mirror of
https://github.com/hanzoai/calendar.git
synced 2026-10-30 14:46:43 +00:00
d82f87aa2a
* 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>
51 lines
1.6 KiB
TypeScript
51 lines
1.6 KiB
TypeScript
import type { TFunction } from "i18next";
|
|
|
|
import { APP_NAME, EMAIL_FROM_NAME } from "@calcom/lib/constants";
|
|
|
|
import renderEmail from "../src/renderEmail";
|
|
import BaseEmail from "./_base-email";
|
|
|
|
export type PasswordReset = {
|
|
language: TFunction;
|
|
user: {
|
|
name?: string | null;
|
|
email: string;
|
|
};
|
|
resetLink: string;
|
|
};
|
|
|
|
export default class ForgotPasswordEmail extends BaseEmail {
|
|
passwordEvent: PasswordReset;
|
|
|
|
constructor(passwordEvent: PasswordReset) {
|
|
super();
|
|
this.name = "SEND_PASSWORD_RESET_EMAIL";
|
|
this.passwordEvent = passwordEvent;
|
|
}
|
|
|
|
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
|
|
return {
|
|
to: `${this.passwordEvent.user.name} <${this.passwordEvent.user.email}>`,
|
|
from: `${EMAIL_FROM_NAME} <${this.getMailerOptions().from}>`,
|
|
subject: this.passwordEvent.language("reset_password_subject", {
|
|
appName: APP_NAME,
|
|
}),
|
|
html: await renderEmail("ForgotPasswordEmail", this.passwordEvent),
|
|
text: this.getTextBody(),
|
|
};
|
|
}
|
|
|
|
protected getTextBody(): string {
|
|
return `
|
|
${this.passwordEvent.language("reset_password_subject", { appName: APP_NAME })}
|
|
${this.passwordEvent.language("hi_user_name", { name: this.passwordEvent.user.name })},
|
|
${this.passwordEvent.language("someone_requested_password_reset")}
|
|
${this.passwordEvent.language("change_password")}: ${this.passwordEvent.resetLink}
|
|
${this.passwordEvent.language("password_reset_instructions")}
|
|
${this.passwordEvent.language("have_any_questions")} ${this.passwordEvent.language(
|
|
"contact_our_support_team"
|
|
)}
|
|
`.replace(/(<([^>]+)>)/gi, "");
|
|
}
|
|
}
|