@better-auth-ui/core 1.6.9 → 1.6.11

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 (63) hide show
  1. package/dist/config/auth-config.d.ts +8 -8
  2. package/dist/config/index.d.ts +4 -4
  3. package/dist/create-auth-plugin-CnH7jMHA.js +199 -0
  4. package/dist/index.d.ts +11 -11
  5. package/dist/index.js +103 -11
  6. package/dist/lib/auth-plugin.d.ts +1 -1
  7. package/dist/lib/create-auth-plugin.d.ts +1 -1
  8. package/dist/lib/provider-names.d.ts +1 -1
  9. package/dist/lib/utils.d.ts +1 -1
  10. package/dist/plugins/api-key/api-key-plugin.d.ts +1 -1
  11. package/dist/plugins/delete-user/delete-user-plugin.d.ts +1 -1
  12. package/dist/plugins/magic-link/magic-link-plugin.d.ts +1 -1
  13. package/dist/plugins/multi-session/multi-session-plugin.d.ts +1 -1
  14. package/dist/plugins/organization/organization-plugin.d.ts +3 -3
  15. package/dist/plugins/passkey/passkey-plugin.d.ts +1 -1
  16. package/dist/plugins/theme/theme-plugin.d.ts +1 -1
  17. package/dist/plugins/username/username-plugin.d.ts +1 -1
  18. package/dist/plugins.d.ts +28 -28
  19. package/dist/plugins.js +360 -28
  20. package/package.json +2 -2
  21. package/dist/config/additional-fields-config.js +0 -39
  22. package/dist/config/auth-config.js +0 -34
  23. package/dist/config/avatar-config.js +0 -1
  24. package/dist/config/email-and-password-config.js +0 -1
  25. package/dist/config/index.js +0 -4
  26. package/dist/lib/auth-mutation-keys.js +0 -70
  27. package/dist/lib/auth-plugin.js +0 -1
  28. package/dist/lib/auth-query-keys.js +0 -42
  29. package/dist/lib/base-paths.js +0 -5
  30. package/dist/lib/create-auth-plugin.js +0 -23
  31. package/dist/lib/deep-partial.js +0 -1
  32. package/dist/lib/localization.js +0 -150
  33. package/dist/lib/provider-names.js +0 -50
  34. package/dist/lib/utils.js +0 -116
  35. package/dist/lib/view-paths.js +0 -13
  36. package/dist/plugins/api-key/api-key-localization.js +0 -24
  37. package/dist/plugins/api-key/api-key-mutation-keys.js +0 -11
  38. package/dist/plugins/api-key/api-key-plugin.js +0 -6
  39. package/dist/plugins/api-key/api-key-query-keys.js +0 -7
  40. package/dist/plugins/delete-user/delete-user-localization.js +0 -10
  41. package/dist/plugins/delete-user/delete-user-mutation-keys.js +0 -7
  42. package/dist/plugins/delete-user/delete-user-plugin.js +0 -6
  43. package/dist/plugins/magic-link/magic-link-localization.js +0 -8
  44. package/dist/plugins/magic-link/magic-link-mutation-keys.js +0 -17
  45. package/dist/plugins/magic-link/magic-link-plugin.js +0 -8
  46. package/dist/plugins/multi-session/multi-session-localization.js +0 -10
  47. package/dist/plugins/multi-session/multi-session-mutation-keys.js +0 -11
  48. package/dist/plugins/multi-session/multi-session-plugin.js +0 -5
  49. package/dist/plugins/multi-session/multi-session-query-keys.js +0 -7
  50. package/dist/plugins/organization/organization-localization.js +0 -114
  51. package/dist/plugins/organization/organization-mutation-keys.js +0 -40
  52. package/dist/plugins/organization/organization-plugin.js +0 -35
  53. package/dist/plugins/organization/organization-query-keys.js +0 -54
  54. package/dist/plugins/organization/organization-view-paths.js +0 -1
  55. package/dist/plugins/passkey/passkey-localization.js +0 -20
  56. package/dist/plugins/passkey/passkey-mutation-keys.js +0 -15
  57. package/dist/plugins/passkey/passkey-plugin.js +0 -5
  58. package/dist/plugins/passkey/passkey-query-keys.js +0 -7
  59. package/dist/plugins/theme/theme-localization.js +0 -12
  60. package/dist/plugins/theme/theme-plugin.js +0 -8
  61. package/dist/plugins/username/username-localization.js +0 -16
  62. package/dist/plugins/username/username-mutation-keys.js +0 -17
  63. package/dist/plugins/username/username-plugin.js +0 -36
@@ -1,35 +0,0 @@
1
- import { defaultAuthConfig } from "../../config";
2
- import { createAuthPlugin } from "../../lib/create-auth-plugin";
3
- import { organizationLocalization } from "./organization-localization";
4
- export const organizationPlugin = createAuthPlugin("organization", (options = {}) => {
5
- const localization = {
6
- ...organizationLocalization,
7
- ...options.localization
8
- };
9
- return {
10
- slug: options.slug,
11
- checkSlug: options.checkSlug ?? true,
12
- localization,
13
- logo: {
14
- ...defaultAuthConfig.avatar,
15
- ...options.logo
16
- },
17
- roles: {
18
- ...(options.roles ?? {
19
- owner: localization.owner,
20
- admin: localization.admin,
21
- member: localization.member
22
- }),
23
- ...options.additionalRoles
24
- },
25
- viewPaths: {
26
- settings: {
27
- organizations: options.viewPaths?.settings?.organizations ?? "organizations"
28
- },
29
- organization: {
30
- settings: options.viewPaths?.organization?.settings ?? "settings",
31
- people: options.viewPaths?.organization?.people ?? "people"
32
- }
33
- }
34
- };
35
- });
@@ -1,54 +0,0 @@
1
- import { authQueryKeys } from "../../lib/auth-query-keys";
2
- /** Query key factory for organization queries, scoped per user. */
3
- export const organizationQueryKeys = {
4
- all: (userId) => [...authQueryKeys.user(userId), "organization"],
5
- lists: (userId) => [...organizationQueryKeys.all(userId), "list"],
6
- list: (userId, query) => [...organizationQueryKeys.lists(userId), query ?? null],
7
- fullDetails: (userId) => [...organizationQueryKeys.all(userId), "fullDetails"],
8
- fullDetail: (userId, query) => [...organizationQueryKeys.fullDetails(userId), query ?? null],
9
- /**
10
- * Prefix for every active-organization cache entry (used for invalidation
11
- * across slug-partitioned variants).
12
- */
13
- activeOrganizations: (userId) => [...organizationQueryKeys.all(userId), "active"],
14
- /**
15
- * Cache entry for the currently active organization. Holds a {@link
16
- * ListOrganization}-shaped value — distinct from `fullDetail`, which
17
- * carries members and invitations — so `setActive`'s optimistic update
18
- * (which can only produce a list-shaped org) doesn't corrupt the full
19
- * cache.
20
- */
21
- activeOrganization: (userId, query) => [
22
- ...organizationQueryKeys.activeOrganizations(userId),
23
- query ?? null
24
- ],
25
- members: {
26
- all: (userId) => [...organizationQueryKeys.all(userId), "members"],
27
- lists: (userId) => [...organizationQueryKeys.members.all(userId), "list"],
28
- list: (userId, query) => [...organizationQueryKeys.members.lists(userId), query ?? null]
29
- },
30
- invitations: {
31
- all: (userId) => [...organizationQueryKeys.all(userId), "invitations"],
32
- lists: (userId) => [...organizationQueryKeys.invitations.all(userId), "list"],
33
- list: (userId, query) => [
34
- ...organizationQueryKeys.invitations.lists(userId),
35
- query ?? null
36
- ]
37
- },
38
- userInvitations: {
39
- all: (userId) => [...organizationQueryKeys.all(userId), "userInvitations"],
40
- lists: (userId) => [...organizationQueryKeys.userInvitations.all(userId), "list"],
41
- list: (userId, query) => [
42
- ...organizationQueryKeys.userInvitations.lists(userId),
43
- query ?? null
44
- ]
45
- },
46
- permissions: {
47
- all: (userId) => [...organizationQueryKeys.all(userId), "permissions"],
48
- has: (userId, query) => [
49
- ...organizationQueryKeys.permissions.all(userId),
50
- "has",
51
- query ?? null
52
- ]
53
- }
54
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,20 +0,0 @@
1
- export const passkeyLocalization = {
2
- /** @remarks `"Passkey"` */
3
- passkey: "Passkey",
4
- /** @remarks `"Add passkey"` */
5
- addPasskey: "Add passkey",
6
- /** @remarks `"Delete passkey {{name}}"` */
7
- deletePasskey: "Delete passkey {{name}}",
8
- /** @remarks `"Delete passkey"` */
9
- deletePasskeyTitle: "Delete passkey",
10
- /** @remarks `"This action cannot be undone. You will need to add this passkey again before you can use it to sign in."` */
11
- deletePasskeyWarning: "This action cannot be undone. You will need to add this passkey again before you can use it to sign in.",
12
- /** @remarks `"Passkeys"` */
13
- passkeys: "Passkeys",
14
- /** @remarks `"Create a passkey to securely access your account."` */
15
- passkeysDescription: "Create a passkey to securely access your account.",
16
- /** @remarks `"No passkeys"` */
17
- noPasskeys: "No passkeys",
18
- /** @remarks `"Name"` */
19
- name: "Name"
20
- };
@@ -1,15 +0,0 @@
1
- /**
2
- * Mutation keys contributed by the passkey plugin.
3
- *
4
- * `signIn` is kept under the shared `["auth", "signIn", ...]` namespace so
5
- * consumers can match the whole sign-in surface with
6
- * `useIsMutating({ mutationKey: ["auth", "signIn"] })`.
7
- */
8
- export const passkeyMutationKeys = {
9
- /** Key for `signIn.passkey`. */
10
- signIn: ["auth", "signIn", "passkey"],
11
- /** Key for `passkey.addPasskey`. */
12
- addPasskey: ["auth", "passkey", "addPasskey"],
13
- /** Key for `passkey.deletePasskey`. */
14
- deletePasskey: ["auth", "passkey", "deletePasskey"]
15
- };
@@ -1,5 +0,0 @@
1
- import { createAuthPlugin } from "../../lib/create-auth-plugin";
2
- import { passkeyLocalization } from "./passkey-localization";
3
- export const passkeyPlugin = createAuthPlugin("passkey", (options = {}) => ({
4
- localization: { ...passkeyLocalization, ...options.localization }
5
- }));
@@ -1,7 +0,0 @@
1
- import { authQueryKeys } from "../../lib/auth-query-keys";
2
- /** Query key factory for passkey queries, scoped per user. */
3
- export const passkeyQueryKeys = {
4
- all: (userId) => [...authQueryKeys.user(userId), "passkey"],
5
- lists: (userId) => [...passkeyQueryKeys.all(userId), "list"],
6
- list: (userId, query) => [...passkeyQueryKeys.lists(userId), query ?? null]
7
- };
@@ -1,12 +0,0 @@
1
- export const themeLocalization = {
2
- /** @remarks `"Appearance"` */
3
- appearance: "Appearance",
4
- /** @remarks `"Theme"` */
5
- theme: "Theme",
6
- /** @remarks `"System"` */
7
- system: "System",
8
- /** @remarks `"Light"` */
9
- light: "Light",
10
- /** @remarks `"Dark"` */
11
- dark: "Dark"
12
- };
@@ -1,8 +0,0 @@
1
- import { createAuthPlugin } from "../../lib/create-auth-plugin";
2
- import { themeLocalization } from "./theme-localization";
3
- export const themePlugin = createAuthPlugin("theme", (options) => ({
4
- localization: { ...themeLocalization, ...options.localization },
5
- theme: options.theme ?? "system",
6
- setTheme: options.setTheme,
7
- themes: options.themes ?? ["system", "light", "dark"]
8
- }));
@@ -1,16 +0,0 @@
1
- export const usernameLocalization = {
2
- /** @remarks `"Username"` */
3
- username: "Username",
4
- /** @remarks `"Enter your username"` */
5
- usernamePlaceholder: "Enter your username",
6
- /** @remarks `"Enter your username or email"` */
7
- usernameOrEmailPlaceholder: "Enter your username or email",
8
- /** @remarks `"Username is available"` */
9
- usernameAvailable: "Username is available",
10
- /** @remarks `"Username is already taken. Please try another."` */
11
- usernameTaken: "Username is already taken. Please try another.",
12
- /** @remarks `"Display Username"` */
13
- displayUsername: "Display Username",
14
- /** @remarks `"Enter your display username"` */
15
- displayUsernamePlaceholder: "Enter your display username"
16
- };
@@ -1,17 +0,0 @@
1
- /**
2
- * Mutation keys contributed by the username plugin.
3
- *
4
- * `signIn` is kept under the shared `["auth", "signIn", ...]` namespace so
5
- * consumers can match the whole sign-in surface with
6
- * `useIsMutating({ mutationKey: ["auth", "signIn"] })`.
7
- */
8
- export const usernameMutationKeys = {
9
- /** Key for `signIn.username`. */
10
- signIn: ["auth", "signIn", "username"],
11
- /**
12
- * Key for `isUsernameAvailable`. This is technically a read, but it's
13
- * exposed via better-auth's mutation surface and lives under the mutation
14
- * factories for parity with other username flows.
15
- */
16
- isUsernameAvailable: ["auth", "isUsernameAvailable"]
17
- };
@@ -1,36 +0,0 @@
1
- import { createAuthPlugin } from "../../lib/create-auth-plugin";
2
- import { usernameLocalization } from "./username-localization";
3
- export const usernamePlugin = createAuthPlugin("username", (options = {}) => {
4
- const minUsernameLength = options.minUsernameLength ?? 3;
5
- const maxUsernameLength = options.maxUsernameLength ?? 30;
6
- const localization = { ...usernameLocalization, ...options.localization };
7
- return {
8
- ...options,
9
- minUsernameLength,
10
- maxUsernameLength,
11
- localization,
12
- additionalFields: [
13
- {
14
- name: "username",
15
- type: "string",
16
- label: localization.username,
17
- placeholder: localization.usernamePlaceholder,
18
- inputType: "input",
19
- signUp: "above",
20
- required: true
21
- },
22
- ...(options.displayUsername
23
- ? [
24
- {
25
- name: "displayUsername",
26
- type: "string",
27
- label: localization.displayUsername,
28
- placeholder: localization.displayUsernamePlaceholder,
29
- inputType: "input",
30
- signUp: "above"
31
- }
32
- ]
33
- : [])
34
- ]
35
- };
36
- });