@anker-in/shopify-react 0.1.1-beta.4 → 0.1.1-beta.5
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 +17 -25
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +17 -25
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/{index-aSsTcW2O.d.ts → index-BTb1ZIF-.d.ts} +13 -30
- package/dist/{index-Utuz9i5x.d.mts → index-eFsqDs13.d.mts} +13 -30
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +17 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -25
- package/dist/index.mjs.map +1 -1
- package/dist/provider/index.js +0 -2
- package/dist/provider/index.js.map +1 -1
- package/dist/provider/index.mjs +0 -2
- package/dist/provider/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/hooks/index.mjs
CHANGED
|
@@ -1294,8 +1294,6 @@ var useCartAttributes = ({
|
|
|
1294
1294
|
memberSetting,
|
|
1295
1295
|
cart
|
|
1296
1296
|
});
|
|
1297
|
-
console.log("memberSetting", memberSetting);
|
|
1298
|
-
console.log("hasPlusMember", hasPlusMember);
|
|
1299
1297
|
useEffect(() => {
|
|
1300
1298
|
setCurrentUrl(window.location.href);
|
|
1301
1299
|
}, []);
|
|
@@ -2615,15 +2613,14 @@ var usePlusMemberCheckoutCustomAttributes = ({
|
|
|
2615
2613
|
}, [deliveryCustomData, product, profile, userType, variant, isShowShippingBenefits]);
|
|
2616
2614
|
};
|
|
2617
2615
|
function useAutoRemovePlusMemberInCart({
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2616
|
+
cart,
|
|
2617
|
+
profile,
|
|
2618
|
+
memberSetting
|
|
2621
2619
|
}) {
|
|
2622
|
-
const { plus_monthly_product, plus_annual_product } =
|
|
2623
|
-
const { cart } = useCartContext();
|
|
2620
|
+
const { plus_monthly_product, plus_annual_product } = memberSetting || {};
|
|
2624
2621
|
const { trigger: removeCartLines2 } = useRemoveCartLines();
|
|
2625
2622
|
useEffect(() => {
|
|
2626
|
-
if (!cart) return;
|
|
2623
|
+
if (!cart || !plus_monthly_product || !plus_annual_product) return;
|
|
2627
2624
|
const removePlusProduct = async (productType) => {
|
|
2628
2625
|
if (!productType) return;
|
|
2629
2626
|
const product = cart.lineItems?.find(
|
|
@@ -2635,33 +2632,25 @@ function useAutoRemovePlusMemberInCart({
|
|
|
2635
2632
|
});
|
|
2636
2633
|
}
|
|
2637
2634
|
};
|
|
2638
|
-
if (isMonthlyPlus) {
|
|
2635
|
+
if (profile?.isMonthlyPlus) {
|
|
2639
2636
|
removePlusProduct(plus_monthly_product);
|
|
2640
2637
|
}
|
|
2641
|
-
if (isAnnualPlus) {
|
|
2638
|
+
if (profile?.isAnnualPlus) {
|
|
2642
2639
|
removePlusProduct(plus_annual_product);
|
|
2643
2640
|
}
|
|
2644
|
-
}, [
|
|
2645
|
-
cart,
|
|
2646
|
-
plus_annual_product,
|
|
2647
|
-
plus_monthly_product,
|
|
2648
|
-
isAnnualPlus,
|
|
2649
|
-
isMonthlyPlus,
|
|
2650
|
-
removeCartLines2
|
|
2651
|
-
]);
|
|
2641
|
+
}, [cart, plus_annual_product, plus_monthly_product, profile, removeCartLines2]);
|
|
2652
2642
|
}
|
|
2653
2643
|
function useAddPlusMemberProductsToCart({
|
|
2654
2644
|
cart,
|
|
2655
|
-
|
|
2656
|
-
selectedPlusMemberMode,
|
|
2657
|
-
selectedPlusMemberProduct
|
|
2645
|
+
profile
|
|
2658
2646
|
}) {
|
|
2647
|
+
const { selectedPlusMemberMode, selectedPlusMemberProduct, plusMemberMetafields } = usePlusMemberContext();
|
|
2659
2648
|
const { hasMonthlyPlus, hasAnnualPlus } = useHasPlusMemberInCart({
|
|
2660
|
-
|
|
2661
|
-
|
|
2649
|
+
memberSetting: plusMemberMetafields,
|
|
2650
|
+
cart
|
|
2662
2651
|
});
|
|
2663
2652
|
const plusMemberProduct = useMemo(() => {
|
|
2664
|
-
if (selectedPlusMemberMode === "free" /* FREE */) {
|
|
2653
|
+
if (!selectedPlusMemberProduct || selectedPlusMemberMode === "free" /* FREE */) {
|
|
2665
2654
|
return void 0;
|
|
2666
2655
|
}
|
|
2667
2656
|
if (selectedPlusMemberMode === "monthly" /* MONTHLY */ && hasMonthlyPlus) {
|
|
@@ -2670,7 +2659,10 @@ function useAddPlusMemberProductsToCart({
|
|
|
2670
2659
|
if (selectedPlusMemberMode === "annual" /* ANNUAL */ && hasAnnualPlus) {
|
|
2671
2660
|
return void 0;
|
|
2672
2661
|
}
|
|
2673
|
-
if (
|
|
2662
|
+
if (profile.isMonthlyPlus && selectedPlusMemberMode === "monthly" /* MONTHLY */) {
|
|
2663
|
+
return void 0;
|
|
2664
|
+
}
|
|
2665
|
+
if (!profile.isAnnualPlus && selectedPlusMemberMode === "annual" /* ANNUAL */) {
|
|
2674
2666
|
return void 0;
|
|
2675
2667
|
}
|
|
2676
2668
|
return selectedPlusMemberProduct;
|