@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,42 +0,0 @@
1
- import { passkeyPlugin as e } from "../../../lib/auth/passkey-plugin.js";
2
- import { AddPasskeyDialog as t } from "./add-passkey-dialog.js";
3
- import { Passkey as n } from "./passkey.js";
4
- import { PasskeySkeleton as r } from "./passkey-skeleton.js";
5
- import { PasskeysEmpty as i } from "./passkeys-empty.js";
6
- import { useAuth as a, useAuthPlugin as o, useListPasskeys as s } from "@better-auth-ui/react";
7
- import { Button as c, Card as l, cn as u } from "@heroui/react";
8
- import { useState as d } from "react";
9
- import { jsx as f, jsxs as p } from "react/jsx-runtime";
10
- //#region src/components/auth/passkey/passkeys.tsx
11
- function m({ className: m, variant: h, ...g }) {
12
- let { authClient: _ } = a(), { localization: v } = o(e), { data: y, isPending: b } = s(_), [x, S] = d(!1);
13
- return /* @__PURE__ */ p("div", {
14
- className: u("flex flex-col gap-3", m),
15
- children: [
16
- /* @__PURE__ */ p("div", {
17
- className: "flex items-end justify-between gap-3",
18
- children: [/* @__PURE__ */ f("h2", {
19
- className: "text-sm font-semibold truncate",
20
- children: v.passkeys
21
- }), /* @__PURE__ */ f(c, {
22
- className: "shrink-0",
23
- size: "sm",
24
- isDisabled: b,
25
- onPress: () => S(!0),
26
- children: v.addPasskey
27
- })]
28
- }),
29
- /* @__PURE__ */ f(l, {
30
- variant: h,
31
- ...g,
32
- children: /* @__PURE__ */ f(l.Content, { children: b ? /* @__PURE__ */ f(r, {}) : y?.length ? y.map((e, t) => /* @__PURE__ */ p("div", { children: [t > 0 && /* @__PURE__ */ f("div", { className: "border-b border-dashed -mx-4 my-4" }), /* @__PURE__ */ f(n, { passkey: e })] }, e.id)) : /* @__PURE__ */ f(i, { onAddPress: () => S(!0) }) })
33
- }),
34
- /* @__PURE__ */ f(t, {
35
- isOpen: x,
36
- onOpenChange: S
37
- })
38
- ]
39
- });
40
- }
41
- //#endregion
42
- export { m as Passkeys };
@@ -1,25 +0,0 @@
1
- import { authMutationKeys as e, getProviderName as t } from "@better-auth-ui/core";
2
- import { providerIcons as n, useAuth as r, useSignInSocial as i } from "@better-auth-ui/react";
3
- import { Button as a, Spinner as o } from "@heroui/react";
4
- import { jsx as s, jsxs as c } from "react/jsx-runtime";
5
- import { useIsMutating as l } from "@tanstack/react-query";
6
- //#region src/components/auth/provider-button.tsx
7
- function u({ provider: u, display: d = "full", variant: f = "tertiary", ...p }) {
8
- let { authClient: m, baseURL: h, localization: g, redirectTo: _ } = r(), v = `${h}${_}`, { mutate: y, isPending: b } = i(m), x = n[u];
9
- return /* @__PURE__ */ c(a, {
10
- variant: f,
11
- isPending: l({ mutationKey: e.signIn.all }) + l({ mutationKey: e.signUp.all }) > 0,
12
- onPress: () => y({
13
- provider: u,
14
- callbackURL: v
15
- }),
16
- ...p,
17
- "aria-label": t(u),
18
- children: [b ? /* @__PURE__ */ s(o, {
19
- color: "current",
20
- size: "sm"
21
- }) : /* @__PURE__ */ s(x, {}), d === "full" ? g.auth.continueWith.replace("{{provider}}", t(u)) : d === "name" ? t(u) : null]
22
- });
23
- }
24
- //#endregion
25
- export { u as ProviderButton };
@@ -1,19 +0,0 @@
1
- import { ProviderButton as e } from "./provider-button.js";
2
- import { useAuth as t } from "@better-auth-ui/react";
3
- import { cn as n } from "@heroui/react";
4
- import { useMemo as r } from "react";
5
- import { jsx as i } from "react/jsx-runtime";
6
- //#region src/components/auth/provider-buttons.tsx
7
- function a({ socialLayout: a = "auto" }) {
8
- let { socialProviders: o } = t(), s = r(() => a === "auto" ? o?.length && o.length >= 4 ? "horizontal" : "vertical" : a, [a, o?.length]);
9
- return /* @__PURE__ */ i("div", {
10
- className: n("gap-3", s === "grid" && "grid grid-cols-2", s === "vertical" && "flex flex-col", s === "horizontal" && "flex flex-wrap"),
11
- children: o?.map((t) => /* @__PURE__ */ i(e, {
12
- provider: t,
13
- display: s === "vertical" ? "full" : s === "grid" ? "name" : "icon",
14
- className: n("w-full", s === "horizontal" && "flex-1")
15
- }, t))
16
- });
17
- }
18
- //#endregion
19
- export { a as ProviderButtons };
@@ -1,147 +0,0 @@
1
- import { useAuth as e, useResetPassword as t } from "@better-auth-ui/react";
2
- import { Eye as n, EyeSlash as r } from "@gravity-ui/icons";
3
- import { Button as i, Card as a, Description as o, FieldError as s, Form as c, InputGroup as l, Label as u, Link as d, Spinner as f, TextField as p, cn as m, toast as h } from "@heroui/react";
4
- import { useEffect as g, useState as _ } from "react";
5
- import { jsx as v, jsxs as y } from "react/jsx-runtime";
6
- //#region src/components/auth/reset-password.tsx
7
- function b({ className: b, variant: x, ...S }) {
8
- let { authClient: C, basePaths: w, emailAndPassword: T, localization: E, viewPaths: D, navigate: O } = e(), { mutate: k, isPending: A } = t(C, { onSuccess: () => {
9
- h.success(E.auth.passwordResetSuccess), O({ to: `${w.auth}/${D.auth.signIn}` });
10
- } }), [j, M] = _(!1), [N, P] = _(!1);
11
- g(() => {
12
- new URLSearchParams(window.location.search).get("token") || (h.danger(E.auth.invalidResetPasswordToken), O({ to: `${w.auth}/${D.auth.signIn}` }));
13
- }, [
14
- w.auth,
15
- E.auth.invalidResetPasswordToken,
16
- D.auth.signIn,
17
- O
18
- ]);
19
- function F(e) {
20
- e.preventDefault();
21
- let t = new URLSearchParams(window.location.search).get("token");
22
- if (!t) {
23
- h.danger(E.auth.invalidResetPasswordToken), O({ to: `${w.auth}/${D.auth.signIn}` });
24
- return;
25
- }
26
- let n = new FormData(e.currentTarget), r = n.get("password"), i = n.get("confirmPassword");
27
- if (T?.confirmPassword && r !== i) {
28
- h.danger(E.auth.passwordsDoNotMatch);
29
- return;
30
- }
31
- k({
32
- token: t,
33
- newPassword: r
34
- });
35
- }
36
- return /* @__PURE__ */ y(a, {
37
- className: m("w-full max-w-sm gap-4 md:p-6", b),
38
- variant: x,
39
- ...S,
40
- children: [
41
- /* @__PURE__ */ v(a.Header, { children: /* @__PURE__ */ v(a.Title, {
42
- className: "text-xl font-semibold mb-1",
43
- children: E.auth.resetPassword
44
- }) }),
45
- /* @__PURE__ */ v(a.Content, {
46
- className: "gap-4",
47
- children: /* @__PURE__ */ y(c, {
48
- onSubmit: F,
49
- className: "flex flex-col gap-4",
50
- children: [
51
- /* @__PURE__ */ y(p, {
52
- minLength: T?.minPasswordLength,
53
- maxLength: T?.maxPasswordLength,
54
- name: "password",
55
- autoComplete: "new-password",
56
- isDisabled: A,
57
- children: [
58
- /* @__PURE__ */ v(u, { children: E.auth.password }),
59
- /* @__PURE__ */ y(l, {
60
- variant: x === "transparent" ? "primary" : "secondary",
61
- children: [/* @__PURE__ */ v(l.Input, {
62
- name: "password",
63
- placeholder: E.auth.newPasswordPlaceholder,
64
- type: j ? "text" : "password",
65
- required: !0
66
- }), /* @__PURE__ */ v(l.Suffix, {
67
- className: "px-0",
68
- children: /* @__PURE__ */ v(i, {
69
- isIconOnly: !0,
70
- "aria-label": j ? E.auth.hidePassword : E.auth.showPassword,
71
- size: "sm",
72
- variant: "ghost",
73
- onPress: () => M(!j),
74
- isDisabled: A,
75
- children: v(j ? r : n, {})
76
- })
77
- })]
78
- }),
79
- /* @__PURE__ */ v(s, {})
80
- ]
81
- }),
82
- T?.confirmPassword && /* @__PURE__ */ y(p, {
83
- minLength: T?.minPasswordLength,
84
- maxLength: T?.maxPasswordLength,
85
- name: "confirmPassword",
86
- autoComplete: "new-password",
87
- isDisabled: A,
88
- children: [
89
- /* @__PURE__ */ v(u, { children: E.auth.confirmPassword }),
90
- /* @__PURE__ */ y(l, {
91
- variant: x === "transparent" ? "primary" : "secondary",
92
- children: [/* @__PURE__ */ v(l.Input, {
93
- placeholder: E.auth.confirmPasswordPlaceholder,
94
- type: N ? "text" : "password",
95
- required: !0,
96
- name: "confirmPassword"
97
- }), /* @__PURE__ */ v(l.Suffix, {
98
- className: "px-0",
99
- children: /* @__PURE__ */ v(i, {
100
- isIconOnly: !0,
101
- "aria-label": N ? E.auth.hidePassword : E.auth.showPassword,
102
- size: "sm",
103
- variant: "ghost",
104
- onPress: () => P(!N),
105
- isDisabled: A,
106
- children: v(N ? r : n, {})
107
- })
108
- })]
109
- }),
110
- /* @__PURE__ */ v(s, {})
111
- ]
112
- }),
113
- /* @__PURE__ */ v("div", {
114
- className: "flex flex-col gap-3",
115
- children: /* @__PURE__ */ y(i, {
116
- type: "submit",
117
- className: "w-full",
118
- isPending: A,
119
- children: [A && /* @__PURE__ */ v(f, {
120
- color: "current",
121
- size: "sm"
122
- }), E.auth.resetPassword]
123
- })
124
- })
125
- ]
126
- })
127
- }),
128
- /* @__PURE__ */ v(a.Footer, {
129
- className: "flex-col gap-3",
130
- children: /* @__PURE__ */ y(o, {
131
- className: "text-sm",
132
- children: [
133
- E.auth.rememberYourPassword,
134
- " ",
135
- /* @__PURE__ */ v(d, {
136
- href: `${w.auth}/${D.auth.signIn}`,
137
- className: "text-accent no-underline hover:underline decoration-accent-hover",
138
- children: E.auth.signIn
139
- })
140
- ]
141
- })
142
- })
143
- ]
144
- });
145
- }
146
- //#endregion
147
- export { b as ResetPassword };
@@ -1,20 +0,0 @@
1
- import { ChangeEmail as e } from "./change-email.js";
2
- import { UserProfile as t } from "./user-profile.js";
3
- import { useAuth as n } from "@better-auth-ui/react";
4
- import { cn as r } from "@heroui/react";
5
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
- //#region src/components/auth/settings/account/account-settings.tsx
7
- function o({ className: o, variant: s, ...c }) {
8
- let { emailAndPassword: l, plugins: u } = n(), d = u.some((e) => e.id === "magicLink");
9
- return /* @__PURE__ */ a("div", {
10
- className: r("flex w-full flex-col gap-4 md:gap-6", o),
11
- ...c,
12
- children: [
13
- /* @__PURE__ */ i(t, { variant: s }),
14
- (l?.enabled || d) && /* @__PURE__ */ i(e, { variant: s }),
15
- u.flatMap((e) => e.accountCards?.map((t, n) => /* @__PURE__ */ i(t, { variant: s }, `${e.id}-${n.toString()}`)))
16
- ]
17
- });
18
- }
19
- //#endregion
20
- export { o as AccountSettings };
@@ -1,89 +0,0 @@
1
- import { UserAvatar as e } from "../../user/user-avatar.js";
2
- import { fileToBase64 as t } from "@better-auth-ui/core";
3
- import { useAuth as n, useSession as r, useUpdateUser as i } from "@better-auth-ui/react";
4
- import { CloudArrowUpIn as a, TrashBin as o } from "@gravity-ui/icons";
5
- import { Button as s, Dropdown as c, Label as l, Spinner as u, cn as d, toast as f } from "@heroui/react";
6
- import { useRef as p, useState as m } from "react";
7
- import { jsx as h, jsxs as g } from "react/jsx-runtime";
8
- //#region src/components/auth/settings/account/change-avatar.tsx
9
- function _({ className: _ }) {
10
- let { authClient: v, localization: y, avatar: b } = n(), { data: x } = r(v), { mutate: S, isPending: C } = i(v), w = p(null), [T, E] = m(!1), [D, O] = m(!1), k = C || T || D;
11
- async function A(e) {
12
- let n = e.target.files?.[0];
13
- if (n) {
14
- e.target.value = "", E(!0);
15
- try {
16
- let e = await b.resize?.(n, b.size, b.extension) || n;
17
- S({ image: await b.upload?.(e) || await t(e) }, { onSuccess: () => f.success(y.settings.avatarChangedSuccess) });
18
- } catch (e) {
19
- e instanceof Error && f.danger(e.message);
20
- }
21
- E(!1);
22
- }
23
- }
24
- async function j() {
25
- let e = x?.user.image;
26
- S({ image: null }, { onSuccess: async () => {
27
- if (e) {
28
- O(!0);
29
- try {
30
- await b.delete?.(e);
31
- } finally {
32
- O(!1);
33
- }
34
- }
35
- f.success(y.settings.avatarDeletedSuccess);
36
- } });
37
- }
38
- return /* @__PURE__ */ g("div", {
39
- className: d("flex flex-col gap-1", _),
40
- children: [
41
- /* @__PURE__ */ h(l, {
42
- isDisabled: !x,
43
- children: y.settings.avatar
44
- }),
45
- /* @__PURE__ */ h("input", {
46
- ref: w,
47
- type: "file",
48
- accept: "image/*",
49
- className: "hidden",
50
- onChange: A
51
- }),
52
- /* @__PURE__ */ g("div", {
53
- className: "flex items-center gap-4",
54
- children: [/* @__PURE__ */ h(s, {
55
- type: "button",
56
- isIconOnly: !0,
57
- variant: "ghost",
58
- className: "p-0 h-auto w-auto rounded-full",
59
- isDisabled: !x || k,
60
- onPress: () => w.current?.click(),
61
- children: /* @__PURE__ */ h(e, {
62
- size: "lg",
63
- isPending: k
64
- })
65
- }), /* @__PURE__ */ g(c, { children: [/* @__PURE__ */ g(s, {
66
- isDisabled: !x || k,
67
- size: "sm",
68
- variant: "secondary",
69
- children: [k && /* @__PURE__ */ h(u, { size: "sm" }), y.settings.changeAvatar]
70
- }), /* @__PURE__ */ h(c.Popover, {
71
- className: "min-w-fit",
72
- children: /* @__PURE__ */ g(c.Menu, { children: [/* @__PURE__ */ g(c.Item, {
73
- textValue: y.settings.uploadAvatar,
74
- onAction: () => w.current?.click(),
75
- children: [/* @__PURE__ */ h(a, { className: "text-muted" }), /* @__PURE__ */ h(l, { children: y.settings.uploadAvatar })]
76
- }), /* @__PURE__ */ g(c.Item, {
77
- textValue: y.settings.deleteAvatar,
78
- isDisabled: !x?.user.image,
79
- onAction: j,
80
- variant: "danger",
81
- children: [/* @__PURE__ */ h(o, { className: "text-danger" }), /* @__PURE__ */ h(l, { children: y.settings.deleteAvatar })]
82
- })] })
83
- })] })]
84
- })
85
- ]
86
- });
87
- }
88
- //#endregion
89
- export { _ as ChangeAvatar };
@@ -1,54 +0,0 @@
1
- import { useAuth as e, useChangeEmail as t, useSession as n } from "@better-auth-ui/react";
2
- import { Button as r, Card as i, FieldError as a, Fieldset as o, Form as s, Input as c, Label as l, Skeleton as u, Spinner as d, TextField as f, cn as p, toast as m } from "@heroui/react";
3
- import { jsx as h, jsxs as g } from "react/jsx-runtime";
4
- //#region src/components/auth/settings/account/change-email.tsx
5
- function _({ className: _, variant: v, ...y }) {
6
- let { authClient: b, localization: x, baseURL: S, viewPaths: C } = e(), { data: w } = n(b), { mutate: T, isPending: E } = t(b, { onSuccess: () => m.success(x.settings.changeEmailSuccess) });
7
- function D(e) {
8
- e.preventDefault(), T({
9
- newEmail: new FormData(e.currentTarget).get("email"),
10
- callbackURL: `${S}/${C.settings.account}`
11
- });
12
- }
13
- return /* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("h2", {
14
- className: p("text-sm font-semibold mb-3"),
15
- children: x.settings.changeEmail
16
- }), /* @__PURE__ */ h(i, {
17
- className: p("p-4 gap-4", _),
18
- variant: v,
19
- ...y,
20
- children: /* @__PURE__ */ h(i.Content, { children: /* @__PURE__ */ h(s, {
21
- onSubmit: D,
22
- children: /* @__PURE__ */ g(o, {
23
- className: "w-full gap-4",
24
- children: [/* @__PURE__ */ h(o.Group, { children: /* @__PURE__ */ g(f, {
25
- name: "email",
26
- type: "email",
27
- defaultValue: w?.user.email,
28
- isDisabled: E || !w,
29
- children: [
30
- /* @__PURE__ */ h(l, { children: x.auth.email }),
31
- w ? /* @__PURE__ */ h(c, {
32
- required: !0,
33
- variant: v === "transparent" ? "primary" : "secondary",
34
- autoComplete: "email",
35
- placeholder: x.auth.emailPlaceholder
36
- }) : /* @__PURE__ */ h(u, { className: "h-10 md:h-9 w-full rounded-xl" }),
37
- /* @__PURE__ */ h(a, {})
38
- ]
39
- }, w?.user.email) }), /* @__PURE__ */ h(o.Actions, { children: /* @__PURE__ */ g(r, {
40
- type: "submit",
41
- isPending: E,
42
- isDisabled: !w,
43
- size: "sm",
44
- children: [E && /* @__PURE__ */ h(d, {
45
- color: "current",
46
- size: "sm"
47
- }), x.settings.updateEmail]
48
- }) })]
49
- })
50
- }) })
51
- })] });
52
- }
53
- //#endregion
54
- export { _ as ChangeEmail };
@@ -1,86 +0,0 @@
1
- import { AdditionalField as e } from "../../additional-field.js";
2
- import { ChangeAvatar as t } from "./change-avatar.js";
3
- import { parseAdditionalFieldValue as n } from "@better-auth-ui/core";
4
- import { useAuth as r, useSession as i, useUpdateUser as a } from "@better-auth-ui/react";
5
- import { Button as o, Card as s, FieldError as c, Form as l, Input as u, Label as d, Skeleton as f, Spinner as p, TextField as m, cn as h, toast as g } from "@heroui/react";
6
- import { jsx as _, jsxs as v } from "react/jsx-runtime";
7
- //#region src/components/auth/settings/account/user-profile.tsx
8
- function y({ className: y, variant: b, ...x }) {
9
- let { additionalFields: S, authClient: C, localization: w } = r(), { data: T } = i(C), { mutate: E, isPending: D } = a(C, { onSuccess: () => g.success(w.settings.profileUpdatedSuccess) });
10
- async function O(e) {
11
- e.preventDefault();
12
- let t = new FormData(e.currentTarget), r = t.get("name"), i = {};
13
- for (let e of S ?? []) {
14
- if (e.profile === !1 || e.readOnly) continue;
15
- let r = n(e, t.get(e.name));
16
- if (e.validate) try {
17
- await e.validate(r);
18
- } catch (e) {
19
- g.danger(e instanceof Error ? e.message : String(e));
20
- return;
21
- }
22
- r !== void 0 && (i[e.name] = r);
23
- }
24
- E({
25
- name: r,
26
- ...i
27
- });
28
- }
29
- return /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("h2", {
30
- className: h("text-sm font-semibold mb-3"),
31
- children: w.settings.profile
32
- }), /* @__PURE__ */ _(s, {
33
- className: h("p-4 gap-4", y),
34
- variant: b,
35
- ...x,
36
- children: /* @__PURE__ */ _(s.Content, { children: /* @__PURE__ */ v(l, {
37
- onSubmit: O,
38
- className: "flex flex-col gap-4",
39
- children: [
40
- /* @__PURE__ */ _(t, {}),
41
- /* @__PURE__ */ v(m, {
42
- name: "name",
43
- defaultValue: T?.user.name,
44
- isDisabled: D || !T,
45
- children: [
46
- /* @__PURE__ */ _(d, { children: w.auth.name }),
47
- /* @__PURE__ */ _(u, {
48
- className: h(!T && "hidden"),
49
- autoComplete: "name",
50
- placeholder: w.auth.name,
51
- variant: b === "transparent" ? "primary" : "secondary"
52
- }),
53
- !T && /* @__PURE__ */ _(f, { className: "h-10 md:h-9 w-full rounded-xl" }),
54
- /* @__PURE__ */ _(c, {})
55
- ]
56
- }, T?.user?.name),
57
- S?.filter((e) => e.profile !== !1).map((t) => {
58
- if (!T) return t.inputType === "hidden" ? null : /* @__PURE__ */ _(f, { className: "h-10 md:h-9 w-full rounded-xl" }, t.name);
59
- let n = T.user[t.name], r = `${t.name}:${n instanceof Date ? n.toISOString() : String(n ?? "")}`;
60
- return /* @__PURE__ */ _(e, {
61
- name: t.name,
62
- field: {
63
- ...t,
64
- defaultValue: n
65
- },
66
- isPending: D,
67
- variant: b
68
- }, r);
69
- }),
70
- /* @__PURE__ */ v(o, {
71
- type: "submit",
72
- isPending: D,
73
- isDisabled: !T,
74
- size: "sm",
75
- className: "self-start mt-1",
76
- children: [D && /* @__PURE__ */ _(p, {
77
- color: "current",
78
- size: "sm"
79
- }), w.settings.saveChanges]
80
- })
81
- ]
82
- }) })
83
- })] });
84
- }
85
- //#endregion
86
- export { y as UserProfile };
@@ -1,59 +0,0 @@
1
- import { useAuth as e, useRevokeSession as t, useSession as n } from "@better-auth-ui/react";
2
- import { ArrowRightFromSquare as r, Display as i, Smartphone as a, Xmark as o } from "@gravity-ui/icons";
3
- import { Button as s, Chip as c, Spinner as l, toast as u } from "@heroui/react";
4
- import { jsx as d, jsxs as f } from "react/jsx-runtime";
5
- import p from "bowser";
6
- //#region src/components/auth/settings/security/active-session.tsx
7
- function m(e) {
8
- let t = Math.floor((Date.now() - e.getTime()) / 1e3), n = new Intl.RelativeTimeFormat(void 0, { numeric: "auto" });
9
- for (let [e, r] of [
10
- ["year", 31536e3],
11
- ["month", 2592e3],
12
- ["week", 604800],
13
- ["day", 86400],
14
- ["hour", 3600],
15
- ["minute", 60],
16
- ["second", 1]
17
- ]) if (t >= r) return n.format(-Math.floor(t / r), e);
18
- return n.format(0, "second");
19
- }
20
- function h({ activeSession: h }) {
21
- let { authClient: g, basePaths: _, localization: v, viewPaths: y, navigate: b } = e(), { data: x } = n(g, { refetchOnMount: !1 }), { mutate: S, isPending: C } = t(g, { onSuccess: () => u.success(v.settings.revokeSessionSuccess) }), w = h.token === x?.session.token, T = p.parse(h.userAgent || "");
22
- return /* @__PURE__ */ f("div", {
23
- className: "flex items-center gap-3",
24
- children: [
25
- /* @__PURE__ */ d("div", {
26
- className: "flex size-10 shrink-0 items-center justify-center rounded-xl bg-surface-secondary",
27
- children: T.platform.type === "mobile" || T.platform.type === "tablet" ? /* @__PURE__ */ d(a, { className: "size-4.5" }) : /* @__PURE__ */ d(i, { className: "size-4.5" })
28
- }),
29
- /* @__PURE__ */ f("div", {
30
- className: "flex flex-col min-w-0",
31
- children: [/* @__PURE__ */ f("span", {
32
- className: "text-sm font-medium truncate",
33
- children: [T.browser.name || "Unknown Browser", T.os.name ? `, ${T.os.name}` : ""]
34
- }), w ? /* @__PURE__ */ d(c, {
35
- color: "accent",
36
- size: "sm",
37
- children: v.settings.currentSession
38
- }) : h.createdAt && /* @__PURE__ */ d("span", {
39
- className: "text-xs text-muted capitalize",
40
- children: m(h.createdAt)
41
- })]
42
- }),
43
- /* @__PURE__ */ f(s, {
44
- className: "ml-auto shrink-0",
45
- variant: "outline",
46
- size: "sm",
47
- onPress: () => w ? b({ to: `${_.auth}/${y.auth.signOut}` }) : S(h),
48
- isPending: C,
49
- "aria-label": w ? v.auth.signOut : v.settings.revokeSession,
50
- children: [C ? /* @__PURE__ */ d(l, {
51
- color: "current",
52
- size: "sm"
53
- }) : d(w ? r : o, {}), w ? v.auth.signOut : v.settings.revoke]
54
- })
55
- ]
56
- });
57
- }
58
- //#endregion
59
- export { h as ActiveSession };
@@ -1,34 +0,0 @@
1
- import { ActiveSession as e } from "./active-session.js";
2
- import { useAuth as t, useListSessions as n, useSession as r } from "@better-auth-ui/react";
3
- import { Card as i, Skeleton as a, cn as o } from "@heroui/react";
4
- import { jsx as s, jsxs as c } from "react/jsx-runtime";
5
- //#region src/components/auth/settings/security/active-sessions.tsx
6
- function l({ className: a, variant: l, ...d }) {
7
- let { authClient: f, localization: p } = t(), { data: m } = r(f), { data: h, isPending: g } = n(f), _ = h?.toSorted((e) => e.id === m?.session.id ? -1 : 1);
8
- return /* @__PURE__ */ c("div", { children: [/* @__PURE__ */ s("h2", {
9
- className: o("text-sm font-semibold mb-3"),
10
- children: p.settings.activeSessions
11
- }), /* @__PURE__ */ s(i, {
12
- className: o(a),
13
- variant: l,
14
- ...d,
15
- children: /* @__PURE__ */ s(i.Content, {
16
- className: "gap-0",
17
- children: g ? /* @__PURE__ */ s(u, {}) : _?.map((t, n) => /* @__PURE__ */ c("div", { children: [n > 0 && /* @__PURE__ */ s("div", { className: "border-b border-dashed -mx-4 md:-mx-6 my-4" }), /* @__PURE__ */ s(e, { activeSession: t })] }, t.id))
18
- })
19
- })] });
20
- }
21
- function u() {
22
- return /* @__PURE__ */ s("div", {
23
- className: "flex items-center justify-between",
24
- children: /* @__PURE__ */ c("div", {
25
- className: "flex items-center gap-3",
26
- children: [/* @__PURE__ */ s(a, { className: "size-10 rounded-xl" }), /* @__PURE__ */ c("div", {
27
- className: "flex flex-col gap-1",
28
- children: [/* @__PURE__ */ s(a, { className: "h-4 w-32 rounded-lg" }), /* @__PURE__ */ s(a, { className: "h-3 w-24 rounded-lg" })]
29
- })]
30
- })
31
- });
32
- }
33
- //#endregion
34
- export { l as ActiveSessions };