1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
import { render } from '@react-email/render';
import * as React from "react";
import * as fs from "node:fs";
import Event, {EventProps} from './emails/Event';
import IdentityVerificationJWT from "./emails/IdentityVerificationJWT";
import IdentityVerificationOTC from "./emails/IdentityVerificationOTC";
const optsHTML = {
pretty: false,
plainText: false,
};
const optsTXT = {
pretty: false,
plainText: true,
};
async function doRender() {
const propsEvent: EventProps = {
title: "{{ .Title }}",
displayName: "{{ .DisplayName }}",
bodyPrefix: "{{ .BodyPrefix }}",
bodyEvent: "{{ .BodyEvent }}",
bodySuffix: "{{ .BodySuffix }}",
remoteIP: "{{ .RemoteIP }}",
detailsKey: "{{ $key }}",
detailsValue: "{{ index $.Details $key }}",
detailsPrefix: "{{- $keys := sortAlpha (keys .Details) }}{{- range $key := $keys }}",
detailsSuffix: "{{ end }}",
};
fs.writeFileSync('../embed/notification/Event.html', await render(<Event {...propsEvent} />, optsHTML));
fs.writeFileSync('../embed/notification/Event.txt', await render(<Event {...propsEvent} />, optsTXT));
const propsEventNoPreview = {
...propsEvent,
hidePreview: true,
};
fs.writeFileSync('../../../examples/templates/notifications/no-preview/Event.html', await render(<Event {...propsEventNoPreview} />, optsHTML));
const propsJWT = {
title: "{{ .Title }}",
displayName: "{{ .DisplayName }}",
domain: "{{ .Domain }}",
remoteIP: "{{ .RemoteIP }}",
link: "{{ .LinkURL }}",
linkText: "{{ .LinkText }}",
revocationLinkURL: "{{ .RevocationLinkURL }}",
revocationLinkText: "{{ .RevocationLinkText }}",
};
fs.writeFileSync('../embed/notification/IdentityVerificationJWT.html', await render(<IdentityVerificationJWT {...propsJWT} />, optsHTML));
fs.writeFileSync('../embed/notification/IdentityVerificationJWT.txt', await render(<IdentityVerificationJWT {...propsJWT} />, optsTXT));
const propsJWTNoPreview = {
...propsJWT,
hidePreview: true,
};
fs.writeFileSync('../../../examples/templates/notifications/no-preview/IdentityVerificationJWT.html', await render(<IdentityVerificationJWT {...propsJWTNoPreview} />, optsHTML));
const propsOTC = {
title: "{{ .Title }}",
displayName: "{{ .DisplayName }}",
domain: "{{ .Domain }}",
remoteIP: "{{ .RemoteIP }}",
oneTimeCode: "{{ .OneTimeCode }}",
revocationLinkURL: "{{ .RevocationLinkURL }}",
revocationLinkText: "{{ .RevocationLinkText }}",
};
fs.writeFileSync('../embed/notification/IdentityVerificationOTC.html', await render(<IdentityVerificationOTC {...propsOTC} />, optsHTML));
fs.writeFileSync('../embed/notification/IdentityVerificationOTC.txt', await render(<IdentityVerificationOTC {...propsOTC} />, optsTXT));
const propsOTCNoPreview = {
...propsOTC,
hidePreview: true,
};
fs.writeFileSync('../../../examples/templates/notifications/no-preview/IdentityVerificationOTC.html', await render(<IdentityVerificationOTC {...propsOTCNoPreview} />, optsHTML));
}
doRender().then();
|