@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,90 +1,223 @@
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}"
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/new-device.tsx
6
+ var y = {
7
+ NEW_SIGN_IN_DETECTED: "New sign-in detected",
8
+ LOGO: "Logo",
9
+ NEW_SIGN_IN_TO_YOUR_ACCOUNT: "We detected a new sign-in to your {appName} account {userEmail} from a device we don't recognize.",
10
+ DEVICE_DETAILS: "Device details",
11
+ BROWSER: "Browser",
12
+ OPERATING_SYSTEM: "Operating System",
13
+ LOCATION: "Location",
14
+ IP_ADDRESS: "IP Address",
15
+ TIME: "Time",
16
+ 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.",
17
+ SECURE_MY_ACCOUNT: "Secure my account",
18
+ EMAIL_SENT_BY: "Email sent by {appName}.",
19
+ IF_YOU_DIDNT_SIGN_IN: "If you didn't sign in, please contact support immediately {supportEmail} to secure your account.",
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
+ ] });
20
207
  };
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
- })() }))] }) }) }) })] }));
208
+ b.localization = y, b.PreviewProps = {
209
+ userEmail: "m@example.com",
210
+ deviceInfo: {
211
+ browser: "Chrome on macOS",
212
+ os: "macOS 26.2",
213
+ location: "San Francisco, CA, United States",
214
+ ipAddress: "127.0.0.1",
215
+ timestamp: "February 10, 2025 at 4:20 PM UTC"
216
+ },
217
+ secureAccountLink: "https://better-auth-ui.com/auth/secure-account",
218
+ appName: "Better Auth",
219
+ supportEmail: "support@example.com",
220
+ darkMode: !0
74
221
  };
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;
222
+ //#endregion
223
+ export { b as default };
@@ -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 otpEmailLocalization: {
4
4
  YOUR_VERIFICATION_CODE_IS_CODE: string;
5
5
  LOGO: string;
@@ -1,65 +1,129 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Body, 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 otpEmailLocalization = {
6
- YOUR_VERIFICATION_CODE_IS_CODE: "Your verification code is {verificationCode}",
7
- LOGO: "Logo",
8
- VERIFY_YOUR_EMAIL: "Verify your email",
9
- WE_NEED_TO_VERIFY_YOUR_EMAIL_ADDRESS: "We need to verify your email address {email} before you can access your {appName} account. Enter the code below in your open browser window.",
10
- THIS_CODE_EXPIRES_IN_MINUTES: "This code expires in {expirationMinutes} minutes.",
11
- EMAIL_SENT_BY: "Email sent by {appName}.",
12
- IF_YOU_DIDNT_REQUEST_THIS_EMAIL: "If you didn't request this email, you can safely ignore it. Someone else might have typed your email address by mistake.",
13
- 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, Container as o, Head as s, Heading as c, Hr as l, Html as u, Img as d, Link as f, Preview as p, Section as m, Tailwind as h, Text as g, pixelBasedPreset as _ } from "@react-email/components";
5
+ //#region src/components/email/otp-email.tsx
6
+ var v = {
7
+ YOUR_VERIFICATION_CODE_IS_CODE: "Your verification code is {verificationCode}",
8
+ LOGO: "Logo",
9
+ VERIFY_YOUR_EMAIL: "Verify your email",
10
+ WE_NEED_TO_VERIFY_YOUR_EMAIL_ADDRESS: "We need to verify your email address {email} before you can access your {appName} account. Enter the code below in your open browser window.",
11
+ THIS_CODE_EXPIRES_IN_MINUTES: "This code expires in {expirationMinutes} minutes.",
12
+ EMAIL_SENT_BY: "Email sent by {appName}.",
13
+ IF_YOU_DIDNT_REQUEST_THIS_EMAIL: "If you didn't request this email, you can safely ignore it. Someone else might have typed your email address by mistake.",
14
+ POWERED_BY_BETTER_AUTH: "Powered by {betterAuth}"
15
+ }, y = ({ verificationCode: v, email: b, appName: x, expirationMinutes: S = 10, logoURL: C, colors: w, classNames: T, darkMode: E = !0, poweredBy: D, head: O, ...k }) => {
16
+ let A = {
17
+ ...y.localization,
18
+ ...k.localization
19
+ }, j = A.YOUR_VERIFICATION_CODE_IS_CODE.replace("{verificationCode}", v);
20
+ return /* @__PURE__ */ i(u, { children: [
21
+ /* @__PURE__ */ i(s, { children: [
22
+ /* @__PURE__ */ r("meta", {
23
+ content: "light dark",
24
+ name: "color-scheme"
25
+ }),
26
+ /* @__PURE__ */ r("meta", {
27
+ content: "light dark",
28
+ name: "supported-color-schemes"
29
+ }),
30
+ /* @__PURE__ */ r(t, {
31
+ colors: w,
32
+ darkMode: E
33
+ }),
34
+ O
35
+ ] }),
36
+ /* @__PURE__ */ r(p, { children: j }),
37
+ /* @__PURE__ */ r(h, {
38
+ config: { presets: [_] },
39
+ children: /* @__PURE__ */ r(a, {
40
+ className: e("bg-background font-sans", T?.body),
41
+ children: /* @__PURE__ */ r(o, {
42
+ className: e("mx-auto my-auto max-w-xl px-2 py-10", T?.container),
43
+ children: /* @__PURE__ */ i(m, {
44
+ className: e("bg-card text-card-foreground rounded-none border border-border p-8", T?.card),
45
+ children: [
46
+ C && (typeof C == "string" ? /* @__PURE__ */ r(d, {
47
+ src: C,
48
+ width: 48,
49
+ height: 48,
50
+ alt: x || A.LOGO,
51
+ className: e("mx-auto mb-8", T?.logo)
52
+ }) : /* @__PURE__ */ i(n, { children: [/* @__PURE__ */ r(d, {
53
+ src: C.light,
54
+ width: 48,
55
+ height: 48,
56
+ alt: x || A.LOGO,
57
+ className: e("mx-auto mb-8 logo-light", T?.logo)
58
+ }), /* @__PURE__ */ r(d, {
59
+ src: C.dark,
60
+ width: 48,
61
+ height: 48,
62
+ alt: x || A.LOGO,
63
+ className: e("hidden mx-auto mb-8 logo-dark", T?.logo)
64
+ })] })),
65
+ /* @__PURE__ */ r(c, {
66
+ className: e("mb-5 text-2xl font-semibold", T?.title),
67
+ children: A.VERIFY_YOUR_EMAIL
68
+ }),
69
+ /* @__PURE__ */ r(g, {
70
+ className: e("text-sm font-normal", T?.content),
71
+ children: (() => {
72
+ let e = A.WE_NEED_TO_VERIFY_YOUR_EMAIL_ADDRESS.replace("{appName}", x || "").replace(/\s{2,}/g, " ").replace(" .", "."), [t, a] = e.split("{email}");
73
+ return b ? /* @__PURE__ */ i(n, { children: [
74
+ t,
75
+ /* @__PURE__ */ r(f, {
76
+ href: `mailto:${b}`,
77
+ className: "text-primary font-medium",
78
+ children: b
79
+ }),
80
+ a
81
+ ] }) : e.replace("{email}", "").replace(/\s{2,}/g, " ").replace(" .", ".");
82
+ })()
83
+ }),
84
+ /* @__PURE__ */ r(m, {
85
+ className: e("my-6 border border-border bg-muted p-6", T?.codeBlock),
86
+ children: /* @__PURE__ */ r(g, {
87
+ className: e("m-0 text-center text-4xl font-semibold tracking-widest", T?.title),
88
+ children: v
89
+ })
90
+ }),
91
+ /* @__PURE__ */ r(l, { className: e("my-6 w-full border border-solid border-border", T?.separator) }),
92
+ /* @__PURE__ */ i(g, {
93
+ className: e("mb-3 text-xs text-muted-foreground", T?.description),
94
+ children: [A.THIS_CODE_EXPIRES_IN_MINUTES.replace("{expirationMinutes}", S.toString()), x && /* @__PURE__ */ i(n, { children: [" ", A.EMAIL_SENT_BY.replace("{appName}", x)] })]
95
+ }),
96
+ /* @__PURE__ */ r(g, {
97
+ className: e("mt-3 text-xs text-muted-foreground", T?.description),
98
+ children: A.IF_YOU_DIDNT_REQUEST_THIS_EMAIL
99
+ }),
100
+ D && /* @__PURE__ */ r(g, {
101
+ className: e("mt-4 mb-0 text-center text-[11px] text-muted-foreground", T?.poweredBy),
102
+ children: (() => {
103
+ let [t, a] = A.POWERED_BY_BETTER_AUTH.split("{betterAuth}");
104
+ return /* @__PURE__ */ i(n, { children: [
105
+ t,
106
+ /* @__PURE__ */ r(f, {
107
+ href: "https://better-auth.com",
108
+ className: e("text-primary underline", T?.link),
109
+ children: "better-auth"
110
+ }),
111
+ a
112
+ ] });
113
+ })()
114
+ })
115
+ ]
116
+ })
117
+ })
118
+ })
119
+ })
120
+ ] });
14
121
  };
15
- /**
16
- * Email template component that sends one-time password (OTP) verification codes to users.
17
- *
18
- * This email includes:
19
- * - Large, prominently displayed verification code
20
- * - Expiration time information
21
- * - Security notice for unauthorized requests
22
- * - Customizable branding and styling
23
- * - Support for light/dark mode themes
24
- *
25
- * @example
26
- * ```tsx
27
- * <OtpEmail
28
- * verificationCode="069420"
29
- * email="user@example.com"
30
- * appName="My App"
31
- * expirationMinutes={10}
32
- * logoURL="https://example.com/logo.png"
33
- * darkMode={true}
34
- * />
35
- * ```
36
- */
37
- export const OtpEmail = ({ verificationCode, email, appName, expirationMinutes = 10, logoURL, colors, classNames, darkMode = true, poweredBy, head, ...props }) => {
38
- const localization = {
39
- ...OtpEmail.localization,
40
- ...props.localization
41
- };
42
- const previewText = localization.YOUR_VERIFICATION_CODE_IS_CODE.replace("{verificationCode}", verificationCode);
43
- 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 &&
44
- (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("mb-5 text-2xl font-semibold", classNames?.title), children: localization.VERIFY_YOUR_EMAIL }), _jsx(Text, { className: cn("text-sm font-normal", classNames?.content), children: (() => {
45
- const textWithAppName = localization.WE_NEED_TO_VERIFY_YOUR_EMAIL_ADDRESS.replace("{appName}", appName || "")
46
- .replace(/\s{2,}/g, " ")
47
- .replace(" .", ".");
48
- const [beforeEmail, afterEmail] = textWithAppName.split("{email}");
49
- return email ? (_jsxs(_Fragment, { children: [beforeEmail, _jsx(Link, { href: `mailto:${email}`, className: "text-primary font-medium", children: email }), afterEmail] })) : (textWithAppName
50
- .replace("{email}", "")
51
- .replace(/\s{2,}/g, " ")
52
- .replace(" .", "."));
53
- })() }), _jsx(Section, { className: cn("my-6 border border-border bg-muted p-6", classNames?.codeBlock), children: _jsx(Text, { className: cn("m-0 text-center text-4xl font-semibold tracking-widest", classNames?.title), children: verificationCode }) }), _jsx(Hr, { className: cn("my-6 w-full border border-solid border-border", classNames?.separator) }), _jsxs(Text, { className: cn("mb-3 text-xs text-muted-foreground", classNames?.description), children: [localization.THIS_CODE_EXPIRES_IN_MINUTES.replace("{expirationMinutes}", expirationMinutes.toString()), appName && (_jsxs(_Fragment, { children: [" ", localization.EMAIL_SENT_BY.replace("{appName}", appName)] }))] }), _jsx(Text, { className: cn("mt-3 text-xs text-muted-foreground", classNames?.description), children: localization.IF_YOU_DIDNT_REQUEST_THIS_EMAIL }), poweredBy && (_jsx(Text, { className: cn("mt-4 mb-0 text-center text-[11px] text-muted-foreground", classNames?.poweredBy), children: (() => {
54
- const [beforeBetterAuth, afterBetterAuth] = localization.POWERED_BY_BETTER_AUTH.split("{betterAuth}");
55
- return (_jsxs(_Fragment, { children: [beforeBetterAuth, _jsx(Link, { href: "https://better-auth.com", className: cn("text-primary underline", classNames?.link), children: "better-auth" }), afterBetterAuth] }));
56
- })() }))] }) }) }) })] }));
122
+ y.localization = v, y.PreviewProps = {
123
+ verificationCode: "069420",
124
+ email: "m@example.com",
125
+ appName: "Better Auth",
126
+ darkMode: !0
57
127
  };
58
- OtpEmail.localization = otpEmailLocalization;
59
- OtpEmail.PreviewProps = {
60
- verificationCode: "069420",
61
- email: "m@example.com",
62
- appName: "Better Auth",
63
- darkMode: true
64
- };
65
- export default OtpEmail;
128
+ //#endregion
129
+ export { y as default };
@@ -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 passwordChangedEmailLocalization: {
4
4
  YOUR_PASSWORD_HAS_BEEN_CHANGED: string;
5
5
  LOGO: string;