@getlupa/client 1.0.4 → 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.
@@ -5749,55 +5749,6 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
5749
5749
  }
5750
5750
  return container;
5751
5751
  }
5752
- var isVue2$1 = false;
5753
- /*!
5754
- * pinia v2.1.4
5755
- * (c) 2023 Eduardo San Martin Morote
5756
- * @license MIT
5757
- */
5758
- const piniaSymbol$1 = (
5759
- /* istanbul ignore next */
5760
- Symbol()
5761
- );
5762
- var MutationType$1;
5763
- (function(MutationType2) {
5764
- MutationType2["direct"] = "direct";
5765
- MutationType2["patchObject"] = "patch object";
5766
- MutationType2["patchFunction"] = "patch function";
5767
- })(MutationType$1 || (MutationType$1 = {}));
5768
- function createPinia$1() {
5769
- const scope = effectScope(true);
5770
- const state = scope.run(() => ref({}));
5771
- let _p = [];
5772
- let toBeInstalled = [];
5773
- const pinia = markRaw({
5774
- install(app2) {
5775
- {
5776
- pinia._a = app2;
5777
- app2.provide(piniaSymbol$1, pinia);
5778
- app2.config.globalProperties.$pinia = pinia;
5779
- toBeInstalled.forEach((plugin) => _p.push(plugin));
5780
- toBeInstalled = [];
5781
- }
5782
- },
5783
- use(plugin) {
5784
- if (!this._a && !isVue2$1) {
5785
- toBeInstalled.push(plugin);
5786
- } else {
5787
- _p.push(plugin);
5788
- }
5789
- return this;
5790
- },
5791
- _p,
5792
- // it's actually undefined here
5793
- // @ts-expect-error
5794
- _a: null,
5795
- _e: scope,
5796
- _s: /* @__PURE__ */ new Map(),
5797
- state
5798
- });
5799
- return pinia;
5800
- }
5801
5752
  var __defProp2 = Object.defineProperty;
5802
5753
  var __defProps2 = Object.defineProperties;
5803
5754
  var __getOwnPropDescs2 = Object.getOwnPropertyDescriptors;
@@ -7682,16 +7633,16 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7682
7633
  resetHighlightIndex
7683
7634
  };
7684
7635
  });
7685
- const _hoisted_1$11 = { id: "lupa-search-box-input-container" };
7686
- const _hoisted_2$H = { class: "lupa-input-clear" };
7687
- const _hoisted_3$t = { id: "lupa-search-box-input" };
7688
- 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"];
7689
7640
  const _hoisted_5$c = ["placeholder"];
7690
7641
  const _hoisted_6$6 = {
7691
7642
  key: 0,
7692
7643
  class: "lupa-close-label"
7693
7644
  };
7694
- const _sfc_main$19 = /* @__PURE__ */ defineComponent({
7645
+ const _sfc_main$1a = /* @__PURE__ */ defineComponent({
7695
7646
  __name: "SearchBoxInput",
7696
7647
  props: {
7697
7648
  options: {},
@@ -7768,19 +7719,19 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7768
7719
  };
7769
7720
  __expose({ focus });
7770
7721
  return (_ctx, _cache) => {
7771
- return openBlock(), createElementBlock("div", _hoisted_1$11, [
7772
- createBaseVNode("div", _hoisted_2$H, [
7722
+ return openBlock(), createElementBlock("div", _hoisted_1$12, [
7723
+ createBaseVNode("div", _hoisted_2$I, [
7773
7724
  createBaseVNode("div", {
7774
7725
  class: normalizeClass(["lupa-input-clear-content", { "lupa-input-clear-filled": inputValue.value }]),
7775
7726
  onClick: clear2
7776
7727
  }, null, 2)
7777
7728
  ]),
7778
- createBaseVNode("div", _hoisted_3$t, [
7729
+ createBaseVNode("div", _hoisted_3$u, [
7779
7730
  createBaseVNode("input", {
7780
7731
  class: "lupa-hint",
7781
7732
  value: showHint.value ? suggestedValue.value.item.suggestion : "",
7782
7733
  disabled: ""
7783
- }, null, 8, _hoisted_4$l),
7734
+ }, null, 8, _hoisted_4$m),
7784
7735
  withDirectives(createBaseVNode("input", mergeProps({
7785
7736
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputValue.value = $event)
7786
7737
  }, inputAttributes.value, {
@@ -7808,7 +7759,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7808
7759
  };
7809
7760
  }
7810
7761
  });
7811
- const _sfc_main$18 = /* @__PURE__ */ defineComponent({
7762
+ const _sfc_main$19 = /* @__PURE__ */ defineComponent({
7812
7763
  __name: "SearchBoxMoreResults",
7813
7764
  props: {
7814
7765
  labels: {},
@@ -7840,9 +7791,9 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7840
7791
  };
7841
7792
  }
7842
7793
  });
7843
- const _hoisted_1$10 = { class: "lupa-search-box-history-item" };
7844
- const _hoisted_2$G = { class: "lupa-search-box-history-item-content" };
7845
- 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({
7846
7797
  __name: "SearchBoxHistoryItem",
7847
7798
  props: {
7848
7799
  item: {},
@@ -7858,8 +7809,8 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7858
7809
  emit2("click", { query: props.item });
7859
7810
  };
7860
7811
  return (_ctx, _cache) => {
7861
- return openBlock(), createElementBlock("div", _hoisted_1$10, [
7862
- createBaseVNode("div", _hoisted_2$G, [
7812
+ return openBlock(), createElementBlock("div", _hoisted_1$11, [
7813
+ createBaseVNode("div", _hoisted_2$H, [
7863
7814
  createBaseVNode("div", {
7864
7815
  class: normalizeClass(["lupa-search-box-history-item-text", { "lupa-search-box-history-item-highlighted": _ctx.highlighted }]),
7865
7816
  onClick: click2
@@ -7873,11 +7824,11 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7873
7824
  };
7874
7825
  }
7875
7826
  });
7876
- const _hoisted_1$$ = {
7827
+ const _hoisted_1$10 = {
7877
7828
  key: 0,
7878
7829
  class: "lupa-search-box-history-panel"
7879
7830
  };
7880
- const _sfc_main$16 = /* @__PURE__ */ defineComponent({
7831
+ const _sfc_main$17 = /* @__PURE__ */ defineComponent({
7881
7832
  __name: "SearchBoxHistoryPanel",
7882
7833
  props: {
7883
7834
  options: {}
@@ -7918,9 +7869,9 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7918
7869
  }
7919
7870
  };
7920
7871
  return (_ctx, _cache) => {
7921
- return hasHistory.value ? (openBlock(), createElementBlock("div", _hoisted_1$$, [
7872
+ return hasHistory.value ? (openBlock(), createElementBlock("div", _hoisted_1$10, [
7922
7873
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(history), (item, index) => {
7923
- return openBlock(), createBlock(_sfc_main$17, {
7874
+ return openBlock(), createBlock(_sfc_main$18, {
7924
7875
  key: item,
7925
7876
  item,
7926
7877
  highlighted: index === highlightIndex.value,
@@ -7936,18 +7887,18 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7936
7887
  };
7937
7888
  }
7938
7889
  });
7939
- const _hoisted_1$_ = ["innerHTML"];
7940
- const _hoisted_2$F = {
7890
+ const _hoisted_1$$ = ["innerHTML"];
7891
+ const _hoisted_2$G = {
7941
7892
  key: 1,
7942
7893
  "data-cy": "lupa-suggestion-value",
7943
7894
  class: "lupa-suggestion-value"
7944
7895
  };
7945
- const _hoisted_3$s = {
7896
+ const _hoisted_3$t = {
7946
7897
  key: 2,
7947
7898
  class: "lupa-suggestion-facet",
7948
7899
  "data-cy": "lupa-suggestion-facet"
7949
7900
  };
7950
- const _hoisted_4$k = {
7901
+ const _hoisted_4$l = {
7951
7902
  class: "lupa-suggestion-facet-label",
7952
7903
  "data-cy": "lupa-suggestion-facet-label"
7953
7904
  };
@@ -7955,7 +7906,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7955
7906
  class: "lupa-suggestion-facet-value",
7956
7907
  "data-cy": "lupa-suggestion-facet-value"
7957
7908
  };
7958
- const _sfc_main$15 = /* @__PURE__ */ defineComponent({
7909
+ const _sfc_main$16 = /* @__PURE__ */ defineComponent({
7959
7910
  __name: "SearchBoxSuggestion",
7960
7911
  props: {
7961
7912
  suggestion: {},
@@ -7991,20 +7942,20 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7991
7942
  class: "lupa-suggestion-value",
7992
7943
  "data-cy": "lupa-suggestion-value",
7993
7944
  innerHTML: _ctx.suggestion.displayHighlight
7994
- }, null, 8, _hoisted_1$_)) : (openBlock(), createElementBlock("div", _hoisted_2$F, toDisplayString(_ctx.suggestion.display), 1)),
7995
- _ctx.suggestion.facet ? (openBlock(), createElementBlock("div", _hoisted_3$s, [
7996
- 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),
7997
7948
  createBaseVNode("span", _hoisted_5$b, toDisplayString(_ctx.suggestion.facet.title), 1)
7998
7949
  ])) : createCommentVNode("", true)
7999
7950
  ]);
8000
7951
  };
8001
7952
  }
8002
7953
  });
8003
- const _hoisted_1$Z = {
7954
+ const _hoisted_1$_ = {
8004
7955
  id: "lupa-search-box-suggestions",
8005
7956
  "data-cy": "lupa-search-box-suggestions"
8006
7957
  };
8007
- const _sfc_main$14 = /* @__PURE__ */ defineComponent({
7958
+ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
8008
7959
  __name: "SearchBoxSuggestions",
8009
7960
  props: {
8010
7961
  items: {},
@@ -8064,9 +8015,9 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8064
8015
  });
8065
8016
  });
8066
8017
  return (_ctx, _cache) => {
8067
- return openBlock(), createElementBlock("div", _hoisted_1$Z, [
8018
+ return openBlock(), createElementBlock("div", _hoisted_1$_, [
8068
8019
  (openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (item, index) => {
8069
- return openBlock(), createBlock(_sfc_main$15, {
8020
+ return openBlock(), createBlock(_sfc_main$16, {
8070
8021
  key: getSuggestionKey(item),
8071
8022
  class: normalizeClass(["lupa-suggestion", index === highlightedIndex.value ? "lupa-suggestion-highlighted" : ""]),
8072
8023
  suggestion: item,
@@ -8094,7 +8045,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8094
8045
  }, timeout);
8095
8046
  };
8096
8047
  };
8097
- const _sfc_main$13 = /* @__PURE__ */ defineComponent({
8048
+ const _sfc_main$14 = /* @__PURE__ */ defineComponent({
8098
8049
  __name: "SearchBoxSuggestionsWrapper",
8099
8050
  props: {
8100
8051
  panel: {},
@@ -8135,7 +8086,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8135
8086
  };
8136
8087
  const getSuggestionsDebounced = debounce$1(getSuggestions, props.debounce);
8137
8088
  return (_ctx, _cache) => {
8138
- return openBlock(), createBlock(_sfc_main$14, {
8089
+ return openBlock(), createBlock(_sfc_main$15, {
8139
8090
  items: searchResult.value,
8140
8091
  highlight: _ctx.panel.highlight,
8141
8092
  queryKey: _ctx.panel.queryKey,
@@ -8213,8 +8164,8 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8213
8164
  });
8214
8165
  return { dynamicDataIdMap, loading, enhanceSearchResultsWithDynamicData };
8215
8166
  });
8216
- const _hoisted_1$Y = ["src"];
8217
- const _sfc_main$12 = /* @__PURE__ */ defineComponent({
8167
+ const _hoisted_1$Z = ["src"];
8168
+ const _sfc_main$13 = /* @__PURE__ */ defineComponent({
8218
8169
  __name: "ProductImage",
8219
8170
  props: {
8220
8171
  item: {},
@@ -8262,12 +8213,12 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8262
8213
  class: normalizeClass((_b = _ctx.imageClass) != null ? _b : ""),
8263
8214
  src: finalUrl.value,
8264
8215
  onError: replaceWithPlaceholder
8265
- }, null, 42, _hoisted_1$Y)
8216
+ }, null, 42, _hoisted_1$Z)
8266
8217
  ], 2);
8267
8218
  };
8268
8219
  }
8269
8220
  });
8270
- const _sfc_main$11 = /* @__PURE__ */ defineComponent({
8221
+ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
8271
8222
  __name: "SearchBoxProductImage",
8272
8223
  props: {
8273
8224
  item: {},
@@ -8275,7 +8226,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8275
8226
  },
8276
8227
  setup(__props) {
8277
8228
  return (_ctx, _cache) => {
8278
- return openBlock(), createBlock(_sfc_main$12, {
8229
+ return openBlock(), createBlock(_sfc_main$13, {
8279
8230
  item: _ctx.item,
8280
8231
  options: _ctx.options,
8281
8232
  "wrapper-class": "lupa-search-box-image-wrapper",
@@ -8284,12 +8235,12 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8284
8235
  };
8285
8236
  }
8286
8237
  });
8287
- const _hoisted_1$X = ["innerHTML"];
8288
- const _hoisted_2$E = {
8238
+ const _hoisted_1$Y = ["innerHTML"];
8239
+ const _hoisted_2$F = {
8289
8240
  key: 1,
8290
8241
  class: "lupa-search-box-product-title"
8291
8242
  };
8292
- const _sfc_main$10 = /* @__PURE__ */ defineComponent({
8243
+ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
8293
8244
  __name: "SearchBoxProductTitle",
8294
8245
  props: {
8295
8246
  item: {},
@@ -8309,18 +8260,18 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8309
8260
  key: 0,
8310
8261
  class: "lupa-search-box-product-title",
8311
8262
  innerHTML: title.value
8312
- }, null, 8, _hoisted_1$X)) : (openBlock(), createElementBlock("div", _hoisted_2$E, [
8263
+ }, null, 8, _hoisted_1$Y)) : (openBlock(), createElementBlock("div", _hoisted_2$F, [
8313
8264
  createBaseVNode("strong", null, toDisplayString(title.value), 1)
8314
8265
  ]));
8315
8266
  };
8316
8267
  }
8317
8268
  });
8318
- const _hoisted_1$W = ["innerHTML"];
8319
- const _hoisted_2$D = {
8269
+ const _hoisted_1$X = ["innerHTML"];
8270
+ const _hoisted_2$E = {
8320
8271
  key: 1,
8321
8272
  class: "lupa-search-box-product-description"
8322
8273
  };
8323
- const _sfc_main$$ = /* @__PURE__ */ defineComponent({
8274
+ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
8324
8275
  __name: "SearchBoxProductDescription",
8325
8276
  props: {
8326
8277
  item: {},
@@ -8340,12 +8291,12 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8340
8291
  key: 0,
8341
8292
  class: "lupa-search-box-product-description",
8342
8293
  innerHTML: description.value
8343
- }, 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));
8344
8295
  };
8345
8296
  }
8346
8297
  });
8347
- const _hoisted_1$V = { class: "lupa-search-box-product-price" };
8348
- const _sfc_main$_ = /* @__PURE__ */ defineComponent({
8298
+ const _hoisted_1$W = { class: "lupa-search-box-product-price" };
8299
+ const _sfc_main$$ = /* @__PURE__ */ defineComponent({
8349
8300
  __name: "SearchBoxProductPrice",
8350
8301
  props: {
8351
8302
  item: {},
@@ -8363,14 +8314,14 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8363
8314
  );
8364
8315
  });
8365
8316
  return (_ctx, _cache) => {
8366
- return openBlock(), createElementBlock("div", _hoisted_1$V, [
8317
+ return openBlock(), createElementBlock("div", _hoisted_1$W, [
8367
8318
  createBaseVNode("strong", null, toDisplayString(price.value), 1)
8368
8319
  ]);
8369
8320
  };
8370
8321
  }
8371
8322
  });
8372
- const _hoisted_1$U = { class: "lupa-search-box-product-regular-price" };
8373
- const _sfc_main$Z = /* @__PURE__ */ defineComponent({
8323
+ const _hoisted_1$V = { class: "lupa-search-box-product-regular-price" };
8324
+ const _sfc_main$_ = /* @__PURE__ */ defineComponent({
8374
8325
  __name: "SearchBoxProductRegularPrice",
8375
8326
  props: {
8376
8327
  item: {},
@@ -8388,16 +8339,16 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8388
8339
  );
8389
8340
  });
8390
8341
  return (_ctx, _cache) => {
8391
- return openBlock(), createElementBlock("div", _hoisted_1$U, toDisplayString(price.value), 1);
8342
+ return openBlock(), createElementBlock("div", _hoisted_1$V, toDisplayString(price.value), 1);
8392
8343
  };
8393
8344
  }
8394
8345
  });
8395
- const _hoisted_1$T = ["innerHTML"];
8396
- const _hoisted_2$C = { key: 0 };
8397
- const _hoisted_3$r = { key: 1 };
8398
- 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" };
8399
8350
  const _hoisted_5$a = { class: "lupa-search-box-custom-text" };
8400
- const _sfc_main$Y = /* @__PURE__ */ defineComponent({
8351
+ const _sfc_main$Z = /* @__PURE__ */ defineComponent({
8401
8352
  __name: "SearchBoxProductCustom",
8402
8353
  props: {
8403
8354
  item: {},
@@ -8423,52 +8374,288 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8423
8374
  key: 0,
8424
8375
  class: [className.value, "lupa-search-box-product-custom"],
8425
8376
  innerHTML: text.value
8426
- }, 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({
8427
8378
  key: 1,
8428
8379
  class: [className.value, "lupa-search-box-product-custom"]
8429
8380
  }, toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), [
8430
- !label.value ? (openBlock(), createElementBlock("div", _hoisted_2$C, toDisplayString(text.value), 1)) : (openBlock(), createElementBlock("div", _hoisted_3$r, [
8431
- 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),
8432
8383
  createBaseVNode("div", _hoisted_5$a, toDisplayString(text.value), 1)
8433
8384
  ]))
8434
8385
  ], 16));
8435
8386
  };
8436
8387
  }
8437
8388
  });
8438
- const _hoisted_1$S = ["innerHTML"];
8439
- const _sfc_main$X = /* @__PURE__ */ defineComponent({
8389
+ const _hoisted_1$T = ["innerHTML"];
8390
+ const _sfc_main$Y = /* @__PURE__ */ defineComponent({
8440
8391
  __name: "SearchBoxProductCustomHtml",
8441
8392
  props: {
8442
8393
  item: {},
8443
8394
  options: {}
8444
8395
  },
8445
- setup(__props) {
8396
+ setup(__props) {
8397
+ const props = __props;
8398
+ const text = computed(() => props.options.html(props.item));
8399
+ const className = computed(() => props.options.className);
8400
+ const handleClick = () => __async(this, null, function* () {
8401
+ if (!props.options.action) {
8402
+ return;
8403
+ }
8404
+ yield props.options.action(props.item);
8405
+ });
8406
+ return (_ctx, _cache) => {
8407
+ return openBlock(), createElementBlock("div", mergeProps({
8408
+ class: className.value,
8409
+ innerHTML: text.value
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 }) {
8446
8617
  const props = __props;
8447
- const text = computed(() => props.options.html(props.item));
8448
- const className = computed(() => props.options.className);
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
+ });
8449
8628
  const handleClick = () => __async(this, null, function* () {
8450
- if (!props.options.action) {
8451
- return;
8452
- }
8453
- yield props.options.action(props.item);
8629
+ loading.value = true;
8630
+ yield props.options.action(props.item, addToCartAmount.value);
8631
+ emit2("productEvent", { type: "addToCart" });
8632
+ loading.value = false;
8454
8633
  });
8455
8634
  return (_ctx, _cache) => {
8456
- return openBlock(), createElementBlock("div", mergeProps({
8457
- class: className.value,
8458
- innerHTML: text.value
8459
- }, toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), null, 16, _hoisted_1$S);
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
+ ]);
8460
8646
  };
8461
8647
  }
8462
8648
  });
8463
8649
  const __default__$4 = {
8464
8650
  components: {
8465
- SearchBoxProductImage: _sfc_main$11,
8466
- SearchBoxProductTitle: _sfc_main$10,
8467
- SearchBoxProductDescription: _sfc_main$$,
8468
- SearchBoxProductPrice: _sfc_main$_,
8469
- SearchBoxProductRegularPrice: _sfc_main$Z,
8470
- SearchBoxProductCustom: _sfc_main$Y,
8471
- 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
8472
8659
  }
8473
8660
  };
8474
8661
  const _sfc_main$W = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValues2({}, __default__$4), {
@@ -8476,7 +8663,8 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8476
8663
  props: {
8477
8664
  item: {},
8478
8665
  element: {},
8479
- labels: {}
8666
+ labels: {},
8667
+ isInStock: { type: Boolean }
8480
8668
  },
8481
8669
  setup(__props) {
8482
8670
  const props = __props;
@@ -8498,6 +8686,8 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8498
8686
  return "search-box-product-custom";
8499
8687
  case DocumentElementType.CUSTOM_HTML:
8500
8688
  return "search-box-product-custom-html";
8689
+ case DocumentElementType.ADDTOCART:
8690
+ return "search-box-product-add-to-cart";
8501
8691
  }
8502
8692
  return "search-box-product-title";
8503
8693
  });
@@ -8521,8 +8711,9 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8521
8711
  item: enhancedItem.value,
8522
8712
  options: _ctx.element,
8523
8713
  labels: _ctx.labels,
8524
- class: normalizeClass({ "lupa-loading-dynamic-data": isLoadingDynamicData.value })
8525
- }, 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);
8526
8717
  };
8527
8718
  }
8528
8719
  }));
@@ -8584,6 +8775,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8584
8775
  const _hoisted_1$R = ["href"];
8585
8776
  const _hoisted_2$B = { class: "lupa-search-box-product-image-section" };
8586
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
+ };
8587
8782
  const _sfc_main$V = /* @__PURE__ */ defineComponent({
8588
8783
  __name: "SearchBoxProduct",
8589
8784
  props: {
@@ -8599,6 +8794,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8599
8794
  const historyStore = useHistoryStore();
8600
8795
  const trackingStore = useTrackingStore();
8601
8796
  const optionsStore = useOptionsStore();
8797
+ const isInStock = ref(true);
8602
8798
  const { boxRoutingBehavior } = storeToRefs(optionsStore);
8603
8799
  const link = computed(() => {
8604
8800
  var _a, _b;
@@ -8610,7 +8806,9 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8610
8806
  });
8611
8807
  const detailElements = computed(() => {
8612
8808
  var _a, _b;
8613
- 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 : [];
8614
8812
  });
8615
8813
  const id = computed(() => {
8616
8814
  if (props.panelOptions.idKey) {
@@ -8628,6 +8826,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8628
8826
  });
8629
8827
  return title2;
8630
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
+ });
8631
8833
  const handleClick = (event) => {
8632
8834
  var _a;
8633
8835
  if (props.panelOptions.titleKey) {
@@ -8657,6 +8859,12 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8657
8859
  emit2("product-click");
8658
8860
  handleRoutingEvent(link.value, event, boxRoutingBehavior.value === "event");
8659
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
+ });
8660
8868
  return (_ctx, _cache) => {
8661
8869
  return openBlock(), createElementBlock("a", {
8662
8870
  class: normalizeClass(["lupa-search-box-product", { "lupa-search-box-product-highlighted": _ctx.highlighted }]),
@@ -8687,7 +8895,17 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8687
8895
  link: link.value
8688
8896
  }, null, 8, ["item", "element", "labels", "link"]);
8689
8897
  }), 128))
8690
- ])
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)
8691
8909
  ], 10, _hoisted_1$R);
8692
8910
  };
8693
8911
  }
@@ -8821,7 +9039,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8821
9039
  };
8822
9040
  const __default__$3 = {
8823
9041
  components: {
8824
- SearchBoxSuggestionsWrapper: _sfc_main$13,
9042
+ SearchBoxSuggestionsWrapper: _sfc_main$14,
8825
9043
  SearchBoxProductsWrapper: _sfc_main$T
8826
9044
  }
8827
9045
  };
@@ -8971,13 +9189,13 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8971
9189
  ], 10, _hoisted_2$A);
8972
9190
  }), 128))
8973
9191
  ]),
8974
- createVNode(_sfc_main$18, {
9192
+ createVNode(_sfc_main$19, {
8975
9193
  labels: labels.value,
8976
9194
  showTotalCount: (_a = _ctx.options.showTotalCount) != null ? _a : false,
8977
9195
  onGoToResults: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("go-to-results"))
8978
9196
  }, null, 8, ["labels", "showTotalCount"])
8979
9197
  ], 512)) : displayHistory.value ? (openBlock(), createElementBlock("div", _hoisted_3$p, [
8980
- createVNode(_sfc_main$16, {
9198
+ createVNode(_sfc_main$17, {
8981
9199
  ref: "panel",
8982
9200
  options: _ctx.options.history,
8983
9201
  history: history.value,
@@ -9238,7 +9456,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
9238
9456
  var _a2;
9239
9457
  return openBlock(), createElementBlock("div", _hoisted_1$O, [
9240
9458
  createBaseVNode("div", _hoisted_2$z, [
9241
- createVNode(_sfc_main$19, {
9459
+ createVNode(_sfc_main$1a, {
9242
9460
  options: inputOptions.value,
9243
9461
  suggestedValue: suggestedValue.value,
9244
9462
  "can-close": (_a2 = _ctx.isSearchContainer) != null ? _a2 : false,
@@ -9272,197 +9490,6 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
9272
9490
  };
9273
9491
  }
9274
9492
  });
9275
- var ResultsLayoutEnum = /* @__PURE__ */ ((ResultsLayoutEnum2) => {
9276
- ResultsLayoutEnum2["GRID"] = "Grid";
9277
- ResultsLayoutEnum2["LIST"] = "List";
9278
- return ResultsLayoutEnum2;
9279
- })(ResultsLayoutEnum || {});
9280
- const RESULT_ROOT_ID = "lupa-search-results";
9281
- const SHADOW_ROOT_ID = "lupa-shadow-id";
9282
- const CONTAINER_ROOT_ID = "lupa-search-container";
9283
- const scrollToSearchResults = (timeout = 500) => {
9284
- if (timeout) {
9285
- setTimeout(() => scrollTo(RESULT_ROOT_ID), timeout);
9286
- } else {
9287
- scrollTo(RESULT_ROOT_ID);
9288
- }
9289
- };
9290
- const scrollTo = (elementId) => {
9291
- var _a, _b;
9292
- let el = document.getElementById(elementId);
9293
- const shadowRoot = (_a = document.getElementById(SHADOW_ROOT_ID)) == null ? void 0 : _a.shadowRoot;
9294
- if (!el) {
9295
- el = (_b = shadowRoot == null ? void 0 : shadowRoot.getElementById(elementId)) != null ? _b : null;
9296
- }
9297
- if (!el) {
9298
- return;
9299
- }
9300
- const searchContainer2 = shadowRoot ? shadowRoot.getElementById(CONTAINER_ROOT_ID) : void 0;
9301
- const container = searchContainer2 != null ? searchContainer2 : window;
9302
- container.scrollTo({
9303
- top: el.offsetTop,
9304
- behavior: "smooth"
9305
- });
9306
- };
9307
- const disableBodyScroll = () => {
9308
- const scrollY = window.scrollY;
9309
- document.body.style.position = "fixed";
9310
- document.body.style.top = `-${scrollY}px`;
9311
- };
9312
- const enableBodyScroll = () => {
9313
- const scrollY = document.body.style.top;
9314
- document.body.style.position = "";
9315
- document.body.style.top = "";
9316
- window.scrollTo(0, parseInt(scrollY || "0") * -1);
9317
- };
9318
- const setDocumentTitle = (template, textToInsert = "") => {
9319
- document.title = addParamsToLabel(template, textToInsert);
9320
- };
9321
- const useSearchResultStore = defineStore("searchResult", () => {
9322
- const searchResult = ref({});
9323
- const columnCount = ref(2);
9324
- const addToCartAmount = ref(1);
9325
- const layout = ref(ResultsLayoutEnum.GRID);
9326
- const loading = ref(false);
9327
- const isMobileSidebarVisible = ref(false);
9328
- const optionsStore = useOptionsStore();
9329
- const paramsStore = useParamsStore();
9330
- const facets = computed(() => searchResult.value.facets);
9331
- const filters = computed(() => searchResult.value.filters);
9332
- const currentQueryText = computed(() => searchResult.value.searchText);
9333
- const totalItems = computed(() => searchResult.value.total);
9334
- const hasResults = computed(() => totalItems.value > 0);
9335
- const labeledFilters = computed(
9336
- () => getLabeledFilters(unfoldFilters(filters.value), facets.value)
9337
- );
9338
- const displayFilters = computed(() => {
9339
- var _a, _b;
9340
- const initialFilters = optionsStore.initialFilters;
9341
- return (_b = (_a = labeledFilters.value) == null ? void 0 : _a.filter((f2) => !(initialFilters == null ? void 0 : initialFilters[f2.key]))) != null ? _b : [];
9342
- });
9343
- const currentFilterCount = computed(() => {
9344
- var _a, _b;
9345
- return (_b = (_a = displayFilters.value) == null ? void 0 : _a.length) != null ? _b : 0;
9346
- });
9347
- const currentFilterKeys = computed(() => {
9348
- var _a;
9349
- return Object.keys((_a = filters.value) != null ? _a : {});
9350
- });
9351
- const hasAnyFilter = computed(() => {
9352
- var _a;
9353
- return Object.keys((_a = filters.value) != null ? _a : {}).length > 0;
9354
- });
9355
- const itemRange = computed(() => {
9356
- var _a, _b;
9357
- const limit = (_a = paramsStore.limit) != null ? _a : 0;
9358
- const offset = (_b = searchResult.value.offset) != null ? _b : 0;
9359
- return [offset + 1, Math.min(offset + limit, totalItems.value)];
9360
- });
9361
- const isPageEmpty = computed(
9362
- () => {
9363
- var _a;
9364
- return hasResults.value && ((_a = searchResult.value.offset) != null ? _a : 0) >= totalItems.value;
9365
- }
9366
- );
9367
- const setSidebarState = ({ visible }) => {
9368
- if (visible) {
9369
- disableBodyScroll();
9370
- } else {
9371
- enableBodyScroll();
9372
- }
9373
- isMobileSidebarVisible.value = visible;
9374
- };
9375
- const queryFacet = (_0) => __async(void 0, [_0], function* ({ queryKey, facetKey }) {
9376
- var _a, _b, _c, _d;
9377
- const query = { searchText: "", filters: __spreadValues2({}, filters.value) };
9378
- const options = (_a = optionsStore.envOptions) != null ? _a : { environment: "production" };
9379
- const result = yield LupaSearchSdk.query(queryKey, query, options);
9380
- if (!result.success) {
9381
- return;
9382
- }
9383
- const facet = (_b = result.facets) == null ? void 0 : _b.find((f2) => f2.key === facetKey);
9384
- const facetItems = (_c = facet == null ? void 0 : facet.items) != null ? _c : [];
9385
- const updatedResult = __spreadProps2(__spreadValues2({}, searchResult.value), {
9386
- facets: (_d = facets.value) == null ? void 0 : _d.map((f2) => f2.key === facetKey ? __spreadProps2(__spreadValues2({}, f2), { items: facetItems }) : f2)
9387
- });
9388
- searchResult.value = updatedResult;
9389
- });
9390
- const add2 = (newSearchResult) => {
9391
- var _a, _b;
9392
- if (!newSearchResult) {
9393
- return {
9394
- searchResult: searchResult.value,
9395
- pageSize: searchResult.value.limit || 0
9396
- };
9397
- }
9398
- if (typeof document !== "undefined") {
9399
- setDocumentTitle(
9400
- (_b = (_a = optionsStore.searchResultOptions) == null ? void 0 : _a.labels) == null ? void 0 : _b.htmlTitleTemplate,
9401
- newSearchResult.searchText
9402
- );
9403
- }
9404
- searchResult.value = newSearchResult;
9405
- return { searchResult: newSearchResult };
9406
- };
9407
- const setColumnCount = ({ width, grid }) => {
9408
- if (!width || !grid) {
9409
- return;
9410
- }
9411
- if (width <= S_MIN_WIDTH) {
9412
- columnCount.value = grid.columns.xs;
9413
- } else if (width > S_MIN_WIDTH && width <= MD_MIN_WIDTH) {
9414
- columnCount.value = grid.columns.sm;
9415
- } else if (width > MD_MIN_WIDTH && width <= L_MIN_WIDTH) {
9416
- columnCount.value = grid.columns.md;
9417
- } else if (width > L_MIN_WIDTH && width <= XL_MIN_WIDTH) {
9418
- columnCount.value = grid.columns.l;
9419
- } else {
9420
- columnCount.value = grid.columns.xl;
9421
- }
9422
- };
9423
- const setAddToCartAmount = (newAddToCartAmount) => {
9424
- if (!newAddToCartAmount) {
9425
- return;
9426
- }
9427
- addToCartAmount.value = newAddToCartAmount;
9428
- };
9429
- const setLayout = (newLayout) => {
9430
- if (!newLayout) {
9431
- return;
9432
- }
9433
- layout.value = newLayout;
9434
- };
9435
- const setLoading = (state) => {
9436
- loading.value = state || false;
9437
- };
9438
- return {
9439
- isMobileSidebarVisible,
9440
- searchResult,
9441
- columnCount,
9442
- addToCartAmount,
9443
- facets,
9444
- filters,
9445
- loading,
9446
- layout,
9447
- currentQueryText,
9448
- totalItems,
9449
- hasResults,
9450
- labeledFilters,
9451
- displayFilters,
9452
- currentFilterCount,
9453
- currentFilterKeys,
9454
- hasAnyFilter,
9455
- itemRange,
9456
- isPageEmpty,
9457
- setSidebarState,
9458
- queryFacet,
9459
- add: add2,
9460
- setColumnCount,
9461
- setAddToCartAmount,
9462
- setLayout,
9463
- setLoading
9464
- };
9465
- });
9466
9493
  const createPublicQuery = (queryParams, sortOptions, defaultPageSize) => {
9467
9494
  var _a;
9468
9495
  const publicQuery = {};
@@ -12612,7 +12639,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
12612
12639
  },
12613
12640
  setup(__props) {
12614
12641
  return (_ctx, _cache) => {
12615
- return openBlock(), createBlock(_sfc_main$12, {
12642
+ return openBlock(), createBlock(_sfc_main$13, {
12616
12643
  item: _ctx.item,
12617
12644
  options: _ctx.options,
12618
12645
  "wrapper-class": "lupa-search-results-image-wrapper",
@@ -20430,7 +20457,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20430
20457
  class: "lupa-recommended-products",
20431
20458
  "data-cy": "lupa-recommended-products"
20432
20459
  };
20433
- const _sfc_main$1a = /* @__PURE__ */ defineComponent({
20460
+ const _sfc_main$1b = /* @__PURE__ */ defineComponent({
20434
20461
  __name: "Recommendations",
20435
20462
  props: {
20436
20463
  options: {}
@@ -20545,17 +20572,17 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20545
20572
  };
20546
20573
  }
20547
20574
  });
20548
- let piniaInstance$1 = null;
20549
- const initPinia$1 = () => {
20550
- if (piniaInstance$1) {
20551
- return piniaInstance$1;
20575
+ let piniaInstance = null;
20576
+ const initPinia = () => {
20577
+ if (piniaInstance) {
20578
+ return piniaInstance;
20552
20579
  }
20553
20580
  const pinia = createPinia();
20554
- piniaInstance$1 = pinia;
20581
+ piniaInstance = pinia;
20555
20582
  return pinia;
20556
20583
  };
20557
20584
  const setupTracking = (options) => {
20558
- const pinia = initPinia$1();
20585
+ const pinia = initPinia();
20559
20586
  const store = useOptionsStore(pinia);
20560
20587
  initTracking(options);
20561
20588
  store.setTrackingOptions({ options });
@@ -26363,7 +26390,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26363
26390
  };
26364
26391
  __expose({ fetch: fetch2 });
26365
26392
  return (_ctx, _cache) => {
26366
- return openBlock(), createBlock(unref(_sfc_main$1a), {
26393
+ return openBlock(), createBlock(unref(_sfc_main$1b), {
26367
26394
  options: _ctx.recommendationOptions,
26368
26395
  ref_key: "productRecommendations",
26369
26396
  ref: productRecommendations
@@ -26423,15 +26450,6 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26423
26450
  searchContainer: {},
26424
26451
  recommendations: {}
26425
26452
  };
26426
- let piniaInstance = null;
26427
- const initPinia = () => {
26428
- if (piniaInstance) {
26429
- return piniaInstance;
26430
- }
26431
- const pinia = createPinia$1();
26432
- piniaInstance = pinia;
26433
- return pinia;
26434
- };
26435
26453
  const tracking = (options) => {
26436
26454
  setupTracking(options);
26437
26455
  };
@@ -26516,7 +26534,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26516
26534
  return;
26517
26535
  }
26518
26536
  const instance = createVue(options.containerSelector, _sfc_main$2, {
26519
- productsListOptions: options
26537
+ productListOptions: options
26520
26538
  });
26521
26539
  if (!instance) {
26522
26540
  return;