handleBeforeUnload and formatting
This commit is contained in:
hiteshkumar87 2024-11-13 13:57:17 +05:30
parent 7bd2396160
commit 39033e858d
15 changed files with 59 additions and 56 deletions

View file

@ -106,11 +106,7 @@ export async function getImplicitNavigation(toRoute) {
Used to navigate to the heritage funnel with the correct query string and url. Used to navigate to the heritage funnel with the correct query string and url.
*/ */
export async function navigateToHeritageFunnel({ export async function navigateToHeritageFunnel({ shouldSaveSession, pageNameToLog }) {
shouldSaveSession,
pageNameToLog,
callBackMethod = null,
}) {
const log = getQuerystringParameter(queryStrings.LOG); const log = getQuerystringParameter(queryStrings.LOG);
if (eval(log)) { if (eval(log)) {
console.log("------------- Navigate to heritage start -----------------"); console.log("------------- Navigate to heritage start -----------------");
@ -154,7 +150,7 @@ export async function navigateToHeritageFunnel({
window.sessionStorage.removeItem("createNewSessionForHeritage"); window.sessionStorage.removeItem("createNewSessionForHeritage");
} }
router.navigateToExternalUrl(applicationConfig.HERITAGE_FUNNEL, heritageParms, callBackMethod); router.navigateToExternalUrl(applicationConfig.HERITAGE_FUNNEL, heritageParms);
} }
export async function skipVinLookup() { export async function skipVinLookup() {

View file

@ -617,7 +617,7 @@ describe("navigateToHeritageFunnel", () => {
externalUrls.HERITAGE_FUNNEL, externalUrls.HERITAGE_FUNNEL,
expect.objectContaining({ expect.objectContaining({
corid: mockCorrelationId, corid: mockCorrelationId,
}),null })
); );
}); });

View file

@ -13,7 +13,6 @@
</div> </div>
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-md-6 col-xl-4 mt-4"> <div class="col-md-6 col-xl-4 mt-4">
<funnelSubHeader cmsWidgetName="FunnelSubHeaderWidget" ref="funnelSubHeader" /> <funnelSubHeader cmsWidgetName="FunnelSubHeaderWidget" ref="funnelSubHeader" />
<customerQuestions <customerQuestions

View file

@ -8,7 +8,6 @@
</div> </div>
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-md-6 col-xl-4 mt-4"> <div class="col-md-6 col-xl-4 mt-4">
<funnelSubHeader cmsWidgetName="FunnelSubHeaderWidget" /> <funnelSubHeader cmsWidgetName="FunnelSubHeaderWidget" />
<alert <alert

View file

@ -9,7 +9,6 @@
</div> </div>
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-md-6 col-xl-4 mt-4"> <div class="col-md-6 col-xl-4 mt-4">
<funnelSubHeader cmsWidgetName="FunnelSubHeaderWidget" /> <funnelSubHeader cmsWidgetName="FunnelSubHeaderWidget" />
<navbar <navbar

View file

@ -15,9 +15,7 @@
<span v-html="ScheduleConfirmationText"></span> <span v-html="ScheduleConfirmationText"></span>
</div> </div>
<div class="main"> <div class="main">
<div> <div></div>
</div>
<div class="scheduleText"> <div class="scheduleText">
<p>{{ ScheduleDateFormatted }}</p> <p>{{ ScheduleDateFormatted }}</p>

View file

@ -111,6 +111,10 @@ export default {
: ""; : "";
return accountNumber; return accountNumber;
}, },
handleBeforeUnload() {
const insuranceCompanyPage = document.getElementById("insurance-company");
insuranceCompanyPage.parentElement.removeChild(insuranceCompanyPage);
},
arePagePrerequisitesValid() { arePagePrerequisitesValid() {
return store.getters.order.payment.isInsurance === true; return store.getters.order.payment.isInsurance === true;
}, },
@ -140,17 +144,17 @@ export default {
billToAccountNumber, billToAccountNumber,
false false
); );
//Manually unmount component in case navigate to external application.
window.addEventListener("beforeunload", this.handleBeforeUnload);
navigateToHeritageFunnel({ navigateToHeritageFunnel({
shouldSaveSession: true, shouldSaveSession: true,
pageNameToLog: "insurance-company", pageNameToLog: "insurance-company",
callBackMethod: this.unloadPage,
}); });
}, },
unloadPage() { },
const insuranceCompanyPage = document.getElementById("insurance-company"); unmounted() {
insuranceCompanyPage.parentElement.removeChild(insuranceCompanyPage); window.removeEventListener("beforeunload", this.handleBeforeUnload);
},
}, },
components: { components: {
funnelHeader, funnelHeader,

View file

@ -8,7 +8,6 @@
</div> </div>
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-md-6 col-xl-4 mt-4"> <div class="col-md-6 col-xl-4 mt-4">
<funnelSubHeader cmsWidgetName="FunnelSubHeaderWidget" /> <funnelSubHeader cmsWidgetName="FunnelSubHeaderWidget" />
<textboxQuestion <textboxQuestion

View file

@ -9,7 +9,6 @@
</div> </div>
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-md-6 col-xl-4 mt-4"> <div class="col-md-6 col-xl-4 mt-4">
<funnelSubHeader class="mb-5" cmsWidgetName="FunnelSubHeaderWidget" /> <funnelSubHeader class="mb-5" cmsWidgetName="FunnelSubHeaderWidget" />
<hr class="my-0" /> <hr class="my-0" />
@ -420,7 +419,8 @@ export default {
customer.emailAddress customer.emailAddress
); );
const preReqResult = serviceLocationReqs && isInsuranceSet() && scheduleReqs && customerReqs; const preReqResult =
serviceLocationReqs && isInsuranceSet() && scheduleReqs && customerReqs;
// prettier-ignore // prettier-ignore
{ {
@ -443,7 +443,7 @@ export default {
console.log(new Date() + " customerReqs::customer.emailAddress:" + customer.emailAddress); console.log(new Date() + " customerReqs::customer.emailAddress:" + customer.emailAddress);
console.log("------------- payment-method.vue pagePrereqs end -----------------"); console.log("------------- payment-method.vue pagePrereqs end -----------------");
} }
} }
return preReqResult; return preReqResult;
}, },

View file

@ -139,7 +139,10 @@
type="hidden" type="hidden"
name="sgtermsofusedisplaytext" name="sgtermsofusedisplaytext"
value="By selecting submit, I agree to Safelite's" /> value="By selecting submit, I agree to Safelite's" />
<input type="hidden" name="sgtermsofuseurl" value="http://www.safelite.com/terms-of-service/" /> <input
type="hidden"
name="sgtermsofuseurl"
value="http://www.safelite.com/terms-of-service/" />
<input type="hidden" name="sgtermsofuselinkdisplaytext" value="Terms of service" /> <input type="hidden" name="sgtermsofuselinkdisplaytext" value="Terms of service" />
<input type="hidden" name="sgtermsofcancelrefunddisplaytext" value="and" /> <input type="hidden" name="sgtermsofcancelrefunddisplaytext" value="and" />
<input <input

View file

@ -447,15 +447,14 @@ export default {
arePagePrerequisitesValid() { arePagePrerequisitesValid() {
const payment = store.getters.order.payment; const payment = store.getters.order.payment;
const preReqResult = ( const preReqResult =
store.getters.order.serviceLocation.zipCode && store.getters.order.serviceLocation.zipCode &&
store.getters.order.serviceLocation.zipCodeCtu && store.getters.order.serviceLocation.zipCodeCtu &&
(store.getters.order.damage.isRepair || (store.getters.order.damage.isRepair ||
(store.getters.order.lineItems?.glassParts != null && (store.getters.order.lineItems?.glassParts != null &&
store.getters.order.lineItems.glassParts.length > 0)) && store.getters.order.lineItems.glassParts.length > 0)) &&
(payment.insuranceCoverage?.isVerified == null || (payment.insuranceCoverage?.isVerified == null ||
payment.insuranceCoverage?.isVerified === false) payment.insuranceCoverage?.isVerified === false);
);
// prettier-ignore // prettier-ignore
{ {
@ -592,7 +591,10 @@ export default {
}); });
} }
let price = 0; let price = 0;
if (tier.additionalButtonData?.servicePackageDiscount && this.isServicePackageDiscountOnOrder) { if (
tier.additionalButtonData?.servicePackageDiscount &&
this.isServicePackageDiscountOnOrder
) {
lineItemsToPrice.push(...this.servicePackageDiscountParts); lineItemsToPrice.push(...this.servicePackageDiscountParts);
} }
price += baseMixin.methods.getTierOnePackagePrice( price += baseMixin.methods.getTierOnePackagePrice(

View file

@ -447,8 +447,10 @@ export default {
this.updateSupportingItems(); this.updateSupportingItems();
if (this.selectedTimeSlotInfo.timeSlot.jobMinMinutes == null) { if (this.selectedTimeSlotInfo.timeSlot.jobMinMinutes == null) {
this.selectedTimeSlotInfo.timeSlot.jobMinMinutes = this.selectableDatesData?.estimatedServiceMinutesMinimum?.toString(); this.selectedTimeSlotInfo.timeSlot.jobMinMinutes =
this.selectedTimeSlotInfo.timeSlot.jobMaxMinutes = this.selectableDatesData?.estimatedServiceMinutesMaximum?.toString(); this.selectableDatesData?.estimatedServiceMinutesMinimum?.toString();
this.selectedTimeSlotInfo.timeSlot.jobMaxMinutes =
this.selectableDatesData?.estimatedServiceMinutesMaximum?.toString();
} }
this.dispatchStoreAction( this.dispatchStoreAction(

View file

@ -410,7 +410,7 @@ export default {
console.log(new Date() + "Cash: servce-location invalid prereqs"); console.log(new Date() + "Cash: servce-location invalid prereqs");
console.log(new Date() + "store.getters.lineItems.supportingItems:" + JSON.stringify(store.getters.lineItems.supportingItems)); console.log(new Date() + "store.getters.lineItems.supportingItems:" + JSON.stringify(store.getters.lineItems.supportingItems));
console.log(new Date() + "store.getters.order.serviceLocation.zipCode:" + store.getters.order.serviceLocation.zipCode); console.log(new Date() + "store.getters.order.serviceLocation.zipCode:" + store.getters.order.serviceLocation.zipCode);
} }
return false; return false;
} }
} }

View file

@ -361,8 +361,8 @@ router.navigateWithSaving = (
navigate(scenario, currentRoute, true, optionalQuery, optionalParams, optionalPageData); navigate(scenario, currentRoute, true, optionalQuery, optionalParams, optionalPageData);
}; };
router.navigateToExternalUrl = (url, optionalQuery = {}, callBackMethod = null) => { router.navigateToExternalUrl = (url, optionalQuery = {}) => {
navigateToUrl(url, optionalQuery, callBackMethod); navigateToUrl(url, optionalQuery);
}; };
router.navigateError = () => { router.navigateError = () => {
@ -493,16 +493,13 @@ function getNavigationMap(scenario, currentRoute) {
//---------------------------------------------------------- Private Functions ---------------------------------------------------------- //---------------------------------------------------------- Private Functions ----------------------------------------------------------
// Navigate to an external url. // Navigate to an external url.
function navigateToUrl(url, optionalQuery = {}, callBackMethod = null) { function navigateToUrl(url, optionalQuery = {}) {
// possibly show some loading screen in the future here. // possibly show some loading screen in the future here.
var externalUrl = new URL(url); var externalUrl = new URL(url);
for (const queryKey in optionalQuery) { for (const queryKey in optionalQuery) {
externalUrl.searchParams.append(queryKey, optionalQuery[queryKey]); externalUrl.searchParams.append(queryKey, optionalQuery[queryKey]);
} }
//cleanup method before navigate to external
callBackMethod?.();
showFmgLoadingModal(true);
window.location.assign(externalUrl); window.location.assign(externalUrl);
} }

View file

@ -79,50 +79,55 @@ caption,
// Averta Fonts // Averta Fonts
@font-face { @font-face {
font-family: 'AvertaBold'; font-family: "AvertaBold";
src: url('@/assets/fonts/averta-bold-webfont.woff2') format('woff2'), src:
url('@/assets/fonts/averta-bold-webfont.woff') format('woff'); url("@/assets/fonts/averta-bold-webfont.woff2") format("woff2"),
url("@/assets/fonts/averta-bold-webfont.woff") format("woff");
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
} }
@font-face { @font-face {
font-family: 'AvertaBold_Italic'; font-family: "AvertaBold_Italic";
src: url('@/assets/fonts/averta-bolditalic-webfont.woff2') format('woff2'), src:
url('@/assets/fonts/averta-bolditalic-webfont.woff') format('woff'); url("@/assets/fonts/averta-bolditalic-webfont.woff2") format("woff2"),
url("@/assets/fonts/averta-bolditalic-webfont.woff") format("woff");
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
} }
@font-face { @font-face {
font-family: 'AvertaExtraBold'; font-family: "AvertaExtraBold";
src: url('@/assets/fonts/averta-extrabold-webfont.woff2') format('woff2'), src:
url('@/assets/fonts/averta-extrabold-webfont.woff') format('woff'); url("@/assets/fonts/averta-extrabold-webfont.woff2") format("woff2"),
url("@/assets/fonts/averta-extrabold-webfont.woff") format("woff");
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
} }
@font-face { @font-face {
font-family: 'AvertaRegular'; font-family: "AvertaRegular";
src: url('@/assets/fonts/averta-regular-webfont.woff2') format('woff2'), src:
url('@/assets/fonts/averta-regular-webfont.woff') format('woff'); url("@/assets/fonts/averta-regular-webfont.woff2") format("woff2"),
url("@/assets/fonts/averta-regular-webfont.woff") format("woff");
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
} }
@font-face { @font-face {
font-family: 'AvertaRegular_Italic'; font-family: "AvertaRegular_Italic";
src: url('@/assets/fonts/averta-regularitalic-webfont.woff2') format('woff2'), src:
url('@/assets/fonts/averta-regularitalic-webfont.woff') format('woff'); url("@/assets/fonts/averta-regularitalic-webfont.woff2") format("woff2"),
url("@/assets/fonts/averta-regularitalic-webfont.woff") format("woff");
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
} }
@font-face { @font-face {
font-family: 'AvertaSemibold'; font-family: "AvertaSemibold";
src: url('@/assets/fonts/averta-semibold-webfont.woff2') format('woff2'), src:
url('@/assets/fonts/averta-semibold-webfont.woff') format('woff'); url("@/assets/fonts/averta-semibold-webfont.woff2") format("woff2"),
url("@/assets/fonts/averta-semibold-webfont.woff") format("woff");
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
}
}