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