@getlupa/client 1.8.8 → 1.9.1

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.
@@ -6544,7 +6544,8 @@ const trackLupaEvent = (queryKey, data = {}, options) => {
6544
6544
  itemId: (_b = data.itemId) != null ? _b : "",
6545
6545
  name: data.type,
6546
6546
  userId: getUserKey(),
6547
- sessionId: getSessionKey()
6547
+ sessionId: getSessionKey(),
6548
+ filters: data.filters
6548
6549
  };
6549
6550
  LupaSearchSdk.track(queryKey, eventData, options);
6550
6551
  };
@@ -6648,9 +6649,6 @@ const track = (queryKey, data = {}, options) => {
6648
6649
  return;
6649
6650
  }
6650
6651
  trackAnalyticsEvent(data);
6651
- if (!hasSearchQuery) {
6652
- return;
6653
- }
6654
6652
  trackLupaEvent(queryKey, data, options);
6655
6653
  };
6656
6654
  const DEFAULT_SEARCH_BOX_OPTIONS$1 = {
@@ -6927,6 +6925,7 @@ var DocumentElementType = /* @__PURE__ */ ((DocumentElementType2) => {
6927
6925
  var SearchBoxPanelType = /* @__PURE__ */ ((SearchBoxPanelType2) => {
6928
6926
  SearchBoxPanelType2["SUGGESTION"] = "suggestion";
6929
6927
  SearchBoxPanelType2["DOCUMENT"] = "document";
6928
+ SearchBoxPanelType2["RELATED_SOURCE"] = "related-source";
6930
6929
  return SearchBoxPanelType2;
6931
6930
  })(SearchBoxPanelType || {});
6932
6931
  var BadgeType = /* @__PURE__ */ ((BadgeType2) => {
@@ -7843,12 +7842,12 @@ const _hoisted_1$1c = { id: "lupa-search-box-input-container" };
7843
7842
  const _hoisted_2$P = { class: "lupa-input-clear" };
7844
7843
  const _hoisted_3$A = { id: "lupa-search-box-input" };
7845
7844
  const _hoisted_4$s = ["value"];
7846
- const _hoisted_5$g = ["aria-label", "placeholder"];
7845
+ const _hoisted_5$h = ["aria-label", "placeholder"];
7847
7846
  const _hoisted_6$9 = {
7848
7847
  key: 0,
7849
7848
  class: "lupa-close-label"
7850
7849
  };
7851
- const _sfc_main$1k = /* @__PURE__ */ defineComponent({
7850
+ const _sfc_main$1l = /* @__PURE__ */ defineComponent({
7852
7851
  __name: "SearchBoxInput",
7853
7852
  props: {
7854
7853
  options: {},
@@ -7956,7 +7955,7 @@ const _sfc_main$1k = /* @__PURE__ */ defineComponent({
7956
7955
  placeholder: labels.value.placeholder,
7957
7956
  onInput: handleInput,
7958
7957
  onFocus: handleFocus
7959
- }), null, 16, _hoisted_5$g), [
7958
+ }), null, 16, _hoisted_5$h), [
7960
7959
  [vModelText, inputValue.value]
7961
7960
  ])
7962
7961
  ]),
@@ -7971,7 +7970,7 @@ const _sfc_main$1k = /* @__PURE__ */ defineComponent({
7971
7970
  };
7972
7971
  }
7973
7972
  });
7974
- const _sfc_main$1j = /* @__PURE__ */ defineComponent({
7973
+ const _sfc_main$1k = /* @__PURE__ */ defineComponent({
7975
7974
  __name: "SearchBoxMoreResults",
7976
7975
  props: {
7977
7976
  labels: {},
@@ -8005,7 +8004,7 @@ const _sfc_main$1j = /* @__PURE__ */ defineComponent({
8005
8004
  });
8006
8005
  const _hoisted_1$1b = { class: "lupa-search-box-history-item" };
8007
8006
  const _hoisted_2$O = { class: "lupa-search-box-history-item-content" };
8008
- const _sfc_main$1i = /* @__PURE__ */ defineComponent({
8007
+ const _sfc_main$1j = /* @__PURE__ */ defineComponent({
8009
8008
  __name: "SearchBoxHistoryItem",
8010
8009
  props: {
8011
8010
  item: {},
@@ -8040,7 +8039,7 @@ const _hoisted_1$1a = {
8040
8039
  key: 0,
8041
8040
  class: "lupa-search-box-history-panel"
8042
8041
  };
8043
- const _sfc_main$1h = /* @__PURE__ */ defineComponent({
8042
+ const _sfc_main$1i = /* @__PURE__ */ defineComponent({
8044
8043
  __name: "SearchBoxHistoryPanel",
8045
8044
  props: {
8046
8045
  options: {}
@@ -8083,7 +8082,7 @@ const _sfc_main$1h = /* @__PURE__ */ defineComponent({
8083
8082
  return (_ctx, _cache) => {
8084
8083
  return hasHistory.value ? (openBlock(), createElementBlock("div", _hoisted_1$1a, [
8085
8084
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(history), (item, index) => {
8086
- return openBlock(), createBlock(_sfc_main$1i, {
8085
+ return openBlock(), createBlock(_sfc_main$1j, {
8087
8086
  key: item,
8088
8087
  item,
8089
8088
  highlighted: index === highlightIndex.value,
@@ -8100,7 +8099,7 @@ const _sfc_main$1h = /* @__PURE__ */ defineComponent({
8100
8099
  }
8101
8100
  });
8102
8101
  const _hoisted_1$19 = { class: "lupa-search-box-no-results" };
8103
- const _sfc_main$1g = /* @__PURE__ */ defineComponent({
8102
+ const _sfc_main$1h = /* @__PURE__ */ defineComponent({
8104
8103
  __name: "SearchBoxNoResults",
8105
8104
  props: {
8106
8105
  labels: {}
@@ -8126,11 +8125,11 @@ const _hoisted_4$r = {
8126
8125
  class: "lupa-suggestion-facet-label",
8127
8126
  "data-cy": "lupa-suggestion-facet-label"
8128
8127
  };
8129
- const _hoisted_5$f = {
8128
+ const _hoisted_5$g = {
8130
8129
  class: "lupa-suggestion-facet-value",
8131
8130
  "data-cy": "lupa-suggestion-facet-value"
8132
8131
  };
8133
- const _sfc_main$1f = /* @__PURE__ */ defineComponent({
8132
+ const _sfc_main$1g = /* @__PURE__ */ defineComponent({
8134
8133
  __name: "SearchBoxSuggestion",
8135
8134
  props: {
8136
8135
  suggestion: {},
@@ -8169,7 +8168,7 @@ const _sfc_main$1f = /* @__PURE__ */ defineComponent({
8169
8168
  }, null, 8, _hoisted_1$18)) : (openBlock(), createElementBlock("div", _hoisted_2$N, toDisplayString(_ctx.suggestion.display), 1)),
8170
8169
  _ctx.suggestion.facet ? (openBlock(), createElementBlock("div", _hoisted_3$z, [
8171
8170
  createBaseVNode("span", _hoisted_4$r, toDisplayString(facetLabel.value), 1),
8172
- createBaseVNode("span", _hoisted_5$f, toDisplayString(_ctx.suggestion.facet.title), 1)
8171
+ createBaseVNode("span", _hoisted_5$g, toDisplayString(_ctx.suggestion.facet.title), 1)
8173
8172
  ])) : createCommentVNode("", true)
8174
8173
  ]);
8175
8174
  };
@@ -8179,7 +8178,7 @@ const _hoisted_1$17 = {
8179
8178
  id: "lupa-search-box-suggestions",
8180
8179
  "data-cy": "lupa-search-box-suggestions"
8181
8180
  };
8182
- const _sfc_main$1e = /* @__PURE__ */ defineComponent({
8181
+ const _sfc_main$1f = /* @__PURE__ */ defineComponent({
8183
8182
  __name: "SearchBoxSuggestions",
8184
8183
  props: {
8185
8184
  items: {},
@@ -8241,7 +8240,7 @@ const _sfc_main$1e = /* @__PURE__ */ defineComponent({
8241
8240
  return (_ctx, _cache) => {
8242
8241
  return openBlock(), createElementBlock("div", _hoisted_1$17, [
8243
8242
  (openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (item, index) => {
8244
- return openBlock(), createBlock(_sfc_main$1f, {
8243
+ return openBlock(), createBlock(_sfc_main$1g, {
8245
8244
  key: getSuggestionKey(item),
8246
8245
  class: normalizeClass(["lupa-suggestion", index === highlightedIndex.value ? "lupa-suggestion-highlighted" : ""]),
8247
8246
  suggestion: item,
@@ -8269,7 +8268,7 @@ const debounce$1 = (func, timeout) => {
8269
8268
  }, timeout);
8270
8269
  };
8271
8270
  };
8272
- const _sfc_main$1d = /* @__PURE__ */ defineComponent({
8271
+ const _sfc_main$1e = /* @__PURE__ */ defineComponent({
8273
8272
  __name: "SearchBoxSuggestionsWrapper",
8274
8273
  props: {
8275
8274
  panel: {},
@@ -8310,7 +8309,7 @@ const _sfc_main$1d = /* @__PURE__ */ defineComponent({
8310
8309
  };
8311
8310
  const getSuggestionsDebounced = debounce$1(getSuggestions, props.debounce);
8312
8311
  return (_ctx, _cache) => {
8313
- return openBlock(), createBlock(_sfc_main$1e, {
8312
+ return openBlock(), createBlock(_sfc_main$1f, {
8314
8313
  items: searchResult.value,
8315
8314
  highlight: _ctx.panel.highlight,
8316
8315
  queryKey: _ctx.panel.queryKey,
@@ -8396,7 +8395,7 @@ const joinUrlParts = (...parts) => {
8396
8395
  return (_c = (_b = (_a = parts == null ? void 0 : parts.map((part) => part.replace(/(^\/+|\/+$)/g, ""))) == null ? void 0 : _a.filter((part) => part !== "")) == null ? void 0 : _b.join("/")) != null ? _c : "";
8397
8396
  };
8398
8397
  const _hoisted_1$16 = ["src"];
8399
- const _sfc_main$1c = /* @__PURE__ */ defineComponent({
8398
+ const _sfc_main$1d = /* @__PURE__ */ defineComponent({
8400
8399
  __name: "ProductImage",
8401
8400
  props: {
8402
8401
  item: {},
@@ -8454,7 +8453,7 @@ const _sfc_main$1c = /* @__PURE__ */ defineComponent({
8454
8453
  };
8455
8454
  }
8456
8455
  });
8457
- const _sfc_main$1b = /* @__PURE__ */ defineComponent({
8456
+ const _sfc_main$1c = /* @__PURE__ */ defineComponent({
8458
8457
  __name: "SearchBoxProductImage",
8459
8458
  props: {
8460
8459
  item: {},
@@ -8462,7 +8461,7 @@ const _sfc_main$1b = /* @__PURE__ */ defineComponent({
8462
8461
  },
8463
8462
  setup(__props) {
8464
8463
  return (_ctx, _cache) => {
8465
- return openBlock(), createBlock(_sfc_main$1c, {
8464
+ return openBlock(), createBlock(_sfc_main$1d, {
8466
8465
  item: _ctx.item,
8467
8466
  options: _ctx.options,
8468
8467
  "wrapper-class": "lupa-search-box-image-wrapper",
@@ -8476,7 +8475,7 @@ const _hoisted_2$M = {
8476
8475
  key: 1,
8477
8476
  class: "lupa-search-box-product-title"
8478
8477
  };
8479
- const _sfc_main$1a = /* @__PURE__ */ defineComponent({
8478
+ const _sfc_main$1b = /* @__PURE__ */ defineComponent({
8480
8479
  __name: "SearchBoxProductTitle",
8481
8480
  props: {
8482
8481
  item: {},
@@ -8507,7 +8506,7 @@ const _hoisted_2$L = {
8507
8506
  key: 1,
8508
8507
  class: "lupa-search-box-product-description"
8509
8508
  };
8510
- const _sfc_main$19 = /* @__PURE__ */ defineComponent({
8509
+ const _sfc_main$1a = /* @__PURE__ */ defineComponent({
8511
8510
  __name: "SearchBoxProductDescription",
8512
8511
  props: {
8513
8512
  item: {},
@@ -8532,7 +8531,7 @@ const _sfc_main$19 = /* @__PURE__ */ defineComponent({
8532
8531
  }
8533
8532
  });
8534
8533
  const _hoisted_1$13 = { class: "lupa-search-box-product-price" };
8535
- const _sfc_main$18 = /* @__PURE__ */ defineComponent({
8534
+ const _sfc_main$19 = /* @__PURE__ */ defineComponent({
8536
8535
  __name: "SearchBoxProductPrice",
8537
8536
  props: {
8538
8537
  item: {},
@@ -8557,7 +8556,7 @@ const _sfc_main$18 = /* @__PURE__ */ defineComponent({
8557
8556
  }
8558
8557
  });
8559
8558
  const _hoisted_1$12 = { class: "lupa-search-box-product-regular-price" };
8560
- const _sfc_main$17 = /* @__PURE__ */ defineComponent({
8559
+ const _sfc_main$18 = /* @__PURE__ */ defineComponent({
8561
8560
  __name: "SearchBoxProductRegularPrice",
8562
8561
  props: {
8563
8562
  item: {},
@@ -8583,8 +8582,8 @@ const _hoisted_1$11 = ["innerHTML"];
8583
8582
  const _hoisted_2$K = { key: 0 };
8584
8583
  const _hoisted_3$y = { key: 1 };
8585
8584
  const _hoisted_4$q = { class: "lupa-search-box-custom-label" };
8586
- const _hoisted_5$e = { class: "lupa-search-box-custom-text" };
8587
- const _sfc_main$16 = /* @__PURE__ */ defineComponent({
8585
+ const _hoisted_5$f = { class: "lupa-search-box-custom-text" };
8586
+ const _sfc_main$17 = /* @__PURE__ */ defineComponent({
8588
8587
  __name: "SearchBoxProductCustom",
8589
8588
  props: {
8590
8589
  item: {},
@@ -8616,14 +8615,14 @@ const _sfc_main$16 = /* @__PURE__ */ defineComponent({
8616
8615
  }, toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), [
8617
8616
  !label.value ? (openBlock(), createElementBlock("div", _hoisted_2$K, toDisplayString(text.value), 1)) : (openBlock(), createElementBlock("div", _hoisted_3$y, [
8618
8617
  createBaseVNode("div", _hoisted_4$q, toDisplayString(label.value), 1),
8619
- createBaseVNode("div", _hoisted_5$e, toDisplayString(text.value), 1)
8618
+ createBaseVNode("div", _hoisted_5$f, toDisplayString(text.value), 1)
8620
8619
  ]))
8621
8620
  ], 16));
8622
8621
  };
8623
8622
  }
8624
8623
  });
8625
8624
  const _hoisted_1$10 = ["innerHTML"];
8626
- const _sfc_main$15 = /* @__PURE__ */ defineComponent({
8625
+ const _sfc_main$16 = /* @__PURE__ */ defineComponent({
8627
8626
  __name: "SearchBoxProductCustomHtml",
8628
8627
  props: {
8629
8628
  item: {},
@@ -8840,7 +8839,7 @@ const useSearchResultStore = defineStore("searchResult", () => {
8840
8839
  const _hoisted_1$$ = { class: "lupa-search-box-add-to-cart-wrapper" };
8841
8840
  const _hoisted_2$J = { class: "lupa-search-box-product-addtocart" };
8842
8841
  const _hoisted_3$x = ["onClick", "disabled"];
8843
- const _sfc_main$14 = /* @__PURE__ */ defineComponent({
8842
+ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
8844
8843
  __name: "SearchBoxProductAddToCart",
8845
8844
  props: {
8846
8845
  item: {},
@@ -8883,17 +8882,17 @@ const _sfc_main$14 = /* @__PURE__ */ defineComponent({
8883
8882
  });
8884
8883
  const __default__$4 = {
8885
8884
  components: {
8886
- SearchBoxProductImage: _sfc_main$1b,
8887
- SearchBoxProductTitle: _sfc_main$1a,
8888
- SearchBoxProductDescription: _sfc_main$19,
8889
- SearchBoxProductPrice: _sfc_main$18,
8890
- SearchBoxProductRegularPrice: _sfc_main$17,
8891
- SearchBoxProductCustom: _sfc_main$16,
8892
- SearchBoxProductCustomHtml: _sfc_main$15,
8893
- SearchBoxProductAddToCart: _sfc_main$14
8885
+ SearchBoxProductImage: _sfc_main$1c,
8886
+ SearchBoxProductTitle: _sfc_main$1b,
8887
+ SearchBoxProductDescription: _sfc_main$1a,
8888
+ SearchBoxProductPrice: _sfc_main$19,
8889
+ SearchBoxProductRegularPrice: _sfc_main$18,
8890
+ SearchBoxProductCustom: _sfc_main$17,
8891
+ SearchBoxProductCustomHtml: _sfc_main$16,
8892
+ SearchBoxProductAddToCart: _sfc_main$15
8894
8893
  }
8895
8894
  };
8896
- const _sfc_main$13 = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValues2({}, __default__$4), {
8895
+ const _sfc_main$14 = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValues2({}, __default__$4), {
8897
8896
  __name: "SearchBoxProductElement",
8898
8897
  props: {
8899
8898
  item: {},
@@ -8959,7 +8958,7 @@ const _hoisted_4$p = {
8959
8958
  key: 0,
8960
8959
  class: "lupa-search-box-product-add-to-cart-section"
8961
8960
  };
8962
- const _sfc_main$12 = /* @__PURE__ */ defineComponent({
8961
+ const _sfc_main$13 = /* @__PURE__ */ defineComponent({
8963
8962
  __name: "SearchBoxProduct",
8964
8963
  props: {
8965
8964
  item: {},
@@ -9017,7 +9016,7 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
9017
9016
  }), [
9018
9017
  createBaseVNode("div", _hoisted_2$I, [
9019
9018
  (openBlock(true), createElementBlock(Fragment, null, renderList(imageElements.value, (element) => {
9020
- return openBlock(), createBlock(_sfc_main$13, {
9019
+ return openBlock(), createBlock(_sfc_main$14, {
9021
9020
  class: "lupa-search-box-product-element",
9022
9021
  item: _ctx.item,
9023
9022
  element,
@@ -9029,7 +9028,7 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
9029
9028
  ]),
9030
9029
  createBaseVNode("div", _hoisted_3$w, [
9031
9030
  (openBlock(true), createElementBlock(Fragment, null, renderList(detailElements.value, (element) => {
9032
- return openBlock(), createBlock(_sfc_main$13, {
9031
+ return openBlock(), createBlock(_sfc_main$14, {
9033
9032
  class: "lupa-search-box-product-element",
9034
9033
  item: _ctx.item,
9035
9034
  element,
@@ -9040,7 +9039,7 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
9040
9039
  }), 128))
9041
9040
  ]),
9042
9041
  addToCartElement.value ? (openBlock(), createElementBlock("div", _hoisted_4$p, [
9043
- createVNode(_sfc_main$13, {
9042
+ createVNode(_sfc_main$14, {
9044
9043
  class: "lupa-search-box-product-element",
9045
9044
  item: _ctx.item,
9046
9045
  element: addToCartElement.value,
@@ -9064,6 +9063,7 @@ const getSearchTrackingData = (searchText, type) => {
9064
9063
  };
9065
9064
  const useTrackingStore = defineStore("tracking", () => {
9066
9065
  const optionsStore = useOptionsStore();
9066
+ const searchResultStore = useSearchResultStore();
9067
9067
  const trackSearch = ({
9068
9068
  queryKey,
9069
9069
  query,
@@ -9101,7 +9101,8 @@ const useTrackingStore = defineStore("tracking", () => {
9101
9101
  track(
9102
9102
  queryKey,
9103
9103
  __spreadProps2(__spreadValues2({}, data), {
9104
- analytics: data.analytics ? __spreadProps2(__spreadValues2({}, data.analytics), { items: mappedItems }) : void 0
9104
+ analytics: data.analytics ? __spreadProps2(__spreadValues2({}, data.analytics), { items: mappedItems }) : void 0,
9105
+ filters: searchResultStore.hasAnyFilter ? searchResultStore.filters : void 0
9105
9106
  }),
9106
9107
  options
9107
9108
  );
@@ -9109,7 +9110,7 @@ const useTrackingStore = defineStore("tracking", () => {
9109
9110
  return { trackSearch, trackResults, trackEvent };
9110
9111
  });
9111
9112
  const _hoisted_1$Z = { id: "lupa-search-box-products" };
9112
- const _sfc_main$11 = /* @__PURE__ */ defineComponent({
9113
+ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
9113
9114
  __name: "SearchBoxProducts",
9114
9115
  props: {
9115
9116
  items: {},
@@ -9182,7 +9183,7 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
9182
9183
  itemClicked: handleProductClick
9183
9184
  });
9184
9185
  }), 128)) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(_ctx.items, (item, index) => {
9185
- return openBlock(), createBlock(_sfc_main$12, {
9186
+ return openBlock(), createBlock(_sfc_main$13, {
9186
9187
  key: index,
9187
9188
  item,
9188
9189
  panelOptions: _ctx.panelOptions,
@@ -9196,7 +9197,7 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
9196
9197
  };
9197
9198
  }
9198
9199
  });
9199
- const _sfc_main$10 = /* @__PURE__ */ defineComponent({
9200
+ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
9200
9201
  __name: "SearchBoxProductsWrapper",
9201
9202
  props: {
9202
9203
  panel: {},
@@ -9248,7 +9249,7 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
9248
9249
  const getItemsDebounced = debounce$1(getItems, props.debounce);
9249
9250
  return (_ctx, _cache) => {
9250
9251
  var _a, _b;
9251
- return openBlock(), createBlock(_sfc_main$11, {
9252
+ return openBlock(), createBlock(_sfc_main$12, {
9252
9253
  items: (_b = (_a = searchResult.value) == null ? void 0 : _a.items) != null ? _b : [],
9253
9254
  panelOptions: _ctx.panel,
9254
9255
  labels: _ctx.labels,
@@ -9266,6 +9267,96 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
9266
9267
  };
9267
9268
  }
9268
9269
  });
9270
+ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
9271
+ __name: "SearchBoxRelatedSourceWrapper",
9272
+ props: {
9273
+ panel: {},
9274
+ inputValue: {},
9275
+ options: {},
9276
+ labels: {},
9277
+ debounce: {}
9278
+ },
9279
+ emits: ["fetched"],
9280
+ setup(__props, { emit: emit2 }) {
9281
+ const props = __props;
9282
+ const searchBoxStore = useSearchBoxStore();
9283
+ const mounted = ref(false);
9284
+ const { docResults } = storeToRefs(searchBoxStore);
9285
+ const searchResult = ref(null);
9286
+ const options = computed(() => props.options);
9287
+ const relatedSourceIds = computed(() => {
9288
+ var _a, _b, _c;
9289
+ const queryKey = (_a = props.panel.sourceIds) == null ? void 0 : _a.queryKey;
9290
+ if (!queryKey) {
9291
+ return [];
9292
+ }
9293
+ const currentDocumentItems = (_c = (_b = docResults == null ? void 0 : docResults.value[queryKey]) == null ? void 0 : _b.items) != null ? _c : [];
9294
+ const allFieldValues = currentDocumentItems.map((item) => item[props.panel.sourceIds.field]).flat();
9295
+ const uniqueFieldValues = Array.from(new Set(allFieldValues));
9296
+ return uniqueFieldValues;
9297
+ });
9298
+ const relatedSourceIdsString = computed(() => relatedSourceIds.value.join(","));
9299
+ onMounted(() => {
9300
+ getItemsDebounced();
9301
+ mounted.value = true;
9302
+ });
9303
+ watch(relatedSourceIdsString, () => {
9304
+ if (mounted) {
9305
+ getItemsDebounced();
9306
+ }
9307
+ });
9308
+ const fetchRelatedItems = () => __async(this, null, function* () {
9309
+ var _a, _b;
9310
+ if (!((_a = props.panel.target) == null ? void 0 : _a.queryKey) || !relatedSourceIds.value.length) {
9311
+ return { items: [], success: true, searchText: "", total: 0 };
9312
+ }
9313
+ try {
9314
+ const result = yield LupaSearchSdk.queryByIds(
9315
+ (_b = props.panel.target) == null ? void 0 : _b.queryKey,
9316
+ relatedSourceIds.value,
9317
+ options.value
9318
+ );
9319
+ if (!result.success) {
9320
+ return { items: [], success: true, searchText: "", total: 0 };
9321
+ }
9322
+ return result;
9323
+ } catch (err) {
9324
+ console.error(err);
9325
+ if (options == null ? void 0 : options.value.onError) {
9326
+ options.value.onError(err);
9327
+ }
9328
+ return { items: [], success: true, searchText: "", total: 0 };
9329
+ }
9330
+ });
9331
+ const getItems = () => __async(this, null, function* () {
9332
+ searchResult.value = yield fetchRelatedItems();
9333
+ });
9334
+ const getItemsDebounced = debounce$1(getItems, props.debounce);
9335
+ const documentPanelOptions = computed(() => {
9336
+ return __spreadProps2(__spreadValues2({}, props.panel), {
9337
+ type: SearchBoxPanelType.DOCUMENT
9338
+ });
9339
+ });
9340
+ return (_ctx, _cache) => {
9341
+ var _a, _b;
9342
+ return openBlock(), createBlock(_sfc_main$12, {
9343
+ items: (_b = (_a = searchResult.value) == null ? void 0 : _a.items) != null ? _b : [],
9344
+ panelOptions: documentPanelOptions.value,
9345
+ labels: _ctx.labels,
9346
+ inputValue: _ctx.inputValue,
9347
+ onProductClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("product-click"))
9348
+ }, createSlots({ _: 2 }, [
9349
+ _ctx.$slots.productCard ? {
9350
+ name: "productCard",
9351
+ fn: withCtx((props2) => [
9352
+ renderSlot(_ctx.$slots, "productCard", normalizeProps(guardReactiveProps(props2)))
9353
+ ]),
9354
+ key: "0"
9355
+ } : void 0
9356
+ ]), 1032, ["items", "panelOptions", "labels", "inputValue"]);
9357
+ };
9358
+ }
9359
+ });
9269
9360
  const _hoisted_1$Y = {
9270
9361
  key: 0,
9271
9362
  id: "lupa-search-box-panel"
@@ -9273,16 +9364,21 @@ const _hoisted_1$Y = {
9273
9364
  const _hoisted_2$H = ["data-cy"];
9274
9365
  const _hoisted_3$v = {
9275
9366
  key: 0,
9276
- class: "lupa-panel-title"
9367
+ class: "lupa-panel-title lupa-panel-title-top-results"
9277
9368
  };
9278
9369
  const _hoisted_4$o = {
9370
+ key: 1,
9371
+ class: "lupa-panel-title"
9372
+ };
9373
+ const _hoisted_5$e = {
9279
9374
  key: 1,
9280
9375
  id: "lupa-search-box-panel"
9281
9376
  };
9282
9377
  const __default__$3 = {
9283
9378
  components: {
9284
- SearchBoxSuggestionsWrapper: _sfc_main$1d,
9285
- SearchBoxProductsWrapper: _sfc_main$10
9379
+ SearchBoxSuggestionsWrapper: _sfc_main$1e,
9380
+ SearchBoxProductsWrapper: _sfc_main$11,
9381
+ SearchBoxRelatedSourceWrapper: _sfc_main$10
9286
9382
  }
9287
9383
  };
9288
9384
  const _sfc_main$$ = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValues2({}, __default__$3), {
@@ -9376,6 +9472,8 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
9376
9472
  switch (type) {
9377
9473
  case "suggestion":
9378
9474
  return "SearchBoxSuggestionsWrapper";
9475
+ case "related-source":
9476
+ return "SearchBoxRelatedSourceWrapper";
9379
9477
  default:
9380
9478
  return "SearchBoxProductsWrapper";
9381
9479
  }
@@ -9401,6 +9499,21 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
9401
9499
  const panel = panelItemCounts.value.find((v) => v.queryKey === queryKey);
9402
9500
  return (panel == null ? void 0 : panel.count) > 0 && (panel == null ? void 0 : panel.input.length) < 1;
9403
9501
  };
9502
+ const showPanelTitle = (queryKey) => {
9503
+ const panel = panelItemCounts.value.find((v) => v.queryKey === queryKey);
9504
+ return (panel == null ? void 0 : panel.count) > 0;
9505
+ };
9506
+ const canShowPanel = (panel) => {
9507
+ var _a, _b, _c;
9508
+ if (!((_a = panel.visibility) == null ? void 0 : _a.showWhenKeyHasNoResults)) {
9509
+ return true;
9510
+ }
9511
+ const resultCountFromRelatedPanel = (_c = (_b = panelItemCounts.value.find((v) => {
9512
+ var _a2;
9513
+ return v.queryKey === ((_a2 = panel.visibility) == null ? void 0 : _a2.showWhenKeyHasNoResults);
9514
+ })) == null ? void 0 : _b.count) != null ? _c : 0;
9515
+ return resultCountFromRelatedPanel < 1;
9516
+ };
9404
9517
  return (_ctx, _cache) => {
9405
9518
  var _a;
9406
9519
  return openBlock(), createElementBlock("div", {
@@ -9414,7 +9527,7 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
9414
9527
  "data-cy": "lupa-main-panel"
9415
9528
  }, [
9416
9529
  (openBlock(true), createElementBlock(Fragment, null, renderList(displayPanels.value, (panel, index) => {
9417
- var _a2, _b;
9530
+ var _a2, _b, _c, _d;
9418
9531
  return openBlock(), createElementBlock("div", {
9419
9532
  key: index,
9420
9533
  class: normalizeClass([
@@ -9424,8 +9537,9 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
9424
9537
  "data-cy": "lupa-panel-" + panel.type + "-index"
9425
9538
  }, [
9426
9539
  ((_a2 = panel.labels) == null ? void 0 : _a2.topResultsTitle) && showTopResultsPanelTitle(panel.queryKey) ? (openBlock(), createElementBlock("div", _hoisted_3$v, toDisplayString((_b = panel.labels) == null ? void 0 : _b.topResultsTitle), 1)) : createCommentVNode("", true),
9427
- panel.queryKey ? (openBlock(), createBlock(resolveDynamicComponent(getComponent(panel.type)), {
9428
- key: 1,
9540
+ ((_c = panel.labels) == null ? void 0 : _c.title) && showPanelTitle(panel.queryKey) ? (openBlock(), createElementBlock("div", _hoisted_4$o, toDisplayString((_d = panel.labels) == null ? void 0 : _d.title), 1)) : createCommentVNode("", true),
9541
+ panel.queryKey && canShowPanel(panel) ? (openBlock(), createBlock(resolveDynamicComponent(getComponent(panel.type)), {
9542
+ key: 2,
9429
9543
  panel,
9430
9544
  options: sdkOptions.value,
9431
9545
  debounce: _ctx.options.debounce,
@@ -9446,18 +9560,18 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
9446
9560
  ], 10, _hoisted_2$H);
9447
9561
  }), 128))
9448
9562
  ], 4),
9449
- !unref(hasAnyResults) && _ctx.options.showNoResultsPanel ? (openBlock(), createBlock(_sfc_main$1g, {
9563
+ !unref(hasAnyResults) && _ctx.options.showNoResultsPanel ? (openBlock(), createBlock(_sfc_main$1h, {
9450
9564
  key: 0,
9451
9565
  labels: labels.value
9452
9566
  }, null, 8, ["labels"])) : createCommentVNode("", true),
9453
- unref(hasAnyResults) || !_ctx.options.hideMoreResultsButtonOnNoResults ? (openBlock(), createBlock(_sfc_main$1j, {
9567
+ unref(hasAnyResults) || !_ctx.options.hideMoreResultsButtonOnNoResults ? (openBlock(), createBlock(_sfc_main$1k, {
9454
9568
  key: 1,
9455
9569
  labels: labels.value,
9456
9570
  showTotalCount: (_a = _ctx.options.showTotalCount) != null ? _a : false,
9457
9571
  onGoToResults: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("go-to-results"))
9458
9572
  }, null, 8, ["labels", "showTotalCount"])) : createCommentVNode("", true)
9459
- ])) : displayHistory.value ? (openBlock(), createElementBlock("div", _hoisted_4$o, [
9460
- createVNode(_sfc_main$1h, {
9573
+ ])) : displayHistory.value ? (openBlock(), createElementBlock("div", _hoisted_5$e, [
9574
+ createVNode(_sfc_main$1i, {
9461
9575
  options: _ctx.options.history,
9462
9576
  history: history.value,
9463
9577
  onGoToResults: handleGoToResults,
@@ -9727,7 +9841,7 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent({
9727
9841
  var _a2;
9728
9842
  return openBlock(), createElementBlock("div", _hoisted_1$X, [
9729
9843
  createBaseVNode("div", _hoisted_2$G, [
9730
- createVNode(_sfc_main$1k, {
9844
+ createVNode(_sfc_main$1l, {
9731
9845
  options: inputOptions.value,
9732
9846
  suggestedValue: suggestedValue.value,
9733
9847
  "can-close": (_a2 = _ctx.isSearchContainer) != null ? _a2 : false,
@@ -13022,7 +13136,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
13022
13136
  },
13023
13137
  setup(__props) {
13024
13138
  return (_ctx, _cache) => {
13025
- return openBlock(), createBlock(_sfc_main$1c, {
13139
+ return openBlock(), createBlock(_sfc_main$1d, {
13026
13140
  item: _ctx.item,
13027
13141
  options: _ctx.options,
13028
13142
  "wrapper-class": "lupa-search-results-image-wrapper",
@@ -21534,7 +21648,7 @@ const _hoisted_4 = {
21534
21648
  class: "lupa-chat-spinner-main"
21535
21649
  };
21536
21650
  const _hoisted_5 = { class: "lupasearch-chat-input" };
21537
- const _sfc_main$1l = /* @__PURE__ */ defineComponent({
21651
+ const _sfc_main$1m = /* @__PURE__ */ defineComponent({
21538
21652
  __name: "ChatContainer",
21539
21653
  props: {
21540
21654
  options: {}
@@ -28012,7 +28126,7 @@ const chat = (options, mountOptions) => {
28012
28126
  }
28013
28127
  return;
28014
28128
  }
28015
- const instance = createVue(options.displayOptions.containerSelector, _sfc_main$1l, {
28129
+ const instance = createVue(options.displayOptions.containerSelector, _sfc_main$1m, {
28016
28130
  options
28017
28131
  });
28018
28132
  if (!instance) {