diff --git a/apps/api/lib/helpers/captureErrors.ts b/apps/api/lib/helpers/captureErrors.ts index 02aa25183d..654750c074 100644 --- a/apps/api/lib/helpers/captureErrors.ts +++ b/apps/api/lib/helpers/captureErrors.ts @@ -1,4 +1,4 @@ -import * as Sentry from "@sentry/nextjs"; +import { captureException as SentryCaptureException } from "@sentry/nextjs"; import type { NextMiddleware } from "next-api-middleware"; import { redactError } from "@calcom/lib/redactError"; @@ -9,7 +9,7 @@ export const captureErrors: NextMiddleware = async (_req, res, next) => { // middleware and the API route handler await next(); } catch (error) { - Sentry.captureException(error); + SentryCaptureException(error); const redactedError = redactError(error); if (redactedError instanceof Error) { res.status(400).json({ message: redactedError.message, error: redactedError }); diff --git a/apps/api/lib/validations/shared/timeZone.ts b/apps/api/lib/validations/shared/timeZone.ts index e94b0afa09..290bea55fa 100644 --- a/apps/api/lib/validations/shared/timeZone.ts +++ b/apps/api/lib/validations/shared/timeZone.ts @@ -1,5 +1,5 @@ import tzdata from "tzdata"; -import * as z from "zod"; +import { z } from "zod"; // @note: This is a custom validation that checks if the timezone is valid and exists in the tzdb library export const timeZone = z.string().refine((tz: string) => Object.keys(tzdata.zones).includes(tz), { diff --git a/apps/api/sentry.edge.config.ts b/apps/api/sentry.edge.config.ts index 842f09fccc..0e1d2cbecd 100644 --- a/apps/api/sentry.edge.config.ts +++ b/apps/api/sentry.edge.config.ts @@ -1,5 +1,5 @@ -import * as Sentry from "@sentry/nextjs"; +import { init as SentryInit } from "@sentry/nextjs"; -Sentry.init({ +SentryInit({ dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, }); diff --git a/apps/api/sentry.server.config.ts b/apps/api/sentry.server.config.ts index a429088bd9..0798e21c35 100644 --- a/apps/api/sentry.server.config.ts +++ b/apps/api/sentry.server.config.ts @@ -1,6 +1,6 @@ -import * as Sentry from "@sentry/nextjs"; +import { init as SentryInit } from "@sentry/nextjs"; -Sentry.init({ +SentryInit({ dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, tracesSampleRate: 1.0, }); diff --git a/apps/web/components/setup/AdminUser.tsx b/apps/web/components/setup/AdminUser.tsx index 4dce0f9934..34462482a7 100644 --- a/apps/web/components/setup/AdminUser.tsx +++ b/apps/web/components/setup/AdminUser.tsx @@ -3,7 +3,7 @@ import classNames from "classnames"; import { signIn } from "next-auth/react"; import React from "react"; import { Controller, FormProvider, useForm } from "react-hook-form"; -import * as z from "zod"; +import { z } from "zod"; import { isPasswordValid } from "@calcom/features/auth/lib/isPasswordValid"; import { WEBSITE_URL } from "@calcom/lib/constants"; diff --git a/apps/web/components/setup/EnterpriseLicense.tsx b/apps/web/components/setup/EnterpriseLicense.tsx index d30044e920..164b052276 100644 --- a/apps/web/components/setup/EnterpriseLicense.tsx +++ b/apps/web/components/setup/EnterpriseLicense.tsx @@ -3,7 +3,7 @@ import { zodResolver } from "@hookform/resolvers/zod"; import { noop } from "lodash"; import { useCallback, useState } from "react"; import { Controller, FormProvider, useForm, useFormState } from "react-hook-form"; -import * as z from "zod"; +import { z } from "zod"; import { classNames } from "@calcom/lib"; import { CONSOLE_URL } from "@calcom/lib/constants"; diff --git a/apps/web/sentry.edge.config.ts b/apps/web/sentry.edge.config.ts index 842f09fccc..0e1d2cbecd 100644 --- a/apps/web/sentry.edge.config.ts +++ b/apps/web/sentry.edge.config.ts @@ -1,5 +1,5 @@ -import * as Sentry from "@sentry/nextjs"; +import { init as SentryInit } from "@sentry/nextjs"; -Sentry.init({ +SentryInit({ dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, }); diff --git a/apps/web/sentry.server.config.ts b/apps/web/sentry.server.config.ts index a429088bd9..0798e21c35 100644 --- a/apps/web/sentry.server.config.ts +++ b/apps/web/sentry.server.config.ts @@ -1,6 +1,6 @@ -import * as Sentry from "@sentry/nextjs"; +import { init as SentryInit } from "@sentry/nextjs"; -Sentry.init({ +SentryInit({ dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, tracesSampleRate: 1.0, }); diff --git a/packages/app-store/alby/api/webhook.ts b/packages/app-store/alby/api/webhook.ts index 4910d7749c..811dd288aa 100644 --- a/packages/app-store/alby/api/webhook.ts +++ b/packages/app-store/alby/api/webhook.ts @@ -1,6 +1,6 @@ import type { NextApiRequest, NextApiResponse } from "next"; import getRawBody from "raw-body"; -import * as z from "zod"; +import { z } from "zod"; import { albyCredentialKeysSchema } from "@calcom/app-store/alby/lib"; import parseInvoice from "@calcom/app-store/alby/lib/parseInvoice"; diff --git a/packages/app-store/paypal/api/webhook.ts b/packages/app-store/paypal/api/webhook.ts index c48358487c..951cf06c6a 100644 --- a/packages/app-store/paypal/api/webhook.ts +++ b/packages/app-store/paypal/api/webhook.ts @@ -1,6 +1,6 @@ import type { NextApiRequest, NextApiResponse } from "next"; import getRawBody from "raw-body"; -import * as z from "zod"; +import { z } from "zod"; import { paypalCredentialKeysSchema } from "@calcom/app-store/paypal/lib"; import Paypal from "@calcom/app-store/paypal/lib/Paypal"; diff --git a/packages/core/sentryWrapper.ts b/packages/core/sentryWrapper.ts index 5d2ae4b384..5d4d5aac06 100644 --- a/packages/core/sentryWrapper.ts +++ b/packages/core/sentryWrapper.ts @@ -1,4 +1,4 @@ -import * as Sentry from "@sentry/nextjs"; +import { getCurrentHub, startTransaction, captureException } from "@sentry/nextjs"; import type { Span, Transaction } from "@sentry/types"; /* @@ -13,11 +13,11 @@ considering that a million monitored iterations only took roughly 8 seconds when const setUpMonitoring = (name: string) => { // Attempt to retrieve the current transaction from Sentry's scope - let transaction = Sentry.getCurrentHub().getScope()?.getTransaction(); + let transaction = getCurrentHub().getScope()?.getTransaction(); // Check if there's an existing transaction, if not, start a new one if (!transaction) { - transaction = Sentry.startTransaction({ + transaction = startTransaction({ op: name, name: name, }); @@ -37,7 +37,7 @@ const finishMonitoring = (transaction: Transaction | Span, span: Span) => { span.finish(); // If this was a new transaction, finish it - if (!Sentry.getCurrentHub().getScope()?.getTransaction()) { + if (!getCurrentHub().getScope()?.getTransaction()) { transaction.finish(); } }; @@ -55,7 +55,7 @@ const monitorCallbackAsync = async any>( const result = await cb(...args); return result as ReturnType; } catch (error) { - Sentry.captureException(error); + captureException(error); throw error; } finally { finishMonitoring(transaction, span); @@ -75,7 +75,7 @@ const monitorCallbackSync = any>( const result = cb(...args); return result as ReturnType; } catch (error) { - Sentry.captureException(error); + captureException(error); throw error; } finally { finishMonitoring(transaction, span); diff --git a/packages/trpc/server/createNextApiHandler.ts b/packages/trpc/server/createNextApiHandler.ts index 710464f9ac..54e0f6c91e 100644 --- a/packages/trpc/server/createNextApiHandler.ts +++ b/packages/trpc/server/createNextApiHandler.ts @@ -1,15 +1,15 @@ import { z } from "zod"; -import * as trpcNext from "@calcom/trpc/server/adapters/next"; -import { createContext as createTrpcContext } from "@calcom/trpc/server/createContext"; - import type { AnyRouter } from "@trpc/server"; +import { createNextApiHandler as _createNextApiHandler } from "@trpc/server/adapters/next"; + +import { createContext as createTrpcContext } from "./createContext"; /** * Creates an API handler executed by Next.js. */ export function createNextApiHandler(router: AnyRouter, isPublic = false, namespace = "") { - return trpcNext.createNextApiHandler({ + return _createNextApiHandler({ router, /** * @link https://trpc.io/docs/context diff --git a/packages/trpc/server/middlewares/captureErrorsMiddleware.ts b/packages/trpc/server/middlewares/captureErrorsMiddleware.ts index 4112095ef8..019b3715c4 100644 --- a/packages/trpc/server/middlewares/captureErrorsMiddleware.ts +++ b/packages/trpc/server/middlewares/captureErrorsMiddleware.ts @@ -1,4 +1,4 @@ -import * as Sentry from "@sentry/nextjs"; +import { captureException as SentryCaptureException } from "@sentry/nextjs"; import { redactError } from "@calcom/lib/redactError"; @@ -11,7 +11,7 @@ const captureErrorsMiddleware = middleware(async ({ next }) => { if (!cause) { return result; } - Sentry.captureException(cause); + SentryCaptureException(cause); throw redactError(cause); } return result; diff --git a/packages/ui/components/avatar/Avatar.tsx b/packages/ui/components/avatar/Avatar.tsx index e06b20d541..6ebd05d114 100644 --- a/packages/ui/components/avatar/Avatar.tsx +++ b/packages/ui/components/avatar/Avatar.tsx @@ -1,5 +1,5 @@ import * as AvatarPrimitive from "@radix-ui/react-avatar"; -import * as TooltipPrimitive from "@radix-ui/react-tooltip"; +import { Provider as TooltipPrimitiveProvider } from "@radix-ui/react-tooltip"; import Link from "next/link"; import classNames from "@calcom/lib/classNames"; @@ -70,9 +70,9 @@ export function Avatar(props: AvatarProps) { } return title ? ( - + {avatar} - + ) : ( <>{avatar} );