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