@betterstore/sdk 0.5.19 → 0.5.22

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/dist/index.d.mts CHANGED
@@ -6,7 +6,7 @@ type ShippingRate = ZasilkovnaRate;
6
6
  interface BaseRate {
7
7
  provider: string;
8
8
  name: string;
9
- price: number;
9
+ priceInCents: number;
10
10
  }
11
11
  interface ZasilkovnaRate extends BaseRate {
12
12
  provider: "zasilkovna";
@@ -45,13 +45,7 @@ interface CheckoutCreateParams {
45
45
  }
46
46
  interface CheckoutUpdateParams {
47
47
  customerId?: string;
48
- shipmentData?: {
49
- provider: string;
50
- name?: string;
51
- pickupPointId?: string;
52
- trackingNumber?: string;
53
- trackingUrl?: string;
54
- };
48
+ shipments?: CheckoutShipment[];
55
49
  }
56
50
 
57
51
  type ShipmentData = {
@@ -61,6 +55,11 @@ type ShipmentData = {
61
55
  pickupPointId?: string;
62
56
  trackingId?: string;
63
57
  trackingUrl?: string;
58
+ priceInCents: number;
59
+ };
60
+ type CheckoutShipment = {
61
+ id: string;
62
+ shipmentData?: ShipmentData | null;
64
63
  };
65
64
  interface CheckoutSession {
66
65
  id: string;
@@ -73,7 +72,6 @@ interface CheckoutSession {
73
72
  };
74
73
  lineItems: LineItem[];
75
74
  tax: number | null;
76
- shipping: number | null;
77
75
  discountAmount: number | null;
78
76
  appliedDiscounts: {
79
77
  id: string;
@@ -86,7 +84,7 @@ interface CheckoutSession {
86
84
  }[];
87
85
  currency: string;
88
86
  exchangeRate: number | null;
89
- shipmentData: ShipmentData | null;
87
+ shipments: CheckoutShipment[];
90
88
  status: "IN_PROGRESS" | "PAYMENT_PENDING" | "ABANDONED" | "CANCELED" | "FAILED";
91
89
  }
92
90
 
@@ -452,7 +450,7 @@ declare class Checkout {
452
450
  /**
453
451
  * Get shipping rates for a checkout session
454
452
  */
455
- getShippingRates(checkoutId: string): Promise<ShippingRate[]>;
453
+ getShippingRates(checkoutId: string, shipmentId: string): Promise<ShippingRate[]>;
456
454
  /**
457
455
  * Generate payment secret for a checkout session
458
456
  */
package/dist/index.d.ts CHANGED
@@ -6,7 +6,7 @@ type ShippingRate = ZasilkovnaRate;
6
6
  interface BaseRate {
7
7
  provider: string;
8
8
  name: string;
9
- price: number;
9
+ priceInCents: number;
10
10
  }
11
11
  interface ZasilkovnaRate extends BaseRate {
12
12
  provider: "zasilkovna";
@@ -45,13 +45,7 @@ interface CheckoutCreateParams {
45
45
  }
46
46
  interface CheckoutUpdateParams {
47
47
  customerId?: string;
48
- shipmentData?: {
49
- provider: string;
50
- name?: string;
51
- pickupPointId?: string;
52
- trackingNumber?: string;
53
- trackingUrl?: string;
54
- };
48
+ shipments?: CheckoutShipment[];
55
49
  }
56
50
 
57
51
  type ShipmentData = {
@@ -61,6 +55,11 @@ type ShipmentData = {
61
55
  pickupPointId?: string;
62
56
  trackingId?: string;
63
57
  trackingUrl?: string;
58
+ priceInCents: number;
59
+ };
60
+ type CheckoutShipment = {
61
+ id: string;
62
+ shipmentData?: ShipmentData | null;
64
63
  };
65
64
  interface CheckoutSession {
66
65
  id: string;
@@ -73,7 +72,6 @@ interface CheckoutSession {
73
72
  };
74
73
  lineItems: LineItem[];
75
74
  tax: number | null;
76
- shipping: number | null;
77
75
  discountAmount: number | null;
78
76
  appliedDiscounts: {
79
77
  id: string;
@@ -86,7 +84,7 @@ interface CheckoutSession {
86
84
  }[];
87
85
  currency: string;
88
86
  exchangeRate: number | null;
89
- shipmentData: ShipmentData | null;
87
+ shipments: CheckoutShipment[];
90
88
  status: "IN_PROGRESS" | "PAYMENT_PENDING" | "ABANDONED" | "CANCELED" | "FAILED";
91
89
  }
92
90
 
@@ -452,7 +450,7 @@ declare class Checkout {
452
450
  /**
453
451
  * Get shipping rates for a checkout session
454
452
  */
455
- getShippingRates(checkoutId: string): Promise<ShippingRate[]>;
453
+ getShippingRates(checkoutId: string, shipmentId: string): Promise<ShippingRate[]>;
456
454
  /**
457
455
  * Generate payment secret for a checkout session
458
456
  */
package/dist/index.js CHANGED
@@ -222,9 +222,9 @@ var Checkout = class {
222
222
  /**
223
223
  * Get shipping rates for a checkout session
224
224
  */
225
- async getShippingRates(checkoutId) {
225
+ async getShippingRates(checkoutId, shipmentId) {
226
226
  const data = await this.apiClient.get(
227
- `/checkout/shipping/${checkoutId}`
227
+ `/checkout/${checkoutId}/shipping/${shipmentId}/rates`
228
228
  );
229
229
  if ("isError" in data && data.isError || !data || !Array.isArray(data)) {
230
230
  return [];
package/dist/index.mjs CHANGED
@@ -184,9 +184,9 @@ var Checkout = class {
184
184
  /**
185
185
  * Get shipping rates for a checkout session
186
186
  */
187
- async getShippingRates(checkoutId) {
187
+ async getShippingRates(checkoutId, shipmentId) {
188
188
  const data = await this.apiClient.get(
189
- `/checkout/shipping/${checkoutId}`
189
+ `/checkout/${checkoutId}/shipping/${shipmentId}/rates`
190
190
  );
191
191
  if ("isError" in data && data.isError || !data || !Array.isArray(data)) {
192
192
  return [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@betterstore/sdk",
3
- "version": "0.5.19",
3
+ "version": "0.5.22",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",