@better-auth-ui/heroui 1.6.8 → 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.js +21 -64
- package/dist/components/auth/passkey/delete-passkey-dialog.js +13 -46
- 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.js +4 -16
- package/dist/components/auth/passkey/passkey.d.ts +1 -1
- package/dist/components/auth/passkey/passkey.js +16 -47
- package/dist/components/auth/passkey/passkeys-empty.js +8 -34
- package/dist/components/auth/passkey/passkeys.d.ts +1 -1
- package/dist/components/auth/passkey/passkeys.js +15 -41
- 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 +5 -5
- 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 +15 -2
- 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/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
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
import { createAuthPlugin } from "@better-auth-ui/core";
|
|
2
|
+
import { themePlugin as coreThemePlugin } from "@better-auth-ui/core/plugins";
|
|
3
|
+
import { Appearance } from "../../components/auth/theme/appearance";
|
|
4
|
+
import { ThemeToggleItem } from "../../components/auth/theme/theme-toggle-item";
|
|
5
|
+
export const themePlugin = createAuthPlugin(coreThemePlugin.id, ({ useTheme, ...rest }) => {
|
|
6
|
+
// No-op `setTheme` baseline keeps core's required option satisfied on the
|
|
7
|
+
// hook branch (where the consumer doesn't pass a setter); on the static
|
|
8
|
+
// branch the spread overrides it with the consumer's real setter.
|
|
9
|
+
const base = coreThemePlugin({ setTheme: () => { }, ...rest });
|
|
10
|
+
return {
|
|
11
|
+
...base,
|
|
12
|
+
// Slot components always call `plugin.useTheme()` — invoking the hook
|
|
13
|
+
// inside their render keeps it in scope of any `<ThemeProvider>` the
|
|
14
|
+
// consumer mounts. On the static branch the factory re-runs on every
|
|
15
|
+
// parent render, so the synthesized closure stays in sync with the
|
|
16
|
+
// consumer's `theme` state.
|
|
17
|
+
useTheme: useTheme ??
|
|
18
|
+
(() => ({
|
|
19
|
+
theme: base.theme,
|
|
20
|
+
setTheme: base.setTheme,
|
|
21
|
+
themes: base.themes
|
|
22
|
+
})),
|
|
23
|
+
userMenuItems: [ThemeToggleItem],
|
|
24
|
+
accountCards: [Appearance]
|
|
25
|
+
};
|
|
21
26
|
});
|
|
22
|
-
//#endregion
|
|
23
|
-
export { i as themePlugin };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { UsernamePluginOptions } from
|
|
2
|
-
import { SignInUsername } from
|
|
3
|
-
import { UsernameField } from
|
|
4
|
-
export declare const usernamePlugin: ((options?: UsernamePluginOptions | undefined) =>
|
|
1
|
+
import { type UsernamePluginOptions } from "@better-auth-ui/core/plugins";
|
|
2
|
+
import { SignInUsername } from "../../components/auth/username/sign-in-username";
|
|
3
|
+
import { UsernameField } from "../../components/auth/username/username-field";
|
|
4
|
+
export declare const usernamePlugin: ((options?: UsernamePluginOptions | undefined) => {
|
|
5
5
|
additionalFields: ({
|
|
6
6
|
name: string;
|
|
7
7
|
type: "string";
|
|
@@ -9,7 +9,7 @@ export declare const usernamePlugin: ((options?: UsernamePluginOptions | undefin
|
|
|
9
9
|
placeholder: string;
|
|
10
10
|
inputType: "input";
|
|
11
11
|
signUp: "above";
|
|
12
|
-
required:
|
|
12
|
+
required: true;
|
|
13
13
|
} | {
|
|
14
14
|
name: string;
|
|
15
15
|
type: "string";
|
|
@@ -26,7 +26,7 @@ export declare const usernamePlugin: ((options?: UsernamePluginOptions | undefin
|
|
|
26
26
|
placeholder: string;
|
|
27
27
|
inputType: "input";
|
|
28
28
|
signUp: "above";
|
|
29
|
-
required:
|
|
29
|
+
required: true;
|
|
30
30
|
} | {
|
|
31
31
|
render: typeof UsernameField;
|
|
32
32
|
name: string;
|
|
@@ -42,6 +42,8 @@ export declare const usernamePlugin: ((options?: UsernamePluginOptions | undefin
|
|
|
42
42
|
signIn: typeof SignInUsername;
|
|
43
43
|
};
|
|
44
44
|
};
|
|
45
|
+
minUsernameLength: number;
|
|
46
|
+
maxUsernameLength: number;
|
|
45
47
|
localization: {
|
|
46
48
|
username: string;
|
|
47
49
|
usernamePlaceholder: string;
|
|
@@ -51,12 +53,10 @@ export declare const usernamePlugin: ((options?: UsernamePluginOptions | undefin
|
|
|
51
53
|
displayUsername: string;
|
|
52
54
|
displayUsernamePlaceholder: string;
|
|
53
55
|
};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
minUsernameLength: number;
|
|
57
|
-
maxUsernameLength: number;
|
|
56
|
+
displayUsername?: boolean;
|
|
57
|
+
isUsernameAvailable?: boolean;
|
|
58
58
|
id: "username";
|
|
59
|
-
}
|
|
59
|
+
} & {
|
|
60
60
|
id: "username";
|
|
61
61
|
}) & {
|
|
62
62
|
id: "username";
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { createAuthPlugin } from "@better-auth-ui/core";
|
|
2
|
+
import { usernamePlugin as coreUsernamePlugin } from "@better-auth-ui/core/plugins";
|
|
3
|
+
import { SignInUsername } from "../../components/auth/username/sign-in-username";
|
|
4
|
+
import { UsernameField } from "../../components/auth/username/username-field";
|
|
5
|
+
export const usernamePlugin = createAuthPlugin(coreUsernamePlugin.id, (options = {}) => {
|
|
6
|
+
const core = coreUsernamePlugin(options);
|
|
7
|
+
return {
|
|
8
|
+
...core,
|
|
9
|
+
additionalFields: core.additionalFields?.map((field) => field.name === "username"
|
|
10
|
+
? {
|
|
11
|
+
...field,
|
|
12
|
+
render: UsernameField
|
|
13
|
+
}
|
|
14
|
+
: field),
|
|
15
|
+
views: {
|
|
16
|
+
auth: { signIn: SignInUsername }
|
|
17
|
+
}
|
|
18
|
+
};
|
|
16
19
|
});
|
|
17
|
-
//#endregion
|
|
18
|
-
export { i as usernamePlugin };
|
package/dist/plugins.d.ts
CHANGED
|
@@ -1,22 +1,46 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
11
|
-
export * from
|
|
12
|
-
export * from
|
|
13
|
-
export * from
|
|
14
|
-
export * from
|
|
15
|
-
export * from
|
|
16
|
-
export * from
|
|
17
|
-
export * from
|
|
18
|
-
export * from
|
|
19
|
-
export * from
|
|
20
|
-
export * from
|
|
21
|
-
export * from
|
|
22
|
-
export * from
|
|
1
|
+
export * from "./components/auth/api-key/api-keys";
|
|
2
|
+
export * from "./components/auth/api-key/organization-api-keys";
|
|
3
|
+
export * from "./components/auth/delete-user/danger-zone";
|
|
4
|
+
export * from "./components/auth/delete-user/delete-account";
|
|
5
|
+
export * from "./components/auth/magic-link/magic-link";
|
|
6
|
+
export * from "./components/auth/multi-session/manage-account";
|
|
7
|
+
export * from "./components/auth/multi-session/manage-accounts";
|
|
8
|
+
export * from "./components/auth/multi-session/switch-account-submenu";
|
|
9
|
+
export * from "./components/auth/multi-session/switch-account-submenu-content";
|
|
10
|
+
export * from "./components/auth/multi-session/switch-account-submenu-item";
|
|
11
|
+
export * from "./components/auth/organization/change-organization-logo";
|
|
12
|
+
export * from "./components/auth/organization/create-organization-dialog";
|
|
13
|
+
export * from "./components/auth/organization/delete-organization";
|
|
14
|
+
export * from "./components/auth/organization/delete-organization-skeleton";
|
|
15
|
+
export * from "./components/auth/organization/invite-member-dialog";
|
|
16
|
+
export * from "./components/auth/organization/leave-organization";
|
|
17
|
+
export * from "./components/auth/organization/organization";
|
|
18
|
+
export * from "./components/auth/organization/organization-danger-zone";
|
|
19
|
+
export * from "./components/auth/organization/organization-invitations";
|
|
20
|
+
export * from "./components/auth/organization/organization-invitations-empty";
|
|
21
|
+
export * from "./components/auth/organization/organization-logo";
|
|
22
|
+
export * from "./components/auth/organization/organization-members";
|
|
23
|
+
export * from "./components/auth/organization/organization-people";
|
|
24
|
+
export * from "./components/auth/organization/organization-profile";
|
|
25
|
+
export * from "./components/auth/organization/organization-row";
|
|
26
|
+
export * from "./components/auth/organization/organization-settings";
|
|
27
|
+
export * from "./components/auth/organization/organization-switcher";
|
|
28
|
+
export * from "./components/auth/organization/organization-view";
|
|
29
|
+
export * from "./components/auth/organization/organization-view-skeleton";
|
|
30
|
+
export * from "./components/auth/organization/organizations";
|
|
31
|
+
export * from "./components/auth/organization/organizations-settings";
|
|
32
|
+
export * from "./components/auth/organization/user-invitations";
|
|
33
|
+
export * from "./components/auth/passkey/passkeys";
|
|
34
|
+
export * from "./components/auth/theme/appearance";
|
|
35
|
+
export * from "./components/auth/theme/theme-toggle-item";
|
|
36
|
+
export * from "./components/auth/username/sign-in-username";
|
|
37
|
+
export * from "./components/auth/username/username-field";
|
|
38
|
+
export * from "./lib/auth/api-key-plugin";
|
|
39
|
+
export * from "./lib/auth/auth-plugin";
|
|
40
|
+
export * from "./lib/auth/delete-user-plugin";
|
|
41
|
+
export * from "./lib/auth/magic-link-plugin";
|
|
42
|
+
export * from "./lib/auth/multi-session-plugin";
|
|
43
|
+
export * from "./lib/auth/organization-plugin";
|
|
44
|
+
export * from "./lib/auth/passkey-plugin";
|
|
45
|
+
export * from "./lib/auth/theme-plugin";
|
|
46
|
+
export * from "./lib/auth/username-plugin";
|
package/dist/plugins.js
CHANGED
|
@@ -1,23 +1,48 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
export
|
|
2
|
+
export * from "./components/auth/api-key/api-keys";
|
|
3
|
+
export * from "./components/auth/api-key/organization-api-keys";
|
|
4
|
+
export * from "./components/auth/delete-user/danger-zone";
|
|
5
|
+
export * from "./components/auth/delete-user/delete-account";
|
|
6
|
+
// Plugin-contributed components that may be used standalone
|
|
7
|
+
export * from "./components/auth/magic-link/magic-link";
|
|
8
|
+
export * from "./components/auth/multi-session/manage-account";
|
|
9
|
+
export * from "./components/auth/multi-session/manage-accounts";
|
|
10
|
+
export * from "./components/auth/multi-session/switch-account-submenu";
|
|
11
|
+
export * from "./components/auth/multi-session/switch-account-submenu-content";
|
|
12
|
+
export * from "./components/auth/multi-session/switch-account-submenu-item";
|
|
13
|
+
export * from "./components/auth/organization/change-organization-logo";
|
|
14
|
+
export * from "./components/auth/organization/create-organization-dialog";
|
|
15
|
+
export * from "./components/auth/organization/delete-organization";
|
|
16
|
+
export * from "./components/auth/organization/delete-organization-skeleton";
|
|
17
|
+
export * from "./components/auth/organization/invite-member-dialog";
|
|
18
|
+
export * from "./components/auth/organization/leave-organization";
|
|
19
|
+
export * from "./components/auth/organization/organization";
|
|
20
|
+
export * from "./components/auth/organization/organization-danger-zone";
|
|
21
|
+
export * from "./components/auth/organization/organization-invitations";
|
|
22
|
+
export * from "./components/auth/organization/organization-invitations-empty";
|
|
23
|
+
export * from "./components/auth/organization/organization-logo";
|
|
24
|
+
export * from "./components/auth/organization/organization-members";
|
|
25
|
+
export * from "./components/auth/organization/organization-people";
|
|
26
|
+
export * from "./components/auth/organization/organization-profile";
|
|
27
|
+
export * from "./components/auth/organization/organization-row";
|
|
28
|
+
export * from "./components/auth/organization/organization-settings";
|
|
29
|
+
export * from "./components/auth/organization/organization-switcher";
|
|
30
|
+
export * from "./components/auth/organization/organization-view";
|
|
31
|
+
export * from "./components/auth/organization/organization-view-skeleton";
|
|
32
|
+
export * from "./components/auth/organization/organizations";
|
|
33
|
+
export * from "./components/auth/organization/organizations-settings";
|
|
34
|
+
export * from "./components/auth/organization/user-invitations";
|
|
35
|
+
export * from "./components/auth/passkey/passkeys";
|
|
36
|
+
export * from "./components/auth/theme/appearance";
|
|
37
|
+
export * from "./components/auth/theme/theme-toggle-item";
|
|
38
|
+
export * from "./components/auth/username/sign-in-username";
|
|
39
|
+
export * from "./components/auth/username/username-field";
|
|
40
|
+
export * from "./lib/auth/api-key-plugin";
|
|
41
|
+
export * from "./lib/auth/auth-plugin";
|
|
42
|
+
export * from "./lib/auth/delete-user-plugin";
|
|
43
|
+
export * from "./lib/auth/magic-link-plugin";
|
|
44
|
+
export * from "./lib/auth/multi-session-plugin";
|
|
45
|
+
export * from "./lib/auth/organization-plugin";
|
|
46
|
+
export * from "./lib/auth/passkey-plugin";
|
|
47
|
+
export * from "./lib/auth/theme-plugin";
|
|
48
|
+
export * from "./lib/auth/username-plugin";
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-auth-ui/heroui",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"build": "
|
|
7
|
-
"
|
|
6
|
+
"build": "tsc && bun run styles",
|
|
7
|
+
"styles": "mkdir -p dist && cp src/styles.css dist/styles.css",
|
|
8
8
|
"test": "vitest"
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
@@ -13,48 +13,54 @@
|
|
|
13
13
|
],
|
|
14
14
|
"exports": {
|
|
15
15
|
".": {
|
|
16
|
+
"development": "./src/index.tsx",
|
|
16
17
|
"types": "./dist/index.d.ts",
|
|
17
18
|
"import": "./dist/index.js"
|
|
18
19
|
},
|
|
19
20
|
"./email": {
|
|
21
|
+
"development": "./src/email.ts",
|
|
20
22
|
"types": "./dist/email.d.ts",
|
|
21
23
|
"import": "./dist/email.js"
|
|
22
24
|
},
|
|
23
25
|
"./plugins": {
|
|
26
|
+
"development": "./src/plugins.ts",
|
|
24
27
|
"types": "./dist/plugins.d.ts",
|
|
25
28
|
"import": "./dist/plugins.js"
|
|
26
29
|
},
|
|
27
|
-
"./styles":
|
|
30
|
+
"./styles": {
|
|
31
|
+
"development": "./src/styles.css",
|
|
32
|
+
"default": "./dist/styles.css"
|
|
33
|
+
}
|
|
28
34
|
},
|
|
29
35
|
"devDependencies": {
|
|
30
36
|
"@gravity-ui/icons": "^2.18.0",
|
|
31
|
-
"@heroui/react": "^3.0
|
|
32
|
-
"@heroui/styles": "^3.0
|
|
37
|
+
"@heroui/react": "^3.1.0",
|
|
38
|
+
"@heroui/styles": "^3.1.0",
|
|
33
39
|
"@internationalized/date": "^3.12.1",
|
|
34
|
-
"@tanstack/react-pacer": "^0.22.
|
|
35
|
-
"@tanstack/react-query": "^5.100.
|
|
40
|
+
"@tanstack/react-pacer": "^0.22.1",
|
|
41
|
+
"@tanstack/react-query": "^5.100.14",
|
|
36
42
|
"@testing-library/react": "^16.3.2",
|
|
37
43
|
"@testing-library/user-event": "^14.5.2",
|
|
38
|
-
"@types/react": "^19.2.
|
|
39
|
-
"@vitejs/plugin-react": "^6.0.
|
|
40
|
-
"@vitest/browser-playwright": "^4.1.
|
|
41
|
-
"better-auth": "^1.6.
|
|
44
|
+
"@types/react": "^19.2.15",
|
|
45
|
+
"@vitejs/plugin-react": "^6.0.2",
|
|
46
|
+
"@vitest/browser-playwright": "^4.1.7",
|
|
47
|
+
"better-auth": "^1.6.11",
|
|
42
48
|
"bowser": "^2.11.0",
|
|
43
|
-
"playwright": "^1.
|
|
49
|
+
"playwright": "^1.60.0",
|
|
44
50
|
"react": "^19.2.6",
|
|
45
51
|
"react-dom": "^19.2.6",
|
|
46
|
-
"vitest": "^4.1.
|
|
52
|
+
"vitest": "^4.1.7"
|
|
47
53
|
},
|
|
48
54
|
"peerDependencies": {
|
|
49
55
|
"@better-auth-ui/core": "*",
|
|
50
56
|
"@better-auth-ui/react": "*",
|
|
51
57
|
"@gravity-ui/icons": ">=2.18.0",
|
|
52
|
-
"@heroui/react": ">=3.0
|
|
53
|
-
"@heroui/styles": ">=3.0
|
|
58
|
+
"@heroui/react": ">=3.1.0",
|
|
59
|
+
"@heroui/styles": ">=3.1.0",
|
|
54
60
|
"@internationalized/date": ">=3.12.1",
|
|
55
|
-
"@tanstack/react-pacer": ">=0.22.
|
|
56
|
-
"@tanstack/react-query": ">=5.100.
|
|
57
|
-
"better-auth": ">=1.6.
|
|
61
|
+
"@tanstack/react-pacer": ">=0.22.1",
|
|
62
|
+
"@tanstack/react-query": ">=5.100.14",
|
|
63
|
+
"better-auth": ">=1.6.11",
|
|
58
64
|
"react": ">=19.2.6",
|
|
59
65
|
"react-dom": ">=19.2.6",
|
|
60
66
|
"bowser": ">=2.11.0"
|
|
@@ -12,9 +12,13 @@ import { DeleteApiKeyDialog } from "./delete-api-key-dialog"
|
|
|
12
12
|
|
|
13
13
|
export type ApiKeyProps = {
|
|
14
14
|
apiKey: ListedApiKey
|
|
15
|
+
/** Hide the row's delete button (e.g., when caller lacks `apiKey:delete`). */
|
|
16
|
+
hideDelete?: boolean
|
|
17
|
+
/** Scope the delete payload to an organization (sets `configId`). */
|
|
18
|
+
organizationId?: string
|
|
15
19
|
}
|
|
16
20
|
|
|
17
|
-
export function ApiKey({ apiKey }: ApiKeyProps) {
|
|
21
|
+
export function ApiKey({ apiKey, hideDelete, organizationId }: ApiKeyProps) {
|
|
18
22
|
const { localization } = useAuth()
|
|
19
23
|
const { localization: apiKeyLocalization } = useAuthPlugin(apiKeyPlugin)
|
|
20
24
|
const [deleteOpen, setDeleteOpen] = useState(false)
|
|
@@ -42,23 +46,28 @@ export function ApiKey({ apiKey }: ApiKeyProps) {
|
|
|
42
46
|
</span>
|
|
43
47
|
</div>
|
|
44
48
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
{!hideDelete && (
|
|
50
|
+
<>
|
|
51
|
+
<Button
|
|
52
|
+
className="ml-auto shrink-0"
|
|
53
|
+
variant="outline"
|
|
54
|
+
size="sm"
|
|
55
|
+
onPress={() => setDeleteOpen(true)}
|
|
56
|
+
aria-label={apiKeyLocalization.deleteApiKey}
|
|
57
|
+
>
|
|
58
|
+
<Xmark />
|
|
53
59
|
|
|
54
|
-
|
|
55
|
-
|
|
60
|
+
{localization.settings.delete}
|
|
61
|
+
</Button>
|
|
56
62
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
63
|
+
<DeleteApiKeyDialog
|
|
64
|
+
isOpen={deleteOpen}
|
|
65
|
+
onOpenChange={setDeleteOpen}
|
|
66
|
+
apiKey={apiKey}
|
|
67
|
+
organizationId={organizationId}
|
|
68
|
+
/>
|
|
69
|
+
</>
|
|
70
|
+
)}
|
|
62
71
|
</div>
|
|
63
72
|
)
|
|
64
73
|
}
|
|
@@ -6,9 +6,11 @@ import { apiKeyPlugin } from "../../../lib/auth/api-key-plugin"
|
|
|
6
6
|
|
|
7
7
|
export type ApiKeysEmptyProps = {
|
|
8
8
|
onCreatePress: () => void
|
|
9
|
+
/** Hide the empty-state "Create API key" button. */
|
|
10
|
+
hideCreate?: boolean
|
|
9
11
|
}
|
|
10
12
|
|
|
11
|
-
export function ApiKeysEmpty({ onCreatePress }: ApiKeysEmptyProps) {
|
|
13
|
+
export function ApiKeysEmpty({ onCreatePress, hideCreate }: ApiKeysEmptyProps) {
|
|
12
14
|
const { localization: apiKeyLocalization } = useAuthPlugin(apiKeyPlugin)
|
|
13
15
|
|
|
14
16
|
return (
|
|
@@ -25,9 +27,11 @@ export function ApiKeysEmpty({ onCreatePress }: ApiKeysEmptyProps) {
|
|
|
25
27
|
</p>
|
|
26
28
|
</div>
|
|
27
29
|
|
|
28
|
-
|
|
29
|
-
{
|
|
30
|
-
|
|
30
|
+
{!hideCreate && (
|
|
31
|
+
<Button size="sm" onPress={onCreatePress}>
|
|
32
|
+
{apiKeyLocalization.createApiKey}
|
|
33
|
+
</Button>
|
|
34
|
+
)}
|
|
31
35
|
</div>
|
|
32
36
|
)
|
|
33
37
|
}
|
|
@@ -16,16 +16,39 @@ import { CreateApiKeyDialog } from "./create-api-key-dialog"
|
|
|
16
16
|
export type ApiKeysProps = {
|
|
17
17
|
className?: string
|
|
18
18
|
variant?: CardProps["variant"]
|
|
19
|
+
/** Scope the list and create payload to an organization. */
|
|
20
|
+
organizationId?: string
|
|
21
|
+
/** Force the loading skeleton and disable the list query. */
|
|
22
|
+
isPending?: boolean
|
|
23
|
+
/** Hide the "Create API key" button (header + empty state). */
|
|
24
|
+
hideCreate?: boolean
|
|
25
|
+
/** Hide the per-row delete button on listed keys. */
|
|
26
|
+
hideDelete?: boolean
|
|
19
27
|
}
|
|
20
28
|
|
|
21
|
-
export function ApiKeys({
|
|
29
|
+
export function ApiKeys({
|
|
30
|
+
className,
|
|
31
|
+
variant,
|
|
32
|
+
organizationId,
|
|
33
|
+
isPending: isPendingProp,
|
|
34
|
+
hideCreate,
|
|
35
|
+
hideDelete
|
|
36
|
+
}: ApiKeysProps) {
|
|
22
37
|
const { authClient } = useAuth()
|
|
23
38
|
const { localization: apiKeyLocalization } = useAuthPlugin(apiKeyPlugin)
|
|
24
39
|
|
|
25
|
-
const { data: listData, isPending } = useListApiKeys(
|
|
26
|
-
authClient as ApiKeyAuthClient
|
|
40
|
+
const { data: listData, isPending: isListPending } = useListApiKeys(
|
|
41
|
+
authClient as ApiKeyAuthClient,
|
|
42
|
+
{
|
|
43
|
+
enabled: !isPendingProp,
|
|
44
|
+
...(organizationId
|
|
45
|
+
? { query: { organizationId, configId: "organization" } }
|
|
46
|
+
: {})
|
|
47
|
+
}
|
|
27
48
|
)
|
|
28
49
|
|
|
50
|
+
const isPending = isPendingProp || isListPending
|
|
51
|
+
|
|
29
52
|
const [createOpen, setCreateOpen] = useState(false)
|
|
30
53
|
|
|
31
54
|
return (
|
|
@@ -35,14 +58,16 @@ export function ApiKeys({ className, variant }: ApiKeysProps) {
|
|
|
35
58
|
{apiKeyLocalization.apiKeys}
|
|
36
59
|
</h2>
|
|
37
60
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
61
|
+
{!hideCreate && (
|
|
62
|
+
<Button
|
|
63
|
+
className="shrink-0"
|
|
64
|
+
size="sm"
|
|
65
|
+
isDisabled={isPending}
|
|
66
|
+
onPress={() => setCreateOpen(true)}
|
|
67
|
+
>
|
|
68
|
+
{apiKeyLocalization.createApiKey}
|
|
69
|
+
</Button>
|
|
70
|
+
)}
|
|
46
71
|
</div>
|
|
47
72
|
|
|
48
73
|
<Card variant={variant}>
|
|
@@ -50,7 +75,10 @@ export function ApiKeys({ className, variant }: ApiKeysProps) {
|
|
|
50
75
|
{isPending ? (
|
|
51
76
|
<ApiKeySkeleton />
|
|
52
77
|
) : !listData?.apiKeys.length ? (
|
|
53
|
-
<ApiKeysEmpty
|
|
78
|
+
<ApiKeysEmpty
|
|
79
|
+
onCreatePress={() => setCreateOpen(true)}
|
|
80
|
+
hideCreate={hideCreate}
|
|
81
|
+
/>
|
|
54
82
|
) : (
|
|
55
83
|
listData?.apiKeys.map((key, index) => (
|
|
56
84
|
<div key={key.id}>
|
|
@@ -58,14 +86,24 @@ export function ApiKeys({ className, variant }: ApiKeysProps) {
|
|
|
58
86
|
<div className="border-b border-dashed -mx-4 my-4" />
|
|
59
87
|
)}
|
|
60
88
|
|
|
61
|
-
<ApiKey
|
|
89
|
+
<ApiKey
|
|
90
|
+
apiKey={key}
|
|
91
|
+
hideDelete={hideDelete}
|
|
92
|
+
organizationId={organizationId}
|
|
93
|
+
/>
|
|
62
94
|
</div>
|
|
63
95
|
))
|
|
64
96
|
)}
|
|
65
97
|
</Card.Content>
|
|
66
98
|
</Card>
|
|
67
99
|
|
|
68
|
-
|
|
100
|
+
{!hideCreate && (
|
|
101
|
+
<CreateApiKeyDialog
|
|
102
|
+
isOpen={createOpen}
|
|
103
|
+
onOpenChange={setCreateOpen}
|
|
104
|
+
organizationId={organizationId}
|
|
105
|
+
/>
|
|
106
|
+
)}
|
|
69
107
|
</div>
|
|
70
108
|
)
|
|
71
109
|
}
|
|
@@ -24,11 +24,14 @@ import { NewApiKeyDialog } from "./new-api-key-dialog"
|
|
|
24
24
|
export type CreateApiKeyDialogProps = {
|
|
25
25
|
isOpen: boolean
|
|
26
26
|
onOpenChange: (open: boolean) => void
|
|
27
|
+
/** Create an organization-owned key by passing the organization id. */
|
|
28
|
+
organizationId?: string
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
export function CreateApiKeyDialog({
|
|
30
32
|
isOpen,
|
|
31
|
-
onOpenChange
|
|
33
|
+
onOpenChange,
|
|
34
|
+
organizationId
|
|
32
35
|
}: CreateApiKeyDialogProps) {
|
|
33
36
|
const { authClient, localization } = useAuth()
|
|
34
37
|
const { localization: apiKeyLocalization } = useAuthPlugin(apiKeyPlugin)
|
|
@@ -56,7 +59,17 @@ export function CreateApiKeyDialog({
|
|
|
56
59
|
const formData = new FormData(e.target as HTMLFormElement)
|
|
57
60
|
const name = (formData.get("name") as string)?.trim()
|
|
58
61
|
|
|
59
|
-
|
|
62
|
+
const payload =
|
|
63
|
+
name || organizationId
|
|
64
|
+
? {
|
|
65
|
+
...(name ? { name } : {}),
|
|
66
|
+
...(organizationId
|
|
67
|
+
? { organizationId, configId: "organization" }
|
|
68
|
+
: {})
|
|
69
|
+
}
|
|
70
|
+
: undefined
|
|
71
|
+
|
|
72
|
+
createApiKey(payload, {
|
|
60
73
|
onSuccess: (result) => {
|
|
61
74
|
handleOpenChange(false)
|
|
62
75
|
setKeyName(name)
|
|
@@ -21,12 +21,15 @@ export type DeleteApiKeyDialogProps = {
|
|
|
21
21
|
isOpen: boolean
|
|
22
22
|
onOpenChange: (open: boolean) => void
|
|
23
23
|
apiKey: ListedApiKey
|
|
24
|
+
/** Scope the delete payload to an organization (sets `configId`). */
|
|
25
|
+
organizationId?: string
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
export function DeleteApiKeyDialog({
|
|
27
29
|
isOpen,
|
|
28
30
|
onOpenChange,
|
|
29
|
-
apiKey
|
|
31
|
+
apiKey,
|
|
32
|
+
organizationId
|
|
30
33
|
}: DeleteApiKeyDialogProps) {
|
|
31
34
|
const { authClient, localization } = useAuth()
|
|
32
35
|
const { localization: apiKeyLocalization } = useAuthPlugin(apiKeyPlugin)
|
|
@@ -77,7 +80,12 @@ export function DeleteApiKeyDialog({
|
|
|
77
80
|
|
|
78
81
|
<Button
|
|
79
82
|
variant="danger"
|
|
80
|
-
onPress={() =>
|
|
83
|
+
onPress={() =>
|
|
84
|
+
deleteApiKey({
|
|
85
|
+
keyId: apiKey.id,
|
|
86
|
+
...(organizationId ? { configId: "organization" } : {})
|
|
87
|
+
})
|
|
88
|
+
}
|
|
81
89
|
isPending={isDeleting}
|
|
82
90
|
>
|
|
83
91
|
{isDeleting && <Spinner color="current" size="sm" />}
|