@better-auth-ui/heroui 1.6.8 → 1.6.10

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 (195) hide show
  1. package/dist/components/auth/api-key/api-key.d.ts +5 -1
  2. package/dist/components/auth/api-key/api-keys-empty.d.ts +3 -1
  3. package/dist/components/auth/api-key/api-keys.d.ts +9 -1
  4. package/dist/components/auth/api-key/create-api-key-dialog.d.ts +3 -1
  5. package/dist/components/auth/api-key/delete-api-key-dialog.d.ts +3 -1
  6. package/dist/components/auth/api-key/organization-api-keys.d.ts +14 -0
  7. package/dist/components/auth/delete-user/danger-zone.d.ts +1 -1
  8. package/dist/components/auth/delete-user/{delete-user.d.ts → delete-account.d.ts} +2 -2
  9. package/dist/components/auth/email/organization-invitation-email.d.ts +3 -0
  10. package/dist/components/auth/multi-session/switch-account-submenu-content.d.ts +3 -1
  11. package/dist/components/auth/multi-session/switch-account-submenu-item.d.ts +2 -1
  12. package/dist/components/auth/multi-session/switch-account-submenu.d.ts +2 -1
  13. package/dist/components/auth/organization/change-organization-logo.d.ts +4 -0
  14. package/dist/components/auth/organization/create-organization-dialog.d.ts +13 -0
  15. package/dist/components/auth/organization/delete-organization-dialog.d.ts +7 -0
  16. package/dist/components/auth/organization/delete-organization-skeleton.d.ts +4 -0
  17. package/dist/components/auth/organization/delete-organization.d.ts +5 -0
  18. package/dist/components/auth/organization/invite-member-dialog.d.ts +13 -0
  19. package/dist/components/auth/organization/leave-organization-dialog.d.ts +7 -0
  20. package/dist/components/auth/organization/leave-organization.d.ts +4 -0
  21. package/dist/components/auth/organization/organization-danger-zone.d.ts +16 -0
  22. package/dist/components/auth/organization/organization-invitation-row-skeleton.d.ts +5 -0
  23. package/dist/components/auth/organization/organization-invitation-row.d.ts +5 -0
  24. package/dist/components/auth/organization/organization-invitations-empty.d.ts +8 -0
  25. package/dist/components/auth/organization/organization-invitations.d.ts +9 -0
  26. package/dist/components/auth/organization/organization-logo.d.ts +15 -0
  27. package/dist/components/auth/organization/organization-member-row-skeleton.d.ts +4 -0
  28. package/dist/components/auth/organization/organization-member-row.d.ts +9 -0
  29. package/dist/components/auth/organization/organization-members.d.ts +9 -0
  30. package/dist/components/auth/organization/organization-people.d.ts +10 -0
  31. package/dist/components/auth/organization/organization-profile.d.ts +9 -0
  32. package/dist/components/auth/organization/organization-row.d.ts +8 -0
  33. package/dist/components/auth/organization/organization-settings.d.ts +12 -0
  34. package/dist/components/auth/organization/organization-switcher.d.ts +20 -0
  35. package/dist/components/auth/organization/organization-view-skeleton.d.ts +6 -0
  36. package/dist/components/auth/organization/organization-view.d.ts +15 -0
  37. package/dist/components/auth/organization/organization.d.ts +17 -0
  38. package/dist/components/auth/organization/organizations-empty.d.ts +4 -0
  39. package/dist/components/auth/organization/organizations-settings.d.ts +17 -0
  40. package/dist/components/auth/organization/organizations.d.ts +10 -0
  41. package/dist/components/auth/organization/remove-member-dialog.d.ts +9 -0
  42. package/dist/components/auth/organization/slug-field.d.ts +19 -0
  43. package/dist/components/auth/organization/user-invitation-row-skeleton.d.ts +4 -0
  44. package/dist/components/auth/organization/user-invitation-row.d.ts +10 -0
  45. package/dist/components/auth/organization/user-invitations-empty.d.ts +4 -0
  46. package/dist/components/auth/organization/user-invitations.d.ts +10 -0
  47. package/dist/components/auth/settings/settings.d.ts +1 -1
  48. package/dist/components/auth/user/user-avatar.d.ts +1 -1
  49. package/dist/components/auth/user/user-button.d.ts +4 -5
  50. package/dist/components/auth/user/user-view.d.ts +10 -4
  51. package/dist/email.d.ts +1 -0
  52. package/dist/email.js +211 -8
  53. package/dist/index.js +1682 -22
  54. package/dist/lib/auth/api-key-plugin.d.ts +5 -2
  55. package/dist/lib/auth/auth-plugin.d.ts +6 -2
  56. package/dist/lib/auth/delete-user-plugin.d.ts +4 -4
  57. package/dist/lib/auth/magic-link-plugin.d.ts +2 -2
  58. package/dist/lib/auth/multi-session-plugin.d.ts +2 -2
  59. package/dist/lib/auth/organization-plugin.d.ts +37 -0
  60. package/dist/lib/auth/passkey-plugin.d.ts +2 -2
  61. package/dist/lib/auth/theme-plugin.d.ts +3 -3
  62. package/dist/lib/auth/username-plugin.d.ts +8 -8
  63. package/dist/plugins.d.ts +25 -1
  64. package/dist/plugins.js +2824 -22
  65. package/dist/user-view--47tVtJ3.js +113 -0
  66. package/package.json +23 -18
  67. package/src/components/auth/api-key/api-key.tsx +25 -16
  68. package/src/components/auth/api-key/api-keys-empty.tsx +8 -4
  69. package/src/components/auth/api-key/api-keys.tsx +52 -14
  70. package/src/components/auth/api-key/create-api-key-dialog.tsx +15 -2
  71. package/src/components/auth/api-key/delete-api-key-dialog.tsx +10 -2
  72. package/src/components/auth/api-key/organization-api-keys.tsx +55 -0
  73. package/src/components/auth/delete-user/danger-zone.tsx +3 -3
  74. package/src/components/auth/delete-user/{delete-user.tsx → delete-account.tsx} +9 -9
  75. package/src/components/auth/email/organization-invitation-email.tsx +38 -0
  76. package/src/components/auth/error-toaster.tsx +28 -10
  77. package/src/components/auth/forgot-password.tsx +10 -2
  78. package/src/components/auth/multi-session/manage-accounts.tsx +1 -1
  79. package/src/components/auth/multi-session/switch-account-submenu-content.tsx +7 -2
  80. package/src/components/auth/multi-session/switch-account-submenu-item.tsx +4 -2
  81. package/src/components/auth/multi-session/switch-account-submenu.tsx +8 -4
  82. package/src/components/auth/organization/change-organization-logo.tsx +171 -0
  83. package/src/components/auth/organization/create-organization-dialog.tsx +133 -0
  84. package/src/components/auth/organization/delete-organization-dialog.tsx +97 -0
  85. package/src/components/auth/organization/delete-organization-skeleton.tsx +17 -0
  86. package/src/components/auth/organization/delete-organization.tsx +77 -0
  87. package/src/components/auth/organization/invite-member-dialog.tsx +177 -0
  88. package/src/components/auth/organization/leave-organization-dialog.tsx +95 -0
  89. package/src/components/auth/organization/leave-organization.tsx +59 -0
  90. package/src/components/auth/organization/organization-danger-zone.tsx +68 -0
  91. package/src/components/auth/organization/organization-invitation-row-skeleton.tsx +29 -0
  92. package/src/components/auth/organization/organization-invitation-row.tsx +97 -0
  93. package/src/components/auth/organization/organization-invitations-empty.tsx +39 -0
  94. package/src/components/auth/organization/organization-invitations.tsx +351 -0
  95. package/src/components/auth/organization/organization-logo.tsx +64 -0
  96. package/src/components/auth/organization/organization-member-row-skeleton.tsx +24 -0
  97. package/src/components/auth/organization/organization-member-row.tsx +157 -0
  98. package/src/components/auth/organization/organization-members.tsx +284 -0
  99. package/src/components/auth/organization/organization-people.tsx +26 -0
  100. package/src/components/auth/organization/organization-profile.tsx +141 -0
  101. package/src/components/auth/organization/organization-row.tsx +66 -0
  102. package/src/components/auth/organization/organization-settings.tsx +38 -0
  103. package/src/components/auth/organization/organization-switcher.tsx +233 -0
  104. package/src/components/auth/organization/organization-view-skeleton.tsx +36 -0
  105. package/src/components/auth/organization/organization-view.tsx +109 -0
  106. package/src/components/auth/organization/organization.tsx +162 -0
  107. package/src/components/auth/organization/organizations-empty.tsx +35 -0
  108. package/src/components/auth/organization/organizations-settings.tsx +36 -0
  109. package/src/components/auth/organization/organizations.tsx +80 -0
  110. package/src/components/auth/organization/remove-member-dialog.tsx +95 -0
  111. package/src/components/auth/organization/slug-field.tsx +111 -0
  112. package/src/components/auth/organization/user-invitation-row-skeleton.tsx +17 -0
  113. package/src/components/auth/organization/user-invitation-row.tsx +90 -0
  114. package/src/components/auth/organization/user-invitations-empty.tsx +30 -0
  115. package/src/components/auth/organization/user-invitations.tsx +59 -0
  116. package/src/components/auth/settings/account/change-email.tsx +1 -1
  117. package/src/components/auth/settings/account/user-profile.tsx +5 -5
  118. package/src/components/auth/settings/security/active-sessions.tsx +6 -4
  119. package/src/components/auth/settings/security/linked-accounts.tsx +2 -2
  120. package/src/components/auth/settings/settings.tsx +77 -14
  121. package/src/components/auth/user/user-avatar.tsx +4 -1
  122. package/src/components/auth/user/user-button.tsx +14 -11
  123. package/src/components/auth/user/user-view.tsx +32 -12
  124. package/src/email.ts +1 -0
  125. package/src/lib/auth/api-key-plugin.ts +10 -4
  126. package/src/lib/auth/auth-plugin.ts +6 -1
  127. package/src/lib/auth/organization-plugin.tsx +32 -0
  128. package/src/plugins.ts +25 -1
  129. package/dist/components/auth/additional-field.js +0 -270
  130. package/dist/components/auth/api-key/api-key-skeleton.js +0 -21
  131. package/dist/components/auth/api-key/api-key.js +0 -55
  132. package/dist/components/auth/api-key/api-keys-empty.js +0 -35
  133. package/dist/components/auth/api-key/api-keys.js +0 -41
  134. package/dist/components/auth/api-key/create-api-key-dialog.js +0 -74
  135. package/dist/components/auth/api-key/delete-api-key-dialog.js +0 -51
  136. package/dist/components/auth/api-key/new-api-key-dialog.js +0 -60
  137. package/dist/components/auth/auth-provider.js +0 -17
  138. package/dist/components/auth/auth.js +0 -63
  139. package/dist/components/auth/delete-user/danger-zone.js +0 -18
  140. package/dist/components/auth/delete-user/delete-user.js +0 -95
  141. package/dist/components/auth/email/email-changed-email.js +0 -30
  142. package/dist/components/auth/email/email-verification-email.js +0 -30
  143. package/dist/components/auth/email/magic-link-email.js +0 -30
  144. package/dist/components/auth/email/new-device-email.js +0 -30
  145. package/dist/components/auth/email/otp-email.js +0 -29
  146. package/dist/components/auth/email/password-changed-email.js +0 -30
  147. package/dist/components/auth/email/reset-password-email.js +0 -30
  148. package/dist/components/auth/error-toaster.js +0 -17
  149. package/dist/components/auth/field-separator.js +0 -18
  150. package/dist/components/auth/forgot-password.js +0 -89
  151. package/dist/components/auth/magic-link/magic-link-button.js +0 -20
  152. package/dist/components/auth/magic-link/magic-link.js +0 -87
  153. package/dist/components/auth/multi-session/manage-account.js +0 -49
  154. package/dist/components/auth/multi-session/manage-accounts.js +0 -34
  155. package/dist/components/auth/multi-session/switch-account-submenu-content.js +0 -28
  156. package/dist/components/auth/multi-session/switch-account-submenu-item.js +0 -20
  157. package/dist/components/auth/multi-session/switch-account-submenu.js +0 -24
  158. package/dist/components/auth/passkey/add-passkey-dialog.js +0 -65
  159. package/dist/components/auth/passkey/delete-passkey-dialog.js +0 -47
  160. package/dist/components/auth/passkey/passkey-button.js +0 -24
  161. package/dist/components/auth/passkey/passkey-skeleton.js +0 -17
  162. package/dist/components/auth/passkey/passkey.js +0 -48
  163. package/dist/components/auth/passkey/passkeys-empty.js +0 -35
  164. package/dist/components/auth/passkey/passkeys.js +0 -42
  165. package/dist/components/auth/provider-button.js +0 -25
  166. package/dist/components/auth/provider-buttons.js +0 -19
  167. package/dist/components/auth/reset-password.js +0 -147
  168. package/dist/components/auth/settings/account/account-settings.js +0 -20
  169. package/dist/components/auth/settings/account/change-avatar.js +0 -89
  170. package/dist/components/auth/settings/account/change-email.js +0 -54
  171. package/dist/components/auth/settings/account/user-profile.js +0 -86
  172. package/dist/components/auth/settings/security/active-session.js +0 -59
  173. package/dist/components/auth/settings/security/active-sessions.js +0 -34
  174. package/dist/components/auth/settings/security/change-password.js +0 -189
  175. package/dist/components/auth/settings/security/linked-account.js +0 -56
  176. package/dist/components/auth/settings/security/linked-accounts.js +0 -45
  177. package/dist/components/auth/settings/security/security-settings.js +0 -22
  178. package/dist/components/auth/settings/settings.js +0 -45
  179. package/dist/components/auth/sign-in.js +0 -133
  180. package/dist/components/auth/sign-out.js +0 -27
  181. package/dist/components/auth/sign-up.js +0 -212
  182. package/dist/components/auth/theme/appearance.js +0 -72
  183. package/dist/components/auth/theme/theme-toggle-item.js +0 -62
  184. package/dist/components/auth/user/user-avatar.js +0 -29
  185. package/dist/components/auth/user/user-button.js +0 -74
  186. package/dist/components/auth/user/user-view.js +0 -37
  187. package/dist/components/auth/username/sign-in-username.js +0 -148
  188. package/dist/components/auth/username/username-field.js +0 -53
  189. package/dist/lib/auth/api-key-plugin.js +0 -10
  190. package/dist/lib/auth/delete-user-plugin.js +0 -10
  191. package/dist/lib/auth/magic-link-plugin.js +0 -13
  192. package/dist/lib/auth/multi-session-plugin.js +0 -12
  193. package/dist/lib/auth/passkey-plugin.js +0 -12
  194. package/dist/lib/auth/theme-plugin.js +0 -23
  195. package/dist/lib/auth/username-plugin.js +0 -18
@@ -1,189 +0,0 @@
1
- import { useAuth as e, useChangePassword as t, useListAccounts as n, useRequestPasswordReset as r, useSession as i } from "@better-auth-ui/react";
2
- import { Eye as a, EyeSlash as o } from "@gravity-ui/icons";
3
- import { Button as s, Card as c, FieldError as l, Fieldset as u, Form as d, Input as f, InputGroup as p, Label as m, Skeleton as h, Spinner as g, TextField as _, cn as v, toast as y } from "@heroui/react";
4
- import { useState as b } from "react";
5
- import { jsx as x, jsxs as S } from "react/jsx-runtime";
6
- //#region src/components/auth/settings/security/change-password.tsx
7
- function C({ className: t, variant: r, ...a }) {
8
- let { authClient: o, emailAndPassword: s, localization: c } = e(), { data: l } = i(o), { data: u, isPending: d } = n(o), f = u?.some((e) => e.providerId === "credential");
9
- return !d && !f ? /* @__PURE__ */ x(w, {
10
- className: t,
11
- variant: r,
12
- ...a
13
- }) : /* @__PURE__ */ x(T, {
14
- className: t,
15
- variant: r,
16
- emailAndPassword: s,
17
- localization: c,
18
- session: d ? void 0 : l,
19
- ...a
20
- });
21
- }
22
- function w({ className: t, variant: n, ...a }) {
23
- let { authClient: o, localization: l } = e(), { data: u } = i(o), { mutate: d, isPending: f } = r(o, { onSuccess: () => y.success(l.auth.passwordResetEmailSent) }), p = () => {
24
- u?.user.email && d({ email: u.user.email });
25
- };
26
- return /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("h2", {
27
- className: v("text-sm font-semibold mb-3"),
28
- children: l.settings.changePassword
29
- }), /* @__PURE__ */ x(c, {
30
- className: v(t),
31
- variant: n,
32
- ...a,
33
- children: /* @__PURE__ */ S(c.Content, {
34
- className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",
35
- children: [/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
36
- className: "text-sm font-medium leading-tight",
37
- children: l.settings.setPassword
38
- }), /* @__PURE__ */ x("p", {
39
- className: "text-muted text-xs mt-0.5",
40
- children: l.settings.setPasswordDescription
41
- })] }), /* @__PURE__ */ S(s, {
42
- size: "sm",
43
- isPending: f,
44
- isDisabled: !u,
45
- onPress: p,
46
- children: [f && /* @__PURE__ */ x(g, {
47
- color: "current",
48
- size: "sm"
49
- }), l.auth.sendResetLink]
50
- })]
51
- })
52
- })] });
53
- }
54
- function T({ className: n, variant: r, emailAndPassword: i, localization: C, session: w, ...T }) {
55
- let { authClient: E } = e(), [D, O] = b(""), [k, A] = b(""), [j, M] = b(""), { mutate: N, isPending: P } = t(E, {
56
- onError: (e) => {
57
- O(""), A(""), M(""), y.danger(e.error?.message || e.message);
58
- },
59
- onSuccess: () => {
60
- O(""), A(""), M(""), y.success(C.settings.changePasswordSuccess);
61
- }
62
- }), [F, I] = b(!1), [L, R] = b(!1), z = (e) => {
63
- if (e.preventDefault(), i?.confirmPassword && k !== j) {
64
- O(""), A(""), M(""), y.danger(C.auth.passwordsDoNotMatch);
65
- return;
66
- }
67
- N({
68
- currentPassword: D,
69
- newPassword: k,
70
- revokeOtherSessions: !0
71
- });
72
- };
73
- return /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("h2", {
74
- className: v("text-sm font-semibold mb-3"),
75
- children: C.settings.changePassword
76
- }), /* @__PURE__ */ x(c, {
77
- className: v("p-4 gap-4", n),
78
- variant: r,
79
- ...T,
80
- children: /* @__PURE__ */ x(c.Content, { children: /* @__PURE__ */ x(d, {
81
- onSubmit: z,
82
- children: /* @__PURE__ */ S(u, {
83
- className: "w-full gap-4",
84
- children: [/* @__PURE__ */ S(u.Group, { children: [
85
- /* @__PURE__ */ S(_, {
86
- name: "currentPassword",
87
- type: "password",
88
- isDisabled: P || !w,
89
- defaultValue: "",
90
- value: D,
91
- onChange: O,
92
- children: [
93
- /* @__PURE__ */ x(m, { children: C.settings.currentPassword }),
94
- /* @__PURE__ */ x(f, {
95
- className: v(!w && "hidden"),
96
- autoComplete: "current-password",
97
- placeholder: C.settings.currentPasswordPlaceholder,
98
- required: !0,
99
- variant: r === "transparent" ? "primary" : "secondary"
100
- }),
101
- !w && /* @__PURE__ */ x(h, { className: "h-10 md:h-9 w-full rounded-xl" }),
102
- /* @__PURE__ */ x(l, {})
103
- ]
104
- }),
105
- /* @__PURE__ */ S(_, {
106
- minLength: i?.minPasswordLength,
107
- maxLength: i?.maxPasswordLength,
108
- isDisabled: P || !w,
109
- value: k,
110
- onChange: A,
111
- children: [
112
- /* @__PURE__ */ x(m, { children: C.auth.newPassword }),
113
- /* @__PURE__ */ S(p, {
114
- className: v(!w && "hidden"),
115
- variant: r === "transparent" ? "primary" : "secondary",
116
- children: [/* @__PURE__ */ x(p.Input, {
117
- name: "newPassword",
118
- type: F ? "text" : "password",
119
- autoComplete: "new-password",
120
- placeholder: C.auth.newPasswordPlaceholder,
121
- required: !0
122
- }), /* @__PURE__ */ x(p.Suffix, {
123
- className: "px-0",
124
- children: /* @__PURE__ */ x(s, {
125
- isIconOnly: !0,
126
- "aria-label": F ? C.auth.hidePassword : C.auth.showPassword,
127
- size: "sm",
128
- variant: "ghost",
129
- onPress: () => I(!F),
130
- isDisabled: P,
131
- children: x(F ? o : a, {})
132
- })
133
- })]
134
- }),
135
- !w && /* @__PURE__ */ x(h, { className: "h-10 md:h-9 w-full rounded-xl" }),
136
- /* @__PURE__ */ x(l, {})
137
- ]
138
- }),
139
- i?.confirmPassword && /* @__PURE__ */ S(_, {
140
- minLength: i?.minPasswordLength,
141
- maxLength: i?.maxPasswordLength,
142
- isDisabled: P || !w,
143
- isRequired: !0,
144
- value: j,
145
- onChange: M,
146
- children: [
147
- /* @__PURE__ */ x(m, { children: C.auth.confirmPassword }),
148
- /* @__PURE__ */ S(p, {
149
- className: v(!w && "hidden"),
150
- variant: r === "transparent" ? "primary" : "secondary",
151
- children: [/* @__PURE__ */ x(p.Input, {
152
- name: "confirmPassword",
153
- type: L ? "text" : "password",
154
- autoComplete: "new-password",
155
- placeholder: C.auth.confirmPasswordPlaceholder,
156
- required: !0
157
- }), /* @__PURE__ */ x(p.Suffix, {
158
- className: "px-0",
159
- children: /* @__PURE__ */ x(s, {
160
- isIconOnly: !0,
161
- "aria-label": L ? C.auth.hidePassword : C.auth.showPassword,
162
- size: "sm",
163
- variant: "ghost",
164
- onPress: () => R(!L),
165
- isDisabled: P,
166
- children: x(L ? o : a, {})
167
- })
168
- })]
169
- }),
170
- !w && /* @__PURE__ */ x(h, { className: "h-10 md:h-9 w-full rounded-xl" }),
171
- /* @__PURE__ */ x(l, {})
172
- ]
173
- })
174
- ] }), /* @__PURE__ */ x(u.Actions, { children: /* @__PURE__ */ S(s, {
175
- type: "submit",
176
- isPending: P,
177
- isDisabled: !w,
178
- size: "sm",
179
- children: [P && /* @__PURE__ */ x(g, {
180
- color: "current",
181
- size: "sm"
182
- }), C.settings.updatePassword]
183
- }) })]
184
- })
185
- }) })
186
- })] });
187
- }
188
- //#endregion
189
- export { C as ChangePassword };
@@ -1,56 +0,0 @@
1
- import { getProviderName as e } from "@better-auth-ui/core";
2
- import { providerIcons as t, useAccountInfo as n, useAuth as r, useLinkSocial as i, useUnlinkAccount as a } from "@better-auth-ui/react";
3
- import { Link as o, LinkSlash as s, PlugConnection as c } from "@gravity-ui/icons";
4
- import { Button as l, Skeleton as u, Spinner as d, cn as f, toast as p } from "@heroui/react";
5
- import { jsx as m, jsxs as h } from "react/jsx-runtime";
6
- //#region src/components/auth/settings/security/linked-account.tsx
7
- function g({ account: g, provider: _ }) {
8
- let { authClient: v, baseURL: y, localization: b } = r(), { data: x, isPending: S } = n(v, { query: { accountId: g?.accountId } }), { mutate: C, isPending: w } = i(v), { mutate: T, isPending: E } = a(v, { onSuccess: () => p.success(b.settings.accountUnlinked) }), D = t[_], O = e(_), k = x?.data?.login || x?.data?.username || x?.user?.email || x?.user?.name || g?.accountId;
9
- return /* @__PURE__ */ h("div", {
10
- className: "flex items-center gap-3",
11
- children: [
12
- /* @__PURE__ */ m("div", {
13
- className: f("flex size-10 shrink-0 items-center justify-center rounded-xl bg-surface-secondary"),
14
- children: m(D || c, { className: "size-4.5" })
15
- }),
16
- /* @__PURE__ */ h("div", {
17
- className: "flex flex-col min-w-0",
18
- children: [/* @__PURE__ */ m("span", {
19
- className: "text-sm font-medium leading-tight",
20
- children: O
21
- }), g && S ? /* @__PURE__ */ m(u, { className: "h-3 w-24 my-0.5 rounded-lg" }) : /* @__PURE__ */ m("span", {
22
- className: "text-xs text-muted truncate",
23
- children: g ? k : b.settings.linkProvider.replace("{{provider}}", O)
24
- })]
25
- }),
26
- g ? /* @__PURE__ */ h(l, {
27
- className: "ml-auto shrink-0",
28
- variant: "outline",
29
- size: "sm",
30
- onPress: () => T({ providerId: g.providerId }),
31
- isPending: E,
32
- "aria-label": b.settings.unlinkProvider.replace("{{provider}}", O),
33
- children: [E ? /* @__PURE__ */ m(d, {
34
- color: "current",
35
- size: "sm"
36
- }) : /* @__PURE__ */ m(s, {}), b.settings.unlinkProvider.replace("{{provider}}", "").trim()]
37
- }) : /* @__PURE__ */ h(l, {
38
- className: "ml-auto shrink-0",
39
- variant: "outline",
40
- size: "sm",
41
- onPress: () => C({
42
- provider: _,
43
- callbackURL: `${y}${window.location.pathname}`
44
- }),
45
- isPending: w,
46
- "aria-label": b.settings.linkProvider.replace("{{provider}}", O),
47
- children: [w ? /* @__PURE__ */ m(d, {
48
- color: "current",
49
- size: "sm"
50
- }) : /* @__PURE__ */ m(o, {}), b.settings.link]
51
- })
52
- ]
53
- });
54
- }
55
- //#endregion
56
- export { g as LinkedAccount };
@@ -1,45 +0,0 @@
1
- import { LinkedAccount as e } from "./linked-account.js";
2
- import { useAuth as t, useListAccounts as n } from "@better-auth-ui/react";
3
- import { Card as r, Skeleton as i, cn as a } from "@heroui/react";
4
- import { jsx as o, jsxs as s } from "react/jsx-runtime";
5
- //#region src/components/auth/settings/security/linked-accounts.tsx
6
- function c({ className: i, variant: c, ...u }) {
7
- let { authClient: d, localization: f, socialProviders: p } = t(), { data: m, isPending: h } = n(d), g = [...(m?.filter((e) => e.providerId !== "credential"))?.map((e) => ({
8
- key: e.id,
9
- account: e,
10
- provider: e.providerId
11
- })) ?? [], ...p?.map((e) => ({
12
- key: e,
13
- account: void 0,
14
- provider: e
15
- })) ?? []];
16
- return /* @__PURE__ */ s("div", { children: [/* @__PURE__ */ o("h2", {
17
- className: a("text-sm font-semibold mb-3"),
18
- children: f.settings.linkedAccounts
19
- }), /* @__PURE__ */ o(r, {
20
- className: a(i),
21
- variant: c,
22
- ...u,
23
- children: /* @__PURE__ */ o(r.Content, {
24
- className: "gap-0",
25
- children: h ? p?.map((e, t) => /* @__PURE__ */ s("div", { children: [t > 0 && /* @__PURE__ */ o("div", { className: "border-b border-dashed -mx-4 md:-mx-6 my-4" }), /* @__PURE__ */ o(l, {})] }, e)) : g.map((t, n) => /* @__PURE__ */ s("div", { children: [n > 0 && /* @__PURE__ */ o("div", { className: "border-b border-dashed -mx-4 md:-mx-6 my-4" }), /* @__PURE__ */ o(e, {
26
- account: t.account,
27
- provider: t.provider
28
- })] }, t.key))
29
- })
30
- })] });
31
- }
32
- function l() {
33
- return /* @__PURE__ */ o("div", {
34
- className: "flex items-center justify-between",
35
- children: /* @__PURE__ */ s("div", {
36
- className: "flex items-center gap-3",
37
- children: [/* @__PURE__ */ o(i, { className: "size-10 rounded-xl" }), /* @__PURE__ */ s("div", {
38
- className: "flex flex-col gap-1",
39
- children: [/* @__PURE__ */ o(i, { className: "h-4 w-20 rounded-lg" }), /* @__PURE__ */ o(i, { className: "h-3 w-32 rounded-lg" })]
40
- })]
41
- })
42
- });
43
- }
44
- //#endregion
45
- export { c as LinkedAccounts };
@@ -1,22 +0,0 @@
1
- import { ActiveSessions as e } from "./active-sessions.js";
2
- import { ChangePassword as t } from "./change-password.js";
3
- import { LinkedAccounts as n } from "./linked-accounts.js";
4
- import { useAuth as r } from "@better-auth-ui/react";
5
- import { cn as i } from "@heroui/react";
6
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
7
- //#region src/components/auth/settings/security/security-settings.tsx
8
- function s({ className: s, variant: c, ...l }) {
9
- let { emailAndPassword: u, plugins: d, socialProviders: f } = r();
10
- return /* @__PURE__ */ o("div", {
11
- className: i("flex w-full flex-col gap-4 md:gap-6", s),
12
- ...l,
13
- children: [
14
- u?.enabled && /* @__PURE__ */ a(t, { variant: c }),
15
- !!f?.length && /* @__PURE__ */ a(n, { variant: c }),
16
- /* @__PURE__ */ a(e, { variant: c }),
17
- d.flatMap((e) => e.securityCards?.map((t, n) => /* @__PURE__ */ a(t, { variant: c }, `${e.id}-${n.toString()}`)))
18
- ]
19
- });
20
- }
21
- //#endregion
22
- export { s as SecuritySettings };
@@ -1,45 +0,0 @@
1
- import { AccountSettings as e } from "./account/account-settings.js";
2
- import { SecuritySettings as t } from "./security/security-settings.js";
3
- import { useAuth as n, useAuthenticate as r } from "@better-auth-ui/react";
4
- import { Tabs as i, cn as a } from "@heroui/react";
5
- import { useMemo as o } from "react";
6
- import { jsx as s, jsxs as c } from "react/jsx-runtime";
7
- //#region src/components/auth/settings/settings.tsx
8
- function l({ className: l, hideNav: u, path: d, variant: f, view: p, ...m }) {
9
- let { authClient: h, basePaths: g, localization: _, viewPaths: v } = n();
10
- if (r(h), !p && !d) throw Error("[Better Auth UI] Either `view` or `path` must be provided");
11
- let y = o(() => Object.fromEntries(Object.entries(v.settings).map(([e, t]) => [t, e])), [v.settings]), b = p || (d ? y[d] : void 0);
12
- return /* @__PURE__ */ c(i, {
13
- className: a(l),
14
- orientation: "horizontal",
15
- selectedKey: b,
16
- ...m,
17
- children: [
18
- /* @__PURE__ */ s(i.ListContainer, { children: /* @__PURE__ */ c(i.List, {
19
- "aria-label": _.settings.settings,
20
- className: "overflow-auto w-fit",
21
- children: [/* @__PURE__ */ c(i.Tab, {
22
- id: "account",
23
- href: `${g.settings}/${v.settings.account}`,
24
- children: [_.settings.account, /* @__PURE__ */ s(i.Indicator, {})]
25
- }), /* @__PURE__ */ c(i.Tab, {
26
- id: "security",
27
- href: `${g.settings}/${v.settings.security}`,
28
- children: [_.settings.security, /* @__PURE__ */ s(i.Indicator, {})]
29
- })]
30
- }) }),
31
- /* @__PURE__ */ s(i.Panel, {
32
- id: "account",
33
- className: "px-0",
34
- children: /* @__PURE__ */ s(e, { variant: f })
35
- }),
36
- /* @__PURE__ */ s(i.Panel, {
37
- id: "security",
38
- className: "px-0",
39
- children: /* @__PURE__ */ s(t, { variant: f })
40
- })
41
- ]
42
- });
43
- }
44
- //#endregion
45
- export { l as Settings };
@@ -1,133 +0,0 @@
1
- import { FieldSeparator as e } from "./field-separator.js";
2
- import { ProviderButtons as t } from "./provider-buttons.js";
3
- import { authMutationKeys as n } from "@better-auth-ui/core";
4
- import { useAuth as r, useFetchOptions as i, useSendVerificationEmail as a, useSignInEmail as o } from "@better-auth-ui/react";
5
- import { Button as s, Card as c, Checkbox as l, Description as u, FieldError as d, Form as f, Input as p, Label as m, Link as h, Spinner as g, TextField as _, cn as v, toast as y } from "@heroui/react";
6
- import { useState as b } from "react";
7
- import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
8
- import { useIsMutating as w } from "@tanstack/react-query";
9
- //#region src/components/auth/sign-in.tsx
10
- function T({ className: T, socialLayout: E, socialPosition: D = "bottom", variant: O, ...k }) {
11
- let { authClient: A, basePaths: j, baseURL: M, emailAndPassword: N, localization: P, plugins: F, redirectTo: I, socialProviders: L, viewPaths: R, navigate: z } = r(), { fetchOptions: B, resetFetchOptions: V } = i(), [H, U] = b(""), { mutate: W } = a(A, { onSuccess: () => y.success(P.auth.verificationEmailSent) }), { mutate: G, isPending: K } = o(A, {
12
- onError: (e, { email: t }) => {
13
- U(""), e.error?.code === "EMAIL_NOT_VERIFIED" ? y.danger(e.error?.message || e.message, { actionProps: {
14
- children: P.auth.resend,
15
- onClick: () => W({
16
- email: t,
17
- callbackURL: `${M}${I}`
18
- })
19
- } }) : y.danger(e.error?.message || e.message), V();
20
- },
21
- onSuccess: () => z({ to: I })
22
- }), q = (e) => {
23
- e.preventDefault();
24
- let t = new FormData(e.currentTarget), n = t.get("email"), r = t.get("rememberMe") === "on";
25
- G({
26
- email: n,
27
- password: H,
28
- ...N?.rememberMe ? { rememberMe: r } : {},
29
- fetchOptions: B
30
- });
31
- }, J = w({ mutationKey: n.signIn.all }) + w({ mutationKey: n.signUp.all }) > 0, Y = F.find((e) => e.captchaComponent)?.captchaComponent, X = N?.enabled && !!L?.length;
32
- return /* @__PURE__ */ C(c, {
33
- className: v("w-full max-w-sm gap-4 md:p-6", T),
34
- variant: O,
35
- ...k,
36
- children: [
37
- /* @__PURE__ */ S(c.Header, { children: /* @__PURE__ */ S(c.Title, {
38
- className: "text-xl font-semibold mb-1",
39
- children: P.auth.signIn
40
- }) }),
41
- /* @__PURE__ */ C(c.Content, {
42
- className: "gap-4",
43
- children: [
44
- D === "top" && /* @__PURE__ */ C(x, { children: [!!L?.length && /* @__PURE__ */ S(t, { socialLayout: E }), X && /* @__PURE__ */ S(e, { children: P.auth.or })] }),
45
- N?.enabled && /* @__PURE__ */ C(f, {
46
- onSubmit: q,
47
- className: "flex flex-col gap-4",
48
- children: [
49
- /* @__PURE__ */ C(_, {
50
- name: "email",
51
- type: "email",
52
- autoComplete: "email",
53
- isDisabled: J,
54
- children: [
55
- /* @__PURE__ */ S(m, { children: P.auth.email }),
56
- /* @__PURE__ */ S(p, {
57
- placeholder: P.auth.emailPlaceholder,
58
- variant: O === "transparent" ? "primary" : "secondary",
59
- required: !0
60
- }),
61
- /* @__PURE__ */ S(d, {})
62
- ]
63
- }),
64
- /* @__PURE__ */ C(_, {
65
- minLength: N?.minPasswordLength,
66
- maxLength: N?.maxPasswordLength,
67
- name: "password",
68
- type: "password",
69
- autoComplete: "current-password",
70
- isDisabled: J,
71
- value: H,
72
- onChange: U,
73
- children: [
74
- /* @__PURE__ */ S(m, { children: P.auth.password }),
75
- /* @__PURE__ */ S(p, {
76
- placeholder: P.auth.passwordPlaceholder,
77
- variant: O === "transparent" ? "primary" : "secondary",
78
- required: !0
79
- }),
80
- /* @__PURE__ */ S(d, {})
81
- ]
82
- }),
83
- N?.rememberMe && /* @__PURE__ */ C(l, {
84
- name: "rememberMe",
85
- isDisabled: J,
86
- variant: O === "transparent" ? "primary" : "secondary",
87
- children: [/* @__PURE__ */ S(l.Control, { children: /* @__PURE__ */ S(l.Indicator, {}) }), /* @__PURE__ */ S(l.Content, { children: /* @__PURE__ */ S(m, { children: P.auth.rememberMe }) })]
88
- }),
89
- Y && /* @__PURE__ */ S("div", {
90
- className: "flex justify-center",
91
- children: Y
92
- }),
93
- /* @__PURE__ */ C("div", {
94
- className: "flex flex-col gap-3",
95
- children: [/* @__PURE__ */ C(s, {
96
- type: "submit",
97
- className: "w-full",
98
- isPending: J,
99
- children: [K && /* @__PURE__ */ S(g, {
100
- color: "current",
101
- size: "sm"
102
- }), P.auth.signIn]
103
- }), F.flatMap((e) => e.authButtons?.map((t, n) => /* @__PURE__ */ S(t, { view: "signIn" }, `${e.id}-${n.toString()}`)))]
104
- })
105
- ]
106
- }),
107
- D === "bottom" && /* @__PURE__ */ C(x, { children: [X && /* @__PURE__ */ S(e, { children: P.auth.or }), !!L?.length && /* @__PURE__ */ S(t, { socialLayout: E })] })
108
- ]
109
- }),
110
- /* @__PURE__ */ C(c.Footer, {
111
- className: "flex-col gap-3",
112
- children: [N?.forgotPassword && /* @__PURE__ */ S(h, {
113
- href: `${j.auth}/${R.auth.forgotPassword}`,
114
- className: "no-underline hover:underline",
115
- children: P.auth.forgotPasswordLink
116
- }), N?.enabled && /* @__PURE__ */ C(u, {
117
- className: "text-sm",
118
- children: [
119
- P.auth.needToCreateAnAccount,
120
- " ",
121
- /* @__PURE__ */ S(h, {
122
- href: `${j.auth}/${R.auth.signUp}`,
123
- className: "text-accent no-underline hover:underline decoration-accent-hover",
124
- children: P.auth.signUp
125
- })
126
- ]
127
- })]
128
- })
129
- ]
130
- });
131
- }
132
- //#endregion
133
- export { T as SignIn };
@@ -1,27 +0,0 @@
1
- import { useAuth as e, useSignOut as t } from "@better-auth-ui/react";
2
- import { Spinner as n, cn as r, toast as i } from "@heroui/react";
3
- import { useEffect as a, useRef as o } from "react";
4
- import { jsx as s } from "react/jsx-runtime";
5
- //#region src/components/auth/sign-out.tsx
6
- function c({ className: c }) {
7
- let { authClient: l, basePaths: u, navigate: d, viewPaths: f } = e(), { mutate: p } = t(l, {
8
- onError: (e) => {
9
- i.danger(e.error?.message || e.message), d({
10
- to: `${u.auth}/${f.auth.signIn}`,
11
- replace: !0
12
- });
13
- },
14
- onSuccess: () => d({
15
- to: `${u.auth}/${f.auth.signIn}`,
16
- replace: !0
17
- })
18
- }), m = o(!1);
19
- return a(() => {
20
- m.current || (m.current = !0, p());
21
- }, [p]), /* @__PURE__ */ s(n, {
22
- className: r("mx-auto my-auto", c),
23
- color: "current"
24
- });
25
- }
26
- //#endregion
27
- export { c as SignOut };