@getlupa/client 1.0.5 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7635,16 +7635,16 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7635
7635
  resetHighlightIndex
7636
7636
  };
7637
7637
  });
7638
- const _hoisted_1$11 = { id: "lupa-search-box-input-container" };
7639
- const _hoisted_2$H = { class: "lupa-input-clear" };
7640
- const _hoisted_3$t = { id: "lupa-search-box-input" };
7641
- const _hoisted_4$l = ["value"];
7638
+ const _hoisted_1$12 = { id: "lupa-search-box-input-container" };
7639
+ const _hoisted_2$I = { class: "lupa-input-clear" };
7640
+ const _hoisted_3$u = { id: "lupa-search-box-input" };
7641
+ const _hoisted_4$m = ["value"];
7642
7642
  const _hoisted_5$c = ["placeholder"];
7643
7643
  const _hoisted_6$6 = {
7644
7644
  key: 0,
7645
7645
  class: "lupa-close-label"
7646
7646
  };
7647
- const _sfc_main$19 = /* @__PURE__ */ defineComponent({
7647
+ const _sfc_main$1a = /* @__PURE__ */ defineComponent({
7648
7648
  __name: "SearchBoxInput",
7649
7649
  props: {
7650
7650
  options: {},
@@ -7721,19 +7721,19 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7721
7721
  };
7722
7722
  __expose({ focus });
7723
7723
  return (_ctx, _cache) => {
7724
- return openBlock(), createElementBlock("div", _hoisted_1$11, [
7725
- createBaseVNode("div", _hoisted_2$H, [
7724
+ return openBlock(), createElementBlock("div", _hoisted_1$12, [
7725
+ createBaseVNode("div", _hoisted_2$I, [
7726
7726
  createBaseVNode("div", {
7727
7727
  class: normalizeClass(["lupa-input-clear-content", { "lupa-input-clear-filled": inputValue.value }]),
7728
7728
  onClick: clear2
7729
7729
  }, null, 2)
7730
7730
  ]),
7731
- createBaseVNode("div", _hoisted_3$t, [
7731
+ createBaseVNode("div", _hoisted_3$u, [
7732
7732
  createBaseVNode("input", {
7733
7733
  class: "lupa-hint",
7734
7734
  value: showHint.value ? suggestedValue.value.item.suggestion : "",
7735
7735
  disabled: ""
7736
- }, null, 8, _hoisted_4$l),
7736
+ }, null, 8, _hoisted_4$m),
7737
7737
  withDirectives(createBaseVNode("input", mergeProps({
7738
7738
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputValue.value = $event)
7739
7739
  }, inputAttributes.value, {
@@ -7761,7 +7761,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7761
7761
  };
7762
7762
  }
7763
7763
  });
7764
- const _sfc_main$18 = /* @__PURE__ */ defineComponent({
7764
+ const _sfc_main$19 = /* @__PURE__ */ defineComponent({
7765
7765
  __name: "SearchBoxMoreResults",
7766
7766
  props: {
7767
7767
  labels: {},
@@ -7793,9 +7793,9 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7793
7793
  };
7794
7794
  }
7795
7795
  });
7796
- const _hoisted_1$10 = { class: "lupa-search-box-history-item" };
7797
- const _hoisted_2$G = { class: "lupa-search-box-history-item-content" };
7798
- const _sfc_main$17 = /* @__PURE__ */ defineComponent({
7796
+ const _hoisted_1$11 = { class: "lupa-search-box-history-item" };
7797
+ const _hoisted_2$H = { class: "lupa-search-box-history-item-content" };
7798
+ const _sfc_main$18 = /* @__PURE__ */ defineComponent({
7799
7799
  __name: "SearchBoxHistoryItem",
7800
7800
  props: {
7801
7801
  item: {},
@@ -7811,8 +7811,8 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7811
7811
  emit2("click", { query: props.item });
7812
7812
  };
7813
7813
  return (_ctx, _cache) => {
7814
- return openBlock(), createElementBlock("div", _hoisted_1$10, [
7815
- createBaseVNode("div", _hoisted_2$G, [
7814
+ return openBlock(), createElementBlock("div", _hoisted_1$11, [
7815
+ createBaseVNode("div", _hoisted_2$H, [
7816
7816
  createBaseVNode("div", {
7817
7817
  class: normalizeClass(["lupa-search-box-history-item-text", { "lupa-search-box-history-item-highlighted": _ctx.highlighted }]),
7818
7818
  onClick: click2
@@ -7826,11 +7826,11 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7826
7826
  };
7827
7827
  }
7828
7828
  });
7829
- const _hoisted_1$$ = {
7829
+ const _hoisted_1$10 = {
7830
7830
  key: 0,
7831
7831
  class: "lupa-search-box-history-panel"
7832
7832
  };
7833
- const _sfc_main$16 = /* @__PURE__ */ defineComponent({
7833
+ const _sfc_main$17 = /* @__PURE__ */ defineComponent({
7834
7834
  __name: "SearchBoxHistoryPanel",
7835
7835
  props: {
7836
7836
  options: {}
@@ -7871,9 +7871,9 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7871
7871
  }
7872
7872
  };
7873
7873
  return (_ctx, _cache) => {
7874
- return hasHistory.value ? (openBlock(), createElementBlock("div", _hoisted_1$$, [
7874
+ return hasHistory.value ? (openBlock(), createElementBlock("div", _hoisted_1$10, [
7875
7875
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(history), (item, index) => {
7876
- return openBlock(), createBlock(_sfc_main$17, {
7876
+ return openBlock(), createBlock(_sfc_main$18, {
7877
7877
  key: item,
7878
7878
  item,
7879
7879
  highlighted: index === highlightIndex.value,
@@ -7889,18 +7889,18 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7889
7889
  };
7890
7890
  }
7891
7891
  });
7892
- const _hoisted_1$_ = ["innerHTML"];
7893
- const _hoisted_2$F = {
7892
+ const _hoisted_1$$ = ["innerHTML"];
7893
+ const _hoisted_2$G = {
7894
7894
  key: 1,
7895
7895
  "data-cy": "lupa-suggestion-value",
7896
7896
  class: "lupa-suggestion-value"
7897
7897
  };
7898
- const _hoisted_3$s = {
7898
+ const _hoisted_3$t = {
7899
7899
  key: 2,
7900
7900
  class: "lupa-suggestion-facet",
7901
7901
  "data-cy": "lupa-suggestion-facet"
7902
7902
  };
7903
- const _hoisted_4$k = {
7903
+ const _hoisted_4$l = {
7904
7904
  class: "lupa-suggestion-facet-label",
7905
7905
  "data-cy": "lupa-suggestion-facet-label"
7906
7906
  };
@@ -7908,7 +7908,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7908
7908
  class: "lupa-suggestion-facet-value",
7909
7909
  "data-cy": "lupa-suggestion-facet-value"
7910
7910
  };
7911
- const _sfc_main$15 = /* @__PURE__ */ defineComponent({
7911
+ const _sfc_main$16 = /* @__PURE__ */ defineComponent({
7912
7912
  __name: "SearchBoxSuggestion",
7913
7913
  props: {
7914
7914
  suggestion: {},
@@ -7944,20 +7944,20 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7944
7944
  class: "lupa-suggestion-value",
7945
7945
  "data-cy": "lupa-suggestion-value",
7946
7946
  innerHTML: _ctx.suggestion.displayHighlight
7947
- }, null, 8, _hoisted_1$_)) : (openBlock(), createElementBlock("div", _hoisted_2$F, toDisplayString(_ctx.suggestion.display), 1)),
7948
- _ctx.suggestion.facet ? (openBlock(), createElementBlock("div", _hoisted_3$s, [
7949
- createBaseVNode("span", _hoisted_4$k, toDisplayString(facetLabel.value), 1),
7947
+ }, null, 8, _hoisted_1$$)) : (openBlock(), createElementBlock("div", _hoisted_2$G, toDisplayString(_ctx.suggestion.display), 1)),
7948
+ _ctx.suggestion.facet ? (openBlock(), createElementBlock("div", _hoisted_3$t, [
7949
+ createBaseVNode("span", _hoisted_4$l, toDisplayString(facetLabel.value), 1),
7950
7950
  createBaseVNode("span", _hoisted_5$b, toDisplayString(_ctx.suggestion.facet.title), 1)
7951
7951
  ])) : createCommentVNode("", true)
7952
7952
  ]);
7953
7953
  };
7954
7954
  }
7955
7955
  });
7956
- const _hoisted_1$Z = {
7956
+ const _hoisted_1$_ = {
7957
7957
  id: "lupa-search-box-suggestions",
7958
7958
  "data-cy": "lupa-search-box-suggestions"
7959
7959
  };
7960
- const _sfc_main$14 = /* @__PURE__ */ defineComponent({
7960
+ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
7961
7961
  __name: "SearchBoxSuggestions",
7962
7962
  props: {
7963
7963
  items: {},
@@ -8017,9 +8017,9 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8017
8017
  });
8018
8018
  });
8019
8019
  return (_ctx, _cache) => {
8020
- return openBlock(), createElementBlock("div", _hoisted_1$Z, [
8020
+ return openBlock(), createElementBlock("div", _hoisted_1$_, [
8021
8021
  (openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (item, index) => {
8022
- return openBlock(), createBlock(_sfc_main$15, {
8022
+ return openBlock(), createBlock(_sfc_main$16, {
8023
8023
  key: getSuggestionKey(item),
8024
8024
  class: normalizeClass(["lupa-suggestion", index === highlightedIndex.value ? "lupa-suggestion-highlighted" : ""]),
8025
8025
  suggestion: item,
@@ -8047,7 +8047,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8047
8047
  }, timeout);
8048
8048
  };
8049
8049
  };
8050
- const _sfc_main$13 = /* @__PURE__ */ defineComponent({
8050
+ const _sfc_main$14 = /* @__PURE__ */ defineComponent({
8051
8051
  __name: "SearchBoxSuggestionsWrapper",
8052
8052
  props: {
8053
8053
  panel: {},
@@ -8088,7 +8088,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8088
8088
  };
8089
8089
  const getSuggestionsDebounced = debounce$1(getSuggestions, props.debounce);
8090
8090
  return (_ctx, _cache) => {
8091
- return openBlock(), createBlock(_sfc_main$14, {
8091
+ return openBlock(), createBlock(_sfc_main$15, {
8092
8092
  items: searchResult.value,
8093
8093
  highlight: _ctx.panel.highlight,
8094
8094
  queryKey: _ctx.panel.queryKey,
@@ -8166,8 +8166,8 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8166
8166
  });
8167
8167
  return { dynamicDataIdMap, loading, enhanceSearchResultsWithDynamicData };
8168
8168
  });
8169
- const _hoisted_1$Y = ["src"];
8170
- const _sfc_main$12 = /* @__PURE__ */ defineComponent({
8169
+ const _hoisted_1$Z = ["src"];
8170
+ const _sfc_main$13 = /* @__PURE__ */ defineComponent({
8171
8171
  __name: "ProductImage",
8172
8172
  props: {
8173
8173
  item: {},
@@ -8215,12 +8215,12 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8215
8215
  class: normalizeClass((_b = _ctx.imageClass) != null ? _b : ""),
8216
8216
  src: finalUrl.value,
8217
8217
  onError: replaceWithPlaceholder
8218
- }, null, 42, _hoisted_1$Y)
8218
+ }, null, 42, _hoisted_1$Z)
8219
8219
  ], 2);
8220
8220
  };
8221
8221
  }
8222
8222
  });
8223
- const _sfc_main$11 = /* @__PURE__ */ defineComponent({
8223
+ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
8224
8224
  __name: "SearchBoxProductImage",
8225
8225
  props: {
8226
8226
  item: {},
@@ -8228,7 +8228,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8228
8228
  },
8229
8229
  setup(__props) {
8230
8230
  return (_ctx, _cache) => {
8231
- return openBlock(), createBlock(_sfc_main$12, {
8231
+ return openBlock(), createBlock(_sfc_main$13, {
8232
8232
  item: _ctx.item,
8233
8233
  options: _ctx.options,
8234
8234
  "wrapper-class": "lupa-search-box-image-wrapper",
@@ -8237,12 +8237,12 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8237
8237
  };
8238
8238
  }
8239
8239
  });
8240
- const _hoisted_1$X = ["innerHTML"];
8241
- const _hoisted_2$E = {
8240
+ const _hoisted_1$Y = ["innerHTML"];
8241
+ const _hoisted_2$F = {
8242
8242
  key: 1,
8243
8243
  class: "lupa-search-box-product-title"
8244
8244
  };
8245
- const _sfc_main$10 = /* @__PURE__ */ defineComponent({
8245
+ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
8246
8246
  __name: "SearchBoxProductTitle",
8247
8247
  props: {
8248
8248
  item: {},
@@ -8262,18 +8262,18 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8262
8262
  key: 0,
8263
8263
  class: "lupa-search-box-product-title",
8264
8264
  innerHTML: title.value
8265
- }, null, 8, _hoisted_1$X)) : (openBlock(), createElementBlock("div", _hoisted_2$E, [
8265
+ }, null, 8, _hoisted_1$Y)) : (openBlock(), createElementBlock("div", _hoisted_2$F, [
8266
8266
  createBaseVNode("strong", null, toDisplayString(title.value), 1)
8267
8267
  ]));
8268
8268
  };
8269
8269
  }
8270
8270
  });
8271
- const _hoisted_1$W = ["innerHTML"];
8272
- const _hoisted_2$D = {
8271
+ const _hoisted_1$X = ["innerHTML"];
8272
+ const _hoisted_2$E = {
8273
8273
  key: 1,
8274
8274
  class: "lupa-search-box-product-description"
8275
8275
  };
8276
- const _sfc_main$$ = /* @__PURE__ */ defineComponent({
8276
+ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
8277
8277
  __name: "SearchBoxProductDescription",
8278
8278
  props: {
8279
8279
  item: {},
@@ -8293,12 +8293,12 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8293
8293
  key: 0,
8294
8294
  class: "lupa-search-box-product-description",
8295
8295
  innerHTML: description.value
8296
- }, null, 8, _hoisted_1$W)) : (openBlock(), createElementBlock("div", _hoisted_2$D, toDisplayString(description.value), 1));
8296
+ }, null, 8, _hoisted_1$X)) : (openBlock(), createElementBlock("div", _hoisted_2$E, toDisplayString(description.value), 1));
8297
8297
  };
8298
8298
  }
8299
8299
  });
8300
- const _hoisted_1$V = { class: "lupa-search-box-product-price" };
8301
- const _sfc_main$_ = /* @__PURE__ */ defineComponent({
8300
+ const _hoisted_1$W = { class: "lupa-search-box-product-price" };
8301
+ const _sfc_main$$ = /* @__PURE__ */ defineComponent({
8302
8302
  __name: "SearchBoxProductPrice",
8303
8303
  props: {
8304
8304
  item: {},
@@ -8316,14 +8316,14 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8316
8316
  );
8317
8317
  });
8318
8318
  return (_ctx, _cache) => {
8319
- return openBlock(), createElementBlock("div", _hoisted_1$V, [
8319
+ return openBlock(), createElementBlock("div", _hoisted_1$W, [
8320
8320
  createBaseVNode("strong", null, toDisplayString(price.value), 1)
8321
8321
  ]);
8322
8322
  };
8323
8323
  }
8324
8324
  });
8325
- const _hoisted_1$U = { class: "lupa-search-box-product-regular-price" };
8326
- const _sfc_main$Z = /* @__PURE__ */ defineComponent({
8325
+ const _hoisted_1$V = { class: "lupa-search-box-product-regular-price" };
8326
+ const _sfc_main$_ = /* @__PURE__ */ defineComponent({
8327
8327
  __name: "SearchBoxProductRegularPrice",
8328
8328
  props: {
8329
8329
  item: {},
@@ -8341,16 +8341,16 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8341
8341
  );
8342
8342
  });
8343
8343
  return (_ctx, _cache) => {
8344
- return openBlock(), createElementBlock("div", _hoisted_1$U, toDisplayString(price.value), 1);
8344
+ return openBlock(), createElementBlock("div", _hoisted_1$V, toDisplayString(price.value), 1);
8345
8345
  };
8346
8346
  }
8347
8347
  });
8348
- const _hoisted_1$T = ["innerHTML"];
8349
- const _hoisted_2$C = { key: 0 };
8350
- const _hoisted_3$r = { key: 1 };
8351
- const _hoisted_4$j = { class: "lupa-search-box-custom-label" };
8348
+ const _hoisted_1$U = ["innerHTML"];
8349
+ const _hoisted_2$D = { key: 0 };
8350
+ const _hoisted_3$s = { key: 1 };
8351
+ const _hoisted_4$k = { class: "lupa-search-box-custom-label" };
8352
8352
  const _hoisted_5$a = { class: "lupa-search-box-custom-text" };
8353
- const _sfc_main$Y = /* @__PURE__ */ defineComponent({
8353
+ const _sfc_main$Z = /* @__PURE__ */ defineComponent({
8354
8354
  __name: "SearchBoxProductCustom",
8355
8355
  props: {
8356
8356
  item: {},
@@ -8376,20 +8376,20 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8376
8376
  key: 0,
8377
8377
  class: [className.value, "lupa-search-box-product-custom"],
8378
8378
  innerHTML: text.value
8379
- }, toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), null, 16, _hoisted_1$T)) : (openBlock(), createElementBlock("div", mergeProps({
8379
+ }, toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), null, 16, _hoisted_1$U)) : (openBlock(), createElementBlock("div", mergeProps({
8380
8380
  key: 1,
8381
8381
  class: [className.value, "lupa-search-box-product-custom"]
8382
8382
  }, toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), [
8383
- !label.value ? (openBlock(), createElementBlock("div", _hoisted_2$C, toDisplayString(text.value), 1)) : (openBlock(), createElementBlock("div", _hoisted_3$r, [
8384
- createBaseVNode("div", _hoisted_4$j, toDisplayString(label.value), 1),
8383
+ !label.value ? (openBlock(), createElementBlock("div", _hoisted_2$D, toDisplayString(text.value), 1)) : (openBlock(), createElementBlock("div", _hoisted_3$s, [
8384
+ createBaseVNode("div", _hoisted_4$k, toDisplayString(label.value), 1),
8385
8385
  createBaseVNode("div", _hoisted_5$a, toDisplayString(text.value), 1)
8386
8386
  ]))
8387
8387
  ], 16));
8388
8388
  };
8389
8389
  }
8390
8390
  });
8391
- const _hoisted_1$S = ["innerHTML"];
8392
- const _sfc_main$X = /* @__PURE__ */ defineComponent({
8391
+ const _hoisted_1$T = ["innerHTML"];
8392
+ const _sfc_main$Y = /* @__PURE__ */ defineComponent({
8393
8393
  __name: "SearchBoxProductCustomHtml",
8394
8394
  props: {
8395
8395
  item: {},
@@ -8409,19 +8409,255 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8409
8409
  return openBlock(), createElementBlock("div", mergeProps({
8410
8410
  class: className.value,
8411
8411
  innerHTML: text.value
8412
- }, toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), null, 16, _hoisted_1$S);
8412
+ }, toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), null, 16, _hoisted_1$T);
8413
+ };
8414
+ }
8415
+ });
8416
+ var ResultsLayoutEnum = /* @__PURE__ */ ((ResultsLayoutEnum2) => {
8417
+ ResultsLayoutEnum2["GRID"] = "Grid";
8418
+ ResultsLayoutEnum2["LIST"] = "List";
8419
+ return ResultsLayoutEnum2;
8420
+ })(ResultsLayoutEnum || {});
8421
+ const RESULT_ROOT_ID = "lupa-search-results";
8422
+ const SHADOW_ROOT_ID = "lupa-shadow-id";
8423
+ const CONTAINER_ROOT_ID = "lupa-search-container";
8424
+ const scrollToSearchResults = (timeout = 500) => {
8425
+ if (timeout) {
8426
+ setTimeout(() => scrollTo(RESULT_ROOT_ID), timeout);
8427
+ } else {
8428
+ scrollTo(RESULT_ROOT_ID);
8429
+ }
8430
+ };
8431
+ const scrollTo = (elementId) => {
8432
+ var _a, _b;
8433
+ let el = document.getElementById(elementId);
8434
+ const shadowRoot = (_a = document.getElementById(SHADOW_ROOT_ID)) == null ? void 0 : _a.shadowRoot;
8435
+ if (!el) {
8436
+ el = (_b = shadowRoot == null ? void 0 : shadowRoot.getElementById(elementId)) != null ? _b : null;
8437
+ }
8438
+ if (!el) {
8439
+ return;
8440
+ }
8441
+ const searchContainer2 = shadowRoot ? shadowRoot.getElementById(CONTAINER_ROOT_ID) : void 0;
8442
+ const container = searchContainer2 != null ? searchContainer2 : window;
8443
+ container.scrollTo({
8444
+ top: el.offsetTop,
8445
+ behavior: "smooth"
8446
+ });
8447
+ };
8448
+ const disableBodyScroll = () => {
8449
+ const scrollY = window.scrollY;
8450
+ document.body.style.position = "fixed";
8451
+ document.body.style.top = `-${scrollY}px`;
8452
+ };
8453
+ const enableBodyScroll = () => {
8454
+ const scrollY = document.body.style.top;
8455
+ document.body.style.position = "";
8456
+ document.body.style.top = "";
8457
+ window.scrollTo(0, parseInt(scrollY || "0") * -1);
8458
+ };
8459
+ const setDocumentTitle = (template, textToInsert = "") => {
8460
+ document.title = addParamsToLabel(template, textToInsert);
8461
+ };
8462
+ const useSearchResultStore = defineStore("searchResult", () => {
8463
+ const searchResult = ref({});
8464
+ const columnCount = ref(2);
8465
+ const addToCartAmount = ref(1);
8466
+ const layout = ref(ResultsLayoutEnum.GRID);
8467
+ const loading = ref(false);
8468
+ const isMobileSidebarVisible = ref(false);
8469
+ const optionsStore = useOptionsStore();
8470
+ const paramsStore = useParamsStore();
8471
+ const facets = computed(() => searchResult.value.facets);
8472
+ const filters = computed(() => searchResult.value.filters);
8473
+ const currentQueryText = computed(() => searchResult.value.searchText);
8474
+ const totalItems = computed(() => searchResult.value.total);
8475
+ const hasResults = computed(() => totalItems.value > 0);
8476
+ const labeledFilters = computed(
8477
+ () => getLabeledFilters(unfoldFilters(filters.value), facets.value)
8478
+ );
8479
+ const displayFilters = computed(() => {
8480
+ var _a, _b;
8481
+ const initialFilters = optionsStore.initialFilters;
8482
+ return (_b = (_a = labeledFilters.value) == null ? void 0 : _a.filter((f2) => !(initialFilters == null ? void 0 : initialFilters[f2.key]))) != null ? _b : [];
8483
+ });
8484
+ const currentFilterCount = computed(() => {
8485
+ var _a, _b;
8486
+ return (_b = (_a = displayFilters.value) == null ? void 0 : _a.length) != null ? _b : 0;
8487
+ });
8488
+ const currentFilterKeys = computed(() => {
8489
+ var _a;
8490
+ return Object.keys((_a = filters.value) != null ? _a : {});
8491
+ });
8492
+ const hasAnyFilter = computed(() => {
8493
+ var _a;
8494
+ return Object.keys((_a = filters.value) != null ? _a : {}).length > 0;
8495
+ });
8496
+ const itemRange = computed(() => {
8497
+ var _a, _b;
8498
+ const limit = (_a = paramsStore.limit) != null ? _a : 0;
8499
+ const offset = (_b = searchResult.value.offset) != null ? _b : 0;
8500
+ return [offset + 1, Math.min(offset + limit, totalItems.value)];
8501
+ });
8502
+ const isPageEmpty = computed(
8503
+ () => {
8504
+ var _a;
8505
+ return hasResults.value && ((_a = searchResult.value.offset) != null ? _a : 0) >= totalItems.value;
8506
+ }
8507
+ );
8508
+ const setSidebarState = ({ visible }) => {
8509
+ if (visible) {
8510
+ disableBodyScroll();
8511
+ } else {
8512
+ enableBodyScroll();
8513
+ }
8514
+ isMobileSidebarVisible.value = visible;
8515
+ };
8516
+ const queryFacet = (_0) => __async(void 0, [_0], function* ({ queryKey, facetKey }) {
8517
+ var _a, _b, _c, _d;
8518
+ const query = { searchText: "", filters: __spreadValues2({}, filters.value) };
8519
+ const options = (_a = optionsStore.envOptions) != null ? _a : { environment: "production" };
8520
+ const result = yield LupaSearchSdk.query(queryKey, query, options);
8521
+ if (!result.success) {
8522
+ return;
8523
+ }
8524
+ const facet = (_b = result.facets) == null ? void 0 : _b.find((f2) => f2.key === facetKey);
8525
+ const facetItems = (_c = facet == null ? void 0 : facet.items) != null ? _c : [];
8526
+ const updatedResult = __spreadProps2(__spreadValues2({}, searchResult.value), {
8527
+ facets: (_d = facets.value) == null ? void 0 : _d.map((f2) => f2.key === facetKey ? __spreadProps2(__spreadValues2({}, f2), { items: facetItems }) : f2)
8528
+ });
8529
+ searchResult.value = updatedResult;
8530
+ });
8531
+ const add2 = (newSearchResult) => {
8532
+ var _a, _b;
8533
+ if (!newSearchResult) {
8534
+ return {
8535
+ searchResult: searchResult.value,
8536
+ pageSize: searchResult.value.limit || 0
8537
+ };
8538
+ }
8539
+ if (typeof document !== "undefined") {
8540
+ setDocumentTitle(
8541
+ (_b = (_a = optionsStore.searchResultOptions) == null ? void 0 : _a.labels) == null ? void 0 : _b.htmlTitleTemplate,
8542
+ newSearchResult.searchText
8543
+ );
8544
+ }
8545
+ searchResult.value = newSearchResult;
8546
+ return { searchResult: newSearchResult };
8547
+ };
8548
+ const setColumnCount = ({ width, grid }) => {
8549
+ if (!width || !grid) {
8550
+ return;
8551
+ }
8552
+ if (width <= S_MIN_WIDTH) {
8553
+ columnCount.value = grid.columns.xs;
8554
+ } else if (width > S_MIN_WIDTH && width <= MD_MIN_WIDTH) {
8555
+ columnCount.value = grid.columns.sm;
8556
+ } else if (width > MD_MIN_WIDTH && width <= L_MIN_WIDTH) {
8557
+ columnCount.value = grid.columns.md;
8558
+ } else if (width > L_MIN_WIDTH && width <= XL_MIN_WIDTH) {
8559
+ columnCount.value = grid.columns.l;
8560
+ } else {
8561
+ columnCount.value = grid.columns.xl;
8562
+ }
8563
+ };
8564
+ const setAddToCartAmount = (newAddToCartAmount) => {
8565
+ if (!newAddToCartAmount) {
8566
+ return;
8567
+ }
8568
+ addToCartAmount.value = newAddToCartAmount;
8569
+ };
8570
+ const setLayout = (newLayout) => {
8571
+ if (!newLayout) {
8572
+ return;
8573
+ }
8574
+ layout.value = newLayout;
8575
+ };
8576
+ const setLoading = (state) => {
8577
+ loading.value = state || false;
8578
+ };
8579
+ return {
8580
+ isMobileSidebarVisible,
8581
+ searchResult,
8582
+ columnCount,
8583
+ addToCartAmount,
8584
+ facets,
8585
+ filters,
8586
+ loading,
8587
+ layout,
8588
+ currentQueryText,
8589
+ totalItems,
8590
+ hasResults,
8591
+ labeledFilters,
8592
+ displayFilters,
8593
+ currentFilterCount,
8594
+ currentFilterKeys,
8595
+ hasAnyFilter,
8596
+ itemRange,
8597
+ isPageEmpty,
8598
+ setSidebarState,
8599
+ queryFacet,
8600
+ add: add2,
8601
+ setColumnCount,
8602
+ setAddToCartAmount,
8603
+ setLayout,
8604
+ setLoading
8605
+ };
8606
+ });
8607
+ const _hoisted_1$S = { class: "lupa-search-results-add-to-cart-wrapper" };
8608
+ const _hoisted_2$C = { class: "lupa-search-results-product-addtocart" };
8609
+ const _hoisted_3$r = ["onClick", "disabled"];
8610
+ const _sfc_main$X = /* @__PURE__ */ defineComponent({
8611
+ __name: "SearchBoxProductAddToCart",
8612
+ props: {
8613
+ item: {},
8614
+ options: {},
8615
+ inStock: { type: Boolean }
8616
+ },
8617
+ emits: ["productEvent"],
8618
+ setup(__props, { emit: emit2 }) {
8619
+ const props = __props;
8620
+ const inStockValue = computed(() => {
8621
+ var _a;
8622
+ return (_a = props.inStock) != null ? _a : true;
8623
+ });
8624
+ const searchResultStore = useSearchResultStore();
8625
+ const { addToCartAmount } = storeToRefs(searchResultStore);
8626
+ const loading = ref(false);
8627
+ const label = computed(() => {
8628
+ return props.options.labels.addToCart;
8629
+ });
8630
+ const handleClick = () => __async(this, null, function* () {
8631
+ loading.value = true;
8632
+ yield props.options.action(props.item, addToCartAmount.value);
8633
+ emit2("productEvent", { type: "addToCart" });
8634
+ loading.value = false;
8635
+ });
8636
+ return (_ctx, _cache) => {
8637
+ return openBlock(), createElementBlock("div", _hoisted_1$S, [
8638
+ createBaseVNode("div", _hoisted_2$C, [
8639
+ createBaseVNode("button", {
8640
+ onClick: withModifiers(handleClick, ["stop", "prevent"]),
8641
+ class: normalizeClass(loading.value ? "lupa-add-to-cart-loading" : "lupa-add-to-cart"),
8642
+ "data-cy": "lupa-add-to-cart",
8643
+ type: "button",
8644
+ disabled: !inStockValue.value || loading.value
8645
+ }, toDisplayString(label.value), 11, _hoisted_3$r)
8646
+ ])
8647
+ ]);
8413
8648
  };
8414
8649
  }
8415
8650
  });
8416
8651
  const __default__$4 = {
8417
8652
  components: {
8418
- SearchBoxProductImage: _sfc_main$11,
8419
- SearchBoxProductTitle: _sfc_main$10,
8420
- SearchBoxProductDescription: _sfc_main$$,
8421
- SearchBoxProductPrice: _sfc_main$_,
8422
- SearchBoxProductRegularPrice: _sfc_main$Z,
8423
- SearchBoxProductCustom: _sfc_main$Y,
8424
- SearchBoxProductCustomHtml: _sfc_main$X
8653
+ SearchBoxProductImage: _sfc_main$12,
8654
+ SearchBoxProductTitle: _sfc_main$11,
8655
+ SearchBoxProductDescription: _sfc_main$10,
8656
+ SearchBoxProductPrice: _sfc_main$$,
8657
+ SearchBoxProductRegularPrice: _sfc_main$_,
8658
+ SearchBoxProductCustom: _sfc_main$Z,
8659
+ SearchBoxProductCustomHtml: _sfc_main$Y,
8660
+ SearchBoxProductAddToCart: _sfc_main$X
8425
8661
  }
8426
8662
  };
8427
8663
  const _sfc_main$W = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValues2({}, __default__$4), {
@@ -8429,7 +8665,8 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8429
8665
  props: {
8430
8666
  item: {},
8431
8667
  element: {},
8432
- labels: {}
8668
+ labels: {},
8669
+ isInStock: { type: Boolean }
8433
8670
  },
8434
8671
  setup(__props) {
8435
8672
  const props = __props;
@@ -8451,6 +8688,8 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8451
8688
  return "search-box-product-custom";
8452
8689
  case DocumentElementType.CUSTOM_HTML:
8453
8690
  return "search-box-product-custom-html";
8691
+ case DocumentElementType.ADDTOCART:
8692
+ return "search-box-product-add-to-cart";
8454
8693
  }
8455
8694
  return "search-box-product-title";
8456
8695
  });
@@ -8474,8 +8713,9 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8474
8713
  item: enhancedItem.value,
8475
8714
  options: _ctx.element,
8476
8715
  labels: _ctx.labels,
8477
- class: normalizeClass({ "lupa-loading-dynamic-data": isLoadingDynamicData.value })
8478
- }, null, 8, ["item", "options", "labels", "class"])) : createCommentVNode("", true);
8716
+ class: normalizeClass({ "lupa-loading-dynamic-data": isLoadingDynamicData.value }),
8717
+ inStock: _ctx.isInStock
8718
+ }, null, 8, ["item", "options", "labels", "class", "inStock"])) : createCommentVNode("", true);
8479
8719
  };
8480
8720
  }
8481
8721
  }));
@@ -8537,6 +8777,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8537
8777
  const _hoisted_1$R = ["href"];
8538
8778
  const _hoisted_2$B = { class: "lupa-search-box-product-image-section" };
8539
8779
  const _hoisted_3$q = { class: "lupa-search-box-product-details-section" };
8780
+ const _hoisted_4$j = {
8781
+ key: 0,
8782
+ class: "lupa-search-box-product-add-to-cart-section"
8783
+ };
8540
8784
  const _sfc_main$V = /* @__PURE__ */ defineComponent({
8541
8785
  __name: "SearchBoxProduct",
8542
8786
  props: {
@@ -8552,6 +8796,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8552
8796
  const historyStore = useHistoryStore();
8553
8797
  const trackingStore = useTrackingStore();
8554
8798
  const optionsStore = useOptionsStore();
8799
+ const isInStock = ref(true);
8555
8800
  const { boxRoutingBehavior } = storeToRefs(optionsStore);
8556
8801
  const link = computed(() => {
8557
8802
  var _a, _b;
@@ -8563,7 +8808,9 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8563
8808
  });
8564
8809
  const detailElements = computed(() => {
8565
8810
  var _a, _b;
8566
- return (_b = (_a = props.panelOptions.elements) == null ? void 0 : _a.filter((e) => e.type !== DocumentElementType.IMAGE)) != null ? _b : [];
8811
+ return (_b = (_a = props.panelOptions.elements) == null ? void 0 : _a.filter(
8812
+ (e) => e.type !== DocumentElementType.IMAGE && e.type !== DocumentElementType.ADDTOCART
8813
+ )) != null ? _b : [];
8567
8814
  });
8568
8815
  const id = computed(() => {
8569
8816
  if (props.panelOptions.idKey) {
@@ -8581,6 +8828,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8581
8828
  });
8582
8829
  return title2;
8583
8830
  });
8831
+ const addToCartElement = computed(() => {
8832
+ var _a;
8833
+ return (_a = props.panelOptions.elements) == null ? void 0 : _a.find((e) => e.type === DocumentElementType.ADDTOCART);
8834
+ });
8584
8835
  const handleClick = (event) => {
8585
8836
  var _a;
8586
8837
  if (props.panelOptions.titleKey) {
@@ -8610,6 +8861,12 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8610
8861
  emit2("product-click");
8611
8862
  handleRoutingEvent(link.value, event, boxRoutingBehavior.value === "event");
8612
8863
  };
8864
+ onMounted(() => {
8865
+ checkIfIsInStock();
8866
+ });
8867
+ const checkIfIsInStock = () => __async(this, null, function* () {
8868
+ isInStock.value = props.panelOptions.isInStock ? yield props.panelOptions.isInStock(props.item) : true;
8869
+ });
8613
8870
  return (_ctx, _cache) => {
8614
8871
  return openBlock(), createElementBlock("a", {
8615
8872
  class: normalizeClass(["lupa-search-box-product", { "lupa-search-box-product-highlighted": _ctx.highlighted }]),
@@ -8640,7 +8897,17 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8640
8897
  link: link.value
8641
8898
  }, null, 8, ["item", "element", "labels", "link"]);
8642
8899
  }), 128))
8643
- ])
8900
+ ]),
8901
+ addToCartElement.value ? (openBlock(), createElementBlock("div", _hoisted_4$j, [
8902
+ createVNode(_sfc_main$W, {
8903
+ class: "lupa-search-box-product-element",
8904
+ item: _ctx.item,
8905
+ element: addToCartElement.value,
8906
+ labels: _ctx.labels,
8907
+ link: link.value,
8908
+ isInStock: isInStock.value
8909
+ }, null, 8, ["item", "element", "labels", "link", "isInStock"])
8910
+ ])) : createCommentVNode("", true)
8644
8911
  ], 10, _hoisted_1$R);
8645
8912
  };
8646
8913
  }
@@ -8774,7 +9041,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8774
9041
  };
8775
9042
  const __default__$3 = {
8776
9043
  components: {
8777
- SearchBoxSuggestionsWrapper: _sfc_main$13,
9044
+ SearchBoxSuggestionsWrapper: _sfc_main$14,
8778
9045
  SearchBoxProductsWrapper: _sfc_main$T
8779
9046
  }
8780
9047
  };
@@ -8924,13 +9191,13 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8924
9191
  ], 10, _hoisted_2$A);
8925
9192
  }), 128))
8926
9193
  ]),
8927
- createVNode(_sfc_main$18, {
9194
+ createVNode(_sfc_main$19, {
8928
9195
  labels: labels.value,
8929
9196
  showTotalCount: (_a = _ctx.options.showTotalCount) != null ? _a : false,
8930
9197
  onGoToResults: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("go-to-results"))
8931
9198
  }, null, 8, ["labels", "showTotalCount"])
8932
9199
  ], 512)) : displayHistory.value ? (openBlock(), createElementBlock("div", _hoisted_3$p, [
8933
- createVNode(_sfc_main$16, {
9200
+ createVNode(_sfc_main$17, {
8934
9201
  ref: "panel",
8935
9202
  options: _ctx.options.history,
8936
9203
  history: history.value,
@@ -9191,7 +9458,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
9191
9458
  var _a2;
9192
9459
  return openBlock(), createElementBlock("div", _hoisted_1$O, [
9193
9460
  createBaseVNode("div", _hoisted_2$z, [
9194
- createVNode(_sfc_main$19, {
9461
+ createVNode(_sfc_main$1a, {
9195
9462
  options: inputOptions.value,
9196
9463
  suggestedValue: suggestedValue.value,
9197
9464
  "can-close": (_a2 = _ctx.isSearchContainer) != null ? _a2 : false,
@@ -9225,197 +9492,6 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
9225
9492
  };
9226
9493
  }
9227
9494
  });
9228
- var ResultsLayoutEnum = /* @__PURE__ */ ((ResultsLayoutEnum2) => {
9229
- ResultsLayoutEnum2["GRID"] = "Grid";
9230
- ResultsLayoutEnum2["LIST"] = "List";
9231
- return ResultsLayoutEnum2;
9232
- })(ResultsLayoutEnum || {});
9233
- const RESULT_ROOT_ID = "lupa-search-results";
9234
- const SHADOW_ROOT_ID = "lupa-shadow-id";
9235
- const CONTAINER_ROOT_ID = "lupa-search-container";
9236
- const scrollToSearchResults = (timeout = 500) => {
9237
- if (timeout) {
9238
- setTimeout(() => scrollTo(RESULT_ROOT_ID), timeout);
9239
- } else {
9240
- scrollTo(RESULT_ROOT_ID);
9241
- }
9242
- };
9243
- const scrollTo = (elementId) => {
9244
- var _a, _b;
9245
- let el = document.getElementById(elementId);
9246
- const shadowRoot = (_a = document.getElementById(SHADOW_ROOT_ID)) == null ? void 0 : _a.shadowRoot;
9247
- if (!el) {
9248
- el = (_b = shadowRoot == null ? void 0 : shadowRoot.getElementById(elementId)) != null ? _b : null;
9249
- }
9250
- if (!el) {
9251
- return;
9252
- }
9253
- const searchContainer2 = shadowRoot ? shadowRoot.getElementById(CONTAINER_ROOT_ID) : void 0;
9254
- const container = searchContainer2 != null ? searchContainer2 : window;
9255
- container.scrollTo({
9256
- top: el.offsetTop,
9257
- behavior: "smooth"
9258
- });
9259
- };
9260
- const disableBodyScroll = () => {
9261
- const scrollY = window.scrollY;
9262
- document.body.style.position = "fixed";
9263
- document.body.style.top = `-${scrollY}px`;
9264
- };
9265
- const enableBodyScroll = () => {
9266
- const scrollY = document.body.style.top;
9267
- document.body.style.position = "";
9268
- document.body.style.top = "";
9269
- window.scrollTo(0, parseInt(scrollY || "0") * -1);
9270
- };
9271
- const setDocumentTitle = (template, textToInsert = "") => {
9272
- document.title = addParamsToLabel(template, textToInsert);
9273
- };
9274
- const useSearchResultStore = defineStore("searchResult", () => {
9275
- const searchResult = ref({});
9276
- const columnCount = ref(2);
9277
- const addToCartAmount = ref(1);
9278
- const layout = ref(ResultsLayoutEnum.GRID);
9279
- const loading = ref(false);
9280
- const isMobileSidebarVisible = ref(false);
9281
- const optionsStore = useOptionsStore();
9282
- const paramsStore = useParamsStore();
9283
- const facets = computed(() => searchResult.value.facets);
9284
- const filters = computed(() => searchResult.value.filters);
9285
- const currentQueryText = computed(() => searchResult.value.searchText);
9286
- const totalItems = computed(() => searchResult.value.total);
9287
- const hasResults = computed(() => totalItems.value > 0);
9288
- const labeledFilters = computed(
9289
- () => getLabeledFilters(unfoldFilters(filters.value), facets.value)
9290
- );
9291
- const displayFilters = computed(() => {
9292
- var _a, _b;
9293
- const initialFilters = optionsStore.initialFilters;
9294
- return (_b = (_a = labeledFilters.value) == null ? void 0 : _a.filter((f2) => !(initialFilters == null ? void 0 : initialFilters[f2.key]))) != null ? _b : [];
9295
- });
9296
- const currentFilterCount = computed(() => {
9297
- var _a, _b;
9298
- return (_b = (_a = displayFilters.value) == null ? void 0 : _a.length) != null ? _b : 0;
9299
- });
9300
- const currentFilterKeys = computed(() => {
9301
- var _a;
9302
- return Object.keys((_a = filters.value) != null ? _a : {});
9303
- });
9304
- const hasAnyFilter = computed(() => {
9305
- var _a;
9306
- return Object.keys((_a = filters.value) != null ? _a : {}).length > 0;
9307
- });
9308
- const itemRange = computed(() => {
9309
- var _a, _b;
9310
- const limit = (_a = paramsStore.limit) != null ? _a : 0;
9311
- const offset = (_b = searchResult.value.offset) != null ? _b : 0;
9312
- return [offset + 1, Math.min(offset + limit, totalItems.value)];
9313
- });
9314
- const isPageEmpty = computed(
9315
- () => {
9316
- var _a;
9317
- return hasResults.value && ((_a = searchResult.value.offset) != null ? _a : 0) >= totalItems.value;
9318
- }
9319
- );
9320
- const setSidebarState = ({ visible }) => {
9321
- if (visible) {
9322
- disableBodyScroll();
9323
- } else {
9324
- enableBodyScroll();
9325
- }
9326
- isMobileSidebarVisible.value = visible;
9327
- };
9328
- const queryFacet = (_0) => __async(void 0, [_0], function* ({ queryKey, facetKey }) {
9329
- var _a, _b, _c, _d;
9330
- const query = { searchText: "", filters: __spreadValues2({}, filters.value) };
9331
- const options = (_a = optionsStore.envOptions) != null ? _a : { environment: "production" };
9332
- const result = yield LupaSearchSdk.query(queryKey, query, options);
9333
- if (!result.success) {
9334
- return;
9335
- }
9336
- const facet = (_b = result.facets) == null ? void 0 : _b.find((f2) => f2.key === facetKey);
9337
- const facetItems = (_c = facet == null ? void 0 : facet.items) != null ? _c : [];
9338
- const updatedResult = __spreadProps2(__spreadValues2({}, searchResult.value), {
9339
- facets: (_d = facets.value) == null ? void 0 : _d.map((f2) => f2.key === facetKey ? __spreadProps2(__spreadValues2({}, f2), { items: facetItems }) : f2)
9340
- });
9341
- searchResult.value = updatedResult;
9342
- });
9343
- const add2 = (newSearchResult) => {
9344
- var _a, _b;
9345
- if (!newSearchResult) {
9346
- return {
9347
- searchResult: searchResult.value,
9348
- pageSize: searchResult.value.limit || 0
9349
- };
9350
- }
9351
- if (typeof document !== "undefined") {
9352
- setDocumentTitle(
9353
- (_b = (_a = optionsStore.searchResultOptions) == null ? void 0 : _a.labels) == null ? void 0 : _b.htmlTitleTemplate,
9354
- newSearchResult.searchText
9355
- );
9356
- }
9357
- searchResult.value = newSearchResult;
9358
- return { searchResult: newSearchResult };
9359
- };
9360
- const setColumnCount = ({ width, grid }) => {
9361
- if (!width || !grid) {
9362
- return;
9363
- }
9364
- if (width <= S_MIN_WIDTH) {
9365
- columnCount.value = grid.columns.xs;
9366
- } else if (width > S_MIN_WIDTH && width <= MD_MIN_WIDTH) {
9367
- columnCount.value = grid.columns.sm;
9368
- } else if (width > MD_MIN_WIDTH && width <= L_MIN_WIDTH) {
9369
- columnCount.value = grid.columns.md;
9370
- } else if (width > L_MIN_WIDTH && width <= XL_MIN_WIDTH) {
9371
- columnCount.value = grid.columns.l;
9372
- } else {
9373
- columnCount.value = grid.columns.xl;
9374
- }
9375
- };
9376
- const setAddToCartAmount = (newAddToCartAmount) => {
9377
- if (!newAddToCartAmount) {
9378
- return;
9379
- }
9380
- addToCartAmount.value = newAddToCartAmount;
9381
- };
9382
- const setLayout = (newLayout) => {
9383
- if (!newLayout) {
9384
- return;
9385
- }
9386
- layout.value = newLayout;
9387
- };
9388
- const setLoading = (state) => {
9389
- loading.value = state || false;
9390
- };
9391
- return {
9392
- isMobileSidebarVisible,
9393
- searchResult,
9394
- columnCount,
9395
- addToCartAmount,
9396
- facets,
9397
- filters,
9398
- loading,
9399
- layout,
9400
- currentQueryText,
9401
- totalItems,
9402
- hasResults,
9403
- labeledFilters,
9404
- displayFilters,
9405
- currentFilterCount,
9406
- currentFilterKeys,
9407
- hasAnyFilter,
9408
- itemRange,
9409
- isPageEmpty,
9410
- setSidebarState,
9411
- queryFacet,
9412
- add: add2,
9413
- setColumnCount,
9414
- setAddToCartAmount,
9415
- setLayout,
9416
- setLoading
9417
- };
9418
- });
9419
9495
  const createPublicQuery = (queryParams, sortOptions, defaultPageSize) => {
9420
9496
  var _a;
9421
9497
  const publicQuery = {};
@@ -12565,7 +12641,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
12565
12641
  },
12566
12642
  setup(__props) {
12567
12643
  return (_ctx, _cache) => {
12568
- return openBlock(), createBlock(_sfc_main$12, {
12644
+ return openBlock(), createBlock(_sfc_main$13, {
12569
12645
  item: _ctx.item,
12570
12646
  options: _ctx.options,
12571
12647
  "wrapper-class": "lupa-search-results-image-wrapper",
@@ -20383,7 +20459,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20383
20459
  class: "lupa-recommended-products",
20384
20460
  "data-cy": "lupa-recommended-products"
20385
20461
  };
20386
- const _sfc_main$1a = /* @__PURE__ */ defineComponent({
20462
+ const _sfc_main$1b = /* @__PURE__ */ defineComponent({
20387
20463
  __name: "Recommendations",
20388
20464
  props: {
20389
20465
  options: {}
@@ -26316,7 +26392,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26316
26392
  };
26317
26393
  __expose({ fetch: fetch2 });
26318
26394
  return (_ctx, _cache) => {
26319
- return openBlock(), createBlock(unref(_sfc_main$1a), {
26395
+ return openBlock(), createBlock(unref(_sfc_main$1b), {
26320
26396
  options: _ctx.recommendationOptions,
26321
26397
  ref_key: "productRecommendations",
26322
26398
  ref: productRecommendations