diff --git a/src/constants/store-actions.js b/src/constants/store-actions.js index 2a0a7f29d..fe658fbe1 100644 --- a/src/constants/store-actions.js +++ b/src/constants/store-actions.js @@ -22,6 +22,7 @@ const storeActions = { LOG_PAGE_VIEW: "logPageView", LOG_CUSTOM_EVENT: "logCustomEvent", GET_EXPERIMENTS_BY_USER: "GetExperimentsByUser", + UPDATE_SERVICE_LOCATION_WITH_VEHICLE_REGISTRATION: "updateServiceLocationWithVehicleRegistration", // DEPENDENCY MUTATIONS RESET_VEHICLE_STATE_AND_DEPENDENCIES: "resetVehicleAndDependencies", diff --git a/src/constants/store-mutations.js b/src/constants/store-mutations.js index 65f4719ec..179b484ef 100644 --- a/src/constants/store-mutations.js +++ b/src/constants/store-mutations.js @@ -44,8 +44,8 @@ const storeMutations = { // OTHER MUTATIONS UPDATE_PAGE_DATA: "updatePageData", - UPDATE_STATE_WITH_ORDER_INFORMATION: "updateStateWithOrderInformation" - + UPDATE_STATE_WITH_ORDER_INFORMATION: "updateStateWithOrderInformation", + UPDATE_SERVICE_LOCATION_WITH_VEHICLE_REGISTRATION: "updateServiceLocationWithVehicleRegistration" }; export { storeMutations }; diff --git a/src/helpers/heritage-integration/navigation-helper.js b/src/helpers/heritage-integration/navigation-helper.js index eadb607f0..7e0b80f99 100644 --- a/src/helpers/heritage-integration/navigation-helper.js +++ b/src/helpers/heritage-integration/navigation-helper.js @@ -3,8 +3,10 @@ import { externalUrls } from "@/router/router-constants/externalUrl-values"; import { lazyLoadComponent } from "@/router/dynamic-routing/component-loader.js"; import { saveOrder } from "@/helpers/heritage-integration/order-helper.js"; import { fmgPageValues } from "@/router/router-constants/fmgPage-values"; +import { storeActions } from "@/constants/store-actions"; import store from "@/store"; import router from "@/router"; +import baseMixin from "@/mixins/base-mixin.js"; /* If the user has visited the funnel before this method will determine the bets place to @@ -40,7 +42,7 @@ export async function getPageToRouteExistingOrderTo(toRoute = {}, existingHerita Used to navigate to the heritage funnel with the correct query string and url. */ -export async function navigateToHeritageFunnel(suppressConceptFunnel = false) { +export async function navigateToHeritageFunnel() { // Create the order (or save existing order) when navigating to Heritage Funnel. await saveOrder(); @@ -49,7 +51,6 @@ export async function navigateToHeritageFunnel(suppressConceptFunnel = false) { { corid: store.getters.order.referralCorrelationId, src: "concept-funnel", - suppressConceptFunnel: suppressConceptFunnel } ); } @@ -57,6 +58,9 @@ export async function navigateToHeritageFunnel(suppressConceptFunnel = false) { export async function navigateAfterSaveToHeritageFunnel(currentRoute) { const currentComponent = currentRoute.matched[0].components; currentComponent.default.methods.resetDependentState(); + + setupOrderBeforeSave(); + // Create the order (or save existing order) when navigating to Heritage Funnel. await saveOrder(); @@ -141,4 +145,14 @@ function isVinRelatedPage(toRoute) { fmgPageValue === fmgPageValues.ADDRESS_LOOKUP || fmgPageValue === fmgPageValues.ADDRESS_VEHICLES || fmgPageValue === fmgPageValues.ESTIMATE; +} + +function setupOrderBeforeSave() { + const serviceLocation = store.getters.order.serviceLocation; + + if (!serviceLocation.address && (!serviceLocation.zipCode || serviceLocation.zipCode == store.getters.vehicle.registration.zipCode)) { + baseMixin.methods.dispatchStoreAction( + storeActions.UPDATE_SERVICE_LOCATION_WITH_VEHICLE_REGISTRATION + ); + } } \ No newline at end of file diff --git a/src/layouts/address-lookup/address-lookup.vue b/src/layouts/address-lookup/address-lookup.vue index 33939609b..ea5ba2a63 100644 --- a/src/layouts/address-lookup/address-lookup.vue +++ b/src/layouts/address-lookup/address-lookup.vue @@ -195,7 +195,7 @@ export default { if (!vinLookupResponse.data.isStatePermissible) { // State Restrictions forbid lookup by address - this.displayVinLookupByHomeAddressNotAllowedAlert = true; + this.displayVinLookupByHomeAddressNotAwllowedAlert = true; this.$refs.funnelFooter.removeLoader(); return; } diff --git a/src/store/index.js b/src/store/index.js index 608a981cd..f93dc6439 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -31,6 +31,9 @@ const getDefaultState = () => { }, }, serviceLocation: { + address: null, + city: null, + state: null, zipCode: null, }, customer: { @@ -251,8 +254,15 @@ export const mutations = { state.order.payment.isInsurance = orderInformation.IsInsuranceOrder; state.order.payment.insuranceCoverage.isVerified = orderInformation?.insuranceInfo.coverageVerified; - state.order.customer.emailAddress = orderInformation.customer.emailAddress + state.order.customer.emailAddress = orderInformation.customer.emailAddress; + }, + updateServiceLocationWithVehicleRegistration(state) { + console.log("Updating B") + state.order.serviceLocation.address = state.order.vehicle.registration.address; + state.order.serviceLocation.city = state.order.vehicle.registration.city; + state.order.serviceLocation.state = state.order.vehicle.registration.state; + state.order.serviceLocation.zipCode = state.order.vehicle.registration.zipCode; } } @@ -433,6 +443,10 @@ export const actions = { context.commit(storeMutations.UPDATE_REFERRAL_DATE, referralDate); context.commit(storeMutations.UPDATE_REFERRAL_CORRELATION_ID, referralCorrelationId); }, + updateServiceLocationWithVehicleRegistration(context) { + console.log("Updating A") + context.commit(storeMutations.UPDATE_SERVICE_LOCATION_WITH_VEHICLE_REGISTRATION); + }, logExperimentExposure(context, { userId, sessionKey, pageName, universeName }) { return globalMethods.callHttpClient({ @@ -550,6 +564,9 @@ export const actions = { emailAddress: order.customer.emailAddress, }, serviceLocation: { + streetAddress: order.serviceLocation.address, + city: order.serviceLocation.city, + state: order.serviceLocation.state, zipCode: order.serviceLocation.zipCode }, referralNumber: order.referralNumber,