Skip to content

Scheduling infrastructure for absolutely everyone.

Refactors EE code (#3490)

Omar López464343f5abb1
diff --git a/apps/api b/apps/api
index aba7b1ec1c9..60c2f736075 160000
--- a/apps/api
+++ b/apps/api
@@ -1 +1 @@
-Subproject commit aba7b1ec1c9b5122609dea916c7b114e9a3ba66f
+Subproject commit 60c2f736075122ec3b91a24ef612ad004d257cdb
diff --git a/apps/console b/apps/console
index ac2567263de..0f33218c84a 160000
--- a/apps/console
+++ b/apps/console
@@ -1 +1 @@
-Subproject commit ac2567263de74449c6e4b98b468415ce1c1815d4
+Subproject commit 0f33218c84aac810efc3b8f2de483cbcb7c5836c
diff --git a/apps/web/components/App.tsx b/apps/web/components/App.tsx
index 3908a0efc4f..d47a9136dcf 100644
--- a/apps/web/components/App.tsx
+++ b/apps/web/components/App.tsx
@@ -3,16 +3,15 @@ import React, { useEffect, useState } from "react";
import useAddAppMutation from "@calcom/app-store/_utils/useAddAppMutation";
import { InstallAppButton } from "@calcom/app-store/components";
+import LicenseRequired from "@calcom/features/ee/common/components/LicenseRequired";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import showToast from "@calcom/lib/notification";
import { trpc } from "@calcom/trpc/react";
import { App as AppType } from "@calcom/types/App";
import { Button, SkeletonButton } from "@calcom/ui";
+import Badge from "@calcom/ui/Badge";
import { Icon } from "@calcom/ui/Icon";
-import LicenseRequired from "@ee/components/LicenseRequired";
-
-import Shell from "@components/Shell";
-import Badge from "@components/ui/Badge";
+import Shell from "@calcom/ui/Shell";
const Component = ({
name,
diff --git a/apps/web/components/SettingsShell.tsx b/apps/web/components/SettingsShell.tsx
index e3cb3c6d8bb..fa777d088de 100644
--- a/apps/web/components/SettingsShell.tsx
+++ b/apps/web/components/SettingsShell.tsx
@@ -1,11 +1,10 @@
import React, { ComponentProps } from "react";
+import ErrorBoundary from "@calcom/ui/ErrorBoundary";
import { Icon } from "@calcom/ui/Icon";
-
-import ErrorBoundary from "@lib/ErrorBoundary";
+import Shell from "@calcom/ui/Shell";
import NavTabs from "./NavTabs";
-import Shell from "./Shell";
const tabs = [
{
diff --git a/apps/web/components/apps/AppCard.tsx b/apps/web/components/apps/AppCard.tsx
index 6397b9e46b4..dc1fdc0c490 100644
--- a/apps/web/components/apps/AppCard.tsx
+++ b/apps/web/components/apps/AppCard.tsx
@@ -1,10 +1,9 @@
import Link from "next/link";
import { trpc } from "@calcom/trpc/react";
+import Badge from "@calcom/ui/Badge";
import Button from "@calcom/ui/Button";
-import Badge from "@components/ui/Badge";
-
interface AppCardProps {
logo: string;
name: string;
diff --git a/apps/web/components/auth/SAMLLogin.tsx b/apps/web/components/auth/SAMLLogin.tsx
index 62ec48ef0fe..a675b90a5ee 100644
--- a/apps/web/components/auth/SAMLLogin.tsx
+++ b/apps/web/components/auth/SAMLLogin.tsx
@@ -2,11 +2,11 @@ import { signIn } from "next-auth/react";
import { Dispatch, SetStateAction } from "react";
import { useFormContext } from "react-hook-form";
+import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@calcom/lib/telemetry";
import { trpc } from "@calcom/trpc/react";
import Button from "@calcom/ui/Button";
import { useLocale } from "@lib/hooks/useLocale";
-import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@lib/telemetry";
interface Props {
email: string;
diff --git a/apps/web/components/booking/CancelBooking.tsx b/apps/web/components/booking/CancelBooking.tsx
index 9e88d490213..c3aa355c48f 100644
--- a/apps/web/components/booking/CancelBooking.tsx
+++ b/apps/web/components/booking/CancelBooking.tsx
@@ -2,13 +2,12 @@ import { useRouter } from "next/router";
import { useState } from "react";
import { useLocale } from "@calcom/lib/hooks/useLocale";
-import { RecurringEvent } from "@calcom/types/Calendar";
+import useTheme from "@calcom/lib/hooks/useTheme";
+import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@calcom/lib/telemetry";
+import type { RecurringEvent } from "@calcom/types/Calendar";
import { Button } from "@calcom/ui/Button";
import { Icon } from "@calcom/ui/Icon";
-import useTheme from "@lib/hooks/useTheme";
-import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@lib/telemetry";
-
type Props = {
booking: {
title?: string;
diff --git a/apps/web/components/booking/TimeOptions.tsx b/apps/web/components/booking/TimeOptions.tsx
index 2db42d48367..f1916b0d148 100644
--- a/apps/web/components/booking/TimeOptions.tsx
+++ b/apps/web/components/booking/TimeOptions.tsx
@@ -2,8 +2,7 @@ import { FC, useEffect, useState } from "react";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import Switch from "@calcom/ui/Switch";
-
-import TimezoneSelect, { ITimezoneOption } from "@components/ui/form/TimezoneSelect";
+import TimezoneSelect, { ITimezoneOption } from "@calcom/ui/form/TimezoneSelect";
import { is24h, timeZone } from "../../lib/clock";
diff --git a/apps/web/components/booking/pages/AvailabilityPage.tsx b/apps/web/components/booking/pages/AvailabilityPage.tsx
index 26b7deaaa55..8ab45db6c0c 100644
--- a/apps/web/components/booking/pages/AvailabilityPage.tsx
+++ b/apps/web/components/booking/pages/AvailabilityPage.tsx
@@ -1,7 +1,6 @@
// Get router variables
import { EventType } from "@prisma/client";
import * as Collapsible from "@radix-ui/react-collapsible";
-import { useContracts } from "contexts/contractsContext";
import { TFunction } from "next-i18next";
import { useRouter } from "next/router";
import { useEffect, useMemo, useState } from "react";
@@ -16,11 +15,15 @@ import {
useEmbedNonStylesConfig,
useIsBackgroundTransparent,
} from "@calcom/embed-core/embed-iframe";
+import { useContracts } from "@calcom/features/ee/web3/contexts/contractsContext";
import CustomBranding from "@calcom/lib/CustomBranding";
import classNames from "@calcom/lib/classNames";
import { CAL_URL, WEBSITE_URL } from "@calcom/lib/constants";
import { useLocale } from "@calcom/lib/hooks/useLocale";
+import useTheme from "@calcom/lib/hooks/useTheme";
import { getRecurringFreq } from "@calcom/lib/recurringStrings";
+import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@calcom/lib/telemetry";
+import { detectBrowserTimeFormat } from "@calcom/lib/timeFormat";
import { localStorage } from "@calcom/lib/webstorage";
import { trpc } from "@calcom/trpc/react";
import { Icon } from "@calcom/ui/Icon";
@@ -29,10 +32,7 @@ import DatePicker from "@calcom/ui/booker/DatePicker";
import { timeZone as localStorageTimeZone } from "@lib/clock";
// import { timeZone } from "@lib/clock";
import { useExposePlanGlobally } from "@lib/hooks/useExposePlanGlobally";
-import useTheme from "@lib/hooks/useTheme";
import { isBrandingHidden } from "@lib/isBrandingHidden";
-import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@lib/telemetry";
-import { detectBrowserTimeFormat } from "@lib/timeFormat";
import AvailableTimes from "@components/booking/AvailableTimes";
import TimeOptions from "@components/booking/TimeOptions";
diff --git a/apps/web/components/booking/pages/BookingPage.tsx b/apps/web/components/booking/pages/BookingPage.tsx
index 7c335f47258..bd1f36e060b 100644
--- a/apps/web/components/booking/pages/BookingPage.tsx
+++ b/apps/web/components/booking/pages/BookingPage.tsx
@@ -1,9 +1,7 @@
import { zodResolver } from "@hookform/resolvers/zod";
import { EventTypeCustomInputType, WorkflowActions } from "@prisma/client";
-import { useContracts } from "contexts/contractsContext";
import { isValidPhoneNumber } from "libphonenumber-js";
import { useSession } from "next-auth/react";
-import dynamic from "next/dynamic";
import Head from "next/head";
import { useRouter } from "next/router";
import { useEffect, useMemo, useState } from "react";
@@ -14,36 +12,37 @@ import { useMutation } from "react-query";
import { v4 as uuidv4 } from "uuid";
import { z } from "zod";
+import { createPaymentLink } from "@calcom/app-store/stripepayment/lib/client";
import dayjs from "@calcom/dayjs";
import {
useEmbedNonStylesConfig,
useIsBackgroundTransparent,
useIsEmbed,
} from "@calcom/embed-core/embed-iframe";
+import { useContracts } from "@calcom/features/ee/web3/contexts/contractsContext";
import CustomBranding from "@calcom/lib/CustomBranding";
import classNames from "@calcom/lib/classNames";
import { useLocale } from "@calcom/lib/hooks/useLocale";
+import useTheme from "@calcom/lib/hooks/useTheme";
import { HttpError } from "@calcom/lib/http-error";
import { getEveryFreqFor } from "@calcom/lib/recurringStrings";
-import { createPaymentLink } from "@calcom/stripe/client";
+import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@calcom/lib/telemetry";
import { Button } from "@calcom/ui/Button";
import { Icon } from "@calcom/ui/Icon";
import { Tooltip } from "@calcom/ui/Tooltip";
+import PhoneInput from "@calcom/ui/form/PhoneInputLazy";
import { EmailInput, Form } from "@calcom/ui/form/fields";
import { asStringOrNull } from "@lib/asStringOrNull";
import { timeZone } from "@lib/clock";
import { ensureArray } from "@lib/ensureArray";
-import useTheme from "@lib/hooks/useTheme";
import { LocationObject, LocationType } from "@lib/location";
import createBooking from "@lib/mutations/bookings/create-booking";
import createRecurringBooking from "@lib/mutations/bookings/create-recurring-booking";
import { parseDate, parseRecurringDates } from "@lib/parseDate";
import slugify from "@lib/slugify";
-import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@lib/telemetry";
import AvatarGroup from "@components/ui/AvatarGroup";
-import type PhoneInputType from "@components/ui/form/PhoneInput";
import { BookPageProps } from "../../../pages/[user]/book";
import { HashLinkPageProps } from "../../../pages/d/[link]/book";
@@ -58,11 +57,6 @@ declare global {
};
}
-/** These are like 40kb that not every user needs */
-const PhoneInput = dynamic(
- () => import("@components/ui/form/PhoneInput")
-) as unknown as typeof PhoneInputType;
-
type BookingPageProps = (BookPageProps | TeamBookingPageProps | HashLinkPageProps) & {
locationLabels: Record<LocationType, string>;
};
diff --git a/apps/web/components/dialog/EditLocationDialog.tsx b/apps/web/components/dialog/EditLocationDialog.tsx
index b768086af28..04d9d9e846b 100644
--- a/apps/web/components/dialog/EditLocationDialog.tsx
+++ b/apps/web/components/dialog/EditLocationDialog.tsx
@@ -1,31 +1,25 @@
import { zodResolver } from "@hookform/resolvers/zod";
import { isValidPhoneNumber } from "libphonenumber-js";
-import dynamic from "next/dynamic";
import { useEffect } from "react";
import { Controller, useForm, useWatch } from "react-hook-form";
import { z } from "zod";
-import classNames from "@calcom/lib/classNames";
+import { LocationOptionsToString } from "@calcom/app-store/locations";
+import { LocationType } from "@calcom/core/location";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { inferQueryOutput, trpc } from "@calcom/trpc/react";
import { Button } from "@calcom/ui";
import { Dialog, DialogContent } from "@calcom/ui/Dialog";
import { Icon } from "@calcom/ui/Icon";
+import PhoneInput from "@calcom/ui/form/PhoneInputLazy";
import { Form } from "@calcom/ui/form/fields";
import { QueryCell } from "@lib/QueryCell";
import { linkValueToString } from "@lib/linkValueToString";
-import { LocationType } from "@lib/location";
-import { LocationOptionsToString } from "@lib/locationOptions";
import CheckboxField from "@components/ui/form/CheckboxField";
-import type PhoneInputType from "@components/ui/form/PhoneInput";
import Select from "@components/ui/form/Select";
-const PhoneInput = dynamic(
- () => import("@components/ui/form/PhoneInput")
-) as unknown as typeof PhoneInputType;
-
type BookingItem = inferQueryOutput<"viewer.bookings">["bookings"][number];
type OptionTypeBase = {
diff --git a/apps/web/components/eventtype/RecurringEventController.tsx b/apps/web/components/eventtype/RecurringEventController.tsx
index 3e90df32a60..73654773393 100644
--- a/apps/web/components/eventtype/RecurringEventController.tsx
+++ b/apps/web/components/eventtype/RecurringEventController.tsx
@@ -4,7 +4,7 @@ import { UseFormReturn } from "react-hook-form";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { Frequency } from "@calcom/prisma/zod-utils";
-import { RecurringEvent } from "@calcom/types/Calendar";
+import type { RecurringEvent } from "@calcom/types/Calendar";
import { Alert } from "@calcom/ui/Alert";
import Select from "@components/ui/form/Select";
diff --git a/apps/web/components/integrations/CalendarListContainer.tsx b/apps/web/components/integrations/CalendarListContainer.tsx
index d2864bf265b..2dd99a1310c 100644
--- a/apps/web/components/integrations/CalendarListContainer.tsx
+++ b/apps/web/components/integrations/CalendarListContainer.tsx
@@ -7,15 +7,15 @@ import showToast from "@calcom/lib/notification";
import { inferQueryOutput, trpc } from "@calcom/trpc/react";
import { Alert } from "@calcom/ui/Alert";
import Button from "@calcom/ui/Button";
+import { List } from "@calcom/ui/List";
+import { ShellSubHeading } from "@calcom/ui/Shell";
import Switch from "@calcom/ui/Switch";
+import SkeletonLoader from "@calcom/ui/apps/SkeletonLoader";
import { QueryCell } from "@lib/QueryCell";
import AdditionalCalendarSelector from "@components/AdditionalCalendarSelector";
import DestinationCalendarSelector from "@components/DestinationCalendarSelector";
-import { List } from "@components/List";
-import { ShellSubHeading } from "@components/Shell";
-import SkeletonLoader from "@components/apps/SkeletonLoader";
import DisconnectIntegration from "./DisconnectIntegration";
import IntegrationListItem from "./IntegrationListItem";
diff --git a/apps/web/components/integrations/DisconnectIntegration.tsx b/apps/web/components/integrations/DisconnectIntegration.tsx
index ec74fea0b2c..316e9325486 100644
--- a/apps/web/components/integrations/DisconnectIntegration.tsx
+++ b/apps/web/components/integrations/DisconnectIntegration.tsx
@@ -1,14 +1,12 @@
import { useState } from "react";
-import { useMutation } from "react-query";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import showToast from "@calcom/lib/notification";
import { trpc } from "@calcom/trpc/react";
import { ButtonBaseProps } from "@calcom/ui/Button";
+import ConfirmationDialogContent from "@calcom/ui/ConfirmationDialogContent";
import { Dialog } from "@calcom/ui/Dialog";
-import ConfirmationDialogContent from "@components/dialog/ConfirmationDialogContent";
-
export default function DisconnectIntegration(props: {
/** Integration credential id */
id: number;
diff --git a/apps/web/components/integrations/IntegrationListItem.tsx b/apps/web/components/integrations/IntegrationListItem.tsx
index 9333c747b9f..ca1cf525959 100644
--- a/apps/web/components/integrations/IntegrationListItem.tsx
+++ b/apps/web/components/integrations/IntegrationListItem.tsx
@@ -1,9 +1,9 @@
import Link from "next/link";
import { ReactNode } from "react";
-import classNames from "@lib/classNames";
+import { ListItem, ListItemText, ListItemTitle } from "@calcom/ui/List";
-import { ListItem, ListItemText, ListItemTitle } from "@components/List";
+import classNames from "@lib/classNames";
function IntegrationListItem(props: {
imageSrc?: string;
diff --git a/apps/web/components/integrations/SubHeadingTitleWithConnections.tsx b/apps/web/components/integrations/SubHeadingTitleWithConnections.tsx
index 80d120d3015..f6e083859d7 100644
--- a/apps/web/components/integrations/SubHeadingTitleWithConnections.tsx
+++ b/apps/web/components/integrations/SubHeadingTitleWithConnections.tsx
@@ -1,6 +1,6 @@
import { ReactNode } from "react";
-import Badge from "@components/ui/Badge";
+import Badge from "@calcom/ui/Badge";
function pluralize(opts: { num: number; plural: string; singular: string }) {
if (opts.num === 0) {
diff --git a/apps/web/components/security/DisableUserImpersonation.tsx b/apps/web/components/security/DisableUserImpersonation.tsx
index 79b1f297c4b..18269b3b135 100644
--- a/apps/web/components/security/DisableUserImpersonation.tsx
+++ b/apps/web/components/security/DisableUserImpersonation.tsx
@@ -1,10 +1,9 @@
import { useLocale } from "@calcom/lib/hooks/useLocale";
import showToast from "@calcom/lib/notification";
import { trpc } from "@calcom/trpc/react";
+import Badge from "@calcom/ui/Badge";
import Button from "@calcom/ui/Button";
-import Badge from "@components/ui/Badge";
-
const DisableUserImpersonation = ({ disableImpersonation }: { disableImpersonation: boolean }) => {
const utils = trpc.useContext();
diff --git a/apps/web/components/security/TwoFactorAuthSection.tsx b/apps/web/components/security/TwoFactorAuthSection.tsx
index b21273fdd68..4a2b03325ee 100644
--- a/apps/web/components/security/TwoFactorAuthSection.tsx
+++ b/apps/web/components/security/TwoFactorAuthSection.tsx
@@ -1,11 +1,10 @@
import { useState } from "react";
+import Badge from "@calcom/ui/Badge";
import Button from "@calcom/ui/Button";
import { useLocale } from "@lib/hooks/useLocale";
-import Badge from "@components/ui/Badge";
-
import DisableTwoFactorModal from "./DisableTwoFactorModal";
import EnableTwoFactorModal from "./EnableTwoFactorModal";
diff --git a/apps/web/components/team/DisableTeamImpersonation.tsx b/apps/web/components/team/DisableTeamImpersonation.tsx
index d1b75b5f7c9..c88cf569bf9 100644
--- a/apps/web/components/team/DisableTeamImpersonation.tsx
+++ b/apps/web/components/team/DisableTeamImpersonation.tsx
@@ -1,10 +1,9 @@
import { useLocale } from "@calcom/lib/hooks/useLocale";
import showToast from "@calcom/lib/notification";
import { trpc } from "@calcom/trpc/react";
+import Badge from "@calcom/ui/Badge";
import Button from "@calcom/ui/Button";
-import Badge from "@components/ui/Badge";
-
const DisableTeamImpersonation = ({ teamId, memberId }: { teamId: number; memberId: number }) => {
const { t } = useLocale();
diff --git a/apps/web/components/team/MemberListItem.tsx b/apps/web/components/team/MemberListItem.tsx
index 4849c2ec9af..850b4a6f9b1 100644
--- a/apps/web/components/team/MemberListItem.tsx
+++ b/apps/web/components/team/MemberListItem.tsx
@@ -3,11 +3,13 @@ import { signIn } from "next-auth/react";
import Link from "next/link";
import { useState } from "react";
+import TeamAvailabilityModal from "@calcom/features/ee/teams/components/TeamAvailabilityModal";
import { WEBAPP_URL } from "@calcom/lib/constants";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import showToast from "@calcom/lib/notification";
import { inferQueryOutput, trpc } from "@calcom/trpc/react";
import Button from "@calcom/ui/Button";
+import ConfirmationDialogContent from "@calcom/ui/ConfirmationDialogContent";
import { Dialog, DialogTrigger } from "@calcom/ui/Dialog";
import Dropdown, {
DropdownMenuContent,
@@ -17,11 +19,9 @@ import Dropdown, {
} from "@calcom/ui/Dropdown";
import { Icon } from "@calcom/ui/Icon";
import { Tooltip } from "@calcom/ui/Tooltip";
-import TeamAvailabilityModal from "@ee/components/team/availability/TeamAvailabilityModal";
import useCurrentUserId from "@lib/hooks/useCurrentUserId";
-import ConfirmationDialogContent from "@components/dialog/ConfirmationDialogContent";
import Avatar from "@components/ui/Avatar";
import ModalContainer from "@components/ui/ModalContainer";
diff --git a/apps/web/components/team/SkeletonloaderTeamList.tsx b/apps/web/components/team/SkeletonloaderTeamList.tsx
index 137b1be84bd..8acb96d9445 100644
--- a/apps/web/components/team/SkeletonloaderTeamList.tsx
+++ b/apps/web/components/team/SkeletonloaderTeamList.tsx
@@ -1,10 +1,6 @@
-import React from "react";
-
import { SkeletonText } from "@calcom/ui";
-import { ShellSubHeading } from "@components/Shell";
-
-function SkeletonLoaderTeamList({ className }: { className?: string }) {
+function SkeletonLoaderTeamList() {
return (
<>
<ul className="-mx-4 animate-pulse divide-y divide-neutral-200 rounded-sm border border-gray-200 bg-white sm:mx-0 sm:overflow-hidden">
diff --git a/apps/web/components/team/TeamListItem.tsx b/apps/web/components/team/TeamListItem.tsx
index 65b6e74546a..ec5bd393d29 100644
--- a/apps/web/components/team/TeamListItem.tsx
+++ b/apps/web/components/team/TeamListItem.tsx
@@ -1,10 +1,13 @@
import { MembershipRole } from "@prisma/client";
import Link from "next/link";
+import classNames from "@calcom/lib/classNames";
+import { getPlaceholderAvatar } from "@calcom/lib/getPlaceholderAvatar";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import showToast from "@calcom/lib/notification";
import { inferQueryOutput, trpc } from "@calcom/trpc/react";
import Button from "@calcom/ui/Button";
+import ConfirmationDialogContent from "@calcom/ui/ConfirmationDialogContent";
import { Dialog, DialogTrigger } from "@calcom/ui/Dialog";
import Dropdown, {
DropdownMenuContent,
@@ -15,10 +18,6 @@ import Dropdown, {
import { Icon } from "@calcom/ui/Icon";
import { Tooltip } from "@calcom/ui/Tooltip";
-import classNames from "@lib/classNames";
-import { getPlaceholderAvatar } from "@lib/getPlaceholderAvatar";
-
-import ConfirmationDialogContent from "@components/dialog/ConfirmationDialogContent";
import Avatar from "@components/ui/Avatar";
import { TeamRole } from "./TeamPill";
diff --git a/apps/web/components/team/TeamSettingsRightSidebar.tsx b/apps/web/components/team/TeamSettingsRightSidebar.tsx
index cc6680c7b42..796018ee051 100644
--- a/apps/web/components/team/TeamSettingsRightSidebar.tsx
+++ b/apps/web/components/team/TeamSettingsRightSidebar.tsx
@@ -6,12 +6,12 @@ import React from "react";
import showToast from "@calcom/lib/notification";
import { TeamWithMembers } from "@calcom/lib/server/queries/teams";
import { trpc } from "@calcom/trpc/react";
+import ConfirmationDialogContent from "@calcom/ui/ConfirmationDialogContent";
import { Dialog, DialogTrigger } from "@calcom/ui/Dialog";
import { Icon } from "@calcom/ui/Icon";
import { useLocale } from "@lib/hooks/useLocale";
-import ConfirmationDialogContent from "@components/dialog/ConfirmationDialogContent";
import CreateEventTypeButton from "@components/eventtype/CreateEventType";
import LinkIconButton from "@components/ui/LinkIconButton";
diff --git a/apps/web/components/ui/form/Select.tsx b/apps/web/components/ui/form/Select.tsx
index afb78522615..dc24ed098fa 100644
--- a/apps/web/components/ui/form/Select.tsx
+++ b/apps/web/components/ui/form/Select.tsx
@@ -1,8 +1,8 @@
import React, { useCallback, useEffect, useState } from "react";
import ReactSelect, { components, GroupBase, Props, InputProps, SingleValue, MultiValue } from "react-select";
-import classNames from "@lib/classNames";
-import useTheme from "@lib/hooks/useTheme";
+import classNames from "@calcom/lib/classNames";
+import useTheme from "@calcom/lib/hooks/useTheme";
export type SelectProps<
Option,
diff --git a/apps/web/components/webhook/WebhookListContainer.tsx b/apps/web/components/webhook/WebhookListContainer.tsx
index 5bd926454f9..bff378415f0 100644
--- a/apps/web/components/webhook/WebhookListContainer.tsx
+++ b/apps/web/components/webhook/WebhookListContainer.tsx
@@ -4,12 +4,12 @@ import { trpc } from "@calcom/trpc/react";
import Button from "@calcom/ui/Button";
import { Dialog, DialogContent } from "@calcom/ui/Dialog";
import { Icon } from "@calcom/ui/Icon";
+import { List } from "@calcom/ui/List";
+import { ShellSubHeading } from "@calcom/ui/Shell";
+import SkeletonLoader from "@calcom/ui/apps/SkeletonLoader";
import { QueryCell } from "@lib/QueryCell";
-import { List } from "@components/List";
-import { ShellSubHeading } from "@components/Shell";
-import SkeletonLoader from "@components/apps/SkeletonLoader";
import WebhookDialogForm from "@components/webhook/WebhookDialogForm";
import WebhookListItem, { TWebhook } from "@components/webhook/WebhookListItem";
diff --git a/apps/web/components/webhook/WebhookListItem.tsx b/apps/web/components/webhook/WebhookListItem.tsx
index 6088621ec0c..1b842ce8b02 100644
--- a/apps/web/components/webhook/WebhookListItem.tsx
+++ b/apps/web/components/webhook/WebhookListItem.tsx
@@ -1,15 +1,14 @@
import classNames from "@calcom/lib/classNames";
import { inferQueryOutput, trpc } from "@calcom/trpc/react";
import Button from "@calcom/ui/Button";
+import ConfirmationDialogContent from "@calcom/ui/ConfirmationDialogContent";
import { Dialog, DialogTrigger } from "@calcom/ui/Dialog";
import { Icon } from "@calcom/ui/Icon";
+import { ListItem } from "@calcom/ui/List";
import { Tooltip } from "@calcom/ui/Tooltip";
import { useLocale } from "@lib/hooks/useLocale";
-import { ListItem } from "@components/List";
-import ConfirmationDialogContent from "@components/dialog/ConfirmationDialogContent";
-
export type TWebhook = inferQueryOutput<"viewer.webhook.list">[number];
export default function WebhookListItem(props: { webhook: TWebhook; onEditWebhook: () => void }) {
diff --git a/apps/web/ee/LICENSE b/apps/web/ee/LICENSE
deleted file mode 100644
index 1f8841cbc2d..00000000000
--- a/apps/web/ee/LICENSE
+++ /dev/null
@@ -1,42 +0,0 @@
-The Cal.com Enterprise Edition (EE) license (the “EE License”)
-Copyright (c) 2020-present Cal.com, Inc
-
-With regard to the Cal.com Software:
-
-This software and associated documentation files (the "Software") may only be
-used in production, if you (and any entity that you represent) have agreed to,
-and are in compliance with, the Cal.com Subscription Terms available
-at https://cal.com/terms (the “EE Terms”), or other agreements governing
-the use of the Software, as mutually agreed by you and Cal.com, Inc ("Cal.com"),
-and otherwise have a valid Cal.com Enterprise Edition subscription ("EE Subscription")
-for the correct number of hosts as defined in the EE Terms ("Hosts"). Subject to the foregoing sentence,
-you are free to modify this Software and publish patches to the Software. You agree
-that Cal.com and/or its licensors (as applicable) retain all right, title and interest in
-and to all such modifications and/or patches, and all such modifications and/or
-patches may only be used, copied, modified, displayed, distributed, or otherwise
-exploited with a valid EE Subscription for the correct number of hosts.
-Notwithstanding the foregoing, you may copy and modify the Software for development
-and testing purposes, without requiring a subscription. You agree that Cal.com and/or
-its licensors (as applicable) retain all right, title and interest in and to all such
-modifications. You are not granted any other rights beyond what is expressly stated herein.
-Subject to the foregoing, it is forbidden to copy, merge, publish, distribute, sublicense,
-and/or sell the Software.
-
-This EE License applies only to the part of this Software that is not distributed under
-the AGPLv3 license. Any part of this Software distributed under the AGPLv3 license or which
-is served client-side as an image, font, cascading stylesheet (CSS), file which produces
-or is compiled, arranged, augmented, or combined into client-side JavaScript, in whole or
-in part, is copyrighted under the AGPLv3 license. The full text of this EE License shall
-be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
-For all third party components incorporated into the Cal.com Software, those
-components are licensed under the original license provided by the owner of the
-applicable component.
diff --git a/apps/web/ee/README.md b/apps/web/ee/README.md
deleted file mode 100644
index d5af7e20d8d..00000000000
--- a/apps/web/ee/README.md
+++ /dev/null
@@ -1,38 +0,0 @@
-<!-- PROJECT LOGO -->
-<div align="center">
- <a href="https://cal.com/enterprise">
- <img src="https://user-images.githubusercontent.com/8019099/133430653-24422d2a-3c8d-4052-9ad6-0580597151ee.png" alt="Logo">
- </a>
-
- <a href="https://cal.com/enterprise">Get Started with Enterprise</a>
-</div>
-
-# Enterprise Edition
-
-Welcome to the Enterprise Edition ("/ee") of Cal.com.
-
-The [/ee](https://github.com/calcom/cal.com/tree/main/apps/web/ee) subfolder is the place for all the **Pro** features from our [hosted](https://cal.com/pricing) plan and [enterprise-grade](https://cal.com/enterprise) features such as SSO, SAML, ADFS, OIDC, SCIM, SIEM, HRIS and much more.
-
-> _❗ WARNING: This repository is copyrighted (unlike our [main repo](https://github.com/calcom/cal.com)). You are not allowed to use this code to host your own version of app.cal.com without obtaining a proper [license](https://cal.com/enterprise) first❗_
-
-## Setting up Stripe
-
-1. Create a stripe account or use an existing one. For testing, you should use all stripe dashboard functions with the Test-Mode toggle in the top right activated.
-2. Open [Stripe ApiKeys](https://dashboard.stripe.com/apikeys) save the token starting with `pk_...` to `NEXT_PUBLIC_STRIPE_PUBLIC_KEY` and `sk_...` to `STRIPE_PRIVATE_KEY` in the .env file.
-3. Open [Stripe Connect Settings](https://dashboard.stripe.com/settings/connect) and activate OAuth for Standard Accounts
-4. Add `<CALENDSO URL>/api/integrations/stripepayment/callback` as redirect URL.
-5. Copy your client*id (`ca*...`) to `STRIPE_CLIENT_ID` in the .env file.
-6. Open [Stripe Webhooks](https://dashboard.stripe.com/webhooks) and add `<CALENDSO URL>/api/integrations/stripepayment/webhook` as webhook for connected applications.
-7. Select all `payment_intent` events for the webhook.
-8. Copy the webhook secret (`whsec_...`) to `STRIPE_WEBHOOK_SECRET` in the .env file.
-
-## Setting up SAML login
-
-1. Set SAML_DATABASE_URL to a postgres database. Please use a different database than the main Cal instance since the migrations are separate for this database. For example `postgresql://postgres:@localhost:5450/cal-saml`
-2. Set SAML_ADMINS to a comma separated list of admin emails from where the SAML metadata can be uploaded and configured.
-3. Create a SAML application with your Identity Provider (IdP) using the instructions here - [SAML Setup](../docs/saml-setup.md)
-4. Remember to configure access to the IdP SAML app for all your users (who need access to Cal).
-5. You will need the XML metadata from your IdP later, so keep it accessible.
-6. Log in to one of the admin accounts configured in SAML_ADMINS and then navigate to Settings -> Security.
-7. You should see a SAML configuration section, copy and paste the XML metadata from step 5 and click on Save.
-8. Your provisioned users can now log into Cal using SAML.
diff --git a/apps/web/ee/components/support/ContactMenuItem.tsx b/apps/web/ee/components/support/ContactMenuItem.tsx
deleted file mode 100644
index 15ae451c54b..00000000000
--- a/apps/web/ee/components/support/ContactMenuItem.tsx
+++ /dev/null
@@ -1,13 +0,0 @@
-import HelpscoutMenuItem from "@ee/lib/helpscout/HelpscoutMenuItem";
-import IntercomMenuItem from "@ee/lib/intercom/IntercomMenuItem";
-import ZendeskMenuItem from "@ee/lib/zendesk/ZendeskMenuItem";
-
-export default function HelpMenuItem() {
- return (
- <>
- <IntercomMenuItem />
- <ZendeskMenuItem />
- <HelpscoutMenuItem />
- </>
- );
-}
diff --git a/apps/web/lib/QueryCell.tsx b/apps/web/lib/QueryCell.tsx
index b1ee6fa588f..7259feebce9 100644
--- a/apps/web/lib/QueryCell.tsx
+++ b/apps/web/lib/QueryCell.tsx
@@ -9,8 +9,8 @@ import {
} from "react-query";
import type { TRPCClientErrorLike } from "@calcom/trpc/client";
-import { trpc } from "@calcom/trpc/react";
import type { UseTRPCQueryOptions } from "@calcom/trpc/react";
+import { trpc } from "@calcom/trpc/react";
import type {
inferHandlerInput,
inferProcedureInput,
@@ -19,8 +19,7 @@ import type {
} from "@calcom/trpc/server";
import type { AppRouter } from "@calcom/trpc/server/routers/_app";
import { Alert } from "@calcom/ui/Alert";
-
-import Loader from "@components/Loader";
+import Loader from "@calcom/ui/Loader";
type ErrorLike = {
message: string;
diff --git a/apps/web/lib/app-providers.tsx b/apps/web/lib/app-providers.tsx
index 02678923edb..8db171261af 100644
--- a/apps/web/lib/app-providers.tsx
+++ b/apps/web/lib/app-providers.tsx
@@ -1,12 +1,15 @@
import { SessionProvider } from "next-auth/react";
+import { EventCollectionProvider } from "next-collect/client";
import { appWithTranslation } from "next-i18next";
+import { ThemeProvider } from "next-themes";
import type { AppProps as NextAppProps, AppProps as NextJsAppProps } from "next/app";
import { NextRouter } from "next/router";
import { ComponentProps, ReactNode } from "react";
+import DynamicHelpscoutProvider from "@calcom/features/ee/support/lib/helpscout/providerDynamic";
+import DynamicIntercomProvider from "@calcom/features/ee/support/lib/intercom/providerDynamic";
+import { ContractsProvider } from "@calcom/features/ee/web3/contexts/contractsContext";
import { trpc } from "@calcom/trpc/react";
-import DynamicHelpscoutProvider from "@ee/lib/helpscout/providerDynamic";
-import DynamicIntercomProvider from "@ee/lib/intercom/providerDynamic";
import usePublicPage from "@lib/hooks/usePublicPage";
@@ -52,10 +55,34 @@ const AppProviders = (props: AppPropsWithChildren) => {
const session = trpc.useQuery(["viewer.public.session"]).data;
// No need to have intercom on public pages - Good for Page Performance
const isPublicPage = usePublicPage();
+ const isThemeSupported =
+ typeof props.Component.isThemeSupported === "function"
+ ? props.Component.isThemeSupported({ router: props.router })
+ : props.Component.isThemeSupported;
+ const forcedTheme = isThemeSupported ? undefined : "light";
+ // Use namespace of embed to ensure same namespaced embed are displayed with same theme. This allows different embeds on the same website to be themed differently
+ // One such example is our Embeds Demo and Testing page at http://localhost:3100
+ // Having `getEmbedNamespace` defined on window before react initializes the app, ensures that embedNamespace is available on the first mount and can be used as part of storageKey
+ const embedNamespace = typeof window !== "undefined" ? window.getEmbedNamespace() : null;
+ const storageKey = typeof embedNamespace === "string" ? `embed-theme-${embedNamespace}` : "theme";
+
const RemainingProviders = (
- <SessionProvider session={session || undefined}>
- <CustomI18nextProvider {...props}>{props.children}</CustomI18nextProvider>
- </SessionProvider>
+ <EventCollectionProvider options={{ apiPath: "/api/collect-events" }}>
+ <ContractsProvider>
+ <SessionProvider session={session || undefined}>
+ <CustomI18nextProvider {...props}>
+ {/* color-scheme makes background:transparent not work which is required by embed. We need to ensure next-theme adds color-scheme to `body` instead of `html`(https://github.com/pacocoursey/next-themes/blob/main/src/index.tsx#L74). Once that's done we can enable color-scheme support */}
+ <ThemeProvider
+ enableColorScheme={false}
+ storageKey={storageKey}
+ forcedTheme={forcedTheme}
+ attribute="class">
+ {props.children}
+ </ThemeProvider>
+ </CustomI18nextProvider>
+ </SessionProvider>
+ </ContractsProvider>
+ </EventCollectionProvider>
);
if (isPublicPage) {
diff --git a/apps/web/lib/asStringOrNull.tsx b/apps/web/lib/asStringOrNull.tsx
index 2d7bb94b6e3..564075cd853 100644
--- a/apps/web/lib/asStringOrNull.tsx
+++ b/apps/web/lib/asStringOrNull.tsx
@@ -1,19 +1,24 @@
+/** @deprecated use zod instead */
export function asStringOrNull(str: unknown) {
return typeof str === "string" ? str : null;
}
+/** @deprecated use zod instead */
export function asStringOrUndefined(str: unknown) {
return typeof str === "string" ? str : undefined;
}
+/** @deprecated use zod instead */
export function asNumberOrUndefined(str: unknown) {
return typeof str === "string" ? parseInt(str) : undefined;
}
+/** @deprecated use zod instead */
export function asNumberOrThrow(str: unknown) {
return parseInt(asStringOrThrow(str));
}
+/** @deprecated use zod instead */
export function asStringOrThrow(str: unknown): string {
if (typeof str !== "string") {
throw new Error(`Expected "string" - got ${typeof str}`);
diff --git a/apps/web/lib/clock.ts b/apps/web/lib/clock.ts
index 12e79559883..1fd0b42273b 100644
--- a/apps/web/lib/clock.ts
+++ b/apps/web/lib/clock.ts
@@ -1,9 +1,8 @@
// handles logic related to user clock display using 24h display / timeZone options.
import dayjs from "@calcom/dayjs";
+import { isBrowserLocale24h } from "@calcom/lib/timeFormat";
import { localStorage } from "@calcom/lib/webstorage";
-import { isBrowserLocale24h } from "./timeFormat";
-
interface TimeOptions {
is24hClock: boolean;
inviteeTimeZone: string;
diff --git a/apps/web/lib/core/i18n/i18n.utils.ts b/apps/web/lib/core/i18n/i18n.utils.ts
index 9899a5654e6..7b4098c6c75 100644
--- a/apps/web/lib/core/i18n/i18n.utils.ts
+++ b/apps/web/lib/core/i18n/i18n.utils.ts
@@ -1,10 +1,10 @@
import parser from "accept-language-parser";
import { IncomingMessage } from "http";
+import prisma from "@calcom/prisma";
import { Maybe } from "@calcom/trpc/server";
import { getSession } from "@lib/auth";
-import prisma from "@lib/prisma";
import { i18n } from "../../../next-i18next.config";
diff --git a/apps/web/lib/getting-started.tsx b/apps/web/lib/getting-started.tsx
deleted file mode 100644
index 8da6333da63..00000000000
--- a/apps/web/lib/getting-started.tsx
+++ /dev/null
@@ -1,16 +0,0 @@
-import { User } from "@prisma/client";
-
-import dayjs from "@calcom/dayjs";
-
-export const ONBOARDING_INTRODUCED_AT = dayjs("September 1 2021").toISOString();
-
-export const ONBOARDING_NEXT_REDIRECT = {
- redirect: {
- permanent: false,
- destination: "/getting-started",
- },
-} as const;
-
-export const shouldShowOnboarding = (user: Pick<User, "createdDate" | "completedOnboarding">) => {
- return !user.completedOnboarding && dayjs(user.createdDate).isAfter(ONBOARDING_INTRODUCED_AT);
-};
diff --git a/apps/web/lib/locationOptions.tsx b/apps/web/lib/locationOptions.tsx
deleted file mode 100644
index c9d96287fba..00000000000
--- a/apps/web/lib/locationOptions.tsx
+++ /dev/null
@@ -1,36 +0,0 @@
-import { TFunction } from "next-i18next";
-
-import { LocationType } from "./location";
-
-/**
- * Use this function for translating event location to a readable string
- * @param location
- * @param t
- * @returns string
- */
-export const LocationOptionsToString = (location: string, t: TFunction) => {
- switch (location) {
- case LocationType.InPerson:
- return t("set_address_place");
- case LocationType.Link:
- return t("set_link_meeting");
- case LocationType.Phone:
- return t("cal_invitee_phone_number_scheduling");
- case LocationType.GoogleMeet:
- return t("cal_provide_google_meet_location");
- case LocationType.Zoom:
- return t("cal_provide_zoom_meeting_url");
- case LocationType.Daily:
- return t("cal_provide_video_meeting_url");
- case LocationType.Jitsi:
- return t("cal_provide_jitsi_meeting_url");
- case LocationType.Huddle01:
- return t("cal_provide_huddle01_meeting_url");
- case LocationType.Tandem:
- return t("cal_provide_tandem_meeting_url");
- case LocationType.Teams:
- return t("cal_provide_teams_meeting_url");
- default:
- return null;
- }
-};
diff --git a/apps/web/lib/parseDate.ts b/apps/web/lib/parseDate.ts
index 4d068fe427c..5aaaef5bad8 100644
--- a/apps/web/lib/parseDate.ts
+++ b/apps/web/lib/parseDate.ts
@@ -2,10 +2,9 @@ import { I18n } from "next-i18next";
import { RRule } from "rrule";
import dayjs, { Dayjs } from "@calcom/dayjs";
+import { detectBrowserTimeFormat } from "@calcom/lib/timeFormat";
import { inferQueryOutput } from "@calcom/trpc/react";
-import { RecurringEvent } from "@calcom/types/Calendar";
-
-import { detectBrowserTimeFormat } from "@lib/timeFormat";
+import type { RecurringEvent } from "@calcom/types/Calendar";
import { parseZone } from "./parseZone";
diff --git a/apps/web/lib/webhooks/subscriptions.tsx b/apps/web/lib/webhooks/subscriptions.tsx
index a6a5a5ae8b2..67fd8f53dbd 100644
--- a/apps/web/lib/webhooks/subscriptions.tsx
+++ b/apps/web/lib/webhooks/subscriptions.tsx
@@ -1,6 +1,6 @@
import { WebhookTriggerEvents } from "@prisma/client";
-import prisma from "@lib/prisma";
+import prisma from "@calcom/prisma";
export type GetSubscriberOptions = {
userId: number;
diff --git a/apps/web/middleware.ts b/apps/web/middleware.ts
index c65abfa4edc..fb36ee41826 100644
--- a/apps/web/middleware.ts
+++ b/apps/web/middleware.ts
@@ -1,6 +1,6 @@
import { collectEvents } from "next-collect/server";
-import { extendEventData, nextCollectBasicSettings } from "@lib/telemetry";
+import { extendEventData, nextCollectBasicSettings } from "@calcom/lib/telemetry";
export default collectEvents({
...nextCollectBasicSettings,
diff --git a/apps/web/next.config.js b/apps/web/next.config.js
index 19877bb2c6d..134501f7e8e 100644
--- a/apps/web/next.config.js
+++ b/apps/web/next.config.js
@@ -4,14 +4,13 @@ const withTM = require("next-transpile-modules")([
"@calcom/app-store",
"@calcom/core",
"@calcom/dayjs",
- "@calcom/ee",
"@calcom/emails",
"@calcom/embed-core",
"@calcom/embed-react",
"@calcom/embed-snippet",
+ "@calcom/features",
"@calcom/lib",
"@calcom/prisma",
- "@calcom/stripe",
"@calcom/trpc",
"@calcom/ui",
]);
diff --git a/apps/web/package.json b/apps/web/package.json
index 2f609a5dc24..4ffef0c00ce 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -28,17 +28,16 @@
},
"dependencies": {
"@boxyhq/saml-jackson": "0.3.6",
- "@calcom/app-store-cli": "*",
"@calcom/app-store": "*",
+ "@calcom/app-store-cli": "*",
"@calcom/core": "*",
"@calcom/dayjs": "*",
- "@calcom/ee": "*",
+ "@calcom/features": "*",
"@calcom/embed-core": "*",
"@calcom/embed-react": "*",
"@calcom/embed-snippet": "*",
"@calcom/lib": "*",
"@calcom/prisma": "*",
- "@calcom/stripe": "*",
"@calcom/trpc": "*",
"@calcom/tsconfig": "*",
"@calcom/ui": "*",
@@ -46,7 +45,7 @@
"@glidejs/glide": "^3.5.2",
"@heroicons/react": "^1.0.6",
"@hookform/error-message": "^2.0.0",
- "@hookform/resolvers": "^2.8.9",
+ "@hookform/resolvers": "^2.9.7",
"@metamask/providers": "^8.1.1",
"@next-auth/prisma-adapter": "^1.0.3",
"@next/bundle-analyzer": "12.1.6",
diff --git a/apps/web/pages/[user].tsx b/apps/web/pages/[user].tsx
index a6083cba8aa..dd8a5b2f14c 100644
--- a/apps/web/pages/[user].tsx
+++ b/apps/web/pages/[user].tsx
@@ -14,6 +14,7 @@ import {
useEmbedStyles,
useIsEmbed,
} from "@calcom/embed-core/embed-iframe";
+import type { CryptoSectionProps } from "@calcom/features/ee/web3/components/CryptoSection";
import CustomBranding from "@calcom/lib/CustomBranding";
import defaultEvents, {
getDynamicEventDescription,
@@ -22,13 +23,13 @@ import defaultEvents, {
getUsernameSlugLink,
} from "@calcom/lib/defaultEvents";
import { useLocale } from "@calcom/lib/hooks/useLocale";
-import { baseEventTypeSelect } from "@calcom/prisma/selects/event-types";
+import useTheme from "@calcom/lib/hooks/useTheme";
+import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@calcom/lib/telemetry";
+import prisma from "@calcom/prisma";
+import { baseEventTypeSelect } from "@calcom/prisma/selects";
import { BadgeCheckIcon, Icon } from "@calcom/ui/Icon";
import { useExposePlanGlobally } from "@lib/hooks/useExposePlanGlobally";
-import useTheme from "@lib/hooks/useTheme";
-import prisma from "@lib/prisma";
-import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@lib/telemetry";
import { inferSSRProps } from "@lib/types/inferSSRProps";
import AvatarGroup from "@components/ui/AvatarGroup";
@@ -38,7 +39,9 @@ import { ssrInit } from "@server/lib/ssr";
const EventTypeDescription = dynamic(() => import("@components/eventtype/EventTypeDescription"));
const HeadSeo = dynamic(() => import("@components/seo/head-seo"));
-const CryptoSection = dynamic(() => import("../ee/components/web3/CryptoSection"));
+const CryptoSection = dynamic<CryptoSectionProps>(
+ () => import("@calcom/features/ee/web3/components/CryptoSection")
+);
interface EvtsToVerify {
[evtId: string]: boolean;
diff --git a/apps/web/pages/[user]/book.tsx b/apps/web/pages/[user]/book.tsx
index 2366f38210d..98570b8b688 100644
--- a/apps/web/pages/[user]/book.tsx
+++ b/apps/web/pages/[user]/book.tsx
@@ -11,10 +11,10 @@ import {
} from "@calcom/lib/defaultEvents";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { bookEventTypeSelect } from "@calcom/prisma";
+import prisma from "@calcom/prisma";
import { asStringOrNull, asStringOrThrow } from "@lib/asStringOrNull";
import getBooking, { GetBookingType } from "@lib/getBooking";
-import prisma from "@lib/prisma";
import { inferSSRProps } from "@lib/types/inferSSRProps";
import BookingPage from "@components/booking/pages/BookingPage";
diff --git a/apps/web/pages/_app.tsx b/apps/web/pages/_app.tsx
index 273faff1bdf..7cc4341a482 100644
--- a/apps/web/pages/_app.tsx
+++ b/apps/web/pages/_app.tsx
@@ -1,10 +1,9 @@
-import { EventCollectionProvider } from "next-collect/client";
import { DefaultSeo } from "next-seo";
-import { ThemeProvider } from "next-themes";
import Head from "next/head";
import superjson from "superjson";
import "@calcom/embed-core/src/embed-iframe";
+import LicenseRequired from "@calcom/features/ee/common/components/LicenseRequired";
import { httpBatchLink } from "@calcom/trpc/client/links/httpBatchLink";
import { httpLink } from "@calcom/trpc/client/links/httpLink";
import { loggerLink } from "@calcom/trpc/client/links/loggerLink";
@@ -13,14 +12,12 @@ import { withTRPC } from "@calcom/trpc/next";
import type { TRPCClientErrorLike } from "@calcom/trpc/react";
import { Maybe } from "@calcom/trpc/server";
import type { AppRouter } from "@calcom/trpc/server/routers/_app";
-import LicenseRequired from "@ee/components/LicenseRequired";
import AppProviders, { AppProps } from "@lib/app-providers";
import { seoConfig } from "@lib/config/next-seo.config";
import I18nLanguageHandler from "@components/I18nLanguageHandler";
-import { ContractsProvider } from "../contexts/contractsContext";
import "../styles/fonts.css";
import "../styles/globals.css";
@@ -32,50 +29,22 @@ function MyApp(props: AppProps) {
} else if (router.pathname === "/500") {
pageStatus = "500";
}
-
- let isThemeSupported = null;
-
- if (typeof Component.isThemeSupported === "function") {
- isThemeSupported = Component.isThemeSupported({ router });
- } else {
- isThemeSupported = Component.isThemeSupported;
- }
-
- const forcedTheme = isThemeSupported ? undefined : "light";
-
- // Use namespace of embed to ensure same namespaced embed are displayed with same theme. This allows different embeds on the same website to be themed differently
- // One such example is our Embeds Demo and Testing page at http://localhost:3100
- // Having `getEmbedNamespace` defined on window before react initializes the app, ensures that embedNamespace is available on the first mount and can be used as part of storageKey
- const embedNamespace = typeof window !== "undefined" ? window.getEmbedNamespace() : null;
- const storageKey = typeof embedNamespace === "string" ? `embed-theme-${embedNamespace}` : "theme";
-
return (
- <EventCollectionProvider options={{ apiPath: "/api/collect-events" }}>
- <ContractsProvider>
- <AppProviders {...props}>
- <DefaultSeo {...seoConfig.defaultNextSeo} />
- <I18nLanguageHandler />
- <Head>
- <script dangerouslySetInnerHTML={{ __html: `window.CalComPageStatus = '${pageStatus}'` }} />
- <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
- </Head>
- {/* color-scheme makes background:transparent not work which is required by embed. We need to ensure next-theme adds color-scheme to `body` instead of `html`(https://github.com/pacocoursey/next-themes/blob/main/src/index.tsx#L74). Once that's done we can enable color-scheme support */}
- <ThemeProvider
- enableColorScheme={false}
- storageKey={storageKey}
- forcedTheme={forcedTheme}
- attribute="class">
- {Component.requiresLicense ? (
- <LicenseRequired>
- <Component {...pageProps} err={err} />
- </LicenseRequired>
- ) : (
- <Component {...pageProps} err={err} />
- )}
- </ThemeProvider>
- </AppProviders>
- </ContractsProvider>
- </EventCollectionProvider>
+ <AppProviders {...props}>
+ <DefaultSeo {...seoConfig.defaultNextSeo} />
+ <I18nLanguageHandler />
+ <Head>
+ <script dangerouslySetInnerHTML={{ __html: `window.CalComPageStatus = '${pageStatus}'` }} />
+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
+ </Head>
+ {Component.requiresLicense ? (
+ <LicenseRequired>
+ <Component {...pageProps} err={err} />
+ </LicenseRequired>
+ ) : (
+ <Component {...pageProps} err={err} />
+ )}
+ </AppProviders>
);
}
diff --git a/apps/web/pages/api/auth/[...nextauth].tsx b/apps/web/pages/api/auth/[...nextauth].tsx
index 016bdaa520c..01d216d9c83 100644
--- a/apps/web/pages/api/auth/[...nextauth].tsx
+++ b/apps/web/pages/api/auth/[...nextauth].tsx
@@ -10,16 +10,16 @@ import nodemailer, { TransportOptions } from "nodemailer";
import { authenticator } from "otplib";
import path from "path";
-import checkLicense from "@calcom/ee/server/checkLicense";
+import checkLicense from "@calcom/features/ee/common/server/checkLicense";
+import ImpersonationProvider from "@calcom/features/ee/impersonation/lib/ImpersonationProvider";
import { WEBSITE_URL } from "@calcom/lib/constants";
import { symmetricDecrypt } from "@calcom/lib/crypto";
import { defaultCookies } from "@calcom/lib/default-cookies";
import { serverConfig } from "@calcom/lib/serverConfig";
-import ImpersonationProvider from "@ee/lib/impersonation/ImpersonationProvider";
+import prisma from "@calcom/prisma";
import { ErrorCode, verifyPassword } from "@lib/auth";
import CalComAdapter from "@lib/auth/next-auth-custom-adapter";
-import prisma from "@lib/prisma";
import { randomString } from "@lib/random";
import { hostedCal, isSAMLLoginEnabled, samlLoginUrl } from "@lib/saml";
import slugify from "@lib/slugify";
diff --git a/apps/web/pages/api/auth/changepw.ts b/apps/web/pages/api/auth/changepw.ts
index 1a0c7fe617c..525bc4e8bc8 100644
--- a/apps/web/pages/api/auth/changepw.ts
+++ b/apps/web/pages/api/auth/changepw.ts
@@ -1,8 +1,9 @@
import { IdentityProvider } from "@prisma/client";
import type { NextApiRequest, NextApiResponse } from "next";
+import prisma from "@calcom/prisma";
+
import { getSession } from "@lib/auth";
-import prisma from "@lib/prisma";
import { ErrorCode, hashPassword, verifyPassword } from "../../../lib/auth";
diff --git a/apps/web/pages/api/auth/reset-password.ts b/apps/web/pages/api/auth/reset-password.ts
index c401afd79f6..16db8d1fa03 100644
--- a/apps/web/pages/api/auth/reset-password.ts
+++ b/apps/web/pages/api/auth/reset-password.ts
@@ -1,7 +1,8 @@
import { NextApiRequest, NextApiResponse } from "next";
+import prisma from "@calcom/prisma";
+
import { hashPassword } from "@lib/auth";
-import prisma from "@lib/prisma";
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
if (req.method !== "POST") {
diff --git a/apps/web/pages/api/auth/signup.ts b/apps/web/pages/api/auth/signup.ts
index 8c107b785c8..cbc65fe4930 100644
--- a/apps/web/pages/api/auth/signup.ts
+++ b/apps/web/pages/api/auth/signup.ts
@@ -1,8 +1,9 @@
import { IdentityProvider } from "@prisma/client";
import { NextApiRequest, NextApiResponse } from "next";
+import prisma from "@calcom/prisma";
+
import { hashPassword } from "@lib/auth";
-import prisma from "@lib/prisma";
import slugify from "@lib/slugify";
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
diff --git a/apps/web/pages/api/auth/two-factor/totp/disable.ts b/apps/web/pages/api/auth/two-factor/totp/disable.ts
index f1595643d48..84ba99d9a6e 100644
--- a/apps/web/pages/api/auth/two-factor/totp/disable.ts
+++ b/apps/web/pages/api/auth/two-factor/totp/disable.ts
@@ -1,7 +1,8 @@
import { NextApiRequest, NextApiResponse } from "next";
+import prisma from "@calcom/prisma";
+
import { ErrorCode, getSession, verifyPassword } from "@lib/auth";
-import prisma from "@lib/prisma";
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
if (req.method !== "POST") {
diff --git a/apps/web/pages/api/auth/two-factor/totp/enable.ts b/apps/web/pages/api/auth/two-factor/totp/enable.ts
index 91aca8239a4..5a580a39cc3 100644
--- a/apps/web/pages/api/auth/two-factor/totp/enable.ts
+++ b/apps/web/pages/api/auth/two-factor/totp/enable.ts
@@ -2,9 +2,9 @@ import { NextApiRequest, NextApiResponse } from "next";
import { authenticator } from "otplib";
import { symmetricDecrypt } from "@calcom/lib/crypto";
+import prisma from "@calcom/prisma";
import { ErrorCode, getSession } from "@lib/auth";
-import prisma from "@lib/prisma";
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
if (req.method !== "POST") {
diff --git a/apps/web/pages/api/auth/two-factor/totp/setup.ts b/apps/web/pages/api/auth/two-factor/totp/setup.ts
index f785113d214..565c5c33911 100644
--- a/apps/web/pages/api/auth/two-factor/totp/setup.ts
+++ b/apps/web/pages/api/auth/two-factor/totp/setup.ts
@@ -4,9 +4,9 @@ import { authenticator } from "otplib";
import qrcode from "qrcode";
import { symmetricEncrypt } from "@calcom/lib/crypto";
+import prisma from "@calcom/prisma";
import { ErrorCode, getSession, verifyPassword } from "@lib/auth";
-import prisma from "@lib/prisma";
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
if (req.method !== "POST") {
diff --git a/apps/web/pages/api/availability/calendar.ts b/apps/web/pages/api/availability/calendar.ts
index 259dbd03df8..94a5309090b 100644
--- a/apps/web/pages/api/availability/calendar.ts
+++ b/apps/web/pages/api/availability/calendar.ts
@@ -2,9 +2,9 @@ import type { NextApiRequest, NextApiResponse } from "next";
import { getCalendarCredentials, getConnectedCalendars } from "@calcom/core/CalendarManager";
import notEmpty from "@calcom/lib/notEmpty";
+import prisma from "@calcom/prisma";
import { getSession } from "@lib/auth";
-import prisma from "@lib/prisma";
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const session = await getSession({ req });
diff --git a/apps/web/pages/api/book/confirm.ts b/apps/web/pages/api/book/confirm.ts
index 77fd3ff9252..fa8fde02568 100644
--- a/apps/web/pages/api/book/confirm.ts
+++ b/apps/web/pages/api/book/confirm.ts
@@ -2,15 +2,15 @@ import { Booking, BookingStatus, Prisma, SchedulingType, User } from "@prisma/cl
import type { NextApiRequest } from "next";
import { z } from "zod";
+import { refund } from "@calcom/app-store/stripepayment/lib/server";
import EventManager from "@calcom/core/EventManager";
import { sendDeclinedEmails, sendScheduledEmails } from "@calcom/emails";
+import { scheduleWorkflowReminders } from "@calcom/features/ee/workflows/lib/reminders/reminderScheduler";
import { isPrismaObjOrUndefined, parseRecurringEvent } from "@calcom/lib";
import logger from "@calcom/lib/logger";
import { defaultHandler, defaultResponder } from "@calcom/lib/server";
import prisma from "@calcom/prisma";
-import { refund } from "@calcom/stripe/server";
import type { AdditionalInformation, CalendarEvent } from "@calcom/types/Calendar";
-import { scheduleWorkflowReminders } from "@ee/lib/workflows/reminders/reminderScheduler";
import { getSession } from "@lib/auth";
import { HttpError } from "@lib/core/http/error";
diff --git a/apps/web/pages/api/book/event.ts b/apps/web/pages/api/book/event.ts
index 2ea3373d596..365670f533e 100644
--- a/apps/web/pages/api/book/event.ts
+++ b/apps/web/pages/api/book/event.ts
@@ -5,6 +5,7 @@ import rrule from "rrule";
import short from "short-uuid";
import { v5 as uuidv5 } from "uuid";
+import { handlePayment } from "@calcom/app-store/stripepayment/lib/server";
import EventManager from "@calcom/core/EventManager";
import { getUserAvailability } from "@calcom/core/getUserAvailability";
import dayjs from "@calcom/dayjs";
@@ -15,6 +16,8 @@ import {
sendScheduledEmails,
sendScheduledSeatsEmails,
} from "@calcom/emails";
+import verifyAccount from "@calcom/features/ee/web3/utils/verifyAccount";
+import { scheduleWorkflowReminders } from "@calcom/features/ee/workflows/lib/reminders/reminderScheduler";
import { getLuckyUsers, isPrismaObjOrUndefined, parseRecurringEvent } from "@calcom/lib";
import { getDefaultEvent, getGroupName, getUsernameList } from "@calcom/lib/defaultEvents";
import { getErrorFromUnknown } from "@calcom/lib/errors";
@@ -23,11 +26,9 @@ import logger from "@calcom/lib/logger";
import { defaultResponder } from "@calcom/lib/server";
import prisma, { userSelect } from "@calcom/prisma";
import { extendedBookingCreateBody } from "@calcom/prisma/zod-utils";
-import { handlePayment } from "@calcom/stripe/server";
import type { BufferedBusyTime } from "@calcom/types/BufferedBusyTime";
import type { AdditionalInformation, CalendarEvent } from "@calcom/types/Calendar";
import type { EventResult, PartialReference } from "@calcom/types/EventManager";
-import { scheduleWorkflowReminders } from "@ee/lib/workflows/reminders/reminderScheduler";
import { HttpError } from "@lib/core/http/error";
import { ensureArray } from "@lib/ensureArray";
@@ -37,8 +38,6 @@ import getSubscribers from "@lib/webhooks/subscriptions";
import { getTranslation } from "@server/lib/i18n";
-import verifyAccount from "../../../web3/utils/verifyAccount";
-
const translator = short();
const log = logger.getChildLogger({ prefix: ["[api] book:user"] });
diff --git a/apps/web/pages/api/book/request-reschedule.ts b/apps/web/pages/api/book/request-reschedule.ts
index b8ff512fefa..3d06b26aac5 100644
--- a/apps/web/pages/api/book/request-reschedule.ts
+++ b/apps/web/pages/api/book/request-reschedule.ts
@@ -20,9 +20,9 @@ import dayjs from "@calcom/dayjs";
import { sendRequestRescheduleEmail } from "@calcom/emails";
import { isPrismaObjOrUndefined } from "@calcom/lib";
import { getTranslation } from "@calcom/lib/server/i18n";
-import { CalendarEvent, Person } from "@calcom/types/Calendar";
+import prisma from "@calcom/prisma";
+import type { CalendarEvent, Person } from "@calcom/types/Calendar";
-import prisma from "@lib/prisma";
import sendPayload from "@lib/webhooks/sendPayload";
import getWebhooks from "@lib/webhooks/subscriptions";
diff --git a/apps/web/pages/api/cancel.ts b/apps/web/pages/api/cancel.ts
index 1ab17eff596..2a1b0ee1c14 100644
--- a/apps/web/pages/api/cancel.ts
+++ b/apps/web/pages/api/cancel.ts
@@ -1,29 +1,21 @@
-import {
- BookingStatus,
- Credential,
- Prisma,
- PrismaPromise,
- WebhookTriggerEvents,
- WorkflowMethods,
-} from "@prisma/client";
-import async from "async";
+import { BookingStatus, Prisma, PrismaPromise, WebhookTriggerEvents, WorkflowMethods } from "@prisma/client";
import { NextApiRequest, NextApiResponse } from "next";
import z from "zod";
import { getCalendar } from "@calcom/app-store/_utils/getCalendar";
import { FAKE_DAILY_CREDENTIAL } from "@calcom/app-store/dailyvideo/lib/VideoApiAdapter";
+import { refund } from "@calcom/app-store/stripepayment/lib/server";
import { deleteMeeting } from "@calcom/core/videoClient";
import dayjs from "@calcom/dayjs";
import { sendCancelledEmails } from "@calcom/emails";
+import { deleteScheduledEmailReminder } from "@calcom/features/ee/workflows/lib/reminders/emailReminderManager";
+import { sendCancelledReminders } from "@calcom/features/ee/workflows/lib/reminders/reminderScheduler";
+import { deleteScheduledSMSReminder } from "@calcom/features/ee/workflows/lib/reminders/smsReminderManager";
import { isPrismaObjOrUndefined, parseRecurringEvent } from "@calcom/lib";
import { HttpError } from "@calcom/lib/http-error";
import { defaultHandler, defaultResponder } from "@calcom/lib/server";
import prisma, { bookingMinimalSelect } from "@calcom/prisma";
-import { refund } from "@calcom/stripe/server";
import type { CalendarEvent } from "@calcom/types/Calendar";
-import { deleteScheduledEmailReminder } from "@ee/lib/workflows/reminders/emailReminderManager";
-import { sendCancelledReminders } from "@ee/lib/workflows/reminders/reminderScheduler";
-import { deleteScheduledSMSReminder } from "@ee/lib/workflows/reminders/smsReminderManager";
import { getSession } from "@lib/auth";
import sendPayload from "@lib/webhooks/sendPayload";
diff --git a/apps/web/pages/api/collect-events.ts b/apps/web/pages/api/collect-events.ts
index bbd95a475a3..79ae3b54551 100644
--- a/apps/web/pages/api/collect-events.ts
+++ b/apps/web/pages/api/collect-events.ts
@@ -1,6 +1,6 @@
import { nextEventsCollectApi } from "next-collect/server";
-import { extendEventData, nextCollectBasicSettings } from "@lib/telemetry";
+import { extendEventData, nextCollectBasicSettings } from "@calcom/lib/telemetry";
export default nextEventsCollectApi({
...nextCollectBasicSettings,
diff --git a/apps/web/pages/api/cron/workflows/scheduleEmailReminders.ts b/apps/web/pages/api/cron/workflows/scheduleEmailReminders.ts
index 5d8ca18a990..80821bbe5bd 100644
--- a/apps/web/pages/api/cron/workflows/scheduleEmailReminders.ts
+++ b/apps/web/pages/api/cron/workflows/scheduleEmailReminders.ts
@@ -1 +1 @@
-export { default } from "@ee/pages/api/cron/workflows/scheduleEmailReminders";
+export { default } from "@calcom/features/ee/workflows/api/scheduleEmailReminders";
diff --git a/apps/web/pages/api/cron/workflows/scheduleSMSReminders.ts b/apps/web/pages/api/cron/workflows/scheduleSMSReminders.ts
index 4b0679b04e3..891eaac11d5 100644
--- a/apps/web/pages/api/cron/workflows/scheduleSMSReminders.ts
+++ b/apps/web/pages/api/cron/workflows/scheduleSMSReminders.ts
@@ -1 +1 @@
-export { default } from "@ee/pages/api/cron/workflows/scheduleSMSReminders";
+export { default } from "@calcom/features/ee/workflows/api/scheduleSMSReminders";
diff --git a/apps/web/pages/api/event-type/index.ts b/apps/web/pages/api/event-type/index.ts
index a643af4fe5a..ea3bd0fe817 100644
--- a/apps/web/pages/api/event-type/index.ts
+++ b/apps/web/pages/api/event-type/index.ts
@@ -1,7 +1,8 @@
import type { NextApiRequest, NextApiResponse } from "next";
+import prisma from "@calcom/prisma";
+
import { getSession } from "@lib/auth";
-import prisma from "@lib/prisma";
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const session = await getSession({ req: req });
diff --git a/apps/web/pages/api/eventType.ts b/apps/web/pages/api/eventType.ts
index 4ab41d9b5b4..6b8f8f2e426 100644
--- a/apps/web/pages/api/eventType.ts
+++ b/apps/web/pages/api/eventType.ts
@@ -2,7 +2,7 @@ import { Prisma } from "@prisma/client";
import type { NextApiRequest, NextApiResponse } from "next";
import { getSession } from "next-auth/react";
-import prisma from "@lib/prisma";
+import prisma from "@calcom/prisma";
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const session = await getSession({ req: req });
diff --git a/apps/web/pages/api/integrations.ts b/apps/web/pages/api/integrations.ts
index dbe806369e5..c947688cc5f 100644
--- a/apps/web/pages/api/integrations.ts
+++ b/apps/web/pages/api/integrations.ts
@@ -1,8 +1,9 @@
import { BookingStatus, Prisma } from "@prisma/client";
import type { NextApiRequest, NextApiResponse } from "next";
+import prisma from "@calcom/prisma";
+
import { getSession } from "@lib/auth";
-import prisma from "@lib/prisma";
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
if (!["GET", "DELETE"].includes(req.method || "")) {
diff --git a/apps/web/pages/api/integrations/stripepayment/webhook.ts b/apps/web/pages/api/integrations/stripepayment/webhook.ts
index 5c37a033ac6..cdb8619513e 100644
--- a/apps/web/pages/api/integrations/stripepayment/webhook.ts
+++ b/apps/web/pages/api/integrations/stripepayment/webhook.ts
@@ -1 +1 @@
-export { default, config } from "@ee/pages/api/integrations/stripepayment/webhook";
+export { default, config } from "@calcom/features/ee/payments/api/webhook";
diff --git a/apps/web/pages/api/me.ts b/apps/web/pages/api/me.ts
index bf33f248f78..b9f41aa133c 100644
--- a/apps/web/pages/api/me.ts
+++ b/apps/web/pages/api/me.ts
@@ -1,7 +1,8 @@
import type { NextApiRequest, NextApiResponse } from "next";
+import prisma from "@calcom/prisma";
+
import { getSession } from "@lib/auth";
-import prisma from "@lib/prisma";
import { defaultAvatarSrc } from "@lib/profile";
/**
diff --git a/apps/web/pages/api/schedule/index.ts b/apps/web/pages/api/schedule/index.ts
index 830ff036359..69df404525b 100644
--- a/apps/web/pages/api/schedule/index.ts
+++ b/apps/web/pages/api/schedule/index.ts
@@ -1,8 +1,9 @@
import type { NextApiRequest, NextApiResponse } from "next";
+import prisma from "@calcom/prisma";
+
import { getSession } from "@lib/auth";
import { getAvailabilityFromSchedule } from "@lib/availability";
-import prisma from "@lib/prisma";
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const session = await getSession({ req });
diff --git a/apps/web/pages/api/teams.ts b/apps/web/pages/api/teams.ts
index c06814c0173..9cdc9eb33f8 100644
--- a/apps/web/pages/api/teams.ts
+++ b/apps/web/pages/api/teams.ts
@@ -1,7 +1,8 @@
import type { NextApiRequest, NextApiResponse } from "next";
+import prisma from "@calcom/prisma";
+
import { getSession } from "@lib/auth";
-import prisma from "@lib/prisma";
import slugify from "@lib/slugify";
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
diff --git a/apps/web/pages/api/teams/[team]/index.ts b/apps/web/pages/api/teams/[team]/index.ts
index e576069c134..26722fa701e 100644
--- a/apps/web/pages/api/teams/[team]/index.ts
+++ b/apps/web/pages/api/teams/[team]/index.ts
@@ -1,9 +1,9 @@
import type { NextApiRequest, NextApiResponse } from "next";
import { getTeamWithMembers } from "@calcom/lib/server/queries/teams";
+import prisma from "@calcom/prisma";
import { getSession } from "@lib/auth";
-import prisma from "@lib/prisma";
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const session = await getSession({ req: req });
diff --git a/apps/web/pages/api/teams/[team]/invite.ts b/apps/web/pages/api/teams/[team]/invite.ts
index a0a60d44bfb..3fce9765ae6 100644
--- a/apps/web/pages/api/teams/[team]/invite.ts
+++ b/apps/web/pages/api/teams/[team]/invite.ts
@@ -3,10 +3,10 @@ import { randomBytes } from "crypto";
import type { NextApiRequest, NextApiResponse } from "next";
import { sendTeamInviteEmail } from "@calcom/emails";
+import prisma from "@calcom/prisma";
import { getSession } from "@lib/auth";
import { BASE_URL } from "@lib/config/constants";
-import prisma from "@lib/prisma";
import slugify from "@lib/slugify";
import { getTranslation } from "@server/lib/i18n";
diff --git a/apps/web/pages/api/teams/[team]/membership.ts b/apps/web/pages/api/teams/[team]/membership.ts
index 0f3f5864020..31247c1b572 100644
--- a/apps/web/pages/api/teams/[team]/membership.ts
+++ b/apps/web/pages/api/teams/[team]/membership.ts
@@ -1,7 +1,8 @@
import type { NextApiRequest, NextApiResponse } from "next";
+import prisma from "@calcom/prisma";
+
import { getSession } from "@lib/auth";
-import prisma from "@lib/prisma";
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const session = await getSession({ req });
diff --git a/apps/web/pages/api/teams/[team]/profile.ts b/apps/web/pages/api/teams/[team]/profile.ts
index ac1420ef54f..34b0f6192b0 100644
--- a/apps/web/pages/api/teams/[team]/profile.ts
+++ b/apps/web/pages/api/teams/[team]/profile.ts
@@ -1,7 +1,8 @@
import type { NextApiRequest, NextApiResponse } from "next";
+import prisma from "@calcom/prisma";
+
import { getSession } from "@lib/auth";
-import prisma from "@lib/prisma";
// @deprecated - USE TRPC
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
diff --git a/apps/web/pages/api/teams/[team]/upgrade.ts b/apps/web/pages/api/teams/[team]/upgrade.ts
index 7144740a11e..1c36cdd9b0b 100644
--- a/apps/web/pages/api/teams/[team]/upgrade.ts
+++ b/apps/web/pages/api/teams/[team]/upgrade.ts
@@ -1 +1 @@
-export { default } from "@ee/pages/api/teams/[team]/upgrade";
+export { default } from "@calcom/features/ee/teams/api/upgrade";
diff --git a/apps/web/pages/api/upgrade.ts b/apps/web/pages/api/upgrade.ts
index 1b6d8605080..69e73e4deb0 100644
--- a/apps/web/pages/api/upgrade.ts
+++ b/apps/web/pages/api/upgrade.ts
@@ -1,11 +1,11 @@
import type { NextApiRequest, NextApiResponse } from "next";
-import { getStripeCustomerId } from "@calcom/stripe/customer";
+import { getStripeCustomerId } from "@calcom/app-store/stripepayment/lib/customer";
+import prisma from "@calcom/prisma";
import { getSession } from "@lib/auth";
import { WEBSITE_URL } from "@lib/config/constants";
import { HttpError as HttpCode } from "@lib/core/http/error";
-import prisma from "@lib/prisma";
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const session = await getSession({ req });
diff --git a/apps/web/pages/api/user/[id].ts b/apps/web/pages/api/user/[id].ts
index 80e8f586283..7315d9c507d 100644
--- a/apps/web/pages/api/user/[id].ts
+++ b/apps/web/pages/api/user/[id].ts
@@ -2,8 +2,9 @@ import { pick } from "lodash";
import type { NextApiRequest, NextApiResponse } from "next";
import z from "zod";
+import prisma from "@calcom/prisma";
+
import { getSession } from "@lib/auth";
-import prisma from "@lib/prisma";
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const session = await getSession({ req });
diff --git a/apps/web/pages/api/user/avatar.ts b/apps/web/pages/api/user/avatar.ts
index 8bd856d8f54..349b71588eb 100644
--- a/apps/web/pages/api/user/avatar.ts
+++ b/apps/web/pages/api/user/avatar.ts
@@ -1,8 +1,9 @@
import crypto from "crypto";
import type { NextApiRequest, NextApiResponse } from "next";
-import { getPlaceholderAvatar } from "@lib/getPlaceholderAvatar";
-import prisma from "@lib/prisma";
+import { getPlaceholderAvatar } from "@calcom/lib/getPlaceholderAvatar";
+import prisma from "@calcom/prisma";
+
import { defaultAvatarSrc } from "@lib/profile";
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
diff --git a/apps/web/pages/api/user/me.ts b/apps/web/pages/api/user/me.ts
index 698b2818736..0b7ecf430ce 100644
--- a/apps/web/pages/api/user/me.ts
+++ b/apps/web/pages/api/user/me.ts
@@ -1,9 +1,9 @@
import type { NextApiRequest, NextApiResponse } from "next";
-import { deleteStripeCustomer } from "@calcom/stripe/customer";
+import { deleteStripeCustomer } from "@calcom/app-store/stripepayment/lib/customer";
+import prisma from "@calcom/prisma";
import { getSession } from "@lib/auth";
-import prisma from "@lib/prisma";
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const session = await getSession({ req });
diff --git a/apps/web/pages/api/user/membership.ts b/apps/web/pages/api/user/membership.ts
index f523f117944..4a5613629e1 100644
--- a/apps/web/pages/api/user/membership.ts
+++ b/apps/web/pages/api/user/membership.ts
@@ -1,7 +1,8 @@
import type { NextApiRequest, NextApiResponse } from "next";
+import prisma from "@calcom/prisma";
+
import { getSession } from "@lib/auth";
-import prisma from "@lib/prisma";
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const session = await getSession({ req: req });
diff --git a/apps/web/pages/api/user/profile.ts b/apps/web/pages/api/user/profile.ts
index 4a510cc42aa..91e69bec7db 100644
--- a/apps/web/pages/api/user/profile.ts
+++ b/apps/web/pages/api/user/profile.ts
@@ -2,8 +2,9 @@ import { PrismaClientKnownRequestError } from "@prisma/client/runtime";
import { pick } from "lodash";
import type { NextApiRequest, NextApiResponse } from "next";
+import prisma from "@calcom/prisma";
+
import { getSession } from "@lib/auth";
-import prisma from "@lib/prisma";
import { resizeBase64Image } from "@server/lib/resizeBase64Image";
diff --git a/apps/web/pages/apps/categories/[category].tsx b/apps/web/pages/apps/categories/[category].tsx
index 8109e39f112..2114c8936b8 100644
--- a/apps/web/pages/apps/categories/[category].tsx
+++ b/apps/web/pages/apps/categories/[category].tsx
@@ -7,8 +7,8 @@ import { getAppRegistry } from "@calcom/app-store/_appRegistry";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import prisma from "@calcom/prisma";
import { Icon } from "@calcom/ui/Icon";
+import Shell from "@calcom/ui/Shell";
-import Shell from "@components/Shell";
import AppCard from "@components/apps/AppCard";
export default function Apps({ apps }: InferGetStaticPropsType<typeof getStaticProps>) {
diff --git a/apps/web/pages/apps/categories/index.tsx b/apps/web/pages/apps/categories/index.tsx
index 08430d652c0..672cf0dd87f 100644
--- a/apps/web/pages/apps/categories/index.tsx
+++ b/apps/web/pages/apps/categories/index.tsx
@@ -4,8 +4,8 @@ import Link from "next/link";
import { getAppRegistry } from "@calcom/app-store/_appRegistry";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { Icon } from "@calcom/ui/Icon";
+import Shell from "@calcom/ui/Shell";
-import Shell from "@components/Shell";
import AppStoreCategories from "@components/apps/Categories";
export default function Apps({ categories }: InferGetStaticPropsType<typeof getStaticProps>) {
diff --git a/apps/web/pages/apps/index.tsx b/apps/web/pages/apps/index.tsx
index 501ee0a9b67..61be51eb34c 100644
--- a/apps/web/pages/apps/index.tsx
+++ b/apps/web/pages/apps/index.tsx
@@ -3,9 +3,9 @@ import { InferGetStaticPropsType } from "next";
import { getAppRegistry } from "@calcom/app-store/_appRegistry";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import prisma from "@calcom/prisma";
+import Shell from "@calcom/ui/Shell";
import AppsShell from "@components/AppsShell";
-import Shell from "@components/Shell";
import AllApps from "@components/apps/AllApps";
import AppStoreCategories from "@components/apps/Categories";
import TrendingAppsSlider from "@components/apps/TrendingAppsSlider";
diff --git a/apps/web/pages/apps/installed.tsx b/apps/web/pages/apps/installed.tsx
index e4a8b4755ea..feb94ff8ebf 100644
--- a/apps/web/pages/apps/installed.tsx
+++ b/apps/web/pages/apps/installed.tsx
@@ -11,15 +11,15 @@ import { Alert } from "@calcom/ui/Alert";
import Button from "@calcom/ui/Button";
import EmptyScreen from "@calcom/ui/EmptyScreen";
import { Icon } from "@calcom/ui/Icon";
+import { List, ListItem, ListItemText, ListItemTitle } from "@calcom/ui/List";
+import Shell, { ShellSubHeading } from "@calcom/ui/Shell";
+import SkeletonLoader from "@calcom/ui/apps/SkeletonLoader";
import { QueryCell } from "@lib/QueryCell";
import classNames from "@lib/classNames";
import { HttpError } from "@lib/core/http/error";
import AppsShell from "@components/AppsShell";
-import { List, ListItem, ListItemText, ListItemTitle } from "@components/List";
-import Shell, { ShellSubHeading } from "@components/Shell";
-import SkeletonLoader from "@components/apps/SkeletonLoader";
import { CalendarListContainer } from "@components/integrations/CalendarListContainer";
import DisconnectIntegration from "@components/integrations/DisconnectIntegration";
import IntegrationListItem from "@components/integrations/IntegrationListItem";
@@ -156,7 +156,7 @@ function Web3Container() {
<List>
<ListItem className={classNames("flex-col")}>
<div className={classNames("flex w-full flex-1 items-center space-x-2 p-3")}>
- <Image width={40} height={40} src="/apps/metamask.svg" alt="Embed" />
+ <Image width={40} height={40} src="/api/app-store/metamask/icon.svg" alt="Embed" />
<div className="flex-grow truncate pl-2">
<ListItemTitle component="h3">
MetaMask (
diff --git a/apps/web/pages/auth/login.tsx b/apps/web/pages/auth/login.tsx
index 2d8716cbb45..bd573203c47 100644
--- a/apps/web/pages/auth/login.tsx
+++ b/apps/web/pages/auth/login.tsx
@@ -8,6 +8,7 @@ import { useForm } from "react-hook-form";
import { getSafeRedirectUrl } from "@calcom/lib/getSafeRedirectUrl";
import { useLocale } from "@calcom/lib/hooks/useLocale";
+import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@calcom/lib/telemetry";
import { Alert } from "@calcom/ui/Alert";
import Button from "@calcom/ui/Button";
import { Icon } from "@calcom/ui/Icon";
@@ -17,7 +18,6 @@ import prisma from "@calcom/web/lib/prisma";
import { ErrorCode, getSession } from "@lib/auth";
import { WEBAPP_URL, WEBSITE_URL } from "@lib/config/constants";
import { hostedCal, isSAMLLoginEnabled, samlProductID, samlTenantID } from "@lib/saml";
-import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@lib/telemetry";
import { inferSSRProps } from "@lib/types/inferSSRProps";
import AddToHomescreen from "@components/AddToHomescreen";
diff --git a/apps/web/pages/auth/signup.tsx b/apps/web/pages/auth/signup.tsx
index f77721f238f..7d4e96a4bfd 100644
--- a/apps/web/pages/auth/signup.tsx
+++ b/apps/web/pages/auth/signup.tsx
@@ -3,6 +3,7 @@ import { signIn } from "next-auth/react";
import { useRouter } from "next/router";
import { FormProvider, SubmitHandler, useForm } from "react-hook-form";
+import prisma from "@calcom/prisma";
import { Alert } from "@calcom/ui/Alert";
import Button from "@calcom/ui/Button";
import { EmailField, PasswordField, TextField } from "@calcom/ui/form/fields";
@@ -10,7 +11,6 @@ import { EmailField, PasswordField, TextField } from "@calcom/ui/form/fields";
import { asStringOrNull } from "@lib/asStringOrNull";
import { NEXT_PUBLIC_BASE_URL } from "@lib/config/constants";
import { useLocale } from "@lib/hooks/useLocale";
-import prisma from "@lib/prisma";
import { isSAMLLoginEnabled } from "@lib/saml";
import { inferSSRProps } from "@lib/types/inferSSRProps";
diff --git a/apps/web/pages/auth/sso/[provider].tsx b/apps/web/pages/auth/sso/[provider].tsx
index 707e640ec00..3331177549d 100644
--- a/apps/web/pages/auth/sso/[provider].tsx
+++ b/apps/web/pages/auth/sso/[provider].tsx
@@ -3,13 +3,13 @@ import { signIn } from "next-auth/react";
import { useRouter } from "next/router";
import { useEffect } from "react";
+import stripe from "@calcom/app-store/stripepayment/lib/server";
+import { getPremiumPlanPrice } from "@calcom/app-store/stripepayment/lib/utils";
import { checkUsername } from "@calcom/lib/server/checkUsername";
-import stripe from "@calcom/stripe/server";
-import { getPremiumPlanPrice } from "@calcom/stripe/utils";
+import prisma from "@calcom/prisma";
import { asStringOrNull } from "@lib/asStringOrNull";
import { getSession } from "@lib/auth";
-import prisma from "@lib/prisma";
import { hostedCal, isSAMLLoginEnabled, samlProductID, samlTenantID, samlTenantProduct } from "@lib/saml";
import { inferSSRProps } from "@lib/types/inferSSRProps";
diff --git a/apps/web/pages/availability/[schedule].tsx b/apps/web/pages/availability/[schedule].tsx
index 04d84cb7ab7..86ee7026109 100644
--- a/apps/web/pages/availability/[schedule].tsx
+++ b/apps/web/pages/availability/[schedule].tsx
@@ -4,23 +4,23 @@ import { useState } from "react";
import { Controller, useForm } from "react-hook-form";
import { z } from "zod";
-import { availabilityAsString, DEFAULT_SCHEDULE } from "@calcom/lib/availability";
+import { DEFAULT_SCHEDULE, availabilityAsString } from "@calcom/lib/availability";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import showToast from "@calcom/lib/notification";
import { stringOrNumber } from "@calcom/prisma/zod-utils";
import { inferQueryOutput, trpc } from "@calcom/trpc/react";
import Button from "@calcom/ui/Button";
import { BadgeCheckIcon } from "@calcom/ui/Icon";
+import Shell from "@calcom/ui/Shell";
import Switch from "@calcom/ui/Switch";
+import TimezoneSelect from "@calcom/ui/form/TimezoneSelect";
import { Form } from "@calcom/ui/form/fields";
import { QueryCell } from "@lib/QueryCell";
import { HttpError } from "@lib/core/http/error";
-import Shell from "@components/Shell";
import Schedule from "@components/availability/Schedule";
import EditableHeading from "@components/ui/EditableHeading";
-import TimezoneSelect from "@components/ui/form/TimezoneSelect";
export function AvailabilityForm(props: inferQueryOutput<"viewer.availability.schedule">) {
const { t } = useLocale();
diff --git a/apps/web/pages/availability/index.tsx b/apps/web/pages/availability/index.tsx
index 7386129815b..7ceb915aa05 100644
--- a/apps/web/pages/availability/index.tsx
+++ b/apps/web/pages/availability/index.tsx
@@ -3,11 +3,11 @@ import showToast from "@calcom/lib/notification";
import { inferQueryOutput, trpc } from "@calcom/trpc/react";
import EmptyScreen from "@calcom/ui/EmptyScreen";
import { Icon } from "@calcom/ui/Icon";
+import Shell from "@calcom/ui/Shell";
import { withQuery } from "@lib/QueryCell";
import { HttpError } from "@lib/core/http/error";
-import Shell from "@components/Shell";
import { NewScheduleButton } from "@components/availability/NewScheduleButton";
import { ScheduleListItem } from "@components/availability/ScheduleListItem";
import SkeletonLoader from "@components/availability/SkeletonLoader";
diff --git a/apps/web/pages/availability/troubleshoot.tsx b/apps/web/pages/availability/troubleshoot.tsx
index 0d0de594335..74c791ff8aa 100644
--- a/apps/web/pages/availability/troubleshoot.tsx
+++ b/apps/web/pages/availability/troubleshoot.tsx
@@ -3,11 +3,11 @@ import { useEffect, useState } from "react";
import dayjs, { Dayjs } from "@calcom/dayjs";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { inferQueryOutput, trpc } from "@calcom/trpc/react";
+import Shell from "@calcom/ui/Shell";
import { QueryCell } from "@lib/QueryCell";
import Loader from "@components/Loader";
-import Shell from "@components/Shell";
type User = inferQueryOutput<"viewer.me">;
diff --git a/apps/web/pages/bookings/[status].tsx b/apps/web/pages/bookings/[status].tsx
index 86e093375cf..703bada8877 100644
--- a/apps/web/pages/bookings/[status].tsx
+++ b/apps/web/pages/bookings/[status].tsx
@@ -10,11 +10,11 @@ import { Alert } from "@calcom/ui/Alert";
import Button from "@calcom/ui/Button";
import EmptyScreen from "@calcom/ui/EmptyScreen";
import { Icon } from "@calcom/ui/Icon";
+import Shell from "@calcom/ui/Shell";
import { useInViewObserver } from "@lib/hooks/useInViewObserver";
import BookingsShell from "@components/BookingsShell";
-import Shell from "@components/Shell";
import BookingListItem from "@components/booking/BookingListItem";
import SkeletonLoader from "@components/booking/SkeletonLoader";
diff --git a/apps/web/pages/cancel/[uid].tsx b/apps/web/pages/cancel/[uid].tsx
index d48cce26003..ce07d7d38c7 100644
--- a/apps/web/pages/cancel/[uid].tsx
+++ b/apps/web/pages/cancel/[uid].tsx
@@ -10,14 +10,14 @@ import classNames from "@calcom/lib/classNames";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { parseRecurringEvent } from "@calcom/lib/isRecurringEvent";
import { getEveryFreqFor } from "@calcom/lib/recurringStrings";
+import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@calcom/lib/telemetry";
+import { detectBrowserTimeFormat } from "@calcom/lib/timeFormat";
import prisma, { bookingMinimalSelect } from "@calcom/prisma";
import { Button } from "@calcom/ui/Button";
import { Icon } from "@calcom/ui/Icon";
import { TextField } from "@calcom/ui/form/fields";
import { getSession } from "@lib/auth";
-import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@lib/telemetry";
-import { detectBrowserTimeFormat } from "@lib/timeFormat";
import { inferSSRProps } from "@lib/types/inferSSRProps";
import { HeadSeo } from "@components/seo/head-seo";
diff --git a/apps/web/pages/d/[link]/[slug].tsx b/apps/web/pages/d/[link]/[slug].tsx
index 158702fe721..75bec18dca8 100644
--- a/apps/web/pages/d/[link]/[slug].tsx
+++ b/apps/web/pages/d/[link]/[slug].tsx
@@ -4,11 +4,11 @@ import { z } from "zod";
import { parseRecurringEvent } from "@calcom/lib";
import { availiblityPageEventTypeSelect } from "@calcom/prisma";
+import prisma from "@calcom/prisma";
import { getWorkingHours } from "@lib/availability";
import { GetBookingType } from "@lib/getBooking";
import { locationHiddenFilter, LocationObject } from "@lib/location";
-import prisma from "@lib/prisma";
import { inferSSRProps } from "@lib/types/inferSSRProps";
import AvailabilityPage from "@components/booking/pages/AvailabilityPage";
diff --git a/apps/web/pages/d/[link]/book.tsx b/apps/web/pages/d/[link]/book.tsx
index b9f6102a46c..7f63a61872b 100644
--- a/apps/web/pages/d/[link]/book.tsx
+++ b/apps/web/pages/d/[link]/book.tsx
@@ -4,10 +4,10 @@ import { JSONObject } from "superjson/dist/types";
import { getLocationLabels } from "@calcom/app-store/utils";
import { parseRecurringEvent } from "@calcom/lib";
import { useLocale } from "@calcom/lib/hooks/useLocale";
+import prisma from "@calcom/prisma";
import { bookEventTypeSelect } from "@calcom/prisma/selects";
import { asStringOrNull, asStringOrThrow } from "@lib/asStringOrNull";
-import prisma from "@lib/prisma";
import { inferSSRProps } from "@lib/types/inferSSRProps";
import BookingPage from "@components/booking/pages/BookingPage";
diff --git a/apps/web/pages/event-types/[type].tsx b/apps/web/pages/event-types/[type].tsx
index c45b46fba6d..2bcd7747fe6 100644
--- a/apps/web/pages/event-types/[type].tsx
+++ b/apps/web/pages/event-types/[type].tsx
@@ -15,19 +15,22 @@ import { v5 as uuidv5 } from "uuid";
import { z } from "zod";
import { SelectGifInput } from "@calcom/app-store/giphy/components";
+import { StripeData } from "@calcom/app-store/stripepayment/lib/server";
import getApps, { getLocationOptions } from "@calcom/app-store/utils";
import { parseRecurringEvent } from "@calcom/lib";
import { CAL_URL, WEBAPP_URL } from "@calcom/lib/constants";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import showToast from "@calcom/lib/notification";
import prisma from "@calcom/prisma";
-import { StripeData } from "@calcom/stripe/server";
import { trpc } from "@calcom/trpc/react";
-import { RecurringEvent } from "@calcom/types/Calendar";
+import type { RecurringEvent } from "@calcom/types/Calendar";
import { Alert } from "@calcom/ui/Alert";
+import Badge from "@calcom/ui/Badge";
import Button from "@calcom/ui/Button";
+import ConfirmationDialogContent from "@calcom/ui/ConfirmationDialogContent";
import { Dialog, DialogContent, DialogTrigger } from "@calcom/ui/Dialog";
import { Icon } from "@calcom/ui/Icon";
+import Shell from "@calcom/ui/Shell";
import Switch from "@calcom/ui/Switch";
import { Tooltip } from "@calcom/ui/Tooltip";
import { Form } from "@calcom/ui/form/fields";
@@ -45,14 +48,11 @@ import { ClientSuspense } from "@components/ClientSuspense";
import DestinationCalendarSelector from "@components/DestinationCalendarSelector";
import { EmbedButton, EmbedDialog } from "@components/Embed";
import Loader from "@components/Loader";
-import Shell from "@components/Shell";
import { UpgradeToProDialog } from "@components/UpgradeToProDialog";
import { AvailabilitySelectSkeletonLoader } from "@components/availability/SkeletonLoader";
-import ConfirmationDialogContent from "@components/dialog/ConfirmationDialogContent";
import { EditLocationDialog } from "@components/dialog/EditLocationDialog";
import RecurringEventController from "@components/eventtype/RecurringEventController";
import CustomInputTypeForm from "@components/pages/eventtypes/CustomInputTypeForm";
-import Badge from "@components/ui/Badge";
import EditableHeading from "@components/ui/EditableHeading";
import InfoBadge from "@components/ui/InfoBadge";
import CheckboxField from "@components/ui/form/CheckboxField";
diff --git a/apps/web/pages/event-types/index.tsx b/apps/web/pages/event-types/index.tsx
index a9b0cbd4b87..fd21b31b19f 100644
--- a/apps/web/pages/event-types/index.tsx
+++ b/apps/web/pages/event-types/index.tsx
@@ -11,6 +11,8 @@ import showToast from "@calcom/lib/notification";
import { inferQueryOutput, trpc } from "@calcom/trpc/react";
import { Button } from "@calcom/ui";
import { Alert } from "@calcom/ui/Alert";
+import Badge from "@calcom/ui/Badge";
+import ConfirmationDialogContent from "@calcom/ui/ConfirmationDialogContent";
import { Dialog } from "@calcom/ui/Dialog";
import Dropdown, {
DropdownMenuContent,
@@ -20,6 +22,7 @@ import Dropdown, {
} from "@calcom/ui/Dropdown";
import EmptyScreen from "@calcom/ui/EmptyScreen";
import { Icon } from "@calcom/ui/Icon";
+import Shell from "@calcom/ui/Shell";
import { Tooltip } from "@calcom/ui/Tooltip";
import { withQuery } from "@lib/QueryCell";
@@ -27,14 +30,11 @@ import classNames from "@lib/classNames";
import { HttpError } from "@lib/core/http/error";
import { EmbedButton, EmbedDialog } from "@components/Embed";
-import Shell from "@components/Shell";
-import ConfirmationDialogContent from "@components/dialog/ConfirmationDialogContent";
import CreateEventTypeButton from "@components/eventtype/CreateEventType";
import EventTypeDescription from "@components/eventtype/EventTypeDescription";
import SkeletonLoader from "@components/eventtype/SkeletonLoader";
import Avatar from "@components/ui/Avatar";
import AvatarGroup from "@components/ui/AvatarGroup";
-import Badge from "@components/ui/Badge";
import { TRPCClientError } from "@trpc/react";
diff --git a/apps/web/pages/getting-started.tsx b/apps/web/pages/getting-started.tsx
index cbb0aec6f98..82773f7c037 100644
--- a/apps/web/pages/getting-started.tsx
+++ b/apps/web/pages/getting-started.tsx
@@ -16,18 +16,19 @@ import { getCalendarCredentials, getConnectedCalendars } from "@calcom/core/Cale
import dayjs from "@calcom/dayjs";
import { DOCS_URL } from "@calcom/lib/constants";
import { fetchUsername } from "@calcom/lib/fetchUsername";
+import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@calcom/lib/telemetry";
+import { isBrowserLocale24h } from "@calcom/lib/timeFormat";
+import prisma from "@calcom/prisma";
import { trpc } from "@calcom/trpc/react";
import { Alert } from "@calcom/ui/Alert";
import Button from "@calcom/ui/Button";
import { Icon } from "@calcom/ui/Icon";
+import TimezoneSelect from "@calcom/ui/form/TimezoneSelect";
import { Form } from "@calcom/ui/form/fields";
import { getSession } from "@lib/auth";
import { DEFAULT_SCHEDULE } from "@lib/availability";
import { useLocale } from "@lib/hooks/useLocale";
-import prisma from "@lib/prisma";
-import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@lib/telemetry";
-import { isBrowserLocale24h } from "@lib/timeFormat";
import { inferSSRProps } from "@lib/types/inferSSRProps";
import { Schedule as ScheduleType } from "@lib/types/schedule";
@@ -35,7 +36,6 @@ import { ClientSuspense } from "@components/ClientSuspense";
import Loader from "@components/Loader";
import Schedule from "@components/availability/Schedule";
import { CalendarListContainer } from "@components/integrations/CalendarListContainer";
-import TimezoneSelect from "@components/ui/form/TimezoneSelect";
import getEventTypes from "../lib/queries/event-types/get-event-types";
diff --git a/apps/web/pages/payment/[uid].tsx b/apps/web/pages/payment/[uid].tsx
index 1f81bb62318..6fa998361dc 100644
--- a/apps/web/pages/payment/[uid].tsx
+++ b/apps/web/pages/payment/[uid].tsx
@@ -1,7 +1,6 @@
-import PaymentPage from "@ee/components/stripe/PaymentPage";
-import { getServerSideProps } from "@ee/pages/payment/[uid]";
-
-import { inferSSRProps } from "@lib/types/inferSSRProps";
+import PaymentPage from "@calcom/features/ee/payments/components/PaymentPage";
+import { getServerSideProps } from "@calcom/features/ee/payments/pages/payment";
+import { inferSSRProps } from "@calcom/types/inferSSRProps";
export default function Payment(props: inferSSRProps<typeof getServerSideProps>) {
return <PaymentPage {...props} />;
diff --git a/apps/web/pages/sandbox/Badge.tsx b/apps/web/pages/sandbox/Badge.tsx
index d700c337f4f..ee06ab80523 100644
--- a/apps/web/pages/sandbox/Badge.tsx
+++ b/apps/web/pages/sandbox/Badge.tsx
@@ -1,4 +1,4 @@
-import { Badge, BadgeProps } from "@components/ui/Badge";
+import { Badge, BadgeProps } from "@calcom/ui/Badge";
import { sandboxPage } from ".";
diff --git a/apps/web/pages/sandbox/List.tsx b/apps/web/pages/sandbox/List.tsx
index 4bae6b7119d..c6782b3f4eb 100644
--- a/apps/web/pages/sandbox/List.tsx
+++ b/apps/web/pages/sandbox/List.tsx
@@ -1,8 +1,7 @@
import React, { useState } from "react";
import Button from "@calcom/ui/Button";
-
-import { List, ListItem } from "@components/List";
+import { List, ListItem } from "@calcom/ui/List";
import { sandboxPage } from ".";
diff --git a/apps/web/pages/settings/developer.tsx b/apps/web/pages/settings/developer.tsx
index 2b639a49342..b2b0de5b952 100644
--- a/apps/web/pages/settings/developer.tsx
+++ b/apps/web/pages/settings/developer.tsx
@@ -1,6 +1,6 @@
+import ApiKeyListContainer from "@calcom/features/ee/api-keys/components/ApiKeyListContainer";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { trpc } from "@calcom/trpc/react";
-import ApiKeyListContainer from "@ee/components/apiKeys/ApiKeyListContainer";
import SettingsShell from "@components/SettingsShell";
import WebhookListContainer from "@components/webhook/WebhookListContainer";
diff --git a/apps/web/pages/settings/profile.tsx b/apps/web/pages/settings/profile.tsx
index c96cd9a34a9..c62c5f27d6a 100644
--- a/apps/web/pages/settings/profile.tsx
+++ b/apps/web/pages/settings/profile.tsx
@@ -7,11 +7,14 @@ import TimezoneSelect, { ITimezone } from "react-timezone-select";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import showToast from "@calcom/lib/notification";
+import prisma from "@calcom/prisma";
import { TRPCClientErrorLike } from "@calcom/trpc/client";
import { trpc } from "@calcom/trpc/react";
import { AppRouter } from "@calcom/trpc/server/routers/_app";
import { Alert } from "@calcom/ui/Alert";
+import Badge from "@calcom/ui/Badge";
import Button from "@calcom/ui/Button";
+import ConfirmationDialogContent from "@calcom/ui/ConfirmationDialogContent";
import { Dialog, DialogTrigger } from "@calcom/ui/Dialog";
import { Icon } from "@calcom/ui/Icon";
@@ -20,14 +23,11 @@ import { asStringOrNull, asStringOrUndefined } from "@lib/asStringOrNull";
import { getSession } from "@lib/auth";
import { nameOfDay } from "@lib/core/i18n/weekday";
import { isBrandingHidden } from "@lib/isBrandingHidden";
-import prisma from "@lib/prisma";
import { inferSSRProps } from "@lib/types/inferSSRProps";
import ImageUploader from "@components/ImageUploader";
import SettingsShell from "@components/SettingsShell";
-import ConfirmationDialogContent from "@components/dialog/ConfirmationDialogContent";
import Avatar from "@components/ui/Avatar";
-import Badge from "@components/ui/Badge";
import InfoBadge from "@components/ui/InfoBadge";
import { UsernameAvailability } from "@components/ui/UsernameAvailability";
import ColorPicker from "@components/ui/colorpicker";
diff --git a/apps/web/pages/settings/security.tsx b/apps/web/pages/settings/security.tsx
index bb2f0eab04d..de2dfed113c 100644
--- a/apps/web/pages/settings/security.tsx
+++ b/apps/web/pages/settings/security.tsx
@@ -1,9 +1,9 @@
import { IdentityProvider } from "@prisma/client";
import React from "react";
+import SAMLConfiguration from "@calcom/features/ee/common/components/SamlConfiguration";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { trpc } from "@calcom/trpc/react";
-import SAMLConfiguration from "@ee/components/saml/Configuration";
import { identityProviderNameMap } from "@lib/auth";
diff --git a/apps/web/pages/settings/teams/[id]/availability.tsx b/apps/web/pages/settings/teams/[id]/availability.tsx
index d855eb0dbc3..2bc7472c1b9 100644
--- a/apps/web/pages/settings/teams/[id]/availability.tsx
+++ b/apps/web/pages/settings/teams/[id]/availability.tsx
@@ -1 +1 @@
-export { default } from "@ee/pages/settings/teams/[id]/availability";
+export { default } from "@calcom/features/ee/teams/pages/availability";
diff --git a/apps/web/pages/settings/teams/[id]/index.tsx b/apps/web/pages/settings/teams/[id]/index.tsx
index 9364ccd1779..31f2c1a8411 100644
--- a/apps/web/pages/settings/teams/[id]/index.tsx
+++ b/apps/web/pages/settings/teams/[id]/index.tsx
@@ -2,20 +2,20 @@ import { MembershipRole } from "@prisma/client";
import { useRouter } from "next/router";
import { useEffect, useState } from "react";
+import SAMLConfiguration from "@calcom/features/ee/common/components/SamlConfiguration";
+import { getPlaceholderAvatar } from "@calcom/lib/getPlaceholderAvatar";
import showToast from "@calcom/lib/notification";
import { trpc } from "@calcom/trpc/react";
import { SkeletonAvatar, SkeletonText } from "@calcom/ui";
import { Alert } from "@calcom/ui/Alert";
import { Button } from "@calcom/ui/Button";
import { Icon } from "@calcom/ui/Icon";
-import SAMLConfiguration from "@ee/components/saml/Configuration";
+import Shell from "@calcom/ui/Shell";
import { QueryCell } from "@lib/QueryCell";
-import { getPlaceholderAvatar } from "@lib/getPlaceholderAvatar";
import useCurrentUserId from "@lib/hooks/useCurrentUserId";
import { useLocale } from "@lib/hooks/useLocale";
-import Shell from "@components/Shell";
import DisableTeamImpersonation from "@components/team/DisableTeamImpersonation";
import MemberInvitationModal from "@components/team/MemberInvitationModal";
import MemberList from "@components/team/MemberList";
diff --git a/apps/web/pages/success.tsx b/apps/web/pages/success.tsx
index 793e9280ca8..33e9ab4d310 100644
--- a/apps/web/pages/success.tsx
+++ b/apps/web/pages/success.tsx
@@ -18,11 +18,14 @@ import {
} from "@calcom/embed-core/embed-iframe";
import { parseRecurringEvent } from "@calcom/lib";
import CustomBranding from "@calcom/lib/CustomBranding";
-import { WEBSITE_URL } from "@calcom/lib/constants";
import { getDefaultEvent } from "@calcom/lib/defaultEvents";
import { useLocale } from "@calcom/lib/hooks/useLocale";
+import useTheme from "@calcom/lib/hooks/useTheme";
import { getEveryFreqFor } from "@calcom/lib/recurringStrings";
+import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@calcom/lib/telemetry";
+import { isBrowserLocale24h } from "@calcom/lib/timeFormat";
import { localStorage } from "@calcom/lib/webstorage";
+import prisma from "@calcom/prisma";
import { Prisma } from "@calcom/prisma/client";
import Button from "@calcom/ui/Button";
import { Icon } from "@calcom/ui/Icon";
@@ -30,12 +33,8 @@ import { EmailInput } from "@calcom/ui/form/fields";
import { asStringOrThrow } from "@lib/asStringOrNull";
import { getEventName } from "@lib/event";
-import useTheme from "@lib/hooks/useTheme";
import { isBrandingHidden } from "@lib/isBrandingHidden";
import { isSuccessRedirectAvailable } from "@lib/isSuccessRedirectAvailable";
-import prisma from "@lib/prisma";
-import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@lib/telemetry";
-import { isBrowserLocale24h } from "@lib/timeFormat";
import { inferSSRProps } from "@lib/types/inferSSRProps";
import CancelBooking from "@components/booking/CancelBooking";
diff --git a/apps/web/pages/team/[slug].tsx b/apps/web/pages/team/[slug].tsx
index 37f70cd8367..4afa3b77217 100644
--- a/apps/web/pages/team/[slug].tsx
+++ b/apps/web/pages/team/[slug].tsx
@@ -7,16 +7,16 @@ import React, { useEffect } from "react";
import { useIsEmbed } from "@calcom/embed-core/embed-iframe";
import { CAL_URL } from "@calcom/lib/constants";
+import { getPlaceholderAvatar } from "@calcom/lib/getPlaceholderAvatar";
+import useTheme from "@calcom/lib/hooks/useTheme";
import { getTeamWithMembers } from "@calcom/lib/server/queries/teams";
+import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@calcom/lib/telemetry";
import Button from "@calcom/ui/Button";
import { Icon } from "@calcom/ui/Icon";
-import { getPlaceholderAvatar } from "@lib/getPlaceholderAvatar";
import { useExposePlanGlobally } from "@lib/hooks/useExposePlanGlobally";
import { useLocale } from "@lib/hooks/useLocale";
-import useTheme from "@lib/hooks/useTheme";
import { useToggleQuery } from "@lib/hooks/useToggleQuery";
-import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@lib/telemetry";
import { inferSSRProps } from "@lib/types/inferSSRProps";
import EventTypeDescription from "@components/eventtype/EventTypeDescription";
diff --git a/apps/web/pages/team/[slug]/[type].tsx b/apps/web/pages/team/[slug]/[type].tsx
index 6288f9d4c35..fad74bb099e 100644
--- a/apps/web/pages/team/[slug]/[type].tsx
+++ b/apps/web/pages/team/[slug]/[type].tsx
@@ -3,12 +3,12 @@ import { GetServerSidePropsContext } from "next";
import { JSONObject } from "superjson/dist/types";
import { parseRecurringEvent } from "@calcom/lib";
+import prisma from "@calcom/prisma";
import { asStringOrNull } from "@lib/asStringOrNull";
import { getWorkingHours } from "@lib/availability";
import getBooking, { GetBookingType } from "@lib/getBooking";
import { locationHiddenFilter, LocationObject } from "@lib/location";
-import prisma from "@lib/prisma";
import { inferSSRProps } from "@lib/types/inferSSRProps";
import AvailabilityPage from "@components/booking/pages/AvailabilityPage";
diff --git a/apps/web/pages/team/[slug]/book.tsx b/apps/web/pages/team/[slug]/book.tsx
index 0eaa073c18d..99a627ff28a 100644
--- a/apps/web/pages/team/[slug]/book.tsx
+++ b/apps/web/pages/team/[slug]/book.tsx
@@ -4,10 +4,10 @@ import { JSONObject } from "superjson/dist/types";
import { getLocationLabels } from "@calcom/app-store/utils";
import { parseRecurringEvent } from "@calcom/lib";
import { useLocale } from "@calcom/lib/hooks/useLocale";
+import prisma from "@calcom/prisma";
import { asStringOrNull, asStringOrThrow } from "@lib/asStringOrNull";
import getBooking, { GetBookingType } from "@lib/getBooking";
-import prisma from "@lib/prisma";
import { inferSSRProps } from "@lib/types/inferSSRProps";
import BookingPage from "@components/booking/pages/BookingPage";
diff --git a/apps/web/pages/video/meeting-ended/[uid].tsx b/apps/web/pages/video/meeting-ended/[uid].tsx
index d7d94743323..4c1ae3e0b11 100644
--- a/apps/web/pages/video/meeting-ended/[uid].tsx
+++ b/apps/web/pages/video/meeting-ended/[uid].tsx
@@ -5,11 +5,11 @@ import { useEffect } from "react";
import dayjs from "@calcom/dayjs";
import { useLocale } from "@calcom/lib/hooks/useLocale";
+import { detectBrowserTimeFormat } from "@calcom/lib/timeFormat";
import prisma, { bookingMinimalSelect } from "@calcom/prisma";
import Button from "@calcom/ui/Button";
import { Icon } from "@calcom/ui/Icon";
-import { detectBrowserTimeFormat } from "@lib/timeFormat";
import { inferSSRProps } from "@lib/types/inferSSRProps";
import { HeadSeo } from "@components/seo/head-seo";
diff --git a/apps/web/pages/video/meeting-not-started/[uid].tsx b/apps/web/pages/video/meeting-not-started/[uid].tsx
index 1797e39caed..9599b0b8b20 100644
--- a/apps/web/pages/video/meeting-not-started/[uid].tsx
+++ b/apps/web/pages/video/meeting-not-started/[uid].tsx
@@ -5,13 +5,12 @@ import { useEffect } from "react";
import dayjs from "@calcom/dayjs";
import { useLocale } from "@calcom/lib/hooks/useLocale";
+import { detectBrowserTimeFormat } from "@calcom/lib/timeFormat";
import prisma, { bookingMinimalSelect } from "@calcom/prisma";
import type { inferSSRProps } from "@calcom/types/inferSSRProps";
import Button from "@calcom/ui/Button";
import { Icon } from "@calcom/ui/Icon";
-import { detectBrowserTimeFormat } from "@lib/timeFormat";
-
import { HeadSeo } from "@components/seo/head-seo";
export default function MeetingNotStarted(props: inferSSRProps<typeof getServerSideProps>) {
diff --git a/apps/web/pages/workflows/[workflow].tsx b/apps/web/pages/workflows/[workflow].tsx
index d5784c1929a..a9111407a33 100644
--- a/apps/web/pages/workflows/[workflow].tsx
+++ b/apps/web/pages/workflows/[workflow].tsx
@@ -1 +1 @@
-export { default } from "@ee/pages/workflows/[workflow]";
+export { default } from "@calcom/features/ee/workflows/pages/workflow";
diff --git a/apps/web/pages/workflows/index.tsx b/apps/web/pages/workflows/index.tsx
index 7a7030b725b..a0ea6817363 100644
--- a/apps/web/pages/workflows/index.tsx
+++ b/apps/web/pages/workflows/index.tsx
@@ -1 +1 @@
-export { default } from "@ee/pages/workflows/index";
+export { default } from "@calcom/features/ee/workflows/pages/index";
diff --git a/apps/web/playwright/auth/auth-index.test.ts b/apps/web/playwright/auth/auth-index.test.ts
index cd96a0c1906..4a9260bfe00 100644
--- a/apps/web/playwright/auth/auth-index.test.ts
+++ b/apps/web/playwright/auth/auth-index.test.ts
@@ -1,7 +1,8 @@
import { expect, test } from "@playwright/test";
+import prisma from "@calcom/prisma";
+
import { WEBAPP_URL } from "@lib/config/constants";
-import prisma from "@lib/prisma";
import { todo } from "../lib/testUtils";
diff --git a/apps/web/playwright/change-username.test.ts b/apps/web/playwright/change-username.test.ts
index 79fc35a1a27..5ef6ec38f3b 100644
--- a/apps/web/playwright/change-username.test.ts
+++ b/apps/web/playwright/change-username.test.ts
@@ -1,12 +1,11 @@
import { expect } from "@playwright/test";
import { UserPlan } from "@prisma/client";
+import stripe from "@calcom/app-store/stripepayment/lib/server";
+import { getFreePlanPrice, getProPlanPrice } from "@calcom/app-store/stripepayment/lib/utils";
import dayjs from "@calcom/dayjs";
import { WEBAPP_URL } from "@calcom/lib/constants";
-import stripe from "@calcom/stripe/server";
-import { getFreePlanPrice, getProPlanPrice } from "@calcom/stripe/utils";
-
-import prisma from "@lib/prisma";
+import prisma from "@calcom/prisma";
import { test } from "./lib/fixtures";
diff --git a/apps/web/playwright/lib/teardown.ts b/apps/web/playwright/lib/teardown.ts
index cb6010c47eb..ba5fb0e2778 100644
--- a/apps/web/playwright/lib/teardown.ts
+++ b/apps/web/playwright/lib/teardown.ts
@@ -1,6 +1,6 @@
import { Prisma } from "@prisma/client";
-import prisma from "@lib/prisma";
+import prisma from "@calcom/prisma";
/**
* @deprecated
diff --git a/apps/web/playwright/onboarding.test.ts b/apps/web/playwright/onboarding.test.ts
index 972b7abeecc..4b523ebbd95 100644
--- a/apps/web/playwright/onboarding.test.ts
+++ b/apps/web/playwright/onboarding.test.ts
@@ -1,6 +1,6 @@
import { expect, test } from "@playwright/test";
-import prisma from "@lib/prisma";
+import prisma from "@calcom/prisma";
test.describe("Onboarding", () => {
test.use({ storageState: "playwright/artifacts/onboardingStorageState.json" });
diff --git a/apps/web/playwright/reschedule.test.ts b/apps/web/playwright/reschedule.test.ts
index 17aacec459e..e3932e5dad9 100644
--- a/apps/web/playwright/reschedule.test.ts
+++ b/apps/web/playwright/reschedule.test.ts
@@ -1,7 +1,7 @@
import { expect } from "@playwright/test";
import { BookingStatus } from "@prisma/client";
-import prisma from "@lib/prisma";
+import prisma from "@calcom/prisma";
import { test } from "./lib/fixtures";
import { selectFirstAvailableTimeSlotNextMonth } from "./lib/testUtils";
diff --git a/apps/web/public/apps/metamask.svg b/apps/web/public/apps/metamask.svg
deleted file mode 100644
index 6cb41ba98e1..00000000000
--- a/apps/web/public/apps/metamask.svg
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
-<svg version="1.1" id="Layer_1" xmlns:ev="http://www.w3.org/2001/xml-events"
- xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 318.6 318.6"
- style="enable-background:new 0 0 318.6 318.6;" xml:space="preserve">
-<style type="text/css">
- .st0{fill:#E2761B;stroke:#E2761B;stroke-linecap:round;stroke-linejoin:round;}
- .st1{fill:#E4761B;stroke:#E4761B;stroke-linecap:round;stroke-linejoin:round;}
- .st2{fill:#D7C1B3;stroke:#D7C1B3;stroke-linecap:round;stroke-linejoin:round;}
- .st3{fill:#233447;stroke:#233447;stroke-linecap:round;stroke-linejoin:round;}
- .st4{fill:#CD6116;stroke:#CD6116;stroke-linecap:round;stroke-linejoin:round;}
- .st5{fill:#E4751F;stroke:#E4751F;stroke-linecap:round;stroke-linejoin:round;}
- .st6{fill:#F6851B;stroke:#F6851B;stroke-linecap:round;stroke-linejoin:round;}
- .st7{fill:#C0AD9E;stroke:#C0AD9E;stroke-linecap:round;stroke-linejoin:round;}
- .st8{fill:#161616;stroke:#161616;stroke-linecap:round;stroke-linejoin:round;}
- .st9{fill:#763D16;stroke:#763D16;stroke-linecap:round;stroke-linejoin:round;}
-</style>
-<polygon class="st0" points="274.1,35.5 174.6,109.4 193,65.8 "/>
-<g>
- <polygon class="st1" points="44.4,35.5 143.1,110.1 125.6,65.8 "/>
- <polygon class="st1" points="238.3,206.8 211.8,247.4 268.5,263 284.8,207.7 "/>
- <polygon class="st1" points="33.9,207.7 50.1,263 106.8,247.4 80.3,206.8 "/>
- <polygon class="st1" points="103.6,138.2 87.8,162.1 144.1,164.6 142.1,104.1 "/>
- <polygon class="st1" points="214.9,138.2 175.9,103.4 174.6,164.6 230.8,162.1 "/>
- <polygon class="st1" points="106.8,247.4 140.6,230.9 111.4,208.1 "/>
- <polygon class="st1" points="177.9,230.9 211.8,247.4 207.1,208.1 "/>
-</g>
-<g>
- <polygon class="st2" points="211.8,247.4 177.9,230.9 180.6,253 180.3,262.3 "/>
- <polygon class="st2" points="106.8,247.4 138.3,262.3 138.1,253 140.6,230.9 "/>
-</g>
-<polygon class="st3" points="138.8,193.5 110.6,185.2 130.5,176.1 "/>
-<polygon class="st3" points="179.7,193.5 188,176.1 208,185.2 "/>
-<g>
- <polygon class="st4" points="106.8,247.4 111.6,206.8 80.3,207.7 "/>
- <polygon class="st4" points="207,206.8 211.8,247.4 238.3,207.7 "/>
- <polygon class="st4" points="230.8,162.1 174.6,164.6 179.8,193.5 188.1,176.1 208.1,185.2 "/>
- <polygon class="st4" points="110.6,185.2 130.6,176.1 138.8,193.5 144.1,164.6 87.8,162.1 "/>
-</g>
-<g>
- <polygon class="st5" points="87.8,162.1 111.4,208.1 110.6,185.2 "/>
- <polygon class="st5" points="208.1,185.2 207.1,208.1 230.8,162.1 "/>
- <polygon class="st5" points="144.1,164.6 138.8,193.5 145.4,227.6 146.9,182.7 "/>
- <polygon class="st5" points="174.6,164.6 171.9,182.6 173.1,227.6 179.8,193.5 "/>
-</g>
-<polygon class="st6" points="179.8,193.5 173.1,227.6 177.9,230.9 207.1,208.1 208.1,185.2 "/>
-<polygon class="st6" points="110.6,185.2 111.4,208.1 140.6,230.9 145.4,227.6 138.8,193.5 "/>
-<polygon class="st7" points="180.3,262.3 180.6,253 178.1,250.8 140.4,250.8 138.1,253 138.3,262.3 106.8,247.4 117.8,256.4
- 140.1,271.9 178.4,271.9 200.8,256.4 211.8,247.4 "/>
-<polygon class="st8" points="177.9,230.9 173.1,227.6 145.4,227.6 140.6,230.9 138.1,253 140.4,250.8 178.1,250.8 180.6,253 "/>
-<g>
- <polygon class="st9" points="278.3,114.2 286.8,73.4 274.1,35.5 177.9,106.9 214.9,138.2 267.2,153.5 278.8,140 273.8,136.4
- 281.8,129.1 275.6,124.3 283.6,118.2 "/>
- <polygon class="st9" points="31.8,73.4 40.3,114.2 34.9,118.2 42.9,124.3 36.8,129.1 44.8,136.4 39.8,140 51.3,153.5 103.6,138.2
- 140.6,106.9 44.4,35.5 "/>
-</g>
-<polygon class="st6" points="267.2,153.5 214.9,138.2 230.8,162.1 207.1,208.1 238.3,207.7 284.8,207.7 "/>
-<polygon class="st6" points="103.6,138.2 51.3,153.5 33.9,207.7 80.3,207.7 111.4,208.1 87.8,162.1 "/>
-<polygon class="st6" points="174.6,164.6 177.9,106.9 193.1,65.8 125.6,65.8 140.6,106.9 144.1,164.6 145.3,182.8 145.4,227.6
- 173.1,227.6 173.3,182.8 "/>
-</svg>
diff --git a/apps/web/tsconfig.json b/apps/web/tsconfig.json
index 20255ded782..f0ddea5552b 100644
--- a/apps/web/tsconfig.json
+++ b/apps/web/tsconfig.json
@@ -7,7 +7,6 @@
"@components/*": ["components/*"],
"@lib/*": ["lib/*"],
"@server/*": ["server/*"],
- "@ee/*": ["ee/*"],
"@prisma/client/*": ["@calcom/prisma/client/*"]
}
},
diff --git a/apps/website b/apps/website
index 4ca4a62771c..ee050575158 160000
--- a/apps/website
+++ b/apps/website
@@ -1 +1 @@
-Subproject commit 4ca4a62771c2c9174014668ca6557f8ff8a95bf6
+Subproject commit ee050575158383b364e09702a2aa8e7ebcf15050
diff --git a/package.json b/package.json
index 8534db7b124..e0cfb8f7bc5 100644
--- a/package.json
+++ b/package.json
@@ -6,6 +6,7 @@
"apps/*",
"packages/*",
"packages/embeds/*",
+ "packages/features/*",
"packages/app-store/*",
"packages/app-store/ee/*"
],
diff --git a/packages/app-store/_utils/getCalendar.ts b/packages/app-store/_utils/getCalendar.ts
index 8d538491cb9..064fccae4cf 100644
--- a/packages/app-store/_utils/getCalendar.ts
+++ b/packages/app-store/_utils/getCalendar.ts
@@ -1,7 +1,7 @@
import { Credential } from "@prisma/client";
import logger from "@calcom/lib/logger";
-import { Calendar } from "@calcom/types/Calendar";
+import type { Calendar } from "@calcom/types/Calendar";
import appStore from "..";
diff --git a/packages/app-store/ee/routing_forms/components/RoutingShell.tsx b/packages/app-store/ee/routing_forms/components/RoutingShell.tsx
index afd551c52c3..30e21604bb2 100644
--- a/packages/app-store/ee/routing_forms/components/RoutingShell.tsx
+++ b/packages/app-store/ee/routing_forms/components/RoutingShell.tsx
@@ -1,6 +1,6 @@
import { ReactNode } from "react";
-import Shell from "@components/Shell";
+import Shell from "@calcom/ui/Shell";
import RoutingNavBar from "../components/RoutingNavBar";
import { getSerializableForm } from "../utils";
diff --git a/packages/app-store/ee/routing_forms/components/SideBar.tsx b/packages/app-store/ee/routing_forms/components/SideBar.tsx
index f0a7f0cd4c5..0ebbd44b23c 100644
--- a/packages/app-store/ee/routing_forms/components/SideBar.tsx
+++ b/packages/app-store/ee/routing_forms/components/SideBar.tsx
@@ -6,10 +6,9 @@ import { useLocale } from "@calcom/lib/hooks/useLocale";
import showToast from "@calcom/lib/notification";
import { trpc } from "@calcom/trpc/react";
import { Switch } from "@calcom/ui";
+import ConfirmationDialogContent from "@calcom/ui/ConfirmationDialogContent";
import { DialogTrigger, Dialog } from "@calcom/ui/Dialog";
-import ConfirmationDialogContent from "@components/dialog/ConfirmationDialogContent";
-
import { getSerializableForm } from "../utils";
export default function SideBar({
diff --git a/packages/app-store/ee/routing_forms/pages/forms/[...appPages].tsx b/packages/app-store/ee/routing_forms/pages/forms/[...appPages].tsx
index 0ebda3d0d1f..9d58ebfb186 100644
--- a/packages/app-store/ee/routing_forms/pages/forms/[...appPages].tsx
+++ b/packages/app-store/ee/routing_forms/pages/forms/[...appPages].tsx
@@ -26,11 +26,10 @@ import Dropdown, {
DropdownMenuSeparator,
DropdownMenuTrigger,
} from "@calcom/ui/Dropdown";
+import Shell from "@calcom/ui/Shell";
import { inferSSRProps } from "@lib/types/inferSSRProps";
-import Shell from "@components/Shell";
-
import { getSerializableForm } from "../../utils";
export default function RoutingForms({
diff --git a/packages/app-store/ee/routing_forms/pages/routing-link/[...appPages].tsx b/packages/app-store/ee/routing_forms/pages/routing-link/[...appPages].tsx
index 7beb52bba80..db2fd1d5918 100644
--- a/packages/app-store/ee/routing_forms/pages/routing-link/[...appPages].tsx
+++ b/packages/app-store/ee/routing_forms/pages/routing-link/[...appPages].tsx
@@ -9,14 +9,13 @@ import { v4 as uuidv4 } from "uuid";
import { useIsEmbed } from "@calcom/embed-core/embed-iframe";
import CustomBranding from "@calcom/lib/CustomBranding";
import classNames from "@calcom/lib/classNames";
+import useTheme from "@calcom/lib/hooks/useTheme";
import showToast from "@calcom/lib/notification";
import { trpc } from "@calcom/trpc/react";
import { AppGetServerSidePropsContext, AppPrisma } from "@calcom/types/AppGetServerSideProps";
import { inferSSRProps } from "@calcom/types/inferSSRProps";
import { Button } from "@calcom/ui";
-import useTheme from "@lib/hooks/useTheme";
-
import { getSerializableForm } from "../../utils";
import { getQueryBuilderConfig } from "../route-builder/[...appPages]";
diff --git a/packages/app-store/ee/routing_forms/playwright/config/globalSetup.ts b/packages/app-store/ee/routing_forms/playwright/config/globalSetup.ts
index 5a8061bb328..c349ce50b01 100644
--- a/packages/app-store/ee/routing_forms/playwright/config/globalSetup.ts
+++ b/packages/app-store/ee/routing_forms/playwright/config/globalSetup.ts
@@ -3,8 +3,7 @@ import { Page, chromium } from "@playwright/test";
// TODO: Import it in _playwright/config/globalSetup.ts and export it from there.
import { loginAsUser } from "@calcom/app-store/_apps-playwright/config/globalSetup";
import { hashPassword } from "@calcom/lib/auth";
-
-import prisma from "@lib/prisma";
+import prisma from "@calcom/prisma";
async function installApp(appName: string, redirectUrl: string, page: Page) {
await page.goto(`${process.env.PLAYWRIGHT_TEST_BASE_URL}/apps/${appName}`);
diff --git a/packages/app-store/ee/routing_forms/playwright/config/globalTeardown.ts b/packages/app-store/ee/routing_forms/playwright/config/globalTeardown.ts
index e3dca059ef1..d279f062e61 100644
--- a/packages/app-store/ee/routing_forms/playwright/config/globalTeardown.ts
+++ b/packages/app-store/ee/routing_forms/playwright/config/globalTeardown.ts
@@ -1,4 +1,4 @@
-import prisma from "@lib/prisma";
+import prisma from "@calcom/prisma";
async function deleteUser(userName: string) {
await prisma.user.deleteMany({
diff --git a/packages/app-store/locations.ts b/packages/app-store/locations.ts
index d3b2f75b3cd..f8a9ec72898 100644
--- a/packages/app-store/locations.ts
+++ b/packages/app-store/locations.ts
@@ -1,3 +1,5 @@
+import type { TFunction } from "next-i18next";
+
export enum DefaultLocationType {
InPerson = "inPerson",
Phone = "phone",
@@ -43,3 +45,36 @@ export const locationHiddenFilter = (locations: LocationObject[]) =>
return el;
}
});
+
+/**
+ * Use this function for translating event location to a readable string
+ * @param location
+ * @param t
+ * @returns string
+ */
+export const LocationOptionsToString = (location: string, t: TFunction) => {
+ switch (location) {
+ case LocationType.InPerson:
+ return t("set_address_place");
+ case LocationType.Link:
+ return t("set_link_meeting");
+ case LocationType.Phone:
+ return t("cal_invitee_phone_number_scheduling");
+ case LocationType.GoogleMeet:
+ return t("cal_provide_google_meet_location");
+ case LocationType.Zoom:
+ return t("cal_provide_zoom_meeting_url");
+ case LocationType.Daily:
+ return t("cal_provide_video_meeting_url");
+ case LocationType.Jitsi:
+ return t("cal_provide_jitsi_meeting_url");
+ case LocationType.Huddle01:
+ return t("cal_provide_huddle01_meeting_url");
+ case LocationType.Tandem:
+ return t("cal_provide_tandem_meeting_url");
+ case LocationType.Teams:
+ return t("cal_provide_teams_meeting_url");
+ default:
+ return null;
+ }
+};
diff --git a/packages/app-store/package.json b/packages/app-store/package.json
index ef0e224a50d..9359563e2db 100644
--- a/packages/app-store/package.json
+++ b/packages/app-store/package.json
@@ -11,10 +11,13 @@
"lint:report": "eslint . --format json --output-file ../../lint-results/app-store.json"
},
"dependencies": {
- "@calcom/lib": "*",
- "@calcom/zoomvideo": "*",
"@calcom/dailyvideo": "*",
+ "@calcom/dayjs": "*",
+ "@calcom/features": "*",
+ "@calcom/lib": "*",
"@calcom/office365video": "*",
+ "@calcom/trpc": "*",
+ "@calcom/zoomvideo": "*",
"lodash": "^4.17.21"
},
"devDependencies": {
diff --git a/packages/app-store/stripepayment/api/callback.ts b/packages/app-store/stripepayment/api/callback.ts
index 78bee4b04a9..3711f200eaf 100644
--- a/packages/app-store/stripepayment/api/callback.ts
+++ b/packages/app-store/stripepayment/api/callback.ts
@@ -3,7 +3,8 @@ import type { NextApiRequest, NextApiResponse } from "next";
import { stringify } from "querystring";
import prisma from "@calcom/prisma";
-import stripe, { StripeData } from "@calcom/stripe/server";
+
+import stripe, { StripeData } from "../lib/server";
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const { code, error, error_description } = req.query;
diff --git a/packages/app-store/stripepayment/api/portal.ts b/packages/app-store/stripepayment/api/portal.ts
index 9e4218125bc..7087c5304f6 100644
--- a/packages/app-store/stripepayment/api/portal.ts
+++ b/packages/app-store/stripepayment/api/portal.ts
@@ -1,7 +1,7 @@
import type { NextApiRequest, NextApiResponse } from "next";
-import { getStripeCustomerIdFromUserId } from "@calcom/stripe/customer";
-import stripe from "@calcom/stripe/server";
+import { getStripeCustomerIdFromUserId } from "../lib/customer";
+import stripe from "../lib/server";
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
if (req.method === "POST") {
diff --git a/packages/app-store/stripepayment/api/subscription.ts b/packages/app-store/stripepayment/api/subscription.ts
index 2b770cc9132..54bf8a40659 100644
--- a/packages/app-store/stripepayment/api/subscription.ts
+++ b/packages/app-store/stripepayment/api/subscription.ts
@@ -2,18 +2,19 @@ import { UserPlan } from "@prisma/client";
import type { NextApiRequest, NextApiResponse } from "next";
import Stripe from "stripe";
-import { checkPremiumUsername } from "@calcom/ee/lib/core/checkPremiumUsername";
+import { checkPremiumUsername } from "@calcom/features/ee/common/lib/checkPremiumUsername";
import hasKeyInMetadata from "@calcom/lib/hasKeyInMetadata";
import prisma from "@calcom/prisma";
import { Prisma } from "@calcom/prisma/client";
+
import {
PREMIUM_PLAN_PRICE,
PREMIUM_PLAN_PRODUCT_ID,
PRO_PLAN_PRICE,
PRO_PLAN_PRODUCT_ID,
-} from "@calcom/stripe/constants";
-import { getStripeCustomerIdFromUserId } from "@calcom/stripe/customer";
-import stripe from "@calcom/stripe/server";
+} from "../lib/constants";
+import { getStripeCustomerIdFromUserId } from "../lib/customer";
+import stripe from "../lib/server";
enum UsernameChangeStatusEnum {
NORMAL = "NORMAL",
diff --git a/packages/app-store/stripepayment/lib/client/createPaymentLink.ts b/packages/app-store/stripepayment/lib/client/createPaymentLink.ts
new file mode 100644
index 00000000000..c4a97803536
--- /dev/null
+++ b/packages/app-store/stripepayment/lib/client/createPaymentLink.ts
@@ -0,0 +1,17 @@
+import { stringify } from "querystring";
+
+export type Maybe<T> = T | undefined | null;
+
+export function createPaymentLink(opts: {
+ paymentUid: string;
+ name?: Maybe<string>;
+ date?: Maybe<string>;
+ email?: Maybe<string>;
+ absolute?: boolean;
+}): string {
+ const { paymentUid, name, email, date, absolute = true } = opts;
+ let link = "";
+ if (absolute) link = process.env.NEXT_PUBLIC_WEBSITE_URL!;
+ const query = stringify({ date, name, email });
+ return link + `/payment/${paymentUid}?${query}`;
+}
diff --git a/packages/stripe/client.ts b/packages/app-store/stripepayment/lib/client/getStripe.ts
similarity index 56%
rename from packages/stripe/client.ts
rename to packages/app-store/stripepayment/lib/client/getStripe.ts
index 5e87d7d7650..b53453933a1 100644
--- a/packages/stripe/client.ts
+++ b/packages/app-store/stripepayment/lib/client/getStripe.ts
@@ -1,6 +1,5 @@
import { Stripe } from "@stripe/stripe-js";
import { loadStripe } from "@stripe/stripe-js/pure";
-import { stringify } from "querystring";
export type Maybe<T> = T | undefined | null;
@@ -21,18 +20,4 @@ const getStripe = (userPublicKey?: string) => {
return stripePromise;
};
-export function createPaymentLink(opts: {
- paymentUid: string;
- name?: Maybe<string>;
- date?: Maybe<string>;
- email?: Maybe<string>;
- absolute?: boolean;
-}): string {
- const { paymentUid, name, email, date, absolute = true } = opts;
- let link = "";
- if (absolute) link = process.env.NEXT_PUBLIC_WEBSITE_URL!;
- const query = stringify({ date, name, email });
- return link + `/payment/${paymentUid}?${query}`;
-}
-
export default getStripe;
diff --git a/packages/app-store/stripepayment/lib/client/index.ts b/packages/app-store/stripepayment/lib/client/index.ts
new file mode 100644
index 00000000000..7365ec286b2
--- /dev/null
+++ b/packages/app-store/stripepayment/lib/client/index.ts
@@ -0,0 +1,2 @@
+export { createPaymentLink } from "./createPaymentLink";
+export { default } from "./getStripe";
diff --git a/packages/stripe/constants.ts b/packages/app-store/stripepayment/lib/constants.ts
similarity index 100%
rename from packages/stripe/constants.ts
rename to packages/app-store/stripepayment/lib/constants.ts
diff --git a/packages/stripe/customer.ts b/packages/app-store/stripepayment/lib/customer.ts
similarity index 98%
rename from packages/stripe/customer.ts
rename to packages/app-store/stripepayment/lib/customer.ts
index 162d5f5c5ba..2231a5c7cd3 100644
--- a/packages/stripe/customer.ts
+++ b/packages/app-store/stripepayment/lib/customer.ts
@@ -2,7 +2,8 @@ import { Prisma } from "@prisma/client";
import { HttpError as HttpCode } from "@calcom/lib/http-error";
import prisma from "@calcom/prisma";
-import stripe from "@calcom/stripe/server";
+
+import stripe from "./server";
export async function getStripeCustomerIdFromUserId(userId: number) {
// Get user
diff --git a/packages/stripe/downgrade.ts b/packages/app-store/stripepayment/lib/downgrade.ts
similarity index 98%
rename from packages/stripe/downgrade.ts
rename to packages/app-store/stripepayment/lib/downgrade.ts
index 71e309fefe7..03bdf671e13 100755
--- a/packages/stripe/downgrade.ts
+++ b/packages/app-store/stripepayment/lib/downgrade.ts
@@ -5,10 +5,10 @@ import { Prisma, UserPlan } from "@prisma/client";
import dayjs from "@calcom/dayjs";
import { TRIAL_LIMIT_DAYS } from "@calcom/lib/constants";
import prisma from "@calcom/prisma";
-import stripe from "@calcom/stripe/server";
// import { isPremiumUserName } from "../../apps/website/lib/username";
import { getStripeCustomerIdFromUserId } from "./customer";
+import stripe from "./server";
import { getPremiumPlanPrice, getProPlanPrice, getProPlanProduct } from "./utils";
export async function downgradeIllegalProUsers() {
diff --git a/packages/stripe/index.ts b/packages/app-store/stripepayment/lib/index.ts
similarity index 100%
rename from packages/stripe/index.ts
rename to packages/app-store/stripepayment/lib/index.ts
diff --git a/packages/stripe/server.ts b/packages/app-store/stripepayment/lib/server.ts
similarity index 98%
rename from packages/stripe/server.ts
rename to packages/app-store/stripepayment/lib/server.ts
index 0e4a3d0096f..4211e06c482 100644
--- a/packages/stripe/server.ts
+++ b/packages/app-store/stripepayment/lib/server.ts
@@ -3,12 +3,12 @@ import Stripe from "stripe";
import { v4 as uuidv4 } from "uuid";
import { z } from "zod";
-import getAppKeysFromSlug from "@calcom/app-store/_utils/getAppKeysFromSlug";
import { sendAwaitingPaymentEmail, sendOrganizerPaymentRefundFailedEmail } from "@calcom/emails";
import { getErrorFromUnknown } from "@calcom/lib/errors";
import prisma from "@calcom/prisma";
import type { CalendarEvent } from "@calcom/types/Calendar";
+import getAppKeysFromSlug from "../../_utils/getAppKeysFromSlug";
import { createPaymentLink } from "./client";
export type PaymentData = Stripe.Response<Stripe.PaymentIntent> & {
diff --git a/packages/stripe/subscriptions.ts b/packages/app-store/stripepayment/lib/subscriptions.ts
similarity index 97%
rename from packages/stripe/subscriptions.ts
rename to packages/app-store/stripepayment/lib/subscriptions.ts
index 4d5a88e5c34..a4a4eafa40c 100644
--- a/packages/stripe/subscriptions.ts
+++ b/packages/app-store/stripepayment/lib/subscriptions.ts
@@ -1,8 +1,7 @@
import { UserPlan } from "@prisma/client";
import Stripe from "stripe";
-import stripe from "@calcom/stripe/server";
-
+import stripe from "./server";
import {
getFreePlanPrice,
getPremiumPlanPrice,
diff --git a/packages/stripe/team-billing.ts b/packages/app-store/stripepayment/lib/team-billing.ts
similarity index 99%
rename from packages/stripe/team-billing.ts
rename to packages/app-store/stripepayment/lib/team-billing.ts
index b153496ca95..e9868fead62 100644
--- a/packages/stripe/team-billing.ts
+++ b/packages/app-store/stripepayment/lib/team-billing.ts
@@ -4,9 +4,9 @@ import Stripe from "stripe";
import { HOSTED_CAL_FEATURES } from "@calcom/lib/constants";
import { HttpError } from "@calcom/lib/http-error";
import prisma from "@calcom/prisma";
-import stripe from "@calcom/stripe/server";
import { getStripeCustomerIdFromUserId } from "./customer";
+import stripe from "./server";
import { getPerSeatProPlanPrice, getPremiumPlanPrice, getProPlanPrice } from "./utils";
// get team owner's Pro Plan subscription from Cal userId
diff --git a/packages/stripe/utils.ts b/packages/app-store/stripepayment/lib/utils.ts
similarity index 100%
rename from packages/stripe/utils.ts
rename to packages/app-store/stripepayment/lib/utils.ts
diff --git a/packages/app-store/stripepayment/package.json b/packages/app-store/stripepayment/package.json
index a8a0fd3397c..1a8f9d7d95f 100644
--- a/packages/app-store/stripepayment/package.json
+++ b/packages/app-store/stripepayment/package.json
@@ -6,10 +6,25 @@
"version": "0.0.0",
"main": "./index.ts",
"description": "A Saas company a payment processing software, and application programming interfaces for e-commerce websites and mobile applications.",
+ "scripts": {
+ "downgrade": "ts-node ./downgrade.ts"
+ },
"dependencies": {
- "@calcom/prisma": "*"
+ "@calcom/app-store": "*",
+ "@calcom/dayjs": "*",
+ "@calcom/emails": "*",
+ "@calcom/features": "*",
+ "@calcom/lib": "*",
+ "@calcom/prisma": "*",
+ "@calcom/types": "*",
+ "@stripe/react-stripe-js": "^1.8.0",
+ "@stripe/stripe-js": "^1.29.0",
+ "stripe": "^9.1.0",
+ "uuid": "^8.3.2",
+ "zod": "^3.16.0"
},
"devDependencies": {
- "@calcom/types": "*"
+ "@calcom/types": "*",
+ "ts-node": "^10.6.0"
}
}
diff --git a/packages/app-store/tsconfig.json b/packages/app-store/tsconfig.json
index 5c7de9fd4d4..2cf1a3c3df5 100644
--- a/packages/app-store/tsconfig.json
+++ b/packages/app-store/tsconfig.json
@@ -6,7 +6,6 @@
"paths": {
"@components/*": ["../../apps/web/components/*"],
"@lib/*": ["../../apps/web/lib/*"],
- "@server/*": ["../../apps/web/server/*"],
"@prisma/client/*": ["@calcom/prisma/client/*"]
},
"resolveJsonModule": true
diff --git a/packages/app-store/vital/lib/reschedule.ts b/packages/app-store/vital/lib/reschedule.ts
index 2ec90964afc..b3e0a6f25dd 100644
--- a/packages/app-store/vital/lib/reschedule.ts
+++ b/packages/app-store/vital/lib/reschedule.ts
@@ -10,7 +10,7 @@ import { sendRequestRescheduleEmail } from "@calcom/emails";
import logger from "@calcom/lib/logger";
import { getTranslation } from "@calcom/lib/server/i18n";
import prisma from "@calcom/prisma";
-import { Person } from "@calcom/types/Calendar";
+import type { Person } from "@calcom/types/Calendar";
import { getCalendar } from "../../_utils/getCalendar";
diff --git a/packages/app-store/wipemycalother/lib/reschedule.ts b/packages/app-store/wipemycalother/lib/reschedule.ts
index 8ffb389f04e..d43541d7316 100644
--- a/packages/app-store/wipemycalother/lib/reschedule.ts
+++ b/packages/app-store/wipemycalother/lib/reschedule.ts
@@ -10,7 +10,7 @@ import { sendRequestRescheduleEmail } from "@calcom/emails";
import logger from "@calcom/lib/logger";
import { getTranslation } from "@calcom/lib/server/i18n";
import prisma from "@calcom/prisma";
-import { Person } from "@calcom/types/Calendar";
+import type { Person } from "@calcom/types/Calendar";
import { getCalendar } from "../../_utils/getCalendar";
diff --git a/packages/app-store/zapier/api/subscriptions/addSubscription.ts b/packages/app-store/zapier/api/subscriptions/addSubscription.ts
index d1e32c6cba3..dbb535d4d3b 100644
--- a/packages/app-store/zapier/api/subscriptions/addSubscription.ts
+++ b/packages/app-store/zapier/api/subscriptions/addSubscription.ts
@@ -1,7 +1,7 @@
import type { NextApiRequest, NextApiResponse } from "next";
import { v4 } from "uuid";
-import findValidApiKey from "@calcom/ee/lib/api/findValidApiKey";
+import findValidApiKey from "@calcom/features/ee/api-keys/lib/findValidApiKey";
import prisma from "@calcom/prisma";
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
diff --git a/packages/app-store/zapier/api/subscriptions/deleteSubscription.ts b/packages/app-store/zapier/api/subscriptions/deleteSubscription.ts
index 52084db6c26..5d645d3109b 100644
--- a/packages/app-store/zapier/api/subscriptions/deleteSubscription.ts
+++ b/packages/app-store/zapier/api/subscriptions/deleteSubscription.ts
@@ -1,6 +1,6 @@
import type { NextApiRequest, NextApiResponse } from "next";
-import findValidApiKey from "@calcom/ee/lib/api/findValidApiKey";
+import findValidApiKey from "@calcom/features/ee/api-keys/lib/findValidApiKey";
import prisma from "@calcom/prisma";
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
diff --git a/packages/app-store/zapier/api/subscriptions/listBookings.ts b/packages/app-store/zapier/api/subscriptions/listBookings.ts
index 7afcdfa0d0c..375587dde35 100644
--- a/packages/app-store/zapier/api/subscriptions/listBookings.ts
+++ b/packages/app-store/zapier/api/subscriptions/listBookings.ts
@@ -1,6 +1,6 @@
import type { NextApiRequest, NextApiResponse } from "next";
-import findValidApiKey from "@calcom/ee/lib/api/findValidApiKey";
+import findValidApiKey from "@calcom/features/ee/api-keys/lib/findValidApiKey";
import prisma, { bookingMinimalSelect } from "@calcom/prisma";
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
diff --git a/packages/app-store/zapier/api/subscriptions/me.ts b/packages/app-store/zapier/api/subscriptions/me.ts
index 11318730423..f2bb119b9b2 100644
--- a/packages/app-store/zapier/api/subscriptions/me.ts
+++ b/packages/app-store/zapier/api/subscriptions/me.ts
@@ -1,6 +1,6 @@
import type { NextApiRequest, NextApiResponse } from "next";
-import findValidApiKey from "@calcom/ee/lib/api/findValidApiKey";
+import findValidApiKey from "@calcom/features/ee/api-keys/lib/findValidApiKey";
import prisma from "@calcom/prisma";
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
diff --git a/packages/core/builders/CalendarEvent/builder.ts b/packages/core/builders/CalendarEvent/builder.ts
index 0ae27e90912..7e2423e881f 100644
--- a/packages/core/builders/CalendarEvent/builder.ts
+++ b/packages/core/builders/CalendarEvent/builder.ts
@@ -6,7 +6,7 @@ import dayjs from "@calcom/dayjs";
import { WEBAPP_URL } from "@calcom/lib/constants";
import { getTranslation } from "@calcom/lib/server/i18n";
import prisma from "@calcom/prisma";
-import { CalendarEvent } from "@calcom/types/Calendar";
+import type { CalendarEvent } from "@calcom/types/Calendar";
import { CalendarEventClass } from "./class";
diff --git a/packages/core/builders/CalendarEvent/class.ts b/packages/core/builders/CalendarEvent/class.ts
index 60a8e6351a9..d74d9a37392 100644
--- a/packages/core/builders/CalendarEvent/class.ts
+++ b/packages/core/builders/CalendarEvent/class.ts
@@ -1,6 +1,6 @@
import { DestinationCalendar } from "@prisma/client";
-import { AdditionalInformation, CalendarEvent, ConferenceData, Person } from "@calcom/types/Calendar";
+import type { AdditionalInformation, CalendarEvent, ConferenceData, Person } from "@calcom/types/Calendar";
class CalendarEventClass implements CalendarEvent {
type!: string;
diff --git a/packages/ee/index.ts b/packages/ee/index.ts
deleted file mode 100644
index 29bef9e09dc..00000000000
--- a/packages/ee/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from "lib/core/checkPremiumUsername";
diff --git a/packages/ee/tsconfig.json b/packages/ee/tsconfig.json
deleted file mode 100644
index 184d5dec703..00000000000
--- a/packages/ee/tsconfig.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "extends": "@calcom/tsconfig/base.json",
- "compilerOptions": {
- "baseUrl": "."
- },
- "include": ["."],
- "exclude": ["dist", "build", "node_modules"]
-}
diff --git a/packages/emails/src/components/WhenInfo.tsx b/packages/emails/src/components/WhenInfo.tsx
index dab3311014d..7318ad5d675 100644
--- a/packages/emails/src/components/WhenInfo.tsx
+++ b/packages/emails/src/components/WhenInfo.tsx
@@ -4,7 +4,7 @@ import rrule from "rrule";
import dayjs from "@calcom/dayjs";
import { getEveryFreqFor } from "@calcom/lib/recurringStrings";
import type { CalendarEvent } from "@calcom/types/Calendar";
-import { RecurringEvent } from "@calcom/types/Calendar";
+import type { RecurringEvent } from "@calcom/types/Calendar";
import { Info } from "./Info";
diff --git a/packages/embeds/embed-core/playwright/lib/testUtils.ts b/packages/embeds/embed-core/playwright/lib/testUtils.ts
index 0b289848ee7..25b7fa0e71c 100644
--- a/packages/embeds/embed-core/playwright/lib/testUtils.ts
+++ b/packages/embeds/embed-core/playwright/lib/testUtils.ts
@@ -1,6 +1,6 @@
import { Page, Frame, test, expect } from "@playwright/test";
-import prisma from "@lib/prisma";
+import prisma from "@calcom/prisma";
export function todo(title: string) {
test.skip(title, () => {});
diff --git a/packages/features/auth/README.md b/packages/features/auth/README.md
new file mode 100644
index 00000000000..86d06a48ef8
--- /dev/null
+++ b/packages/features/auth/README.md
@@ -0,0 +1 @@
+# Auth-related code will live here
diff --git a/packages/features/availability/README.md b/packages/features/availability/README.md
new file mode 100644
index 00000000000..85af1647b0c
--- /dev/null
+++ b/packages/features/availability/README.md
@@ -0,0 +1,4 @@
+# Availability related code will live here
+
+- [ ] Maybe migrate `getBusyTimes` here
+- [ ] Maybe migrate `getUserAvailability` here (or into `users` feature)
diff --git a/packages/features/bookings/README.md b/packages/features/bookings/README.md
new file mode 100644
index 00000000000..0ae962c58d5
--- /dev/null
+++ b/packages/features/bookings/README.md
@@ -0,0 +1 @@
+# Bookings related code will live here
diff --git a/packages/features/calendars/README.md b/packages/features/calendars/README.md
new file mode 100644
index 00000000000..6a2c99a3e24
--- /dev/null
+++ b/packages/features/calendars/README.md
@@ -0,0 +1,4 @@
+# Calendars related code will live here
+
+- [ ] Maybe migrate `CalendarManager` here
+- [ ] Maybe migrate `EventManager` here
diff --git a/packages/features/conferencing/README.md b/packages/features/conferencing/README.md
new file mode 100644
index 00000000000..1557b498da2
--- /dev/null
+++ b/packages/features/conferencing/README.md
@@ -0,0 +1,3 @@
+# Conferencing related code will live here
+
+- [ ] Maybe migrate `videoClient` here
diff --git a/packages/ee/LICENSE b/packages/features/ee/LICENSE
similarity index 100%
rename from packages/ee/LICENSE
rename to packages/features/ee/LICENSE
diff --git a/packages/ee/README.md b/packages/features/ee/README.md
similarity index 100%
rename from packages/ee/README.md
rename to packages/features/ee/README.md
diff --git a/apps/web/ee/components/apiKeys/ApiKeyDialogForm.tsx b/packages/features/ee/api-keys/components/ApiKeyDialogForm.tsx
similarity index 97%
rename from apps/web/ee/components/apiKeys/ApiKeyDialogForm.tsx
rename to packages/features/ee/api-keys/components/ApiKeyDialogForm.tsx
index 635e171a8fd..ee418ca696d 100644
--- a/apps/web/ee/components/apiKeys/ApiKeyDialogForm.tsx
+++ b/packages/features/ee/api-keys/components/ApiKeyDialogForm.tsx
@@ -11,10 +11,9 @@ import { ClipboardCopyIcon } from "@calcom/ui/Icon";
import Switch from "@calcom/ui/Switch";
import { Tooltip } from "@calcom/ui/Tooltip";
import { Form, TextField } from "@calcom/ui/form/fields";
+import DatePicker from "@calcom/ui/v2/form/DatePicker";
-import { DatePicker } from "@components/ui/form/DatePicker";
-
-import LicenseRequired from "../LicenseRequired";
+import LicenseRequired from "../../common/components/LicenseRequired";
import type { TApiKeys } from "./ApiKeyListItem";
export default function ApiKeyDialogForm(props: {
diff --git a/apps/web/ee/components/apiKeys/ApiKeyListContainer.tsx b/packages/features/ee/api-keys/components/ApiKeyListContainer.tsx
similarity index 82%
rename from apps/web/ee/components/apiKeys/ApiKeyListContainer.tsx
rename to packages/features/ee/api-keys/components/ApiKeyListContainer.tsx
index ce564e6e4f5..f1866e92445 100644
--- a/apps/web/ee/components/apiKeys/ApiKeyListContainer.tsx
+++ b/packages/features/ee/api-keys/components/ApiKeyListContainer.tsx
@@ -5,20 +5,18 @@ import { trpc } from "@calcom/trpc/react";
import Button from "@calcom/ui/Button";
import { Dialog, DialogContent } from "@calcom/ui/Dialog";
import { Icon } from "@calcom/ui/Icon";
-import ApiKeyDialogForm from "@ee/components/apiKeys/ApiKeyDialogForm";
-import ApiKeyListItem, { TApiKeys } from "@ee/components/apiKeys/ApiKeyListItem";
+import { List } from "@calcom/ui/List";
+import { ShellSubHeading } from "@calcom/ui/Shell";
+import SkeletonLoader from "@calcom/ui/apps/SkeletonLoader";
-import { QueryCell } from "@lib/QueryCell";
-
-import { List } from "@components/List";
-import { ShellSubHeading } from "@components/Shell";
-import SkeletonLoader from "@components/apps/SkeletonLoader";
-
-import LicenseRequired from "../LicenseRequired";
+import LicenseRequired from "../../common/components/LicenseRequired";
+import ApiKeyDialogForm from "./ApiKeyDialogForm";
+import ApiKeyListItem, { TApiKeys } from "./ApiKeyListItem";
function ApiKeyListContainer() {
const { t } = useLocale();
const query = trpc.useQuery(["viewer.apiKeys.list"]);
+ const data = query.data;
const [newApiKeyModal, setNewApiKeyModal] = useState(false);
const [editModalOpen, setEditModalOpen] = useState(false);
@@ -34,10 +32,10 @@ function ApiKeyListContainer() {
}
/>
<LicenseRequired>
- <QueryCell
- query={query}
- customLoader={<SkeletonLoader />}
- success={({ data }) => (
+ {(() => {
+ if (query.isLoading) return <SkeletonLoader />;
+ if (!data) return null;
+ return (
<>
{data.length > 0 && (
<List className="mt-6">
@@ -77,8 +75,8 @@ function ApiKeyListContainer() {
</DialogContent>
</Dialog>
</>
- )}
- />
+ );
+ })()}
</LicenseRequired>
</div>
);
diff --git a/apps/web/ee/components/apiKeys/ApiKeyListItem.tsx b/packages/features/ee/api-keys/components/ApiKeyListItem.tsx
similarity index 95%
rename from apps/web/ee/components/apiKeys/ApiKeyListItem.tsx
rename to packages/features/ee/api-keys/components/ApiKeyListItem.tsx
index 651566738e6..4d7b2bfea43 100644
--- a/apps/web/ee/components/apiKeys/ApiKeyListItem.tsx
+++ b/packages/features/ee/api-keys/components/ApiKeyListItem.tsx
@@ -2,15 +2,14 @@ import dayjs from "@calcom/dayjs";
import classNames from "@calcom/lib/classNames";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { inferQueryOutput, trpc } from "@calcom/trpc/react";
+import Badge from "@calcom/ui/Badge";
import Button from "@calcom/ui/Button";
+import ConfirmationDialogContent from "@calcom/ui/ConfirmationDialogContent";
import { Dialog, DialogTrigger } from "@calcom/ui/Dialog";
import { Icon } from "@calcom/ui/Icon";
+import { ListItem } from "@calcom/ui/List";
import { Tooltip } from "@calcom/ui/Tooltip";
-import { ListItem } from "@components/List";
-import ConfirmationDialogContent from "@components/dialog/ConfirmationDialogContent";
-import Badge from "@components/ui/Badge";
-
export type TApiKeys = inferQueryOutput<"viewer.apiKeys.list">[number];
export default function ApiKeyListItem(props: { apiKey: TApiKeys; onEditApiKey: () => void }) {
diff --git a/packages/ee/lib/api/apiKeys.ts b/packages/features/ee/api-keys/lib/apiKeys.ts
similarity index 100%
rename from packages/ee/lib/api/apiKeys.ts
rename to packages/features/ee/api-keys/lib/apiKeys.ts
diff --git a/packages/ee/lib/api/findValidApiKey.ts b/packages/features/ee/api-keys/lib/findValidApiKey.ts
similarity index 89%
rename from packages/ee/lib/api/findValidApiKey.ts
rename to packages/features/ee/api-keys/lib/findValidApiKey.ts
index 2aeeb7c78db..aa5035c08a5 100644
--- a/packages/ee/lib/api/findValidApiKey.ts
+++ b/packages/features/ee/api-keys/lib/findValidApiKey.ts
@@ -1,4 +1,4 @@
-import { hashAPIKey } from "@calcom/ee/lib/api/apiKeys";
+import { hashAPIKey } from "@calcom/features/ee/api-keys/lib/apiKeys";
import prisma from "@calcom/prisma";
const findValidApiKey = async (apiKey: string, appId?: string) => {
diff --git a/apps/web/ee/components/LicenseBanner.tsx b/packages/features/ee/common/components/LicenseBanner.tsx
similarity index 97%
rename from apps/web/ee/components/LicenseBanner.tsx
rename to packages/features/ee/common/components/LicenseBanner.tsx
index 6851b2ce299..aa24ef0e2e0 100644
--- a/apps/web/ee/components/LicenseBanner.tsx
+++ b/packages/features/ee/common/components/LicenseBanner.tsx
@@ -1,12 +1,11 @@
import { Trans } from "react-i18next";
+import ConfirmationDialogContent from "@calcom/ui/ConfirmationDialogContent";
import { Dialog, DialogTrigger } from "@calcom/ui/Dialog";
import { Icon, BadgeCheckIcon } from "@calcom/ui/Icon";
import { useLocale } from "@lib/hooks/useLocale";
-import ConfirmationDialogContent from "@components/dialog/ConfirmationDialogContent";
-
export default function LicenseBanner() {
const { t } = useLocale();
/*
diff --git a/apps/web/ee/components/LicenseRequired.tsx b/packages/features/ee/common/components/LicenseRequired.tsx
similarity index 82%
rename from apps/web/ee/components/LicenseRequired.tsx
rename to packages/features/ee/common/components/LicenseRequired.tsx
index 2e8fe83580b..cfa577267ad 100644
--- a/apps/web/ee/components/LicenseRequired.tsx
+++ b/packages/features/ee/common/components/LicenseRequired.tsx
@@ -1,5 +1,5 @@
import { useSession } from "next-auth/react";
-import React, { AriaRole, ComponentType, FC, Fragment } from "react";
+import React, { AriaRole, ComponentType, Fragment } from "react";
import { CONSOLE_URL } from "@calcom/lib/constants";
import EmptyScreen from "@calcom/ui/EmptyScreen";
@@ -16,7 +16,7 @@ type LicenseRequiredProps = {
* This component will only render it's children if the installation has a valid
* license.
*/
-const LicenseRequired: FC<LicenseRequiredProps> = ({ children, as = "", ...rest }) => {
+const LicenseRequired = ({ children, as = "", ...rest }: LicenseRequiredProps) => {
const session = useSession();
const Component = as || Fragment;
return (
@@ -47,15 +47,14 @@ const LicenseRequired: FC<LicenseRequiredProps> = ({ children, as = "", ...rest
);
};
-export function withLicenseRequired<T>(Component: ComponentType<T>) {
+export const withLicenseRequired =
+ <T,>(Component: ComponentType<T>) =>
// eslint-disable-next-line react/display-name
- return (hocProps: T) => {
- return (
+ (hocProps: T) =>
+ (
<LicenseRequired>
- <Component {...(hocProps as T)} />;
+ <Component {...hocProps} />
</LicenseRequired>
);
- };
-}
export default LicenseRequired;
diff --git a/apps/web/ee/components/saml/Configuration.tsx b/packages/features/ee/common/components/SamlConfiguration.tsx
similarity index 96%
rename from apps/web/ee/components/saml/Configuration.tsx
rename to packages/features/ee/common/components/SamlConfiguration.tsx
index d2e4fe34d3f..47f19e84d5c 100644
--- a/apps/web/ee/components/saml/Configuration.tsx
+++ b/packages/features/ee/common/components/SamlConfiguration.tsx
@@ -2,18 +2,16 @@ import React, { useEffect, useRef, useState } from "react";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import showToast from "@calcom/lib/notification";
+import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@calcom/lib/telemetry";
import { trpc } from "@calcom/trpc/react";
import { Alert } from "@calcom/ui/Alert";
+import Badge from "@calcom/ui/Badge";
import Button from "@calcom/ui/Button";
+import ConfirmationDialogContent from "@calcom/ui/ConfirmationDialogContent";
import { Dialog, DialogTrigger } from "@calcom/ui/Dialog";
import { TextArea } from "@calcom/ui/form/fields";
-import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@lib/telemetry";
-
-import ConfirmationDialogContent from "@components/dialog/ConfirmationDialogContent";
-import Badge from "@components/ui/Badge";
-
-import LicenseRequired from "../LicenseRequired";
+import LicenseRequired from "./LicenseRequired";
export default function SAMLConfiguration({
teamsView,
diff --git a/apps/web/ee/components/TrialBanner.tsx b/packages/features/ee/common/components/TrialBanner.tsx
similarity index 100%
rename from apps/web/ee/components/TrialBanner.tsx
rename to packages/features/ee/common/components/TrialBanner.tsx
diff --git a/packages/ee/lib/core/checkPremiumUsername.ts b/packages/features/ee/common/lib/checkPremiumUsername.ts
similarity index 100%
rename from packages/ee/lib/core/checkPremiumUsername.ts
rename to packages/features/ee/common/lib/checkPremiumUsername.ts
diff --git a/packages/ee/server/checkLicense.ts b/packages/features/ee/common/server/checkLicense.ts
similarity index 100%
rename from packages/ee/server/checkLicense.ts
rename to packages/features/ee/common/server/checkLicense.ts
diff --git a/apps/web/components/ui/ImpersonatingBanner.tsx b/packages/features/ee/impersonation/components/ImpersonatingBanner.tsx
similarity index 100%
rename from apps/web/components/ui/ImpersonatingBanner.tsx
rename to packages/features/ee/impersonation/components/ImpersonatingBanner.tsx
diff --git a/apps/web/ee/lib/impersonation/ImpersonationProvider.ts b/packages/features/ee/impersonation/lib/ImpersonationProvider.ts
similarity index 99%
rename from apps/web/ee/lib/impersonation/ImpersonationProvider.ts
rename to packages/features/ee/impersonation/lib/ImpersonationProvider.ts
index 901a274a4db..d7c541736cb 100644
--- a/apps/web/ee/lib/impersonation/ImpersonationProvider.ts
+++ b/packages/features/ee/impersonation/lib/ImpersonationProvider.ts
@@ -2,8 +2,9 @@ import { User } from "@prisma/client";
import CredentialsProvider from "next-auth/providers/credentials";
import { getSession } from "next-auth/react";
+import prisma from "@calcom/prisma";
+
import { asNumberOrThrow } from "@lib/asStringOrNull";
-import prisma from "@lib/prisma";
const auditAndReturnNextUser = async (
impersonatedUser: Pick<User, "id" | "username" | "email" | "name" | "role">,
diff --git a/packages/features/ee/index.ts b/packages/features/ee/index.ts
new file mode 100644
index 00000000000..a15d2b584ad
--- /dev/null
+++ b/packages/features/ee/index.ts
@@ -0,0 +1 @@
+export { default } from "./common/server/checkLicense";
diff --git a/packages/ee/package.json b/packages/features/ee/package.json
similarity index 63%
rename from packages/ee/package.json
rename to packages/features/ee/package.json
index 6f055cff6bb..e15e4a75001 100644
--- a/packages/ee/package.json
+++ b/packages/features/ee/package.json
@@ -3,16 +3,17 @@
"description": "Cal.com Enterprise Edition features",
"version": "0.0.0",
"private": true,
- "license": "AGPLv3",
+ "license": "See license in LICENSE",
"main": "./index.ts",
- "scripts": {
- "clean": "rm -rf .turbo && rm -rf node_modules"
- },
"dependencies": {
"@calcom/lib": "*",
+ "@calcom/ui": "*",
+ "@hookform/error-message": "^2.0.0",
+ "@hookform/resolvers": "^2.9.7",
"@sendgrid/client": "^7.6.2",
"@sendgrid/mail": "^7.6.2",
- "twilio": "^3.75.1"
+ "twilio": "^3.75.1",
+ "zod": "^3.16.0"
},
"devDependencies": {
"@calcom/tsconfig": "*"
diff --git a/apps/web/ee/pages/api/integrations/stripepayment/webhook.ts b/packages/features/ee/payments/api/webhook.ts
similarity index 98%
rename from apps/web/ee/pages/api/integrations/stripepayment/webhook.ts
rename to packages/features/ee/payments/api/webhook.ts
index d204d5bff7c..775ea0cade2 100644
--- a/apps/web/ee/pages/api/integrations/stripepayment/webhook.ts
+++ b/packages/features/ee/payments/api/webhook.ts
@@ -3,13 +3,13 @@ import { buffer } from "micro";
import type { NextApiRequest, NextApiResponse } from "next";
import Stripe from "stripe";
+import stripe from "@calcom/app-store/stripepayment/lib/server";
import EventManager from "@calcom/core/EventManager";
import { sendScheduledEmails } from "@calcom/emails";
import { isPrismaObjOrUndefined, parseRecurringEvent } from "@calcom/lib";
import { getErrorFromUnknown } from "@calcom/lib/errors";
import prisma, { bookingMinimalSelect } from "@calcom/prisma";
-import stripe from "@calcom/stripe/server";
-import { CalendarEvent } from "@calcom/types/Calendar";
+import type { CalendarEvent } from "@calcom/types/Calendar";
import { IS_PRODUCTION } from "@lib/config/constants";
import { HttpError as HttpCode } from "@lib/core/http/error";
diff --git a/apps/web/ee/components/stripe/Payment.tsx b/packages/features/ee/payments/components/Payment.tsx
similarity index 98%
rename from apps/web/ee/components/stripe/Payment.tsx
rename to packages/features/ee/payments/components/Payment.tsx
index 25756748e6b..647719d9672 100644
--- a/apps/web/ee/components/stripe/Payment.tsx
+++ b/packages/features/ee/payments/components/Payment.tsx
@@ -4,7 +4,7 @@ import { useRouter } from "next/router";
import { stringify } from "querystring";
import React, { SyntheticEvent, useEffect, useState } from "react";
-import { PaymentData } from "@calcom/stripe/server";
+import { PaymentData } from "@calcom/app-store/stripepayment/lib/server";
import Button from "@calcom/ui/Button";
import { useLocale } from "@lib/hooks/useLocale";
diff --git a/apps/web/ee/components/stripe/PaymentPage.tsx b/packages/features/ee/payments/components/PaymentPage.tsx
similarity index 94%
rename from apps/web/ee/components/stripe/PaymentPage.tsx
rename to packages/features/ee/payments/components/PaymentPage.tsx
index 52f9b2e7d0d..3e3b381b354 100644
--- a/apps/web/ee/components/stripe/PaymentPage.tsx
+++ b/packages/features/ee/payments/components/PaymentPage.tsx
@@ -4,18 +4,18 @@ import Head from "next/head";
import { FC, useEffect, useState } from "react";
import { FormattedNumber, IntlProvider } from "react-intl";
+import { LocationOptionsToString } from "@calcom/app-store/locations";
+import getStripe from "@calcom/app-store/stripepayment/lib/client";
import dayjs from "@calcom/dayjs";
import { sdkActionManager, useIsEmbed } from "@calcom/embed-core/embed-iframe";
import { WEBSITE_URL } from "@calcom/lib/constants";
-import getStripe from "@calcom/stripe/client";
+import { useLocale } from "@calcom/lib/hooks/useLocale";
+import useTheme from "@calcom/lib/hooks/useTheme";
+import { isBrowserLocale24h } from "@calcom/lib/timeFormat";
import { Icon } from "@calcom/ui/Icon";
-import PaymentComponent from "@ee/components/stripe/Payment";
-import { PaymentPageProps } from "@ee/pages/payment/[uid]";
-import { useLocale } from "@lib/hooks/useLocale";
-import useTheme from "@lib/hooks/useTheme";
-import { LocationOptionsToString } from "@lib/locationOptions";
-import { isBrowserLocale24h } from "@lib/timeFormat";
+import type { PaymentPageProps } from "../pages/payment";
+import PaymentComponent from "./Payment";
const PaymentPage: FC<PaymentPageProps> = (props) => {
const { t } = useLocale();
diff --git a/apps/web/ee/pages/payment/[uid].tsx b/packages/features/ee/payments/pages/payment.tsx
similarity index 87%
rename from apps/web/ee/pages/payment/[uid].tsx
rename to packages/features/ee/payments/pages/payment.tsx
index c43d19a3b39..0b0c2be83c4 100644
--- a/apps/web/ee/pages/payment/[uid].tsx
+++ b/packages/features/ee/payments/pages/payment.tsx
@@ -1,17 +1,21 @@
import { GetServerSidePropsContext } from "next";
+import { z } from "zod";
-import { PaymentData } from "@calcom/stripe/server";
-
-import { asStringOrThrow } from "@lib/asStringOrNull";
-import prisma from "@lib/prisma";
-import { inferSSRProps } from "@lib/types/inferSSRProps";
+import { PaymentData } from "@calcom/app-store/stripepayment/lib/server";
+import prisma from "@calcom/prisma";
+import type { inferSSRProps } from "@calcom/types/inferSSRProps";
export type PaymentPageProps = inferSSRProps<typeof getServerSideProps>;
+const querySchema = z.object({
+ uid: z.string(),
+});
+
export const getServerSideProps = async (context: GetServerSidePropsContext) => {
+ const { uid } = querySchema.parse(context.query);
const rawPayment = await prisma.payment.findFirst({
where: {
- uid: asStringOrThrow(context.query.uid),
+ uid,
},
select: {
data: true,
diff --git a/packages/features/ee/support/components/ContactMenuItem.tsx b/packages/features/ee/support/components/ContactMenuItem.tsx
new file mode 100644
index 00000000000..66d005c4018
--- /dev/null
+++ b/packages/features/ee/support/components/ContactMenuItem.tsx
@@ -0,0 +1,13 @@
+import HelpscoutMenuItem from "../lib/helpscout/HelpscoutMenuItem";
+import IntercomMenuItem from "../lib/intercom/IntercomMenuItem";
+import ZendeskMenuItem from "../lib/zendesk/ZendeskMenuItem";
+
+export default function HelpMenuItem() {
+ return (
+ <>
+ <IntercomMenuItem />
+ <ZendeskMenuItem />
+ <HelpscoutMenuItem />
+ </>
+ );
+}
diff --git a/apps/web/ee/components/support/HelpMenuItem.tsx b/packages/features/ee/support/components/HelpMenuItem.tsx
similarity index 99%
rename from apps/web/ee/components/support/HelpMenuItem.tsx
rename to packages/features/ee/support/components/HelpMenuItem.tsx
index 9bc85f62e7c..6aa1925a0fd 100644
--- a/apps/web/ee/components/support/HelpMenuItem.tsx
+++ b/packages/features/ee/support/components/HelpMenuItem.tsx
@@ -1,14 +1,13 @@
import { useState } from "react";
import { useChat } from "react-live-chat-loader";
+import classNames from "@calcom/lib/classNames";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import showToast from "@calcom/lib/notification";
import { trpc } from "@calcom/trpc/react";
import Button from "@calcom/ui/Button";
import { Icon } from "@calcom/ui/Icon";
-import classNames from "@lib/classNames";
-
import ContactMenuItem from "./ContactMenuItem";
interface HelpMenuItemProps {
diff --git a/apps/web/ee/lib/helpscout/HelpscoutMenuItem.tsx b/packages/features/ee/support/lib/helpscout/HelpscoutMenuItem.tsx
similarity index 100%
rename from apps/web/ee/lib/helpscout/HelpscoutMenuItem.tsx
rename to packages/features/ee/support/lib/helpscout/HelpscoutMenuItem.tsx
diff --git a/apps/web/ee/lib/helpscout/provider.tsx b/packages/features/ee/support/lib/helpscout/provider.tsx
similarity index 100%
rename from apps/web/ee/lib/helpscout/provider.tsx
rename to packages/features/ee/support/lib/helpscout/provider.tsx
diff --git a/apps/web/ee/lib/helpscout/providerDynamic.tsx b/packages/features/ee/support/lib/helpscout/providerDynamic.tsx
similarity index 100%
rename from apps/web/ee/lib/helpscout/providerDynamic.tsx
rename to packages/features/ee/support/lib/helpscout/providerDynamic.tsx
diff --git a/apps/web/ee/lib/intercom/IntercomMenuItem.tsx b/packages/features/ee/support/lib/intercom/IntercomMenuItem.tsx
similarity index 100%
rename from apps/web/ee/lib/intercom/IntercomMenuItem.tsx
rename to packages/features/ee/support/lib/intercom/IntercomMenuItem.tsx
diff --git a/apps/web/ee/lib/intercom/provider.tsx b/packages/features/ee/support/lib/intercom/provider.tsx
similarity index 100%
rename from apps/web/ee/lib/intercom/provider.tsx
rename to packages/features/ee/support/lib/intercom/provider.tsx
diff --git a/apps/web/ee/lib/intercom/providerDynamic.tsx b/packages/features/ee/support/lib/intercom/providerDynamic.tsx
similarity index 100%
rename from apps/web/ee/lib/intercom/providerDynamic.tsx
rename to packages/features/ee/support/lib/intercom/providerDynamic.tsx
diff --git a/apps/web/ee/lib/intercom/useIntercom.ts b/packages/features/ee/support/lib/intercom/useIntercom.ts
similarity index 100%
rename from apps/web/ee/lib/intercom/useIntercom.ts
rename to packages/features/ee/support/lib/intercom/useIntercom.ts
diff --git a/apps/web/ee/lib/zendesk/ZendeskMenuItem.tsx b/packages/features/ee/support/lib/zendesk/ZendeskMenuItem.tsx
similarity index 100%
rename from apps/web/ee/lib/zendesk/ZendeskMenuItem.tsx
rename to packages/features/ee/support/lib/zendesk/ZendeskMenuItem.tsx
diff --git a/apps/web/ee/pages/api/teams/[team]/upgrade.ts b/packages/features/ee/teams/api/upgrade.ts
similarity index 81%
rename from apps/web/ee/pages/api/teams/[team]/upgrade.ts
rename to packages/features/ee/teams/api/upgrade.ts
index d9059d18f88..09b968fedbd 100644
--- a/apps/web/ee/pages/api/teams/[team]/upgrade.ts
+++ b/packages/features/ee/teams/api/upgrade.ts
@@ -1,8 +1,7 @@
import type { NextApiRequest, NextApiResponse } from "next";
-import { upgradeTeam } from "@calcom/stripe/team-billing";
-
-import { getSession } from "@lib/auth";
+import { upgradeTeam } from "@calcom/app-store/stripepayment/lib/team-billing";
+import { getSession } from "@calcom/lib/auth";
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
if (req.method === "GET") {
diff --git a/apps/web/ee/components/team/availability/TeamAvailabilityModal.tsx b/packages/features/ee/teams/components/TeamAvailabilityModal.tsx
similarity index 91%
rename from apps/web/ee/components/team/availability/TeamAvailabilityModal.tsx
rename to packages/features/ee/teams/components/TeamAvailabilityModal.tsx
index 9af0f18757d..30d1c681867 100644
--- a/apps/web/ee/components/team/availability/TeamAvailabilityModal.tsx
+++ b/packages/features/ee/teams/components/TeamAvailabilityModal.tsx
@@ -3,13 +3,12 @@ import React, { useState, useEffect } from "react";
import dayjs from "@calcom/dayjs";
import { WEBAPP_URL } from "@calcom/lib/constants";
import { inferQueryOutput, trpc } from "@calcom/trpc/react";
-import LicenseRequired from "@ee/components/LicenseRequired";
-
-import Avatar from "@components/ui/Avatar";
-import { DatePicker } from "@components/ui/form/DatePicker";
-import Select from "@components/ui/form/Select";
-import TimezoneSelect, { ITimezone } from "@components/ui/form/TimezoneSelect";
+import Select from "@calcom/ui/form/Select";
+import TimezoneSelect, { ITimezone } from "@calcom/ui/form/TimezoneSelect";
+import { Avatar } from "@calcom/ui/v2";
+import DatePicker from "@calcom/ui/v2/form/DatePicker";
+import LicenseRequired from "../../common/components/LicenseRequired";
import TeamAvailabilityTimes from "./TeamAvailabilityTimes";
interface Props {
@@ -35,6 +34,7 @@ export default function TeamAvailabilityModal(props: Props) {
<div className="min-w-64 w-64 space-y-5 p-5 pr-0">
<div className="flex">
<Avatar
+ size="sm"
imageSrc={WEBAPP_URL + "/" + props.member?.username + "/avatar.png"}
alt={props.member?.name || ""}
className="h-14 w-14 rounded-full"
diff --git a/apps/web/ee/components/team/availability/TeamAvailabilityScreen.tsx b/packages/features/ee/teams/components/TeamAvailabilityScreen.tsx
similarity index 94%
rename from apps/web/ee/components/team/availability/TeamAvailabilityScreen.tsx
rename to packages/features/ee/teams/components/TeamAvailabilityScreen.tsx
index 8729cc2a6c0..ea77bbc5c9e 100644
--- a/apps/web/ee/components/team/availability/TeamAvailabilityScreen.tsx
+++ b/packages/features/ee/teams/components/TeamAvailabilityScreen.tsx
@@ -5,11 +5,10 @@ import { FixedSizeList as List } from "react-window";
import dayjs from "@calcom/dayjs";
import { CAL_URL } from "@calcom/lib/constants";
import { inferQueryOutput, trpc } from "@calcom/trpc/react";
-
-import Avatar from "@components/ui/Avatar";
-import { DatePicker } from "@components/ui/form/DatePicker";
-import Select from "@components/ui/form/Select";
-import TimezoneSelect, { ITimezone } from "@components/ui/form/TimezoneSelect";
+import Select from "@calcom/ui/form/Select";
+import TimezoneSelect, { ITimezone } from "@calcom/ui/form/TimezoneSelect";
+import Avatar from "@calcom/ui/v2/Avatar";
+import DatePicker from "@calcom/ui/v2/form/DatePicker";
import TeamAvailabilityTimes from "./TeamAvailabilityTimes";
@@ -45,6 +44,7 @@ export default function TeamAvailabilityScreen(props: Props) {
HeaderComponent={
<div className="mb-6 flex items-center">
<Avatar
+ size="sm"
imageSrc={CAL_URL + "/" + member.username + "/avatar.png"}
alt={member?.name || ""}
className="min-w-10 min-h-10 mt-1 h-10 w-10 rounded-full"
diff --git a/apps/web/ee/components/team/availability/TeamAvailabilityTimes.tsx b/packages/features/ee/teams/components/TeamAvailabilityTimes.tsx
similarity index 98%
rename from apps/web/ee/components/team/availability/TeamAvailabilityTimes.tsx
rename to packages/features/ee/teams/components/TeamAvailabilityTimes.tsx
index 601ed1e0c63..9c455e8996d 100644
--- a/apps/web/ee/components/team/availability/TeamAvailabilityTimes.tsx
+++ b/packages/features/ee/teams/components/TeamAvailabilityTimes.tsx
@@ -5,8 +5,7 @@ import { ITimezone } from "react-timezone-select";
import { Dayjs } from "@calcom/dayjs";
import getSlots from "@calcom/lib/slots";
import { trpc } from "@calcom/trpc/react";
-
-import Loader from "@components/Loader";
+import Loader from "@calcom/ui/Loader";
interface Props {
teamId: number;
diff --git a/apps/web/ee/pages/settings/teams/[id]/availability.tsx b/packages/features/ee/teams/pages/availability.tsx
similarity index 80%
rename from apps/web/ee/pages/settings/teams/[id]/availability.tsx
rename to packages/features/ee/teams/pages/availability.tsx
index 13de941875a..9da7fc7b450 100644
--- a/apps/web/ee/pages/settings/teams/[id]/availability.tsx
+++ b/packages/features/ee/teams/pages/availability.tsx
@@ -1,18 +1,17 @@
import { useRouter } from "next/router";
import { useMemo, useState } from "react";
+import { getPlaceholderAvatar } from "@calcom/lib/getPlaceholderAvatar";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { trpc } from "@calcom/trpc/react";
+import useMeQuery from "@calcom/trpc/react/hooks/useMeQuery";
import { Alert } from "@calcom/ui/Alert";
-import LicenseRequired from "@ee/components/LicenseRequired";
-import TeamAvailabilityScreen from "@ee/components/team/availability/TeamAvailabilityScreen";
+import Loader from "@calcom/ui/Loader";
+import Shell from "@calcom/ui/Shell";
+import { Avatar } from "@calcom/ui/v2";
-import { getPlaceholderAvatar } from "@lib/getPlaceholderAvatar";
-import useMeQuery from "@lib/hooks/useMeQuery";
-
-import Loader from "@components/Loader";
-import Shell from "@components/Shell";
-import Avatar from "@components/ui/Avatar";
+import LicenseRequired from "../../common/components/LicenseRequired";
+import TeamAvailabilityScreen from "../components/TeamAvailabilityScreen";
export function TeamAvailabilityPage() {
const { t } = useLocale();
@@ -45,7 +44,7 @@ export function TeamAvailabilityPage() {
team &&
!isFreeUser && (
<Avatar
- size={12}
+ size="sm"
imageSrc={getPlaceholderAvatar(team?.logo, team?.name as string)}
alt="Team Logo"
className="mt-1"
diff --git a/apps/web/web3/abis/abiWithGetBalance.json b/packages/features/ee/web3/abis/abiWithGetBalance.json
similarity index 100%
rename from apps/web/web3/abis/abiWithGetBalance.json
rename to packages/features/ee/web3/abis/abiWithGetBalance.json
diff --git a/apps/web/ee/components/web3/CryptoSection.tsx b/packages/features/ee/web3/components/CryptoSection.tsx
similarity index 75%
rename from apps/web/ee/components/web3/CryptoSection.tsx
rename to packages/features/ee/web3/components/CryptoSection.tsx
index 0056c65f85e..f68af8b6f9b 100644
--- a/apps/web/ee/components/web3/CryptoSection.tsx
+++ b/packages/features/ee/web3/components/CryptoSection.tsx
@@ -8,10 +8,10 @@ import { useLocale } from "@calcom/lib/hooks/useLocale";
import showToast from "@calcom/lib/notification";
import { Button } from "@calcom/ui/Button";
-import { useContracts } from "../../../contexts/contractsContext";
-import genericAbi from "../../../web3/abis/abiWithGetBalance.json";
-import verifyAccount, { AUTH_MESSAGE } from "../../../web3/utils/verifyAccount";
-import { withLicenseRequired } from "../LicenseRequired";
+import { withLicenseRequired } from "../../common/components/LicenseRequired";
+import genericAbi from "../abis/abiWithGetBalance.json";
+import { useContracts } from "../contexts/contractsContext";
+import verifyAccount, { AUTH_MESSAGE } from "../utils/verifyAccount";
interface Window {
ethereum: AbstractProvider & { selectedAddress: string };
@@ -23,7 +23,7 @@ interface EvtsToVerify {
declare const window: Window;
-interface CryptoSectionProps {
+export interface CryptoSectionProps {
id: number | string;
pathname: string;
smartContractAddress: string;
@@ -51,30 +51,22 @@ const CryptoSection = (props: CryptoSectionProps) => {
const verifyWallet = useCallback(async () => {
try {
- if (!window.web3) {
- throw new Error("MetaMask browser extension is not installed");
- }
-
+ if (!window.web3) throw new Error("MetaMask browser extension is not installed");
const contract = new window.web3.eth.Contract(genericAbi as AbiItem[], props.smartContractAddress);
const balance = await contract.methods.balanceOf(window.ethereum.selectedAddress).call();
const hasToken = balance > 0;
- if (!hasToken) {
+ if (!hasToken)
throw new Error("Specified wallet does not own any tokens belonging to this smart contract");
- } else {
- const [account] = await window.web3.eth.getAccounts();
- const signature = await window.web3.eth.personal.sign(AUTH_MESSAGE, account, "");
- addContract({ address: props.smartContractAddress, signature });
-
- await verifyAccount(signature, account);
- props.setEvtsToVerify((prevState: EvtsToVerify) => {
- const changedEvt = { [props.id]: hasToken };
- return { ...prevState, ...changedEvt };
- });
- }
+ const [account] = await window.web3.eth.getAccounts();
+ const signature = await window.web3.eth.personal.sign(AUTH_MESSAGE, account, "");
+ addContract({ address: props.smartContractAddress, signature });
+ await verifyAccount(signature, account);
+ props.setEvtsToVerify((prevState: EvtsToVerify) => ({ ...prevState, [props.id]: hasToken }));
} catch (err) {
- err instanceof Error ? showToast(err.message, "error") : showToast("An error has occurred", "error");
+ const message = err instanceof Error ? err.message : "An error has occurred";
+ showToast(message, "error");
}
}, [props, addContract]);
@@ -90,10 +82,7 @@ const CryptoSection = (props: CryptoSectionProps) => {
const verifyButton = useMemo(() => {
return (
<Button color="secondary" onClick={verifyWallet} type="button" id="hasToken">
- {
- // eslint-disable-next-line @next/next/no-img-element
- <img className="mr-1 h-5" src="/apps/metamask.svg" alt="MetaMask" />
- }
+ <img className="mr-1 h-5" src="/api/app-store/metamask/icon.svg" alt="MetaMask" />
{t("verify_wallet")}
</Button>
);
@@ -104,7 +93,7 @@ const CryptoSection = (props: CryptoSectionProps) => {
<Button color="secondary" onClick={connectMetamask} type="button">
{
// eslint-disable-next-line @next/next/no-img-element
- <img className="mr-1 h-5" src="/apps/metamask.svg" alt="MetaMask" />
+ <img className="mr-1 h-5" src="/api/app-store/metamask/icon.svg" alt="MetaMask" />
}
{t("connect_metamask")}
</Button>
@@ -122,7 +111,7 @@ const CryptoSection = (props: CryptoSectionProps) => {
}}>
{
// eslint-disable-next-line @next/next/no-img-element
- <img className="mr-1 h-5" src="/apps/metamask.svg" alt="MetaMask" />
+ <img className="mr-1 h-5" src="/api/app-store/metamask/icon.svg" alt="MetaMask" />
}
{t("verify_wallet")}
</Button>
diff --git a/apps/web/contexts/contractsContext.tsx b/packages/features/ee/web3/contexts/contractsContext.tsx
similarity index 100%
rename from apps/web/contexts/contractsContext.tsx
rename to packages/features/ee/web3/contexts/contractsContext.tsx
diff --git a/apps/web/web3/utils/verifyAccount.ts b/packages/features/ee/web3/utils/verifyAccount.ts
similarity index 100%
rename from apps/web/web3/utils/verifyAccount.ts
rename to packages/features/ee/web3/utils/verifyAccount.ts
diff --git a/apps/web/ee/pages/api/cron/workflows/scheduleEmailReminders.ts b/packages/features/ee/workflows/api/scheduleEmailReminders.ts
similarity index 95%
rename from apps/web/ee/pages/api/cron/workflows/scheduleEmailReminders.ts
rename to packages/features/ee/workflows/api/scheduleEmailReminders.ts
index fbdafb64e22..e4b6882867a 100644
--- a/apps/web/ee/pages/api/cron/workflows/scheduleEmailReminders.ts
+++ b/packages/features/ee/workflows/api/scheduleEmailReminders.ts
@@ -1,14 +1,14 @@
/* Schedule any workflow reminder that falls within 72 hours for email */
-import { WorkflowActions, WorkflowTemplates, WorkflowMethods } from "@prisma/client";
+import { WorkflowActions, WorkflowMethods, WorkflowTemplates } from "@prisma/client";
import client from "@sendgrid/client";
import sgMail from "@sendgrid/mail";
import type { NextApiRequest, NextApiResponse } from "next";
import dayjs from "@calcom/dayjs";
import { defaultHandler } from "@calcom/lib/server";
-import emailReminderTemplate from "@ee/lib/workflows/reminders/templates/emailReminderTemplate";
+import prisma from "@calcom/prisma";
-import prisma from "@lib/prisma";
+import emailReminderTemplate from "../lib/reminders/templates/emailReminderTemplate";
const sendgridAPIKey = process.env.SENDGRID_API_KEY as string;
const senderEmail = process.env.SENDGRID_EMAIL as string;
diff --git a/apps/web/ee/pages/api/cron/workflows/scheduleSMSReminders.ts b/packages/features/ee/workflows/api/scheduleSMSReminders.ts
similarity index 92%
rename from apps/web/ee/pages/api/cron/workflows/scheduleSMSReminders.ts
rename to packages/features/ee/workflows/api/scheduleSMSReminders.ts
index 9492f865c81..8a0d7d00340 100644
--- a/apps/web/ee/pages/api/cron/workflows/scheduleSMSReminders.ts
+++ b/packages/features/ee/workflows/api/scheduleSMSReminders.ts
@@ -1,13 +1,13 @@
/* Schedule any workflow reminder that falls within 7 days for SMS */
-import { WorkflowActions, WorkflowTemplates, WorkflowMethods } from "@prisma/client";
+import { WorkflowActions, WorkflowMethods, WorkflowTemplates } from "@prisma/client";
import type { NextApiRequest, NextApiResponse } from "next";
import dayjs from "@calcom/dayjs";
import { defaultHandler } from "@calcom/lib/server";
-import * as twilio from "@ee/lib/workflows/reminders/smsProviders/twilioProvider";
-import smsReminderTemplate from "@ee/lib/workflows/reminders/templates/smsReminderTemplate";
+import prisma from "@calcom/prisma";
-import prisma from "@lib/prisma";
+import * as twilio from "../lib/reminders/smsProviders/twilioProvider";
+import smsReminderTemplate from "../lib/reminders/templates/smsReminderTemplate";
async function handler(req: NextApiRequest, res: NextApiResponse) {
const apiKey = req.headers.authorization || req.query.apiKey;
diff --git a/apps/web/ee/components/workflows/AddActionDialog.tsx b/packages/features/ee/workflows/components/AddActionDialog.tsx
similarity index 95%
rename from apps/web/ee/components/workflows/AddActionDialog.tsx
rename to packages/features/ee/workflows/components/AddActionDialog.tsx
index a0fff1a2ea0..ef184cf0b46 100644
--- a/apps/web/ee/components/workflows/AddActionDialog.tsx
+++ b/packages/features/ee/workflows/components/AddActionDialog.tsx
@@ -1,19 +1,19 @@
import { zodResolver } from "@hookform/resolvers/zod";
import { WorkflowActions } from "@prisma/client";
import { isValidPhoneNumber } from "libphonenumber-js";
-import React, { useState, Dispatch, SetStateAction } from "react";
+import { Dispatch, SetStateAction, useState } from "react";
import { Controller, useForm } from "react-hook-form";
import { z } from "zod";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import Button from "@calcom/ui/Button";
import { Dialog, DialogClose, DialogContent, DialogFooter, DialogHeader } from "@calcom/ui/Dialog";
+import PhoneInput from "@calcom/ui/form/PhoneInputLazy";
import Select from "@calcom/ui/form/Select";
import { Form } from "@calcom/ui/form/fields";
-import { WORKFLOW_ACTIONS } from "@ee/lib/workflows/constants";
-import { getWorkflowActionOptions } from "@ee/lib/workflows/getOptions";
-import PhoneInput from "@components/ui/form/PhoneInput";
+import { WORKFLOW_ACTIONS } from "../lib/constants";
+import { getWorkflowActionOptions } from "../lib/getOptions";
interface IAddActionDialog {
isOpenDialog: boolean;
diff --git a/apps/web/ee/components/workflows/NewWorkflowButton.tsx b/packages/features/ee/workflows/components/NewWorkflowButton.tsx
similarity index 96%
rename from apps/web/ee/components/workflows/NewWorkflowButton.tsx
rename to packages/features/ee/workflows/components/NewWorkflowButton.tsx
index 34f4841c2ce..3c37b96caf2 100644
--- a/apps/web/ee/components/workflows/NewWorkflowButton.tsx
+++ b/packages/features/ee/workflows/components/NewWorkflowButton.tsx
@@ -1,29 +1,28 @@
import { zodResolver } from "@hookform/resolvers/zod";
-import { WorkflowTriggerEvents, WorkflowActions, TimeUnit } from "@prisma/client";
+import { TimeUnit, WorkflowActions, WorkflowTriggerEvents } from "@prisma/client";
import { isValidPhoneNumber } from "libphonenumber-js";
import { useRouter } from "next/router";
import { useState } from "react";
-import { useForm, Controller } from "react-hook-form";
+import { Controller, useForm } from "react-hook-form";
import { z } from "zod";
import { useLocale } from "@calcom/lib/hooks/useLocale";
+import { HttpError } from "@calcom/lib/http-error";
import showToast from "@calcom/lib/notification";
import { trpc } from "@calcom/trpc/react";
import { Button } from "@calcom/ui";
import { Dialog, DialogClose, DialogContent, DialogTrigger } from "@calcom/ui/Dialog";
import { Icon } from "@calcom/ui/Icon";
+import PhoneInput from "@calcom/ui/form/PhoneInputLazy";
+import Select from "@calcom/ui/form/Select";
import { Form, TextField } from "@calcom/ui/form/fields";
-import { TIME_UNIT, WORKFLOW_ACTIONS, WORKFLOW_TRIGGER_EVENTS } from "@ee/lib/workflows/constants";
+
+import { TIME_UNIT, WORKFLOW_ACTIONS, WORKFLOW_TRIGGER_EVENTS } from "../lib/constants";
import {
getWorkflowActionOptions,
getWorkflowTimeUnitOptions,
getWorkflowTriggerOptions,
-} from "@ee/lib/workflows/getOptions";
-
-import { HttpError } from "@lib/core/http/error";
-
-import PhoneInput from "@components/ui/form/PhoneInput";
-import Select from "@components/ui/form/Select";
+} from "../lib/getOptions";
type WorkflowFormValues = {
name: string;
diff --git a/apps/web/ee/components/workflows/WorkflowDetailsPage.tsx b/packages/features/ee/workflows/components/WorkflowDetailsPage.tsx
similarity index 93%
rename from apps/web/ee/components/workflows/WorkflowDetailsPage.tsx
rename to packages/features/ee/workflows/components/WorkflowDetailsPage.tsx
index b936a201efd..44ec1edca4d 100644
--- a/apps/web/ee/components/workflows/WorkflowDetailsPage.tsx
+++ b/packages/features/ee/workflows/components/WorkflowDetailsPage.tsx
@@ -1,6 +1,6 @@
import { WorkflowActions, WorkflowTemplates } from "@prisma/client";
import { useRouter } from "next/router";
-import { useState, Dispatch, SetStateAction, useMemo } from "react";
+import { Dispatch, SetStateAction, useMemo, useState } from "react";
import { Controller, UseFormReturn } from "react-hook-form";
import { useLocale } from "@calcom/lib/hooks/useLocale";
@@ -8,12 +8,12 @@ import { HttpError } from "@calcom/lib/http-error";
import showToast from "@calcom/lib/notification";
import { trpc } from "@calcom/trpc/react";
import { Button } from "@calcom/ui";
+import MultiSelectCheckboxes, { Option } from "@calcom/ui/form/MultiSelectCheckboxes";
import { Form } from "@calcom/ui/form/fields";
-import { AddActionDialog } from "@ee/components/workflows/AddActionDialog";
-import WorkflowStepContainer from "@ee/components/workflows/WorkflowStepContainer";
-import { FormValues } from "@ee/pages/workflows/[workflow]";
-import MultiSelectCheckboxes, { Option } from "@components/ui/form/MultiSelectCheckboxes";
+import type { FormValues } from "../pages/workflow";
+import { AddActionDialog } from "./AddActionDialog";
+import WorkflowStepContainer from "./WorkflowStepContainer";
interface Props {
form: UseFormReturn<FormValues>;
diff --git a/apps/web/ee/components/workflows/WorkflowListPage.tsx b/packages/features/ee/workflows/components/WorkflowListPage.tsx
similarity index 98%
rename from apps/web/ee/components/workflows/WorkflowListPage.tsx
rename to packages/features/ee/workflows/components/WorkflowListPage.tsx
index dc28c739f4b..42bb4a41cd1 100644
--- a/apps/web/ee/components/workflows/WorkflowListPage.tsx
+++ b/packages/features/ee/workflows/components/WorkflowListPage.tsx
@@ -2,19 +2,17 @@ import Link from "next/link";
import { useState } from "react";
import { useLocale } from "@calcom/lib/hooks/useLocale";
+import { HttpError } from "@calcom/lib/http-error";
import showToast from "@calcom/lib/notification";
import { EventType, Workflow, WorkflowsOnEventTypes } from "@calcom/prisma/client";
import { trpc } from "@calcom/trpc/react";
import { Button, Tooltip } from "@calcom/ui";
+import ConfirmationDialogContent from "@calcom/ui/ConfirmationDialogContent";
import { Dialog } from "@calcom/ui/Dialog";
import Dropdown, { DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@calcom/ui/Dropdown";
import EmptyScreen from "@calcom/ui/EmptyScreen";
import { Icon } from "@calcom/ui/Icon";
-import { HttpError } from "@lib/core/http/error";
-
-import ConfirmationDialogContent from "@components/dialog/ConfirmationDialogContent";
-
const CreateFirstWorkflowView = () => {
const { t } = useLocale();
diff --git a/apps/web/ee/components/workflows/WorkflowStepContainer.tsx b/packages/features/ee/workflows/components/WorkflowStepContainer.tsx
similarity index 99%
rename from apps/web/ee/components/workflows/WorkflowStepContainer.tsx
rename to packages/features/ee/workflows/components/WorkflowStepContainer.tsx
index b2a15bf6742..75c6b18ae43 100644
--- a/apps/web/ee/components/workflows/WorkflowStepContainer.tsx
+++ b/packages/features/ee/workflows/components/WorkflowStepContainer.tsx
@@ -1,9 +1,9 @@
import {
TimeUnit,
- WorkflowStep,
- WorkflowTriggerEvents,
WorkflowActions,
+ WorkflowStep,
WorkflowTemplates,
+ WorkflowTriggerEvents,
} from "@prisma/client";
import { isValidPhoneNumber } from "libphonenumber-js";
import { Dispatch, SetStateAction, useState } from "react";
@@ -16,14 +16,15 @@ import { Button } from "@calcom/ui";
import Dropdown, { DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@calcom/ui/Dropdown";
import { Icon } from "@calcom/ui/Icon";
import Select from "@calcom/ui/form/Select";
-import { TextField, TextArea } from "@calcom/ui/form/fields";
+import { TextArea, TextField } from "@calcom/ui/form/fields";
+
import {
getWorkflowActionOptions,
getWorkflowTemplateOptions,
getWorkflowTimeUnitOptions,
getWorkflowTriggerOptions,
-} from "@ee/lib/workflows/getOptions";
-import { FormValues } from "@ee/pages/workflows/[workflow]";
+} from "../lib/getOptions";
+import type { FormValues } from "../pages/workflow";
type WorkflowStepProps = {
step?: WorkflowStep;
diff --git a/apps/web/ee/lib/workflows/constants.ts b/packages/features/ee/workflows/lib/constants.ts
similarity index 58%
rename from apps/web/ee/lib/workflows/constants.ts
rename to packages/features/ee/workflows/lib/constants.ts
index 7c72210b324..e940af661cc 100644
--- a/apps/web/ee/lib/workflows/constants.ts
+++ b/packages/features/ee/workflows/lib/constants.ts
@@ -1,21 +1,18 @@
-import { WorkflowTriggerEvents, WorkflowActions, TimeUnit, WorkflowTemplates } from "@prisma/client";
+import { TimeUnit, WorkflowActions, WorkflowTemplates, WorkflowTriggerEvents } from "@prisma/client";
export const WORKFLOW_TRIGGER_EVENTS = [
WorkflowTriggerEvents.BEFORE_EVENT,
WorkflowTriggerEvents.EVENT_CANCELLED,
WorkflowTriggerEvents.NEW_EVENT,
-] as ["BEFORE_EVENT", "EVENT_CANCELLED", "NEW_EVENT"];
+] as const;
export const WORKFLOW_ACTIONS = [
WorkflowActions.EMAIL_HOST,
WorkflowActions.EMAIL_ATTENDEE,
WorkflowActions.SMS_ATTENDEE,
WorkflowActions.SMS_NUMBER,
-] as ["EMAIL_HOST", "EMAIL_ATTENDEE", "SMS_ATTENDEE", "SMS_NUMBER"];
+] as const;
-export const TIME_UNIT = [TimeUnit.DAY, TimeUnit.HOUR, TimeUnit.MINUTE] as ["DAY", "HOUR", "MINUTE"];
+export const TIME_UNIT = [TimeUnit.DAY, TimeUnit.HOUR, TimeUnit.MINUTE] as const;
-export const WORKFLOW_TEMPLATES = [WorkflowTemplates.CUSTOM, WorkflowTemplates.REMINDER] as [
- "CUSTOM",
- "REMINDER"
-];
+export const WORKFLOW_TEMPLATES = [WorkflowTemplates.CUSTOM, WorkflowTemplates.REMINDER] as const;
diff --git a/apps/web/ee/lib/workflows/getOptions.ts b/packages/features/ee/workflows/lib/getOptions.ts
similarity index 86%
rename from apps/web/ee/lib/workflows/getOptions.ts
rename to packages/features/ee/workflows/lib/getOptions.ts
index fee8bec1975..f4f51bac080 100644
--- a/apps/web/ee/lib/workflows/getOptions.ts
+++ b/packages/features/ee/workflows/lib/getOptions.ts
@@ -1,11 +1,6 @@
import { TFunction } from "next-i18next";
-import {
- TIME_UNIT,
- WORKFLOW_ACTIONS,
- WORKFLOW_TEMPLATES,
- WORKFLOW_TRIGGER_EVENTS,
-} from "@ee/lib/workflows/constants";
+import { TIME_UNIT, WORKFLOW_ACTIONS, WORKFLOW_TEMPLATES, WORKFLOW_TRIGGER_EVENTS } from "./constants";
export function getWorkflowActionOptions(t: TFunction) {
return WORKFLOW_ACTIONS.map((action) => {
diff --git a/apps/web/ee/lib/workflows/reminders/emailReminderManager.ts b/packages/features/ee/workflows/lib/reminders/emailReminderManager.ts
similarity index 95%
rename from apps/web/ee/lib/workflows/reminders/emailReminderManager.ts
rename to packages/features/ee/workflows/lib/reminders/emailReminderManager.ts
index 18b434e4439..d31cd7d7cb4 100644
--- a/apps/web/ee/lib/workflows/reminders/emailReminderManager.ts
+++ b/packages/features/ee/workflows/lib/reminders/emailReminderManager.ts
@@ -10,8 +10,9 @@ import sgMail from "@sendgrid/mail";
import dayjs from "@calcom/dayjs";
import prisma from "@calcom/prisma";
-import { BookingInfo, timeUnitLowerCase } from "@ee/lib/workflows/reminders/smsReminderManager";
-import emailReminderTemplate from "@ee/lib/workflows/reminders/templates/emailReminderTemplate";
+
+import { BookingInfo, timeUnitLowerCase } from "./smsReminderManager";
+import emailReminderTemplate from "./templates/emailReminderTemplate";
let sendgridAPIKey, senderEmail: string;
diff --git a/apps/web/ee/lib/workflows/reminders/reminderScheduler.ts b/packages/features/ee/workflows/lib/reminders/reminderScheduler.ts
similarity index 94%
rename from apps/web/ee/lib/workflows/reminders/reminderScheduler.ts
rename to packages/features/ee/workflows/lib/reminders/reminderScheduler.ts
index f01df8a52d1..ede8b20bc70 100644
--- a/apps/web/ee/lib/workflows/reminders/reminderScheduler.ts
+++ b/packages/features/ee/workflows/lib/reminders/reminderScheduler.ts
@@ -1,14 +1,15 @@
import {
Workflow,
- WorkflowsOnEventTypes,
WorkflowActions,
+ WorkflowsOnEventTypes,
WorkflowStep,
WorkflowTriggerEvents,
} from "@prisma/client";
-import { CalendarEvent } from "@calcom/types/Calendar";
-import { scheduleEmailReminder } from "@ee/lib/workflows/reminders/emailReminderManager";
-import { scheduleSMSReminder } from "@ee/lib/workflows/reminders/smsReminderManager";
+import type { CalendarEvent } from "@calcom/types/Calendar";
+
+import { scheduleEmailReminder } from "./emailReminderManager";
+import { scheduleSMSReminder } from "./smsReminderManager";
export const scheduleWorkflowReminders = async (
workflows: (WorkflowsOnEventTypes & {
diff --git a/apps/web/ee/lib/workflows/reminders/smsProviders/twilioProvider.ts b/packages/features/ee/workflows/lib/reminders/smsProviders/twilioProvider.ts
similarity index 100%
rename from apps/web/ee/lib/workflows/reminders/smsProviders/twilioProvider.ts
rename to packages/features/ee/workflows/lib/reminders/smsProviders/twilioProvider.ts
diff --git a/apps/web/ee/lib/workflows/reminders/smsReminderManager.ts b/packages/features/ee/workflows/lib/reminders/smsReminderManager.ts
similarity index 94%
rename from apps/web/ee/lib/workflows/reminders/smsReminderManager.ts
rename to packages/features/ee/workflows/lib/reminders/smsReminderManager.ts
index 62745da6857..ab200fcf984 100644
--- a/apps/web/ee/lib/workflows/reminders/smsReminderManager.ts
+++ b/packages/features/ee/workflows/lib/reminders/smsReminderManager.ts
@@ -8,8 +8,9 @@ import {
import dayjs from "@calcom/dayjs";
import prisma from "@calcom/prisma";
-import * as twilio from "@calcom/web/ee/lib/workflows/reminders/smsProviders/twilioProvider";
-import smsReminderTemplate from "@calcom/web/ee/lib/workflows/reminders/templates/smsReminderTemplate";
+
+import * as twilio from "./smsProviders/twilioProvider";
+import smsReminderTemplate from "./templates/smsReminderTemplate";
export enum timeUnitLowerCase {
DAY = "day",
diff --git a/apps/web/ee/lib/workflows/reminders/templates/emailReminderTemplate.ts b/packages/features/ee/workflows/lib/reminders/templates/emailReminderTemplate.ts
similarity index 100%
rename from apps/web/ee/lib/workflows/reminders/templates/emailReminderTemplate.ts
rename to packages/features/ee/workflows/lib/reminders/templates/emailReminderTemplate.ts
diff --git a/apps/web/ee/lib/workflows/reminders/templates/smsReminderTemplate.ts b/packages/features/ee/workflows/lib/reminders/templates/smsReminderTemplate.ts
similarity index 100%
rename from apps/web/ee/lib/workflows/reminders/templates/smsReminderTemplate.ts
rename to packages/features/ee/workflows/lib/reminders/templates/smsReminderTemplate.ts
diff --git a/apps/web/ee/pages/workflows/index.tsx b/packages/features/ee/workflows/pages/index.tsx
similarity index 74%
rename from apps/web/ee/pages/workflows/index.tsx
rename to packages/features/ee/workflows/pages/index.tsx
index c3e075923b0..f26dbd5a44a 100644
--- a/apps/web/ee/pages/workflows/index.tsx
+++ b/packages/features/ee/workflows/pages/index.tsx
@@ -1,16 +1,15 @@
import { useSession } from "next-auth/react";
+import LicenseRequired from "@calcom/features/ee/common/components/LicenseRequired";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { trpc } from "@calcom/trpc/react";
+import useMeQuery from "@calcom/trpc/react/hooks/useMeQuery";
import { Alert } from "@calcom/ui/Alert";
-import LicenseRequired from "@ee/components/LicenseRequired";
-import { NewWorkflowButton } from "@ee/components/workflows/NewWorkflowButton";
-import WorkflowList from "@ee/components/workflows/WorkflowListPage";
+import Loader from "@calcom/ui/Loader";
+import Shell from "@calcom/ui/Shell";
-import useMeQuery from "@lib/hooks/useMeQuery";
-
-import Loader from "@components/Loader";
-import Shell from "@components/Shell";
+import { NewWorkflowButton } from "../components/NewWorkflowButton";
+import WorkflowList from "../components/WorkflowListPage";
function WorkflowsPage() {
const { t } = useLocale();
diff --git a/apps/web/ee/pages/workflows/[workflow].tsx b/packages/features/ee/workflows/pages/workflow.tsx
similarity index 77%
rename from apps/web/ee/pages/workflows/[workflow].tsx
rename to packages/features/ee/workflows/pages/workflow.tsx
index 64543a2b5c3..f0aa76acfc6 100644
--- a/apps/web/ee/pages/workflows/[workflow].tsx
+++ b/packages/features/ee/workflows/pages/workflow.tsx
@@ -1,5 +1,11 @@
import { zodResolver } from "@hookform/resolvers/zod";
-import { TimeUnit, WorkflowStep, WorkflowTriggerEvents } from "@prisma/client";
+import {
+ TimeUnit,
+ WorkflowActions,
+ WorkflowStep,
+ WorkflowTemplates,
+ WorkflowTriggerEvents,
+} from "@prisma/client";
import { isValidPhoneNumber } from "libphonenumber-js";
import { useSession } from "next-auth/react";
import { useRouter } from "next/router";
@@ -8,23 +14,17 @@ import { useForm } from "react-hook-form";
import { z } from "zod";
import { useLocale } from "@calcom/lib/hooks/useLocale";
+import { stringOrNumber } from "@calcom/prisma/zod-utils";
import { trpc } from "@calcom/trpc/react";
+import useMeQuery from "@calcom/trpc/react/hooks/useMeQuery";
import { Alert } from "@calcom/ui/Alert";
import { Icon } from "@calcom/ui/Icon";
import Loader from "@calcom/ui/Loader";
-import LicenseRequired from "@ee/components/LicenseRequired";
-import WorkflowDetailsPage from "@ee/components/workflows/WorkflowDetailsPage";
-import {
- TIME_UNIT,
- WORKFLOW_ACTIONS,
- WORKFLOW_TEMPLATES,
- WORKFLOW_TRIGGER_EVENTS,
-} from "@ee/lib/workflows/constants";
+import Shell from "@calcom/ui/Shell";
+import { Option } from "@calcom/ui/form/MultiSelectCheckboxes";
-import useMeQuery from "@lib/hooks/useMeQuery";
-
-import Shell from "@components/Shell";
-import { Option } from "@components/ui/form/MultiSelectCheckboxes";
+import LicenseRequired from "../../common/components/LicenseRequired";
+import WorkflowDetailsPage from "../components/WorkflowDetailsPage";
export type FormValues = {
name: string;
@@ -38,27 +38,30 @@ export type FormValues = {
const formSchema = z.object({
name: z.string(),
activeOn: z.object({ value: z.string(), label: z.string() }).array(),
- trigger: z.enum(WORKFLOW_TRIGGER_EVENTS),
+ trigger: z.nativeEnum(WorkflowTriggerEvents),
time: z.number().gte(0).optional(),
- timeUnit: z.enum(TIME_UNIT).optional(),
+ timeUnit: z.nativeEnum(TimeUnit).optional(),
steps: z
.object({
id: z.number(),
stepNumber: z.number(),
- action: z.enum(WORKFLOW_ACTIONS),
+ action: z.nativeEnum(WorkflowActions),
workflowId: z.number(),
- reminderBody: z.string().optional().nullable(),
- emailSubject: z.string().optional().nullable(),
- template: z.enum(WORKFLOW_TEMPLATES),
+ reminderBody: z.string().nullable(),
+ emailSubject: z.string().nullable(),
+ template: z.nativeEnum(WorkflowTemplates),
sendTo: z
.string()
.refine((val) => isValidPhoneNumber(val))
- .optional()
.nullable(),
})
.array(),
});
+const querySchema = z.object({
+ workflow: stringOrNumber,
+});
+
function WorkflowPage() {
const { t } = useLocale();
const session = useSession();
@@ -73,33 +76,30 @@ function WorkflowPage() {
const form = useForm<FormValues>({
resolver: zodResolver(formSchema),
});
-
- const workflowId = router.query?.workflow as string;
+ const { workflow: workflowId } = router.isReady ? querySchema.parse(router.query) : { workflow: -1 };
const {
data: workflow,
isError,
error,
- isLoading,
dataUpdatedAt,
- } = trpc.useQuery([
- "viewer.workflows.get",
- {
- id: +workflowId,
- },
- ]);
+ } = trpc.useQuery(["viewer.workflows.get", { id: +workflowId }], {
+ enabled: router.isReady && !!workflowId,
+ });
useEffect(() => {
if (workflow) {
setSelectedEventTypes(
- workflow.activeOn.map((active: { eventType: { id: any; title: any } }) => {
- return { value: String(active.eventType.id), label: active.eventType.title };
- }) || []
+ workflow.activeOn.map((active) => ({
+ value: String(active.eventType.id),
+ label: active.eventType.title,
+ })) || []
);
const activeOn = workflow.activeOn
- ? workflow.activeOn.map((active) => {
- return { value: active.eventType.id.toString(), label: active.eventType.slug };
- })
+ ? workflow.activeOn.map((active) => ({
+ value: active.eventType.id.toString(),
+ label: active.eventType.slug,
+ }))
: undefined;
form.setValue("name", workflow.name);
form.setValue("steps", workflow.steps);
diff --git a/packages/features/index.ts b/packages/features/index.ts
new file mode 100644
index 00000000000..c80e198cf65
--- /dev/null
+++ b/packages/features/index.ts
@@ -0,0 +1 @@
+export * as ee from "./ee";
diff --git a/packages/features/links/README.md b/packages/features/links/README.md
new file mode 100644
index 00000000000..9682bae4e3f
--- /dev/null
+++ b/packages/features/links/README.md
@@ -0,0 +1,3 @@
+# Event types will become Links…
+
+…and this is where the feature will live.
diff --git a/packages/features/package.json b/packages/features/package.json
new file mode 100644
index 00000000000..33a43270a15
--- /dev/null
+++ b/packages/features/package.json
@@ -0,0 +1,8 @@
+{
+ "name": "@calcom/features",
+ "description": "Cal.com's main collocation of features",
+ "authors": "Cal.com, Inc.",
+ "version": "1.0.0",
+ "main": "index.ts",
+ "dependencies": {}
+}
diff --git a/packages/features/tsconfig.json b/packages/features/tsconfig.json
new file mode 100644
index 00000000000..b8fb2a6430a
--- /dev/null
+++ b/packages/features/tsconfig.json
@@ -0,0 +1,12 @@
+{
+ "extends": "@calcom/tsconfig/react-library.json",
+ "compilerOptions": {
+ "baseUrl": ".",
+ "paths": {
+ "~/*": ["/*"]
+ },
+ "resolveJsonModule": true
+ },
+ "include": [".", "../types/next-auth.d.ts"],
+ "exclude": ["dist", "build", "node_modules"]
+}
diff --git a/packages/features/users/README.md b/packages/features/users/README.md
new file mode 100644
index 00000000000..523a782b742
--- /dev/null
+++ b/packages/features/users/README.md
@@ -0,0 +1 @@
+# User-centric related code will live here
diff --git a/apps/web/lib/getPlaceholderAvatar.tsx b/packages/lib/getPlaceholderAvatar.tsx
similarity index 100%
rename from apps/web/lib/getPlaceholderAvatar.tsx
rename to packages/lib/getPlaceholderAvatar.tsx
diff --git a/apps/web/lib/hooks/useTheme.tsx b/packages/lib/hooks/useTheme.tsx
similarity index 100%
rename from apps/web/lib/hooks/useTheme.tsx
rename to packages/lib/hooks/useTheme.tsx
diff --git a/packages/lib/index.ts b/packages/lib/index.ts
index 00ae0059e87..dab1a5763ef 100644
--- a/packages/lib/index.ts
+++ b/packages/lib/index.ts
@@ -1,3 +1,4 @@
+export { default as classNames } from "./classNames";
export { getLuckyUsers } from "./getLuckyUsers";
export { default as isPrismaObj, isPrismaObjOrUndefined } from "./isPrismaObj";
export * from "./isRecurringEvent";
diff --git a/packages/lib/recurringStrings.ts b/packages/lib/recurringStrings.ts
index 1610efbb021..81301c8cdeb 100644
--- a/packages/lib/recurringStrings.ts
+++ b/packages/lib/recurringStrings.ts
@@ -1,7 +1,7 @@
import { TFunction } from "next-i18next";
import { Frequency } from "@calcom/prisma/zod-utils";
-import { RecurringEvent } from "@calcom/types/Calendar";
+import type { RecurringEvent } from "@calcom/types/Calendar";
export const getRecurringFreq = ({
t,
diff --git a/packages/lib/server/checkUsername.ts b/packages/lib/server/checkUsername.ts
index dce2b1f47b3..9dcae032785 100644
--- a/packages/lib/server/checkUsername.ts
+++ b/packages/lib/server/checkUsername.ts
@@ -1,4 +1,4 @@
-import { checkPremiumUsername } from "@calcom/ee/lib/core/checkPremiumUsername";
+import { checkPremiumUsername } from "@calcom/features/ee/common/lib/checkPremiumUsername";
import { IS_SELF_HOSTED } from "@calcom/lib/constants";
import { checkRegularUsername } from "./checkRegularUsername";
diff --git a/apps/web/lib/telemetry.ts b/packages/lib/telemetry.ts
similarity index 95%
rename from apps/web/lib/telemetry.ts
rename to packages/lib/telemetry.ts
index a3ed58028aa..30946439da0 100644
--- a/apps/web/lib/telemetry.ts
+++ b/packages/lib/telemetry.ts
@@ -1,11 +1,11 @@
import { NextApiRequest, NextApiResponse } from "next";
-import { EventHandler, EventSinkOpts } from "next-collect";
+import { CollectOpts, EventHandler } from "next-collect";
import { useCollector } from "next-collect/client";
// it's ok to do this since we're importing only types which are harmless
// eslint-disable-next-line @next/next/no-server-import-in-page
import type { NextRequest, NextResponse } from "next/server";
-import { CONSOLE_URL } from "@calcom/lib/constants";
+import { CONSOLE_URL } from "./constants";
export const telemetryEventTypes = {
pageView: "page_view",
@@ -51,7 +51,7 @@ const reportUsage: EventHandler = async (event, { fetch }) => {
}
};
-export const nextCollectBasicSettings: EventSinkOpts = {
+export const nextCollectBasicSettings: CollectOpts = {
drivers: [
process.env.CALCOM_LICENSE_KEY && process.env.NEXT_PUBLIC_IS_E2E !== "1" ? reportUsage : undefined,
process.env.CALCOM_TELEMETRY_DISABLED === "1" || process.env.NEXT_PUBLIC_IS_E2E === "1"
diff --git a/apps/web/lib/timeFormat.ts b/packages/lib/timeFormat.ts
similarity index 100%
rename from apps/web/lib/timeFormat.ts
rename to packages/lib/timeFormat.ts
diff --git a/packages/stripe/LICENSE b/packages/stripe/LICENSE
deleted file mode 100644
index 60f0a2a1d03..00000000000
--- a/packages/stripe/LICENSE
+++ /dev/null
@@ -1,42 +0,0 @@
-The Cal.com Enterprise Edition (EE) license (the “EE License”)
-Copyright (c) 2020-present Cal.com, Inc
-
-With regard to the Cal.com Software:
-
-This software and associated documentation files (the "Software") may only be
-used in production, if you (and any entity that you represent) have agreed to,
-and are in compliance with, the Cal.com Subscription Terms available
-at https://cal.com/terms (the “EE Terms”), or other agreements governing
-the use of the Software, as mutually agreed by you and Cal.com, Inc ("Cal.com"),
-and otherwise have a valid Cal.com Enterprise Edition subscription ("EE Subscription")
-for the correct number of hosts as defined in the EE Terms ("Hosts"). Subject to the foregoing sentence,
-you are free to modify this Software and publish patches to the Software. You agree
-that Cal.com and/or its licensors (as applicable) retain all right, title and interest in
-and to all such modifications and/or patches, and all such modifications and/or
-patches may only be used, copied, modified, displayed, distributed, or otherwise
-exploited with a valid EE Subscription for the correct number of hosts.
-Notwithstanding the foregoing, you may copy and modify the Software for development
-and testing purposes, without requiring a subscription. You agree that Cal.com and/or
-its licensors (as applicable) retain all right, title and interest in and to all such
-modifications. You are not granted any other rights beyond what is expressly stated herein.
-Subject to the foregoing, it is forbidden to copy, merge, publish, distribute, sublicense,
-and/or sell the Software.
-
-This EE License applies only to the part of this Software that is not distributed under
-the AGPLv3 license. Any part of this Software distributed under the MIT license or which
-is served client-side as an image, font, cascading stylesheet (CSS), file which produces
-or is compiled, arranged, augmented, or combined into client-side JavaScript, in whole or
-in part, is copyrighted under the AGPLv3 license. The full text of this EE License shall
-be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
-For all third party components incorporated into the Cal.com Software, those
-components are licensed under the original license provided by the owner of the
-applicable component.
diff --git a/packages/stripe/README.md b/packages/stripe/README.md
deleted file mode 100644
index d73b8b860d7..00000000000
--- a/packages/stripe/README.md
+++ /dev/null
@@ -1,38 +0,0 @@
-<!-- PROJECT LOGO -->
-<div align="center">
- <a href="https://cal.com/enterprise">
- <img src="https://user-images.githubusercontent.com/8019099/133430653-24422d2a-3c8d-4052-9ad6-0580597151ee.png" alt="Logo">
- </a>
-
- <a href="https://cal.com/enterprise">Get Started with Enterprise</a>
-</div>
-
-# Enterprise Edition
-
-Welcome to the Enterprise Edition ("/ee") of Cal.com.
-
-The [/ee](https://github.com/calcom/cal.com/tree/main/apps/web/ee) subfolder is the place for all the **Pro** features from our [hosted](https://cal.com/pricing) plan and [enterprise-grade](https://cal.com/enterprise) features such as SSO, SAML, ADFS, OIDC, SCIM, SIEM, HRIS and much more.
-
-> _❗ WARNING: This repository is copyrighted (unlike our [main repo](https://github.com/calcom/cal.com)). You are not allowed to use this code to host your own version of app.cal.com without obtaining a proper [license](https://cal.com/enterprise) first❗_
-
-## Setting up Stripe
-
-1. Create a stripe account or use an existing one. For testing, you should use all stripe dashboard functions with the Test-Mode toggle in the top right activated.
-2. Open [Stripe ApiKeys](https://dashboard.stripe.com/apikeys) save the token starting with `pk_...` to `NEXT_PUBLIC_STRIPE_PUBLIC_KEY` and `sk_...` to `STRIPE_PRIVATE_KEY` in the .env file.
-3. Open [Stripe Connect Settings](https://dashboard.stripe.com/settings/connect) and activate OAuth for Standard Accounts
-4. Add `<CALENDSO URL>/api/integrations/stripepayment/callback` as redirect URL.
-5. Copy your client*id (`ca*...`) to `STRIPE_CLIENT_ID` in the .env file.
-6. Open [Stripe Webhooks](https://dashboard.stripe.com/webhooks) and add `<CALENDSO URL>/api/integrations/stripepayment/webhook` as webhook for connected applications.
-7. Select all `payment_intent` events for the webhook.
-8. Copy the webhook secret (`whsec_...`) to `STRIPE_WEBHOOK_SECRET` in the .env file.
-
-## Setting up SAML login
-
-1. Set SAML_DATABASE_URL to a postgres database. Please use a different database than the main Cal instance since the migrations are separate for this database. For example `postgresql://postgres:@localhost:5450/cal-saml`
-2. Set SAML_ADMINS to a comma separated list of admin emails from where the SAML metadata can be uploaded and configured.
-3. Create a SAML application with your Identity Provider (IdP) using the instructions here - [SAML Setup](../../apps/web/docs/saml-setup.md)
-4. Remember to configure access to the IdP SAML app for all your users (who need access to Cal).
-5. You will need the XML metadata from your IdP later, so keep it accessible.
-6. Log in to one of the admin accounts configured in SAML_ADMINS and then navigate to Settings -> Security.
-7. You should see a SAML configuration section, copy and paste the XML metadata from step 5 and click on Save.
-8. Your provisioned users can now log into Cal using SAML.
diff --git a/packages/stripe/package.json b/packages/stripe/package.json
deleted file mode 100644
index cbf9c134606..00000000000
--- a/packages/stripe/package.json
+++ /dev/null
@@ -1,35 +0,0 @@
-{
- "name": "@calcom/stripe",
- "version": "0.0.0",
- "private": true,
- "license": "AGPLv3",
- "scripts": {
- "clean": "rm -rf .turbo && rm -rf node_modules",
- "downgrade": "ts-node ./downgrade.ts"
- },
- "devDependencies": {
- "ts-node": "^10.6.0"
- },
- "dependencies": {
- "@calcom/app-store": "*",
- "@calcom/dayjs": "*",
- "@calcom/ee": "*",
- "@calcom/emails": "*",
- "@calcom/lib": "*",
- "@calcom/prisma": "*",
- "@calcom/types": "*",
- "@stripe/react-stripe-js": "^1.8.0",
- "@stripe/stripe-js": "^1.29.0",
- "stripe": "^9.1.0",
- "uuid": "^8.3.2",
- "zod": "^3.16.0"
- },
- "main": "index.ts",
- "types": "index.d.ts",
- "files": [
- "client.ts",
- "constants.ts",
- "server.ts",
- "utils.ts"
- ]
-}
diff --git a/packages/stripe/tsconfig.json b/packages/stripe/tsconfig.json
deleted file mode 100644
index 184d5dec703..00000000000
--- a/packages/stripe/tsconfig.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "extends": "@calcom/tsconfig/base.json",
- "compilerOptions": {
- "baseUrl": "."
- },
- "include": ["."],
- "exclude": ["dist", "build", "node_modules"]
-}
diff --git a/packages/trpc/react/hooks/useMeQuery.ts b/packages/trpc/react/hooks/useMeQuery.ts
new file mode 100644
index 00000000000..a8d0a051ce3
--- /dev/null
+++ b/packages/trpc/react/hooks/useMeQuery.ts
@@ -0,0 +1,13 @@
+import { trpc } from "../trpc";
+
+export function useMeQuery() {
+ const meQuery = trpc.useQuery(["viewer.me"], {
+ retry(failureCount) {
+ return failureCount > 3;
+ },
+ });
+
+ return meQuery;
+}
+
+export default useMeQuery;
diff --git a/packages/trpc/server/routers/viewer.tsx b/packages/trpc/server/routers/viewer.tsx
index 897aab633a4..e87e0be16ce 100644
--- a/packages/trpc/server/routers/viewer.tsx
+++ b/packages/trpc/server/routers/viewer.tsx
@@ -4,6 +4,7 @@ import { JSONObject } from "superjson/dist/types";
import { z } from "zod";
import app_RoutingForms from "@calcom/app-store/ee/routing_forms/trpc-router";
+import stripe, { closePayments } from "@calcom/app-store/stripepayment/lib/server";
import getApps, { getLocationOptions } from "@calcom/app-store/utils";
import { getCalendarCredentials, getConnectedCalendars } from "@calcom/core/CalendarManager";
import dayjs from "@calcom/dayjs";
@@ -25,7 +26,6 @@ import { getTranslation } from "@calcom/lib/server/i18n";
import { isTeamOwner } from "@calcom/lib/server/queries/teams";
import slugify from "@calcom/lib/slugify";
import prisma, { baseEventTypeSelect, bookingMinimalSelect } from "@calcom/prisma";
-import stripe, { closePayments } from "@calcom/stripe/server";
import { resizeBase64Image } from "@calcom/web/server/lib/resizeBase64Image";
import { TRPCError } from "@trpc/server";
diff --git a/packages/trpc/server/routers/viewer/apiKeys.tsx b/packages/trpc/server/routers/viewer/apiKeys.tsx
index 3c9bb046489..e10c9ca80f2 100644
--- a/packages/trpc/server/routers/viewer/apiKeys.tsx
+++ b/packages/trpc/server/routers/viewer/apiKeys.tsx
@@ -1,7 +1,7 @@
import { v4 } from "uuid";
import { z } from "zod";
-import { generateUniqueAPIKey } from "@calcom/ee/lib/api/apiKeys";
+import { generateUniqueAPIKey } from "@calcom/features/ee/api-keys/lib/apiKeys";
import { createProtectedRouter } from "../../createRouter";
diff --git a/packages/trpc/server/routers/viewer/eventTypes.tsx b/packages/trpc/server/routers/viewer/eventTypes.tsx
index 05baeb0420e..7c920b34c44 100644
--- a/packages/trpc/server/routers/viewer/eventTypes.tsx
+++ b/packages/trpc/server/routers/viewer/eventTypes.tsx
@@ -3,10 +3,10 @@ import { PrismaClientKnownRequestError } from "@prisma/client/runtime";
import { z } from "zod";
import getAppKeysFromSlug from "@calcom/app-store/_utils/getAppKeysFromSlug";
+import { stripeDataSchema } from "@calcom/app-store/stripepayment/lib/server";
import { _DestinationCalendarModel, _EventTypeCustomInputModel, _EventTypeModel } from "@calcom/prisma/zod";
import { stringOrNumber } from "@calcom/prisma/zod-utils";
import { createEventTypeInput } from "@calcom/prisma/zod/custom/eventtype";
-import { stripeDataSchema } from "@calcom/stripe/server";
import { TRPCError } from "@trpc/server";
diff --git a/packages/trpc/server/routers/viewer/teams.tsx b/packages/trpc/server/routers/viewer/teams.tsx
index a9db87cc238..3b95c06b1bf 100644
--- a/packages/trpc/server/routers/viewer/teams.tsx
+++ b/packages/trpc/server/routers/viewer/teams.tsx
@@ -2,13 +2,6 @@ import { MembershipRole, Prisma, UserPlan } from "@prisma/client";
import { randomBytes } from "crypto";
import { z } from "zod";
-import { getUserAvailability } from "@calcom/core/getUserAvailability";
-import { sendTeamInviteEmail } from "@calcom/emails";
-import { HOSTED_CAL_FEATURES, WEBAPP_URL } from "@calcom/lib/constants";
-import { getTranslation } from "@calcom/lib/server/i18n";
-import { getTeamWithMembers, isTeamAdmin, isTeamOwner } from "@calcom/lib/server/queries/teams";
-import slugify from "@calcom/lib/slugify";
-import { availabilityUserSelect } from "@calcom/prisma";
import {
addSeat,
downgradeTeamMembers,
@@ -16,7 +9,14 @@ import {
getTeamSeatStats,
removeSeat,
upgradeTeam,
-} from "@calcom/stripe/team-billing";
+} from "@calcom/app-store/stripepayment/lib/team-billing";
+import { getUserAvailability } from "@calcom/core/getUserAvailability";
+import { sendTeamInviteEmail } from "@calcom/emails";
+import { HOSTED_CAL_FEATURES, WEBAPP_URL } from "@calcom/lib/constants";
+import { getTranslation } from "@calcom/lib/server/i18n";
+import { getTeamWithMembers, isTeamAdmin, isTeamOwner } from "@calcom/lib/server/queries/teams";
+import slugify from "@calcom/lib/slugify";
+import { availabilityUserSelect } from "@calcom/prisma";
import { TRPCError } from "@trpc/server";
diff --git a/packages/trpc/server/routers/viewer/workflows.tsx b/packages/trpc/server/routers/viewer/workflows.tsx
index 546743f5a05..02f60ddebb0 100644
--- a/packages/trpc/server/routers/viewer/workflows.tsx
+++ b/packages/trpc/server/routers/viewer/workflows.tsx
@@ -14,15 +14,15 @@ import {
WORKFLOW_TRIGGER_EVENTS,
WORKFLOW_ACTIONS,
TIME_UNIT,
-} from "@ee/lib/workflows/constants";
+} from "@calcom/features/ee/workflows/lib/constants";
import {
deleteScheduledEmailReminder,
scheduleEmailReminder,
-} from "@ee/lib/workflows/reminders/emailReminderManager";
+} from "@calcom/features/ee/workflows/lib/reminders/emailReminderManager";
import {
deleteScheduledSMSReminder,
scheduleSMSReminder,
-} from "@ee/lib/workflows/reminders/smsReminderManager";
+} from "@calcom/features/ee/workflows/lib/reminders/smsReminderManager";
import { TRPCError } from "@trpc/server";
diff --git a/apps/web/components/ui/Badge.tsx b/packages/ui/Badge.tsx
similarity index 93%
rename from apps/web/components/ui/Badge.tsx
rename to packages/ui/Badge.tsx
index b6c23da45ac..8e5a8c86f6e 100644
--- a/apps/web/components/ui/Badge.tsx
+++ b/packages/ui/Badge.tsx
@@ -1,6 +1,6 @@
import React from "react";
-import classNames from "@lib/classNames";
+import classNames from "@calcom/lib/classNames";
export type BadgeProps = {
variant: "default" | "success" | "gray";
diff --git a/apps/web/components/dialog/ConfirmationDialogContent.tsx b/packages/ui/ConfirmationDialogContent.tsx
similarity index 100%
rename from apps/web/components/dialog/ConfirmationDialogContent.tsx
rename to packages/ui/ConfirmationDialogContent.tsx
diff --git a/packages/ui/CustomBranding.tsx b/packages/ui/CustomBranding.tsx
new file mode 100644
index 00000000000..8512de4de09
--- /dev/null
+++ b/packages/ui/CustomBranding.tsx
@@ -0,0 +1,269 @@
+import Head from "next/head";
+
+import { useBrandColors } from "@calcom/embed-core/embed-iframe";
+
+const brandColor = "#292929";
+const brandTextColor = "#ffffff";
+const darkBrandColor = "#fafafa";
+
+export function colorNameToHex(color: string) {
+ const colors = {
+ aliceblue: "#f0f8ff",
+ antiquewhite: "#faebd7",
+ aqua: "#00ffff",
+ aquamarine: "#7fffd4",
+ azure: "#f0ffff",
+ beige: "#f5f5dc",
+ bisque: "#ffe4c4",
+ black: "#000000",
+ blanchedalmond: "#ffebcd",
+ blue: "#0000ff",
+ blueviolet: "#8a2be2",
+ brown: "#a52a2a",
+ burlywood: "#deb887",
+ cadetblue: "#5f9ea0",
+ chartreuse: "#7fff00",
+ chocolate: "#d2691e",
+ coral: "#ff7f50",
+ cornflowerblue: "#6495ed",
+ cornsilk: "#fff8dc",
+ crimson: "#dc143c",
+ cyan: "#00ffff",
+ darkblue: "#00008b",
+ darkcyan: "#008b8b",
+ darkgoldenrod: "#b8860b",
+ darkgray: "#a9a9a9",
+ darkgreen: "#006400",
+ darkkhaki: "#bdb76b",
+ darkmagenta: "#8b008b",
+ darkolivegreen: "#556b2f",
+ darkorange: "#ff8c00",
+ darkorchid: "#9932cc",
+ darkred: "#8b0000",
+ darksalmon: "#e9967a",
+ darkseagreen: "#8fbc8f",
+ darkslateblue: "#483d8b",
+ darkslategray: "#2f4f4f",
+ darkturquoise: "#00ced1",
+ darkviolet: "#9400d3",
+ deeppink: "#ff1493",
+ deepskyblue: "#00bfff",
+ dimgray: "#696969",
+ dodgerblue: "#1e90ff",
+ firebrick: "#b22222",
+ floralwhite: "#fffaf0",
+ forestgreen: "#228b22",
+ fuchsia: "#ff00ff",
+ gainsboro: "#dcdcdc",
+ ghostwhite: "#f8f8ff",
+ gold: "#ffd700",
+ goldenrod: "#daa520",
+ gray: "#808080",
+ green: "#008000",
+ greenyellow: "#adff2f",
+ honeydew: "#f0fff0",
+ hotpink: "#ff69b4",
+ "indianred ": "#cd5c5c",
+ indigo: "#4b0082",
+ ivory: "#fffff0",
+ khaki: "#f0e68c",
+ lavender: "#e6e6fa",
+ lavenderblush: "#fff0f5",
+ lawngreen: "#7cfc00",
+ lemonchiffon: "#fffacd",
+ lightblue: "#add8e6",
+ lightcoral: "#f08080",
+ lightcyan: "#e0ffff",
+ lightgoldenrodyellow: "#fafad2",
+ lightgrey: "#d3d3d3",
+ lightgreen: "#90ee90",
+ lightpink: "#ffb6c1",
+ lightsalmon: "#ffa07a",
+ lightseagreen: "#20b2aa",
+ lightskyblue: "#87cefa",
+ lightslategray: "#778899",
+ lightsteelblue: "#b0c4de",
+ lightyellow: "#ffffe0",
+ lime: "#00ff00",
+ limegreen: "#32cd32",
+ linen: "#faf0e6",
+ magenta: "#ff00ff",
+ maroon: "#800000",
+ mediumaquamarine: "#66cdaa",
+ mediumblue: "#0000cd",
+ mediumorchid: "#ba55d3",
+ mediumpurple: "#9370d8",
+ mediumseagreen: "#3cb371",
+ mediumslateblue: "#7b68ee",
+ mediumspringgreen: "#00fa9a",
+ mediumturquoise: "#48d1cc",
+ mediumvioletred: "#c71585",
+ midnightblue: "#191970",
+ mintcream: "#f5fffa",
+ mistyrose: "#ffe4e1",
+ moccasin: "#ffe4b5",
+ navajowhite: "#ffdead",
+ navy: "#000080",
+ oldlace: "#fdf5e6",
+ olive: "#808000",
+ olivedrab: "#6b8e23",
+ orange: "#ffa500",
+ orangered: "#ff4500",
+ orchid: "#da70d6",
+ palegoldenrod: "#eee8aa",
+ palegreen: "#98fb98",
+ paleturquoise: "#afeeee",
+ palevioletred: "#d87093",
+ papayawhip: "#ffefd5",
+ peachpuff: "#ffdab9",
+ peru: "#cd853f",
+ pink: "#ffc0cb",
+ plum: "#dda0dd",
+ powderblue: "#b0e0e6",
+ purple: "#800080",
+ rebeccapurple: "#663399",
+ red: "#ff0000",
+ rosybrown: "#bc8f8f",
+ royalblue: "#4169e1",
+ saddlebrown: "#8b4513",
+ salmon: "#fa8072",
+ sandybrown: "#f4a460",
+ seagreen: "#2e8b57",
+ seashell: "#fff5ee",
+ sienna: "#a0522d",
+ silver: "#c0c0c0",
+ skyblue: "#87ceeb",
+ slateblue: "#6a5acd",
+ slategray: "#708090",
+ snow: "#fffafa",
+ springgreen: "#00ff7f",
+ steelblue: "#4682b4",
+ tan: "#d2b48c",
+ teal: "#008080",
+ thistle: "#d8bfd8",
+ tomato: "#ff6347",
+ turquoise: "#40e0d0",
+ violet: "#ee82ee",
+ wheat: "#f5deb3",
+ white: "#ffffff",
+ whitesmoke: "#f5f5f5",
+ yellow: "#ffff00",
+ yellowgreen: "#9acd32",
+ };
+
+ return colors[color.toLowerCase() as keyof typeof colors] !== undefined
+ ? colors[color.toLowerCase() as keyof typeof colors]
+ : false;
+}
+
+function computeContrastRatio(a: number[], b: number[]) {
+ const lum1 = computeLuminance(a[0], a[1], a[2]);
+ const lum2 = computeLuminance(b[0], b[1], b[2]);
+ const brightest = Math.max(lum1, lum2);
+ const darkest = Math.min(lum1, lum2);
+ return (brightest + 0.05) / (darkest + 0.05);
+}
+
+function computeLuminance(r: number, g: number, b: number) {
+ const a = [r, g, b].map((v) => {
+ v /= 255;
+ return v <= 0.03928 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);
+ });
+ return a[0] * 0.2126 + a[1] * 0.7152 + a[2] * 0.0722;
+}
+
+function hexToRGB(hex: string) {
+ const color = hex.replace("#", "");
+ return [parseInt(color.slice(0, 2), 16), parseInt(color.slice(2, 4), 16), parseInt(color.slice(4, 6), 16)];
+}
+
+function normalizeHexCode(hex: string | null, dark: boolean) {
+ if (!hex) {
+ return !dark ? brandColor : darkBrandColor;
+ }
+ hex = hex.replace("#", "");
+ if (hex.length === 3) {
+ hex = hex
+ .split("")
+ .map(function (hex) {
+ return hex + hex;
+ })
+ .join("");
+ }
+ return hex;
+}
+
+function getContrastingTextColor(bgColor: string | null, dark: boolean): string {
+ bgColor = bgColor == "" || bgColor == null ? (dark ? darkBrandColor : brandColor) : bgColor;
+ const rgb = hexToRGB(bgColor);
+ const whiteContrastRatio = computeContrastRatio(rgb, [255, 255, 255]);
+ const blackContrastRatio = computeContrastRatio(rgb, [41, 41, 41]); //#292929
+ return whiteContrastRatio > blackContrastRatio ? brandTextColor : brandColor;
+}
+
+export function isValidHexCode(val: string | null) {
+ if (val) {
+ val = val.indexOf("#") === 0 ? val : "#" + val;
+ const regex = new RegExp("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$");
+ return regex.test(val);
+ }
+ return false;
+}
+
+export function fallBackHex(val: string | null, dark: boolean): string {
+ if (val) if (colorNameToHex(val)) return colorNameToHex(val) as string;
+ return dark ? darkBrandColor : brandColor;
+}
+
+const BrandColor = ({
+ lightVal = brandColor,
+ darkVal = darkBrandColor,
+}: {
+ lightVal: string | undefined | null;
+ darkVal: string | undefined | null;
+}) => {
+ const embedBrandingColors = useBrandColors();
+ lightVal = embedBrandingColors.brandColor || lightVal;
+ // convert to 6 digit equivalent if 3 digit code is entered
+ lightVal = normalizeHexCode(lightVal, false);
+ darkVal = normalizeHexCode(darkVal, true);
+ // ensure acceptable hex-code
+ lightVal = isValidHexCode(lightVal)
+ ? lightVal?.indexOf("#") === 0
+ ? lightVal
+ : "#" + lightVal
+ : fallBackHex(lightVal, false);
+ darkVal = isValidHexCode(darkVal)
+ ? darkVal?.indexOf("#") === 0
+ ? darkVal
+ : "#" + darkVal
+ : fallBackHex(darkVal, true);
+ return (
+ <Head>
+ <style>
+ {`body {
+ /* green--500*/
+ --booking-highlight-color: ${embedBrandingColors.highlightColor || "#10B981"};
+ /* gray--200 */
+ --booking-lightest-color: ${embedBrandingColors.lightestColor || "#E1E1E1"};
+ /* gray--400 */
+ --booking-lighter-color: ${embedBrandingColors.lighterColor || "#ACACAC"};
+ /* gray--500 */
+ --booking-light-color: ${embedBrandingColors.lightColor || "#888888"};
+ /* gray--600 */
+ --booking-median-color: ${embedBrandingColors.medianColor || "#494949"};
+ /* gray--800 */
+ --booking-dark-color: ${embedBrandingColors.darkColor || "#313131"};
+ /* gray--900 */
+ --booking-darker-color: ${embedBrandingColors.darkerColor || "#292929"};
+ --brand-color: ${lightVal};
+ --brand-text-color: ${getContrastingTextColor(lightVal, true)};
+ --brand-color-dark-mode: ${darkVal};
+ --brand-text-color-dark-mode: ${getContrastingTextColor(darkVal, true)};
+ `}
+ </style>
+ </Head>
+ );
+};
+
+export default BrandColor;
diff --git a/apps/web/lib/ErrorBoundary.tsx b/packages/ui/ErrorBoundary.tsx
similarity index 100%
rename from apps/web/lib/ErrorBoundary.tsx
rename to packages/ui/ErrorBoundary.tsx
diff --git a/apps/web/components/Kbar.tsx b/packages/ui/Kbar.tsx
similarity index 100%
rename from apps/web/components/Kbar.tsx
rename to packages/ui/Kbar.tsx
diff --git a/apps/web/components/List.tsx b/packages/ui/List.tsx
similarity index 97%
rename from apps/web/components/List.tsx
rename to packages/ui/List.tsx
index f9eb647ac42..15ecf8f088c 100644
--- a/apps/web/components/List.tsx
+++ b/packages/ui/List.tsx
@@ -1,7 +1,7 @@
import Link from "next/link";
import { createElement } from "react";
-import classNames from "@lib/classNames";
+import classNames from "@calcom/lib/classNames";
export function List(props: JSX.IntrinsicElements["ul"]) {
return (
diff --git a/apps/web/components/Logo.tsx b/packages/ui/Logo.tsx
similarity index 100%
rename from apps/web/components/Logo.tsx
rename to packages/ui/Logo.tsx
diff --git a/apps/web/components/Shell.tsx b/packages/ui/Shell.tsx
similarity index 92%
rename from apps/web/components/Shell.tsx
rename to packages/ui/Shell.tsx
index d0903e19232..4f4586db530 100644
--- a/apps/web/components/Shell.tsx
+++ b/packages/ui/Shell.tsx
@@ -1,15 +1,23 @@
-import { UserPlan } from "@prisma/client";
+import type { User, UserPlan } from "@prisma/client";
import { SessionContextValue, signOut, useSession } from "next-auth/react";
import Link from "next/link";
import { useRouter } from "next/router";
import React, { Fragment, ReactNode, useEffect, useState } from "react";
import { Toaster } from "react-hot-toast";
+import dayjs from "@calcom/dayjs";
import { useIsEmbed } from "@calcom/embed-core/embed-iframe";
+import LicenseBanner from "@calcom/features/ee/common/components/LicenseBanner";
+import TrialBanner from "@calcom/features/ee/common/components/TrialBanner";
+import ImpersonatingBanner from "@calcom/features/ee/impersonation/components/ImpersonatingBanner";
+import HelpMenuItem from "@calcom/features/ee/support/components/HelpMenuItem";
import CustomBranding from "@calcom/lib/CustomBranding";
-import { WEBAPP_URL, JOIN_SLACK, ROADMAP } from "@calcom/lib/constants";
+import classNames from "@calcom/lib/classNames";
+import { JOIN_SLACK, ROADMAP, WEBAPP_URL } from "@calcom/lib/constants";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { trpc } from "@calcom/trpc/react";
+import useMeQuery from "@calcom/trpc/react/hooks/useMeQuery";
+import Badge from "@calcom/ui/Badge";
import Button from "@calcom/ui/Button";
import Dropdown, {
DropdownMenuContent,
@@ -18,25 +26,30 @@ import Dropdown, {
DropdownMenuTrigger,
} from "@calcom/ui/Dropdown";
import { CollectionIcon, Icon } from "@calcom/ui/Icon";
-import LicenseBanner from "@ee/components/LicenseBanner";
-import TrialBanner from "@ee/components/TrialBanner";
-import HelpMenuItem from "@ee/components/support/HelpMenuItem";
+import Loader from "@calcom/ui/Loader";
+import { useViewerI18n } from "@calcom/web/components/I18nLanguageHandler";
-import ErrorBoundary from "@lib/ErrorBoundary";
-import classNames from "@lib/classNames";
-import { shouldShowOnboarding } from "@lib/getting-started";
-import useMeQuery from "@lib/hooks/useMeQuery";
-
-import { KBarRoot, KBarContent, KBarTrigger } from "@components/Kbar";
-import Loader from "@components/Loader";
import { HeadSeo } from "@components/seo/head-seo";
-import Badge from "@components/ui/Badge";
-import ImpersonatingBanner from "@components/ui/ImpersonatingBanner";
-import pkg from "../package.json";
-import { useViewerI18n } from "./I18nLanguageHandler";
+/* TODO: Get this from endpoint */
+import pkg from "../../apps/web/package.json";
+import ErrorBoundary from "./ErrorBoundary";
+import { KBarContent, KBarRoot, KBarTrigger } from "./Kbar";
import Logo from "./Logo";
+export const ONBOARDING_INTRODUCED_AT = dayjs("September 1 2021").toISOString();
+
+export const ONBOARDING_NEXT_REDIRECT = {
+ redirect: {
+ permanent: false,
+ destination: "/getting-started",
+ },
+} as const;
+
+export const shouldShowOnboarding = (user: Pick<User, "createdDate" | "completedOnboarding">) => {
+ return !user.completedOnboarding && dayjs(user.createdDate).isAfter(ONBOARDING_INTRODUCED_AT);
+};
+
function useRedirectToLoginIfUnauthenticated(isPublic = false) {
const { data: session, status } = useSession();
const loading = status === "loading";
@@ -278,13 +291,7 @@ const Layout = ({
<UserDropdown small />
</span>
</div>
- <small style={{ fontSize: "0.5rem" }} className="mx-3 mt-1 mb-2 hidden opacity-50 lg:block">
- &copy; {new Date().getFullYear()} Cal.com, Inc. v.{pkg.version + "-"}
- {process.env.NEXT_PUBLIC_WEBSITE_URL === "https://cal.com" ? "h" : "sh"}
- <span className="lowercase" data-testid={`plan-${plan?.toLowerCase()}`}>
- -{plan}
- </span>
- </small>
+ <DeploymentInfo />
</div>
</div>
</div>
@@ -645,3 +652,22 @@ function UserDropdown({ small }: { small?: boolean }) {
</Dropdown>
);
}
+
+function DeploymentInfo() {
+ const query = useMeQuery();
+ const user = query.data;
+
+ return (
+ <small
+ style={{
+ fontSize: "0.5rem",
+ }}
+ className="mx-3 mt-1 mb-2 hidden opacity-50 lg:block">
+ &copy; {new Date().getFullYear()} Cal.com, Inc. v.{pkg.version + "-"}
+ {process.env.NEXT_PUBLIC_WEBSITE_URL === "https://cal.com" ? "h" : "sh"}
+ <span className="lowercase" data-testid={`plan-${user?.plan.toLowerCase()}`}>
+ -{user?.plan}
+ </span>
+ </small>
+ );
+}
diff --git a/apps/web/components/apps/SkeletonLoader.tsx b/packages/ui/apps/SkeletonLoader.tsx
similarity index 92%
rename from apps/web/components/apps/SkeletonLoader.tsx
rename to packages/ui/apps/SkeletonLoader.tsx
index aa187a9d700..bf12ded304c 100644
--- a/apps/web/components/apps/SkeletonLoader.tsx
+++ b/packages/ui/apps/SkeletonLoader.tsx
@@ -1,8 +1,7 @@
import React from "react";
-import { SkeletonText } from "@calcom/ui";
-
-import { ShellSubHeading } from "@components/Shell";
+import { SkeletonText } from "../";
+import { ShellSubHeading } from "../Shell";
function SkeletonLoader({ className }: { className?: string }) {
return (
diff --git a/apps/web/components/ui/form/MultiSelectCheckboxes.tsx b/packages/ui/form/MultiSelectCheckboxes.tsx
similarity index 97%
rename from apps/web/components/ui/form/MultiSelectCheckboxes.tsx
rename to packages/ui/form/MultiSelectCheckboxes.tsx
index 55a6b76c1e9..622206431fe 100644
--- a/apps/web/components/ui/form/MultiSelectCheckboxes.tsx
+++ b/packages/ui/form/MultiSelectCheckboxes.tsx
@@ -3,7 +3,8 @@ import { components, GroupBase, OptionProps } from "react-select";
import { Props } from "react-select";
import { useLocale } from "@calcom/lib/hooks/useLocale";
-import Select from "@calcom/ui/form/Select";
+
+import Select from "./Select";
export type Option = {
value: string;
diff --git a/apps/web/components/ui/form/PhoneInput.tsx b/packages/ui/form/PhoneInput.tsx
similarity index 100%
rename from apps/web/components/ui/form/PhoneInput.tsx
rename to packages/ui/form/PhoneInput.tsx
diff --git a/packages/ui/form/PhoneInputLazy.tsx b/packages/ui/form/PhoneInputLazy.tsx
new file mode 100644
index 00000000000..117ec426e86
--- /dev/null
+++ b/packages/ui/form/PhoneInputLazy.tsx
@@ -0,0 +1,8 @@
+import dynamic from "next/dynamic";
+
+/** These are like 40kb that not every user needs */
+const PhoneInputLazy = dynamic(
+ () => import("./PhoneInput")
+) as unknown as typeof import("./PhoneInput").default;
+
+export default PhoneInputLazy;
diff --git a/apps/web/components/ui/form/TimezoneSelect.tsx b/packages/ui/form/TimezoneSelect.tsx
similarity index 95%
rename from apps/web/components/ui/form/TimezoneSelect.tsx
rename to packages/ui/form/TimezoneSelect.tsx
index 698bc1b45ff..c2cf2413aba 100644
--- a/apps/web/components/ui/form/TimezoneSelect.tsx
+++ b/packages/ui/form/TimezoneSelect.tsx
@@ -7,7 +7,7 @@ import BaseSelect, {
Props as SelectProps,
} from "react-timezone-select";
-import { InputComponent } from "@components/ui/form/Select";
+import { InputComponent } from "./Select";
function TimezoneSelect({ className, ...props }: SelectProps) {
return (
diff --git a/packages/ui/package.json b/packages/ui/package.json
index cc8b80cb258..d0b266b153c 100644
--- a/packages/ui/package.json
+++ b/packages/ui/package.json
@@ -10,19 +10,21 @@
"lint:report": "eslint . --format json --output-file ../../lint-results/ui.json"
},
"dependencies": {
+ "@calcom/lib": "*",
+ "@calcom/trpc": "*",
"@radix-ui/react-dialog": "^0.1.0",
"@radix-ui/react-select": "^0.1.1",
"downshift": "^6.1.7",
"next": "^12.2.0",
+ "react": "^18.1.0",
"react-colorful": "^5.5.1",
"react-feather": "^2.0.10",
+ "react-query": "^3.39.0",
"react-select": "^5.4.0"
},
"devDependencies": {
"@calcom/config": "*",
- "@calcom/lib": "*",
"@calcom/tsconfig": "*",
- "@calcom/trpc": "*",
"@types/react": "18.0.9",
"@types/react-dom": "18.0.4",
"typescript": "^4.6.4"
diff --git a/packages/ui/tsconfig.json b/packages/ui/tsconfig.json
index 9874ef3e47a..4ebc153690f 100644
--- a/packages/ui/tsconfig.json
+++ b/packages/ui/tsconfig.json
@@ -1,5 +1,8 @@
{
"extends": "@calcom/tsconfig/react-library.json",
+ "compilerOptions": {
+ "resolveJsonModule": true
+ },
"include": ["."],
"exclude": ["dist", "build", "node_modules"]
}
diff --git a/packages/ui/v2/index.tsx b/packages/ui/v2/index.tsx
index 0a79e91f3de..b5ca9614b0f 100644
--- a/packages/ui/v2/index.tsx
+++ b/packages/ui/v2/index.tsx
@@ -1,24 +1,23 @@
-export { default as Button } from "./Button";
-export { default as EmptyScreen } from "./EmptyScreen";
-export { default as Select } from "./form/Select";
-export { default as Loader } from "./Loader";
-export * as Dialog from "./Dialog";
-export * from "./skeleton";
-export { default as Switch } from "./Switch";
-export * from "./Breadcrumb";
-export { default as Tooltip } from "./Tooltip";
+export { default as Avatar } from "./Avatar";
+export { default as AvatarGroup } from "./AvatarGroup";
export { default as Badge } from "./Badge";
-export { default as Checkbox } from "./form/Checkbox";
-export { default as PageHeader } from "./PageHeader";
+export { default as Banner } from "./banner";
+export * from "./Breadcrumb";
+export { default as Button } from "./Button";
export { default as ButtonGroup } from "./ButtonGroup";
+export * from "./Card";
export { default as ColorPicker } from "./colorpicker";
+export * as Dialog from "./Dialog";
+export { default as EmptyScreen } from "./EmptyScreen";
+export { default as Checkbox } from "./form/Checkbox";
export { default as DatePicker } from "./form/DatePicker";
-export { default as Notifcations } from "./notfications";
-export { default as Banner } from "./banner";
export { default as FormStep } from "./form/FormStep";
-export { default as Avatar } from "./Avatar";
-export { default as AvatarGroup } from "./AvatarGroup";
-export * from "./Card";
export * from "./form/radio-area/";
+export { default as Select } from "./form/Select";
+export { default as Loader } from "./Loader";
export * from "./navigation/tabs/";
-export * from "./list-items";
+export { default as Notifcations } from "./notfications";
+export { default as PageHeader } from "./PageHeader";
+export * from "./skeleton";
+export { default as Switch } from "./Switch";
+export { default as Tooltip } from "./Tooltip";
diff --git a/yarn.lock b/yarn.lock
index b6bf2f78fb3..52e98bd985e 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2215,15 +2215,10 @@
resolved "https://registry.yarnpkg.com/@hookform/error-message/-/error-message-2.0.0.tgz#9b1b037fd816ea9b1531c06aa7fab5f5154aa740"
integrity sha512-Y90nHzjgL2MP7GFy75kscdvxrCTjtyxGmOLLxX14nd08OXRIh9lMH/y9Kpdo0p1IPowJBiZMHyueg7p+yrqynQ==
-"@hookform/resolvers@^2.8.1":
- version "2.9.5"
- resolved "https://registry.yarnpkg.com/@hookform/resolvers/-/resolvers-2.9.5.tgz#adfa2d240a9315f4ab6ff4c63621d22d1b574c07"
- integrity sha512-4XABrKdE4GpX6v2RZ+Ij1Wrl9qPEl5ZvVhFxROY+SZhP/6TU8gPw0LO4ZS9/GgIbTx3Pw1U8HmcXVAoGOq+7iA==
-
-"@hookform/resolvers@^2.8.9":
- version "2.8.9"
- resolved "https://registry.yarnpkg.com/@hookform/resolvers/-/resolvers-2.8.9.tgz#0177a6b2b5b0dfa7860625f9a1b71803d467e78a"
- integrity sha512-IXwGpjewxScF4N2kuyYDip6ABqH4lCg9n1f1mp0vbmKik+u+nestpbtdEs6U1WQZxwaoK/2APv1+MEr4czX7XA==
+"@hookform/resolvers@^2.9.7":
+ version "2.9.7"
+ resolved "https://registry.yarnpkg.com/@hookform/resolvers/-/resolvers-2.9.7.tgz#8b257ae67234ce0270e6b044c1a61fb98ec02b4b"
+ integrity sha512-BloehX3MOLwuFEwT4yZnmolPjVmqyn8VsSuodLfazbCIqxBHsQ4qUZsi+bvNNCduRli1AGWFrkDLGD5QoNzsoA==
"@hubspot/api-client@^6.0.1":
version "6.0.1"