@frontegg/rest-api 3.1.78 → 3.1.79-alpha.9987430273

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 (122) hide show
  1. package/BaseApiClient.d.ts +16 -0
  2. package/BaseApiClient.js +39 -0
  3. package/ContextHolder/index.d.ts +113 -28
  4. package/ContextHolder/index.js +163 -54
  5. package/FetchClient.d.ts +42 -0
  6. package/FetchClient.js +308 -0
  7. package/account-settings/index.d.ts +19 -7
  8. package/account-settings/index.js +23 -13
  9. package/applications/index.d.ts +49 -44
  10. package/applications/index.js +51 -37
  11. package/audits/index.d.ts +27 -15
  12. package/audits/index.js +27 -17
  13. package/auth/index.d.ts +817 -768
  14. package/auth/index.js +902 -721
  15. package/auth/secutiry-poilicy/index.d.ts +58 -102
  16. package/auth/secutiry-poilicy/index.js +122 -90
  17. package/auth/utils.d.ts +2 -2
  18. package/auth/utils.js +9 -8
  19. package/connectivity/index.d.ts +126 -27
  20. package/connectivity/index.js +147 -114
  21. package/directory/index.d.ts +31 -22
  22. package/directory/index.js +27 -15
  23. package/entitlements/index.d.ts +14 -8
  24. package/entitlements/index.js +12 -4
  25. package/feature-flags/index.d.ts +8 -2
  26. package/feature-flags/index.js +16 -8
  27. package/groups/index.d.ts +73 -49
  28. package/groups/index.js +64 -45
  29. package/impersonate/index.d.ts +15 -6
  30. package/impersonate/index.js +13 -5
  31. package/index.d.ts +154 -108
  32. package/index.js +109 -78
  33. package/interfaces.d.ts +10 -0
  34. package/metadata/index.d.ts +67 -7
  35. package/metadata/index.js +52 -32
  36. package/node/BaseApiClient.js +49 -0
  37. package/node/ContextHolder/index.js +163 -54
  38. package/node/FetchClient.js +326 -0
  39. package/node/account-settings/index.js +27 -16
  40. package/node/applications/index.js +51 -44
  41. package/node/audits/index.js +31 -20
  42. package/node/auth/index.js +768 -1035
  43. package/node/auth/secutiry-poilicy/index.js +125 -136
  44. package/node/auth/utils.js +9 -7
  45. package/node/connectivity/index.js +148 -187
  46. package/node/directory/index.js +29 -20
  47. package/node/entitlements/index.js +18 -5
  48. package/node/feature-flags/index.js +21 -9
  49. package/node/groups/index.js +65 -63
  50. package/node/impersonate/index.js +18 -5
  51. package/node/index.js +116 -71
  52. package/node/metadata/index.js +61 -52
  53. package/node/notifications/index.js +37 -27
  54. package/node/reports/index.js +78 -70
  55. package/node/roles/index.js +56 -51
  56. package/node/security-center/index.js +21 -9
  57. package/node/sub-tenants/index.js +90 -89
  58. package/node/subscriptions/index.js +69 -107
  59. package/node/subscriptions/invoices.js +25 -17
  60. package/node/subscriptions/managedSubscriptions.js +32 -27
  61. package/node/subscriptions/paymentMethods.js +27 -20
  62. package/node/subscriptions/paymentProviders.js +15 -6
  63. package/node/subscriptions/plans.js +17 -9
  64. package/node/subscriptions/providers/stripe/index.js +26 -21
  65. package/node/subscriptions/subscriptions.js +32 -27
  66. package/node/subscriptions/summaries.js +15 -6
  67. package/node/subscriptions/tenantConfiguration.js +17 -9
  68. package/node/subscriptions/vendorPublicConfigurations.js +15 -6
  69. package/node/teams/index.js +138 -148
  70. package/node/tenants/index.js +65 -60
  71. package/node/user-phone-numbers/index.js +32 -24
  72. package/node/users/index.js +58 -53
  73. package/node/vendor/index.js +17 -6
  74. package/notifications/index.d.ts +22 -16
  75. package/notifications/index.js +33 -22
  76. package/package.json +1 -1
  77. package/reports/index.d.ts +50 -44
  78. package/reports/index.js +75 -62
  79. package/roles/index.d.ts +44 -38
  80. package/roles/index.js +57 -41
  81. package/security-center/index.d.ts +14 -2
  82. package/security-center/index.js +15 -6
  83. package/sub-tenants/index.d.ts +57 -15
  84. package/sub-tenants/index.js +88 -68
  85. package/subscriptions/index.d.ts +56 -11
  86. package/subscriptions/index.js +58 -11
  87. package/subscriptions/invoices.d.ts +16 -13
  88. package/subscriptions/invoices.js +24 -14
  89. package/subscriptions/managedSubscriptions.d.ts +18 -15
  90. package/subscriptions/managedSubscriptions.js +33 -22
  91. package/subscriptions/paymentMethods.d.ts +16 -13
  92. package/subscriptions/paymentMethods.js +26 -17
  93. package/subscriptions/paymentProviders.d.ts +8 -5
  94. package/subscriptions/paymentProviders.js +11 -4
  95. package/subscriptions/plans.d.ts +11 -8
  96. package/subscriptions/plans.js +14 -6
  97. package/subscriptions/providers/stripe/index.d.ts +24 -21
  98. package/subscriptions/providers/stripe/index.js +27 -16
  99. package/subscriptions/subscriptions.d.ts +24 -21
  100. package/subscriptions/subscriptions.js +33 -22
  101. package/subscriptions/summaries.d.ts +7 -4
  102. package/subscriptions/summaries.js +10 -3
  103. package/subscriptions/tenantConfiguration.d.ts +6 -3
  104. package/subscriptions/tenantConfiguration.js +15 -7
  105. package/subscriptions/vendorPublicConfigurations.d.ts +5 -2
  106. package/subscriptions/vendorPublicConfigurations.js +11 -4
  107. package/teams/index.d.ts +37 -139
  108. package/teams/index.js +130 -99
  109. package/tenants/index.d.ts +25 -37
  110. package/tenants/index.js +62 -46
  111. package/user-phone-numbers/index.d.ts +32 -26
  112. package/user-phone-numbers/index.js +32 -19
  113. package/users/index.d.ts +21 -15
  114. package/users/index.js +60 -44
  115. package/vendor/index.d.ts +12 -6
  116. package/vendor/index.js +11 -4
  117. package/fetch.d.ts +0 -24
  118. package/fetch.js +0 -265
  119. package/node/fetch.js +0 -306
  120. package/node/subscriptions/providers/index.js +0 -18
  121. package/subscriptions/providers/index.d.ts +0 -1
  122. package/subscriptions/providers/index.js +0 -1
@@ -6,349 +6,50 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  var _exportNames = {
9
- generateLoginResponse: true,
10
- generateLoginResponseV2: true,
11
- generateLoginResponseV3: true,
12
- generateLoginResponseFromOAuthResponse: true,
13
- generateLoginResponseFromOAuthResponseV2: true,
14
- preLogin: true,
15
- preLoginWithIdpType: true,
16
- postLogin: true,
17
- oidcPostLogin: true,
18
- login: true,
19
- loginv2: true,
20
- loginWithMfa: true,
21
- loginWithMfaV2: true,
22
- activateAccount: true,
23
- activateAccountV2: true,
24
- getActivateAccountStrategy: true,
25
- resendActivationEmail: true,
26
- resendInvitationEmail: true,
27
- acceptInvitation: true,
28
- refreshToken: true,
29
- refreshTokenV2: true,
30
- refreshTokenV3: true,
31
- logout: true,
32
- OAuthLogout: true,
33
- forgotPassword: true,
34
- resetPassword: true,
35
- loadPasswordConfig: true,
36
- recoverMfaToken: true,
37
- enrollMfa: true,
38
- preEnrollMFAAuthenticatorApp: true,
39
- enrollMFAAuthenticatorApp: true,
40
- preEnrollMFASMS: true,
41
- enrollMFASMS: true,
42
- preEnrollMFAWebAuthn: true,
43
- enrollMFAWebAuthn: true,
44
- verifyMfa: true,
45
- disableMfa: true,
46
- disableMFAAuthenticatorApp: true,
47
- preDisableMFASMS: true,
48
- disableMFASMS: true,
49
- preDisableMFAWebAuthn: true,
50
- disableMFAWebAuthn: true,
51
- getMFADevices: true,
52
- preEnrollMFAAuthenticatorAppForLogin: true,
53
- enrollMFAAuthenticatorAppForLogin: true,
54
- enrollMFAAuthenticatorAppForLoginV2: true,
55
- verifyMFAAuthenticatorAppForLogin: true,
56
- preVerifyMFAEmailCode: true,
57
- verifyMFAEmailCode: true,
58
- verifyMFAEmailCodeV2: true,
59
- preEnrollMFASMSForLogin: true,
60
- enrollMFASMSForLogin: true,
61
- enrollMFASMSForLoginV2: true,
62
- preVerifyMFASMSForLogin: true,
63
- verifyMFASMSForLogin: true,
64
- verifyMFASMSForLoginV2: true,
65
- preEnrollMFAWebAuthnForLogin: true,
66
- enrollMFAWebAuthnForLogin: true,
67
- enrollMFAWebAuthnForLoginV2: true,
68
- preVerifyMFAWebAuthnForLogin: true,
69
- verifyMFAWebAuthnForLogin: true,
70
- verifyMFAWebAuthnForLoginV2: true,
71
- getSamlConfiguration: true,
72
- updateSamlConfiguration: true,
73
- getSamlVendorConfiguration: true,
74
- updateSamlVendorMetadata: true,
75
- validateSamlDomain: true,
76
- getSamlRoles: true,
77
- getSamlRolesGroups: true,
78
- updateSamlRoles: true,
79
- createSamlGroup: true,
80
- updateSamlGroup: true,
81
- deleteSamlGroup: true,
82
- getOidcConfiguration: true,
83
- getSSOPublicConfiguration: true,
84
- getSocialLoginProviders: true,
85
- getSocialLoginProvidersV2: true,
86
- getSocialLoginProvidersV2ForAuthenticatedUser: true,
87
- getCustomSocialLoginProvidersV1: true,
88
- loginViaSocialLogin: true,
89
- getVendorConfig: true,
90
- signUpUser: true,
91
- getCurrentUserSessions: true,
92
- getCurrentUserSession: true,
93
- revokeSessionsForUser: true,
94
- getSessionConfigurations: true,
95
- createOrUpdateSessionConfigrations: true,
96
- deleteSessionForUser: true,
97
- deleteAllSessionsForUser: true,
98
- getUserAccessTokensData: true,
99
- getTenantAccessTokensData: true,
100
- deleteTenantAccessToken: true,
101
- deleteUserAccessToken: true,
102
- createUserAccessToken: true,
103
- createTenantAccessToken: true,
104
- getUserApiTokensData: true,
105
- getTenantApiTokensData: true,
106
- updateUserApiTokensData: true,
107
- updateTenantApiTokensData: true,
108
- deleteTenantApiToken: true,
109
- deleteUserApiToken: true,
110
- getUserById: true,
111
- checkIfAllowToRememberMfaDevice: true,
112
- passwordlessPreLogin: true,
113
- passwordlessPostLoginV2: true,
114
- passwordlessPostLogin: true,
115
- verifyInviteToken: true,
116
- getSSOConfigurations: true,
117
- createSSOConfiguration: true,
118
- updateSSOConfiguration: true,
119
- deleteSSOConfiguration: true,
120
- createSSOConfigurationByMetadata: true,
121
- updateSSOConfigurationByMetadata: true,
122
- createSSOConfigurationByMetadataUrl: true,
123
- updateSSOConfigurationByMetadataUrl: true,
124
- createSSODomain: true,
125
- deleteSSODomain: true,
126
- validateSSODomain: true,
127
- validateSSODomainV2: true,
128
- getSSODefaultRoles: true,
129
- setSSODefaultRoles: true,
130
- createSSOGroup: true,
131
- updateSSOGroup: true,
132
- deleteSSOGroup: true,
133
- getSSOGroups: true,
134
- preLoginV2: true,
135
- oidcPostLoginV2: true,
136
- exchangeOAuthTokensV2: true,
137
- silentOAuthRefreshTokenV2: true,
138
- exchangeOAuthTokens: true,
139
- silentOAuthRefreshToken: true,
140
- resetPhoneNumber: true,
141
- verifyResetPhoneNumber: true,
142
- changePhoneNumberWithVerification: true,
143
- verifyChangePhoneNumber: true,
144
- changePhoneNumber: true,
145
- webAuthnPreLogin: true,
146
- webAuthnPostLogin: true,
147
- webAuthnPostLoginV2: true,
148
- webAuthnCreateNewDeviceSession: true,
149
- getWebAuthnDevices: true,
150
- deleteWebAuthnDevice: true,
151
- verifyNewDeviceSession: true,
152
- getVendorPublicAuthStrategiesConfig: true,
153
- getPublicAuthStrategiesConfigForAuthenticatedUser: true,
154
- getMFAStrategiesConfig: true,
155
- getUserAuthorization: true,
156
- getMeV2: true,
157
- getMeAndEntitlements: true,
158
- generateStepupSession: true,
9
+ AuthenticationApi: true,
159
10
  FRONTEGG_SEPARATE_TABS_BY_TENANT: true,
160
11
  setTabTenantInSessionStorage: true,
161
12
  getTabTenantFromSessionStorage: true,
162
13
  getCurrentUserTenantsFunction: true,
163
14
  removeTabTenantFromSessionStorage: true
164
15
  };
16
+ exports.AuthenticationApi = void 0;
165
17
  Object.defineProperty(exports, "FRONTEGG_SEPARATE_TABS_BY_TENANT", {
166
18
  enumerable: true,
167
19
  get: function () {
168
20
  return _constants.FRONTEGG_SEPARATE_TABS_BY_TENANT;
169
21
  }
170
22
  });
171
- exports.OAuthLogout = OAuthLogout;
172
- exports.acceptInvitation = acceptInvitation;
173
- exports.activateAccount = activateAccount;
174
- exports.activateAccountV2 = activateAccountV2;
175
- exports.changePhoneNumber = changePhoneNumber;
176
- exports.changePhoneNumberWithVerification = changePhoneNumberWithVerification;
177
- exports.checkIfAllowToRememberMfaDevice = checkIfAllowToRememberMfaDevice;
178
- exports.createOrUpdateSessionConfigrations = createOrUpdateSessionConfigrations;
179
- exports.createSSOConfiguration = createSSOConfiguration;
180
- exports.createSSOConfigurationByMetadata = createSSOConfigurationByMetadata;
181
- exports.createSSOConfigurationByMetadataUrl = createSSOConfigurationByMetadataUrl;
182
- exports.createSSODomain = createSSODomain;
183
- exports.createSSOGroup = createSSOGroup;
184
- exports.createSamlGroup = createSamlGroup;
185
- exports.createTenantAccessToken = createTenantAccessToken;
186
- exports.createUserAccessToken = createUserAccessToken;
187
- exports.deleteAllSessionsForUser = deleteAllSessionsForUser;
188
- exports.deleteSSOConfiguration = deleteSSOConfiguration;
189
- exports.deleteSSODomain = deleteSSODomain;
190
- exports.deleteSSOGroup = deleteSSOGroup;
191
- exports.deleteSamlGroup = deleteSamlGroup;
192
- exports.deleteSessionForUser = deleteSessionForUser;
193
- exports.deleteTenantAccessToken = deleteTenantAccessToken;
194
- exports.deleteTenantApiToken = deleteTenantApiToken;
195
- exports.deleteUserAccessToken = deleteUserAccessToken;
196
- exports.deleteUserApiToken = deleteUserApiToken;
197
- exports.deleteWebAuthnDevice = deleteWebAuthnDevice;
198
- exports.disableMFAAuthenticatorApp = disableMFAAuthenticatorApp;
199
- exports.disableMFASMS = disableMFASMS;
200
- exports.disableMFAWebAuthn = disableMFAWebAuthn;
201
- exports.disableMfa = disableMfa;
202
- exports.enrollMFAAuthenticatorApp = enrollMFAAuthenticatorApp;
203
- exports.enrollMFAAuthenticatorAppForLogin = enrollMFAAuthenticatorAppForLogin;
204
- exports.enrollMFAAuthenticatorAppForLoginV2 = enrollMFAAuthenticatorAppForLoginV2;
205
- exports.enrollMFASMS = enrollMFASMS;
206
- exports.enrollMFASMSForLogin = enrollMFASMSForLogin;
207
- exports.enrollMFASMSForLoginV2 = enrollMFASMSForLoginV2;
208
- exports.enrollMFAWebAuthn = enrollMFAWebAuthn;
209
- exports.enrollMFAWebAuthnForLogin = enrollMFAWebAuthnForLogin;
210
- exports.enrollMFAWebAuthnForLoginV2 = enrollMFAWebAuthnForLoginV2;
211
- exports.enrollMfa = enrollMfa;
212
- exports.exchangeOAuthTokens = exchangeOAuthTokens;
213
- exports.exchangeOAuthTokensV2 = exchangeOAuthTokensV2;
214
- exports.forgotPassword = forgotPassword;
215
- exports.generateLoginResponse = generateLoginResponse;
216
- exports.generateLoginResponseFromOAuthResponse = generateLoginResponseFromOAuthResponse;
217
- exports.generateLoginResponseFromOAuthResponseV2 = generateLoginResponseFromOAuthResponseV2;
218
- exports.generateLoginResponseV2 = generateLoginResponseV2;
219
- exports.generateLoginResponseV3 = generateLoginResponseV3;
220
- exports.generateStepupSession = generateStepupSession;
221
- exports.getActivateAccountStrategy = getActivateAccountStrategy;
222
- exports.getCurrentUserSession = getCurrentUserSession;
223
- exports.getCurrentUserSessions = getCurrentUserSessions;
23
+ exports.default = void 0;
224
24
  Object.defineProperty(exports, "getCurrentUserTenantsFunction", {
225
25
  enumerable: true,
226
26
  get: function () {
227
27
  return _utils.getCurrentUserTenantsFunction;
228
28
  }
229
29
  });
230
- exports.getCustomSocialLoginProvidersV1 = getCustomSocialLoginProvidersV1;
231
- exports.getMFADevices = getMFADevices;
232
- exports.getMFAStrategiesConfig = getMFAStrategiesConfig;
233
- exports.getMeAndEntitlements = getMeAndEntitlements;
234
- exports.getMeV2 = getMeV2;
235
- exports.getOidcConfiguration = getOidcConfiguration;
236
- exports.getPublicAuthStrategiesConfigForAuthenticatedUser = getPublicAuthStrategiesConfigForAuthenticatedUser;
237
- exports.getSSOConfigurations = getSSOConfigurations;
238
- exports.getSSODefaultRoles = getSSODefaultRoles;
239
- exports.getSSOGroups = getSSOGroups;
240
- exports.getSSOPublicConfiguration = getSSOPublicConfiguration;
241
- exports.getSamlConfiguration = getSamlConfiguration;
242
- exports.getSamlRoles = getSamlRoles;
243
- exports.getSamlRolesGroups = getSamlRolesGroups;
244
- exports.getSamlVendorConfiguration = getSamlVendorConfiguration;
245
- exports.getSessionConfigurations = getSessionConfigurations;
246
- exports.getSocialLoginProviders = getSocialLoginProviders;
247
- exports.getSocialLoginProvidersV2 = getSocialLoginProvidersV2;
248
- exports.getSocialLoginProvidersV2ForAuthenticatedUser = getSocialLoginProvidersV2ForAuthenticatedUser;
249
30
  Object.defineProperty(exports, "getTabTenantFromSessionStorage", {
250
31
  enumerable: true,
251
32
  get: function () {
252
33
  return _utils.getTabTenantFromSessionStorage;
253
34
  }
254
35
  });
255
- exports.getTenantAccessTokensData = getTenantAccessTokensData;
256
- exports.getTenantApiTokensData = getTenantApiTokensData;
257
- exports.getUserAccessTokensData = getUserAccessTokensData;
258
- exports.getUserApiTokensData = getUserApiTokensData;
259
- exports.getUserAuthorization = getUserAuthorization;
260
- exports.getUserById = getUserById;
261
- exports.getVendorConfig = getVendorConfig;
262
- exports.getVendorPublicAuthStrategiesConfig = getVendorPublicAuthStrategiesConfig;
263
- exports.getWebAuthnDevices = getWebAuthnDevices;
264
- exports.loadPasswordConfig = loadPasswordConfig;
265
- exports.login = login;
266
- exports.loginViaSocialLogin = loginViaSocialLogin;
267
- exports.loginWithMfa = loginWithMfa;
268
- exports.loginWithMfaV2 = loginWithMfaV2;
269
- exports.loginv2 = loginv2;
270
- exports.logout = logout;
271
- exports.oidcPostLogin = oidcPostLogin;
272
- exports.oidcPostLoginV2 = oidcPostLoginV2;
273
- exports.passwordlessPostLogin = passwordlessPostLogin;
274
- exports.passwordlessPostLoginV2 = passwordlessPostLoginV2;
275
- exports.passwordlessPreLogin = passwordlessPreLogin;
276
- exports.postLogin = postLogin;
277
- exports.preDisableMFASMS = preDisableMFASMS;
278
- exports.preDisableMFAWebAuthn = preDisableMFAWebAuthn;
279
- exports.preEnrollMFAAuthenticatorApp = preEnrollMFAAuthenticatorApp;
280
- exports.preEnrollMFAAuthenticatorAppForLogin = preEnrollMFAAuthenticatorAppForLogin;
281
- exports.preEnrollMFASMS = preEnrollMFASMS;
282
- exports.preEnrollMFASMSForLogin = preEnrollMFASMSForLogin;
283
- exports.preEnrollMFAWebAuthn = preEnrollMFAWebAuthn;
284
- exports.preEnrollMFAWebAuthnForLogin = preEnrollMFAWebAuthnForLogin;
285
- exports.preLogin = preLogin;
286
- exports.preLoginV2 = preLoginV2;
287
- exports.preLoginWithIdpType = preLoginWithIdpType;
288
- exports.preVerifyMFAEmailCode = preVerifyMFAEmailCode;
289
- exports.preVerifyMFASMSForLogin = preVerifyMFASMSForLogin;
290
- exports.preVerifyMFAWebAuthnForLogin = preVerifyMFAWebAuthnForLogin;
291
- exports.recoverMfaToken = recoverMfaToken;
292
- exports.refreshToken = refreshToken;
293
- exports.refreshTokenV2 = refreshTokenV2;
294
- exports.refreshTokenV3 = refreshTokenV3;
295
36
  Object.defineProperty(exports, "removeTabTenantFromSessionStorage", {
296
37
  enumerable: true,
297
38
  get: function () {
298
39
  return _utils.removeTabTenantFromSessionStorage;
299
40
  }
300
41
  });
301
- exports.resendActivationEmail = resendActivationEmail;
302
- exports.resendInvitationEmail = resendInvitationEmail;
303
- exports.resetPassword = resetPassword;
304
- exports.resetPhoneNumber = resetPhoneNumber;
305
- exports.revokeSessionsForUser = revokeSessionsForUser;
306
- exports.setSSODefaultRoles = setSSODefaultRoles;
307
42
  Object.defineProperty(exports, "setTabTenantInSessionStorage", {
308
43
  enumerable: true,
309
44
  get: function () {
310
45
  return _utils.setTabTenantInSessionStorage;
311
46
  }
312
47
  });
313
- exports.signUpUser = signUpUser;
314
- exports.silentOAuthRefreshToken = silentOAuthRefreshToken;
315
- exports.silentOAuthRefreshTokenV2 = silentOAuthRefreshTokenV2;
316
- exports.updateSSOConfiguration = updateSSOConfiguration;
317
- exports.updateSSOConfigurationByMetadata = updateSSOConfigurationByMetadata;
318
- exports.updateSSOConfigurationByMetadataUrl = updateSSOConfigurationByMetadataUrl;
319
- exports.updateSSOGroup = updateSSOGroup;
320
- exports.updateSamlConfiguration = updateSamlConfiguration;
321
- exports.updateSamlGroup = updateSamlGroup;
322
- exports.updateSamlRoles = updateSamlRoles;
323
- exports.updateSamlVendorMetadata = updateSamlVendorMetadata;
324
- exports.updateTenantApiTokensData = updateTenantApiTokensData;
325
- exports.updateUserApiTokensData = updateUserApiTokensData;
326
- exports.validateSSODomain = validateSSODomain;
327
- exports.validateSSODomainV2 = validateSSODomainV2;
328
- exports.validateSamlDomain = validateSamlDomain;
329
- exports.verifyChangePhoneNumber = verifyChangePhoneNumber;
330
- exports.verifyInviteToken = verifyInviteToken;
331
- exports.verifyMFAAuthenticatorAppForLogin = verifyMFAAuthenticatorAppForLogin;
332
- exports.verifyMFAEmailCode = verifyMFAEmailCode;
333
- exports.verifyMFAEmailCodeV2 = verifyMFAEmailCodeV2;
334
- exports.verifyMFASMSForLogin = verifyMFASMSForLogin;
335
- exports.verifyMFASMSForLoginV2 = verifyMFASMSForLoginV2;
336
- exports.verifyMFAWebAuthnForLogin = verifyMFAWebAuthnForLogin;
337
- exports.verifyMFAWebAuthnForLoginV2 = verifyMFAWebAuthnForLoginV2;
338
- exports.verifyMfa = verifyMfa;
339
- exports.verifyNewDeviceSession = verifyNewDeviceSession;
340
- exports.verifyResetPhoneNumber = verifyResetPhoneNumber;
341
- exports.webAuthnCreateNewDeviceSession = webAuthnCreateNewDeviceSession;
342
- exports.webAuthnPostLogin = webAuthnPostLogin;
343
- exports.webAuthnPostLoginV2 = webAuthnPostLoginV2;
344
- exports.webAuthnPreLogin = webAuthnPreLogin;
345
48
 
346
49
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
347
50
 
348
51
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
349
52
 
350
- var _tenants = require("../tenants");
351
-
352
53
  var _secutiryPoilicy = require("./secutiry-poilicy");
353
54
 
354
55
  Object.keys(_secutiryPoilicy).forEach(function (key) {
@@ -383,921 +84,953 @@ var _utils = require("./utils");
383
84
 
384
85
  var _constants2 = require("../constants");
385
86
 
386
- var _ContextHolder = require("../ContextHolder");
387
-
388
- var _fetch = require("../fetch");
389
-
390
87
  var _jwt = require("../jwt");
391
88
 
392
89
  var _interfaces = require("./interfaces");
393
90
 
394
- var _entitlements = require("../entitlements");
395
-
396
91
  var _interfaces2 = require("../entitlements/interfaces");
397
92
 
398
93
  var _featureFlags = require("../feature-flags");
399
94
 
400
- const _excluded = ["type"],
401
- _excluded2 = ["type"],
402
- _excluded3 = ["type"];
403
-
404
- async function generateLoginResponse(loginResponse) {
405
- if (!loginResponse.accessToken) {
406
- return loginResponse;
407
- }
95
+ var _tenants = require("../tenants");
408
96
 
409
- _ContextHolder.ContextHolder.setAccessToken(loginResponse.accessToken);
97
+ var _BaseApiClient = require("../BaseApiClient");
410
98
 
411
- const me = await getMeAndEntitlements();
412
- const decodedContent = loginResponse.accessToken ? (0, _jwt.jwtDecode)(loginResponse.accessToken) : {};
413
- const user = (0, _extends2.default)({}, loginResponse, decodedContent, me);
99
+ var _entitlements = require("../entitlements");
414
100
 
415
- _ContextHolder.ContextHolder.setUser(user);
101
+ var _ContextHolder = require("../ContextHolder");
416
102
 
417
- return user;
418
- }
103
+ const _excluded = ["type"],
104
+ _excluded2 = ["type"],
105
+ _excluded3 = ["type"];
419
106
 
420
- async function generateLoginResponseV2(loginResponse) {
421
- if (!loginResponse.accessToken) {
422
- return {
423
- user: loginResponse
107
+ class AuthenticationApi extends _BaseApiClient.BaseApiClient {
108
+ constructor(appName) {
109
+ super(appName);
110
+ this.tenantsApi = new _tenants.TenantsApi(this.appName);
111
+ this.entitlementsApi = new _entitlements.EntitlementsApi(this.appName);
112
+ this.securityPolicy = new _secutiryPoilicy.SecurityPolicyApi(this.appName);
113
+
114
+ this.generateLoginResponse = async loginResponse => {
115
+ if (!loginResponse.accessToken) {
116
+ return loginResponse;
117
+ }
118
+
119
+ const contextHolder = _ContextHolder.ContextHolder.for(this.appName);
120
+
121
+ contextHolder.setAccessToken(loginResponse.accessToken);
122
+ const me = await this.getMeAndEntitlements();
123
+ const decodedContent = loginResponse.accessToken ? (0, _jwt.jwtDecode)(loginResponse.accessToken) : {};
124
+ const user = (0, _extends2.default)({}, loginResponse, decodedContent, me);
125
+ contextHolder.setUser(user);
126
+ return user;
424
127
  };
425
- }
426
-
427
- _ContextHolder.ContextHolder.setAccessToken(loginResponse.accessToken);
428
-
429
- const [me, tenants] = await Promise.all([getMeAndEntitlements(), (0, _tenants.getTenants)()]);
430
- const decodedContent = loginResponse.accessToken ? (0, _jwt.jwtDecode)(loginResponse.accessToken) : {};
431
- const user = (0, _extends2.default)({}, loginResponse, decodedContent, me);
432
-
433
- _ContextHolder.ContextHolder.setUser(user);
434
128
 
435
- return {
436
- user,
437
- tenants
438
- };
439
- }
440
-
441
- function shouldLoadEntitlements() {
442
- if (!_ContextHolder.ContextHolder.shouldLoadEntitlements()) {
443
- return false;
444
- }
445
-
446
- const [isEntitlementsFFOn] = _featureFlags.FeatureFlags.getFeatureFlags([_interfaces2.ADMIN_PORTAL_ENTITLEMENTS_FF], _ContextHolder.ContextHolder.getAppName() || '');
447
-
448
- return isEntitlementsFFOn;
449
- }
450
-
451
- function shouldLoadMeAuthorization() {
452
- const [shouldLoadAuthorization] = _featureFlags.FeatureFlags.getFeatureFlags([_interfaces.LOAD_AUTHORIZATION_FF], _ContextHolder.ContextHolder.getAppName() || '');
453
-
454
- return shouldLoadAuthorization;
455
- }
456
-
457
- async function generateLoginResponseV3(loginResponse) {
458
- const {
459
- accessToken
460
- } = loginResponse;
461
-
462
- if (!accessToken) {
463
- return {
464
- user: loginResponse
129
+ this.generateLoginResponseV2 = async loginResponse => {
130
+ if (!loginResponse.accessToken) {
131
+ return {
132
+ user: loginResponse
133
+ };
134
+ }
135
+
136
+ const contextHolder = _ContextHolder.ContextHolder.for(this.appName);
137
+
138
+ contextHolder.setAccessToken(loginResponse.accessToken);
139
+ const [me, tenants] = await Promise.all([this.getMeAndEntitlements(), this.tenantsApi.getTenants()]);
140
+ const decodedContent = loginResponse.accessToken ? (0, _jwt.jwtDecode)(loginResponse.accessToken) : {};
141
+ const user = (0, _extends2.default)({}, loginResponse, decodedContent, me);
142
+ contextHolder.setUser(user);
143
+ return {
144
+ user,
145
+ tenants
146
+ };
465
147
  };
466
- }
467
148
 
468
- _ContextHolder.ContextHolder.setAccessToken(accessToken);
149
+ this.generateLoginResponseV3 = async loginResponse => {
150
+ const {
151
+ accessToken
152
+ } = loginResponse;
153
+
154
+ if (!accessToken) {
155
+ return {
156
+ user: loginResponse
157
+ };
158
+ }
159
+
160
+ const contextHolder = _ContextHolder.ContextHolder.for(this.appName);
161
+
162
+ contextHolder.setAccessToken(accessToken);
163
+ const [me, currentUserTenants] = await Promise.all([this.getMeAndEntitlements(), (0, _utils.getCurrentUserTenantsFunction)(this.appName)()]);
164
+ const decodedContent = accessToken ? (0, _jwt.jwtDecode)(accessToken) : {};
165
+ const user = (0, _extends2.default)({}, loginResponse, decodedContent, me);
166
+
167
+ if (contextHolder.isSessionPerTenantEnabled()) {
168
+ (0, _utils.setTabTenantInSessionStorage)(user.tenantId);
169
+ }
170
+
171
+ contextHolder.setUser(user);
172
+ return {
173
+ user,
174
+ tenants: currentUserTenants.tenants,
175
+ activeTenant: currentUserTenants.activeTenant
176
+ };
177
+ };
469
178
 
470
- const [me, currentUserTenants] = await Promise.all([getMeAndEntitlements(), (0, _utils.getCurrentUserTenantsFunction)()()]);
471
- const decodedContent = accessToken ? (0, _jwt.jwtDecode)(accessToken) : {};
472
- const user = (0, _extends2.default)({}, loginResponse, decodedContent, me);
179
+ this.generateLoginResponseFromOAuthResponse = async oauthResponse => {
180
+ const contextHolder = _ContextHolder.ContextHolder.for(this.appName);
181
+
182
+ contextHolder.setAccessToken(oauthResponse.id_token);
183
+ const me = await this.getMeAndEntitlements();
184
+ const decodedContent = oauthResponse.id_token ? (0, _jwt.jwtDecode)(oauthResponse.id_token) : {};
185
+ const user = (0, _extends2.default)({
186
+ mfaRequired: false,
187
+ accessToken: oauthResponse.id_token,
188
+ refreshToken: oauthResponse.refresh_token
189
+ }, decodedContent, me, {
190
+ expiresIn: oauthResponse.expires_in || 300
191
+ });
192
+ contextHolder.setUser(user);
193
+ return user;
194
+ };
473
195
 
474
- if (_ContextHolder.ContextHolder.isSessionPerTenantEnabled()) {
475
- (0, _utils.setTabTenantInSessionStorage)(user.tenantId);
476
- }
196
+ this.generateLoginResponseFromOAuthResponseV2 = async oauthResponse => {
197
+ const contextHolder = _ContextHolder.ContextHolder.for(this.appName);
198
+
199
+ contextHolder.setAccessToken(oauthResponse.id_token);
200
+ const [me, currentUserTenants] = await Promise.all([this.getMeAndEntitlements(), (0, _utils.getCurrentUserTenantsFunction)(this.appName)()]);
201
+ const decodedContent = oauthResponse.id_token ? (0, _jwt.jwtDecode)(oauthResponse.id_token) : {};
202
+ const user = (0, _extends2.default)({
203
+ mfaRequired: false,
204
+ accessToken: oauthResponse.id_token,
205
+ refreshToken: oauthResponse.refresh_token
206
+ }, decodedContent, me, {
207
+ expiresIn: oauthResponse.expires_in || 300
208
+ });
209
+
210
+ if (contextHolder.isSessionPerTenantEnabled()) {
211
+ (0, _utils.setTabTenantInSessionStorage)(user.tenantId);
212
+ }
213
+
214
+ contextHolder.setUser(user);
215
+ return {
216
+ user,
217
+ tenants: currentUserTenants.tenants,
218
+ activeTenant: currentUserTenants.activeTenant
219
+ };
220
+ };
477
221
 
478
- _ContextHolder.ContextHolder.setUser(user);
222
+ this.preLogin = async body => {
223
+ try {
224
+ const {
225
+ address
226
+ } = await this.post(`${_constants2.urls.identity.auth.v1}/user/saml/prelogin`, body);
227
+ return address;
228
+ } catch {
229
+ return null;
230
+ }
231
+ };
479
232
 
480
- return {
481
- user,
482
- tenants: currentUserTenants.tenants,
483
- activeTenant: currentUserTenants.activeTenant
484
- };
485
- }
233
+ this.preLoginWithIdpType = async body => {
234
+ return this.post(`${_constants2.urls.identity.auth.v1}/user/saml/prelogin`, body);
235
+ };
486
236
 
487
- async function generateLoginResponseFromOAuthResponse(oauthResponse) {
488
- _ContextHolder.ContextHolder.setAccessToken(oauthResponse.id_token);
489
-
490
- const me = await getMeAndEntitlements();
491
- const decodedContent = oauthResponse.id_token ? (0, _jwt.jwtDecode)(oauthResponse.id_token) : {};
492
- const user = (0, _extends2.default)({
493
- mfaRequired: false,
494
- accessToken: oauthResponse.id_token,
495
- refreshToken: oauthResponse.refresh_token
496
- }, decodedContent, me, {
497
- expiresIn: oauthResponse.expires_in || 300
498
- });
237
+ this.postLogin = async body => {
238
+ const data = await this.post(`${_constants2.urls.identity.auth.v1}/user/saml/postlogin`, body);
239
+ return this.generateLoginResponse(data);
240
+ };
499
241
 
500
- _ContextHolder.ContextHolder.setUser(user);
242
+ this.oidcPostLogin = async body => {
243
+ const data = await this.post(`${_constants2.urls.identity.auth.v1}/user/oidc/postlogin`, body);
244
+ return this.generateLoginResponse(data);
245
+ };
501
246
 
502
- return user;
503
- }
247
+ this.login = async body => {
248
+ const data = await this.post(`${_constants2.urls.identity.auth.v1}/user`, body);
249
+ return this.generateLoginResponse(data);
250
+ };
504
251
 
505
- async function generateLoginResponseFromOAuthResponseV2(oauthResponse) {
506
- _ContextHolder.ContextHolder.setAccessToken(oauthResponse.id_token);
507
-
508
- const [me, currentUserTenants] = await Promise.all([getMeAndEntitlements(), (0, _utils.getCurrentUserTenantsFunction)()()]);
509
- const decodedContent = oauthResponse.id_token ? (0, _jwt.jwtDecode)(oauthResponse.id_token) : {};
510
- const user = (0, _extends2.default)({
511
- mfaRequired: false,
512
- accessToken: oauthResponse.id_token,
513
- refreshToken: oauthResponse.refresh_token
514
- }, decodedContent, me, {
515
- expiresIn: oauthResponse.expires_in || 300
516
- });
252
+ this.loginv2 = async body => {
253
+ const data = await this.post(`${_constants2.urls.identity.auth.v1}/user`, body);
254
+ return this.generateLoginResponseV3(data);
255
+ };
517
256
 
518
- if (_ContextHolder.ContextHolder.isSessionPerTenantEnabled()) {
519
- (0, _utils.setTabTenantInSessionStorage)(user.tenantId);
520
- }
257
+ this.loginWithMfa = async body => {
258
+ const data = await this.post(`${_constants2.urls.identity.auth.v1}/user/mfa/verify`, body);
259
+ return this.generateLoginResponse(data);
260
+ };
521
261
 
522
- _ContextHolder.ContextHolder.setUser(user);
262
+ this.loginWithMfaV2 = async body => {
263
+ const data = await this.post(`${_constants2.urls.identity.auth.v1}/user/mfa/verify`, body);
264
+ return this.generateLoginResponseV3(data);
265
+ };
523
266
 
524
- return {
525
- user,
526
- tenants: currentUserTenants.tenants,
527
- activeTenant: currentUserTenants.activeTenant
528
- };
529
- }
267
+ this.activateAccount = async body => {
268
+ return this.post(`${_constants2.urls.identity.users.v1}/activate`, body);
269
+ };
530
270
 
531
- async function preLogin(body) {
532
- try {
533
- const {
534
- address
535
- } = await (0, _fetch.Post)(`${_constants2.urls.identity.auth.v1}/user/saml/prelogin`, body);
536
- return address;
537
- } catch {
538
- return null;
539
- }
540
- }
271
+ this.activateAccountV2 = async body => {
272
+ const data = await this.post(`${_constants2.urls.identity.users.v1}/activate`, body);
273
+ return this.generateLoginResponseV3(data);
274
+ };
541
275
 
542
- async function preLoginWithIdpType(body) {
543
- return (0, _fetch.Post)(`${_constants2.urls.identity.auth.v1}/user/saml/prelogin`, body);
544
- }
276
+ this.getActivateAccountStrategy = async params => {
277
+ return this.get(`${_constants2.urls.identity.users.v1}/activate/strategy`, params);
278
+ };
545
279
 
546
- async function postLogin(body) {
547
- const data = await (0, _fetch.Post)(`${_constants2.urls.identity.auth.v1}/user/saml/postlogin`, body);
548
- return generateLoginResponse(data);
549
- }
280
+ this.resendActivationEmail = async body => {
281
+ return this.post(`${_constants2.urls.identity.users.v1}/activate/reset`, body);
282
+ };
550
283
 
551
- async function oidcPostLogin(body) {
552
- const data = await (0, _fetch.Post)(`${_constants2.urls.identity.auth.v1}/user/oidc/postlogin`, body);
553
- return generateLoginResponse(data);
554
- }
284
+ this.resendInvitationEmail = async body => {
285
+ return this.post(`${_constants2.urls.identity.users.v1}/invitation/reset`, body);
286
+ };
555
287
 
556
- async function login(body) {
557
- const data = await (0, _fetch.Post)(`${_constants2.urls.identity.auth.v1}/user`, body);
558
- return generateLoginResponse(data);
559
- }
288
+ this.acceptInvitation = async body => {
289
+ return this.post(`${_constants2.urls.identity.users.v1}/invitation/accept`, body);
290
+ };
560
291
 
561
- async function loginv2(body) {
562
- const data = await (0, _fetch.Post)(`${_constants2.urls.identity.auth.v1}/user`, body);
563
- return generateLoginResponseV3(data);
564
- }
292
+ this.refreshToken = async () => {
293
+ const tabTenantId = (0, _utils.getTabTenantFromSessionStorage)(this.appName);
294
+ const data = await this.post(`${_constants2.urls.identity.auth.v1}/user/token/refresh`, {
295
+ tenantId: tabTenantId
296
+ });
297
+ return this.generateLoginResponse(data);
298
+ };
565
299
 
566
- async function loginWithMfa(body) {
567
- const data = await (0, _fetch.Post)(`${_constants2.urls.identity.auth.v1}/user/mfa/verify`, body);
568
- return generateLoginResponse(data);
569
- }
300
+ this.refreshTokenV2 = async () => {
301
+ const tabTenantId = (0, _utils.getTabTenantFromSessionStorage)(this.appName);
302
+ const data = await this.post(`${_constants2.urls.identity.auth.v1}/user/token/refresh`, {
303
+ tenantId: tabTenantId
304
+ });
305
+ return this.generateLoginResponseV2(data);
306
+ };
570
307
 
571
- async function loginWithMfaV2(body) {
572
- const data = await (0, _fetch.Post)(`${_constants2.urls.identity.auth.v1}/user/mfa/verify`, body);
573
- return generateLoginResponseV3(data);
574
- }
308
+ this.refreshTokenV3 = async () => {
309
+ const tabTenantId = (0, _utils.getTabTenantFromSessionStorage)(this.appName);
310
+ const data = await this.post(`${_constants2.urls.identity.auth.v1}/user/token/refresh`, {
311
+ tenantId: tabTenantId
312
+ });
313
+ return this.generateLoginResponseV3(data);
314
+ };
575
315
 
576
- async function activateAccount(body) {
577
- return (0, _fetch.Post)(`${_constants2.urls.identity.users.v1}/activate`, body);
578
- }
316
+ this.logout = async () => {
317
+ return this.post(`${_constants2.urls.identity.auth.v1}/logout`);
318
+ };
579
319
 
580
- async function activateAccountV2(body) {
581
- const data = await (0, _fetch.Post)(`${_constants2.urls.identity.users.v1}/activate`, body);
582
- return generateLoginResponseV3(data);
583
- }
320
+ this.OAuthLogout = async params => {
321
+ return this.get(`${_constants2.urls.oauth.v1}/logout`, params);
322
+ };
584
323
 
585
- async function getActivateAccountStrategy(params) {
586
- return (0, _fetch.Get)(`${_constants2.urls.identity.users.v1}/activate/strategy`, params);
587
- }
324
+ this.forgotPassword = async body => {
325
+ return this.post(`${_constants2.urls.identity.users.v1}/passwords/reset`, body);
326
+ };
588
327
 
589
- async function resendActivationEmail(body) {
590
- return (0, _fetch.Post)(`${_constants2.urls.identity.users.v1}/activate/reset`, body);
591
- }
328
+ this.resetPassword = async body => {
329
+ return this.post(`${_constants2.urls.identity.users.v1}/passwords/reset/verify`, body);
330
+ };
592
331
 
593
- async function resendInvitationEmail(body) {
594
- return (0, _fetch.Post)(`${_constants2.urls.identity.users.v1}/invitation/reset`, body);
595
- }
332
+ this.loadPasswordConfig = async params => {
333
+ return this.get(`${_constants2.urls.identity.users.v1}/passwords/config`, params);
334
+ };
596
335
 
597
- async function acceptInvitation(body) {
598
- return (0, _fetch.Post)(`${_constants2.urls.identity.users.v1}/invitation/accept`, body);
599
- }
336
+ this.recoverMfaToken = async body => {
337
+ return this.post(`${_constants2.urls.identity.auth.v1}/user/mfa/recover`, body);
338
+ };
600
339
 
601
- async function refreshToken() {
602
- const tabTenantId = (0, _utils.getTabTenantFromSessionStorage)();
603
- const data = await (0, _fetch.Post)(`${_constants2.urls.identity.auth.v1}/user/token/refresh`, {
604
- tenantId: tabTenantId
605
- });
606
- return generateLoginResponse(data);
607
- }
340
+ this.enrollMfa = async () => {
341
+ return this.post(`${_constants2.urls.identity.users.v1}/mfa/enroll`);
342
+ };
608
343
 
609
- async function refreshTokenV2() {
610
- const tabTenantId = (0, _utils.getTabTenantFromSessionStorage)();
611
- const data = await (0, _fetch.Post)(`${_constants2.urls.identity.auth.v1}/user/token/refresh`, {
612
- tenantId: tabTenantId
613
- });
614
- return generateLoginResponseV2(data);
615
- }
344
+ this.preEnrollMFAAuthenticatorApp = async () => {
345
+ return this.post(`${_constants2.urls.identity.users.v1}/mfa/authenticator/enroll`);
346
+ };
616
347
 
617
- async function refreshTokenV3() {
618
- const tabTenantId = (0, _utils.getTabTenantFromSessionStorage)();
619
- const data = await (0, _fetch.Post)(`${_constants2.urls.identity.auth.v1}/user/token/refresh`, {
620
- tenantId: tabTenantId
621
- });
622
- return generateLoginResponseV3(data);
623
- }
348
+ this.enrollMFAAuthenticatorApp = async body => {
349
+ return this.post(`${_constants2.urls.identity.users.v1}/mfa/authenticator/enroll/verify`, body);
350
+ };
624
351
 
625
- async function logout() {
626
- return (0, _fetch.Post)(`${_constants2.urls.identity.auth.v1}/logout`);
627
- }
352
+ this.preEnrollMFASMS = async body => {
353
+ return this.post(`${_constants2.urls.identity.users.v1}/mfa/sms/enroll`, body);
354
+ };
628
355
 
629
- async function OAuthLogout(params) {
630
- return (0, _fetch.Get)(`${_constants2.urls.oauth.v1}/logout`, params);
631
- }
356
+ this.enrollMFASMS = async body => {
357
+ return this.post(`${_constants2.urls.identity.users.v1}/mfa/sms/enroll/verify`, body);
358
+ };
632
359
 
633
- async function forgotPassword(body) {
634
- return (0, _fetch.Post)(`${_constants2.urls.identity.users.v1}/passwords/reset`, body);
635
- }
360
+ this.preEnrollMFAWebAuthn = async () => {
361
+ return this.post(`${_constants2.urls.identity.users.v1}/mfa/webauthn/enroll`);
362
+ };
636
363
 
637
- async function resetPassword(body) {
638
- return (0, _fetch.Post)(`${_constants2.urls.identity.users.v1}/passwords/reset/verify`, body);
639
- }
364
+ this.enrollMFAWebAuthn = async body => {
365
+ return this.post(`${_constants2.urls.identity.users.v1}/mfa/webauthn/enroll/verify`, body);
366
+ };
640
367
 
641
- async function loadPasswordConfig(params) {
642
- return (0, _fetch.Get)(`${_constants2.urls.identity.users.v1}/passwords/config`, params);
643
- }
368
+ this.verifyMfa = async body => {
369
+ return this.post(`${_constants2.urls.identity.users.v1}/mfa/enroll/verify`, body);
370
+ };
644
371
 
645
- async function recoverMfaToken(body) {
646
- return (0, _fetch.Post)(`${_constants2.urls.identity.auth.v1}/user/mfa/recover`, body);
647
- }
372
+ this.disableMfa = async body => {
373
+ return this.post(`${_constants2.urls.identity.users.v1}/mfa/disable`, body);
374
+ };
648
375
 
649
- async function enrollMfa() {
650
- return (0, _fetch.Post)(`${_constants2.urls.identity.users.v1}/mfa/enroll`);
651
- }
376
+ this.disableMFAAuthenticatorApp = async (deviceId, body) => {
377
+ return this.post(`${_constants2.urls.identity.users.v1}/mfa/authenticator/${deviceId}/disable/verify`, body);
378
+ };
652
379
 
653
- async function preEnrollMFAAuthenticatorApp() {
654
- return (0, _fetch.Post)(`${_constants2.urls.identity.users.v1}/mfa/authenticator/enroll`);
655
- }
380
+ this.preDisableMFASMS = async deviceId => {
381
+ return this.post(`${_constants2.urls.identity.users.v1}/mfa/sms/${deviceId}/disable`);
382
+ };
656
383
 
657
- async function enrollMFAAuthenticatorApp(body) {
658
- return (0, _fetch.Post)(`${_constants2.urls.identity.users.v1}/mfa/authenticator/enroll/verify`, body);
659
- }
384
+ this.disableMFASMS = async (deviceId, body) => {
385
+ return this.post(`${_constants2.urls.identity.users.v1}/mfa/sms/${deviceId}/disable/verify`, body);
386
+ };
660
387
 
661
- async function preEnrollMFASMS(body) {
662
- return (0, _fetch.Post)(`${_constants2.urls.identity.users.v1}/mfa/sms/enroll`, body);
663
- }
388
+ this.preDisableMFAWebAuthn = async deviceId => {
389
+ return this.post(`${_constants2.urls.identity.users.v1}/mfa/webauthn/${deviceId}/disable`);
390
+ };
664
391
 
665
- async function enrollMFASMS(body) {
666
- return (0, _fetch.Post)(`${_constants2.urls.identity.users.v1}/mfa/sms/enroll/verify`, body);
667
- }
392
+ this.disableMFAWebAuthn = async (deviceId, body) => {
393
+ return this.post(`${_constants2.urls.identity.users.v1}/mfa/webauthn/${deviceId}/disable/verify`, body);
394
+ };
668
395
 
669
- async function preEnrollMFAWebAuthn() {
670
- return (0, _fetch.Post)(`${_constants2.urls.identity.users.v1}/mfa/webauthn/enroll`);
671
- }
396
+ this.getMFADevices = async () => {
397
+ return this.get(`${_constants2.urls.identity.users.v1}/mfa/devices`);
398
+ };
672
399
 
673
- async function enrollMFAWebAuthn(body) {
674
- return (0, _fetch.Post)(`${_constants2.urls.identity.users.v1}/mfa/webauthn/enroll/verify`, body);
675
- }
400
+ this.preEnrollMFAAuthenticatorAppForLogin = async body => {
401
+ return this.post(`${_constants2.urls.identity.auth.v1}/user/mfa/authenticator/enroll`, body);
402
+ };
676
403
 
677
- async function verifyMfa(body) {
678
- return (0, _fetch.Post)(`${_constants2.urls.identity.users.v1}/mfa/enroll/verify`, body);
679
- }
404
+ this.enrollMFAAuthenticatorAppForLogin = async body => {
405
+ return this.post(`${_constants2.urls.identity.auth.v1}/user/mfa/authenticator/enroll/verify`, body);
406
+ };
680
407
 
681
- async function disableMfa(body) {
682
- return (0, _fetch.Post)(`${_constants2.urls.identity.users.v1}/mfa/disable`, body);
683
- }
408
+ this.enrollMFAAuthenticatorAppForLoginV2 = async body => {
409
+ const data = await this.post(`${_constants2.urls.identity.auth.v1}/user/mfa/authenticator/enroll/verify`, body);
410
+ return this.generateLoginResponseV3(data);
411
+ };
684
412
 
685
- async function disableMFAAuthenticatorApp(deviceId, body) {
686
- return (0, _fetch.Post)(`${_constants2.urls.identity.users.v1}/mfa/authenticator/${deviceId}/disable/verify`, body);
687
- }
413
+ this.verifyMFAAuthenticatorAppForLogin = async (deviceId, body) => {
414
+ return this.post(`${_constants2.urls.identity.auth.v1}/user/mfa/authenticator/${deviceId}/verify`, body);
415
+ };
688
416
 
689
- async function preDisableMFASMS(deviceId) {
690
- return (0, _fetch.Post)(`${_constants2.urls.identity.users.v1}/mfa/sms/${deviceId}/disable`);
691
- }
417
+ this.preVerifyMFAEmailCode = async body => {
418
+ return this.post(`${_constants2.urls.identity.auth.v1}/user/mfa/emailcode`, body);
419
+ };
692
420
 
693
- async function disableMFASMS(deviceId, body) {
694
- return (0, _fetch.Post)(`${_constants2.urls.identity.users.v1}/mfa/sms/${deviceId}/disable/verify`, body);
695
- }
421
+ this.verifyMFAEmailCode = async body => {
422
+ return this.post(`${_constants2.urls.identity.auth.v1}/user/mfa/emailcode/verify`, body);
423
+ };
696
424
 
697
- async function preDisableMFAWebAuthn(deviceId) {
698
- return (0, _fetch.Post)(`${_constants2.urls.identity.users.v1}/mfa/webauthn/${deviceId}/disable`);
699
- }
425
+ this.verifyMFAEmailCodeV2 = async body => {
426
+ const data = await this.post(`${_constants2.urls.identity.auth.v1}/user/mfa/emailcode/verify`, body);
427
+ return this.generateLoginResponseV3(data);
428
+ };
700
429
 
701
- async function disableMFAWebAuthn(deviceId, body) {
702
- return (0, _fetch.Post)(`${_constants2.urls.identity.users.v1}/mfa/webauthn/${deviceId}/disable/verify`, body);
703
- }
430
+ this.preEnrollMFASMSForLogin = async body => {
431
+ return this.post(`${_constants2.urls.identity.auth.v1}/user/mfa/sms/enroll`, body);
432
+ };
704
433
 
705
- async function getMFADevices() {
706
- return (0, _fetch.Get)(`${_constants2.urls.identity.users.v1}/mfa/devices`);
707
- }
434
+ this.enrollMFASMSForLogin = async body => {
435
+ return this.post(`${_constants2.urls.identity.auth.v1}/user/mfa/sms/enroll/verify`, body);
436
+ };
708
437
 
709
- async function preEnrollMFAAuthenticatorAppForLogin(body) {
710
- return (0, _fetch.Post)(`${_constants2.urls.identity.auth.v1}/user/mfa/authenticator/enroll`, body);
711
- }
438
+ this.enrollMFASMSForLoginV2 = async body => {
439
+ const data = await this.post(`${_constants2.urls.identity.auth.v1}/user/mfa/sms/enroll/verify`, body);
440
+ return this.generateLoginResponseV3(data);
441
+ };
712
442
 
713
- async function enrollMFAAuthenticatorAppForLogin(body) {
714
- return (0, _fetch.Post)(`${_constants2.urls.identity.auth.v1}/user/mfa/authenticator/enroll/verify`, body);
715
- }
443
+ this.preVerifyMFASMSForLogin = async (deviceId, body) => {
444
+ return this.post(`${_constants2.urls.identity.auth.v1}/user/mfa/sms/${deviceId}`, body);
445
+ };
716
446
 
717
- async function enrollMFAAuthenticatorAppForLoginV2(body) {
718
- const data = await (0, _fetch.Post)(`${_constants2.urls.identity.auth.v1}/user/mfa/authenticator/enroll/verify`, body);
719
- return generateLoginResponseV3(data);
720
- }
447
+ this.verifyMFASMSForLogin = async (deviceId, body) => {
448
+ return this.post(`${_constants2.urls.identity.auth.v1}/user/mfa/sms/${deviceId}/verify`, body);
449
+ };
721
450
 
722
- async function verifyMFAAuthenticatorAppForLogin(deviceId, body) {
723
- return (0, _fetch.Post)(`${_constants2.urls.identity.auth.v1}/user/mfa/authenticator/${deviceId}/verify`, body);
724
- }
451
+ this.verifyMFASMSForLoginV2 = async (deviceId, body) => {
452
+ const data = await this.post(`${_constants2.urls.identity.auth.v1}/user/mfa/sms/${deviceId}/verify`, body);
453
+ return this.generateLoginResponseV3(data);
454
+ };
725
455
 
726
- async function preVerifyMFAEmailCode(body) {
727
- return (0, _fetch.Post)(`${_constants2.urls.identity.auth.v1}/user/mfa/emailcode`, body);
728
- }
456
+ this.preEnrollMFAWebAuthnForLogin = async body => {
457
+ return this.post(`${_constants2.urls.identity.auth.v1}/user/mfa/webauthn/enroll`, body);
458
+ };
729
459
 
730
- async function verifyMFAEmailCode(body) {
731
- return (0, _fetch.Post)(`${_constants2.urls.identity.auth.v1}/user/mfa/emailcode/verify`, body);
732
- }
460
+ this.enrollMFAWebAuthnForLogin = async body => {
461
+ return this.post(`${_constants2.urls.identity.auth.v1}/user/mfa/webauthn/enroll/verify`, body);
462
+ };
733
463
 
734
- async function verifyMFAEmailCodeV2(body) {
735
- const data = await (0, _fetch.Post)(`${_constants2.urls.identity.auth.v1}/user/mfa/emailcode/verify`, body);
736
- return generateLoginResponseV3(data);
737
- }
464
+ this.enrollMFAWebAuthnForLoginV2 = async body => {
465
+ const data = await this.post(`${_constants2.urls.identity.auth.v1}/user/mfa/webauthn/enroll/verify`, body);
466
+ return this.generateLoginResponseV3(data);
467
+ };
738
468
 
739
- async function preEnrollMFASMSForLogin(body) {
740
- return (0, _fetch.Post)(`${_constants2.urls.identity.auth.v1}/user/mfa/sms/enroll`, body);
741
- }
469
+ this.preVerifyMFAWebAuthnForLogin = async (deviceId, body) => {
470
+ return this.post(`${_constants2.urls.identity.auth.v1}/user/mfa/webauthn/${deviceId}`, body);
471
+ };
742
472
 
743
- async function enrollMFASMSForLogin(body) {
744
- return (0, _fetch.Post)(`${_constants2.urls.identity.auth.v1}/user/mfa/sms/enroll/verify`, body);
745
- }
473
+ this.verifyMFAWebAuthnForLogin = async (deviceId, body) => {
474
+ return this.post(`${_constants2.urls.identity.auth.v1}/user/mfa/webauthn/${deviceId}/verify`, body);
475
+ };
746
476
 
747
- async function enrollMFASMSForLoginV2(body) {
748
- const data = await (0, _fetch.Post)(`${_constants2.urls.identity.auth.v1}/user/mfa/sms/enroll/verify`, body);
749
- return generateLoginResponseV3(data);
750
- }
477
+ this.verifyMFAWebAuthnForLoginV2 = async (deviceId, body) => {
478
+ const data = await this.post(`${_constants2.urls.identity.auth.v1}/user/mfa/webauthn/${deviceId}/verify`, body);
479
+ return this.generateLoginResponseV3(data);
480
+ };
751
481
 
752
- async function preVerifyMFASMSForLogin(deviceId, body) {
753
- return (0, _fetch.Post)(`${_constants2.urls.identity.auth.v1}/user/mfa/sms/${deviceId}`, body);
754
- }
482
+ this.getSamlConfiguration = async () => {
483
+ return this.get(`${_constants2.urls.team.sso.v1}/saml/configurations`);
484
+ };
755
485
 
756
- async function verifyMFASMSForLogin(deviceId, body) {
757
- return (0, _fetch.Post)(`${_constants2.urls.identity.auth.v1}/user/mfa/sms/${deviceId}/verify`, body);
758
- }
486
+ this.updateSamlConfiguration = async body => {
487
+ return this.post(`${_constants2.urls.team.sso.v1}/saml/configurations`, body);
488
+ };
759
489
 
760
- async function verifyMFASMSForLoginV2(deviceId, body) {
761
- const data = await (0, _fetch.Post)(`${_constants2.urls.identity.auth.v1}/user/mfa/sms/${deviceId}/verify`, body);
762
- return generateLoginResponseV3(data);
763
- }
490
+ this.getSamlVendorConfiguration = async () => {
491
+ return this.get(`${_constants2.urls.team.sso.v1}/saml/configurations/vendor-config`);
492
+ };
764
493
 
765
- async function preEnrollMFAWebAuthnForLogin(body) {
766
- return (0, _fetch.Post)(`${_constants2.urls.identity.auth.v1}/user/mfa/webauthn/enroll`, body);
767
- }
494
+ this.updateSamlVendorMetadata = async body => {
495
+ return this.put(`${_constants2.urls.team.sso.v1}/saml/configurations/metadata`, body);
496
+ };
768
497
 
769
- async function enrollMFAWebAuthnForLogin(body) {
770
- return (0, _fetch.Post)(`${_constants2.urls.identity.auth.v1}/user/mfa/webauthn/enroll/verify`, body);
771
- }
498
+ this.validateSamlDomain = async () => {
499
+ return this.put(`${_constants2.urls.team.sso.v1}/saml/validations/domain`);
500
+ };
772
501
 
773
- async function enrollMFAWebAuthnForLoginV2(body) {
774
- const data = await (0, _fetch.Post)(`${_constants2.urls.identity.auth.v1}/user/mfa/webauthn/enroll/verify`, body);
775
- return generateLoginResponseV3(data);
776
- }
502
+ this.getSamlRoles = async () => {
503
+ return this.get(`${_constants2.urls.team.sso.v1}/saml/configurations/roles/default`);
504
+ };
777
505
 
778
- async function preVerifyMFAWebAuthnForLogin(deviceId, body) {
779
- return (0, _fetch.Post)(`${_constants2.urls.identity.auth.v1}/user/mfa/webauthn/${deviceId}`, body);
780
- }
506
+ this.getSamlRolesGroups = async () => {
507
+ return this.get(`${_constants2.urls.team.sso.v2}/saml/configurations/groups`);
508
+ };
781
509
 
782
- async function verifyMFAWebAuthnForLogin(deviceId, body) {
783
- return (0, _fetch.Post)(`${_constants2.urls.identity.auth.v1}/user/mfa/webauthn/${deviceId}/verify`, body);
784
- }
510
+ this.updateSamlRoles = async ({
511
+ roleIds
512
+ }) => {
513
+ return this.post(`${_constants2.urls.team.sso.v1}/saml/configurations/roles/default`, {
514
+ roleIds
515
+ });
516
+ };
785
517
 
786
- async function verifyMFAWebAuthnForLoginV2(deviceId, body) {
787
- const data = await (0, _fetch.Post)(`${_constants2.urls.identity.auth.v1}/user/mfa/webauthn/${deviceId}/verify`, body);
788
- return generateLoginResponseV3(data);
789
- }
518
+ this.createSamlGroup = async ({
519
+ roleIds,
520
+ group
521
+ }) => {
522
+ return this.post(`${_constants2.urls.team.sso.v2}/saml/configurations/groups`, {
523
+ group,
524
+ roleIds
525
+ });
526
+ };
790
527
 
791
- async function getSamlConfiguration() {
792
- return (0, _fetch.Get)(`${_constants2.urls.team.sso.v1}/saml/configurations`);
793
- }
528
+ this.updateSamlGroup = async ({
529
+ roleIds,
530
+ group,
531
+ id
532
+ }) => {
533
+ return this.patch(`${_constants2.urls.team.sso.v2}/saml/configurations/groups/${id}`, {
534
+ group,
535
+ roleIds
536
+ });
537
+ };
794
538
 
795
- async function updateSamlConfiguration(body) {
796
- return (0, _fetch.Post)(`${_constants2.urls.team.sso.v1}/saml/configurations`, body);
797
- }
539
+ this.deleteSamlGroup = async ({
540
+ id
541
+ }) => {
542
+ return this.delete(`${_constants2.urls.team.sso.v2}/saml/configurations/groups/${id}`);
543
+ };
798
544
 
799
- async function getSamlVendorConfiguration() {
800
- return (0, _fetch.Get)(`${_constants2.urls.team.sso.v1}/saml/configurations/vendor-config`);
801
- }
545
+ this.getOidcConfiguration = async () => {
546
+ return this.get(`${_constants2.urls.team.sso.v1}/oidc/configurations`);
547
+ };
802
548
 
803
- async function updateSamlVendorMetadata(body) {
804
- return (0, _fetch.Put)(`${_constants2.urls.team.sso.v1}/saml/configurations/metadata`, body);
805
- }
549
+ this.getSSOPublicConfiguration = async () => {
550
+ return this.get(`${_constants2.urls.team.sso.v2}/configurations/public`);
551
+ };
806
552
 
807
- async function validateSamlDomain() {
808
- return (0, _fetch.Put)(`${_constants2.urls.team.sso.v1}/saml/validations/domain`);
809
- }
553
+ this.getSocialLoginProviders = async () => {
554
+ return this.get(_constants2.urls.identity.sso.v1);
555
+ };
810
556
 
811
- async function getSamlRoles() {
812
- return (0, _fetch.Get)(`${_constants2.urls.team.sso.v1}/saml/configurations/roles/default`);
813
- }
557
+ this.getSocialLoginProvidersV2 = async () => {
558
+ return this.get(_constants2.urls.identity.sso.v2);
559
+ };
814
560
 
815
- async function getSamlRolesGroups() {
816
- return (0, _fetch.Get)(`${_constants2.urls.team.sso.v2}/saml/configurations/groups`);
817
- }
561
+ this.getSocialLoginProvidersV2ForAuthenticatedUser = async () => {
562
+ return this.get(`${_constants2.urls.identity.sso.v2}/authenticated`);
563
+ };
818
564
 
819
- async function updateSamlRoles({
820
- roleIds
821
- }) {
822
- return (0, _fetch.Post)(`${_constants2.urls.team.sso.v1}/saml/configurations/roles/default`, {
823
- roleIds
824
- });
825
- }
565
+ this.getCustomSocialLoginProvidersV1 = async () => {
566
+ return this.get(_constants2.urls.identity.sso.custom.v1);
567
+ };
826
568
 
827
- async function createSamlGroup({
828
- roleIds,
829
- group
830
- }) {
831
- return (0, _fetch.Post)(`${_constants2.urls.team.sso.v2}/saml/configurations/groups`, {
832
- group,
833
- roleIds
834
- });
835
- }
569
+ this.loginViaSocialLogin = async params => {
570
+ const queryParams = {};
836
571
 
837
- async function updateSamlGroup({
838
- roleIds,
839
- group,
840
- id
841
- }) {
842
- return (0, _fetch.Patch)(`${_constants2.urls.team.sso.v2}/saml/configurations/groups/${id}`, {
843
- group,
844
- roleIds
845
- });
846
- }
572
+ if (params.code) {
573
+ queryParams.code = params.code;
574
+ }
847
575
 
848
- async function deleteSamlGroup({
849
- id
850
- }) {
851
- return (0, _fetch.Delete)(`${_constants2.urls.team.sso.v2}/saml/configurations/groups/${id}`);
852
- }
576
+ if (params.idToken) {
577
+ queryParams.id_token = params.idToken;
578
+ }
853
579
 
854
- async function getOidcConfiguration() {
855
- return (0, _fetch.Get)(`${_constants2.urls.team.sso.v1}/oidc/configurations`);
856
- }
580
+ if (params.redirectUri) {
581
+ queryParams.redirectUri = params.redirectUri;
582
+ }
857
583
 
858
- async function getSSOPublicConfiguration() {
859
- return (0, _fetch.Get)(`${_constants2.urls.team.sso.v2}/configurations/public`);
860
- }
584
+ if (params.codeVerifier) {
585
+ queryParams.code_verifier = params.codeVerifier;
586
+ }
861
587
 
862
- async function getSocialLoginProviders() {
863
- return (0, _fetch.Get)(_constants2.urls.identity.sso.v1);
864
- }
588
+ if (params.state) {
589
+ queryParams.state = params.state;
590
+ }
865
591
 
866
- async function getSocialLoginProvidersV2() {
867
- return (0, _fetch.Get)(_constants2.urls.identity.sso.v2);
868
- }
592
+ return this.post(`${_constants2.urls.identity.auth.v1}/user/sso/${params.provider}/postlogin`, {
593
+ metadata: params.metadata,
594
+ invitationToken: params.invitationToken
595
+ }, {
596
+ params: queryParams
597
+ });
598
+ };
869
599
 
870
- async function getSocialLoginProvidersV2ForAuthenticatedUser() {
871
- return (0, _fetch.Get)(`${_constants2.urls.identity.sso.v2}/authenticated`);
872
- }
600
+ this.getVendorConfig = async () => {
601
+ return this.get(`${_constants2.urls.identity.configurations.v1}/public`);
602
+ };
873
603
 
874
- async function getCustomSocialLoginProvidersV1() {
875
- return (0, _fetch.Get)(_constants2.urls.identity.sso.custom.v1);
876
- }
604
+ this.signUpUser = async body => {
605
+ const {
606
+ shouldActivate,
607
+ authResponse,
608
+ userId,
609
+ tenantId
610
+ } = await this.post(`${_constants2.urls.identity.users.v1}/signUp`, body);
611
+ const response = {
612
+ shouldActivate,
613
+ userId,
614
+ tenantId
615
+ };
616
+
617
+ if (!shouldActivate && authResponse) {
618
+ const {
619
+ user,
620
+ tenants,
621
+ activeTenant
622
+ } = await this.generateLoginResponseV3(authResponse);
623
+ return (0, _extends2.default)({}, response, {
624
+ user,
625
+ tenants,
626
+ activeTenant
627
+ });
628
+ }
629
+
630
+ return response;
631
+ };
877
632
 
878
- async function loginViaSocialLogin({
879
- provider,
880
- code,
881
- idToken,
882
- redirectUri,
883
- codeVerifier,
884
- metadata,
885
- invitationToken,
886
- state
887
- }) {
888
- const params = {};
889
-
890
- if (code) {
891
- params.code = code;
892
- }
633
+ this.getCurrentUserSessions = async () => {
634
+ return this.get(_constants2.urls.identity.users.sessions.currentUser.v1);
635
+ };
893
636
 
894
- if (idToken) {
895
- params.id_token = idToken;
896
- }
637
+ this.getCurrentUserSession = async () => {
638
+ return this.get(`${_constants2.urls.identity.users.sessions.currentUser.v1}/current`);
639
+ };
897
640
 
898
- if (redirectUri) {
899
- params.redirectUri = redirectUri;
900
- }
641
+ this.revokeSessionsForUser = async userId => {
642
+ return this.post(`${_constants2.urls.identity.users.sessions.v1}/revoke`, {
643
+ userId
644
+ });
645
+ };
901
646
 
902
- if (codeVerifier) {
903
- params.code_verifier = codeVerifier;
904
- }
647
+ this.getSessionConfigurations = async () => {
648
+ return this.get(_constants2.urls.identity.users.sessions.configurations.v1);
649
+ };
905
650
 
906
- if (state) {
907
- params.state = state;
908
- }
651
+ this.createOrUpdateSessionConfigrations = async body => {
652
+ await this.post(_constants2.urls.identity.users.sessions.configurations.v1, body);
653
+ };
909
654
 
910
- return (0, _fetch.Post)(`${_constants2.urls.identity.auth.v1}/user/sso/${provider}/postlogin`, {
911
- metadata,
912
- invitationToken
913
- }, {
914
- params
915
- });
916
- }
655
+ this.deleteSessionForUser = async id => {
656
+ await this.delete(`${_constants2.urls.identity.users.sessions.currentUser.v1}/${id}`);
657
+ };
917
658
 
918
- async function getVendorConfig() {
919
- return (0, _fetch.Get)(`${_constants2.urls.identity.configurations.v1}/public`);
920
- }
659
+ this.deleteAllSessionsForUser = async () => {
660
+ await this.delete(`${_constants2.urls.identity.users.sessions.currentUser.v1}/all`);
661
+ };
921
662
 
922
- async function signUpUser(body) {
923
- const {
924
- shouldActivate,
925
- authResponse,
926
- userId,
927
- tenantId
928
- } = await (0, _fetch.Post)(`${_constants2.urls.identity.users.v1}/signUp`, body);
929
- const response = {
930
- shouldActivate,
931
- userId,
932
- tenantId
933
- };
934
-
935
- if (!shouldActivate && authResponse) {
936
- const {
937
- user,
938
- tenants,
939
- activeTenant
940
- } = await generateLoginResponseV3(authResponse);
941
- return (0, _extends2.default)({}, response, {
942
- user,
943
- tenants,
944
- activeTenant
945
- });
946
- }
663
+ this.getUserAccessTokensData = async () => {
664
+ return this.get(_constants2.urls.identity.users.accessTokens.v1);
665
+ };
947
666
 
948
- return response;
949
- }
667
+ this.getTenantAccessTokensData = async () => {
668
+ return this.get(_constants2.urls.identity.tenants.accessTokens.v1);
669
+ };
950
670
 
951
- async function getCurrentUserSessions() {
952
- return (0, _fetch.Get)(_constants2.urls.identity.users.sessions.currentUser.v1);
953
- }
671
+ this.deleteTenantAccessToken = async ({
672
+ id
673
+ }) => {
674
+ await this.delete(`${_constants2.urls.identity.tenants.accessTokens.v1}/${id}`);
675
+ };
954
676
 
955
- async function getCurrentUserSession() {
956
- return (0, _fetch.Get)(`${_constants2.urls.identity.users.sessions.currentUser.v1}/current`);
957
- }
677
+ this.deleteUserAccessToken = async ({
678
+ id
679
+ }) => {
680
+ await this.delete(`${_constants2.urls.identity.users.accessTokens.v1}/${id}`);
681
+ };
958
682
 
959
- async function revokeSessionsForUser(userId) {
960
- return (0, _fetch.Post)(`${_constants2.urls.identity.users.sessions.v1}/revoke`, {
961
- userId
962
- });
963
- }
683
+ this.createUserAccessToken = async body => {
684
+ return this.post(_constants2.urls.identity.users.accessTokens.v1, body);
685
+ };
964
686
 
965
- async function getSessionConfigurations() {
966
- return (0, _fetch.Get)(_constants2.urls.identity.users.sessions.configurations.v1);
967
- }
687
+ this.createTenantAccessToken = async body => {
688
+ return this.post(_constants2.urls.identity.tenants.accessTokens.v1, body);
689
+ };
968
690
 
969
- async function createOrUpdateSessionConfigrations(body) {
970
- await (0, _fetch.Post)(_constants2.urls.identity.users.sessions.configurations.v1, body);
971
- }
691
+ this.getUserApiTokensData = async () => {
692
+ return this.get(_constants2.urls.identity.users.apiTokens.v1);
693
+ };
972
694
 
973
- async function deleteSessionForUser(id) {
974
- await (0, _fetch.Delete)(`${_constants2.urls.identity.users.sessions.currentUser.v1}/${id}`);
975
- }
695
+ this.getTenantApiTokensData = async () => {
696
+ return this.get(_constants2.urls.identity.tenants.apiTokens.v1);
697
+ };
976
698
 
977
- async function deleteAllSessionsForUser() {
978
- await (0, _fetch.Delete)(`${_constants2.urls.identity.users.sessions.currentUser.v1}/all`);
979
- }
699
+ this.updateUserApiTokensData = async body => {
700
+ return this.post(_constants2.urls.identity.users.apiTokens.v1, body);
701
+ };
980
702
 
981
- async function getUserAccessTokensData() {
982
- return (0, _fetch.Get)(_constants2.urls.identity.users.accessTokens.v1);
983
- }
703
+ this.updateTenantApiTokensData = async body => {
704
+ return this.post(_constants2.urls.identity.tenants.apiTokens.v2, body);
705
+ };
984
706
 
985
- async function getTenantAccessTokensData() {
986
- return (0, _fetch.Get)(_constants2.urls.identity.tenants.accessTokens.v1);
987
- }
707
+ this.deleteTenantApiToken = async ({
708
+ tokenId
709
+ }) => {
710
+ await this.delete(`${_constants2.urls.identity.tenants.apiTokens.v1}/${tokenId}`);
711
+ };
988
712
 
989
- async function deleteTenantAccessToken({
990
- id
991
- }) {
992
- return (0, _fetch.Delete)(`${_constants2.urls.identity.tenants.accessTokens.v1}/${id}`);
993
- }
713
+ this.deleteUserApiToken = async ({
714
+ tokenId
715
+ }) => {
716
+ await this.delete(`${_constants2.urls.identity.users.apiTokens.v1}/${tokenId}`);
717
+ };
994
718
 
995
- async function deleteUserAccessToken({
996
- id
997
- }) {
998
- return (0, _fetch.Delete)(`${_constants2.urls.identity.users.accessTokens.v1}/${id}`);
999
- }
719
+ this.getUserById = async ({
720
+ userId
721
+ }) => {
722
+ return this.get(`${_constants2.urls.identity.users.v1}/${userId}`);
723
+ };
1000
724
 
1001
- async function createUserAccessToken(body) {
1002
- return (0, _fetch.Post)(_constants2.urls.identity.users.accessTokens.v1, body);
1003
- }
725
+ this.checkIfAllowToRememberMfaDevice = async mfaToken => {
726
+ return this.get(`${_constants2.urls.identity.configurations.v1}/mfa-policy/allow-remember-device`, {
727
+ mfaToken
728
+ });
729
+ };
1004
730
 
1005
- async function createTenantAccessToken(body) {
1006
- return (0, _fetch.Post)(_constants2.urls.identity.tenants.accessTokens.v1, body);
1007
- }
731
+ this.passwordlessPreLogin = async _ref => {
732
+ let {
733
+ type
734
+ } = _ref,
735
+ body = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
736
+ return this.post(`${_constants2.urls.identity.auth.v1}/passwordless/${type.toLocaleLowerCase()}/prelogin`, body);
737
+ };
1008
738
 
1009
- async function getUserApiTokensData() {
1010
- return (0, _fetch.Get)(_constants2.urls.identity.users.apiTokens.v1);
1011
- }
739
+ this.passwordlessPostLoginV2 = async _ref2 => {
740
+ let {
741
+ type
742
+ } = _ref2,
743
+ body = (0, _objectWithoutPropertiesLoose2.default)(_ref2, _excluded2);
744
+ const data = await this.post(`${_constants2.urls.identity.auth.v1}/passwordless/${type.toLocaleLowerCase()}/postlogin`, body);
745
+ return this.generateLoginResponseV3(data);
746
+ };
1012
747
 
1013
- async function getTenantApiTokensData() {
1014
- return (0, _fetch.Get)(_constants2.urls.identity.tenants.apiTokens.v1);
1015
- }
748
+ this.passwordlessPostLogin = async _ref3 => {
749
+ let {
750
+ type
751
+ } = _ref3,
752
+ body = (0, _objectWithoutPropertiesLoose2.default)(_ref3, _excluded3);
753
+ return this.post(`${_constants2.urls.identity.auth.v1}/passwordless/${type.toLocaleLowerCase()}/postlogin`, body);
754
+ };
1016
755
 
1017
- async function updateUserApiTokensData(body) {
1018
- return (0, _fetch.Post)(_constants2.urls.identity.users.apiTokens.v1, body);
1019
- }
756
+ this.verifyInviteToken = async ({
757
+ token
758
+ }) => {
759
+ return this.post(_constants2.urls.identity.tenants.invites.verify.v1, {
760
+ token
761
+ });
762
+ };
1020
763
 
1021
- async function updateTenantApiTokensData(body) {
1022
- return (0, _fetch.Post)(_constants2.urls.identity.tenants.apiTokens.v2, body);
1023
- }
764
+ this.getSSOConfigurations = async () => {
765
+ return this.get(`${_constants2.urls.team.sso.v1}/configurations`);
766
+ };
1024
767
 
1025
- async function deleteTenantApiToken({
1026
- tokenId
1027
- }) {
1028
- return (0, _fetch.Delete)(`${_constants2.urls.identity.tenants.apiTokens.v1}/${tokenId}`);
1029
- }
768
+ this.createSSOConfiguration = async body => {
769
+ return this.post(`${_constants2.urls.team.sso.v1}/configurations`, body);
770
+ };
1030
771
 
1031
- async function deleteUserApiToken({
1032
- tokenId
1033
- }) {
1034
- return (0, _fetch.Delete)(`${_constants2.urls.identity.users.apiTokens.v1}/${tokenId}`);
1035
- }
772
+ this.updateSSOConfiguration = async (ssoConfigId, body) => {
773
+ return this.patch(`${_constants2.urls.team.sso.v1}/configurations/${ssoConfigId}`, body);
774
+ };
1036
775
 
1037
- async function getUserById({
1038
- userId
1039
- }) {
1040
- return (0, _fetch.Get)(`${_constants2.urls.identity.users.v1}/${userId}`);
1041
- }
776
+ this.deleteSSOConfiguration = async ssoConfigId => {
777
+ await this.delete(`${_constants2.urls.team.sso.v1}/configurations/${ssoConfigId}`);
778
+ };
1042
779
 
1043
- async function checkIfAllowToRememberMfaDevice(mfaToken) {
1044
- return (0, _fetch.Get)(`${_constants2.urls.identity.configurations.v1}/mfa-policy/allow-remember-device`, {
1045
- mfaToken
1046
- });
1047
- }
780
+ this.createSSOConfigurationByMetadata = async body => {
781
+ return this.post(`${_constants2.urls.team.sso.v1}/configurations/metadata`, body);
782
+ };
1048
783
 
1049
- async function passwordlessPreLogin(_ref) {
1050
- let {
1051
- type
1052
- } = _ref,
1053
- body = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
1054
- return (0, _fetch.Post)(`${_constants2.urls.identity.auth.v1}/passwordless/${type.toLocaleLowerCase()}/prelogin`, body);
1055
- }
784
+ this.updateSSOConfigurationByMetadata = async (ssoConfigId, body) => {
785
+ return this.put(`${_constants2.urls.team.sso.v1}/configurations/${ssoConfigId}/metadata`, body);
786
+ };
1056
787
 
1057
- async function passwordlessPostLoginV2(_ref2) {
1058
- let {
1059
- type
1060
- } = _ref2,
1061
- body = (0, _objectWithoutPropertiesLoose2.default)(_ref2, _excluded2);
1062
- const data = await (0, _fetch.Post)(`${_constants2.urls.identity.auth.v1}/passwordless/${type.toLocaleLowerCase()}/postlogin`, body);
1063
- return generateLoginResponseV3(data);
1064
- }
788
+ this.createSSOConfigurationByMetadataUrl = async body => {
789
+ return this.post(`${_constants2.urls.team.sso.v1}/configurations/metadata-url`, body);
790
+ };
1065
791
 
1066
- async function passwordlessPostLogin(_ref3) {
1067
- let {
1068
- type
1069
- } = _ref3,
1070
- body = (0, _objectWithoutPropertiesLoose2.default)(_ref3, _excluded3);
1071
- return (0, _fetch.Post)(`${_constants2.urls.identity.auth.v1}/passwordless/${type.toLocaleLowerCase()}/postlogin`, body);
1072
- }
792
+ this.updateSSOConfigurationByMetadataUrl = async (ssoConfigId, body) => {
793
+ return this.put(`${_constants2.urls.team.sso.v1}/configurations/${ssoConfigId}/metadata-url`, body);
794
+ };
1073
795
 
1074
- async function verifyInviteToken({
1075
- token
1076
- }) {
1077
- return (0, _fetch.Post)(_constants2.urls.identity.tenants.invites.verify.v1, {
1078
- token
1079
- });
1080
- }
796
+ this.createSSODomain = async (ssoConfigId, body) => {
797
+ return this.post(`${_constants2.urls.team.sso.v1}/configurations/${ssoConfigId}/domains`, body);
798
+ };
1081
799
 
1082
- async function getSSOConfigurations() {
1083
- return (0, _fetch.Get)(`${_constants2.urls.team.sso.v1}/configurations`);
1084
- }
800
+ this.deleteSSODomain = async (ssoConfigId, domainId) => {
801
+ return this.delete(`${_constants2.urls.team.sso.v1}/configurations/${ssoConfigId}/domains/${domainId}`);
802
+ };
1085
803
 
1086
- async function createSSOConfiguration(body) {
1087
- return (0, _fetch.Post)(`${_constants2.urls.team.sso.v1}/configurations`, body);
1088
- }
804
+ this.validateSSODomain = async (ssoConfigId, domainId) => {
805
+ return this.put(`${_constants2.urls.team.sso.v1}/configurations/${ssoConfigId}/domains/${domainId}/validate`);
806
+ };
1089
807
 
1090
- async function updateSSOConfiguration(ssoConfigId, body) {
1091
- return (0, _fetch.Patch)(`${_constants2.urls.team.sso.v1}/configurations/${ssoConfigId}`, body);
1092
- }
808
+ this.validateSSODomainV2 = async (ssoConfigId, domainId) => {
809
+ return this.put(`${_constants2.urls.team.sso.v2}/configurations/${ssoConfigId}/domains/${domainId}/validate`);
810
+ };
1093
811
 
1094
- async function deleteSSOConfiguration(ssoConfigId) {
1095
- return (0, _fetch.Delete)(`${_constants2.urls.team.sso.v1}/configurations/${ssoConfigId}`);
1096
- }
812
+ this.getSSODefaultRoles = async ssoConfigId => {
813
+ return this.get(`${_constants2.urls.team.sso.v1}/configurations/${ssoConfigId}/roles`);
814
+ };
1097
815
 
1098
- async function createSSOConfigurationByMetadata(body) {
1099
- return (0, _fetch.Post)(`${_constants2.urls.team.sso.v1}/configurations/metadata`, body);
1100
- }
816
+ this.setSSODefaultRoles = async (ssoConfigId, body) => {
817
+ return this.put(`${_constants2.urls.team.sso.v1}/configurations/${ssoConfigId}/roles`, body);
818
+ };
1101
819
 
1102
- async function updateSSOConfigurationByMetadata(ssoConfigId, body) {
1103
- return (0, _fetch.Put)(`${_constants2.urls.team.sso.v1}/configurations/${ssoConfigId}/metadata`, body);
1104
- }
820
+ this.createSSOGroup = async (ssoConfigId, body) => {
821
+ return this.post(`${_constants2.urls.team.sso.v1}/configurations/${ssoConfigId}/groups`, body);
822
+ };
1105
823
 
1106
- async function createSSOConfigurationByMetadataUrl(body) {
1107
- return (0, _fetch.Post)(`${_constants2.urls.team.sso.v1}/configurations/metadata-url`, body);
1108
- }
824
+ this.updateSSOGroup = async (ssoConfigId, {
825
+ roleIds,
826
+ group,
827
+ id
828
+ }) => {
829
+ return this.patch(`${_constants2.urls.team.sso.v1}/configurations/${ssoConfigId}/groups/${id}`, {
830
+ group,
831
+ roleIds
832
+ });
833
+ };
1109
834
 
1110
- async function updateSSOConfigurationByMetadataUrl(ssoConfigId, body) {
1111
- return (0, _fetch.Put)(`${_constants2.urls.team.sso.v1}/configurations/${ssoConfigId}/metadata-url`, body);
1112
- }
835
+ this.deleteSSOGroup = async (ssoConfigId, groupId) => {
836
+ return this.delete(`${_constants2.urls.team.sso.v1}/configurations/${ssoConfigId}/groups/${groupId}`);
837
+ };
1113
838
 
1114
- async function createSSODomain(ssoConfigId, body) {
1115
- return (0, _fetch.Post)(`${_constants2.urls.team.sso.v1}/configurations/${ssoConfigId}/domains`, body);
1116
- }
839
+ this.getSSOGroups = async ssoConfigId => {
840
+ return this.get(`${_constants2.urls.team.sso.v1}/configurations/${ssoConfigId}/groups`);
841
+ };
1117
842
 
1118
- async function deleteSSODomain(ssoConfigId, domainId) {
1119
- return (0, _fetch.Delete)(`${_constants2.urls.team.sso.v1}/configurations/${ssoConfigId}/domains/${domainId}`);
1120
- }
843
+ this.preLoginV2 = async body => {
844
+ return this.post(`${_constants2.urls.identity.auth.v2}/user/sso/prelogin`, body);
845
+ };
1121
846
 
1122
- async function validateSSODomain(ssoConfigId, domainId) {
1123
- return (0, _fetch.Put)(`${_constants2.urls.team.sso.v1}/configurations/${ssoConfigId}/domains/${domainId}/validate`);
1124
- }
847
+ this.oidcPostLoginV2 = async body => {
848
+ const data = await this.post(`${_constants2.urls.identity.auth.v2}/user/oidc/postlogin`, body);
849
+ return this.generateLoginResponse(data);
850
+ };
1125
851
 
1126
- async function validateSSODomainV2(ssoConfigId, domainId) {
1127
- return (0, _fetch.Put)(`${_constants2.urls.team.sso.v2}/configurations/${ssoConfigId}/domains/${domainId}/validate`);
1128
- }
852
+ this.exchangeOAuthTokensV2 = async body => {
853
+ const data = await this.post(`${_constants2.urls.oauth.v1}/token`, body);
854
+ return this.generateLoginResponseFromOAuthResponseV2(data);
855
+ };
1129
856
 
1130
- async function getSSODefaultRoles(ssoConfigId) {
1131
- return (0, _fetch.Get)(`${_constants2.urls.team.sso.v1}/configurations/${ssoConfigId}/roles`);
1132
- }
857
+ this.silentOAuthRefreshTokenV2 = async () => {
858
+ const tabTenantId = (0, _utils.getTabTenantFromSessionStorage)(this.appName);
859
+ const data = await this.post(`${_constants2.urls.oauth.v1}/authorize/silent`, {
860
+ tenantId: tabTenantId
861
+ });
862
+ return this.generateLoginResponseFromOAuthResponseV2(data);
863
+ };
1133
864
 
1134
- async function setSSODefaultRoles(ssoConfigId, body) {
1135
- return (0, _fetch.Put)(`${_constants2.urls.team.sso.v1}/configurations/${ssoConfigId}/roles`, body);
1136
- }
865
+ this.exchangeOAuthTokens = async body => {
866
+ const data = await this.post(`${_constants2.urls.oauth.v1}/token`, body);
867
+ return this.generateLoginResponseFromOAuthResponse(data);
868
+ };
1137
869
 
1138
- async function createSSOGroup(ssoConfigId, body) {
1139
- return (0, _fetch.Post)(`${_constants2.urls.team.sso.v1}/configurations/${ssoConfigId}/groups`, body);
1140
- }
870
+ this.silentOAuthRefreshToken = async () => {
871
+ const tabTenantId = (0, _utils.getTabTenantFromSessionStorage)(this.appName);
872
+ const data = await this.post(`${_constants2.urls.oauth.v1}/authorize/silent`, {
873
+ tenantId: tabTenantId
874
+ });
875
+ return this.generateLoginResponseFromOAuthResponse(data);
876
+ };
1141
877
 
1142
- async function updateSSOGroup(ssoConfigId, {
1143
- roleIds,
1144
- group,
1145
- id
1146
- }) {
1147
- return (0, _fetch.Patch)(`${_constants2.urls.team.sso.v1}/configurations/${ssoConfigId}/groups/${id}`, {
1148
- group,
1149
- roleIds
1150
- });
1151
- }
878
+ this.resetPhoneNumber = async body => {
879
+ return this.post(`${_constants2.urls.identity.users.v1}/phone/reset`, body);
880
+ };
1152
881
 
1153
- async function deleteSSOGroup(ssoConfigId, groupId) {
1154
- return (0, _fetch.Delete)(`${_constants2.urls.team.sso.v1}/configurations/${ssoConfigId}/groups/${groupId}`);
1155
- }
882
+ this.verifyResetPhoneNumber = async body => {
883
+ return this.post(`${_constants2.urls.identity.users.v1}/phone/reset/verify`, body);
884
+ };
1156
885
 
1157
- async function getSSOGroups(ssoConfigId) {
1158
- return (0, _fetch.Get)(`${_constants2.urls.team.sso.v1}/configurations/${ssoConfigId}/groups`);
1159
- }
886
+ this.changePhoneNumberWithVerification = async body => {
887
+ return this.post(`${_constants2.urls.identity.users.v1}/phone`, body);
888
+ };
1160
889
 
1161
- async function preLoginV2(body) {
1162
- return (0, _fetch.Post)(`${_constants2.urls.identity.auth.v2}/user/sso/prelogin`, body);
1163
- }
890
+ this.verifyChangePhoneNumber = async body => {
891
+ return this.post(`${_constants2.urls.identity.users.v1}/phone/verify`, body);
892
+ };
1164
893
 
1165
- async function oidcPostLoginV2(body) {
1166
- const data = await (0, _fetch.Post)(`${_constants2.urls.identity.auth.v2}/user/oidc/postlogin`, body);
1167
- return generateLoginResponse(data);
1168
- }
894
+ this.changePhoneNumber = async body => {
895
+ return this.put(`${_constants2.urls.identity.users.v1}/phone/change`, body);
896
+ };
1169
897
 
1170
- async function exchangeOAuthTokensV2(body) {
1171
- const data = await (0, _fetch.Post)(`${_constants2.urls.oauth.v1}/token`, body);
1172
- return generateLoginResponseFromOAuthResponseV2(data);
1173
- }
898
+ this.webAuthnPreLogin = async body => {
899
+ return this.post(`${_constants2.urls.identity.auth.v1}/webauthn/prelogin`, body);
900
+ };
1174
901
 
1175
- async function silentOAuthRefreshTokenV2() {
1176
- const tabTenantId = (0, _utils.getTabTenantFromSessionStorage)();
1177
- const data = await (0, _fetch.Post)(`${_constants2.urls.oauth.v1}/authorize/silent`, {
1178
- tenantId: tabTenantId
1179
- });
1180
- return generateLoginResponseFromOAuthResponseV2(data);
1181
- }
902
+ this.webAuthnPostLogin = async body => {
903
+ return this.post(`${_constants2.urls.identity.auth.v1}/webauthn/postlogin`, body);
904
+ };
1182
905
 
1183
- async function exchangeOAuthTokens(body) {
1184
- const data = await (0, _fetch.Post)(`${_constants2.urls.oauth.v1}/token`, body);
1185
- return generateLoginResponseFromOAuthResponse(data);
1186
- }
906
+ this.webAuthnPostLoginV2 = async body => {
907
+ const data = await this.post(`${_constants2.urls.identity.auth.v1}/webauthn/postlogin`, body);
908
+ return this.generateLoginResponseV3(data);
909
+ };
1187
910
 
1188
- async function silentOAuthRefreshToken() {
1189
- const tabTenantId = (0, _utils.getTabTenantFromSessionStorage)();
1190
- const data = await (0, _fetch.Post)(`${_constants2.urls.oauth.v1}/authorize/silent`, {
1191
- tenantId: tabTenantId
1192
- });
1193
- return generateLoginResponseFromOAuthResponse(data);
1194
- }
911
+ this.webAuthnCreateNewDeviceSession = async () => {
912
+ return this.post(_constants2.urls.identity.webAuthnDevices.v1);
913
+ };
1195
914
 
1196
- async function resetPhoneNumber(body) {
1197
- return (0, _fetch.Post)(`${_constants2.urls.identity.users.v1}/phone/reset`, body);
1198
- }
915
+ this.getWebAuthnDevices = async () => {
916
+ return this.get(_constants2.urls.identity.webAuthnDevices.v1);
917
+ };
1199
918
 
1200
- async function verifyResetPhoneNumber(body) {
1201
- return (0, _fetch.Post)(`${_constants2.urls.identity.users.v1}/phone/reset/verify`, body);
1202
- }
919
+ this.deleteWebAuthnDevice = async deviceId => {
920
+ return this.delete(`${_constants2.urls.identity.webAuthnDevices.v1}/${deviceId}`);
921
+ };
1203
922
 
1204
- async function changePhoneNumberWithVerification(body) {
1205
- return (0, _fetch.Post)(`${_constants2.urls.identity.users.v1}/phone`, body);
1206
- }
923
+ this.verifyNewDeviceSession = async body => {
924
+ return this.post(`${_constants2.urls.identity.webAuthnDevices.v1}/verify`, body);
925
+ };
1207
926
 
1208
- async function verifyChangePhoneNumber(body) {
1209
- return (0, _fetch.Post)(`${_constants2.urls.identity.users.v1}/phone/verify`, body);
1210
- }
927
+ this.getVendorPublicAuthStrategiesConfig = async () => {
928
+ return this.get(`${_constants2.urls.identity.configurations.v1}/auth/strategies/public`);
929
+ };
1211
930
 
1212
- async function changePhoneNumber(body) {
1213
- return (0, _fetch.Put)(`${_constants2.urls.identity.users.v1}/phone/change`, body);
1214
- }
931
+ this.getPublicAuthStrategiesConfigForAuthenticatedUser = async () => {
932
+ return this.get(`${_constants2.urls.identity.configurations.v1}/auth/strategies`);
933
+ };
1215
934
 
1216
- async function webAuthnPreLogin(body) {
1217
- return (0, _fetch.Post)(`${_constants2.urls.identity.auth.v1}/webauthn/prelogin`, body);
1218
- }
935
+ this.getMFAStrategiesConfig = async () => {
936
+ return this.get(`${_constants2.urls.identity.configurations.v1}/mfa/strategies`);
937
+ };
1219
938
 
1220
- async function webAuthnPostLogin(body) {
1221
- return (0, _fetch.Post)(`${_constants2.urls.identity.auth.v1}/webauthn/postlogin`, body);
1222
- }
939
+ this.getUserAuthorization = async () => {
940
+ return this.get(`${_constants2.urls.identity.users.authorization.v1}`);
941
+ };
1223
942
 
1224
- async function webAuthnPostLoginV2(body) {
1225
- const data = await (0, _fetch.Post)(`${_constants2.urls.identity.auth.v1}/webauthn/postlogin`, body);
1226
- return generateLoginResponseV3(data);
1227
- }
943
+ this.getMeV2 = async () => {
944
+ return this.get(`${_constants2.urls.identity.users.v2}/me`);
945
+ };
1228
946
 
1229
- async function webAuthnCreateNewDeviceSession() {
1230
- return (0, _fetch.Post)(_constants2.urls.identity.webAuthnDevices.v1);
1231
- }
947
+ this.noThrowLoadEntitlements = async () => {
948
+ try {
949
+ return await this.entitlementsApi.loadEntitlementsV2();
950
+ } catch (e) {}
951
+ };
1232
952
 
1233
- async function getWebAuthnDevices() {
1234
- return (0, _fetch.Get)(_constants2.urls.identity.webAuthnDevices.v1);
1235
- }
953
+ this.getMeAndEntitlements = async () => {
954
+ const actions = [{
955
+ action: this.getMeV2,
956
+ shouldLoad: true
957
+ }, {
958
+ action: this.noThrowLoadEntitlements,
959
+ shouldLoad: this.shouldLoadEntitlements()
960
+ }, {
961
+ action: this.getUserAuthorization,
962
+ shouldLoad: this.shouldLoadMeAuthorization()
963
+ }];
964
+ const promises = actions.map(action => (0, _utils.executeConditionalPromise)(action));
965
+ const [me, entitlements, authorization] = await Promise.all(promises);
966
+ const tabTenant = (0, _utils.getTabTenantFromSessionStorage)(this.appName);
967
+
968
+ if (tabTenant) {
969
+ me.tenantId = tabTenant;
970
+ }
971
+
972
+ return (0, _extends2.default)({}, me, authorization != null ? authorization : {}, {
973
+ entitlements
974
+ });
975
+ };
1236
976
 
1237
- async function deleteWebAuthnDevice(deviceId) {
1238
- return (0, _fetch.Delete)(`${_constants2.urls.identity.webAuthnDevices.v1}/${deviceId}`);
1239
- }
977
+ this.generateStepupSession = async body => {
978
+ const data = await this.post(`${_constants2.urls.identity.auth.v1}/user/step-up/generate`, body);
1240
979
 
1241
- async function verifyNewDeviceSession(body) {
1242
- return (0, _fetch.Post)(`${_constants2.urls.identity.webAuthnDevices.v1}/verify`, body);
1243
- }
980
+ if (!data.accessToken) {
981
+ return data;
982
+ }
1244
983
 
1245
- async function getVendorPublicAuthStrategiesConfig() {
1246
- return (0, _fetch.Get)(`${_constants2.urls.identity.configurations.v1}/auth/strategies/public`);
1247
- }
984
+ return this.generateLoginResponseV3(data);
985
+ };
1248
986
 
1249
- async function getPublicAuthStrategiesConfigForAuthenticatedUser() {
1250
- return (0, _fetch.Get)(`${_constants2.urls.identity.configurations.v1}/auth/strategies`);
1251
- }
987
+ this.getGlobalSecurityPolicy = this.securityPolicy.getGlobalSecurityPolicy.bind(this.securityPolicy);
988
+ this.getMfaPolicy = this.securityPolicy.getMfaPolicy.bind(this.securityPolicy);
989
+ this.getVendorMfaPolicy = this.securityPolicy.getVendorMfaPolicy.bind(this.securityPolicy);
990
+ this.saveMfaPolicy = this.securityPolicy.saveMfaPolicy.bind(this.securityPolicy);
991
+ this.getLockoutPolicy = this.securityPolicy.getLockoutPolicy.bind(this.securityPolicy);
992
+ this.getVendorLockoutPolicy = this.securityPolicy.getVendorLockoutPolicy.bind(this.securityPolicy);
993
+ this.saveLockoutPolicy = this.securityPolicy.saveLockoutPolicy.bind(this.securityPolicy);
994
+ this.getCaptchaPolicy = this.securityPolicy.getCaptchaPolicy.bind(this.securityPolicy);
995
+ this.getPasswordHistoryPolicy = this.securityPolicy.getPasswordHistoryPolicy.bind(this.securityPolicy);
996
+ this.getVendorPasswordHistoryPolicy = this.securityPolicy.getVendorPasswordHistoryPolicy.bind(this.securityPolicy);
997
+ this.savePasswordHistoryPolicy = this.securityPolicy.savePasswordHistoryPolicy.bind(this.securityPolicy);
998
+ this.getPasswordConfigPolicy = this.securityPolicy.getPasswordConfigPolicy.bind(this.securityPolicy);
999
+ this.getDomainRestrictions = this.securityPolicy.getDomainRestrictions.bind(this.securityPolicy);
1000
+ this.getDomainRestrictionsConfig = this.securityPolicy.getDomainRestrictionsConfig.bind(this.securityPolicy);
1001
+ this.createDomainRestriction = this.securityPolicy.createDomainRestriction.bind(this.securityPolicy);
1002
+ this.updateDomainRestrictionConfig = this.securityPolicy.updateDomainRestrictionConfig.bind(this.securityPolicy);
1003
+ this.deleteDomainRestriction = this.securityPolicy.deleteDomainRestriction.bind(this.securityPolicy);
1004
+ this.getIPRestrictions = this.securityPolicy.getIPRestrictions.bind(this.securityPolicy);
1005
+ this.getIPRestrictionsConfig = this.securityPolicy.getIPRestrictionsConfig.bind(this.securityPolicy);
1006
+ this.createIPRestriction = this.securityPolicy.createIPRestriction.bind(this.securityPolicy);
1007
+ this.bulkCreateIPRestriction = this.securityPolicy.bulkCreateIPRestriction.bind(this.securityPolicy);
1008
+ this.updateIPRestrictionConfig = this.securityPolicy.updateIPRestrictionConfig.bind(this.securityPolicy);
1009
+ this.deleteIPRestriction = this.securityPolicy.deleteIPRestriction.bind(this.securityPolicy);
1010
+ this.testCurrentIp = this.securityPolicy.testCurrentIp.bind(this.securityPolicy);
1011
+ this.testCurrentIpInAllowList = this.securityPolicy.testCurrentIpInAllowList.bind(this.securityPolicy);
1012
+ }
1252
1013
 
1253
- async function getMFAStrategiesConfig() {
1254
- return (0, _fetch.Get)(`${_constants2.urls.identity.configurations.v1}/mfa/strategies`);
1255
- }
1014
+ shouldLoadEntitlements() {
1015
+ if (!_ContextHolder.ContextHolder.for(this.appName).shouldLoadEntitlements()) {
1016
+ return false;
1017
+ }
1256
1018
 
1257
- async function getUserAuthorization() {
1258
- return (0, _fetch.Get)(`${_constants2.urls.identity.users.authorization.v1}`);
1259
- }
1019
+ const [isEntitlementsFFOn] = _featureFlags.FeatureFlags.getFeatureFlags([_interfaces2.ADMIN_PORTAL_ENTITLEMENTS_FF], this.appName || '');
1260
1020
 
1261
- async function getMeV2() {
1262
- return (0, _fetch.Get)(`${_constants2.urls.identity.users.v2}/me`);
1263
- }
1021
+ return isEntitlementsFFOn;
1022
+ }
1264
1023
 
1265
- const noThrowLoadEntitlements = async () => {
1266
- try {
1267
- return await (0, _entitlements.loadEntitlementsV2)();
1268
- } catch (e) {}
1269
- };
1024
+ shouldLoadMeAuthorization() {
1025
+ const [shouldLoadAuthorization] = _featureFlags.FeatureFlags.getFeatureFlags([_interfaces.LOAD_AUTHORIZATION_FF], this.appName);
1270
1026
 
1271
- async function getMeAndEntitlements() {
1272
- const actions = [{
1273
- action: getMeV2,
1274
- shouldLoad: true
1275
- }, {
1276
- action: noThrowLoadEntitlements,
1277
- shouldLoad: shouldLoadEntitlements()
1278
- }, {
1279
- action: getUserAuthorization,
1280
- shouldLoad: shouldLoadMeAuthorization()
1281
- }];
1282
- const promises = actions.map(action => (0, _utils.executeConditionalPromise)(action));
1283
- const [me, entitlements, authorization] = await Promise.all(promises);
1284
- const tabTenant = (0, _utils.getTabTenantFromSessionStorage)();
1285
-
1286
- if (tabTenant) {
1287
- me.tenantId = tabTenant;
1027
+ return shouldLoadAuthorization;
1288
1028
  }
1289
1029
 
1290
- return (0, _extends2.default)({}, me, authorization != null ? authorization : {}, {
1291
- entitlements
1292
- });
1293
1030
  }
1294
1031
 
1295
- async function generateStepupSession(body) {
1296
- const data = await (0, _fetch.Post)(`${_constants2.urls.identity.auth.v1}/user/step-up/generate`, body);
1032
+ exports.AuthenticationApi = AuthenticationApi;
1297
1033
 
1298
- if (!data.accessToken) {
1299
- return data;
1300
- }
1034
+ var _default = new AuthenticationApi('default');
1301
1035
 
1302
- return generateLoginResponseV3(data);
1303
- }
1036
+ exports.default = _default;