@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/index.mjs
CHANGED
|
@@ -438,7 +438,6 @@ var useCalcAutoFreeGift = (cart, autoFreeGiftConfig, customer, lines) => {
|
|
|
438
438
|
}
|
|
439
439
|
return cart;
|
|
440
440
|
}, [lines, cart]);
|
|
441
|
-
console.log("effectiveCart useCalcAutoFreeGift", effectiveCart);
|
|
442
441
|
const { activeCampaign, subtotal } = useMemo(() => {
|
|
443
442
|
for (const campaign of autoFreeGiftConfig) {
|
|
444
443
|
const { rule_conditions = [], rule_result } = campaign;
|
|
@@ -454,7 +453,6 @@ var useCalcAutoFreeGift = (cart, autoFreeGiftConfig, customer, lines) => {
|
|
|
454
453
|
all_store_variant: spend_get_reward.main_product?.all_store_variant || false
|
|
455
454
|
}
|
|
456
455
|
);
|
|
457
|
-
console.log("matchedSubtotal useCalcAutoFreeGift", matchedSubtotal);
|
|
458
456
|
if (matchedSubtotal > 0) {
|
|
459
457
|
return { activeCampaign: campaign, subtotal: matchedSubtotal };
|
|
460
458
|
}
|
|
@@ -972,7 +970,7 @@ function useApplyCartCodes(options) {
|
|
|
972
970
|
}
|
|
973
971
|
return updatedCart;
|
|
974
972
|
},
|
|
975
|
-
[client, locale, cartCookieAdapter, mutateCart, cart]
|
|
973
|
+
[client, locale, cartCookieAdapter, mutateCart, cart, metafieldIdentifiers]
|
|
976
974
|
);
|
|
977
975
|
return useSWRMutation("apply-codes", applyCodes, options);
|
|
978
976
|
}
|
|
@@ -996,7 +994,7 @@ function useRemoveCartCodes(options) {
|
|
|
996
994
|
}
|
|
997
995
|
return updatedCart;
|
|
998
996
|
},
|
|
999
|
-
[client, locale, cartCookieAdapter, mutateCart, cart]
|
|
997
|
+
[client, locale, cartCookieAdapter, mutateCart, cart, metafieldIdentifiers]
|
|
1000
998
|
);
|
|
1001
999
|
return useSWRMutation("remove-codes", removeCodes, options);
|
|
1002
1000
|
}
|
|
@@ -1153,9 +1151,10 @@ function useUpdateCartLines(options) {
|
|
|
1153
1151
|
if (updatedCart) {
|
|
1154
1152
|
mutateCart(updatedCart);
|
|
1155
1153
|
}
|
|
1154
|
+
console.log("use-update-cart-lines updatedCart", metafieldIdentifiers, updatedCart);
|
|
1156
1155
|
return updatedCart;
|
|
1157
1156
|
},
|
|
1158
|
-
[client, locale, cartCookieAdapter, mutateCart]
|
|
1157
|
+
[client, locale, cartCookieAdapter, mutateCart, metafieldIdentifiers]
|
|
1159
1158
|
);
|
|
1160
1159
|
return useSWRMutation("update-cart-lines", updateLines, options);
|
|
1161
1160
|
}
|
|
@@ -1194,7 +1193,7 @@ function useRemoveCartLines(options) {
|
|
|
1194
1193
|
}
|
|
1195
1194
|
return updatedCart;
|
|
1196
1195
|
},
|
|
1197
|
-
[client, locale, cartCookieAdapter, mutateCart]
|
|
1196
|
+
[client, locale, cartCookieAdapter, mutateCart, metafieldIdentifiers]
|
|
1198
1197
|
);
|
|
1199
1198
|
return useSWRMutation("remove-cart-lines", removeLines, options);
|
|
1200
1199
|
}
|
|
@@ -1213,7 +1212,7 @@ function useUpdateCartAttributes(mutate, metafieldIdentifiers, options) {
|
|
|
1213
1212
|
}
|
|
1214
1213
|
return updatedCart;
|
|
1215
1214
|
},
|
|
1216
|
-
[client, locale, cartCookieAdapter, mutate]
|
|
1215
|
+
[client, locale, cartCookieAdapter, mutate, metafieldIdentifiers]
|
|
1217
1216
|
);
|
|
1218
1217
|
return useSWRMutation("update-cart-attributes", updateAttributes, options);
|
|
1219
1218
|
}
|
|
@@ -1354,7 +1353,7 @@ var useCalcOrderDiscount = (cart, orderDiscountConfig, customer) => {
|
|
|
1354
1353
|
const isCustomerLoading = useMemo(() => !customer ? true : false, [customer]);
|
|
1355
1354
|
const dealsType = "";
|
|
1356
1355
|
const { activeCampaign, subtotal } = useMemo(() => {
|
|
1357
|
-
for (const campaign of orderDiscountConfig) {
|
|
1356
|
+
for (const campaign of orderDiscountConfig || []) {
|
|
1358
1357
|
const { rule_conditions = [], result_detail } = campaign;
|
|
1359
1358
|
const { main_product, order_discount_conf } = result_detail || {};
|
|
1360
1359
|
const isPreCheckPassed = preCheck(rule_conditions, tags, []);
|
|
@@ -1458,7 +1457,7 @@ function useHasPlusMemberInCart({
|
|
|
1458
1457
|
}, [cart?.lineItems, plus_monthly_product, plus_annual_product]);
|
|
1459
1458
|
}
|
|
1460
1459
|
var getReferralAttributes = () => {
|
|
1461
|
-
const inviteCode = getLocalStorage("
|
|
1460
|
+
const inviteCode = getLocalStorage("inviteCode") || Cookies5.get("inviteCode");
|
|
1462
1461
|
const playModeId = getLocalStorage("playModeId") || Cookies5.get("playModeId");
|
|
1463
1462
|
const popup = getLocalStorage("_popup") || Cookies5.get("_popup");
|
|
1464
1463
|
if (inviteCode && playModeId) {
|
|
@@ -2769,7 +2768,7 @@ function useUpdateCartDeliveryOptions(mutate, metafieldIdentifiers, options) {
|
|
|
2769
2768
|
}
|
|
2770
2769
|
return updatedCart;
|
|
2771
2770
|
},
|
|
2772
|
-
[client, locale, cartCookieAdapter, mutate]
|
|
2771
|
+
[client, locale, cartCookieAdapter, mutate, metafieldIdentifiers]
|
|
2773
2772
|
);
|
|
2774
2773
|
return useSWRMutation("update-cart-delivery-options", updateDeliveryOptions, options);
|
|
2775
2774
|
}
|
|
@@ -3268,7 +3267,8 @@ function CartProvider({
|
|
|
3268
3267
|
cart,
|
|
3269
3268
|
mutateCart,
|
|
3270
3269
|
isCartLoading: isCartLoading || isCodeChanging,
|
|
3271
|
-
setLoadingState
|
|
3270
|
+
setLoadingState,
|
|
3271
|
+
metafieldIdentifiers
|
|
3272
3272
|
});
|
|
3273
3273
|
const removeCustomAttributes = useCallback(
|
|
3274
3274
|
(attributes2) => {
|
|
@@ -3409,9 +3409,9 @@ function CartProvider({
|
|
|
3409
3409
|
);
|
|
3410
3410
|
return /* @__PURE__ */ jsx(CartContext.Provider, { value, children });
|
|
3411
3411
|
}
|
|
3412
|
-
function useCartContext() {
|
|
3412
|
+
function useCartContext(options) {
|
|
3413
3413
|
const context = useContext(CartContext);
|
|
3414
|
-
if (!context) {
|
|
3414
|
+
if (!context && !options?.optional) {
|
|
3415
3415
|
throw new Error("useCartContext must be used within a CartProvider");
|
|
3416
3416
|
}
|
|
3417
3417
|
return context;
|