@anker-in/shopify-react 1.2.1-beta.0 → 1.2.2-beta.1
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.d.mts +2 -2
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.js +5 -2
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +5 -2
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -3
- package/dist/index.mjs.map +1 -1
- package/dist/provider/index.js +9 -3
- package/dist/provider/index.js.map +1 -1
- package/dist/provider/index.mjs +9 -3
- package/dist/provider/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -1727,11 +1727,14 @@ function getCartBasicAttributes({
|
|
|
1727
1727
|
...weightAttributes,
|
|
1728
1728
|
...trackingAttributes,
|
|
1729
1729
|
...getReferralAttributes()
|
|
1730
|
-
].filter((item) => item?.value);
|
|
1730
|
+
].filter((item) => item?.value !== void 0 && item?.value !== null);
|
|
1731
1731
|
const extraAttributesInCart = cart?.customAttributes?.filter(
|
|
1732
1732
|
(item) => !commonAttributes.some((attr) => attr.key === item.key)
|
|
1733
1733
|
) || [];
|
|
1734
|
-
return [...commonAttributes, ...extraAttributesInCart].filter((item) => item?.value !== void 0 && item?.value !== null)
|
|
1734
|
+
return [...commonAttributes, ...extraAttributesInCart].filter((item) => item?.value !== void 0 && item?.value !== null).map((item) => ({
|
|
1735
|
+
key: item.key,
|
|
1736
|
+
value: typeof item.value === "string" ? item.value : String(item.value)
|
|
1737
|
+
}));
|
|
1735
1738
|
}
|
|
1736
1739
|
var useCartAttributes = ({
|
|
1737
1740
|
profile,
|
|
@@ -3597,8 +3600,11 @@ function CartProvider({
|
|
|
3597
3600
|
newAttributes,
|
|
3598
3601
|
customAttributesNeedRemove
|
|
3599
3602
|
);
|
|
3603
|
+
const finalAttributes = newAttributes.filter(
|
|
3604
|
+
(attribute) => !customAttributesNeedRemove.find((a) => a.key === attribute.key)
|
|
3605
|
+
);
|
|
3600
3606
|
if (needUpdate) {
|
|
3601
|
-
return updateAttributes({ attributes:
|
|
3607
|
+
return updateAttributes({ attributes: finalAttributes });
|
|
3602
3608
|
} else {
|
|
3603
3609
|
return Promise.resolve(cart);
|
|
3604
3610
|
}
|