@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,7 +1,7 @@
|
|
|
1
|
-
import { AuthConfig, DeepPartial } from
|
|
2
|
-
import { QueryClient } from
|
|
3
|
-
import { PropsWithChildren, ReactNode } from
|
|
4
|
-
import { AuthClient } from
|
|
1
|
+
import { type AuthConfig, type DeepPartial } from "@better-auth-ui/core";
|
|
2
|
+
import { QueryClient } from "@tanstack/react-query";
|
|
3
|
+
import { type PropsWithChildren, type ReactNode } from "react";
|
|
4
|
+
import type { AuthClient } from "../../lib/auth-client";
|
|
5
5
|
declare module "@better-auth-ui/core" {
|
|
6
6
|
interface AuthConfig {
|
|
7
7
|
/**
|
|
@@ -1,44 +1,68 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import { deepmerge
|
|
4
|
-
import { QueryClient
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { deepmerge, defaultAuthConfig } from "@better-auth-ui/core";
|
|
4
|
+
import { QueryClient, QueryClientContext, QueryClientProvider } from "@tanstack/react-query";
|
|
5
|
+
import { useContext } from "react";
|
|
6
|
+
import { MutationInvalidator } from "../mutation-invalidator";
|
|
7
|
+
import { AuthContext } from "./auth-context";
|
|
8
|
+
import { FetchOptionsProvider } from "./fetch-options-provider";
|
|
9
|
+
const fallbackQueryClient = new QueryClient({
|
|
10
|
+
defaultOptions: {
|
|
11
|
+
queries: {
|
|
12
|
+
staleTime: 5000
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
/**
|
|
17
|
+
* Provides merged authentication configuration and a resolved React Query client to descendant components.
|
|
18
|
+
*
|
|
19
|
+
* The component merges the provided auth config with the library defaults, updates `redirectTo` from the
|
|
20
|
+
* current URL when the app is hydrated, wires a QueryClient (prop, context, or fallback) and installs an
|
|
21
|
+
* error handler that surfaces query errors via the configured toast. It then supplies the merged config
|
|
22
|
+
* via AuthContext and wraps children with QueryClientProvider.
|
|
23
|
+
*
|
|
24
|
+
* @returns The children wrapped with AuthContext.Provider and QueryClientProvider configured for auth.
|
|
25
|
+
*/
|
|
26
|
+
export function AuthProvider({ children, queryClient, ...config }) {
|
|
27
|
+
const { authClient, ...partialConfig } = config;
|
|
28
|
+
const mergedConfig = {
|
|
29
|
+
...deepmerge(defaultAuthConfig, partialConfig),
|
|
30
|
+
authClient
|
|
31
|
+
};
|
|
32
|
+
mergedConfig.redirectTo =
|
|
33
|
+
(typeof window !== "undefined" &&
|
|
34
|
+
new URLSearchParams(window.location.search).get("redirectTo")?.trim()) ||
|
|
35
|
+
mergedConfig.redirectTo;
|
|
36
|
+
// Merge plugin-contributed `additionalFields` with user-supplied ones.
|
|
37
|
+
// Plugin order is preserved; user-supplied entries with the same `name`
|
|
38
|
+
// override the plugin contribution.
|
|
39
|
+
const fieldsByName = new Map();
|
|
40
|
+
for (const plugin of mergedConfig.plugins ?? []) {
|
|
41
|
+
for (const field of plugin.additionalFields ?? []) {
|
|
42
|
+
fieldsByName.set(field.name, field);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
for (const field of mergedConfig.additionalFields ?? []) {
|
|
46
|
+
fieldsByName.set(field.name, field);
|
|
47
|
+
}
|
|
48
|
+
mergedConfig.additionalFields = Array.from(fieldsByName.values());
|
|
49
|
+
const contextQueryClient = useContext(QueryClientContext);
|
|
50
|
+
return (_jsx(QueryClientProvider, { client: queryClient || contextQueryClient || fallbackQueryClient, children: _jsx(AuthContext.Provider, { value: mergedConfig, children: _jsxs(FetchOptionsProvider, { children: [_jsx(MutationInvalidator, {}), children] }) }) }));
|
|
37
51
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
52
|
+
/**
|
|
53
|
+
* Accesses the current authentication configuration from AuthContext.
|
|
54
|
+
*
|
|
55
|
+
* UI packages widen the plugin type globally via the `Register` interface
|
|
56
|
+
* (see module augmentation in `@better-auth-ui/heroui`), so callers don't
|
|
57
|
+
* need to pass a generic.
|
|
58
|
+
*
|
|
59
|
+
* @returns The merged authentication configuration provided by AuthProvider.
|
|
60
|
+
* @throws If no AuthProvider is present in the component tree.
|
|
61
|
+
*/
|
|
62
|
+
export function useAuth() {
|
|
63
|
+
const context = useContext(AuthContext);
|
|
64
|
+
if (!context) {
|
|
65
|
+
throw new Error("[Better Auth UI] AuthProvider is required");
|
|
66
|
+
}
|
|
67
|
+
return context;
|
|
42
68
|
}
|
|
43
|
-
//#endregion
|
|
44
|
-
export { d as AuthProvider, f as useAuth };
|
|
@@ -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 emailChangedEmailLocalization: {
|
|
4
4
|
YOUR_EMAIL_ADDRESS_HAS_BEEN_CHANGED: string;
|
|
5
5
|
LOGO: string;
|
|
@@ -1,156 +1,70 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
POWERED_BY_BETTER_AUTH: "Powered by {betterAuth}"
|
|
18
|
-
}, b = ({ oldEmail: y, newEmail: x, revertURL: S, appName: C, supportEmail: w, logoURL: T, colors: E, classNames: D, darkMode: O = !0, poweredBy: k, head: A, ...j }) => {
|
|
19
|
-
let M = {
|
|
20
|
-
...b.localization,
|
|
21
|
-
...j.localization
|
|
22
|
-
}, N = M.YOUR_EMAIL_ADDRESS_HAS_BEEN_CHANGED;
|
|
23
|
-
return /* @__PURE__ */ i(d, { children: [
|
|
24
|
-
/* @__PURE__ */ i(c, { children: [
|
|
25
|
-
/* @__PURE__ */ r("meta", {
|
|
26
|
-
content: "light dark",
|
|
27
|
-
name: "color-scheme"
|
|
28
|
-
}),
|
|
29
|
-
/* @__PURE__ */ r("meta", {
|
|
30
|
-
content: "light dark",
|
|
31
|
-
name: "supported-color-schemes"
|
|
32
|
-
}),
|
|
33
|
-
/* @__PURE__ */ r(t, {
|
|
34
|
-
colors: E,
|
|
35
|
-
darkMode: O
|
|
36
|
-
}),
|
|
37
|
-
A
|
|
38
|
-
] }),
|
|
39
|
-
/* @__PURE__ */ r(m, { children: N }),
|
|
40
|
-
/* @__PURE__ */ r(g, {
|
|
41
|
-
config: { presets: [v] },
|
|
42
|
-
children: /* @__PURE__ */ r(a, {
|
|
43
|
-
className: e("bg-background font-sans", D?.body),
|
|
44
|
-
children: /* @__PURE__ */ r(s, {
|
|
45
|
-
className: e("mx-auto my-auto max-w-xl px-2 py-10", D?.container),
|
|
46
|
-
children: /* @__PURE__ */ i(h, {
|
|
47
|
-
className: e("bg-card text-card-foreground rounded-none border border-border p-8", D?.card),
|
|
48
|
-
children: [
|
|
49
|
-
T && (typeof T == "string" ? /* @__PURE__ */ r(f, {
|
|
50
|
-
src: T,
|
|
51
|
-
width: 48,
|
|
52
|
-
height: 48,
|
|
53
|
-
alt: C || M.LOGO,
|
|
54
|
-
className: e("mx-auto mb-8", D?.logo)
|
|
55
|
-
}) : /* @__PURE__ */ i(n, { children: [/* @__PURE__ */ r(f, {
|
|
56
|
-
src: T.light,
|
|
57
|
-
width: 48,
|
|
58
|
-
height: 48,
|
|
59
|
-
alt: C || M.LOGO,
|
|
60
|
-
className: e("mx-auto mb-8 logo-light", D?.logo)
|
|
61
|
-
}), /* @__PURE__ */ r(f, {
|
|
62
|
-
src: T.dark,
|
|
63
|
-
width: 48,
|
|
64
|
-
height: 48,
|
|
65
|
-
alt: C || M.LOGO,
|
|
66
|
-
className: e("hidden mx-auto mb-8 logo-dark", D?.logo)
|
|
67
|
-
})] })),
|
|
68
|
-
/* @__PURE__ */ r(l, {
|
|
69
|
-
className: e("m-0 mb-5 text-2xl font-semibold", D?.title),
|
|
70
|
-
children: M.EMAIL_ADDRESS_CHANGED
|
|
71
|
-
}),
|
|
72
|
-
/* @__PURE__ */ r(_, {
|
|
73
|
-
className: e("text-sm font-normal", D?.content),
|
|
74
|
-
children: M.EMAIL_ADDRESS_FOR_YOUR_ACCOUNT_CHANGED.replace("{appName}", C || "").replace(/\s{2,}/g, " ").replace(" .", ".")
|
|
75
|
-
}),
|
|
76
|
-
(y || x) && /* @__PURE__ */ i(h, {
|
|
77
|
-
className: e("my-6 border border-border bg-muted p-4", D?.codeBlock),
|
|
78
|
-
children: [y && /* @__PURE__ */ i(n, { children: [/* @__PURE__ */ r(_, {
|
|
79
|
-
className: e("m-0 mb-2 text-xs text-muted-foreground", D?.description),
|
|
80
|
-
children: M.PREVIOUS_EMAIL
|
|
81
|
-
}), /* @__PURE__ */ r(_, {
|
|
82
|
-
className: e("m-0 mb-4 text-sm font-semibold", D?.content),
|
|
83
|
-
children: y
|
|
84
|
-
})] }), x && /* @__PURE__ */ i(n, { children: [/* @__PURE__ */ r(_, {
|
|
85
|
-
className: e("m-0 mb-2 text-xs text-muted-foreground", D?.description),
|
|
86
|
-
children: M.NEW_EMAIL
|
|
87
|
-
}), /* @__PURE__ */ r(_, {
|
|
88
|
-
className: e("m-0 text-sm font-semibold text-primary", D?.content),
|
|
89
|
-
children: x
|
|
90
|
-
})] })]
|
|
91
|
-
}),
|
|
92
|
-
/* @__PURE__ */ r(_, {
|
|
93
|
-
className: e("text-sm font-normal", D?.content),
|
|
94
|
-
children: M.IF_YOU_MADE_THIS_CHANGE
|
|
95
|
-
}),
|
|
96
|
-
S && /* @__PURE__ */ r(h, {
|
|
97
|
-
className: "my-6",
|
|
98
|
-
children: /* @__PURE__ */ r(o, {
|
|
99
|
-
href: S,
|
|
100
|
-
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),
|
|
101
|
-
children: M.I_DIDNT_MAKE_THIS_CHANGE
|
|
102
|
-
})
|
|
103
|
-
}),
|
|
104
|
-
/* @__PURE__ */ r(u, { className: e("my-6 w-full border border-solid border-border", D?.separator) }),
|
|
105
|
-
C && /* @__PURE__ */ r(_, {
|
|
106
|
-
className: e("mb-3 text-xs text-muted-foreground", D?.description),
|
|
107
|
-
children: M.EMAIL_SENT_BY.replace("{appName}", C)
|
|
108
|
-
}),
|
|
109
|
-
/* @__PURE__ */ r(_, {
|
|
110
|
-
className: e("mt-3 text-xs text-muted-foreground", D?.description),
|
|
111
|
-
children: (() => {
|
|
112
|
-
let [t, a] = M.IF_YOU_DIDNT_AUTHORIZE_THIS_CHANGE.split("{supportEmail}");
|
|
113
|
-
return w ? /* @__PURE__ */ i(n, { children: [
|
|
114
|
-
t,
|
|
115
|
-
/* @__PURE__ */ r(p, {
|
|
116
|
-
href: `mailto:${w}`,
|
|
117
|
-
className: e("text-primary underline", D?.link),
|
|
118
|
-
children: w
|
|
119
|
-
}),
|
|
120
|
-
a
|
|
121
|
-
] }) : M.IF_YOU_DIDNT_AUTHORIZE_THIS_CHANGE.replace("{supportEmail}", "").replace(/\s{2,}/g, " ").replace(" .", ".");
|
|
122
|
-
})()
|
|
123
|
-
}),
|
|
124
|
-
k && /* @__PURE__ */ r(_, {
|
|
125
|
-
className: e("mt-4 mb-0 text-center text-[11px] text-muted-foreground", D?.poweredBy),
|
|
126
|
-
children: (() => {
|
|
127
|
-
let [t, a] = M.POWERED_BY_BETTER_AUTH.split("{betterAuth}");
|
|
128
|
-
return /* @__PURE__ */ i(n, { children: [
|
|
129
|
-
t,
|
|
130
|
-
/* @__PURE__ */ r(p, {
|
|
131
|
-
href: "https://better-auth.com",
|
|
132
|
-
className: e("text-primary underline", D?.link),
|
|
133
|
-
children: "better-auth"
|
|
134
|
-
}),
|
|
135
|
-
a
|
|
136
|
-
] });
|
|
137
|
-
})()
|
|
138
|
-
})
|
|
139
|
-
]
|
|
140
|
-
})
|
|
141
|
-
})
|
|
142
|
-
})
|
|
143
|
-
})
|
|
144
|
-
] });
|
|
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 emailChangedEmailLocalization = {
|
|
6
|
+
YOUR_EMAIL_ADDRESS_HAS_BEEN_CHANGED: "Your email address has been changed",
|
|
7
|
+
LOGO: "Logo",
|
|
8
|
+
EMAIL_ADDRESS_CHANGED: "Email address changed",
|
|
9
|
+
EMAIL_ADDRESS_FOR_YOUR_ACCOUNT_CHANGED: "The email address for your {appName} account has been changed.",
|
|
10
|
+
PREVIOUS_EMAIL: "Previous email:",
|
|
11
|
+
NEW_EMAIL: "New email:",
|
|
12
|
+
IF_YOU_MADE_THIS_CHANGE: "If you made this change, you can safely ignore this email.",
|
|
13
|
+
I_DIDNT_MAKE_THIS_CHANGE: "I didn't make this change",
|
|
14
|
+
EMAIL_SENT_BY: "Email sent by {appName}.",
|
|
15
|
+
IF_YOU_DIDNT_AUTHORIZE_THIS_CHANGE: "If you didn't authorize this change, please contact support immediately {supportEmail} to secure your account.",
|
|
16
|
+
POWERED_BY_BETTER_AUTH: "Powered by {betterAuth}"
|
|
145
17
|
};
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Email template component that notifies users when their email address has been changed.
|
|
20
|
+
*
|
|
21
|
+
* This email includes:
|
|
22
|
+
* - Display of both old and new email addresses
|
|
23
|
+
* - Revert action button if unauthorized change occurred
|
|
24
|
+
* - Security information and support contact details
|
|
25
|
+
* - Customizable branding and styling
|
|
26
|
+
* - Support for light/dark mode themes
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* <EmailChangedEmail
|
|
31
|
+
* oldEmail="old@example.com"
|
|
32
|
+
* newEmail="new@example.com"
|
|
33
|
+
* revertURL="https://example.com/revert?token=abc123"
|
|
34
|
+
* appName="My App"
|
|
35
|
+
* supportEmail="support@example.com"
|
|
36
|
+
* logoURL="https://example.com/logo.png"
|
|
37
|
+
* darkMode={true}
|
|
38
|
+
* />
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export const EmailChangedEmail = ({ oldEmail, newEmail, revertURL, appName, supportEmail, logoURL, colors, classNames, darkMode = true, poweredBy, head, ...props }) => {
|
|
42
|
+
const localization = {
|
|
43
|
+
...EmailChangedEmail.localization,
|
|
44
|
+
...props.localization
|
|
45
|
+
};
|
|
46
|
+
const previewText = localization.YOUR_EMAIL_ADDRESS_HAS_BEEN_CHANGED;
|
|
47
|
+
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 &&
|
|
48
|
+
(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.EMAIL_ADDRESS_CHANGED }), _jsx(Text, { className: cn("text-sm font-normal", classNames?.content), children: localization.EMAIL_ADDRESS_FOR_YOUR_ACCOUNT_CHANGED.replace("{appName}", appName || "")
|
|
49
|
+
.replace(/\s{2,}/g, " ")
|
|
50
|
+
.replace(" .", ".") }), (oldEmail || newEmail) && (_jsxs(Section, { className: cn("my-6 border border-border bg-muted p-4", classNames?.codeBlock), children: [oldEmail && (_jsxs(_Fragment, { children: [_jsx(Text, { className: cn("m-0 mb-2 text-xs text-muted-foreground", classNames?.description), children: localization.PREVIOUS_EMAIL }), _jsx(Text, { className: cn("m-0 mb-4 text-sm font-semibold", classNames?.content), children: oldEmail })] })), newEmail && (_jsxs(_Fragment, { children: [_jsx(Text, { className: cn("m-0 mb-2 text-xs text-muted-foreground", classNames?.description), children: localization.NEW_EMAIL }), _jsx(Text, { className: cn("m-0 text-sm font-semibold text-primary", classNames?.content), children: newEmail })] }))] })), _jsx(Text, { className: cn("text-sm font-normal", classNames?.content), children: localization.IF_YOU_MADE_THIS_CHANGE }), revertURL && (_jsx(Section, { className: "my-6", children: _jsx(Button, { href: revertURL, 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.I_DIDNT_MAKE_THIS_CHANGE }) })), _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: (() => {
|
|
51
|
+
const [beforeSupportEmail, afterSupportEmail] = localization.IF_YOU_DIDNT_AUTHORIZE_THIS_CHANGE.split("{supportEmail}");
|
|
52
|
+
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_AUTHORIZE_THIS_CHANGE.replace("{supportEmail}", "")
|
|
53
|
+
.replace(/\s{2,}/g, " ")
|
|
54
|
+
.replace(" .", "."));
|
|
55
|
+
})() }), poweredBy && (_jsx(Text, { className: cn("mt-4 mb-0 text-center text-[11px] text-muted-foreground", classNames?.poweredBy), children: (() => {
|
|
56
|
+
const [beforeBetterAuth, afterBetterAuth] = localization.POWERED_BY_BETTER_AUTH.split("{betterAuth}");
|
|
57
|
+
return (_jsxs(_Fragment, { children: [beforeBetterAuth, _jsx(Link, { href: "https://better-auth.com", className: cn("text-primary underline", classNames?.link), children: "better-auth" }), afterBetterAuth] }));
|
|
58
|
+
})() }))] }) }) }) })] }));
|
|
154
59
|
};
|
|
155
|
-
|
|
156
|
-
|
|
60
|
+
EmailChangedEmail.localization = emailChangedEmailLocalization;
|
|
61
|
+
EmailChangedEmail.PreviewProps = {
|
|
62
|
+
oldEmail: "old@example.com",
|
|
63
|
+
newEmail: "new@example.com",
|
|
64
|
+
supportEmail: "support@example.com",
|
|
65
|
+
revertURL: "https://better-auth-ui.com/auth/revert-email?token=example-token",
|
|
66
|
+
appName: "Better Auth",
|
|
67
|
+
poweredBy: true,
|
|
68
|
+
darkMode: true
|
|
69
|
+
};
|
|
70
|
+
export default EmailChangedEmail;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Aggregated localization strings for all email components.
|
|
3
3
|
*
|
|
4
4
|
* Combines localization strings from all email templates (EmailChangedEmail,
|
|
5
|
-
* EmailVerificationEmail, MagicLinkEmail, NewDeviceEmail,
|
|
6
|
-
*
|
|
7
|
-
* bulk customization.
|
|
5
|
+
* EmailVerificationEmail, MagicLinkEmail, NewDeviceEmail,
|
|
6
|
+
* OrganizationInvitationEmail, OtpEmail, PasswordChangedEmail,
|
|
7
|
+
* ResetPasswordEmail) into a single object for convenient bulk customization.
|
|
8
8
|
*/
|
|
9
9
|
export declare const emailLocalization: {
|
|
10
10
|
RESET_YOUR_PASSWORD: string;
|
|
@@ -28,6 +28,14 @@ export declare const emailLocalization: {
|
|
|
28
28
|
WE_NEED_TO_VERIFY_YOUR_EMAIL_ADDRESS: string;
|
|
29
29
|
THIS_CODE_EXPIRES_IN_MINUTES: string;
|
|
30
30
|
IF_YOU_DIDNT_REQUEST_THIS_EMAIL: string;
|
|
31
|
+
YOU_RE_INVITED_TO_ORGANIZATION: string;
|
|
32
|
+
YOU_RE_INVITED: string;
|
|
33
|
+
ORGANIZATION_LOGO: string;
|
|
34
|
+
INVITED_TO_JOIN_ORGANIZATION: string;
|
|
35
|
+
ACCEPT_INVITATION: string;
|
|
36
|
+
VIEW_INVITATION: string;
|
|
37
|
+
THIS_INVITATION_EXPIRES_IN_HOURS: string;
|
|
38
|
+
IF_YOU_DIDNT_EXPECT_THIS_INVITATION: string;
|
|
31
39
|
NEW_SIGN_IN_DETECTED: string;
|
|
32
40
|
NEW_SIGN_IN_TO_YOUR_ACCOUNT: string;
|
|
33
41
|
DEVICE_DETAILS: string;
|
|
@@ -1,19 +1,26 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import EmailChangedEmail from "./email-changed";
|
|
2
|
+
import EmailVerificationEmail from "./email-verification";
|
|
3
|
+
import MagicLinkEmail from "./magic-link";
|
|
4
|
+
import NewDeviceEmail from "./new-device";
|
|
5
|
+
import OrganizationInvitationEmail from "./organization-invitation";
|
|
6
|
+
import OtpEmail from "./otp-email";
|
|
7
|
+
import PasswordChangedEmail from "./password-changed";
|
|
8
|
+
import ResetPasswordEmail from "./reset-password";
|
|
9
|
+
/**
|
|
10
|
+
* Aggregated localization strings for all email components.
|
|
11
|
+
*
|
|
12
|
+
* Combines localization strings from all email templates (EmailChangedEmail,
|
|
13
|
+
* EmailVerificationEmail, MagicLinkEmail, NewDeviceEmail,
|
|
14
|
+
* OrganizationInvitationEmail, OtpEmail, PasswordChangedEmail,
|
|
15
|
+
* ResetPasswordEmail) into a single object for convenient bulk customization.
|
|
16
|
+
*/
|
|
17
|
+
export const emailLocalization = {
|
|
18
|
+
...EmailChangedEmail.localization,
|
|
19
|
+
...EmailVerificationEmail.localization,
|
|
20
|
+
...MagicLinkEmail.localization,
|
|
21
|
+
...NewDeviceEmail.localization,
|
|
22
|
+
...OrganizationInvitationEmail.localization,
|
|
23
|
+
...OtpEmail.localization,
|
|
24
|
+
...PasswordChangedEmail.localization,
|
|
25
|
+
...ResetPasswordEmail.localization
|
|
17
26
|
};
|
|
18
|
-
//#endregion
|
|
19
|
-
export { s as emailLocalization };
|
|
@@ -1,57 +1,81 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Default color scheme for email templates in light and dark modes.
|
|
4
|
+
*
|
|
5
|
+
* Provides a consistent color palette that can be customized via the EmailColors type.
|
|
6
|
+
*/
|
|
7
|
+
export const defaultColors = {
|
|
8
|
+
light: {
|
|
9
|
+
background: "#F5F5F5",
|
|
10
|
+
border: "#E5E5E5",
|
|
11
|
+
card: "#FFFFFF",
|
|
12
|
+
cardForeground: "#0A0A0A",
|
|
13
|
+
foreground: "#262626",
|
|
14
|
+
muted: "#F5F5F5",
|
|
15
|
+
mutedForeground: "#737373",
|
|
16
|
+
primary: "#171717",
|
|
17
|
+
primaryForeground: "#FAFAFA"
|
|
18
|
+
},
|
|
19
|
+
dark: {
|
|
20
|
+
background: "#0A0A0A",
|
|
21
|
+
border: "#2E2E2E",
|
|
22
|
+
card: "#171717",
|
|
23
|
+
cardForeground: "#FAFAFA",
|
|
24
|
+
foreground: "#D4D4D4",
|
|
25
|
+
muted: "#212121",
|
|
26
|
+
mutedForeground: "#A1A1A1",
|
|
27
|
+
primary: "#E5E5E5",
|
|
28
|
+
primaryForeground: "#171717"
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Component that injects CSS styles for email templates with support for light and dark modes.
|
|
33
|
+
*
|
|
34
|
+
* Generates inline styles that adapt to the user's color scheme preference and applies
|
|
35
|
+
* custom colors if provided. Handles logo visibility switching between light and dark modes.
|
|
36
|
+
*
|
|
37
|
+
* @param props - Style configuration options
|
|
38
|
+
* @returns A style element containing CSS for email template theming
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```tsx
|
|
42
|
+
* <EmailStyles
|
|
43
|
+
* colors={{
|
|
44
|
+
* light: { primary: "#000000" },
|
|
45
|
+
* dark: { primary: "#FFFFFF" }
|
|
46
|
+
* }}
|
|
47
|
+
* darkMode={true}
|
|
48
|
+
* />
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export const EmailStyles = ({ colors, darkMode = true }) => {
|
|
52
|
+
return (_jsx("style", { type: "text/css", children: `
|
|
29
53
|
.bg-background {
|
|
30
|
-
background-color: ${
|
|
54
|
+
background-color: ${colors?.light?.background || defaultColors.light.background} !important;
|
|
31
55
|
}
|
|
32
56
|
.bg-card {
|
|
33
|
-
background-color: ${
|
|
57
|
+
background-color: ${colors?.light?.card || defaultColors.light.card} !important;
|
|
34
58
|
}
|
|
35
59
|
.bg-primary {
|
|
36
|
-
background-color: ${
|
|
60
|
+
background-color: ${colors?.light?.primary || defaultColors.light.primary} !important;
|
|
37
61
|
}
|
|
38
62
|
.bg-muted {
|
|
39
|
-
background-color: ${
|
|
63
|
+
background-color: ${colors?.light?.muted || defaultColors.light.muted} !important;
|
|
40
64
|
}
|
|
41
65
|
.border-border {
|
|
42
|
-
border-color: ${
|
|
66
|
+
border-color: ${colors?.light?.border || defaultColors.light.border} !important;
|
|
43
67
|
}
|
|
44
68
|
.text-card-foreground {
|
|
45
|
-
color: ${
|
|
69
|
+
color: ${colors?.light?.cardForeground || defaultColors.light.cardForeground} !important;
|
|
46
70
|
}
|
|
47
71
|
.text-muted-foreground {
|
|
48
|
-
color: ${
|
|
72
|
+
color: ${colors?.light?.mutedForeground || defaultColors.light.mutedForeground} !important;
|
|
49
73
|
}
|
|
50
74
|
.text-primary {
|
|
51
|
-
color: ${
|
|
75
|
+
color: ${colors?.light?.primary || defaultColors.light.primary} !important;
|
|
52
76
|
}
|
|
53
77
|
.text-primary-foreground {
|
|
54
|
-
color: ${
|
|
78
|
+
color: ${colors?.light?.primaryForeground || defaultColors.light.primaryForeground} !important;
|
|
55
79
|
}
|
|
56
80
|
.logo-dark {
|
|
57
81
|
display: none !important;
|
|
@@ -60,33 +84,34 @@ var t = {
|
|
|
60
84
|
display: block !important;
|
|
61
85
|
}
|
|
62
86
|
|
|
63
|
-
${
|
|
87
|
+
${darkMode
|
|
88
|
+
? `@media (prefers-color-scheme: dark) {
|
|
64
89
|
.bg-background {
|
|
65
|
-
background-color: ${
|
|
90
|
+
background-color: ${colors?.dark?.background || defaultColors.dark.background} !important;
|
|
66
91
|
}
|
|
67
92
|
.bg-card {
|
|
68
|
-
background-color: ${
|
|
93
|
+
background-color: ${colors?.dark?.card || defaultColors.dark.card} !important;
|
|
69
94
|
}
|
|
70
95
|
.bg-primary {
|
|
71
|
-
background-color: ${
|
|
96
|
+
background-color: ${colors?.dark?.primary || defaultColors.dark.primary} !important;
|
|
72
97
|
}
|
|
73
98
|
.bg-muted {
|
|
74
|
-
background-color: ${
|
|
99
|
+
background-color: ${colors?.dark?.muted || defaultColors.dark.muted} !important;
|
|
75
100
|
}
|
|
76
101
|
.border-border {
|
|
77
|
-
border-color: ${
|
|
102
|
+
border-color: ${colors?.dark?.border || defaultColors.dark.border} !important;
|
|
78
103
|
}
|
|
79
104
|
.text-card-foreground {
|
|
80
|
-
color: ${
|
|
105
|
+
color: ${colors?.dark?.cardForeground || defaultColors.dark.cardForeground} !important;
|
|
81
106
|
}
|
|
82
107
|
.text-muted-foreground {
|
|
83
|
-
color: ${
|
|
108
|
+
color: ${colors?.dark?.mutedForeground || defaultColors.dark.mutedForeground} !important;
|
|
84
109
|
}
|
|
85
110
|
.text-primary {
|
|
86
|
-
color: ${
|
|
111
|
+
color: ${colors?.dark?.primary || defaultColors.dark.primary} !important;
|
|
87
112
|
}
|
|
88
113
|
.text-primary-foreground {
|
|
89
|
-
color: ${
|
|
114
|
+
color: ${colors?.dark?.primaryForeground || defaultColors.dark.primaryForeground} !important;
|
|
90
115
|
}
|
|
91
116
|
.logo-dark {
|
|
92
117
|
display: block !important;
|
|
@@ -97,8 +122,8 @@ var t = {
|
|
|
97
122
|
* {
|
|
98
123
|
box-shadow: none !important;
|
|
99
124
|
}
|
|
100
|
-
}`
|
|
101
|
-
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
export
|
|
125
|
+
}`
|
|
126
|
+
: ""}
|
|
127
|
+
` }));
|
|
128
|
+
};
|
|
129
|
+
export default EmailStyles;
|
|
@@ -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 emailVerificationEmailLocalization: {
|
|
4
4
|
VERIFY_YOUR_EMAIL_ADDRESS: string;
|
|
5
5
|
LOGO: string;
|