Merge pull request #567 from Safelite/feature/CSR-659

Feature/csr 659
This commit is contained in:
Leah Schumann 2022-06-16 13:30:03 -04:00 committed by GitHub
commit 048ddd295c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -203,10 +203,13 @@ export default {
this.getCmsContent("FunnelFooterWidget", "ForwardButtonText")
);
},
zip() {
this.noServiceZip = false;
},
},
computed: {
perfectMatchNewVinAlert() {
const isVinPerfectMatch = this.vinPopulatedOnPageLoad && this.vin === this.getVinFromStore();
const isVinPerfectMatch = this.vinPopulatedOnPageLoad && this.initialVin === this.getVinFromStore();
this.updateIsCarIdDifferent(isVinPerfectMatch);
return isVinPerfectMatch;
},
@ -309,33 +312,39 @@ export default {
const zipValidation = this.validateZip(this.zip);
const zipValidationResponse = await zipValidation;
// Check if Service Zip entered is servicable, if not display an alert
if (!zipValidationResponse.data.isServiceable) {
this.customAlertData.zip = this.zip;
this.$refs.funnelFooter.removeLoader();
this.customAlertData.zip = this.zip;
this.noServiceZip = true;
this.invalidZip = this.zip;
return;
}
// If the user has clicked on the VIN field, either they are doing a new VIN lookup or changing the VIN previously matched.
// Therefore we need to do a VIN Lookup
let vehicleLookupResponse;
if (this.vinTouched && this.vin != this.initialVin) {
// If the user has clicked on the VIN field, either they are doing a new VIN lookup or changing the VIN previously matched.
// Therefore we need to do a VIN Lookup
const vinToLookup = this.vinTouched ? this.vin : this.initialVin;
const vehicleLookup = this.lookupVehicle(vinToLookup);
vehicleLookupResponse = await vehicleLookup.catch((response) => {
if (response.status == StatusCodes.NOT_FOUND) {
this.vinNotFound = true;
this.$refs.funnelFooter.removeLoader();
this.noServiceZip = false;
return false;
}
});
if (!vehicleLookupResponse) {
return;
}
// if the ZIP is not serviceable or the Vin Lookup didn't return anything then don't complete the process and navigate forward.
if (!zipValidationResponse.data.isServiceable || !vehicleLookupResponse) {
this.$refs.funnelFooter.removeLoader();
return;
}
} else {
// if the ZIP is not serviceable then don't navigate forward.
if (!zipValidationResponse.data.isServiceable) {
this.$refs.funnelFooter.removeLoader();
return;
}
this.navigateForward();
return;
}