@anker-in/shopify-react 1.2.8 → 1.2.9-beta.2
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/dist/hooks/index.js +22 -3
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +22 -3
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.js +22 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -3
- package/dist/index.mjs.map +1 -1
- package/dist/provider/index.js +12 -1
- package/dist/provider/index.js.map +1 -1
- package/dist/provider/index.mjs +12 -1
- package/dist/provider/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1737,7 +1737,17 @@ function getCartBasicAttributes({
|
|
|
1737
1737
|
const presellAttributes = [
|
|
1738
1738
|
{
|
|
1739
1739
|
key: "_presale",
|
|
1740
|
-
value: cart?.lineItems?.some(
|
|
1740
|
+
value: cart?.lineItems?.some(
|
|
1741
|
+
(item) => item?.variant?.metafields?.global?.presell === "presell"
|
|
1742
|
+
) ? "true" : "false"
|
|
1743
|
+
}
|
|
1744
|
+
];
|
|
1745
|
+
const hideShippingAttributes = [
|
|
1746
|
+
{
|
|
1747
|
+
key: "_hide_shipping",
|
|
1748
|
+
value: cart?.lineItems?.some(
|
|
1749
|
+
(item) => item?.variant?.metafields?.global?.hideShipping === "true"
|
|
1750
|
+
) ? "true" : "false"
|
|
1741
1751
|
}
|
|
1742
1752
|
];
|
|
1743
1753
|
const weightAttributes = [
|
|
@@ -1776,6 +1786,7 @@ function getCartBasicAttributes({
|
|
|
1776
1786
|
...functionAttributes,
|
|
1777
1787
|
...presellAttributes,
|
|
1778
1788
|
...weightAttributes,
|
|
1789
|
+
...hideShippingAttributes,
|
|
1779
1790
|
...trackingAttributes,
|
|
1780
1791
|
...getReferralAttributes()
|
|
1781
1792
|
].filter((item) => item?.value !== void 0 && item?.value !== null);
|
|
@@ -2772,7 +2783,13 @@ function useBuyNow({ withTrack = true } = {}, swrOptions) {
|
|
|
2772
2783
|
cookieAdapter: cartCookieAdapter,
|
|
2773
2784
|
buyerIdentity,
|
|
2774
2785
|
discountCodes,
|
|
2775
|
-
customAttributes: [
|
|
2786
|
+
customAttributes: [
|
|
2787
|
+
...basicCartAttributes.filter(
|
|
2788
|
+
(a) => !(customAttributes || []).some((c) => c.key === a.key)
|
|
2789
|
+
),
|
|
2790
|
+
...ga4Attributes.filter((a) => !(customAttributes || []).some((c) => c.key === a.key)),
|
|
2791
|
+
...customAttributes || []
|
|
2792
|
+
]
|
|
2776
2793
|
});
|
|
2777
2794
|
if (!resultCart) {
|
|
2778
2795
|
throw new Error("Failed to create cart for buy now");
|
|
@@ -2780,7 +2797,9 @@ function useBuyNow({ withTrack = true } = {}, swrOptions) {
|
|
|
2780
2797
|
if (withTrack && resultCart.lineItems) {
|
|
2781
2798
|
trackBuyNowGA({
|
|
2782
2799
|
lineItems: lineItems.map((item) => {
|
|
2783
|
-
const cartLine = resultCart.lineItems.find(
|
|
2800
|
+
const cartLine = resultCart.lineItems.find(
|
|
2801
|
+
(line) => line.variant.id === item.variant?.id
|
|
2802
|
+
);
|
|
2784
2803
|
if (!cartLine) {
|
|
2785
2804
|
return null;
|
|
2786
2805
|
}
|