fix: gracefully handle calendar failures when bypassBusyCalendarTimes is enabled (#23061)

* fix: gracefully handle calendar failures when bypassBusyCalendarTimes is enabled

- When _bypassCalendarBusyTimes parameter is true and third-party calendar fetching fails
- System now falls back to internal bookings only instead of throwing error
- Maintains existing error behavior when bypass is disabled

Co-Authored-By: [email protected] <[email protected]>

* feat: add _silentCalendarFailures parameter to handle calendar failures gracefully

- Add silentlyHandleCalendarFailures parameter to getBusyTimes service
- Add _silentCalendarFailures parameter to getUserAvailability schema
- Add _silentCalendarFailures parameter to tRPC slots endpoint
- Add _silentCalendarFailures parameter to API v2 slots/available endpoint
- Parameter attempts calendar calls first, falls back silently on failure
- Different from bypassCalendarBusyTimes which skips calendar calls entirely

Co-Authored-By: [email protected] <[email protected]>

* refactor: remove bypassBusyCalendarTimes logic from error handling

- Keep only silentlyHandleCalendarFailures logic in getBusyTimes error handling
- Remove redundant bypassBusyCalendarTimes condition from calendar failure handling
- Maintain existing bypassBusyCalendarTimes logic that skips calendar calls entirely

Co-Authored-By: [email protected] <[email protected]>

* feat: add silentlyHandleCalendarFailures prop to Booker atom

- Pass silentlyHandleCalendarFailures prop from BookerPlatformWrapper to useAvailableSlots
- Forward prop as _silentCalendarFailures parameter to API v2 slots/available endpoint
- Complete the parameter flow from Booker atom to underlying service layer
- Enables silent handling of calendar provider failures in Booker component

Co-Authored-By: [email protected] <[email protected]>

* chore: fix type and bump library

* chore: bump library

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: [email protected] <[email protected]>
Co-authored-by: Somay Chauhan <[email protected]>
Co-authored-by: Morgan <[email protected]>
This commit is contained in:
authored and GitHub committed 2025-08-14 18:41:53 +03:00
1 parent 994a36d039
commit e237749abd
11 files changed
+102 -302

No files matched your search

@@ -35,6 +35,7 @@ export const getScheduleSchemaObject = z.object({
skipContactOwner: z.boolean().nullish(),
_enableTroubleshooter: z.boolean().optional(),
_bypassCalendarBusyTimes: z.boolean().optional(),
_silentCalendarFailures: z.boolean().optional(),
_shouldServeCache: z.boolean().optional(),
routingFormResponseId: z.number().optional(),
queuedFormResponseId: z.string().nullish(),
@@ -737,6 +737,7 @@ export class AvailableSlotsService {
startTime,
endTime,
bypassBusyCalendarTimes,
silentCalendarFailures,
shouldServeCache,
}: {
input: TGetScheduleInputSchema;
@@ -753,6 +754,7 @@ export class AvailableSlotsService {
startTime: ReturnType<(typeof AvailableSlotsService)["prototype"]["getStartTime"]>;
endTime: Dayjs;
bypassBusyCalendarTimes: boolean;
silentCalendarFailures: boolean;
shouldServeCache?: boolean;
}) {
const usersWithCredentials = this.getUsersWithCredentials({
@@ -887,6 +889,7 @@ export class AvailableSlotsService {
duration: input.duration || 0,
returnDateOverrides: false,
bypassBusyCalendarTimes,
silentlyHandleCalendarFailures: silentCalendarFailures,
shouldServeCache,
},
initialData: {
@@ -958,6 +961,7 @@ export class AvailableSlotsService {
const {
_enableTroubleshooter: enableTroubleshooter = false,
_bypassCalendarBusyTimes: bypassBusyCalendarTimes = false,
_silentCalendarFailures: silentCalendarFailures = false,
_shouldServeCache,
routingFormResponseId,
queuedFormResponseId,
@@ -1069,6 +1073,7 @@ export class AvailableSlotsService {
? this.getStartTime(twoWeeksFromNow.format(), input.timeZone, eventType.minimumBookingNotice)
: endTime,
bypassBusyCalendarTimes,
silentCalendarFailures,
shouldServeCache,
});
@@ -1095,6 +1100,7 @@ export class AvailableSlotsService {
startTime: dayjs(),
endTime: twoWeeksFromNow,
bypassBusyCalendarTimes,
silentCalendarFailures,
shouldServeCache,
});
if (
@@ -1129,6 +1135,7 @@ export class AvailableSlotsService {
startTime,
endTime,
bypassBusyCalendarTimes,
silentCalendarFailures,
shouldServeCache,
}));
aggregatedAvailability = getAggregatedAvailability(allUsersAvailability, eventType.schedulingType);