@internxt/sdk 1.15.13 → 1.16.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.
- package/dist/auth/index.js +180 -262
- package/dist/auth/types.js +2 -22
- package/dist/drive/backups/index.js +34 -32
- package/dist/drive/payments/index.js +96 -149
- package/dist/drive/payments/object-storage.js +34 -36
- package/dist/drive/referrals/index.js +19 -17
- package/dist/drive/share/index.js +168 -235
- package/dist/drive/storage/index.js +213 -302
- package/dist/drive/trash/index.js +40 -84
- package/dist/drive/users/index.js +95 -140
- package/dist/mail/index.d.ts +124 -2
- package/dist/mail/index.js +170 -16
- package/dist/mail/types.d.ts +50 -0
- package/dist/mail/types.js +6 -0
- package/dist/meet/index.js +31 -99
- package/dist/misc/location/index.js +10 -50
- package/dist/network/download.js +38 -107
- package/dist/network/errors/codes.js +8 -24
- package/dist/network/errors/context.js +9 -26
- package/dist/network/errors/download.js +6 -24
- package/dist/network/errors/upload.js +21 -48
- package/dist/network/index.js +120 -277
- package/dist/network/types.js +3 -4
- package/dist/network/upload.js +63 -133
- package/dist/payments/checkout.js +57 -69
- package/dist/send/send.js +17 -27
- package/dist/shared/headers/index.js +56 -42
- package/dist/shared/http/client.d.ts +7 -0
- package/dist/shared/http/client.js +101 -188
- package/dist/shared/http/retryWithBackoff.js +36 -110
- package/dist/shared/types/errors.js +37 -51
- package/dist/workspaces/index.js +224 -264
- package/package.json +14 -15
- package/dist/mail/api.d.ts +0 -126
- package/dist/mail/api.js +0 -288
- package/dist/mail/crypto.d.ts +0 -66
- package/dist/mail/crypto.js +0 -156
- package/dist/mail/mail.d.ts +0 -162
- package/dist/mail/mail.js +0 -382
package/dist/auth/types.js
CHANGED
|
@@ -1,26 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
3
|
exports.UserAccessError = void 0;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
function UserAccessError() {
|
|
22
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
23
|
-
}
|
|
24
|
-
return UserAccessError;
|
|
25
|
-
}(Error));
|
|
4
|
+
class UserAccessError extends Error {
|
|
5
|
+
}
|
|
26
6
|
exports.UserAccessError = UserAccessError;
|
|
@@ -1,32 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Backups = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
const client_1 = require("../../shared/http/client");
|
|
5
|
+
const headers_1 = require("../../shared/headers");
|
|
6
|
+
class Backups {
|
|
7
|
+
client;
|
|
8
|
+
appDetails;
|
|
9
|
+
apiSecurity;
|
|
10
|
+
static client(apiUrl, appDetails, apiSecurity) {
|
|
11
|
+
return new Backups(apiUrl, appDetails, apiSecurity);
|
|
12
|
+
}
|
|
13
|
+
constructor(apiUrl, appDetails, apiSecurity) {
|
|
8
14
|
this.client = client_1.HttpClient.create(apiUrl, apiSecurity.unauthorizedCallback, apiSecurity.retryOptions);
|
|
9
15
|
this.appDetails = appDetails;
|
|
10
16
|
this.apiSecurity = apiSecurity;
|
|
11
17
|
}
|
|
12
|
-
Backups.client = function (apiUrl, appDetails, apiSecurity) {
|
|
13
|
-
return new Backups(apiUrl, appDetails, apiSecurity);
|
|
14
|
-
};
|
|
15
18
|
/**
|
|
16
19
|
* @deprecated Use `getBackupDevices` instead.
|
|
17
20
|
* This method uses the old drive backend, while `getBackupDevices` uses the new drive backend.
|
|
18
21
|
*/
|
|
19
|
-
|
|
22
|
+
getAllDevices() {
|
|
20
23
|
return this.client.get('/backup/device', this.headers());
|
|
21
|
-
}
|
|
24
|
+
}
|
|
22
25
|
/**
|
|
23
26
|
* Retrieves the list of backup devices associated with the user's account.
|
|
24
27
|
*
|
|
25
28
|
* @returns {Promise<Device[]>} A promise that resolves to an array of Devices.
|
|
26
29
|
*/
|
|
27
|
-
|
|
30
|
+
getBackupDevices() {
|
|
28
31
|
return this.client.get('/backup/devices', this.headers());
|
|
29
|
-
}
|
|
32
|
+
}
|
|
30
33
|
/**
|
|
31
34
|
* Retrieves a list of all devices represented as folders.
|
|
32
35
|
*
|
|
@@ -36,57 +39,57 @@ var Backups = /** @class */ (function () {
|
|
|
36
39
|
*
|
|
37
40
|
* @returns {Promise<DriveFolderData[]>} A promise that resolves to an array of DriveFolderData.
|
|
38
41
|
*/
|
|
39
|
-
|
|
42
|
+
getAllDevicesAsFolder() {
|
|
40
43
|
return this.client.get('/backup/deviceAsFolder', this.headers());
|
|
41
|
-
}
|
|
44
|
+
}
|
|
42
45
|
/**
|
|
43
46
|
* Retrieves all backups associated with a specific device identified by its mac ID.
|
|
44
47
|
*
|
|
45
48
|
* @param mac - The mac ID of the device for which backups are to be retrieved.
|
|
46
49
|
* @returns A promise that resolves to an array of DeviceBackups.
|
|
47
50
|
*/
|
|
48
|
-
|
|
49
|
-
return this.client.get(
|
|
50
|
-
}
|
|
51
|
+
getAllBackups(mac) {
|
|
52
|
+
return this.client.get(`/backup/${mac}`, this.headers());
|
|
53
|
+
}
|
|
51
54
|
/**
|
|
52
55
|
* Deletes a backup by its ID.
|
|
53
56
|
*
|
|
54
57
|
* @param backupId - The unique identifier of the backup to be deleted.
|
|
55
58
|
* @returns A promise that resolves when the backup is successfully deleted.
|
|
56
59
|
*/
|
|
57
|
-
|
|
58
|
-
return this.client.delete(
|
|
59
|
-
}
|
|
60
|
+
deleteBackup(backupId) {
|
|
61
|
+
return this.client.delete(`/backup/${backupId}`, this.headers());
|
|
62
|
+
}
|
|
60
63
|
/**
|
|
61
64
|
* @deprecated Use `deleteBackupDevice` instead.
|
|
62
65
|
* This method uses the old drive backend, while `deleteBackupDevice` uses the new drive backend.
|
|
63
66
|
*/
|
|
64
|
-
|
|
65
|
-
return this.client.delete(
|
|
66
|
-
}
|
|
67
|
+
deleteDevice(deviceId) {
|
|
68
|
+
return this.client.delete(`/backup/device/${deviceId}`, this.headers());
|
|
69
|
+
}
|
|
67
70
|
/**
|
|
68
71
|
* Deletes a backup device by its ID.
|
|
69
72
|
*
|
|
70
73
|
* @param deviceId - The unique identifier of the device to be deleted.
|
|
71
74
|
* @returns A promise that resolves when the device is successfully deleted.
|
|
72
75
|
*/
|
|
73
|
-
|
|
74
|
-
return this.client.delete(
|
|
75
|
-
}
|
|
76
|
+
deleteBackupDevice(deviceId) {
|
|
77
|
+
return this.client.delete(`/backup/devices/${deviceId}`, this.headers());
|
|
78
|
+
}
|
|
76
79
|
/**
|
|
77
80
|
* Deletes a backup device by its folder ID.
|
|
78
81
|
*
|
|
79
82
|
* @param folderId - The unique identifier of the folder to be deleted.
|
|
80
83
|
* @returns A promise that resolves when the device is successfully deleted.
|
|
81
84
|
*/
|
|
82
|
-
|
|
83
|
-
return this.client.delete(
|
|
84
|
-
}
|
|
85
|
+
deleteBackupDeviceAsFolder(folderId) {
|
|
86
|
+
return this.client.delete(`/backup/deviceAsFolder/${folderId}`, this.headers());
|
|
87
|
+
}
|
|
85
88
|
/**
|
|
86
89
|
* Returns the needed headers for the module requests
|
|
87
90
|
* @private
|
|
88
91
|
*/
|
|
89
|
-
|
|
92
|
+
headers() {
|
|
90
93
|
return (0, headers_1.headersWithToken)({
|
|
91
94
|
clientName: this.appDetails.clientName,
|
|
92
95
|
clientVersion: this.appDetails.clientVersion,
|
|
@@ -95,7 +98,6 @@ var Backups = /** @class */ (function () {
|
|
|
95
98
|
desktopToken: this.appDetails.desktopHeader,
|
|
96
99
|
customHeaders: this.appDetails.customHeaders,
|
|
97
100
|
});
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
}());
|
|
101
|
+
}
|
|
102
|
+
}
|
|
101
103
|
exports.Backups = Backups;
|
|
@@ -1,80 +1,36 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
3
|
exports.Payments = void 0;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
4
|
+
const headers_1 = require("../../shared/headers");
|
|
5
|
+
const client_1 = require("../../shared/http/client");
|
|
6
|
+
const types_1 = require("./types/types");
|
|
7
|
+
class Payments {
|
|
8
|
+
client;
|
|
9
|
+
appDetails;
|
|
10
|
+
apiSecurity;
|
|
11
|
+
static client(apiUrl, appDetails, apiSecurity) {
|
|
12
|
+
return new Payments(apiUrl, appDetails, apiSecurity);
|
|
13
|
+
}
|
|
14
|
+
constructor(apiUrl, appDetails, apiSecurity) {
|
|
56
15
|
this.client = client_1.HttpClient.create(apiUrl, apiSecurity.unauthorizedCallback, apiSecurity.retryOptions);
|
|
57
16
|
this.appDetails = appDetails;
|
|
58
17
|
this.apiSecurity = apiSecurity;
|
|
59
18
|
}
|
|
60
|
-
|
|
61
|
-
return
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return this.client.post('/create-customer', { name: name, email: email, country: country, companyVatId: companyVatId }, this.headers());
|
|
65
|
-
};
|
|
66
|
-
Payments.prototype.createSubscription = function (customerId, priceId, token, quantity, currency, promoCodeId) {
|
|
19
|
+
createCustomer(name, email, country, companyVatId) {
|
|
20
|
+
return this.client.post('/create-customer', { name, email, country, companyVatId }, this.headers());
|
|
21
|
+
}
|
|
22
|
+
createSubscription(customerId, priceId, token, quantity, currency, promoCodeId) {
|
|
67
23
|
return this.client.post('/create-subscription', {
|
|
68
|
-
customerId
|
|
69
|
-
priceId
|
|
70
|
-
token
|
|
71
|
-
quantity
|
|
72
|
-
currency
|
|
73
|
-
promoCodeId
|
|
24
|
+
customerId,
|
|
25
|
+
priceId,
|
|
26
|
+
token,
|
|
27
|
+
quantity,
|
|
28
|
+
currency,
|
|
29
|
+
promoCodeId,
|
|
74
30
|
}, this.headers());
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
31
|
+
}
|
|
32
|
+
createPaymentIntent(customerId, amount, planId, token, currency, promoCodeName) {
|
|
33
|
+
const query = new URLSearchParams();
|
|
78
34
|
query.set('customerId', customerId);
|
|
79
35
|
query.set('amount', String(amount));
|
|
80
36
|
query.set('planId', planId);
|
|
@@ -83,19 +39,19 @@ var Payments = /** @class */ (function () {
|
|
|
83
39
|
query.set('currency', currency);
|
|
84
40
|
if (promoCodeName !== undefined)
|
|
85
41
|
query.set('promoCodeName', promoCodeName);
|
|
86
|
-
return this.client.get(
|
|
87
|
-
}
|
|
42
|
+
return this.client.get(`/payment-intent?${query.toString()}`, this.headers());
|
|
43
|
+
}
|
|
88
44
|
/**
|
|
89
45
|
* Fetches the existing products and its details
|
|
90
46
|
*/
|
|
91
|
-
|
|
47
|
+
getProducts() {
|
|
92
48
|
return this.client.get('/v3/stripe/products', this.headers());
|
|
93
|
-
}
|
|
49
|
+
}
|
|
94
50
|
/**
|
|
95
51
|
* Creates and returns a new session identifier for the client to go to payment platform
|
|
96
52
|
* @param payload
|
|
97
53
|
*/
|
|
98
|
-
|
|
54
|
+
createSession(payload) {
|
|
99
55
|
return this.client.post('/v2/stripe/session', {
|
|
100
56
|
test: payload.test,
|
|
101
57
|
lifetime_tier: payload.lifetime_tier,
|
|
@@ -104,22 +60,21 @@ var Payments = /** @class */ (function () {
|
|
|
104
60
|
successUrl: payload.successUrl,
|
|
105
61
|
canceledUrl: payload.canceledUrl,
|
|
106
62
|
}, this.headers());
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
|
|
63
|
+
}
|
|
64
|
+
getSetupIntent(userType) {
|
|
65
|
+
const query = new URLSearchParams();
|
|
110
66
|
if (userType)
|
|
111
67
|
query.set('userType', userType);
|
|
112
|
-
return this.client.get(
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
|
|
68
|
+
return this.client.get(`/setup-intent?${query.toString()}`, this.headers());
|
|
69
|
+
}
|
|
70
|
+
getDefaultPaymentMethod(userType) {
|
|
71
|
+
const query = new URLSearchParams();
|
|
116
72
|
if (userType)
|
|
117
73
|
query.set('userType', userType);
|
|
118
|
-
return this.client.get(
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
var query = new URLSearchParams();
|
|
74
|
+
return this.client.get(`/default-payment-method?${query.toString()}`, this.headers());
|
|
75
|
+
}
|
|
76
|
+
getInvoices({ subscriptionId, userType = types_1.UserType.Individual, startingAfter, limit, }) {
|
|
77
|
+
const query = new URLSearchParams();
|
|
123
78
|
if (subscriptionId !== undefined)
|
|
124
79
|
query.set('subscription', subscriptionId);
|
|
125
80
|
if (startingAfter !== undefined)
|
|
@@ -128,85 +83,78 @@ var Payments = /** @class */ (function () {
|
|
|
128
83
|
query.set('userType', userType);
|
|
129
84
|
if (limit !== undefined)
|
|
130
85
|
query.set('limit', limit.toString());
|
|
131
|
-
return this.client.get(
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
var query = new URLSearchParams();
|
|
86
|
+
return this.client.get(`/invoices?${query.toString()}`, this.headers());
|
|
87
|
+
}
|
|
88
|
+
isCouponUsedByUser({ couponCode }) {
|
|
89
|
+
const query = new URLSearchParams();
|
|
136
90
|
if (couponCode !== undefined)
|
|
137
91
|
query.set('code', couponCode);
|
|
138
|
-
return this.client.get(
|
|
139
|
-
}
|
|
140
|
-
|
|
92
|
+
return this.client.get(`/coupon-in-use?${query.toString()}`, this.headers());
|
|
93
|
+
}
|
|
94
|
+
getPromoCodesUsedByUser() {
|
|
141
95
|
return this.client.get('/customer/redeemed-promotion-codes', this.headers());
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
|
|
96
|
+
}
|
|
97
|
+
getUserSubscription(userType) {
|
|
98
|
+
const query = new URLSearchParams();
|
|
145
99
|
if (userType)
|
|
146
100
|
query.set('userType', userType);
|
|
147
|
-
return this.client.get(
|
|
148
|
-
|
|
101
|
+
return this.client.get(`/subscriptions?${query.toString()}`, this.headers()).catch((err) => {
|
|
102
|
+
const error = err;
|
|
149
103
|
if (error.status === 404)
|
|
150
104
|
return { type: 'free' };
|
|
151
105
|
else
|
|
152
106
|
throw err;
|
|
153
107
|
});
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
return [2 /*return*/, this.client.get("/prices?".concat(query.toString()), this.headers())];
|
|
165
|
-
});
|
|
166
|
-
});
|
|
167
|
-
};
|
|
168
|
-
Payments.prototype.requestPreventCancellation = function () {
|
|
108
|
+
}
|
|
109
|
+
async getPrices(currency, userType) {
|
|
110
|
+
const query = new URLSearchParams();
|
|
111
|
+
if (currency !== undefined)
|
|
112
|
+
query.set('currency', currency);
|
|
113
|
+
if (userType)
|
|
114
|
+
query.set('userType', userType);
|
|
115
|
+
return this.client.get(`/prices?${query.toString()}`, this.headers());
|
|
116
|
+
}
|
|
117
|
+
requestPreventCancellation() {
|
|
169
118
|
return this.client.get('/request-prevent-cancellation', this.headers());
|
|
170
|
-
}
|
|
171
|
-
|
|
119
|
+
}
|
|
120
|
+
preventCancellation() {
|
|
172
121
|
return this.client.put('/prevent-cancellation', {}, this.headers());
|
|
173
|
-
}
|
|
174
|
-
|
|
122
|
+
}
|
|
123
|
+
applyRedeemCode(payload) {
|
|
175
124
|
return this.client.post('/licenses', { code: payload.code, provider: payload.provider }, this.headers());
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
return this.client.post('/subscriptions/update-payment-method',
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
Payments.prototype.updateWorkspaceMembers = function (workspaceId, subscriptionId, updatedSeats) {
|
|
125
|
+
}
|
|
126
|
+
updateSubscriptionPaymentMethod(payload) {
|
|
127
|
+
return this.client.post('/subscriptions/update-payment-method', { ...payload }, this.headers());
|
|
128
|
+
}
|
|
129
|
+
updateSubscriptionPrice({ priceId, couponCode, userType, }) {
|
|
130
|
+
return this.client.put('/subscriptions', { price_id: priceId, couponCode: couponCode, userType }, this.headers());
|
|
131
|
+
}
|
|
132
|
+
updateWorkspaceMembers(workspaceId, subscriptionId, updatedSeats) {
|
|
185
133
|
return this.client.patch('/business/subscription', {
|
|
186
|
-
workspaceId
|
|
187
|
-
subscriptionId
|
|
134
|
+
workspaceId,
|
|
135
|
+
subscriptionId,
|
|
188
136
|
workspaceUpdatedSeats: updatedSeats,
|
|
189
137
|
}, this.headers());
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
|
|
138
|
+
}
|
|
139
|
+
cancelSubscription(userType) {
|
|
140
|
+
const query = new URLSearchParams();
|
|
193
141
|
if (userType)
|
|
194
142
|
query.set('userType', userType);
|
|
195
|
-
return this.client.delete(
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
return this.client.post('/checkout-session',
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
return this.client.patch('/billing',
|
|
202
|
-
}
|
|
143
|
+
return this.client.delete(`/subscriptions?${query.toString()}`, this.headers());
|
|
144
|
+
}
|
|
145
|
+
createCheckoutSession(payload) {
|
|
146
|
+
return this.client.post('/checkout-session', { ...payload }, this.headers());
|
|
147
|
+
}
|
|
148
|
+
updateCustomerBillingInfo(payload) {
|
|
149
|
+
return this.client.patch('/billing', { ...payload }, this.headers());
|
|
150
|
+
}
|
|
203
151
|
/**
|
|
204
152
|
* Gets the available products from the user
|
|
205
153
|
* @returns an object containing available products
|
|
206
154
|
*/
|
|
207
|
-
|
|
155
|
+
checkUserAvailableProducts() {
|
|
208
156
|
return this.client.get('/products', this.headers());
|
|
209
|
-
}
|
|
157
|
+
}
|
|
210
158
|
/**
|
|
211
159
|
* Gets product information based on the user's subscription tier.
|
|
212
160
|
*
|
|
@@ -223,17 +171,17 @@ var Payments = /** @class */ (function () {
|
|
|
223
171
|
* // Get products for a business user tier
|
|
224
172
|
* const businessProducts = await getUserTier(UserType.Business);
|
|
225
173
|
*/
|
|
226
|
-
|
|
227
|
-
|
|
174
|
+
getUserTier(userType) {
|
|
175
|
+
const query = new URLSearchParams();
|
|
228
176
|
if (userType !== undefined)
|
|
229
177
|
query.set('tierType', userType);
|
|
230
|
-
return this.client.get(
|
|
231
|
-
}
|
|
178
|
+
return this.client.get(`/products/tier?${query.toString()}`, this.headers());
|
|
179
|
+
}
|
|
232
180
|
/**
|
|
233
181
|
* Returns the needed headers for the module requests
|
|
234
182
|
* @private
|
|
235
183
|
*/
|
|
236
|
-
|
|
184
|
+
headers() {
|
|
237
185
|
return (0, headers_1.headersWithToken)({
|
|
238
186
|
clientName: this.appDetails.clientName,
|
|
239
187
|
clientVersion: this.appDetails.clientVersion,
|
|
@@ -242,7 +190,6 @@ var Payments = /** @class */ (function () {
|
|
|
242
190
|
desktopToken: this.appDetails.desktopHeader,
|
|
243
191
|
customHeaders: this.appDetails.customHeaders,
|
|
244
192
|
});
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
}());
|
|
193
|
+
}
|
|
194
|
+
}
|
|
248
195
|
exports.Payments = Payments;
|
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ObjectStorage = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
const headers_1 = require("../../shared/headers");
|
|
5
|
+
const client_1 = require("../../shared/http/client");
|
|
6
|
+
class ObjectStorage {
|
|
7
|
+
client;
|
|
8
|
+
appDetails;
|
|
9
|
+
static client(apiUrl, appDetails) {
|
|
10
|
+
return new ObjectStorage(apiUrl, appDetails);
|
|
11
|
+
}
|
|
12
|
+
constructor(apiUrl, appDetails) {
|
|
8
13
|
this.client = client_1.HttpClient.create(apiUrl);
|
|
9
14
|
this.appDetails = appDetails;
|
|
10
15
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
14
|
-
ObjectStorage.prototype.getObjectStoragePlanById = function (priceId, currency) {
|
|
15
|
-
var query = new URLSearchParams();
|
|
16
|
+
getObjectStoragePlanById(priceId, currency) {
|
|
17
|
+
const query = new URLSearchParams();
|
|
16
18
|
query.set('planId', priceId);
|
|
17
19
|
if (currency !== undefined) {
|
|
18
20
|
query.set('currency', currency);
|
|
19
21
|
}
|
|
20
|
-
return this.client.get(
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
var query = new URLSearchParams();
|
|
22
|
+
return this.client.get(`/object-storage/price?${query.toString()}`, this.headers());
|
|
23
|
+
}
|
|
24
|
+
getObjectStorageCustomerId({ customerName, email, country, postalCode, companyVatId, }) {
|
|
25
|
+
const query = new URLSearchParams();
|
|
25
26
|
query.set('customerName', customerName);
|
|
26
27
|
query.set('email', email);
|
|
27
28
|
query.set('postalCode', postalCode);
|
|
@@ -29,36 +30,33 @@ var ObjectStorage = /** @class */ (function () {
|
|
|
29
30
|
if (companyVatId !== undefined) {
|
|
30
31
|
query.set('companyVatId', companyVatId);
|
|
31
32
|
}
|
|
32
|
-
return this.client.get(
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
var customerId = _a.customerId, priceId = _a.priceId, currency = _a.currency, token = _a.token, promoCodeId = _a.promoCodeId;
|
|
33
|
+
return this.client.get(`/object-storage/customer?${query.toString()}`, this.headers());
|
|
34
|
+
}
|
|
35
|
+
createObjectStorageSubscription({ customerId, priceId, currency, token, promoCodeId, }) {
|
|
36
36
|
return this.client.post('/object-storage/subscription', {
|
|
37
|
-
customerId
|
|
38
|
-
priceId
|
|
39
|
-
currency
|
|
40
|
-
token
|
|
41
|
-
promoCodeId
|
|
37
|
+
customerId,
|
|
38
|
+
priceId,
|
|
39
|
+
currency,
|
|
40
|
+
token,
|
|
41
|
+
promoCodeId,
|
|
42
42
|
}, this.headers());
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
var customerId = _a.customerId, token = _a.token, _b = _a.currency, currency = _b === void 0 ? 'eur' : _b, priceId = _a.priceId, paymentMethod = _a.paymentMethod;
|
|
43
|
+
}
|
|
44
|
+
paymentMethodVerification({ customerId, token, currency = 'eur', priceId, paymentMethod, }) {
|
|
46
45
|
return this.client.post('/payment-method-verification', {
|
|
47
|
-
customerId
|
|
48
|
-
token
|
|
49
|
-
currency
|
|
50
|
-
priceId
|
|
51
|
-
paymentMethod
|
|
46
|
+
customerId,
|
|
47
|
+
token,
|
|
48
|
+
currency,
|
|
49
|
+
priceId,
|
|
50
|
+
paymentMethod,
|
|
52
51
|
}, this.headers());
|
|
53
|
-
}
|
|
54
|
-
|
|
52
|
+
}
|
|
53
|
+
headers() {
|
|
55
54
|
return (0, headers_1.basicHeaders)({
|
|
56
55
|
clientName: this.appDetails.clientName,
|
|
57
56
|
clientVersion: this.appDetails.clientVersion,
|
|
58
57
|
desktopToken: this.appDetails.desktopHeader,
|
|
59
58
|
customHeaders: this.appDetails.customHeaders,
|
|
60
59
|
});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
}());
|
|
60
|
+
}
|
|
61
|
+
}
|
|
64
62
|
exports.ObjectStorage = ObjectStorage;
|