@getlupa/client 1.11.8 → 1.12.0

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.
@@ -6899,11 +6899,12 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
6899
6899
  }
6900
6900
  };
6901
6901
  const getNormalizedString = (str) => {
6902
+ var _a, _b;
6902
6903
  if (!str) {
6903
6904
  return "";
6904
6905
  }
6905
6906
  const transformedStr = typeof str === "string" ? str : str.toString();
6906
- return transformedStr.normalize === void 0 ? transformedStr.toLocaleLowerCase() : transformedStr.toLocaleLowerCase().normalize("NFKD").replace(/[^\w\s.-_/]/g, "");
6907
+ return transformedStr.normalize === void 0 ? (_a = transformedStr.toLocaleLowerCase()) == null ? void 0 : _a.trim() : (_b = transformedStr.toLocaleLowerCase().normalize("NFKD").replace(/[^\w\s.-_/]/g, "")) == null ? void 0 : _b.trim();
6907
6908
  };
6908
6909
  const capitalize$1 = (str) => {
6909
6910
  if (!str) {
@@ -7381,23 +7382,34 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7381
7382
  };
7382
7383
  const useScreenStore = defineStore("screen", () => {
7383
7384
  const screenWidth = ref(1e3);
7385
+ const optionsStore = useOptionsStore();
7386
+ const configuredGridSizes = computed(() => {
7387
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
7388
+ return {
7389
+ smMin: (_d = (_c = (_b = (_a = optionsStore.searchResultOptions) == null ? void 0 : _a.grid) == null ? void 0 : _b.sizes) == null ? void 0 : _c.sm) != null ? _d : S_MIN_WIDTH,
7390
+ mdMin: (_h = (_g = (_f = (_e = optionsStore.searchResultOptions) == null ? void 0 : _e.grid) == null ? void 0 : _f.sizes) == null ? void 0 : _g.md) != null ? _h : MD_MIN_WIDTH,
7391
+ lMin: (_l = (_k = (_j = (_i = optionsStore.searchResultOptions) == null ? void 0 : _i.grid) == null ? void 0 : _j.sizes) == null ? void 0 : _k.l) != null ? _l : L_MIN_WIDTH,
7392
+ xlMin: (_p = (_o = (_n = (_m = optionsStore.searchResultOptions) == null ? void 0 : _m.grid) == null ? void 0 : _n.sizes) == null ? void 0 : _o.xl) != null ? _p : XL_MIN_WIDTH
7393
+ };
7394
+ });
7384
7395
  const currentScreenWidth = computed(() => {
7385
7396
  const width = screenWidth.value;
7386
- if (width <= S_MIN_WIDTH) {
7397
+ if (width <= configuredGridSizes.value.smMin) {
7387
7398
  return "xs";
7388
- } else if (width > S_MIN_WIDTH && width <= MD_MIN_WIDTH) {
7399
+ } else if (width > configuredGridSizes.value.smMin && width <= configuredGridSizes.value.mdMin) {
7389
7400
  return "sm";
7390
- } else if (width > MD_MIN_WIDTH && width <= L_MIN_WIDTH) {
7401
+ } else if (width > configuredGridSizes.value.mdMin && width <= configuredGridSizes.value.lMin) {
7391
7402
  return "md";
7392
- } else if (width > L_MIN_WIDTH && width <= XL_MIN_WIDTH) {
7403
+ } else if (width > configuredGridSizes.value.lMin && width <= configuredGridSizes.value.xlMin) {
7393
7404
  return "l";
7394
7405
  } else {
7395
7406
  return "xl";
7396
7407
  }
7397
7408
  });
7398
- const isMobileWidth = computed(
7399
- () => currentScreenWidth.value === "sm" || currentScreenWidth.value === "xs"
7400
- );
7409
+ const isMobileWidth = computed(() => {
7410
+ var _a;
7411
+ return (_a = ["xs", "sm"]) == null ? void 0 : _a.includes(currentScreenWidth.value);
7412
+ });
7401
7413
  const setScreenWidth = ({ width }) => {
7402
7414
  screenWidth.value = width;
7403
7415
  };
@@ -9406,6 +9418,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
9406
9418
  const isMobileSidebarVisible = ref(false);
9407
9419
  const optionsStore = useOptionsStore();
9408
9420
  const paramsStore = useParamsStore();
9421
+ const screenStore = useScreenStore();
9409
9422
  const { searchResultOptions } = storeToRefs(optionsStore);
9410
9423
  const facets = computed(() => searchResult.value.facets);
9411
9424
  const filters = computed(() => searchResult.value.filters);
@@ -9451,6 +9464,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
9451
9464
  var _a;
9452
9465
  return Object.keys((_a = filters.value) != null ? _a : {}).length > 0;
9453
9466
  });
9467
+ const hideFiltersOnExactMatchForKeys = computed(() => {
9468
+ var _a, _b, _c, _d;
9469
+ return (_d = (_c = (_b = (_a = searchResultOptions.value) == null ? void 0 : _a.filters) == null ? void 0 : _b.facets) == null ? void 0 : _c.hideFiltersOnExactMatchForKeys) != null ? _d : [];
9470
+ });
9454
9471
  const itemRange = computed(() => {
9455
9472
  var _a, _b;
9456
9473
  const limit = (_a = paramsStore.limit) != null ? _a : 0;
@@ -9504,20 +9521,13 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
9504
9521
  return { searchResult: newSearchResult };
9505
9522
  };
9506
9523
  const setColumnCount = ({ width, grid }) => {
9524
+ var _a;
9507
9525
  if (!width || !grid) {
9508
9526
  return;
9509
9527
  }
9510
- if (width <= S_MIN_WIDTH) {
9511
- columnCount.value = grid.columns.xs;
9512
- } else if (width > S_MIN_WIDTH && width <= MD_MIN_WIDTH) {
9513
- columnCount.value = grid.columns.sm;
9514
- } else if (width > MD_MIN_WIDTH && width <= L_MIN_WIDTH) {
9515
- columnCount.value = grid.columns.md;
9516
- } else if (width > L_MIN_WIDTH && width <= XL_MIN_WIDTH) {
9517
- columnCount.value = grid.columns.l;
9518
- } else {
9519
- columnCount.value = grid.columns.xl;
9520
- }
9528
+ const { currentScreenWidth } = storeToRefs(screenStore);
9529
+ const screenWidth = (_a = currentScreenWidth.value) != null ? _a : "xl";
9530
+ columnCount.value = grid.columns[screenWidth];
9521
9531
  };
9522
9532
  const setAddToCartAmount = (newAddToCartAmount) => {
9523
9533
  if (!newAddToCartAmount) {
@@ -9537,6 +9547,15 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
9537
9547
  const clearSearchResult = () => {
9538
9548
  searchResult.value = {};
9539
9549
  };
9550
+ const filterVisibleFilterValues = (key, items = []) => {
9551
+ var _a;
9552
+ if (!((_a = hideFiltersOnExactMatchForKeys.value) == null ? void 0 : _a.length) || !hideFiltersOnExactMatchForKeys.value.includes(key) || !items.length) {
9553
+ return items;
9554
+ }
9555
+ const searchInput = getNormalizedString(currentQueryText.value);
9556
+ const hasExactMatch = items.some((item) => getNormalizedString(item.title) === searchInput);
9557
+ return hasExactMatch ? items.filter((item) => getNormalizedString(item.title) === searchInput) : items;
9558
+ };
9540
9559
  return {
9541
9560
  isMobileSidebarVisible,
9542
9561
  searchResult,
@@ -9556,6 +9575,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
9556
9575
  hasAnyFilter,
9557
9576
  itemRange,
9558
9577
  isPageEmpty,
9578
+ hideFiltersOnExactMatchForKeys,
9559
9579
  setSidebarState,
9560
9580
  queryFacet,
9561
9581
  add: add2,
@@ -9563,7 +9583,8 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
9563
9583
  setAddToCartAmount,
9564
9584
  setLayout,
9565
9585
  setLoading,
9566
- clearSearchResult
9586
+ clearSearchResult,
9587
+ filterVisibleFilterValues
9567
9588
  };
9568
9589
  });
9569
9590
  const _hoisted_1$12 = { class: "lupa-search-box-add-to-cart-wrapper" };
@@ -11276,11 +11297,25 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
11276
11297
  const paramsStore = useParamsStore();
11277
11298
  const optionStore = useOptionsStore();
11278
11299
  const searchResultStore = useSearchResultStore();
11279
- const { filters, displayFilters, currentFilterCount } = storeToRefs(searchResultStore);
11300
+ const {
11301
+ filters,
11302
+ displayFilters,
11303
+ currentFilterCount,
11304
+ hideFiltersOnExactMatchForKeys,
11305
+ currentQueryText
11306
+ } = storeToRefs(searchResultStore);
11280
11307
  const currentFilters = computed(() => filters.value);
11308
+ const currentDisplayFilters = computed(
11309
+ () => hideFiltersOnExactMatchForKeys.value.length ? displayFilters.value.filter(
11310
+ (f2) => {
11311
+ var _a;
11312
+ return !((_a = hideFiltersOnExactMatchForKeys.value) == null ? void 0 : _a.includes(f2.key)) && getNormalizedString(currentQueryText.value) !== getNormalizedString(f2.label);
11313
+ }
11314
+ ) : displayFilters.value
11315
+ );
11281
11316
  const hasFilters = computed(() => {
11282
11317
  var _a;
11283
- return ((_a = displayFilters.value) == null ? void 0 : _a.length) > 0;
11318
+ return ((_a = currentDisplayFilters.value) == null ? void 0 : _a.length) > 0;
11284
11319
  });
11285
11320
  const handleClearAll = () => {
11286
11321
  paramsStore.removeAllFilters();
@@ -11337,7 +11372,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
11337
11372
  ]),
11338
11373
  !_ctx.expandable || isOpen.value ? (openBlock(), createElementBlock("div", _hoisted_3$q, [
11339
11374
  createBaseVNode("div", _hoisted_4$k, [
11340
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(displayFilters), (filter) => {
11375
+ (openBlock(true), createElementBlock(Fragment, null, renderList(currentDisplayFilters.value, (filter) => {
11341
11376
  return openBlock(), createBlock(_sfc_main$R, {
11342
11377
  key: filter.key + "_" + filter.value,
11343
11378
  filter,
@@ -11550,11 +11585,12 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
11550
11585
  emits: ["select"],
11551
11586
  setup(__props, { emit: emit2 }) {
11552
11587
  const props = __props;
11588
+ const searchResultStore = useSearchResultStore();
11553
11589
  const facet = computed(() => {
11554
11590
  var _a;
11555
11591
  return (_a = props.facet) != null ? _a : { type: "terms", items: [], key: "" };
11556
11592
  });
11557
- const currentFiltersaValue = computed(() => {
11593
+ const currentFiltersValue = computed(() => {
11558
11594
  var _a;
11559
11595
  return (_a = props.currentFilters) != null ? _a : [];
11560
11596
  });
@@ -11565,22 +11601,23 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
11565
11601
  });
11566
11602
  const allValues = computed(() => {
11567
11603
  var _a, _b;
11568
- return (_b = (_a = facet.value) == null ? void 0 : _a.items) != null ? _b : [];
11604
+ return searchResultStore.filterVisibleFilterValues(facet.value.key, (_b = (_a = facet.value) == null ? void 0 : _a.items) != null ? _b : []);
11569
11605
  });
11570
11606
  const displayValues = computed(() => {
11571
11607
  return filteredValues.value.slice(0, itemLimit.value).map((v) => __spreadProps2(__spreadValues2({}, v), { title: getDisplayValue(v.title) }));
11572
11608
  });
11573
11609
  const filteredValues = computed(() => {
11574
- return isFilterable.value ? allValues.value.filter(
11610
+ var _a, _b;
11611
+ return isFilterable.value ? (_a = allValues.value) == null ? void 0 : _a.filter(
11575
11612
  (v) => {
11576
- var _a;
11577
- return (_a = getNormalizedString(v.title)) == null ? void 0 : _a.includes(getNormalizedString(termFilter.value));
11613
+ var _a2;
11614
+ return (_a2 = getNormalizedString(v.title)) == null ? void 0 : _a2.includes(getNormalizedString(termFilter.value));
11578
11615
  }
11579
- ) : allValues.value;
11616
+ ) : (_b = allValues.value) != null ? _b : [];
11580
11617
  });
11581
11618
  const isFilterable = computed(() => {
11582
- var _a, _b;
11583
- return allValues.value.length >= ((_b = (_a = props.options.filterable) == null ? void 0 : _a.minValues) != null ? _b : MAX_FACET_VALUES);
11619
+ var _a, _b, _c;
11620
+ return ((_a = allValues.value) == null ? void 0 : _a.length) >= ((_c = (_b = props.options.filterable) == null ? void 0 : _b.minValues) != null ? _c : MAX_FACET_VALUES);
11584
11621
  });
11585
11622
  const isRange = computed(() => {
11586
11623
  return facet.value.type === "range";
@@ -11604,7 +11641,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
11604
11641
  };
11605
11642
  const isChecked = (item) => {
11606
11643
  var _a, _b;
11607
- let selectedItems = (_a = currentFiltersaValue.value) != null ? _a : [];
11644
+ let selectedItems = (_a = currentFiltersValue.value) != null ? _a : [];
11608
11645
  selectedItems = isRange.value && selectedItems ? [rangeFilterToString(selectedItems)] : selectedItems;
11609
11646
  return selectedItems == null ? void 0 : selectedItems.includes((_b = item.title) == null ? void 0 : _b.toString());
11610
11647
  };
@@ -6899,11 +6899,12 @@ const LupaSearchSdk = {
6899
6899
  }
6900
6900
  };
6901
6901
  const getNormalizedString = (str) => {
6902
+ var _a, _b;
6902
6903
  if (!str) {
6903
6904
  return "";
6904
6905
  }
6905
6906
  const transformedStr = typeof str === "string" ? str : str.toString();
6906
- return transformedStr.normalize === void 0 ? transformedStr.toLocaleLowerCase() : transformedStr.toLocaleLowerCase().normalize("NFKD").replace(/[^\w\s.-_/]/g, "");
6907
+ return transformedStr.normalize === void 0 ? (_a = transformedStr.toLocaleLowerCase()) == null ? void 0 : _a.trim() : (_b = transformedStr.toLocaleLowerCase().normalize("NFKD").replace(/[^\w\s.-_/]/g, "")) == null ? void 0 : _b.trim();
6907
6908
  };
6908
6909
  const capitalize$1 = (str) => {
6909
6910
  if (!str) {
@@ -7381,23 +7382,34 @@ const DEFAULT_OPTIONS_RESULTS$1 = {
7381
7382
  };
7382
7383
  const useScreenStore = defineStore("screen", () => {
7383
7384
  const screenWidth = ref(1e3);
7385
+ const optionsStore = useOptionsStore();
7386
+ const configuredGridSizes = computed(() => {
7387
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
7388
+ return {
7389
+ smMin: (_d = (_c = (_b = (_a = optionsStore.searchResultOptions) == null ? void 0 : _a.grid) == null ? void 0 : _b.sizes) == null ? void 0 : _c.sm) != null ? _d : S_MIN_WIDTH,
7390
+ mdMin: (_h = (_g = (_f = (_e = optionsStore.searchResultOptions) == null ? void 0 : _e.grid) == null ? void 0 : _f.sizes) == null ? void 0 : _g.md) != null ? _h : MD_MIN_WIDTH,
7391
+ lMin: (_l = (_k = (_j = (_i = optionsStore.searchResultOptions) == null ? void 0 : _i.grid) == null ? void 0 : _j.sizes) == null ? void 0 : _k.l) != null ? _l : L_MIN_WIDTH,
7392
+ xlMin: (_p = (_o = (_n = (_m = optionsStore.searchResultOptions) == null ? void 0 : _m.grid) == null ? void 0 : _n.sizes) == null ? void 0 : _o.xl) != null ? _p : XL_MIN_WIDTH
7393
+ };
7394
+ });
7384
7395
  const currentScreenWidth = computed(() => {
7385
7396
  const width = screenWidth.value;
7386
- if (width <= S_MIN_WIDTH) {
7397
+ if (width <= configuredGridSizes.value.smMin) {
7387
7398
  return "xs";
7388
- } else if (width > S_MIN_WIDTH && width <= MD_MIN_WIDTH) {
7399
+ } else if (width > configuredGridSizes.value.smMin && width <= configuredGridSizes.value.mdMin) {
7389
7400
  return "sm";
7390
- } else if (width > MD_MIN_WIDTH && width <= L_MIN_WIDTH) {
7401
+ } else if (width > configuredGridSizes.value.mdMin && width <= configuredGridSizes.value.lMin) {
7391
7402
  return "md";
7392
- } else if (width > L_MIN_WIDTH && width <= XL_MIN_WIDTH) {
7403
+ } else if (width > configuredGridSizes.value.lMin && width <= configuredGridSizes.value.xlMin) {
7393
7404
  return "l";
7394
7405
  } else {
7395
7406
  return "xl";
7396
7407
  }
7397
7408
  });
7398
- const isMobileWidth = computed(
7399
- () => currentScreenWidth.value === "sm" || currentScreenWidth.value === "xs"
7400
- );
7409
+ const isMobileWidth = computed(() => {
7410
+ var _a;
7411
+ return (_a = ["xs", "sm"]) == null ? void 0 : _a.includes(currentScreenWidth.value);
7412
+ });
7401
7413
  const setScreenWidth = ({ width }) => {
7402
7414
  screenWidth.value = width;
7403
7415
  };
@@ -9406,6 +9418,7 @@ const useSearchResultStore = defineStore("searchResult", () => {
9406
9418
  const isMobileSidebarVisible = ref(false);
9407
9419
  const optionsStore = useOptionsStore();
9408
9420
  const paramsStore = useParamsStore();
9421
+ const screenStore = useScreenStore();
9409
9422
  const { searchResultOptions } = storeToRefs(optionsStore);
9410
9423
  const facets = computed(() => searchResult.value.facets);
9411
9424
  const filters = computed(() => searchResult.value.filters);
@@ -9451,6 +9464,10 @@ const useSearchResultStore = defineStore("searchResult", () => {
9451
9464
  var _a;
9452
9465
  return Object.keys((_a = filters.value) != null ? _a : {}).length > 0;
9453
9466
  });
9467
+ const hideFiltersOnExactMatchForKeys = computed(() => {
9468
+ var _a, _b, _c, _d;
9469
+ return (_d = (_c = (_b = (_a = searchResultOptions.value) == null ? void 0 : _a.filters) == null ? void 0 : _b.facets) == null ? void 0 : _c.hideFiltersOnExactMatchForKeys) != null ? _d : [];
9470
+ });
9454
9471
  const itemRange = computed(() => {
9455
9472
  var _a, _b;
9456
9473
  const limit = (_a = paramsStore.limit) != null ? _a : 0;
@@ -9504,20 +9521,13 @@ const useSearchResultStore = defineStore("searchResult", () => {
9504
9521
  return { searchResult: newSearchResult };
9505
9522
  };
9506
9523
  const setColumnCount = ({ width, grid }) => {
9524
+ var _a;
9507
9525
  if (!width || !grid) {
9508
9526
  return;
9509
9527
  }
9510
- if (width <= S_MIN_WIDTH) {
9511
- columnCount.value = grid.columns.xs;
9512
- } else if (width > S_MIN_WIDTH && width <= MD_MIN_WIDTH) {
9513
- columnCount.value = grid.columns.sm;
9514
- } else if (width > MD_MIN_WIDTH && width <= L_MIN_WIDTH) {
9515
- columnCount.value = grid.columns.md;
9516
- } else if (width > L_MIN_WIDTH && width <= XL_MIN_WIDTH) {
9517
- columnCount.value = grid.columns.l;
9518
- } else {
9519
- columnCount.value = grid.columns.xl;
9520
- }
9528
+ const { currentScreenWidth } = storeToRefs(screenStore);
9529
+ const screenWidth = (_a = currentScreenWidth.value) != null ? _a : "xl";
9530
+ columnCount.value = grid.columns[screenWidth];
9521
9531
  };
9522
9532
  const setAddToCartAmount = (newAddToCartAmount) => {
9523
9533
  if (!newAddToCartAmount) {
@@ -9537,6 +9547,15 @@ const useSearchResultStore = defineStore("searchResult", () => {
9537
9547
  const clearSearchResult = () => {
9538
9548
  searchResult.value = {};
9539
9549
  };
9550
+ const filterVisibleFilterValues = (key, items = []) => {
9551
+ var _a;
9552
+ if (!((_a = hideFiltersOnExactMatchForKeys.value) == null ? void 0 : _a.length) || !hideFiltersOnExactMatchForKeys.value.includes(key) || !items.length) {
9553
+ return items;
9554
+ }
9555
+ const searchInput = getNormalizedString(currentQueryText.value);
9556
+ const hasExactMatch = items.some((item) => getNormalizedString(item.title) === searchInput);
9557
+ return hasExactMatch ? items.filter((item) => getNormalizedString(item.title) === searchInput) : items;
9558
+ };
9540
9559
  return {
9541
9560
  isMobileSidebarVisible,
9542
9561
  searchResult,
@@ -9556,6 +9575,7 @@ const useSearchResultStore = defineStore("searchResult", () => {
9556
9575
  hasAnyFilter,
9557
9576
  itemRange,
9558
9577
  isPageEmpty,
9578
+ hideFiltersOnExactMatchForKeys,
9559
9579
  setSidebarState,
9560
9580
  queryFacet,
9561
9581
  add: add2,
@@ -9563,7 +9583,8 @@ const useSearchResultStore = defineStore("searchResult", () => {
9563
9583
  setAddToCartAmount,
9564
9584
  setLayout,
9565
9585
  setLoading,
9566
- clearSearchResult
9586
+ clearSearchResult,
9587
+ filterVisibleFilterValues
9567
9588
  };
9568
9589
  });
9569
9590
  const _hoisted_1$12 = { class: "lupa-search-box-add-to-cart-wrapper" };
@@ -11276,11 +11297,25 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
11276
11297
  const paramsStore = useParamsStore();
11277
11298
  const optionStore = useOptionsStore();
11278
11299
  const searchResultStore = useSearchResultStore();
11279
- const { filters, displayFilters, currentFilterCount } = storeToRefs(searchResultStore);
11300
+ const {
11301
+ filters,
11302
+ displayFilters,
11303
+ currentFilterCount,
11304
+ hideFiltersOnExactMatchForKeys,
11305
+ currentQueryText
11306
+ } = storeToRefs(searchResultStore);
11280
11307
  const currentFilters = computed(() => filters.value);
11308
+ const currentDisplayFilters = computed(
11309
+ () => hideFiltersOnExactMatchForKeys.value.length ? displayFilters.value.filter(
11310
+ (f2) => {
11311
+ var _a;
11312
+ return !((_a = hideFiltersOnExactMatchForKeys.value) == null ? void 0 : _a.includes(f2.key)) && getNormalizedString(currentQueryText.value) !== getNormalizedString(f2.label);
11313
+ }
11314
+ ) : displayFilters.value
11315
+ );
11281
11316
  const hasFilters = computed(() => {
11282
11317
  var _a;
11283
- return ((_a = displayFilters.value) == null ? void 0 : _a.length) > 0;
11318
+ return ((_a = currentDisplayFilters.value) == null ? void 0 : _a.length) > 0;
11284
11319
  });
11285
11320
  const handleClearAll = () => {
11286
11321
  paramsStore.removeAllFilters();
@@ -11337,7 +11372,7 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
11337
11372
  ]),
11338
11373
  !_ctx.expandable || isOpen.value ? (openBlock(), createElementBlock("div", _hoisted_3$q, [
11339
11374
  createBaseVNode("div", _hoisted_4$k, [
11340
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(displayFilters), (filter) => {
11375
+ (openBlock(true), createElementBlock(Fragment, null, renderList(currentDisplayFilters.value, (filter) => {
11341
11376
  return openBlock(), createBlock(_sfc_main$R, {
11342
11377
  key: filter.key + "_" + filter.value,
11343
11378
  filter,
@@ -11550,11 +11585,12 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
11550
11585
  emits: ["select"],
11551
11586
  setup(__props, { emit: emit2 }) {
11552
11587
  const props = __props;
11588
+ const searchResultStore = useSearchResultStore();
11553
11589
  const facet = computed(() => {
11554
11590
  var _a;
11555
11591
  return (_a = props.facet) != null ? _a : { type: "terms", items: [], key: "" };
11556
11592
  });
11557
- const currentFiltersaValue = computed(() => {
11593
+ const currentFiltersValue = computed(() => {
11558
11594
  var _a;
11559
11595
  return (_a = props.currentFilters) != null ? _a : [];
11560
11596
  });
@@ -11565,22 +11601,23 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
11565
11601
  });
11566
11602
  const allValues = computed(() => {
11567
11603
  var _a, _b;
11568
- return (_b = (_a = facet.value) == null ? void 0 : _a.items) != null ? _b : [];
11604
+ return searchResultStore.filterVisibleFilterValues(facet.value.key, (_b = (_a = facet.value) == null ? void 0 : _a.items) != null ? _b : []);
11569
11605
  });
11570
11606
  const displayValues = computed(() => {
11571
11607
  return filteredValues.value.slice(0, itemLimit.value).map((v) => __spreadProps2(__spreadValues2({}, v), { title: getDisplayValue(v.title) }));
11572
11608
  });
11573
11609
  const filteredValues = computed(() => {
11574
- return isFilterable.value ? allValues.value.filter(
11610
+ var _a, _b;
11611
+ return isFilterable.value ? (_a = allValues.value) == null ? void 0 : _a.filter(
11575
11612
  (v) => {
11576
- var _a;
11577
- return (_a = getNormalizedString(v.title)) == null ? void 0 : _a.includes(getNormalizedString(termFilter.value));
11613
+ var _a2;
11614
+ return (_a2 = getNormalizedString(v.title)) == null ? void 0 : _a2.includes(getNormalizedString(termFilter.value));
11578
11615
  }
11579
- ) : allValues.value;
11616
+ ) : (_b = allValues.value) != null ? _b : [];
11580
11617
  });
11581
11618
  const isFilterable = computed(() => {
11582
- var _a, _b;
11583
- return allValues.value.length >= ((_b = (_a = props.options.filterable) == null ? void 0 : _a.minValues) != null ? _b : MAX_FACET_VALUES);
11619
+ var _a, _b, _c;
11620
+ return ((_a = allValues.value) == null ? void 0 : _a.length) >= ((_c = (_b = props.options.filterable) == null ? void 0 : _b.minValues) != null ? _c : MAX_FACET_VALUES);
11584
11621
  });
11585
11622
  const isRange = computed(() => {
11586
11623
  return facet.value.type === "range";
@@ -11604,7 +11641,7 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
11604
11641
  };
11605
11642
  const isChecked = (item) => {
11606
11643
  var _a, _b;
11607
- let selectedItems = (_a = currentFiltersaValue.value) != null ? _a : [];
11644
+ let selectedItems = (_a = currentFiltersValue.value) != null ? _a : [];
11608
11645
  selectedItems = isRange.value && selectedItems ? [rangeFilterToString(selectedItems)] : selectedItems;
11609
11646
  return selectedItems == null ? void 0 : selectedItems.includes((_b = item.title) == null ? void 0 : _b.toString());
11610
11647
  };
@@ -6897,11 +6897,12 @@ const LupaSearchSdk = {
6897
6897
  }
6898
6898
  };
6899
6899
  const getNormalizedString = (str) => {
6900
+ var _a, _b;
6900
6901
  if (!str) {
6901
6902
  return "";
6902
6903
  }
6903
6904
  const transformedStr = typeof str === "string" ? str : str.toString();
6904
- return transformedStr.normalize === void 0 ? transformedStr.toLocaleLowerCase() : transformedStr.toLocaleLowerCase().normalize("NFKD").replace(/[^\w\s.-_/]/g, "");
6905
+ return transformedStr.normalize === void 0 ? (_a = transformedStr.toLocaleLowerCase()) == null ? void 0 : _a.trim() : (_b = transformedStr.toLocaleLowerCase().normalize("NFKD").replace(/[^\w\s.-_/]/g, "")) == null ? void 0 : _b.trim();
6905
6906
  };
6906
6907
  const capitalize$1 = (str) => {
6907
6908
  if (!str) {
@@ -7379,23 +7380,34 @@ const DEFAULT_OPTIONS_RESULTS$1 = {
7379
7380
  };
7380
7381
  const useScreenStore = defineStore("screen", () => {
7381
7382
  const screenWidth = ref(1e3);
7383
+ const optionsStore = useOptionsStore();
7384
+ const configuredGridSizes = computed(() => {
7385
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
7386
+ return {
7387
+ smMin: (_d = (_c = (_b = (_a = optionsStore.searchResultOptions) == null ? void 0 : _a.grid) == null ? void 0 : _b.sizes) == null ? void 0 : _c.sm) != null ? _d : S_MIN_WIDTH,
7388
+ mdMin: (_h = (_g = (_f = (_e = optionsStore.searchResultOptions) == null ? void 0 : _e.grid) == null ? void 0 : _f.sizes) == null ? void 0 : _g.md) != null ? _h : MD_MIN_WIDTH,
7389
+ lMin: (_l = (_k = (_j = (_i = optionsStore.searchResultOptions) == null ? void 0 : _i.grid) == null ? void 0 : _j.sizes) == null ? void 0 : _k.l) != null ? _l : L_MIN_WIDTH,
7390
+ xlMin: (_p = (_o = (_n = (_m = optionsStore.searchResultOptions) == null ? void 0 : _m.grid) == null ? void 0 : _n.sizes) == null ? void 0 : _o.xl) != null ? _p : XL_MIN_WIDTH
7391
+ };
7392
+ });
7382
7393
  const currentScreenWidth = computed(() => {
7383
7394
  const width = screenWidth.value;
7384
- if (width <= S_MIN_WIDTH) {
7395
+ if (width <= configuredGridSizes.value.smMin) {
7385
7396
  return "xs";
7386
- } else if (width > S_MIN_WIDTH && width <= MD_MIN_WIDTH) {
7397
+ } else if (width > configuredGridSizes.value.smMin && width <= configuredGridSizes.value.mdMin) {
7387
7398
  return "sm";
7388
- } else if (width > MD_MIN_WIDTH && width <= L_MIN_WIDTH) {
7399
+ } else if (width > configuredGridSizes.value.mdMin && width <= configuredGridSizes.value.lMin) {
7389
7400
  return "md";
7390
- } else if (width > L_MIN_WIDTH && width <= XL_MIN_WIDTH) {
7401
+ } else if (width > configuredGridSizes.value.lMin && width <= configuredGridSizes.value.xlMin) {
7391
7402
  return "l";
7392
7403
  } else {
7393
7404
  return "xl";
7394
7405
  }
7395
7406
  });
7396
- const isMobileWidth = computed(
7397
- () => currentScreenWidth.value === "sm" || currentScreenWidth.value === "xs"
7398
- );
7407
+ const isMobileWidth = computed(() => {
7408
+ var _a;
7409
+ return (_a = ["xs", "sm"]) == null ? void 0 : _a.includes(currentScreenWidth.value);
7410
+ });
7399
7411
  const setScreenWidth = ({ width }) => {
7400
7412
  screenWidth.value = width;
7401
7413
  };
@@ -9404,6 +9416,7 @@ const useSearchResultStore = defineStore("searchResult", () => {
9404
9416
  const isMobileSidebarVisible = ref(false);
9405
9417
  const optionsStore = useOptionsStore();
9406
9418
  const paramsStore = useParamsStore();
9419
+ const screenStore = useScreenStore();
9407
9420
  const { searchResultOptions } = storeToRefs(optionsStore);
9408
9421
  const facets = computed(() => searchResult.value.facets);
9409
9422
  const filters = computed(() => searchResult.value.filters);
@@ -9449,6 +9462,10 @@ const useSearchResultStore = defineStore("searchResult", () => {
9449
9462
  var _a;
9450
9463
  return Object.keys((_a = filters.value) != null ? _a : {}).length > 0;
9451
9464
  });
9465
+ const hideFiltersOnExactMatchForKeys = computed(() => {
9466
+ var _a, _b, _c, _d;
9467
+ return (_d = (_c = (_b = (_a = searchResultOptions.value) == null ? void 0 : _a.filters) == null ? void 0 : _b.facets) == null ? void 0 : _c.hideFiltersOnExactMatchForKeys) != null ? _d : [];
9468
+ });
9452
9469
  const itemRange = computed(() => {
9453
9470
  var _a, _b;
9454
9471
  const limit = (_a = paramsStore.limit) != null ? _a : 0;
@@ -9502,20 +9519,13 @@ const useSearchResultStore = defineStore("searchResult", () => {
9502
9519
  return { searchResult: newSearchResult };
9503
9520
  };
9504
9521
  const setColumnCount = ({ width, grid }) => {
9522
+ var _a;
9505
9523
  if (!width || !grid) {
9506
9524
  return;
9507
9525
  }
9508
- if (width <= S_MIN_WIDTH) {
9509
- columnCount.value = grid.columns.xs;
9510
- } else if (width > S_MIN_WIDTH && width <= MD_MIN_WIDTH) {
9511
- columnCount.value = grid.columns.sm;
9512
- } else if (width > MD_MIN_WIDTH && width <= L_MIN_WIDTH) {
9513
- columnCount.value = grid.columns.md;
9514
- } else if (width > L_MIN_WIDTH && width <= XL_MIN_WIDTH) {
9515
- columnCount.value = grid.columns.l;
9516
- } else {
9517
- columnCount.value = grid.columns.xl;
9518
- }
9526
+ const { currentScreenWidth } = storeToRefs(screenStore);
9527
+ const screenWidth = (_a = currentScreenWidth.value) != null ? _a : "xl";
9528
+ columnCount.value = grid.columns[screenWidth];
9519
9529
  };
9520
9530
  const setAddToCartAmount = (newAddToCartAmount) => {
9521
9531
  if (!newAddToCartAmount) {
@@ -9535,6 +9545,15 @@ const useSearchResultStore = defineStore("searchResult", () => {
9535
9545
  const clearSearchResult = () => {
9536
9546
  searchResult.value = {};
9537
9547
  };
9548
+ const filterVisibleFilterValues = (key, items = []) => {
9549
+ var _a;
9550
+ if (!((_a = hideFiltersOnExactMatchForKeys.value) == null ? void 0 : _a.length) || !hideFiltersOnExactMatchForKeys.value.includes(key) || !items.length) {
9551
+ return items;
9552
+ }
9553
+ const searchInput = getNormalizedString(currentQueryText.value);
9554
+ const hasExactMatch = items.some((item) => getNormalizedString(item.title) === searchInput);
9555
+ return hasExactMatch ? items.filter((item) => getNormalizedString(item.title) === searchInput) : items;
9556
+ };
9538
9557
  return {
9539
9558
  isMobileSidebarVisible,
9540
9559
  searchResult,
@@ -9554,6 +9573,7 @@ const useSearchResultStore = defineStore("searchResult", () => {
9554
9573
  hasAnyFilter,
9555
9574
  itemRange,
9556
9575
  isPageEmpty,
9576
+ hideFiltersOnExactMatchForKeys,
9557
9577
  setSidebarState,
9558
9578
  queryFacet,
9559
9579
  add: add2,
@@ -9561,7 +9581,8 @@ const useSearchResultStore = defineStore("searchResult", () => {
9561
9581
  setAddToCartAmount,
9562
9582
  setLayout,
9563
9583
  setLoading,
9564
- clearSearchResult
9584
+ clearSearchResult,
9585
+ filterVisibleFilterValues
9565
9586
  };
9566
9587
  });
9567
9588
  const _hoisted_1$12 = { class: "lupa-search-box-add-to-cart-wrapper" };
@@ -11274,11 +11295,25 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
11274
11295
  const paramsStore = useParamsStore();
11275
11296
  const optionStore = useOptionsStore();
11276
11297
  const searchResultStore = useSearchResultStore();
11277
- const { filters, displayFilters, currentFilterCount } = storeToRefs(searchResultStore);
11298
+ const {
11299
+ filters,
11300
+ displayFilters,
11301
+ currentFilterCount,
11302
+ hideFiltersOnExactMatchForKeys,
11303
+ currentQueryText
11304
+ } = storeToRefs(searchResultStore);
11278
11305
  const currentFilters = computed(() => filters.value);
11306
+ const currentDisplayFilters = computed(
11307
+ () => hideFiltersOnExactMatchForKeys.value.length ? displayFilters.value.filter(
11308
+ (f2) => {
11309
+ var _a;
11310
+ return !((_a = hideFiltersOnExactMatchForKeys.value) == null ? void 0 : _a.includes(f2.key)) && getNormalizedString(currentQueryText.value) !== getNormalizedString(f2.label);
11311
+ }
11312
+ ) : displayFilters.value
11313
+ );
11279
11314
  const hasFilters = computed(() => {
11280
11315
  var _a;
11281
- return ((_a = displayFilters.value) == null ? void 0 : _a.length) > 0;
11316
+ return ((_a = currentDisplayFilters.value) == null ? void 0 : _a.length) > 0;
11282
11317
  });
11283
11318
  const handleClearAll = () => {
11284
11319
  paramsStore.removeAllFilters();
@@ -11335,7 +11370,7 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
11335
11370
  ]),
11336
11371
  !_ctx.expandable || isOpen.value ? (openBlock(), createElementBlock("div", _hoisted_3$q, [
11337
11372
  createBaseVNode("div", _hoisted_4$k, [
11338
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(displayFilters), (filter) => {
11373
+ (openBlock(true), createElementBlock(Fragment, null, renderList(currentDisplayFilters.value, (filter) => {
11339
11374
  return openBlock(), createBlock(_sfc_main$R, {
11340
11375
  key: filter.key + "_" + filter.value,
11341
11376
  filter,
@@ -11548,11 +11583,12 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
11548
11583
  emits: ["select"],
11549
11584
  setup(__props, { emit: emit2 }) {
11550
11585
  const props = __props;
11586
+ const searchResultStore = useSearchResultStore();
11551
11587
  const facet = computed(() => {
11552
11588
  var _a;
11553
11589
  return (_a = props.facet) != null ? _a : { type: "terms", items: [], key: "" };
11554
11590
  });
11555
- const currentFiltersaValue = computed(() => {
11591
+ const currentFiltersValue = computed(() => {
11556
11592
  var _a;
11557
11593
  return (_a = props.currentFilters) != null ? _a : [];
11558
11594
  });
@@ -11563,22 +11599,23 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
11563
11599
  });
11564
11600
  const allValues = computed(() => {
11565
11601
  var _a, _b;
11566
- return (_b = (_a = facet.value) == null ? void 0 : _a.items) != null ? _b : [];
11602
+ return searchResultStore.filterVisibleFilterValues(facet.value.key, (_b = (_a = facet.value) == null ? void 0 : _a.items) != null ? _b : []);
11567
11603
  });
11568
11604
  const displayValues = computed(() => {
11569
11605
  return filteredValues.value.slice(0, itemLimit.value).map((v) => __spreadProps2(__spreadValues2({}, v), { title: getDisplayValue(v.title) }));
11570
11606
  });
11571
11607
  const filteredValues = computed(() => {
11572
- return isFilterable.value ? allValues.value.filter(
11608
+ var _a, _b;
11609
+ return isFilterable.value ? (_a = allValues.value) == null ? void 0 : _a.filter(
11573
11610
  (v) => {
11574
- var _a;
11575
- return (_a = getNormalizedString(v.title)) == null ? void 0 : _a.includes(getNormalizedString(termFilter.value));
11611
+ var _a2;
11612
+ return (_a2 = getNormalizedString(v.title)) == null ? void 0 : _a2.includes(getNormalizedString(termFilter.value));
11576
11613
  }
11577
- ) : allValues.value;
11614
+ ) : (_b = allValues.value) != null ? _b : [];
11578
11615
  });
11579
11616
  const isFilterable = computed(() => {
11580
- var _a, _b;
11581
- return allValues.value.length >= ((_b = (_a = props.options.filterable) == null ? void 0 : _a.minValues) != null ? _b : MAX_FACET_VALUES);
11617
+ var _a, _b, _c;
11618
+ return ((_a = allValues.value) == null ? void 0 : _a.length) >= ((_c = (_b = props.options.filterable) == null ? void 0 : _b.minValues) != null ? _c : MAX_FACET_VALUES);
11582
11619
  });
11583
11620
  const isRange = computed(() => {
11584
11621
  return facet.value.type === "range";
@@ -11602,7 +11639,7 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
11602
11639
  };
11603
11640
  const isChecked = (item) => {
11604
11641
  var _a, _b;
11605
- let selectedItems = (_a = currentFiltersaValue.value) != null ? _a : [];
11642
+ let selectedItems = (_a = currentFiltersValue.value) != null ? _a : [];
11606
11643
  selectedItems = isRange.value && selectedItems ? [rangeFilterToString(selectedItems)] : selectedItems;
11607
11644
  return selectedItems == null ? void 0 : selectedItems.includes((_b = item.title) == null ? void 0 : _b.toString());
11608
11645
  };
@@ -6901,11 +6901,12 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
6901
6901
  }
6902
6902
  };
6903
6903
  const getNormalizedString = (str) => {
6904
+ var _a, _b;
6904
6905
  if (!str) {
6905
6906
  return "";
6906
6907
  }
6907
6908
  const transformedStr = typeof str === "string" ? str : str.toString();
6908
- return transformedStr.normalize === void 0 ? transformedStr.toLocaleLowerCase() : transformedStr.toLocaleLowerCase().normalize("NFKD").replace(/[^\w\s.-_/]/g, "");
6909
+ return transformedStr.normalize === void 0 ? (_a = transformedStr.toLocaleLowerCase()) == null ? void 0 : _a.trim() : (_b = transformedStr.toLocaleLowerCase().normalize("NFKD").replace(/[^\w\s.-_/]/g, "")) == null ? void 0 : _b.trim();
6909
6910
  };
6910
6911
  const capitalize$1 = (str) => {
6911
6912
  if (!str) {
@@ -7383,23 +7384,34 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7383
7384
  };
7384
7385
  const useScreenStore = defineStore("screen", () => {
7385
7386
  const screenWidth = ref(1e3);
7387
+ const optionsStore = useOptionsStore();
7388
+ const configuredGridSizes = computed(() => {
7389
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
7390
+ return {
7391
+ smMin: (_d = (_c = (_b = (_a = optionsStore.searchResultOptions) == null ? void 0 : _a.grid) == null ? void 0 : _b.sizes) == null ? void 0 : _c.sm) != null ? _d : S_MIN_WIDTH,
7392
+ mdMin: (_h = (_g = (_f = (_e = optionsStore.searchResultOptions) == null ? void 0 : _e.grid) == null ? void 0 : _f.sizes) == null ? void 0 : _g.md) != null ? _h : MD_MIN_WIDTH,
7393
+ lMin: (_l = (_k = (_j = (_i = optionsStore.searchResultOptions) == null ? void 0 : _i.grid) == null ? void 0 : _j.sizes) == null ? void 0 : _k.l) != null ? _l : L_MIN_WIDTH,
7394
+ xlMin: (_p = (_o = (_n = (_m = optionsStore.searchResultOptions) == null ? void 0 : _m.grid) == null ? void 0 : _n.sizes) == null ? void 0 : _o.xl) != null ? _p : XL_MIN_WIDTH
7395
+ };
7396
+ });
7386
7397
  const currentScreenWidth = computed(() => {
7387
7398
  const width = screenWidth.value;
7388
- if (width <= S_MIN_WIDTH) {
7399
+ if (width <= configuredGridSizes.value.smMin) {
7389
7400
  return "xs";
7390
- } else if (width > S_MIN_WIDTH && width <= MD_MIN_WIDTH) {
7401
+ } else if (width > configuredGridSizes.value.smMin && width <= configuredGridSizes.value.mdMin) {
7391
7402
  return "sm";
7392
- } else if (width > MD_MIN_WIDTH && width <= L_MIN_WIDTH) {
7403
+ } else if (width > configuredGridSizes.value.mdMin && width <= configuredGridSizes.value.lMin) {
7393
7404
  return "md";
7394
- } else if (width > L_MIN_WIDTH && width <= XL_MIN_WIDTH) {
7405
+ } else if (width > configuredGridSizes.value.lMin && width <= configuredGridSizes.value.xlMin) {
7395
7406
  return "l";
7396
7407
  } else {
7397
7408
  return "xl";
7398
7409
  }
7399
7410
  });
7400
- const isMobileWidth = computed(
7401
- () => currentScreenWidth.value === "sm" || currentScreenWidth.value === "xs"
7402
- );
7411
+ const isMobileWidth = computed(() => {
7412
+ var _a;
7413
+ return (_a = ["xs", "sm"]) == null ? void 0 : _a.includes(currentScreenWidth.value);
7414
+ });
7403
7415
  const setScreenWidth = ({ width }) => {
7404
7416
  screenWidth.value = width;
7405
7417
  };
@@ -9408,6 +9420,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
9408
9420
  const isMobileSidebarVisible = ref(false);
9409
9421
  const optionsStore = useOptionsStore();
9410
9422
  const paramsStore = useParamsStore();
9423
+ const screenStore = useScreenStore();
9411
9424
  const { searchResultOptions } = storeToRefs(optionsStore);
9412
9425
  const facets = computed(() => searchResult.value.facets);
9413
9426
  const filters = computed(() => searchResult.value.filters);
@@ -9453,6 +9466,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
9453
9466
  var _a;
9454
9467
  return Object.keys((_a = filters.value) != null ? _a : {}).length > 0;
9455
9468
  });
9469
+ const hideFiltersOnExactMatchForKeys = computed(() => {
9470
+ var _a, _b, _c, _d;
9471
+ return (_d = (_c = (_b = (_a = searchResultOptions.value) == null ? void 0 : _a.filters) == null ? void 0 : _b.facets) == null ? void 0 : _c.hideFiltersOnExactMatchForKeys) != null ? _d : [];
9472
+ });
9456
9473
  const itemRange = computed(() => {
9457
9474
  var _a, _b;
9458
9475
  const limit = (_a = paramsStore.limit) != null ? _a : 0;
@@ -9506,20 +9523,13 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
9506
9523
  return { searchResult: newSearchResult };
9507
9524
  };
9508
9525
  const setColumnCount = ({ width, grid }) => {
9526
+ var _a;
9509
9527
  if (!width || !grid) {
9510
9528
  return;
9511
9529
  }
9512
- if (width <= S_MIN_WIDTH) {
9513
- columnCount.value = grid.columns.xs;
9514
- } else if (width > S_MIN_WIDTH && width <= MD_MIN_WIDTH) {
9515
- columnCount.value = grid.columns.sm;
9516
- } else if (width > MD_MIN_WIDTH && width <= L_MIN_WIDTH) {
9517
- columnCount.value = grid.columns.md;
9518
- } else if (width > L_MIN_WIDTH && width <= XL_MIN_WIDTH) {
9519
- columnCount.value = grid.columns.l;
9520
- } else {
9521
- columnCount.value = grid.columns.xl;
9522
- }
9530
+ const { currentScreenWidth } = storeToRefs(screenStore);
9531
+ const screenWidth = (_a = currentScreenWidth.value) != null ? _a : "xl";
9532
+ columnCount.value = grid.columns[screenWidth];
9523
9533
  };
9524
9534
  const setAddToCartAmount = (newAddToCartAmount) => {
9525
9535
  if (!newAddToCartAmount) {
@@ -9539,6 +9549,15 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
9539
9549
  const clearSearchResult = () => {
9540
9550
  searchResult.value = {};
9541
9551
  };
9552
+ const filterVisibleFilterValues = (key, items = []) => {
9553
+ var _a;
9554
+ if (!((_a = hideFiltersOnExactMatchForKeys.value) == null ? void 0 : _a.length) || !hideFiltersOnExactMatchForKeys.value.includes(key) || !items.length) {
9555
+ return items;
9556
+ }
9557
+ const searchInput = getNormalizedString(currentQueryText.value);
9558
+ const hasExactMatch = items.some((item) => getNormalizedString(item.title) === searchInput);
9559
+ return hasExactMatch ? items.filter((item) => getNormalizedString(item.title) === searchInput) : items;
9560
+ };
9542
9561
  return {
9543
9562
  isMobileSidebarVisible,
9544
9563
  searchResult,
@@ -9558,6 +9577,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
9558
9577
  hasAnyFilter,
9559
9578
  itemRange,
9560
9579
  isPageEmpty,
9580
+ hideFiltersOnExactMatchForKeys,
9561
9581
  setSidebarState,
9562
9582
  queryFacet,
9563
9583
  add: add2,
@@ -9565,7 +9585,8 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
9565
9585
  setAddToCartAmount,
9566
9586
  setLayout,
9567
9587
  setLoading,
9568
- clearSearchResult
9588
+ clearSearchResult,
9589
+ filterVisibleFilterValues
9569
9590
  };
9570
9591
  });
9571
9592
  const _hoisted_1$12 = { class: "lupa-search-box-add-to-cart-wrapper" };
@@ -11278,11 +11299,25 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
11278
11299
  const paramsStore = useParamsStore();
11279
11300
  const optionStore = useOptionsStore();
11280
11301
  const searchResultStore = useSearchResultStore();
11281
- const { filters, displayFilters, currentFilterCount } = storeToRefs(searchResultStore);
11302
+ const {
11303
+ filters,
11304
+ displayFilters,
11305
+ currentFilterCount,
11306
+ hideFiltersOnExactMatchForKeys,
11307
+ currentQueryText
11308
+ } = storeToRefs(searchResultStore);
11282
11309
  const currentFilters = computed(() => filters.value);
11310
+ const currentDisplayFilters = computed(
11311
+ () => hideFiltersOnExactMatchForKeys.value.length ? displayFilters.value.filter(
11312
+ (f2) => {
11313
+ var _a;
11314
+ return !((_a = hideFiltersOnExactMatchForKeys.value) == null ? void 0 : _a.includes(f2.key)) && getNormalizedString(currentQueryText.value) !== getNormalizedString(f2.label);
11315
+ }
11316
+ ) : displayFilters.value
11317
+ );
11283
11318
  const hasFilters = computed(() => {
11284
11319
  var _a;
11285
- return ((_a = displayFilters.value) == null ? void 0 : _a.length) > 0;
11320
+ return ((_a = currentDisplayFilters.value) == null ? void 0 : _a.length) > 0;
11286
11321
  });
11287
11322
  const handleClearAll = () => {
11288
11323
  paramsStore.removeAllFilters();
@@ -11339,7 +11374,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
11339
11374
  ]),
11340
11375
  !_ctx.expandable || isOpen.value ? (openBlock(), createElementBlock("div", _hoisted_3$q, [
11341
11376
  createBaseVNode("div", _hoisted_4$k, [
11342
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(displayFilters), (filter) => {
11377
+ (openBlock(true), createElementBlock(Fragment, null, renderList(currentDisplayFilters.value, (filter) => {
11343
11378
  return openBlock(), createBlock(_sfc_main$R, {
11344
11379
  key: filter.key + "_" + filter.value,
11345
11380
  filter,
@@ -11552,11 +11587,12 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
11552
11587
  emits: ["select"],
11553
11588
  setup(__props, { emit: emit2 }) {
11554
11589
  const props = __props;
11590
+ const searchResultStore = useSearchResultStore();
11555
11591
  const facet = computed(() => {
11556
11592
  var _a;
11557
11593
  return (_a = props.facet) != null ? _a : { type: "terms", items: [], key: "" };
11558
11594
  });
11559
- const currentFiltersaValue = computed(() => {
11595
+ const currentFiltersValue = computed(() => {
11560
11596
  var _a;
11561
11597
  return (_a = props.currentFilters) != null ? _a : [];
11562
11598
  });
@@ -11567,22 +11603,23 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
11567
11603
  });
11568
11604
  const allValues = computed(() => {
11569
11605
  var _a, _b;
11570
- return (_b = (_a = facet.value) == null ? void 0 : _a.items) != null ? _b : [];
11606
+ return searchResultStore.filterVisibleFilterValues(facet.value.key, (_b = (_a = facet.value) == null ? void 0 : _a.items) != null ? _b : []);
11571
11607
  });
11572
11608
  const displayValues = computed(() => {
11573
11609
  return filteredValues.value.slice(0, itemLimit.value).map((v) => __spreadProps2(__spreadValues2({}, v), { title: getDisplayValue(v.title) }));
11574
11610
  });
11575
11611
  const filteredValues = computed(() => {
11576
- return isFilterable.value ? allValues.value.filter(
11612
+ var _a, _b;
11613
+ return isFilterable.value ? (_a = allValues.value) == null ? void 0 : _a.filter(
11577
11614
  (v) => {
11578
- var _a;
11579
- return (_a = getNormalizedString(v.title)) == null ? void 0 : _a.includes(getNormalizedString(termFilter.value));
11615
+ var _a2;
11616
+ return (_a2 = getNormalizedString(v.title)) == null ? void 0 : _a2.includes(getNormalizedString(termFilter.value));
11580
11617
  }
11581
- ) : allValues.value;
11618
+ ) : (_b = allValues.value) != null ? _b : [];
11582
11619
  });
11583
11620
  const isFilterable = computed(() => {
11584
- var _a, _b;
11585
- return allValues.value.length >= ((_b = (_a = props.options.filterable) == null ? void 0 : _a.minValues) != null ? _b : MAX_FACET_VALUES);
11621
+ var _a, _b, _c;
11622
+ return ((_a = allValues.value) == null ? void 0 : _a.length) >= ((_c = (_b = props.options.filterable) == null ? void 0 : _b.minValues) != null ? _c : MAX_FACET_VALUES);
11586
11623
  });
11587
11624
  const isRange = computed(() => {
11588
11625
  return facet.value.type === "range";
@@ -11606,7 +11643,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
11606
11643
  };
11607
11644
  const isChecked = (item) => {
11608
11645
  var _a, _b;
11609
- let selectedItems = (_a = currentFiltersaValue.value) != null ? _a : [];
11646
+ let selectedItems = (_a = currentFiltersValue.value) != null ? _a : [];
11610
11647
  selectedItems = isRange.value && selectedItems ? [rangeFilterToString(selectedItems)] : selectedItems;
11611
11648
  return selectedItems == null ? void 0 : selectedItems.includes((_b = item.title) == null ? void 0 : _b.toString());
11612
11649
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getlupa/client",
3
- "version": "1.11.8",
3
+ "version": "1.12.0",
4
4
  "main": "dist/lupaSearch.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/src/index.d.ts",
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "devDependencies": {
22
22
  "@getlupa/client-sdk": "^1.3.4",
23
- "@getlupa/vue": "0.11.8",
23
+ "@getlupa/vue": "0.12.0",
24
24
  "@rushstack/eslint-patch": "^1.3.2",
25
25
  "@tsconfig/node18": "^2.0.1",
26
26
  "@types/jsdom": "^21.1.1",