refactor: move WebWrapper files from packages/platform to apps/web/modules (#26629)
* refactor: move WebWrapper files from packages/platform to apps/web/modules Move the following WebWrapper files to their appropriate locations in apps/web/modules: - EventTypeWebWrapper and related tab wrappers to apps/web/modules/event-types/components/wrappers/ - BookerWebWrapper to apps/web/modules/bookings/components/ - ConferencingAppsViewWebWrapper to apps/web/modules/apps/components/ - SelectedCalendarsSettingsWebWrapper to apps/web/modules/calendars/components/ - AddMembersWithSwitchWebWrapper to apps/web/modules/event-types/components/ This reduces the number of files in packages/platform that import from @calcom/web, improving the separation between platform and web-specific code. Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * fix: move web-specific hooks to apps/web and update imports Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * fix * fix * fix * fix * fix * fix * fix * fix * add back comments * fix * fix * fix * fix * fix: correct relative import paths in moved WebWrapper files Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * final * fix: use package alias for event-type hooks instead of deeply nested relative paths - Move sortHosts function to @calcom/lib/bookings/hostGroupUtils.ts for shared access - Add exports for useEventTypeForm, useHandleRouteChange, useTabsNavigations to @calcom/atoms package.json - Update EventTypeWebWrapper.tsx to use @calcom/atoms package alias instead of ../../../../../packages/... paths - Update useEventTypeForm.ts to import sortHosts from @calcom/lib instead of @calcom/web - Re-export sortHosts from HostEditDialogs.tsx for backward compatibility This addresses the Cubic AI review feedback about fragile deeply nested relative paths that bypass proper package resolution. Co-Authored-By: unknown <> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
unknown
Devin AI
parent
cbb56f6a61
commit
d3e7554835
@@ -6,7 +6,7 @@ import { cookies, headers } from "next/headers";
|
||||
import { redirect } from "next/navigation";
|
||||
import { z } from "zod";
|
||||
|
||||
import { EventTypeWebWrapper } from "@calcom/atoms/event-types/wrappers/EventTypeWebWrapper";
|
||||
import { EventTypeWebWrapper } from "@calcom/web/modules/event-types/components/EventTypeWebWrapper";
|
||||
import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
|
||||
import { getEventTypePermissions } from "@calcom/features/pbac/lib/event-type-permissions";
|
||||
import { eventTypesRouter } from "@calcom/trpc/server/routers/viewer/eventTypes/_router";
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { SkeletonLoader } from "@calcom/atoms/connect/conferencing-apps/ConferencingAppsViewWebWrapper";
|
||||
import { SkeletonLoader } from "@calcom/web/modules/apps/components/ConferencingAppsViewWebWrapper";
|
||||
|
||||
export default function Loading() {
|
||||
return <SkeletonLoader />;
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import { createRouterCaller } from "app/_trpc/context";
|
||||
import { _generateMetadata } from "app/_utils";
|
||||
|
||||
import { ConferencingAppsViewWebWrapper } from "@calcom/atoms/connect/conferencing-apps/ConferencingAppsViewWebWrapper";
|
||||
import { ConferencingAppsViewWebWrapper } from "@calcom/web/modules/apps/components/ConferencingAppsViewWebWrapper";
|
||||
import { appsRouter } from "@calcom/trpc/server/routers/viewer/apps/_router";
|
||||
import { eventTypesRouter } from "@calcom/trpc/server/routers/viewer/eventTypes/_router";
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
import { useEffect, Suspense } from "react";
|
||||
|
||||
import { InstallAppButton } from "@calcom/app-store/InstallAppButton";
|
||||
import { DestinationCalendarSettingsWebWrapper } from "@calcom/atoms/destination-calendar/wrappers/DestinationCalendarSettingsWebWrapper";
|
||||
import { SelectedCalendarsSettingsWebWrapper } from "@calcom/atoms/selected-calendars/wrappers/SelectedCalendarsSettingsWebWrapper";
|
||||
import { DestinationCalendarSettingsWebWrapper } from "./DestinationCalendarSettingsWebWrapper";
|
||||
import { SelectedCalendarsSettingsWebWrapper } from "@calcom/web/modules/calendars/components/SelectedCalendarsSettingsWebWrapper";
|
||||
import AppListCard from "@calcom/web/modules/apps/components/AppListCard";
|
||||
import { SkeletonLoader } from "@calcom/web/modules/apps/components/SkeletonLoader";
|
||||
import SettingsHeader from "@calcom/features/settings/appDir/SettingsHeader";
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
|
||||
import { AtomsWrapper } from "../../src/components/atoms-wrapper";
|
||||
import { DestinationCalendarSettings } from "../DestinationCalendar";
|
||||
import { AtomsWrapper } from "../../../../packages/platform/atoms/src/components/atoms-wrapper";
|
||||
import { DestinationCalendarSettings } from "../../../../packages/platform/atoms/destination-calendar/DestinationCalendar";
|
||||
|
||||
export const DestinationCalendarSettingsWebWrapper = () => {
|
||||
const calendars = trpc.viewer.calendars.connectedCalendars.useQuery();
|
||||
+3
-2
@@ -2,8 +2,6 @@
|
||||
|
||||
import { useReducer } from "react";
|
||||
|
||||
import { AppList } from "@calcom/web/modules/apps/components/AppList";
|
||||
import DisconnectIntegrationModal from "@calcom/web/modules/apps/components/DisconnectIntegrationModal";
|
||||
import SettingsHeader from "@calcom/features/settings/appDir/SettingsHeader";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
@@ -13,6 +11,9 @@ import { EmptyScreen } from "@calcom/ui/components/empty-screen";
|
||||
import { SkeletonText, SkeletonContainer } from "@calcom/ui/components/skeleton";
|
||||
import { showToast } from "@calcom/ui/components/toast";
|
||||
|
||||
import { AppList } from "./AppList";
|
||||
import DisconnectIntegrationModal from "./DisconnectIntegrationModal";
|
||||
|
||||
export type UpdateUsersDefaultConferencingAppParams = {
|
||||
appSlug: string;
|
||||
appLink?: string;
|
||||
+3
-2
@@ -2,7 +2,7 @@
|
||||
|
||||
import { useSession } from "next-auth/react";
|
||||
import { useSearchParams, usePathname, useRouter } from "next/navigation";
|
||||
import { useMemo, useCallback, useEffect, useRef } from "react";
|
||||
import { useMemo, useCallback, useEffect } from "react";
|
||||
import React from "react";
|
||||
import { shallow } from "zustand/shallow";
|
||||
|
||||
@@ -12,7 +12,6 @@ import {
|
||||
} from "@calcom/embed-core/embed-iframe";
|
||||
import { useBookerEmbedEvents } from "@calcom/embed-core/src/embed-iframe/react-hooks";
|
||||
import type { BookerProps } from "@calcom/features/bookings/Booker";
|
||||
import { Booker as BookerComponent } from "@calcom/web/modules/bookings/components/Booker";
|
||||
import {
|
||||
BookerStoreProvider,
|
||||
useInitializeBookerStoreContext,
|
||||
@@ -33,6 +32,8 @@ import { DEFAULT_LIGHT_BRAND_COLOR, DEFAULT_DARK_BRAND_COLOR, WEBAPP_URL } from
|
||||
import { useRouterQuery } from "@calcom/lib/hooks/useRouterQuery";
|
||||
import { localStorage } from "@calcom/lib/webstorage";
|
||||
|
||||
import { Booker as BookerComponent } from "./Booker";
|
||||
|
||||
export type BookerWebWrapperAtomProps = BookerProps & {
|
||||
eventData?: NonNullable<Awaited<ReturnType<typeof getPublicEvent>>>;
|
||||
};
|
||||
+1
-2
@@ -12,7 +12,7 @@ import { Alert } from "@calcom/ui/components/alert";
|
||||
import { Select } from "@calcom/ui/components/form";
|
||||
import { List } from "@calcom/ui/components/list";
|
||||
|
||||
import { SelectedCalendarsSettings } from "../SelectedCalendarsSettings";
|
||||
import { SelectedCalendarsSettings } from "@calcom/atoms/selected-calendars/SelectedCalendarsSettings";
|
||||
|
||||
export enum SelectedCalendarSettingsScope {
|
||||
User = "user",
|
||||
@@ -147,7 +147,6 @@ export const SelectedCalendarsSettingsWebWrapper = (props: SelectedCalendarsSett
|
||||
|
||||
const query = trpc.viewer.calendars.connectedCalendars.useQuery(
|
||||
{
|
||||
|
||||
eventTypeId: scope === SelectedCalendarSettingsScope.EventType ? eventTypeId! : null,
|
||||
},
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { BookerWebWrapper as Booker } from "@calcom/atoms/booker";
|
||||
import { BookerWebWrapper as Booker } from "@calcom/web/modules/bookings/components/BookerWebWrapper";
|
||||
import { getBookerWrapperClasses } from "@calcom/features/bookings/Booker/utils/getBookerWrapperClasses";
|
||||
|
||||
import { type PageProps } from "@lib/d/[link]/[slug]/getServerSideProps";
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Controller } from "react-hook-form";
|
||||
import type { Options } from "react-select";
|
||||
|
||||
import { AddMembersWithSwitchPlatformWrapper } from "@calcom/atoms/add-members-switch/AddMembersWithSwitchPlatformWrapper";
|
||||
import { AddMembersWithSwitchWebWrapper } from "@calcom/atoms/add-members-switch/AddMembersWithSwitchWebWrapper";
|
||||
import { AddMembersWithSwitchWebWrapper } from "./AddMembersWithSwitchWebWrapper";
|
||||
import { useIsPlatform } from "@calcom/atoms/hooks/useIsPlatform";
|
||||
import { Segment } from "@calcom/features/Segment";
|
||||
import type {
|
||||
|
||||
+3
-2
@@ -1,7 +1,8 @@
|
||||
import type { AddMembersWithSwitchProps } from "@calcom/web/modules/event-types/components/AddMembersWithSwitch";
|
||||
import { AddMembersWithSwitch } from "@calcom/web/modules/event-types/components/AddMembersWithSwitch";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
|
||||
import type { AddMembersWithSwitchProps } from "./AddMembersWithSwitch";
|
||||
import { AddMembersWithSwitch } from "./AddMembersWithSwitch";
|
||||
|
||||
export const AddMembersWithSwitchWebWrapper = ({ ...props }: AddMembersWithSwitchProps) => {
|
||||
const utils = trpc.useUtils();
|
||||
|
||||
+21
-36
@@ -6,8 +6,6 @@ import { useEffect, useRef, useState } from "react";
|
||||
import { z } from "zod";
|
||||
|
||||
import { useOrgBranding } from "@calcom/features/ee/organizations/context/provider";
|
||||
import type { ChildrenEventType } from "@calcom/web/modules/event-types/components/ChildrenEventTypeSelect";
|
||||
import { EventType as EventTypeComponent } from "@calcom/web/modules/event-types/components/EventType";
|
||||
import type { EventTypeSetupProps } from "@calcom/features/eventtypes/lib/types";
|
||||
import { EventPermissionProvider } from "@calcom/features/pbac/client/context/EventPermissionContext";
|
||||
import { useWorkflowPermission } from "@calcom/features/pbac/client/hooks/useEventPermission";
|
||||
@@ -20,14 +18,17 @@ import { trpc } from "@calcom/trpc/react";
|
||||
import type { RouterOutputs } from "@calcom/trpc/react";
|
||||
import useMeQuery from "@calcom/trpc/react/hooks/useMeQuery";
|
||||
import { showToast } from "@calcom/ui/components/toast";
|
||||
import { revalidateTeamEventTypeCache } from "@calcom/web/app/(booking-page-wrapper)/team/[slug]/[type]/actions";
|
||||
import { revalidateEventTypeEditPage } from "@calcom/web/app/(use-page-wrapper)/event-types/[type]/actions";
|
||||
|
||||
import { TRPCClientError } from "@trpc/react-query";
|
||||
|
||||
import { useEventTypeForm } from "../hooks/useEventTypeForm";
|
||||
import { useHandleRouteChange } from "../hooks/useHandleRouteChange";
|
||||
import { useTabsNavigations } from "../hooks/useTabsNavigations";
|
||||
import { revalidateTeamEventTypeCache } from "@calcom/web/app/(booking-page-wrapper)/team/[slug]/[type]/actions";
|
||||
import { revalidateEventTypeEditPage } from "@calcom/web/app/(use-page-wrapper)/event-types/[type]/actions";
|
||||
|
||||
import type { ChildrenEventType } from "./ChildrenEventTypeSelect";
|
||||
import { EventType as EventTypeComponent } from "./EventType";
|
||||
import { useEventTypeForm } from "@calcom/atoms/event-types/hooks/useEventTypeForm";
|
||||
import { useHandleRouteChange } from "@calcom/atoms/event-types/hooks/useHandleRouteChange";
|
||||
import { useTabsNavigations } from "@calcom/atoms/event-types/hooks/useTabsNavigations";
|
||||
|
||||
type EventPermissions = {
|
||||
eventTypes: {
|
||||
@@ -44,65 +45,49 @@ type EventPermissions = {
|
||||
};
|
||||
};
|
||||
|
||||
const ManagedEventTypeDialog = dynamic(
|
||||
() => import("@calcom/web/modules/event-types/components/dialogs/ManagedEventDialog")
|
||||
);
|
||||
const ManagedEventTypeDialog = dynamic(() => import("./dialogs/ManagedEventDialog"));
|
||||
|
||||
const AssignmentWarningDialog = dynamic(
|
||||
() => import("@calcom/web/modules/event-types/components/dialogs/AssignmentWarningDialog")
|
||||
);
|
||||
const AssignmentWarningDialog = dynamic(() => import("./dialogs/AssignmentWarningDialog"));
|
||||
|
||||
const EventSetupTab = dynamic(
|
||||
() =>
|
||||
// import web wrapper when it's ready
|
||||
import("./EventSetupTabWebWrapper").then((mod) => mod),
|
||||
() => import("./tabs/setup/EventSetupTabWebWrapper").then((mod) => mod),
|
||||
{ loading: () => null }
|
||||
);
|
||||
|
||||
const EventAvailabilityTab = dynamic(() =>
|
||||
// import web wrapper when it's ready
|
||||
import("./EventAvailabilityTabWebWrapper").then((mod) => mod)
|
||||
import("./tabs/availability/EventAvailabilityTabWebWrapper").then((mod) => mod)
|
||||
);
|
||||
|
||||
const EventTeamAssignmentTab = dynamic(() => import("./EventTeamAssignmentTabWebWrapper").then((mod) => mod));
|
||||
const EventTeamAssignmentTab = dynamic(() => import("./tabs/assignment/EventTeamAssignmentTabWebWrapper").then((mod) => mod));
|
||||
|
||||
const EventLimitsTab = dynamic(() =>
|
||||
// import web wrapper when it's ready
|
||||
import("./EventLimitsTabWebWrapper").then((mod) => mod)
|
||||
import("./tabs/limits/EventLimitsTabWebWrapper").then((mod) => mod)
|
||||
);
|
||||
|
||||
const EventAdvancedTab = dynamic(() =>
|
||||
// import web wrapper when it's ready
|
||||
import("./EventAdvancedWebWrapper").then((mod) => mod)
|
||||
import("./tabs/advanced/EventAdvancedWebWrapper").then((mod) => mod)
|
||||
);
|
||||
|
||||
const EventInstantTab = dynamic(() =>
|
||||
import("@calcom/web/modules/event-types/components/tabs/instant/EventInstantTab").then(
|
||||
(mod) => mod.EventInstantTab
|
||||
)
|
||||
import("./tabs/instant/EventInstantTab").then((mod) => mod.EventInstantTab)
|
||||
);
|
||||
|
||||
const EventRecurringTab = dynamic(() =>
|
||||
// import web wrapper when it's ready
|
||||
import("./EventRecurringWebWrapper").then((mod) => mod)
|
||||
import("./tabs/recurring/EventRecurringWebWrapper").then((mod) => mod)
|
||||
);
|
||||
|
||||
const EventAppsTab = dynamic(() =>
|
||||
import("@calcom/web/modules/event-types/components/tabs/apps/EventAppsTab").then((mod) => mod.EventAppsTab)
|
||||
import("./tabs/apps/EventAppsTab").then((mod) => mod.EventAppsTab)
|
||||
);
|
||||
|
||||
const EventWorkflowsTab = dynamic(
|
||||
() => import("@calcom/web/modules/event-types/components/tabs/workflows/EventWorkflowsTab")
|
||||
);
|
||||
const EventWorkflowsTab = dynamic(() => import("./tabs/workflows/EventWorkflowsTab"));
|
||||
|
||||
const EventWebhooksTab = dynamic(() =>
|
||||
import("@calcom/web/modules/event-types/components/tabs/webhooks/EventWebhooksTab").then(
|
||||
(mod) => mod.EventWebhooksTab
|
||||
)
|
||||
import("./tabs/webhooks/EventWebhooksTab").then((mod) => mod.EventWebhooksTab)
|
||||
);
|
||||
|
||||
const EventAITab = dynamic(() =>
|
||||
import("@calcom/web/modules/event-types/components/tabs/ai/EventAITab").then((mod) => mod.EventAITab)
|
||||
import("./tabs/ai/EventAITab").then((mod) => mod.EventAITab)
|
||||
);
|
||||
|
||||
export type EventTypeWebWrapperProps = {
|
||||
@@ -10,7 +10,7 @@ import type {
|
||||
InputClassNames,
|
||||
SelectClassNames,
|
||||
} from "@calcom/features/eventtypes/lib/types";
|
||||
import { groupHostsByGroupId, getHostsFromOtherGroups } from "@calcom/lib/bookings/hostGroupUtils";
|
||||
import { groupHostsByGroupId, getHostsFromOtherGroups, sortHosts } from "@calcom/lib/bookings/hostGroupUtils";
|
||||
import { DEFAULT_GROUP_ID } from "@calcom/lib/constants";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import classNames from "@calcom/ui/classNames";
|
||||
@@ -128,27 +128,6 @@ export const PriorityDialog = (
|
||||
);
|
||||
};
|
||||
|
||||
export function sortHosts(
|
||||
hostA: { priority: number | null; weight: number | null },
|
||||
hostB: { priority: number | null; weight: number | null },
|
||||
isRRWeightsEnabled: boolean
|
||||
) {
|
||||
const weightA = hostA.weight ?? 100;
|
||||
const priorityA = hostA.priority ?? 2;
|
||||
const weightB = hostB.weight ?? 100;
|
||||
const priorityB = hostB.priority ?? 2;
|
||||
|
||||
if (isRRWeightsEnabled) {
|
||||
if (weightA === weightB) {
|
||||
return priorityB - priorityA;
|
||||
} else {
|
||||
return weightB - weightA;
|
||||
}
|
||||
} else {
|
||||
return priorityB - priorityA;
|
||||
}
|
||||
}
|
||||
|
||||
export type WeightDialogCustomClassNames = {
|
||||
container?: string;
|
||||
label?: string;
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
SelectedCalendarsSettingsWebWrapper,
|
||||
SelectedCalendarSettingsScope,
|
||||
SelectedCalendarsSettingsWebWrapperSkeleton,
|
||||
} from "@calcom/atoms/selected-calendars/wrappers/SelectedCalendarsSettingsWebWrapper";
|
||||
} from "@calcom/web/modules/calendars/components/SelectedCalendarsSettingsWebWrapper";
|
||||
import { Timezone as PlatformTimzoneSelect } from "@calcom/atoms/timezone";
|
||||
import getLocationsOptionsForSelect from "@calcom/features/bookings/lib/getLocationOptionsForSelect";
|
||||
import DestinationCalendarSelector from "@calcom/features/calendars/DestinationCalendarSelector";
|
||||
|
||||
+3
-2
@@ -1,7 +1,8 @@
|
||||
import { localeOptions } from "@calcom/lib/i18n";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
import type { EventAdvancedBaseProps } from "@calcom/web/modules/event-types/components/tabs/advanced/EventAdvancedTab";
|
||||
import { EventAdvancedTab } from "@calcom/web/modules/event-types/components/tabs/advanced/EventAdvancedTab";
|
||||
|
||||
import type { EventAdvancedBaseProps } from "./EventAdvancedTab";
|
||||
import { EventAdvancedTab } from "./EventAdvancedTab";
|
||||
|
||||
const EventAdvancedWebWrapper = ({ ...props }: EventAdvancedBaseProps) => {
|
||||
const connectedCalendarsQuery = trpc.viewer.calendars.connectedCalendars.useQuery();
|
||||
@@ -14,7 +14,7 @@ import AssignAllTeamMembers from "@calcom/web/modules/event-types/components/Ass
|
||||
import type { ChildrenEventTypeSelectCustomClassNames } from "@calcom/web/modules/event-types/components/ChildrenEventTypeSelect";
|
||||
import ChildrenEventTypeSelect from "@calcom/web/modules/event-types/components/ChildrenEventTypeSelect";
|
||||
import { EditWeightsForAllTeamMembers } from "@calcom/web/modules/event-types/components/EditWeightsForAllTeamMembers";
|
||||
import { sortHosts } from "@calcom/web/modules/event-types/components/HostEditDialogs";
|
||||
import { sortHosts } from "@calcom/lib/bookings/hostGroupUtils";
|
||||
import { LearnMoreLink } from "@calcom/web/modules/event-types/components/LearnMoreLink";
|
||||
import WeightDescription from "@calcom/web/modules/event-types/components/WeightDescription";
|
||||
import type {
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
EventTeamAssignmentTab,
|
||||
type EventTeamAssignmentTabBaseProps,
|
||||
} from "@calcom/web/modules/event-types/components/tabs/assignment/EventTeamAssignmentTab";
|
||||
} from "./EventTeamAssignmentTab";
|
||||
|
||||
const EventTeamAssignmentTabWebWrapper = (
|
||||
props: Omit<EventTeamAssignmentTabBaseProps, "isSegmentApplicable">
|
||||
@@ -5,7 +5,7 @@ import { Controller, useFormContext } from "react-hook-form";
|
||||
import type { OptionProps, SingleValueProps } from "react-select";
|
||||
import { components } from "react-select";
|
||||
|
||||
import type { GetAllSchedulesByUserIdQueryType } from "@calcom/atoms/event-types/wrappers/EventAvailabilityTabWebWrapper";
|
||||
import type { GetAllSchedulesByUserIdQueryType } from "./EventAvailabilityTabWebWrapper";
|
||||
import { useIsPlatform } from "@calcom/atoms/hooks/useIsPlatform";
|
||||
import dayjs from "@calcom/dayjs";
|
||||
import { SelectSkeletonLoader } from "@calcom/features/availability/components/SkeletonLoader";
|
||||
|
||||
+3
-2
@@ -1,12 +1,13 @@
|
||||
import { useFormContext } from "react-hook-form";
|
||||
|
||||
import useLockedFieldsManager from "@calcom/features/ee/managed-event-types/hooks/useLockedFieldsManager";
|
||||
import type { TeamMembers } from "@calcom/web/modules/event-types/components/EventType";
|
||||
import type { EventTypeSetup, FormValues } from "@calcom/features/eventtypes/lib/types";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import type { RouterOutputs } from "@calcom/trpc/react";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
import { EventAvailabilityTab } from "@calcom/web/modules/event-types/components/tabs/availability/EventAvailabilityTab";
|
||||
|
||||
import type { TeamMembers } from "../../EventType";
|
||||
import { EventAvailabilityTab } from "./EventAvailabilityTab";
|
||||
|
||||
export type EventAvailabilityTabWebWrapperProps = {
|
||||
eventType: EventTypeSetup;
|
||||
+1
-1
@@ -5,4 +5,4 @@ const EventLimitsTabWebWrapper = (props: EventLimitsTabProps) => {
|
||||
return <EventLimitsTab {...props} />;
|
||||
};
|
||||
|
||||
export default EventLimitsTabWebWrapper;
|
||||
export default EventLimitsTabWebWrapper;
|
||||
+1
-1
@@ -5,4 +5,4 @@ const EventRecurringWebWrapper = (props: EventRecurringTabProps) => {
|
||||
return <EventRecurringTab {...props} />;
|
||||
};
|
||||
|
||||
export default EventRecurringWebWrapper;
|
||||
export default EventRecurringWebWrapper;
|
||||
+3
-2
@@ -3,8 +3,9 @@ import { useSession } from "next-auth/react";
|
||||
import { useOrgBranding } from "@calcom/features/ee/organizations/context/provider";
|
||||
import { WEBSITE_URL } from "@calcom/lib/constants";
|
||||
import { localeOptions } from "@calcom/lib/i18n";
|
||||
import type { EventSetupTabProps } from "@calcom/web/modules/event-types/components/tabs/setup/EventSetupTab";
|
||||
import { EventSetupTab } from "@calcom/web/modules/event-types/components/tabs/setup/EventSetupTab";
|
||||
|
||||
import type { EventSetupTabProps } from "./EventSetupTab";
|
||||
import { EventSetupTab } from "./EventSetupTab";
|
||||
|
||||
const EventSetupTabWebWrapper = (props: EventSetupTabProps) => {
|
||||
const orgBranding = useOrgBranding();
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
import type { EmbedProps } from "app/WithEmbedSSR";
|
||||
|
||||
import { BookerWebWrapper as Booker } from "@calcom/atoms/booker";
|
||||
import { BookerWebWrapper as Booker } from "@calcom/web/modules/bookings/components/BookerWebWrapper";
|
||||
import { getBookerWrapperClasses } from "@calcom/features/bookings/Booker/utils/getBookerWrapperClasses";
|
||||
|
||||
import type { getServerSideProps } from "@lib/org/[orgSlug]/instant-meeting/team/[slug]/[type]/getServerSideProps";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { BookerWebWrapper, type BookerWebWrapperAtomProps } from "@calcom/atoms/booker";
|
||||
import { BookerWebWrapper, type BookerWebWrapperAtomProps } from "@calcom/web/modules/bookings/components/BookerWebWrapper";
|
||||
import { getBookerWrapperClasses } from "@calcom/features/bookings/Booker/utils/getBookerWrapperClasses";
|
||||
|
||||
import BookingPageErrorBoundary from "@components/error/BookingPageErrorBoundary";
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import type { EmbedProps } from "app/WithEmbedSSR";
|
||||
import { useSearchParams } from "next/navigation";
|
||||
|
||||
import { BookerWebWrapper as Booker } from "@calcom/atoms/booker";
|
||||
import { BookerWebWrapper as Booker } from "@calcom/web/modules/bookings/components/BookerWebWrapper";
|
||||
import { getBookerWrapperClasses } from "@calcom/features/bookings/Booker/utils/getBookerWrapperClasses";
|
||||
|
||||
import type { getServerSideProps } from "@lib/team/[slug]/[type]/getServerSideProps";
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import type { EmbedProps } from "app/WithEmbedSSR";
|
||||
import { useSearchParams } from "next/navigation";
|
||||
|
||||
import { BookerWebWrapper as Booker } from "@calcom/atoms/booker";
|
||||
import { BookerWebWrapper as Booker } from "@calcom/web/modules/bookings/components/BookerWebWrapper";
|
||||
import { getBookerWrapperClasses } from "@calcom/features/bookings/Booker/utils/getBookerWrapperClasses";
|
||||
|
||||
import type { inferSSRProps } from "@lib/types/inferSSRProps";
|
||||
|
||||
@@ -37,3 +37,24 @@ export function getHostsFromOtherGroups<T extends { groupId?: string | null }>(
|
||||
(host) => (groupId && (!host.groupId || host.groupId !== groupId)) || (!groupId && host.groupId)
|
||||
);
|
||||
}
|
||||
|
||||
export function sortHosts(
|
||||
hostA: { priority: number | null; weight: number | null },
|
||||
hostB: { priority: number | null; weight: number | null },
|
||||
isRRWeightsEnabled: boolean
|
||||
) {
|
||||
const weightA = hostA.weight ?? 100;
|
||||
const priorityA = hostA.priority ?? 2;
|
||||
const weightB = hostB.weight ?? 100;
|
||||
const priorityB = hostB.priority ?? 2;
|
||||
|
||||
if (isRRWeightsEnabled) {
|
||||
if (weightA === weightB) {
|
||||
return priorityB - priorityA;
|
||||
} else {
|
||||
return weightB - weightA;
|
||||
}
|
||||
} else {
|
||||
return priorityB - priorityA;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
export { BookerWebWrapper } from "./BookerWebWrapper";
|
||||
export type { BookerWebWrapperAtomProps } from "./BookerWebWrapper";
|
||||
@@ -7,8 +7,8 @@ import checkForMultiplePaymentApps from "@calcom/app-store/_utils/payments/check
|
||||
import { locationsResolver } from "@calcom/app-store/locations";
|
||||
import { DEFAULT_PROMPT_VALUE, DEFAULT_BEGIN_MESSAGE } from "@calcom/features/calAIPhone/promptTemplates";
|
||||
import type { TemplateType } from "@calcom/features/calAIPhone/zod-utils";
|
||||
import { sortHosts } from "@calcom/web/modules/event-types/components/HostEditDialogs";
|
||||
import { validateCustomEventName } from "@calcom/features/eventtypes/lib/eventNaming";
|
||||
import { sortHosts } from "@calcom/lib/bookings/hostGroupUtils";
|
||||
import type {
|
||||
FormValues,
|
||||
EventTypeSetupProps,
|
||||
|
||||
@@ -54,15 +54,12 @@
|
||||
"require": "./dist/cal-atoms.umd.cjs"
|
||||
},
|
||||
"./add-members-switch/AddMembersWithSwitchPlatformWrapper": "./add-members-switch/AddMembersWithSwitchPlatformWrapper.tsx",
|
||||
"./add-members-switch/AddMembersWithSwitchWebWrapper": "./add-members-switch/AddMembersWithSwitchWebWrapper.tsx",
|
||||
"./availability/AvailabilitySettings": "./availability/AvailabilitySettings.tsx",
|
||||
"./booker": "./booker/index.ts",
|
||||
"./selected-calendars/SelectedCalendarsSettings": "./selected-calendars/SelectedCalendarsSettings.tsx",
|
||||
"./components/ui/shell": "./src/components/ui/shell.tsx",
|
||||
"./connect/conferencing-apps/ConferencingAppsViewWebWrapper": "./connect/conferencing-apps/ConferencingAppsViewWebWrapper.tsx",
|
||||
"./destination-calendar/wrappers/DestinationCalendarSettingsWebWrapper": "./destination-calendar/wrappers/DestinationCalendarSettingsWebWrapper.tsx",
|
||||
"./dist/index.ts": "./index.ts",
|
||||
"./dist/index.d.ts": "./dist/index.d.ts",
|
||||
"./event-types/wrappers/EventTypeWebWrapper": "./event-types/wrappers/EventTypeWebWrapper.tsx",
|
||||
"./globals.min.css": "./globals.min.css",
|
||||
"./hooks/bookings/useBookings": "./hooks/bookings/useBookings.ts",
|
||||
"./hooks/bookings/useHandleBookEvent": "./hooks/bookings/useHandleBookEvent.ts",
|
||||
@@ -72,7 +69,9 @@
|
||||
"./hooks/useIsPlatform": "./hooks/useIsPlatform.ts",
|
||||
"./hooks/useIsPlatformBookerEmbed": "./hooks/useIsPlatformBookerEmbed.ts",
|
||||
"./hooks/event-types/private/useEventTypeById": "./hooks/event-types/private/useEventTypeById.ts",
|
||||
"./selected-calendars/wrappers/SelectedCalendarsSettingsWebWrapper": "./selected-calendars/wrappers/SelectedCalendarsSettingsWebWrapper.tsx",
|
||||
"./event-types/hooks/useEventTypeForm": "./event-types/hooks/useEventTypeForm.ts",
|
||||
"./event-types/hooks/useHandleRouteChange": "./event-types/hooks/useHandleRouteChange.ts",
|
||||
"./event-types/hooks/useTabsNavigations": "./event-types/hooks/useTabsNavigations.tsx",
|
||||
"./timezone": "./timezone/index.tsx"
|
||||
},
|
||||
"types": "./dist/index.d.ts",
|
||||
|
||||
Reference in New Issue
Block a user