CASH-845: use isServiceable___ vars to selectively load mobile time-slots, inshop, or both

This commit is contained in:
AdamCaouetteSafelite 2025-07-18 01:13:39 -04:00
parent cefdb0fa70
commit d2cf736c4c

View file

@ -249,6 +249,8 @@ const getScheduleApiResponse = async ({
endDateString,
providerNumber,
zipCode,
includeMobileTimeSlots = true,
includeInshopTimeSlots = true,
}) => {
const apiEndDateLimit = sumDateString(startDateString, TIME_SLOTS_CALL_DAYS_LIMIT);
const difference = calcDaysBetweenDates(startDateString, endDateString);
@ -292,8 +294,8 @@ const getScheduleApiResponse = async ({
},
};
if (apiStartDate < apiEndDate) {
storeActionConfigs.push(storeActionConfigInshop);
storeActionConfigs.push(storeActionConfigMobile);
if (includeInshopTimeSlots) storeActionConfigs.push(storeActionConfigInshop);
if (includeMobileTimeSlots) storeActionConfigs.push(storeActionConfigMobile);
}
}
@ -329,6 +331,8 @@ const getScheduleApiResponse = async ({
...mobileTimeSlotsData.days,
...mobileTimeSlotsResponse.data.days,
];
mobileTimeSlotsData.type = mobileTimeSlotsResponse.data.type;
mobileTimeSlotsData.zipCode = mobileTimeSlotsResponse.data.zipCode;
} else {
const inshopTimeSlotsResponse =
await baseMixin.methods.dispatchStoreActionWithLogging(
@ -346,6 +350,9 @@ const getScheduleApiResponse = async ({
...inshopTimeSlotsData.days,
...inshopTimeSlotsResponse.data.days,
];
inshopTimeSlotsData.type = inshopTimeSlotsResponse.data.type;
inshopTimeSlotsData.providerNumber =
inshopTimeSlotsResponse.data.providerNumber;
}
})
);
@ -591,7 +598,6 @@ export default {
);
});
},
mounted() {
async mounted() {
const datePickerInitialData = await datePicker.methods.loadInitialData({
// setup config options for date-picker
@ -601,6 +607,8 @@ export default {
// preSelectedDate: preSelectedDate,
providerNumber: this.selectedProvider?.providerNumber,
zipCode: this.zipCode,
includeMobileTimeSlots: this.isServiceableMobile,
includeInshopTimeSlots: this.isServiceableInshop || this.isServiceableDropoff,
});
datePickerInitialData.pricingByDayBasePrice = this.pricingByDayBasePrice;
datePickerInitialData.pricingByDayUpcharge = this.pricingByDayUpcharge;