@anker-in/shopify-react 0.1.1-beta.14 → 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 +28 -15
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +28 -15
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +28 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -15
- package/dist/index.mjs.map +1 -1
- package/dist/provider/index.d.mts +1 -1
- package/dist/provider/index.d.ts +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/dist/{types-DpxtE_nv.d.mts → types-DX-2ABDs.d.mts} +4 -1
- package/dist/{types-DpxtE_nv.d.ts → types-DX-2ABDs.d.ts} +4 -1
- package/package.json +2 -2
- package/dist/index-Bp9gEGUb.d.mts +0 -1974
- package/dist/index-D9zCMHzm.d.ts +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;
|
|
@@ -2590,7 +2597,7 @@ var useUpdatePlusMemberDeliveryOptions = ({
|
|
|
2590
2597
|
const { deliveryData } = arg;
|
|
2591
2598
|
const firstDeliveryGroup = currentCart?.deliveryGroups?.[0];
|
|
2592
2599
|
const deliveryGroupId = firstDeliveryGroup?.id;
|
|
2593
|
-
const selectedOptionCode = deliveryData?.deliveryCustomData?.selected_delivery_option;
|
|
2600
|
+
const selectedOptionCode = deliveryData?.deliveryCustomData?.selected_delivery_option?.code;
|
|
2594
2601
|
if (!deliveryGroupId || !selectedOptionCode || selectedOptionCode === firstDeliveryGroup?.selectedDeliveryOption?.code) {
|
|
2595
2602
|
return null;
|
|
2596
2603
|
}
|
|
@@ -2627,7 +2634,13 @@ var usePlusMemberItemCustomAttributes = ({
|
|
|
2627
2634
|
}) => {
|
|
2628
2635
|
const { deliveryCustomData } = deliveryData || {};
|
|
2629
2636
|
return react.useMemo(() => {
|
|
2630
|
-
const itemCustomAttributes = [
|
|
2637
|
+
const itemCustomAttributes = [
|
|
2638
|
+
// _last_url: 付费会员结算完成之后 checkout 有一个继续购买的按钮, 用于跳转到继续购买的页面
|
|
2639
|
+
{
|
|
2640
|
+
key: "_last_url",
|
|
2641
|
+
value: typeof window !== "undefined" ? window.location.origin + window.location.pathname : ""
|
|
2642
|
+
}
|
|
2643
|
+
];
|
|
2631
2644
|
if (deliveryCustomData?.is_presale) {
|
|
2632
2645
|
itemCustomAttributes.push({
|
|
2633
2646
|
key: "_is_presale",
|