Add extension to save/load session
This commit is contained in:
parent
2750d98f36
commit
d4530ca4cf
3 changed files with 56 additions and 2 deletions
|
|
@ -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([
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 = '';
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue