From 51bce6763f4d935c0dbd7cf44b1afb442a090f26 Mon Sep 17 00:00:00 2001 From: Keith Williams Date: Sat, 20 Dec 2025 23:43:04 -0300 Subject: [PATCH] refactor: split tRPC build into server and react phases (#26082) * refactor: import AppRouter from generated types instead of server source This change improves tRPC build performance by having the client-side code import AppRouter from pre-generated type declarations instead of traversing the entire server router tree. Changes: - Create type bridge file at packages/trpc/types/app-router.ts - Update packages/trpc/react/trpc.ts to import from the bridge - Update .gitignore to only ignore types/server (generated files) - Update eslint.config.mjs to only ignore types/server (generated files) The type bridge provides: 1. Faster typechecking - avoids parsing 458 server files 2. Stable import location that's easy to lint against 3. Single place to adjust if generated path changes Build order is already enforced in turbo.json (type-check depends on @calcom/trpc#build). Co-Authored-By: keith@cal.com * fix: move bridge file to react/ to avoid TS5055 error Move the AppRouter type bridge file from types/app-router.ts to react/app-router.ts to avoid the TS5055 'Cannot write file because it would overwrite input file' error. The issue was that placing the bridge file in types/ caused TypeScript to treat the generated .d.ts files as input files during the tRPC build, then fail when trying to emit to the same location. By placing the bridge in react/ (which is excluded from the tRPC server build), the bridge file is only used by client code and doesn't interfere with the server type generation. Changes: - Move bridge file from types/app-router.ts to react/app-router.ts - Update import in react/trpc.ts to use ./app-router - Revert .gitignore to ignore all of types/ (generated files) - Revert eslint.config.mjs to ignore all of types/** Co-Authored-By: keith@cal.com * refactor: split tRPC build into server and react phases - Create tsconfig.server.json for server-only type generation - Create tsconfig.react.json for react/client type generation - Update build script to run server build first, then react build - Remove || true so build properly fails on errors - This allows react code to import from generated server types Co-Authored-By: keith@cal.com * refactor: split @calcom/trpc exports to separate server and react entrypoints - Remove react exports from @calcom/trpc root (index.ts) - Update 89 files to import from @calcom/trpc/react instead of @calcom/trpc - This fixes the boundary leak where server builds were pulling in react code - Server build no longer compiles react/app-router.ts, fixing the chicken-and-egg issue where react code needed generated server types that didn't exist yet This improves TypeScript build performance by preventing the server type generation from traversing the entire react/client type graph. Co-Authored-By: keith@cal.com * fix: import WorkflowType from lib/types instead of React component This fixes a boundary leak where the server build was pulling in React components through the WorkflowRepository import chain. By importing WorkflowListType from lib/types instead of WorkflowListPage.tsx, the server build no longer traverses React component files. Co-Authored-By: keith@cal.com * fix: extract server-safe types to prevent boundary leaks in tRPC build - Extract ChildrenEventType to lib/childrenEventType.ts (server-safe) - Extract Slots type to calendars/lib/slots.ts (server-safe) - Create types.server.ts files for eventtypes and bookings - Update server code to import from server-safe type files - Update DatePicker.tsx to use extracted Slots type - Update app-store utils to use BookerEventForAppData type This prevents the server build from pulling in React files through transitive imports from @calcom/features barrel exports. Co-Authored-By: keith@cal.com * fix: update Segment.test.tsx mock path to @calcom/trpc/react The test was mocking @calcom/trpc but importing from @calcom/trpc/react. After the entrypoint separation, the mock path needs to match the import path. Co-Authored-By: keith@cal.com * fix: temporarily restore || true to unblock PR merge The pre-existing Prisma type errors (~345 errors) will be addressed in a follow-up PR. This allows the two-phase build architecture changes to be merged first. Co-Authored-By: keith@cal.com * Run trpc build as part of API v2 build * Removed the bridge file * refactor: extract event type schemas to server-safe file - Create packages/features/eventtypes/lib/schemas.ts with createEventTypeInput and EventTypeDuplicateInput - Update types.ts to re-export schemas from the new server-safe location - Update tRPC schema files to import from schemas.ts instead of types.server.ts - Delete types.server.ts (was duplicating ~200 lines unnecessarily) This keeps the server build graph clean while avoiding code duplication. Co-Authored-By: keith@cal.com * Removed the optionality of the tRPC builds * Removed the extra command for API v2 * refactor: rename calendars/lib/slots.ts to types.ts Per Keith's feedback, renamed the file to types.ts since it contains type definitions. Co-Authored-By: keith@cal.com * Added back tRPC build:server for API v2 --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Dhairyashil Shinde <93669429+dhairyashiil@users.noreply.github.com> --- apps/api/v2/package.json | 2 +- .../apps/alby/AlbyPaymentComponent.tsx | 2 +- apps/web/components/apps/alby/Setup.tsx | 2 +- .../btcpayserver/BtcpayPaymentComponent.tsx | 2 +- .../components/apps/btcpayserver/Setup.tsx | 2 +- apps/web/components/apps/hitpay/Setup.tsx | 2 +- apps/web/components/apps/paypal/Setup.tsx | 6 +- .../apps/routing-forms/TestForm.tsx | 2 +- apps/web/modules/auth/verify-email-view.tsx | 2 +- .../connect-and-join-view.tsx | 2 +- .../insights/insights-call-history-view.tsx | 2 +- .../insights/insights-virtual-queues-view.tsx | 2 +- .../settings/admin/locked-sms-view.tsx | 2 +- .../web/modules/settings/admin/oauth-view.tsx | 2 +- .../new/_components/OnboardMembersView.tsx | 4 +- .../new/_components/PaymentStatusView.tsx | 2 +- .../components/blocked-entries-table.tsx | 2 +- .../components/pending-reports-table.tsx | 2 +- .../insights/add-new-booking-charts.mdx | 2 +- .../app-store/_utils/getEventTypeAppData.ts | 4 +- .../_utils/payments/getPaymentAppData.ts | 5 +- packages/features/Segment.test.tsx | 4 +- packages/features/Segment.tsx | 2 +- packages/features/apps/components/AppList.tsx | 2 +- .../Booker/components/hooks/useBookings.ts | 2 +- .../Booker/components/hooks/useSlots.ts | 4 +- .../Booker/components/hooks/useVerifyEmail.ts | 2 +- packages/features/bookings/types.server.ts | 14 +++++ packages/features/bookings/types.ts | 6 +- packages/features/calendars/DatePicker.tsx | 16 +---- packages/features/calendars/lib/types.ts | 14 +++++ .../segment/DeleteSegmentDialog.tsx | 2 +- .../segment/DuplicateSegmentDialog.tsx | 2 +- .../segment/RenameSegmentDialog.tsx | 2 +- .../licensekey/CreateLicenseKeyForm.tsx | 2 +- .../components/TeamInviteFromOrg.tsx | 2 +- .../DisableAutofillOnBookingPageSwitch.tsx | 4 +- .../DisableGuestBookingEmailsSetting.tsx | 2 +- ...DisablePhoneOnlySMSNotificationsSwitch.tsx | 4 +- .../pages/components/LockEventTypeSwitch.tsx | 4 +- .../components/NoSlotsNotificationSwitch.tsx | 4 +- .../pages/components/OrgAutoJoinSetting.tsx | 2 +- .../settings/admin/WorkspacePlatformPage.tsx | 2 +- .../ee/teams/components/EventTypesList.tsx | 2 +- .../GoogleWorkspaceInviteButton.tsx | 2 +- .../components/InviteLinkSettingsModal.tsx | 2 +- .../components/MemberInvitationModal.tsx | 4 +- .../ee/teams/components/MemberList.tsx | 2 +- .../ee/workflows/pages/call-history.tsx | 2 +- .../repositories/WorkflowRepository.ts | 2 +- .../components/ChildrenEventTypeSelect.tsx | 20 +------ .../eventtypes/lib/childrenEventType.ts | 20 +++++++ packages/features/eventtypes/lib/schemas.ts | 54 +++++++++++++++++ packages/features/eventtypes/lib/types.ts | 60 ++----------------- .../insights/HOW_TO_ADD_BOOKING_CHARTS.md | 2 +- .../booking/AverageEventDurationChart.tsx | 2 +- .../components/booking/BookingKPICards.tsx | 2 +- .../booking/BookingsByHourChart.tsx | 2 +- .../components/booking/CSATOverTimeChart.tsx | 2 +- .../components/booking/EventTrendsChart.tsx | 2 +- .../booking/HighestNoShowHostTable.tsx | 2 +- .../booking/HighestRatedMembersTable.tsx | 2 +- .../booking/LeastBookedTeamMembersTable.tsx | 2 +- .../booking/LeastCompletedBookings.tsx | 2 +- .../booking/LowestRatedMembersTable.tsx | 2 +- .../booking/MostBookedTeamMembersTable.tsx | 2 +- .../booking/MostCancelledBookingsTables.tsx | 2 +- .../booking/MostCompletedBookings.tsx | 2 +- .../booking/NoShowHostsOverTimeChart.tsx | 2 +- .../components/booking/PopularEventsTable.tsx | 2 +- .../booking/RecentFeedbackTable.tsx | 2 +- .../booking/RecentNoShowGuestsChart.tsx | 2 +- .../routing/FailedBookingsByField.tsx | 2 +- .../components/routing/RoutedToPerPeriod.tsx | 2 +- .../routing/RoutingFormResponsesTable.tsx | 2 +- .../components/routing/RoutingFunnel.tsx | 2 +- .../components/routing/RoutingKPICards.tsx | 2 +- .../insights/filters/Download/Download.tsx | 2 +- .../Download/RoutingFormResponsesDownload.tsx | 2 +- .../insights/filters/OrgTeamsFilter.tsx | 2 +- .../insights/hooks/useDefaultRoutingForm.ts | 2 +- .../useInsightsBookingFacetedUniqueValues.ts | 2 +- .../useInsightsRoutingFacetedUniqueValues.ts | 2 +- packages/features/insights/lib/types.ts | 2 +- .../shell/user-dropdown/ProfileDropdown.tsx | 2 +- .../components/AvailabilitySliderTable.tsx | 2 +- packages/features/tips/UpgradeTip.tsx | 2 +- .../components/EventTypeSelect.tsx | 2 +- .../components/LargeCalendar.tsx | 2 +- .../components/CalendarCredentialBanner.tsx | 2 +- .../InvalidAppCredentialsBanner.tsx | 2 +- .../UserTable/BulkActions/EventTypesList.tsx | 2 +- .../BulkActions/MassAssignAttributes.tsx | 2 +- .../UserTable/BulkActions/TeamList.tsx | 2 +- .../UserTable/DeleteMemberModal.tsx | 2 +- .../UserTable/InviteMemberModal.tsx | 2 +- .../UserTable/PlatformManagedUsersTable.tsx | 2 +- .../components/UserTable/UserListTable.tsx | 2 +- .../users/components/UserTable/types.ts | 2 +- .../users/components/VerifyEmailBanner.tsx | 2 +- .../AddMembersWithSwitchWebWrapper.tsx | 2 +- packages/trpc/index.ts | 4 +- packages/trpc/package.json | 5 +- packages/trpc/react/trpc.ts | 2 +- .../viewer/eventTypes/heavy/create.schema.ts | 2 +- .../eventTypes/heavy/duplicate.schema.ts | 2 +- packages/trpc/tsconfig.react.json | 27 +++++++++ packages/trpc/tsconfig.server.json | 27 +++++++++ turbo.json | 1 + 109 files changed, 283 insertions(+), 202 deletions(-) create mode 100644 packages/features/bookings/types.server.ts create mode 100644 packages/features/calendars/lib/types.ts create mode 100644 packages/features/eventtypes/lib/childrenEventType.ts create mode 100644 packages/features/eventtypes/lib/schemas.ts create mode 100644 packages/trpc/tsconfig.react.json create mode 100644 packages/trpc/tsconfig.server.json diff --git a/apps/api/v2/package.json b/apps/api/v2/package.json index 2006fd05d4..78756bdeef 100644 --- a/apps/api/v2/package.json +++ b/apps/api/v2/package.json @@ -16,7 +16,7 @@ "_dev:build:watch:enums": "yarn workspace @calcom/platform-enums build:watch", "_dev:build:watch:utils": "yarn workspace @calcom/platform-utils build:watch", "_dev:build:watch:types": "yarn workspace @calcom/platform-types build:watch", - "dev:build": "yarn workspace @calcom/platform-constants build && yarn workspace @calcom/platform-enums build && yarn workspace @calcom/platform-utils build && yarn workspace @calcom/platform-types build && yarn workspace @calcom/platform-libraries build", + "dev:build": "yarn workspace @calcom/platform-constants build && yarn workspace @calcom/platform-enums build && yarn workspace @calcom/platform-utils build && yarn workspace @calcom/platform-types build && yarn workspace @calcom/platform-libraries build && yarn workspace @calcom/trpc build:server", "dev": "yarn dev:build && ts-node scripts/docker-start.ts && yarn copy-swagger-module && yarn start --watch", "dev:no-docker": "yarn dev:build && yarn copy-swagger-module && yarn start --watch", "start:debug": "nest start --debug --watch", diff --git a/apps/web/components/apps/alby/AlbyPaymentComponent.tsx b/apps/web/components/apps/alby/AlbyPaymentComponent.tsx index 64488f59b7..73e3ea1c53 100644 --- a/apps/web/components/apps/alby/AlbyPaymentComponent.tsx +++ b/apps/web/components/apps/alby/AlbyPaymentComponent.tsx @@ -10,7 +10,7 @@ import type { PaymentPageProps } from "@calcom/features/ee/payments/pages/paymen import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams"; import { useCopy } from "@calcom/lib/hooks/useCopy"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { Button } from "@calcom/ui/components/button"; import { Spinner } from "@calcom/ui/components/icon"; import { showToast } from "@calcom/ui/components/toast"; diff --git a/apps/web/components/apps/alby/Setup.tsx b/apps/web/components/apps/alby/Setup.tsx index 9f46004694..4d009286e2 100644 --- a/apps/web/components/apps/alby/Setup.tsx +++ b/apps/web/components/apps/alby/Setup.tsx @@ -9,7 +9,7 @@ import { albyCredentialKeysSchema } from "@calcom/app-store/alby/lib/albyCredent import type { IAlbySetupProps } from "@calcom/app-store/alby/pages/setup/_getServerSideProps"; import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { Badge } from "@calcom/ui/components/badge"; import { Button } from "@calcom/ui/components/button"; import { Icon } from "@calcom/ui/components/icon"; diff --git a/apps/web/components/apps/btcpayserver/BtcpayPaymentComponent.tsx b/apps/web/components/apps/btcpayserver/BtcpayPaymentComponent.tsx index e89db5fab3..4635e64288 100644 --- a/apps/web/components/apps/btcpayserver/BtcpayPaymentComponent.tsx +++ b/apps/web/components/apps/btcpayserver/BtcpayPaymentComponent.tsx @@ -8,7 +8,7 @@ import type { PaymentPageProps } from "@calcom/features/ee/payments/pages/paymen import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams"; import { useCopy } from "@calcom/lib/hooks/useCopy"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { Button } from "@calcom/ui/components/button"; import { Spinner } from "@calcom/ui/components/icon"; import { showToast } from "@calcom/ui/components/toast"; diff --git a/apps/web/components/apps/btcpayserver/Setup.tsx b/apps/web/components/apps/btcpayserver/Setup.tsx index 3ebc2f0f6c..194c537964 100644 --- a/apps/web/components/apps/btcpayserver/Setup.tsx +++ b/apps/web/components/apps/btcpayserver/Setup.tsx @@ -14,7 +14,7 @@ import type { IBTCPaySetupProps } from "@calcom/app-store/btcpayserver/pages/set import { WEBAPP_URL } from "@calcom/lib/constants"; import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { Button } from "@calcom/ui/components/button"; import { Icon } from "@calcom/ui/components/icon"; import { showToast } from "@calcom/ui/components/toast"; diff --git a/apps/web/components/apps/hitpay/Setup.tsx b/apps/web/components/apps/hitpay/Setup.tsx index ae12d39dcc..f2d3b96c2b 100644 --- a/apps/web/components/apps/hitpay/Setup.tsx +++ b/apps/web/components/apps/hitpay/Setup.tsx @@ -13,7 +13,7 @@ import { hitpayCredentialKeysSchema } from "@calcom/app-store/hitpay/lib/hitpayC import type { IHitPaySetupProps } from "@calcom/app-store/hitpay/pages/setup/_getServerSideProps"; import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { Button } from "@calcom/ui/components/button"; import { Switch } from "@calcom/ui/components/form"; import { Icon } from "@calcom/ui/components/icon"; diff --git a/apps/web/components/apps/paypal/Setup.tsx b/apps/web/components/apps/paypal/Setup.tsx index 99398f019a..271494979c 100644 --- a/apps/web/components/apps/paypal/Setup.tsx +++ b/apps/web/components/apps/paypal/Setup.tsx @@ -4,7 +4,7 @@ import { Toaster } from "sonner"; import AppNotInstalledMessage from "@calcom/app-store/_components/AppNotInstalledMessage"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { Button } from "@calcom/ui/components/button"; import { TextField } from "@calcom/ui/components/form"; import { Icon } from "@calcom/ui/components/icon"; @@ -101,7 +101,7 @@ export default function PayPalSetup() { + href="https://developer.paypal.com/api/rest/#link-getclientidandclientsecret" rel="noreferrer"> Link to Paypal developer API REST Setup Guide: https://developer.paypal.com/api/rest/#link-getclientidandclientsecret @@ -120,7 +120,7 @@ export default function PayPalSetup() { + className="text-orange-600 underline" rel="noreferrer"> {t("here")} . diff --git a/apps/web/components/apps/routing-forms/TestForm.tsx b/apps/web/components/apps/routing-forms/TestForm.tsx index e203beff5e..a552196b82 100644 --- a/apps/web/components/apps/routing-forms/TestForm.tsx +++ b/apps/web/components/apps/routing-forms/TestForm.tsx @@ -15,7 +15,7 @@ import { useOrgBranding } from "@calcom/features/ee/organizations/context/provid import { WEBSITE_URL } from "@calcom/lib/constants"; import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import type { inferSSRProps } from "@calcom/types/inferSSRProps"; import type { Brand } from "@calcom/types/utils"; import { Button } from "@calcom/ui/components/button"; diff --git a/apps/web/modules/auth/verify-email-view.tsx b/apps/web/modules/auth/verify-email-view.tsx index 590d113a72..17a439baef 100644 --- a/apps/web/modules/auth/verify-email-view.tsx +++ b/apps/web/modules/auth/verify-email-view.tsx @@ -8,7 +8,7 @@ import { useEffect } from "react"; import { useFlagMap } from "@calcom/features/flags/context/provider"; import { APP_NAME } from "@calcom/lib/constants"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import useEmailVerifyCheck from "@calcom/trpc/react/hooks/useEmailVerifyCheck"; import { Button } from "@calcom/ui/components/button"; import { EmptyScreen } from "@calcom/ui/components/empty-screen"; diff --git a/apps/web/modules/connect-and-join/connect-and-join-view.tsx b/apps/web/modules/connect-and-join/connect-and-join-view.tsx index d1de5dbe14..d37770eb13 100644 --- a/apps/web/modules/connect-and-join/connect-and-join-view.tsx +++ b/apps/web/modules/connect-and-join/connect-and-join-view.tsx @@ -9,7 +9,7 @@ import { getQueryParam } from "@calcom/features/bookings/Booker/utils/query-para import ServerTrans from "@calcom/lib/components/ServerTrans"; import { WEBAPP_URL } from "@calcom/lib/constants"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { Alert } from "@calcom/ui/components/alert"; import { Button } from "@calcom/ui/components/button"; import { EmptyScreen } from "@calcom/ui/components/empty-screen"; diff --git a/apps/web/modules/insights/insights-call-history-view.tsx b/apps/web/modules/insights/insights-call-history-view.tsx index 1e54b3835a..0b16d449ec 100644 --- a/apps/web/modules/insights/insights-call-history-view.tsx +++ b/apps/web/modules/insights/insights-call-history-view.tsx @@ -19,7 +19,7 @@ import { CallDetailsSheet } from "@calcom/features/ee/workflows/components/CallD import type { CallDetailsState, CallDetailsAction } from "@calcom/features/ee/workflows/components/types"; import { WEBAPP_URL } from "@calcom/lib/constants"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import type { RouterOutputs } from "@calcom/trpc/react"; import { Badge } from "@calcom/ui/components/badge"; import { EmptyScreen } from "@calcom/ui/components/empty-screen"; diff --git a/apps/web/modules/insights/insights-virtual-queues-view.tsx b/apps/web/modules/insights/insights-virtual-queues-view.tsx index 8e36612941..c5c4ad71f6 100644 --- a/apps/web/modules/insights/insights-virtual-queues-view.tsx +++ b/apps/web/modules/insights/insights-virtual-queues-view.tsx @@ -4,7 +4,7 @@ import { useState } from "react"; import type { RoutingForm } from "@calcom/app-store/routing-forms/types/types"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { Label } from "@calcom/ui/components/form"; import { Select } from "@calcom/ui/components/form"; diff --git a/apps/web/modules/settings/admin/locked-sms-view.tsx b/apps/web/modules/settings/admin/locked-sms-view.tsx index 5daf5858c2..a6228c0856 100644 --- a/apps/web/modules/settings/admin/locked-sms-view.tsx +++ b/apps/web/modules/settings/admin/locked-sms-view.tsx @@ -2,7 +2,7 @@ import { useState } from "react"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { TextField } from "@calcom/ui/components/form"; import { Button } from "@calcom/ui/components/button"; import { showToast } from "@calcom/ui/components/toast"; diff --git a/apps/web/modules/settings/admin/oauth-view.tsx b/apps/web/modules/settings/admin/oauth-view.tsx index cbc69a7867..a2fb75d344 100644 --- a/apps/web/modules/settings/admin/oauth-view.tsx +++ b/apps/web/modules/settings/admin/oauth-view.tsx @@ -4,7 +4,7 @@ import { useState } from "react"; import { useForm } from "react-hook-form"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { Avatar } from "@calcom/ui/components/avatar"; import { Button } from "@calcom/ui/components/button"; import { Form } from "@calcom/ui/components/form"; diff --git a/apps/web/modules/settings/organizations/new/_components/OnboardMembersView.tsx b/apps/web/modules/settings/organizations/new/_components/OnboardMembersView.tsx index a1141a2256..421bb94dc9 100644 --- a/apps/web/modules/settings/organizations/new/_components/OnboardMembersView.tsx +++ b/apps/web/modules/settings/organizations/new/_components/OnboardMembersView.tsx @@ -8,8 +8,8 @@ import { z } from "zod"; import { setShowNewOrgModalFlag } from "@calcom/features/ee/organizations/hooks/useWelcomeModal"; import { useOnboarding } from "@calcom/features/ee/organizations/lib/onboardingStore"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import type { RouterOutputs } from "@calcom/trpc"; -import { trpc } from "@calcom/trpc"; +import type { RouterOutputs } from "@calcom/trpc/react"; +import { trpc } from "@calcom/trpc/react"; import { Alert } from "@calcom/ui/components/alert"; import { Avatar } from "@calcom/ui/components/avatar"; import { Badge } from "@calcom/ui/components/badge"; diff --git a/apps/web/modules/settings/organizations/new/_components/PaymentStatusView.tsx b/apps/web/modules/settings/organizations/new/_components/PaymentStatusView.tsx index 972e4bb7df..1a5561b921 100644 --- a/apps/web/modules/settings/organizations/new/_components/PaymentStatusView.tsx +++ b/apps/web/modules/settings/organizations/new/_components/PaymentStatusView.tsx @@ -5,7 +5,7 @@ import { useEffect, useState } from "react"; import { useOnboarding } from "@calcom/features/ee/organizations/lib/onboardingStore"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { Button } from "@calcom/ui/components/button"; import { Icon } from "@calcom/ui/components/icon"; diff --git a/apps/web/modules/settings/organizations/privacy/components/blocked-entries-table.tsx b/apps/web/modules/settings/organizations/privacy/components/blocked-entries-table.tsx index e8013c63ad..82d4a9b99a 100644 --- a/apps/web/modules/settings/organizations/privacy/components/blocked-entries-table.tsx +++ b/apps/web/modules/settings/organizations/privacy/components/blocked-entries-table.tsx @@ -7,7 +7,7 @@ import { useMemo, useState } from "react"; import { DataTableWrapper, useDataTable } from "@calcom/features/data-table"; import { IS_CALCOM } from "@calcom/lib/constants"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import type { RouterOutputs } from "@calcom/trpc/react"; import { Button } from "@calcom/ui/components/button"; import { ConfirmationDialogContent, Dialog, DialogClose } from "@calcom/ui/components/dialog"; diff --git a/apps/web/modules/settings/organizations/privacy/components/pending-reports-table.tsx b/apps/web/modules/settings/organizations/privacy/components/pending-reports-table.tsx index 442861c7fe..13ef58452a 100644 --- a/apps/web/modules/settings/organizations/privacy/components/pending-reports-table.tsx +++ b/apps/web/modules/settings/organizations/privacy/components/pending-reports-table.tsx @@ -6,7 +6,7 @@ import { useMemo, useState } from "react"; import { DataTableWrapper, useDataTable } from "@calcom/features/data-table"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import type { RouterOutputs } from "@calcom/trpc/react"; import { EmptyScreen } from "@calcom/ui/components/empty-screen"; diff --git a/docs/developing/guides/insights/add-new-booking-charts.mdx b/docs/developing/guides/insights/add-new-booking-charts.mdx index 556a22b3b8..a45f003725 100644 --- a/docs/developing/guides/insights/add-new-booking-charts.mdx +++ b/docs/developing/guides/insights/add-new-booking-charts.mdx @@ -22,7 +22,7 @@ UI Component → tRPC Handler → Insights Service → Database Query → Respon import { LineChart, XAxis, YAxis, CartesianGrid, Tooltip, Line, ResponsiveContainer } from "recharts"; import { useLocale } from "@calcom/lib/hooks/useLocale"; - import { trpc } from "@calcom/trpc"; + import { trpc } from "@calcom/trpc/react"; import { useInsightsBookingParameters } from "../../hooks/useInsightsBookingParameters"; import { ChartCard } from "../ChartCard"; diff --git a/packages/app-store/_utils/getEventTypeAppData.ts b/packages/app-store/_utils/getEventTypeAppData.ts index abafe50b77..80cfe5ab78 100644 --- a/packages/app-store/_utils/getEventTypeAppData.ts +++ b/packages/app-store/_utils/getEventTypeAppData.ts @@ -1,7 +1,7 @@ import type { z } from "zod"; import type { eventTypeMetaDataSchemaWithTypedApps } from "@calcom/app-store/zod-utils"; -import type { BookerEvent } from "@calcom/features/bookings/types"; +import type { BookerEventForAppData } from "@calcom/features/bookings/types.server"; export type EventTypeApps = NonNullable< NonNullable>["apps"] @@ -9,7 +9,7 @@ export type EventTypeApps = NonNullable< export type EventTypeAppsList = keyof EventTypeApps; export const getEventTypeAppData = ( - eventType: Pick, + eventType: BookerEventForAppData, appId: T, forcedGet?: boolean ): EventTypeApps[T] => { diff --git a/packages/app-store/_utils/payments/getPaymentAppData.ts b/packages/app-store/_utils/payments/getPaymentAppData.ts index 5b515d238b..f901150188 100644 --- a/packages/app-store/_utils/payments/getPaymentAppData.ts +++ b/packages/app-store/_utils/payments/getPaymentAppData.ts @@ -1,6 +1,5 @@ import type { z } from "zod"; -import type { BookerEvent } from "@calcom/features/bookings/types"; import type { EventTypeMetaDataSchema } from "@calcom/prisma/zod-utils"; import type { appDataSchemas } from "../../apps.schemas.generated"; @@ -10,7 +9,9 @@ import { eventTypeMetaDataSchemaWithTypedApps } from "../../zod-utils"; import { getEventTypeAppData } from "../getEventTypeAppData"; export function getPaymentAppData( - _eventType: Pick & { + _eventType: { + price: number; + currency: string; metadata: z.infer; }, forcedGet?: boolean diff --git a/packages/features/Segment.test.tsx b/packages/features/Segment.test.tsx index cbf93aa49f..85fae73b6d 100644 --- a/packages/features/Segment.test.tsx +++ b/packages/features/Segment.test.tsx @@ -6,7 +6,7 @@ import type { Mock } from "vitest"; import { Segment } from "@calcom/features/Segment"; import type { AttributesQueryValue } from "@calcom/lib/raqb/types"; import { AttributeType } from "@calcom/prisma/enums"; -import { trpc, type RouterOutputs } from "@calcom/trpc"; +import { trpc, type RouterOutputs } from "@calcom/trpc/react"; type Attributes = RouterOutputs["viewer"]["appRoutingForms"]["getAttributesForTeam"]; type MatchingTeamMembersData = RouterOutputs["viewer"]["attributes"]["findTeamMembersMatchingAttributeLogic"]; @@ -62,7 +62,7 @@ const mockAttributesWithSingleSelect = () => { }; // Mock the TRPC hooks -vi.mock("@calcom/trpc", () => ({ +vi.mock("@calcom/trpc/react", () => ({ trpc: { viewer: { appRoutingForms: { diff --git a/packages/features/Segment.tsx b/packages/features/Segment.tsx index 910a5ca3a6..a68be96e6e 100644 --- a/packages/features/Segment.tsx +++ b/packages/features/Segment.tsx @@ -14,7 +14,7 @@ import { getQueryBuilderConfigForAttributes } from "@calcom/app-store/routing-fo import { useLocale } from "@calcom/lib/hooks/useLocale"; import { isEqual } from "@calcom/lib/isEqual"; import type { AttributesQueryValue } from "@calcom/lib/raqb/types"; -import { trpc, type RouterOutputs } from "@calcom/trpc"; +import { trpc, type RouterOutputs } from "@calcom/trpc/react"; import cn from "@calcom/ui/classNames"; export type Attributes = RouterOutputs["viewer"]["appRoutingForms"]["getAttributesForTeam"]; diff --git a/packages/features/apps/components/AppList.tsx b/packages/features/apps/components/AppList.tsx index 10831c1d0d..6e5e8cd918 100644 --- a/packages/features/apps/components/AppList.tsx +++ b/packages/features/apps/components/AppList.tsx @@ -15,7 +15,7 @@ import { BulkEditDefaultForEventsModal } from "@calcom/features/eventtypes/compo import { isDelegationCredential } from "@calcom/lib/delegationCredential"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import type { AppCategories } from "@calcom/prisma/enums"; -import { type RouterOutputs } from "@calcom/trpc"; +import { type RouterOutputs } from "@calcom/trpc/react"; import type { App } from "@calcom/types/App"; import { Alert } from "@calcom/ui/components/alert"; import { Button } from "@calcom/ui/components/button"; diff --git a/packages/features/bookings/Booker/components/hooks/useBookings.ts b/packages/features/bookings/Booker/components/hooks/useBookings.ts index 3ee4755ba8..7ef1a668a6 100644 --- a/packages/features/bookings/Booker/components/hooks/useBookings.ts +++ b/packages/features/bookings/Booker/components/hooks/useBookings.ts @@ -23,7 +23,7 @@ import { useLocale } from "@calcom/lib/hooks/useLocale"; import { localStorage } from "@calcom/lib/webstorage"; import { BookingStatus } from "@calcom/prisma/enums"; import { bookingMetadataSchema } from "@calcom/prisma/zod-utils"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { showToast } from "@calcom/ui/components/toast"; import { useBookingSuccessRedirect } from "../../../lib/bookingSuccessRedirect"; diff --git a/packages/features/bookings/Booker/components/hooks/useSlots.ts b/packages/features/bookings/Booker/components/hooks/useSlots.ts index faebef5098..a246d8c856 100644 --- a/packages/features/bookings/Booker/components/hooks/useSlots.ts +++ b/packages/features/bookings/Booker/components/hooks/useSlots.ts @@ -11,7 +11,7 @@ import { PUBLIC_QUERY_RESERVATION_STALE_TIME_SECONDS, } from "@calcom/lib/constants"; import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import type { TIsAvailableOutputSchema } from "@calcom/trpc/server/routers/viewer/slots/isAvailable.schema"; import { useIsQuickAvailabilityCheckFeatureEnabled } from "./useIsQuickAvailabilityCheckFeatureEnabled"; @@ -51,7 +51,7 @@ const useQuickAvailabilityChecks = ({ { slots: slotsToCheck, // enabled flag can't be true if eventTypeId is nullish - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + eventTypeId: eventTypeId!, }, { diff --git a/packages/features/bookings/Booker/components/hooks/useVerifyEmail.ts b/packages/features/bookings/Booker/components/hooks/useVerifyEmail.ts index 3564929d79..eada0222d3 100644 --- a/packages/features/bookings/Booker/components/hooks/useVerifyEmail.ts +++ b/packages/features/bookings/Booker/components/hooks/useVerifyEmail.ts @@ -4,7 +4,7 @@ import { useState } from "react"; import { useBookerStore } from "@calcom/features/bookings/Booker/store"; import { useDebounce } from "@calcom/lib/hooks/useDebounce"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { showToast } from "@calcom/ui/components/toast"; export interface IUseVerifyEmailProps { diff --git a/packages/features/bookings/types.server.ts b/packages/features/bookings/types.server.ts new file mode 100644 index 0000000000..9fae23b34c --- /dev/null +++ b/packages/features/bookings/types.server.ts @@ -0,0 +1,14 @@ +import type { z } from "zod"; + +import type { eventTypeMetaDataSchemaWithTypedApps } from "@calcom/app-store/zod-utils"; + +/** + * Server-safe subset of BookerEvent type. + * This type is used by server code that needs to access event type metadata + * without pulling in React/TRPC client dependencies. + */ +export type BookerEventForAppData = { + price: number; + currency: string; + metadata: z.infer | null; +}; diff --git a/packages/features/bookings/types.ts b/packages/features/bookings/types.ts index f546760d72..1f3454e5c4 100644 --- a/packages/features/bookings/types.ts +++ b/packages/features/bookings/types.ts @@ -1,11 +1,11 @@ import type { ErrorOption, FieldPath } from "react-hook-form"; import type { RegularBookingCreateResult } from "@calcom/features/bookings/lib/dto/types"; +import type { Slots } from "@calcom/features/calendars/lib/types"; import type { SchedulingType } from "@calcom/prisma/enums"; import type { RouterOutputs } from "@calcom/trpc/react"; import type { AppsStatus } from "@calcom/types/Calendar"; -import type { DatePickerProps } from "../calendars/DatePicker"; import type { BookingCreateBody } from "./lib/bookingCreateBodySchema"; export type PublicEvent = NonNullable; @@ -29,8 +29,8 @@ type BookerEventUser = Pick< type BookerEventProfile = Pick; -// marked as required to keep responsibility on consumers to handle the case where slots is undefined -export type Slots = Required>; +// Re-export Slots from the server-safe location +export type { Slots }; export type BookerEvent = Pick< PublicEvent, diff --git a/packages/features/calendars/DatePicker.tsx b/packages/features/calendars/DatePicker.tsx index 63bc4888f6..fc0de3b067 100644 --- a/packages/features/calendars/DatePicker.tsx +++ b/packages/features/calendars/DatePicker.tsx @@ -4,9 +4,9 @@ import { shallow } from "zustand/shallow"; import type { Dayjs } from "@calcom/dayjs"; import dayjs from "@calcom/dayjs"; import { useEmbedStyles } from "@calcom/embed-core/embed-iframe"; -import type { IFromUser, IToUser } from "@calcom/features/availability/lib/getUserAvailability"; import { useBookerStoreContext } from "@calcom/features/bookings/Booker/BookerStoreProvider"; import { getAvailableDatesInMonth } from "@calcom/features/calendars/lib/getAvailableDatesInMonth"; +import type { Slots } from "@calcom/features/calendars/lib/types"; import { daysInMonth, yyyymmdd } from "@calcom/lib/dayjs"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { weekdayNames } from "@calcom/lib/weekday"; @@ -44,19 +44,7 @@ export type DatePickerProps = { /** used to query the multiple selected dates */ eventSlug?: string; /** To identify days that are not available and should display OOO and redirect if toUser exists */ - slots?: Record< - string, - { - time: string; - userIds?: number[]; - away?: boolean; - fromUser?: IFromUser; - toUser?: IToUser; - reason?: string; - emoji?: string; - showNotePublicly?: boolean; - }[] - >; + slots?: Slots; periodData?: PeriodData; // Whether this is a compact sidebar view or main monthly view isCompact?: boolean; diff --git a/packages/features/calendars/lib/types.ts b/packages/features/calendars/lib/types.ts new file mode 100644 index 0000000000..8bf2df2a89 --- /dev/null +++ b/packages/features/calendars/lib/types.ts @@ -0,0 +1,14 @@ +import type { IFromUser, IToUser } from "@calcom/features/availability/lib/getUserAvailability"; + +export type SlotInfo = { + time: string; + userIds?: number[]; + away?: boolean; + fromUser?: IFromUser; + toUser?: IToUser; + reason?: string; + emoji?: string; + showNotePublicly?: boolean; +}; + +export type Slots = Record; diff --git a/packages/features/data-table/components/segment/DeleteSegmentDialog.tsx b/packages/features/data-table/components/segment/DeleteSegmentDialog.tsx index 4defe5d383..0a8226da4f 100644 --- a/packages/features/data-table/components/segment/DeleteSegmentDialog.tsx +++ b/packages/features/data-table/components/segment/DeleteSegmentDialog.tsx @@ -1,5 +1,5 @@ import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { Dialog, ConfirmationDialogContent } from "@calcom/ui/components/dialog"; import { showToast } from "@calcom/ui/components/toast"; diff --git a/packages/features/data-table/components/segment/DuplicateSegmentDialog.tsx b/packages/features/data-table/components/segment/DuplicateSegmentDialog.tsx index 548dd96c7f..448181502f 100644 --- a/packages/features/data-table/components/segment/DuplicateSegmentDialog.tsx +++ b/packages/features/data-table/components/segment/DuplicateSegmentDialog.tsx @@ -3,7 +3,7 @@ import { useForm } from "react-hook-form"; import { checkAdminOrOwner } from "@calcom/features/auth/lib/checkAdminOrOwner"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { Button } from "@calcom/ui/components/button"; import { Dialog, DialogContent, DialogFooter, DialogHeader } from "@calcom/ui/components/dialog"; import { Form, TextField } from "@calcom/ui/components/form"; diff --git a/packages/features/data-table/components/segment/RenameSegmentDialog.tsx b/packages/features/data-table/components/segment/RenameSegmentDialog.tsx index 0b2707068d..39503b9321 100644 --- a/packages/features/data-table/components/segment/RenameSegmentDialog.tsx +++ b/packages/features/data-table/components/segment/RenameSegmentDialog.tsx @@ -1,7 +1,7 @@ import { useForm } from "react-hook-form"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { Button } from "@calcom/ui/components/button"; import { Dialog, DialogContent, DialogFooter, DialogHeader } from "@calcom/ui/components/dialog"; import { Form, TextField } from "@calcom/ui/components/form"; diff --git a/packages/features/ee/deployment/licensekey/CreateLicenseKeyForm.tsx b/packages/features/ee/deployment/licensekey/CreateLicenseKeyForm.tsx index c712c28d6c..62a1f2c1e8 100644 --- a/packages/features/ee/deployment/licensekey/CreateLicenseKeyForm.tsx +++ b/packages/features/ee/deployment/licensekey/CreateLicenseKeyForm.tsx @@ -6,7 +6,7 @@ import { useState } from "react"; import { Controller, useForm } from "react-hook-form"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import type { Ensure } from "@calcom/types/utils"; import { Alert } from "@calcom/ui/components/alert"; import { Button } from "@calcom/ui/components/button"; diff --git a/packages/features/ee/organizations/components/TeamInviteFromOrg.tsx b/packages/features/ee/organizations/components/TeamInviteFromOrg.tsx index da3a19a67d..b109f37069 100644 --- a/packages/features/ee/organizations/components/TeamInviteFromOrg.tsx +++ b/packages/features/ee/organizations/components/TeamInviteFromOrg.tsx @@ -1,7 +1,7 @@ import type { PropsWithChildren } from "react"; import { useState } from "react"; -import type { RouterOutputs } from "@calcom/trpc"; +import type { RouterOutputs } from "@calcom/trpc/react"; import { TextField } from "@calcom/ui/components/form"; import { Avatar } from "@calcom/ui/components/avatar"; import classNames from "@calcom/ui/classNames"; diff --git a/packages/features/ee/organizations/pages/components/DisableAutofillOnBookingPageSwitch.tsx b/packages/features/ee/organizations/pages/components/DisableAutofillOnBookingPageSwitch.tsx index c8352de948..7f2d3fa61e 100644 --- a/packages/features/ee/organizations/pages/components/DisableAutofillOnBookingPageSwitch.tsx +++ b/packages/features/ee/organizations/pages/components/DisableAutofillOnBookingPageSwitch.tsx @@ -3,8 +3,8 @@ import { useState } from "react"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import type { RouterOutputs } from "@calcom/trpc"; -import { trpc } from "@calcom/trpc"; +import type { RouterOutputs } from "@calcom/trpc/react"; +import { trpc } from "@calcom/trpc/react"; import { SettingsToggle } from "@calcom/ui/components/form"; import { showToast } from "@calcom/ui/components/toast"; diff --git a/packages/features/ee/organizations/pages/components/DisableGuestBookingEmailsSetting.tsx b/packages/features/ee/organizations/pages/components/DisableGuestBookingEmailsSetting.tsx index b44670daca..64ba7c5776 100644 --- a/packages/features/ee/organizations/pages/components/DisableGuestBookingEmailsSetting.tsx +++ b/packages/features/ee/organizations/pages/components/DisableGuestBookingEmailsSetting.tsx @@ -5,7 +5,7 @@ import { useState } from "react"; import { EmailType } from "@calcom/emails/email-types"; import { Dialog } from "@calcom/features/components/controlled-dialog"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { Alert } from "@calcom/ui/components/alert"; import { ConfirmationDialogContent } from "@calcom/ui/components/dialog"; import { Checkbox, SettingsToggle } from "@calcom/ui/components/form"; diff --git a/packages/features/ee/organizations/pages/components/DisablePhoneOnlySMSNotificationsSwitch.tsx b/packages/features/ee/organizations/pages/components/DisablePhoneOnlySMSNotificationsSwitch.tsx index b1852f8685..b7d7957cf8 100644 --- a/packages/features/ee/organizations/pages/components/DisablePhoneOnlySMSNotificationsSwitch.tsx +++ b/packages/features/ee/organizations/pages/components/DisablePhoneOnlySMSNotificationsSwitch.tsx @@ -3,8 +3,8 @@ import { useState } from "react"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import type { RouterOutputs } from "@calcom/trpc"; -import { trpc } from "@calcom/trpc"; +import type { RouterOutputs } from "@calcom/trpc/react"; +import { trpc } from "@calcom/trpc/react"; import { SettingsToggle } from "@calcom/ui/components/form"; import { showToast } from "@calcom/ui/components/toast"; diff --git a/packages/features/ee/organizations/pages/components/LockEventTypeSwitch.tsx b/packages/features/ee/organizations/pages/components/LockEventTypeSwitch.tsx index 1446765da1..b61a2f4715 100644 --- a/packages/features/ee/organizations/pages/components/LockEventTypeSwitch.tsx +++ b/packages/features/ee/organizations/pages/components/LockEventTypeSwitch.tsx @@ -3,8 +3,8 @@ import { useForm } from "react-hook-form"; import { Dialog } from "@calcom/features/components/controlled-dialog"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import type { RouterOutputs } from "@calcom/trpc"; -import { trpc } from "@calcom/trpc"; +import type { RouterOutputs } from "@calcom/trpc/react"; +import { trpc } from "@calcom/trpc/react"; import classNames from "@calcom/ui/classNames"; import { Button } from "@calcom/ui/components/button"; import { DialogContent, DialogFooter, DialogHeader, DialogClose } from "@calcom/ui/components/dialog"; diff --git a/packages/features/ee/organizations/pages/components/NoSlotsNotificationSwitch.tsx b/packages/features/ee/organizations/pages/components/NoSlotsNotificationSwitch.tsx index 4d714409df..f61a66a750 100644 --- a/packages/features/ee/organizations/pages/components/NoSlotsNotificationSwitch.tsx +++ b/packages/features/ee/organizations/pages/components/NoSlotsNotificationSwitch.tsx @@ -1,8 +1,8 @@ import { useState } from "react"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import type { RouterOutputs } from "@calcom/trpc"; -import { trpc } from "@calcom/trpc"; +import type { RouterOutputs } from "@calcom/trpc/react"; +import { trpc } from "@calcom/trpc/react"; import { SettingsToggle } from "@calcom/ui/components/form"; import { showToast } from "@calcom/ui/components/toast"; diff --git a/packages/features/ee/organizations/pages/components/OrgAutoJoinSetting.tsx b/packages/features/ee/organizations/pages/components/OrgAutoJoinSetting.tsx index c6b677293c..5ccfd8317e 100644 --- a/packages/features/ee/organizations/pages/components/OrgAutoJoinSetting.tsx +++ b/packages/features/ee/organizations/pages/components/OrgAutoJoinSetting.tsx @@ -3,7 +3,7 @@ import { useState } from "react"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { SettingsToggle } from "@calcom/ui/components/form"; import { showToast } from "@calcom/ui/components/toast"; diff --git a/packages/features/ee/organizations/pages/settings/admin/WorkspacePlatformPage.tsx b/packages/features/ee/organizations/pages/settings/admin/WorkspacePlatformPage.tsx index 8e7aa1cc16..63ec6724ca 100644 --- a/packages/features/ee/organizations/pages/settings/admin/WorkspacePlatformPage.tsx +++ b/packages/features/ee/organizations/pages/settings/admin/WorkspacePlatformPage.tsx @@ -9,7 +9,7 @@ import { z } from "zod"; import { Dialog } from "@calcom/features/components/controlled-dialog"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { serviceAccountKeySchema } from "@calcom/prisma/zod-utils"; -import { trpc, type RouterOutputs } from "@calcom/trpc"; +import { trpc, type RouterOutputs } from "@calcom/trpc/react"; import { Button } from "@calcom/ui/components/button"; import { DialogContent, DialogFooter, DialogClose } from "@calcom/ui/components/dialog"; import { Form } from "@calcom/ui/components/form"; diff --git a/packages/features/ee/teams/components/EventTypesList.tsx b/packages/features/ee/teams/components/EventTypesList.tsx index 0218094d16..48bafb0b78 100644 --- a/packages/features/ee/teams/components/EventTypesList.tsx +++ b/packages/features/ee/teams/components/EventTypesList.tsx @@ -5,7 +5,7 @@ import { useState, Fragment } from "react"; import { DataTableSelectionBar } from "@calcom/features/data-table"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { SchedulingType } from "@calcom/prisma/enums"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import classNames from "@calcom/ui/classNames"; import { Button } from "@calcom/ui/components/button"; import { diff --git a/packages/features/ee/teams/components/GoogleWorkspaceInviteButton.tsx b/packages/features/ee/teams/components/GoogleWorkspaceInviteButton.tsx index 3d9131886f..876607f5ef 100644 --- a/packages/features/ee/teams/components/GoogleWorkspaceInviteButton.tsx +++ b/packages/features/ee/teams/components/GoogleWorkspaceInviteButton.tsx @@ -4,7 +4,7 @@ import { useState } from "react"; import { useFlagMap } from "@calcom/features/flags/context/provider"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { useParamsWithFallback } from "@calcom/lib/hooks/useParamsWithFallback"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { showToast } from "@calcom/ui/components/toast"; import { Tooltip } from "@calcom/ui/components/tooltip"; import { Button } from "@calcom/ui/components/button"; diff --git a/packages/features/ee/teams/components/InviteLinkSettingsModal.tsx b/packages/features/ee/teams/components/InviteLinkSettingsModal.tsx index 4efab6743d..ef323854fe 100644 --- a/packages/features/ee/teams/components/InviteLinkSettingsModal.tsx +++ b/packages/features/ee/teams/components/InviteLinkSettingsModal.tsx @@ -3,7 +3,7 @@ import { Controller, useForm } from "react-hook-form"; import { Dialog } from "@calcom/features/components/controlled-dialog"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { Button } from "@calcom/ui/components/button"; import { DialogContent, DialogFooter } from "@calcom/ui/components/dialog"; import { Form } from "@calcom/ui/components/form"; diff --git a/packages/features/ee/teams/components/MemberInvitationModal.tsx b/packages/features/ee/teams/components/MemberInvitationModal.tsx index c07a2afa8e..ab162630e7 100644 --- a/packages/features/ee/teams/components/MemberInvitationModal.tsx +++ b/packages/features/ee/teams/components/MemberInvitationModal.tsx @@ -13,8 +13,8 @@ import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { MembershipRole } from "@calcom/prisma/enums"; import { CreationSource } from "@calcom/prisma/enums"; -import type { RouterOutputs } from "@calcom/trpc"; -import { trpc } from "@calcom/trpc"; +import type { RouterOutputs } from "@calcom/trpc/react"; +import { trpc } from "@calcom/trpc/react"; import { isEmail } from "@calcom/trpc/server/routers/viewer/teams/util"; import classNames from "@calcom/ui/classNames"; import { Button } from "@calcom/ui/components/button"; diff --git a/packages/features/ee/teams/components/MemberList.tsx b/packages/features/ee/teams/components/MemberList.tsx index ff1ee1627c..2efe7dc5df 100644 --- a/packages/features/ee/teams/components/MemberList.tsx +++ b/packages/features/ee/teams/components/MemberList.tsx @@ -35,7 +35,7 @@ import type { MemberPermissions } from "@calcom/features/users/components/UserTa import { WEBAPP_URL } from "@calcom/lib/constants"; import { getUserAvatarUrl } from "@calcom/lib/getAvatarUrl"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import type { RouterOutputs } from "@calcom/trpc/react"; import { Avatar } from "@calcom/ui/components/avatar"; import { Badge } from "@calcom/ui/components/badge"; diff --git a/packages/features/ee/workflows/pages/call-history.tsx b/packages/features/ee/workflows/pages/call-history.tsx index cf225096ad..e5218ecfd6 100644 --- a/packages/features/ee/workflows/pages/call-history.tsx +++ b/packages/features/ee/workflows/pages/call-history.tsx @@ -18,7 +18,7 @@ import { useSegments } from "@calcom/features/data-table/hooks/useSegments"; import { useOrgBranding } from "@calcom/features/ee/organizations/context/provider"; import { WEBAPP_URL } from "@calcom/lib/constants"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import type { RouterOutputs } from "@calcom/trpc/react"; import { Badge } from "@calcom/ui/components/badge"; diff --git a/packages/features/ee/workflows/repositories/WorkflowRepository.ts b/packages/features/ee/workflows/repositories/WorkflowRepository.ts index c2c94d6b6a..4eeea447bb 100644 --- a/packages/features/ee/workflows/repositories/WorkflowRepository.ts +++ b/packages/features/ee/workflows/repositories/WorkflowRepository.ts @@ -1,6 +1,6 @@ import { z } from "zod"; -import type { WorkflowType } from "@calcom/ee/workflows/components/WorkflowListPage"; +import type { WorkflowListType as WorkflowType } from "@calcom/ee/workflows/lib/types"; import { FORM_TRIGGER_WORKFLOW_EVENTS } from "@calcom/ee/workflows/lib/constants"; import { deleteScheduledAIPhoneCall } from "@calcom/ee/workflows/lib/reminders/aiPhoneCallManager"; import { deleteScheduledEmailReminder } from "@calcom/ee/workflows/lib/reminders/emailReminderManager"; diff --git a/packages/features/eventtypes/components/ChildrenEventTypeSelect.tsx b/packages/features/eventtypes/components/ChildrenEventTypeSelect.tsx index c8e16fd8a4..0d28ee7437 100644 --- a/packages/features/eventtypes/components/ChildrenEventTypeSelect.tsx +++ b/packages/features/eventtypes/components/ChildrenEventTypeSelect.tsx @@ -2,10 +2,10 @@ import { useAutoAnimate } from "@formkit/auto-animate/react"; import type { Props } from "react-select"; import { getBookerBaseUrlSync } from "@calcom/features/ee/organizations/lib/getBookerBaseUrlSync"; +import type { ChildrenEventType } from "@calcom/features/eventtypes/lib/childrenEventType"; import type { SelectClassNames } from "@calcom/features/eventtypes/lib/types"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { MembershipRole } from "@calcom/prisma/enums"; -import type { UserProfile } from "@calcom/types/UserProfile"; import classNames from "@calcom/ui/classNames"; import { Avatar } from "@calcom/ui/components/avatar"; import { Badge } from "@calcom/ui/components/badge"; @@ -15,23 +15,7 @@ import { Select } from "@calcom/ui/components/form"; import { Switch } from "@calcom/ui/components/form"; import { Tooltip } from "@calcom/ui/components/tooltip"; -export type ChildrenEventType = { - value: string; - label: string; - created: boolean; - owner: { - avatar: string; - id: number; - email: string; - name: string; - username: string; - membership: MembershipRole; - eventTypeSlugs: string[]; - profile: UserProfile; - }; - slug: string; - hidden: boolean; -}; +export type { ChildrenEventType } from "@calcom/features/eventtypes/lib/childrenEventType"; export type ChildrenEventTypeSelectCustomClassNames = { assignToSelect?: SelectClassNames; diff --git a/packages/features/eventtypes/lib/childrenEventType.ts b/packages/features/eventtypes/lib/childrenEventType.ts new file mode 100644 index 0000000000..ed127cbdda --- /dev/null +++ b/packages/features/eventtypes/lib/childrenEventType.ts @@ -0,0 +1,20 @@ +import type { MembershipRole } from "@calcom/prisma/enums"; +import type { UserProfile } from "@calcom/types/UserProfile"; + +export type ChildrenEventType = { + value: string; + label: string; + created: boolean; + owner: { + avatar: string; + id: number; + email: string; + name: string; + username: string; + membership: MembershipRole; + eventTypeSlugs: string[]; + profile: UserProfile; + }; + slug: string; + hidden: boolean; +}; diff --git a/packages/features/eventtypes/lib/schemas.ts b/packages/features/eventtypes/lib/schemas.ts new file mode 100644 index 0000000000..82350a7036 --- /dev/null +++ b/packages/features/eventtypes/lib/schemas.ts @@ -0,0 +1,54 @@ +import { z } from "zod"; + +import { SchedulingType } from "@calcom/prisma/enums"; +import { eventTypeLocations, EventTypeMetaDataSchema, eventTypeSlug } from "@calcom/prisma/zod-utils"; + +const calVideoSettingsSchema = z + .object({ + disableRecordingForGuests: z.boolean().nullish(), + disableRecordingForOrganizer: z.boolean().nullish(), + enableAutomaticTranscription: z.boolean().nullish(), + enableAutomaticRecordingForOrganizer: z.boolean().nullish(), + disableTranscriptionForGuests: z.boolean().nullish(), + disableTranscriptionForOrganizer: z.boolean().nullish(), + redirectUrlOnExit: z.string().url().nullish(), + requireEmailForGuests: z.boolean().nullish(), + }) + .optional() + .nullable(); + +export const EventTypeDuplicateInput = z + .object({ + id: z.number(), + slug: z.string(), + title: z.string().min(1), + description: z.string(), + length: z.number(), + teamId: z.number().nullish(), + }) + .strict(); + +export const createEventTypeInput = z + .object({ + title: z.string().trim().min(1), + slug: eventTypeSlug, + description: z.string().nullish(), + length: z.number().int(), + hidden: z.boolean(), + teamId: z.number().int().nullish(), + schedulingType: z.nativeEnum(SchedulingType).nullish(), + locations: eventTypeLocations, + metadata: EventTypeMetaDataSchema.optional(), + disableGuests: z.boolean().optional(), + slotInterval: z.number().min(0).nullish(), + minimumBookingNotice: z.number().int().min(0).optional(), + beforeEventBuffer: z.number().int().min(0).optional(), + afterEventBuffer: z.number().int().min(0).optional(), + scheduleId: z.number().int().optional(), + calVideoSettings: calVideoSettingsSchema, + }) + .partial({ hidden: true, locations: true }) + .refine((data) => (data.teamId ? data.teamId && data.schedulingType : true), { + path: ["schedulingType"], + message: "You must select a scheduling type for team events", + }); diff --git a/packages/features/eventtypes/lib/types.ts b/packages/features/eventtypes/lib/types.ts index e61b881b98..2c0b0e7943 100644 --- a/packages/features/eventtypes/lib/types.ts +++ b/packages/features/eventtypes/lib/types.ts @@ -2,17 +2,12 @@ import { z } from "zod"; import type { EventLocationType } from "@calcom/app-store/locations"; import type { eventTypeMetaDataSchemaWithTypedApps } from "@calcom/app-store/zod-utils"; -import type { ChildrenEventType } from "@calcom/features/eventtypes/components/ChildrenEventTypeSelect"; +import type { ChildrenEventType } from "@calcom/features/eventtypes/lib/childrenEventType"; import type { IntervalLimit } from "@calcom/lib/intervalLimits/intervalLimitSchema"; import type { AttributesQueryValue } from "@calcom/lib/raqb/types"; import type { EventTypeTranslation } from "@calcom/prisma/client"; import { type PeriodType, SchedulingType } from "@calcom/prisma/enums"; -import { - eventTypeLocations, - EventTypeMetaDataSchema, - eventTypeSlug, - type BookerLayoutSettings, -} from "@calcom/prisma/zod-utils"; +import type { BookerLayoutSettings } from "@calcom/prisma/zod-utils"; import type { customInputSchema } from "@calcom/prisma/zod-utils"; import type { eventTypeBookingFields } from "@calcom/prisma/zod-utils"; import type { eventTypeColor } from "@calcom/prisma/zod-utils"; @@ -236,55 +231,8 @@ export type SelectClassNames = { container?: string; }; -export const EventTypeDuplicateInput = z - .object({ - id: z.number(), - slug: z.string(), - title: z.string().min(1), - description: z.string(), - length: z.number(), - teamId: z.number().nullish(), - }) - .strict(); - -const calVideoSettingsSchema = z - .object({ - disableRecordingForGuests: z.boolean().nullish(), - disableRecordingForOrganizer: z.boolean().nullish(), - enableAutomaticTranscription: z.boolean().nullish(), - enableAutomaticRecordingForOrganizer: z.boolean().nullish(), - disableTranscriptionForGuests: z.boolean().nullish(), - disableTranscriptionForOrganizer: z.boolean().nullish(), - redirectUrlOnExit: z.string().url().nullish(), - requireEmailForGuests: z.boolean().nullish(), - }) - .optional() - .nullable(); - -export const createEventTypeInput = z - .object({ - title: z.string().trim().min(1), - slug: eventTypeSlug, - description: z.string().nullish(), - length: z.number().int(), - hidden: z.boolean(), - teamId: z.number().int().nullish(), - schedulingType: z.nativeEnum(SchedulingType).nullish(), - locations: eventTypeLocations, - metadata: EventTypeMetaDataSchema.optional(), - disableGuests: z.boolean().optional(), - slotInterval: z.number().min(0).nullish(), - minimumBookingNotice: z.number().int().min(0).optional(), - beforeEventBuffer: z.number().int().min(0).optional(), - afterEventBuffer: z.number().int().min(0).optional(), - scheduleId: z.number().int().optional(), - calVideoSettings: calVideoSettingsSchema, - }) - .partial({ hidden: true, locations: true }) - .refine((data) => (data.teamId ? data.teamId && data.schedulingType : true), { - path: ["schedulingType"], - message: "You must select a scheduling type for team events", - }); +// Re-export schemas from server-safe location +export { EventTypeDuplicateInput, createEventTypeInput } from "./schemas"; export type FormValidationResult = { isValid: boolean; diff --git a/packages/features/insights/HOW_TO_ADD_BOOKING_CHARTS.md b/packages/features/insights/HOW_TO_ADD_BOOKING_CHARTS.md index 13e32276a9..3f6930277c 100644 --- a/packages/features/insights/HOW_TO_ADD_BOOKING_CHARTS.md +++ b/packages/features/insights/HOW_TO_ADD_BOOKING_CHARTS.md @@ -19,7 +19,7 @@ Create your chart component in `packages/features/insights/components/booking/`: import { LineChart, XAxis, YAxis, CartesianGrid, Tooltip, Line, ResponsiveContainer } from "recharts"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { useInsightsBookingParameters } from "../../hooks/useInsightsBookingParameters"; import { ChartCard } from "../ChartCard"; diff --git a/packages/features/insights/components/booking/AverageEventDurationChart.tsx b/packages/features/insights/components/booking/AverageEventDurationChart.tsx index 8ccabe406b..eaa7adce64 100644 --- a/packages/features/insights/components/booking/AverageEventDurationChart.tsx +++ b/packages/features/insights/components/booking/AverageEventDurationChart.tsx @@ -3,7 +3,7 @@ import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer } from "recharts"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import type { RouterOutputs } from "@calcom/trpc/react"; import { useInsightsBookingParameters } from "../../hooks/useInsightsBookingParameters"; diff --git a/packages/features/insights/components/booking/BookingKPICards.tsx b/packages/features/insights/components/booking/BookingKPICards.tsx index df9430c75c..2fcb995d44 100644 --- a/packages/features/insights/components/booking/BookingKPICards.tsx +++ b/packages/features/insights/components/booking/BookingKPICards.tsx @@ -1,7 +1,7 @@ "use client"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import classNames from "@calcom/ui/classNames"; import { SkeletonText } from "@calcom/ui/components/skeleton"; diff --git a/packages/features/insights/components/booking/BookingsByHourChart.tsx b/packages/features/insights/components/booking/BookingsByHourChart.tsx index c66609f745..aa8e1c379e 100644 --- a/packages/features/insights/components/booking/BookingsByHourChart.tsx +++ b/packages/features/insights/components/booking/BookingsByHourChart.tsx @@ -12,7 +12,7 @@ import { } from "recharts"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import type { RouterOutputs } from "@calcom/trpc/react"; import { useInsightsBookingParameters } from "../../hooks/useInsightsBookingParameters"; diff --git a/packages/features/insights/components/booking/CSATOverTimeChart.tsx b/packages/features/insights/components/booking/CSATOverTimeChart.tsx index f8482e3142..77d7aa0830 100644 --- a/packages/features/insights/components/booking/CSATOverTimeChart.tsx +++ b/packages/features/insights/components/booking/CSATOverTimeChart.tsx @@ -3,7 +3,7 @@ import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer } from "recharts"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import type { RouterOutputs } from "@calcom/trpc/react"; import { useInsightsBookingParameters } from "../../hooks/useInsightsBookingParameters"; diff --git a/packages/features/insights/components/booking/EventTrendsChart.tsx b/packages/features/insights/components/booking/EventTrendsChart.tsx index 0767e4c59e..a093baaa37 100644 --- a/packages/features/insights/components/booking/EventTrendsChart.tsx +++ b/packages/features/insights/components/booking/EventTrendsChart.tsx @@ -3,7 +3,7 @@ import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer } from "recharts"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import type { RouterOutputs } from "@calcom/trpc/react"; import { useInsightsBookingParameters } from "../../hooks/useInsightsBookingParameters"; diff --git a/packages/features/insights/components/booking/HighestNoShowHostTable.tsx b/packages/features/insights/components/booking/HighestNoShowHostTable.tsx index afbef1811a..e780ea76d8 100644 --- a/packages/features/insights/components/booking/HighestNoShowHostTable.tsx +++ b/packages/features/insights/components/booking/HighestNoShowHostTable.tsx @@ -1,7 +1,7 @@ "use client"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { useInsightsBookingParameters } from "../../hooks/useInsightsBookingParameters"; import { ChartCard } from "../ChartCard"; diff --git a/packages/features/insights/components/booking/HighestRatedMembersTable.tsx b/packages/features/insights/components/booking/HighestRatedMembersTable.tsx index cbf79954b4..e849456036 100644 --- a/packages/features/insights/components/booking/HighestRatedMembersTable.tsx +++ b/packages/features/insights/components/booking/HighestRatedMembersTable.tsx @@ -1,7 +1,7 @@ "use client"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { useInsightsBookingParameters } from "../../hooks/useInsightsBookingParameters"; import { ChartCard } from "../ChartCard"; diff --git a/packages/features/insights/components/booking/LeastBookedTeamMembersTable.tsx b/packages/features/insights/components/booking/LeastBookedTeamMembersTable.tsx index 24a80954b6..24ca58da76 100644 --- a/packages/features/insights/components/booking/LeastBookedTeamMembersTable.tsx +++ b/packages/features/insights/components/booking/LeastBookedTeamMembersTable.tsx @@ -1,7 +1,7 @@ "use client"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { useInsightsBookingParameters } from "../../hooks/useInsightsBookingParameters"; import { ChartCard } from "../ChartCard"; diff --git a/packages/features/insights/components/booking/LeastCompletedBookings.tsx b/packages/features/insights/components/booking/LeastCompletedBookings.tsx index 39bbf71281..6902f840ab 100644 --- a/packages/features/insights/components/booking/LeastCompletedBookings.tsx +++ b/packages/features/insights/components/booking/LeastCompletedBookings.tsx @@ -1,7 +1,7 @@ "use client"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { useInsightsBookingParameters } from "../../hooks/useInsightsBookingParameters"; import { ChartCard } from "../ChartCard"; diff --git a/packages/features/insights/components/booking/LowestRatedMembersTable.tsx b/packages/features/insights/components/booking/LowestRatedMembersTable.tsx index ef5faa0a2a..a02b509d8a 100644 --- a/packages/features/insights/components/booking/LowestRatedMembersTable.tsx +++ b/packages/features/insights/components/booking/LowestRatedMembersTable.tsx @@ -1,7 +1,7 @@ "use client"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { useInsightsBookingParameters } from "../../hooks/useInsightsBookingParameters"; import { ChartCard } from "../ChartCard"; diff --git a/packages/features/insights/components/booking/MostBookedTeamMembersTable.tsx b/packages/features/insights/components/booking/MostBookedTeamMembersTable.tsx index fdc16557f2..59fabac803 100644 --- a/packages/features/insights/components/booking/MostBookedTeamMembersTable.tsx +++ b/packages/features/insights/components/booking/MostBookedTeamMembersTable.tsx @@ -1,7 +1,7 @@ "use client"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { useInsightsBookingParameters } from "../../hooks/useInsightsBookingParameters"; import { ChartCard } from "../ChartCard"; diff --git a/packages/features/insights/components/booking/MostCancelledBookingsTables.tsx b/packages/features/insights/components/booking/MostCancelledBookingsTables.tsx index fd87f922b6..006b6e053e 100644 --- a/packages/features/insights/components/booking/MostCancelledBookingsTables.tsx +++ b/packages/features/insights/components/booking/MostCancelledBookingsTables.tsx @@ -1,7 +1,7 @@ "use client"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { useInsightsBookingParameters } from "../../hooks/useInsightsBookingParameters"; import { ChartCard } from "../ChartCard"; diff --git a/packages/features/insights/components/booking/MostCompletedBookings.tsx b/packages/features/insights/components/booking/MostCompletedBookings.tsx index e220dd91da..0b6c49734f 100644 --- a/packages/features/insights/components/booking/MostCompletedBookings.tsx +++ b/packages/features/insights/components/booking/MostCompletedBookings.tsx @@ -1,7 +1,7 @@ "use client"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { useInsightsBookingParameters } from "../../hooks/useInsightsBookingParameters"; import { ChartCard } from "../ChartCard"; diff --git a/packages/features/insights/components/booking/NoShowHostsOverTimeChart.tsx b/packages/features/insights/components/booking/NoShowHostsOverTimeChart.tsx index f9b67782bb..b9fd3461ad 100644 --- a/packages/features/insights/components/booking/NoShowHostsOverTimeChart.tsx +++ b/packages/features/insights/components/booking/NoShowHostsOverTimeChart.tsx @@ -3,7 +3,7 @@ import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer } from "recharts"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import type { RouterOutputs } from "@calcom/trpc/react"; import { useInsightsBookingParameters } from "../../hooks/useInsightsBookingParameters"; diff --git a/packages/features/insights/components/booking/PopularEventsTable.tsx b/packages/features/insights/components/booking/PopularEventsTable.tsx index d4cd8aabc5..e8432f97e5 100644 --- a/packages/features/insights/components/booking/PopularEventsTable.tsx +++ b/packages/features/insights/components/booking/PopularEventsTable.tsx @@ -1,7 +1,7 @@ "use client"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { useInsightsBookingParameters } from "../../hooks/useInsightsBookingParameters"; import { ChartCard, ChartCardItem } from "../ChartCard"; diff --git a/packages/features/insights/components/booking/RecentFeedbackTable.tsx b/packages/features/insights/components/booking/RecentFeedbackTable.tsx index 499aac0012..e666a3a9a0 100644 --- a/packages/features/insights/components/booking/RecentFeedbackTable.tsx +++ b/packages/features/insights/components/booking/RecentFeedbackTable.tsx @@ -1,7 +1,7 @@ "use client"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { useInsightsBookingParameters } from "../../hooks/useInsightsBookingParameters"; import { ChartCard } from "../ChartCard"; diff --git a/packages/features/insights/components/booking/RecentNoShowGuestsChart.tsx b/packages/features/insights/components/booking/RecentNoShowGuestsChart.tsx index dc31d2ab6f..19fd510be1 100644 --- a/packages/features/insights/components/booking/RecentNoShowGuestsChart.tsx +++ b/packages/features/insights/components/booking/RecentNoShowGuestsChart.tsx @@ -2,7 +2,7 @@ import { useCopy } from "@calcom/lib/hooks/useCopy"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { Button } from "@calcom/ui/components/button"; import { showToast } from "@calcom/ui/components/toast"; diff --git a/packages/features/insights/components/routing/FailedBookingsByField.tsx b/packages/features/insights/components/routing/FailedBookingsByField.tsx index 04c730d185..b138b21df6 100644 --- a/packages/features/insights/components/routing/FailedBookingsByField.tsx +++ b/packages/features/insights/components/routing/FailedBookingsByField.tsx @@ -13,7 +13,7 @@ import { } from "recharts"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { ToggleGroup } from "@calcom/ui/components/form"; import { useInsightsRoutingParameters } from "../../hooks/useInsightsRoutingParameters"; diff --git a/packages/features/insights/components/routing/RoutedToPerPeriod.tsx b/packages/features/insights/components/routing/RoutedToPerPeriod.tsx index ff55d571f6..b5b18a69c6 100644 --- a/packages/features/insights/components/routing/RoutedToPerPeriod.tsx +++ b/packages/features/insights/components/routing/RoutedToPerPeriod.tsx @@ -8,7 +8,7 @@ import posthog from "posthog-js"; import { downloadAsCsv } from "@calcom/lib/csvUtils"; import { useDebounce } from "@calcom/lib/hooks/useDebounce"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import type { RouterOutputs } from "@calcom/trpc/react"; import classNames from "@calcom/ui/classNames"; import { Avatar } from "@calcom/ui/components/avatar"; diff --git a/packages/features/insights/components/routing/RoutingFormResponsesTable.tsx b/packages/features/insights/components/routing/RoutingFormResponsesTable.tsx index ea52485374..bc4eebfb43 100644 --- a/packages/features/insights/components/routing/RoutingFormResponsesTable.tsx +++ b/packages/features/insights/components/routing/RoutingFormResponsesTable.tsx @@ -21,7 +21,7 @@ import { } from "@calcom/features/data-table"; import type { FilterType } from "@calcom/types/data-table"; import { useInsightsRoutingParameters } from "@calcom/features/insights/hooks/useInsightsRoutingParameters"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { RoutingFormResponsesDownload } from "../../filters/Download"; import { OrgTeamsFilter } from "../../filters/OrgTeamsFilter"; diff --git a/packages/features/insights/components/routing/RoutingFunnel.tsx b/packages/features/insights/components/routing/RoutingFunnel.tsx index c907d09ad5..b6a609aa8f 100644 --- a/packages/features/insights/components/routing/RoutingFunnel.tsx +++ b/packages/features/insights/components/routing/RoutingFunnel.tsx @@ -2,7 +2,7 @@ import { useInsightsRoutingParameters } from "@calcom/features/insights/hooks/useInsightsRoutingParameters"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { useToggleableLegend } from "../../hooks/useToggleableLegend"; import { ChartCard } from "../ChartCard"; diff --git a/packages/features/insights/components/routing/RoutingKPICards.tsx b/packages/features/insights/components/routing/RoutingKPICards.tsx index 7d1232076f..3aa14ca105 100644 --- a/packages/features/insights/components/routing/RoutingKPICards.tsx +++ b/packages/features/insights/components/routing/RoutingKPICards.tsx @@ -2,7 +2,7 @@ import { useInsightsRoutingParameters } from "@calcom/features/insights/hooks/useInsightsRoutingParameters"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import classNames from "@calcom/ui/classNames"; import { SkeletonText } from "@calcom/ui/components/skeleton"; diff --git a/packages/features/insights/filters/Download/Download.tsx b/packages/features/insights/filters/Download/Download.tsx index 9c482f4145..1d8387bbe6 100644 --- a/packages/features/insights/filters/Download/Download.tsx +++ b/packages/features/insights/filters/Download/Download.tsx @@ -4,7 +4,7 @@ import posthog from "posthog-js"; import dayjs from "@calcom/dayjs"; import { downloadAsCsv } from "@calcom/lib/csvUtils"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import type { RouterOutputs } from "@calcom/trpc/react"; import { Button } from "@calcom/ui/components/button"; import { diff --git a/packages/features/insights/filters/Download/RoutingFormResponsesDownload.tsx b/packages/features/insights/filters/Download/RoutingFormResponsesDownload.tsx index f76a2b0124..2a3b24cd49 100644 --- a/packages/features/insights/filters/Download/RoutingFormResponsesDownload.tsx +++ b/packages/features/insights/filters/Download/RoutingFormResponsesDownload.tsx @@ -5,7 +5,7 @@ import type { SortingState } from "@calcom/features/data-table"; import { useInsightsRoutingParameters } from "@calcom/features/insights/hooks/useInsightsRoutingParameters"; import { downloadAsCsv } from "@calcom/lib/csvUtils"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import type { RouterOutputs } from "@calcom/trpc/react"; import { Button } from "@calcom/ui/components/button"; import { diff --git a/packages/features/insights/filters/OrgTeamsFilter.tsx b/packages/features/insights/filters/OrgTeamsFilter.tsx index 58f566e3e1..1684a31d23 100644 --- a/packages/features/insights/filters/OrgTeamsFilter.tsx +++ b/packages/features/insights/filters/OrgTeamsFilter.tsx @@ -7,7 +7,7 @@ import { } from "@calcom/features/filters/components/TeamsFilter"; import { getPlaceholderAvatar } from "@calcom/lib/defaultAvatarImage"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { Avatar } from "@calcom/ui/components/avatar"; import { Divider } from "@calcom/ui/components/divider"; import { FilterSearchField } from "@calcom/ui/components/form"; diff --git a/packages/features/insights/hooks/useDefaultRoutingForm.ts b/packages/features/insights/hooks/useDefaultRoutingForm.ts index cddd864aa2..1f62e36827 100644 --- a/packages/features/insights/hooks/useDefaultRoutingForm.ts +++ b/packages/features/insights/hooks/useDefaultRoutingForm.ts @@ -2,7 +2,7 @@ import { usePathname, useRouter } from "next/navigation"; import { useEffect, useRef } from "react"; import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; export function useDefaultRoutingForm({ userId, diff --git a/packages/features/insights/hooks/useInsightsBookingFacetedUniqueValues.ts b/packages/features/insights/hooks/useInsightsBookingFacetedUniqueValues.ts index c2feecf094..6cae7b4f48 100644 --- a/packages/features/insights/hooks/useInsightsBookingFacetedUniqueValues.ts +++ b/packages/features/insights/hooks/useInsightsBookingFacetedUniqueValues.ts @@ -4,7 +4,7 @@ import { useCallback } from "react"; import { convertFacetedValuesToMap, type FacetedValue } from "@calcom/features/data-table"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { BookingStatus } from "@calcom/prisma/enums"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { bookingStatusToText } from "../lib/bookingStatusToText"; diff --git a/packages/features/insights/hooks/useInsightsRoutingFacetedUniqueValues.ts b/packages/features/insights/hooks/useInsightsRoutingFacetedUniqueValues.ts index c03bb1a670..12585dd23f 100644 --- a/packages/features/insights/hooks/useInsightsRoutingFacetedUniqueValues.ts +++ b/packages/features/insights/hooks/useInsightsRoutingFacetedUniqueValues.ts @@ -3,7 +3,7 @@ import { useCallback } from "react"; import { convertFacetedValuesToMap, type FacetedValue } from "@calcom/features/data-table"; import { BookingStatus } from "@calcom/prisma/enums"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { bookingStatusToText } from "../lib/bookingStatusToText"; import type { HeaderRow } from "../lib/types"; diff --git a/packages/features/insights/lib/types.ts b/packages/features/insights/lib/types.ts index 78868b5199..0461a0326e 100644 --- a/packages/features/insights/lib/types.ts +++ b/packages/features/insights/lib/types.ts @@ -1,6 +1,6 @@ import { z } from "zod"; -import type { RouterOutputs } from "@calcom/trpc"; +import type { RouterOutputs } from "@calcom/trpc/react"; export type RoutingFormTableRow = RouterOutputs["viewer"]["insights"]["routingFormResponses"]["data"][number]; diff --git a/packages/features/shell/user-dropdown/ProfileDropdown.tsx b/packages/features/shell/user-dropdown/ProfileDropdown.tsx index e665ddc31f..5d700258e6 100644 --- a/packages/features/shell/user-dropdown/ProfileDropdown.tsx +++ b/packages/features/shell/user-dropdown/ProfileDropdown.tsx @@ -3,7 +3,7 @@ import { useState } from "react"; import { ENABLE_PROFILE_SWITCHER } from "@calcom/lib/constants"; import { useRefreshData } from "@calcom/lib/hooks/useRefreshData"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { Avatar } from "@calcom/ui/components/avatar"; import classNames from "@calcom/ui/classNames"; import { diff --git a/packages/features/timezone-buddy/components/AvailabilitySliderTable.tsx b/packages/features/timezone-buddy/components/AvailabilitySliderTable.tsx index db9a02af74..767aad9ca4 100644 --- a/packages/features/timezone-buddy/components/AvailabilitySliderTable.tsx +++ b/packages/features/timezone-buddy/components/AvailabilitySliderTable.tsx @@ -15,7 +15,7 @@ import { APP_NAME, WEBAPP_URL } from "@calcom/lib/constants"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { CURRENT_TIMEZONE } from "@calcom/lib/timezoneConstants"; import type { MembershipRole } from "@calcom/prisma/enums"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import type { UserProfile } from "@calcom/types/UserProfile"; import { UserAvatar } from "@calcom/ui/components/avatar"; import { Button } from "@calcom/ui/components/button"; diff --git a/packages/features/tips/UpgradeTip.tsx b/packages/features/tips/UpgradeTip.tsx index 25bbd69048..d0ab6c9051 100644 --- a/packages/features/tips/UpgradeTip.tsx +++ b/packages/features/tips/UpgradeTip.tsx @@ -2,7 +2,7 @@ import type { ReactNode } from "react"; import { useHasTeamPlan } from "@calcom/features/billing/hooks/useHasPaidPlan"; import { useGetTheme } from "@calcom/lib/hooks/useTheme"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import classNames from "@calcom/ui/classNames"; export function UpgradeTip({ diff --git a/packages/features/troubleshooter/components/EventTypeSelect.tsx b/packages/features/troubleshooter/components/EventTypeSelect.tsx index c430c6b2f6..a7000a249e 100644 --- a/packages/features/troubleshooter/components/EventTypeSelect.tsx +++ b/packages/features/troubleshooter/components/EventTypeSelect.tsx @@ -1,7 +1,7 @@ import { useMemo, useEffect, startTransition } from "react"; import { shallow } from "zustand/shallow"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { SelectField } from "@calcom/ui/components/form"; import { getQueryParam } from "../../bookings/Booker/utils/query-param"; diff --git a/packages/features/troubleshooter/components/LargeCalendar.tsx b/packages/features/troubleshooter/components/LargeCalendar.tsx index 012b63d5cb..9e3002fe1d 100644 --- a/packages/features/troubleshooter/components/LargeCalendar.tsx +++ b/packages/features/troubleshooter/components/LargeCalendar.tsx @@ -5,7 +5,7 @@ import dayjs from "@calcom/dayjs"; import { useAvailableTimeSlots } from "@calcom/features/bookings/Booker/components/hooks/useAvailableTimeSlots"; import { Calendar } from "@calcom/features/calendars/weeklyview"; import { BookingStatus } from "@calcom/prisma/enums"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { useTimePreferences } from "../../bookings/lib/timePreferences"; import { useSchedule } from "../../schedules/lib/use-schedule/useSchedule"; diff --git a/packages/features/users/components/CalendarCredentialBanner.tsx b/packages/features/users/components/CalendarCredentialBanner.tsx index b1001b1c41..1be9566728 100644 --- a/packages/features/users/components/CalendarCredentialBanner.tsx +++ b/packages/features/users/components/CalendarCredentialBanner.tsx @@ -1,7 +1,7 @@ import Link from "next/link"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { type RouterOutputs } from "@calcom/trpc"; +import { type RouterOutputs } from "@calcom/trpc/react"; import { TopBanner } from "@calcom/ui/components/top-banner"; export type CalendarCredentialBannerProps = { diff --git a/packages/features/users/components/InvalidAppCredentialsBanner.tsx b/packages/features/users/components/InvalidAppCredentialsBanner.tsx index 4ce2daaca6..3a8ec7c880 100644 --- a/packages/features/users/components/InvalidAppCredentialsBanner.tsx +++ b/packages/features/users/components/InvalidAppCredentialsBanner.tsx @@ -1,7 +1,7 @@ import { useRouter } from "next/navigation"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { type RouterOutputs } from "@calcom/trpc"; +import { type RouterOutputs } from "@calcom/trpc/react"; import { TopBanner } from "@calcom/ui/components/top-banner"; import { type InvalidAppCredentialBannerProps } from "../types/invalidAppCredentials"; diff --git a/packages/features/users/components/UserTable/BulkActions/EventTypesList.tsx b/packages/features/users/components/UserTable/BulkActions/EventTypesList.tsx index b357bd680d..adc2212800 100644 --- a/packages/features/users/components/UserTable/BulkActions/EventTypesList.tsx +++ b/packages/features/users/components/UserTable/BulkActions/EventTypesList.tsx @@ -5,7 +5,7 @@ import { useState, Fragment } from "react"; import { DataTableSelectionBar } from "@calcom/features/data-table"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { SchedulingType } from "@calcom/prisma/enums"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import type { RouterOutputs } from "@calcom/trpc/react"; import classNames from "@calcom/ui/classNames"; import { Button } from "@calcom/ui/components/button"; diff --git a/packages/features/users/components/UserTable/BulkActions/MassAssignAttributes.tsx b/packages/features/users/components/UserTable/BulkActions/MassAssignAttributes.tsx index c467f5b60e..af40d4a9cb 100644 --- a/packages/features/users/components/UserTable/BulkActions/MassAssignAttributes.tsx +++ b/packages/features/users/components/UserTable/BulkActions/MassAssignAttributes.tsx @@ -5,7 +5,7 @@ import type { Dispatch, SetStateAction } from "react"; import { DataTableSelectionBar, type ColumnFilter } from "@calcom/features/data-table"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import type { Attribute as _Attribute, AttributeOption } from "@calcom/prisma/client"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import classNames from "@calcom/ui/classNames"; import { Alert } from "@calcom/ui/components/alert"; import { Button } from "@calcom/ui/components/button"; diff --git a/packages/features/users/components/UserTable/BulkActions/TeamList.tsx b/packages/features/users/components/UserTable/BulkActions/TeamList.tsx index 67ad108398..c105b6c8c7 100644 --- a/packages/features/users/components/UserTable/BulkActions/TeamList.tsx +++ b/packages/features/users/components/UserTable/BulkActions/TeamList.tsx @@ -4,7 +4,7 @@ import { useState } from "react"; import { DataTableSelectionBar } from "@calcom/features/data-table"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import classNames from "@calcom/ui/classNames"; import { Button } from "@calcom/ui/components/button"; import { diff --git a/packages/features/users/components/UserTable/DeleteMemberModal.tsx b/packages/features/users/components/UserTable/DeleteMemberModal.tsx index ca8a6efe65..f3a2b12a03 100644 --- a/packages/features/users/components/UserTable/DeleteMemberModal.tsx +++ b/packages/features/users/components/UserTable/DeleteMemberModal.tsx @@ -3,7 +3,7 @@ import type { Dispatch } from "react"; import { Dialog } from "@calcom/features/components/controlled-dialog"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { ConfirmationDialogContent } from "@calcom/ui/components/dialog"; import { showToast } from "@calcom/ui/components/toast"; diff --git a/packages/features/users/components/UserTable/InviteMemberModal.tsx b/packages/features/users/components/UserTable/InviteMemberModal.tsx index ba7cd31e4a..931e84429b 100644 --- a/packages/features/users/components/UserTable/InviteMemberModal.tsx +++ b/packages/features/users/components/UserTable/InviteMemberModal.tsx @@ -4,7 +4,7 @@ import type { Dispatch } from "react"; import MemberInvitationModal from "@calcom/features/ee/teams/components/MemberInvitationModal"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { CreationSource } from "@calcom/prisma/enums"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { showToast } from "@calcom/ui/components/toast"; import usePlatformMe from "@calcom/web/components/settings/platform/hooks/usePlatformMe"; diff --git a/packages/features/users/components/UserTable/PlatformManagedUsersTable.tsx b/packages/features/users/components/UserTable/PlatformManagedUsersTable.tsx index 2226938173..bd1b0658ea 100644 --- a/packages/features/users/components/UserTable/PlatformManagedUsersTable.tsx +++ b/packages/features/users/components/UserTable/PlatformManagedUsersTable.tsx @@ -17,7 +17,7 @@ import { import { useSegments } from "@calcom/features/data-table/hooks/useSegments"; import { getUserAvatarUrl } from "@calcom/lib/getAvatarUrl"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { Avatar } from "@calcom/ui/components/avatar"; import { Badge } from "@calcom/ui/components/badge"; import { Checkbox } from "@calcom/ui/components/form"; diff --git a/packages/features/users/components/UserTable/UserListTable.tsx b/packages/features/users/components/UserTable/UserListTable.tsx index c1555ce8f4..08365e2247 100644 --- a/packages/features/users/components/UserTable/UserListTable.tsx +++ b/packages/features/users/components/UserTable/UserListTable.tsx @@ -32,7 +32,7 @@ import { WEBAPP_URL } from "@calcom/lib/constants"; import { downloadAsCsv } from "@calcom/lib/csvUtils"; import { getUserAvatarUrl } from "@calcom/lib/getAvatarUrl"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import type { RouterOutputs } from "@calcom/trpc/react"; import classNames from "@calcom/ui/classNames"; import { Avatar } from "@calcom/ui/components/avatar"; diff --git a/packages/features/users/components/UserTable/types.ts b/packages/features/users/components/UserTable/types.ts index ab6c8a3f78..e37c028d1c 100644 --- a/packages/features/users/components/UserTable/types.ts +++ b/packages/features/users/components/UserTable/types.ts @@ -1,4 +1,4 @@ -import type { RouterOutputs } from "@calcom/trpc"; +import type { RouterOutputs } from "@calcom/trpc/react"; export type UserTableUser = RouterOutputs["viewer"]["organizations"]["listMembers"]["rows"][number]; diff --git a/packages/features/users/components/VerifyEmailBanner.tsx b/packages/features/users/components/VerifyEmailBanner.tsx index e39078bfd3..f75d73be49 100644 --- a/packages/features/users/components/VerifyEmailBanner.tsx +++ b/packages/features/users/components/VerifyEmailBanner.tsx @@ -1,6 +1,6 @@ import { APP_NAME } from "@calcom/lib/constants"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; import { TopBanner } from "@calcom/ui/components/top-banner"; import { showToast } from "@calcom/ui/components/toast"; diff --git a/packages/platform/atoms/add-members-switch/AddMembersWithSwitchWebWrapper.tsx b/packages/platform/atoms/add-members-switch/AddMembersWithSwitchWebWrapper.tsx index 1720fb54b2..52a3836de2 100644 --- a/packages/platform/atoms/add-members-switch/AddMembersWithSwitchWebWrapper.tsx +++ b/packages/platform/atoms/add-members-switch/AddMembersWithSwitchWebWrapper.tsx @@ -1,6 +1,6 @@ import type { AddMembersWithSwitchProps } from "@calcom/features/eventtypes/components/AddMembersWithSwitch"; import { AddMembersWithSwitch } from "@calcom/features/eventtypes/components/AddMembersWithSwitch"; -import { trpc } from "@calcom/trpc"; +import { trpc } from "@calcom/trpc/react"; export const AddMembersWithSwitchWebWrapper = ({ ...props }: AddMembersWithSwitchProps) => { const utils = trpc.useUtils(); diff --git a/packages/trpc/index.ts b/packages/trpc/index.ts index 2b5ed7162b..2dbb57b7b7 100644 --- a/packages/trpc/index.ts +++ b/packages/trpc/index.ts @@ -1 +1,3 @@ -export * from "./react"; +// React exports have been moved to @calcom/trpc/react +// Import from "@calcom/trpc/react" instead of "@calcom/trpc" for client-side code +// This separation improves build performance by preventing server builds from traversing client code diff --git a/packages/trpc/package.json b/packages/trpc/package.json index 0ff233d597..9b22317f3d 100644 --- a/packages/trpc/package.json +++ b/packages/trpc/package.json @@ -9,8 +9,9 @@ "scripts": { "lint": "eslint .", "lint:fix": "eslint . ", - "build": "yarn trpc:generate || true", - "trpc:generate": "yarn tsc --project tsconfig.json" + "build": "yarn build:server && yarn build:react", + "build:server": "yarn tsc --project tsconfig.server.json", + "build:react": "yarn tsc --project tsconfig.react.json" }, "dependencies": { "@tanstack/react-query": "^5.17.15", diff --git a/packages/trpc/react/trpc.ts b/packages/trpc/react/trpc.ts index 28a43dc1bf..d6f16dc654 100644 --- a/packages/trpc/react/trpc.ts +++ b/packages/trpc/react/trpc.ts @@ -9,7 +9,7 @@ import { createTRPCNext } from "@trpc/next"; import type { TRPCClientErrorLike } from "@trpc/react-query"; import type { inferRouterInputs, inferRouterOutputs } from "@trpc/server"; -import type { AppRouter } from "../server/routers/_app"; +import type { AppRouter } from "../types/server/routers/_app"; import { ENDPOINTS } from "./shared"; type Maybe = T | null | undefined; diff --git a/packages/trpc/server/routers/viewer/eventTypes/heavy/create.schema.ts b/packages/trpc/server/routers/viewer/eventTypes/heavy/create.schema.ts index b7be9a623a..57b9506a64 100644 --- a/packages/trpc/server/routers/viewer/eventTypes/heavy/create.schema.ts +++ b/packages/trpc/server/routers/viewer/eventTypes/heavy/create.schema.ts @@ -1,6 +1,6 @@ import type { z } from "zod"; -import { createEventTypeInput } from "@calcom/features/eventtypes/lib/types"; +import { createEventTypeInput } from "@calcom/features/eventtypes/lib/schemas"; export const ZCreateInputSchema = createEventTypeInput; diff --git a/packages/trpc/server/routers/viewer/eventTypes/heavy/duplicate.schema.ts b/packages/trpc/server/routers/viewer/eventTypes/heavy/duplicate.schema.ts index a17ae1e6cc..a8b1c1cf18 100644 --- a/packages/trpc/server/routers/viewer/eventTypes/heavy/duplicate.schema.ts +++ b/packages/trpc/server/routers/viewer/eventTypes/heavy/duplicate.schema.ts @@ -1,6 +1,6 @@ import type { z } from "zod"; -import { EventTypeDuplicateInput } from "@calcom/features/eventtypes/lib/types"; +import { EventTypeDuplicateInput } from "@calcom/features/eventtypes/lib/schemas"; export const ZDuplicateInputSchema = EventTypeDuplicateInput; diff --git a/packages/trpc/tsconfig.react.json b/packages/trpc/tsconfig.react.json new file mode 100644 index 0000000000..4db5bd8382 --- /dev/null +++ b/packages/trpc/tsconfig.react.json @@ -0,0 +1,27 @@ +{ + "extends": "@calcom/tsconfig/react-library.json", + "include": [ + "../types/@wojtekmaj__react-daterange-picker.d.ts", + "../types/business-days-plugin.d.ts", + "../types/next-auth.d.ts", + "../types/tanstack-table.d.ts", + "../types/next.d.ts", + "../types/window.d.ts", + "./react" + ], + "exclude": ["**/node_modules/**", "./server", "./react/**/*.test.ts", "./react/**/*.spec.ts"], + "compilerOptions": { + "isolatedModules": false, + "noEmit": false, + "declaration": true, + "emitDeclarationOnly": true, + "experimentalDecorators": true, + "declarationMap": false, + "resolveJsonModule": true, + "declarationDir": "types/react", + "moduleResolution": "node", + "paths": { + "~/*": ["./*"] + } + } +} diff --git a/packages/trpc/tsconfig.server.json b/packages/trpc/tsconfig.server.json new file mode 100644 index 0000000000..b3a251d742 --- /dev/null +++ b/packages/trpc/tsconfig.server.json @@ -0,0 +1,27 @@ +{ + "extends": "@calcom/tsconfig/react-library.json", + "include": [ + "../types/@wojtekmaj__react-daterange-picker.d.ts", + "../types/business-days-plugin.d.ts", + "../types/next-auth.d.ts", + "../types/tanstack-table.d.ts", + "../types/next.d.ts", + "../types/window.d.ts", + "./server" + ], + "exclude": ["**/node_modules/**", "./react", "./server/**/*.test.ts", "./server/**/*.spec.ts"], + "compilerOptions": { + "isolatedModules": false, + "noEmit": false, + "declaration": true, + "emitDeclarationOnly": true, + "experimentalDecorators": true, + "declarationMap": false, + "resolveJsonModule": true, + "declarationDir": "types/server", + "moduleResolution": "node", + "paths": { + "~/*": ["./*"] + } + } +} diff --git a/turbo.json b/turbo.json index ecfc6cdbec..d9359f528f 100644 --- a/turbo.json +++ b/turbo.json @@ -321,6 +321,7 @@ "dependsOn": ["@calcom/prisma#db-up"] }, "@calcom/trpc#build": { + "dependsOn": ["@calcom/prisma#post-install"], "outputs": ["./types"] }, "@calcom/web#build": {