@betterstore/react 0.6.8 → 0.6.9
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkout-form.d.ts","sourceRoot":"","sources":["../../../src/components/checkout-embed/checkout-form.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAGhB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAcvD,UAAU,iBAAiB;IACzB,WAAW,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;IAClD,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,kBAAkB,CAAC,EAAE,gBAAgB,CAAC;IACtC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,eAAe,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,SAAS,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC;CACzC;AAED,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,WAAW,EACX,UAAU,EACV,SAAS,EACT,OAAO,EACP,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,kBAAkB,EAClB,KAAK,EACL,MAAM,EACN,eAAe,EACf,YAAY,EACZ,aAAa,EACb,SAAS,EACT,mBAAmB,EACnB,WAAW,EACX,QAAQ,EACR,SAAS,EACT,wBAAwB,EACxB,SAAS,GACV,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"checkout-form.d.ts","sourceRoot":"","sources":["../../../src/components/checkout-embed/checkout-form.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAGhB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAcvD,UAAU,iBAAiB;IACzB,WAAW,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;IAClD,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,kBAAkB,CAAC,EAAE,gBAAgB,CAAC;IACtC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,eAAe,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,SAAS,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC;CACzC;AAED,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,WAAW,EACX,UAAU,EACV,SAAS,EACT,OAAO,EACP,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,kBAAkB,EAClB,KAAK,EACL,MAAM,EACN,eAAe,EACf,YAAY,EACZ,aAAa,EACb,SAAS,EACT,mBAAmB,EACnB,WAAW,EACX,QAAQ,EACR,SAAS,EACT,wBAAwB,EACxB,SAAS,GACV,EAAE,iBAAiB,2CA0SnB"}
|
|
@@ -5,34 +5,34 @@ export declare const customerSchema: z.ZodObject<{
|
|
|
5
5
|
lastName: z.ZodString;
|
|
6
6
|
address: z.ZodObject<{
|
|
7
7
|
line1: z.ZodString;
|
|
8
|
-
line2: z.ZodNullable<z.ZodString
|
|
8
|
+
line2: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
9
9
|
city: z.ZodString;
|
|
10
|
-
province: z.ZodNullable<z.ZodString
|
|
11
|
-
provinceCode: z.ZodNullable<z.ZodString
|
|
10
|
+
province: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
11
|
+
provinceCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
12
12
|
zipCode: z.ZodString;
|
|
13
13
|
country: z.ZodString;
|
|
14
14
|
countryCode: z.ZodString;
|
|
15
|
-
company: z.ZodNullable<z.ZodString
|
|
15
|
+
company: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
16
16
|
}, "strip", z.ZodTypeAny, {
|
|
17
17
|
line1: string;
|
|
18
|
-
line2: string | null;
|
|
19
18
|
city: string;
|
|
20
|
-
province: string | null;
|
|
21
|
-
provinceCode: string | null;
|
|
22
19
|
zipCode: string;
|
|
23
20
|
country: string;
|
|
24
21
|
countryCode: string;
|
|
25
|
-
|
|
22
|
+
line2?: string | null | undefined;
|
|
23
|
+
province?: string | null | undefined;
|
|
24
|
+
provinceCode?: string | null | undefined;
|
|
25
|
+
company?: string | null | undefined;
|
|
26
26
|
}, {
|
|
27
27
|
line1: string;
|
|
28
|
-
line2: string | null;
|
|
29
28
|
city: string;
|
|
30
|
-
province: string | null;
|
|
31
|
-
provinceCode: string | null;
|
|
32
29
|
zipCode: string;
|
|
33
30
|
country: string;
|
|
34
31
|
countryCode: string;
|
|
35
|
-
|
|
32
|
+
line2?: string | null | undefined;
|
|
33
|
+
province?: string | null | undefined;
|
|
34
|
+
provinceCode?: string | null | undefined;
|
|
35
|
+
company?: string | null | undefined;
|
|
36
36
|
}>;
|
|
37
37
|
phone: z.ZodString;
|
|
38
38
|
isEmailSubscribed: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -42,14 +42,14 @@ export declare const customerSchema: z.ZodObject<{
|
|
|
42
42
|
lastName: string;
|
|
43
43
|
address: {
|
|
44
44
|
line1: string;
|
|
45
|
-
line2: string | null;
|
|
46
45
|
city: string;
|
|
47
|
-
province: string | null;
|
|
48
|
-
provinceCode: string | null;
|
|
49
46
|
zipCode: string;
|
|
50
47
|
country: string;
|
|
51
48
|
countryCode: string;
|
|
52
|
-
|
|
49
|
+
line2?: string | null | undefined;
|
|
50
|
+
province?: string | null | undefined;
|
|
51
|
+
provinceCode?: string | null | undefined;
|
|
52
|
+
company?: string | null | undefined;
|
|
53
53
|
};
|
|
54
54
|
phone: string;
|
|
55
55
|
isEmailSubscribed?: boolean | undefined;
|
|
@@ -59,14 +59,14 @@ export declare const customerSchema: z.ZodObject<{
|
|
|
59
59
|
lastName: string;
|
|
60
60
|
address: {
|
|
61
61
|
line1: string;
|
|
62
|
-
line2: string | null;
|
|
63
62
|
city: string;
|
|
64
|
-
province: string | null;
|
|
65
|
-
provinceCode: string | null;
|
|
66
63
|
zipCode: string;
|
|
67
64
|
country: string;
|
|
68
65
|
countryCode: string;
|
|
69
|
-
|
|
66
|
+
line2?: string | null | undefined;
|
|
67
|
+
province?: string | null | undefined;
|
|
68
|
+
provinceCode?: string | null | undefined;
|
|
69
|
+
company?: string | null | undefined;
|
|
70
70
|
};
|
|
71
71
|
phone: string;
|
|
72
72
|
isEmailSubscribed?: boolean | undefined;
|
|
@@ -114,34 +114,34 @@ export declare const checkoutSchema: z.ZodObject<{
|
|
|
114
114
|
lastName: z.ZodString;
|
|
115
115
|
address: z.ZodObject<{
|
|
116
116
|
line1: z.ZodString;
|
|
117
|
-
line2: z.ZodNullable<z.ZodString
|
|
117
|
+
line2: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
118
118
|
city: z.ZodString;
|
|
119
|
-
province: z.ZodNullable<z.ZodString
|
|
120
|
-
provinceCode: z.ZodNullable<z.ZodString
|
|
119
|
+
province: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
120
|
+
provinceCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
121
121
|
zipCode: z.ZodString;
|
|
122
122
|
country: z.ZodString;
|
|
123
123
|
countryCode: z.ZodString;
|
|
124
|
-
company: z.ZodNullable<z.ZodString
|
|
124
|
+
company: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
125
125
|
}, "strip", z.ZodTypeAny, {
|
|
126
126
|
line1: string;
|
|
127
|
-
line2: string | null;
|
|
128
127
|
city: string;
|
|
129
|
-
province: string | null;
|
|
130
|
-
provinceCode: string | null;
|
|
131
128
|
zipCode: string;
|
|
132
129
|
country: string;
|
|
133
130
|
countryCode: string;
|
|
134
|
-
|
|
131
|
+
line2?: string | null | undefined;
|
|
132
|
+
province?: string | null | undefined;
|
|
133
|
+
provinceCode?: string | null | undefined;
|
|
134
|
+
company?: string | null | undefined;
|
|
135
135
|
}, {
|
|
136
136
|
line1: string;
|
|
137
|
-
line2: string | null;
|
|
138
137
|
city: string;
|
|
139
|
-
province: string | null;
|
|
140
|
-
provinceCode: string | null;
|
|
141
138
|
zipCode: string;
|
|
142
139
|
country: string;
|
|
143
140
|
countryCode: string;
|
|
144
|
-
|
|
141
|
+
line2?: string | null | undefined;
|
|
142
|
+
province?: string | null | undefined;
|
|
143
|
+
provinceCode?: string | null | undefined;
|
|
144
|
+
company?: string | null | undefined;
|
|
145
145
|
}>;
|
|
146
146
|
phone: z.ZodString;
|
|
147
147
|
isEmailSubscribed: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -151,14 +151,14 @@ export declare const checkoutSchema: z.ZodObject<{
|
|
|
151
151
|
lastName: string;
|
|
152
152
|
address: {
|
|
153
153
|
line1: string;
|
|
154
|
-
line2: string | null;
|
|
155
154
|
city: string;
|
|
156
|
-
province: string | null;
|
|
157
|
-
provinceCode: string | null;
|
|
158
155
|
zipCode: string;
|
|
159
156
|
country: string;
|
|
160
157
|
countryCode: string;
|
|
161
|
-
|
|
158
|
+
line2?: string | null | undefined;
|
|
159
|
+
province?: string | null | undefined;
|
|
160
|
+
provinceCode?: string | null | undefined;
|
|
161
|
+
company?: string | null | undefined;
|
|
162
162
|
};
|
|
163
163
|
phone: string;
|
|
164
164
|
isEmailSubscribed?: boolean | undefined;
|
|
@@ -168,14 +168,14 @@ export declare const checkoutSchema: z.ZodObject<{
|
|
|
168
168
|
lastName: string;
|
|
169
169
|
address: {
|
|
170
170
|
line1: string;
|
|
171
|
-
line2: string | null;
|
|
172
171
|
city: string;
|
|
173
|
-
province: string | null;
|
|
174
|
-
provinceCode: string | null;
|
|
175
172
|
zipCode: string;
|
|
176
173
|
country: string;
|
|
177
174
|
countryCode: string;
|
|
178
|
-
|
|
175
|
+
line2?: string | null | undefined;
|
|
176
|
+
province?: string | null | undefined;
|
|
177
|
+
provinceCode?: string | null | undefined;
|
|
178
|
+
company?: string | null | undefined;
|
|
179
179
|
};
|
|
180
180
|
phone: string;
|
|
181
181
|
isEmailSubscribed?: boolean | undefined;
|
|
@@ -224,14 +224,14 @@ export declare const checkoutSchema: z.ZodObject<{
|
|
|
224
224
|
lastName: string;
|
|
225
225
|
address: {
|
|
226
226
|
line1: string;
|
|
227
|
-
line2: string | null;
|
|
228
227
|
city: string;
|
|
229
|
-
province: string | null;
|
|
230
|
-
provinceCode: string | null;
|
|
231
228
|
zipCode: string;
|
|
232
229
|
country: string;
|
|
233
230
|
countryCode: string;
|
|
234
|
-
|
|
231
|
+
line2?: string | null | undefined;
|
|
232
|
+
province?: string | null | undefined;
|
|
233
|
+
provinceCode?: string | null | undefined;
|
|
234
|
+
company?: string | null | undefined;
|
|
235
235
|
};
|
|
236
236
|
phone: string;
|
|
237
237
|
isEmailSubscribed?: boolean | undefined;
|
|
@@ -252,14 +252,14 @@ export declare const checkoutSchema: z.ZodObject<{
|
|
|
252
252
|
lastName: string;
|
|
253
253
|
address: {
|
|
254
254
|
line1: string;
|
|
255
|
-
line2: string | null;
|
|
256
255
|
city: string;
|
|
257
|
-
province: string | null;
|
|
258
|
-
provinceCode: string | null;
|
|
259
256
|
zipCode: string;
|
|
260
257
|
country: string;
|
|
261
258
|
countryCode: string;
|
|
262
|
-
|
|
259
|
+
line2?: string | null | undefined;
|
|
260
|
+
province?: string | null | undefined;
|
|
261
|
+
provinceCode?: string | null | undefined;
|
|
262
|
+
company?: string | null | undefined;
|
|
263
263
|
};
|
|
264
264
|
phone: string;
|
|
265
265
|
isEmailSubscribed?: boolean | undefined;
|
package/dist/index.cjs.js
CHANGED
|
@@ -13588,14 +13588,14 @@ const customerSchema = objectType({
|
|
|
13588
13588
|
lastName: stringType().min(1, "required_error"),
|
|
13589
13589
|
address: objectType({
|
|
13590
13590
|
line1: stringType().min(1, "required_error"),
|
|
13591
|
-
line2: stringType().nullable(),
|
|
13591
|
+
line2: stringType().nullable().optional(),
|
|
13592
13592
|
city: stringType().min(1, "required_error"),
|
|
13593
|
-
province: stringType().nullable(),
|
|
13594
|
-
provinceCode: stringType().nullable(),
|
|
13593
|
+
province: stringType().nullable().optional(),
|
|
13594
|
+
provinceCode: stringType().nullable().optional(),
|
|
13595
13595
|
zipCode: stringType().min(5, "invalid_zipCode"),
|
|
13596
13596
|
country: stringType().min(1, "required_error"),
|
|
13597
13597
|
countryCode: stringType().min(1, "required_error"),
|
|
13598
|
-
company: stringType().nullable(),
|
|
13598
|
+
company: stringType().nullable().optional(),
|
|
13599
13599
|
}),
|
|
13600
13600
|
phone: stringType().regex(phoneRegex, "invalid_phone"),
|
|
13601
13601
|
isEmailSubscribed: booleanType().optional(),
|
|
@@ -19217,7 +19217,7 @@ const FloatingLabel = React__namespace.forwardRef((_a, ref) => {
|
|
|
19217
19217
|
const LabelComponent = isFormLabel ? FormLabel : Label;
|
|
19218
19218
|
const isEmpty = !value || value.length === 0;
|
|
19219
19219
|
const isFloating = isFocused || !isEmpty;
|
|
19220
|
-
return (jsxRuntime.jsxs("div", { className: cn("pointer-events-none absolute translate-x-2", "z-10 block", "duration-200 ease-in-out", isFloating ? "top-0 -translate-y-1/2" : "top-1/2 -translate-y-1/2", className), children: [jsxRuntime.jsx("div", { className: "bg-background absolute left-0 right-0 top-1/2 z-
|
|
19220
|
+
return (jsxRuntime.jsxs("div", { className: cn("pointer-events-none absolute translate-x-2", "z-10 block", "duration-200 ease-in-out", isFloating ? "top-0 -translate-y-1/2" : "top-1/2 -translate-y-1/2", className), children: [jsxRuntime.jsx("div", { className: "bg-background absolute left-0 right-0 top-1/2 z-10 h-[5px] -translate-x-0 -translate-y-[calc(50%+2px)]" }), jsxRuntime.jsxs(LabelComponent, Object.assign({ ref: ref, className: cn("relative z-20 block",
|
|
19221
19221
|
// "after:bg-background after:absolute after:left-0 after:right-0 after:top-1/2 after:z-0 after:h-px after:-translate-y-1/2 after:content-['']",
|
|
19222
19222
|
"m-0 p-0 px-1 leading-none", "duration-200 ease-in-out", isFloating
|
|
19223
19223
|
? "text-xs font-medium"
|
|
@@ -36128,7 +36128,7 @@ function CustomerForm({ initialData, onSubmit, clientProxy, clientSecret, latitu
|
|
|
36128
36128
|
phone: "",
|
|
36129
36129
|
},
|
|
36130
36130
|
});
|
|
36131
|
-
return (jsxRuntime.jsx(Form, Object.assign({}, form, { children: jsxRuntime.jsxs("form", { onSubmit: form.handleSubmit(onSubmit), className: "grid gap-5 md:grid-cols-2", children: [jsxRuntime.jsx("div", { className: "md:col-span-2", children: jsxRuntime.jsx("h2", { children: t("CheckoutEmbed.CustomerForm.title") }) }), jsxRuntime.jsx(InputGroup, { className: "md:col-span-2", name: "email", label: t("CheckoutEmbed.CustomerForm.email"), type: "email", autoComplete: "email" }), jsxRuntime.jsx(InputGroup, { name: "firstName", label: t("CheckoutEmbed.CustomerForm.firstName"), autoComplete: "given-name" }), jsxRuntime.jsx(InputGroup, { name: "lastName", label: t("CheckoutEmbed.CustomerForm.lastName"), autoComplete: "family-name" }), jsxRuntime.jsx(AddressInput, { className: "md:col-span-2", proxy: clientProxy, clientSecret: clientSecret, latitude: latitude, longitude: longitude, currentAlpha3CountryCode: currentAlpha3CountryCode, locale: locale }), jsxRuntime.jsx(InputGroup, { name: "phone", label: t("CheckoutEmbed.CustomerForm.phone"), type: "tel", autoComplete: "tel" }), jsxRuntime.jsx("div", { className: "flex justify-end pt-2 md:col-span-2", children: jsxRuntime.jsx(SubmitButton, { isValid: form.formState.isValid, isSubmitting: form.formState.isSubmitting, children: t("CheckoutEmbed.CustomerForm.button") }) })] }) })));
|
|
36131
|
+
return (jsxRuntime.jsx(Form, Object.assign({}, form, { children: jsxRuntime.jsxs("form", { onSubmit: form.handleSubmit(onSubmit), className: "grid gap-5 md:grid-cols-2", children: [jsxRuntime.jsx("div", { className: "md:col-span-2", children: jsxRuntime.jsx("h2", { children: t("CheckoutEmbed.CustomerForm.title") }) }), jsxRuntime.jsx(InputGroup, { className: "md:col-span-2", name: "email", label: t("CheckoutEmbed.CustomerForm.email"), type: "email", autoComplete: "email" }), jsxRuntime.jsx(InputGroup, { name: "firstName", label: t("CheckoutEmbed.CustomerForm.firstName"), autoComplete: "given-name" }), jsxRuntime.jsx(InputGroup, { name: "lastName", label: t("CheckoutEmbed.CustomerForm.lastName"), autoComplete: "family-name" }), jsxRuntime.jsx(AddressInput, { className: "md:col-span-2", proxy: clientProxy, clientSecret: clientSecret, latitude: latitude, longitude: longitude, currentAlpha3CountryCode: currentAlpha3CountryCode, locale: locale }), jsxRuntime.jsx(InputGroup, { name: "phone", label: t("CheckoutEmbed.CustomerForm.phone"), type: "tel", autoComplete: "tel" }), jsxRuntime.jsx("div", { className: "flex justify-end pt-2 md:col-span-2", children: jsxRuntime.jsx(SubmitButton, { isValid: form.formState.isDirty || form.formState.isValid, isSubmitting: form.formState.isSubmitting, children: t("CheckoutEmbed.CustomerForm.button") }) })] }) })));
|
|
36132
36132
|
}
|
|
36133
36133
|
|
|
36134
36134
|
var reactStripe_umd$1 = {exports: {}};
|
|
@@ -42596,6 +42596,7 @@ function CheckoutForm({ storeClient, checkoutId, onSuccess, onError, cancelUrl,
|
|
|
42596
42596
|
}, [step, clientSecret, checkoutId]);
|
|
42597
42597
|
// Handle address form submission
|
|
42598
42598
|
const handleCustomerSubmit = (data) => __awaiter(this, void 0, void 0, function* () {
|
|
42599
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
42599
42600
|
setFormData(Object.assign(Object.assign({}, formData), { customer: data }));
|
|
42600
42601
|
let newCustomerId = formData.customerId;
|
|
42601
42602
|
if (!newCustomerId) {
|
|
@@ -42604,7 +42605,7 @@ function CheckoutForm({ storeClient, checkoutId, onSuccess, onError, cancelUrl,
|
|
|
42604
42605
|
phone: data.phone,
|
|
42605
42606
|
firstName: data.firstName,
|
|
42606
42607
|
lastName: data.lastName,
|
|
42607
|
-
address: Object.assign(Object.assign({}, data.address), { phone: data.phone, name: data.firstName + " " + data.lastName }),
|
|
42608
|
+
address: Object.assign(Object.assign({}, data.address), { company: (_a = data.address.company) !== null && _a !== void 0 ? _a : null, line2: (_b = data.address.line2) !== null && _b !== void 0 ? _b : null, province: (_c = data.address.province) !== null && _c !== void 0 ? _c : null, provinceCode: (_d = data.address.provinceCode) !== null && _d !== void 0 ? _d : null, phone: data.phone, name: data.firstName + " " + data.lastName }),
|
|
42608
42609
|
});
|
|
42609
42610
|
yield storeClient.updateCheckout(clientSecret, checkoutId, {
|
|
42610
42611
|
customerId: newCustomer.id,
|
|
@@ -42617,7 +42618,7 @@ function CheckoutForm({ storeClient, checkoutId, onSuccess, onError, cancelUrl,
|
|
|
42617
42618
|
phone: data.phone,
|
|
42618
42619
|
firstName: data.firstName,
|
|
42619
42620
|
lastName: data.lastName,
|
|
42620
|
-
address: Object.assign(Object.assign({}, data.address), { phone: data.phone, name: data.firstName + " " + data.lastName }),
|
|
42621
|
+
address: Object.assign(Object.assign({}, data.address), { company: (_e = data.address.company) !== null && _e !== void 0 ? _e : null, line2: (_f = data.address.line2) !== null && _f !== void 0 ? _f : null, province: (_g = data.address.province) !== null && _g !== void 0 ? _g : null, provinceCode: (_h = data.address.provinceCode) !== null && _h !== void 0 ? _h : null, phone: data.phone, name: data.firstName + " " + data.lastName }),
|
|
42621
42622
|
});
|
|
42622
42623
|
}
|
|
42623
42624
|
const shippingRates = yield storeClient.getCheckoutShippingRates(clientSecret, checkoutId);
|
package/dist/index.mjs
CHANGED
|
@@ -13568,14 +13568,14 @@ const customerSchema = objectType({
|
|
|
13568
13568
|
lastName: stringType().min(1, "required_error"),
|
|
13569
13569
|
address: objectType({
|
|
13570
13570
|
line1: stringType().min(1, "required_error"),
|
|
13571
|
-
line2: stringType().nullable(),
|
|
13571
|
+
line2: stringType().nullable().optional(),
|
|
13572
13572
|
city: stringType().min(1, "required_error"),
|
|
13573
|
-
province: stringType().nullable(),
|
|
13574
|
-
provinceCode: stringType().nullable(),
|
|
13573
|
+
province: stringType().nullable().optional(),
|
|
13574
|
+
provinceCode: stringType().nullable().optional(),
|
|
13575
13575
|
zipCode: stringType().min(5, "invalid_zipCode"),
|
|
13576
13576
|
country: stringType().min(1, "required_error"),
|
|
13577
13577
|
countryCode: stringType().min(1, "required_error"),
|
|
13578
|
-
company: stringType().nullable(),
|
|
13578
|
+
company: stringType().nullable().optional(),
|
|
13579
13579
|
}),
|
|
13580
13580
|
phone: stringType().regex(phoneRegex, "invalid_phone"),
|
|
13581
13581
|
isEmailSubscribed: booleanType().optional(),
|
|
@@ -19197,7 +19197,7 @@ const FloatingLabel = React.forwardRef((_a, ref) => {
|
|
|
19197
19197
|
const LabelComponent = isFormLabel ? FormLabel : Label;
|
|
19198
19198
|
const isEmpty = !value || value.length === 0;
|
|
19199
19199
|
const isFloating = isFocused || !isEmpty;
|
|
19200
|
-
return (jsxs("div", { className: cn("pointer-events-none absolute translate-x-2", "z-10 block", "duration-200 ease-in-out", isFloating ? "top-0 -translate-y-1/2" : "top-1/2 -translate-y-1/2", className), children: [jsx("div", { className: "bg-background absolute left-0 right-0 top-1/2 z-
|
|
19200
|
+
return (jsxs("div", { className: cn("pointer-events-none absolute translate-x-2", "z-10 block", "duration-200 ease-in-out", isFloating ? "top-0 -translate-y-1/2" : "top-1/2 -translate-y-1/2", className), children: [jsx("div", { className: "bg-background absolute left-0 right-0 top-1/2 z-10 h-[5px] -translate-x-0 -translate-y-[calc(50%+2px)]" }), jsxs(LabelComponent, Object.assign({ ref: ref, className: cn("relative z-20 block",
|
|
19201
19201
|
// "after:bg-background after:absolute after:left-0 after:right-0 after:top-1/2 after:z-0 after:h-px after:-translate-y-1/2 after:content-['']",
|
|
19202
19202
|
"m-0 p-0 px-1 leading-none", "duration-200 ease-in-out", isFloating
|
|
19203
19203
|
? "text-xs font-medium"
|
|
@@ -36108,7 +36108,7 @@ function CustomerForm({ initialData, onSubmit, clientProxy, clientSecret, latitu
|
|
|
36108
36108
|
phone: "",
|
|
36109
36109
|
},
|
|
36110
36110
|
});
|
|
36111
|
-
return (jsx(Form, Object.assign({}, form, { children: jsxs("form", { onSubmit: form.handleSubmit(onSubmit), className: "grid gap-5 md:grid-cols-2", children: [jsx("div", { className: "md:col-span-2", children: jsx("h2", { children: t("CheckoutEmbed.CustomerForm.title") }) }), jsx(InputGroup, { className: "md:col-span-2", name: "email", label: t("CheckoutEmbed.CustomerForm.email"), type: "email", autoComplete: "email" }), jsx(InputGroup, { name: "firstName", label: t("CheckoutEmbed.CustomerForm.firstName"), autoComplete: "given-name" }), jsx(InputGroup, { name: "lastName", label: t("CheckoutEmbed.CustomerForm.lastName"), autoComplete: "family-name" }), jsx(AddressInput, { className: "md:col-span-2", proxy: clientProxy, clientSecret: clientSecret, latitude: latitude, longitude: longitude, currentAlpha3CountryCode: currentAlpha3CountryCode, locale: locale }), jsx(InputGroup, { name: "phone", label: t("CheckoutEmbed.CustomerForm.phone"), type: "tel", autoComplete: "tel" }), jsx("div", { className: "flex justify-end pt-2 md:col-span-2", children: jsx(SubmitButton, { isValid: form.formState.isValid, isSubmitting: form.formState.isSubmitting, children: t("CheckoutEmbed.CustomerForm.button") }) })] }) })));
|
|
36111
|
+
return (jsx(Form, Object.assign({}, form, { children: jsxs("form", { onSubmit: form.handleSubmit(onSubmit), className: "grid gap-5 md:grid-cols-2", children: [jsx("div", { className: "md:col-span-2", children: jsx("h2", { children: t("CheckoutEmbed.CustomerForm.title") }) }), jsx(InputGroup, { className: "md:col-span-2", name: "email", label: t("CheckoutEmbed.CustomerForm.email"), type: "email", autoComplete: "email" }), jsx(InputGroup, { name: "firstName", label: t("CheckoutEmbed.CustomerForm.firstName"), autoComplete: "given-name" }), jsx(InputGroup, { name: "lastName", label: t("CheckoutEmbed.CustomerForm.lastName"), autoComplete: "family-name" }), jsx(AddressInput, { className: "md:col-span-2", proxy: clientProxy, clientSecret: clientSecret, latitude: latitude, longitude: longitude, currentAlpha3CountryCode: currentAlpha3CountryCode, locale: locale }), jsx(InputGroup, { name: "phone", label: t("CheckoutEmbed.CustomerForm.phone"), type: "tel", autoComplete: "tel" }), jsx("div", { className: "flex justify-end pt-2 md:col-span-2", children: jsx(SubmitButton, { isValid: form.formState.isDirty || form.formState.isValid, isSubmitting: form.formState.isSubmitting, children: t("CheckoutEmbed.CustomerForm.button") }) })] }) })));
|
|
36112
36112
|
}
|
|
36113
36113
|
|
|
36114
36114
|
var reactStripe_umd$1 = {exports: {}};
|
|
@@ -42576,6 +42576,7 @@ function CheckoutForm({ storeClient, checkoutId, onSuccess, onError, cancelUrl,
|
|
|
42576
42576
|
}, [step, clientSecret, checkoutId]);
|
|
42577
42577
|
// Handle address form submission
|
|
42578
42578
|
const handleCustomerSubmit = (data) => __awaiter(this, void 0, void 0, function* () {
|
|
42579
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
42579
42580
|
setFormData(Object.assign(Object.assign({}, formData), { customer: data }));
|
|
42580
42581
|
let newCustomerId = formData.customerId;
|
|
42581
42582
|
if (!newCustomerId) {
|
|
@@ -42584,7 +42585,7 @@ function CheckoutForm({ storeClient, checkoutId, onSuccess, onError, cancelUrl,
|
|
|
42584
42585
|
phone: data.phone,
|
|
42585
42586
|
firstName: data.firstName,
|
|
42586
42587
|
lastName: data.lastName,
|
|
42587
|
-
address: Object.assign(Object.assign({}, data.address), { phone: data.phone, name: data.firstName + " " + data.lastName }),
|
|
42588
|
+
address: Object.assign(Object.assign({}, data.address), { company: (_a = data.address.company) !== null && _a !== void 0 ? _a : null, line2: (_b = data.address.line2) !== null && _b !== void 0 ? _b : null, province: (_c = data.address.province) !== null && _c !== void 0 ? _c : null, provinceCode: (_d = data.address.provinceCode) !== null && _d !== void 0 ? _d : null, phone: data.phone, name: data.firstName + " " + data.lastName }),
|
|
42588
42589
|
});
|
|
42589
42590
|
yield storeClient.updateCheckout(clientSecret, checkoutId, {
|
|
42590
42591
|
customerId: newCustomer.id,
|
|
@@ -42597,7 +42598,7 @@ function CheckoutForm({ storeClient, checkoutId, onSuccess, onError, cancelUrl,
|
|
|
42597
42598
|
phone: data.phone,
|
|
42598
42599
|
firstName: data.firstName,
|
|
42599
42600
|
lastName: data.lastName,
|
|
42600
|
-
address: Object.assign(Object.assign({}, data.address), { phone: data.phone, name: data.firstName + " " + data.lastName }),
|
|
42601
|
+
address: Object.assign(Object.assign({}, data.address), { company: (_e = data.address.company) !== null && _e !== void 0 ? _e : null, line2: (_f = data.address.line2) !== null && _f !== void 0 ? _f : null, province: (_g = data.address.province) !== null && _g !== void 0 ? _g : null, provinceCode: (_h = data.address.provinceCode) !== null && _h !== void 0 ? _h : null, phone: data.phone, name: data.firstName + " " + data.lastName }),
|
|
42601
42602
|
});
|
|
42602
42603
|
}
|
|
42603
42604
|
const shippingRates = yield storeClient.getCheckoutShippingRates(clientSecret, checkoutId);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@betterstore/react",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.9",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"world_countries_lists": "^3.2.0",
|
|
78
78
|
"zod": "^3.25.30",
|
|
79
79
|
"zustand": "^5.0.5",
|
|
80
|
-
"@betterstore/sdk": "0.6.
|
|
80
|
+
"@betterstore/sdk": "0.6.9"
|
|
81
81
|
},
|
|
82
82
|
"publishConfig": {
|
|
83
83
|
"access": "public"
|