From 702d03f9742a9a382841b33170e9e838b52ed496 Mon Sep 17 00:00:00 2001 From: Matt Caimi Date: Fri, 10 Nov 2023 11:44:37 -0500 Subject: [PATCH] CSR-1462 break confirmation page out of iframe --- src/layouts/confirmation/confirmation.vue | 2 -- src/layouts/payment-pia-return/payment-pia-return.vue | 1 + src/router/index.js | 11 ++++++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/layouts/confirmation/confirmation.vue b/src/layouts/confirmation/confirmation.vue index 94a7054e7..903df1dc6 100644 --- a/src/layouts/confirmation/confirmation.vue +++ b/src/layouts/confirmation/confirmation.vue @@ -73,8 +73,6 @@ import { get12HourTimeFormat, get12HourTimeMobileFormat } from "@/helpers/date-h export default { name: "confirmation", async beforeRouteEnter(to, from, next) { - await baseMixin.methods.dispatchStoreAction(storeActions.CREATE_SUBMITTED_ORDER); - // Call APIs const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage); diff --git a/src/layouts/payment-pia-return/payment-pia-return.vue b/src/layouts/payment-pia-return/payment-pia-return.vue index 54e49c620..8088cbb06 100644 --- a/src/layouts/payment-pia-return/payment-pia-return.vue +++ b/src/layouts/payment-pia-return/payment-pia-return.vue @@ -131,6 +131,7 @@ export default { } this.$refs.loadingModal.isModalVisible = false; + await baseMixin.methods.dispatchStoreAction(storeActions.CREATE_SUBMITTED_ORDER); this.$router.navigateWithoutSaving(this.navigationScenarios.PIA_SUCCESS, this.$route); }, forwardButtonAction() { diff --git a/src/router/index.js b/src/router/index.js index cec3ff193..f7ff73a94 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -169,7 +169,16 @@ router.beforeEach(async (to, from, next) => { showFmgLoadingModal(true); } - next(); + const toQueryPage = to.query?.fmgPage; + const notToPIAReturn = toQueryPage != "payment-pia-return"; + const isInIframe = window !== window.top; + + if (isInIframe && notToPIAReturn) { + const newUrl = `${window.top.location.origin}${to.href}`; + window.top.location.href = newUrl; + } else { + next(); + } }); router.afterEach(async (to, from) => {