@internxt/sdk 1.9.16 → 1.9.18

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.
@@ -183,6 +183,11 @@ export type CreatedSubscriptionData = {
183
183
  subscriptionId?: string;
184
184
  paymentIntentId?: string;
185
185
  };
186
+ export type CreatedPaymentIntent = {
187
+ clientSecret: string;
188
+ id: string;
189
+ invoiceStatus?: string;
190
+ };
186
191
  export type AvailableProducts = {
187
192
  featuresPerService: {
188
193
  antivirus: boolean;
@@ -3,7 +3,7 @@ import { ApiSecurity, ApiUrl, AppDetails } from '../../shared';
3
3
  import { RequestCanceler } from '../../shared/http/client';
4
4
  import { UUID } from '../../shared/types/userSettings';
5
5
  import { ItemType } from './../../workspaces/types';
6
- import { AddItemsToTrashPayload, CheckDuplicatedFilesPayload, CheckDuplicatedFilesResponse, CheckDuplicatedFolderPayload, CheckDuplicatedFoldersResponse, CreateFolderByUuidPayload, CreateFolderPayload, CreateFolderResponse, CreateThumbnailEntryPayload, DeleteFilePayload, DriveFileData, FetchFolderContentResponse, FetchLimitResponse, FetchPaginatedFilesContent, FetchPaginatedFolderContentResponse, FetchPaginatedFoldersContent, FileEntry, FileEntryByUuid, FileMeta, FolderAncestor, FolderAncestorWorkspace, FolderMeta, FolderTreeResponse, MoveFilePayload, MoveFileResponse, MoveFileUuidPayload, MoveFolderPayload, MoveFolderResponse, MoveFolderUuidPayload, ReplaceFile, SearchResultData, Thumbnail, ThumbnailEntry, UpdateFilePayload, UpdateFolderMetadataPayload, UsageResponse } from './types';
6
+ import { AddItemsToTrashPayload, CheckDuplicatedFilesPayload, CheckDuplicatedFilesResponse, CheckDuplicatedFolderPayload, CheckDuplicatedFoldersResponse, CreateFolderByUuidPayload, CreateFolderPayload, CreateFolderResponse, CreateThumbnailEntryPayload, DeleteFilePayload, DriveFileData, FetchFolderContentResponse, FetchLimitResponse, FetchPaginatedFilesContent, FetchPaginatedFolderContentResponse, FetchPaginatedFoldersContent, FileEntry, FileEntryByUuid, FileMeta, FolderAncestor, FolderAncestorWorkspace, FolderMeta, FolderTreeResponse, MoveFilePayload, MoveFileResponse, MoveFileUuidPayload, MoveFolderPayload, MoveFolderResponse, MoveFolderUuidPayload, ReplaceFile, SearchResultData, Thumbnail, ThumbnailEntry, UpdateFilePayload, UpdateFolderMetadataPayload, UsageResponse, UsageResponseV2 } from './types';
7
7
  export * as StorageTypes from './types';
8
8
  export declare class Storage {
9
9
  private readonly client;
@@ -227,12 +227,22 @@ export declare class Storage {
227
227
  searchItemsByName(plain_name: string): Promise<DriveFileData[]>;
228
228
  /**
229
229
  * Returns the current space usage of the user
230
+ * @deprecated use `spaceUsageV2` call instead.
230
231
  */
231
232
  spaceUsage(): Promise<UsageResponse>;
233
+ /**
234
+ * Returns the current space usage of the user
235
+ */
236
+ spaceUsageV2(): Promise<UsageResponseV2>;
232
237
  /**
233
238
  * Returns the current space limit for the user
239
+ * @deprecated use `spaceLimitV2` call instead.
234
240
  */
235
241
  spaceLimit(): Promise<FetchLimitResponse>;
242
+ /**
243
+ * Returns the current space limit for the user
244
+ */
245
+ spaceLimitV2(): Promise<FetchLimitResponse>;
236
246
  /**
237
247
  * Get global search items.
238
248
  *
@@ -493,16 +493,30 @@ var Storage = /** @class */ (function () {
493
493
  };
494
494
  /**
495
495
  * Returns the current space usage of the user
496
+ * @deprecated use `spaceUsageV2` call instead.
496
497
  */
497
498
  Storage.prototype.spaceUsage = function () {
498
499
  return this.client.get('/usage', this.headers());
499
500
  };
501
+ /**
502
+ * Returns the current space usage of the user
503
+ */
504
+ Storage.prototype.spaceUsageV2 = function () {
505
+ return this.client.get('/users/usage', this.headers());
506
+ };
500
507
  /**
501
508
  * Returns the current space limit for the user
509
+ * @deprecated use `spaceLimitV2` call instead.
502
510
  */
503
511
  Storage.prototype.spaceLimit = function () {
504
512
  return this.client.get('/limit', this.headers());
505
513
  };
514
+ /**
515
+ * Returns the current space limit for the user
516
+ */
517
+ Storage.prototype.spaceLimitV2 = function () {
518
+ return this.client.get('/users/limit', this.headers());
519
+ };
506
520
  /**
507
521
  * Get global search items.
508
522
  *
@@ -276,7 +276,6 @@ export interface ThumbnailEntry {
276
276
  encrypt_version: EncryptionVersion;
277
277
  }
278
278
  export interface CreateThumbnailEntryPayload {
279
- fileId: number;
280
279
  fileUuid: string;
281
280
  type: string;
282
281
  size: number;
@@ -366,6 +365,11 @@ export type UsageResponse = {
366
365
  } & {
367
366
  [k in 'drive' | 'backups' | 'total']: number;
368
367
  };
368
+ export type UsageResponseV2 = {
369
+ drive: number;
370
+ backups: number;
371
+ total: number;
372
+ };
369
373
  export interface FetchLimitResponse {
370
374
  maxSpaceBytes: number;
371
375
  }
package/dist/index.d.ts CHANGED
@@ -6,3 +6,4 @@ export * as Shared from './shared';
6
6
  export * as Workspaces from './workspaces';
7
7
  export * from './meet';
8
8
  export * as Payments from './payments';
9
+ export * from './misc';
package/dist/index.js CHANGED
@@ -35,3 +35,4 @@ exports.Shared = __importStar(require("./shared"));
35
35
  exports.Workspaces = __importStar(require("./workspaces"));
36
36
  __exportStar(require("./meet"), exports);
37
37
  exports.Payments = __importStar(require("./payments"));
38
+ __exportStar(require("./misc"), exports);
@@ -0,0 +1 @@
1
+ export * from './location';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./location"), exports);
@@ -0,0 +1,5 @@
1
+ export interface UserLocation {
2
+ ip: string;
3
+ location: string;
4
+ }
5
+ export declare const getUserLocation: (apiUrl: string) => Promise<UserLocation>;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ 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;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.getUserLocation = void 0;
40
+ var client_1 = require("../../shared/http/client");
41
+ var getUserLocation = function (apiUrl) { return __awaiter(void 0, void 0, void 0, function () {
42
+ var client;
43
+ return __generator(this, function (_a) {
44
+ client = client_1.HttpClient.create(apiUrl);
45
+ return [2 /*return*/, client.get("".concat(apiUrl), {})];
46
+ });
47
+ }); };
48
+ exports.getUserLocation = getUserLocation;
@@ -1,4 +1,4 @@
1
- import { CreatedSubscriptionData } from '../drive/payments/types/types';
1
+ import { CreatedPaymentIntent, CreatedSubscriptionData } from '../drive/payments/types/types';
2
2
  import { ApiSecurity, ApiUrl, AppDetails } from '../shared';
3
3
  import { CreatePaymentIntentPayload, CreateSubscriptionPayload, GetPriceByIdPayload, PriceWithTax } from './types';
4
4
  export declare class Checkout {
@@ -14,11 +14,11 @@ export declare class Checkout {
14
14
  * @param companyVatId - The VAT ID of the company (optional)
15
15
  * @returns The customer ID and the user token used to create a subscription or payment intent
16
16
  */
17
- getCustomerId({ country, postalCode, companyVatId, companyName, }: {
18
- country: string;
17
+ getCustomerId({ customerName, postalCode, country, companyVatId, }: {
18
+ customerName: string;
19
19
  postalCode: string;
20
+ country: string;
20
21
  companyVatId?: string;
21
- companyName?: string;
22
22
  }): Promise<{
23
23
  customerId: string;
24
24
  token: string;
@@ -50,11 +50,7 @@ export declare class Checkout {
50
50
  * - `id`: The ID of the invoice
51
51
  * - `invoiceStatus`: The status of the invoice (only when the status is 'paid')
52
52
  */
53
- createPaymentIntent({ customerId, priceId, token, currency, promoCodeId, }: CreatePaymentIntentPayload): Promise<{
54
- clientSecret: string;
55
- id: string;
56
- invoiceStatus?: string;
57
- }>;
53
+ createPaymentIntent({ customerId, priceId, token, currency, promoCodeId, }: CreatePaymentIntentPayload): Promise<CreatedPaymentIntent>;
58
54
  /**
59
55
  * @description Fetch a requested price by its ID and its tax rate
60
56
  * @param priceId - The ID of the price
@@ -31,14 +31,13 @@ var Checkout = /** @class */ (function () {
31
31
  * @returns The customer ID and the user token used to create a subscription or payment intent
32
32
  */
33
33
  Checkout.prototype.getCustomerId = function (_a) {
34
- var country = _a.country, postalCode = _a.postalCode, companyVatId = _a.companyVatId, companyName = _a.companyName;
34
+ var customerName = _a.customerName, postalCode = _a.postalCode, country = _a.country, companyVatId = _a.companyVatId;
35
35
  var query = new URLSearchParams();
36
+ query.set('customerName', customerName);
36
37
  query.set('country', country);
37
38
  query.set('postalCode', postalCode);
38
39
  if (companyVatId !== undefined)
39
40
  query.set('companyVatId', companyVatId);
40
- if (companyName !== undefined)
41
- query.set('companyName', companyName);
42
41
  return this.client.get("/checkout/customer?".concat(query.toString()), this.authHeaders());
43
42
  };
44
43
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@internxt/sdk",
3
3
  "author": "Internxt <hello@internxt.com>",
4
- "version": "1.9.16",
4
+ "version": "1.9.18",
5
5
  "description": "An sdk for interacting with Internxt's services",
6
6
  "repository": {
7
7
  "type": "git",