@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,17 +0,0 @@
1
- import { toast as e } from "@heroui/react";
2
- import { useEffect as t } from "react";
3
- import { useQueryClient as n } from "@tanstack/react-query";
4
- //#region src/components/auth/error-toaster.tsx
5
- function r() {
6
- let r = n();
7
- return t(() => {
8
- r.getQueryCache().config.onError = (t) => {
9
- let n = t;
10
- n?.error && e.danger(n.error.message);
11
- }, r.setMutationDefaults([], { onError: (t) => {
12
- e.danger(t?.error?.message || t.message);
13
- } });
14
- }, [r]), null;
15
- }
16
- //#endregion
17
- export { r as ErrorToaster };
@@ -1,18 +0,0 @@
1
- import { Separator as e } from "@heroui/react";
2
- import { jsx as t, jsxs as n } from "react/jsx-runtime";
3
- //#region src/components/auth/field-separator.tsx
4
- function r({ children: r }) {
5
- return /* @__PURE__ */ n("div", {
6
- className: "flex items-center gap-4",
7
- children: [
8
- /* @__PURE__ */ t(e, { className: "flex-1" }),
9
- /* @__PURE__ */ t("p", {
10
- className: "text-xs text-muted shrink-0",
11
- children: r
12
- }),
13
- /* @__PURE__ */ t(e, { className: "flex-1" })
14
- ]
15
- });
16
- }
17
- //#endregion
18
- export { r as FieldSeparator };
@@ -1,89 +0,0 @@
1
- import { useAuth as e, useFetchOptions as t, useRequestPasswordReset as n } from "@better-auth-ui/react";
2
- import { Button as r, Card as i, Description as a, FieldError as o, Form as s, Input as c, Label as l, Link 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/forgot-password.tsx
5
- function _({ className: _, variant: v, ...y }) {
6
- let { authClient: b, basePaths: x, localization: S, viewPaths: C, navigate: w, plugins: T } = e(), { fetchOptions: E, resetFetchOptions: D } = t(), { mutate: O, isPending: k } = n(b, {
7
- onError: (e) => {
8
- m.danger(e.error?.message || e.message), D();
9
- },
10
- onSuccess: () => {
11
- m.success(S.auth.passwordResetEmailSent), w({ to: `${x.auth}/${C.auth.signIn}` });
12
- }
13
- });
14
- function A(e) {
15
- e.preventDefault(), O({
16
- email: new FormData(e.currentTarget).get("email"),
17
- fetchOptions: E
18
- });
19
- }
20
- let j = T.find((e) => e.captchaComponent)?.captchaComponent;
21
- return /* @__PURE__ */ g(i, {
22
- className: p("w-full max-w-sm gap-4 md:p-6", _),
23
- variant: v,
24
- ...y,
25
- children: [
26
- /* @__PURE__ */ h(i.Header, { children: /* @__PURE__ */ h(i.Title, {
27
- className: "text-xl font-semibold mb-1",
28
- children: S.auth.forgotPassword
29
- }) }),
30
- /* @__PURE__ */ h(i.Content, {
31
- className: "gap-4",
32
- children: /* @__PURE__ */ g(s, {
33
- onSubmit: A,
34
- className: "flex flex-col gap-4",
35
- children: [
36
- /* @__PURE__ */ g(f, {
37
- name: "email",
38
- type: "email",
39
- autoComplete: "email",
40
- isDisabled: k,
41
- children: [
42
- /* @__PURE__ */ h(l, { children: S.auth.email }),
43
- /* @__PURE__ */ h(c, {
44
- placeholder: S.auth.emailPlaceholder,
45
- required: !0,
46
- variant: v === "transparent" ? "primary" : "secondary"
47
- }),
48
- /* @__PURE__ */ h(o, {})
49
- ]
50
- }),
51
- j && /* @__PURE__ */ h("div", {
52
- className: "flex justify-center",
53
- children: j
54
- }),
55
- /* @__PURE__ */ h("div", {
56
- className: "flex flex-col gap-3",
57
- children: /* @__PURE__ */ g(r, {
58
- type: "submit",
59
- className: "w-full",
60
- isPending: k,
61
- children: [k && /* @__PURE__ */ h(d, {
62
- color: "current",
63
- size: "sm"
64
- }), S.auth.sendResetLink]
65
- })
66
- })
67
- ]
68
- })
69
- }),
70
- /* @__PURE__ */ h(i.Footer, {
71
- className: "flex-col gap-3",
72
- children: /* @__PURE__ */ g(a, {
73
- className: "text-sm",
74
- children: [
75
- S.auth.rememberYourPassword,
76
- " ",
77
- /* @__PURE__ */ h(u, {
78
- href: `${x.auth}/${C.auth.signIn}`,
79
- className: "text-accent no-underline hover:underline decoration-accent-hover",
80
- children: S.auth.signIn
81
- })
82
- ]
83
- })
84
- })
85
- ]
86
- });
87
- }
88
- //#endregion
89
- export { _ as ForgotPassword };
@@ -1,20 +0,0 @@
1
- import { magicLinkPlugin as e } from "../../../lib/auth/magic-link-plugin.js";
2
- import { authMutationKeys as t } from "@better-auth-ui/core";
3
- import { useAuth as n, useAuthPlugin as r } from "@better-auth-ui/react";
4
- import { Envelope as i, Lock as a } from "@gravity-ui/icons";
5
- import { Link as o, cn as s } from "@heroui/react";
6
- import { jsx as c, jsxs as l } from "react/jsx-runtime";
7
- import { useIsMutating as u } from "@tanstack/react-query";
8
- import { buttonVariants as d } from "@heroui/styles";
9
- //#region src/components/auth/magic-link/magic-link-button.tsx
10
- function f({ view: f }) {
11
- let { basePaths: p, emailAndPassword: m, viewPaths: h, localization: g } = n(), _ = u({ mutationKey: t.signIn.all }) + u({ mutationKey: t.signUp.all }) > 0, { localization: v, viewPaths: y } = r(e), b = f === "magicLink";
12
- return b && !m?.enabled ? null : /* @__PURE__ */ l(o, {
13
- href: `${p.auth}/${b ? h.auth.signIn : y.auth.magicLink}`,
14
- isDisabled: _,
15
- className: s(d({ variant: "tertiary" }), "w-full gap-2", _ && "status-disabled"),
16
- children: [c(b ? a : i, {}), g.auth.continueWith.replace("{{provider}}", b ? g.auth.password : v.magicLink)]
17
- });
18
- }
19
- //#endregion
20
- export { f as MagicLinkButton };
@@ -1,87 +0,0 @@
1
- import { FieldSeparator as e } from "../field-separator.js";
2
- import { ProviderButtons as t } from "../provider-buttons.js";
3
- import { magicLinkPlugin as n } from "../../../lib/auth/magic-link-plugin.js";
4
- import { authMutationKeys as r } from "@better-auth-ui/core";
5
- import { useAuth as i, useAuthPlugin as a, useSignInMagicLink as o } from "@better-auth-ui/react";
6
- import { Button as s, Card as c, Description as l, FieldError as u, Form as d, Input as f, Label as p, Link as m, Spinner as h, TextField as g, cn as _, toast as v } from "@heroui/react";
7
- import { useState as y } from "react";
8
- import { Fragment as b, jsx as x, jsxs as S } from "react/jsx-runtime";
9
- import { useIsMutating as C } from "@tanstack/react-query";
10
- //#region src/components/auth/magic-link/magic-link.tsx
11
- function w({ className: w, socialLayout: T, socialPosition: E = "bottom", variant: D, ...O }) {
12
- let { authClient: k, basePaths: A, baseURL: j, emailAndPassword: M, localization: N, plugins: P, redirectTo: F, socialProviders: I, viewPaths: L } = i(), { localization: R } = a(n), [z, B] = y(""), { mutate: V, isPending: H } = o(k, { onSuccess: () => {
13
- B(""), v.success(R.magicLinkSent);
14
- } }), U = C({ mutationKey: r.signIn.all }) + C({ mutationKey: r.signUp.all }) > 0, W = (e) => {
15
- e.preventDefault(), V({
16
- email: z,
17
- callbackURL: `${j}${F}`
18
- });
19
- }, G = !!I?.length;
20
- return /* @__PURE__ */ S(c, {
21
- className: _("w-full max-w-sm gap-4 md:p-6", w),
22
- variant: D,
23
- ...O,
24
- children: [
25
- /* @__PURE__ */ x(c.Header, { children: /* @__PURE__ */ x(c.Title, {
26
- className: "text-xl font-semibold mb-1",
27
- children: N.auth.signIn
28
- }) }),
29
- /* @__PURE__ */ S(c.Content, {
30
- className: "gap-4",
31
- children: [
32
- E === "top" && /* @__PURE__ */ S(b, { children: [!!I?.length && /* @__PURE__ */ x(t, { socialLayout: T }), G && /* @__PURE__ */ x(e, { children: N.auth.or })] }),
33
- /* @__PURE__ */ S(d, {
34
- onSubmit: W,
35
- className: "flex flex-col gap-4",
36
- children: [/* @__PURE__ */ S(g, {
37
- name: "email",
38
- type: "email",
39
- autoComplete: "email",
40
- isDisabled: U,
41
- value: z,
42
- onChange: B,
43
- children: [
44
- /* @__PURE__ */ x(p, { children: N.auth.email }),
45
- /* @__PURE__ */ x(f, {
46
- placeholder: N.auth.emailPlaceholder,
47
- required: !0,
48
- variant: D === "transparent" ? "primary" : "secondary"
49
- }),
50
- /* @__PURE__ */ x(u, {})
51
- ]
52
- }), /* @__PURE__ */ S("div", {
53
- className: "flex flex-col gap-3",
54
- children: [/* @__PURE__ */ S(s, {
55
- type: "submit",
56
- className: "w-full",
57
- isPending: U,
58
- children: [H && /* @__PURE__ */ x(h, {
59
- color: "current",
60
- size: "sm"
61
- }), R.sendMagicLink]
62
- }), P.flatMap((e) => (e.authButtons ?? []).map((t, n) => /* @__PURE__ */ x(t, { view: "magicLink" }, `${e.id}-${n.toString()}`)))]
63
- })]
64
- }),
65
- E === "bottom" && /* @__PURE__ */ S(b, { children: [G && /* @__PURE__ */ x(e, { children: N.auth.or }), !!I?.length && /* @__PURE__ */ x(t, { socialLayout: T })] })
66
- ]
67
- }),
68
- M?.enabled && /* @__PURE__ */ x(c.Footer, {
69
- className: "flex-col gap-3",
70
- children: /* @__PURE__ */ S(l, {
71
- className: "text-sm",
72
- children: [
73
- N.auth.needToCreateAnAccount,
74
- " ",
75
- /* @__PURE__ */ x(m, {
76
- href: `${A.auth}/${L.auth.signUp}`,
77
- className: "text-accent no-underline hover:underline decoration-accent-hover",
78
- children: N.auth.signUp
79
- })
80
- ]
81
- })
82
- })
83
- ]
84
- });
85
- }
86
- //#endregion
87
- export { w as MagicLink };
@@ -1,49 +0,0 @@
1
- import { UserView as e } from "../user/user-view.js";
2
- import { multiSessionPlugin as t } from "../../../lib/auth/multi-session-plugin.js";
3
- import { useAuth as n, useAuthPlugin as r, useRevokeMultiSession as i, useSetActiveSession as a, useUser as o } from "@better-auth-ui/react";
4
- import { ArrowRightArrowLeft as s, ArrowRightFromSquare as c, Ellipsis as l } from "@gravity-ui/icons";
5
- import { Button as u, Dropdown as d, Spinner as f, toast as p } from "@heroui/react";
6
- import { jsx as m, jsxs as h } from "react/jsx-runtime";
7
- //#region src/components/auth/multi-session/manage-account.tsx
8
- function g({ deviceSession: g, isPending: _ }) {
9
- let { authClient: v, localization: y } = n(), { localization: b } = r(t), { data: x } = o(v), { mutate: S, isPending: C } = a(v, { onSuccess: () => window.scrollTo({ top: 0 }) }), { mutate: w, isPending: T } = i(v, { onSuccess: () => p.success(y.settings.revokeSessionSuccess) }), E = g?.session.userId === x?.id, D = C || T;
10
- return /* @__PURE__ */ h("div", {
11
- className: "flex items-center justify-between gap-3",
12
- children: [
13
- /* @__PURE__ */ m(e, {
14
- user: g?.user,
15
- isPending: _,
16
- size: "md"
17
- }),
18
- g && E && /* @__PURE__ */ h(u, {
19
- className: "shrink-0",
20
- variant: "outline",
21
- size: "sm",
22
- onPress: () => w({ sessionToken: g.session.token }),
23
- isDisabled: D,
24
- children: [T ? /* @__PURE__ */ m(f, {
25
- color: "current",
26
- size: "sm"
27
- }) : /* @__PURE__ */ m(c, {}), y.auth.signOut]
28
- }),
29
- g && !E && /* @__PURE__ */ h(d, { children: [/* @__PURE__ */ m(u, {
30
- isIconOnly: !0,
31
- variant: "ghost",
32
- className: "shrink-0",
33
- size: "sm",
34
- isDisabled: D,
35
- children: /* @__PURE__ */ m(l, {})
36
- }), /* @__PURE__ */ m(d.Popover, { children: /* @__PURE__ */ h(d.Menu, { children: [/* @__PURE__ */ h(d.Item, {
37
- textValue: b.switchAccount,
38
- onAction: () => S({ sessionToken: g.session.token }),
39
- children: [/* @__PURE__ */ m(s, { className: "text-muted" }), b.switchAccount]
40
- }), /* @__PURE__ */ h(d.Item, {
41
- textValue: y.auth.signOut,
42
- onAction: () => w({ sessionToken: g.session.token }),
43
- children: [/* @__PURE__ */ m(c, { className: "text-muted" }), y.auth.signOut]
44
- })] }) })] })
45
- ]
46
- });
47
- }
48
- //#endregion
49
- export { g as ManageAccount };
@@ -1,34 +0,0 @@
1
- import { multiSessionPlugin as e } from "../../../lib/auth/multi-session-plugin.js";
2
- import { ManageAccount as t } from "./manage-account.js";
3
- import { useAuth as n, useAuthPlugin as r, useListDeviceSessions as i, useSession as a } from "@better-auth-ui/react";
4
- import { Card as o, cn as s } from "@heroui/react";
5
- import { jsx as c, jsxs as l } from "react/jsx-runtime";
6
- //#region src/components/auth/multi-session/manage-accounts.tsx
7
- function u({ className: u, variant: d, ...f }) {
8
- let { authClient: p } = n(), { localization: m } = r(e), { data: h } = a(p), { data: g, isPending: _ } = i(p), v = g?.filter((e) => e.session.id !== h?.session.id), y = [{
9
- key: h?.session.id ?? "current",
10
- deviceSession: _ ? null : h,
11
- isPending: _
12
- }, ...v?.map((e) => ({
13
- key: e.session.id,
14
- deviceSession: e,
15
- isPending: !1
16
- })) ?? []];
17
- return /* @__PURE__ */ l("div", { children: [/* @__PURE__ */ c("h2", {
18
- className: s("text-sm font-semibold mb-3"),
19
- children: m.manageAccounts
20
- }), /* @__PURE__ */ c(o, {
21
- className: s(u),
22
- variant: d,
23
- ...f,
24
- children: /* @__PURE__ */ c(o.Content, {
25
- className: "gap-0",
26
- children: y.map((e, n) => /* @__PURE__ */ l("div", { children: [n > 0 && /* @__PURE__ */ c("div", { className: "border-b border-dashed -mx-4 md:-mx-6 my-4" }), /* @__PURE__ */ c(t, {
27
- deviceSession: e.deviceSession,
28
- isPending: e.isPending
29
- })] }, e.key))
30
- })
31
- })] });
32
- }
33
- //#endregion
34
- export { u as ManageAccounts };
@@ -1,28 +0,0 @@
1
- import { UserView as e } from "../user/user-view.js";
2
- import { SwitchAccountSubmenuItem as t } from "./switch-account-submenu-item.js";
3
- import { multiSessionPlugin as n } from "../../../lib/auth/multi-session-plugin.js";
4
- import { useAuth as r, useAuthPlugin as i, useListDeviceSessions as a, useSession as o } from "@better-auth-ui/react";
5
- import { Check as s, CirclePlus as c } from "@gravity-ui/icons";
6
- import { Dropdown as l, Label as u } from "@heroui/react";
7
- import { jsx as d, jsxs as f } from "react/jsx-runtime";
8
- //#region src/components/auth/multi-session/switch-account-submenu-content.tsx
9
- function p() {
10
- let { authClient: p, basePaths: m, viewPaths: h } = r(), { localization: g } = i(n), { data: _ } = o(p), { data: v, isPending: y } = a(p);
11
- return /* @__PURE__ */ d(l.Popover, {
12
- className: "min-w-40 md:min-w-56 max-w-[48svw]",
13
- children: /* @__PURE__ */ f(l.Menu, { children: [
14
- /* @__PURE__ */ f(l.Item, {
15
- className: "px-2",
16
- children: [/* @__PURE__ */ d(e, { isPending: y }), !y && /* @__PURE__ */ d(s, { className: "ml-auto" })]
17
- }),
18
- v?.filter((e) => e.session.id !== _?.session?.id).map((e) => /* @__PURE__ */ d(t, { deviceSession: e }, e.session.id)),
19
- /* @__PURE__ */ f(l.Item, {
20
- textValue: g.addAccount,
21
- href: `${m.auth}/${h.auth.signIn}`,
22
- children: [/* @__PURE__ */ d(c, { className: "text-muted" }), /* @__PURE__ */ d(u, { children: g.addAccount })]
23
- })
24
- ] })
25
- });
26
- }
27
- //#endregion
28
- export { p as SwitchAccountSubmenuContent };
@@ -1,20 +0,0 @@
1
- import { UserView as e } from "../user/user-view.js";
2
- import { useAuth as t, useSetActiveSession as n } from "@better-auth-ui/react";
3
- import { Dropdown as r, Spinner as i } from "@heroui/react";
4
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
5
- //#region src/components/auth/multi-session/switch-account-submenu-item.tsx
6
- function s({ deviceSession: s }) {
7
- let { authClient: c } = t(), { mutate: l, isPending: u } = n(c, { onSuccess: () => window.scrollTo({ top: 0 }) });
8
- return /* @__PURE__ */ o(r.Item, {
9
- className: "px-2",
10
- isDisabled: u,
11
- onPress: () => l({ sessionToken: s.session.token }),
12
- children: [/* @__PURE__ */ a(e, { user: s.user }), u && /* @__PURE__ */ a(i, {
13
- color: "current",
14
- size: "sm",
15
- className: "ml-auto"
16
- })]
17
- });
18
- }
19
- //#endregion
20
- export { s as SwitchAccountSubmenuItem };
@@ -1,24 +0,0 @@
1
- import { SwitchAccountSubmenuContent as e } from "./switch-account-submenu-content.js";
2
- import { multiSessionPlugin as t } from "../../../lib/auth/multi-session-plugin.js";
3
- import { useAuth as n, useAuthPlugin as r, useSession as i } from "@better-auth-ui/react";
4
- import { Persons as a } from "@gravity-ui/icons";
5
- import { Dropdown as o, Label as s } from "@heroui/react";
6
- import { jsx as c, jsxs as l } from "react/jsx-runtime";
7
- //#region src/components/auth/multi-session/switch-account-submenu.tsx
8
- function u({ className: u }) {
9
- let { authClient: d } = n(), { data: f } = i(d), { localization: p } = r(t);
10
- return f ? /* @__PURE__ */ l(o.SubmenuTrigger, { children: [/* @__PURE__ */ l(o.Item, {
11
- className: u,
12
- textValue: p.switchAccount,
13
- children: [
14
- /* @__PURE__ */ c(a, { className: "text-muted" }),
15
- /* @__PURE__ */ c(s, { children: p.switchAccount }),
16
- /* @__PURE__ */ c(o.SubmenuIndicator, {})
17
- ]
18
- }), /* @__PURE__ */ c(o.Popover, {
19
- className: "min-w-40 md:min-w-56 max-w-[48svw]",
20
- children: /* @__PURE__ */ c(e, {})
21
- })] }) : null;
22
- }
23
- //#endregion
24
- export { u as SwitchAccountSubmenu };
@@ -1,65 +0,0 @@
1
- import { passkeyPlugin as e } from "../../../lib/auth/passkey-plugin.js";
2
- import { useAddPasskey as t, useAuth as n, useAuthPlugin as r } from "@better-auth-ui/react";
3
- import { Fingerprint as i } from "@gravity-ui/icons";
4
- import { AlertDialog as a, Button as o, FieldError as s, Form as c, Input as l, Label as u, Spinner as d, TextField as f } from "@heroui/react";
5
- import { jsx as p, jsxs as m } from "react/jsx-runtime";
6
- //#region src/components/auth/passkey/add-passkey-dialog.tsx
7
- function h({ isOpen: h, onOpenChange: g }) {
8
- let { authClient: _, localization: v } = n(), { localization: y } = r(e), { mutate: b, isPending: x } = t(_), S = (e) => {
9
- g(e);
10
- };
11
- return /* @__PURE__ */ p(a.Backdrop, {
12
- isOpen: h,
13
- onOpenChange: S,
14
- children: /* @__PURE__ */ p(a.Container, { children: /* @__PURE__ */ p(a.Dialog, { children: /* @__PURE__ */ m(c, {
15
- onSubmit: (e) => {
16
- e.preventDefault();
17
- let t = new FormData(e.target).get("name")?.trim();
18
- b(t ? { name: t } : void 0, { onSuccess: () => S(!1) });
19
- },
20
- children: [
21
- /* @__PURE__ */ p(a.CloseTrigger, {}),
22
- /* @__PURE__ */ m(a.Header, { children: [/* @__PURE__ */ p(a.Icon, {
23
- status: "default",
24
- children: /* @__PURE__ */ p(i, {})
25
- }), /* @__PURE__ */ p(a.Heading, { children: y.addPasskey })] }),
26
- /* @__PURE__ */ m(a.Body, {
27
- className: "overflow-visible",
28
- children: [/* @__PURE__ */ p("p", {
29
- className: "text-muted text-sm",
30
- children: y.passkeysDescription
31
- }), /* @__PURE__ */ m(f, {
32
- className: "mt-4",
33
- id: "name",
34
- name: "name",
35
- isDisabled: x,
36
- children: [
37
- /* @__PURE__ */ p(u, { children: y.name }),
38
- /* @__PURE__ */ p(l, {
39
- autoFocus: !0,
40
- placeholder: v.settings.optional,
41
- variant: "secondary"
42
- }),
43
- /* @__PURE__ */ p(s, {})
44
- ]
45
- })]
46
- }),
47
- /* @__PURE__ */ m(a.Footer, { children: [/* @__PURE__ */ p(o, {
48
- slot: "close",
49
- variant: "tertiary",
50
- isDisabled: x,
51
- children: v.settings.cancel
52
- }), /* @__PURE__ */ m(o, {
53
- type: "submit",
54
- isPending: x,
55
- children: [x && /* @__PURE__ */ p(d, {
56
- color: "current",
57
- size: "sm"
58
- }), y.addPasskey]
59
- })] })
60
- ]
61
- }) }) })
62
- });
63
- }
64
- //#endregion
65
- export { h as AddPasskeyDialog };
@@ -1,47 +0,0 @@
1
- import { passkeyPlugin as e } from "../../../lib/auth/passkey-plugin.js";
2
- import { useAuth as t, useAuthPlugin as n, useDeletePasskey as r } from "@better-auth-ui/react";
3
- import { Fingerprint as i } from "@gravity-ui/icons";
4
- import { AlertDialog as a, Button as o, Input as s, Label as c, Spinner as l, TextField as u } from "@heroui/react";
5
- import { jsx as d, jsxs as f } from "react/jsx-runtime";
6
- //#region src/components/auth/passkey/delete-passkey-dialog.tsx
7
- function p({ isOpen: p, onOpenChange: m, passkey: h }) {
8
- let { authClient: g, localization: _ } = t(), { localization: v } = n(e), y = h.name || v.passkey, { mutate: b, isPending: x } = r(g, { onSuccess: () => m(!1) });
9
- return /* @__PURE__ */ d(a.Backdrop, {
10
- isOpen: p,
11
- onOpenChange: m,
12
- children: /* @__PURE__ */ d(a.Container, { children: /* @__PURE__ */ f(a.Dialog, { children: [
13
- /* @__PURE__ */ d(a.CloseTrigger, {}),
14
- /* @__PURE__ */ f(a.Header, { children: [/* @__PURE__ */ d(a.Icon, {
15
- status: "danger",
16
- children: /* @__PURE__ */ d(i, {})
17
- }), /* @__PURE__ */ d(a.Heading, { children: v.deletePasskeyTitle })] }),
18
- /* @__PURE__ */ f(a.Body, {
19
- className: "flex flex-col gap-4 overflow-visible",
20
- children: [/* @__PURE__ */ d("p", {
21
- className: "text-muted text-sm",
22
- children: v.deletePasskeyWarning
23
- }), /* @__PURE__ */ f(u, {
24
- value: y,
25
- variant: "secondary",
26
- children: [/* @__PURE__ */ d(c, { children: h.name || v.passkey }), /* @__PURE__ */ d(s, { readOnly: !0 })]
27
- })]
28
- }),
29
- /* @__PURE__ */ f(a.Footer, { children: [/* @__PURE__ */ d(o, {
30
- slot: "close",
31
- variant: "tertiary",
32
- isDisabled: x,
33
- children: _.settings.cancel
34
- }), /* @__PURE__ */ f(o, {
35
- variant: "danger",
36
- onPress: () => b({ id: h.id }),
37
- isPending: x,
38
- children: [x && /* @__PURE__ */ d(l, {
39
- color: "current",
40
- size: "sm"
41
- }), v.deletePasskeyTitle]
42
- })] })
43
- ] }) })
44
- });
45
- }
46
- //#endregion
47
- export { p as DeletePasskeyDialog };
@@ -1,24 +0,0 @@
1
- import { passkeyPlugin as e } from "../../../lib/auth/passkey-plugin.js";
2
- import { authMutationKeys as t } from "@better-auth-ui/core";
3
- import { useAuth as n, useAuthPlugin as r, useSignInPasskey as i } from "@better-auth-ui/react";
4
- import { Fingerprint as a } from "@gravity-ui/icons";
5
- import { Button as o, Spinner as s } from "@heroui/react";
6
- import { jsx as c, jsxs as l } from "react/jsx-runtime";
7
- import { useIsMutating as u } from "@tanstack/react-query";
8
- //#region src/components/auth/passkey/passkey-button.tsx
9
- function d({ view: d }) {
10
- let { authClient: f, localization: p, redirectTo: m, navigate: h } = n(), { localization: g } = r(e), { mutate: _, isPending: v } = i(f, { onSuccess: () => h({ to: m }) }), y = u({ mutationKey: t.signIn.all }) + u({ mutationKey: t.signUp.all }) > 0;
11
- return d === "signUp" ? null : /* @__PURE__ */ l(o, {
12
- className: "w-full",
13
- variant: "tertiary",
14
- isDisabled: y,
15
- isPending: v,
16
- onPress: () => _(),
17
- children: [v ? /* @__PURE__ */ c(s, {
18
- color: "current",
19
- size: "sm"
20
- }) : /* @__PURE__ */ c(a, {}), p.auth.continueWith.replace("{{provider}}", g.passkey)]
21
- });
22
- }
23
- //#endregion
24
- export { d as PasskeyButton };
@@ -1,17 +0,0 @@
1
- import { Skeleton as e } from "@heroui/react";
2
- import { jsx as t, jsxs as n } from "react/jsx-runtime";
3
- //#region src/components/auth/passkey/passkey-skeleton.tsx
4
- function r() {
5
- return /* @__PURE__ */ t("div", {
6
- className: "flex items-center justify-between",
7
- children: /* @__PURE__ */ n("div", {
8
- className: "flex items-center gap-3",
9
- children: [/* @__PURE__ */ t(e, { className: "size-10 rounded-xl" }), /* @__PURE__ */ n("div", {
10
- className: "flex flex-col gap-1",
11
- children: [/* @__PURE__ */ t(e, { className: "h-4 w-28 rounded-lg" }), /* @__PURE__ */ t(e, { className: "h-3 w-32 rounded-lg" })]
12
- })]
13
- })
14
- });
15
- }
16
- //#endregion
17
- export { r as PasskeySkeleton };
@@ -1,48 +0,0 @@
1
- import { passkeyPlugin as e } from "../../../lib/auth/passkey-plugin.js";
2
- import { DeletePasskeyDialog as t } from "./delete-passkey-dialog.js";
3
- import { useAuth as n, useAuthPlugin as r } from "@better-auth-ui/react";
4
- import { Fingerprint as i, Xmark as a } from "@gravity-ui/icons";
5
- import { Button as o } from "@heroui/react";
6
- import { useState as s } from "react";
7
- import { jsx as c, jsxs as l } from "react/jsx-runtime";
8
- //#region src/components/auth/passkey/passkey.tsx
9
- function u({ passkey: u }) {
10
- let { localization: d } = n(), { localization: f } = r(e), [p, m] = s(!1), h = u.name || f.passkey;
11
- return /* @__PURE__ */ l("div", {
12
- className: "flex items-center gap-3",
13
- children: [
14
- /* @__PURE__ */ c("div", {
15
- className: "flex size-10 shrink-0 items-center justify-center rounded-xl bg-surface-secondary",
16
- children: /* @__PURE__ */ c(i, { className: "size-4.5" })
17
- }),
18
- /* @__PURE__ */ l("div", {
19
- className: "flex min-w-0 flex-col",
20
- children: [/* @__PURE__ */ c("span", {
21
- className: "truncate text-sm font-medium leading-tight",
22
- children: h
23
- }), /* @__PURE__ */ c("span", {
24
- className: "text-xs text-muted",
25
- children: new Date(u.createdAt).toLocaleString(void 0, {
26
- dateStyle: "medium",
27
- timeStyle: "short"
28
- })
29
- })]
30
- }),
31
- /* @__PURE__ */ l(o, {
32
- className: "ml-auto shrink-0",
33
- variant: "outline",
34
- size: "sm",
35
- onPress: () => m(!0),
36
- "aria-label": f.deletePasskey.replace("{{name}}", h),
37
- children: [/* @__PURE__ */ c(a, {}), d.settings.delete]
38
- }),
39
- /* @__PURE__ */ c(t, {
40
- isOpen: p,
41
- onOpenChange: m,
42
- passkey: u
43
- })
44
- ]
45
- });
46
- }
47
- //#endregion
48
- export { u as Passkey };
@@ -1,35 +0,0 @@
1
- import { passkeyPlugin as e } from "../../../lib/auth/passkey-plugin.js";
2
- import { useAuthPlugin as t } from "@better-auth-ui/react";
3
- import { Fingerprint as n } from "@gravity-ui/icons";
4
- import { Button as r } from "@heroui/react";
5
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
- //#region src/components/auth/passkey/passkeys-empty.tsx
7
- function o({ onAddPress: o }) {
8
- let { localization: s } = t(e);
9
- return /* @__PURE__ */ a("div", {
10
- className: "flex flex-col items-center justify-center gap-4",
11
- children: [
12
- /* @__PURE__ */ i("div", {
13
- className: "flex size-10 items-center justify-center rounded-xl bg-surface-secondary",
14
- children: /* @__PURE__ */ i(n, { className: "size-4.5" })
15
- }),
16
- /* @__PURE__ */ a("div", {
17
- className: "flex flex-col items-center justify-center gap-1 text-center",
18
- children: [/* @__PURE__ */ i("p", {
19
- className: "text-sm font-semibold",
20
- children: s.noPasskeys
21
- }), /* @__PURE__ */ i("p", {
22
- className: "text-muted text-xs",
23
- children: s.passkeysDescription
24
- })]
25
- }),
26
- /* @__PURE__ */ i(r, {
27
- size: "sm",
28
- onPress: o,
29
- children: s.addPasskey
30
- })
31
- ]
32
- });
33
- }
34
- //#endregion
35
- export { o as PasskeysEmpty };