@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
|
@@ -28,18 +28,20 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var swr_exports = {};
|
|
30
30
|
__export(swr_exports, {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
AuthenticationInformationResponseDataVerificationMethodsMfaOneOfProvider: () => AuthenticationInformationResponseDataVerificationMethodsMfaOneOfProvider,
|
|
32
|
+
AuthenticationInformationResponseDataVerificationMethodsPasskeyOneOfProvider: () => AuthenticationInformationResponseDataVerificationMethodsPasskeyOneOfProvider,
|
|
33
|
+
AuthenticationInformationResponseDataVerificationMethodsPasswordOneOfProvider: () => AuthenticationInformationResponseDataVerificationMethodsPasswordOneOfProvider,
|
|
34
34
|
CreateTotpFactorResponseAuthenticationChallengeAllOfObject: () => CreateTotpFactorResponseAuthenticationChallengeAllOfObject,
|
|
35
35
|
CreateTotpFactorResponseAuthenticationFactorAllOfObject: () => CreateTotpFactorResponseAuthenticationFactorAllOfObject,
|
|
36
36
|
CreateTotpFactorResponseAuthenticationFactorAllOfType: () => CreateTotpFactorResponseAuthenticationFactorAllOfType,
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
DataInstallationAllOfObject: () => DataInstallationAllOfObject,
|
|
38
|
+
DataInstallationAllOfState: () => DataInstallationAllOfState,
|
|
39
39
|
DataIntegrationCredentialsType: () => DataIntegrationCredentialsType,
|
|
40
40
|
DataIntegrationIntegrationType: () => DataIntegrationIntegrationType,
|
|
41
41
|
DataIntegrationObject: () => DataIntegrationObject,
|
|
42
42
|
DataIntegrationOwnership: () => DataIntegrationOwnership,
|
|
43
|
+
DirectoryState: () => DirectoryState,
|
|
44
|
+
DirectoryType: () => DirectoryType,
|
|
43
45
|
DomainVerificationNameServer: () => DomainVerificationNameServer,
|
|
44
46
|
GenerateAdminPortalLinkIntent: () => GenerateAdminPortalLinkIntent,
|
|
45
47
|
MemberActionsItem: () => MemberActionsItem,
|
|
@@ -104,6 +106,8 @@ __export(swr_exports, {
|
|
|
104
106
|
getInviteMemberMutationFetcher: () => getInviteMemberMutationFetcher,
|
|
105
107
|
getInviteMemberMutationKey: () => getInviteMemberMutationKey,
|
|
106
108
|
getInviteMemberUrl: () => getInviteMemberUrl,
|
|
109
|
+
getListDirectoriesKey: () => getListDirectoriesKey,
|
|
110
|
+
getListDirectoriesUrl: () => getListDirectoriesUrl,
|
|
107
111
|
getListOrganizationApiKeyPermissionsKey: () => getListOrganizationApiKeyPermissionsKey,
|
|
108
112
|
getListOrganizationApiKeyPermissionsUrl: () => getListOrganizationApiKeyPermissionsUrl,
|
|
109
113
|
getListOrganizationApiKeysKey: () => getListOrganizationApiKeysKey,
|
|
@@ -171,6 +175,7 @@ __export(swr_exports, {
|
|
|
171
175
|
getVerifyTotpFactorUrl: () => getVerifyTotpFactorUrl,
|
|
172
176
|
getVerifyUrl: () => getVerifyUrl,
|
|
173
177
|
inviteMember: () => inviteMember,
|
|
178
|
+
listDirectories: () => listDirectories,
|
|
174
179
|
listOrganizationApiKeyPermissions: () => listOrganizationApiKeyPermissions,
|
|
175
180
|
listOrganizationApiKeys: () => listOrganizationApiKeys,
|
|
176
181
|
listOrganizationDomains: () => listOrganizationDomains,
|
|
@@ -207,6 +212,7 @@ __export(swr_exports, {
|
|
|
207
212
|
useGetDataInstallationAuthorizationStatus: () => useGetDataInstallationAuthorizationStatus,
|
|
208
213
|
useGetDataIntegrationAuthorizeUrl: () => useGetDataIntegrationAuthorizeUrl,
|
|
209
214
|
useInviteMember: () => useInviteMember,
|
|
215
|
+
useListDirectories: () => useListDirectories,
|
|
210
216
|
useListOrganizationApiKeyPermissions: () => useListOrganizationApiKeyPermissions,
|
|
211
217
|
useListOrganizationApiKeys: () => useListOrganizationApiKeys,
|
|
212
218
|
useListOrganizationDomains: () => useListOrganizationDomains,
|
|
@@ -265,13 +271,13 @@ const CreateTotpFactorResponseAuthenticationFactorAllOfType = {
|
|
|
265
271
|
const CreateTotpFactorResponseAuthenticationChallengeAllOfObject = {
|
|
266
272
|
authentication_challenge: "authentication_challenge"
|
|
267
273
|
};
|
|
268
|
-
const
|
|
274
|
+
const AuthenticationInformationResponseDataVerificationMethodsMfaOneOfProvider = {
|
|
269
275
|
MFA: "MFA"
|
|
270
276
|
};
|
|
271
|
-
const
|
|
277
|
+
const AuthenticationInformationResponseDataVerificationMethodsPasswordOneOfProvider = {
|
|
272
278
|
Password: "Password"
|
|
273
279
|
};
|
|
274
|
-
const
|
|
280
|
+
const AuthenticationInformationResponseDataVerificationMethodsPasskeyOneOfProvider = {
|
|
275
281
|
Passkey: "Passkey"
|
|
276
282
|
};
|
|
277
283
|
const SendVerificationResponseType = {
|
|
@@ -369,11 +375,11 @@ const SsoConnectionAnyOfEightAllOfType = {
|
|
|
369
375
|
const SsoConnectionAnyOfEightAllOfProviderTag = {
|
|
370
376
|
OpenIdConnect: "OpenIdConnect"
|
|
371
377
|
};
|
|
372
|
-
const
|
|
378
|
+
const DataInstallationAllOfObject = {
|
|
373
379
|
data_installation: "data_installation",
|
|
374
380
|
connected_account: "connected_account"
|
|
375
381
|
};
|
|
376
|
-
const
|
|
382
|
+
const DataInstallationAllOfState = {
|
|
377
383
|
connected: "connected",
|
|
378
384
|
needs_reauthorization: "needs_reauthorization"
|
|
379
385
|
};
|
|
@@ -427,66 +433,109 @@ const DataIntegrationCredentialsType = {
|
|
|
427
433
|
shared: "shared",
|
|
428
434
|
custom: "custom"
|
|
429
435
|
};
|
|
436
|
+
const DirectoryType = {
|
|
437
|
+
azure_scim_v20: "azure scim v2.0",
|
|
438
|
+
bamboohr: "bamboohr",
|
|
439
|
+
breathe_hr: "breathe hr",
|
|
440
|
+
cezanne_hr: "cezanne hr",
|
|
441
|
+
cyberark_scim_v20: "cyberark scim v2.0",
|
|
442
|
+
fourth_hr: "fourth hr",
|
|
443
|
+
generic_scim_v20: "generic scim v2.0",
|
|
444
|
+
gsuite_directory: "gsuite directory",
|
|
445
|
+
gusto: "gusto",
|
|
446
|
+
hibob: "hibob",
|
|
447
|
+
jump_cloud_scim_v20: "jump cloud scim v2.0",
|
|
448
|
+
okta_scim_v20: "okta scim v2.0",
|
|
449
|
+
onelogin_scim_v20: "onelogin scim v2.0",
|
|
450
|
+
people_hr: "people hr",
|
|
451
|
+
personio: "personio",
|
|
452
|
+
pingfederate_scim_v20: "pingfederate scim v2.0",
|
|
453
|
+
rippling: "rippling",
|
|
454
|
+
rippling_scim_v20: "rippling scim v2.0",
|
|
455
|
+
s3: "s3",
|
|
456
|
+
sailpoint_scim_v20: "sailpoint scim v2.0",
|
|
457
|
+
sftp: "sftp",
|
|
458
|
+
sftp_workday: "sftp workday",
|
|
459
|
+
workday: "workday"
|
|
460
|
+
};
|
|
461
|
+
const DirectoryState = {
|
|
462
|
+
requires_type: "requires_type",
|
|
463
|
+
linked: "linked",
|
|
464
|
+
validating: "validating",
|
|
465
|
+
invalid_credentials: "invalid_credentials",
|
|
466
|
+
unlinked: "unlinked",
|
|
467
|
+
deleting: "deleting"
|
|
468
|
+
};
|
|
430
469
|
const GenerateAdminPortalLinkIntent = {
|
|
431
470
|
domain_verification: "domain_verification",
|
|
432
471
|
sso: "sso"
|
|
433
472
|
};
|
|
434
|
-
const
|
|
435
|
-
|
|
436
|
-
Object.entries(params || {}).forEach(([key, value]) => {
|
|
437
|
-
if (value !== void 0) {
|
|
438
|
-
normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
439
|
-
}
|
|
440
|
-
});
|
|
441
|
-
const stringifiedParams = normalizedParams.toString();
|
|
442
|
-
return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/UserManagement/members?${stringifiedParams}` : `https://api.workos.com/_widgets/UserManagement/members`;
|
|
473
|
+
const getCreateOrganizationApiKeyUrl = () => {
|
|
474
|
+
return `https://api.workos.com/_widgets/ApiKeys/organization-api-keys`;
|
|
443
475
|
};
|
|
444
|
-
const
|
|
445
|
-
const res = await fetch(
|
|
476
|
+
const createOrganizationApiKey = async (createOrganizationApiKeyRequest, options) => {
|
|
477
|
+
const res = await fetch(getCreateOrganizationApiKeyUrl(), {
|
|
446
478
|
...options,
|
|
447
|
-
method: "
|
|
479
|
+
method: "POST",
|
|
480
|
+
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
481
|
+
body: JSON.stringify(createOrganizationApiKeyRequest)
|
|
448
482
|
});
|
|
449
483
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
450
484
|
const data = body ? JSON.parse(body) : {};
|
|
451
|
-
return {
|
|
485
|
+
return {
|
|
486
|
+
data,
|
|
487
|
+
status: res.status,
|
|
488
|
+
headers: res.headers
|
|
489
|
+
};
|
|
452
490
|
};
|
|
453
|
-
const
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
491
|
+
const getCreateOrganizationApiKeyMutationFetcher = (options) => {
|
|
492
|
+
return (_, { arg }) => {
|
|
493
|
+
return createOrganizationApiKey(arg, options);
|
|
494
|
+
};
|
|
495
|
+
};
|
|
496
|
+
const getCreateOrganizationApiKeyMutationKey = () => [`https://api.workos.com/_widgets/ApiKeys/organization-api-keys`];
|
|
497
|
+
const useCreateOrganizationApiKey = (options) => {
|
|
458
498
|
const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
|
|
459
|
-
const
|
|
460
|
-
const
|
|
461
|
-
const
|
|
462
|
-
const query = (0, import_swr.default)(
|
|
463
|
-
swrKey,
|
|
464
|
-
swrFn,
|
|
465
|
-
swrOptions
|
|
466
|
-
);
|
|
499
|
+
const swrKey = swrOptions?.swrKey ?? getCreateOrganizationApiKeyMutationKey();
|
|
500
|
+
const swrFn = getCreateOrganizationApiKeyMutationFetcher(fetchOptions);
|
|
501
|
+
const query = (0, import_mutation.default)(swrKey, swrFn, swrOptions);
|
|
467
502
|
return {
|
|
468
503
|
swrKey,
|
|
469
504
|
...query
|
|
470
505
|
};
|
|
471
506
|
};
|
|
472
|
-
const
|
|
473
|
-
|
|
507
|
+
const getListOrganizationApiKeysUrl = (params) => {
|
|
508
|
+
const normalizedParams = new URLSearchParams();
|
|
509
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
510
|
+
if (value !== void 0) {
|
|
511
|
+
normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
512
|
+
}
|
|
513
|
+
});
|
|
514
|
+
const stringifiedParams = normalizedParams.toString();
|
|
515
|
+
return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/ApiKeys/organization-api-keys?${stringifiedParams}` : `https://api.workos.com/_widgets/ApiKeys/organization-api-keys`;
|
|
474
516
|
};
|
|
475
|
-
const
|
|
476
|
-
const res = await fetch(
|
|
517
|
+
const listOrganizationApiKeys = async (params, options) => {
|
|
518
|
+
const res = await fetch(getListOrganizationApiKeysUrl(params), {
|
|
477
519
|
...options,
|
|
478
520
|
method: "GET"
|
|
479
521
|
});
|
|
480
522
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
481
523
|
const data = body ? JSON.parse(body) : {};
|
|
482
|
-
return {
|
|
524
|
+
return {
|
|
525
|
+
data,
|
|
526
|
+
status: res.status,
|
|
527
|
+
headers: res.headers
|
|
528
|
+
};
|
|
483
529
|
};
|
|
484
|
-
const
|
|
485
|
-
|
|
530
|
+
const getListOrganizationApiKeysKey = (params) => [
|
|
531
|
+
`https://api.workos.com/_widgets/ApiKeys/organization-api-keys`,
|
|
532
|
+
...params ? [params] : []
|
|
533
|
+
];
|
|
534
|
+
const useListOrganizationApiKeys = (params, options) => {
|
|
486
535
|
const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
|
|
487
536
|
const isEnabled = swrOptions?.enabled !== false;
|
|
488
|
-
const swrKey = swrOptions?.swrKey ?? (() => isEnabled ?
|
|
489
|
-
const swrFn = () =>
|
|
537
|
+
const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getListOrganizationApiKeysKey(params) : null);
|
|
538
|
+
const swrFn = () => listOrganizationApiKeys(params, fetchOptions);
|
|
490
539
|
const query = (0, import_swr.default)(
|
|
491
540
|
swrKey,
|
|
492
541
|
swrFn,
|
|
@@ -497,11 +546,18 @@ const useRoles = (options) => {
|
|
|
497
546
|
...query
|
|
498
547
|
};
|
|
499
548
|
};
|
|
500
|
-
const
|
|
501
|
-
|
|
549
|
+
const getListOrganizationApiKeyPermissionsUrl = (params) => {
|
|
550
|
+
const normalizedParams = new URLSearchParams();
|
|
551
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
552
|
+
if (value !== void 0) {
|
|
553
|
+
normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
554
|
+
}
|
|
555
|
+
});
|
|
556
|
+
const stringifiedParams = normalizedParams.toString();
|
|
557
|
+
return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/ApiKeys/permissions?${stringifiedParams}` : `https://api.workos.com/_widgets/ApiKeys/permissions`;
|
|
502
558
|
};
|
|
503
|
-
const
|
|
504
|
-
const res = await fetch(
|
|
559
|
+
const listOrganizationApiKeyPermissions = async (params, options) => {
|
|
560
|
+
const res = await fetch(getListOrganizationApiKeyPermissionsUrl(params), {
|
|
505
561
|
...options,
|
|
506
562
|
method: "GET"
|
|
507
563
|
});
|
|
@@ -513,12 +569,15 @@ const rolesAndConfig = async (options) => {
|
|
|
513
569
|
headers: res.headers
|
|
514
570
|
};
|
|
515
571
|
};
|
|
516
|
-
const
|
|
517
|
-
|
|
572
|
+
const getListOrganizationApiKeyPermissionsKey = (params) => [
|
|
573
|
+
`https://api.workos.com/_widgets/ApiKeys/permissions`,
|
|
574
|
+
...params ? [params] : []
|
|
575
|
+
];
|
|
576
|
+
const useListOrganizationApiKeyPermissions = (params, options) => {
|
|
518
577
|
const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
|
|
519
578
|
const isEnabled = swrOptions?.enabled !== false;
|
|
520
|
-
const swrKey = swrOptions?.swrKey ?? (() => isEnabled ?
|
|
521
|
-
const swrFn = () =>
|
|
579
|
+
const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getListOrganizationApiKeyPermissionsKey(params) : null);
|
|
580
|
+
const swrFn = () => listOrganizationApiKeyPermissions(params, fetchOptions);
|
|
522
581
|
const query = (0, import_swr.default)(
|
|
523
582
|
swrKey,
|
|
524
583
|
swrFn,
|
|
@@ -529,15 +588,13 @@ const useRolesAndConfig = (options) => {
|
|
|
529
588
|
...query
|
|
530
589
|
};
|
|
531
590
|
};
|
|
532
|
-
const
|
|
533
|
-
return `https://api.workos.com/_widgets/
|
|
591
|
+
const getDeleteOrganizationApiKeyUrl = (apiKeyId) => {
|
|
592
|
+
return `https://api.workos.com/_widgets/ApiKeys/${apiKeyId}`;
|
|
534
593
|
};
|
|
535
|
-
const
|
|
536
|
-
const res = await fetch(
|
|
594
|
+
const deleteOrganizationApiKey = async (apiKeyId, options) => {
|
|
595
|
+
const res = await fetch(getDeleteOrganizationApiKeyUrl(apiKeyId), {
|
|
537
596
|
...options,
|
|
538
|
-
method: "
|
|
539
|
-
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
540
|
-
body: JSON.stringify(inviteMemberBody)
|
|
597
|
+
method: "DELETE"
|
|
541
598
|
});
|
|
542
599
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
543
600
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -547,29 +604,32 @@ const inviteMember = async (inviteMemberBody, options) => {
|
|
|
547
604
|
headers: res.headers
|
|
548
605
|
};
|
|
549
606
|
};
|
|
550
|
-
const
|
|
551
|
-
return (_,
|
|
552
|
-
return
|
|
607
|
+
const getDeleteOrganizationApiKeyMutationFetcher = (apiKeyId, options) => {
|
|
608
|
+
return (_, __) => {
|
|
609
|
+
return deleteOrganizationApiKey(apiKeyId, options);
|
|
553
610
|
};
|
|
554
611
|
};
|
|
555
|
-
const
|
|
556
|
-
const
|
|
612
|
+
const getDeleteOrganizationApiKeyMutationKey = (apiKeyId) => [`https://api.workos.com/_widgets/ApiKeys/${apiKeyId}`];
|
|
613
|
+
const useDeleteOrganizationApiKey = (apiKeyId, options) => {
|
|
557
614
|
const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
|
|
558
|
-
const swrKey = swrOptions?.swrKey ??
|
|
559
|
-
const swrFn =
|
|
615
|
+
const swrKey = swrOptions?.swrKey ?? getDeleteOrganizationApiKeyMutationKey(apiKeyId);
|
|
616
|
+
const swrFn = getDeleteOrganizationApiKeyMutationFetcher(
|
|
617
|
+
apiKeyId,
|
|
618
|
+
fetchOptions
|
|
619
|
+
);
|
|
560
620
|
const query = (0, import_mutation.default)(swrKey, swrFn, swrOptions);
|
|
561
621
|
return {
|
|
562
622
|
swrKey,
|
|
563
623
|
...query
|
|
564
624
|
};
|
|
565
625
|
};
|
|
566
|
-
const
|
|
567
|
-
return `https://api.workos.com/_widgets/
|
|
626
|
+
const getDeleteDataInstallationUrl = (installationId) => {
|
|
627
|
+
return `https://api.workos.com/_widgets/DataIntegrations/installations/${installationId}`;
|
|
568
628
|
};
|
|
569
|
-
const
|
|
570
|
-
const res = await fetch(
|
|
629
|
+
const deleteDataInstallation = async (installationId, options) => {
|
|
630
|
+
const res = await fetch(getDeleteDataInstallationUrl(installationId), {
|
|
571
631
|
...options,
|
|
572
|
-
method: "
|
|
632
|
+
method: "DELETE"
|
|
573
633
|
});
|
|
574
634
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
575
635
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -579,31 +639,34 @@ const resendInvite = async (userId, options) => {
|
|
|
579
639
|
headers: res.headers
|
|
580
640
|
};
|
|
581
641
|
};
|
|
582
|
-
const
|
|
642
|
+
const getDeleteDataInstallationMutationFetcher = (installationId, options) => {
|
|
583
643
|
return (_, __) => {
|
|
584
|
-
return
|
|
644
|
+
return deleteDataInstallation(installationId, options);
|
|
585
645
|
};
|
|
586
646
|
};
|
|
587
|
-
const
|
|
588
|
-
`https://api.workos.com/_widgets/
|
|
647
|
+
const getDeleteDataInstallationMutationKey = (installationId) => [
|
|
648
|
+
`https://api.workos.com/_widgets/DataIntegrations/installations/${installationId}`
|
|
589
649
|
];
|
|
590
|
-
const
|
|
650
|
+
const useDeleteDataInstallation = (installationId, options) => {
|
|
591
651
|
const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
|
|
592
|
-
const swrKey = swrOptions?.swrKey ??
|
|
593
|
-
const swrFn =
|
|
652
|
+
const swrKey = swrOptions?.swrKey ?? getDeleteDataInstallationMutationKey(installationId);
|
|
653
|
+
const swrFn = getDeleteDataInstallationMutationFetcher(
|
|
654
|
+
installationId,
|
|
655
|
+
fetchOptions
|
|
656
|
+
);
|
|
594
657
|
const query = (0, import_mutation.default)(swrKey, swrFn, swrOptions);
|
|
595
658
|
return {
|
|
596
659
|
swrKey,
|
|
597
660
|
...query
|
|
598
661
|
};
|
|
599
662
|
};
|
|
600
|
-
const
|
|
601
|
-
return `https://api.workos.com/_widgets/
|
|
663
|
+
const getMyDataIntegrationsUrl = () => {
|
|
664
|
+
return `https://api.workos.com/_widgets/DataIntegrations/mine`;
|
|
602
665
|
};
|
|
603
|
-
const
|
|
604
|
-
const res = await fetch(
|
|
666
|
+
const myDataIntegrations = async (options) => {
|
|
667
|
+
const res = await fetch(getMyDataIntegrationsUrl(), {
|
|
605
668
|
...options,
|
|
606
|
-
method: "
|
|
669
|
+
method: "GET"
|
|
607
670
|
});
|
|
608
671
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
609
672
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -613,30 +676,33 @@ const revokeInvite = async (userId, options) => {
|
|
|
613
676
|
headers: res.headers
|
|
614
677
|
};
|
|
615
678
|
};
|
|
616
|
-
const
|
|
617
|
-
|
|
618
|
-
return revokeInvite(userId, options);
|
|
619
|
-
};
|
|
620
|
-
};
|
|
621
|
-
const getRevokeInviteMutationKey = (userId) => [`https://api.workos.com/_widgets/UserManagement/invites/${userId}`];
|
|
622
|
-
const useRevokeInvite = (userId, options) => {
|
|
679
|
+
const getMyDataIntegrationsKey = () => [`https://api.workos.com/_widgets/DataIntegrations/mine`];
|
|
680
|
+
const useMyDataIntegrations = (options) => {
|
|
623
681
|
const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
|
|
624
|
-
const
|
|
625
|
-
const
|
|
626
|
-
const
|
|
682
|
+
const isEnabled = swrOptions?.enabled !== false;
|
|
683
|
+
const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getMyDataIntegrationsKey() : null);
|
|
684
|
+
const swrFn = () => myDataIntegrations(fetchOptions);
|
|
685
|
+
const query = (0, import_swr.default)(
|
|
686
|
+
swrKey,
|
|
687
|
+
swrFn,
|
|
688
|
+
swrOptions
|
|
689
|
+
);
|
|
627
690
|
return {
|
|
628
691
|
swrKey,
|
|
629
692
|
...query
|
|
630
693
|
};
|
|
631
694
|
};
|
|
632
|
-
const
|
|
633
|
-
return `https://api.workos.com/_widgets/
|
|
695
|
+
const getGetDataInstallationAuthorizationStatusUrl = (dataIntegrationId, state) => {
|
|
696
|
+
return `https://api.workos.com/_widgets/DataIntegrations/${dataIntegrationId}/authorization-status/${state}`;
|
|
634
697
|
};
|
|
635
|
-
const
|
|
636
|
-
const res = await fetch(
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
698
|
+
const getDataInstallationAuthorizationStatus = async (dataIntegrationId, state, options) => {
|
|
699
|
+
const res = await fetch(
|
|
700
|
+
getGetDataInstallationAuthorizationStatusUrl(dataIntegrationId, state),
|
|
701
|
+
{
|
|
702
|
+
...options,
|
|
703
|
+
method: "GET"
|
|
704
|
+
}
|
|
705
|
+
);
|
|
640
706
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
641
707
|
const data = body ? JSON.parse(body) : {};
|
|
642
708
|
return {
|
|
@@ -645,31 +711,42 @@ const removeMember = async (userId, options) => {
|
|
|
645
711
|
headers: res.headers
|
|
646
712
|
};
|
|
647
713
|
};
|
|
648
|
-
const
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
};
|
|
653
|
-
const getRemoveMemberMutationKey = (userId) => [`https://api.workos.com/_widgets/UserManagement/members/${userId}`];
|
|
654
|
-
const useRemoveMember = (userId, options) => {
|
|
714
|
+
const getGetDataInstallationAuthorizationStatusKey = (dataIntegrationId, state) => [
|
|
715
|
+
`https://api.workos.com/_widgets/DataIntegrations/${dataIntegrationId}/authorization-status/${state}`
|
|
716
|
+
];
|
|
717
|
+
const useGetDataInstallationAuthorizationStatus = (dataIntegrationId, state, options) => {
|
|
655
718
|
const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
|
|
656
|
-
const
|
|
657
|
-
const
|
|
658
|
-
const
|
|
719
|
+
const isEnabled = swrOptions?.enabled !== false && !!(dataIntegrationId && state);
|
|
720
|
+
const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getGetDataInstallationAuthorizationStatusKey(dataIntegrationId, state) : null);
|
|
721
|
+
const swrFn = () => getDataInstallationAuthorizationStatus(
|
|
722
|
+
dataIntegrationId,
|
|
723
|
+
state,
|
|
724
|
+
fetchOptions
|
|
725
|
+
);
|
|
726
|
+
const query = (0, import_swr.default)(
|
|
727
|
+
swrKey,
|
|
728
|
+
swrFn,
|
|
729
|
+
swrOptions
|
|
730
|
+
);
|
|
659
731
|
return {
|
|
660
732
|
swrKey,
|
|
661
733
|
...query
|
|
662
734
|
};
|
|
663
735
|
};
|
|
664
|
-
const
|
|
665
|
-
|
|
736
|
+
const getGetDataIntegrationAuthorizeUrlUrl = (slug, params) => {
|
|
737
|
+
const normalizedParams = new URLSearchParams();
|
|
738
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
739
|
+
if (value !== void 0) {
|
|
740
|
+
normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
741
|
+
}
|
|
742
|
+
});
|
|
743
|
+
const stringifiedParams = normalizedParams.toString();
|
|
744
|
+
return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/DataIntegrations/${slug}/authorize?${stringifiedParams}` : `https://api.workos.com/_widgets/DataIntegrations/${slug}/authorize`;
|
|
666
745
|
};
|
|
667
|
-
const
|
|
668
|
-
const res = await fetch(
|
|
746
|
+
const getDataIntegrationAuthorizeUrl = async (slug, params, options) => {
|
|
747
|
+
const res = await fetch(getGetDataIntegrationAuthorizeUrlUrl(slug, params), {
|
|
669
748
|
...options,
|
|
670
|
-
method: "
|
|
671
|
-
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
672
|
-
body: JSON.stringify(updateMemberBody)
|
|
749
|
+
method: "GET"
|
|
673
750
|
});
|
|
674
751
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
675
752
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -679,72 +756,15 @@ const updateMember = async (userId, updateMemberBody, options) => {
|
|
|
679
756
|
headers: res.headers
|
|
680
757
|
};
|
|
681
758
|
};
|
|
682
|
-
const
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
const getUpdateMemberMutationKey = (userId) => [`https://api.workos.com/_widgets/UserManagement/members/${userId}`];
|
|
688
|
-
const useUpdateMember = (userId, options) => {
|
|
689
|
-
const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
|
|
690
|
-
const swrKey = swrOptions?.swrKey ?? getUpdateMemberMutationKey(userId);
|
|
691
|
-
const swrFn = getUpdateMemberMutationFetcher(userId, fetchOptions);
|
|
692
|
-
const query = (0, import_mutation.default)(swrKey, swrFn, swrOptions);
|
|
693
|
-
return {
|
|
694
|
-
swrKey,
|
|
695
|
-
...query
|
|
696
|
-
};
|
|
697
|
-
};
|
|
698
|
-
const getOrganizationsUrl = () => {
|
|
699
|
-
return `https://api.workos.com/_widgets/UserManagement/organizations`;
|
|
700
|
-
};
|
|
701
|
-
const organizations = async (options) => {
|
|
702
|
-
const res = await fetch(getOrganizationsUrl(), {
|
|
703
|
-
...options,
|
|
704
|
-
method: "GET"
|
|
705
|
-
});
|
|
706
|
-
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
707
|
-
const data = body ? JSON.parse(body) : {};
|
|
708
|
-
return {
|
|
709
|
-
data,
|
|
710
|
-
status: res.status,
|
|
711
|
-
headers: res.headers
|
|
712
|
-
};
|
|
713
|
-
};
|
|
714
|
-
const getOrganizationsKey = () => [`https://api.workos.com/_widgets/UserManagement/organizations`];
|
|
715
|
-
const useOrganizations = (options) => {
|
|
716
|
-
const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
|
|
717
|
-
const isEnabled = swrOptions?.enabled !== false;
|
|
718
|
-
const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getOrganizationsKey() : null);
|
|
719
|
-
const swrFn = () => organizations(fetchOptions);
|
|
720
|
-
const query = (0, import_swr.default)(
|
|
721
|
-
swrKey,
|
|
722
|
-
swrFn,
|
|
723
|
-
swrOptions
|
|
724
|
-
);
|
|
725
|
-
return {
|
|
726
|
-
swrKey,
|
|
727
|
-
...query
|
|
728
|
-
};
|
|
729
|
-
};
|
|
730
|
-
const getMeUrl = () => {
|
|
731
|
-
return `https://api.workos.com/_widgets/UserProfile/me`;
|
|
732
|
-
};
|
|
733
|
-
const me = async (options) => {
|
|
734
|
-
const res = await fetch(getMeUrl(), {
|
|
735
|
-
...options,
|
|
736
|
-
method: "GET"
|
|
737
|
-
});
|
|
738
|
-
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
739
|
-
const data = body ? JSON.parse(body) : {};
|
|
740
|
-
return { data, status: res.status, headers: res.headers };
|
|
741
|
-
};
|
|
742
|
-
const getMeKey = () => [`https://api.workos.com/_widgets/UserProfile/me`];
|
|
743
|
-
const useMe = (options) => {
|
|
759
|
+
const getGetDataIntegrationAuthorizeUrlKey = (slug, params) => [
|
|
760
|
+
`https://api.workos.com/_widgets/DataIntegrations/${slug}/authorize`,
|
|
761
|
+
...params ? [params] : []
|
|
762
|
+
];
|
|
763
|
+
const useGetDataIntegrationAuthorizeUrl = (slug, params, options) => {
|
|
744
764
|
const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
|
|
745
|
-
const isEnabled = swrOptions?.enabled !== false;
|
|
746
|
-
const swrKey = swrOptions?.swrKey ?? (() => isEnabled ?
|
|
747
|
-
const swrFn = () =>
|
|
765
|
+
const isEnabled = swrOptions?.enabled !== false && !!slug;
|
|
766
|
+
const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getGetDataIntegrationAuthorizeUrlKey(slug, params) : null);
|
|
767
|
+
const swrFn = () => getDataIntegrationAuthorizeUrl(slug, params, fetchOptions);
|
|
748
768
|
const query = (0, import_swr.default)(
|
|
749
769
|
swrKey,
|
|
750
770
|
swrFn,
|
|
@@ -755,43 +775,15 @@ const useMe = (options) => {
|
|
|
755
775
|
...query
|
|
756
776
|
};
|
|
757
777
|
};
|
|
758
|
-
const
|
|
759
|
-
return `https://api.workos.com/_widgets/
|
|
778
|
+
const getInviteMemberUrl = () => {
|
|
779
|
+
return `https://api.workos.com/_widgets/UserManagement/invite-user`;
|
|
760
780
|
};
|
|
761
|
-
const
|
|
762
|
-
const res = await fetch(
|
|
781
|
+
const inviteMember = async (inviteMemberBody, options) => {
|
|
782
|
+
const res = await fetch(getInviteMemberUrl(), {
|
|
763
783
|
...options,
|
|
764
784
|
method: "POST",
|
|
765
785
|
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
766
|
-
body: JSON.stringify(
|
|
767
|
-
});
|
|
768
|
-
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
769
|
-
const data = body ? JSON.parse(body) : {};
|
|
770
|
-
return { data, status: res.status, headers: res.headers };
|
|
771
|
-
};
|
|
772
|
-
const getUpdateMeMutationFetcher = (options) => {
|
|
773
|
-
return (_, { arg }) => {
|
|
774
|
-
return updateMe(arg, options);
|
|
775
|
-
};
|
|
776
|
-
};
|
|
777
|
-
const getUpdateMeMutationKey = () => [`https://api.workos.com/_widgets/UserProfile/me`];
|
|
778
|
-
const useUpdateMe = (options) => {
|
|
779
|
-
const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
|
|
780
|
-
const swrKey = swrOptions?.swrKey ?? getUpdateMeMutationKey();
|
|
781
|
-
const swrFn = getUpdateMeMutationFetcher(fetchOptions);
|
|
782
|
-
const query = (0, import_mutation.default)(swrKey, swrFn, swrOptions);
|
|
783
|
-
return {
|
|
784
|
-
swrKey,
|
|
785
|
-
...query
|
|
786
|
-
};
|
|
787
|
-
};
|
|
788
|
-
const getCreateTotpFactorUrl = () => {
|
|
789
|
-
return `https://api.workos.com/_widgets/UserProfile/create-totp-factor`;
|
|
790
|
-
};
|
|
791
|
-
const createTotpFactor = async (options) => {
|
|
792
|
-
const res = await fetch(getCreateTotpFactorUrl(), {
|
|
793
|
-
...options,
|
|
794
|
-
method: "POST"
|
|
786
|
+
body: JSON.stringify(inviteMemberBody)
|
|
795
787
|
});
|
|
796
788
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
797
789
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -801,31 +793,29 @@ const createTotpFactor = async (options) => {
|
|
|
801
793
|
headers: res.headers
|
|
802
794
|
};
|
|
803
795
|
};
|
|
804
|
-
const
|
|
805
|
-
return (_,
|
|
806
|
-
return
|
|
796
|
+
const getInviteMemberMutationFetcher = (options) => {
|
|
797
|
+
return (_, { arg }) => {
|
|
798
|
+
return inviteMember(arg, options);
|
|
807
799
|
};
|
|
808
800
|
};
|
|
809
|
-
const
|
|
810
|
-
const
|
|
801
|
+
const getInviteMemberMutationKey = () => [`https://api.workos.com/_widgets/UserManagement/invite-user`];
|
|
802
|
+
const useInviteMember = (options) => {
|
|
811
803
|
const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
|
|
812
|
-
const swrKey = swrOptions?.swrKey ??
|
|
813
|
-
const swrFn =
|
|
804
|
+
const swrKey = swrOptions?.swrKey ?? getInviteMemberMutationKey();
|
|
805
|
+
const swrFn = getInviteMemberMutationFetcher(fetchOptions);
|
|
814
806
|
const query = (0, import_mutation.default)(swrKey, swrFn, swrOptions);
|
|
815
807
|
return {
|
|
816
808
|
swrKey,
|
|
817
809
|
...query
|
|
818
810
|
};
|
|
819
811
|
};
|
|
820
|
-
const
|
|
821
|
-
return `https://api.workos.com/_widgets/
|
|
812
|
+
const getRevokeInviteUrl = (userId) => {
|
|
813
|
+
return `https://api.workos.com/_widgets/UserManagement/invites/${userId}`;
|
|
822
814
|
};
|
|
823
|
-
const
|
|
824
|
-
const res = await fetch(
|
|
815
|
+
const revokeInvite = async (userId, options) => {
|
|
816
|
+
const res = await fetch(getRevokeInviteUrl(userId), {
|
|
825
817
|
...options,
|
|
826
|
-
method: "
|
|
827
|
-
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
828
|
-
body: JSON.stringify(verifyTotpFactorRequest)
|
|
818
|
+
method: "DELETE"
|
|
829
819
|
});
|
|
830
820
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
831
821
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -835,29 +825,29 @@ const verifyTotpFactor = async (verifyTotpFactorRequest, options) => {
|
|
|
835
825
|
headers: res.headers
|
|
836
826
|
};
|
|
837
827
|
};
|
|
838
|
-
const
|
|
839
|
-
return (_,
|
|
840
|
-
return
|
|
828
|
+
const getRevokeInviteMutationFetcher = (userId, options) => {
|
|
829
|
+
return (_, __) => {
|
|
830
|
+
return revokeInvite(userId, options);
|
|
841
831
|
};
|
|
842
832
|
};
|
|
843
|
-
const
|
|
844
|
-
const
|
|
833
|
+
const getRevokeInviteMutationKey = (userId) => [`https://api.workos.com/_widgets/UserManagement/invites/${userId}`];
|
|
834
|
+
const useRevokeInvite = (userId, options) => {
|
|
845
835
|
const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
|
|
846
|
-
const swrKey = swrOptions?.swrKey ??
|
|
847
|
-
const swrFn =
|
|
836
|
+
const swrKey = swrOptions?.swrKey ?? getRevokeInviteMutationKey(userId);
|
|
837
|
+
const swrFn = getRevokeInviteMutationFetcher(userId, fetchOptions);
|
|
848
838
|
const query = (0, import_mutation.default)(swrKey, swrFn, swrOptions);
|
|
849
839
|
return {
|
|
850
840
|
swrKey,
|
|
851
841
|
...query
|
|
852
842
|
};
|
|
853
843
|
};
|
|
854
|
-
const
|
|
855
|
-
return `https://api.workos.com/_widgets/
|
|
844
|
+
const getResendInviteUrl = (userId) => {
|
|
845
|
+
return `https://api.workos.com/_widgets/UserManagement/invites/${userId}/resend`;
|
|
856
846
|
};
|
|
857
|
-
const
|
|
858
|
-
const res = await fetch(
|
|
847
|
+
const resendInvite = async (userId, options) => {
|
|
848
|
+
const res = await fetch(getResendInviteUrl(userId), {
|
|
859
849
|
...options,
|
|
860
|
-
method: "
|
|
850
|
+
method: "POST"
|
|
861
851
|
});
|
|
862
852
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
863
853
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -867,46 +857,52 @@ const deleteTotpFactors = async (options) => {
|
|
|
867
857
|
headers: res.headers
|
|
868
858
|
};
|
|
869
859
|
};
|
|
870
|
-
const
|
|
860
|
+
const getResendInviteMutationFetcher = (userId, options) => {
|
|
871
861
|
return (_, __) => {
|
|
872
|
-
return
|
|
862
|
+
return resendInvite(userId, options);
|
|
873
863
|
};
|
|
874
864
|
};
|
|
875
|
-
const
|
|
876
|
-
|
|
865
|
+
const getResendInviteMutationKey = (userId) => [
|
|
866
|
+
`https://api.workos.com/_widgets/UserManagement/invites/${userId}/resend`
|
|
867
|
+
];
|
|
868
|
+
const useResendInvite = (userId, options) => {
|
|
877
869
|
const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
|
|
878
|
-
const swrKey = swrOptions?.swrKey ??
|
|
879
|
-
const swrFn =
|
|
870
|
+
const swrKey = swrOptions?.swrKey ?? getResendInviteMutationKey(userId);
|
|
871
|
+
const swrFn = getResendInviteMutationFetcher(userId, fetchOptions);
|
|
880
872
|
const query = (0, import_mutation.default)(swrKey, swrFn, swrOptions);
|
|
881
873
|
return {
|
|
882
874
|
swrKey,
|
|
883
875
|
...query
|
|
884
876
|
};
|
|
885
877
|
};
|
|
886
|
-
const
|
|
887
|
-
|
|
878
|
+
const getMembersUrl = (params) => {
|
|
879
|
+
const normalizedParams = new URLSearchParams();
|
|
880
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
881
|
+
if (value !== void 0) {
|
|
882
|
+
normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
883
|
+
}
|
|
884
|
+
});
|
|
885
|
+
const stringifiedParams = normalizedParams.toString();
|
|
886
|
+
return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/UserManagement/members?${stringifiedParams}` : `https://api.workos.com/_widgets/UserManagement/members`;
|
|
888
887
|
};
|
|
889
|
-
const
|
|
890
|
-
const res = await fetch(
|
|
888
|
+
const members = async (params, options) => {
|
|
889
|
+
const res = await fetch(getMembersUrl(params), {
|
|
891
890
|
...options,
|
|
892
891
|
method: "GET"
|
|
893
892
|
});
|
|
894
893
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
895
894
|
const data = body ? JSON.parse(body) : {};
|
|
896
|
-
return {
|
|
897
|
-
data,
|
|
898
|
-
status: res.status,
|
|
899
|
-
headers: res.headers
|
|
900
|
-
};
|
|
895
|
+
return { data, status: res.status, headers: res.headers };
|
|
901
896
|
};
|
|
902
|
-
const
|
|
903
|
-
`https://api.workos.com/_widgets/
|
|
897
|
+
const getMembersKey = (params) => [
|
|
898
|
+
`https://api.workos.com/_widgets/UserManagement/members`,
|
|
899
|
+
...params ? [params] : []
|
|
904
900
|
];
|
|
905
|
-
const
|
|
901
|
+
const useMembers = (params, options) => {
|
|
906
902
|
const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
|
|
907
903
|
const isEnabled = swrOptions?.enabled !== false;
|
|
908
|
-
const swrKey = swrOptions?.swrKey ?? (() => isEnabled ?
|
|
909
|
-
const swrFn = () =>
|
|
904
|
+
const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getMembersKey(params) : null);
|
|
905
|
+
const swrFn = () => members(params, fetchOptions);
|
|
910
906
|
const query = (0, import_swr.default)(
|
|
911
907
|
swrKey,
|
|
912
908
|
swrFn,
|
|
@@ -917,15 +913,13 @@ const useAuthenticationInformation = (options) => {
|
|
|
917
913
|
...query
|
|
918
914
|
};
|
|
919
915
|
};
|
|
920
|
-
const
|
|
921
|
-
return `https://api.workos.com/_widgets/
|
|
916
|
+
const getRemoveMemberUrl = (userId) => {
|
|
917
|
+
return `https://api.workos.com/_widgets/UserManagement/members/${userId}`;
|
|
922
918
|
};
|
|
923
|
-
const
|
|
924
|
-
const res = await fetch(
|
|
919
|
+
const removeMember = async (userId, options) => {
|
|
920
|
+
const res = await fetch(getRemoveMemberUrl(userId), {
|
|
925
921
|
...options,
|
|
926
|
-
method: "
|
|
927
|
-
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
928
|
-
body: JSON.stringify(createPasswordRequest)
|
|
922
|
+
method: "DELETE"
|
|
929
923
|
});
|
|
930
924
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
931
925
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -935,31 +929,31 @@ const createPassword = async (createPasswordRequest, options) => {
|
|
|
935
929
|
headers: res.headers
|
|
936
930
|
};
|
|
937
931
|
};
|
|
938
|
-
const
|
|
939
|
-
return (_,
|
|
940
|
-
return
|
|
932
|
+
const getRemoveMemberMutationFetcher = (userId, options) => {
|
|
933
|
+
return (_, __) => {
|
|
934
|
+
return removeMember(userId, options);
|
|
941
935
|
};
|
|
942
936
|
};
|
|
943
|
-
const
|
|
944
|
-
const
|
|
937
|
+
const getRemoveMemberMutationKey = (userId) => [`https://api.workos.com/_widgets/UserManagement/members/${userId}`];
|
|
938
|
+
const useRemoveMember = (userId, options) => {
|
|
945
939
|
const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
|
|
946
|
-
const swrKey = swrOptions?.swrKey ??
|
|
947
|
-
const swrFn =
|
|
940
|
+
const swrKey = swrOptions?.swrKey ?? getRemoveMemberMutationKey(userId);
|
|
941
|
+
const swrFn = getRemoveMemberMutationFetcher(userId, fetchOptions);
|
|
948
942
|
const query = (0, import_mutation.default)(swrKey, swrFn, swrOptions);
|
|
949
943
|
return {
|
|
950
944
|
swrKey,
|
|
951
945
|
...query
|
|
952
946
|
};
|
|
953
947
|
};
|
|
954
|
-
const
|
|
955
|
-
return `https://api.workos.com/_widgets/
|
|
948
|
+
const getUpdateMemberUrl = (userId) => {
|
|
949
|
+
return `https://api.workos.com/_widgets/UserManagement/members/${userId}`;
|
|
956
950
|
};
|
|
957
|
-
const
|
|
958
|
-
const res = await fetch(
|
|
951
|
+
const updateMember = async (userId, updateMemberBody, options) => {
|
|
952
|
+
const res = await fetch(getUpdateMemberUrl(userId), {
|
|
959
953
|
...options,
|
|
960
954
|
method: "POST",
|
|
961
955
|
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
962
|
-
body: JSON.stringify(
|
|
956
|
+
body: JSON.stringify(updateMemberBody)
|
|
963
957
|
});
|
|
964
958
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
965
959
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -969,31 +963,29 @@ const updatePassword = async (updatePasswordRequest, options) => {
|
|
|
969
963
|
headers: res.headers
|
|
970
964
|
};
|
|
971
965
|
};
|
|
972
|
-
const
|
|
966
|
+
const getUpdateMemberMutationFetcher = (userId, options) => {
|
|
973
967
|
return (_, { arg }) => {
|
|
974
|
-
return
|
|
968
|
+
return updateMember(userId, arg, options);
|
|
975
969
|
};
|
|
976
970
|
};
|
|
977
|
-
const
|
|
978
|
-
const
|
|
971
|
+
const getUpdateMemberMutationKey = (userId) => [`https://api.workos.com/_widgets/UserManagement/members/${userId}`];
|
|
972
|
+
const useUpdateMember = (userId, options) => {
|
|
979
973
|
const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
|
|
980
|
-
const swrKey = swrOptions?.swrKey ??
|
|
981
|
-
const swrFn =
|
|
974
|
+
const swrKey = swrOptions?.swrKey ?? getUpdateMemberMutationKey(userId);
|
|
975
|
+
const swrFn = getUpdateMemberMutationFetcher(userId, fetchOptions);
|
|
982
976
|
const query = (0, import_mutation.default)(swrKey, swrFn, swrOptions);
|
|
983
977
|
return {
|
|
984
978
|
swrKey,
|
|
985
979
|
...query
|
|
986
980
|
};
|
|
987
981
|
};
|
|
988
|
-
const
|
|
989
|
-
return `https://api.workos.com/_widgets/
|
|
982
|
+
const getOrganizationsUrl = () => {
|
|
983
|
+
return `https://api.workos.com/_widgets/UserManagement/organizations`;
|
|
990
984
|
};
|
|
991
|
-
const
|
|
992
|
-
const res = await fetch(
|
|
985
|
+
const organizations = async (options) => {
|
|
986
|
+
const res = await fetch(getOrganizationsUrl(), {
|
|
993
987
|
...options,
|
|
994
|
-
method: "
|
|
995
|
-
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
996
|
-
body: JSON.stringify(revokeAllSessionsRequest)
|
|
988
|
+
method: "GET"
|
|
997
989
|
});
|
|
998
990
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
999
991
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -1003,29 +995,57 @@ const revokeAllSessions = async (revokeAllSessionsRequest, options) => {
|
|
|
1003
995
|
headers: res.headers
|
|
1004
996
|
};
|
|
1005
997
|
};
|
|
1006
|
-
const
|
|
1007
|
-
|
|
1008
|
-
|
|
998
|
+
const getOrganizationsKey = () => [`https://api.workos.com/_widgets/UserManagement/organizations`];
|
|
999
|
+
const useOrganizations = (options) => {
|
|
1000
|
+
const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
|
|
1001
|
+
const isEnabled = swrOptions?.enabled !== false;
|
|
1002
|
+
const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getOrganizationsKey() : null);
|
|
1003
|
+
const swrFn = () => organizations(fetchOptions);
|
|
1004
|
+
const query = (0, import_swr.default)(
|
|
1005
|
+
swrKey,
|
|
1006
|
+
swrFn,
|
|
1007
|
+
swrOptions
|
|
1008
|
+
);
|
|
1009
|
+
return {
|
|
1010
|
+
swrKey,
|
|
1011
|
+
...query
|
|
1009
1012
|
};
|
|
1010
1013
|
};
|
|
1011
|
-
const
|
|
1012
|
-
|
|
1014
|
+
const getRolesUrl = () => {
|
|
1015
|
+
return `https://api.workos.com/_widgets/UserManagement/roles`;
|
|
1016
|
+
};
|
|
1017
|
+
const roles = async (options) => {
|
|
1018
|
+
const res = await fetch(getRolesUrl(), {
|
|
1019
|
+
...options,
|
|
1020
|
+
method: "GET"
|
|
1021
|
+
});
|
|
1022
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1023
|
+
const data = body ? JSON.parse(body) : {};
|
|
1024
|
+
return { data, status: res.status, headers: res.headers };
|
|
1025
|
+
};
|
|
1026
|
+
const getRolesKey = () => [`https://api.workos.com/_widgets/UserManagement/roles`];
|
|
1027
|
+
const useRoles = (options) => {
|
|
1013
1028
|
const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
|
|
1014
|
-
const
|
|
1015
|
-
const
|
|
1016
|
-
const
|
|
1029
|
+
const isEnabled = swrOptions?.enabled !== false;
|
|
1030
|
+
const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getRolesKey() : null);
|
|
1031
|
+
const swrFn = () => roles(fetchOptions);
|
|
1032
|
+
const query = (0, import_swr.default)(
|
|
1033
|
+
swrKey,
|
|
1034
|
+
swrFn,
|
|
1035
|
+
swrOptions
|
|
1036
|
+
);
|
|
1017
1037
|
return {
|
|
1018
1038
|
swrKey,
|
|
1019
1039
|
...query
|
|
1020
1040
|
};
|
|
1021
1041
|
};
|
|
1022
|
-
const
|
|
1023
|
-
return `https://api.workos.com/_widgets/
|
|
1042
|
+
const getRolesAndConfigUrl = () => {
|
|
1043
|
+
return `https://api.workos.com/_widgets/UserManagement/roles-and-config`;
|
|
1024
1044
|
};
|
|
1025
|
-
const
|
|
1026
|
-
const res = await fetch(
|
|
1045
|
+
const rolesAndConfig = async (options) => {
|
|
1046
|
+
const res = await fetch(getRolesAndConfigUrl(), {
|
|
1027
1047
|
...options,
|
|
1028
|
-
method: "
|
|
1048
|
+
method: "GET"
|
|
1029
1049
|
});
|
|
1030
1050
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1031
1051
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -1035,42 +1055,46 @@ const revokeSession = async (sessionId, options) => {
|
|
|
1035
1055
|
headers: res.headers
|
|
1036
1056
|
};
|
|
1037
1057
|
};
|
|
1038
|
-
const
|
|
1039
|
-
|
|
1040
|
-
return revokeSession(sessionId, options);
|
|
1041
|
-
};
|
|
1042
|
-
};
|
|
1043
|
-
const getRevokeSessionMutationKey = (sessionId) => [
|
|
1044
|
-
`https://api.workos.com/_widgets/UserProfile/sessions/revoke/${sessionId}`
|
|
1045
|
-
];
|
|
1046
|
-
const useRevokeSession = (sessionId, options) => {
|
|
1058
|
+
const getRolesAndConfigKey = () => [`https://api.workos.com/_widgets/UserManagement/roles-and-config`];
|
|
1059
|
+
const useRolesAndConfig = (options) => {
|
|
1047
1060
|
const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
|
|
1048
|
-
const
|
|
1049
|
-
const
|
|
1050
|
-
const
|
|
1061
|
+
const isEnabled = swrOptions?.enabled !== false;
|
|
1062
|
+
const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getRolesAndConfigKey() : null);
|
|
1063
|
+
const swrFn = () => rolesAndConfig(fetchOptions);
|
|
1064
|
+
const query = (0, import_swr.default)(
|
|
1065
|
+
swrKey,
|
|
1066
|
+
swrFn,
|
|
1067
|
+
swrOptions
|
|
1068
|
+
);
|
|
1051
1069
|
return {
|
|
1052
1070
|
swrKey,
|
|
1053
1071
|
...query
|
|
1054
1072
|
};
|
|
1055
1073
|
};
|
|
1056
|
-
const
|
|
1057
|
-
return `https://api.workos.com/_widgets/UserProfile/
|
|
1074
|
+
const getAuthenticationInformationUrl = () => {
|
|
1075
|
+
return `https://api.workos.com/_widgets/UserProfile/authentication-information`;
|
|
1058
1076
|
};
|
|
1059
|
-
const
|
|
1060
|
-
const res = await fetch(
|
|
1077
|
+
const authenticationInformation = async (options) => {
|
|
1078
|
+
const res = await fetch(getAuthenticationInformationUrl(), {
|
|
1061
1079
|
...options,
|
|
1062
1080
|
method: "GET"
|
|
1063
1081
|
});
|
|
1064
1082
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1065
1083
|
const data = body ? JSON.parse(body) : {};
|
|
1066
|
-
return {
|
|
1084
|
+
return {
|
|
1085
|
+
data,
|
|
1086
|
+
status: res.status,
|
|
1087
|
+
headers: res.headers
|
|
1088
|
+
};
|
|
1067
1089
|
};
|
|
1068
|
-
const
|
|
1069
|
-
|
|
1090
|
+
const getAuthenticationInformationKey = () => [
|
|
1091
|
+
`https://api.workos.com/_widgets/UserProfile/authentication-information`
|
|
1092
|
+
];
|
|
1093
|
+
const useAuthenticationInformation = (options) => {
|
|
1070
1094
|
const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
|
|
1071
1095
|
const isEnabled = swrOptions?.enabled !== false;
|
|
1072
|
-
const swrKey = swrOptions?.swrKey ?? (() => isEnabled ?
|
|
1073
|
-
const swrFn = () =>
|
|
1096
|
+
const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getAuthenticationInformationKey() : null);
|
|
1097
|
+
const swrFn = () => authenticationInformation(fetchOptions);
|
|
1074
1098
|
const query = (0, import_swr.default)(
|
|
1075
1099
|
swrKey,
|
|
1076
1100
|
swrFn,
|
|
@@ -1081,11 +1105,45 @@ const useSessions = (options) => {
|
|
|
1081
1105
|
...query
|
|
1082
1106
|
};
|
|
1083
1107
|
};
|
|
1084
|
-
const
|
|
1085
|
-
return `https://api.workos.com/_widgets/UserProfile/
|
|
1108
|
+
const getCreatePasswordUrl = () => {
|
|
1109
|
+
return `https://api.workos.com/_widgets/UserProfile/create-password`;
|
|
1110
|
+
};
|
|
1111
|
+
const createPassword = async (createPasswordRequest, options) => {
|
|
1112
|
+
const res = await fetch(getCreatePasswordUrl(), {
|
|
1113
|
+
...options,
|
|
1114
|
+
method: "POST",
|
|
1115
|
+
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
1116
|
+
body: JSON.stringify(createPasswordRequest)
|
|
1117
|
+
});
|
|
1118
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1119
|
+
const data = body ? JSON.parse(body) : {};
|
|
1120
|
+
return {
|
|
1121
|
+
data,
|
|
1122
|
+
status: res.status,
|
|
1123
|
+
headers: res.headers
|
|
1124
|
+
};
|
|
1125
|
+
};
|
|
1126
|
+
const getCreatePasswordMutationFetcher = (options) => {
|
|
1127
|
+
return (_, { arg }) => {
|
|
1128
|
+
return createPassword(arg, options);
|
|
1129
|
+
};
|
|
1130
|
+
};
|
|
1131
|
+
const getCreatePasswordMutationKey = () => [`https://api.workos.com/_widgets/UserProfile/create-password`];
|
|
1132
|
+
const useCreatePassword = (options) => {
|
|
1133
|
+
const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
|
|
1134
|
+
const swrKey = swrOptions?.swrKey ?? getCreatePasswordMutationKey();
|
|
1135
|
+
const swrFn = getCreatePasswordMutationFetcher(fetchOptions);
|
|
1136
|
+
const query = (0, import_mutation.default)(swrKey, swrFn, swrOptions);
|
|
1137
|
+
return {
|
|
1138
|
+
swrKey,
|
|
1139
|
+
...query
|
|
1140
|
+
};
|
|
1141
|
+
};
|
|
1142
|
+
const getCreateTotpFactorUrl = () => {
|
|
1143
|
+
return `https://api.workos.com/_widgets/UserProfile/create-totp-factor`;
|
|
1086
1144
|
};
|
|
1087
|
-
const
|
|
1088
|
-
const res = await fetch(
|
|
1145
|
+
const createTotpFactor = async (options) => {
|
|
1146
|
+
const res = await fetch(getCreateTotpFactorUrl(), {
|
|
1089
1147
|
...options,
|
|
1090
1148
|
method: "POST"
|
|
1091
1149
|
});
|
|
@@ -1097,46 +1155,74 @@ const sendVerification = async (options) => {
|
|
|
1097
1155
|
headers: res.headers
|
|
1098
1156
|
};
|
|
1099
1157
|
};
|
|
1100
|
-
const
|
|
1158
|
+
const getCreateTotpFactorMutationFetcher = (options) => {
|
|
1101
1159
|
return (_, __) => {
|
|
1102
|
-
return
|
|
1160
|
+
return createTotpFactor(options);
|
|
1103
1161
|
};
|
|
1104
1162
|
};
|
|
1105
|
-
const
|
|
1106
|
-
const
|
|
1163
|
+
const getCreateTotpFactorMutationKey = () => [`https://api.workos.com/_widgets/UserProfile/create-totp-factor`];
|
|
1164
|
+
const useCreateTotpFactor = (options) => {
|
|
1107
1165
|
const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
|
|
1108
|
-
const swrKey = swrOptions?.swrKey ??
|
|
1109
|
-
const swrFn =
|
|
1166
|
+
const swrKey = swrOptions?.swrKey ?? getCreateTotpFactorMutationKey();
|
|
1167
|
+
const swrFn = getCreateTotpFactorMutationFetcher(fetchOptions);
|
|
1110
1168
|
const query = (0, import_mutation.default)(swrKey, swrFn, swrOptions);
|
|
1111
1169
|
return {
|
|
1112
1170
|
swrKey,
|
|
1113
1171
|
...query
|
|
1114
1172
|
};
|
|
1115
1173
|
};
|
|
1116
|
-
const
|
|
1117
|
-
return `https://api.workos.com/_widgets/UserProfile/
|
|
1174
|
+
const getMeUrl = () => {
|
|
1175
|
+
return `https://api.workos.com/_widgets/UserProfile/me`;
|
|
1118
1176
|
};
|
|
1119
|
-
const
|
|
1120
|
-
const res = await fetch(
|
|
1177
|
+
const me = async (options) => {
|
|
1178
|
+
const res = await fetch(getMeUrl(), {
|
|
1179
|
+
...options,
|
|
1180
|
+
method: "GET"
|
|
1181
|
+
});
|
|
1182
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1183
|
+
const data = body ? JSON.parse(body) : {};
|
|
1184
|
+
return { data, status: res.status, headers: res.headers };
|
|
1185
|
+
};
|
|
1186
|
+
const getMeKey = () => [`https://api.workos.com/_widgets/UserProfile/me`];
|
|
1187
|
+
const useMe = (options) => {
|
|
1188
|
+
const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
|
|
1189
|
+
const isEnabled = swrOptions?.enabled !== false;
|
|
1190
|
+
const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getMeKey() : null);
|
|
1191
|
+
const swrFn = () => me(fetchOptions);
|
|
1192
|
+
const query = (0, import_swr.default)(
|
|
1193
|
+
swrKey,
|
|
1194
|
+
swrFn,
|
|
1195
|
+
swrOptions
|
|
1196
|
+
);
|
|
1197
|
+
return {
|
|
1198
|
+
swrKey,
|
|
1199
|
+
...query
|
|
1200
|
+
};
|
|
1201
|
+
};
|
|
1202
|
+
const getUpdateMeUrl = () => {
|
|
1203
|
+
return `https://api.workos.com/_widgets/UserProfile/me`;
|
|
1204
|
+
};
|
|
1205
|
+
const updateMe = async (updateMeBody, options) => {
|
|
1206
|
+
const res = await fetch(getUpdateMeUrl(), {
|
|
1121
1207
|
...options,
|
|
1122
1208
|
method: "POST",
|
|
1123
1209
|
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
1124
|
-
body: JSON.stringify(
|
|
1210
|
+
body: JSON.stringify(updateMeBody)
|
|
1125
1211
|
});
|
|
1126
1212
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1127
1213
|
const data = body ? JSON.parse(body) : {};
|
|
1128
1214
|
return { data, status: res.status, headers: res.headers };
|
|
1129
1215
|
};
|
|
1130
|
-
const
|
|
1216
|
+
const getUpdateMeMutationFetcher = (options) => {
|
|
1131
1217
|
return (_, { arg }) => {
|
|
1132
|
-
return
|
|
1218
|
+
return updateMe(arg, options);
|
|
1133
1219
|
};
|
|
1134
1220
|
};
|
|
1135
|
-
const
|
|
1136
|
-
const
|
|
1221
|
+
const getUpdateMeMutationKey = () => [`https://api.workos.com/_widgets/UserProfile/me`];
|
|
1222
|
+
const useUpdateMe = (options) => {
|
|
1137
1223
|
const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
|
|
1138
|
-
const swrKey = swrOptions?.swrKey ??
|
|
1139
|
-
const swrFn =
|
|
1224
|
+
const swrKey = swrOptions?.swrKey ?? getUpdateMeMutationKey();
|
|
1225
|
+
const swrFn = getUpdateMeMutationFetcher(fetchOptions);
|
|
1140
1226
|
const query = (0, import_mutation.default)(swrKey, swrFn, swrOptions);
|
|
1141
1227
|
return {
|
|
1142
1228
|
swrKey,
|
|
@@ -1243,11 +1329,43 @@ const useDeletePasskey = (passkeyId, options) => {
|
|
|
1243
1329
|
...query
|
|
1244
1330
|
};
|
|
1245
1331
|
};
|
|
1246
|
-
const
|
|
1247
|
-
return `https://api.workos.com/_widgets/
|
|
1332
|
+
const getSendVerificationUrl = () => {
|
|
1333
|
+
return `https://api.workos.com/_widgets/UserProfile/send-verification`;
|
|
1248
1334
|
};
|
|
1249
|
-
const
|
|
1250
|
-
const res = await fetch(
|
|
1335
|
+
const sendVerification = async (options) => {
|
|
1336
|
+
const res = await fetch(getSendVerificationUrl(), {
|
|
1337
|
+
...options,
|
|
1338
|
+
method: "POST"
|
|
1339
|
+
});
|
|
1340
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1341
|
+
const data = body ? JSON.parse(body) : {};
|
|
1342
|
+
return {
|
|
1343
|
+
data,
|
|
1344
|
+
status: res.status,
|
|
1345
|
+
headers: res.headers
|
|
1346
|
+
};
|
|
1347
|
+
};
|
|
1348
|
+
const getSendVerificationMutationFetcher = (options) => {
|
|
1349
|
+
return (_, __) => {
|
|
1350
|
+
return sendVerification(options);
|
|
1351
|
+
};
|
|
1352
|
+
};
|
|
1353
|
+
const getSendVerificationMutationKey = () => [`https://api.workos.com/_widgets/UserProfile/send-verification`];
|
|
1354
|
+
const useSendVerification = (options) => {
|
|
1355
|
+
const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
|
|
1356
|
+
const swrKey = swrOptions?.swrKey ?? getSendVerificationMutationKey();
|
|
1357
|
+
const swrFn = getSendVerificationMutationFetcher(fetchOptions);
|
|
1358
|
+
const query = (0, import_mutation.default)(swrKey, swrFn, swrOptions);
|
|
1359
|
+
return {
|
|
1360
|
+
swrKey,
|
|
1361
|
+
...query
|
|
1362
|
+
};
|
|
1363
|
+
};
|
|
1364
|
+
const getSessionsUrl = () => {
|
|
1365
|
+
return `https://api.workos.com/_widgets/UserProfile/sessions`;
|
|
1366
|
+
};
|
|
1367
|
+
const sessions = async (options) => {
|
|
1368
|
+
const res = await fetch(getSessionsUrl(), {
|
|
1251
1369
|
...options,
|
|
1252
1370
|
method: "GET"
|
|
1253
1371
|
});
|
|
@@ -1255,12 +1373,12 @@ const settings = async (options) => {
|
|
|
1255
1373
|
const data = body ? JSON.parse(body) : {};
|
|
1256
1374
|
return { data, status: res.status, headers: res.headers };
|
|
1257
1375
|
};
|
|
1258
|
-
const
|
|
1259
|
-
const
|
|
1376
|
+
const getSessionsKey = () => [`https://api.workos.com/_widgets/UserProfile/sessions`];
|
|
1377
|
+
const useSessions = (options) => {
|
|
1260
1378
|
const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
|
|
1261
1379
|
const isEnabled = swrOptions?.enabled !== false;
|
|
1262
|
-
const swrKey = swrOptions?.swrKey ?? (() => isEnabled ?
|
|
1263
|
-
const swrFn = () =>
|
|
1380
|
+
const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getSessionsKey() : null);
|
|
1381
|
+
const swrFn = () => sessions(fetchOptions);
|
|
1264
1382
|
const query = (0, import_swr.default)(
|
|
1265
1383
|
swrKey,
|
|
1266
1384
|
swrFn,
|
|
@@ -1271,13 +1389,15 @@ const useSettings = (options) => {
|
|
|
1271
1389
|
...query
|
|
1272
1390
|
};
|
|
1273
1391
|
};
|
|
1274
|
-
const
|
|
1275
|
-
return `https://api.workos.com/_widgets/
|
|
1392
|
+
const getRevokeAllSessionsUrl = () => {
|
|
1393
|
+
return `https://api.workos.com/_widgets/UserProfile/sessions/revoke-all`;
|
|
1276
1394
|
};
|
|
1277
|
-
const
|
|
1278
|
-
const res = await fetch(
|
|
1395
|
+
const revokeAllSessions = async (revokeAllSessionsRequest, options) => {
|
|
1396
|
+
const res = await fetch(getRevokeAllSessionsUrl(), {
|
|
1279
1397
|
...options,
|
|
1280
|
-
method: "
|
|
1398
|
+
method: "DELETE",
|
|
1399
|
+
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
1400
|
+
body: JSON.stringify(revokeAllSessionsRequest)
|
|
1281
1401
|
});
|
|
1282
1402
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1283
1403
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -1287,38 +1407,29 @@ const listOrganizationDomains = async (options) => {
|
|
|
1287
1407
|
headers: res.headers
|
|
1288
1408
|
};
|
|
1289
1409
|
};
|
|
1290
|
-
const
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1410
|
+
const getRevokeAllSessionsMutationFetcher = (options) => {
|
|
1411
|
+
return (_, { arg }) => {
|
|
1412
|
+
return revokeAllSessions(arg, options);
|
|
1413
|
+
};
|
|
1414
|
+
};
|
|
1415
|
+
const getRevokeAllSessionsMutationKey = () => [`https://api.workos.com/_widgets/UserProfile/sessions/revoke-all`];
|
|
1416
|
+
const useRevokeAllSessions = (options) => {
|
|
1294
1417
|
const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
|
|
1295
|
-
const
|
|
1296
|
-
const
|
|
1297
|
-
const
|
|
1298
|
-
const query = (0, import_swr.default)(
|
|
1299
|
-
swrKey,
|
|
1300
|
-
swrFn,
|
|
1301
|
-
swrOptions
|
|
1302
|
-
);
|
|
1418
|
+
const swrKey = swrOptions?.swrKey ?? getRevokeAllSessionsMutationKey();
|
|
1419
|
+
const swrFn = getRevokeAllSessionsMutationFetcher(fetchOptions);
|
|
1420
|
+
const query = (0, import_mutation.default)(swrKey, swrFn, swrOptions);
|
|
1303
1421
|
return {
|
|
1304
1422
|
swrKey,
|
|
1305
1423
|
...query
|
|
1306
1424
|
};
|
|
1307
1425
|
};
|
|
1308
|
-
const
|
|
1309
|
-
|
|
1310
|
-
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1311
|
-
if (value !== void 0) {
|
|
1312
|
-
normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
1313
|
-
}
|
|
1314
|
-
});
|
|
1315
|
-
const stringifiedParams = normalizedParams.toString();
|
|
1316
|
-
return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/admin-portal/generate-link?${stringifiedParams}` : `https://api.workos.com/_widgets/admin-portal/generate-link`;
|
|
1426
|
+
const getRevokeSessionUrl = (sessionId) => {
|
|
1427
|
+
return `https://api.workos.com/_widgets/UserProfile/sessions/revoke/${sessionId}`;
|
|
1317
1428
|
};
|
|
1318
|
-
const
|
|
1319
|
-
const res = await fetch(
|
|
1429
|
+
const revokeSession = async (sessionId, options) => {
|
|
1430
|
+
const res = await fetch(getRevokeSessionUrl(sessionId), {
|
|
1320
1431
|
...options,
|
|
1321
|
-
method: "
|
|
1432
|
+
method: "DELETE"
|
|
1322
1433
|
});
|
|
1323
1434
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1324
1435
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -1328,30 +1439,29 @@ const generateAdminPortalLink = async (params, options) => {
|
|
|
1328
1439
|
headers: res.headers
|
|
1329
1440
|
};
|
|
1330
1441
|
};
|
|
1331
|
-
const
|
|
1442
|
+
const getRevokeSessionMutationFetcher = (sessionId, options) => {
|
|
1332
1443
|
return (_, __) => {
|
|
1333
|
-
return
|
|
1444
|
+
return revokeSession(sessionId, options);
|
|
1334
1445
|
};
|
|
1335
1446
|
};
|
|
1336
|
-
const
|
|
1337
|
-
`https://api.workos.com/_widgets/
|
|
1338
|
-
...params ? [params] : []
|
|
1447
|
+
const getRevokeSessionMutationKey = (sessionId) => [
|
|
1448
|
+
`https://api.workos.com/_widgets/UserProfile/sessions/revoke/${sessionId}`
|
|
1339
1449
|
];
|
|
1340
|
-
const
|
|
1450
|
+
const useRevokeSession = (sessionId, options) => {
|
|
1341
1451
|
const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
|
|
1342
|
-
const swrKey = swrOptions?.swrKey ??
|
|
1343
|
-
const swrFn =
|
|
1452
|
+
const swrKey = swrOptions?.swrKey ?? getRevokeSessionMutationKey(sessionId);
|
|
1453
|
+
const swrFn = getRevokeSessionMutationFetcher(sessionId, fetchOptions);
|
|
1344
1454
|
const query = (0, import_mutation.default)(swrKey, swrFn, swrOptions);
|
|
1345
1455
|
return {
|
|
1346
1456
|
swrKey,
|
|
1347
1457
|
...query
|
|
1348
1458
|
};
|
|
1349
1459
|
};
|
|
1350
|
-
const
|
|
1351
|
-
return `https://api.workos.com/_widgets/
|
|
1460
|
+
const getDeleteTotpFactorsUrl = () => {
|
|
1461
|
+
return `https://api.workos.com/_widgets/UserProfile/totp-factors`;
|
|
1352
1462
|
};
|
|
1353
|
-
const
|
|
1354
|
-
const res = await fetch(
|
|
1463
|
+
const deleteTotpFactors = async (options) => {
|
|
1464
|
+
const res = await fetch(getDeleteTotpFactorsUrl(), {
|
|
1355
1465
|
...options,
|
|
1356
1466
|
method: "DELETE"
|
|
1357
1467
|
});
|
|
@@ -1363,34 +1473,31 @@ const deleteOrganizationDomain = async (domainId, options) => {
|
|
|
1363
1473
|
headers: res.headers
|
|
1364
1474
|
};
|
|
1365
1475
|
};
|
|
1366
|
-
const
|
|
1476
|
+
const getDeleteTotpFactorsMutationFetcher = (options) => {
|
|
1367
1477
|
return (_, __) => {
|
|
1368
|
-
return
|
|
1478
|
+
return deleteTotpFactors(options);
|
|
1369
1479
|
};
|
|
1370
1480
|
};
|
|
1371
|
-
const
|
|
1372
|
-
|
|
1373
|
-
];
|
|
1374
|
-
const useDeleteOrganizationDomain = (domainId, options) => {
|
|
1481
|
+
const getDeleteTotpFactorsMutationKey = () => [`https://api.workos.com/_widgets/UserProfile/totp-factors`];
|
|
1482
|
+
const useDeleteTotpFactors = (options) => {
|
|
1375
1483
|
const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
|
|
1376
|
-
const swrKey = swrOptions?.swrKey ??
|
|
1377
|
-
const swrFn =
|
|
1378
|
-
domainId,
|
|
1379
|
-
fetchOptions
|
|
1380
|
-
);
|
|
1484
|
+
const swrKey = swrOptions?.swrKey ?? getDeleteTotpFactorsMutationKey();
|
|
1485
|
+
const swrFn = getDeleteTotpFactorsMutationFetcher(fetchOptions);
|
|
1381
1486
|
const query = (0, import_mutation.default)(swrKey, swrFn, swrOptions);
|
|
1382
1487
|
return {
|
|
1383
1488
|
swrKey,
|
|
1384
1489
|
...query
|
|
1385
1490
|
};
|
|
1386
1491
|
};
|
|
1387
|
-
const
|
|
1388
|
-
return `https://api.workos.com/_widgets/
|
|
1492
|
+
const getUpdatePasswordUrl = () => {
|
|
1493
|
+
return `https://api.workos.com/_widgets/UserProfile/update-password`;
|
|
1389
1494
|
};
|
|
1390
|
-
const
|
|
1391
|
-
const res = await fetch(
|
|
1495
|
+
const updatePassword = async (updatePasswordRequest, options) => {
|
|
1496
|
+
const res = await fetch(getUpdatePasswordUrl(), {
|
|
1392
1497
|
...options,
|
|
1393
|
-
method: "POST"
|
|
1498
|
+
method: "POST",
|
|
1499
|
+
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
1500
|
+
body: JSON.stringify(updatePasswordRequest)
|
|
1394
1501
|
});
|
|
1395
1502
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1396
1503
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -1400,68 +1507,61 @@ const reverifyOrganizationDomain = async (domainId, options) => {
|
|
|
1400
1507
|
headers: res.headers
|
|
1401
1508
|
};
|
|
1402
1509
|
};
|
|
1403
|
-
const
|
|
1404
|
-
return (_,
|
|
1405
|
-
return
|
|
1510
|
+
const getUpdatePasswordMutationFetcher = (options) => {
|
|
1511
|
+
return (_, { arg }) => {
|
|
1512
|
+
return updatePassword(arg, options);
|
|
1406
1513
|
};
|
|
1407
1514
|
};
|
|
1408
|
-
const
|
|
1409
|
-
|
|
1410
|
-
];
|
|
1411
|
-
const useReverifyOrganizationDomain = (domainId, options) => {
|
|
1515
|
+
const getUpdatePasswordMutationKey = () => [`https://api.workos.com/_widgets/UserProfile/update-password`];
|
|
1516
|
+
const useUpdatePassword = (options) => {
|
|
1412
1517
|
const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
|
|
1413
|
-
const swrKey = swrOptions?.swrKey ??
|
|
1414
|
-
const swrFn =
|
|
1415
|
-
domainId,
|
|
1416
|
-
fetchOptions
|
|
1417
|
-
);
|
|
1518
|
+
const swrKey = swrOptions?.swrKey ?? getUpdatePasswordMutationKey();
|
|
1519
|
+
const swrFn = getUpdatePasswordMutationFetcher(fetchOptions);
|
|
1418
1520
|
const query = (0, import_mutation.default)(swrKey, swrFn, swrOptions);
|
|
1419
1521
|
return {
|
|
1420
1522
|
swrKey,
|
|
1421
1523
|
...query
|
|
1422
1524
|
};
|
|
1423
1525
|
};
|
|
1424
|
-
const
|
|
1425
|
-
return `https://api.workos.com/_widgets/
|
|
1526
|
+
const getVerifyUrl = () => {
|
|
1527
|
+
return `https://api.workos.com/_widgets/UserProfile/verify`;
|
|
1426
1528
|
};
|
|
1427
|
-
const
|
|
1428
|
-
const res = await fetch(
|
|
1529
|
+
const verify = async (verifyRequest, options) => {
|
|
1530
|
+
const res = await fetch(getVerifyUrl(), {
|
|
1429
1531
|
...options,
|
|
1430
|
-
method: "
|
|
1532
|
+
method: "POST",
|
|
1533
|
+
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
1534
|
+
body: JSON.stringify(verifyRequest)
|
|
1431
1535
|
});
|
|
1432
1536
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1433
1537
|
const data = body ? JSON.parse(body) : {};
|
|
1434
|
-
return {
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1538
|
+
return { data, status: res.status, headers: res.headers };
|
|
1539
|
+
};
|
|
1540
|
+
const getVerifyMutationFetcher = (options) => {
|
|
1541
|
+
return (_, { arg }) => {
|
|
1542
|
+
return verify(arg, options);
|
|
1438
1543
|
};
|
|
1439
1544
|
};
|
|
1440
|
-
const
|
|
1441
|
-
const
|
|
1545
|
+
const getVerifyMutationKey = () => [`https://api.workos.com/_widgets/UserProfile/verify`];
|
|
1546
|
+
const useVerify = (options) => {
|
|
1442
1547
|
const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
|
|
1443
|
-
const
|
|
1444
|
-
const
|
|
1445
|
-
const
|
|
1446
|
-
const query = (0, import_swr.default)(
|
|
1447
|
-
swrKey,
|
|
1448
|
-
swrFn,
|
|
1449
|
-
swrOptions
|
|
1450
|
-
);
|
|
1548
|
+
const swrKey = swrOptions?.swrKey ?? getVerifyMutationKey();
|
|
1549
|
+
const swrFn = getVerifyMutationFetcher(fetchOptions);
|
|
1550
|
+
const query = (0, import_mutation.default)(swrKey, swrFn, swrOptions);
|
|
1451
1551
|
return {
|
|
1452
1552
|
swrKey,
|
|
1453
1553
|
...query
|
|
1454
1554
|
};
|
|
1455
1555
|
};
|
|
1456
|
-
const
|
|
1457
|
-
return `https://api.workos.com/_widgets/
|
|
1556
|
+
const getVerifyTotpFactorUrl = () => {
|
|
1557
|
+
return `https://api.workos.com/_widgets/UserProfile/verify-totp-factor`;
|
|
1458
1558
|
};
|
|
1459
|
-
const
|
|
1460
|
-
const res = await fetch(
|
|
1559
|
+
const verifyTotpFactor = async (verifyTotpFactorRequest, options) => {
|
|
1560
|
+
const res = await fetch(getVerifyTotpFactorUrl(), {
|
|
1461
1561
|
...options,
|
|
1462
1562
|
method: "POST",
|
|
1463
1563
|
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
1464
|
-
body: JSON.stringify(
|
|
1564
|
+
body: JSON.stringify(verifyTotpFactorRequest)
|
|
1465
1565
|
});
|
|
1466
1566
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1467
1567
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -1471,23 +1571,23 @@ const createOrganizationApiKey = async (createOrganizationApiKeyRequest, options
|
|
|
1471
1571
|
headers: res.headers
|
|
1472
1572
|
};
|
|
1473
1573
|
};
|
|
1474
|
-
const
|
|
1574
|
+
const getVerifyTotpFactorMutationFetcher = (options) => {
|
|
1475
1575
|
return (_, { arg }) => {
|
|
1476
|
-
return
|
|
1576
|
+
return verifyTotpFactor(arg, options);
|
|
1477
1577
|
};
|
|
1478
1578
|
};
|
|
1479
|
-
const
|
|
1480
|
-
const
|
|
1579
|
+
const getVerifyTotpFactorMutationKey = () => [`https://api.workos.com/_widgets/UserProfile/verify-totp-factor`];
|
|
1580
|
+
const useVerifyTotpFactor = (options) => {
|
|
1481
1581
|
const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
|
|
1482
|
-
const swrKey = swrOptions?.swrKey ??
|
|
1483
|
-
const swrFn =
|
|
1582
|
+
const swrKey = swrOptions?.swrKey ?? getVerifyTotpFactorMutationKey();
|
|
1583
|
+
const swrFn = getVerifyTotpFactorMutationFetcher(fetchOptions);
|
|
1484
1584
|
const query = (0, import_mutation.default)(swrKey, swrFn, swrOptions);
|
|
1485
1585
|
return {
|
|
1486
1586
|
swrKey,
|
|
1487
1587
|
...query
|
|
1488
1588
|
};
|
|
1489
1589
|
};
|
|
1490
|
-
const
|
|
1590
|
+
const getGenerateAdminPortalLinkUrl = (params) => {
|
|
1491
1591
|
const normalizedParams = new URLSearchParams();
|
|
1492
1592
|
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1493
1593
|
if (value !== void 0) {
|
|
@@ -1495,12 +1595,12 @@ const getListOrganizationApiKeysUrl = (params) => {
|
|
|
1495
1595
|
}
|
|
1496
1596
|
});
|
|
1497
1597
|
const stringifiedParams = normalizedParams.toString();
|
|
1498
|
-
return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/
|
|
1598
|
+
return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/admin-portal/generate-link?${stringifiedParams}` : `https://api.workos.com/_widgets/admin-portal/generate-link`;
|
|
1499
1599
|
};
|
|
1500
|
-
const
|
|
1501
|
-
const res = await fetch(
|
|
1600
|
+
const generateAdminPortalLink = async (params, options) => {
|
|
1601
|
+
const res = await fetch(getGenerateAdminPortalLinkUrl(params), {
|
|
1502
1602
|
...options,
|
|
1503
|
-
method: "
|
|
1603
|
+
method: "POST"
|
|
1504
1604
|
});
|
|
1505
1605
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1506
1606
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -1510,37 +1610,30 @@ const listOrganizationApiKeys = async (params, options) => {
|
|
|
1510
1610
|
headers: res.headers
|
|
1511
1611
|
};
|
|
1512
1612
|
};
|
|
1513
|
-
const
|
|
1514
|
-
|
|
1613
|
+
const getGenerateAdminPortalLinkMutationFetcher = (params, options) => {
|
|
1614
|
+
return (_, __) => {
|
|
1615
|
+
return generateAdminPortalLink(params, options);
|
|
1616
|
+
};
|
|
1617
|
+
};
|
|
1618
|
+
const getGenerateAdminPortalLinkMutationKey = (params) => [
|
|
1619
|
+
`https://api.workos.com/_widgets/admin-portal/generate-link`,
|
|
1515
1620
|
...params ? [params] : []
|
|
1516
1621
|
];
|
|
1517
|
-
const
|
|
1622
|
+
const useGenerateAdminPortalLink = (params, options) => {
|
|
1518
1623
|
const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
|
|
1519
|
-
const
|
|
1520
|
-
const
|
|
1521
|
-
const
|
|
1522
|
-
const query = (0, import_swr.default)(
|
|
1523
|
-
swrKey,
|
|
1524
|
-
swrFn,
|
|
1525
|
-
swrOptions
|
|
1526
|
-
);
|
|
1624
|
+
const swrKey = swrOptions?.swrKey ?? getGenerateAdminPortalLinkMutationKey(params);
|
|
1625
|
+
const swrFn = getGenerateAdminPortalLinkMutationFetcher(params, fetchOptions);
|
|
1626
|
+
const query = (0, import_mutation.default)(swrKey, swrFn, swrOptions);
|
|
1527
1627
|
return {
|
|
1528
1628
|
swrKey,
|
|
1529
1629
|
...query
|
|
1530
1630
|
};
|
|
1531
1631
|
};
|
|
1532
|
-
const
|
|
1533
|
-
|
|
1534
|
-
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1535
|
-
if (value !== void 0) {
|
|
1536
|
-
normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
1537
|
-
}
|
|
1538
|
-
});
|
|
1539
|
-
const stringifiedParams = normalizedParams.toString();
|
|
1540
|
-
return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/ApiKeys/permissions?${stringifiedParams}` : `https://api.workos.com/_widgets/ApiKeys/permissions`;
|
|
1632
|
+
const getListOrganizationDomainsUrl = () => {
|
|
1633
|
+
return `https://api.workos.com/_widgets/admin-portal/organization-domains`;
|
|
1541
1634
|
};
|
|
1542
|
-
const
|
|
1543
|
-
const res = await fetch(
|
|
1635
|
+
const listOrganizationDomains = async (options) => {
|
|
1636
|
+
const res = await fetch(getListOrganizationDomainsUrl(), {
|
|
1544
1637
|
...options,
|
|
1545
1638
|
method: "GET"
|
|
1546
1639
|
});
|
|
@@ -1552,15 +1645,14 @@ const listOrganizationApiKeyPermissions = async (params, options) => {
|
|
|
1552
1645
|
headers: res.headers
|
|
1553
1646
|
};
|
|
1554
1647
|
};
|
|
1555
|
-
const
|
|
1556
|
-
`https://api.workos.com/_widgets/
|
|
1557
|
-
...params ? [params] : []
|
|
1648
|
+
const getListOrganizationDomainsKey = () => [
|
|
1649
|
+
`https://api.workos.com/_widgets/admin-portal/organization-domains`
|
|
1558
1650
|
];
|
|
1559
|
-
const
|
|
1651
|
+
const useListOrganizationDomains = (options) => {
|
|
1560
1652
|
const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
|
|
1561
1653
|
const isEnabled = swrOptions?.enabled !== false;
|
|
1562
|
-
const swrKey = swrOptions?.swrKey ?? (() => isEnabled ?
|
|
1563
|
-
const swrFn = () =>
|
|
1654
|
+
const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getListOrganizationDomainsKey() : null);
|
|
1655
|
+
const swrFn = () => listOrganizationDomains(fetchOptions);
|
|
1564
1656
|
const query = (0, import_swr.default)(
|
|
1565
1657
|
swrKey,
|
|
1566
1658
|
swrFn,
|
|
@@ -1571,11 +1663,11 @@ const useListOrganizationApiKeyPermissions = (params, options) => {
|
|
|
1571
1663
|
...query
|
|
1572
1664
|
};
|
|
1573
1665
|
};
|
|
1574
|
-
const
|
|
1575
|
-
return `https://api.workos.com/_widgets/
|
|
1666
|
+
const getDeleteOrganizationDomainUrl = (domainId) => {
|
|
1667
|
+
return `https://api.workos.com/_widgets/admin-portal/organization-domains/${domainId}`;
|
|
1576
1668
|
};
|
|
1577
|
-
const
|
|
1578
|
-
const res = await fetch(
|
|
1669
|
+
const deleteOrganizationDomain = async (domainId, options) => {
|
|
1670
|
+
const res = await fetch(getDeleteOrganizationDomainUrl(domainId), {
|
|
1579
1671
|
...options,
|
|
1580
1672
|
method: "DELETE"
|
|
1581
1673
|
});
|
|
@@ -1587,17 +1679,19 @@ const deleteOrganizationApiKey = async (apiKeyId, options) => {
|
|
|
1587
1679
|
headers: res.headers
|
|
1588
1680
|
};
|
|
1589
1681
|
};
|
|
1590
|
-
const
|
|
1682
|
+
const getDeleteOrganizationDomainMutationFetcher = (domainId, options) => {
|
|
1591
1683
|
return (_, __) => {
|
|
1592
|
-
return
|
|
1684
|
+
return deleteOrganizationDomain(domainId, options);
|
|
1593
1685
|
};
|
|
1594
1686
|
};
|
|
1595
|
-
const
|
|
1596
|
-
|
|
1687
|
+
const getDeleteOrganizationDomainMutationKey = (domainId) => [
|
|
1688
|
+
`https://api.workos.com/_widgets/admin-portal/organization-domains/${domainId}`
|
|
1689
|
+
];
|
|
1690
|
+
const useDeleteOrganizationDomain = (domainId, options) => {
|
|
1597
1691
|
const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
|
|
1598
|
-
const swrKey = swrOptions?.swrKey ??
|
|
1599
|
-
const swrFn =
|
|
1600
|
-
|
|
1692
|
+
const swrKey = swrOptions?.swrKey ?? getDeleteOrganizationDomainMutationKey(domainId);
|
|
1693
|
+
const swrFn = getDeleteOrganizationDomainMutationFetcher(
|
|
1694
|
+
domainId,
|
|
1601
1695
|
fetchOptions
|
|
1602
1696
|
);
|
|
1603
1697
|
const query = (0, import_mutation.default)(swrKey, swrFn, swrOptions);
|
|
@@ -1606,13 +1700,13 @@ const useDeleteOrganizationApiKey = (apiKeyId, options) => {
|
|
|
1606
1700
|
...query
|
|
1607
1701
|
};
|
|
1608
1702
|
};
|
|
1609
|
-
const
|
|
1610
|
-
return `https://api.workos.com/_widgets/
|
|
1703
|
+
const getReverifyOrganizationDomainUrl = (domainId) => {
|
|
1704
|
+
return `https://api.workos.com/_widgets/admin-portal/organization-domains/${domainId}/reverify`;
|
|
1611
1705
|
};
|
|
1612
|
-
const
|
|
1613
|
-
const res = await fetch(
|
|
1706
|
+
const reverifyOrganizationDomain = async (domainId, options) => {
|
|
1707
|
+
const res = await fetch(getReverifyOrganizationDomainUrl(domainId), {
|
|
1614
1708
|
...options,
|
|
1615
|
-
method: "
|
|
1709
|
+
method: "POST"
|
|
1616
1710
|
});
|
|
1617
1711
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1618
1712
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -1622,34 +1716,32 @@ const myDataIntegrations = async (options) => {
|
|
|
1622
1716
|
headers: res.headers
|
|
1623
1717
|
};
|
|
1624
1718
|
};
|
|
1625
|
-
const
|
|
1626
|
-
|
|
1719
|
+
const getReverifyOrganizationDomainMutationFetcher = (domainId, options) => {
|
|
1720
|
+
return (_, __) => {
|
|
1721
|
+
return reverifyOrganizationDomain(domainId, options);
|
|
1722
|
+
};
|
|
1723
|
+
};
|
|
1724
|
+
const getReverifyOrganizationDomainMutationKey = (domainId) => [
|
|
1725
|
+
`https://api.workos.com/_widgets/admin-portal/organization-domains/${domainId}/reverify`
|
|
1726
|
+
];
|
|
1727
|
+
const useReverifyOrganizationDomain = (domainId, options) => {
|
|
1627
1728
|
const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
|
|
1628
|
-
const
|
|
1629
|
-
const
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
swrKey,
|
|
1633
|
-
swrFn,
|
|
1634
|
-
swrOptions
|
|
1729
|
+
const swrKey = swrOptions?.swrKey ?? getReverifyOrganizationDomainMutationKey(domainId);
|
|
1730
|
+
const swrFn = getReverifyOrganizationDomainMutationFetcher(
|
|
1731
|
+
domainId,
|
|
1732
|
+
fetchOptions
|
|
1635
1733
|
);
|
|
1734
|
+
const query = (0, import_mutation.default)(swrKey, swrFn, swrOptions);
|
|
1636
1735
|
return {
|
|
1637
1736
|
swrKey,
|
|
1638
1737
|
...query
|
|
1639
1738
|
};
|
|
1640
1739
|
};
|
|
1641
|
-
const
|
|
1642
|
-
|
|
1643
|
-
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1644
|
-
if (value !== void 0) {
|
|
1645
|
-
normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
1646
|
-
}
|
|
1647
|
-
});
|
|
1648
|
-
const stringifiedParams = normalizedParams.toString();
|
|
1649
|
-
return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/DataIntegrations/${slug}/authorize?${stringifiedParams}` : `https://api.workos.com/_widgets/DataIntegrations/${slug}/authorize`;
|
|
1740
|
+
const getListSsoConnectionsUrl = () => {
|
|
1741
|
+
return `https://api.workos.com/_widgets/admin-portal/sso-connections`;
|
|
1650
1742
|
};
|
|
1651
|
-
const
|
|
1652
|
-
const res = await fetch(
|
|
1743
|
+
const listSsoConnections = async (options) => {
|
|
1744
|
+
const res = await fetch(getListSsoConnectionsUrl(), {
|
|
1653
1745
|
...options,
|
|
1654
1746
|
method: "GET"
|
|
1655
1747
|
});
|
|
@@ -1661,15 +1753,12 @@ const getDataIntegrationAuthorizeUrl = async (slug, params, options) => {
|
|
|
1661
1753
|
headers: res.headers
|
|
1662
1754
|
};
|
|
1663
1755
|
};
|
|
1664
|
-
const
|
|
1665
|
-
|
|
1666
|
-
...params ? [params] : []
|
|
1667
|
-
];
|
|
1668
|
-
const useGetDataIntegrationAuthorizeUrl = (slug, params, options) => {
|
|
1756
|
+
const getListSsoConnectionsKey = () => [`https://api.workos.com/_widgets/admin-portal/sso-connections`];
|
|
1757
|
+
const useListSsoConnections = (options) => {
|
|
1669
1758
|
const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
|
|
1670
|
-
const isEnabled = swrOptions?.enabled !== false
|
|
1671
|
-
const swrKey = swrOptions?.swrKey ?? (() => isEnabled ?
|
|
1672
|
-
const swrFn = () =>
|
|
1759
|
+
const isEnabled = swrOptions?.enabled !== false;
|
|
1760
|
+
const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getListSsoConnectionsKey() : null);
|
|
1761
|
+
const swrFn = () => listSsoConnections(fetchOptions);
|
|
1673
1762
|
const query = (0, import_swr.default)(
|
|
1674
1763
|
swrKey,
|
|
1675
1764
|
swrFn,
|
|
@@ -1680,17 +1769,14 @@ const useGetDataIntegrationAuthorizeUrl = (slug, params, options) => {
|
|
|
1680
1769
|
...query
|
|
1681
1770
|
};
|
|
1682
1771
|
};
|
|
1683
|
-
const
|
|
1684
|
-
return `https://api.workos.com/_widgets/
|
|
1772
|
+
const getListDirectoriesUrl = () => {
|
|
1773
|
+
return `https://api.workos.com/_widgets/directory-sync/directories`;
|
|
1685
1774
|
};
|
|
1686
|
-
const
|
|
1687
|
-
const res = await fetch(
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
method: "GET"
|
|
1692
|
-
}
|
|
1693
|
-
);
|
|
1775
|
+
const listDirectories = async (options) => {
|
|
1776
|
+
const res = await fetch(getListDirectoriesUrl(), {
|
|
1777
|
+
...options,
|
|
1778
|
+
method: "GET"
|
|
1779
|
+
});
|
|
1694
1780
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1695
1781
|
const data = body ? JSON.parse(body) : {};
|
|
1696
1782
|
return {
|
|
@@ -1699,18 +1785,12 @@ const getDataInstallationAuthorizationStatus = async (dataIntegrationId, state,
|
|
|
1699
1785
|
headers: res.headers
|
|
1700
1786
|
};
|
|
1701
1787
|
};
|
|
1702
|
-
const
|
|
1703
|
-
|
|
1704
|
-
];
|
|
1705
|
-
const useGetDataInstallationAuthorizationStatus = (dataIntegrationId, state, options) => {
|
|
1788
|
+
const getListDirectoriesKey = () => [`https://api.workos.com/_widgets/directory-sync/directories`];
|
|
1789
|
+
const useListDirectories = (options) => {
|
|
1706
1790
|
const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
|
|
1707
|
-
const isEnabled = swrOptions?.enabled !== false
|
|
1708
|
-
const swrKey = swrOptions?.swrKey ?? (() => isEnabled ?
|
|
1709
|
-
const swrFn = () =>
|
|
1710
|
-
dataIntegrationId,
|
|
1711
|
-
state,
|
|
1712
|
-
fetchOptions
|
|
1713
|
-
);
|
|
1791
|
+
const isEnabled = swrOptions?.enabled !== false;
|
|
1792
|
+
const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getListDirectoriesKey() : null);
|
|
1793
|
+
const swrFn = () => listDirectories(fetchOptions);
|
|
1714
1794
|
const query = (0, import_swr.default)(
|
|
1715
1795
|
swrKey,
|
|
1716
1796
|
swrFn,
|
|
@@ -1721,38 +1801,29 @@ const useGetDataInstallationAuthorizationStatus = (dataIntegrationId, state, opt
|
|
|
1721
1801
|
...query
|
|
1722
1802
|
};
|
|
1723
1803
|
};
|
|
1724
|
-
const
|
|
1725
|
-
return `https://api.workos.com/_widgets/
|
|
1804
|
+
const getSettingsUrl = () => {
|
|
1805
|
+
return `https://api.workos.com/_widgets/settings`;
|
|
1726
1806
|
};
|
|
1727
|
-
const
|
|
1728
|
-
const res = await fetch(
|
|
1807
|
+
const settings = async (options) => {
|
|
1808
|
+
const res = await fetch(getSettingsUrl(), {
|
|
1729
1809
|
...options,
|
|
1730
|
-
method: "
|
|
1810
|
+
method: "GET"
|
|
1731
1811
|
});
|
|
1732
1812
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1733
1813
|
const data = body ? JSON.parse(body) : {};
|
|
1734
|
-
return {
|
|
1735
|
-
data,
|
|
1736
|
-
status: res.status,
|
|
1737
|
-
headers: res.headers
|
|
1738
|
-
};
|
|
1739
|
-
};
|
|
1740
|
-
const getDeleteDataInstallationMutationFetcher = (installationId, options) => {
|
|
1741
|
-
return (_, __) => {
|
|
1742
|
-
return deleteDataInstallation(installationId, options);
|
|
1743
|
-
};
|
|
1814
|
+
return { data, status: res.status, headers: res.headers };
|
|
1744
1815
|
};
|
|
1745
|
-
const
|
|
1746
|
-
|
|
1747
|
-
];
|
|
1748
|
-
const useDeleteDataInstallation = (installationId, options) => {
|
|
1816
|
+
const getSettingsKey = () => [`https://api.workos.com/_widgets/settings`];
|
|
1817
|
+
const useSettings = (options) => {
|
|
1749
1818
|
const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
|
|
1750
|
-
const
|
|
1751
|
-
const
|
|
1752
|
-
|
|
1753
|
-
|
|
1819
|
+
const isEnabled = swrOptions?.enabled !== false;
|
|
1820
|
+
const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getSettingsKey() : null);
|
|
1821
|
+
const swrFn = () => settings(fetchOptions);
|
|
1822
|
+
const query = (0, import_swr.default)(
|
|
1823
|
+
swrKey,
|
|
1824
|
+
swrFn,
|
|
1825
|
+
swrOptions
|
|
1754
1826
|
);
|
|
1755
|
-
const query = (0, import_mutation.default)(swrKey, swrFn, swrOptions);
|
|
1756
1827
|
return {
|
|
1757
1828
|
swrKey,
|
|
1758
1829
|
...query
|
|
@@ -1760,18 +1831,20 @@ const useDeleteDataInstallation = (installationId, options) => {
|
|
|
1760
1831
|
};
|
|
1761
1832
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1762
1833
|
0 && (module.exports = {
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1834
|
+
AuthenticationInformationResponseDataVerificationMethodsMfaOneOfProvider,
|
|
1835
|
+
AuthenticationInformationResponseDataVerificationMethodsPasskeyOneOfProvider,
|
|
1836
|
+
AuthenticationInformationResponseDataVerificationMethodsPasswordOneOfProvider,
|
|
1766
1837
|
CreateTotpFactorResponseAuthenticationChallengeAllOfObject,
|
|
1767
1838
|
CreateTotpFactorResponseAuthenticationFactorAllOfObject,
|
|
1768
1839
|
CreateTotpFactorResponseAuthenticationFactorAllOfType,
|
|
1769
|
-
|
|
1770
|
-
|
|
1840
|
+
DataInstallationAllOfObject,
|
|
1841
|
+
DataInstallationAllOfState,
|
|
1771
1842
|
DataIntegrationCredentialsType,
|
|
1772
1843
|
DataIntegrationIntegrationType,
|
|
1773
1844
|
DataIntegrationObject,
|
|
1774
1845
|
DataIntegrationOwnership,
|
|
1846
|
+
DirectoryState,
|
|
1847
|
+
DirectoryType,
|
|
1775
1848
|
DomainVerificationNameServer,
|
|
1776
1849
|
GenerateAdminPortalLinkIntent,
|
|
1777
1850
|
MemberActionsItem,
|
|
@@ -1836,6 +1909,8 @@ const useDeleteDataInstallation = (installationId, options) => {
|
|
|
1836
1909
|
getInviteMemberMutationFetcher,
|
|
1837
1910
|
getInviteMemberMutationKey,
|
|
1838
1911
|
getInviteMemberUrl,
|
|
1912
|
+
getListDirectoriesKey,
|
|
1913
|
+
getListDirectoriesUrl,
|
|
1839
1914
|
getListOrganizationApiKeyPermissionsKey,
|
|
1840
1915
|
getListOrganizationApiKeyPermissionsUrl,
|
|
1841
1916
|
getListOrganizationApiKeysKey,
|
|
@@ -1903,6 +1978,7 @@ const useDeleteDataInstallation = (installationId, options) => {
|
|
|
1903
1978
|
getVerifyTotpFactorUrl,
|
|
1904
1979
|
getVerifyUrl,
|
|
1905
1980
|
inviteMember,
|
|
1981
|
+
listDirectories,
|
|
1906
1982
|
listOrganizationApiKeyPermissions,
|
|
1907
1983
|
listOrganizationApiKeys,
|
|
1908
1984
|
listOrganizationDomains,
|
|
@@ -1939,6 +2015,7 @@ const useDeleteDataInstallation = (installationId, options) => {
|
|
|
1939
2015
|
useGetDataInstallationAuthorizationStatus,
|
|
1940
2016
|
useGetDataIntegrationAuthorizeUrl,
|
|
1941
2017
|
useInviteMember,
|
|
2018
|
+
useListDirectories,
|
|
1942
2019
|
useListOrganizationApiKeyPermissions,
|
|
1943
2020
|
useListOrganizationApiKeys,
|
|
1944
2021
|
useListOrganizationDomains,
|