@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.
@@ -1319,7 +1319,7 @@ var useCartAttributes = ({
1319
1319
  return "new_user_login";
1320
1320
  }, [customer]);
1321
1321
  const memberAttributes = useMemo(() => {
1322
- return [
1322
+ const attributes = [
1323
1323
  {
1324
1324
  key: "_token",
1325
1325
  value: profile?.token
@@ -1338,8 +1338,19 @@ var useCartAttributes = ({
1338
1338
  {
1339
1339
  key: "_is_login",
1340
1340
  value: profile?.token ? "true" : "false"
1341
+ },
1342
+ {
1343
+ key: "_last_url",
1344
+ value: typeof window !== "undefined" ? window.location.origin + window.location.pathname : ""
1341
1345
  }
1342
1346
  ];
1347
+ if (profile?.token) {
1348
+ attributes.push({
1349
+ key: "_login_user",
1350
+ value: "1"
1351
+ });
1352
+ }
1353
+ return attributes;
1343
1354
  }, [profile?.memberType, profile?.token, userType, hasPlusMember]);
1344
1355
  const functionAttributes = useMemo(() => {
1345
1356
  const hasFunctionEnvAttribute = cart?.lineItems.some(
@@ -2613,48 +2624,12 @@ var usePlusMemberCheckoutCustomAttributes = ({
2613
2624
  deliveryData,
2614
2625
  product,
2615
2626
  variant,
2616
- customer,
2617
2627
  isShowShippingBenefits
2618
2628
  }) => {
2619
2629
  const { deliveryCustomData } = deliveryData || {};
2620
2630
  const { profile } = usePlusMemberContext();
2621
- const userType = useMemo(() => {
2622
- const customerInfo = customer;
2623
- if (!customerInfo) {
2624
- return "new_user_unlogin";
2625
- }
2626
- if (customer) {
2627
- const { orders = {} } = customer;
2628
- const edgesLength = orders?.edges?.length;
2629
- if (edgesLength === 1) {
2630
- return "old_user_orders_once";
2631
- } else if (edgesLength && edgesLength > 1) {
2632
- return "old_user_orders_twice";
2633
- }
2634
- }
2635
- return "new_user_login";
2636
- }, [customer]);
2637
2631
  return useMemo(() => {
2638
- const checkoutCustomAttributes = [
2639
- {
2640
- key: "_token",
2641
- value: profile?.token || ""
2642
- },
2643
- {
2644
- key: "_last_url",
2645
- value: typeof window !== "undefined" ? window.location.origin + window.location.pathname : ""
2646
- },
2647
- {
2648
- key: "_user_type",
2649
- value: userType
2650
- }
2651
- ];
2652
- if (profile) {
2653
- checkoutCustomAttributes.push({
2654
- key: "_login_user",
2655
- value: "1"
2656
- });
2657
- }
2632
+ const checkoutCustomAttributes = [];
2658
2633
  if (deliveryCustomData) {
2659
2634
  checkoutCustomAttributes.push({
2660
2635
  key: "_checkout_delivery_custom",
@@ -2664,12 +2639,6 @@ var usePlusMemberCheckoutCustomAttributes = ({
2664
2639
  })
2665
2640
  });
2666
2641
  }
2667
- if (variant?.metafields?.presell) {
2668
- checkoutCustomAttributes.push({
2669
- key: "_presale",
2670
- value: "true"
2671
- });
2672
- }
2673
2642
  if (isShowShippingBenefits && !isShowShippingBenefits({ variant, product, setting: {} })) {
2674
2643
  checkoutCustomAttributes.push({
2675
2644
  key: "_hide_shipping",
@@ -2677,7 +2646,7 @@ var usePlusMemberCheckoutCustomAttributes = ({
2677
2646
  });
2678
2647
  }
2679
2648
  return checkoutCustomAttributes;
2680
- }, [deliveryCustomData, product, profile, userType, variant, isShowShippingBenefits]);
2649
+ }, [deliveryCustomData, product, profile, variant, isShowShippingBenefits]);
2681
2650
  };
2682
2651
  function useAutoRemovePlusMemberInCart({
2683
2652
  cart,