@better-auth-ui/react 1.6.30 → 1.6.32
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/index.d.ts +6 -0
- package/dist/index.js +420 -329
- package/dist/lib/auth-client.d.ts +11 -1
- package/dist/mutations/admin/stop-impersonating-mutation.d.ts +61 -0
- package/dist/mutations/device-authorization/approve-device-mutation.d.ts +33 -0
- package/dist/mutations/device-authorization/deny-device-mutation.d.ts +33 -0
- package/dist/mutations/device-authorization/verify-device-code-mutation.d.ts +107 -0
- package/dist/mutations/oauth-provider/oauth-consent-mutation.d.ts +40 -0
- package/dist/mutations/organization/accept-invitation-mutation.d.ts +4 -4
- package/dist/mutations/organization/cancel-invitation-mutation.d.ts +4 -4
- package/dist/mutations/organization/invite-member-mutation.d.ts +8 -8
- package/dist/mutations/organization/leave-organization-mutation.d.ts +2 -2
- package/dist/mutations/organization/reject-invitation-mutation.d.ts +2 -2
- package/dist/mutations/organization/remove-member-mutation.d.ts +2 -2
- package/dist/mutations/organization/set-active-organization-mutation.d.ts +6 -6
- package/dist/queries/oauth-provider/public-oauth-client-query.d.ts +33 -0
- package/dist/queries/organization/list-members-query.d.ts +4 -4
- package/dist/server/queries/organization/list-members-query.d.ts +4 -4
- package/package.json +3 -1
- package/src/index.ts +6 -0
- package/src/lib/auth-client.ts +22 -0
- package/src/mutations/admin/stop-impersonating-mutation.ts +71 -0
- package/src/mutations/device-authorization/approve-device-mutation.ts +45 -0
- package/src/mutations/device-authorization/deny-device-mutation.ts +45 -0
- package/src/mutations/device-authorization/verify-device-code-mutation.ts +48 -0
- package/src/mutations/oauth-provider/oauth-consent-mutation.ts +41 -0
- package/src/queries/oauth-provider/public-oauth-client-query.ts +131 -0
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { apiKeyClient } from '@better-auth/api-key/client';
|
|
2
|
+
import { oauthProviderClient } from '@better-auth/oauth-provider/client';
|
|
2
3
|
import { passkeyClient } from '@better-auth/passkey/client';
|
|
3
|
-
import { lastLoginMethodClient, magicLinkClient, multiSessionClient, organizationClient, usernameClient } from 'better-auth/client/plugins';
|
|
4
|
+
import { AdminClientOptions, adminClient, deviceAuthorizationClient, lastLoginMethodClient, magicLinkClient, multiSessionClient, organizationClient, usernameClient } from 'better-auth/client/plugins';
|
|
4
5
|
import { createAuthClient } from 'better-auth/react';
|
|
5
6
|
export type AuthClient = ReturnType<typeof createAuthClient>;
|
|
7
|
+
export type AdminAuthClient = ReturnType<typeof createAuthClient<{
|
|
8
|
+
plugins: [ReturnType<typeof adminClient<AdminClientOptions>>];
|
|
9
|
+
}>>;
|
|
6
10
|
export type MagicLinkAuthClient = ReturnType<typeof createAuthClient<{
|
|
7
11
|
plugins: [ReturnType<typeof magicLinkClient>];
|
|
8
12
|
}>>;
|
|
13
|
+
export type DeviceAuthorizationAuthClient = ReturnType<typeof createAuthClient<{
|
|
14
|
+
plugins: [ReturnType<typeof deviceAuthorizationClient>];
|
|
15
|
+
}>>;
|
|
9
16
|
export type LastLoginMethodAuthClient = ReturnType<typeof createAuthClient<{
|
|
10
17
|
plugins: [ReturnType<typeof lastLoginMethodClient>];
|
|
11
18
|
}>>;
|
|
@@ -18,6 +25,9 @@ export type PasskeyAuthClient = ReturnType<typeof createAuthClient<{
|
|
|
18
25
|
export type ApiKeyAuthClient = ReturnType<typeof createAuthClient<{
|
|
19
26
|
plugins: [ReturnType<typeof apiKeyClient>];
|
|
20
27
|
}>>;
|
|
28
|
+
export type OAuthProviderAuthClient = ReturnType<typeof createAuthClient<{
|
|
29
|
+
plugins: [ReturnType<typeof oauthProviderClient>];
|
|
30
|
+
}>>;
|
|
21
31
|
export type UsernameAuthClient = ReturnType<typeof createAuthClient<{
|
|
22
32
|
plugins: [ReturnType<typeof usernameClient>];
|
|
23
33
|
}>>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { QueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { BetterFetchError } from 'better-auth/react';
|
|
3
|
+
import { AdminAuthClient } from '../../lib/auth-client';
|
|
4
|
+
export type StopImpersonatingParams<TAuthClient extends AdminAuthClient> = Parameters<TAuthClient["admin"]["stopImpersonating"]>[0];
|
|
5
|
+
export type StopImpersonatingOptions<TAuthClient extends AdminAuthClient> = Omit<ReturnType<typeof stopImpersonatingOptions<TAuthClient>>, "mutationKey" | "mutationFn" | "meta">;
|
|
6
|
+
/**
|
|
7
|
+
* Mutation options factory for restoring the administrator's session.
|
|
8
|
+
*
|
|
9
|
+
* @param authClient - The Better Auth client with the admin plugin.
|
|
10
|
+
*/
|
|
11
|
+
export declare function stopImpersonatingOptions<TAuthClient extends AdminAuthClient>(authClient: TAuthClient): import('@tanstack/query-core').WithRequired<import('@tanstack/react-query').UseMutationOptions<{
|
|
12
|
+
session: {
|
|
13
|
+
id: string;
|
|
14
|
+
createdAt: Date;
|
|
15
|
+
updatedAt: Date;
|
|
16
|
+
userId: string;
|
|
17
|
+
expiresAt: Date;
|
|
18
|
+
token: string;
|
|
19
|
+
ipAddress?: string | null | undefined;
|
|
20
|
+
userAgent?: string | null | undefined;
|
|
21
|
+
} & Record<string, any>;
|
|
22
|
+
user: {
|
|
23
|
+
id: string;
|
|
24
|
+
createdAt: Date;
|
|
25
|
+
updatedAt: Date;
|
|
26
|
+
email: string;
|
|
27
|
+
emailVerified: boolean;
|
|
28
|
+
name: string;
|
|
29
|
+
image?: string | null | undefined;
|
|
30
|
+
} & Record<string, any>;
|
|
31
|
+
}, BetterFetchError, StopImpersonatingParams<TAuthClient> | undefined, unknown>, "mutationKey">;
|
|
32
|
+
/**
|
|
33
|
+
* Stop impersonating a user and restore the administrator's session.
|
|
34
|
+
*
|
|
35
|
+
* On success, `MutationInvalidator` awaits invalidation of the session query
|
|
36
|
+
* so every auth surface immediately reflects the restored administrator.
|
|
37
|
+
*
|
|
38
|
+
* @param authClient - The Better Auth client with the admin plugin.
|
|
39
|
+
* @param options - React Query options forwarded to `useMutation`.
|
|
40
|
+
*/
|
|
41
|
+
export declare function useStopImpersonating<TAuthClient extends AdminAuthClient>(authClient: TAuthClient, options?: StopImpersonatingOptions<TAuthClient>, queryClient?: QueryClient): import('@tanstack/react-query').UseMutationResult<{
|
|
42
|
+
session: {
|
|
43
|
+
id: string;
|
|
44
|
+
createdAt: Date;
|
|
45
|
+
updatedAt: Date;
|
|
46
|
+
userId: string;
|
|
47
|
+
expiresAt: Date;
|
|
48
|
+
token: string;
|
|
49
|
+
ipAddress?: string | null | undefined;
|
|
50
|
+
userAgent?: string | null | undefined;
|
|
51
|
+
} & Record<string, any>;
|
|
52
|
+
user: {
|
|
53
|
+
id: string;
|
|
54
|
+
createdAt: Date;
|
|
55
|
+
updatedAt: Date;
|
|
56
|
+
email: string;
|
|
57
|
+
emailVerified: boolean;
|
|
58
|
+
name: string;
|
|
59
|
+
image?: string | null | undefined;
|
|
60
|
+
} & Record<string, any>;
|
|
61
|
+
}, BetterFetchError, StopImpersonatingParams<TAuthClient> | undefined, unknown>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { DeviceAuthorizationAuthClient } from '../../lib/auth-client';
|
|
2
|
+
export type ApproveDeviceParams<TAuthClient extends DeviceAuthorizationAuthClient> = Parameters<TAuthClient["device"]["approve"]>[0];
|
|
3
|
+
export type ApproveDeviceOptions<TAuthClient extends DeviceAuthorizationAuthClient> = Omit<ReturnType<typeof approveDeviceOptions<TAuthClient>>, "mutationKey" | "mutationFn">;
|
|
4
|
+
/**
|
|
5
|
+
* Mutation options factory for approving a pending device request.
|
|
6
|
+
*
|
|
7
|
+
* @param authClient - The Better Auth client with the device-authorization plugin.
|
|
8
|
+
*/
|
|
9
|
+
export declare function approveDeviceOptions<TAuthClient extends DeviceAuthorizationAuthClient>(authClient: TAuthClient): import('../auth-mutation-options').AuthMutationOptions<(<FetchOptions extends import('better-auth').ClientFetchOption<Partial<{
|
|
10
|
+
userCode: string;
|
|
11
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import('better-auth').Prettify<{
|
|
12
|
+
userCode: string;
|
|
13
|
+
} & {
|
|
14
|
+
fetchOptions?: FetchOptions | undefined;
|
|
15
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import('better-auth/client').BetterFetchResponse<{
|
|
16
|
+
success: boolean;
|
|
17
|
+
}, {
|
|
18
|
+
error: "invalid_request" | "expired_token" | "access_denied" | "device_code_already_processed" | "unauthorized";
|
|
19
|
+
error_description: string;
|
|
20
|
+
}, FetchOptions["throw"] extends true ? true : false>>), readonly ["auth", "deviceAuthorization", "approve"]>;
|
|
21
|
+
/**
|
|
22
|
+
* Create a mutation for approving a pending device request.
|
|
23
|
+
*
|
|
24
|
+
* @param authClient - The Better Auth client with the device-authorization plugin.
|
|
25
|
+
* @param options - React Query options forwarded to `useMutation`.
|
|
26
|
+
*/
|
|
27
|
+
export declare function useApproveDevice<TAuthClient extends DeviceAuthorizationAuthClient>(authClient: TAuthClient, options?: ApproveDeviceOptions<TAuthClient>): import('@tanstack/react-query').UseMutationResult<any, import('better-auth/client').BetterFetchError, import('better-auth').Prettify<{
|
|
28
|
+
userCode: string;
|
|
29
|
+
} & {
|
|
30
|
+
fetchOptions?: import('better-auth').ClientFetchOption<Partial<{
|
|
31
|
+
userCode: string;
|
|
32
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined> | undefined;
|
|
33
|
+
}>, unknown>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { DeviceAuthorizationAuthClient } from '../../lib/auth-client';
|
|
2
|
+
export type DenyDeviceParams<TAuthClient extends DeviceAuthorizationAuthClient> = Parameters<TAuthClient["device"]["deny"]>[0];
|
|
3
|
+
export type DenyDeviceOptions<TAuthClient extends DeviceAuthorizationAuthClient> = Omit<ReturnType<typeof denyDeviceOptions<TAuthClient>>, "mutationKey" | "mutationFn">;
|
|
4
|
+
/**
|
|
5
|
+
* Mutation options factory for denying a pending device request.
|
|
6
|
+
*
|
|
7
|
+
* @param authClient - The Better Auth client with the device-authorization plugin.
|
|
8
|
+
*/
|
|
9
|
+
export declare function denyDeviceOptions<TAuthClient extends DeviceAuthorizationAuthClient>(authClient: TAuthClient): import('../auth-mutation-options').AuthMutationOptions<(<FetchOptions extends import('better-auth').ClientFetchOption<Partial<{
|
|
10
|
+
userCode: string;
|
|
11
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import('better-auth').Prettify<{
|
|
12
|
+
userCode: string;
|
|
13
|
+
} & {
|
|
14
|
+
fetchOptions?: FetchOptions | undefined;
|
|
15
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import('better-auth/client').BetterFetchResponse<{
|
|
16
|
+
success: boolean;
|
|
17
|
+
}, {
|
|
18
|
+
error: "invalid_request" | "expired_token" | "access_denied" | "unauthorized";
|
|
19
|
+
error_description: string;
|
|
20
|
+
}, FetchOptions["throw"] extends true ? true : false>>), readonly ["auth", "deviceAuthorization", "deny"]>;
|
|
21
|
+
/**
|
|
22
|
+
* Create a mutation for denying a pending device request.
|
|
23
|
+
*
|
|
24
|
+
* @param authClient - The Better Auth client with the device-authorization plugin.
|
|
25
|
+
* @param options - React Query options forwarded to `useMutation`.
|
|
26
|
+
*/
|
|
27
|
+
export declare function useDenyDevice<TAuthClient extends DeviceAuthorizationAuthClient>(authClient: TAuthClient, options?: DenyDeviceOptions<TAuthClient>): import('@tanstack/react-query').UseMutationResult<any, import('better-auth/client').BetterFetchError, import('better-auth').Prettify<{
|
|
28
|
+
userCode: string;
|
|
29
|
+
} & {
|
|
30
|
+
fetchOptions?: import('better-auth').ClientFetchOption<Partial<{
|
|
31
|
+
userCode: string;
|
|
32
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined> | undefined;
|
|
33
|
+
}>, unknown>;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { DeviceAuthorizationAuthClient } from '../../lib/auth-client';
|
|
2
|
+
export type VerifyDeviceCodeParams<TAuthClient extends DeviceAuthorizationAuthClient> = Parameters<TAuthClient["device"]>[0];
|
|
3
|
+
export type VerifyDeviceCodeOptions<TAuthClient extends DeviceAuthorizationAuthClient> = Omit<ReturnType<typeof verifyDeviceCodeOptions<TAuthClient>>, "mutationKey" | "mutationFn">;
|
|
4
|
+
/**
|
|
5
|
+
* Mutation options factory for verifying and claiming a device user code.
|
|
6
|
+
*
|
|
7
|
+
* The Better Auth endpoint uses GET, but this operation is modeled as a
|
|
8
|
+
* mutation because verification binds the code to the current session.
|
|
9
|
+
*
|
|
10
|
+
* @param authClient - The Better Auth client with the device-authorization plugin.
|
|
11
|
+
*/
|
|
12
|
+
export declare function verifyDeviceCodeOptions<TAuthClient extends DeviceAuthorizationAuthClient>(authClient: TAuthClient): import('../auth-mutation-options').AuthMutationOptions<{
|
|
13
|
+
code: <FetchOptions extends import('better-auth').ClientFetchOption<Partial<{
|
|
14
|
+
client_id: string;
|
|
15
|
+
user_id?: string | undefined;
|
|
16
|
+
scope?: string | undefined;
|
|
17
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import('better-auth').Prettify<{
|
|
18
|
+
client_id: string;
|
|
19
|
+
user_id?: string | undefined;
|
|
20
|
+
scope?: string | undefined;
|
|
21
|
+
} & {
|
|
22
|
+
fetchOptions?: FetchOptions | undefined;
|
|
23
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import('better-auth/client').BetterFetchResponse<{
|
|
24
|
+
device_code: string;
|
|
25
|
+
user_code: string;
|
|
26
|
+
verification_uri: string;
|
|
27
|
+
verification_uri_complete: string;
|
|
28
|
+
expires_in: number;
|
|
29
|
+
interval: number;
|
|
30
|
+
}, {
|
|
31
|
+
error: "invalid_request" | "invalid_client";
|
|
32
|
+
error_description: string;
|
|
33
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
34
|
+
} & {
|
|
35
|
+
token: <FetchOptions extends import('better-auth').ClientFetchOption<Partial<{
|
|
36
|
+
grant_type: "urn:ietf:params:oauth:grant-type:device_code";
|
|
37
|
+
device_code: string;
|
|
38
|
+
client_id: string;
|
|
39
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import('better-auth').Prettify<{
|
|
40
|
+
grant_type: "urn:ietf:params:oauth:grant-type:device_code";
|
|
41
|
+
device_code: string;
|
|
42
|
+
client_id: string;
|
|
43
|
+
} & {
|
|
44
|
+
fetchOptions?: FetchOptions | undefined;
|
|
45
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import('better-auth/client').BetterFetchResponse<{
|
|
46
|
+
access_token: string;
|
|
47
|
+
token_type: string;
|
|
48
|
+
expires_in: number;
|
|
49
|
+
scope: string;
|
|
50
|
+
}, {
|
|
51
|
+
error: "invalid_request" | "authorization_pending" | "slow_down" | "expired_token" | "access_denied" | "invalid_grant";
|
|
52
|
+
error_description: string;
|
|
53
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
54
|
+
} & (<FetchOptions extends import('better-auth').ClientFetchOption<never, Partial<{
|
|
55
|
+
user_code: string;
|
|
56
|
+
}> & Record<string, any>, Record<string, any> | undefined>>(data_0: import('better-auth').Prettify<{
|
|
57
|
+
query: {
|
|
58
|
+
user_code: string;
|
|
59
|
+
};
|
|
60
|
+
fetchOptions?: FetchOptions | undefined;
|
|
61
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import('better-auth/client').BetterFetchResponse<{
|
|
62
|
+
user_code: string;
|
|
63
|
+
status: string;
|
|
64
|
+
}, {
|
|
65
|
+
error: "invalid_request";
|
|
66
|
+
error_description: string;
|
|
67
|
+
}, FetchOptions["throw"] extends true ? true : false>>) & {
|
|
68
|
+
approve: <FetchOptions extends import('better-auth').ClientFetchOption<Partial<{
|
|
69
|
+
userCode: string;
|
|
70
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import('better-auth').Prettify<{
|
|
71
|
+
userCode: string;
|
|
72
|
+
} & {
|
|
73
|
+
fetchOptions?: FetchOptions | undefined;
|
|
74
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import('better-auth/client').BetterFetchResponse<{
|
|
75
|
+
success: boolean;
|
|
76
|
+
}, {
|
|
77
|
+
error: "invalid_request" | "expired_token" | "access_denied" | "device_code_already_processed" | "unauthorized";
|
|
78
|
+
error_description: string;
|
|
79
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
80
|
+
} & {
|
|
81
|
+
deny: <FetchOptions extends import('better-auth').ClientFetchOption<Partial<{
|
|
82
|
+
userCode: string;
|
|
83
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import('better-auth').Prettify<{
|
|
84
|
+
userCode: string;
|
|
85
|
+
} & {
|
|
86
|
+
fetchOptions?: FetchOptions | undefined;
|
|
87
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import('better-auth/client').BetterFetchResponse<{
|
|
88
|
+
success: boolean;
|
|
89
|
+
}, {
|
|
90
|
+
error: "invalid_request" | "expired_token" | "access_denied" | "unauthorized";
|
|
91
|
+
error_description: string;
|
|
92
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
93
|
+
}, readonly ["auth", "deviceAuthorization", "verify"]>;
|
|
94
|
+
/**
|
|
95
|
+
* Create a mutation for verifying and claiming a device user code.
|
|
96
|
+
*
|
|
97
|
+
* @param authClient - The Better Auth client with the device-authorization plugin.
|
|
98
|
+
* @param options - React Query options forwarded to `useMutation`.
|
|
99
|
+
*/
|
|
100
|
+
export declare function useVerifyDeviceCode<TAuthClient extends DeviceAuthorizationAuthClient>(authClient: TAuthClient, options?: VerifyDeviceCodeOptions<TAuthClient>): import('@tanstack/react-query').UseMutationResult<any, import('better-auth/client').BetterFetchError, import('better-auth').Prettify<{
|
|
101
|
+
query: {
|
|
102
|
+
user_code: string;
|
|
103
|
+
};
|
|
104
|
+
fetchOptions?: import('better-auth').ClientFetchOption<never, Partial<{
|
|
105
|
+
user_code: string;
|
|
106
|
+
}> & Record<string, any>, Record<string, any> | undefined> | undefined;
|
|
107
|
+
}>, unknown>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { OAuthProviderAuthClient } from '../../lib/auth-client';
|
|
2
|
+
export type OAuthConsentParams<TAuthClient extends OAuthProviderAuthClient = OAuthProviderAuthClient> = Parameters<TAuthClient["oauth2"]["consent"]>[0];
|
|
3
|
+
export type OAuthConsentOptions<TAuthClient extends OAuthProviderAuthClient = OAuthProviderAuthClient> = Omit<ReturnType<typeof oauthConsentOptions<TAuthClient>>, "mutationKey" | "mutationFn">;
|
|
4
|
+
/**
|
|
5
|
+
* Mutation options factory for accepting or denying an OAuth request.
|
|
6
|
+
*
|
|
7
|
+
* Better Auth reads the signed authorization query from the current URL and
|
|
8
|
+
* validates the resulting redirect.
|
|
9
|
+
*/
|
|
10
|
+
export declare function oauthConsentOptions<TAuthClient extends OAuthProviderAuthClient>(authClient: TAuthClient): import('../auth-mutation-options').AuthMutationOptions<(<FetchOptions extends import('better-auth').ClientFetchOption<Partial<{
|
|
11
|
+
accept: boolean;
|
|
12
|
+
scope?: string | undefined;
|
|
13
|
+
oauth_query?: string | undefined;
|
|
14
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import('better-auth').Prettify<{
|
|
15
|
+
accept: boolean;
|
|
16
|
+
scope?: string | undefined;
|
|
17
|
+
oauth_query?: string | undefined;
|
|
18
|
+
} & {
|
|
19
|
+
fetchOptions?: FetchOptions | undefined;
|
|
20
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import('better-auth/client').BetterFetchResponse<NonNullable<{
|
|
21
|
+
redirect: boolean;
|
|
22
|
+
url: string;
|
|
23
|
+
} | {
|
|
24
|
+
redirect: boolean;
|
|
25
|
+
url: string;
|
|
26
|
+
}>, {
|
|
27
|
+
code?: string | undefined;
|
|
28
|
+
message?: string | undefined;
|
|
29
|
+
}, FetchOptions["throw"] extends true ? true : false>>), readonly ["auth", "oauthProvider", "consent"]>;
|
|
30
|
+
export declare function useOAuthConsent<TAuthClient extends OAuthProviderAuthClient>(authClient: TAuthClient, options?: OAuthConsentOptions<TAuthClient>): import('@tanstack/react-query').UseMutationResult<any, import('better-auth/client').BetterFetchError, import('better-auth').Prettify<{
|
|
31
|
+
accept: boolean;
|
|
32
|
+
scope?: string | undefined;
|
|
33
|
+
oauth_query?: string | undefined;
|
|
34
|
+
} & {
|
|
35
|
+
fetchOptions?: import('better-auth').ClientFetchOption<Partial<{
|
|
36
|
+
accept: boolean;
|
|
37
|
+
scope?: string | undefined;
|
|
38
|
+
oauth_query?: string | undefined;
|
|
39
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined> | undefined;
|
|
40
|
+
}>, unknown>;
|
|
@@ -8,8 +8,8 @@ export declare function acceptInvitationOptions<TAuthClient extends Organization
|
|
|
8
8
|
id: string;
|
|
9
9
|
organizationId: string;
|
|
10
10
|
email: string;
|
|
11
|
-
role: "
|
|
12
|
-
status: import('better-auth/
|
|
11
|
+
role: "admin" | "member" | "owner";
|
|
12
|
+
status: import('better-auth/plugins').InvitationStatus;
|
|
13
13
|
inviterId: string;
|
|
14
14
|
expiresAt: Date;
|
|
15
15
|
createdAt: Date;
|
|
@@ -27,8 +27,8 @@ export declare function useAcceptInvitation<TAuthClient extends OrganizationAuth
|
|
|
27
27
|
id: string;
|
|
28
28
|
organizationId: string;
|
|
29
29
|
email: string;
|
|
30
|
-
role: "
|
|
31
|
-
status: import('better-auth/
|
|
30
|
+
role: "admin" | "member" | "owner";
|
|
31
|
+
status: import('better-auth/plugins').InvitationStatus;
|
|
32
32
|
inviterId: string;
|
|
33
33
|
expiresAt: Date;
|
|
34
34
|
createdAt: Date;
|
|
@@ -7,8 +7,8 @@ export declare function cancelInvitationOptions<TAuthClient extends Organization
|
|
|
7
7
|
id: string;
|
|
8
8
|
organizationId: string;
|
|
9
9
|
email: string;
|
|
10
|
-
role: "
|
|
11
|
-
status: import('better-auth/
|
|
10
|
+
role: "admin" | "member" | "owner";
|
|
11
|
+
status: import('better-auth/plugins').InvitationStatus;
|
|
12
12
|
inviterId: string;
|
|
13
13
|
expiresAt: Date;
|
|
14
14
|
createdAt: Date;
|
|
@@ -17,8 +17,8 @@ export declare function useCancelInvitation<TAuthClient extends OrganizationAuth
|
|
|
17
17
|
id: string;
|
|
18
18
|
organizationId: string;
|
|
19
19
|
email: string;
|
|
20
|
-
role: "
|
|
21
|
-
status: import('better-auth/
|
|
20
|
+
role: "admin" | "member" | "owner";
|
|
21
|
+
status: import('better-auth/plugins').InvitationStatus;
|
|
22
22
|
inviterId: string;
|
|
23
23
|
expiresAt: Date;
|
|
24
24
|
createdAt: Date;
|
|
@@ -7,8 +7,8 @@ export declare function inviteMemberOptions<TAuthClient extends OrganizationAuth
|
|
|
7
7
|
id: string;
|
|
8
8
|
organizationId: string;
|
|
9
9
|
email: string;
|
|
10
|
-
role: "
|
|
11
|
-
status: import('better-auth/
|
|
10
|
+
role: "admin" | "member" | "owner";
|
|
11
|
+
status: import('better-auth/plugins').InvitationStatus;
|
|
12
12
|
inviterId: string;
|
|
13
13
|
expiresAt: Date;
|
|
14
14
|
createdAt: Date;
|
|
@@ -16,8 +16,8 @@ export declare function inviteMemberOptions<TAuthClient extends OrganizationAuth
|
|
|
16
16
|
id: string;
|
|
17
17
|
organizationId: string;
|
|
18
18
|
email: string;
|
|
19
|
-
role: "
|
|
20
|
-
status: import('better-auth/
|
|
19
|
+
role: "admin" | "member" | "owner";
|
|
20
|
+
status: import('better-auth/plugins').InvitationStatus;
|
|
21
21
|
inviterId: string;
|
|
22
22
|
expiresAt: Date;
|
|
23
23
|
createdAt: Date;
|
|
@@ -26,8 +26,8 @@ export declare function useInviteMember<TAuthClient extends OrganizationAuthClie
|
|
|
26
26
|
id: string;
|
|
27
27
|
organizationId: string;
|
|
28
28
|
email: string;
|
|
29
|
-
role: "
|
|
30
|
-
status: import('better-auth/
|
|
29
|
+
role: "admin" | "member" | "owner";
|
|
30
|
+
status: import('better-auth/plugins').InvitationStatus;
|
|
31
31
|
inviterId: string;
|
|
32
32
|
expiresAt: Date;
|
|
33
33
|
createdAt: Date;
|
|
@@ -35,8 +35,8 @@ export declare function useInviteMember<TAuthClient extends OrganizationAuthClie
|
|
|
35
35
|
id: string;
|
|
36
36
|
organizationId: string;
|
|
37
37
|
email: string;
|
|
38
|
-
role: "
|
|
39
|
-
status: import('better-auth/
|
|
38
|
+
role: "admin" | "member" | "owner";
|
|
39
|
+
status: import('better-auth/plugins').InvitationStatus;
|
|
40
40
|
inviterId: string;
|
|
41
41
|
expiresAt: Date;
|
|
42
42
|
createdAt: Date;
|
|
@@ -6,7 +6,7 @@ export type LeaveOrganizationOptions<TAuthClient extends OrganizationAuthClient>
|
|
|
6
6
|
export declare function leaveOrganizationOptions<TAuthClient extends OrganizationAuthClient>(authClient: TAuthClient): import('@tanstack/query-core').WithRequired<import('@tanstack/react-query').UseMutationOptions<Omit<{
|
|
7
7
|
id: string;
|
|
8
8
|
organizationId: string;
|
|
9
|
-
role: "
|
|
9
|
+
role: "admin" | "member" | "owner";
|
|
10
10
|
createdAt: Date;
|
|
11
11
|
userId: string;
|
|
12
12
|
user: {
|
|
@@ -36,7 +36,7 @@ export declare function leaveOrganizationOptions<TAuthClient extends Organizatio
|
|
|
36
36
|
export declare function useLeaveOrganization<TAuthClient extends OrganizationAuthClient>(authClient: TAuthClient, options?: LeaveOrganizationOptions<TAuthClient>, queryClient?: QueryClient): import('@tanstack/react-query').UseMutationResult<Omit<{
|
|
37
37
|
id: string;
|
|
38
38
|
organizationId: string;
|
|
39
|
-
role: "
|
|
39
|
+
role: "admin" | "member" | "owner";
|
|
40
40
|
createdAt: Date;
|
|
41
41
|
userId: string;
|
|
42
42
|
user: {
|
|
@@ -9,7 +9,7 @@ export declare function rejectInvitationOptions<TAuthClient extends Organization
|
|
|
9
9
|
organizationId: string;
|
|
10
10
|
email: string;
|
|
11
11
|
role: "admin" | "member" | "owner";
|
|
12
|
-
status: import('better-auth/
|
|
12
|
+
status: import('better-auth/plugins').InvitationStatus;
|
|
13
13
|
inviterId: string;
|
|
14
14
|
expiresAt: Date;
|
|
15
15
|
createdAt: Date;
|
|
@@ -22,7 +22,7 @@ export declare function useRejectInvitation<TAuthClient extends OrganizationAuth
|
|
|
22
22
|
organizationId: string;
|
|
23
23
|
email: string;
|
|
24
24
|
role: "admin" | "member" | "owner";
|
|
25
|
-
status: import('better-auth/
|
|
25
|
+
status: import('better-auth/plugins').InvitationStatus;
|
|
26
26
|
inviterId: string;
|
|
27
27
|
expiresAt: Date;
|
|
28
28
|
createdAt: Date;
|
|
@@ -7,7 +7,7 @@ export declare function removeMemberOptions<TAuthClient extends OrganizationAuth
|
|
|
7
7
|
member: {
|
|
8
8
|
id: string;
|
|
9
9
|
organizationId: string;
|
|
10
|
-
role: "
|
|
10
|
+
role: "admin" | "member" | "owner";
|
|
11
11
|
createdAt: Date;
|
|
12
12
|
userId: string;
|
|
13
13
|
user: {
|
|
@@ -22,7 +22,7 @@ export declare function useRemoveMember<TAuthClient extends OrganizationAuthClie
|
|
|
22
22
|
member: {
|
|
23
23
|
id: string;
|
|
24
24
|
organizationId: string;
|
|
25
|
-
role: "
|
|
25
|
+
role: "admin" | "member" | "owner";
|
|
26
26
|
createdAt: Date;
|
|
27
27
|
userId: string;
|
|
28
28
|
user: {
|
|
@@ -7,7 +7,7 @@ export declare function setActiveOrganizationOptions<TAuthClient extends Organiz
|
|
|
7
7
|
members: {
|
|
8
8
|
id: string;
|
|
9
9
|
organizationId: string;
|
|
10
|
-
role: "
|
|
10
|
+
role: "admin" | "member" | "owner";
|
|
11
11
|
createdAt: Date;
|
|
12
12
|
userId: string;
|
|
13
13
|
user: {
|
|
@@ -21,8 +21,8 @@ export declare function setActiveOrganizationOptions<TAuthClient extends Organiz
|
|
|
21
21
|
id: string;
|
|
22
22
|
organizationId: string;
|
|
23
23
|
email: string;
|
|
24
|
-
role: "
|
|
25
|
-
status: import('better-auth/
|
|
24
|
+
role: "admin" | "member" | "owner";
|
|
25
|
+
status: import('better-auth/plugins').InvitationStatus;
|
|
26
26
|
inviterId: string;
|
|
27
27
|
expiresAt: Date;
|
|
28
28
|
createdAt: Date;
|
|
@@ -39,7 +39,7 @@ export declare function useSetActiveOrganization<TAuthClient extends Organizatio
|
|
|
39
39
|
members: {
|
|
40
40
|
id: string;
|
|
41
41
|
organizationId: string;
|
|
42
|
-
role: "
|
|
42
|
+
role: "admin" | "member" | "owner";
|
|
43
43
|
createdAt: Date;
|
|
44
44
|
userId: string;
|
|
45
45
|
user: {
|
|
@@ -53,8 +53,8 @@ export declare function useSetActiveOrganization<TAuthClient extends Organizatio
|
|
|
53
53
|
id: string;
|
|
54
54
|
organizationId: string;
|
|
55
55
|
email: string;
|
|
56
|
-
role: "
|
|
57
|
-
status: import('better-auth/
|
|
56
|
+
role: "admin" | "member" | "owner";
|
|
57
|
+
status: import('better-auth/plugins').InvitationStatus;
|
|
58
58
|
inviterId: string;
|
|
59
59
|
expiresAt: Date;
|
|
60
60
|
createdAt: Date;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { DataTag, QueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { BetterFetchError } from 'better-auth/react';
|
|
3
|
+
import { InferData, OAuthProviderAuthClient } from '../../lib/auth-client';
|
|
4
|
+
export type PublicOAuthClientData<TAuthClient extends OAuthProviderAuthClient = OAuthProviderAuthClient> = InferData<TAuthClient["oauth2"]["publicClient"]>;
|
|
5
|
+
export type PublicOAuthClientParams<TAuthClient extends OAuthProviderAuthClient = OAuthProviderAuthClient> = Partial<Omit<NonNullable<Parameters<TAuthClient["oauth2"]["publicClient"]>[0]>, "query">>;
|
|
6
|
+
export type PublicOAuthClientOptions<TAuthClient extends OAuthProviderAuthClient = OAuthProviderAuthClient> = Omit<ReturnType<typeof publicOAuthClientOptions<TAuthClient>>, "queryKey" | "queryFn">;
|
|
7
|
+
/**
|
|
8
|
+
* Query options factory for an OAuth application's public metadata.
|
|
9
|
+
*
|
|
10
|
+
* @param authClient - The Better Auth client with the OAuth provider plugin.
|
|
11
|
+
* @param clientId - The OAuth client ID from the signed authorization request.
|
|
12
|
+
* @param params - Fetch options forwarded to `oauth2.publicClient`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function publicOAuthClientOptions<TAuthClient extends OAuthProviderAuthClient>(authClient: TAuthClient, clientId: string, params?: PublicOAuthClientParams<TAuthClient>): (import('@tanstack/query-core').OmitKeyof<import('@tanstack/react-query').UseQueryOptions<InferData<TAuthClient["oauth2"]["publicClient"]>, BetterFetchError, InferData<TAuthClient["oauth2"]["publicClient"]>, readonly ["auth", "oauthProvider", "publicClient", string | null]>, "queryFn"> & {
|
|
15
|
+
queryFn?: import('@tanstack/query-core').QueryFunction<InferData<TAuthClient["oauth2"]["publicClient"]>, readonly ["auth", "oauthProvider", "publicClient", string | null], never> | undefined;
|
|
16
|
+
} & {
|
|
17
|
+
queryKey: readonly ["auth", "oauthProvider", "publicClient", string | null] & {
|
|
18
|
+
[dataTagSymbol]: InferData<TAuthClient["oauth2"]["publicClient"]>;
|
|
19
|
+
[dataTagErrorSymbol]: BetterFetchError;
|
|
20
|
+
};
|
|
21
|
+
}) & {
|
|
22
|
+
queryKey: DataTag<readonly ["auth", "oauthProvider", "publicClient", string | null], InferData<TAuthClient["oauth2"]["publicClient"]>, BetterFetchError>;
|
|
23
|
+
};
|
|
24
|
+
export declare const ensurePublicOAuthClient: <TAuthClient extends OAuthProviderAuthClient>(queryClient: QueryClient, authClient: TAuthClient, clientId: string, params?: PublicOAuthClientParams<TAuthClient>) => Promise<InferData<TAuthClient["oauth2"]["publicClient"]>>;
|
|
25
|
+
export declare const prefetchPublicOAuthClient: <TAuthClient extends OAuthProviderAuthClient>(queryClient: QueryClient, authClient: TAuthClient, clientId: string, params?: PublicOAuthClientParams<TAuthClient>) => Promise<void>;
|
|
26
|
+
export declare const fetchPublicOAuthClient: <TAuthClient extends OAuthProviderAuthClient>(queryClient: QueryClient, authClient: TAuthClient, clientId: string, params?: PublicOAuthClientParams<TAuthClient>) => Promise<InferData<TAuthClient["oauth2"]["publicClient"]>>;
|
|
27
|
+
export type UsePublicOAuthClientOptions<TAuthClient extends OAuthProviderAuthClient = OAuthProviderAuthClient> = PublicOAuthClientOptions<TAuthClient> & PublicOAuthClientParams<TAuthClient>;
|
|
28
|
+
/**
|
|
29
|
+
* Subscribe to an OAuth application's public metadata.
|
|
30
|
+
*
|
|
31
|
+
* The query is disabled until a client ID is available.
|
|
32
|
+
*/
|
|
33
|
+
export declare function usePublicOAuthClient<TAuthClient extends OAuthProviderAuthClient>(authClient: TAuthClient, clientId: string | undefined, options?: UsePublicOAuthClientOptions<TAuthClient>, queryClient?: QueryClient): import('@tanstack/react-query').UseQueryResult<NoInfer<InferData<TAuthClient["oauth2"]["publicClient"]>>, BetterFetchError>;
|
|
@@ -11,7 +11,7 @@ export declare function listOrganizationMembersOptions<TAuthClient extends Organ
|
|
|
11
11
|
sortDirection?: "asc" | "desc" | undefined;
|
|
12
12
|
filterField?: string | undefined;
|
|
13
13
|
filterValue?: string | number | boolean | string[] | number[] | undefined;
|
|
14
|
-
filterOperator?: "in" | "
|
|
14
|
+
filterOperator?: "in" | "contains" | "starts_with" | "ends_with" | "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "not_in" | undefined;
|
|
15
15
|
organizationId?: string | undefined;
|
|
16
16
|
organizationSlug?: string | undefined;
|
|
17
17
|
} | null]>, "queryFn"> & {
|
|
@@ -22,7 +22,7 @@ export declare function listOrganizationMembersOptions<TAuthClient extends Organ
|
|
|
22
22
|
sortDirection?: "asc" | "desc" | undefined;
|
|
23
23
|
filterField?: string | undefined;
|
|
24
24
|
filterValue?: string | number | boolean | string[] | number[] | undefined;
|
|
25
|
-
filterOperator?: "in" | "
|
|
25
|
+
filterOperator?: "in" | "contains" | "starts_with" | "ends_with" | "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "not_in" | undefined;
|
|
26
26
|
organizationId?: string | undefined;
|
|
27
27
|
organizationSlug?: string | undefined;
|
|
28
28
|
} | null], never> | undefined;
|
|
@@ -34,7 +34,7 @@ export declare function listOrganizationMembersOptions<TAuthClient extends Organ
|
|
|
34
34
|
sortDirection?: "asc" | "desc" | undefined;
|
|
35
35
|
filterField?: string | undefined;
|
|
36
36
|
filterValue?: string | number | boolean | string[] | number[] | undefined;
|
|
37
|
-
filterOperator?: "in" | "
|
|
37
|
+
filterOperator?: "in" | "contains" | "starts_with" | "ends_with" | "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "not_in" | undefined;
|
|
38
38
|
organizationId?: string | undefined;
|
|
39
39
|
organizationSlug?: string | undefined;
|
|
40
40
|
} | null] & {
|
|
@@ -49,7 +49,7 @@ export declare function listOrganizationMembersOptions<TAuthClient extends Organ
|
|
|
49
49
|
sortDirection?: "asc" | "desc" | undefined;
|
|
50
50
|
filterField?: string | undefined;
|
|
51
51
|
filterValue?: string | number | boolean | string[] | number[] | undefined;
|
|
52
|
-
filterOperator?: "in" | "
|
|
52
|
+
filterOperator?: "in" | "contains" | "starts_with" | "ends_with" | "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "not_in" | undefined;
|
|
53
53
|
organizationId?: string | undefined;
|
|
54
54
|
organizationSlug?: string | undefined;
|
|
55
55
|
} | null], InferData<TAuthClient["organization"]["listMembers"]>, BetterFetchError>;
|
|
@@ -18,7 +18,7 @@ export declare function listOrganizationMembersOptions<TAuth extends Organizatio
|
|
|
18
18
|
sortDirection?: "asc" | "desc" | undefined;
|
|
19
19
|
filterField?: string | undefined;
|
|
20
20
|
filterValue?: string | number | boolean | string[] | number[] | undefined;
|
|
21
|
-
filterOperator?: "in" | "
|
|
21
|
+
filterOperator?: "in" | "contains" | "starts_with" | "ends_with" | "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "not_in" | undefined;
|
|
22
22
|
organizationId?: string | undefined;
|
|
23
23
|
organizationSlug?: string | undefined;
|
|
24
24
|
} | null]>, "queryFn"> & {
|
|
@@ -29,7 +29,7 @@ export declare function listOrganizationMembersOptions<TAuth extends Organizatio
|
|
|
29
29
|
sortDirection?: "asc" | "desc" | undefined;
|
|
30
30
|
filterField?: string | undefined;
|
|
31
31
|
filterValue?: string | number | boolean | string[] | number[] | undefined;
|
|
32
|
-
filterOperator?: "in" | "
|
|
32
|
+
filterOperator?: "in" | "contains" | "starts_with" | "ends_with" | "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "not_in" | undefined;
|
|
33
33
|
organizationId?: string | undefined;
|
|
34
34
|
organizationSlug?: string | undefined;
|
|
35
35
|
} | null], never> | undefined;
|
|
@@ -41,7 +41,7 @@ export declare function listOrganizationMembersOptions<TAuth extends Organizatio
|
|
|
41
41
|
sortDirection?: "asc" | "desc" | undefined;
|
|
42
42
|
filterField?: string | undefined;
|
|
43
43
|
filterValue?: string | number | boolean | string[] | number[] | undefined;
|
|
44
|
-
filterOperator?: "in" | "
|
|
44
|
+
filterOperator?: "in" | "contains" | "starts_with" | "ends_with" | "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "not_in" | undefined;
|
|
45
45
|
organizationId?: string | undefined;
|
|
46
46
|
organizationSlug?: string | undefined;
|
|
47
47
|
} | null] & {
|
|
@@ -56,7 +56,7 @@ export declare function listOrganizationMembersOptions<TAuth extends Organizatio
|
|
|
56
56
|
sortDirection?: "asc" | "desc" | undefined;
|
|
57
57
|
filterField?: string | undefined;
|
|
58
58
|
filterValue?: string | number | boolean | string[] | number[] | undefined;
|
|
59
|
-
filterOperator?: "in" | "
|
|
59
|
+
filterOperator?: "in" | "contains" | "starts_with" | "ends_with" | "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "not_in" | undefined;
|
|
60
60
|
organizationId?: string | undefined;
|
|
61
61
|
organizationSlug?: string | undefined;
|
|
62
62
|
} | null], Awaited<ReturnType<TAuth["api"]["listMembers"]>>, APIError>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-auth-ui/react",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.32",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "vite build",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@better-auth/api-key": "^1.6.19",
|
|
40
|
+
"@better-auth/oauth-provider": "1.6.19",
|
|
40
41
|
"@better-auth/passkey": "^1.6.19",
|
|
41
42
|
"@react-email/ui": "6.6.8",
|
|
42
43
|
"@tanstack/query-core": "^5.100.14",
|
|
@@ -60,6 +61,7 @@
|
|
|
60
61
|
"peerDependencies": {
|
|
61
62
|
"@better-auth-ui/core": "*",
|
|
62
63
|
"@better-auth/api-key": ">=1.6.19",
|
|
64
|
+
"@better-auth/oauth-provider": ">=1.6.19",
|
|
63
65
|
"@better-auth/passkey": ">=1.6.19",
|
|
64
66
|
"@tanstack/query-core": ">=5.100.14",
|
|
65
67
|
"@tanstack/react-query": ">=5.100.14",
|