Fix closing payment popup on error
This commit is contained in:
parent
7e20fdec2f
commit
d0c724412b
|
@ -226,7 +226,7 @@ export default class PopupPaymentCard extends PopupElement<{
|
|||
if(SUPPORTED_NATIVE_PROVIDERS.has(paymentForm.native_provider as PaymentsNativeProvider)) {
|
||||
this.d();
|
||||
} else {
|
||||
const iframe = createVerificationIframe(paymentForm.url, (event) => {
|
||||
const {iframe, onMount} = createVerificationIframe(paymentForm.url, (event) => {
|
||||
if(event.eventType !== 'payment_form_submit') {
|
||||
return;
|
||||
}
|
||||
|
@ -257,6 +257,7 @@ export default class PopupPaymentCard extends PopupElement<{
|
|||
// putPreloader(this.body, true);
|
||||
this.body.append(iframe);
|
||||
this.show();
|
||||
onMount();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,11 +27,12 @@ export function createVerificationIframe(url: string, callback: TelegramWebviewE
|
|||
iframe.classList.add('payment-verification');
|
||||
iframe.src = url;
|
||||
|
||||
iframe.addEventListener('load', () => {
|
||||
weakMap.set(iframe.contentWindow, callback);
|
||||
}, {once: true});
|
||||
|
||||
return iframe;
|
||||
return {
|
||||
iframe,
|
||||
onMount: () => {
|
||||
weakMap.set(iframe.contentWindow, callback);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export default class PopupPaymentVerification extends PopupElement<{
|
||||
|
@ -49,7 +50,7 @@ export default class PopupPaymentVerification extends PopupElement<{
|
|||
}
|
||||
|
||||
private d() {
|
||||
const iframe = createVerificationIframe(this.url, (event) => {
|
||||
const {iframe, onMount} = createVerificationIframe(this.url, (event) => {
|
||||
if(event.eventType !== 'web_app_open_tg_link') {
|
||||
return;
|
||||
}
|
||||
|
@ -63,5 +64,6 @@ export default class PopupPaymentVerification extends PopupElement<{
|
|||
|
||||
this.body.append(iframe);
|
||||
this.show();
|
||||
onMount();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue