@adonis-agora/authkit-react 0.20.1 → 0.22.0
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/build/index.d.ts +86 -84
- package/build/index.js +41 -40
- package/build/src/authkit_provider.d.ts +2 -2
- package/build/src/client/client.d.ts +23 -5
- package/build/src/client/client.js +19 -1
- package/build/src/client/types.d.ts +86 -7
- package/build/src/components/authenticated.js +1 -1
- package/build/src/components/can_permission.js +1 -1
- package/build/src/components/interaction_form.d.ts +116 -116
- package/build/src/components/oauth_button.d.ts +115 -115
- package/build/src/components/sign_in_button.d.ts +118 -118
- package/build/src/components/sign_out_button.d.ts +118 -118
- package/build/src/passkey/json_registration.d.ts +8 -0
- package/build/src/passkey/json_registration.js +8 -0
- package/build/src/queries/account/index.d.ts +74 -1
- package/build/src/queries/account/index.js +99 -0
- package/build/src/queries/admin/index.d.ts +5 -5
- package/build/src/queries/keys.d.ts +49 -31
- package/build/src/queries/keys.js +18 -0
- package/package.json +13 -13
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useAuthkitClient } from '../../client/context.js';
|
|
2
|
+
import { registerPasskeyJson, } from '../../passkey/json_registration.js';
|
|
2
3
|
import { authkitKeys } from '../keys.js';
|
|
3
4
|
export function useMeQueryOptions() {
|
|
4
5
|
const client = useAuthkitClient();
|
|
@@ -162,3 +163,101 @@ export function useAccountOrgInvitationsQueryOptions() {
|
|
|
162
163
|
queryFn: () => client.account.orgs.invitations(),
|
|
163
164
|
};
|
|
164
165
|
}
|
|
166
|
+
export function useAccountCreateOrgMutationOptions() {
|
|
167
|
+
const client = useAuthkitClient();
|
|
168
|
+
return {
|
|
169
|
+
mutationKey: authkitKeys.account.mutations.orgCreate(),
|
|
170
|
+
mutationFn: (data) => client.account.orgs.create(data),
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
export function useAccountActivateOrgMutationOptions() {
|
|
174
|
+
const client = useAuthkitClient();
|
|
175
|
+
return {
|
|
176
|
+
mutationKey: authkitKeys.account.mutations.orgActivate(),
|
|
177
|
+
mutationFn: (orgId) => client.account.orgs.activate(orgId),
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
export function useAccountDeactivateOrgMutationOptions() {
|
|
181
|
+
const client = useAuthkitClient();
|
|
182
|
+
return {
|
|
183
|
+
mutationKey: authkitKeys.account.mutations.orgDeactivate(),
|
|
184
|
+
mutationFn: () => client.account.orgs.deactivate(),
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
export function useAccountLeaveOrgMutationOptions() {
|
|
188
|
+
const client = useAuthkitClient();
|
|
189
|
+
return {
|
|
190
|
+
mutationKey: authkitKeys.account.mutations.orgLeave(),
|
|
191
|
+
mutationFn: (orgId) => client.account.orgs.leave(orgId),
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
export function useAccountInviteOrgMemberMutationOptions() {
|
|
195
|
+
const client = useAuthkitClient();
|
|
196
|
+
return {
|
|
197
|
+
mutationKey: authkitKeys.account.mutations.orgInvite(),
|
|
198
|
+
mutationFn: (vars) => client.account.orgs.invite(vars.orgId, { email: vars.email, role: vars.role }),
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
export function useAccountRevokeOrgInvitationMutationOptions() {
|
|
202
|
+
const client = useAuthkitClient();
|
|
203
|
+
return {
|
|
204
|
+
mutationKey: authkitKeys.account.mutations.orgRevokeInvitation(),
|
|
205
|
+
mutationFn: (vars) => client.account.orgs.revokeInvitation(vars.orgId, vars.invitationId),
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
export function useAccountUpdateOrgMemberRoleMutationOptions() {
|
|
209
|
+
const client = useAuthkitClient();
|
|
210
|
+
return {
|
|
211
|
+
mutationKey: authkitKeys.account.mutations.orgUpdateMemberRole(),
|
|
212
|
+
mutationFn: (vars) => client.account.orgs.updateMemberRole(vars.orgId, vars.accountId, vars.role),
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
export function useAccountRemoveOrgMemberMutationOptions() {
|
|
216
|
+
const client = useAuthkitClient();
|
|
217
|
+
return {
|
|
218
|
+
mutationKey: authkitKeys.account.mutations.orgRemoveMember(),
|
|
219
|
+
mutationFn: (vars) => client.account.orgs.removeMember(vars.orgId, vars.accountId),
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
export function useAccountAcceptOrgInvitationMutationOptions() {
|
|
223
|
+
const client = useAuthkitClient();
|
|
224
|
+
return {
|
|
225
|
+
mutationKey: authkitKeys.account.mutations.orgAcceptInvitation(),
|
|
226
|
+
mutationFn: (token) => client.account.orgs.acceptInvitation(token),
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
export function useEnrollTotpMutationOptions() {
|
|
230
|
+
const client = useAuthkitClient();
|
|
231
|
+
return {
|
|
232
|
+
mutationKey: authkitKeys.account.mutations.mfaEnroll(),
|
|
233
|
+
mutationFn: () => client.account.mfa.enroll(),
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
export function useConfirmTotpMutationOptions() {
|
|
237
|
+
const client = useAuthkitClient();
|
|
238
|
+
return {
|
|
239
|
+
mutationKey: authkitKeys.account.mutations.mfaConfirm(),
|
|
240
|
+
mutationFn: (code) => client.account.mfa.confirm(code),
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
export function useDisableTotpMutationOptions() {
|
|
244
|
+
const client = useAuthkitClient();
|
|
245
|
+
return {
|
|
246
|
+
mutationKey: authkitKeys.account.mutations.mfaDisable(),
|
|
247
|
+
mutationFn: () => client.account.mfa.disable(),
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
export function useRegenerateRecoveryCodesMutationOptions() {
|
|
251
|
+
const client = useAuthkitClient();
|
|
252
|
+
return {
|
|
253
|
+
mutationKey: authkitKeys.account.mutations.mfaRecoveryCodes(),
|
|
254
|
+
mutationFn: () => client.account.mfa.regenerateRecoveryCodes(),
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
export function useRegisterPasskeyMutationOptions(deps = {}) {
|
|
258
|
+
const client = useAuthkitClient();
|
|
259
|
+
return {
|
|
260
|
+
mutationKey: authkitKeys.account.mutations.passkeyRegister(),
|
|
261
|
+
mutationFn: () => registerPasskeyJson(client, deps),
|
|
262
|
+
};
|
|
263
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AdminClient, AdminClientListResult, AdminOrgDetail, AdminOrgEntry, AdminOrgInvitation, AdminOrgListResult, AdminOverview, AdminUser, AdminUserListResult, AuditListParams, AuditListResult, CreateClientInput, CreateOrgInput, CreateRoleInput, CreateUserInput,
|
|
1
|
+
import type { AdminClient, AdminClientListResult, AdminOrgDetail, AdminOrgEntry, AdminOrgInvitation, AdminOrgListResult, AdminOverview, AdminUser, AdminUserListResult, AuditListParams, AuditListResult, CreateClientInput, CreatedClientResult, CreateOrgInput, CreateRoleInput, CreateUserInput, ImpersonationPanel, KeysRotateInput, KeysRotateResult, KeysStatus, RegenerateSecretResult, RevokeSessionsResult, RoleCatalogEntry, RoleListResult, SettingEntry, SettingListResult, UpdateClientInput, UpdateOrgInput, UpdateRoleInput, UpdateUserInput, UserSessionsResult } from '../../client/types.js';
|
|
2
2
|
export declare function useOverviewQueryOptions(): {
|
|
3
3
|
queryKey: readonly ["authkit", "admin", "overview"];
|
|
4
4
|
queryFn: () => Promise<AdminOverview>;
|
|
@@ -6,12 +6,12 @@ export declare function useOverviewQueryOptions(): {
|
|
|
6
6
|
export declare function useUsersQueryOptions(params?: {
|
|
7
7
|
search?: string;
|
|
8
8
|
page?: number;
|
|
9
|
-
|
|
9
|
+
size?: number;
|
|
10
10
|
}): {
|
|
11
11
|
queryKey: readonly ["authkit", "admin", "users", {
|
|
12
12
|
search?: string;
|
|
13
13
|
page?: number;
|
|
14
|
-
|
|
14
|
+
size?: number;
|
|
15
15
|
}];
|
|
16
16
|
queryFn: () => Promise<AdminUserListResult>;
|
|
17
17
|
};
|
|
@@ -187,13 +187,13 @@ export declare function useAuditQueryOptions(params?: AuditListParams): {
|
|
|
187
187
|
queryKey: readonly ["authkit", "admin", "audit", {
|
|
188
188
|
type?: string;
|
|
189
189
|
page?: number;
|
|
190
|
-
|
|
190
|
+
size?: number;
|
|
191
191
|
subject?: string;
|
|
192
192
|
}];
|
|
193
193
|
queryFn: () => Promise<AuditListResult>;
|
|
194
194
|
};
|
|
195
195
|
export declare function useSettingsQueryOptions(orgId?: string | null): {
|
|
196
|
-
queryKey: readonly ["authkit", "admin", "settings"
|
|
196
|
+
queryKey: readonly ["authkit", "admin", "settings"] | readonly ["authkit", "admin", "settings", string];
|
|
197
197
|
queryFn: () => Promise<SettingListResult>;
|
|
198
198
|
};
|
|
199
199
|
export declare function useSetSettingMutationOptions(orgId?: string | null): {
|
|
@@ -1,51 +1,69 @@
|
|
|
1
1
|
export declare const authkitKeys: {
|
|
2
2
|
readonly admin: {
|
|
3
|
-
readonly all: readonly [
|
|
4
|
-
readonly overview: () => readonly [
|
|
3
|
+
readonly all: readonly ['authkit', 'admin'];
|
|
4
|
+
readonly overview: () => readonly ['authkit', 'admin', 'overview'];
|
|
5
5
|
readonly users: (params?: {
|
|
6
6
|
search?: string;
|
|
7
7
|
page?: number;
|
|
8
|
-
|
|
9
|
-
}) => readonly [
|
|
8
|
+
size?: number;
|
|
9
|
+
}) => readonly ['authkit', 'admin', 'users', {
|
|
10
10
|
search?: string;
|
|
11
11
|
page?: number;
|
|
12
|
-
|
|
12
|
+
size?: number;
|
|
13
13
|
}];
|
|
14
|
-
readonly user: (id: string) => readonly [
|
|
15
|
-
readonly userSessions: (id: string) => readonly [
|
|
16
|
-
readonly sessions: (accountId?: string) => readonly [
|
|
17
|
-
readonly clients: () => readonly [
|
|
18
|
-
readonly client: (id: string) => readonly [
|
|
19
|
-
readonly roles: () => readonly [
|
|
20
|
-
readonly orgs: () => readonly [
|
|
21
|
-
readonly org: (id: string) => readonly [
|
|
14
|
+
readonly user: (id: string) => readonly ['authkit', 'admin', 'users', string];
|
|
15
|
+
readonly userSessions: (id: string) => readonly ['authkit', 'admin', 'users', string, 'sessions'];
|
|
16
|
+
readonly sessions: (accountId?: string) => readonly ['authkit', 'admin', 'sessions', string | null];
|
|
17
|
+
readonly clients: () => readonly ['authkit', 'admin', 'clients'];
|
|
18
|
+
readonly client: (id: string) => readonly ['authkit', 'admin', 'clients', string];
|
|
19
|
+
readonly roles: () => readonly ['authkit', 'admin', 'roles'];
|
|
20
|
+
readonly orgs: () => readonly ['authkit', 'admin', 'orgs'];
|
|
21
|
+
readonly org: (id: string) => readonly ['authkit', 'admin', 'orgs', string];
|
|
22
22
|
readonly audit: (params?: {
|
|
23
23
|
type?: string;
|
|
24
24
|
page?: number;
|
|
25
|
-
|
|
25
|
+
size?: number;
|
|
26
26
|
subject?: string;
|
|
27
|
-
}) => readonly [
|
|
27
|
+
}) => readonly ['authkit', 'admin', 'audit', {
|
|
28
28
|
type?: string;
|
|
29
29
|
page?: number;
|
|
30
|
-
|
|
30
|
+
size?: number;
|
|
31
31
|
subject?: string;
|
|
32
32
|
}];
|
|
33
|
-
readonly settings: (orgId?: string | null) => readonly ["authkit", "admin", "settings"
|
|
34
|
-
readonly impersonation: (userId: string) => readonly [
|
|
35
|
-
readonly keys: () => readonly [
|
|
33
|
+
readonly settings: (orgId?: string | null) => readonly ["authkit", "admin", "settings"] | readonly ["authkit", "admin", "settings", string];
|
|
34
|
+
readonly impersonation: (userId: string) => readonly ['authkit', 'admin', 'impersonation', string];
|
|
35
|
+
readonly keys: () => readonly ['authkit', 'admin', 'keys'];
|
|
36
36
|
};
|
|
37
37
|
readonly account: {
|
|
38
|
-
readonly all: readonly [
|
|
39
|
-
readonly me: () => readonly [
|
|
40
|
-
readonly security: () => readonly [
|
|
41
|
-
readonly sessions: () => readonly [
|
|
42
|
-
readonly apps: () => readonly [
|
|
43
|
-
readonly mfa: () => readonly [
|
|
44
|
-
readonly passkeys: () => readonly [
|
|
45
|
-
readonly tokens: () => readonly [
|
|
46
|
-
readonly orgs: () => readonly [
|
|
47
|
-
readonly org: (id: string) => readonly [
|
|
48
|
-
readonly orgInvitations: () => readonly [
|
|
49
|
-
readonly loginMethods: () => readonly [
|
|
38
|
+
readonly all: readonly ['authkit', 'account'];
|
|
39
|
+
readonly me: () => readonly ['authkit', 'account', 'me'];
|
|
40
|
+
readonly security: () => readonly ['authkit', 'account', 'security'];
|
|
41
|
+
readonly sessions: () => readonly ['authkit', 'account', 'sessions'];
|
|
42
|
+
readonly apps: () => readonly ['authkit', 'account', 'apps'];
|
|
43
|
+
readonly mfa: () => readonly ['authkit', 'account', 'mfa'];
|
|
44
|
+
readonly passkeys: () => readonly ['authkit', 'account', 'passkeys'];
|
|
45
|
+
readonly tokens: () => readonly ['authkit', 'account', 'tokens'];
|
|
46
|
+
readonly orgs: () => readonly ['authkit', 'account', 'orgs'];
|
|
47
|
+
readonly org: (id: string) => readonly ['authkit', 'account', 'orgs', string];
|
|
48
|
+
readonly orgInvitations: () => readonly ['authkit', 'account', 'orgs', 'invitations'];
|
|
49
|
+
readonly loginMethods: () => readonly ['authkit', 'account', 'login-methods'];
|
|
50
|
+
readonly mutations: {
|
|
51
|
+
readonly orgs: () => readonly ['authkit', 'account', 'orgs', 'mutation'];
|
|
52
|
+
readonly orgCreate: () => readonly ['authkit', 'account', 'orgs', 'mutation', 'create'];
|
|
53
|
+
readonly orgActivate: () => readonly ['authkit', 'account', 'orgs', 'mutation', 'activate'];
|
|
54
|
+
readonly orgDeactivate: () => readonly ['authkit', 'account', 'orgs', 'mutation', 'deactivate'];
|
|
55
|
+
readonly orgLeave: () => readonly ['authkit', 'account', 'orgs', 'mutation', 'leave'];
|
|
56
|
+
readonly orgInvite: () => readonly ['authkit', 'account', 'orgs', 'mutation', 'invite'];
|
|
57
|
+
readonly orgRevokeInvitation: () => readonly ['authkit', 'account', 'orgs', 'mutation', 'revoke-invitation'];
|
|
58
|
+
readonly orgAcceptInvitation: () => readonly ['authkit', 'account', 'orgs', 'mutation', 'accept-invitation'];
|
|
59
|
+
readonly orgUpdateMemberRole: () => readonly ['authkit', 'account', 'orgs', 'mutation', 'update-member-role'];
|
|
60
|
+
readonly orgRemoveMember: () => readonly ['authkit', 'account', 'orgs', 'mutation', 'remove-member'];
|
|
61
|
+
readonly mfa: () => readonly ['authkit', 'account', 'mfa', 'mutation'];
|
|
62
|
+
readonly mfaEnroll: () => readonly ['authkit', 'account', 'mfa', 'mutation', 'totp-enroll'];
|
|
63
|
+
readonly mfaConfirm: () => readonly ['authkit', 'account', 'mfa', 'mutation', 'totp-confirm'];
|
|
64
|
+
readonly mfaDisable: () => readonly ['authkit', 'account', 'mfa', 'mutation', 'totp-disable'];
|
|
65
|
+
readonly mfaRecoveryCodes: () => readonly ['authkit', 'account', 'mfa', 'mutation', 'recovery-codes'];
|
|
66
|
+
readonly passkeyRegister: () => readonly ['authkit', 'account', 'mfa', 'mutation', 'passkey-register'];
|
|
67
|
+
};
|
|
50
68
|
};
|
|
51
69
|
};
|
|
@@ -31,5 +31,23 @@ export const authkitKeys = {
|
|
|
31
31
|
org: (id) => ['authkit', 'account', 'orgs', id],
|
|
32
32
|
orgInvitations: () => ['authkit', 'account', 'orgs', 'invitations'],
|
|
33
33
|
loginMethods: () => ['authkit', 'account', 'login-methods'],
|
|
34
|
+
mutations: {
|
|
35
|
+
orgs: () => ['authkit', 'account', 'orgs', 'mutation'],
|
|
36
|
+
orgCreate: () => ['authkit', 'account', 'orgs', 'mutation', 'create'],
|
|
37
|
+
orgActivate: () => ['authkit', 'account', 'orgs', 'mutation', 'activate'],
|
|
38
|
+
orgDeactivate: () => ['authkit', 'account', 'orgs', 'mutation', 'deactivate'],
|
|
39
|
+
orgLeave: () => ['authkit', 'account', 'orgs', 'mutation', 'leave'],
|
|
40
|
+
orgInvite: () => ['authkit', 'account', 'orgs', 'mutation', 'invite'],
|
|
41
|
+
orgRevokeInvitation: () => ['authkit', 'account', 'orgs', 'mutation', 'revoke-invitation'],
|
|
42
|
+
orgAcceptInvitation: () => ['authkit', 'account', 'orgs', 'mutation', 'accept-invitation'],
|
|
43
|
+
orgUpdateMemberRole: () => ['authkit', 'account', 'orgs', 'mutation', 'update-member-role'],
|
|
44
|
+
orgRemoveMember: () => ['authkit', 'account', 'orgs', 'mutation', 'remove-member'],
|
|
45
|
+
mfa: () => ['authkit', 'account', 'mfa', 'mutation'],
|
|
46
|
+
mfaEnroll: () => ['authkit', 'account', 'mfa', 'mutation', 'totp-enroll'],
|
|
47
|
+
mfaConfirm: () => ['authkit', 'account', 'mfa', 'mutation', 'totp-confirm'],
|
|
48
|
+
mfaDisable: () => ['authkit', 'account', 'mfa', 'mutation', 'totp-disable'],
|
|
49
|
+
mfaRecoveryCodes: () => ['authkit', 'account', 'mfa', 'mutation', 'recovery-codes'],
|
|
50
|
+
passkeyRegister: () => ['authkit', 'account', 'mfa', 'mutation', 'passkey-register'],
|
|
51
|
+
},
|
|
34
52
|
},
|
|
35
53
|
};
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adonis-agora/authkit-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"description": "Frontend ergonomics over AuthKit for AdonisJS + Inertia + React apps: a typed useAuth() hook, role-gating hooks and gating components.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "dudousxd",
|
|
7
|
-
"homepage": "https://github.com/DavideCarvalho/adonis-agora-authkit/tree/main/packages/authkit-react#readme",
|
|
8
7
|
"repository": {
|
|
9
8
|
"type": "git",
|
|
10
9
|
"url": "https://github.com/DavideCarvalho/adonis-agora-authkit.git",
|
|
11
10
|
"directory": "packages/authkit-react"
|
|
12
11
|
},
|
|
12
|
+
"homepage": "https://davidecarvalho.github.io/agora/docs/authkit",
|
|
13
13
|
"bugs": {
|
|
14
14
|
"url": "https://github.com/DavideCarvalho/adonis-agora-authkit/issues"
|
|
15
15
|
},
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
"./styles.css": "./styles.css"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@inertiajs/react": "
|
|
44
|
-
"@simplewebauthn/browser": "
|
|
45
|
-
"@tanstack/react-query": "
|
|
46
|
-
"react": "
|
|
47
|
-
"react-dom": "
|
|
43
|
+
"@inertiajs/react": "3.7.1",
|
|
44
|
+
"@simplewebauthn/browser": "14.0.0",
|
|
45
|
+
"@tanstack/react-query": "5.102.8",
|
|
46
|
+
"react": "19.3.0",
|
|
47
|
+
"react-dom": "19.3.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependenciesMeta": {
|
|
50
50
|
"@simplewebauthn/browser": {
|
|
@@ -56,18 +56,18 @@
|
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@adonisjs/tsconfig": "2.0.0",
|
|
59
|
-
"@inertiajs/react": "3.
|
|
59
|
+
"@inertiajs/react": "3.7.1",
|
|
60
60
|
"@japa/assert": "4.2.0",
|
|
61
61
|
"@japa/runner": "5.3.0",
|
|
62
62
|
"@poppinss/ts-exec": "1.4.4",
|
|
63
|
-
"@tanstack/intent": "
|
|
64
|
-
"@tanstack/react-query": "5.
|
|
65
|
-
"@types/node": "
|
|
63
|
+
"@tanstack/intent": "0.4.0",
|
|
64
|
+
"@tanstack/react-query": "5.102.8",
|
|
65
|
+
"@types/node": "26.5.1",
|
|
66
66
|
"@types/react": "19.2.18",
|
|
67
|
-
"@types/react-dom": "19.2.
|
|
67
|
+
"@types/react-dom": "19.2.7",
|
|
68
68
|
"react": "19.2.8",
|
|
69
69
|
"react-dom": "19.2.8",
|
|
70
|
-
"typescript": "
|
|
70
|
+
"typescript": "7.0.2"
|
|
71
71
|
},
|
|
72
72
|
"scripts": {
|
|
73
73
|
"build": "tsc",
|