Merge pull request #1066 from Safelite/feature/CSR-1337

CSR-1337
This commit is contained in:
CarlNation 2023-04-20 10:22:08 -04:00 committed by GitHub
commit 024f2ab30e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 4 deletions

View file

@ -101,6 +101,9 @@ describe("estimate.vue", () => {
//Arrange
const { wrapper } = setupMocks({});
delete window.location;
window.location = { search: "?fmgPage=estimate&zipcode=43015" };
//Act
estimate.beforeRouteEnter.call(
wrapper.vm,

View file

@ -149,11 +149,17 @@ export default {
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const hasZip = urlParams.has(queryStrings.ZIP_CODE);
const zip = urlParams.get(queryStrings.ZIP_CODE);
const lowerCaseParams = new URLSearchParams();
for (const [name, value] of urlParams) {
lowerCaseParams.append(name.toLowerCase(), value);
}
const zip = lowerCaseParams.get(queryStrings.ZIP_CODE)
? lowerCaseParams.get(queryStrings.ZIP_CODE)
: store.getters.order.serviceLocation.zipCode;
var vinByAddressPromise;
if (hasZip) {
if (zip) {
vinByAddressPromise = baseMixin.methods.dispatchStoreAction(
storeActions.IS_VIN_BY_ADDRESS_PERMISSIBLE,
zip,
@ -193,7 +199,7 @@ export default {
}
}
if (zip && resultMap.vinByAddress === false) {
if (!zip || resultMap.vinByAddress === false) {
var indexToRemove = resultMap.cmsContent.VinLookupMethod.Answers.findIndex(
(answer) => answer.Name === "HomeAddress"
);
@ -201,6 +207,7 @@ export default {
resultMap.cmsContent.VinLookupMethod.Answers.splice(indexToRemove, 1);
}
}
vm.setCmsContent(resultMap.cmsContent);
});
},