From 301f8f0c5b37319dc742d6b06e0435d1045ef096 Mon Sep 17 00:00:00 2001 From: Alex Humphries Date: Fri, 6 Mar 2026 10:20:02 -0500 Subject: [PATCH] Address some comments around guarding againt iframe loading issues --- src/layouts/payment-page/payment-page.vue | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/layouts/payment-page/payment-page.vue b/src/layouts/payment-page/payment-page.vue index bb10db65..d116b502 100644 --- a/src/layouts/payment-page/payment-page.vue +++ b/src/layouts/payment-page/payment-page.vue @@ -535,7 +535,9 @@ export default { displayAmount: this.getDisplayAmountDue(), payInAdvanceLineItems: '', shouldBlockInteraction: false, - afterpayModalOpen: false + afterpayModalOpen: false, + iframeLoaded: false, + iframeResizerLoaded: false }; }, computed: { @@ -776,6 +778,7 @@ export default { } else { iframe.contentWindow.postMessage('CreditCardChosen', '*'); } + this.iframeLoaded = true; } }; } @@ -855,23 +858,27 @@ export default { }, submitPaymentAction() { const iframe = this.$refs.paymentFrame; - if (iframe && iframe.contentWindow) { + if (iframe && iframe.contentWindow && this.iframeLoaded) { iframe.contentWindow.postMessage('submitPayment', '*'); } }, switchToAfterPay() { const iframe = this.$refs.paymentFrame; - if (iframe && iframe.contentWindow) { + if (iframe && iframe.contentWindow && this.iframeLoaded) { this.afterpayModalOpen = true; this.lockIFrameSize(iframe); iframe.contentWindow.postMessage('afterpay-switch', '*'); } }, lockIFrameSize(iframe) { - iframe.iFrameResizer.removeListeners(); + if (iframe && iframe.iFrameResizer) { + iframe.iFrameResizer.removeListeners(); + } }, allowIFrameResize(iframe) { - iframeResize({ checkOrigin: false }, iframe); + if (iframe) { + iframeResize({ checkOrigin: false }, iframe); + } }, showIssLoadingModal }