@anker-in/shopify-react 0.1.1-beta.10 → 0.1.1-beta.11

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
@@ -1416,7 +1416,7 @@ var useCartAttributes = ({
1416
1416
  return "new_user_login";
1417
1417
  }, [customer]);
1418
1418
  const memberAttributes = useMemo(() => {
1419
- return [
1419
+ const attributes = [
1420
1420
  {
1421
1421
  key: "_token",
1422
1422
  value: profile?.token
@@ -1435,8 +1435,19 @@ var useCartAttributes = ({
1435
1435
  {
1436
1436
  key: "_is_login",
1437
1437
  value: profile?.token ? "true" : "false"
1438
+ },
1439
+ {
1440
+ key: "_last_url",
1441
+ value: typeof window !== "undefined" ? window.location.origin + window.location.pathname : ""
1438
1442
  }
1439
1443
  ];
1444
+ if (profile?.token) {
1445
+ attributes.push({
1446
+ key: "_login_user",
1447
+ value: "1"
1448
+ });
1449
+ }
1450
+ return attributes;
1440
1451
  }, [profile?.memberType, profile?.token, userType, hasPlusMember]);
1441
1452
  const functionAttributes = useMemo(() => {
1442
1453
  const hasFunctionEnvAttribute = cart?.lineItems.some(
@@ -2710,48 +2721,12 @@ var usePlusMemberCheckoutCustomAttributes = ({
2710
2721
  deliveryData,
2711
2722
  product,
2712
2723
  variant,
2713
- customer,
2714
2724
  isShowShippingBenefits
2715
2725
  }) => {
2716
2726
  const { deliveryCustomData } = deliveryData || {};
2717
2727
  const { profile } = usePlusMemberContext();
2718
- const userType = useMemo(() => {
2719
- const customerInfo = customer;
2720
- if (!customerInfo) {
2721
- return "new_user_unlogin";
2722
- }
2723
- if (customer) {
2724
- const { orders = {} } = customer;
2725
- const edgesLength = orders?.edges?.length;
2726
- if (edgesLength === 1) {
2727
- return "old_user_orders_once";
2728
- } else if (edgesLength && edgesLength > 1) {
2729
- return "old_user_orders_twice";
2730
- }
2731
- }
2732
- return "new_user_login";
2733
- }, [customer]);
2734
2728
  return useMemo(() => {
2735
- const checkoutCustomAttributes = [
2736
- {
2737
- key: "_token",
2738
- value: profile?.token || ""
2739
- },
2740
- {
2741
- key: "_last_url",
2742
- value: typeof window !== "undefined" ? window.location.origin + window.location.pathname : ""
2743
- },
2744
- {
2745
- key: "_user_type",
2746
- value: userType
2747
- }
2748
- ];
2749
- if (profile) {
2750
- checkoutCustomAttributes.push({
2751
- key: "_login_user",
2752
- value: "1"
2753
- });
2754
- }
2729
+ const checkoutCustomAttributes = [];
2755
2730
  if (deliveryCustomData) {
2756
2731
  checkoutCustomAttributes.push({
2757
2732
  key: "_checkout_delivery_custom",
@@ -2761,12 +2736,6 @@ var usePlusMemberCheckoutCustomAttributes = ({
2761
2736
  })
2762
2737
  });
2763
2738
  }
2764
- if (variant?.metafields?.presell) {
2765
- checkoutCustomAttributes.push({
2766
- key: "_presale",
2767
- value: "true"
2768
- });
2769
- }
2770
2739
  if (isShowShippingBenefits && !isShowShippingBenefits({ variant, product, setting: {} })) {
2771
2740
  checkoutCustomAttributes.push({
2772
2741
  key: "_hide_shipping",
@@ -2774,7 +2743,7 @@ var usePlusMemberCheckoutCustomAttributes = ({
2774
2743
  });
2775
2744
  }
2776
2745
  return checkoutCustomAttributes;
2777
- }, [deliveryCustomData, product, profile, userType, variant, isShowShippingBenefits]);
2746
+ }, [deliveryCustomData, product, profile, variant, isShowShippingBenefits]);
2778
2747
  };
2779
2748
  function useAutoRemovePlusMemberInCart({
2780
2749
  cart,