@stackframe/stack-shared 2.8.25 → 2.8.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/config/format.d.mts +20 -5
- package/dist/config/format.d.ts +20 -5
- package/dist/config/format.js +39 -14
- package/dist/config/format.js.map +1 -1
- package/dist/config/schema.d.mts +795 -317
- package/dist/config/schema.d.ts +795 -317
- package/dist/config/schema.js +471 -84
- package/dist/config/schema.js.map +1 -1
- package/dist/crud.d.mts +1 -0
- package/dist/crud.d.ts +1 -0
- package/dist/esm/config/format.js +37 -14
- package/dist/esm/config/format.js.map +1 -1
- package/dist/esm/config/schema.js +460 -80
- package/dist/esm/config/schema.js.map +1 -1
- package/dist/esm/helpers/emails.js +164 -34
- package/dist/esm/helpers/emails.js.map +1 -1
- package/dist/esm/interface/admin-interface.js +41 -38
- package/dist/esm/interface/admin-interface.js.map +1 -1
- package/dist/esm/interface/crud/config.js +40 -0
- package/dist/esm/interface/crud/config.js.map +1 -0
- package/dist/esm/interface/server-interface.js +26 -0
- package/dist/esm/interface/server-interface.js.map +1 -1
- package/dist/esm/known-errors.js +24 -1
- package/dist/esm/known-errors.js.map +1 -1
- package/dist/esm/schema-fields.js +92 -27
- package/dist/esm/schema-fields.js.map +1 -1
- package/dist/esm/utils/currencies.js +52 -0
- package/dist/esm/utils/currencies.js.map +1 -0
- package/dist/esm/utils/dates.js +55 -1
- package/dist/esm/utils/dates.js.map +1 -1
- package/dist/esm/utils/errors.js.map +1 -1
- package/dist/esm/utils/esbuild.js +15 -11
- package/dist/esm/utils/esbuild.js.map +1 -1
- package/dist/esm/utils/objects.js +2 -0
- package/dist/esm/utils/objects.js.map +1 -1
- package/dist/esm/utils/promises.js +24 -13
- package/dist/esm/utils/promises.js.map +1 -1
- package/dist/esm/utils/strings.js +4 -0
- package/dist/esm/utils/strings.js.map +1 -1
- package/dist/esm/utils/telemetry.js +39 -0
- package/dist/esm/utils/telemetry.js.map +1 -0
- package/dist/esm/utils/types.js +45 -0
- package/dist/esm/utils/types.js.map +1 -1
- package/dist/helpers/emails.d.mts +32 -6
- package/dist/helpers/emails.d.ts +32 -6
- package/dist/helpers/emails.js +166 -34
- package/dist/helpers/emails.js.map +1 -1
- package/dist/helpers/password.d.mts +1 -0
- package/dist/helpers/password.d.ts +1 -0
- package/dist/helpers/production-mode.d.mts +1 -0
- package/dist/helpers/production-mode.d.ts +1 -0
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/interface/admin-interface.d.mts +13 -14
- package/dist/interface/admin-interface.d.ts +13 -14
- package/dist/interface/admin-interface.js +41 -38
- package/dist/interface/admin-interface.js.map +1 -1
- package/dist/interface/client-interface.d.mts +1 -0
- package/dist/interface/client-interface.d.ts +1 -0
- package/dist/interface/crud/config.d.mts +49 -0
- package/dist/interface/crud/config.d.ts +49 -0
- package/dist/interface/crud/config.js +79 -0
- package/dist/interface/crud/config.js.map +1 -0
- package/dist/interface/crud/connected-accounts.d.mts +1 -0
- package/dist/interface/crud/connected-accounts.d.ts +1 -0
- package/dist/interface/crud/contact-channels.d.mts +1 -0
- package/dist/interface/crud/contact-channels.d.ts +1 -0
- package/dist/interface/crud/current-user.d.mts +1 -0
- package/dist/interface/crud/current-user.d.ts +1 -0
- package/dist/interface/crud/email-templates.d.mts +1 -0
- package/dist/interface/crud/email-templates.d.ts +1 -0
- package/dist/interface/crud/emails.d.mts +1 -0
- package/dist/interface/crud/emails.d.ts +1 -0
- package/dist/interface/crud/internal-api-keys.d.mts +1 -0
- package/dist/interface/crud/internal-api-keys.d.ts +1 -0
- package/dist/interface/crud/notification-preferences.d.mts +1 -0
- package/dist/interface/crud/notification-preferences.d.ts +1 -0
- package/dist/interface/crud/oauth-providers.d.mts +5 -4
- package/dist/interface/crud/oauth-providers.d.ts +5 -4
- package/dist/interface/crud/project-api-keys.d.mts +3 -2
- package/dist/interface/crud/project-api-keys.d.ts +3 -2
- package/dist/interface/crud/project-permissions.d.mts +1 -0
- package/dist/interface/crud/project-permissions.d.ts +1 -0
- package/dist/interface/crud/projects.d.mts +8 -7
- package/dist/interface/crud/projects.d.ts +8 -7
- package/dist/interface/crud/sessions.d.mts +1 -0
- package/dist/interface/crud/sessions.d.ts +1 -0
- package/dist/interface/crud/svix-token.d.mts +1 -0
- package/dist/interface/crud/svix-token.d.ts +1 -0
- package/dist/interface/crud/team-invitation-details.d.mts +1 -0
- package/dist/interface/crud/team-invitation-details.d.ts +1 -0
- package/dist/interface/crud/team-invitation.d.mts +1 -0
- package/dist/interface/crud/team-invitation.d.ts +1 -0
- package/dist/interface/crud/team-member-profiles.d.mts +1 -0
- package/dist/interface/crud/team-member-profiles.d.ts +1 -0
- package/dist/interface/crud/team-memberships.d.mts +1 -0
- package/dist/interface/crud/team-memberships.d.ts +1 -0
- package/dist/interface/crud/team-permissions.d.mts +1 -0
- package/dist/interface/crud/team-permissions.d.ts +1 -0
- package/dist/interface/crud/teams.d.mts +1 -0
- package/dist/interface/crud/teams.d.ts +1 -0
- package/dist/interface/crud/users.d.mts +1 -0
- package/dist/interface/crud/users.d.ts +1 -0
- package/dist/interface/server-interface.d.mts +10 -0
- package/dist/interface/server-interface.d.ts +10 -0
- package/dist/interface/server-interface.js +26 -0
- package/dist/interface/server-interface.js.map +1 -1
- package/dist/known-errors.d.mts +6 -0
- package/dist/known-errors.d.ts +6 -0
- package/dist/known-errors.js +24 -1
- package/dist/known-errors.js.map +1 -1
- package/dist/schema-fields.d.mts +39 -8
- package/dist/schema-fields.d.ts +39 -8
- package/dist/schema-fields.js +101 -27
- package/dist/schema-fields.js.map +1 -1
- package/dist/utils/currencies.d.mts +39 -0
- package/dist/utils/currencies.d.ts +39 -0
- package/dist/utils/currencies.js +78 -0
- package/dist/utils/currencies.js.map +1 -0
- package/dist/utils/dates.d.mts +5 -1
- package/dist/utils/dates.d.ts +5 -1
- package/dist/utils/dates.js +58 -2
- package/dist/utils/dates.js.map +1 -1
- package/dist/utils/errors.d.mts +12 -1
- package/dist/utils/errors.d.ts +12 -1
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/esbuild.js +15 -11
- package/dist/utils/esbuild.js.map +1 -1
- package/dist/utils/objects.d.mts +23 -8
- package/dist/utils/objects.d.ts +23 -8
- package/dist/utils/objects.js +2 -0
- package/dist/utils/objects.js.map +1 -1
- package/dist/utils/promises.d.mts +5 -1
- package/dist/utils/promises.d.ts +5 -1
- package/dist/utils/promises.js +24 -12
- package/dist/utils/promises.js.map +1 -1
- package/dist/utils/strings.d.mts +3 -1
- package/dist/utils/strings.d.ts +3 -1
- package/dist/utils/strings.js +5 -0
- package/dist/utils/strings.js.map +1 -1
- package/dist/utils/telemetry.d.mts +13 -0
- package/dist/utils/telemetry.d.ts +13 -0
- package/dist/utils/telemetry.js +66 -0
- package/dist/utils/telemetry.js.map +1 -0
- package/dist/utils/types.d.mts +73 -2
- package/dist/utils/types.d.ts +73 -2
- package/dist/utils/types.js +54 -0
- package/dist/utils/types.js.map +1 -1
- package/package.json +2 -1
package/dist/helpers/emails.js
CHANGED
|
@@ -23,52 +23,109 @@ __export(emails_exports, {
|
|
|
23
23
|
DEFAULT_EMAIL_TEMPLATES: () => DEFAULT_EMAIL_TEMPLATES,
|
|
24
24
|
DEFAULT_EMAIL_THEMES: () => DEFAULT_EMAIL_THEMES,
|
|
25
25
|
DEFAULT_EMAIL_THEME_ID: () => DEFAULT_EMAIL_THEME_ID,
|
|
26
|
+
DEFAULT_TEMPLATE_IDS: () => DEFAULT_TEMPLATE_IDS,
|
|
26
27
|
LightEmailTheme: () => LightEmailTheme,
|
|
28
|
+
emptyEmailTheme: () => emptyEmailTheme,
|
|
27
29
|
previewTemplateSource: () => previewTemplateSource
|
|
28
30
|
});
|
|
29
31
|
module.exports = __toCommonJS(emails_exports);
|
|
30
|
-
var
|
|
32
|
+
var import_strings = require("../utils/strings.js");
|
|
33
|
+
var previewTemplateSource = import_strings.deindent`
|
|
34
|
+
import { Heading, Section, Row, Button, Link, Column } from "@react-email/components";
|
|
35
|
+
export const variablesSchema = v => v;
|
|
31
36
|
export function EmailTemplate() {
|
|
32
|
-
return
|
|
33
|
-
<
|
|
34
|
-
<h2 className="mb-4 text-2xl font-bold">
|
|
37
|
+
return <>
|
|
38
|
+
<Heading as="h2" className="mb-4 text-2xl font-bold">
|
|
35
39
|
Header text
|
|
36
|
-
</
|
|
37
|
-
<
|
|
40
|
+
</Heading>
|
|
41
|
+
<Section className="mb-4">
|
|
38
42
|
Body text content with some additional information.
|
|
39
|
-
|
|
40
|
-
|
|
43
|
+
</Section>
|
|
44
|
+
<Row className="mb-4">
|
|
45
|
+
<Column>
|
|
46
|
+
<Button href="https://example.com">
|
|
47
|
+
A button
|
|
48
|
+
</Button>
|
|
49
|
+
</Column>
|
|
50
|
+
<Column>
|
|
51
|
+
<Link href="https://example.com">
|
|
52
|
+
A link
|
|
53
|
+
</Link>
|
|
54
|
+
</Column>
|
|
55
|
+
</Row>
|
|
56
|
+
</>;
|
|
57
|
+
}
|
|
58
|
+
`;
|
|
59
|
+
var emptyEmailTheme = import_strings.deindent`
|
|
60
|
+
import { Html, Tailwind, Body } from '@react-email/components';
|
|
61
|
+
export function EmailTheme({ children }: { children: React.ReactNode }) {
|
|
62
|
+
return (
|
|
63
|
+
<Html>
|
|
64
|
+
<Tailwind>
|
|
65
|
+
<Body>
|
|
66
|
+
{children}
|
|
67
|
+
</Body>
|
|
68
|
+
</Tailwind>
|
|
69
|
+
</Html>
|
|
41
70
|
);
|
|
42
71
|
}
|
|
43
72
|
`;
|
|
44
|
-
var LightEmailTheme = `import { Html, Tailwind, Body } from '@react-email/components';
|
|
45
|
-
|
|
73
|
+
var LightEmailTheme = `import { Html, Head, Tailwind, Body, Container, Link } from '@react-email/components';
|
|
74
|
+
import { ThemeProps } from "@stackframe/emails"
|
|
75
|
+
|
|
76
|
+
export function EmailTheme({ children, unsubscribeLink }: ThemeProps) {
|
|
46
77
|
return (
|
|
47
78
|
<Html>
|
|
79
|
+
<Head />
|
|
48
80
|
<Tailwind>
|
|
49
|
-
<Body>
|
|
50
|
-
<
|
|
81
|
+
<Body className="bg-[#fafbfb] font-sans text-base">
|
|
82
|
+
<Container className="bg-white p-[45px] rounded-lg">
|
|
51
83
|
{children}
|
|
52
|
-
</
|
|
84
|
+
</Container>
|
|
85
|
+
{unsubscribeLink && (
|
|
86
|
+
<div className="p-4">
|
|
87
|
+
<Link href={unsubscribeLink}>Click here{" "}</Link>
|
|
88
|
+
to unsubscribe from these emails
|
|
89
|
+
</div>
|
|
90
|
+
)}
|
|
53
91
|
</Body>
|
|
54
92
|
</Tailwind>
|
|
55
93
|
</Html>
|
|
56
94
|
);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
EmailTheme.PreviewProps = {
|
|
98
|
+
unsubscribeLink: "https://example.com"
|
|
99
|
+
} satisfies Partial<ThemeProps>
|
|
100
|
+
`;
|
|
101
|
+
var DarkEmailTheme = `import { Html, Head, Tailwind, Body, Container, Link } from '@react-email/components';
|
|
102
|
+
import { ThemeProps } from "@stackframe/emails"
|
|
103
|
+
|
|
104
|
+
export function EmailTheme({ children, unsubscribeLink }: ThemeProps) {
|
|
60
105
|
return (
|
|
61
106
|
<Html>
|
|
107
|
+
<Head />
|
|
62
108
|
<Tailwind>
|
|
63
|
-
<Body>
|
|
64
|
-
<
|
|
109
|
+
<Body className="bg-[#323232] font-sans text-white">
|
|
110
|
+
<Container className="bg-black p-[45px] rounded-lg">
|
|
65
111
|
{children}
|
|
66
|
-
</
|
|
112
|
+
</Container>
|
|
113
|
+
{unsubscribeLink && (
|
|
114
|
+
<div className="p-4">
|
|
115
|
+
<Link href={unsubscribeLink}>Click here{" "}</Link>
|
|
116
|
+
to unsubscribe from these emails
|
|
117
|
+
</div>
|
|
118
|
+
)}
|
|
67
119
|
</Body>
|
|
68
120
|
</Tailwind>
|
|
69
121
|
</Html>
|
|
70
122
|
);
|
|
71
|
-
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
EmailTheme.PreviewProps = {
|
|
126
|
+
unsubscribeLink: "https://example.com"
|
|
127
|
+
} satisfies Partial<ThemeProps>
|
|
128
|
+
`;
|
|
72
129
|
var DEFAULT_EMAIL_THEME_ID = "1df07ae6-abf3-4a40-83a5-a1a2cbe336ac";
|
|
73
130
|
var DEFAULT_EMAIL_THEMES = {
|
|
74
131
|
[DEFAULT_EMAIL_THEME_ID]: {
|
|
@@ -80,29 +137,104 @@ var DEFAULT_EMAIL_THEMES = {
|
|
|
80
137
|
tsxSource: DarkEmailTheme
|
|
81
138
|
}
|
|
82
139
|
};
|
|
140
|
+
var EMAIL_TEMPLATE_EMAIL_VERIFICATION_ID = "e7d009ce-8d47-4528-b245-5bf119f2ffa3";
|
|
141
|
+
var EMAIL_TEMPLATE_PASSWORD_RESET_ID = "a70fb3a4-56c1-4e42-af25-49d25603abd0";
|
|
142
|
+
var EMAIL_TEMPLATE_MAGIC_LINK_ID = "822687fe-8d0a-4467-a0d1-416b6e639478";
|
|
143
|
+
var EMAIL_TEMPLATE_TEAM_INVITATION_ID = "e84de395-2076-4831-9c19-8e9a96a868e4";
|
|
144
|
+
var EMAIL_TEMPLATE_SIGN_IN_INVITATION_ID = "066dd73c-36da-4fd0-b6d6-ebf87683f8bc";
|
|
83
145
|
var DEFAULT_EMAIL_TEMPLATES = {
|
|
84
|
-
|
|
85
|
-
displayName: "Email Verification",
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
146
|
+
[EMAIL_TEMPLATE_EMAIL_VERIFICATION_ID]: {
|
|
147
|
+
"displayName": "Email Verification",
|
|
148
|
+
"tsxSource": 'import { type } from "arktype"\nimport { Button, Section, Hr } from "@react-email/components";\nimport { Subject, NotificationCategory, Props } from "@stackframe/emails";\n\nexport const variablesSchema = type({\n emailVerificationLink: "string"\n})\n\nexport function EmailTemplate({ user, project, variables }: Props<typeof variablesSchema.infer>) {\n return (\n <>\n <Subject value={`Verify your email at ${project.displayName}`} />\n <NotificationCategory value="Transactional" />\n <div className="bg-white text-[#242424] font-sans text-base font-normal tracking-[0.15008px] leading-[1.5] m-0 py-8 w-full min-h-full">\n <Section className="bg-white">\n <h3 className="text-black font-sans font-bold text-[20px] text-center py-4 px-6 m-0">\n Verify your email at {project.displayName}\n </h3>\n <p className="text-[#474849] font-sans font-normal text-[14px] text-center pt-2 px-6 pb-4 m-0">\n Hi{user.displayName ? (", " + user.displayName) : \'\'}! Please click on the following button to verify your email.\n </p>\n <div className="text-center py-3 px-6">\n <Button\n href={variables.emailVerificationLink}\n target="_blank"\n className="text-black font-sans font-bold text-[14px] inline-block bg-[#f0f0f0] rounded-[4px] py-3 px-5 no-underline border-0"\n >\n Verify my email\n </Button>\n </div>\n <div className="py-4 px-6">\n <Hr />\n </div>\n <p className="text-[#474849] font-sans font-normal text-[12px] text-center pt-1 px-6 pb-6 m-0">\n If you were not expecting this email, you can safely ignore it. \n </p>\n </Section>\n </div>\n </>\n )\n}\n\nEmailTemplate.PreviewVariables = {\n emailVerificationLink: "<email verification link>"\n} satisfies typeof variablesSchema.infer',
|
|
149
|
+
"themeId": void 0
|
|
150
|
+
},
|
|
151
|
+
[EMAIL_TEMPLATE_PASSWORD_RESET_ID]: {
|
|
152
|
+
"displayName": "Password Reset",
|
|
153
|
+
"tsxSource": 'import { type } from "arktype"\nimport { Button, Section, Hr } from "@react-email/components"\nimport { Subject, NotificationCategory, Props} from "@stackframe/emails"\n\nexport const variablesSchema = type({\n passwordResetLink: "string"\n})\n\nexport function EmailTemplate({ user, project, variables }: Props<typeof variablesSchema.infer>) {\n return (\n <>\n <Subject value={"Reset your password at " + project.displayName} />\n <NotificationCategory value="Transactional" />\n <div className="bg-white text-[#242424] font-sans text-base font-normal tracking-tight leading-relaxed py-8 w-full min-h-full">\n <Section>\n <h3 className="text-black bg-transparent font-sans font-bold text-[20px] text-center py-4 px-6 m-0">\n Reset your password at {project.displayName}\n </h3>\n\n <p className="text-[#474849] bg-transparent text-sm font-sans font-normal text-center pt-2 pb-4 px-6 m-0">\n Hi{user.displayName ? (", " + user.displayName) : ""}! Please click on the following button to start the password reset process.\n </p>\n\n <div className="bg-transparent text-center px-6 py-3">\n <Button\n href={variables.passwordResetLink}\n className="text-black text-sm font-sans font-bold bg-[#f0f0f0] rounded-[4px] inline-block py-3 px-5 no-underline border-none"\n target="_blank"\n >\n Reset my password\n </Button>\n </div>\n\n <div className="px-6 py-4">\n <Hr />\n </div>\n\n <p className="text-[#474849] bg-transparent text-xs font-sans font-normal text-center pt-1 pb-6 px-6 m-0">\n If you were not expecting this email, you can safely ignore it.\n </p>\n </Section>\n </div>\n </>\n )\n}\n\nEmailTemplate.PreviewVariables = {\n passwordResetLink: "<password reset link>"\n} satisfies typeof variablesSchema.infer',
|
|
154
|
+
"themeId": void 0
|
|
155
|
+
},
|
|
156
|
+
[EMAIL_TEMPLATE_MAGIC_LINK_ID]: {
|
|
157
|
+
"displayName": "Magic Link/OTP",
|
|
158
|
+
"tsxSource": `import { type } from 'arktype';
|
|
159
|
+
import { Section, Hr } from '@react-email/components';
|
|
160
|
+
import { Subject, NotificationCategory, Props } from '@stackframe/emails';
|
|
161
|
+
|
|
162
|
+
export const variablesSchema = type({
|
|
163
|
+
magicLink: 'string',
|
|
164
|
+
otp: 'string',
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
export function EmailTemplate({ user, project, variables }: Props<typeof variablesSchema.infer>) {
|
|
168
|
+
return (
|
|
169
|
+
<>
|
|
170
|
+
<Subject value={"Sign in to " + project.displayName + ": Your code is " + variables.otp} />
|
|
171
|
+
<NotificationCategory value="Transactional" />
|
|
172
|
+
<div className="bg-white text-[#242424] font-sans text-base font-normal tracking-[0.15008px] leading-6 m-0 py-8 w-full min-h-full">
|
|
173
|
+
<Section className="mx-auto bg-white">
|
|
174
|
+
<h3 className="text-black bg-transparent font-sans font-bold text-xl text-center px-6 py-4 m-0">
|
|
175
|
+
Sign in to {project.displayName}
|
|
176
|
+
</h3>
|
|
177
|
+
<p className="text-[#474849] bg-transparent text-sm font-sans font-normal text-center px-6 py-4 m-0">
|
|
178
|
+
Hi{user.displayName ? ", " + user.displayName : ""}! This is your one-time-password for signing in:
|
|
179
|
+
</p>
|
|
180
|
+
<p className="text-black bg-transparent text-2xl font-mono font-bold text-center px-6 py-4 m-0">
|
|
181
|
+
{variables.otp}
|
|
182
|
+
</p>
|
|
183
|
+
<p className="text-black bg-transparent text-sm font-sans font-normal text-center px-6 py-4 m-0">
|
|
184
|
+
Or you can click on{' '}
|
|
185
|
+
<a
|
|
186
|
+
key={20}
|
|
187
|
+
href={variables.magicLink}
|
|
188
|
+
target="_blank"
|
|
189
|
+
rel="noopener noreferrer"
|
|
190
|
+
className="text-blue-600 underline"
|
|
191
|
+
>
|
|
192
|
+
this link
|
|
193
|
+
</a>{' '}
|
|
194
|
+
to sign in
|
|
195
|
+
</p>
|
|
196
|
+
<Hr className="px-6 py-4 bg-transparent" />
|
|
197
|
+
<p className="text-[#474849] bg-transparent text-xs font-sans font-normal text-center px-6 pt-1 pb-6 m-0">
|
|
198
|
+
If you were not expecting this email, you can safely ignore it.
|
|
199
|
+
</p>
|
|
200
|
+
</Section>
|
|
201
|
+
</div>
|
|
202
|
+
</>
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
EmailTemplate.PreviewVariables = {
|
|
207
|
+
magicLink: "<magic link>",
|
|
208
|
+
otp: "3SLSWZ"
|
|
209
|
+
} satisfies typeof variablesSchema.infer`,
|
|
210
|
+
"themeId": void 0
|
|
211
|
+
},
|
|
212
|
+
[EMAIL_TEMPLATE_TEAM_INVITATION_ID]: {
|
|
213
|
+
"displayName": "Team Invitation",
|
|
214
|
+
"tsxSource": 'import { type } from "arktype";\nimport { Button, Section, Hr } from "@react-email/components";\nimport { Subject, NotificationCategory, Props } from "@stackframe/emails";\n\n\nexport const variablesSchema = type({\n teamDisplayName: "string",\n teamInvitationLink: "string"\n});\n\nexport function EmailTemplate({ user, variables }: Props<typeof variablesSchema.infer>) {\n return (\n <>\n <Subject value={"You have been invited to join " + variables.teamDisplayName} />\n <NotificationCategory value="Transactional" />\n <div className="bg-white text-[#242424] font-sans text-base font-normal tracking-[0.15008px] leading-[1.5] m-0 py-8 w-full min-h-full">\n <Section className="mx-auto max-w-lg bg-white">\n <h3 className="text-black bg-transparent font-sans font-bold text-xl text-center px-6 pt-8 m-0">\n You are invited to {variables.teamDisplayName}\n </h3>\n <p className="text-[#474849] bg-transparent text-sm font-sans font-normal text-center px-6 pt-2 pb-4 m-0">\n Hi{user.displayName ? ", " + user.displayName : ""}! Please click the button below to join the team {variables.teamDisplayName}\n </p>\n <div className="bg-transparent text-center px-6 py-3">\n <Button\n href={variables.teamInvitationLink}\n target="_blank"\n className="text-black text-sm font-sans font-bold bg-[#f0f0f0] rounded-md inline-block px-5 py-3 no-underline border-0"\n >\n Join team\n </Button>\n </div>\n <div className="px-6 py-4 bg-transparent">\n <Hr />\n </div>\n <p className="text-[#474849] bg-transparent text-xs font-sans font-normal text-center px-6 pb-6 pt-1 m-0">\n If you were not expecting this email, you can safely ignore it.\n </p>\n </Section>\n </div>\n </>\n );\n}\n\nEmailTemplate.PreviewVariables = {\n teamDisplayName: "My Team",\n teamInvitationLink: "<team invitation link>"\n} satisfies typeof variablesSchema.infer ',
|
|
215
|
+
"themeId": void 0
|
|
216
|
+
},
|
|
217
|
+
[EMAIL_TEMPLATE_SIGN_IN_INVITATION_ID]: {
|
|
218
|
+
"displayName": "Sign In Invitation",
|
|
219
|
+
"tsxSource": 'import { type } from "arktype"\nimport { Button, Section, Hr } from "@react-email/components";\nimport { Subject, NotificationCategory, Props } from "@stackframe/emails";\n\nexport const variablesSchema = type({\n signInInvitationLink: "string",\n teamDisplayName: "string"\n})\n\nexport function EmailTemplate({ user, project, variables }: Props<typeof variablesSchema.infer>) {\n return (\n <>\n <Subject\n value={"You have been invited to sign in to " + project.displayName}\n />\n <NotificationCategory value="Transactional" />\n\n <div className="bg-white text-gray-900 font-sans text-base font-normal leading-normal w-full min-h-full m-0 py-8">\n <Section>\n <h3 className="text-black bg-transparent font-sans font-bold text-xl text-center pt-8 px-6 m-0">\n You are invited to sign in to {variables.teamDisplayName}\n </h3>\n\n <p className="text-gray-700 bg-transparent text-sm font-sans font-normal text-center pt-2 pb-4 px-6 m-0">\n Hi\n {user.displayName ? ", " + user.displayName : ""}! Please click on the following\n link to sign in to your account\n </p>\n\n <div className="bg-transparent text-center px-6 py-3">\n <Button\n href={variables.signInInvitationLink}\n className="text-black text-sm font-sans font-bold bg-gray-200 rounded-md inline-block py-3 px-5 no-underline border-none"\n target="_blank"\n >\n Sign in\n </Button>\n </div>\n\n <div className="px-6 py-4 bg-transparent">\n <Hr />\n </div>\n\n <p className="text-gray-700 bg-transparent text-xs font-sans font-normal text-center pt-1 pb-6 px-6 m-0">\n If you were not expecting this email, you can safely ignore it.\n </p>\n </Section>\n </div>\n </>\n )\n}\n\nEmailTemplate.PreviewVariables = {\n signInInvitationLink: "<sign in invitation link>",\n teamDisplayName: "My Team"\n} satisfies typeof variablesSchema.infer',
|
|
220
|
+
"themeId": void 0
|
|
90
221
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
// },
|
|
222
|
+
};
|
|
223
|
+
var DEFAULT_TEMPLATE_IDS = {
|
|
224
|
+
email_verification: EMAIL_TEMPLATE_EMAIL_VERIFICATION_ID,
|
|
225
|
+
password_reset: EMAIL_TEMPLATE_PASSWORD_RESET_ID,
|
|
226
|
+
magic_link: EMAIL_TEMPLATE_MAGIC_LINK_ID,
|
|
227
|
+
team_invitation: EMAIL_TEMPLATE_TEAM_INVITATION_ID,
|
|
228
|
+
sign_in_invitation: EMAIL_TEMPLATE_SIGN_IN_INVITATION_ID
|
|
99
229
|
};
|
|
100
230
|
// Annotate the CommonJS export names for ESM import in node:
|
|
101
231
|
0 && (module.exports = {
|
|
102
232
|
DEFAULT_EMAIL_TEMPLATES,
|
|
103
233
|
DEFAULT_EMAIL_THEMES,
|
|
104
234
|
DEFAULT_EMAIL_THEME_ID,
|
|
235
|
+
DEFAULT_TEMPLATE_IDS,
|
|
105
236
|
LightEmailTheme,
|
|
237
|
+
emptyEmailTheme,
|
|
106
238
|
previewTemplateSource
|
|
107
239
|
});
|
|
108
240
|
//# sourceMappingURL=emails.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/helpers/emails.ts"],"sourcesContent":["export const previewTemplateSource = `\n export function EmailTemplate() {\n return (\n <div>\n <h2 className=\"mb-4 text-2xl font-bold\">\n Header text\n </h2>\n <p className=\"mb-4\">\n Body text content with some additional information.\n </p>\n </div>\n );\n }\n`;\n\nexport const LightEmailTheme = `import { Html, Tailwind, Body } from '@react-email/components';\nexport function EmailTheme({ children }: { children: React.ReactNode }) {\n return (\n <Html>\n <Tailwind>\n <Body>\n <div className=\"bg-white text-slate-800 p-4 rounded-lg max-w-[600px] mx-auto leading-relaxed\">\n {children}\n </div>\n </Body>\n </Tailwind>\n </Html>\n );\n}`;\n\n\nconst DarkEmailTheme = `import { Html, Tailwind, Body } from '@react-email/components';\nexport function EmailTheme({ children }: { children: React.ReactNode }) {\n return (\n <Html>\n <Tailwind>\n <Body>\n <div className=\"bg-slate-900 text-slate-100 p-4 rounded-lg max-w-[600px] mx-auto leading-relaxed\">\n {children}\n </div>\n </Body>\n </Tailwind>\n </Html>\n );\n}`;\n\nexport const DEFAULT_EMAIL_THEME_ID = \"1df07ae6-abf3-4a40-83a5-a1a2cbe336ac\";\n\nexport const DEFAULT_EMAIL_THEMES = {\n [DEFAULT_EMAIL_THEME_ID]: {\n displayName: 'Default Light',\n tsxSource: LightEmailTheme,\n },\n \"a0172b5d-cff0-463b-83bb-85124697373a\": {\n displayName: 'Default Dark',\n tsxSource: DarkEmailTheme,\n },\n};\n\nexport const DEFAULT_EMAIL_TEMPLATES = {\n \"e7d009ce-8d47-4528-b245-5bf119f2ffa3\": {\n displayName: \"Email Verification\",\n description: \"Will be sent to the user when they sign-up with email/password\",\n variables: [\"projectDisplayName\"],\n subject: \"Welcome to {{ projectDisplayName }}\",\n tsxSource: \"export function EmailTemplate({ projectDisplayName }) {\\n return <div>Email Verification for { projectDisplayName }</div>; \\n}\",\n },\n // \"a70fb3a4-56c1-4e42-af25-49d25603abd0\": {\n\n // },\n // \"822687fe-8d0a-4467-a0d1-416b6e639478\": {\n\n // },\n // \"066dd73c-36da-4fd0-b6d6-ebf87683f8bc\": {\n\n // },\n // \"e84de395-2076-4831-9c19-8e9a96a868e4\": {\n\n // },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,IAAM,wBAAwB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAe9B,IAAM,kBAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgB/B,IAAM,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAehB,IAAM,yBAAyB;AAE/B,IAAM,uBAAuB;AAAA,EAClC,CAAC,sBAAsB,GAAG;AAAA,IACxB,aAAa;AAAA,IACb,WAAW;AAAA,EACb;AAAA,EACA,wCAAwC;AAAA,IACtC,aAAa;AAAA,IACb,WAAW;AAAA,EACb;AACF;AAEO,IAAM,0BAA0B;AAAA,EACrC,wCAAwC;AAAA,IACtC,aAAa;AAAA,IACb,aAAa;AAAA,IACb,WAAW,CAAC,oBAAoB;AAAA,IAChC,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/helpers/emails.ts"],"sourcesContent":["import { deindent } from \"../utils/strings\";\n\nexport const previewTemplateSource = deindent`\n import { Heading, Section, Row, Button, Link, Column } from \"@react-email/components\";\n export const variablesSchema = v => v;\n export function EmailTemplate() {\n return <>\n <Heading as=\"h2\" className=\"mb-4 text-2xl font-bold\">\n Header text\n </Heading>\n <Section className=\"mb-4\">\n Body text content with some additional information.\n </Section>\n <Row className=\"mb-4\">\n <Column>\n <Button href=\"https://example.com\">\n A button\n </Button>\n </Column>\n <Column>\n <Link href=\"https://example.com\">\n A link\n </Link>\n </Column>\n </Row>\n </>;\n }\n`;\n\nexport const emptyEmailTheme = deindent`\n import { Html, Tailwind, Body } from '@react-email/components';\n export function EmailTheme({ children }: { children: React.ReactNode }) {\n return (\n <Html>\n <Tailwind>\n <Body>\n {children}\n </Body>\n </Tailwind>\n </Html>\n );\n }\n`;\n\nexport const LightEmailTheme = `import { Html, Head, Tailwind, Body, Container, Link } from '@react-email/components';\nimport { ThemeProps } from \"@stackframe/emails\"\n\nexport function EmailTheme({ children, unsubscribeLink }: ThemeProps) {\n return (\n <Html>\n <Head />\n <Tailwind>\n <Body className=\"bg-[#fafbfb] font-sans text-base\">\n <Container className=\"bg-white p-[45px] rounded-lg\">\n {children}\n </Container>\n {unsubscribeLink && (\n <div className=\"p-4\">\n <Link href={unsubscribeLink}>Click here{\" \"}</Link>\n to unsubscribe from these emails\n </div>\n )}\n </Body>\n </Tailwind>\n </Html>\n );\n}\n\nEmailTheme.PreviewProps = {\n unsubscribeLink: \"https://example.com\"\n} satisfies Partial<ThemeProps>\n`;\n\n\nconst DarkEmailTheme = `import { Html, Head, Tailwind, Body, Container, Link } from '@react-email/components';\nimport { ThemeProps } from \"@stackframe/emails\"\n\nexport function EmailTheme({ children, unsubscribeLink }: ThemeProps) {\n return (\n <Html>\n <Head />\n <Tailwind>\n <Body className=\"bg-[#323232] font-sans text-white\">\n <Container className=\"bg-black p-[45px] rounded-lg\">\n {children}\n </Container>\n {unsubscribeLink && (\n <div className=\"p-4\">\n <Link href={unsubscribeLink}>Click here{\" \"}</Link>\n to unsubscribe from these emails\n </div>\n )}\n </Body>\n </Tailwind>\n </Html>\n );\n}\n\nEmailTheme.PreviewProps = {\n unsubscribeLink: \"https://example.com\"\n} satisfies Partial<ThemeProps>\n`;\n\n\nexport const DEFAULT_EMAIL_THEME_ID = \"1df07ae6-abf3-4a40-83a5-a1a2cbe336ac\";\n\nexport const DEFAULT_EMAIL_THEMES = {\n [DEFAULT_EMAIL_THEME_ID]: {\n displayName: 'Default Light',\n tsxSource: LightEmailTheme,\n },\n \"a0172b5d-cff0-463b-83bb-85124697373a\": {\n displayName: 'Default Dark',\n tsxSource: DarkEmailTheme,\n },\n};\n\nconst EMAIL_TEMPLATE_EMAIL_VERIFICATION_ID = \"e7d009ce-8d47-4528-b245-5bf119f2ffa3\";\nconst EMAIL_TEMPLATE_PASSWORD_RESET_ID = \"a70fb3a4-56c1-4e42-af25-49d25603abd0\";\nconst EMAIL_TEMPLATE_MAGIC_LINK_ID = \"822687fe-8d0a-4467-a0d1-416b6e639478\";\nconst EMAIL_TEMPLATE_TEAM_INVITATION_ID = \"e84de395-2076-4831-9c19-8e9a96a868e4\";\nconst EMAIL_TEMPLATE_SIGN_IN_INVITATION_ID = \"066dd73c-36da-4fd0-b6d6-ebf87683f8bc\";\n\nexport const DEFAULT_EMAIL_TEMPLATES = {\n [EMAIL_TEMPLATE_EMAIL_VERIFICATION_ID]: {\n \"displayName\": \"Email Verification\",\n \"tsxSource\": \"import { type } from \\\"arktype\\\"\\nimport { Button, Section, Hr } from \\\"@react-email/components\\\";\\nimport { Subject, NotificationCategory, Props } from \\\"@stackframe/emails\\\";\\n\\nexport const variablesSchema = type({\\n emailVerificationLink: \\\"string\\\"\\n})\\n\\nexport function EmailTemplate({ user, project, variables }: Props<typeof variablesSchema.infer>) {\\n return (\\n <>\\n <Subject value={`Verify your email at ${project.displayName}`} />\\n <NotificationCategory value=\\\"Transactional\\\" />\\n <div className=\\\"bg-white text-[#242424] font-sans text-base font-normal tracking-[0.15008px] leading-[1.5] m-0 py-8 w-full min-h-full\\\">\\n <Section className=\\\"bg-white\\\">\\n <h3 className=\\\"text-black font-sans font-bold text-[20px] text-center py-4 px-6 m-0\\\">\\n Verify your email at {project.displayName}\\n </h3>\\n <p className=\\\"text-[#474849] font-sans font-normal text-[14px] text-center pt-2 px-6 pb-4 m-0\\\">\\n Hi{user.displayName ? (\\\", \\\" + user.displayName) : ''}! Please click on the following button to verify your email.\\n </p>\\n <div className=\\\"text-center py-3 px-6\\\">\\n <Button\\n href={variables.emailVerificationLink}\\n target=\\\"_blank\\\"\\n className=\\\"text-black font-sans font-bold text-[14px] inline-block bg-[#f0f0f0] rounded-[4px] py-3 px-5 no-underline border-0\\\"\\n >\\n Verify my email\\n </Button>\\n </div>\\n <div className=\\\"py-4 px-6\\\">\\n <Hr />\\n </div>\\n <p className=\\\"text-[#474849] font-sans font-normal text-[12px] text-center pt-1 px-6 pb-6 m-0\\\">\\n If you were not expecting this email, you can safely ignore it. \\n </p>\\n </Section>\\n </div>\\n </>\\n )\\n}\\n\\nEmailTemplate.PreviewVariables = {\\n emailVerificationLink: \\\"<email verification link>\\\"\\n} satisfies typeof variablesSchema.infer\",\n \"themeId\": undefined,\n },\n [EMAIL_TEMPLATE_PASSWORD_RESET_ID]: {\n \"displayName\": \"Password Reset\",\n \"tsxSource\": \"import { type } from \\\"arktype\\\"\\nimport { Button, Section, Hr } from \\\"@react-email/components\\\"\\nimport { Subject, NotificationCategory, Props} from \\\"@stackframe/emails\\\"\\n\\nexport const variablesSchema = type({\\n passwordResetLink: \\\"string\\\"\\n})\\n\\nexport function EmailTemplate({ user, project, variables }: Props<typeof variablesSchema.infer>) {\\n return (\\n <>\\n <Subject value={\\\"Reset your password at \\\" + project.displayName} />\\n <NotificationCategory value=\\\"Transactional\\\" />\\n <div className=\\\"bg-white text-[#242424] font-sans text-base font-normal tracking-tight leading-relaxed py-8 w-full min-h-full\\\">\\n <Section>\\n <h3 className=\\\"text-black bg-transparent font-sans font-bold text-[20px] text-center py-4 px-6 m-0\\\">\\n Reset your password at {project.displayName}\\n </h3>\\n\\n <p className=\\\"text-[#474849] bg-transparent text-sm font-sans font-normal text-center pt-2 pb-4 px-6 m-0\\\">\\n Hi{user.displayName ? (\\\", \\\" + user.displayName) : \\\"\\\"}! Please click on the following button to start the password reset process.\\n </p>\\n\\n <div className=\\\"bg-transparent text-center px-6 py-3\\\">\\n <Button\\n href={variables.passwordResetLink}\\n className=\\\"text-black text-sm font-sans font-bold bg-[#f0f0f0] rounded-[4px] inline-block py-3 px-5 no-underline border-none\\\"\\n target=\\\"_blank\\\"\\n >\\n Reset my password\\n </Button>\\n </div>\\n\\n <div className=\\\"px-6 py-4\\\">\\n <Hr />\\n </div>\\n\\n <p className=\\\"text-[#474849] bg-transparent text-xs font-sans font-normal text-center pt-1 pb-6 px-6 m-0\\\">\\n If you were not expecting this email, you can safely ignore it.\\n </p>\\n </Section>\\n </div>\\n </>\\n )\\n}\\n\\nEmailTemplate.PreviewVariables = {\\n passwordResetLink: \\\"<password reset link>\\\"\\n} satisfies typeof variablesSchema.infer\",\n \"themeId\": undefined,\n },\n [EMAIL_TEMPLATE_MAGIC_LINK_ID]: {\n \"displayName\": \"Magic Link/OTP\",\n \"tsxSource\": \"import { type } from 'arktype';\\nimport { Section, Hr } from '@react-email/components';\\nimport { Subject, NotificationCategory, Props } from '@stackframe/emails';\\n\\nexport const variablesSchema = type({\\n magicLink: 'string',\\n otp: 'string',\\n});\\n\\nexport function EmailTemplate({ user, project, variables }: Props<typeof variablesSchema.infer>) {\\n return (\\n <>\\n <Subject value={\\\"Sign in to \\\" + project.displayName + \\\": Your code is \\\" + variables.otp} />\\n <NotificationCategory value=\\\"Transactional\\\" />\\n <div className=\\\"bg-white text-[#242424] font-sans text-base font-normal tracking-[0.15008px] leading-6 m-0 py-8 w-full min-h-full\\\">\\n <Section className=\\\"mx-auto bg-white\\\">\\n <h3 className=\\\"text-black bg-transparent font-sans font-bold text-xl text-center px-6 py-4 m-0\\\">\\n Sign in to {project.displayName}\\n </h3>\\n <p className=\\\"text-[#474849] bg-transparent text-sm font-sans font-normal text-center px-6 py-4 m-0\\\">\\n Hi{user.displayName ? \\\", \\\" + user.displayName : \\\"\\\"}! This is your one-time-password for signing in:\\n </p>\\n <p className=\\\"text-black bg-transparent text-2xl font-mono font-bold text-center px-6 py-4 m-0\\\">\\n {variables.otp}\\n </p>\\n <p className=\\\"text-black bg-transparent text-sm font-sans font-normal text-center px-6 py-4 m-0\\\">\\n Or you can click on{' '}\\n <a\\n key={20}\\n href={variables.magicLink}\\n target=\\\"_blank\\\"\\n rel=\\\"noopener noreferrer\\\"\\n className=\\\"text-blue-600 underline\\\"\\n >\\n this link\\n </a>{' '}\\n to sign in\\n </p>\\n <Hr className=\\\"px-6 py-4 bg-transparent\\\" />\\n <p className=\\\"text-[#474849] bg-transparent text-xs font-sans font-normal text-center px-6 pt-1 pb-6 m-0\\\">\\n If you were not expecting this email, you can safely ignore it.\\n </p>\\n </Section>\\n </div>\\n </>\\n );\\n}\\n\\nEmailTemplate.PreviewVariables = {\\n magicLink: \\\"<magic link>\\\",\\n otp: \\\"3SLSWZ\\\"\\n} satisfies typeof variablesSchema.infer\",\n \"themeId\": undefined,\n },\n [EMAIL_TEMPLATE_TEAM_INVITATION_ID]: {\n \"displayName\": \"Team Invitation\",\n \"tsxSource\": \"import { type } from \\\"arktype\\\";\\nimport { Button, Section, Hr } from \\\"@react-email/components\\\";\\nimport { Subject, NotificationCategory, Props } from \\\"@stackframe/emails\\\";\\n\\n\\nexport const variablesSchema = type({\\n teamDisplayName: \\\"string\\\",\\n teamInvitationLink: \\\"string\\\"\\n});\\n\\nexport function EmailTemplate({ user, variables }: Props<typeof variablesSchema.infer>) {\\n return (\\n <>\\n <Subject value={\\\"You have been invited to join \\\" + variables.teamDisplayName} />\\n <NotificationCategory value=\\\"Transactional\\\" />\\n <div className=\\\"bg-white text-[#242424] font-sans text-base font-normal tracking-[0.15008px] leading-[1.5] m-0 py-8 w-full min-h-full\\\">\\n <Section className=\\\"mx-auto max-w-lg bg-white\\\">\\n <h3 className=\\\"text-black bg-transparent font-sans font-bold text-xl text-center px-6 pt-8 m-0\\\">\\n You are invited to {variables.teamDisplayName}\\n </h3>\\n <p className=\\\"text-[#474849] bg-transparent text-sm font-sans font-normal text-center px-6 pt-2 pb-4 m-0\\\">\\n Hi{user.displayName ? \\\", \\\" + user.displayName : \\\"\\\"}! Please click the button below to join the team {variables.teamDisplayName}\\n </p>\\n <div className=\\\"bg-transparent text-center px-6 py-3\\\">\\n <Button\\n href={variables.teamInvitationLink}\\n target=\\\"_blank\\\"\\n className=\\\"text-black text-sm font-sans font-bold bg-[#f0f0f0] rounded-md inline-block px-5 py-3 no-underline border-0\\\"\\n >\\n Join team\\n </Button>\\n </div>\\n <div className=\\\"px-6 py-4 bg-transparent\\\">\\n <Hr />\\n </div>\\n <p className=\\\"text-[#474849] bg-transparent text-xs font-sans font-normal text-center px-6 pb-6 pt-1 m-0\\\">\\n If you were not expecting this email, you can safely ignore it.\\n </p>\\n </Section>\\n </div>\\n </>\\n );\\n}\\n\\nEmailTemplate.PreviewVariables = {\\n teamDisplayName: \\\"My Team\\\",\\n teamInvitationLink: \\\"<team invitation link>\\\"\\n} satisfies typeof variablesSchema.infer \",\n \"themeId\": undefined,\n },\n [EMAIL_TEMPLATE_SIGN_IN_INVITATION_ID]: {\n \"displayName\": \"Sign In Invitation\",\n \"tsxSource\": \"import { type } from \\\"arktype\\\"\\nimport { Button, Section, Hr } from \\\"@react-email/components\\\";\\nimport { Subject, NotificationCategory, Props } from \\\"@stackframe/emails\\\";\\n\\nexport const variablesSchema = type({\\n signInInvitationLink: \\\"string\\\",\\n teamDisplayName: \\\"string\\\"\\n})\\n\\nexport function EmailTemplate({ user, project, variables }: Props<typeof variablesSchema.infer>) {\\n return (\\n <>\\n <Subject\\n value={\\\"You have been invited to sign in to \\\" + project.displayName}\\n />\\n <NotificationCategory value=\\\"Transactional\\\" />\\n\\n <div className=\\\"bg-white text-gray-900 font-sans text-base font-normal leading-normal w-full min-h-full m-0 py-8\\\">\\n <Section>\\n <h3 className=\\\"text-black bg-transparent font-sans font-bold text-xl text-center pt-8 px-6 m-0\\\">\\n You are invited to sign in to {variables.teamDisplayName}\\n </h3>\\n\\n <p className=\\\"text-gray-700 bg-transparent text-sm font-sans font-normal text-center pt-2 pb-4 px-6 m-0\\\">\\n Hi\\n {user.displayName ? \\\", \\\" + user.displayName : \\\"\\\"}! Please click on the following\\n link to sign in to your account\\n </p>\\n\\n <div className=\\\"bg-transparent text-center px-6 py-3\\\">\\n <Button\\n href={variables.signInInvitationLink}\\n className=\\\"text-black text-sm font-sans font-bold bg-gray-200 rounded-md inline-block py-3 px-5 no-underline border-none\\\"\\n target=\\\"_blank\\\"\\n >\\n Sign in\\n </Button>\\n </div>\\n\\n <div className=\\\"px-6 py-4 bg-transparent\\\">\\n <Hr />\\n </div>\\n\\n <p className=\\\"text-gray-700 bg-transparent text-xs font-sans font-normal text-center pt-1 pb-6 px-6 m-0\\\">\\n If you were not expecting this email, you can safely ignore it.\\n </p>\\n </Section>\\n </div>\\n </>\\n )\\n}\\n\\nEmailTemplate.PreviewVariables = {\\n signInInvitationLink: \\\"<sign in invitation link>\\\",\\n teamDisplayName: \\\"My Team\\\"\\n} satisfies typeof variablesSchema.infer\",\n \"themeId\": undefined,\n }\n};\n\nexport const DEFAULT_TEMPLATE_IDS = {\n email_verification: EMAIL_TEMPLATE_EMAIL_VERIFICATION_ID,\n password_reset: EMAIL_TEMPLATE_PASSWORD_RESET_ID,\n magic_link: EMAIL_TEMPLATE_MAGIC_LINK_ID,\n team_invitation: EMAIL_TEMPLATE_TEAM_INVITATION_ID,\n sign_in_invitation: EMAIL_TEMPLATE_SIGN_IN_INVITATION_ID,\n} as const;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAyB;AAElB,IAAM,wBAAwB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA2B9B,IAAM,kBAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAexB,IAAM,kBAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA8B/B,IAAM,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA8BhB,IAAM,yBAAyB;AAE/B,IAAM,uBAAuB;AAAA,EAClC,CAAC,sBAAsB,GAAG;AAAA,IACxB,aAAa;AAAA,IACb,WAAW;AAAA,EACb;AAAA,EACA,wCAAwC;AAAA,IACtC,aAAa;AAAA,IACb,WAAW;AAAA,EACb;AACF;AAEA,IAAM,uCAAuC;AAC7C,IAAM,mCAAmC;AACzC,IAAM,+BAA+B;AACrC,IAAM,oCAAoC;AAC1C,IAAM,uCAAuC;AAEtC,IAAM,0BAA0B;AAAA,EACrC,CAAC,oCAAoC,GAAG;AAAA,IACtC,eAAe;AAAA,IACf,aAAa;AAAA,IACb,WAAW;AAAA,EACb;AAAA,EACA,CAAC,gCAAgC,GAAG;AAAA,IAClC,eAAe;AAAA,IACf,aAAa;AAAA,IACb,WAAW;AAAA,EACb;AAAA,EACA,CAAC,4BAA4B,GAAG;AAAA,IAC9B,eAAe;AAAA,IACf,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IACb,WAAW;AAAA,EACb;AAAA,EACA,CAAC,iCAAiC,GAAG;AAAA,IACnC,eAAe;AAAA,IACf,aAAa;AAAA,IACb,WAAW;AAAA,EACb;AAAA,EACA,CAAC,oCAAoC,GAAG;AAAA,IACtC,eAAe;AAAA,IACf,aAAa;AAAA,IACb,WAAW;AAAA,EACb;AACF;AAEO,IAAM,uBAAuB;AAAA,EAClC,oBAAoB;AAAA,EACpB,gBAAgB;AAAA,EAChB,YAAY;AAAA,EACZ,iBAAiB;AAAA,EACjB,oBAAoB;AACtB;","names":[]}
|
package/dist/index.d.mts
CHANGED
|
@@ -4,10 +4,11 @@ export { StackServerInterface } from './interface/server-interface.mjs';
|
|
|
4
4
|
export { KnownError, KnownErrors } from './known-errors.mjs';
|
|
5
5
|
import './sessions.mjs';
|
|
6
6
|
import 'jose';
|
|
7
|
-
import './interface/crud/
|
|
7
|
+
import './interface/crud/config.mjs';
|
|
8
8
|
import './crud.mjs';
|
|
9
9
|
import 'yup';
|
|
10
10
|
import './utils/types.mjs';
|
|
11
|
+
import './utils/strings.mjs';
|
|
11
12
|
import './interface/crud/emails.mjs';
|
|
12
13
|
import './interface/crud/internal-api-keys.mjs';
|
|
13
14
|
import './interface/crud/project-permissions.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -4,10 +4,11 @@ export { StackServerInterface } from './interface/server-interface.js';
|
|
|
4
4
|
export { KnownError, KnownErrors } from './known-errors.js';
|
|
5
5
|
import './sessions.js';
|
|
6
6
|
import 'jose';
|
|
7
|
-
import './interface/crud/
|
|
7
|
+
import './interface/crud/config.js';
|
|
8
8
|
import './crud.js';
|
|
9
9
|
import 'yup';
|
|
10
10
|
import './utils/types.js';
|
|
11
|
+
import './utils/strings.js';
|
|
11
12
|
import './interface/crud/emails.js';
|
|
12
13
|
import './interface/crud/internal-api-keys.js';
|
|
13
14
|
import './interface/crud/project-permissions.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { InternalSession, AccessToken, RefreshToken } from '../sessions.mjs';
|
|
2
|
-
import {
|
|
2
|
+
import { ConfigCrud, ConfigOverrideCrud } from './crud/config.mjs';
|
|
3
3
|
import { InternalEmailsCrud } from './crud/emails.mjs';
|
|
4
4
|
import { InternalApiKeysCrud } from './crud/internal-api-keys.mjs';
|
|
5
5
|
import { ProjectPermissionDefinitionsCrud } from './crud/project-permissions.mjs';
|
|
@@ -13,6 +13,7 @@ import 'jose';
|
|
|
13
13
|
import '../crud.mjs';
|
|
14
14
|
import 'yup';
|
|
15
15
|
import '../utils/types.mjs';
|
|
16
|
+
import '../utils/strings.mjs';
|
|
16
17
|
import '../utils/results.mjs';
|
|
17
18
|
import './crud/connected-accounts.mjs';
|
|
18
19
|
import './crud/contact-channels.mjs';
|
|
@@ -72,19 +73,16 @@ declare class StackAdminInterface extends StackServerInterface {
|
|
|
72
73
|
listInternalApiKeys(): Promise<InternalApiKeysCrud["Admin"]["Read"][]>;
|
|
73
74
|
revokeInternalApiKeyById(id: string): Promise<void>;
|
|
74
75
|
getInternalApiKey(id: string, session: InternalSession): Promise<InternalApiKeysCrud["Admin"]["Read"]>;
|
|
75
|
-
|
|
76
|
-
listInternalEmailTemplatesNew(): Promise<{
|
|
76
|
+
listInternalEmailTemplates(): Promise<{
|
|
77
77
|
id: string;
|
|
78
|
-
subject: string;
|
|
79
78
|
display_name: string;
|
|
79
|
+
theme_id?: string;
|
|
80
80
|
tsx_source: string;
|
|
81
81
|
}[]>;
|
|
82
82
|
listEmailThemes(): Promise<{
|
|
83
83
|
id: string;
|
|
84
84
|
display_name: string;
|
|
85
85
|
}[]>;
|
|
86
|
-
updateEmailTemplate(type: EmailTemplateType, data: EmailTemplateCrud['Admin']['Update']): Promise<EmailTemplateCrud['Admin']['Read']>;
|
|
87
|
-
resetEmailTemplate(type: EmailTemplateType): Promise<void>;
|
|
88
86
|
listTeamPermissionDefinitions(): Promise<TeamPermissionDefinitionsCrud['Admin']['Read'][]>;
|
|
89
87
|
createTeamPermissionDefinition(data: TeamPermissionDefinitionsCrud['Admin']['Create']): Promise<TeamPermissionDefinitionsCrud['Admin']['Read']>;
|
|
90
88
|
updateTeamPermissionDefinition(permissionId: string, data: TeamPermissionDefinitionsCrud['Admin']['Update']): Promise<TeamPermissionDefinitionsCrud['Admin']['Read']>;
|
|
@@ -111,12 +109,6 @@ declare class StackAdminInterface extends StackServerInterface {
|
|
|
111
109
|
error_message?: string;
|
|
112
110
|
}>;
|
|
113
111
|
listSentEmails(): Promise<InternalEmailsCrud["Admin"]["List"]>;
|
|
114
|
-
sendEmail(options: {
|
|
115
|
-
user_ids: string[];
|
|
116
|
-
subject: string;
|
|
117
|
-
html: string;
|
|
118
|
-
notification_category_name: string;
|
|
119
|
-
}): Promise<void>;
|
|
120
112
|
sendSignInInvitationEmail(email: string, callbackUrl: string): Promise<void>;
|
|
121
113
|
sendChatMessage(threadId: string, contextType: "email-theme" | "email-template", messages: Array<{
|
|
122
114
|
role: string;
|
|
@@ -129,7 +121,7 @@ declare class StackAdminInterface extends StackServerInterface {
|
|
|
129
121
|
messages: Array<any>;
|
|
130
122
|
}>;
|
|
131
123
|
renderEmailPreview(options: {
|
|
132
|
-
themeId?: string;
|
|
124
|
+
themeId?: string | null | false;
|
|
133
125
|
themeTsxSource?: string;
|
|
134
126
|
templateId?: string;
|
|
135
127
|
templateTsxSource?: string;
|
|
@@ -144,9 +136,16 @@ declare class StackAdminInterface extends StackServerInterface {
|
|
|
144
136
|
tsx_source: string;
|
|
145
137
|
}>;
|
|
146
138
|
updateEmailTheme(id: string, tsxSource: string): Promise<void>;
|
|
147
|
-
|
|
139
|
+
updateEmailTemplate(id: string, tsxSource: string, themeId: string | null | false): Promise<{
|
|
148
140
|
rendered_html: string;
|
|
149
141
|
}>;
|
|
142
|
+
getConfig(): Promise<ConfigCrud["Admin"]["Read"]>;
|
|
143
|
+
updateConfig(data: {
|
|
144
|
+
configOverride: any;
|
|
145
|
+
}): Promise<ConfigOverrideCrud["Admin"]["Read"]>;
|
|
146
|
+
createEmailTemplate(displayName: string): Promise<{
|
|
147
|
+
id: string;
|
|
148
|
+
}>;
|
|
150
149
|
}
|
|
151
150
|
|
|
152
151
|
export { type AdminAuthApplicationOptions, type ChatContent, type InternalApiKeyCreateCrudRequest, type InternalApiKeyCreateCrudResponse, StackAdminInterface };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { InternalSession, AccessToken, RefreshToken } from '../sessions.js';
|
|
2
|
-
import {
|
|
2
|
+
import { ConfigCrud, ConfigOverrideCrud } from './crud/config.js';
|
|
3
3
|
import { InternalEmailsCrud } from './crud/emails.js';
|
|
4
4
|
import { InternalApiKeysCrud } from './crud/internal-api-keys.js';
|
|
5
5
|
import { ProjectPermissionDefinitionsCrud } from './crud/project-permissions.js';
|
|
@@ -13,6 +13,7 @@ import 'jose';
|
|
|
13
13
|
import '../crud.js';
|
|
14
14
|
import 'yup';
|
|
15
15
|
import '../utils/types.js';
|
|
16
|
+
import '../utils/strings.js';
|
|
16
17
|
import '../utils/results.js';
|
|
17
18
|
import './crud/connected-accounts.js';
|
|
18
19
|
import './crud/contact-channels.js';
|
|
@@ -72,19 +73,16 @@ declare class StackAdminInterface extends StackServerInterface {
|
|
|
72
73
|
listInternalApiKeys(): Promise<InternalApiKeysCrud["Admin"]["Read"][]>;
|
|
73
74
|
revokeInternalApiKeyById(id: string): Promise<void>;
|
|
74
75
|
getInternalApiKey(id: string, session: InternalSession): Promise<InternalApiKeysCrud["Admin"]["Read"]>;
|
|
75
|
-
|
|
76
|
-
listInternalEmailTemplatesNew(): Promise<{
|
|
76
|
+
listInternalEmailTemplates(): Promise<{
|
|
77
77
|
id: string;
|
|
78
|
-
subject: string;
|
|
79
78
|
display_name: string;
|
|
79
|
+
theme_id?: string;
|
|
80
80
|
tsx_source: string;
|
|
81
81
|
}[]>;
|
|
82
82
|
listEmailThemes(): Promise<{
|
|
83
83
|
id: string;
|
|
84
84
|
display_name: string;
|
|
85
85
|
}[]>;
|
|
86
|
-
updateEmailTemplate(type: EmailTemplateType, data: EmailTemplateCrud['Admin']['Update']): Promise<EmailTemplateCrud['Admin']['Read']>;
|
|
87
|
-
resetEmailTemplate(type: EmailTemplateType): Promise<void>;
|
|
88
86
|
listTeamPermissionDefinitions(): Promise<TeamPermissionDefinitionsCrud['Admin']['Read'][]>;
|
|
89
87
|
createTeamPermissionDefinition(data: TeamPermissionDefinitionsCrud['Admin']['Create']): Promise<TeamPermissionDefinitionsCrud['Admin']['Read']>;
|
|
90
88
|
updateTeamPermissionDefinition(permissionId: string, data: TeamPermissionDefinitionsCrud['Admin']['Update']): Promise<TeamPermissionDefinitionsCrud['Admin']['Read']>;
|
|
@@ -111,12 +109,6 @@ declare class StackAdminInterface extends StackServerInterface {
|
|
|
111
109
|
error_message?: string;
|
|
112
110
|
}>;
|
|
113
111
|
listSentEmails(): Promise<InternalEmailsCrud["Admin"]["List"]>;
|
|
114
|
-
sendEmail(options: {
|
|
115
|
-
user_ids: string[];
|
|
116
|
-
subject: string;
|
|
117
|
-
html: string;
|
|
118
|
-
notification_category_name: string;
|
|
119
|
-
}): Promise<void>;
|
|
120
112
|
sendSignInInvitationEmail(email: string, callbackUrl: string): Promise<void>;
|
|
121
113
|
sendChatMessage(threadId: string, contextType: "email-theme" | "email-template", messages: Array<{
|
|
122
114
|
role: string;
|
|
@@ -129,7 +121,7 @@ declare class StackAdminInterface extends StackServerInterface {
|
|
|
129
121
|
messages: Array<any>;
|
|
130
122
|
}>;
|
|
131
123
|
renderEmailPreview(options: {
|
|
132
|
-
themeId?: string;
|
|
124
|
+
themeId?: string | null | false;
|
|
133
125
|
themeTsxSource?: string;
|
|
134
126
|
templateId?: string;
|
|
135
127
|
templateTsxSource?: string;
|
|
@@ -144,9 +136,16 @@ declare class StackAdminInterface extends StackServerInterface {
|
|
|
144
136
|
tsx_source: string;
|
|
145
137
|
}>;
|
|
146
138
|
updateEmailTheme(id: string, tsxSource: string): Promise<void>;
|
|
147
|
-
|
|
139
|
+
updateEmailTemplate(id: string, tsxSource: string, themeId: string | null | false): Promise<{
|
|
148
140
|
rendered_html: string;
|
|
149
141
|
}>;
|
|
142
|
+
getConfig(): Promise<ConfigCrud["Admin"]["Read"]>;
|
|
143
|
+
updateConfig(data: {
|
|
144
|
+
configOverride: any;
|
|
145
|
+
}): Promise<ConfigOverrideCrud["Admin"]["Read"]>;
|
|
146
|
+
createEmailTemplate(displayName: string): Promise<{
|
|
147
|
+
id: string;
|
|
148
|
+
}>;
|
|
150
149
|
}
|
|
151
150
|
|
|
152
151
|
export { type AdminAuthApplicationOptions, type ChatContent, type InternalApiKeyCreateCrudRequest, type InternalApiKeyCreateCrudResponse, StackAdminInterface };
|
|
@@ -105,12 +105,7 @@ var StackAdminInterface = class extends import_server_interface.StackServerInter
|
|
|
105
105
|
const response = await this.sendAdminRequest(`/internal/api-keys/${id}`, {}, session);
|
|
106
106
|
return await response.json();
|
|
107
107
|
}
|
|
108
|
-
async
|
|
109
|
-
const response = await this.sendAdminRequest(`/email-templates`, {}, null);
|
|
110
|
-
const result = await response.json();
|
|
111
|
-
return result.items;
|
|
112
|
-
}
|
|
113
|
-
async listInternalEmailTemplatesNew() {
|
|
108
|
+
async listInternalEmailTemplates() {
|
|
114
109
|
const response = await this.sendAdminRequest(`/internal/email-templates`, {}, null);
|
|
115
110
|
const result = await response.json();
|
|
116
111
|
return result.templates;
|
|
@@ -120,27 +115,6 @@ var StackAdminInterface = class extends import_server_interface.StackServerInter
|
|
|
120
115
|
const result = await response.json();
|
|
121
116
|
return result.themes;
|
|
122
117
|
}
|
|
123
|
-
async updateEmailTemplate(type, data) {
|
|
124
|
-
const result = await this.sendAdminRequest(
|
|
125
|
-
`/email-templates/${type}`,
|
|
126
|
-
{
|
|
127
|
-
method: "PATCH",
|
|
128
|
-
headers: {
|
|
129
|
-
"content-type": "application/json"
|
|
130
|
-
},
|
|
131
|
-
body: JSON.stringify(data)
|
|
132
|
-
},
|
|
133
|
-
null
|
|
134
|
-
);
|
|
135
|
-
return await result.json();
|
|
136
|
-
}
|
|
137
|
-
async resetEmailTemplate(type) {
|
|
138
|
-
await this.sendAdminRequest(
|
|
139
|
-
`/email-templates/${type}`,
|
|
140
|
-
{ method: "DELETE" },
|
|
141
|
-
null
|
|
142
|
-
);
|
|
143
|
-
}
|
|
144
118
|
// Team permission definitions methods
|
|
145
119
|
async listTeamPermissionDefinitions() {
|
|
146
120
|
const response = await this.sendAdminRequest(`/team-permission-definitions`, {}, null);
|
|
@@ -271,15 +245,6 @@ var StackAdminInterface = class extends import_server_interface.StackServerInter
|
|
|
271
245
|
}, null);
|
|
272
246
|
return await response.json();
|
|
273
247
|
}
|
|
274
|
-
async sendEmail(options) {
|
|
275
|
-
await this.sendAdminRequest("/emails/send-email", {
|
|
276
|
-
method: "POST",
|
|
277
|
-
headers: {
|
|
278
|
-
"content-type": "application/json"
|
|
279
|
-
},
|
|
280
|
-
body: JSON.stringify(options)
|
|
281
|
-
}, null);
|
|
282
|
-
}
|
|
283
248
|
async sendSignInInvitationEmail(email, callbackUrl) {
|
|
284
249
|
await this.sendAdminRequest(
|
|
285
250
|
"/internal/send-sign-in-invitation",
|
|
@@ -386,7 +351,7 @@ var StackAdminInterface = class extends import_server_interface.StackServerInter
|
|
|
386
351
|
null
|
|
387
352
|
);
|
|
388
353
|
}
|
|
389
|
-
async
|
|
354
|
+
async updateEmailTemplate(id, tsxSource, themeId) {
|
|
390
355
|
const response = await this.sendAdminRequest(
|
|
391
356
|
`/internal/email-templates/${id}`,
|
|
392
357
|
{
|
|
@@ -394,7 +359,45 @@ var StackAdminInterface = class extends import_server_interface.StackServerInter
|
|
|
394
359
|
headers: {
|
|
395
360
|
"content-type": "application/json"
|
|
396
361
|
},
|
|
397
|
-
body: JSON.stringify({ tsx_source: tsxSource })
|
|
362
|
+
body: JSON.stringify({ tsx_source: tsxSource, theme_id: themeId })
|
|
363
|
+
},
|
|
364
|
+
null
|
|
365
|
+
);
|
|
366
|
+
return await response.json();
|
|
367
|
+
}
|
|
368
|
+
async getConfig() {
|
|
369
|
+
const response = await this.sendAdminRequest(
|
|
370
|
+
`/internal/config`,
|
|
371
|
+
{ method: "GET" },
|
|
372
|
+
null
|
|
373
|
+
);
|
|
374
|
+
return await response.json();
|
|
375
|
+
}
|
|
376
|
+
async updateConfig(data) {
|
|
377
|
+
const response = await this.sendAdminRequest(
|
|
378
|
+
`/internal/config/override`,
|
|
379
|
+
{
|
|
380
|
+
method: "PATCH",
|
|
381
|
+
headers: {
|
|
382
|
+
"content-type": "application/json"
|
|
383
|
+
},
|
|
384
|
+
body: JSON.stringify({ config_override_string: JSON.stringify(data.configOverride) })
|
|
385
|
+
},
|
|
386
|
+
null
|
|
387
|
+
);
|
|
388
|
+
return await response.json();
|
|
389
|
+
}
|
|
390
|
+
async createEmailTemplate(displayName) {
|
|
391
|
+
const response = await this.sendAdminRequest(
|
|
392
|
+
`/internal/email-templates`,
|
|
393
|
+
{
|
|
394
|
+
method: "POST",
|
|
395
|
+
headers: {
|
|
396
|
+
"content-type": "application/json"
|
|
397
|
+
},
|
|
398
|
+
body: JSON.stringify({
|
|
399
|
+
display_name: displayName
|
|
400
|
+
})
|
|
398
401
|
},
|
|
399
402
|
null
|
|
400
403
|
);
|