From 9247117e1242848e18c7cd658acb0c7f4c3965e8 Mon Sep 17 00:00:00 2001 From: Johnny shultz Date: Thu, 6 Feb 2025 13:01:54 -0500 Subject: [PATCH 1/3] CASH-176 CASH-176 Added email or sms to vin-lookup, address-lookup, and license plate-lookup --- src/layouts/address-lookup/address-lookup.vue | 23 +++++--- .../customer-questions/customer-questions.vue | 16 +++--- .../license-plate-lookup.vue | 37 +++++++++---- src/layouts/vin-lookup/vin-lookup.vue | 53 ++++++++++++++----- src/store/index.js | 3 +- 5 files changed, 94 insertions(+), 38 deletions(-) diff --git a/src/layouts/address-lookup/address-lookup.vue b/src/layouts/address-lookup/address-lookup.vue index 55d8a0499..8789f0839 100644 --- a/src/layouts/address-lookup/address-lookup.vue +++ b/src/layouts/address-lookup/address-lookup.vue @@ -18,7 +18,7 @@ @@ -59,12 +59,12 @@ import textBlock from "@/digital-components/text-block/text-block"; // DEFINE VALIDATION RULES defineRule("first-name-required", required(errorMessages.FIRST_NAME_REQUIRED)); defineRule("last-name-required", required(errorMessages.LAST_NAME_REQUIRED)); -defineRule("email-address-required", required(errorMessages.EMAIL_ADDRESS_REQUIRED)); +defineRule("email-sms-required", required(errorMessages.EMAIL_SMS_REQUIRED)); defineRule( - "email-address-format", + "email-sms-format", regex( - /^([a-zA-Z0-9_\-.+]+)@([a-zA-Z0-9-]+)\.([a-zA-Z]{2,})$/, - errorMessages.EMAIL_ADDRESS_FORMAT + /^([a-zA-Z0-9_\-.+]+)@([a-zA-Z0-9-]+)\.([a-zA-Z]{2,})$|^\(?(\d{3})\)?[-. ]?(\d{3})[-. ]?(\d{4})$/, + errorMessages.EMAIL_SMS_FORMAT ) ); @@ -84,7 +84,7 @@ export default { }, firstName: "", lastName: "", - emailAddress: "", + emailOrSms: "", }, }), }, diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.vue b/src/layouts/license-plate-lookup/license-plate-lookup.vue index b374e8bb6..e1b3f721e 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.vue +++ b/src/layouts/license-plate-lookup/license-plate-lookup.vue @@ -28,10 +28,10 @@ @@ -110,17 +110,18 @@ import { Form, defineRule } from "vee-validate"; import baseMixin from "@/mixins/base-mixin.js"; import store from "@/store"; import vinPagesMixin from "@/mixins/vin-pages-mixin"; +import { fmgPageValues } from "@/router/router-constants/fmgPage-values"; // DEFINE VALIDATION RULES defineRule("license-plate-required", required(errorMessages.LICENSE_PLATE_REQUIRED)); defineRule("registration-zip-required", required(errorMessages.REGISTRATION_ZIP_REQUIRED)); defineRule("zip-format", regex(/(^\d{5}$)|(^\d{5}-\d{4}$)/, errorMessages.SERVICE_ZIP_FORMAT)); -defineRule("email-address-required", required(errorMessages.EMAIL_ADDRESS_REQUIRED)); +defineRule("email-sms-required", required(errorMessages.EMAIL_SMS_REQUIRED)); defineRule( - "email-address-format", + "email-sms-format", regex( - /^([a-zA-Z0-9_\-.+]+)@([a-zA-Z0-9-]+)\.([a-zA-Z]{2,})$/, - errorMessages.EMAIL_ADDRESS_FORMAT + /^([a-zA-Z0-9_\-.+]+)@([a-zA-Z0-9-]+)\.([a-zA-Z]{2,})$|^\(?(\d{3})\)?[-. ]?(\d{3})[-. ]?(\d{4})$/, + errorMessages.EMAIL_SMS_FORMAT ) ); @@ -155,7 +156,7 @@ export default { return { licensePlate: this.getLicensePlateFromStore(), registrationZipCode: this.getRegistrationZipFromStore() ?? this.$route.query.zipcode, - email: this.getEmailFromStore(), + emailOrSms: this.getEmailOrSmsFromStore(), serviceZipCode: this.getServiceZipFromStore(), displayNonServiceableZipAlert: false, displayVinNotFoundAlert: false, @@ -193,8 +194,8 @@ export default { getRegistrationZipFromStore() { return this.$store.getters.vehicle.registration.zipCode; }, - getEmailFromStore() { - return this.$store.getters.order.customer.emailAddress; + getEmailOrSmsFromStore() { + return this.$store.getters.emailOrSms; }, getServiceZipFromStore() { return this.$store.getters.order.serviceLocation.zipCode; @@ -310,7 +311,21 @@ export default { false ); - await this.dispatchStoreAction(storeActions.SAVE_EMAIL, this.email, false); + if (vinPagesMixin.methods.isPhoneNumber(this.emailOrSms)) { + const phone = this.emailOrSms.replace(/[()]/g, ""); + await this.dispatchStoreAction(storeActions.SAVE_PHONE_NUMBER, phone, false); + } else { + await this.dispatchStoreAction(storeActions.SAVE_EMAIL, this.emailOrSms, false); + } + + await this.dispatchStoreAction( + storeActions.SAVE_PAGE_DATA, + { + page: fmgPageValues.EMAIL_SMS_PAGES, + data: { emailOrSmsValue: this.emailOrSms }, + }, + false + ); await this.dispatchStoreAction( storeActions.SAVE_SERVICE_ZIP_CODE_INFO, diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index eb184bd69..82c54d43a 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -46,10 +46,10 @@ @@ -151,16 +151,17 @@ import { routerParams } from "@/router/router-constants/router-params"; import baseMixin from "@/mixins/base-mixin.js"; import store from "@/store"; import vinPagesMixin from "@/mixins/vin-pages-mixin"; +import { fmgPageValues } from "@/router/router-constants/fmgPage-values"; // DEFINE VALIDATION RULES defineRule("zip-required", required(errorMessages.SERVICE_ZIP_REQUIRED)); defineRule("zip-format", regex(/(^\d{5}$)|(^\d{5}-\d{4}$)/, errorMessages.SERVICE_ZIP_FORMAT)); -defineRule("email-address-required", required(errorMessages.EMAIL_ADDRESS_REQUIRED)); +defineRule("email-sms-required", required(errorMessages.EMAIL_SMS_REQUIRED)); defineRule( - "email-address-format", + "email-sms-format", regex( - /^([a-zA-Z0-9_\-.+]+)@([a-zA-Z0-9-]+)\.([a-zA-Z]{2,})$/, - errorMessages.EMAIL_ADDRESS_FORMAT + /^([a-zA-Z0-9_\-.+]+)@([a-zA-Z0-9-]+)\.([a-zA-Z]{2,})$|^\(?(\d{3})\)?[-. ]?(\d{3})[-. ]?(\d{4})$/, + errorMessages.EMAIL_SMS_FORMAT ) ); defineRule("vin-required", required(errorMessages.VIN_REQUIRED)); @@ -195,7 +196,7 @@ export default { return { vin: this.getVinFromStore(), serviceZipCode: this.getZipFromStore() ?? this.$route.query.zipcode, - emailAddress: this.getEmailFromStore(), + emailOrSms: this.getEmailOrSmsFromStore(), isCarIdDifferent: false, customAlertData: {}, previouslyEnteredCarId: "", @@ -212,8 +213,8 @@ export default { arePagePrerequisitesValid() { return store.getters.vehicle.carId !== null; }, - getEmailFromStore() { - return this.$store.getters.order.customer.emailAddress; + getEmailOrSmsFromStore() { + return this.$store.getters.emailOrSms; }, getVinFromStore() { return this.$store.getters.vehicle.vin; @@ -329,7 +330,21 @@ export default { false ); - await this.dispatchStoreAction(storeActions.SAVE_EMAIL, this.emailAddress, false); + if (vinPagesMixin.methods.isPhoneNumber(this.emailOrSms)) { + const phone = this.emailOrSms.replace(/[()]/g, ""); + await this.dispatchStoreAction(storeActions.SAVE_PHONE_NUMBER, phone, false); + } else { + await this.dispatchStoreAction(storeActions.SAVE_EMAIL, this.emailOrSms, false); + } + + await this.dispatchStoreAction( + storeActions.SAVE_PAGE_DATA, + { + page: fmgPageValues.EMAIL_SMS_PAGES, + data: { emailOrSmsValue: this.emailOrSms }, + }, + false + ); await this.dispatchStoreAction( storeActions.SAVE_SERVICE_ZIP_CODE_INFO, { @@ -365,7 +380,21 @@ export default { ); } - await this.dispatchStoreAction(storeActions.SAVE_EMAIL, this.emailAddress, false); + if (vinPagesMixin.methods.isPhoneNumber(this.emailOrSms)) { + const phone = this.emailOrSms.replace(/[()]/g, ""); + await this.dispatchStoreAction(storeActions.SAVE_PHONE_NUMBER, phone, false); + } else { + await this.dispatchStoreAction(storeActions.SAVE_EMAIL, this.emailOrSms, false); + } + + await this.dispatchStoreAction( + storeActions.SAVE_PAGE_DATA, + { + page: fmgPageValues.EMAIL_SMS_PAGES, + data: { emailOrSmsValue: this.emailOrSms }, + }, + false + ); return await this.navigateForward(); } diff --git a/src/store/index.js b/src/store/index.js index 1feb02a2f..e1c726892 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1004,7 +1004,8 @@ export const getters = { isExternalParameter: (state) => externalParameterState?.isExternalParameter, emailOrSms: (state) => { - const email = externalParameterState.serviceZip.emailAddress ?? state.order.customer.emailAddress; + const email = + externalParameterState.serviceZip.emailAddress ?? state.order.customer.emailAddress; const phone = state.order.customer.phoneNumber; if (!phone && !email) { From 759e1eef57efd731278fcff740274985c0d19787 Mon Sep 17 00:00:00 2001 From: Johnny shultz Date: Thu, 6 Feb 2025 15:25:21 -0500 Subject: [PATCH 2/3] CASH-176 CASH-176 Fixed unit test for license-plate-spec --- .../license-plate-lookup/license-plate-lookup.spec.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.spec.js b/src/layouts/license-plate-lookup/license-plate-lookup.spec.js index 93aee887a..9dfbc4ed1 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.spec.js +++ b/src/layouts/license-plate-lookup/license-plate-lookup.spec.js @@ -68,7 +68,7 @@ describe("license-plate-lookup.vue", () => { const { wrapper } = setupMocks({ emailAddress: mockEmail }); // ACT - const customerEmail = wrapper.vm.getEmailFromStore(); + const customerEmail = wrapper.vm.getEmailOrSmsFromStore(); // Assert expect(customerEmail).toEqual(mockEmail); @@ -625,6 +625,8 @@ function setupMocks({ licensePlate = null, //"TESTPLATE", emailAddress = null, //"test@test.com" }) { + console.log("======================================================================================================" + emailAddress); + console.log("serviceLocationZipCode" + serviceLocationZipCode); store.commit(storeMutations.RESET_STATE); //Mock api responses const apiResponses = { @@ -665,6 +667,7 @@ function setupMocks({ }, store: { getters: { + emailOrSms: emailAddress, vehicle: { registration: { licensePlate: licensePlate, From f9b043ca66d766c50c35a0c105692c24495df9b8 Mon Sep 17 00:00:00 2001 From: Johnny shultz Date: Thu, 6 Feb 2025 16:48:43 -0500 Subject: [PATCH 3/3] CASH-176 CASH-176 Removed console.logs from license-plate-lookup.spec.js --- .../save-progress-modal-question.vue | 4 ++-- src/layouts/address-lookup/address-lookup.vue | 6 +++++- .../license-plate-lookup/license-plate-lookup.spec.js | 2 -- src/store/index.js | 10 +++++----- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/fmg-components/save-progress-modal-question/save-progress-modal-question.vue b/src/fmg-components/save-progress-modal-question/save-progress-modal-question.vue index 27ca1f479..c6e31b781 100644 --- a/src/fmg-components/save-progress-modal-question/save-progress-modal-question.vue +++ b/src/fmg-components/save-progress-modal-question/save-progress-modal-question.vue @@ -158,8 +158,8 @@ export default { box-shadow: none; } &:focus-visible span { - outline: 2px solid #005FCC; - border-radius: .25rem; + outline: 2px solid #005fcc; + border-radius: 0.25rem; } &.delay { // fixes flicker while transitioning between states diff --git a/src/layouts/address-lookup/address-lookup.vue b/src/layouts/address-lookup/address-lookup.vue index 8789f0839..e069ee48d 100644 --- a/src/layouts/address-lookup/address-lookup.vue +++ b/src/layouts/address-lookup/address-lookup.vue @@ -361,7 +361,11 @@ export default { const phone = this.customerQuestions.emailOrSms.replace(/[()]/g, ""); await this.dispatchStoreAction(storeActions.SAVE_PHONE_NUMBER, phone, false); } else { - await this.dispatchStoreAction(storeActions.SAVE_EMAIL, this.customerQuestions.emailOrSms, false); + await this.dispatchStoreAction( + storeActions.SAVE_EMAIL, + this.customerQuestions.emailOrSms, + false + ); } await this.dispatchStoreAction( diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.spec.js b/src/layouts/license-plate-lookup/license-plate-lookup.spec.js index 9dfbc4ed1..2d4b729d8 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.spec.js +++ b/src/layouts/license-plate-lookup/license-plate-lookup.spec.js @@ -625,8 +625,6 @@ function setupMocks({ licensePlate = null, //"TESTPLATE", emailAddress = null, //"test@test.com" }) { - console.log("======================================================================================================" + emailAddress); - console.log("serviceLocationZipCode" + serviceLocationZipCode); store.commit(storeMutations.RESET_STATE); //Mock api responses const apiResponses = { diff --git a/src/store/index.js b/src/store/index.js index ae85d311e..8e156871f 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1293,16 +1293,16 @@ export const actions = { { payload: { userId, deviceId, sessionKey, pageName, experiment }, pageNameToLog } ) { const experiments = deepClone(context.getters.applicationUser.experiments); - const experimentToMarkAsExposed = experiments.find(ex => { + const experimentToMarkAsExposed = experiments.find((ex) => { ex.universeId == experiment.universeId && - ex.testId == experiment.testIde && - ex.variationId == experiment.variationId && - ex.assignmentId == experiment.assignmentId + ex.testId == experiment.testIde && + ex.variationId == experiment.variationId && + ex.assignmentId == experiment.assignmentId; }); if (experimentToMarkAsExposed) { experimentToMarkAsExposed.isExposed = true; } - + context.commit(storeMutations.UPDATE_EXPERIMENTS, experiments); return globalMethods.callHttpClient({