@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.
@@ -906,11 +906,14 @@ function getCartBasicAttributes({
906
906
  ...weightAttributes,
907
907
  ...trackingAttributes,
908
908
  ...getReferralAttributes()
909
- ].filter((item) => item?.value);
909
+ ].filter((item) => item?.value !== void 0 && item?.value !== null);
910
910
  const extraAttributesInCart = cart?.customAttributes?.filter(
911
911
  (item) => !commonAttributes.some((attr) => attr.key === item.key)
912
912
  ) || [];
913
- return [...commonAttributes, ...extraAttributesInCart].filter((item) => item?.value !== void 0 && item?.value !== null);
913
+ return [...commonAttributes, ...extraAttributesInCart].filter((item) => item?.value !== void 0 && item?.value !== null).map((item) => ({
914
+ key: item.key,
915
+ value: typeof item.value === "string" ? item.value : String(item.value)
916
+ }));
914
917
  }
915
918
  var useCartAttributes = ({
916
919
  profile,
@@ -1240,8 +1243,11 @@ function CartProvider({
1240
1243
  newAttributes,
1241
1244
  customAttributesNeedRemove
1242
1245
  );
1246
+ const finalAttributes = newAttributes.filter(
1247
+ (attribute) => !customAttributesNeedRemove.find((a) => a.key === attribute.key)
1248
+ );
1243
1249
  if (needUpdate) {
1244
- return updateAttributes({ attributes: newAttributes });
1250
+ return updateAttributes({ attributes: finalAttributes });
1245
1251
  } else {
1246
1252
  return Promise.resolve(cart);
1247
1253
  }