From 7298f0b62f26ec99cb9f4dd4e793bb1d708d08ae Mon Sep 17 00:00:00 2001 From: Alex Humphries Date: Fri, 30 Jan 2026 14:41:13 -0500 Subject: [PATCH] INSR-7752; Some routing adjustments and related store tweaks for contactinfo --- .../contact-details/contact-details.vue | 9 +--- .../order-confirmation/order-confirmation.vue | 2 +- src/layouts/payment-method/payment-method.vue | 24 +++++++++- src/layouts/payment-page/payment-page.vue | 10 ++-- .../service-packages/service-packages.vue | 6 ++- .../router-constants/navigation-scenarios.js | 6 +++ src/router/router-constants/routing-table.js | 42 ++++++++-------- src/store/index.js | 48 ++++++++----------- 8 files changed, 82 insertions(+), 65 deletions(-) diff --git a/src/layouts/contact-details/contact-details.vue b/src/layouts/contact-details/contact-details.vue index 7e0b22f1..31091acb 100644 --- a/src/layouts/contact-details/contact-details.vue +++ b/src/layouts/contact-details/contact-details.vue @@ -220,14 +220,7 @@ export default { }); } - const scenario = - useMainStore().order.serviceLocation.IsSafeliteProvider - === false - ? this.navigationScenarios - .CLICKED_FORWARD_WITH_NON_SAFELITE_SHOP - : this.navigationScenarios - .CLICKED_FORWARD_WITH_SAFELITE_SHOP; - this.$router.navigate(scenario, this.$route); + this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD, this.$route); } } }; diff --git a/src/layouts/order-confirmation/order-confirmation.vue b/src/layouts/order-confirmation/order-confirmation.vue index 98edaf23..c3514995 100644 --- a/src/layouts/order-confirmation/order-confirmation.vue +++ b/src/layouts/order-confirmation/order-confirmation.vue @@ -373,7 +373,7 @@ export default { ); // Contact Info - const { contactInfo } = useMainStore().order; + const { contactInfo } = useMainStore(); const contactInfoReqs = !!( contactInfo.firstName && contactInfo.lastName diff --git a/src/layouts/payment-method/payment-method.vue b/src/layouts/payment-method/payment-method.vue index d0d6c341..fb54676f 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -52,7 +52,7 @@ cmsWidgetName="SiteFooterWidget" :isForwardActionDisabled="!meta.valid" :isStackedVertically="true" - @backClicked="navigateBack" + @backClicked="backButtonAction" @ForwardClicked="forwardButtonAction" /> @@ -176,6 +176,7 @@ export default { && vehicle.model && vehicle.style ); + console.log('vehicleReqs:', vehicleReqs); // Damage const { isRepair, numberOfChips, glassToReplace } = @@ -184,6 +185,7 @@ export default { (isRepair && numberOfChips) || (!isRepair && glassToReplace?.length) ); + console.log('damageReqs:', damageReqs); // Service Package const { lineItems } = useMainStore().order; @@ -191,15 +193,18 @@ export default { (isRepair || lineItems.glassParts) && lineItems.supportingItems ); + console.log('packageReqs:', packageReqs); // Service Location const { serviceLocation } = useMainStore().order; + console.log('serviceLocation:', serviceLocation); const mobileReqs = !!( serviceLocation.address && serviceLocation.city && serviceLocation.state && serviceLocation.zipCode ); + console.log('mobileReqs:', mobileReqs); const providerLocation = serviceLocation.provider.address; const dropOffInshopReqs = !!( @@ -208,11 +213,13 @@ export default { && providerLocation.state && providerLocation.zipCode ); + console.log('dropOffInshopReqs:', dropOffInshopReqs); const isMobile = serviceLocation.appointmentType === AppointmentTypeStrings.MOBILE || serviceLocation.appointmentType === AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP; const serviceLocationReqs = (isMobile && mobileReqs) || (!isMobile && dropOffInshopReqs); + console.log('serviceLocationReqs:', serviceLocationReqs); // Schedule const { date, startTime, endTime, jobMaxMinutes, jobMinMinutes } = @@ -224,19 +231,23 @@ export default { && jobMaxMinutes && jobMinMinutes ); + console.log('scheduleReqs:', scheduleReqs); // Customer const { firstName, lastName, emailAddress } = useMainStore().order.customer; const customerReqs = !!(firstName && lastName && emailAddress); + console.log('customerReqs:', customerReqs); // Contact Info - const { contactInfo } = useMainStore().order; + const { contactInfo } = useMainStore(); + console.log('contactInfo:', contactInfo); const contactInfoReqs = !!( contactInfo.firstName && contactInfo.lastName && contactInfo.servicePhone && contactInfo.emailAddress ); + console.log('contactInfoReqs:', contactInfoReqs); return ( vehicleReqs @@ -291,6 +302,15 @@ export default { { [routerParams.SKIP_SAVE_SESSION]: true } ); } + }, + backButtonAction() { + const scenario = this.mainStore.isMobileAppointment + ? this.navigationScenarios.CLICKED_BACK_MOBILE + : this.navigationScenarios.CLICKED_BACK_INSHOP; + this.$router.navigate( + scenario, + this.$route + ); } } }; diff --git a/src/layouts/payment-page/payment-page.vue b/src/layouts/payment-page/payment-page.vue index 8ac64f7c..7dd6b673 100644 --- a/src/layouts/payment-page/payment-page.vue +++ b/src/layouts/payment-page/payment-page.vue @@ -479,15 +479,15 @@ export default { authSignature: '', authSignatureStart: '', referralSequenceNumber: useMainStore().order.referralSequenceNumber, - emailAddress: useMainStore().order.contactInfo.emailAddress, + emailAddress: useMainStore().contactInfo.emailAddress, address1: this.getAddress1(), address2: this.getAddress2(), city: this.getCity(), state: this.getState(), zipCode: this.getZipCode(), - firstName: useMainStore().order.contactInfo.firstName, - lastName: useMainStore().order.contactInfo.lastName, - phoneNumber: useMainStore().order.contactInfo.servicePhone, + firstName: useMainStore().contactInfo.firstName, + lastName: useMainStore().contactInfo.lastName, + phoneNumber: useMainStore().contactInfo.servicePhone, ctu: useMainStore().order.serviceLocation.provider?.address?.zipCodeCtu ?? useMainStore().order.serviceLocation.zipCodeCtu, referralCorrelationId: useMainStore().order.referralCorrelationId, workOrderNumber: this.getWorkOrderNumber(), @@ -593,7 +593,7 @@ export default { ); // Contact Info - const { contactInfo } = useMainStore().order; + const { contactInfo } = useMainStore(); const contactInfoReqs = !!( contactInfo.firstName && contactInfo.lastName diff --git a/src/layouts/service-packages/service-packages.vue b/src/layouts/service-packages/service-packages.vue index 692546ce..1bed0a7c 100644 --- a/src/layouts/service-packages/service-packages.vue +++ b/src/layouts/service-packages/service-packages.vue @@ -195,8 +195,12 @@ export default { } store.updateVaps(this.selectedVaps); + const scenario = store.isMobileAppointment + ? this.navigationScenarios.CLICKED_FORWARD_MOBILE + : this.navigationScenarios.CLICKED_FORWARD_INSHOP; + this.$router.navigate( - this.navigationScenarios.CLICKED_FORWARD, + scenario, this.$route ); } diff --git a/src/router/router-constants/navigation-scenarios.js b/src/router/router-constants/navigation-scenarios.js index 9e86b8cf..9bfa0c2b 100644 --- a/src/router/router-constants/navigation-scenarios.js +++ b/src/router/router-constants/navigation-scenarios.js @@ -93,6 +93,10 @@ const navigationScenarios = Object.freeze({ CLICKED_FORWARD_WITH_TPA_DISABLED: 'CLICKED_FORWARD_WITH_TPA_DISABLED', CLICKED_FORWARD_WITH_POLICY_AND_VEHICLES: 'CLICKED_FORWARD_WITH_POLICY_AND_VEHICLES', + // Service Package + CLICKED_FORWARD_INSHOP: 'CLICKED_FORWARD_INSHOP', + CLICKED_FORWARD_MOBILE: 'CLICKED_FORWARD_MOBILE', + // Review Page CLICKED_CUSTOMER_EDIT: 'CLICKED_CUSTOMER_EDIT', CLICKED_DAMAGE_EDIT: 'CLICKED_DAMAGE_EDIT', @@ -102,6 +106,8 @@ const navigationScenarios = Object.freeze({ CLICKED_VEHICLE_EDIT: 'CLICKED_VEHICLE_EDIT', // Payment + CLICKED_BACK_INSHOP: 'CLICKED_BACK_INSHOP', + CLICKED_BACK_MOBILE: 'CLICKED_BACK_MOBILE', CLICKED_PAY_NOW: 'CLICKED_PAY_NOW', PAY_IN_ADVANCE_ERROR: 'PAY_IN_ADVANCE_ERROR', PAY_IN_ADVANCE_CREDIT_CARD_ERROR: 'PAY_IN_ADVANCE_CREDIT_CARD_ERROR', diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js index c526dc47..55166fe0 100644 --- a/src/router/router-constants/routing-table.js +++ b/src/router/router-constants/routing-table.js @@ -597,7 +597,7 @@ const routingTable = () => [ }, { scenario: navigationScenarios.CLICKED_FORWARD, - destinationIssPageValue: issPageValues.CONTACT_DETAILS + destinationIssPageValue: issPageValues.SERVICE_PACKAGES }, { scenario: navigationScenarios.CLICKED_CHANGE_LOCATION, @@ -610,25 +610,8 @@ const routingTable = () => [ maps: [ { scenario: navigationScenarios.CLICKED_BACK, - destinationIssPageValue: issPageValues.SCHEDULE_PAGE - }, - { - scenario: navigationScenarios.CLICKED_FORWARD_WITH_SAFELITE_SHOP, destinationIssPageValue: issPageValues.SERVICE_PACKAGES }, - { - scenario: navigationScenarios.CLICKED_FORWARD_WITH_NON_SAFELITE_SHOP, - destinationIssPageValue: issPageValues.TPA_SUBMIT - } - ] - }, - { - issPageValue: issPageValues.SERVICE_PACKAGES, - maps: [ - { - scenario: navigationScenarios.CLICKED_BACK, - destinationIssPageValue: issPageValues.CONTACT_DETAILS - }, { scenario: navigationScenarios.CLICKED_FORWARD, destinationIssPageValue: issPageValues.PAYMENT_METHOD @@ -636,12 +619,33 @@ const routingTable = () => [ ] }, { - issPageValue: issPageValues.PAYMENT_METHOD, + issPageValue: issPageValues.SERVICE_PACKAGES, maps: [ { scenario: navigationScenarios.CLICKED_BACK, + destinationIssPageValue: issPageValues.SCHEDULE_PAGE + }, + { + scenario: navigationScenarios.CLICKED_FORWARD_INSHOP, + destinationIssPageValue: issPageValues.PAYMENT_METHOD + }, + { + scenario: navigationScenarios.CLICKED_FORWARD_MOBILE, + destinationIssPageValue: issPageValues.CONTACT_DETAILS + } + ] + }, + { + issPageValue: issPageValues.PAYMENT_METHOD, + maps: [ + { + scenario: navigationScenarios.CLICKED_BACK_INSHOP, destinationIssPageValue: issPageValues.SERVICE_PACKAGES }, + { + scenario: navigationScenarios.CLICKED_BACK_MOBILE, + destinationIssPageValue: issPageValues.CONTACT_DETAILS + }, { scenario: navigationScenarios.CLICKED_FORWARD, destinationIssPageValue: issPageValues.ORDER_CONFIRMATION diff --git a/src/store/index.js b/src/store/index.js index 17a811af..440c15f3 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -349,17 +349,20 @@ export const useMainStore = defineStore({ lastName: state.order.customer.lastName }; }, - contactInfo: (s) => ({ - firstName: s.order.contactInfo.firstName ?? s.order.customer.firstName, - lastName: s.order.contactInfo.lastName ?? s.order.customer.lastName, - emailAddress: s.order.contactInfo.emailAddress ?? s.order.customer.emailAddress, - homePhone: s.order.contactInfo.homePhone, - alternativePhone: s.order.contactInfo.alternativePhone, - servicePhone: s.order.contactInfo.servicePhone, - extension: s.order.contactInfo.extension, - requestTextUpdates: s.order.contactInfo.requestTextUpdates ?? false, - notesForTechnician: s.order.contactInfo.notesForTechnician - }), + contactInfo: (s) => { + const obj = { + firstName: s.order.contactInfo.firstName ?? s.order.customer.firstName, + lastName: s.order.contactInfo.lastName ?? s.order.customer.lastName, + emailAddress: s.order.contactInfo.emailAddress ?? s.order.customer.emailAddress, + homePhone: s.order.contactInfo.homePhone, + alternativePhone: s.order.contactInfo.alternativePhone, + servicePhone: s.order.contactInfo.servicePhone, + extension: s.order.contactInfo.extension, + requestTextUpdates: s.order.contactInfo.requestTextUpdates ?? false, + notesForTechnician: s.order.contactInfo.notesForTechnician + }; + return obj; + }, scheduleDisplayText: (s) => { const dateModel = convertDateStringToDate(s.order.schedule.date); const readableDate = dateModel?.toLocaleDateString('en-us', { @@ -875,7 +878,7 @@ export const useMainStore = defineStore({ logApiCall: true }); }, - getMobileTimeSlots(startDate, endDate) { + getMobileTimeSlots(startDate, endDate, zipCodeOverride = null) { const { order } = this; const { vehicle } = this.order; let lineItems = [ @@ -921,8 +924,9 @@ export const useMainStore = defineStore({ style: vehicle.style, vin: vehicle.vin ?? '' }, - zipCode: order.serviceLocation.zipCode + zipCode: zipCodeOverride ?? order.serviceLocation.zipCode }; + return globalMethods.callHttpClient({ method: endpoints.GetMobileTimeSlots.method, endpoint: endpoints.GetMobileTimeSlots.url, @@ -931,7 +935,7 @@ export const useMainStore = defineStore({ additionalSuccessEventDataHandler: (response) => getTimeSlotsAdditionalEventData( response.data.provisionalTriggers, - order.serviceLocation.zipCode, + zipCodeOverride ?? order.serviceLocation.zipCode, response.data.days?.[0]?.date ) }); @@ -2717,19 +2721,6 @@ export const useMainStore = defineStore({ }, saveServiceLocation(serviceLocationInfo) { - if (this.order.serviceLocation) { - if ( - serviceLocationInfo.zipCode !== this.order.serviceLocation.zipCode - || !providersEqual( - serviceLocationInfo.provider, - this.order.serviceLocation.provider - ) - || serviceLocationInfo.appointmentType - !== this.order.serviceLocation.appointmentType - ) { - this.resetSchedule(); - } - } this.updateServiceLocation(serviceLocationInfo); }, @@ -2881,11 +2872,10 @@ export const useMainStore = defineStore({ return JSON.parse(window.sessionStorage.getItem(webStorageConstants.SUBMITTED_ORDER)); }, - async createSubmittedOrder(submitType) { + createSubmittedOrder(submitType) { if (this.hasSubmittedOrder()) { return; } - await this.getCarrierAccountInfo(); const submittedOrder = this.order; const { experiments } = this.applicationUser; const { issConfig } = this;