@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.
- package/dist/hooks/index.d.mts +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +11 -12
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +11 -12
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.js +13 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -13
- package/dist/index.mjs.map +1 -1
- package/dist/provider/index.d.mts +13 -2
- package/dist/provider/index.d.ts +13 -2
- package/dist/provider/index.js +6 -7
- package/dist/provider/index.js.map +1 -1
- package/dist/provider/index.mjs +6 -7
- package/dist/provider/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/hooks/index.d.mts
CHANGED
|
@@ -656,7 +656,7 @@ interface OrderDiscountResult {
|
|
|
656
656
|
* @param orderDiscountConfig - 订单折扣配置
|
|
657
657
|
* @returns { OrderDiscountResult }
|
|
658
658
|
*/
|
|
659
|
-
declare const useCalcOrderDiscount: (cart: any, orderDiscountConfig
|
|
659
|
+
declare const useCalcOrderDiscount: (cart: any, orderDiscountConfig?: OrderDiscountConfig[], customer?: any) => OrderDiscountResult;
|
|
660
660
|
|
|
661
661
|
interface ShippingMethodsContext {
|
|
662
662
|
freeShippingMethods: PlusMemberShippingMethodConfig[];
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -656,7 +656,7 @@ interface OrderDiscountResult {
|
|
|
656
656
|
* @param orderDiscountConfig - 订单折扣配置
|
|
657
657
|
* @returns { OrderDiscountResult }
|
|
658
658
|
*/
|
|
659
|
-
declare const useCalcOrderDiscount: (cart: any, orderDiscountConfig
|
|
659
|
+
declare const useCalcOrderDiscount: (cart: any, orderDiscountConfig?: OrderDiscountConfig[], customer?: any) => OrderDiscountResult;
|
|
660
660
|
|
|
661
661
|
interface ShippingMethodsContext {
|
|
662
662
|
freeShippingMethods: PlusMemberShippingMethodConfig[];
|
package/dist/hooks/index.js
CHANGED
|
@@ -375,7 +375,6 @@ var useCalcAutoFreeGift = (cart, autoFreeGiftConfig, customer, lines) => {
|
|
|
375
375
|
}
|
|
376
376
|
return cart;
|
|
377
377
|
}, [lines, cart]);
|
|
378
|
-
console.log("effectiveCart useCalcAutoFreeGift", effectiveCart);
|
|
379
378
|
const { activeCampaign, subtotal } = react.useMemo(() => {
|
|
380
379
|
for (const campaign of autoFreeGiftConfig) {
|
|
381
380
|
const { rule_conditions = [], rule_result } = campaign;
|
|
@@ -391,7 +390,6 @@ var useCalcAutoFreeGift = (cart, autoFreeGiftConfig, customer, lines) => {
|
|
|
391
390
|
all_store_variant: spend_get_reward.main_product?.all_store_variant || false
|
|
392
391
|
}
|
|
393
392
|
);
|
|
394
|
-
console.log("matchedSubtotal useCalcAutoFreeGift", matchedSubtotal);
|
|
395
393
|
if (matchedSubtotal > 0) {
|
|
396
394
|
return { activeCampaign: campaign, subtotal: matchedSubtotal };
|
|
397
395
|
}
|
|
@@ -655,9 +653,9 @@ var useScriptAutoFreeGift = ({
|
|
|
655
653
|
};
|
|
656
654
|
};
|
|
657
655
|
var CartContext = react.createContext(null);
|
|
658
|
-
function useCartContext() {
|
|
656
|
+
function useCartContext(options) {
|
|
659
657
|
const context = react.useContext(CartContext);
|
|
660
|
-
if (!context) {
|
|
658
|
+
if (!context && true) {
|
|
661
659
|
throw new Error("useCartContext must be used within a CartProvider");
|
|
662
660
|
}
|
|
663
661
|
return context;
|
|
@@ -884,7 +882,7 @@ function useApplyCartCodes(options) {
|
|
|
884
882
|
}
|
|
885
883
|
return updatedCart;
|
|
886
884
|
},
|
|
887
|
-
[client, locale, cartCookieAdapter, mutateCart, cart]
|
|
885
|
+
[client, locale, cartCookieAdapter, mutateCart, cart, metafieldIdentifiers]
|
|
888
886
|
);
|
|
889
887
|
return useSWRMutation__default.default("apply-codes", applyCodes, options);
|
|
890
888
|
}
|
|
@@ -908,7 +906,7 @@ function useRemoveCartCodes(options) {
|
|
|
908
906
|
}
|
|
909
907
|
return updatedCart;
|
|
910
908
|
},
|
|
911
|
-
[client, locale, cartCookieAdapter, mutateCart, cart]
|
|
909
|
+
[client, locale, cartCookieAdapter, mutateCart, cart, metafieldIdentifiers]
|
|
912
910
|
);
|
|
913
911
|
return useSWRMutation__default.default("remove-codes", removeCodes, options);
|
|
914
912
|
}
|
|
@@ -1065,9 +1063,10 @@ function useUpdateCartLines(options) {
|
|
|
1065
1063
|
if (updatedCart) {
|
|
1066
1064
|
mutateCart(updatedCart);
|
|
1067
1065
|
}
|
|
1066
|
+
console.log("use-update-cart-lines updatedCart", metafieldIdentifiers, updatedCart);
|
|
1068
1067
|
return updatedCart;
|
|
1069
1068
|
},
|
|
1070
|
-
[client, locale, cartCookieAdapter, mutateCart]
|
|
1069
|
+
[client, locale, cartCookieAdapter, mutateCart, metafieldIdentifiers]
|
|
1071
1070
|
);
|
|
1072
1071
|
return useSWRMutation__default.default("update-cart-lines", updateLines, options);
|
|
1073
1072
|
}
|
|
@@ -1106,7 +1105,7 @@ function useRemoveCartLines(options) {
|
|
|
1106
1105
|
}
|
|
1107
1106
|
return updatedCart;
|
|
1108
1107
|
},
|
|
1109
|
-
[client, locale, cartCookieAdapter, mutateCart]
|
|
1108
|
+
[client, locale, cartCookieAdapter, mutateCart, metafieldIdentifiers]
|
|
1110
1109
|
);
|
|
1111
1110
|
return useSWRMutation__default.default("remove-cart-lines", removeLines, options);
|
|
1112
1111
|
}
|
|
@@ -1125,7 +1124,7 @@ function useUpdateCartAttributes(mutate, metafieldIdentifiers, options) {
|
|
|
1125
1124
|
}
|
|
1126
1125
|
return updatedCart;
|
|
1127
1126
|
},
|
|
1128
|
-
[client, locale, cartCookieAdapter, mutate]
|
|
1127
|
+
[client, locale, cartCookieAdapter, mutate, metafieldIdentifiers]
|
|
1129
1128
|
);
|
|
1130
1129
|
return useSWRMutation__default.default("update-cart-attributes", updateAttributes, options);
|
|
1131
1130
|
}
|
|
@@ -1266,7 +1265,7 @@ var useCalcOrderDiscount = (cart, orderDiscountConfig, customer) => {
|
|
|
1266
1265
|
const isCustomerLoading = react.useMemo(() => !customer ? true : false, [customer]);
|
|
1267
1266
|
const dealsType = "";
|
|
1268
1267
|
const { activeCampaign, subtotal } = react.useMemo(() => {
|
|
1269
|
-
for (const campaign of orderDiscountConfig) {
|
|
1268
|
+
for (const campaign of orderDiscountConfig || []) {
|
|
1270
1269
|
const { rule_conditions = [], result_detail } = campaign;
|
|
1271
1270
|
const { main_product, order_discount_conf } = result_detail || {};
|
|
1272
1271
|
const isPreCheckPassed = preCheck(rule_conditions, tags, []);
|
|
@@ -1370,7 +1369,7 @@ function useHasPlusMemberInCart({
|
|
|
1370
1369
|
}, [cart?.lineItems, plus_monthly_product, plus_annual_product]);
|
|
1371
1370
|
}
|
|
1372
1371
|
var getReferralAttributes = () => {
|
|
1373
|
-
const inviteCode = shopifySdk.getLocalStorage("
|
|
1372
|
+
const inviteCode = shopifySdk.getLocalStorage("inviteCode") || Cookies5__default.default.get("inviteCode");
|
|
1374
1373
|
const playModeId = shopifySdk.getLocalStorage("playModeId") || Cookies5__default.default.get("playModeId");
|
|
1375
1374
|
const popup = shopifySdk.getLocalStorage("_popup") || Cookies5__default.default.get("_popup");
|
|
1376
1375
|
if (inviteCode && playModeId) {
|
|
@@ -2681,7 +2680,7 @@ function useUpdateCartDeliveryOptions(mutate, metafieldIdentifiers, options) {
|
|
|
2681
2680
|
}
|
|
2682
2681
|
return updatedCart;
|
|
2683
2682
|
},
|
|
2684
|
-
[client, locale, cartCookieAdapter, mutate]
|
|
2683
|
+
[client, locale, cartCookieAdapter, mutate, metafieldIdentifiers]
|
|
2685
2684
|
);
|
|
2686
2685
|
return useSWRMutation__default.default("update-cart-delivery-options", updateDeliveryOptions, options);
|
|
2687
2686
|
}
|