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

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