@anker-in/shopify-react 0.1.1-beta.15 → 0.1.1-beta.17
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 +5 -5
- package/dist/index-Bfg4hT-O.d.ts +0 -1974
- package/dist/index-DGaexgLe.d.mts +0 -1974
package/dist/hooks/index.js
CHANGED
|
@@ -1351,10 +1351,6 @@ var useCartAttributes = ({
|
|
|
1351
1351
|
{
|
|
1352
1352
|
key: "_is_login",
|
|
1353
1353
|
value: profile?.token ? "true" : "false"
|
|
1354
|
-
},
|
|
1355
|
-
{
|
|
1356
|
-
key: "_last_url",
|
|
1357
|
-
value: typeof window !== "undefined" ? window.location.origin + window.location.pathname : ""
|
|
1358
1354
|
}
|
|
1359
1355
|
];
|
|
1360
1356
|
if (profile?.token) {
|
|
@@ -1410,18 +1406,29 @@ var useCartAttributes = ({
|
|
|
1410
1406
|
}
|
|
1411
1407
|
];
|
|
1412
1408
|
}, [currentUrl]);
|
|
1409
|
+
const commonAttributes = react.useMemo(
|
|
1410
|
+
() => [
|
|
1411
|
+
...memberAttributes,
|
|
1412
|
+
...functionAttributes,
|
|
1413
|
+
...presellAttributes,
|
|
1414
|
+
...weightAttributes,
|
|
1415
|
+
...trackingAttributes,
|
|
1416
|
+
...getReferralAttributes()
|
|
1417
|
+
].filter((item) => item?.value),
|
|
1418
|
+
[memberAttributes, functionAttributes, presellAttributes, weightAttributes, trackingAttributes]
|
|
1419
|
+
);
|
|
1420
|
+
const extraAttributesInCart = react.useMemo(() => {
|
|
1421
|
+
return cart?.customAttributes?.filter(
|
|
1422
|
+
(item) => !commonAttributes.some((attr) => attr.key === item.key)
|
|
1423
|
+
) || [];
|
|
1424
|
+
}, [cart]);
|
|
1413
1425
|
return react.useMemo(
|
|
1414
1426
|
() => ({
|
|
1415
|
-
attributes: [
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
...presellAttributes,
|
|
1419
|
-
...weightAttributes,
|
|
1420
|
-
...trackingAttributes,
|
|
1421
|
-
...getReferralAttributes()
|
|
1422
|
-
].filter((item) => item?.value)
|
|
1427
|
+
attributes: [...commonAttributes, ...extraAttributesInCart].filter(
|
|
1428
|
+
(item) => item?.value
|
|
1429
|
+
)
|
|
1423
1430
|
}),
|
|
1424
|
-
[
|
|
1431
|
+
[commonAttributes, extraAttributesInCart]
|
|
1425
1432
|
);
|
|
1426
1433
|
};
|
|
1427
1434
|
var DEFAULT_MIN = 1;
|
|
@@ -2646,7 +2653,13 @@ var usePlusMemberCheckoutCustomAttributes = ({
|
|
|
2646
2653
|
const { deliveryCustomData } = deliveryData || {};
|
|
2647
2654
|
const { profile } = usePlusMemberContext();
|
|
2648
2655
|
return react.useMemo(() => {
|
|
2649
|
-
const checkoutCustomAttributes = [
|
|
2656
|
+
const checkoutCustomAttributes = [
|
|
2657
|
+
// _last_url: 付费会员结算完成之后 checkout 有一个继续购买的按钮, 用于跳转到继续购买的页面
|
|
2658
|
+
{
|
|
2659
|
+
key: "_last_url",
|
|
2660
|
+
value: typeof window !== "undefined" ? window.location.origin + window.location.pathname : ""
|
|
2661
|
+
}
|
|
2662
|
+
];
|
|
2650
2663
|
if (deliveryCustomData) {
|
|
2651
2664
|
checkoutCustomAttributes.push({
|
|
2652
2665
|
key: "_checkout_delivery_custom",
|