@anker-in/shopify-react 0.1.1-beta.30 → 0.1.1-beta.32

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.
@@ -366,7 +366,6 @@ var useCalcAutoFreeGift = (cart, autoFreeGiftConfig, customer, lines) => {
366
366
  }
367
367
  return cart;
368
368
  }, [lines, cart]);
369
- console.log("effectiveCart useCalcAutoFreeGift", effectiveCart);
370
369
  const { activeCampaign, subtotal } = useMemo(() => {
371
370
  for (const campaign of autoFreeGiftConfig) {
372
371
  const { rule_conditions = [], rule_result } = campaign;
@@ -382,7 +381,6 @@ var useCalcAutoFreeGift = (cart, autoFreeGiftConfig, customer, lines) => {
382
381
  all_store_variant: spend_get_reward.main_product?.all_store_variant || false
383
382
  }
384
383
  );
385
- console.log("matchedSubtotal useCalcAutoFreeGift", matchedSubtotal);
386
384
  if (matchedSubtotal > 0) {
387
385
  return { activeCampaign: campaign, subtotal: matchedSubtotal };
388
386
  }
@@ -646,9 +644,9 @@ var useScriptAutoFreeGift = ({
646
644
  };
647
645
  };
648
646
  var CartContext = createContext(null);
649
- function useCartContext() {
647
+ function useCartContext(options) {
650
648
  const context = useContext(CartContext);
651
- if (!context) {
649
+ if (!context && true) {
652
650
  throw new Error("useCartContext must be used within a CartProvider");
653
651
  }
654
652
  return context;
@@ -875,7 +873,7 @@ function useApplyCartCodes(options) {
875
873
  }
876
874
  return updatedCart;
877
875
  },
878
- [client, locale, cartCookieAdapter, mutateCart, cart]
876
+ [client, locale, cartCookieAdapter, mutateCart, cart, metafieldIdentifiers]
879
877
  );
880
878
  return useSWRMutation("apply-codes", applyCodes, options);
881
879
  }
@@ -899,7 +897,7 @@ function useRemoveCartCodes(options) {
899
897
  }
900
898
  return updatedCart;
901
899
  },
902
- [client, locale, cartCookieAdapter, mutateCart, cart]
900
+ [client, locale, cartCookieAdapter, mutateCart, cart, metafieldIdentifiers]
903
901
  );
904
902
  return useSWRMutation("remove-codes", removeCodes, options);
905
903
  }
@@ -1056,9 +1054,10 @@ function useUpdateCartLines(options) {
1056
1054
  if (updatedCart) {
1057
1055
  mutateCart(updatedCart);
1058
1056
  }
1057
+ console.log("use-update-cart-lines updatedCart", metafieldIdentifiers, updatedCart);
1059
1058
  return updatedCart;
1060
1059
  },
1061
- [client, locale, cartCookieAdapter, mutateCart]
1060
+ [client, locale, cartCookieAdapter, mutateCart, metafieldIdentifiers]
1062
1061
  );
1063
1062
  return useSWRMutation("update-cart-lines", updateLines, options);
1064
1063
  }
@@ -1097,7 +1096,7 @@ function useRemoveCartLines(options) {
1097
1096
  }
1098
1097
  return updatedCart;
1099
1098
  },
1100
- [client, locale, cartCookieAdapter, mutateCart]
1099
+ [client, locale, cartCookieAdapter, mutateCart, metafieldIdentifiers]
1101
1100
  );
1102
1101
  return useSWRMutation("remove-cart-lines", removeLines, options);
1103
1102
  }
@@ -1116,7 +1115,7 @@ function useUpdateCartAttributes(mutate, metafieldIdentifiers, options) {
1116
1115
  }
1117
1116
  return updatedCart;
1118
1117
  },
1119
- [client, locale, cartCookieAdapter, mutate]
1118
+ [client, locale, cartCookieAdapter, mutate, metafieldIdentifiers]
1120
1119
  );
1121
1120
  return useSWRMutation("update-cart-attributes", updateAttributes, options);
1122
1121
  }
@@ -1257,7 +1256,7 @@ var useCalcOrderDiscount = (cart, orderDiscountConfig, customer) => {
1257
1256
  const isCustomerLoading = useMemo(() => !customer ? true : false, [customer]);
1258
1257
  const dealsType = "";
1259
1258
  const { activeCampaign, subtotal } = useMemo(() => {
1260
- for (const campaign of orderDiscountConfig) {
1259
+ for (const campaign of orderDiscountConfig || []) {
1261
1260
  const { rule_conditions = [], result_detail } = campaign;
1262
1261
  const { main_product, order_discount_conf } = result_detail || {};
1263
1262
  const isPreCheckPassed = preCheck(rule_conditions, tags, []);
@@ -1361,7 +1360,7 @@ function useHasPlusMemberInCart({
1361
1360
  }, [cart?.lineItems, plus_monthly_product, plus_annual_product]);
1362
1361
  }
1363
1362
  var getReferralAttributes = () => {
1364
- const inviteCode = getLocalStorage("invite_code") || Cookies5.get("invite_code");
1363
+ const inviteCode = getLocalStorage("inviteCode") || Cookies5.get("inviteCode");
1365
1364
  const playModeId = getLocalStorage("playModeId") || Cookies5.get("playModeId");
1366
1365
  const popup = getLocalStorage("_popup") || Cookies5.get("_popup");
1367
1366
  if (inviteCode && playModeId) {
@@ -2672,7 +2671,7 @@ function useUpdateCartDeliveryOptions(mutate, metafieldIdentifiers, options) {
2672
2671
  }
2673
2672
  return updatedCart;
2674
2673
  },
2675
- [client, locale, cartCookieAdapter, mutate]
2674
+ [client, locale, cartCookieAdapter, mutate, metafieldIdentifiers]
2676
2675
  );
2677
2676
  return useSWRMutation("update-cart-delivery-options", updateDeliveryOptions, options);
2678
2677
  }