@better-auth-ui/react 1.6.1 → 1.6.2

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.
Files changed (201) hide show
  1. package/dist/components/auth/auth-provider.d.ts +4 -3
  2. package/dist/components/auth/auth-provider.js +24 -40
  3. package/dist/components/email/email-changed.d.ts +2 -2
  4. package/dist/components/email/email-changed.js +154 -68
  5. package/dist/components/email/email-localization.js +18 -23
  6. package/dist/components/email/email-styles.js +52 -77
  7. package/dist/components/email/email-verification.d.ts +2 -2
  8. package/dist/components/email/email-verification.js +138 -73
  9. package/dist/components/email/index.d.ts +9 -9
  10. package/dist/components/email/index.js +9 -9
  11. package/dist/components/email/magic-link.d.ts +2 -2
  12. package/dist/components/email/magic-link.js +139 -70
  13. package/dist/components/email/new-device.d.ts +2 -2
  14. package/dist/components/email/new-device.js +221 -88
  15. package/dist/components/email/otp-email.d.ts +2 -2
  16. package/dist/components/email/otp-email.js +127 -63
  17. package/dist/components/email/password-changed.d.ts +2 -2
  18. package/dist/components/email/password-changed.js +157 -74
  19. package/dist/components/email/reset-password.d.ts +2 -2
  20. package/dist/components/email/reset-password.js +138 -66
  21. package/dist/components/icons/apple.d.ts +1 -1
  22. package/dist/components/icons/apple.js +16 -9
  23. package/dist/components/icons/atlassian.d.ts +1 -1
  24. package/dist/components/icons/atlassian.js +38 -13
  25. package/dist/components/icons/cognito.d.ts +1 -1
  26. package/dist/components/icons/cognito.js +19 -9
  27. package/dist/components/icons/discord.d.ts +1 -1
  28. package/dist/components/icons/discord.js +16 -9
  29. package/dist/components/icons/dropbox.d.ts +1 -1
  30. package/dist/components/icons/dropbox.js +16 -9
  31. package/dist/components/icons/facebook.d.ts +1 -1
  32. package/dist/components/icons/facebook.js +19 -11
  33. package/dist/components/icons/figma.d.ts +1 -1
  34. package/dist/components/icons/figma.js +34 -12
  35. package/dist/components/icons/github.d.ts +1 -1
  36. package/dist/components/icons/github.js +16 -11
  37. package/dist/components/icons/gitlab.d.ts +1 -1
  38. package/dist/components/icons/gitlab.js +30 -9
  39. package/dist/components/icons/google.d.ts +1 -1
  40. package/dist/components/icons/google.js +39 -9
  41. package/dist/components/icons/huggingface.d.ts +1 -1
  42. package/dist/components/icons/huggingface.js +38 -9
  43. package/dist/components/icons/index.d.ts +35 -35
  44. package/dist/components/icons/index.js +35 -35
  45. package/dist/components/icons/kakao.d.ts +1 -1
  46. package/dist/components/icons/kakao.js +16 -11
  47. package/dist/components/icons/kick.d.ts +1 -1
  48. package/dist/components/icons/kick.js +20 -11
  49. package/dist/components/icons/line.d.ts +1 -1
  50. package/dist/components/icons/line.js +16 -9
  51. package/dist/components/icons/linear.d.ts +1 -1
  52. package/dist/components/icons/linear.js +16 -9
  53. package/dist/components/icons/linkedin.d.ts +1 -1
  54. package/dist/components/icons/linkedin.js +33 -9
  55. package/dist/components/icons/microsoft.d.ts +1 -1
  56. package/dist/components/icons/microsoft.js +30 -9
  57. package/dist/components/icons/naver.d.ts +1 -1
  58. package/dist/components/icons/naver.js +16 -9
  59. package/dist/components/icons/notion.d.ts +1 -1
  60. package/dist/components/icons/notion.js +16 -9
  61. package/dist/components/icons/paybin.d.ts +1 -1
  62. package/dist/components/icons/paybin.js +32 -8
  63. package/dist/components/icons/paypal.d.ts +1 -1
  64. package/dist/components/icons/paypal.js +30 -9
  65. package/dist/components/icons/polar.d.ts +1 -1
  66. package/dist/components/icons/polar.js +24 -9
  67. package/dist/components/icons/railway.d.ts +1 -1
  68. package/dist/components/icons/railway.js +16 -9
  69. package/dist/components/icons/reddit.d.ts +1 -1
  70. package/dist/components/icons/reddit.js +21 -9
  71. package/dist/components/icons/roblox.d.ts +1 -1
  72. package/dist/components/icons/roblox.js +17 -12
  73. package/dist/components/icons/salesforce.d.ts +1 -1
  74. package/dist/components/icons/salesforce.js +16 -9
  75. package/dist/components/icons/slack.d.ts +1 -1
  76. package/dist/components/icons/slack.js +30 -9
  77. package/dist/components/icons/spotify.d.ts +1 -1
  78. package/dist/components/icons/spotify.js +16 -9
  79. package/dist/components/icons/tiktok.d.ts +1 -1
  80. package/dist/components/icons/tiktok.js +23 -10
  81. package/dist/components/icons/twitch.d.ts +1 -1
  82. package/dist/components/icons/twitch.js +43 -12
  83. package/dist/components/icons/vercel.d.ts +1 -1
  84. package/dist/components/icons/vercel.js +16 -9
  85. package/dist/components/icons/vk.d.ts +1 -1
  86. package/dist/components/icons/vk.js +16 -9
  87. package/dist/components/icons/wechat.d.ts +1 -1
  88. package/dist/components/icons/wechat.js +16 -9
  89. package/dist/components/icons/x.d.ts +1 -1
  90. package/dist/components/icons/x.js +16 -9
  91. package/dist/components/icons/zoom.d.ts +1 -1
  92. package/dist/components/icons/zoom.js +69 -11
  93. package/dist/components/settings/account/theme-preview.js +286 -7
  94. package/dist/core.d.ts +1 -1
  95. package/dist/hooks/auth/use-auth-mutation.d.ts +2 -2
  96. package/dist/hooks/auth/use-auth-mutation.js +12 -9
  97. package/dist/hooks/auth/use-auth-query.d.ts +3 -3
  98. package/dist/hooks/auth/use-auth-query.js +12 -9
  99. package/dist/hooks/auth/use-authenticate.d.ts +2 -2
  100. package/dist/hooks/auth/use-authenticate.js +22 -27
  101. package/dist/hooks/auth/use-is-username-available.d.ts +19 -0
  102. package/dist/hooks/auth/use-is-username-available.js +12 -0
  103. package/dist/hooks/auth/use-request-password-reset.d.ts +5 -6
  104. package/dist/hooks/auth/use-request-password-reset.js +11 -13
  105. package/dist/hooks/auth/use-reset-password.d.ts +8 -9
  106. package/dist/hooks/auth/use-reset-password.js +11 -12
  107. package/dist/hooks/auth/use-send-verification-email.d.ts +5 -6
  108. package/dist/hooks/auth/use-send-verification-email.js +11 -12
  109. package/dist/hooks/auth/use-session.d.ts +2 -2
  110. package/dist/hooks/auth/use-session.js +14 -17
  111. package/dist/hooks/auth/use-sign-in-email.d.ts +6 -7
  112. package/dist/hooks/auth/use-sign-in-email.js +17 -24
  113. package/dist/hooks/auth/use-sign-in-magic-link.d.ts +5 -6
  114. package/dist/hooks/auth/use-sign-in-magic-link.js +11 -12
  115. package/dist/hooks/auth/use-sign-in-passkey.d.ts +14 -14
  116. package/dist/hooks/auth/use-sign-in-passkey.js +17 -24
  117. package/dist/hooks/auth/use-sign-in-social.d.ts +8 -9
  118. package/dist/hooks/auth/use-sign-in-social.js +11 -12
  119. package/dist/hooks/auth/use-sign-in-username.d.ts +53 -0
  120. package/dist/hooks/auth/use-sign-in-username.js +18 -0
  121. package/dist/hooks/auth/use-sign-out.d.ts +4 -5
  122. package/dist/hooks/auth/use-sign-out.js +17 -23
  123. package/dist/hooks/auth/use-sign-up-email.d.ts +166 -167
  124. package/dist/hooks/auth/use-sign-up-email.js +17 -24
  125. package/dist/hooks/auth/use-user.d.ts +58 -58
  126. package/dist/hooks/auth/use-user.js +10 -13
  127. package/dist/hooks/settings/use-account-info.d.ts +5 -5
  128. package/dist/hooks/settings/use-account-info.js +20 -24
  129. package/dist/hooks/settings/use-add-passkey.d.ts +10 -10
  130. package/dist/hooks/settings/use-add-passkey.js +17 -23
  131. package/dist/hooks/settings/use-change-email.d.ts +5 -5
  132. package/dist/hooks/settings/use-change-email.js +17 -22
  133. package/dist/hooks/settings/use-change-password.d.ts +6 -7
  134. package/dist/hooks/settings/use-change-password.js +11 -10
  135. package/dist/hooks/settings/use-delete-passkey.d.ts +5 -5
  136. package/dist/hooks/settings/use-delete-passkey.js +17 -23
  137. package/dist/hooks/settings/use-delete-user.d.ts +8 -9
  138. package/dist/hooks/settings/use-delete-user.js +11 -10
  139. package/dist/hooks/settings/use-link-social.d.ts +5 -5
  140. package/dist/hooks/settings/use-link-social.js +11 -9
  141. package/dist/hooks/settings/use-list-accounts.d.ts +4 -4
  142. package/dist/hooks/settings/use-list-accounts.js +20 -22
  143. package/dist/hooks/settings/use-list-device-sessions.d.ts +2 -2
  144. package/dist/hooks/settings/use-list-device-sessions.js +20 -21
  145. package/dist/hooks/settings/use-list-sessions.d.ts +4 -4
  146. package/dist/hooks/settings/use-list-sessions.js +20 -21
  147. package/dist/hooks/settings/use-list-user-passkeys.d.ts +3 -3
  148. package/dist/hooks/settings/use-list-user-passkeys.js +20 -21
  149. package/dist/hooks/settings/use-revoke-multi-session.d.ts +5 -5
  150. package/dist/hooks/settings/use-revoke-multi-session.js +17 -19
  151. package/dist/hooks/settings/use-revoke-session.d.ts +5 -5
  152. package/dist/hooks/settings/use-revoke-session.js +17 -20
  153. package/dist/hooks/settings/use-set-active-session.d.ts +5 -5
  154. package/dist/hooks/settings/use-set-active-session.js +20 -27
  155. package/dist/hooks/settings/use-unlink-account.d.ts +5 -5
  156. package/dist/hooks/settings/use-unlink-account.js +17 -20
  157. package/dist/hooks/settings/use-update-user.d.ts +2 -2
  158. package/dist/hooks/settings/use-update-user.js +24 -28
  159. package/dist/index.d.ts +40 -36
  160. package/dist/index.js +84 -36
  161. package/dist/lib/auth-client.d.ts +1254 -1254
  162. package/dist/lib/auth-client.js +11 -11
  163. package/dist/lib/auth-config.d.ts +3 -3
  164. package/dist/lib/auth-context.d.ts +2 -2
  165. package/dist/lib/auth-context.js +5 -2
  166. package/dist/lib/provider-icons.d.ts +2 -2
  167. package/dist/lib/provider-icons.js +75 -47
  168. package/dist/lib/utils.d.ts +1 -1
  169. package/dist/lib/utils.js +7 -4
  170. package/package.json +11 -11
  171. package/src/components/auth/auth-provider.tsx +4 -6
  172. package/src/hooks/auth/use-authenticate.ts +3 -1
  173. package/src/hooks/auth/use-is-username-available.ts +22 -0
  174. package/src/hooks/auth/use-request-password-reset.ts +4 -6
  175. package/src/hooks/auth/use-reset-password.ts +4 -6
  176. package/src/hooks/auth/use-send-verification-email.ts +4 -6
  177. package/src/hooks/auth/use-session.ts +2 -1
  178. package/src/hooks/auth/use-sign-in-email.ts +6 -8
  179. package/src/hooks/auth/use-sign-in-magic-link.ts +4 -6
  180. package/src/hooks/auth/use-sign-in-social.ts +4 -6
  181. package/src/hooks/auth/use-sign-in-username.ts +34 -0
  182. package/src/hooks/auth/use-sign-out.ts +6 -7
  183. package/src/hooks/auth/use-sign-up-email.ts +6 -8
  184. package/src/hooks/auth/use-user.ts +1 -2
  185. package/src/hooks/settings/use-account-info.ts +2 -1
  186. package/src/hooks/settings/use-change-email.ts +6 -6
  187. package/src/hooks/settings/use-change-password.ts +4 -6
  188. package/src/hooks/settings/use-delete-user.ts +4 -6
  189. package/src/hooks/settings/use-link-social.ts +4 -4
  190. package/src/hooks/settings/use-list-accounts.ts +3 -1
  191. package/src/hooks/settings/use-list-device-sessions.ts +3 -1
  192. package/src/hooks/settings/use-list-sessions.ts +3 -1
  193. package/src/hooks/settings/use-list-user-passkeys.ts +3 -1
  194. package/src/hooks/settings/use-revoke-multi-session.ts +6 -6
  195. package/src/hooks/settings/use-revoke-session.ts +4 -5
  196. package/src/hooks/settings/use-set-active-session.ts +9 -8
  197. package/src/hooks/settings/use-unlink-account.ts +4 -5
  198. package/src/hooks/settings/use-update-user.ts +8 -9
  199. package/src/index.ts +4 -0
  200. package/src/lib/auth-config.ts +1 -1
  201. package/dist/lib/auth-config.js +0 -1
@@ -1,6 +1,7 @@
1
- import { type AnyAuthClient, type AnyAuthConfig, type AuthConfig } from "@better-auth-ui/react";
2
- import { QueryClient } from "@tanstack/react-query";
3
- import { type PropsWithChildren } from "react";
1
+ import { QueryClient } from '@tanstack/react-query';
2
+ import { PropsWithChildren } from 'react';
3
+ import { AnyAuthClient } from '../../lib/auth-client';
4
+ import { AnyAuthConfig, AuthConfig } from '../../lib/auth-config';
4
5
  export type AuthProviderProps = PropsWithChildren<AnyAuthConfig> & {
5
6
  authClient: AnyAuthClient;
6
7
  navigate: (options: {
@@ -1,44 +1,28 @@
1
1
  "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { deepmerge, defaultAuthConfig } from "@better-auth-ui/core";
4
- import { AuthContext } from "@better-auth-ui/react";
5
- import { QueryClient, QueryClientContext, QueryClientProvider } from "@tanstack/react-query";
6
- import { useContext } from "react";
7
- const fallbackQueryClient = new QueryClient();
8
- const baseAuthConfig = {
9
- ...defaultAuthConfig,
10
- Link: (props) => _jsx("a", { ...props })
2
+ import { AuthContext as e } from "../../lib/auth-context.js";
3
+ import { deepmerge as t, defaultAuthConfig as n } from "@better-auth-ui/core";
4
+ import { QueryClient as r, QueryClientContext as i, QueryClientProvider as a } from "@tanstack/react-query";
5
+ import { useContext as o } from "react";
6
+ import { jsx as s } from "react/jsx-runtime";
7
+ //#region src/components/auth/auth-provider.tsx
8
+ var c = new r(), l = {
9
+ ...n,
10
+ Link: (e) => /* @__PURE__ */ s("a", { ...e })
11
11
  };
12
- /**
13
- * Provides merged authentication configuration and a resolved React Query client to descendant components.
14
- *
15
- * The component merges the provided auth config with the library defaults, updates `redirectTo` from the
16
- * current URL when the app is hydrated, wires a QueryClient (prop, context, or fallback) and installs an
17
- * error handler that surfaces query errors via the configured toast. It then supplies the merged config
18
- * via AuthContext and wraps children with QueryClientProvider.
19
- *
20
- * @returns The children wrapped with AuthContext.Provider and QueryClientProvider configured for auth.
21
- */
22
- export function AuthProvider({ children, queryClient, ...config }) {
23
- const contextQueryClient = useContext(QueryClientContext);
24
- const resolvedQueryClient = queryClient || contextQueryClient || fallbackQueryClient;
25
- const mergedConfig = deepmerge(baseAuthConfig, config);
26
- mergedConfig.redirectTo =
27
- (typeof window !== "undefined" &&
28
- new URLSearchParams(window.location.search).get("redirectTo")?.trim()) ||
29
- mergedConfig.redirectTo;
30
- return (_jsx(AuthContext.Provider, { value: mergedConfig, children: _jsx(QueryClientProvider, { client: resolvedQueryClient, children: children }) }));
12
+ function u({ children: n, queryClient: r, ...u }) {
13
+ let d = o(i), f = r || d || c, p = t(l, u);
14
+ return p.redirectTo = typeof window < "u" && new URLSearchParams(window.location.search).get("redirectTo")?.trim() || p.redirectTo, /* @__PURE__ */ s(e.Provider, {
15
+ value: p,
16
+ children: /* @__PURE__ */ s(a, {
17
+ client: f,
18
+ children: n
19
+ })
20
+ });
31
21
  }
32
- /**
33
- * Accesses the current authentication configuration from AuthContext.
34
- *
35
- * @returns The merged authentication configuration provided by AuthProvider.
36
- * @throws If no AuthProvider is present in the component tree.
37
- */
38
- export function useAuth() {
39
- const context = useContext(AuthContext);
40
- if (!context) {
41
- throw new Error("[Better Auth UI] AuthProvider is required");
42
- }
43
- return context;
22
+ function d() {
23
+ let t = o(e);
24
+ if (!t) throw Error("[Better Auth UI] AuthProvider is required");
25
+ return t;
44
26
  }
27
+ //#endregion
28
+ export { u as AuthProvider, d as useAuth };
@@ -1,5 +1,5 @@
1
- import type { ReactNode } from "react";
2
- import { type EmailClassNames, type EmailColors } from "./email-styles";
1
+ import { ReactNode } from 'react';
2
+ import { EmailClassNames, EmailColors } from './email-styles';
3
3
  declare const emailChangedEmailLocalization: {
4
4
  YOUR_EMAIL_ADDRESS_HAS_BEEN_CHANGED: string;
5
5
  LOGO: string;
@@ -1,70 +1,156 @@
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}"
1
+ import { cn as e } from "../../lib/utils.js";
2
+ import t from "./email-styles.js";
3
+ import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
4
+ import { Body as a, Button as o, Container as s, Head as c, Heading as l, Hr as u, Html as d, Img as f, Link as p, Preview as m, Section as h, Tailwind as g, Text as _, pixelBasedPreset as v } from "@react-email/components";
5
+ //#region src/components/email/email-changed.tsx
6
+ var y = {
7
+ YOUR_EMAIL_ADDRESS_HAS_BEEN_CHANGED: "Your email address has been changed",
8
+ LOGO: "Logo",
9
+ EMAIL_ADDRESS_CHANGED: "Email address changed",
10
+ EMAIL_ADDRESS_FOR_YOUR_ACCOUNT_CHANGED: "The email address for your {appName} account has been changed.",
11
+ PREVIOUS_EMAIL: "Previous email:",
12
+ NEW_EMAIL: "New email:",
13
+ IF_YOU_MADE_THIS_CHANGE: "If you made this change, you can safely ignore this email.",
14
+ I_DIDNT_MAKE_THIS_CHANGE: "I didn't make this change",
15
+ EMAIL_SENT_BY: "Email sent by {appName}.",
16
+ IF_YOU_DIDNT_AUTHORIZE_THIS_CHANGE: "If you didn't authorize this change, please contact support immediately {supportEmail} to secure your account.",
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
+ ] });
17
145
  };
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
- })() }))] }) }) }) })] }));
146
+ b.localization = y, b.PreviewProps = {
147
+ oldEmail: "old@example.com",
148
+ newEmail: "new@example.com",
149
+ supportEmail: "support@example.com",
150
+ revertURL: "https://better-auth-ui.com/auth/revert-email?token=example-token",
151
+ appName: "Better Auth",
152
+ poweredBy: !0,
153
+ darkMode: !0
59
154
  };
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;
155
+ //#endregion
156
+ export { b as default };
@@ -1,24 +1,19 @@
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 OtpEmail from "./otp-email";
6
- import PasswordChangedEmail from "./password-changed";
7
- import ResetPasswordEmail from "./reset-password";
8
- /**
9
- * Aggregated localization strings for all email components.
10
- *
11
- * Combines localization strings from all email templates (EmailChangedEmail,
12
- * EmailVerificationEmail, MagicLinkEmail, NewDeviceEmail, OtpEmail,
13
- * PasswordChangedEmail, ResetPasswordEmail) into a single object for convenient
14
- * bulk customization.
15
- */
16
- export const emailLocalization = {
17
- ...EmailChangedEmail.localization,
18
- ...EmailVerificationEmail.localization,
19
- ...MagicLinkEmail.localization,
20
- ...NewDeviceEmail.localization,
21
- ...OtpEmail.localization,
22
- ...PasswordChangedEmail.localization,
23
- ...ResetPasswordEmail.localization
1
+ import e from "./email-changed.js";
2
+ import t from "./email-verification.js";
3
+ import n from "./magic-link.js";
4
+ import r from "./new-device.js";
5
+ import i from "./otp-email.js";
6
+ import a from "./password-changed.js";
7
+ import o from "./reset-password.js";
8
+ //#region src/components/email/email-localization.tsx
9
+ var s = {
10
+ ...e.localization,
11
+ ...t.localization,
12
+ ...n.localization,
13
+ ...r.localization,
14
+ ...i.localization,
15
+ ...a.localization,
16
+ ...o.localization
24
17
  };
18
+ //#endregion
19
+ export { s as emailLocalization };
@@ -1,81 +1,57 @@
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: `
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ //#region src/components/email/email-styles.tsx
3
+ var t = {
4
+ light: {
5
+ background: "#F5F5F5",
6
+ border: "#E5E5E5",
7
+ card: "#FFFFFF",
8
+ cardForeground: "#0A0A0A",
9
+ foreground: "#262626",
10
+ muted: "#F5F5F5",
11
+ mutedForeground: "#737373",
12
+ primary: "#171717",
13
+ primaryForeground: "#FAFAFA"
14
+ },
15
+ dark: {
16
+ background: "#0A0A0A",
17
+ border: "#2E2E2E",
18
+ card: "#171717",
19
+ cardForeground: "#FAFAFA",
20
+ foreground: "#D4D4D4",
21
+ muted: "#212121",
22
+ mutedForeground: "#A1A1A1",
23
+ primary: "#E5E5E5",
24
+ primaryForeground: "#171717"
25
+ }
26
+ }, n = ({ colors: n, darkMode: r = !0 }) => /* @__PURE__ */ e("style", {
27
+ type: "text/css",
28
+ children: `
53
29
  .bg-background {
54
- background-color: ${colors?.light?.background || defaultColors.light.background} !important;
30
+ background-color: ${n?.light?.background || t.light.background} !important;
55
31
  }
56
32
  .bg-card {
57
- background-color: ${colors?.light?.card || defaultColors.light.card} !important;
33
+ background-color: ${n?.light?.card || t.light.card} !important;
58
34
  }
59
35
  .bg-primary {
60
- background-color: ${colors?.light?.primary || defaultColors.light.primary} !important;
36
+ background-color: ${n?.light?.primary || t.light.primary} !important;
61
37
  }
62
38
  .bg-muted {
63
- background-color: ${colors?.light?.muted || defaultColors.light.muted} !important;
39
+ background-color: ${n?.light?.muted || t.light.muted} !important;
64
40
  }
65
41
  .border-border {
66
- border-color: ${colors?.light?.border || defaultColors.light.border} !important;
42
+ border-color: ${n?.light?.border || t.light.border} !important;
67
43
  }
68
44
  .text-card-foreground {
69
- color: ${colors?.light?.cardForeground || defaultColors.light.cardForeground} !important;
45
+ color: ${n?.light?.cardForeground || t.light.cardForeground} !important;
70
46
  }
71
47
  .text-muted-foreground {
72
- color: ${colors?.light?.mutedForeground || defaultColors.light.mutedForeground} !important;
48
+ color: ${n?.light?.mutedForeground || t.light.mutedForeground} !important;
73
49
  }
74
50
  .text-primary {
75
- color: ${colors?.light?.primary || defaultColors.light.primary} !important;
51
+ color: ${n?.light?.primary || t.light.primary} !important;
76
52
  }
77
53
  .text-primary-foreground {
78
- color: ${colors?.light?.primaryForeground || defaultColors.light.primaryForeground} !important;
54
+ color: ${n?.light?.primaryForeground || t.light.primaryForeground} !important;
79
55
  }
80
56
  .logo-dark {
81
57
  display: none !important;
@@ -84,34 +60,33 @@ export const EmailStyles = ({ colors, darkMode = true }) => {
84
60
  display: block !important;
85
61
  }
86
62
 
87
- ${darkMode
88
- ? `@media (prefers-color-scheme: dark) {
63
+ ${r ? `@media (prefers-color-scheme: dark) {
89
64
  .bg-background {
90
- background-color: ${colors?.dark?.background || defaultColors.dark.background} !important;
65
+ background-color: ${n?.dark?.background || t.dark.background} !important;
91
66
  }
92
67
  .bg-card {
93
- background-color: ${colors?.dark?.card || defaultColors.dark.card} !important;
68
+ background-color: ${n?.dark?.card || t.dark.card} !important;
94
69
  }
95
70
  .bg-primary {
96
- background-color: ${colors?.dark?.primary || defaultColors.dark.primary} !important;
71
+ background-color: ${n?.dark?.primary || t.dark.primary} !important;
97
72
  }
98
73
  .bg-muted {
99
- background-color: ${colors?.dark?.muted || defaultColors.dark.muted} !important;
74
+ background-color: ${n?.dark?.muted || t.dark.muted} !important;
100
75
  }
101
76
  .border-border {
102
- border-color: ${colors?.dark?.border || defaultColors.dark.border} !important;
77
+ border-color: ${n?.dark?.border || t.dark.border} !important;
103
78
  }
104
79
  .text-card-foreground {
105
- color: ${colors?.dark?.cardForeground || defaultColors.dark.cardForeground} !important;
80
+ color: ${n?.dark?.cardForeground || t.dark.cardForeground} !important;
106
81
  }
107
82
  .text-muted-foreground {
108
- color: ${colors?.dark?.mutedForeground || defaultColors.dark.mutedForeground} !important;
83
+ color: ${n?.dark?.mutedForeground || t.dark.mutedForeground} !important;
109
84
  }
110
85
  .text-primary {
111
- color: ${colors?.dark?.primary || defaultColors.dark.primary} !important;
86
+ color: ${n?.dark?.primary || t.dark.primary} !important;
112
87
  }
113
88
  .text-primary-foreground {
114
- color: ${colors?.dark?.primaryForeground || defaultColors.dark.primaryForeground} !important;
89
+ color: ${n?.dark?.primaryForeground || t.dark.primaryForeground} !important;
115
90
  }
116
91
  .logo-dark {
117
92
  display: block !important;
@@ -122,8 +97,8 @@ export const EmailStyles = ({ colors, darkMode = true }) => {
122
97
  * {
123
98
  box-shadow: none !important;
124
99
  }
125
- }`
126
- : ""}
127
- ` }));
128
- };
129
- export default EmailStyles;
100
+ }` : ""}
101
+ `
102
+ });
103
+ //#endregion
104
+ export { n as default, t as defaultColors };
@@ -1,5 +1,5 @@
1
- import type { ReactNode } from "react";
2
- import { type EmailClassNames, type EmailColors } from "./email-styles";
1
+ import { ReactNode } from 'react';
2
+ import { EmailClassNames, EmailColors } from './email-styles';
3
3
  declare const emailVerificationEmailLocalization: {
4
4
  VERIFY_YOUR_EMAIL_ADDRESS: string;
5
5
  LOGO: string;