@paddle/paddle-node-sdk 1.3.0-beta.0 → 1.3.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/CHANGELOG.md +10 -1
- package/dist/cjs/entities/pricing-preview/pricing-preview.js +6 -6
- package/dist/cjs/internal/base/collection.js +3 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/entities/pricing-preview/pricing-preview.js +6 -6
- package/dist/esm/internal/base/collection.js +3 -1
- package/dist/esm/version.js +1 -1
- package/dist/types/entities/pricing-preview/pricing-preview.d.ts +3 -3
- package/dist/types/internal/base/collection.d.ts +2 -1
- package/dist/types/types/pricing-preview/pricing-preview-response.d.ts +3 -3
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -12,11 +12,20 @@ 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
|
-
## 1.3.0
|
|
15
|
+
## 1.3.0 - 2024-04-18
|
|
16
16
|
|
|
17
17
|
### Changed
|
|
18
18
|
|
|
19
19
|
- Updated the package to export both CommonJS and ES module formats.
|
|
20
|
+
- Updated `Collection` to return `hasMore` and `estimatedTotal` properties
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 1.2.2 - 2024-04-03
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
|
|
28
|
+
- Updated the optional properties returned by `pricingPreview.preview` operation to match the API response.
|
|
20
29
|
|
|
21
30
|
---
|
|
22
31
|
|
|
@@ -5,16 +5,16 @@ const transaction_1 = require("../transaction");
|
|
|
5
5
|
const pricing_preview_details_1 = require("./pricing-preview-details");
|
|
6
6
|
class PricingPreview {
|
|
7
7
|
constructor(pricePreview) {
|
|
8
|
-
var _a, _b, _c, _d, _e, _f
|
|
8
|
+
var _a, _b, _c, _d, _e, _f;
|
|
9
9
|
this.customerId = (_a = pricePreview.customer_id) !== null && _a !== void 0 ? _a : null;
|
|
10
10
|
this.addressId = (_b = pricePreview.address_id) !== null && _b !== void 0 ? _b : null;
|
|
11
11
|
this.businessId = (_c = pricePreview.business_id) !== null && _c !== void 0 ? _c : null;
|
|
12
|
-
this.currencyCode =
|
|
13
|
-
this.discountId = (
|
|
12
|
+
this.currencyCode = pricePreview.currency_code;
|
|
13
|
+
this.discountId = (_d = pricePreview.discount_id) !== null && _d !== void 0 ? _d : null;
|
|
14
14
|
this.address = pricePreview.address ? new transaction_1.AddressPreview(pricePreview.address) : null;
|
|
15
|
-
this.customerIpAddress = (
|
|
16
|
-
this.details =
|
|
17
|
-
this.availablePaymentMethods = (
|
|
15
|
+
this.customerIpAddress = (_e = pricePreview.customer_ip_address) !== null && _e !== void 0 ? _e : null;
|
|
16
|
+
this.details = new pricing_preview_details_1.PricingPreviewDetails(pricePreview.details);
|
|
17
|
+
this.availablePaymentMethods = (_f = pricePreview.available_payment_methods) !== null && _f !== void 0 ? _f : [];
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
exports.PricingPreview = PricingPreview;
|
|
@@ -27,16 +27,18 @@ class Collection {
|
|
|
27
27
|
constructor(client, initialUri) {
|
|
28
28
|
this.client = client;
|
|
29
29
|
this.hasMore = true;
|
|
30
|
+
this.estimatedTotal = 0;
|
|
30
31
|
this.data = [];
|
|
31
32
|
this.nextLink = initialUri;
|
|
32
33
|
}
|
|
33
34
|
next() {
|
|
34
|
-
var _a;
|
|
35
|
+
var _a, _b;
|
|
35
36
|
return __awaiter(this, void 0, void 0, function* () {
|
|
36
37
|
const response = yield this.client.get(this.nextLink);
|
|
37
38
|
const handledResponse = this.handlePaginatedResponse(response);
|
|
38
39
|
this.hasMore = (_a = handledResponse.meta.pagination.has_more) !== null && _a !== void 0 ? _a : false;
|
|
39
40
|
this.nextLink = handledResponse.meta.pagination.next;
|
|
41
|
+
this.estimatedTotal = (_b = handledResponse.meta.pagination.estimated_total) !== null && _b !== void 0 ? _b : 0;
|
|
40
42
|
this.data = handledResponse.data.map((data) => this.fromJson(data));
|
|
41
43
|
return this.data.length > 0 ? this.data : [];
|
|
42
44
|
});
|
package/dist/cjs/version.js
CHANGED
|
@@ -2,15 +2,15 @@ import { AddressPreview } from '../transaction';
|
|
|
2
2
|
import { PricingPreviewDetails } from './pricing-preview-details';
|
|
3
3
|
export class PricingPreview {
|
|
4
4
|
constructor(pricePreview) {
|
|
5
|
-
var _a, _b, _c, _d, _e, _f
|
|
5
|
+
var _a, _b, _c, _d, _e, _f;
|
|
6
6
|
this.customerId = (_a = pricePreview.customer_id) !== null && _a !== void 0 ? _a : null;
|
|
7
7
|
this.addressId = (_b = pricePreview.address_id) !== null && _b !== void 0 ? _b : null;
|
|
8
8
|
this.businessId = (_c = pricePreview.business_id) !== null && _c !== void 0 ? _c : null;
|
|
9
|
-
this.currencyCode =
|
|
10
|
-
this.discountId = (
|
|
9
|
+
this.currencyCode = pricePreview.currency_code;
|
|
10
|
+
this.discountId = (_d = pricePreview.discount_id) !== null && _d !== void 0 ? _d : null;
|
|
11
11
|
this.address = pricePreview.address ? new AddressPreview(pricePreview.address) : null;
|
|
12
|
-
this.customerIpAddress = (
|
|
13
|
-
this.details =
|
|
14
|
-
this.availablePaymentMethods = (
|
|
12
|
+
this.customerIpAddress = (_e = pricePreview.customer_ip_address) !== null && _e !== void 0 ? _e : null;
|
|
13
|
+
this.details = new PricingPreviewDetails(pricePreview.details);
|
|
14
|
+
this.availablePaymentMethods = (_f = pricePreview.available_payment_methods) !== null && _f !== void 0 ? _f : [];
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -24,16 +24,18 @@ export class Collection {
|
|
|
24
24
|
constructor(client, initialUri) {
|
|
25
25
|
this.client = client;
|
|
26
26
|
this.hasMore = true;
|
|
27
|
+
this.estimatedTotal = 0;
|
|
27
28
|
this.data = [];
|
|
28
29
|
this.nextLink = initialUri;
|
|
29
30
|
}
|
|
30
31
|
next() {
|
|
31
|
-
var _a;
|
|
32
|
+
var _a, _b;
|
|
32
33
|
return __awaiter(this, void 0, void 0, function* () {
|
|
33
34
|
const response = yield this.client.get(this.nextLink);
|
|
34
35
|
const handledResponse = this.handlePaginatedResponse(response);
|
|
35
36
|
this.hasMore = (_a = handledResponse.meta.pagination.has_more) !== null && _a !== void 0 ? _a : false;
|
|
36
37
|
this.nextLink = handledResponse.meta.pagination.next;
|
|
38
|
+
this.estimatedTotal = (_b = handledResponse.meta.pagination.estimated_total) !== null && _b !== void 0 ? _b : 0;
|
|
37
39
|
this.data = handledResponse.data.map((data) => this.fromJson(data));
|
|
38
40
|
return this.data.length > 0 ? this.data : [];
|
|
39
41
|
});
|
package/dist/esm/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = '1.3.0
|
|
1
|
+
export const SDK_VERSION = '1.3.0';
|
|
@@ -6,11 +6,11 @@ export declare class PricingPreview {
|
|
|
6
6
|
readonly customerId: string | null;
|
|
7
7
|
readonly addressId: string | null;
|
|
8
8
|
readonly businessId: string | null;
|
|
9
|
-
readonly currencyCode: CurrencyCode
|
|
9
|
+
readonly currencyCode: CurrencyCode;
|
|
10
10
|
readonly discountId: string | null;
|
|
11
11
|
readonly address: AddressPreview | null;
|
|
12
12
|
readonly customerIpAddress: string | null;
|
|
13
|
-
readonly details: PricingPreviewDetails
|
|
14
|
-
readonly availablePaymentMethods: AvailablePaymentMethod
|
|
13
|
+
readonly details: PricingPreviewDetails;
|
|
14
|
+
readonly availablePaymentMethods: AvailablePaymentMethod[];
|
|
15
15
|
constructor(pricePreview: IPricingPreviewResponse);
|
|
16
16
|
}
|
|
@@ -2,7 +2,8 @@ import { type Client } from '../api/client';
|
|
|
2
2
|
import { type ErrorResponse, type ResponsePaginated } from '../types/response';
|
|
3
3
|
export declare abstract class Collection<T, C> implements AsyncIterable<C> {
|
|
4
4
|
private readonly client;
|
|
5
|
-
|
|
5
|
+
hasMore: boolean;
|
|
6
|
+
estimatedTotal: number;
|
|
6
7
|
private nextLink;
|
|
7
8
|
private data;
|
|
8
9
|
constructor(client: Client, initialUri: string);
|
|
@@ -6,11 +6,11 @@ export interface IPricingPreviewResponse {
|
|
|
6
6
|
customer_id?: string | null;
|
|
7
7
|
address_id?: string | null;
|
|
8
8
|
business_id?: string | null;
|
|
9
|
-
currency_code
|
|
9
|
+
currency_code: CurrencyCode;
|
|
10
10
|
discount_id?: string | null;
|
|
11
11
|
address?: IAddressPreviewResponse | null;
|
|
12
12
|
customer_ip_address?: string | null;
|
|
13
13
|
items: IPricingPreviewItemResponse[];
|
|
14
|
-
details
|
|
15
|
-
|
|
14
|
+
details: IPricingPreviewDetailsResponse;
|
|
15
|
+
available_payment_methods: AvailablePaymentMethod[];
|
|
16
16
|
}
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.3.0
|
|
1
|
+
export declare const SDK_VERSION = "1.3.0";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paddle/paddle-node-sdk",
|
|
3
|
-
"version": "1.3.0
|
|
3
|
+
"version": "1.3.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.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|