@anker-in/shopify-react 0.1.1-beta.15 → 0.1.1-beta.16
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 +1881 -9
- package/dist/hooks/index.d.ts +1881 -9
- package/dist/hooks/index.js +27 -14
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +27 -14
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +27 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -14
- package/dist/index.mjs.map +1 -1
- package/dist/provider/index.js +20 -13
- package/dist/provider/index.js.map +1 -1
- package/dist/provider/index.mjs +20 -13
- package/dist/provider/index.mjs.map +1 -1
- package/package.json +2 -2
- package/dist/index-Bfg4hT-O.d.ts +0 -1974
- package/dist/index-DGaexgLe.d.mts +0 -1974
package/dist/hooks/index.mjs
CHANGED
|
@@ -1342,10 +1342,6 @@ var useCartAttributes = ({
|
|
|
1342
1342
|
{
|
|
1343
1343
|
key: "_is_login",
|
|
1344
1344
|
value: profile?.token ? "true" : "false"
|
|
1345
|
-
},
|
|
1346
|
-
{
|
|
1347
|
-
key: "_last_url",
|
|
1348
|
-
value: typeof window !== "undefined" ? window.location.origin + window.location.pathname : ""
|
|
1349
1345
|
}
|
|
1350
1346
|
];
|
|
1351
1347
|
if (profile?.token) {
|
|
@@ -1401,18 +1397,29 @@ var useCartAttributes = ({
|
|
|
1401
1397
|
}
|
|
1402
1398
|
];
|
|
1403
1399
|
}, [currentUrl]);
|
|
1400
|
+
const commonAttributes = useMemo(
|
|
1401
|
+
() => [
|
|
1402
|
+
...memberAttributes,
|
|
1403
|
+
...functionAttributes,
|
|
1404
|
+
...presellAttributes,
|
|
1405
|
+
...weightAttributes,
|
|
1406
|
+
...trackingAttributes,
|
|
1407
|
+
...getReferralAttributes()
|
|
1408
|
+
].filter((item) => item?.value),
|
|
1409
|
+
[memberAttributes, functionAttributes, presellAttributes, weightAttributes, trackingAttributes]
|
|
1410
|
+
);
|
|
1411
|
+
const extraAttributesInCart = useMemo(() => {
|
|
1412
|
+
return cart?.customAttributes?.filter(
|
|
1413
|
+
(item) => !commonAttributes.some((attr) => attr.key === item.key)
|
|
1414
|
+
) || [];
|
|
1415
|
+
}, [cart]);
|
|
1404
1416
|
return useMemo(
|
|
1405
1417
|
() => ({
|
|
1406
|
-
attributes: [
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
...presellAttributes,
|
|
1410
|
-
...weightAttributes,
|
|
1411
|
-
...trackingAttributes,
|
|
1412
|
-
...getReferralAttributes()
|
|
1413
|
-
].filter((item) => item?.value)
|
|
1418
|
+
attributes: [...commonAttributes, ...extraAttributesInCart].filter(
|
|
1419
|
+
(item) => item?.value
|
|
1420
|
+
)
|
|
1414
1421
|
}),
|
|
1415
|
-
[
|
|
1422
|
+
[commonAttributes, extraAttributesInCart]
|
|
1416
1423
|
);
|
|
1417
1424
|
};
|
|
1418
1425
|
var DEFAULT_MIN = 1;
|
|
@@ -2618,7 +2625,13 @@ var usePlusMemberItemCustomAttributes = ({
|
|
|
2618
2625
|
}) => {
|
|
2619
2626
|
const { deliveryCustomData } = deliveryData || {};
|
|
2620
2627
|
return useMemo(() => {
|
|
2621
|
-
const itemCustomAttributes = [
|
|
2628
|
+
const itemCustomAttributes = [
|
|
2629
|
+
// _last_url: 付费会员结算完成之后 checkout 有一个继续购买的按钮, 用于跳转到继续购买的页面
|
|
2630
|
+
{
|
|
2631
|
+
key: "_last_url",
|
|
2632
|
+
value: typeof window !== "undefined" ? window.location.origin + window.location.pathname : ""
|
|
2633
|
+
}
|
|
2634
|
+
];
|
|
2622
2635
|
if (deliveryCustomData?.is_presale) {
|
|
2623
2636
|
itemCustomAttributes.push({
|
|
2624
2637
|
key: "_is_presale",
|