@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.
Files changed (93) hide show
  1. package/dist/auth/index.d.ts +127 -122
  2. package/dist/auth/index.js +378 -310
  3. package/dist/auth/types.d.ts +67 -54
  4. package/dist/auth/types.js +26 -26
  5. package/dist/drive/backups/index.d.ts +18 -18
  6. package/dist/drive/backups/index.js +40 -40
  7. package/dist/drive/backups/types.d.ts +27 -27
  8. package/dist/drive/backups/types.js +2 -2
  9. package/dist/drive/index.d.ts +7 -7
  10. package/dist/drive/index.js +23 -19
  11. package/dist/drive/payments/index.d.ts +66 -71
  12. package/dist/drive/payments/index.js +206 -208
  13. package/dist/drive/payments/types.d.ts +180 -176
  14. package/dist/drive/payments/types.js +37 -37
  15. package/dist/drive/referrals/index.d.ts +19 -19
  16. package/dist/drive/referrals/index.js +54 -50
  17. package/dist/drive/referrals/types.d.ts +21 -21
  18. package/dist/drive/referrals/types.js +18 -18
  19. package/dist/drive/share/index.d.ts +319 -319
  20. package/dist/drive/share/index.js +544 -540
  21. package/dist/drive/share/types.d.ts +360 -360
  22. package/dist/drive/share/types.js +2 -2
  23. package/dist/drive/storage/index.d.ts +315 -315
  24. package/dist/drive/storage/index.js +634 -630
  25. package/dist/drive/storage/types.d.ts +480 -473
  26. package/dist/drive/storage/types.js +13 -13
  27. package/dist/drive/trash/index.d.ts +75 -75
  28. package/dist/drive/trash/index.js +184 -180
  29. package/dist/drive/trash/types.d.ts +29 -29
  30. package/dist/drive/trash/types.js +2 -2
  31. package/dist/drive/users/index.d.ts +135 -135
  32. package/dist/drive/users/index.js +208 -204
  33. package/dist/drive/users/types.d.ts +53 -51
  34. package/dist/drive/users/types.js +2 -2
  35. package/dist/index.d.ts +6 -6
  36. package/dist/index.js +35 -31
  37. package/dist/network/download.d.ts +8 -8
  38. package/dist/network/download.js +123 -123
  39. package/dist/network/errors/codes.d.ts +24 -24
  40. package/dist/network/errors/codes.js +48 -48
  41. package/dist/network/errors/context.d.ts +35 -35
  42. package/dist/network/errors/context.js +39 -39
  43. package/dist/network/errors/download.d.ts +4 -4
  44. package/dist/network/errors/download.js +52 -48
  45. package/dist/network/errors/index.d.ts +3 -3
  46. package/dist/network/errors/index.js +19 -15
  47. package/dist/network/errors/upload.d.ts +13 -13
  48. package/dist/network/errors/upload.js +82 -78
  49. package/dist/network/index.d.ts +70 -70
  50. package/dist/network/index.js +315 -311
  51. package/dist/network/types.d.ts +102 -102
  52. package/dist/network/types.js +18 -18
  53. package/dist/network/upload.d.ts +4 -4
  54. package/dist/network/upload.js +158 -159
  55. package/dist/photos/devices/index.d.ts +10 -10
  56. package/dist/photos/devices/index.js +79 -79
  57. package/dist/photos/index.d.ts +17 -17
  58. package/dist/photos/index.js +56 -52
  59. package/dist/photos/photos/index.d.ts +60 -60
  60. package/dist/photos/photos/index.js +225 -225
  61. package/dist/photos/shares/index.d.ts +8 -8
  62. package/dist/photos/shares/index.js +34 -34
  63. package/dist/photos/types.d.ts +154 -154
  64. package/dist/photos/types.js +19 -19
  65. package/dist/photos/users/index.d.ts +7 -7
  66. package/dist/photos/users/index.js +46 -46
  67. package/dist/shared/headers/index.d.ts +21 -21
  68. package/dist/shared/headers/index.js +78 -79
  69. package/dist/shared/http/client.d.ts +85 -85
  70. package/dist/shared/http/client.js +172 -172
  71. package/dist/shared/http/types.d.ts +7 -7
  72. package/dist/shared/http/types.js +2 -2
  73. package/dist/shared/index.d.ts +1 -1
  74. package/dist/shared/index.js +17 -13
  75. package/dist/shared/types/apiConnection.d.ts +12 -12
  76. package/dist/shared/types/apiConnection.js +2 -2
  77. package/dist/shared/types/appsumo.d.ts +16 -16
  78. package/dist/shared/types/appsumo.js +12 -12
  79. package/dist/shared/types/errors.d.ts +5 -5
  80. package/dist/shared/types/errors.js +28 -28
  81. package/dist/shared/types/teams.d.ts +9 -9
  82. package/dist/shared/types/teams.js +2 -2
  83. package/dist/shared/types/userSettings.d.ts +43 -29
  84. package/dist/shared/types/userSettings.js +2 -2
  85. package/dist/utils.d.ts +3 -3
  86. package/dist/utils.js +24 -25
  87. package/dist/workspaces/index.d.ts +176 -176
  88. package/dist/workspaces/index.js +419 -415
  89. package/dist/workspaces/index.test.d.ts +1 -1
  90. package/dist/workspaces/index.test.js +908 -903
  91. package/dist/workspaces/types.d.ts +294 -291
  92. package/dist/workspaces/types.js +2 -2
  93. package/package.json +13 -13
@@ -1,54 +1,67 @@
1
- import { UUID, UserSettings } from '../shared/types/userSettings';
2
- export declare type Password = string;
3
- export declare type Email = string;
4
- export declare type Token = string;
5
- export interface LoginDetails {
6
- email: Email;
7
- password: Password;
8
- tfaCode: string | undefined;
9
- }
10
- export interface RegisterDetails {
11
- name: string;
12
- lastname: string;
13
- email: Email;
14
- password: Password;
15
- mnemonic: string;
16
- salt: string;
17
- keys: Keys;
18
- captcha: string;
19
- referrer?: string;
20
- referral?: string;
21
- }
22
- export interface RegisterPreCreatedUser extends RegisterDetails {
23
- invitationId: string;
24
- }
25
- export interface RegisterPreCreatedUserResponse {
26
- token: Token;
27
- user: UserSettings & {
28
- referralCode: string;
29
- };
30
- uuid: UUID;
31
- }
32
- export interface Keys {
33
- privateKeyEncrypted: string;
34
- publicKey: string;
35
- revocationCertificate: string;
36
- }
37
- export interface CryptoProvider {
38
- encryptPasswordHash: (password: Password, encryptedSalt: string) => string;
39
- generateKeys: (password: Password) => Promise<Keys>;
40
- }
41
- export declare class UserAccessError extends Error {
42
- }
43
- export interface SecurityDetails {
44
- encryptedSalt: string;
45
- tfaEnabled: boolean;
46
- }
47
- export interface TwoFactorAuthQR {
48
- qr: string;
49
- backupKey: string;
50
- }
51
- export interface BasicAuth {
52
- username: string;
53
- password: string;
54
- }
1
+ import { UUID, UserSettings } from '../shared/types/userSettings';
2
+ export type Password = string;
3
+ export type Email = string;
4
+ export type Token = string;
5
+ export interface LoginDetails {
6
+ email: Email;
7
+ password: Password;
8
+ tfaCode: string | undefined;
9
+ }
10
+ export interface RegisterDetails {
11
+ name: string;
12
+ lastname: string;
13
+ email: Email;
14
+ password: Password;
15
+ mnemonic: string;
16
+ salt: string;
17
+ keys: Keys;
18
+ captcha: string;
19
+ referrer?: string;
20
+ referral?: string;
21
+ }
22
+ export interface RegisterPreCreatedUser extends RegisterDetails {
23
+ invitationId: string;
24
+ }
25
+ export interface RegisterPreCreatedUserResponse {
26
+ token: Token;
27
+ user: UserSettings & {
28
+ referralCode: string;
29
+ };
30
+ uuid: UUID;
31
+ }
32
+ export interface Keys {
33
+ /**
34
+ / @deprecated The individual fields for keys should not be used
35
+ */
36
+ privateKeyEncrypted: string;
37
+ publicKey: string;
38
+ revocationCertificate: string;
39
+ keys: {
40
+ ecc: {
41
+ privateKeyEncrypted: string;
42
+ publicKey: string;
43
+ };
44
+ kyber: {
45
+ publicKey: string;
46
+ privateKeyEncrypted: string;
47
+ };
48
+ };
49
+ }
50
+ export interface CryptoProvider {
51
+ encryptPasswordHash: (password: Password, encryptedSalt: string) => Promise<string>;
52
+ generateKeys: (password: Password) => Promise<Keys>;
53
+ }
54
+ export declare class UserAccessError extends Error {
55
+ }
56
+ export interface SecurityDetails {
57
+ encryptedSalt: string;
58
+ tfaEnabled: boolean;
59
+ }
60
+ export interface TwoFactorAuthQR {
61
+ qr: string;
62
+ backupKey: string;
63
+ }
64
+ export interface BasicAuth {
65
+ username: string;
66
+ password: string;
67
+ }
@@ -1,26 +1,26 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.UserAccessError = void 0;
19
- var UserAccessError = /** @class */ (function (_super) {
20
- __extends(UserAccessError, _super);
21
- function UserAccessError() {
22
- return _super !== null && _super.apply(this, arguments) || this;
23
- }
24
- return UserAccessError;
25
- }(Error));
26
- exports.UserAccessError = UserAccessError;
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
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.UserAccessError = void 0;
19
+ var UserAccessError = /** @class */ (function (_super) {
20
+ __extends(UserAccessError, _super);
21
+ function UserAccessError() {
22
+ return _super !== null && _super.apply(this, arguments) || this;
23
+ }
24
+ return UserAccessError;
25
+ }(Error));
26
+ exports.UserAccessError = UserAccessError;
@@ -1,18 +1,18 @@
1
- import { ApiSecurity, ApiUrl, AppDetails } from '../../shared';
2
- import { Device, DeviceBackup } from './types';
3
- export declare class Backups {
4
- private readonly client;
5
- private readonly appDetails;
6
- private readonly apiSecurity;
7
- static client(apiUrl: ApiUrl, appDetails: AppDetails, apiSecurity: ApiSecurity): Backups;
8
- private constructor();
9
- getAllDevices(): Promise<Device[]>;
10
- getAllBackups(mac: string): Promise<DeviceBackup[]>;
11
- deleteBackup(backupId: number): Promise<void>;
12
- deleteDevice(deviceId: number): Promise<void>;
13
- /**
14
- * Returns the needed headers for the module requests
15
- * @private
16
- */
17
- private headers;
18
- }
1
+ import { ApiSecurity, ApiUrl, AppDetails } from '../../shared';
2
+ import { Device, DeviceBackup } from './types';
3
+ export declare class Backups {
4
+ private readonly client;
5
+ private readonly appDetails;
6
+ private readonly apiSecurity;
7
+ static client(apiUrl: ApiUrl, appDetails: AppDetails, apiSecurity: ApiSecurity): Backups;
8
+ private constructor();
9
+ getAllDevices(): Promise<Device[]>;
10
+ getAllBackups(mac: string): Promise<DeviceBackup[]>;
11
+ deleteBackup(backupId: number): Promise<void>;
12
+ deleteDevice(deviceId: number): Promise<void>;
13
+ /**
14
+ * Returns the needed headers for the module requests
15
+ * @private
16
+ */
17
+ private headers;
18
+ }
@@ -1,40 +1,40 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Backups = void 0;
4
- var client_1 = require("../../shared/http/client");
5
- var headers_1 = require("../../shared/headers");
6
- var Backups = /** @class */ (function () {
7
- function Backups(apiUrl, appDetails, apiSecurity) {
8
- this.client = client_1.HttpClient.create(apiUrl, apiSecurity.unauthorizedCallback);
9
- this.appDetails = appDetails;
10
- this.apiSecurity = apiSecurity;
11
- }
12
- Backups.client = function (apiUrl, appDetails, apiSecurity) {
13
- return new Backups(apiUrl, appDetails, apiSecurity);
14
- };
15
- Backups.prototype.getAllDevices = function () {
16
- return this.client
17
- .get('/backup/device', this.headers());
18
- };
19
- Backups.prototype.getAllBackups = function (mac) {
20
- return this.client
21
- .get("/backup/" + mac, this.headers());
22
- };
23
- Backups.prototype.deleteBackup = function (backupId) {
24
- return this.client
25
- .delete("/backup/" + backupId, this.headers());
26
- };
27
- Backups.prototype.deleteDevice = function (deviceId) {
28
- return this.client
29
- .delete("/backup/device/" + deviceId, this.headers());
30
- };
31
- /**
32
- * Returns the needed headers for the module requests
33
- * @private
34
- */
35
- Backups.prototype.headers = function () {
36
- return (0, headers_1.headersWithToken)(this.appDetails.clientName, this.appDetails.clientVersion, this.apiSecurity.token);
37
- };
38
- return Backups;
39
- }());
40
- exports.Backups = Backups;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Backups = void 0;
4
+ var client_1 = require("../../shared/http/client");
5
+ var headers_1 = require("../../shared/headers");
6
+ var Backups = /** @class */ (function () {
7
+ function Backups(apiUrl, appDetails, apiSecurity) {
8
+ this.client = client_1.HttpClient.create(apiUrl, apiSecurity.unauthorizedCallback);
9
+ this.appDetails = appDetails;
10
+ this.apiSecurity = apiSecurity;
11
+ }
12
+ Backups.client = function (apiUrl, appDetails, apiSecurity) {
13
+ return new Backups(apiUrl, appDetails, apiSecurity);
14
+ };
15
+ Backups.prototype.getAllDevices = function () {
16
+ return this.client
17
+ .get('/backup/device', this.headers());
18
+ };
19
+ Backups.prototype.getAllBackups = function (mac) {
20
+ return this.client
21
+ .get("/backup/".concat(mac), this.headers());
22
+ };
23
+ Backups.prototype.deleteBackup = function (backupId) {
24
+ return this.client
25
+ .delete("/backup/".concat(backupId), this.headers());
26
+ };
27
+ Backups.prototype.deleteDevice = function (deviceId) {
28
+ return this.client
29
+ .delete("/backup/device/".concat(deviceId), this.headers());
30
+ };
31
+ /**
32
+ * Returns the needed headers for the module requests
33
+ * @private
34
+ */
35
+ Backups.prototype.headers = function () {
36
+ return (0, headers_1.headersWithToken)(this.appDetails.clientName, this.appDetails.clientVersion, this.apiSecurity.token);
37
+ };
38
+ return Backups;
39
+ }());
40
+ exports.Backups = Backups;
@@ -1,27 +1,27 @@
1
- export interface Device {
2
- id: number;
3
- name: string;
4
- mac: string;
5
- userId: number;
6
- createdAt: string;
7
- updatedAt: string;
8
- size: number;
9
- platform: string | null;
10
- }
11
- export interface DeviceBackup {
12
- id: number;
13
- path: string;
14
- name: string;
15
- fileId?: string;
16
- deviceId: number;
17
- userId: number;
18
- interval: number;
19
- size?: number;
20
- bucket: string;
21
- createdAt: string;
22
- updatedAt: string;
23
- encrypt_version: string;
24
- hash?: string;
25
- enabled: boolean;
26
- lastBackupAt?: string;
27
- }
1
+ export interface Device {
2
+ id: number;
3
+ name: string;
4
+ mac: string;
5
+ userId: number;
6
+ createdAt: string;
7
+ updatedAt: string;
8
+ size: number;
9
+ platform: string | null;
10
+ }
11
+ export interface DeviceBackup {
12
+ id: number;
13
+ path: string;
14
+ name: string;
15
+ fileId?: string;
16
+ deviceId: number;
17
+ userId: number;
18
+ interval: number;
19
+ size?: number;
20
+ bucket: string;
21
+ createdAt: string;
22
+ updatedAt: string;
23
+ encrypt_version: string;
24
+ hash?: string;
25
+ enabled: boolean;
26
+ lastBackupAt?: string;
27
+ }
@@ -1,2 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,7 +1,7 @@
1
- export * from './storage';
2
- export * from './share';
3
- export * from './users';
4
- export * from './referrals';
5
- export * from './payments';
6
- export * from './backups';
7
- export * from './trash';
1
+ export * from './storage';
2
+ export * from './share';
3
+ export * from './users';
4
+ export * from './referrals';
5
+ export * from './payments';
6
+ export * from './backups';
7
+ export * from './trash';
@@ -1,19 +1,23 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- __exportStar(require("./storage"), exports);
14
- __exportStar(require("./share"), exports);
15
- __exportStar(require("./users"), exports);
16
- __exportStar(require("./referrals"), exports);
17
- __exportStar(require("./payments"), exports);
18
- __exportStar(require("./backups"), exports);
19
- __exportStar(require("./trash"), exports);
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("./storage"), exports);
18
+ __exportStar(require("./share"), exports);
19
+ __exportStar(require("./users"), exports);
20
+ __exportStar(require("./referrals"), exports);
21
+ __exportStar(require("./payments"), exports);
22
+ __exportStar(require("./backups"), exports);
23
+ __exportStar(require("./trash"), exports);
@@ -1,71 +1,66 @@
1
- import { ApiSecurity, ApiUrl, AppDetails } from '../../shared';
2
- import { CreateCheckoutSessionPayload, CreatedSubscriptionData, CreatePaymentSessionPayload, CustomerBillingInfo, DisplayPrice, FreeTrialAvailable, Invoice, InvoicePayload, PaymentMethod, ProductData, RedeemCodePayload, UpdateSubscriptionPaymentMethod, UserSubscription, UserType } from './types';
3
- export declare class Payments {
4
- private readonly client;
5
- private readonly appDetails;
6
- private readonly apiSecurity;
7
- static client(apiUrl: ApiUrl, appDetails: AppDetails, apiSecurity: ApiSecurity): Payments;
8
- private constructor();
9
- createCustomer(name: string, email: string, country?: string, companyVatId?: string): Promise<{
10
- customerId: string;
11
- token: string;
12
- }>;
13
- createSubscription(customerId: string, priceId: string, token: string, quantity: number, currency?: string, promoCodeId?: string): Promise<CreatedSubscriptionData>;
14
- createPaymentIntent(customerId: string, amount: number, planId: string, token: string, currency?: string, promoCodeName?: string): Promise<{
15
- clientSecret: string;
16
- id: string;
17
- invoiceStatus?: string;
18
- }>;
19
- /**
20
- * Fetches the existing products and its details
21
- */
22
- getProducts(): Promise<ProductData[]>;
23
- /**
24
- * Creates and returns a new session identifier for the client to go to payment platform
25
- * @param payload
26
- */
27
- createSession(payload: CreatePaymentSessionPayload): Promise<{
28
- id: string;
29
- }>;
30
- getSetupIntent(userType?: UserType): Promise<{
31
- clientSecret: string;
32
- }>;
33
- getDefaultPaymentMethod(userType?: UserType): Promise<PaymentMethod>;
34
- getInvoices({ subscriptionId, startingAfter, limit }: InvoicePayload): Promise<Invoice[]>;
35
- isCouponUsedByUser({ couponCode }: {
36
- couponCode: string;
37
- }): Promise<{
38
- couponUsed: boolean;
39
- }>;
40
- getUserSubscription(userType?: UserType): Promise<UserSubscription>;
41
- getPrices(currency?: string, userType?: UserType): Promise<DisplayPrice[]>;
42
- requestPreventCancellation(): Promise<FreeTrialAvailable>;
43
- preventCancellation(): Promise<void>;
44
- applyRedeemCode(payload: RedeemCodePayload): Promise<void>;
45
- updateSubscriptionPaymentMethod(payload: UpdateSubscriptionPaymentMethod): Promise<void | Error>;
46
- updateSubscriptionPrice({ priceId, couponCode, userType, }: {
47
- priceId: string;
48
- couponCode?: string;
49
- userType: UserType;
50
- }): Promise<{
51
- userSubscription: UserSubscription;
52
- request3DSecure: boolean;
53
- clientSecret: string;
54
- }>;
55
- cancelSubscription(userType?: UserType): Promise<void>;
56
- createCheckoutSession(payload: CreateCheckoutSessionPayload): Promise<{
57
- sessionId: string;
58
- }>;
59
- updateCustomerBillingInfo(payload: CustomerBillingInfo): Promise<void>;
60
- getPaypalSetupIntent({ priceId, coupon, }: {
61
- priceId: string;
62
- coupon?: string;
63
- }): Promise<{
64
- client_secret: string;
65
- }>;
66
- /**
67
- * Returns the needed headers for the module requests
68
- * @private
69
- */
70
- private headers;
71
- }
1
+ import { ApiSecurity, ApiUrl, AppDetails } from '../../shared';
2
+ import { CreateCheckoutSessionPayload, CreatedSubscriptionData, CreatePaymentSessionPayload, CustomerBillingInfo, DisplayPrice, FreeTrialAvailable, Invoice, InvoicePayload, PaymentMethod, ProductData, RedeemCodePayload, UpdateSubscriptionPaymentMethod, UserSubscription, UserType } from './types';
3
+ export declare class Payments {
4
+ private readonly client;
5
+ private readonly appDetails;
6
+ private readonly apiSecurity;
7
+ static client(apiUrl: ApiUrl, appDetails: AppDetails, apiSecurity: ApiSecurity): Payments;
8
+ private constructor();
9
+ createCustomer(name: string, email: string, country?: string, companyVatId?: string): Promise<{
10
+ customerId: string;
11
+ token: string;
12
+ }>;
13
+ createSubscription(customerId: string, priceId: string, token: string, quantity: number, currency?: string, promoCodeId?: string): Promise<CreatedSubscriptionData>;
14
+ createPaymentIntent(customerId: string, amount: number, planId: string, token: string, currency?: string, promoCodeName?: string): Promise<{
15
+ clientSecret: string;
16
+ id: string;
17
+ invoiceStatus?: string;
18
+ }>;
19
+ /**
20
+ * Fetches the existing products and its details
21
+ */
22
+ getProducts(): Promise<ProductData[]>;
23
+ /**
24
+ * Creates and returns a new session identifier for the client to go to payment platform
25
+ * @param payload
26
+ */
27
+ createSession(payload: CreatePaymentSessionPayload): Promise<{
28
+ id: string;
29
+ }>;
30
+ getSetupIntent(userType?: UserType): Promise<{
31
+ clientSecret: string;
32
+ }>;
33
+ getDefaultPaymentMethod(userType?: UserType): Promise<PaymentMethod>;
34
+ getInvoices({ subscriptionId, startingAfter, limit }: InvoicePayload): Promise<Invoice[]>;
35
+ isCouponUsedByUser({ couponCode }: {
36
+ couponCode: string;
37
+ }): Promise<{
38
+ couponUsed: boolean;
39
+ }>;
40
+ getUserSubscription(userType?: UserType): Promise<UserSubscription>;
41
+ getPrices(currency?: string, userType?: UserType): Promise<DisplayPrice[]>;
42
+ requestPreventCancellation(): Promise<FreeTrialAvailable>;
43
+ preventCancellation(): Promise<void>;
44
+ applyRedeemCode(payload: RedeemCodePayload): Promise<void>;
45
+ updateSubscriptionPaymentMethod(payload: UpdateSubscriptionPaymentMethod): Promise<void | Error>;
46
+ updateSubscriptionPrice({ priceId, couponCode, userType, }: {
47
+ priceId: string;
48
+ couponCode?: string;
49
+ userType: UserType;
50
+ }): Promise<{
51
+ userSubscription: UserSubscription;
52
+ request3DSecure: boolean;
53
+ clientSecret: string;
54
+ }>;
55
+ updateWorkspaceMembers(workspaceId: string, subscriptionId: string, updatedSeats: number): Promise<unknown>;
56
+ cancelSubscription(userType?: UserType): Promise<void>;
57
+ createCheckoutSession(payload: CreateCheckoutSessionPayload): Promise<{
58
+ sessionId: string;
59
+ }>;
60
+ updateCustomerBillingInfo(payload: CustomerBillingInfo): Promise<void>;
61
+ /**
62
+ * Returns the needed headers for the module requests
63
+ * @private
64
+ */
65
+ private headers;
66
+ }