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