diff --git a/src/layouts/confirmation/confirmation.spec.js b/src/layouts/confirmation/confirmation.spec.js index bf544c13a..d29bb552a 100644 --- a/src/layouts/confirmation/confirmation.spec.js +++ b/src/layouts/confirmation/confirmation.spec.js @@ -120,9 +120,9 @@ describe("computed properties...", () => { test("ScheduleDateFormatted should return date in expected format.", () => { //Arrange const { wrapper } = setupMocks({}); - wrapper.vm.submittedOrder = { + wrapper.vm.submittedOrder = { vehicle: { - imageUrl: "" + imageUrl: "", }, schedule: { startTime: "09:00", @@ -130,9 +130,9 @@ describe("computed properties...", () => { date: "2023-01-01", jobMaxMinutes: 120, jobMinMinutes: 60, - routeCode: "" + routeCode: "", }, - serviceLocation: store.getters.order.serviceLocation + serviceLocation: store.getters.order.serviceLocation, }; // Act @@ -144,9 +144,9 @@ describe("computed properties...", () => { test("ScheduleTimeFormatted should return mobile time in expected format.", () => { //Arrange const { wrapper } = setupMocks({}); - wrapper.vm.submittedOrder = { + wrapper.vm.submittedOrder = { vehicle: { - imageUrl: "" + imageUrl: "", }, schedule: { startTime: "09:00", @@ -154,9 +154,9 @@ describe("computed properties...", () => { date: "2024-09-28", jobMaxMinutes: 120, jobMinMinutes: 60, - routeCode: "" + routeCode: "", }, - serviceLocation: store.getters.order.serviceLocation + serviceLocation: store.getters.order.serviceLocation, }; wrapper.vm.submittedOrder.serviceLocation.appointmentType = AppointmentTypeStrings.MOBILE; @@ -169,9 +169,9 @@ describe("computed properties...", () => { test("ScheduleTimeFormatted should return DROP_OFF time in expected format.", () => { //Arrange const { wrapper } = setupMocks({}); - wrapper.vm.submittedOrder = { + wrapper.vm.submittedOrder = { vehicle: { - imageUrl: "" + imageUrl: "", }, schedule: { startTime: "09:00", @@ -179,9 +179,9 @@ describe("computed properties...", () => { date: "2024-09-28", jobMaxMinutes: 120, jobMinMinutes: 60, - routeCode: "" + routeCode: "", }, - serviceLocation: store.getters.order.serviceLocation + serviceLocation: store.getters.order.serviceLocation, }; wrapper.vm.submittedOrder.serviceLocation.appointmentType = AppointmentTypeStrings.DROP_OFF; @@ -194,9 +194,9 @@ describe("computed properties...", () => { test("ScheduleTimeFormatted should return Inshop time in expected format.", () => { //Arrange const { wrapper } = setupMocks({}); - wrapper.vm.submittedOrder = { + wrapper.vm.submittedOrder = { vehicle: { - imageUrl: "" + imageUrl: "", }, schedule: { startTime: "09:00", @@ -204,9 +204,9 @@ describe("computed properties...", () => { date: "2024-09-28", jobMaxMinutes: 120, jobMinMinutes: 60, - routeCode: "" + routeCode: "", }, - serviceLocation: store.getters.order.serviceLocation + serviceLocation: store.getters.order.serviceLocation, }; wrapper.vm.submittedOrder.serviceLocation.appointmentType = AppointmentTypeStrings.IN_SHOP; @@ -219,18 +219,18 @@ describe("computed properties...", () => { test("AppointmentWordingText should return mobile text in expected format.", () => { //Arrange const { wrapper } = setupMocks({}); - wrapper.vm.submittedOrder = { + wrapper.vm.submittedOrder = { vehicle: { - imageUrl: "" + imageUrl: "", }, schedule: { endTime: "10:00", date: "2024-09-28", jobMaxMinutes: 120, jobMinMinutes: 60, - routeCode: "" + routeCode: "", }, - serviceLocation: store.getters.order.serviceLocation + serviceLocation: store.getters.order.serviceLocation, }; wrapper.vm.submittedOrder.serviceLocation.appointmentType = AppointmentTypeStrings.MOBILE; // Act @@ -242,18 +242,18 @@ describe("computed properties...", () => { test("AppointmentWordingText should return DROP_OFF text in expected format.", () => { //Arrange const { wrapper } = setupMocks({}); - wrapper.vm.submittedOrder = { + wrapper.vm.submittedOrder = { vehicle: { - imageUrl: "" + imageUrl: "", }, schedule: { endTime: "10:00", date: "2024-09-28", jobMaxMinutes: 120, jobMinMinutes: 60, - routeCode: "" + routeCode: "", }, - serviceLocation: store.getters.order.serviceLocation + serviceLocation: store.getters.order.serviceLocation, }; wrapper.vm.submittedOrder.serviceLocation.appointmentType = AppointmentTypeStrings.DROP_OFF; @@ -266,18 +266,18 @@ describe("computed properties...", () => { test("AppointmentWordingText should return IN_SHOP text in expected format.", () => { //Arrange const { wrapper } = setupMocks({}); - wrapper.vm.submittedOrder = { + wrapper.vm.submittedOrder = { vehicle: { - imageUrl: "" + imageUrl: "", }, schedule: { endTime: "10:00", date: "2024-09-28", jobMaxMinutes: 120, jobMinMinutes: 60, - routeCode: "" + routeCode: "", }, - serviceLocation: store.getters.order.serviceLocation + serviceLocation: store.getters.order.serviceLocation, }; // Act @@ -299,18 +299,18 @@ describe("computed properties...", () => { test("ScheduleDate should return date in expected format.", () => { //Arrange const { wrapper } = setupMocks({}); - wrapper.vm.submittedOrder = { + wrapper.vm.submittedOrder = { vehicle: { - imageUrl: "" + imageUrl: "", }, schedule: { date: "2023-01-01", endTime: "10:00", jobMaxMinutes: 120, jobMinMinutes: 60, - routeCode: "" + routeCode: "", }, - serviceLocation: store.getters.order.serviceLocation + serviceLocation: store.getters.order.serviceLocation, }; // Act @@ -322,18 +322,18 @@ describe("computed properties...", () => { test("ScheduleStartTime should return time in expected format.", () => { //Arrange const { wrapper } = setupMocks({}); - wrapper.vm.submittedOrder = { + wrapper.vm.submittedOrder = { vehicle: { - imageUrl: "" + imageUrl: "", }, schedule: { startTime: "09:00", date: "2024-09-28", jobMaxMinutes: 120, jobMinMinutes: 60, - routeCode: "" + routeCode: "", }, - serviceLocation: store.getters.order.serviceLocation + serviceLocation: store.getters.order.serviceLocation, }; // Act @@ -345,18 +345,18 @@ describe("computed properties...", () => { test("ScheduleEndTime should return time in expected format.", () => { //Arrange const { wrapper } = setupMocks({}); - wrapper.vm.submittedOrder = { + wrapper.vm.submittedOrder = { vehicle: { - imageUrl: "" + imageUrl: "", }, schedule: { endTime: "10:00", date: "2024-09-28", jobMaxMinutes: 120, jobMinMinutes: 60, - routeCode: "" + routeCode: "", }, - serviceLocation: store.getters.order.serviceLocation + serviceLocation: store.getters.order.serviceLocation, }; // Act @@ -402,17 +402,17 @@ describe("computed properties...", () => { //Arrange const { wrapper } = setupMocks({}); - wrapper.vm.submittedOrder = { + wrapper.vm.submittedOrder = { vehicle: { - imageUrl: "" + imageUrl: "", }, schedule: { date: "2024-09-28", jobMaxMinutes: 120, jobMinMinutes: 60, - routeCode: "" + routeCode: "", }, - serviceLocation: store.getters.order.serviceLocation + serviceLocation: store.getters.order.serviceLocation, }; // Act @@ -425,17 +425,17 @@ describe("computed properties...", () => { //Arrange const { wrapper } = setupMocks({}); - wrapper.vm.submittedOrder = { + wrapper.vm.submittedOrder = { vehicle: { - imageUrl: "" + imageUrl: "", }, schedule: { date: "2024-09-28", jobMaxMinutes: 120, jobMinMinutes: 60, - routeCode: "" + routeCode: "", }, - serviceLocation: store.getters.order.serviceLocation + serviceLocation: store.getters.order.serviceLocation, }; // Act @@ -448,16 +448,16 @@ describe("computed properties...", () => { //Arrange const { wrapper } = setupMocks({}); - wrapper.vm.submittedOrder = { + wrapper.vm.submittedOrder = { vehicle: { - imageUrl: "" + imageUrl: "", }, schedule: { date: "2024-09-28", jobMaxMinutes: 120, jobMinMinutes: 60, - routeCode: "" - } + routeCode: "", + }, }; // Act @@ -469,16 +469,16 @@ describe("computed properties...", () => { test("Appointment Duration should return with correct duration values in expected format for hours.", () => { //Arrange const { wrapper } = setupMocks({}); - wrapper.vm.submittedOrder = { + wrapper.vm.submittedOrder = { vehicle: { - imageUrl: "" + imageUrl: "", }, schedule: { date: "2024-09-28", jobMaxMinutes: 120, jobMinMinutes: 60, - routeCode: "" - } + routeCode: "", + }, }; // Act @@ -490,16 +490,16 @@ describe("computed properties...", () => { test("Appointment Duration should return with correct duration values in expected format for minutes.", () => { //Arrange const { wrapper } = setupMocks({}); - wrapper.vm.submittedOrder = { + wrapper.vm.submittedOrder = { vehicle: { - imageUrl: "" + imageUrl: "", }, schedule: { date: "2024-09-28", jobMaxMinutes: 45, jobMinMinutes: 30, - routeCode: "" - } + routeCode: "", + }, }; // Act @@ -512,16 +512,16 @@ describe("computed properties...", () => { test("Appointment Duration should return with All Day.", () => { //Arrange const { wrapper } = setupMocks({}); - wrapper.vm.submittedOrder = { + wrapper.vm.submittedOrder = { vehicle: { - imageUrl: "" + imageUrl: "", }, schedule: { date: "2024-09-28", jobMaxMinutes: 45, jobMinMinutes: 30, - routeCode: RouteCodeFlags.ALL_DAY_DROP_OFF - } + routeCode: RouteCodeFlags.ALL_DAY_DROP_OFF, + }, }; // Act @@ -534,16 +534,16 @@ describe("computed properties...", () => { test("Appointment Duration should return with Overnight.", () => { //Arrange const { wrapper } = setupMocks({}); - wrapper.vm.submittedOrder = { + wrapper.vm.submittedOrder = { vehicle: { - imageUrl: "" + imageUrl: "", }, schedule: { date: "2024-09-28", jobMaxMinutes: 45, jobMinMinutes: 30, - routeCode: RouteCodeFlags.OVERNIGHT_DROP_OFF - } + routeCode: RouteCodeFlags.OVERNIGHT_DROP_OFF, + }, }; // Act @@ -570,4 +570,4 @@ function setupMocks({ customMountOptions }) { ]; const wrapper = shallowMount(confirmation, mountOptions); return { wrapper }; -} \ No newline at end of file +} diff --git a/src/layouts/confirmation/confirmation.vue b/src/layouts/confirmation/confirmation.vue index 19e4d2caf..4eddb8b16 100644 --- a/src/layouts/confirmation/confirmation.vue +++ b/src/layouts/confirmation/confirmation.vue @@ -109,13 +109,11 @@ import { getDisplayTextForDurationLength } from "@/helpers/duration-length-helpe export default { name: "confirmation", async beforeRouteEnter(to, from, next) { - console.log("beforeRoute.."); await baseMixin.methods.dispatchStoreAction(storeActions.CREATE_SUBMITTED_ORDER); // Call APIs - const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage); - const submittedOrder = baseMixin.methods.getSubmittedOrder(); + const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage); const wipersPromise = baseMixin.methods.dispatchStoreActionWithLogging( storeActions.GET_WIPERS, @@ -188,6 +186,10 @@ export default { }, 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("<", "<") @@ -206,13 +208,49 @@ export default { 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 this.submittedOrder?.serviceLocation?.address;