@betterstore/sdk 0.5.21 → 0.5.23
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 +8 -5
- package/dist/index.d.ts +8 -5
- package/dist/index.js +3 -3
- package/dist/index.mjs +3 -3
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -6,12 +6,15 @@ type ShippingRate = ZasilkovnaRate;
|
|
|
6
6
|
interface BaseRate {
|
|
7
7
|
provider: string;
|
|
8
8
|
name: string;
|
|
9
|
-
|
|
9
|
+
priceInCents: number;
|
|
10
10
|
}
|
|
11
11
|
interface ZasilkovnaRate extends BaseRate {
|
|
12
12
|
provider: "zasilkovna";
|
|
13
13
|
clientSecret: string;
|
|
14
14
|
}
|
|
15
|
+
interface GetShippingRatesResponse {
|
|
16
|
+
[shipmentId: string]: ShippingRate[];
|
|
17
|
+
}
|
|
15
18
|
|
|
16
19
|
type ProductData = Pick<Product, "title" | "description" | "images" | "category" | "tags" | "sku" | "barcode" | "vendor" | "isPhysical" | "weightInGrams" | "heightInCm" | "widthInCm" | "lengthInCm" | "priceInCents" | "billingType" | "billingInterval" | "billingIntervalCount"> & {
|
|
17
20
|
productId: string;
|
|
@@ -45,7 +48,7 @@ interface CheckoutCreateParams {
|
|
|
45
48
|
}
|
|
46
49
|
interface CheckoutUpdateParams {
|
|
47
50
|
customerId?: string;
|
|
48
|
-
shipments
|
|
51
|
+
shipments?: CheckoutShipment[];
|
|
49
52
|
}
|
|
50
53
|
|
|
51
54
|
type ShipmentData = {
|
|
@@ -55,6 +58,7 @@ type ShipmentData = {
|
|
|
55
58
|
pickupPointId?: string;
|
|
56
59
|
trackingId?: string;
|
|
57
60
|
trackingUrl?: string;
|
|
61
|
+
priceInCents: number;
|
|
58
62
|
};
|
|
59
63
|
type CheckoutShipment = {
|
|
60
64
|
id: string;
|
|
@@ -71,7 +75,6 @@ interface CheckoutSession {
|
|
|
71
75
|
};
|
|
72
76
|
lineItems: LineItem[];
|
|
73
77
|
tax: number | null;
|
|
74
|
-
shipping: number | null;
|
|
75
78
|
discountAmount: number | null;
|
|
76
79
|
appliedDiscounts: {
|
|
77
80
|
id: string;
|
|
@@ -450,7 +453,7 @@ declare class Checkout {
|
|
|
450
453
|
/**
|
|
451
454
|
* Get shipping rates for a checkout session
|
|
452
455
|
*/
|
|
453
|
-
getShippingRates(checkoutId: string): Promise<
|
|
456
|
+
getShippingRates(checkoutId: string): Promise<GetShippingRatesResponse>;
|
|
454
457
|
/**
|
|
455
458
|
* Generate payment secret for a checkout session
|
|
456
459
|
*/
|
|
@@ -599,4 +602,4 @@ declare function createStoreHelpers(config?: {
|
|
|
599
602
|
proxy?: string;
|
|
600
603
|
}): Helpers;
|
|
601
604
|
|
|
602
|
-
export { type Address, type AutosuggestAddressResult, type CheckoutCreateParams, type CheckoutSession, type CheckoutUpdateParams, type Collection, type CollectionWithProducts, type Currency, type Customer$1 as Customer, type CustomerCreateParams, type CustomerSession, type CustomerSubscription, type CustomerSubscriptionUpdateParams, type CustomerUpdateParams, type Discount, type LineItem, type LineItemCreate, type ListCollectionsParams, type ListCollectionsQuery, type ListCollectionsSortBy, type ListDiscountsParams, type ListDiscountsQuery, type ListDiscountsSortBy, type ListProductsParams, type ListProductsQuery, type ListProductsSortBy, type LookupAddressResult, type OTPLoginParams, type OTPLoginResponse, type OTPSignupParams, type OTPSignupResponse, type OTPVerifyParams, type OTPVerifyResponse, type Product, type ProductBillingInterval, type ProductBillingType, type ProductOption, type ProductStatus, type ProductVariant, type ProductWithoutVariants, type RetrieveCollectionParams, type RetrieveDiscountParams, type RetrieveProductParams, type ShippingRate, type VariantOption, createStoreClient, createStoreHelpers, createBetterStore as default };
|
|
605
|
+
export { type Address, type AutosuggestAddressResult, type CheckoutCreateParams, type CheckoutSession, type CheckoutUpdateParams, type Collection, type CollectionWithProducts, type Currency, type Customer$1 as Customer, type CustomerCreateParams, type CustomerSession, type CustomerSubscription, type CustomerSubscriptionUpdateParams, type CustomerUpdateParams, type Discount, type GetShippingRatesResponse, type LineItem, type LineItemCreate, type ListCollectionsParams, type ListCollectionsQuery, type ListCollectionsSortBy, type ListDiscountsParams, type ListDiscountsQuery, type ListDiscountsSortBy, type ListProductsParams, type ListProductsQuery, type ListProductsSortBy, type LookupAddressResult, type OTPLoginParams, type OTPLoginResponse, type OTPSignupParams, type OTPSignupResponse, type OTPVerifyParams, type OTPVerifyResponse, type Product, type ProductBillingInterval, type ProductBillingType, type ProductOption, type ProductStatus, type ProductVariant, type ProductWithoutVariants, type RetrieveCollectionParams, type RetrieveDiscountParams, type RetrieveProductParams, type ShippingRate, type VariantOption, createStoreClient, createStoreHelpers, createBetterStore as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -6,12 +6,15 @@ type ShippingRate = ZasilkovnaRate;
|
|
|
6
6
|
interface BaseRate {
|
|
7
7
|
provider: string;
|
|
8
8
|
name: string;
|
|
9
|
-
|
|
9
|
+
priceInCents: number;
|
|
10
10
|
}
|
|
11
11
|
interface ZasilkovnaRate extends BaseRate {
|
|
12
12
|
provider: "zasilkovna";
|
|
13
13
|
clientSecret: string;
|
|
14
14
|
}
|
|
15
|
+
interface GetShippingRatesResponse {
|
|
16
|
+
[shipmentId: string]: ShippingRate[];
|
|
17
|
+
}
|
|
15
18
|
|
|
16
19
|
type ProductData = Pick<Product, "title" | "description" | "images" | "category" | "tags" | "sku" | "barcode" | "vendor" | "isPhysical" | "weightInGrams" | "heightInCm" | "widthInCm" | "lengthInCm" | "priceInCents" | "billingType" | "billingInterval" | "billingIntervalCount"> & {
|
|
17
20
|
productId: string;
|
|
@@ -45,7 +48,7 @@ interface CheckoutCreateParams {
|
|
|
45
48
|
}
|
|
46
49
|
interface CheckoutUpdateParams {
|
|
47
50
|
customerId?: string;
|
|
48
|
-
shipments
|
|
51
|
+
shipments?: CheckoutShipment[];
|
|
49
52
|
}
|
|
50
53
|
|
|
51
54
|
type ShipmentData = {
|
|
@@ -55,6 +58,7 @@ type ShipmentData = {
|
|
|
55
58
|
pickupPointId?: string;
|
|
56
59
|
trackingId?: string;
|
|
57
60
|
trackingUrl?: string;
|
|
61
|
+
priceInCents: number;
|
|
58
62
|
};
|
|
59
63
|
type CheckoutShipment = {
|
|
60
64
|
id: string;
|
|
@@ -71,7 +75,6 @@ interface CheckoutSession {
|
|
|
71
75
|
};
|
|
72
76
|
lineItems: LineItem[];
|
|
73
77
|
tax: number | null;
|
|
74
|
-
shipping: number | null;
|
|
75
78
|
discountAmount: number | null;
|
|
76
79
|
appliedDiscounts: {
|
|
77
80
|
id: string;
|
|
@@ -450,7 +453,7 @@ declare class Checkout {
|
|
|
450
453
|
/**
|
|
451
454
|
* Get shipping rates for a checkout session
|
|
452
455
|
*/
|
|
453
|
-
getShippingRates(checkoutId: string): Promise<
|
|
456
|
+
getShippingRates(checkoutId: string): Promise<GetShippingRatesResponse>;
|
|
454
457
|
/**
|
|
455
458
|
* Generate payment secret for a checkout session
|
|
456
459
|
*/
|
|
@@ -599,4 +602,4 @@ declare function createStoreHelpers(config?: {
|
|
|
599
602
|
proxy?: string;
|
|
600
603
|
}): Helpers;
|
|
601
604
|
|
|
602
|
-
export { type Address, type AutosuggestAddressResult, type CheckoutCreateParams, type CheckoutSession, type CheckoutUpdateParams, type Collection, type CollectionWithProducts, type Currency, type Customer$1 as Customer, type CustomerCreateParams, type CustomerSession, type CustomerSubscription, type CustomerSubscriptionUpdateParams, type CustomerUpdateParams, type Discount, type LineItem, type LineItemCreate, type ListCollectionsParams, type ListCollectionsQuery, type ListCollectionsSortBy, type ListDiscountsParams, type ListDiscountsQuery, type ListDiscountsSortBy, type ListProductsParams, type ListProductsQuery, type ListProductsSortBy, type LookupAddressResult, type OTPLoginParams, type OTPLoginResponse, type OTPSignupParams, type OTPSignupResponse, type OTPVerifyParams, type OTPVerifyResponse, type Product, type ProductBillingInterval, type ProductBillingType, type ProductOption, type ProductStatus, type ProductVariant, type ProductWithoutVariants, type RetrieveCollectionParams, type RetrieveDiscountParams, type RetrieveProductParams, type ShippingRate, type VariantOption, createStoreClient, createStoreHelpers, createBetterStore as default };
|
|
605
|
+
export { type Address, type AutosuggestAddressResult, type CheckoutCreateParams, type CheckoutSession, type CheckoutUpdateParams, type Collection, type CollectionWithProducts, type Currency, type Customer$1 as Customer, type CustomerCreateParams, type CustomerSession, type CustomerSubscription, type CustomerSubscriptionUpdateParams, type CustomerUpdateParams, type Discount, type GetShippingRatesResponse, type LineItem, type LineItemCreate, type ListCollectionsParams, type ListCollectionsQuery, type ListCollectionsSortBy, type ListDiscountsParams, type ListDiscountsQuery, type ListDiscountsSortBy, type ListProductsParams, type ListProductsQuery, type ListProductsSortBy, type LookupAddressResult, type OTPLoginParams, type OTPLoginResponse, type OTPSignupParams, type OTPSignupResponse, type OTPVerifyParams, type OTPVerifyResponse, type Product, type ProductBillingInterval, type ProductBillingType, type ProductOption, type ProductStatus, type ProductVariant, type ProductWithoutVariants, type RetrieveCollectionParams, type RetrieveDiscountParams, type RetrieveProductParams, type ShippingRate, type VariantOption, createStoreClient, createStoreHelpers, createBetterStore as default };
|
package/dist/index.js
CHANGED
|
@@ -224,10 +224,10 @@ var Checkout = class {
|
|
|
224
224
|
*/
|
|
225
225
|
async getShippingRates(checkoutId) {
|
|
226
226
|
const data = await this.apiClient.get(
|
|
227
|
-
`/checkout
|
|
227
|
+
`/checkout/${checkoutId}/shipping/rates`
|
|
228
228
|
);
|
|
229
|
-
if ("isError" in data && data.isError || !data
|
|
230
|
-
return
|
|
229
|
+
if ("isError" in data && data.isError || !data) {
|
|
230
|
+
return {};
|
|
231
231
|
}
|
|
232
232
|
return data;
|
|
233
233
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -186,10 +186,10 @@ var Checkout = class {
|
|
|
186
186
|
*/
|
|
187
187
|
async getShippingRates(checkoutId) {
|
|
188
188
|
const data = await this.apiClient.get(
|
|
189
|
-
`/checkout
|
|
189
|
+
`/checkout/${checkoutId}/shipping/rates`
|
|
190
190
|
);
|
|
191
|
-
if ("isError" in data && data.isError || !data
|
|
192
|
-
return
|
|
191
|
+
if ("isError" in data && data.isError || !data) {
|
|
192
|
+
return {};
|
|
193
193
|
}
|
|
194
194
|
return data;
|
|
195
195
|
}
|