@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.
@@ -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
- ...memberAttributes,
1408
- ...functionAttributes,
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
- [memberAttributes, functionAttributes, presellAttributes, weightAttributes, trackingAttributes]
1422
+ [commonAttributes, extraAttributesInCart]
1416
1423
  );
1417
1424
  };
1418
1425
  var DEFAULT_MIN = 1;
@@ -2581,7 +2588,7 @@ var useUpdatePlusMemberDeliveryOptions = ({
2581
2588
  const { deliveryData } = arg;
2582
2589
  const firstDeliveryGroup = currentCart?.deliveryGroups?.[0];
2583
2590
  const deliveryGroupId = firstDeliveryGroup?.id;
2584
- const selectedOptionCode = deliveryData?.deliveryCustomData?.selected_delivery_option;
2591
+ const selectedOptionCode = deliveryData?.deliveryCustomData?.selected_delivery_option?.code;
2585
2592
  if (!deliveryGroupId || !selectedOptionCode || selectedOptionCode === firstDeliveryGroup?.selectedDeliveryOption?.code) {
2586
2593
  return null;
2587
2594
  }
@@ -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",