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,3 +1,5 @@
"use client";
import Link from "next/link";
import { useEffect, useState } from "react";
import QRCode from "react-qr-code";
@@ -1,4 +1,3 @@
import { XhrApi } from "@ewsjs/xhr";
import type { FindFoldersResults, FindItemsResults } from "ews-javascript-api";
import {
Appointment,
@@ -55,7 +54,7 @@ export default class ExchangeCalendarService implements Calendar {
}
async createEvent(event: CalendarEvent): Promise<NewCalendarEventType> {
const appointment: Appointment = new Appointment(this.getExchangeService());
const appointment: Appointment = new Appointment(await this.getExchangeService());
appointment.Subject = event.title;
appointment.Start = DateTime.Parse(event.startTime);
appointment.End = DateTime.Parse(event.endTime);
@@ -91,7 +90,7 @@ export default class ExchangeCalendarService implements Calendar {
uid: string,
event: CalendarEvent
): Promise<NewCalendarEventType | NewCalendarEventType[]> {
const appointment: Appointment = await Appointment.Bind(this.getExchangeService(), new ItemId(uid));
const appointment: Appointment = await Appointment.Bind(await this.getExchangeService(), new ItemId(uid));
appointment.Subject = event.title;
appointment.Start = DateTime.Parse(event.startTime);
appointment.End = DateTime.Parse(event.endTime);
@@ -127,7 +126,7 @@ export default class ExchangeCalendarService implements Calendar {
}
async deleteEvent(uid: string): Promise<void> {
const appointment: Appointment = await Appointment.Bind(this.getExchangeService(), new ItemId(uid));
const appointment: Appointment = await Appointment.Bind(await this.getExchangeService(), new ItemId(uid));
return appointment.Delete(DeleteMode.MoveToDeletedItems).catch((reason) => {
this.log.error(reason);
throw reason;
@@ -143,7 +142,7 @@ export default class ExchangeCalendarService implements Calendar {
const promises: Promise<EventBusyDate[]>[] = calendars
.filter((lcal) => selectedCalendars.some((rcal) => lcal.externalId == rcal.externalId))
.map(async (calendar) => {
return this.getExchangeService()
return (await this.getExchangeService())
.FindAppointments(
new FolderId(calendar.externalId),
new CalendarView(DateTime.Parse(dateFrom), DateTime.Parse(dateTo))
@@ -167,7 +166,7 @@ export default class ExchangeCalendarService implements Calendar {
}
async listCalendars(): Promise<IntegrationCalendar[]> {
const service: ExchangeService = this.getExchangeService();
const service: ExchangeService = await this.getExchangeService();
const view: FolderView = new FolderView(1000);
view.PropertySet = new PropertySet(BasePropertySet.IdOnly);
view.PropertySet.Add(FolderSchema.ParentFolderId);
@@ -197,12 +196,13 @@ export default class ExchangeCalendarService implements Calendar {
});
}
private getExchangeService(): ExchangeService {
private async getExchangeService(): Promise<ExchangeService> {
const service: ExchangeService = new ExchangeService(this.payload.exchangeVersion);
service.Credentials = new WebCredentials(this.payload.username, this.payload.password);
service.Url = new Uri(this.payload.url);
if (this.payload.authenticationMethod === ExchangeAuthentication.NTLM) {
const xhr: XhrApi = new XhrApi({
const { XhrApi } = await import("@ewsjs/xhr");
const xhr = new XhrApi({
rejectUnauthorized: false,
}).useNtlmAuthentication(this.payload.username, this.payload.password);
service.XHRApi = xhr;
+1 -1
View File
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { z } from "zod";
import { appStoreMetadata } from "@calcom/app-store/bookerAppsMetaData";
+20 -15
View File
@@ -1,5 +1,4 @@
import type { InferGetServerSidePropsType } from "next";
import { Trans } from "next-i18next";
import Link from "next/link";
import { useState } from "react";
import { Toaster } from "sonner";
@@ -11,6 +10,7 @@ import { Button } from "@calcom/ui/components/button";
import { Icon } from "@calcom/ui/components/icon";
import { showToast } from "@calcom/ui/components/toast";
import { Tooltip } from "@calcom/ui/components/tooltip";
import ServerTrans from "@calcom/web/components/ServerTrans";
import type { getServerSideProps } from "./_getServerSideProps";
@@ -115,20 +115,25 @@ export default function MakeSetup({ inviteLink }: InferGetServerSidePropsType<ty
</>
<ol className="mb-5 ml-5 mt-5 list-decimal ltr:mr-5 rtl:ml-5">
<Trans i18nKey="make_setup_instructions">
<li>
Go to
<a href={inviteLink} className="ml-1 mr-1 text-orange-600 underline">
Make Invite Link
</a>
and install the Cal.com app.
</li>
<li>Log into your Make account and create a new Scenario.</li>
<li>Select Cal.com as your Trigger app. Also choose a Trigger event.</li>
<li>Choose your account and then enter your Unique API Key.</li>
<li>Test your Trigger.</li>
<li>You&apos;re set!</li>
</Trans>
<li>
<ServerTrans
t={t}
i18nKey="make_setup_instructions_1"
components={[
<a
key="make-invite-link"
href={inviteLink}
className="ml-1 mr-1 text-orange-600 underline">
Make Invite Link
</a>,
]}
/>
</li>
<li>{t("make_setup_instructions_2")}</li>
<li>{t("make_setup_instructions_3")}</li>
<li>{t("make_setup_instructions_4")}</li>
<li>{t("make_setup_instructions_5")}</li>
<li>{t("make_setup_instructions_6")}</li>
</ol>
<Link href="/apps/installed/automation?hl=make" passHref={true} legacyBehavior>
<Button color="secondary">{t("done")}</Button>
@@ -114,7 +114,6 @@ export const getServerSidePropsForSingleFormView = async function getServerSideP
return {
props: {
trpcState: await ssr.dehydrate(),
form: await getSerializableForm({ form: formWithoutProfileInfo }),
enrichedWithUserProfileForm: await getSerializableForm({
form: enrichFormWithMigrationData(formWithUserInfoProfile),
@@ -0,0 +1,8 @@
export const routingFormsComponents = {
"form-edit": () => import("./form-edit/[...appPages]").then((mod) => mod.default),
"route-builder": () => import("./route-builder/[...appPages]").then((mod) => mod.default),
"forms": () => import("./forms/[...appPages]").then((mod) => mod.default),
"routing-link": () => import("./routing-link/[...appPages]").then((mod) => mod.default),
"reporting": () => import("./reporting/[...appPages]").then((mod) => mod.default),
"incomplete-booking": () => import("./incomplete-booking/[...appPages]").then((mod) => mod.default),
};
@@ -1,26 +1,11 @@
//TODO: Generate this file automatically so that like in Next.js file based routing can work automatically
import "server-only";
import type { AppGetServerSideProps } from "@calcom/types/AppGetServerSideProps";
import { getServerSidePropsForSingleFormView as getServerSidePropsSingleForm } from "../components/getServerSidePropsSingleForm";
import * as formEdit from "./form-edit/[...appPages]";
import * as forms from "./forms/[...appPages]";
// extracts getServerSideProps function from the client component
import { getServerSideProps as getServerSidePropsForms } from "./forms/getServerSideProps";
import * as IncompleteBooking from "./incomplete-booking/[...appPages]";
import * as Reporting from "./reporting/[...appPages]";
import * as RouteBuilder from "./route-builder/[...appPages]";
import * as RoutingLink from "./routing-link/[...appPages]";
import { getServerSideProps as getServerSidePropsRoutingLink } from "./routing-link/getServerSideProps";
const routingConfig = {
"form-edit": formEdit,
"route-builder": RouteBuilder,
forms: forms,
"routing-link": RoutingLink,
reporting: Reporting,
"incomplete-booking": IncompleteBooking,
};
export const routingServerSidePropsConfig: Record<string, AppGetServerSideProps> = {
forms: getServerSidePropsForms,
"form-edit": getServerSidePropsSingleForm,
@@ -29,5 +14,3 @@ export const routingServerSidePropsConfig: Record<string, AppGetServerSideProps>
reporting: getServerSidePropsSingleForm,
"incomplete-booking": getServerSidePropsSingleForm,
};
export default routingConfig;
@@ -30,8 +30,6 @@ export const getServerSideProps = async function getServerSideProps(
// Prefetch this so that New Button is immediately available
await ssr.viewer.teamsAndUserProfilesQuery.prefetch();
return {
props: {
trpcState: await ssr.dehydrate(),
},
props: {},
};
};
@@ -1,41 +0,0 @@
"use client";
import type { GetServerSidePropsContext, GetServerSideProps } from "next";
import type { ReactElement, ReactNode, ComponentType } from "react";
import { FormProvider, useForm } from "react-hook-form";
import { useParamsWithFallback } from "@calcom/lib/hooks/useParamsWithFallback";
import RoutingFormsRoutingConfig from "../app-routing.config";
const DEFAULT_ROUTE = "forms";
type ComponentWithLayout = ComponentType & {
getLayout?: (page: ReactElement) => ReactNode;
};
type Component = {
default: ComponentWithLayout;
getServerSideProps?: (
context: GetServerSidePropsContext,
...rest: Parameters<GetServerSideProps>
) => ReturnType<GetServerSideProps>;
};
const getComponent = (route: string): Component => {
return (RoutingFormsRoutingConfig as unknown as Record<string, Component>)[route];
};
export default function LayoutHandler(props: { [key: string]: unknown }) {
const params = useParamsWithFallback();
const methods = useForm();
const pageKey = Array.isArray(params.pages)
? params.pages[0]
: params.pages?.split("/")[0] ?? DEFAULT_ROUTE;
const PageComponent = getComponent(pageKey).default;
return (
<FormProvider {...methods}>
<PageComponent {...props} />
</FormProvider>
);
}
+1 -1
View File
@@ -1,5 +1,5 @@
import type { Prisma } from "@prisma/client";
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { defaultVideoAppCategories } from "@calcom/app-store/utils";
import getEnabledAppsFromCredentials from "@calcom/lib/apps/getEnabledAppsFromCredentials";
+3 -3
View File
@@ -1,4 +1,3 @@
import { VitalClient } from "@tryvital/vital-node";
import type { ClientConfig } from "@tryvital/vital-node/dist/lib/models";
import getAppKeysFromSlug from "../../_utils/getAppKeysFromSlug";
@@ -8,10 +7,10 @@ type VitalEnv = ClientConfig & {
webhook_secret: string;
};
export let vitalClient: VitalClient | null = null;
export let vitalClient: any = null;
export let vitalEnv: VitalEnv | null = null;
export async function initVitalClient(): Promise<VitalClient> {
export async function initVitalClient() {
if (vitalClient) return vitalClient;
const appKeys = (await getAppKeysFromSlug("vital-automation")) as unknown as VitalEnv;
if (
@@ -23,6 +22,7 @@ export async function initVitalClient(): Promise<VitalClient> {
)
throw Error("Missing properties in vital-automation DB keys");
vitalEnv = appKeys;
const { VitalClient } = await import("@tryvital/vital-node");
vitalClient = new VitalClient({
region: appKeys.region,
api_key: appKeys.api_key || "",
+1 -1
View File
@@ -1,5 +1,5 @@
import type { Booking, BookingReference, User } from "@prisma/client";
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import dayjs from "@calcom/dayjs";
import { sendRequestRescheduleEmailAndSMS } from "@calcom/emails";
@@ -1,5 +1,5 @@
import type { Booking, BookingReference, User } from "@prisma/client";
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import dayjs from "@calcom/dayjs";
import { sendRequestRescheduleEmailAndSMS } from "@calcom/emails";
+16 -10
View File
@@ -1,4 +1,3 @@
import { Trans } from "next-i18next";
import Link from "next/link";
import { useState } from "react";
import { Toaster } from "sonner";
@@ -6,10 +5,11 @@ import { Toaster } from "sonner";
import AppNotInstalledMessage from "@calcom/app-store/_components/AppNotInstalledMessage";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { trpc } from "@calcom/trpc/react";
import { Icon } from "@calcom/ui/components/icon";
import { Tooltip } from "@calcom/ui/components/tooltip";
import { Button } from "@calcom/ui/components/button";
import { Icon } from "@calcom/ui/components/icon";
import { showToast } from "@calcom/ui/components/toast";
import { Tooltip } from "@calcom/ui/components/tooltip";
import ServerTrans from "@calcom/web/components/ServerTrans";
export interface IZapierSetupProps {
inviteLink?: string;
@@ -124,13 +124,19 @@ export default function ZapierSetup(props: IZapierSetupProps) {
</a>
</li>
)}
<Trans i18nKey="zapier_setup_instructions">
<li>Log into your Zapier account and create a new Zap.</li>
<li>Select Cal.com as your Trigger app. Also choose a Trigger event.</li>
<li>Choose your account and then enter your Unique API Key.</li>
<li>Test your Trigger.</li>
<li>You&apos;re set!</li>
</Trans>
<ServerTrans
t={t}
i18nKey="zapier_setup_instructions"
components={[
<li key="instruction_1">Log into your Zapier account and create a new Zap.</li>,
<li key="instruction_2">
Select Cal.com as your Trigger app. Also choose a Trigger event.
</li>,
<li key="instruction_3">Choose your account and then enter your Unique API Key.</li>,
<li key="instruction_4">Test your Trigger.</li>,
<li key="instruction_5">You&apos;re set!</li>,
]}
/>
</ol>
<Link href="/apps/installed/automation?hl=zapier" passHref={true} legacyBehavior>
<Button color="secondary">{t("done")}</Button>
+1 -1
View File
@@ -1,6 +1,6 @@
// eslint-disable-next-line no-restricted-imports
import { cloneDeep } from "lodash";
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import type { z } from "zod";
import type BaseEmail from "@calcom/emails/templates/_base-email";
+1 -1
View File
@@ -1,5 +1,5 @@
import type { EventStatus } from "ics";
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import type { CalendarEvent } from "@calcom/types/Calendar";
+1 -1
View File
@@ -1,6 +1,6 @@
import type { DateArray, ParticipationRole, EventStatus, ParticipationStatus } from "ics";
import { createEvent } from "ics";
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { RRule } from "rrule";
import { getRichDescription } from "@calcom/lib/CalEventParser";
+1 -1
View File
@@ -9,7 +9,7 @@
"dependencies": {
"@calcom/dayjs": "*",
"@calcom/lib": "*",
"next-i18next": "^13.2.2",
"next-i18next": "^15.4.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rrule": "^2.7.1"
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import type { CalendarEvent } from "@calcom/types/Calendar";
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { guessEventLocationType } from "@calcom/app-store/locations";
import { getVideoCallUrlFromCalEvent } from "@calcom/lib/CalEventParser";
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import getLabelValueMapFromResponses from "@calcom/lib/getLabelValueMapFromResponses";
import type { CalendarEvent } from "@calcom/types/Calendar";
+1 -1
View File
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { RRule } from "rrule";
import dayjs from "@calcom/dayjs";
+1 -1
View File
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import isSmsCalEmail from "@calcom/lib/isSmsCalEmail";
import type { CalendarEvent } from "@calcom/types/Calendar";
@@ -1,8 +1,7 @@
"use client";
import { Trans, type TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { APP_NAME, WEBAPP_URL } from "@calcom/lib/constants";
import ServerTrans from "@calcom/web/components/ServerTrans";
import { BaseEmailHtml, CallToAction } from "../components";
@@ -92,20 +91,7 @@ export const AdminOrganizationNotificationEmail = ({
<>{language("hi_admin")}!</>
</p>
<p style={{ fontWeight: 400, lineHeight: "24px" }}>
<Trans i18nKey="admin_org_notification_email_body_part1" t={language} values={{ orgSlug }}>
An organization with slug {`"${orgSlug}"`} was created.
<br />
<br />
Please be sure to configure your DNS registry to point the subdomain corresponding to the new
organization to where the main app is running. Otherwise the organization will not work.
<br />
<br />
Here are just the very basic options to configure a subdomain to point to their app so it loads the
organization profile page.
<br />
<br />
You can do it either with the A Record:
</Trans>
<ServerTrans i18nKey="admin_org_notification_email_body_part1" t={language} values={{ orgSlug }} />
</p>
{dnsTable("A", orgSlug, webappIPAddress, language)}
<p style={{ fontWeight: 400, lineHeight: "24px" }}>
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import dayjs from "@calcom/dayjs";
import { formatPrice } from "@calcom/lib/price";
@@ -1,11 +1,9 @@
"use client";
import type { TFunction } from "next-i18next";
import { Trans } from "react-i18next";
import type { TFunction } from "i18next";
import { AppStoreLocationType } from "@calcom/app-store/locations";
import { WEBAPP_URL } from "@calcom/lib/constants";
import type { CalendarEvent, Person } from "@calcom/types/Calendar";
import ServerTrans from "@calcom/web/components/ServerTrans";
import { BaseScheduledEmail } from "./BaseScheduledEmail";
@@ -17,18 +15,27 @@ export function getEnumKeyByEnumValue(myEnum: any, enumValue: number | string):
const BrokenVideoIntegration = (props: { location: string; eventTypeId?: number | null; t: TFunction }) => {
return (
<Trans i18nKey="broken_video_action" t={props.t}>
We could not add the <span>{props.location}</span> meeting link to your scheduled event. Contact your
invitees or update your calendar event to add the details. You can either&nbsp;
<a
href={
props.eventTypeId ? `${WEBAPP_URL}/event-types/${props.eventTypeId}` : `${WEBAPP_URL}/event-types`
}>
change your location on the event type
</a>
&nbsp;or try&nbsp;
<a href={`${WEBAPP_URL}/apps/installed`}>removing and adding the app again.</a>
</Trans>
<ServerTrans
i18nKey="broken_video_action"
t={props.t}
values={{ location: props.location }}
components={[
<a
key="broken-video-action-link-1"
className="cursor-pointer text-blue-500 underline"
href={
props.eventTypeId ? `${WEBAPP_URL}/event-types/${props.eventTypeId}` : `${WEBAPP_URL}/event-types`
}>
change your location on the event type
</a>,
<a
key="broken-video-action-link-2"
className="cursor-pointer text-blue-500 underline"
href={`${WEBAPP_URL}/apps/installed`}>
removing and adding the app again.
</a>,
]}
/>
);
};
@@ -40,12 +47,13 @@ const BrokenCalendarIntegration = (props: {
const { t } = props;
return (
<Trans i18nKey="broken_calendar_action" t={props.t}>
We could not update your <span>{props.calendar}</span>.{" "}
<a href={`${WEBAPP_URL}/apps/installed`}>
Please check your calendar settings or remove and add your calendar again
</a>
</Trans>
<div>
{t("broken_calendar_action", {
calendar: props.calendar,
calendarSettingsLink: `${WEBAPP_URL}/apps/installed`,
interpolation: { escapeValue: false },
})}
</div>
);
};
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { WEBAPP_URL, APP_NAME, COMPANY_NAME } from "@calcom/lib/constants";
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { WEBAPP_URL, COMPANY_NAME } from "@calcom/lib/constants";
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { WEBAPP_URL } from "@calcom/lib/constants";
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { APP_NAME, SUPPORT_MAIL_ADDRESS } from "@calcom/lib/constants";
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { APP_NAME, SENDER_NAME, SUPPORT_MAIL_ADDRESS } from "@calcom/lib/constants";
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { APP_NAME, WEBAPP_URL, IS_PRODUCTION } from "@calcom/lib/constants";
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { APP_NAME, SUPPORT_MAIL_ADDRESS, COMPANY_NAME } from "@calcom/lib/constants";
@@ -1,5 +1,6 @@
import type { TFunction } from "next-i18next";
import { Trans } from "next-i18next";
import type { TFunction } from "i18next";
import ServerTrans from "@calcom/web/components/ServerTrans";
import { BaseEmailHtml, CallToAction } from "../components";
@@ -30,25 +31,11 @@ export const OrganizationAdminNoSlotsEmail = (
<>{props.language("org_admin_no_slots|heading", { name: props.user })}</>
</p>
<p style={{ fontWeight: 400, fontSize: "16px", lineHeight: "24px" }}>
<Trans i18nKey="org_admin_no_slots|content" values={{ username: props.user, slug: props.slug }}>
Hello Organization Admins,
<br />
<br />
Please note: It has been brought to our attention that {props.user} has not had any availability
when a user has visited {props.teamSlug}/{props.slug}.
<br />
Start time: {props.startTime}
<br />
End time: {props.endTime}
<br />
<br />
There’s a few reasons why this could be happening:
<br />
<ul>
<li>The user does not have any calendars connected</li>
<li>Their schedules attached to this event are not enabled</li>
</ul>
</Trans>
<ServerTrans
t={props.language}
i18nKey="org_admin_no_slots|content"
values={{ username: props.user, slug: props.slug }}
/>
</p>
<div style={{ marginTop: "3rem", marginBottom: "0.75rem" }}>
<CallToAction
@@ -1,6 +1,5 @@
import { Trans } from "next-i18next";
import { APP_NAME, WEBAPP_URL } from "@calcom/lib/constants";
import ServerTrans from "@calcom/web/components/ServerTrans";
import type { OrganizationCreation } from "../../templates/organization-creation-email";
import { V2BaseEmailHtml } from "../components";
@@ -48,30 +47,32 @@ export const OrganizationCreationEmail = (
lineHeightStep: "24px",
}}>
{isNewUser ? (
<Trans>
<>
Enjoy your new organization link: <a href={`${newLink}`}>{newLinkWithoutProtocol}</a>
</Trans>
</>
) : (
<Trans i18nKey="email|existing_user_added_link_changed">
Your link has been changed from <a href={prevLink ?? ""}>{prevLinkWithoutProtocol}</a> to{" "}
<a href={newLink ?? ""}>{newLinkWithoutProtocol}</a> but don&apos;t worry, all previous links
still work and redirect appropriately.
<br />
<br />
Please note: All of your personal event types have been moved into the <strong>
{teamName}
</strong>{" "}
organisation, which may also include potential personal link.
<br />
<br />
Please log in and make sure you have no private events on your new organisational account.
<br />
<br />
For personal events we recommend creating a new account with a personal email address.
<br />
<br />
Enjoy your new clean link: <a href={`${newLink}?orgRedirection=true`}>{newLinkWithoutProtocol}</a>
</Trans>
<ServerTrans
t={props.language}
i18nKey="email|existing_user_added_link_changed"
components={{
a0: (
<a className="cursor-pointer text-blue-500 underline" href={prevLink ?? ""}>
{prevLinkWithoutProtocol}
</a>
),
a1: (
<a className="cursor-pointer text-blue-500 underline" href={newLink ?? ""}>
{newLinkWithoutProtocol}
</a>
),
a2: (
<a className="cursor-pointer text-blue-500 underline" href={`${newLink}?orgRedirection=true`}>
{newLinkWithoutProtocol}
</a>
),
}}
values={{ teamName }}
/>
)}
</p>
@@ -1,9 +1,7 @@
"use client";
import type { TFunction } from "next-i18next";
import { Trans } from "next-i18next";
import type { TFunction } from "i18next";
import { WEBAPP_URL } from "@calcom/lib/constants";
import ServerTrans from "@calcom/web/components/ServerTrans";
import { BaseEmailHtml, CallToAction } from "../components";
@@ -23,22 +21,14 @@ export const SlugReplacementEmail = (
headerType="teamCircle"
title={t("event_replaced_notice")}>
<>
<Trans i18nKey="hi_user_name" name={name}>
<p style={{ fontWeight: 400, lineHeight: "24px", display: "inline-block" }}>Hi {name}</p>
<p style={{ display: "inline" }}>,</p>
</Trans>
<Trans i18nKey="email_body_slug_replacement_notice" slug={slug}>
<p style={{ fontWeight: 400, lineHeight: "24px" }}>
An administrator on the <strong>{teamName}</strong> team has replaced your event type{" "}
<strong>/{slug}</strong> with a managed event type that they control.
</p>
</Trans>
<Trans i18nKey="email_body_slug_replacement_info">
<p style={{ fontWeight: 400, lineHeight: "24px" }}>
Your link will continue to work but some settings for it may have changed. You can review it in
event types.
</p>
</Trans>
<p style={{ fontWeight: 400, lineHeight: "24px", display: "inline-block" }}>
<ServerTrans t={t} i18nKey="hi_user_name" values={{ name }} />
</p>
<p style={{ display: "inline" }}>,</p>
<p style={{ fontWeight: 400, lineHeight: "24px" }}>
<ServerTrans t={t} i18nKey="email_body_slug_replacement_notice" values={{ teamName, slug }} />
</p>
<p style={{ fontWeight: 400, lineHeight: "24px" }}>{t("email_body_slug_replacement_info")}</p>
<table
role="presentation"
border={0}
@@ -64,15 +54,9 @@ export const SlugReplacementEmail = (
width: "100%",
}}
/>
<Trans i18nKey="email_body_slug_replacement_suggestion">
<p style={{ fontWeight: 400, lineHeight: "24px" }}>
If you have any questions about the event type, please reach out to your administrator.
<br />
<br />
Happy scheduling, <br />
The Cal.com team
</p>
</Trans>
<p style={{ fontWeight: 400, lineHeight: "24px" }}>
<ServerTrans i18nKey="email_body_slug_replacement_suggestion" t={t} />
</p>
{/*<p style={{ fontWeight: 400, lineHeight: "24px" }}>
<>{t("email_body_slug_replacement_suggestion")}</>
</p>*/}
@@ -1,7 +1,7 @@
import type { TFunction } from "next-i18next";
import { Trans } from "next-i18next";
import type { TFunction } from "i18next";
import { APP_NAME, WEBAPP_URL, IS_PRODUCTION } from "@calcom/lib/constants";
import ServerTrans from "@calcom/web/components/ServerTrans";
import { getSubject, getTypeOfInvite } from "../../templates/team-invite-email";
import { V2BaseEmailHtml, CallToAction } from "../components";
@@ -157,49 +157,48 @@ export const TeamInviteEmail = (
<>
{autoJoinType == "added" ? (
<>
<Trans i18nKey="email_team_invite|content|added_to_org">
{invitedBy} has added you to the <strong>{teamName}</strong> organization.
</Trans>{" "}
<Trans
i18nKey="email_team_invite|content_addition|existing_user_added"
values={{ prevLink: props.prevLink, newLink: props.newLink, teamName: props.teamName }}>
Your link has been changed from <a href={prevLink ?? ""}>{prevLinkWithoutProtocol}</a> to{" "}
<a href={newLink ?? ""}>{newLinkWithoutProtocol}</a> but don&apos;t worry, all previous
links still work and redirect appropriately.
<br />
<br />
Please note: All of your personal event types have been moved into the{" "}
<strong>{teamName}</strong> organisation, which may also include potential personal link.
<br />
<br />
Please log in and make sure you have no private events on your new organisational account.
<br />
<br />
For personal events we recommend creating a new account with a personal email address.
<br />
<br />
Enjoy your new clean link:{" "}
<a href={`${newLink}?orgRedirection=true`}>{newLinkWithoutProtocol}</a>
</Trans>
<ServerTrans
t={props.language}
i18nKey="email_team_invite|content|added_to_org"
values={{ teamName, invitedBy, appName: APP_NAME }}
/>{" "}
<ServerTrans
t={props.language}
i18nKey="email|existing_user_added_link_changed"
components={{
a0: (
<a className="cursor-pointer text-blue-500 underline" href={prevLink ?? ""}>
{prevLinkWithoutProtocol}
</a>
),
a1: (
<a className="cursor-pointer text-blue-500 underline" href={newLink ?? ""}>
{newLinkWithoutProtocol}
</a>
),
a2: (
<a
className="cursor-pointer text-blue-500 underline"
href={`${newLink}?orgRedirection=true`}>
{newLinkWithoutProtocol}
</a>
),
}}
values={{ teamName, appName: APP_NAME }}
/>
</>
) : (
<>
<Trans i18nKey="email_team_invite|content|invited_to_org">
{invitedBy} has invited you to join the <strong>{teamName}</strong> organization.
</Trans>{" "}
<Trans
<ServerTrans
t={props.language}
i18nKey="email_team_invite|content|invited_to_org"
values={{ teamName, invitedBy, appName: APP_NAME }}
/>{" "}
<ServerTrans
t={props.language}
i18nKey="existing_user_added_link_will_change"
values={{ prevLink: props.prevLink, newLink: props.newLink, teamName: props.teamName }}>
On accepting the invite, your link will change to your organization domain but don&apos;t
worry, all previous links will still work and redirect appropriately.
<br />
<br />
Please note: All of your personal event types will be moved into the{" "}
<strong>{teamName}</strong> organisation, which may also include potential personal link.
<br />
<br />
For personal events we recommend creating a new account with a personal email address.
</Trans>
values={{ teamName, appName: APP_NAME }}
/>
</>
)}
</>
@@ -208,18 +207,20 @@ export const TeamInviteEmail = (
return (
<>
{autoJoinType === "added" ? (
<Trans i18nKey="email_team_invite|content|added_to_org">
{invitedBy} has added you to the <strong>{teamName}</strong> organization.
</Trans>
<ServerTrans
t={props.language}
i18nKey="email_team_invite|content|added_to_org"
values={{ teamName, invitedBy, appName: APP_NAME }}
/>
) : (
<Trans i18nKey="email_team_invite|content|invited_to_org">
{invitedBy} has invited you to join the <strong>{teamName}</strong> organization.
</Trans>
<ServerTrans
t={props.language}
i18nKey="email_team_invite|content|invited_to_org"
values={{ teamName, invitedBy, appName: APP_NAME }}
/>
)}{" "}
<Trans>
{appName} is the event-juggling scheduler that enables you and your team to schedule meetings
without the email tennis.
</Trans>
{appName} is the event-juggling scheduler that enables you and your team to schedule meetings
without the email tennis.
</>
);
}
@@ -228,20 +229,20 @@ export const TeamInviteEmail = (
return (
<>
{autoJoinType === "added" ? (
<Trans i18nKey="email_team_invite|content|added_to_subteam">
{invitedBy} has added you to the team <strong>{teamName}</strong> in their organization{" "}
<strong>{parentTeamName}</strong>.
</Trans>
<ServerTrans
t={props.language}
i18nKey="email_team_invite|content|added_to_subteam"
values={{ teamName, parentTeamName: parentTeamName ?? "", invitedBy, appName: APP_NAME }}
/>
) : (
<Trans i18nKey="email_team_invite|content|invited_to_subteam">
{invitedBy} has invited you to the team <strong>{teamName}</strong> in their organization{" "}
<strong>{parentTeamName}</strong>.
</Trans>
<ServerTrans
t={props.language}
i18nKey="email_team_invite|content|invited_to_subteam"
values={{ teamName, parentTeamName: parentTeamName ?? "", invitedBy, appName: APP_NAME }}
/>
)}{" "}
<Trans>
{appName} is the event-juggling scheduler that enables you and your team to schedule meetings
without the email tennis.
</Trans>
{appName} is the event-juggling scheduler that enables you and your team to schedule meetings
without the email tennis.
</>
);
}
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { APP_NAME, SENDER_NAME, SUPPORT_MAIL_ADDRESS } from "@calcom/lib/constants";
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { APP_NAME, SENDER_NAME, SUPPORT_MAIL_ADDRESS } from "@calcom/lib/constants";
+1 -1
View File
@@ -1,5 +1,4 @@
import { decodeHTML } from "entities";
import { createTransport } from "nodemailer";
import { z } from "zod";
import dayjs from "@calcom/dayjs";
@@ -71,6 +70,7 @@ export default class BaseEmail {
},
...(parseSubject.success && { subject: decodeHTML(parseSubject.data) }),
};
const { createTransport } = await import("nodemailer");
await new Promise((resolve, reject) =>
createTransport(this.getMailerOptions().transport).sendMail(
payloadWithUnEscapedSubject,
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { APP_NAME, COMPANY_NAME, EMAIL_FROM_NAME } from "@calcom/lib/constants";
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
@@ -1,5 +1,5 @@
// TODO: We should find a way to keep App specific email templates within the App itself
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { TimeFormat } from "@calcom/lib/timeFormat";
import type { CalendarEvent, Person } from "@calcom/types/Calendar";
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { TimeFormat } from "@calcom/lib/timeFormat";
import type { CalendarEvent, Person } from "@calcom/types/Calendar";
@@ -1,6 +1,6 @@
// eslint-disable-next-line no-restricted-imports
import { cloneDeep } from "lodash";
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { getRichDescription } from "@calcom/lib/CalEventParser";
import { TimeFormat } from "@calcom/lib/timeFormat";
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { APP_NAME, COMPANY_NAME, EMAIL_FROM_NAME } from "@calcom/lib/constants";
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { getRichDescription } from "@calcom/lib/CalEventParser";
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { APP_NAME, COMPANY_NAME, EMAIL_FROM_NAME } from "@calcom/lib/constants";
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { APP_NAME, EMAIL_FROM_NAME } from "@calcom/lib/constants";
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { APP_NAME, EMAIL_FROM_NAME } from "@calcom/lib/constants";
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
import { TimeFormat } from "@calcom/lib/timeFormat";
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
import { TimeFormat } from "@calcom/lib/timeFormat";
@@ -1,6 +1,6 @@
// eslint-disable-next-line no-restricted-imports
import { cloneDeep } from "lodash";
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { getRichDescription } from "@calcom/lib/CalEventParser";
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { APP_NAME, EMAIL_FROM_NAME } from "@calcom/lib/constants";
@@ -1,4 +1,5 @@
// this file is copied from '@calcom/lib/hooks/useCompatSearchParams.tsx'
"use client";
import { ReadonlyURLSearchParams, useParams, useSearchParams } from "next/navigation";
export const useCompatSearchParams = () => {
@@ -1,11 +1,19 @@
/* eslint-disable playwright/missing-playwright-await */
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { render, screen } from "@testing-library/react";
import { vi, describe, expect } from "vitest";
import type { AppFrontendPayload } from "@calcom/types/App";
import { AppCard } from "./AppCard";
vi.mock("next/navigation", () => ({
useRouter: vi.fn().mockReturnValue({
push: vi.fn(),
}),
usePathname: vi.fn(),
}));
describe("Tests for AppCard component", () => {
const mockApp: AppFrontendPayload = {
logo: "/path/to/logo.png",
@@ -34,7 +42,7 @@ describe("Tests for AppCard component", () => {
};
describe("Tests for app description", () => {
test("Should render the app name correctly and display app logo with correct alt text", () => {
it("Should render the app name correctly and display app logo with correct alt text", () => {
renderAppCard();
const appLogo = screen.getByAltText("Test App Logo");
const appName = screen.getByText("Test App");
@@ -43,14 +51,14 @@ describe("Tests for AppCard component", () => {
expect(appName).toBeInTheDocument();
});
test("Should render details button with correct href", () => {
it("Should render details button with correct href", () => {
renderAppCard();
const detailsButton = screen.getByText("details");
expect(detailsButton).toBeInTheDocument();
expect(detailsButton.closest("a")).toHaveAttribute("href", "/apps/test-app");
});
test("Should highlight the app name based on searchText", () => {
it("Should highlight the app name based on searchText", () => {
renderAppCard({}, { searchText: "test" });
const highlightedText = screen.getByTestId("highlighted-text");
expect(highlightedText).toBeInTheDocument();
@@ -58,13 +66,13 @@ describe("Tests for AppCard component", () => {
});
describe("Tests for app categories", () => {
test("Should show 'Template' badge if app is a template", () => {
it("Should show 'Template' badge if app is a template", () => {
renderAppCard({ isTemplate: true });
const templateBadge = screen.getByText("Template");
expect(templateBadge).toBeInTheDocument();
});
test("Should show 'default' badge if app is default or global", () => {
it("Should show 'default' badge if app is default or global", () => {
renderAppCard({ isDefault: true });
const defaultBadge = screen.getByText("default");
expect(defaultBadge).toBeInTheDocument();
@@ -1,7 +1,6 @@
import type { User } from "@prisma/client";
import dayjs from "@calcom/dayjs";
import { sendPasswordResetEmail } from "@calcom/emails";
import { getTranslation } from "@calcom/lib/server/i18n";
import prisma from "@calcom/prisma";
@@ -40,6 +39,8 @@ const passwordResetRequest = async (user: Pick<User, "email" | "name" | "locale"
const t = await getTranslation(user.locale ?? "en", "common");
await guardAgainstTooManyPasswordResets(email);
const resetLink = await createPasswordReset(email);
const { sendPasswordResetEmail } = await import("@calcom/emails");
// send email in user language
await sendPasswordResetEmail({
language: t,
@@ -1,5 +1,4 @@
import type { TFunction } from "next-i18next";
import { Trans } from "next-i18next";
import type { TFunction } from "i18next";
import Link from "next/link";
import { useMemo, useState } from "react";
import type { FieldError } from "react-hook-form";
@@ -9,10 +8,11 @@ import type { BookerEvent } from "@calcom/features/bookings/types";
import { WEBSITE_PRIVACY_POLICY_URL, WEBSITE_TERMS_URL } from "@calcom/lib/constants";
import { getPaymentAppData } from "@calcom/lib/getPaymentAppData";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { Form } from "@calcom/ui/components/form";
import { Alert } from "@calcom/ui/components/alert";
import { Button } from "@calcom/ui/components/button";
import { EmptyScreen } from "@calcom/ui/components/empty-screen";
import { Form } from "@calcom/ui/components/form";
import ServerTrans from "@calcom/web/components/ServerTrans";
import { useBookerStore } from "../../store";
import type { UseBookingFormReturnType } from "../hooks/useBookingForm";
@@ -141,12 +141,19 @@ export const BookEventForm = ({
severity="info"
title={t("unavailable_timeslot_title")}
message={
<Trans i18nKey="timeslot_unavailable_book_a_new_time">
The selected time slot is no longer available.{" "}
<button type="button" className="underline" onClick={onCancel}>
Please select a new time
</button>
</Trans>
<ServerTrans
t={t}
i18nKey="timeslot_unavailable_book_a_new_time"
components={[
<button
key="please-select-a-new-time-button"
type="button"
className="underline"
onClick={onCancel}>
Please select a new time
</button>,
]}
/>
}
/>
</div>
@@ -154,7 +161,8 @@ export const BookEventForm = ({
{!isPlatform && (
<div className="text-subtle my-3 w-full text-xs">
<Trans
<ServerTrans
t={t}
i18nKey="signing_up_terms"
components={[
<Link
@@ -3,8 +3,7 @@ import { render, fireEvent, screen } from "@testing-library/react";
import * as React from "react";
import type { UseFormReturn } from "react-hook-form";
import { FormProvider, useForm } from "react-hook-form";
import { expect } from "vitest";
import { vi } from "vitest";
import { expect, vi } from "vitest";
import PhoneInput from "@calcom/features/components/phone-input/PhoneInput";
@@ -1,11 +1,11 @@
import { Trans } from "next-i18next";
import { useRouter } from "next/navigation";
import type { IOutOfOfficeData } from "@calcom/lib/getUserAvailability";
import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { Button } from "@calcom/ui/components/button";
import classNames from "@calcom/ui/classNames";
import { Button } from "@calcom/ui/components/button";
import ServerTrans from "@calcom/web/components/ServerTrans";
interface IOutOfOfficeInSlotsProps {
date: string;
@@ -42,10 +42,10 @@ export const OutOfOfficeInSlots = (props: IOutOfOfficeInSlotsProps) => {
{fromUser?.displayName && toUser?.displayName && (
<p className="text-center text-sm">
<Trans
<ServerTrans
t={t}
i18nKey="ooo_slots_returning"
values={{ displayName: toUser.displayName }}
default="<1>{{ displayName }}</1> can take their meetings while they are away."
components={[<strong key="username">username</strong>]}
/>
</p>
@@ -1,3 +1,5 @@
"use client";
import { useMutation } from "@tanstack/react-query";
import { useRouter } from "next/navigation";
import { useRef, useState, useEffect } from "react";
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { useEffect, useRef } from "react";
import { useIsPlatform } from "@calcom/atoms/hooks/useIsPlatform";
@@ -1,6 +1,6 @@
import type { App } from "@prisma/client";
import type { Prisma } from "@prisma/client";
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import type { EventTypeAppsList } from "@calcom/app-store/utils";
import type { PaymentAppData } from "@calcom/lib/getPaymentAppData";
@@ -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";
@@ -1,6 +1,5 @@
"use client";
import { Trans } from "next-i18next";
import Link from "next/link";
import { useState, useEffect, useRef, useMemo } from "react";
@@ -24,6 +23,7 @@ import {
SheetTitle,
} from "@calcom/ui/components/sheet";
import { showToast } from "@calcom/ui/components/toast";
import ServerTrans from "@calcom/web/components/ServerTrans";
type TeamMemberItemProps = {
member: Omit<TeamMember, "defaultScheduleId"> & { weight?: number };
@@ -302,15 +302,19 @@ export const EditWeightsForAllTeamMembers = ({
<SheetHeader>
<SheetTitle>{t("edit_team_member_weights")}</SheetTitle>
<div className="text-subtle text-sm">
<Trans i18nKey="weights_description">
Weights determine how meetings are distributed among hosts.
<Link
className="underline underline-offset-2"
target="_blank"
href="https://cal.com/docs/enterprise-features/teams/round-robin-scheduling#weights">
Learn more
</Link>
</Trans>
<ServerTrans
t={t}
i18nKey="weights_description"
components={[
<Link
key="weights_description"
className="underline underline-offset-2"
target="_blank"
href="https://cal.com/docs/enterprise-features/teams/round-robin-scheduling#weights">
Learn more
</Link>,
]}
/>
</div>
</SheetHeader>
@@ -1,5 +1,3 @@
import { Trans } from "next-i18next";
import Link from "next/link";
import type { Dispatch, SetStateAction } from "react";
import { useState } from "react";
import { useFormContext } from "react-hook-form";
@@ -19,6 +17,7 @@ import classNames from "@calcom/ui/classNames";
import { Dialog, DialogContent, DialogFooter, DialogClose } from "@calcom/ui/components/dialog";
import type { CheckedSelectOption } from "./CheckedTeamSelect";
import WeightDescription from "./WeightDescription";
interface IDialog {
isOpenDialog: boolean;
@@ -99,18 +98,6 @@ export const PriorityDialog = (
);
};
export const weightDescription = (
<Trans i18nKey="weights_description">
Weights determine how meetings are distributed among hosts.
<Link
className="underline underline-offset-2"
target="_blank"
href="https://cal.com/docs/enterprise-features/teams/round-robin-scheduling#weights">
Learn more
</Link>
</Trans>
);
export function sortHosts(
hostA: { priority: number | null; weight: number | null },
hostB: { priority: number | null; weight: number | null },
@@ -167,7 +154,7 @@ export const WeightDialog = (props: IDialog & { customClassNames?: WeightDialogC
return (
<Dialog open={isOpenDialog} onOpenChange={setIsOpenDialog}>
<DialogContent title={t("set_weight")} description={weightDescription}>
<DialogContent title={t("set_weight")} description={<WeightDescription t={t} />}>
<div className={classNames("mb-4 mt-2", customClassNames?.container)}>
<Label className={customClassNames?.label}>
{t("weight_for_user", { userName: option.label })}
@@ -1,6 +1,5 @@
import { useAutoAnimate } from "@formkit/auto-animate/react";
import { ErrorMessage } from "@hookform/error-message";
import { Trans } from "next-i18next";
import Link from "next/link";
import { useEffect, useState } from "react";
import { Controller, useFieldArray } from "react-hook-form";
@@ -23,11 +22,12 @@ import type {
import LocationSelect from "@calcom/features/form/components/LocationSelect";
import { WEBAPP_URL } from "@calcom/lib/constants";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { Input } 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 { Input } 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";
export type TEventTypeLocation = Pick<EventTypeSetupProps["eventType"], "locations">;
export type TLocationOptions = Pick<EventTypeSetupProps, "locationOptions">["locationOptions"];
@@ -443,14 +443,18 @@ const Locations: React.FC<LocationsProps> = ({
<Icon name="check" className="h-3 w-3" />
</div>
<p className="text-default text-sm">
<Trans i18nKey="event_type_requires_google_calendar">
The “Add to calendar” for this event type needs to be a Google Calendar for Meet to work.
Connect it
<Link className="cursor-pointer text-blue-500 underline" href="/apps/google-calendar">
here
</Link>
.
</Trans>
<ServerTrans
t={t}
i18nKey="event_type_requires_google_calendar"
components={[
<Link
key="event_type_requires_google_calendar"
className="cursor-pointer text-blue-500 underline"
href="/apps/google-calendar">
here
</Link>,
]}
/>
</p>
</div>
)}
@@ -480,13 +484,18 @@ const Locations: React.FC<LocationsProps> = ({
</ul>
{props.showAppStoreLink && !isPlatorm && (
<p className="text-default mt-2 text-sm">
<Trans i18nKey="cant_find_the_right_conferencing_app_visit_our_app_store">
Can&apos;t find the right conferencing app? Visit our
<Link className="cursor-pointer text-blue-500 underline" href="/apps/categories/conferencing">
App Store
</Link>
.
</Trans>
<ServerTrans
t={t}
i18nKey="cant_find_the_right_conferencing_app_visit_our_app_store"
components={[
<Link
key="cant_find_the_right_conferencing_app_visit_our_app_store"
className="cursor-pointer text-blue-500 underline"
href="/apps/categories/conferencing">
App Store
</Link>,
]}
/>
</p>
)}
</div>
@@ -0,0 +1,22 @@
import type { TFunction } from "i18next";
import Link from "next/link";
import ServerTrans from "@calcom/web/components/ServerTrans";
export default function WeightDescription({ t }: { t: TFunction }) {
return (
<ServerTrans
t={t}
i18nKey="weights_description"
components={[
<Link
key="weights_description"
className="underline underline-offset-2"
target="_blank"
href="https://cal.com/docs/enterprise-features/teams/round-robin-scheduling#weights">
Learn more
</Link>,
]}
/>
);
}
@@ -1,8 +1,8 @@
import { Trans } from "next-i18next";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import classNames from "@calcom/ui/classNames";
import type { DialogProps } from "@calcom/ui/components/dialog";
import { ConfirmationDialogContent, Dialog } from "@calcom/ui/components/dialog";
import ServerTrans from "@calcom/web/components/ServerTrans";
export function DeleteDialog({
isManagedEvent,
@@ -32,14 +32,14 @@ export function DeleteDialog({
onDelete(eventTypeId);
}}>
<p className="mt-5">
<Trans
i18nKey={`delete${isManagedEvent}_event_type_description`}
components={{ li: <li />, ul: <ul className="ml-4 list-disc" /> }}>
<ul>
<li>Members assigned to this event type will also have their event types deleted.</li>
<li>Anyone who they&apos;ve shared their link with will no longer be able to book using it.</li>
{isManagedEvent ? (
<ul className="ml-4 list-disc">
<li>{t("delete_managed_event_type_description_1")}</li>
<li>{t("delete_managed_event_type_description_2")}</li>
</ul>
</Trans>
) : (
t("delete_event_type_description")
)}
</p>
</ConfirmationDialogContent>
</Dialog>
@@ -1,8 +1,7 @@
import { Trans } from "next-i18next";
import type { ChildrenEventType } from "@calcom/features/eventtypes/components/ChildrenEventTypeSelect";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { ConfirmationDialogContent, Dialog } from "@calcom/ui/components/dialog";
import ServerTrans from "@calcom/web/components/ServerTrans";
interface ManagedEventDialogProps {
slugExistsChildrenDialogOpen: ChildrenEventType[];
@@ -31,8 +30,13 @@ export default function ManagedEventDialog(props: ManagedEventDialogProps) {
cancelBtnText={t("go_back")}
onConfirm={onConfirm}>
<p className="mt-5">
<Trans
i18nKey="managed_event_dialog_information"
<ServerTrans
t={t}
i18nKey={
slugExistsChildrenDialogOpen.length > 1
? "managed_event_dialog_information_other"
: "managed_event_dialog_information_one"
}
values={{
names: `${slugExistsChildrenDialogOpen
.map((ch) => ch.owner.name)
@@ -42,7 +46,6 @@ export default function ManagedEventDialog(props: ManagedEventDialogProps) {
} ${slugExistsChildrenDialogOpen.map((ch) => ch.owner.name).slice(-1)}`,
slug,
}}
count={slugExistsChildrenDialogOpen.length}
/>
</p>{" "}
<p className="mt-5">{t("managed_event_dialog_clarification")}</p>
@@ -1,13 +1,13 @@
import type { TFunction } from "next-i18next";
import { Trans } from "next-i18next";
import type { TFunction } from "i18next";
import { useState } from "react";
import type { InputClassNames, SettingsToggleClassNames } from "@calcom/features/eventtypes/lib/types";
import { InputField } 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, DialogClose } from "@calcom/ui/components/dialog";
import { InputField } from "@calcom/ui/components/form";
import { SettingsToggle } from "@calcom/ui/components/form";
import ServerTrans from "@calcom/web/components/ServerTrans";
export type EmailNotificationToggleCustomClassNames = SettingsToggleClassNames & {
confirmationDialog?: {
@@ -53,15 +53,7 @@ export const DisableAllEmailsSetting = ({
className={customClassNames?.confirmationDialog?.container}>
<p
className={classNames("text-default text-sm", customClassNames?.confirmationDialog?.description)}>
<Trans i18nKey="disable_attendees_emails_description">
This will disable all emails to {recipient}. This includes booking confirmations, requests,
reschedules and reschedule requests, cancellation emails, and any other emails related to
booking updates.
<br />
<br />
It is your responsibility to ensure that your {recipient} are aware of any bookings and changes
to their bookings.
</Trans>
<ServerTrans t={t} i18nKey="disable_attendees_emails_description" values={{ recipient }} />
</p>
<p
className={classNames(
@@ -1,6 +1,5 @@
import * as RadioGroup from "@radix-ui/react-radio-group";
import type { UnitTypeLongPlural } from "dayjs";
import { Trans } from "next-i18next";
import type { Dispatch, SetStateAction } from "react";
import { useEffect, useState } from "react";
import { Controller, useFormContext } from "react-hook-form";
@@ -17,6 +16,7 @@ import { CheckboxField } from "@calcom/ui/components/form";
import { Input } from "@calcom/ui/components/form";
import { SettingsToggle } from "@calcom/ui/components/form";
import { RadioField } from "@calcom/ui/components/radio";
import ServerTrans from "@calcom/web/components/ServerTrans";
export type RequiresConfirmationCustomClassNames = SettingsToggleClassNames & {
radioGroupContainer?: string;
@@ -163,70 +163,70 @@ export default function RequiresConfirmationController({
)}
label={
<>
<Trans
<ServerTrans
t={t}
i18nKey="when_booked_with_less_than_notice"
defaults="When booked with less than <time></time> notice"
components={{
time: (
<div className="mx-2 inline-flex items-center">
<Input
type="number"
min={1}
disabled={requiresConfirmationLockedProps.disabled}
onChange={(evt) => {
const val = Number(evt.target?.value);
components={[
<div
key="when_booked_with_less_than_notice"
className="mx-2 inline-flex items-center">
<Input
type="number"
min={1}
disabled={requiresConfirmationLockedProps.disabled}
onChange={(evt) => {
const val = Number(evt.target?.value);
setRequiresConfirmationSetup({
unit:
requiresConfirmationSetup?.unit ??
defaultRequiresConfirmationSetup.unit,
time: val,
});
formMethods.setValue(
"metadata.requiresConfirmationThreshold.time",
val,
{ shouldDirty: true }
);
}}
className={classNames(
"border-default h-9! !m-0 block w-16 rounded-r-none border-r-0 text-sm [appearance:textfield] focus:z-10 focus:border-r",
customClassNames?.conditionalConfirmationRadio?.timeInput
)}
defaultValue={metadata?.requiresConfirmationThreshold?.time || 30}
/>
<label
className={classNames(
requiresConfirmationLockedProps.disabled && "cursor-not-allowed"
)}>
<Select
inputId="notice"
options={options}
isSearchable={false}
isDisabled={requiresConfirmationLockedProps.disabled}
className={
customClassNames?.conditionalConfirmationRadio?.timeUnitSelect
}
innerClassNames={{
control: "rounded-l-none max-h-4 px-3 bg-subtle",
}}
onChange={(opt) => {
setRequiresConfirmationSetup({
unit:
requiresConfirmationSetup?.unit ??
defaultRequiresConfirmationSetup.unit,
time: val,
time:
requiresConfirmationSetup?.time ??
defaultRequiresConfirmationSetup.time,
unit: opt?.value as UnitTypeLongPlural,
});
formMethods.setValue(
"metadata.requiresConfirmationThreshold.time",
val,
"metadata.requiresConfirmationThreshold.unit",
opt?.value as UnitTypeLongPlural,
{ shouldDirty: true }
);
}}
className={classNames(
"border-default h-9! !m-0 block w-16 rounded-r-none border-r-0 text-sm [appearance:textfield] focus:z-10 focus:border-r",
customClassNames?.conditionalConfirmationRadio?.timeInput
)}
defaultValue={metadata?.requiresConfirmationThreshold?.time || 30}
defaultValue={defaultValue}
/>
<label
className={classNames(
requiresConfirmationLockedProps.disabled && "cursor-not-allowed"
)}>
<Select
inputId="notice"
options={options}
isSearchable={false}
isDisabled={requiresConfirmationLockedProps.disabled}
className={
customClassNames?.conditionalConfirmationRadio?.timeUnitSelect
}
innerClassNames={{
control: "rounded-l-none max-h-4 px-3 bg-subtle",
}}
onChange={(opt) => {
setRequiresConfirmationSetup({
time:
requiresConfirmationSetup?.time ??
defaultRequiresConfirmationSetup.time,
unit: opt?.value as UnitTypeLongPlural,
});
formMethods.setValue(
"metadata.requiresConfirmationThreshold.unit",
opt?.value as UnitTypeLongPlural,
{ shouldDirty: true }
);
}}
defaultValue={defaultValue}
/>
</label>
</div>
),
}}
</label>
</div>,
]}
/>
</>
}
@@ -1,4 +1,3 @@
import { Trans } from "next-i18next";
import Link from "next/link";
import { useFormContext } from "react-hook-form";
@@ -10,9 +9,10 @@ import type { FormValues, EventTypeSetupProps } from "@calcom/features/eventtype
import useAppsData from "@calcom/lib/hooks/useAppsData";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { trpc } from "@calcom/trpc/react";
import { EmptyScreen } from "@calcom/ui/components/empty-screen";
import { Alert } from "@calcom/ui/components/alert";
import { Button } from "@calcom/ui/components/button";
import { EmptyScreen } from "@calcom/ui/components/empty-screen";
import ServerTrans from "@calcom/web/components/ServerTrans";
export type EventType = Pick<EventTypeSetupProps, "eventType">["eventType"] &
EventTypeAppCardComponentProps["eventType"];
@@ -97,22 +97,19 @@ export const EventAppsTab = ({ eventType }: { eventType: EventType }) => {
severity={appsDisableProps.isLocked ? "neutral" : "info"}
className="mb-2"
title={
<Trans i18nKey={`${lockedText}_${isManagedEventType ? "for_members" : "by_team_admins"}`}>
{lockedText[0].toUpperCase()}
{lockedText.slice(1)} {isManagedEventType ? "for members" : "by team admins"}
</Trans>
<ServerTrans
t={t}
i18nKey={`${lockedText}_${isManagedEventType ? "for_members" : "by_team_admins"}`}
/>
}
actions={<div className="flex h-full items-center">{appsDisableProps.LockedIcon}</div>}
message={
<Trans
<ServerTrans
t={t}
i18nKey={`apps_${lockedText}_${
isManagedEventType ? "for_members" : "by_team_admins"
}_description`}>
{isManagedEventType ? "Members" : "You"}{" "}
{appsDisableProps.isLocked
? "will be able to see the active apps but will not be able to edit any app settings"
: "will be able to see the active apps and will be able to edit any app settings"}
</Trans>
}_description`}
/>
}
/>
)}
@@ -162,12 +159,15 @@ export const EventAppsTab = ({ eventType }: { eventType: EventType }) => {
{t("available_apps_lower_case")}
</h2>
<p className="text-default mb-6 text-sm font-normal">
<Trans i18nKey="available_apps_desc">
View popular apps below and explore more in our &nbsp;
<Link className="cursor-pointer underline" href="/apps">
App Store
</Link>
</Trans>
<ServerTrans
t={t}
i18nKey="available_apps_desc"
components={[
<Link key="available_apps_desc" className="cursor-pointer underline" href="/apps">
App Store
</Link>,
]}
/>
</p>
</>
) : null}
@@ -1,4 +1,4 @@
import { Trans } from "next-i18next";
import type { TFunction } from "i18next";
import Link from "next/link";
import { useEffect, useRef, useState } from "react";
import type { ComponentProps, Dispatch, SetStateAction } from "react";
@@ -12,7 +12,7 @@ import AddMembersWithSwitch, {
import AssignAllTeamMembers from "@calcom/features/eventtypes/components/AssignAllTeamMembers";
import type { ChildrenEventTypeSelectCustomClassNames } from "@calcom/features/eventtypes/components/ChildrenEventTypeSelect";
import ChildrenEventTypeSelect from "@calcom/features/eventtypes/components/ChildrenEventTypeSelect";
import { sortHosts, weightDescription } from "@calcom/features/eventtypes/components/HostEditDialogs";
import { sortHosts } from "@calcom/features/eventtypes/components/HostEditDialogs";
import type {
FormValues,
TeamMember,
@@ -28,8 +28,10 @@ import { Label } from "@calcom/ui/components/form";
import { Select } from "@calcom/ui/components/form";
import { SettingsToggle } from "@calcom/ui/components/form";
import { RadioAreaGroup as RadioArea } from "@calcom/ui/components/radio";
import ServerTrans from "@calcom/web/components/ServerTrans";
import { EditWeightsForAllTeamMembers } from "../../EditWeightsForAllTeamMembers";
import WeightDescription from "../../WeightDescription";
export type EventTeamAssignmentTabCustomClassNames = {
assignmentType?: {
@@ -114,16 +116,20 @@ const ChildrenEventTypesList = ({
);
};
const FixedHostHelper = (
<Trans i18nKey="fixed_host_helper">
Add anyone who needs to attend the event.
<Link
className="underline underline-offset-2"
target="_blank"
href="https://cal.com/docs/enterprise-features/teams/round-robin-scheduling#fixed-hosts">
Learn more
</Link>
</Trans>
const FixedHostHelper = ({ t }: { t: TFunction }) => (
<ServerTrans
t={t}
i18nKey="fixed_host_helper"
components={[
<Link
key="fixed_host_helper"
className="underline underline-offset-2"
target="_blank"
href="https://cal.com/docs/enterprise-features/teams/round-robin-scheduling#fixed-hosts">
Learn more
</Link>,
]}
/>
);
type FixedHostsCustomClassNames = SettingsToggleClassNames & {
@@ -172,7 +178,7 @@ const FixedHosts = ({
"text-subtle max-w-full break-words text-sm leading-tight",
customClassNames?.description
)}>
{FixedHostHelper}
<FixedHostHelper t={t} />
</p>
</div>
<div className="border-subtle rounded-b-md border border-t-0 px-6">
@@ -212,7 +218,7 @@ const FixedHosts = ({
data-testid="fixed-hosts-switch"
toggleSwitchAtTheEnd={true}
title={t("fixed_hosts")}
description={FixedHostHelper}
description={<FixedHostHelper t={t} />}
checked={isDisabled && !assignAllTeamMembers}
hideSwitch={assignAllTeamMembers}
labelClassName={classNames("text-sm", customClassNames?.label)}
@@ -334,7 +340,7 @@ const RoundRobinHosts = ({
render={({ field: { value: isRRWeightsEnabled, onChange } }) => (
<SettingsToggle
title={t("enable_weights")}
description={weightDescription}
description={<WeightDescription t={t} />}
checked={isRRWeightsEnabled}
switchContainerClassName={customClassNames?.enableWeights?.container}
labelClassName={customClassNames?.enableWeights?.label}
@@ -1,5 +1,4 @@
import type { Webhook } from "@prisma/client";
import { Trans } from "next-i18next";
import Link from "next/link";
import { useState } from "react";
import { useFormContext } from "react-hook-form";
@@ -13,11 +12,12 @@ import { subscriberUrlReserved } from "@calcom/features/webhooks/lib/subscriberU
import { APP_NAME } from "@calcom/lib/constants";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { trpc } from "@calcom/trpc/react";
import { showToast } from "@calcom/ui/components/toast";
import { Alert } from "@calcom/ui/components/alert";
import { Button } from "@calcom/ui/components/button";
import { Dialog, DialogContent } from "@calcom/ui/components/dialog";
import { EmptyScreen } from "@calcom/ui/components/empty-screen";
import { showToast } from "@calcom/ui/components/toast";
import ServerTrans from "@calcom/web/components/ServerTrans";
export const EventWebhooksTab = ({ eventType }: Pick<EventTypeSetupProps, "eventType">) => {
const { t } = useLocale();
@@ -122,25 +122,21 @@ export const EventWebhooksTab = ({ eventType }: Pick<EventTypeSetupProps, "event
severity={webhooksDisableProps.isLocked ? "neutral" : "info"}
className="mb-2"
title={
<Trans
i18nKey={`${lockedText}_${isManagedEventType ? "for_members" : "by_team_admins"}`}>
{lockedText[0].toUpperCase()}
{lockedText.slice(1)} {isManagedEventType ? "for members" : "by team admins"}
</Trans>
<ServerTrans
t={t}
i18nKey={`${lockedText}_${isManagedEventType ? "for_members" : "by_team_admins"}`}
/>
}
actions={
<div className="flex h-full items-center">{webhooksDisableProps.LockedIcon}</div>
}
message={
<Trans
<ServerTrans
t={t}
i18nKey={`webhooks_${lockedText}_${
isManagedEventType ? "for_members" : "by_team_admins"
}_description`}>
{isManagedEventType ? "Members" : "You"}{" "}
{webhooksDisableProps.isLocked
? "will be able to see the active webhooks but will not be able to edit any webhook settings"
: "will be able to see the active webhooks and will be able to edit any webhook settings"}
</Trans>
}_description`}
/>
}
/>
)}
@@ -181,14 +177,18 @@ export const EventWebhooksTab = ({ eventType }: Pick<EventTypeSetupProps, "event
</div>
<p className="text-default text-sm font-normal">
<Trans i18nKey="edit_or_manage_webhooks">
If you wish to edit or manage your web hooks, please head over to &nbsp;
<Link
className="cursor-pointer font-semibold underline"
href="/settings/developer/webhooks">
webhooks settings
</Link>
</Trans>
<ServerTrans
t={t}
i18nKey="edit_or_manage_webhooks"
components={[
<Link
key="edit_or_manage_webhooks"
className="cursor-pointer font-semibold underline"
href="/settings/developer/webhooks">
webhooks settings
</Link>,
]}
/>
</p>
</div>
</>
@@ -2,7 +2,6 @@ import Link from "next/link";
import { useRouter } from "next/navigation";
import { useEffect, useState } from "react";
import { useFormContext } from "react-hook-form";
import { Trans } from "react-i18next";
import LicenseRequired from "@calcom/features/ee/common/components/LicenseRequired";
import useLockedFieldsManager from "@calcom/features/ee/managed-event-types/hooks/useLockedFieldsManager";
@@ -15,14 +14,15 @@ import { HttpError } from "@calcom/lib/http-error";
import { WorkflowActions } from "@calcom/prisma/enums";
import type { RouterOutputs } from "@calcom/trpc/react";
import { trpc } from "@calcom/trpc/react";
import { Icon } from "@calcom/ui/components/icon";
import { Tooltip } from "@calcom/ui/components/tooltip";
import classNames from "@calcom/ui/classNames";
import { Alert } from "@calcom/ui/components/alert";
import { Button } from "@calcom/ui/components/button";
import classNames from "@calcom/ui/classNames";
import { EmptyScreen } from "@calcom/ui/components/empty-screen";
import { Switch } from "@calcom/ui/components/form";
import { Icon } from "@calcom/ui/components/icon";
import { showToast } from "@calcom/ui/components/toast";
import { Tooltip } from "@calcom/ui/components/tooltip";
import ServerTrans from "@calcom/web/components/ServerTrans";
type PartialWorkflowType = Pick<WorkflowType, "name" | "activeOn" | "isOrg" | "steps" | "id" | "readOnly">;
@@ -252,22 +252,19 @@ function EventWorkflowsTab(props: Props) {
severity={workflowsDisableProps.isLocked ? "neutral" : "info"}
className="mb-2"
title={
<Trans i18nKey={`${lockedText}_${isManagedEventType ? "for_members" : "by_team_admins"}`}>
{lockedText[0].toUpperCase()}
{lockedText.slice(1)} {isManagedEventType ? "for members" : "by team admins"}
</Trans>
<ServerTrans
t={t}
i18nKey={`${lockedText}_${isManagedEventType ? "for_members" : "by_team_admins"}`}
/>
}
actions={<div className="flex h-full items-center">{workflowsDisableProps.LockedIcon}</div>}
message={
<Trans
<ServerTrans
t={t}
i18nKey={`workflows_${lockedText}_${
isManagedEventType ? "for_members" : "by_team_admins"
}_description`}>
{isManagedEventType ? "Members" : "You"}{" "}
{workflowsDisableProps.isLocked
? "will be able to see the active workflows but will not be able to edit any workflow settings"
: "will be able to see the active workflow and will be able to edit any workflow settings"}
</Trans>
}_description`}
/>
}
/>
)}
@@ -1,5 +1,5 @@
import { ErrorMessage } from "@hookform/error-message";
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { Controller, useFormContext } from "react-hook-form";
import type { z } from "zod";
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { useQueryState } from "nuqs";
import { type ReactNode, useMemo, useRef, useState } from "react";
@@ -1,5 +1,4 @@
import * as RadioGroup from "@radix-ui/react-radio-group";
import { Trans } from "next-i18next";
import Link from "next/link";
import { useCallback, useState } from "react";
import { Controller, useFormContext } from "react-hook-form";
@@ -8,10 +7,11 @@ import { useLocale } from "@calcom/lib/hooks/useLocale";
import { BookerLayouts, defaultBookerLayoutSettings } from "@calcom/prisma/zod-utils";
import { bookerLayoutOptions, type BookerLayoutSettings } from "@calcom/prisma/zod-utils";
import type { RouterOutputs } from "@calcom/trpc/react";
import { Label } 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 { Label } from "@calcom/ui/components/form";
import { CheckboxField } from "@calcom/ui/components/form";
import ServerTrans from "@calcom/web/components/ServerTrans";
import SectionBottomActions from "./SectionBottomActions";
@@ -229,20 +229,26 @@ const BookerLayoutFields = ({
</div>
{disableFields && (
<p className="text-sm">
<Trans i18nKey="bookerlayout_override_global_settings">
You can manage this for all your event types in Settings {"-> "}
<Link target="_blank" href="/settings/my-account/appearance" className="underline">
Appearance
</Link>{" "}
or{" "}
<Button
onClick={onOverrideSettings}
color="minimal"
className="h-fit p-0 font-normal underline hover:bg-transparent focus-visible:bg-transparent">
Override
</Button>{" "}
for this event only.
</Trans>
<ServerTrans
t={t}
i18nKey="bookerlayout_override_global_settings"
components={[
<Link
key="appearance-link"
target="_blank"
href="/settings/my-account/appearance"
className="underline">
Appearance
</Link>,
<Button
key="override-button"
onClick={onOverrideSettings}
color="minimal"
className="h-fit p-0 font-normal underline hover:bg-transparent focus-visible:bg-transparent">
Override
</Button>,
]}
/>
</p>
)}
</div>
@@ -7,7 +7,6 @@ import {
getFilteredRowModel,
useReactTable,
} from "@tanstack/react-table";
import { Trans } from "next-i18next";
import { useEffect, useMemo, useRef, useState } from "react";
import { useFormState } from "react-hook-form";
@@ -25,13 +24,14 @@ import { getUserAvatarUrl } from "@calcom/lib/getAvatarUrl";
import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { trpc } from "@calcom/trpc/react";
import { Icon } from "@calcom/ui/components/icon";
import { SkeletonText } from "@calcom/ui/components/skeleton";
import { Tooltip } from "@calcom/ui/components/tooltip";
import { Avatar } from "@calcom/ui/components/avatar";
import { Button } from "@calcom/ui/components/button";
import { EmptyScreen } from "@calcom/ui/components/empty-screen";
import { Icon } from "@calcom/ui/components/icon";
import { SkeletonText } from "@calcom/ui/components/skeleton";
import { showToast } from "@calcom/ui/components/toast";
import { Tooltip } from "@calcom/ui/components/tooltip";
import ServerTrans from "@calcom/web/components/ServerTrans";
import CreateNewOutOfOfficeEntryButton from "./CreateNewOutOfOfficeEntryButton";
import { CreateOrEditOutOfOfficeEntryModal } from "./CreateOrEditOutOfOfficeModal";
@@ -197,14 +197,13 @@ function OutOfOfficeEntriesListContent() {
</p>
<p className="px-2">
{item.toUser?.username ? (
<Trans
<ServerTrans
t={t}
i18nKey="ooo_forwarding_to"
values={{
username: item.toUser?.username,
}}
components={{
span: <span className="text-subtle font-bold" />,
}}
components={[<span key="ooo-username" className="text-subtle font-bold" />]}
/>
) : (
<>{t("ooo_not_forwarding")}</>
+1 -1
View File
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import { describe, expect, it } from "vitest";
import type { CalendarEvent } from "@calcom/types/Calendar";
+1 -1
View File
@@ -1,4 +1,4 @@
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
import short from "short-uuid";
import { v5 as uuidv5 } from "uuid";
Loaded 100 of 263 files, more files were not shown because too many files have changed in this diff. Show more