@frontegg/rest-api 3.1.73 → 3.1.74-alpha.9436511986

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