@anker-in/shopify-react 1.3.0-beta.1 → 1.3.0-beta.2
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.js +139 -139
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +140 -140
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.js +25 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -4
- package/dist/index.mjs.map +1 -1
- package/dist/provider/index.d.mts +2 -0
- package/dist/provider/index.d.ts +2 -0
- package/dist/provider/index.js +138 -6
- package/dist/provider/index.js.map +1 -1
- package/dist/provider/index.mjs +139 -7
- package/dist/provider/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -3549,6 +3549,16 @@ function clearGeoLocationCache(cacheKey = "geoLocation") {
|
|
|
3549
3549
|
}
|
|
3550
3550
|
}
|
|
3551
3551
|
var CartContext = react.createContext(null);
|
|
3552
|
+
function AutoRemoveGiftsHandler({
|
|
3553
|
+
options,
|
|
3554
|
+
onRemovingChange
|
|
3555
|
+
}) {
|
|
3556
|
+
const { isRemoving } = useAutoRemoveFreeGifts(options);
|
|
3557
|
+
react.useEffect(() => {
|
|
3558
|
+
onRemovingChange(isRemoving);
|
|
3559
|
+
}, [isRemoving, onRemovingChange]);
|
|
3560
|
+
return null;
|
|
3561
|
+
}
|
|
3552
3562
|
function CartProvider({
|
|
3553
3563
|
children,
|
|
3554
3564
|
// swrOptions,
|
|
@@ -3576,6 +3586,7 @@ function CartProvider({
|
|
|
3576
3586
|
});
|
|
3577
3587
|
const [scriptAutoFreeGift, setScriptAutoFreeGift] = react.useState([]);
|
|
3578
3588
|
const [functionAutoFreeGift, setFunctionAutoFreeGift] = react.useState([]);
|
|
3589
|
+
const [isAutoRemovingFreeGifts, setIsAutoRemovingFreeGifts] = react.useState(false);
|
|
3579
3590
|
const {
|
|
3580
3591
|
run: fetchCart,
|
|
3581
3592
|
data: cart,
|
|
@@ -3768,7 +3779,8 @@ function CartProvider({
|
|
|
3768
3779
|
metafieldIdentifiers,
|
|
3769
3780
|
memberSetting,
|
|
3770
3781
|
appContext,
|
|
3771
|
-
autoRemoveFreeGiftsOptions
|
|
3782
|
+
autoRemoveFreeGiftsOptions,
|
|
3783
|
+
isAutoRemovingFreeGifts
|
|
3772
3784
|
}),
|
|
3773
3785
|
[
|
|
3774
3786
|
cart,
|
|
@@ -3797,10 +3809,20 @@ function CartProvider({
|
|
|
3797
3809
|
profile,
|
|
3798
3810
|
memberSetting,
|
|
3799
3811
|
appContext,
|
|
3800
|
-
autoRemoveFreeGiftsOptions
|
|
3812
|
+
autoRemoveFreeGiftsOptions,
|
|
3813
|
+
isAutoRemovingFreeGifts
|
|
3801
3814
|
]
|
|
3802
3815
|
);
|
|
3803
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
3816
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(CartContext.Provider, { value, children: [
|
|
3817
|
+
(functionAutoFreeGiftConfig || scriptAutoFreeGiftConfig) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3818
|
+
AutoRemoveGiftsHandler,
|
|
3819
|
+
{
|
|
3820
|
+
options: autoRemoveFreeGiftsOptions,
|
|
3821
|
+
onRemovingChange: setIsAutoRemovingFreeGifts
|
|
3822
|
+
}
|
|
3823
|
+
),
|
|
3824
|
+
children
|
|
3825
|
+
] });
|
|
3804
3826
|
}
|
|
3805
3827
|
function useCartContext(options) {
|
|
3806
3828
|
const context = react.useContext(CartContext);
|