@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
@@ -12,33 +12,6 @@ const MemberActionsItem = {
12
12
  "revoke-invite": "revoke-invite",
13
13
  "revoke-membership": "revoke-membership"
14
14
  };
15
- const CreateTotpFactorResponseAuthenticationFactorAllOfObject = {
16
- authentication_factor: "authentication_factor"
17
- };
18
- const CreateTotpFactorResponseAuthenticationFactorAllOfType = {
19
- generic_otp: "generic_otp",
20
- sms: "sms",
21
- totp: "totp",
22
- webauthn: "webauthn"
23
- };
24
- const CreateTotpFactorResponseAuthenticationChallengeAllOfObject = {
25
- authentication_challenge: "authentication_challenge"
26
- };
27
- const AuthenticationInformationResponseDataVerificationMethodsMfaProvider = {
28
- MFA: "MFA"
29
- };
30
- const AuthenticationInformationResponseDataVerificationMethodsPasswordProvider = {
31
- Password: "Password"
32
- };
33
- const AuthenticationInformationResponseDataVerificationMethodsPasskeyProvider = {
34
- Passkey: "Passkey"
35
- };
36
- const SendVerificationResponseType = {
37
- EmailVerification: "EmailVerification"
38
- };
39
- const SettingsResponseObject = {
40
- settings: "settings"
41
- };
42
15
  const OrganizationDomainState = {
43
16
  Failed: "Failed",
44
17
  LegacyVerified: "LegacyVerified",
@@ -71,126 +44,78 @@ const SsoConnectionSessionJSONState = {
71
44
  ...SamlSessionState,
72
45
  ...OidcSessionState
73
46
  };
74
- const SsoConnectionAnyOfType = {
75
- AdfsSaml: "AdfsSaml",
76
- Auth0Saml: "Auth0Saml",
77
- AzureSaml: "AzureSaml",
78
- CasSaml: "CasSaml",
79
- ClassLinkSaml: "ClassLinkSaml",
80
- CloudflareSaml: "CloudflareSaml",
81
- CyberArkSaml: "CyberArkSaml",
82
- DuoSaml: "DuoSaml",
83
- GenericSaml: "GenericSaml",
84
- GoogleSaml: "GoogleSaml",
85
- JumpCloudSaml: "JumpCloudSaml",
86
- KeycloakSaml: "KeycloakSaml",
87
- LastPassSaml: "LastPassSaml",
88
- MiniOrangeSaml: "MiniOrangeSaml",
89
- NetIqSaml: "NetIqSaml",
90
- OktaSaml: "OktaSaml",
91
- OneLoginSaml: "OneLoginSaml",
92
- OracleSaml: "OracleSaml",
93
- PingFederateSaml: "PingFederateSaml",
94
- PingOneSaml: "PingOneSaml",
95
- RipplingSaml: "RipplingSaml",
96
- SalesforceSaml: "SalesforceSaml",
97
- ShibbolethGenericSaml: "ShibbolethGenericSaml",
98
- ShibbolethSaml: "ShibbolethSaml",
99
- SimpleSamlPhpSaml: "SimpleSamlPhpSaml",
100
- TestIdp: "TestIdp",
101
- VmWareSaml: "VmWareSaml"
102
- };
103
- const SsoConnectionAnyOfState = {
104
- Inactive: "Inactive",
105
- Validating: "Validating",
106
- Active: "Active",
107
- Deleting: "Deleting"
108
- };
109
- const SsoConnectionAnyOfProviderTag = {
110
- Saml: "Saml"
111
- };
112
- const SsoConnectionAnyOfEightAllOfState = {
113
- Inactive: "Inactive",
114
- Validating: "Validating",
115
- Active: "Active",
116
- Deleting: "Deleting"
117
- };
118
- const SsoConnectionAnyOfEightAllOfType = {
119
- AdpOidc: "AdpOidc",
120
- Auth0Migration: "Auth0Migration",
121
- CleverOidc: "CleverOidc",
122
- EntraIdOidc: "EntraIdOidc",
123
- GenericOidc: "GenericOidc",
124
- GoogleOidc: "GoogleOidc",
125
- OktaOidc: "OktaOidc",
126
- LoginGovOidc: "LoginGovOidc"
127
- };
128
- const SsoConnectionAnyOfEightAllOfProviderTag = {
129
- OpenIdConnect: "OpenIdConnect"
130
- };
131
- const DataInstallationObject = {
132
- data_installation: "data_installation",
133
- connected_account: "connected_account"
134
- };
135
- const DataInstallationState = {
136
- connected: "connected",
137
- needs_reauthorization: "needs_reauthorization"
138
- };
139
- const DataIntegrationObject = {
140
- data_integration: "data_integration"
141
- };
142
- const DataIntegrationIntegrationType = {
143
- asana: "asana",
144
- box: "box",
145
- "cal-dot-com": "cal-dot-com",
146
- calendly: "calendly",
147
- confluence: "confluence",
148
- dropbox: "dropbox",
149
- "frame-io": "frame-io",
150
- front: "front",
151
- github: "github",
152
- gitlab: "gitlab",
153
- gmail: "gmail",
154
- google: "google",
155
- "google-calendar": "google-calendar",
156
- "google-drive": "google-drive",
157
- helpscout: "helpscout",
158
- hubspot: "hubspot",
159
- intercom: "intercom",
160
- jira: "jira",
161
- linear: "linear",
162
- microsoft: "microsoft",
163
- "microsoft-onedrive": "microsoft-onedrive",
164
- "microsoft-onenote": "microsoft-onenote",
165
- "microsoft-outlook": "microsoft-outlook",
166
- "microsoft-outlook-calendar": "microsoft-outlook-calendar",
167
- "microsoft-sharepoint": "microsoft-sharepoint",
168
- "microsoft-teams": "microsoft-teams",
169
- "microsoft-todo": "microsoft-todo",
170
- notion: "notion",
171
- prefect: "prefect",
172
- "pydantic-logfire": "pydantic-logfire",
173
- salesforce: "salesforce",
174
- sentry: "sentry",
175
- slack: "slack",
176
- snowflake: "snowflake",
177
- stripe: "stripe",
178
- xero: "xero",
179
- zendesk: "zendesk"
180
- };
181
- const DataIntegrationOwnership = {
182
- userland_user: "userland_user",
183
- organization: "organization"
184
- };
185
- const DataIntegrationCredentialsType = {
186
- shared: "shared",
187
- custom: "custom"
47
+ const DirectoryType = {
48
+ azure_scim_v20: "azure scim v2.0",
49
+ bamboohr: "bamboohr",
50
+ breathe_hr: "breathe hr",
51
+ cezanne_hr: "cezanne hr",
52
+ cyberark_scim_v20: "cyberark scim v2.0",
53
+ fourth_hr: "fourth hr",
54
+ generic_scim_v20: "generic scim v2.0",
55
+ gsuite_directory: "gsuite directory",
56
+ gusto: "gusto",
57
+ hibob: "hibob",
58
+ jump_cloud_scim_v20: "jump cloud scim v2.0",
59
+ okta_scim_v20: "okta scim v2.0",
60
+ onelogin_scim_v20: "onelogin scim v2.0",
61
+ people_hr: "people hr",
62
+ personio: "personio",
63
+ pingfederate_scim_v20: "pingfederate scim v2.0",
64
+ rippling: "rippling",
65
+ rippling_scim_v20: "rippling scim v2.0",
66
+ s3: "s3",
67
+ sailpoint_scim_v20: "sailpoint scim v2.0",
68
+ sftp: "sftp",
69
+ sftp_workday: "sftp workday",
70
+ workday: "workday"
71
+ };
72
+ const DirectoryState = {
73
+ requires_type: "requires_type",
74
+ linked: "linked",
75
+ validating: "validating",
76
+ invalid_credentials: "invalid_credentials",
77
+ unlinked: "unlinked",
78
+ deleting: "deleting"
188
79
  };
189
80
  const GenerateAdminPortalLinkIntent = {
190
81
  domain_verification: "domain_verification",
191
- sso: "sso"
82
+ sso: "sso",
83
+ log_streams: "log_streams"
192
84
  };
193
- const getMembersUrl = (params) => {
85
+ const getCreateOrganizationApiKeyUrl = () => {
86
+ return `https://api.workos.com/_widgets/ApiKeys/organization-api-keys`;
87
+ };
88
+ const createOrganizationApiKey = async (createOrganizationApiKeyRequest, options) => {
89
+ const res = await fetch(getCreateOrganizationApiKeyUrl(), {
90
+ ...options,
91
+ method: "POST",
92
+ headers: { "Content-Type": "application/json", ...options?.headers },
93
+ body: JSON.stringify(createOrganizationApiKeyRequest)
94
+ });
95
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
96
+ const data = body ? JSON.parse(body) : {};
97
+ return {
98
+ data,
99
+ status: res.status,
100
+ headers: res.headers
101
+ };
102
+ };
103
+ const getCreateOrganizationApiKeyMutationOptions = (options) => {
104
+ const mutationKey = ["createOrganizationApiKey"];
105
+ 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 };
106
+ const mutationFn = (props) => {
107
+ const { data } = props ?? {};
108
+ return createOrganizationApiKey(data, fetchOptions);
109
+ };
110
+ return { mutationFn, ...mutationOptions };
111
+ };
112
+ const useCreateOrganizationApiKey = (options, queryClient) => {
113
+ return useMutation(
114
+ getCreateOrganizationApiKeyMutationOptions(options),
115
+ queryClient
116
+ );
117
+ };
118
+ const getListOrganizationApiKeysUrl = (params) => {
194
119
  const normalizedParams = new URLSearchParams();
195
120
  Object.entries(params || {}).forEach(([key, value]) => {
196
121
  if (value !== void 0) {
@@ -198,71 +123,148 @@ const getMembersUrl = (params) => {
198
123
  }
199
124
  });
200
125
  const stringifiedParams = normalizedParams.toString();
201
- return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/UserManagement/members?${stringifiedParams}` : `https://api.workos.com/_widgets/UserManagement/members`;
126
+ return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/ApiKeys/organization-api-keys?${stringifiedParams}` : `https://api.workos.com/_widgets/ApiKeys/organization-api-keys`;
202
127
  };
203
- const members = async (params, options) => {
204
- const res = await fetch(getMembersUrl(params), {
128
+ const listOrganizationApiKeys = async (params, options) => {
129
+ const res = await fetch(getListOrganizationApiKeysUrl(params), {
205
130
  ...options,
206
131
  method: "GET"
207
132
  });
208
133
  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
209
134
  const data = body ? JSON.parse(body) : {};
210
- return { data, status: res.status, headers: res.headers };
135
+ return {
136
+ data,
137
+ status: res.status,
138
+ headers: res.headers
139
+ };
211
140
  };
212
- const getMembersQueryKey = (params) => {
141
+ const getListOrganizationApiKeysQueryKey = (params) => {
213
142
  return [
214
- `https://api.workos.com/_widgets/UserManagement/members`,
143
+ `https://api.workos.com/_widgets/ApiKeys/organization-api-keys`,
215
144
  ...params ? [params] : []
216
145
  ];
217
146
  };
218
- const getMembersQueryOptions = (params, options) => {
147
+ const getListOrganizationApiKeysQueryOptions = (params, options) => {
219
148
  const { query: queryOptions, fetch: fetchOptions } = options ?? {};
220
- const queryKey = queryOptions?.queryKey ?? getMembersQueryKey(params);
221
- const queryFn = ({
222
- signal
223
- }) => members(params, { signal, ...fetchOptions });
149
+ const queryKey = queryOptions?.queryKey ?? getListOrganizationApiKeysQueryKey(params);
150
+ const queryFn = ({ signal }) => listOrganizationApiKeys(params, { signal, ...fetchOptions });
224
151
  return { queryKey, queryFn, ...queryOptions };
225
152
  };
226
- function useMembers(params, options, queryClient) {
227
- const queryOptions = getMembersQueryOptions(params, options);
153
+ function useListOrganizationApiKeys(params, options, queryClient) {
154
+ const queryOptions = getListOrganizationApiKeysQueryOptions(params, options);
228
155
  const query = useQuery(queryOptions, queryClient);
229
- query.queryKey = queryOptions.queryKey;
230
- return query;
156
+ return { ...query, queryKey: queryOptions.queryKey };
231
157
  }
232
- const getRolesUrl = () => {
233
- return `https://api.workos.com/_widgets/UserManagement/roles`;
158
+ const getListOrganizationApiKeyPermissionsUrl = (params) => {
159
+ const normalizedParams = new URLSearchParams();
160
+ Object.entries(params || {}).forEach(([key, value]) => {
161
+ if (value !== void 0) {
162
+ normalizedParams.append(key, value === null ? "null" : value.toString());
163
+ }
164
+ });
165
+ const stringifiedParams = normalizedParams.toString();
166
+ return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/ApiKeys/permissions?${stringifiedParams}` : `https://api.workos.com/_widgets/ApiKeys/permissions`;
234
167
  };
235
- const roles = async (options) => {
236
- const res = await fetch(getRolesUrl(), {
168
+ const listOrganizationApiKeyPermissions = async (params, options) => {
169
+ const res = await fetch(getListOrganizationApiKeyPermissionsUrl(params), {
237
170
  ...options,
238
171
  method: "GET"
239
172
  });
240
173
  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
241
174
  const data = body ? JSON.parse(body) : {};
242
- return { data, status: res.status, headers: res.headers };
175
+ return {
176
+ data,
177
+ status: res.status,
178
+ headers: res.headers
179
+ };
243
180
  };
244
- const getRolesQueryKey = () => {
245
- return [`https://api.workos.com/_widgets/UserManagement/roles`];
181
+ const getListOrganizationApiKeyPermissionsQueryKey = (params) => {
182
+ return [
183
+ `https://api.workos.com/_widgets/ApiKeys/permissions`,
184
+ ...params ? [params] : []
185
+ ];
246
186
  };
247
- const getRolesQueryOptions = (options) => {
187
+ const getListOrganizationApiKeyPermissionsQueryOptions = (params, options) => {
248
188
  const { query: queryOptions, fetch: fetchOptions } = options ?? {};
249
- const queryKey = queryOptions?.queryKey ?? getRolesQueryKey();
250
- const queryFn = ({
251
- signal
252
- }) => roles({ signal, ...fetchOptions });
189
+ const queryKey = queryOptions?.queryKey ?? getListOrganizationApiKeyPermissionsQueryKey(params);
190
+ const queryFn = ({ signal }) => listOrganizationApiKeyPermissions(params, { signal, ...fetchOptions });
253
191
  return { queryKey, queryFn, ...queryOptions };
254
192
  };
255
- function useRoles(options, queryClient) {
256
- const queryOptions = getRolesQueryOptions(options);
193
+ function useListOrganizationApiKeyPermissions(params, options, queryClient) {
194
+ const queryOptions = getListOrganizationApiKeyPermissionsQueryOptions(
195
+ params,
196
+ options
197
+ );
257
198
  const query = useQuery(queryOptions, queryClient);
258
- query.queryKey = queryOptions.queryKey;
259
- return query;
199
+ return { ...query, queryKey: queryOptions.queryKey };
260
200
  }
261
- const getRolesAndConfigUrl = () => {
262
- return `https://api.workos.com/_widgets/UserManagement/roles-and-config`;
201
+ const getDeleteOrganizationApiKeyUrl = (apiKeyId) => {
202
+ return `https://api.workos.com/_widgets/ApiKeys/${apiKeyId}`;
263
203
  };
264
- const rolesAndConfig = async (options) => {
265
- const res = await fetch(getRolesAndConfigUrl(), {
204
+ const deleteOrganizationApiKey = async (apiKeyId, options) => {
205
+ const res = await fetch(getDeleteOrganizationApiKeyUrl(apiKeyId), {
206
+ ...options,
207
+ method: "DELETE"
208
+ });
209
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
210
+ const data = body ? JSON.parse(body) : {};
211
+ return {
212
+ data,
213
+ status: res.status,
214
+ headers: res.headers
215
+ };
216
+ };
217
+ const getDeleteOrganizationApiKeyMutationOptions = (options) => {
218
+ const mutationKey = ["deleteOrganizationApiKey"];
219
+ 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 };
220
+ const mutationFn = (props) => {
221
+ const { apiKeyId } = props ?? {};
222
+ return deleteOrganizationApiKey(apiKeyId, fetchOptions);
223
+ };
224
+ return { mutationFn, ...mutationOptions };
225
+ };
226
+ const useDeleteOrganizationApiKey = (options, queryClient) => {
227
+ return useMutation(
228
+ getDeleteOrganizationApiKeyMutationOptions(options),
229
+ queryClient
230
+ );
231
+ };
232
+ const getDeleteDataInstallationUrl = (installationId) => {
233
+ return `https://api.workos.com/_widgets/DataIntegrations/installations/${installationId}`;
234
+ };
235
+ const deleteDataInstallation = async (installationId, options) => {
236
+ const res = await fetch(getDeleteDataInstallationUrl(installationId), {
237
+ ...options,
238
+ method: "DELETE"
239
+ });
240
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
241
+ const data = body ? JSON.parse(body) : {};
242
+ return {
243
+ data,
244
+ status: res.status,
245
+ headers: res.headers
246
+ };
247
+ };
248
+ const getDeleteDataInstallationMutationOptions = (options) => {
249
+ const mutationKey = ["deleteDataInstallation"];
250
+ 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 };
251
+ const mutationFn = (props) => {
252
+ const { installationId } = props ?? {};
253
+ return deleteDataInstallation(installationId, fetchOptions);
254
+ };
255
+ return { mutationFn, ...mutationOptions };
256
+ };
257
+ const useDeleteDataInstallation = (options, queryClient) => {
258
+ return useMutation(
259
+ getDeleteDataInstallationMutationOptions(options),
260
+ queryClient
261
+ );
262
+ };
263
+ const getMyDataIntegrationsUrl = () => {
264
+ return `https://api.workos.com/_widgets/DataIntegrations/mine`;
265
+ };
266
+ const myDataIntegrations = async (options) => {
267
+ const res = await fetch(getMyDataIntegrationsUrl(), {
266
268
  ...options,
267
269
  method: "GET"
268
270
  });
@@ -274,24 +276,115 @@ const rolesAndConfig = async (options) => {
274
276
  headers: res.headers
275
277
  };
276
278
  };
277
- const getRolesAndConfigQueryKey = () => {
279
+ const getMyDataIntegrationsQueryKey = () => {
280
+ return [`https://api.workos.com/_widgets/DataIntegrations/mine`];
281
+ };
282
+ const getMyDataIntegrationsQueryOptions = (options) => {
283
+ const { query: queryOptions, fetch: fetchOptions } = options ?? {};
284
+ const queryKey = queryOptions?.queryKey ?? getMyDataIntegrationsQueryKey();
285
+ const queryFn = ({ signal }) => myDataIntegrations({ signal, ...fetchOptions });
286
+ return { queryKey, queryFn, ...queryOptions };
287
+ };
288
+ function useMyDataIntegrations(options, queryClient) {
289
+ const queryOptions = getMyDataIntegrationsQueryOptions(options);
290
+ const query = useQuery(queryOptions, queryClient);
291
+ return { ...query, queryKey: queryOptions.queryKey };
292
+ }
293
+ const getGetDataInstallationAuthorizationStatusUrl = (dataIntegrationId, state) => {
294
+ return `https://api.workos.com/_widgets/DataIntegrations/${dataIntegrationId}/authorization-status/${state}`;
295
+ };
296
+ const getDataInstallationAuthorizationStatus = async (dataIntegrationId, state, options) => {
297
+ const res = await fetch(
298
+ getGetDataInstallationAuthorizationStatusUrl(dataIntegrationId, state),
299
+ {
300
+ ...options,
301
+ method: "GET"
302
+ }
303
+ );
304
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
305
+ const data = body ? JSON.parse(body) : {};
306
+ return {
307
+ data,
308
+ status: res.status,
309
+ headers: res.headers
310
+ };
311
+ };
312
+ const getGetDataInstallationAuthorizationStatusQueryKey = (dataIntegrationId, state) => {
278
313
  return [
279
- `https://api.workos.com/_widgets/UserManagement/roles-and-config`
314
+ `https://api.workos.com/_widgets/DataIntegrations/${dataIntegrationId}/authorization-status/${state}`
280
315
  ];
281
316
  };
282
- const getRolesAndConfigQueryOptions = (options) => {
317
+ const getGetDataInstallationAuthorizationStatusQueryOptions = (dataIntegrationId, state, options) => {
283
318
  const { query: queryOptions, fetch: fetchOptions } = options ?? {};
284
- const queryKey = queryOptions?.queryKey ?? getRolesAndConfigQueryKey();
285
- const queryFn = ({
286
- signal
287
- }) => rolesAndConfig({ signal, ...fetchOptions });
288
- return { queryKey, queryFn, ...queryOptions };
319
+ const queryKey = queryOptions?.queryKey ?? getGetDataInstallationAuthorizationStatusQueryKey(dataIntegrationId, state);
320
+ const queryFn = ({ signal }) => getDataInstallationAuthorizationStatus(dataIntegrationId, state, {
321
+ signal,
322
+ ...fetchOptions
323
+ });
324
+ return {
325
+ queryKey,
326
+ queryFn,
327
+ enabled: !!(dataIntegrationId && state),
328
+ ...queryOptions
329
+ };
289
330
  };
290
- function useRolesAndConfig(options, queryClient) {
291
- const queryOptions = getRolesAndConfigQueryOptions(options);
331
+ function useGetDataInstallationAuthorizationStatus(dataIntegrationId, state, options, queryClient) {
332
+ const queryOptions = getGetDataInstallationAuthorizationStatusQueryOptions(
333
+ dataIntegrationId,
334
+ state,
335
+ options
336
+ );
337
+ const query = useQuery(queryOptions, queryClient);
338
+ return { ...query, queryKey: queryOptions.queryKey };
339
+ }
340
+ const getGetDataIntegrationAuthorizeUrlUrl = (slug, params) => {
341
+ const normalizedParams = new URLSearchParams();
342
+ Object.entries(params || {}).forEach(([key, value]) => {
343
+ if (value !== void 0) {
344
+ normalizedParams.append(key, value === null ? "null" : value.toString());
345
+ }
346
+ });
347
+ const stringifiedParams = normalizedParams.toString();
348
+ return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/DataIntegrations/${slug}/authorize?${stringifiedParams}` : `https://api.workos.com/_widgets/DataIntegrations/${slug}/authorize`;
349
+ };
350
+ const getDataIntegrationAuthorizeUrl = async (slug, params, options) => {
351
+ const res = await fetch(getGetDataIntegrationAuthorizeUrlUrl(slug, params), {
352
+ ...options,
353
+ method: "GET"
354
+ });
355
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
356
+ const data = body ? JSON.parse(body) : {};
357
+ return {
358
+ data,
359
+ status: res.status,
360
+ headers: res.headers
361
+ };
362
+ };
363
+ const getGetDataIntegrationAuthorizeUrlQueryKey = (slug, params) => {
364
+ return [
365
+ `https://api.workos.com/_widgets/DataIntegrations/${slug}/authorize`,
366
+ ...params ? [params] : []
367
+ ];
368
+ };
369
+ const getGetDataIntegrationAuthorizeUrlQueryOptions = (slug, params, options) => {
370
+ const { query: queryOptions, fetch: fetchOptions } = options ?? {};
371
+ const queryKey = queryOptions?.queryKey ?? getGetDataIntegrationAuthorizeUrlQueryKey(slug, params);
372
+ const queryFn = ({ signal }) => getDataIntegrationAuthorizeUrl(slug, params, { signal, ...fetchOptions });
373
+ return {
374
+ queryKey,
375
+ queryFn,
376
+ enabled: !!slug,
377
+ ...queryOptions
378
+ };
379
+ };
380
+ function useGetDataIntegrationAuthorizeUrl(slug, params, options, queryClient) {
381
+ const queryOptions = getGetDataIntegrationAuthorizeUrlQueryOptions(
382
+ slug,
383
+ params,
384
+ options
385
+ );
292
386
  const query = useQuery(queryOptions, queryClient);
293
- query.queryKey = queryOptions.queryKey;
294
- return query;
387
+ return { ...query, queryKey: queryOptions.queryKey };
295
388
  }
296
389
  const getInviteMemberUrl = () => {
297
390
  return `https://api.workos.com/_widgets/UserManagement/invite-user`;
@@ -321,16 +414,15 @@ const getInviteMemberMutationOptions = (options) => {
321
414
  return { mutationFn, ...mutationOptions };
322
415
  };
323
416
  const useInviteMember = (options, queryClient) => {
324
- const mutationOptions = getInviteMemberMutationOptions(options);
325
- return useMutation(mutationOptions, queryClient);
417
+ return useMutation(getInviteMemberMutationOptions(options), queryClient);
326
418
  };
327
- const getResendInviteUrl = (userId) => {
328
- return `https://api.workos.com/_widgets/UserManagement/invites/${userId}/resend`;
419
+ const getRevokeInviteUrl = (userId) => {
420
+ return `https://api.workos.com/_widgets/UserManagement/invites/${userId}`;
329
421
  };
330
- const resendInvite = async (userId, options) => {
331
- const res = await fetch(getResendInviteUrl(userId), {
422
+ const revokeInvite = async (userId, options) => {
423
+ const res = await fetch(getRevokeInviteUrl(userId), {
332
424
  ...options,
333
- method: "POST"
425
+ method: "DELETE"
334
426
  });
335
427
  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
336
428
  const data = body ? JSON.parse(body) : {};
@@ -340,26 +432,25 @@ const resendInvite = async (userId, options) => {
340
432
  headers: res.headers
341
433
  };
342
434
  };
343
- const getResendInviteMutationOptions = (options) => {
344
- const mutationKey = ["resendInvite"];
435
+ const getRevokeInviteMutationOptions = (options) => {
436
+ const mutationKey = ["revokeInvite"];
345
437
  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
438
  const mutationFn = (props) => {
347
439
  const { userId } = props ?? {};
348
- return resendInvite(userId, fetchOptions);
440
+ return revokeInvite(userId, fetchOptions);
349
441
  };
350
442
  return { mutationFn, ...mutationOptions };
351
443
  };
352
- const useResendInvite = (options, queryClient) => {
353
- const mutationOptions = getResendInviteMutationOptions(options);
354
- return useMutation(mutationOptions, queryClient);
444
+ const useRevokeInvite = (options, queryClient) => {
445
+ return useMutation(getRevokeInviteMutationOptions(options), queryClient);
355
446
  };
356
- const getRevokeInviteUrl = (userId) => {
357
- return `https://api.workos.com/_widgets/UserManagement/invites/${userId}`;
447
+ const getResendInviteUrl = (userId) => {
448
+ return `https://api.workos.com/_widgets/UserManagement/invites/${userId}/resend`;
358
449
  };
359
- const revokeInvite = async (userId, options) => {
360
- const res = await fetch(getRevokeInviteUrl(userId), {
450
+ const resendInvite = async (userId, options) => {
451
+ const res = await fetch(getResendInviteUrl(userId), {
361
452
  ...options,
362
- method: "DELETE"
453
+ method: "POST"
363
454
  });
364
455
  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
365
456
  const data = body ? JSON.parse(body) : {};
@@ -369,19 +460,56 @@ const revokeInvite = async (userId, options) => {
369
460
  headers: res.headers
370
461
  };
371
462
  };
372
- const getRevokeInviteMutationOptions = (options) => {
373
- const mutationKey = ["revokeInvite"];
463
+ const getResendInviteMutationOptions = (options) => {
464
+ const mutationKey = ["resendInvite"];
374
465
  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 };
375
466
  const mutationFn = (props) => {
376
467
  const { userId } = props ?? {};
377
- return revokeInvite(userId, fetchOptions);
468
+ return resendInvite(userId, fetchOptions);
378
469
  };
379
470
  return { mutationFn, ...mutationOptions };
380
471
  };
381
- const useRevokeInvite = (options, queryClient) => {
382
- const mutationOptions = getRevokeInviteMutationOptions(options);
383
- return useMutation(mutationOptions, queryClient);
472
+ const useResendInvite = (options, queryClient) => {
473
+ return useMutation(getResendInviteMutationOptions(options), queryClient);
474
+ };
475
+ const getMembersUrl = (params) => {
476
+ const normalizedParams = new URLSearchParams();
477
+ Object.entries(params || {}).forEach(([key, value]) => {
478
+ if (value !== void 0) {
479
+ normalizedParams.append(key, value === null ? "null" : value.toString());
480
+ }
481
+ });
482
+ const stringifiedParams = normalizedParams.toString();
483
+ return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/UserManagement/members?${stringifiedParams}` : `https://api.workos.com/_widgets/UserManagement/members`;
484
+ };
485
+ const members = async (params, options) => {
486
+ const res = await fetch(getMembersUrl(params), {
487
+ ...options,
488
+ method: "GET"
489
+ });
490
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
491
+ const data = body ? JSON.parse(body) : {};
492
+ return { data, status: res.status, headers: res.headers };
493
+ };
494
+ const getMembersQueryKey = (params) => {
495
+ return [
496
+ `https://api.workos.com/_widgets/UserManagement/members`,
497
+ ...params ? [params] : []
498
+ ];
499
+ };
500
+ const getMembersQueryOptions = (params, options) => {
501
+ const { query: queryOptions, fetch: fetchOptions } = options ?? {};
502
+ const queryKey = queryOptions?.queryKey ?? getMembersQueryKey(params);
503
+ const queryFn = ({
504
+ signal
505
+ }) => members(params, { signal, ...fetchOptions });
506
+ return { queryKey, queryFn, ...queryOptions };
384
507
  };
508
+ function useMembers(params, options, queryClient) {
509
+ const queryOptions = getMembersQueryOptions(params, options);
510
+ const query = useQuery(queryOptions, queryClient);
511
+ return { ...query, queryKey: queryOptions.queryKey };
512
+ }
385
513
  const getRemoveMemberUrl = (userId) => {
386
514
  return `https://api.workos.com/_widgets/UserManagement/members/${userId}`;
387
515
  };
@@ -408,8 +536,7 @@ const getRemoveMemberMutationOptions = (options) => {
408
536
  return { mutationFn, ...mutationOptions };
409
537
  };
410
538
  const useRemoveMember = (options, queryClient) => {
411
- const mutationOptions = getRemoveMemberMutationOptions(options);
412
- return useMutation(mutationOptions, queryClient);
539
+ return useMutation(getRemoveMemberMutationOptions(options), queryClient);
413
540
  };
414
541
  const getUpdateMemberUrl = (userId) => {
415
542
  return `https://api.workos.com/_widgets/UserManagement/members/${userId}`;
@@ -439,8 +566,7 @@ const getUpdateMemberMutationOptions = (options) => {
439
566
  return { mutationFn, ...mutationOptions };
440
567
  };
441
568
  const useUpdateMember = (options, queryClient) => {
442
- const mutationOptions = getUpdateMemberMutationOptions(options);
443
- return useMutation(mutationOptions, queryClient);
569
+ return useMutation(getUpdateMemberMutationOptions(options), queryClient);
444
570
  };
445
571
  const getOrganizationsUrl = () => {
446
572
  return `https://api.workos.com/_widgets/UserManagement/organizations`;
@@ -474,14 +600,13 @@ const getOrganizationsQueryOptions = (options) => {
474
600
  function useOrganizations(options, queryClient) {
475
601
  const queryOptions = getOrganizationsQueryOptions(options);
476
602
  const query = useQuery(queryOptions, queryClient);
477
- query.queryKey = queryOptions.queryKey;
478
- return query;
603
+ return { ...query, queryKey: queryOptions.queryKey };
479
604
  }
480
- const getMeUrl = () => {
481
- return `https://api.workos.com/_widgets/UserProfile/me`;
605
+ const getRolesUrl = () => {
606
+ return `https://api.workos.com/_widgets/UserManagement/roles`;
482
607
  };
483
- const me = async (options) => {
484
- const res = await fetch(getMeUrl(), {
608
+ const roles = async (options) => {
609
+ const res = await fetch(getRolesUrl(), {
485
610
  ...options,
486
611
  method: "GET"
487
612
  });
@@ -489,114 +614,29 @@ const me = async (options) => {
489
614
  const data = body ? JSON.parse(body) : {};
490
615
  return { data, status: res.status, headers: res.headers };
491
616
  };
492
- const getMeQueryKey = () => {
493
- return [`https://api.workos.com/_widgets/UserProfile/me`];
617
+ const getRolesQueryKey = () => {
618
+ return [`https://api.workos.com/_widgets/UserManagement/roles`];
494
619
  };
495
- const getMeQueryOptions = (options) => {
620
+ const getRolesQueryOptions = (options) => {
496
621
  const { query: queryOptions, fetch: fetchOptions } = options ?? {};
497
- const queryKey = queryOptions?.queryKey ?? getMeQueryKey();
498
- const queryFn = ({ signal }) => me({ signal, ...fetchOptions });
622
+ const queryKey = queryOptions?.queryKey ?? getRolesQueryKey();
623
+ const queryFn = ({
624
+ signal
625
+ }) => roles({ signal, ...fetchOptions });
499
626
  return { queryKey, queryFn, ...queryOptions };
500
627
  };
501
- function useMe(options, queryClient) {
502
- const queryOptions = getMeQueryOptions(options);
628
+ function useRoles(options, queryClient) {
629
+ const queryOptions = getRolesQueryOptions(options);
503
630
  const query = useQuery(queryOptions, queryClient);
504
- query.queryKey = queryOptions.queryKey;
505
- return query;
631
+ return { ...query, queryKey: queryOptions.queryKey };
506
632
  }
507
- const getUpdateMeUrl = () => {
508
- return `https://api.workos.com/_widgets/UserProfile/me`;
509
- };
510
- const updateMe = async (updateMeBody, options) => {
511
- const res = await fetch(getUpdateMeUrl(), {
512
- ...options,
513
- method: "POST",
514
- headers: { "Content-Type": "application/json", ...options?.headers },
515
- body: JSON.stringify(updateMeBody)
516
- });
517
- const body = [204, 205, 304].includes(res.status) ? null : await res.text();
518
- const data = body ? JSON.parse(body) : {};
519
- return { data, status: res.status, headers: res.headers };
520
- };
521
- const getUpdateMeMutationOptions = (options) => {
522
- const mutationKey = ["updateMe"];
523
- 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
- const mutationFn = (props) => {
525
- const { data } = props ?? {};
526
- return updateMe(data, fetchOptions);
527
- };
528
- return { mutationFn, ...mutationOptions };
529
- };
530
- const useUpdateMe = (options, queryClient) => {
531
- const mutationOptions = getUpdateMeMutationOptions(options);
532
- return useMutation(mutationOptions, queryClient);
533
- };
534
- const getCreateTotpFactorUrl = () => {
535
- return `https://api.workos.com/_widgets/UserProfile/create-totp-factor`;
536
- };
537
- const createTotpFactor = async (options) => {
538
- const res = await fetch(getCreateTotpFactorUrl(), {
539
- ...options,
540
- method: "POST"
541
- });
542
- const body = [204, 205, 304].includes(res.status) ? null : await res.text();
543
- const data = body ? JSON.parse(body) : {};
544
- return {
545
- data,
546
- status: res.status,
547
- headers: res.headers
548
- };
549
- };
550
- const getCreateTotpFactorMutationOptions = (options) => {
551
- const mutationKey = ["createTotpFactor"];
552
- 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
- return createTotpFactor(fetchOptions);
555
- };
556
- return { mutationFn, ...mutationOptions };
557
- };
558
- const useCreateTotpFactor = (options, queryClient) => {
559
- const mutationOptions = getCreateTotpFactorMutationOptions(options);
560
- return useMutation(mutationOptions, queryClient);
561
- };
562
- const getVerifyTotpFactorUrl = () => {
563
- return `https://api.workos.com/_widgets/UserProfile/verify-totp-factor`;
564
- };
565
- const verifyTotpFactor = async (verifyTotpFactorRequest, options) => {
566
- const res = await fetch(getVerifyTotpFactorUrl(), {
567
- ...options,
568
- method: "POST",
569
- headers: { "Content-Type": "application/json", ...options?.headers },
570
- body: JSON.stringify(verifyTotpFactorRequest)
571
- });
572
- const body = [204, 205, 304].includes(res.status) ? null : await res.text();
573
- const data = body ? JSON.parse(body) : {};
574
- return {
575
- data,
576
- status: res.status,
577
- headers: res.headers
578
- };
579
- };
580
- const getVerifyTotpFactorMutationOptions = (options) => {
581
- const mutationKey = ["verifyTotpFactor"];
582
- 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 };
583
- const mutationFn = (props) => {
584
- const { data } = props ?? {};
585
- return verifyTotpFactor(data, fetchOptions);
586
- };
587
- return { mutationFn, ...mutationOptions };
588
- };
589
- const useVerifyTotpFactor = (options, queryClient) => {
590
- const mutationOptions = getVerifyTotpFactorMutationOptions(options);
591
- return useMutation(mutationOptions, queryClient);
592
- };
593
- const getDeleteTotpFactorsUrl = () => {
594
- return `https://api.workos.com/_widgets/UserProfile/totp-factors`;
633
+ const getRolesAndConfigUrl = () => {
634
+ return `https://api.workos.com/_widgets/UserManagement/roles-and-config`;
595
635
  };
596
- const deleteTotpFactors = async (options) => {
597
- const res = await fetch(getDeleteTotpFactorsUrl(), {
636
+ const rolesAndConfig = async (options) => {
637
+ const res = await fetch(getRolesAndConfigUrl(), {
598
638
  ...options,
599
- method: "DELETE"
639
+ method: "GET"
600
640
  });
601
641
  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
602
642
  const data = body ? JSON.parse(body) : {};
@@ -606,18 +646,24 @@ const deleteTotpFactors = async (options) => {
606
646
  headers: res.headers
607
647
  };
608
648
  };
609
- const getDeleteTotpFactorsMutationOptions = (options) => {
610
- const mutationKey = ["deleteTotpFactors"];
611
- 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 };
612
- const mutationFn = () => {
613
- return deleteTotpFactors(fetchOptions);
614
- };
615
- return { mutationFn, ...mutationOptions };
649
+ const getRolesAndConfigQueryKey = () => {
650
+ return [
651
+ `https://api.workos.com/_widgets/UserManagement/roles-and-config`
652
+ ];
616
653
  };
617
- const useDeleteTotpFactors = (options, queryClient) => {
618
- const mutationOptions = getDeleteTotpFactorsMutationOptions(options);
619
- return useMutation(mutationOptions, queryClient);
654
+ const getRolesAndConfigQueryOptions = (options) => {
655
+ const { query: queryOptions, fetch: fetchOptions } = options ?? {};
656
+ const queryKey = queryOptions?.queryKey ?? getRolesAndConfigQueryKey();
657
+ const queryFn = ({
658
+ signal
659
+ }) => rolesAndConfig({ signal, ...fetchOptions });
660
+ return { queryKey, queryFn, ...queryOptions };
620
661
  };
662
+ function useRolesAndConfig(options, queryClient) {
663
+ const queryOptions = getRolesAndConfigQueryOptions(options);
664
+ const query = useQuery(queryOptions, queryClient);
665
+ return { ...query, queryKey: queryOptions.queryKey };
666
+ }
621
667
  const getAuthenticationInformationUrl = () => {
622
668
  return `https://api.workos.com/_widgets/UserProfile/authentication-information`;
623
669
  };
@@ -648,8 +694,7 @@ const getAuthenticationInformationQueryOptions = (options) => {
648
694
  function useAuthenticationInformation(options, queryClient) {
649
695
  const queryOptions = getAuthenticationInformationQueryOptions(options);
650
696
  const query = useQuery(queryOptions, queryClient);
651
- query.queryKey = queryOptions.queryKey;
652
- return query;
697
+ return { ...query, queryKey: queryOptions.queryKey };
653
698
  }
654
699
  const getCreatePasswordUrl = () => {
655
700
  return `https://api.workos.com/_widgets/UserProfile/create-password`;
@@ -679,78 +724,15 @@ const getCreatePasswordMutationOptions = (options) => {
679
724
  return { mutationFn, ...mutationOptions };
680
725
  };
681
726
  const useCreatePassword = (options, queryClient) => {
682
- const mutationOptions = getCreatePasswordMutationOptions(options);
683
- return useMutation(mutationOptions, queryClient);
684
- };
685
- const getUpdatePasswordUrl = () => {
686
- return `https://api.workos.com/_widgets/UserProfile/update-password`;
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);
727
+ return useMutation(getCreatePasswordMutationOptions(options), queryClient);
746
728
  };
747
- const getRevokeSessionUrl = (sessionId) => {
748
- return `https://api.workos.com/_widgets/UserProfile/sessions/revoke/${sessionId}`;
729
+ const getCreateTotpFactorUrl = () => {
730
+ return `https://api.workos.com/_widgets/UserProfile/create-totp-factor`;
749
731
  };
750
- const revokeSession = async (sessionId, options) => {
751
- const res = await fetch(getRevokeSessionUrl(sessionId), {
732
+ const createTotpFactor = async (options) => {
733
+ const res = await fetch(getCreateTotpFactorUrl(), {
752
734
  ...options,
753
- method: "DELETE"
735
+ method: "POST"
754
736
  });
755
737
  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
756
738
  const data = body ? JSON.parse(body) : {};
@@ -760,102 +742,68 @@ const revokeSession = async (sessionId, options) => {
760
742
  headers: res.headers
761
743
  };
762
744
  };
763
- const getRevokeSessionMutationOptions = (options) => {
764
- const mutationKey = ["revokeSession"];
745
+ const getCreateTotpFactorMutationOptions = (options) => {
746
+ const mutationKey = ["createTotpFactor"];
765
747
  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 = (props) => {
767
- const { sessionId } = props ?? {};
768
- return revokeSession(sessionId, fetchOptions);
748
+ const mutationFn = () => {
749
+ return createTotpFactor(fetchOptions);
769
750
  };
770
751
  return { mutationFn, ...mutationOptions };
771
752
  };
772
- const useRevokeSession = (options, queryClient) => {
773
- const mutationOptions = getRevokeSessionMutationOptions(options);
774
- return useMutation(mutationOptions, queryClient);
775
- };
776
- const getSessionsUrl = () => {
777
- return `https://api.workos.com/_widgets/UserProfile/sessions`;
778
- };
779
- const sessions = async (options) => {
780
- const res = await fetch(getSessionsUrl(), {
781
- ...options,
782
- method: "GET"
783
- });
784
- const body = [204, 205, 304].includes(res.status) ? null : await res.text();
785
- const data = body ? JSON.parse(body) : {};
786
- return { data, status: res.status, headers: res.headers };
787
- };
788
- const getSessionsQueryKey = () => {
789
- return [`https://api.workos.com/_widgets/UserProfile/sessions`];
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 };
753
+ const useCreateTotpFactor = (options, queryClient) => {
754
+ return useMutation(getCreateTotpFactorMutationOptions(options), queryClient);
798
755
  };
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`;
756
+ const getMeUrl = () => {
757
+ return `https://api.workos.com/_widgets/UserProfile/me`;
807
758
  };
808
- const sendVerification = async (options) => {
809
- const res = await fetch(getSendVerificationUrl(), {
759
+ const me = async (options) => {
760
+ const res = await fetch(getMeUrl(), {
810
761
  ...options,
811
- method: "POST"
762
+ method: "GET"
812
763
  });
813
764
  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
814
765
  const data = body ? JSON.parse(body) : {};
815
- return {
816
- data,
817
- status: res.status,
818
- headers: res.headers
819
- };
766
+ return { data, status: res.status, headers: res.headers };
820
767
  };
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 };
768
+ const getMeQueryKey = () => {
769
+ return [`https://api.workos.com/_widgets/UserProfile/me`];
828
770
  };
829
- const useSendVerification = (options, queryClient) => {
830
- const mutationOptions = getSendVerificationMutationOptions(options);
831
- return useMutation(mutationOptions, queryClient);
771
+ const getMeQueryOptions = (options) => {
772
+ const { query: queryOptions, fetch: fetchOptions } = options ?? {};
773
+ const queryKey = queryOptions?.queryKey ?? getMeQueryKey();
774
+ const queryFn = ({ signal }) => me({ signal, ...fetchOptions });
775
+ return { queryKey, queryFn, ...queryOptions };
832
776
  };
833
- const getVerifyUrl = () => {
834
- return `https://api.workos.com/_widgets/UserProfile/verify`;
777
+ function useMe(options, queryClient) {
778
+ const queryOptions = getMeQueryOptions(options);
779
+ const query = useQuery(queryOptions, queryClient);
780
+ return { ...query, queryKey: queryOptions.queryKey };
781
+ }
782
+ const getUpdateMeUrl = () => {
783
+ return `https://api.workos.com/_widgets/UserProfile/me`;
835
784
  };
836
- const verify = async (verifyRequest, options) => {
837
- const res = await fetch(getVerifyUrl(), {
785
+ const updateMe = async (updateMeBody, options) => {
786
+ const res = await fetch(getUpdateMeUrl(), {
838
787
  ...options,
839
788
  method: "POST",
840
789
  headers: { "Content-Type": "application/json", ...options?.headers },
841
- body: JSON.stringify(verifyRequest)
790
+ body: JSON.stringify(updateMeBody)
842
791
  });
843
792
  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
844
793
  const data = body ? JSON.parse(body) : {};
845
794
  return { data, status: res.status, headers: res.headers };
846
795
  };
847
- const getVerifyMutationOptions = (options) => {
848
- const mutationKey = ["verify"];
796
+ const getUpdateMeMutationOptions = (options) => {
797
+ const mutationKey = ["updateMe"];
849
798
  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
799
  const mutationFn = (props) => {
851
800
  const { data } = props ?? {};
852
- return verify(data, fetchOptions);
801
+ return updateMe(data, fetchOptions);
853
802
  };
854
803
  return { mutationFn, ...mutationOptions };
855
804
  };
856
- const useVerify = (options, queryClient) => {
857
- const mutationOptions = getVerifyMutationOptions(options);
858
- return useMutation(mutationOptions, queryClient);
805
+ const useUpdateMe = (options, queryClient) => {
806
+ return useMutation(getUpdateMeMutationOptions(options), queryClient);
859
807
  };
860
808
  const getRegisterPasskeyUrl = () => {
861
809
  return `https://api.workos.com/_widgets/UserProfile/passkeys`;
@@ -882,8 +830,7 @@ const getRegisterPasskeyMutationOptions = (options) => {
882
830
  return { mutationFn, ...mutationOptions };
883
831
  };
884
832
  const useRegisterPasskey = (options, queryClient) => {
885
- const mutationOptions = getRegisterPasskeyMutationOptions(options);
886
- return useMutation(mutationOptions, queryClient);
833
+ return useMutation(getRegisterPasskeyMutationOptions(options), queryClient);
887
834
  };
888
835
  const getVerifyPasskeyUrl = () => {
889
836
  return `https://api.workos.com/_widgets/UserProfile/passkeys/verify`;
@@ -913,8 +860,7 @@ const getVerifyPasskeyMutationOptions = (options) => {
913
860
  return { mutationFn, ...mutationOptions };
914
861
  };
915
862
  const useVerifyPasskey = (options, queryClient) => {
916
- const mutationOptions = getVerifyPasskeyMutationOptions(options);
917
- return useMutation(mutationOptions, queryClient);
863
+ return useMutation(getVerifyPasskeyMutationOptions(options), queryClient);
918
864
  };
919
865
  const getDeletePasskeyUrl = (passkeyId) => {
920
866
  return `https://api.workos.com/_widgets/UserProfile/passkeys/${passkeyId}`;
@@ -942,14 +888,40 @@ const getDeletePasskeyMutationOptions = (options) => {
942
888
  return { mutationFn, ...mutationOptions };
943
889
  };
944
890
  const useDeletePasskey = (options, queryClient) => {
945
- const mutationOptions = getDeletePasskeyMutationOptions(options);
946
- return useMutation(mutationOptions, queryClient);
891
+ return useMutation(getDeletePasskeyMutationOptions(options), queryClient);
947
892
  };
948
- const getSettingsUrl = () => {
949
- return `https://api.workos.com/_widgets/settings`;
893
+ const getSendVerificationUrl = () => {
894
+ return `https://api.workos.com/_widgets/UserProfile/send-verification`;
950
895
  };
951
- const settings = async (options) => {
952
- const res = await fetch(getSettingsUrl(), {
896
+ const sendVerification = async (options) => {
897
+ const res = await fetch(getSendVerificationUrl(), {
898
+ ...options,
899
+ method: "POST"
900
+ });
901
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
902
+ const data = body ? JSON.parse(body) : {};
903
+ return {
904
+ data,
905
+ status: res.status,
906
+ headers: res.headers
907
+ };
908
+ };
909
+ const getSendVerificationMutationOptions = (options) => {
910
+ const mutationKey = ["sendVerification"];
911
+ 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 };
912
+ const mutationFn = () => {
913
+ return sendVerification(fetchOptions);
914
+ };
915
+ return { mutationFn, ...mutationOptions };
916
+ };
917
+ const useSendVerification = (options, queryClient) => {
918
+ return useMutation(getSendVerificationMutationOptions(options), queryClient);
919
+ };
920
+ const getSessionsUrl = () => {
921
+ return `https://api.workos.com/_widgets/UserProfile/sessions`;
922
+ };
923
+ const sessions = async (options) => {
924
+ const res = await fetch(getSessionsUrl(), {
953
925
  ...options,
954
926
  method: "GET"
955
927
  });
@@ -957,30 +929,31 @@ const settings = async (options) => {
957
929
  const data = body ? JSON.parse(body) : {};
958
930
  return { data, status: res.status, headers: res.headers };
959
931
  };
960
- const getSettingsQueryKey = () => {
961
- return [`https://api.workos.com/_widgets/settings`];
932
+ const getSessionsQueryKey = () => {
933
+ return [`https://api.workos.com/_widgets/UserProfile/sessions`];
962
934
  };
963
- const getSettingsQueryOptions = (options) => {
935
+ const getSessionsQueryOptions = (options) => {
964
936
  const { query: queryOptions, fetch: fetchOptions } = options ?? {};
965
- const queryKey = queryOptions?.queryKey ?? getSettingsQueryKey();
937
+ const queryKey = queryOptions?.queryKey ?? getSessionsQueryKey();
966
938
  const queryFn = ({
967
939
  signal
968
- }) => settings({ signal, ...fetchOptions });
940
+ }) => sessions({ signal, ...fetchOptions });
969
941
  return { queryKey, queryFn, ...queryOptions };
970
942
  };
971
- function useSettings(options, queryClient) {
972
- const queryOptions = getSettingsQueryOptions(options);
943
+ function useSessions(options, queryClient) {
944
+ const queryOptions = getSessionsQueryOptions(options);
973
945
  const query = useQuery(queryOptions, queryClient);
974
- query.queryKey = queryOptions.queryKey;
975
- return query;
946
+ return { ...query, queryKey: queryOptions.queryKey };
976
947
  }
977
- const getListOrganizationDomainsUrl = () => {
978
- return `https://api.workos.com/_widgets/admin-portal/organization-domains`;
948
+ const getRevokeAllSessionsUrl = () => {
949
+ return `https://api.workos.com/_widgets/UserProfile/sessions/revoke-all`;
979
950
  };
980
- const listOrganizationDomains = async (options) => {
981
- const res = await fetch(getListOrganizationDomainsUrl(), {
951
+ const revokeAllSessions = async (revokeAllSessionsRequest, options) => {
952
+ const res = await fetch(getRevokeAllSessionsUrl(), {
982
953
  ...options,
983
- method: "GET"
954
+ method: "DELETE",
955
+ headers: { "Content-Type": "application/json", ...options?.headers },
956
+ body: JSON.stringify(revokeAllSessionsRequest)
984
957
  });
985
958
  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
986
959
  const data = body ? JSON.parse(body) : {};
@@ -990,37 +963,25 @@ const listOrganizationDomains = async (options) => {
990
963
  headers: res.headers
991
964
  };
992
965
  };
993
- const getListOrganizationDomainsQueryKey = () => {
994
- return [
995
- `https://api.workos.com/_widgets/admin-portal/organization-domains`
996
- ];
966
+ const getRevokeAllSessionsMutationOptions = (options) => {
967
+ const mutationKey = ["revokeAllSessions"];
968
+ 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 };
969
+ const mutationFn = (props) => {
970
+ const { data } = props ?? {};
971
+ return revokeAllSessions(data, fetchOptions);
972
+ };
973
+ return { mutationFn, ...mutationOptions };
997
974
  };
998
- const getListOrganizationDomainsQueryOptions = (options) => {
999
- const { query: queryOptions, fetch: fetchOptions } = options ?? {};
1000
- const queryKey = queryOptions?.queryKey ?? getListOrganizationDomainsQueryKey();
1001
- const queryFn = ({ signal }) => listOrganizationDomains({ signal, ...fetchOptions });
1002
- return { queryKey, queryFn, ...queryOptions };
975
+ const useRevokeAllSessions = (options, queryClient) => {
976
+ return useMutation(getRevokeAllSessionsMutationOptions(options), queryClient);
1003
977
  };
1004
- function useListOrganizationDomains(options, queryClient) {
1005
- const queryOptions = getListOrganizationDomainsQueryOptions(options);
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`;
978
+ const getRevokeSessionUrl = (sessionId) => {
979
+ return `https://api.workos.com/_widgets/UserProfile/sessions/revoke/${sessionId}`;
1019
980
  };
1020
- const generateAdminPortalLink = async (params, options) => {
1021
- const res = await fetch(getGenerateAdminPortalLinkUrl(params), {
981
+ const revokeSession = async (sessionId, options) => {
982
+ const res = await fetch(getRevokeSessionUrl(sessionId), {
1022
983
  ...options,
1023
- method: "POST"
984
+ method: "DELETE"
1024
985
  });
1025
986
  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
1026
987
  const data = body ? JSON.parse(body) : {};
@@ -1030,24 +991,23 @@ const generateAdminPortalLink = async (params, options) => {
1030
991
  headers: res.headers
1031
992
  };
1032
993
  };
1033
- const getGenerateAdminPortalLinkMutationOptions = (options) => {
1034
- const mutationKey = ["generateAdminPortalLink"];
994
+ const getRevokeSessionMutationOptions = (options) => {
995
+ const mutationKey = ["revokeSession"];
1035
996
  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
997
  const mutationFn = (props) => {
1037
- const { params } = props ?? {};
1038
- return generateAdminPortalLink(params, fetchOptions);
998
+ const { sessionId } = props ?? {};
999
+ return revokeSession(sessionId, fetchOptions);
1039
1000
  };
1040
1001
  return { mutationFn, ...mutationOptions };
1041
1002
  };
1042
- const useGenerateAdminPortalLink = (options, queryClient) => {
1043
- const mutationOptions = getGenerateAdminPortalLinkMutationOptions(options);
1044
- return useMutation(mutationOptions, queryClient);
1003
+ const useRevokeSession = (options, queryClient) => {
1004
+ return useMutation(getRevokeSessionMutationOptions(options), queryClient);
1045
1005
  };
1046
- const getDeleteOrganizationDomainUrl = (domainId) => {
1047
- return `https://api.workos.com/_widgets/admin-portal/organization-domains/${domainId}`;
1006
+ const getDeleteTotpFactorsUrl = () => {
1007
+ return `https://api.workos.com/_widgets/UserProfile/totp-factors`;
1048
1008
  };
1049
- const deleteOrganizationDomain = async (domainId, options) => {
1050
- const res = await fetch(getDeleteOrganizationDomainUrl(domainId), {
1009
+ const deleteTotpFactors = async (options) => {
1010
+ const res = await fetch(getDeleteTotpFactorsUrl(), {
1051
1011
  ...options,
1052
1012
  method: "DELETE"
1053
1013
  });
@@ -1059,26 +1019,82 @@ const deleteOrganizationDomain = async (domainId, options) => {
1059
1019
  headers: res.headers
1060
1020
  };
1061
1021
  };
1062
- const getDeleteOrganizationDomainMutationOptions = (options) => {
1063
- const mutationKey = ["deleteOrganizationDomain"];
1022
+ const getDeleteTotpFactorsMutationOptions = (options) => {
1023
+ const mutationKey = ["deleteTotpFactors"];
1024
+ 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 };
1025
+ const mutationFn = () => {
1026
+ return deleteTotpFactors(fetchOptions);
1027
+ };
1028
+ return { mutationFn, ...mutationOptions };
1029
+ };
1030
+ const useDeleteTotpFactors = (options, queryClient) => {
1031
+ return useMutation(getDeleteTotpFactorsMutationOptions(options), queryClient);
1032
+ };
1033
+ const getUpdatePasswordUrl = () => {
1034
+ return `https://api.workos.com/_widgets/UserProfile/update-password`;
1035
+ };
1036
+ const updatePassword = async (updatePasswordRequest, options) => {
1037
+ const res = await fetch(getUpdatePasswordUrl(), {
1038
+ ...options,
1039
+ method: "POST",
1040
+ headers: { "Content-Type": "application/json", ...options?.headers },
1041
+ body: JSON.stringify(updatePasswordRequest)
1042
+ });
1043
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
1044
+ const data = body ? JSON.parse(body) : {};
1045
+ return {
1046
+ data,
1047
+ status: res.status,
1048
+ headers: res.headers
1049
+ };
1050
+ };
1051
+ const getUpdatePasswordMutationOptions = (options) => {
1052
+ const mutationKey = ["updatePassword"];
1064
1053
  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
1054
  const mutationFn = (props) => {
1066
- const { domainId } = props ?? {};
1067
- return deleteOrganizationDomain(domainId, fetchOptions);
1055
+ const { data } = props ?? {};
1056
+ return updatePassword(data, fetchOptions);
1068
1057
  };
1069
1058
  return { mutationFn, ...mutationOptions };
1070
1059
  };
1071
- const useDeleteOrganizationDomain = (options, queryClient) => {
1072
- const mutationOptions = getDeleteOrganizationDomainMutationOptions(options);
1073
- return useMutation(mutationOptions, queryClient);
1060
+ const useUpdatePassword = (options, queryClient) => {
1061
+ return useMutation(getUpdatePasswordMutationOptions(options), queryClient);
1074
1062
  };
1075
- const getReverifyOrganizationDomainUrl = (domainId) => {
1076
- return `https://api.workos.com/_widgets/admin-portal/organization-domains/${domainId}/reverify`;
1063
+ const getVerifyUrl = () => {
1064
+ return `https://api.workos.com/_widgets/UserProfile/verify`;
1077
1065
  };
1078
- const reverifyOrganizationDomain = async (domainId, options) => {
1079
- const res = await fetch(getReverifyOrganizationDomainUrl(domainId), {
1066
+ const verify = async (verifyRequest, options) => {
1067
+ const res = await fetch(getVerifyUrl(), {
1080
1068
  ...options,
1081
- method: "POST"
1069
+ method: "POST",
1070
+ headers: { "Content-Type": "application/json", ...options?.headers },
1071
+ body: JSON.stringify(verifyRequest)
1072
+ });
1073
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
1074
+ const data = body ? JSON.parse(body) : {};
1075
+ return { data, status: res.status, headers: res.headers };
1076
+ };
1077
+ const getVerifyMutationOptions = (options) => {
1078
+ const mutationKey = ["verify"];
1079
+ 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 };
1080
+ const mutationFn = (props) => {
1081
+ const { data } = props ?? {};
1082
+ return verify(data, fetchOptions);
1083
+ };
1084
+ return { mutationFn, ...mutationOptions };
1085
+ };
1086
+ const useVerify = (options, queryClient) => {
1087
+ return useMutation(getVerifyMutationOptions(options), queryClient);
1088
+ };
1089
+ const getVerifyTotpFactorUrl = () => {
1090
+ return `https://api.workos.com/_widgets/UserProfile/verify-totp-factor`;
1091
+ };
1092
+ const verifyTotpFactor = async (verifyTotpFactorRequest, options) => {
1093
+ const res = await fetch(getVerifyTotpFactorUrl(), {
1094
+ ...options,
1095
+ method: "POST",
1096
+ headers: { "Content-Type": "application/json", ...options?.headers },
1097
+ body: JSON.stringify(verifyTotpFactorRequest)
1082
1098
  });
1083
1099
  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
1084
1100
  const data = body ? JSON.parse(body) : {};
@@ -1088,24 +1104,23 @@ const reverifyOrganizationDomain = async (domainId, options) => {
1088
1104
  headers: res.headers
1089
1105
  };
1090
1106
  };
1091
- const getReverifyOrganizationDomainMutationOptions = (options) => {
1092
- const mutationKey = ["reverifyOrganizationDomain"];
1107
+ const getVerifyTotpFactorMutationOptions = (options) => {
1108
+ const mutationKey = ["verifyTotpFactor"];
1093
1109
  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
1110
  const mutationFn = (props) => {
1095
- const { domainId } = props ?? {};
1096
- return reverifyOrganizationDomain(domainId, fetchOptions);
1111
+ const { data } = props ?? {};
1112
+ return verifyTotpFactor(data, fetchOptions);
1097
1113
  };
1098
1114
  return { mutationFn, ...mutationOptions };
1099
1115
  };
1100
- const useReverifyOrganizationDomain = (options, queryClient) => {
1101
- const mutationOptions = getReverifyOrganizationDomainMutationOptions(options);
1102
- return useMutation(mutationOptions, queryClient);
1116
+ const useVerifyTotpFactor = (options, queryClient) => {
1117
+ return useMutation(getVerifyTotpFactorMutationOptions(options), queryClient);
1103
1118
  };
1104
- const getListSsoConnectionsUrl = () => {
1105
- return `https://api.workos.com/_widgets/admin-portal/sso-connections`;
1119
+ const getGetAuditLogStreamUrl = () => {
1120
+ return `https://api.workos.com/_widgets/admin-portal/audit-log-stream`;
1106
1121
  };
1107
- const listSsoConnections = async (options) => {
1108
- const res = await fetch(getListSsoConnectionsUrl(), {
1122
+ const getAuditLogStream = async (options) => {
1123
+ const res = await fetch(getGetAuditLogStreamUrl(), {
1109
1124
  ...options,
1110
1125
  method: "GET"
1111
1126
  });
@@ -1117,32 +1132,36 @@ const listSsoConnections = async (options) => {
1117
1132
  headers: res.headers
1118
1133
  };
1119
1134
  };
1120
- const getListSsoConnectionsQueryKey = () => {
1135
+ const getGetAuditLogStreamQueryKey = () => {
1121
1136
  return [
1122
- `https://api.workos.com/_widgets/admin-portal/sso-connections`
1137
+ `https://api.workos.com/_widgets/admin-portal/audit-log-stream`
1123
1138
  ];
1124
1139
  };
1125
- const getListSsoConnectionsQueryOptions = (options) => {
1140
+ const getGetAuditLogStreamQueryOptions = (options) => {
1126
1141
  const { query: queryOptions, fetch: fetchOptions } = options ?? {};
1127
- const queryKey = queryOptions?.queryKey ?? getListSsoConnectionsQueryKey();
1128
- const queryFn = ({ signal }) => listSsoConnections({ signal, ...fetchOptions });
1142
+ const queryKey = queryOptions?.queryKey ?? getGetAuditLogStreamQueryKey();
1143
+ const queryFn = ({ signal }) => getAuditLogStream({ signal, ...fetchOptions });
1129
1144
  return { queryKey, queryFn, ...queryOptions };
1130
1145
  };
1131
- function useListSsoConnections(options, queryClient) {
1132
- const queryOptions = getListSsoConnectionsQueryOptions(options);
1146
+ function useGetAuditLogStream(options, queryClient) {
1147
+ const queryOptions = getGetAuditLogStreamQueryOptions(options);
1133
1148
  const query = useQuery(queryOptions, queryClient);
1134
- query.queryKey = queryOptions.queryKey;
1135
- return query;
1149
+ return { ...query, queryKey: queryOptions.queryKey };
1136
1150
  }
1137
- const getCreateOrganizationApiKeyUrl = () => {
1138
- return `https://api.workos.com/_widgets/ApiKeys/organization-api-keys`;
1151
+ const getGenerateAdminPortalLinkUrl = (params) => {
1152
+ const normalizedParams = new URLSearchParams();
1153
+ Object.entries(params || {}).forEach(([key, value]) => {
1154
+ if (value !== void 0) {
1155
+ normalizedParams.append(key, value === null ? "null" : value.toString());
1156
+ }
1157
+ });
1158
+ const stringifiedParams = normalizedParams.toString();
1159
+ return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/admin-portal/generate-link?${stringifiedParams}` : `https://api.workos.com/_widgets/admin-portal/generate-link`;
1139
1160
  };
1140
- const createOrganizationApiKey = async (createOrganizationApiKeyRequest, options) => {
1141
- const res = await fetch(getCreateOrganizationApiKeyUrl(), {
1161
+ const generateAdminPortalLink = async (params, options) => {
1162
+ const res = await fetch(getGenerateAdminPortalLinkUrl(params), {
1142
1163
  ...options,
1143
- method: "POST",
1144
- headers: { "Content-Type": "application/json", ...options?.headers },
1145
- body: JSON.stringify(createOrganizationApiKeyRequest)
1164
+ method: "POST"
1146
1165
  });
1147
1166
  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
1148
1167
  const data = body ? JSON.parse(body) : {};
@@ -1152,31 +1171,26 @@ const createOrganizationApiKey = async (createOrganizationApiKeyRequest, options
1152
1171
  headers: res.headers
1153
1172
  };
1154
1173
  };
1155
- const getCreateOrganizationApiKeyMutationOptions = (options) => {
1156
- const mutationKey = ["createOrganizationApiKey"];
1174
+ const getGenerateAdminPortalLinkMutationOptions = (options) => {
1175
+ const mutationKey = ["generateAdminPortalLink"];
1157
1176
  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
1177
  const mutationFn = (props) => {
1159
- const { data } = props ?? {};
1160
- return createOrganizationApiKey(data, fetchOptions);
1178
+ const { params } = props ?? {};
1179
+ return generateAdminPortalLink(params, fetchOptions);
1161
1180
  };
1162
1181
  return { mutationFn, ...mutationOptions };
1163
1182
  };
1164
- const useCreateOrganizationApiKey = (options, queryClient) => {
1165
- const mutationOptions = getCreateOrganizationApiKeyMutationOptions(options);
1166
- return useMutation(mutationOptions, queryClient);
1183
+ const useGenerateAdminPortalLink = (options, queryClient) => {
1184
+ return useMutation(
1185
+ getGenerateAdminPortalLinkMutationOptions(options),
1186
+ queryClient
1187
+ );
1167
1188
  };
1168
- const getListOrganizationApiKeysUrl = (params) => {
1169
- const normalizedParams = new URLSearchParams();
1170
- Object.entries(params || {}).forEach(([key, value]) => {
1171
- if (value !== void 0) {
1172
- normalizedParams.append(key, value === null ? "null" : value.toString());
1173
- }
1174
- });
1175
- const stringifiedParams = normalizedParams.toString();
1176
- return stringifiedParams.length > 0 ? `https://api.workos.com/_widgets/ApiKeys/organization-api-keys?${stringifiedParams}` : `https://api.workos.com/_widgets/ApiKeys/organization-api-keys`;
1189
+ const getListOrganizationDomainsUrl = () => {
1190
+ return `https://api.workos.com/_widgets/admin-portal/organization-domains`;
1177
1191
  };
1178
- const listOrganizationApiKeys = async (params, options) => {
1179
- const res = await fetch(getListOrganizationApiKeysUrl(params), {
1192
+ const listOrganizationDomains = async (options) => {
1193
+ const res = await fetch(getListOrganizationDomainsUrl(), {
1180
1194
  ...options,
1181
1195
  method: "GET"
1182
1196
  });
@@ -1188,38 +1202,29 @@ const listOrganizationApiKeys = async (params, options) => {
1188
1202
  headers: res.headers
1189
1203
  };
1190
1204
  };
1191
- const getListOrganizationApiKeysQueryKey = (params) => {
1205
+ const getListOrganizationDomainsQueryKey = () => {
1192
1206
  return [
1193
- `https://api.workos.com/_widgets/ApiKeys/organization-api-keys`,
1194
- ...params ? [params] : []
1207
+ `https://api.workos.com/_widgets/admin-portal/organization-domains`
1195
1208
  ];
1196
1209
  };
1197
- const getListOrganizationApiKeysQueryOptions = (params, options) => {
1210
+ const getListOrganizationDomainsQueryOptions = (options) => {
1198
1211
  const { query: queryOptions, fetch: fetchOptions } = options ?? {};
1199
- const queryKey = queryOptions?.queryKey ?? getListOrganizationApiKeysQueryKey(params);
1200
- const queryFn = ({ signal }) => listOrganizationApiKeys(params, { signal, ...fetchOptions });
1212
+ const queryKey = queryOptions?.queryKey ?? getListOrganizationDomainsQueryKey();
1213
+ const queryFn = ({ signal }) => listOrganizationDomains({ signal, ...fetchOptions });
1201
1214
  return { queryKey, queryFn, ...queryOptions };
1202
1215
  };
1203
- function useListOrganizationApiKeys(params, options, queryClient) {
1204
- const queryOptions = getListOrganizationApiKeysQueryOptions(params, options);
1216
+ function useListOrganizationDomains(options, queryClient) {
1217
+ const queryOptions = getListOrganizationDomainsQueryOptions(options);
1205
1218
  const query = useQuery(queryOptions, queryClient);
1206
- query.queryKey = queryOptions.queryKey;
1207
- return query;
1219
+ return { ...query, queryKey: queryOptions.queryKey };
1208
1220
  }
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`;
1221
+ const getDeleteOrganizationDomainUrl = (domainId) => {
1222
+ return `https://api.workos.com/_widgets/admin-portal/organization-domains/${domainId}`;
1218
1223
  };
1219
- const listOrganizationApiKeyPermissions = async (params, options) => {
1220
- const res = await fetch(getListOrganizationApiKeyPermissionsUrl(params), {
1224
+ const deleteOrganizationDomain = async (domainId, options) => {
1225
+ const res = await fetch(getDeleteOrganizationDomainUrl(domainId), {
1221
1226
  ...options,
1222
- method: "GET"
1227
+ method: "DELETE"
1223
1228
  });
1224
1229
  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
1225
1230
  const data = body ? JSON.parse(body) : {};
@@ -1229,34 +1234,28 @@ const listOrganizationApiKeyPermissions = async (params, options) => {
1229
1234
  headers: res.headers
1230
1235
  };
1231
1236
  };
1232
- const getListOrganizationApiKeyPermissionsQueryKey = (params) => {
1233
- return [
1234
- `https://api.workos.com/_widgets/ApiKeys/permissions`,
1235
- ...params ? [params] : []
1236
- ];
1237
- };
1238
- const getListOrganizationApiKeyPermissionsQueryOptions = (params, options) => {
1239
- const { query: queryOptions, fetch: fetchOptions } = options ?? {};
1240
- const queryKey = queryOptions?.queryKey ?? getListOrganizationApiKeyPermissionsQueryKey(params);
1241
- const queryFn = ({ signal }) => listOrganizationApiKeyPermissions(params, { signal, ...fetchOptions });
1242
- return { queryKey, queryFn, ...queryOptions };
1237
+ const getDeleteOrganizationDomainMutationOptions = (options) => {
1238
+ const mutationKey = ["deleteOrganizationDomain"];
1239
+ 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 };
1240
+ const mutationFn = (props) => {
1241
+ const { domainId } = props ?? {};
1242
+ return deleteOrganizationDomain(domainId, fetchOptions);
1243
+ };
1244
+ return { mutationFn, ...mutationOptions };
1243
1245
  };
1244
- function useListOrganizationApiKeyPermissions(params, options, queryClient) {
1245
- const queryOptions = getListOrganizationApiKeyPermissionsQueryOptions(
1246
- params,
1247
- options
1246
+ const useDeleteOrganizationDomain = (options, queryClient) => {
1247
+ return useMutation(
1248
+ getDeleteOrganizationDomainMutationOptions(options),
1249
+ queryClient
1248
1250
  );
1249
- const query = useQuery(queryOptions, queryClient);
1250
- query.queryKey = queryOptions.queryKey;
1251
- return query;
1252
- }
1253
- const getDeleteOrganizationApiKeyUrl = (apiKeyId) => {
1254
- return `https://api.workos.com/_widgets/ApiKeys/${apiKeyId}`;
1255
1251
  };
1256
- const deleteOrganizationApiKey = async (apiKeyId, options) => {
1257
- const res = await fetch(getDeleteOrganizationApiKeyUrl(apiKeyId), {
1252
+ const getReverifyOrganizationDomainUrl = (domainId) => {
1253
+ return `https://api.workos.com/_widgets/admin-portal/organization-domains/${domainId}/reverify`;
1254
+ };
1255
+ const reverifyOrganizationDomain = async (domainId, options) => {
1256
+ const res = await fetch(getReverifyOrganizationDomainUrl(domainId), {
1258
1257
  ...options,
1259
- method: "DELETE"
1258
+ method: "POST"
1260
1259
  });
1261
1260
  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
1262
1261
  const data = body ? JSON.parse(body) : {};
@@ -1266,24 +1265,26 @@ const deleteOrganizationApiKey = async (apiKeyId, options) => {
1266
1265
  headers: res.headers
1267
1266
  };
1268
1267
  };
1269
- const getDeleteOrganizationApiKeyMutationOptions = (options) => {
1270
- const mutationKey = ["deleteOrganizationApiKey"];
1268
+ const getReverifyOrganizationDomainMutationOptions = (options) => {
1269
+ const mutationKey = ["reverifyOrganizationDomain"];
1271
1270
  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
1271
  const mutationFn = (props) => {
1273
- const { apiKeyId } = props ?? {};
1274
- return deleteOrganizationApiKey(apiKeyId, fetchOptions);
1272
+ const { domainId } = props ?? {};
1273
+ return reverifyOrganizationDomain(domainId, fetchOptions);
1275
1274
  };
1276
1275
  return { mutationFn, ...mutationOptions };
1277
1276
  };
1278
- const useDeleteOrganizationApiKey = (options, queryClient) => {
1279
- const mutationOptions = getDeleteOrganizationApiKeyMutationOptions(options);
1280
- return useMutation(mutationOptions, queryClient);
1277
+ const useReverifyOrganizationDomain = (options, queryClient) => {
1278
+ return useMutation(
1279
+ getReverifyOrganizationDomainMutationOptions(options),
1280
+ queryClient
1281
+ );
1281
1282
  };
1282
- const getMyDataIntegrationsUrl = () => {
1283
- return `https://api.workos.com/_widgets/DataIntegrations/mine`;
1283
+ const getListSsoConnectionsUrl = () => {
1284
+ return `https://api.workos.com/_widgets/admin-portal/sso-connections`;
1284
1285
  };
1285
- const myDataIntegrations = async (options) => {
1286
- const res = await fetch(getMyDataIntegrationsUrl(), {
1286
+ const listSsoConnections = async (options) => {
1287
+ const res = await fetch(getListSsoConnectionsUrl(), {
1287
1288
  ...options,
1288
1289
  method: "GET"
1289
1290
  });
@@ -1295,33 +1296,27 @@ const myDataIntegrations = async (options) => {
1295
1296
  headers: res.headers
1296
1297
  };
1297
1298
  };
1298
- const getMyDataIntegrationsQueryKey = () => {
1299
- return [`https://api.workos.com/_widgets/DataIntegrations/mine`];
1299
+ const getListSsoConnectionsQueryKey = () => {
1300
+ return [
1301
+ `https://api.workos.com/_widgets/admin-portal/sso-connections`
1302
+ ];
1300
1303
  };
1301
- const getMyDataIntegrationsQueryOptions = (options) => {
1304
+ const getListSsoConnectionsQueryOptions = (options) => {
1302
1305
  const { query: queryOptions, fetch: fetchOptions } = options ?? {};
1303
- const queryKey = queryOptions?.queryKey ?? getMyDataIntegrationsQueryKey();
1304
- const queryFn = ({ signal }) => myDataIntegrations({ signal, ...fetchOptions });
1306
+ const queryKey = queryOptions?.queryKey ?? getListSsoConnectionsQueryKey();
1307
+ const queryFn = ({ signal }) => listSsoConnections({ signal, ...fetchOptions });
1305
1308
  return { queryKey, queryFn, ...queryOptions };
1306
1309
  };
1307
- function useMyDataIntegrations(options, queryClient) {
1308
- const queryOptions = getMyDataIntegrationsQueryOptions(options);
1310
+ function useListSsoConnections(options, queryClient) {
1311
+ const queryOptions = getListSsoConnectionsQueryOptions(options);
1309
1312
  const query = useQuery(queryOptions, queryClient);
1310
- query.queryKey = queryOptions.queryKey;
1311
- return query;
1313
+ return { ...query, queryKey: queryOptions.queryKey };
1312
1314
  }
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`;
1315
+ const getListDirectoriesUrl = () => {
1316
+ return `https://api.workos.com/_widgets/directory-sync/directories`;
1322
1317
  };
1323
- const getDataIntegrationAuthorizeUrl = async (slug, params, options) => {
1324
- const res = await fetch(getGetDataIntegrationAuthorizeUrlUrl(slug, params), {
1318
+ const listDirectories = async (options) => {
1319
+ const res = await fetch(getListDirectoriesUrl(), {
1325
1320
  ...options,
1326
1321
  method: "GET"
1327
1322
  });
@@ -1333,44 +1328,32 @@ const getDataIntegrationAuthorizeUrl = async (slug, params, options) => {
1333
1328
  headers: res.headers
1334
1329
  };
1335
1330
  };
1336
- const getGetDataIntegrationAuthorizeUrlQueryKey = (slug, params) => {
1331
+ const getListDirectoriesQueryKey = () => {
1337
1332
  return [
1338
- `https://api.workos.com/_widgets/DataIntegrations/${slug}/authorize`,
1339
- ...params ? [params] : []
1333
+ `https://api.workos.com/_widgets/directory-sync/directories`
1340
1334
  ];
1341
1335
  };
1342
- const getGetDataIntegrationAuthorizeUrlQueryOptions = (slug, params, options) => {
1336
+ const getListDirectoriesQueryOptions = (options) => {
1343
1337
  const { query: queryOptions, fetch: fetchOptions } = options ?? {};
1344
- const queryKey = queryOptions?.queryKey ?? getGetDataIntegrationAuthorizeUrlQueryKey(slug, params);
1345
- const queryFn = ({ signal }) => getDataIntegrationAuthorizeUrl(slug, params, { signal, ...fetchOptions });
1346
- return {
1347
- queryKey,
1348
- queryFn,
1349
- enabled: !!slug,
1350
- ...queryOptions
1351
- };
1338
+ const queryKey = queryOptions?.queryKey ?? getListDirectoriesQueryKey();
1339
+ const queryFn = ({
1340
+ signal
1341
+ }) => listDirectories({ signal, ...fetchOptions });
1342
+ return { queryKey, queryFn, ...queryOptions };
1352
1343
  };
1353
- function useGetDataIntegrationAuthorizeUrl(slug, params, options, queryClient) {
1354
- const queryOptions = getGetDataIntegrationAuthorizeUrlQueryOptions(
1355
- slug,
1356
- params,
1357
- options
1358
- );
1344
+ function useListDirectories(options, queryClient) {
1345
+ const queryOptions = getListDirectoriesQueryOptions(options);
1359
1346
  const query = useQuery(queryOptions, queryClient);
1360
- query.queryKey = queryOptions.queryKey;
1361
- return query;
1347
+ return { ...query, queryKey: queryOptions.queryKey };
1362
1348
  }
1363
- const getGetDataInstallationAuthorizationStatusUrl = (dataIntegrationId, state) => {
1364
- return `https://api.workos.com/_widgets/DataIntegrations/${dataIntegrationId}/authorization-status/${state}`;
1349
+ const getGetDirectoryUrl = (directoryId) => {
1350
+ return `https://api.workos.com/_widgets/directory-sync/directories/${directoryId}`;
1365
1351
  };
1366
- const getDataInstallationAuthorizationStatus = async (dataIntegrationId, state, options) => {
1367
- const res = await fetch(
1368
- getGetDataInstallationAuthorizationStatusUrl(dataIntegrationId, state),
1369
- {
1370
- ...options,
1371
- method: "GET"
1372
- }
1373
- );
1352
+ const getDirectory = async (directoryId, options) => {
1353
+ const res = await fetch(getGetDirectoryUrl(directoryId), {
1354
+ ...options,
1355
+ method: "GET"
1356
+ });
1374
1357
  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
1375
1358
  const data = body ? JSON.parse(body) : {};
1376
1359
  return {
@@ -1379,77 +1362,60 @@ const getDataInstallationAuthorizationStatus = async (dataIntegrationId, state,
1379
1362
  headers: res.headers
1380
1363
  };
1381
1364
  };
1382
- const getGetDataInstallationAuthorizationStatusQueryKey = (dataIntegrationId, state) => {
1365
+ const getGetDirectoryQueryKey = (directoryId) => {
1383
1366
  return [
1384
- `https://api.workos.com/_widgets/DataIntegrations/${dataIntegrationId}/authorization-status/${state}`
1367
+ `https://api.workos.com/_widgets/directory-sync/directories/${directoryId}`
1385
1368
  ];
1386
1369
  };
1387
- const getGetDataInstallationAuthorizationStatusQueryOptions = (dataIntegrationId, state, options) => {
1370
+ const getGetDirectoryQueryOptions = (directoryId, options) => {
1388
1371
  const { query: queryOptions, fetch: fetchOptions } = options ?? {};
1389
- const queryKey = queryOptions?.queryKey ?? getGetDataInstallationAuthorizationStatusQueryKey(dataIntegrationId, state);
1390
- const queryFn = ({ signal }) => getDataInstallationAuthorizationStatus(dataIntegrationId, state, {
1391
- signal,
1392
- ...fetchOptions
1393
- });
1372
+ const queryKey = queryOptions?.queryKey ?? getGetDirectoryQueryKey(directoryId);
1373
+ const queryFn = ({
1374
+ signal
1375
+ }) => getDirectory(directoryId, { signal, ...fetchOptions });
1394
1376
  return {
1395
1377
  queryKey,
1396
1378
  queryFn,
1397
- enabled: !!(dataIntegrationId && state),
1379
+ enabled: !!directoryId,
1398
1380
  ...queryOptions
1399
1381
  };
1400
1382
  };
1401
- function useGetDataInstallationAuthorizationStatus(dataIntegrationId, state, options, queryClient) {
1402
- const queryOptions = getGetDataInstallationAuthorizationStatusQueryOptions(
1403
- dataIntegrationId,
1404
- state,
1405
- options
1406
- );
1383
+ function useGetDirectory(directoryId, options, queryClient) {
1384
+ const queryOptions = getGetDirectoryQueryOptions(directoryId, options);
1407
1385
  const query = useQuery(queryOptions, queryClient);
1408
- query.queryKey = queryOptions.queryKey;
1409
- return query;
1386
+ return { ...query, queryKey: queryOptions.queryKey };
1410
1387
  }
1411
- const getDeleteDataInstallationUrl = (installationId) => {
1412
- return `https://api.workos.com/_widgets/DataIntegrations/installations/${installationId}`;
1388
+ const getSettingsUrl = () => {
1389
+ return `https://api.workos.com/_widgets/settings`;
1413
1390
  };
1414
- const deleteDataInstallation = async (installationId, options) => {
1415
- const res = await fetch(getDeleteDataInstallationUrl(installationId), {
1391
+ const settings = async (options) => {
1392
+ const res = await fetch(getSettingsUrl(), {
1416
1393
  ...options,
1417
- method: "DELETE"
1394
+ method: "GET"
1418
1395
  });
1419
1396
  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
1420
1397
  const data = body ? JSON.parse(body) : {};
1421
- return {
1422
- data,
1423
- status: res.status,
1424
- headers: res.headers
1425
- };
1398
+ return { data, status: res.status, headers: res.headers };
1426
1399
  };
1427
- const getDeleteDataInstallationMutationOptions = (options) => {
1428
- const mutationKey = ["deleteDataInstallation"];
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 };
1400
+ const getSettingsQueryKey = () => {
1401
+ return [`https://api.workos.com/_widgets/settings`];
1435
1402
  };
1436
- const useDeleteDataInstallation = (options, queryClient) => {
1437
- const mutationOptions = getDeleteDataInstallationMutationOptions(options);
1438
- return useMutation(mutationOptions, queryClient);
1403
+ const getSettingsQueryOptions = (options) => {
1404
+ const { query: queryOptions, fetch: fetchOptions } = options ?? {};
1405
+ const queryKey = queryOptions?.queryKey ?? getSettingsQueryKey();
1406
+ const queryFn = ({
1407
+ signal
1408
+ }) => settings({ signal, ...fetchOptions });
1409
+ return { queryKey, queryFn, ...queryOptions };
1439
1410
  };
1411
+ function useSettings(options, queryClient) {
1412
+ const queryOptions = getSettingsQueryOptions(options);
1413
+ const query = useQuery(queryOptions, queryClient);
1414
+ return { ...query, queryKey: queryOptions.queryKey };
1415
+ }
1440
1416
  export {
1441
- AuthenticationInformationResponseDataVerificationMethodsMfaProvider,
1442
- AuthenticationInformationResponseDataVerificationMethodsPasskeyProvider,
1443
- AuthenticationInformationResponseDataVerificationMethodsPasswordProvider,
1444
- CreateTotpFactorResponseAuthenticationChallengeAllOfObject,
1445
- CreateTotpFactorResponseAuthenticationFactorAllOfObject,
1446
- CreateTotpFactorResponseAuthenticationFactorAllOfType,
1447
- DataInstallationObject,
1448
- DataInstallationState,
1449
- DataIntegrationCredentialsType,
1450
- DataIntegrationIntegrationType,
1451
- DataIntegrationObject,
1452
- DataIntegrationOwnership,
1417
+ DirectoryState,
1418
+ DirectoryType,
1453
1419
  DomainVerificationNameServer,
1454
1420
  GenerateAdminPortalLinkIntent,
1455
1421
  MemberActionsItem,
@@ -1457,14 +1423,6 @@ export {
1457
1423
  OidcSessionState,
1458
1424
  OrganizationDomainState,
1459
1425
  SamlSessionState,
1460
- SendVerificationResponseType,
1461
- SettingsResponseObject,
1462
- SsoConnectionAnyOfEightAllOfProviderTag,
1463
- SsoConnectionAnyOfEightAllOfState,
1464
- SsoConnectionAnyOfEightAllOfType,
1465
- SsoConnectionAnyOfProviderTag,
1466
- SsoConnectionAnyOfState,
1467
- SsoConnectionAnyOfType,
1468
1426
  SsoConnectionSessionJSONState,
1469
1427
  authenticationInformation,
1470
1428
  createOrganizationApiKey,
@@ -1476,6 +1434,7 @@ export {
1476
1434
  deletePasskey,
1477
1435
  deleteTotpFactors,
1478
1436
  generateAdminPortalLink,
1437
+ getAuditLogStream,
1479
1438
  getAuthenticationInformationQueryKey,
1480
1439
  getAuthenticationInformationQueryOptions,
1481
1440
  getAuthenticationInformationUrl,
@@ -1497,16 +1456,26 @@ export {
1497
1456
  getDeletePasskeyUrl,
1498
1457
  getDeleteTotpFactorsMutationOptions,
1499
1458
  getDeleteTotpFactorsUrl,
1459
+ getDirectory,
1500
1460
  getGenerateAdminPortalLinkMutationOptions,
1501
1461
  getGenerateAdminPortalLinkUrl,
1462
+ getGetAuditLogStreamQueryKey,
1463
+ getGetAuditLogStreamQueryOptions,
1464
+ getGetAuditLogStreamUrl,
1502
1465
  getGetDataInstallationAuthorizationStatusQueryKey,
1503
1466
  getGetDataInstallationAuthorizationStatusQueryOptions,
1504
1467
  getGetDataInstallationAuthorizationStatusUrl,
1505
1468
  getGetDataIntegrationAuthorizeUrlQueryKey,
1506
1469
  getGetDataIntegrationAuthorizeUrlQueryOptions,
1507
1470
  getGetDataIntegrationAuthorizeUrlUrl,
1471
+ getGetDirectoryQueryKey,
1472
+ getGetDirectoryQueryOptions,
1473
+ getGetDirectoryUrl,
1508
1474
  getInviteMemberMutationOptions,
1509
1475
  getInviteMemberUrl,
1476
+ getListDirectoriesQueryKey,
1477
+ getListDirectoriesQueryOptions,
1478
+ getListDirectoriesUrl,
1510
1479
  getListOrganizationApiKeyPermissionsQueryKey,
1511
1480
  getListOrganizationApiKeyPermissionsQueryOptions,
1512
1481
  getListOrganizationApiKeyPermissionsUrl,
@@ -1572,6 +1541,7 @@ export {
1572
1541
  getVerifyTotpFactorUrl,
1573
1542
  getVerifyUrl,
1574
1543
  inviteMember,
1544
+ listDirectories,
1575
1545
  listOrganizationApiKeyPermissions,
1576
1546
  listOrganizationApiKeys,
1577
1547
  listOrganizationDomains,
@@ -1605,9 +1575,12 @@ export {
1605
1575
  useDeletePasskey,
1606
1576
  useDeleteTotpFactors,
1607
1577
  useGenerateAdminPortalLink,
1578
+ useGetAuditLogStream,
1608
1579
  useGetDataInstallationAuthorizationStatus,
1609
1580
  useGetDataIntegrationAuthorizeUrl,
1581
+ useGetDirectory,
1610
1582
  useInviteMember,
1583
+ useListDirectories,
1611
1584
  useListOrganizationApiKeyPermissions,
1612
1585
  useListOrganizationApiKeys,
1613
1586
  useListOrganizationDomains,