CASH-1524: WIP
This commit is contained in:
parent
e986fc5a3c
commit
bfbfb24033
9 changed files with 16 additions and 8 deletions
|
|
@ -9,7 +9,11 @@ export function isPhoneContactMethod(contactMethod) {
|
||||||
return contactMethod === saveProgressPopupContactMethods.PHONE;
|
return contactMethod === saveProgressPopupContactMethods.PHONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function hasSaveProgressContactInStore(customer = {}) {
|
export function hasSaveProgressContactInStore(customer) {
|
||||||
|
if (!customer) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const hasEmail = Boolean(customer.emailAddress?.length > 0);
|
const hasEmail = Boolean(customer.emailAddress?.length > 0);
|
||||||
const hasPhone = Boolean(customer.phoneNumber?.length > 0);
|
const hasPhone = Boolean(customer.phoneNumber?.length > 0);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,10 @@ describe("save-progress-popup-contact-helper", () => {
|
||||||
expect(hasSaveProgressContactInStore({ phoneNumber: "5551234567" })).toBe(true);
|
expect(hasSaveProgressContactInStore({ phoneNumber: "5551234567" })).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should return false when customer is undefined", () => {
|
||||||
|
expect(hasSaveProgressContactInStore(undefined)).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
it("should return false when neither email nor phone is saved", () => {
|
it("should return false when neither email nor phone is saved", () => {
|
||||||
expect(hasSaveProgressContactInStore({})).toBe(false);
|
expect(hasSaveProgressContactInStore({})).toBe(false);
|
||||||
expect(hasSaveProgressContactInStore({ emailAddress: "", phoneNumber: null })).toBe(
|
expect(hasSaveProgressContactInStore({ emailAddress: "", phoneNumber: null })).toBe(
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ export default {
|
||||||
// Call the "next" function to complete the transition to this page.
|
// Call the "next" function to complete the transition to this page.
|
||||||
next(async (vm) => {
|
next(async (vm) => {
|
||||||
vm.setCmsContent(resultMap.cmsContent);
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
vm.showSaveProgressModal = !hasSaveProgressContactInStore(store.getters.order.customer);
|
vm.showSaveProgressModal = !hasSaveProgressContactInStore(store.getters.order?.customer);
|
||||||
if (store.getters.externalParameterState?.isExternalParameter) {
|
if (store.getters.externalParameterState?.isExternalParameter) {
|
||||||
if (store.getters.externalParameterServiceZip.zipCode) {
|
if (store.getters.externalParameterServiceZip.zipCode) {
|
||||||
await baseMixin.methods.dispatchStoreAction(
|
await baseMixin.methods.dispatchStoreAction(
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,7 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
const resultMap = await settleAllPromises(promiseResultMap);
|
const resultMap = await settleAllPromises(promiseResultMap);
|
||||||
const showSaveProgressModal = !hasSaveProgressContactInStore(store.getters.order.customer);
|
const showSaveProgressModal = !hasSaveProgressContactInStore(store.getters.order?.customer);
|
||||||
next((vm) => {
|
next((vm) => {
|
||||||
vm.setCmsContent(resultMap.cmsContent);
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
vm.clientConfig = resultMap.clientConfig ?? {};
|
vm.clientConfig = resultMap.clientConfig ?? {};
|
||||||
|
|
|
||||||
|
|
@ -224,7 +224,7 @@ export default {
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
const resultMap = await settleAllPromises(promiseResultMap);
|
const resultMap = await settleAllPromises(promiseResultMap);
|
||||||
const showSaveProgressModal = !hasSaveProgressContactInStore(store.getters.order.customer);
|
const showSaveProgressModal = !hasSaveProgressContactInStore(store.getters.order?.customer);
|
||||||
next((vm) => {
|
next((vm) => {
|
||||||
vm.setCmsContent(resultMap.cmsContent);
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
vm.showSaveProgressModal = showSaveProgressModal;
|
vm.showSaveProgressModal = showSaveProgressModal;
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ export default {
|
||||||
// Call the "next" function to complete the transition to this page.
|
// Call the "next" function to complete the transition to this page.
|
||||||
next(async (vm) => {
|
next(async (vm) => {
|
||||||
vm.setCmsContent(resultMap.cmsContent);
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
vm.showSaveProgressModal = !hasSaveProgressContactInStore(store.getters.order.customer);
|
vm.showSaveProgressModal = !hasSaveProgressContactInStore(store.getters.order?.customer);
|
||||||
if (store.getters.externalParameterState?.isExternalParameter) {
|
if (store.getters.externalParameterState?.isExternalParameter) {
|
||||||
if (store.getters.externalParameterServiceZip.zipCode) {
|
if (store.getters.externalParameterServiceZip.zipCode) {
|
||||||
await baseMixin.methods.dispatchStoreAction(
|
await baseMixin.methods.dispatchStoreAction(
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ export default {
|
||||||
// Call the "next" function to complete the transition to this page.
|
// Call the "next" function to complete the transition to this page.
|
||||||
next(async (vm) => {
|
next(async (vm) => {
|
||||||
vm.setCmsContent(resultMap.cmsContent);
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
vm.showSaveProgressModal = !hasSaveProgressContactInStore(store.getters.order.customer);
|
vm.showSaveProgressModal = !hasSaveProgressContactInStore(store.getters.order?.customer);
|
||||||
if (store.getters.externalParameterState?.isExternalParameter) {
|
if (store.getters.externalParameterState?.isExternalParameter) {
|
||||||
if (store.getters.externalParameterServiceZip.zipCode) {
|
if (store.getters.externalParameterServiceZip.zipCode) {
|
||||||
const serviceState = store.getters.order.serviceLocation.state;
|
const serviceState = store.getters.order.serviceLocation.state;
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ export default {
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
const resultMap = await settleAllPromises(promiseResultMap);
|
const resultMap = await settleAllPromises(promiseResultMap);
|
||||||
const showSaveProgressModal = !hasSaveProgressContactInStore(store.getters.order.customer);
|
const showSaveProgressModal = !hasSaveProgressContactInStore(store.getters.order?.customer);
|
||||||
next((vm) => {
|
next((vm) => {
|
||||||
vm.setCmsContent(resultMap.cmsContent);
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
vm.clientConfig = resultMap.clientConfig ?? {};
|
vm.clientConfig = resultMap.clientConfig ?? {};
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ export default {
|
||||||
// Call the "next" function to complete the transition to this page.
|
// Call the "next" function to complete the transition to this page.
|
||||||
next((vm) => {
|
next((vm) => {
|
||||||
vm.setCmsContent(resultMap.cmsContent);
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
vm.showSaveProgressModal = !hasSaveProgressContactInStore(store.getters.order.customer);
|
vm.showSaveProgressModal = !hasSaveProgressContactInStore(store.getters.order?.customer);
|
||||||
|
|
||||||
// Glass Part Question dynamic component
|
// Glass Part Question dynamic component
|
||||||
Object.keys(vm.$refs)
|
Object.keys(vm.$refs)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue