Merge pull request #664 from Safelite/feature/SSR-683

fix bailout issue, update bailout name
This commit is contained in:
katiekroell 2024-05-01 09:08:21 -04:00 committed by GitHub
commit 733ad0f8c5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 35 additions and 36 deletions

View file

@ -9,7 +9,8 @@ const bailoutCode = Object.freeze({
TPANotEnabled: 7,
RequestCallback: 8,
HeavyTruckVehicle: 9,
NoPartsAvailable: 10
NoPartsAvailable: 10,
PartsServiceError: 11
});
export default bailoutCode;

View file

@ -53,8 +53,12 @@ const bailoutMessage = Object.freeze({
code: bailoutCode.HeavyTruckVehicle,
message: `User selected a heavy truck vehicle. Car ID: ${carId} `
}),
NoPartsAvailable: (error) => ({
NoPartsAvailable: () => ({
code: bailoutCode.NoPartsAvailable,
message: 'No parts were returned'
}),
PartsServiceError: (error) => ({
code: bailoutCode.PartsServiceError,
message: `An error occurred in getPartsOrQuestions. Error: ${getItemData(error)}`
})
});

View file

@ -433,7 +433,7 @@ export default {
const partsOrQuestionsResponse = await this.getPartsOrQuestions();
if (partsOrQuestionsResponse.error) {
this.mainStore.setBailout(bailoutMessage.NoPartsAvailable(partsOrQuestionsResponse.error.data));
this.mainStore.setBailout(bailoutMessage.PartsServiceError(partsOrQuestionsResponse.error.data));
window.console.error('Error on retrieving PartsOrQuestions');
this.$refs.siteFooter.removeLoader();
this.hasBailedOut = true;

View file

@ -74,12 +74,12 @@ export default {
vehicleBanner,
vinLocationInformation,
vinLookupAlerts,
vinQuestion,
vinQuestion
},
mixins: [baseFormMixin, vehicleQuestionsMixin],
provide() {
return {
vehicleFromLookup: computed(() => this.vehicleFromLookup),
vehicleFromLookup: computed(() => this.vehicleFromLookup)
};
},
async beforeRouteEnter(to, from, next) {
@ -89,8 +89,8 @@ export default {
const promiseResultMap = [
{
resultKey: 'cmsContent',
promise: cmsContentPromise,
},
promise: cmsContentPromise
}
];
const resultMap = await settleAllPromises(promiseResultMap);
@ -123,9 +123,9 @@ export default {
computed: {
isCarIdDifferentFromTheStore() {
return (
this.vehicleFromLookup !== null &&
this.hasValidCarId() &&
this.vehicleFromLookup.carId !== this.mainStore.vehicle.carId
this.vehicleFromLookup !== null
&& this.hasValidCarId()
&& this.vehicleFromLookup.carId !== this.mainStore.vehicle.carId
);
},
isTwoIdenticalYMMVehicleFound() {
@ -157,10 +157,8 @@ export default {
this.resetActiveAlert();
this.$refs.siteFooter.enableForwardAction();
this.needToLookupVehicle = true;
this.$refs.siteFooter.updateButtonText(
this.getCmsContent('SiteFooterWidget', 'ForwardButtonText')
);
},
this.$refs.siteFooter.updateButtonText(this.getCmsContent('SiteFooterWidget', 'ForwardButtonText'));
}
},
methods: {
arePagePrerequisiteValid() {
@ -171,8 +169,8 @@ export default {
},
hasValidCarId() {
return (
this.mainStore.vehicle.carId &&
this.mainStore.vehicle.carId !== '0'
this.mainStore.vehicle.carId
&& this.mainStore.vehicle.carId !== '0'
);
},
// NOTE: If form is not valid, this method is not called when 'Continue' button is clicked
@ -182,16 +180,12 @@ export default {
this.$refs.siteFooter.enableForwardAction();
if (this.needToLookupVehicle) {
const vehicleLookupResponse = await this.lookupVehicleByVin(
this.vin
);
const vehicleLookupResponse = await this.lookupVehicleByVin(this.vin);
if (vehicleLookupResponse.error) {
this.activeVehicleLookupAlertType =
vehicleLookupAlertTypes.NOT_FOUND;
this.mainStore.setBailout(
bailoutMessage.vehicleNotFound(this.vin)
);
this.mainStore.setBailout(bailoutMessage.vehicleNotFound(this.vin));
this.resetVehicleFromLookup();
this.$refs.siteFooter.removeLoader();
// Temp solution to turn on 'disabled' style on the Continue button
@ -207,7 +201,7 @@ export default {
this.vehicleFromLookup = Object.assign(
vehicleLookupResponse.data,
{
vin: this.vin,
vin: this.vin
}
);
}
@ -225,9 +219,7 @@ export default {
const vehicleYearMakeModelStyle =
// eslint-disable-next-line max-len
`${this.vehicleFromLookup.year} ${this.vehicleFromLookup.make} ${this.vehicleFromLookup.model} ${this.forwardButtonCarStyle}`;
this.$refs.siteFooter.updateButtonText(
`Continue with ${vehicleYearMakeModelStyle}`
);
this.$refs.siteFooter.updateButtonText(`Continue with ${vehicleYearMakeModelStyle}`);
this.$refs.siteFooter.removeLoader();
this.needToLookupVehicle = false;
@ -238,15 +230,13 @@ export default {
let isSelectedGlassAvailableForVehicle = true;
if (this.isCarIdDifferentFromTheStore) {
isSelectedGlassAvailableForVehicle =
await isGlassAvailableForCarId(
this.vehicleFromLookup.carId
);
await isGlassAvailableForCarId(this.vehicleFromLookup.carId);
}
// navigate back to vehicle-damage
if (
this.isCarIdDifferentFromTheStore &&
!isSelectedGlassAvailableForVehicle
this.isCarIdDifferentFromTheStore
&& !isSelectedGlassAvailableForVehicle
) {
this.mainStore.updateVehicle(this.vehicleFromLookup);
this.mainStore.resetDamageState();
@ -276,7 +266,7 @@ export default {
const partsOrQuestionsResponse = await this.getPartsOrQuestions();
if (partsOrQuestionsResponse.error) {
this.mainStore.setBailout(bailoutMessage.NoPartsAvailable(partsOrQuestionsResponse.error.data));
this.mainStore.setBailout(bailoutMessage.PartsServiceError(partsOrQuestionsResponse.error.data));
window.console.error('Error on retrieving PartsOrQuestions');
this.$refs.siteFooter.removeLoader();
this.hasBailedOut = true;
@ -300,8 +290,8 @@ export default {
} catch (responseError) {
return {
error: {
status: responseError.status,
},
status: responseError.status
}
};
}
},
@ -311,7 +301,7 @@ export default {
resetVehicleFromLookup() {
this.vehicleFromLookup = null;
},
resetDependentState() {},
},
resetDependentState() {}
}
};
</script>

View file

@ -55,6 +55,10 @@ const routingTable = () => [
{
scenario: navigationScenarios.CLICKED_FORWARD_WITHOUT_VIN,
destinationIssPageValue: issPageValues.VEHICLE_LOOKUP
},
{
scenario: navigationScenarios.CLICKED_FORWARD_WITH_BAILOUT,
destinationIssPageValue: issPageValues.BAILOUT_PAGE
}
]
},