@sledge-app/react-instant-search 1.0.51 → 1.0.53

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.
@@ -152,6 +152,7 @@ const DEFAULT_QUERY_PARAM = {
152
152
  KEYWORD: "q",
153
153
  SHARE_ID: "share"
154
154
  };
155
+ const DEFAULT_QUERY_PRODUCT_MEILISEARCH = [`'status' = 'active'`];
155
156
  const OBJECT_DATA_STRING_KEY = {
156
157
  STORE: {
157
158
  NAME: "{{ shop.name }}"
@@ -2530,16 +2531,6 @@ const ProductCard = (props) => {
2530
2531
  const defaultSelectedVariantStock = (variants == null ? void 0 : variants.length) && Object.hasOwn(variants[0], "inventory_quantity") ? variants[0].inventory_quantity : 0;
2531
2532
  const [selectedVariantId, setSelectedVariantId] = React__default.useState(defaultSelectedVariantId);
2532
2533
  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
2534
  let isLoadingAddToCart = clickedAddToCartId == selectedVariantId;
2544
2535
  let isOutOfStock = (variants == null ? void 0 : variants.length) && Object.hasOwn(variants[0], "inventory_quantity") ? !Number(selectedVariantStock) && showOptionOutOfStock : false;
2545
2536
  let component = null;
@@ -2567,7 +2558,7 @@ const ProductCard = (props) => {
2567
2558
  setShowPopupComponent,
2568
2559
  sourceApp
2569
2560
  };
2570
- component = /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: isComponentJsVersion ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__product-grid-entry-card", dangerouslySetInnerHTML: { __html: CardsComponent({ ...CardsProps }) } }) : /* @__PURE__ */ jsxRuntimeExports.jsx(CardsComponent, { ...CardsProps }) });
2561
+ component = /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: isComponentJsVersion ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { dangerouslySetInnerHTML: { __html: CardsComponent({ ...CardsProps }) } }) : /* @__PURE__ */ jsxRuntimeExports.jsx(CardsComponent, { ...CardsProps }) });
2571
2562
  } else {
2572
2563
  let setDefaultFunction = function() {
2573
2564
  if (!(variants == null ? void 0 : variants.length))
@@ -2842,7 +2833,7 @@ ${selectedOption === item2 ? "sledge__product-variant-size-swatch-active" : ""}
2842
2833
  ) }) : null
2843
2834
  ] });
2844
2835
  }
2845
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__product-grid-entry-card", ref: rootRef, children: hasEntry && component }, id);
2836
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(React__default.Fragment, { children: component }, id);
2846
2837
  };
2847
2838
  const ProductGrid = (props) => {
2848
2839
  const { type, className = "", data, setting, sourceApp = null, useSlider = false, onAfterAddToCart, onAfterRenderProduct } = props;
@@ -3601,7 +3592,7 @@ const SearchIconWidgetPopup = () => {
3601
3592
  queries: tabs.map((tab) => {
3602
3593
  const { index } = tab;
3603
3594
  let isProductIndex = index.includes(index_product);
3604
- let additionalFilter = [];
3595
+ let additionalFilter = DEFAULT_QUERY_PRODUCT_MEILISEARCH;
3605
3596
  if (hidden_tags == null ? void 0 : hidden_tags.length)
3606
3597
  additionalFilter.push(`tags NOT IN [${hidden_tags}]`);
3607
3598
  if (!show_out_of_stock)
@@ -4059,7 +4050,7 @@ const SearchResultWidget = (props) => {
4059
4050
  }) : [];
4060
4051
  let isProductIndex = index.includes(index_product);
4061
4052
  let isHasProductFacets = isProductIndex && getFacets.length;
4062
- let additionalFilter = [];
4053
+ let additionalFilter = DEFAULT_QUERY_PRODUCT_MEILISEARCH;
4063
4054
  if (hidden_tags == null ? void 0 : hidden_tags.length)
4064
4055
  additionalFilter.push(`'tags' NOT IN ${JSON.stringify(hidden_tags)}`);
4065
4056
  if (!show_out_of_stock)
@@ -4897,6 +4888,8 @@ const ResultProduct = (props) => {
4897
4888
  filters.push(`'tags' NOT IN ${JSON.stringify(hiddenTags)}`);
4898
4889
  if (collectionId)
4899
4890
  filters.push(`'collections.id' = '${collectionId}'`);
4891
+ if (DEFAULT_QUERY_PRODUCT_MEILISEARCH == null ? void 0 : DEFAULT_QUERY_PRODUCT_MEILISEARCH.length)
4892
+ filters = [...filters, ...DEFAULT_QUERY_PRODUCT_MEILISEARCH];
4900
4893
  let body = {
4901
4894
  q: keyword,
4902
4895
  sort: clickedSortId ? [clickedSortId] : [],
@@ -5731,7 +5724,7 @@ const SearchWidget = (props) => {
5731
5724
  queries: tabs.map((tab) => {
5732
5725
  const { index } = tab;
5733
5726
  let isProductIndex = index.includes(index_product);
5734
- let additionalFilter = [];
5727
+ let additionalFilter = DEFAULT_QUERY_PRODUCT_MEILISEARCH;
5735
5728
  if (hidden_tags == null ? void 0 : hidden_tags.length)
5736
5729
  additionalFilter.push(`tags NOT IN [${hidden_tags}]`);
5737
5730
  if (!show_out_of_stock)