@getlupa/client 1.15.7 → 1.15.9

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.
@@ -7287,7 +7287,7 @@ var __async = (__this, __arguments, generator) => {
7287
7287
  details: "/{id}"
7288
7288
  },
7289
7289
  elements: [],
7290
- breadcrumbs: [{ label: "Main Page", link: "/" }, { label: "Search: {1}" }]
7290
+ breadcrumbs: []
7291
7291
  };
7292
7292
  const useScreenStore = defineStore("screen", () => {
7293
7293
  const measuredScreenWidth = ref(1e3);
@@ -8126,12 +8126,15 @@ var __async = (__this, __arguments, generator) => {
8126
8126
  value
8127
8127
  };
8128
8128
  };
8129
- const toggleTermFilter = (appendParams, facetAction, getQueryParamName, currentFilters) => {
8129
+ const toggleTermFilter = (appendParams, facetAction, getQueryParamName, currentFilters, paramsToRemove = []) => {
8130
8130
  const currentFilter = currentFilters == null ? void 0 : currentFilters[facetAction.key];
8131
8131
  const newParams = toggleTermParam(currentFilter, facetAction.value);
8132
8132
  appendParams({
8133
8133
  params: [getFacetParam(facetAction.key, newParams)],
8134
- paramsToRemove: [getQueryParamName ? getQueryParamName(QUERY_PARAMS$1.PAGE) : QUERY_PARAMS$1.PAGE]
8134
+ paramsToRemove: [
8135
+ ...paramsToRemove,
8136
+ ...[getQueryParamName ? getQueryParamName(QUERY_PARAMS$1.PAGE) : QUERY_PARAMS$1.PAGE]
8137
+ ]
8135
8138
  });
8136
8139
  };
8137
8140
  const replaceHierarchyParam = (params = [], param = "") => {
@@ -8817,7 +8820,7 @@ var __async = (__this, __arguments, generator) => {
8817
8820
  __name: "SearchBoxMoreResults",
8818
8821
  props: {
8819
8822
  labels: {},
8820
- showTotalCount: { type: Boolean }
8823
+ options: {}
8821
8824
  },
8822
8825
  emits: ["go-to-results"],
8823
8826
  setup(__props, { emit: emit2 }) {
@@ -8825,23 +8828,28 @@ var __async = (__this, __arguments, generator) => {
8825
8828
  const searchBoxStore = useSearchBoxStore();
8826
8829
  const { docResults, options } = storeToRefs(searchBoxStore);
8827
8830
  const totalCount = computed(() => {
8828
- var _a, _b, _c;
8829
- if (!props.showTotalCount) {
8831
+ var _a, _b, _c, _d;
8832
+ if (!((_a = props.options) == null ? void 0 : _a.showTotalCount)) {
8830
8833
  return "";
8831
8834
  }
8832
- const queryKey = (_b = (_a = options.value) == null ? void 0 : _a.panels.find((x2) => x2.type === "document")) == null ? void 0 : _b.queryKey;
8833
- const total = queryKey ? (_c = docResults.value[queryKey]) == null ? void 0 : _c.total : "";
8835
+ const queryKey = (_c = (_b = options.value) == null ? void 0 : _b.panels.find((x2) => x2.type === "document")) == null ? void 0 : _c.queryKey;
8836
+ const total = queryKey ? (_d = docResults.value[queryKey]) == null ? void 0 : _d.total : "";
8834
8837
  return total ? `(${total})` : "";
8835
8838
  });
8839
+ const showMoreResultsButton = computed(() => {
8840
+ var _a;
8841
+ return (_a = props.options.showMoreResultsButton) != null ? _a : true;
8842
+ });
8836
8843
  const handleClick = () => {
8837
8844
  emit2("go-to-results");
8838
8845
  };
8839
8846
  return (_ctx, _cache) => {
8840
- return openBlock(), createElementBlock("a", {
8847
+ return showMoreResultsButton.value ? (openBlock(), createElementBlock("a", {
8848
+ key: 0,
8841
8849
  class: "lupa-more-results",
8842
8850
  "data-cy": "lupa-more-results",
8843
8851
  onClick: handleClick
8844
- }, toDisplayString(_ctx.labels.moreResults) + " " + toDisplayString(totalCount.value), 1);
8852
+ }, toDisplayString(_ctx.labels.moreResults) + " " + toDisplayString(totalCount.value), 1)) : createCommentVNode("", true);
8845
8853
  };
8846
8854
  }
8847
8855
  });
@@ -20047,7 +20055,6 @@ and ensure you are accounting for this risk.
20047
20055
  return resultCountFromRelatedPanel < 1;
20048
20056
  };
20049
20057
  return (_ctx, _cache) => {
20050
- var _a;
20051
20058
  return openBlock(), createElementBlock("div", {
20052
20059
  ref_key: "panelContainer",
20053
20060
  ref: panelContainer
@@ -20064,7 +20071,7 @@ and ensure you are accounting for this risk.
20064
20071
  "data-cy": "lupa-main-panel"
20065
20072
  }, [
20066
20073
  (openBlock(true), createElementBlock(Fragment, null, renderList(displayPanels.value, (panel, index) => {
20067
- var _a2, _b, _c, _d;
20074
+ var _a, _b, _c, _d;
20068
20075
  return openBlock(), createElementBlock("div", {
20069
20076
  key: index,
20070
20077
  class: normalizeClass([
@@ -20074,7 +20081,7 @@ and ensure you are accounting for this risk.
20074
20081
  style: normalizeStyle(panel.gridArea ? { gridArea: `${panel.gridArea}${index}` } : {}),
20075
20082
  "data-cy": "lupa-panel-" + panel.type + "-index"
20076
20083
  }, [
20077
- ((_a2 = panel.labels) == null ? void 0 : _a2.topResultsTitle) && showTopResultsPanelTitle(panel.queryKey) ? (openBlock(), createElementBlock("div", _hoisted_3$y, toDisplayString((_b = panel.labels) == null ? void 0 : _b.topResultsTitle), 1)) : createCommentVNode("", true),
20084
+ ((_a = panel.labels) == null ? void 0 : _a.topResultsTitle) && showTopResultsPanelTitle(panel.queryKey) ? (openBlock(), createElementBlock("div", _hoisted_3$y, toDisplayString((_b = panel.labels) == null ? void 0 : _b.topResultsTitle), 1)) : createCommentVNode("", true),
20078
20085
  ((_c = panel.labels) == null ? void 0 : _c.title) && showPanelTitle(panel) ? (openBlock(), createElementBlock("div", _hoisted_4$p, toDisplayString((_d = panel.labels) == null ? void 0 : _d.title), 1)) : createCommentVNode("", true),
20079
20086
  panel.queryKey && canShowPanel(panel) ? (openBlock(), createBlock(resolveDynamicComponent(getComponent(panel.type)), {
20080
20087
  key: 2,
@@ -20107,9 +20114,9 @@ and ensure you are accounting for this risk.
20107
20114
  unref(hasAnyResults) || !_ctx.options.hideMoreResultsButtonOnNoResults ? (openBlock(), createBlock(_sfc_main$1s, {
20108
20115
  key: 2,
20109
20116
  labels: labels.value,
20110
- showTotalCount: (_a = _ctx.options.showTotalCount) != null ? _a : false,
20117
+ options: _ctx.options,
20111
20118
  onGoToResults: _cache[4] || (_cache[4] = ($event) => _ctx.$emit("go-to-results"))
20112
- }, null, 8, ["labels", "showTotalCount"])) : createCommentVNode("", true)
20119
+ }, null, 8, ["labels", "options"])) : createCommentVNode("", true)
20113
20120
  ])) : displayHistory.value ? (openBlock(), createElementBlock("div", _hoisted_5$g, [
20114
20121
  createVNode(_sfc_main$1q, {
20115
20122
  options: _ctx.options.history,
@@ -20188,7 +20195,8 @@ and ensure you are accounting for this risk.
20188
20195
  "showTotalCount",
20189
20196
  "hideMoreResultsButtonOnNoResults",
20190
20197
  "showNoResultsPanel",
20191
- "expandOnSinglePanel"
20198
+ "expandOnSinglePanel",
20199
+ "showMoreResultsButton"
20192
20200
  ])
20193
20201
  );
20194
20202
  const searchTriggers = computed(() => {
@@ -20661,11 +20669,15 @@ and ensure you are accounting for this risk.
20661
20669
  var _a, _b;
20662
20670
  return (_b = (_a = props.options.labels) == null ? void 0 : _a.searchResultsCount) != null ? _b : "";
20663
20671
  });
20672
+ const searchResultsTitleTemplate = computed(() => {
20673
+ var _a, _b, _c, _d, _e;
20674
+ return ((_c = (_b = (_a = props.options) == null ? void 0 : _a.labels) == null ? void 0 : _b.searchResults) == null ? void 0 : _c.includes("{")) ? addParamsToLabel((_e = (_d = props.options) == null ? void 0 : _d.labels) == null ? void 0 : _e.searchResults, queryText.value) : ``;
20675
+ });
20664
20676
  return (_ctx, _cache) => {
20665
20677
  return openBlock(), createElementBlock("div", null, [
20666
20678
  showSearchTitle.value ? (openBlock(), createElementBlock("h1", _hoisted_1$S, [
20667
- createTextVNode(toDisplayString(_ctx.options.labels.searchResults), 1),
20668
- queryText.value ? (openBlock(), createElementBlock("span", _hoisted_2$F, "'" + toDisplayString(queryText.value) + "'", 1)) : createCommentVNode("", true),
20679
+ createTextVNode(toDisplayString(searchResultsTitleTemplate.value || _ctx.options.labels.searchResults), 1),
20680
+ queryText.value && !searchResultsTitleTemplate.value ? (openBlock(), createElementBlock("span", _hoisted_2$F, "'" + toDisplayString(queryText.value) + "'", 1)) : createCommentVNode("", true),
20669
20681
  showProductCount.value ? (openBlock(), createElementBlock("span", _hoisted_3$w, [
20670
20682
  createTextVNode("(" + toDisplayString(searchResultsCountLabel.value), 1),
20671
20683
  createBaseVNode("span", _hoisted_4$n, toDisplayString(unref(totalItems)), 1),
@@ -24673,26 +24685,104 @@ and ensure you are accounting for this risk.
24673
24685
  RelatedQuerySourceType2["FACETS"] = "facets";
24674
24686
  return RelatedQuerySourceType2;
24675
24687
  })(RelatedQuerySourceType || {});
24676
- const extractFacetsRelatedSource = (source, searchResults2) => {
24688
+ const combineIdenticalValues = (results) => {
24689
+ const result2 = [];
24690
+ const keys = /* @__PURE__ */ new Set();
24691
+ for (const item of results) {
24692
+ const trimmedValue = item.value.trim().toLowerCase();
24693
+ if (!keys.has(trimmedValue)) {
24694
+ keys.add(trimmedValue);
24695
+ result2.push({ key: item.key, value: item.value.trim() });
24696
+ }
24697
+ }
24698
+ return result2;
24699
+ };
24700
+ const processFacetsRelatedSourceSuggestionQuery = (searchText, querySource, options, activeFilters) => __async2(void 0, null, function* () {
24701
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
24702
+ if ((_a = Object.keys(activeFilters != null ? activeFilters : {})) == null ? void 0 : _a.length) {
24703
+ return [];
24704
+ }
24705
+ const lupaQuery = {
24706
+ searchText,
24707
+ limit: 1,
24708
+ trackTerm: false
24709
+ };
24710
+ try {
24711
+ const result2 = yield LupaSearchSdk.suggestions(querySource.queryKey, lupaQuery, options);
24712
+ if (!result2.success || ((_c = (_b = result2.items) == null ? void 0 : _b[0].suggestion) == null ? void 0 : _c.toLocaleLowerCase()) !== (searchText == null ? void 0 : searchText.toLocaleLowerCase())) {
24713
+ return [];
24714
+ }
24715
+ return (_i = (_h = (_f = (_e = (_d = result2.items) == null ? void 0 : _d[0].facets) == null ? void 0 : _e[querySource.facetKey]) == null ? void 0 : _f.map((item) => ({
24716
+ key: querySource.facetKey,
24717
+ value: item.title
24718
+ }))) == null ? void 0 : _h.slice(0, (_g = querySource.maxCount) != null ? _g : 5)) != null ? _i : [];
24719
+ } catch (error) {
24720
+ return [];
24721
+ }
24722
+ });
24723
+ const processFacetsRelatedSourceDocumentQuery = (searchText, querySource, options, activeFilters) => __async2(void 0, null, function* () {
24724
+ const lupaQuery = {
24725
+ searchText,
24726
+ limit: 1,
24727
+ filters: activeFilters,
24728
+ trackTerm: false
24729
+ };
24730
+ try {
24731
+ const result2 = yield LupaSearchSdk.query(querySource.queryKey, lupaQuery, options);
24732
+ if (!result2.success) {
24733
+ return [];
24734
+ }
24735
+ return extractFacetsRelatedSourceFromOriginalQuery(
24736
+ {
24737
+ type: RelatedQuerySourceType.FACETS,
24738
+ key: querySource.facetKey,
24739
+ count: querySource.maxCount
24740
+ },
24741
+ result2
24742
+ );
24743
+ } catch (error) {
24744
+ return [];
24745
+ }
24746
+ });
24747
+ const processFacetsRelatedSourceQuery = (searchText, query, options, activeFilters) => __async2(void 0, null, function* () {
24748
+ switch (query.type) {
24749
+ case "document":
24750
+ return processFacetsRelatedSourceDocumentQuery(searchText, query, options, activeFilters);
24751
+ case "suggestion":
24752
+ return processFacetsRelatedSourceSuggestionQuery(searchText, query, options, activeFilters);
24753
+ }
24754
+ });
24755
+ const extractFacetsRelatedSource = (source, searchResults2, options, activeFilters) => __async2(void 0, null, function* () {
24756
+ var _a, _b;
24757
+ if (!((_a = source.queries) == null ? void 0 : _a.length)) {
24758
+ return extractFacetsRelatedSourceFromOriginalQuery(source, searchResults2);
24759
+ }
24760
+ const promises = source.queries.map(
24761
+ (query) => processFacetsRelatedSourceQuery(searchResults2.searchText, query, options, activeFilters)
24762
+ );
24763
+ const result2 = (yield Promise.all(promises)).flat();
24764
+ return (_b = combineIdenticalValues(result2)) == null ? void 0 : _b.slice(0, source.count);
24765
+ });
24766
+ const extractFacetsRelatedSourceFromOriginalQuery = (source, searchResults2) => __async2(void 0, null, function* () {
24677
24767
  var _a, _b, _c, _d, _e;
24678
24768
  const facet = (_a = searchResults2.facets) == null ? void 0 : _a.find((facet2) => facet2.key === source.key);
24679
24769
  if (!facet) {
24680
24770
  return [];
24681
24771
  }
24682
24772
  if (facet.type === "terms") {
24683
- return (_c = (_b = facet.items) == null ? void 0 : _b.slice(0, source.count)) == null ? void 0 : _c.map((item) => item.title);
24773
+ return (_c = (_b = facet.items) == null ? void 0 : _b.slice(0, source.count)) == null ? void 0 : _c.map((item) => ({ key: source.key, value: item.title }));
24684
24774
  }
24685
24775
  if (facet.type === "hierarchy") {
24686
- return (_e = (_d = facet.items) == null ? void 0 : _d.slice(0, source.count)) == null ? void 0 : _e.map((item) => item.title);
24776
+ return (_e = (_d = facet.items) == null ? void 0 : _d.slice(0, source.count)) == null ? void 0 : _e.map((item) => ({ key: source.key, value: item.title }));
24687
24777
  }
24688
24778
  return [];
24689
- };
24690
- const extractRelatedSource = (source, searchResults2) => {
24779
+ });
24780
+ const extractRelatedSource = (source, searchResults2, options, activeFilters) => __async2(void 0, null, function* () {
24691
24781
  switch (source.type) {
24692
24782
  case RelatedQuerySourceType.FACETS:
24693
- return extractFacetsRelatedSource(source, searchResults2);
24783
+ return extractFacetsRelatedSource(source, searchResults2, options, activeFilters);
24694
24784
  }
24695
- };
24785
+ });
24696
24786
  const _hoisted_1$h = { class: "lupa-related-query-item" };
24697
24787
  const _hoisted_2$e = { class: "lupa-related-query-image" };
24698
24788
  const _hoisted_3$a = { class: "lupa-related-query-label" };
@@ -24705,12 +24795,16 @@ and ensure you are accounting for this risk.
24705
24795
  __name: "RelatedQueryPanel",
24706
24796
  props: {
24707
24797
  query: {},
24708
- options: {}
24798
+ sourceKey: {},
24799
+ options: {},
24800
+ existingItemsFromOtherQueries: {}
24709
24801
  },
24710
- setup(__props) {
24802
+ emits: ["loaded"],
24803
+ setup(__props, { emit: emit2 }) {
24711
24804
  const props = __props;
24712
24805
  const loading = ref(false);
24713
24806
  const relatedQueryResult = ref(null);
24807
+ const itemToDisplay = ref(null);
24714
24808
  const optionsStore = useOptionsStore();
24715
24809
  const searchResultStore = useSearchResultStore();
24716
24810
  const { searchResultOptions } = storeToRefs(optionsStore);
@@ -24731,10 +24825,6 @@ and ensure you are accounting for this risk.
24731
24825
  var _a, _b;
24732
24826
  return ((_b = (_a = relatedQueryResult.value) == null ? void 0 : _a.items) == null ? void 0 : _b.length) > 0;
24733
24827
  });
24734
- const firstResultItem = computed(() => {
24735
- var _a, _b;
24736
- return (_b = (_a = relatedQueryResult.value) == null ? void 0 : _a.items) == null ? void 0 : _b[0];
24737
- });
24738
24828
  const totalItemCount = computed(() => {
24739
24829
  var _a, _b;
24740
24830
  return (_b = (_a = relatedQueryResult.value) == null ? void 0 : _a.total) != null ? _b : 0;
@@ -24744,19 +24834,19 @@ and ensure you are accounting for this risk.
24744
24834
  return ((_a = props.options.source) == null ? void 0 : _a.mode) === "filter" ? (_b = searchResult.value) == null ? void 0 : _b.searchText : (_c = props.query) == null ? void 0 : _c.toLowerCase();
24745
24835
  });
24746
24836
  const relatedQueryFilters = computed(() => {
24747
- var _a, _b, _c;
24837
+ var _a;
24748
24838
  return ((_a = props.options.source) == null ? void 0 : _a.mode) === "filter" ? {
24749
- [(_c = (_b = props.options) == null ? void 0 : _b.source) == null ? void 0 : _c.key]: [props.query]
24839
+ [props.sourceKey]: [props.query]
24750
24840
  } : {};
24751
24841
  });
24752
24842
  const searchForRelatedQuery = () => __async2(this, null, function* () {
24753
- var _a, _b, _c;
24843
+ var _a, _b, _c, _d, _e, _f, _g, _h;
24754
24844
  if (!props.query) {
24755
24845
  return;
24756
24846
  }
24757
24847
  const lupaQuery = {
24758
24848
  searchText: searchText.value,
24759
- limit: 1,
24849
+ limit: 3,
24760
24850
  filters: relatedQueryFilters.value,
24761
24851
  trackTerm: false
24762
24852
  };
@@ -24770,8 +24860,13 @@ and ensure you are accounting for this risk.
24770
24860
  if (result2.success) {
24771
24861
  relatedQueryResult.value = result2;
24772
24862
  }
24863
+ const firstItem = (_c = (_b = relatedQueryResult.value) == null ? void 0 : _b.items) == null ? void 0 : _c[0];
24864
+ itemToDisplay.value = (_f = (_e = (_d = relatedQueryResult == null ? void 0 : relatedQueryResult.value) == null ? void 0 : _d.items) == null ? void 0 : _e.find(
24865
+ (i) => !props.existingItemsFromOtherQueries[`${i.id}`]
24866
+ )) != null ? _f : firstItem;
24867
+ emit2("loaded", itemToDisplay.value);
24773
24868
  } catch (error) {
24774
- (_c = (_b = searchResultOptions.value) == null ? void 0 : _b.options) == null ? void 0 : _c.onError(error);
24869
+ (_h = (_g = searchResultOptions.value) == null ? void 0 : _g.options) == null ? void 0 : _h.onError(error);
24775
24870
  } finally {
24776
24871
  loading.value = false;
24777
24872
  }
@@ -24789,11 +24884,11 @@ and ensure you are accounting for this risk.
24789
24884
  var _a;
24790
24885
  return openBlock(), createElementBlock("div", _hoisted_1$h, [
24791
24886
  createBaseVNode("div", _hoisted_2$e, [
24792
- firstResultItem.value && image.value ? (openBlock(), createBlock(_sfc_main$1l, {
24887
+ itemToDisplay.value && image.value ? (openBlock(), createBlock(_sfc_main$1l, {
24793
24888
  key: 0,
24794
24889
  "wrapper-class": "lupa-related-query-image-wrapper",
24795
24890
  "image-class": "lupa-related-query-image",
24796
- item: firstResultItem.value,
24891
+ item: itemToDisplay.value,
24797
24892
  options: image.value
24798
24893
  }, null, 8, ["item", "options"])) : createCommentVNode("", true)
24799
24894
  ]),
@@ -24825,47 +24920,63 @@ and ensure you are accounting for this risk.
24825
24920
  const paramsStore = useParamsStore();
24826
24921
  const optionsStore = useOptionsStore();
24827
24922
  const { searchResult } = storeToRefs(searchResultStore);
24923
+ const { searchResultOptions } = storeToRefs(optionsStore);
24924
+ const relatedQueries = ref([]);
24925
+ const allDisplayItems = ref({});
24926
+ const querySourceResultMap = ref({});
24828
24927
  const currentSearchText = computed(() => {
24829
24928
  var _a, _b;
24830
24929
  return (_b = (_a = searchResult.value) == null ? void 0 : _a.searchText) != null ? _b : "";
24831
24930
  });
24832
- const relatedQueries = computed(() => {
24833
- if (!props.options || !searchResult.value) {
24834
- return [];
24931
+ const currentFilters = computed(() => paramsStore.filters);
24932
+ const querySources = computed(() => {
24933
+ var _a, _b, _c, _d;
24934
+ return (_d = (_c = (_b = (_a = props.options) == null ? void 0 : _a.source) == null ? void 0 : _b.queries) == null ? void 0 : _c.map((q) => q.facetKey)) != null ? _d : [];
24935
+ });
24936
+ const currentFiltersWithoutQuerySources = computed(() => {
24937
+ const filters = {};
24938
+ if (currentFilters.value) {
24939
+ for (const key in currentFilters.value) {
24940
+ if (!querySources.value.includes(key)) {
24941
+ filters[key] = currentFilters.value[key];
24942
+ }
24943
+ }
24835
24944
  }
24836
- const queries = extractRelatedSource(props.options.source, searchResult.value);
24837
- return queries;
24945
+ return filters;
24838
24946
  });
24947
+ watch(searchResult, () => __async2(this, null, function* () {
24948
+ allDisplayItems.value = {};
24949
+ querySourceResultMap.value = {};
24950
+ if (!props.options || !searchResult.value) {
24951
+ relatedQueries.value = [];
24952
+ }
24953
+ const queries = yield extractRelatedSource(
24954
+ props.options.source,
24955
+ searchResult.value,
24956
+ searchResultOptions.value.options,
24957
+ currentFiltersWithoutQuerySources.value
24958
+ );
24959
+ relatedQueries.value = queries;
24960
+ }));
24839
24961
  const hasEnoughRelatedQueries = computed(() => {
24840
24962
  return relatedQueries.value.length > 1;
24841
24963
  });
24842
- const goToResults = ({ searchText }) => {
24843
- paramsStore.goToResults({ searchText });
24844
- };
24845
24964
  const handleRelatedQueryClick = (query) => {
24846
24965
  var _a;
24847
24966
  if (((_a = props.options.source) == null ? void 0 : _a.mode) === "filter") {
24848
24967
  handleFilter(query);
24849
24968
  } else {
24850
- goToResults({ searchText: query });
24969
+ paramsStore.goToResults({ searchText: query.value });
24851
24970
  }
24852
24971
  };
24853
24972
  const handleFilter = (query) => {
24854
- var _a, _b;
24855
- const facet = (_b = (_a = searchResult.value) == null ? void 0 : _a.facets) == null ? void 0 : _b.find(
24856
- (facet2) => {
24857
- var _a2, _b2;
24858
- return facet2.key === ((_b2 = (_a2 = props.options) == null ? void 0 : _a2.source) == null ? void 0 : _b2.key);
24859
- }
24860
- );
24861
- if (!facet || facet.type !== "terms") {
24862
- return [];
24863
- }
24973
+ var _a;
24864
24974
  toggleTermFilter(
24865
24975
  paramsStore.appendParams,
24866
- { type: "terms", key: facet.key, value: query },
24976
+ { type: "terms", key: query.key, value: query.value },
24867
24977
  optionsStore.getQueryParamName,
24868
- {}
24978
+ {},
24979
+ (_a = querySources.value) == null ? void 0 : _a.map((q) => `f.${q}`)
24869
24980
  );
24870
24981
  };
24871
24982
  const getSelectedFilterClass = (query) => {
@@ -24873,9 +24984,13 @@ and ensure you are accounting for this risk.
24873
24984
  if (((_a = props.options.source) == null ? void 0 : _a.mode) !== "filter") {
24874
24985
  return "";
24875
24986
  }
24876
- return Array.isArray((_c = (_b = searchResult.value) == null ? void 0 : _b.filters) == null ? void 0 : _c[props.options.source.key]) && ((_f = (_e = (_d = searchResult.value) == null ? void 0 : _d.filters) == null ? void 0 : _e[props.options.source.key]) == null ? void 0 : _f.includes(
24877
- query
24878
- )) ? "lupa-selected-related-query-filter" : "";
24987
+ return Array.isArray((_c = (_b = searchResult.value) == null ? void 0 : _b.filters) == null ? void 0 : _c[query.key]) && ((_f = (_e = (_d = searchResult.value) == null ? void 0 : _d.filters) == null ? void 0 : _e[query.key]) == null ? void 0 : _f.includes(query.value)) ? "lupa-selected-related-query-filter" : "";
24988
+ };
24989
+ const processLoadedItem = (query, item) => {
24990
+ if (item) {
24991
+ allDisplayItems.value[`${item.id}`] = item;
24992
+ }
24993
+ querySourceResultMap.value[query.value] = Boolean(item);
24879
24994
  };
24880
24995
  return (_ctx, _cache) => {
24881
24996
  var _a, _b, _c, _d;
@@ -24883,19 +24998,24 @@ and ensure you are accounting for this risk.
24883
24998
  ((_b = (_a = _ctx.options) == null ? void 0 : _a.labels) == null ? void 0 : _b.title) ? (openBlock(), createElementBlock("h3", _hoisted_2$d, toDisplayString((_d = (_c = _ctx.options) == null ? void 0 : _c.labels) == null ? void 0 : _d.title), 1)) : createCommentVNode("", true),
24884
24999
  createBaseVNode("ul", null, [
24885
25000
  (openBlock(true), createElementBlock(Fragment, null, renderList(relatedQueries.value, (query) => {
24886
- return openBlock(), createElementBlock("li", {
24887
- key: query + currentSearchText.value,
25001
+ return withDirectives((openBlock(), createElementBlock("li", {
25002
+ key: query.value + query.key + currentSearchText.value,
24888
25003
  class: normalizeClass(getSelectedFilterClass(query))
24889
25004
  }, [
24890
25005
  createBaseVNode("a", {
24891
25006
  onClick: ($event) => handleRelatedQueryClick(query)
24892
25007
  }, [
24893
25008
  createVNode(_sfc_main$j, {
25009
+ "source-key": query.key,
24894
25010
  options: _ctx.options,
24895
- query
24896
- }, null, 8, ["options", "query"])
25011
+ query: query.value,
25012
+ "existing-items-from-other-queries": allDisplayItems.value,
25013
+ onLoaded: (item) => processLoadedItem(query, item)
25014
+ }, null, 8, ["source-key", "options", "query", "existing-items-from-other-queries", "onLoaded"])
24897
25015
  ], 8, _hoisted_3$9)
24898
- ], 2);
25016
+ ], 2)), [
25017
+ [vShow, querySourceResultMap.value[query.value] !== false]
25018
+ ]);
24899
25019
  }), 128))
24900
25020
  ])
24901
25021
  ])) : createCommentVNode("", true);