@anker-in/shopify-react 1.2.0 → 1.2.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.
@@ -758,7 +758,7 @@ interface GetCartAttributesProps {
758
758
  */
759
759
  declare function getCartBasicAttributes({ profile, customer, cart, memberType, currentUrl, appContext, buyPath, }: GetCartAttributesProps): Array<{
760
760
  key: string;
761
- value: any;
761
+ value: string;
762
762
  }>;
763
763
  /**
764
764
  * Hook to get cart attributes
@@ -776,7 +776,7 @@ declare const useCartAttributes: ({ profile, customer, cart, memberType, appCont
776
776
  }) => {
777
777
  attributes: Array<{
778
778
  key: string;
779
- value: any;
779
+ value: string;
780
780
  }>;
781
781
  };
782
782
 
@@ -758,7 +758,7 @@ interface GetCartAttributesProps {
758
758
  */
759
759
  declare function getCartBasicAttributes({ profile, customer, cart, memberType, currentUrl, appContext, buyPath, }: GetCartAttributesProps): Array<{
760
760
  key: string;
761
- value: any;
761
+ value: string;
762
762
  }>;
763
763
  /**
764
764
  * Hook to get cart attributes
@@ -776,7 +776,7 @@ declare const useCartAttributes: ({ profile, customer, cart, memberType, appCont
776
776
  }) => {
777
777
  attributes: Array<{
778
778
  key: string;
779
- value: any;
779
+ value: string;
780
780
  }>;
781
781
  };
782
782
 
@@ -1525,7 +1525,7 @@ function getCartBasicAttributes({
1525
1525
  const presellAttributes = [
1526
1526
  {
1527
1527
  key: "_presale",
1528
- value: cart?.lineItems?.some((item) => item?.variant?.metafields?.presell === "presell")
1528
+ value: cart?.lineItems?.some((item) => item?.variant?.metafields?.presell === "presell") ? "true" : "false"
1529
1529
  }
1530
1530
  ];
1531
1531
  const weightAttributes = [
@@ -1566,11 +1566,14 @@ function getCartBasicAttributes({
1566
1566
  ...weightAttributes,
1567
1567
  ...trackingAttributes,
1568
1568
  ...getReferralAttributes()
1569
- ].filter((item) => item?.value);
1569
+ ].filter((item) => item?.value !== void 0 && item?.value !== null);
1570
1570
  const extraAttributesInCart = cart?.customAttributes?.filter(
1571
1571
  (item) => !commonAttributes.some((attr) => attr.key === item.key)
1572
1572
  ) || [];
1573
- return [...commonAttributes, ...extraAttributesInCart].filter((item) => item?.value);
1573
+ return [...commonAttributes, ...extraAttributesInCart].filter((item) => item?.value !== void 0 && item?.value !== null).map((item) => ({
1574
+ key: item.key,
1575
+ value: typeof item.value === "string" ? item.value : String(item.value)
1576
+ }));
1574
1577
  }
1575
1578
  var useCartAttributes = ({
1576
1579
  profile,