@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/index.mjs CHANGED
@@ -1439,10 +1439,6 @@ var useCartAttributes = ({
1439
1439
  {
1440
1440
  key: "_is_login",
1441
1441
  value: profile?.token ? "true" : "false"
1442
- },
1443
- {
1444
- key: "_last_url",
1445
- value: typeof window !== "undefined" ? window.location.origin + window.location.pathname : ""
1446
1442
  }
1447
1443
  ];
1448
1444
  if (profile?.token) {
@@ -1498,18 +1494,29 @@ var useCartAttributes = ({
1498
1494
  }
1499
1495
  ];
1500
1496
  }, [currentUrl]);
1497
+ const commonAttributes = useMemo(
1498
+ () => [
1499
+ ...memberAttributes,
1500
+ ...functionAttributes,
1501
+ ...presellAttributes,
1502
+ ...weightAttributes,
1503
+ ...trackingAttributes,
1504
+ ...getReferralAttributes()
1505
+ ].filter((item) => item?.value),
1506
+ [memberAttributes, functionAttributes, presellAttributes, weightAttributes, trackingAttributes]
1507
+ );
1508
+ const extraAttributesInCart = useMemo(() => {
1509
+ return cart?.customAttributes?.filter(
1510
+ (item) => !commonAttributes.some((attr) => attr.key === item.key)
1511
+ ) || [];
1512
+ }, [cart]);
1501
1513
  return useMemo(
1502
1514
  () => ({
1503
- attributes: [
1504
- ...memberAttributes,
1505
- ...functionAttributes,
1506
- ...presellAttributes,
1507
- ...weightAttributes,
1508
- ...trackingAttributes,
1509
- ...getReferralAttributes()
1510
- ].filter((item) => item?.value)
1515
+ attributes: [...commonAttributes, ...extraAttributesInCart].filter(
1516
+ (item) => item?.value
1517
+ )
1511
1518
  }),
1512
- [memberAttributes, functionAttributes, presellAttributes, weightAttributes, trackingAttributes]
1519
+ [commonAttributes, extraAttributesInCart]
1513
1520
  );
1514
1521
  };
1515
1522
  var DEFAULT_MIN = 1;
@@ -2678,7 +2685,7 @@ var useUpdatePlusMemberDeliveryOptions = ({
2678
2685
  const { deliveryData } = arg;
2679
2686
  const firstDeliveryGroup = currentCart?.deliveryGroups?.[0];
2680
2687
  const deliveryGroupId = firstDeliveryGroup?.id;
2681
- const selectedOptionCode = deliveryData?.deliveryCustomData?.selected_delivery_option;
2688
+ const selectedOptionCode = deliveryData?.deliveryCustomData?.selected_delivery_option?.code;
2682
2689
  if (!deliveryGroupId || !selectedOptionCode || selectedOptionCode === firstDeliveryGroup?.selectedDeliveryOption?.code) {
2683
2690
  return null;
2684
2691
  }
@@ -2715,7 +2722,13 @@ var usePlusMemberItemCustomAttributes = ({
2715
2722
  }) => {
2716
2723
  const { deliveryCustomData } = deliveryData || {};
2717
2724
  return useMemo(() => {
2718
- const itemCustomAttributes = [];
2725
+ const itemCustomAttributes = [
2726
+ // _last_url: 付费会员结算完成之后 checkout 有一个继续购买的按钮, 用于跳转到继续购买的页面
2727
+ {
2728
+ key: "_last_url",
2729
+ value: typeof window !== "undefined" ? window.location.origin + window.location.pathname : ""
2730
+ }
2731
+ ];
2719
2732
  if (deliveryCustomData?.is_presale) {
2720
2733
  itemCustomAttributes.push({
2721
2734
  key: "_is_presale",