diff --git a/apps/api/v2/package.json b/apps/api/v2/package.json index 2006fd05d441f5..78756bdeef83e7 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 64488f59b70cf7..73e3ea1c53c2e6 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 9f4600469491ff..4d009286e2825f 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 e89db5fab333da..4635e6428802d5 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 3ebc2f0f6c89e5..194c537964afc0 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 ae12d39dccc745..f2d3b96c2bd84b 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 99398f019a82a1..271494979c78ac 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 e203beff5e914a..a552196b826646 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 590d113a72e67c..17a439baef92ce 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 d1de5dbe1416c4..d37770eb1309cc 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 1e54b3835a7833..0b16d449ecf7eb 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 8e3661294132ef..c5c4ad71f66d0e 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 5daf5858c2d47d..a6228c0856fed3 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 cbc69a786736ff..a2fb75d344a6d4 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 a1141a2256bc96..421bb94dc989af 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 972e4bb7df33fc..1a5561b9217134 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 e8013c63ad91eb..82d4a9b99afbae 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 442861c7fe08e4..13ef58452a23aa 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 556a22b3b865b8..a45f003725c3da 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 abafe50b77fa9c..80cfe5ab782a96 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 5b515d238bce94..f90115018880c6 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 cbf93aa49f912f..85fae73b6d0628 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 910a5ca3a68fec..a68be96e6ecf93 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 10831c1d0d712d..6e5e8cd91816d8 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 3ee4755ba84446..7ef1a668a66722 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 faebef50984eec..a246d8c8561047 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 3564929d79bdfb..eada0222d3cfb2 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 00000000000000..9fae23b34c8ebf --- /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 f546760d7252d9..1f3454e5c498c8 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 63bc4888f6be93..fc0de3b067460e 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 00000000000000..8bf2df2a89b829 --- /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 4defe5d38337ab..0a8226da4f140d 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 548dd96c7f81ed..448181502f9074 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 0b2707068d78fc..39503b9321218a 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 c712c28d6c2206..62a1f2c1e8eaf3 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 da3a19a67d1a04..b109f370697d5c 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 c8352de94854e9..7f2d3fa61ef671 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 b44670dacad670..64ba7c5776eaf2 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 b1852f86857098..b7d7957cf81188 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 1446765da136ef..b61a2f4715dd06 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 4d714409df8416..f61a66a750ce98 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 c6b677293ccc88..5ccfd8317efa4c 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 8e7aa1cc16b128..63ec6724ca6446 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 0218094d16356d..48bafb0b780050 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 3d9131886fc680..876607f5efc3f3 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 4efab6743d5017..ef323854fe640a 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 c07a2afa8ea27e..ab162630e72c29 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 ff1ee1627c3b9a..2efe7dc5dfebb6 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 cf225096ad5148..e5218ecfd65e08 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 c2c94d6b6a25f7..4eeea447bb2851 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 c8e16fd8a4feb2..0d28ee7437dee1 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 00000000000000..ed127cbdda1a0f --- /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 00000000000000..82350a7036918c --- /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 e61b881b98bf87..2c0b0e79439cc1 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 13e32276a91667..3f6930277c9015 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 8ccabe406bbd8f..eaa7adce6439dd 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 df9430c75cc9fb..2fcb995d44be5c 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 c66609f745c2de..aa8e1c379e6bde 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 f8482e31421547..77d7aa083000e9 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 0767e4c59eb365..a093baaa3709f6 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 afbef1811ab5bd..e780ea76d8432e 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 cbf79954b4045c..e849456036d69f 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 24a80954b67c0b..24ca58da76f7a5 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 39bbf71281c712..6902f840ab7c32 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 ef5faa0a2a97e7..a02b509d8ae18b 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 fdc16557f22cdc..59fabac803f604 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 fd87f922b63ac6..006b6e053ea446 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 e220dd91da2b77..0b6c49734fdc48 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 f9b67782bb523b..b9fd3461ad7f54 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 d4cd8aabc54a4b..e8432f97e595be 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 499aac001274b1..e666a3a9a0bf3a 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 dc31d2ab6f65c6..19fd510be1dced 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 04c730d185cd83..b138b21df61660 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 ff55d571f68061..b5b18a69c6406a 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 ea524853741cdd..bc4eebfb438e7d 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 c907d09ad53fd6..b6a609aa8fac77 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 7d1232076f0e4b..3aa14ca105e098 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 9c482f414572c2..1d8387bbe65bc5 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 f76a2b0124fca0..2a3b24cd49d0a9 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 58f566e3e1da56..1684a31d23843b 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 cddd864aa2ea1e..1f62e36827ebdd 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 c2feecf09451f4..6cae7b4f4872f2 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 c03bb1a670a464..12585dd23ffc12 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 78868b51998854..0461a0326e0097 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 e665ddc31ff31d..5d700258e6abcc 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 db9a02af74b53e..767aad9ca478c4 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 25bbd69048c34e..d0ab6c905168da 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 c430c6b2f6ba1a..a7000a249e24da 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 012b63d5cb1f69..9e3002fe1d31c1 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 b1001b1c419336..1be956672813a0 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 4ce2daaca655c4..3a8ec7c880b441 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 b357bd680d136a..adc2212800a07c 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 c467f5b60e2459..af40d4a9cb8c5b 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 67ad1083988052..c105b6c8c789c1 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 ca8a6efe65ad5f..f3a2b12a035764 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 ba7cd31e4a1f29..931e84429b59d2 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 2226938173723b..bd1b0658ea7165 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 c1555ce8f406dd..08365e2247ac3e 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 ab6c8a3f7821bd..e37c028d1c20d6 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 e39078bfd3363a..f75d73be49e0e6 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 1720fb54b25865..52a3836de28313 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 2b5ed7162b9cb4..2dbb57b7b7b32c 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 0ff233d59797bb..9b22317f3dd11d 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 28a43dc1bf0120..d6f16dc6548b87 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 b7be9a623a5cac..57b9506a64a846 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 a17ae1e6ccc840..a8b1c1cf187525 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 00000000000000..4db5bd838243d6 --- /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 00000000000000..b3a251d7427001 --- /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 ecfc6cdbec9438..d9359f528f8378 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": {