@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/hooks/index.mjs
CHANGED
|
@@ -1559,7 +1559,17 @@ function getCartBasicAttributes({
|
|
|
1559
1559
|
const presellAttributes = [
|
|
1560
1560
|
{
|
|
1561
1561
|
key: "_presale",
|
|
1562
|
-
value: cart?.lineItems?.some(
|
|
1562
|
+
value: cart?.lineItems?.some(
|
|
1563
|
+
(item) => item?.variant?.metafields?.global?.presell === "presell"
|
|
1564
|
+
) ? "true" : "false"
|
|
1565
|
+
}
|
|
1566
|
+
];
|
|
1567
|
+
const hideShippingAttributes = [
|
|
1568
|
+
{
|
|
1569
|
+
key: "_hide_shipping",
|
|
1570
|
+
value: cart?.lineItems?.some(
|
|
1571
|
+
(item) => item?.variant?.metafields?.global?.hideShipping === "true"
|
|
1572
|
+
) ? "true" : "false"
|
|
1563
1573
|
}
|
|
1564
1574
|
];
|
|
1565
1575
|
const weightAttributes = [
|
|
@@ -1598,6 +1608,7 @@ function getCartBasicAttributes({
|
|
|
1598
1608
|
...functionAttributes,
|
|
1599
1609
|
...presellAttributes,
|
|
1600
1610
|
...weightAttributes,
|
|
1611
|
+
...hideShippingAttributes,
|
|
1601
1612
|
...trackingAttributes,
|
|
1602
1613
|
...getReferralAttributes()
|
|
1603
1614
|
].filter((item) => item?.value !== void 0 && item?.value !== null);
|
|
@@ -2594,7 +2605,13 @@ function useBuyNow({ withTrack = true } = {}, swrOptions) {
|
|
|
2594
2605
|
cookieAdapter: cartCookieAdapter,
|
|
2595
2606
|
buyerIdentity,
|
|
2596
2607
|
discountCodes,
|
|
2597
|
-
customAttributes: [
|
|
2608
|
+
customAttributes: [
|
|
2609
|
+
...basicCartAttributes.filter(
|
|
2610
|
+
(a) => !(customAttributes || []).some((c) => c.key === a.key)
|
|
2611
|
+
),
|
|
2612
|
+
...ga4Attributes.filter((a) => !(customAttributes || []).some((c) => c.key === a.key)),
|
|
2613
|
+
...customAttributes || []
|
|
2614
|
+
]
|
|
2598
2615
|
});
|
|
2599
2616
|
if (!resultCart) {
|
|
2600
2617
|
throw new Error("Failed to create cart for buy now");
|
|
@@ -2602,7 +2619,9 @@ function useBuyNow({ withTrack = true } = {}, swrOptions) {
|
|
|
2602
2619
|
if (withTrack && resultCart.lineItems) {
|
|
2603
2620
|
trackBuyNowGA({
|
|
2604
2621
|
lineItems: lineItems.map((item) => {
|
|
2605
|
-
const cartLine = resultCart.lineItems.find(
|
|
2622
|
+
const cartLine = resultCart.lineItems.find(
|
|
2623
|
+
(line) => line.variant.id === item.variant?.id
|
|
2624
|
+
);
|
|
2606
2625
|
if (!cartLine) {
|
|
2607
2626
|
return null;
|
|
2608
2627
|
}
|