Merge branch 'main' into hanko-passkeys

This commit is contained in:
Peer Richelsen 2024-01-09 18:32:02 +00:00 committed by GitHub
commit e330b44254
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
46 changed files with 292 additions and 424 deletions

View File

@ -2,6 +2,7 @@ name: "Next.js Bundle Analysis"
on: on:
workflow_call: workflow_call:
workflow_dispatch:
push: push:
branches: branches:
- main - main
@ -34,7 +35,7 @@ jobs:
- name: Download base branch bundle stats - name: Download base branch bundle stats
uses: dawidd6/action-download-artifact@v2 uses: dawidd6/action-download-artifact@v2
if: success() && github.event.number if: success()
with: with:
workflow: nextjs-bundle-analysis.yml workflow: nextjs-bundle-analysis.yml
branch: ${{ github.event.pull_request.base.ref }} branch: ${{ github.event.pull_request.base.ref }}
@ -54,39 +55,39 @@ jobs:
# Either of these arguments can be changed or removed by editing the `nextBundleAnalysis` # Either of these arguments can be changed or removed by editing the `nextBundleAnalysis`
# entry in your package.json file. # entry in your package.json file.
- name: Compare with base branch bundle - name: Compare with base branch bundle
if: success() && github.event.number if: success()
run: | run: |
cd apps/web cd apps/web
ls -laR .next/analyze/base && npx -p nextjs-bundle-analysis compare ls -laR .next/analyze/base && npx -p nextjs-bundle-analysis compare
- name: Get comment body - name: Get comment body
id: get-comment-body id: get-comment-body
if: success() && github.event.number if: success()
run: | run: |
cd apps/web cd apps/web
body=$(cat .next/analyze/__bundle_analysis_comment.txt) body=$(cat .next/analyze/__bundle_analysis_comment.txt)
body="${body//'%'/'%25'}" body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}" body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}" body="${body//$'\r'/'%0D'}"
echo ::set-output name=body::$body echo "{name}={$body}" >> $GITHUB_OUTPUT
- name: Find Comment - name: Find Comment
uses: peter-evans/find-comment@v1 uses: peter-evans/find-comment@v2
if: success() && github.event.number if: success()
id: fc id: fc
with: with:
issue-number: ${{ github.event.number }} issue-number: ${{ github.event.number }}
body-includes: "<!-- __NEXTJS_BUNDLE_@calcom/web -->" body-includes: "<!-- __NEXTJS_BUNDLE_@calcom/web -->"
- name: Create Comment - name: Create Comment
uses: peter-evans/create-or-update-comment@v1.4.4 uses: peter-evans/create-or-update-comment@v3
if: success() && github.event.number && steps.fc.outputs.comment-id == 0 if: success() && github.event.number && steps.fc.outputs.comment-id == 0
with: with:
issue-number: ${{ github.event.number }} issue-number: ${{ github.event.number }}
body: ${{ steps.get-comment-body.outputs.body }} body: ${{ steps.get-comment-body.outputs.body }}
- name: Update Comment - name: Update Comment
uses: peter-evans/create-or-update-comment@v1.4.4 uses: peter-evans/create-or-update-comment@v3
if: success() && github.event.number && steps.fc.outputs.comment-id != 0 if: success() && github.event.number && steps.fc.outputs.comment-id != 0
with: with:
issue-number: ${{ github.event.number }} issue-number: ${{ github.event.number }}

View File

@ -64,6 +64,25 @@ export async function patchHandler(req: NextApiRequest) {
where: { id: teamId, members: { some: { userId, role: { in: ["OWNER", "ADMIN"] } } } }, where: { id: teamId, members: { some: { userId, role: { in: ["OWNER", "ADMIN"] } } } },
}); });
if (!_team) throw new HttpError({ statusCode: 401, message: "Unauthorized: OWNER or ADMIN required" }); if (!_team) throw new HttpError({ statusCode: 401, message: "Unauthorized: OWNER or ADMIN required" });
// Check if parentId is related to this user
if (data.parentId && data.parentId === teamId) {
throw new HttpError({
statusCode: 400,
message: "Bad request: Parent id cannot be the same as the team id.",
});
}
if (data.parentId) {
const parentTeam = await prisma.team.findFirst({
where: { id: data.parentId, members: { some: { userId, role: { in: ["OWNER", "ADMIN"] } } } },
});
if (!parentTeam)
throw new HttpError({
statusCode: 401,
message: "Unauthorized: Invalid parent id. You can only use parent id of your own teams.",
});
}
let paymentUrl; let paymentUrl;
if (_team.slug === null && data.slug) { if (_team.slug === null && data.slug) {
data.metadata = { data.metadata = {

View File

@ -68,6 +68,18 @@ async function postHandler(req: NextApiRequest) {
} }
} }
// Check if parentId is related to this user
if (data.parentId) {
const parentTeam = await prisma.team.findFirst({
where: { id: data.parentId, members: { some: { userId, role: { in: ["OWNER", "ADMIN"] } } } },
});
if (!parentTeam)
throw new HttpError({
statusCode: 401,
message: "Unauthorized: Invalid parent id. You can only use parent id of your own teams.",
});
}
// TODO: Perhaps there is a better fix for this? // TODO: Perhaps there is a better fix for this?
const cloneData: typeof data & { const cloneData: typeof data & {
metadata: NonNullable<typeof data.metadata> | undefined; metadata: NonNullable<typeof data.metadata> | undefined;

View File

@ -1,212 +0,0 @@
// originally from in the "experimental playground for tRPC + next.js 13" repo owned by trpc team
// file link: https://github.com/trpc/next-13/blob/main/%40trpc/next-layout/createTRPCNextLayout.ts
// repo link: https://github.com/trpc/next-13
// code is / will continue to be adapted for our usage
import { dehydrate, QueryClient } from "@tanstack/query-core";
import type { DehydratedState, QueryKey } from "@tanstack/react-query";
import type { Maybe, TRPCClientError, TRPCClientErrorLike } from "@calcom/trpc";
import {
callProcedure,
type AnyProcedure,
type AnyQueryProcedure,
type AnyRouter,
type DataTransformer,
type inferProcedureInput,
type inferProcedureOutput,
type inferRouterContext,
type MaybePromise,
type ProcedureRouterRecord,
} from "@calcom/trpc/server";
import { createRecursiveProxy, createFlatProxy } from "@trpc/server/shared";
export function getArrayQueryKey(
queryKey: string | [string] | [string, ...unknown[]] | unknown[],
type: string
): QueryKey {
const queryKeyArrayed = Array.isArray(queryKey) ? queryKey : [queryKey];
const [arrayPath, input] = queryKeyArrayed;
if (!input && (!type || type === "any")) {
return Array.isArray(arrayPath) && arrayPath.length !== 0 ? [arrayPath] : ([] as unknown as QueryKey);
}
return [
arrayPath,
{
...(typeof input !== "undefined" && { input: input }),
...(type && type !== "any" && { type: type }),
},
];
}
// copy starts
// copied from trpc/trpc repo
// ref: https://github.com/trpc/trpc/blob/main/packages/next/src/withTRPC.tsx#L37-#L58
function transformQueryOrMutationCacheErrors<
TState extends DehydratedState["queries"][0] | DehydratedState["mutations"][0]
>(result: TState): TState {
const error = result.state.error as Maybe<TRPCClientError<any>>;
if (error instanceof Error && error.name === "TRPCClientError") {
const newError: TRPCClientErrorLike<any> = {
message: error.message,
data: error.data,
shape: error.shape,
};
return {
...result,
state: {
...result.state,
error: newError,
},
};
}
return result;
}
// copy ends
interface CreateTRPCNextLayoutOptions<TRouter extends AnyRouter> {
router: TRouter;
createContext: () => MaybePromise<inferRouterContext<TRouter>>;
transformer?: DataTransformer;
}
/**
* @internal
*/
export type DecorateProcedure<TProcedure extends AnyProcedure> = TProcedure extends AnyQueryProcedure
? {
fetch(input: inferProcedureInput<TProcedure>): Promise<inferProcedureOutput<TProcedure>>;
fetchInfinite(input: inferProcedureInput<TProcedure>): Promise<inferProcedureOutput<TProcedure>>;
prefetch(input: inferProcedureInput<TProcedure>): Promise<inferProcedureOutput<TProcedure>>;
prefetchInfinite(input: inferProcedureInput<TProcedure>): Promise<inferProcedureOutput<TProcedure>>;
}
: never;
type OmitNever<TType> = Pick<
TType,
{
[K in keyof TType]: TType[K] extends never ? never : K;
}[keyof TType]
>;
/**
* @internal
*/
export type DecoratedProcedureRecord<
TProcedures extends ProcedureRouterRecord,
TPath extends string = ""
> = OmitNever<{
[TKey in keyof TProcedures]: TProcedures[TKey] extends AnyRouter
? DecoratedProcedureRecord<TProcedures[TKey]["_def"]["record"], `${TPath}${TKey & string}.`>
: TProcedures[TKey] extends AnyQueryProcedure
? DecorateProcedure<TProcedures[TKey]>
: never;
}>;
type CreateTRPCNextLayout<TRouter extends AnyRouter> = DecoratedProcedureRecord<TRouter["_def"]["record"]> & {
dehydrate(): Promise<DehydratedState>;
queryClient: QueryClient;
};
const getStateContainer = <TRouter extends AnyRouter>(opts: CreateTRPCNextLayoutOptions<TRouter>) => {
let _trpc: {
queryClient: QueryClient;
context: inferRouterContext<TRouter>;
} | null = null;
return () => {
if (_trpc === null) {
_trpc = {
context: opts.createContext(),
queryClient: new QueryClient(),
};
}
return _trpc;
};
};
export function createTRPCNextLayout<TRouter extends AnyRouter>(
opts: CreateTRPCNextLayoutOptions<TRouter>
): CreateTRPCNextLayout<TRouter> {
const getState = getStateContainer(opts);
const transformer = opts.transformer ?? {
serialize: (v) => v,
deserialize: (v) => v,
};
return createFlatProxy((key) => {
const state = getState();
const { queryClient } = state;
if (key === "queryClient") {
return queryClient;
}
if (key === "dehydrate") {
// copy starts
// copied from trpc/trpc repo
// ref: https://github.com/trpc/trpc/blob/main/packages/next/src/withTRPC.tsx#L214-#L229
const dehydratedCache = dehydrate(queryClient, {
shouldDehydrateQuery() {
// makes sure errors are also dehydrated
return true;
},
});
// since error instances can't be serialized, let's make them into `TRPCClientErrorLike`-objects
const dehydratedCacheWithErrors = {
...dehydratedCache,
queries: dehydratedCache.queries.map(transformQueryOrMutationCacheErrors),
mutations: dehydratedCache.mutations.map(transformQueryOrMutationCacheErrors),
};
return () => transformer.serialize(dehydratedCacheWithErrors);
}
// copy ends
return createRecursiveProxy(async (callOpts) => {
const path = [key, ...callOpts.path];
const utilName = path.pop();
const ctx = await state.context;
const caller = opts.router.createCaller(ctx);
const pathStr = path.join(".");
const input = callOpts.args[0];
if (utilName === "fetchInfinite") {
return queryClient.fetchInfiniteQuery(getArrayQueryKey([path, input], "infinite"), () =>
caller.query(pathStr, input)
);
}
if (utilName === "prefetch") {
return queryClient.prefetchQuery({
queryKey: getArrayQueryKey([path, input], "query"),
queryFn: async () => {
const res = await callProcedure({
procedures: opts.router._def.procedures,
path: pathStr,
rawInput: input,
ctx,
type: "query",
});
return res;
},
});
}
if (utilName === "prefetchInfinite") {
return queryClient.prefetchInfiniteQuery(getArrayQueryKey([path, input], "infinite"), () =>
caller.query(pathStr, input)
);
}
return queryClient.fetchQuery(getArrayQueryKey([path, input], "query"), () =>
caller.query(pathStr, input)
);
}) as CreateTRPCNextLayout<TRouter>;
});
}

View File

@ -1,34 +0,0 @@
import { serverSideTranslations } from "next-i18next/serverSideTranslations";
import { headers } from "next/headers";
import superjson from "superjson";
import { CALCOM_VERSION } from "@calcom/lib/constants";
import prisma, { readonlyPrisma } from "@calcom/prisma";
import { appRouter } from "@calcom/trpc/server/routers/_app";
import { createTRPCNextLayout } from "./createTRPCNextLayout";
export async function ssgInit() {
const locale = headers().get("x-locale") ?? "en";
const i18n = (await serverSideTranslations(locale, ["common"])) || "en";
const ssg = createTRPCNextLayout({
router: appRouter,
transformer: superjson,
createContext() {
return { prisma, insightsDb: readonlyPrisma, session: null, locale, i18n };
},
});
// i18n translations are already retrieved from serverSideTranslations call, there is no need to run a i18n.fetch
// we can set query data directly to the queryClient
const queryKey = [
["viewer", "public", "i18n"],
{ input: { locale, CalComVersion: CALCOM_VERSION }, type: "query" },
];
ssg.queryClient.setQueryData(queryKey, { i18n });
return ssg;
}

View File

@ -1,57 +0,0 @@
import { type GetServerSidePropsContext } from "next";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";
import { headers, cookies } from "next/headers";
import superjson from "superjson";
import { getLocale } from "@calcom/features/auth/lib/getLocale";
import { CALCOM_VERSION } from "@calcom/lib/constants";
import prisma, { readonlyPrisma } from "@calcom/prisma";
import { appRouter } from "@calcom/trpc/server/routers/_app";
import { createTRPCNextLayout } from "./createTRPCNextLayout";
export async function ssrInit(options?: { noI18nPreload: boolean }) {
const req = {
headers: headers(),
cookies: cookies(),
};
const locale = await getLocale(req);
const i18n = (await serverSideTranslations(locale, ["common", "vital"])) || "en";
const ssr = createTRPCNextLayout({
router: appRouter,
transformer: superjson,
createContext() {
return {
prisma,
insightsDb: readonlyPrisma,
session: null,
locale,
i18n,
req: req as unknown as GetServerSidePropsContext["req"],
};
},
});
// i18n translations are already retrieved from serverSideTranslations call, there is no need to run a i18n.fetch
// we can set query data directly to the queryClient
const queryKey = [
["viewer", "public", "i18n"],
{ input: { locale, CalComVersion: CALCOM_VERSION }, type: "query" },
];
if (!options?.noI18nPreload) {
ssr.queryClient.setQueryData(queryKey, { i18n });
}
await Promise.allSettled([
// So feature flags are available on first render
ssr.viewer.features.map.prefetch(),
// Provides a better UX to the users who have already upgraded.
ssr.viewer.teams.hasTeamPlan.prefetch(),
ssr.viewer.public.session.prefetch(),
]);
return ssr;
}

View File

@ -67,5 +67,5 @@ const getPageProps = async ({ params }: { params: Record<string, string | string
}; };
// @ts-expect-error getData arg // @ts-expect-error getData arg
export default WithLayout({ getData: getPageProps, Page: CategoryPage })<P>; export default WithLayout({ getData: getPageProps, Page: CategoryPage })<"P">;
export const dynamic = "force-static"; export const dynamic = "force-static";

View File

@ -1,13 +1,15 @@
import LegacyPage from "@pages/apps/categories/index"; import LegacyPage from "@pages/apps/categories/index";
import { ssrInit } from "app/_trpc/ssrInit";
import { _generateMetadata } from "app/_utils"; import { _generateMetadata } from "app/_utils";
import { WithLayout } from "app/layoutHOC"; import { WithLayout } from "app/layoutHOC";
import { cookies, headers } from "next/headers";
import { getAppRegistry, getAppRegistryWithCredentials } from "@calcom/app-store/_appRegistry"; import { getAppRegistry, getAppRegistryWithCredentials } from "@calcom/app-store/_appRegistry";
import { getServerSession } from "@calcom/features/auth/lib/getServerSession"; import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
import { APP_NAME } from "@calcom/lib/constants"; import { APP_NAME } from "@calcom/lib/constants";
import type { buildLegacyCtx } from "@lib/buildLegacyCtx";
import { ssrInit } from "@server/lib/ssr";
export const generateMetadata = async () => { export const generateMetadata = async () => {
return await _generateMetadata( return await _generateMetadata(
() => `Categories | ${APP_NAME}`, () => `Categories | ${APP_NAME}`,
@ -15,12 +17,12 @@ export const generateMetadata = async () => {
); );
}; };
async function getPageProps() { const getData = async (ctx: ReturnType<typeof buildLegacyCtx>) => {
const ssr = await ssrInit(); // @ts-expect-error Argument of type '{ query: Params; params: Params; req: { headers: ReadonlyHeaders; cookies: ReadonlyRequestCookies; }; }' is not assignable to parameter of type 'GetServerSidePropsContext'.
const req = { headers: headers(), cookies: cookies() }; const ssr = await ssrInit(ctx);
// @ts-expect-error Type '{ headers: ReadonlyHeaders; cookies: ReadonlyRequestCookies; }' is not assignable to type 'NextApiRequest | IncomingMessage // @ts-expect-error Type '{ headers: ReadonlyHeaders; cookies: ReadonlyRequestCookies; }' is not assignable to type 'NextApiRequest | IncomingMessage
const session = await getServerSession({ req }); const session = await getServerSession({ req: ctx.req });
let appStore; let appStore;
if (session?.user?.id) { if (session?.user?.id) {
@ -38,8 +40,8 @@ async function getPageProps() {
return { return {
categories: Object.entries(categories).map(([name, count]) => ({ name, count })), categories: Object.entries(categories).map(([name, count]) => ({ name, count })),
dehydratedState: await ssr.dehydrate(), dehydratedState: ssr.dehydrate(),
}; };
} };
export default WithLayout({ getData: getPageProps, Page: LegacyPage, getLayout: null })<"P">; export default WithLayout({ getData, Page: LegacyPage, getLayout: null })<"P">;

View File

@ -1,7 +1,6 @@
import AppsPage from "@pages/apps"; import AppsPage from "@pages/apps";
import { ssrInit } from "app/_trpc/ssrInit";
import { _generateMetadata } from "app/_utils"; import { _generateMetadata } from "app/_utils";
import { cookies, headers } from "next/headers"; import { WithLayout } from "app/layoutHOC";
import { getAppRegistry, getAppRegistryWithCredentials } from "@calcom/app-store/_appRegistry"; import { getAppRegistry, getAppRegistryWithCredentials } from "@calcom/app-store/_appRegistry";
import { getLayout } from "@calcom/features/MainLayoutAppDir"; import { getLayout } from "@calcom/features/MainLayoutAppDir";
@ -11,7 +10,9 @@ import getUserAdminTeams from "@calcom/features/ee/teams/lib/getUserAdminTeams";
import { APP_NAME } from "@calcom/lib/constants"; import { APP_NAME } from "@calcom/lib/constants";
import type { AppCategories } from "@calcom/prisma/enums"; import type { AppCategories } from "@calcom/prisma/enums";
import PageWrapper from "@components/PageWrapperAppDir"; import type { buildLegacyCtx } from "@lib/buildLegacyCtx";
import { ssrInit } from "@server/lib/ssr";
export const generateMetadata = async () => { export const generateMetadata = async () => {
return await _generateMetadata( return await _generateMetadata(
@ -20,12 +21,12 @@ export const generateMetadata = async () => {
); );
}; };
const getPageProps = async () => { const getData = async (ctx: ReturnType<typeof buildLegacyCtx>) => {
const ssr = await ssrInit(); // @ts-expect-error Argument of type '{ query: Params; params: Params; req: { headers: ReadonlyHeaders; cookies: ReadonlyRequestCookies; }; }' is not assignable to parameter of type 'GetServerSidePropsContext'.
const req = { headers: headers(), cookies: cookies() }; const ssr = await ssrInit(ctx);
// @ts-expect-error Type '{ headers: ReadonlyHeaders; cookies: ReadonlyRequestCookies; }' is not assignable to type 'NextApiRequest // @ts-expect-error Type '{ headers: ReadonlyHeaders; cookies: ReadonlyRequestCookies; }' is not assignable to type 'NextApiRequest
const session = await getServerSession({ req }); const session = await getServerSession({ req: ctx.req });
let appStore, userAdminTeams: UserAdminTeams; let appStore, userAdminTeams: UserAdminTeams;
if (session?.user?.id) { if (session?.user?.id) {
@ -58,24 +59,8 @@ const getPageProps = async () => {
}), }),
appStore, appStore,
userAdminTeams, userAdminTeams,
dehydratedState: await ssr.dehydrate(), dehydratedState: ssr.dehydrate(),
}; };
}; };
export default async function AppPageAppDir() { export default WithLayout({ getLayout, getData, Page: AppsPage });
const { categories, appStore, userAdminTeams, dehydratedState } = await getPageProps();
const h = headers();
const nonce = h.get("x-nonce") ?? undefined;
return (
<PageWrapper
getLayout={getLayout}
requiresLicense={false}
nonce={nonce}
themeBasis={null}
dehydratedState={dehydratedState}>
<AppsPage categories={categories} appStore={appStore} userAdminTeams={userAdminTeams} />
</PageWrapper>
);
}

View File

@ -1,22 +1,21 @@
import { ssgInit } from "app/_trpc/ssgInit";
import type { Params } from "app/_types";
import { _generateMetadata } from "app/_utils"; import { _generateMetadata } from "app/_utils";
import { WithLayout } from "app/layoutHOC"; import { WithLayout } from "app/layoutHOC";
import { notFound } from "next/navigation"; import { notFound } from "next/navigation";
import type { ReactElement } from "react";
import { z } from "zod"; import { z } from "zod";
import { getLayout } from "@calcom/features/MainLayoutAppDir"; import { getLayout } from "@calcom/features/MainLayoutAppDir";
import { APP_NAME } from "@calcom/lib/constants"; import { APP_NAME } from "@calcom/lib/constants";
import type { buildLegacyCtx } from "@lib/buildLegacyCtx";
import { ssgInit } from "@server/lib/ssg";
const validStatuses = ["upcoming", "recurring", "past", "cancelled", "unconfirmed"] as const; const validStatuses = ["upcoming", "recurring", "past", "cancelled", "unconfirmed"] as const;
const querySchema = z.object({ const querySchema = z.object({
status: z.enum(validStatuses), status: z.enum(validStatuses),
}); });
type Props = { params: Params; children: ReactElement };
export const generateMetadata = async () => export const generateMetadata = async () =>
await _generateMetadata( await _generateMetadata(
(t) => `${APP_NAME} | ${t("bookings")}`, (t) => `${APP_NAME} | ${t("bookings")}`,
@ -27,18 +26,18 @@ export const generateStaticParams = async () => {
return validStatuses.map((status) => ({ status })); return validStatuses.map((status) => ({ status }));
}; };
const getData = async ({ params }: { params: Params }) => { const getData = async (ctx: ReturnType<typeof buildLegacyCtx>) => {
const parsedParams = querySchema.safeParse(params); const parsedParams = querySchema.safeParse(ctx.params);
if (!parsedParams.success) { if (!parsedParams.success) {
notFound(); notFound();
} }
const ssg = await ssgInit(); const ssg = await ssgInit(ctx);
return { return {
status: parsedParams.data.status, status: parsedParams.data.status,
dehydratedState: await ssg.dehydrate(), dehydratedState: ssg.dehydrate(),
}; };
}; };

View File

@ -1,14 +1,16 @@
import LegacyPage from "@pages/getting-started/[[...step]]"; import LegacyPage from "@pages/getting-started/[[...step]]";
import { ssrInit } from "app/_trpc/ssrInit"; import { WithLayout } from "app/layoutHOC";
import { cookies, headers } from "next/headers"; import { cookies, headers } from "next/headers";
import { redirect } from "next/navigation"; import { redirect } from "next/navigation";
import { getServerSession } from "@calcom/features/auth/lib/getServerSession"; import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
import prisma from "@calcom/prisma"; import prisma from "@calcom/prisma";
import PageWrapper from "@components/PageWrapperAppDir"; import type { buildLegacyCtx } from "@lib/buildLegacyCtx";
async function getData() { import { ssrInit } from "@server/lib/ssr";
const getData = async (ctx: ReturnType<typeof buildLegacyCtx>) => {
const req = { headers: headers(), cookies: cookies() }; const req = { headers: headers(), cookies: cookies() };
//@ts-expect-error Type '{ headers: ReadonlyHeaders; cookies: ReadonlyRequestCookies; }' is not assignable to type 'NextApiRequest //@ts-expect-error Type '{ headers: ReadonlyHeaders; cookies: ReadonlyRequestCookies; }' is not assignable to type 'NextApiRequest
@ -17,8 +19,8 @@ async function getData() {
if (!session?.user?.id) { if (!session?.user?.id) {
return redirect("/auth/login"); return redirect("/auth/login");
} }
// @ts-expect-error Argument of type '{ query: Params; params: Params; req: { headers: ReadonlyHeaders; cookies: ReadonlyRequestCookies; }; }' is not assignable to parameter of type 'GetServerSidePropsContext'.
const ssr = await ssrInit(); const ssr = await ssrInit(ctx);
await ssr.viewer.me.prefetch(); await ssr.viewer.me.prefetch();
const user = await prisma.user.findUnique({ const user = await prisma.user.findUnique({
@ -51,20 +53,11 @@ async function getData() {
} }
return { return {
dehydratedState: await ssr.dehydrate(), dehydratedState: ssr.dehydrate(),
hasPendingInvites: user.teams.find((team: any) => team.accepted === false) ?? false, hasPendingInvites: user.teams.find((team: any) => team.accepted === false) ?? false,
requiresLicense: false,
themeBasis: null,
}; };
} };
export default async function Page() { export default WithLayout({ getLayout: null, getData, Page: LegacyPage });
const props = await getData();
const h = headers();
const nonce = h.get("x-nonce") ?? undefined;
return (
<PageWrapper getLayout={null} requiresLicense={false} nonce={nonce} themeBasis={null} {...props}>
<LegacyPage />
</PageWrapper>
);
}

View File

@ -0,0 +1,5 @@
import { WithLayout } from "app/layoutHOC";
import { getLayout } from "@calcom/features/settings/layouts/SettingsLayoutAppDir";
export default WithLayout({ getLayout })<"L">;

View File

@ -0,0 +1,11 @@
import { _generateMetadata } from "app/_utils";
import Page from "@calcom/features/ee/teams/pages/team-appearance-view";
export const generateMetadata = async () =>
await _generateMetadata(
(t) => t("booking_appearance"),
(t) => t("appearance_team_description")
);
export default Page;

View File

@ -0,0 +1,5 @@
import { WithLayout } from "app/layoutHOC";
import { getLayout } from "@calcom/features/settings/layouts/SettingsLayoutAppDir";
export default WithLayout({ getLayout })<"L">;

View File

@ -0,0 +1,10 @@
import Page from "@pages/settings/billing/index";
import { _generateMetadata } from "app/_utils";
export const generateMetadata = async () =>
await _generateMetadata(
(t) => t("billing"),
(t) => t("team_billing_description")
);
export default Page;

View File

@ -0,0 +1,5 @@
import { WithLayout } from "app/layoutHOC";
import { getLayout } from "@calcom/features/settings/layouts/SettingsLayoutAppDir";
export default WithLayout({ getLayout })<"L">;

View File

@ -0,0 +1,11 @@
import { _generateMetadata } from "app/_utils";
import Page from "@calcom/features/ee/teams/pages/team-members-view";
export const generateMetadata = async () =>
await _generateMetadata(
(t) => t("team_members"),
(t) => t("members_team_description")
);
export default Page;

View File

@ -0,0 +1,11 @@
import LegacyPage, { GetLayout } from "@pages/settings/teams/[id]/onboard-members";
import { _generateMetadata } from "app/_utils";
import { WithLayout } from "app/layoutHOC";
export const generateMetadata = async () =>
await _generateMetadata(
(t) => t("add_team_members"),
(t) => t("add_team_members_description")
);
export default WithLayout({ Page: LegacyPage, getLayout: GetLayout })<"P">;

View File

@ -0,0 +1,5 @@
import { WithLayout } from "app/layoutHOC";
import { getLayout } from "@calcom/features/settings/layouts/SettingsLayoutAppDir";
export default WithLayout({ getLayout })<"L">;

View File

@ -0,0 +1,11 @@
import { _generateMetadata } from "app/_utils";
import Page from "@calcom/features/ee/teams/pages/team-profile-view";
export const generateMetadata = async () =>
await _generateMetadata(
(t) => t("profile"),
(t) => t("profile_team_description")
);
export default Page;

View File

@ -0,0 +1,5 @@
import { WithLayout } from "app/layoutHOC";
import { getLayout } from "@calcom/features/settings/layouts/SettingsLayoutAppDir";
export default WithLayout({ getLayout })<"L">;

View File

@ -0,0 +1,11 @@
import { _generateMetadata } from "app/_utils";
import Page from "@calcom/features/ee/sso/page/teams-sso-view";
export const generateMetadata = async () =>
await _generateMetadata(
(t) => t("sso_configuration"),
(t) => t("sso_configuration_description")
);
export default Page;

View File

@ -0,0 +1,5 @@
import { WithLayout } from "app/layoutHOC";
import { getLayout } from "@calcom/features/settings/layouts/SettingsLayoutAppDir";
export default WithLayout({ getLayout })<"L">;

View File

@ -0,0 +1,11 @@
import LegacyPage, { LayoutWrapper } from "@pages/settings/teams/new/index";
import { _generateMetadata } from "app/_utils";
import { WithLayout } from "app/layoutHOC";
export const generateMetadata = async () =>
await _generateMetadata(
(t) => t("create_new_team"),
(t) => t("create_new_team_description")
);
export default WithLayout({ Page: LegacyPage, getLayout: LayoutWrapper })<"P">;

View File

@ -0,0 +1,11 @@
import { _generateMetadata } from "app/_utils";
import Page from "@calcom/features/ee/teams/pages/team-listing-view";
export const generateMetadata = async () =>
await _generateMetadata(
(t) => t("teams"),
(t) => t("create_manage_teams_collaborative")
);
export default Page;

View File

@ -1,24 +1,29 @@
import OldPage from "@pages/teams/index"; import OldPage from "@pages/teams/index";
import { ssrInit } from "app/_trpc/ssrInit";
import { _generateMetadata } from "app/_utils"; import { _generateMetadata } from "app/_utils";
import { WithLayout } from "app/layoutHOC"; import { WithLayout } from "app/layoutHOC";
import { type GetServerSidePropsContext } from "next";
import { redirect } from "next/navigation"; import { redirect } from "next/navigation";
import { getLayout } from "@calcom/features/MainLayoutAppDir"; import { getLayout } from "@calcom/features/MainLayoutAppDir";
import { getServerSession } from "@calcom/features/auth/lib/getServerSession"; import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
import type { buildLegacyCtx } from "@lib/buildLegacyCtx";
import { ssrInit } from "@server/lib/ssr";
export const generateMetadata = async () => export const generateMetadata = async () =>
await _generateMetadata( await _generateMetadata(
(t) => t("teams"), (t) => t("teams"),
(t) => t("create_manage_teams_collaborative") (t) => t("create_manage_teams_collaborative")
); );
async function getData(context: Omit<GetServerSidePropsContext, "res" | "resolvedUrl">) { async function getData(context: ReturnType<typeof buildLegacyCtx>) {
const ssr = await ssrInit(); // @ts-expect-error Argument of type '{ query: Params; params: Params; req: { headers: ReadonlyHeaders; cookies: ReadonlyRequestCookies; }; }' is not assignable to parameter of type 'GetServerSidePropsContext'.
const ssr = await ssrInit(context);
await ssr.viewer.me.prefetch(); await ssr.viewer.me.prefetch();
const session = await getServerSession({ const session = await getServerSession({
// @ts-expect-error Type '{ headers: ReadonlyHeaders; cookies: ReadonlyRequestCookies; }' is not assignable to type 'NextApiRequest | (IncomingMessage & { cookies: Partial<{ [key: string]: string; }>; })'.
req: context.req, req: context.req,
}); });
@ -29,8 +34,7 @@ async function getData(context: Omit<GetServerSidePropsContext, "res" | "resolve
return redirect(callbackUrl ? `/auth/login?callbackUrl=${callbackUrl}` : "/auth/login"); return redirect(callbackUrl ? `/auth/login?callbackUrl=${callbackUrl}` : "/auth/login");
} }
return { dehydratedState: await ssr.dehydrate() }; return { dehydratedState: ssr.dehydrate() };
} }
// @ts-expect-error getData arg
export default WithLayout({ getData, getLayout, Page: OldPage })<"P">; export default WithLayout({ getData, getLayout, Page: OldPage })<"P">;

View File

@ -1,15 +1,17 @@
import OldPage from "@pages/video/[uid]"; import OldPage from "@pages/video/[uid]";
import { ssrInit } from "app/_trpc/ssrInit";
import { _generateMetadata } from "app/_utils"; import { _generateMetadata } from "app/_utils";
import { WithLayout } from "app/layoutHOC"; import { WithLayout } from "app/layoutHOC";
import MarkdownIt from "markdown-it"; import MarkdownIt from "markdown-it";
import { type GetServerSidePropsContext } from "next";
import { redirect } from "next/navigation"; import { redirect } from "next/navigation";
import { getServerSession } from "@calcom/features/auth/lib/getServerSession"; import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
import { APP_NAME } from "@calcom/lib/constants"; import { APP_NAME } from "@calcom/lib/constants";
import prisma, { bookingMinimalSelect } from "@calcom/prisma"; import prisma, { bookingMinimalSelect } from "@calcom/prisma";
import type { buildLegacyCtx } from "@lib/buildLegacyCtx";
import { ssrInit } from "@server/lib/ssr";
export const generateMetadata = async () => export const generateMetadata = async () =>
await _generateMetadata( await _generateMetadata(
() => `${APP_NAME} Video`, () => `${APP_NAME} Video`,
@ -18,8 +20,9 @@ export const generateMetadata = async () =>
const md = new MarkdownIt("default", { html: true, breaks: true, linkify: true }); const md = new MarkdownIt("default", { html: true, breaks: true, linkify: true });
async function getData(context: Omit<GetServerSidePropsContext, "res" | "resolvedUrl">) { async function getData(context: ReturnType<typeof buildLegacyCtx>) {
const ssr = await ssrInit(); // @ts-expect-error Argument of type '{ query: Params; params: Params; req: { headers: ReadonlyHeaders; cookies: ReadonlyRequestCookies; }; }' is not assignable to parameter of type 'GetServerSidePropsContext'.
const ssr = await ssrInit(context);
const booking = await prisma.booking.findUnique({ const booking = await prisma.booking.findUnique({
where: { where: {
@ -76,6 +79,7 @@ async function getData(context: Omit<GetServerSidePropsContext, "res" | "resolve
endTime: booking.endTime.toString(), endTime: booking.endTime.toString(),
}); });
// @ts-expect-error Type '{ headers: ReadonlyHeaders; cookies: ReadonlyRequestCookies; }' is not assignable to type 'NextApiRequest | (IncomingMessage & { cookies: Partial<{ [key: string]: string; }>; })'.
const session = await getServerSession({ req: context.req }); const session = await getServerSession({ req: context.req });
// set meetingPassword to null for guests // set meetingPassword to null for guests
@ -94,9 +98,8 @@ async function getData(context: Omit<GetServerSidePropsContext, "res" | "resolve
...bookingObj, ...bookingObj,
...(bookingObj.description && { description: md.render(bookingObj.description) }), ...(bookingObj.description && { description: md.render(bookingObj.description) }),
}, },
dehydratedState: await ssr.dehydrate(), dehydratedState: ssr.dehydrate(),
}; };
} }
// @ts-expect-error getData arg
export default WithLayout({ getData, Page: OldPage, getLayout: null })<"P">; export default WithLayout({ getData, Page: OldPage, getLayout: null })<"P">;

View File

@ -1,19 +1,23 @@
import LegacyPage from "@pages/video/no-meeting-found"; import LegacyPage from "@pages/video/no-meeting-found";
import { ssrInit } from "app/_trpc/ssrInit";
import { _generateMetadata } from "app/_utils"; import { _generateMetadata } from "app/_utils";
import { WithLayout } from "app/layoutHOC"; import { WithLayout } from "app/layoutHOC";
import type { buildLegacyCtx } from "@lib/buildLegacyCtx";
import { ssrInit } from "@server/lib/ssr";
export const generateMetadata = async () => export const generateMetadata = async () =>
await _generateMetadata( await _generateMetadata(
(t) => t("no_meeting_found"), (t) => t("no_meeting_found"),
(t) => t("no_meeting_found") (t) => t("no_meeting_found")
); );
const getData = async () => { const getData = async (context: ReturnType<typeof buildLegacyCtx>) => {
const ssr = await ssrInit(); // @ts-expect-error Argument of type '{ query: Params; params: Params; req: { headers: ReadonlyHeaders; cookies: ReadonlyRequestCookies; }; }' is not assignable to parameter of type 'GetServerSidePropsContext'.
const ssr = await ssrInit(context);
return { return {
dehydratedState: await ssr.dehydrate(), dehydratedState: ssr.dehydrate(),
}; };
}; };

View File

@ -3,12 +3,14 @@ import prismock from "../../../tests/libs/__mocks__/prisma";
import { describe, expect, it } from "vitest"; import { describe, expect, it } from "vitest";
import type { z } from "zod"; import type { z } from "zod";
import { WEBSITE_URL } from "@calcom/lib/constants";
import type { MembershipRole, Prisma } from "@calcom/prisma/client"; import type { MembershipRole, Prisma } from "@calcom/prisma/client";
import { RedirectType } from "@calcom/prisma/enums"; import { RedirectType } from "@calcom/prisma/enums";
import type { teamMetadataSchema } from "@calcom/prisma/zod-utils"; import type { teamMetadataSchema } from "@calcom/prisma/zod-utils";
import { moveTeamToOrg, moveUserToOrg, removeTeamFromOrg, removeUserFromOrg } from "./orgMigration"; import { moveTeamToOrg, moveUserToOrg, removeTeamFromOrg, removeUserFromOrg } from "./orgMigration";
const WEBSITE_PROTOCOL = new URL(WEBSITE_URL).protocol;
describe("orgMigration", () => { describe("orgMigration", () => {
describe("moveUserToOrg", () => { describe("moveUserToOrg", () => {
describe("when user email does not match orgAutoAcceptEmail", () => { describe("when user email does not match orgAutoAcceptEmail", () => {
@ -1366,7 +1368,7 @@ async function expectRedirectToBeEnabled({
} }
expect(redirect).not.toBeNull(); expect(redirect).not.toBeNull();
expect(redirect?.toUrl).toBe(`http://${orgSlug}.cal.local:3000/${to}`); expect(redirect?.toUrl).toBe(`${WEBSITE_PROTOCOL}//${orgSlug}.cal.local:3000/${to}`);
if (!redirect) { if (!redirect) {
throw new Error(`Redirect doesn't exist for ${JSON.stringify(tempOrgRedirectWhere)}`); throw new Error(`Redirect doesn't exist for ${JSON.stringify(tempOrgRedirectWhere)}`);
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "@calcom/web", "name": "@calcom/web",
"version": "3.6.1", "version": "3.6.2",
"private": true, "private": true,
"scripts": { "scripts": {
"analyze": "ANALYZE=true next build", "analyze": "ANALYZE=true next build",

View File

@ -1,3 +1,5 @@
"use client";
import { usePathname } from "next/navigation"; import { usePathname } from "next/navigation";
import { useIntercom } from "@calcom/features/ee/support/lib/intercom/useIntercom"; import { useIntercom } from "@calcom/features/ee/support/lib/intercom/useIntercom";

View File

@ -1,3 +1,5 @@
"use client";
import Head from "next/head"; import Head from "next/head";
import AddNewTeamMembers from "@calcom/features/ee/teams/components/AddNewTeamMembers"; import AddNewTeamMembers from "@calcom/features/ee/teams/components/AddNewTeamMembers";
@ -19,12 +21,13 @@ const OnboardTeamMembersPage = () => {
); );
}; };
OnboardTeamMembersPage.getLayout = (page: React.ReactElement) => ( export const GetLayout = (page: React.ReactElement) => (
<WizardLayout currentStep={2} maxSteps={2}> <WizardLayout currentStep={2} maxSteps={2}>
{page} {page}
</WizardLayout> </WizardLayout>
); );
OnboardTeamMembersPage.getLayout = GetLayout;
OnboardTeamMembersPage.PageWrapper = PageWrapper; OnboardTeamMembersPage.PageWrapper = PageWrapper;
export default OnboardTeamMembersPage; export default OnboardTeamMembersPage;

View File

@ -1,3 +1,5 @@
"use client";
import Head from "next/head"; import Head from "next/head";
import { CreateANewTeamForm } from "@calcom/features/ee/teams/components"; import { CreateANewTeamForm } from "@calcom/features/ee/teams/components";
@ -18,7 +20,7 @@ const CreateNewTeamPage = () => {
</> </>
); );
}; };
const LayoutWrapper = (page: React.ReactElement) => { export const LayoutWrapper = (page: React.ReactElement) => {
return ( return (
<WizardLayout currentStep={1} maxSteps={2}> <WizardLayout currentStep={1} maxSteps={2}>
{page} {page}

View File

@ -1,9 +1,11 @@
import type { TestFunction } from "vitest"; import type { TestFunction } from "vitest";
import { WEBSITE_URL } from "@calcom/lib/constants";
import { test } from "@calcom/web/test/fixtures/fixtures"; import { test } from "@calcom/web/test/fixtures/fixtures";
import type { Fixtures } from "@calcom/web/test/fixtures/fixtures"; import type { Fixtures } from "@calcom/web/test/fixtures/fixtures";
import { createOrganization } from "@calcom/web/test/utils/bookingScenario/bookingScenario"; import { createOrganization } from "@calcom/web/test/utils/bookingScenario/bookingScenario";
const WEBSITE_PROTOCOL = new URL(WEBSITE_URL).protocol;
const _testWithAndWithoutOrg = ( const _testWithAndWithoutOrg = (
description: Parameters<typeof testWithAndWithoutOrg>[0], description: Parameters<typeof testWithAndWithoutOrg>[0],
fn: Parameters<typeof testWithAndWithoutOrg>[1], fn: Parameters<typeof testWithAndWithoutOrg>[1],
@ -28,7 +30,7 @@ const _testWithAndWithoutOrg = (
skip, skip,
org: { org: {
organization: org, organization: org,
urlOrigin: `http://${org.slug}.cal.local:3000`, urlOrigin: `${WEBSITE_PROTOCOL}//${org.slug}.cal.local:3000`,
}, },
}); });
}, },

View File

@ -33,7 +33,9 @@ import { useBrandColors } from "./utils/use-brand-colors";
const loadFramerFeatures = () => import("./framer-features").then((res) => res.default); const loadFramerFeatures = () => import("./framer-features").then((res) => res.default);
const PoweredBy = dynamic(() => import("@calcom/ee/components/PoweredBy")); const PoweredBy = dynamic(() => import("@calcom/ee/components/PoweredBy"));
const UnpublishedEntity = dynamic(() => import("@calcom/ui").then((mod) => mod.UnpublishedEntity)); const UnpublishedEntity = dynamic(() =>
import("@calcom/ui/components/unpublished-entity/UnpublishedEntity").then((mod) => mod.UnpublishedEntity)
);
const DatePicker = dynamic(() => import("./components/DatePicker").then((mod) => mod.DatePicker), { const DatePicker = dynamic(() => import("./components/DatePicker").then((mod) => mod.DatePicker), {
ssr: false, ssr: false,
}); });

View File

@ -200,7 +200,7 @@ export const BookEventFormChild = ({
const { uid, paymentUid } = responseData; const { uid, paymentUid } = responseData;
const fullName = getFullName(bookingForm.getValues("responses.name")); const fullName = getFullName(bookingForm.getValues("responses.name"));
if (paymentUid) { if (paymentUid) {
return router.push( router.push(
createPaymentLink({ createPaymentLink({
paymentUid, paymentUid,
date: timeslot, date: timeslot,
@ -225,7 +225,7 @@ export const BookEventFormChild = ({
isRescheduling && bookingData?.startTime ? dayjs(bookingData.startTime).toString() : undefined, isRescheduling && bookingData?.startTime ? dayjs(bookingData.startTime).toString() : undefined,
}; };
return bookingSuccessRedirect({ bookingSuccessRedirect({
successRedirectUrl: eventType?.successRedirectUrl || "", successRedirectUrl: eventType?.successRedirectUrl || "",
query, query,
booking: responseData, booking: responseData,
@ -272,7 +272,7 @@ export const BookEventFormChild = ({
isRescheduling && bookingData?.startTime ? dayjs(bookingData.startTime).toString() : undefined, isRescheduling && bookingData?.startTime ? dayjs(bookingData.startTime).toString() : undefined,
}; };
return bookingSuccessRedirect({ bookingSuccessRedirect({
successRedirectUrl: eventType?.successRedirectUrl || "", successRedirectUrl: eventType?.successRedirectUrl || "",
query, query,
booking, booking,
@ -325,10 +325,6 @@ export const BookEventFormChild = ({
); );
const bookEvent = (values: BookingFormValues) => { const bookEvent = (values: BookingFormValues) => {
// Clears form values stored in store, so old values won't stick around.
setFormValues({});
bookingForm.clearErrors();
// It shouldn't be possible that this method is fired without having eventQuery data, // It shouldn't be possible that this method is fired without having eventQuery data,
// but since in theory (looking at the types) it is possible, we still handle that case. // but since in theory (looking at the types) it is possible, we still handle that case.
if (!eventQuery?.data) { if (!eventQuery?.data) {
@ -375,6 +371,9 @@ export const BookEventFormChild = ({
} else { } else {
createBookingMutation.mutate(mapBookingToMutationInput(bookingInput)); createBookingMutation.mutate(mapBookingToMutationInput(bookingInput));
} }
// Clears form values stored in store, so old values won't stick around.
setFormValues({});
bookingForm.clearErrors();
}; };
if (!eventType) { if (!eventType) {
@ -442,7 +441,14 @@ export const BookEventFormChild = ({
<Button <Button
type="submit" type="submit"
color="primary" color="primary"
loading={createBookingMutation.isLoading || createRecurringBookingMutation.isLoading} loading={
bookingForm.formState.isSubmitting ||
createBookingMutation.isLoading ||
createRecurringBookingMutation.isLoading ||
// A redirect is triggered on mutation success, so keep the button disabled as this is happening.
createBookingMutation.isSuccess ||
createRecurringBookingMutation.isSuccess
}
data-testid={ data-testid={
rescheduleUid && bookingData ? "confirm-reschedule-button" : "confirm-book-button" rescheduleUid && bookingData ? "confirm-reschedule-button" : "confirm-book-button"
}> }>

View File

@ -15,9 +15,12 @@ import { useBookerStore } from "../store";
import { FromToTime } from "../utils/dates"; import { FromToTime } from "../utils/dates";
import { useEvent } from "../utils/event"; import { useEvent } from "../utils/event";
const TimezoneSelect = dynamic(() => import("@calcom/ui").then((mod) => mod.TimezoneSelect), { const TimezoneSelect = dynamic(
ssr: false, () => import("@calcom/ui/components/form/timezone-select/TimezoneSelect").then((mod) => mod.TimezoneSelect),
}); {
ssr: false,
}
);
export const EventMeta = () => { export const EventMeta = () => {
const { setTimezone, timeFormat, timezone } = useTimePreferences(); const { setTimezone, timeFormat, timezone } = useTimePreferences();

View File

@ -1,7 +1,7 @@
import type { Prisma } from "@prisma/client"; import type { Prisma } from "@prisma/client";
import type { IncomingMessage } from "http"; import type { IncomingMessage } from "http";
import { IS_PRODUCTION } from "@calcom/lib/constants"; import { IS_PRODUCTION, WEBSITE_URL } from "@calcom/lib/constants";
import { ALLOWED_HOSTNAMES, RESERVED_SUBDOMAINS, WEBAPP_URL } from "@calcom/lib/constants"; import { ALLOWED_HOSTNAMES, RESERVED_SUBDOMAINS, WEBAPP_URL } from "@calcom/lib/constants";
import logger from "@calcom/lib/logger"; import logger from "@calcom/lib/logger";
import slugify from "@calcom/lib/slugify"; import slugify from "@calcom/lib/slugify";
@ -100,9 +100,10 @@ export function subdomainSuffix() {
} }
export function getOrgFullOrigin(slug: string, options: { protocol: boolean } = { protocol: true }) { export function getOrgFullOrigin(slug: string, options: { protocol: boolean } = { protocol: true }) {
if (!slug) return options.protocol ? WEBAPP_URL : WEBAPP_URL.replace("https://", "").replace("http://", ""); if (!slug)
return options.protocol ? WEBSITE_URL : WEBSITE_URL.replace("https://", "").replace("http://", "");
const orgFullOrigin = `${ const orgFullOrigin = `${
options.protocol ? `${new URL(WEBAPP_URL).protocol}//` : "" options.protocol ? `${new URL(WEBSITE_URL).protocol}//` : ""
}${slug}.${subdomainSuffix()}`; }${slug}.${subdomainSuffix()}`;
return orgFullOrigin; return orgFullOrigin;
} }

View File

@ -1,3 +1,5 @@
"use client";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { useEffect } from "react"; import { useEffect } from "react";

View File

@ -107,9 +107,7 @@ export default function TeamListItem(props: Props) {
<span className="text-default text-sm font-bold">{team.name}</span> <span className="text-default text-sm font-bold">{team.name}</span>
<span className="text-muted block text-xs"> <span className="text-muted block text-xs">
{team.slug ? ( {team.slug ? (
`${getTeamUrlSync({ orgSlug: team.parent ? team.parent.slug : null, teamSlug: team.slug })}/${ `${getTeamUrlSync({ orgSlug: team.parent ? team.parent.slug : null, teamSlug: team.slug })}`
team.slug
}`
) : ( ) : (
<Badge>{t("upgrade")}</Badge> <Badge>{t("upgrade")}</Badge>
)} )}
@ -245,11 +243,10 @@ export default function TeamListItem(props: Props) {
color="secondary" color="secondary"
onClick={() => { onClick={() => {
navigator.clipboard.writeText( navigator.clipboard.writeText(
`${ `${getTeamUrlSync({
orgBranding orgSlug: team.parent ? team.parent.slug : null,
? `${orgBranding.fullDomain}` teamSlug: team.slug,
: `${process.env.NEXT_PUBLIC_WEBSITE_URL}/team` })}`
}/${team.slug}`
); );
showToast(t("link_copied"), "success"); showToast(t("link_copied"), "success");
}} }}
@ -285,11 +282,10 @@ export default function TeamListItem(props: Props) {
<DropdownItem <DropdownItem
type="button" type="button"
target="_blank" target="_blank"
href={`${ href={`${getTeamUrlSync({
orgBranding orgSlug: team.parent ? team.parent.slug : null,
? `${orgBranding.fullDomain}` teamSlug: team.slug,
: `${process.env.NEXT_PUBLIC_WEBSITE_URL}/team` })}`}
}/${team.slug}`}
StartIcon={ExternalLink}> StartIcon={ExternalLink}>
{t("preview_team") as string} {t("preview_team") as string}
</DropdownItem> </DropdownItem>

View File

@ -1,3 +1,5 @@
"use client";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { useState } from "react"; import { useState } from "react";
import { useForm } from "react-hook-form"; import { useForm } from "react-hook-form";

View File

@ -1,3 +1,5 @@
"use client";
import { useLocale } from "@calcom/lib/hooks/useLocale"; import { useLocale } from "@calcom/lib/hooks/useLocale";
import { Meta } from "@calcom/ui"; import { Meta } from "@calcom/ui";

View File

@ -1,3 +1,5 @@
"use client";
import { useSession } from "next-auth/react"; import { useSession } from "next-auth/react";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { useState } from "react"; import { useState } from "react";

View File

@ -1,3 +1,5 @@
"use client";
import { zodResolver } from "@hookform/resolvers/zod"; import { zodResolver } from "@hookform/resolvers/zod";
import type { Prisma } from "@prisma/client"; import type { Prisma } from "@prisma/client";
import { useSession } from "next-auth/react"; import { useSession } from "next-auth/react";

View File

@ -10,7 +10,9 @@
"./components/icon": "./components/icon/index.ts", "./components/icon": "./components/icon/index.ts",
"./components/icon/Discord": "./components/icon/Discord.tsx", "./components/icon/Discord": "./components/icon/Discord.tsx",
"./components/icon/SatSymbol": "./components/icon/SatSymbol.tsx", "./components/icon/SatSymbol": "./components/icon/SatSymbol.tsx",
"./components/icon/Spinner": "./components/icon/Spinner.tsx" "./components/icon/Spinner": "./components/icon/Spinner.tsx",
"./components/unpublished-entity/UnpublishedEntity": "./components/unpublished-entity/index.ts",
"./components/form/timezone-select/TimezoneSelect": "./components/form/timezone-select/index.ts"
}, },
"types": "./index.tsx", "types": "./index.tsx",
"license": "MIT", "license": "MIT",

View File

@ -112,6 +112,7 @@
"cache": false "cache": false
}, },
"dx": { "dx": {
"dependsOn": ["//#env-check:common", "//#env-check:app-store"],
"cache": false "cache": false
}, },
"lint": { "lint": {