Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into domain-wide-delegatio…
Browse files Browse the repository at this point in the history
…n-google-calendar
  • Loading branch information
hariombalhara committed Jan 16, 2025
2 parents 7e0a1bf + 79a8ab7 commit 04168c1
Show file tree
Hide file tree
Showing 163 changed files with 1,912 additions and 1,680 deletions.
8 changes: 8 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,14 @@ E2E_TEST_OIDC_USER_PASSWORD=
# provide a value between 0 and 100 to ensure the percentage of traffic
# redirected from the legacy to the future pages
AB_TEST_BUCKET_PROBABILITY=50
APP_ROUTER_APPS_INSTALLED_CATEGORY_ENABLED=0
APP_ROUTER_APPS_SLUG_ENABLED=0
APP_ROUTER_APPS_SLUG_SETUP_ENABLED=0
# whether we redirect to the future/apps/categories from /apps/categories or not
APP_ROUTER_APPS_CATEGORIES_ENABLED=0
# whether we redirect to the future/apps/categories/[category] from /apps/categories/[category] or not
APP_ROUTER_APPS_CATEGORIES_CATEGORY_ENABLED=0
APP_ROUTER_APPS_ENABLED=0
APP_ROUTER_TEAM_ENABLED=0
APP_ROUTER_AUTH_FORGOT_PASSWORD_ENABLED=0
APP_ROUTER_AUTH_LOGIN_ENABLED=0
Expand Down
6 changes: 6 additions & 0 deletions .yarn/versions/14a3a33b.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
undecided:
- "@calcom/app-store-cli"
- "@calcom/platform-constants"
- "@calcom/platform-enums"
- "@calcom/platform-types"
- "@calcom/platform-utils"
3 changes: 3 additions & 0 deletions .yarn/versions/d05ae1e0.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
undecided:
- calcom-monorepo
- "@calcom/prisma"
2 changes: 1 addition & 1 deletion apps/api/v2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@axiomhq/winston": "^1.2.0",
"@calcom/platform-constants": "*",
"@calcom/platform-enums": "*",
"@calcom/platform-libraries": "npm:@calcom/platform-libraries@0.0.81",
"@calcom/platform-libraries": "npm:@calcom/platform-libraries@0.0.82",
"@calcom/platform-libraries-0.0.2": "npm:@calcom/platform-libraries@0.0.2",
"@calcom/platform-types": "*",
"@calcom/platform-utils": "*",
Expand Down
4 changes: 2 additions & 2 deletions apps/api/v2/swagger/documentation.json
Original file line number Diff line number Diff line change
Expand Up @@ -8001,7 +8001,7 @@
"type": {
"type": "string",
"example": "name",
"description": "only allowed value for type is `name`"
"description": "only allowed value for type is `name`. Used for having 1 booking field for both first name and last name."
},
"label": {
"type": "string"
Expand Down Expand Up @@ -8795,7 +8795,7 @@
"boolean"
],
"example": "name",
"description": "only allowed value for type is `name`",
"description": "only allowed value for type is `name`. Used for having 1 booking field for both first name and last name.",
"default": "name"
},
"label": {
Expand Down
5 changes: 5 additions & 0 deletions apps/web/abTest/middlewareFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ import { NextResponse, URLPattern } from "next/server";
import { FUTURE_ROUTES_ENABLED_COOKIE_NAME, FUTURE_ROUTES_OVERRIDE_COOKIE_NAME } from "@calcom/lib/constants";

const ROUTES: [URLPattern, boolean][] = [
["/apps/installed/:category", process.env.APP_ROUTER_APPS_INSTALLED_CATEGORY_ENABLED === "1"] as const,
["/apps/:slug", process.env.APP_ROUTER_APPS_SLUG_ENABLED === "1"] as const,
["/apps/:slug/setup", process.env.APP_ROUTER_APPS_SLUG_SETUP_ENABLED === "1"] as const,
["/apps/categories", process.env.APP_ROUTER_APPS_CATEGORIES_ENABLED === "1"] as const,
["/apps/categories/:category", process.env.APP_ROUTER_APPS_CATEGORIES_CATEGORY_ENABLED === "1"] as const,
["/auth/forgot-password/:path*", process.env.APP_ROUTER_AUTH_FORGOT_PASSWORD_ENABLED === "1"] as const,
["/auth/login", process.env.APP_ROUTER_AUTH_LOGIN_ENABLED === "1"] as const,
["/auth/logout", process.env.APP_ROUTER_AUTH_LOGOUT_ENABLED === "1"] as const,
Expand Down
31 changes: 5 additions & 26 deletions apps/web/app/_utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import i18next from "i18next";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";
import { headers } from "next/headers";

import type { AppImageProps, MeetingImageProps } from "@calcom/lib/OgImages";
import { constructGenericImage, constructAppImage, constructMeetingImage } from "@calcom/lib/OgImages";
import type { MeetingImageProps } from "@calcom/lib/OgImages";
import { constructGenericImage, constructMeetingImage } from "@calcom/lib/OgImages";
import { IS_CALCOM, WEBAPP_URL, APP_NAME, SEO_IMG_OGIMG, CAL_URL } from "@calcom/lib/constants";
import { buildCanonical } from "@calcom/lib/next-seo.config";
import { truncateOnWord } from "@calcom/lib/text";
Expand Down Expand Up @@ -62,18 +62,17 @@ const _generateMetadataWithoutImage = async (
const t = await getTranslationWithCache(locale);

const title = getTitle(t);

const description = getDescription(t);
const titleSuffix = `| ${APP_NAME}`;
const displayedTitle = title.includes(titleSuffix) || hideBranding ? title : `${title} ${titleSuffix}`;
const metadataBase = new URL(IS_CALCOM ? "https://cal.com" : WEBAPP_URL);
const truncatedDescription = truncateOnWord(getDescription(t), 158);

return {
title: title.length === 0 ? APP_NAME : displayedTitle,
description: truncatedDescription,
description,
alternates: { canonical },
openGraph: {
description: truncatedDescription,
description: truncateOnWord(description, 158),
url: canonical,
type: "website",
siteName: APP_NAME,
Expand Down Expand Up @@ -106,26 +105,6 @@ export const _generateMetadata = async (
};
};

export const generateAppMetadata = async (
app: AppImageProps,
getTitle: (t: TFunction<string, undefined>) => string,
getDescription: (t: TFunction<string, undefined>) => string,
hideBranding?: boolean,
origin?: string
) => {
const metadata = await _generateMetadataWithoutImage(getTitle, getDescription, hideBranding, origin);

const image = SEO_IMG_OGIMG + constructAppImage({ ...app, description: metadata.description });

return {
...metadata,
openGraph: {
...metadata.openGraph,
images: [image],
},
};
};

export const generateMeetingMetadata = async (
meeting: MeetingImageProps,
getTitle: (t: TFunction<string, undefined>) => string,
Expand Down
68 changes: 0 additions & 68 deletions apps/web/app/apps/[slug]/page.tsx

This file was deleted.

40 changes: 0 additions & 40 deletions apps/web/app/apps/categories/[category]/page.tsx

This file was deleted.

32 changes: 0 additions & 32 deletions apps/web/app/apps/installed/[category]/page.tsx

This file was deleted.

1 change: 0 additions & 1 deletion apps/web/app/apps/routing-forms/[...pages]/page.tsx

This file was deleted.

1 change: 0 additions & 1 deletion apps/web/app/apps/routing-forms/page.tsx

This file was deleted.

89 changes: 47 additions & 42 deletions apps/web/app/error.tsx
Original file line number Diff line number Diff line change
@@ -1,59 +1,64 @@
"use client";

import { captureException } from "@sentry/nextjs";
/**
* Typescript class based component for custom-error
* @link https://nextjs.org/docs/advanced-features/custom-error-page
*/
import type { NextPage } from "next";
import type { ErrorProps } from "next/error";
import React from "react";

import { getErrorFromUnknown } from "@calcom/lib/errors";
import { HttpError } from "@calcom/lib/http-error";
import logger from "@calcom/lib/logger";
import { redactError } from "@calcom/lib/redactError";

import { ErrorPage } from "@components/error/error-page";

const log = logger.getSubLogger({ prefix: ["[error]"] });
type NextError = Error & { digest?: string };

type ErrorProps = {
error: Error;
reset: () => void;
// Ref: https://nextjs.org/docs/app/api-reference/file-conventions/error#props
export type DefaultErrorProps = {
error: NextError;
reset: () => void; // A function to reset the error boundary
};

export default function Error({ error, reset }: ErrorProps) {
React.useEffect(() => {
log.error(error);

// Log the error to Sentry
captureException(error);
}, [error]);

const processedError = React.useMemo(() => {
const err = getErrorFromUnknown(error);

if (err instanceof HttpError) {
const redactedError = redactError(err);
return {
statusCode: err.statusCode,
title: redactedError.name,
name: redactedError.name,
message: redactedError.message,
url: err.url,
method: err.method,
cause: err.cause,
};
}

return {
statusCode: 500,
title: "Internal Server Error",
name: "Internal Server Error",
message: "An unexpected error occurred.",
type AugmentedError = NextError | HttpError | null;

type CustomErrorProps = {
err?: AugmentedError;
statusCode?: number;
message?: string;
} & Omit<ErrorProps, "err" | "statusCode">;

const log = logger.getSubLogger({ prefix: ["[error]"] });

const CustomError: NextPage<DefaultErrorProps> = (props) => {
const { error } = props;
let errorObject: CustomErrorProps = {
message: error.message,
err: error,
};

if (error instanceof HttpError) {
const redactedError = redactError(error);
errorObject = {
statusCode: error.statusCode,
title: redactedError.name,
message: redactedError.message,
err: {
...redactedError,
...error,
},
};
}, [error]);
}

// `error.digest` property contains an automatically generated hash of the error that can be used to match the corresponding error in server-side logs
log.debug(`${error?.toString() ?? JSON.stringify(error)}`);
log.info("errorObject: ", errorObject);

return (
<ErrorPage
statusCode={processedError.statusCode}
error={processedError}
message={processedError.message}
/>
<ErrorPage statusCode={errorObject.statusCode} error={errorObject.err} message={errorObject.message} />
);
}
};

export default CustomError;
Loading

0 comments on commit 04168c1

Please sign in to comment.