@frontegg/rest-api 3.0.1 → 3.0.2

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 (68) hide show
  1. package/ContextHolder.js +64 -100
  2. package/account-settings/index.js +4 -43
  3. package/audits/index.js +16 -69
  4. package/auth/enums.js +2 -2
  5. package/auth/index.js +352 -2045
  6. package/auth/interfaces.js +1 -1
  7. package/auth/secutiry-poilicy/index.js +45 -254
  8. package/connectivity/index.js +79 -73
  9. package/constants.js +1 -1
  10. package/error.js +9 -33
  11. package/fetch.js +159 -519
  12. package/index.js +26 -26
  13. package/jwt.js +19 -45
  14. package/metadata/index.js +18 -160
  15. package/node/ContextHolder.js +68 -104
  16. package/node/account-settings/index.js +4 -46
  17. package/node/audits/index.js +15 -68
  18. package/node/auth/enums.js +2 -2
  19. package/node/auth/index.js +481 -2099
  20. package/node/auth/interfaces.js +2 -2
  21. package/node/auth/secutiry-poilicy/index.js +36 -240
  22. package/node/connectivity/index.js +78 -71
  23. package/node/constants.js +1 -1
  24. package/node/error.js +9 -38
  25. package/node/fetch.js +166 -521
  26. package/node/index.js +47 -49
  27. package/node/jwt.js +19 -51
  28. package/node/metadata/index.js +19 -163
  29. package/node/notifications/index.js +18 -94
  30. package/node/reports/index.js +62 -171
  31. package/node/roles/index.js +34 -172
  32. package/node/routers.js +2 -2
  33. package/node/sub-tenants/index.js +12 -126
  34. package/node/subscriptions/enums.js +4 -4
  35. package/node/subscriptions/index.js +10 -10
  36. package/node/subscriptions/interfaces.js +1 -1
  37. package/node/subscriptions/invoices.js +10 -70
  38. package/node/subscriptions/managedSubscriptions.js +16 -111
  39. package/node/subscriptions/paymentMethods.js +15 -69
  40. package/node/subscriptions/paymentProviders.js +2 -26
  41. package/node/subscriptions/plans.js +4 -46
  42. package/node/subscriptions/providers/index.js +1 -1
  43. package/node/subscriptions/providers/stripe/index.js +10 -106
  44. package/node/subscriptions/subscriptions.js +16 -111
  45. package/node/subscriptions/summaries.js +2 -26
  46. package/node/subscriptions/tenantConfiguration.js +4 -46
  47. package/node/teams/index.js +57 -406
  48. package/node/tenants/index.js +8 -86
  49. package/node/vendor/index.js +2 -26
  50. package/notifications/index.js +18 -93
  51. package/package.json +1 -1
  52. package/reports/index.js +65 -175
  53. package/roles/index.js +34 -175
  54. package/routers.js +2 -2
  55. package/sub-tenants/index.js +12 -127
  56. package/subscriptions/enums.js +4 -4
  57. package/subscriptions/invoices.js +12 -70
  58. package/subscriptions/managedSubscriptions.js +20 -115
  59. package/subscriptions/paymentMethods.js +16 -70
  60. package/subscriptions/paymentProviders.js +2 -22
  61. package/subscriptions/plans.js +4 -43
  62. package/subscriptions/providers/stripe/index.js +10 -106
  63. package/subscriptions/subscriptions.js +20 -115
  64. package/subscriptions/summaries.js +2 -22
  65. package/subscriptions/tenantConfiguration.js +4 -43
  66. package/teams/index.js +55 -421
  67. package/tenants/index.js +8 -85
  68. package/vendor/index.js +2 -23
@@ -1,135 +1,20 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
- import _regeneratorRuntime from "@babel/runtime/regenerator";
3
1
  import { Delete, Get, Patch, Post } from "../fetch";
4
2
  import { urls } from "../constants";
5
- export function loadAllUsers(_x) {
6
- return _loadAllUsers.apply(this, arguments);
3
+ export async function loadAllUsers(params) {
4
+ return Get(urls.identity.subTenants.v1, params);
7
5
  }
8
-
9
- function _loadAllUsers() {
10
- _loadAllUsers = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(params) {
11
- return _regeneratorRuntime.wrap(function _callee$(_context) {
12
- while (1) {
13
- switch (_context.prev = _context.next) {
14
- case 0:
15
- return _context.abrupt("return", Get(urls.identity.subTenants.v1, params));
16
-
17
- case 1:
18
- case "end":
19
- return _context.stop();
20
- }
21
- }
22
- }, _callee);
23
- }));
24
- return _loadAllUsers.apply(this, arguments);
6
+ export async function addUserToTenantAndSubTenants(body) {
7
+ return Post(urls.identity.subTenants.v1, body);
25
8
  }
26
-
27
- export function addUserToTenantAndSubTenants(_x2) {
28
- return _addUserToTenantAndSubTenants.apply(this, arguments);
9
+ export async function removeUserFromTenantAndSubTenants(body) {
10
+ return Delete(urls.identity.subTenants.v1, body);
29
11
  }
30
-
31
- function _addUserToTenantAndSubTenants() {
32
- _addUserToTenantAndSubTenants = _asyncToGenerator(_regeneratorRuntime.mark(function _callee2(body) {
33
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
34
- while (1) {
35
- switch (_context2.prev = _context2.next) {
36
- case 0:
37
- return _context2.abrupt("return", Post(urls.identity.subTenants.v1, body));
38
-
39
- case 1:
40
- case "end":
41
- return _context2.stop();
42
- }
43
- }
44
- }, _callee2);
45
- }));
46
- return _addUserToTenantAndSubTenants.apply(this, arguments);
12
+ export async function addUserRolesForSubTenants(userId, body) {
13
+ return Post(`${urls.identity.subTenants.v1}/${userId}/roles`, body);
47
14
  }
48
-
49
- export function removeUserFromTenantAndSubTenants(_x3) {
50
- return _removeUserFromTenantAndSubTenants.apply(this, arguments);
15
+ export async function removeUserRolesFromSubTenants(userId, body) {
16
+ return Delete(`${urls.identity.subTenants.v1}/${userId}/roles`, body);
51
17
  }
52
-
53
- function _removeUserFromTenantAndSubTenants() {
54
- _removeUserFromTenantAndSubTenants = _asyncToGenerator(_regeneratorRuntime.mark(function _callee3(body) {
55
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
56
- while (1) {
57
- switch (_context3.prev = _context3.next) {
58
- case 0:
59
- return _context3.abrupt("return", Delete(urls.identity.subTenants.v1, body));
60
-
61
- case 1:
62
- case "end":
63
- return _context3.stop();
64
- }
65
- }
66
- }, _callee3);
67
- }));
68
- return _removeUserFromTenantAndSubTenants.apply(this, arguments);
69
- }
70
-
71
- export function addUserRolesForSubTenants(_x4, _x5) {
72
- return _addUserRolesForSubTenants.apply(this, arguments);
73
- }
74
-
75
- function _addUserRolesForSubTenants() {
76
- _addUserRolesForSubTenants = _asyncToGenerator(_regeneratorRuntime.mark(function _callee4(userId, body) {
77
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
78
- while (1) {
79
- switch (_context4.prev = _context4.next) {
80
- case 0:
81
- return _context4.abrupt("return", Post("".concat(urls.identity.subTenants.v1, "/").concat(userId, "/roles"), body));
82
-
83
- case 1:
84
- case "end":
85
- return _context4.stop();
86
- }
87
- }
88
- }, _callee4);
89
- }));
90
- return _addUserRolesForSubTenants.apply(this, arguments);
91
- }
92
-
93
- export function removeUserRolesFromSubTenants(_x6, _x7) {
94
- return _removeUserRolesFromSubTenants.apply(this, arguments);
95
- }
96
-
97
- function _removeUserRolesFromSubTenants() {
98
- _removeUserRolesFromSubTenants = _asyncToGenerator(_regeneratorRuntime.mark(function _callee5(userId, body) {
99
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
100
- while (1) {
101
- switch (_context5.prev = _context5.next) {
102
- case 0:
103
- return _context5.abrupt("return", Delete("".concat(urls.identity.subTenants.v1, "/").concat(userId, "/roles"), body));
104
-
105
- case 1:
106
- case "end":
107
- return _context5.stop();
108
- }
109
- }
110
- }, _callee5);
111
- }));
112
- return _removeUserRolesFromSubTenants.apply(this, arguments);
113
- }
114
-
115
- export function setUserRolesForSubTenants(_x8, _x9) {
116
- return _setUserRolesForSubTenants.apply(this, arguments);
117
- }
118
-
119
- function _setUserRolesForSubTenants() {
120
- _setUserRolesForSubTenants = _asyncToGenerator(_regeneratorRuntime.mark(function _callee6(userId, body) {
121
- return _regeneratorRuntime.wrap(function _callee6$(_context6) {
122
- while (1) {
123
- switch (_context6.prev = _context6.next) {
124
- case 0:
125
- return _context6.abrupt("return", Patch("".concat(urls.identity.subTenants.v1, "/").concat(userId, "/roles"), body));
126
-
127
- case 1:
128
- case "end":
129
- return _context6.stop();
130
- }
131
- }
132
- }, _callee6);
133
- }));
134
- return _setUserRolesForSubTenants.apply(this, arguments);
18
+ export async function setUserRolesForSubTenants(userId, body) {
19
+ return Patch(`${urls.identity.subTenants.v1}/${userId}/roles`, body);
135
20
  }
@@ -1,4 +1,4 @@
1
- export var ISubscriptionStatus;
1
+ export let ISubscriptionStatus;
2
2
 
3
3
  (function (ISubscriptionStatus) {
4
4
  ISubscriptionStatus["ACTIVE"] = "active";
@@ -9,20 +9,20 @@ export var ISubscriptionStatus;
9
9
  ISubscriptionStatus["TRIAL_ENDED"] = "trialEnded";
10
10
  })(ISubscriptionStatus || (ISubscriptionStatus = {}));
11
11
 
12
- export var PaymentMethodType;
12
+ export let PaymentMethodType;
13
13
 
14
14
  (function (PaymentMethodType) {
15
15
  PaymentMethodType["UNKNWON"] = "unknown";
16
16
  PaymentMethodType["CARD"] = "card";
17
17
  })(PaymentMethodType || (PaymentMethodType = {}));
18
18
 
19
- export var ISubscriptionCancellationPolicy;
19
+ export let ISubscriptionCancellationPolicy;
20
20
 
21
21
  (function (ISubscriptionCancellationPolicy) {
22
22
  ISubscriptionCancellationPolicy["AT_PERIOD_END"] = "atPeriodEnd";
23
23
  })(ISubscriptionCancellationPolicy || (ISubscriptionCancellationPolicy = {}));
24
24
 
25
- export var ProviderType;
25
+ export let ProviderType;
26
26
 
27
27
  (function (ProviderType) {
28
28
  ProviderType["Stripe"] = "Stripe";
@@ -1,73 +1,15 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
- import _regeneratorRuntime from "@babel/runtime/regenerator";
3
1
  import { Get } from "../fetch";
4
2
  import { urls } from "../constants";
5
- export function getSubscriptionInvoices() {
6
- return _getSubscriptionInvoices.apply(this, arguments);
7
- }
8
-
9
- function _getSubscriptionInvoices() {
10
- _getSubscriptionInvoices = _asyncToGenerator(_regeneratorRuntime.mark(function _callee() {
11
- return _regeneratorRuntime.wrap(function _callee$(_context) {
12
- while (1) {
13
- switch (_context.prev = _context.next) {
14
- case 0:
15
- return _context.abrupt("return", Get(urls.subscriptions.billing.invoices.v1));
16
-
17
- case 1:
18
- case "end":
19
- return _context.stop();
20
- }
21
- }
22
- }, _callee);
23
- }));
24
- return _getSubscriptionInvoices.apply(this, arguments);
25
- }
26
-
27
- export function getSubscriptionInvoice(_x) {
28
- return _getSubscriptionInvoice.apply(this, arguments);
29
- }
30
-
31
- function _getSubscriptionInvoice() {
32
- _getSubscriptionInvoice = _asyncToGenerator(_regeneratorRuntime.mark(function _callee2(invoiceId) {
33
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
34
- while (1) {
35
- switch (_context2.prev = _context2.next) {
36
- case 0:
37
- return _context2.abrupt("return", Get("".concat(urls.subscriptions.billing.invoices.v1, "/").concat(invoiceId)));
38
-
39
- case 1:
40
- case "end":
41
- return _context2.stop();
42
- }
43
- }
44
- }, _callee2);
45
- }));
46
- return _getSubscriptionInvoice.apply(this, arguments);
47
- }
48
-
49
- export function getSubscriptionInvoicePdf(_x2, _x3) {
50
- return _getSubscriptionInvoicePdf.apply(this, arguments);
51
- }
52
-
53
- function _getSubscriptionInvoicePdf() {
54
- _getSubscriptionInvoicePdf = _asyncToGenerator(_regeneratorRuntime.mark(function _callee3(invoiceId, outputFileName) {
55
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
56
- while (1) {
57
- switch (_context3.prev = _context3.next) {
58
- case 0:
59
- return _context3.abrupt("return", Get("".concat(urls.subscriptions.billing.invoices.v1, "/").concat(invoiceId, "/pdf"), {
60
- outputFileName: outputFileName
61
- }, {
62
- responseType: "blob"
63
- }));
64
-
65
- case 1:
66
- case "end":
67
- return _context3.stop();
68
- }
69
- }
70
- }, _callee3);
71
- }));
72
- return _getSubscriptionInvoicePdf.apply(this, arguments);
3
+ export async function getSubscriptionInvoices() {
4
+ return Get(urls.subscriptions.billing.invoices.v1);
5
+ }
6
+ export async function getSubscriptionInvoice(invoiceId) {
7
+ return Get(`${urls.subscriptions.billing.invoices.v1}/${invoiceId}`);
8
+ }
9
+ export async function getSubscriptionInvoicePdf(invoiceId, outputFileName) {
10
+ return Get(`${urls.subscriptions.billing.invoices.v1}/${invoiceId}/pdf`, {
11
+ outputFileName
12
+ }, {
13
+ responseType: "blob"
14
+ });
73
15
  }
@@ -1,118 +1,23 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
- import _regeneratorRuntime from "@babel/runtime/regenerator";
3
1
  import { Get, Put } from "../fetch";
4
2
  import { urls } from "../constants";
5
- export function getManagedSubscription(_x) {
6
- return _getManagedSubscription.apply(this, arguments);
7
- }
8
-
9
- function _getManagedSubscription() {
10
- _getManagedSubscription = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(subscriptionId) {
11
- return _regeneratorRuntime.wrap(function _callee$(_context) {
12
- while (1) {
13
- switch (_context.prev = _context.next) {
14
- case 0:
15
- return _context.abrupt("return", Get("".concat(urls.subscriptions.managedSubscriptions.v1, "/").concat(subscriptionId)));
16
-
17
- case 1:
18
- case "end":
19
- return _context.stop();
20
- }
21
- }
22
- }, _callee);
23
- }));
24
- return _getManagedSubscription.apply(this, arguments);
25
- }
26
-
27
- export function getManagedSubscriptions() {
28
- return _getManagedSubscriptions.apply(this, arguments);
29
- }
30
-
31
- function _getManagedSubscriptions() {
32
- _getManagedSubscriptions = _asyncToGenerator(_regeneratorRuntime.mark(function _callee2() {
33
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
34
- while (1) {
35
- switch (_context2.prev = _context2.next) {
36
- case 0:
37
- return _context2.abrupt("return", Get("".concat(urls.subscriptions.managedSubscriptions.v1)));
38
-
39
- case 1:
40
- case "end":
41
- return _context2.stop();
42
- }
43
- }
44
- }, _callee2);
45
- }));
46
- return _getManagedSubscriptions.apply(this, arguments);
47
- }
48
-
49
- export function cancelManagedSubscription(_x2) {
50
- return _cancelManagedSubscription.apply(this, arguments);
51
- }
52
-
53
- function _cancelManagedSubscription() {
54
- _cancelManagedSubscription = _asyncToGenerator(_regeneratorRuntime.mark(function _callee3(subscriptionId) {
55
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
56
- while (1) {
57
- switch (_context3.prev = _context3.next) {
58
- case 0:
59
- return _context3.abrupt("return", Put("".concat(urls.subscriptions.managedSubscriptions.v1, "/").concat(subscriptionId, "/cancellations/"), {}));
60
-
61
- case 1:
62
- case "end":
63
- return _context3.stop();
64
- }
65
- }
66
- }, _callee3);
67
- }));
68
- return _cancelManagedSubscription.apply(this, arguments);
69
- }
70
-
71
- export function renewManagedSubscription(_x3) {
72
- return _renewManagedSubscription.apply(this, arguments);
73
- }
74
-
75
- function _renewManagedSubscription() {
76
- _renewManagedSubscription = _asyncToGenerator(_regeneratorRuntime.mark(function _callee4(subscriptionId) {
77
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
78
- while (1) {
79
- switch (_context4.prev = _context4.next) {
80
- case 0:
81
- return _context4.abrupt("return", Put("".concat(urls.subscriptions.managedSubscriptions.v1, "/").concat(subscriptionId, "/renewals/"), {}));
82
-
83
- case 1:
84
- case "end":
85
- return _context4.stop();
86
- }
87
- }
88
- }, _callee4);
89
- }));
90
- return _renewManagedSubscription.apply(this, arguments);
91
- }
92
-
93
- export function updateManagedSubscription(_x4, _x5) {
94
- return _updateManagedSubscription.apply(this, arguments);
95
- }
96
-
97
- function _updateManagedSubscription() {
98
- _updateManagedSubscription = _asyncToGenerator(_regeneratorRuntime.mark(function _callee5(subscriptionId, _ref) {
99
- var paymentMethodId, planId;
100
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
101
- while (1) {
102
- switch (_context5.prev = _context5.next) {
103
- case 0:
104
- paymentMethodId = _ref.paymentMethodId, planId = _ref.planId;
105
- return _context5.abrupt("return", Put("".concat(urls.subscriptions.managedSubscriptions.v1, "/").concat(subscriptionId), {
106
- paymentMethodId: paymentMethodId,
107
- planId: planId
108
- }));
109
-
110
- case 2:
111
- case "end":
112
- return _context5.stop();
113
- }
114
- }
115
- }, _callee5);
116
- }));
117
- return _updateManagedSubscription.apply(this, arguments);
3
+ export async function getManagedSubscription(subscriptionId) {
4
+ return Get(`${urls.subscriptions.managedSubscriptions.v1}/${subscriptionId}`);
5
+ }
6
+ export async function getManagedSubscriptions() {
7
+ return Get(`${urls.subscriptions.managedSubscriptions.v1}`);
8
+ }
9
+ export async function cancelManagedSubscription(subscriptionId) {
10
+ return Put(`${urls.subscriptions.managedSubscriptions.v1}/${subscriptionId}/cancellations/`, {});
11
+ }
12
+ export async function renewManagedSubscription(subscriptionId) {
13
+ return Put(`${urls.subscriptions.managedSubscriptions.v1}/${subscriptionId}/renewals/`, {});
14
+ }
15
+ export async function updateManagedSubscription(subscriptionId, {
16
+ paymentMethodId,
17
+ planId
18
+ }) {
19
+ return Put(`${urls.subscriptions.managedSubscriptions.v1}/${subscriptionId}`, {
20
+ paymentMethodId,
21
+ planId
22
+ });
118
23
  }
@@ -1,75 +1,21 @@
1
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
- import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
- import _regeneratorRuntime from "@babel/runtime/regenerator";
1
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
+ const _excluded = ["email"];
4
3
  import { Get, Patch } from "../fetch";
5
4
  import { urls } from "../constants";
6
- export function getPaymentMethods() {
7
- return _getPaymentMethods.apply(this, arguments);
5
+ export async function getPaymentMethods() {
6
+ return Get(urls.subscriptions.billing.paymentMethods.v1);
8
7
  }
9
-
10
- function _getPaymentMethods() {
11
- _getPaymentMethods = _asyncToGenerator(_regeneratorRuntime.mark(function _callee() {
12
- return _regeneratorRuntime.wrap(function _callee$(_context) {
13
- while (1) {
14
- switch (_context.prev = _context.next) {
15
- case 0:
16
- return _context.abrupt("return", Get(urls.subscriptions.billing.paymentMethods.v1));
17
-
18
- case 1:
19
- case "end":
20
- return _context.stop();
21
- }
22
- }
23
- }, _callee);
24
- }));
25
- return _getPaymentMethods.apply(this, arguments);
26
- }
27
-
28
- export function getPaymentMethod(_x) {
29
- return _getPaymentMethod.apply(this, arguments);
8
+ export async function getPaymentMethod(paymentMethodId) {
9
+ return Get(`${urls.subscriptions.billing.paymentMethods.v1}/${paymentMethodId}`);
30
10
  }
31
-
32
- function _getPaymentMethod() {
33
- _getPaymentMethod = _asyncToGenerator(_regeneratorRuntime.mark(function _callee2(paymentMethodId) {
34
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
35
- while (1) {
36
- switch (_context2.prev = _context2.next) {
37
- case 0:
38
- return _context2.abrupt("return", Get("".concat(urls.subscriptions.billing.paymentMethods.v1, "/").concat(paymentMethodId)));
39
-
40
- case 1:
41
- case "end":
42
- return _context2.stop();
43
- }
44
- }
45
- }, _callee2);
46
- }));
47
- return _getPaymentMethod.apply(this, arguments);
48
- }
49
-
50
- export function updatePaymentMethodBillingDetails(_x2, _x3) {
51
- return _updatePaymentMethodBillingDetails.apply(this, arguments);
52
- }
53
-
54
- function _updatePaymentMethodBillingDetails() {
55
- _updatePaymentMethodBillingDetails = _asyncToGenerator(_regeneratorRuntime.mark(function _callee3(paymentMethodId, _ref) {
56
- var email, address;
57
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
58
- while (1) {
59
- switch (_context3.prev = _context3.next) {
60
- case 0:
61
- email = _ref.email, address = _objectWithoutProperties(_ref, ["email"]);
62
- return _context3.abrupt("return", Patch("".concat(urls.subscriptions.billing.paymentMethods.v1, "/").concat(paymentMethodId, "/billing-details"), {
63
- email: email,
64
- address: address
65
- }));
66
-
67
- case 2:
68
- case "end":
69
- return _context3.stop();
70
- }
71
- }
72
- }, _callee3);
73
- }));
74
- return _updatePaymentMethodBillingDetails.apply(this, arguments);
11
+ export async function updatePaymentMethodBillingDetails(paymentMethodId, _ref) {
12
+ let {
13
+ email
14
+ } = _ref,
15
+ address = _objectWithoutPropertiesLoose(_ref, _excluded);
16
+
17
+ return Patch(`${urls.subscriptions.billing.paymentMethods.v1}/${paymentMethodId}/billing-details`, {
18
+ email,
19
+ address
20
+ });
75
21
  }
@@ -1,25 +1,5 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
- import _regeneratorRuntime from "@babel/runtime/regenerator";
3
1
  import { Get } from "../fetch";
4
2
  import { urls } from "../constants";
5
- export function getPaymentProviders() {
6
- return _getPaymentProviders.apply(this, arguments);
7
- }
8
-
9
- function _getPaymentProviders() {
10
- _getPaymentProviders = _asyncToGenerator(_regeneratorRuntime.mark(function _callee() {
11
- return _regeneratorRuntime.wrap(function _callee$(_context) {
12
- while (1) {
13
- switch (_context.prev = _context.next) {
14
- case 0:
15
- return _context.abrupt("return", Get(urls.subscriptions.paymentProviders.v1));
16
-
17
- case 1:
18
- case "end":
19
- return _context.stop();
20
- }
21
- }
22
- }, _callee);
23
- }));
24
- return _getPaymentProviders.apply(this, arguments);
3
+ export async function getPaymentProviders() {
4
+ return Get(urls.subscriptions.paymentProviders.v1);
25
5
  }
@@ -1,47 +1,8 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
- import _regeneratorRuntime from "@babel/runtime/regenerator";
3
1
  import { Get } from '../fetch';
4
2
  import { urls } from '../constants';
5
- export function getSubscriptionPlans() {
6
- return _getSubscriptionPlans.apply(this, arguments);
3
+ export async function getSubscriptionPlans() {
4
+ return Get(urls.subscriptions.billing.plans.v1);
7
5
  }
8
-
9
- function _getSubscriptionPlans() {
10
- _getSubscriptionPlans = _asyncToGenerator(_regeneratorRuntime.mark(function _callee() {
11
- return _regeneratorRuntime.wrap(function _callee$(_context) {
12
- while (1) {
13
- switch (_context.prev = _context.next) {
14
- case 0:
15
- return _context.abrupt("return", Get(urls.subscriptions.billing.plans.v1));
16
-
17
- case 1:
18
- case "end":
19
- return _context.stop();
20
- }
21
- }
22
- }, _callee);
23
- }));
24
- return _getSubscriptionPlans.apply(this, arguments);
25
- }
26
-
27
- export function getSubscriptionPlan(_x) {
28
- return _getSubscriptionPlan.apply(this, arguments);
29
- }
30
-
31
- function _getSubscriptionPlan() {
32
- _getSubscriptionPlan = _asyncToGenerator(_regeneratorRuntime.mark(function _callee2(planId) {
33
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
34
- while (1) {
35
- switch (_context2.prev = _context2.next) {
36
- case 0:
37
- return _context2.abrupt("return", Get("".concat(urls.subscriptions.billing.plans.v1, "/").concat(planId)));
38
-
39
- case 1:
40
- case "end":
41
- return _context2.stop();
42
- }
43
- }
44
- }, _callee2);
45
- }));
46
- return _getSubscriptionPlan.apply(this, arguments);
6
+ export async function getSubscriptionPlan(planId) {
7
+ return Get(`${urls.subscriptions.billing.plans.v1}/${planId}`);
47
8
  }