diff --git a/src/constants/bailoutCode.js b/src/constants/bailoutCode.js index 6e562261..0753da70 100644 --- a/src/constants/bailoutCode.js +++ b/src/constants/bailoutCode.js @@ -9,7 +9,8 @@ const bailoutCode = Object.freeze({ TPANotEnabled: 7, RequestCallback: 8, HeavyTruckVehicle: 9, - NoPartsAvailable: 10 + NoPartsAvailable: 10, + PartsServiceError: 11 }); export default bailoutCode; diff --git a/src/constants/bailoutMessage.js b/src/constants/bailoutMessage.js index d18d4a3a..2dbbcfe6 100644 --- a/src/constants/bailoutMessage.js +++ b/src/constants/bailoutMessage.js @@ -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)}` }) }); diff --git a/src/layouts/vehicle-damage/vehicle-damage.vue b/src/layouts/vehicle-damage/vehicle-damage.vue index f4eb66fd..b756523e 100644 --- a/src/layouts/vehicle-damage/vehicle-damage.vue +++ b/src/layouts/vehicle-damage/vehicle-damage.vue @@ -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; diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index cfc74792..5517b3ac 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -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() {} + } }; diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js index a005582f..6a66676d 100644 --- a/src/router/router-constants/routing-table.js +++ b/src/router/router-constants/routing-table.js @@ -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 } ] },