refactor: move hooks and stores from packages/features to apps/web/modules (#27221)
* refactor: move booking-audit client components from packages/features to apps/web/modules This is part of the larger effort to move tRPC-dependent UI components from packages/features to apps/web/modules to eliminate circular dependencies. Changes: - Move BookingHistory.tsx and BookingHistoryPage.tsx to apps/web/modules/booking-audit/components/ - Update imports in apps/web to use the new location Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * refactor: move formbricks client from packages/features to apps/web/modules Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * refactor: move hooks and stores from packages/features to apps/web/modules - Move useAppsData hook from packages/features/apps/hooks to apps/web/modules/apps/hooks - Move onboardingStore from packages/features/ee/organizations/lib to apps/web/modules/ee/organizations/lib - Move useWelcomeModal hook from packages/features/ee/organizations/hooks to apps/web/modules/ee/organizations/hooks - Move useAgentsData hook from packages/features/ee/workflows/hooks to apps/web/modules/ee/workflows/hooks - Update all import paths in consuming files Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * refactor: move onboardingStore test file to apps/web/modules Co-Authored-By: benny@cal.com <sldisek783@gmail.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
benny@cal.com <sldisek783@gmail.com>
benny@cal.com <sldisek783@gmail.com>
Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
parent
d93306e32c
commit
0774a41119
@@ -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(
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
@@ -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>;
|
||||
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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}))(?:[/?#:]|$)/);
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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";
|
||||
|
||||
+1
-7
@@ -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();
|
||||
@@ -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);
|
||||
}
|
||||
};
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user