@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/index.js CHANGED
@@ -1735,11 +1735,14 @@ function getCartBasicAttributes({
1735
1735
  ...weightAttributes,
1736
1736
  ...trackingAttributes,
1737
1737
  ...getReferralAttributes()
1738
- ].filter((item) => item?.value);
1738
+ ].filter((item) => item?.value !== void 0 && item?.value !== null);
1739
1739
  const extraAttributesInCart = cart?.customAttributes?.filter(
1740
1740
  (item) => !commonAttributes.some((attr) => attr.key === item.key)
1741
1741
  ) || [];
1742
- return [...commonAttributes, ...extraAttributesInCart].filter((item) => item?.value !== void 0 && item?.value !== null);
1742
+ return [...commonAttributes, ...extraAttributesInCart].filter((item) => item?.value !== void 0 && item?.value !== null).map((item) => ({
1743
+ key: item.key,
1744
+ value: typeof item.value === "string" ? item.value : String(item.value)
1745
+ }));
1743
1746
  }
1744
1747
  var useCartAttributes = ({
1745
1748
  profile,
@@ -3605,8 +3608,11 @@ function CartProvider({
3605
3608
  newAttributes,
3606
3609
  customAttributesNeedRemove
3607
3610
  );
3611
+ const finalAttributes = newAttributes.filter(
3612
+ (attribute) => !customAttributesNeedRemove.find((a) => a.key === attribute.key)
3613
+ );
3608
3614
  if (needUpdate) {
3609
- return updateAttributes({ attributes: newAttributes });
3615
+ return updateAttributes({ attributes: finalAttributes });
3610
3616
  } else {
3611
3617
  return Promise.resolve(cart);
3612
3618
  }