feat: Upgrade to Next 15 (#18834)

* wip

* update layoutHOC

* wip

* remove app router related code no longer used

* remove more

* await cookies, headers, params, serachparams

* update yarn.lock

* await cookies, headers, params, serachparams more

* update yarn lock again

* downgrade next-auth to 4.22.1

* update yarn lock

* fix

* update yarn lock

* fix type checks

* update yarn lock

* await headers and cookies

* restore pages folder

* restore yarn.lock

* update yarn.lock

* await headers and cookies

* remove

* await params in API routes

* updates

* restore next.config.js

* remove i18n from next.config.js

* Fixed tests

* Fixed types

* Removed duplicate favicon.ico

* Fixing more types

* ImageResponse moved to next/og

* Fixed prisma import issues

* dynamic import for @ewsjs/xhr

* remove deasync dep

* dynamic import for @tryvital/vital-node

* fix type checks

* add back turbopack command

* Type fix

* Removed unneeded file

* fix turbopack relative path errors

* add comments

* remove unneeded code

* Fixed build errors

* await apis

* use Promise<Params> type in defaultResponderForAppDir util

* refactor scim api route

* fix type checks

* separate app-routing.config into client-config and server-config

* wip

* refactor routing forms components

* revert unneeded changes for easier review

* fix

* fix

* use CustomTrans

* fix type

* fix unit tests

* fix type error

* fix build error

* fix build error

* fix build error

* fix warnings

* fix warnings

* upgrade @tremor/react and tailwindcss

* numCols -> numItems

* fix forgot-password e2e test

* fix 1 more e2e test

* fix login e2e test

* fix e2e tests

* fix e2e tests

* clean up

* remove error

* use tremor/react 2.11.0

* fix

* rename CustomTrans to ServerTrans

* address comment

* fix test

* fix ServerTrans

* fix

* fix type

* fix ServerTrans usages 1

* fix translations

* fix type checks

* fix type checks

* link styling

* fix

---------

Co-authored-by: Keith Williams <[email protected]>
Co-authored-by: Anik Dhabal Babu <[email protected]>
This commit is contained in:
authored and GitHub committed 2025-03-20 21:30:51 -03:00
1 parent 695a4d7a59
commit 8ad442f2be
263 files changed
+2002 -1663

No files matched your search

@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { createAProfileForAnExistingUser } from "@calcom/lib/createAProfileForAnExistingUser";
import prisma from "@calcom/prisma";
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { createAProfileForAnExistingUser } from "@calcom/lib/createAProfileForAnExistingUser";
import prisma from "@calcom/prisma";
@@ -1,6 +1,6 @@
// eslint-disable-next-line no-restricted-imports
import { get } from "lodash";
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import type { Dispatch, SetStateAction } from "react";
import { useState } from "react";
import type { UseFormReturn } from "react-hook-form";
@@ -30,32 +30,6 @@ vi.mock("@calcom/trpc/server/routers/viewer/organizations/createTeams.handler",
createTeamsHandler: vi.fn(),
}));
vi.mock("next-i18next", () => ({
serverSideTranslations: vi.fn().mockImplementation(async () => {
return {
_nextI18Next: {
initialI18nStore: {
en: {
common: {},
},
},
userConfig: {
i18n: {
defaultLocale: "en",
locales: ["en"],
},
},
},
};
}),
i18n: {
language: "en",
languages: ["en"],
defaultLocale: "en",
getFixedT: () => (key: string) => key,
},
}));
vi.mock("@calcom/lib/domainManager/organization", () => ({
createDomain: vi.fn(),
}));
@@ -1,6 +1,5 @@
"use client";
import { Trans } from "next-i18next";
import { useState } from "react";
import { useLocale } from "@calcom/lib/hooks/useLocale";
@@ -9,6 +8,7 @@ import { Badge } from "@calcom/ui/components/badge";
import { Dialog, ConfirmationDialogContent } from "@calcom/ui/components/dialog";
import { DropdownActions, Table } from "@calcom/ui/components/table";
import { showToast } from "@calcom/ui/components/toast";
import ServerTrans from "@calcom/web/components/ServerTrans";
import { subdomainSuffix } from "../../../../organizations/lib/orgDomains";
@@ -251,20 +251,12 @@ const DeleteOrgDialog = ({
cancelBtnText={t("cancel")}
variety="danger"
onConfirm={onConfirm}>
<Trans
i18nKey="admin_delete_organization_description"
components={{ li: <li />, ul: <ul className="ml-4 mt-5 list-disc space-y-2" /> }}>
<ul>
<li>
Teams that are member of this organization will also be deleted along with their event-types
</li>
<li>
Users that were part of the organization will not be deleted and their event-types will also
remain intact.
</li>
<li>Usernames would be changed to allow them to exist outside the organization</li>
</ul>
</Trans>
<ul className="ml-4 mt-5 list-disc space-y-2">
<li>{t("admin_delete_organization_description_1")}</li>
<li>{t("admin_delete_organization_description_2")}</li>
<li>{t("admin_delete_organization_description_3")}</li>
<li>{t("admin_delete_organization_description_4")}</li>
</ul>
</ConfirmationDialogContent>
</Dialog>
);
@@ -1,3 +1,5 @@
"use client";
import type { EventType, Payment } from "@prisma/client";
import { Elements, PaymentElement, useElements, useStripe } from "@stripe/react-stripe-js";
import type { StripeElementLocale, StripeElements, StripePaymentElementOptions } from "@stripe/stripe-js";
@@ -10,8 +10,9 @@ import { uuid } from "short-uuid";
import { deriveOrgNameFromEmail } from "@calcom/ee/organizations/components/CreateANewOrganizationForm";
import { deriveSlugFromEmail } from "@calcom/ee/organizations/components/CreateANewOrganizationForm";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { useTelemetry } from "@calcom/lib/hooks/useTelemetry";
import slugify from "@calcom/lib/slugify";
import { telemetryEventTypes, useTelemetry } from "@calcom/lib/telemetry";
import { telemetryEventTypes } from "@calcom/lib/telemetry";
import { UserPermissionRole } from "@calcom/prisma/enums";
import { CreationSource } from "@calcom/prisma/enums";
import { trpc } from "@calcom/trpc/react";
@@ -1,3 +1,5 @@
"use client";
import { keepPreviousData } from "@tanstack/react-query";
import { useSession } from "next-auth/react";
import { useRouter } from "next/navigation";
@@ -9,7 +11,8 @@ import { MemberInvitationModalWithoutMembers } from "@calcom/features/ee/teams/c
import { APP_NAME } from "@calcom/lib/constants";
import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { telemetryEventTypes, useTelemetry } from "@calcom/lib/telemetry";
import { useTelemetry } from "@calcom/lib/hooks/useTelemetry";
import { telemetryEventTypes } from "@calcom/lib/telemetry";
import { MembershipRole } from "@calcom/prisma/enums";
import type { RouterOutputs } from "@calcom/trpc/react";
import { trpc } from "@calcom/trpc/react";
@@ -1,5 +1,4 @@
import { useSession } from "next-auth/react";
import { Trans } from "next-i18next";
import type { FormEvent } from "react";
import { useMemo, useRef, useState } from "react";
import { Controller, useForm } from "react-hook-form";
@@ -13,10 +12,10 @@ import { CreationSource } from "@calcom/prisma/enums";
import type { RouterOutputs } from "@calcom/trpc";
import { trpc } from "@calcom/trpc";
import { isEmail } from "@calcom/trpc/server/routers/viewer/teams/util";
import { TextAreaField } from "@calcom/ui/components/form";
import { Button } from "@calcom/ui/components/button";
import classNames from "@calcom/ui/classNames";
import { Button } from "@calcom/ui/components/button";
import { Dialog, DialogContent, DialogFooter } from "@calcom/ui/components/dialog";
import { TextAreaField } from "@calcom/ui/components/form";
import { Form } from "@calcom/ui/components/form";
import { Label } from "@calcom/ui/components/form";
import { TextField } from "@calcom/ui/components/form";
@@ -24,6 +23,7 @@ import { Select } from "@calcom/ui/components/form";
import { ToggleGroup } from "@calcom/ui/components/form";
import { Icon } from "@calcom/ui/components/icon";
import { showToast } from "@calcom/ui/components/toast";
import ServerTrans from "@calcom/web/components/ServerTrans";
import type { PendingMember } from "../lib/types";
import { GoogleWorkspaceInviteButton } from "./GoogleWorkspaceInviteButton";
@@ -205,10 +205,15 @@ export default function MemberInvitationModal(props: MemberInvitationModalProps)
description={
IS_TEAM_BILLING_ENABLED_CLIENT && !currentOrg ? (
<span className="text-subtle text-sm leading-tight">
<Trans i18nKey="invite_new_member_description">
Note: This will <span className="text-emphasis font-medium">cost an extra seat ($15/m)</span>{" "}
on your subscription.
</Trans>
<ServerTrans
t={t}
i18nKey="invite_new_member_description"
components={[
<span key="invite_new_member_description" className="text-emphasis font-medium">
cost an extra seat ($15/m)
</span>,
]}
/>
</span>
) : null
}>
@@ -5,6 +5,20 @@ import { vi } from "vitest";
import type { CreateBtnProps } from "./CreateButton";
import { CreateButtonWithTeamsList } from "./CreateButtonWithTeamsList";
const mockRouter = {
push: vi.fn((path: string) => {
return;
}),
};
vi.mock("next/navigation", async (importOriginal) => {
const actual = await importOriginal<typeof import("next/navigation")>();
return {
...actual,
useRouter: vi.fn(() => mockRouter),
};
});
const runtimeMock = async (data: Array<any>) => {
const updatedTrpc = {
viewer: {
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import type { WorkflowActions } from "@calcom/prisma/enums";
import { WorkflowTemplates, WorkflowTriggerEvents } from "@calcom/prisma/enums";
@@ -89,9 +89,9 @@ export async function getAllRemindersToDelete(): Promise<RemindersToDeleteType[]
},
};
const select: Prisma.WorkflowReminderSelect = {
const select = Prisma.validator<Prisma.WorkflowReminderSelect>()({
referenceId: true,
};
});
const remindersToDelete = await getWorkflowReminders(whereFilter, select);
@@ -109,10 +109,10 @@ export async function getAllRemindersToCancel(): Promise<RemindersToCancelType[]
},
};
const select: Prisma.WorkflowReminderSelect = {
const select = Prisma.validator<Prisma.WorkflowReminderSelect>()({
referenceId: true,
id: true,
};
});
const remindersToCancel = await getWorkflowReminders(whereFilter, select);
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { DYNAMIC_TEXT_VARIABLES, FORMATTED_DYNAMIC_TEXT_VARIABLES } from "./constants";