@betterstore/react 0.2.37 → 0.2.39
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 +12 -0
- package/dist/components/cart/useCart.d.ts +5 -19
- package/dist/components/checkout-embed/checkout-form.d.ts +2 -1
- package/dist/components/checkout-embed/checkout-schema.d.ts +44 -16
- package/dist/components/checkout-embed/steps/shipping/form.d.ts +5 -1
- package/dist/components/checkout-embed/steps/shipping/providers/zasilkovna.d.ts +13 -0
- package/dist/components/checkout-embed/steps/shipping/shipping-option-wrapper.d.ts +9 -0
- package/dist/index.cjs.js +153 -71
- package/dist/index.mjs +153 -71
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,21 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
id: string;
|
|
3
|
-
title: string;
|
|
4
|
-
description?: string;
|
|
5
|
-
images: string[];
|
|
6
|
-
priceInCents: number;
|
|
7
|
-
} | string;
|
|
8
|
-
interface LineItem {
|
|
9
|
-
id: string;
|
|
10
|
-
productId: string;
|
|
11
|
-
product?: Product;
|
|
12
|
-
quantity: number;
|
|
13
|
-
variantOptions: {
|
|
14
|
-
name: string;
|
|
15
|
-
value: string;
|
|
16
|
-
}[];
|
|
17
|
-
metadata?: string;
|
|
18
|
-
}
|
|
1
|
+
import { Product, LineItem as SDKLineItem } from "@betterstore/sdk";
|
|
19
2
|
type LineItemOptionalParams = {
|
|
20
3
|
quantity?: number;
|
|
21
4
|
productId: string;
|
|
@@ -25,9 +8,12 @@ type LineItemOptionalParams = {
|
|
|
25
8
|
}[];
|
|
26
9
|
metadata?: string;
|
|
27
10
|
};
|
|
11
|
+
interface LineItem extends Omit<SDKLineItem, "product"> {
|
|
12
|
+
id: string;
|
|
13
|
+
}
|
|
28
14
|
interface Cart {
|
|
29
15
|
lineItems: LineItem[];
|
|
30
|
-
addItem: (product: Product, additionalParams?: LineItemOptionalParams) => void;
|
|
16
|
+
addItem: (product: Omit<Product, "productVariants">, additionalParams?: LineItemOptionalParams) => void;
|
|
31
17
|
removeItem: (id: string) => void;
|
|
32
18
|
updateQuantity: (id: string, quantity: number) => void;
|
|
33
19
|
getProductQuantity: (productId: string) => number;
|
|
@@ -15,6 +15,7 @@ interface CheckoutFormProps {
|
|
|
15
15
|
fonts?: StripeElementsOptions["fonts"];
|
|
16
16
|
locale?: StripeElementLocale;
|
|
17
17
|
setShippingCost: (cost: number) => void;
|
|
18
|
+
exchangeRate: number;
|
|
18
19
|
}
|
|
19
|
-
export default function CheckoutForm({ storeClient, checkoutId, onSuccess, onError, cancelUrl, clientSecret, customer, currency, checkoutAppearance, fonts, locale, setShippingCost, }: CheckoutFormProps): React.JSX.Element;
|
|
20
|
+
export default function CheckoutForm({ storeClient, checkoutId, onSuccess, onError, cancelUrl, clientSecret, customer, currency, checkoutAppearance, fonts, locale, setShippingCost, exchangeRate, }: CheckoutFormProps): React.JSX.Element;
|
|
20
21
|
export {};
|
|
@@ -10,11 +10,13 @@ export declare const customerSchema: z.ZodObject<{
|
|
|
10
10
|
state: z.ZodOptional<z.ZodString>;
|
|
11
11
|
zipCode: z.ZodString;
|
|
12
12
|
country: z.ZodString;
|
|
13
|
+
countryCode: z.ZodString;
|
|
13
14
|
}, "strip", z.ZodTypeAny, {
|
|
14
15
|
line1: string;
|
|
15
16
|
city: string;
|
|
16
17
|
zipCode: string;
|
|
17
18
|
country: string;
|
|
19
|
+
countryCode: string;
|
|
18
20
|
line2?: string | undefined;
|
|
19
21
|
state?: string | undefined;
|
|
20
22
|
}, {
|
|
@@ -22,6 +24,7 @@ export declare const customerSchema: z.ZodObject<{
|
|
|
22
24
|
city: string;
|
|
23
25
|
zipCode: string;
|
|
24
26
|
country: string;
|
|
27
|
+
countryCode: string;
|
|
25
28
|
line2?: string | undefined;
|
|
26
29
|
state?: string | undefined;
|
|
27
30
|
}>;
|
|
@@ -36,6 +39,7 @@ export declare const customerSchema: z.ZodObject<{
|
|
|
36
39
|
city: string;
|
|
37
40
|
zipCode: string;
|
|
38
41
|
country: string;
|
|
42
|
+
countryCode: string;
|
|
39
43
|
line2?: string | undefined;
|
|
40
44
|
state?: string | undefined;
|
|
41
45
|
};
|
|
@@ -50,6 +54,7 @@ export declare const customerSchema: z.ZodObject<{
|
|
|
50
54
|
city: string;
|
|
51
55
|
zipCode: string;
|
|
52
56
|
country: string;
|
|
57
|
+
countryCode: string;
|
|
53
58
|
line2?: string | undefined;
|
|
54
59
|
state?: string | undefined;
|
|
55
60
|
};
|
|
@@ -58,19 +63,25 @@ export declare const customerSchema: z.ZodObject<{
|
|
|
58
63
|
}>;
|
|
59
64
|
export declare const shippingMethodSchema: z.ZodObject<{
|
|
60
65
|
rateId: z.ZodString;
|
|
61
|
-
name: z.ZodString;
|
|
62
66
|
provider: z.ZodString;
|
|
63
|
-
|
|
67
|
+
price: z.ZodNumber;
|
|
68
|
+
name: z.ZodString;
|
|
69
|
+
pickupPointId: z.ZodOptional<z.ZodString>;
|
|
70
|
+
pickupPointDisplayName: z.ZodOptional<z.ZodString>;
|
|
64
71
|
}, "strip", z.ZodTypeAny, {
|
|
65
72
|
rateId: string;
|
|
66
|
-
name: string;
|
|
67
73
|
provider: string;
|
|
68
|
-
|
|
74
|
+
price: number;
|
|
75
|
+
name: string;
|
|
76
|
+
pickupPointId?: string | undefined;
|
|
77
|
+
pickupPointDisplayName?: string | undefined;
|
|
69
78
|
}, {
|
|
70
79
|
rateId: string;
|
|
71
|
-
name: string;
|
|
72
80
|
provider: string;
|
|
73
|
-
|
|
81
|
+
price: number;
|
|
82
|
+
name: string;
|
|
83
|
+
pickupPointId?: string | undefined;
|
|
84
|
+
pickupPointDisplayName?: string | undefined;
|
|
74
85
|
}>;
|
|
75
86
|
export declare const checkoutSchema: z.ZodObject<{
|
|
76
87
|
customer: z.ZodObject<{
|
|
@@ -84,11 +95,13 @@ export declare const checkoutSchema: z.ZodObject<{
|
|
|
84
95
|
state: z.ZodOptional<z.ZodString>;
|
|
85
96
|
zipCode: z.ZodString;
|
|
86
97
|
country: z.ZodString;
|
|
98
|
+
countryCode: z.ZodString;
|
|
87
99
|
}, "strip", z.ZodTypeAny, {
|
|
88
100
|
line1: string;
|
|
89
101
|
city: string;
|
|
90
102
|
zipCode: string;
|
|
91
103
|
country: string;
|
|
104
|
+
countryCode: string;
|
|
92
105
|
line2?: string | undefined;
|
|
93
106
|
state?: string | undefined;
|
|
94
107
|
}, {
|
|
@@ -96,6 +109,7 @@ export declare const checkoutSchema: z.ZodObject<{
|
|
|
96
109
|
city: string;
|
|
97
110
|
zipCode: string;
|
|
98
111
|
country: string;
|
|
112
|
+
countryCode: string;
|
|
99
113
|
line2?: string | undefined;
|
|
100
114
|
state?: string | undefined;
|
|
101
115
|
}>;
|
|
@@ -110,6 +124,7 @@ export declare const checkoutSchema: z.ZodObject<{
|
|
|
110
124
|
city: string;
|
|
111
125
|
zipCode: string;
|
|
112
126
|
country: string;
|
|
127
|
+
countryCode: string;
|
|
113
128
|
line2?: string | undefined;
|
|
114
129
|
state?: string | undefined;
|
|
115
130
|
};
|
|
@@ -124,6 +139,7 @@ export declare const checkoutSchema: z.ZodObject<{
|
|
|
124
139
|
city: string;
|
|
125
140
|
zipCode: string;
|
|
126
141
|
country: string;
|
|
142
|
+
countryCode: string;
|
|
127
143
|
line2?: string | undefined;
|
|
128
144
|
state?: string | undefined;
|
|
129
145
|
};
|
|
@@ -132,19 +148,25 @@ export declare const checkoutSchema: z.ZodObject<{
|
|
|
132
148
|
}>;
|
|
133
149
|
shipping: z.ZodObject<{
|
|
134
150
|
rateId: z.ZodString;
|
|
135
|
-
name: z.ZodString;
|
|
136
151
|
provider: z.ZodString;
|
|
137
|
-
|
|
152
|
+
price: z.ZodNumber;
|
|
153
|
+
name: z.ZodString;
|
|
154
|
+
pickupPointId: z.ZodOptional<z.ZodString>;
|
|
155
|
+
pickupPointDisplayName: z.ZodOptional<z.ZodString>;
|
|
138
156
|
}, "strip", z.ZodTypeAny, {
|
|
139
157
|
rateId: string;
|
|
140
|
-
name: string;
|
|
141
158
|
provider: string;
|
|
142
|
-
|
|
159
|
+
price: number;
|
|
160
|
+
name: string;
|
|
161
|
+
pickupPointId?: string | undefined;
|
|
162
|
+
pickupPointDisplayName?: string | undefined;
|
|
143
163
|
}, {
|
|
144
164
|
rateId: string;
|
|
145
|
-
name: string;
|
|
146
165
|
provider: string;
|
|
147
|
-
|
|
166
|
+
price: number;
|
|
167
|
+
name: string;
|
|
168
|
+
pickupPointId?: string | undefined;
|
|
169
|
+
pickupPointDisplayName?: string | undefined;
|
|
148
170
|
}>;
|
|
149
171
|
customerId: z.ZodOptional<z.ZodString>;
|
|
150
172
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -157,6 +179,7 @@ export declare const checkoutSchema: z.ZodObject<{
|
|
|
157
179
|
city: string;
|
|
158
180
|
zipCode: string;
|
|
159
181
|
country: string;
|
|
182
|
+
countryCode: string;
|
|
160
183
|
line2?: string | undefined;
|
|
161
184
|
state?: string | undefined;
|
|
162
185
|
};
|
|
@@ -165,9 +188,11 @@ export declare const checkoutSchema: z.ZodObject<{
|
|
|
165
188
|
};
|
|
166
189
|
shipping: {
|
|
167
190
|
rateId: string;
|
|
168
|
-
name: string;
|
|
169
191
|
provider: string;
|
|
170
|
-
|
|
192
|
+
price: number;
|
|
193
|
+
name: string;
|
|
194
|
+
pickupPointId?: string | undefined;
|
|
195
|
+
pickupPointDisplayName?: string | undefined;
|
|
171
196
|
};
|
|
172
197
|
customerId?: string | undefined;
|
|
173
198
|
}, {
|
|
@@ -180,6 +205,7 @@ export declare const checkoutSchema: z.ZodObject<{
|
|
|
180
205
|
city: string;
|
|
181
206
|
zipCode: string;
|
|
182
207
|
country: string;
|
|
208
|
+
countryCode: string;
|
|
183
209
|
line2?: string | undefined;
|
|
184
210
|
state?: string | undefined;
|
|
185
211
|
};
|
|
@@ -188,9 +214,11 @@ export declare const checkoutSchema: z.ZodObject<{
|
|
|
188
214
|
};
|
|
189
215
|
shipping: {
|
|
190
216
|
rateId: string;
|
|
191
|
-
name: string;
|
|
192
217
|
provider: string;
|
|
193
|
-
|
|
218
|
+
price: number;
|
|
219
|
+
name: string;
|
|
220
|
+
pickupPointId?: string | undefined;
|
|
221
|
+
pickupPointDisplayName?: string | undefined;
|
|
194
222
|
};
|
|
195
223
|
customerId?: string | undefined;
|
|
196
224
|
}>;
|
|
@@ -8,6 +8,10 @@ interface ShippingMethodFormProps {
|
|
|
8
8
|
onBack: () => void;
|
|
9
9
|
contactEmail: string;
|
|
10
10
|
shippingAddress: string;
|
|
11
|
+
currency: string;
|
|
12
|
+
exchangeRate: number;
|
|
13
|
+
locale?: string;
|
|
14
|
+
countryCode?: string;
|
|
11
15
|
}
|
|
12
|
-
export default function ShippingMethodForm({ shippingRates, initialData, onSubmit, onBack, contactEmail, shippingAddress, }: ShippingMethodFormProps): React.JSX.Element;
|
|
16
|
+
export default function ShippingMethodForm({ shippingRates, initialData, onSubmit, onBack, contactEmail, shippingAddress, currency, exchangeRate, locale, countryCode, }: ShippingMethodFormProps): React.JSX.Element;
|
|
13
17
|
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare global {
|
|
3
|
+
interface Window {
|
|
4
|
+
Packeta: any;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
export default function ZasilkovnaShippingOption({ children, onPickupPointSelected, locale, countryCode, apiKey, }: {
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
onPickupPointSelected?: (pickupPointId: string, pickupPointName: string) => void;
|
|
10
|
+
locale?: string;
|
|
11
|
+
countryCode?: string;
|
|
12
|
+
apiKey?: string;
|
|
13
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ShippingRate } from "@betterstore/sdk";
|
|
2
|
+
import React from "react";
|
|
3
|
+
export default function ShippingOptionWrapper({ rate, children, onPickupPointSelected, locale, countryCode, }: {
|
|
4
|
+
rate: ShippingRate;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
onPickupPointSelected?: (pickupPointId: string, pickupPointName: string) => void;
|
|
7
|
+
locale?: string;
|
|
8
|
+
countryCode?: string;
|
|
9
|
+
}): React.JSX.Element | undefined;
|