@betterstore/react 0.5.14 → 0.5.15

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":"AACA,OAAO,EACL,eAAe,EACf,iBAAiB,EAElB,MAAM,kBAAkB,CAAC;AAC1B,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;CACnC;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,GACzB,EAAE,iBAAiB,2CA+QnB"}
1
+ {"version":3,"file":"checkout-form.d.ts","sourceRoot":"","sources":["../../../src/components/checkout-embed/checkout-form.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,iBAAiB,EAElB,MAAM,kBAAkB,CAAC;AAC1B,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;CACnC;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,GACzB,EAAE,iBAAiB,2CAgRnB"}
@@ -7,7 +7,8 @@ interface CustomerFormProps {
7
7
  latitude?: number;
8
8
  longitude?: number;
9
9
  currentAlpha2CountryCode?: string;
10
+ locale?: string;
10
11
  }
11
- export default function CustomerForm({ initialData, onSubmit, clientProxy, clientSecret, latitude, longitude, currentAlpha2CountryCode, }: CustomerFormProps): import("react/jsx-runtime").JSX.Element;
12
+ export default function CustomerForm({ initialData, onSubmit, clientProxy, clientSecret, latitude, longitude, currentAlpha2CountryCode, locale, }: CustomerFormProps): import("react/jsx-runtime").JSX.Element;
12
13
  export {};
13
14
  //# sourceMappingURL=form.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../../../../src/components/checkout-embed/steps/customer/form.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,gBAAgB,EAAkB,MAAM,uBAAuB,CAAC;AAE9E,UAAU,iBAAiB;IACzB,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B,QAAQ,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACnC;AAED,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,WAAW,EACX,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,wBAAwB,GACzB,EAAE,iBAAiB,2CA+EnB"}
1
+ {"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../../../../src/components/checkout-embed/steps/customer/form.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,gBAAgB,EAAkB,MAAM,uBAAuB,CAAC;AAE9E,UAAU,iBAAiB;IACzB,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B,QAAQ,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,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,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,WAAW,EACX,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,wBAAwB,EACxB,MAAM,GACP,EAAE,iBAAiB,2CAgFnB"}
@@ -5,7 +5,8 @@ interface AddressInputProps {
5
5
  latitude?: number;
6
6
  longitude?: number;
7
7
  currentAlpha2CountryCode?: string;
8
+ locale?: string;
8
9
  }
9
- export declare function AddressInput({ className, proxy, clientSecret, latitude, longitude, currentAlpha2CountryCode, }: AddressInputProps): import("react/jsx-runtime").JSX.Element;
10
+ export declare function AddressInput({ className, proxy, clientSecret, latitude, longitude, currentAlpha2CountryCode, locale, }: AddressInputProps): import("react/jsx-runtime").JSX.Element;
10
11
  export {};
11
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/compounds/form/address-input/index.tsx"],"names":[],"mappings":"AA+BA,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;CACnC;AAED,wBAAgB,YAAY,CAAC,EAC3B,SAAc,EACd,KAAK,EACL,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,wBAAwB,GACzB,EAAE,iBAAiB,2CAqOnB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/compounds/form/address-input/index.tsx"],"names":[],"mappings":"AA2BA,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,2CAgOnB"}
package/dist/index.cjs.js CHANGED
@@ -7414,21 +7414,6 @@ var Client = class {
7414
7414
  });
7415
7415
  return data;
7416
7416
  }
7417
- /**
7418
- * Get geocode address results
7419
- */
7420
- async getGeocodeAddressResults(clientSecret, params) {
7421
- const apiClient = createApiClient(clientSecret, this.proxy);
7422
- const { position, ...rest } = params;
7423
- const { data } = await apiClient.get("/helpers/geocode-address", {
7424
- params: {
7425
- ...rest,
7426
- lat: position.lat,
7427
- lng: position.lng
7428
- }
7429
- });
7430
- return data;
7431
- }
7432
7417
  };
7433
7418
  var client_default = Client;
7434
7419
 
@@ -23582,8 +23567,8 @@ const createLucideIcon = (iconName, iconNode) => {
23582
23567
  */
23583
23568
 
23584
23569
 
23585
- const __iconNode$8 = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
23586
- const Check = createLucideIcon("Check", __iconNode$8);
23570
+ const __iconNode$7 = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
23571
+ const Check = createLucideIcon("Check", __iconNode$7);
23587
23572
 
23588
23573
  /**
23589
23574
  * @license lucide-react v0.479.0 - ISC
@@ -23593,8 +23578,8 @@ const Check = createLucideIcon("Check", __iconNode$8);
23593
23578
  */
23594
23579
 
23595
23580
 
23596
- const __iconNode$7 = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
23597
- const ChevronDown = createLucideIcon("ChevronDown", __iconNode$7);
23581
+ const __iconNode$6 = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
23582
+ const ChevronDown = createLucideIcon("ChevronDown", __iconNode$6);
23598
23583
 
23599
23584
  /**
23600
23585
  * @license lucide-react v0.479.0 - ISC
@@ -23604,19 +23589,8 @@ const ChevronDown = createLucideIcon("ChevronDown", __iconNode$7);
23604
23589
  */
23605
23590
 
23606
23591
 
23607
- const __iconNode$6 = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]];
23608
- const ChevronLeft = createLucideIcon("ChevronLeft", __iconNode$6);
23609
-
23610
- /**
23611
- * @license lucide-react v0.479.0 - ISC
23612
- *
23613
- * This source code is licensed under the ISC license.
23614
- * See the LICENSE file in the root directory of this source tree.
23615
- */
23616
-
23617
-
23618
- const __iconNode$5 = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
23619
- const ChevronRight = createLucideIcon("ChevronRight", __iconNode$5);
23592
+ const __iconNode$5 = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]];
23593
+ const ChevronLeft = createLucideIcon("ChevronLeft", __iconNode$5);
23620
23594
 
23621
23595
  /**
23622
23596
  * @license lucide-react v0.479.0 - ISC
@@ -34383,7 +34357,7 @@ const stateOptions = [
34383
34357
  { value: "GA", label: "Georgia" },
34384
34358
  { value: "Prague", label: "Prague" },
34385
34359
  ];
34386
- function AddressInput({ className = "", proxy, clientSecret, latitude, longitude, currentAlpha2CountryCode, }) {
34360
+ function AddressInput({ className = "", proxy, clientSecret, latitude, longitude, currentAlpha2CountryCode, locale, }) {
34387
34361
  const storeClient = createStoreClient({ proxy });
34388
34362
  const form = useFormContext();
34389
34363
  const [showSuggestions, setShowSuggestions] = React.useState(false);
@@ -34393,6 +34367,7 @@ function AddressInput({ className = "", proxy, clientSecret, latitude, longitude
34393
34367
  const [isLoading, setIsLoading] = React.useState(false);
34394
34368
  const addressInput = form.watch("address.line1") || "";
34395
34369
  const cityInput = form.watch("address.city") || "";
34370
+ const line2Input = form.watch("address.line2") || "";
34396
34371
  React.useEffect(() => {
34397
34372
  if (!currentAlpha2CountryCode)
34398
34373
  return;
@@ -34419,6 +34394,7 @@ function AddressInput({ className = "", proxy, clientSecret, latitude, longitude
34419
34394
  latitude: latitude === null || latitude === void 0 ? void 0 : latitude.toString(),
34420
34395
  longitude: longitude === null || longitude === void 0 ? void 0 : longitude.toString(),
34421
34396
  countryCode,
34397
+ locale,
34422
34398
  });
34423
34399
  console.log(results);
34424
34400
  setSuggestions(results);
@@ -34442,41 +34418,40 @@ function AddressInput({ className = "", proxy, clientSecret, latitude, longitude
34442
34418
  }
34443
34419
  // eslint-disable-next-line react-hooks/exhaustive-deps
34444
34420
  }, [showAllInputs, addressInput]);
34445
- const handleSelectAddress = (address) => {
34446
- const isLookup = "line1" in address;
34447
- if (!isLookup) {
34448
- setIsLoading(true);
34449
- storeClient
34450
- .getGeocodeAddressResults(clientSecret, address)
34451
- .then((results) => {
34452
- console.log(results);
34453
- setIsLoading(false);
34454
- setShowSuggestions(false);
34455
- setSuggestions(results);
34456
- });
34457
- return;
34458
- }
34459
- const geocodeAddress = address;
34460
- form.setValue("address.line1", geocodeAddress.line1);
34461
- form.setValue("address.line2", geocodeAddress.line2);
34462
- form.setValue("address.city", geocodeAddress.city);
34463
- form.setValue("address.province", geocodeAddress.province);
34464
- form.setValue("address.provinceCode", geocodeAddress.provinceCode);
34465
- form.setValue("address.zipCode", geocodeAddress.zipCode);
34421
+ const handleSelectAddress = (result) => {
34422
+ const { address } = result;
34423
+ form.setValue("address.line1", address.line1);
34424
+ form.setValue("address.line2", address.line2);
34425
+ form.setValue("address.city", address.city);
34426
+ form.setValue("address.province", address.province);
34427
+ form.setValue("address.provinceCode", address.provinceCode);
34428
+ form.setValue("address.zipCode", address.zipCode);
34466
34429
  setShowSuggestions(false);
34467
34430
  setShowAllInputs(true);
34468
34431
  setSuggestions([]);
34469
34432
  };
34470
34433
  const handleManualEntry = () => {
34471
34434
  setShowAllInputs(true);
34435
+ form.resetField("address.line1");
34436
+ form.resetField("address.line2");
34437
+ form.resetField("address.city");
34438
+ form.resetField("address.province");
34439
+ form.resetField("address.provinceCode");
34440
+ form.resetField("address.zipCode");
34472
34441
  };
34473
34442
  React.useEffect(() => {
34474
- setShowAllInputs((cityInput === null || cityInput === void 0 ? void 0 : cityInput.length) > 0);
34443
+ if (!showAllInputs) {
34444
+ setShowAllInputs((cityInput === null || cityInput === void 0 ? void 0 : cityInput.length) > 0);
34445
+ }
34446
+ // eslint-disable-next-line react-hooks/exhaustive-deps
34475
34447
  }, [cityInput]);
34476
- return (jsxRuntime.jsxs("div", { className: cn("space-y-5", className), children: [jsxRuntime.jsx(CountryInput, { prefix: "address", label: "Country", form: form }), jsxRuntime.jsxs("div", { className: "relative", children: [jsxRuntime.jsx(InputGroup, { name: "address.line1", label: showAllInputs ? "Address" : "Start typing address", required: showAllInputs, icon: jsxRuntime.jsx(Search, { className: "h-4 w-4" }), showIcon: !showAllInputs, onFocus: () => setShowSuggestions(true), onBlur: () => setTimeout(() => setShowSuggestions(false), 100) }), !showAllInputs && (showSuggestions || isLoading) && (jsxRuntime.jsx("div", { className: "bg-background border-border absolute left-0 right-0 top-full z-50 mt-1 rounded-md border shadow-lg", "data-dropdown": "suggestions", children: isLoading ? (jsxRuntime.jsx("div", { className: "text-muted-foreground border-border border-b p-3 text-sm", children: "Searching for addresses..." })) : suggestions.length > 0 ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: "text-muted-foreground border-border border-b p-3 text-sm", children: "Keep typing address to display results" }), jsxRuntime.jsx("div", { className: "max-h-60 overflow-y-auto", children: suggestions.map((address, index) => {
34477
- const isLookup = "line1" in address;
34478
- return (jsxRuntime.jsxs("button", { type: "button", onClick: () => handleSelectAddress(address), className: "hover:bg-accent border-border flex w-full cursor-pointer items-center border-b px-3 py-3 text-left transition-colors last:border-b-0", children: [jsxRuntime.jsx("div", { className: "text-foreground text-sm", children: address.title }), !isLookup && (jsxRuntime.jsx(ChevronRight, { className: "text-muted-foreground ml-auto size-4" }))] }, index));
34479
- }) })] })) : (jsxRuntime.jsx("div", { className: "text-muted-foreground border-border border-b p-3 text-sm", children: "No addresses found" })) }))] }), jsxRuntime.jsx("div", { className: cn(!showAllInputs ? "-mt-2 mb-4 block" : "hidden"), children: jsxRuntime.jsx("button", { type: "button", onClick: handleManualEntry, className: "text-foreground hover:text-muted-foreground cursor-pointer text-[13px] underline", children: "Enter address manually" }) }), jsxRuntime.jsxs("div", { className: cn("space-y-4", !showAllInputs && "-mt-4 h-0 max-h-0 w-0 max-w-0 opacity-0"), children: [jsxRuntime.jsx("div", { className: cn(!showApartmentField ? "block" : "hidden"), children: jsxRuntime.jsxs("button", { type: "button", onClick: () => {
34448
+ React.useEffect(() => {
34449
+ if (!showApartmentField) {
34450
+ setShowApartmentField(line2Input.length > 0);
34451
+ }
34452
+ // eslint-disable-next-line react-hooks/exhaustive-deps
34453
+ }, [line2Input]);
34454
+ return (jsxRuntime.jsxs("div", { className: cn("space-y-5", className), children: [jsxRuntime.jsx(CountryInput, { prefix: "address", label: "Country", form: form }), jsxRuntime.jsxs("div", { className: "relative", children: [jsxRuntime.jsx(InputGroup, { name: "address.line1", label: showAllInputs ? "Address" : "Start typing address", required: showAllInputs, icon: jsxRuntime.jsx(Search, { className: "h-4 w-4" }), showIcon: !showAllInputs, onFocus: () => setShowSuggestions(true), onBlur: () => setTimeout(() => setShowSuggestions(false), 50) }), !showAllInputs && (showSuggestions || isLoading) && (jsxRuntime.jsx("div", { className: "bg-background border-border absolute left-0 right-0 top-full z-50 mt-1 rounded-md border shadow-lg", "data-dropdown": "suggestions", children: isLoading ? (jsxRuntime.jsx("div", { className: "text-muted-foreground border-border border-b p-3 text-sm", children: "Searching for addresses..." })) : suggestions.length > 0 ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: "text-muted-foreground border-border border-b p-3 text-sm", children: "Keep typing address to display results" }), jsxRuntime.jsx("div", { className: "max-h-60 overflow-y-auto", children: suggestions.map((address, index) => (jsxRuntime.jsx("button", { type: "button", onClick: () => handleSelectAddress(address), className: "hover:bg-accent border-border flex w-full cursor-pointer items-center border-b px-3 py-3 text-left transition-colors last:border-b-0", children: jsxRuntime.jsx("div", { className: "text-foreground text-sm", children: address.title }) }, index))) })] })) : (jsxRuntime.jsx("div", { className: "text-muted-foreground border-border border-b p-3 text-sm", children: "No addresses found" })) }))] }), jsxRuntime.jsx("div", { className: cn(!showAllInputs ? "-mt-2 mb-4 block" : "hidden"), children: jsxRuntime.jsx("button", { type: "button", onClick: handleManualEntry, className: "text-foreground hover:text-muted-foreground cursor-pointer text-[13px] underline", children: "Enter address manually" }) }), jsxRuntime.jsxs("div", { className: cn("space-y-4", !showAllInputs && "-mt-4 h-0 max-h-0 w-0 max-w-0 opacity-0"), children: [jsxRuntime.jsx("div", { className: cn(!showApartmentField ? "block" : "hidden"), children: jsxRuntime.jsxs("button", { type: "button", onClick: () => {
34480
34455
  setShowApartmentField(true);
34481
34456
  form.setFocus("address.line2");
34482
34457
  }, className: "text-muted-foreground hover:text-foreground flex cursor-pointer items-center gap-2 text-sm transition-colors", children: [jsxRuntime.jsx(Plus, { className: "h-4 w-4" }), "Add Company, C/O, Apt, Suite, Unit"] }) }), jsxRuntime.jsx("div", { className: cn(!showApartmentField && "-mt-4 h-0 max-h-0 w-0 max-w-0 opacity-0"), children: jsxRuntime.jsx(InputGroup, { name: "address.line2", label: "Company, C/O, Apt, Suite, Unit" }) }), jsxRuntime.jsxs("div", { className: "grid grid-cols-3 gap-4", children: [jsxRuntime.jsx(InputGroup, { name: "address.city", label: "City", required: true }), jsxRuntime.jsx(SelectGroup, { name: "address.province", label: "State", options: stateOptions, required: true }), jsxRuntime.jsx(InputGroup, { name: "address.zipCode", label: "Postal Code", required: true })] })] })] }));
@@ -34562,7 +34537,7 @@ const r=(t,r,o)=>{if(t&&"reportValidity"in t){const s=get(o,r);t.setCustomValidi
34562
34537
 
34563
34538
  function n(r,e){for(var n={};r.length;){var s=r[0],t=s.code,i=s.message,a=s.path.join(".");if(!n[a])if("unionErrors"in s){var u=s.unionErrors[0].errors[0];n[a]={message:u.message,type:u.code};}else n[a]={message:i,type:t};if("unionErrors"in s&&s.unionErrors.forEach(function(e){return e.errors.forEach(function(e){return r.push(e)})}),e){var c=n[a].types,f=c&&c[s.code];n[a]=appendErrors(a,e,n,t,f?[].concat(f,s.message):s.message);}r.shift();}return n}function s(o$1,s,t){return void 0===t&&(t={}),function(i,a,u){try{return Promise.resolve(function(e,n){try{var a=Promise.resolve(o$1["sync"===t.mode?"parse":"parseAsync"](i,s)).then(function(e){return u.shouldUseNativeValidation&&o({},u),{errors:{},values:t.raw?Object.assign({},i):e}});}catch(r){return n(r)}return a&&a.then?a.then(void 0,n):a}(0,function(r){if(function(r){return Array.isArray(null==r?void 0:r.errors)}(r))return {values:{},errors:s$1(n(r.errors,!u.shouldUseNativeValidation&&"all"===u.criteriaMode),u)};throw r}))}catch(r){return Promise.reject(r)}}}
34564
34539
 
34565
- function CustomerForm({ initialData, onSubmit, clientProxy, clientSecret, latitude, longitude, currentAlpha2CountryCode, }) {
34540
+ function CustomerForm({ initialData, onSubmit, clientProxy, clientSecret, latitude, longitude, currentAlpha2CountryCode, locale, }) {
34566
34541
  const { t } = useTranslation();
34567
34542
  const form = useForm({
34568
34543
  resolver: s(customerSchema),
@@ -34583,7 +34558,7 @@ function CustomerForm({ initialData, onSubmit, clientProxy, clientSecret, latitu
34583
34558
  },
34584
34559
  mode: "onBlur",
34585
34560
  });
34586
- 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, currentAlpha2CountryCode: currentAlpha2CountryCode }), 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") }) })] }) })));
34561
+ 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, currentAlpha2CountryCode: currentAlpha2CountryCode, 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") }) })] }) })));
34587
34562
  }
34588
34563
 
34589
34564
  var reactStripe_umd$1 = {exports: {}};
@@ -36406,7 +36381,7 @@ function CheckoutForm({ storeClient, checkoutId, onSuccess, onError, cancelUrl,
36406
36381
  if (step === "shipping" && formData.customer) {
36407
36382
  return (jsxRuntime.jsx(ShippingMethodForm, { setFormData: setFormData, formData: formData, shippingRates: shippingRates, initialData: formData.shipping, onSubmit: handleShippingSubmit, onBack: handleBack, contactEmail: formData.customer.email, shippingAddress: formatAddress(formData.customer.address), currency: currency, exchangeRate: exchangeRate, locale: locale, countryCode: formData.customer.address.countryCode }));
36408
36383
  }
36409
- return (jsxRuntime.jsx(CustomerForm, { initialData: formData.customer, onSubmit: handleCustomerSubmit, clientProxy: clientProxy, clientSecret: clientSecret, latitude: latitude, longitude: longitude, currentAlpha2CountryCode: currentAlpha2CountryCode }));
36384
+ return (jsxRuntime.jsx(CustomerForm, { initialData: formData.customer, onSubmit: handleCustomerSubmit, clientProxy: clientProxy, clientSecret: clientSecret, latitude: latitude, longitude: longitude, currentAlpha2CountryCode: currentAlpha2CountryCode, locale: locale }));
36410
36385
  };
36411
36386
  return jsxRuntime.jsx("div", { className: "relative h-max min-h-full w-full", children: renderStep() });
36412
36387
  }
package/dist/index.mjs CHANGED
@@ -7394,21 +7394,6 @@ var Client = class {
7394
7394
  });
7395
7395
  return data;
7396
7396
  }
7397
- /**
7398
- * Get geocode address results
7399
- */
7400
- async getGeocodeAddressResults(clientSecret, params) {
7401
- const apiClient = createApiClient(clientSecret, this.proxy);
7402
- const { position, ...rest } = params;
7403
- const { data } = await apiClient.get("/helpers/geocode-address", {
7404
- params: {
7405
- ...rest,
7406
- lat: position.lat,
7407
- lng: position.lng
7408
- }
7409
- });
7410
- return data;
7411
- }
7412
7397
  };
7413
7398
  var client_default = Client;
7414
7399
 
@@ -23562,8 +23547,8 @@ const createLucideIcon = (iconName, iconNode) => {
23562
23547
  */
23563
23548
 
23564
23549
 
23565
- const __iconNode$8 = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
23566
- const Check = createLucideIcon("Check", __iconNode$8);
23550
+ const __iconNode$7 = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
23551
+ const Check = createLucideIcon("Check", __iconNode$7);
23567
23552
 
23568
23553
  /**
23569
23554
  * @license lucide-react v0.479.0 - ISC
@@ -23573,8 +23558,8 @@ const Check = createLucideIcon("Check", __iconNode$8);
23573
23558
  */
23574
23559
 
23575
23560
 
23576
- const __iconNode$7 = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
23577
- const ChevronDown = createLucideIcon("ChevronDown", __iconNode$7);
23561
+ const __iconNode$6 = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
23562
+ const ChevronDown = createLucideIcon("ChevronDown", __iconNode$6);
23578
23563
 
23579
23564
  /**
23580
23565
  * @license lucide-react v0.479.0 - ISC
@@ -23584,19 +23569,8 @@ const ChevronDown = createLucideIcon("ChevronDown", __iconNode$7);
23584
23569
  */
23585
23570
 
23586
23571
 
23587
- const __iconNode$6 = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]];
23588
- const ChevronLeft = createLucideIcon("ChevronLeft", __iconNode$6);
23589
-
23590
- /**
23591
- * @license lucide-react v0.479.0 - ISC
23592
- *
23593
- * This source code is licensed under the ISC license.
23594
- * See the LICENSE file in the root directory of this source tree.
23595
- */
23596
-
23597
-
23598
- const __iconNode$5 = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
23599
- const ChevronRight = createLucideIcon("ChevronRight", __iconNode$5);
23572
+ const __iconNode$5 = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]];
23573
+ const ChevronLeft = createLucideIcon("ChevronLeft", __iconNode$5);
23600
23574
 
23601
23575
  /**
23602
23576
  * @license lucide-react v0.479.0 - ISC
@@ -34363,7 +34337,7 @@ const stateOptions = [
34363
34337
  { value: "GA", label: "Georgia" },
34364
34338
  { value: "Prague", label: "Prague" },
34365
34339
  ];
34366
- function AddressInput({ className = "", proxy, clientSecret, latitude, longitude, currentAlpha2CountryCode, }) {
34340
+ function AddressInput({ className = "", proxy, clientSecret, latitude, longitude, currentAlpha2CountryCode, locale, }) {
34367
34341
  const storeClient = createStoreClient({ proxy });
34368
34342
  const form = useFormContext();
34369
34343
  const [showSuggestions, setShowSuggestions] = useState(false);
@@ -34373,6 +34347,7 @@ function AddressInput({ className = "", proxy, clientSecret, latitude, longitude
34373
34347
  const [isLoading, setIsLoading] = useState(false);
34374
34348
  const addressInput = form.watch("address.line1") || "";
34375
34349
  const cityInput = form.watch("address.city") || "";
34350
+ const line2Input = form.watch("address.line2") || "";
34376
34351
  useEffect(() => {
34377
34352
  if (!currentAlpha2CountryCode)
34378
34353
  return;
@@ -34399,6 +34374,7 @@ function AddressInput({ className = "", proxy, clientSecret, latitude, longitude
34399
34374
  latitude: latitude === null || latitude === void 0 ? void 0 : latitude.toString(),
34400
34375
  longitude: longitude === null || longitude === void 0 ? void 0 : longitude.toString(),
34401
34376
  countryCode,
34377
+ locale,
34402
34378
  });
34403
34379
  console.log(results);
34404
34380
  setSuggestions(results);
@@ -34422,41 +34398,40 @@ function AddressInput({ className = "", proxy, clientSecret, latitude, longitude
34422
34398
  }
34423
34399
  // eslint-disable-next-line react-hooks/exhaustive-deps
34424
34400
  }, [showAllInputs, addressInput]);
34425
- const handleSelectAddress = (address) => {
34426
- const isLookup = "line1" in address;
34427
- if (!isLookup) {
34428
- setIsLoading(true);
34429
- storeClient
34430
- .getGeocodeAddressResults(clientSecret, address)
34431
- .then((results) => {
34432
- console.log(results);
34433
- setIsLoading(false);
34434
- setShowSuggestions(false);
34435
- setSuggestions(results);
34436
- });
34437
- return;
34438
- }
34439
- const geocodeAddress = address;
34440
- form.setValue("address.line1", geocodeAddress.line1);
34441
- form.setValue("address.line2", geocodeAddress.line2);
34442
- form.setValue("address.city", geocodeAddress.city);
34443
- form.setValue("address.province", geocodeAddress.province);
34444
- form.setValue("address.provinceCode", geocodeAddress.provinceCode);
34445
- form.setValue("address.zipCode", geocodeAddress.zipCode);
34401
+ const handleSelectAddress = (result) => {
34402
+ const { address } = result;
34403
+ form.setValue("address.line1", address.line1);
34404
+ form.setValue("address.line2", address.line2);
34405
+ form.setValue("address.city", address.city);
34406
+ form.setValue("address.province", address.province);
34407
+ form.setValue("address.provinceCode", address.provinceCode);
34408
+ form.setValue("address.zipCode", address.zipCode);
34446
34409
  setShowSuggestions(false);
34447
34410
  setShowAllInputs(true);
34448
34411
  setSuggestions([]);
34449
34412
  };
34450
34413
  const handleManualEntry = () => {
34451
34414
  setShowAllInputs(true);
34415
+ form.resetField("address.line1");
34416
+ form.resetField("address.line2");
34417
+ form.resetField("address.city");
34418
+ form.resetField("address.province");
34419
+ form.resetField("address.provinceCode");
34420
+ form.resetField("address.zipCode");
34452
34421
  };
34453
34422
  useEffect(() => {
34454
- setShowAllInputs((cityInput === null || cityInput === void 0 ? void 0 : cityInput.length) > 0);
34423
+ if (!showAllInputs) {
34424
+ setShowAllInputs((cityInput === null || cityInput === void 0 ? void 0 : cityInput.length) > 0);
34425
+ }
34426
+ // eslint-disable-next-line react-hooks/exhaustive-deps
34455
34427
  }, [cityInput]);
34456
- return (jsxs("div", { className: cn("space-y-5", className), children: [jsx(CountryInput, { prefix: "address", label: "Country", form: form }), jsxs("div", { className: "relative", children: [jsx(InputGroup, { name: "address.line1", label: showAllInputs ? "Address" : "Start typing address", required: showAllInputs, icon: jsx(Search, { className: "h-4 w-4" }), showIcon: !showAllInputs, onFocus: () => setShowSuggestions(true), onBlur: () => setTimeout(() => setShowSuggestions(false), 100) }), !showAllInputs && (showSuggestions || isLoading) && (jsx("div", { className: "bg-background border-border absolute left-0 right-0 top-full z-50 mt-1 rounded-md border shadow-lg", "data-dropdown": "suggestions", children: isLoading ? (jsx("div", { className: "text-muted-foreground border-border border-b p-3 text-sm", children: "Searching for addresses..." })) : suggestions.length > 0 ? (jsxs(Fragment, { children: [jsx("div", { className: "text-muted-foreground border-border border-b p-3 text-sm", children: "Keep typing address to display results" }), jsx("div", { className: "max-h-60 overflow-y-auto", children: suggestions.map((address, index) => {
34457
- const isLookup = "line1" in address;
34458
- return (jsxs("button", { type: "button", onClick: () => handleSelectAddress(address), className: "hover:bg-accent border-border flex w-full cursor-pointer items-center border-b px-3 py-3 text-left transition-colors last:border-b-0", children: [jsx("div", { className: "text-foreground text-sm", children: address.title }), !isLookup && (jsx(ChevronRight, { className: "text-muted-foreground ml-auto size-4" }))] }, index));
34459
- }) })] })) : (jsx("div", { className: "text-muted-foreground border-border border-b p-3 text-sm", children: "No addresses found" })) }))] }), jsx("div", { className: cn(!showAllInputs ? "-mt-2 mb-4 block" : "hidden"), children: jsx("button", { type: "button", onClick: handleManualEntry, className: "text-foreground hover:text-muted-foreground cursor-pointer text-[13px] underline", children: "Enter address manually" }) }), jsxs("div", { className: cn("space-y-4", !showAllInputs && "-mt-4 h-0 max-h-0 w-0 max-w-0 opacity-0"), children: [jsx("div", { className: cn(!showApartmentField ? "block" : "hidden"), children: jsxs("button", { type: "button", onClick: () => {
34428
+ useEffect(() => {
34429
+ if (!showApartmentField) {
34430
+ setShowApartmentField(line2Input.length > 0);
34431
+ }
34432
+ // eslint-disable-next-line react-hooks/exhaustive-deps
34433
+ }, [line2Input]);
34434
+ return (jsxs("div", { className: cn("space-y-5", className), children: [jsx(CountryInput, { prefix: "address", label: "Country", form: form }), jsxs("div", { className: "relative", children: [jsx(InputGroup, { name: "address.line1", label: showAllInputs ? "Address" : "Start typing address", required: showAllInputs, icon: jsx(Search, { className: "h-4 w-4" }), showIcon: !showAllInputs, onFocus: () => setShowSuggestions(true), onBlur: () => setTimeout(() => setShowSuggestions(false), 50) }), !showAllInputs && (showSuggestions || isLoading) && (jsx("div", { className: "bg-background border-border absolute left-0 right-0 top-full z-50 mt-1 rounded-md border shadow-lg", "data-dropdown": "suggestions", children: isLoading ? (jsx("div", { className: "text-muted-foreground border-border border-b p-3 text-sm", children: "Searching for addresses..." })) : suggestions.length > 0 ? (jsxs(Fragment, { children: [jsx("div", { className: "text-muted-foreground border-border border-b p-3 text-sm", children: "Keep typing address to display results" }), jsx("div", { className: "max-h-60 overflow-y-auto", children: suggestions.map((address, index) => (jsx("button", { type: "button", onClick: () => handleSelectAddress(address), className: "hover:bg-accent border-border flex w-full cursor-pointer items-center border-b px-3 py-3 text-left transition-colors last:border-b-0", children: jsx("div", { className: "text-foreground text-sm", children: address.title }) }, index))) })] })) : (jsx("div", { className: "text-muted-foreground border-border border-b p-3 text-sm", children: "No addresses found" })) }))] }), jsx("div", { className: cn(!showAllInputs ? "-mt-2 mb-4 block" : "hidden"), children: jsx("button", { type: "button", onClick: handleManualEntry, className: "text-foreground hover:text-muted-foreground cursor-pointer text-[13px] underline", children: "Enter address manually" }) }), jsxs("div", { className: cn("space-y-4", !showAllInputs && "-mt-4 h-0 max-h-0 w-0 max-w-0 opacity-0"), children: [jsx("div", { className: cn(!showApartmentField ? "block" : "hidden"), children: jsxs("button", { type: "button", onClick: () => {
34460
34435
  setShowApartmentField(true);
34461
34436
  form.setFocus("address.line2");
34462
34437
  }, className: "text-muted-foreground hover:text-foreground flex cursor-pointer items-center gap-2 text-sm transition-colors", children: [jsx(Plus, { className: "h-4 w-4" }), "Add Company, C/O, Apt, Suite, Unit"] }) }), jsx("div", { className: cn(!showApartmentField && "-mt-4 h-0 max-h-0 w-0 max-w-0 opacity-0"), children: jsx(InputGroup, { name: "address.line2", label: "Company, C/O, Apt, Suite, Unit" }) }), jsxs("div", { className: "grid grid-cols-3 gap-4", children: [jsx(InputGroup, { name: "address.city", label: "City", required: true }), jsx(SelectGroup, { name: "address.province", label: "State", options: stateOptions, required: true }), jsx(InputGroup, { name: "address.zipCode", label: "Postal Code", required: true })] })] })] }));
@@ -34542,7 +34517,7 @@ const r=(t,r,o)=>{if(t&&"reportValidity"in t){const s=get(o,r);t.setCustomValidi
34542
34517
 
34543
34518
  function n(r,e){for(var n={};r.length;){var s=r[0],t=s.code,i=s.message,a=s.path.join(".");if(!n[a])if("unionErrors"in s){var u=s.unionErrors[0].errors[0];n[a]={message:u.message,type:u.code};}else n[a]={message:i,type:t};if("unionErrors"in s&&s.unionErrors.forEach(function(e){return e.errors.forEach(function(e){return r.push(e)})}),e){var c=n[a].types,f=c&&c[s.code];n[a]=appendErrors(a,e,n,t,f?[].concat(f,s.message):s.message);}r.shift();}return n}function s(o$1,s,t){return void 0===t&&(t={}),function(i,a,u){try{return Promise.resolve(function(e,n){try{var a=Promise.resolve(o$1["sync"===t.mode?"parse":"parseAsync"](i,s)).then(function(e){return u.shouldUseNativeValidation&&o({},u),{errors:{},values:t.raw?Object.assign({},i):e}});}catch(r){return n(r)}return a&&a.then?a.then(void 0,n):a}(0,function(r){if(function(r){return Array.isArray(null==r?void 0:r.errors)}(r))return {values:{},errors:s$1(n(r.errors,!u.shouldUseNativeValidation&&"all"===u.criteriaMode),u)};throw r}))}catch(r){return Promise.reject(r)}}}
34544
34519
 
34545
- function CustomerForm({ initialData, onSubmit, clientProxy, clientSecret, latitude, longitude, currentAlpha2CountryCode, }) {
34520
+ function CustomerForm({ initialData, onSubmit, clientProxy, clientSecret, latitude, longitude, currentAlpha2CountryCode, locale, }) {
34546
34521
  const { t } = useTranslation();
34547
34522
  const form = useForm({
34548
34523
  resolver: s(customerSchema),
@@ -34563,7 +34538,7 @@ function CustomerForm({ initialData, onSubmit, clientProxy, clientSecret, latitu
34563
34538
  },
34564
34539
  mode: "onBlur",
34565
34540
  });
34566
- 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, currentAlpha2CountryCode: currentAlpha2CountryCode }), 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") }) })] }) })));
34541
+ 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, currentAlpha2CountryCode: currentAlpha2CountryCode, 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") }) })] }) })));
34567
34542
  }
34568
34543
 
34569
34544
  var reactStripe_umd$1 = {exports: {}};
@@ -36386,7 +36361,7 @@ function CheckoutForm({ storeClient, checkoutId, onSuccess, onError, cancelUrl,
36386
36361
  if (step === "shipping" && formData.customer) {
36387
36362
  return (jsx(ShippingMethodForm, { setFormData: setFormData, formData: formData, shippingRates: shippingRates, initialData: formData.shipping, onSubmit: handleShippingSubmit, onBack: handleBack, contactEmail: formData.customer.email, shippingAddress: formatAddress(formData.customer.address), currency: currency, exchangeRate: exchangeRate, locale: locale, countryCode: formData.customer.address.countryCode }));
36388
36363
  }
36389
- return (jsx(CustomerForm, { initialData: formData.customer, onSubmit: handleCustomerSubmit, clientProxy: clientProxy, clientSecret: clientSecret, latitude: latitude, longitude: longitude, currentAlpha2CountryCode: currentAlpha2CountryCode }));
36364
+ return (jsx(CustomerForm, { initialData: formData.customer, onSubmit: handleCustomerSubmit, clientProxy: clientProxy, clientSecret: clientSecret, latitude: latitude, longitude: longitude, currentAlpha2CountryCode: currentAlpha2CountryCode, locale: locale }));
36390
36365
  };
36391
36366
  return jsx("div", { className: "relative h-max min-h-full w-full", children: renderStep() });
36392
36367
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@betterstore/react",
3
- "version": "0.5.14",
3
+ "version": "0.5.15",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -77,7 +77,7 @@
77
77
  "tailwindcss-animate": "^1.0.7",
78
78
  "zod": "^3.25.30",
79
79
  "zustand": "^5.0.5",
80
- "@betterstore/sdk": "0.5.14"
80
+ "@betterstore/sdk": "0.5.15"
81
81
  },
82
82
  "publishConfig": {
83
83
  "access": "public"