@frontegg/rest-api 6.0.1-alpha.4 → 7.28.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (218) hide show
  1. package/BaseApiClient.d.ts +16 -0
  2. package/BaseApiClient.js +30 -0
  3. package/ContextHolder/index.d.ts +160 -0
  4. package/ContextHolder/index.js +278 -0
  5. package/ContextHolder/package.json +6 -0
  6. package/FetchClient.d.ts +42 -0
  7. package/FetchClient.js +260 -0
  8. package/account-settings/index.d.ts +21 -7
  9. package/account-settings/index.js +25 -6
  10. package/account-settings/interfaces.d.ts +9 -2
  11. package/applications/index.d.ts +51 -0
  12. package/applications/index.js +55 -0
  13. package/applications/interfaces.d.ts +49 -0
  14. package/applications/interfaces.js +5 -0
  15. package/applications/package.json +6 -0
  16. package/audits/index.d.ts +27 -15
  17. package/audits/index.js +29 -16
  18. package/audits/interfaces.d.ts +3 -2
  19. package/auth/constants.d.ts +5 -0
  20. package/auth/constants.js +5 -0
  21. package/auth/enums.d.ts +8 -1
  22. package/auth/enums.js +9 -4
  23. package/auth/index.d.ts +833 -428
  24. package/auth/index.js +768 -385
  25. package/auth/interfaces.d.ts +341 -39
  26. package/auth/interfaces.js +19 -9
  27. package/auth/secutiry-poilicy/index.d.ts +60 -41
  28. package/auth/secutiry-poilicy/index.js +99 -45
  29. package/auth/secutiry-poilicy/interfaces.d.ts +62 -2
  30. package/auth/secutiry-poilicy/interfaces.js +5 -1
  31. package/auth/utils.d.ts +10 -0
  32. package/auth/utils.js +35 -0
  33. package/connectivity/index.d.ts +126 -27
  34. package/connectivity/index.js +120 -114
  35. package/constants.d.ts +115 -0
  36. package/constants.js +122 -5
  37. package/directory/index.d.ts +32 -0
  38. package/directory/index.js +30 -0
  39. package/directory/interfaces.d.ts +30 -0
  40. package/directory/interfaces.js +7 -0
  41. package/directory/package.json +6 -0
  42. package/entitlements/index.d.ts +15 -0
  43. package/entitlements/index.js +20 -0
  44. package/entitlements/interfaces.d.ts +13 -0
  45. package/entitlements/interfaces.js +11 -0
  46. package/entitlements/package.json +6 -0
  47. package/error.js +0 -2
  48. package/feature-flags/index.d.ts +18 -0
  49. package/feature-flags/index.js +44 -0
  50. package/feature-flags/interfaces.d.ts +5 -0
  51. package/feature-flags/interfaces.js +1 -0
  52. package/feature-flags/package.json +6 -0
  53. package/groups/enums.d.ts +9 -0
  54. package/groups/enums.js +11 -0
  55. package/groups/index.d.ts +73 -0
  56. package/groups/index.js +62 -0
  57. package/groups/interfaces.d.ts +64 -0
  58. package/groups/interfaces.js +1 -0
  59. package/groups/package.json +6 -0
  60. package/impersonate/index.d.ts +17 -0
  61. package/impersonate/index.js +23 -0
  62. package/impersonate/interfaces.d.ts +12 -0
  63. package/impersonate/interfaces.js +1 -0
  64. package/impersonate/package.json +6 -0
  65. package/index.d.ts +148 -53
  66. package/index.js +103 -31
  67. package/interfaces.d.ts +82 -1
  68. package/interfaces.js +28 -1
  69. package/jwt.js +19 -20
  70. package/metadata/index.d.ts +68 -5
  71. package/metadata/index.js +53 -23
  72. package/metadata/interfaces.d.ts +10 -2
  73. package/node/BaseApiClient.js +37 -0
  74. package/node/ContextHolder/index.js +286 -0
  75. package/node/FetchClient.js +268 -0
  76. package/node/account-settings/index.js +26 -11
  77. package/node/applications/index.js +62 -0
  78. package/node/applications/interfaces.js +12 -0
  79. package/node/audits/index.js +32 -27
  80. package/node/auth/constants.js +13 -0
  81. package/node/auth/enums.js +11 -5
  82. package/node/auth/index.js +807 -644
  83. package/node/auth/interfaces.js +27 -13
  84. package/node/auth/secutiry-poilicy/index.js +100 -66
  85. package/node/auth/secutiry-poilicy/interfaces.js +8 -1
  86. package/node/auth/utils.js +44 -0
  87. package/node/connectivity/index.js +123 -197
  88. package/node/constants.js +124 -6
  89. package/node/directory/index.js +37 -0
  90. package/node/directory/interfaces.js +14 -0
  91. package/node/entitlements/index.js +27 -0
  92. package/node/entitlements/interfaces.js +18 -0
  93. package/node/error.js +0 -4
  94. package/node/feature-flags/index.js +54 -0
  95. package/node/feature-flags/interfaces.js +5 -0
  96. package/node/groups/enums.js +19 -0
  97. package/node/groups/index.js +70 -0
  98. package/node/groups/interfaces.js +5 -0
  99. package/node/impersonate/index.js +29 -0
  100. package/node/impersonate/interfaces.js +5 -0
  101. package/node/index.js +324 -94
  102. package/node/interfaces.js +34 -1
  103. package/node/jwt.js +19 -25
  104. package/node/metadata/index.js +57 -38
  105. package/node/notifications/index.js +34 -31
  106. package/node/reports/index.js +79 -83
  107. package/node/roles/index.js +55 -60
  108. package/node/roles/interfaces.js +9 -1
  109. package/node/routers.js +52 -6
  110. package/node/security-center/index.js +26 -0
  111. package/node/security-center/interfaces.js +74 -0
  112. package/node/sub-tenants/index.js +82 -29
  113. package/node/sub-tenants/interfaces.js +9 -1
  114. package/node/subscriptions/enums.js +13 -9
  115. package/node/subscriptions/index.js +64 -109
  116. package/node/subscriptions/interfaces.js +0 -2
  117. package/node/subscriptions/invoices.js +20 -21
  118. package/node/subscriptions/managedSubscriptions.js +28 -33
  119. package/node/subscriptions/paymentMethods.js +23 -27
  120. package/node/subscriptions/paymentProviders.js +11 -8
  121. package/node/subscriptions/plans.js +13 -12
  122. package/node/subscriptions/providers/stripe/index.js +22 -27
  123. package/node/subscriptions/subscriptions.js +28 -33
  124. package/node/subscriptions/summaries.js +11 -8
  125. package/node/subscriptions/tenantConfiguration.js +13 -12
  126. package/node/subscriptions/vendorPublicConfigurations.js +17 -0
  127. package/node/teams/index.js +108 -121
  128. package/node/teams/interfaces.js +8 -1
  129. package/node/tenants/index.js +63 -21
  130. package/node/tenants/interfaces.js +18 -1
  131. package/node/user-phone-numbers/index.js +38 -0
  132. package/node/user-phone-numbers/interfaces.js +5 -0
  133. package/node/users/index.js +64 -0
  134. package/node/users/interfaces.js +27 -0
  135. package/node/velo/index.js +75 -0
  136. package/node/velo/interfaces.js +5 -0
  137. package/node/vendor/index.js +16 -8
  138. package/notifications/index.d.ts +22 -16
  139. package/notifications/index.js +33 -22
  140. package/package.json +4 -2
  141. package/reports/index.d.ts +50 -44
  142. package/reports/index.js +77 -68
  143. package/reports/interfaces.d.ts +2 -2
  144. package/roles/index.d.ts +45 -34
  145. package/roles/index.js +52 -41
  146. package/roles/interfaces.d.ts +25 -9
  147. package/roles/interfaces.js +6 -1
  148. package/routers.d.ts +6 -1
  149. package/routers.js +45 -2
  150. package/security-center/index.d.ts +15 -0
  151. package/security-center/index.js +19 -0
  152. package/security-center/interfaces.d.ts +115 -0
  153. package/security-center/interfaces.js +63 -0
  154. package/security-center/package.json +6 -0
  155. package/sub-tenants/index.d.ts +57 -8
  156. package/sub-tenants/index.js +84 -19
  157. package/sub-tenants/interfaces.d.ts +68 -10
  158. package/sub-tenants/interfaces.js +6 -1
  159. package/subscriptions/enums.d.ts +7 -0
  160. package/subscriptions/enums.js +10 -8
  161. package/subscriptions/index.d.ts +55 -9
  162. package/subscriptions/index.js +56 -9
  163. package/subscriptions/interfaces.d.ts +7 -3
  164. package/subscriptions/interfaces.js +1 -1
  165. package/subscriptions/invoices.d.ts +16 -13
  166. package/subscriptions/invoices.js +19 -14
  167. package/subscriptions/managedSubscriptions.d.ts +18 -15
  168. package/subscriptions/managedSubscriptions.js +27 -22
  169. package/subscriptions/paymentMethods.d.ts +16 -13
  170. package/subscriptions/paymentMethods.js +22 -18
  171. package/subscriptions/paymentProviders.d.ts +8 -5
  172. package/subscriptions/paymentProviders.js +9 -4
  173. package/subscriptions/plans.d.ts +11 -8
  174. package/subscriptions/plans.js +11 -6
  175. package/subscriptions/providers/stripe/index.d.ts +24 -21
  176. package/subscriptions/providers/stripe/index.js +21 -16
  177. package/subscriptions/subscriptions.d.ts +24 -21
  178. package/subscriptions/subscriptions.js +27 -22
  179. package/subscriptions/summaries.d.ts +7 -4
  180. package/subscriptions/summaries.js +8 -3
  181. package/subscriptions/tenantConfiguration.d.ts +6 -3
  182. package/subscriptions/tenantConfiguration.js +12 -7
  183. package/subscriptions/vendorPublicConfigurations.d.ts +5 -0
  184. package/subscriptions/vendorPublicConfigurations.js +10 -0
  185. package/teams/index.d.ts +38 -115
  186. package/teams/index.js +105 -79
  187. package/teams/interfaces.d.ts +47 -42
  188. package/teams/interfaces.js +5 -1
  189. package/tenants/index.d.ts +25 -26
  190. package/tenants/index.js +61 -12
  191. package/tenants/interfaces.d.ts +85 -0
  192. package/tenants/interfaces.js +14 -1
  193. package/user-phone-numbers/index.d.ts +32 -0
  194. package/user-phone-numbers/index.js +31 -0
  195. package/user-phone-numbers/interfaces.d.ts +32 -0
  196. package/user-phone-numbers/interfaces.js +1 -0
  197. package/user-phone-numbers/package.json +6 -0
  198. package/users/index.d.ts +24 -0
  199. package/users/index.js +55 -0
  200. package/users/interfaces.d.ts +144 -0
  201. package/users/interfaces.js +18 -0
  202. package/users/package.json +6 -0
  203. package/velo/index.d.ts +46 -0
  204. package/velo/index.js +68 -0
  205. package/velo/interfaces.d.ts +108 -0
  206. package/velo/interfaces.js +1 -0
  207. package/velo/package.json +6 -0
  208. package/vendor/index.d.ts +12 -6
  209. package/vendor/index.js +15 -4
  210. package/ContextHolder.d.ts +0 -29
  211. package/ContextHolder.js +0 -80
  212. package/fetch.d.ts +0 -19
  213. package/fetch.js +0 -203
  214. package/node/ContextHolder.js +0 -90
  215. package/node/fetch.js +0 -234
  216. package/node/subscriptions/providers/index.js +0 -18
  217. package/subscriptions/providers/index.d.ts +0 -1
  218. package/subscriptions/providers/index.js +0 -1
@@ -4,12 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  var _exportNames = {
7
- SecondaryAuthStrategy: true
7
+ SecondaryAuthStrategy: true,
8
+ WebAuthnDeviceType: true,
9
+ MFAStrategyEnum: true,
10
+ LOAD_AUTHORIZATION_FF: true
8
11
  };
9
- exports.SecondaryAuthStrategy = void 0;
10
-
12
+ exports.WebAuthnDeviceType = exports.SecondaryAuthStrategy = exports.MFAStrategyEnum = exports.LOAD_AUTHORIZATION_FF = void 0;
11
13
  var _interfaces = require("./secutiry-poilicy/interfaces");
12
-
13
14
  Object.keys(_interfaces).forEach(function (key) {
14
15
  if (key === "default" || key === "__esModule") return;
15
16
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -21,18 +22,31 @@ Object.keys(_interfaces).forEach(function (key) {
21
22
  }
22
23
  });
23
24
  });
24
- ;
25
- ;
26
- ;
27
- ;
28
- ;
29
- ;
30
- ;
25
+ // SmsCode is for speedy login, SmsCodeV2 is for login with SMS
31
26
  let SecondaryAuthStrategy;
32
27
  exports.SecondaryAuthStrategy = SecondaryAuthStrategy;
33
-
34
28
  (function (SecondaryAuthStrategy) {
35
29
  SecondaryAuthStrategy["WebAuthnPlatform"] = "WebAuthnPlatform";
36
30
  SecondaryAuthStrategy["WebAuthnCrossPlatform"] = "WebAuthnCrossPlatform";
37
31
  SecondaryAuthStrategy["SmsCode"] = "SmsCode";
38
- })(SecondaryAuthStrategy || (exports.SecondaryAuthStrategy = SecondaryAuthStrategy = {}));
32
+ SecondaryAuthStrategy["SmsCodeV2"] = "SmsCodeV2";
33
+ SecondaryAuthStrategy["Passkeys"] = "Passkeys";
34
+ })(SecondaryAuthStrategy || (exports.SecondaryAuthStrategy = SecondaryAuthStrategy = {}));
35
+ // WebAuthn
36
+ let WebAuthnDeviceType;
37
+ exports.WebAuthnDeviceType = WebAuthnDeviceType;
38
+ (function (WebAuthnDeviceType) {
39
+ WebAuthnDeviceType["Platform"] = "Platform";
40
+ WebAuthnDeviceType["CrossPlatform"] = "CrossPlatform";
41
+ })(WebAuthnDeviceType || (exports.WebAuthnDeviceType = WebAuthnDeviceType = {}));
42
+ let MFAStrategyEnum;
43
+ exports.MFAStrategyEnum = MFAStrategyEnum;
44
+ (function (MFAStrategyEnum) {
45
+ MFAStrategyEnum["AuthenticatorApp"] = "AuthenticatorApp";
46
+ MFAStrategyEnum["WebAuthnPlatform"] = "WebAuthnPlatform";
47
+ MFAStrategyEnum["WebAuthnCrossPlatform"] = "WebAuthnCrossPlatform";
48
+ MFAStrategyEnum["SMS"] = "SMS";
49
+ MFAStrategyEnum["EmailCode"] = "EmailCode";
50
+ })(MFAStrategyEnum || (exports.MFAStrategyEnum = MFAStrategyEnum = {}));
51
+ const LOAD_AUTHORIZATION_FF = 'admin_portal_should_load_authorization';
52
+ exports.LOAD_AUTHORIZATION_FF = LOAD_AUTHORIZATION_FF;
@@ -3,73 +3,107 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getCaptchaPolicy = getCaptchaPolicy;
7
- exports.getGlobalSecurityPolicy = getGlobalSecurityPolicy;
8
- exports.getLockoutPolicy = getLockoutPolicy;
9
- exports.getMfaPolicy = getMfaPolicy;
10
- exports.getPasswordConfigPolicy = getPasswordConfigPolicy;
11
- exports.getPasswordHistoryPolicy = getPasswordHistoryPolicy;
12
- exports.getVendorMfaPolicy = getVendorMfaPolicy;
13
- exports.saveLockoutPolicy = saveLockoutPolicy;
14
- exports.saveMfaPolicy = saveMfaPolicy;
15
- exports.savePasswordHistoryPolicy = savePasswordHistoryPolicy;
16
-
17
- var _fetch = require("../../fetch");
18
-
6
+ exports.default = exports.SecurityPolicyApi = void 0;
19
7
  var _constants = require("../../constants");
20
-
21
- async function getGlobalSecurityPolicy() {
22
- return (0, _fetch.Get)(_constants.urls.identity.configurations.v1);
23
- }
24
-
25
- async function getMfaPolicy() {
26
- return (0, _fetch.Get)(`${_constants.urls.identity.configurations.v1}/mfa-policy`);
27
- }
28
-
29
- async function getVendorMfaPolicy() {
30
- return (0, _fetch.Get)(`${_constants.urls.identity.configurations.v1}/mfa-policy/vendor`);
31
- }
32
-
33
- async function saveMfaPolicy(body) {
34
- if (body.id) {
35
- return (0, _fetch.Patch)(`${_constants.urls.identity.configurations.v1}/mfa-policy`, body);
36
- } else {
37
- return (0, _fetch.Post)(`${_constants.urls.identity.configurations.v1}/mfa-policy`, body);
38
- }
39
- }
40
-
41
- async function getLockoutPolicy() {
42
- return (0, _fetch.Get)(`${_constants.urls.identity.configurations.v1}/lockout-policy`);
43
- }
44
-
45
- async function saveLockoutPolicy(body) {
46
- if (body.id) {
47
- return (0, _fetch.Patch)(`${_constants.urls.identity.configurations.v1}/lockout-policy`, body);
48
- } else {
49
- return (0, _fetch.Post)(`${_constants.urls.identity.configurations.v1}/lockout-policy`, body);
8
+ var _BaseApiClient = require("../../BaseApiClient");
9
+ class SecurityPolicyApi extends _BaseApiClient.BaseApiClient {
10
+ constructor(appName) {
11
+ super(appName);
12
+ this.getGlobalSecurityPolicy = async () => {
13
+ return this.get(_constants.urls.identity.configurations.v1);
14
+ };
15
+ this.getMfaPolicy = async () => {
16
+ return this.get(`${_constants.urls.identity.configurations.v1}/mfa-policy`);
17
+ };
18
+ this.getVendorMfaPolicy = async () => {
19
+ return this.get(`${_constants.urls.identity.configurations.v1}/mfa-policy/vendor`);
20
+ };
21
+ this.saveMfaPolicy = async body => {
22
+ if (body.id) {
23
+ return this.patch(`${_constants.urls.identity.configurations.v1}/mfa-policy`, body);
24
+ } else {
25
+ return this.post(`${_constants.urls.identity.configurations.v1}/mfa-policy`, body);
26
+ }
27
+ };
28
+ this.getLockoutPolicy = async () => {
29
+ return this.get(`${_constants.urls.identity.configurations.v1}/lockout-policy`);
30
+ };
31
+ this.getVendorLockoutPolicy = async () => {
32
+ return this.get(`${_constants.urls.identity.configurations.v1}/lockout-policy/vendor`);
33
+ };
34
+ this.saveLockoutPolicy = async body => {
35
+ if (body.id) {
36
+ return this.patch(`${_constants.urls.identity.configurations.v1}/lockout-policy`, body);
37
+ } else {
38
+ return this.post(`${_constants.urls.identity.configurations.v1}/lockout-policy`, body);
39
+ }
40
+ };
41
+ this.getCaptchaPolicy = async () => {
42
+ try {
43
+ return await this.get(`${_constants.urls.identity.configurations.v1}/captcha-policy/public`);
44
+ } catch {
45
+ return null;
46
+ }
47
+ };
48
+ this.getPasswordHistoryPolicy = async () => {
49
+ return this.get(`${_constants.urls.identity.configurations.v1}/password-history-policy`);
50
+ };
51
+ this.getVendorPasswordHistoryPolicy = async () => {
52
+ return this.get(`${_constants.urls.identity.configurations.v1}/password-history-policy/vendor`);
53
+ };
54
+ this.savePasswordHistoryPolicy = async body => {
55
+ if (body.id) {
56
+ return this.patch(`${_constants.urls.identity.configurations.v1}/password-history-policy`, body);
57
+ } else {
58
+ return this.post(`${_constants.urls.identity.configurations.v1}/password-history-policy`, body);
59
+ }
60
+ };
61
+ this.getPasswordConfigPolicy = async () => {
62
+ return this.get(`${_constants.urls.identity.configurations.v1}/password`);
63
+ };
64
+ this.getDomainRestrictions = async () => {
65
+ return this.get(`${_constants.urls.identity.restrictions.emailDomain.v1}`);
66
+ };
67
+ this.getDomainRestrictionsConfig = async () => {
68
+ return this.get(`${_constants.urls.identity.restrictions.emailDomain.v1}/config`);
69
+ };
70
+ this.createDomainRestriction = async body => {
71
+ return this.post(`${_constants.urls.identity.restrictions.emailDomain.v1}`, body);
72
+ };
73
+ this.updateDomainRestrictionConfig = async body => {
74
+ return this.post(`${_constants.urls.identity.restrictions.emailDomain.v1}/config`, body);
75
+ };
76
+ this.deleteDomainRestriction = async id => {
77
+ return this.delete(`${_constants.urls.identity.restrictions.emailDomain.v1}/${id}`);
78
+ };
79
+ this.getIPRestrictions = async params => {
80
+ return this.get(`${_constants.urls.identity.restrictions.ip.v1}`, params);
81
+ };
82
+ this.getIPRestrictionsConfig = async () => {
83
+ return this.get(`${_constants.urls.identity.restrictions.ip.v1}/config`);
84
+ };
85
+ this.createIPRestriction = async body => {
86
+ return this.post(`${_constants.urls.identity.restrictions.ip.v1}`, body);
87
+ };
88
+ this.bulkCreateIPRestriction = async body => {
89
+ return this.post(`${_constants.urls.identity.restrictions.ip.v1}/bulk`, body);
90
+ };
91
+ this.updateIPRestrictionConfig = async body => {
92
+ return this.post(`${_constants.urls.identity.restrictions.ip.v1}/config`, body);
93
+ };
94
+ this.deleteIPRestriction = async id => {
95
+ return this.delete(`${_constants.urls.identity.restrictions.ip.v1}/${id}`);
96
+ };
97
+ this.testCurrentIp = async () => {
98
+ return this.post(`${_constants.urls.identity.restrictions.ip.v1}/verify`);
99
+ };
100
+ this.testCurrentIpInAllowList = async () => {
101
+ return this.post(`${_constants.urls.identity.restrictions.ip.v1}/verify/allow`);
102
+ };
50
103
  }
51
- }
52
104
 
53
- async function getCaptchaPolicy() {
54
- try {
55
- return await (0, _fetch.Get)(`${_constants.urls.identity.configurations.v1}/captcha-policy/public`);
56
- } catch {
57
- return null;
58
- }
105
+ /** Get global secure access configuration */
59
106
  }
60
-
61
- async function getPasswordHistoryPolicy() {
62
- return (0, _fetch.Get)(`${_constants.urls.identity.configurations.v1}/password-history-policy`);
63
- }
64
-
65
- async function savePasswordHistoryPolicy(body) {
66
- if (body.id) {
67
- return (0, _fetch.Patch)(`${_constants.urls.identity.configurations.v1}/password-history-policy`, body);
68
- } else {
69
- return (0, _fetch.Post)(`${_constants.urls.identity.configurations.v1}/password-history-policy`, body);
70
- }
71
- }
72
-
73
- async function getPasswordConfigPolicy() {
74
- return (0, _fetch.Get)(`${_constants.urls.identity.configurations.v1}/password`);
75
- }
107
+ exports.SecurityPolicyApi = SecurityPolicyApi;
108
+ var _default = new SecurityPolicyApi('default');
109
+ exports.default = _default;
@@ -2,4 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
- });
5
+ });
6
+ exports.RestrictionType = void 0;
7
+ let RestrictionType;
8
+ exports.RestrictionType = RestrictionType;
9
+ (function (RestrictionType) {
10
+ RestrictionType["ALLOW"] = "ALLOW";
11
+ RestrictionType["BLOCK"] = "BLOCK";
12
+ })(RestrictionType || (exports.RestrictionType = RestrictionType = {}));
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.executeConditionalPromise = executeConditionalPromise;
7
+ exports.getCurrentUserTenantsFunction = getCurrentUserTenantsFunction;
8
+ exports.getTabTenantFromSessionStorage = getTabTenantFromSessionStorage;
9
+ exports.removeTabTenantFromSessionStorage = removeTabTenantFromSessionStorage;
10
+ exports.setTabTenantInSessionStorage = setTabTenantInSessionStorage;
11
+ var _ContextHolder = require("../ContextHolder");
12
+ var _constants = require("./constants");
13
+ var _featureFlags = require("../feature-flags");
14
+ var _users = require("../users");
15
+ async function executeConditionalPromise({
16
+ shouldLoad,
17
+ action
18
+ }) {
19
+ if (!shouldLoad) return;
20
+ return await action();
21
+ }
22
+ function setTabTenantInSessionStorage(tenantId) {
23
+ if (!tenantId) {
24
+ return;
25
+ }
26
+ sessionStorage.setItem(_constants.FRONTEGG_SEPARATE_TABS_BY_TENANT, tenantId);
27
+ }
28
+ function removeTabTenantFromSessionStorage() {
29
+ sessionStorage.removeItem(_constants.FRONTEGG_SEPARATE_TABS_BY_TENANT);
30
+ }
31
+ function getTabTenantFromSessionStorage(appName) {
32
+ if (!_ContextHolder.ContextHolder.for(appName).isSessionPerTenantEnabled()) {
33
+ return null;
34
+ }
35
+ return sessionStorage.getItem(_constants.FRONTEGG_SEPARATE_TABS_BY_TENANT);
36
+ }
37
+ function getCurrentUserTenantsFunction(appName) {
38
+ const usersApi = new _users.UsersApi(appName);
39
+ const [useCurrentUserTenantsV1] = _featureFlags.FeatureFlags.getFeatureFlags([_constants.USE_CURRENT_USER_TENANTS_V1_ENDPOINT_FF], appName);
40
+ if (_ContextHolder.ContextHolder.for(appName).isSessionPerTenantEnabled()) {
41
+ return usersApi.getCurrentUserTenantsV1;
42
+ }
43
+ return useCurrentUserTenantsV1 ? usersApi.getCurrentUserTenantsV1 : usersApi.getCurrentUserTenantsV3;
44
+ }
@@ -1,208 +1,134 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
- exports.putSMSSubscriptions = exports.putEmailSubscriptions = exports.postWebhooksConfiguration = exports.postWebhookTest = exports.postWebhookRetry = exports.postSlackConfiguration = exports.postSlackCode = exports.postSMSConfiguration = exports.postEmailConfiguration = exports.patchSMSConfiguration = exports.patchEmailConfiguration = exports.getWebhooksConfigurations = exports.getWebhookLog = exports.getSlackScope = exports.getSlackConfiguration = exports.getSlackChannels = exports.getSMSConfiguration = exports.getEmailConfiguration = exports.getChannelMaps = exports.getCategories = exports.deleteWebhooksConfiguration = exports.deleteSlackConfiguration = exports.deleteSMSSubscriptions = exports.deleteSMSConfiguration = exports.deleteEmailSubscriptions = exports.deleteEmailConfiguration = void 0;
9
-
7
+ exports.default = exports.ConnectivityApi = void 0;
10
8
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
11
-
12
9
  var _constants = require("../constants");
13
-
14
- var _fetch = require("../fetch");
15
-
10
+ var _BaseApiClient = require("../BaseApiClient");
16
11
  const _excluded = ["eventKey"],
17
- _excluded2 = ["eventKey"];
18
-
19
- const getSlackConfiguration = () => {
20
- return (0, _fetch.Get)(`${_constants.urls.integrations.configurations.v1}/slack`);
21
- };
22
-
23
- exports.getSlackConfiguration = getSlackConfiguration;
24
-
25
- const getSlackScope = () => {
26
- return (0, _fetch.Get)(`${_constants.urls.integrations.configurations.v1}/slack/applications`);
27
- };
28
-
29
- exports.getSlackScope = getSlackScope;
30
-
31
- const getSlackChannels = () => {
32
- return (0, _fetch.Get)(`${_constants.urls.integrations.configurations.v1}/slack/channels`);
33
- };
34
-
35
- exports.getSlackChannels = getSlackChannels;
36
-
37
- const postSlackConfiguration = data => {
38
- if (data.id) {
39
- return (0, _fetch.Patch)(`${_constants.urls.integrations.configurations.v1}/slack/subscription/${data.id}`, data);
40
- }
41
-
42
- return (0, _fetch.Post)(`${_constants.urls.integrations.configurations.v1}/slack/subscriptions`, data);
43
- };
44
-
45
- exports.postSlackConfiguration = postSlackConfiguration;
46
-
47
- const deleteSlackConfiguration = data => {
48
- return (0, _fetch.Delete)(`${_constants.urls.integrations.configurations.v1}/slack/subscriptions/${data.id}`);
49
- };
50
-
51
- exports.deleteSlackConfiguration = deleteSlackConfiguration;
52
-
53
- const postSlackCode = code => {
54
- return (0, _fetch.Post)(`${_constants.urls.integrations.configurations.v1}/slack/applications/registrations`, {
55
- code
56
- });
57
- };
58
-
59
- exports.postSlackCode = postSlackCode;
60
-
61
- const getEmailConfiguration = () => {
62
- return (0, _fetch.Get)(`${_constants.urls.integrations.configurations.v1}/emails`);
63
- };
64
-
65
- exports.getEmailConfiguration = getEmailConfiguration;
66
-
67
- const postEmailConfiguration = _ref => {
68
- let {
69
- eventKey
70
- } = _ref,
71
- data = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
72
- return (0, _fetch.Post)(`${_constants.urls.integrations.configurations.v1}/emails/${eventKey}`, data);
73
- };
74
-
75
- exports.postEmailConfiguration = postEmailConfiguration;
76
-
77
- const patchEmailConfiguration = ({
78
- eventKey,
79
- enabled
80
- }) => {
81
- return (0, _fetch.Patch)(`${_constants.urls.integrations.configurations.v1}/emails/${eventKey}`, {
82
- enabled
83
- });
84
- };
85
-
86
- exports.patchEmailConfiguration = patchEmailConfiguration;
87
-
88
- const deleteEmailSubscriptions = (eventKey, subscriptionId) => {
89
- return (0, _fetch.Delete)(`${_constants.urls.integrations.configurations.v1}/emails/${eventKey}/subscriptions/${subscriptionId}`);
90
- };
91
-
92
- exports.deleteEmailSubscriptions = deleteEmailSubscriptions;
93
-
94
- const putEmailSubscriptions = (subscriptionId, eventKey, data) => {
95
- return (0, _fetch.Put)(`${_constants.urls.integrations.configurations.v1}/emails/${eventKey}/subscriptions/${subscriptionId}`, data);
96
- };
97
-
98
- exports.putEmailSubscriptions = putEmailSubscriptions;
99
-
100
- const deleteEmailConfiguration = eventKey => {
101
- return (0, _fetch.Delete)(`${_constants.urls.integrations.configurations.v1}/emails/${eventKey}`);
102
- };
103
-
104
- exports.deleteEmailConfiguration = deleteEmailConfiguration;
105
-
106
- const getSMSConfiguration = () => {
107
- return (0, _fetch.Get)(`${_constants.urls.integrations.configurations.v2}/sms`);
108
- };
109
-
110
- exports.getSMSConfiguration = getSMSConfiguration;
111
-
112
- const postSMSConfiguration = _ref2 => {
113
- let {
114
- eventKey
115
- } = _ref2,
116
- data = (0, _objectWithoutPropertiesLoose2.default)(_ref2, _excluded2);
117
- return (0, _fetch.Post)(`${_constants.urls.integrations.configurations.v2}/sms/${eventKey}`, data);
118
- };
119
-
120
- exports.postSMSConfiguration = postSMSConfiguration;
121
-
122
- const patchSMSConfiguration = ({
123
- eventKey,
124
- enabled
125
- }) => {
126
- return (0, _fetch.Patch)(`${_constants.urls.integrations.configurations.v2}/sms/${eventKey}`, {
127
- enabled
128
- });
129
- };
130
-
131
- exports.patchSMSConfiguration = patchSMSConfiguration;
132
-
133
- const deleteSMSSubscriptions = (eventKey, subscriptionId) => {
134
- return (0, _fetch.Delete)(`${_constants.urls.integrations.configurations.v2}/sms/${eventKey}/subscriptions/${subscriptionId}`);
135
- };
136
-
137
- exports.deleteSMSSubscriptions = deleteSMSSubscriptions;
138
-
139
- const putSMSSubscriptions = (subscriptionId, eventKey, data) => {
140
- return (0, _fetch.Put)(`${_constants.urls.integrations.configurations.v2}/sms/${eventKey}/subscriptions/${subscriptionId}`, data);
141
- };
142
-
143
- exports.putSMSSubscriptions = putSMSSubscriptions;
144
-
145
- const deleteSMSConfiguration = eventKey => {
146
- return (0, _fetch.Delete)(`${_constants.urls.integrations.configurations.v2}/sms/${eventKey}`);
147
- };
148
-
149
- exports.deleteSMSConfiguration = deleteSMSConfiguration;
150
-
151
- const getWebhooksConfigurations = () => {
152
- return (0, _fetch.Get)(_constants.urls.webhooks.v1);
153
- };
154
-
155
- exports.getWebhooksConfigurations = getWebhooksConfigurations;
156
-
157
- const postWebhooksConfiguration = data => {
158
- if (data._id) {
159
- return (0, _fetch.Patch)(`${_constants.urls.webhooks.v1}/${data._id}`, data);
160
- } else {
161
- return (0, _fetch.Post)(`${_constants.urls.webhooks.v1}/custom`, data);
12
+ _excluded2 = ["eventKey"];
13
+ class ConnectivityApi extends _BaseApiClient.BaseApiClient {
14
+ constructor(appName) {
15
+ super(appName);
16
+ this.getSlackConfiguration = () => {
17
+ return this.get(`${_constants.urls.integrations.configurations.v1}/slack`);
18
+ };
19
+ this.getSlackScope = () => {
20
+ return this.get(`${_constants.urls.integrations.configurations.v1}/slack/applications`);
21
+ };
22
+ this.getSlackChannels = () => {
23
+ return this.get(`${_constants.urls.integrations.configurations.v1}/slack/channels`);
24
+ };
25
+ this.postSlackConfiguration = data => {
26
+ if (data.id) {
27
+ return this.patch(`${_constants.urls.integrations.configurations.v1}/slack/subscription/${data.id}`, data);
28
+ }
29
+ return this.post(`${_constants.urls.integrations.configurations.v1}/slack/subscriptions`, data);
30
+ };
31
+ this.deleteSlackConfiguration = data => {
32
+ return this.delete(`${_constants.urls.integrations.configurations.v1}/slack/subscriptions/${data.id}`);
33
+ };
34
+ this.postSlackCode = code => {
35
+ return this.post(`${_constants.urls.integrations.configurations.v1}/slack/applications/registrations`, {
36
+ code
37
+ });
38
+ };
39
+ this.getEmailConfiguration = () => {
40
+ return this.get(`${_constants.urls.integrations.configurations.v1}/emails`);
41
+ };
42
+ this.postEmailConfiguration = _ref => {
43
+ let {
44
+ eventKey
45
+ } = _ref,
46
+ data = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
47
+ return this.post(`${_constants.urls.integrations.configurations.v1}/emails/${eventKey}`, data);
48
+ };
49
+ this.patchEmailConfiguration = ({
50
+ eventKey,
51
+ enabled
52
+ }) => {
53
+ return this.patch(`${_constants.urls.integrations.configurations.v1}/emails/${eventKey}`, {
54
+ enabled
55
+ });
56
+ };
57
+ this.deleteEmailSubscriptions = (eventKey, subscriptionId) => {
58
+ return this.delete(`${_constants.urls.integrations.configurations.v1}/emails/${eventKey}/subscriptions/${subscriptionId}`);
59
+ };
60
+ this.putEmailSubscriptions = (subscriptionId, eventKey, data) => {
61
+ return this.put(`${_constants.urls.integrations.configurations.v1}/emails/${eventKey}/subscriptions/${subscriptionId}`, data);
62
+ };
63
+ this.deleteEmailConfiguration = eventKey => {
64
+ return this.delete(`${_constants.urls.integrations.configurations.v1}/emails/${eventKey}`);
65
+ };
66
+ this.getSMSConfiguration = () => {
67
+ return this.get(`${_constants.urls.integrations.configurations.v2}/sms`);
68
+ };
69
+ this.postSMSConfiguration = _ref2 => {
70
+ let {
71
+ eventKey
72
+ } = _ref2,
73
+ data = (0, _objectWithoutPropertiesLoose2.default)(_ref2, _excluded2);
74
+ return this.post(`${_constants.urls.integrations.configurations.v2}/sms/${eventKey}`, data);
75
+ };
76
+ this.patchSMSConfiguration = ({
77
+ eventKey,
78
+ enabled
79
+ }) => {
80
+ return this.patch(`${_constants.urls.integrations.configurations.v2}/sms/${eventKey}`, {
81
+ enabled
82
+ });
83
+ };
84
+ this.deleteSMSSubscriptions = (eventKey, subscriptionId) => {
85
+ return this.delete(`${_constants.urls.integrations.configurations.v2}/sms/${eventKey}/subscriptions/${subscriptionId}`);
86
+ };
87
+ this.putSMSSubscriptions = (subscriptionId, eventKey, data) => {
88
+ return this.put(`${_constants.urls.integrations.configurations.v2}/sms/${eventKey}/subscriptions/${subscriptionId}`, data);
89
+ };
90
+ this.deleteSMSConfiguration = eventKey => {
91
+ return this.delete(`${_constants.urls.integrations.configurations.v2}/sms/${eventKey}`);
92
+ };
93
+ this.getWebhooksConfigurations = () => {
94
+ return this.get(_constants.urls.webhooks.v1);
95
+ };
96
+ this.postWebhooksConfiguration = data => {
97
+ if (data._id) {
98
+ return this.patch(`${_constants.urls.webhooks.v1}/${data._id}`, data);
99
+ } else {
100
+ return this.post(`${_constants.urls.webhooks.v1}/custom`, data);
101
+ }
102
+ };
103
+ this.deleteWebhooksConfiguration = id => {
104
+ return this.delete(`${_constants.urls.webhooks.v1}/${id}`);
105
+ };
106
+ this.getWebhookLog = (id, offset = 0, limit = 10) => {
107
+ const query = new URLSearchParams({
108
+ id,
109
+ offset: `${offset}`,
110
+ limit: `${limit}`
111
+ });
112
+ return this.get(`${_constants.urls.webhooks.v1}/logs/?${query.toString()}`);
113
+ };
114
+ this.postWebhookTest = data => {
115
+ return this.post(`${_constants.urls.webhooks.v1}/test`, data);
116
+ };
117
+ this.postWebhookRetry = id => {
118
+ return this.post(`${_constants.urls.webhooks.v1}/logs/${id}/retries`);
119
+ };
120
+ this.getCategories = () => {
121
+ return this.get(`${_constants.urls.events.configurations.v1}/categories`);
122
+ };
123
+ this.getChannelMaps = channels => {
124
+ return this.get(_constants.urls.events.configurations.v1, {
125
+ channels
126
+ });
127
+ };
162
128
  }
163
- };
164
-
165
- exports.postWebhooksConfiguration = postWebhooksConfiguration;
166
-
167
- const deleteWebhooksConfiguration = id => {
168
- return (0, _fetch.Delete)(`${_constants.urls.webhooks.v1}/${id}`);
169
- };
170
-
171
- exports.deleteWebhooksConfiguration = deleteWebhooksConfiguration;
172
-
173
- const getWebhookLog = (id, offset = 0, limit = 10) => {
174
- const query = new URLSearchParams({
175
- id,
176
- offset: `${offset}`,
177
- limit: `${limit}`
178
- });
179
- return (0, _fetch.Get)(`${_constants.urls.webhooks.v1}/logs/?${query.toString()}`);
180
- };
181
-
182
- exports.getWebhookLog = getWebhookLog;
183
-
184
- const postWebhookTest = data => {
185
- return (0, _fetch.Post)(`${_constants.urls.webhooks.v1}/test`, data);
186
- };
187
-
188
- exports.postWebhookTest = postWebhookTest;
189
-
190
- const postWebhookRetry = id => {
191
- return (0, _fetch.Post)(`${_constants.urls.webhooks.v1}/logs/${id}/retries`);
192
- };
193
-
194
- exports.postWebhookRetry = postWebhookRetry;
195
-
196
- const getCategories = () => {
197
- return (0, _fetch.Get)(`${_constants.urls.events.configurations.v1}/categories`);
198
- };
199
-
200
- exports.getCategories = getCategories;
201
-
202
- const getChannelMaps = channels => {
203
- return (0, _fetch.Get)(_constants.urls.events.configurations.v1, {
204
- channels
205
- });
206
- };
207
129
 
208
- exports.getChannelMaps = getChannelMaps;
130
+ /** Get Slack configuration */
131
+ }
132
+ exports.ConnectivityApi = ConnectivityApi;
133
+ var _default = new ConnectivityApi('default');
134
+ exports.default = _default;