@getlupa/client 1.8.2 → 1.8.4

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.
@@ -6166,6 +6166,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
6166
6166
  const DEFAULT_PAGE_SIZE_SELECTION = [12, 24, 36, 60];
6167
6167
  const LUPA_ROUTING_EVENT = "lupaRedirect";
6168
6168
  const RATING_STAR_HTML = "☆";
6169
+ const RESULT_ROOT_SELECTOR = "#lupa-search-results";
6169
6170
  const production = "https://api.lupasearch.com/v1/";
6170
6171
  const staging = "https://api.staging.lupasearch.com/v1/";
6171
6172
  const Env$1 = {
@@ -7150,7 +7151,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7150
7151
  const [min, max] = range.split(FACET_RANGE_SEPARATOR);
7151
7152
  return {
7152
7153
  gte: min,
7153
- lt: max
7154
+ lte: max
7154
7155
  };
7155
7156
  }
7156
7157
  if (key.startsWith(FACET_PARAMS_TYPE.HIERARCHY)) {
@@ -8620,22 +8621,21 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8620
8621
  ResultsLayoutEnum2["LIST"] = "List";
8621
8622
  return ResultsLayoutEnum2;
8622
8623
  })(ResultsLayoutEnum || {});
8623
- const RESULT_ROOT_ID = "lupa-search-results";
8624
8624
  const SHADOW_ROOT_ID = "lupa-shadow-id";
8625
8625
  const CONTAINER_ROOT_ID = "lupa-search-container";
8626
- const scrollToSearchResults = (timeout = 500) => {
8626
+ const scrollToSearchResults = (timeout = 500, containerSelector) => {
8627
8627
  if (timeout) {
8628
- setTimeout(() => scrollTo(RESULT_ROOT_ID), timeout);
8628
+ setTimeout(() => scrollTo(containerSelector != null ? containerSelector : RESULT_ROOT_SELECTOR), timeout);
8629
8629
  } else {
8630
- scrollTo(RESULT_ROOT_ID);
8630
+ scrollTo(RESULT_ROOT_SELECTOR);
8631
8631
  }
8632
8632
  };
8633
- const scrollTo = (elementId) => {
8633
+ const scrollTo = (elementSelector) => {
8634
8634
  var _a, _b;
8635
- let el = document.getElementById(elementId);
8635
+ let el = document.querySelector(elementSelector);
8636
8636
  const shadowRoot = (_a = document.getElementById(SHADOW_ROOT_ID)) == null ? void 0 : _a.shadowRoot;
8637
8637
  if (!el) {
8638
- el = (_b = shadowRoot == null ? void 0 : shadowRoot.getElementById(elementId)) != null ? _b : null;
8638
+ el = (_b = shadowRoot == null ? void 0 : shadowRoot.getElementById(elementSelector)) != null ? _b : null;
8639
8639
  }
8640
8640
  if (!el) {
8641
8641
  return;
@@ -11457,7 +11457,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
11457
11457
  return typeof currentFilters.value.gte === "string" ? parseFloat(currentFilters.value.gte) : currentFilters.value.gte;
11458
11458
  });
11459
11459
  const currentLte = computed(() => {
11460
- return typeof currentFilters.value.lt === "string" ? parseFloat(currentFilters.value.lt) : currentFilters.value.lt;
11460
+ return typeof currentFilters.value.lte === "string" ? parseFloat(currentFilters.value.lte) : currentFilters.value.lte;
11461
11461
  });
11462
11462
  const currentMinValue = computed(() => {
11463
11463
  return currentGte.value ? Math.max(currentGte.value, facetMin.value) : facetMin.value;
@@ -12004,8 +12004,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
12004
12004
  const props = __props;
12005
12005
  const paramStore = useParamsStore();
12006
12006
  const searchResultStore = useSearchResultStore();
12007
+ const optionsStore = useOptionsStore();
12007
12008
  const { filters } = storeToRefs(paramStore);
12008
12009
  const { facets } = storeToRefs(searchResultStore);
12010
+ const { searchResultOptions } = storeToRefs(optionsStore);
12009
12011
  computed(() => {
12010
12012
  var _a;
12011
12013
  return (_a = facets.value) == null ? void 0 : _a.filter((f2) => {
@@ -12020,6 +12022,14 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
12020
12022
  return !((_a2 = props.options.promotedFacets) == null ? void 0 : _a2.includes(f2.key));
12021
12023
  });
12022
12024
  });
12025
+ const scrollToResultsOptions = computed(() => {
12026
+ var _a, _b, _c, _d, _e, _f;
12027
+ return {
12028
+ enabled: ((_a = searchResultOptions.value.scrollToResults) == null ? void 0 : _a.enabled) === void 0 ? true : (_b = searchResultOptions.value.scrollToResults) == null ? void 0 : _b.enabled,
12029
+ container: (_d = (_c = searchResultOptions.value.scrollToResults) == null ? void 0 : _c.scrollToContainerSelector) != null ? _d : RESULT_ROOT_SELECTOR,
12030
+ timeout: (_f = (_e = searchResultOptions.value.scrollToResults) == null ? void 0 : _e.timeout) != null ? _f : 500
12031
+ };
12032
+ });
12023
12033
  const handleFacetSelect = (facetAction) => {
12024
12034
  switch (facetAction.type) {
12025
12035
  case "terms":
@@ -12032,7 +12042,12 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
12032
12042
  toggleHierarchyFilter(paramStore.appendParams, facetAction, filters.value);
12033
12043
  break;
12034
12044
  }
12035
- scrollToSearchResults();
12045
+ if (scrollToResultsOptions.value.enabled) {
12046
+ scrollToSearchResults(
12047
+ scrollToResultsOptions.value.timeout,
12048
+ scrollToResultsOptions.value.container
12049
+ );
12050
+ }
12036
12051
  };
12037
12052
  const clear2 = (facet) => {
12038
12053
  const param = getFacetKey(facet.key, facet.type);
@@ -12344,7 +12359,9 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
12344
12359
  });
12345
12360
  const paramStore = useParamsStore();
12346
12361
  const screenStore = useScreenStore();
12362
+ const optionsStore = useOptionsStore();
12347
12363
  const { isMobileWidth } = storeToRefs(screenStore);
12364
+ const { searchResultOptions } = storeToRefs(optionsStore);
12348
12365
  const pageOptionsCount = computed(() => {
12349
12366
  return isMobileWidth.value ? props.options.displayMobile : props.options.display;
12350
12367
  });
@@ -12378,12 +12395,25 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
12378
12395
  const showPagination = computed(() => {
12379
12396
  return pages.value.length > 1;
12380
12397
  });
12398
+ const scrollToResultsOptions = computed(() => {
12399
+ var _a, _b, _c, _d, _e, _f;
12400
+ return {
12401
+ enabled: ((_a = searchResultOptions.value.scrollToResults) == null ? void 0 : _a.enabled) === void 0 ? true : (_b = searchResultOptions.value.scrollToResults) == null ? void 0 : _b.enabled,
12402
+ container: (_d = (_c = searchResultOptions.value.scrollToResults) == null ? void 0 : _c.scrollToContainerSelector) != null ? _d : RESULT_ROOT_SELECTOR,
12403
+ timeout: (_f = (_e = searchResultOptions.value.scrollToResults) == null ? void 0 : _e.timeout) != null ? _f : 500
12404
+ };
12405
+ });
12381
12406
  const handlePageChange = (page) => {
12382
12407
  if (page > 0) {
12383
12408
  paramStore.appendParams({
12384
12409
  params: [{ name: QUERY_PARAMS$1.PAGE, value: page.toString() }]
12385
12410
  });
12386
- scrollToSearchResults();
12411
+ if (scrollToResultsOptions.value.enabled) {
12412
+ scrollToSearchResults(
12413
+ scrollToResultsOptions.value.timeout,
12414
+ scrollToResultsOptions.value.container
12415
+ );
12416
+ }
12387
12417
  }
12388
12418
  };
12389
12419
  return (_ctx, _cache) => {
@@ -27571,7 +27601,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
27571
27601
  callbacks,
27572
27602
  additionalFields
27573
27603
  }) => {
27574
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
27604
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A;
27575
27605
  const filters = searchResultOptions.showFacets ? {
27576
27606
  currentFilters: {
27577
27607
  visibility: {
@@ -27620,23 +27650,37 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
27620
27650
  sm: (_i = searchResultOptions.maxColumns) != null ? _i : 2,
27621
27651
  xs: (_j = searchResultOptions.maxColumns) != null ? _j : 1
27622
27652
  };
27623
- const badges = searchResultOptions.showRelevance ? {
27653
+ const badges = {
27624
27654
  badges: {
27625
27655
  anchor: "tr",
27626
27656
  elements: [
27627
- {
27628
- key: "",
27629
- type: "customHtml",
27630
- className: "relevance",
27631
- html: (doc2) => `${toMaxDecimalPlaces(escapeHtml(doc2._relevance), 3)}`,
27632
- display: (doc2) => Boolean(doc2._relevance !== void 0)
27633
- }
27657
+ ...searchResultOptions.showRelevance && [
27658
+ {
27659
+ key: "",
27660
+ type: "customHtml",
27661
+ className: "relevance",
27662
+ html: (doc2) => `${toMaxDecimalPlaces(escapeHtml(doc2._relevance), 3)}`,
27663
+ display: (doc2) => Boolean(doc2._relevance !== void 0)
27664
+ }
27665
+ ],
27666
+ ...((_m = (_l = searchResultOptions.boostedMarker) == null ? void 0 : _l.enabled) != null ? _m : false) && [
27667
+ {
27668
+ key: "",
27669
+ type: "customHtml",
27670
+ className: "boosted-marker",
27671
+ html: () => {
27672
+ var _a2;
27673
+ return `${escapeHtml((_a2 = searchResultOptions.boostedMarker) == null ? void 0 : _a2.label)}`;
27674
+ },
27675
+ display: (doc2) => doc2._boosted === true
27676
+ }
27677
+ ]
27634
27678
  ]
27635
27679
  }
27636
- } : {};
27680
+ };
27637
27681
  return __spreadValues(__spreadProps(__spreadValues({
27638
27682
  options: {
27639
- environment: (_l = searchResultOptions.environment) != null ? _l : "production",
27683
+ environment: (_n = searchResultOptions.environment) != null ? _n : "production",
27640
27684
  customUrl: searchResultOptions.customUrl,
27641
27685
  customBaseUrl: searchResultOptions.customBaseUrl,
27642
27686
  customPayload: searchResultOptions.customPayload,
@@ -27646,7 +27690,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
27646
27690
  queryKey: searchResultOptions.queryKey,
27647
27691
  containerSelector: searchResultOptions.containerSelector,
27648
27692
  searchTitlePosition: "search-results-top",
27649
- titleKey: (_m = searchResultOptions.fields) == null ? void 0 : _m.titleKey,
27693
+ titleKey: (_o = searchResultOptions.fields) == null ? void 0 : _o.titleKey,
27650
27694
  labels: labels == null ? void 0 : labels.searchResults,
27651
27695
  grid: {
27652
27696
  columns
@@ -27679,7 +27723,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
27679
27723
  }
27680
27724
  }, badges), {
27681
27725
  links: {
27682
- details: ((_n = searchResultOptions.fields) == null ? void 0 : _n.productUrl) ? `{${(_o = searchResultOptions.fields) == null ? void 0 : _o.productUrl}}` : void 0
27726
+ details: ((_p = searchResultOptions.fields) == null ? void 0 : _p.productUrl) ? `{${(_q = searchResultOptions.fields) == null ? void 0 : _q.productUrl}}` : void 0
27683
27727
  },
27684
27728
  callbacks,
27685
27729
  routingBehavior: callbacks ? "event" : "direct-link",
@@ -27688,31 +27732,31 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
27688
27732
  {
27689
27733
  type: "image",
27690
27734
  placeholder: placeholderImage,
27691
- key: (_p = searchResultOptions.fields) == null ? void 0 : _p.imageKey,
27692
- baseUrl: (_q = searchResultOptions.fields) == null ? void 0 : _q.baseImageUrl,
27735
+ key: (_r = searchResultOptions.fields) == null ? void 0 : _r.imageKey,
27736
+ baseUrl: (_s = searchResultOptions.fields) == null ? void 0 : _s.baseImageUrl,
27693
27737
  display: () => {
27694
27738
  var _a2;
27695
27739
  return (_a2 = searchResultOptions.fields) == null ? void 0 : _a2.imageKey;
27696
27740
  }
27697
27741
  },
27698
- addFieldIfKeyExists("_emphasis", (_r = searchResultOptions.fields) == null ? void 0 : _r.emphasizedField, {
27742
+ addFieldIfKeyExists("_emphasis", (_t = searchResultOptions.fields) == null ? void 0 : _t.emphasizedField, {
27699
27743
  type: "custom",
27700
27744
  className: "lupa-custom-emphasis",
27701
- key: (_s = searchResultOptions.fields) == null ? void 0 : _s.emphasizedField,
27745
+ key: (_u = searchResultOptions.fields) == null ? void 0 : _u.emphasizedField,
27702
27746
  display: () => true
27703
27747
  }),
27704
27748
  {
27705
27749
  type: "title",
27706
- key: (_t = searchResultOptions.fields) == null ? void 0 : _t.titleKey,
27707
- maxLines: (_u = searchResultOptions.maxLines) != null ? _u : 2,
27750
+ key: (_v = searchResultOptions.fields) == null ? void 0 : _v.titleKey,
27751
+ maxLines: (_w = searchResultOptions.maxLines) != null ? _w : 2,
27708
27752
  display: (doc2) => {
27709
27753
  var _a2, _b2;
27710
27754
  return ((_a2 = searchResultOptions.fields) == null ? void 0 : _a2.titleKey) && Boolean(doc2[(_b2 = searchResultOptions.fields) == null ? void 0 : _b2.titleKey]);
27711
27755
  }
27712
27756
  },
27713
27757
  ...getAdditionalElements(additionalFields),
27714
- addFieldIfKeyExists("_discountPrice", (_v = searchResultOptions.fields) == null ? void 0 : _v.discountPriceKey, {
27715
- key: (_w = searchResultOptions.fields) == null ? void 0 : _w.discountPriceKey,
27758
+ addFieldIfKeyExists("_discountPrice", (_x = searchResultOptions.fields) == null ? void 0 : _x.discountPriceKey, {
27759
+ key: (_y = searchResultOptions.fields) == null ? void 0 : _y.discountPriceKey,
27716
27760
  type: "customHtml",
27717
27761
  className: "lupa-price lupa-price-discounted",
27718
27762
  display: (doc2) => displayDiscountedPriceSection(doc2, searchResultOptions),
@@ -27734,8 +27778,8 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
27734
27778
  return discount + regular;
27735
27779
  }
27736
27780
  }),
27737
- addFieldIfKeyExists("_regularPrice", (_x = searchResultOptions.fields) == null ? void 0 : _x.regularPriceKey, {
27738
- key: (_y = searchResultOptions.fields) == null ? void 0 : _y.regularPriceKey,
27781
+ addFieldIfKeyExists("_regularPrice", (_z = searchResultOptions.fields) == null ? void 0 : _z.regularPriceKey, {
27782
+ key: (_A = searchResultOptions.fields) == null ? void 0 : _A.regularPriceKey,
27739
27783
  type: "customHtml",
27740
27784
  className: "lupa-price lupa-price-single",
27741
27785
  display: (doc2) => displayRegularPriceSection(doc2, searchResultOptions),
@@ -6166,6 +6166,7 @@ const DEFAULT_PAGE_SIZE = 12;
6166
6166
  const DEFAULT_PAGE_SIZE_SELECTION = [12, 24, 36, 60];
6167
6167
  const LUPA_ROUTING_EVENT = "lupaRedirect";
6168
6168
  const RATING_STAR_HTML = "☆";
6169
+ const RESULT_ROOT_SELECTOR = "#lupa-search-results";
6169
6170
  const production = "https://api.lupasearch.com/v1/";
6170
6171
  const staging = "https://api.staging.lupasearch.com/v1/";
6171
6172
  const Env$1 = {
@@ -7150,7 +7151,7 @@ const parseFacetKey = (key, searchParams) => {
7150
7151
  const [min, max] = range.split(FACET_RANGE_SEPARATOR);
7151
7152
  return {
7152
7153
  gte: min,
7153
- lt: max
7154
+ lte: max
7154
7155
  };
7155
7156
  }
7156
7157
  if (key.startsWith(FACET_PARAMS_TYPE.HIERARCHY)) {
@@ -8620,22 +8621,21 @@ var ResultsLayoutEnum = /* @__PURE__ */ ((ResultsLayoutEnum2) => {
8620
8621
  ResultsLayoutEnum2["LIST"] = "List";
8621
8622
  return ResultsLayoutEnum2;
8622
8623
  })(ResultsLayoutEnum || {});
8623
- const RESULT_ROOT_ID = "lupa-search-results";
8624
8624
  const SHADOW_ROOT_ID = "lupa-shadow-id";
8625
8625
  const CONTAINER_ROOT_ID = "lupa-search-container";
8626
- const scrollToSearchResults = (timeout = 500) => {
8626
+ const scrollToSearchResults = (timeout = 500, containerSelector) => {
8627
8627
  if (timeout) {
8628
- setTimeout(() => scrollTo(RESULT_ROOT_ID), timeout);
8628
+ setTimeout(() => scrollTo(containerSelector != null ? containerSelector : RESULT_ROOT_SELECTOR), timeout);
8629
8629
  } else {
8630
- scrollTo(RESULT_ROOT_ID);
8630
+ scrollTo(RESULT_ROOT_SELECTOR);
8631
8631
  }
8632
8632
  };
8633
- const scrollTo = (elementId) => {
8633
+ const scrollTo = (elementSelector) => {
8634
8634
  var _a, _b;
8635
- let el = document.getElementById(elementId);
8635
+ let el = document.querySelector(elementSelector);
8636
8636
  const shadowRoot = (_a = document.getElementById(SHADOW_ROOT_ID)) == null ? void 0 : _a.shadowRoot;
8637
8637
  if (!el) {
8638
- el = (_b = shadowRoot == null ? void 0 : shadowRoot.getElementById(elementId)) != null ? _b : null;
8638
+ el = (_b = shadowRoot == null ? void 0 : shadowRoot.getElementById(elementSelector)) != null ? _b : null;
8639
8639
  }
8640
8640
  if (!el) {
8641
8641
  return;
@@ -11457,7 +11457,7 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({
11457
11457
  return typeof currentFilters.value.gte === "string" ? parseFloat(currentFilters.value.gte) : currentFilters.value.gte;
11458
11458
  });
11459
11459
  const currentLte = computed(() => {
11460
- return typeof currentFilters.value.lt === "string" ? parseFloat(currentFilters.value.lt) : currentFilters.value.lt;
11460
+ return typeof currentFilters.value.lte === "string" ? parseFloat(currentFilters.value.lte) : currentFilters.value.lte;
11461
11461
  });
11462
11462
  const currentMinValue = computed(() => {
11463
11463
  return currentGte.value ? Math.max(currentGte.value, facetMin.value) : facetMin.value;
@@ -12004,8 +12004,10 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
12004
12004
  const props = __props;
12005
12005
  const paramStore = useParamsStore();
12006
12006
  const searchResultStore = useSearchResultStore();
12007
+ const optionsStore = useOptionsStore();
12007
12008
  const { filters } = storeToRefs(paramStore);
12008
12009
  const { facets } = storeToRefs(searchResultStore);
12010
+ const { searchResultOptions } = storeToRefs(optionsStore);
12009
12011
  computed(() => {
12010
12012
  var _a;
12011
12013
  return (_a = facets.value) == null ? void 0 : _a.filter((f2) => {
@@ -12020,6 +12022,14 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
12020
12022
  return !((_a2 = props.options.promotedFacets) == null ? void 0 : _a2.includes(f2.key));
12021
12023
  });
12022
12024
  });
12025
+ const scrollToResultsOptions = computed(() => {
12026
+ var _a, _b, _c, _d, _e, _f;
12027
+ return {
12028
+ enabled: ((_a = searchResultOptions.value.scrollToResults) == null ? void 0 : _a.enabled) === void 0 ? true : (_b = searchResultOptions.value.scrollToResults) == null ? void 0 : _b.enabled,
12029
+ container: (_d = (_c = searchResultOptions.value.scrollToResults) == null ? void 0 : _c.scrollToContainerSelector) != null ? _d : RESULT_ROOT_SELECTOR,
12030
+ timeout: (_f = (_e = searchResultOptions.value.scrollToResults) == null ? void 0 : _e.timeout) != null ? _f : 500
12031
+ };
12032
+ });
12023
12033
  const handleFacetSelect = (facetAction) => {
12024
12034
  switch (facetAction.type) {
12025
12035
  case "terms":
@@ -12032,7 +12042,12 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
12032
12042
  toggleHierarchyFilter(paramStore.appendParams, facetAction, filters.value);
12033
12043
  break;
12034
12044
  }
12035
- scrollToSearchResults();
12045
+ if (scrollToResultsOptions.value.enabled) {
12046
+ scrollToSearchResults(
12047
+ scrollToResultsOptions.value.timeout,
12048
+ scrollToResultsOptions.value.container
12049
+ );
12050
+ }
12036
12051
  };
12037
12052
  const clear2 = (facet) => {
12038
12053
  const param = getFacetKey(facet.key, facet.type);
@@ -12344,7 +12359,9 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
12344
12359
  });
12345
12360
  const paramStore = useParamsStore();
12346
12361
  const screenStore = useScreenStore();
12362
+ const optionsStore = useOptionsStore();
12347
12363
  const { isMobileWidth } = storeToRefs(screenStore);
12364
+ const { searchResultOptions } = storeToRefs(optionsStore);
12348
12365
  const pageOptionsCount = computed(() => {
12349
12366
  return isMobileWidth.value ? props.options.displayMobile : props.options.display;
12350
12367
  });
@@ -12378,12 +12395,25 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
12378
12395
  const showPagination = computed(() => {
12379
12396
  return pages.value.length > 1;
12380
12397
  });
12398
+ const scrollToResultsOptions = computed(() => {
12399
+ var _a, _b, _c, _d, _e, _f;
12400
+ return {
12401
+ enabled: ((_a = searchResultOptions.value.scrollToResults) == null ? void 0 : _a.enabled) === void 0 ? true : (_b = searchResultOptions.value.scrollToResults) == null ? void 0 : _b.enabled,
12402
+ container: (_d = (_c = searchResultOptions.value.scrollToResults) == null ? void 0 : _c.scrollToContainerSelector) != null ? _d : RESULT_ROOT_SELECTOR,
12403
+ timeout: (_f = (_e = searchResultOptions.value.scrollToResults) == null ? void 0 : _e.timeout) != null ? _f : 500
12404
+ };
12405
+ });
12381
12406
  const handlePageChange = (page) => {
12382
12407
  if (page > 0) {
12383
12408
  paramStore.appendParams({
12384
12409
  params: [{ name: QUERY_PARAMS$1.PAGE, value: page.toString() }]
12385
12410
  });
12386
- scrollToSearchResults();
12411
+ if (scrollToResultsOptions.value.enabled) {
12412
+ scrollToSearchResults(
12413
+ scrollToResultsOptions.value.timeout,
12414
+ scrollToResultsOptions.value.container
12415
+ );
12416
+ }
12387
12417
  }
12388
12418
  };
12389
12419
  return (_ctx, _cache) => {
@@ -27571,7 +27601,7 @@ const getSearchResultsComponent = ({
27571
27601
  callbacks,
27572
27602
  additionalFields
27573
27603
  }) => {
27574
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
27604
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A;
27575
27605
  const filters = searchResultOptions.showFacets ? {
27576
27606
  currentFilters: {
27577
27607
  visibility: {
@@ -27620,23 +27650,37 @@ const getSearchResultsComponent = ({
27620
27650
  sm: (_i = searchResultOptions.maxColumns) != null ? _i : 2,
27621
27651
  xs: (_j = searchResultOptions.maxColumns) != null ? _j : 1
27622
27652
  };
27623
- const badges = searchResultOptions.showRelevance ? {
27653
+ const badges = {
27624
27654
  badges: {
27625
27655
  anchor: "tr",
27626
27656
  elements: [
27627
- {
27628
- key: "",
27629
- type: "customHtml",
27630
- className: "relevance",
27631
- html: (doc2) => `${toMaxDecimalPlaces(escapeHtml(doc2._relevance), 3)}`,
27632
- display: (doc2) => Boolean(doc2._relevance !== void 0)
27633
- }
27657
+ ...searchResultOptions.showRelevance && [
27658
+ {
27659
+ key: "",
27660
+ type: "customHtml",
27661
+ className: "relevance",
27662
+ html: (doc2) => `${toMaxDecimalPlaces(escapeHtml(doc2._relevance), 3)}`,
27663
+ display: (doc2) => Boolean(doc2._relevance !== void 0)
27664
+ }
27665
+ ],
27666
+ ...((_m = (_l = searchResultOptions.boostedMarker) == null ? void 0 : _l.enabled) != null ? _m : false) && [
27667
+ {
27668
+ key: "",
27669
+ type: "customHtml",
27670
+ className: "boosted-marker",
27671
+ html: () => {
27672
+ var _a2;
27673
+ return `${escapeHtml((_a2 = searchResultOptions.boostedMarker) == null ? void 0 : _a2.label)}`;
27674
+ },
27675
+ display: (doc2) => doc2._boosted === true
27676
+ }
27677
+ ]
27634
27678
  ]
27635
27679
  }
27636
- } : {};
27680
+ };
27637
27681
  return __spreadValues(__spreadProps(__spreadValues({
27638
27682
  options: {
27639
- environment: (_l = searchResultOptions.environment) != null ? _l : "production",
27683
+ environment: (_n = searchResultOptions.environment) != null ? _n : "production",
27640
27684
  customUrl: searchResultOptions.customUrl,
27641
27685
  customBaseUrl: searchResultOptions.customBaseUrl,
27642
27686
  customPayload: searchResultOptions.customPayload,
@@ -27646,7 +27690,7 @@ const getSearchResultsComponent = ({
27646
27690
  queryKey: searchResultOptions.queryKey,
27647
27691
  containerSelector: searchResultOptions.containerSelector,
27648
27692
  searchTitlePosition: "search-results-top",
27649
- titleKey: (_m = searchResultOptions.fields) == null ? void 0 : _m.titleKey,
27693
+ titleKey: (_o = searchResultOptions.fields) == null ? void 0 : _o.titleKey,
27650
27694
  labels: labels == null ? void 0 : labels.searchResults,
27651
27695
  grid: {
27652
27696
  columns
@@ -27679,7 +27723,7 @@ const getSearchResultsComponent = ({
27679
27723
  }
27680
27724
  }, badges), {
27681
27725
  links: {
27682
- details: ((_n = searchResultOptions.fields) == null ? void 0 : _n.productUrl) ? `{${(_o = searchResultOptions.fields) == null ? void 0 : _o.productUrl}}` : void 0
27726
+ details: ((_p = searchResultOptions.fields) == null ? void 0 : _p.productUrl) ? `{${(_q = searchResultOptions.fields) == null ? void 0 : _q.productUrl}}` : void 0
27683
27727
  },
27684
27728
  callbacks,
27685
27729
  routingBehavior: callbacks ? "event" : "direct-link",
@@ -27688,31 +27732,31 @@ const getSearchResultsComponent = ({
27688
27732
  {
27689
27733
  type: "image",
27690
27734
  placeholder: placeholderImage,
27691
- key: (_p = searchResultOptions.fields) == null ? void 0 : _p.imageKey,
27692
- baseUrl: (_q = searchResultOptions.fields) == null ? void 0 : _q.baseImageUrl,
27735
+ key: (_r = searchResultOptions.fields) == null ? void 0 : _r.imageKey,
27736
+ baseUrl: (_s = searchResultOptions.fields) == null ? void 0 : _s.baseImageUrl,
27693
27737
  display: () => {
27694
27738
  var _a2;
27695
27739
  return (_a2 = searchResultOptions.fields) == null ? void 0 : _a2.imageKey;
27696
27740
  }
27697
27741
  },
27698
- addFieldIfKeyExists("_emphasis", (_r = searchResultOptions.fields) == null ? void 0 : _r.emphasizedField, {
27742
+ addFieldIfKeyExists("_emphasis", (_t = searchResultOptions.fields) == null ? void 0 : _t.emphasizedField, {
27699
27743
  type: "custom",
27700
27744
  className: "lupa-custom-emphasis",
27701
- key: (_s = searchResultOptions.fields) == null ? void 0 : _s.emphasizedField,
27745
+ key: (_u = searchResultOptions.fields) == null ? void 0 : _u.emphasizedField,
27702
27746
  display: () => true
27703
27747
  }),
27704
27748
  {
27705
27749
  type: "title",
27706
- key: (_t = searchResultOptions.fields) == null ? void 0 : _t.titleKey,
27707
- maxLines: (_u = searchResultOptions.maxLines) != null ? _u : 2,
27750
+ key: (_v = searchResultOptions.fields) == null ? void 0 : _v.titleKey,
27751
+ maxLines: (_w = searchResultOptions.maxLines) != null ? _w : 2,
27708
27752
  display: (doc2) => {
27709
27753
  var _a2, _b2;
27710
27754
  return ((_a2 = searchResultOptions.fields) == null ? void 0 : _a2.titleKey) && Boolean(doc2[(_b2 = searchResultOptions.fields) == null ? void 0 : _b2.titleKey]);
27711
27755
  }
27712
27756
  },
27713
27757
  ...getAdditionalElements(additionalFields),
27714
- addFieldIfKeyExists("_discountPrice", (_v = searchResultOptions.fields) == null ? void 0 : _v.discountPriceKey, {
27715
- key: (_w = searchResultOptions.fields) == null ? void 0 : _w.discountPriceKey,
27758
+ addFieldIfKeyExists("_discountPrice", (_x = searchResultOptions.fields) == null ? void 0 : _x.discountPriceKey, {
27759
+ key: (_y = searchResultOptions.fields) == null ? void 0 : _y.discountPriceKey,
27716
27760
  type: "customHtml",
27717
27761
  className: "lupa-price lupa-price-discounted",
27718
27762
  display: (doc2) => displayDiscountedPriceSection(doc2, searchResultOptions),
@@ -27734,8 +27778,8 @@ const getSearchResultsComponent = ({
27734
27778
  return discount + regular;
27735
27779
  }
27736
27780
  }),
27737
- addFieldIfKeyExists("_regularPrice", (_x = searchResultOptions.fields) == null ? void 0 : _x.regularPriceKey, {
27738
- key: (_y = searchResultOptions.fields) == null ? void 0 : _y.regularPriceKey,
27781
+ addFieldIfKeyExists("_regularPrice", (_z = searchResultOptions.fields) == null ? void 0 : _z.regularPriceKey, {
27782
+ key: (_A = searchResultOptions.fields) == null ? void 0 : _A.regularPriceKey,
27739
27783
  type: "customHtml",
27740
27784
  className: "lupa-price lupa-price-single",
27741
27785
  display: (doc2) => displayRegularPriceSection(doc2, searchResultOptions),
@@ -6164,6 +6164,7 @@ const DEFAULT_PAGE_SIZE = 12;
6164
6164
  const DEFAULT_PAGE_SIZE_SELECTION = [12, 24, 36, 60];
6165
6165
  const LUPA_ROUTING_EVENT = "lupaRedirect";
6166
6166
  const RATING_STAR_HTML = "☆";
6167
+ const RESULT_ROOT_SELECTOR = "#lupa-search-results";
6167
6168
  const production = "https://api.lupasearch.com/v1/";
6168
6169
  const staging = "https://api.staging.lupasearch.com/v1/";
6169
6170
  const Env$1 = {
@@ -7148,7 +7149,7 @@ const parseFacetKey = (key, searchParams) => {
7148
7149
  const [min, max] = range.split(FACET_RANGE_SEPARATOR);
7149
7150
  return {
7150
7151
  gte: min,
7151
- lt: max
7152
+ lte: max
7152
7153
  };
7153
7154
  }
7154
7155
  if (key.startsWith(FACET_PARAMS_TYPE.HIERARCHY)) {
@@ -8618,22 +8619,21 @@ var ResultsLayoutEnum = /* @__PURE__ */ ((ResultsLayoutEnum2) => {
8618
8619
  ResultsLayoutEnum2["LIST"] = "List";
8619
8620
  return ResultsLayoutEnum2;
8620
8621
  })(ResultsLayoutEnum || {});
8621
- const RESULT_ROOT_ID = "lupa-search-results";
8622
8622
  const SHADOW_ROOT_ID = "lupa-shadow-id";
8623
8623
  const CONTAINER_ROOT_ID = "lupa-search-container";
8624
- const scrollToSearchResults = (timeout = 500) => {
8624
+ const scrollToSearchResults = (timeout = 500, containerSelector) => {
8625
8625
  if (timeout) {
8626
- setTimeout(() => scrollTo(RESULT_ROOT_ID), timeout);
8626
+ setTimeout(() => scrollTo(containerSelector != null ? containerSelector : RESULT_ROOT_SELECTOR), timeout);
8627
8627
  } else {
8628
- scrollTo(RESULT_ROOT_ID);
8628
+ scrollTo(RESULT_ROOT_SELECTOR);
8629
8629
  }
8630
8630
  };
8631
- const scrollTo = (elementId) => {
8631
+ const scrollTo = (elementSelector) => {
8632
8632
  var _a, _b;
8633
- let el = document.getElementById(elementId);
8633
+ let el = document.querySelector(elementSelector);
8634
8634
  const shadowRoot = (_a = document.getElementById(SHADOW_ROOT_ID)) == null ? void 0 : _a.shadowRoot;
8635
8635
  if (!el) {
8636
- el = (_b = shadowRoot == null ? void 0 : shadowRoot.getElementById(elementId)) != null ? _b : null;
8636
+ el = (_b = shadowRoot == null ? void 0 : shadowRoot.getElementById(elementSelector)) != null ? _b : null;
8637
8637
  }
8638
8638
  if (!el) {
8639
8639
  return;
@@ -11455,7 +11455,7 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({
11455
11455
  return typeof currentFilters.value.gte === "string" ? parseFloat(currentFilters.value.gte) : currentFilters.value.gte;
11456
11456
  });
11457
11457
  const currentLte = computed(() => {
11458
- return typeof currentFilters.value.lt === "string" ? parseFloat(currentFilters.value.lt) : currentFilters.value.lt;
11458
+ return typeof currentFilters.value.lte === "string" ? parseFloat(currentFilters.value.lte) : currentFilters.value.lte;
11459
11459
  });
11460
11460
  const currentMinValue = computed(() => {
11461
11461
  return currentGte.value ? Math.max(currentGte.value, facetMin.value) : facetMin.value;
@@ -12002,8 +12002,10 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
12002
12002
  const props = __props;
12003
12003
  const paramStore = useParamsStore();
12004
12004
  const searchResultStore = useSearchResultStore();
12005
+ const optionsStore = useOptionsStore();
12005
12006
  const { filters } = storeToRefs(paramStore);
12006
12007
  const { facets } = storeToRefs(searchResultStore);
12008
+ const { searchResultOptions } = storeToRefs(optionsStore);
12007
12009
  computed(() => {
12008
12010
  var _a;
12009
12011
  return (_a = facets.value) == null ? void 0 : _a.filter((f2) => {
@@ -12018,6 +12020,14 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
12018
12020
  return !((_a2 = props.options.promotedFacets) == null ? void 0 : _a2.includes(f2.key));
12019
12021
  });
12020
12022
  });
12023
+ const scrollToResultsOptions = computed(() => {
12024
+ var _a, _b, _c, _d, _e, _f;
12025
+ return {
12026
+ enabled: ((_a = searchResultOptions.value.scrollToResults) == null ? void 0 : _a.enabled) === void 0 ? true : (_b = searchResultOptions.value.scrollToResults) == null ? void 0 : _b.enabled,
12027
+ container: (_d = (_c = searchResultOptions.value.scrollToResults) == null ? void 0 : _c.scrollToContainerSelector) != null ? _d : RESULT_ROOT_SELECTOR,
12028
+ timeout: (_f = (_e = searchResultOptions.value.scrollToResults) == null ? void 0 : _e.timeout) != null ? _f : 500
12029
+ };
12030
+ });
12021
12031
  const handleFacetSelect = (facetAction) => {
12022
12032
  switch (facetAction.type) {
12023
12033
  case "terms":
@@ -12030,7 +12040,12 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
12030
12040
  toggleHierarchyFilter(paramStore.appendParams, facetAction, filters.value);
12031
12041
  break;
12032
12042
  }
12033
- scrollToSearchResults();
12043
+ if (scrollToResultsOptions.value.enabled) {
12044
+ scrollToSearchResults(
12045
+ scrollToResultsOptions.value.timeout,
12046
+ scrollToResultsOptions.value.container
12047
+ );
12048
+ }
12034
12049
  };
12035
12050
  const clear2 = (facet) => {
12036
12051
  const param = getFacetKey(facet.key, facet.type);
@@ -12342,7 +12357,9 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
12342
12357
  });
12343
12358
  const paramStore = useParamsStore();
12344
12359
  const screenStore = useScreenStore();
12360
+ const optionsStore = useOptionsStore();
12345
12361
  const { isMobileWidth } = storeToRefs(screenStore);
12362
+ const { searchResultOptions } = storeToRefs(optionsStore);
12346
12363
  const pageOptionsCount = computed(() => {
12347
12364
  return isMobileWidth.value ? props.options.displayMobile : props.options.display;
12348
12365
  });
@@ -12376,12 +12393,25 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
12376
12393
  const showPagination = computed(() => {
12377
12394
  return pages.value.length > 1;
12378
12395
  });
12396
+ const scrollToResultsOptions = computed(() => {
12397
+ var _a, _b, _c, _d, _e, _f;
12398
+ return {
12399
+ enabled: ((_a = searchResultOptions.value.scrollToResults) == null ? void 0 : _a.enabled) === void 0 ? true : (_b = searchResultOptions.value.scrollToResults) == null ? void 0 : _b.enabled,
12400
+ container: (_d = (_c = searchResultOptions.value.scrollToResults) == null ? void 0 : _c.scrollToContainerSelector) != null ? _d : RESULT_ROOT_SELECTOR,
12401
+ timeout: (_f = (_e = searchResultOptions.value.scrollToResults) == null ? void 0 : _e.timeout) != null ? _f : 500
12402
+ };
12403
+ });
12379
12404
  const handlePageChange = (page) => {
12380
12405
  if (page > 0) {
12381
12406
  paramStore.appendParams({
12382
12407
  params: [{ name: QUERY_PARAMS$1.PAGE, value: page.toString() }]
12383
12408
  });
12384
- scrollToSearchResults();
12409
+ if (scrollToResultsOptions.value.enabled) {
12410
+ scrollToSearchResults(
12411
+ scrollToResultsOptions.value.timeout,
12412
+ scrollToResultsOptions.value.container
12413
+ );
12414
+ }
12385
12415
  }
12386
12416
  };
12387
12417
  return (_ctx, _cache) => {
@@ -27569,7 +27599,7 @@ const getSearchResultsComponent = ({
27569
27599
  callbacks,
27570
27600
  additionalFields
27571
27601
  }) => {
27572
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
27602
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A;
27573
27603
  const filters = searchResultOptions.showFacets ? {
27574
27604
  currentFilters: {
27575
27605
  visibility: {
@@ -27618,23 +27648,37 @@ const getSearchResultsComponent = ({
27618
27648
  sm: (_i = searchResultOptions.maxColumns) != null ? _i : 2,
27619
27649
  xs: (_j = searchResultOptions.maxColumns) != null ? _j : 1
27620
27650
  };
27621
- const badges = searchResultOptions.showRelevance ? {
27651
+ const badges = {
27622
27652
  badges: {
27623
27653
  anchor: "tr",
27624
27654
  elements: [
27625
- {
27626
- key: "",
27627
- type: "customHtml",
27628
- className: "relevance",
27629
- html: (doc2) => `${toMaxDecimalPlaces(escapeHtml(doc2._relevance), 3)}`,
27630
- display: (doc2) => Boolean(doc2._relevance !== void 0)
27631
- }
27655
+ ...searchResultOptions.showRelevance && [
27656
+ {
27657
+ key: "",
27658
+ type: "customHtml",
27659
+ className: "relevance",
27660
+ html: (doc2) => `${toMaxDecimalPlaces(escapeHtml(doc2._relevance), 3)}`,
27661
+ display: (doc2) => Boolean(doc2._relevance !== void 0)
27662
+ }
27663
+ ],
27664
+ ...((_m = (_l = searchResultOptions.boostedMarker) == null ? void 0 : _l.enabled) != null ? _m : false) && [
27665
+ {
27666
+ key: "",
27667
+ type: "customHtml",
27668
+ className: "boosted-marker",
27669
+ html: () => {
27670
+ var _a2;
27671
+ return `${escapeHtml((_a2 = searchResultOptions.boostedMarker) == null ? void 0 : _a2.label)}`;
27672
+ },
27673
+ display: (doc2) => doc2._boosted === true
27674
+ }
27675
+ ]
27632
27676
  ]
27633
27677
  }
27634
- } : {};
27678
+ };
27635
27679
  return __spreadValues(__spreadProps(__spreadValues({
27636
27680
  options: {
27637
- environment: (_l = searchResultOptions.environment) != null ? _l : "production",
27681
+ environment: (_n = searchResultOptions.environment) != null ? _n : "production",
27638
27682
  customUrl: searchResultOptions.customUrl,
27639
27683
  customBaseUrl: searchResultOptions.customBaseUrl,
27640
27684
  customPayload: searchResultOptions.customPayload,
@@ -27644,7 +27688,7 @@ const getSearchResultsComponent = ({
27644
27688
  queryKey: searchResultOptions.queryKey,
27645
27689
  containerSelector: searchResultOptions.containerSelector,
27646
27690
  searchTitlePosition: "search-results-top",
27647
- titleKey: (_m = searchResultOptions.fields) == null ? void 0 : _m.titleKey,
27691
+ titleKey: (_o = searchResultOptions.fields) == null ? void 0 : _o.titleKey,
27648
27692
  labels: labels == null ? void 0 : labels.searchResults,
27649
27693
  grid: {
27650
27694
  columns
@@ -27677,7 +27721,7 @@ const getSearchResultsComponent = ({
27677
27721
  }
27678
27722
  }, badges), {
27679
27723
  links: {
27680
- details: ((_n = searchResultOptions.fields) == null ? void 0 : _n.productUrl) ? `{${(_o = searchResultOptions.fields) == null ? void 0 : _o.productUrl}}` : void 0
27724
+ details: ((_p = searchResultOptions.fields) == null ? void 0 : _p.productUrl) ? `{${(_q = searchResultOptions.fields) == null ? void 0 : _q.productUrl}}` : void 0
27681
27725
  },
27682
27726
  callbacks,
27683
27727
  routingBehavior: callbacks ? "event" : "direct-link",
@@ -27686,31 +27730,31 @@ const getSearchResultsComponent = ({
27686
27730
  {
27687
27731
  type: "image",
27688
27732
  placeholder: placeholderImage,
27689
- key: (_p = searchResultOptions.fields) == null ? void 0 : _p.imageKey,
27690
- baseUrl: (_q = searchResultOptions.fields) == null ? void 0 : _q.baseImageUrl,
27733
+ key: (_r = searchResultOptions.fields) == null ? void 0 : _r.imageKey,
27734
+ baseUrl: (_s = searchResultOptions.fields) == null ? void 0 : _s.baseImageUrl,
27691
27735
  display: () => {
27692
27736
  var _a2;
27693
27737
  return (_a2 = searchResultOptions.fields) == null ? void 0 : _a2.imageKey;
27694
27738
  }
27695
27739
  },
27696
- addFieldIfKeyExists("_emphasis", (_r = searchResultOptions.fields) == null ? void 0 : _r.emphasizedField, {
27740
+ addFieldIfKeyExists("_emphasis", (_t = searchResultOptions.fields) == null ? void 0 : _t.emphasizedField, {
27697
27741
  type: "custom",
27698
27742
  className: "lupa-custom-emphasis",
27699
- key: (_s = searchResultOptions.fields) == null ? void 0 : _s.emphasizedField,
27743
+ key: (_u = searchResultOptions.fields) == null ? void 0 : _u.emphasizedField,
27700
27744
  display: () => true
27701
27745
  }),
27702
27746
  {
27703
27747
  type: "title",
27704
- key: (_t = searchResultOptions.fields) == null ? void 0 : _t.titleKey,
27705
- maxLines: (_u = searchResultOptions.maxLines) != null ? _u : 2,
27748
+ key: (_v = searchResultOptions.fields) == null ? void 0 : _v.titleKey,
27749
+ maxLines: (_w = searchResultOptions.maxLines) != null ? _w : 2,
27706
27750
  display: (doc2) => {
27707
27751
  var _a2, _b2;
27708
27752
  return ((_a2 = searchResultOptions.fields) == null ? void 0 : _a2.titleKey) && Boolean(doc2[(_b2 = searchResultOptions.fields) == null ? void 0 : _b2.titleKey]);
27709
27753
  }
27710
27754
  },
27711
27755
  ...getAdditionalElements(additionalFields),
27712
- addFieldIfKeyExists("_discountPrice", (_v = searchResultOptions.fields) == null ? void 0 : _v.discountPriceKey, {
27713
- key: (_w = searchResultOptions.fields) == null ? void 0 : _w.discountPriceKey,
27756
+ addFieldIfKeyExists("_discountPrice", (_x = searchResultOptions.fields) == null ? void 0 : _x.discountPriceKey, {
27757
+ key: (_y = searchResultOptions.fields) == null ? void 0 : _y.discountPriceKey,
27714
27758
  type: "customHtml",
27715
27759
  className: "lupa-price lupa-price-discounted",
27716
27760
  display: (doc2) => displayDiscountedPriceSection(doc2, searchResultOptions),
@@ -27732,8 +27776,8 @@ const getSearchResultsComponent = ({
27732
27776
  return discount + regular;
27733
27777
  }
27734
27778
  }),
27735
- addFieldIfKeyExists("_regularPrice", (_x = searchResultOptions.fields) == null ? void 0 : _x.regularPriceKey, {
27736
- key: (_y = searchResultOptions.fields) == null ? void 0 : _y.regularPriceKey,
27779
+ addFieldIfKeyExists("_regularPrice", (_z = searchResultOptions.fields) == null ? void 0 : _z.regularPriceKey, {
27780
+ key: (_A = searchResultOptions.fields) == null ? void 0 : _A.regularPriceKey,
27737
27781
  type: "customHtml",
27738
27782
  className: "lupa-price lupa-price-single",
27739
27783
  display: (doc2) => displayRegularPriceSection(doc2, searchResultOptions),
@@ -6168,6 +6168,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
6168
6168
  const DEFAULT_PAGE_SIZE_SELECTION = [12, 24, 36, 60];
6169
6169
  const LUPA_ROUTING_EVENT = "lupaRedirect";
6170
6170
  const RATING_STAR_HTML = "☆";
6171
+ const RESULT_ROOT_SELECTOR = "#lupa-search-results";
6171
6172
  const production = "https://api.lupasearch.com/v1/";
6172
6173
  const staging = "https://api.staging.lupasearch.com/v1/";
6173
6174
  const Env$1 = {
@@ -7152,7 +7153,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7152
7153
  const [min, max] = range.split(FACET_RANGE_SEPARATOR);
7153
7154
  return {
7154
7155
  gte: min,
7155
- lt: max
7156
+ lte: max
7156
7157
  };
7157
7158
  }
7158
7159
  if (key.startsWith(FACET_PARAMS_TYPE.HIERARCHY)) {
@@ -8622,22 +8623,21 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8622
8623
  ResultsLayoutEnum2["LIST"] = "List";
8623
8624
  return ResultsLayoutEnum2;
8624
8625
  })(ResultsLayoutEnum || {});
8625
- const RESULT_ROOT_ID = "lupa-search-results";
8626
8626
  const SHADOW_ROOT_ID = "lupa-shadow-id";
8627
8627
  const CONTAINER_ROOT_ID = "lupa-search-container";
8628
- const scrollToSearchResults = (timeout = 500) => {
8628
+ const scrollToSearchResults = (timeout = 500, containerSelector) => {
8629
8629
  if (timeout) {
8630
- setTimeout(() => scrollTo(RESULT_ROOT_ID), timeout);
8630
+ setTimeout(() => scrollTo(containerSelector != null ? containerSelector : RESULT_ROOT_SELECTOR), timeout);
8631
8631
  } else {
8632
- scrollTo(RESULT_ROOT_ID);
8632
+ scrollTo(RESULT_ROOT_SELECTOR);
8633
8633
  }
8634
8634
  };
8635
- const scrollTo = (elementId) => {
8635
+ const scrollTo = (elementSelector) => {
8636
8636
  var _a, _b;
8637
- let el = document.getElementById(elementId);
8637
+ let el = document.querySelector(elementSelector);
8638
8638
  const shadowRoot = (_a = document.getElementById(SHADOW_ROOT_ID)) == null ? void 0 : _a.shadowRoot;
8639
8639
  if (!el) {
8640
- el = (_b = shadowRoot == null ? void 0 : shadowRoot.getElementById(elementId)) != null ? _b : null;
8640
+ el = (_b = shadowRoot == null ? void 0 : shadowRoot.getElementById(elementSelector)) != null ? _b : null;
8641
8641
  }
8642
8642
  if (!el) {
8643
8643
  return;
@@ -11459,7 +11459,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
11459
11459
  return typeof currentFilters.value.gte === "string" ? parseFloat(currentFilters.value.gte) : currentFilters.value.gte;
11460
11460
  });
11461
11461
  const currentLte = computed(() => {
11462
- return typeof currentFilters.value.lt === "string" ? parseFloat(currentFilters.value.lt) : currentFilters.value.lt;
11462
+ return typeof currentFilters.value.lte === "string" ? parseFloat(currentFilters.value.lte) : currentFilters.value.lte;
11463
11463
  });
11464
11464
  const currentMinValue = computed(() => {
11465
11465
  return currentGte.value ? Math.max(currentGte.value, facetMin.value) : facetMin.value;
@@ -12006,8 +12006,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
12006
12006
  const props = __props;
12007
12007
  const paramStore = useParamsStore();
12008
12008
  const searchResultStore = useSearchResultStore();
12009
+ const optionsStore = useOptionsStore();
12009
12010
  const { filters } = storeToRefs(paramStore);
12010
12011
  const { facets } = storeToRefs(searchResultStore);
12012
+ const { searchResultOptions } = storeToRefs(optionsStore);
12011
12013
  computed(() => {
12012
12014
  var _a;
12013
12015
  return (_a = facets.value) == null ? void 0 : _a.filter((f2) => {
@@ -12022,6 +12024,14 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
12022
12024
  return !((_a2 = props.options.promotedFacets) == null ? void 0 : _a2.includes(f2.key));
12023
12025
  });
12024
12026
  });
12027
+ const scrollToResultsOptions = computed(() => {
12028
+ var _a, _b, _c, _d, _e, _f;
12029
+ return {
12030
+ enabled: ((_a = searchResultOptions.value.scrollToResults) == null ? void 0 : _a.enabled) === void 0 ? true : (_b = searchResultOptions.value.scrollToResults) == null ? void 0 : _b.enabled,
12031
+ container: (_d = (_c = searchResultOptions.value.scrollToResults) == null ? void 0 : _c.scrollToContainerSelector) != null ? _d : RESULT_ROOT_SELECTOR,
12032
+ timeout: (_f = (_e = searchResultOptions.value.scrollToResults) == null ? void 0 : _e.timeout) != null ? _f : 500
12033
+ };
12034
+ });
12025
12035
  const handleFacetSelect = (facetAction) => {
12026
12036
  switch (facetAction.type) {
12027
12037
  case "terms":
@@ -12034,7 +12044,12 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
12034
12044
  toggleHierarchyFilter(paramStore.appendParams, facetAction, filters.value);
12035
12045
  break;
12036
12046
  }
12037
- scrollToSearchResults();
12047
+ if (scrollToResultsOptions.value.enabled) {
12048
+ scrollToSearchResults(
12049
+ scrollToResultsOptions.value.timeout,
12050
+ scrollToResultsOptions.value.container
12051
+ );
12052
+ }
12038
12053
  };
12039
12054
  const clear2 = (facet) => {
12040
12055
  const param = getFacetKey(facet.key, facet.type);
@@ -12346,7 +12361,9 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
12346
12361
  });
12347
12362
  const paramStore = useParamsStore();
12348
12363
  const screenStore = useScreenStore();
12364
+ const optionsStore = useOptionsStore();
12349
12365
  const { isMobileWidth } = storeToRefs(screenStore);
12366
+ const { searchResultOptions } = storeToRefs(optionsStore);
12350
12367
  const pageOptionsCount = computed(() => {
12351
12368
  return isMobileWidth.value ? props.options.displayMobile : props.options.display;
12352
12369
  });
@@ -12380,12 +12397,25 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
12380
12397
  const showPagination = computed(() => {
12381
12398
  return pages.value.length > 1;
12382
12399
  });
12400
+ const scrollToResultsOptions = computed(() => {
12401
+ var _a, _b, _c, _d, _e, _f;
12402
+ return {
12403
+ enabled: ((_a = searchResultOptions.value.scrollToResults) == null ? void 0 : _a.enabled) === void 0 ? true : (_b = searchResultOptions.value.scrollToResults) == null ? void 0 : _b.enabled,
12404
+ container: (_d = (_c = searchResultOptions.value.scrollToResults) == null ? void 0 : _c.scrollToContainerSelector) != null ? _d : RESULT_ROOT_SELECTOR,
12405
+ timeout: (_f = (_e = searchResultOptions.value.scrollToResults) == null ? void 0 : _e.timeout) != null ? _f : 500
12406
+ };
12407
+ });
12383
12408
  const handlePageChange = (page) => {
12384
12409
  if (page > 0) {
12385
12410
  paramStore.appendParams({
12386
12411
  params: [{ name: QUERY_PARAMS$1.PAGE, value: page.toString() }]
12387
12412
  });
12388
- scrollToSearchResults();
12413
+ if (scrollToResultsOptions.value.enabled) {
12414
+ scrollToSearchResults(
12415
+ scrollToResultsOptions.value.timeout,
12416
+ scrollToResultsOptions.value.container
12417
+ );
12418
+ }
12389
12419
  }
12390
12420
  };
12391
12421
  return (_ctx, _cache) => {
@@ -27573,7 +27603,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
27573
27603
  callbacks,
27574
27604
  additionalFields
27575
27605
  }) => {
27576
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
27606
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A;
27577
27607
  const filters = searchResultOptions.showFacets ? {
27578
27608
  currentFilters: {
27579
27609
  visibility: {
@@ -27622,23 +27652,37 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
27622
27652
  sm: (_i = searchResultOptions.maxColumns) != null ? _i : 2,
27623
27653
  xs: (_j = searchResultOptions.maxColumns) != null ? _j : 1
27624
27654
  };
27625
- const badges = searchResultOptions.showRelevance ? {
27655
+ const badges = {
27626
27656
  badges: {
27627
27657
  anchor: "tr",
27628
27658
  elements: [
27629
- {
27630
- key: "",
27631
- type: "customHtml",
27632
- className: "relevance",
27633
- html: (doc2) => `${toMaxDecimalPlaces(escapeHtml(doc2._relevance), 3)}`,
27634
- display: (doc2) => Boolean(doc2._relevance !== void 0)
27635
- }
27659
+ ...searchResultOptions.showRelevance && [
27660
+ {
27661
+ key: "",
27662
+ type: "customHtml",
27663
+ className: "relevance",
27664
+ html: (doc2) => `${toMaxDecimalPlaces(escapeHtml(doc2._relevance), 3)}`,
27665
+ display: (doc2) => Boolean(doc2._relevance !== void 0)
27666
+ }
27667
+ ],
27668
+ ...((_m = (_l = searchResultOptions.boostedMarker) == null ? void 0 : _l.enabled) != null ? _m : false) && [
27669
+ {
27670
+ key: "",
27671
+ type: "customHtml",
27672
+ className: "boosted-marker",
27673
+ html: () => {
27674
+ var _a2;
27675
+ return `${escapeHtml((_a2 = searchResultOptions.boostedMarker) == null ? void 0 : _a2.label)}`;
27676
+ },
27677
+ display: (doc2) => doc2._boosted === true
27678
+ }
27679
+ ]
27636
27680
  ]
27637
27681
  }
27638
- } : {};
27682
+ };
27639
27683
  return __spreadValues(__spreadProps(__spreadValues({
27640
27684
  options: {
27641
- environment: (_l = searchResultOptions.environment) != null ? _l : "production",
27685
+ environment: (_n = searchResultOptions.environment) != null ? _n : "production",
27642
27686
  customUrl: searchResultOptions.customUrl,
27643
27687
  customBaseUrl: searchResultOptions.customBaseUrl,
27644
27688
  customPayload: searchResultOptions.customPayload,
@@ -27648,7 +27692,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
27648
27692
  queryKey: searchResultOptions.queryKey,
27649
27693
  containerSelector: searchResultOptions.containerSelector,
27650
27694
  searchTitlePosition: "search-results-top",
27651
- titleKey: (_m = searchResultOptions.fields) == null ? void 0 : _m.titleKey,
27695
+ titleKey: (_o = searchResultOptions.fields) == null ? void 0 : _o.titleKey,
27652
27696
  labels: labels == null ? void 0 : labels.searchResults,
27653
27697
  grid: {
27654
27698
  columns
@@ -27681,7 +27725,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
27681
27725
  }
27682
27726
  }, badges), {
27683
27727
  links: {
27684
- details: ((_n = searchResultOptions.fields) == null ? void 0 : _n.productUrl) ? `{${(_o = searchResultOptions.fields) == null ? void 0 : _o.productUrl}}` : void 0
27728
+ details: ((_p = searchResultOptions.fields) == null ? void 0 : _p.productUrl) ? `{${(_q = searchResultOptions.fields) == null ? void 0 : _q.productUrl}}` : void 0
27685
27729
  },
27686
27730
  callbacks,
27687
27731
  routingBehavior: callbacks ? "event" : "direct-link",
@@ -27690,31 +27734,31 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
27690
27734
  {
27691
27735
  type: "image",
27692
27736
  placeholder: placeholderImage,
27693
- key: (_p = searchResultOptions.fields) == null ? void 0 : _p.imageKey,
27694
- baseUrl: (_q = searchResultOptions.fields) == null ? void 0 : _q.baseImageUrl,
27737
+ key: (_r = searchResultOptions.fields) == null ? void 0 : _r.imageKey,
27738
+ baseUrl: (_s = searchResultOptions.fields) == null ? void 0 : _s.baseImageUrl,
27695
27739
  display: () => {
27696
27740
  var _a2;
27697
27741
  return (_a2 = searchResultOptions.fields) == null ? void 0 : _a2.imageKey;
27698
27742
  }
27699
27743
  },
27700
- addFieldIfKeyExists("_emphasis", (_r = searchResultOptions.fields) == null ? void 0 : _r.emphasizedField, {
27744
+ addFieldIfKeyExists("_emphasis", (_t = searchResultOptions.fields) == null ? void 0 : _t.emphasizedField, {
27701
27745
  type: "custom",
27702
27746
  className: "lupa-custom-emphasis",
27703
- key: (_s = searchResultOptions.fields) == null ? void 0 : _s.emphasizedField,
27747
+ key: (_u = searchResultOptions.fields) == null ? void 0 : _u.emphasizedField,
27704
27748
  display: () => true
27705
27749
  }),
27706
27750
  {
27707
27751
  type: "title",
27708
- key: (_t = searchResultOptions.fields) == null ? void 0 : _t.titleKey,
27709
- maxLines: (_u = searchResultOptions.maxLines) != null ? _u : 2,
27752
+ key: (_v = searchResultOptions.fields) == null ? void 0 : _v.titleKey,
27753
+ maxLines: (_w = searchResultOptions.maxLines) != null ? _w : 2,
27710
27754
  display: (doc2) => {
27711
27755
  var _a2, _b2;
27712
27756
  return ((_a2 = searchResultOptions.fields) == null ? void 0 : _a2.titleKey) && Boolean(doc2[(_b2 = searchResultOptions.fields) == null ? void 0 : _b2.titleKey]);
27713
27757
  }
27714
27758
  },
27715
27759
  ...getAdditionalElements(additionalFields),
27716
- addFieldIfKeyExists("_discountPrice", (_v = searchResultOptions.fields) == null ? void 0 : _v.discountPriceKey, {
27717
- key: (_w = searchResultOptions.fields) == null ? void 0 : _w.discountPriceKey,
27760
+ addFieldIfKeyExists("_discountPrice", (_x = searchResultOptions.fields) == null ? void 0 : _x.discountPriceKey, {
27761
+ key: (_y = searchResultOptions.fields) == null ? void 0 : _y.discountPriceKey,
27718
27762
  type: "customHtml",
27719
27763
  className: "lupa-price lupa-price-discounted",
27720
27764
  display: (doc2) => displayDiscountedPriceSection(doc2, searchResultOptions),
@@ -27736,8 +27780,8 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
27736
27780
  return discount + regular;
27737
27781
  }
27738
27782
  }),
27739
- addFieldIfKeyExists("_regularPrice", (_x = searchResultOptions.fields) == null ? void 0 : _x.regularPriceKey, {
27740
- key: (_y = searchResultOptions.fields) == null ? void 0 : _y.regularPriceKey,
27783
+ addFieldIfKeyExists("_regularPrice", (_z = searchResultOptions.fields) == null ? void 0 : _z.regularPriceKey, {
27784
+ key: (_A = searchResultOptions.fields) == null ? void 0 : _A.regularPriceKey,
27741
27785
  type: "customHtml",
27742
27786
  className: "lupa-price lupa-price-single",
27743
27787
  display: (doc2) => displayRegularPriceSection(doc2, searchResultOptions),
@@ -37,6 +37,10 @@ export type SearchResultDemoOptions = {
37
37
  customHeaders?: Record<string, string>;
38
38
  gridConfiguration?: Record<string, number>;
39
39
  showRelevance?: boolean;
40
+ boostedMarker?: {
41
+ enabled: boolean;
42
+ label: string;
43
+ };
40
44
  errorHandler?: (errorResponse: any) => unknown;
41
45
  };
42
46
  export type PreconfiguredSearchContainerOptions = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getlupa/client",
3
- "version": "1.8.2",
3
+ "version": "1.8.4",
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.8.1",
23
+ "@getlupa/vue": "0.8.3",
24
24
  "@rushstack/eslint-patch": "^1.3.2",
25
25
  "@tsconfig/node18": "^2.0.1",
26
26
  "@types/jsdom": "^21.1.1",