@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.
@@ -656,7 +656,7 @@ interface OrderDiscountResult {
656
656
  * @param orderDiscountConfig - 订单折扣配置
657
657
  * @returns { OrderDiscountResult }
658
658
  */
659
- declare const useCalcOrderDiscount: (cart: any, orderDiscountConfig: OrderDiscountConfig[], customer: any) => OrderDiscountResult;
659
+ declare const useCalcOrderDiscount: (cart: any, orderDiscountConfig?: OrderDiscountConfig[], customer?: any) => OrderDiscountResult;
660
660
 
661
661
  interface ShippingMethodsContext {
662
662
  freeShippingMethods: PlusMemberShippingMethodConfig[];
@@ -656,7 +656,7 @@ interface OrderDiscountResult {
656
656
  * @param orderDiscountConfig - 订单折扣配置
657
657
  * @returns { OrderDiscountResult }
658
658
  */
659
- declare const useCalcOrderDiscount: (cart: any, orderDiscountConfig: OrderDiscountConfig[], customer: any) => OrderDiscountResult;
659
+ declare const useCalcOrderDiscount: (cart: any, orderDiscountConfig?: OrderDiscountConfig[], customer?: any) => OrderDiscountResult;
660
660
 
661
661
  interface ShippingMethodsContext {
662
662
  freeShippingMethods: PlusMemberShippingMethodConfig[];
@@ -655,9 +655,9 @@ var useScriptAutoFreeGift = ({
655
655
  };
656
656
  };
657
657
  var CartContext = react.createContext(null);
658
- function useCartContext() {
658
+ function useCartContext(options) {
659
659
  const context = react.useContext(CartContext);
660
- if (!context) {
660
+ if (!context && true) {
661
661
  throw new Error("useCartContext must be used within a CartProvider");
662
662
  }
663
663
  return context;
@@ -884,7 +884,7 @@ function useApplyCartCodes(options) {
884
884
  }
885
885
  return updatedCart;
886
886
  },
887
- [client, locale, cartCookieAdapter, mutateCart, cart]
887
+ [client, locale, cartCookieAdapter, mutateCart, cart, metafieldIdentifiers]
888
888
  );
889
889
  return useSWRMutation__default.default("apply-codes", applyCodes, options);
890
890
  }
@@ -908,7 +908,7 @@ function useRemoveCartCodes(options) {
908
908
  }
909
909
  return updatedCart;
910
910
  },
911
- [client, locale, cartCookieAdapter, mutateCart, cart]
911
+ [client, locale, cartCookieAdapter, mutateCart, cart, metafieldIdentifiers]
912
912
  );
913
913
  return useSWRMutation__default.default("remove-codes", removeCodes, options);
914
914
  }
@@ -1065,9 +1065,10 @@ function useUpdateCartLines(options) {
1065
1065
  if (updatedCart) {
1066
1066
  mutateCart(updatedCart);
1067
1067
  }
1068
+ console.log("use-update-cart-lines updatedCart", metafieldIdentifiers, updatedCart);
1068
1069
  return updatedCart;
1069
1070
  },
1070
- [client, locale, cartCookieAdapter, mutateCart]
1071
+ [client, locale, cartCookieAdapter, mutateCart, metafieldIdentifiers]
1071
1072
  );
1072
1073
  return useSWRMutation__default.default("update-cart-lines", updateLines, options);
1073
1074
  }
@@ -1106,7 +1107,7 @@ function useRemoveCartLines(options) {
1106
1107
  }
1107
1108
  return updatedCart;
1108
1109
  },
1109
- [client, locale, cartCookieAdapter, mutateCart]
1110
+ [client, locale, cartCookieAdapter, mutateCart, metafieldIdentifiers]
1110
1111
  );
1111
1112
  return useSWRMutation__default.default("remove-cart-lines", removeLines, options);
1112
1113
  }
@@ -1125,7 +1126,7 @@ function useUpdateCartAttributes(mutate, metafieldIdentifiers, options) {
1125
1126
  }
1126
1127
  return updatedCart;
1127
1128
  },
1128
- [client, locale, cartCookieAdapter, mutate]
1129
+ [client, locale, cartCookieAdapter, mutate, metafieldIdentifiers]
1129
1130
  );
1130
1131
  return useSWRMutation__default.default("update-cart-attributes", updateAttributes, options);
1131
1132
  }
@@ -1266,7 +1267,7 @@ var useCalcOrderDiscount = (cart, orderDiscountConfig, customer) => {
1266
1267
  const isCustomerLoading = react.useMemo(() => !customer ? true : false, [customer]);
1267
1268
  const dealsType = "";
1268
1269
  const { activeCampaign, subtotal } = react.useMemo(() => {
1269
- for (const campaign of orderDiscountConfig) {
1270
+ for (const campaign of orderDiscountConfig || []) {
1270
1271
  const { rule_conditions = [], result_detail } = campaign;
1271
1272
  const { main_product, order_discount_conf } = result_detail || {};
1272
1273
  const isPreCheckPassed = preCheck(rule_conditions, tags, []);
@@ -1370,7 +1371,7 @@ function useHasPlusMemberInCart({
1370
1371
  }, [cart?.lineItems, plus_monthly_product, plus_annual_product]);
1371
1372
  }
1372
1373
  var getReferralAttributes = () => {
1373
- const inviteCode = shopifySdk.getLocalStorage("invite_code") || Cookies5__default.default.get("invite_code");
1374
+ const inviteCode = shopifySdk.getLocalStorage("inviteCode") || Cookies5__default.default.get("inviteCode");
1374
1375
  const playModeId = shopifySdk.getLocalStorage("playModeId") || Cookies5__default.default.get("playModeId");
1375
1376
  const popup = shopifySdk.getLocalStorage("_popup") || Cookies5__default.default.get("_popup");
1376
1377
  if (inviteCode && playModeId) {
@@ -2681,7 +2682,7 @@ function useUpdateCartDeliveryOptions(mutate, metafieldIdentifiers, options) {
2681
2682
  }
2682
2683
  return updatedCart;
2683
2684
  },
2684
- [client, locale, cartCookieAdapter, mutate]
2685
+ [client, locale, cartCookieAdapter, mutate, metafieldIdentifiers]
2685
2686
  );
2686
2687
  return useSWRMutation__default.default("update-cart-delivery-options", updateDeliveryOptions, options);
2687
2688
  }