refactor: remove tRPC references from packages/lib (#24553)
This commit is contained in:
1 parent
66234ffba9
commit
71515ad17c
50 files changed
+235
-211
No files matched your search
@@ -6,6 +6,7 @@ import { useFormContext } from "react-hook-form";
|
||||
|
||||
import { isFallbackRoute } from "@calcom/app-store/routing-forms/lib/isFallbackRoute";
|
||||
import type { RoutingFormWithResponseCount } from "@calcom/app-store/routing-forms/types/types";
|
||||
import { useHasPaidPlan } from "@calcom/features/billing/hooks/useHasPaidPlan";
|
||||
import LicenseRequired from "@calcom/features/ee/common/components/LicenseRequired";
|
||||
import SkeletonLoaderTeamList from "@calcom/features/ee/teams/components/SkeletonloaderTeamList";
|
||||
import { CreateButtonWithTeamsList } from "@calcom/features/ee/teams/components/createButton/CreateButtonWithTeamsList";
|
||||
@@ -15,7 +16,6 @@ import { getTeamsFiltersFromQuery } from "@calcom/features/filters/lib/getTeamsF
|
||||
import { ShellMain } from "@calcom/features/shell/Shell";
|
||||
import { UpgradeTip } from "@calcom/features/tips";
|
||||
import { WEBAPP_URL } from "@calcom/lib/constants";
|
||||
import { useHasPaidPlan } from "@calcom/lib/hooks/useHasPaidPlan";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { useRouterQuery } from "@calcom/lib/hooks/useRouterQuery";
|
||||
import { MembershipRole } from "@calcom/prisma/enums";
|
||||
|
||||
@@ -3,9 +3,13 @@ import { ApiError } from "next/dist/server/api-utils";
|
||||
import type { NextRequest } from "next/server";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
import { HttpError } from "@calcom/lib/http-error";
|
||||
import { getServerErrorFromUnknown } from "@calcom/lib/server/getServerErrorFromUnknown";
|
||||
import { performance } from "@calcom/lib/server/perfObserver";
|
||||
|
||||
import { TRPCError } from "@trpc/server";
|
||||
import { getHTTPStatusCodeFromError } from "@trpc/server/http";
|
||||
|
||||
type Handler<T extends NextResponse | Response = NextResponse> = (
|
||||
req: NextRequest,
|
||||
{ params }: { params: Promise<Params> }
|
||||
@@ -34,15 +38,18 @@ export const defaultResponderForAppDir = <T extends NextResponse | Response = Ne
|
||||
|
||||
return NextResponse.json({});
|
||||
} catch (error) {
|
||||
let serverError;
|
||||
let serverError: HttpError;
|
||||
|
||||
if (error instanceof ApiError) {
|
||||
serverError = {
|
||||
if (error instanceof TRPCError) {
|
||||
const statusCode = getHTTPStatusCodeFromError(error);
|
||||
serverError = new HttpError({ statusCode, message: error.message });
|
||||
} else if (error instanceof ApiError) {
|
||||
serverError = new HttpError({
|
||||
message: error.message,
|
||||
statusCode: error.statusCode,
|
||||
url: req.url,
|
||||
method: req.method,
|
||||
};
|
||||
});
|
||||
} else {
|
||||
serverError = getServerErrorFromUnknown(error);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import useApp from "@calcom/lib/hooks/useApp";
|
||||
import useApp from "@calcom/features/apps/hooks/useApp";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import classNames from "@calcom/ui/classNames";
|
||||
import { Button } from "@calcom/ui/components/button";
|
||||
|
||||
File renamed without changes.
+2
-3
@@ -1,8 +1,7 @@
|
||||
import { IS_SELF_HOSTED } from "@calcom/lib/constants";
|
||||
import hasKeyInMetadata from "@calcom/lib/hasKeyInMetadata";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
|
||||
import { IS_SELF_HOSTED } from "../constants";
|
||||
import hasKeyInMetadata from "../hasKeyInMetadata";
|
||||
|
||||
export function useHasPaidPlan() {
|
||||
if (IS_SELF_HOSTED) return { isPending: false, hasPaidPlan: true };
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { DI_TOKENS } from "@calcom/features/di/tokens";
|
||||
import { ScheduleRepository } from "@calcom/lib/server/repository/schedule";
|
||||
import { ScheduleRepository } from "@calcom/features/schedules/repositories/ScheduleRepository";
|
||||
|
||||
import { createModule } from "../di";
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { useState } from "react";
|
||||
|
||||
import type { OrganizationRepository } from "@calcom/features/ee/organizations/repositories/OrganizationRepository";
|
||||
import { trackFormbricksAction } from "@calcom/lib/formbricks-client";
|
||||
import { trackFormbricksAction } from "@calcom/features/formbricks/formbricks-client";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
import { showToast } from "@calcom/ui/components/toast";
|
||||
|
||||
|
||||
@@ -9,9 +9,9 @@ import { Controller, useForm } from "react-hook-form";
|
||||
import { z } from "zod";
|
||||
|
||||
import { Dialog } from "@calcom/features/components/controlled-dialog";
|
||||
import { trackFormbricksAction } from "@calcom/features/formbricks/formbricks-client";
|
||||
import { IS_TEAM_BILLING_ENABLED_CLIENT, WEBAPP_URL } from "@calcom/lib/constants";
|
||||
import { getPlaceholderAvatar } from "@calcom/lib/defaultAvatarImage";
|
||||
import { trackFormbricksAction } from "@calcom/lib/formbricks-client";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { useParamsWithFallback } from "@calcom/lib/hooks/useParamsWithFallback";
|
||||
import { md } from "@calcom/lib/markdownIt";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useHasPaidPlan } from "@calcom/features/billing/hooks/useHasPaidPlan";
|
||||
import { JOIN_COMMUNITY } from "@calcom/lib/constants";
|
||||
import { useHasPaidPlan } from "@calcom/lib/hooks/useHasPaidPlan";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { UpgradeTeamsBadge } from "@calcom/ui/components/badge";
|
||||
import { Icon } from "@calcom/ui/components/icon";
|
||||
|
||||
@@ -6,9 +6,9 @@ import { useEffect, type FC } from "react";
|
||||
import { IntercomProvider } from "react-use-intercom";
|
||||
|
||||
import { useBootIntercom } from "@calcom/ee/support/lib/intercom/useIntercom";
|
||||
import useHasPaidPlan from "@calcom/features/billing/hooks/useHasPaidPlan";
|
||||
import { IntercomContactForm } from "@calcom/features/ee/support/components/IntercomContactForm";
|
||||
import { useFlagMap } from "@calcom/features/flags/context/provider";
|
||||
import useHasPaidPlan from "@calcom/lib/hooks/useHasPaidPlan";
|
||||
import useMediaQuery from "@calcom/lib/hooks/useMediaQuery";
|
||||
|
||||
declare global {
|
||||
|
||||
@@ -5,9 +5,9 @@ import { useIntercom as useIntercomLib } from "react-use-intercom";
|
||||
import { z } from "zod";
|
||||
|
||||
import dayjs from "@calcom/dayjs";
|
||||
import { useHasTeamPlan, useHasPaidPlan } from "@calcom/features/billing/hooks/useHasPaidPlan";
|
||||
import { useFlagMap } from "@calcom/features/flags/context/provider";
|
||||
import { WEBAPP_URL, WEBSITE_URL } from "@calcom/lib/constants";
|
||||
import { useHasTeamPlan, useHasPaidPlan } from "@calcom/lib/hooks/useHasPaidPlan";
|
||||
import useMediaQuery from "@calcom/lib/hooks/useMediaQuery";
|
||||
import { localStorage } from "@calcom/lib/webstorage";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
@@ -18,11 +18,9 @@ const useIntercomHook = isInterComEnabled
|
||||
? useIntercomLib
|
||||
: () => {
|
||||
return {
|
||||
|
||||
boot: (_props: IntercomBootProps) => {},
|
||||
show: noop,
|
||||
shutdown: noop,
|
||||
|
||||
update: (_props: Partial<IntercomProps>) => {},
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useState } from "react";
|
||||
|
||||
import { trackFormbricksAction } from "@calcom/lib/formbricks-client";
|
||||
import { trackFormbricksAction } from "@calcom/features/formbricks/formbricks-client";
|
||||
import type { MembershipRole } from "@calcom/prisma/enums";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
import { showToast } from "@calcom/ui/components/toast";
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { useState } from "react";
|
||||
|
||||
import { trackFormbricksAction } from "@calcom/features/formbricks/formbricks-client";
|
||||
import {
|
||||
ORG_SELF_SERVE_ENABLED,
|
||||
ORG_MINIMUM_PUBLISHED_TEAMS_SELF_SERVE_HELPER_DIALOGUE,
|
||||
} from "@calcom/lib/constants";
|
||||
import { trackFormbricksAction } from "@calcom/lib/formbricks-client";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import type { RouterOutputs } from "@calcom/trpc/react";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
|
||||
@@ -11,10 +11,10 @@ import { z } from "zod";
|
||||
import { checkAdminOrOwner } from "@calcom/features/auth/lib/checkAdminOrOwner";
|
||||
import { Dialog } from "@calcom/features/components/controlled-dialog";
|
||||
import { getTeamUrlSync } from "@calcom/features/ee/organizations/lib/getTeamUrlSync";
|
||||
import { trackFormbricksAction } from "@calcom/features/formbricks/formbricks-client";
|
||||
import SectionBottomActions from "@calcom/features/settings/SectionBottomActions";
|
||||
import { IS_TEAM_BILLING_ENABLED, WEBAPP_URL } from "@calcom/lib/constants";
|
||||
import { getPlaceholderAvatar } from "@calcom/lib/defaultAvatarImage";
|
||||
import { trackFormbricksAction } from "@calcom/lib/formbricks-client";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { useParamsWithFallback } from "@calcom/lib/hooks/useParamsWithFallback";
|
||||
import { md } from "@calcom/lib/markdownIt";
|
||||
|
||||
@@ -4,9 +4,9 @@ import { useRouter } from "next/navigation";
|
||||
import { Suspense, useEffect, useState } from "react";
|
||||
|
||||
import dayjs from "@calcom/dayjs";
|
||||
import { useHasTeamPlan } from "@calcom/features/billing/hooks/useHasPaidPlan";
|
||||
import { Dialog } from "@calcom/features/components/controlled-dialog";
|
||||
import LicenseRequired from "@calcom/features/ee/common/components/LicenseRequired";
|
||||
import { useHasTeamPlan } from "@calcom/lib/hooks/useHasPaidPlan";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import type { RecordingItemSchema } from "@calcom/prisma/zod-utils";
|
||||
import type { RouterOutputs } from "@calcom/trpc/react";
|
||||
|
||||
@@ -3,9 +3,9 @@ import type { Dispatch, SetStateAction } from "react";
|
||||
import { useState, useEffect } from "react";
|
||||
import type { UseFormReturn } from "react-hook-form";
|
||||
|
||||
import type { WorkflowPermissions } from "@calcom/features/workflows/repositories/WorkflowPermissionsRepository";
|
||||
import { SENDER_ID, SENDER_NAME, SCANNING_WORKFLOW_STEPS } from "@calcom/lib/constants";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import type { WorkflowPermissions } from "@calcom/lib/server/repository/workflow-permissions";
|
||||
import { getTimeFormatStringFromUserTimeFormat } from "@calcom/lib/timeFormat";
|
||||
import { WorkflowActions } from "@calcom/prisma/enums";
|
||||
import { WorkflowTemplates } from "@calcom/prisma/enums";
|
||||
|
||||
@@ -3,9 +3,9 @@ import Link from "next/link";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
|
||||
import type { WorkflowPermissions } from "@calcom/features/workflows/repositories/WorkflowPermissionsRepository";
|
||||
import { getPlaceholderAvatar } from "@calcom/lib/defaultAvatarImage";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import type { WorkflowPermissions } from "@calcom/lib/server/repository/workflow-permissions";
|
||||
import type { Membership, Workflow } from "@calcom/prisma/client";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
import classNames from "@calcom/ui/classNames";
|
||||
|
||||
@@ -6,12 +6,12 @@ import type { UseFormReturn } from "react-hook-form";
|
||||
import { Controller, useWatch } from "react-hook-form";
|
||||
import "react-phone-number-input/style.css";
|
||||
|
||||
import { useHasActiveTeamPlan } from "@calcom/features/billing/hooks/useHasPaidPlan";
|
||||
import type { RetellAgentWithDetails } from "@calcom/features/calAIPhone/providers/retellAI";
|
||||
import { Dialog } from "@calcom/features/components/controlled-dialog";
|
||||
import PhoneInput from "@calcom/features/components/phone-input";
|
||||
import { SENDER_ID, SENDER_NAME } from "@calcom/lib/constants";
|
||||
import { formatPhoneNumber } from "@calcom/lib/formatPhoneNumber";
|
||||
import { useHasActiveTeamPlan } from "@calcom/lib/hooks/useHasPaidPlan";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import useMediaQuery from "@calcom/lib/hooks/useMediaQuery";
|
||||
import { HttpError } from "@calcom/lib/http-error";
|
||||
|
||||
@@ -8,10 +8,10 @@ import { useForm, useWatch } from "react-hook-form";
|
||||
import { Toaster } from "sonner";
|
||||
|
||||
import type { WorkflowRepository } from "@calcom/features/ee/workflows/repositories/WorkflowRepository";
|
||||
import type { WorkflowPermissions } from "@calcom/features/workflows/repositories/WorkflowPermissionsRepository";
|
||||
import { SENDER_ID } from "@calcom/lib/constants";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { HttpError } from "@calcom/lib/http-error";
|
||||
import type { WorkflowPermissions } from "@calcom/lib/server/repository/workflow-permissions";
|
||||
import type { WorkflowStep } from "@calcom/prisma/client";
|
||||
import type { TimeUnit, WorkflowTriggerEvents } from "@calcom/prisma/enums";
|
||||
import { WorkflowActions } from "@calcom/prisma/enums";
|
||||
|
||||
File renamed without changes.
+5
-6
@@ -1,13 +1,12 @@
|
||||
import type { PrismaClient } from "@calcom/prisma";
|
||||
import prisma from "@calcom/prisma";
|
||||
import { getDefaultScheduleId } from "@calcom/trpc/server/routers/viewer/availability/util";
|
||||
|
||||
import { hasReadPermissionsForUserId } from "../../hasEditPermissionForUser";
|
||||
import { hasReadPermissionsForUserId } from "@calcom/lib/hasEditPermissionForUser";
|
||||
import {
|
||||
transformAvailabilityForAtom,
|
||||
transformDateOverridesForAtom,
|
||||
transformWorkingHoursForAtom,
|
||||
} from "../../schedules/transformers";
|
||||
} from "@calcom/lib/schedules/transformers";
|
||||
import type { PrismaClient } from "@calcom/prisma";
|
||||
import prisma from "@calcom/prisma";
|
||||
import { getDefaultScheduleId } from "@calcom/trpc/server/routers/viewer/availability/util";
|
||||
|
||||
export type FindDetailedScheduleByIdReturnType = Awaited<
|
||||
ReturnType<typeof ScheduleRepository.findDetailedScheduleById>
|
||||
@@ -0,0 +1,146 @@
|
||||
import { getAvailabilityFromSchedule } from "@calcom/lib/availability";
|
||||
import { hasEditPermissionForUserID } from "@calcom/lib/hasEditPermissionForUser";
|
||||
import { HttpError } from "@calcom/lib/http-error";
|
||||
import { transformScheduleToAvailabilityForAtom } from "@calcom/lib/schedules/transformers/for-atom";
|
||||
import type { PrismaClient } from "@calcom/prisma";
|
||||
import type { TUpdateInputSchema } from "@calcom/trpc/server/routers/viewer/availability/schedule/update.schema";
|
||||
import { setupDefaultSchedule } from "@calcom/trpc/server/routers/viewer/availability/util";
|
||||
import type { TrpcSessionUser } from "@calcom/trpc/server/types";
|
||||
|
||||
interface IUpdateScheduleOptions {
|
||||
input: TUpdateInputSchema;
|
||||
user: Pick<NonNullable<TrpcSessionUser>, "id" | "defaultScheduleId" | "timeZone">;
|
||||
}
|
||||
|
||||
export type UpdateScheduleResponse = Awaited<ReturnType<ScheduleService["update"]>>;
|
||||
|
||||
export class ScheduleService {
|
||||
constructor(private prisma: PrismaClient) {}
|
||||
|
||||
async update({ input, user }: IUpdateScheduleOptions) {
|
||||
const availability = input.schedule
|
||||
? getAvailabilityFromSchedule(input.schedule)
|
||||
: (input.dateOverrides || []).map((dateOverride) => ({
|
||||
startTime: dateOverride.start,
|
||||
endTime: dateOverride.end,
|
||||
date: dateOverride.start,
|
||||
days: [],
|
||||
}));
|
||||
|
||||
// Not able to update the schedule with userId where clause, so fetch schedule separately and then validate
|
||||
// Bug: https://github.com/prisma/prisma/issues/7290
|
||||
const userSchedule = await this.prisma.schedule.findUnique({
|
||||
where: {
|
||||
id: input.scheduleId,
|
||||
},
|
||||
select: {
|
||||
userId: true,
|
||||
name: true,
|
||||
id: true,
|
||||
},
|
||||
});
|
||||
|
||||
if (!userSchedule) {
|
||||
throw new HttpError({
|
||||
statusCode: 401,
|
||||
message: "Unauthorized",
|
||||
});
|
||||
}
|
||||
|
||||
if (userSchedule?.userId !== user.id) {
|
||||
const hasEditPermission = await hasEditPermissionForUserID({
|
||||
ctx: {
|
||||
user,
|
||||
},
|
||||
input: { memberId: userSchedule.userId },
|
||||
});
|
||||
if (!hasEditPermission) {
|
||||
throw new HttpError({
|
||||
statusCode: 401,
|
||||
message: "Unauthorized",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
let updatedUser;
|
||||
if (input.isDefault) {
|
||||
const setupDefault = await setupDefaultSchedule(user.id, input.scheduleId, this.prisma);
|
||||
updatedUser = setupDefault;
|
||||
}
|
||||
|
||||
if (!input.name) {
|
||||
// TODO: Improve
|
||||
// We don't want to pass the full schedule for just a set as default update
|
||||
// but in the current logic, this wipes the existing availability.
|
||||
// Return early to prevent this from happening.
|
||||
return {
|
||||
schedule: userSchedule,
|
||||
isDefault: updatedUser
|
||||
? updatedUser.defaultScheduleId === input.scheduleId
|
||||
: user.defaultScheduleId === input.scheduleId,
|
||||
};
|
||||
}
|
||||
|
||||
const schedule = await this.prisma.schedule.update({
|
||||
where: {
|
||||
id: input.scheduleId,
|
||||
},
|
||||
data: {
|
||||
timeZone: input.timeZone,
|
||||
name: input.name,
|
||||
availability: {
|
||||
deleteMany: {
|
||||
scheduleId: {
|
||||
equals: input.scheduleId,
|
||||
},
|
||||
},
|
||||
createMany: {
|
||||
data: [
|
||||
...availability,
|
||||
...(input.dateOverrides || []).map((override) => ({
|
||||
date: override.start,
|
||||
startTime: override.start,
|
||||
endTime: override.end,
|
||||
})),
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
userId: true,
|
||||
name: true,
|
||||
availability: true,
|
||||
timeZone: true,
|
||||
eventType: {
|
||||
select: {
|
||||
id: true,
|
||||
eventName: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const userAvailability = transformScheduleToAvailabilityForAtom(schedule);
|
||||
|
||||
return {
|
||||
schedule,
|
||||
availability: userAvailability,
|
||||
timeZone: schedule.timeZone || user.timeZone,
|
||||
isDefault: updatedUser
|
||||
? updatedUser.defaultScheduleId === schedule.id
|
||||
: user.defaultScheduleId === schedule.id,
|
||||
prevDefaultId: user.defaultScheduleId,
|
||||
currentDefaultId: updatedUser ? updatedUser.defaultScheduleId : user.defaultScheduleId,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export const updateSchedule = async ({
|
||||
input,
|
||||
user,
|
||||
prisma,
|
||||
}: IUpdateScheduleOptions & { prisma: PrismaClient }) => {
|
||||
const service = new ScheduleService(prisma);
|
||||
return service.update({ input, user });
|
||||
};
|
||||
@@ -2,10 +2,10 @@ import { useState } from "react";
|
||||
import { Controller, useForm } from "react-hook-form";
|
||||
|
||||
import dayjs from "@calcom/dayjs";
|
||||
import { useHasTeamPlan } from "@calcom/features/billing/hooks/useHasPaidPlan";
|
||||
import { Dialog } from "@calcom/features/components/controlled-dialog";
|
||||
import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams";
|
||||
import { useDebounce } from "@calcom/lib/hooks/useDebounce";
|
||||
import { useHasTeamPlan } from "@calcom/lib/hooks/useHasPaidPlan";
|
||||
import { useInViewObserver } from "@calcom/lib/hooks/useInViewObserver";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
@@ -67,7 +67,7 @@ export const CreateOrEditOutOfOfficeEntryModal = ({
|
||||
value: number;
|
||||
label: string;
|
||||
avatarUrl: string | null;
|
||||
}[] = !!currentlyEditingOutOfOfficeEntry
|
||||
}[] = currentlyEditingOutOfOfficeEntry
|
||||
? [
|
||||
{
|
||||
value: currentlyEditingOutOfOfficeEntry.forUserId || -1,
|
||||
@@ -236,7 +236,7 @@ export const CreateOrEditOutOfOfficeEntryModal = ({
|
||||
/>
|
||||
<div
|
||||
className={`scroll-bar bg-default mt-2 flex ${
|
||||
!!currentlyEditingOutOfOfficeEntry ? "h-[45px]" : "h-[150px]"
|
||||
currentlyEditingOutOfOfficeEntry ? "h-[45px]" : "h-[150px]"
|
||||
} flex-col gap-0.5 overflow-y-scroll rounded-[10px] border p-1`}>
|
||||
{oooMemberListOptions.map((member) => (
|
||||
<label
|
||||
|
||||
@@ -8,9 +8,9 @@ import { Toaster } from "sonner";
|
||||
|
||||
import { useRedirectToLoginIfUnauthenticated } from "@calcom/features/auth/lib/hooks/useRedirectToLoginIfUnauthenticated";
|
||||
import { useRedirectToOnboardingIfNeeded } from "@calcom/features/auth/lib/hooks/useRedirectToOnboardingIfNeeded";
|
||||
import { useFormbricks } from "@calcom/features/formbricks/formbricks-client";
|
||||
import { KBarContent, KBarRoot } from "@calcom/features/kbar/Kbar";
|
||||
import TimezoneChangeDialog from "@calcom/features/settings/TimezoneChangeDialog";
|
||||
import { useFormbricks } from "@calcom/lib/formbricks-client";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import classNames from "@calcom/ui/classNames";
|
||||
import { Button } from "@calcom/ui/components/button";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useTeamInvites } from "@calcom/lib/hooks/useHasPaidPlan";
|
||||
import { useTeamInvites } from "@calcom/features/billing/hooks/useHasPaidPlan";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { Badge } from "@calcom/ui/components/badge";
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { User as UserAuth } from "next-auth";
|
||||
|
||||
import { useHasActiveTeamPlanAsOwner } from "@calcom/features/billing/hooks/useHasPaidPlan";
|
||||
import { IS_DUB_REFERRALS_ENABLED } from "@calcom/lib/constants";
|
||||
import { useHasActiveTeamPlanAsOwner } from "@calcom/lib/hooks/useHasPaidPlan";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
import { showToast } from "@calcom/ui/components/toast";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { ReactNode } from "react";
|
||||
|
||||
import { useHasTeamPlan } from "@calcom/lib/hooks/useHasPaidPlan";
|
||||
import { useHasTeamPlan } from "@calcom/features/billing/hooks/useHasPaidPlan";
|
||||
import { useGetTheme } from "@calcom/lib/hooks/useTheme";
|
||||
import { trpc } from "@calcom/trpc";
|
||||
import classNames from "@calcom/ui/classNames";
|
||||
|
||||
File renamed without changes.
@@ -1,8 +1,7 @@
|
||||
import { prisma } from "@calcom/prisma";
|
||||
import { SMSLockState } from "@calcom/prisma/enums";
|
||||
|
||||
import { TRPCError } from "@trpc/server";
|
||||
|
||||
import { HttpError } from "./http-error";
|
||||
import type { RateLimitHelper } from "./rateLimit";
|
||||
import { rateLimiter } from "./rateLimit";
|
||||
|
||||
@@ -20,8 +19,8 @@ export async function checkRateLimitAndThrowError({
|
||||
if (!success) {
|
||||
const convertToSeconds = (ms: number) => Math.floor(ms / 1000);
|
||||
const secondsToWait = convertToSeconds(reset - Date.now());
|
||||
throw new TRPCError({
|
||||
code: "TOO_MANY_REQUESTS",
|
||||
throw new HttpError({
|
||||
statusCode: 429,
|
||||
message: `Rate limit exceeded. Try again in ${secondsToWait} seconds.`,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { TRPCClientError } from "@trpc/client";
|
||||
|
||||
import { HttpError } from "./http-error";
|
||||
|
||||
export function getClientErrorFromUnknown(cause: unknown): Error {
|
||||
@@ -7,9 +5,6 @@ export function getClientErrorFromUnknown(cause: unknown): Error {
|
||||
const message = `${cause.statusCode}: ${cause.message}`;
|
||||
return new Error(message);
|
||||
}
|
||||
if (cause instanceof TRPCClientError) {
|
||||
return new Error(cause.message);
|
||||
}
|
||||
if (cause instanceof Error) {
|
||||
return new Error(cause.message);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import { prisma } from "@calcom/prisma";
|
||||
import { MembershipRole } from "@calcom/prisma/enums";
|
||||
import type { TrpcSessionUser } from "@calcom/trpc/server/types";
|
||||
|
||||
type InputOptions = {
|
||||
ctx: {
|
||||
user: { id: NonNullable<TrpcSessionUser>["id"] };
|
||||
user: { id: number };
|
||||
};
|
||||
input: {
|
||||
memberId: number;
|
||||
|
||||
@@ -1,133 +0,0 @@
|
||||
import { getAvailabilityFromSchedule } from "@calcom/lib/availability";
|
||||
import { hasEditPermissionForUserID } from "@calcom/lib/hasEditPermissionForUser";
|
||||
import { transformScheduleToAvailabilityForAtom } from "@calcom/lib/schedules/transformers/for-atom";
|
||||
import type { PrismaClient } from "@calcom/prisma";
|
||||
import type { TUpdateInputSchema } from "@calcom/trpc/server/routers/viewer/availability/schedule/update.schema";
|
||||
import { setupDefaultSchedule } from "@calcom/trpc/server/routers/viewer/availability/util";
|
||||
import type { TrpcSessionUser } from "@calcom/trpc/server/types";
|
||||
|
||||
import { TRPCError } from "@trpc/server";
|
||||
|
||||
interface IUpdateScheduleOptions {
|
||||
input: TUpdateInputSchema;
|
||||
user: Pick<NonNullable<TrpcSessionUser>, "id" | "defaultScheduleId" | "timeZone">;
|
||||
prisma: PrismaClient;
|
||||
}
|
||||
|
||||
export type UpdateScheduleResponse = Awaited<ReturnType<typeof updateSchedule>>;
|
||||
|
||||
export const updateSchedule = async ({ input, user, prisma }: IUpdateScheduleOptions) => {
|
||||
const availability = input.schedule
|
||||
? getAvailabilityFromSchedule(input.schedule)
|
||||
: (input.dateOverrides || []).map((dateOverride) => ({
|
||||
startTime: dateOverride.start,
|
||||
endTime: dateOverride.end,
|
||||
date: dateOverride.start,
|
||||
days: [],
|
||||
}));
|
||||
|
||||
// Not able to update the schedule with userId where clause, so fetch schedule separately and then validate
|
||||
// Bug: https://github.com/prisma/prisma/issues/7290
|
||||
const userSchedule = await prisma.schedule.findUnique({
|
||||
where: {
|
||||
id: input.scheduleId,
|
||||
},
|
||||
select: {
|
||||
userId: true,
|
||||
name: true,
|
||||
id: true,
|
||||
},
|
||||
});
|
||||
|
||||
if (!userSchedule) {
|
||||
throw new TRPCError({
|
||||
code: "UNAUTHORIZED",
|
||||
});
|
||||
}
|
||||
|
||||
if (userSchedule?.userId !== user.id) {
|
||||
const hasEditPermission = await hasEditPermissionForUserID({
|
||||
ctx: {
|
||||
user,
|
||||
},
|
||||
input: { memberId: userSchedule.userId },
|
||||
});
|
||||
if (!hasEditPermission) {
|
||||
throw new TRPCError({
|
||||
code: "UNAUTHORIZED",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
let updatedUser;
|
||||
if (input.isDefault) {
|
||||
const setupDefault = await setupDefaultSchedule(user.id, input.scheduleId, prisma);
|
||||
updatedUser = setupDefault;
|
||||
}
|
||||
|
||||
if (!input.name) {
|
||||
// TODO: Improve
|
||||
// We don't want to pass the full schedule for just a set as default update
|
||||
// but in the current logic, this wipes the existing availability.
|
||||
// Return early to prevent this from happening.
|
||||
return {
|
||||
schedule: userSchedule,
|
||||
isDefault: updatedUser
|
||||
? updatedUser.defaultScheduleId === input.scheduleId
|
||||
: user.defaultScheduleId === input.scheduleId,
|
||||
};
|
||||
}
|
||||
|
||||
const schedule = await prisma.schedule.update({
|
||||
where: {
|
||||
id: input.scheduleId,
|
||||
},
|
||||
data: {
|
||||
timeZone: input.timeZone,
|
||||
name: input.name,
|
||||
availability: {
|
||||
deleteMany: {
|
||||
scheduleId: {
|
||||
equals: input.scheduleId,
|
||||
},
|
||||
},
|
||||
createMany: {
|
||||
data: [
|
||||
...availability,
|
||||
...(input.dateOverrides || []).map((override) => ({
|
||||
date: override.start,
|
||||
startTime: override.start,
|
||||
endTime: override.end,
|
||||
})),
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
userId: true,
|
||||
name: true,
|
||||
availability: true,
|
||||
timeZone: true,
|
||||
eventType: {
|
||||
select: {
|
||||
id: true,
|
||||
eventName: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const userAvailability = transformScheduleToAvailabilityForAtom(schedule);
|
||||
|
||||
return {
|
||||
schedule,
|
||||
availability: userAvailability,
|
||||
timeZone: schedule.timeZone || user.timeZone,
|
||||
isDefault: updatedUser
|
||||
? updatedUser.defaultScheduleId === schedule.id
|
||||
: user.defaultScheduleId === schedule.id,
|
||||
prevDefaultId: user.defaultScheduleId,
|
||||
currentDefaultId: updatedUser ? updatedUser.defaultScheduleId : user.defaultScheduleId,
|
||||
};
|
||||
};
|
||||
@@ -1,5 +1,9 @@
|
||||
import type { NextApiRequest, NextApiResponse } from "next";
|
||||
|
||||
import { TRPCError } from "@trpc/server";
|
||||
import { getHTTPStatusCodeFromError } from "@trpc/server/http";
|
||||
|
||||
import { HttpError } from "../http-error";
|
||||
import { getServerErrorFromUnknown } from "./getServerErrorFromUnknown";
|
||||
import { performance } from "./perfObserver";
|
||||
|
||||
@@ -29,7 +33,13 @@ export function defaultResponder<T>(
|
||||
return res.json(result);
|
||||
}
|
||||
} catch (err) {
|
||||
const error = getServerErrorFromUnknown(err);
|
||||
let error: HttpError;
|
||||
if (err instanceof TRPCError) {
|
||||
const statusCode = getHTTPStatusCodeFromError(err);
|
||||
error = new HttpError({ statusCode, message: err.message });
|
||||
} else {
|
||||
error = getServerErrorFromUnknown(err);
|
||||
}
|
||||
// we don't want to report Bad Request errors to Sentry / console
|
||||
if (!(error.statusCode >= 400 && error.statusCode < 500)) {
|
||||
console.error(error);
|
||||
|
||||
@@ -5,9 +5,6 @@ import { ErrorCode } from "@calcom/lib/errorCodes";
|
||||
import { ErrorWithCode } from "@calcom/lib/errors";
|
||||
import { Prisma } from "@calcom/prisma/client";
|
||||
|
||||
import { TRPCError } from "@trpc/server";
|
||||
import { getHTTPStatusCodeFromError } from "@trpc/server/http";
|
||||
|
||||
import { HttpError } from "../http-error";
|
||||
import { redactError } from "../redactError";
|
||||
import { stripeInvalidRequestErrorSchema } from "../stripe-error";
|
||||
@@ -37,10 +34,6 @@ function parseZodErrorIssues(issues: ZodIssue[]): string {
|
||||
}
|
||||
|
||||
export function getServerErrorFromUnknown(cause: unknown): HttpError {
|
||||
if (cause instanceof TRPCError) {
|
||||
const statusCode = getHTTPStatusCodeFromError(cause);
|
||||
return new HttpError({ statusCode, message: cause.message });
|
||||
}
|
||||
if (isZodError(cause)) {
|
||||
return new HttpError({
|
||||
statusCode: 400,
|
||||
@@ -87,8 +80,10 @@ export function getServerErrorFromUnknown(cause: unknown): HttpError {
|
||||
return getHttpError({ statusCode, cause });
|
||||
}
|
||||
if (typeof cause === "string") {
|
||||
// @ts-expect-error https://github.com/tc39/proposal-error-cause
|
||||
return new Error(cause, { cause });
|
||||
return new HttpError({
|
||||
statusCode: 500,
|
||||
message: cause,
|
||||
});
|
||||
}
|
||||
|
||||
return new HttpError({
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ import type { ReactNode } from "react";
|
||||
import { forwardRef, useRef } from "react";
|
||||
|
||||
import type { ScheduleLabelsType } from "@calcom/features/schedules/components/Schedule";
|
||||
import type { UpdateScheduleResponse } from "@calcom/lib/schedules/updateSchedule";
|
||||
import type { UpdateScheduleResponse } from "@calcom/features/schedules/services/ScheduleService";
|
||||
import type { ApiErrorResponse, ApiResponse, UpdateScheduleInput_2024_06_11 } from "@calcom/platform-types";
|
||||
|
||||
import { useAtomSchedule } from "../../hooks/schedules/useAtomSchedule";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import type { FindDetailedScheduleByIdReturnType } from "@calcom/lib/server/repository/schedule";
|
||||
import type { FindDetailedScheduleByIdReturnType } from "@calcom/features/schedules/repositories/ScheduleRepository";
|
||||
import { SUCCESS_STATUS } from "@calcom/platform-constants";
|
||||
import type { ApiResponse } from "@calcom/platform-types";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
|
||||
import type { UpdateScheduleResponse } from "@calcom/lib/schedules/updateSchedule";
|
||||
import type { UpdateScheduleResponse } from "@calcom/features/schedules/services/ScheduleService";
|
||||
import { SUCCESS_STATUS } from "@calcom/platform-constants";
|
||||
import type { ApiResponse, ApiErrorResponse, UpdateAtomScheduleDto } from "@calcom/platform-types";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export { PrismaAttributeRepository } from "@calcom/lib/server/repository/PrismaAttributeRepository";
|
||||
export { PrismaOOORepository } from "@calcom/lib/server/repository/ooo";
|
||||
export { ScheduleRepository as PrismaScheduleRepository } from "@calcom/lib/server/repository/schedule";
|
||||
export { ScheduleRepository as PrismaScheduleRepository } from "@calcom/features/schedules/repositories/ScheduleRepository";
|
||||
export { BookingRepository as PrismaBookingRepository } from "@calcom/features/bookings/repositories/BookingRepository";
|
||||
export { EventTypeRepository as PrismaEventTypeRepository } from "@calcom/features/eventtypes/repositories/eventTypeRepository";
|
||||
export { RoutingFormResponseRepository as PrismaRoutingFormResponseRepository } from "@calcom/lib/server/repository/formResponse";
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
export {
|
||||
ScheduleRepository,
|
||||
type FindDetailedScheduleByIdReturnType,
|
||||
} from "@calcom/lib/server/repository/schedule";
|
||||
} from "@calcom/features/schedules/repositories/ScheduleRepository";
|
||||
|
||||
export { updateSchedule, type UpdateScheduleResponse } from "@calcom/lib/schedules/updateSchedule";
|
||||
export {
|
||||
updateSchedule,
|
||||
type UpdateScheduleResponse,
|
||||
} from "@calcom/features/schedules/services/ScheduleService";
|
||||
export { UserAvailabilityService } from "@calcom/features/availability/lib/getUserAvailability";
|
||||
|
||||
export {
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import { captureException } from "@sentry/nextjs";
|
||||
import type { NextApiRequest, NextApiResponse } from "next";
|
||||
|
||||
import { HttpError } from "@calcom/lib/http-error";
|
||||
import { getServerErrorFromUnknown } from "@calcom/lib/server/getServerErrorFromUnknown";
|
||||
|
||||
import type { TRPCError } from "@trpc/server";
|
||||
import { TRPCError } from "@trpc/server";
|
||||
import { getHTTPStatusCodeFromError } from "@trpc/server/http";
|
||||
|
||||
type OnErrorOptions = {
|
||||
error: TRPCError;
|
||||
@@ -12,8 +14,13 @@ type OnErrorOptions = {
|
||||
};
|
||||
|
||||
export function onErrorHandler({ error }: OnErrorOptions) {
|
||||
// Convert any error to a HttpError using our centralized error handling
|
||||
const httpError = getServerErrorFromUnknown(error);
|
||||
let httpError: HttpError;
|
||||
if (error instanceof TRPCError) {
|
||||
const statusCode = getHTTPStatusCodeFromError(error);
|
||||
httpError = new HttpError({ statusCode, message: error.message });
|
||||
} else {
|
||||
httpError = getServerErrorFromUnknown(error);
|
||||
}
|
||||
|
||||
// Log errors that aren't client errors (400s)
|
||||
if (httpError.statusCode >= 500) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ScheduleRepository } from "@calcom/lib/server/repository/schedule";
|
||||
import { ScheduleRepository } from "@calcom/features/schedules/repositories/ScheduleRepository";
|
||||
|
||||
import type { TrpcSessionUser } from "../../../../types";
|
||||
import type { TGetInputSchema } from "./get.schema";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { updateSchedule } from "@calcom/lib/schedules/updateSchedule";
|
||||
import { updateSchedule } from "@calcom/features/schedules/services/ScheduleService";
|
||||
import { prisma } from "@calcom/prisma";
|
||||
import type { TrpcSessionUser } from "@calcom/trpc/server/types";
|
||||
|
||||
|
||||
@@ -11,12 +11,12 @@ import {
|
||||
import { HashedLinkRepository } from "@calcom/features/hashedLink/lib/repository/HashedLinkRepository";
|
||||
import { HashedLinkService } from "@calcom/features/hashedLink/lib/service/HashedLinkService";
|
||||
import { MembershipRepository } from "@calcom/features/membership/repositories/MembershipRepository";
|
||||
import { ScheduleRepository } from "@calcom/features/schedules/repositories/ScheduleRepository";
|
||||
import tasker from "@calcom/features/tasker";
|
||||
import { validateIntervalLimitOrder } from "@calcom/lib/intervalLimits/validateIntervalLimitOrder";
|
||||
import logger from "@calcom/lib/logger";
|
||||
import { getTranslation } from "@calcom/lib/server/i18n";
|
||||
import { CalVideoSettingsRepository } from "@calcom/lib/server/repository/calVideoSettings";
|
||||
import { ScheduleRepository } from "@calcom/lib/server/repository/schedule";
|
||||
import { validateBookerLayouts } from "@calcom/lib/validateBookerLayouts";
|
||||
import type { PrismaClient } from "@calcom/prisma";
|
||||
import { Prisma } from "@calcom/prisma/client";
|
||||
|
||||
@@ -28,6 +28,7 @@ import type { FeaturesRepository } from "@calcom/features/flags/features.reposit
|
||||
import type { IRedisService } from "@calcom/features/redis/IRedisService";
|
||||
import { buildDateRanges } from "@calcom/features/schedules/lib/date-ranges";
|
||||
import getSlots from "@calcom/features/schedules/lib/slots";
|
||||
import type { ScheduleRepository } from "@calcom/features/schedules/repositories/ScheduleRepository";
|
||||
import type { UserRepository } from "@calcom/features/users/repositories/UserRepository";
|
||||
import { withSelectedCalendars } from "@calcom/features/users/repositories/UserRepository";
|
||||
import { shouldIgnoreContactOwner } from "@calcom/lib/bookings/routing/utils";
|
||||
@@ -51,7 +52,6 @@ import { withReporting } from "@calcom/lib/sentryWrapper";
|
||||
import type { ISelectedSlotRepository } from "@calcom/lib/server/repository/ISelectedSlotRepository";
|
||||
import type { RoutingFormResponseRepository } from "@calcom/lib/server/repository/formResponse";
|
||||
import type { PrismaOOORepository } from "@calcom/lib/server/repository/ooo";
|
||||
import type { ScheduleRepository } from "@calcom/lib/server/repository/schedule";
|
||||
import { SchedulingType, PeriodType } from "@calcom/prisma/enums";
|
||||
import type { EventBusyDate, EventBusyDetails } from "@calcom/types/Calendar";
|
||||
import type { CredentialForCalendarService } from "@calcom/types/Credential";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { WorkflowRepository } from "@calcom/features/ee/workflows/repositories/WorkflowRepository";
|
||||
import { addPermissionsToWorkflows } from "@calcom/lib/server/repository/workflow-permissions";
|
||||
import { addPermissionsToWorkflows } from "@calcom/features/workflows/repositories/WorkflowPermissionsRepository";
|
||||
import type { PrismaClient } from "@calcom/prisma";
|
||||
import type { Prisma } from "@calcom/prisma/client";
|
||||
import type { TrpcSessionUser } from "@calcom/trpc/server/types";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { WorkflowRepository } from "@calcom/features/ee/workflows/repositories/WorkflowRepository";
|
||||
import { addPermissionsToWorkflow } from "@calcom/lib/server/repository/workflow-permissions";
|
||||
import { addPermissionsToWorkflow } from "@calcom/features/workflows/repositories/WorkflowPermissionsRepository";
|
||||
import type { TrpcSessionUser } from "@calcom/trpc/server/types";
|
||||
|
||||
import { TRPCError } from "@trpc/server";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { eventTypeMetaDataSchemaWithTypedApps } from "@calcom/app-store/zod-utils";
|
||||
import { PermissionCheckService } from "@calcom/features/pbac/services/permission-check.service";
|
||||
import { addPermissionsToWorkflows } from "@calcom/lib/server/repository/workflow-permissions";
|
||||
import { addPermissionsToWorkflows } from "@calcom/features/workflows/repositories/WorkflowPermissionsRepository";
|
||||
import { MembershipRole } from "@calcom/prisma/enums";
|
||||
import type { TrpcSessionUser } from "@calcom/trpc/server/types";
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { WorkflowType } from "@calcom/features/ee/workflows/components/Work
|
||||
import { WorkflowRepository } from "@calcom/features/ee/workflows/repositories/WorkflowRepository";
|
||||
// import dayjs from "@calcom/dayjs";
|
||||
// import { getErrorFromUnknown } from "@calcom/lib/errors";
|
||||
import { addPermissionsToWorkflows } from "@calcom/lib/server/repository/workflow-permissions";
|
||||
import { addPermissionsToWorkflows } from "@calcom/features/workflows/repositories/WorkflowPermissionsRepository";
|
||||
import type { PrismaClient } from "@calcom/prisma";
|
||||
import { MembershipRole } from "@calcom/prisma/enums";
|
||||
import type { TrpcSessionUser } from "@calcom/trpc/server/types";
|
||||
|
||||
@@ -5,11 +5,11 @@ import { WorkflowReminderRepository } from "@calcom/features/ee/workflows/lib/re
|
||||
import { WorkflowRepository } from "@calcom/features/ee/workflows/repositories/WorkflowRepository";
|
||||
import { EventTypeRepository } from "@calcom/features/eventtypes/repositories/eventTypeRepository";
|
||||
import tasker from "@calcom/features/tasker";
|
||||
import { addPermissionsToWorkflow } from "@calcom/features/workflows/repositories/WorkflowPermissionsRepository";
|
||||
import { IS_SELF_HOSTED, SCANNING_WORKFLOW_STEPS } from "@calcom/lib/constants";
|
||||
import hasKeyInMetadata from "@calcom/lib/hasKeyInMetadata";
|
||||
import logger from "@calcom/lib/logger";
|
||||
import { PrismaAgentRepository } from "@calcom/lib/server/repository/PrismaAgentRepository";
|
||||
import { addPermissionsToWorkflow } from "@calcom/lib/server/repository/workflow-permissions";
|
||||
import { WorkflowRelationsRepository } from "@calcom/lib/server/repository/workflowRelations";
|
||||
import { WorkflowStepRepository } from "@calcom/lib/server/repository/workflowStep";
|
||||
import { prisma, type PrismaClient } from "@calcom/prisma";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Link from "next/link";
|
||||
|
||||
import { useHasPaidPlan, useHasActiveTeamPlan } from "@calcom/lib/hooks/useHasPaidPlan";
|
||||
import { useHasPaidPlan, useHasActiveTeamPlan } from "@calcom/features/billing/hooks/useHasPaidPlan";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
|
||||
import { Tooltip } from "../tooltip";
|
||||
|
||||
Reference in new issue
Block a user