@frontegg/rest-api 3.1.76-alpha.9502349697 → 3.1.76-alpha.9794353373

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