calcom/lib/forgot-password/messaging/forgot-password.ts
Mihai C 8d6fec79d3
feat: add translations for emails and type error fixes overall (#994)
* feat: add translations for forgot password email and misc

* fix: type fixes

* feat: translate invitation email

* fix: e2e tests

* fix: lint

* feat: type fixes and i18n for emails

* Merge main

* fix: jest import on server path

* Merge

* fix: playwright tests

* fix: lint

Co-authored-by: Bailey Pumfleet <pumfleet@hey.com>
2021-10-25 14:05:21 +01:00

28 lines
748 B
TypeScript

import { TFunction } from "next-i18next";
import { buildMessageTemplate, VarType } from "../../emails/buildMessageTemplate";
export const forgotPasswordSubjectTemplate = (t: TFunction): string => {
const text = t("forgot_your_password_calcom");
return text;
};
export const forgotPasswordMessageTemplate = (t: TFunction): string => {
const text = `${t("hey_there")}
${t("use_link_to_reset_password")}
{{link}}
${t("link_expires", { expiresIn: 6 })}
- Cal.com`;
return text;
};
export const buildForgotPasswordMessage = (vars: VarType) => {
return buildMessageTemplate({
subjectTemplate: forgotPasswordSubjectTemplate(vars.language),
messageTemplate: forgotPasswordMessageTemplate(vars.language),
vars,
});
};