@anker-in/shopify-react 0.1.1-beta.31 → 0.1.1-beta.33
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/adapters/index.d.mts +18 -3
- package/dist/adapters/index.d.ts +18 -3
- package/dist/adapters/index.js +15 -0
- package/dist/adapters/index.js.map +1 -1
- package/dist/adapters/index.mjs +15 -1
- package/dist/adapters/index.mjs.map +1 -1
- package/dist/hooks/index.d.mts +3 -3
- package/dist/hooks/index.d.ts +3 -3
- package/dist/hooks/index.js +7 -6
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +7 -6
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +29 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -9
- package/dist/index.mjs.map +1 -1
- package/dist/provider/index.d.mts +4 -2
- package/dist/provider/index.d.ts +4 -2
- package/dist/provider/index.js +7 -5
- package/dist/provider/index.js.map +1 -1
- package/dist/provider/index.mjs +7 -5
- package/dist/provider/index.mjs.map +1 -1
- package/dist/{types-Dt0DUG00.d.mts → types-SKDHauqk.d.mts} +14 -1
- package/dist/{types-Dt0DUG00.d.ts → types-SKDHauqk.d.ts} +14 -1
- package/package.json +3 -3
package/dist/hooks/index.mjs
CHANGED
|
@@ -366,7 +366,6 @@ var useCalcAutoFreeGift = (cart, autoFreeGiftConfig, customer, lines) => {
|
|
|
366
366
|
}
|
|
367
367
|
return cart;
|
|
368
368
|
}, [lines, cart]);
|
|
369
|
-
console.log("effectiveCart useCalcAutoFreeGift", effectiveCart);
|
|
370
369
|
const { activeCampaign, subtotal } = useMemo(() => {
|
|
371
370
|
for (const campaign of autoFreeGiftConfig) {
|
|
372
371
|
const { rule_conditions = [], rule_result } = campaign;
|
|
@@ -382,7 +381,6 @@ var useCalcAutoFreeGift = (cart, autoFreeGiftConfig, customer, lines) => {
|
|
|
382
381
|
all_store_variant: spend_get_reward.main_product?.all_store_variant || false
|
|
383
382
|
}
|
|
384
383
|
);
|
|
385
|
-
console.log("matchedSubtotal useCalcAutoFreeGift", matchedSubtotal);
|
|
386
384
|
if (matchedSubtotal > 0) {
|
|
387
385
|
return { activeCampaign: campaign, subtotal: matchedSubtotal };
|
|
388
386
|
}
|
|
@@ -961,7 +959,7 @@ var getLinesWithFunctionAttributes = (lineItems) => {
|
|
|
961
959
|
|
|
962
960
|
// src/hooks/cart/use-add-to-cart.ts
|
|
963
961
|
function useAddToCart({ withTrack = true } = {}, swrOptions) {
|
|
964
|
-
const { client, config, locale, cartCookieAdapter, userAdapter } = useShopify();
|
|
962
|
+
const { client, config, locale, cartCookieAdapter, userAdapter, performanceAdapter } = useShopify();
|
|
965
963
|
const { cart, addCustomAttributes } = useCartContext();
|
|
966
964
|
const { trigger: applyCartCodes } = useApplyCartCodes();
|
|
967
965
|
const { trigger: removeInvalidCodes } = useRemoveCartCodes();
|
|
@@ -982,6 +980,7 @@ function useAddToCart({ withTrack = true } = {}, swrOptions) {
|
|
|
982
980
|
if (!lineItems || lineItems.length === 0) {
|
|
983
981
|
return;
|
|
984
982
|
}
|
|
983
|
+
performanceAdapter?.addToCartStart();
|
|
985
984
|
const linesWithAttributes = getLinesWithAttributes({
|
|
986
985
|
cart,
|
|
987
986
|
lineItems
|
|
@@ -1003,6 +1002,7 @@ function useAddToCart({ withTrack = true } = {}, swrOptions) {
|
|
|
1003
1002
|
buyerIdentity
|
|
1004
1003
|
});
|
|
1005
1004
|
if (!resultCart) {
|
|
1005
|
+
performanceAdapter?.addToCartEnd();
|
|
1006
1006
|
return void 0;
|
|
1007
1007
|
}
|
|
1008
1008
|
console.log("npm addCartLines resultCart", resultCart);
|
|
@@ -1037,9 +1037,10 @@ function useAddToCart({ withTrack = true } = {}, swrOptions) {
|
|
|
1037
1037
|
});
|
|
1038
1038
|
trackAddToCartFBQ({ lineItems });
|
|
1039
1039
|
}
|
|
1040
|
+
performanceAdapter?.addToCartEnd();
|
|
1040
1041
|
return resultCart;
|
|
1041
1042
|
},
|
|
1042
|
-
[client, locale, cartCookieAdapter, userAdapter, cart, withTrack]
|
|
1043
|
+
[client, locale, cartCookieAdapter, userAdapter, cart, withTrack, performanceAdapter]
|
|
1043
1044
|
);
|
|
1044
1045
|
return useSWRMutation("add-to-cart", addToCart, swrOptions);
|
|
1045
1046
|
}
|
|
@@ -2802,7 +2803,7 @@ function useAutoRemovePlusMemberInCart({
|
|
|
2802
2803
|
}
|
|
2803
2804
|
}, [cart, plus_annual_product, plus_monthly_product, profile, removeCartLines2]);
|
|
2804
2805
|
}
|
|
2805
|
-
function
|
|
2806
|
+
function usePlusMemberNeedAddToCart({
|
|
2806
2807
|
cart,
|
|
2807
2808
|
profile
|
|
2808
2809
|
}) {
|
|
@@ -3098,6 +3099,6 @@ function clearGeoLocationCache(cacheKey = "geoLocation") {
|
|
|
3098
3099
|
}
|
|
3099
3100
|
}
|
|
3100
3101
|
|
|
3101
|
-
export { BuyRuleType, CODE_AMOUNT_KEY, CUSTOMER_ATTRIBUTE_KEY, CUSTOMER_SCRIPT_GIFT_KEY, DeliveryPlusType, MAIN_PRODUCT_CODE, OrderBasePriceType, OrderDiscountType, PLUS_MEMBER_TYPE, PlusMemberContext, PlusMemberMode, PlusMemberProvider, PriceBasePriceType, PriceDiscountType, RuleType, SCRIPT_CODE_AMOUNT_KEY, ShippingMethodMode, SpendMoneyType, checkAttributesUpdateNeeded, clearGeoLocationCache, createMockCartFromLines, currencyCodeMapping, defaultSWRMutationConfiguration, formatFunctionAutoFreeGift, formatScriptAutoFreeGift, getCachedGeoLocation, getDiscountEnvAttributeValue, getMatchedMainProductSubTotal, getQuery, getReferralAttributes, normalizeAddToCartLines, preCheck, safeParse, useAddCartLines,
|
|
3102
|
+
export { BuyRuleType, CODE_AMOUNT_KEY, CUSTOMER_ATTRIBUTE_KEY, CUSTOMER_SCRIPT_GIFT_KEY, DeliveryPlusType, MAIN_PRODUCT_CODE, OrderBasePriceType, OrderDiscountType, PLUS_MEMBER_TYPE, PlusMemberContext, PlusMemberMode, PlusMemberProvider, PriceBasePriceType, PriceDiscountType, RuleType, SCRIPT_CODE_AMOUNT_KEY, ShippingMethodMode, SpendMoneyType, checkAttributesUpdateNeeded, clearGeoLocationCache, createMockCartFromLines, currencyCodeMapping, defaultSWRMutationConfiguration, formatFunctionAutoFreeGift, formatScriptAutoFreeGift, getCachedGeoLocation, getDiscountEnvAttributeValue, getMatchedMainProductSubTotal, getQuery, getReferralAttributes, normalizeAddToCartLines, preCheck, safeParse, useAddCartLines, useAddToCart, useAllBlogs, useAllCollections, useAllProducts, useApplyCartCodes, useArticle, useArticles, useArticlesInBlog, useAutoRemovePlusMemberInCart, useBlog, useBuyNow, useCalcAutoFreeGift, useCalcGiftsFromLines, useCalcOrderDiscount, useCartAttributes, useCartItemQuantityLimit, useCollection, useCollections, useCreateCart, useExposure, useGeoLocation, useHasPlusMemberInCart, useIntersection, usePlusAnnualProductVariant, usePlusMemberCheckoutCustomAttributes, usePlusMemberContext, usePlusMemberDeliveryCodes, usePlusMemberItemCustomAttributes, usePlusMemberNeedAddToCart, usePlusMonthlyProductVariant, usePrice, useProduct, useProductUrl, useProductsByHandles, useRemoveCartCodes, useRemoveCartLines, useReplaceCartPlusMember, useScriptAutoFreeGift, useSearch, useSelectedOptions, useShippingMethodAvailableCheck, useShippingMethods, useSite, useUpdateCartAttributes, useUpdateCartLines, useUpdateLineCodeAmountAttributes, useUpdatePlusMemberDeliveryOptions, useUpdateVariantQuery, useVariant, useVariantMedia };
|
|
3102
3103
|
//# sourceMappingURL=index.mjs.map
|
|
3103
3104
|
//# sourceMappingURL=index.mjs.map
|