@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
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.SecurityCenterApi = void 0;
7
+ var _constants = require("../constants");
8
+ var _BaseApiClient = require("../BaseApiClient");
9
+ class SecurityCenterApi extends _BaseApiClient.BaseApiClient {
10
+ constructor(appName) {
11
+ super(appName);
12
+ this.getRecommendations = async () => {
13
+ return this.get(_constants.urls.securityCenter.recommendations.v1);
14
+ };
15
+ this.getInsights = async () => {
16
+ return this.get(_constants.urls.securityCenter.insights.v1);
17
+ };
18
+ }
19
+
20
+ /**
21
+ * Get security center recommendations.
22
+ */
23
+ }
24
+ exports.SecurityCenterApi = SecurityCenterApi;
25
+ var _default = new SecurityCenterApi('default');
26
+ exports.default = _default;
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SecurityCategory = exports.RecommendationSeverity = exports.RecommendationCode = exports.RecommendationActionKey = exports.InsightCode = void 0;
7
+ let RecommendationCode;
8
+ exports.RecommendationCode = RecommendationCode;
9
+ (function (RecommendationCode) {
10
+ RecommendationCode["FORCE_MFA"] = "FORCE_MFA";
11
+ RecommendationCode["BREACHED_PASSWORDS_EXIST"] = "BREACHED_PASSWORDS_EXIST";
12
+ RecommendationCode["ENABLE_USER_LOCKOUT"] = "ENABLE_USER_LOCKOUT";
13
+ RecommendationCode["STRENGTHEN_USER_LOCKOUT"] = "STRENGTHEN_USER_LOCKOUT";
14
+ RecommendationCode["ENABLE_PASSWORD_HISTORY"] = "ENABLE_PASSWORD_HISTORY";
15
+ RecommendationCode["STRENGTHEN_PASSWORD_HISTORY"] = "STRENGTHEN_PASSWORD_HISTORY";
16
+ RecommendationCode["ENABLE_FORCE_RELOGIN"] = "ENABLE_FORCE_RELOGIN";
17
+ RecommendationCode["SET_FORCE_RELOGIN"] = "SET_FORCE_RELOGIN";
18
+ RecommendationCode["ENABLE_SESSION_CONCURRENCY"] = "ENABLE_SESSION_CONCURRENCY";
19
+ RecommendationCode["SET_SESSION_CONCURRENCY"] = "SET_SESSION_CONCURRENCY";
20
+ RecommendationCode["ENABLE_IDLE_SESSION"] = "ENABLE_IDLE_SESSION";
21
+ RecommendationCode["SET_IDLE_SESSION"] = "SET_IDLE_SESSION";
22
+ RecommendationCode["ENABLE_IP_RESTRICTIONS"] = "ENABLE_IP_RESTRICTIONS";
23
+ RecommendationCode["CHANGE_IP_TO_ALLOWLIST"] = "CHANGE_IP_TO_ALLOWLIST";
24
+ RecommendationCode["ENABLE_DOMAIN_RESTRICTIONS"] = "ENABLE_DOMAIN_RESTRICTIONS";
25
+ RecommendationCode["CHANGE_DOMAIN_TO_ALLOWLIST"] = "CHANGE_DOMAIN_TO_ALLOWLIST";
26
+ RecommendationCode["CONFIGURE_SSO"] = "CONFIGURE_SSO";
27
+ })(RecommendationCode || (exports.RecommendationCode = RecommendationCode = {}));
28
+ let InsightCode;
29
+ exports.InsightCode = InsightCode;
30
+ (function (InsightCode) {
31
+ InsightCode["MFA_FORCED"] = "MFA_FORCED";
32
+ InsightCode["PARTIALLY_FORCED_MFA"] = "PARTIALLY_FORCED_MFA";
33
+ InsightCode["PARTIAL_MFA_USAGE"] = "PARTIAL_MFA_USAGE";
34
+ InsightCode["FULL_MFA_USAGE"] = "FULL_MFA_USAGE";
35
+ InsightCode["BREACHED_PASSWORD_USERS_EXIST"] = "BREACHED_PASSWORD_USERS_EXIST";
36
+ InsightCode["IMPROVE_LOCKOUT_POLICY"] = "IMPROVE_LOCKOUT_POLICY";
37
+ InsightCode["IMPROVE_PASSWORD_HISTORY_POLICY"] = "IMPROVE_PASSWORD_HISTORY_POLICY";
38
+ InsightCode["NO_SESSION_SETTINGS"] = "NO_SESSION_SETTINGS";
39
+ InsightCode["PARTIAL_SESSION_SETTINGS"] = "PARTIAL_SESSION_SETTINGS";
40
+ InsightCode["FULL_SESSION_SETTINGS"] = "FULL_SESSION_SETTINGS";
41
+ InsightCode["NO_IP_RESTRICTIONS"] = "NO_IP_RESTRICTIONS";
42
+ InsightCode["IP_ALLOWLIST"] = "IP_ALLOWLIST";
43
+ InsightCode["IP_DENYLIST"] = "IP_DENYLIST";
44
+ InsightCode["NO_DOMAIN_RESTRICTIONS"] = "NO_DOMAIN_RESTRICTIONS";
45
+ InsightCode["DOMAIN_ALLOWLIST"] = "DOMAIN_ALLOWLIST";
46
+ InsightCode["DOMAIN_DENYLIST"] = "DOMAIN_DENYLIST";
47
+ InsightCode["FULL_PASSWORD_SETTINGS"] = "FULL_PASSWORD_SETTINGS";
48
+ })(InsightCode || (exports.InsightCode = InsightCode = {}));
49
+ let RecommendationActionKey;
50
+ exports.RecommendationActionKey = RecommendationActionKey;
51
+ (function (RecommendationActionKey) {
52
+ RecommendationActionKey["SEND_RESET_BREACHED_PASSWORD_EMAIL"] = "SEND_RESET_BREACHED_PASSWORD_EMAIL";
53
+ RecommendationActionKey["ADJUST_FORCE_RELOGIN"] = "ADJUST_FORCE_RELOGIN";
54
+ RecommendationActionKey["ADJUST_MAX_CONCURRENT_SESSIONS"] = "ADJUST_MAX_CONCURRENT_SESSIONS";
55
+ RecommendationActionKey["ADJUST_IDLE_TIMEOUT"] = "ADJUST_IDLE_TIMEOUT";
56
+ })(RecommendationActionKey || (exports.RecommendationActionKey = RecommendationActionKey = {}));
57
+ let RecommendationSeverity;
58
+ exports.RecommendationSeverity = RecommendationSeverity;
59
+ (function (RecommendationSeverity) {
60
+ RecommendationSeverity["SEVERE"] = "SEVERE";
61
+ RecommendationSeverity["WARNING"] = "WARNING";
62
+ RecommendationSeverity["INFO"] = "INFO";
63
+ })(RecommendationSeverity || (exports.RecommendationSeverity = RecommendationSeverity = {}));
64
+ let SecurityCategory;
65
+ exports.SecurityCategory = SecurityCategory;
66
+ (function (SecurityCategory) {
67
+ SecurityCategory["MFA"] = "MFA";
68
+ SecurityCategory["SESSIONS"] = "SESSIONS";
69
+ SecurityCategory["PASSWORD"] = "PASSWORD";
70
+ SecurityCategory["INACTIVITY"] = "INACTIVITY";
71
+ SecurityCategory["IP"] = "IP";
72
+ SecurityCategory["DOMAIN"] = "DOMAIN";
73
+ SecurityCategory["SSO"] = "SSO";
74
+ })(SecurityCategory || (exports.SecurityCategory = SecurityCategory = {}));
@@ -3,37 +3,90 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.addUserRolesForSubTenants = addUserRolesForSubTenants;
7
- exports.addUserToTenantAndSubTenants = addUserToTenantAndSubTenants;
8
- exports.loadAllUsers = loadAllUsers;
9
- exports.removeUserFromTenantAndSubTenants = removeUserFromTenantAndSubTenants;
10
- exports.removeUserRolesFromSubTenants = removeUserRolesFromSubTenants;
11
- exports.setUserRolesForSubTenants = setUserRolesForSubTenants;
12
-
13
- var _fetch = require("../fetch");
14
-
6
+ exports.default = exports.SubTenantsApi = void 0;
15
7
  var _constants = require("../constants");
8
+ var _BaseApiClient = require("../BaseApiClient");
9
+ class SubTenantsApi extends _BaseApiClient.BaseApiClient {
10
+ constructor(appName) {
11
+ super(appName);
12
+ this.loadAllUsers = async params => {
13
+ return this.get(_constants.urls.identity.subTenants.v1, params);
14
+ };
15
+ this.addUserToTenantAndSubTenants = async body => {
16
+ return this.post(_constants.urls.identity.subTenants.v1, body);
17
+ };
18
+ this.removeUserFromTenantAndSubTenants = async (body, options) => {
19
+ return this.delete(_constants.urls.identity.subTenants.v1, body, {
20
+ headers: this.extractHeadersFromOptions(options)
21
+ });
22
+ };
23
+ this.addUserRolesForSubTenants = async (userId, body, options) => {
24
+ return this.post(`${_constants.urls.identity.subTenants.v1}/${userId}/roles`, body, {
25
+ headers: this.extractHeadersFromOptions(options)
26
+ });
27
+ };
28
+ this.removeUserRolesFromSubTenants = async (userId, body, options) => {
29
+ return this.delete(`${_constants.urls.identity.subTenants.v1}/${userId}/roles`, body, {
30
+ headers: this.extractHeadersFromOptions(options)
31
+ });
32
+ };
33
+ this.setUserRolesForSubTenants = async (userId, body, options) => {
34
+ return this.patch(`${_constants.urls.identity.subTenants.v1}/${userId}/roles`, body, {
35
+ headers: this.extractHeadersFromOptions(options)
36
+ });
37
+ };
38
+ this.createSubTenant = async (body, options) => {
39
+ return this.post(_constants.urls.tenants.subTenants.v1, body, {
40
+ headers: this.extractHeadersFromOptions(options)
41
+ });
42
+ };
43
+ this.deleteSubTenant = async (tenantId, options) => {
44
+ return this.delete(`${_constants.urls.tenants.subTenants.v1}/${tenantId}`, undefined, {
45
+ headers: this.extractHeadersFromOptions(options)
46
+ });
47
+ };
48
+ this.updateSubTenant = async ({
49
+ tenantId
50
+ }, body, options) => {
51
+ return this.patch(`${_constants.urls.tenants.subTenants.v1}/${tenantId}`, body, {
52
+ headers: this.extractHeadersFromOptions(options)
53
+ });
54
+ };
55
+ this.updateSubTenantManagement = async ({
56
+ tenantId
57
+ }, body, options) => {
58
+ return this.put(`${_constants.urls.tenants.subTenants.v1}/${tenantId}/management`, body, {
59
+ headers: this.extractHeadersFromOptions(options)
60
+ });
61
+ };
62
+ this.updateSubAccountAccess = async (userId, body, options) => {
63
+ return this.put(`${_constants.urls.identity.subTenants.v1}/${userId}/access`, body, {
64
+ headers: this.extractHeadersFromOptions(options)
65
+ });
66
+ };
67
+ this.addUsersToSubTenant = async (body, options) => {
68
+ return this.post(`${_constants.urls.identity.subTenants.v2}/`, body, {
69
+ headers: this.extractHeadersFromOptions(options)
70
+ });
71
+ };
72
+ }
16
73
 
17
- async function loadAllUsers(params) {
18
- return (0, _fetch.Get)(_constants.urls.identity.subTenants.v1, params);
19
- }
74
+ /**
75
+ * Loads all users based on given parameters.
76
+ */
20
77
 
21
- async function addUserToTenantAndSubTenants(body) {
22
- return (0, _fetch.Post)(_constants.urls.identity.subTenants.v1, body);
23
- }
78
+ updateSubTenantHierarchySettings({
79
+ tenantId
80
+ }, body, options) {
81
+ return this.put(`${_constants.urls.tenants.subTenants.v1}/${tenantId}/hierarchy-settings`, body, {
82
+ headers: this.extractHeadersFromOptions(options)
83
+ });
84
+ }
24
85
 
25
- async function removeUserFromTenantAndSubTenants(body) {
26
- return (0, _fetch.Delete)(_constants.urls.identity.subTenants.v1, body);
86
+ /**
87
+ * Updates sub-account access.
88
+ */
27
89
  }
28
-
29
- async function addUserRolesForSubTenants(userId, body) {
30
- return (0, _fetch.Post)(`${_constants.urls.identity.subTenants.v1}/${userId}/roles`, body);
31
- }
32
-
33
- async function removeUserRolesFromSubTenants(userId, body) {
34
- return (0, _fetch.Delete)(`${_constants.urls.identity.subTenants.v1}/${userId}/roles`, body);
35
- }
36
-
37
- async function setUserRolesForSubTenants(userId, body) {
38
- return (0, _fetch.Patch)(`${_constants.urls.identity.subTenants.v1}/${userId}/roles`, body);
39
- }
90
+ exports.SubTenantsApi = SubTenantsApi;
91
+ var _default = new SubTenantsApi('default');
92
+ exports.default = _default;
@@ -2,4 +2,12 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
- });
5
+ });
6
+ exports.SubAccountAccessTypeEnum = void 0;
7
+ let SubAccountAccessTypeEnum;
8
+ exports.SubAccountAccessTypeEnum = SubAccountAccessTypeEnum;
9
+ (function (SubAccountAccessTypeEnum) {
10
+ SubAccountAccessTypeEnum["DEFAULT_OFF"] = "defaultOff";
11
+ SubAccountAccessTypeEnum["DEFAULT_ON"] = "defaultOn";
12
+ SubAccountAccessTypeEnum["ALWAYS_ON"] = "alwaysOn";
13
+ })(SubAccountAccessTypeEnum || (exports.SubAccountAccessTypeEnum = SubAccountAccessTypeEnum = {}));
@@ -3,10 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.ProviderType = exports.PaymentMethodType = exports.ISubscriptionStatus = exports.ISubscriptionCancellationPolicy = void 0;
6
+ exports.TrialEndAction = exports.TenantCreatedAction = exports.ProviderType = exports.PaymentMethodType = exports.ISubscriptionStatus = exports.ISubscriptionCancellationPolicy = void 0;
7
7
  let ISubscriptionStatus;
8
8
  exports.ISubscriptionStatus = ISubscriptionStatus;
9
-
10
9
  (function (ISubscriptionStatus) {
11
10
  ISubscriptionStatus["ACTIVE"] = "active";
12
11
  ISubscriptionStatus["CANCELED"] = "canceled";
@@ -15,25 +14,30 @@ exports.ISubscriptionStatus = ISubscriptionStatus;
15
14
  ISubscriptionStatus["TRIALING"] = "trialing";
16
15
  ISubscriptionStatus["TRIAL_ENDED"] = "trialEnded";
17
16
  })(ISubscriptionStatus || (exports.ISubscriptionStatus = ISubscriptionStatus = {}));
18
-
19
17
  let PaymentMethodType;
20
18
  exports.PaymentMethodType = PaymentMethodType;
21
-
22
19
  (function (PaymentMethodType) {
23
20
  PaymentMethodType["UNKNWON"] = "unknown";
24
21
  PaymentMethodType["CARD"] = "card";
25
22
  })(PaymentMethodType || (exports.PaymentMethodType = PaymentMethodType = {}));
26
-
27
23
  let ISubscriptionCancellationPolicy;
28
24
  exports.ISubscriptionCancellationPolicy = ISubscriptionCancellationPolicy;
29
-
30
25
  (function (ISubscriptionCancellationPolicy) {
31
26
  ISubscriptionCancellationPolicy["AT_PERIOD_END"] = "atPeriodEnd";
32
27
  })(ISubscriptionCancellationPolicy || (exports.ISubscriptionCancellationPolicy = ISubscriptionCancellationPolicy = {}));
33
-
34
28
  let ProviderType;
35
29
  exports.ProviderType = ProviderType;
36
-
37
30
  (function (ProviderType) {
38
31
  ProviderType["Stripe"] = "Stripe";
39
- })(ProviderType || (exports.ProviderType = ProviderType = {}));
32
+ })(ProviderType || (exports.ProviderType = ProviderType = {}));
33
+ let TrialEndAction;
34
+ exports.TrialEndAction = TrialEndAction;
35
+ (function (TrialEndAction) {
36
+ TrialEndAction["CHANGE_TO_DEFAULT"] = "change_to_default";
37
+ TrialEndAction["RETAIN_TRIAL"] = "retain_trial";
38
+ })(TrialEndAction || (exports.TrialEndAction = TrialEndAction = {}));
39
+ let TenantCreatedAction;
40
+ exports.TenantCreatedAction = TenantCreatedAction;
41
+ (function (TenantCreatedAction) {
42
+ TenantCreatedAction["CREATE"] = "create_customer";
43
+ })(TenantCreatedAction || (exports.TenantCreatedAction = TenantCreatedAction = {}));
@@ -3,128 +3,37 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
7
- var _subscriptions = require("./subscriptions");
8
-
9
- Object.keys(_subscriptions).forEach(function (key) {
10
- if (key === "default" || key === "__esModule") return;
11
- if (key in exports && exports[key] === _subscriptions[key]) return;
12
- Object.defineProperty(exports, key, {
13
- enumerable: true,
14
- get: function () {
15
- return _subscriptions[key];
16
- }
17
- });
18
- });
19
-
20
- var _managedSubscriptions = require("./managedSubscriptions");
21
-
22
- Object.keys(_managedSubscriptions).forEach(function (key) {
23
- if (key === "default" || key === "__esModule") return;
24
- if (key in exports && exports[key] === _managedSubscriptions[key]) return;
25
- Object.defineProperty(exports, key, {
26
- enumerable: true,
27
- get: function () {
28
- return _managedSubscriptions[key];
29
- }
30
- });
31
- });
32
-
33
- var _plans = require("./plans");
34
-
35
- Object.keys(_plans).forEach(function (key) {
36
- if (key === "default" || key === "__esModule") return;
37
- if (key in exports && exports[key] === _plans[key]) return;
38
- Object.defineProperty(exports, key, {
39
- enumerable: true,
40
- get: function () {
41
- return _plans[key];
42
- }
43
- });
44
- });
45
-
6
+ var _exportNames = {
7
+ SubscriptionsApi: true
8
+ };
9
+ exports.default = exports.SubscriptionsApi = void 0;
10
+ var _BaseApiClient = require("../BaseApiClient");
46
11
  var _invoices = require("./invoices");
47
-
48
- Object.keys(_invoices).forEach(function (key) {
49
- if (key === "default" || key === "__esModule") return;
50
- if (key in exports && exports[key] === _invoices[key]) return;
51
- Object.defineProperty(exports, key, {
52
- enumerable: true,
53
- get: function () {
54
- return _invoices[key];
55
- }
56
- });
57
- });
58
-
12
+ var _managedSubscriptions = require("./managedSubscriptions");
59
13
  var _paymentMethods = require("./paymentMethods");
60
-
61
- Object.keys(_paymentMethods).forEach(function (key) {
62
- if (key === "default" || key === "__esModule") return;
63
- if (key in exports && exports[key] === _paymentMethods[key]) return;
64
- Object.defineProperty(exports, key, {
65
- enumerable: true,
66
- get: function () {
67
- return _paymentMethods[key];
68
- }
69
- });
70
- });
71
-
72
- var _providers = require("./providers");
73
-
74
- Object.keys(_providers).forEach(function (key) {
75
- if (key === "default" || key === "__esModule") return;
76
- if (key in exports && exports[key] === _providers[key]) return;
77
- Object.defineProperty(exports, key, {
78
- enumerable: true,
79
- get: function () {
80
- return _providers[key];
81
- }
82
- });
83
- });
84
-
14
+ var _paymentProviders = require("./paymentProviders");
15
+ var _plans = require("./plans");
16
+ var _subscriptions = require("./subscriptions");
85
17
  var _summaries = require("./summaries");
86
-
87
- Object.keys(_summaries).forEach(function (key) {
88
- if (key === "default" || key === "__esModule") return;
89
- if (key in exports && exports[key] === _summaries[key]) return;
90
- Object.defineProperty(exports, key, {
91
- enumerable: true,
92
- get: function () {
93
- return _summaries[key];
94
- }
95
- });
96
- });
97
-
98
18
  var _tenantConfiguration = require("./tenantConfiguration");
99
-
100
- Object.keys(_tenantConfiguration).forEach(function (key) {
19
+ var _vendorPublicConfigurations = require("./vendorPublicConfigurations");
20
+ var _stripe = require("./providers/stripe");
21
+ var _interfaces = require("./interfaces");
22
+ Object.keys(_interfaces).forEach(function (key) {
101
23
  if (key === "default" || key === "__esModule") return;
102
- if (key in exports && exports[key] === _tenantConfiguration[key]) return;
24
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
25
+ if (key in exports && exports[key] === _interfaces[key]) return;
103
26
  Object.defineProperty(exports, key, {
104
27
  enumerable: true,
105
28
  get: function () {
106
- return _tenantConfiguration[key];
29
+ return _interfaces[key];
107
30
  }
108
31
  });
109
32
  });
110
-
111
- var _paymentProviders = require("./paymentProviders");
112
-
113
- Object.keys(_paymentProviders).forEach(function (key) {
114
- if (key === "default" || key === "__esModule") return;
115
- if (key in exports && exports[key] === _paymentProviders[key]) return;
116
- Object.defineProperty(exports, key, {
117
- enumerable: true,
118
- get: function () {
119
- return _paymentProviders[key];
120
- }
121
- });
122
- });
123
-
124
33
  var _enums = require("./enums");
125
-
126
34
  Object.keys(_enums).forEach(function (key) {
127
35
  if (key === "default" || key === "__esModule") return;
36
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
128
37
  if (key in exports && exports[key] === _enums[key]) return;
129
38
  Object.defineProperty(exports, key, {
130
39
  enumerable: true,
@@ -132,4 +41,50 @@ Object.keys(_enums).forEach(function (key) {
132
41
  return _enums[key];
133
42
  }
134
43
  });
135
- });
44
+ });
45
+ class SubscriptionsApi extends _BaseApiClient.BaseApiClient {
46
+ constructor(appName) {
47
+ super(appName);
48
+ this.invoicesApi = new _invoices.InvoicesApi(this.appName);
49
+ this.managedSubscriptionApi = new _managedSubscriptions.ManagedSubscriptionApi(this.appName);
50
+ this.paymentMethodsApi = new _paymentMethods.PaymentMethodsApi(this.appName);
51
+ this.paymentProvidersApi = new _paymentProviders.PaymentProvidersApi(this.appName);
52
+ this.plansApi = new _plans.PlansApi(this.appName);
53
+ this.subscriptionApi = new _subscriptions.SubscriptionApi(this.appName);
54
+ this.summariesApi = new _summaries.SummariesApi(this.appName);
55
+ this.subscriptionTenantConfigApi = new _tenantConfiguration.SubscriptionTenantConfigApi(this.appName);
56
+ this.vendorPublicConfigApi = new _vendorPublicConfigurations.VendorPublicConfigApi(this.appName);
57
+ this.stripeProviderApi = new _stripe.StripeProviderApi(this.appName);
58
+ this.getSubscriptionInvoices = this.invoicesApi.getSubscriptionInvoices.bind(this.invoicesApi);
59
+ this.getSubscriptionInvoice = this.invoicesApi.getSubscriptionInvoice.bind(this.invoicesApi);
60
+ this.getSubscriptionInvoicePdf = this.invoicesApi.getSubscriptionInvoicePdf.bind(this.invoicesApi);
61
+ this.getManagedSubscription = this.managedSubscriptionApi.getManagedSubscription.bind(this.managedSubscriptionApi);
62
+ this.getManagedSubscriptions = this.managedSubscriptionApi.getManagedSubscriptions.bind(this.managedSubscriptionApi);
63
+ this.cancelManagedSubscription = this.managedSubscriptionApi.cancelManagedSubscription.bind(this.managedSubscriptionApi);
64
+ this.renewManagedSubscription = this.managedSubscriptionApi.renewManagedSubscription.bind(this.managedSubscriptionApi);
65
+ this.updateManagedSubscription = this.managedSubscriptionApi.updateManagedSubscription.bind(this.managedSubscriptionApi);
66
+ this.getPaymentMethods = this.paymentMethodsApi.getPaymentMethods.bind(this.paymentMethodsApi);
67
+ this.getPaymentMethod = this.paymentMethodsApi.getPaymentMethod.bind(this.paymentMethodsApi);
68
+ this.updatePaymentMethodBillingDetails = this.paymentMethodsApi.updatePaymentMethodBillingDetails.bind(this.paymentMethodsApi);
69
+ this.getPaymentProviders = this.paymentProvidersApi.getPaymentProviders.bind(this.paymentProvidersApi);
70
+ this.getSubscriptionPlans = this.plansApi.getSubscriptionPlans.bind(this.plansApi);
71
+ this.getSubscriptionPlan = this.plansApi.getSubscriptionPlan.bind(this.plansApi);
72
+ this.getSubscriptions = this.subscriptionApi.getSubscriptions.bind(this.subscriptionApi);
73
+ this.getSubscription = this.subscriptionApi.getSubscription.bind(this.subscriptionApi);
74
+ this.cancelSubscription = this.subscriptionApi.cancelSubscription.bind(this.subscriptionApi);
75
+ this.renewSubscription = this.subscriptionApi.renewSubscription.bind(this.subscriptionApi);
76
+ this.updateSubscription = this.subscriptionApi.updateSubscription.bind(this.subscriptionApi);
77
+ this.getSubscriptionSummaries = this.summariesApi.getSubscriptionSummaries.bind(this.summariesApi);
78
+ this.getTenantConfiguration = this.subscriptionTenantConfigApi.getTenantConfiguration.bind(this.subscriptionTenantConfigApi);
79
+ this.createTenantConfiguration = this.subscriptionTenantConfigApi.createTenantConfiguration.bind(this.subscriptionTenantConfigApi);
80
+ this.getVendorPublicConfigurations = this.vendorPublicConfigApi.getVendorPublicConfigurations.bind(this.vendorPublicConfigApi);
81
+ this.createSubscription = this.stripeProviderApi.createSubscription.bind(this.stripeProviderApi);
82
+ this.getStripeCustomer = this.stripeProviderApi.getStripeCustomer.bind(this.stripeProviderApi);
83
+ this.createStripeCustomer = this.stripeProviderApi.createStripeCustomer.bind(this.stripeProviderApi);
84
+ this.getStripePaymentProviderConfiguration = this.stripeProviderApi.getStripePaymentProviderConfiguration.bind(this.stripeProviderApi);
85
+ this.createStripePaymentMethodSetupIntentSecret = this.stripeProviderApi.createStripePaymentMethodSetupIntentSecret.bind(this.stripeProviderApi);
86
+ }
87
+ }
88
+ exports.SubscriptionsApi = SubscriptionsApi;
89
+ var _default = new SubscriptionsApi('default');
90
+ exports.default = _default;
@@ -3,9 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
7
6
  var _interfaces = require("./providers/stripe/interfaces");
8
-
9
7
  Object.keys(_interfaces).forEach(function (key) {
10
8
  if (key === "default" || key === "__esModule") return;
11
9
  if (key in exports && exports[key] === _interfaces[key]) return;
@@ -3,26 +3,25 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getSubscriptionInvoice = getSubscriptionInvoice;
7
- exports.getSubscriptionInvoicePdf = getSubscriptionInvoicePdf;
8
- exports.getSubscriptionInvoices = getSubscriptionInvoices;
9
-
10
- var _fetch = require("../fetch");
11
-
6
+ exports.InvoicesApi = void 0;
12
7
  var _constants = require("../constants");
13
-
14
- async function getSubscriptionInvoices() {
15
- return (0, _fetch.Get)(_constants.urls.subscriptions.billing.invoices.v1);
8
+ var _BaseApiClient = require("../BaseApiClient");
9
+ class InvoicesApi extends _BaseApiClient.BaseApiClient {
10
+ constructor(...args) {
11
+ super(...args);
12
+ this.getSubscriptionInvoices = async () => {
13
+ return this.get(_constants.urls.subscriptions.billing.invoices.v1);
14
+ };
15
+ this.getSubscriptionInvoice = async invoiceId => {
16
+ return this.get(`${_constants.urls.subscriptions.billing.invoices.v1}/${invoiceId}`);
17
+ };
18
+ this.getSubscriptionInvoicePdf = async (invoiceId, outputFileName) => {
19
+ return this.get(`${_constants.urls.subscriptions.billing.invoices.v1}/${invoiceId}/pdf`, {
20
+ outputFileName
21
+ }, {
22
+ responseType: 'blob'
23
+ });
24
+ };
25
+ }
16
26
  }
17
-
18
- async function getSubscriptionInvoice(invoiceId) {
19
- return (0, _fetch.Get)(`${_constants.urls.subscriptions.billing.invoices.v1}/${invoiceId}`);
20
- }
21
-
22
- async function getSubscriptionInvoicePdf(invoiceId, outputFileName) {
23
- return (0, _fetch.Get)(`${_constants.urls.subscriptions.billing.invoices.v1}/${invoiceId}/pdf`, {
24
- outputFileName
25
- }, {
26
- responseType: "blob"
27
- });
28
- }
27
+ exports.InvoicesApi = InvoicesApi;
@@ -3,38 +3,33 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.cancelManagedSubscription = cancelManagedSubscription;
7
- exports.getManagedSubscription = getManagedSubscription;
8
- exports.getManagedSubscriptions = getManagedSubscriptions;
9
- exports.renewManagedSubscription = renewManagedSubscription;
10
- exports.updateManagedSubscription = updateManagedSubscription;
11
-
12
- var _fetch = require("../fetch");
13
-
6
+ exports.ManagedSubscriptionApi = void 0;
14
7
  var _constants = require("../constants");
15
-
16
- async function getManagedSubscription(subscriptionId) {
17
- return (0, _fetch.Get)(`${_constants.urls.subscriptions.managedSubscriptions.v1}/${subscriptionId}`);
18
- }
19
-
20
- async function getManagedSubscriptions() {
21
- return (0, _fetch.Get)(`${_constants.urls.subscriptions.managedSubscriptions.v1}`);
8
+ var _BaseApiClient = require("../BaseApiClient");
9
+ class ManagedSubscriptionApi extends _BaseApiClient.BaseApiClient {
10
+ constructor(...args) {
11
+ super(...args);
12
+ this.getManagedSubscription = async subscriptionId => {
13
+ return this.get(`${_constants.urls.subscriptions.managedSubscriptions.v1}/${subscriptionId}`);
14
+ };
15
+ this.getManagedSubscriptions = async () => {
16
+ return this.get(_constants.urls.subscriptions.managedSubscriptions.v1);
17
+ };
18
+ this.cancelManagedSubscription = async subscriptionId => {
19
+ return this.put(`${_constants.urls.subscriptions.managedSubscriptions.v1}/${subscriptionId}/cancellations/`, {});
20
+ };
21
+ this.renewManagedSubscription = async subscriptionId => {
22
+ return this.put(`${_constants.urls.subscriptions.managedSubscriptions.v1}/${subscriptionId}/renewals/`, {});
23
+ };
24
+ this.updateManagedSubscription = async (subscriptionId, {
25
+ paymentMethodId,
26
+ planId
27
+ }) => {
28
+ return this.put(`${_constants.urls.subscriptions.managedSubscriptions.v1}/${subscriptionId}`, {
29
+ paymentMethodId,
30
+ planId
31
+ });
32
+ };
33
+ }
22
34
  }
23
-
24
- async function cancelManagedSubscription(subscriptionId) {
25
- return (0, _fetch.Put)(`${_constants.urls.subscriptions.managedSubscriptions.v1}/${subscriptionId}/cancellations/`, {});
26
- }
27
-
28
- async function renewManagedSubscription(subscriptionId) {
29
- return (0, _fetch.Put)(`${_constants.urls.subscriptions.managedSubscriptions.v1}/${subscriptionId}/renewals/`, {});
30
- }
31
-
32
- async function updateManagedSubscription(subscriptionId, {
33
- paymentMethodId,
34
- planId
35
- }) {
36
- return (0, _fetch.Put)(`${_constants.urls.subscriptions.managedSubscriptions.v1}/${subscriptionId}`, {
37
- paymentMethodId,
38
- planId
39
- });
40
- }
35
+ exports.ManagedSubscriptionApi = ManagedSubscriptionApi;
@@ -1,37 +1,33 @@
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.getPaymentMethod = getPaymentMethod;
9
- exports.getPaymentMethods = getPaymentMethods;
10
- exports.updatePaymentMethodBillingDetails = updatePaymentMethodBillingDetails;
11
-
7
+ exports.PaymentMethodsApi = void 0;
12
8
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
13
-
14
- var _fetch = require("../fetch");
15
-
16
9
  var _constants = require("../constants");
17
-
10
+ var _BaseApiClient = require("../BaseApiClient");
18
11
  const _excluded = ["email"];
19
-
20
- async function getPaymentMethods() {
21
- return (0, _fetch.Get)(_constants.urls.subscriptions.billing.paymentMethods.v1);
22
- }
23
-
24
- async function getPaymentMethod(paymentMethodId) {
25
- return (0, _fetch.Get)(`${_constants.urls.subscriptions.billing.paymentMethods.v1}/${paymentMethodId}`);
12
+ class PaymentMethodsApi extends _BaseApiClient.BaseApiClient {
13
+ constructor(...args) {
14
+ super(...args);
15
+ this.getPaymentMethods = async () => {
16
+ return this.get(_constants.urls.subscriptions.billing.paymentMethods.v1);
17
+ };
18
+ this.getPaymentMethod = async paymentMethodId => {
19
+ return this.get(`${_constants.urls.subscriptions.billing.paymentMethods.v1}/${paymentMethodId}`);
20
+ };
21
+ this.updatePaymentMethodBillingDetails = async (paymentMethodId, _ref) => {
22
+ let {
23
+ email
24
+ } = _ref,
25
+ address = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
26
+ return this.patch(`${_constants.urls.subscriptions.billing.paymentMethods.v1}/${paymentMethodId}/billing-details`, {
27
+ email,
28
+ address
29
+ });
30
+ };
31
+ }
26
32
  }
27
-
28
- async function updatePaymentMethodBillingDetails(paymentMethodId, _ref) {
29
- let {
30
- email
31
- } = _ref,
32
- address = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
33
- return (0, _fetch.Patch)(`${_constants.urls.subscriptions.billing.paymentMethods.v1}/${paymentMethodId}/billing-details`, {
34
- email,
35
- address
36
- });
37
- }
33
+ exports.PaymentMethodsApi = PaymentMethodsApi;