diff --git a/src/constants/query-strings.js b/src/constants/query-strings.js index 4a5c47943..9fb379836 100644 --- a/src/constants/query-strings.js +++ b/src/constants/query-strings.js @@ -36,6 +36,7 @@ const queryStrings = { VIN_SELECTION: "vinselection", SERVICE_PACKAGE: "servicepackage", NUMBER_OF_CHIPS: "numberofchips", + LOG: "log", UTM_SOURCE: "_source", UTM_MEDIUM: "_medium", UTM_CAMPAIGN: "_campaign", diff --git a/src/digital-components/base-input-button/base-input-button.spec.js b/src/digital-components/base-input-button/base-input-button.spec.js index 507c1ec59..9b9585dd0 100644 --- a/src/digital-components/base-input-button/base-input-button.spec.js +++ b/src/digital-components/base-input-button/base-input-button.spec.js @@ -1123,42 +1123,6 @@ describe("baseInputButton.vue", () => { }); }); - describe("buttonId", () => { - test("groupName and value combo yield correct id for input button with string value", () => { - // Arrange/Act - const { wrapper } = setupMocks({ - mockData: { - propsData: { - groupName: "my test-name", - value: "Aaa-BBB CcC", - }, - }, - }); - - // Assert - const inputElement = wrapper.find("input"); - expect(wrapper.vm.buttonId).toBe("my-test-name-Aaa-BBB-CcC"); - expect(inputElement.attributes().id).toBe("my-test-name-Aaa-BBB-CcC"); - }); - - test("groupName and value combo yield correct id for input button with number value", () => { - // Arrange/Act - const { wrapper } = setupMocks({ - mockData: { - propsData: { - groupName: "my test-name", - value: 2, - }, - }, - }); - - // Assert - const inputElement = wrapper.find("input"); - expect(wrapper.vm.buttonId).toBe("my-test-name-2"); - expect(inputElement.attributes().id).toBe("my-test-name-2"); - }); - }); - describe("inputType", () => { test("isMultiSelect is true => inputType is 'checkbox'", () => { // Arrange/Act diff --git a/src/digital-components/base-input-button/base-input-button.vue b/src/digital-components/base-input-button/base-input-button.vue index e9b5e6411..a21233362 100644 --- a/src/digital-components/base-input-button/base-input-button.vue +++ b/src/digital-components/base-input-button/base-input-button.vue @@ -34,6 +34,7 @@ import { handleInputComponentBlur, } from "@/helpers/button-question-focus-helper"; import { inputButtonProps } from "@/digital-components/base-input-button/button-functionality-props"; +import { v4 as uuidv4 } from "uuid"; export default { name: "base-input-button", @@ -45,6 +46,7 @@ export default { data() { return { valueToEmit: null, + buttonId: uuidv4(), }; }, mounted() { @@ -153,11 +155,6 @@ export default { inputType() { return this.isMultiSelect ? "checkbox" : "radio"; }, - buttonId() { - return `${this.groupName?.replace(" ", "-")}-${this.value - ?.toString() - ?.replace(" ", "-")}`; - }, isValueSelectedOnClick() { return this.isMultiSelect || this.selectingInitiatesLoad; }, diff --git a/src/fmg-components/cart/cart.vue b/src/fmg-components/cart/cart.vue index f352ce2c7..caac2b708 100644 --- a/src/fmg-components/cart/cart.vue +++ b/src/fmg-components/cart/cart.vue @@ -139,7 +139,7 @@
Promo code {{ promoCode }} applied @@ -183,6 +183,7 @@ export default { allowItemRemoval: Boolean, recyclingModalCmsWidgetName: String, showAsPaid: Boolean, + isInsurance: Boolean, insuranceDeductible: Number, insuranceCompanyName: String, showInsuranceCoverageAs: String, @@ -282,6 +283,7 @@ export default { (lineItemsToKeep) => lineItemsToKeep.cartItemType != cartItemType ); }, + getPromoCodeList() { if (this.$refs["promoModalQuestion"]) { return this.$refs["promoModalQuestion"].getPromoCodeList(); @@ -298,6 +300,14 @@ export default { this.$emit("update:modelValue", newValue); }, }, + lineItemsWithoutRecal() { + if (!this.lineItems || this.lineItems.length < 1) return; + const lineItemsCopy = deepClone(this.lineItems); + lineItemsCopy.supportingItems = baseMixin.methods.filterOutRecalibration( + lineItemsCopy.supportingItems + ); + return lineItemsCopy; + }, showCoverageAsPending() { return this.showInsuranceCoverageAs === coverageStatus.PENDING; }, @@ -426,7 +436,14 @@ export default { packagePrice() { let packagePrice = 0; - if (!this.showCoverageAsVerified && !this.showCoverageAsPending) { + if (!this.isInsurance) { + // CASH ONLY + packagePrice = baseMixin.methods.getTierOnePackagePrice( + baseMixin.methods.filterOutFees( + baseMixin.methods.filterOutRecalibration(this.availableLineItems) + ) + ); + } else if (!this.showCoverageAsVerified && !this.showCoverageAsPending) { packagePrice = baseMixin.methods.getTierOnePackagePrice( baseMixin.methods.filterOutFees(this.availableLineItems) ); @@ -915,8 +932,6 @@ export default { promoCartItems() { const promoCartItems = []; - // clone the promos array - const promosClone = deepClone(this.promo); // get unique promo codes const uniquePromoCodes = [ ...new Set( @@ -982,16 +997,23 @@ export default { return this.getCmsContent("SubtotalTextWidget", "Text"); }, subTotal() { - return baseMixin.methods.getSubTotal(this.lineItems); + if (!this.lineItems || this.lineItems.length < 1) return; + return this.isInsurance + ? baseMixin.methods.getSubTotal(this.lineItems) + : baseMixin.methods.getSubTotal(this.lineItemsWithoutRecal); }, salesTax() { - return baseMixin.methods.getSalesTax(this.lineItems); + if (!this.lineItems || this.lineItems.length < 1) return; + return this.isInsurance + ? baseMixin.methods.getSalesTax(this.lineItems) + : baseMixin.methods.getSalesTax(this.lineItemsWithoutRecal); }, amountDue() { - if (this.showAsPaid) { - return 0; - } - return baseMixin.methods.getAmountDue(this.lineItems); + if (!this.lineItems || this.lineItems.length < 1) return; + if (this.showAsPaid) return 0; + return this.isInsurance + ? baseMixin.methods.getAmountDue(this.lineItems) + : baseMixin.methods.getAmountDue(this.lineItemsWithoutRecal); }, amountPaid() { if (!this.showAsPaid) { diff --git a/src/helpers/date-helper.js b/src/helpers/date-helper.js index b5afc535c..59ffa5745 100644 --- a/src/helpers/date-helper.js +++ b/src/helpers/date-helper.js @@ -8,6 +8,10 @@ export function getDateDifferenceInDays(startDate, endDate) { return Math.round(difference / (1000 * 3600 * 24)); } export function get12HourTimeFormat(time) { + if (!time) { + return null; + } + // Check correct time format and split into components time = time.toString().match(/^([01]\d|2[0-3])(:)([0-5]\d)?$/) || [time]; @@ -20,8 +24,12 @@ export function get12HourTimeFormat(time) { return time.join(""); // return adjusted time or original string } export function get12HourTimeMobileFormat(time) { + if (!time) { + return null; + } + // Check correct time format and split into components - time = time.toString().match(/^([01]\d|2[0-3])(:)([0-5]\d)?$/) || [time]; + time = time?.toString().match(/^([01]\d|2[0-3])(:)([0-5]\d)?$/) || [time]; if (time.length > 1) { // If time format correct diff --git a/src/helpers/heritage-integration/navigation-helper.js b/src/helpers/heritage-integration/navigation-helper.js index f7c3ddc3b..208a301e4 100644 --- a/src/helpers/heritage-integration/navigation-helper.js +++ b/src/helpers/heritage-integration/navigation-helper.js @@ -107,8 +107,12 @@ export async function getImplicitNavigation(toRoute) { */ export async function navigateToHeritageFunnel({ shouldSaveSession, pageNameToLog }) { - console.log(new Date() + " navigateToHeritageFunnel: " + JSON.stringify(applicationConfig)); - console.log(new Date() + " navigateToHeritageFunnel: " + applicationConfig.HERITAGE_FUNNEL); + const log = getQuerystringParameter(queryStrings.LOG); + if (eval(log)) { + console.log(new Date() + " applicationConfig: " + JSON.stringify(applicationConfig)); + console.log(new Date() + " navigateToHeritageFunnel: " + applicationConfig.HERITAGE_FUNNEL); + } + // Create the order (or save existing order) when navigating to Heritage Funnel. if (shouldSaveSession) { await saveSession({ pageNameToLog: pageNameToLog, shouldAwaitSaveSessionQueue: true }); diff --git a/src/layouts/address-lookup/address-lookup.vue b/src/layouts/address-lookup/address-lookup.vue index 4612348f2..403982a83 100644 --- a/src/layouts/address-lookup/address-lookup.vue +++ b/src/layouts/address-lookup/address-lookup.vue @@ -150,7 +150,7 @@ export default { // Call the "next" function to complete the transition to this page. next((vm) => { vm.setCmsContent(resultMap.cmsContent); - if (store.getters.isExternalParameter) { + if (store.getters.externalParameterState?.isExternalParameter) { baseMixin.methods.ResetExternalParamsAndHideModal(); } }); diff --git a/src/layouts/capability-questions/capability-questions.vue b/src/layouts/capability-questions/capability-questions.vue index 7d1cb6c5b..a94db9786 100644 --- a/src/layouts/capability-questions/capability-questions.vue +++ b/src/layouts/capability-questions/capability-questions.vue @@ -54,7 +54,7 @@ export default { // Call the "next" function to complete the transition to this page. next((vm) => { vm.setCmsContent(resultMap.cmsContent); - if (store.getters.isExternalParameter) { + if (store.getters.externalParameterState?.isExternalParameter) { baseMixin.methods.ResetExternalParamsAndHideModal(); } }); diff --git a/src/layouts/confirmation/add-to-calendar/add-to-calendar.vue b/src/layouts/confirmation/add-to-calendar/add-to-calendar.vue index 4cbe0d748..a4cdcbb6f 100644 --- a/src/layouts/confirmation/add-to-calendar/add-to-calendar.vue +++ b/src/layouts/confirmation/add-to-calendar/add-to-calendar.vue @@ -34,6 +34,8 @@ import { import store from "@/store"; import { serviceType } from "@/constants/service-type"; import { applicationConfig } from "@/constants/application-config.js"; +import baseMixin from "@/mixins/base-mixin.js"; + export default { name: "add-to-calendar", components: { @@ -110,10 +112,10 @@ export default { return this.getCmsContent(this.sameDayDropOffWidgetName, "BodyText"); }, UniqueId() { - return store.getters.submittedOrder.referralNumber?.toString(); + return this.getSubmittedOrder()?.referralNumber?.toString(); }, ServiceType() { - const isRepair = store.getters.submittedOrder.damage.isRepair; + const isRepair = this.getSubmittedOrder()?.damage.isRepair; const funnelHasRecalibrationPart = store.getters.isRecalibrationOnSubmittedOrder; if (!isRepair) { if (funnelHasRecalibrationPart) { @@ -125,7 +127,7 @@ export default { return serviceType.REPAIR; }, RouteCode() { - return store.getters.submittedOrder.schedule.routeCode; + return this.getSubmittedOrder()?.schedule.routeCode; }, Appointment() { var subject = ""; @@ -206,6 +208,9 @@ export default { }, methods: { + getSubmittedOrder() { + return baseMixin.methods.getSubmittedOrder(); + }, setCalendarAppointment(calendarOption) { if ( calendarOption.name == calendarOptions.ICAL || diff --git a/src/layouts/confirmation/confirmation.spec.js b/src/layouts/confirmation/confirmation.spec.js index a079fab83..d29bb552a 100644 --- a/src/layouts/confirmation/confirmation.spec.js +++ b/src/layouts/confirmation/confirmation.spec.js @@ -19,67 +19,6 @@ beforeEach(() => { jest.restoreAllMocks(); jest.clearAllMocks(); store.getters = { - submittedOrder: { - schedule: { - date: "2023-01-01", - startTime: "09:00", - endTime: "10:00", - routeCode: "000", - jobMaxMinutes: "120", - jobMinMinutes: "60", - }, - lineItems: { - glassParts: [ - { - partNumber: "ABC123", - }, - ], - supportingItems: [], - }, - serviceLocation: { - address: "test", - address2: "123", - city: "test", - state: "AZ", - appointmentType: "Inshop", - zipCode: "12345", - zipCodeCtu: "01234", - provider: { - providerNumber: "123", - address: { - streetAddress: "test1", - city: "test", - state: "AZ", - zipCode: "12345", - zipCodeCtu: "01234", - }, - }, - }, - damage: { - isRepair: false, - }, - payment: { - isPia: true, - isInsurance: false, - insuranceCoverage: { - coverageStatus: "test", - }, - }, - policy: { - isNoComp: false, - currentDeductible: 1, - insuranceCompanyName: "test name", - }, - referralNumber: "1234567", - vehicle: { - year: "2004", - make: "Ford", - model: "F Series F250", - }, - customer: { - emailAddress: "test@test.com", - }, - }, order: { schedule: { date: "2023-01-01", @@ -96,6 +35,7 @@ beforeEach(() => { supportingItems: [], }, serviceLocation: { + appointmentType: AppointmentTypeStrings.IN_SHOP, address: "test", address2: "123", city: "test", @@ -180,6 +120,20 @@ describe("computed properties...", () => { test("ScheduleDateFormatted should return date in expected format.", () => { //Arrange const { wrapper } = setupMocks({}); + wrapper.vm.submittedOrder = { + vehicle: { + imageUrl: "", + }, + schedule: { + startTime: "09:00", + endTime: "11:00", + date: "2023-01-01", + jobMaxMinutes: 120, + jobMinMinutes: 60, + routeCode: "", + }, + serviceLocation: store.getters.order.serviceLocation, + }; // Act const testValue = wrapper.vm.ScheduleDateFormatted; @@ -189,11 +143,22 @@ describe("computed properties...", () => { }); test("ScheduleTimeFormatted should return mobile time in expected format.", () => { //Arrange - store.getters.submittedOrder.serviceLocation.appointmentType = - AppointmentTypeStrings.MOBILE; - store.getters.submittedOrder.schedule.startTime = "09:00"; - store.getters.submittedOrder.schedule.endTime = "11:00"; const { wrapper } = setupMocks({}); + wrapper.vm.submittedOrder = { + vehicle: { + imageUrl: "", + }, + schedule: { + startTime: "09:00", + endTime: "11:00", + date: "2024-09-28", + jobMaxMinutes: 120, + jobMinMinutes: 60, + routeCode: "", + }, + serviceLocation: store.getters.order.serviceLocation, + }; + wrapper.vm.submittedOrder.serviceLocation.appointmentType = AppointmentTypeStrings.MOBILE; // Act const testValue = wrapper.vm.ScheduleTimeFormatted; @@ -203,11 +168,22 @@ describe("computed properties...", () => { }); test("ScheduleTimeFormatted should return DROP_OFF time in expected format.", () => { //Arrange - store.getters.submittedOrder.serviceLocation.appointmentType = - AppointmentTypeStrings.DROP_OFF; - store.getters.submittedOrder.schedule.startTime = "09:00"; - store.getters.submittedOrder.schedule.endTime = "11:00"; const { wrapper } = setupMocks({}); + wrapper.vm.submittedOrder = { + vehicle: { + imageUrl: "", + }, + schedule: { + startTime: "09:00", + endTime: "11:00", + date: "2024-09-28", + jobMaxMinutes: 120, + jobMinMinutes: 60, + routeCode: "", + }, + serviceLocation: store.getters.order.serviceLocation, + }; + wrapper.vm.submittedOrder.serviceLocation.appointmentType = AppointmentTypeStrings.DROP_OFF; // Act const testValue = wrapper.vm.ScheduleTimeFormatted; @@ -217,11 +193,22 @@ describe("computed properties...", () => { }); test("ScheduleTimeFormatted should return Inshop time in expected format.", () => { //Arrange - store.getters.submittedOrder.serviceLocation.appointmentType = - AppointmentTypeStrings.IN_SHOP; - store.getters.submittedOrder.schedule.startTime = "09:00"; - store.getters.submittedOrder.schedule.endTime = "11:00"; const { wrapper } = setupMocks({}); + wrapper.vm.submittedOrder = { + vehicle: { + imageUrl: "", + }, + schedule: { + startTime: "09:00", + endTime: "11:00", + date: "2024-09-28", + jobMaxMinutes: 120, + jobMinMinutes: 60, + routeCode: "", + }, + serviceLocation: store.getters.order.serviceLocation, + }; + wrapper.vm.submittedOrder.serviceLocation.appointmentType = AppointmentTypeStrings.IN_SHOP; // Act const testValue = wrapper.vm.ScheduleTimeFormatted; @@ -231,10 +218,21 @@ describe("computed properties...", () => { }); test("AppointmentWordingText should return mobile text in expected format.", () => { //Arrange - store.getters.submittedOrder.serviceLocation.appointmentType = - AppointmentTypeStrings.MOBILE; - const { wrapper } = setupMocks({}); + wrapper.vm.submittedOrder = { + vehicle: { + imageUrl: "", + }, + schedule: { + endTime: "10:00", + date: "2024-09-28", + jobMaxMinutes: 120, + jobMinMinutes: 60, + routeCode: "", + }, + serviceLocation: store.getters.order.serviceLocation, + }; + wrapper.vm.submittedOrder.serviceLocation.appointmentType = AppointmentTypeStrings.MOBILE; // Act const testValue = wrapper.vm.AppointmentWordingText; @@ -243,10 +241,21 @@ describe("computed properties...", () => { }); test("AppointmentWordingText should return DROP_OFF text in expected format.", () => { //Arrange - store.getters.submittedOrder.serviceLocation.appointmentType = - AppointmentTypeStrings.DROP_OFF; - const { wrapper } = setupMocks({}); + wrapper.vm.submittedOrder = { + vehicle: { + imageUrl: "", + }, + schedule: { + endTime: "10:00", + date: "2024-09-28", + jobMaxMinutes: 120, + jobMinMinutes: 60, + routeCode: "", + }, + serviceLocation: store.getters.order.serviceLocation, + }; + wrapper.vm.submittedOrder.serviceLocation.appointmentType = AppointmentTypeStrings.DROP_OFF; // Act const testValue = wrapper.vm.AppointmentWordingText; @@ -256,10 +265,20 @@ describe("computed properties...", () => { }); test("AppointmentWordingText should return IN_SHOP text in expected format.", () => { //Arrange - store.getters.submittedOrder.serviceLocation.appointmentType = - AppointmentTypeStrings.IN_SHOP; - const { wrapper } = setupMocks({}); + wrapper.vm.submittedOrder = { + vehicle: { + imageUrl: "", + }, + schedule: { + endTime: "10:00", + date: "2024-09-28", + jobMaxMinutes: 120, + jobMinMinutes: 60, + routeCode: "", + }, + serviceLocation: store.getters.order.serviceLocation, + }; // Act const testValue = wrapper.vm.AppointmentWordingText; @@ -280,6 +299,19 @@ describe("computed properties...", () => { test("ScheduleDate should return date in expected format.", () => { //Arrange const { wrapper } = setupMocks({}); + wrapper.vm.submittedOrder = { + vehicle: { + imageUrl: "", + }, + schedule: { + date: "2023-01-01", + endTime: "10:00", + jobMaxMinutes: 120, + jobMinMinutes: 60, + routeCode: "", + }, + serviceLocation: store.getters.order.serviceLocation, + }; // Act const testValue = wrapper.vm.ScheduleDate; @@ -290,6 +322,19 @@ describe("computed properties...", () => { test("ScheduleStartTime should return time in expected format.", () => { //Arrange const { wrapper } = setupMocks({}); + wrapper.vm.submittedOrder = { + vehicle: { + imageUrl: "", + }, + schedule: { + startTime: "09:00", + date: "2024-09-28", + jobMaxMinutes: 120, + jobMinMinutes: 60, + routeCode: "", + }, + serviceLocation: store.getters.order.serviceLocation, + }; // Act const testValue = wrapper.vm.ScheduleStartTime; @@ -300,6 +345,19 @@ describe("computed properties...", () => { test("ScheduleEndTime should return time in expected format.", () => { //Arrange const { wrapper } = setupMocks({}); + wrapper.vm.submittedOrder = { + vehicle: { + imageUrl: "", + }, + schedule: { + endTime: "10:00", + date: "2024-09-28", + jobMaxMinutes: 120, + jobMinMinutes: 60, + routeCode: "", + }, + serviceLocation: store.getters.order.serviceLocation, + }; // Act const testValue = wrapper.vm.ScheduleEndTime; @@ -344,6 +402,18 @@ describe("computed properties...", () => { //Arrange const { wrapper } = setupMocks({}); + wrapper.vm.submittedOrder = { + vehicle: { + imageUrl: "", + }, + schedule: { + date: "2024-09-28", + jobMaxMinutes: 120, + jobMinMinutes: 60, + routeCode: "", + }, + serviceLocation: store.getters.order.serviceLocation, + }; // Act const testValue = wrapper.vm.ServiceLocationFullAddress; @@ -355,6 +425,18 @@ describe("computed properties...", () => { //Arrange const { wrapper } = setupMocks({}); + wrapper.vm.submittedOrder = { + vehicle: { + imageUrl: "", + }, + schedule: { + date: "2024-09-28", + jobMaxMinutes: 120, + jobMinMinutes: 60, + routeCode: "", + }, + serviceLocation: store.getters.order.serviceLocation, + }; // Act const testValue = wrapper.vm.ProviderFullAddress; @@ -366,6 +448,17 @@ describe("computed properties...", () => { //Arrange const { wrapper } = setupMocks({}); + wrapper.vm.submittedOrder = { + vehicle: { + imageUrl: "", + }, + schedule: { + date: "2024-09-28", + jobMaxMinutes: 120, + jobMinMinutes: 60, + routeCode: "", + }, + }; // Act const testValue = wrapper.vm.AppointmentDuration; @@ -375,9 +468,18 @@ describe("computed properties...", () => { }); test("Appointment Duration should return with correct duration values in expected format for hours.", () => { //Arrange - store.getters.submittedOrder.schedule.jobMaxMinutes = 120; - store.getters.submittedOrder.schedule.jobMinMinutes = 60; const { wrapper } = setupMocks({}); + wrapper.vm.submittedOrder = { + vehicle: { + imageUrl: "", + }, + schedule: { + date: "2024-09-28", + jobMaxMinutes: 120, + jobMinMinutes: 60, + routeCode: "", + }, + }; // Act const testValue = wrapper.vm.AppointmentDuration; @@ -387,9 +489,18 @@ describe("computed properties...", () => { }); test("Appointment Duration should return with correct duration values in expected format for minutes.", () => { //Arrange - store.getters.submittedOrder.schedule.jobMaxMinutes = 45; - store.getters.submittedOrder.schedule.jobMinMinutes = 30; const { wrapper } = setupMocks({}); + wrapper.vm.submittedOrder = { + vehicle: { + imageUrl: "", + }, + schedule: { + date: "2024-09-28", + jobMaxMinutes: 45, + jobMinMinutes: 30, + routeCode: "", + }, + }; // Act const testValue = wrapper.vm.AppointmentDuration; @@ -400,10 +511,18 @@ describe("computed properties...", () => { test("Appointment Duration should return with All Day.", () => { //Arrange - store.getters.submittedOrder.schedule.jobMaxMinutes = 45; - store.getters.submittedOrder.schedule.jobMinMinutes = 30; - store.getters.submittedOrder.schedule.routeCode = RouteCodeFlags.ALL_DAY_DROP_OFF; const { wrapper } = setupMocks({}); + wrapper.vm.submittedOrder = { + vehicle: { + imageUrl: "", + }, + schedule: { + date: "2024-09-28", + jobMaxMinutes: 45, + jobMinMinutes: 30, + routeCode: RouteCodeFlags.ALL_DAY_DROP_OFF, + }, + }; // Act const testValue = wrapper.vm.AppointmentDuration; @@ -414,10 +533,18 @@ describe("computed properties...", () => { test("Appointment Duration should return with Overnight.", () => { //Arrange - store.getters.submittedOrder.schedule.jobMaxMinutes = 45; - store.getters.submittedOrder.schedule.jobMinMinutes = 30; - store.getters.submittedOrder.schedule.routeCode = RouteCodeFlags.OVERNIGHT_DROP_OFF; const { wrapper } = setupMocks({}); + wrapper.vm.submittedOrder = { + vehicle: { + imageUrl: "", + }, + schedule: { + date: "2024-09-28", + jobMaxMinutes: 45, + jobMinMinutes: 30, + routeCode: RouteCodeFlags.OVERNIGHT_DROP_OFF, + }, + }; // Act const testValue = wrapper.vm.AppointmentDuration; diff --git a/src/layouts/confirmation/confirmation.vue b/src/layouts/confirmation/confirmation.vue index b46154756..4eddb8b16 100644 --- a/src/layouts/confirmation/confirmation.vue +++ b/src/layouts/confirmation/confirmation.vue @@ -112,13 +112,14 @@ export default { await baseMixin.methods.dispatchStoreAction(storeActions.CREATE_SUBMITTED_ORDER); // Call APIs + const submittedOrder = baseMixin.methods.getSubmittedOrder(); const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage); const wipersPromise = baseMixin.methods.dispatchStoreActionWithLogging( storeActions.GET_WIPERS, { - serviceZipCode: store.getters.submittedOrder.serviceLocation.zipCode, - carId: store.getters.submittedOrder.vehicle.carId, + serviceZipCode: submittedOrder.serviceLocation.zipCode, + carId: submittedOrder.vehicle.carId, }, "confirmation" ); @@ -147,24 +148,26 @@ export default { const resultMap = await settleAllPromises(promiseResultMap); const availableVaps = [resultMap.rainDefense, ...resultMap.wipers]; - const lineItemsFromSubmittedOrder = deepClone(store.getters.submittedOrder.lineItems); + const lineItemsFromSubmittedOrder = deepClone(submittedOrder.lineItems); // Call the "next" function to complete the transition to this page. next((vm) => { vm.setCmsContent(resultMap.cmsContent); vm.lineItems = lineItemsFromSubmittedOrder; vm.vaps = availableVaps; + vm.submittedOrder = submittedOrder; }); }, data() { return { lineItems: [], vaps: [], + submittedOrder: null, }; }, computed: { ShowCart() { - if (this.isPia && store.getters.submittedOrder.settledTenderAmount == 0) { + if (this.isPia && this.submittedOrder?.settledTenderAmount == 0) { // settleTenderAmount always shows 0 via localhost or dev. // Temporarily set return true to see cart in localhost or dev environment return false; @@ -179,62 +182,102 @@ export default { return this.getCmsContent("ScheduleConfirmationWidget", "Image"); }, CustomerPortalLoginToken() { - return store.getters.submittedOrder.customerPortalLoginToken; + return this.submittedOrder?.customerPortalLoginToken; }, ConfirmationEmailText() { return this.getCmsContent("ConfirmationEmailWidget", "BodyText") + ?.replaceAll( + "{custom:submittedOrder.customer.emailAddress}", + this.submittedOrder?.customer?.emailAddress + ) ?.replaceAll("{custom:MY_ACCOUNT_URL}", applicationConfig.MY_ACCOUNT) ?.replaceAll("{custom:CUSTOMER_PORTAL_LOGIN_TOKEN}", this.CustomerPortalLoginToken) ?.replaceAll("<", "<") ?.replaceAll(">", ">"); }, ScheduleDate() { - return store.getters.submittedOrder.schedule.date; + return this.submittedOrder?.schedule?.date; }, AppointmentType() { - return store.getters.submittedOrder.serviceLocation.appointmentType; + return this.submittedOrder?.serviceLocation?.appointmentType; }, ScheduleStartTime() { - return store.getters.submittedOrder.schedule.startTime; + return this.submittedOrder?.schedule?.startTime; }, ScheduleEndTime() { - return store.getters.submittedOrder.schedule.endTime; + return this.submittedOrder?.schedule?.endTime; }, InShopWordingText() { - return this.getCmsContent("InShopWordingWidget", "BodyText"); + return this.getCmsContent("InShopWordingWidget", "BodyText") + ?.replaceAll( + "{custom:submittedOrder.vehicle.year}", + this.submittedOrder?.vehicle?.year + ) + ?.replaceAll( + "{custom:submittedOrder.vehicle.make}", + this.submittedOrder?.vehicle?.make + ) + ?.replaceAll( + "{custom:submittedOrder.vehicle.model}", + this.submittedOrder?.vehicle?.model + ); }, MobileWordingText() { - return this.getCmsContent("MobileWordingWidget", "BodyText"); + return this.getCmsContent("MobileWordingWidget", "BodyText") + ?.replaceAll( + "{custom:submittedOrder.vehicle.year}", + this.submittedOrder?.vehicle?.year + ) + ?.replaceAll( + "{custom:submittedOrder.vehicle.make}", + this.submittedOrder?.vehicle?.make + ) + ?.replaceAll( + "{custom:submittedOrder.vehicle.model}", + this.submittedOrder?.vehicle?.model + ); }, DropOffWordingText() { - return this.getCmsContent("DropOffWordingWidget", "BodyText"); + return this.getCmsContent("DropOffWordingWidget", "BodyText") + ?.replaceAll( + "{custom:submittedOrder.vehicle.year}", + this.submittedOrder?.vehicle?.year + ) + ?.replaceAll( + "{custom:submittedOrder.vehicle.make}", + this.submittedOrder?.vehicle?.make + ) + ?.replaceAll( + "{custom:submittedOrder.vehicle.model}", + this.submittedOrder?.vehicle?.model + ); }, ServiceLocationAddress() { - return store.getters.submittedOrder.serviceLocation.address; + return this.submittedOrder?.serviceLocation?.address; }, ServiceLocationAddress2() { - return store.getters.submittedOrder.serviceLocation.address2; + return this.submittedOrder?.serviceLocation?.address2; }, ServiceLocationCity() { - return store.getters.submittedOrder.serviceLocation.city; + return this.submittedOrder?.serviceLocation?.city; }, ServiceLocationState() { - return store.getters.submittedOrder.serviceLocation.state; + return this.submittedOrder?.serviceLocation?.state; }, ServiceLocationZipCode() { - return store.getters.submittedOrder.serviceLocation.zipCode; + return this.submittedOrder?.serviceLocation?.zipCode; }, ProviderAddress() { - return store.getters.submittedOrder.serviceLocation.provider.address.streetAddress; + return this.submittedOrder?.serviceLocation?.provider?.address?.streetAddress; }, ProviderCity() { - return store.getters.submittedOrder.serviceLocation.provider.address.city; + return this.submittedOrder?.serviceLocation?.provider?.address?.city; }, ProviderState() { - return store.getters.submittedOrder.serviceLocation.provider.address.state; + return this.submittedOrder?.serviceLocation?.provider?.address?.state; }, ProviderZipCode() { - return store.getters.submittedOrder.serviceLocation.provider.address.zipCode; + return this.submittedOrder?.serviceLocation?.provider?.address?.zipCode; }, AppointmentWordingText() { if (this.AppointmentType == AppointmentTypeStrings.MOBILE) { @@ -268,7 +311,7 @@ export default { // This conversion ensures we don't get get GMT induced date changes const dateObject = convertDateStringToDate(this.ScheduleDate); // Ex: Tuesday, April 22 - return dateObject.toLocaleDateString("en-us", { + return dateObject?.toLocaleDateString("en-us", { weekday: "long", month: "long", day: "numeric", @@ -286,19 +329,19 @@ export default { } }, vehicleBannerImageUrl() { - return store.getters.submittedOrder?.vehicle.imageUrl; + return this.submittedOrder?.vehicle.imageUrl; }, damageInfo() { - return store.getters.submittedOrder.damage; + return this.submittedOrder?.damage; }, isInsurance() { - return store.getters.submittedOrder.payment.isInsurance; + return this.submittedOrder?.payment?.isInsurance; }, isNoComp() { - return store.getters.submittedOrder.policy.isNoComp; + return this.submittedOrder?.policy?.isNoComp; }, isItac() { - return store.getters.submittedOrder.policy.isItac; + return this.submittedOrder?.policy?.isItac; }, hasVapsInCart() { if (this.lineItems?.vaps?.length > 0) { @@ -311,32 +354,28 @@ export default { if (this.isNoComp || this.isItac) { return coverageStatus.NOCOMP; } else { - return store.getters.submittedOrder.payment.insuranceCoverage.coverageStatus; + return this.submittedOrder?.payment?.insuranceCoverage?.coverageStatus; } }, currentDeductible() { - return store.getters.submittedOrder.policy.currentDeductible; + return this.submittedOrder?.policy?.currentDeductible; }, insuranceCompanyName() { - return store.getters.submittedOrder.policy.insuranceCompanyName; + return this.submittedOrder?.policy?.insuranceCompanyName; }, isPia() { - return store.getters.submittedOrder?.payment.isPia; + return this.submittedOrder?.payment?.isPia; }, AppointmentDuration() { - const durationMaximum = store.getters.submittedOrder?.schedule?.jobMaxMinutes; - const durationMinimum = store.getters.submittedOrder?.schedule?.jobMinMinutes; + const durationMaximum = this.submittedOrder?.schedule?.jobMaxMinutes; + const durationMinimum = this.submittedOrder?.schedule?.jobMinMinutes; const durationLengthString = "Duration: "; if ( - store.getters.submittedOrder?.schedule?.routeCode.includes( - RouteCodeFlags.ALL_DAY_DROP_OFF - ) + this.submittedOrder?.schedule?.routeCode.includes(RouteCodeFlags.ALL_DAY_DROP_OFF) ) { return durationLengthString.concat("All Day"); } else if ( - store.getters.submittedOrder?.schedule?.routeCode.includes( - RouteCodeFlags.OVERNIGHT_DROP_OFF - ) + this.submittedOrder?.schedule?.routeCode.includes(RouteCodeFlags.OVERNIGHT_DROP_OFF) ) { return durationLengthString.concat("Overnight"); } else { @@ -348,7 +387,7 @@ export default { }, methods: { arePagePrerequisitesValid() { - if (store.getters.hasSubmittedOrder) { + if (baseMixin.methods.hasSubmittedOrder()) { return true; } diff --git a/src/layouts/estimate/estimate.spec.js b/src/layouts/estimate/estimate.spec.js index 7a66a197c..87235d15a 100644 --- a/src/layouts/estimate/estimate.spec.js +++ b/src/layouts/estimate/estimate.spec.js @@ -216,7 +216,7 @@ describe("estimate.vue", () => { describe("estimate.vue", () => { test("should call forwardButtonAction if isExternalParameter is true and form is valid", async () => { store.getters = { - isExternalParameter: true, + externalParameterState: { isExternalParameter: true }, externalParameterEstimate: { vinSelection: "decline" }, }; // Set up the component diff --git a/src/layouts/estimate/estimate.vue b/src/layouts/estimate/estimate.vue index 89d29c744..25217d74b 100644 --- a/src/layouts/estimate/estimate.vue +++ b/src/layouts/estimate/estimate.vue @@ -146,7 +146,7 @@ export default { } vm.setCmsContent(resultMap.cmsContent); - if (store.getters.isExternalParameter) { + if (store.getters.externalParameterState?.isExternalParameter) { if (store.getters.externalParameterEstimate.vinSelection) { vm.selectedVinLookupMethod = vinPagesMixin.methods.getVinlookupMethod( store.getters.externalParameterEstimate.vinSelection diff --git a/src/layouts/insurance-company/insurance-company.vue b/src/layouts/insurance-company/insurance-company.vue index f675055a5..bc9e5755a 100644 --- a/src/layouts/insurance-company/insurance-company.vue +++ b/src/layouts/insurance-company/insurance-company.vue @@ -76,7 +76,7 @@ export default { next((vm) => { vm.setCmsContent(resultMap.cmsContent); vm.originalList = resultMap.insuranceCompanyList; - if (store.getters.isExternalParameter) { + if (store.getters.externalParameterState?.isExternalParameter) { baseMixin.methods.ResetExternalParamsAndHideModal(); } }); diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.vue b/src/layouts/license-plate-lookup/license-plate-lookup.vue index 94b85a881..308180d20 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.vue +++ b/src/layouts/license-plate-lookup/license-plate-lookup.vue @@ -148,7 +148,7 @@ export default { // Call the "next" function to complete the transition to this page. next((vm) => { vm.setCmsContent(resultMap.cmsContent); - if (store.getters.isExternalParameter) { + if (store.getters.externalParameterState?.isExternalParameter) { baseMixin.methods.ResetExternalParamsAndHideModal(); } }); diff --git a/src/layouts/molding-questions/molding-questions.vue b/src/layouts/molding-questions/molding-questions.vue index 379eb5eb1..e2838c27e 100644 --- a/src/layouts/molding-questions/molding-questions.vue +++ b/src/layouts/molding-questions/molding-questions.vue @@ -54,7 +54,7 @@ export default { // Call the "next" function to complete the transition to this page. next((vm) => { vm.setCmsContent(resultMap.cmsContent); - if (store.getters.isExternalParameter) { + if (store.getters.externalParameterState?.isExternalParameter) { baseMixin.methods.ResetExternalParamsAndHideModal(); } }); diff --git a/src/layouts/part-questions/part-questions.vue b/src/layouts/part-questions/part-questions.vue index 5b225e758..f49f5876c 100644 --- a/src/layouts/part-questions/part-questions.vue +++ b/src/layouts/part-questions/part-questions.vue @@ -54,7 +54,7 @@ export default { // Call the "next" function to complete the transition to this page. next((vm) => { vm.setCmsContent(resultMap.cmsContent); - if (store.getters.isExternalParameter) { + if (store.getters.externalParameterState?.isExternalParameter) { baseMixin.methods.ResetExternalParamsAndHideModal(); } }); diff --git a/src/layouts/payment-method/payment-method.vue b/src/layouts/payment-method/payment-method.vue index 7c9e96650..b68e0bd27 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -30,6 +30,7 @@ pageName="payment-method" servicePackageOptionsCmsName="ServicePackageTitle" recyclingModalCmsWidgetName="RecycleModal" + :isInsurance="isInsurance" :insuranceDeductible="currentDeductible" :insuranceCompanyName="insuranceCompanyName" :showInsuranceCoverageAs="showInsuranceCoverageAs" /> @@ -573,7 +574,10 @@ export default { ); }, hasSubmittedOrder() { - return this.$store.getters.hasSubmittedOrder; + return baseMixin.methods.hasSubmittedOrder(); + }, + getSubmittedOrder() { + return baseMixin.methods.getSubmittedOrder(); }, openModal(modalName) { this.$refs[modalName].openModal(); @@ -600,17 +604,17 @@ export default { }, isInsurance() { return this.hasSubmittedOrder() - ? this.$store.getters.submittedOrder.payment.isInsurance + ? this.getSubmittedOrder()?.payment.isInsurance : this.$store.getters.payment.isInsurance; }, isNoComp() { return this.hasSubmittedOrder() - ? this.$store.getters.submittedOrder.policy.isNoComp + ? this.getSubmittedOrder()?.policy.isNoComp : this.$store.getters.policy.isNoComp; }, isItac() { return this.hasSubmittedOrder() - ? this.$store.getters.submittedOrder.policy.isItac + ? this.getSubmittedOrder()?.policy.isItac : this.$store.getters.policy.isItac; }, hasVapsInCart() { @@ -625,13 +629,13 @@ export default { return coverageStatus.NOCOMP; } else { return this.hasSubmittedOrder() - ? this.$store.getters.submittedOrder.payment.insuranceCoverage.coverageStatus + ? this.getSubmittedOrder()?.payment.insuranceCoverage.coverageStatus : this.$store.getters.payment.insuranceCoverage.coverageStatus; } }, currentDeductible() { return this.hasSubmittedOrder() - ? this.$store.getters.submittedOrder.policy.currentDeductible + ? this.getSubmittedOrder()?.policy.currentDeductible : this.$store.getters.policy.currentDeductible; }, insuranceCompanyName() { diff --git a/src/layouts/quote/quote.spec.js b/src/layouts/quote/quote.spec.js index 3780faf32..4f2ac213e 100644 --- a/src/layouts/quote/quote.spec.js +++ b/src/layouts/quote/quote.spec.js @@ -701,7 +701,7 @@ describe("quote.vue", () => { inactivePromos: [], }, }, - isExternalParameter: true, + externalParameterState: { isExternalParameter: true }, externalParameterQuote: { isInsurance: true, servicePackage: "glassonly", diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index 8f2ef4fe9..88ea3ddc7 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -323,7 +323,7 @@ export default { } } - if (store.getters.isExternalParameter) { + if (store.getters.externalParameterState?.isExternalParameter) { if (store.getters.externalParameterQuote.isInsurance == true) { vm.isInsuranceSelected = true; vm.servicePackage = store.getters.externalParameterQuote.servicePackage; diff --git a/src/layouts/service-zip/service-zip.spec.js b/src/layouts/service-zip/service-zip.spec.js index 96cde148f..1a22bb03b 100644 --- a/src/layouts/service-zip/service-zip.spec.js +++ b/src/layouts/service-zip/service-zip.spec.js @@ -169,6 +169,7 @@ function resetMockStoreData() { zipCode: null, emailAddress: null, }, + externalParameterState: { isExternalParameter: false }, }; } @@ -412,7 +413,7 @@ describe("service-zip.vue", () => { describe("service-zip.vue", () => { test("should call forwardButtonAction if isExternalParameter is true and form is valid", async () => { // Set up the store with isExternalParameter as true - store.getters.isExternalParameter = true; + store.getters.externalParameterState = { isExternalParameter: true }; // Set up the component const wrapper = setupMocks({}); @@ -436,7 +437,7 @@ describe("service-zip.vue", () => { }); test("should not call forwardButtonAction if isExternalParameter is true and form is invalid", async () => { // Set up the store with isExternalParameter as true - store.getters.isExternalParameter = true; + store.getters.externalParameterState = { isExternalParameter: true }; // Set up the component const wrapper = setupMocks({}); diff --git a/src/layouts/service-zip/service-zip.vue b/src/layouts/service-zip/service-zip.vue index 056e67d97..34efac1a1 100644 --- a/src/layouts/service-zip/service-zip.vue +++ b/src/layouts/service-zip/service-zip.vue @@ -132,7 +132,7 @@ export default { next(async (vm) => { vm.setCmsContent(resultMap.cmsContent); - if (store.getters.isExternalParameter) { + if (store.getters.externalParameterState?.isExternalParameter) { const isValid = await baseMixin.methods.isFormValid(vm.$refs.theForm); if (isValid) { vm.forwardButtonAction(); @@ -188,7 +188,7 @@ export default { if (!zipCodeData.isValid) { this.displayInvalidZipAlert = true; - if (store.getters.isExternalParameter) { + if (store.getters.externalParameterState?.isExternalParameter) { baseMixin.methods.ResetExternalParamsAndHideModal(); } return this.$refs.navbar.removeLoader(); @@ -197,7 +197,7 @@ export default { if (!zipCodeData.isServiceable) { this.displayNonServiceableZipAlert = true; - if (store.getters.isExternalParameter) { + if (store.getters.externalParameterState?.isExternalParameter) { baseMixin.methods.ResetExternalParamsAndHideModal(); } return this.$refs.navbar.removeLoader(); diff --git a/src/layouts/vehicle-damage/vehicle-damage.spec.js b/src/layouts/vehicle-damage/vehicle-damage.spec.js index bc4ab9356..6a94c240b 100644 --- a/src/layouts/vehicle-damage/vehicle-damage.spec.js +++ b/src/layouts/vehicle-damage/vehicle-damage.spec.js @@ -66,7 +66,7 @@ jest.mock("@/store", () => ({ glassToReplace: [], }, }, - isExternalParameter: false, + externalParameterState: { isExternalParameter: false }, externalParameterDamage: { damageType: null, isRepair: null, @@ -813,7 +813,7 @@ describe("vehicle-damage.vue", () => { describe("vehicle-damage.vue", () => { test("should call forwardButtonAction if isExternalParameter is true and form is valid", async () => { // Set up the store with isExternalParameter as true - store.getters.isExternalParameter = true; + store.getters.externalParameterState = { isExternalParameter: true }; store.getters.externalParameterDamage = { damageType: "windshieldReplace", isRepair: false, diff --git a/src/layouts/vehicle-damage/vehicle-damage.vue b/src/layouts/vehicle-damage/vehicle-damage.vue index d22bb9c81..62da598db 100644 --- a/src/layouts/vehicle-damage/vehicle-damage.vue +++ b/src/layouts/vehicle-damage/vehicle-damage.vue @@ -1,5 +1,5 @@