From 4886e0be923bd25b30c3780fe1792f401775726f Mon Sep 17 00:00:00 2001 From: CarlNation Date: Sat, 8 Feb 2025 07:43:24 -0500 Subject: [PATCH 1/3] CASH-207 CASH-97 CASH-207 CASH-97 - updates for tech review on CASH-97 for moving the vuex phone number update out of the router. The also implemented CASH-207 to default the smsOptin to true when quick quote supplies a mobile number. --- src/constants/store-actions.js | 1 + src/constants/store-mutations.js | 1 + src/layouts/estimate/estimate.vue | 14 ++++++++++++++ src/layouts/service-zip/service-zip.vue | 14 ++++++++++++++ src/router/index.js | 1 - src/store/index.js | 18 +++++++++++++----- 6 files changed, 43 insertions(+), 6 deletions(-) diff --git a/src/constants/store-actions.js b/src/constants/store-actions.js index 9ad6d9890..4750f1641 100644 --- a/src/constants/store-actions.js +++ b/src/constants/store-actions.js @@ -78,6 +78,7 @@ const storeActions = { SAVE_SCHEDULE: "saveSchedule", SAVE_EMAIL: "saveEmail", SAVE_PHONE_NUMBER: "savePhoneNumber", + SAVE_IS_SMS_OPT_IN: "saveIsSmsOptIn", SAVE_REGISTRATION_LICENSE_PLATE_LOOKUP: "saveRegistrationLicensePlateLookup", SAVE_VIN: "saveVin", SAVE_REGISTRATION_ADDRESS_LOOKUP: "saveRegistrationAddressLookup", diff --git a/src/constants/store-mutations.js b/src/constants/store-mutations.js index 1ebf39b8d..d9cfc703e 100644 --- a/src/constants/store-mutations.js +++ b/src/constants/store-mutations.js @@ -42,6 +42,7 @@ const storeMutations = { // CUSTOMER MUTATIONS UPDATE_CUSTOMER_EMAIL_ADDRESS: "updateCustomerEmailAddress", UPDATE_CUSTOMER_PHONE_NUMBER: "updateCustomerPhoneNumber", + UPDATE_CUSTOMER_IS_SMS_OPT_IN: "updateCustomerIsSmsOptin", UPDATE_CUSTOMER_DETAILS: "updateCustomerDetails", // ORDER MUTATIONS diff --git a/src/layouts/estimate/estimate.vue b/src/layouts/estimate/estimate.vue index 6a85ae349..5ab1df2ae 100644 --- a/src/layouts/estimate/estimate.vue +++ b/src/layouts/estimate/estimate.vue @@ -145,6 +145,20 @@ export default { vm.setCmsContent(resultMap.cmsContent); if (store.getters.externalParameterState?.isExternalParameter) { + if (store.getters.externalParameterCustomer.phoneNumber) { + await baseMixin.methods.dispatchStoreAction( + storeActions.SAVE_PHONE_NUMBER, + store.getters.externalParameterCustomer.phoneNumber, + false + ); + + await baseMixin.methods.dispatchStoreAction( + storeActions.SAVE_IS_SMS_OPT_IN, + true, + false + ); + } + if (store.getters.externalParameterEstimate.vinSelection) { vm.selectedVinLookupMethod = vinPagesMixin.methods.getVinlookupMethod( store.getters.externalParameterEstimate.vinSelection diff --git a/src/layouts/service-zip/service-zip.vue b/src/layouts/service-zip/service-zip.vue index 18a8b3362..88d160077 100644 --- a/src/layouts/service-zip/service-zip.vue +++ b/src/layouts/service-zip/service-zip.vue @@ -149,6 +149,20 @@ export default { ); } + if (store.getters.externalParameterCustomer.phoneNumber) { + await baseMixin.methods.dispatchStoreAction( + storeActions.SAVE_PHONE_NUMBER, + store.getters.externalParameterCustomer.phoneNumber, + false + ); + + await baseMixin.methods.dispatchStoreAction( + storeActions.SAVE_IS_SMS_OPT_IN, + true, + false + ); + } + baseMixin.methods.ResetExternalParamsAndHideModal(); } } diff --git a/src/router/index.js b/src/router/index.js index 83004b38c..2230a652d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -898,7 +898,6 @@ function updateExternalParameterState() { storeMutations.UPDATE_EXTERNAL_PARAMETER_PHONE_NUMBER, externalParameterPhoneNumber ); - store.dispatch(storeActions.SAVE_PHONE_NUMBER, externalParameterPhoneNumber); } } diff --git a/src/store/index.js b/src/store/index.js index 095767380..bba99f230 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -346,6 +346,9 @@ export const mutations = { updateCustomerPhoneNumber(state, phoneNumber) { state.order.customer.phoneNumber = phoneNumber; }, + updateCustomerIsSmsOptin(state, isSmsOptIn) { + state.order.customer.isSmsOptIn = isSmsOptIn; + }, updateVehicle(state, vehicleInfo) { state.order.vehicle.year = vehicleInfo.year; state.order.vehicle.make = vehicleInfo.make; @@ -483,7 +486,7 @@ export const mutations = { saveExternalParameterState(externalParameterState); }, updateExternalParameterEmailAddress(state, emailAddress) { - externalParameterState.serviceZip.emailAddress = emailAddress; + externalParameterState.customer.emailAddress = emailAddress; saveExternalParameterState(externalParameterState); }, updateExternalParameterIsInsurance(state, isInsurance) { @@ -524,7 +527,6 @@ export const mutations = { }, resetExternalParameterServiceZipState(state) { externalParameterState.serviceZip.zipCode = null; - externalParameterState.serviceZip.emailAddress = null; saveExternalParameterState(externalParameterState); }, resetExternalParameterQuoteState(state) { @@ -536,6 +538,7 @@ export const mutations = { saveExternalParameterState(externalParameterState); }, resetExternalParameterCustomerState(state) { + externalParameterState.customer.emailAddress = null; externalParameterState.customer.phoneNumber = null; saveExternalParameterState(externalParameterState); }, @@ -1005,8 +1008,9 @@ export const getters = { emailOrSms: (state) => { const email = - externalParameterState.serviceZip.emailAddress ?? state.order.customer.emailAddress; - const phone = state.order.customer.phoneNumber; + externalParameterState.customer.emailAddress ?? state.order.customer.emailAddress; + const phone = + externalParameterState.customer.phoneNumber ?? state.order.customer.phoneNumber; if (!phone && !email) { return null; @@ -3088,6 +3092,10 @@ export const actions = { phoneNumber === "" ? null : phoneNumber ); }, + saveIsSmsOptIn(context, isSmsOptIn) { + debugger; // eslint-disable-line + context.commit(storeMutations.UPDATE_CUSTOMER_IS_SMS_OPT_IN, isSmsOptIn); + }, savePageData(context, emailOrSms) { context.commit(storeMutations.UPDATE_PAGE_DATA, emailOrSms); @@ -3752,7 +3760,6 @@ function createExternalParameterDefaultState() { vinSelection: null, }, serviceZip: { - emailAddress: null, zipCode: null, }, quote: { @@ -3760,6 +3767,7 @@ function createExternalParameterDefaultState() { servicePackage: null, }, customer: { + emailAddress: null, phoneNumber: null, }, }; From 1764db4739fdbaa3010caed1a928dc3fb31adbc4 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Sat, 8 Feb 2025 08:57:02 -0500 Subject: [PATCH 2/3] CASH-207 CASH-207 null check --- src/layouts/service-zip/service-zip.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/layouts/service-zip/service-zip.vue b/src/layouts/service-zip/service-zip.vue index 88d160077..b01f99c06 100644 --- a/src/layouts/service-zip/service-zip.vue +++ b/src/layouts/service-zip/service-zip.vue @@ -149,7 +149,7 @@ export default { ); } - if (store.getters.externalParameterCustomer.phoneNumber) { + if (store.getters.externalParameterCustomer?.phoneNumber) { await baseMixin.methods.dispatchStoreAction( storeActions.SAVE_PHONE_NUMBER, store.getters.externalParameterCustomer.phoneNumber, From 3c55924140ece4d4d70036755a4effe4ee320e85 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Sat, 8 Feb 2025 09:17:04 -0500 Subject: [PATCH 3/3] CASH-207 CASH-207 another null check --- src/layouts/estimate/estimate.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/layouts/estimate/estimate.vue b/src/layouts/estimate/estimate.vue index 5ab1df2ae..b9fdf1958 100644 --- a/src/layouts/estimate/estimate.vue +++ b/src/layouts/estimate/estimate.vue @@ -145,7 +145,7 @@ export default { vm.setCmsContent(resultMap.cmsContent); if (store.getters.externalParameterState?.isExternalParameter) { - if (store.getters.externalParameterCustomer.phoneNumber) { + if (store.getters.externalParameterCustomer?.phoneNumber) { await baseMixin.methods.dispatchStoreAction( storeActions.SAVE_PHONE_NUMBER, store.getters.externalParameterCustomer.phoneNumber,