@sledge-app/react-instant-search 1.0.50 → 1.0.52
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/components/SearchResultWidget/SearchResultWidget.d.ts.map +1 -1
- package/dist/sledge-react-instant-search.cjs +1 -1
- package/dist/sledge-react-instant-search.cjs.map +1 -1
- package/dist/sledge-react-instant-search.js +9 -14
- package/dist/sledge-react-instant-search.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -2530,16 +2530,6 @@ const ProductCard = (props) => {
|
|
|
2530
2530
|
const defaultSelectedVariantStock = (variants == null ? void 0 : variants.length) && Object.hasOwn(variants[0], "inventory_quantity") ? variants[0].inventory_quantity : 0;
|
|
2531
2531
|
const [selectedVariantId, setSelectedVariantId] = React__default.useState(defaultSelectedVariantId);
|
|
2532
2532
|
const [selectedVariantStock, setSelectedVariantStock] = React__default.useState(defaultSelectedVariantStock);
|
|
2533
|
-
const [hasEntry, setHasEntry] = React__default.useState(false);
|
|
2534
|
-
const [rootRef, rootEntry] = useIntersectionObserver({
|
|
2535
|
-
threshold: 0,
|
|
2536
|
-
root: null,
|
|
2537
|
-
rootMargin: "0px"
|
|
2538
|
-
});
|
|
2539
|
-
React__default.useEffect(() => {
|
|
2540
|
-
if (!hasEntry && (rootEntry == null ? void 0 : rootEntry.isIntersecting))
|
|
2541
|
-
setHasEntry(rootEntry == null ? void 0 : rootEntry.isIntersecting);
|
|
2542
|
-
}, [rootEntry]);
|
|
2543
2533
|
let isLoadingAddToCart = clickedAddToCartId == selectedVariantId;
|
|
2544
2534
|
let isOutOfStock = (variants == null ? void 0 : variants.length) && Object.hasOwn(variants[0], "inventory_quantity") ? !Number(selectedVariantStock) && showOptionOutOfStock : false;
|
|
2545
2535
|
let component = null;
|
|
@@ -2567,7 +2557,7 @@ const ProductCard = (props) => {
|
|
|
2567
2557
|
setShowPopupComponent,
|
|
2568
2558
|
sourceApp
|
|
2569
2559
|
};
|
|
2570
|
-
component = /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: isComponentJsVersion ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
|
|
2560
|
+
component = /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: isComponentJsVersion ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { dangerouslySetInnerHTML: { __html: CardsComponent({ ...CardsProps }) } }) : /* @__PURE__ */ jsxRuntimeExports.jsx(CardsComponent, { ...CardsProps }) });
|
|
2571
2561
|
} else {
|
|
2572
2562
|
let setDefaultFunction = function() {
|
|
2573
2563
|
if (!(variants == null ? void 0 : variants.length))
|
|
@@ -2842,7 +2832,7 @@ ${selectedOption === item2 ? "sledge__product-variant-size-swatch-active" : ""}
|
|
|
2842
2832
|
) }) : null
|
|
2843
2833
|
] });
|
|
2844
2834
|
}
|
|
2845
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2835
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(React__default.Fragment, { children: component }, id);
|
|
2846
2836
|
};
|
|
2847
2837
|
const ProductGrid = (props) => {
|
|
2848
2838
|
const { type, className = "", data, setting, sourceApp = null, useSlider = false, onAfterAddToCart, onAfterRenderProduct } = props;
|
|
@@ -3942,8 +3932,10 @@ const ButtonLoadMore = ({ text, onClick, isInfiniteScroll, currentPage, totalPag
|
|
|
3942
3932
|
};
|
|
3943
3933
|
React__default.useEffect(() => {
|
|
3944
3934
|
handlePageInfo();
|
|
3945
|
-
if (isInfiniteScroll && isVisibleLoadMore && (entry == null ? void 0 : entry.isIntersecting))
|
|
3946
|
-
onClick == null ? void 0 : onClick();
|
|
3935
|
+
if (isInfiniteScroll && isVisibleLoadMore && (entry == null ? void 0 : entry.isIntersecting)) {
|
|
3936
|
+
const delay = setTimeout(() => onClick == null ? void 0 : onClick(), 500);
|
|
3937
|
+
return () => clearTimeout(delay);
|
|
3938
|
+
}
|
|
3947
3939
|
}, [entry]);
|
|
3948
3940
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__pagination", ref, children: (entry == null ? void 0 : entry.isIntersecting) && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge-instant-search__load-more", children: [
|
|
3949
3941
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: pageInfo }),
|
|
@@ -4789,12 +4781,15 @@ const ResultProduct = (props) => {
|
|
|
4789
4781
|
var _a2;
|
|
4790
4782
|
let facets2 = [value];
|
|
4791
4783
|
let isRange = ["variants.price"].includes(parentId);
|
|
4784
|
+
let isHierarchical = hierarchicalFacetAliases.includes(parentId);
|
|
4792
4785
|
if (clickedFacets) {
|
|
4793
4786
|
if (force) {
|
|
4794
4787
|
facets2 = [value];
|
|
4795
4788
|
} else {
|
|
4796
4789
|
if ((_a2 = clickedFacets[parentId]) == null ? void 0 : _a2.includes(value)) {
|
|
4797
4790
|
facets2 = clickedFacets[parentId].filter((facet) => facet !== value);
|
|
4791
|
+
if (isHierarchical)
|
|
4792
|
+
facets2 = facets2.filter((facet) => !facet.startsWith(value));
|
|
4798
4793
|
} else {
|
|
4799
4794
|
if (isRange) {
|
|
4800
4795
|
if (clickedFacets[parentId], clickedFacets[parentId] === value) {
|