better-auth-ui 3.2.5

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 (226) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +53 -0
  3. package/dist/auth-hooks-IOEvlYYv.d.cts +6966 -0
  4. package/dist/auth-hooks-IOEvlYYv.d.ts +6966 -0
  5. package/dist/auth-mutators-DdqOmQ32.d.cts +29 -0
  6. package/dist/auth-mutators-DdqOmQ32.d.ts +29 -0
  7. package/dist/auth-ui-provider-BsH3xJDw.d.ts +697 -0
  8. package/dist/auth-ui-provider-DhZfncd3.d.cts +697 -0
  9. package/dist/chunk-BDFQSFBU.js +750 -0
  10. package/dist/chunk-CRAHKL2C.cjs +801 -0
  11. package/dist/chunk-MJPOA6PK.js +801 -0
  12. package/dist/chunk-SV64DXGW.cjs +750 -0
  13. package/dist/index.cjs +12618 -0
  14. package/dist/index.d.cts +771 -0
  15. package/dist/index.d.ts +771 -0
  16. package/dist/index.js +12618 -0
  17. package/dist/instantdb.cjs +189 -0
  18. package/dist/instantdb.d.cts +36 -0
  19. package/dist/instantdb.d.ts +36 -0
  20. package/dist/instantdb.js +189 -0
  21. package/dist/metafile-cjs.json +1 -0
  22. package/dist/metafile-esm.json +1 -0
  23. package/dist/server.cjs +194 -0
  24. package/dist/server.d.cts +35 -0
  25. package/dist/server.d.ts +35 -0
  26. package/dist/server.js +194 -0
  27. package/dist/style.css +1 -0
  28. package/dist/tanstack.cjs +153 -0
  29. package/dist/tanstack.d.cts +18 -0
  30. package/dist/tanstack.d.ts +18 -0
  31. package/dist/tanstack.js +153 -0
  32. package/dist/triplit.cjs +201 -0
  33. package/dist/triplit.d.cts +31 -0
  34. package/dist/triplit.d.ts +31 -0
  35. package/dist/triplit.js +201 -0
  36. package/dist/utils-C5R37WDe.d.cts +3 -0
  37. package/dist/utils-C5R37WDe.d.ts +3 -0
  38. package/dist/view-paths-CHSJf5dv.d.cts +645 -0
  39. package/dist/view-paths-CHSJf5dv.d.ts +645 -0
  40. package/package.json +156 -0
  41. package/src/components/account/account-view.tsx +220 -0
  42. package/src/components/auth/auth-callback.tsx +36 -0
  43. package/src/components/auth/auth-form.tsx +277 -0
  44. package/src/components/auth/auth-view.tsx +389 -0
  45. package/src/components/auth/email-otp-button.tsx +53 -0
  46. package/src/components/auth/forms/email-otp-form.tsx +288 -0
  47. package/src/components/auth/forms/forgot-password-form.tsx +168 -0
  48. package/src/components/auth/forms/magic-link-form.tsx +191 -0
  49. package/src/components/auth/forms/recover-account-form.tsx +138 -0
  50. package/src/components/auth/forms/reset-password-form.tsx +215 -0
  51. package/src/components/auth/forms/sign-in-form.tsx +289 -0
  52. package/src/components/auth/forms/sign-up-form.tsx +788 -0
  53. package/src/components/auth/forms/two-factor-form.tsx +372 -0
  54. package/src/components/auth/magic-link-button.tsx +54 -0
  55. package/src/components/auth/one-tap.tsx +48 -0
  56. package/src/components/auth/otp-input-group.tsx +65 -0
  57. package/src/components/auth/passkey-button.tsx +85 -0
  58. package/src/components/auth/provider-button.tsx +141 -0
  59. package/src/components/auth/sign-out.tsx +25 -0
  60. package/src/components/auth-loading.tsx +21 -0
  61. package/src/components/captcha/captcha.tsx +79 -0
  62. package/src/components/captcha/recaptcha-badge.tsx +61 -0
  63. package/src/components/captcha/recaptcha-v2.tsx +58 -0
  64. package/src/components/captcha/recaptcha-v3.tsx +73 -0
  65. package/src/components/email/email-template.tsx +216 -0
  66. package/src/components/form-error.tsx +27 -0
  67. package/src/components/organization/accept-invitation-card.tsx +362 -0
  68. package/src/components/organization/create-organization-dialog.tsx +395 -0
  69. package/src/components/organization/delete-organization-card.tsx +101 -0
  70. package/src/components/organization/delete-organization-dialog.tsx +209 -0
  71. package/src/components/organization/invitation-cell.tsx +156 -0
  72. package/src/components/organization/invite-member-dialog.tsx +258 -0
  73. package/src/components/organization/leave-organization-dialog.tsx +150 -0
  74. package/src/components/organization/member-cell.tsx +187 -0
  75. package/src/components/organization/organization-cell-view.tsx +122 -0
  76. package/src/components/organization/organization-cell.tsx +154 -0
  77. package/src/components/organization/organization-invitations-card.tsx +94 -0
  78. package/src/components/organization/organization-logo-card.tsx +308 -0
  79. package/src/components/organization/organization-logo.tsx +120 -0
  80. package/src/components/organization/organization-members-card.tsx +155 -0
  81. package/src/components/organization/organization-name-card.tsx +204 -0
  82. package/src/components/organization/organization-settings-cards.tsx +67 -0
  83. package/src/components/organization/organization-slug-card.tsx +223 -0
  84. package/src/components/organization/organization-switcher.tsx +512 -0
  85. package/src/components/organization/organization-view.tsx +228 -0
  86. package/src/components/organization/organizations-card.tsx +72 -0
  87. package/src/components/organization/personal-account-view.tsx +115 -0
  88. package/src/components/organization/remove-member-dialog.tsx +144 -0
  89. package/src/components/organization/update-member-role-dialog.tsx +213 -0
  90. package/src/components/organization/user-invitations-card.tsx +238 -0
  91. package/src/components/password-input.tsx +56 -0
  92. package/src/components/provider-icons.tsx +385 -0
  93. package/src/components/redirect-to-sign-in.tsx +16 -0
  94. package/src/components/redirect-to-sign-up.tsx +16 -0
  95. package/src/components/settings/account/account-cell.tsx +158 -0
  96. package/src/components/settings/account/accounts-card.tsx +75 -0
  97. package/src/components/settings/account/delete-account-card.tsx +65 -0
  98. package/src/components/settings/account/delete-account-dialog.tsx +231 -0
  99. package/src/components/settings/account/update-avatar-card.tsx +198 -0
  100. package/src/components/settings/account/update-field-card.tsx +282 -0
  101. package/src/components/settings/account/update-name-card.tsx +39 -0
  102. package/src/components/settings/account/update-username-card.tsx +42 -0
  103. package/src/components/settings/account-settings-cards.tsx +123 -0
  104. package/src/components/settings/api-key/api-key-cell.tsx +108 -0
  105. package/src/components/settings/api-key/api-key-delete-dialog.tsx +162 -0
  106. package/src/components/settings/api-key/api-key-display-dialog.tsx +110 -0
  107. package/src/components/settings/api-key/api-keys-card.tsx +98 -0
  108. package/src/components/settings/api-key/create-api-key-dialog.tsx +376 -0
  109. package/src/components/settings/passkey/passkey-cell.tsx +113 -0
  110. package/src/components/settings/passkey/passkeys-card.tsx +111 -0
  111. package/src/components/settings/providers/provider-cell.tsx +152 -0
  112. package/src/components/settings/providers/providers-card.tsx +108 -0
  113. package/src/components/settings/security/change-email-card.tsx +200 -0
  114. package/src/components/settings/security/change-password-card.tsx +326 -0
  115. package/src/components/settings/security/session-cell.tsx +120 -0
  116. package/src/components/settings/security/sessions-card.tsx +58 -0
  117. package/src/components/settings/security-settings-cards.tsx +111 -0
  118. package/src/components/settings/shared/session-freshness-dialog.tsx +97 -0
  119. package/src/components/settings/shared/settings-action-button.tsx +51 -0
  120. package/src/components/settings/shared/settings-card-footer.tsx +94 -0
  121. package/src/components/settings/shared/settings-card-header.tsx +67 -0
  122. package/src/components/settings/shared/settings-card.tsx +106 -0
  123. package/src/components/settings/skeletons/input-field-skeleton.tsx +18 -0
  124. package/src/components/settings/skeletons/settings-cell-skeleton.tsx +37 -0
  125. package/src/components/settings/two-factor/backup-codes-dialog.tsx +113 -0
  126. package/src/components/settings/two-factor/two-factor-card.tsx +63 -0
  127. package/src/components/settings/two-factor/two-factor-password-dialog.tsx +226 -0
  128. package/src/components/signed-in.tsx +20 -0
  129. package/src/components/signed-out.tsx +20 -0
  130. package/src/components/ui/alert.tsx +66 -0
  131. package/src/components/ui/avatar.tsx +53 -0
  132. package/src/components/ui/button.tsx +59 -0
  133. package/src/components/ui/card.tsx +92 -0
  134. package/src/components/ui/checkbox.tsx +32 -0
  135. package/src/components/ui/dialog.tsx +143 -0
  136. package/src/components/ui/drawer.tsx +135 -0
  137. package/src/components/ui/dropdown-menu.tsx +257 -0
  138. package/src/components/ui/form.tsx +167 -0
  139. package/src/components/ui/input-otp.tsx +77 -0
  140. package/src/components/ui/input.tsx +21 -0
  141. package/src/components/ui/label.tsx +24 -0
  142. package/src/components/ui/select.tsx +185 -0
  143. package/src/components/ui/separator.tsx +28 -0
  144. package/src/components/ui/skeleton.tsx +13 -0
  145. package/src/components/ui/tabs.tsx +66 -0
  146. package/src/components/ui/textarea.tsx +18 -0
  147. package/src/components/user-avatar.tsx +147 -0
  148. package/src/components/user-button.tsx +409 -0
  149. package/src/components/user-view.tsx +138 -0
  150. package/src/hooks/use-auth-data.ts +184 -0
  151. package/src/hooks/use-authenticate.ts +62 -0
  152. package/src/hooks/use-captcha.tsx +138 -0
  153. package/src/hooks/use-current-organization.ts +59 -0
  154. package/src/hooks/use-hydrated.ts +13 -0
  155. package/src/hooks/use-lang.ts +32 -0
  156. package/src/hooks/use-success-transition.ts +51 -0
  157. package/src/hooks/use-theme.ts +39 -0
  158. package/src/index.ts +65 -0
  159. package/src/instantdb.ts +1 -0
  160. package/src/lib/auth-data-cache.ts +90 -0
  161. package/src/lib/auth-ui-provider.tsx +658 -0
  162. package/src/lib/gravatar-utils.ts +58 -0
  163. package/src/lib/image-utils.ts +55 -0
  164. package/src/lib/instantdb/model-names.ts +24 -0
  165. package/src/lib/instantdb/use-instant-options.ts +98 -0
  166. package/src/lib/instantdb/use-list-accounts.ts +38 -0
  167. package/src/lib/instantdb/use-list-sessions.ts +53 -0
  168. package/src/lib/instantdb/use-session.ts +55 -0
  169. package/src/lib/organization-refetcher.tsx +56 -0
  170. package/src/lib/social-providers.ts +144 -0
  171. package/src/lib/tanstack/auth-ui-provider-tanstack.tsx +49 -0
  172. package/src/lib/tanstack/use-tanstack-options.ts +112 -0
  173. package/src/lib/triplit/model-names.ts +24 -0
  174. package/src/lib/triplit/use-conditional-query.ts +82 -0
  175. package/src/lib/triplit/use-list-accounts.ts +31 -0
  176. package/src/lib/triplit/use-list-sessions.ts +33 -0
  177. package/src/lib/triplit/use-session.ts +42 -0
  178. package/src/lib/triplit/use-triplit-hooks.ts +68 -0
  179. package/src/lib/triplit/use-triplit-token.ts +44 -0
  180. package/src/lib/utils.ts +105 -0
  181. package/src/lib/view-paths.ts +55 -0
  182. package/src/localization/admin-error-codes.ts +20 -0
  183. package/src/localization/anonymous-error-codes.ts +6 -0
  184. package/src/localization/api-key-error-codes.ts +32 -0
  185. package/src/localization/auth-localization.ts +740 -0
  186. package/src/localization/base-error-codes.ts +27 -0
  187. package/src/localization/captcha-error-codes.ts +17 -0
  188. package/src/localization/email-otp-error-codes.ts +7 -0
  189. package/src/localization/generic-oauth-error-codes.ts +3 -0
  190. package/src/localization/haveibeenpwned-error-codes.ts +4 -0
  191. package/src/localization/multi-session-error-codes.ts +3 -0
  192. package/src/localization/organization-error-codes.ts +57 -0
  193. package/src/localization/passkey-error-codes.ts +10 -0
  194. package/src/localization/phone-number-error-codes.ts +10 -0
  195. package/src/localization/stripe-localization.ts +12 -0
  196. package/src/localization/two-factor-error-codes.ts +12 -0
  197. package/src/localization/username-error-codes.ts +9 -0
  198. package/src/server.ts +4 -0
  199. package/src/style.css +1 -0
  200. package/src/tanstack.ts +1 -0
  201. package/src/triplit.ts +1 -0
  202. package/src/types/account-options.ts +35 -0
  203. package/src/types/additional-fields.ts +21 -0
  204. package/src/types/any-auth-client.ts +6 -0
  205. package/src/types/api-key.ts +9 -0
  206. package/src/types/auth-client.ts +37 -0
  207. package/src/types/auth-hooks.ts +61 -0
  208. package/src/types/auth-mutators.ts +17 -0
  209. package/src/types/avatar-options.ts +29 -0
  210. package/src/types/captcha-options.ts +32 -0
  211. package/src/types/captcha-provider.ts +6 -0
  212. package/src/types/credentials-options.ts +32 -0
  213. package/src/types/delete-user-options.ts +7 -0
  214. package/src/types/fetch-error.ts +6 -0
  215. package/src/types/generic-oauth-options.ts +16 -0
  216. package/src/types/gravatar-options.ts +21 -0
  217. package/src/types/image.ts +7 -0
  218. package/src/types/invitation.ts +10 -0
  219. package/src/types/link.ts +7 -0
  220. package/src/types/organization-options.ts +106 -0
  221. package/src/types/password-validation.ts +16 -0
  222. package/src/types/profile.ts +15 -0
  223. package/src/types/refetch.ts +1 -0
  224. package/src/types/render-toast.ts +9 -0
  225. package/src/types/sign-up-options.ts +7 -0
  226. package/src/types/social-options.ts +16 -0
@@ -0,0 +1,194 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+
7
+
8
+ var _chunkCRAHKL2Ccjs = require('./chunk-CRAHKL2C.cjs');
9
+
10
+ // src/components/email/email-template.tsx
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+ var _components = require('@react-email/components');
26
+ var _jsxruntime = require('react/jsx-runtime');
27
+ var EmailTemplate = ({
28
+ classNames,
29
+ action,
30
+ baseUrl,
31
+ content,
32
+ heading,
33
+ imageUrl,
34
+ preview,
35
+ siteName,
36
+ variant = "vercel",
37
+ url
38
+ }) => {
39
+ baseUrl = baseUrl || process.env.BASE_URL || process.env.NEXT_PUBLIC_BASE_URL;
40
+ imageUrl = imageUrl || `${baseUrl}/apple-touch-icon.png`;
41
+ siteName = siteName || process.env.SITE_NAME || process.env.NEXT_PUBLIC_SITE_NAME;
42
+ preview = preview || (typeof heading === "string" ? heading : void 0);
43
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _components.Html, { children: [
44
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _components.Head, { children: [
45
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "meta", { name: "x-apple-disable-message-reformatting" }),
46
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "meta", { content: "light dark", name: "color-scheme" }),
47
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "meta", { content: "light dark", name: "supported-color-schemes" }),
48
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "style", { type: "text/css", children: `
49
+ :root {
50
+ color-scheme: light dark;
51
+ supported-color-schemes: light dark;
52
+ }
53
+ ` }),
54
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "style", { type: "text/css", children: `
55
+ html, body {
56
+ background-color: #ffffff;
57
+ color: #000000;
58
+ }
59
+
60
+ a {
61
+ color: #000000;
62
+ }
63
+
64
+ .border-color {
65
+ border-color: #eaeaea;
66
+ }
67
+
68
+ .action-button {
69
+ background-color: #000000 !important;
70
+ color: #ffffff !important;
71
+ }
72
+
73
+ @media (prefers-color-scheme: dark) {
74
+ html, body {
75
+ background-color: #000000 !important;
76
+ color: #ffffff !important;
77
+ }
78
+
79
+ a {
80
+ color: #ffffff;
81
+ }
82
+
83
+ .border-color {
84
+ border-color: #333333 !important;
85
+ }
86
+
87
+ .action-button {
88
+ background-color: rgb(38, 38, 38) !important;
89
+ color: #ffffff !important;
90
+ }
91
+ }
92
+ ` })
93
+ ] }),
94
+ preview && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _components.Preview, { children: preview }),
95
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _components.Tailwind, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
96
+ _components.Body,
97
+ {
98
+ className: _chunkCRAHKL2Ccjs.cn.call(void 0,
99
+ "mx-auto my-auto px-2 font-sans",
100
+ classNames == null ? void 0 : classNames.body
101
+ ),
102
+ children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _components.Container, { className: "mx-auto my-[40px] max-w-[465px] rounded border border-color border-solid p-[20px]", children: [
103
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _components.Section, { className: "mt-[32px]", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
104
+ _components.Img,
105
+ {
106
+ alt: siteName,
107
+ className: _chunkCRAHKL2Ccjs.cn.call(void 0,
108
+ "mx-auto my-0 rounded-full",
109
+ classNames == null ? void 0 : classNames.image
110
+ ),
111
+ height: "40",
112
+ src: imageUrl,
113
+ width: "40"
114
+ }
115
+ ) }),
116
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
117
+ _components.Heading,
118
+ {
119
+ className: _chunkCRAHKL2Ccjs.cn.call(void 0,
120
+ "mx-0 my-[30px] p-0 text-center font-bold text-[24px]",
121
+ classNames == null ? void 0 : classNames.heading
122
+ ),
123
+ children: heading
124
+ }
125
+ ),
126
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
127
+ _components.Text,
128
+ {
129
+ className: _chunkCRAHKL2Ccjs.cn.call(void 0,
130
+ "text-[14px] leading-[24px]",
131
+ classNames == null ? void 0 : classNames.content
132
+ ),
133
+ children: content
134
+ }
135
+ ),
136
+ action && url && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _components.Section, { className: "mt-[32px] mb-[32px] text-center", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
137
+ _components.Button,
138
+ {
139
+ className: _chunkCRAHKL2Ccjs.cn.call(void 0,
140
+ "action-button rounded px-5 py-3 text-center font-semibold text-[12px] no-underline",
141
+ classNames == null ? void 0 : classNames.button
142
+ ),
143
+ href: url,
144
+ children: action
145
+ }
146
+ ) }),
147
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
148
+ _components.Hr,
149
+ {
150
+ className: _chunkCRAHKL2Ccjs.cn.call(void 0,
151
+ "mx-0 my-[26px] w-full border border-color border-solid",
152
+ classNames == null ? void 0 : classNames.hr
153
+ )
154
+ }
155
+ ),
156
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
157
+ _components.Text,
158
+ {
159
+ className: _chunkCRAHKL2Ccjs.cn.call(void 0,
160
+ "text-[#666666] text-[12px] leading-[24px]",
161
+ classNames == null ? void 0 : classNames.footer
162
+ ),
163
+ children: [
164
+ siteName && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
165
+ siteName,
166
+ " "
167
+ ] }),
168
+ baseUrl && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
169
+ _components.Link,
170
+ {
171
+ className: _chunkCRAHKL2Ccjs.cn.call(void 0,
172
+ "no-underline",
173
+ classNames == null ? void 0 : classNames.link
174
+ ),
175
+ href: baseUrl,
176
+ children: baseUrl == null ? void 0 : baseUrl.replace("https://", "").replace("http://", "")
177
+ }
178
+ )
179
+ ]
180
+ }
181
+ )
182
+ ] })
183
+ }
184
+ ) })
185
+ ] });
186
+ };
187
+
188
+
189
+
190
+
191
+
192
+
193
+
194
+ exports.EmailTemplate = EmailTemplate; exports.accountViewPaths = _chunkCRAHKL2Ccjs.accountViewPaths; exports.authLocalization = _chunkCRAHKL2Ccjs.authLocalization; exports.authViewPaths = _chunkCRAHKL2Ccjs.authViewPaths; exports.getViewByPath = _chunkCRAHKL2Ccjs.getViewByPath; exports.organizationViewPaths = _chunkCRAHKL2Ccjs.organizationViewPaths;
@@ -0,0 +1,35 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+ export { g as getViewByPath } from './utils-C5R37WDe.cjs';
4
+ export { a as AccountViewPath, f as AccountViewPaths, A as AuthLocalization, b as AuthViewPath, c as AuthViewPaths, O as OrganizationViewPath, g as OrganizationViewPaths, e as accountViewPaths, h as authLocalization, d as authViewPaths, o as organizationViewPaths } from './view-paths-CHSJf5dv.cjs';
5
+
6
+ interface EmailTemplateClassNames {
7
+ body?: string;
8
+ button?: string;
9
+ container?: string;
10
+ image?: string;
11
+ content?: string;
12
+ footer?: string;
13
+ heading?: string;
14
+ hr?: string;
15
+ link?: string;
16
+ }
17
+ interface EmailTemplateProps {
18
+ classNames?: EmailTemplateClassNames;
19
+ action?: string;
20
+ /** @default process.env.BASE_URL || process.env.NEXT_PUBLIC_BASE_URL */
21
+ baseUrl?: string;
22
+ content: ReactNode;
23
+ heading: ReactNode;
24
+ /** @default `${baseUrl}/apple-touch-icon.png` */
25
+ imageUrl?: string;
26
+ preview?: string;
27
+ /** @default process.env.SITE_NAME || process.env.NEXT_PUBLIC_SITE_NAME */
28
+ siteName?: string;
29
+ url?: string;
30
+ /** @default "vercel" */
31
+ variant?: "vercel";
32
+ }
33
+ declare const EmailTemplate: ({ classNames, action, baseUrl, content, heading, imageUrl, preview, siteName, variant, url }: EmailTemplateProps) => react_jsx_runtime.JSX.Element;
34
+
35
+ export { EmailTemplate, type EmailTemplateClassNames, type EmailTemplateProps };
@@ -0,0 +1,35 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+ export { g as getViewByPath } from './utils-C5R37WDe.js';
4
+ export { a as AccountViewPath, f as AccountViewPaths, A as AuthLocalization, b as AuthViewPath, c as AuthViewPaths, O as OrganizationViewPath, g as OrganizationViewPaths, e as accountViewPaths, h as authLocalization, d as authViewPaths, o as organizationViewPaths } from './view-paths-CHSJf5dv.js';
5
+
6
+ interface EmailTemplateClassNames {
7
+ body?: string;
8
+ button?: string;
9
+ container?: string;
10
+ image?: string;
11
+ content?: string;
12
+ footer?: string;
13
+ heading?: string;
14
+ hr?: string;
15
+ link?: string;
16
+ }
17
+ interface EmailTemplateProps {
18
+ classNames?: EmailTemplateClassNames;
19
+ action?: string;
20
+ /** @default process.env.BASE_URL || process.env.NEXT_PUBLIC_BASE_URL */
21
+ baseUrl?: string;
22
+ content: ReactNode;
23
+ heading: ReactNode;
24
+ /** @default `${baseUrl}/apple-touch-icon.png` */
25
+ imageUrl?: string;
26
+ preview?: string;
27
+ /** @default process.env.SITE_NAME || process.env.NEXT_PUBLIC_SITE_NAME */
28
+ siteName?: string;
29
+ url?: string;
30
+ /** @default "vercel" */
31
+ variant?: "vercel";
32
+ }
33
+ declare const EmailTemplate: ({ classNames, action, baseUrl, content, heading, imageUrl, preview, siteName, variant, url }: EmailTemplateProps) => react_jsx_runtime.JSX.Element;
34
+
35
+ export { EmailTemplate, type EmailTemplateClassNames, type EmailTemplateProps };
package/dist/server.js ADDED
@@ -0,0 +1,194 @@
1
+ import {
2
+ accountViewPaths,
3
+ authLocalization,
4
+ authViewPaths,
5
+ cn,
6
+ getViewByPath,
7
+ organizationViewPaths
8
+ } from "./chunk-MJPOA6PK.js";
9
+
10
+ // src/components/email/email-template.tsx
11
+ import {
12
+ Body,
13
+ Button,
14
+ Container,
15
+ Head,
16
+ Heading,
17
+ Hr,
18
+ Html,
19
+ Img,
20
+ Link,
21
+ Preview,
22
+ Section,
23
+ Tailwind,
24
+ Text
25
+ } from "@react-email/components";
26
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
27
+ var EmailTemplate = ({
28
+ classNames,
29
+ action,
30
+ baseUrl,
31
+ content,
32
+ heading,
33
+ imageUrl,
34
+ preview,
35
+ siteName,
36
+ variant = "vercel",
37
+ url
38
+ }) => {
39
+ baseUrl = baseUrl || process.env.BASE_URL || process.env.NEXT_PUBLIC_BASE_URL;
40
+ imageUrl = imageUrl || `${baseUrl}/apple-touch-icon.png`;
41
+ siteName = siteName || process.env.SITE_NAME || process.env.NEXT_PUBLIC_SITE_NAME;
42
+ preview = preview || (typeof heading === "string" ? heading : void 0);
43
+ return /* @__PURE__ */ jsxs(Html, { children: [
44
+ /* @__PURE__ */ jsxs(Head, { children: [
45
+ /* @__PURE__ */ jsx("meta", { name: "x-apple-disable-message-reformatting" }),
46
+ /* @__PURE__ */ jsx("meta", { content: "light dark", name: "color-scheme" }),
47
+ /* @__PURE__ */ jsx("meta", { content: "light dark", name: "supported-color-schemes" }),
48
+ /* @__PURE__ */ jsx("style", { type: "text/css", children: `
49
+ :root {
50
+ color-scheme: light dark;
51
+ supported-color-schemes: light dark;
52
+ }
53
+ ` }),
54
+ /* @__PURE__ */ jsx("style", { type: "text/css", children: `
55
+ html, body {
56
+ background-color: #ffffff;
57
+ color: #000000;
58
+ }
59
+
60
+ a {
61
+ color: #000000;
62
+ }
63
+
64
+ .border-color {
65
+ border-color: #eaeaea;
66
+ }
67
+
68
+ .action-button {
69
+ background-color: #000000 !important;
70
+ color: #ffffff !important;
71
+ }
72
+
73
+ @media (prefers-color-scheme: dark) {
74
+ html, body {
75
+ background-color: #000000 !important;
76
+ color: #ffffff !important;
77
+ }
78
+
79
+ a {
80
+ color: #ffffff;
81
+ }
82
+
83
+ .border-color {
84
+ border-color: #333333 !important;
85
+ }
86
+
87
+ .action-button {
88
+ background-color: rgb(38, 38, 38) !important;
89
+ color: #ffffff !important;
90
+ }
91
+ }
92
+ ` })
93
+ ] }),
94
+ preview && /* @__PURE__ */ jsx(Preview, { children: preview }),
95
+ /* @__PURE__ */ jsx(Tailwind, { children: /* @__PURE__ */ jsx(
96
+ Body,
97
+ {
98
+ className: cn(
99
+ "mx-auto my-auto px-2 font-sans",
100
+ classNames == null ? void 0 : classNames.body
101
+ ),
102
+ children: /* @__PURE__ */ jsxs(Container, { className: "mx-auto my-[40px] max-w-[465px] rounded border border-color border-solid p-[20px]", children: [
103
+ /* @__PURE__ */ jsx(Section, { className: "mt-[32px]", children: /* @__PURE__ */ jsx(
104
+ Img,
105
+ {
106
+ alt: siteName,
107
+ className: cn(
108
+ "mx-auto my-0 rounded-full",
109
+ classNames == null ? void 0 : classNames.image
110
+ ),
111
+ height: "40",
112
+ src: imageUrl,
113
+ width: "40"
114
+ }
115
+ ) }),
116
+ /* @__PURE__ */ jsx(
117
+ Heading,
118
+ {
119
+ className: cn(
120
+ "mx-0 my-[30px] p-0 text-center font-bold text-[24px]",
121
+ classNames == null ? void 0 : classNames.heading
122
+ ),
123
+ children: heading
124
+ }
125
+ ),
126
+ /* @__PURE__ */ jsx(
127
+ Text,
128
+ {
129
+ className: cn(
130
+ "text-[14px] leading-[24px]",
131
+ classNames == null ? void 0 : classNames.content
132
+ ),
133
+ children: content
134
+ }
135
+ ),
136
+ action && url && /* @__PURE__ */ jsx(Section, { className: "mt-[32px] mb-[32px] text-center", children: /* @__PURE__ */ jsx(
137
+ Button,
138
+ {
139
+ className: cn(
140
+ "action-button rounded px-5 py-3 text-center font-semibold text-[12px] no-underline",
141
+ classNames == null ? void 0 : classNames.button
142
+ ),
143
+ href: url,
144
+ children: action
145
+ }
146
+ ) }),
147
+ /* @__PURE__ */ jsx(
148
+ Hr,
149
+ {
150
+ className: cn(
151
+ "mx-0 my-[26px] w-full border border-color border-solid",
152
+ classNames == null ? void 0 : classNames.hr
153
+ )
154
+ }
155
+ ),
156
+ /* @__PURE__ */ jsxs(
157
+ Text,
158
+ {
159
+ className: cn(
160
+ "text-[#666666] text-[12px] leading-[24px]",
161
+ classNames == null ? void 0 : classNames.footer
162
+ ),
163
+ children: [
164
+ siteName && /* @__PURE__ */ jsxs(Fragment, { children: [
165
+ siteName,
166
+ " "
167
+ ] }),
168
+ baseUrl && /* @__PURE__ */ jsx(
169
+ Link,
170
+ {
171
+ className: cn(
172
+ "no-underline",
173
+ classNames == null ? void 0 : classNames.link
174
+ ),
175
+ href: baseUrl,
176
+ children: baseUrl == null ? void 0 : baseUrl.replace("https://", "").replace("http://", "")
177
+ }
178
+ )
179
+ ]
180
+ }
181
+ )
182
+ ] })
183
+ }
184
+ ) })
185
+ ] });
186
+ };
187
+ export {
188
+ EmailTemplate,
189
+ accountViewPaths,
190
+ authLocalization,
191
+ authViewPaths,
192
+ getViewByPath,
193
+ organizationViewPaths
194
+ };
package/dist/style.css ADDED
@@ -0,0 +1 @@
1
+ @source ".";
@@ -0,0 +1,153 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkSV64DXGWcjs = require('./chunk-SV64DXGW.cjs');
4
+ require('./chunk-CRAHKL2C.cjs');
5
+
6
+ // src/lib/tanstack/auth-ui-provider-tanstack.tsx
7
+ var _react = require('react');
8
+
9
+ // src/lib/tanstack/use-tanstack-options.ts
10
+
11
+
12
+
13
+ var _betterauthtanstack = require('@daveyplate/better-auth-tanstack');
14
+ var _reactquery = require('@tanstack/react-query');
15
+
16
+ function useTanstackOptions({
17
+ authClient
18
+ }) {
19
+ const {
20
+ useUnlinkAccount,
21
+ useUpdateUser,
22
+ useDeletePasskey,
23
+ useRevokeSession,
24
+ useRevokeDeviceSession,
25
+ useSetActiveSession
26
+ } = _betterauthtanstack.createAuthHooks.call(void 0, authClient);
27
+ const queryClient = _reactquery.useQueryClient.call(void 0, );
28
+ const { mutateAsync: updateUserAsync } = useUpdateUser();
29
+ const { mutateAsync: deletePasskeyAsync } = useDeletePasskey();
30
+ const { mutateAsync: unlinkAccountAsync } = useUnlinkAccount();
31
+ const { mutateAsync: revokeSessionAsync } = useRevokeSession();
32
+ const { mutateAsync: revokeDeviceSessionAsync } = useRevokeDeviceSession();
33
+ const { setActiveSessionAsync } = useSetActiveSession();
34
+ const { sessionKey } = _react.useContext.call(void 0, _betterauthtanstack.AuthQueryContext);
35
+ const hooks = _react.useMemo.call(void 0,
36
+ () => ({
37
+ ..._betterauthtanstack.createAuthHooks.call(void 0, authClient),
38
+ useIsRestoring: _reactquery.useIsRestoring
39
+ }),
40
+ [authClient]
41
+ );
42
+ const mutators = _react.useMemo.call(void 0,
43
+ () => ({
44
+ updateUser: async (params) => {
45
+ const { error } = await updateUserAsync({
46
+ ...params,
47
+ fetchOptions: { throw: false }
48
+ });
49
+ if (error) throw error;
50
+ },
51
+ unlinkAccount: async (params) => {
52
+ const { error } = await unlinkAccountAsync({
53
+ ...params,
54
+ fetchOptions: { throw: false }
55
+ });
56
+ if (error) throw error;
57
+ },
58
+ deletePasskey: async (params) => {
59
+ const { error } = await deletePasskeyAsync({
60
+ ...params,
61
+ fetchOptions: { throw: false }
62
+ });
63
+ if (error) throw error;
64
+ },
65
+ revokeSession: async (params) => {
66
+ const { error } = await revokeSessionAsync({
67
+ ...params,
68
+ fetchOptions: { throw: false }
69
+ });
70
+ if (error) throw error;
71
+ },
72
+ setActiveSession: async (params) => {
73
+ const { error } = await setActiveSessionAsync({
74
+ ...params,
75
+ fetchOptions: { throw: false }
76
+ });
77
+ if (error) throw error;
78
+ },
79
+ revokeDeviceSession: async (params) => {
80
+ const { error } = await revokeDeviceSessionAsync({
81
+ ...params,
82
+ fetchOptions: { throw: false }
83
+ });
84
+ if (error) throw error;
85
+ }
86
+ }),
87
+ [
88
+ updateUserAsync,
89
+ deletePasskeyAsync,
90
+ unlinkAccountAsync,
91
+ revokeSessionAsync,
92
+ revokeDeviceSessionAsync,
93
+ setActiveSessionAsync
94
+ ]
95
+ );
96
+ const onSessionChange = _react.useCallback.call(void 0, async () => {
97
+ await queryClient.refetchQueries({ queryKey: sessionKey });
98
+ queryClient.invalidateQueries({
99
+ predicate: (query) => query.queryKey !== sessionKey
100
+ });
101
+ }, [queryClient, sessionKey]);
102
+ return {
103
+ hooks,
104
+ mutators,
105
+ onSessionChange,
106
+ optimistic: true
107
+ };
108
+ }
109
+
110
+ // src/lib/tanstack/auth-ui-provider-tanstack.tsx
111
+ var _jsxruntime = require('react/jsx-runtime');
112
+ function AuthUIProviderTanstack({
113
+ children,
114
+ authClient,
115
+ hooks: hooksProp,
116
+ mutators: mutatorsProp,
117
+ onSessionChange: onSessionChangeProp,
118
+ ...props
119
+ }) {
120
+ const {
121
+ hooks: contextHooks,
122
+ mutators: contextMutators,
123
+ onSessionChange,
124
+ optimistic
125
+ } = useTanstackOptions({ authClient });
126
+ const hooks = _react.useMemo.call(void 0,
127
+ () => ({ ...contextHooks, ...hooksProp }),
128
+ [contextHooks, hooksProp]
129
+ );
130
+ const mutators = _react.useMemo.call(void 0,
131
+ () => ({ ...contextMutators, ...mutatorsProp }),
132
+ [contextMutators, mutatorsProp]
133
+ );
134
+ const onSessionChangeCallback = _react.useCallback.call(void 0, async () => {
135
+ await onSessionChange();
136
+ await (onSessionChangeProp == null ? void 0 : onSessionChangeProp());
137
+ }, [onSessionChangeProp, onSessionChange]);
138
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
139
+ _chunkSV64DXGWcjs.AuthUIProvider,
140
+ {
141
+ authClient,
142
+ hooks,
143
+ mutators,
144
+ onSessionChange: onSessionChangeCallback,
145
+ optimistic,
146
+ ...props,
147
+ children
148
+ }
149
+ );
150
+ }
151
+
152
+
153
+ exports.AuthUIProviderTanstack = AuthUIProviderTanstack;
@@ -0,0 +1,18 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { l as AuthUIProviderProps } from './auth-ui-provider-DhZfncd3.cjs';
3
+ import 'react';
4
+ import './view-paths-CHSJf5dv.cjs';
5
+ import './auth-hooks-IOEvlYYv.cjs';
6
+ import '@better-fetch/fetch';
7
+ import 'better-auth';
8
+ import 'better-auth/plugins/organization';
9
+ import 'better-auth/react';
10
+ import 'inspector';
11
+ import 'better-auth/client/plugins';
12
+ import 'better-auth/plugins/passkey';
13
+ import './auth-mutators-DdqOmQ32.cjs';
14
+ import 'better-auth/social-providers';
15
+
16
+ declare function AuthUIProviderTanstack({ children, authClient, hooks: hooksProp, mutators: mutatorsProp, onSessionChange: onSessionChangeProp, ...props }: AuthUIProviderProps): react_jsx_runtime.JSX.Element;
17
+
18
+ export { AuthUIProviderTanstack };
@@ -0,0 +1,18 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { l as AuthUIProviderProps } from './auth-ui-provider-BsH3xJDw.js';
3
+ import 'react';
4
+ import './view-paths-CHSJf5dv.js';
5
+ import './auth-hooks-IOEvlYYv.js';
6
+ import '@better-fetch/fetch';
7
+ import 'better-auth';
8
+ import 'better-auth/plugins/organization';
9
+ import 'better-auth/react';
10
+ import 'inspector';
11
+ import 'better-auth/client/plugins';
12
+ import 'better-auth/plugins/passkey';
13
+ import './auth-mutators-DdqOmQ32.js';
14
+ import 'better-auth/social-providers';
15
+
16
+ declare function AuthUIProviderTanstack({ children, authClient, hooks: hooksProp, mutators: mutatorsProp, onSessionChange: onSessionChangeProp, ...props }: AuthUIProviderProps): react_jsx_runtime.JSX.Element;
17
+
18
+ export { AuthUIProviderTanstack };