diff --git a/src/constants/endpoints.js b/src/constants/endpoints.js index 9f4c60d61..1fc6c2b8f 100644 --- a/src/constants/endpoints.js +++ b/src/constants/endpoints.js @@ -54,6 +54,10 @@ const endpoints = { url: "/vehicle/api/v1/vehicle/lookup-vin-by-address", method: "POST", }, + IsVinByAddressPermissible: { + url: "/vehicle/api/v1/vehicle/is-vin-by-address-permissible", + method: "GET", + }, GetPartsOrQuestions: { url: "/parts/api/v1/parts/parts-or-questions", method: "POST", diff --git a/src/constants/store-actions.js b/src/constants/store-actions.js index 428280d40..c11356d69 100644 --- a/src/constants/store-actions.js +++ b/src/constants/store-actions.js @@ -13,6 +13,7 @@ const storeActions = { GET_DAMAGE_OPTIONS: "getDamageOptions", GET_EVOX_IMAGE: "getEvoxImage", IS_VIN_OPTIONAL_VEHICLE: "isVinOptionalVehicle", + IS_VIN_BY_ADDRESS_PERMISSIBLE: "isVinByAddressPermissible", // Lookup Actions LOOKUP_VEHICLE_BY_YMMS: "lookupVehicleByYmms", diff --git a/src/layouts/estimate/estimate.vue b/src/layouts/estimate/estimate.vue index 4eafab25e..722357e62 100644 --- a/src/layouts/estimate/estimate.vue +++ b/src/layouts/estimate/estimate.vue @@ -112,6 +112,8 @@ import { experimentSettings } from "@/constants/experiments"; import vinPagesMixin from "@/mixins/vin-pages-mixin"; import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper"; import { saveSession } from "@/helpers/heritage-integration/order-helper.js"; +import baseMixin from "@/mixins/base-mixin.js"; +import { queryStrings } from "@/constants/query-strings"; // Define Validation Rules defineRule("zip-required", required(errorMessages.SERVICE_ZIP_REQUIRED)); @@ -145,12 +147,27 @@ export default { //Call APIs const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage); + const zip = Object.hasOwn(to.query, queryStrings.ZIP_CODE) ? to.query.zipCode : null; + var vinByAddressPromise; + if (zip) { + vinByAddressPromise = baseMixin.methods.dispatchStoreAction( + storeActions.IS_VIN_BY_ADDRESS_PERMISSIBLE, + zip, + false + ); + } + //Settle promises and get results const promiseResultMap = [ { resultKey: "cmsContent", promise: cmsContentPromise, }, + zip != null && + zip != undefined && { + resultKey: "vinByAddress", + promise: vinByAddressPromise, + }, ]; const resultMap = await settleAllPromises(promiseResultMap); @@ -172,6 +189,14 @@ export default { } } + if (zip) { + var indexToRemove = resultMap.cmsContent.VinLookupMethod.Answers.findIndex( + (answer) => answer.Name === "HomeAddress" + ); + if (indexToRemove) { + resultMap.cmsContent.VinLookupMethod.Answers.splice(indexToRemove, 1); + } + } vm.setCmsContent(resultMap.cmsContent); }); }, diff --git a/src/store/index.js b/src/store/index.js index 93a3e5a25..f42a950ea 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -530,6 +530,13 @@ export const actions = { }, }); }, + isVinByAddressPermissible(context, zip) { + return globalMethods.callHttpClient({ + method: endpoints.IsVinByAddressPermissible.method, + endpoint: `${endpoints.IsVinByAddressPermissible.url}?zipcode=${zip}`, + payload: {}, + }); + }, getVehicleMakes(context, { year }) { return globalMethods.callHttpClient({ method: endpoints.GetVehicleMakes.method,