@better-auth-ui/heroui 1.6.7 → 1.6.9
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.
- package/dist/components/auth/additional-field.d.ts +2 -2
- package/dist/components/auth/additional-field.js +133 -266
- package/dist/components/auth/api-key/api-key-skeleton.js +4 -20
- package/dist/components/auth/api-key/api-key.d.ts +6 -2
- package/dist/components/auth/api-key/api-key.js +16 -54
- package/dist/components/auth/api-key/api-keys-empty.d.ts +3 -1
- package/dist/components/auth/api-key/api-keys-empty.js +8 -34
- package/dist/components/auth/api-key/api-keys.d.ts +10 -2
- package/dist/components/auth/api-key/api-keys.js +21 -40
- package/dist/components/auth/api-key/create-api-key-dialog.d.ts +3 -1
- package/dist/components/auth/api-key/create-api-key-dialog.js +43 -73
- package/dist/components/auth/api-key/delete-api-key-dialog.d.ts +4 -2
- package/dist/components/auth/api-key/delete-api-key-dialog.js +16 -50
- package/dist/components/auth/api-key/new-api-key-dialog.js +23 -59
- package/dist/components/auth/api-key/organization-api-keys.d.ts +14 -0
- package/dist/components/auth/api-key/organization-api-keys.js +22 -0
- package/dist/components/auth/auth-provider.d.ts +1 -1
- package/dist/components/auth/auth-provider.js +10 -16
- package/dist/components/auth/auth.d.ts +3 -3
- package/dist/components/auth/auth.js +86 -61
- package/dist/components/auth/delete-user/danger-zone.d.ts +3 -3
- package/dist/components/auth/delete-user/danger-zone.js +11 -17
- package/dist/components/auth/delete-user/delete-account.d.ts +9 -0
- package/dist/components/auth/delete-user/delete-account.js +50 -0
- package/dist/components/auth/email/email-changed-email.d.ts +2 -2
- package/dist/components/auth/email/email-changed-email.js +22 -29
- package/dist/components/auth/email/email-verification-email.d.ts +2 -2
- package/dist/components/auth/email/email-verification-email.js +22 -29
- package/dist/components/auth/email/magic-link-email.d.ts +2 -2
- package/dist/components/auth/email/magic-link-email.js +22 -29
- package/dist/components/auth/email/new-device-email.d.ts +2 -2
- package/dist/components/auth/email/new-device-email.js +22 -29
- package/dist/components/auth/email/organization-invitation-email.d.ts +3 -0
- package/dist/components/auth/email/organization-invitation-email.js +23 -0
- package/dist/components/auth/email/otp-email.d.ts +2 -2
- package/dist/components/auth/email/otp-email.js +21 -28
- package/dist/components/auth/email/password-changed-email.d.ts +2 -2
- package/dist/components/auth/email/password-changed-email.js +22 -29
- package/dist/components/auth/email/reset-password-email.d.ts +2 -2
- package/dist/components/auth/email/reset-password-email.js +22 -29
- package/dist/components/auth/error-toaster.js +32 -16
- package/dist/components/auth/field-separator.d.ts +1 -1
- package/dist/components/auth/field-separator.js +4 -17
- package/dist/components/auth/forgot-password.d.ts +1 -1
- package/dist/components/auth/forgot-password.js +36 -88
- package/dist/components/auth/magic-link/magic-link-button.d.ts +1 -1
- package/dist/components/auth/magic-link/magic-link-button.js +33 -19
- package/dist/components/auth/magic-link/magic-link.d.ts +2 -2
- package/dist/components/auth/magic-link/magic-link.js +39 -86
- package/dist/components/auth/multi-session/manage-account.d.ts +1 -1
- package/dist/components/auth/multi-session/manage-account.js +32 -48
- package/dist/components/auth/multi-session/manage-accounts.d.ts +1 -1
- package/dist/components/auth/multi-session/manage-accounts.js +32 -33
- package/dist/components/auth/multi-session/switch-account-submenu-content.d.ts +3 -1
- package/dist/components/auth/multi-session/switch-account-submenu-content.js +24 -27
- package/dist/components/auth/multi-session/switch-account-submenu-item.d.ts +3 -2
- package/dist/components/auth/multi-session/switch-account-submenu-item.js +16 -19
- package/dist/components/auth/multi-session/switch-account-submenu.d.ts +2 -1
- package/dist/components/auth/multi-session/switch-account-submenu.js +23 -23
- package/dist/components/auth/organization/change-organization-logo.d.ts +4 -0
- package/dist/components/auth/organization/change-organization-logo.js +69 -0
- package/dist/components/auth/organization/create-organization-dialog.d.ts +13 -0
- package/dist/components/auth/organization/create-organization-dialog.js +37 -0
- package/dist/components/auth/organization/delete-organization-dialog.d.ts +7 -0
- package/dist/components/auth/organization/delete-organization-dialog.js +25 -0
- package/dist/components/auth/organization/delete-organization-skeleton.d.ts +4 -0
- package/dist/components/auth/organization/delete-organization-skeleton.js +8 -0
- package/dist/components/auth/organization/delete-organization.d.ts +5 -0
- package/dist/components/auth/organization/delete-organization.js +27 -0
- package/dist/components/auth/organization/invite-member-dialog.d.ts +13 -0
- package/dist/components/auth/organization/invite-member-dialog.js +47 -0
- package/dist/components/auth/organization/leave-organization-dialog.d.ts +7 -0
- package/dist/components/auth/organization/leave-organization-dialog.js +21 -0
- package/dist/components/auth/organization/leave-organization.d.ts +4 -0
- package/dist/components/auth/organization/leave-organization.js +16 -0
- package/dist/components/auth/organization/organization-danger-zone.d.ts +16 -0
- package/dist/components/auth/organization/organization-danger-zone.js +23 -0
- package/dist/components/auth/organization/organization-invitation-row-skeleton.d.ts +5 -0
- package/dist/components/auth/organization/organization-invitation-row-skeleton.js +9 -0
- package/dist/components/auth/organization/organization-invitation-row.d.ts +5 -0
- package/dist/components/auth/organization/organization-invitation-row.js +31 -0
- package/dist/components/auth/organization/organization-invitations-empty.d.ts +8 -0
- package/dist/components/auth/organization/organization-invitations-empty.js +13 -0
- package/dist/components/auth/organization/organization-invitations.d.ts +9 -0
- package/dist/components/auth/organization/organization-invitations.js +66 -0
- package/dist/components/auth/organization/organization-logo.d.ts +15 -0
- package/dist/components/auth/organization/organization-logo.js +14 -0
- package/dist/components/auth/organization/organization-member-row-skeleton.d.ts +4 -0
- package/dist/components/auth/organization/organization-member-row-skeleton.js +9 -0
- package/dist/components/auth/organization/organization-member-row.d.ts +9 -0
- package/dist/components/auth/organization/organization-member-row.js +34 -0
- package/dist/components/auth/organization/organization-members.d.ts +9 -0
- package/dist/components/auth/organization/organization-members.js +67 -0
- package/dist/components/auth/organization/organization-people.d.ts +10 -0
- package/dist/components/auth/organization/organization-people.js +11 -0
- package/dist/components/auth/organization/organization-profile.d.ts +9 -0
- package/dist/components/auth/organization/organization-profile.js +34 -0
- package/dist/components/auth/organization/organization-row.d.ts +8 -0
- package/dist/components/auth/organization/organization-row.js +31 -0
- package/dist/components/auth/organization/organization-settings.d.ts +12 -0
- package/dist/components/auth/organization/organization-settings.js +13 -0
- package/dist/components/auth/organization/organization-switcher.d.ts +20 -0
- package/dist/components/auth/organization/organization-switcher.js +48 -0
- package/dist/components/auth/organization/organization-view-skeleton.d.ts +6 -0
- package/dist/components/auth/organization/organization-view-skeleton.js +9 -0
- package/dist/components/auth/organization/organization-view.d.ts +15 -0
- package/dist/components/auth/organization/organization-view.js +31 -0
- package/dist/components/auth/organization/organization.d.ts +17 -0
- package/dist/components/auth/organization/organization.js +60 -0
- package/dist/components/auth/organization/organizations-empty.d.ts +4 -0
- package/dist/components/auth/organization/organizations-empty.js +9 -0
- package/dist/components/auth/organization/organizations-settings.d.ts +17 -0
- package/dist/components/auth/organization/organizations-settings.js +17 -0
- package/dist/components/auth/organization/organizations.d.ts +10 -0
- package/dist/components/auth/organization/organizations.js +21 -0
- package/dist/components/auth/organization/remove-member-dialog.d.ts +9 -0
- package/dist/components/auth/organization/remove-member-dialog.js +20 -0
- package/dist/components/auth/organization/slug-field.d.ts +19 -0
- package/dist/components/auth/organization/slug-field.js +38 -0
- package/dist/components/auth/organization/user-invitation-row-skeleton.d.ts +4 -0
- package/dist/components/auth/organization/user-invitation-row-skeleton.js +8 -0
- package/dist/components/auth/organization/user-invitation-row.d.ts +10 -0
- package/dist/components/auth/organization/user-invitation-row.js +22 -0
- package/dist/components/auth/organization/user-invitations-empty.d.ts +4 -0
- package/dist/components/auth/organization/user-invitations-empty.js +12 -0
- package/dist/components/auth/organization/user-invitations.d.ts +10 -0
- package/dist/components/auth/organization/user-invitations.js +18 -0
- package/dist/components/auth/passkey/add-passkey-dialog.d.ts +5 -0
- package/dist/components/auth/passkey/add-passkey-dialog.js +22 -0
- package/dist/components/auth/passkey/delete-passkey-dialog.d.ts +11 -0
- package/dist/components/auth/passkey/delete-passkey-dialog.js +14 -0
- package/dist/components/auth/passkey/passkey-button.d.ts +1 -1
- package/dist/components/auth/passkey/passkey-button.js +24 -23
- package/dist/components/auth/passkey/passkey-skeleton.d.ts +1 -0
- package/dist/components/auth/passkey/passkey-skeleton.js +5 -0
- package/dist/components/auth/passkey/passkey.d.ts +2 -5
- package/dist/components/auth/passkey/passkey.js +16 -44
- package/dist/components/auth/passkey/passkeys-empty.d.ts +4 -0
- package/dist/components/auth/passkey/passkeys-empty.js +9 -0
- package/dist/components/auth/passkey/passkeys.d.ts +1 -1
- package/dist/components/auth/passkey/passkeys.js +15 -105
- package/dist/components/auth/provider-button.d.ts +2 -2
- package/dist/components/auth/provider-button.js +28 -24
- package/dist/components/auth/provider-buttons.js +28 -18
- package/dist/components/auth/reset-password.d.ts +1 -1
- package/dist/components/auth/reset-password.js +56 -146
- package/dist/components/auth/settings/account/account-settings.d.ts +2 -2
- package/dist/components/auth/settings/account/account-settings.js +21 -19
- package/dist/components/auth/settings/account/change-avatar.js +53 -88
- package/dist/components/auth/settings/account/change-email.d.ts +1 -1
- package/dist/components/auth/settings/account/change-email.js +27 -53
- package/dist/components/auth/settings/account/user-profile.d.ts +1 -1
- package/dist/components/auth/settings/account/user-profile.js +64 -85
- package/dist/components/auth/settings/security/active-session.d.ts +1 -1
- package/dist/components/auth/settings/security/active-session.js +50 -57
- package/dist/components/auth/settings/security/active-sessions.d.ts +1 -1
- package/dist/components/auth/settings/security/active-sessions.js +21 -32
- package/dist/components/auth/settings/security/change-password.d.ts +1 -1
- package/dist/components/auth/settings/security/change-password.js +76 -186
- package/dist/components/auth/settings/security/linked-account.d.ts +1 -1
- package/dist/components/auth/settings/security/linked-account.js +37 -55
- package/dist/components/auth/settings/security/linked-accounts.d.ts +1 -1
- package/dist/components/auth/settings/security/linked-accounts.js +34 -43
- package/dist/components/auth/settings/security/security-settings.d.ts +2 -2
- package/dist/components/auth/settings/security/security-settings.js +19 -21
- package/dist/components/auth/settings/settings.d.ts +4 -4
- package/dist/components/auth/settings/settings.js +52 -44
- package/dist/components/auth/sign-in.d.ts +2 -2
- package/dist/components/auth/sign-in.js +63 -132
- package/dist/components/auth/sign-out.js +32 -26
- package/dist/components/auth/sign-up.d.ts +2 -2
- package/dist/components/auth/sign-up.js +97 -211
- package/dist/components/auth/theme/appearance.d.ts +1 -1
- package/dist/components/auth/theme/appearance.js +23 -71
- package/dist/components/auth/theme/theme-toggle-item.js +56 -61
- package/dist/components/auth/user/user-avatar.d.ts +4 -4
- package/dist/components/auth/user/user-avatar.js +31 -28
- package/dist/components/auth/user/user-button.d.ts +6 -7
- package/dist/components/auth/user/user-button.js +38 -72
- package/dist/components/auth/user/user-view.d.ts +13 -7
- package/dist/components/auth/user/user-view.js +26 -36
- package/dist/components/auth/username/sign-in-username.d.ts +2 -2
- package/dist/components/auth/username/sign-in-username.js +87 -147
- package/dist/components/auth/username/username-field.d.ts +1 -1
- package/dist/components/auth/username/username-field.js +44 -52
- package/dist/email.d.ts +8 -7
- package/dist/email.js +8 -8
- package/dist/index.d.ts +21 -21
- package/dist/index.js +21 -22
- package/dist/lib/auth/api-key-plugin.d.ts +7 -4
- package/dist/lib/auth/api-key-plugin.js +12 -10
- package/dist/lib/auth/auth-plugin.d.ts +10 -6
- package/dist/lib/auth/auth-plugin.js +1 -0
- package/dist/lib/auth/delete-user-plugin.d.ts +6 -6
- package/dist/lib/auth/delete-user-plugin.js +6 -9
- package/dist/lib/auth/magic-link-plugin.d.ts +5 -5
- package/dist/lib/auth/magic-link-plugin.js +17 -12
- package/dist/lib/auth/multi-session-plugin.d.ts +5 -5
- package/dist/lib/auth/multi-session-plugin.js +8 -11
- package/dist/lib/auth/organization-plugin.d.ts +37 -0
- package/dist/lib/auth/organization-plugin.js +19 -0
- package/dist/lib/auth/passkey-plugin.d.ts +9 -6
- package/dist/lib/auth/passkey-plugin.js +8 -11
- package/dist/lib/auth/theme-plugin.d.ts +6 -6
- package/dist/lib/auth/theme-plugin.js +25 -22
- package/dist/lib/auth/username-plugin.d.ts +11 -11
- package/dist/lib/auth/username-plugin.js +18 -17
- package/dist/plugins.d.ts +46 -22
- package/dist/plugins.js +47 -22
- package/package.json +25 -19
- package/src/components/auth/api-key/api-key.tsx +25 -16
- package/src/components/auth/api-key/api-keys-empty.tsx +8 -4
- package/src/components/auth/api-key/api-keys.tsx +52 -14
- package/src/components/auth/api-key/create-api-key-dialog.tsx +17 -4
- package/src/components/auth/api-key/delete-api-key-dialog.tsx +10 -2
- package/src/components/auth/api-key/organization-api-keys.tsx +55 -0
- package/src/components/auth/delete-user/danger-zone.tsx +3 -3
- package/src/components/auth/delete-user/{delete-user.tsx → delete-account.tsx} +9 -9
- package/src/components/auth/email/organization-invitation-email.tsx +38 -0
- package/src/components/auth/error-toaster.tsx +28 -10
- package/src/components/auth/forgot-password.tsx +10 -2
- package/src/components/auth/multi-session/manage-accounts.tsx +1 -1
- package/src/components/auth/multi-session/switch-account-submenu-content.tsx +7 -2
- package/src/components/auth/multi-session/switch-account-submenu-item.tsx +4 -2
- package/src/components/auth/multi-session/switch-account-submenu.tsx +8 -4
- package/src/components/auth/organization/change-organization-logo.tsx +171 -0
- package/src/components/auth/organization/create-organization-dialog.tsx +133 -0
- package/src/components/auth/organization/delete-organization-dialog.tsx +97 -0
- package/src/components/auth/organization/delete-organization-skeleton.tsx +17 -0
- package/src/components/auth/organization/delete-organization.tsx +77 -0
- package/src/components/auth/organization/invite-member-dialog.tsx +177 -0
- package/src/components/auth/organization/leave-organization-dialog.tsx +95 -0
- package/src/components/auth/organization/leave-organization.tsx +59 -0
- package/src/components/auth/organization/organization-danger-zone.tsx +68 -0
- package/src/components/auth/organization/organization-invitation-row-skeleton.tsx +29 -0
- package/src/components/auth/organization/organization-invitation-row.tsx +97 -0
- package/src/components/auth/organization/organization-invitations-empty.tsx +39 -0
- package/src/components/auth/organization/organization-invitations.tsx +351 -0
- package/src/components/auth/organization/organization-logo.tsx +64 -0
- package/src/components/auth/organization/organization-member-row-skeleton.tsx +24 -0
- package/src/components/auth/organization/organization-member-row.tsx +157 -0
- package/src/components/auth/organization/organization-members.tsx +284 -0
- package/src/components/auth/organization/organization-people.tsx +26 -0
- package/src/components/auth/organization/organization-profile.tsx +141 -0
- package/src/components/auth/organization/organization-row.tsx +66 -0
- package/src/components/auth/organization/organization-settings.tsx +38 -0
- package/src/components/auth/organization/organization-switcher.tsx +233 -0
- package/src/components/auth/organization/organization-view-skeleton.tsx +36 -0
- package/src/components/auth/organization/organization-view.tsx +109 -0
- package/src/components/auth/organization/organization.tsx +162 -0
- package/src/components/auth/organization/organizations-empty.tsx +35 -0
- package/src/components/auth/organization/organizations-settings.tsx +36 -0
- package/src/components/auth/organization/organizations.tsx +80 -0
- package/src/components/auth/organization/remove-member-dialog.tsx +95 -0
- package/src/components/auth/organization/slug-field.tsx +111 -0
- package/src/components/auth/organization/user-invitation-row-skeleton.tsx +17 -0
- package/src/components/auth/organization/user-invitation-row.tsx +90 -0
- package/src/components/auth/organization/user-invitations-empty.tsx +30 -0
- package/src/components/auth/organization/user-invitations.tsx +59 -0
- package/src/components/auth/passkey/add-passkey-dialog.tsx +109 -0
- package/src/components/auth/passkey/delete-passkey-dialog.tsx +95 -0
- package/src/components/auth/passkey/passkey-skeleton.tsx +16 -0
- package/src/components/auth/passkey/passkey.tsx +23 -22
- package/src/components/auth/passkey/passkeys-empty.tsx +35 -0
- package/src/components/auth/passkey/passkeys.tsx +33 -154
- package/src/components/auth/settings/account/change-email.tsx +1 -1
- package/src/components/auth/settings/account/user-profile.tsx +5 -5
- package/src/components/auth/settings/security/active-sessions.tsx +6 -4
- package/src/components/auth/settings/security/linked-accounts.tsx +2 -2
- package/src/components/auth/settings/settings.tsx +77 -14
- package/src/components/auth/user/user-avatar.tsx +4 -1
- package/src/components/auth/user/user-button.tsx +14 -11
- package/src/components/auth/user/user-view.tsx +32 -12
- package/src/email.ts +1 -0
- package/src/lib/auth/api-key-plugin.ts +10 -4
- package/src/lib/auth/auth-plugin.ts +6 -1
- package/src/lib/auth/organization-plugin.tsx +32 -0
- package/src/plugins.ts +25 -1
- package/dist/components/auth/delete-user/delete-user.d.ts +0 -9
- package/dist/components/auth/delete-user/delete-user.js +0 -95
|
@@ -12,22 +12,32 @@ export type UserViewProps = {
|
|
|
12
12
|
className?: string
|
|
13
13
|
isPending?: boolean
|
|
14
14
|
size?: AvatarProps["size"]
|
|
15
|
+
/**
|
|
16
|
+
* When true, the subtitle line (email when name/username is shown) is hidden.
|
|
17
|
+
* @default false
|
|
18
|
+
*/
|
|
19
|
+
hideSubtitle?: boolean
|
|
15
20
|
/** @remarks `User` */
|
|
16
|
-
user?: User & {
|
|
21
|
+
user?: Partial<User> & {
|
|
22
|
+
username?: string | null
|
|
23
|
+
displayUsername?: string | null
|
|
24
|
+
}
|
|
17
25
|
}
|
|
18
26
|
|
|
19
27
|
/**
|
|
20
|
-
* Render a compact user item with an avatar, a primary label (display username, name, or email), and an optional
|
|
28
|
+
* Render a compact user item with an avatar, a primary label (display username, name, or email), and an optional subtitle (email).
|
|
21
29
|
*
|
|
22
30
|
* @param isPending - If true and no `user` prop is provided, renders a loading skeleton instead of user details
|
|
23
|
-
* @param size - Avatar size variant; defaults to `"
|
|
31
|
+
* @param size - Avatar size variant; defaults to `"md"`
|
|
32
|
+
* @param hideSubtitle - When true, omits the muted subtitle row under the primary label
|
|
24
33
|
* @param user - Optional user to display; when omitted the current session user is used if available
|
|
25
34
|
* @returns A React element containing the user's avatar and text labels
|
|
26
35
|
*/
|
|
27
36
|
export function UserView({
|
|
28
37
|
className,
|
|
29
38
|
isPending,
|
|
30
|
-
size = "
|
|
39
|
+
size = "md",
|
|
40
|
+
hideSubtitle = false,
|
|
31
41
|
user,
|
|
32
42
|
...props
|
|
33
43
|
}: UserViewProps & ComponentProps<"div">) {
|
|
@@ -47,11 +57,16 @@ export function UserView({
|
|
|
47
57
|
className={cn("flex items-center gap-2 min-w-0", className)}
|
|
48
58
|
{...props}
|
|
49
59
|
>
|
|
50
|
-
<UserAvatar
|
|
60
|
+
<UserAvatar
|
|
61
|
+
isPending
|
|
62
|
+
className={size === "sm" ? "size-5 [&>span]:text-xs" : undefined}
|
|
63
|
+
size={size === "lg" ? "md" : "sm"}
|
|
64
|
+
/>
|
|
51
65
|
|
|
52
66
|
<div className="flex flex-col gap-1 min-w-0">
|
|
53
67
|
<Skeleton className="h-3.5 w-24 rounded-lg" />
|
|
54
|
-
|
|
68
|
+
|
|
69
|
+
{!hideSubtitle ? <Skeleton className="h-3 w-32 rounded-lg" /> : null}
|
|
55
70
|
</div>
|
|
56
71
|
</div>
|
|
57
72
|
)
|
|
@@ -62,20 +77,25 @@ export function UserView({
|
|
|
62
77
|
className={cn("flex items-center gap-2 min-w-0", className)}
|
|
63
78
|
{...props}
|
|
64
79
|
>
|
|
65
|
-
<UserAvatar
|
|
80
|
+
<UserAvatar
|
|
81
|
+
className={size === "sm" ? "size-5 [&>span]:text-xs" : undefined}
|
|
82
|
+
user={resolvedUser}
|
|
83
|
+
size={size === "lg" ? "md" : "sm"}
|
|
84
|
+
/>
|
|
66
85
|
|
|
67
|
-
<div className="min-w-0">
|
|
68
|
-
<p className="text-sm font-medium
|
|
86
|
+
<div className="flex flex-col min-w-0">
|
|
87
|
+
<p className="text-foreground text-sm font-medium leading-tight truncate">
|
|
69
88
|
{resolvedUser?.displayUsername ||
|
|
70
89
|
resolvedUser?.name ||
|
|
71
90
|
resolvedUser?.email}
|
|
72
91
|
</p>
|
|
73
92
|
|
|
74
|
-
{
|
|
75
|
-
|
|
93
|
+
{!hideSubtitle &&
|
|
94
|
+
(resolvedUser?.displayUsername || resolvedUser?.name) ? (
|
|
95
|
+
<p className="text-muted text-xs leading-tight truncate overflow-x-hidden">
|
|
76
96
|
{resolvedUser?.email}
|
|
77
97
|
</p>
|
|
78
|
-
)}
|
|
98
|
+
) : null}
|
|
79
99
|
</div>
|
|
80
100
|
</div>
|
|
81
101
|
)
|
package/src/email.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from "./components/auth/email/email-changed-email"
|
|
|
4
4
|
export * from "./components/auth/email/email-verification-email"
|
|
5
5
|
export * from "./components/auth/email/magic-link-email"
|
|
6
6
|
export * from "./components/auth/email/new-device-email"
|
|
7
|
+
export * from "./components/auth/email/organization-invitation-email"
|
|
7
8
|
export * from "./components/auth/email/otp-email"
|
|
8
9
|
export * from "./components/auth/email/password-changed-email"
|
|
9
10
|
export * from "./components/auth/email/reset-password-email"
|
|
@@ -5,11 +5,17 @@ import {
|
|
|
5
5
|
} from "@better-auth-ui/core/plugins"
|
|
6
6
|
|
|
7
7
|
import { ApiKeys } from "../../components/auth/api-key/api-keys"
|
|
8
|
+
import { OrganizationApiKeys } from "../../components/auth/api-key/organization-api-keys"
|
|
8
9
|
|
|
9
10
|
export const apiKeyPlugin = createAuthPlugin(
|
|
10
11
|
coreApiKeyPlugin.id,
|
|
11
|
-
(options: ApiKeyPluginOptions = {}) =>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
(options: ApiKeyPluginOptions = {}) => {
|
|
13
|
+
const core = coreApiKeyPlugin(options)
|
|
14
|
+
|
|
15
|
+
return {
|
|
16
|
+
...core,
|
|
17
|
+
securityCards: [ApiKeys],
|
|
18
|
+
...(core.organization ? { organizationCards: [OrganizationApiKeys] } : {})
|
|
19
|
+
}
|
|
20
|
+
}
|
|
15
21
|
)
|
|
@@ -3,6 +3,7 @@ import type {
|
|
|
3
3
|
AccountCardProps,
|
|
4
4
|
AuthPlugin as AuthPluginPrimitive,
|
|
5
5
|
AuthPluginComponents as BaseAuthPluginComponents,
|
|
6
|
+
OrganizationCardProps,
|
|
6
7
|
SecurityCardProps,
|
|
7
8
|
UserMenuItemProps
|
|
8
9
|
} from "@better-auth-ui/react"
|
|
@@ -36,7 +37,7 @@ declare module "@better-auth-ui/core" {
|
|
|
36
37
|
/** Heroui slot component shapes — inherits from the framework-agnostic defaults and narrows slots that receive a heroui variant from the host. */
|
|
37
38
|
export type AuthPluginComponents = Omit<
|
|
38
39
|
BaseAuthPluginComponents,
|
|
39
|
-
"securityCards" | "accountCards"
|
|
40
|
+
"securityCards" | "accountCards" | "organizationCards"
|
|
40
41
|
> & {
|
|
41
42
|
/** Rendered as cards inside security settings */
|
|
42
43
|
securityCards?: ComponentType<
|
|
@@ -46,6 +47,10 @@ export type AuthPluginComponents = Omit<
|
|
|
46
47
|
accountCards?: ComponentType<
|
|
47
48
|
AccountCardProps & { variant?: CardProps["variant"] }
|
|
48
49
|
>[]
|
|
50
|
+
/** Rendered as cards inside the active organization's settings */
|
|
51
|
+
organizationCards?: ComponentType<
|
|
52
|
+
OrganizationCardProps & { variant?: CardProps["variant"] }
|
|
53
|
+
>[]
|
|
49
54
|
/** Rendered as items inside the `UserButton` dropdown (e.g. account switcher). */
|
|
50
55
|
userMenuItems?: ComponentType<UserMenuItemProps>[]
|
|
51
56
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { createAuthPlugin } from "@better-auth-ui/core"
|
|
2
|
+
import {
|
|
3
|
+
organizationPlugin as coreOrganizationPlugin,
|
|
4
|
+
type OrganizationLocalization,
|
|
5
|
+
type OrganizationPluginOptions
|
|
6
|
+
} from "@better-auth-ui/core/plugins"
|
|
7
|
+
import { Briefcase } from "@gravity-ui/icons"
|
|
8
|
+
import { OrganizationsSettings } from "../../components/auth/organization/organizations-settings"
|
|
9
|
+
|
|
10
|
+
export const organizationPlugin = createAuthPlugin(
|
|
11
|
+
coreOrganizationPlugin.id,
|
|
12
|
+
(options: OrganizationPluginOptions = {}) => {
|
|
13
|
+
const coreOptions = coreOrganizationPlugin(options)
|
|
14
|
+
|
|
15
|
+
return {
|
|
16
|
+
...coreOptions,
|
|
17
|
+
localization: coreOptions.localization as OrganizationLocalization,
|
|
18
|
+
settingsTabs: [
|
|
19
|
+
{
|
|
20
|
+
view: "organizations",
|
|
21
|
+
label: (
|
|
22
|
+
<>
|
|
23
|
+
<Briefcase className="text-muted" />
|
|
24
|
+
{coreOptions.localization.organizations}
|
|
25
|
+
</>
|
|
26
|
+
),
|
|
27
|
+
component: OrganizationsSettings
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
)
|
package/src/plugins.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
3
|
export * from "./components/auth/api-key/api-keys"
|
|
4
|
+
export * from "./components/auth/api-key/organization-api-keys"
|
|
4
5
|
export * from "./components/auth/delete-user/danger-zone"
|
|
5
|
-
export * from "./components/auth/delete-user/delete-
|
|
6
|
+
export * from "./components/auth/delete-user/delete-account"
|
|
6
7
|
// Plugin-contributed components that may be used standalone
|
|
7
8
|
export * from "./components/auth/magic-link/magic-link"
|
|
8
9
|
export * from "./components/auth/multi-session/manage-account"
|
|
@@ -10,6 +11,28 @@ export * from "./components/auth/multi-session/manage-accounts"
|
|
|
10
11
|
export * from "./components/auth/multi-session/switch-account-submenu"
|
|
11
12
|
export * from "./components/auth/multi-session/switch-account-submenu-content"
|
|
12
13
|
export * from "./components/auth/multi-session/switch-account-submenu-item"
|
|
14
|
+
export * from "./components/auth/organization/change-organization-logo"
|
|
15
|
+
export * from "./components/auth/organization/create-organization-dialog"
|
|
16
|
+
export * from "./components/auth/organization/delete-organization"
|
|
17
|
+
export * from "./components/auth/organization/delete-organization-skeleton"
|
|
18
|
+
export * from "./components/auth/organization/invite-member-dialog"
|
|
19
|
+
export * from "./components/auth/organization/leave-organization"
|
|
20
|
+
export * from "./components/auth/organization/organization"
|
|
21
|
+
export * from "./components/auth/organization/organization-danger-zone"
|
|
22
|
+
export * from "./components/auth/organization/organization-invitations"
|
|
23
|
+
export * from "./components/auth/organization/organization-invitations-empty"
|
|
24
|
+
export * from "./components/auth/organization/organization-logo"
|
|
25
|
+
export * from "./components/auth/organization/organization-members"
|
|
26
|
+
export * from "./components/auth/organization/organization-people"
|
|
27
|
+
export * from "./components/auth/organization/organization-profile"
|
|
28
|
+
export * from "./components/auth/organization/organization-row"
|
|
29
|
+
export * from "./components/auth/organization/organization-settings"
|
|
30
|
+
export * from "./components/auth/organization/organization-switcher"
|
|
31
|
+
export * from "./components/auth/organization/organization-view"
|
|
32
|
+
export * from "./components/auth/organization/organization-view-skeleton"
|
|
33
|
+
export * from "./components/auth/organization/organizations"
|
|
34
|
+
export * from "./components/auth/organization/organizations-settings"
|
|
35
|
+
export * from "./components/auth/organization/user-invitations"
|
|
13
36
|
export * from "./components/auth/passkey/passkeys"
|
|
14
37
|
export * from "./components/auth/theme/appearance"
|
|
15
38
|
export * from "./components/auth/theme/theme-toggle-item"
|
|
@@ -20,6 +43,7 @@ export * from "./lib/auth/auth-plugin"
|
|
|
20
43
|
export * from "./lib/auth/delete-user-plugin"
|
|
21
44
|
export * from "./lib/auth/magic-link-plugin"
|
|
22
45
|
export * from "./lib/auth/multi-session-plugin"
|
|
46
|
+
export * from "./lib/auth/organization-plugin"
|
|
23
47
|
export * from "./lib/auth/passkey-plugin"
|
|
24
48
|
export * from "./lib/auth/theme-plugin"
|
|
25
49
|
export * from "./lib/auth/username-plugin"
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { CardProps } from '@heroui/react';
|
|
2
|
-
export type DeleteUserProps = {
|
|
3
|
-
className?: string;
|
|
4
|
-
variant?: CardProps["variant"];
|
|
5
|
-
};
|
|
6
|
-
/**
|
|
7
|
-
* Danger-zone card to delete the authenticated account, with a confirmation dialog and toasts.
|
|
8
|
-
*/
|
|
9
|
-
export declare function DeleteUser({ className, variant, ...props }: DeleteUserProps & Omit<CardProps, "children">): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { deleteUserPlugin as e } from "../../../lib/auth/delete-user-plugin.js";
|
|
2
|
-
import { authQueryKeys as t } from "@better-auth-ui/core";
|
|
3
|
-
import { useAuth as n, useAuthPlugin as r, useDeleteUser as i, useListAccounts as a } from "@better-auth-ui/react";
|
|
4
|
-
import { TriangleExclamation as o } from "@gravity-ui/icons";
|
|
5
|
-
import { AlertDialog as s, Button as c, Card as l, FieldError as u, Form as d, Input as f, Label as p, Spinner as m, TextField as h, toast as g } from "@heroui/react";
|
|
6
|
-
import { useState as _ } from "react";
|
|
7
|
-
import { jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
8
|
-
import { useQueryClient as b } from "@tanstack/react-query";
|
|
9
|
-
//#region src/components/auth/delete-user/delete-user.tsx
|
|
10
|
-
function x({ className: x, variant: S, ...C }) {
|
|
11
|
-
let { authClient: w, basePaths: T, localization: E, navigate: D, viewPaths: O } = n(), { localization: k, sendDeleteAccountVerification: A } = r(e), { data: j } = a(w), M = b(), [N, P] = _(!1), [F, I] = _(""), L = j?.some((e) => e.providerId === "credential"), R = !A && L, { mutate: z, isPending: B } = i(w), V = (e) => {
|
|
12
|
-
P(e), I("");
|
|
13
|
-
}, H = async (e) => {
|
|
14
|
-
e.preventDefault(), z({ ...R ? { password: F } : {} }, { onSuccess: () => {
|
|
15
|
-
P(!1), I(""), A ? g.success(k.deleteUserVerificationSent) : (g.success(k.deleteUserSuccess), M.removeQueries({ queryKey: t.all }), D({
|
|
16
|
-
to: `${T.auth}/${O.auth.signIn}`,
|
|
17
|
-
replace: !0
|
|
18
|
-
}));
|
|
19
|
-
} });
|
|
20
|
-
};
|
|
21
|
-
return /* @__PURE__ */ v(l, {
|
|
22
|
-
className: x,
|
|
23
|
-
variant: S,
|
|
24
|
-
...C,
|
|
25
|
-
children: /* @__PURE__ */ y(l.Content, {
|
|
26
|
-
className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",
|
|
27
|
-
children: [/* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("p", {
|
|
28
|
-
className: "text-sm font-medium leading-tight",
|
|
29
|
-
children: k.deleteUser
|
|
30
|
-
}), /* @__PURE__ */ v("p", {
|
|
31
|
-
className: "text-muted text-xs mt-0.5",
|
|
32
|
-
children: k.deleteUserDescription
|
|
33
|
-
})] }), /* @__PURE__ */ y(s, { children: [/* @__PURE__ */ v(c, {
|
|
34
|
-
isDisabled: !j,
|
|
35
|
-
size: "sm",
|
|
36
|
-
variant: "danger-soft",
|
|
37
|
-
onPress: () => P(!0),
|
|
38
|
-
children: k.deleteUser
|
|
39
|
-
}), /* @__PURE__ */ v(s.Backdrop, {
|
|
40
|
-
isOpen: N,
|
|
41
|
-
onOpenChange: V,
|
|
42
|
-
children: /* @__PURE__ */ v(s.Container, { children: /* @__PURE__ */ v(s.Dialog, { children: /* @__PURE__ */ y(d, {
|
|
43
|
-
onSubmit: H,
|
|
44
|
-
children: [
|
|
45
|
-
/* @__PURE__ */ v(s.CloseTrigger, {}),
|
|
46
|
-
/* @__PURE__ */ y(s.Header, { children: [/* @__PURE__ */ v(s.Icon, {
|
|
47
|
-
status: "danger",
|
|
48
|
-
children: /* @__PURE__ */ v(o, {})
|
|
49
|
-
}), /* @__PURE__ */ v(s.Heading, { children: k.deleteUser })] }),
|
|
50
|
-
/* @__PURE__ */ y(s.Body, {
|
|
51
|
-
className: "overflow-visible",
|
|
52
|
-
children: [/* @__PURE__ */ v("p", {
|
|
53
|
-
className: "text-muted text-sm",
|
|
54
|
-
children: k.deleteUserDescription
|
|
55
|
-
}), R && /* @__PURE__ */ y(h, {
|
|
56
|
-
className: "mt-4",
|
|
57
|
-
name: "password",
|
|
58
|
-
type: "password",
|
|
59
|
-
isDisabled: B,
|
|
60
|
-
value: F,
|
|
61
|
-
onChange: I,
|
|
62
|
-
children: [
|
|
63
|
-
/* @__PURE__ */ v(p, { children: E.auth.password }),
|
|
64
|
-
/* @__PURE__ */ v(f, {
|
|
65
|
-
autoComplete: "current-password",
|
|
66
|
-
placeholder: E.auth.passwordPlaceholder,
|
|
67
|
-
required: !0,
|
|
68
|
-
variant: "secondary"
|
|
69
|
-
}),
|
|
70
|
-
/* @__PURE__ */ v(u, {})
|
|
71
|
-
]
|
|
72
|
-
})]
|
|
73
|
-
}),
|
|
74
|
-
/* @__PURE__ */ y(s.Footer, { children: [/* @__PURE__ */ v(c, {
|
|
75
|
-
slot: "close",
|
|
76
|
-
variant: "tertiary",
|
|
77
|
-
isDisabled: B,
|
|
78
|
-
children: E.settings.cancel
|
|
79
|
-
}), /* @__PURE__ */ y(c, {
|
|
80
|
-
type: "submit",
|
|
81
|
-
variant: "danger",
|
|
82
|
-
isPending: B,
|
|
83
|
-
children: [B && /* @__PURE__ */ v(m, {
|
|
84
|
-
color: "current",
|
|
85
|
-
size: "sm"
|
|
86
|
-
}), k.deleteUser]
|
|
87
|
-
})] })
|
|
88
|
-
]
|
|
89
|
-
}) }) })
|
|
90
|
-
})] })]
|
|
91
|
-
})
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
//#endregion
|
|
95
|
-
export { x as DeleteUser };
|