@workos-inc/widgets 1.8.2 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/dist/cjs/api/api-provider.cjs.map +1 -1
- package/dist/cjs/api/api-provider.d.cts +1 -1
- package/dist/cjs/api/endpoint.cjs +702 -623
- package/dist/cjs/api/endpoint.cjs.map +1 -1
- package/dist/cjs/api/endpoint.d.cts +810 -729
- package/dist/cjs/directory-sync.client.cjs +143 -0
- package/dist/cjs/directory-sync.client.cjs.map +1 -0
- package/dist/cjs/directory-sync.client.d.cts +26 -0
- package/dist/cjs/experimental/api/fetch.cjs +309 -252
- package/dist/cjs/experimental/api/fetch.cjs.map +1 -1
- package/dist/cjs/experimental/api/fetch.d.cts +809 -731
- package/dist/cjs/experimental/api/react-query.cjs +695 -613
- package/dist/cjs/experimental/api/react-query.cjs.map +1 -1
- package/dist/cjs/experimental/api/react-query.d.cts +1355 -1250
- package/dist/cjs/experimental/api/swr.cjs +660 -583
- package/dist/cjs/experimental/api/swr.cjs.map +1 -1
- package/dist/cjs/experimental/api/swr.d.cts +1307 -1212
- package/dist/cjs/index.cjs +5 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +2 -0
- package/dist/cjs/lib/api-keys/api-keys-context.cjs +1 -1
- package/dist/cjs/lib/api-keys/api-keys-context.cjs.map +1 -1
- package/dist/cjs/lib/api-keys/api-keys-table.cjs +7 -5
- package/dist/cjs/lib/api-keys/api-keys-table.cjs.map +1 -1
- package/dist/cjs/lib/directory-sync.cjs +288 -0
- package/dist/cjs/lib/directory-sync.cjs.map +1 -0
- package/dist/cjs/lib/directory-sync.d.cts +72 -0
- package/dist/cjs/lib/identity-providers.cjs +57 -1
- package/dist/cjs/lib/identity-providers.cjs.map +1 -1
- package/dist/cjs/lib/identity-providers.d.cts +5 -3
- package/dist/cjs/lib/pipes.cjs +9 -9
- package/dist/cjs/lib/pipes.cjs.map +1 -1
- package/dist/cjs/lib/reset-mfa-dialog.cjs +2 -1
- package/dist/cjs/lib/reset-mfa-dialog.cjs.map +1 -1
- package/dist/cjs/lib/use-permissions.cjs.map +1 -1
- package/dist/cjs/lib/use-permissions.d.cts +1 -1
- package/dist/cjs/lib/users-management-context.cjs +1 -1
- package/dist/cjs/lib/users-management-context.cjs.map +1 -1
- package/dist/cjs/lib/users-management.cjs +3 -3
- package/dist/cjs/lib/users-management.cjs.map +1 -1
- package/dist/cjs/lib/utils.cjs +9 -0
- package/dist/cjs/lib/utils.cjs.map +1 -1
- package/dist/cjs/lib/utils.d.cts +16 -2
- package/dist/esm/api/api-provider.d.ts +1 -1
- package/dist/esm/api/api-provider.js.map +1 -1
- package/dist/esm/api/endpoint.d.ts +810 -729
- package/dist/esm/api/endpoint.js +691 -618
- package/dist/esm/api/endpoint.js.map +1 -1
- package/dist/esm/directory-sync.client.d.ts +26 -0
- package/dist/esm/directory-sync.client.js +121 -0
- package/dist/esm/directory-sync.client.js.map +1 -0
- package/dist/esm/experimental/api/fetch.d.ts +809 -731
- package/dist/esm/experimental/api/fetch.js +300 -247
- package/dist/esm/experimental/api/fetch.js.map +1 -1
- package/dist/esm/experimental/api/react-query.d.ts +1355 -1250
- package/dist/esm/experimental/api/react-query.js +683 -608
- package/dist/esm/experimental/api/react-query.js.map +1 -1
- package/dist/esm/experimental/api/swr.d.ts +1307 -1212
- package/dist/esm/experimental/api/swr.js +649 -578
- package/dist/esm/experimental/api/swr.js.map +1 -1
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +6 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/api-keys/api-keys-context.js +1 -1
- package/dist/esm/lib/api-keys/api-keys-context.js.map +1 -1
- package/dist/esm/lib/api-keys/api-keys-table.js +7 -5
- package/dist/esm/lib/api-keys/api-keys-table.js.map +1 -1
- package/dist/esm/lib/directory-sync.d.ts +72 -0
- package/dist/esm/lib/directory-sync.js +259 -0
- package/dist/esm/lib/directory-sync.js.map +1 -0
- package/dist/esm/lib/identity-providers.d.ts +5 -3
- package/dist/esm/lib/identity-providers.js +55 -1
- package/dist/esm/lib/identity-providers.js.map +1 -1
- package/dist/esm/lib/pipes.js +9 -10
- package/dist/esm/lib/pipes.js.map +1 -1
- package/dist/esm/lib/reset-mfa-dialog.js +2 -1
- package/dist/esm/lib/reset-mfa-dialog.js.map +1 -1
- package/dist/esm/lib/use-permissions.d.ts +1 -1
- package/dist/esm/lib/use-permissions.js.map +1 -1
- package/dist/esm/lib/users-management-context.js +1 -1
- package/dist/esm/lib/users-management-context.js.map +1 -1
- package/dist/esm/lib/users-management.js +5 -4
- package/dist/esm/lib/users-management.js.map +1 -1
- package/dist/esm/lib/utils.d.ts +16 -2
- package/dist/esm/lib/utils.js +8 -0
- package/dist/esm/lib/utils.js.map +1 -1
- package/package.json +3 -3
|
@@ -24,13 +24,13 @@ const CreateTotpFactorResponseAuthenticationFactorAllOfType = {
|
|
|
24
24
|
const CreateTotpFactorResponseAuthenticationChallengeAllOfObject = {
|
|
25
25
|
authentication_challenge: "authentication_challenge"
|
|
26
26
|
};
|
|
27
|
-
const
|
|
27
|
+
const AuthenticationInformationResponseDataVerificationMethodsMfaOneOfProvider = {
|
|
28
28
|
MFA: "MFA"
|
|
29
29
|
};
|
|
30
|
-
const
|
|
30
|
+
const AuthenticationInformationResponseDataVerificationMethodsPasswordOneOfProvider = {
|
|
31
31
|
Password: "Password"
|
|
32
32
|
};
|
|
33
|
-
const
|
|
33
|
+
const AuthenticationInformationResponseDataVerificationMethodsPasskeyOneOfProvider = {
|
|
34
34
|
Passkey: "Passkey"
|
|
35
35
|
};
|
|
36
36
|
const SendVerificationResponseType = {
|
|
@@ -128,11 +128,11 @@ const SsoConnectionAnyOfEightAllOfType = {
|
|
|
128
128
|
const SsoConnectionAnyOfEightAllOfProviderTag = {
|
|
129
129
|
OpenIdConnect: "OpenIdConnect"
|
|
130
130
|
};
|
|
131
|
-
const
|
|
131
|
+
const DataInstallationAllOfObject = {
|
|
132
132
|
data_installation: "data_installation",
|
|
133
133
|
connected_account: "connected_account"
|
|
134
134
|
};
|
|
135
|
-
const
|
|
135
|
+
const DataInstallationAllOfState = {
|
|
136
136
|
connected: "connected",
|
|
137
137
|
needs_reauthorization: "needs_reauthorization"
|
|
138
138
|
};
|
|
@@ -186,11 +186,75 @@ const DataIntegrationCredentialsType = {
|
|
|
186
186
|
shared: "shared",
|
|
187
187
|
custom: "custom"
|
|
188
188
|
};
|
|
189
|
+
const DirectoryType = {
|
|
190
|
+
azure_scim_v20: "azure scim v2.0",
|
|
191
|
+
bamboohr: "bamboohr",
|
|
192
|
+
breathe_hr: "breathe hr",
|
|
193
|
+
cezanne_hr: "cezanne hr",
|
|
194
|
+
cyberark_scim_v20: "cyberark scim v2.0",
|
|
195
|
+
fourth_hr: "fourth hr",
|
|
196
|
+
generic_scim_v20: "generic scim v2.0",
|
|
197
|
+
gsuite_directory: "gsuite directory",
|
|
198
|
+
gusto: "gusto",
|
|
199
|
+
hibob: "hibob",
|
|
200
|
+
jump_cloud_scim_v20: "jump cloud scim v2.0",
|
|
201
|
+
okta_scim_v20: "okta scim v2.0",
|
|
202
|
+
onelogin_scim_v20: "onelogin scim v2.0",
|
|
203
|
+
people_hr: "people hr",
|
|
204
|
+
personio: "personio",
|
|
205
|
+
pingfederate_scim_v20: "pingfederate scim v2.0",
|
|
206
|
+
rippling: "rippling",
|
|
207
|
+
rippling_scim_v20: "rippling scim v2.0",
|
|
208
|
+
s3: "s3",
|
|
209
|
+
sailpoint_scim_v20: "sailpoint scim v2.0",
|
|
210
|
+
sftp: "sftp",
|
|
211
|
+
sftp_workday: "sftp workday",
|
|
212
|
+
workday: "workday"
|
|
213
|
+
};
|
|
214
|
+
const DirectoryState = {
|
|
215
|
+
requires_type: "requires_type",
|
|
216
|
+
linked: "linked",
|
|
217
|
+
validating: "validating",
|
|
218
|
+
invalid_credentials: "invalid_credentials",
|
|
219
|
+
unlinked: "unlinked",
|
|
220
|
+
deleting: "deleting"
|
|
221
|
+
};
|
|
189
222
|
const GenerateAdminPortalLinkIntent = {
|
|
190
223
|
domain_verification: "domain_verification",
|
|
191
224
|
sso: "sso"
|
|
192
225
|
};
|
|
193
|
-
const
|
|
226
|
+
const getCreateOrganizationApiKeyUrl = () => {
|
|
227
|
+
return `https://api.workos.com/_widgets/ApiKeys/organization-api-keys`;
|
|
228
|
+
};
|
|
229
|
+
const createOrganizationApiKey = async (createOrganizationApiKeyRequest, options) => {
|
|
230
|
+
const res = await fetch(getCreateOrganizationApiKeyUrl(), {
|
|
231
|
+
...options,
|
|
232
|
+
method: "POST",
|
|
233
|
+
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
234
|
+
body: JSON.stringify(createOrganizationApiKeyRequest)
|
|
235
|
+
});
|
|
236
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
237
|
+
const data = body ? JSON.parse(body) : {};
|
|
238
|
+
return {
|
|
239
|
+
data,
|
|
240
|
+
status: res.status,
|
|
241
|
+
headers: res.headers
|
|
242
|
+
};
|
|
243
|
+
};
|
|
244
|
+
const getCreateOrganizationApiKeyMutationOptions = (options) => {
|
|
245
|
+
const mutationKey = ["createOrganizationApiKey"];
|
|
246
|
+
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
247
|
+
const mutationFn = (props) => {
|
|
248
|
+
const { data } = props ?? {};
|
|
249
|
+
return createOrganizationApiKey(data, fetchOptions);
|
|
250
|
+
};
|
|
251
|
+
return { mutationFn, ...mutationOptions };
|
|
252
|
+
};
|
|
253
|
+
const useCreateOrganizationApiKey = (options, queryClient) => {
|
|
254
|
+
const mutationOptions = getCreateOrganizationApiKeyMutationOptions(options);
|
|
255
|
+
return useMutation(mutationOptions, queryClient);
|
|
256
|
+
};
|
|
257
|
+
const getListOrganizationApiKeysUrl = (params) => {
|
|
194
258
|
const normalizedParams = new URLSearchParams();
|
|
195
259
|
Object.entries(params || {}).forEach(([key, value]) => {
|
|
196
260
|
if (value !== void 0) {
|
|
@@ -198,71 +262,51 @@ const getMembersUrl = (params) => {
|
|
|
198
262
|
}
|
|
199
263
|
});
|
|
200
264
|
const stringifiedParams = normalizedParams.toString();
|
|
201
|
-
return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/
|
|
265
|
+
return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/ApiKeys/organization-api-keys?${stringifiedParams}` : `https://api.workos.com/_widgets/ApiKeys/organization-api-keys`;
|
|
202
266
|
};
|
|
203
|
-
const
|
|
204
|
-
const res = await fetch(
|
|
267
|
+
const listOrganizationApiKeys = async (params, options) => {
|
|
268
|
+
const res = await fetch(getListOrganizationApiKeysUrl(params), {
|
|
205
269
|
...options,
|
|
206
270
|
method: "GET"
|
|
207
271
|
});
|
|
208
272
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
209
273
|
const data = body ? JSON.parse(body) : {};
|
|
210
|
-
return {
|
|
274
|
+
return {
|
|
275
|
+
data,
|
|
276
|
+
status: res.status,
|
|
277
|
+
headers: res.headers
|
|
278
|
+
};
|
|
211
279
|
};
|
|
212
|
-
const
|
|
280
|
+
const getListOrganizationApiKeysQueryKey = (params) => {
|
|
213
281
|
return [
|
|
214
|
-
`https://api.workos.com/_widgets/
|
|
282
|
+
`https://api.workos.com/_widgets/ApiKeys/organization-api-keys`,
|
|
215
283
|
...params ? [params] : []
|
|
216
284
|
];
|
|
217
285
|
};
|
|
218
|
-
const
|
|
286
|
+
const getListOrganizationApiKeysQueryOptions = (params, options) => {
|
|
219
287
|
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
220
|
-
const queryKey = queryOptions?.queryKey ??
|
|
221
|
-
const queryFn = ({
|
|
222
|
-
signal
|
|
223
|
-
}) => members(params, { signal, ...fetchOptions });
|
|
288
|
+
const queryKey = queryOptions?.queryKey ?? getListOrganizationApiKeysQueryKey(params);
|
|
289
|
+
const queryFn = ({ signal }) => listOrganizationApiKeys(params, { signal, ...fetchOptions });
|
|
224
290
|
return { queryKey, queryFn, ...queryOptions };
|
|
225
291
|
};
|
|
226
|
-
function
|
|
227
|
-
const queryOptions =
|
|
292
|
+
function useListOrganizationApiKeys(params, options, queryClient) {
|
|
293
|
+
const queryOptions = getListOrganizationApiKeysQueryOptions(params, options);
|
|
228
294
|
const query = useQuery(queryOptions, queryClient);
|
|
229
295
|
query.queryKey = queryOptions.queryKey;
|
|
230
296
|
return query;
|
|
231
297
|
}
|
|
232
|
-
const
|
|
233
|
-
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
method: "GET"
|
|
298
|
+
const getListOrganizationApiKeyPermissionsUrl = (params) => {
|
|
299
|
+
const normalizedParams = new URLSearchParams();
|
|
300
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
301
|
+
if (value !== void 0) {
|
|
302
|
+
normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
303
|
+
}
|
|
239
304
|
});
|
|
240
|
-
const
|
|
241
|
-
|
|
242
|
-
return { data, status: res.status, headers: res.headers };
|
|
243
|
-
};
|
|
244
|
-
const getRolesQueryKey = () => {
|
|
245
|
-
return [`https://api.workos.com/_widgets/UserManagement/roles`];
|
|
246
|
-
};
|
|
247
|
-
const getRolesQueryOptions = (options) => {
|
|
248
|
-
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
249
|
-
const queryKey = queryOptions?.queryKey ?? getRolesQueryKey();
|
|
250
|
-
const queryFn = ({
|
|
251
|
-
signal
|
|
252
|
-
}) => roles({ signal, ...fetchOptions });
|
|
253
|
-
return { queryKey, queryFn, ...queryOptions };
|
|
254
|
-
};
|
|
255
|
-
function useRoles(options, queryClient) {
|
|
256
|
-
const queryOptions = getRolesQueryOptions(options);
|
|
257
|
-
const query = useQuery(queryOptions, queryClient);
|
|
258
|
-
query.queryKey = queryOptions.queryKey;
|
|
259
|
-
return query;
|
|
260
|
-
}
|
|
261
|
-
const getRolesAndConfigUrl = () => {
|
|
262
|
-
return `https://api.workos.com/_widgets/UserManagement/roles-and-config`;
|
|
305
|
+
const stringifiedParams = normalizedParams.toString();
|
|
306
|
+
return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/ApiKeys/permissions?${stringifiedParams}` : `https://api.workos.com/_widgets/ApiKeys/permissions`;
|
|
263
307
|
};
|
|
264
|
-
const
|
|
265
|
-
const res = await fetch(
|
|
308
|
+
const listOrganizationApiKeyPermissions = async (params, options) => {
|
|
309
|
+
const res = await fetch(getListOrganizationApiKeyPermissionsUrl(params), {
|
|
266
310
|
...options,
|
|
267
311
|
method: "GET"
|
|
268
312
|
});
|
|
@@ -274,34 +318,34 @@ const rolesAndConfig = async (options) => {
|
|
|
274
318
|
headers: res.headers
|
|
275
319
|
};
|
|
276
320
|
};
|
|
277
|
-
const
|
|
321
|
+
const getListOrganizationApiKeyPermissionsQueryKey = (params) => {
|
|
278
322
|
return [
|
|
279
|
-
`https://api.workos.com/_widgets/
|
|
323
|
+
`https://api.workos.com/_widgets/ApiKeys/permissions`,
|
|
324
|
+
...params ? [params] : []
|
|
280
325
|
];
|
|
281
326
|
};
|
|
282
|
-
const
|
|
327
|
+
const getListOrganizationApiKeyPermissionsQueryOptions = (params, options) => {
|
|
283
328
|
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
284
|
-
const queryKey = queryOptions?.queryKey ??
|
|
285
|
-
const queryFn = ({
|
|
286
|
-
signal
|
|
287
|
-
}) => rolesAndConfig({ signal, ...fetchOptions });
|
|
329
|
+
const queryKey = queryOptions?.queryKey ?? getListOrganizationApiKeyPermissionsQueryKey(params);
|
|
330
|
+
const queryFn = ({ signal }) => listOrganizationApiKeyPermissions(params, { signal, ...fetchOptions });
|
|
288
331
|
return { queryKey, queryFn, ...queryOptions };
|
|
289
332
|
};
|
|
290
|
-
function
|
|
291
|
-
const queryOptions =
|
|
333
|
+
function useListOrganizationApiKeyPermissions(params, options, queryClient) {
|
|
334
|
+
const queryOptions = getListOrganizationApiKeyPermissionsQueryOptions(
|
|
335
|
+
params,
|
|
336
|
+
options
|
|
337
|
+
);
|
|
292
338
|
const query = useQuery(queryOptions, queryClient);
|
|
293
339
|
query.queryKey = queryOptions.queryKey;
|
|
294
340
|
return query;
|
|
295
341
|
}
|
|
296
|
-
const
|
|
297
|
-
return `https://api.workos.com/_widgets/
|
|
342
|
+
const getDeleteOrganizationApiKeyUrl = (apiKeyId) => {
|
|
343
|
+
return `https://api.workos.com/_widgets/ApiKeys/${apiKeyId}`;
|
|
298
344
|
};
|
|
299
|
-
const
|
|
300
|
-
const res = await fetch(
|
|
345
|
+
const deleteOrganizationApiKey = async (apiKeyId, options) => {
|
|
346
|
+
const res = await fetch(getDeleteOrganizationApiKeyUrl(apiKeyId), {
|
|
301
347
|
...options,
|
|
302
|
-
method: "
|
|
303
|
-
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
304
|
-
body: JSON.stringify(inviteMemberBody)
|
|
348
|
+
method: "DELETE"
|
|
305
349
|
});
|
|
306
350
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
307
351
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -311,26 +355,26 @@ const inviteMember = async (inviteMemberBody, options) => {
|
|
|
311
355
|
headers: res.headers
|
|
312
356
|
};
|
|
313
357
|
};
|
|
314
|
-
const
|
|
315
|
-
const mutationKey = ["
|
|
358
|
+
const getDeleteOrganizationApiKeyMutationOptions = (options) => {
|
|
359
|
+
const mutationKey = ["deleteOrganizationApiKey"];
|
|
316
360
|
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
317
361
|
const mutationFn = (props) => {
|
|
318
|
-
const {
|
|
319
|
-
return
|
|
362
|
+
const { apiKeyId } = props ?? {};
|
|
363
|
+
return deleteOrganizationApiKey(apiKeyId, fetchOptions);
|
|
320
364
|
};
|
|
321
365
|
return { mutationFn, ...mutationOptions };
|
|
322
366
|
};
|
|
323
|
-
const
|
|
324
|
-
const mutationOptions =
|
|
367
|
+
const useDeleteOrganizationApiKey = (options, queryClient) => {
|
|
368
|
+
const mutationOptions = getDeleteOrganizationApiKeyMutationOptions(options);
|
|
325
369
|
return useMutation(mutationOptions, queryClient);
|
|
326
370
|
};
|
|
327
|
-
const
|
|
328
|
-
return `https://api.workos.com/_widgets/
|
|
371
|
+
const getDeleteDataInstallationUrl = (installationId) => {
|
|
372
|
+
return `https://api.workos.com/_widgets/DataIntegrations/installations/${installationId}`;
|
|
329
373
|
};
|
|
330
|
-
const
|
|
331
|
-
const res = await fetch(
|
|
374
|
+
const deleteDataInstallation = async (installationId, options) => {
|
|
375
|
+
const res = await fetch(getDeleteDataInstallationUrl(installationId), {
|
|
332
376
|
...options,
|
|
333
|
-
method: "
|
|
377
|
+
method: "DELETE"
|
|
334
378
|
});
|
|
335
379
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
336
380
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -340,26 +384,26 @@ const resendInvite = async (userId, options) => {
|
|
|
340
384
|
headers: res.headers
|
|
341
385
|
};
|
|
342
386
|
};
|
|
343
|
-
const
|
|
344
|
-
const mutationKey = ["
|
|
387
|
+
const getDeleteDataInstallationMutationOptions = (options) => {
|
|
388
|
+
const mutationKey = ["deleteDataInstallation"];
|
|
345
389
|
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
346
390
|
const mutationFn = (props) => {
|
|
347
|
-
const {
|
|
348
|
-
return
|
|
391
|
+
const { installationId } = props ?? {};
|
|
392
|
+
return deleteDataInstallation(installationId, fetchOptions);
|
|
349
393
|
};
|
|
350
394
|
return { mutationFn, ...mutationOptions };
|
|
351
395
|
};
|
|
352
|
-
const
|
|
353
|
-
const mutationOptions =
|
|
396
|
+
const useDeleteDataInstallation = (options, queryClient) => {
|
|
397
|
+
const mutationOptions = getDeleteDataInstallationMutationOptions(options);
|
|
354
398
|
return useMutation(mutationOptions, queryClient);
|
|
355
399
|
};
|
|
356
|
-
const
|
|
357
|
-
return `https://api.workos.com/_widgets/
|
|
400
|
+
const getMyDataIntegrationsUrl = () => {
|
|
401
|
+
return `https://api.workos.com/_widgets/DataIntegrations/mine`;
|
|
358
402
|
};
|
|
359
|
-
const
|
|
360
|
-
const res = await fetch(
|
|
403
|
+
const myDataIntegrations = async (options) => {
|
|
404
|
+
const res = await fetch(getMyDataIntegrationsUrl(), {
|
|
361
405
|
...options,
|
|
362
|
-
method: "
|
|
406
|
+
method: "GET"
|
|
363
407
|
});
|
|
364
408
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
365
409
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -369,26 +413,83 @@ const revokeInvite = async (userId, options) => {
|
|
|
369
413
|
headers: res.headers
|
|
370
414
|
};
|
|
371
415
|
};
|
|
372
|
-
const
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
416
|
+
const getMyDataIntegrationsQueryKey = () => {
|
|
417
|
+
return [`https://api.workos.com/_widgets/DataIntegrations/mine`];
|
|
418
|
+
};
|
|
419
|
+
const getMyDataIntegrationsQueryOptions = (options) => {
|
|
420
|
+
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
421
|
+
const queryKey = queryOptions?.queryKey ?? getMyDataIntegrationsQueryKey();
|
|
422
|
+
const queryFn = ({ signal }) => myDataIntegrations({ signal, ...fetchOptions });
|
|
423
|
+
return { queryKey, queryFn, ...queryOptions };
|
|
424
|
+
};
|
|
425
|
+
function useMyDataIntegrations(options, queryClient) {
|
|
426
|
+
const queryOptions = getMyDataIntegrationsQueryOptions(options);
|
|
427
|
+
const query = useQuery(queryOptions, queryClient);
|
|
428
|
+
query.queryKey = queryOptions.queryKey;
|
|
429
|
+
return query;
|
|
430
|
+
}
|
|
431
|
+
const getGetDataInstallationAuthorizationStatusUrl = (dataIntegrationId, state) => {
|
|
432
|
+
return `https://api.workos.com/_widgets/DataIntegrations/${dataIntegrationId}/authorization-status/${state}`;
|
|
433
|
+
};
|
|
434
|
+
const getDataInstallationAuthorizationStatus = async (dataIntegrationId, state, options) => {
|
|
435
|
+
const res = await fetch(
|
|
436
|
+
getGetDataInstallationAuthorizationStatusUrl(dataIntegrationId, state),
|
|
437
|
+
{
|
|
438
|
+
...options,
|
|
439
|
+
method: "GET"
|
|
440
|
+
}
|
|
441
|
+
);
|
|
442
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
443
|
+
const data = body ? JSON.parse(body) : {};
|
|
444
|
+
return {
|
|
445
|
+
data,
|
|
446
|
+
status: res.status,
|
|
447
|
+
headers: res.headers
|
|
378
448
|
};
|
|
379
|
-
return { mutationFn, ...mutationOptions };
|
|
380
449
|
};
|
|
381
|
-
const
|
|
382
|
-
|
|
383
|
-
|
|
450
|
+
const getGetDataInstallationAuthorizationStatusQueryKey = (dataIntegrationId, state) => {
|
|
451
|
+
return [
|
|
452
|
+
`https://api.workos.com/_widgets/DataIntegrations/${dataIntegrationId}/authorization-status/${state}`
|
|
453
|
+
];
|
|
384
454
|
};
|
|
385
|
-
const
|
|
386
|
-
|
|
455
|
+
const getGetDataInstallationAuthorizationStatusQueryOptions = (dataIntegrationId, state, options) => {
|
|
456
|
+
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
457
|
+
const queryKey = queryOptions?.queryKey ?? getGetDataInstallationAuthorizationStatusQueryKey(dataIntegrationId, state);
|
|
458
|
+
const queryFn = ({ signal }) => getDataInstallationAuthorizationStatus(dataIntegrationId, state, {
|
|
459
|
+
signal,
|
|
460
|
+
...fetchOptions
|
|
461
|
+
});
|
|
462
|
+
return {
|
|
463
|
+
queryKey,
|
|
464
|
+
queryFn,
|
|
465
|
+
enabled: !!(dataIntegrationId && state),
|
|
466
|
+
...queryOptions
|
|
467
|
+
};
|
|
387
468
|
};
|
|
388
|
-
|
|
389
|
-
const
|
|
469
|
+
function useGetDataInstallationAuthorizationStatus(dataIntegrationId, state, options, queryClient) {
|
|
470
|
+
const queryOptions = getGetDataInstallationAuthorizationStatusQueryOptions(
|
|
471
|
+
dataIntegrationId,
|
|
472
|
+
state,
|
|
473
|
+
options
|
|
474
|
+
);
|
|
475
|
+
const query = useQuery(queryOptions, queryClient);
|
|
476
|
+
query.queryKey = queryOptions.queryKey;
|
|
477
|
+
return query;
|
|
478
|
+
}
|
|
479
|
+
const getGetDataIntegrationAuthorizeUrlUrl = (slug, params) => {
|
|
480
|
+
const normalizedParams = new URLSearchParams();
|
|
481
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
482
|
+
if (value !== void 0) {
|
|
483
|
+
normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
484
|
+
}
|
|
485
|
+
});
|
|
486
|
+
const stringifiedParams = normalizedParams.toString();
|
|
487
|
+
return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/DataIntegrations/${slug}/authorize?${stringifiedParams}` : `https://api.workos.com/_widgets/DataIntegrations/${slug}/authorize`;
|
|
488
|
+
};
|
|
489
|
+
const getDataIntegrationAuthorizeUrl = async (slug, params, options) => {
|
|
490
|
+
const res = await fetch(getGetDataIntegrationAuthorizeUrlUrl(slug, params), {
|
|
390
491
|
...options,
|
|
391
|
-
method: "
|
|
492
|
+
method: "GET"
|
|
392
493
|
});
|
|
393
494
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
394
495
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -398,28 +499,71 @@ const removeMember = async (userId, options) => {
|
|
|
398
499
|
headers: res.headers
|
|
399
500
|
};
|
|
400
501
|
};
|
|
401
|
-
const
|
|
402
|
-
|
|
502
|
+
const getGetDataIntegrationAuthorizeUrlQueryKey = (slug, params) => {
|
|
503
|
+
return [
|
|
504
|
+
`https://api.workos.com/_widgets/DataIntegrations/${slug}/authorize`,
|
|
505
|
+
...params ? [params] : []
|
|
506
|
+
];
|
|
507
|
+
};
|
|
508
|
+
const getGetDataIntegrationAuthorizeUrlQueryOptions = (slug, params, options) => {
|
|
509
|
+
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
510
|
+
const queryKey = queryOptions?.queryKey ?? getGetDataIntegrationAuthorizeUrlQueryKey(slug, params);
|
|
511
|
+
const queryFn = ({ signal }) => getDataIntegrationAuthorizeUrl(slug, params, { signal, ...fetchOptions });
|
|
512
|
+
return {
|
|
513
|
+
queryKey,
|
|
514
|
+
queryFn,
|
|
515
|
+
enabled: !!slug,
|
|
516
|
+
...queryOptions
|
|
517
|
+
};
|
|
518
|
+
};
|
|
519
|
+
function useGetDataIntegrationAuthorizeUrl(slug, params, options, queryClient) {
|
|
520
|
+
const queryOptions = getGetDataIntegrationAuthorizeUrlQueryOptions(
|
|
521
|
+
slug,
|
|
522
|
+
params,
|
|
523
|
+
options
|
|
524
|
+
);
|
|
525
|
+
const query = useQuery(queryOptions, queryClient);
|
|
526
|
+
query.queryKey = queryOptions.queryKey;
|
|
527
|
+
return query;
|
|
528
|
+
}
|
|
529
|
+
const getInviteMemberUrl = () => {
|
|
530
|
+
return `https://api.workos.com/_widgets/UserManagement/invite-user`;
|
|
531
|
+
};
|
|
532
|
+
const inviteMember = async (inviteMemberBody, options) => {
|
|
533
|
+
const res = await fetch(getInviteMemberUrl(), {
|
|
534
|
+
...options,
|
|
535
|
+
method: "POST",
|
|
536
|
+
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
537
|
+
body: JSON.stringify(inviteMemberBody)
|
|
538
|
+
});
|
|
539
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
540
|
+
const data = body ? JSON.parse(body) : {};
|
|
541
|
+
return {
|
|
542
|
+
data,
|
|
543
|
+
status: res.status,
|
|
544
|
+
headers: res.headers
|
|
545
|
+
};
|
|
546
|
+
};
|
|
547
|
+
const getInviteMemberMutationOptions = (options) => {
|
|
548
|
+
const mutationKey = ["inviteMember"];
|
|
403
549
|
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
404
550
|
const mutationFn = (props) => {
|
|
405
|
-
const {
|
|
406
|
-
return
|
|
551
|
+
const { data } = props ?? {};
|
|
552
|
+
return inviteMember(data, fetchOptions);
|
|
407
553
|
};
|
|
408
554
|
return { mutationFn, ...mutationOptions };
|
|
409
555
|
};
|
|
410
|
-
const
|
|
411
|
-
const mutationOptions =
|
|
556
|
+
const useInviteMember = (options, queryClient) => {
|
|
557
|
+
const mutationOptions = getInviteMemberMutationOptions(options);
|
|
412
558
|
return useMutation(mutationOptions, queryClient);
|
|
413
559
|
};
|
|
414
|
-
const
|
|
415
|
-
return `https://api.workos.com/_widgets/UserManagement/
|
|
560
|
+
const getRevokeInviteUrl = (userId) => {
|
|
561
|
+
return `https://api.workos.com/_widgets/UserManagement/invites/${userId}`;
|
|
416
562
|
};
|
|
417
|
-
const
|
|
418
|
-
const res = await fetch(
|
|
563
|
+
const revokeInvite = async (userId, options) => {
|
|
564
|
+
const res = await fetch(getRevokeInviteUrl(userId), {
|
|
419
565
|
...options,
|
|
420
|
-
method: "
|
|
421
|
-
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
422
|
-
body: JSON.stringify(updateMemberBody)
|
|
566
|
+
method: "DELETE"
|
|
423
567
|
});
|
|
424
568
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
425
569
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -429,26 +573,26 @@ const updateMember = async (userId, updateMemberBody, options) => {
|
|
|
429
573
|
headers: res.headers
|
|
430
574
|
};
|
|
431
575
|
};
|
|
432
|
-
const
|
|
433
|
-
const mutationKey = ["
|
|
576
|
+
const getRevokeInviteMutationOptions = (options) => {
|
|
577
|
+
const mutationKey = ["revokeInvite"];
|
|
434
578
|
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
435
579
|
const mutationFn = (props) => {
|
|
436
|
-
const { userId
|
|
437
|
-
return
|
|
580
|
+
const { userId } = props ?? {};
|
|
581
|
+
return revokeInvite(userId, fetchOptions);
|
|
438
582
|
};
|
|
439
583
|
return { mutationFn, ...mutationOptions };
|
|
440
584
|
};
|
|
441
|
-
const
|
|
442
|
-
const mutationOptions =
|
|
585
|
+
const useRevokeInvite = (options, queryClient) => {
|
|
586
|
+
const mutationOptions = getRevokeInviteMutationOptions(options);
|
|
443
587
|
return useMutation(mutationOptions, queryClient);
|
|
444
588
|
};
|
|
445
|
-
const
|
|
446
|
-
return `https://api.workos.com/_widgets/UserManagement/
|
|
589
|
+
const getResendInviteUrl = (userId) => {
|
|
590
|
+
return `https://api.workos.com/_widgets/UserManagement/invites/${userId}/resend`;
|
|
447
591
|
};
|
|
448
|
-
const
|
|
449
|
-
const res = await fetch(
|
|
592
|
+
const resendInvite = async (userId, options) => {
|
|
593
|
+
const res = await fetch(getResendInviteUrl(userId), {
|
|
450
594
|
...options,
|
|
451
|
-
method: "
|
|
595
|
+
method: "POST"
|
|
452
596
|
});
|
|
453
597
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
454
598
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -458,30 +602,31 @@ const organizations = async (options) => {
|
|
|
458
602
|
headers: res.headers
|
|
459
603
|
};
|
|
460
604
|
};
|
|
461
|
-
const
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
605
|
+
const getResendInviteMutationOptions = (options) => {
|
|
606
|
+
const mutationKey = ["resendInvite"];
|
|
607
|
+
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
608
|
+
const mutationFn = (props) => {
|
|
609
|
+
const { userId } = props ?? {};
|
|
610
|
+
return resendInvite(userId, fetchOptions);
|
|
611
|
+
};
|
|
612
|
+
return { mutationFn, ...mutationOptions };
|
|
465
613
|
};
|
|
466
|
-
const
|
|
467
|
-
const
|
|
468
|
-
|
|
469
|
-
const queryFn = ({
|
|
470
|
-
signal
|
|
471
|
-
}) => organizations({ signal, ...fetchOptions });
|
|
472
|
-
return { queryKey, queryFn, ...queryOptions };
|
|
614
|
+
const useResendInvite = (options, queryClient) => {
|
|
615
|
+
const mutationOptions = getResendInviteMutationOptions(options);
|
|
616
|
+
return useMutation(mutationOptions, queryClient);
|
|
473
617
|
};
|
|
474
|
-
|
|
475
|
-
const
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
|
|
618
|
+
const getMembersUrl = (params) => {
|
|
619
|
+
const normalizedParams = new URLSearchParams();
|
|
620
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
621
|
+
if (value !== void 0) {
|
|
622
|
+
normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
623
|
+
}
|
|
624
|
+
});
|
|
625
|
+
const stringifiedParams = normalizedParams.toString();
|
|
626
|
+
return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/UserManagement/members?${stringifiedParams}` : `https://api.workos.com/_widgets/UserManagement/members`;
|
|
482
627
|
};
|
|
483
|
-
const
|
|
484
|
-
const res = await fetch(
|
|
628
|
+
const members = async (params, options) => {
|
|
629
|
+
const res = await fetch(getMembersUrl(params), {
|
|
485
630
|
...options,
|
|
486
631
|
method: "GET"
|
|
487
632
|
});
|
|
@@ -489,55 +634,64 @@ const me = async (options) => {
|
|
|
489
634
|
const data = body ? JSON.parse(body) : {};
|
|
490
635
|
return { data, status: res.status, headers: res.headers };
|
|
491
636
|
};
|
|
492
|
-
const
|
|
493
|
-
return [
|
|
637
|
+
const getMembersQueryKey = (params) => {
|
|
638
|
+
return [
|
|
639
|
+
`https://api.workos.com/_widgets/UserManagement/members`,
|
|
640
|
+
...params ? [params] : []
|
|
641
|
+
];
|
|
494
642
|
};
|
|
495
|
-
const
|
|
643
|
+
const getMembersQueryOptions = (params, options) => {
|
|
496
644
|
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
497
|
-
const queryKey = queryOptions?.queryKey ??
|
|
498
|
-
const queryFn = ({
|
|
645
|
+
const queryKey = queryOptions?.queryKey ?? getMembersQueryKey(params);
|
|
646
|
+
const queryFn = ({
|
|
647
|
+
signal
|
|
648
|
+
}) => members(params, { signal, ...fetchOptions });
|
|
499
649
|
return { queryKey, queryFn, ...queryOptions };
|
|
500
650
|
};
|
|
501
|
-
function
|
|
502
|
-
const queryOptions =
|
|
651
|
+
function useMembers(params, options, queryClient) {
|
|
652
|
+
const queryOptions = getMembersQueryOptions(params, options);
|
|
503
653
|
const query = useQuery(queryOptions, queryClient);
|
|
504
654
|
query.queryKey = queryOptions.queryKey;
|
|
505
655
|
return query;
|
|
506
656
|
}
|
|
507
|
-
const
|
|
508
|
-
return `https://api.workos.com/_widgets/
|
|
657
|
+
const getRemoveMemberUrl = (userId) => {
|
|
658
|
+
return `https://api.workos.com/_widgets/UserManagement/members/${userId}`;
|
|
509
659
|
};
|
|
510
|
-
const
|
|
511
|
-
const res = await fetch(
|
|
660
|
+
const removeMember = async (userId, options) => {
|
|
661
|
+
const res = await fetch(getRemoveMemberUrl(userId), {
|
|
512
662
|
...options,
|
|
513
|
-
method: "
|
|
514
|
-
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
515
|
-
body: JSON.stringify(updateMeBody)
|
|
663
|
+
method: "DELETE"
|
|
516
664
|
});
|
|
517
665
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
518
666
|
const data = body ? JSON.parse(body) : {};
|
|
519
|
-
return {
|
|
667
|
+
return {
|
|
668
|
+
data,
|
|
669
|
+
status: res.status,
|
|
670
|
+
headers: res.headers
|
|
671
|
+
};
|
|
520
672
|
};
|
|
521
|
-
const
|
|
522
|
-
const mutationKey = ["
|
|
673
|
+
const getRemoveMemberMutationOptions = (options) => {
|
|
674
|
+
const mutationKey = ["removeMember"];
|
|
523
675
|
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
524
676
|
const mutationFn = (props) => {
|
|
525
|
-
const {
|
|
526
|
-
return
|
|
677
|
+
const { userId } = props ?? {};
|
|
678
|
+
return removeMember(userId, fetchOptions);
|
|
527
679
|
};
|
|
528
680
|
return { mutationFn, ...mutationOptions };
|
|
529
681
|
};
|
|
530
|
-
const
|
|
531
|
-
const mutationOptions =
|
|
682
|
+
const useRemoveMember = (options, queryClient) => {
|
|
683
|
+
const mutationOptions = getRemoveMemberMutationOptions(options);
|
|
532
684
|
return useMutation(mutationOptions, queryClient);
|
|
533
685
|
};
|
|
534
|
-
const
|
|
535
|
-
return `https://api.workos.com/_widgets/
|
|
536
|
-
};
|
|
537
|
-
const
|
|
538
|
-
const res = await fetch(
|
|
686
|
+
const getUpdateMemberUrl = (userId) => {
|
|
687
|
+
return `https://api.workos.com/_widgets/UserManagement/members/${userId}`;
|
|
688
|
+
};
|
|
689
|
+
const updateMember = async (userId, updateMemberBody, options) => {
|
|
690
|
+
const res = await fetch(getUpdateMemberUrl(userId), {
|
|
539
691
|
...options,
|
|
540
|
-
method: "POST"
|
|
692
|
+
method: "POST",
|
|
693
|
+
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
694
|
+
body: JSON.stringify(updateMemberBody)
|
|
541
695
|
});
|
|
542
696
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
543
697
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -547,27 +701,26 @@ const createTotpFactor = async (options) => {
|
|
|
547
701
|
headers: res.headers
|
|
548
702
|
};
|
|
549
703
|
};
|
|
550
|
-
const
|
|
551
|
-
const mutationKey = ["
|
|
704
|
+
const getUpdateMemberMutationOptions = (options) => {
|
|
705
|
+
const mutationKey = ["updateMember"];
|
|
552
706
|
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
553
|
-
const mutationFn = () => {
|
|
554
|
-
|
|
707
|
+
const mutationFn = (props) => {
|
|
708
|
+
const { userId, data } = props ?? {};
|
|
709
|
+
return updateMember(userId, data, fetchOptions);
|
|
555
710
|
};
|
|
556
711
|
return { mutationFn, ...mutationOptions };
|
|
557
712
|
};
|
|
558
|
-
const
|
|
559
|
-
const mutationOptions =
|
|
713
|
+
const useUpdateMember = (options, queryClient) => {
|
|
714
|
+
const mutationOptions = getUpdateMemberMutationOptions(options);
|
|
560
715
|
return useMutation(mutationOptions, queryClient);
|
|
561
716
|
};
|
|
562
|
-
const
|
|
563
|
-
return `https://api.workos.com/_widgets/
|
|
717
|
+
const getOrganizationsUrl = () => {
|
|
718
|
+
return `https://api.workos.com/_widgets/UserManagement/organizations`;
|
|
564
719
|
};
|
|
565
|
-
const
|
|
566
|
-
const res = await fetch(
|
|
720
|
+
const organizations = async (options) => {
|
|
721
|
+
const res = await fetch(getOrganizationsUrl(), {
|
|
567
722
|
...options,
|
|
568
|
-
method: "
|
|
569
|
-
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
570
|
-
body: JSON.stringify(verifyTotpFactorRequest)
|
|
723
|
+
method: "GET"
|
|
571
724
|
});
|
|
572
725
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
573
726
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -577,26 +730,61 @@ const verifyTotpFactor = async (verifyTotpFactorRequest, options) => {
|
|
|
577
730
|
headers: res.headers
|
|
578
731
|
};
|
|
579
732
|
};
|
|
580
|
-
const
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
const { data } = props ?? {};
|
|
585
|
-
return verifyTotpFactor(data, fetchOptions);
|
|
586
|
-
};
|
|
587
|
-
return { mutationFn, ...mutationOptions };
|
|
733
|
+
const getOrganizationsQueryKey = () => {
|
|
734
|
+
return [
|
|
735
|
+
`https://api.workos.com/_widgets/UserManagement/organizations`
|
|
736
|
+
];
|
|
588
737
|
};
|
|
589
|
-
const
|
|
590
|
-
const
|
|
591
|
-
|
|
738
|
+
const getOrganizationsQueryOptions = (options) => {
|
|
739
|
+
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
740
|
+
const queryKey = queryOptions?.queryKey ?? getOrganizationsQueryKey();
|
|
741
|
+
const queryFn = ({
|
|
742
|
+
signal
|
|
743
|
+
}) => organizations({ signal, ...fetchOptions });
|
|
744
|
+
return { queryKey, queryFn, ...queryOptions };
|
|
592
745
|
};
|
|
593
|
-
|
|
594
|
-
|
|
746
|
+
function useOrganizations(options, queryClient) {
|
|
747
|
+
const queryOptions = getOrganizationsQueryOptions(options);
|
|
748
|
+
const query = useQuery(queryOptions, queryClient);
|
|
749
|
+
query.queryKey = queryOptions.queryKey;
|
|
750
|
+
return query;
|
|
751
|
+
}
|
|
752
|
+
const getRolesUrl = () => {
|
|
753
|
+
return `https://api.workos.com/_widgets/UserManagement/roles`;
|
|
595
754
|
};
|
|
596
|
-
const
|
|
597
|
-
const res = await fetch(
|
|
755
|
+
const roles = async (options) => {
|
|
756
|
+
const res = await fetch(getRolesUrl(), {
|
|
598
757
|
...options,
|
|
599
|
-
method: "
|
|
758
|
+
method: "GET"
|
|
759
|
+
});
|
|
760
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
761
|
+
const data = body ? JSON.parse(body) : {};
|
|
762
|
+
return { data, status: res.status, headers: res.headers };
|
|
763
|
+
};
|
|
764
|
+
const getRolesQueryKey = () => {
|
|
765
|
+
return [`https://api.workos.com/_widgets/UserManagement/roles`];
|
|
766
|
+
};
|
|
767
|
+
const getRolesQueryOptions = (options) => {
|
|
768
|
+
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
769
|
+
const queryKey = queryOptions?.queryKey ?? getRolesQueryKey();
|
|
770
|
+
const queryFn = ({
|
|
771
|
+
signal
|
|
772
|
+
}) => roles({ signal, ...fetchOptions });
|
|
773
|
+
return { queryKey, queryFn, ...queryOptions };
|
|
774
|
+
};
|
|
775
|
+
function useRoles(options, queryClient) {
|
|
776
|
+
const queryOptions = getRolesQueryOptions(options);
|
|
777
|
+
const query = useQuery(queryOptions, queryClient);
|
|
778
|
+
query.queryKey = queryOptions.queryKey;
|
|
779
|
+
return query;
|
|
780
|
+
}
|
|
781
|
+
const getRolesAndConfigUrl = () => {
|
|
782
|
+
return `https://api.workos.com/_widgets/UserManagement/roles-and-config`;
|
|
783
|
+
};
|
|
784
|
+
const rolesAndConfig = async (options) => {
|
|
785
|
+
const res = await fetch(getRolesAndConfigUrl(), {
|
|
786
|
+
...options,
|
|
787
|
+
method: "GET"
|
|
600
788
|
});
|
|
601
789
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
602
790
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -606,18 +794,25 @@ const deleteTotpFactors = async (options) => {
|
|
|
606
794
|
headers: res.headers
|
|
607
795
|
};
|
|
608
796
|
};
|
|
609
|
-
const
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
return deleteTotpFactors(fetchOptions);
|
|
614
|
-
};
|
|
615
|
-
return { mutationFn, ...mutationOptions };
|
|
797
|
+
const getRolesAndConfigQueryKey = () => {
|
|
798
|
+
return [
|
|
799
|
+
`https://api.workos.com/_widgets/UserManagement/roles-and-config`
|
|
800
|
+
];
|
|
616
801
|
};
|
|
617
|
-
const
|
|
618
|
-
const
|
|
619
|
-
|
|
802
|
+
const getRolesAndConfigQueryOptions = (options) => {
|
|
803
|
+
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
804
|
+
const queryKey = queryOptions?.queryKey ?? getRolesAndConfigQueryKey();
|
|
805
|
+
const queryFn = ({
|
|
806
|
+
signal
|
|
807
|
+
}) => rolesAndConfig({ signal, ...fetchOptions });
|
|
808
|
+
return { queryKey, queryFn, ...queryOptions };
|
|
620
809
|
};
|
|
810
|
+
function useRolesAndConfig(options, queryClient) {
|
|
811
|
+
const queryOptions = getRolesAndConfigQueryOptions(options);
|
|
812
|
+
const query = useQuery(queryOptions, queryClient);
|
|
813
|
+
query.queryKey = queryOptions.queryKey;
|
|
814
|
+
return query;
|
|
815
|
+
}
|
|
621
816
|
const getAuthenticationInformationUrl = () => {
|
|
622
817
|
return `https://api.workos.com/_widgets/UserProfile/authentication-information`;
|
|
623
818
|
};
|
|
@@ -682,75 +877,13 @@ const useCreatePassword = (options, queryClient) => {
|
|
|
682
877
|
const mutationOptions = getCreatePasswordMutationOptions(options);
|
|
683
878
|
return useMutation(mutationOptions, queryClient);
|
|
684
879
|
};
|
|
685
|
-
const
|
|
686
|
-
return `https://api.workos.com/_widgets/UserProfile/
|
|
687
|
-
};
|
|
688
|
-
const updatePassword = async (updatePasswordRequest, options) => {
|
|
689
|
-
const res = await fetch(getUpdatePasswordUrl(), {
|
|
690
|
-
...options,
|
|
691
|
-
method: "POST",
|
|
692
|
-
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
693
|
-
body: JSON.stringify(updatePasswordRequest)
|
|
694
|
-
});
|
|
695
|
-
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
696
|
-
const data = body ? JSON.parse(body) : {};
|
|
697
|
-
return {
|
|
698
|
-
data,
|
|
699
|
-
status: res.status,
|
|
700
|
-
headers: res.headers
|
|
701
|
-
};
|
|
702
|
-
};
|
|
703
|
-
const getUpdatePasswordMutationOptions = (options) => {
|
|
704
|
-
const mutationKey = ["updatePassword"];
|
|
705
|
-
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
706
|
-
const mutationFn = (props) => {
|
|
707
|
-
const { data } = props ?? {};
|
|
708
|
-
return updatePassword(data, fetchOptions);
|
|
709
|
-
};
|
|
710
|
-
return { mutationFn, ...mutationOptions };
|
|
711
|
-
};
|
|
712
|
-
const useUpdatePassword = (options, queryClient) => {
|
|
713
|
-
const mutationOptions = getUpdatePasswordMutationOptions(options);
|
|
714
|
-
return useMutation(mutationOptions, queryClient);
|
|
715
|
-
};
|
|
716
|
-
const getRevokeAllSessionsUrl = () => {
|
|
717
|
-
return `https://api.workos.com/_widgets/UserProfile/sessions/revoke-all`;
|
|
718
|
-
};
|
|
719
|
-
const revokeAllSessions = async (revokeAllSessionsRequest, options) => {
|
|
720
|
-
const res = await fetch(getRevokeAllSessionsUrl(), {
|
|
721
|
-
...options,
|
|
722
|
-
method: "DELETE",
|
|
723
|
-
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
724
|
-
body: JSON.stringify(revokeAllSessionsRequest)
|
|
725
|
-
});
|
|
726
|
-
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
727
|
-
const data = body ? JSON.parse(body) : {};
|
|
728
|
-
return {
|
|
729
|
-
data,
|
|
730
|
-
status: res.status,
|
|
731
|
-
headers: res.headers
|
|
732
|
-
};
|
|
733
|
-
};
|
|
734
|
-
const getRevokeAllSessionsMutationOptions = (options) => {
|
|
735
|
-
const mutationKey = ["revokeAllSessions"];
|
|
736
|
-
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
737
|
-
const mutationFn = (props) => {
|
|
738
|
-
const { data } = props ?? {};
|
|
739
|
-
return revokeAllSessions(data, fetchOptions);
|
|
740
|
-
};
|
|
741
|
-
return { mutationFn, ...mutationOptions };
|
|
742
|
-
};
|
|
743
|
-
const useRevokeAllSessions = (options, queryClient) => {
|
|
744
|
-
const mutationOptions = getRevokeAllSessionsMutationOptions(options);
|
|
745
|
-
return useMutation(mutationOptions, queryClient);
|
|
746
|
-
};
|
|
747
|
-
const getRevokeSessionUrl = (sessionId) => {
|
|
748
|
-
return `https://api.workos.com/_widgets/UserProfile/sessions/revoke/${sessionId}`;
|
|
880
|
+
const getCreateTotpFactorUrl = () => {
|
|
881
|
+
return `https://api.workos.com/_widgets/UserProfile/create-totp-factor`;
|
|
749
882
|
};
|
|
750
|
-
const
|
|
751
|
-
const res = await fetch(
|
|
883
|
+
const createTotpFactor = async (options) => {
|
|
884
|
+
const res = await fetch(getCreateTotpFactorUrl(), {
|
|
752
885
|
...options,
|
|
753
|
-
method: "
|
|
886
|
+
method: "POST"
|
|
754
887
|
});
|
|
755
888
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
756
889
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -760,24 +893,23 @@ const revokeSession = async (sessionId, options) => {
|
|
|
760
893
|
headers: res.headers
|
|
761
894
|
};
|
|
762
895
|
};
|
|
763
|
-
const
|
|
764
|
-
const mutationKey = ["
|
|
896
|
+
const getCreateTotpFactorMutationOptions = (options) => {
|
|
897
|
+
const mutationKey = ["createTotpFactor"];
|
|
765
898
|
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
766
|
-
const mutationFn = (
|
|
767
|
-
|
|
768
|
-
return revokeSession(sessionId, fetchOptions);
|
|
899
|
+
const mutationFn = () => {
|
|
900
|
+
return createTotpFactor(fetchOptions);
|
|
769
901
|
};
|
|
770
902
|
return { mutationFn, ...mutationOptions };
|
|
771
903
|
};
|
|
772
|
-
const
|
|
773
|
-
const mutationOptions =
|
|
904
|
+
const useCreateTotpFactor = (options, queryClient) => {
|
|
905
|
+
const mutationOptions = getCreateTotpFactorMutationOptions(options);
|
|
774
906
|
return useMutation(mutationOptions, queryClient);
|
|
775
907
|
};
|
|
776
|
-
const
|
|
777
|
-
return `https://api.workos.com/_widgets/UserProfile/
|
|
908
|
+
const getMeUrl = () => {
|
|
909
|
+
return `https://api.workos.com/_widgets/UserProfile/me`;
|
|
778
910
|
};
|
|
779
|
-
const
|
|
780
|
-
const res = await fetch(
|
|
911
|
+
const me = async (options) => {
|
|
912
|
+
const res = await fetch(getMeUrl(), {
|
|
781
913
|
...options,
|
|
782
914
|
method: "GET"
|
|
783
915
|
});
|
|
@@ -785,76 +917,46 @@ const sessions = async (options) => {
|
|
|
785
917
|
const data = body ? JSON.parse(body) : {};
|
|
786
918
|
return { data, status: res.status, headers: res.headers };
|
|
787
919
|
};
|
|
788
|
-
const
|
|
789
|
-
return [`https://api.workos.com/_widgets/UserProfile/
|
|
790
|
-
};
|
|
791
|
-
const getSessionsQueryOptions = (options) => {
|
|
792
|
-
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
793
|
-
const queryKey = queryOptions?.queryKey ?? getSessionsQueryKey();
|
|
794
|
-
const queryFn = ({
|
|
795
|
-
signal
|
|
796
|
-
}) => sessions({ signal, ...fetchOptions });
|
|
797
|
-
return { queryKey, queryFn, ...queryOptions };
|
|
798
|
-
};
|
|
799
|
-
function useSessions(options, queryClient) {
|
|
800
|
-
const queryOptions = getSessionsQueryOptions(options);
|
|
801
|
-
const query = useQuery(queryOptions, queryClient);
|
|
802
|
-
query.queryKey = queryOptions.queryKey;
|
|
803
|
-
return query;
|
|
804
|
-
}
|
|
805
|
-
const getSendVerificationUrl = () => {
|
|
806
|
-
return `https://api.workos.com/_widgets/UserProfile/send-verification`;
|
|
807
|
-
};
|
|
808
|
-
const sendVerification = async (options) => {
|
|
809
|
-
const res = await fetch(getSendVerificationUrl(), {
|
|
810
|
-
...options,
|
|
811
|
-
method: "POST"
|
|
812
|
-
});
|
|
813
|
-
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
814
|
-
const data = body ? JSON.parse(body) : {};
|
|
815
|
-
return {
|
|
816
|
-
data,
|
|
817
|
-
status: res.status,
|
|
818
|
-
headers: res.headers
|
|
819
|
-
};
|
|
820
|
-
};
|
|
821
|
-
const getSendVerificationMutationOptions = (options) => {
|
|
822
|
-
const mutationKey = ["sendVerification"];
|
|
823
|
-
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
824
|
-
const mutationFn = () => {
|
|
825
|
-
return sendVerification(fetchOptions);
|
|
826
|
-
};
|
|
827
|
-
return { mutationFn, ...mutationOptions };
|
|
920
|
+
const getMeQueryKey = () => {
|
|
921
|
+
return [`https://api.workos.com/_widgets/UserProfile/me`];
|
|
828
922
|
};
|
|
829
|
-
const
|
|
830
|
-
const
|
|
831
|
-
|
|
923
|
+
const getMeQueryOptions = (options) => {
|
|
924
|
+
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
925
|
+
const queryKey = queryOptions?.queryKey ?? getMeQueryKey();
|
|
926
|
+
const queryFn = ({ signal }) => me({ signal, ...fetchOptions });
|
|
927
|
+
return { queryKey, queryFn, ...queryOptions };
|
|
832
928
|
};
|
|
833
|
-
|
|
834
|
-
|
|
929
|
+
function useMe(options, queryClient) {
|
|
930
|
+
const queryOptions = getMeQueryOptions(options);
|
|
931
|
+
const query = useQuery(queryOptions, queryClient);
|
|
932
|
+
query.queryKey = queryOptions.queryKey;
|
|
933
|
+
return query;
|
|
934
|
+
}
|
|
935
|
+
const getUpdateMeUrl = () => {
|
|
936
|
+
return `https://api.workos.com/_widgets/UserProfile/me`;
|
|
835
937
|
};
|
|
836
|
-
const
|
|
837
|
-
const res = await fetch(
|
|
938
|
+
const updateMe = async (updateMeBody, options) => {
|
|
939
|
+
const res = await fetch(getUpdateMeUrl(), {
|
|
838
940
|
...options,
|
|
839
941
|
method: "POST",
|
|
840
942
|
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
841
|
-
body: JSON.stringify(
|
|
943
|
+
body: JSON.stringify(updateMeBody)
|
|
842
944
|
});
|
|
843
945
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
844
946
|
const data = body ? JSON.parse(body) : {};
|
|
845
947
|
return { data, status: res.status, headers: res.headers };
|
|
846
948
|
};
|
|
847
|
-
const
|
|
848
|
-
const mutationKey = ["
|
|
949
|
+
const getUpdateMeMutationOptions = (options) => {
|
|
950
|
+
const mutationKey = ["updateMe"];
|
|
849
951
|
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
850
952
|
const mutationFn = (props) => {
|
|
851
953
|
const { data } = props ?? {};
|
|
852
|
-
return
|
|
954
|
+
return updateMe(data, fetchOptions);
|
|
853
955
|
};
|
|
854
956
|
return { mutationFn, ...mutationOptions };
|
|
855
957
|
};
|
|
856
|
-
const
|
|
857
|
-
const mutationOptions =
|
|
958
|
+
const useUpdateMe = (options, queryClient) => {
|
|
959
|
+
const mutationOptions = getUpdateMeMutationOptions(options);
|
|
858
960
|
return useMutation(mutationOptions, queryClient);
|
|
859
961
|
};
|
|
860
962
|
const getRegisterPasskeyUrl = () => {
|
|
@@ -945,11 +1047,39 @@ const useDeletePasskey = (options, queryClient) => {
|
|
|
945
1047
|
const mutationOptions = getDeletePasskeyMutationOptions(options);
|
|
946
1048
|
return useMutation(mutationOptions, queryClient);
|
|
947
1049
|
};
|
|
948
|
-
const
|
|
949
|
-
return `https://api.workos.com/_widgets/
|
|
1050
|
+
const getSendVerificationUrl = () => {
|
|
1051
|
+
return `https://api.workos.com/_widgets/UserProfile/send-verification`;
|
|
950
1052
|
};
|
|
951
|
-
const
|
|
952
|
-
const res = await fetch(
|
|
1053
|
+
const sendVerification = async (options) => {
|
|
1054
|
+
const res = await fetch(getSendVerificationUrl(), {
|
|
1055
|
+
...options,
|
|
1056
|
+
method: "POST"
|
|
1057
|
+
});
|
|
1058
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1059
|
+
const data = body ? JSON.parse(body) : {};
|
|
1060
|
+
return {
|
|
1061
|
+
data,
|
|
1062
|
+
status: res.status,
|
|
1063
|
+
headers: res.headers
|
|
1064
|
+
};
|
|
1065
|
+
};
|
|
1066
|
+
const getSendVerificationMutationOptions = (options) => {
|
|
1067
|
+
const mutationKey = ["sendVerification"];
|
|
1068
|
+
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
1069
|
+
const mutationFn = () => {
|
|
1070
|
+
return sendVerification(fetchOptions);
|
|
1071
|
+
};
|
|
1072
|
+
return { mutationFn, ...mutationOptions };
|
|
1073
|
+
};
|
|
1074
|
+
const useSendVerification = (options, queryClient) => {
|
|
1075
|
+
const mutationOptions = getSendVerificationMutationOptions(options);
|
|
1076
|
+
return useMutation(mutationOptions, queryClient);
|
|
1077
|
+
};
|
|
1078
|
+
const getSessionsUrl = () => {
|
|
1079
|
+
return `https://api.workos.com/_widgets/UserProfile/sessions`;
|
|
1080
|
+
};
|
|
1081
|
+
const sessions = async (options) => {
|
|
1082
|
+
const res = await fetch(getSessionsUrl(), {
|
|
953
1083
|
...options,
|
|
954
1084
|
method: "GET"
|
|
955
1085
|
});
|
|
@@ -957,30 +1087,32 @@ const settings = async (options) => {
|
|
|
957
1087
|
const data = body ? JSON.parse(body) : {};
|
|
958
1088
|
return { data, status: res.status, headers: res.headers };
|
|
959
1089
|
};
|
|
960
|
-
const
|
|
961
|
-
return [`https://api.workos.com/_widgets/
|
|
1090
|
+
const getSessionsQueryKey = () => {
|
|
1091
|
+
return [`https://api.workos.com/_widgets/UserProfile/sessions`];
|
|
962
1092
|
};
|
|
963
|
-
const
|
|
1093
|
+
const getSessionsQueryOptions = (options) => {
|
|
964
1094
|
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
965
|
-
const queryKey = queryOptions?.queryKey ??
|
|
1095
|
+
const queryKey = queryOptions?.queryKey ?? getSessionsQueryKey();
|
|
966
1096
|
const queryFn = ({
|
|
967
1097
|
signal
|
|
968
|
-
}) =>
|
|
1098
|
+
}) => sessions({ signal, ...fetchOptions });
|
|
969
1099
|
return { queryKey, queryFn, ...queryOptions };
|
|
970
1100
|
};
|
|
971
|
-
function
|
|
972
|
-
const queryOptions =
|
|
1101
|
+
function useSessions(options, queryClient) {
|
|
1102
|
+
const queryOptions = getSessionsQueryOptions(options);
|
|
973
1103
|
const query = useQuery(queryOptions, queryClient);
|
|
974
1104
|
query.queryKey = queryOptions.queryKey;
|
|
975
1105
|
return query;
|
|
976
1106
|
}
|
|
977
|
-
const
|
|
978
|
-
return `https://api.workos.com/_widgets/
|
|
1107
|
+
const getRevokeAllSessionsUrl = () => {
|
|
1108
|
+
return `https://api.workos.com/_widgets/UserProfile/sessions/revoke-all`;
|
|
979
1109
|
};
|
|
980
|
-
const
|
|
981
|
-
const res = await fetch(
|
|
1110
|
+
const revokeAllSessions = async (revokeAllSessionsRequest, options) => {
|
|
1111
|
+
const res = await fetch(getRevokeAllSessionsUrl(), {
|
|
982
1112
|
...options,
|
|
983
|
-
method: "
|
|
1113
|
+
method: "DELETE",
|
|
1114
|
+
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
1115
|
+
body: JSON.stringify(revokeAllSessionsRequest)
|
|
984
1116
|
});
|
|
985
1117
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
986
1118
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -990,37 +1122,26 @@ const listOrganizationDomains = async (options) => {
|
|
|
990
1122
|
headers: res.headers
|
|
991
1123
|
};
|
|
992
1124
|
};
|
|
993
|
-
const
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
1125
|
+
const getRevokeAllSessionsMutationOptions = (options) => {
|
|
1126
|
+
const mutationKey = ["revokeAllSessions"];
|
|
1127
|
+
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
1128
|
+
const mutationFn = (props) => {
|
|
1129
|
+
const { data } = props ?? {};
|
|
1130
|
+
return revokeAllSessions(data, fetchOptions);
|
|
1131
|
+
};
|
|
1132
|
+
return { mutationFn, ...mutationOptions };
|
|
997
1133
|
};
|
|
998
|
-
const
|
|
999
|
-
const
|
|
1000
|
-
|
|
1001
|
-
const queryFn = ({ signal }) => listOrganizationDomains({ signal, ...fetchOptions });
|
|
1002
|
-
return { queryKey, queryFn, ...queryOptions };
|
|
1134
|
+
const useRevokeAllSessions = (options, queryClient) => {
|
|
1135
|
+
const mutationOptions = getRevokeAllSessionsMutationOptions(options);
|
|
1136
|
+
return useMutation(mutationOptions, queryClient);
|
|
1003
1137
|
};
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
const query = useQuery(queryOptions, queryClient);
|
|
1007
|
-
query.queryKey = queryOptions.queryKey;
|
|
1008
|
-
return query;
|
|
1009
|
-
}
|
|
1010
|
-
const getGenerateAdminPortalLinkUrl = (params) => {
|
|
1011
|
-
const normalizedParams = new URLSearchParams();
|
|
1012
|
-
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1013
|
-
if (value !== void 0) {
|
|
1014
|
-
normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
1015
|
-
}
|
|
1016
|
-
});
|
|
1017
|
-
const stringifiedParams = normalizedParams.toString();
|
|
1018
|
-
return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/admin-portal/generate-link?${stringifiedParams}` : `https://api.workos.com/_widgets/admin-portal/generate-link`;
|
|
1138
|
+
const getRevokeSessionUrl = (sessionId) => {
|
|
1139
|
+
return `https://api.workos.com/_widgets/UserProfile/sessions/revoke/${sessionId}`;
|
|
1019
1140
|
};
|
|
1020
|
-
const
|
|
1021
|
-
const res = await fetch(
|
|
1141
|
+
const revokeSession = async (sessionId, options) => {
|
|
1142
|
+
const res = await fetch(getRevokeSessionUrl(sessionId), {
|
|
1022
1143
|
...options,
|
|
1023
|
-
method: "
|
|
1144
|
+
method: "DELETE"
|
|
1024
1145
|
});
|
|
1025
1146
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1026
1147
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -1030,24 +1151,24 @@ const generateAdminPortalLink = async (params, options) => {
|
|
|
1030
1151
|
headers: res.headers
|
|
1031
1152
|
};
|
|
1032
1153
|
};
|
|
1033
|
-
const
|
|
1034
|
-
const mutationKey = ["
|
|
1154
|
+
const getRevokeSessionMutationOptions = (options) => {
|
|
1155
|
+
const mutationKey = ["revokeSession"];
|
|
1035
1156
|
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
1036
1157
|
const mutationFn = (props) => {
|
|
1037
|
-
const {
|
|
1038
|
-
return
|
|
1158
|
+
const { sessionId } = props ?? {};
|
|
1159
|
+
return revokeSession(sessionId, fetchOptions);
|
|
1039
1160
|
};
|
|
1040
1161
|
return { mutationFn, ...mutationOptions };
|
|
1041
1162
|
};
|
|
1042
|
-
const
|
|
1043
|
-
const mutationOptions =
|
|
1163
|
+
const useRevokeSession = (options, queryClient) => {
|
|
1164
|
+
const mutationOptions = getRevokeSessionMutationOptions(options);
|
|
1044
1165
|
return useMutation(mutationOptions, queryClient);
|
|
1045
1166
|
};
|
|
1046
|
-
const
|
|
1047
|
-
return `https://api.workos.com/_widgets/
|
|
1167
|
+
const getDeleteTotpFactorsUrl = () => {
|
|
1168
|
+
return `https://api.workos.com/_widgets/UserProfile/totp-factors`;
|
|
1048
1169
|
};
|
|
1049
|
-
const
|
|
1050
|
-
const res = await fetch(
|
|
1170
|
+
const deleteTotpFactors = async (options) => {
|
|
1171
|
+
const res = await fetch(getDeleteTotpFactorsUrl(), {
|
|
1051
1172
|
...options,
|
|
1052
1173
|
method: "DELETE"
|
|
1053
1174
|
});
|
|
@@ -1059,26 +1180,27 @@ const deleteOrganizationDomain = async (domainId, options) => {
|
|
|
1059
1180
|
headers: res.headers
|
|
1060
1181
|
};
|
|
1061
1182
|
};
|
|
1062
|
-
const
|
|
1063
|
-
const mutationKey = ["
|
|
1183
|
+
const getDeleteTotpFactorsMutationOptions = (options) => {
|
|
1184
|
+
const mutationKey = ["deleteTotpFactors"];
|
|
1064
1185
|
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
1065
|
-
const mutationFn = (
|
|
1066
|
-
|
|
1067
|
-
return deleteOrganizationDomain(domainId, fetchOptions);
|
|
1186
|
+
const mutationFn = () => {
|
|
1187
|
+
return deleteTotpFactors(fetchOptions);
|
|
1068
1188
|
};
|
|
1069
1189
|
return { mutationFn, ...mutationOptions };
|
|
1070
1190
|
};
|
|
1071
|
-
const
|
|
1072
|
-
const mutationOptions =
|
|
1191
|
+
const useDeleteTotpFactors = (options, queryClient) => {
|
|
1192
|
+
const mutationOptions = getDeleteTotpFactorsMutationOptions(options);
|
|
1073
1193
|
return useMutation(mutationOptions, queryClient);
|
|
1074
1194
|
};
|
|
1075
|
-
const
|
|
1076
|
-
return `https://api.workos.com/_widgets/
|
|
1195
|
+
const getUpdatePasswordUrl = () => {
|
|
1196
|
+
return `https://api.workos.com/_widgets/UserProfile/update-password`;
|
|
1077
1197
|
};
|
|
1078
|
-
const
|
|
1079
|
-
const res = await fetch(
|
|
1198
|
+
const updatePassword = async (updatePasswordRequest, options) => {
|
|
1199
|
+
const res = await fetch(getUpdatePasswordUrl(), {
|
|
1080
1200
|
...options,
|
|
1081
|
-
method: "POST"
|
|
1201
|
+
method: "POST",
|
|
1202
|
+
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
1203
|
+
body: JSON.stringify(updatePasswordRequest)
|
|
1082
1204
|
});
|
|
1083
1205
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1084
1206
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -1088,61 +1210,55 @@ const reverifyOrganizationDomain = async (domainId, options) => {
|
|
|
1088
1210
|
headers: res.headers
|
|
1089
1211
|
};
|
|
1090
1212
|
};
|
|
1091
|
-
const
|
|
1092
|
-
const mutationKey = ["
|
|
1213
|
+
const getUpdatePasswordMutationOptions = (options) => {
|
|
1214
|
+
const mutationKey = ["updatePassword"];
|
|
1093
1215
|
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
1094
1216
|
const mutationFn = (props) => {
|
|
1095
|
-
const {
|
|
1096
|
-
return
|
|
1217
|
+
const { data } = props ?? {};
|
|
1218
|
+
return updatePassword(data, fetchOptions);
|
|
1097
1219
|
};
|
|
1098
1220
|
return { mutationFn, ...mutationOptions };
|
|
1099
1221
|
};
|
|
1100
|
-
const
|
|
1101
|
-
const mutationOptions =
|
|
1222
|
+
const useUpdatePassword = (options, queryClient) => {
|
|
1223
|
+
const mutationOptions = getUpdatePasswordMutationOptions(options);
|
|
1102
1224
|
return useMutation(mutationOptions, queryClient);
|
|
1103
1225
|
};
|
|
1104
|
-
const
|
|
1105
|
-
return `https://api.workos.com/_widgets/
|
|
1226
|
+
const getVerifyUrl = () => {
|
|
1227
|
+
return `https://api.workos.com/_widgets/UserProfile/verify`;
|
|
1106
1228
|
};
|
|
1107
|
-
const
|
|
1108
|
-
const res = await fetch(
|
|
1229
|
+
const verify = async (verifyRequest, options) => {
|
|
1230
|
+
const res = await fetch(getVerifyUrl(), {
|
|
1109
1231
|
...options,
|
|
1110
|
-
method: "
|
|
1232
|
+
method: "POST",
|
|
1233
|
+
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
1234
|
+
body: JSON.stringify(verifyRequest)
|
|
1111
1235
|
});
|
|
1112
1236
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1113
1237
|
const data = body ? JSON.parse(body) : {};
|
|
1114
|
-
return {
|
|
1115
|
-
data,
|
|
1116
|
-
status: res.status,
|
|
1117
|
-
headers: res.headers
|
|
1118
|
-
};
|
|
1238
|
+
return { data, status: res.status, headers: res.headers };
|
|
1119
1239
|
};
|
|
1120
|
-
const
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1240
|
+
const getVerifyMutationOptions = (options) => {
|
|
1241
|
+
const mutationKey = ["verify"];
|
|
1242
|
+
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
1243
|
+
const mutationFn = (props) => {
|
|
1244
|
+
const { data } = props ?? {};
|
|
1245
|
+
return verify(data, fetchOptions);
|
|
1246
|
+
};
|
|
1247
|
+
return { mutationFn, ...mutationOptions };
|
|
1124
1248
|
};
|
|
1125
|
-
const
|
|
1126
|
-
const
|
|
1127
|
-
|
|
1128
|
-
const queryFn = ({ signal }) => listSsoConnections({ signal, ...fetchOptions });
|
|
1129
|
-
return { queryKey, queryFn, ...queryOptions };
|
|
1249
|
+
const useVerify = (options, queryClient) => {
|
|
1250
|
+
const mutationOptions = getVerifyMutationOptions(options);
|
|
1251
|
+
return useMutation(mutationOptions, queryClient);
|
|
1130
1252
|
};
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
const query = useQuery(queryOptions, queryClient);
|
|
1134
|
-
query.queryKey = queryOptions.queryKey;
|
|
1135
|
-
return query;
|
|
1136
|
-
}
|
|
1137
|
-
const getCreateOrganizationApiKeyUrl = () => {
|
|
1138
|
-
return `https://api.workos.com/_widgets/ApiKeys/organization-api-keys`;
|
|
1253
|
+
const getVerifyTotpFactorUrl = () => {
|
|
1254
|
+
return `https://api.workos.com/_widgets/UserProfile/verify-totp-factor`;
|
|
1139
1255
|
};
|
|
1140
|
-
const
|
|
1141
|
-
const res = await fetch(
|
|
1256
|
+
const verifyTotpFactor = async (verifyTotpFactorRequest, options) => {
|
|
1257
|
+
const res = await fetch(getVerifyTotpFactorUrl(), {
|
|
1142
1258
|
...options,
|
|
1143
1259
|
method: "POST",
|
|
1144
1260
|
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
1145
|
-
body: JSON.stringify(
|
|
1261
|
+
body: JSON.stringify(verifyTotpFactorRequest)
|
|
1146
1262
|
});
|
|
1147
1263
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1148
1264
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -1152,20 +1268,20 @@ const createOrganizationApiKey = async (createOrganizationApiKeyRequest, options
|
|
|
1152
1268
|
headers: res.headers
|
|
1153
1269
|
};
|
|
1154
1270
|
};
|
|
1155
|
-
const
|
|
1156
|
-
const mutationKey = ["
|
|
1271
|
+
const getVerifyTotpFactorMutationOptions = (options) => {
|
|
1272
|
+
const mutationKey = ["verifyTotpFactor"];
|
|
1157
1273
|
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
1158
1274
|
const mutationFn = (props) => {
|
|
1159
1275
|
const { data } = props ?? {};
|
|
1160
|
-
return
|
|
1276
|
+
return verifyTotpFactor(data, fetchOptions);
|
|
1161
1277
|
};
|
|
1162
1278
|
return { mutationFn, ...mutationOptions };
|
|
1163
1279
|
};
|
|
1164
|
-
const
|
|
1165
|
-
const mutationOptions =
|
|
1280
|
+
const useVerifyTotpFactor = (options, queryClient) => {
|
|
1281
|
+
const mutationOptions = getVerifyTotpFactorMutationOptions(options);
|
|
1166
1282
|
return useMutation(mutationOptions, queryClient);
|
|
1167
1283
|
};
|
|
1168
|
-
const
|
|
1284
|
+
const getGenerateAdminPortalLinkUrl = (params) => {
|
|
1169
1285
|
const normalizedParams = new URLSearchParams();
|
|
1170
1286
|
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1171
1287
|
if (value !== void 0) {
|
|
@@ -1173,12 +1289,12 @@ const getListOrganizationApiKeysUrl = (params) => {
|
|
|
1173
1289
|
}
|
|
1174
1290
|
});
|
|
1175
1291
|
const stringifiedParams = normalizedParams.toString();
|
|
1176
|
-
return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/
|
|
1292
|
+
return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/admin-portal/generate-link?${stringifiedParams}` : `https://api.workos.com/_widgets/admin-portal/generate-link`;
|
|
1177
1293
|
};
|
|
1178
|
-
const
|
|
1179
|
-
const res = await fetch(
|
|
1294
|
+
const generateAdminPortalLink = async (params, options) => {
|
|
1295
|
+
const res = await fetch(getGenerateAdminPortalLinkUrl(params), {
|
|
1180
1296
|
...options,
|
|
1181
|
-
method: "
|
|
1297
|
+
method: "POST"
|
|
1182
1298
|
});
|
|
1183
1299
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1184
1300
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -1188,36 +1304,24 @@ const listOrganizationApiKeys = async (params, options) => {
|
|
|
1188
1304
|
headers: res.headers
|
|
1189
1305
|
};
|
|
1190
1306
|
};
|
|
1191
|
-
const
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1307
|
+
const getGenerateAdminPortalLinkMutationOptions = (options) => {
|
|
1308
|
+
const mutationKey = ["generateAdminPortalLink"];
|
|
1309
|
+
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
1310
|
+
const mutationFn = (props) => {
|
|
1311
|
+
const { params } = props ?? {};
|
|
1312
|
+
return generateAdminPortalLink(params, fetchOptions);
|
|
1313
|
+
};
|
|
1314
|
+
return { mutationFn, ...mutationOptions };
|
|
1196
1315
|
};
|
|
1197
|
-
const
|
|
1198
|
-
const
|
|
1199
|
-
|
|
1200
|
-
const queryFn = ({ signal }) => listOrganizationApiKeys(params, { signal, ...fetchOptions });
|
|
1201
|
-
return { queryKey, queryFn, ...queryOptions };
|
|
1316
|
+
const useGenerateAdminPortalLink = (options, queryClient) => {
|
|
1317
|
+
const mutationOptions = getGenerateAdminPortalLinkMutationOptions(options);
|
|
1318
|
+
return useMutation(mutationOptions, queryClient);
|
|
1202
1319
|
};
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
const query = useQuery(queryOptions, queryClient);
|
|
1206
|
-
query.queryKey = queryOptions.queryKey;
|
|
1207
|
-
return query;
|
|
1208
|
-
}
|
|
1209
|
-
const getListOrganizationApiKeyPermissionsUrl = (params) => {
|
|
1210
|
-
const normalizedParams = new URLSearchParams();
|
|
1211
|
-
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1212
|
-
if (value !== void 0) {
|
|
1213
|
-
normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
1214
|
-
}
|
|
1215
|
-
});
|
|
1216
|
-
const stringifiedParams = normalizedParams.toString();
|
|
1217
|
-
return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/ApiKeys/permissions?${stringifiedParams}` : `https://api.workos.com/_widgets/ApiKeys/permissions`;
|
|
1320
|
+
const getListOrganizationDomainsUrl = () => {
|
|
1321
|
+
return `https://api.workos.com/_widgets/admin-portal/organization-domains`;
|
|
1218
1322
|
};
|
|
1219
|
-
const
|
|
1220
|
-
const res = await fetch(
|
|
1323
|
+
const listOrganizationDomains = async (options) => {
|
|
1324
|
+
const res = await fetch(getListOrganizationDomainsUrl(), {
|
|
1221
1325
|
...options,
|
|
1222
1326
|
method: "GET"
|
|
1223
1327
|
});
|
|
@@ -1229,32 +1333,28 @@ const listOrganizationApiKeyPermissions = async (params, options) => {
|
|
|
1229
1333
|
headers: res.headers
|
|
1230
1334
|
};
|
|
1231
1335
|
};
|
|
1232
|
-
const
|
|
1336
|
+
const getListOrganizationDomainsQueryKey = () => {
|
|
1233
1337
|
return [
|
|
1234
|
-
`https://api.workos.com/_widgets/
|
|
1235
|
-
...params ? [params] : []
|
|
1338
|
+
`https://api.workos.com/_widgets/admin-portal/organization-domains`
|
|
1236
1339
|
];
|
|
1237
1340
|
};
|
|
1238
|
-
const
|
|
1341
|
+
const getListOrganizationDomainsQueryOptions = (options) => {
|
|
1239
1342
|
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
1240
|
-
const queryKey = queryOptions?.queryKey ??
|
|
1241
|
-
const queryFn = ({ signal }) =>
|
|
1343
|
+
const queryKey = queryOptions?.queryKey ?? getListOrganizationDomainsQueryKey();
|
|
1344
|
+
const queryFn = ({ signal }) => listOrganizationDomains({ signal, ...fetchOptions });
|
|
1242
1345
|
return { queryKey, queryFn, ...queryOptions };
|
|
1243
1346
|
};
|
|
1244
|
-
function
|
|
1245
|
-
const queryOptions =
|
|
1246
|
-
params,
|
|
1247
|
-
options
|
|
1248
|
-
);
|
|
1347
|
+
function useListOrganizationDomains(options, queryClient) {
|
|
1348
|
+
const queryOptions = getListOrganizationDomainsQueryOptions(options);
|
|
1249
1349
|
const query = useQuery(queryOptions, queryClient);
|
|
1250
1350
|
query.queryKey = queryOptions.queryKey;
|
|
1251
1351
|
return query;
|
|
1252
1352
|
}
|
|
1253
|
-
const
|
|
1254
|
-
return `https://api.workos.com/_widgets/
|
|
1353
|
+
const getDeleteOrganizationDomainUrl = (domainId) => {
|
|
1354
|
+
return `https://api.workos.com/_widgets/admin-portal/organization-domains/${domainId}`;
|
|
1255
1355
|
};
|
|
1256
|
-
const
|
|
1257
|
-
const res = await fetch(
|
|
1356
|
+
const deleteOrganizationDomain = async (domainId, options) => {
|
|
1357
|
+
const res = await fetch(getDeleteOrganizationDomainUrl(domainId), {
|
|
1258
1358
|
...options,
|
|
1259
1359
|
method: "DELETE"
|
|
1260
1360
|
});
|
|
@@ -1266,26 +1366,26 @@ const deleteOrganizationApiKey = async (apiKeyId, options) => {
|
|
|
1266
1366
|
headers: res.headers
|
|
1267
1367
|
};
|
|
1268
1368
|
};
|
|
1269
|
-
const
|
|
1270
|
-
const mutationKey = ["
|
|
1369
|
+
const getDeleteOrganizationDomainMutationOptions = (options) => {
|
|
1370
|
+
const mutationKey = ["deleteOrganizationDomain"];
|
|
1271
1371
|
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
1272
1372
|
const mutationFn = (props) => {
|
|
1273
|
-
const {
|
|
1274
|
-
return
|
|
1373
|
+
const { domainId } = props ?? {};
|
|
1374
|
+
return deleteOrganizationDomain(domainId, fetchOptions);
|
|
1275
1375
|
};
|
|
1276
1376
|
return { mutationFn, ...mutationOptions };
|
|
1277
1377
|
};
|
|
1278
|
-
const
|
|
1279
|
-
const mutationOptions =
|
|
1378
|
+
const useDeleteOrganizationDomain = (options, queryClient) => {
|
|
1379
|
+
const mutationOptions = getDeleteOrganizationDomainMutationOptions(options);
|
|
1280
1380
|
return useMutation(mutationOptions, queryClient);
|
|
1281
1381
|
};
|
|
1282
|
-
const
|
|
1283
|
-
return `https://api.workos.com/_widgets/
|
|
1382
|
+
const getReverifyOrganizationDomainUrl = (domainId) => {
|
|
1383
|
+
return `https://api.workos.com/_widgets/admin-portal/organization-domains/${domainId}/reverify`;
|
|
1284
1384
|
};
|
|
1285
|
-
const
|
|
1286
|
-
const res = await fetch(
|
|
1385
|
+
const reverifyOrganizationDomain = async (domainId, options) => {
|
|
1386
|
+
const res = await fetch(getReverifyOrganizationDomainUrl(domainId), {
|
|
1287
1387
|
...options,
|
|
1288
|
-
method: "
|
|
1388
|
+
method: "POST"
|
|
1289
1389
|
});
|
|
1290
1390
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1291
1391
|
const data = body ? JSON.parse(body) : {};
|
|
@@ -1295,33 +1395,24 @@ const myDataIntegrations = async (options) => {
|
|
|
1295
1395
|
headers: res.headers
|
|
1296
1396
|
};
|
|
1297
1397
|
};
|
|
1298
|
-
const
|
|
1299
|
-
|
|
1398
|
+
const getReverifyOrganizationDomainMutationOptions = (options) => {
|
|
1399
|
+
const mutationKey = ["reverifyOrganizationDomain"];
|
|
1400
|
+
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
1401
|
+
const mutationFn = (props) => {
|
|
1402
|
+
const { domainId } = props ?? {};
|
|
1403
|
+
return reverifyOrganizationDomain(domainId, fetchOptions);
|
|
1404
|
+
};
|
|
1405
|
+
return { mutationFn, ...mutationOptions };
|
|
1300
1406
|
};
|
|
1301
|
-
const
|
|
1302
|
-
const
|
|
1303
|
-
|
|
1304
|
-
const queryFn = ({ signal }) => myDataIntegrations({ signal, ...fetchOptions });
|
|
1305
|
-
return { queryKey, queryFn, ...queryOptions };
|
|
1407
|
+
const useReverifyOrganizationDomain = (options, queryClient) => {
|
|
1408
|
+
const mutationOptions = getReverifyOrganizationDomainMutationOptions(options);
|
|
1409
|
+
return useMutation(mutationOptions, queryClient);
|
|
1306
1410
|
};
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
const query = useQuery(queryOptions, queryClient);
|
|
1310
|
-
query.queryKey = queryOptions.queryKey;
|
|
1311
|
-
return query;
|
|
1312
|
-
}
|
|
1313
|
-
const getGetDataIntegrationAuthorizeUrlUrl = (slug, params) => {
|
|
1314
|
-
const normalizedParams = new URLSearchParams();
|
|
1315
|
-
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1316
|
-
if (value !== void 0) {
|
|
1317
|
-
normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
1318
|
-
}
|
|
1319
|
-
});
|
|
1320
|
-
const stringifiedParams = normalizedParams.toString();
|
|
1321
|
-
return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/DataIntegrations/${slug}/authorize?${stringifiedParams}` : `https://api.workos.com/_widgets/DataIntegrations/${slug}/authorize`;
|
|
1411
|
+
const getListSsoConnectionsUrl = () => {
|
|
1412
|
+
return `https://api.workos.com/_widgets/admin-portal/sso-connections`;
|
|
1322
1413
|
};
|
|
1323
|
-
const
|
|
1324
|
-
const res = await fetch(
|
|
1414
|
+
const listSsoConnections = async (options) => {
|
|
1415
|
+
const res = await fetch(getListSsoConnectionsUrl(), {
|
|
1325
1416
|
...options,
|
|
1326
1417
|
method: "GET"
|
|
1327
1418
|
});
|
|
@@ -1333,44 +1424,31 @@ const getDataIntegrationAuthorizeUrl = async (slug, params, options) => {
|
|
|
1333
1424
|
headers: res.headers
|
|
1334
1425
|
};
|
|
1335
1426
|
};
|
|
1336
|
-
const
|
|
1427
|
+
const getListSsoConnectionsQueryKey = () => {
|
|
1337
1428
|
return [
|
|
1338
|
-
`https://api.workos.com/_widgets/
|
|
1339
|
-
...params ? [params] : []
|
|
1429
|
+
`https://api.workos.com/_widgets/admin-portal/sso-connections`
|
|
1340
1430
|
];
|
|
1341
1431
|
};
|
|
1342
|
-
const
|
|
1432
|
+
const getListSsoConnectionsQueryOptions = (options) => {
|
|
1343
1433
|
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
1344
|
-
const queryKey = queryOptions?.queryKey ??
|
|
1345
|
-
const queryFn = ({ signal }) =>
|
|
1346
|
-
return {
|
|
1347
|
-
queryKey,
|
|
1348
|
-
queryFn,
|
|
1349
|
-
enabled: !!slug,
|
|
1350
|
-
...queryOptions
|
|
1351
|
-
};
|
|
1434
|
+
const queryKey = queryOptions?.queryKey ?? getListSsoConnectionsQueryKey();
|
|
1435
|
+
const queryFn = ({ signal }) => listSsoConnections({ signal, ...fetchOptions });
|
|
1436
|
+
return { queryKey, queryFn, ...queryOptions };
|
|
1352
1437
|
};
|
|
1353
|
-
function
|
|
1354
|
-
const queryOptions =
|
|
1355
|
-
slug,
|
|
1356
|
-
params,
|
|
1357
|
-
options
|
|
1358
|
-
);
|
|
1438
|
+
function useListSsoConnections(options, queryClient) {
|
|
1439
|
+
const queryOptions = getListSsoConnectionsQueryOptions(options);
|
|
1359
1440
|
const query = useQuery(queryOptions, queryClient);
|
|
1360
1441
|
query.queryKey = queryOptions.queryKey;
|
|
1361
1442
|
return query;
|
|
1362
1443
|
}
|
|
1363
|
-
const
|
|
1364
|
-
return `https://api.workos.com/_widgets/
|
|
1444
|
+
const getListDirectoriesUrl = () => {
|
|
1445
|
+
return `https://api.workos.com/_widgets/directory-sync/directories`;
|
|
1365
1446
|
};
|
|
1366
|
-
const
|
|
1367
|
-
const res = await fetch(
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
method: "GET"
|
|
1372
|
-
}
|
|
1373
|
-
);
|
|
1447
|
+
const listDirectories = async (options) => {
|
|
1448
|
+
const res = await fetch(getListDirectoriesUrl(), {
|
|
1449
|
+
...options,
|
|
1450
|
+
method: "GET"
|
|
1451
|
+
});
|
|
1374
1452
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1375
1453
|
const data = body ? JSON.parse(body) : {};
|
|
1376
1454
|
return {
|
|
@@ -1379,77 +1457,69 @@ const getDataInstallationAuthorizationStatus = async (dataIntegrationId, state,
|
|
|
1379
1457
|
headers: res.headers
|
|
1380
1458
|
};
|
|
1381
1459
|
};
|
|
1382
|
-
const
|
|
1460
|
+
const getListDirectoriesQueryKey = () => {
|
|
1383
1461
|
return [
|
|
1384
|
-
`https://api.workos.com/_widgets/
|
|
1462
|
+
`https://api.workos.com/_widgets/directory-sync/directories`
|
|
1385
1463
|
];
|
|
1386
1464
|
};
|
|
1387
|
-
const
|
|
1465
|
+
const getListDirectoriesQueryOptions = (options) => {
|
|
1388
1466
|
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
1389
|
-
const queryKey = queryOptions?.queryKey ??
|
|
1390
|
-
const queryFn = ({
|
|
1391
|
-
signal
|
|
1392
|
-
|
|
1393
|
-
}
|
|
1394
|
-
return {
|
|
1395
|
-
queryKey,
|
|
1396
|
-
queryFn,
|
|
1397
|
-
enabled: !!(dataIntegrationId && state),
|
|
1398
|
-
...queryOptions
|
|
1399
|
-
};
|
|
1467
|
+
const queryKey = queryOptions?.queryKey ?? getListDirectoriesQueryKey();
|
|
1468
|
+
const queryFn = ({
|
|
1469
|
+
signal
|
|
1470
|
+
}) => listDirectories({ signal, ...fetchOptions });
|
|
1471
|
+
return { queryKey, queryFn, ...queryOptions };
|
|
1400
1472
|
};
|
|
1401
|
-
function
|
|
1402
|
-
const queryOptions =
|
|
1403
|
-
dataIntegrationId,
|
|
1404
|
-
state,
|
|
1405
|
-
options
|
|
1406
|
-
);
|
|
1473
|
+
function useListDirectories(options, queryClient) {
|
|
1474
|
+
const queryOptions = getListDirectoriesQueryOptions(options);
|
|
1407
1475
|
const query = useQuery(queryOptions, queryClient);
|
|
1408
1476
|
query.queryKey = queryOptions.queryKey;
|
|
1409
1477
|
return query;
|
|
1410
1478
|
}
|
|
1411
|
-
const
|
|
1412
|
-
return `https://api.workos.com/_widgets/
|
|
1479
|
+
const getSettingsUrl = () => {
|
|
1480
|
+
return `https://api.workos.com/_widgets/settings`;
|
|
1413
1481
|
};
|
|
1414
|
-
const
|
|
1415
|
-
const res = await fetch(
|
|
1482
|
+
const settings = async (options) => {
|
|
1483
|
+
const res = await fetch(getSettingsUrl(), {
|
|
1416
1484
|
...options,
|
|
1417
|
-
method: "
|
|
1485
|
+
method: "GET"
|
|
1418
1486
|
});
|
|
1419
1487
|
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1420
1488
|
const data = body ? JSON.parse(body) : {};
|
|
1421
|
-
return {
|
|
1422
|
-
data,
|
|
1423
|
-
status: res.status,
|
|
1424
|
-
headers: res.headers
|
|
1425
|
-
};
|
|
1489
|
+
return { data, status: res.status, headers: res.headers };
|
|
1426
1490
|
};
|
|
1427
|
-
const
|
|
1428
|
-
|
|
1429
|
-
const { mutation: mutationOptions, fetch: fetchOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, fetch: void 0 };
|
|
1430
|
-
const mutationFn = (props) => {
|
|
1431
|
-
const { installationId } = props ?? {};
|
|
1432
|
-
return deleteDataInstallation(installationId, fetchOptions);
|
|
1433
|
-
};
|
|
1434
|
-
return { mutationFn, ...mutationOptions };
|
|
1491
|
+
const getSettingsQueryKey = () => {
|
|
1492
|
+
return [`https://api.workos.com/_widgets/settings`];
|
|
1435
1493
|
};
|
|
1436
|
-
const
|
|
1437
|
-
const
|
|
1438
|
-
|
|
1494
|
+
const getSettingsQueryOptions = (options) => {
|
|
1495
|
+
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
1496
|
+
const queryKey = queryOptions?.queryKey ?? getSettingsQueryKey();
|
|
1497
|
+
const queryFn = ({
|
|
1498
|
+
signal
|
|
1499
|
+
}) => settings({ signal, ...fetchOptions });
|
|
1500
|
+
return { queryKey, queryFn, ...queryOptions };
|
|
1439
1501
|
};
|
|
1502
|
+
function useSettings(options, queryClient) {
|
|
1503
|
+
const queryOptions = getSettingsQueryOptions(options);
|
|
1504
|
+
const query = useQuery(queryOptions, queryClient);
|
|
1505
|
+
query.queryKey = queryOptions.queryKey;
|
|
1506
|
+
return query;
|
|
1507
|
+
}
|
|
1440
1508
|
export {
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1509
|
+
AuthenticationInformationResponseDataVerificationMethodsMfaOneOfProvider,
|
|
1510
|
+
AuthenticationInformationResponseDataVerificationMethodsPasskeyOneOfProvider,
|
|
1511
|
+
AuthenticationInformationResponseDataVerificationMethodsPasswordOneOfProvider,
|
|
1444
1512
|
CreateTotpFactorResponseAuthenticationChallengeAllOfObject,
|
|
1445
1513
|
CreateTotpFactorResponseAuthenticationFactorAllOfObject,
|
|
1446
1514
|
CreateTotpFactorResponseAuthenticationFactorAllOfType,
|
|
1447
|
-
|
|
1448
|
-
|
|
1515
|
+
DataInstallationAllOfObject,
|
|
1516
|
+
DataInstallationAllOfState,
|
|
1449
1517
|
DataIntegrationCredentialsType,
|
|
1450
1518
|
DataIntegrationIntegrationType,
|
|
1451
1519
|
DataIntegrationObject,
|
|
1452
1520
|
DataIntegrationOwnership,
|
|
1521
|
+
DirectoryState,
|
|
1522
|
+
DirectoryType,
|
|
1453
1523
|
DomainVerificationNameServer,
|
|
1454
1524
|
GenerateAdminPortalLinkIntent,
|
|
1455
1525
|
MemberActionsItem,
|
|
@@ -1507,6 +1577,9 @@ export {
|
|
|
1507
1577
|
getGetDataIntegrationAuthorizeUrlUrl,
|
|
1508
1578
|
getInviteMemberMutationOptions,
|
|
1509
1579
|
getInviteMemberUrl,
|
|
1580
|
+
getListDirectoriesQueryKey,
|
|
1581
|
+
getListDirectoriesQueryOptions,
|
|
1582
|
+
getListDirectoriesUrl,
|
|
1510
1583
|
getListOrganizationApiKeyPermissionsQueryKey,
|
|
1511
1584
|
getListOrganizationApiKeyPermissionsQueryOptions,
|
|
1512
1585
|
getListOrganizationApiKeyPermissionsUrl,
|
|
@@ -1572,6 +1645,7 @@ export {
|
|
|
1572
1645
|
getVerifyTotpFactorUrl,
|
|
1573
1646
|
getVerifyUrl,
|
|
1574
1647
|
inviteMember,
|
|
1648
|
+
listDirectories,
|
|
1575
1649
|
listOrganizationApiKeyPermissions,
|
|
1576
1650
|
listOrganizationApiKeys,
|
|
1577
1651
|
listOrganizationDomains,
|
|
@@ -1608,6 +1682,7 @@ export {
|
|
|
1608
1682
|
useGetDataInstallationAuthorizationStatus,
|
|
1609
1683
|
useGetDataIntegrationAuthorizeUrl,
|
|
1610
1684
|
useInviteMember,
|
|
1685
|
+
useListDirectories,
|
|
1611
1686
|
useListOrganizationApiKeyPermissions,
|
|
1612
1687
|
useListOrganizationApiKeys,
|
|
1613
1688
|
useListOrganizationDomains,
|