@betterstore/react 0.3.47 → 0.3.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/index.cjs.js +34 -27
- package/dist/index.mjs +34 -27
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.cjs.js
CHANGED
|
@@ -11633,30 +11633,34 @@ function CheckoutForm({ storeClient, checkoutId, onSuccess, onError, cancelUrl,
|
|
|
11633
11633
|
validateStep();
|
|
11634
11634
|
}, [step]);
|
|
11635
11635
|
React.useEffect(() => {
|
|
11636
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19;
|
|
11636
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21;
|
|
11637
11637
|
if (checkoutId !== storedCheckoutId) {
|
|
11638
11638
|
setStep("customer");
|
|
11639
11639
|
setCheckoutId(checkoutId);
|
|
11640
11640
|
if (customer) {
|
|
11641
|
+
if ((_a = customer === null || customer === void 0 ? void 0 : customer.address) === null || _a === void 0 ? void 0 : _a.city) {
|
|
11642
|
+
setStep("shipping");
|
|
11643
|
+
}
|
|
11641
11644
|
setFormData({
|
|
11642
11645
|
customerId: customer.id,
|
|
11643
11646
|
customer: {
|
|
11644
|
-
firstName: (
|
|
11645
|
-
lastName: (
|
|
11646
|
-
phone: (
|
|
11647
|
-
email: (
|
|
11647
|
+
firstName: (_d = (_c = (_b = customer.address) === null || _b === void 0 ? void 0 : _b.name) === null || _c === void 0 ? void 0 : _c.split(" ")[0]) !== null && _d !== void 0 ? _d : "",
|
|
11648
|
+
lastName: (_g = (_f = (_e = customer.address) === null || _e === void 0 ? void 0 : _e.name) === null || _f === void 0 ? void 0 : _f.split(" ")[1]) !== null && _g !== void 0 ? _g : "",
|
|
11649
|
+
phone: (_j = (_h = customer.address) === null || _h === void 0 ? void 0 : _h.phone) !== null && _j !== void 0 ? _j : "",
|
|
11650
|
+
email: (_k = customer.email) !== null && _k !== void 0 ? _k : "",
|
|
11648
11651
|
address: {
|
|
11649
|
-
line1: (
|
|
11650
|
-
line2: (
|
|
11651
|
-
city: (
|
|
11652
|
-
zipCode: (
|
|
11653
|
-
country: (
|
|
11654
|
-
countryCode: (
|
|
11652
|
+
line1: (_m = (_l = customer.address) === null || _l === void 0 ? void 0 : _l.line1) !== null && _m !== void 0 ? _m : "",
|
|
11653
|
+
line2: (_p = (_o = customer.address) === null || _o === void 0 ? void 0 : _o.line2) !== null && _p !== void 0 ? _p : "",
|
|
11654
|
+
city: (_r = (_q = customer.address) === null || _q === void 0 ? void 0 : _q.city) !== null && _r !== void 0 ? _r : "",
|
|
11655
|
+
zipCode: (_t = (_s = customer.address) === null || _s === void 0 ? void 0 : _s.zipCode) !== null && _t !== void 0 ? _t : "",
|
|
11656
|
+
country: (_v = (_u = customer.address) === null || _u === void 0 ? void 0 : _u.country) !== null && _v !== void 0 ? _v : "",
|
|
11657
|
+
countryCode: (_x = (_w = customer.address) === null || _w === void 0 ? void 0 : _w.countryCode) !== null && _x !== void 0 ? _x : "",
|
|
11655
11658
|
},
|
|
11656
11659
|
},
|
|
11657
11660
|
});
|
|
11661
|
+
return;
|
|
11658
11662
|
}
|
|
11659
|
-
else if ((
|
|
11663
|
+
else if ((_y = formData.customer) === null || _y === void 0 ? void 0 : _y.email) {
|
|
11660
11664
|
setFormData({
|
|
11661
11665
|
customer: formData.customer,
|
|
11662
11666
|
});
|
|
@@ -11666,22 +11670,25 @@ function CheckoutForm({ storeClient, checkoutId, onSuccess, onError, cancelUrl,
|
|
|
11666
11670
|
}
|
|
11667
11671
|
return;
|
|
11668
11672
|
}
|
|
11669
|
-
if (customer && !((
|
|
11673
|
+
if (customer && !((_z = formData.customer) === null || _z === void 0 ? void 0 : _z.email)) {
|
|
11674
|
+
setStep("customer");
|
|
11675
|
+
if ((_0 = customer.address) === null || _0 === void 0 ? void 0 : _0.city) {
|
|
11676
|
+
setStep("shipping");
|
|
11677
|
+
}
|
|
11670
11678
|
setFormData(Object.assign(Object.assign({}, formData), { customerId: customer.id, customer: {
|
|
11671
|
-
firstName: (
|
|
11672
|
-
lastName: (
|
|
11673
|
-
phone: (
|
|
11674
|
-
email: (
|
|
11679
|
+
firstName: (_3 = (_2 = (_1 = customer.address) === null || _1 === void 0 ? void 0 : _1.name) === null || _2 === void 0 ? void 0 : _2.split(" ")[0]) !== null && _3 !== void 0 ? _3 : "",
|
|
11680
|
+
lastName: (_6 = (_5 = (_4 = customer.address) === null || _4 === void 0 ? void 0 : _4.name) === null || _5 === void 0 ? void 0 : _5.split(" ")[1]) !== null && _6 !== void 0 ? _6 : "",
|
|
11681
|
+
phone: (_8 = (_7 = customer.address) === null || _7 === void 0 ? void 0 : _7.phone) !== null && _8 !== void 0 ? _8 : "",
|
|
11682
|
+
email: (_9 = customer.email) !== null && _9 !== void 0 ? _9 : "",
|
|
11675
11683
|
address: {
|
|
11676
|
-
line1: (
|
|
11677
|
-
line2: (
|
|
11678
|
-
city: (
|
|
11679
|
-
zipCode: (
|
|
11680
|
-
country: (
|
|
11681
|
-
countryCode: (
|
|
11684
|
+
line1: (_11 = (_10 = customer.address) === null || _10 === void 0 ? void 0 : _10.line1) !== null && _11 !== void 0 ? _11 : "",
|
|
11685
|
+
line2: (_13 = (_12 = customer.address) === null || _12 === void 0 ? void 0 : _12.line2) !== null && _13 !== void 0 ? _13 : "",
|
|
11686
|
+
city: (_15 = (_14 = customer.address) === null || _14 === void 0 ? void 0 : _14.city) !== null && _15 !== void 0 ? _15 : "",
|
|
11687
|
+
zipCode: (_17 = (_16 = customer.address) === null || _16 === void 0 ? void 0 : _16.zipCode) !== null && _17 !== void 0 ? _17 : "",
|
|
11688
|
+
country: (_19 = (_18 = customer.address) === null || _18 === void 0 ? void 0 : _18.country) !== null && _19 !== void 0 ? _19 : "",
|
|
11689
|
+
countryCode: (_21 = (_20 = customer.address) === null || _20 === void 0 ? void 0 : _20.countryCode) !== null && _21 !== void 0 ? _21 : "",
|
|
11682
11690
|
},
|
|
11683
11691
|
} }));
|
|
11684
|
-
setStep("customer");
|
|
11685
11692
|
}
|
|
11686
11693
|
}, [customer]);
|
|
11687
11694
|
React.useEffect(() => {
|
|
@@ -11915,7 +11922,7 @@ function CheckoutSummary({ appliedDiscounts, lineItems, shipping, tax, currency,
|
|
|
11915
11922
|
"hidden md:block": !isOpen,
|
|
11916
11923
|
block: isOpen,
|
|
11917
11924
|
}) }),
|
|
11918
|
-
React.createElement("div", { className: clsx("gap-
|
|
11925
|
+
React.createElement("div", { className: clsx("gap-5 order-3 md:order-none", {
|
|
11919
11926
|
"hidden md:grid": !isOpen,
|
|
11920
11927
|
grid: isOpen,
|
|
11921
11928
|
}) }, lineItems.map((item, index) => {
|
|
@@ -11952,7 +11959,7 @@ function CheckoutSummary({ appliedDiscounts, lineItems, shipping, tax, currency,
|
|
|
11952
11959
|
"/placeholder.svg", alt: ((_c = item.productData) === null || _c === void 0 ? void 0 : _c.title) || "", className: "object-cover w-full h-full", sizes: "64px" }))),
|
|
11953
11960
|
React.createElement("div", { className: "absolute -top-2 -right-2 w-6 h-6 bg-primary rounded-full flex items-center text-background justify-center text-sm" }, item.quantity)),
|
|
11954
11961
|
React.createElement("div", { className: "ml-4 flex-1" },
|
|
11955
|
-
React.createElement("h3", { className: "text-
|
|
11962
|
+
React.createElement("h3", { className: "text-base font-medium" }, (_d = item.productData) === null || _d === void 0 ? void 0 : _d.title),
|
|
11956
11963
|
React.createElement("p", { className: "text-muted-foreground text-ellipsis line-clamp-1 md:max-w-[75%] text-sm" }, item.variantOptions
|
|
11957
11964
|
.map((option) => `${option.name}: ${option.value}`)
|
|
11958
11965
|
.join(", "))),
|
|
@@ -11990,7 +11997,7 @@ function CheckoutSummaryLoading() {
|
|
|
11990
11997
|
React.createElement("div", { className: "flex justify-between items-center" },
|
|
11991
11998
|
React.createElement("div", { className: "flex items-center gap-2 cursor-pointer" },
|
|
11992
11999
|
React.createElement("h2", null, t("CheckoutEmbed.Summary.title")),
|
|
11993
|
-
React.createElement(lucideReact.ChevronDown, { className: "size-5 transition-transform" })),
|
|
12000
|
+
React.createElement(lucideReact.ChevronDown, { className: "md:hidden size-5 transition-transform" })),
|
|
11994
12001
|
React.createElement(Skeleton, { className: "w-20 h-[20px] md:hidden" }),
|
|
11995
12002
|
React.createElement(Button, { className: "max-sm:hidden", variant: "link", size: "link", asChild: true },
|
|
11996
12003
|
React.createElement("a", null, t("CheckoutEmbed.Summary.edit")))),
|
package/dist/index.mjs
CHANGED
|
@@ -11610,30 +11610,34 @@ function CheckoutForm({ storeClient, checkoutId, onSuccess, onError, cancelUrl,
|
|
|
11610
11610
|
validateStep();
|
|
11611
11611
|
}, [step]);
|
|
11612
11612
|
useEffect(() => {
|
|
11613
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19;
|
|
11613
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21;
|
|
11614
11614
|
if (checkoutId !== storedCheckoutId) {
|
|
11615
11615
|
setStep("customer");
|
|
11616
11616
|
setCheckoutId(checkoutId);
|
|
11617
11617
|
if (customer) {
|
|
11618
|
+
if ((_a = customer === null || customer === void 0 ? void 0 : customer.address) === null || _a === void 0 ? void 0 : _a.city) {
|
|
11619
|
+
setStep("shipping");
|
|
11620
|
+
}
|
|
11618
11621
|
setFormData({
|
|
11619
11622
|
customerId: customer.id,
|
|
11620
11623
|
customer: {
|
|
11621
|
-
firstName: (
|
|
11622
|
-
lastName: (
|
|
11623
|
-
phone: (
|
|
11624
|
-
email: (
|
|
11624
|
+
firstName: (_d = (_c = (_b = customer.address) === null || _b === void 0 ? void 0 : _b.name) === null || _c === void 0 ? void 0 : _c.split(" ")[0]) !== null && _d !== void 0 ? _d : "",
|
|
11625
|
+
lastName: (_g = (_f = (_e = customer.address) === null || _e === void 0 ? void 0 : _e.name) === null || _f === void 0 ? void 0 : _f.split(" ")[1]) !== null && _g !== void 0 ? _g : "",
|
|
11626
|
+
phone: (_j = (_h = customer.address) === null || _h === void 0 ? void 0 : _h.phone) !== null && _j !== void 0 ? _j : "",
|
|
11627
|
+
email: (_k = customer.email) !== null && _k !== void 0 ? _k : "",
|
|
11625
11628
|
address: {
|
|
11626
|
-
line1: (
|
|
11627
|
-
line2: (
|
|
11628
|
-
city: (
|
|
11629
|
-
zipCode: (
|
|
11630
|
-
country: (
|
|
11631
|
-
countryCode: (
|
|
11629
|
+
line1: (_m = (_l = customer.address) === null || _l === void 0 ? void 0 : _l.line1) !== null && _m !== void 0 ? _m : "",
|
|
11630
|
+
line2: (_p = (_o = customer.address) === null || _o === void 0 ? void 0 : _o.line2) !== null && _p !== void 0 ? _p : "",
|
|
11631
|
+
city: (_r = (_q = customer.address) === null || _q === void 0 ? void 0 : _q.city) !== null && _r !== void 0 ? _r : "",
|
|
11632
|
+
zipCode: (_t = (_s = customer.address) === null || _s === void 0 ? void 0 : _s.zipCode) !== null && _t !== void 0 ? _t : "",
|
|
11633
|
+
country: (_v = (_u = customer.address) === null || _u === void 0 ? void 0 : _u.country) !== null && _v !== void 0 ? _v : "",
|
|
11634
|
+
countryCode: (_x = (_w = customer.address) === null || _w === void 0 ? void 0 : _w.countryCode) !== null && _x !== void 0 ? _x : "",
|
|
11632
11635
|
},
|
|
11633
11636
|
},
|
|
11634
11637
|
});
|
|
11638
|
+
return;
|
|
11635
11639
|
}
|
|
11636
|
-
else if ((
|
|
11640
|
+
else if ((_y = formData.customer) === null || _y === void 0 ? void 0 : _y.email) {
|
|
11637
11641
|
setFormData({
|
|
11638
11642
|
customer: formData.customer,
|
|
11639
11643
|
});
|
|
@@ -11643,22 +11647,25 @@ function CheckoutForm({ storeClient, checkoutId, onSuccess, onError, cancelUrl,
|
|
|
11643
11647
|
}
|
|
11644
11648
|
return;
|
|
11645
11649
|
}
|
|
11646
|
-
if (customer && !((
|
|
11650
|
+
if (customer && !((_z = formData.customer) === null || _z === void 0 ? void 0 : _z.email)) {
|
|
11651
|
+
setStep("customer");
|
|
11652
|
+
if ((_0 = customer.address) === null || _0 === void 0 ? void 0 : _0.city) {
|
|
11653
|
+
setStep("shipping");
|
|
11654
|
+
}
|
|
11647
11655
|
setFormData(Object.assign(Object.assign({}, formData), { customerId: customer.id, customer: {
|
|
11648
|
-
firstName: (
|
|
11649
|
-
lastName: (
|
|
11650
|
-
phone: (
|
|
11651
|
-
email: (
|
|
11656
|
+
firstName: (_3 = (_2 = (_1 = customer.address) === null || _1 === void 0 ? void 0 : _1.name) === null || _2 === void 0 ? void 0 : _2.split(" ")[0]) !== null && _3 !== void 0 ? _3 : "",
|
|
11657
|
+
lastName: (_6 = (_5 = (_4 = customer.address) === null || _4 === void 0 ? void 0 : _4.name) === null || _5 === void 0 ? void 0 : _5.split(" ")[1]) !== null && _6 !== void 0 ? _6 : "",
|
|
11658
|
+
phone: (_8 = (_7 = customer.address) === null || _7 === void 0 ? void 0 : _7.phone) !== null && _8 !== void 0 ? _8 : "",
|
|
11659
|
+
email: (_9 = customer.email) !== null && _9 !== void 0 ? _9 : "",
|
|
11652
11660
|
address: {
|
|
11653
|
-
line1: (
|
|
11654
|
-
line2: (
|
|
11655
|
-
city: (
|
|
11656
|
-
zipCode: (
|
|
11657
|
-
country: (
|
|
11658
|
-
countryCode: (
|
|
11661
|
+
line1: (_11 = (_10 = customer.address) === null || _10 === void 0 ? void 0 : _10.line1) !== null && _11 !== void 0 ? _11 : "",
|
|
11662
|
+
line2: (_13 = (_12 = customer.address) === null || _12 === void 0 ? void 0 : _12.line2) !== null && _13 !== void 0 ? _13 : "",
|
|
11663
|
+
city: (_15 = (_14 = customer.address) === null || _14 === void 0 ? void 0 : _14.city) !== null && _15 !== void 0 ? _15 : "",
|
|
11664
|
+
zipCode: (_17 = (_16 = customer.address) === null || _16 === void 0 ? void 0 : _16.zipCode) !== null && _17 !== void 0 ? _17 : "",
|
|
11665
|
+
country: (_19 = (_18 = customer.address) === null || _18 === void 0 ? void 0 : _18.country) !== null && _19 !== void 0 ? _19 : "",
|
|
11666
|
+
countryCode: (_21 = (_20 = customer.address) === null || _20 === void 0 ? void 0 : _20.countryCode) !== null && _21 !== void 0 ? _21 : "",
|
|
11659
11667
|
},
|
|
11660
11668
|
} }));
|
|
11661
|
-
setStep("customer");
|
|
11662
11669
|
}
|
|
11663
11670
|
}, [customer]);
|
|
11664
11671
|
useEffect(() => {
|
|
@@ -11892,7 +11899,7 @@ function CheckoutSummary({ appliedDiscounts, lineItems, shipping, tax, currency,
|
|
|
11892
11899
|
"hidden md:block": !isOpen,
|
|
11893
11900
|
block: isOpen,
|
|
11894
11901
|
}) }),
|
|
11895
|
-
React__default.createElement("div", { className: clsx$1("gap-
|
|
11902
|
+
React__default.createElement("div", { className: clsx$1("gap-5 order-3 md:order-none", {
|
|
11896
11903
|
"hidden md:grid": !isOpen,
|
|
11897
11904
|
grid: isOpen,
|
|
11898
11905
|
}) }, lineItems.map((item, index) => {
|
|
@@ -11929,7 +11936,7 @@ function CheckoutSummary({ appliedDiscounts, lineItems, shipping, tax, currency,
|
|
|
11929
11936
|
"/placeholder.svg", alt: ((_c = item.productData) === null || _c === void 0 ? void 0 : _c.title) || "", className: "object-cover w-full h-full", sizes: "64px" }))),
|
|
11930
11937
|
React__default.createElement("div", { className: "absolute -top-2 -right-2 w-6 h-6 bg-primary rounded-full flex items-center text-background justify-center text-sm" }, item.quantity)),
|
|
11931
11938
|
React__default.createElement("div", { className: "ml-4 flex-1" },
|
|
11932
|
-
React__default.createElement("h3", { className: "text-
|
|
11939
|
+
React__default.createElement("h3", { className: "text-base font-medium" }, (_d = item.productData) === null || _d === void 0 ? void 0 : _d.title),
|
|
11933
11940
|
React__default.createElement("p", { className: "text-muted-foreground text-ellipsis line-clamp-1 md:max-w-[75%] text-sm" }, item.variantOptions
|
|
11934
11941
|
.map((option) => `${option.name}: ${option.value}`)
|
|
11935
11942
|
.join(", "))),
|
|
@@ -11967,7 +11974,7 @@ function CheckoutSummaryLoading() {
|
|
|
11967
11974
|
React__default.createElement("div", { className: "flex justify-between items-center" },
|
|
11968
11975
|
React__default.createElement("div", { className: "flex items-center gap-2 cursor-pointer" },
|
|
11969
11976
|
React__default.createElement("h2", null, t("CheckoutEmbed.Summary.title")),
|
|
11970
|
-
React__default.createElement(ChevronDown, { className: "size-5 transition-transform" })),
|
|
11977
|
+
React__default.createElement(ChevronDown, { className: "md:hidden size-5 transition-transform" })),
|
|
11971
11978
|
React__default.createElement(Skeleton, { className: "w-20 h-[20px] md:hidden" }),
|
|
11972
11979
|
React__default.createElement(Button, { className: "max-sm:hidden", variant: "link", size: "link", asChild: true },
|
|
11973
11980
|
React__default.createElement("a", null, t("CheckoutEmbed.Summary.edit")))),
|