From d4530ca4cf229f48b5dd85b08d9dbb0a8582de67 Mon Sep 17 00:00:00 2001 From: Alex Humphries Date: Wed, 21 Jan 2026 17:17:20 -0500 Subject: [PATCH] Add extension to save/load session --- src/layouts/tpa-submit/tpa-submit.spec.js | 47 +++++++++++++++++++++++ src/layouts/tpa-submit/tpa-submit.vue | 6 ++- src/store/index.js | 5 ++- 3 files changed, 56 insertions(+), 2 deletions(-) diff --git a/src/layouts/tpa-submit/tpa-submit.spec.js b/src/layouts/tpa-submit/tpa-submit.spec.js index 6470f241..ab42d2f5 100644 --- a/src/layouts/tpa-submit/tpa-submit.spec.js +++ b/src/layouts/tpa-submit/tpa-submit.spec.js @@ -418,6 +418,53 @@ describe('tpa-submit', () => { expect(contactInfoSection.lines[0]).toContain(expectedPhone); expect(toDisplayPhoneNumber).toHaveBeenCalledWith(servicePhone); }); + test('contact info section has expected content with extension', async () => { + // Arrange + const firstName = 'Jones'; + const lastName = 'Eddison'; + const emailAddress = 'myname@gmail.com'; + const servicePhone = '0001112222'; + const extension = '12345'; + const providerCompanyName = 'Some Provider LLC'; + const initialStore = { + order: { + serviceLocation: { + provider: { + companyName: providerCompanyName + } + }, + contactInfo: { + firstName, + lastName, + emailAddress, + servicePhone, + extension + } + } + }; + const { wrapper } = getMountedComponent(initialStore); + const expectedEmail = emailAddress; + const expectedPhone = 'some value returned'; + toDisplayPhoneNumber.mockImplementation((number) => (number === servicePhone ? expectedPhone : '')); + const contactInfoSectionIndex = 1; + wrapper.vm.getCmsContent.mockImplementation(() => '{custom:contactPhone} or {custom:contactEmail}'); + + // Act + await tpaSubmit.beforeRouteEnter.call( + wrapper.vm, + { query: { issPage: 'tpa-submit' } }, + undefined, + (c) => c(wrapper.vm) + ); + wrapper.vm.setSections(); + + // Assert + const contactInfoSection = wrapper.vm.sections[contactInfoSectionIndex]; + expect(contactInfoSection.lines[0]).toContain(expectedEmail); + expect(contactInfoSection.lines[0]).toContain(expectedPhone); + expect(contactInfoSection.lines[0]).toContain(`Ext. ${extension}`); + expect(toDisplayPhoneNumber).toHaveBeenCalledWith(servicePhone); + }); }); describe('computed', () => { test.each([ diff --git a/src/layouts/tpa-submit/tpa-submit.vue b/src/layouts/tpa-submit/tpa-submit.vue index ff3824bc..eba5129a 100644 --- a/src/layouts/tpa-submit/tpa-submit.vue +++ b/src/layouts/tpa-submit/tpa-submit.vue @@ -275,9 +275,13 @@ export default { return this.mainStore.hasRecalibrationPart; }, customValueMap() { + let contactPhone = toDisplayPhoneNumber(this.mainStore.contactInfo.servicePhone); + if (this.mainStore.contactInfo.extension) { + contactPhone += ` Ext. ${this.mainStore.contactInfo.extension}`; + } return { glassShop: this.getPreferredShopTitle, - contactPhone: toDisplayPhoneNumber(this.mainStore.contactInfo.servicePhone), + contactPhone: contactPhone, contactEmail: this.mainStore.contactInfo.emailAddress } } diff --git a/src/store/index.js b/src/store/index.js index dafc9402..9f710b03 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1457,7 +1457,7 @@ export const useMainStore = defineStore({ emailAddress: contactInfo.emailAddress || customer.emailAddress, firstName: contactInfo.firstName || customer.firstName, lastName: contactInfo.lastName || customer.lastName, - homePhone: contactInfo.homePhone, + homePhone: contactInfo.extension ? contactInfo.servicePhone + contactInfo.extension : contactInfo.homePhone, servicePhone: contactInfo.servicePhone, alternativePhone: contactInfo.alternativePhone, isSmsOptIn: contactInfo.requestTextUpdates ?? false @@ -1592,6 +1592,7 @@ export const useMainStore = defineStore({ order.contactInfo.lastName = data?.customer?.lastName; order.contactInfo.emailAddress = data?.customer?.emailAddress; order.contactInfo.homePhone = data?.customer?.homePhone; + order.contactInfo.extension = data?.customer?.homePhone?.length > 10 ? data.customer.homePhone.slice(10) : ''; order.contactInfo.servicePhone = data?.customer?.servicePhone; order.contactInfo.alternativePhone = data?.customer?.alternativePhone; order.contactInfo.requestTextUpdates = data?.customer?.isSmsOptIn; @@ -1660,6 +1661,7 @@ export const useMainStore = defineStore({ order.contactInfo.lastName = data?.customer?.lastName; order.contactInfo.emailAddress = data?.customer?.emailAddress; order.contactInfo.homePhone = data?.customer?.homePhone; + order.contactInfo.extension = data?.customer?.homePhone?.length > 10 ? data.customer.homePhone.slice(10) : ''; order.contactInfo.servicePhone = data?.customer?.servicePhone; order.contactInfo.alternativePhone = data?.customer?.alternativePhone; order.contactInfo.requestTextUpdates = data?.customer?.isSmsOptIn; @@ -2097,6 +2099,7 @@ export const useMainStore = defineStore({ this.order.contactInfo.homePhone = null; this.order.contactInfo.alternativePhone = null; this.order.contactInfo.servicePhone = null; + this.order.contactInfo.extension = null; this.order.contactInfo.requestTextUpdates = false; this.order.contactInfo.notesForTechnician = ''; },