@internxt/sdk 1.9.16 → 1.9.17

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;
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.17",
5
5
  "description": "An sdk for interacting with Internxt's services",
6
6
  "repository": {
7
7
  "type": "git",