@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.
@@ -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
- ...memberAttributes,
1417
- ...functionAttributes,
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
- [memberAttributes, functionAttributes, presellAttributes, weightAttributes, trackingAttributes]
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",