@internxt/sdk 1.5.25 → 1.6.3
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/dist/auth/index.d.ts +127 -122
- package/dist/auth/index.js +378 -310
- package/dist/auth/types.d.ts +67 -54
- package/dist/auth/types.js +26 -26
- package/dist/drive/backups/index.d.ts +18 -18
- package/dist/drive/backups/index.js +40 -40
- package/dist/drive/backups/types.d.ts +27 -27
- package/dist/drive/backups/types.js +2 -2
- package/dist/drive/index.d.ts +7 -7
- package/dist/drive/index.js +23 -19
- package/dist/drive/payments/index.d.ts +66 -71
- package/dist/drive/payments/index.js +206 -208
- package/dist/drive/payments/types.d.ts +180 -176
- package/dist/drive/payments/types.js +37 -37
- package/dist/drive/referrals/index.d.ts +19 -19
- package/dist/drive/referrals/index.js +54 -50
- package/dist/drive/referrals/types.d.ts +21 -21
- package/dist/drive/referrals/types.js +18 -18
- package/dist/drive/share/index.d.ts +319 -319
- package/dist/drive/share/index.js +544 -540
- package/dist/drive/share/types.d.ts +360 -360
- package/dist/drive/share/types.js +2 -2
- package/dist/drive/storage/index.d.ts +315 -315
- package/dist/drive/storage/index.js +634 -630
- package/dist/drive/storage/types.d.ts +480 -473
- package/dist/drive/storage/types.js +13 -13
- package/dist/drive/trash/index.d.ts +75 -75
- package/dist/drive/trash/index.js +184 -180
- package/dist/drive/trash/types.d.ts +29 -29
- package/dist/drive/trash/types.js +2 -2
- package/dist/drive/users/index.d.ts +135 -135
- package/dist/drive/users/index.js +208 -204
- package/dist/drive/users/types.d.ts +53 -51
- package/dist/drive/users/types.js +2 -2
- package/dist/index.d.ts +6 -6
- package/dist/index.js +35 -31
- package/dist/network/download.d.ts +8 -8
- package/dist/network/download.js +123 -123
- package/dist/network/errors/codes.d.ts +24 -24
- package/dist/network/errors/codes.js +48 -48
- package/dist/network/errors/context.d.ts +35 -35
- package/dist/network/errors/context.js +39 -39
- package/dist/network/errors/download.d.ts +4 -4
- package/dist/network/errors/download.js +52 -48
- package/dist/network/errors/index.d.ts +3 -3
- package/dist/network/errors/index.js +19 -15
- package/dist/network/errors/upload.d.ts +13 -13
- package/dist/network/errors/upload.js +82 -78
- package/dist/network/index.d.ts +70 -70
- package/dist/network/index.js +315 -311
- package/dist/network/types.d.ts +102 -102
- package/dist/network/types.js +18 -18
- package/dist/network/upload.d.ts +4 -4
- package/dist/network/upload.js +158 -159
- package/dist/photos/devices/index.d.ts +10 -10
- package/dist/photos/devices/index.js +79 -79
- package/dist/photos/index.d.ts +17 -17
- package/dist/photos/index.js +56 -52
- package/dist/photos/photos/index.d.ts +60 -60
- package/dist/photos/photos/index.js +225 -225
- package/dist/photos/shares/index.d.ts +8 -8
- package/dist/photos/shares/index.js +34 -34
- package/dist/photos/types.d.ts +154 -154
- package/dist/photos/types.js +19 -19
- package/dist/photos/users/index.d.ts +7 -7
- package/dist/photos/users/index.js +46 -46
- package/dist/shared/headers/index.d.ts +21 -21
- package/dist/shared/headers/index.js +78 -79
- package/dist/shared/http/client.d.ts +85 -85
- package/dist/shared/http/client.js +172 -172
- package/dist/shared/http/types.d.ts +7 -7
- package/dist/shared/http/types.js +2 -2
- package/dist/shared/index.d.ts +1 -1
- package/dist/shared/index.js +17 -13
- package/dist/shared/types/apiConnection.d.ts +12 -12
- package/dist/shared/types/apiConnection.js +2 -2
- package/dist/shared/types/appsumo.d.ts +16 -16
- package/dist/shared/types/appsumo.js +12 -12
- package/dist/shared/types/errors.d.ts +5 -5
- package/dist/shared/types/errors.js +28 -28
- package/dist/shared/types/teams.d.ts +9 -9
- package/dist/shared/types/teams.js +2 -2
- package/dist/shared/types/userSettings.d.ts +43 -29
- package/dist/shared/types/userSettings.js +2 -2
- package/dist/utils.d.ts +3 -3
- package/dist/utils.js +24 -25
- package/dist/workspaces/index.d.ts +176 -176
- package/dist/workspaces/index.js +419 -415
- package/dist/workspaces/index.test.d.ts +1 -1
- package/dist/workspaces/index.test.js +908 -903
- package/dist/workspaces/types.d.ts +294 -291
- package/dist/workspaces/types.js +2 -2
- package/package.json +13 -13
|
@@ -1,208 +1,206 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g =
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (_) try {
|
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
-
exports.Payments = void 0;
|
|
51
|
-
var headers_1 = require("../../shared/headers");
|
|
52
|
-
var client_1 = require("../../shared/http/client");
|
|
53
|
-
var Payments = /** @class */ (function () {
|
|
54
|
-
function Payments(apiUrl, appDetails, apiSecurity) {
|
|
55
|
-
this.client = client_1.HttpClient.create(apiUrl, apiSecurity.unauthorizedCallback);
|
|
56
|
-
this.appDetails = appDetails;
|
|
57
|
-
this.apiSecurity = apiSecurity;
|
|
58
|
-
}
|
|
59
|
-
Payments.client = function (apiUrl, appDetails, apiSecurity) {
|
|
60
|
-
return new Payments(apiUrl, appDetails, apiSecurity);
|
|
61
|
-
};
|
|
62
|
-
Payments.prototype.createCustomer = function (name, email, country, companyVatId) {
|
|
63
|
-
return this.client.post('/create-customer', { name: name, email: email, country: country, companyVatId: companyVatId }, this.headers());
|
|
64
|
-
};
|
|
65
|
-
Payments.prototype.createSubscription = function (customerId, priceId, token, quantity, currency, promoCodeId) {
|
|
66
|
-
return this.client.post('/create-subscription', {
|
|
67
|
-
customerId: customerId,
|
|
68
|
-
priceId: priceId,
|
|
69
|
-
token: token,
|
|
70
|
-
quantity: quantity,
|
|
71
|
-
currency: currency,
|
|
72
|
-
promoCodeId: promoCodeId,
|
|
73
|
-
}, this.headers());
|
|
74
|
-
};
|
|
75
|
-
Payments.prototype.createPaymentIntent = function (customerId, amount, planId, token, currency, promoCodeName) {
|
|
76
|
-
var query = new URLSearchParams();
|
|
77
|
-
query.set('customerId', customerId);
|
|
78
|
-
query.set('amount', String(amount));
|
|
79
|
-
query.set('planId', planId);
|
|
80
|
-
query.set('token', token);
|
|
81
|
-
if (currency !== undefined)
|
|
82
|
-
query.set('currency', currency);
|
|
83
|
-
if (promoCodeName !== undefined)
|
|
84
|
-
query.set('promoCodeName', promoCodeName);
|
|
85
|
-
return this.client.get("/payment-intent?"
|
|
86
|
-
};
|
|
87
|
-
/**
|
|
88
|
-
* Fetches the existing products and its details
|
|
89
|
-
*/
|
|
90
|
-
Payments.prototype.getProducts = function () {
|
|
91
|
-
return this.client.get('/v3/stripe/products', this.headers());
|
|
92
|
-
};
|
|
93
|
-
/**
|
|
94
|
-
* Creates and returns a new session identifier for the client to go to payment platform
|
|
95
|
-
* @param payload
|
|
96
|
-
*/
|
|
97
|
-
Payments.prototype.createSession = function (payload) {
|
|
98
|
-
return this.client.post('/v2/stripe/session', {
|
|
99
|
-
test: payload.test,
|
|
100
|
-
lifetime_tier: payload.lifetime_tier,
|
|
101
|
-
mode: payload.mode,
|
|
102
|
-
priceId: payload.priceId,
|
|
103
|
-
successUrl: payload.successUrl,
|
|
104
|
-
canceledUrl: payload.canceledUrl,
|
|
105
|
-
}, this.headers());
|
|
106
|
-
};
|
|
107
|
-
Payments.prototype.getSetupIntent = function (userType) {
|
|
108
|
-
var query = new URLSearchParams();
|
|
109
|
-
if (userType)
|
|
110
|
-
query.set('userType', userType);
|
|
111
|
-
return this.client.get("/setup-intent?"
|
|
112
|
-
};
|
|
113
|
-
Payments.prototype.getDefaultPaymentMethod = function (userType) {
|
|
114
|
-
var query = new URLSearchParams();
|
|
115
|
-
if (userType)
|
|
116
|
-
query.set('userType', userType);
|
|
117
|
-
return this.client.get("/default-payment-method?"
|
|
118
|
-
};
|
|
119
|
-
Payments.prototype.getInvoices = function (_a) {
|
|
120
|
-
var subscriptionId = _a.subscriptionId, startingAfter = _a.startingAfter, limit = _a.limit;
|
|
121
|
-
var query = new URLSearchParams();
|
|
122
|
-
if (subscriptionId)
|
|
123
|
-
query.set('subscription', subscriptionId);
|
|
124
|
-
if (startingAfter !== undefined)
|
|
125
|
-
query.set('starting_after', startingAfter);
|
|
126
|
-
if (limit !== undefined)
|
|
127
|
-
query.set('limit', limit.toString());
|
|
128
|
-
return this.client.get("/invoices?"
|
|
129
|
-
};
|
|
130
|
-
Payments.prototype.isCouponUsedByUser = function (_a) {
|
|
131
|
-
var couponCode = _a.couponCode;
|
|
132
|
-
var query = new URLSearchParams();
|
|
133
|
-
if (couponCode !== undefined)
|
|
134
|
-
query.set('code', couponCode);
|
|
135
|
-
return this.client.get("/coupon-in-use?"
|
|
136
|
-
};
|
|
137
|
-
Payments.prototype.getUserSubscription = function (userType) {
|
|
138
|
-
var query = new URLSearchParams();
|
|
139
|
-
if (userType)
|
|
140
|
-
query.set('userType', userType);
|
|
141
|
-
return this.client.get("/subscriptions?"
|
|
142
|
-
var error = err;
|
|
143
|
-
if (error.status === 404)
|
|
144
|
-
return { type: 'free' };
|
|
145
|
-
else
|
|
146
|
-
throw err;
|
|
147
|
-
});
|
|
148
|
-
};
|
|
149
|
-
Payments.prototype.getPrices = function (currency, userType) {
|
|
150
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
151
|
-
var query;
|
|
152
|
-
return __generator(this, function (_a) {
|
|
153
|
-
query = new URLSearchParams();
|
|
154
|
-
if (currency !== undefined)
|
|
155
|
-
query.set('currency', currency);
|
|
156
|
-
if (userType)
|
|
157
|
-
query.set('userType', userType);
|
|
158
|
-
return [2 /*return*/, this.client.get("/prices?"
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
};
|
|
162
|
-
Payments.prototype.requestPreventCancellation = function () {
|
|
163
|
-
return this.client.get('/request-prevent-cancellation', this.headers());
|
|
164
|
-
};
|
|
165
|
-
Payments.prototype.preventCancellation = function () {
|
|
166
|
-
return this.client.put('/prevent-cancellation', {}, this.headers());
|
|
167
|
-
};
|
|
168
|
-
Payments.prototype.applyRedeemCode = function (payload) {
|
|
169
|
-
return this.client.post('/licenses', { code: payload.code, provider: payload.provider }, this.headers());
|
|
170
|
-
};
|
|
171
|
-
Payments.prototype.updateSubscriptionPaymentMethod = function (payload) {
|
|
172
|
-
return this.client.post('/subscriptions/update-payment-method', __assign({}, payload), this.headers());
|
|
173
|
-
};
|
|
174
|
-
Payments.prototype.updateSubscriptionPrice = function (_a) {
|
|
175
|
-
var priceId = _a.priceId, couponCode = _a.couponCode, userType = _a.userType;
|
|
176
|
-
return this.client.put('/subscriptions', { price_id: priceId, couponCode: couponCode, userType: userType }, this.headers());
|
|
177
|
-
};
|
|
178
|
-
Payments.prototype.
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
}());
|
|
208
|
-
exports.Payments = Payments;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
24
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
+
exports.Payments = void 0;
|
|
51
|
+
var headers_1 = require("../../shared/headers");
|
|
52
|
+
var client_1 = require("../../shared/http/client");
|
|
53
|
+
var Payments = /** @class */ (function () {
|
|
54
|
+
function Payments(apiUrl, appDetails, apiSecurity) {
|
|
55
|
+
this.client = client_1.HttpClient.create(apiUrl, apiSecurity.unauthorizedCallback);
|
|
56
|
+
this.appDetails = appDetails;
|
|
57
|
+
this.apiSecurity = apiSecurity;
|
|
58
|
+
}
|
|
59
|
+
Payments.client = function (apiUrl, appDetails, apiSecurity) {
|
|
60
|
+
return new Payments(apiUrl, appDetails, apiSecurity);
|
|
61
|
+
};
|
|
62
|
+
Payments.prototype.createCustomer = function (name, email, country, companyVatId) {
|
|
63
|
+
return this.client.post('/create-customer', { name: name, email: email, country: country, companyVatId: companyVatId }, this.headers());
|
|
64
|
+
};
|
|
65
|
+
Payments.prototype.createSubscription = function (customerId, priceId, token, quantity, currency, promoCodeId) {
|
|
66
|
+
return this.client.post('/create-subscription', {
|
|
67
|
+
customerId: customerId,
|
|
68
|
+
priceId: priceId,
|
|
69
|
+
token: token,
|
|
70
|
+
quantity: quantity,
|
|
71
|
+
currency: currency,
|
|
72
|
+
promoCodeId: promoCodeId,
|
|
73
|
+
}, this.headers());
|
|
74
|
+
};
|
|
75
|
+
Payments.prototype.createPaymentIntent = function (customerId, amount, planId, token, currency, promoCodeName) {
|
|
76
|
+
var query = new URLSearchParams();
|
|
77
|
+
query.set('customerId', customerId);
|
|
78
|
+
query.set('amount', String(amount));
|
|
79
|
+
query.set('planId', planId);
|
|
80
|
+
query.set('token', token);
|
|
81
|
+
if (currency !== undefined)
|
|
82
|
+
query.set('currency', currency);
|
|
83
|
+
if (promoCodeName !== undefined)
|
|
84
|
+
query.set('promoCodeName', promoCodeName);
|
|
85
|
+
return this.client.get("/payment-intent?".concat(query.toString()), this.headers());
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Fetches the existing products and its details
|
|
89
|
+
*/
|
|
90
|
+
Payments.prototype.getProducts = function () {
|
|
91
|
+
return this.client.get('/v3/stripe/products', this.headers());
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Creates and returns a new session identifier for the client to go to payment platform
|
|
95
|
+
* @param payload
|
|
96
|
+
*/
|
|
97
|
+
Payments.prototype.createSession = function (payload) {
|
|
98
|
+
return this.client.post('/v2/stripe/session', {
|
|
99
|
+
test: payload.test,
|
|
100
|
+
lifetime_tier: payload.lifetime_tier,
|
|
101
|
+
mode: payload.mode,
|
|
102
|
+
priceId: payload.priceId,
|
|
103
|
+
successUrl: payload.successUrl,
|
|
104
|
+
canceledUrl: payload.canceledUrl,
|
|
105
|
+
}, this.headers());
|
|
106
|
+
};
|
|
107
|
+
Payments.prototype.getSetupIntent = function (userType) {
|
|
108
|
+
var query = new URLSearchParams();
|
|
109
|
+
if (userType)
|
|
110
|
+
query.set('userType', userType);
|
|
111
|
+
return this.client.get("/setup-intent?".concat(query.toString()), this.headers());
|
|
112
|
+
};
|
|
113
|
+
Payments.prototype.getDefaultPaymentMethod = function (userType) {
|
|
114
|
+
var query = new URLSearchParams();
|
|
115
|
+
if (userType)
|
|
116
|
+
query.set('userType', userType);
|
|
117
|
+
return this.client.get("/default-payment-method?".concat(query.toString()), this.headers());
|
|
118
|
+
};
|
|
119
|
+
Payments.prototype.getInvoices = function (_a) {
|
|
120
|
+
var subscriptionId = _a.subscriptionId, startingAfter = _a.startingAfter, limit = _a.limit;
|
|
121
|
+
var query = new URLSearchParams();
|
|
122
|
+
if (subscriptionId)
|
|
123
|
+
query.set('subscription', subscriptionId);
|
|
124
|
+
if (startingAfter !== undefined)
|
|
125
|
+
query.set('starting_after', startingAfter);
|
|
126
|
+
if (limit !== undefined)
|
|
127
|
+
query.set('limit', limit.toString());
|
|
128
|
+
return this.client.get("/invoices?".concat(query.toString()), this.headers());
|
|
129
|
+
};
|
|
130
|
+
Payments.prototype.isCouponUsedByUser = function (_a) {
|
|
131
|
+
var couponCode = _a.couponCode;
|
|
132
|
+
var query = new URLSearchParams();
|
|
133
|
+
if (couponCode !== undefined)
|
|
134
|
+
query.set('code', couponCode);
|
|
135
|
+
return this.client.get("/coupon-in-use?".concat(query.toString()), this.headers());
|
|
136
|
+
};
|
|
137
|
+
Payments.prototype.getUserSubscription = function (userType) {
|
|
138
|
+
var query = new URLSearchParams();
|
|
139
|
+
if (userType)
|
|
140
|
+
query.set('userType', userType);
|
|
141
|
+
return this.client.get("/subscriptions?".concat(query.toString()), this.headers()).catch(function (err) {
|
|
142
|
+
var error = err;
|
|
143
|
+
if (error.status === 404)
|
|
144
|
+
return { type: 'free' };
|
|
145
|
+
else
|
|
146
|
+
throw err;
|
|
147
|
+
});
|
|
148
|
+
};
|
|
149
|
+
Payments.prototype.getPrices = function (currency, userType) {
|
|
150
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
151
|
+
var query;
|
|
152
|
+
return __generator(this, function (_a) {
|
|
153
|
+
query = new URLSearchParams();
|
|
154
|
+
if (currency !== undefined)
|
|
155
|
+
query.set('currency', currency);
|
|
156
|
+
if (userType)
|
|
157
|
+
query.set('userType', userType);
|
|
158
|
+
return [2 /*return*/, this.client.get("/prices?".concat(query.toString()), this.headers())];
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
};
|
|
162
|
+
Payments.prototype.requestPreventCancellation = function () {
|
|
163
|
+
return this.client.get('/request-prevent-cancellation', this.headers());
|
|
164
|
+
};
|
|
165
|
+
Payments.prototype.preventCancellation = function () {
|
|
166
|
+
return this.client.put('/prevent-cancellation', {}, this.headers());
|
|
167
|
+
};
|
|
168
|
+
Payments.prototype.applyRedeemCode = function (payload) {
|
|
169
|
+
return this.client.post('/licenses', { code: payload.code, provider: payload.provider }, this.headers());
|
|
170
|
+
};
|
|
171
|
+
Payments.prototype.updateSubscriptionPaymentMethod = function (payload) {
|
|
172
|
+
return this.client.post('/subscriptions/update-payment-method', __assign({}, payload), this.headers());
|
|
173
|
+
};
|
|
174
|
+
Payments.prototype.updateSubscriptionPrice = function (_a) {
|
|
175
|
+
var priceId = _a.priceId, couponCode = _a.couponCode, userType = _a.userType;
|
|
176
|
+
return this.client.put('/subscriptions', { price_id: priceId, couponCode: couponCode, userType: userType }, this.headers());
|
|
177
|
+
};
|
|
178
|
+
Payments.prototype.updateWorkspaceMembers = function (workspaceId, subscriptionId, updatedSeats) {
|
|
179
|
+
return this.client.patch('/business/subscription', {
|
|
180
|
+
workspaceId: workspaceId,
|
|
181
|
+
subscriptionId: subscriptionId,
|
|
182
|
+
workspaceUpdatedSeats: updatedSeats,
|
|
183
|
+
}, this.headers());
|
|
184
|
+
};
|
|
185
|
+
Payments.prototype.cancelSubscription = function (userType) {
|
|
186
|
+
var query = new URLSearchParams();
|
|
187
|
+
if (userType)
|
|
188
|
+
query.set('userType', userType);
|
|
189
|
+
return this.client.delete("/subscriptions?".concat(query.toString()), this.headers());
|
|
190
|
+
};
|
|
191
|
+
Payments.prototype.createCheckoutSession = function (payload) {
|
|
192
|
+
return this.client.post('/checkout-session', __assign({}, payload), this.headers());
|
|
193
|
+
};
|
|
194
|
+
Payments.prototype.updateCustomerBillingInfo = function (payload) {
|
|
195
|
+
return this.client.patch('/billing', __assign({}, payload), this.headers());
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* Returns the needed headers for the module requests
|
|
199
|
+
* @private
|
|
200
|
+
*/
|
|
201
|
+
Payments.prototype.headers = function () {
|
|
202
|
+
return (0, headers_1.headersWithToken)(this.appDetails.clientName, this.appDetails.clientVersion, this.apiSecurity.token);
|
|
203
|
+
};
|
|
204
|
+
return Payments;
|
|
205
|
+
}());
|
|
206
|
+
exports.Payments = Payments;
|