Merge pull request #2357 from Safelite/feature/CASH-276

Feature/cash 276
This commit is contained in:
CarlNation 2025-03-17 14:39:29 -04:00 committed by GitHub
commit a37948db80
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 32 additions and 10 deletions

View file

@ -188,6 +188,10 @@ const endpoints = {
url: "/account/api/v1/account/bill-to-account-number",
method: "GET",
},
ClosestApplicableShops: {
url: "/location/api/v1/location/closest-applicable-shops",
method: "GET",
},
};
export { endpoints };

View file

@ -53,6 +53,7 @@ const storeActions = {
GET_INSURANCE_COMPANY_LIST: "getInsuranceCompanyList",
GET_BILL_TO_ACCOUNT_NUMBER: "getBillToAccountNumber",
GET_RECAL_PARTS_AND_SAVE_TO_LINE_ITEMS: "getRecalPartsAndSaveToLineItems",
GET_CLOSEST_APPLICABLE_SHOPS: "getClosestApplicableShops",
// Analytics
LOG_EXPERIMENT_EXPOSURE_AND_UPDATE_STORE: "logExperimentExposureAndUpdateStore",

View file

@ -49,7 +49,7 @@
placeHolderText="Select style"
customDropdownId="styleQuestionField" />
<div v-if="showHeavyTruck">
<div v-if="isHeavyTruck">
<div class="separator-line"></div>
<textboxQuestion
class="mb-4"
@ -140,6 +140,7 @@ export default {
modelOptions: [],
styleOptions: [],
displayNoServiceAlert: false,
canSafeliteService: false,
};
},
@ -425,10 +426,8 @@ export default {
!!this.carId
);
},
showHeavyTruck() {
return (
this.vehicleSubType === vehicleSubTypes.HEAVY_TRUCK && !this.displayNoServiceAlert
);
isHeavyTruck() {
return this.vehicleSubType === vehicleSubTypes.HEAVY_TRUCK && this.canSafeliteService;
},
},
methods: {
@ -479,11 +478,8 @@ export default {
this.imageVifNumber = result?.data.imageVifNumber;
this.imageVifColor = result?.data.imageVifColor;
this.displayNoServiceAlert = !result?.data.canSafeliteService;
this.canSafeliteService = result?.data.canSafeliteService;
this.vehicleSubType = result?.data.vehicleSubType;
// if (this.showHeavyTruck) {
// }
},
resetAlert() {
this.displayNoServiceAlert = false;
@ -507,7 +503,7 @@ export default {
false
);
if (this.showHeavyTruck) {
if (this.isHeavyTruck) {
const zipCodeData = await this.getZipCodeData(this.serviceZipCode);
await this.dispatchStoreAction(
storeActions.SAVE_SERVICE_ZIP_CODE_INFO,
@ -518,6 +514,18 @@ export default {
},
false
);
// check the location endpoint to verify this zip can service a heavy truck
var closestShops = await this.dispatchStoreActionWithLogging(
storeActions.GET_CLOSEST_APPLICABLE_SHOPS,
{ zip: this.serviceZipCode, carId: this.carId },
"vehicle"
);
if (!closestShops || closestShops.data?.providers?.length === 0) {
this.displayNoServiceAlert = true;
return this.$refs.navbar.removeLoader();
}
}
this.$router.navigateWithSaving(this.navigationScenarios.CLICKED_FORWARD, this.$route);

View file

@ -1244,6 +1244,15 @@ export const actions = {
});
},
getClosestApplicableShops(context, { payload: { zip, carId }, pageNameToLog }) {
return globalMethods.callHttpClient({
methods: endpoints.ClosestApplicableShops.method,
endpoint: `${endpoints.ClosestApplicableShops.url}/${zip}/${carId}`,
logApiCall: true,
pageNameToLog: pageNameToLog,
});
},
// Dependency Actions
resetVehicleStateAndDependencies(context) {
context.commit(storeMutations.RESET_VEHICLE_STATE);