@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.
@@ -396,7 +396,6 @@ var useCalcAutoFreeGift = (cart, autoFreeGiftConfig, customer, lines) => {
396
396
  const effectiveCart = useMemo(() => {
397
397
  return cart;
398
398
  }, [lines, cart]);
399
- console.log("effectiveCart useCalcAutoFreeGift", effectiveCart);
400
399
  const { activeCampaign, subtotal } = useMemo(() => {
401
400
  for (const campaign of autoFreeGiftConfig) {
402
401
  const { rule_conditions = [], rule_result } = campaign;
@@ -412,7 +411,6 @@ var useCalcAutoFreeGift = (cart, autoFreeGiftConfig, customer, lines) => {
412
411
  all_store_variant: spend_get_reward.main_product?.all_store_variant || false
413
412
  }
414
413
  );
415
- console.log("matchedSubtotal useCalcAutoFreeGift", matchedSubtotal);
416
414
  if (matchedSubtotal > 0) {
417
415
  return { activeCampaign: campaign, subtotal: matchedSubtotal };
418
416
  }
@@ -690,7 +688,7 @@ function useUpdateCartAttributes(mutate, metafieldIdentifiers, options) {
690
688
  }
691
689
  return updatedCart;
692
690
  },
693
- [client, locale, cartCookieAdapter, mutate]
691
+ [client, locale, cartCookieAdapter, mutate, metafieldIdentifiers]
694
692
  );
695
693
  return useSWRMutation8("update-cart-attributes", updateAttributes, options);
696
694
  }
@@ -726,7 +724,7 @@ function useHasPlusMemberInCart({
726
724
  }, [cart?.lineItems, plus_monthly_product, plus_annual_product]);
727
725
  }
728
726
  var getReferralAttributes = () => {
729
- const inviteCode = getLocalStorage("invite_code") || Cookies5.get("invite_code");
727
+ const inviteCode = getLocalStorage("inviteCode") || Cookies5.get("inviteCode");
730
728
  const playModeId = getLocalStorage("playModeId") || Cookies5.get("playModeId");
731
729
  const popup = getLocalStorage("_popup") || Cookies5.get("_popup");
732
730
  if (inviteCode && playModeId) {
@@ -1132,7 +1130,8 @@ function CartProvider({
1132
1130
  cart,
1133
1131
  mutateCart,
1134
1132
  isCartLoading: isCartLoading || isCodeChanging,
1135
- setLoadingState
1133
+ setLoadingState,
1134
+ metafieldIdentifiers
1136
1135
  });
1137
1136
  const removeCustomAttributes = useCallback(
1138
1137
  (attributes2) => {
@@ -1273,9 +1272,9 @@ function CartProvider({
1273
1272
  );
1274
1273
  return /* @__PURE__ */ jsx(CartContext.Provider, { value, children });
1275
1274
  }
1276
- function useCartContext() {
1275
+ function useCartContext(options) {
1277
1276
  const context = useContext(CartContext);
1278
- if (!context) {
1277
+ if (!context && !options?.optional) {
1279
1278
  throw new Error("useCartContext must be used within a CartProvider");
1280
1279
  }
1281
1280
  return context;