@workos-inc/widgets 1.8.2 → 1.9.1

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.
Files changed (113) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/cjs/admin-portal-domain-verification.client.cjs.map +1 -1
  3. package/dist/cjs/admin-portal-sso-connection.client.cjs +4 -7
  4. package/dist/cjs/admin-portal-sso-connection.client.cjs.map +1 -1
  5. package/dist/cjs/api/api-provider.cjs.map +1 -1
  6. package/dist/cjs/api/api-provider.d.cts +1 -1
  7. package/dist/cjs/api/endpoint.cjs +741 -771
  8. package/dist/cjs/api/endpoint.cjs.map +1 -1
  9. package/dist/cjs/api/endpoint.d.cts +860 -813
  10. package/dist/cjs/directory-sync.client.cjs +156 -0
  11. package/dist/cjs/directory-sync.client.cjs.map +1 -0
  12. package/dist/cjs/directory-sync.client.d.cts +26 -0
  13. package/dist/cjs/experimental/api/fetch.cjs +327 -411
  14. package/dist/cjs/experimental/api/fetch.cjs.map +1 -1
  15. package/dist/cjs/experimental/api/fetch.d.cts +832 -798
  16. package/dist/cjs/experimental/api/react-query.cjs +747 -777
  17. package/dist/cjs/experimental/api/react-query.cjs.map +1 -1
  18. package/dist/cjs/experimental/api/react-query.d.cts +1378 -1263
  19. package/dist/cjs/experimental/api/swr.cjs +720 -742
  20. package/dist/cjs/experimental/api/swr.cjs.map +1 -1
  21. package/dist/cjs/experimental/api/swr.d.cts +1218 -1175
  22. package/dist/cjs/index.cjs +5 -0
  23. package/dist/cjs/index.cjs.map +1 -1
  24. package/dist/cjs/index.d.cts +2 -0
  25. package/dist/cjs/lib/add-mfa-dialog.cjs +18 -16
  26. package/dist/cjs/lib/add-mfa-dialog.cjs.map +1 -1
  27. package/dist/cjs/lib/admin-portal-sso-connection.cjs +0 -8
  28. package/dist/cjs/lib/admin-portal-sso-connection.cjs.map +1 -1
  29. package/dist/cjs/lib/admin-portal-sso-connection.d.cts +1 -2
  30. package/dist/cjs/lib/api-keys/api-keys-context.cjs +1 -1
  31. package/dist/cjs/lib/api-keys/api-keys-context.cjs.map +1 -1
  32. package/dist/cjs/lib/api-keys/api-keys-table.cjs +7 -5
  33. package/dist/cjs/lib/api-keys/api-keys-table.cjs.map +1 -1
  34. package/dist/cjs/lib/directory-sync.cjs +288 -0
  35. package/dist/cjs/lib/directory-sync.cjs.map +1 -0
  36. package/dist/cjs/lib/directory-sync.d.cts +72 -0
  37. package/dist/cjs/lib/identity-providers.cjs +57 -1
  38. package/dist/cjs/lib/identity-providers.cjs.map +1 -1
  39. package/dist/cjs/lib/identity-providers.d.cts +5 -3
  40. package/dist/cjs/lib/pipes.cjs +9 -9
  41. package/dist/cjs/lib/pipes.cjs.map +1 -1
  42. package/dist/cjs/lib/provider-icon.cjs.map +1 -1
  43. package/dist/cjs/lib/provider-icon.d.cts +2 -2
  44. package/dist/cjs/lib/reset-mfa-dialog.cjs +2 -1
  45. package/dist/cjs/lib/reset-mfa-dialog.cjs.map +1 -1
  46. package/dist/cjs/lib/use-permissions.cjs.map +1 -1
  47. package/dist/cjs/lib/use-permissions.d.cts +1 -1
  48. package/dist/cjs/lib/users-management-context.cjs +1 -1
  49. package/dist/cjs/lib/users-management-context.cjs.map +1 -1
  50. package/dist/cjs/lib/users-management.cjs +3 -3
  51. package/dist/cjs/lib/users-management.cjs.map +1 -1
  52. package/dist/cjs/lib/utils.cjs +9 -0
  53. package/dist/cjs/lib/utils.cjs.map +1 -1
  54. package/dist/cjs/lib/utils.d.cts +16 -2
  55. package/dist/cjs/workos-widgets.client.cjs +13 -1
  56. package/dist/cjs/workos-widgets.client.cjs.map +1 -1
  57. package/dist/esm/admin-portal-domain-verification.client.js +2 -2
  58. package/dist/esm/admin-portal-domain-verification.client.js.map +1 -1
  59. package/dist/esm/admin-portal-sso-connection.client.js +6 -9
  60. package/dist/esm/admin-portal-sso-connection.client.js.map +1 -1
  61. package/dist/esm/api/api-provider.d.ts +1 -1
  62. package/dist/esm/api/api-provider.js.map +1 -1
  63. package/dist/esm/api/endpoint.d.ts +860 -813
  64. package/dist/esm/api/endpoint.js +727 -751
  65. package/dist/esm/api/endpoint.js.map +1 -1
  66. package/dist/esm/directory-sync.client.d.ts +26 -0
  67. package/dist/esm/directory-sync.client.js +134 -0
  68. package/dist/esm/directory-sync.client.js.map +1 -0
  69. package/dist/esm/experimental/api/fetch.d.ts +832 -798
  70. package/dist/esm/experimental/api/fetch.js +319 -391
  71. package/dist/esm/experimental/api/fetch.js.map +1 -1
  72. package/dist/esm/experimental/api/react-query.d.ts +1378 -1263
  73. package/dist/esm/experimental/api/react-query.js +730 -757
  74. package/dist/esm/experimental/api/react-query.js.map +1 -1
  75. package/dist/esm/experimental/api/swr.d.ts +1218 -1175
  76. package/dist/esm/experimental/api/swr.js +706 -722
  77. package/dist/esm/experimental/api/swr.js.map +1 -1
  78. package/dist/esm/index.d.ts +2 -0
  79. package/dist/esm/index.js +6 -0
  80. package/dist/esm/index.js.map +1 -1
  81. package/dist/esm/lib/add-mfa-dialog.js +18 -16
  82. package/dist/esm/lib/add-mfa-dialog.js.map +1 -1
  83. package/dist/esm/lib/admin-portal-sso-connection.d.ts +1 -2
  84. package/dist/esm/lib/admin-portal-sso-connection.js +0 -8
  85. package/dist/esm/lib/admin-portal-sso-connection.js.map +1 -1
  86. package/dist/esm/lib/api-keys/api-keys-context.js +1 -1
  87. package/dist/esm/lib/api-keys/api-keys-context.js.map +1 -1
  88. package/dist/esm/lib/api-keys/api-keys-table.js +7 -5
  89. package/dist/esm/lib/api-keys/api-keys-table.js.map +1 -1
  90. package/dist/esm/lib/directory-sync.d.ts +72 -0
  91. package/dist/esm/lib/directory-sync.js +259 -0
  92. package/dist/esm/lib/directory-sync.js.map +1 -0
  93. package/dist/esm/lib/identity-providers.d.ts +5 -3
  94. package/dist/esm/lib/identity-providers.js +55 -1
  95. package/dist/esm/lib/identity-providers.js.map +1 -1
  96. package/dist/esm/lib/pipes.js +9 -10
  97. package/dist/esm/lib/pipes.js.map +1 -1
  98. package/dist/esm/lib/provider-icon.d.ts +2 -2
  99. package/dist/esm/lib/provider-icon.js.map +1 -1
  100. package/dist/esm/lib/reset-mfa-dialog.js +2 -1
  101. package/dist/esm/lib/reset-mfa-dialog.js.map +1 -1
  102. package/dist/esm/lib/use-permissions.d.ts +1 -1
  103. package/dist/esm/lib/use-permissions.js.map +1 -1
  104. package/dist/esm/lib/users-management-context.js +1 -1
  105. package/dist/esm/lib/users-management-context.js.map +1 -1
  106. package/dist/esm/lib/users-management.js +5 -4
  107. package/dist/esm/lib/users-management.js.map +1 -1
  108. package/dist/esm/lib/utils.d.ts +16 -2
  109. package/dist/esm/lib/utils.js +8 -0
  110. package/dist/esm/lib/utils.js.map +1 -1
  111. package/dist/esm/workos-widgets.client.js +13 -1
  112. package/dist/esm/workos-widgets.client.js.map +1 -1
  113. package/package.json +2 -2
@@ -13,33 +13,6 @@ const MemberActionsItem = {
13
13
  "revoke-invite": "revoke-invite",
14
14
  "revoke-membership": "revoke-membership"
15
15
  };
16
- const CreateTotpFactorResponseAuthenticationFactorAllOfObject = {
17
- authentication_factor: "authentication_factor"
18
- };
19
- const CreateTotpFactorResponseAuthenticationFactorAllOfType = {
20
- generic_otp: "generic_otp",
21
- sms: "sms",
22
- totp: "totp",
23
- webauthn: "webauthn"
24
- };
25
- const CreateTotpFactorResponseAuthenticationChallengeAllOfObject = {
26
- authentication_challenge: "authentication_challenge"
27
- };
28
- const AuthenticationInformationResponseDataVerificationMethodsMfaProvider = {
29
- MFA: "MFA"
30
- };
31
- const AuthenticationInformationResponseDataVerificationMethodsPasswordProvider = {
32
- Password: "Password"
33
- };
34
- const AuthenticationInformationResponseDataVerificationMethodsPasskeyProvider = {
35
- Passkey: "Passkey"
36
- };
37
- const SendVerificationResponseType = {
38
- EmailVerification: "EmailVerification"
39
- };
40
- const SettingsResponseObject = {
41
- settings: "settings"
42
- };
43
16
  const OrganizationDomainState = {
44
17
  Failed: "Failed",
45
18
  LegacyVerified: "LegacyVerified",
@@ -72,181 +45,110 @@ const SsoConnectionSessionJSONState = {
72
45
  ...SamlSessionState,
73
46
  ...OidcSessionState
74
47
  };
75
- const SsoConnectionAnyOfType = {
76
- AdfsSaml: "AdfsSaml",
77
- Auth0Saml: "Auth0Saml",
78
- AzureSaml: "AzureSaml",
79
- CasSaml: "CasSaml",
80
- ClassLinkSaml: "ClassLinkSaml",
81
- CloudflareSaml: "CloudflareSaml",
82
- CyberArkSaml: "CyberArkSaml",
83
- DuoSaml: "DuoSaml",
84
- GenericSaml: "GenericSaml",
85
- GoogleSaml: "GoogleSaml",
86
- JumpCloudSaml: "JumpCloudSaml",
87
- KeycloakSaml: "KeycloakSaml",
88
- LastPassSaml: "LastPassSaml",
89
- MiniOrangeSaml: "MiniOrangeSaml",
90
- NetIqSaml: "NetIqSaml",
91
- OktaSaml: "OktaSaml",
92
- OneLoginSaml: "OneLoginSaml",
93
- OracleSaml: "OracleSaml",
94
- PingFederateSaml: "PingFederateSaml",
95
- PingOneSaml: "PingOneSaml",
96
- RipplingSaml: "RipplingSaml",
97
- SalesforceSaml: "SalesforceSaml",
98
- ShibbolethGenericSaml: "ShibbolethGenericSaml",
99
- ShibbolethSaml: "ShibbolethSaml",
100
- SimpleSamlPhpSaml: "SimpleSamlPhpSaml",
101
- TestIdp: "TestIdp",
102
- VmWareSaml: "VmWareSaml"
103
- };
104
- const SsoConnectionAnyOfState = {
105
- Inactive: "Inactive",
106
- Validating: "Validating",
107
- Active: "Active",
108
- Deleting: "Deleting"
109
- };
110
- const SsoConnectionAnyOfProviderTag = {
111
- Saml: "Saml"
112
- };
113
- const SsoConnectionAnyOfEightAllOfState = {
114
- Inactive: "Inactive",
115
- Validating: "Validating",
116
- Active: "Active",
117
- Deleting: "Deleting"
118
- };
119
- const SsoConnectionAnyOfEightAllOfType = {
120
- AdpOidc: "AdpOidc",
121
- Auth0Migration: "Auth0Migration",
122
- CleverOidc: "CleverOidc",
123
- EntraIdOidc: "EntraIdOidc",
124
- GenericOidc: "GenericOidc",
125
- GoogleOidc: "GoogleOidc",
126
- OktaOidc: "OktaOidc",
127
- LoginGovOidc: "LoginGovOidc"
128
- };
129
- const SsoConnectionAnyOfEightAllOfProviderTag = {
130
- OpenIdConnect: "OpenIdConnect"
131
- };
132
- const DataInstallationObject = {
133
- data_installation: "data_installation",
134
- connected_account: "connected_account"
135
- };
136
- const DataInstallationState = {
137
- connected: "connected",
138
- needs_reauthorization: "needs_reauthorization"
139
- };
140
- const DataIntegrationObject = {
141
- data_integration: "data_integration"
142
- };
143
- const DataIntegrationIntegrationType = {
144
- asana: "asana",
145
- box: "box",
146
- "cal-dot-com": "cal-dot-com",
147
- calendly: "calendly",
148
- confluence: "confluence",
149
- dropbox: "dropbox",
150
- "frame-io": "frame-io",
151
- front: "front",
152
- github: "github",
153
- gitlab: "gitlab",
154
- gmail: "gmail",
155
- google: "google",
156
- "google-calendar": "google-calendar",
157
- "google-drive": "google-drive",
158
- helpscout: "helpscout",
159
- hubspot: "hubspot",
160
- intercom: "intercom",
161
- jira: "jira",
162
- linear: "linear",
163
- microsoft: "microsoft",
164
- "microsoft-onedrive": "microsoft-onedrive",
165
- "microsoft-onenote": "microsoft-onenote",
166
- "microsoft-outlook": "microsoft-outlook",
167
- "microsoft-outlook-calendar": "microsoft-outlook-calendar",
168
- "microsoft-sharepoint": "microsoft-sharepoint",
169
- "microsoft-teams": "microsoft-teams",
170
- "microsoft-todo": "microsoft-todo",
171
- notion: "notion",
172
- prefect: "prefect",
173
- "pydantic-logfire": "pydantic-logfire",
174
- salesforce: "salesforce",
175
- sentry: "sentry",
176
- slack: "slack",
177
- snowflake: "snowflake",
178
- stripe: "stripe",
179
- xero: "xero",
180
- zendesk: "zendesk"
181
- };
182
- const DataIntegrationOwnership = {
183
- userland_user: "userland_user",
184
- organization: "organization"
185
- };
186
- const DataIntegrationCredentialsType = {
187
- shared: "shared",
188
- custom: "custom"
48
+ const DirectoryType = {
49
+ azure_scim_v20: "azure scim v2.0",
50
+ bamboohr: "bamboohr",
51
+ breathe_hr: "breathe hr",
52
+ cezanne_hr: "cezanne hr",
53
+ cyberark_scim_v20: "cyberark scim v2.0",
54
+ fourth_hr: "fourth hr",
55
+ generic_scim_v20: "generic scim v2.0",
56
+ gsuite_directory: "gsuite directory",
57
+ gusto: "gusto",
58
+ hibob: "hibob",
59
+ jump_cloud_scim_v20: "jump cloud scim v2.0",
60
+ okta_scim_v20: "okta scim v2.0",
61
+ onelogin_scim_v20: "onelogin scim v2.0",
62
+ people_hr: "people hr",
63
+ personio: "personio",
64
+ pingfederate_scim_v20: "pingfederate scim v2.0",
65
+ rippling: "rippling",
66
+ rippling_scim_v20: "rippling scim v2.0",
67
+ s3: "s3",
68
+ sailpoint_scim_v20: "sailpoint scim v2.0",
69
+ sftp: "sftp",
70
+ sftp_workday: "sftp workday",
71
+ workday: "workday"
72
+ };
73
+ const DirectoryState = {
74
+ requires_type: "requires_type",
75
+ linked: "linked",
76
+ validating: "validating",
77
+ invalid_credentials: "invalid_credentials",
78
+ unlinked: "unlinked",
79
+ deleting: "deleting"
189
80
  };
190
81
  const GenerateAdminPortalLinkIntent = {
191
82
  domain_verification: "domain_verification",
192
- sso: "sso"
83
+ sso: "sso",
84
+ log_streams: "log_streams"
193
85
  };
194
- const getMembersUrl = (params) => {
195
- const normalizedParams = new URLSearchParams();
196
- Object.entries(params || {}).forEach(([key, value]) => {
197
- if (value !== void 0) {
198
- normalizedParams.append(key, value === null ? "null" : value.toString());
199
- }
200
- });
201
- const stringifiedParams = normalizedParams.toString();
202
- return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/UserManagement/members?${stringifiedParams}` : `https://api.workos.com/_widgets/UserManagement/members`;
86
+ const getCreateOrganizationApiKeyUrl = () => {
87
+ return `https://api.workos.com/_widgets/ApiKeys/organization-api-keys`;
203
88
  };
204
- const members = async (params, options) => {
205
- const res = await fetch(getMembersUrl(params), {
89
+ const createOrganizationApiKey = async (createOrganizationApiKeyRequest, options) => {
90
+ const res = await fetch(getCreateOrganizationApiKeyUrl(), {
206
91
  ...options,
207
- method: "GET"
92
+ method: "POST",
93
+ headers: { "Content-Type": "application/json", ...options?.headers },
94
+ body: JSON.stringify(createOrganizationApiKeyRequest)
208
95
  });
209
96
  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
210
97
  const data = body ? JSON.parse(body) : {};
211
- return { data, status: res.status, headers: res.headers };
98
+ return {
99
+ data,
100
+ status: res.status,
101
+ headers: res.headers
102
+ };
212
103
  };
213
- const getMembersKey = (params) => [
214
- `https://api.workos.com/_widgets/UserManagement/members`,
215
- ...params ? [params] : []
216
- ];
217
- const useMembers = (params, options) => {
104
+ const getCreateOrganizationApiKeyMutationFetcher = (options) => {
105
+ return (_, { arg }) => {
106
+ return createOrganizationApiKey(arg, options);
107
+ };
108
+ };
109
+ const getCreateOrganizationApiKeyMutationKey = () => [`https://api.workos.com/_widgets/ApiKeys/organization-api-keys`];
110
+ const useCreateOrganizationApiKey = (options) => {
218
111
  const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
219
- const isEnabled = swrOptions?.enabled !== false;
220
- const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getMembersKey(params) : null);
221
- const swrFn = () => members(params, fetchOptions);
222
- const query = useSwr(
223
- swrKey,
224
- swrFn,
225
- swrOptions
226
- );
112
+ const swrKey = swrOptions?.swrKey ?? getCreateOrganizationApiKeyMutationKey();
113
+ const swrFn = getCreateOrganizationApiKeyMutationFetcher(fetchOptions);
114
+ const query = useSWRMutation(swrKey, swrFn, swrOptions);
227
115
  return {
228
116
  swrKey,
229
117
  ...query
230
118
  };
231
119
  };
232
- const getRolesUrl = () => {
233
- return `https://api.workos.com/_widgets/UserManagement/roles`;
120
+ const getListOrganizationApiKeysUrl = (params) => {
121
+ const normalizedParams = new URLSearchParams();
122
+ Object.entries(params || {}).forEach(([key, value]) => {
123
+ if (value !== void 0) {
124
+ normalizedParams.append(key, value === null ? "null" : value.toString());
125
+ }
126
+ });
127
+ const stringifiedParams = normalizedParams.toString();
128
+ return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/ApiKeys/organization-api-keys?${stringifiedParams}` : `https://api.workos.com/_widgets/ApiKeys/organization-api-keys`;
234
129
  };
235
- const roles = async (options) => {
236
- const res = await fetch(getRolesUrl(), {
130
+ const listOrganizationApiKeys = async (params, options) => {
131
+ const res = await fetch(getListOrganizationApiKeysUrl(params), {
237
132
  ...options,
238
133
  method: "GET"
239
134
  });
240
135
  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
241
136
  const data = body ? JSON.parse(body) : {};
242
- return { data, status: res.status, headers: res.headers };
137
+ return {
138
+ data,
139
+ status: res.status,
140
+ headers: res.headers
141
+ };
243
142
  };
244
- const getRolesKey = () => [`https://api.workos.com/_widgets/UserManagement/roles`];
245
- const useRoles = (options) => {
143
+ const getListOrganizationApiKeysKey = (params) => [
144
+ `https://api.workos.com/_widgets/ApiKeys/organization-api-keys`,
145
+ ...params ? [params] : []
146
+ ];
147
+ const useListOrganizationApiKeys = (params, options) => {
246
148
  const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
247
149
  const isEnabled = swrOptions?.enabled !== false;
248
- const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getRolesKey() : null);
249
- const swrFn = () => roles(fetchOptions);
150
+ const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getListOrganizationApiKeysKey(params) : null);
151
+ const swrFn = () => listOrganizationApiKeys(params, fetchOptions);
250
152
  const query = useSwr(
251
153
  swrKey,
252
154
  swrFn,
@@ -257,11 +159,18 @@ const useRoles = (options) => {
257
159
  ...query
258
160
  };
259
161
  };
260
- const getRolesAndConfigUrl = () => {
261
- return `https://api.workos.com/_widgets/UserManagement/roles-and-config`;
162
+ const getListOrganizationApiKeyPermissionsUrl = (params) => {
163
+ const normalizedParams = new URLSearchParams();
164
+ Object.entries(params || {}).forEach(([key, value]) => {
165
+ if (value !== void 0) {
166
+ normalizedParams.append(key, value === null ? "null" : value.toString());
167
+ }
168
+ });
169
+ const stringifiedParams = normalizedParams.toString();
170
+ return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/ApiKeys/permissions?${stringifiedParams}` : `https://api.workos.com/_widgets/ApiKeys/permissions`;
262
171
  };
263
- const rolesAndConfig = async (options) => {
264
- const res = await fetch(getRolesAndConfigUrl(), {
172
+ const listOrganizationApiKeyPermissions = async (params, options) => {
173
+ const res = await fetch(getListOrganizationApiKeyPermissionsUrl(params), {
265
174
  ...options,
266
175
  method: "GET"
267
176
  });
@@ -273,12 +182,15 @@ const rolesAndConfig = async (options) => {
273
182
  headers: res.headers
274
183
  };
275
184
  };
276
- const getRolesAndConfigKey = () => [`https://api.workos.com/_widgets/UserManagement/roles-and-config`];
277
- const useRolesAndConfig = (options) => {
185
+ const getListOrganizationApiKeyPermissionsKey = (params) => [
186
+ `https://api.workos.com/_widgets/ApiKeys/permissions`,
187
+ ...params ? [params] : []
188
+ ];
189
+ const useListOrganizationApiKeyPermissions = (params, options) => {
278
190
  const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
279
191
  const isEnabled = swrOptions?.enabled !== false;
280
- const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getRolesAndConfigKey() : null);
281
- const swrFn = () => rolesAndConfig(fetchOptions);
192
+ const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getListOrganizationApiKeyPermissionsKey(params) : null);
193
+ const swrFn = () => listOrganizationApiKeyPermissions(params, fetchOptions);
282
194
  const query = useSwr(
283
195
  swrKey,
284
196
  swrFn,
@@ -289,15 +201,13 @@ const useRolesAndConfig = (options) => {
289
201
  ...query
290
202
  };
291
203
  };
292
- const getInviteMemberUrl = () => {
293
- return `https://api.workos.com/_widgets/UserManagement/invite-user`;
204
+ const getDeleteOrganizationApiKeyUrl = (apiKeyId) => {
205
+ return `https://api.workos.com/_widgets/ApiKeys/${apiKeyId}`;
294
206
  };
295
- const inviteMember = async (inviteMemberBody, options) => {
296
- const res = await fetch(getInviteMemberUrl(), {
207
+ const deleteOrganizationApiKey = async (apiKeyId, options) => {
208
+ const res = await fetch(getDeleteOrganizationApiKeyUrl(apiKeyId), {
297
209
  ...options,
298
- method: "POST",
299
- headers: { "Content-Type": "application/json", ...options?.headers },
300
- body: JSON.stringify(inviteMemberBody)
210
+ method: "DELETE"
301
211
  });
302
212
  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
303
213
  const data = body ? JSON.parse(body) : {};
@@ -307,29 +217,32 @@ const inviteMember = async (inviteMemberBody, options) => {
307
217
  headers: res.headers
308
218
  };
309
219
  };
310
- const getInviteMemberMutationFetcher = (options) => {
311
- return (_, { arg }) => {
312
- return inviteMember(arg, options);
220
+ const getDeleteOrganizationApiKeyMutationFetcher = (apiKeyId, options) => {
221
+ return (_, __) => {
222
+ return deleteOrganizationApiKey(apiKeyId, options);
313
223
  };
314
224
  };
315
- const getInviteMemberMutationKey = () => [`https://api.workos.com/_widgets/UserManagement/invite-user`];
316
- const useInviteMember = (options) => {
225
+ const getDeleteOrganizationApiKeyMutationKey = (apiKeyId) => [`https://api.workos.com/_widgets/ApiKeys/${apiKeyId}`];
226
+ const useDeleteOrganizationApiKey = (apiKeyId, options) => {
317
227
  const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
318
- const swrKey = swrOptions?.swrKey ?? getInviteMemberMutationKey();
319
- const swrFn = getInviteMemberMutationFetcher(fetchOptions);
228
+ const swrKey = swrOptions?.swrKey ?? getDeleteOrganizationApiKeyMutationKey(apiKeyId);
229
+ const swrFn = getDeleteOrganizationApiKeyMutationFetcher(
230
+ apiKeyId,
231
+ fetchOptions
232
+ );
320
233
  const query = useSWRMutation(swrKey, swrFn, swrOptions);
321
234
  return {
322
235
  swrKey,
323
236
  ...query
324
237
  };
325
238
  };
326
- const getResendInviteUrl = (userId) => {
327
- return `https://api.workos.com/_widgets/UserManagement/invites/${userId}/resend`;
239
+ const getDeleteDataInstallationUrl = (installationId) => {
240
+ return `https://api.workos.com/_widgets/DataIntegrations/installations/${installationId}`;
328
241
  };
329
- const resendInvite = async (userId, options) => {
330
- const res = await fetch(getResendInviteUrl(userId), {
242
+ const deleteDataInstallation = async (installationId, options) => {
243
+ const res = await fetch(getDeleteDataInstallationUrl(installationId), {
331
244
  ...options,
332
- method: "POST"
245
+ method: "DELETE"
333
246
  });
334
247
  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
335
248
  const data = body ? JSON.parse(body) : {};
@@ -339,31 +252,34 @@ const resendInvite = async (userId, options) => {
339
252
  headers: res.headers
340
253
  };
341
254
  };
342
- const getResendInviteMutationFetcher = (userId, options) => {
255
+ const getDeleteDataInstallationMutationFetcher = (installationId, options) => {
343
256
  return (_, __) => {
344
- return resendInvite(userId, options);
257
+ return deleteDataInstallation(installationId, options);
345
258
  };
346
259
  };
347
- const getResendInviteMutationKey = (userId) => [
348
- `https://api.workos.com/_widgets/UserManagement/invites/${userId}/resend`
260
+ const getDeleteDataInstallationMutationKey = (installationId) => [
261
+ `https://api.workos.com/_widgets/DataIntegrations/installations/${installationId}`
349
262
  ];
350
- const useResendInvite = (userId, options) => {
263
+ const useDeleteDataInstallation = (installationId, options) => {
351
264
  const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
352
- const swrKey = swrOptions?.swrKey ?? getResendInviteMutationKey(userId);
353
- const swrFn = getResendInviteMutationFetcher(userId, fetchOptions);
265
+ const swrKey = swrOptions?.swrKey ?? getDeleteDataInstallationMutationKey(installationId);
266
+ const swrFn = getDeleteDataInstallationMutationFetcher(
267
+ installationId,
268
+ fetchOptions
269
+ );
354
270
  const query = useSWRMutation(swrKey, swrFn, swrOptions);
355
271
  return {
356
272
  swrKey,
357
273
  ...query
358
274
  };
359
275
  };
360
- const getRevokeInviteUrl = (userId) => {
361
- return `https://api.workos.com/_widgets/UserManagement/invites/${userId}`;
276
+ const getMyDataIntegrationsUrl = () => {
277
+ return `https://api.workos.com/_widgets/DataIntegrations/mine`;
362
278
  };
363
- const revokeInvite = async (userId, options) => {
364
- const res = await fetch(getRevokeInviteUrl(userId), {
279
+ const myDataIntegrations = async (options) => {
280
+ const res = await fetch(getMyDataIntegrationsUrl(), {
365
281
  ...options,
366
- method: "DELETE"
282
+ method: "GET"
367
283
  });
368
284
  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
369
285
  const data = body ? JSON.parse(body) : {};
@@ -373,30 +289,33 @@ const revokeInvite = async (userId, options) => {
373
289
  headers: res.headers
374
290
  };
375
291
  };
376
- const getRevokeInviteMutationFetcher = (userId, options) => {
377
- return (_, __) => {
378
- return revokeInvite(userId, options);
379
- };
380
- };
381
- const getRevokeInviteMutationKey = (userId) => [`https://api.workos.com/_widgets/UserManagement/invites/${userId}`];
382
- const useRevokeInvite = (userId, options) => {
292
+ const getMyDataIntegrationsKey = () => [`https://api.workos.com/_widgets/DataIntegrations/mine`];
293
+ const useMyDataIntegrations = (options) => {
383
294
  const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
384
- const swrKey = swrOptions?.swrKey ?? getRevokeInviteMutationKey(userId);
385
- const swrFn = getRevokeInviteMutationFetcher(userId, fetchOptions);
386
- const query = useSWRMutation(swrKey, swrFn, swrOptions);
295
+ const isEnabled = swrOptions?.enabled !== false;
296
+ const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getMyDataIntegrationsKey() : null);
297
+ const swrFn = () => myDataIntegrations(fetchOptions);
298
+ const query = useSwr(
299
+ swrKey,
300
+ swrFn,
301
+ swrOptions
302
+ );
387
303
  return {
388
304
  swrKey,
389
305
  ...query
390
306
  };
391
307
  };
392
- const getRemoveMemberUrl = (userId) => {
393
- return `https://api.workos.com/_widgets/UserManagement/members/${userId}`;
308
+ const getGetDataInstallationAuthorizationStatusUrl = (dataIntegrationId, state) => {
309
+ return `https://api.workos.com/_widgets/DataIntegrations/${dataIntegrationId}/authorization-status/${state}`;
394
310
  };
395
- const removeMember = async (userId, options) => {
396
- const res = await fetch(getRemoveMemberUrl(userId), {
397
- ...options,
398
- method: "DELETE"
399
- });
311
+ const getDataInstallationAuthorizationStatus = async (dataIntegrationId, state, options) => {
312
+ const res = await fetch(
313
+ getGetDataInstallationAuthorizationStatusUrl(dataIntegrationId, state),
314
+ {
315
+ ...options,
316
+ method: "GET"
317
+ }
318
+ );
400
319
  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
401
320
  const data = body ? JSON.parse(body) : {};
402
321
  return {
@@ -405,61 +324,40 @@ const removeMember = async (userId, options) => {
405
324
  headers: res.headers
406
325
  };
407
326
  };
408
- const getRemoveMemberMutationFetcher = (userId, options) => {
409
- return (_, __) => {
410
- return removeMember(userId, options);
411
- };
412
- };
413
- const getRemoveMemberMutationKey = (userId) => [`https://api.workos.com/_widgets/UserManagement/members/${userId}`];
414
- const useRemoveMember = (userId, options) => {
327
+ const getGetDataInstallationAuthorizationStatusKey = (dataIntegrationId, state) => [
328
+ `https://api.workos.com/_widgets/DataIntegrations/${dataIntegrationId}/authorization-status/${state}`
329
+ ];
330
+ const useGetDataInstallationAuthorizationStatus = (dataIntegrationId, state, options) => {
415
331
  const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
416
- const swrKey = swrOptions?.swrKey ?? getRemoveMemberMutationKey(userId);
417
- const swrFn = getRemoveMemberMutationFetcher(userId, fetchOptions);
418
- const query = useSWRMutation(swrKey, swrFn, swrOptions);
332
+ const isEnabled = swrOptions?.enabled !== false && !!(dataIntegrationId && state);
333
+ const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getGetDataInstallationAuthorizationStatusKey(dataIntegrationId, state) : null);
334
+ const swrFn = () => getDataInstallationAuthorizationStatus(
335
+ dataIntegrationId,
336
+ state,
337
+ fetchOptions
338
+ );
339
+ const query = useSwr(
340
+ swrKey,
341
+ swrFn,
342
+ swrOptions
343
+ );
419
344
  return {
420
345
  swrKey,
421
346
  ...query
422
347
  };
423
348
  };
424
- const getUpdateMemberUrl = (userId) => {
425
- return `https://api.workos.com/_widgets/UserManagement/members/${userId}`;
426
- };
427
- const updateMember = async (userId, updateMemberBody, options) => {
428
- const res = await fetch(getUpdateMemberUrl(userId), {
429
- ...options,
430
- method: "POST",
431
- headers: { "Content-Type": "application/json", ...options?.headers },
432
- body: JSON.stringify(updateMemberBody)
349
+ const getGetDataIntegrationAuthorizeUrlUrl = (slug, params) => {
350
+ const normalizedParams = new URLSearchParams();
351
+ Object.entries(params || {}).forEach(([key, value]) => {
352
+ if (value !== void 0) {
353
+ normalizedParams.append(key, value === null ? "null" : value.toString());
354
+ }
433
355
  });
434
- const body = [204, 205, 304].includes(res.status) ? null : await res.text();
435
- const data = body ? JSON.parse(body) : {};
436
- return {
437
- data,
438
- status: res.status,
439
- headers: res.headers
440
- };
441
- };
442
- const getUpdateMemberMutationFetcher = (userId, options) => {
443
- return (_, { arg }) => {
444
- return updateMember(userId, arg, options);
445
- };
446
- };
447
- const getUpdateMemberMutationKey = (userId) => [`https://api.workos.com/_widgets/UserManagement/members/${userId}`];
448
- const useUpdateMember = (userId, options) => {
449
- const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
450
- const swrKey = swrOptions?.swrKey ?? getUpdateMemberMutationKey(userId);
451
- const swrFn = getUpdateMemberMutationFetcher(userId, fetchOptions);
452
- const query = useSWRMutation(swrKey, swrFn, swrOptions);
453
- return {
454
- swrKey,
455
- ...query
456
- };
457
- };
458
- const getOrganizationsUrl = () => {
459
- return `https://api.workos.com/_widgets/UserManagement/organizations`;
356
+ const stringifiedParams = normalizedParams.toString();
357
+ return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/DataIntegrations/${slug}/authorize?${stringifiedParams}` : `https://api.workos.com/_widgets/DataIntegrations/${slug}/authorize`;
460
358
  };
461
- const organizations = async (options) => {
462
- const res = await fetch(getOrganizationsUrl(), {
359
+ const getDataIntegrationAuthorizeUrl = async (slug, params, options) => {
360
+ const res = await fetch(getGetDataIntegrationAuthorizeUrlUrl(slug, params), {
463
361
  ...options,
464
362
  method: "GET"
465
363
  });
@@ -471,40 +369,15 @@ const organizations = async (options) => {
471
369
  headers: res.headers
472
370
  };
473
371
  };
474
- const getOrganizationsKey = () => [`https://api.workos.com/_widgets/UserManagement/organizations`];
475
- const useOrganizations = (options) => {
476
- const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
477
- const isEnabled = swrOptions?.enabled !== false;
478
- const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getOrganizationsKey() : null);
479
- const swrFn = () => organizations(fetchOptions);
480
- const query = useSwr(
481
- swrKey,
482
- swrFn,
483
- swrOptions
484
- );
485
- return {
486
- swrKey,
487
- ...query
488
- };
489
- };
490
- const getMeUrl = () => {
491
- return `https://api.workos.com/_widgets/UserProfile/me`;
492
- };
493
- const me = async (options) => {
494
- const res = await fetch(getMeUrl(), {
495
- ...options,
496
- method: "GET"
497
- });
498
- const body = [204, 205, 304].includes(res.status) ? null : await res.text();
499
- const data = body ? JSON.parse(body) : {};
500
- return { data, status: res.status, headers: res.headers };
501
- };
502
- const getMeKey = () => [`https://api.workos.com/_widgets/UserProfile/me`];
503
- const useMe = (options) => {
372
+ const getGetDataIntegrationAuthorizeUrlKey = (slug, params) => [
373
+ `https://api.workos.com/_widgets/DataIntegrations/${slug}/authorize`,
374
+ ...params ? [params] : []
375
+ ];
376
+ const useGetDataIntegrationAuthorizeUrl = (slug, params, options) => {
504
377
  const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
505
- const isEnabled = swrOptions?.enabled !== false;
506
- const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getMeKey() : null);
507
- const swrFn = () => me(fetchOptions);
378
+ const isEnabled = swrOptions?.enabled !== false && !!slug;
379
+ const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getGetDataIntegrationAuthorizeUrlKey(slug, params) : null);
380
+ const swrFn = () => getDataIntegrationAuthorizeUrl(slug, params, fetchOptions);
508
381
  const query = useSwr(
509
382
  swrKey,
510
383
  swrFn,
@@ -515,43 +388,15 @@ const useMe = (options) => {
515
388
  ...query
516
389
  };
517
390
  };
518
- const getUpdateMeUrl = () => {
519
- return `https://api.workos.com/_widgets/UserProfile/me`;
391
+ const getInviteMemberUrl = () => {
392
+ return `https://api.workos.com/_widgets/UserManagement/invite-user`;
520
393
  };
521
- const updateMe = async (updateMeBody, options) => {
522
- const res = await fetch(getUpdateMeUrl(), {
394
+ const inviteMember = async (inviteMemberBody, options) => {
395
+ const res = await fetch(getInviteMemberUrl(), {
523
396
  ...options,
524
397
  method: "POST",
525
398
  headers: { "Content-Type": "application/json", ...options?.headers },
526
- body: JSON.stringify(updateMeBody)
527
- });
528
- const body = [204, 205, 304].includes(res.status) ? null : await res.text();
529
- const data = body ? JSON.parse(body) : {};
530
- return { data, status: res.status, headers: res.headers };
531
- };
532
- const getUpdateMeMutationFetcher = (options) => {
533
- return (_, { arg }) => {
534
- return updateMe(arg, options);
535
- };
536
- };
537
- const getUpdateMeMutationKey = () => [`https://api.workos.com/_widgets/UserProfile/me`];
538
- const useUpdateMe = (options) => {
539
- const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
540
- const swrKey = swrOptions?.swrKey ?? getUpdateMeMutationKey();
541
- const swrFn = getUpdateMeMutationFetcher(fetchOptions);
542
- const query = useSWRMutation(swrKey, swrFn, swrOptions);
543
- return {
544
- swrKey,
545
- ...query
546
- };
547
- };
548
- const getCreateTotpFactorUrl = () => {
549
- return `https://api.workos.com/_widgets/UserProfile/create-totp-factor`;
550
- };
551
- const createTotpFactor = async (options) => {
552
- const res = await fetch(getCreateTotpFactorUrl(), {
553
- ...options,
554
- method: "POST"
399
+ body: JSON.stringify(inviteMemberBody)
555
400
  });
556
401
  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
557
402
  const data = body ? JSON.parse(body) : {};
@@ -561,31 +406,29 @@ const createTotpFactor = async (options) => {
561
406
  headers: res.headers
562
407
  };
563
408
  };
564
- const getCreateTotpFactorMutationFetcher = (options) => {
565
- return (_, __) => {
566
- return createTotpFactor(options);
409
+ const getInviteMemberMutationFetcher = (options) => {
410
+ return (_, { arg }) => {
411
+ return inviteMember(arg, options);
567
412
  };
568
413
  };
569
- const getCreateTotpFactorMutationKey = () => [`https://api.workos.com/_widgets/UserProfile/create-totp-factor`];
570
- const useCreateTotpFactor = (options) => {
414
+ const getInviteMemberMutationKey = () => [`https://api.workos.com/_widgets/UserManagement/invite-user`];
415
+ const useInviteMember = (options) => {
571
416
  const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
572
- const swrKey = swrOptions?.swrKey ?? getCreateTotpFactorMutationKey();
573
- const swrFn = getCreateTotpFactorMutationFetcher(fetchOptions);
417
+ const swrKey = swrOptions?.swrKey ?? getInviteMemberMutationKey();
418
+ const swrFn = getInviteMemberMutationFetcher(fetchOptions);
574
419
  const query = useSWRMutation(swrKey, swrFn, swrOptions);
575
420
  return {
576
421
  swrKey,
577
422
  ...query
578
423
  };
579
424
  };
580
- const getVerifyTotpFactorUrl = () => {
581
- return `https://api.workos.com/_widgets/UserProfile/verify-totp-factor`;
425
+ const getRevokeInviteUrl = (userId) => {
426
+ return `https://api.workos.com/_widgets/UserManagement/invites/${userId}`;
582
427
  };
583
- const verifyTotpFactor = async (verifyTotpFactorRequest, options) => {
584
- const res = await fetch(getVerifyTotpFactorUrl(), {
428
+ const revokeInvite = async (userId, options) => {
429
+ const res = await fetch(getRevokeInviteUrl(userId), {
585
430
  ...options,
586
- method: "POST",
587
- headers: { "Content-Type": "application/json", ...options?.headers },
588
- body: JSON.stringify(verifyTotpFactorRequest)
431
+ method: "DELETE"
589
432
  });
590
433
  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
591
434
  const data = body ? JSON.parse(body) : {};
@@ -595,29 +438,29 @@ const verifyTotpFactor = async (verifyTotpFactorRequest, options) => {
595
438
  headers: res.headers
596
439
  };
597
440
  };
598
- const getVerifyTotpFactorMutationFetcher = (options) => {
599
- return (_, { arg }) => {
600
- return verifyTotpFactor(arg, options);
441
+ const getRevokeInviteMutationFetcher = (userId, options) => {
442
+ return (_, __) => {
443
+ return revokeInvite(userId, options);
601
444
  };
602
445
  };
603
- const getVerifyTotpFactorMutationKey = () => [`https://api.workos.com/_widgets/UserProfile/verify-totp-factor`];
604
- const useVerifyTotpFactor = (options) => {
446
+ const getRevokeInviteMutationKey = (userId) => [`https://api.workos.com/_widgets/UserManagement/invites/${userId}`];
447
+ const useRevokeInvite = (userId, options) => {
605
448
  const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
606
- const swrKey = swrOptions?.swrKey ?? getVerifyTotpFactorMutationKey();
607
- const swrFn = getVerifyTotpFactorMutationFetcher(fetchOptions);
449
+ const swrKey = swrOptions?.swrKey ?? getRevokeInviteMutationKey(userId);
450
+ const swrFn = getRevokeInviteMutationFetcher(userId, fetchOptions);
608
451
  const query = useSWRMutation(swrKey, swrFn, swrOptions);
609
452
  return {
610
453
  swrKey,
611
454
  ...query
612
455
  };
613
456
  };
614
- const getDeleteTotpFactorsUrl = () => {
615
- return `https://api.workos.com/_widgets/UserProfile/totp-factors`;
457
+ const getResendInviteUrl = (userId) => {
458
+ return `https://api.workos.com/_widgets/UserManagement/invites/${userId}/resend`;
616
459
  };
617
- const deleteTotpFactors = async (options) => {
618
- const res = await fetch(getDeleteTotpFactorsUrl(), {
460
+ const resendInvite = async (userId, options) => {
461
+ const res = await fetch(getResendInviteUrl(userId), {
619
462
  ...options,
620
- method: "DELETE"
463
+ method: "POST"
621
464
  });
622
465
  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
623
466
  const data = body ? JSON.parse(body) : {};
@@ -627,46 +470,52 @@ const deleteTotpFactors = async (options) => {
627
470
  headers: res.headers
628
471
  };
629
472
  };
630
- const getDeleteTotpFactorsMutationFetcher = (options) => {
473
+ const getResendInviteMutationFetcher = (userId, options) => {
631
474
  return (_, __) => {
632
- return deleteTotpFactors(options);
475
+ return resendInvite(userId, options);
633
476
  };
634
477
  };
635
- const getDeleteTotpFactorsMutationKey = () => [`https://api.workos.com/_widgets/UserProfile/totp-factors`];
636
- const useDeleteTotpFactors = (options) => {
478
+ const getResendInviteMutationKey = (userId) => [
479
+ `https://api.workos.com/_widgets/UserManagement/invites/${userId}/resend`
480
+ ];
481
+ const useResendInvite = (userId, options) => {
637
482
  const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
638
- const swrKey = swrOptions?.swrKey ?? getDeleteTotpFactorsMutationKey();
639
- const swrFn = getDeleteTotpFactorsMutationFetcher(fetchOptions);
483
+ const swrKey = swrOptions?.swrKey ?? getResendInviteMutationKey(userId);
484
+ const swrFn = getResendInviteMutationFetcher(userId, fetchOptions);
640
485
  const query = useSWRMutation(swrKey, swrFn, swrOptions);
641
486
  return {
642
487
  swrKey,
643
488
  ...query
644
489
  };
645
490
  };
646
- const getAuthenticationInformationUrl = () => {
647
- return `https://api.workos.com/_widgets/UserProfile/authentication-information`;
491
+ const getMembersUrl = (params) => {
492
+ const normalizedParams = new URLSearchParams();
493
+ Object.entries(params || {}).forEach(([key, value]) => {
494
+ if (value !== void 0) {
495
+ normalizedParams.append(key, value === null ? "null" : value.toString());
496
+ }
497
+ });
498
+ const stringifiedParams = normalizedParams.toString();
499
+ return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/UserManagement/members?${stringifiedParams}` : `https://api.workos.com/_widgets/UserManagement/members`;
648
500
  };
649
- const authenticationInformation = async (options) => {
650
- const res = await fetch(getAuthenticationInformationUrl(), {
501
+ const members = async (params, options) => {
502
+ const res = await fetch(getMembersUrl(params), {
651
503
  ...options,
652
504
  method: "GET"
653
505
  });
654
506
  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
655
507
  const data = body ? JSON.parse(body) : {};
656
- return {
657
- data,
658
- status: res.status,
659
- headers: res.headers
660
- };
508
+ return { data, status: res.status, headers: res.headers };
661
509
  };
662
- const getAuthenticationInformationKey = () => [
663
- `https://api.workos.com/_widgets/UserProfile/authentication-information`
510
+ const getMembersKey = (params) => [
511
+ `https://api.workos.com/_widgets/UserManagement/members`,
512
+ ...params ? [params] : []
664
513
  ];
665
- const useAuthenticationInformation = (options) => {
514
+ const useMembers = (params, options) => {
666
515
  const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
667
516
  const isEnabled = swrOptions?.enabled !== false;
668
- const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getAuthenticationInformationKey() : null);
669
- const swrFn = () => authenticationInformation(fetchOptions);
517
+ const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getMembersKey(params) : null);
518
+ const swrFn = () => members(params, fetchOptions);
670
519
  const query = useSwr(
671
520
  swrKey,
672
521
  swrFn,
@@ -677,15 +526,13 @@ const useAuthenticationInformation = (options) => {
677
526
  ...query
678
527
  };
679
528
  };
680
- const getCreatePasswordUrl = () => {
681
- return `https://api.workos.com/_widgets/UserProfile/create-password`;
529
+ const getRemoveMemberUrl = (userId) => {
530
+ return `https://api.workos.com/_widgets/UserManagement/members/${userId}`;
682
531
  };
683
- const createPassword = async (createPasswordRequest, options) => {
684
- const res = await fetch(getCreatePasswordUrl(), {
532
+ const removeMember = async (userId, options) => {
533
+ const res = await fetch(getRemoveMemberUrl(userId), {
685
534
  ...options,
686
- method: "POST",
687
- headers: { "Content-Type": "application/json", ...options?.headers },
688
- body: JSON.stringify(createPasswordRequest)
535
+ method: "DELETE"
689
536
  });
690
537
  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
691
538
  const data = body ? JSON.parse(body) : {};
@@ -695,31 +542,31 @@ const createPassword = async (createPasswordRequest, options) => {
695
542
  headers: res.headers
696
543
  };
697
544
  };
698
- const getCreatePasswordMutationFetcher = (options) => {
699
- return (_, { arg }) => {
700
- return createPassword(arg, options);
545
+ const getRemoveMemberMutationFetcher = (userId, options) => {
546
+ return (_, __) => {
547
+ return removeMember(userId, options);
701
548
  };
702
549
  };
703
- const getCreatePasswordMutationKey = () => [`https://api.workos.com/_widgets/UserProfile/create-password`];
704
- const useCreatePassword = (options) => {
550
+ const getRemoveMemberMutationKey = (userId) => [`https://api.workos.com/_widgets/UserManagement/members/${userId}`];
551
+ const useRemoveMember = (userId, options) => {
705
552
  const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
706
- const swrKey = swrOptions?.swrKey ?? getCreatePasswordMutationKey();
707
- const swrFn = getCreatePasswordMutationFetcher(fetchOptions);
553
+ const swrKey = swrOptions?.swrKey ?? getRemoveMemberMutationKey(userId);
554
+ const swrFn = getRemoveMemberMutationFetcher(userId, fetchOptions);
708
555
  const query = useSWRMutation(swrKey, swrFn, swrOptions);
709
556
  return {
710
557
  swrKey,
711
558
  ...query
712
559
  };
713
560
  };
714
- const getUpdatePasswordUrl = () => {
715
- return `https://api.workos.com/_widgets/UserProfile/update-password`;
561
+ const getUpdateMemberUrl = (userId) => {
562
+ return `https://api.workos.com/_widgets/UserManagement/members/${userId}`;
716
563
  };
717
- const updatePassword = async (updatePasswordRequest, options) => {
718
- const res = await fetch(getUpdatePasswordUrl(), {
564
+ const updateMember = async (userId, updateMemberBody, options) => {
565
+ const res = await fetch(getUpdateMemberUrl(userId), {
719
566
  ...options,
720
567
  method: "POST",
721
568
  headers: { "Content-Type": "application/json", ...options?.headers },
722
- body: JSON.stringify(updatePasswordRequest)
569
+ body: JSON.stringify(updateMemberBody)
723
570
  });
724
571
  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
725
572
  const data = body ? JSON.parse(body) : {};
@@ -729,31 +576,29 @@ const updatePassword = async (updatePasswordRequest, options) => {
729
576
  headers: res.headers
730
577
  };
731
578
  };
732
- const getUpdatePasswordMutationFetcher = (options) => {
579
+ const getUpdateMemberMutationFetcher = (userId, options) => {
733
580
  return (_, { arg }) => {
734
- return updatePassword(arg, options);
581
+ return updateMember(userId, arg, options);
735
582
  };
736
583
  };
737
- const getUpdatePasswordMutationKey = () => [`https://api.workos.com/_widgets/UserProfile/update-password`];
738
- const useUpdatePassword = (options) => {
584
+ const getUpdateMemberMutationKey = (userId) => [`https://api.workos.com/_widgets/UserManagement/members/${userId}`];
585
+ const useUpdateMember = (userId, options) => {
739
586
  const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
740
- const swrKey = swrOptions?.swrKey ?? getUpdatePasswordMutationKey();
741
- const swrFn = getUpdatePasswordMutationFetcher(fetchOptions);
587
+ const swrKey = swrOptions?.swrKey ?? getUpdateMemberMutationKey(userId);
588
+ const swrFn = getUpdateMemberMutationFetcher(userId, fetchOptions);
742
589
  const query = useSWRMutation(swrKey, swrFn, swrOptions);
743
590
  return {
744
591
  swrKey,
745
592
  ...query
746
593
  };
747
594
  };
748
- const getRevokeAllSessionsUrl = () => {
749
- return `https://api.workos.com/_widgets/UserProfile/sessions/revoke-all`;
595
+ const getOrganizationsUrl = () => {
596
+ return `https://api.workos.com/_widgets/UserManagement/organizations`;
750
597
  };
751
- const revokeAllSessions = async (revokeAllSessionsRequest, options) => {
752
- const res = await fetch(getRevokeAllSessionsUrl(), {
598
+ const organizations = async (options) => {
599
+ const res = await fetch(getOrganizationsUrl(), {
753
600
  ...options,
754
- method: "DELETE",
755
- headers: { "Content-Type": "application/json", ...options?.headers },
756
- body: JSON.stringify(revokeAllSessionsRequest)
601
+ method: "GET"
757
602
  });
758
603
  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
759
604
  const data = body ? JSON.parse(body) : {};
@@ -763,29 +608,57 @@ const revokeAllSessions = async (revokeAllSessionsRequest, options) => {
763
608
  headers: res.headers
764
609
  };
765
610
  };
766
- const getRevokeAllSessionsMutationFetcher = (options) => {
767
- return (_, { arg }) => {
768
- return revokeAllSessions(arg, options);
611
+ const getOrganizationsKey = () => [`https://api.workos.com/_widgets/UserManagement/organizations`];
612
+ const useOrganizations = (options) => {
613
+ const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
614
+ const isEnabled = swrOptions?.enabled !== false;
615
+ const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getOrganizationsKey() : null);
616
+ const swrFn = () => organizations(fetchOptions);
617
+ const query = useSwr(
618
+ swrKey,
619
+ swrFn,
620
+ swrOptions
621
+ );
622
+ return {
623
+ swrKey,
624
+ ...query
769
625
  };
770
626
  };
771
- const getRevokeAllSessionsMutationKey = () => [`https://api.workos.com/_widgets/UserProfile/sessions/revoke-all`];
772
- const useRevokeAllSessions = (options) => {
627
+ const getRolesUrl = () => {
628
+ return `https://api.workos.com/_widgets/UserManagement/roles`;
629
+ };
630
+ const roles = async (options) => {
631
+ const res = await fetch(getRolesUrl(), {
632
+ ...options,
633
+ method: "GET"
634
+ });
635
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
636
+ const data = body ? JSON.parse(body) : {};
637
+ return { data, status: res.status, headers: res.headers };
638
+ };
639
+ const getRolesKey = () => [`https://api.workos.com/_widgets/UserManagement/roles`];
640
+ const useRoles = (options) => {
773
641
  const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
774
- const swrKey = swrOptions?.swrKey ?? getRevokeAllSessionsMutationKey();
775
- const swrFn = getRevokeAllSessionsMutationFetcher(fetchOptions);
776
- const query = useSWRMutation(swrKey, swrFn, swrOptions);
642
+ const isEnabled = swrOptions?.enabled !== false;
643
+ const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getRolesKey() : null);
644
+ const swrFn = () => roles(fetchOptions);
645
+ const query = useSwr(
646
+ swrKey,
647
+ swrFn,
648
+ swrOptions
649
+ );
777
650
  return {
778
651
  swrKey,
779
652
  ...query
780
653
  };
781
654
  };
782
- const getRevokeSessionUrl = (sessionId) => {
783
- return `https://api.workos.com/_widgets/UserProfile/sessions/revoke/${sessionId}`;
655
+ const getRolesAndConfigUrl = () => {
656
+ return `https://api.workos.com/_widgets/UserManagement/roles-and-config`;
784
657
  };
785
- const revokeSession = async (sessionId, options) => {
786
- const res = await fetch(getRevokeSessionUrl(sessionId), {
658
+ const rolesAndConfig = async (options) => {
659
+ const res = await fetch(getRolesAndConfigUrl(), {
787
660
  ...options,
788
- method: "DELETE"
661
+ method: "GET"
789
662
  });
790
663
  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
791
664
  const data = body ? JSON.parse(body) : {};
@@ -795,42 +668,46 @@ const revokeSession = async (sessionId, options) => {
795
668
  headers: res.headers
796
669
  };
797
670
  };
798
- const getRevokeSessionMutationFetcher = (sessionId, options) => {
799
- return (_, __) => {
800
- return revokeSession(sessionId, options);
801
- };
802
- };
803
- const getRevokeSessionMutationKey = (sessionId) => [
804
- `https://api.workos.com/_widgets/UserProfile/sessions/revoke/${sessionId}`
805
- ];
806
- const useRevokeSession = (sessionId, options) => {
671
+ const getRolesAndConfigKey = () => [`https://api.workos.com/_widgets/UserManagement/roles-and-config`];
672
+ const useRolesAndConfig = (options) => {
807
673
  const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
808
- const swrKey = swrOptions?.swrKey ?? getRevokeSessionMutationKey(sessionId);
809
- const swrFn = getRevokeSessionMutationFetcher(sessionId, fetchOptions);
810
- const query = useSWRMutation(swrKey, swrFn, swrOptions);
674
+ const isEnabled = swrOptions?.enabled !== false;
675
+ const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getRolesAndConfigKey() : null);
676
+ const swrFn = () => rolesAndConfig(fetchOptions);
677
+ const query = useSwr(
678
+ swrKey,
679
+ swrFn,
680
+ swrOptions
681
+ );
811
682
  return {
812
683
  swrKey,
813
684
  ...query
814
685
  };
815
686
  };
816
- const getSessionsUrl = () => {
817
- return `https://api.workos.com/_widgets/UserProfile/sessions`;
687
+ const getAuthenticationInformationUrl = () => {
688
+ return `https://api.workos.com/_widgets/UserProfile/authentication-information`;
818
689
  };
819
- const sessions = async (options) => {
820
- const res = await fetch(getSessionsUrl(), {
690
+ const authenticationInformation = async (options) => {
691
+ const res = await fetch(getAuthenticationInformationUrl(), {
821
692
  ...options,
822
693
  method: "GET"
823
694
  });
824
695
  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
825
696
  const data = body ? JSON.parse(body) : {};
826
- return { data, status: res.status, headers: res.headers };
697
+ return {
698
+ data,
699
+ status: res.status,
700
+ headers: res.headers
701
+ };
827
702
  };
828
- const getSessionsKey = () => [`https://api.workos.com/_widgets/UserProfile/sessions`];
829
- const useSessions = (options) => {
703
+ const getAuthenticationInformationKey = () => [
704
+ `https://api.workos.com/_widgets/UserProfile/authentication-information`
705
+ ];
706
+ const useAuthenticationInformation = (options) => {
830
707
  const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
831
708
  const isEnabled = swrOptions?.enabled !== false;
832
- const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getSessionsKey() : null);
833
- const swrFn = () => sessions(fetchOptions);
709
+ const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getAuthenticationInformationKey() : null);
710
+ const swrFn = () => authenticationInformation(fetchOptions);
834
711
  const query = useSwr(
835
712
  swrKey,
836
713
  swrFn,
@@ -841,11 +718,45 @@ const useSessions = (options) => {
841
718
  ...query
842
719
  };
843
720
  };
844
- const getSendVerificationUrl = () => {
845
- return `https://api.workos.com/_widgets/UserProfile/send-verification`;
721
+ const getCreatePasswordUrl = () => {
722
+ return `https://api.workos.com/_widgets/UserProfile/create-password`;
846
723
  };
847
- const sendVerification = async (options) => {
848
- const res = await fetch(getSendVerificationUrl(), {
724
+ const createPassword = async (createPasswordRequest, options) => {
725
+ const res = await fetch(getCreatePasswordUrl(), {
726
+ ...options,
727
+ method: "POST",
728
+ headers: { "Content-Type": "application/json", ...options?.headers },
729
+ body: JSON.stringify(createPasswordRequest)
730
+ });
731
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
732
+ const data = body ? JSON.parse(body) : {};
733
+ return {
734
+ data,
735
+ status: res.status,
736
+ headers: res.headers
737
+ };
738
+ };
739
+ const getCreatePasswordMutationFetcher = (options) => {
740
+ return (_, { arg }) => {
741
+ return createPassword(arg, options);
742
+ };
743
+ };
744
+ const getCreatePasswordMutationKey = () => [`https://api.workos.com/_widgets/UserProfile/create-password`];
745
+ const useCreatePassword = (options) => {
746
+ const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
747
+ const swrKey = swrOptions?.swrKey ?? getCreatePasswordMutationKey();
748
+ const swrFn = getCreatePasswordMutationFetcher(fetchOptions);
749
+ const query = useSWRMutation(swrKey, swrFn, swrOptions);
750
+ return {
751
+ swrKey,
752
+ ...query
753
+ };
754
+ };
755
+ const getCreateTotpFactorUrl = () => {
756
+ return `https://api.workos.com/_widgets/UserProfile/create-totp-factor`;
757
+ };
758
+ const createTotpFactor = async (options) => {
759
+ const res = await fetch(getCreateTotpFactorUrl(), {
849
760
  ...options,
850
761
  method: "POST"
851
762
  });
@@ -857,46 +768,74 @@ const sendVerification = async (options) => {
857
768
  headers: res.headers
858
769
  };
859
770
  };
860
- const getSendVerificationMutationFetcher = (options) => {
771
+ const getCreateTotpFactorMutationFetcher = (options) => {
861
772
  return (_, __) => {
862
- return sendVerification(options);
773
+ return createTotpFactor(options);
863
774
  };
864
775
  };
865
- const getSendVerificationMutationKey = () => [`https://api.workos.com/_widgets/UserProfile/send-verification`];
866
- const useSendVerification = (options) => {
776
+ const getCreateTotpFactorMutationKey = () => [`https://api.workos.com/_widgets/UserProfile/create-totp-factor`];
777
+ const useCreateTotpFactor = (options) => {
778
+ const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
779
+ const swrKey = swrOptions?.swrKey ?? getCreateTotpFactorMutationKey();
780
+ const swrFn = getCreateTotpFactorMutationFetcher(fetchOptions);
781
+ const query = useSWRMutation(swrKey, swrFn, swrOptions);
782
+ return {
783
+ swrKey,
784
+ ...query
785
+ };
786
+ };
787
+ const getMeUrl = () => {
788
+ return `https://api.workos.com/_widgets/UserProfile/me`;
789
+ };
790
+ const me = async (options) => {
791
+ const res = await fetch(getMeUrl(), {
792
+ ...options,
793
+ method: "GET"
794
+ });
795
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
796
+ const data = body ? JSON.parse(body) : {};
797
+ return { data, status: res.status, headers: res.headers };
798
+ };
799
+ const getMeKey = () => [`https://api.workos.com/_widgets/UserProfile/me`];
800
+ const useMe = (options) => {
867
801
  const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
868
- const swrKey = swrOptions?.swrKey ?? getSendVerificationMutationKey();
869
- const swrFn = getSendVerificationMutationFetcher(fetchOptions);
870
- const query = useSWRMutation(swrKey, swrFn, swrOptions);
802
+ const isEnabled = swrOptions?.enabled !== false;
803
+ const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getMeKey() : null);
804
+ const swrFn = () => me(fetchOptions);
805
+ const query = useSwr(
806
+ swrKey,
807
+ swrFn,
808
+ swrOptions
809
+ );
871
810
  return {
872
811
  swrKey,
873
812
  ...query
874
813
  };
875
814
  };
876
- const getVerifyUrl = () => {
877
- return `https://api.workos.com/_widgets/UserProfile/verify`;
815
+ const getUpdateMeUrl = () => {
816
+ return `https://api.workos.com/_widgets/UserProfile/me`;
878
817
  };
879
- const verify = async (verifyRequest, options) => {
880
- const res = await fetch(getVerifyUrl(), {
818
+ const updateMe = async (updateMeBody, options) => {
819
+ const res = await fetch(getUpdateMeUrl(), {
881
820
  ...options,
882
821
  method: "POST",
883
822
  headers: { "Content-Type": "application/json", ...options?.headers },
884
- body: JSON.stringify(verifyRequest)
823
+ body: JSON.stringify(updateMeBody)
885
824
  });
886
825
  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
887
826
  const data = body ? JSON.parse(body) : {};
888
827
  return { data, status: res.status, headers: res.headers };
889
828
  };
890
- const getVerifyMutationFetcher = (options) => {
829
+ const getUpdateMeMutationFetcher = (options) => {
891
830
  return (_, { arg }) => {
892
- return verify(arg, options);
831
+ return updateMe(arg, options);
893
832
  };
894
833
  };
895
- const getVerifyMutationKey = () => [`https://api.workos.com/_widgets/UserProfile/verify`];
896
- const useVerify = (options) => {
834
+ const getUpdateMeMutationKey = () => [`https://api.workos.com/_widgets/UserProfile/me`];
835
+ const useUpdateMe = (options) => {
897
836
  const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
898
- const swrKey = swrOptions?.swrKey ?? getVerifyMutationKey();
899
- const swrFn = getVerifyMutationFetcher(fetchOptions);
837
+ const swrKey = swrOptions?.swrKey ?? getUpdateMeMutationKey();
838
+ const swrFn = getUpdateMeMutationFetcher(fetchOptions);
900
839
  const query = useSWRMutation(swrKey, swrFn, swrOptions);
901
840
  return {
902
841
  swrKey,
@@ -1003,11 +942,43 @@ const useDeletePasskey = (passkeyId, options) => {
1003
942
  ...query
1004
943
  };
1005
944
  };
1006
- const getSettingsUrl = () => {
1007
- return `https://api.workos.com/_widgets/settings`;
945
+ const getSendVerificationUrl = () => {
946
+ return `https://api.workos.com/_widgets/UserProfile/send-verification`;
1008
947
  };
1009
- const settings = async (options) => {
1010
- const res = await fetch(getSettingsUrl(), {
948
+ const sendVerification = async (options) => {
949
+ const res = await fetch(getSendVerificationUrl(), {
950
+ ...options,
951
+ method: "POST"
952
+ });
953
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
954
+ const data = body ? JSON.parse(body) : {};
955
+ return {
956
+ data,
957
+ status: res.status,
958
+ headers: res.headers
959
+ };
960
+ };
961
+ const getSendVerificationMutationFetcher = (options) => {
962
+ return (_, __) => {
963
+ return sendVerification(options);
964
+ };
965
+ };
966
+ const getSendVerificationMutationKey = () => [`https://api.workos.com/_widgets/UserProfile/send-verification`];
967
+ const useSendVerification = (options) => {
968
+ const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
969
+ const swrKey = swrOptions?.swrKey ?? getSendVerificationMutationKey();
970
+ const swrFn = getSendVerificationMutationFetcher(fetchOptions);
971
+ const query = useSWRMutation(swrKey, swrFn, swrOptions);
972
+ return {
973
+ swrKey,
974
+ ...query
975
+ };
976
+ };
977
+ const getSessionsUrl = () => {
978
+ return `https://api.workos.com/_widgets/UserProfile/sessions`;
979
+ };
980
+ const sessions = async (options) => {
981
+ const res = await fetch(getSessionsUrl(), {
1011
982
  ...options,
1012
983
  method: "GET"
1013
984
  });
@@ -1015,12 +986,12 @@ const settings = async (options) => {
1015
986
  const data = body ? JSON.parse(body) : {};
1016
987
  return { data, status: res.status, headers: res.headers };
1017
988
  };
1018
- const getSettingsKey = () => [`https://api.workos.com/_widgets/settings`];
1019
- const useSettings = (options) => {
989
+ const getSessionsKey = () => [`https://api.workos.com/_widgets/UserProfile/sessions`];
990
+ const useSessions = (options) => {
1020
991
  const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
1021
992
  const isEnabled = swrOptions?.enabled !== false;
1022
- const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getSettingsKey() : null);
1023
- const swrFn = () => settings(fetchOptions);
993
+ const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getSessionsKey() : null);
994
+ const swrFn = () => sessions(fetchOptions);
1024
995
  const query = useSwr(
1025
996
  swrKey,
1026
997
  swrFn,
@@ -1031,13 +1002,15 @@ const useSettings = (options) => {
1031
1002
  ...query
1032
1003
  };
1033
1004
  };
1034
- const getListOrganizationDomainsUrl = () => {
1035
- return `https://api.workos.com/_widgets/admin-portal/organization-domains`;
1005
+ const getRevokeAllSessionsUrl = () => {
1006
+ return `https://api.workos.com/_widgets/UserProfile/sessions/revoke-all`;
1036
1007
  };
1037
- const listOrganizationDomains = async (options) => {
1038
- const res = await fetch(getListOrganizationDomainsUrl(), {
1008
+ const revokeAllSessions = async (revokeAllSessionsRequest, options) => {
1009
+ const res = await fetch(getRevokeAllSessionsUrl(), {
1039
1010
  ...options,
1040
- method: "GET"
1011
+ method: "DELETE",
1012
+ headers: { "Content-Type": "application/json", ...options?.headers },
1013
+ body: JSON.stringify(revokeAllSessionsRequest)
1041
1014
  });
1042
1015
  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
1043
1016
  const data = body ? JSON.parse(body) : {};
@@ -1047,38 +1020,29 @@ const listOrganizationDomains = async (options) => {
1047
1020
  headers: res.headers
1048
1021
  };
1049
1022
  };
1050
- const getListOrganizationDomainsKey = () => [
1051
- `https://api.workos.com/_widgets/admin-portal/organization-domains`
1052
- ];
1053
- const useListOrganizationDomains = (options) => {
1023
+ const getRevokeAllSessionsMutationFetcher = (options) => {
1024
+ return (_, { arg }) => {
1025
+ return revokeAllSessions(arg, options);
1026
+ };
1027
+ };
1028
+ const getRevokeAllSessionsMutationKey = () => [`https://api.workos.com/_widgets/UserProfile/sessions/revoke-all`];
1029
+ const useRevokeAllSessions = (options) => {
1054
1030
  const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
1055
- const isEnabled = swrOptions?.enabled !== false;
1056
- const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getListOrganizationDomainsKey() : null);
1057
- const swrFn = () => listOrganizationDomains(fetchOptions);
1058
- const query = useSwr(
1059
- swrKey,
1060
- swrFn,
1061
- swrOptions
1062
- );
1031
+ const swrKey = swrOptions?.swrKey ?? getRevokeAllSessionsMutationKey();
1032
+ const swrFn = getRevokeAllSessionsMutationFetcher(fetchOptions);
1033
+ const query = useSWRMutation(swrKey, swrFn, swrOptions);
1063
1034
  return {
1064
1035
  swrKey,
1065
1036
  ...query
1066
1037
  };
1067
1038
  };
1068
- const getGenerateAdminPortalLinkUrl = (params) => {
1069
- const normalizedParams = new URLSearchParams();
1070
- Object.entries(params || {}).forEach(([key, value]) => {
1071
- if (value !== void 0) {
1072
- normalizedParams.append(key, value === null ? "null" : value.toString());
1073
- }
1074
- });
1075
- const stringifiedParams = normalizedParams.toString();
1076
- return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/admin-portal/generate-link?${stringifiedParams}` : `https://api.workos.com/_widgets/admin-portal/generate-link`;
1039
+ const getRevokeSessionUrl = (sessionId) => {
1040
+ return `https://api.workos.com/_widgets/UserProfile/sessions/revoke/${sessionId}`;
1077
1041
  };
1078
- const generateAdminPortalLink = async (params, options) => {
1079
- const res = await fetch(getGenerateAdminPortalLinkUrl(params), {
1042
+ const revokeSession = async (sessionId, options) => {
1043
+ const res = await fetch(getRevokeSessionUrl(sessionId), {
1080
1044
  ...options,
1081
- method: "POST"
1045
+ method: "DELETE"
1082
1046
  });
1083
1047
  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
1084
1048
  const data = body ? JSON.parse(body) : {};
@@ -1088,30 +1052,29 @@ const generateAdminPortalLink = async (params, options) => {
1088
1052
  headers: res.headers
1089
1053
  };
1090
1054
  };
1091
- const getGenerateAdminPortalLinkMutationFetcher = (params, options) => {
1055
+ const getRevokeSessionMutationFetcher = (sessionId, options) => {
1092
1056
  return (_, __) => {
1093
- return generateAdminPortalLink(params, options);
1057
+ return revokeSession(sessionId, options);
1094
1058
  };
1095
1059
  };
1096
- const getGenerateAdminPortalLinkMutationKey = (params) => [
1097
- `https://api.workos.com/_widgets/admin-portal/generate-link`,
1098
- ...params ? [params] : []
1060
+ const getRevokeSessionMutationKey = (sessionId) => [
1061
+ `https://api.workos.com/_widgets/UserProfile/sessions/revoke/${sessionId}`
1099
1062
  ];
1100
- const useGenerateAdminPortalLink = (params, options) => {
1063
+ const useRevokeSession = (sessionId, options) => {
1101
1064
  const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
1102
- const swrKey = swrOptions?.swrKey ?? getGenerateAdminPortalLinkMutationKey(params);
1103
- const swrFn = getGenerateAdminPortalLinkMutationFetcher(params, fetchOptions);
1065
+ const swrKey = swrOptions?.swrKey ?? getRevokeSessionMutationKey(sessionId);
1066
+ const swrFn = getRevokeSessionMutationFetcher(sessionId, fetchOptions);
1104
1067
  const query = useSWRMutation(swrKey, swrFn, swrOptions);
1105
1068
  return {
1106
1069
  swrKey,
1107
1070
  ...query
1108
1071
  };
1109
1072
  };
1110
- const getDeleteOrganizationDomainUrl = (domainId) => {
1111
- return `https://api.workos.com/_widgets/admin-portal/organization-domains/${domainId}`;
1073
+ const getDeleteTotpFactorsUrl = () => {
1074
+ return `https://api.workos.com/_widgets/UserProfile/totp-factors`;
1112
1075
  };
1113
- const deleteOrganizationDomain = async (domainId, options) => {
1114
- const res = await fetch(getDeleteOrganizationDomainUrl(domainId), {
1076
+ const deleteTotpFactors = async (options) => {
1077
+ const res = await fetch(getDeleteTotpFactorsUrl(), {
1115
1078
  ...options,
1116
1079
  method: "DELETE"
1117
1080
  });
@@ -1123,34 +1086,95 @@ const deleteOrganizationDomain = async (domainId, options) => {
1123
1086
  headers: res.headers
1124
1087
  };
1125
1088
  };
1126
- const getDeleteOrganizationDomainMutationFetcher = (domainId, options) => {
1089
+ const getDeleteTotpFactorsMutationFetcher = (options) => {
1127
1090
  return (_, __) => {
1128
- return deleteOrganizationDomain(domainId, options);
1091
+ return deleteTotpFactors(options);
1129
1092
  };
1130
1093
  };
1131
- const getDeleteOrganizationDomainMutationKey = (domainId) => [
1132
- `https://api.workos.com/_widgets/admin-portal/organization-domains/${domainId}`
1133
- ];
1134
- const useDeleteOrganizationDomain = (domainId, options) => {
1094
+ const getDeleteTotpFactorsMutationKey = () => [`https://api.workos.com/_widgets/UserProfile/totp-factors`];
1095
+ const useDeleteTotpFactors = (options) => {
1135
1096
  const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
1136
- const swrKey = swrOptions?.swrKey ?? getDeleteOrganizationDomainMutationKey(domainId);
1137
- const swrFn = getDeleteOrganizationDomainMutationFetcher(
1138
- domainId,
1139
- fetchOptions
1140
- );
1097
+ const swrKey = swrOptions?.swrKey ?? getDeleteTotpFactorsMutationKey();
1098
+ const swrFn = getDeleteTotpFactorsMutationFetcher(fetchOptions);
1141
1099
  const query = useSWRMutation(swrKey, swrFn, swrOptions);
1142
1100
  return {
1143
1101
  swrKey,
1144
1102
  ...query
1145
1103
  };
1146
1104
  };
1147
- const getReverifyOrganizationDomainUrl = (domainId) => {
1148
- return `https://api.workos.com/_widgets/admin-portal/organization-domains/${domainId}/reverify`;
1105
+ const getUpdatePasswordUrl = () => {
1106
+ return `https://api.workos.com/_widgets/UserProfile/update-password`;
1149
1107
  };
1150
- const reverifyOrganizationDomain = async (domainId, options) => {
1151
- const res = await fetch(getReverifyOrganizationDomainUrl(domainId), {
1108
+ const updatePassword = async (updatePasswordRequest, options) => {
1109
+ const res = await fetch(getUpdatePasswordUrl(), {
1152
1110
  ...options,
1153
- method: "POST"
1111
+ method: "POST",
1112
+ headers: { "Content-Type": "application/json", ...options?.headers },
1113
+ body: JSON.stringify(updatePasswordRequest)
1114
+ });
1115
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
1116
+ const data = body ? JSON.parse(body) : {};
1117
+ return {
1118
+ data,
1119
+ status: res.status,
1120
+ headers: res.headers
1121
+ };
1122
+ };
1123
+ const getUpdatePasswordMutationFetcher = (options) => {
1124
+ return (_, { arg }) => {
1125
+ return updatePassword(arg, options);
1126
+ };
1127
+ };
1128
+ const getUpdatePasswordMutationKey = () => [`https://api.workos.com/_widgets/UserProfile/update-password`];
1129
+ const useUpdatePassword = (options) => {
1130
+ const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
1131
+ const swrKey = swrOptions?.swrKey ?? getUpdatePasswordMutationKey();
1132
+ const swrFn = getUpdatePasswordMutationFetcher(fetchOptions);
1133
+ const query = useSWRMutation(swrKey, swrFn, swrOptions);
1134
+ return {
1135
+ swrKey,
1136
+ ...query
1137
+ };
1138
+ };
1139
+ const getVerifyUrl = () => {
1140
+ return `https://api.workos.com/_widgets/UserProfile/verify`;
1141
+ };
1142
+ const verify = async (verifyRequest, options) => {
1143
+ const res = await fetch(getVerifyUrl(), {
1144
+ ...options,
1145
+ method: "POST",
1146
+ headers: { "Content-Type": "application/json", ...options?.headers },
1147
+ body: JSON.stringify(verifyRequest)
1148
+ });
1149
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
1150
+ const data = body ? JSON.parse(body) : {};
1151
+ return { data, status: res.status, headers: res.headers };
1152
+ };
1153
+ const getVerifyMutationFetcher = (options) => {
1154
+ return (_, { arg }) => {
1155
+ return verify(arg, options);
1156
+ };
1157
+ };
1158
+ const getVerifyMutationKey = () => [`https://api.workos.com/_widgets/UserProfile/verify`];
1159
+ const useVerify = (options) => {
1160
+ const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
1161
+ const swrKey = swrOptions?.swrKey ?? getVerifyMutationKey();
1162
+ const swrFn = getVerifyMutationFetcher(fetchOptions);
1163
+ const query = useSWRMutation(swrKey, swrFn, swrOptions);
1164
+ return {
1165
+ swrKey,
1166
+ ...query
1167
+ };
1168
+ };
1169
+ const getVerifyTotpFactorUrl = () => {
1170
+ return `https://api.workos.com/_widgets/UserProfile/verify-totp-factor`;
1171
+ };
1172
+ const verifyTotpFactor = async (verifyTotpFactorRequest, options) => {
1173
+ const res = await fetch(getVerifyTotpFactorUrl(), {
1174
+ ...options,
1175
+ method: "POST",
1176
+ headers: { "Content-Type": "application/json", ...options?.headers },
1177
+ body: JSON.stringify(verifyTotpFactorRequest)
1154
1178
  });
1155
1179
  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
1156
1180
  const data = body ? JSON.parse(body) : {};
@@ -1160,32 +1184,27 @@ const reverifyOrganizationDomain = async (domainId, options) => {
1160
1184
  headers: res.headers
1161
1185
  };
1162
1186
  };
1163
- const getReverifyOrganizationDomainMutationFetcher = (domainId, options) => {
1164
- return (_, __) => {
1165
- return reverifyOrganizationDomain(domainId, options);
1187
+ const getVerifyTotpFactorMutationFetcher = (options) => {
1188
+ return (_, { arg }) => {
1189
+ return verifyTotpFactor(arg, options);
1166
1190
  };
1167
1191
  };
1168
- const getReverifyOrganizationDomainMutationKey = (domainId) => [
1169
- `https://api.workos.com/_widgets/admin-portal/organization-domains/${domainId}/reverify`
1170
- ];
1171
- const useReverifyOrganizationDomain = (domainId, options) => {
1192
+ const getVerifyTotpFactorMutationKey = () => [`https://api.workos.com/_widgets/UserProfile/verify-totp-factor`];
1193
+ const useVerifyTotpFactor = (options) => {
1172
1194
  const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
1173
- const swrKey = swrOptions?.swrKey ?? getReverifyOrganizationDomainMutationKey(domainId);
1174
- const swrFn = getReverifyOrganizationDomainMutationFetcher(
1175
- domainId,
1176
- fetchOptions
1177
- );
1195
+ const swrKey = swrOptions?.swrKey ?? getVerifyTotpFactorMutationKey();
1196
+ const swrFn = getVerifyTotpFactorMutationFetcher(fetchOptions);
1178
1197
  const query = useSWRMutation(swrKey, swrFn, swrOptions);
1179
1198
  return {
1180
1199
  swrKey,
1181
1200
  ...query
1182
1201
  };
1183
1202
  };
1184
- const getListSsoConnectionsUrl = () => {
1185
- return `https://api.workos.com/_widgets/admin-portal/sso-connections`;
1203
+ const getGetAuditLogStreamUrl = () => {
1204
+ return `https://api.workos.com/_widgets/admin-portal/audit-log-stream`;
1186
1205
  };
1187
- const listSsoConnections = async (options) => {
1188
- const res = await fetch(getListSsoConnectionsUrl(), {
1206
+ const getAuditLogStream = async (options) => {
1207
+ const res = await fetch(getGetAuditLogStreamUrl(), {
1189
1208
  ...options,
1190
1209
  method: "GET"
1191
1210
  });
@@ -1197,12 +1216,12 @@ const listSsoConnections = async (options) => {
1197
1216
  headers: res.headers
1198
1217
  };
1199
1218
  };
1200
- const getListSsoConnectionsKey = () => [`https://api.workos.com/_widgets/admin-portal/sso-connections`];
1201
- const useListSsoConnections = (options) => {
1219
+ const getGetAuditLogStreamKey = () => [`https://api.workos.com/_widgets/admin-portal/audit-log-stream`];
1220
+ const useGetAuditLogStream = (options) => {
1202
1221
  const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
1203
1222
  const isEnabled = swrOptions?.enabled !== false;
1204
- const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getListSsoConnectionsKey() : null);
1205
- const swrFn = () => listSsoConnections(fetchOptions);
1223
+ const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getGetAuditLogStreamKey() : null);
1224
+ const swrFn = () => getAuditLogStream(fetchOptions);
1206
1225
  const query = useSwr(
1207
1226
  swrKey,
1208
1227
  swrFn,
@@ -1213,15 +1232,20 @@ const useListSsoConnections = (options) => {
1213
1232
  ...query
1214
1233
  };
1215
1234
  };
1216
- const getCreateOrganizationApiKeyUrl = () => {
1217
- return `https://api.workos.com/_widgets/ApiKeys/organization-api-keys`;
1235
+ const getGenerateAdminPortalLinkUrl = (params) => {
1236
+ const normalizedParams = new URLSearchParams();
1237
+ Object.entries(params || {}).forEach(([key, value]) => {
1238
+ if (value !== void 0) {
1239
+ normalizedParams.append(key, value === null ? "null" : value.toString());
1240
+ }
1241
+ });
1242
+ const stringifiedParams = normalizedParams.toString();
1243
+ return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/admin-portal/generate-link?${stringifiedParams}` : `https://api.workos.com/_widgets/admin-portal/generate-link`;
1218
1244
  };
1219
- const createOrganizationApiKey = async (createOrganizationApiKeyRequest, options) => {
1220
- const res = await fetch(getCreateOrganizationApiKeyUrl(), {
1245
+ const generateAdminPortalLink = async (params, options) => {
1246
+ const res = await fetch(getGenerateAdminPortalLinkUrl(params), {
1221
1247
  ...options,
1222
- method: "POST",
1223
- headers: { "Content-Type": "application/json", ...options?.headers },
1224
- body: JSON.stringify(createOrganizationApiKeyRequest)
1248
+ method: "POST"
1225
1249
  });
1226
1250
  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
1227
1251
  const data = body ? JSON.parse(body) : {};
@@ -1231,34 +1255,30 @@ const createOrganizationApiKey = async (createOrganizationApiKeyRequest, options
1231
1255
  headers: res.headers
1232
1256
  };
1233
1257
  };
1234
- const getCreateOrganizationApiKeyMutationFetcher = (options) => {
1235
- return (_, { arg }) => {
1236
- return createOrganizationApiKey(arg, options);
1258
+ const getGenerateAdminPortalLinkMutationFetcher = (params, options) => {
1259
+ return (_, __) => {
1260
+ return generateAdminPortalLink(params, options);
1237
1261
  };
1238
1262
  };
1239
- const getCreateOrganizationApiKeyMutationKey = () => [`https://api.workos.com/_widgets/ApiKeys/organization-api-keys`];
1240
- const useCreateOrganizationApiKey = (options) => {
1263
+ const getGenerateAdminPortalLinkMutationKey = (params) => [
1264
+ `https://api.workos.com/_widgets/admin-portal/generate-link`,
1265
+ ...params ? [params] : []
1266
+ ];
1267
+ const useGenerateAdminPortalLink = (params, options) => {
1241
1268
  const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
1242
- const swrKey = swrOptions?.swrKey ?? getCreateOrganizationApiKeyMutationKey();
1243
- const swrFn = getCreateOrganizationApiKeyMutationFetcher(fetchOptions);
1269
+ const swrKey = swrOptions?.swrKey ?? getGenerateAdminPortalLinkMutationKey(params);
1270
+ const swrFn = getGenerateAdminPortalLinkMutationFetcher(params, fetchOptions);
1244
1271
  const query = useSWRMutation(swrKey, swrFn, swrOptions);
1245
1272
  return {
1246
1273
  swrKey,
1247
1274
  ...query
1248
1275
  };
1249
1276
  };
1250
- const getListOrganizationApiKeysUrl = (params) => {
1251
- const normalizedParams = new URLSearchParams();
1252
- Object.entries(params || {}).forEach(([key, value]) => {
1253
- if (value !== void 0) {
1254
- normalizedParams.append(key, value === null ? "null" : value.toString());
1255
- }
1256
- });
1257
- const stringifiedParams = normalizedParams.toString();
1258
- return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/ApiKeys/organization-api-keys?${stringifiedParams}` : `https://api.workos.com/_widgets/ApiKeys/organization-api-keys`;
1277
+ const getListOrganizationDomainsUrl = () => {
1278
+ return `https://api.workos.com/_widgets/admin-portal/organization-domains`;
1259
1279
  };
1260
- const listOrganizationApiKeys = async (params, options) => {
1261
- const res = await fetch(getListOrganizationApiKeysUrl(params), {
1280
+ const listOrganizationDomains = async (options) => {
1281
+ const res = await fetch(getListOrganizationDomainsUrl(), {
1262
1282
  ...options,
1263
1283
  method: "GET"
1264
1284
  });
@@ -1270,15 +1290,14 @@ const listOrganizationApiKeys = async (params, options) => {
1270
1290
  headers: res.headers
1271
1291
  };
1272
1292
  };
1273
- const getListOrganizationApiKeysKey = (params) => [
1274
- `https://api.workos.com/_widgets/ApiKeys/organization-api-keys`,
1275
- ...params ? [params] : []
1293
+ const getListOrganizationDomainsKey = () => [
1294
+ `https://api.workos.com/_widgets/admin-portal/organization-domains`
1276
1295
  ];
1277
- const useListOrganizationApiKeys = (params, options) => {
1296
+ const useListOrganizationDomains = (options) => {
1278
1297
  const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
1279
1298
  const isEnabled = swrOptions?.enabled !== false;
1280
- const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getListOrganizationApiKeysKey(params) : null);
1281
- const swrFn = () => listOrganizationApiKeys(params, fetchOptions);
1299
+ const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getListOrganizationDomainsKey() : null);
1300
+ const swrFn = () => listOrganizationDomains(fetchOptions);
1282
1301
  const query = useSwr(
1283
1302
  swrKey,
1284
1303
  swrFn,
@@ -1289,20 +1308,13 @@ const useListOrganizationApiKeys = (params, options) => {
1289
1308
  ...query
1290
1309
  };
1291
1310
  };
1292
- const getListOrganizationApiKeyPermissionsUrl = (params) => {
1293
- const normalizedParams = new URLSearchParams();
1294
- Object.entries(params || {}).forEach(([key, value]) => {
1295
- if (value !== void 0) {
1296
- normalizedParams.append(key, value === null ? "null" : value.toString());
1297
- }
1298
- });
1299
- const stringifiedParams = normalizedParams.toString();
1300
- return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/ApiKeys/permissions?${stringifiedParams}` : `https://api.workos.com/_widgets/ApiKeys/permissions`;
1311
+ const getDeleteOrganizationDomainUrl = (domainId) => {
1312
+ return `https://api.workos.com/_widgets/admin-portal/organization-domains/${domainId}`;
1301
1313
  };
1302
- const listOrganizationApiKeyPermissions = async (params, options) => {
1303
- const res = await fetch(getListOrganizationApiKeyPermissionsUrl(params), {
1314
+ const deleteOrganizationDomain = async (domainId, options) => {
1315
+ const res = await fetch(getDeleteOrganizationDomainUrl(domainId), {
1304
1316
  ...options,
1305
- method: "GET"
1317
+ method: "DELETE"
1306
1318
  });
1307
1319
  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
1308
1320
  const data = body ? JSON.parse(body) : {};
@@ -1312,32 +1324,34 @@ const listOrganizationApiKeyPermissions = async (params, options) => {
1312
1324
  headers: res.headers
1313
1325
  };
1314
1326
  };
1315
- const getListOrganizationApiKeyPermissionsKey = (params) => [
1316
- `https://api.workos.com/_widgets/ApiKeys/permissions`,
1317
- ...params ? [params] : []
1327
+ const getDeleteOrganizationDomainMutationFetcher = (domainId, options) => {
1328
+ return (_, __) => {
1329
+ return deleteOrganizationDomain(domainId, options);
1330
+ };
1331
+ };
1332
+ const getDeleteOrganizationDomainMutationKey = (domainId) => [
1333
+ `https://api.workos.com/_widgets/admin-portal/organization-domains/${domainId}`
1318
1334
  ];
1319
- const useListOrganizationApiKeyPermissions = (params, options) => {
1335
+ const useDeleteOrganizationDomain = (domainId, options) => {
1320
1336
  const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
1321
- const isEnabled = swrOptions?.enabled !== false;
1322
- const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getListOrganizationApiKeyPermissionsKey(params) : null);
1323
- const swrFn = () => listOrganizationApiKeyPermissions(params, fetchOptions);
1324
- const query = useSwr(
1325
- swrKey,
1326
- swrFn,
1327
- swrOptions
1337
+ const swrKey = swrOptions?.swrKey ?? getDeleteOrganizationDomainMutationKey(domainId);
1338
+ const swrFn = getDeleteOrganizationDomainMutationFetcher(
1339
+ domainId,
1340
+ fetchOptions
1328
1341
  );
1342
+ const query = useSWRMutation(swrKey, swrFn, swrOptions);
1329
1343
  return {
1330
1344
  swrKey,
1331
1345
  ...query
1332
1346
  };
1333
1347
  };
1334
- const getDeleteOrganizationApiKeyUrl = (apiKeyId) => {
1335
- return `https://api.workos.com/_widgets/ApiKeys/${apiKeyId}`;
1348
+ const getReverifyOrganizationDomainUrl = (domainId) => {
1349
+ return `https://api.workos.com/_widgets/admin-portal/organization-domains/${domainId}/reverify`;
1336
1350
  };
1337
- const deleteOrganizationApiKey = async (apiKeyId, options) => {
1338
- const res = await fetch(getDeleteOrganizationApiKeyUrl(apiKeyId), {
1351
+ const reverifyOrganizationDomain = async (domainId, options) => {
1352
+ const res = await fetch(getReverifyOrganizationDomainUrl(domainId), {
1339
1353
  ...options,
1340
- method: "DELETE"
1354
+ method: "POST"
1341
1355
  });
1342
1356
  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
1343
1357
  const data = body ? JSON.parse(body) : {};
@@ -1347,17 +1361,19 @@ const deleteOrganizationApiKey = async (apiKeyId, options) => {
1347
1361
  headers: res.headers
1348
1362
  };
1349
1363
  };
1350
- const getDeleteOrganizationApiKeyMutationFetcher = (apiKeyId, options) => {
1364
+ const getReverifyOrganizationDomainMutationFetcher = (domainId, options) => {
1351
1365
  return (_, __) => {
1352
- return deleteOrganizationApiKey(apiKeyId, options);
1366
+ return reverifyOrganizationDomain(domainId, options);
1353
1367
  };
1354
1368
  };
1355
- const getDeleteOrganizationApiKeyMutationKey = (apiKeyId) => [`https://api.workos.com/_widgets/ApiKeys/${apiKeyId}`];
1356
- const useDeleteOrganizationApiKey = (apiKeyId, options) => {
1369
+ const getReverifyOrganizationDomainMutationKey = (domainId) => [
1370
+ `https://api.workos.com/_widgets/admin-portal/organization-domains/${domainId}/reverify`
1371
+ ];
1372
+ const useReverifyOrganizationDomain = (domainId, options) => {
1357
1373
  const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
1358
- const swrKey = swrOptions?.swrKey ?? getDeleteOrganizationApiKeyMutationKey(apiKeyId);
1359
- const swrFn = getDeleteOrganizationApiKeyMutationFetcher(
1360
- apiKeyId,
1374
+ const swrKey = swrOptions?.swrKey ?? getReverifyOrganizationDomainMutationKey(domainId);
1375
+ const swrFn = getReverifyOrganizationDomainMutationFetcher(
1376
+ domainId,
1361
1377
  fetchOptions
1362
1378
  );
1363
1379
  const query = useSWRMutation(swrKey, swrFn, swrOptions);
@@ -1366,11 +1382,11 @@ const useDeleteOrganizationApiKey = (apiKeyId, options) => {
1366
1382
  ...query
1367
1383
  };
1368
1384
  };
1369
- const getMyDataIntegrationsUrl = () => {
1370
- return `https://api.workos.com/_widgets/DataIntegrations/mine`;
1385
+ const getListSsoConnectionsUrl = () => {
1386
+ return `https://api.workos.com/_widgets/admin-portal/sso-connections`;
1371
1387
  };
1372
- const myDataIntegrations = async (options) => {
1373
- const res = await fetch(getMyDataIntegrationsUrl(), {
1388
+ const listSsoConnections = async (options) => {
1389
+ const res = await fetch(getListSsoConnectionsUrl(), {
1374
1390
  ...options,
1375
1391
  method: "GET"
1376
1392
  });
@@ -1382,12 +1398,12 @@ const myDataIntegrations = async (options) => {
1382
1398
  headers: res.headers
1383
1399
  };
1384
1400
  };
1385
- const getMyDataIntegrationsKey = () => [`https://api.workos.com/_widgets/DataIntegrations/mine`];
1386
- const useMyDataIntegrations = (options) => {
1401
+ const getListSsoConnectionsKey = () => [`https://api.workos.com/_widgets/admin-portal/sso-connections`];
1402
+ const useListSsoConnections = (options) => {
1387
1403
  const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
1388
1404
  const isEnabled = swrOptions?.enabled !== false;
1389
- const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getMyDataIntegrationsKey() : null);
1390
- const swrFn = () => myDataIntegrations(fetchOptions);
1405
+ const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getListSsoConnectionsKey() : null);
1406
+ const swrFn = () => listSsoConnections(fetchOptions);
1391
1407
  const query = useSwr(
1392
1408
  swrKey,
1393
1409
  swrFn,
@@ -1398,18 +1414,11 @@ const useMyDataIntegrations = (options) => {
1398
1414
  ...query
1399
1415
  };
1400
1416
  };
1401
- const getGetDataIntegrationAuthorizeUrlUrl = (slug, params) => {
1402
- const normalizedParams = new URLSearchParams();
1403
- Object.entries(params || {}).forEach(([key, value]) => {
1404
- if (value !== void 0) {
1405
- normalizedParams.append(key, value === null ? "null" : value.toString());
1406
- }
1407
- });
1408
- const stringifiedParams = normalizedParams.toString();
1409
- return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/DataIntegrations/${slug}/authorize?${stringifiedParams}` : `https://api.workos.com/_widgets/DataIntegrations/${slug}/authorize`;
1417
+ const getListDirectoriesUrl = () => {
1418
+ return `https://api.workos.com/_widgets/directory-sync/directories`;
1410
1419
  };
1411
- const getDataIntegrationAuthorizeUrl = async (slug, params, options) => {
1412
- const res = await fetch(getGetDataIntegrationAuthorizeUrlUrl(slug, params), {
1420
+ const listDirectories = async (options) => {
1421
+ const res = await fetch(getListDirectoriesUrl(), {
1413
1422
  ...options,
1414
1423
  method: "GET"
1415
1424
  });
@@ -1421,15 +1430,12 @@ const getDataIntegrationAuthorizeUrl = async (slug, params, options) => {
1421
1430
  headers: res.headers
1422
1431
  };
1423
1432
  };
1424
- const getGetDataIntegrationAuthorizeUrlKey = (slug, params) => [
1425
- `https://api.workos.com/_widgets/DataIntegrations/${slug}/authorize`,
1426
- ...params ? [params] : []
1427
- ];
1428
- const useGetDataIntegrationAuthorizeUrl = (slug, params, options) => {
1433
+ const getListDirectoriesKey = () => [`https://api.workos.com/_widgets/directory-sync/directories`];
1434
+ const useListDirectories = (options) => {
1429
1435
  const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
1430
- const isEnabled = swrOptions?.enabled !== false && !!slug;
1431
- const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getGetDataIntegrationAuthorizeUrlKey(slug, params) : null);
1432
- const swrFn = () => getDataIntegrationAuthorizeUrl(slug, params, fetchOptions);
1436
+ const isEnabled = swrOptions?.enabled !== false;
1437
+ const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getListDirectoriesKey() : null);
1438
+ const swrFn = () => listDirectories(fetchOptions);
1433
1439
  const query = useSwr(
1434
1440
  swrKey,
1435
1441
  swrFn,
@@ -1440,17 +1446,14 @@ const useGetDataIntegrationAuthorizeUrl = (slug, params, options) => {
1440
1446
  ...query
1441
1447
  };
1442
1448
  };
1443
- const getGetDataInstallationAuthorizationStatusUrl = (dataIntegrationId, state) => {
1444
- return `https://api.workos.com/_widgets/DataIntegrations/${dataIntegrationId}/authorization-status/${state}`;
1449
+ const getGetDirectoryUrl = (directoryId) => {
1450
+ return `https://api.workos.com/_widgets/directory-sync/directories/${directoryId}`;
1445
1451
  };
1446
- const getDataInstallationAuthorizationStatus = async (dataIntegrationId, state, options) => {
1447
- const res = await fetch(
1448
- getGetDataInstallationAuthorizationStatusUrl(dataIntegrationId, state),
1449
- {
1450
- ...options,
1451
- method: "GET"
1452
- }
1453
- );
1452
+ const getDirectory = async (directoryId, options) => {
1453
+ const res = await fetch(getGetDirectoryUrl(directoryId), {
1454
+ ...options,
1455
+ method: "GET"
1456
+ });
1454
1457
  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
1455
1458
  const data = body ? JSON.parse(body) : {};
1456
1459
  return {
@@ -1459,18 +1462,14 @@ const getDataInstallationAuthorizationStatus = async (dataIntegrationId, state,
1459
1462
  headers: res.headers
1460
1463
  };
1461
1464
  };
1462
- const getGetDataInstallationAuthorizationStatusKey = (dataIntegrationId, state) => [
1463
- `https://api.workos.com/_widgets/DataIntegrations/${dataIntegrationId}/authorization-status/${state}`
1465
+ const getGetDirectoryKey = (directoryId) => [
1466
+ `https://api.workos.com/_widgets/directory-sync/directories/${directoryId}`
1464
1467
  ];
1465
- const useGetDataInstallationAuthorizationStatus = (dataIntegrationId, state, options) => {
1468
+ const useGetDirectory = (directoryId, options) => {
1466
1469
  const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
1467
- const isEnabled = swrOptions?.enabled !== false && !!(dataIntegrationId && state);
1468
- const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getGetDataInstallationAuthorizationStatusKey(dataIntegrationId, state) : null);
1469
- const swrFn = () => getDataInstallationAuthorizationStatus(
1470
- dataIntegrationId,
1471
- state,
1472
- fetchOptions
1473
- );
1470
+ const isEnabled = swrOptions?.enabled !== false && !!directoryId;
1471
+ const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getGetDirectoryKey(directoryId) : null);
1472
+ const swrFn = () => getDirectory(directoryId, fetchOptions);
1474
1473
  const query = useSwr(
1475
1474
  swrKey,
1476
1475
  swrFn,
@@ -1481,56 +1480,37 @@ const useGetDataInstallationAuthorizationStatus = (dataIntegrationId, state, opt
1481
1480
  ...query
1482
1481
  };
1483
1482
  };
1484
- const getDeleteDataInstallationUrl = (installationId) => {
1485
- return `https://api.workos.com/_widgets/DataIntegrations/installations/${installationId}`;
1483
+ const getSettingsUrl = () => {
1484
+ return `https://api.workos.com/_widgets/settings`;
1486
1485
  };
1487
- const deleteDataInstallation = async (installationId, options) => {
1488
- const res = await fetch(getDeleteDataInstallationUrl(installationId), {
1486
+ const settings = async (options) => {
1487
+ const res = await fetch(getSettingsUrl(), {
1489
1488
  ...options,
1490
- method: "DELETE"
1489
+ method: "GET"
1491
1490
  });
1492
1491
  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
1493
1492
  const data = body ? JSON.parse(body) : {};
1494
- return {
1495
- data,
1496
- status: res.status,
1497
- headers: res.headers
1498
- };
1499
- };
1500
- const getDeleteDataInstallationMutationFetcher = (installationId, options) => {
1501
- return (_, __) => {
1502
- return deleteDataInstallation(installationId, options);
1503
- };
1493
+ return { data, status: res.status, headers: res.headers };
1504
1494
  };
1505
- const getDeleteDataInstallationMutationKey = (installationId) => [
1506
- `https://api.workos.com/_widgets/DataIntegrations/installations/${installationId}`
1507
- ];
1508
- const useDeleteDataInstallation = (installationId, options) => {
1495
+ const getSettingsKey = () => [`https://api.workos.com/_widgets/settings`];
1496
+ const useSettings = (options) => {
1509
1497
  const { swr: swrOptions, fetch: fetchOptions } = options ?? {};
1510
- const swrKey = swrOptions?.swrKey ?? getDeleteDataInstallationMutationKey(installationId);
1511
- const swrFn = getDeleteDataInstallationMutationFetcher(
1512
- installationId,
1513
- fetchOptions
1498
+ const isEnabled = swrOptions?.enabled !== false;
1499
+ const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getSettingsKey() : null);
1500
+ const swrFn = () => settings(fetchOptions);
1501
+ const query = useSwr(
1502
+ swrKey,
1503
+ swrFn,
1504
+ swrOptions
1514
1505
  );
1515
- const query = useSWRMutation(swrKey, swrFn, swrOptions);
1516
1506
  return {
1517
1507
  swrKey,
1518
1508
  ...query
1519
1509
  };
1520
1510
  };
1521
1511
  export {
1522
- AuthenticationInformationResponseDataVerificationMethodsMfaProvider,
1523
- AuthenticationInformationResponseDataVerificationMethodsPasskeyProvider,
1524
- AuthenticationInformationResponseDataVerificationMethodsPasswordProvider,
1525
- CreateTotpFactorResponseAuthenticationChallengeAllOfObject,
1526
- CreateTotpFactorResponseAuthenticationFactorAllOfObject,
1527
- CreateTotpFactorResponseAuthenticationFactorAllOfType,
1528
- DataInstallationObject,
1529
- DataInstallationState,
1530
- DataIntegrationCredentialsType,
1531
- DataIntegrationIntegrationType,
1532
- DataIntegrationObject,
1533
- DataIntegrationOwnership,
1512
+ DirectoryState,
1513
+ DirectoryType,
1534
1514
  DomainVerificationNameServer,
1535
1515
  GenerateAdminPortalLinkIntent,
1536
1516
  MemberActionsItem,
@@ -1538,14 +1518,6 @@ export {
1538
1518
  OidcSessionState,
1539
1519
  OrganizationDomainState,
1540
1520
  SamlSessionState,
1541
- SendVerificationResponseType,
1542
- SettingsResponseObject,
1543
- SsoConnectionAnyOfEightAllOfProviderTag,
1544
- SsoConnectionAnyOfEightAllOfState,
1545
- SsoConnectionAnyOfEightAllOfType,
1546
- SsoConnectionAnyOfProviderTag,
1547
- SsoConnectionAnyOfState,
1548
- SsoConnectionAnyOfType,
1549
1521
  SsoConnectionSessionJSONState,
1550
1522
  authenticationInformation,
1551
1523
  createOrganizationApiKey,
@@ -1557,6 +1529,7 @@ export {
1557
1529
  deletePasskey,
1558
1530
  deleteTotpFactors,
1559
1531
  generateAdminPortalLink,
1532
+ getAuditLogStream,
1560
1533
  getAuthenticationInformationKey,
1561
1534
  getAuthenticationInformationUrl,
1562
1535
  getCreateOrganizationApiKeyMutationFetcher,
@@ -1585,16 +1558,23 @@ export {
1585
1558
  getDeleteTotpFactorsMutationFetcher,
1586
1559
  getDeleteTotpFactorsMutationKey,
1587
1560
  getDeleteTotpFactorsUrl,
1561
+ getDirectory,
1588
1562
  getGenerateAdminPortalLinkMutationFetcher,
1589
1563
  getGenerateAdminPortalLinkMutationKey,
1590
1564
  getGenerateAdminPortalLinkUrl,
1565
+ getGetAuditLogStreamKey,
1566
+ getGetAuditLogStreamUrl,
1591
1567
  getGetDataInstallationAuthorizationStatusKey,
1592
1568
  getGetDataInstallationAuthorizationStatusUrl,
1593
1569
  getGetDataIntegrationAuthorizeUrlKey,
1594
1570
  getGetDataIntegrationAuthorizeUrlUrl,
1571
+ getGetDirectoryKey,
1572
+ getGetDirectoryUrl,
1595
1573
  getInviteMemberMutationFetcher,
1596
1574
  getInviteMemberMutationKey,
1597
1575
  getInviteMemberUrl,
1576
+ getListDirectoriesKey,
1577
+ getListDirectoriesUrl,
1598
1578
  getListOrganizationApiKeyPermissionsKey,
1599
1579
  getListOrganizationApiKeyPermissionsUrl,
1600
1580
  getListOrganizationApiKeysKey,
@@ -1662,6 +1642,7 @@ export {
1662
1642
  getVerifyTotpFactorUrl,
1663
1643
  getVerifyUrl,
1664
1644
  inviteMember,
1645
+ listDirectories,
1665
1646
  listOrganizationApiKeyPermissions,
1666
1647
  listOrganizationApiKeys,
1667
1648
  listOrganizationDomains,
@@ -1695,9 +1676,12 @@ export {
1695
1676
  useDeletePasskey,
1696
1677
  useDeleteTotpFactors,
1697
1678
  useGenerateAdminPortalLink,
1679
+ useGetAuditLogStream,
1698
1680
  useGetDataInstallationAuthorizationStatus,
1699
1681
  useGetDataIntegrationAuthorizeUrl,
1682
+ useGetDirectory,
1700
1683
  useInviteMember,
1684
+ useListDirectories,
1701
1685
  useListOrganizationApiKeyPermissions,
1702
1686
  useListOrganizationApiKeys,
1703
1687
  useListOrganizationDomains,