@better-auth-ui/react 1.6.8 → 1.6.9
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/dist/components/auth/auth-context.d.ts +3 -0
- package/dist/components/auth/auth-context.js +4 -0
- package/dist/components/auth/auth-provider.d.ts +4 -4
- package/dist/components/auth/auth-provider.js +65 -41
- package/dist/components/auth/email/email-changed.d.ts +2 -2
- package/dist/components/auth/email/email-changed.js +68 -154
- package/dist/components/auth/email/email-localization.d.ts +11 -3
- package/dist/components/auth/email/email-localization.js +25 -18
- package/dist/components/auth/email/email-styles.js +77 -52
- package/dist/components/auth/email/email-verification.d.ts +2 -2
- package/dist/components/auth/email/email-verification.js +73 -138
- package/dist/components/auth/email/index.d.ts +10 -9
- package/dist/components/auth/email/index.js +10 -9
- package/dist/components/auth/email/magic-link.d.ts +2 -2
- package/dist/components/auth/email/magic-link.js +70 -139
- package/dist/components/auth/email/new-device.d.ts +2 -2
- package/dist/components/auth/email/new-device.js +88 -221
- package/dist/components/auth/email/organization-invitation.d.ts +121 -0
- package/dist/components/auth/email/organization-invitation.js +110 -0
- package/dist/components/auth/email/otp-email.d.ts +2 -2
- package/dist/components/auth/email/otp-email.js +63 -127
- package/dist/components/auth/email/password-changed.d.ts +2 -2
- package/dist/components/auth/email/password-changed.js +74 -157
- package/dist/components/auth/email/reset-password.d.ts +2 -2
- package/dist/components/auth/email/reset-password.js +66 -138
- package/dist/components/auth/fetch-options-provider.d.ts +1 -1
- package/dist/components/auth/fetch-options-provider.js +28 -27
- package/dist/components/icons/apple.d.ts +1 -1
- package/dist/components/icons/apple.js +9 -16
- package/dist/components/icons/atlassian.d.ts +1 -1
- package/dist/components/icons/atlassian.js +13 -38
- package/dist/components/icons/cognito.d.ts +1 -1
- package/dist/components/icons/cognito.js +9 -19
- package/dist/components/icons/discord.d.ts +1 -1
- package/dist/components/icons/discord.js +9 -16
- package/dist/components/icons/dropbox.d.ts +1 -1
- package/dist/components/icons/dropbox.js +9 -16
- package/dist/components/icons/facebook.d.ts +1 -1
- package/dist/components/icons/facebook.js +11 -19
- package/dist/components/icons/figma.d.ts +1 -1
- package/dist/components/icons/figma.js +12 -34
- package/dist/components/icons/github.d.ts +1 -1
- package/dist/components/icons/github.js +11 -16
- package/dist/components/icons/gitlab.d.ts +1 -1
- package/dist/components/icons/gitlab.js +9 -30
- package/dist/components/icons/google.d.ts +1 -1
- package/dist/components/icons/google.js +9 -39
- package/dist/components/icons/huggingface.d.ts +1 -1
- package/dist/components/icons/huggingface.js +9 -38
- package/dist/components/icons/index.d.ts +35 -35
- package/dist/components/icons/index.js +35 -35
- package/dist/components/icons/kakao.d.ts +1 -1
- package/dist/components/icons/kakao.js +11 -16
- package/dist/components/icons/kick.d.ts +1 -1
- package/dist/components/icons/kick.js +11 -20
- package/dist/components/icons/line.d.ts +1 -1
- package/dist/components/icons/line.js +9 -16
- package/dist/components/icons/linear.d.ts +1 -1
- package/dist/components/icons/linear.js +9 -16
- package/dist/components/icons/linkedin.d.ts +1 -1
- package/dist/components/icons/linkedin.js +9 -33
- package/dist/components/icons/microsoft.d.ts +1 -1
- package/dist/components/icons/microsoft.js +9 -30
- package/dist/components/icons/naver.d.ts +1 -1
- package/dist/components/icons/naver.js +9 -16
- package/dist/components/icons/notion.d.ts +1 -1
- package/dist/components/icons/notion.js +9 -16
- package/dist/components/icons/paybin.d.ts +1 -1
- package/dist/components/icons/paybin.js +8 -32
- package/dist/components/icons/paypal.d.ts +1 -1
- package/dist/components/icons/paypal.js +9 -30
- package/dist/components/icons/polar.d.ts +1 -1
- package/dist/components/icons/polar.js +9 -24
- package/dist/components/icons/railway.d.ts +1 -1
- package/dist/components/icons/railway.js +9 -16
- package/dist/components/icons/reddit.d.ts +1 -1
- package/dist/components/icons/reddit.js +9 -21
- package/dist/components/icons/roblox.d.ts +1 -1
- package/dist/components/icons/roblox.js +12 -17
- package/dist/components/icons/salesforce.d.ts +1 -1
- package/dist/components/icons/salesforce.js +9 -16
- package/dist/components/icons/slack.d.ts +1 -1
- package/dist/components/icons/slack.js +9 -30
- package/dist/components/icons/spotify.d.ts +1 -1
- package/dist/components/icons/spotify.js +9 -16
- package/dist/components/icons/tiktok.d.ts +1 -1
- package/dist/components/icons/tiktok.js +10 -23
- package/dist/components/icons/twitch.d.ts +1 -1
- package/dist/components/icons/twitch.js +12 -43
- package/dist/components/icons/vercel.d.ts +1 -1
- package/dist/components/icons/vercel.js +9 -16
- package/dist/components/icons/vk.d.ts +1 -1
- package/dist/components/icons/vk.js +9 -16
- package/dist/components/icons/wechat.d.ts +1 -1
- package/dist/components/icons/wechat.js +9 -16
- package/dist/components/icons/x.d.ts +1 -1
- package/dist/components/icons/x.js +9 -16
- package/dist/components/icons/zoom.d.ts +1 -1
- package/dist/components/icons/zoom.js +11 -69
- package/dist/components/mutation-invalidator.d.ts +1 -0
- package/dist/components/mutation-invalidator.js +31 -0
- package/dist/components/settings/account/theme-preview.js +7 -286
- package/dist/email.d.ts +1 -1
- package/dist/email.js +1 -11
- package/dist/hooks/auth/use-authenticate.d.ts +3 -3
- package/dist/hooks/auth/use-authenticate.js +28 -22
- package/dist/hooks/auth/use-user.d.ts +34 -34
- package/dist/hooks/auth/use-user.js +14 -10
- package/dist/hooks/use-auth-mutation.d.ts +4 -4
- package/dist/hooks/use-auth-mutation.js +18 -10
- package/dist/hooks/use-auth-plugin.d.ts +1 -1
- package/dist/hooks/use-auth-plugin.js +26 -8
- package/dist/hooks/use-auth-query.d.ts +3 -3
- package/dist/hooks/use-auth-query.js +20 -14
- package/dist/index.d.ts +48 -45
- package/dist/index.js +47 -79
- package/dist/lib/auth-client.d.ts +7 -4
- package/dist/lib/auth-client.js +1 -0
- package/dist/lib/auth-plugin.d.ts +19 -3
- package/dist/lib/auth-plugin.js +1 -0
- package/dist/lib/auth-server.d.ts +10 -3
- package/dist/lib/auth-server.js +1 -0
- package/dist/lib/provider-icons.d.ts +2 -2
- package/dist/lib/provider-icons.js +47 -75
- package/dist/lib/settings-tab.d.ts +19 -0
- package/dist/lib/settings-tab.js +1 -0
- package/dist/lib/utils.d.ts +1 -1
- package/dist/lib/utils.js +4 -7
- package/dist/mutations/api-key/create-api-key-mutation.d.ts +9 -7
- package/dist/mutations/api-key/create-api-key-mutation.js +37 -27
- package/dist/mutations/api-key/delete-api-key-mutation.d.ts +10 -6
- package/dist/mutations/api-key/delete-api-key-mutation.js +37 -27
- package/dist/mutations/auth/request-password-reset-mutation.d.ts +4 -4
- package/dist/mutations/auth/request-password-reset-mutation.js +31 -22
- package/dist/mutations/auth/reset-password-mutation.d.ts +4 -4
- package/dist/mutations/auth/reset-password-mutation.js +32 -22
- package/dist/mutations/auth/send-verification-email-mutation.d.ts +4 -4
- package/dist/mutations/auth/send-verification-email-mutation.js +31 -22
- package/dist/mutations/auth/sign-in-email-mutation.d.ts +10 -10
- package/dist/mutations/auth/sign-in-email-mutation.js +38 -27
- package/dist/mutations/auth/sign-in-social-mutation.d.ts +6 -6
- package/dist/mutations/auth/sign-in-social-mutation.js +36 -22
- package/dist/mutations/auth/sign-out-mutation.d.ts +9 -7
- package/dist/mutations/auth/sign-out-mutation.js +39 -26
- package/dist/mutations/auth/sign-up-email-mutation.d.ts +12 -12
- package/dist/mutations/auth/sign-up-email-mutation.js +34 -27
- package/dist/mutations/auth-mutation-options.d.ts +2 -2
- package/dist/mutations/auth-mutation-options.js +22 -18
- package/dist/mutations/magic-link/sign-in-magic-link-mutation.d.ts +4 -4
- package/dist/mutations/magic-link/sign-in-magic-link-mutation.js +31 -22
- package/dist/mutations/multi-session/revoke-multi-session-mutation.d.ts +8 -8
- package/dist/mutations/multi-session/revoke-multi-session-mutation.js +37 -27
- package/dist/mutations/multi-session/set-active-session-mutation.d.ts +8 -9
- package/dist/mutations/multi-session/set-active-session-mutation.js +38 -29
- package/dist/mutations/organization/accept-invitation-mutation.d.ts +43 -0
- package/dist/mutations/organization/accept-invitation-mutation.js +32 -0
- package/dist/mutations/organization/cancel-invitation-mutation.d.ts +25 -0
- package/dist/mutations/organization/cancel-invitation-mutation.js +28 -0
- package/dist/mutations/organization/check-slug-mutation.d.ts +21 -0
- package/dist/mutations/organization/check-slug-mutation.js +30 -0
- package/dist/mutations/organization/create-organization-mutation.d.ts +39 -0
- package/dist/mutations/organization/create-organization-mutation.js +29 -0
- package/dist/mutations/organization/delete-organization-mutation.d.ts +21 -0
- package/dist/mutations/organization/delete-organization-mutation.js +29 -0
- package/dist/mutations/organization/index.d.ts +12 -0
- package/dist/mutations/organization/index.js +12 -0
- package/dist/mutations/organization/invite-member-mutation.d.ts +43 -0
- package/dist/mutations/organization/invite-member-mutation.js +35 -0
- package/dist/mutations/organization/leave-organization-mutation.d.ts +65 -0
- package/dist/mutations/organization/leave-organization-mutation.js +32 -0
- package/dist/mutations/organization/reject-invitation-mutation.d.ts +31 -0
- package/dist/mutations/organization/reject-invitation-mutation.js +25 -0
- package/dist/mutations/organization/remove-member-mutation.d.ts +35 -0
- package/dist/mutations/organization/remove-member-mutation.js +29 -0
- package/dist/mutations/organization/set-active-organization-mutation.d.ts +71 -0
- package/dist/mutations/organization/set-active-organization-mutation.js +72 -0
- package/dist/mutations/organization/update-member-role-mutation.d.ts +31 -0
- package/dist/mutations/organization/update-member-role-mutation.js +36 -0
- package/dist/mutations/organization/update-organization-mutation.d.ts +21 -0
- package/dist/mutations/organization/update-organization-mutation.js +36 -0
- package/dist/mutations/passkey/add-passkey-mutation.d.ts +16 -16
- package/dist/mutations/passkey/add-passkey-mutation.js +38 -27
- package/dist/mutations/passkey/delete-passkey-mutation.d.ts +8 -8
- package/dist/mutations/passkey/delete-passkey-mutation.js +37 -27
- package/dist/mutations/passkey/sign-in-passkey-mutation.d.ts +24 -24
- package/dist/mutations/passkey/sign-in-passkey-mutation.js +36 -27
- package/dist/mutations/settings/change-email-mutation.d.ts +9 -8
- package/dist/mutations/settings/change-email-mutation.js +35 -27
- package/dist/mutations/settings/change-password-mutation.d.ts +6 -6
- package/dist/mutations/settings/change-password-mutation.js +31 -22
- package/dist/mutations/settings/delete-user-mutation.d.ts +4 -4
- package/dist/mutations/settings/delete-user-mutation.js +31 -22
- package/dist/mutations/settings/link-social-mutation.d.ts +4 -4
- package/dist/mutations/settings/link-social-mutation.js +31 -22
- package/dist/mutations/settings/revoke-session-mutation.d.ts +8 -8
- package/dist/mutations/settings/revoke-session-mutation.js +37 -27
- package/dist/mutations/settings/unlink-account-mutation.d.ts +8 -8
- package/dist/mutations/settings/unlink-account-mutation.js +37 -27
- package/dist/mutations/settings/update-user-mutation.d.ts +8 -8
- package/dist/mutations/settings/update-user-mutation.js +34 -33
- package/dist/mutations/username/is-username-available-mutation.d.ts +4 -4
- package/dist/mutations/username/is-username-available-mutation.js +34 -22
- package/dist/mutations/username/sign-in-username-mutation.d.ts +10 -10
- package/dist/mutations/username/sign-in-username-mutation.js +35 -27
- package/dist/plugins/captcha-plugin.d.ts +3 -3
- package/dist/plugins/captcha-plugin.js +31 -26
- package/dist/plugins.d.ts +1 -1
- package/dist/plugins.js +1 -2
- package/dist/queries/api-key/list-api-keys-query.d.ts +20 -11
- package/dist/queries/api-key/list-api-keys-query.js +52 -29
- package/dist/queries/auth/session-query.d.ts +6 -6
- package/dist/queries/auth/session-query.js +70 -28
- package/dist/queries/auth-query-options.d.ts +2 -2
- package/dist/queries/auth-query-options.js +20 -16
- package/dist/queries/multi-session/list-device-sessions-query.d.ts +8 -8
- package/dist/queries/multi-session/list-device-sessions-query.js +83 -29
- package/dist/queries/organization/active-organization-query.d.ts +39 -0
- package/dist/queries/organization/active-organization-query.js +37 -0
- package/dist/queries/organization/full-organization-query.d.ts +37 -0
- package/dist/queries/organization/full-organization-query.js +31 -0
- package/dist/queries/organization/has-permission-query.d.ts +21 -0
- package/dist/queries/organization/has-permission-query.js +38 -0
- package/dist/queries/organization/index.d.ts +7 -0
- package/dist/queries/organization/index.js +7 -0
- package/dist/queries/organization/list-invitations-query.d.ts +29 -0
- package/dist/queries/organization/list-invitations-query.js +37 -0
- package/dist/queries/organization/list-members-query.d.ts +61 -0
- package/dist/queries/organization/list-members-query.js +37 -0
- package/dist/queries/organization/list-organizations-query.d.ts +22 -0
- package/dist/queries/organization/list-organizations-query.js +31 -0
- package/dist/queries/organization/list-user-invitations-query.d.ts +29 -0
- package/dist/queries/organization/list-user-invitations-query.js +31 -0
- package/dist/queries/passkey/list-passkeys-query.d.ts +8 -8
- package/dist/queries/passkey/list-passkeys-query.js +81 -29
- package/dist/queries/settings/account-info-query.d.ts +6 -6
- package/dist/queries/settings/account-info-query.js +85 -29
- package/dist/queries/settings/list-accounts-query.d.ts +6 -6
- package/dist/queries/settings/list-accounts-query.js +83 -29
- package/dist/queries/settings/list-sessions-query.d.ts +6 -6
- package/dist/queries/settings/list-sessions-query.js +81 -29
- package/dist/server/queries/api-key/list-api-keys-query.d.ts +83 -0
- package/dist/server/queries/api-key/list-api-keys-query.js +49 -0
- package/dist/server/queries/auth/session-query.d.ts +5 -5
- package/dist/server/queries/auth/session-query.js +50 -12
- package/dist/server/queries/multi-session/list-device-sessions-query.d.ts +7 -7
- package/dist/server/queries/multi-session/list-device-sessions-query.js +53 -11
- package/dist/server/queries/organization/active-organization-query.d.ts +61 -0
- package/dist/server/queries/organization/active-organization-query.js +25 -0
- package/dist/server/queries/organization/full-organization-query.d.ts +42 -0
- package/dist/server/queries/organization/full-organization-query.js +21 -0
- package/dist/server/queries/organization/has-permission-query.d.ts +66 -0
- package/dist/server/queries/organization/has-permission-query.js +23 -0
- package/dist/server/queries/organization/list-invitations-query.d.ts +34 -0
- package/dist/server/queries/organization/list-invitations-query.js +21 -0
- package/dist/server/queries/organization/list-members-query.d.ts +66 -0
- package/dist/server/queries/organization/list-members-query.js +21 -0
- package/dist/server/queries/organization/list-organizations-query.d.ts +27 -0
- package/dist/server/queries/organization/list-organizations-query.js +21 -0
- package/dist/server/queries/organization/list-user-invitations-query.d.ts +34 -0
- package/dist/server/queries/organization/list-user-invitations-query.js +21 -0
- package/dist/server/queries/passkey/list-passkeys-query.d.ts +7 -7
- package/dist/server/queries/passkey/list-passkeys-query.js +53 -11
- package/dist/server/queries/settings/account-info-query.d.ts +5 -5
- package/dist/server/queries/settings/account-info-query.js +53 -11
- package/dist/server/queries/settings/list-accounts-query.d.ts +5 -5
- package/dist/server/queries/settings/list-accounts-query.js +53 -11
- package/dist/server/queries/settings/list-sessions-query.d.ts +5 -5
- package/dist/server/queries/settings/list-sessions-query.js +53 -11
- package/dist/server.d.ts +15 -7
- package/dist/server.js +14 -7
- package/package.json +20 -17
- package/src/components/auth/auth-context.tsx +7 -0
- package/src/components/auth/auth-provider.tsx +19 -31
- package/src/components/auth/email/email-localization.tsx +5 -3
- package/src/components/auth/email/index.ts +1 -0
- package/src/components/auth/email/organization-invitation.tsx +454 -0
- package/src/components/mutation-invalidator.tsx +67 -0
- package/src/index.ts +3 -0
- package/src/lib/auth-client.ts +7 -0
- package/src/lib/auth-plugin.ts +17 -0
- package/src/lib/auth-server.ts +17 -1
- package/src/lib/settings-tab.ts +21 -0
- package/src/mutations/api-key/create-api-key-mutation.ts +34 -19
- package/src/mutations/api-key/delete-api-key-mutation.ts +36 -19
- package/src/mutations/auth/sign-in-email-mutation.ts +18 -22
- package/src/mutations/auth/sign-out-mutation.ts +19 -13
- package/src/mutations/auth/sign-up-email-mutation.ts +18 -22
- package/src/mutations/multi-session/revoke-multi-session-mutation.ts +31 -20
- package/src/mutations/multi-session/set-active-session-mutation.ts +25 -44
- package/src/mutations/organization/accept-invitation-mutation.ts +71 -0
- package/src/mutations/organization/cancel-invitation-mutation.ts +67 -0
- package/src/mutations/organization/check-slug-mutation.ts +55 -0
- package/src/mutations/organization/create-organization-mutation.ts +71 -0
- package/src/mutations/organization/delete-organization-mutation.ts +71 -0
- package/src/mutations/organization/index.ts +12 -0
- package/src/mutations/organization/invite-member-mutation.ts +81 -0
- package/src/mutations/organization/leave-organization-mutation.ts +74 -0
- package/src/mutations/organization/reject-invitation-mutation.ts +64 -0
- package/src/mutations/organization/remove-member-mutation.ts +67 -0
- package/src/mutations/organization/set-active-organization-mutation.ts +142 -0
- package/src/mutations/organization/update-member-role-mutation.ts +81 -0
- package/src/mutations/organization/update-organization-mutation.ts +84 -0
- package/src/mutations/passkey/add-passkey-mutation.ts +28 -17
- package/src/mutations/passkey/delete-passkey-mutation.ts +27 -17
- package/src/mutations/passkey/sign-in-passkey-mutation.ts +18 -21
- package/src/mutations/settings/change-email-mutation.ts +22 -18
- package/src/mutations/settings/delete-user-mutation.ts +2 -2
- package/src/mutations/settings/revoke-session-mutation.ts +24 -19
- package/src/mutations/settings/unlink-account-mutation.ts +24 -17
- package/src/mutations/settings/update-user-mutation.ts +18 -30
- package/src/mutations/username/is-username-available-mutation.ts +2 -2
- package/src/mutations/username/sign-in-username-mutation.ts +20 -23
- package/src/queries/api-key/list-api-keys-query.ts +20 -8
- package/src/queries/multi-session/list-device-sessions-query.ts +2 -2
- package/src/queries/organization/active-organization-query.ts +140 -0
- package/src/queries/organization/full-organization-query.ts +113 -0
- package/src/queries/organization/has-permission-query.ts +124 -0
- package/src/queries/organization/index.ts +7 -0
- package/src/queries/organization/list-invitations-query.ts +133 -0
- package/src/queries/organization/list-members-query.ts +133 -0
- package/src/queries/organization/list-organizations-query.ts +122 -0
- package/src/queries/organization/list-user-invitations-query.ts +122 -0
- package/src/queries/passkey/list-passkeys-query.ts +2 -2
- package/src/server/queries/api-key/list-api-keys-query.ts +94 -0
- package/src/server/queries/multi-session/list-device-sessions-query.ts +2 -2
- package/src/server/queries/organization/active-organization-query.ts +92 -0
- package/src/server/queries/organization/full-organization-query.ts +64 -0
- package/src/server/queries/organization/has-permission-query.ts +66 -0
- package/src/server/queries/organization/list-invitations-query.ts +81 -0
- package/src/server/queries/organization/list-members-query.ts +75 -0
- package/src/server/queries/organization/list-organizations-query.ts +67 -0
- package/src/server/queries/organization/list-user-invitations-query.ts +68 -0
- package/src/server/queries/passkey/list-passkeys-query.ts +2 -2
- package/src/server.ts +8 -0
|
@@ -1,223 +1,90 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
POWERED_BY_BETTER_AUTH: "Powered by {betterAuth}"
|
|
21
|
-
}, b = ({ userEmail: y, deviceInfo: x, secureAccountLink: S, appName: C, supportEmail: w, logoURL: T, colors: E, classNames: D, darkMode: O = !0, poweredBy: k, head: A, ...j }) => {
|
|
22
|
-
let M = {
|
|
23
|
-
...b.localization,
|
|
24
|
-
...j.localization
|
|
25
|
-
}, N = M.NEW_SIGN_IN_DETECTED;
|
|
26
|
-
return /* @__PURE__ */ i(d, { children: [
|
|
27
|
-
/* @__PURE__ */ i(c, { children: [
|
|
28
|
-
/* @__PURE__ */ r("meta", {
|
|
29
|
-
content: "light dark",
|
|
30
|
-
name: "color-scheme"
|
|
31
|
-
}),
|
|
32
|
-
/* @__PURE__ */ r("meta", {
|
|
33
|
-
content: "light dark",
|
|
34
|
-
name: "supported-color-schemes"
|
|
35
|
-
}),
|
|
36
|
-
/* @__PURE__ */ r(t, {
|
|
37
|
-
colors: E,
|
|
38
|
-
darkMode: O
|
|
39
|
-
}),
|
|
40
|
-
A
|
|
41
|
-
] }),
|
|
42
|
-
/* @__PURE__ */ r(m, { children: N }),
|
|
43
|
-
/* @__PURE__ */ r(g, {
|
|
44
|
-
config: { presets: [v] },
|
|
45
|
-
children: /* @__PURE__ */ r(a, {
|
|
46
|
-
className: e("bg-background font-sans", D?.body),
|
|
47
|
-
children: /* @__PURE__ */ r(s, {
|
|
48
|
-
className: e("mx-auto my-auto max-w-xl px-2 py-10", D?.container),
|
|
49
|
-
children: /* @__PURE__ */ i(h, {
|
|
50
|
-
className: e("bg-card text-card-foreground rounded-none border border-border p-8", D?.card),
|
|
51
|
-
children: [
|
|
52
|
-
T && (typeof T == "string" ? /* @__PURE__ */ r(f, {
|
|
53
|
-
src: T,
|
|
54
|
-
width: 48,
|
|
55
|
-
height: 48,
|
|
56
|
-
alt: C || M.LOGO,
|
|
57
|
-
className: e("mx-auto mb-8", D?.logo)
|
|
58
|
-
}) : /* @__PURE__ */ i(n, { children: [/* @__PURE__ */ r(f, {
|
|
59
|
-
src: T.light,
|
|
60
|
-
width: 48,
|
|
61
|
-
height: 48,
|
|
62
|
-
alt: C || M.LOGO,
|
|
63
|
-
className: e("mx-auto mb-8 logo-light", D?.logo)
|
|
64
|
-
}), /* @__PURE__ */ r(f, {
|
|
65
|
-
src: T.dark,
|
|
66
|
-
width: 48,
|
|
67
|
-
height: 48,
|
|
68
|
-
alt: C || M.LOGO,
|
|
69
|
-
className: e("hidden mx-auto mb-8 logo-dark", D?.logo)
|
|
70
|
-
})] })),
|
|
71
|
-
/* @__PURE__ */ r(l, {
|
|
72
|
-
className: e("m-0 mb-5 text-2xl font-semibold", D?.title),
|
|
73
|
-
children: M.NEW_SIGN_IN_DETECTED
|
|
74
|
-
}),
|
|
75
|
-
/* @__PURE__ */ r(_, {
|
|
76
|
-
className: e("text-sm font-normal", D?.content),
|
|
77
|
-
children: (() => {
|
|
78
|
-
let e = M.NEW_SIGN_IN_TO_YOUR_ACCOUNT.replace("{appName}", C || "").replace(/\s{2,}/g, " ").replace(" .", "."), [t, a] = e.split("{userEmail}");
|
|
79
|
-
return y ? /* @__PURE__ */ i(n, { children: [
|
|
80
|
-
t,
|
|
81
|
-
/* @__PURE__ */ r(p, {
|
|
82
|
-
href: `mailto:${y}`,
|
|
83
|
-
className: "text-primary font-medium",
|
|
84
|
-
children: y
|
|
85
|
-
}),
|
|
86
|
-
a
|
|
87
|
-
] }) : e.replace("{userEmail}", "").replace(/\s{2,}/g, " ").replace(" .", ".");
|
|
88
|
-
})()
|
|
89
|
-
}),
|
|
90
|
-
x && /* @__PURE__ */ i(h, {
|
|
91
|
-
className: e("my-6 border border-border bg-muted p-4", D?.codeBlock),
|
|
92
|
-
children: [
|
|
93
|
-
/* @__PURE__ */ i(_, {
|
|
94
|
-
className: e("m-0 mb-3 text-xs text-muted-foreground", D?.description),
|
|
95
|
-
children: [M.DEVICE_DETAILS, ":"]
|
|
96
|
-
}),
|
|
97
|
-
x.browser && /* @__PURE__ */ i(_, {
|
|
98
|
-
className: e("m-0 mb-2 text-sm", D?.content),
|
|
99
|
-
children: [
|
|
100
|
-
/* @__PURE__ */ i("span", {
|
|
101
|
-
className: "font-semibold",
|
|
102
|
-
children: [M.BROWSER, ":"]
|
|
103
|
-
}),
|
|
104
|
-
" ",
|
|
105
|
-
x.browser
|
|
106
|
-
]
|
|
107
|
-
}),
|
|
108
|
-
x.os && /* @__PURE__ */ i(_, {
|
|
109
|
-
className: e("m-0 mb-2 text-sm", D?.content),
|
|
110
|
-
children: [
|
|
111
|
-
/* @__PURE__ */ i("span", {
|
|
112
|
-
className: "font-semibold",
|
|
113
|
-
children: [M.OPERATING_SYSTEM, ":"]
|
|
114
|
-
}),
|
|
115
|
-
" ",
|
|
116
|
-
x.os
|
|
117
|
-
]
|
|
118
|
-
}),
|
|
119
|
-
x.location && /* @__PURE__ */ i(_, {
|
|
120
|
-
className: e("m-0 mb-2 text-sm", D?.content),
|
|
121
|
-
children: [
|
|
122
|
-
/* @__PURE__ */ i("span", {
|
|
123
|
-
className: "font-semibold",
|
|
124
|
-
children: [M.LOCATION, ":"]
|
|
125
|
-
}),
|
|
126
|
-
" ",
|
|
127
|
-
x.location
|
|
128
|
-
]
|
|
129
|
-
}),
|
|
130
|
-
x.ipAddress && /* @__PURE__ */ i(_, {
|
|
131
|
-
className: e("m-0 mb-2 text-sm", D?.content),
|
|
132
|
-
children: [
|
|
133
|
-
/* @__PURE__ */ i("span", {
|
|
134
|
-
className: "font-semibold",
|
|
135
|
-
children: [M.IP_ADDRESS, ":"]
|
|
136
|
-
}),
|
|
137
|
-
" ",
|
|
138
|
-
x.ipAddress
|
|
139
|
-
]
|
|
140
|
-
}),
|
|
141
|
-
x.timestamp && /* @__PURE__ */ i(_, {
|
|
142
|
-
className: e("m-0 text-sm", D?.content),
|
|
143
|
-
children: [
|
|
144
|
-
/* @__PURE__ */ i("span", {
|
|
145
|
-
className: "font-semibold",
|
|
146
|
-
children: [M.TIME, ":"]
|
|
147
|
-
}),
|
|
148
|
-
" ",
|
|
149
|
-
x.timestamp
|
|
150
|
-
]
|
|
151
|
-
})
|
|
152
|
-
]
|
|
153
|
-
}),
|
|
154
|
-
/* @__PURE__ */ r(_, {
|
|
155
|
-
className: e("text-sm font-normal", D?.content),
|
|
156
|
-
children: M.IF_THIS_WAS_YOU
|
|
157
|
-
}),
|
|
158
|
-
S && /* @__PURE__ */ r(h, {
|
|
159
|
-
className: "mt-6",
|
|
160
|
-
children: /* @__PURE__ */ r(o, {
|
|
161
|
-
href: S,
|
|
162
|
-
className: e("inline-block whitespace-nowrap rounded-none text-sm font-medium py-2.5 px-6 bg-primary text-primary-foreground no-underline", D?.button),
|
|
163
|
-
children: M.SECURE_MY_ACCOUNT
|
|
164
|
-
})
|
|
165
|
-
}),
|
|
166
|
-
/* @__PURE__ */ r(u, { className: e("my-6 w-full border border-solid border-border", D?.separator) }),
|
|
167
|
-
C && /* @__PURE__ */ r(_, {
|
|
168
|
-
className: e("mb-3 text-xs text-muted-foreground", D?.description),
|
|
169
|
-
children: M.EMAIL_SENT_BY.replace("{appName}", C)
|
|
170
|
-
}),
|
|
171
|
-
/* @__PURE__ */ r(_, {
|
|
172
|
-
className: e("mt-3 text-xs text-muted-foreground", D?.description),
|
|
173
|
-
children: (() => {
|
|
174
|
-
let [t, a] = M.IF_YOU_DIDNT_SIGN_IN.split("{supportEmail}");
|
|
175
|
-
return w ? /* @__PURE__ */ i(n, { children: [
|
|
176
|
-
t,
|
|
177
|
-
/* @__PURE__ */ r(p, {
|
|
178
|
-
href: `mailto:${w}`,
|
|
179
|
-
className: e("text-primary underline", D?.link),
|
|
180
|
-
children: w
|
|
181
|
-
}),
|
|
182
|
-
a
|
|
183
|
-
] }) : M.IF_YOU_DIDNT_SIGN_IN.replace("{supportEmail}", "").replace(/\s{2,}/g, " ").replace(" .", ".");
|
|
184
|
-
})()
|
|
185
|
-
}),
|
|
186
|
-
k && /* @__PURE__ */ r(_, {
|
|
187
|
-
className: e("mt-4 mb-0 text-center text-[11px] text-muted-foreground", D?.poweredBy),
|
|
188
|
-
children: (() => {
|
|
189
|
-
let [t, a] = M.POWERED_BY_BETTER_AUTH.split("{betterAuth}");
|
|
190
|
-
return /* @__PURE__ */ i(n, { children: [
|
|
191
|
-
t,
|
|
192
|
-
/* @__PURE__ */ r(p, {
|
|
193
|
-
href: "https://better-auth.com",
|
|
194
|
-
className: e("text-primary underline", D?.link),
|
|
195
|
-
children: "better-auth"
|
|
196
|
-
}),
|
|
197
|
-
a
|
|
198
|
-
] });
|
|
199
|
-
})()
|
|
200
|
-
})
|
|
201
|
-
]
|
|
202
|
-
})
|
|
203
|
-
})
|
|
204
|
-
})
|
|
205
|
-
})
|
|
206
|
-
] });
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Body, Button, Container, Head, Heading, Hr, Html, Img, Link, Preview, pixelBasedPreset, Section, Tailwind, Text } from "@react-email/components";
|
|
3
|
+
import { cn } from "../../../lib/utils";
|
|
4
|
+
import { EmailStyles } from "./email-styles";
|
|
5
|
+
const newDeviceEmailLocalization = {
|
|
6
|
+
NEW_SIGN_IN_DETECTED: "New sign-in detected",
|
|
7
|
+
LOGO: "Logo",
|
|
8
|
+
NEW_SIGN_IN_TO_YOUR_ACCOUNT: "We detected a new sign-in to your {appName} account {userEmail} from a device we don't recognize.",
|
|
9
|
+
DEVICE_DETAILS: "Device details",
|
|
10
|
+
BROWSER: "Browser",
|
|
11
|
+
OPERATING_SYSTEM: "Operating System",
|
|
12
|
+
LOCATION: "Location",
|
|
13
|
+
IP_ADDRESS: "IP Address",
|
|
14
|
+
TIME: "Time",
|
|
15
|
+
IF_THIS_WAS_YOU: "If this was you, you can safely ignore this email. If you don't recognize this activity, please secure your account immediately.",
|
|
16
|
+
SECURE_MY_ACCOUNT: "Secure my account",
|
|
17
|
+
EMAIL_SENT_BY: "Email sent by {appName}.",
|
|
18
|
+
IF_YOU_DIDNT_SIGN_IN: "If you didn't sign in, please contact support immediately {supportEmail} to secure your account.",
|
|
19
|
+
POWERED_BY_BETTER_AUTH: "Powered by {betterAuth}"
|
|
207
20
|
};
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Email template component that notifies users when a new device signs into their account.
|
|
23
|
+
*
|
|
24
|
+
* This email includes:
|
|
25
|
+
* - Device information display (browser, OS, location, IP, timestamp)
|
|
26
|
+
* - Secure account action button
|
|
27
|
+
* - Security warnings and support contact information
|
|
28
|
+
* - Customizable branding and styling
|
|
29
|
+
* - Support for light/dark mode themes
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* <NewDeviceEmail
|
|
34
|
+
* userEmail="user@example.com"
|
|
35
|
+
* deviceInfo={{
|
|
36
|
+
* browser: "Chrome on macOS",
|
|
37
|
+
* os: "macOS 14.0",
|
|
38
|
+
* location: "San Francisco, CA",
|
|
39
|
+
* ipAddress: "192.168.1.1",
|
|
40
|
+
* timestamp: "February 10, 2025 at 4:20 PM UTC"
|
|
41
|
+
* }}
|
|
42
|
+
* secureAccountLink="https://example.com/secure-account"
|
|
43
|
+
* appName="My App"
|
|
44
|
+
* supportEmail="support@example.com"
|
|
45
|
+
* darkMode={true}
|
|
46
|
+
* />
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export const NewDeviceEmail = ({ userEmail, deviceInfo, secureAccountLink, appName, supportEmail, logoURL, colors, classNames, darkMode = true, poweredBy, head, ...props }) => {
|
|
50
|
+
const localization = {
|
|
51
|
+
...NewDeviceEmail.localization,
|
|
52
|
+
...props.localization
|
|
53
|
+
};
|
|
54
|
+
const previewText = localization.NEW_SIGN_IN_DETECTED;
|
|
55
|
+
return (_jsxs(Html, { children: [_jsxs(Head, { children: [_jsx("meta", { content: "light dark", name: "color-scheme" }), _jsx("meta", { content: "light dark", name: "supported-color-schemes" }), _jsx(EmailStyles, { colors: colors, darkMode: darkMode }), head] }), _jsx(Preview, { children: previewText }), _jsx(Tailwind, { config: { presets: [pixelBasedPreset] }, children: _jsx(Body, { className: cn("bg-background font-sans", classNames?.body), children: _jsx(Container, { className: cn("mx-auto my-auto max-w-xl px-2 py-10", classNames?.container), children: _jsxs(Section, { className: cn("bg-card text-card-foreground rounded-none border border-border p-8", classNames?.card), children: [logoURL &&
|
|
56
|
+
(typeof logoURL === "string" ? (_jsx(Img, { src: logoURL, width: 48, height: 48, alt: appName || localization.LOGO, className: cn("mx-auto mb-8", classNames?.logo) })) : (_jsxs(_Fragment, { children: [_jsx(Img, { src: logoURL.light, width: 48, height: 48, alt: appName || localization.LOGO, className: cn("mx-auto mb-8 logo-light", classNames?.logo) }), _jsx(Img, { src: logoURL.dark, width: 48, height: 48, alt: appName || localization.LOGO, className: cn("hidden mx-auto mb-8 logo-dark", classNames?.logo) })] }))), _jsx(Heading, { className: cn("m-0 mb-5 text-2xl font-semibold", classNames?.title), children: localization.NEW_SIGN_IN_DETECTED }), _jsx(Text, { className: cn("text-sm font-normal", classNames?.content), children: (() => {
|
|
57
|
+
const textWithAppName = localization.NEW_SIGN_IN_TO_YOUR_ACCOUNT.replace("{appName}", appName || "")
|
|
58
|
+
.replace(/\s{2,}/g, " ")
|
|
59
|
+
.replace(" .", ".");
|
|
60
|
+
const [beforeUserEmail, afterUserEmail] = textWithAppName.split("{userEmail}");
|
|
61
|
+
return userEmail ? (_jsxs(_Fragment, { children: [beforeUserEmail, _jsx(Link, { href: `mailto:${userEmail}`, className: "text-primary font-medium", children: userEmail }), afterUserEmail] })) : (textWithAppName
|
|
62
|
+
.replace("{userEmail}", "")
|
|
63
|
+
.replace(/\s{2,}/g, " ")
|
|
64
|
+
.replace(" .", "."));
|
|
65
|
+
})() }), deviceInfo && (_jsxs(Section, { className: cn("my-6 border border-border bg-muted p-4", classNames?.codeBlock), children: [_jsxs(Text, { className: cn("m-0 mb-3 text-xs text-muted-foreground", classNames?.description), children: [localization.DEVICE_DETAILS, ":"] }), deviceInfo.browser && (_jsxs(Text, { className: cn("m-0 mb-2 text-sm", classNames?.content), children: [_jsxs("span", { className: "font-semibold", children: [localization.BROWSER, ":"] }), " ", deviceInfo.browser] })), deviceInfo.os && (_jsxs(Text, { className: cn("m-0 mb-2 text-sm", classNames?.content), children: [_jsxs("span", { className: "font-semibold", children: [localization.OPERATING_SYSTEM, ":"] }), " ", deviceInfo.os] })), deviceInfo.location && (_jsxs(Text, { className: cn("m-0 mb-2 text-sm", classNames?.content), children: [_jsxs("span", { className: "font-semibold", children: [localization.LOCATION, ":"] }), " ", deviceInfo.location] })), deviceInfo.ipAddress && (_jsxs(Text, { className: cn("m-0 mb-2 text-sm", classNames?.content), children: [_jsxs("span", { className: "font-semibold", children: [localization.IP_ADDRESS, ":"] }), " ", deviceInfo.ipAddress] })), deviceInfo.timestamp && (_jsxs(Text, { className: cn("m-0 text-sm", classNames?.content), children: [_jsxs("span", { className: "font-semibold", children: [localization.TIME, ":"] }), " ", deviceInfo.timestamp] }))] })), _jsx(Text, { className: cn("text-sm font-normal", classNames?.content), children: localization.IF_THIS_WAS_YOU }), secureAccountLink && (_jsx(Section, { className: "mt-6", children: _jsx(Button, { href: secureAccountLink, className: cn("inline-block whitespace-nowrap rounded-none text-sm font-medium py-2.5 px-6 bg-primary text-primary-foreground no-underline", classNames?.button), children: localization.SECURE_MY_ACCOUNT }) })), _jsx(Hr, { className: cn("my-6 w-full border border-solid border-border", classNames?.separator) }), appName && (_jsx(Text, { className: cn("mb-3 text-xs text-muted-foreground", classNames?.description), children: localization.EMAIL_SENT_BY.replace("{appName}", appName) })), _jsx(Text, { className: cn("mt-3 text-xs text-muted-foreground", classNames?.description), children: (() => {
|
|
66
|
+
const [beforeSupportEmail, afterSupportEmail] = localization.IF_YOU_DIDNT_SIGN_IN.split("{supportEmail}");
|
|
67
|
+
return supportEmail ? (_jsxs(_Fragment, { children: [beforeSupportEmail, _jsx(Link, { href: `mailto:${supportEmail}`, className: cn("text-primary underline", classNames?.link), children: supportEmail }), afterSupportEmail] })) : (localization.IF_YOU_DIDNT_SIGN_IN.replace("{supportEmail}", "")
|
|
68
|
+
.replace(/\s{2,}/g, " ")
|
|
69
|
+
.replace(" .", "."));
|
|
70
|
+
})() }), poweredBy && (_jsx(Text, { className: cn("mt-4 mb-0 text-center text-[11px] text-muted-foreground", classNames?.poweredBy), children: (() => {
|
|
71
|
+
const [beforeBetterAuth, afterBetterAuth] = localization.POWERED_BY_BETTER_AUTH.split("{betterAuth}");
|
|
72
|
+
return (_jsxs(_Fragment, { children: [beforeBetterAuth, _jsx(Link, { href: "https://better-auth.com", className: cn("text-primary underline", classNames?.link), children: "better-auth" }), afterBetterAuth] }));
|
|
73
|
+
})() }))] }) }) }) })] }));
|
|
221
74
|
};
|
|
222
|
-
|
|
223
|
-
|
|
75
|
+
NewDeviceEmail.localization = newDeviceEmailLocalization;
|
|
76
|
+
NewDeviceEmail.PreviewProps = {
|
|
77
|
+
userEmail: "m@example.com",
|
|
78
|
+
deviceInfo: {
|
|
79
|
+
browser: "Chrome on macOS",
|
|
80
|
+
os: "macOS 26.2",
|
|
81
|
+
location: "San Francisco, CA, United States",
|
|
82
|
+
ipAddress: "127.0.0.1",
|
|
83
|
+
timestamp: "February 10, 2025 at 4:20 PM UTC"
|
|
84
|
+
},
|
|
85
|
+
secureAccountLink: "https://better-auth-ui.com/auth/secure-account",
|
|
86
|
+
appName: "Better Auth",
|
|
87
|
+
supportEmail: "support@example.com",
|
|
88
|
+
darkMode: true
|
|
89
|
+
};
|
|
90
|
+
export default NewDeviceEmail;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { type EmailClassNames, type EmailColors } from "./email-styles";
|
|
3
|
+
declare const organizationInvitationEmailLocalization: {
|
|
4
|
+
YOU_RE_INVITED_TO_ORGANIZATION: string;
|
|
5
|
+
YOU_RE_INVITED: string;
|
|
6
|
+
LOGO: string;
|
|
7
|
+
ORGANIZATION_LOGO: string;
|
|
8
|
+
INVITED_TO_JOIN_ORGANIZATION: string;
|
|
9
|
+
ACCEPT_INVITATION: string;
|
|
10
|
+
VIEW_INVITATION: string;
|
|
11
|
+
OR_COPY_AND_PASTE_URL: string;
|
|
12
|
+
THIS_INVITATION_EXPIRES_IN_HOURS: string;
|
|
13
|
+
EMAIL_SENT_BY: string;
|
|
14
|
+
IF_YOU_DIDNT_EXPECT_THIS_INVITATION: string;
|
|
15
|
+
POWERED_BY_BETTER_AUTH: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Localization strings for the OrganizationInvitationEmail component.
|
|
19
|
+
*
|
|
20
|
+
* Contains all text content used in the organization invitation email template.
|
|
21
|
+
*/
|
|
22
|
+
export type OrganizationInvitationEmailLocalization = typeof organizationInvitationEmailLocalization;
|
|
23
|
+
/**
|
|
24
|
+
* Props for the OrganizationInvitationEmail component.
|
|
25
|
+
*/
|
|
26
|
+
export interface OrganizationInvitationEmailProps {
|
|
27
|
+
/**
|
|
28
|
+
* URL where the invitee can review and accept the invitation.
|
|
29
|
+
*
|
|
30
|
+
* @remarks Pass `{baseUrl}/settings/organizations` — this is where pending
|
|
31
|
+
* organization invitations are listed in the settings UI.
|
|
32
|
+
*/
|
|
33
|
+
url: string;
|
|
34
|
+
/** Email address of the user being invited */
|
|
35
|
+
email?: string;
|
|
36
|
+
/** Name of the person who sent the invitation */
|
|
37
|
+
inviterName?: string;
|
|
38
|
+
/** Email address of the person who sent the invitation */
|
|
39
|
+
inviterEmail?: string;
|
|
40
|
+
/** Name of the organization the user is being invited to */
|
|
41
|
+
organizationName?: string;
|
|
42
|
+
/** Organization logo URL(s) - a single string or light/dark variants. */
|
|
43
|
+
organizationLogoURL?: string | {
|
|
44
|
+
light: string;
|
|
45
|
+
dark: string;
|
|
46
|
+
};
|
|
47
|
+
/** Role being offered to the invitee (e.g. "member", "admin", "owner") */
|
|
48
|
+
role?: string;
|
|
49
|
+
/** Name of the application sending the email */
|
|
50
|
+
appName?: string;
|
|
51
|
+
/** Number of hours until the invitation expires */
|
|
52
|
+
expirationHours?: number;
|
|
53
|
+
/** Logo URL(s) - a single string or light/dark variants. If omitted, no logo is shown. */
|
|
54
|
+
logoURL?: string | {
|
|
55
|
+
light: string;
|
|
56
|
+
dark: string;
|
|
57
|
+
};
|
|
58
|
+
/** Custom CSS class names for styling specific parts of the email */
|
|
59
|
+
classNames?: EmailClassNames;
|
|
60
|
+
/** Custom color scheme for light and dark modes */
|
|
61
|
+
colors?: EmailColors;
|
|
62
|
+
/** Whether to show the "Powered by better-auth" footer */
|
|
63
|
+
poweredBy?: boolean;
|
|
64
|
+
/** Whether to enable dark mode support */
|
|
65
|
+
darkMode?: boolean;
|
|
66
|
+
/** Additional React nodes to inject into the email head */
|
|
67
|
+
head?: ReactNode;
|
|
68
|
+
/**
|
|
69
|
+
* Localization overrides for customizing email text
|
|
70
|
+
* @remarks `OrganizationInvitationEmailLocalization`
|
|
71
|
+
*/
|
|
72
|
+
localization?: Partial<OrganizationInvitationEmailLocalization>;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Email template component that invites a user to join an organization.
|
|
76
|
+
*
|
|
77
|
+
* This email includes:
|
|
78
|
+
* - Inviter and organization details
|
|
79
|
+
* - Role being offered
|
|
80
|
+
* - Accept invitation button linking to `{baseUrl}/settings/organizations`
|
|
81
|
+
* - Fallback URL for manual copy/paste
|
|
82
|
+
* - Optional expiration time information
|
|
83
|
+
* - Security notice for unexpected invitations
|
|
84
|
+
* - Customizable branding and styling
|
|
85
|
+
* - Support for light/dark mode themes
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```tsx
|
|
89
|
+
* <OrganizationInvitationEmail
|
|
90
|
+
* url="https://example.com/settings/organizations"
|
|
91
|
+
* email="invitee@example.com"
|
|
92
|
+
* inviterName="Jane Doe"
|
|
93
|
+
* inviterEmail="jane@example.com"
|
|
94
|
+
* organizationName="Acme Inc."
|
|
95
|
+
* organizationLogoURL="https://example.com/acme-logo.png"
|
|
96
|
+
* role="member"
|
|
97
|
+
* appName="My App"
|
|
98
|
+
* expirationHours={48}
|
|
99
|
+
* darkMode={true}
|
|
100
|
+
* />
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
export declare const OrganizationInvitationEmail: {
|
|
104
|
+
({ url, email, inviterName, inviterEmail, organizationName, organizationLogoURL, role, appName, expirationHours, logoURL, colors, classNames, darkMode, poweredBy, head, ...props }: OrganizationInvitationEmailProps): import("react/jsx-runtime").JSX.Element;
|
|
105
|
+
localization: {
|
|
106
|
+
YOU_RE_INVITED_TO_ORGANIZATION: string;
|
|
107
|
+
YOU_RE_INVITED: string;
|
|
108
|
+
LOGO: string;
|
|
109
|
+
ORGANIZATION_LOGO: string;
|
|
110
|
+
INVITED_TO_JOIN_ORGANIZATION: string;
|
|
111
|
+
ACCEPT_INVITATION: string;
|
|
112
|
+
VIEW_INVITATION: string;
|
|
113
|
+
OR_COPY_AND_PASTE_URL: string;
|
|
114
|
+
THIS_INVITATION_EXPIRES_IN_HOURS: string;
|
|
115
|
+
EMAIL_SENT_BY: string;
|
|
116
|
+
IF_YOU_DIDNT_EXPECT_THIS_INVITATION: string;
|
|
117
|
+
POWERED_BY_BETTER_AUTH: string;
|
|
118
|
+
};
|
|
119
|
+
PreviewProps: OrganizationInvitationEmailProps;
|
|
120
|
+
};
|
|
121
|
+
export default OrganizationInvitationEmail;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Body, Button, Container, Head, Heading, Hr, Html, Img, Link, Preview, pixelBasedPreset, Section, Tailwind, Text } from "@react-email/components";
|
|
3
|
+
import { cn } from "../../../lib/utils";
|
|
4
|
+
import { EmailStyles } from "./email-styles";
|
|
5
|
+
const organizationInvitationEmailLocalization = {
|
|
6
|
+
YOU_RE_INVITED_TO_ORGANIZATION: "You're invited to {organizationName}",
|
|
7
|
+
YOU_RE_INVITED: "You're invited",
|
|
8
|
+
LOGO: "Logo",
|
|
9
|
+
ORGANIZATION_LOGO: "Organization logo",
|
|
10
|
+
INVITED_TO_JOIN_ORGANIZATION: "{inviterName} ({inviterEmail}) has invited you to join {organizationName} on {appName} as a {role}.",
|
|
11
|
+
ACCEPT_INVITATION: "Accept invitation",
|
|
12
|
+
VIEW_INVITATION: "View invitation",
|
|
13
|
+
OR_COPY_AND_PASTE_URL: "Or copy and paste this URL into your browser:",
|
|
14
|
+
THIS_INVITATION_EXPIRES_IN_HOURS: "This invitation expires in {expirationHours} hours.",
|
|
15
|
+
EMAIL_SENT_BY: "Email sent by {appName}.",
|
|
16
|
+
IF_YOU_DIDNT_EXPECT_THIS_INVITATION: "If you didn't expect this invitation, you can safely ignore this email.",
|
|
17
|
+
POWERED_BY_BETTER_AUTH: "Powered by {betterAuth}"
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Email template component that invites a user to join an organization.
|
|
21
|
+
*
|
|
22
|
+
* This email includes:
|
|
23
|
+
* - Inviter and organization details
|
|
24
|
+
* - Role being offered
|
|
25
|
+
* - Accept invitation button linking to `{baseUrl}/settings/organizations`
|
|
26
|
+
* - Fallback URL for manual copy/paste
|
|
27
|
+
* - Optional expiration time information
|
|
28
|
+
* - Security notice for unexpected invitations
|
|
29
|
+
* - Customizable branding and styling
|
|
30
|
+
* - Support for light/dark mode themes
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```tsx
|
|
34
|
+
* <OrganizationInvitationEmail
|
|
35
|
+
* url="https://example.com/settings/organizations"
|
|
36
|
+
* email="invitee@example.com"
|
|
37
|
+
* inviterName="Jane Doe"
|
|
38
|
+
* inviterEmail="jane@example.com"
|
|
39
|
+
* organizationName="Acme Inc."
|
|
40
|
+
* organizationLogoURL="https://example.com/acme-logo.png"
|
|
41
|
+
* role="member"
|
|
42
|
+
* appName="My App"
|
|
43
|
+
* expirationHours={48}
|
|
44
|
+
* darkMode={true}
|
|
45
|
+
* />
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export const OrganizationInvitationEmail = ({ url, email, inviterName, inviterEmail, organizationName, organizationLogoURL, role, appName, expirationHours = 48, logoURL, colors, classNames, darkMode = true, poweredBy, head, ...props }) => {
|
|
49
|
+
const localization = {
|
|
50
|
+
...OrganizationInvitationEmail.localization,
|
|
51
|
+
...props.localization
|
|
52
|
+
};
|
|
53
|
+
const previewText = organizationName
|
|
54
|
+
? localization.YOU_RE_INVITED_TO_ORGANIZATION.replace("{organizationName}", organizationName)
|
|
55
|
+
: localization.YOU_RE_INVITED;
|
|
56
|
+
return (_jsxs(Html, { children: [_jsxs(Head, { children: [_jsx("meta", { content: "light dark", name: "color-scheme" }), _jsx("meta", { content: "light dark", name: "supported-color-schemes" }), _jsx(EmailStyles, { colors: colors, darkMode: darkMode }), head] }), _jsx(Preview, { children: previewText }), _jsx(Tailwind, { config: { presets: [pixelBasedPreset] }, children: _jsx(Body, { className: cn("bg-background font-sans", classNames?.body), children: _jsx(Container, { className: cn("mx-auto my-auto max-w-xl px-2 py-10", classNames?.container), children: _jsxs(Section, { className: cn("bg-card text-card-foreground rounded-none border border-border p-8", classNames?.card), children: [logoURL &&
|
|
57
|
+
(typeof logoURL === "string" ? (_jsx(Img, { src: logoURL, width: 48, height: 48, alt: appName || localization.LOGO, className: cn("mx-auto mb-8", classNames?.logo) })) : (_jsxs(_Fragment, { children: [_jsx(Img, { src: logoURL.light, width: 48, height: 48, alt: appName || localization.LOGO, className: cn("mx-auto mb-8 logo-light", classNames?.logo) }), _jsx(Img, { src: logoURL.dark, width: 48, height: 48, alt: appName || localization.LOGO, className: cn("hidden mx-auto mb-8 logo-dark", classNames?.logo) })] }))), _jsx(Heading, { className: cn("m-0 mb-5 text-2xl font-semibold", classNames?.title), children: organizationName
|
|
58
|
+
? localization.YOU_RE_INVITED_TO_ORGANIZATION.replace("{organizationName}", organizationName)
|
|
59
|
+
: localization.YOU_RE_INVITED }), organizationLogoURL &&
|
|
60
|
+
(typeof organizationLogoURL === "string" ? (_jsx(Img, { src: organizationLogoURL, width: 56, height: 56, alt: organizationName || localization.ORGANIZATION_LOGO, className: cn("mb-5 rounded-md", classNames?.logo) })) : (_jsxs(_Fragment, { children: [_jsx(Img, { src: organizationLogoURL.light, width: 56, height: 56, alt: organizationName || localization.ORGANIZATION_LOGO, className: cn("mb-5 rounded-md logo-light", classNames?.logo) }), _jsx(Img, { src: organizationLogoURL.dark, width: 56, height: 56, alt: organizationName || localization.ORGANIZATION_LOGO, className: cn("hidden mb-5 rounded-md logo-dark", classNames?.logo) })] }))), _jsx(Text, { className: cn("m-0 text-sm font-normal", classNames?.content), children: (() => {
|
|
61
|
+
let text = localization.INVITED_TO_JOIN_ORGANIZATION.replace("{appName}", appName || "")
|
|
62
|
+
.replace("{organizationName}", organizationName || "")
|
|
63
|
+
.replace("{role}", role || "");
|
|
64
|
+
// If we have no inviter info, drop the parenthetical and name placeholders cleanly.
|
|
65
|
+
if (!inviterName && !inviterEmail) {
|
|
66
|
+
text = text
|
|
67
|
+
.replace("{inviterName} ({inviterEmail})", "Someone")
|
|
68
|
+
.replace("{inviterName}", "Someone")
|
|
69
|
+
.replace("({inviterEmail})", "");
|
|
70
|
+
}
|
|
71
|
+
const [beforeInviterName, afterInviterName] = text.split("{inviterName}");
|
|
72
|
+
const renderInviterEmail = (segment) => {
|
|
73
|
+
const [beforeInviterEmail, afterInviterEmail] = segment.split("{inviterEmail}");
|
|
74
|
+
if (!inviterEmail) {
|
|
75
|
+
return segment
|
|
76
|
+
.replace("({inviterEmail})", "")
|
|
77
|
+
.replace("{inviterEmail}", "")
|
|
78
|
+
.replace(/\s{2,}/g, " ")
|
|
79
|
+
.replace(" .", ".");
|
|
80
|
+
}
|
|
81
|
+
return (_jsxs(_Fragment, { children: [beforeInviterEmail, _jsx(Link, { href: `mailto:${inviterEmail}`, className: "text-primary font-medium", children: inviterEmail }), afterInviterEmail] }));
|
|
82
|
+
};
|
|
83
|
+
if (!inviterName) {
|
|
84
|
+
return renderInviterEmail(text
|
|
85
|
+
.replace("{inviterName}", "")
|
|
86
|
+
.replace(/\s{2,}/g, " ")
|
|
87
|
+
.replace(" .", "."));
|
|
88
|
+
}
|
|
89
|
+
return (_jsxs(_Fragment, { children: [beforeInviterName, _jsx("span", { className: "font-medium", children: inviterName }), renderInviterEmail(afterInviterName ?? "")] }));
|
|
90
|
+
})() }), _jsx(Section, { className: "my-6", children: _jsx(Button, { href: url, className: cn("inline-block whitespace-nowrap rounded-none text-sm font-medium py-2.5 px-6 bg-primary text-primary-foreground no-underline", classNames?.button), children: localization.ACCEPT_INVITATION }) }), _jsx(Text, { className: cn("m-0 mb-3 text-xs text-muted-foreground", classNames?.description), children: localization.OR_COPY_AND_PASTE_URL }), _jsx(Link, { className: cn("break-all text-xs text-primary", classNames?.link), href: url, children: url }), _jsx(Hr, { className: cn("my-6 w-full border border-solid border-border", classNames?.separator) }), expirationHours || appName ? (_jsxs(Text, { className: cn("m-0 mb-3 text-xs text-muted-foreground", classNames?.description), children: [expirationHours
|
|
91
|
+
? localization.THIS_INVITATION_EXPIRES_IN_HOURS.replace("{expirationHours}", expirationHours.toString())
|
|
92
|
+
: null, appName && (_jsxs(_Fragment, { children: [expirationHours ? " " : "", localization.EMAIL_SENT_BY.replace("{appName}", appName)] }))] })) : null, _jsx(Text, { className: cn("m-0 text-xs text-muted-foreground", classNames?.description), children: localization.IF_YOU_DIDNT_EXPECT_THIS_INVITATION }), poweredBy && (_jsx(Text, { className: cn("m-0 mt-4 text-center text-[11px] text-muted-foreground", classNames?.poweredBy), children: (() => {
|
|
93
|
+
const [beforeBetterAuth, afterBetterAuth] = localization.POWERED_BY_BETTER_AUTH.split("{betterAuth}");
|
|
94
|
+
return (_jsxs(_Fragment, { children: [beforeBetterAuth, _jsx(Link, { href: "https://better-auth.com", className: cn("text-primary underline", classNames?.link), children: "better-auth" }), afterBetterAuth] }));
|
|
95
|
+
})() }))] }) }) }) })] }));
|
|
96
|
+
};
|
|
97
|
+
OrganizationInvitationEmail.localization =
|
|
98
|
+
organizationInvitationEmailLocalization;
|
|
99
|
+
OrganizationInvitationEmail.PreviewProps = {
|
|
100
|
+
url: "https://better-auth-ui.com/settings/organizations",
|
|
101
|
+
email: "m@example.com",
|
|
102
|
+
inviterName: "Jane Doe",
|
|
103
|
+
inviterEmail: "jane@example.com",
|
|
104
|
+
organizationName: "Acme Inc.",
|
|
105
|
+
role: "member",
|
|
106
|
+
appName: "Better Auth",
|
|
107
|
+
expirationHours: 48,
|
|
108
|
+
darkMode: true
|
|
109
|
+
};
|
|
110
|
+
export default OrganizationInvitationEmail;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ReactNode } from
|
|
2
|
-
import { EmailClassNames, EmailColors } from
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { type EmailClassNames, type EmailColors } from "./email-styles";
|
|
3
3
|
declare const otpEmailLocalization: {
|
|
4
4
|
YOUR_VERIFICATION_CODE_IS_CODE: string;
|
|
5
5
|
LOGO: string;
|