Scheduling infrastructure for absolutely everyone.
refactor: move auth components and hooks from packages/features to apps/web/modules (#27223)
Benny Joo7b8272ea20a7
diff --git a/apps/web/app/(use-page-wrapper)/apps/routing-forms/[...pages]/RoutingFormAuthGuard.tsx b/apps/web/app/(use-page-wrapper)/apps/routing-forms/[...pages]/RoutingFormAuthGuard.tsxindex a6bb3b04ad4..894d0be26a1 100644--- a/apps/web/app/(use-page-wrapper)/apps/routing-forms/[...pages]/RoutingFormAuthGuard.tsx+++ b/apps/web/app/(use-page-wrapper)/apps/routing-forms/[...pages]/RoutingFormAuthGuard.tsx@@ -1,6 +1,6 @@"use client";-import { useRedirectToLoginIfUnauthenticated } from "@calcom/features/auth/lib/hooks/useRedirectToLoginIfUnauthenticated";+import { useRedirectToLoginIfUnauthenticated } from "@calcom/web/modules/auth/hooks/useRedirectToLoginIfUnauthenticated";export function RoutingFormAuthGuard({ children }: { children: React.ReactNode }) {useRedirectToLoginIfUnauthenticated();diff --git a/packages/features/auth/SAMLLogin.tsx b/apps/web/modules/auth/components/SAMLLogin.tsxsimilarity index 96%rename from packages/features/auth/SAMLLogin.tsxrename to apps/web/modules/auth/components/SAMLLogin.tsxindex 98fbbe3724e..d066baa6830 100644--- a/packages/features/auth/SAMLLogin.tsx+++ b/apps/web/modules/auth/components/SAMLLogin.tsx@@ -3,7 +3,7 @@ import type { Dispatch, SetStateAction } from "react";import { useFormContext } from "react-hook-form";import z from "zod";-import { LastUsed, useLastUsed } from "@calcom/features/auth/lib/hooks/useLastUsed";+import { LastUsed, useLastUsed } from "../hooks/useLastUsed";import { HOSTED_CAL_FEATURES } from "@calcom/lib/constants";import { emailRegex } from "@calcom/lib/emailSchema";import { useLocale } from "@calcom/lib/hooks/useLocale";diff --git a/packages/features/auth/Turnstile.tsx b/apps/web/modules/auth/components/Turnstile.tsxsimilarity index 100%rename from packages/features/auth/Turnstile.tsxrename to apps/web/modules/auth/components/Turnstile.tsxdiff --git a/packages/features/auth/lib/hooks/useLastUsed.tsx b/apps/web/modules/auth/hooks/useLastUsed.tsxsimilarity index 100%rename from packages/features/auth/lib/hooks/useLastUsed.tsxrename to apps/web/modules/auth/hooks/useLastUsed.tsxdiff --git a/packages/features/auth/lib/hooks/useRedirectToLoginIfUnauthenticated.tsx b/apps/web/modules/auth/hooks/useRedirectToLoginIfUnauthenticated.tsxsimilarity index 100%rename from packages/features/auth/lib/hooks/useRedirectToLoginIfUnauthenticated.tsxrename to apps/web/modules/auth/hooks/useRedirectToLoginIfUnauthenticated.tsxdiff --git a/packages/features/auth/lib/hooks/useRedirectToOnboardingIfNeeded.tsx b/apps/web/modules/auth/hooks/useRedirectToOnboardingIfNeeded.tsxsimilarity index 100%rename from packages/features/auth/lib/hooks/useRedirectToOnboardingIfNeeded.tsxrename to apps/web/modules/auth/hooks/useRedirectToOnboardingIfNeeded.tsxdiff --git a/apps/web/modules/auth/login-view.tsx b/apps/web/modules/auth/login-view.tsxindex 768ae060284..52d675f4fa6 100644--- a/apps/web/modules/auth/login-view.tsx+++ b/apps/web/modules/auth/login-view.tsx@@ -9,9 +9,9 @@ import { useEffect, useState } from "react";import { FormProvider, useForm } from "react-hook-form";import { z } from "zod";-import { SAMLLogin } from "@calcom/features/auth/SAMLLogin";+import { SAMLLogin } from "@calcom/web/modules/auth/components/SAMLLogin";import { ErrorCode } from "@calcom/features/auth/lib/ErrorCode";-import { LastUsed, useLastUsed } from "@calcom/features/auth/lib/hooks/useLastUsed";+import { LastUsed, useLastUsed } from "@calcom/web/modules/auth/hooks/useLastUsed";import { HOSTED_CAL_FEATURES, WEBAPP_URL, WEBSITE_URL } from "@calcom/lib/constants";import { emailRegex } from "@calcom/lib/emailSchema";import { getSafeRedirectUrl } from "@calcom/lib/getSafeRedirectUrl";diff --git a/apps/web/modules/bookings/components/Booker.test.tsx b/apps/web/modules/bookings/components/Booker.test.tsxindex f0195924c05..751b01b2120 100644--- a/apps/web/modules/bookings/components/Booker.test.tsx+++ b/apps/web/modules/bookings/components/Booker.test.tsx@@ -32,7 +32,7 @@ vi.mock("next/navigation", async (importOriginal) => {});import "@calcom/dayjs/__mocks__";-import "@calcom/features/auth/Turnstile";+import "@calcom/web/modules/auth/components/Turnstile";import { render, screen } from "@calcom/features/bookings/Booker/__tests__/test-utils";import type { BookerProps, WrappedBookerProps } from "@calcom/features/bookings/Booker/types";diff --git a/apps/web/modules/bookings/components/Booker.tsx b/apps/web/modules/bookings/components/Booker.tsxindex 48d82b5b900..c82fa8cc924 100644--- a/apps/web/modules/bookings/components/Booker.tsx+++ b/apps/web/modules/bookings/components/Booker.tsx@@ -4,7 +4,7 @@ import { useIsPlatformBookerEmbed } from "@calcom/atoms/hooks/useIsPlatformBookeimport dayjs from "@calcom/dayjs";import { useEmbedUiConfig } from "@calcom/embed-core/embed-iframe";import { updateEmbedBookerState } from "@calcom/embed-core/src/embed-iframe";-import TurnstileCaptcha from "@calcom/features/auth/Turnstile";+import TurnstileCaptcha from "@calcom/web/modules/auth/components/Turnstile";import { useBookerStoreContext } from "@calcom/features/bookings/Booker/BookerStoreProvider";import { useIsQuickAvailabilityCheckFeatureEnabled } from "@calcom/features/bookings/Booker/components/hooks/useIsQuickAvailabilityCheckFeatureEnabled";import useSkipConfirmStep from "@calcom/features/bookings/Booker/components/hooks/useSkipConfirmStep";diff --git a/apps/web/modules/shell/Shell.tsx b/apps/web/modules/shell/Shell.tsxindex a548b514d73..852ae579c1e 100644--- a/apps/web/modules/shell/Shell.tsx+++ b/apps/web/modules/shell/Shell.tsx@@ -7,8 +7,8 @@ import type React from "react";import { cloneElement } from "react";import { Toaster } from "sonner";-import { useRedirectToLoginIfUnauthenticated } from "@calcom/features/auth/lib/hooks/useRedirectToLoginIfUnauthenticated";-import { useRedirectToOnboardingIfNeeded } from "@calcom/features/auth/lib/hooks/useRedirectToOnboardingIfNeeded";+import { useRedirectToLoginIfUnauthenticated } from "@calcom/web/modules/auth/hooks/useRedirectToLoginIfUnauthenticated";+import { useRedirectToOnboardingIfNeeded } from "@calcom/web/modules/auth/hooks/useRedirectToOnboardingIfNeeded";import { useFormbricks } from "@calcom/features/formbricks/formbricks-client";import TimezoneChangeDialog from "@calcom/web/modules/settings/components/TimezoneChangeDialog";import { useLocale } from "@calcom/lib/hooks/useLocale";diff --git a/apps/web/modules/signup-view.tsx b/apps/web/modules/signup-view.tsxindex da7f4e3fea7..64cfd9eacf5 100644--- a/apps/web/modules/signup-view.tsx+++ b/apps/web/modules/signup-view.tsx@@ -54,7 +54,7 @@ const signupSchema = apiSignupSchema.extend({cfToken: z.string().optional(),});-const TurnstileCaptcha = dynamic(() => import("@calcom/features/auth/Turnstile"), { ssr: false });+const TurnstileCaptcha = dynamic(() => import("@calcom/web/modules/auth/components/Turnstile"), { ssr: false });type FormValues = z.infer<typeof signupSchema>;diff --git a/packages/features/auth/__mocks__/Turnstile.tsx b/packages/features/auth/__mocks__/Turnstile.tsxdeleted file mode 100644index 2543c9ded69..00000000000--- a/packages/features/auth/__mocks__/Turnstile.tsx+++ /dev/null@@ -1,7 +0,0 @@-vi.mock("@calcom/features/auth/Turnstile", () => ({- default: ({ onVerify }: { onVerify: (token: string) => void }) => (- <div data-testid="turnstile-captcha" onClick={() => onVerify("test-token")}>- Mock Captcha- </div>- ),-}));