@workos-inc/widgets 1.8.2 → 1.9.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/CHANGELOG.md +5 -0
- package/dist/cjs/api/api-provider.cjs.map +1 -1
- package/dist/cjs/api/api-provider.d.cts +1 -1
- package/dist/cjs/api/endpoint.cjs +702 -623
- package/dist/cjs/api/endpoint.cjs.map +1 -1
- package/dist/cjs/api/endpoint.d.cts +810 -729
- package/dist/cjs/directory-sync.client.cjs +143 -0
- package/dist/cjs/directory-sync.client.cjs.map +1 -0
- package/dist/cjs/directory-sync.client.d.cts +26 -0
- package/dist/cjs/experimental/api/fetch.cjs +309 -252
- package/dist/cjs/experimental/api/fetch.cjs.map +1 -1
- package/dist/cjs/experimental/api/fetch.d.cts +809 -731
- package/dist/cjs/experimental/api/react-query.cjs +695 -613
- package/dist/cjs/experimental/api/react-query.cjs.map +1 -1
- package/dist/cjs/experimental/api/react-query.d.cts +1355 -1250
- package/dist/cjs/experimental/api/swr.cjs +660 -583
- package/dist/cjs/experimental/api/swr.cjs.map +1 -1
- package/dist/cjs/experimental/api/swr.d.cts +1307 -1212
- package/dist/cjs/index.cjs +5 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +2 -0
- package/dist/cjs/lib/api-keys/api-keys-context.cjs +1 -1
- package/dist/cjs/lib/api-keys/api-keys-context.cjs.map +1 -1
- package/dist/cjs/lib/api-keys/api-keys-table.cjs +7 -5
- package/dist/cjs/lib/api-keys/api-keys-table.cjs.map +1 -1
- package/dist/cjs/lib/directory-sync.cjs +288 -0
- package/dist/cjs/lib/directory-sync.cjs.map +1 -0
- package/dist/cjs/lib/directory-sync.d.cts +72 -0
- package/dist/cjs/lib/identity-providers.cjs +57 -1
- package/dist/cjs/lib/identity-providers.cjs.map +1 -1
- package/dist/cjs/lib/identity-providers.d.cts +5 -3
- package/dist/cjs/lib/pipes.cjs +9 -9
- package/dist/cjs/lib/pipes.cjs.map +1 -1
- package/dist/cjs/lib/reset-mfa-dialog.cjs +2 -1
- package/dist/cjs/lib/reset-mfa-dialog.cjs.map +1 -1
- package/dist/cjs/lib/use-permissions.cjs.map +1 -1
- package/dist/cjs/lib/use-permissions.d.cts +1 -1
- package/dist/cjs/lib/users-management-context.cjs +1 -1
- package/dist/cjs/lib/users-management-context.cjs.map +1 -1
- package/dist/cjs/lib/users-management.cjs +3 -3
- package/dist/cjs/lib/users-management.cjs.map +1 -1
- package/dist/cjs/lib/utils.cjs +9 -0
- package/dist/cjs/lib/utils.cjs.map +1 -1
- package/dist/cjs/lib/utils.d.cts +16 -2
- package/dist/esm/api/api-provider.d.ts +1 -1
- package/dist/esm/api/api-provider.js.map +1 -1
- package/dist/esm/api/endpoint.d.ts +810 -729
- package/dist/esm/api/endpoint.js +691 -618
- package/dist/esm/api/endpoint.js.map +1 -1
- package/dist/esm/directory-sync.client.d.ts +26 -0
- package/dist/esm/directory-sync.client.js +121 -0
- package/dist/esm/directory-sync.client.js.map +1 -0
- package/dist/esm/experimental/api/fetch.d.ts +809 -731
- package/dist/esm/experimental/api/fetch.js +300 -247
- package/dist/esm/experimental/api/fetch.js.map +1 -1
- package/dist/esm/experimental/api/react-query.d.ts +1355 -1250
- package/dist/esm/experimental/api/react-query.js +683 -608
- package/dist/esm/experimental/api/react-query.js.map +1 -1
- package/dist/esm/experimental/api/swr.d.ts +1307 -1212
- package/dist/esm/experimental/api/swr.js +649 -578
- package/dist/esm/experimental/api/swr.js.map +1 -1
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +6 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/api-keys/api-keys-context.js +1 -1
- package/dist/esm/lib/api-keys/api-keys-context.js.map +1 -1
- package/dist/esm/lib/api-keys/api-keys-table.js +7 -5
- package/dist/esm/lib/api-keys/api-keys-table.js.map +1 -1
- package/dist/esm/lib/directory-sync.d.ts +72 -0
- package/dist/esm/lib/directory-sync.js +259 -0
- package/dist/esm/lib/directory-sync.js.map +1 -0
- package/dist/esm/lib/identity-providers.d.ts +5 -3
- package/dist/esm/lib/identity-providers.js +55 -1
- package/dist/esm/lib/identity-providers.js.map +1 -1
- package/dist/esm/lib/pipes.js +9 -10
- package/dist/esm/lib/pipes.js.map +1 -1
- package/dist/esm/lib/reset-mfa-dialog.js +2 -1
- package/dist/esm/lib/reset-mfa-dialog.js.map +1 -1
- package/dist/esm/lib/use-permissions.d.ts +1 -1
- package/dist/esm/lib/use-permissions.js.map +1 -1
- package/dist/esm/lib/users-management-context.js +1 -1
- package/dist/esm/lib/users-management-context.js.map +1 -1
- package/dist/esm/lib/users-management.js +5 -4
- package/dist/esm/lib/users-management.js.map +1 -1
- package/dist/esm/lib/utils.d.ts +16 -2
- package/dist/esm/lib/utils.js +8 -0
- package/dist/esm/lib/utils.js.map +1 -1
- package/package.json +3 -3
|
@@ -18,18 +18,20 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var react_query_exports = {};
|
|
20
20
|
__export(react_query_exports, {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
AuthenticationInformationResponseDataVerificationMethodsMfaOneOfProvider: () => AuthenticationInformationResponseDataVerificationMethodsMfaOneOfProvider,
|
|
22
|
+
AuthenticationInformationResponseDataVerificationMethodsPasskeyOneOfProvider: () => AuthenticationInformationResponseDataVerificationMethodsPasskeyOneOfProvider,
|
|
23
|
+
AuthenticationInformationResponseDataVerificationMethodsPasswordOneOfProvider: () => AuthenticationInformationResponseDataVerificationMethodsPasswordOneOfProvider,
|
|
24
24
|
CreateTotpFactorResponseAuthenticationChallengeAllOfObject: () => CreateTotpFactorResponseAuthenticationChallengeAllOfObject,
|
|
25
25
|
CreateTotpFactorResponseAuthenticationFactorAllOfObject: () => CreateTotpFactorResponseAuthenticationFactorAllOfObject,
|
|
26
26
|
CreateTotpFactorResponseAuthenticationFactorAllOfType: () => CreateTotpFactorResponseAuthenticationFactorAllOfType,
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
DataInstallationAllOfObject: () => DataInstallationAllOfObject,
|
|
28
|
+
DataInstallationAllOfState: () => DataInstallationAllOfState,
|
|
29
29
|
DataIntegrationCredentialsType: () => DataIntegrationCredentialsType,
|
|
30
30
|
DataIntegrationIntegrationType: () => DataIntegrationIntegrationType,
|
|
31
31
|
DataIntegrationObject: () => DataIntegrationObject,
|
|
32
32
|
DataIntegrationOwnership: () => DataIntegrationOwnership,
|
|
33
|
+
DirectoryState: () => DirectoryState,
|
|
34
|
+
DirectoryType: () => DirectoryType,
|
|
33
35
|
DomainVerificationNameServer: () => DomainVerificationNameServer,
|
|
34
36
|
GenerateAdminPortalLinkIntent: () => GenerateAdminPortalLinkIntent,
|
|
35
37
|
MemberActionsItem: () => MemberActionsItem,
|
|
@@ -87,6 +89,9 @@ __export(react_query_exports, {
|
|
|
87
89
|
getGetDataIntegrationAuthorizeUrlUrl: () => getGetDataIntegrationAuthorizeUrlUrl,
|
|
88
90
|
getInviteMemberMutationOptions: () => getInviteMemberMutationOptions,
|
|
89
91
|
getInviteMemberUrl: () => getInviteMemberUrl,
|
|
92
|
+
getListDirectoriesQueryKey: () => getListDirectoriesQueryKey,
|
|
93
|
+
getListDirectoriesQueryOptions: () => getListDirectoriesQueryOptions,
|
|
94
|
+
getListDirectoriesUrl: () => getListDirectoriesUrl,
|
|
90
95
|
getListOrganizationApiKeyPermissionsQueryKey: () => getListOrganizationApiKeyPermissionsQueryKey,
|
|
91
96
|
getListOrganizationApiKeyPermissionsQueryOptions: () => getListOrganizationApiKeyPermissionsQueryOptions,
|
|
92
97
|
getListOrganizationApiKeyPermissionsUrl: () => getListOrganizationApiKeyPermissionsUrl,
|
|
@@ -152,6 +157,7 @@ __export(react_query_exports, {
|
|
|
152
157
|
getVerifyTotpFactorUrl: () => getVerifyTotpFactorUrl,
|
|
153
158
|
getVerifyUrl: () => getVerifyUrl,
|
|
154
159
|
inviteMember: () => inviteMember,
|
|
160
|
+
listDirectories: () => listDirectories,
|
|
155
161
|
listOrganizationApiKeyPermissions: () => listOrganizationApiKeyPermissions,
|
|
156
162
|
listOrganizationApiKeys: () => listOrganizationApiKeys,
|
|
157
163
|
listOrganizationDomains: () => listOrganizationDomains,
|
|
@@ -188,6 +194,7 @@ __export(react_query_exports, {
|
|
|
188
194
|
useGetDataInstallationAuthorizationStatus: () => useGetDataInstallationAuthorizationStatus,
|
|
189
195
|
useGetDataIntegrationAuthorizeUrl: () => useGetDataIntegrationAuthorizeUrl,
|
|
190
196
|
useInviteMember: () => useInviteMember,
|
|
197
|
+
useListDirectories: () => useListDirectories,
|
|
191
198
|
useListOrganizationApiKeyPermissions: () => useListOrganizationApiKeyPermissions,
|
|
192
199
|
useListOrganizationApiKeys: () => useListOrganizationApiKeys,
|
|
193
200
|
useListOrganizationDomains: () => useListOrganizationDomains,
|
|
@@ -245,13 +252,13 @@ const CreateTotpFactorResponseAuthenticationFactorAllOfType = {
|
|
|
245
252
|
const CreateTotpFactorResponseAuthenticationChallengeAllOfObject = {
|
|
246
253
|
authentication_challenge: "authentication_challenge"
|
|
247
254
|
};
|
|
248
|
-
const
|
|
255
|
+
const AuthenticationInformationResponseDataVerificationMethodsMfaOneOfProvider = {
|
|
249
256
|
MFA: "MFA"
|
|
250
257
|
};
|
|
251
|
-
const
|
|
258
|
+
const AuthenticationInformationResponseDataVerificationMethodsPasswordOneOfProvider = {
|
|
252
259
|
Password: "Password"
|
|
253
260
|
};
|
|
254
|
-
const
|
|
261
|
+
const AuthenticationInformationResponseDataVerificationMethodsPasskeyOneOfProvider = {
|
|
255
262
|
Passkey: "Passkey"
|
|
256
263
|
};
|
|
257
264
|
const SendVerificationResponseType = {
|
|
@@ -349,11 +356,11 @@ const SsoConnectionAnyOfEightAllOfType = {
|
|
|
349
356
|
const SsoConnectionAnyOfEightAllOfProviderTag = {
|
|
350
357
|
OpenIdConnect: "OpenIdConnect"
|
|
351
358
|
};
|
|
352
|
-
const
|
|
359
|
+
const DataInstallationAllOfObject = {
|
|
353
360
|
data_installation: "data_installation",
|
|
354
361
|
connected_account: "connected_account"
|
|
355
362
|
};
|
|
356
|
-
const
|
|
363
|
+
const DataInstallationAllOfState = {
|
|
357
364
|
connected: "connected",
|
|
358
365
|
needs_reauthorization: "needs_reauthorization"
|
|
359
366
|
};
|
|
@@ -407,11 +414,75 @@ const DataIntegrationCredentialsType = {
|
|
|
407
414
|
shared: "shared",
|
|
408
415
|
custom: "custom"
|
|
409
416
|
};
|
|
417
|
+
const DirectoryType = {
|
|
418
|
+
azure_scim_v20: "azure scim v2.0",
|
|
419
|
+
bamboohr: "bamboohr",
|
|
420
|
+
breathe_hr: "breathe hr",
|
|
421
|
+
cezanne_hr: "cezanne hr",
|
|
422
|
+
cyberark_scim_v20: "cyberark scim v2.0",
|
|
423
|
+
fourth_hr: "fourth hr",
|
|
424
|
+
generic_scim_v20: "generic scim v2.0",
|
|
425
|
+
gsuite_directory: "gsuite directory",
|
|
426
|
+
gusto: "gusto",
|
|
427
|
+
hibob: "hibob",
|
|
428
|
+
jump_cloud_scim_v20: "jump cloud scim v2.0",
|
|
429
|
+
okta_scim_v20: "okta scim v2.0",
|
|
430
|
+
onelogin_scim_v20: "onelogin scim v2.0",
|
|
431
|
+
people_hr: "people hr",
|
|
432
|
+
personio: "personio",
|
|
433
|
+
pingfederate_scim_v20: "pingfederate scim v2.0",
|
|
434
|
+
rippling: "rippling",
|
|
435
|
+
rippling_scim_v20: "rippling scim v2.0",
|
|
436
|
+
s3: "s3",
|
|
437
|
+
sailpoint_scim_v20: "sailpoint scim v2.0",
|
|
438
|
+
sftp: "sftp",
|
|
439
|
+
sftp_workday: "sftp workday",
|
|
440
|
+
workday: "workday"
|
|
441
|
+
};
|
|
442
|
+
const DirectoryState = {
|
|
443
|
+
requires_type: "requires_type",
|
|
444
|
+
linked: "linked",
|
|
445
|
+
validating: "validating",
|
|
446
|
+
invalid_credentials: "invalid_credentials",
|
|
447
|
+
unlinked: "unlinked",
|
|
448
|
+
deleting: "deleting"
|
|
449
|
+
};
|
|
410
450
|
const GenerateAdminPortalLinkIntent = {
|
|
411
451
|
domain_verification: "domain_verification",
|
|
412
452
|
sso: "sso"
|
|
413
453
|
};
|
|
414
|
-
const
|
|
454
|
+
const getCreateOrganizationApiKeyUrl = () => {
|
|
455
|
+
return `https://api.workos.com/_widgets/ApiKeys/organization-api-keys`;
|
|
456
|
+
};
|
|
457
|
+
const createOrganizationApiKey = async (createOrganizationApiKeyRequest, options) => {
|
|
458
|
+
const res = await fetch(getCreateOrganizationApiKeyUrl(), {
|
|
459
|
+
...options,
|
|
460
|
+
method: "POST",
|
|
461
|
+
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
462
|
+
body: JSON.stringify(createOrganizationApiKeyRequest)
|
|
463
|
+
});
|
|
464
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
465
|
+
const data = body ? JSON.parse(body) : {};
|
|
466
|
+
return {
|
|
467
|
+
data,
|
|
468
|
+
status: res.status,
|
|
469
|
+
headers: res.headers
|
|
470
|
+
};
|
|
471
|
+
};
|
|
472
|
+
const getCreateOrganizationApiKeyMutationOptions = (options) => {
|
|
473
|
+
const mutationKey = ["createOrganizationApiKey"];
|
|
474
|
+
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
475
|
+
const mutationFn = (props) => {
|
|
476
|
+
const { data } = props ?? {};
|
|
477
|
+
return createOrganizationApiKey(data, fetchOptions);
|
|
478
|
+
};
|
|
479
|
+
return { mutationFn, ...mutationOptions };
|
|
480
|
+
};
|
|
481
|
+
const useCreateOrganizationApiKey = (options, queryClient) => {
|
|
482
|
+
const mutationOptions = getCreateOrganizationApiKeyMutationOptions(options);
|
|
483
|
+
return (0, import_react_query.useMutation)(mutationOptions, queryClient);
|
|
484
|
+
};
|
|
485
|
+
const getListOrganizationApiKeysUrl = (params) => {
|
|
415
486
|
const normalizedParams = new URLSearchParams();
|
|
416
487
|
Object.entries(params || {}).forEach(([key, value]) => {
|
|
417
488
|
if (value !== void 0) {
|
|
@@ -419,71 +490,51 @@ const getMembersUrl = (params) => {
|
|
|
419
490
|
}
|
|
420
491
|
});
|
|
421
492
|
const stringifiedParams = normalizedParams.toString();
|
|
422
|
-
return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/
|
|
493
|
+
return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/ApiKeys/organization-api-keys?${stringifiedParams}` : `https://api.workos.com/_widgets/ApiKeys/organization-api-keys`;
|
|
423
494
|
};
|
|
424
|
-
const
|
|
425
|
-
const res = await fetch(
|
|
495
|
+
const listOrganizationApiKeys = async (params, options) => {
|
|
496
|
+
const res = await fetch(getListOrganizationApiKeysUrl(params), {
|
|
426
497
|
...options,
|
|
427
498
|
method: "GET"
|
|
428
499
|
});
|
|
429
500
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
430
501
|
const data = body ? JSON.parse(body) : {};
|
|
431
|
-
return {
|
|
502
|
+
return {
|
|
503
|
+
data,
|
|
504
|
+
status: res.status,
|
|
505
|
+
headers: res.headers
|
|
506
|
+
};
|
|
432
507
|
};
|
|
433
|
-
const
|
|
508
|
+
const getListOrganizationApiKeysQueryKey = (params) => {
|
|
434
509
|
return [
|
|
435
|
-
`https://api.workos.com/_widgets/
|
|
510
|
+
`https://api.workos.com/_widgets/ApiKeys/organization-api-keys`,
|
|
436
511
|
...params ? [params] : []
|
|
437
512
|
];
|
|
438
513
|
};
|
|
439
|
-
const
|
|
514
|
+
const getListOrganizationApiKeysQueryOptions = (params, options) => {
|
|
440
515
|
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
441
|
-
const queryKey = queryOptions?.queryKey ??
|
|
442
|
-
const queryFn = ({
|
|
443
|
-
signal
|
|
444
|
-
}) => members(params, { signal, ...fetchOptions });
|
|
516
|
+
const queryKey = queryOptions?.queryKey ?? getListOrganizationApiKeysQueryKey(params);
|
|
517
|
+
const queryFn = ({ signal }) => listOrganizationApiKeys(params, { signal, ...fetchOptions });
|
|
445
518
|
return { queryKey, queryFn, ...queryOptions };
|
|
446
519
|
};
|
|
447
|
-
function
|
|
448
|
-
const queryOptions =
|
|
520
|
+
function useListOrganizationApiKeys(params, options, queryClient) {
|
|
521
|
+
const queryOptions = getListOrganizationApiKeysQueryOptions(params, options);
|
|
449
522
|
const query = (0, import_react_query.useQuery)(queryOptions, queryClient);
|
|
450
523
|
query.queryKey = queryOptions.queryKey;
|
|
451
524
|
return query;
|
|
452
525
|
}
|
|
453
|
-
const
|
|
454
|
-
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
method: "GET"
|
|
526
|
+
const getListOrganizationApiKeyPermissionsUrl = (params) => {
|
|
527
|
+
const normalizedParams = new URLSearchParams();
|
|
528
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
529
|
+
if (value !== void 0) {
|
|
530
|
+
normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
531
|
+
}
|
|
460
532
|
});
|
|
461
|
-
const
|
|
462
|
-
|
|
463
|
-
return { data, status: res.status, headers: res.headers };
|
|
464
|
-
};
|
|
465
|
-
const getRolesQueryKey = () => {
|
|
466
|
-
return [`https://api.workos.com/_widgets/UserManagement/roles`];
|
|
467
|
-
};
|
|
468
|
-
const getRolesQueryOptions = (options) => {
|
|
469
|
-
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
470
|
-
const queryKey = queryOptions?.queryKey ?? getRolesQueryKey();
|
|
471
|
-
const queryFn = ({
|
|
472
|
-
signal
|
|
473
|
-
}) => roles({ signal, ...fetchOptions });
|
|
474
|
-
return { queryKey, queryFn, ...queryOptions };
|
|
475
|
-
};
|
|
476
|
-
function useRoles(options, queryClient) {
|
|
477
|
-
const queryOptions = getRolesQueryOptions(options);
|
|
478
|
-
const query = (0, import_react_query.useQuery)(queryOptions, queryClient);
|
|
479
|
-
query.queryKey = queryOptions.queryKey;
|
|
480
|
-
return query;
|
|
481
|
-
}
|
|
482
|
-
const getRolesAndConfigUrl = () => {
|
|
483
|
-
return `https://api.workos.com/_widgets/UserManagement/roles-and-config`;
|
|
533
|
+
const stringifiedParams = normalizedParams.toString();
|
|
534
|
+
return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/ApiKeys/permissions?${stringifiedParams}` : `https://api.workos.com/_widgets/ApiKeys/permissions`;
|
|
484
535
|
};
|
|
485
|
-
const
|
|
486
|
-
const res = await fetch(
|
|
536
|
+
const listOrganizationApiKeyPermissions = async (params, options) => {
|
|
537
|
+
const res = await fetch(getListOrganizationApiKeyPermissionsUrl(params), {
|
|
487
538
|
...options,
|
|
488
539
|
method: "GET"
|
|
489
540
|
});
|
|
@@ -495,34 +546,34 @@ const rolesAndConfig = async (options) => {
|
|
|
495
546
|
headers: res.headers
|
|
496
547
|
};
|
|
497
548
|
};
|
|
498
|
-
const
|
|
549
|
+
const getListOrganizationApiKeyPermissionsQueryKey = (params) => {
|
|
499
550
|
return [
|
|
500
|
-
`https://api.workos.com/_widgets/
|
|
551
|
+
`https://api.workos.com/_widgets/ApiKeys/permissions`,
|
|
552
|
+
...params ? [params] : []
|
|
501
553
|
];
|
|
502
554
|
};
|
|
503
|
-
const
|
|
555
|
+
const getListOrganizationApiKeyPermissionsQueryOptions = (params, options) => {
|
|
504
556
|
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
505
|
-
const queryKey = queryOptions?.queryKey ??
|
|
506
|
-
const queryFn = ({
|
|
507
|
-
signal
|
|
508
|
-
}) => rolesAndConfig({ signal, ...fetchOptions });
|
|
557
|
+
const queryKey = queryOptions?.queryKey ?? getListOrganizationApiKeyPermissionsQueryKey(params);
|
|
558
|
+
const queryFn = ({ signal }) => listOrganizationApiKeyPermissions(params, { signal, ...fetchOptions });
|
|
509
559
|
return { queryKey, queryFn, ...queryOptions };
|
|
510
560
|
};
|
|
511
|
-
function
|
|
512
|
-
const queryOptions =
|
|
561
|
+
function useListOrganizationApiKeyPermissions(params, options, queryClient) {
|
|
562
|
+
const queryOptions = getListOrganizationApiKeyPermissionsQueryOptions(
|
|
563
|
+
params,
|
|
564
|
+
options
|
|
565
|
+
);
|
|
513
566
|
const query = (0, import_react_query.useQuery)(queryOptions, queryClient);
|
|
514
567
|
query.queryKey = queryOptions.queryKey;
|
|
515
568
|
return query;
|
|
516
569
|
}
|
|
517
|
-
const
|
|
518
|
-
return `https://api.workos.com/_widgets/
|
|
570
|
+
const getDeleteOrganizationApiKeyUrl = (apiKeyId) => {
|
|
571
|
+
return `https://api.workos.com/_widgets/ApiKeys/${apiKeyId}`;
|
|
519
572
|
};
|
|
520
|
-
const
|
|
521
|
-
const res = await fetch(
|
|
573
|
+
const deleteOrganizationApiKey = async (apiKeyId, options) => {
|
|
574
|
+
const res = await fetch(getDeleteOrganizationApiKeyUrl(apiKeyId), {
|
|
522
575
|
...options,
|
|
523
|
-
method: "
|
|
524
|
-
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
525
|
-
body: JSON.stringify(inviteMemberBody)
|
|
576
|
+
method: "DELETE"
|
|
526
577
|
});
|
|
527
578
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
528
579
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -532,26 +583,26 @@ const inviteMember = async (inviteMemberBody, options) => {
|
|
|
532
583
|
headers: res.headers
|
|
533
584
|
};
|
|
534
585
|
};
|
|
535
|
-
const
|
|
536
|
-
const mutationKey = ["
|
|
586
|
+
const getDeleteOrganizationApiKeyMutationOptions = (options) => {
|
|
587
|
+
const mutationKey = ["deleteOrganizationApiKey"];
|
|
537
588
|
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
538
589
|
const mutationFn = (props) => {
|
|
539
|
-
const {
|
|
540
|
-
return
|
|
590
|
+
const { apiKeyId } = props ?? {};
|
|
591
|
+
return deleteOrganizationApiKey(apiKeyId, fetchOptions);
|
|
541
592
|
};
|
|
542
593
|
return { mutationFn, ...mutationOptions };
|
|
543
594
|
};
|
|
544
|
-
const
|
|
545
|
-
const mutationOptions =
|
|
595
|
+
const useDeleteOrganizationApiKey = (options, queryClient) => {
|
|
596
|
+
const mutationOptions = getDeleteOrganizationApiKeyMutationOptions(options);
|
|
546
597
|
return (0, import_react_query.useMutation)(mutationOptions, queryClient);
|
|
547
598
|
};
|
|
548
|
-
const
|
|
549
|
-
return `https://api.workos.com/_widgets/
|
|
599
|
+
const getDeleteDataInstallationUrl = (installationId) => {
|
|
600
|
+
return `https://api.workos.com/_widgets/DataIntegrations/installations/${installationId}`;
|
|
550
601
|
};
|
|
551
|
-
const
|
|
552
|
-
const res = await fetch(
|
|
602
|
+
const deleteDataInstallation = async (installationId, options) => {
|
|
603
|
+
const res = await fetch(getDeleteDataInstallationUrl(installationId), {
|
|
553
604
|
...options,
|
|
554
|
-
method: "
|
|
605
|
+
method: "DELETE"
|
|
555
606
|
});
|
|
556
607
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
557
608
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -561,26 +612,26 @@ const resendInvite = async (userId, options) => {
|
|
|
561
612
|
headers: res.headers
|
|
562
613
|
};
|
|
563
614
|
};
|
|
564
|
-
const
|
|
565
|
-
const mutationKey = ["
|
|
615
|
+
const getDeleteDataInstallationMutationOptions = (options) => {
|
|
616
|
+
const mutationKey = ["deleteDataInstallation"];
|
|
566
617
|
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
567
618
|
const mutationFn = (props) => {
|
|
568
|
-
const {
|
|
569
|
-
return
|
|
619
|
+
const { installationId } = props ?? {};
|
|
620
|
+
return deleteDataInstallation(installationId, fetchOptions);
|
|
570
621
|
};
|
|
571
622
|
return { mutationFn, ...mutationOptions };
|
|
572
623
|
};
|
|
573
|
-
const
|
|
574
|
-
const mutationOptions =
|
|
624
|
+
const useDeleteDataInstallation = (options, queryClient) => {
|
|
625
|
+
const mutationOptions = getDeleteDataInstallationMutationOptions(options);
|
|
575
626
|
return (0, import_react_query.useMutation)(mutationOptions, queryClient);
|
|
576
627
|
};
|
|
577
|
-
const
|
|
578
|
-
return `https://api.workos.com/_widgets/
|
|
628
|
+
const getMyDataIntegrationsUrl = () => {
|
|
629
|
+
return `https://api.workos.com/_widgets/DataIntegrations/mine`;
|
|
579
630
|
};
|
|
580
|
-
const
|
|
581
|
-
const res = await fetch(
|
|
631
|
+
const myDataIntegrations = async (options) => {
|
|
632
|
+
const res = await fetch(getMyDataIntegrationsUrl(), {
|
|
582
633
|
...options,
|
|
583
|
-
method: "
|
|
634
|
+
method: "GET"
|
|
584
635
|
});
|
|
585
636
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
586
637
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -590,26 +641,83 @@ const revokeInvite = async (userId, options) => {
|
|
|
590
641
|
headers: res.headers
|
|
591
642
|
};
|
|
592
643
|
};
|
|
593
|
-
const
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
644
|
+
const getMyDataIntegrationsQueryKey = () => {
|
|
645
|
+
return [`https://api.workos.com/_widgets/DataIntegrations/mine`];
|
|
646
|
+
};
|
|
647
|
+
const getMyDataIntegrationsQueryOptions = (options) => {
|
|
648
|
+
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
649
|
+
const queryKey = queryOptions?.queryKey ?? getMyDataIntegrationsQueryKey();
|
|
650
|
+
const queryFn = ({ signal }) => myDataIntegrations({ signal, ...fetchOptions });
|
|
651
|
+
return { queryKey, queryFn, ...queryOptions };
|
|
652
|
+
};
|
|
653
|
+
function useMyDataIntegrations(options, queryClient) {
|
|
654
|
+
const queryOptions = getMyDataIntegrationsQueryOptions(options);
|
|
655
|
+
const query = (0, import_react_query.useQuery)(queryOptions, queryClient);
|
|
656
|
+
query.queryKey = queryOptions.queryKey;
|
|
657
|
+
return query;
|
|
658
|
+
}
|
|
659
|
+
const getGetDataInstallationAuthorizationStatusUrl = (dataIntegrationId, state) => {
|
|
660
|
+
return `https://api.workos.com/_widgets/DataIntegrations/${dataIntegrationId}/authorization-status/${state}`;
|
|
661
|
+
};
|
|
662
|
+
const getDataInstallationAuthorizationStatus = async (dataIntegrationId, state, options) => {
|
|
663
|
+
const res = await fetch(
|
|
664
|
+
getGetDataInstallationAuthorizationStatusUrl(dataIntegrationId, state),
|
|
665
|
+
{
|
|
666
|
+
...options,
|
|
667
|
+
method: "GET"
|
|
668
|
+
}
|
|
669
|
+
);
|
|
670
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
671
|
+
const data = body ? JSON.parse(body) : {};
|
|
672
|
+
return {
|
|
673
|
+
data,
|
|
674
|
+
status: res.status,
|
|
675
|
+
headers: res.headers
|
|
599
676
|
};
|
|
600
|
-
return { mutationFn, ...mutationOptions };
|
|
601
677
|
};
|
|
602
|
-
const
|
|
603
|
-
|
|
604
|
-
|
|
678
|
+
const getGetDataInstallationAuthorizationStatusQueryKey = (dataIntegrationId, state) => {
|
|
679
|
+
return [
|
|
680
|
+
`https://api.workos.com/_widgets/DataIntegrations/${dataIntegrationId}/authorization-status/${state}`
|
|
681
|
+
];
|
|
605
682
|
};
|
|
606
|
-
const
|
|
607
|
-
|
|
683
|
+
const getGetDataInstallationAuthorizationStatusQueryOptions = (dataIntegrationId, state, options) => {
|
|
684
|
+
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
685
|
+
const queryKey = queryOptions?.queryKey ?? getGetDataInstallationAuthorizationStatusQueryKey(dataIntegrationId, state);
|
|
686
|
+
const queryFn = ({ signal }) => getDataInstallationAuthorizationStatus(dataIntegrationId, state, {
|
|
687
|
+
signal,
|
|
688
|
+
...fetchOptions
|
|
689
|
+
});
|
|
690
|
+
return {
|
|
691
|
+
queryKey,
|
|
692
|
+
queryFn,
|
|
693
|
+
enabled: !!(dataIntegrationId && state),
|
|
694
|
+
...queryOptions
|
|
695
|
+
};
|
|
608
696
|
};
|
|
609
|
-
|
|
610
|
-
const
|
|
697
|
+
function useGetDataInstallationAuthorizationStatus(dataIntegrationId, state, options, queryClient) {
|
|
698
|
+
const queryOptions = getGetDataInstallationAuthorizationStatusQueryOptions(
|
|
699
|
+
dataIntegrationId,
|
|
700
|
+
state,
|
|
701
|
+
options
|
|
702
|
+
);
|
|
703
|
+
const query = (0, import_react_query.useQuery)(queryOptions, queryClient);
|
|
704
|
+
query.queryKey = queryOptions.queryKey;
|
|
705
|
+
return query;
|
|
706
|
+
}
|
|
707
|
+
const getGetDataIntegrationAuthorizeUrlUrl = (slug, params) => {
|
|
708
|
+
const normalizedParams = new URLSearchParams();
|
|
709
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
710
|
+
if (value !== void 0) {
|
|
711
|
+
normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
712
|
+
}
|
|
713
|
+
});
|
|
714
|
+
const stringifiedParams = normalizedParams.toString();
|
|
715
|
+
return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/DataIntegrations/${slug}/authorize?${stringifiedParams}` : `https://api.workos.com/_widgets/DataIntegrations/${slug}/authorize`;
|
|
716
|
+
};
|
|
717
|
+
const getDataIntegrationAuthorizeUrl = async (slug, params, options) => {
|
|
718
|
+
const res = await fetch(getGetDataIntegrationAuthorizeUrlUrl(slug, params), {
|
|
611
719
|
...options,
|
|
612
|
-
method: "
|
|
720
|
+
method: "GET"
|
|
613
721
|
});
|
|
614
722
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
615
723
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -619,28 +727,71 @@ const removeMember = async (userId, options) => {
|
|
|
619
727
|
headers: res.headers
|
|
620
728
|
};
|
|
621
729
|
};
|
|
622
|
-
const
|
|
623
|
-
|
|
730
|
+
const getGetDataIntegrationAuthorizeUrlQueryKey = (slug, params) => {
|
|
731
|
+
return [
|
|
732
|
+
`https://api.workos.com/_widgets/DataIntegrations/${slug}/authorize`,
|
|
733
|
+
...params ? [params] : []
|
|
734
|
+
];
|
|
735
|
+
};
|
|
736
|
+
const getGetDataIntegrationAuthorizeUrlQueryOptions = (slug, params, options) => {
|
|
737
|
+
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
738
|
+
const queryKey = queryOptions?.queryKey ?? getGetDataIntegrationAuthorizeUrlQueryKey(slug, params);
|
|
739
|
+
const queryFn = ({ signal }) => getDataIntegrationAuthorizeUrl(slug, params, { signal, ...fetchOptions });
|
|
740
|
+
return {
|
|
741
|
+
queryKey,
|
|
742
|
+
queryFn,
|
|
743
|
+
enabled: !!slug,
|
|
744
|
+
...queryOptions
|
|
745
|
+
};
|
|
746
|
+
};
|
|
747
|
+
function useGetDataIntegrationAuthorizeUrl(slug, params, options, queryClient) {
|
|
748
|
+
const queryOptions = getGetDataIntegrationAuthorizeUrlQueryOptions(
|
|
749
|
+
slug,
|
|
750
|
+
params,
|
|
751
|
+
options
|
|
752
|
+
);
|
|
753
|
+
const query = (0, import_react_query.useQuery)(queryOptions, queryClient);
|
|
754
|
+
query.queryKey = queryOptions.queryKey;
|
|
755
|
+
return query;
|
|
756
|
+
}
|
|
757
|
+
const getInviteMemberUrl = () => {
|
|
758
|
+
return `https://api.workos.com/_widgets/UserManagement/invite-user`;
|
|
759
|
+
};
|
|
760
|
+
const inviteMember = async (inviteMemberBody, options) => {
|
|
761
|
+
const res = await fetch(getInviteMemberUrl(), {
|
|
762
|
+
...options,
|
|
763
|
+
method: "POST",
|
|
764
|
+
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
765
|
+
body: JSON.stringify(inviteMemberBody)
|
|
766
|
+
});
|
|
767
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
768
|
+
const data = body ? JSON.parse(body) : {};
|
|
769
|
+
return {
|
|
770
|
+
data,
|
|
771
|
+
status: res.status,
|
|
772
|
+
headers: res.headers
|
|
773
|
+
};
|
|
774
|
+
};
|
|
775
|
+
const getInviteMemberMutationOptions = (options) => {
|
|
776
|
+
const mutationKey = ["inviteMember"];
|
|
624
777
|
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
625
778
|
const mutationFn = (props) => {
|
|
626
|
-
const {
|
|
627
|
-
return
|
|
779
|
+
const { data } = props ?? {};
|
|
780
|
+
return inviteMember(data, fetchOptions);
|
|
628
781
|
};
|
|
629
782
|
return { mutationFn, ...mutationOptions };
|
|
630
783
|
};
|
|
631
|
-
const
|
|
632
|
-
const mutationOptions =
|
|
784
|
+
const useInviteMember = (options, queryClient) => {
|
|
785
|
+
const mutationOptions = getInviteMemberMutationOptions(options);
|
|
633
786
|
return (0, import_react_query.useMutation)(mutationOptions, queryClient);
|
|
634
787
|
};
|
|
635
|
-
const
|
|
636
|
-
return `https://api.workos.com/_widgets/UserManagement/
|
|
788
|
+
const getRevokeInviteUrl = (userId) => {
|
|
789
|
+
return `https://api.workos.com/_widgets/UserManagement/invites/${userId}`;
|
|
637
790
|
};
|
|
638
|
-
const
|
|
639
|
-
const res = await fetch(
|
|
791
|
+
const revokeInvite = async (userId, options) => {
|
|
792
|
+
const res = await fetch(getRevokeInviteUrl(userId), {
|
|
640
793
|
...options,
|
|
641
|
-
method: "
|
|
642
|
-
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
643
|
-
body: JSON.stringify(updateMemberBody)
|
|
794
|
+
method: "DELETE"
|
|
644
795
|
});
|
|
645
796
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
646
797
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -650,26 +801,26 @@ const updateMember = async (userId, updateMemberBody, options) => {
|
|
|
650
801
|
headers: res.headers
|
|
651
802
|
};
|
|
652
803
|
};
|
|
653
|
-
const
|
|
654
|
-
const mutationKey = ["
|
|
804
|
+
const getRevokeInviteMutationOptions = (options) => {
|
|
805
|
+
const mutationKey = ["revokeInvite"];
|
|
655
806
|
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
656
807
|
const mutationFn = (props) => {
|
|
657
|
-
const { userId
|
|
658
|
-
return
|
|
808
|
+
const { userId } = props ?? {};
|
|
809
|
+
return revokeInvite(userId, fetchOptions);
|
|
659
810
|
};
|
|
660
811
|
return { mutationFn, ...mutationOptions };
|
|
661
812
|
};
|
|
662
|
-
const
|
|
663
|
-
const mutationOptions =
|
|
813
|
+
const useRevokeInvite = (options, queryClient) => {
|
|
814
|
+
const mutationOptions = getRevokeInviteMutationOptions(options);
|
|
664
815
|
return (0, import_react_query.useMutation)(mutationOptions, queryClient);
|
|
665
816
|
};
|
|
666
|
-
const
|
|
667
|
-
return `https://api.workos.com/_widgets/UserManagement/
|
|
817
|
+
const getResendInviteUrl = (userId) => {
|
|
818
|
+
return `https://api.workos.com/_widgets/UserManagement/invites/${userId}/resend`;
|
|
668
819
|
};
|
|
669
|
-
const
|
|
670
|
-
const res = await fetch(
|
|
820
|
+
const resendInvite = async (userId, options) => {
|
|
821
|
+
const res = await fetch(getResendInviteUrl(userId), {
|
|
671
822
|
...options,
|
|
672
|
-
method: "
|
|
823
|
+
method: "POST"
|
|
673
824
|
});
|
|
674
825
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
675
826
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -679,30 +830,31 @@ const organizations = async (options) => {
|
|
|
679
830
|
headers: res.headers
|
|
680
831
|
};
|
|
681
832
|
};
|
|
682
|
-
const
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
833
|
+
const getResendInviteMutationOptions = (options) => {
|
|
834
|
+
const mutationKey = ["resendInvite"];
|
|
835
|
+
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
836
|
+
const mutationFn = (props) => {
|
|
837
|
+
const { userId } = props ?? {};
|
|
838
|
+
return resendInvite(userId, fetchOptions);
|
|
839
|
+
};
|
|
840
|
+
return { mutationFn, ...mutationOptions };
|
|
686
841
|
};
|
|
687
|
-
const
|
|
688
|
-
const
|
|
689
|
-
|
|
690
|
-
const queryFn = ({
|
|
691
|
-
signal
|
|
692
|
-
}) => organizations({ signal, ...fetchOptions });
|
|
693
|
-
return { queryKey, queryFn, ...queryOptions };
|
|
842
|
+
const useResendInvite = (options, queryClient) => {
|
|
843
|
+
const mutationOptions = getResendInviteMutationOptions(options);
|
|
844
|
+
return (0, import_react_query.useMutation)(mutationOptions, queryClient);
|
|
694
845
|
};
|
|
695
|
-
|
|
696
|
-
const
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
|
|
846
|
+
const getMembersUrl = (params) => {
|
|
847
|
+
const normalizedParams = new URLSearchParams();
|
|
848
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
849
|
+
if (value !== void 0) {
|
|
850
|
+
normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
851
|
+
}
|
|
852
|
+
});
|
|
853
|
+
const stringifiedParams = normalizedParams.toString();
|
|
854
|
+
return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/UserManagement/members?${stringifiedParams}` : `https://api.workos.com/_widgets/UserManagement/members`;
|
|
703
855
|
};
|
|
704
|
-
const
|
|
705
|
-
const res = await fetch(
|
|
856
|
+
const members = async (params, options) => {
|
|
857
|
+
const res = await fetch(getMembersUrl(params), {
|
|
706
858
|
...options,
|
|
707
859
|
method: "GET"
|
|
708
860
|
});
|
|
@@ -710,55 +862,64 @@ const me = async (options) => {
|
|
|
710
862
|
const data = body ? JSON.parse(body) : {};
|
|
711
863
|
return { data, status: res.status, headers: res.headers };
|
|
712
864
|
};
|
|
713
|
-
const
|
|
714
|
-
return [
|
|
865
|
+
const getMembersQueryKey = (params) => {
|
|
866
|
+
return [
|
|
867
|
+
`https://api.workos.com/_widgets/UserManagement/members`,
|
|
868
|
+
...params ? [params] : []
|
|
869
|
+
];
|
|
715
870
|
};
|
|
716
|
-
const
|
|
871
|
+
const getMembersQueryOptions = (params, options) => {
|
|
717
872
|
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
718
|
-
const queryKey = queryOptions?.queryKey ??
|
|
719
|
-
const queryFn = ({
|
|
873
|
+
const queryKey = queryOptions?.queryKey ?? getMembersQueryKey(params);
|
|
874
|
+
const queryFn = ({
|
|
875
|
+
signal
|
|
876
|
+
}) => members(params, { signal, ...fetchOptions });
|
|
720
877
|
return { queryKey, queryFn, ...queryOptions };
|
|
721
878
|
};
|
|
722
|
-
function
|
|
723
|
-
const queryOptions =
|
|
879
|
+
function useMembers(params, options, queryClient) {
|
|
880
|
+
const queryOptions = getMembersQueryOptions(params, options);
|
|
724
881
|
const query = (0, import_react_query.useQuery)(queryOptions, queryClient);
|
|
725
882
|
query.queryKey = queryOptions.queryKey;
|
|
726
883
|
return query;
|
|
727
884
|
}
|
|
728
|
-
const
|
|
729
|
-
return `https://api.workos.com/_widgets/
|
|
885
|
+
const getRemoveMemberUrl = (userId) => {
|
|
886
|
+
return `https://api.workos.com/_widgets/UserManagement/members/${userId}`;
|
|
730
887
|
};
|
|
731
|
-
const
|
|
732
|
-
const res = await fetch(
|
|
888
|
+
const removeMember = async (userId, options) => {
|
|
889
|
+
const res = await fetch(getRemoveMemberUrl(userId), {
|
|
733
890
|
...options,
|
|
734
|
-
method: "
|
|
735
|
-
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
736
|
-
body: JSON.stringify(updateMeBody)
|
|
891
|
+
method: "DELETE"
|
|
737
892
|
});
|
|
738
893
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
739
894
|
const data = body ? JSON.parse(body) : {};
|
|
740
|
-
return {
|
|
895
|
+
return {
|
|
896
|
+
data,
|
|
897
|
+
status: res.status,
|
|
898
|
+
headers: res.headers
|
|
899
|
+
};
|
|
741
900
|
};
|
|
742
|
-
const
|
|
743
|
-
const mutationKey = ["
|
|
901
|
+
const getRemoveMemberMutationOptions = (options) => {
|
|
902
|
+
const mutationKey = ["removeMember"];
|
|
744
903
|
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
745
904
|
const mutationFn = (props) => {
|
|
746
|
-
const {
|
|
747
|
-
return
|
|
905
|
+
const { userId } = props ?? {};
|
|
906
|
+
return removeMember(userId, fetchOptions);
|
|
748
907
|
};
|
|
749
908
|
return { mutationFn, ...mutationOptions };
|
|
750
909
|
};
|
|
751
|
-
const
|
|
752
|
-
const mutationOptions =
|
|
910
|
+
const useRemoveMember = (options, queryClient) => {
|
|
911
|
+
const mutationOptions = getRemoveMemberMutationOptions(options);
|
|
753
912
|
return (0, import_react_query.useMutation)(mutationOptions, queryClient);
|
|
754
913
|
};
|
|
755
|
-
const
|
|
756
|
-
return `https://api.workos.com/_widgets/
|
|
757
|
-
};
|
|
758
|
-
const
|
|
759
|
-
const res = await fetch(
|
|
914
|
+
const getUpdateMemberUrl = (userId) => {
|
|
915
|
+
return `https://api.workos.com/_widgets/UserManagement/members/${userId}`;
|
|
916
|
+
};
|
|
917
|
+
const updateMember = async (userId, updateMemberBody, options) => {
|
|
918
|
+
const res = await fetch(getUpdateMemberUrl(userId), {
|
|
760
919
|
...options,
|
|
761
|
-
method: "POST"
|
|
920
|
+
method: "POST",
|
|
921
|
+
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
922
|
+
body: JSON.stringify(updateMemberBody)
|
|
762
923
|
});
|
|
763
924
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
764
925
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -768,27 +929,26 @@ const createTotpFactor = async (options) => {
|
|
|
768
929
|
headers: res.headers
|
|
769
930
|
};
|
|
770
931
|
};
|
|
771
|
-
const
|
|
772
|
-
const mutationKey = ["
|
|
932
|
+
const getUpdateMemberMutationOptions = (options) => {
|
|
933
|
+
const mutationKey = ["updateMember"];
|
|
773
934
|
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
774
|
-
const mutationFn = () => {
|
|
775
|
-
|
|
935
|
+
const mutationFn = (props) => {
|
|
936
|
+
const { userId, data } = props ?? {};
|
|
937
|
+
return updateMember(userId, data, fetchOptions);
|
|
776
938
|
};
|
|
777
939
|
return { mutationFn, ...mutationOptions };
|
|
778
940
|
};
|
|
779
|
-
const
|
|
780
|
-
const mutationOptions =
|
|
941
|
+
const useUpdateMember = (options, queryClient) => {
|
|
942
|
+
const mutationOptions = getUpdateMemberMutationOptions(options);
|
|
781
943
|
return (0, import_react_query.useMutation)(mutationOptions, queryClient);
|
|
782
944
|
};
|
|
783
|
-
const
|
|
784
|
-
return `https://api.workos.com/_widgets/
|
|
945
|
+
const getOrganizationsUrl = () => {
|
|
946
|
+
return `https://api.workos.com/_widgets/UserManagement/organizations`;
|
|
785
947
|
};
|
|
786
|
-
const
|
|
787
|
-
const res = await fetch(
|
|
948
|
+
const organizations = async (options) => {
|
|
949
|
+
const res = await fetch(getOrganizationsUrl(), {
|
|
788
950
|
...options,
|
|
789
|
-
method: "
|
|
790
|
-
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
791
|
-
body: JSON.stringify(verifyTotpFactorRequest)
|
|
951
|
+
method: "GET"
|
|
792
952
|
});
|
|
793
953
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
794
954
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -798,26 +958,61 @@ const verifyTotpFactor = async (verifyTotpFactorRequest, options) => {
|
|
|
798
958
|
headers: res.headers
|
|
799
959
|
};
|
|
800
960
|
};
|
|
801
|
-
const
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
const { data } = props ?? {};
|
|
806
|
-
return verifyTotpFactor(data, fetchOptions);
|
|
807
|
-
};
|
|
808
|
-
return { mutationFn, ...mutationOptions };
|
|
961
|
+
const getOrganizationsQueryKey = () => {
|
|
962
|
+
return [
|
|
963
|
+
`https://api.workos.com/_widgets/UserManagement/organizations`
|
|
964
|
+
];
|
|
809
965
|
};
|
|
810
|
-
const
|
|
811
|
-
const
|
|
812
|
-
|
|
966
|
+
const getOrganizationsQueryOptions = (options) => {
|
|
967
|
+
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
968
|
+
const queryKey = queryOptions?.queryKey ?? getOrganizationsQueryKey();
|
|
969
|
+
const queryFn = ({
|
|
970
|
+
signal
|
|
971
|
+
}) => organizations({ signal, ...fetchOptions });
|
|
972
|
+
return { queryKey, queryFn, ...queryOptions };
|
|
813
973
|
};
|
|
814
|
-
|
|
815
|
-
|
|
974
|
+
function useOrganizations(options, queryClient) {
|
|
975
|
+
const queryOptions = getOrganizationsQueryOptions(options);
|
|
976
|
+
const query = (0, import_react_query.useQuery)(queryOptions, queryClient);
|
|
977
|
+
query.queryKey = queryOptions.queryKey;
|
|
978
|
+
return query;
|
|
979
|
+
}
|
|
980
|
+
const getRolesUrl = () => {
|
|
981
|
+
return `https://api.workos.com/_widgets/UserManagement/roles`;
|
|
816
982
|
};
|
|
817
|
-
const
|
|
818
|
-
const res = await fetch(
|
|
983
|
+
const roles = async (options) => {
|
|
984
|
+
const res = await fetch(getRolesUrl(), {
|
|
819
985
|
...options,
|
|
820
|
-
method: "
|
|
986
|
+
method: "GET"
|
|
987
|
+
});
|
|
988
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
989
|
+
const data = body ? JSON.parse(body) : {};
|
|
990
|
+
return { data, status: res.status, headers: res.headers };
|
|
991
|
+
};
|
|
992
|
+
const getRolesQueryKey = () => {
|
|
993
|
+
return [`https://api.workos.com/_widgets/UserManagement/roles`];
|
|
994
|
+
};
|
|
995
|
+
const getRolesQueryOptions = (options) => {
|
|
996
|
+
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
997
|
+
const queryKey = queryOptions?.queryKey ?? getRolesQueryKey();
|
|
998
|
+
const queryFn = ({
|
|
999
|
+
signal
|
|
1000
|
+
}) => roles({ signal, ...fetchOptions });
|
|
1001
|
+
return { queryKey, queryFn, ...queryOptions };
|
|
1002
|
+
};
|
|
1003
|
+
function useRoles(options, queryClient) {
|
|
1004
|
+
const queryOptions = getRolesQueryOptions(options);
|
|
1005
|
+
const query = (0, import_react_query.useQuery)(queryOptions, queryClient);
|
|
1006
|
+
query.queryKey = queryOptions.queryKey;
|
|
1007
|
+
return query;
|
|
1008
|
+
}
|
|
1009
|
+
const getRolesAndConfigUrl = () => {
|
|
1010
|
+
return `https://api.workos.com/_widgets/UserManagement/roles-and-config`;
|
|
1011
|
+
};
|
|
1012
|
+
const rolesAndConfig = async (options) => {
|
|
1013
|
+
const res = await fetch(getRolesAndConfigUrl(), {
|
|
1014
|
+
...options,
|
|
1015
|
+
method: "GET"
|
|
821
1016
|
});
|
|
822
1017
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
823
1018
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -827,18 +1022,25 @@ const deleteTotpFactors = async (options) => {
|
|
|
827
1022
|
headers: res.headers
|
|
828
1023
|
};
|
|
829
1024
|
};
|
|
830
|
-
const
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
return deleteTotpFactors(fetchOptions);
|
|
835
|
-
};
|
|
836
|
-
return { mutationFn, ...mutationOptions };
|
|
1025
|
+
const getRolesAndConfigQueryKey = () => {
|
|
1026
|
+
return [
|
|
1027
|
+
`https://api.workos.com/_widgets/UserManagement/roles-and-config`
|
|
1028
|
+
];
|
|
837
1029
|
};
|
|
838
|
-
const
|
|
839
|
-
const
|
|
840
|
-
|
|
1030
|
+
const getRolesAndConfigQueryOptions = (options) => {
|
|
1031
|
+
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
1032
|
+
const queryKey = queryOptions?.queryKey ?? getRolesAndConfigQueryKey();
|
|
1033
|
+
const queryFn = ({
|
|
1034
|
+
signal
|
|
1035
|
+
}) => rolesAndConfig({ signal, ...fetchOptions });
|
|
1036
|
+
return { queryKey, queryFn, ...queryOptions };
|
|
841
1037
|
};
|
|
1038
|
+
function useRolesAndConfig(options, queryClient) {
|
|
1039
|
+
const queryOptions = getRolesAndConfigQueryOptions(options);
|
|
1040
|
+
const query = (0, import_react_query.useQuery)(queryOptions, queryClient);
|
|
1041
|
+
query.queryKey = queryOptions.queryKey;
|
|
1042
|
+
return query;
|
|
1043
|
+
}
|
|
842
1044
|
const getAuthenticationInformationUrl = () => {
|
|
843
1045
|
return `https://api.workos.com/_widgets/UserProfile/authentication-information`;
|
|
844
1046
|
};
|
|
@@ -903,75 +1105,13 @@ const useCreatePassword = (options, queryClient) => {
|
|
|
903
1105
|
const mutationOptions = getCreatePasswordMutationOptions(options);
|
|
904
1106
|
return (0, import_react_query.useMutation)(mutationOptions, queryClient);
|
|
905
1107
|
};
|
|
906
|
-
const
|
|
907
|
-
return `https://api.workos.com/_widgets/UserProfile/
|
|
908
|
-
};
|
|
909
|
-
const updatePassword = async (updatePasswordRequest, options) => {
|
|
910
|
-
const res = await fetch(getUpdatePasswordUrl(), {
|
|
911
|
-
...options,
|
|
912
|
-
method: "POST",
|
|
913
|
-
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
914
|
-
body: JSON.stringify(updatePasswordRequest)
|
|
915
|
-
});
|
|
916
|
-
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
917
|
-
const data = body ? JSON.parse(body) : {};
|
|
918
|
-
return {
|
|
919
|
-
data,
|
|
920
|
-
status: res.status,
|
|
921
|
-
headers: res.headers
|
|
922
|
-
};
|
|
923
|
-
};
|
|
924
|
-
const getUpdatePasswordMutationOptions = (options) => {
|
|
925
|
-
const mutationKey = ["updatePassword"];
|
|
926
|
-
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
927
|
-
const mutationFn = (props) => {
|
|
928
|
-
const { data } = props ?? {};
|
|
929
|
-
return updatePassword(data, fetchOptions);
|
|
930
|
-
};
|
|
931
|
-
return { mutationFn, ...mutationOptions };
|
|
932
|
-
};
|
|
933
|
-
const useUpdatePassword = (options, queryClient) => {
|
|
934
|
-
const mutationOptions = getUpdatePasswordMutationOptions(options);
|
|
935
|
-
return (0, import_react_query.useMutation)(mutationOptions, queryClient);
|
|
936
|
-
};
|
|
937
|
-
const getRevokeAllSessionsUrl = () => {
|
|
938
|
-
return `https://api.workos.com/_widgets/UserProfile/sessions/revoke-all`;
|
|
939
|
-
};
|
|
940
|
-
const revokeAllSessions = async (revokeAllSessionsRequest, options) => {
|
|
941
|
-
const res = await fetch(getRevokeAllSessionsUrl(), {
|
|
942
|
-
...options,
|
|
943
|
-
method: "DELETE",
|
|
944
|
-
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
945
|
-
body: JSON.stringify(revokeAllSessionsRequest)
|
|
946
|
-
});
|
|
947
|
-
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
948
|
-
const data = body ? JSON.parse(body) : {};
|
|
949
|
-
return {
|
|
950
|
-
data,
|
|
951
|
-
status: res.status,
|
|
952
|
-
headers: res.headers
|
|
953
|
-
};
|
|
954
|
-
};
|
|
955
|
-
const getRevokeAllSessionsMutationOptions = (options) => {
|
|
956
|
-
const mutationKey = ["revokeAllSessions"];
|
|
957
|
-
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
958
|
-
const mutationFn = (props) => {
|
|
959
|
-
const { data } = props ?? {};
|
|
960
|
-
return revokeAllSessions(data, fetchOptions);
|
|
961
|
-
};
|
|
962
|
-
return { mutationFn, ...mutationOptions };
|
|
963
|
-
};
|
|
964
|
-
const useRevokeAllSessions = (options, queryClient) => {
|
|
965
|
-
const mutationOptions = getRevokeAllSessionsMutationOptions(options);
|
|
966
|
-
return (0, import_react_query.useMutation)(mutationOptions, queryClient);
|
|
967
|
-
};
|
|
968
|
-
const getRevokeSessionUrl = (sessionId) => {
|
|
969
|
-
return `https://api.workos.com/_widgets/UserProfile/sessions/revoke/${sessionId}`;
|
|
1108
|
+
const getCreateTotpFactorUrl = () => {
|
|
1109
|
+
return `https://api.workos.com/_widgets/UserProfile/create-totp-factor`;
|
|
970
1110
|
};
|
|
971
|
-
const
|
|
972
|
-
const res = await fetch(
|
|
1111
|
+
const createTotpFactor = async (options) => {
|
|
1112
|
+
const res = await fetch(getCreateTotpFactorUrl(), {
|
|
973
1113
|
...options,
|
|
974
|
-
method: "
|
|
1114
|
+
method: "POST"
|
|
975
1115
|
});
|
|
976
1116
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
977
1117
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -981,24 +1121,23 @@ const revokeSession = async (sessionId, options) => {
|
|
|
981
1121
|
headers: res.headers
|
|
982
1122
|
};
|
|
983
1123
|
};
|
|
984
|
-
const
|
|
985
|
-
const mutationKey = ["
|
|
1124
|
+
const getCreateTotpFactorMutationOptions = (options) => {
|
|
1125
|
+
const mutationKey = ["createTotpFactor"];
|
|
986
1126
|
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
987
|
-
const mutationFn = (
|
|
988
|
-
|
|
989
|
-
return revokeSession(sessionId, fetchOptions);
|
|
1127
|
+
const mutationFn = () => {
|
|
1128
|
+
return createTotpFactor(fetchOptions);
|
|
990
1129
|
};
|
|
991
1130
|
return { mutationFn, ...mutationOptions };
|
|
992
1131
|
};
|
|
993
|
-
const
|
|
994
|
-
const mutationOptions =
|
|
1132
|
+
const useCreateTotpFactor = (options, queryClient) => {
|
|
1133
|
+
const mutationOptions = getCreateTotpFactorMutationOptions(options);
|
|
995
1134
|
return (0, import_react_query.useMutation)(mutationOptions, queryClient);
|
|
996
1135
|
};
|
|
997
|
-
const
|
|
998
|
-
return `https://api.workos.com/_widgets/UserProfile/
|
|
1136
|
+
const getMeUrl = () => {
|
|
1137
|
+
return `https://api.workos.com/_widgets/UserProfile/me`;
|
|
999
1138
|
};
|
|
1000
|
-
const
|
|
1001
|
-
const res = await fetch(
|
|
1139
|
+
const me = async (options) => {
|
|
1140
|
+
const res = await fetch(getMeUrl(), {
|
|
1002
1141
|
...options,
|
|
1003
1142
|
method: "GET"
|
|
1004
1143
|
});
|
|
@@ -1006,76 +1145,46 @@ const sessions = async (options) => {
|
|
|
1006
1145
|
const data = body ? JSON.parse(body) : {};
|
|
1007
1146
|
return { data, status: res.status, headers: res.headers };
|
|
1008
1147
|
};
|
|
1009
|
-
const
|
|
1010
|
-
return [`https://api.workos.com/_widgets/UserProfile/
|
|
1011
|
-
};
|
|
1012
|
-
const getSessionsQueryOptions = (options) => {
|
|
1013
|
-
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
1014
|
-
const queryKey = queryOptions?.queryKey ?? getSessionsQueryKey();
|
|
1015
|
-
const queryFn = ({
|
|
1016
|
-
signal
|
|
1017
|
-
}) => sessions({ signal, ...fetchOptions });
|
|
1018
|
-
return { queryKey, queryFn, ...queryOptions };
|
|
1019
|
-
};
|
|
1020
|
-
function useSessions(options, queryClient) {
|
|
1021
|
-
const queryOptions = getSessionsQueryOptions(options);
|
|
1022
|
-
const query = (0, import_react_query.useQuery)(queryOptions, queryClient);
|
|
1023
|
-
query.queryKey = queryOptions.queryKey;
|
|
1024
|
-
return query;
|
|
1025
|
-
}
|
|
1026
|
-
const getSendVerificationUrl = () => {
|
|
1027
|
-
return `https://api.workos.com/_widgets/UserProfile/send-verification`;
|
|
1028
|
-
};
|
|
1029
|
-
const sendVerification = async (options) => {
|
|
1030
|
-
const res = await fetch(getSendVerificationUrl(), {
|
|
1031
|
-
...options,
|
|
1032
|
-
method: "POST"
|
|
1033
|
-
});
|
|
1034
|
-
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1035
|
-
const data = body ? JSON.parse(body) : {};
|
|
1036
|
-
return {
|
|
1037
|
-
data,
|
|
1038
|
-
status: res.status,
|
|
1039
|
-
headers: res.headers
|
|
1040
|
-
};
|
|
1041
|
-
};
|
|
1042
|
-
const getSendVerificationMutationOptions = (options) => {
|
|
1043
|
-
const mutationKey = ["sendVerification"];
|
|
1044
|
-
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
1045
|
-
const mutationFn = () => {
|
|
1046
|
-
return sendVerification(fetchOptions);
|
|
1047
|
-
};
|
|
1048
|
-
return { mutationFn, ...mutationOptions };
|
|
1148
|
+
const getMeQueryKey = () => {
|
|
1149
|
+
return [`https://api.workos.com/_widgets/UserProfile/me`];
|
|
1049
1150
|
};
|
|
1050
|
-
const
|
|
1051
|
-
const
|
|
1052
|
-
|
|
1151
|
+
const getMeQueryOptions = (options) => {
|
|
1152
|
+
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
1153
|
+
const queryKey = queryOptions?.queryKey ?? getMeQueryKey();
|
|
1154
|
+
const queryFn = ({ signal }) => me({ signal, ...fetchOptions });
|
|
1155
|
+
return { queryKey, queryFn, ...queryOptions };
|
|
1053
1156
|
};
|
|
1054
|
-
|
|
1055
|
-
|
|
1157
|
+
function useMe(options, queryClient) {
|
|
1158
|
+
const queryOptions = getMeQueryOptions(options);
|
|
1159
|
+
const query = (0, import_react_query.useQuery)(queryOptions, queryClient);
|
|
1160
|
+
query.queryKey = queryOptions.queryKey;
|
|
1161
|
+
return query;
|
|
1162
|
+
}
|
|
1163
|
+
const getUpdateMeUrl = () => {
|
|
1164
|
+
return `https://api.workos.com/_widgets/UserProfile/me`;
|
|
1056
1165
|
};
|
|
1057
|
-
const
|
|
1058
|
-
const res = await fetch(
|
|
1166
|
+
const updateMe = async (updateMeBody, options) => {
|
|
1167
|
+
const res = await fetch(getUpdateMeUrl(), {
|
|
1059
1168
|
...options,
|
|
1060
1169
|
method: "POST",
|
|
1061
1170
|
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
1062
|
-
body: JSON.stringify(
|
|
1171
|
+
body: JSON.stringify(updateMeBody)
|
|
1063
1172
|
});
|
|
1064
1173
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1065
1174
|
const data = body ? JSON.parse(body) : {};
|
|
1066
1175
|
return { data, status: res.status, headers: res.headers };
|
|
1067
1176
|
};
|
|
1068
|
-
const
|
|
1069
|
-
const mutationKey = ["
|
|
1177
|
+
const getUpdateMeMutationOptions = (options) => {
|
|
1178
|
+
const mutationKey = ["updateMe"];
|
|
1070
1179
|
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
1071
1180
|
const mutationFn = (props) => {
|
|
1072
1181
|
const { data } = props ?? {};
|
|
1073
|
-
return
|
|
1182
|
+
return updateMe(data, fetchOptions);
|
|
1074
1183
|
};
|
|
1075
1184
|
return { mutationFn, ...mutationOptions };
|
|
1076
1185
|
};
|
|
1077
|
-
const
|
|
1078
|
-
const mutationOptions =
|
|
1186
|
+
const useUpdateMe = (options, queryClient) => {
|
|
1187
|
+
const mutationOptions = getUpdateMeMutationOptions(options);
|
|
1079
1188
|
return (0, import_react_query.useMutation)(mutationOptions, queryClient);
|
|
1080
1189
|
};
|
|
1081
1190
|
const getRegisterPasskeyUrl = () => {
|
|
@@ -1166,11 +1275,39 @@ const useDeletePasskey = (options, queryClient) => {
|
|
|
1166
1275
|
const mutationOptions = getDeletePasskeyMutationOptions(options);
|
|
1167
1276
|
return (0, import_react_query.useMutation)(mutationOptions, queryClient);
|
|
1168
1277
|
};
|
|
1169
|
-
const
|
|
1170
|
-
return `https://api.workos.com/_widgets/
|
|
1278
|
+
const getSendVerificationUrl = () => {
|
|
1279
|
+
return `https://api.workos.com/_widgets/UserProfile/send-verification`;
|
|
1171
1280
|
};
|
|
1172
|
-
const
|
|
1173
|
-
const res = await fetch(
|
|
1281
|
+
const sendVerification = async (options) => {
|
|
1282
|
+
const res = await fetch(getSendVerificationUrl(), {
|
|
1283
|
+
...options,
|
|
1284
|
+
method: "POST"
|
|
1285
|
+
});
|
|
1286
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1287
|
+
const data = body ? JSON.parse(body) : {};
|
|
1288
|
+
return {
|
|
1289
|
+
data,
|
|
1290
|
+
status: res.status,
|
|
1291
|
+
headers: res.headers
|
|
1292
|
+
};
|
|
1293
|
+
};
|
|
1294
|
+
const getSendVerificationMutationOptions = (options) => {
|
|
1295
|
+
const mutationKey = ["sendVerification"];
|
|
1296
|
+
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
1297
|
+
const mutationFn = () => {
|
|
1298
|
+
return sendVerification(fetchOptions);
|
|
1299
|
+
};
|
|
1300
|
+
return { mutationFn, ...mutationOptions };
|
|
1301
|
+
};
|
|
1302
|
+
const useSendVerification = (options, queryClient) => {
|
|
1303
|
+
const mutationOptions = getSendVerificationMutationOptions(options);
|
|
1304
|
+
return (0, import_react_query.useMutation)(mutationOptions, queryClient);
|
|
1305
|
+
};
|
|
1306
|
+
const getSessionsUrl = () => {
|
|
1307
|
+
return `https://api.workos.com/_widgets/UserProfile/sessions`;
|
|
1308
|
+
};
|
|
1309
|
+
const sessions = async (options) => {
|
|
1310
|
+
const res = await fetch(getSessionsUrl(), {
|
|
1174
1311
|
...options,
|
|
1175
1312
|
method: "GET"
|
|
1176
1313
|
});
|
|
@@ -1178,30 +1315,32 @@ const settings = async (options) => {
|
|
|
1178
1315
|
const data = body ? JSON.parse(body) : {};
|
|
1179
1316
|
return { data, status: res.status, headers: res.headers };
|
|
1180
1317
|
};
|
|
1181
|
-
const
|
|
1182
|
-
return [`https://api.workos.com/_widgets/
|
|
1318
|
+
const getSessionsQueryKey = () => {
|
|
1319
|
+
return [`https://api.workos.com/_widgets/UserProfile/sessions`];
|
|
1183
1320
|
};
|
|
1184
|
-
const
|
|
1321
|
+
const getSessionsQueryOptions = (options) => {
|
|
1185
1322
|
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
1186
|
-
const queryKey = queryOptions?.queryKey ??
|
|
1323
|
+
const queryKey = queryOptions?.queryKey ?? getSessionsQueryKey();
|
|
1187
1324
|
const queryFn = ({
|
|
1188
1325
|
signal
|
|
1189
|
-
}) =>
|
|
1326
|
+
}) => sessions({ signal, ...fetchOptions });
|
|
1190
1327
|
return { queryKey, queryFn, ...queryOptions };
|
|
1191
1328
|
};
|
|
1192
|
-
function
|
|
1193
|
-
const queryOptions =
|
|
1329
|
+
function useSessions(options, queryClient) {
|
|
1330
|
+
const queryOptions = getSessionsQueryOptions(options);
|
|
1194
1331
|
const query = (0, import_react_query.useQuery)(queryOptions, queryClient);
|
|
1195
1332
|
query.queryKey = queryOptions.queryKey;
|
|
1196
1333
|
return query;
|
|
1197
1334
|
}
|
|
1198
|
-
const
|
|
1199
|
-
return `https://api.workos.com/_widgets/
|
|
1335
|
+
const getRevokeAllSessionsUrl = () => {
|
|
1336
|
+
return `https://api.workos.com/_widgets/UserProfile/sessions/revoke-all`;
|
|
1200
1337
|
};
|
|
1201
|
-
const
|
|
1202
|
-
const res = await fetch(
|
|
1338
|
+
const revokeAllSessions = async (revokeAllSessionsRequest, options) => {
|
|
1339
|
+
const res = await fetch(getRevokeAllSessionsUrl(), {
|
|
1203
1340
|
...options,
|
|
1204
|
-
method: "
|
|
1341
|
+
method: "DELETE",
|
|
1342
|
+
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
1343
|
+
body: JSON.stringify(revokeAllSessionsRequest)
|
|
1205
1344
|
});
|
|
1206
1345
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1207
1346
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -1211,37 +1350,26 @@ const listOrganizationDomains = async (options) => {
|
|
|
1211
1350
|
headers: res.headers
|
|
1212
1351
|
};
|
|
1213
1352
|
};
|
|
1214
|
-
const
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1353
|
+
const getRevokeAllSessionsMutationOptions = (options) => {
|
|
1354
|
+
const mutationKey = ["revokeAllSessions"];
|
|
1355
|
+
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
1356
|
+
const mutationFn = (props) => {
|
|
1357
|
+
const { data } = props ?? {};
|
|
1358
|
+
return revokeAllSessions(data, fetchOptions);
|
|
1359
|
+
};
|
|
1360
|
+
return { mutationFn, ...mutationOptions };
|
|
1218
1361
|
};
|
|
1219
|
-
const
|
|
1220
|
-
const
|
|
1221
|
-
|
|
1222
|
-
const queryFn = ({ signal }) => listOrganizationDomains({ signal, ...fetchOptions });
|
|
1223
|
-
return { queryKey, queryFn, ...queryOptions };
|
|
1362
|
+
const useRevokeAllSessions = (options, queryClient) => {
|
|
1363
|
+
const mutationOptions = getRevokeAllSessionsMutationOptions(options);
|
|
1364
|
+
return (0, import_react_query.useMutation)(mutationOptions, queryClient);
|
|
1224
1365
|
};
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
const query = (0, import_react_query.useQuery)(queryOptions, queryClient);
|
|
1228
|
-
query.queryKey = queryOptions.queryKey;
|
|
1229
|
-
return query;
|
|
1230
|
-
}
|
|
1231
|
-
const getGenerateAdminPortalLinkUrl = (params) => {
|
|
1232
|
-
const normalizedParams = new URLSearchParams();
|
|
1233
|
-
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1234
|
-
if (value !== void 0) {
|
|
1235
|
-
normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
1236
|
-
}
|
|
1237
|
-
});
|
|
1238
|
-
const stringifiedParams = normalizedParams.toString();
|
|
1239
|
-
return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/admin-portal/generate-link?${stringifiedParams}` : `https://api.workos.com/_widgets/admin-portal/generate-link`;
|
|
1366
|
+
const getRevokeSessionUrl = (sessionId) => {
|
|
1367
|
+
return `https://api.workos.com/_widgets/UserProfile/sessions/revoke/${sessionId}`;
|
|
1240
1368
|
};
|
|
1241
|
-
const
|
|
1242
|
-
const res = await fetch(
|
|
1369
|
+
const revokeSession = async (sessionId, options) => {
|
|
1370
|
+
const res = await fetch(getRevokeSessionUrl(sessionId), {
|
|
1243
1371
|
...options,
|
|
1244
|
-
method: "
|
|
1372
|
+
method: "DELETE"
|
|
1245
1373
|
});
|
|
1246
1374
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1247
1375
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -1251,24 +1379,24 @@ const generateAdminPortalLink = async (params, options) => {
|
|
|
1251
1379
|
headers: res.headers
|
|
1252
1380
|
};
|
|
1253
1381
|
};
|
|
1254
|
-
const
|
|
1255
|
-
const mutationKey = ["
|
|
1382
|
+
const getRevokeSessionMutationOptions = (options) => {
|
|
1383
|
+
const mutationKey = ["revokeSession"];
|
|
1256
1384
|
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
1257
1385
|
const mutationFn = (props) => {
|
|
1258
|
-
const {
|
|
1259
|
-
return
|
|
1386
|
+
const { sessionId } = props ?? {};
|
|
1387
|
+
return revokeSession(sessionId, fetchOptions);
|
|
1260
1388
|
};
|
|
1261
1389
|
return { mutationFn, ...mutationOptions };
|
|
1262
1390
|
};
|
|
1263
|
-
const
|
|
1264
|
-
const mutationOptions =
|
|
1391
|
+
const useRevokeSession = (options, queryClient) => {
|
|
1392
|
+
const mutationOptions = getRevokeSessionMutationOptions(options);
|
|
1265
1393
|
return (0, import_react_query.useMutation)(mutationOptions, queryClient);
|
|
1266
1394
|
};
|
|
1267
|
-
const
|
|
1268
|
-
return `https://api.workos.com/_widgets/
|
|
1395
|
+
const getDeleteTotpFactorsUrl = () => {
|
|
1396
|
+
return `https://api.workos.com/_widgets/UserProfile/totp-factors`;
|
|
1269
1397
|
};
|
|
1270
|
-
const
|
|
1271
|
-
const res = await fetch(
|
|
1398
|
+
const deleteTotpFactors = async (options) => {
|
|
1399
|
+
const res = await fetch(getDeleteTotpFactorsUrl(), {
|
|
1272
1400
|
...options,
|
|
1273
1401
|
method: "DELETE"
|
|
1274
1402
|
});
|
|
@@ -1280,26 +1408,27 @@ const deleteOrganizationDomain = async (domainId, options) => {
|
|
|
1280
1408
|
headers: res.headers
|
|
1281
1409
|
};
|
|
1282
1410
|
};
|
|
1283
|
-
const
|
|
1284
|
-
const mutationKey = ["
|
|
1411
|
+
const getDeleteTotpFactorsMutationOptions = (options) => {
|
|
1412
|
+
const mutationKey = ["deleteTotpFactors"];
|
|
1285
1413
|
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
1286
|
-
const mutationFn = (
|
|
1287
|
-
|
|
1288
|
-
return deleteOrganizationDomain(domainId, fetchOptions);
|
|
1414
|
+
const mutationFn = () => {
|
|
1415
|
+
return deleteTotpFactors(fetchOptions);
|
|
1289
1416
|
};
|
|
1290
1417
|
return { mutationFn, ...mutationOptions };
|
|
1291
1418
|
};
|
|
1292
|
-
const
|
|
1293
|
-
const mutationOptions =
|
|
1419
|
+
const useDeleteTotpFactors = (options, queryClient) => {
|
|
1420
|
+
const mutationOptions = getDeleteTotpFactorsMutationOptions(options);
|
|
1294
1421
|
return (0, import_react_query.useMutation)(mutationOptions, queryClient);
|
|
1295
1422
|
};
|
|
1296
|
-
const
|
|
1297
|
-
return `https://api.workos.com/_widgets/
|
|
1423
|
+
const getUpdatePasswordUrl = () => {
|
|
1424
|
+
return `https://api.workos.com/_widgets/UserProfile/update-password`;
|
|
1298
1425
|
};
|
|
1299
|
-
const
|
|
1300
|
-
const res = await fetch(
|
|
1426
|
+
const updatePassword = async (updatePasswordRequest, options) => {
|
|
1427
|
+
const res = await fetch(getUpdatePasswordUrl(), {
|
|
1301
1428
|
...options,
|
|
1302
|
-
method: "POST"
|
|
1429
|
+
method: "POST",
|
|
1430
|
+
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
1431
|
+
body: JSON.stringify(updatePasswordRequest)
|
|
1303
1432
|
});
|
|
1304
1433
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1305
1434
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -1309,61 +1438,55 @@ const reverifyOrganizationDomain = async (domainId, options) => {
|
|
|
1309
1438
|
headers: res.headers
|
|
1310
1439
|
};
|
|
1311
1440
|
};
|
|
1312
|
-
const
|
|
1313
|
-
const mutationKey = ["
|
|
1441
|
+
const getUpdatePasswordMutationOptions = (options) => {
|
|
1442
|
+
const mutationKey = ["updatePassword"];
|
|
1314
1443
|
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
1315
1444
|
const mutationFn = (props) => {
|
|
1316
|
-
const {
|
|
1317
|
-
return
|
|
1445
|
+
const { data } = props ?? {};
|
|
1446
|
+
return updatePassword(data, fetchOptions);
|
|
1318
1447
|
};
|
|
1319
1448
|
return { mutationFn, ...mutationOptions };
|
|
1320
1449
|
};
|
|
1321
|
-
const
|
|
1322
|
-
const mutationOptions =
|
|
1450
|
+
const useUpdatePassword = (options, queryClient) => {
|
|
1451
|
+
const mutationOptions = getUpdatePasswordMutationOptions(options);
|
|
1323
1452
|
return (0, import_react_query.useMutation)(mutationOptions, queryClient);
|
|
1324
1453
|
};
|
|
1325
|
-
const
|
|
1326
|
-
return `https://api.workos.com/_widgets/
|
|
1454
|
+
const getVerifyUrl = () => {
|
|
1455
|
+
return `https://api.workos.com/_widgets/UserProfile/verify`;
|
|
1327
1456
|
};
|
|
1328
|
-
const
|
|
1329
|
-
const res = await fetch(
|
|
1457
|
+
const verify = async (verifyRequest, options) => {
|
|
1458
|
+
const res = await fetch(getVerifyUrl(), {
|
|
1330
1459
|
...options,
|
|
1331
|
-
method: "
|
|
1460
|
+
method: "POST",
|
|
1461
|
+
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
1462
|
+
body: JSON.stringify(verifyRequest)
|
|
1332
1463
|
});
|
|
1333
1464
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1334
1465
|
const data = body ? JSON.parse(body) : {};
|
|
1335
|
-
return {
|
|
1336
|
-
data,
|
|
1337
|
-
status: res.status,
|
|
1338
|
-
headers: res.headers
|
|
1339
|
-
};
|
|
1466
|
+
return { data, status: res.status, headers: res.headers };
|
|
1340
1467
|
};
|
|
1341
|
-
const
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1468
|
+
const getVerifyMutationOptions = (options) => {
|
|
1469
|
+
const mutationKey = ["verify"];
|
|
1470
|
+
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
1471
|
+
const mutationFn = (props) => {
|
|
1472
|
+
const { data } = props ?? {};
|
|
1473
|
+
return verify(data, fetchOptions);
|
|
1474
|
+
};
|
|
1475
|
+
return { mutationFn, ...mutationOptions };
|
|
1345
1476
|
};
|
|
1346
|
-
const
|
|
1347
|
-
const
|
|
1348
|
-
|
|
1349
|
-
const queryFn = ({ signal }) => listSsoConnections({ signal, ...fetchOptions });
|
|
1350
|
-
return { queryKey, queryFn, ...queryOptions };
|
|
1477
|
+
const useVerify = (options, queryClient) => {
|
|
1478
|
+
const mutationOptions = getVerifyMutationOptions(options);
|
|
1479
|
+
return (0, import_react_query.useMutation)(mutationOptions, queryClient);
|
|
1351
1480
|
};
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
const query = (0, import_react_query.useQuery)(queryOptions, queryClient);
|
|
1355
|
-
query.queryKey = queryOptions.queryKey;
|
|
1356
|
-
return query;
|
|
1357
|
-
}
|
|
1358
|
-
const getCreateOrganizationApiKeyUrl = () => {
|
|
1359
|
-
return `https://api.workos.com/_widgets/ApiKeys/organization-api-keys`;
|
|
1481
|
+
const getVerifyTotpFactorUrl = () => {
|
|
1482
|
+
return `https://api.workos.com/_widgets/UserProfile/verify-totp-factor`;
|
|
1360
1483
|
};
|
|
1361
|
-
const
|
|
1362
|
-
const res = await fetch(
|
|
1484
|
+
const verifyTotpFactor = async (verifyTotpFactorRequest, options) => {
|
|
1485
|
+
const res = await fetch(getVerifyTotpFactorUrl(), {
|
|
1363
1486
|
...options,
|
|
1364
1487
|
method: "POST",
|
|
1365
1488
|
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
1366
|
-
body: JSON.stringify(
|
|
1489
|
+
body: JSON.stringify(verifyTotpFactorRequest)
|
|
1367
1490
|
});
|
|
1368
1491
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1369
1492
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -1373,20 +1496,20 @@ const createOrganizationApiKey = async (createOrganizationApiKeyRequest, options
|
|
|
1373
1496
|
headers: res.headers
|
|
1374
1497
|
};
|
|
1375
1498
|
};
|
|
1376
|
-
const
|
|
1377
|
-
const mutationKey = ["
|
|
1499
|
+
const getVerifyTotpFactorMutationOptions = (options) => {
|
|
1500
|
+
const mutationKey = ["verifyTotpFactor"];
|
|
1378
1501
|
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
1379
1502
|
const mutationFn = (props) => {
|
|
1380
1503
|
const { data } = props ?? {};
|
|
1381
|
-
return
|
|
1504
|
+
return verifyTotpFactor(data, fetchOptions);
|
|
1382
1505
|
};
|
|
1383
1506
|
return { mutationFn, ...mutationOptions };
|
|
1384
1507
|
};
|
|
1385
|
-
const
|
|
1386
|
-
const mutationOptions =
|
|
1508
|
+
const useVerifyTotpFactor = (options, queryClient) => {
|
|
1509
|
+
const mutationOptions = getVerifyTotpFactorMutationOptions(options);
|
|
1387
1510
|
return (0, import_react_query.useMutation)(mutationOptions, queryClient);
|
|
1388
1511
|
};
|
|
1389
|
-
const
|
|
1512
|
+
const getGenerateAdminPortalLinkUrl = (params) => {
|
|
1390
1513
|
const normalizedParams = new URLSearchParams();
|
|
1391
1514
|
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1392
1515
|
if (value !== void 0) {
|
|
@@ -1394,12 +1517,12 @@ const getListOrganizationApiKeysUrl = (params) => {
|
|
|
1394
1517
|
}
|
|
1395
1518
|
});
|
|
1396
1519
|
const stringifiedParams = normalizedParams.toString();
|
|
1397
|
-
return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/
|
|
1520
|
+
return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/admin-portal/generate-link?${stringifiedParams}` : `https://api.workos.com/_widgets/admin-portal/generate-link`;
|
|
1398
1521
|
};
|
|
1399
|
-
const
|
|
1400
|
-
const res = await fetch(
|
|
1522
|
+
const generateAdminPortalLink = async (params, options) => {
|
|
1523
|
+
const res = await fetch(getGenerateAdminPortalLinkUrl(params), {
|
|
1401
1524
|
...options,
|
|
1402
|
-
method: "
|
|
1525
|
+
method: "POST"
|
|
1403
1526
|
});
|
|
1404
1527
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1405
1528
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -1409,36 +1532,24 @@ const listOrganizationApiKeys = async (params, options) => {
|
|
|
1409
1532
|
headers: res.headers
|
|
1410
1533
|
};
|
|
1411
1534
|
};
|
|
1412
|
-
const
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1535
|
+
const getGenerateAdminPortalLinkMutationOptions = (options) => {
|
|
1536
|
+
const mutationKey = ["generateAdminPortalLink"];
|
|
1537
|
+
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
1538
|
+
const mutationFn = (props) => {
|
|
1539
|
+
const { params } = props ?? {};
|
|
1540
|
+
return generateAdminPortalLink(params, fetchOptions);
|
|
1541
|
+
};
|
|
1542
|
+
return { mutationFn, ...mutationOptions };
|
|
1417
1543
|
};
|
|
1418
|
-
const
|
|
1419
|
-
const
|
|
1420
|
-
|
|
1421
|
-
const queryFn = ({ signal }) => listOrganizationApiKeys(params, { signal, ...fetchOptions });
|
|
1422
|
-
return { queryKey, queryFn, ...queryOptions };
|
|
1544
|
+
const useGenerateAdminPortalLink = (options, queryClient) => {
|
|
1545
|
+
const mutationOptions = getGenerateAdminPortalLinkMutationOptions(options);
|
|
1546
|
+
return (0, import_react_query.useMutation)(mutationOptions, queryClient);
|
|
1423
1547
|
};
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
const query = (0, import_react_query.useQuery)(queryOptions, queryClient);
|
|
1427
|
-
query.queryKey = queryOptions.queryKey;
|
|
1428
|
-
return query;
|
|
1429
|
-
}
|
|
1430
|
-
const getListOrganizationApiKeyPermissionsUrl = (params) => {
|
|
1431
|
-
const normalizedParams = new URLSearchParams();
|
|
1432
|
-
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1433
|
-
if (value !== void 0) {
|
|
1434
|
-
normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
1435
|
-
}
|
|
1436
|
-
});
|
|
1437
|
-
const stringifiedParams = normalizedParams.toString();
|
|
1438
|
-
return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/ApiKeys/permissions?${stringifiedParams}` : `https://api.workos.com/_widgets/ApiKeys/permissions`;
|
|
1548
|
+
const getListOrganizationDomainsUrl = () => {
|
|
1549
|
+
return `https://api.workos.com/_widgets/admin-portal/organization-domains`;
|
|
1439
1550
|
};
|
|
1440
|
-
const
|
|
1441
|
-
const res = await fetch(
|
|
1551
|
+
const listOrganizationDomains = async (options) => {
|
|
1552
|
+
const res = await fetch(getListOrganizationDomainsUrl(), {
|
|
1442
1553
|
...options,
|
|
1443
1554
|
method: "GET"
|
|
1444
1555
|
});
|
|
@@ -1450,32 +1561,28 @@ const listOrganizationApiKeyPermissions = async (params, options) => {
|
|
|
1450
1561
|
headers: res.headers
|
|
1451
1562
|
};
|
|
1452
1563
|
};
|
|
1453
|
-
const
|
|
1564
|
+
const getListOrganizationDomainsQueryKey = () => {
|
|
1454
1565
|
return [
|
|
1455
|
-
`https://api.workos.com/_widgets/
|
|
1456
|
-
...params ? [params] : []
|
|
1566
|
+
`https://api.workos.com/_widgets/admin-portal/organization-domains`
|
|
1457
1567
|
];
|
|
1458
1568
|
};
|
|
1459
|
-
const
|
|
1569
|
+
const getListOrganizationDomainsQueryOptions = (options) => {
|
|
1460
1570
|
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
1461
|
-
const queryKey = queryOptions?.queryKey ??
|
|
1462
|
-
const queryFn = ({ signal }) =>
|
|
1571
|
+
const queryKey = queryOptions?.queryKey ?? getListOrganizationDomainsQueryKey();
|
|
1572
|
+
const queryFn = ({ signal }) => listOrganizationDomains({ signal, ...fetchOptions });
|
|
1463
1573
|
return { queryKey, queryFn, ...queryOptions };
|
|
1464
1574
|
};
|
|
1465
|
-
function
|
|
1466
|
-
const queryOptions =
|
|
1467
|
-
params,
|
|
1468
|
-
options
|
|
1469
|
-
);
|
|
1575
|
+
function useListOrganizationDomains(options, queryClient) {
|
|
1576
|
+
const queryOptions = getListOrganizationDomainsQueryOptions(options);
|
|
1470
1577
|
const query = (0, import_react_query.useQuery)(queryOptions, queryClient);
|
|
1471
1578
|
query.queryKey = queryOptions.queryKey;
|
|
1472
1579
|
return query;
|
|
1473
1580
|
}
|
|
1474
|
-
const
|
|
1475
|
-
return `https://api.workos.com/_widgets/
|
|
1581
|
+
const getDeleteOrganizationDomainUrl = (domainId) => {
|
|
1582
|
+
return `https://api.workos.com/_widgets/admin-portal/organization-domains/${domainId}`;
|
|
1476
1583
|
};
|
|
1477
|
-
const
|
|
1478
|
-
const res = await fetch(
|
|
1584
|
+
const deleteOrganizationDomain = async (domainId, options) => {
|
|
1585
|
+
const res = await fetch(getDeleteOrganizationDomainUrl(domainId), {
|
|
1479
1586
|
...options,
|
|
1480
1587
|
method: "DELETE"
|
|
1481
1588
|
});
|
|
@@ -1487,26 +1594,26 @@ const deleteOrganizationApiKey = async (apiKeyId, options) => {
|
|
|
1487
1594
|
headers: res.headers
|
|
1488
1595
|
};
|
|
1489
1596
|
};
|
|
1490
|
-
const
|
|
1491
|
-
const mutationKey = ["
|
|
1597
|
+
const getDeleteOrganizationDomainMutationOptions = (options) => {
|
|
1598
|
+
const mutationKey = ["deleteOrganizationDomain"];
|
|
1492
1599
|
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
1493
1600
|
const mutationFn = (props) => {
|
|
1494
|
-
const {
|
|
1495
|
-
return
|
|
1601
|
+
const { domainId } = props ?? {};
|
|
1602
|
+
return deleteOrganizationDomain(domainId, fetchOptions);
|
|
1496
1603
|
};
|
|
1497
1604
|
return { mutationFn, ...mutationOptions };
|
|
1498
1605
|
};
|
|
1499
|
-
const
|
|
1500
|
-
const mutationOptions =
|
|
1606
|
+
const useDeleteOrganizationDomain = (options, queryClient) => {
|
|
1607
|
+
const mutationOptions = getDeleteOrganizationDomainMutationOptions(options);
|
|
1501
1608
|
return (0, import_react_query.useMutation)(mutationOptions, queryClient);
|
|
1502
1609
|
};
|
|
1503
|
-
const
|
|
1504
|
-
return `https://api.workos.com/_widgets/
|
|
1610
|
+
const getReverifyOrganizationDomainUrl = (domainId) => {
|
|
1611
|
+
return `https://api.workos.com/_widgets/admin-portal/organization-domains/${domainId}/reverify`;
|
|
1505
1612
|
};
|
|
1506
|
-
const
|
|
1507
|
-
const res = await fetch(
|
|
1613
|
+
const reverifyOrganizationDomain = async (domainId, options) => {
|
|
1614
|
+
const res = await fetch(getReverifyOrganizationDomainUrl(domainId), {
|
|
1508
1615
|
...options,
|
|
1509
|
-
method: "
|
|
1616
|
+
method: "POST"
|
|
1510
1617
|
});
|
|
1511
1618
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1512
1619
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -1516,33 +1623,24 @@ const myDataIntegrations = async (options) => {
|
|
|
1516
1623
|
headers: res.headers
|
|
1517
1624
|
};
|
|
1518
1625
|
};
|
|
1519
|
-
const
|
|
1520
|
-
|
|
1626
|
+
const getReverifyOrganizationDomainMutationOptions = (options) => {
|
|
1627
|
+
const mutationKey = ["reverifyOrganizationDomain"];
|
|
1628
|
+
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
1629
|
+
const mutationFn = (props) => {
|
|
1630
|
+
const { domainId } = props ?? {};
|
|
1631
|
+
return reverifyOrganizationDomain(domainId, fetchOptions);
|
|
1632
|
+
};
|
|
1633
|
+
return { mutationFn, ...mutationOptions };
|
|
1521
1634
|
};
|
|
1522
|
-
const
|
|
1523
|
-
const
|
|
1524
|
-
|
|
1525
|
-
const queryFn = ({ signal }) => myDataIntegrations({ signal, ...fetchOptions });
|
|
1526
|
-
return { queryKey, queryFn, ...queryOptions };
|
|
1635
|
+
const useReverifyOrganizationDomain = (options, queryClient) => {
|
|
1636
|
+
const mutationOptions = getReverifyOrganizationDomainMutationOptions(options);
|
|
1637
|
+
return (0, import_react_query.useMutation)(mutationOptions, queryClient);
|
|
1527
1638
|
};
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
const query = (0, import_react_query.useQuery)(queryOptions, queryClient);
|
|
1531
|
-
query.queryKey = queryOptions.queryKey;
|
|
1532
|
-
return query;
|
|
1533
|
-
}
|
|
1534
|
-
const getGetDataIntegrationAuthorizeUrlUrl = (slug, params) => {
|
|
1535
|
-
const normalizedParams = new URLSearchParams();
|
|
1536
|
-
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1537
|
-
if (value !== void 0) {
|
|
1538
|
-
normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
1539
|
-
}
|
|
1540
|
-
});
|
|
1541
|
-
const stringifiedParams = normalizedParams.toString();
|
|
1542
|
-
return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/DataIntegrations/${slug}/authorize?${stringifiedParams}` : `https://api.workos.com/_widgets/DataIntegrations/${slug}/authorize`;
|
|
1639
|
+
const getListSsoConnectionsUrl = () => {
|
|
1640
|
+
return `https://api.workos.com/_widgets/admin-portal/sso-connections`;
|
|
1543
1641
|
};
|
|
1544
|
-
const
|
|
1545
|
-
const res = await fetch(
|
|
1642
|
+
const listSsoConnections = async (options) => {
|
|
1643
|
+
const res = await fetch(getListSsoConnectionsUrl(), {
|
|
1546
1644
|
...options,
|
|
1547
1645
|
method: "GET"
|
|
1548
1646
|
});
|
|
@@ -1554,44 +1652,31 @@ const getDataIntegrationAuthorizeUrl = async (slug, params, options) => {
|
|
|
1554
1652
|
headers: res.headers
|
|
1555
1653
|
};
|
|
1556
1654
|
};
|
|
1557
|
-
const
|
|
1655
|
+
const getListSsoConnectionsQueryKey = () => {
|
|
1558
1656
|
return [
|
|
1559
|
-
`https://api.workos.com/_widgets/
|
|
1560
|
-
...params ? [params] : []
|
|
1657
|
+
`https://api.workos.com/_widgets/admin-portal/sso-connections`
|
|
1561
1658
|
];
|
|
1562
1659
|
};
|
|
1563
|
-
const
|
|
1660
|
+
const getListSsoConnectionsQueryOptions = (options) => {
|
|
1564
1661
|
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
1565
|
-
const queryKey = queryOptions?.queryKey ??
|
|
1566
|
-
const queryFn = ({ signal }) =>
|
|
1567
|
-
return {
|
|
1568
|
-
queryKey,
|
|
1569
|
-
queryFn,
|
|
1570
|
-
enabled: !!slug,
|
|
1571
|
-
...queryOptions
|
|
1572
|
-
};
|
|
1662
|
+
const queryKey = queryOptions?.queryKey ?? getListSsoConnectionsQueryKey();
|
|
1663
|
+
const queryFn = ({ signal }) => listSsoConnections({ signal, ...fetchOptions });
|
|
1664
|
+
return { queryKey, queryFn, ...queryOptions };
|
|
1573
1665
|
};
|
|
1574
|
-
function
|
|
1575
|
-
const queryOptions =
|
|
1576
|
-
slug,
|
|
1577
|
-
params,
|
|
1578
|
-
options
|
|
1579
|
-
);
|
|
1666
|
+
function useListSsoConnections(options, queryClient) {
|
|
1667
|
+
const queryOptions = getListSsoConnectionsQueryOptions(options);
|
|
1580
1668
|
const query = (0, import_react_query.useQuery)(queryOptions, queryClient);
|
|
1581
1669
|
query.queryKey = queryOptions.queryKey;
|
|
1582
1670
|
return query;
|
|
1583
1671
|
}
|
|
1584
|
-
const
|
|
1585
|
-
return `https://api.workos.com/_widgets/
|
|
1672
|
+
const getListDirectoriesUrl = () => {
|
|
1673
|
+
return `https://api.workos.com/_widgets/directory-sync/directories`;
|
|
1586
1674
|
};
|
|
1587
|
-
const
|
|
1588
|
-
const res = await fetch(
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
method: "GET"
|
|
1593
|
-
}
|
|
1594
|
-
);
|
|
1675
|
+
const listDirectories = async (options) => {
|
|
1676
|
+
const res = await fetch(getListDirectoriesUrl(), {
|
|
1677
|
+
...options,
|
|
1678
|
+
method: "GET"
|
|
1679
|
+
});
|
|
1595
1680
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1596
1681
|
const data = body ? JSON.parse(body) : {};
|
|
1597
1682
|
return {
|
|
@@ -1600,78 +1685,70 @@ const getDataInstallationAuthorizationStatus = async (dataIntegrationId, state,
|
|
|
1600
1685
|
headers: res.headers
|
|
1601
1686
|
};
|
|
1602
1687
|
};
|
|
1603
|
-
const
|
|
1688
|
+
const getListDirectoriesQueryKey = () => {
|
|
1604
1689
|
return [
|
|
1605
|
-
`https://api.workos.com/_widgets/
|
|
1690
|
+
`https://api.workos.com/_widgets/directory-sync/directories`
|
|
1606
1691
|
];
|
|
1607
1692
|
};
|
|
1608
|
-
const
|
|
1693
|
+
const getListDirectoriesQueryOptions = (options) => {
|
|
1609
1694
|
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
1610
|
-
const queryKey = queryOptions?.queryKey ??
|
|
1611
|
-
const queryFn = ({
|
|
1612
|
-
signal
|
|
1613
|
-
|
|
1614
|
-
}
|
|
1615
|
-
return {
|
|
1616
|
-
queryKey,
|
|
1617
|
-
queryFn,
|
|
1618
|
-
enabled: !!(dataIntegrationId && state),
|
|
1619
|
-
...queryOptions
|
|
1620
|
-
};
|
|
1695
|
+
const queryKey = queryOptions?.queryKey ?? getListDirectoriesQueryKey();
|
|
1696
|
+
const queryFn = ({
|
|
1697
|
+
signal
|
|
1698
|
+
}) => listDirectories({ signal, ...fetchOptions });
|
|
1699
|
+
return { queryKey, queryFn, ...queryOptions };
|
|
1621
1700
|
};
|
|
1622
|
-
function
|
|
1623
|
-
const queryOptions =
|
|
1624
|
-
dataIntegrationId,
|
|
1625
|
-
state,
|
|
1626
|
-
options
|
|
1627
|
-
);
|
|
1701
|
+
function useListDirectories(options, queryClient) {
|
|
1702
|
+
const queryOptions = getListDirectoriesQueryOptions(options);
|
|
1628
1703
|
const query = (0, import_react_query.useQuery)(queryOptions, queryClient);
|
|
1629
1704
|
query.queryKey = queryOptions.queryKey;
|
|
1630
1705
|
return query;
|
|
1631
1706
|
}
|
|
1632
|
-
const
|
|
1633
|
-
return `https://api.workos.com/_widgets/
|
|
1707
|
+
const getSettingsUrl = () => {
|
|
1708
|
+
return `https://api.workos.com/_widgets/settings`;
|
|
1634
1709
|
};
|
|
1635
|
-
const
|
|
1636
|
-
const res = await fetch(
|
|
1710
|
+
const settings = async (options) => {
|
|
1711
|
+
const res = await fetch(getSettingsUrl(), {
|
|
1637
1712
|
...options,
|
|
1638
|
-
method: "
|
|
1713
|
+
method: "GET"
|
|
1639
1714
|
});
|
|
1640
1715
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1641
1716
|
const data = body ? JSON.parse(body) : {};
|
|
1642
|
-
return {
|
|
1643
|
-
data,
|
|
1644
|
-
status: res.status,
|
|
1645
|
-
headers: res.headers
|
|
1646
|
-
};
|
|
1717
|
+
return { data, status: res.status, headers: res.headers };
|
|
1647
1718
|
};
|
|
1648
|
-
const
|
|
1649
|
-
|
|
1650
|
-
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
1651
|
-
const mutationFn = (props) => {
|
|
1652
|
-
const { installationId } = props ?? {};
|
|
1653
|
-
return deleteDataInstallation(installationId, fetchOptions);
|
|
1654
|
-
};
|
|
1655
|
-
return { mutationFn, ...mutationOptions };
|
|
1719
|
+
const getSettingsQueryKey = () => {
|
|
1720
|
+
return [`https://api.workos.com/_widgets/settings`];
|
|
1656
1721
|
};
|
|
1657
|
-
const
|
|
1658
|
-
const
|
|
1659
|
-
|
|
1722
|
+
const getSettingsQueryOptions = (options) => {
|
|
1723
|
+
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
1724
|
+
const queryKey = queryOptions?.queryKey ?? getSettingsQueryKey();
|
|
1725
|
+
const queryFn = ({
|
|
1726
|
+
signal
|
|
1727
|
+
}) => settings({ signal, ...fetchOptions });
|
|
1728
|
+
return { queryKey, queryFn, ...queryOptions };
|
|
1660
1729
|
};
|
|
1730
|
+
function useSettings(options, queryClient) {
|
|
1731
|
+
const queryOptions = getSettingsQueryOptions(options);
|
|
1732
|
+
const query = (0, import_react_query.useQuery)(queryOptions, queryClient);
|
|
1733
|
+
query.queryKey = queryOptions.queryKey;
|
|
1734
|
+
return query;
|
|
1735
|
+
}
|
|
1661
1736
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1662
1737
|
0 && (module.exports = {
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1738
|
+
AuthenticationInformationResponseDataVerificationMethodsMfaOneOfProvider,
|
|
1739
|
+
AuthenticationInformationResponseDataVerificationMethodsPasskeyOneOfProvider,
|
|
1740
|
+
AuthenticationInformationResponseDataVerificationMethodsPasswordOneOfProvider,
|
|
1666
1741
|
CreateTotpFactorResponseAuthenticationChallengeAllOfObject,
|
|
1667
1742
|
CreateTotpFactorResponseAuthenticationFactorAllOfObject,
|
|
1668
1743
|
CreateTotpFactorResponseAuthenticationFactorAllOfType,
|
|
1669
|
-
|
|
1670
|
-
|
|
1744
|
+
DataInstallationAllOfObject,
|
|
1745
|
+
DataInstallationAllOfState,
|
|
1671
1746
|
DataIntegrationCredentialsType,
|
|
1672
1747
|
DataIntegrationIntegrationType,
|
|
1673
1748
|
DataIntegrationObject,
|
|
1674
1749
|
DataIntegrationOwnership,
|
|
1750
|
+
DirectoryState,
|
|
1751
|
+
DirectoryType,
|
|
1675
1752
|
DomainVerificationNameServer,
|
|
1676
1753
|
GenerateAdminPortalLinkIntent,
|
|
1677
1754
|
MemberActionsItem,
|
|
@@ -1729,6 +1806,9 @@ const useDeleteDataInstallation = (options, queryClient) => {
|
|
|
1729
1806
|
getGetDataIntegrationAuthorizeUrlUrl,
|
|
1730
1807
|
getInviteMemberMutationOptions,
|
|
1731
1808
|
getInviteMemberUrl,
|
|
1809
|
+
getListDirectoriesQueryKey,
|
|
1810
|
+
getListDirectoriesQueryOptions,
|
|
1811
|
+
getListDirectoriesUrl,
|
|
1732
1812
|
getListOrganizationApiKeyPermissionsQueryKey,
|
|
1733
1813
|
getListOrganizationApiKeyPermissionsQueryOptions,
|
|
1734
1814
|
getListOrganizationApiKeyPermissionsUrl,
|
|
@@ -1794,6 +1874,7 @@ const useDeleteDataInstallation = (options, queryClient) => {
|
|
|
1794
1874
|
getVerifyTotpFactorUrl,
|
|
1795
1875
|
getVerifyUrl,
|
|
1796
1876
|
inviteMember,
|
|
1877
|
+
listDirectories,
|
|
1797
1878
|
listOrganizationApiKeyPermissions,
|
|
1798
1879
|
listOrganizationApiKeys,
|
|
1799
1880
|
listOrganizationDomains,
|
|
@@ -1830,6 +1911,7 @@ const useDeleteDataInstallation = (options, queryClient) => {
|
|
|
1830
1911
|
useGetDataInstallationAuthorizationStatus,
|
|
1831
1912
|
useGetDataIntegrationAuthorizeUrl,
|
|
1832
1913
|
useInviteMember,
|
|
1914
|
+
useListDirectories,
|
|
1833
1915
|
useListOrganizationApiKeyPermissions,
|
|
1834
1916
|
useListOrganizationApiKeys,
|
|
1835
1917
|
useListOrganizationDomains,
|