@delmaredigital/payload-better-auth 0.5.2 → 0.5.3
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/README.md +2 -0
- package/dist/components/LoginView.d.ts +1 -2
- package/dist/components/LoginView.js +24 -10
- package/dist/components/PasskeyRegisterButton.d.ts +1 -2
- package/dist/components/PasskeyRegisterButton.js +18 -3
- package/dist/components/PasskeySignInButton.d.ts +1 -2
- package/dist/components/PasskeySignInButton.js +18 -3
- package/dist/components/management/ApiKeysManagementClient.js +12 -5
- package/dist/components/management/PasskeysManagementClient.d.ts +1 -2
- package/dist/components/management/PasskeysManagementClient.js +20 -6
- package/dist/components/management/TwoFactorManagementClient.d.ts +1 -2
- package/dist/exports/client.d.ts +125 -961
- package/dist/exports/client.js +20 -24
- package/package.json +1 -1
package/dist/exports/client.js
CHANGED
|
@@ -1,55 +1,51 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Client-side auth utilities
|
|
3
|
-
* Re-exports createAuthClient from better-auth/react and
|
|
3
|
+
* Re-exports createAuthClient from better-auth/react and core plugins
|
|
4
|
+
*
|
|
5
|
+
* NOTE: Only plugins from the core `better-auth` package are statically imported here.
|
|
6
|
+
* Optional peer dep plugins (passkey, apiKey, etc.) must NOT be statically imported
|
|
7
|
+
* because webpack resolves all static imports at build time, breaking consumers
|
|
8
|
+
* who don't have those packages installed.
|
|
4
9
|
*/ import { createAuthClient } from 'better-auth/react';
|
|
5
10
|
import { twoFactorClient } from 'better-auth/client/plugins';
|
|
6
|
-
|
|
7
|
-
// Re-export createAuthClient and common plugins
|
|
11
|
+
// Re-export createAuthClient and core plugins
|
|
8
12
|
export { createAuthClient } from 'better-auth/react';
|
|
9
13
|
export { twoFactorClient } from 'better-auth/client/plugins';
|
|
10
|
-
export { passkeyClient } from '@better-auth/passkey/client';
|
|
11
14
|
/**
|
|
12
|
-
* Default plugins included with Payload Better Auth.
|
|
13
|
-
*
|
|
15
|
+
* Default plugins included with Payload Better Auth (core only).
|
|
16
|
+
* Add optional plugins (passkeyClient, apiKeyClient) from their own packages.
|
|
14
17
|
*
|
|
15
|
-
* @example
|
|
18
|
+
* @example
|
|
16
19
|
* ```typescript
|
|
17
20
|
* import { createAuthClient, payloadAuthPlugins } from '@delmaredigital/payload-better-auth/client'
|
|
18
|
-
* import {
|
|
21
|
+
* import { passkeyClient } from '@better-auth/passkey/client'
|
|
22
|
+
* import { apiKeyClient } from '@better-auth/api-key/client'
|
|
19
23
|
*
|
|
20
24
|
* export const authClient = createAuthClient({
|
|
21
|
-
* plugins: [...payloadAuthPlugins,
|
|
25
|
+
* plugins: [...payloadAuthPlugins, passkeyClient(), apiKeyClient()],
|
|
22
26
|
* })
|
|
23
|
-
*
|
|
24
|
-
* // authClient.subscription is fully typed!
|
|
25
27
|
* ```
|
|
26
28
|
*/ export const payloadAuthPlugins = [
|
|
27
|
-
twoFactorClient()
|
|
28
|
-
passkeyClient()
|
|
29
|
+
twoFactorClient()
|
|
29
30
|
];
|
|
30
31
|
/**
|
|
31
|
-
* Create a pre-configured auth client with default plugins (twoFactor
|
|
32
|
+
* Create a pre-configured auth client with default core plugins (twoFactor).
|
|
32
33
|
*
|
|
33
|
-
*
|
|
34
|
-
* safety, use `createAuthClient` with `payloadAuthPlugins` instead.
|
|
34
|
+
* For passkeys, API keys, or other optional plugins, use `createAuthClient` directly:
|
|
35
35
|
*
|
|
36
|
-
* @
|
|
37
|
-
* @param options.baseURL - Base URL for auth endpoints (defaults to window.location.origin)
|
|
38
|
-
*
|
|
39
|
-
* @example Basic usage (no custom plugins)
|
|
36
|
+
* @example Basic usage
|
|
40
37
|
* ```typescript
|
|
41
38
|
* import { createPayloadAuthClient } from '@delmaredigital/payload-better-auth/client'
|
|
42
|
-
*
|
|
43
39
|
* export const authClient = createPayloadAuthClient()
|
|
44
40
|
* ```
|
|
45
41
|
*
|
|
46
|
-
* @example With
|
|
42
|
+
* @example With optional plugins
|
|
47
43
|
* ```typescript
|
|
48
44
|
* import { createAuthClient, payloadAuthPlugins } from '@delmaredigital/payload-better-auth/client'
|
|
49
|
-
* import {
|
|
45
|
+
* import { passkeyClient } from '@better-auth/passkey/client'
|
|
50
46
|
*
|
|
51
47
|
* export const authClient = createAuthClient({
|
|
52
|
-
* plugins: [...payloadAuthPlugins,
|
|
48
|
+
* plugins: [...payloadAuthPlugins, passkeyClient()],
|
|
53
49
|
* })
|
|
54
50
|
* ```
|
|
55
51
|
*/ export function createPayloadAuthClient(options) {
|