You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: apps/backend/src/lib/ai-chat/email-template-adapter.ts
+15-9Lines changed: 15 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -28,30 +28,36 @@ Create a new email template.
28
28
The email template is a tsx file that is used to render the email content.
29
29
It must use react-email components.
30
30
It must export two things:
31
-
- schema: An arktype schema for the email template props
32
-
- EmailTemplate: A function that renders the email template.
31
+
- variablesSchema: An arktype schema for the email template props
32
+
- EmailTemplate: A function that renders the email template. You must set the PreviewVariables property to an object that satisfies the variablesSchema by doing EmailTemplate.PreviewVariables = { ...
33
33
It must not import from any package besides "@react-email/components", "@stackframe/emails", and "arktype".
34
34
It uses tailwind classes for all styling.
35
35
36
36
Here is an example of a valid email template:
37
37
\`\`\`tsx
38
+
import { type } from "arktype"
38
39
import { Container } from "@react-email/components";
39
-
import { Subject, NotificationCategory } from "@stackframe/emails";
40
-
import { type } from "arktype";
40
+
import { Subject, NotificationCategory, Props } from "@stackframe/emails";
41
41
42
-
export const schema = type({
43
-
projectDisplayName: "string",
42
+
export const variablesSchema = type({
43
+
count: "number"
44
44
});
45
45
46
-
export function EmailTemplate({ projectDisplayName }: typeof schema.infer) {
46
+
export function EmailTemplate({ user, variables }: Props<typeof variablesSchema.infer>) {
0 commit comments