@paddle/paddle-node-sdk 2.0.0-rc.2 → 2.1.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.
Files changed (58) hide show
  1. package/CHANGELOG.md +10 -16
  2. package/dist/cjs/entities/customer-portal-session/customer-portal-session.js +13 -0
  3. package/dist/cjs/entities/customer-portal-session/customer-portal-subscription-url.js +11 -0
  4. package/dist/cjs/entities/customer-portal-session/general.js +9 -0
  5. package/dist/cjs/entities/customer-portal-session/index.js +18 -0
  6. package/dist/cjs/entities/customer-portal-session/urls.js +13 -0
  7. package/dist/cjs/entities/index.js +1 -0
  8. package/dist/cjs/internal/api/case-helpers.js +19 -32
  9. package/dist/cjs/paddle.js +1 -0
  10. package/dist/cjs/resources/customer-portal-sessions/index.js +32 -0
  11. package/dist/cjs/resources/customer-portal-sessions/operations/create-customer-portal-session-request-object.js +2 -0
  12. package/dist/cjs/resources/customer-portal-sessions/operations/index.js +17 -0
  13. package/dist/cjs/resources/index.js +1 -0
  14. package/dist/cjs/types/customer-portal-session/customer-portal-session-response.js +2 -0
  15. package/dist/cjs/types/customer-portal-session/customer-portal-subscription-url.js +2 -0
  16. package/dist/cjs/types/customer-portal-session/general.js +2 -0
  17. package/dist/cjs/types/customer-portal-session/index.js +20 -0
  18. package/dist/cjs/types/customer-portal-session/urls.js +2 -0
  19. package/dist/cjs/types/index.js +1 -0
  20. package/dist/cjs/version.js +1 -1
  21. package/dist/esm/entities/customer-portal-session/customer-portal-session.js +9 -0
  22. package/dist/esm/entities/customer-portal-session/customer-portal-subscription-url.js +7 -0
  23. package/dist/esm/entities/customer-portal-session/general.js +5 -0
  24. package/dist/esm/entities/customer-portal-session/index.js +2 -0
  25. package/dist/esm/entities/customer-portal-session/urls.js +9 -0
  26. package/dist/esm/entities/index.js +1 -0
  27. package/dist/esm/internal/api/case-helpers.js +19 -9
  28. package/dist/esm/paddle.js +2 -1
  29. package/dist/esm/resources/customer-portal-sessions/index.js +28 -0
  30. package/dist/esm/resources/customer-portal-sessions/operations/create-customer-portal-session-request-object.js +1 -0
  31. package/dist/esm/resources/customer-portal-sessions/operations/index.js +1 -0
  32. package/dist/esm/resources/index.js +1 -0
  33. package/dist/esm/types/customer-portal-session/customer-portal-session-response.js +1 -0
  34. package/dist/esm/types/customer-portal-session/customer-portal-subscription-url.js +1 -0
  35. package/dist/esm/types/customer-portal-session/general.js +1 -0
  36. package/dist/esm/types/customer-portal-session/index.js +4 -0
  37. package/dist/esm/types/customer-portal-session/urls.js +1 -0
  38. package/dist/esm/types/index.js +1 -0
  39. package/dist/esm/version.js +1 -1
  40. package/dist/types/entities/customer-portal-session/customer-portal-session.d.ts +9 -0
  41. package/dist/types/entities/customer-portal-session/customer-portal-subscription-url.d.ts +7 -0
  42. package/dist/types/entities/customer-portal-session/general.d.ts +5 -0
  43. package/dist/types/entities/customer-portal-session/index.d.ts +2 -0
  44. package/dist/types/entities/customer-portal-session/urls.d.ts +8 -0
  45. package/dist/types/entities/index.d.ts +1 -0
  46. package/dist/types/paddle.d.ts +2 -1
  47. package/dist/types/resources/customer-portal-sessions/index.d.ts +5 -0
  48. package/dist/types/resources/customer-portal-sessions/operations/create-customer-portal-session-request-object.d.ts +3 -0
  49. package/dist/types/resources/customer-portal-sessions/operations/index.d.ts +1 -0
  50. package/dist/types/resources/index.d.ts +1 -0
  51. package/dist/types/types/customer-portal-session/customer-portal-session-response.d.ts +7 -0
  52. package/dist/types/types/customer-portal-session/customer-portal-subscription-url.d.ts +5 -0
  53. package/dist/types/types/customer-portal-session/general.d.ts +3 -0
  54. package/dist/types/types/customer-portal-session/index.d.ts +4 -0
  55. package/dist/types/types/customer-portal-session/urls.d.ts +6 -0
  56. package/dist/types/types/index.d.ts +1 -0
  57. package/dist/types/version.d.ts +1 -1
  58. package/package.json +1 -4
package/CHANGELOG.md CHANGED
@@ -12,33 +12,27 @@ When we make [non-breaking changes](https://developer.paddle.com/api-reference/a
12
12
 
13
13
  This means when upgrading minor versions of the SDK, you may notice type errors. You can safely ignore these or fix by adding additional type guards.
14
14
 
15
- ## 2.0.0-rc.2 - 2024-11-19
15
+ ## 2.1.0 - 2024-11-21
16
16
 
17
17
  ### Added
18
18
 
19
- - Added the `trafficSource` filter on notification settings
20
- - Omitted the `transactionId` completely from `SubscriptionNotification` and created a separate `SubscriptionCreatedNotification` with the non-null `transactionId`
21
- - Added `paymentMethods` resources
22
- - Added `generateAuthToken` for customer
19
+ - Added `customerPortalSessions` resources
20
+
21
+ ## 2.0.0 - 2024-11-20
23
22
 
24
- ## 2.0.0-rc.1 - 2024-10-08
23
+ > **Breaking changes:** This version includes major improvements that introduce breaking changes. These are called out below.
25
24
 
26
25
  ### Added
27
26
 
27
+ - Added support for edge runtime.
28
28
  - Added `simulationTypes` resources
29
29
  - Added `simulations` resources
30
30
  - Added `simulationRuns` resources
31
31
  - Added `simulationRunEvents` resources
32
-
33
- ---
34
-
35
- ## 2.0.0-rc.0 - 2024-09-26
36
-
37
- > **Breaking changes:** This version includes major improvements that introduce breaking changes. These are called out below.
38
-
39
- ### Added
40
-
41
- - Added support for edge runtime.
32
+ - Added the `trafficSource` filter on notification settings
33
+ - Omitted the `transactionId` completely from `SubscriptionNotification` and created a separate `SubscriptionCreatedNotification` with the non-null `transactionId`
34
+ - Added `paymentMethods` resources
35
+ - Added `generateAuthToken` for customer
42
36
 
43
37
  ### Changed
44
38
 
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CustomerPortalSession = void 0;
4
+ const urls_js_1 = require("./urls.js");
5
+ class CustomerPortalSession {
6
+ constructor(customerPortalSessionResponse) {
7
+ this.id = customerPortalSessionResponse.id;
8
+ this.customerId = customerPortalSessionResponse.customer_id;
9
+ this.urls = new urls_js_1.Urls(customerPortalSessionResponse.urls);
10
+ this.createdAt = customerPortalSessionResponse.created_at;
11
+ }
12
+ }
13
+ exports.CustomerPortalSession = CustomerPortalSession;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CustomerPortalSubscriptionUrl = void 0;
4
+ class CustomerPortalSubscriptionUrl {
5
+ constructor(customerPortalSubscriptionUrlResponse) {
6
+ this.id = customerPortalSubscriptionUrlResponse.id;
7
+ this.cancelSubscription = customerPortalSubscriptionUrlResponse.cancel_subscription;
8
+ this.updateSubscriptionPaymentMethod = customerPortalSubscriptionUrlResponse.update_subscription_payment_method;
9
+ }
10
+ }
11
+ exports.CustomerPortalSubscriptionUrl = CustomerPortalSubscriptionUrl;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.General = void 0;
4
+ class General {
5
+ constructor(generalResponse) {
6
+ this.overview = generalResponse.overview;
7
+ }
8
+ }
9
+ exports.General = General;
@@ -0,0 +1,18 @@
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("./customer-portal-subscription-url.js"), exports);
18
+ __exportStar(require("./customer-portal-session.js"), exports);
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Urls = void 0;
4
+ const general_js_1 = require("./general.js");
5
+ const customer_portal_subscription_url_js_1 = require("./customer-portal-subscription-url.js");
6
+ class Urls {
7
+ constructor(urlsResponse) {
8
+ var _a;
9
+ this.general = new general_js_1.General(urlsResponse.general);
10
+ this.subscriptions = (_a = urlsResponse.subscriptions) === null || _a === void 0 ? void 0 : _a.map((subscription) => { var _a; return (_a = new customer_portal_subscription_url_js_1.CustomerPortalSubscriptionUrl(subscription)) !== null && _a !== void 0 ? _a : []; });
11
+ }
12
+ }
13
+ exports.Urls = Urls;
@@ -20,6 +20,7 @@ __exportStar(require("./price/index.js"), exports);
20
20
  __exportStar(require("./transaction/index.js"), exports);
21
21
  __exportStar(require("./adjustment/index.js"), exports);
22
22
  __exportStar(require("./customer/index.js"), exports);
23
+ __exportStar(require("./customer-portal-session/index.js"), exports);
23
24
  __exportStar(require("./business/index.js"), exports);
24
25
  __exportStar(require("./subscription/index.js"), exports);
25
26
  __exportStar(require("./address/index.js"), exports);
@@ -1,27 +1,4 @@
1
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  var __rest = (this && this.__rest) || function (s, e) {
26
3
  var t = {};
27
4
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -35,22 +12,32 @@ var __rest = (this && this.__rest) || function (s, e) {
35
12
  };
36
13
  Object.defineProperty(exports, "__esModule", { value: true });
37
14
  exports.convertToSnakeCase = void 0;
38
- const lodash = __importStar(require("lodash"));
39
15
  function isTopLevelCustomDataCamel(input) {
40
16
  return 'customData' in input;
41
17
  }
18
+ function isObject(input) {
19
+ return input != null && typeof input === 'object';
20
+ }
21
+ function snakeCase(input) {
22
+ return input
23
+ .trim()
24
+ .replace(/([a-z])([A-Z])/g, '$1_$2')
25
+ .replace(/[\W]+/g, '_')
26
+ .replace(/^_+|_+$/g, '')
27
+ .toLowerCase();
28
+ }
42
29
  function decamelizeKeys(obj) {
43
- if (!lodash.isObject(obj) ||
44
- lodash.isDate(obj) ||
45
- lodash.isRegExp(obj) ||
46
- lodash.isBoolean(obj) ||
47
- lodash.isFunction(obj)) {
30
+ if (!isObject(obj) ||
31
+ obj instanceof Date ||
32
+ obj instanceof RegExp ||
33
+ typeof obj === 'boolean' ||
34
+ typeof obj === 'function') {
48
35
  return obj;
49
36
  }
50
37
  let output;
51
38
  let i = 0;
52
39
  let l = 0;
53
- if (lodash.isArray(obj)) {
40
+ if (Array.isArray(obj)) {
54
41
  output = [];
55
42
  for (l = obj.length; i < l; i++) {
56
43
  output.push(decamelizeKeys(obj[i]));
@@ -60,14 +47,14 @@ function decamelizeKeys(obj) {
60
47
  output = {};
61
48
  for (const key in obj) {
62
49
  if (Object.prototype.hasOwnProperty.call(obj, key)) {
63
- output[lodash.snakeCase(key)] = decamelizeKeys(obj[key]);
50
+ output[snakeCase(key)] = decamelizeKeys(obj[key]);
64
51
  }
65
52
  }
66
53
  }
67
54
  return output;
68
55
  }
69
56
  function convertToSnakeCase(input) {
70
- if (!input || !lodash.isObject(input)) {
57
+ if (!input || !isObject(input)) {
71
58
  return input;
72
59
  }
73
60
  if (isTopLevelCustomDataCamel(input)) {
@@ -18,6 +18,7 @@ class Paddle {
18
18
  this.transactions = new index_js_2.TransactionsResource(this.client);
19
19
  this.adjustments = new index_js_2.AdjustmentsResource(this.client);
20
20
  this.customers = new index_js_2.CustomersResource(this.client);
21
+ this.customerPortalSessions = new index_js_2.CustomerPortalSessionsResource(this.client);
21
22
  this.addresses = new index_js_2.AddressesResource(this.client);
22
23
  this.businesses = new index_js_2.BusinessesResource(this.client);
23
24
  this.discounts = new index_js_2.DiscountsResource(this.client);
@@ -0,0 +1,32 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.CustomerPortalSessionsResource = void 0;
13
+ const index_js_1 = require("../../entities/index.js");
14
+ const base_1 = require("../../internal/base");
15
+ const CustomerPortalSessionPaths = {
16
+ create: '/customers/{customer_id}/portal-sessions',
17
+ };
18
+ class CustomerPortalSessionsResource extends base_1.BaseResource {
19
+ create(customerId, subscriptionIds) {
20
+ return __awaiter(this, void 0, void 0, function* () {
21
+ const urlWithPathParams = new base_1.PathParameters(CustomerPortalSessionPaths.create, {
22
+ customer_id: customerId,
23
+ }).deriveUrl();
24
+ const response = yield this.client.post(urlWithPathParams, {
25
+ subscriptionIds,
26
+ });
27
+ const data = this.handleResponse(response);
28
+ return new index_js_1.CustomerPortalSession(data);
29
+ });
30
+ }
31
+ }
32
+ exports.CustomerPortalSessionsResource = CustomerPortalSessionsResource;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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("./create-customer-portal-session-request-object.js"), exports);
@@ -18,6 +18,7 @@ __exportStar(require("./addresses/index.js"), exports);
18
18
  __exportStar(require("./adjustments/index.js"), exports);
19
19
  __exportStar(require("./businesses/index.js"), exports);
20
20
  __exportStar(require("./customers/index.js"), exports);
21
+ __exportStar(require("./customer-portal-sessions/index.js"), exports);
21
22
  __exportStar(require("./discounts/index.js"), exports);
22
23
  __exportStar(require("./prices/index.js"), exports);
23
24
  __exportStar(require("./products/index.js"), exports);
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,20 @@
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("./general.js"), exports);
18
+ __exportStar(require("./customer-portal-subscription-url.js"), exports);
19
+ __exportStar(require("./urls.js"), exports);
20
+ __exportStar(require("./customer-portal-session-response.js"), exports);
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -20,6 +20,7 @@ __exportStar(require("./price/index.js"), exports);
20
20
  __exportStar(require("./transaction/index.js"), exports);
21
21
  __exportStar(require("./adjustment/index.js"), exports);
22
22
  __exportStar(require("./customer/index.js"), exports);
23
+ __exportStar(require("./customer-portal-session/index.js"), exports);
23
24
  __exportStar(require("./business/index.js"), exports);
24
25
  __exportStar(require("./subscription/index.js"), exports);
25
26
  __exportStar(require("./address/index.js"), exports);
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = '2.0.0-rc.2';
4
+ exports.SDK_VERSION = '2.1.0';
@@ -0,0 +1,9 @@
1
+ import { Urls } from './urls.js';
2
+ export class CustomerPortalSession {
3
+ constructor(customerPortalSessionResponse) {
4
+ this.id = customerPortalSessionResponse.id;
5
+ this.customerId = customerPortalSessionResponse.customer_id;
6
+ this.urls = new Urls(customerPortalSessionResponse.urls);
7
+ this.createdAt = customerPortalSessionResponse.created_at;
8
+ }
9
+ }
@@ -0,0 +1,7 @@
1
+ export class CustomerPortalSubscriptionUrl {
2
+ constructor(customerPortalSubscriptionUrlResponse) {
3
+ this.id = customerPortalSubscriptionUrlResponse.id;
4
+ this.cancelSubscription = customerPortalSubscriptionUrlResponse.cancel_subscription;
5
+ this.updateSubscriptionPaymentMethod = customerPortalSubscriptionUrlResponse.update_subscription_payment_method;
6
+ }
7
+ }
@@ -0,0 +1,5 @@
1
+ export class General {
2
+ constructor(generalResponse) {
3
+ this.overview = generalResponse.overview;
4
+ }
5
+ }
@@ -0,0 +1,2 @@
1
+ export * from './customer-portal-subscription-url.js';
2
+ export * from './customer-portal-session.js';
@@ -0,0 +1,9 @@
1
+ import { General } from './general.js';
2
+ import { CustomerPortalSubscriptionUrl } from './customer-portal-subscription-url.js';
3
+ export class Urls {
4
+ constructor(urlsResponse) {
5
+ var _a;
6
+ this.general = new General(urlsResponse.general);
7
+ this.subscriptions = (_a = urlsResponse.subscriptions) === null || _a === void 0 ? void 0 : _a.map((subscription) => { var _a; return (_a = new CustomerPortalSubscriptionUrl(subscription)) !== null && _a !== void 0 ? _a : []; });
8
+ }
9
+ }
@@ -4,6 +4,7 @@ export * from './price/index.js';
4
4
  export * from './transaction/index.js';
5
5
  export * from './adjustment/index.js';
6
6
  export * from './customer/index.js';
7
+ export * from './customer-portal-session/index.js';
7
8
  export * from './business/index.js';
8
9
  export * from './subscription/index.js';
9
10
  export * from './address/index.js';
@@ -9,22 +9,32 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
- import * as lodash from 'lodash';
13
12
  function isTopLevelCustomDataCamel(input) {
14
13
  return 'customData' in input;
15
14
  }
15
+ function isObject(input) {
16
+ return input != null && typeof input === 'object';
17
+ }
18
+ function snakeCase(input) {
19
+ return input
20
+ .trim()
21
+ .replace(/([a-z])([A-Z])/g, '$1_$2')
22
+ .replace(/[\W]+/g, '_')
23
+ .replace(/^_+|_+$/g, '')
24
+ .toLowerCase();
25
+ }
16
26
  function decamelizeKeys(obj) {
17
- if (!lodash.isObject(obj) ||
18
- lodash.isDate(obj) ||
19
- lodash.isRegExp(obj) ||
20
- lodash.isBoolean(obj) ||
21
- lodash.isFunction(obj)) {
27
+ if (!isObject(obj) ||
28
+ obj instanceof Date ||
29
+ obj instanceof RegExp ||
30
+ typeof obj === 'boolean' ||
31
+ typeof obj === 'function') {
22
32
  return obj;
23
33
  }
24
34
  let output;
25
35
  let i = 0;
26
36
  let l = 0;
27
- if (lodash.isArray(obj)) {
37
+ if (Array.isArray(obj)) {
28
38
  output = [];
29
39
  for (l = obj.length; i < l; i++) {
30
40
  output.push(decamelizeKeys(obj[i]));
@@ -34,14 +44,14 @@ function decamelizeKeys(obj) {
34
44
  output = {};
35
45
  for (const key in obj) {
36
46
  if (Object.prototype.hasOwnProperty.call(obj, key)) {
37
- output[lodash.snakeCase(key)] = decamelizeKeys(obj[key]);
47
+ output[snakeCase(key)] = decamelizeKeys(obj[key]);
38
48
  }
39
49
  }
40
50
  }
41
51
  return output;
42
52
  }
43
53
  export function convertToSnakeCase(input) {
44
- if (!input || !lodash.isObject(input)) {
54
+ if (!input || !isObject(input)) {
45
55
  return input;
46
56
  }
47
57
  if (isTopLevelCustomDataCamel(input)) {
@@ -1,6 +1,6 @@
1
1
  import { Client } from './internal/api/client.js';
2
2
  import { Environment, LogLevel } from './internal/index.js';
3
- import { AddressesResource, AdjustmentsResource, BusinessesResource, CustomersResource, DiscountsResource, EventTypesResource, NotificationSettingsResource, NotificationsResource, PaymentMethodsResource, PricesResource, PricingPreviewResource, ProductsResource, ReportsResource, SimulationTypesResource, SimulationsResource, SimulationRunsResource, SimulationRunEventsResource, SubscriptionsResource, TransactionsResource, } from './resources/index.js';
3
+ import { AddressesResource, AdjustmentsResource, BusinessesResource, CustomersResource, CustomerPortalSessionsResource, DiscountsResource, EventTypesResource, NotificationSettingsResource, NotificationsResource, PaymentMethodsResource, PricesResource, PricingPreviewResource, ProductsResource, ReportsResource, SimulationTypesResource, SimulationsResource, SimulationRunsResource, SimulationRunEventsResource, SubscriptionsResource, TransactionsResource, } from './resources/index.js';
4
4
  import { EventsResource } from './resources/events/index.js';
5
5
  import { Webhooks } from './notifications/index.js';
6
6
  export class Paddle {
@@ -15,6 +15,7 @@ export class Paddle {
15
15
  this.transactions = new TransactionsResource(this.client);
16
16
  this.adjustments = new AdjustmentsResource(this.client);
17
17
  this.customers = new CustomersResource(this.client);
18
+ this.customerPortalSessions = new CustomerPortalSessionsResource(this.client);
18
19
  this.addresses = new AddressesResource(this.client);
19
20
  this.businesses = new BusinessesResource(this.client);
20
21
  this.discounts = new DiscountsResource(this.client);
@@ -0,0 +1,28 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { CustomerPortalSession } from '../../entities/index.js';
11
+ import { BaseResource, PathParameters } from '../../internal/base';
12
+ const CustomerPortalSessionPaths = {
13
+ create: '/customers/{customer_id}/portal-sessions',
14
+ };
15
+ export class CustomerPortalSessionsResource extends BaseResource {
16
+ create(customerId, subscriptionIds) {
17
+ return __awaiter(this, void 0, void 0, function* () {
18
+ const urlWithPathParams = new PathParameters(CustomerPortalSessionPaths.create, {
19
+ customer_id: customerId,
20
+ }).deriveUrl();
21
+ const response = yield this.client.post(urlWithPathParams, {
22
+ subscriptionIds,
23
+ });
24
+ const data = this.handleResponse(response);
25
+ return new CustomerPortalSession(data);
26
+ });
27
+ }
28
+ }
@@ -0,0 +1 @@
1
+ export * from './create-customer-portal-session-request-object.js';
@@ -2,6 +2,7 @@ export * from './addresses/index.js';
2
2
  export * from './adjustments/index.js';
3
3
  export * from './businesses/index.js';
4
4
  export * from './customers/index.js';
5
+ export * from './customer-portal-sessions/index.js';
5
6
  export * from './discounts/index.js';
6
7
  export * from './prices/index.js';
7
8
  export * from './products/index.js';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export * from './general.js';
2
+ export * from './customer-portal-subscription-url.js';
3
+ export * from './urls.js';
4
+ export * from './customer-portal-session-response.js';
@@ -0,0 +1 @@
1
+ export {};
@@ -4,6 +4,7 @@ export * from './price/index.js';
4
4
  export * from './transaction/index.js';
5
5
  export * from './adjustment/index.js';
6
6
  export * from './customer/index.js';
7
+ export * from './customer-portal-session/index.js';
7
8
  export * from './business/index.js';
8
9
  export * from './subscription/index.js';
9
10
  export * from './address/index.js';
@@ -1 +1 @@
1
- export const SDK_VERSION = '2.0.0-rc.2';
1
+ export const SDK_VERSION = '2.1.0';
@@ -0,0 +1,9 @@
1
+ import { type ICustomerPortalSessionResponse } from '../../types/index.js';
2
+ import { Urls } from './urls.js';
3
+ export declare class CustomerPortalSession {
4
+ readonly id: string;
5
+ readonly customerId: string | null;
6
+ readonly urls: Urls;
7
+ readonly createdAt: string;
8
+ constructor(customerPortalSessionResponse: ICustomerPortalSessionResponse);
9
+ }
@@ -0,0 +1,7 @@
1
+ import { type ICustomerPortalSubscriptionUrl } from '../../types/index.js';
2
+ export declare class CustomerPortalSubscriptionUrl {
3
+ readonly id: string;
4
+ readonly cancelSubscription: string;
5
+ readonly updateSubscriptionPaymentMethod: string;
6
+ constructor(customerPortalSubscriptionUrlResponse: ICustomerPortalSubscriptionUrl);
7
+ }
@@ -0,0 +1,5 @@
1
+ import { type IGeneralResponse } from '../../types/index.js';
2
+ export declare class General {
3
+ readonly overview: string;
4
+ constructor(generalResponse: IGeneralResponse);
5
+ }
@@ -0,0 +1,2 @@
1
+ export * from './customer-portal-subscription-url.js';
2
+ export * from './customer-portal-session.js';
@@ -0,0 +1,8 @@
1
+ import { type IUrlsResponse } from '../../types/index.js';
2
+ import { General } from './general.js';
3
+ import { CustomerPortalSubscriptionUrl } from './customer-portal-subscription-url.js';
4
+ export declare class Urls {
5
+ readonly general: General;
6
+ readonly subscriptions: CustomerPortalSubscriptionUrl[];
7
+ constructor(urlsResponse: IUrlsResponse);
8
+ }
@@ -4,6 +4,7 @@ export * from './price/index.js';
4
4
  export * from './transaction/index.js';
5
5
  export * from './adjustment/index.js';
6
6
  export * from './customer/index.js';
7
+ export * from './customer-portal-session/index.js';
7
8
  export * from './business/index.js';
8
9
  export * from './subscription/index.js';
9
10
  export * from './address/index.js';
@@ -1,5 +1,5 @@
1
1
  import { type PaddleOptions } from './internal/index.js';
2
- import { AddressesResource, AdjustmentsResource, BusinessesResource, CustomersResource, DiscountsResource, EventTypesResource, NotificationSettingsResource, NotificationsResource, PaymentMethodsResource, PricesResource, PricingPreviewResource, ProductsResource, ReportsResource, SimulationTypesResource, SimulationsResource, SimulationRunsResource, SimulationRunEventsResource, SubscriptionsResource, TransactionsResource } from './resources/index.js';
2
+ import { AddressesResource, AdjustmentsResource, BusinessesResource, CustomersResource, CustomerPortalSessionsResource, DiscountsResource, EventTypesResource, NotificationSettingsResource, NotificationsResource, PaymentMethodsResource, PricesResource, PricingPreviewResource, ProductsResource, ReportsResource, SimulationTypesResource, SimulationsResource, SimulationRunsResource, SimulationRunEventsResource, SubscriptionsResource, TransactionsResource } from './resources/index.js';
3
3
  import { EventsResource } from './resources/events/index.js';
4
4
  import { Webhooks } from './notifications/index.js';
5
5
  export declare class Paddle {
@@ -10,6 +10,7 @@ export declare class Paddle {
10
10
  transactions: TransactionsResource;
11
11
  adjustments: AdjustmentsResource;
12
12
  customers: CustomersResource;
13
+ customerPortalSessions: CustomerPortalSessionsResource;
13
14
  addresses: AddressesResource;
14
15
  businesses: BusinessesResource;
15
16
  discounts: DiscountsResource;
@@ -0,0 +1,5 @@
1
+ import { CustomerPortalSession } from '../../entities/index.js';
2
+ import { BaseResource } from '../../internal/base';
3
+ export declare class CustomerPortalSessionsResource extends BaseResource {
4
+ create(customerId: string, subscriptionIds: string[]): Promise<CustomerPortalSession>;
5
+ }
@@ -0,0 +1,3 @@
1
+ export interface CreateCustomerPortalSessionRequestBody {
2
+ subscriptionIds: string[];
3
+ }
@@ -0,0 +1 @@
1
+ export * from './create-customer-portal-session-request-object.js';
@@ -2,6 +2,7 @@ export * from './addresses/index.js';
2
2
  export * from './adjustments/index.js';
3
3
  export * from './businesses/index.js';
4
4
  export * from './customers/index.js';
5
+ export * from './customer-portal-sessions/index.js';
5
6
  export * from './discounts/index.js';
6
7
  export * from './prices/index.js';
7
8
  export * from './products/index.js';
@@ -0,0 +1,7 @@
1
+ import { type IUrlsResponse } from './urls.js';
2
+ export interface ICustomerPortalSessionResponse {
3
+ id: string;
4
+ customer_id: string;
5
+ urls: IUrlsResponse;
6
+ created_at: string;
7
+ }
@@ -0,0 +1,5 @@
1
+ export interface ICustomerPortalSubscriptionUrl {
2
+ id: string;
3
+ cancel_subscription: string;
4
+ update_subscription_payment_method: string;
5
+ }
@@ -0,0 +1,3 @@
1
+ export interface IGeneralResponse {
2
+ overview: string;
3
+ }
@@ -0,0 +1,4 @@
1
+ export * from './general.js';
2
+ export * from './customer-portal-subscription-url.js';
3
+ export * from './urls.js';
4
+ export * from './customer-portal-session-response.js';
@@ -0,0 +1,6 @@
1
+ import { type IGeneralResponse } from './general.js';
2
+ import { type ICustomerPortalSubscriptionUrl } from './customer-portal-subscription-url.js';
3
+ export interface IUrlsResponse {
4
+ general: IGeneralResponse;
5
+ subscriptions: ICustomerPortalSubscriptionUrl[];
6
+ }
@@ -4,6 +4,7 @@ export * from './price/index.js';
4
4
  export * from './transaction/index.js';
5
5
  export * from './adjustment/index.js';
6
6
  export * from './customer/index.js';
7
+ export * from './customer-portal-session/index.js';
7
8
  export * from './business/index.js';
8
9
  export * from './subscription/index.js';
9
10
  export * from './address/index.js';
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "2.0.0-rc.2";
1
+ export declare const SDK_VERSION = "2.1.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paddle/paddle-node-sdk",
3
- "version": "2.0.0-rc.2",
3
+ "version": "2.1.0",
4
4
  "description": "A Node.js SDK that you can use to integrate Paddle Billing with applications written in server-side JavaScript.",
5
5
  "main": "dist/cjs/index.cjs.node.js",
6
6
  "module": "dist/esm/index.esm.node.js",
@@ -58,9 +58,6 @@
58
58
  "prettier": "^3.0.3",
59
59
  "typescript": "^5.2.2"
60
60
  },
61
- "dependencies": {
62
- "lodash": "^4.17.21"
63
- },
64
61
  "exports": {
65
62
  "types": "./dist/types/index.cjs.node.d.ts",
66
63
  "worker": {