@getlupa/client 1.17.1 → 1.17.5

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.
@@ -7865,6 +7865,14 @@ var __async = (__this, __arguments, generator) => {
7865
7865
  }
7866
7866
  return `< ${formatPrice(max, currency, separator, currencyTemplate)}`;
7867
7867
  };
7868
+ const getTranslatedFacetKey = (facet, translations) => {
7869
+ var _a, _b;
7870
+ return (_b = (_a = translations == null ? void 0 : translations.keyTranslations) == null ? void 0 : _a[facet.key]) != null ? _b : facet.label;
7871
+ };
7872
+ const getTranslatedFacetValue = (facet, value, translations) => {
7873
+ var _a, _b, _c;
7874
+ return (_c = (_b = (_a = translations == null ? void 0 : translations.valueTranslations) == null ? void 0 : _a[facet.key]) == null ? void 0 : _b[value == null ? void 0 : value.title]) != null ? _c : value.title;
7875
+ };
7868
7876
  const formatRange = (filter2) => {
7869
7877
  var _a, _b;
7870
7878
  const lt = (_a = filter2.lt) != null ? _a : filter2.lte;
@@ -7924,11 +7932,12 @@ var __async = (__this, __arguments, generator) => {
7924
7932
  const seed = [];
7925
7933
  return Object.entries(filters).reduce((a, c2) => [...a, ...unfoldFilter(...c2, price)], seed);
7926
7934
  };
7927
- const getLabeledFilters = (filters, facets2) => {
7935
+ const getLabeledFilters = (filters, facets2, translations) => {
7928
7936
  return filters.map((f2) => {
7929
- var _a, _b;
7937
+ var _a, _b, _c, _d;
7930
7938
  return __spreadProps2(__spreadValues2({}, f2), {
7931
- label: (_b = (_a = facets2 == null ? void 0 : facets2.find((ft) => ft.key === f2.key)) == null ? void 0 : _a.label) != null ? _b : capitalize$1(f2.key)
7939
+ label: (_d = (_c = (_a = translations == null ? void 0 : translations.keyTranslations) == null ? void 0 : _a[f2.key]) != null ? _c : (_b = facets2 == null ? void 0 : facets2.find((ft) => ft.key === f2.key)) == null ? void 0 : _b.label) != null ? _d : capitalize$1(f2.key),
7940
+ value: getTranslatedFacetValue({ key: f2.key }, { title: f2.value }, translations)
7932
7941
  });
7933
7942
  });
7934
7943
  };
@@ -14281,7 +14290,7 @@ var __async = (__this, __arguments, generator) => {
14281
14290
  };
14282
14291
  });
14283
14292
  const _hoisted_1$1i = { id: "lupa-search-box-input-container" };
14284
- const _hoisted_2$U = { class: "lupa-input-clear" };
14293
+ const _hoisted_2$T = { class: "lupa-input-clear" };
14285
14294
  const _hoisted_3$C = { id: "lupa-search-box-input" };
14286
14295
  const _hoisted_4$s = ["value"];
14287
14296
  const _hoisted_5$j = ["aria-label", "placeholder"];
@@ -14378,7 +14387,7 @@ var __async = (__this, __arguments, generator) => {
14378
14387
  __expose({ focus });
14379
14388
  return (_ctx, _cache) => {
14380
14389
  return openBlock(), createElementBlock("div", _hoisted_1$1i, [
14381
- createBaseVNode("div", _hoisted_2$U, [
14390
+ createBaseVNode("div", _hoisted_2$T, [
14382
14391
  createBaseVNode("div", {
14383
14392
  class: normalizeClass(["lupa-input-clear-content", { "lupa-input-clear-filled": inputValue.value }]),
14384
14393
  onClick: clear2
@@ -14461,7 +14470,7 @@ var __async = (__this, __arguments, generator) => {
14461
14470
  }
14462
14471
  });
14463
14472
  const _hoisted_1$1h = { class: "lupa-search-box-history-item" };
14464
- const _hoisted_2$T = { class: "lupa-search-box-history-item-content" };
14473
+ const _hoisted_2$S = { class: "lupa-search-box-history-item-content" };
14465
14474
  const _sfc_main$1t = /* @__PURE__ */ defineComponent({
14466
14475
  __name: "SearchBoxHistoryItem",
14467
14476
  props: {
@@ -14479,7 +14488,7 @@ var __async = (__this, __arguments, generator) => {
14479
14488
  };
14480
14489
  return (_ctx, _cache) => {
14481
14490
  return openBlock(), createElementBlock("div", _hoisted_1$1h, [
14482
- createBaseVNode("div", _hoisted_2$T, [
14491
+ createBaseVNode("div", _hoisted_2$S, [
14483
14492
  createBaseVNode("div", {
14484
14493
  class: normalizeClass(["lupa-search-box-history-item-text", { "lupa-search-box-history-item-highlighted": _ctx.highlighted }]),
14485
14494
  onClick: click2
@@ -14606,7 +14615,7 @@ var __async = (__this, __arguments, generator) => {
14606
14615
  return gridTemplate.join(" ");
14607
14616
  };
14608
14617
  const _hoisted_1$1e = ["innerHTML"];
14609
- const _hoisted_2$S = {
14618
+ const _hoisted_2$R = {
14610
14619
  key: 1,
14611
14620
  "data-cy": "lupa-suggestion-value",
14612
14621
  class: "lupa-suggestion-value"
@@ -14660,7 +14669,7 @@ var __async = (__this, __arguments, generator) => {
14660
14669
  class: "lupa-suggestion-value",
14661
14670
  "data-cy": "lupa-suggestion-value",
14662
14671
  innerHTML: _ctx.suggestion.displayHighlight
14663
- }, null, 8, _hoisted_1$1e)) : (openBlock(), createElementBlock("div", _hoisted_2$S, toDisplayString(_ctx.suggestion.display), 1)),
14672
+ }, null, 8, _hoisted_1$1e)) : (openBlock(), createElementBlock("div", _hoisted_2$R, toDisplayString(_ctx.suggestion.display), 1)),
14664
14673
  _ctx.suggestion.facet ? (openBlock(), createElementBlock("div", _hoisted_3$B, [
14665
14674
  createBaseVNode("span", _hoisted_4$r, toDisplayString(facetLabel.value), 1),
14666
14675
  createBaseVNode("span", _hoisted_5$i, toDisplayString(_ctx.suggestion.facet.title), 1)
@@ -23799,6 +23808,11 @@ and ensure you are accounting for this risk.
23799
23808
  case "exists": {
23800
23809
  return fields == null ? void 0 : fields.every((field) => getFieldValue(doc2, field) !== void 0);
23801
23810
  }
23811
+ case "notExists": {
23812
+ return fields == null ? void 0 : fields.every(
23813
+ (field) => getFieldValue(doc2, field) === void 0 || getFieldValue(doc2, field) === null
23814
+ );
23815
+ }
23802
23816
  case "equals": {
23803
23817
  if (fields.length < 2)
23804
23818
  return false;
@@ -23855,7 +23869,7 @@ and ensure you are accounting for this risk.
23855
23869
  }
23856
23870
  };
23857
23871
  const _hoisted_1$1c = ["src"];
23858
- const _hoisted_2$R = ["src"];
23872
+ const _hoisted_2$Q = ["src"];
23859
23873
  const _sfc_main$1n = /* @__PURE__ */ defineComponent({
23860
23874
  __name: "ProductImage",
23861
23875
  props: {
@@ -24006,7 +24020,7 @@ and ensure you are accounting for this risk.
24006
24020
  class: ["lupa-images-main-image", { [_ctx.imageClass]: true }],
24007
24021
  style: styleOverride.value,
24008
24022
  src: finalMainImageUrl.value
24009
- }, { alt: imageAlt.value ? imageAlt.value : void 0 }, { onError: replaceWithPlaceholder }), null, 16, _hoisted_2$R))
24023
+ }, { alt: imageAlt.value ? imageAlt.value : void 0 }, { onError: replaceWithPlaceholder }), null, 16, _hoisted_2$Q))
24010
24024
  ], 38);
24011
24025
  };
24012
24026
  }
@@ -24029,7 +24043,7 @@ and ensure you are accounting for this risk.
24029
24043
  }
24030
24044
  });
24031
24045
  const _hoisted_1$1b = ["innerHTML"];
24032
- const _hoisted_2$Q = {
24046
+ const _hoisted_2$P = {
24033
24047
  key: 1,
24034
24048
  class: "lupa-search-box-product-title"
24035
24049
  };
@@ -24056,14 +24070,14 @@ and ensure you are accounting for this risk.
24056
24070
  key: 0,
24057
24071
  class: "lupa-search-box-product-title",
24058
24072
  innerHTML: sanitizedTitle.value
24059
- }, null, 8, _hoisted_1$1b)) : (openBlock(), createElementBlock("div", _hoisted_2$Q, [
24073
+ }, null, 8, _hoisted_1$1b)) : (openBlock(), createElementBlock("div", _hoisted_2$P, [
24060
24074
  createBaseVNode("strong", null, toDisplayString(title.value), 1)
24061
24075
  ]));
24062
24076
  };
24063
24077
  }
24064
24078
  });
24065
24079
  const _hoisted_1$1a = ["innerHTML"];
24066
- const _hoisted_2$P = {
24080
+ const _hoisted_2$O = {
24067
24081
  key: 1,
24068
24082
  class: "lupa-search-box-product-description"
24069
24083
  };
@@ -24090,7 +24104,7 @@ and ensure you are accounting for this risk.
24090
24104
  key: 0,
24091
24105
  class: "lupa-search-box-product-description",
24092
24106
  innerHTML: sanitizedDescription.value
24093
- }, null, 8, _hoisted_1$1a)) : (openBlock(), createElementBlock("div", _hoisted_2$P, toDisplayString(description.value), 1));
24107
+ }, null, 8, _hoisted_1$1a)) : (openBlock(), createElementBlock("div", _hoisted_2$O, toDisplayString(description.value), 1));
24094
24108
  };
24095
24109
  }
24096
24110
  });
@@ -24149,7 +24163,7 @@ and ensure you are accounting for this risk.
24149
24163
  }
24150
24164
  });
24151
24165
  const _hoisted_1$18 = ["innerHTML"];
24152
- const _hoisted_2$O = { key: 0 };
24166
+ const _hoisted_2$N = { key: 0 };
24153
24167
  const _hoisted_3$A = { key: 1 };
24154
24168
  const _hoisted_4$q = { class: "lupa-search-box-custom-label" };
24155
24169
  const _hoisted_5$h = { class: "lupa-search-box-custom-text" };
@@ -24183,7 +24197,7 @@ and ensure you are accounting for this risk.
24183
24197
  key: 1,
24184
24198
  class: [className.value, "lupa-search-box-product-custom"]
24185
24199
  }, toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), [
24186
- !label.value ? (openBlock(), createElementBlock("div", _hoisted_2$O, toDisplayString(text.value), 1)) : (openBlock(), createElementBlock("div", _hoisted_3$A, [
24200
+ !label.value ? (openBlock(), createElementBlock("div", _hoisted_2$N, toDisplayString(text.value), 1)) : (openBlock(), createElementBlock("div", _hoisted_3$A, [
24187
24201
  createBaseVNode("div", _hoisted_4$q, toDisplayString(label.value), 1),
24188
24202
  createBaseVNode("div", _hoisted_5$h, toDisplayString(text.value), 1)
24189
24203
  ]))
@@ -24306,6 +24320,10 @@ and ensure you are accounting for this risk.
24306
24320
  var _a, _b, _c;
24307
24321
  return (_c = (_b = (_a = searchResultOptions.value) == null ? void 0 : _a.labels) == null ? void 0 : _b.currencyTemplate) != null ? _c : "";
24308
24322
  });
24323
+ const filterTranslations = computed(() => {
24324
+ var _a, _b, _c;
24325
+ return (_c = (_b = (_a = searchResultOptions.value) == null ? void 0 : _a.filters) == null ? void 0 : _b.translations) != null ? _c : {};
24326
+ });
24309
24327
  const labeledFilters = computed(
24310
24328
  () => getLabeledFilters(
24311
24329
  unfoldFilters(filters.value, {
@@ -24314,7 +24332,8 @@ and ensure you are accounting for this risk.
24314
24332
  separator: priceSeparator.value,
24315
24333
  currencyTemplate: currencyTemplate.value
24316
24334
  }),
24317
- facets2.value
24335
+ facets2.value,
24336
+ filterTranslations.value
24318
24337
  )
24319
24338
  );
24320
24339
  const displayFilters = computed(() => {
@@ -24497,7 +24516,7 @@ and ensure you are accounting for this risk.
24497
24516
  };
24498
24517
  });
24499
24518
  const _hoisted_1$16 = { class: "lupa-search-box-add-to-cart-wrapper" };
24500
- const _hoisted_2$N = { class: "lupa-search-box-product-addtocart" };
24519
+ const _hoisted_2$M = { class: "lupa-search-box-product-addtocart" };
24501
24520
  const _hoisted_3$z = ["onClick", "disabled"];
24502
24521
  const _sfc_main$1f = /* @__PURE__ */ defineComponent({
24503
24522
  __name: "SearchBoxProductAddToCart",
@@ -24534,7 +24553,7 @@ and ensure you are accounting for this risk.
24534
24553
  });
24535
24554
  return (_ctx, _cache) => {
24536
24555
  return openBlock(), createElementBlock("div", _hoisted_1$16, [
24537
- createBaseVNode("div", _hoisted_2$N, [
24556
+ createBaseVNode("div", _hoisted_2$M, [
24538
24557
  createBaseVNode("button", mergeProps({
24539
24558
  onClick: withModifiers(handleClick, ["stop", "prevent"]),
24540
24559
  class: loading.value ? "lupa-add-to-cart-loading" : "lupa-add-to-cart",
@@ -24648,7 +24667,7 @@ and ensure you are accounting for this risk.
24648
24667
  }
24649
24668
  }));
24650
24669
  const _hoisted_1$14 = { class: "lupa-badge-title" };
24651
- const _hoisted_2$M = ["src"];
24670
+ const _hoisted_2$L = ["src"];
24652
24671
  const _hoisted_3$y = { key: 1 };
24653
24672
  const _hoisted_4$p = {
24654
24673
  key: 0,
@@ -24691,7 +24710,7 @@ and ensure you are accounting for this risk.
24691
24710
  image.value ? (openBlock(), createElementBlock("img", {
24692
24711
  key: 0,
24693
24712
  src: image.value
24694
- }, null, 8, _hoisted_2$M)) : createCommentVNode("", true),
24713
+ }, null, 8, _hoisted_2$L)) : createCommentVNode("", true),
24695
24714
  hasTitleText.value && showTitle.value ? (openBlock(), createElementBlock("span", _hoisted_3$y, toDisplayString(_ctx.badge.titleText), 1)) : createCommentVNode("", true)
24696
24715
  ]),
24697
24716
  hasAdditionalText.value ? (openBlock(), createElementBlock("span", _hoisted_4$p, toDisplayString(_ctx.badge.additionalText), 1)) : createCommentVNode("", true)
@@ -24791,7 +24810,7 @@ and ensure you are accounting for this risk.
24791
24810
  }
24792
24811
  });
24793
24812
  const _hoisted_1$10 = { class: "lupa-image-badges" };
24794
- const _hoisted_2$L = ["src"];
24813
+ const _hoisted_2$K = ["src"];
24795
24814
  const _sfc_main$19 = /* @__PURE__ */ defineComponent({
24796
24815
  __name: "ImageBadge",
24797
24816
  props: {
@@ -24820,7 +24839,7 @@ and ensure you are accounting for this risk.
24820
24839
  }, [
24821
24840
  createBaseVNode("img", {
24822
24841
  src: getImageUrl(item)
24823
- }, null, 8, _hoisted_2$L)
24842
+ }, null, 8, _hoisted_2$K)
24824
24843
  ]);
24825
24844
  }), 128))
24826
24845
  ]);
@@ -24979,7 +24998,7 @@ and ensure you are accounting for this risk.
24979
24998
  }
24980
24999
  }));
24981
25000
  const _hoisted_1$_ = ["href"];
24982
- const _hoisted_2$K = { class: "lupa-search-box-product-details-section" };
25001
+ const _hoisted_2$J = { class: "lupa-search-box-product-details-section" };
24983
25002
  const _hoisted_3$x = {
24984
25003
  key: 0,
24985
25004
  class: "lupa-search-box-product-add-to-cart-section"
@@ -25080,7 +25099,7 @@ and ensure you are accounting for this risk.
25080
25099
  }, null, 8, ["item", "element", "labels", "link"]);
25081
25100
  }), 128))
25082
25101
  ], 4),
25083
- createBaseVNode("div", _hoisted_2$K, [
25102
+ createBaseVNode("div", _hoisted_2$J, [
25084
25103
  (openBlock(true), createElementBlock(Fragment, null, renderList(detailElements.value, (element) => {
25085
25104
  var _a;
25086
25105
  return openBlock(), createBlock(_sfc_main$1e, {
@@ -25253,6 +25272,9 @@ and ensure you are accounting for this risk.
25253
25272
  }
25254
25273
  emit2("product-click");
25255
25274
  handleRoutingEvent(link, event, boxRoutingBehavior.value === "event");
25275
+ if (props.panelOptions.programmaticNavigation) {
25276
+ window.location.assign(link);
25277
+ }
25256
25278
  };
25257
25279
  return (_ctx, _cache) => {
25258
25280
  return openBlock(), createElementBlock("div", _hoisted_1$Z, [
@@ -25283,7 +25305,7 @@ and ensure you are accounting for this risk.
25283
25305
  }
25284
25306
  });
25285
25307
  const _hoisted_1$Y = { class: "lupa-search-box-documents-go-to-results-wrapper" };
25286
- const _hoisted_2$J = { key: 0 };
25308
+ const _hoisted_2$I = { key: 0 };
25287
25309
  const _sfc_main$14 = /* @__PURE__ */ defineComponent({
25288
25310
  __name: "SearchBoxProductsGoToResultsButton",
25289
25311
  props: {
@@ -25320,7 +25342,7 @@ and ensure you are accounting for this risk.
25320
25342
  onClick: goToResults
25321
25343
  }, [
25322
25344
  createTextVNode(toDisplayString(goToResultsLabel.value) + " ", 1),
25323
- totalCount.value ? (openBlock(), createElementBlock("span", _hoisted_2$J, " " + toDisplayString(totalCount.value), 1)) : createCommentVNode("", true)
25345
+ totalCount.value ? (openBlock(), createElementBlock("span", _hoisted_2$I, " " + toDisplayString(totalCount.value), 1)) : createCommentVNode("", true)
25324
25346
  ])
25325
25347
  ]);
25326
25348
  };
@@ -25588,7 +25610,7 @@ and ensure you are accounting for this risk.
25588
25610
  key: 0,
25589
25611
  id: "lupa-search-box-panel"
25590
25612
  };
25591
- const _hoisted_2$I = ["data-cy"];
25613
+ const _hoisted_2$H = ["data-cy"];
25592
25614
  const _hoisted_3$w = {
25593
25615
  key: 0,
25594
25616
  class: "lupa-panel-title lupa-panel-title-top-results"
@@ -25808,7 +25830,7 @@ and ensure you are accounting for this risk.
25808
25830
  key: "0"
25809
25831
  } : void 0
25810
25832
  ]), 1064, ["panel", "search-box-options", "options", "debounce", "inputValue", "labels"])) : createCommentVNode("", true)
25811
- ], 14, _hoisted_2$I);
25833
+ ], 14, _hoisted_2$H);
25812
25834
  }), 128))
25813
25835
  ], 4),
25814
25836
  !unref(hasAnyResults) && _ctx.options.showNoResultsPanel ? (openBlock(), createBlock(_sfc_main$1r, {
@@ -25847,8 +25869,7 @@ and ensure you are accounting for this risk.
25847
25869
  const elements = getElements(triggers);
25848
25870
  elements.forEach((e2) => e2 == null ? void 0 : e2.removeEventListener(BIND_EVENT, event));
25849
25871
  };
25850
- const _hoisted_1$W = { id: "lupa-search-box" };
25851
- const _hoisted_2$H = { class: "lupa-search-box-wrapper" };
25872
+ const _hoisted_1$W = { class: "lupa-search-box-wrapper" };
25852
25873
  const _sfc_main$10 = /* @__PURE__ */ defineComponent({
25853
25874
  __name: "SearchBox",
25854
25875
  props: {
@@ -25873,6 +25894,7 @@ and ensure you are accounting for this risk.
25873
25894
  const suggestedValue = ref(defaultSuggestedValue);
25874
25895
  const opened = ref(props.isSearchContainer);
25875
25896
  const focused = ref(false);
25897
+ const openedAt = ref(null);
25876
25898
  const searchBoxInput = ref(null);
25877
25899
  const { highlightedDocument } = storeToRefs(searchBoxStore);
25878
25900
  const searchValue = computed(() => {
@@ -25909,7 +25931,7 @@ and ensure you are accounting for this risk.
25909
25931
  });
25910
25932
  const goToResultsDebounced = debounce$1(paramsStore.goToResults, (_a = props.options.debounce) != null ? _a : 300);
25911
25933
  onMounted(() => {
25912
- var _a2;
25934
+ var _a2, _b, _c;
25913
25935
  window.addEventListener("keydown", handleKeyDown);
25914
25936
  window.addEventListener("click", handleMouseClick);
25915
25937
  paramsStore.setSearchResultsLink(props.options.links.searchResults);
@@ -25920,6 +25942,9 @@ and ensure you are accounting for this risk.
25920
25942
  if (props.isSearchContainer && searchBoxInput.value) {
25921
25943
  (_a2 = searchBoxInput.value) == null ? void 0 : _a2.focus();
25922
25944
  }
25945
+ if ((_b = props.options.callbacks) == null ? void 0 : _b.onMounted) {
25946
+ (_c = props.options.callbacks) == null ? void 0 : _c.onMounted();
25947
+ }
25923
25948
  });
25924
25949
  onBeforeUnmount(() => {
25925
25950
  window.removeEventListener("keydown", handleKeyDown);
@@ -25927,11 +25952,14 @@ and ensure you are accounting for this risk.
25927
25952
  unbindSearchTriggers(searchTriggers.value, handleCurrentValueSearch);
25928
25953
  });
25929
25954
  const handleMouseClick = (e2) => {
25930
- var _a2, _b;
25955
+ var _a2, _b, _c, _d;
25931
25956
  const el = document.getElementById("lupa-search-box");
25932
25957
  const elementClass = (_b = (_a2 = e2.target) == null ? void 0 : _a2.className) != null ? _b : "";
25933
25958
  const hasLupaClass = typeof elementClass.includes == "function" && elementClass.includes("lupa-search-box");
25934
25959
  const isOutsideElement = el && !el.contains(e2.target) && !hasLupaClass;
25960
+ if (openedAt.value && Date.now() - (openedAt == null ? void 0 : openedAt.value) < 500) {
25961
+ return;
25962
+ }
25935
25963
  if (isOutsideElement && props.options.keepOpen) {
25936
25964
  focused.value = false;
25937
25965
  }
@@ -25940,11 +25968,18 @@ and ensure you are accounting for this risk.
25940
25968
  }
25941
25969
  opened.value = false;
25942
25970
  suggestedValue.value = defaultSuggestedValue;
25971
+ if ((_c = props.options.callbacks) == null ? void 0 : _c.onClosed) {
25972
+ (_d = props.options.callbacks) == null ? void 0 : _d.onClosed();
25973
+ }
25943
25974
  };
25944
25975
  const close = () => {
25976
+ var _a2, _b;
25945
25977
  opened.value = false;
25946
25978
  focused.value = false;
25947
25979
  suggestedValue.value = defaultSuggestedValue;
25980
+ if ((_a2 = props.options.callbacks) == null ? void 0 : _a2.onClosed) {
25981
+ (_b = props.options.callbacks) == null ? void 0 : _b.onClosed();
25982
+ }
25948
25983
  };
25949
25984
  const handleKeyDown = (e2) => {
25950
25985
  var _a2, _b;
@@ -25963,15 +25998,22 @@ and ensure you are accounting for this risk.
25963
25998
  handleSearch();
25964
25999
  resetValues();
25965
26000
  break;
26001
+ case "Escape":
26002
+ opened.value = false;
26003
+ focused.value = false;
26004
+ break;
25966
26005
  }
25967
26006
  };
25968
26007
  const handleInput = (value) => {
25969
- var _a2;
26008
+ var _a2, _b;
25970
26009
  opened.value = true;
25971
26010
  focused.value = true;
25972
26011
  inputValue.value = (_a2 = value == null ? void 0 : value.replace(/\s+$/, "")) != null ? _a2 : "";
25973
26012
  suggestedValue.value = defaultSuggestedValue;
25974
26013
  searchBoxStore.resetHighlightIndex();
26014
+ if ((_b = props.options.callbacks) == null ? void 0 : _b.onSearchBoxInput) {
26015
+ props.options.callbacks.onSearchBoxInput(value);
26016
+ }
25975
26017
  trackSearchQuery(value);
25976
26018
  if (props.isSearchContainer) {
25977
26019
  goToResultsDebounced({
@@ -26104,6 +26146,13 @@ and ensure you are accounting for this risk.
26104
26146
  });
26105
26147
  };
26106
26148
  watch(() => props.options.debounce, handleCurrentValueSearch);
26149
+ watch(opened, () => {
26150
+ if (opened.value) {
26151
+ openedAt.value = Date.now();
26152
+ } else {
26153
+ openedAt.value = null;
26154
+ }
26155
+ });
26107
26156
  const resetValues = () => {
26108
26157
  inputValue.value = "";
26109
26158
  suggestedValue.value = defaultSuggestedValue;
@@ -26115,10 +26164,27 @@ and ensure you are accounting for this risk.
26115
26164
  const slotProps = (props2) => {
26116
26165
  return __spreadValues2({}, props2);
26117
26166
  };
26167
+ const onFocus = () => {
26168
+ var _a2, _b;
26169
+ opened.value = true;
26170
+ if ((_a2 = props.options.callbacks) == null ? void 0 : _a2.onFocused) {
26171
+ (_b = props.options.callbacks) == null ? void 0 : _b.onFocused();
26172
+ }
26173
+ };
26174
+ const onBlur = () => {
26175
+ var _a2, _b;
26176
+ focused.value = false;
26177
+ if ((_a2 = props.options.callbacks) == null ? void 0 : _a2.onBlurred) {
26178
+ (_b = props.options.callbacks) == null ? void 0 : _b.onBlurred();
26179
+ }
26180
+ };
26118
26181
  return (_ctx, _cache) => {
26119
26182
  var _a2;
26120
- return openBlock(), createElementBlock("div", _hoisted_1$W, [
26121
- createBaseVNode("div", _hoisted_2$H, [
26183
+ return openBlock(), createElementBlock("div", {
26184
+ id: "lupa-search-box",
26185
+ class: normalizeClass({ "lupa-search-box-opened": opened.value })
26186
+ }, [
26187
+ createBaseVNode("div", _hoisted_1$W, [
26122
26188
  createVNode(_sfc_main$1v, {
26123
26189
  options: inputOptions.value,
26124
26190
  suggestedValue: suggestedValue.value,
@@ -26127,10 +26193,10 @@ and ensure you are accounting for this risk.
26127
26193
  ref_key: "searchBoxInput",
26128
26194
  ref: searchBoxInput,
26129
26195
  onInput: handleInput,
26130
- onBlur: _cache[0] || (_cache[0] = ($event) => focused.value = false),
26131
- onFocus: _cache[1] || (_cache[1] = ($event) => opened.value = true),
26196
+ onBlur,
26197
+ onFocus,
26132
26198
  onSearch: handleSearch,
26133
- onClose: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("close"))
26199
+ onClose: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("close"))
26134
26200
  }, null, 8, ["options", "suggestedValue", "can-close", "emit-input-on-focus"]),
26135
26201
  opened.value || _ctx.isSearchContainer ? (openBlock(), createBlock(_sfc_main$11, {
26136
26202
  key: 0,
@@ -26153,7 +26219,7 @@ and ensure you are accounting for this risk.
26153
26219
  } : void 0
26154
26220
  ]), 1032, ["options", "inputValue", "isSearchContainer", "focused"])) : createCommentVNode("", true)
26155
26221
  ])
26156
- ]);
26222
+ ], 2);
26157
26223
  };
26158
26224
  }
26159
26225
  });
@@ -26747,6 +26813,8 @@ and ensure you are accounting for this risk.
26747
26813
  setup(__props, { emit: emit2 }) {
26748
26814
  const props = __props;
26749
26815
  const searchResultStore = useSearchResultStore();
26816
+ const optionsStore = useOptionsStore();
26817
+ const { searchResultOptions } = storeToRefs(optionsStore);
26750
26818
  const facet = computed(() => {
26751
26819
  var _a;
26752
26820
  return (_a = props.facet) != null ? _a : { type: "terms", items: [], key: "" };
@@ -26806,6 +26874,10 @@ and ensure you are accounting for this risk.
26806
26874
  selectedItems = isRange.value && selectedItems ? [rangeFilterToString(selectedItems)] : selectedItems;
26807
26875
  return selectedItems == null ? void 0 : selectedItems.includes((_b = item.title) == null ? void 0 : _b.toString());
26808
26876
  };
26877
+ const getItemLabel = (item) => {
26878
+ var _a;
26879
+ return getTranslatedFacetValue(props.facet, item, (_a = searchResultOptions.value.filters) == null ? void 0 : _a.translations);
26880
+ };
26809
26881
  return (_ctx, _cache) => {
26810
26882
  return openBlock(), createElementBlock("div", _hoisted_1$O, [
26811
26883
  isFilterable.value ? withDirectives((openBlock(), createElementBlock("input", {
@@ -26831,7 +26903,7 @@ and ensure you are accounting for this risk.
26831
26903
  }, null, 2)
26832
26904
  ]),
26833
26905
  createBaseVNode("div", _hoisted_6$8, [
26834
- createBaseVNode("span", _hoisted_7$6, toDisplayString(item.title), 1),
26906
+ createBaseVNode("span", _hoisted_7$6, toDisplayString(getItemLabel(item)), 1),
26835
26907
  _ctx.options.showDocumentCount ? (openBlock(), createElementBlock("span", _hoisted_8$2, "(" + toDisplayString(item.count) + ")", 1)) : createCommentVNode("", true)
26836
26908
  ])
26837
26909
  ], 10, _hoisted_4$j);
@@ -28315,7 +28387,9 @@ and ensure you are accounting for this risk.
28315
28387
  return (_a2 = props.currentFilters) != null ? _a2 : {};
28316
28388
  });
28317
28389
  const searchResultStore = useSearchResultStore();
28390
+ const optionsStore = useOptionsStore();
28318
28391
  const { currentFilterKeys } = storeToRefs(searchResultStore);
28392
+ const { searchResultOptions } = storeToRefs(optionsStore);
28319
28393
  const isOpen = ref((_b = (_a = props.options.expand) == null ? void 0 : _a.includes(props.facet.key)) != null ? _b : false);
28320
28394
  const facetPanel = ref(null);
28321
28395
  const facetType = computed(() => {
@@ -28354,6 +28428,10 @@ and ensure you are accounting for this risk.
28354
28428
  const facetKeyClass = computed(() => {
28355
28429
  return `lupa-facet-${facet.value.key}`;
28356
28430
  });
28431
+ const facetLabel = computed(() => {
28432
+ var _a2;
28433
+ return getTranslatedFacetKey(props.facet, (_a2 = searchResultOptions.value.filters) == null ? void 0 : _a2.translations);
28434
+ });
28357
28435
  onMounted(() => {
28358
28436
  var _a2;
28359
28437
  if (((_a2 = props.options.style) == null ? void 0 : _a2.type) === "top-dropdown") {
@@ -28409,7 +28487,7 @@ and ensure you are accounting for this risk.
28409
28487
  "data-cy": "lupa-search-result-facet-label",
28410
28488
  onClick: toggleFacet
28411
28489
  }, [
28412
- createBaseVNode("div", _hoisted_1$K, toDisplayString(facet.value.label), 1),
28490
+ createBaseVNode("div", _hoisted_1$K, toDisplayString(facetLabel.value), 1),
28413
28491
  createBaseVNode("div", {
28414
28492
  class: normalizeClass(["lupa-facet-label-caret", isOpen.value && "open"])
28415
28493
  }, null, 2)
@@ -39599,6 +39677,33 @@ and ensure you are accounting for this risk.
39599
39677
  shadow.appendChild(style);
39600
39678
  }
39601
39679
  };
39680
+ const createDomPing = () => {
39681
+ let intervalId = null;
39682
+ let remaining = 0;
39683
+ return (intervalMs = 100, count = 50) => {
39684
+ if (intervalId !== null) {
39685
+ clearInterval(intervalId);
39686
+ }
39687
+ remaining = count;
39688
+ const flush = () => {
39689
+ if (remaining-- <= 0) {
39690
+ if (intervalId !== null) {
39691
+ clearInterval(intervalId);
39692
+ intervalId = null;
39693
+ }
39694
+ return;
39695
+ }
39696
+ const el = document.createElement("div");
39697
+ el.style.cssText = "position:absolute;width:0;height:0;overflow:hidden;pointer-events:none;";
39698
+ el.setAttribute("data-nudge", Date.now().toString());
39699
+ document.body.appendChild(el);
39700
+ document.body.removeChild(el);
39701
+ };
39702
+ flush();
39703
+ intervalId = window.setInterval(flush, intervalMs);
39704
+ };
39705
+ };
39706
+ const startDomPing = createDomPing();
39602
39707
  const getMountElement = (element, mountingBehavior = "replace", mountToParent) => {
39603
39708
  const parent = element == null ? void 0 : element.parentElement;
39604
39709
  if (mountingBehavior === "replace") {
@@ -39654,6 +39759,58 @@ and ensure you are accounting for this risk.
39654
39759
  recommendations: {},
39655
39760
  chat: {}
39656
39761
  };
39762
+ const addSearchBoxDomPingIfConfigured = (options, mountOptions) => {
39763
+ var _a;
39764
+ if (!((_a = mountOptions == null ? void 0 : mountOptions.domPing) == null ? void 0 : _a.count)) {
39765
+ return options;
39766
+ }
39767
+ const newOptions = __spreadProps(__spreadValues({}, options), {
39768
+ callbacks: {
39769
+ onMounted: () => {
39770
+ var _a2, _b;
39771
+ (_b = (_a2 = options.callbacks) == null ? void 0 : _a2.onMounted) == null ? void 0 : _b.call(_a2);
39772
+ startDomPing(mountOptions.domPing.intervalMs, mountOptions.domPing.count);
39773
+ },
39774
+ onBlurred: () => {
39775
+ var _a2, _b;
39776
+ (_b = (_a2 = options.callbacks) == null ? void 0 : _a2.onBlurred) == null ? void 0 : _b.call(_a2);
39777
+ startDomPing(mountOptions.domPing.intervalMs, mountOptions.domPing.count);
39778
+ },
39779
+ onFocused: () => {
39780
+ var _a2, _b;
39781
+ (_b = (_a2 = options.callbacks) == null ? void 0 : _a2.onFocused) == null ? void 0 : _b.call(_a2);
39782
+ startDomPing(mountOptions.domPing.intervalMs, mountOptions.domPing.count);
39783
+ },
39784
+ onSearchBoxInput: (...args) => {
39785
+ var _a2, _b;
39786
+ (_b = (_a2 = options.callbacks) == null ? void 0 : _a2.onSearchBoxInput) == null ? void 0 : _b.call(_a2, ...args);
39787
+ startDomPing(mountOptions.domPing.intervalMs, mountOptions.domPing.count);
39788
+ }
39789
+ }
39790
+ });
39791
+ return newOptions;
39792
+ };
39793
+ const addSearchResultsDomPingIfConfigured = (options, mountOptions) => {
39794
+ var _a;
39795
+ if (!((_a = mountOptions == null ? void 0 : mountOptions.domPing) == null ? void 0 : _a.count)) {
39796
+ return options;
39797
+ }
39798
+ const newOptions = __spreadProps(__spreadValues({}, options), {
39799
+ callbacks: {
39800
+ onMounted: () => {
39801
+ var _a2, _b;
39802
+ (_b = (_a2 = options.callbacks) == null ? void 0 : _a2.onMounted) == null ? void 0 : _b.call(_a2);
39803
+ startDomPing(mountOptions.domPing.intervalMs, mountOptions.domPing.count);
39804
+ },
39805
+ onUrlQueryChange: (...args) => {
39806
+ var _a2, _b;
39807
+ (_b = (_a2 = options.callbacks) == null ? void 0 : _a2.onUrlQueryChange) == null ? void 0 : _b.call(_a2, ...args);
39808
+ startDomPing(mountOptions.domPing.intervalMs, mountOptions.domPing.count);
39809
+ }
39810
+ }
39811
+ });
39812
+ return newOptions;
39813
+ };
39657
39814
  const applySearchBox = (options, mountOptions) => {
39658
39815
  const existingInstance = app.box[options.inputSelector];
39659
39816
  if (existingInstance) {
@@ -39683,9 +39840,10 @@ and ensure you are accounting for this risk.
39683
39840
  if (!canMount(mountOptions == null ? void 0 : mountOptions.allowedMountUrls)) {
39684
39841
  return;
39685
39842
  }
39843
+ const transformedOptions = addSearchBoxDomPingIfConfigured(options, mountOptions);
39686
39844
  const inputs = (_a = options.inputSelector) == null ? void 0 : _a.split(",");
39687
39845
  for (const input2 of inputs) {
39688
- applySearchBox(__spreadProps(__spreadValues({}, options), { inputSelector: input2.trim() }), mountOptions);
39846
+ applySearchBox(__spreadProps(__spreadValues({}, transformedOptions), { inputSelector: input2.trim() }), mountOptions);
39689
39847
  }
39690
39848
  };
39691
39849
  const searchResults = (options, mountOptions) => {
@@ -39703,12 +39861,13 @@ and ensure you are accounting for this risk.
39703
39861
  }
39704
39862
  return;
39705
39863
  }
39864
+ const transformedOptions = addSearchResultsDomPingIfConfigured(options, mountOptions);
39706
39865
  const instance = createVue(
39707
39866
  options.containerSelector,
39708
39867
  mountOptions == null ? void 0 : mountOptions.mountingBehavior,
39709
39868
  _sfc_main$3,
39710
39869
  {
39711
- searchResultsOptions: options
39870
+ searchResultsOptions: transformedOptions
39712
39871
  }
39713
39872
  );
39714
39873
  if (!instance) {
@@ -40148,6 +40307,7 @@ and ensure you are accounting for this risk.
40148
40307
  }
40149
40308
  const resolvedConfiguration = JSON.parse(configuration.searchBox);
40150
40309
  const allowedMountUrls = resolvedConfiguration.allowedMountUrls;
40310
+ const domPing = resolvedConfiguration.domPing;
40151
40311
  const visible = yield waitForElementToBeVisible(
40152
40312
  resolvedConfiguration.inputSelector,
40153
40313
  0,
@@ -40163,7 +40323,7 @@ and ensure you are accounting for this risk.
40163
40323
  resolvedConfiguration,
40164
40324
  (_a = optionOverrides == null ? void 0 : optionOverrides.searchBox) != null ? _a : {}
40165
40325
  );
40166
- searchBox(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
40326
+ searchBox(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls, domPing });
40167
40327
  });
40168
40328
  const mountSearchResults = (configuration, options, optionOverrides, fetch2 = true, remount = false) => __async(this, null, function* () {
40169
40329
  var _a;
@@ -40172,6 +40332,7 @@ and ensure you are accounting for this risk.
40172
40332
  }
40173
40333
  const resolvedConfiguration = JSON.parse(configuration.searchResults);
40174
40334
  const allowedMountUrls = resolvedConfiguration.allowedMountUrls;
40335
+ const domPing = resolvedConfiguration.domPing;
40175
40336
  const visible = yield waitForElementToBeVisible(
40176
40337
  resolvedConfiguration.containerSelector,
40177
40338
  0,
@@ -40187,7 +40348,7 @@ and ensure you are accounting for this risk.
40187
40348
  resolvedConfiguration,
40188
40349
  (_a = optionOverrides == null ? void 0 : optionOverrides.searchResults) != null ? _a : {}
40189
40350
  );
40190
- searchResults(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
40351
+ searchResults(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls, domPing });
40191
40352
  });
40192
40353
  const mountProductList = (configuration, options, optionOverrides, fetch2 = true, remount = false) => __async(this, null, function* () {
40193
40354
  var _a;