perf: Remove circular dependencies - wip (#24586)
* wip * refactor(emails): remove circular dependencies from packages/emails - Extract renderEmail imports to use direct path (../src/renderEmail) instead of index - Create utility files for shared types and functions: - lib/utils/team-invite-utils.ts: TeamInvite type and utility functions - lib/utils/booking-redirect-types.ts: IBookingRedirect type - lib/utils/email-types.ts: OrganizationCreation and EmailVerifyCode types - lib/utils/date-formatting.ts: getFormattedDate utility function - Update all template files to import renderEmail directly from ../src/renderEmail - Update React template components to import from utility files instead of class templates - This eliminates all circular dependencies within packages/emails (reduced from 234 to 0 internal circular deps) Co-Authored-By: Volnei Munhoz <[email protected]> * refactor(trpc): remove circular dependency in routing-forms - Extract ZFormByResponseIdInputSchema to separate schema file - Create getResponseWithFormFields.schema.ts to break circular dependency - Update imports in _router.ts and getResponseWithFormFields.handler.ts - Fix eslint warnings by updating deprecated rule names - This eliminates the circular dependency within packages/trpc (reduced from 1 to 0 internal circular deps) Co-Authored-By: Volnei Munhoz <[email protected]> * fix(emails): correct TeamInvite type definition - Make isExistingUserMovedToOrg required (not optional) - Make prevLink and newLink non-optional (string | null) - Add back JSDoc comment for isAutoJoin field - This fixes type check errors in CI Co-Authored-By: Volnei Munhoz <[email protected]> * wip * Fixes types folder --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
6aa21aceb8
commit
d82f87aa2a
56 files changed
+190
-155
No files matched your search
@@ -0,0 +1,12 @@
|
|||||||
|
import type { TFunction } from "i18next";
|
||||||
|
|
||||||
|
export interface IBookingRedirect {
|
||||||
|
language: TFunction;
|
||||||
|
fromEmail: string;
|
||||||
|
eventOwner: string;
|
||||||
|
toEmail: string;
|
||||||
|
toName: string;
|
||||||
|
oldDates?: string;
|
||||||
|
dates: string;
|
||||||
|
action: "add" | "update" | "cancel";
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import type { TFunction } from "i18next";
|
||||||
|
|
||||||
|
export type OrganizationCreation = {
|
||||||
|
language: TFunction;
|
||||||
|
from: string;
|
||||||
|
to: string;
|
||||||
|
ownerNewUsername: string;
|
||||||
|
ownerOldUsername: string | null;
|
||||||
|
orgDomain: string;
|
||||||
|
orgName: string;
|
||||||
|
prevLink: string | null;
|
||||||
|
newLink: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type EmailVerifyCode = {
|
||||||
|
language: TFunction;
|
||||||
|
user: {
|
||||||
|
name?: string | null;
|
||||||
|
email: string;
|
||||||
|
};
|
||||||
|
verificationEmailCode: string;
|
||||||
|
isVerifyingEmail?: boolean;
|
||||||
|
};
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import dayjs from "@calcom/dayjs";
|
||||||
|
import { TimeFormat } from "@calcom/lib/timeFormat";
|
||||||
|
import type { CalendarEvent, Person } from "@calcom/types/Calendar";
|
||||||
|
|
||||||
|
export function getFormattedDate(calEvent: CalendarEvent, attendee: Person): string {
|
||||||
|
const inviteeTimeFormat = calEvent.organizer.timeFormat || TimeFormat.TWELVE_HOUR;
|
||||||
|
const timezone = attendee.timeZone;
|
||||||
|
const locale = attendee.language.locale;
|
||||||
|
const t = attendee.language.translate;
|
||||||
|
|
||||||
|
const getFormattedRecipientTime = (time: string, format: string) => {
|
||||||
|
return dayjs(time).tz(timezone).locale(locale).format(format);
|
||||||
|
};
|
||||||
|
|
||||||
|
const getInviteeStart = (format: string) => {
|
||||||
|
return getFormattedRecipientTime(calEvent.startTime, format);
|
||||||
|
};
|
||||||
|
|
||||||
|
const getInviteeEnd = (format: string) => {
|
||||||
|
return getFormattedRecipientTime(calEvent.endTime, format);
|
||||||
|
};
|
||||||
|
|
||||||
|
return `${getInviteeStart(inviteeTimeFormat)} - ${getInviteeEnd(inviteeTimeFormat)}, ${t(
|
||||||
|
getInviteeStart("dddd").toLowerCase()
|
||||||
|
)}, ${t(getInviteeStart("MMMM").toLowerCase())} ${getInviteeStart("D, YYYY")}`;
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
import type { TFunction } from "i18next";
|
||||||
|
|
||||||
|
import { APP_NAME } from "@calcom/lib/constants";
|
||||||
|
|
||||||
|
export type TeamInvite = {
|
||||||
|
language: TFunction;
|
||||||
|
from: string;
|
||||||
|
to: string;
|
||||||
|
teamName: string;
|
||||||
|
joinLink: string;
|
||||||
|
isCalcomMember: boolean;
|
||||||
|
/**
|
||||||
|
* We ideally should have a separate email for auto-join(when a user is automatically accepted into a team/org), but we don't have one yet.
|
||||||
|
*/
|
||||||
|
isAutoJoin: boolean;
|
||||||
|
isOrg: boolean;
|
||||||
|
parentTeamName: string | undefined;
|
||||||
|
isExistingUserMovedToOrg: boolean;
|
||||||
|
prevLink: string | null;
|
||||||
|
newLink: string | null;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function getTypeOfInvite(teamInviteEvent: TeamInvite) {
|
||||||
|
if (teamInviteEvent.isOrg) {
|
||||||
|
return "TO_ORG";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (teamInviteEvent.parentTeamName) {
|
||||||
|
return "TO_SUBTEAM";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (teamInviteEvent.isAutoJoin) {
|
||||||
|
throw new Error("Auto-join is not supported for regular teams");
|
||||||
|
}
|
||||||
|
|
||||||
|
return "TO_REGULAR_TEAM";
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getSubject = (teamInviteEvent: TeamInvite) => {
|
||||||
|
const typeOfInvite = getTypeOfInvite(teamInviteEvent);
|
||||||
|
const type = teamInviteEvent.isAutoJoin ? "added" : "invited";
|
||||||
|
const variables = {
|
||||||
|
user: teamInviteEvent.from,
|
||||||
|
team: teamInviteEvent.teamName,
|
||||||
|
appName: APP_NAME,
|
||||||
|
parentTeamName: teamInviteEvent.parentTeamName,
|
||||||
|
entity: teamInviteEvent.language(teamInviteEvent.isOrg ? "organization" : "team").toLowerCase(),
|
||||||
|
};
|
||||||
|
|
||||||
|
if (typeOfInvite === "TO_ORG") {
|
||||||
|
return teamInviteEvent.language(`email_team_invite|subject|${type}_to_org`, variables);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeOfInvite === "TO_SUBTEAM") {
|
||||||
|
return teamInviteEvent.language(`email_team_invite|subject|${type}_to_subteam`, variables);
|
||||||
|
}
|
||||||
|
|
||||||
|
return teamInviteEvent.language(`email_team_invite|subject|${type}_to_regular_team`, variables);
|
||||||
|
};
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
import AttendeeScheduledEmailClass from "../../templates/attendee-rescheduled-email";
|
import { getFormattedDate } from "../../lib/utils/date-formatting";
|
||||||
import { AttendeeScheduledEmail } from "./AttendeeScheduledEmail";
|
import { AttendeeScheduledEmail } from "./AttendeeScheduledEmail";
|
||||||
|
|
||||||
export const AttendeeRequestEmail = (props: React.ComponentProps<typeof AttendeeScheduledEmail>) => {
|
export const AttendeeRequestEmail = (props: React.ComponentProps<typeof AttendeeScheduledEmail>) => {
|
||||||
const date = new AttendeeScheduledEmailClass(props.calEvent, props.attendee).getFormattedDate();
|
const date = getFormattedDate(props.calEvent, props.attendee);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AttendeeScheduledEmail
|
<AttendeeScheduledEmail
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { IBookingRedirect } from "../../templates/booking-redirect-notification";
|
import type { IBookingRedirect } from "../../lib/types/booking-redirect-types";
|
||||||
import { BaseEmailHtml } from "../components";
|
import { BaseEmailHtml } from "../components";
|
||||||
|
|
||||||
export const BookingRedirectEmailNotification = (
|
export const BookingRedirectEmailNotification = (
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import ServerTrans from "@calcom/lib/components/ServerTrans";
|
import ServerTrans from "@calcom/lib/components/ServerTrans";
|
||||||
import { APP_NAME, WEBAPP_URL } from "@calcom/lib/constants";
|
import { APP_NAME, WEBAPP_URL } from "@calcom/lib/constants";
|
||||||
|
|
||||||
import type { OrganizationCreation } from "../../templates/organization-creation-email";
|
import type { OrganizationCreation } from "../../lib/types/email-types";
|
||||||
import { V2BaseEmailHtml } from "../components";
|
import { V2BaseEmailHtml } from "../components";
|
||||||
|
|
||||||
export const OrganizationCreationEmail = (
|
export const OrganizationCreationEmail = (
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import type { TFunction } from "i18next";
|
|||||||
import ServerTrans from "@calcom/lib/components/ServerTrans";
|
import ServerTrans from "@calcom/lib/components/ServerTrans";
|
||||||
import { APP_NAME, WEBAPP_URL, IS_PRODUCTION } from "@calcom/lib/constants";
|
import { APP_NAME, WEBAPP_URL, IS_PRODUCTION } from "@calcom/lib/constants";
|
||||||
|
|
||||||
import { getSubject, getTypeOfInvite } from "../../templates/team-invite-email";
|
import { getSubject, getTypeOfInvite } from "../../lib/utils/team-invite-utils";
|
||||||
import { V2BaseEmailHtml, CallToAction } from "../components";
|
import { V2BaseEmailHtml, CallToAction } from "../components";
|
||||||
|
|
||||||
type TeamInvite = {
|
type TeamInvite = {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { APP_NAME, SENDER_NAME, SUPPORT_MAIL_ADDRESS } from "@calcom/lib/constants";
|
import { APP_NAME, SENDER_NAME, SUPPORT_MAIL_ADDRESS } from "@calcom/lib/constants";
|
||||||
|
|
||||||
import type { EmailVerifyCode } from "../../templates/attendee-verify-email";
|
import type { EmailVerifyCode } from "../../lib/types/email-types";
|
||||||
import { BaseEmailHtml } from "../components";
|
import { BaseEmailHtml } from "../components";
|
||||||
|
|
||||||
export const VerifyEmailByCode = (
|
export const VerifyEmailByCode = (
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import type { TFunction } from "i18next";
|
|||||||
|
|
||||||
import { APP_NAME, COMPANY_NAME, EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
import { APP_NAME, COMPANY_NAME, EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
||||||
|
|
||||||
import { renderEmail } from "../";
|
import renderEmail from "../src/renderEmail";
|
||||||
import BaseEmail from "./_base-email";
|
import BaseEmail from "./_base-email";
|
||||||
|
|
||||||
export type EmailVerifyLink = {
|
export type EmailVerifyLink = {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import type { TFunction } from "i18next";
|
|||||||
|
|
||||||
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
||||||
|
|
||||||
import { renderEmail } from "../";
|
import renderEmail from "../src/renderEmail";
|
||||||
import BaseEmail from "./_base-email";
|
import BaseEmail from "./_base-email";
|
||||||
|
|
||||||
export type OrganizationNotification = {
|
export type OrganizationNotification = {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { getReplyToHeader } from "@calcom/lib/getReplyToHeader";
|
import { getReplyToHeader } from "@calcom/lib/getReplyToHeader";
|
||||||
|
|
||||||
import { renderEmail } from "../";
|
|
||||||
import generateIcsFile, { GenerateIcsRole } from "../lib/generateIcsFile";
|
import generateIcsFile, { GenerateIcsRole } from "../lib/generateIcsFile";
|
||||||
|
import renderEmail from "../src/renderEmail";
|
||||||
import AttendeeScheduledEmail from "./attendee-scheduled-email";
|
import AttendeeScheduledEmail from "./attendee-scheduled-email";
|
||||||
|
|
||||||
export default class AttendeeAddGuestsEmail extends AttendeeScheduledEmail {
|
export default class AttendeeAddGuestsEmail extends AttendeeScheduledEmail {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { getReplyToHeader } from "@calcom/lib/getReplyToHeader";
|
import { getReplyToHeader } from "@calcom/lib/getReplyToHeader";
|
||||||
|
|
||||||
import { renderEmail } from "../";
|
import renderEmail from "../src/renderEmail";
|
||||||
import AttendeeScheduledEmail from "./attendee-scheduled-email";
|
import AttendeeScheduledEmail from "./attendee-scheduled-email";
|
||||||
|
|
||||||
export default class AttendeeAwaitingPaymentEmail extends AttendeeScheduledEmail {
|
export default class AttendeeAwaitingPaymentEmail extends AttendeeScheduledEmail {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { getReplyToHeader } from "@calcom/lib/getReplyToHeader";
|
import { getReplyToHeader } from "@calcom/lib/getReplyToHeader";
|
||||||
import type { CalendarEvent, Person } from "@calcom/types/Calendar";
|
import type { CalendarEvent, Person } from "@calcom/types/Calendar";
|
||||||
|
|
||||||
import { renderEmail } from "../";
|
|
||||||
import generateIcsFile, { GenerateIcsRole } from "../lib/generateIcsFile";
|
import generateIcsFile, { GenerateIcsRole } from "../lib/generateIcsFile";
|
||||||
|
import renderEmail from "../src/renderEmail";
|
||||||
import AttendeeScheduledEmail from "./attendee-scheduled-email";
|
import AttendeeScheduledEmail from "./attendee-scheduled-email";
|
||||||
|
|
||||||
export default class AttendeeCancelledEmail extends AttendeeScheduledEmail {
|
export default class AttendeeCancelledEmail extends AttendeeScheduledEmail {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { getReplyToHeader } from "@calcom/lib/getReplyToHeader";
|
import { getReplyToHeader } from "@calcom/lib/getReplyToHeader";
|
||||||
|
|
||||||
import { renderEmail } from "../";
|
import renderEmail from "../src/renderEmail";
|
||||||
import AttendeeScheduledEmail from "./attendee-scheduled-email";
|
import AttendeeScheduledEmail from "./attendee-scheduled-email";
|
||||||
|
|
||||||
export default class AttendeeCancelledSeatEmail extends AttendeeScheduledEmail {
|
export default class AttendeeCancelledSeatEmail extends AttendeeScheduledEmail {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { getReplyToHeader } from "@calcom/lib/getReplyToHeader";
|
|||||||
import { TimeFormat } from "@calcom/lib/timeFormat";
|
import { TimeFormat } from "@calcom/lib/timeFormat";
|
||||||
import type { CalendarEvent, Person } from "@calcom/types/Calendar";
|
import type { CalendarEvent, Person } from "@calcom/types/Calendar";
|
||||||
|
|
||||||
import { renderEmail } from "../";
|
import renderEmail from "../src/renderEmail";
|
||||||
import BaseEmail from "./_base-email";
|
import BaseEmail from "./_base-email";
|
||||||
|
|
||||||
export default class AttendeeDailyVideoDownloadRecordingEmail extends BaseEmail {
|
export default class AttendeeDailyVideoDownloadRecordingEmail extends BaseEmail {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { getReplyToHeader } from "@calcom/lib/getReplyToHeader";
|
|||||||
import { TimeFormat } from "@calcom/lib/timeFormat";
|
import { TimeFormat } from "@calcom/lib/timeFormat";
|
||||||
import type { CalendarEvent, Person } from "@calcom/types/Calendar";
|
import type { CalendarEvent, Person } from "@calcom/types/Calendar";
|
||||||
|
|
||||||
import { renderEmail } from "../";
|
import renderEmail from "../src/renderEmail";
|
||||||
import BaseEmail from "./_base-email";
|
import BaseEmail from "./_base-email";
|
||||||
|
|
||||||
export default class AttendeeDailyVideoDownloadTranscriptEmail extends BaseEmail {
|
export default class AttendeeDailyVideoDownloadTranscriptEmail extends BaseEmail {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { getReplyToHeader } from "@calcom/lib/getReplyToHeader";
|
import { getReplyToHeader } from "@calcom/lib/getReplyToHeader";
|
||||||
import type { CalendarEvent, Person } from "@calcom/types/Calendar";
|
import type { CalendarEvent, Person } from "@calcom/types/Calendar";
|
||||||
|
|
||||||
import { renderEmail } from "../";
|
import renderEmail from "../src/renderEmail";
|
||||||
import AttendeeScheduledEmail from "./attendee-scheduled-email";
|
import AttendeeScheduledEmail from "./attendee-scheduled-email";
|
||||||
|
|
||||||
export default class AttendeeDeclinedEmail extends AttendeeScheduledEmail {
|
export default class AttendeeDeclinedEmail extends AttendeeScheduledEmail {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { getReplyToHeader } from "@calcom/lib/getReplyToHeader";
|
import { getReplyToHeader } from "@calcom/lib/getReplyToHeader";
|
||||||
|
|
||||||
import { renderEmail } from "../";
|
|
||||||
import generateIcsFile, { GenerateIcsRole } from "../lib/generateIcsFile";
|
import generateIcsFile, { GenerateIcsRole } from "../lib/generateIcsFile";
|
||||||
|
import renderEmail from "../src/renderEmail";
|
||||||
import AttendeeScheduledEmail from "./attendee-scheduled-email";
|
import AttendeeScheduledEmail from "./attendee-scheduled-email";
|
||||||
|
|
||||||
export default class AttendeeLocationChangeEmail extends AttendeeScheduledEmail {
|
export default class AttendeeLocationChangeEmail extends AttendeeScheduledEmail {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
|||||||
import { getReplyToHeader } from "@calcom/lib/getReplyToHeader";
|
import { getReplyToHeader } from "@calcom/lib/getReplyToHeader";
|
||||||
import type { CalendarEvent, Person } from "@calcom/types/Calendar";
|
import type { CalendarEvent, Person } from "@calcom/types/Calendar";
|
||||||
|
|
||||||
import { renderEmail } from "../";
|
import renderEmail from "../src/renderEmail";
|
||||||
import AttendeeScheduledEmail from "./attendee-scheduled-email";
|
import AttendeeScheduledEmail from "./attendee-scheduled-email";
|
||||||
|
|
||||||
export default class AttendeeRequestEmail extends AttendeeScheduledEmail {
|
export default class AttendeeRequestEmail extends AttendeeScheduledEmail {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { getReplyToHeader } from "@calcom/lib/getReplyToHeader";
|
import { getReplyToHeader } from "@calcom/lib/getReplyToHeader";
|
||||||
import type { CalendarEvent, Person } from "@calcom/types/Calendar";
|
import type { CalendarEvent, Person } from "@calcom/types/Calendar";
|
||||||
|
|
||||||
import { renderEmail } from "../";
|
|
||||||
import generateIcsFile, { GenerateIcsRole } from "../lib/generateIcsFile";
|
import generateIcsFile, { GenerateIcsRole } from "../lib/generateIcsFile";
|
||||||
|
import renderEmail from "../src/renderEmail";
|
||||||
import AttendeeScheduledEmail from "./attendee-scheduled-email";
|
import AttendeeScheduledEmail from "./attendee-scheduled-email";
|
||||||
|
|
||||||
export default class AttendeeRescheduledEmail extends AttendeeScheduledEmail {
|
export default class AttendeeRescheduledEmail extends AttendeeScheduledEmail {
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import { getReplyToHeader } from "@calcom/lib/getReplyToHeader";
|
|||||||
import { TimeFormat } from "@calcom/lib/timeFormat";
|
import { TimeFormat } from "@calcom/lib/timeFormat";
|
||||||
import type { CalendarEvent, Person } from "@calcom/types/Calendar";
|
import type { CalendarEvent, Person } from "@calcom/types/Calendar";
|
||||||
|
|
||||||
import { renderEmail } from "../";
|
|
||||||
import generateIcsFile, { GenerateIcsRole } from "../lib/generateIcsFile";
|
import generateIcsFile, { GenerateIcsRole } from "../lib/generateIcsFile";
|
||||||
|
import renderEmail from "../src/renderEmail";
|
||||||
import BaseEmail from "./_base-email";
|
import BaseEmail from "./_base-email";
|
||||||
|
|
||||||
export default class AttendeeScheduledEmail extends BaseEmail {
|
export default class AttendeeScheduledEmail extends BaseEmail {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { getReplyToHeader } from "@calcom/lib/getReplyToHeader";
|
import { getReplyToHeader } from "@calcom/lib/getReplyToHeader";
|
||||||
import type { CalendarEvent, Person } from "@calcom/types/Calendar";
|
import type { CalendarEvent, Person } from "@calcom/types/Calendar";
|
||||||
|
|
||||||
import { renderEmail } from "../";
|
|
||||||
import generateIcsFile, { GenerateIcsRole } from "../lib/generateIcsFile";
|
import generateIcsFile, { GenerateIcsRole } from "../lib/generateIcsFile";
|
||||||
|
import renderEmail from "../src/renderEmail";
|
||||||
import AttendeeScheduledEmail from "./attendee-scheduled-email";
|
import AttendeeScheduledEmail from "./attendee-scheduled-email";
|
||||||
|
|
||||||
export default class AttendeeUpdatedEmail extends AttendeeScheduledEmail {
|
export default class AttendeeUpdatedEmail extends AttendeeScheduledEmail {
|
||||||
|
|||||||
@@ -1,19 +1,10 @@
|
|||||||
import type { TFunction } from "i18next";
|
|
||||||
|
|
||||||
import { APP_NAME, COMPANY_NAME, EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
import { APP_NAME, COMPANY_NAME, EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
||||||
|
|
||||||
import { renderEmail } from "../";
|
import type { EmailVerifyCode } from "../lib/types/email-types";
|
||||||
|
import renderEmail from "../src/renderEmail";
|
||||||
import BaseEmail from "./_base-email";
|
import BaseEmail from "./_base-email";
|
||||||
|
|
||||||
export type EmailVerifyCode = {
|
export type { EmailVerifyCode } from "../lib/types/email-types";
|
||||||
language: TFunction;
|
|
||||||
user: {
|
|
||||||
name?: string | null;
|
|
||||||
email: string;
|
|
||||||
};
|
|
||||||
verificationEmailCode: string;
|
|
||||||
isVerifyingEmail?: boolean;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default class AttendeeVerifyEmail extends BaseEmail {
|
export default class AttendeeVerifyEmail extends BaseEmail {
|
||||||
verifyAccountInput: EmailVerifyCode;
|
verifyAccountInput: EmailVerifyCode;
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import { getManageLink } from "@calcom/lib/CalEventParser";
|
|||||||
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
||||||
import type { CalendarEvent } from "@calcom/types/Calendar";
|
import type { CalendarEvent } from "@calcom/types/Calendar";
|
||||||
|
|
||||||
import { renderEmail } from "..";
|
|
||||||
import generateIcsFile, { GenerateIcsRole } from "../lib/generateIcsFile";
|
import generateIcsFile, { GenerateIcsRole } from "../lib/generateIcsFile";
|
||||||
|
import renderEmail from "../src/renderEmail";
|
||||||
import OrganizerScheduledEmail from "./organizer-scheduled-email";
|
import OrganizerScheduledEmail from "./organizer-scheduled-email";
|
||||||
|
|
||||||
export default class AttendeeWasRequestedToRescheduleEmail extends OrganizerScheduledEmail {
|
export default class AttendeeWasRequestedToRescheduleEmail extends OrganizerScheduledEmail {
|
||||||
|
|||||||
@@ -1,20 +1,10 @@
|
|||||||
import type { TFunction } from "i18next";
|
|
||||||
|
|
||||||
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
||||||
|
|
||||||
import { renderEmail } from "..";
|
import type { IBookingRedirect } from "../lib/types/booking-redirect-types";
|
||||||
|
import renderEmail from "../src/renderEmail";
|
||||||
import BaseEmail from "./_base-email";
|
import BaseEmail from "./_base-email";
|
||||||
|
|
||||||
export interface IBookingRedirect {
|
export type { IBookingRedirect } from "../lib/types/booking-redirect-types";
|
||||||
language: TFunction;
|
|
||||||
fromEmail: string;
|
|
||||||
eventOwner: string;
|
|
||||||
toEmail: string;
|
|
||||||
toName: string;
|
|
||||||
oldDates?: string;
|
|
||||||
dates: string;
|
|
||||||
action: "add" | "update" | "cancel";
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class BookingRedirectNotification extends BaseEmail {
|
export default class BookingRedirectNotification extends BaseEmail {
|
||||||
bookingRedirect: IBookingRedirect;
|
bookingRedirect: IBookingRedirect;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
|||||||
import { TimeFormat } from "@calcom/lib/timeFormat";
|
import { TimeFormat } from "@calcom/lib/timeFormat";
|
||||||
import type { CalendarEvent } from "@calcom/types/Calendar";
|
import type { CalendarEvent } from "@calcom/types/Calendar";
|
||||||
|
|
||||||
import { renderEmail } from "..";
|
import renderEmail from "../src/renderEmail";
|
||||||
import BaseEmail from "./_base-email";
|
import BaseEmail from "./_base-email";
|
||||||
|
|
||||||
export default class BrokenIntegrationEmail extends BaseEmail {
|
export default class BrokenIntegrationEmail extends BaseEmail {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import type { TFunction } from "i18next";
|
|||||||
|
|
||||||
import { APP_NAME, COMPANY_NAME, EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
import { APP_NAME, COMPANY_NAME, EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
||||||
|
|
||||||
import { renderEmail } from "../";
|
import renderEmail from "../src/renderEmail";
|
||||||
import BaseEmail from "./_base-email";
|
import BaseEmail from "./_base-email";
|
||||||
|
|
||||||
export type ChangeOfEmailVerifyLink = {
|
export type ChangeOfEmailVerifyLink = {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import type { TFunction } from "i18next";
|
|||||||
|
|
||||||
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
||||||
|
|
||||||
import { renderEmail } from "..";
|
import renderEmail from "../src/renderEmail";
|
||||||
import BaseEmail from "./_base-email";
|
import BaseEmail from "./_base-email";
|
||||||
|
|
||||||
export default class CreditBalanceLimitReachedEmail extends BaseEmail {
|
export default class CreditBalanceLimitReachedEmail extends BaseEmail {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import type { TFunction } from "i18next";
|
|||||||
|
|
||||||
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
||||||
|
|
||||||
import { renderEmail } from "..";
|
import renderEmail from "../src/renderEmail";
|
||||||
import BaseEmail from "./_base-email";
|
import BaseEmail from "./_base-email";
|
||||||
|
|
||||||
export default class CreditBalanceLowWarningEmail extends BaseEmail {
|
export default class CreditBalanceLowWarningEmail extends BaseEmail {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import type { TFunction } from "i18next";
|
|||||||
|
|
||||||
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
||||||
|
|
||||||
import { renderEmail } from "..";
|
import renderEmail from "../src/renderEmail";
|
||||||
import BaseEmail from "./_base-email";
|
import BaseEmail from "./_base-email";
|
||||||
|
|
||||||
export default class DisabledAppEmail extends BaseEmail {
|
export default class DisabledAppEmail extends BaseEmail {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
||||||
|
|
||||||
import { renderEmail } from "../";
|
import renderEmail from "../src/renderEmail";
|
||||||
import BaseEmail from "./_base-email";
|
import BaseEmail from "./_base-email";
|
||||||
|
|
||||||
export interface Feedback {
|
export interface Feedback {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import type { TFunction } from "i18next";
|
|||||||
|
|
||||||
import { APP_NAME, EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
import { APP_NAME, EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
||||||
|
|
||||||
import { renderEmail } from "../";
|
import renderEmail from "../src/renderEmail";
|
||||||
import BaseEmail from "./_base-email";
|
import BaseEmail from "./_base-email";
|
||||||
|
|
||||||
export type PasswordReset = {
|
export type PasswordReset = {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { APP_NAME, EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
import { APP_NAME, EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
||||||
|
|
||||||
import { renderEmail } from "../";
|
import renderEmail from "../src/renderEmail";
|
||||||
import type { MonthlyDigestEmailData } from "../src/templates/MonthlyDigestEmail";
|
import type { MonthlyDigestEmailData } from "../src/templates/MonthlyDigestEmail";
|
||||||
import BaseEmail from "./_base-email";
|
import BaseEmail from "./_base-email";
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { getReplyToHeader } from "@calcom/lib/getReplyToHeader";
|
import { getReplyToHeader } from "@calcom/lib/getReplyToHeader";
|
||||||
|
|
||||||
import { renderEmail } from "../";
|
import renderEmail from "../src/renderEmail";
|
||||||
import AttendeeScheduledEmail from "./attendee-scheduled-email";
|
import AttendeeScheduledEmail from "./attendee-scheduled-email";
|
||||||
|
|
||||||
export default class NoShowFeeChargedEmail extends AttendeeScheduledEmail {
|
export default class NoShowFeeChargedEmail extends AttendeeScheduledEmail {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import type { TFunction } from "i18next";
|
|||||||
|
|
||||||
import { APP_NAME, EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
import { APP_NAME, EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
||||||
|
|
||||||
import { renderEmail } from "..";
|
import renderEmail from "../src/renderEmail";
|
||||||
import BaseEmail from "./_base-email";
|
import BaseEmail from "./_base-email";
|
||||||
|
|
||||||
export type OrgAutoInvite = {
|
export type OrgAutoInvite = {
|
||||||
|
|||||||
@@ -1,21 +1,10 @@
|
|||||||
import type { TFunction } from "i18next";
|
|
||||||
|
|
||||||
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
||||||
|
|
||||||
import { renderEmail } from "../";
|
import type { OrganizationCreation } from "../lib/types/email-types";
|
||||||
|
import renderEmail from "../src/renderEmail";
|
||||||
import BaseEmail from "./_base-email";
|
import BaseEmail from "./_base-email";
|
||||||
|
|
||||||
export type OrganizationCreation = {
|
export type { OrganizationCreation } from "../lib/types/email-types";
|
||||||
language: TFunction;
|
|
||||||
from: string;
|
|
||||||
to: string;
|
|
||||||
ownerNewUsername: string;
|
|
||||||
ownerOldUsername: string | null;
|
|
||||||
orgDomain: string;
|
|
||||||
orgName: string;
|
|
||||||
prevLink: string | null;
|
|
||||||
newLink: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default class OrganizationCreationEmail extends BaseEmail {
|
export default class OrganizationCreationEmail extends BaseEmail {
|
||||||
organizationCreationEvent: OrganizationCreation;
|
organizationCreationEvent: OrganizationCreation;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { APP_NAME } from "@calcom/lib/constants";
|
import { APP_NAME } from "@calcom/lib/constants";
|
||||||
import { getReplyToHeader } from "@calcom/lib/getReplyToHeader";
|
import { getReplyToHeader } from "@calcom/lib/getReplyToHeader";
|
||||||
|
|
||||||
import { renderEmail } from "../";
|
|
||||||
import generateIcsFile, { GenerateIcsRole } from "../lib/generateIcsFile";
|
import generateIcsFile, { GenerateIcsRole } from "../lib/generateIcsFile";
|
||||||
|
import renderEmail from "../src/renderEmail";
|
||||||
import OrganizerScheduledEmail from "./organizer-scheduled-email";
|
import OrganizerScheduledEmail from "./organizer-scheduled-email";
|
||||||
|
|
||||||
export default class OrganizerAddGuestsEmail extends OrganizerScheduledEmail {
|
export default class OrganizerAddGuestsEmail extends OrganizerScheduledEmail {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
||||||
|
|
||||||
import { renderEmail } from "../";
|
import renderEmail from "../src/renderEmail";
|
||||||
import OrganizerScheduledEmail from "./organizer-scheduled-email";
|
import OrganizerScheduledEmail from "./organizer-scheduled-email";
|
||||||
|
|
||||||
export default class OrganizerCancelledEmail extends OrganizerScheduledEmail {
|
export default class OrganizerCancelledEmail extends OrganizerScheduledEmail {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
||||||
import type { CalendarEvent, Person } from "@calcom/types/Calendar";
|
import type { CalendarEvent, Person } from "@calcom/types/Calendar";
|
||||||
|
|
||||||
import { renderEmail } from "../";
|
|
||||||
import generateIcsFile, { GenerateIcsRole } from "../lib/generateIcsFile";
|
import generateIcsFile, { GenerateIcsRole } from "../lib/generateIcsFile";
|
||||||
|
import renderEmail from "../src/renderEmail";
|
||||||
import OrganizerScheduledEmail from "./organizer-scheduled-email";
|
import OrganizerScheduledEmail from "./organizer-scheduled-email";
|
||||||
import type { Reassigned } from "./organizer-scheduled-email";
|
import type { Reassigned } from "./organizer-scheduled-email";
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { getReplyToHeader } from "@calcom/lib/getReplyToHeader";
|
|||||||
import { TimeFormat } from "@calcom/lib/timeFormat";
|
import { TimeFormat } from "@calcom/lib/timeFormat";
|
||||||
import type { CalendarEvent } from "@calcom/types/Calendar";
|
import type { CalendarEvent } from "@calcom/types/Calendar";
|
||||||
|
|
||||||
import { renderEmail } from "../";
|
import renderEmail from "../src/renderEmail";
|
||||||
import BaseEmail from "./_base-email";
|
import BaseEmail from "./_base-email";
|
||||||
|
|
||||||
export default class OrganizerDailyVideoDownloadRecordingEmail extends BaseEmail {
|
export default class OrganizerDailyVideoDownloadRecordingEmail extends BaseEmail {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { getReplyToHeader } from "@calcom/lib/getReplyToHeader";
|
|||||||
import { TimeFormat } from "@calcom/lib/timeFormat";
|
import { TimeFormat } from "@calcom/lib/timeFormat";
|
||||||
import type { CalendarEvent } from "@calcom/types/Calendar";
|
import type { CalendarEvent } from "@calcom/types/Calendar";
|
||||||
|
|
||||||
import { renderEmail } from "..";
|
import renderEmail from "../src/renderEmail";
|
||||||
import BaseEmail from "./_base-email";
|
import BaseEmail from "./_base-email";
|
||||||
|
|
||||||
export default class OrganizerDailyVideoDownloadTranscriptEmail extends BaseEmail {
|
export default class OrganizerDailyVideoDownloadTranscriptEmail extends BaseEmail {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
||||||
import { getReplyToHeader } from "@calcom/lib/getReplyToHeader";
|
import { getReplyToHeader } from "@calcom/lib/getReplyToHeader";
|
||||||
|
|
||||||
import { renderEmail } from "../";
|
|
||||||
import generateIcsFile, { GenerateIcsRole } from "../lib/generateIcsFile";
|
import generateIcsFile, { GenerateIcsRole } from "../lib/generateIcsFile";
|
||||||
|
import renderEmail from "../src/renderEmail";
|
||||||
import OrganizerScheduledEmail from "./organizer-scheduled-email";
|
import OrganizerScheduledEmail from "./organizer-scheduled-email";
|
||||||
|
|
||||||
export default class OrganizerLocationChangeEmail extends OrganizerScheduledEmail {
|
export default class OrganizerLocationChangeEmail extends OrganizerScheduledEmail {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
||||||
|
|
||||||
import { renderEmail } from "../";
|
import renderEmail from "../src/renderEmail";
|
||||||
import OrganizerScheduledEmail from "./organizer-scheduled-email";
|
import OrganizerScheduledEmail from "./organizer-scheduled-email";
|
||||||
|
|
||||||
export default class OrganizerPaymentRefundFailedEmail extends OrganizerScheduledEmail {
|
export default class OrganizerPaymentRefundFailedEmail extends OrganizerScheduledEmail {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
||||||
import type { CalendarEvent, Person } from "@calcom/types/Calendar";
|
import type { CalendarEvent, Person } from "@calcom/types/Calendar";
|
||||||
|
|
||||||
import { renderEmail } from "../";
|
|
||||||
import generateIcsFile, { GenerateIcsRole } from "../lib/generateIcsFile";
|
import generateIcsFile, { GenerateIcsRole } from "../lib/generateIcsFile";
|
||||||
|
import renderEmail from "../src/renderEmail";
|
||||||
import OrganizerScheduledEmail from "./organizer-scheduled-email";
|
import OrganizerScheduledEmail from "./organizer-scheduled-email";
|
||||||
import type { Reassigned } from "./organizer-scheduled-email";
|
import type { Reassigned } from "./organizer-scheduled-email";
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
|||||||
import { getReplyToHeader } from "@calcom/lib/getReplyToHeader";
|
import { getReplyToHeader } from "@calcom/lib/getReplyToHeader";
|
||||||
import type { CalendarEvent, Person } from "@calcom/types/Calendar";
|
import type { CalendarEvent, Person } from "@calcom/types/Calendar";
|
||||||
|
|
||||||
import { renderEmail } from "../";
|
import renderEmail from "../src/renderEmail";
|
||||||
import OrganizerScheduledEmail from "./organizer-scheduled-email";
|
import OrganizerScheduledEmail from "./organizer-scheduled-email";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
||||||
import { getReplyToHeader } from "@calcom/lib/getReplyToHeader";
|
import { getReplyToHeader } from "@calcom/lib/getReplyToHeader";
|
||||||
|
|
||||||
import { renderEmail } from "../";
|
import renderEmail from "../src/renderEmail";
|
||||||
import OrganizerRequestEmail from "./organizer-request-email";
|
import OrganizerRequestEmail from "./organizer-request-email";
|
||||||
|
|
||||||
export default class OrganizerRequestReminderEmail extends OrganizerRequestEmail {
|
export default class OrganizerRequestReminderEmail extends OrganizerRequestEmail {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
||||||
import type { CalendarEvent } from "@calcom/types/Calendar";
|
import type { CalendarEvent } from "@calcom/types/Calendar";
|
||||||
|
|
||||||
import { renderEmail } from "..";
|
|
||||||
import generateIcsFile, { GenerateIcsRole } from "../lib/generateIcsFile";
|
import generateIcsFile, { GenerateIcsRole } from "../lib/generateIcsFile";
|
||||||
|
import renderEmail from "../src/renderEmail";
|
||||||
import OrganizerScheduledEmail from "./organizer-scheduled-email";
|
import OrganizerScheduledEmail from "./organizer-scheduled-email";
|
||||||
|
|
||||||
export default class OrganizerRequestedToRescheduleEmail extends OrganizerScheduledEmail {
|
export default class OrganizerRequestedToRescheduleEmail extends OrganizerScheduledEmail {
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
|||||||
import { getReplyToHeader } from "@calcom/lib/getReplyToHeader";
|
import { getReplyToHeader } from "@calcom/lib/getReplyToHeader";
|
||||||
import type { CalendarEvent, Person } from "@calcom/types/Calendar";
|
import type { CalendarEvent, Person } from "@calcom/types/Calendar";
|
||||||
|
|
||||||
import { renderEmail } from "../";
|
|
||||||
import generateIcsFile, { GenerateIcsRole } from "../lib/generateIcsFile";
|
import generateIcsFile, { GenerateIcsRole } from "../lib/generateIcsFile";
|
||||||
|
import renderEmail from "../src/renderEmail";
|
||||||
import OrganizerScheduledEmail from "./organizer-scheduled-email";
|
import OrganizerScheduledEmail from "./organizer-scheduled-email";
|
||||||
|
|
||||||
export default class OrganizerRescheduledEmail extends OrganizerScheduledEmail {
|
export default class OrganizerRescheduledEmail extends OrganizerScheduledEmail {
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ import { getReplyToHeader } from "@calcom/lib/getReplyToHeader";
|
|||||||
import { TimeFormat } from "@calcom/lib/timeFormat";
|
import { TimeFormat } from "@calcom/lib/timeFormat";
|
||||||
import type { CalendarEvent, Person } from "@calcom/types/Calendar";
|
import type { CalendarEvent, Person } from "@calcom/types/Calendar";
|
||||||
|
|
||||||
import { renderEmail } from "../";
|
|
||||||
import generateIcsFile from "../lib/generateIcsFile";
|
import generateIcsFile from "../lib/generateIcsFile";
|
||||||
import { GenerateIcsRole } from "../lib/generateIcsFile";
|
import { GenerateIcsRole } from "../lib/generateIcsFile";
|
||||||
|
import renderEmail from "../src/renderEmail";
|
||||||
import BaseEmail from "./_base-email";
|
import BaseEmail from "./_base-email";
|
||||||
|
|
||||||
export type Reassigned = { name: string | null; email: string; reason?: string; byUser?: string };
|
export type Reassigned = { name: string | null; email: string; reason?: string; byUser?: string };
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import type { TFunction } from "i18next";
|
|||||||
|
|
||||||
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
||||||
|
|
||||||
import { renderEmail } from "..";
|
import renderEmail from "../src/renderEmail";
|
||||||
import BaseEmail from "./_base-email";
|
import BaseEmail from "./_base-email";
|
||||||
|
|
||||||
export default class SlugReplacementEmail extends BaseEmail {
|
export default class SlugReplacementEmail extends BaseEmail {
|
||||||
|
|||||||
@@ -1,65 +1,10 @@
|
|||||||
import type { TFunction } from "i18next";
|
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
||||||
|
|
||||||
import { APP_NAME, EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
import { getSubject, type TeamInvite } from "../lib/utils/team-invite-utils";
|
||||||
|
import renderEmail from "../src/renderEmail";
|
||||||
import { renderEmail } from "../";
|
|
||||||
import BaseEmail from "./_base-email";
|
import BaseEmail from "./_base-email";
|
||||||
|
|
||||||
export type TeamInvite = {
|
export { getSubject, getTypeOfInvite, type TeamInvite } from "../lib/utils/team-invite-utils";
|
||||||
language: TFunction;
|
|
||||||
from: string;
|
|
||||||
to: string;
|
|
||||||
teamName: string;
|
|
||||||
joinLink: string;
|
|
||||||
isCalcomMember: boolean;
|
|
||||||
/**
|
|
||||||
* We ideally should have a separate email for auto-join(when a user is automatically accepted into a team/org), but we don't have one yet.
|
|
||||||
*/
|
|
||||||
isAutoJoin: boolean;
|
|
||||||
isOrg: boolean;
|
|
||||||
parentTeamName: string | undefined;
|
|
||||||
isExistingUserMovedToOrg: boolean;
|
|
||||||
prevLink: string | null;
|
|
||||||
newLink: string | null;
|
|
||||||
};
|
|
||||||
|
|
||||||
export function getTypeOfInvite(teamInviteEvent: TeamInvite) {
|
|
||||||
if (teamInviteEvent.isOrg) {
|
|
||||||
return "TO_ORG";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (teamInviteEvent.parentTeamName) {
|
|
||||||
return "TO_SUBTEAM";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (teamInviteEvent.isAutoJoin) {
|
|
||||||
throw new Error("Auto-join is not supported for regular teams");
|
|
||||||
}
|
|
||||||
|
|
||||||
return "TO_REGULAR_TEAM";
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getSubject = (teamInviteEvent: TeamInvite) => {
|
|
||||||
const typeOfInvite = getTypeOfInvite(teamInviteEvent);
|
|
||||||
const type = teamInviteEvent.isAutoJoin ? "added" : "invited";
|
|
||||||
const variables = {
|
|
||||||
user: teamInviteEvent.from,
|
|
||||||
team: teamInviteEvent.teamName,
|
|
||||||
appName: APP_NAME,
|
|
||||||
parentTeamName: teamInviteEvent.parentTeamName,
|
|
||||||
entity: teamInviteEvent.language(teamInviteEvent.isOrg ? "organization" : "team").toLowerCase(),
|
|
||||||
};
|
|
||||||
|
|
||||||
if (typeOfInvite === "TO_ORG") {
|
|
||||||
return teamInviteEvent.language(`email_team_invite|subject|${type}_to_org`, variables);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeOfInvite === "TO_SUBTEAM") {
|
|
||||||
return teamInviteEvent.language(`email_team_invite|subject|${type}_to_subteam`, variables);
|
|
||||||
}
|
|
||||||
|
|
||||||
return teamInviteEvent.language(`email_team_invite|subject|${type}_to_regular_team`, variables);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default class TeamInviteEmail extends BaseEmail {
|
export default class TeamInviteEmail extends BaseEmail {
|
||||||
teamInviteEvent: TeamInvite;
|
teamInviteEvent: TeamInvite;
|
||||||
|
|||||||
@@ -8,10 +8,11 @@ import { ZFormMutationInputSchema } from "./formMutation.schema";
|
|||||||
import { ZFormQueryInputSchema } from "./formQuery.schema";
|
import { ZFormQueryInputSchema } from "./formQuery.schema";
|
||||||
import { ZGetAttributesForTeamInputSchema } from "./getAttributesForTeam.schema";
|
import { ZGetAttributesForTeamInputSchema } from "./getAttributesForTeam.schema";
|
||||||
import { ZGetIncompleteBookingSettingsInputSchema } from "./getIncompleteBookingSettings.schema";
|
import { ZGetIncompleteBookingSettingsInputSchema } from "./getIncompleteBookingSettings.schema";
|
||||||
|
import { ZFormByResponseIdInputSchema } from "./getResponseWithFormFields.schema";
|
||||||
import { forms } from "./procedures/forms";
|
import { forms } from "./procedures/forms";
|
||||||
import { ZSaveIncompleteBookingSettingsInputSchema } from "./saveIncompleteBookingSettings.schema";
|
import { ZSaveIncompleteBookingSettingsInputSchema } from "./saveIncompleteBookingSettings.schema";
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
||||||
const UNSTABLE_HANDLER_CACHE: Record<string, Function> = {};
|
const UNSTABLE_HANDLER_CACHE: Record<string, Function> = {};
|
||||||
|
|
||||||
// TODO: Move getHandler and UNSTABLE_HANDLER_CACHE to a common utils file making sure that there is no name collision across routes
|
// TODO: Move getHandler and UNSTABLE_HANDLER_CACHE to a common utils file making sure that there is no name collision across routes
|
||||||
@@ -24,7 +25,7 @@ const UNSTABLE_HANDLER_CACHE: Record<string, Function> = {};
|
|||||||
*/
|
*/
|
||||||
const getHandler = async <
|
const getHandler = async <
|
||||||
T extends {
|
T extends {
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
||||||
default: Function;
|
default: Function;
|
||||||
}
|
}
|
||||||
>(
|
>(
|
||||||
@@ -45,10 +46,6 @@ const getHandler = async <
|
|||||||
return UNSTABLE_HANDLER_CACHE[nameInCache] as unknown as T["default"];
|
return UNSTABLE_HANDLER_CACHE[nameInCache] as unknown as T["default"];
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ZFormByResponseIdInputSchema = z.object({
|
|
||||||
formResponseId: z.number(),
|
|
||||||
});
|
|
||||||
|
|
||||||
export type TFormQueryInputSchema = z.infer<typeof ZFormQueryInputSchema>;
|
export type TFormQueryInputSchema = z.infer<typeof ZFormQueryInputSchema>;
|
||||||
|
|
||||||
const appRoutingForms = router({
|
const appRoutingForms = router({
|
||||||
|
|||||||
+1
-1
@@ -10,7 +10,7 @@ import type { TrpcSessionUser } from "@calcom/trpc/server/types";
|
|||||||
|
|
||||||
import { TRPCError } from "@trpc/server";
|
import { TRPCError } from "@trpc/server";
|
||||||
|
|
||||||
import type { ZFormByResponseIdInputSchema } from "./_router";
|
import type { ZFormByResponseIdInputSchema } from "./getResponseWithFormFields.schema";
|
||||||
|
|
||||||
type GetResponseWithFormFieldsOptions = {
|
type GetResponseWithFormFieldsOptions = {
|
||||||
ctx: {
|
ctx: {
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
import { z } from "zod";
|
||||||
|
|
||||||
|
export const ZFormByResponseIdInputSchema = z.object({
|
||||||
|
formResponseId: z.number(),
|
||||||
|
});
|
||||||
Vendored
+3
-5
@@ -6,7 +6,6 @@ import type { Frequency } from "rrule";
|
|||||||
import type z from "zod";
|
import type z from "zod";
|
||||||
|
|
||||||
import type { bookingResponse } from "@calcom/features/bookings/lib/getBookingResponsesSchema";
|
import type { bookingResponse } from "@calcom/features/bookings/lib/getBookingResponsesSchema";
|
||||||
import type { Calendar } from "@calcom/features/calendars/weeklyview";
|
|
||||||
import type { TimeFormat } from "@calcom/lib/timeFormat";
|
import type { TimeFormat } from "@calcom/lib/timeFormat";
|
||||||
import type {
|
import type {
|
||||||
BookingSeat,
|
BookingSeat,
|
||||||
@@ -66,7 +65,6 @@ export type EventBusyDetails = EventBusyDate & {
|
|||||||
userId?: number | null;
|
userId?: number | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type CalendarServiceType = typeof Calendar;
|
|
||||||
export type AdditionalInfo = Record<string, unknown> & { calWarnings?: string[] };
|
export type AdditionalInfo = Record<string, unknown> & { calWarnings?: string[] };
|
||||||
|
|
||||||
export type NewCalendarEventType = {
|
export type NewCalendarEventType = {
|
||||||
@@ -104,9 +102,9 @@ export type CalendarEventType = {
|
|||||||
isNegative: boolean;
|
isNegative: boolean;
|
||||||
};
|
};
|
||||||
organizer: string;
|
organizer: string;
|
||||||
attendees: any[][];
|
attendees: unknown[][];
|
||||||
recurrenceId: Time;
|
recurrenceId: Time;
|
||||||
timezone: any;
|
timezone: string | object;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type BatchResponse = {
|
export type BatchResponse = {
|
||||||
@@ -314,7 +312,7 @@ export interface Calendar {
|
|||||||
/**
|
/**
|
||||||
* @see [How to inference class type that implements an interface](https://stackoverflow.com/a/64765554/6297100)
|
* @see [How to inference class type that implements an interface](https://stackoverflow.com/a/64765554/6297100)
|
||||||
*/
|
*/
|
||||||
type Class<I, Args extends any[] = any[]> = new (...args: Args) => I;
|
type Class<I, Args extends unknown[] = unknown[]> = new (...args: Args) => I;
|
||||||
|
|
||||||
export type CalendarClass = Class<Calendar, [CredentialForCalendarService]>;
|
export type CalendarClass = Class<Calendar, [CredentialForCalendarService]>;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user