From 08dca0f147c96cfedc84aac6b6111d39c2fca608 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 9 Apr 2026 21:05:21 +0000 Subject: [PATCH] fix: prevent mobile schedule requests for non-mobile-eligible orders Three bugs fixed: 1. Typo: order.lineItem -> order.lineItems in resetScheduleIfUnavailable The premium fee check was accessing a non-existent property, so the condition always evaluated to undefined (falsy), skipping the offerPremium validation entirely. 2. findIndex truthiness: findIndex returns -1 (truthy!) when not found and 0 (falsy!) when found at index 0. Changed to >= 0 check. 3. Unsafe default: getScheduleApiResponse had includeMobileTimeSlots defaulting to true, meaning any new caller that forgot the flag would request mobile time slots regardless of serviceability. Changed default to false. Co-authored-by: Mark Harris --- src/layouts/schedule/schedule.vue | 2 +- src/store/index.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/layouts/schedule/schedule.vue b/src/layouts/schedule/schedule.vue index f5462fb9e..fc5cd86b2 100644 --- a/src/layouts/schedule/schedule.vue +++ b/src/layouts/schedule/schedule.vue @@ -323,7 +323,7 @@ const getScheduleApiResponse = async ({ providerNumber, inshopProviderNumber, zipCode, - includeMobileTimeSlots = true, + includeMobileTimeSlots = false, includeInshopTimeSlots = true, }) => { const apiEndDateLimit = sumDateString(startDateString, TIME_SLOTS_CALL_DAYS_LIMIT); diff --git a/src/store/index.js b/src/store/index.js index cce36cf8a..64d1504c3 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -4169,9 +4169,9 @@ async function resetScheduleIfUnavailable(context, order, pageNameToLog) { var mobileRouteCodeFound = false; // if early bird fee is in supporting items then need to check the timeslot to see if offer premium is also still available if ( - order.lineItem?.supportingItems?.findIndex( + order.lineItems?.supportingItems?.findIndex( (item) => item.partType == PREMIUM_FEE_PART_TYPE - ) + ) >= 0 ) { newTimeSlotsResponse.data.days?.forEach((day) => { day.timeSlots.forEach((ts) => {