- {clientId}
-
-
- {clientSecret}
-
- + <>{language("admin_oauth_notification_email_title", { clientName })}> +
++ <>{language("hi_admin")}!> +
++ {language("admin_oauth_notification_email_body", { submitterEmail })} +
+| + {language("client_name")} + | +{clientName} | +
| + {language("purpose")} + | +{purpose ?? ""} | +
| + {language("client_id")} + | +
+ {clientId}
+ |
+
| + {language("redirect_uri")} + | +{redirectUri} | +
| {language("submitted_by")} | ++ {submitterName ? `${submitterName} (${submitterEmail})` : submitterEmail} + | +
+ {language("admin_oauth_notification_email_footer")} +
+ + ); +}; diff --git a/packages/emails/src/templates/OAuthClientApprovedNotificationEmail.tsx b/packages/emails/src/templates/OAuthClientApprovedNotificationEmail.tsx new file mode 100644 index 00000000000000..ef6a5e888328cf --- /dev/null +++ b/packages/emails/src/templates/OAuthClientApprovedNotificationEmail.tsx @@ -0,0 +1,87 @@ +import type { TFunction } from "i18next"; + +import { APP_NAME, WEBAPP_URL } from "@calcom/lib/constants"; + +import { BaseEmailHtml, CallToAction } from "../components"; + +type OAuthClientApprovedNotification = { + language: TFunction; + userName: string | null; + clientName: string; + clientId: string; +}; + +export const OAuthClientApprovedNotificationEmail = ({ + userName, + clientName, + clientId, + language, +}: OAuthClientApprovedNotification) => { + return ( ++ {language("oauth_client_approved_email_title", { clientName })} +
++ {language("hi_user", { name: userName || language("there") })}! +
+{language("oauth_client_approved_email_body")}
+| + {language("client_name")} + | +{clientName} | +
| + {language("client_id")} + | +
+ {clientId}
+ |
+
+ {language("oauth_client_approved_email_footer")} +
+ + ); +}; diff --git a/packages/emails/src/templates/OAuthClientRejectedNotificationEmail.tsx b/packages/emails/src/templates/OAuthClientRejectedNotificationEmail.tsx new file mode 100644 index 00000000000000..c9eb745917f1b0 --- /dev/null +++ b/packages/emails/src/templates/OAuthClientRejectedNotificationEmail.tsx @@ -0,0 +1,101 @@ +import type { TFunction } from "i18next"; + +import { APP_NAME, WEBAPP_URL } from "@calcom/lib/constants"; + +import { BaseEmailHtml, CallToAction } from "../components"; + +type OAuthClientRejectedNotification = { + language: TFunction; + userName: string | null; + clientName: string; + clientId: string; + rejectionReason: string; +}; + +export const OAuthClientRejectedNotificationEmail = ({ + userName, + clientName, + clientId, + rejectionReason, + language, +}: OAuthClientRejectedNotification) => { + return ( ++ {language("oauth_client_rejected_email_title", { clientName })} +
+{language("hi_user", { name: userName || language("there") })}!
+{language("oauth_client_rejected_email_body")}
+| + {language("client_name")} + | +{clientName} | +
| + {language("client_id")} + | +
+ {clientId}
+ |
+
| + {language("oauth_client_rejected_email_reason_label")} + | ++ {rejectionReason} + | +
+ {language("oauth_client_rejected_email_footer")} +
+ + ); +}; diff --git a/packages/emails/src/templates/index.ts b/packages/emails/src/templates/index.ts index 3fb98750ebfe56..7989abe6bd4d8b 100644 --- a/packages/emails/src/templates/index.ts +++ b/packages/emails/src/templates/index.ts @@ -37,6 +37,9 @@ export { OrganisationAccountVerifyEmail } from "./OrganizationAccountVerifyEmail export { OrgAutoInviteEmail } from "./OrgAutoInviteEmail"; export { MonthlyDigestEmail } from "./MonthlyDigestEmail"; export { AdminOrganizationNotificationEmail } from "./AdminOrganizationNotificationEmail"; +export { AdminOAuthClientNotificationEmail } from "./AdminOAuthClientNotificationEmail"; +export { OAuthClientApprovedNotificationEmail } from "./OAuthClientApprovedNotificationEmail"; +export { OAuthClientRejectedNotificationEmail } from "./OAuthClientRejectedNotificationEmail"; export { BookingRedirectEmailNotification } from "./BookingRedirectEmailNotification"; export { VerifyEmailChangeEmail } from "./VerifyEmailChangeEmail"; export { OrganizationCreationEmail } from "./OrganizationCreationEmail"; diff --git a/packages/emails/templates/admin-oauth-client-notification.test.ts b/packages/emails/templates/admin-oauth-client-notification.test.ts new file mode 100644 index 00000000000000..d547c93b607a7c --- /dev/null +++ b/packages/emails/templates/admin-oauth-client-notification.test.ts @@ -0,0 +1,89 @@ +import { describe, expect, it } from "vitest"; + +import type { TFunction } from "i18next"; +import { SUPPORT_MAIL_ADDRESS } from "@calcom/lib/constants"; + +import AdminOAuthClientNotification from "./admin-oauth-client-notification"; + +class TestAdminOAuthClientNotification extends AdminOAuthClientNotification { + public async getPayload() { + return await this.getNodeMailerPayload(); + } +} + +describe("AdminOAuthClientNotification", () => { + it("renders a node mailer payload containing the submitted client information", async () => { + const t = ((key: string, vars?: Record