@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.
- package/dist/hooks/index.d.mts +2 -2
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.js +6 -3
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +6 -3
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -3
- package/dist/index.mjs.map +1 -1
- package/dist/provider/index.js +6 -3
- package/dist/provider/index.js.map +1 -1
- package/dist/provider/index.mjs +6 -3
- package/dist/provider/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/hooks/index.d.mts
CHANGED
|
@@ -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:
|
|
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:
|
|
779
|
+
value: string;
|
|
780
780
|
}>;
|
|
781
781
|
};
|
|
782
782
|
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -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:
|
|
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:
|
|
779
|
+
value: string;
|
|
780
780
|
}>;
|
|
781
781
|
};
|
|
782
782
|
|
package/dist/hooks/index.js
CHANGED
|
@@ -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,
|