@betterstore/react 0.6.7 → 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,2CAkSnB"}
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
- company: string | null;
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
- company: string | null;
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
- company: string | null;
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
- company: string | null;
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
- company: string | null;
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
- company: string | null;
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
- company: string | null;
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
- company: string | null;
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
- company: string | null;
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
- company: string | null;
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;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/compounds/form/address-input/index.tsx"],"names":[],"mappings":"AAgBA,UAAU,iBAAiB;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,YAAY,CAAC,EAC3B,SAAc,EACd,KAAK,EACL,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,wBAAwB,EACxB,MAAM,GACP,EAAE,iBAAiB,2CA8SnB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/compounds/form/address-input/index.tsx"],"names":[],"mappings":"AAgBA,UAAU,iBAAiB;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,YAAY,CAAC,EAC3B,SAAc,EACd,KAAK,EACL,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,wBAAwB,EACxB,MAAM,GACP,EAAE,iBAAiB,2CAqTnB"}
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-0 h-[2px] -translate-x-0 -translate-y-1/2" }), jsxRuntime.jsxs(LabelComponent, Object.assign({ ref: ref, className: cn("relative z-10 block",
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"
@@ -35984,6 +35984,12 @@ function AddressInput({ className = "", proxy, clientSecret, latitude, longitude
35984
35984
  const availableProvinces = renderProvinceInput
35985
35985
  ? countryProvinces[countryCodeInput]
35986
35986
  : [];
35987
+ React.useEffect(() => {
35988
+ if (cityInput) {
35989
+ setShowAllInputs(true);
35990
+ }
35991
+ // eslint-disable-next-line react-hooks/exhaustive-deps
35992
+ }, []);
35987
35993
  React.useEffect(() => {
35988
35994
  if (!currentAlpha3CountryCode)
35989
35995
  return;
@@ -36122,7 +36128,7 @@ function CustomerForm({ initialData, onSubmit, clientProxy, clientSecret, latitu
36122
36128
  phone: "",
36123
36129
  },
36124
36130
  });
36125
- 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") }) })] }) })));
36126
36132
  }
36127
36133
 
36128
36134
  var reactStripe_umd$1 = {exports: {}};
@@ -42590,6 +42596,7 @@ function CheckoutForm({ storeClient, checkoutId, onSuccess, onError, cancelUrl,
42590
42596
  }, [step, clientSecret, checkoutId]);
42591
42597
  // Handle address form submission
42592
42598
  const handleCustomerSubmit = (data) => __awaiter(this, void 0, void 0, function* () {
42599
+ var _a, _b, _c, _d, _e, _f, _g, _h;
42593
42600
  setFormData(Object.assign(Object.assign({}, formData), { customer: data }));
42594
42601
  let newCustomerId = formData.customerId;
42595
42602
  if (!newCustomerId) {
@@ -42598,7 +42605,7 @@ function CheckoutForm({ storeClient, checkoutId, onSuccess, onError, cancelUrl,
42598
42605
  phone: data.phone,
42599
42606
  firstName: data.firstName,
42600
42607
  lastName: data.lastName,
42601
- 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 }),
42602
42609
  });
42603
42610
  yield storeClient.updateCheckout(clientSecret, checkoutId, {
42604
42611
  customerId: newCustomer.id,
@@ -42611,7 +42618,7 @@ function CheckoutForm({ storeClient, checkoutId, onSuccess, onError, cancelUrl,
42611
42618
  phone: data.phone,
42612
42619
  firstName: data.firstName,
42613
42620
  lastName: data.lastName,
42614
- 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 }),
42615
42622
  });
42616
42623
  }
42617
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-0 h-[2px] -translate-x-0 -translate-y-1/2" }), jsxs(LabelComponent, Object.assign({ ref: ref, className: cn("relative z-10 block",
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"
@@ -35964,6 +35964,12 @@ function AddressInput({ className = "", proxy, clientSecret, latitude, longitude
35964
35964
  const availableProvinces = renderProvinceInput
35965
35965
  ? countryProvinces[countryCodeInput]
35966
35966
  : [];
35967
+ useEffect(() => {
35968
+ if (cityInput) {
35969
+ setShowAllInputs(true);
35970
+ }
35971
+ // eslint-disable-next-line react-hooks/exhaustive-deps
35972
+ }, []);
35967
35973
  useEffect(() => {
35968
35974
  if (!currentAlpha3CountryCode)
35969
35975
  return;
@@ -36102,7 +36108,7 @@ function CustomerForm({ initialData, onSubmit, clientProxy, clientSecret, latitu
36102
36108
  phone: "",
36103
36109
  },
36104
36110
  });
36105
- 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") }) })] }) })));
36106
36112
  }
36107
36113
 
36108
36114
  var reactStripe_umd$1 = {exports: {}};
@@ -42570,6 +42576,7 @@ function CheckoutForm({ storeClient, checkoutId, onSuccess, onError, cancelUrl,
42570
42576
  }, [step, clientSecret, checkoutId]);
42571
42577
  // Handle address form submission
42572
42578
  const handleCustomerSubmit = (data) => __awaiter(this, void 0, void 0, function* () {
42579
+ var _a, _b, _c, _d, _e, _f, _g, _h;
42573
42580
  setFormData(Object.assign(Object.assign({}, formData), { customer: data }));
42574
42581
  let newCustomerId = formData.customerId;
42575
42582
  if (!newCustomerId) {
@@ -42578,7 +42585,7 @@ function CheckoutForm({ storeClient, checkoutId, onSuccess, onError, cancelUrl,
42578
42585
  phone: data.phone,
42579
42586
  firstName: data.firstName,
42580
42587
  lastName: data.lastName,
42581
- 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 }),
42582
42589
  });
42583
42590
  yield storeClient.updateCheckout(clientSecret, checkoutId, {
42584
42591
  customerId: newCustomer.id,
@@ -42591,7 +42598,7 @@ function CheckoutForm({ storeClient, checkoutId, onSuccess, onError, cancelUrl,
42591
42598
  phone: data.phone,
42592
42599
  firstName: data.firstName,
42593
42600
  lastName: data.lastName,
42594
- 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 }),
42595
42602
  });
42596
42603
  }
42597
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.7",
3
+ "version": "0.6.9",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -14,21 +14,19 @@
14
14
  "@rollup/plugin-json": "^6.1.0",
15
15
  "@rollup/plugin-node-resolve": "^16.0.1",
16
16
  "@rollup/plugin-typescript": "^12.1.2",
17
- "@tailwindcss/postcss": "^4.1.11",
18
17
  "@types/culori": "^4.0.0",
19
18
  "@types/node": "^22.15.3",
20
19
  "@types/react": "19.1.0",
21
20
  "@types/react-dom": "19.1.1",
22
- "@vitejs/plugin-react": "^4.5.0",
21
+ "@vitejs/plugin-react": "^5.0.4",
23
22
  "eslint": "^9.29.0",
24
23
  "eslint-plugin-i18next": "^6.1.2",
25
- "postcss": "^8.5.3",
26
24
  "rollup": "^4.41.1",
27
25
  "rollup-plugin-dts": "^6.2.1",
28
26
  "rollup-plugin-peer-deps-external": "^2.2.4",
29
27
  "tailwindcss": "^4.1.11",
30
28
  "typescript": "5.8.2",
31
- "vite": "^6.3.5",
29
+ "vite": "^7.1.9",
32
30
  "@betterstore/eslint-config": "0.0.0",
33
31
  "@betterstore/typescript-config": "0.0.0"
34
32
  },
@@ -58,6 +56,7 @@
58
56
  "@rollup/plugin-alias": "^5.1.1",
59
57
  "@stripe/react-stripe-js": "^3.7.0",
60
58
  "@stripe/stripe-js": "^5.10.0",
59
+ "@tailwindcss/vite": "^4.1.14",
61
60
  "add": "^2.0.6",
62
61
  "axios": "^1.9.0",
63
62
  "class-variance-authority": "^0.7.1",
@@ -78,7 +77,7 @@
78
77
  "world_countries_lists": "^3.2.0",
79
78
  "zod": "^3.25.30",
80
79
  "zustand": "^5.0.5",
81
- "@betterstore/sdk": "0.6.7"
80
+ "@betterstore/sdk": "0.6.9"
82
81
  },
83
82
  "publishConfig": {
84
83
  "access": "public"