Skip to content

Commit b716df7

Browse files
authored
Merge pull request #508 from PayButton/feat/autoclose-false-default
Feat/autoclose false default
2 parents 24e2923 + 61c0d73 commit b716df7

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

paybutton/dev/demo/paybutton-generator.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,11 @@
181181
false-value="false">
182182
<label for="disabled">Disabled</label>
183183
</div>
184+
<div class="form-input toggle">
185+
<input type="checkbox" id="autoClose" v-model="paybuttonProps.autoClose" true-value="true"
186+
false-value="false">
187+
<label for="autoClose">Auto Close</label>
188+
</div>
184189
</div>
185190
</div>
186191
<div style="display: flex; justify-content: right; position: relative;">
@@ -213,6 +218,7 @@
213218
:on-transaction="myTransactionFuction"
214219
:disable-altpayment="paybuttonProps.disableAltpayment"
215220
:transaction-text="paybuttonProps.transactionText"
221+
:auto-close="paybuttonProps.autoClose"
216222
:op-return="paybuttonProps.opReturn">
217223
</div>
218224
</div>
@@ -247,7 +253,8 @@
247253
opReturn:undefined,
248254
transactiontext: '',
249255
onSuccess: mySuccessFuction,
250-
onTransaction: myTransactionFuction
256+
onTransaction: myTransactionFuction,
257+
autoClose: true
251258
});
252259
const paybuttonType = ref("paybutton");
253260
const updateProps = () => {

react/lib/components/PayButton/PayButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ const payButtonDefaultProps: PayButtonProps = {
367367
disableEnforceFocus: false,
368368
disabled: false,
369369
editable: false,
370-
autoClose: true,
370+
autoClose: false,
371371
};
372372

373373
PayButton.defaultProps = payButtonDefaultProps;

react/lib/components/PaymentDialog/PaymentDialog.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,7 @@ export const PaymentDialog = (
140140
setSuccess(true);
141141
onSuccess?.(transaction);
142142
setTimeout(() => {
143-
setSuccess(false);
144-
if (autoClose === true) {
143+
if (isPropsTrue(autoClose)) {
145144
handleWidgetClose();
146145
}
147146
}, 3000);

react/lib/components/Widget/WidgetContainer.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,6 @@ export const WidgetContainer: React.FunctionComponent<WidgetContainerProps> =
201201
);
202202
setSuccess(true);
203203
onSuccess?.(transaction);
204-
setTimeout(() => {
205-
setSuccess(false);
206-
}, 3000);
207204
} else {
208205
onTransaction?.(transaction);
209206
if (transactionText){

0 commit comments

Comments
 (0)