Skip to content

refactor: move Booker hooks from packages/features to apps/web/modules#27343

Merged
hbjORbj merged 32 commits intomainfrom
devin/1769605389-booker-migration
Jan 31, 2026
Merged

refactor: move Booker hooks from packages/features to apps/web/modules#27343
hbjORbj merged 32 commits intomainfrom
devin/1769605389-booker-migration

Conversation

@hbjORbj
Copy link
Contributor

@hbjORbj hbjORbj commented Jan 28, 2026

What does this PR do?

Reorganizes Booker hooks from packages/features/bookings/Booker/components/hooks/ as part of the ongoing tRPC-driven UI migration effort. Hooks are split based on whether they're consumed by platform/atoms.

Hooks migrated to apps/web/modules/bookings/hooks/ (web-only):

  • useBookings
  • useCalendars
  • useDecoyBooking
  • useInitializeWeekStart
  • useIsQuickAvailabilityCheckFeatureEnabled
  • useOverlayCalendar
  • useSkipConfirmStep
  • useSlots
  • useVerifyCode
  • useVerifyEmail

Hooks moved to packages/features/bookings/Booker/hooks/ (consumed by platform/atoms, cannot import from web):

  • useAvailableTimeSlots
  • useBookerLayout
  • useBookerTime
  • useBookingForm
  • useInitialFormValues
  • useLocalSet

Additional changes:

  • Moved useSlotsViewOnSmallScreen to @calcom/embed-core/embed-iframe
  • Moved WrappedBookerProps and related types to apps/web/modules/bookings/types.ts
  • Moved QuickAvailabilityCheck type to packages/features/bookings/Booker/types.ts
  • Updated all import paths in consuming files (web app, platform atoms)

Impact:

  • This migration removed 5 runtime @calcom/trpc/react imports from packages/features/

This is part of the larger effort to break down PR #26571.

Updates since last revision

  • Added isBrowser guard to useSlotsViewOnSmallScreen hook in packages/embeds/embed-core/src/embed-iframe/react-hooks.ts to follow the file's client-only contract and avoid executing during SSR/prerendering (addressing Cubic AI review feedback, confidence 9/10)

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. N/A - no documentation changes needed.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  1. Verify the booker component works correctly in the web app
  2. Verify platform atoms that use the shared hooks still function properly
  3. Confirm embed functionality works on mobile devices (tests the useSlotsViewOnSmallScreen hook)

Human Review Checklist

  • Verify the isBrowser guard in useSlotsViewOnSmallScreen follows the same pattern as useBookerEmbedEvents in the same file
  • Confirm all import path updates are correct and no circular dependencies were introduced

Migrate the following Booker hooks:
- useOverlayCalendar
- useSkipConfirmStep
- useInitializeWeekStart
- useIsQuickAvailabilityCheckFeatureEnabled
- useDecoyBooking

These hooks are only imported by apps/web files, making them safe to move
without creating circular dependencies.

Part of the tRPC-driven UI migration from packages/features to apps/web/modules.

Co-Authored-By: benny@cal.com <sldisek783@gmail.com>
@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

devin-ai-integration bot and others added 5 commits January 28, 2026 13:21
…port paths

- Reverted useIsQuickAvailabilityCheckFeatureEnabled.ts back to packages/features since it's imported by useSlots.ts in packages/features (would create circular dependency)
- Fixed import paths in useOverlayCalendar.ts to use @calcom/features paths
- Fixed import paths in useSkipConfirmStep.ts to use @calcom/features paths
- Updated Booker.tsx to import useIsQuickAvailabilityCheckFeatureEnabled from original location

Co-Authored-By: benny@cal.com <sldisek783@gmail.com>
Co-Authored-By: benny@cal.com <sldisek783@gmail.com>
@pull-request-size pull-request-size bot added size/L and removed size/S labels Jan 30, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 31, 2026

E2E results are ready!

@hbjORbj hbjORbj changed the title refactor: move Booker hooks from packages/features to apps/web/modules refactor: Move Booker hooks from packages/features to apps/web/modules Jan 31, 2026
@hbjORbj hbjORbj marked this pull request as ready for review January 31, 2026 09:47
@hbjORbj hbjORbj requested review from a team as code owners January 31, 2026 09:47
@graphite-app graphite-app bot added core area: core, team members only foundation labels Jan 31, 2026
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 46 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="packages/embeds/embed-core/src/embed-iframe/react-hooks.ts">

<violation number="1" location="packages/embeds/embed-core/src/embed-iframe/react-hooks.ts:125">
P3: Add the isBrowser guard in this hook to follow the file’s client-only contract and avoid executing during SSR/prerendering.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@github-actions
Copy link
Contributor

Devin AI is addressing Cubic AI's review feedback

A Devin session has been created to address the issues identified by Cubic AI.

View Devin Session

hbjORbj and others added 3 commits January 31, 2026 19:01
Address Cubic AI review feedback (confidence 9/10) by adding the isBrowser
guard to the useSlotsViewOnSmallScreen hook to follow the file's client-only
contract and avoid executing during SSR/prerendering.

Co-Authored-By: unknown <>
Comment on lines -1 to -13
import { useIsEmbed, useEmbedUiConfig } from "@calcom/embed-core/embed-iframe";
import useMediaQuery from "@calcom/lib/hooks/useMediaQuery";

export const useSlotsViewOnSmallScreen = () => {
const isEmbed = useIsEmbed();
const isMobile = useMediaQuery("(max-width: 768px)");

const embedUiConfig = useEmbedUiConfig();

if (!isEmbed || !isMobile) return false;

return embedUiConfig.useSlotsViewOnSmallScreen ?? false;
};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is migrated to @calcom/embed-core/embed-iframe package since it's relevant to embeds

@devin-ai-integration devin-ai-integration bot changed the title refactor: Move Booker hooks from packages/features to apps/web/modules refactor: move Booker hooks from packages/features to apps/web/modules Jan 31, 2026
import { useIsQuickAvailabilityCheckFeatureEnabled } from "./useIsQuickAvailabilityCheckFeatureEnabled";

export type QuickAvailabilityCheck = TIsAvailableOutputSchema["slots"][number];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to packages/features and I typed it manually now to not depend on TIsAvailableOutputSchema, which is from trpc package

export type QuickAvailabilityCheck = {
  status: "available" | "reserved" | "minBookNoticeViolation" | "slotInPast";
  utcStartIso: string;
  utcEndIso: string;
  realStatus?: "available" | "reserved" | "minBookNoticeViolation" | "slotInPast" | undefined;
};

@hbjORbj hbjORbj requested a review from keithwillcode January 31, 2026 10:06
@hbjORbj hbjORbj enabled auto-merge (squash) January 31, 2026 10:06
@hbjORbj hbjORbj removed the request for review from keithwillcode January 31, 2026 10:10
@hbjORbj hbjORbj merged commit 73f5192 into main Jan 31, 2026
56 checks passed
@hbjORbj hbjORbj deleted the devin/1769605389-booker-migration branch January 31, 2026 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants