@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/index.mjs
CHANGED
|
@@ -1391,8 +1391,6 @@ var useCartAttributes = ({
|
|
|
1391
1391
|
memberSetting,
|
|
1392
1392
|
cart
|
|
1393
1393
|
});
|
|
1394
|
-
console.log("memberSetting", memberSetting);
|
|
1395
|
-
console.log("hasPlusMember", hasPlusMember);
|
|
1396
1394
|
useEffect(() => {
|
|
1397
1395
|
setCurrentUrl(window.location.href);
|
|
1398
1396
|
}, []);
|
|
@@ -2712,15 +2710,14 @@ var usePlusMemberCheckoutCustomAttributes = ({
|
|
|
2712
2710
|
}, [deliveryCustomData, product, profile, userType, variant, isShowShippingBenefits]);
|
|
2713
2711
|
};
|
|
2714
2712
|
function useAutoRemovePlusMemberInCart({
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2713
|
+
cart,
|
|
2714
|
+
profile,
|
|
2715
|
+
memberSetting
|
|
2718
2716
|
}) {
|
|
2719
|
-
const { plus_monthly_product, plus_annual_product } =
|
|
2720
|
-
const { cart } = useCartContext();
|
|
2717
|
+
const { plus_monthly_product, plus_annual_product } = memberSetting || {};
|
|
2721
2718
|
const { trigger: removeCartLines2 } = useRemoveCartLines();
|
|
2722
2719
|
useEffect(() => {
|
|
2723
|
-
if (!cart) return;
|
|
2720
|
+
if (!cart || !plus_monthly_product || !plus_annual_product) return;
|
|
2724
2721
|
const removePlusProduct = async (productType) => {
|
|
2725
2722
|
if (!productType) return;
|
|
2726
2723
|
const product = cart.lineItems?.find(
|
|
@@ -2732,33 +2729,25 @@ function useAutoRemovePlusMemberInCart({
|
|
|
2732
2729
|
});
|
|
2733
2730
|
}
|
|
2734
2731
|
};
|
|
2735
|
-
if (isMonthlyPlus) {
|
|
2732
|
+
if (profile?.isMonthlyPlus) {
|
|
2736
2733
|
removePlusProduct(plus_monthly_product);
|
|
2737
2734
|
}
|
|
2738
|
-
if (isAnnualPlus) {
|
|
2735
|
+
if (profile?.isAnnualPlus) {
|
|
2739
2736
|
removePlusProduct(plus_annual_product);
|
|
2740
2737
|
}
|
|
2741
|
-
}, [
|
|
2742
|
-
cart,
|
|
2743
|
-
plus_annual_product,
|
|
2744
|
-
plus_monthly_product,
|
|
2745
|
-
isAnnualPlus,
|
|
2746
|
-
isMonthlyPlus,
|
|
2747
|
-
removeCartLines2
|
|
2748
|
-
]);
|
|
2738
|
+
}, [cart, plus_annual_product, plus_monthly_product, profile, removeCartLines2]);
|
|
2749
2739
|
}
|
|
2750
2740
|
function useAddPlusMemberProductsToCart({
|
|
2751
2741
|
cart,
|
|
2752
|
-
|
|
2753
|
-
selectedPlusMemberMode,
|
|
2754
|
-
selectedPlusMemberProduct
|
|
2742
|
+
profile
|
|
2755
2743
|
}) {
|
|
2744
|
+
const { selectedPlusMemberMode, selectedPlusMemberProduct, plusMemberMetafields } = usePlusMemberContext();
|
|
2756
2745
|
const { hasMonthlyPlus, hasAnnualPlus } = useHasPlusMemberInCart({
|
|
2757
|
-
|
|
2758
|
-
|
|
2746
|
+
memberSetting: plusMemberMetafields,
|
|
2747
|
+
cart
|
|
2759
2748
|
});
|
|
2760
2749
|
const plusMemberProduct = useMemo(() => {
|
|
2761
|
-
if (selectedPlusMemberMode === "free" /* FREE */) {
|
|
2750
|
+
if (!selectedPlusMemberProduct || selectedPlusMemberMode === "free" /* FREE */) {
|
|
2762
2751
|
return void 0;
|
|
2763
2752
|
}
|
|
2764
2753
|
if (selectedPlusMemberMode === "monthly" /* MONTHLY */ && hasMonthlyPlus) {
|
|
@@ -2767,7 +2756,10 @@ function useAddPlusMemberProductsToCart({
|
|
|
2767
2756
|
if (selectedPlusMemberMode === "annual" /* ANNUAL */ && hasAnnualPlus) {
|
|
2768
2757
|
return void 0;
|
|
2769
2758
|
}
|
|
2770
|
-
if (
|
|
2759
|
+
if (profile.isMonthlyPlus && selectedPlusMemberMode === "monthly" /* MONTHLY */) {
|
|
2760
|
+
return void 0;
|
|
2761
|
+
}
|
|
2762
|
+
if (!profile.isAnnualPlus && selectedPlusMemberMode === "annual" /* ANNUAL */) {
|
|
2771
2763
|
return void 0;
|
|
2772
2764
|
}
|
|
2773
2765
|
return selectedPlusMemberProduct;
|