@delmaredigital/payload-better-auth 0.3.6 → 0.3.8
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 +60 -12
- package/dist/adapter/collections.d.ts.map +1 -1
- package/dist/adapter/collections.js +126 -88
- package/dist/adapter/collections.js.map +1 -1
- package/dist/adapter/index.js +197 -150
- package/dist/adapter/index.js.map +1 -1
- package/dist/components/BeforeLogin.d.ts +1 -1
- package/dist/components/BeforeLogin.d.ts.map +1 -1
- package/dist/components/BeforeLogin.js +15 -7
- package/dist/components/BeforeLogin.js.map +1 -1
- package/dist/components/LoginView.d.ts +2 -2
- package/dist/components/LoginView.d.ts.map +1 -1
- package/dist/components/LoginView.js +660 -218
- package/dist/components/LoginView.js.map +1 -1
- package/dist/components/LoginViewWrapper.d.ts +1 -1
- package/dist/components/LoginViewWrapper.d.ts.map +1 -1
- package/dist/components/LoginViewWrapper.js +14 -4
- package/dist/components/LoginViewWrapper.js.map +1 -1
- package/dist/components/LogoutButton.d.ts +1 -1
- package/dist/components/LogoutButton.d.ts.map +1 -1
- package/dist/components/LogoutButton.js +19 -11
- package/dist/components/LogoutButton.js.map +1 -1
- package/dist/components/PasskeyRegisterButton.d.ts +2 -2
- package/dist/components/PasskeyRegisterButton.d.ts.map +1 -1
- package/dist/components/PasskeyRegisterButton.js +20 -16
- package/dist/components/PasskeyRegisterButton.js.map +1 -1
- package/dist/components/PasskeySignInButton.d.ts +2 -2
- package/dist/components/PasskeySignInButton.d.ts.map +1 -1
- package/dist/components/PasskeySignInButton.js +14 -12
- package/dist/components/PasskeySignInButton.js.map +1 -1
- package/dist/components/auth/ForgotPasswordView.d.ts +1 -1
- package/dist/components/auth/ForgotPasswordView.d.ts.map +1 -1
- package/dist/components/auth/ForgotPasswordView.js +133 -43
- package/dist/components/auth/ForgotPasswordView.js.map +1 -1
- package/dist/components/auth/ResetPasswordView.d.ts +1 -1
- package/dist/components/auth/ResetPasswordView.d.ts.map +1 -1
- package/dist/components/auth/ResetPasswordView.js +154 -50
- package/dist/components/auth/ResetPasswordView.js.map +1 -1
- package/dist/components/auth/index.js +2 -2
- package/dist/components/auth/index.js.map +1 -1
- package/dist/components/management/ApiKeysManagementClient.d.ts +2 -2
- package/dist/components/management/ApiKeysManagementClient.d.ts.map +1 -1
- package/dist/components/management/ApiKeysManagementClient.js +539 -222
- package/dist/components/management/ApiKeysManagementClient.js.map +1 -1
- package/dist/components/management/PasskeysManagementClient.d.ts +2 -2
- package/dist/components/management/PasskeysManagementClient.d.ts.map +1 -1
- package/dist/components/management/PasskeysManagementClient.js +215 -92
- package/dist/components/management/PasskeysManagementClient.js.map +1 -1
- package/dist/components/management/SecurityNavLinks.d.ts +1 -1
- package/dist/components/management/SecurityNavLinks.d.ts.map +1 -1
- package/dist/components/management/SecurityNavLinks.js +51 -24
- package/dist/components/management/SecurityNavLinks.js.map +1 -1
- package/dist/components/management/TwoFactorManagementClient.d.ts +2 -2
- package/dist/components/management/TwoFactorManagementClient.d.ts.map +1 -1
- package/dist/components/management/TwoFactorManagementClient.js +270 -111
- package/dist/components/management/TwoFactorManagementClient.js.map +1 -1
- package/dist/components/management/index.js +2 -2
- package/dist/components/management/index.js.map +1 -1
- package/dist/components/management/views/ApiKeysView.d.ts +1 -1
- package/dist/components/management/views/ApiKeysView.d.ts.map +1 -1
- package/dist/components/management/views/ApiKeysView.js +19 -4
- package/dist/components/management/views/ApiKeysView.js.map +1 -1
- package/dist/components/management/views/PasskeysView.d.ts +1 -1
- package/dist/components/management/views/PasskeysView.d.ts.map +1 -1
- package/dist/components/management/views/PasskeysView.js +16 -4
- package/dist/components/management/views/PasskeysView.js.map +1 -1
- package/dist/components/management/views/TwoFactorView.d.ts +1 -1
- package/dist/components/management/views/TwoFactorView.d.ts.map +1 -1
- package/dist/components/management/views/TwoFactorView.js +16 -4
- package/dist/components/management/views/TwoFactorView.js.map +1 -1
- package/dist/components/management/views/index.js +2 -2
- package/dist/components/management/views/index.js.map +1 -1
- package/dist/components/twoFactor/TwoFactorSetupView.d.ts +1 -1
- package/dist/components/twoFactor/TwoFactorSetupView.d.ts.map +1 -1
- package/dist/components/twoFactor/TwoFactorSetupView.js +240 -87
- package/dist/components/twoFactor/TwoFactorSetupView.js.map +1 -1
- package/dist/components/twoFactor/TwoFactorVerifyView.d.ts +1 -1
- package/dist/components/twoFactor/TwoFactorVerifyView.d.ts.map +1 -1
- package/dist/components/twoFactor/TwoFactorVerifyView.js +108 -45
- package/dist/components/twoFactor/TwoFactorVerifyView.js.map +1 -1
- package/dist/components/twoFactor/index.js +2 -2
- package/dist/components/twoFactor/index.js.map +1 -1
- package/dist/exports/client.d.ts +2356 -2
- package/dist/exports/client.d.ts.map +1 -1
- package/dist/exports/client.js +48 -8
- package/dist/exports/client.js.map +1 -1
- package/dist/exports/components.js +2 -2
- package/dist/exports/components.js.map +1 -1
- package/dist/exports/management.js +3 -3
- package/dist/exports/management.js.map +1 -1
- package/dist/exports/rsc.js +2 -2
- package/dist/exports/rsc.js.map +1 -1
- package/dist/generated-types.js +4 -2
- package/dist/generated-types.js.map +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/plugin/index.d.ts +35 -2
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/index.js +198 -162
- package/dist/plugin/index.js.map +1 -1
- package/dist/scripts/generate-types.js +66 -50
- package/dist/scripts/generate-types.js.map +1 -1
- package/dist/types/apiKey.js +7 -2
- package/dist/types/apiKey.js.map +1 -1
- package/dist/types/betterAuth.js +23 -2
- package/dist/types/betterAuth.js.map +1 -1
- package/dist/utils/access.js +78 -81
- package/dist/utils/access.js.map +1 -1
- package/dist/utils/apiKeyAccess.js +65 -72
- package/dist/utils/apiKeyAccess.js.map +1 -1
- package/dist/utils/betterAuthDefaults.js +8 -8
- package/dist/utils/betterAuthDefaults.js.map +1 -1
- package/dist/utils/detectAuthConfig.js +8 -11
- package/dist/utils/detectAuthConfig.js.map +1 -1
- package/dist/utils/detectEnabledPlugins.js +6 -7
- package/dist/utils/detectEnabledPlugins.js.map +1 -1
- package/dist/utils/firstUserAdmin.js +18 -20
- package/dist/utils/firstUserAdmin.js.map +1 -1
- package/dist/utils/generateScopes.js +40 -41
- package/dist/utils/generateScopes.js.map +1 -1
- package/dist/utils/session.js +8 -9
- package/dist/utils/session.js.map +1 -1
- package/package.json +97 -26
- package/src/adapter/collections.ts +621 -0
- package/src/adapter/index.ts +712 -0
- package/src/components/BeforeLogin.tsx +39 -0
- package/src/components/LoginView.tsx +1516 -0
- package/src/components/LoginViewWrapper.tsx +35 -0
- package/src/components/LogoutButton.tsx +58 -0
- package/src/components/PasskeyRegisterButton.tsx +105 -0
- package/src/components/PasskeySignInButton.tsx +96 -0
- package/src/components/auth/ForgotPasswordView.tsx +274 -0
- package/src/components/auth/ResetPasswordView.tsx +331 -0
- package/src/components/auth/index.ts +8 -0
- package/src/components/management/ApiKeysManagementClient.tsx +988 -0
- package/src/components/management/PasskeysManagementClient.tsx +409 -0
- package/src/components/management/SecurityNavLinks.tsx +117 -0
- package/src/components/management/TwoFactorManagementClient.tsx +560 -0
- package/src/components/management/index.ts +20 -0
- package/src/components/management/views/ApiKeysView.tsx +57 -0
- package/src/components/management/views/PasskeysView.tsx +42 -0
- package/src/components/management/views/TwoFactorView.tsx +42 -0
- package/src/components/management/views/index.ts +10 -0
- package/src/components/twoFactor/TwoFactorSetupView.tsx +515 -0
- package/src/components/twoFactor/TwoFactorVerifyView.tsx +238 -0
- package/src/components/twoFactor/index.ts +8 -0
- package/src/exports/client.ts +77 -0
- package/src/exports/components.ts +30 -0
- package/src/exports/management.ts +25 -0
- package/src/exports/rsc.ts +11 -0
- package/src/generated-types.ts +269 -0
- package/src/index.ts +135 -0
- package/src/plugin/index.ts +834 -0
- package/src/scripts/generate-types.ts +269 -0
- package/src/types/apiKey.ts +63 -0
- package/src/types/betterAuth.ts +253 -0
- package/src/utils/access.ts +410 -0
- package/src/utils/apiKeyAccess.ts +443 -0
- package/src/utils/betterAuthDefaults.ts +102 -0
- package/src/utils/detectAuthConfig.ts +47 -0
- package/src/utils/detectEnabledPlugins.ts +69 -0
- package/src/utils/firstUserAdmin.ts +164 -0
- package/src/utils/generateScopes.ts +150 -0
- package/src/utils/session.ts +91 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/exports/client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAE3D,MAAM,WAAW,wBAAwB;IACvC,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/exports/client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAE3D;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;qCAkBf,CAAC;qCAAkD,CAAC;;;;;;;;;iCAS3C,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qCAoBwnC,CAAC;qCAAkD,CAAC;;;;;;;;;iCAA8Q,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAA65I,CAAC;;;;;;;;;;;;;;;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;2BAA8N,CAAC;gCAAyC,CAAC;;;uBAAoG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6BAzB/2C,CAAC;iBAE1E,CAAD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAuBimB,CAAC;;cAA0D,CAAC;eAA+B,CAAC;;;;;gBAA8U,CAAC;mBAA8C,CAAC;iBAAmC,CAAC;iBAAmC,CAAC;YAA+B,CAAC;gBAAuC,CAAC;gBAA2C,CAAC;sBAAwC,CAAC;cAAwC,CAAC;eAA+C,CAAC;mBAA0G,CAAC;yBAAuB,CAAC;;eAAyC,CAAC;;;aAA2G,CAAC;YAA+B,CAAC;;;;;;;;;;;;YAA+e,CAAC;aAAgB,CAAC;cAAiB,CAAC;cAAiB,CAAC;;aAA8F,CAAC;oBAAkE,CAAC;cAAgC,CAAC;mBAAmG,CAAC;yBAA2E,CAAC;qBAAwC,CAAC;;;uBAAkF,CAAC;+GAAuL,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAH73F;AAED,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAA"}
|
package/dist/exports/client.js
CHANGED
|
@@ -1,25 +1,65 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Client-side auth utilities
|
|
3
3
|
* Re-exports createAuthClient from better-auth/react and common plugins
|
|
4
|
-
*/
|
|
5
|
-
import { createAuthClient } from 'better-auth/react';
|
|
4
|
+
*/ import { createAuthClient } from 'better-auth/react';
|
|
6
5
|
import { twoFactorClient, apiKeyClient } from 'better-auth/client/plugins';
|
|
7
6
|
import { passkeyClient } from '@better-auth/passkey/client';
|
|
8
|
-
// Re-export
|
|
7
|
+
// Re-export createAuthClient and common plugins
|
|
9
8
|
export { createAuthClient } from 'better-auth/react';
|
|
10
9
|
export { twoFactorClient, apiKeyClient } from 'better-auth/client/plugins';
|
|
11
10
|
export { passkeyClient } from '@better-auth/passkey/client';
|
|
12
11
|
/**
|
|
13
|
-
*
|
|
12
|
+
* Default plugins included with Payload Better Auth.
|
|
13
|
+
* Use this with createAuthClient when you need custom plugins with full type safety.
|
|
14
|
+
*
|
|
15
|
+
* @example With custom plugins (full type safety)
|
|
16
|
+
* ```typescript
|
|
17
|
+
* import { createAuthClient, payloadAuthPlugins } from '@delmaredigital/payload-better-auth/client'
|
|
18
|
+
* import { stripeClient } from '@better-auth/stripe/client'
|
|
19
|
+
*
|
|
20
|
+
* export const authClient = createAuthClient({
|
|
21
|
+
* plugins: [...payloadAuthPlugins, stripeClient({ subscription: true })],
|
|
22
|
+
* })
|
|
23
|
+
*
|
|
24
|
+
* // authClient.subscription is fully typed!
|
|
25
|
+
* ```
|
|
26
|
+
*/ export const payloadAuthPlugins = [
|
|
27
|
+
twoFactorClient(),
|
|
28
|
+
apiKeyClient(),
|
|
29
|
+
passkeyClient()
|
|
30
|
+
];
|
|
31
|
+
/**
|
|
32
|
+
* Create a pre-configured auth client with default plugins (twoFactor, apiKey, passkey).
|
|
33
|
+
*
|
|
34
|
+
* This is a convenience wrapper for simple setups. For custom plugins with full type
|
|
35
|
+
* safety, use `createAuthClient` with `payloadAuthPlugins` instead.
|
|
36
|
+
*
|
|
14
37
|
* @param options - Optional configuration
|
|
15
38
|
* @param options.baseURL - Base URL for auth endpoints (defaults to window.location.origin)
|
|
16
39
|
*
|
|
17
|
-
*
|
|
18
|
-
|
|
19
|
-
|
|
40
|
+
* @example Basic usage (no custom plugins)
|
|
41
|
+
* ```typescript
|
|
42
|
+
* import { createPayloadAuthClient } from '@delmaredigital/payload-better-auth/client'
|
|
43
|
+
*
|
|
44
|
+
* export const authClient = createPayloadAuthClient()
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* @example With custom plugins (use createAuthClient for full type safety)
|
|
48
|
+
* ```typescript
|
|
49
|
+
* import { createAuthClient, payloadAuthPlugins } from '@delmaredigital/payload-better-auth/client'
|
|
50
|
+
* import { stripeClient } from '@better-auth/stripe/client'
|
|
51
|
+
*
|
|
52
|
+
* export const authClient = createAuthClient({
|
|
53
|
+
* plugins: [...payloadAuthPlugins, stripeClient({ subscription: true })],
|
|
54
|
+
* })
|
|
55
|
+
* ```
|
|
56
|
+
*/ export function createPayloadAuthClient(options) {
|
|
20
57
|
return createAuthClient({
|
|
21
58
|
baseURL: options?.baseURL ?? (typeof window !== 'undefined' ? window.location.origin : ''),
|
|
22
|
-
plugins: [
|
|
59
|
+
plugins: [
|
|
60
|
+
...payloadAuthPlugins
|
|
61
|
+
]
|
|
23
62
|
});
|
|
24
63
|
}
|
|
64
|
+
|
|
25
65
|
//# sourceMappingURL=client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/exports/client.ts"],"sourcesContent":["/**\n * Client-side auth utilities\n * Re-exports createAuthClient from better-auth/react and common plugins\n */\n\nimport { createAuthClient } from 'better-auth/react'\nimport { twoFactorClient, apiKeyClient } from 'better-auth/client/plugins'\nimport { passkeyClient } from '@better-auth/passkey/client'\n\n// Re-export createAuthClient and common plugins\nexport { createAuthClient } from 'better-auth/react'\nexport { twoFactorClient, apiKeyClient } from 'better-auth/client/plugins'\nexport { passkeyClient } from '@better-auth/passkey/client'\n\n/**\n * Default plugins included with Payload Better Auth.\n * Use this with createAuthClient when you need custom plugins with full type safety.\n *\n * @example With custom plugins (full type safety)\n * ```typescript\n * import { createAuthClient, payloadAuthPlugins } from '@delmaredigital/payload-better-auth/client'\n * import { stripeClient } from '@better-auth/stripe/client'\n *\n * export const authClient = createAuthClient({\n * plugins: [...payloadAuthPlugins, stripeClient({ subscription: true })],\n * })\n *\n * // authClient.subscription is fully typed!\n * ```\n */\nexport const payloadAuthPlugins = [\n twoFactorClient(),\n apiKeyClient(),\n passkeyClient(),\n] as const\n\nexport interface PayloadAuthClientOptions {\n /** Base URL for auth endpoints (defaults to window.location.origin) */\n baseURL?: string\n}\n\n/**\n * Create a pre-configured auth client with default plugins (twoFactor, apiKey, passkey).\n *\n * This is a convenience wrapper for simple setups. For custom plugins with full type\n * safety, use `createAuthClient` with `payloadAuthPlugins` instead.\n *\n * @param options - Optional configuration\n * @param options.baseURL - Base URL for auth endpoints (defaults to window.location.origin)\n *\n * @example Basic usage (no custom plugins)\n * ```typescript\n * import { createPayloadAuthClient } from '@delmaredigital/payload-better-auth/client'\n *\n * export const authClient = createPayloadAuthClient()\n * ```\n *\n * @example With custom plugins (use createAuthClient for full type safety)\n * ```typescript\n * import { createAuthClient, payloadAuthPlugins } from '@delmaredigital/payload-better-auth/client'\n * import { stripeClient } from '@better-auth/stripe/client'\n *\n * export const authClient = createAuthClient({\n * plugins: [...payloadAuthPlugins, stripeClient({ subscription: true })],\n * })\n * ```\n */\nexport function createPayloadAuthClient(options?: PayloadAuthClientOptions) {\n return createAuthClient({\n baseURL:\n options?.baseURL ??\n (typeof window !== 'undefined' ? window.location.origin : ''),\n plugins: [...payloadAuthPlugins],\n })\n}\n\nexport type PayloadAuthClient = ReturnType<typeof createPayloadAuthClient>\n"],"names":["createAuthClient","twoFactorClient","apiKeyClient","passkeyClient","payloadAuthPlugins","createPayloadAuthClient","options","baseURL","window","location","origin","plugins"],"mappings":"AAAA;;;CAGC,GAED,SAASA,gBAAgB,QAAQ,oBAAmB;AACpD,SAASC,eAAe,EAAEC,YAAY,QAAQ,6BAA4B;AAC1E,SAASC,aAAa,QAAQ,8BAA6B;AAE3D,gDAAgD;AAChD,SAASH,gBAAgB,QAAQ,oBAAmB;AACpD,SAASC,eAAe,EAAEC,YAAY,QAAQ,6BAA4B;AAC1E,SAASC,aAAa,QAAQ,8BAA6B;AAE3D;;;;;;;;;;;;;;;CAeC,GACD,OAAO,MAAMC,qBAAqB;IAChCH;IACAC;IACAC;CACD,CAAS;AAOV;;;;;;;;;;;;;;;;;;;;;;;;;CAyBC,GACD,OAAO,SAASE,wBAAwBC,OAAkC;IACxE,OAAON,iBAAiB;QACtBO,SACED,SAASC,WACR,CAAA,OAAOC,WAAW,cAAcA,OAAOC,QAAQ,CAACC,MAAM,GAAG,EAAC;QAC7DC,SAAS;eAAIP;SAAmB;IAClC;AACF"}
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* These components are auto-injected when disableLocalStrategy is detected.
|
|
5
5
|
* They can also be used standalone or customized.
|
|
6
|
-
*/
|
|
7
|
-
export { LogoutButton } from '../components/LogoutButton.js';
|
|
6
|
+
*/ export { LogoutButton } from '../components/LogoutButton.js';
|
|
8
7
|
export { BeforeLogin } from '../components/BeforeLogin.js';
|
|
9
8
|
export { LoginView } from '../components/LoginView.js';
|
|
10
9
|
export { ForgotPasswordView } from '../components/auth/ForgotPasswordView.js';
|
|
@@ -13,4 +12,5 @@ export { TwoFactorSetupView } from '../components/twoFactor/TwoFactorSetupView.j
|
|
|
13
12
|
export { TwoFactorVerifyView } from '../components/twoFactor/TwoFactorVerifyView.js';
|
|
14
13
|
export { PasskeySignInButton } from '../components/PasskeySignInButton.js';
|
|
15
14
|
export { PasskeyRegisterButton } from '../components/PasskeyRegisterButton.js';
|
|
15
|
+
|
|
16
16
|
//# sourceMappingURL=components.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/exports/components.ts"],"sourcesContent":["/**\n * Admin Components for Better Auth\n *\n * These components are auto-injected when disableLocalStrategy is detected.\n * They can also be used standalone or customized.\n */\n\nexport { LogoutButton } from '../components/LogoutButton.js'\nexport type { BeforeLoginProps } from '../components/BeforeLogin.js'\nexport { BeforeLogin } from '../components/BeforeLogin.js'\nexport type { LoginViewProps } from '../components/LoginView.js'\nexport { LoginView } from '../components/LoginView.js'\n\n// Password reset components\nexport type { ForgotPasswordViewProps } from '../components/auth/ForgotPasswordView.js'\nexport { ForgotPasswordView } from '../components/auth/ForgotPasswordView.js'\nexport type { ResetPasswordViewProps } from '../components/auth/ResetPasswordView.js'\nexport { ResetPasswordView } from '../components/auth/ResetPasswordView.js'\n\n// Two-factor authentication components\nexport type { TwoFactorSetupViewProps } from '../components/twoFactor/TwoFactorSetupView.js'\nexport { TwoFactorSetupView } from '../components/twoFactor/TwoFactorSetupView.js'\nexport type { TwoFactorVerifyViewProps } from '../components/twoFactor/TwoFactorVerifyView.js'\nexport { TwoFactorVerifyView } from '../components/twoFactor/TwoFactorVerifyView.js'\n\n// Passkey authentication\nexport type { PasskeySignInButtonProps } from '../components/PasskeySignInButton.js'\nexport { PasskeySignInButton } from '../components/PasskeySignInButton.js'\nexport type { PasskeyRegisterButtonProps } from '../components/PasskeyRegisterButton.js'\nexport { PasskeyRegisterButton } from '../components/PasskeyRegisterButton.js'\n"],"names":["LogoutButton","BeforeLogin","LoginView","ForgotPasswordView","ResetPasswordView","TwoFactorSetupView","TwoFactorVerifyView","PasskeySignInButton","PasskeyRegisterButton"],"mappings":"AAAA;;;;;CAKC,GAED,SAASA,YAAY,QAAQ,gCAA+B;AAE5D,SAASC,WAAW,QAAQ,+BAA8B;AAE1D,SAASC,SAAS,QAAQ,6BAA4B;AAItD,SAASC,kBAAkB,QAAQ,2CAA0C;AAE7E,SAASC,iBAAiB,QAAQ,0CAAyC;AAI3E,SAASC,kBAAkB,QAAQ,gDAA+C;AAElF,SAASC,mBAAmB,QAAQ,iDAAgD;AAIpF,SAASC,mBAAmB,QAAQ,uCAAsC;AAE1E,SAASC,qBAAqB,QAAQ,yCAAwC"}
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Client components for managing security features in the Payload admin panel.
|
|
5
5
|
* For server component views, use the './rsc' export.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export { SecurityNavLinks, TwoFactorManagementClient, ApiKeysManagementClient, PasskeysManagementClient, } from '../components/management/index.js';
|
|
6
|
+
*/ // Client components
|
|
7
|
+
export { SecurityNavLinks, TwoFactorManagementClient, ApiKeysManagementClient, PasskeysManagementClient } from '../components/management/index.js';
|
|
9
8
|
// Re-export plugin detection utility
|
|
10
9
|
export { detectEnabledPlugins } from '../utils/detectEnabledPlugins.js';
|
|
10
|
+
|
|
11
11
|
//# sourceMappingURL=management.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/exports/management.ts"],"sourcesContent":["/**\n * Management UI Components Export\n *\n * Client components for managing security features in the Payload admin panel.\n * For server component views, use the './rsc' export.\n */\n\n// Client components\nexport {\n SecurityNavLinks,\n TwoFactorManagementClient,\n ApiKeysManagementClient,\n PasskeysManagementClient,\n} from '../components/management/index.js'\n\nexport type {\n SecurityNavLinksProps,\n TwoFactorManagementClientProps,\n ApiKeysManagementClientProps,\n PasskeysManagementClientProps,\n} from '../components/management/index.js'\n\n// Re-export plugin detection utility\nexport { detectEnabledPlugins } from '../utils/detectEnabledPlugins.js'\nexport type { EnabledPluginsResult } from '../utils/detectEnabledPlugins.js'\n"],"names":["SecurityNavLinks","TwoFactorManagementClient","ApiKeysManagementClient","PasskeysManagementClient","detectEnabledPlugins"],"mappings":"AAAA;;;;;CAKC,GAED,oBAAoB;AACpB,SACEA,gBAAgB,EAChBC,yBAAyB,EACzBC,uBAAuB,EACvBC,wBAAwB,QACnB,oCAAmC;AAS1C,qCAAqC;AACrC,SAASC,oBAAoB,QAAQ,mCAAkC"}
|
package/dist/exports/rsc.js
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* These async server components use DefaultTemplate for proper
|
|
5
5
|
* integration with Payload's admin panel layout.
|
|
6
|
-
*/
|
|
7
|
-
export { LoginViewWrapper } from '../components/LoginViewWrapper.js';
|
|
6
|
+
*/ export { LoginViewWrapper } from '../components/LoginViewWrapper.js';
|
|
8
7
|
export { TwoFactorView } from '../components/management/views/TwoFactorView.js';
|
|
9
8
|
export { ApiKeysView } from '../components/management/views/ApiKeysView.js';
|
|
10
9
|
export { PasskeysView } from '../components/management/views/PasskeysView.js';
|
|
10
|
+
|
|
11
11
|
//# sourceMappingURL=rsc.js.map
|
package/dist/exports/rsc.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/exports/rsc.ts"],"sourcesContent":["/**\n * React Server Component Views for Better Auth\n *\n * These async server components use DefaultTemplate for proper\n * integration with Payload's admin panel layout.\n */\n\nexport { LoginViewWrapper } from '../components/LoginViewWrapper.js'\nexport { TwoFactorView } from '../components/management/views/TwoFactorView.js'\nexport { ApiKeysView } from '../components/management/views/ApiKeysView.js'\nexport { PasskeysView } from '../components/management/views/PasskeysView.js'\n"],"names":["LoginViewWrapper","TwoFactorView","ApiKeysView","PasskeysView"],"mappings":"AAAA;;;;;CAKC,GAED,SAASA,gBAAgB,QAAQ,oCAAmC;AACpE,SAASC,aAAa,QAAQ,kDAAiD;AAC/E,SAASC,WAAW,QAAQ,gDAA+C;AAC3E,SAASC,YAAY,QAAQ,iDAAgD"}
|
package/dist/generated-types.js
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Generated from Better Auth schema introspection.
|
|
6
6
|
* Contains types for all supported plugins and their field additions.
|
|
7
|
-
*/
|
|
8
|
-
|
|
7
|
+
*/ /**
|
|
8
|
+
* Union of all model names in the schema.
|
|
9
|
+
*/ export { };
|
|
10
|
+
|
|
9
11
|
//# sourceMappingURL=generated-types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../src/generated-types.ts"],"sourcesContent":["/**\n * Auto-generated Better Auth types.\n * DO NOT EDIT - Run `pnpm generate:types` to regenerate.\n *\n * Generated from Better Auth schema introspection.\n * Contains types for all supported plugins and their field additions.\n */\n\nexport type BaseUserFields = {\n name: string\n email: string\n emailVerified: boolean\n image?: string\n createdAt: Date\n updatedAt: Date\n role?: string\n}\n\nexport type UserPluginFields = {\n \"username\": {\n username?: string\n displayUsername?: string\n }\n \"admin\": {\n banned?: boolean\n banReason?: string\n banExpires?: Date\n }\n \"phone-number\": {\n phoneNumber?: string\n phoneNumberVerified?: boolean\n }\n \"anonymous\": {\n isAnonymous?: boolean\n }\n \"two-factor\": {\n twoFactorEnabled?: boolean\n }\n}\n\nexport type User = BaseUserFields & UserPluginFields[\"username\"] & UserPluginFields[\"admin\"] & UserPluginFields[\"phone-number\"] & UserPluginFields[\"anonymous\"] & UserPluginFields[\"two-factor\"]\n\nexport type BaseSessionFields = {\n expiresAt: Date\n token: string\n createdAt: Date\n updatedAt: Date\n ipAddress?: string\n userAgent?: string\n userId: string\n}\n\nexport type SessionPluginFields = {\n \"admin\": {\n impersonatedBy?: string\n }\n \"organization\": {\n activeOrganizationId?: string\n activeTeamId?: string\n }\n}\n\nexport type Session = BaseSessionFields & SessionPluginFields[\"admin\"] & SessionPluginFields[\"organization\"]\n\nexport type BaseAccountFields = {\n accountId: string\n providerId: string\n userId: string\n accessToken?: string\n refreshToken?: string\n idToken?: string\n accessTokenExpiresAt?: Date\n refreshTokenExpiresAt?: Date\n scope?: string\n password?: string\n createdAt: Date\n updatedAt: Date\n}\n\nexport type Account = BaseAccountFields\n\nexport type BaseVerificationFields = {\n identifier: string\n value: string\n expiresAt: Date\n createdAt: Date\n updatedAt: Date\n}\n\nexport type Verification = BaseVerificationFields\n\nexport type ApikeyFields = {\n name?: string\n start?: string\n prefix?: string\n key: string\n userId: string\n refillInterval?: number\n refillAmount?: number\n lastRefillAt?: Date\n enabled?: boolean\n rateLimitEnabled?: boolean\n rateLimitTimeWindow?: number\n rateLimitMax?: number\n requestCount?: number\n remaining?: number\n lastRequest?: Date\n expiresAt?: Date\n createdAt: Date\n updatedAt: Date\n permissions?: string\n metadata?: string\n}\n\nexport type Apikey = ApikeyFields\n\nexport type PasskeyFields = {\n name?: string\n publicKey: string\n userId: string\n credentialID: string\n counter: number\n deviceType: string\n backedUp: boolean\n transports?: string\n createdAt?: Date\n aaguid?: string\n}\n\nexport type Passkey = PasskeyFields\n\nexport type OauthApplicationFields = {\n name?: string\n icon?: string\n metadata?: string\n clientId?: string\n clientSecret?: string\n redirectUrls?: string\n type?: string\n disabled?: boolean\n userId?: string\n createdAt?: Date\n updatedAt?: Date\n}\n\nexport type OauthApplication = OauthApplicationFields\n\nexport type OauthAccessTokenFields = {\n accessToken?: string\n refreshToken?: string\n accessTokenExpiresAt?: Date\n refreshTokenExpiresAt?: Date\n clientId?: string\n userId?: string\n scopes?: string\n createdAt?: Date\n updatedAt?: Date\n}\n\nexport type OauthAccessToken = OauthAccessTokenFields\n\nexport type OauthConsentFields = {\n clientId?: string\n userId?: string\n scopes?: string\n createdAt?: Date\n updatedAt?: Date\n consentGiven?: boolean\n}\n\nexport type OauthConsent = OauthConsentFields\n\nexport type OrganizationFields = {\n name: string\n slug: string\n logo?: string\n createdAt: Date\n metadata?: string\n}\n\nexport type Organization = OrganizationFields\n\nexport type TeamFields = {\n name: string\n organizationId: string\n createdAt: Date\n updatedAt?: Date\n}\n\nexport type Team = TeamFields\n\nexport type TeamMemberFields = {\n teamId: string\n userId: string\n createdAt?: Date\n}\n\nexport type TeamMember = TeamMemberFields\n\nexport type MemberFields = {\n organizationId: string\n userId: string\n role: string\n createdAt: Date\n}\n\nexport type Member = MemberFields\n\nexport type InvitationFields = {\n organizationId: string\n email: string\n role?: string\n teamId?: string\n status: string\n expiresAt: Date\n createdAt: Date\n inviterId: string\n}\n\nexport type Invitation = InvitationFields\n\nexport type JwksFields = {\n publicKey: string\n privateKey: string\n createdAt: Date\n expiresAt?: Date\n}\n\nexport type Jwks = JwksFields\n\nexport type TwoFactorFields = {\n secret: string\n backupCodes: string\n userId: string\n}\n\nexport type TwoFactor = TwoFactorFields\n\n/**\n * Union of all supported plugin identifiers.\n */\nexport type PluginId = \"username\" | \"admin\" | \"api-key\" | \"passkey\" | \"bearer\" | \"email-otp\" | \"magic-link\" | \"phone-number\" | \"one-tap\" | \"anonymous\" | \"multi-session\" | \"one-time-token\" | \"oidc\" | \"generic-oauth\" | \"open-api\" | \"organization\" | \"jwt\" | \"two-factor\"\n\n/**\n * Complete schema mapping of all models to their types.\n */\nexport type BetterAuthFullSchema = {\n \"user\": User\n \"session\": Session\n \"account\": Account\n \"verification\": Verification\n \"apikey\": Apikey\n \"passkey\": Passkey\n \"oauthApplication\": OauthApplication\n \"oauthAccessToken\": OauthAccessToken\n \"oauthConsent\": OauthConsent\n \"organization\": Organization\n \"team\": Team\n \"teamMember\": TeamMember\n \"member\": Member\n \"invitation\": Invitation\n \"jwks\": Jwks\n \"twoFactor\": TwoFactor\n}\n\n/**\n * Union of all model names in the schema.\n */\nexport type ModelKey = keyof BetterAuthFullSchema\n"],"names":[],"mappings":"AAAA;;;;;;CAMC,GAmQD;;CAEC,GACD,WAAiD"}
|
package/dist/index.js
CHANGED
|
@@ -5,19 +5,18 @@
|
|
|
5
5
|
* Enables seamless integration between Better Auth and Payload.
|
|
6
6
|
*
|
|
7
7
|
* @packageDocumentation
|
|
8
|
-
*/
|
|
9
|
-
// Adapter
|
|
8
|
+
*/ // Adapter
|
|
10
9
|
export { payloadAdapter } from './adapter/index.js';
|
|
11
10
|
// Collection generator plugin
|
|
12
11
|
export { betterAuthCollections } from './adapter/collections.js';
|
|
13
12
|
// Payload plugin and strategy
|
|
14
|
-
export { createBetterAuthPlugin, betterAuthStrategy, resetAuthInstance, getApiKeyScopesConfig
|
|
13
|
+
export { createBetterAuthPlugin, betterAuthStrategy, resetAuthInstance, getApiKeyScopesConfig } from './plugin/index.js';
|
|
15
14
|
// Scope utilities
|
|
16
|
-
export { generateScopesFromCollections, buildAvailableScopes, scopesToPermissions
|
|
15
|
+
export { generateScopesFromCollections, buildAvailableScopes, scopesToPermissions } from './utils/generateScopes.js';
|
|
17
16
|
// Access control utilities
|
|
18
|
-
export { normalizeRoles, hasAnyRole, hasAllRoles, hasAdminRoles, isAdmin, isAdminField, isAdminOrSelf, canUpdateOwnFields, isAuthenticated, isAuthenticatedField, hasRole, hasRoleField, requireAllRoles
|
|
17
|
+
export { normalizeRoles, hasAnyRole, hasAllRoles, hasAdminRoles, isAdmin, isAdminField, isAdminOrSelf, canUpdateOwnFields, isAuthenticated, isAuthenticatedField, hasRole, hasRoleField, requireAllRoles } from './utils/access.js';
|
|
19
18
|
// API key scope enforcement utilities
|
|
20
|
-
export { extractApiKeyFromRequest, getApiKeyInfo, hasScope, hasAnyScope as hasAnyScopeKey, hasAllScopes as hasAllScopesKey, requireScope, requireAnyScope, requireAllScopes as requireAllScopesKey, allowSessionOrScope, allowSessionOrAnyScope, validateApiKey
|
|
19
|
+
export { extractApiKeyFromRequest, getApiKeyInfo, hasScope, hasAnyScope as hasAnyScopeKey, hasAllScopes as hasAllScopesKey, requireScope, requireAnyScope, requireAllScopes as requireAllScopesKey, allowSessionOrScope, allowSessionOrAnyScope, validateApiKey } from './utils/apiKeyAccess.js';
|
|
21
20
|
// Auth config detection utility
|
|
22
21
|
export { detectAuthConfig } from './utils/detectAuthConfig.js';
|
|
23
22
|
// Session utilities
|
|
@@ -26,4 +25,5 @@ export { getServerSession, getServerUser } from './utils/session.js';
|
|
|
26
25
|
export { firstUserAdminHooks } from './utils/firstUserAdmin.js';
|
|
27
26
|
// Better Auth defaults utility
|
|
28
27
|
export { withBetterAuthDefaults, apiKeyWithDefaults } from './utils/betterAuthDefaults.js';
|
|
28
|
+
|
|
29
29
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * @delmare/payload-better-auth\n *\n * Better Auth adapter and plugins for Payload CMS.\n * Enables seamless integration between Better Auth and Payload.\n *\n * @packageDocumentation\n */\n\n// Adapter\nexport { payloadAdapter } from './adapter/index.js'\nexport type { PayloadAdapterConfig } from './adapter/index.js'\n\n// Collection generator plugin\nexport { betterAuthCollections } from './adapter/collections.js'\nexport type { BetterAuthCollectionsOptions } from './adapter/collections.js'\n\n// Payload plugin and strategy\nexport {\n createBetterAuthPlugin,\n betterAuthStrategy,\n resetAuthInstance,\n getApiKeyScopesConfig,\n} from './plugin/index.js'\nexport type {\n Auth,\n CreateAuthFunction,\n BetterAuthPluginOptions,\n BetterAuthPluginAdminOptions,\n BetterAuthStrategyOptions,\n} from './plugin/index.js'\n\n// Enhanced Better Auth types with inference\nexport type {\n BetterAuthReturn,\n PayloadWithAuth,\n PayloadRequestWithBetterAuth,\n CollectionHookWithBetterAuth,\n EndpointWithBetterAuth,\n RoleArray,\n} from './types/betterAuth.js'\n\n// Generated schema types\nexport type {\n User,\n Session as BetterAuthSession,\n Account,\n Verification,\n Apikey,\n Passkey,\n Organization,\n Member,\n Invitation,\n Team,\n TeamMember,\n TwoFactor,\n BaseUserFields,\n BaseSessionFields,\n BaseAccountFields,\n UserPluginFields,\n SessionPluginFields,\n BetterAuthFullSchema,\n ModelKey,\n PluginId,\n} from './generated-types.js'\n\n// API key scope types\nexport type {\n ScopeDefinition,\n ApiKeyScopesConfig,\n AvailableScope,\n} from './types/apiKey.js'\n\n// Scope utilities\nexport {\n generateScopesFromCollections,\n buildAvailableScopes,\n scopesToPermissions,\n} from './utils/generateScopes.js'\n\n// Access control utilities\nexport {\n normalizeRoles,\n hasAnyRole,\n hasAllRoles,\n hasAdminRoles,\n isAdmin,\n isAdminField,\n isAdminOrSelf,\n canUpdateOwnFields,\n isAuthenticated,\n isAuthenticatedField,\n hasRole,\n hasRoleField,\n requireAllRoles,\n} from './utils/access.js'\nexport type {\n RoleCheckConfig,\n SelfAccessConfig,\n FieldUpdateConfig,\n} from './utils/access.js'\n\n// API key scope enforcement utilities\nexport {\n extractApiKeyFromRequest,\n getApiKeyInfo,\n hasScope,\n hasAnyScope as hasAnyScopeKey,\n hasAllScopes as hasAllScopesKey,\n requireScope,\n requireAnyScope,\n requireAllScopes as requireAllScopesKey,\n allowSessionOrScope,\n allowSessionOrAnyScope,\n validateApiKey,\n} from './utils/apiKeyAccess.js'\nexport type {\n ApiKeyInfo,\n ApiKeyAccessConfig,\n} from './utils/apiKeyAccess.js'\n\n// Auth config detection utility\nexport { detectAuthConfig } from './utils/detectAuthConfig.js'\nexport type { AuthDetectionResult } from './utils/detectAuthConfig.js'\n\n// Session utilities\nexport { getServerSession, getServerUser } from './utils/session.js'\nexport type { Session } from './utils/session.js'\n\n// First user admin hook utility\nexport { firstUserAdminHooks } from './utils/firstUserAdmin.js'\nexport type { FirstUserAdminOptions } from './utils/firstUserAdmin.js'\n\n// Better Auth defaults utility\nexport { withBetterAuthDefaults, apiKeyWithDefaults } from './utils/betterAuthDefaults.js'\n"],"names":["payloadAdapter","betterAuthCollections","createBetterAuthPlugin","betterAuthStrategy","resetAuthInstance","getApiKeyScopesConfig","generateScopesFromCollections","buildAvailableScopes","scopesToPermissions","normalizeRoles","hasAnyRole","hasAllRoles","hasAdminRoles","isAdmin","isAdminField","isAdminOrSelf","canUpdateOwnFields","isAuthenticated","isAuthenticatedField","hasRole","hasRoleField","requireAllRoles","extractApiKeyFromRequest","getApiKeyInfo","hasScope","hasAnyScope","hasAnyScopeKey","hasAllScopes","hasAllScopesKey","requireScope","requireAnyScope","requireAllScopes","requireAllScopesKey","allowSessionOrScope","allowSessionOrAnyScope","validateApiKey","detectAuthConfig","getServerSession","getServerUser","firstUserAdminHooks","withBetterAuthDefaults","apiKeyWithDefaults"],"mappings":"AAAA;;;;;;;CAOC,GAED,UAAU;AACV,SAASA,cAAc,QAAQ,qBAAoB;AAGnD,8BAA8B;AAC9B,SAASC,qBAAqB,QAAQ,2BAA0B;AAGhE,8BAA8B;AAC9B,SACEC,sBAAsB,EACtBC,kBAAkB,EAClBC,iBAAiB,EACjBC,qBAAqB,QAChB,oBAAmB;AAkD1B,kBAAkB;AAClB,SACEC,6BAA6B,EAC7BC,oBAAoB,EACpBC,mBAAmB,QACd,4BAA2B;AAElC,2BAA2B;AAC3B,SACEC,cAAc,EACdC,UAAU,EACVC,WAAW,EACXC,aAAa,EACbC,OAAO,EACPC,YAAY,EACZC,aAAa,EACbC,kBAAkB,EAClBC,eAAe,EACfC,oBAAoB,EACpBC,OAAO,EACPC,YAAY,EACZC,eAAe,QACV,oBAAmB;AAO1B,sCAAsC;AACtC,SACEC,wBAAwB,EACxBC,aAAa,EACbC,QAAQ,EACRC,eAAeC,cAAc,EAC7BC,gBAAgBC,eAAe,EAC/BC,YAAY,EACZC,eAAe,EACfC,oBAAoBC,mBAAmB,EACvCC,mBAAmB,EACnBC,sBAAsB,EACtBC,cAAc,QACT,0BAAyB;AAMhC,gCAAgC;AAChC,SAASC,gBAAgB,QAAQ,8BAA6B;AAG9D,oBAAoB;AACpB,SAASC,gBAAgB,EAAEC,aAAa,QAAQ,qBAAoB;AAGpE,gCAAgC;AAChC,SAASC,mBAAmB,QAAQ,4BAA2B;AAG/D,+BAA+B;AAC/B,SAASC,sBAAsB,EAAEC,kBAAkB,QAAQ,gCAA+B"}
|
package/dist/plugin/index.d.ts
CHANGED
|
@@ -34,8 +34,41 @@ export type BetterAuthPluginAdminOptions = {
|
|
|
34
34
|
* Default: false (any matching role grants access)
|
|
35
35
|
*/
|
|
36
36
|
requireAllRoles?: boolean;
|
|
37
|
-
/**
|
|
38
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Enable passkey (WebAuthn) sign-in option.
|
|
39
|
+
* - true: Always show passkey button
|
|
40
|
+
* - false: Never show passkey button
|
|
41
|
+
* - 'auto': Auto-detect if passkey plugin is available (default for LoginView)
|
|
42
|
+
* Default: false (for backwards compatibility)
|
|
43
|
+
*/
|
|
44
|
+
enablePasskey?: boolean | 'auto';
|
|
45
|
+
/**
|
|
46
|
+
* Enable user registration (sign up) option.
|
|
47
|
+
* - true: Always show "Create account" link
|
|
48
|
+
* - false: Never show registration option
|
|
49
|
+
* - 'auto': Auto-detect if sign-up endpoint is available
|
|
50
|
+
* Default: 'auto' - LoginView automatically detects if Better Auth has signup enabled
|
|
51
|
+
*/
|
|
52
|
+
enableSignUp?: boolean | 'auto';
|
|
53
|
+
/**
|
|
54
|
+
* Default role to assign to new users during registration.
|
|
55
|
+
* Only used when enableSignUp is enabled.
|
|
56
|
+
* Default: 'user'
|
|
57
|
+
*/
|
|
58
|
+
defaultSignUpRole?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Enable forgot password option.
|
|
61
|
+
* - true: Always show "Forgot password?" link
|
|
62
|
+
* - false: Never show forgot password option
|
|
63
|
+
* - 'auto': Auto-detect if password reset endpoint is available
|
|
64
|
+
* Default: 'auto' - LoginView automatically detects if Better Auth has password reset enabled
|
|
65
|
+
*/
|
|
66
|
+
enableForgotPassword?: boolean | 'auto';
|
|
67
|
+
/**
|
|
68
|
+
* Custom URL for password reset page. If provided, users will be redirected here
|
|
69
|
+
* instead of showing the inline password reset form.
|
|
70
|
+
*/
|
|
71
|
+
resetPasswordUrl?: string;
|
|
39
72
|
};
|
|
40
73
|
/** Path to custom logout button component (import map format) */
|
|
41
74
|
logoutButtonComponent?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugin/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,MAAM,EACN,YAAY,EAEZ,WAAW,EAIZ,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAMhE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAM5D,MAAM,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAA;AAGhD,YAAY,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAE7D,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAA;AAE/D,MAAM,MAAM,4BAA4B,GAAG;IACzC,8CAA8C;IAC9C,mBAAmB,CAAC,EAAE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