Scheduling infrastructure for absolutely everyone.
refactor: move hooks and stores from packages/features to apps/web/modules (#27221)
Benny Joo0774a4111920
diff --git a/apps/web/app/(use-page-wrapper)/(main-nav)/booking/[uid]/logs/page.tsx b/apps/web/app/(use-page-wrapper)/(main-nav)/booking/[uid]/logs/page.tsxindex ebe3c5c11b6..6127f1a5d44 100644--- a/apps/web/app/(use-page-wrapper)/(main-nav)/booking/[uid]/logs/page.tsx+++ b/apps/web/app/(use-page-wrapper)/(main-nav)/booking/[uid]/logs/page.tsx@@ -11,7 +11,7 @@ import { getServerSession } from "@calcom/features/auth/lib/getServerSession";import { buildLegacyRequest } from "@lib/buildLegacyCtx";-import { BookingHistoryPage } from "@calcom/features/booking-audit/client/components/BookingHistoryPage";+import { BookingHistoryPage } from "@calcom/web/modules/booking-audit/components/BookingHistoryPage";export const generateMetadata = async ({ params }: { params: Promise<{ uid: string }> }) =>await _generateMetadata(diff --git a/apps/web/components/apps/installation/EventTypeAppSettingsWrapper.tsx b/apps/web/components/apps/installation/EventTypeAppSettingsWrapper.tsxindex 777e82bebd5..7b9a984a0d8 100644--- a/apps/web/components/apps/installation/EventTypeAppSettingsWrapper.tsx+++ b/apps/web/components/apps/installation/EventTypeAppSettingsWrapper.tsx@@ -2,7 +2,7 @@ import { useEffect, type FC } from "react";import { EventTypeAppSettings } from "@calcom/app-store/_components/EventTypeAppSettingsInterface";import type { EventTypeAppsList } from "@calcom/app-store/utils";-import useAppsData from "@calcom/features/apps/hooks/useAppsData";+import useAppsData from "@calcom/web/modules/apps/hooks/useAppsData";import type { ConfigureStepCardProps } from "@components/apps/installation/ConfigureStepCard";diff --git a/packages/features/apps/hooks/useAppsData.ts b/apps/web/modules/apps/hooks/useAppsData.tssimilarity index 100%rename from packages/features/apps/hooks/useAppsData.tsrename to apps/web/modules/apps/hooks/useAppsData.tsdiff --git a/packages/features/booking-audit/client/components/BookingHistory.tsx b/apps/web/modules/booking-audit/components/BookingHistory.tsxsimilarity index 100%rename from packages/features/booking-audit/client/components/BookingHistory.tsxrename to apps/web/modules/booking-audit/components/BookingHistory.tsxdiff --git a/packages/features/booking-audit/client/components/BookingHistoryPage.tsx b/apps/web/modules/booking-audit/components/BookingHistoryPage.tsxsimilarity index 100%rename from packages/features/booking-audit/client/components/BookingHistoryPage.tsxrename to apps/web/modules/booking-audit/components/BookingHistoryPage.tsxdiff --git a/apps/web/modules/bookings/components/BookingDetailsSheet.tsx b/apps/web/modules/bookings/components/BookingDetailsSheet.tsxindex e7495cd94e1..5029573d4c2 100644--- a/apps/web/modules/bookings/components/BookingDetailsSheet.tsx+++ b/apps/web/modules/bookings/components/BookingDetailsSheet.tsx@@ -45,7 +45,7 @@ import { usePaymentStatus } from "../hooks/usePaymentStatus";import { useBookingDetailsSheetStore } from "../store/bookingDetailsSheetStore";import type { BookingOutput } from "../types";import { JoinMeetingButton } from "./JoinMeetingButton";-import { BookingHistory } from "@calcom/features/booking-audit/client/components/BookingHistory";+import { BookingHistory } from "@calcom/web/modules/booking-audit/components/BookingHistory";import { SegmentedControl } from "@calcom/ui/components/segmented-control";type BookingMetaData = z.infer<typeof bookingMetadataSchema>;diff --git a/apps/web/modules/ee/organizations/components/AboutOrganizationForm.tsx b/apps/web/modules/ee/organizations/components/AboutOrganizationForm.tsxindex edd294f5af6..1781f3e2111 100644--- a/apps/web/modules/ee/organizations/components/AboutOrganizationForm.tsx+++ b/apps/web/modules/ee/organizations/components/AboutOrganizationForm.tsx@@ -3,7 +3,7 @@import { useRouter } from "next/navigation";import { Controller, useForm } from "react-hook-form";-import { useOnboarding } from "@calcom/features/ee/organizations/lib/onboardingStore";+import { useOnboarding } from "@calcom/web/modules/ee/organizations/lib/onboardingStore";import { useLocale } from "@calcom/lib/hooks/useLocale";import { ImageUploader } from "@calcom/ui/components/image-uploader";import { TextAreaField } from "@calcom/ui/components/form";diff --git a/apps/web/modules/ee/organizations/components/AdminOnboardingHandover.tsx b/apps/web/modules/ee/organizations/components/AdminOnboardingHandover.tsxindex 5e1266d0592..53b0ef41be2 100644--- a/apps/web/modules/ee/organizations/components/AdminOnboardingHandover.tsx+++ b/apps/web/modules/ee/organizations/components/AdminOnboardingHandover.tsx@@ -3,7 +3,7 @@import { useSession } from "next-auth/react";import { useRouter } from "next/navigation";-import { useOnboarding } from "@calcom/features/ee/organizations/lib/onboardingStore";+import { useOnboarding } from "@calcom/web/modules/ee/organizations/lib/onboardingStore";import { WEBAPP_URL } from "@calcom/lib/constants";import { useLocale } from "@calcom/lib/hooks/useLocale";import { Alert } from "@calcom/ui/components/alert";diff --git a/apps/web/modules/ee/organizations/components/CreateANewOrganizationForm.tsx b/apps/web/modules/ee/organizations/components/CreateANewOrganizationForm.tsxindex 1c8f2caae51..2cc4aa756d6 100644--- a/apps/web/modules/ee/organizations/components/CreateANewOrganizationForm.tsx+++ b/apps/web/modules/ee/organizations/components/CreateANewOrganizationForm.tsx@@ -22,7 +22,7 @@ import { Label } from "@calcom/ui/components/form";import { TextField } from "@calcom/ui/components/form";import { RadioAreaGroup as RadioArea } from "@calcom/ui/components/radio";-import { useOnboarding } from "@calcom/features/ee/organizations/lib/onboardingStore";+import { useOnboarding } from "@calcom/web/modules/ee/organizations/lib/onboardingStore";function extractDomainFromEmail(email: string) {const match = email.match(/^(?:.*?:\/\/)?.*?([\w-]*(?:\.\w{2,}|\.\w{2,}\.\w{2}))(?:[/?#:]|$)/);diff --git a/apps/web/modules/ee/organizations/components/OtherTeamList.tsx b/apps/web/modules/ee/organizations/components/OtherTeamList.tsxindex c5d4691d49e..07d3e5a6536 100644--- a/apps/web/modules/ee/organizations/components/OtherTeamList.tsx+++ b/apps/web/modules/ee/organizations/components/OtherTeamList.tsx@@ -3,7 +3,7 @@import { useState } from "react";import type { OrganizationRepository } from "@calcom/features/ee/organizations/di/OrganizationRepository.module";-import { trackFormbricksAction } from "@calcom/features/formbricks/formbricks-client";+import { trackFormbricksAction } from "@calcom/web/modules/formbricks/lib/trackFormbricksAction";import { trpc } from "@calcom/trpc/react";import { showToast } from "@calcom/ui/components/toast";diff --git a/apps/web/modules/ee/organizations/components/WelcomeToOrganizationsModal.tsx b/apps/web/modules/ee/organizations/components/WelcomeToOrganizationsModal.tsxindex dd262d500dd..f0c48f27cf2 100644--- a/apps/web/modules/ee/organizations/components/WelcomeToOrganizationsModal.tsx+++ b/apps/web/modules/ee/organizations/components/WelcomeToOrganizationsModal.tsx@@ -8,7 +8,7 @@ import { Dialog, DialogContent } from "@calcom/ui/components/dialog";import { Icon, type IconName } from "@calcom/ui/components/icon";import { Logo } from "@calcom/ui/components/logo";-import { useWelcomeModal } from "@calcom/features/ee/organizations/hooks/useWelcomeModal";+import { useWelcomeModal } from "@calcom/web/modules/ee/organizations/hooks/useWelcomeModal";const features = ["1_parent_team_unlimited_subteams",diff --git a/packages/features/ee/organizations/hooks/useWelcomeModal.ts b/apps/web/modules/ee/organizations/hooks/useWelcomeModal.tssimilarity index 100%rename from packages/features/ee/organizations/hooks/useWelcomeModal.tsrename to apps/web/modules/ee/organizations/hooks/useWelcomeModal.tsdiff --git a/packages/features/ee/organizations/lib/onboardingStore.test.ts b/apps/web/modules/ee/organizations/lib/onboardingStore.test.tssimilarity index 100%rename from packages/features/ee/organizations/lib/onboardingStore.test.tsrename to apps/web/modules/ee/organizations/lib/onboardingStore.test.tsdiff --git a/packages/features/ee/organizations/lib/onboardingStore.ts b/apps/web/modules/ee/organizations/lib/onboardingStore.tssimilarity index 100%rename from packages/features/ee/organizations/lib/onboardingStore.tsrename to apps/web/modules/ee/organizations/lib/onboardingStore.tsdiff --git a/apps/web/modules/ee/organizations/new/_components/AddNewTeamsForm.tsx b/apps/web/modules/ee/organizations/new/_components/AddNewTeamsForm.tsxindex b5f2e7ed0cf..341e9f0337d 100644--- a/apps/web/modules/ee/organizations/new/_components/AddNewTeamsForm.tsx+++ b/apps/web/modules/ee/organizations/new/_components/AddNewTeamsForm.tsx@@ -5,7 +5,7 @@ import { useState } from "react";import { Controller, useFieldArray, useForm } from "react-hook-form";import { z } from "zod";-import { useOnboarding } from "@calcom/features/ee/organizations/lib/onboardingStore";+import { useOnboarding } from "@calcom/web/modules/ee/organizations/lib/onboardingStore";import { useLocale } from "@calcom/lib/hooks/useLocale";import slugify from "@calcom/lib/slugify";import { trpc } from "@calcom/trpc/react";diff --git a/apps/web/modules/ee/organizations/new/_components/OnboardMembersView.tsx b/apps/web/modules/ee/organizations/new/_components/OnboardMembersView.tsxindex 421bb94dc98..277d704d3e6 100644--- a/apps/web/modules/ee/organizations/new/_components/OnboardMembersView.tsx+++ b/apps/web/modules/ee/organizations/new/_components/OnboardMembersView.tsx@@ -5,8 +5,8 @@ import { useState } from "react";import { useForm } from "react-hook-form";import { z } from "zod";-import { setShowNewOrgModalFlag } from "@calcom/features/ee/organizations/hooks/useWelcomeModal";-import { useOnboarding } from "@calcom/features/ee/organizations/lib/onboardingStore";+import { setShowNewOrgModalFlag } from "@calcom/web/modules/ee/organizations/hooks/useWelcomeModal";+import { useOnboarding } from "@calcom/web/modules/ee/organizations/lib/onboardingStore";import { useLocale } from "@calcom/lib/hooks/useLocale";import type { RouterOutputs } from "@calcom/trpc/react";import { trpc } from "@calcom/trpc/react";diff --git a/apps/web/modules/ee/organizations/new/_components/PaymentStatusView.tsx b/apps/web/modules/ee/organizations/new/_components/PaymentStatusView.tsxindex 1a5561b9217..2fbb2f3a913 100644--- a/apps/web/modules/ee/organizations/new/_components/PaymentStatusView.tsx+++ b/apps/web/modules/ee/organizations/new/_components/PaymentStatusView.tsx@@ -3,7 +3,7 @@import { useRouter, useSearchParams } from "next/navigation";import { useEffect, useState } from "react";-import { useOnboarding } from "@calcom/features/ee/organizations/lib/onboardingStore";+import { useOnboarding } from "@calcom/web/modules/ee/organizations/lib/onboardingStore";import { useLocale } from "@calcom/lib/hooks/useLocale";import { trpc } from "@calcom/trpc/react";import { Button } from "@calcom/ui/components/button";diff --git a/apps/web/modules/ee/organizations/new/resume-view.tsx b/apps/web/modules/ee/organizations/new/resume-view.tsxindex ce201863b41..e9fe618ea08 100644--- a/apps/web/modules/ee/organizations/new/resume-view.tsx+++ b/apps/web/modules/ee/organizations/new/resume-view.tsx@@ -3,7 +3,7 @@import { useRouter, useSearchParams } from "next/navigation";import { useEffect } from "react";-import { useOnboarding } from "@calcom/features/ee/organizations/lib/onboardingStore";+import { useOnboarding } from "@calcom/web/modules/ee/organizations/lib/onboardingStore";import { useLocale } from "@calcom/lib/hooks/useLocale";import { Alert } from "@calcom/ui/components/alert";import { SkeletonContainer, SkeletonText } from "@calcom/ui/components/skeleton";diff --git a/apps/web/modules/ee/organizations/other-team-profile-view.tsx b/apps/web/modules/ee/organizations/other-team-profile-view.tsxindex 0411e1b6dfb..6899d95b1f4 100644--- a/apps/web/modules/ee/organizations/other-team-profile-view.tsx+++ b/apps/web/modules/ee/organizations/other-team-profile-view.tsx@@ -9,7 +9,7 @@ import { z } from "zod";import { Dialog } from "@calcom/features/components/controlled-dialog";import { subdomainSuffix } from "@calcom/features/ee/organizations/lib/orgDomains";-import { trackFormbricksAction } from "@calcom/features/formbricks/formbricks-client";+import { trackFormbricksAction } from "@calcom/web/modules/formbricks/lib/trackFormbricksAction";import { IS_TEAM_BILLING_ENABLED_CLIENT, WEBAPP_URL } from "@calcom/lib/constants";import { getPlaceholderAvatar } from "@calcom/lib/defaultAvatarImage";import { useLocale } from "@calcom/lib/hooks/useLocale";diff --git a/apps/web/modules/ee/teams/components/TeamInviteList.tsx b/apps/web/modules/ee/teams/components/TeamInviteList.tsxindex aebb8e47e19..b92147e7637 100644--- a/apps/web/modules/ee/teams/components/TeamInviteList.tsx+++ b/apps/web/modules/ee/teams/components/TeamInviteList.tsx@@ -1,6 +1,6 @@import { useState } from "react";-import { trackFormbricksAction } from "@calcom/features/formbricks/formbricks-client";+import { trackFormbricksAction } from "@calcom/web/modules/formbricks/lib/trackFormbricksAction";import type { MembershipRole } from "@calcom/prisma/enums";import { trpc } from "@calcom/trpc/react";import { showToast } from "@calcom/ui/components/toast";diff --git a/apps/web/modules/ee/teams/components/TeamList.tsx b/apps/web/modules/ee/teams/components/TeamList.tsxindex ebddcbfc07a..32465177b71 100644--- a/apps/web/modules/ee/teams/components/TeamList.tsx+++ b/apps/web/modules/ee/teams/components/TeamList.tsx@@ -1,6 +1,6 @@import { useState } from "react";-import { trackFormbricksAction } from "@calcom/features/formbricks/formbricks-client";+import { trackFormbricksAction } from "@calcom/web/modules/formbricks/lib/trackFormbricksAction";import {ORG_SELF_SERVE_ENABLED,ORG_MINIMUM_PUBLISHED_TEAMS_SELF_SERVE_HELPER_DIALOGUE,diff --git a/apps/web/modules/ee/teams/views/team-profile-view.tsx b/apps/web/modules/ee/teams/views/team-profile-view.tsxindex 41298f85ed3..7888552a3dd 100644--- a/apps/web/modules/ee/teams/views/team-profile-view.tsx+++ b/apps/web/modules/ee/teams/views/team-profile-view.tsx@@ -11,7 +11,7 @@ import { z } from "zod";import { checkAdminOrOwner } from "@calcom/features/auth/lib/checkAdminOrOwner";import { Dialog } from "@calcom/features/components/controlled-dialog";import { getTeamUrlSync } from "@calcom/features/ee/organizations/lib/getTeamUrlSync";-import { trackFormbricksAction } from "@calcom/features/formbricks/formbricks-client";+import { trackFormbricksAction } from "@calcom/web/modules/formbricks/lib/trackFormbricksAction";import SectionBottomActions from "@calcom/features/settings/SectionBottomActions";import { IS_TEAM_BILLING_ENABLED, WEBAPP_URL } from "@calcom/lib/constants";import { getPlaceholderAvatar } from "@calcom/lib/defaultAvatarImage";diff --git a/apps/web/modules/ee/workflows/components/WorkflowDetailsPage.tsx b/apps/web/modules/ee/workflows/components/WorkflowDetailsPage.tsxindex 6252c0a057a..915aa6c670d 100644--- a/apps/web/modules/ee/workflows/components/WorkflowDetailsPage.tsx+++ b/apps/web/modules/ee/workflows/components/WorkflowDetailsPage.tsx@@ -3,7 +3,7 @@ import type { Dispatch, SetStateAction } from "react";import { useState, useEffect } from "react";import type { UseFormReturn } from "react-hook-form";-import { useAgentsData } from "@calcom/features/ee/workflows/hooks/useAgentsData";+import { useAgentsData } from "@calcom/web/modules/ee/workflows/hooks/useAgentsData";import {isCalAIAction,isSMSAction,diff --git a/packages/features/ee/workflows/hooks/useAgentsData.ts b/apps/web/modules/ee/workflows/hooks/useAgentsData.tssimilarity index 100%rename from packages/features/ee/workflows/hooks/useAgentsData.tsrename to apps/web/modules/ee/workflows/hooks/useAgentsData.tsdiff --git a/apps/web/modules/event-types/components/tabs/apps/EventAppsTab.tsx b/apps/web/modules/event-types/components/tabs/apps/EventAppsTab.tsxindex 3145642f26e..7a638138a4b 100644--- a/apps/web/modules/event-types/components/tabs/apps/EventAppsTab.tsx+++ b/apps/web/modules/event-types/components/tabs/apps/EventAppsTab.tsx@@ -4,7 +4,7 @@ import { useFormContext } from "react-hook-form";import { EventTypeAppCard } from "@calcom/app-store/_components/EventTypeAppCardInterface";import type { EventTypeAppCardComponentProps } from "@calcom/app-store/types";import type { EventTypeAppsList } from "@calcom/app-store/utils";-import useAppsData from "@calcom/features/apps/hooks/useAppsData";+import useAppsData from "@calcom/web/modules/apps/hooks/useAppsData";import useLockedFieldsManager from "@calcom/features/ee/managed-event-types/hooks/useLockedFieldsManager";import type { FormValues, EventTypeSetupProps, EventTypeApps } from "@calcom/features/eventtypes/lib/types";import ServerTrans from "@calcom/lib/components/ServerTrans";diff --git a/packages/features/formbricks/formbricks-client.ts b/apps/web/modules/formbricks/hooks/useFormbricks.tssimilarity index 83%rename from packages/features/formbricks/formbricks-client.tsrename to apps/web/modules/formbricks/hooks/useFormbricks.tsindex 73ddd147943..1c05fdeedc9 100644--- a/packages/features/formbricks/formbricks-client.ts+++ b/apps/web/modules/formbricks/hooks/useFormbricks.ts@@ -4,7 +4,7 @@ import { useEffect } from "react";import useMeQuery from "@calcom/trpc/react/hooks/useMeQuery";-export const initFormbricks = ({+const initFormbricks = ({userId,attributes,}: {@@ -29,12 +29,6 @@ export const initFormbricks = ({}};-export const trackFormbricksAction = (eventName: string, properties: Record<string, string> = {}) => {- if (process.env.NEXT_PUBLIC_FORMBRICKS_HOST_URL && process.env.NEXT_PUBLIC_FORMBRICKS_ENVIRONMENT_ID) {- formbricks.track(eventName, properties);- }-};-export const useFormbricks = () => {const { data: user, isLoading } = useMeQuery();const { data: session, status } = useSession();diff --git a/apps/web/modules/formbricks/lib/trackFormbricksAction.ts b/apps/web/modules/formbricks/lib/trackFormbricksAction.tsnew file mode 100644index 00000000000..e65b220e99d--- /dev/null+++ b/apps/web/modules/formbricks/lib/trackFormbricksAction.ts@@ -0,0 +1,7 @@+import formbricks from "@formbricks/js/app";++export const trackFormbricksAction = (eventName: string, properties: Record<string, string> = {}) => {+ if (process.env.NEXT_PUBLIC_FORMBRICKS_HOST_URL && process.env.NEXT_PUBLIC_FORMBRICKS_ENVIRONMENT_ID) {+ formbricks.track(eventName, properties);+ }+};diff --git a/apps/web/modules/onboarding/hooks/useSubmitOnboarding.ts b/apps/web/modules/onboarding/hooks/useSubmitOnboarding.tsindex 78a8ac24f56..68f1c30efc2 100644--- a/apps/web/modules/onboarding/hooks/useSubmitOnboarding.ts+++ b/apps/web/modules/onboarding/hooks/useSubmitOnboarding.ts@@ -1,6 +1,6 @@import { useState } from "react";-import { setShowNewOrgModalFlag } from "@calcom/features/ee/organizations/hooks/useWelcomeModal";+import { setShowNewOrgModalFlag } from "@calcom/web/modules/ee/organizations/hooks/useWelcomeModal";import { useFlagMap } from "@calcom/features/flags/context/provider";import { CreationSource } from "@calcom/prisma/enums";import { trpc } from "@calcom/trpc/react";diff --git a/apps/web/modules/shell/Shell.tsx b/apps/web/modules/shell/Shell.tsxindex 852ae579c1e..74c54a00c54 100644--- a/apps/web/modules/shell/Shell.tsx+++ b/apps/web/modules/shell/Shell.tsx@@ -7,9 +7,10 @@ import type React from "react";import { cloneElement } from "react";import { Toaster } from "sonner";+import { useFormbricks } from "@calcom/web/modules/formbricks/hooks/useFormbricks";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";import classNames from "@calcom/ui/classNames";diff --git a/packages/platform/atoms/event-types/wrappers/EventPaymentsTabPlatformWrapper.tsx b/packages/platform/atoms/event-types/wrappers/EventPaymentsTabPlatformWrapper.tsxindex 7447d8b665f..ca562fa861b 100644--- a/packages/platform/atoms/event-types/wrappers/EventPaymentsTabPlatformWrapper.tsx+++ b/packages/platform/atoms/event-types/wrappers/EventPaymentsTabPlatformWrapper.tsx@@ -4,7 +4,7 @@ import type {EventTypeForAppCard,} from "@calcom/app-store/_components/EventTypeAppCardInterface";import type { EventTypeAppsList } from "@calcom/app-store/utils";-import useAppsData from "@calcom/features/apps/hooks/useAppsData";+import useAppsData from "@calcom/web/modules/apps/hooks/useAppsData";import type { EventTypeSetupProps } from "@calcom/features/eventtypes/lib/types";import { EmptyScreen } from "@calcom/ui/components/empty-screen";