Address some comments around guarding againt iframe loading issues
This commit is contained in:
parent
10f4469ebb
commit
301f8f0c5b
1 changed files with 12 additions and 5 deletions
|
|
@ -535,7 +535,9 @@ export default {
|
||||||
displayAmount: this.getDisplayAmountDue(),
|
displayAmount: this.getDisplayAmountDue(),
|
||||||
payInAdvanceLineItems: '',
|
payInAdvanceLineItems: '',
|
||||||
shouldBlockInteraction: false,
|
shouldBlockInteraction: false,
|
||||||
afterpayModalOpen: false
|
afterpayModalOpen: false,
|
||||||
|
iframeLoaded: false,
|
||||||
|
iframeResizerLoaded: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
@ -776,6 +778,7 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
iframe.contentWindow.postMessage('CreditCardChosen', '*');
|
iframe.contentWindow.postMessage('CreditCardChosen', '*');
|
||||||
}
|
}
|
||||||
|
this.iframeLoaded = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -855,23 +858,27 @@ export default {
|
||||||
},
|
},
|
||||||
submitPaymentAction() {
|
submitPaymentAction() {
|
||||||
const iframe = this.$refs.paymentFrame;
|
const iframe = this.$refs.paymentFrame;
|
||||||
if (iframe && iframe.contentWindow) {
|
if (iframe && iframe.contentWindow && this.iframeLoaded) {
|
||||||
iframe.contentWindow.postMessage('submitPayment', '*');
|
iframe.contentWindow.postMessage('submitPayment', '*');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
switchToAfterPay() {
|
switchToAfterPay() {
|
||||||
const iframe = this.$refs.paymentFrame;
|
const iframe = this.$refs.paymentFrame;
|
||||||
if (iframe && iframe.contentWindow) {
|
if (iframe && iframe.contentWindow && this.iframeLoaded) {
|
||||||
this.afterpayModalOpen = true;
|
this.afterpayModalOpen = true;
|
||||||
this.lockIFrameSize(iframe);
|
this.lockIFrameSize(iframe);
|
||||||
iframe.contentWindow.postMessage('afterpay-switch', '*');
|
iframe.contentWindow.postMessage('afterpay-switch', '*');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
lockIFrameSize(iframe) {
|
lockIFrameSize(iframe) {
|
||||||
iframe.iFrameResizer.removeListeners();
|
if (iframe && iframe.iFrameResizer) {
|
||||||
|
iframe.iFrameResizer.removeListeners();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
allowIFrameResize(iframe) {
|
allowIFrameResize(iframe) {
|
||||||
iframeResize({ checkOrigin: false }, iframe);
|
if (iframe) {
|
||||||
|
iframeResize({ checkOrigin: false }, iframe);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
showIssLoadingModal
|
showIssLoadingModal
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue