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) {