@getlupa/vue 0.0.14 → 0.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.
@@ -2989,16 +2989,16 @@ const useSearchBoxStore = defineStore("searchBox", () => {
2989
2989
  resetHighlightIndex
2990
2990
  };
2991
2991
  });
2992
- const _hoisted_1$11 = { id: "lupa-search-box-input-container" };
2993
- const _hoisted_2$H = { class: "lupa-input-clear" };
2994
- const _hoisted_3$t = { id: "lupa-search-box-input" };
2995
- const _hoisted_4$l = ["value"];
2992
+ const _hoisted_1$12 = { id: "lupa-search-box-input-container" };
2993
+ const _hoisted_2$I = { class: "lupa-input-clear" };
2994
+ const _hoisted_3$u = { id: "lupa-search-box-input" };
2995
+ const _hoisted_4$m = ["value"];
2996
2996
  const _hoisted_5$c = ["placeholder"];
2997
2997
  const _hoisted_6$6 = {
2998
2998
  key: 0,
2999
2999
  class: "lupa-close-label"
3000
3000
  };
3001
- const _sfc_main$19 = /* @__PURE__ */ vue.defineComponent({
3001
+ const _sfc_main$1a = /* @__PURE__ */ vue.defineComponent({
3002
3002
  __name: "SearchBoxInput",
3003
3003
  props: {
3004
3004
  options: {},
@@ -3075,19 +3075,19 @@ const _sfc_main$19 = /* @__PURE__ */ vue.defineComponent({
3075
3075
  };
3076
3076
  __expose({ focus });
3077
3077
  return (_ctx, _cache) => {
3078
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$11, [
3079
- vue.createElementVNode("div", _hoisted_2$H, [
3078
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$12, [
3079
+ vue.createElementVNode("div", _hoisted_2$I, [
3080
3080
  vue.createElementVNode("div", {
3081
3081
  class: vue.normalizeClass(["lupa-input-clear-content", { "lupa-input-clear-filled": inputValue.value }]),
3082
3082
  onClick: clear
3083
3083
  }, null, 2)
3084
3084
  ]),
3085
- vue.createElementVNode("div", _hoisted_3$t, [
3085
+ vue.createElementVNode("div", _hoisted_3$u, [
3086
3086
  vue.createElementVNode("input", {
3087
3087
  class: "lupa-hint",
3088
3088
  value: showHint.value ? suggestedValue.value.item.suggestion : "",
3089
3089
  disabled: ""
3090
- }, null, 8, _hoisted_4$l),
3090
+ }, null, 8, _hoisted_4$m),
3091
3091
  vue.withDirectives(vue.createElementVNode("input", vue.mergeProps({
3092
3092
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputValue.value = $event)
3093
3093
  }, inputAttributes.value, {
@@ -3115,7 +3115,7 @@ const _sfc_main$19 = /* @__PURE__ */ vue.defineComponent({
3115
3115
  };
3116
3116
  }
3117
3117
  });
3118
- const _sfc_main$18 = /* @__PURE__ */ vue.defineComponent({
3118
+ const _sfc_main$19 = /* @__PURE__ */ vue.defineComponent({
3119
3119
  __name: "SearchBoxMoreResults",
3120
3120
  props: {
3121
3121
  labels: {},
@@ -3147,9 +3147,9 @@ const _sfc_main$18 = /* @__PURE__ */ vue.defineComponent({
3147
3147
  };
3148
3148
  }
3149
3149
  });
3150
- const _hoisted_1$10 = { class: "lupa-search-box-history-item" };
3151
- const _hoisted_2$G = { class: "lupa-search-box-history-item-content" };
3152
- const _sfc_main$17 = /* @__PURE__ */ vue.defineComponent({
3150
+ const _hoisted_1$11 = { class: "lupa-search-box-history-item" };
3151
+ const _hoisted_2$H = { class: "lupa-search-box-history-item-content" };
3152
+ const _sfc_main$18 = /* @__PURE__ */ vue.defineComponent({
3153
3153
  __name: "SearchBoxHistoryItem",
3154
3154
  props: {
3155
3155
  item: {},
@@ -3165,8 +3165,8 @@ const _sfc_main$17 = /* @__PURE__ */ vue.defineComponent({
3165
3165
  emit("click", { query: props.item });
3166
3166
  };
3167
3167
  return (_ctx, _cache) => {
3168
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$10, [
3169
- vue.createElementVNode("div", _hoisted_2$G, [
3168
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$11, [
3169
+ vue.createElementVNode("div", _hoisted_2$H, [
3170
3170
  vue.createElementVNode("div", {
3171
3171
  class: vue.normalizeClass(["lupa-search-box-history-item-text", { "lupa-search-box-history-item-highlighted": _ctx.highlighted }]),
3172
3172
  onClick: click2
@@ -3180,11 +3180,11 @@ const _sfc_main$17 = /* @__PURE__ */ vue.defineComponent({
3180
3180
  };
3181
3181
  }
3182
3182
  });
3183
- const _hoisted_1$$ = {
3183
+ const _hoisted_1$10 = {
3184
3184
  key: 0,
3185
3185
  class: "lupa-search-box-history-panel"
3186
3186
  };
3187
- const _sfc_main$16 = /* @__PURE__ */ vue.defineComponent({
3187
+ const _sfc_main$17 = /* @__PURE__ */ vue.defineComponent({
3188
3188
  __name: "SearchBoxHistoryPanel",
3189
3189
  props: {
3190
3190
  options: {}
@@ -3225,9 +3225,9 @@ const _sfc_main$16 = /* @__PURE__ */ vue.defineComponent({
3225
3225
  }
3226
3226
  };
3227
3227
  return (_ctx, _cache) => {
3228
- return hasHistory.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$$, [
3228
+ return hasHistory.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$10, [
3229
3229
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(history), (item, index) => {
3230
- return vue.openBlock(), vue.createBlock(_sfc_main$17, {
3230
+ return vue.openBlock(), vue.createBlock(_sfc_main$18, {
3231
3231
  key: item,
3232
3232
  item,
3233
3233
  highlighted: index === highlightIndex.value,
@@ -3243,18 +3243,18 @@ const _sfc_main$16 = /* @__PURE__ */ vue.defineComponent({
3243
3243
  };
3244
3244
  }
3245
3245
  });
3246
- const _hoisted_1$_ = ["innerHTML"];
3247
- const _hoisted_2$F = {
3246
+ const _hoisted_1$$ = ["innerHTML"];
3247
+ const _hoisted_2$G = {
3248
3248
  key: 1,
3249
3249
  "data-cy": "lupa-suggestion-value",
3250
3250
  class: "lupa-suggestion-value"
3251
3251
  };
3252
- const _hoisted_3$s = {
3252
+ const _hoisted_3$t = {
3253
3253
  key: 2,
3254
3254
  class: "lupa-suggestion-facet",
3255
3255
  "data-cy": "lupa-suggestion-facet"
3256
3256
  };
3257
- const _hoisted_4$k = {
3257
+ const _hoisted_4$l = {
3258
3258
  class: "lupa-suggestion-facet-label",
3259
3259
  "data-cy": "lupa-suggestion-facet-label"
3260
3260
  };
@@ -3262,7 +3262,7 @@ const _hoisted_5$b = {
3262
3262
  class: "lupa-suggestion-facet-value",
3263
3263
  "data-cy": "lupa-suggestion-facet-value"
3264
3264
  };
3265
- const _sfc_main$15 = /* @__PURE__ */ vue.defineComponent({
3265
+ const _sfc_main$16 = /* @__PURE__ */ vue.defineComponent({
3266
3266
  __name: "SearchBoxSuggestion",
3267
3267
  props: {
3268
3268
  suggestion: {},
@@ -3298,20 +3298,20 @@ const _sfc_main$15 = /* @__PURE__ */ vue.defineComponent({
3298
3298
  class: "lupa-suggestion-value",
3299
3299
  "data-cy": "lupa-suggestion-value",
3300
3300
  innerHTML: _ctx.suggestion.displayHighlight
3301
- }, null, 8, _hoisted_1$_)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$F, vue.toDisplayString(_ctx.suggestion.display), 1)),
3302
- _ctx.suggestion.facet ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$s, [
3303
- vue.createElementVNode("span", _hoisted_4$k, vue.toDisplayString(facetLabel.value), 1),
3301
+ }, null, 8, _hoisted_1$$)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$G, vue.toDisplayString(_ctx.suggestion.display), 1)),
3302
+ _ctx.suggestion.facet ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$t, [
3303
+ vue.createElementVNode("span", _hoisted_4$l, vue.toDisplayString(facetLabel.value), 1),
3304
3304
  vue.createElementVNode("span", _hoisted_5$b, vue.toDisplayString(_ctx.suggestion.facet.title), 1)
3305
3305
  ])) : vue.createCommentVNode("", true)
3306
3306
  ]);
3307
3307
  };
3308
3308
  }
3309
3309
  });
3310
- const _hoisted_1$Z = {
3310
+ const _hoisted_1$_ = {
3311
3311
  id: "lupa-search-box-suggestions",
3312
3312
  "data-cy": "lupa-search-box-suggestions"
3313
3313
  };
3314
- const _sfc_main$14 = /* @__PURE__ */ vue.defineComponent({
3314
+ const _sfc_main$15 = /* @__PURE__ */ vue.defineComponent({
3315
3315
  __name: "SearchBoxSuggestions",
3316
3316
  props: {
3317
3317
  items: {},
@@ -3371,9 +3371,9 @@ const _sfc_main$14 = /* @__PURE__ */ vue.defineComponent({
3371
3371
  });
3372
3372
  });
3373
3373
  return (_ctx, _cache) => {
3374
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$Z, [
3374
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$_, [
3375
3375
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(items.value, (item, index) => {
3376
- return vue.openBlock(), vue.createBlock(_sfc_main$15, {
3376
+ return vue.openBlock(), vue.createBlock(_sfc_main$16, {
3377
3377
  key: getSuggestionKey(item),
3378
3378
  class: vue.normalizeClass(["lupa-suggestion", index === highlightedIndex.value ? "lupa-suggestion-highlighted" : ""]),
3379
3379
  suggestion: item,
@@ -3401,7 +3401,7 @@ const debounce$1 = (func, timeout) => {
3401
3401
  }, timeout);
3402
3402
  };
3403
3403
  };
3404
- const _sfc_main$13 = /* @__PURE__ */ vue.defineComponent({
3404
+ const _sfc_main$14 = /* @__PURE__ */ vue.defineComponent({
3405
3405
  __name: "SearchBoxSuggestionsWrapper",
3406
3406
  props: {
3407
3407
  panel: {},
@@ -3442,7 +3442,7 @@ const _sfc_main$13 = /* @__PURE__ */ vue.defineComponent({
3442
3442
  };
3443
3443
  const getSuggestionsDebounced = debounce$1(getSuggestions, props.debounce);
3444
3444
  return (_ctx, _cache) => {
3445
- return vue.openBlock(), vue.createBlock(_sfc_main$14, {
3445
+ return vue.openBlock(), vue.createBlock(_sfc_main$15, {
3446
3446
  items: searchResult.value,
3447
3447
  highlight: _ctx.panel.highlight,
3448
3448
  queryKey: _ctx.panel.queryKey,
@@ -3520,8 +3520,8 @@ const useDynamicDataStore = defineStore("dynamicData", () => {
3520
3520
  });
3521
3521
  return { dynamicDataIdMap, loading, enhanceSearchResultsWithDynamicData };
3522
3522
  });
3523
- const _hoisted_1$Y = ["src"];
3524
- const _sfc_main$12 = /* @__PURE__ */ vue.defineComponent({
3523
+ const _hoisted_1$Z = ["src"];
3524
+ const _sfc_main$13 = /* @__PURE__ */ vue.defineComponent({
3525
3525
  __name: "ProductImage",
3526
3526
  props: {
3527
3527
  item: {},
@@ -3569,12 +3569,12 @@ const _sfc_main$12 = /* @__PURE__ */ vue.defineComponent({
3569
3569
  class: vue.normalizeClass((_b = _ctx.imageClass) != null ? _b : ""),
3570
3570
  src: finalUrl.value,
3571
3571
  onError: replaceWithPlaceholder
3572
- }, null, 42, _hoisted_1$Y)
3572
+ }, null, 42, _hoisted_1$Z)
3573
3573
  ], 2);
3574
3574
  };
3575
3575
  }
3576
3576
  });
3577
- const _sfc_main$11 = /* @__PURE__ */ vue.defineComponent({
3577
+ const _sfc_main$12 = /* @__PURE__ */ vue.defineComponent({
3578
3578
  __name: "SearchBoxProductImage",
3579
3579
  props: {
3580
3580
  item: {},
@@ -3582,7 +3582,7 @@ const _sfc_main$11 = /* @__PURE__ */ vue.defineComponent({
3582
3582
  },
3583
3583
  setup(__props) {
3584
3584
  return (_ctx, _cache) => {
3585
- return vue.openBlock(), vue.createBlock(_sfc_main$12, {
3585
+ return vue.openBlock(), vue.createBlock(_sfc_main$13, {
3586
3586
  item: _ctx.item,
3587
3587
  options: _ctx.options,
3588
3588
  "wrapper-class": "lupa-search-box-image-wrapper",
@@ -3591,12 +3591,12 @@ const _sfc_main$11 = /* @__PURE__ */ vue.defineComponent({
3591
3591
  };
3592
3592
  }
3593
3593
  });
3594
- const _hoisted_1$X = ["innerHTML"];
3595
- const _hoisted_2$E = {
3594
+ const _hoisted_1$Y = ["innerHTML"];
3595
+ const _hoisted_2$F = {
3596
3596
  key: 1,
3597
3597
  class: "lupa-search-box-product-title"
3598
3598
  };
3599
- const _sfc_main$10 = /* @__PURE__ */ vue.defineComponent({
3599
+ const _sfc_main$11 = /* @__PURE__ */ vue.defineComponent({
3600
3600
  __name: "SearchBoxProductTitle",
3601
3601
  props: {
3602
3602
  item: {},
@@ -3616,18 +3616,18 @@ const _sfc_main$10 = /* @__PURE__ */ vue.defineComponent({
3616
3616
  key: 0,
3617
3617
  class: "lupa-search-box-product-title",
3618
3618
  innerHTML: title.value
3619
- }, null, 8, _hoisted_1$X)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$E, [
3619
+ }, null, 8, _hoisted_1$Y)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$F, [
3620
3620
  vue.createElementVNode("strong", null, vue.toDisplayString(title.value), 1)
3621
3621
  ]));
3622
3622
  };
3623
3623
  }
3624
3624
  });
3625
- const _hoisted_1$W = ["innerHTML"];
3626
- const _hoisted_2$D = {
3625
+ const _hoisted_1$X = ["innerHTML"];
3626
+ const _hoisted_2$E = {
3627
3627
  key: 1,
3628
3628
  class: "lupa-search-box-product-description"
3629
3629
  };
3630
- const _sfc_main$$ = /* @__PURE__ */ vue.defineComponent({
3630
+ const _sfc_main$10 = /* @__PURE__ */ vue.defineComponent({
3631
3631
  __name: "SearchBoxProductDescription",
3632
3632
  props: {
3633
3633
  item: {},
@@ -3647,12 +3647,12 @@ const _sfc_main$$ = /* @__PURE__ */ vue.defineComponent({
3647
3647
  key: 0,
3648
3648
  class: "lupa-search-box-product-description",
3649
3649
  innerHTML: description.value
3650
- }, null, 8, _hoisted_1$W)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$D, vue.toDisplayString(description.value), 1));
3650
+ }, null, 8, _hoisted_1$X)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$E, vue.toDisplayString(description.value), 1));
3651
3651
  };
3652
3652
  }
3653
3653
  });
3654
- const _hoisted_1$V = { class: "lupa-search-box-product-price" };
3655
- const _sfc_main$_ = /* @__PURE__ */ vue.defineComponent({
3654
+ const _hoisted_1$W = { class: "lupa-search-box-product-price" };
3655
+ const _sfc_main$$ = /* @__PURE__ */ vue.defineComponent({
3656
3656
  __name: "SearchBoxProductPrice",
3657
3657
  props: {
3658
3658
  item: {},
@@ -3670,14 +3670,14 @@ const _sfc_main$_ = /* @__PURE__ */ vue.defineComponent({
3670
3670
  );
3671
3671
  });
3672
3672
  return (_ctx, _cache) => {
3673
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$V, [
3673
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$W, [
3674
3674
  vue.createElementVNode("strong", null, vue.toDisplayString(price.value), 1)
3675
3675
  ]);
3676
3676
  };
3677
3677
  }
3678
3678
  });
3679
- const _hoisted_1$U = { class: "lupa-search-box-product-regular-price" };
3680
- const _sfc_main$Z = /* @__PURE__ */ vue.defineComponent({
3679
+ const _hoisted_1$V = { class: "lupa-search-box-product-regular-price" };
3680
+ const _sfc_main$_ = /* @__PURE__ */ vue.defineComponent({
3681
3681
  __name: "SearchBoxProductRegularPrice",
3682
3682
  props: {
3683
3683
  item: {},
@@ -3695,16 +3695,16 @@ const _sfc_main$Z = /* @__PURE__ */ vue.defineComponent({
3695
3695
  );
3696
3696
  });
3697
3697
  return (_ctx, _cache) => {
3698
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$U, vue.toDisplayString(price.value), 1);
3698
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$V, vue.toDisplayString(price.value), 1);
3699
3699
  };
3700
3700
  }
3701
3701
  });
3702
- const _hoisted_1$T = ["innerHTML"];
3703
- const _hoisted_2$C = { key: 0 };
3704
- const _hoisted_3$r = { key: 1 };
3705
- const _hoisted_4$j = { class: "lupa-search-box-custom-label" };
3702
+ const _hoisted_1$U = ["innerHTML"];
3703
+ const _hoisted_2$D = { key: 0 };
3704
+ const _hoisted_3$s = { key: 1 };
3705
+ const _hoisted_4$k = { class: "lupa-search-box-custom-label" };
3706
3706
  const _hoisted_5$a = { class: "lupa-search-box-custom-text" };
3707
- const _sfc_main$Y = /* @__PURE__ */ vue.defineComponent({
3707
+ const _sfc_main$Z = /* @__PURE__ */ vue.defineComponent({
3708
3708
  __name: "SearchBoxProductCustom",
3709
3709
  props: {
3710
3710
  item: {},
@@ -3730,20 +3730,20 @@ const _sfc_main$Y = /* @__PURE__ */ vue.defineComponent({
3730
3730
  key: 0,
3731
3731
  class: [className.value, "lupa-search-box-product-custom"],
3732
3732
  innerHTML: text.value
3733
- }, vue.toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), null, 16, _hoisted_1$T)) : (vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({
3733
+ }, vue.toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), null, 16, _hoisted_1$U)) : (vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({
3734
3734
  key: 1,
3735
3735
  class: [className.value, "lupa-search-box-product-custom"]
3736
3736
  }, vue.toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), [
3737
- !label.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$C, vue.toDisplayString(text.value), 1)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$r, [
3738
- vue.createElementVNode("div", _hoisted_4$j, vue.toDisplayString(label.value), 1),
3737
+ !label.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$D, vue.toDisplayString(text.value), 1)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$s, [
3738
+ vue.createElementVNode("div", _hoisted_4$k, vue.toDisplayString(label.value), 1),
3739
3739
  vue.createElementVNode("div", _hoisted_5$a, vue.toDisplayString(text.value), 1)
3740
3740
  ]))
3741
3741
  ], 16));
3742
3742
  };
3743
3743
  }
3744
3744
  });
3745
- const _hoisted_1$S = ["innerHTML"];
3746
- const _sfc_main$X = /* @__PURE__ */ vue.defineComponent({
3745
+ const _hoisted_1$T = ["innerHTML"];
3746
+ const _sfc_main$Y = /* @__PURE__ */ vue.defineComponent({
3747
3747
  __name: "SearchBoxProductCustomHtml",
3748
3748
  props: {
3749
3749
  item: {},
@@ -3763,19 +3763,255 @@ const _sfc_main$X = /* @__PURE__ */ vue.defineComponent({
3763
3763
  return vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({
3764
3764
  class: className.value,
3765
3765
  innerHTML: text.value
3766
- }, vue.toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), null, 16, _hoisted_1$S);
3766
+ }, vue.toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), null, 16, _hoisted_1$T);
3767
+ };
3768
+ }
3769
+ });
3770
+ var ResultsLayoutEnum = /* @__PURE__ */ ((ResultsLayoutEnum2) => {
3771
+ ResultsLayoutEnum2["GRID"] = "Grid";
3772
+ ResultsLayoutEnum2["LIST"] = "List";
3773
+ return ResultsLayoutEnum2;
3774
+ })(ResultsLayoutEnum || {});
3775
+ const RESULT_ROOT_ID = "lupa-search-results";
3776
+ const SHADOW_ROOT_ID = "lupa-shadow-id";
3777
+ const CONTAINER_ROOT_ID = "lupa-search-container";
3778
+ const scrollToSearchResults = (timeout = 500) => {
3779
+ if (timeout) {
3780
+ setTimeout(() => scrollTo(RESULT_ROOT_ID), timeout);
3781
+ } else {
3782
+ scrollTo(RESULT_ROOT_ID);
3783
+ }
3784
+ };
3785
+ const scrollTo = (elementId) => {
3786
+ var _a, _b;
3787
+ let el = document.getElementById(elementId);
3788
+ const shadowRoot = (_a = document.getElementById(SHADOW_ROOT_ID)) == null ? void 0 : _a.shadowRoot;
3789
+ if (!el) {
3790
+ el = (_b = shadowRoot == null ? void 0 : shadowRoot.getElementById(elementId)) != null ? _b : null;
3791
+ }
3792
+ if (!el) {
3793
+ return;
3794
+ }
3795
+ const searchContainer = shadowRoot ? shadowRoot.getElementById(CONTAINER_ROOT_ID) : void 0;
3796
+ const container = searchContainer != null ? searchContainer : window;
3797
+ container.scrollTo({
3798
+ top: el.offsetTop,
3799
+ behavior: "smooth"
3800
+ });
3801
+ };
3802
+ const disableBodyScroll = () => {
3803
+ const scrollY = window.scrollY;
3804
+ document.body.style.position = "fixed";
3805
+ document.body.style.top = `-${scrollY}px`;
3806
+ };
3807
+ const enableBodyScroll = () => {
3808
+ const scrollY = document.body.style.top;
3809
+ document.body.style.position = "";
3810
+ document.body.style.top = "";
3811
+ window.scrollTo(0, parseInt(scrollY || "0") * -1);
3812
+ };
3813
+ const setDocumentTitle = (template, textToInsert = "") => {
3814
+ document.title = addParamsToLabel(template, textToInsert);
3815
+ };
3816
+ const useSearchResultStore = defineStore("searchResult", () => {
3817
+ const searchResult = vue.ref({});
3818
+ const columnCount = vue.ref(2);
3819
+ const addToCartAmount = vue.ref(1);
3820
+ const layout = vue.ref(ResultsLayoutEnum.GRID);
3821
+ const loading = vue.ref(false);
3822
+ const isMobileSidebarVisible = vue.ref(false);
3823
+ const optionsStore = useOptionsStore();
3824
+ const paramsStore = useParamsStore();
3825
+ const facets = vue.computed(() => searchResult.value.facets);
3826
+ const filters = vue.computed(() => searchResult.value.filters);
3827
+ const currentQueryText = vue.computed(() => searchResult.value.searchText);
3828
+ const totalItems = vue.computed(() => searchResult.value.total);
3829
+ const hasResults = vue.computed(() => totalItems.value > 0);
3830
+ const labeledFilters = vue.computed(
3831
+ () => getLabeledFilters(unfoldFilters(filters.value), facets.value)
3832
+ );
3833
+ const displayFilters = vue.computed(() => {
3834
+ var _a, _b;
3835
+ const initialFilters = optionsStore.initialFilters;
3836
+ return (_b = (_a = labeledFilters.value) == null ? void 0 : _a.filter((f2) => !(initialFilters == null ? void 0 : initialFilters[f2.key]))) != null ? _b : [];
3837
+ });
3838
+ const currentFilterCount = vue.computed(() => {
3839
+ var _a, _b;
3840
+ return (_b = (_a = displayFilters.value) == null ? void 0 : _a.length) != null ? _b : 0;
3841
+ });
3842
+ const currentFilterKeys = vue.computed(() => {
3843
+ var _a;
3844
+ return Object.keys((_a = filters.value) != null ? _a : {});
3845
+ });
3846
+ const hasAnyFilter = vue.computed(() => {
3847
+ var _a;
3848
+ return Object.keys((_a = filters.value) != null ? _a : {}).length > 0;
3849
+ });
3850
+ const itemRange = vue.computed(() => {
3851
+ var _a, _b;
3852
+ const limit = (_a = paramsStore.limit) != null ? _a : 0;
3853
+ const offset = (_b = searchResult.value.offset) != null ? _b : 0;
3854
+ return [offset + 1, Math.min(offset + limit, totalItems.value)];
3855
+ });
3856
+ const isPageEmpty = vue.computed(
3857
+ () => {
3858
+ var _a;
3859
+ return hasResults.value && ((_a = searchResult.value.offset) != null ? _a : 0) >= totalItems.value;
3860
+ }
3861
+ );
3862
+ const setSidebarState = ({ visible }) => {
3863
+ if (visible) {
3864
+ disableBodyScroll();
3865
+ } else {
3866
+ enableBodyScroll();
3867
+ }
3868
+ isMobileSidebarVisible.value = visible;
3869
+ };
3870
+ const queryFacet = (_0) => __async(exports, [_0], function* ({ queryKey, facetKey }) {
3871
+ var _a, _b, _c, _d;
3872
+ const query = { searchText: "", filters: __spreadValues({}, filters.value) };
3873
+ const options = (_a = optionsStore.envOptions) != null ? _a : { environment: "production" };
3874
+ const result = yield LupaSearchSdk.query(queryKey, query, options);
3875
+ if (!result.success) {
3876
+ return;
3877
+ }
3878
+ const facet = (_b = result.facets) == null ? void 0 : _b.find((f2) => f2.key === facetKey);
3879
+ const facetItems = (_c = facet == null ? void 0 : facet.items) != null ? _c : [];
3880
+ const updatedResult = __spreadProps(__spreadValues({}, searchResult.value), {
3881
+ facets: (_d = facets.value) == null ? void 0 : _d.map((f2) => f2.key === facetKey ? __spreadProps(__spreadValues({}, f2), { items: facetItems }) : f2)
3882
+ });
3883
+ searchResult.value = updatedResult;
3884
+ });
3885
+ const add = (newSearchResult) => {
3886
+ var _a, _b;
3887
+ if (!newSearchResult) {
3888
+ return {
3889
+ searchResult: searchResult.value,
3890
+ pageSize: searchResult.value.limit || 0
3891
+ };
3892
+ }
3893
+ if (typeof document !== "undefined") {
3894
+ setDocumentTitle(
3895
+ (_b = (_a = optionsStore.searchResultOptions) == null ? void 0 : _a.labels) == null ? void 0 : _b.htmlTitleTemplate,
3896
+ newSearchResult.searchText
3897
+ );
3898
+ }
3899
+ searchResult.value = newSearchResult;
3900
+ return { searchResult: newSearchResult };
3901
+ };
3902
+ const setColumnCount = ({ width, grid }) => {
3903
+ if (!width || !grid) {
3904
+ return;
3905
+ }
3906
+ if (width <= S_MIN_WIDTH) {
3907
+ columnCount.value = grid.columns.xs;
3908
+ } else if (width > S_MIN_WIDTH && width <= MD_MIN_WIDTH) {
3909
+ columnCount.value = grid.columns.sm;
3910
+ } else if (width > MD_MIN_WIDTH && width <= L_MIN_WIDTH) {
3911
+ columnCount.value = grid.columns.md;
3912
+ } else if (width > L_MIN_WIDTH && width <= XL_MIN_WIDTH) {
3913
+ columnCount.value = grid.columns.l;
3914
+ } else {
3915
+ columnCount.value = grid.columns.xl;
3916
+ }
3917
+ };
3918
+ const setAddToCartAmount = (newAddToCartAmount) => {
3919
+ if (!newAddToCartAmount) {
3920
+ return;
3921
+ }
3922
+ addToCartAmount.value = newAddToCartAmount;
3923
+ };
3924
+ const setLayout = (newLayout) => {
3925
+ if (!newLayout) {
3926
+ return;
3927
+ }
3928
+ layout.value = newLayout;
3929
+ };
3930
+ const setLoading = (state) => {
3931
+ loading.value = state || false;
3932
+ };
3933
+ return {
3934
+ isMobileSidebarVisible,
3935
+ searchResult,
3936
+ columnCount,
3937
+ addToCartAmount,
3938
+ facets,
3939
+ filters,
3940
+ loading,
3941
+ layout,
3942
+ currentQueryText,
3943
+ totalItems,
3944
+ hasResults,
3945
+ labeledFilters,
3946
+ displayFilters,
3947
+ currentFilterCount,
3948
+ currentFilterKeys,
3949
+ hasAnyFilter,
3950
+ itemRange,
3951
+ isPageEmpty,
3952
+ setSidebarState,
3953
+ queryFacet,
3954
+ add,
3955
+ setColumnCount,
3956
+ setAddToCartAmount,
3957
+ setLayout,
3958
+ setLoading
3959
+ };
3960
+ });
3961
+ const _hoisted_1$S = { class: "lupa-search-results-add-to-cart-wrapper" };
3962
+ const _hoisted_2$C = { class: "lupa-search-results-product-addtocart" };
3963
+ const _hoisted_3$r = ["onClick", "disabled"];
3964
+ const _sfc_main$X = /* @__PURE__ */ vue.defineComponent({
3965
+ __name: "SearchBoxProductAddToCart",
3966
+ props: {
3967
+ item: {},
3968
+ options: {},
3969
+ inStock: { type: Boolean }
3970
+ },
3971
+ emits: ["productEvent"],
3972
+ setup(__props, { emit }) {
3973
+ const props = __props;
3974
+ const inStockValue = vue.computed(() => {
3975
+ var _a;
3976
+ return (_a = props.inStock) != null ? _a : true;
3977
+ });
3978
+ const searchResultStore = useSearchResultStore();
3979
+ const { addToCartAmount } = storeToRefs(searchResultStore);
3980
+ const loading = vue.ref(false);
3981
+ const label = vue.computed(() => {
3982
+ return props.options.labels.addToCart;
3983
+ });
3984
+ const handleClick = () => __async(this, null, function* () {
3985
+ loading.value = true;
3986
+ yield props.options.action(props.item, addToCartAmount.value);
3987
+ emit("productEvent", { type: "addToCart" });
3988
+ loading.value = false;
3989
+ });
3990
+ return (_ctx, _cache) => {
3991
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$S, [
3992
+ vue.createElementVNode("div", _hoisted_2$C, [
3993
+ vue.createElementVNode("button", {
3994
+ onClick: vue.withModifiers(handleClick, ["stop", "prevent"]),
3995
+ class: vue.normalizeClass(loading.value ? "lupa-add-to-cart-loading" : "lupa-add-to-cart"),
3996
+ "data-cy": "lupa-add-to-cart",
3997
+ type: "button",
3998
+ disabled: !inStockValue.value || loading.value
3999
+ }, vue.toDisplayString(label.value), 11, _hoisted_3$r)
4000
+ ])
4001
+ ]);
3767
4002
  };
3768
4003
  }
3769
4004
  });
3770
4005
  const __default__$4 = {
3771
4006
  components: {
3772
- SearchBoxProductImage: _sfc_main$11,
3773
- SearchBoxProductTitle: _sfc_main$10,
3774
- SearchBoxProductDescription: _sfc_main$$,
3775
- SearchBoxProductPrice: _sfc_main$_,
3776
- SearchBoxProductRegularPrice: _sfc_main$Z,
3777
- SearchBoxProductCustom: _sfc_main$Y,
3778
- SearchBoxProductCustomHtml: _sfc_main$X
4007
+ SearchBoxProductImage: _sfc_main$12,
4008
+ SearchBoxProductTitle: _sfc_main$11,
4009
+ SearchBoxProductDescription: _sfc_main$10,
4010
+ SearchBoxProductPrice: _sfc_main$$,
4011
+ SearchBoxProductRegularPrice: _sfc_main$_,
4012
+ SearchBoxProductCustom: _sfc_main$Z,
4013
+ SearchBoxProductCustomHtml: _sfc_main$Y,
4014
+ SearchBoxProductAddToCart: _sfc_main$X
3779
4015
  }
3780
4016
  };
3781
4017
  const _sfc_main$W = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadValues({}, __default__$4), {
@@ -3783,7 +4019,8 @@ const _sfc_main$W = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadVa
3783
4019
  props: {
3784
4020
  item: {},
3785
4021
  element: {},
3786
- labels: {}
4022
+ labels: {},
4023
+ isInStock: { type: Boolean }
3787
4024
  },
3788
4025
  setup(__props) {
3789
4026
  const props = __props;
@@ -3805,6 +4042,8 @@ const _sfc_main$W = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadVa
3805
4042
  return "search-box-product-custom";
3806
4043
  case DocumentElementType.CUSTOM_HTML:
3807
4044
  return "search-box-product-custom-html";
4045
+ case DocumentElementType.ADDTOCART:
4046
+ return "search-box-product-add-to-cart";
3808
4047
  }
3809
4048
  return "search-box-product-title";
3810
4049
  });
@@ -3828,8 +4067,9 @@ const _sfc_main$W = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadVa
3828
4067
  item: enhancedItem.value,
3829
4068
  options: _ctx.element,
3830
4069
  labels: _ctx.labels,
3831
- class: vue.normalizeClass({ "lupa-loading-dynamic-data": isLoadingDynamicData.value })
3832
- }, null, 8, ["item", "options", "labels", "class"])) : vue.createCommentVNode("", true);
4070
+ class: vue.normalizeClass({ "lupa-loading-dynamic-data": isLoadingDynamicData.value }),
4071
+ inStock: _ctx.isInStock
4072
+ }, null, 8, ["item", "options", "labels", "class", "inStock"])) : vue.createCommentVNode("", true);
3833
4073
  };
3834
4074
  }
3835
4075
  }));
@@ -3891,6 +4131,10 @@ const useTrackingStore = defineStore("tracking", () => {
3891
4131
  const _hoisted_1$R = ["href"];
3892
4132
  const _hoisted_2$B = { class: "lupa-search-box-product-image-section" };
3893
4133
  const _hoisted_3$q = { class: "lupa-search-box-product-details-section" };
4134
+ const _hoisted_4$j = {
4135
+ key: 0,
4136
+ class: "lupa-search-box-product-add-to-cart-section"
4137
+ };
3894
4138
  const _sfc_main$V = /* @__PURE__ */ vue.defineComponent({
3895
4139
  __name: "SearchBoxProduct",
3896
4140
  props: {
@@ -3906,6 +4150,7 @@ const _sfc_main$V = /* @__PURE__ */ vue.defineComponent({
3906
4150
  const historyStore = useHistoryStore();
3907
4151
  const trackingStore = useTrackingStore();
3908
4152
  const optionsStore = useOptionsStore();
4153
+ const isInStock = vue.ref(true);
3909
4154
  const { boxRoutingBehavior } = storeToRefs(optionsStore);
3910
4155
  const link = vue.computed(() => {
3911
4156
  var _a, _b;
@@ -3917,7 +4162,9 @@ const _sfc_main$V = /* @__PURE__ */ vue.defineComponent({
3917
4162
  });
3918
4163
  const detailElements = vue.computed(() => {
3919
4164
  var _a, _b;
3920
- return (_b = (_a = props.panelOptions.elements) == null ? void 0 : _a.filter((e) => e.type !== DocumentElementType.IMAGE)) != null ? _b : [];
4165
+ return (_b = (_a = props.panelOptions.elements) == null ? void 0 : _a.filter(
4166
+ (e) => e.type !== DocumentElementType.IMAGE && e.type !== DocumentElementType.ADDTOCART
4167
+ )) != null ? _b : [];
3921
4168
  });
3922
4169
  const id = vue.computed(() => {
3923
4170
  if (props.panelOptions.idKey) {
@@ -3935,6 +4182,10 @@ const _sfc_main$V = /* @__PURE__ */ vue.defineComponent({
3935
4182
  });
3936
4183
  return title2;
3937
4184
  });
4185
+ const addToCartElement = vue.computed(() => {
4186
+ var _a;
4187
+ return (_a = props.panelOptions.elements) == null ? void 0 : _a.find((e) => e.type === DocumentElementType.ADDTOCART);
4188
+ });
3938
4189
  const handleClick = (event) => {
3939
4190
  var _a;
3940
4191
  if (props.panelOptions.titleKey) {
@@ -3964,6 +4215,12 @@ const _sfc_main$V = /* @__PURE__ */ vue.defineComponent({
3964
4215
  emit("product-click");
3965
4216
  handleRoutingEvent(link.value, event, boxRoutingBehavior.value === "event");
3966
4217
  };
4218
+ vue.onMounted(() => {
4219
+ checkIfIsInStock();
4220
+ });
4221
+ const checkIfIsInStock = () => __async(this, null, function* () {
4222
+ isInStock.value = props.panelOptions.isInStock ? yield props.panelOptions.isInStock(props.item) : true;
4223
+ });
3967
4224
  return (_ctx, _cache) => {
3968
4225
  return vue.openBlock(), vue.createElementBlock("a", {
3969
4226
  class: vue.normalizeClass(["lupa-search-box-product", { "lupa-search-box-product-highlighted": _ctx.highlighted }]),
@@ -3994,7 +4251,17 @@ const _sfc_main$V = /* @__PURE__ */ vue.defineComponent({
3994
4251
  link: link.value
3995
4252
  }, null, 8, ["item", "element", "labels", "link"]);
3996
4253
  }), 128))
3997
- ])
4254
+ ]),
4255
+ addToCartElement.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$j, [
4256
+ vue.createVNode(_sfc_main$W, {
4257
+ class: "lupa-search-box-product-element",
4258
+ item: _ctx.item,
4259
+ element: addToCartElement.value,
4260
+ labels: _ctx.labels,
4261
+ link: link.value,
4262
+ isInStock: isInStock.value
4263
+ }, null, 8, ["item", "element", "labels", "link", "isInStock"])
4264
+ ])) : vue.createCommentVNode("", true)
3998
4265
  ], 10, _hoisted_1$R);
3999
4266
  };
4000
4267
  }
@@ -4128,7 +4395,7 @@ const _hoisted_3$p = {
4128
4395
  };
4129
4396
  const __default__$3 = {
4130
4397
  components: {
4131
- SearchBoxSuggestionsWrapper: _sfc_main$13,
4398
+ SearchBoxSuggestionsWrapper: _sfc_main$14,
4132
4399
  SearchBoxProductsWrapper: _sfc_main$T
4133
4400
  }
4134
4401
  };
@@ -4278,13 +4545,13 @@ const _sfc_main$S = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadVa
4278
4545
  ], 10, _hoisted_2$A);
4279
4546
  }), 128))
4280
4547
  ]),
4281
- vue.createVNode(_sfc_main$18, {
4548
+ vue.createVNode(_sfc_main$19, {
4282
4549
  labels: labels.value,
4283
4550
  showTotalCount: (_a = _ctx.options.showTotalCount) != null ? _a : false,
4284
4551
  onGoToResults: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("go-to-results"))
4285
4552
  }, null, 8, ["labels", "showTotalCount"])
4286
4553
  ], 512)) : displayHistory.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$p, [
4287
- vue.createVNode(_sfc_main$16, {
4554
+ vue.createVNode(_sfc_main$17, {
4288
4555
  ref: "panel",
4289
4556
  options: _ctx.options.history,
4290
4557
  history: history.value,
@@ -4545,7 +4812,7 @@ const _sfc_main$R = /* @__PURE__ */ vue.defineComponent({
4545
4812
  var _a2;
4546
4813
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$O, [
4547
4814
  vue.createElementVNode("div", _hoisted_2$z, [
4548
- vue.createVNode(_sfc_main$19, {
4815
+ vue.createVNode(_sfc_main$1a, {
4549
4816
  options: inputOptions.value,
4550
4817
  suggestedValue: suggestedValue.value,
4551
4818
  "can-close": (_a2 = _ctx.isSearchContainer) != null ? _a2 : false,
@@ -4579,197 +4846,6 @@ const _sfc_main$R = /* @__PURE__ */ vue.defineComponent({
4579
4846
  };
4580
4847
  }
4581
4848
  });
4582
- var ResultsLayoutEnum = /* @__PURE__ */ ((ResultsLayoutEnum2) => {
4583
- ResultsLayoutEnum2["GRID"] = "Grid";
4584
- ResultsLayoutEnum2["LIST"] = "List";
4585
- return ResultsLayoutEnum2;
4586
- })(ResultsLayoutEnum || {});
4587
- const RESULT_ROOT_ID = "lupa-search-results";
4588
- const SHADOW_ROOT_ID = "lupa-shadow-id";
4589
- const CONTAINER_ROOT_ID = "lupa-search-container";
4590
- const scrollToSearchResults = (timeout = 500) => {
4591
- if (timeout) {
4592
- setTimeout(() => scrollTo(RESULT_ROOT_ID), timeout);
4593
- } else {
4594
- scrollTo(RESULT_ROOT_ID);
4595
- }
4596
- };
4597
- const scrollTo = (elementId) => {
4598
- var _a, _b;
4599
- let el = document.getElementById(elementId);
4600
- const shadowRoot = (_a = document.getElementById(SHADOW_ROOT_ID)) == null ? void 0 : _a.shadowRoot;
4601
- if (!el) {
4602
- el = (_b = shadowRoot == null ? void 0 : shadowRoot.getElementById(elementId)) != null ? _b : null;
4603
- }
4604
- if (!el) {
4605
- return;
4606
- }
4607
- const searchContainer = shadowRoot ? shadowRoot.getElementById(CONTAINER_ROOT_ID) : void 0;
4608
- const container = searchContainer != null ? searchContainer : window;
4609
- container.scrollTo({
4610
- top: el.offsetTop,
4611
- behavior: "smooth"
4612
- });
4613
- };
4614
- const disableBodyScroll = () => {
4615
- const scrollY = window.scrollY;
4616
- document.body.style.position = "fixed";
4617
- document.body.style.top = `-${scrollY}px`;
4618
- };
4619
- const enableBodyScroll = () => {
4620
- const scrollY = document.body.style.top;
4621
- document.body.style.position = "";
4622
- document.body.style.top = "";
4623
- window.scrollTo(0, parseInt(scrollY || "0") * -1);
4624
- };
4625
- const setDocumentTitle = (template, textToInsert = "") => {
4626
- document.title = addParamsToLabel(template, textToInsert);
4627
- };
4628
- const useSearchResultStore = defineStore("searchResult", () => {
4629
- const searchResult = vue.ref({});
4630
- const columnCount = vue.ref(2);
4631
- const addToCartAmount = vue.ref(1);
4632
- const layout = vue.ref(ResultsLayoutEnum.GRID);
4633
- const loading = vue.ref(false);
4634
- const isMobileSidebarVisible = vue.ref(false);
4635
- const optionsStore = useOptionsStore();
4636
- const paramsStore = useParamsStore();
4637
- const facets = vue.computed(() => searchResult.value.facets);
4638
- const filters = vue.computed(() => searchResult.value.filters);
4639
- const currentQueryText = vue.computed(() => searchResult.value.searchText);
4640
- const totalItems = vue.computed(() => searchResult.value.total);
4641
- const hasResults = vue.computed(() => totalItems.value > 0);
4642
- const labeledFilters = vue.computed(
4643
- () => getLabeledFilters(unfoldFilters(filters.value), facets.value)
4644
- );
4645
- const displayFilters = vue.computed(() => {
4646
- var _a, _b;
4647
- const initialFilters = optionsStore.initialFilters;
4648
- return (_b = (_a = labeledFilters.value) == null ? void 0 : _a.filter((f2) => !(initialFilters == null ? void 0 : initialFilters[f2.key]))) != null ? _b : [];
4649
- });
4650
- const currentFilterCount = vue.computed(() => {
4651
- var _a, _b;
4652
- return (_b = (_a = displayFilters.value) == null ? void 0 : _a.length) != null ? _b : 0;
4653
- });
4654
- const currentFilterKeys = vue.computed(() => {
4655
- var _a;
4656
- return Object.keys((_a = filters.value) != null ? _a : {});
4657
- });
4658
- const hasAnyFilter = vue.computed(() => {
4659
- var _a;
4660
- return Object.keys((_a = filters.value) != null ? _a : {}).length > 0;
4661
- });
4662
- const itemRange = vue.computed(() => {
4663
- var _a, _b;
4664
- const limit = (_a = paramsStore.limit) != null ? _a : 0;
4665
- const offset = (_b = searchResult.value.offset) != null ? _b : 0;
4666
- return [offset + 1, Math.min(offset + limit, totalItems.value)];
4667
- });
4668
- const isPageEmpty = vue.computed(
4669
- () => {
4670
- var _a;
4671
- return hasResults.value && ((_a = searchResult.value.offset) != null ? _a : 0) >= totalItems.value;
4672
- }
4673
- );
4674
- const setSidebarState = ({ visible }) => {
4675
- if (visible) {
4676
- disableBodyScroll();
4677
- } else {
4678
- enableBodyScroll();
4679
- }
4680
- isMobileSidebarVisible.value = visible;
4681
- };
4682
- const queryFacet = (_0) => __async(exports, [_0], function* ({ queryKey, facetKey }) {
4683
- var _a, _b, _c, _d;
4684
- const query = { searchText: "", filters: __spreadValues({}, filters.value) };
4685
- const options = (_a = optionsStore.envOptions) != null ? _a : { environment: "production" };
4686
- const result = yield LupaSearchSdk.query(queryKey, query, options);
4687
- if (!result.success) {
4688
- return;
4689
- }
4690
- const facet = (_b = result.facets) == null ? void 0 : _b.find((f2) => f2.key === facetKey);
4691
- const facetItems = (_c = facet == null ? void 0 : facet.items) != null ? _c : [];
4692
- const updatedResult = __spreadProps(__spreadValues({}, searchResult.value), {
4693
- facets: (_d = facets.value) == null ? void 0 : _d.map((f2) => f2.key === facetKey ? __spreadProps(__spreadValues({}, f2), { items: facetItems }) : f2)
4694
- });
4695
- searchResult.value = updatedResult;
4696
- });
4697
- const add = (newSearchResult) => {
4698
- var _a, _b;
4699
- if (!newSearchResult) {
4700
- return {
4701
- searchResult: searchResult.value,
4702
- pageSize: searchResult.value.limit || 0
4703
- };
4704
- }
4705
- if (typeof document !== "undefined") {
4706
- setDocumentTitle(
4707
- (_b = (_a = optionsStore.searchResultOptions) == null ? void 0 : _a.labels) == null ? void 0 : _b.htmlTitleTemplate,
4708
- newSearchResult.searchText
4709
- );
4710
- }
4711
- searchResult.value = newSearchResult;
4712
- return { searchResult: newSearchResult };
4713
- };
4714
- const setColumnCount = ({ width, grid }) => {
4715
- if (!width || !grid) {
4716
- return;
4717
- }
4718
- if (width <= S_MIN_WIDTH) {
4719
- columnCount.value = grid.columns.xs;
4720
- } else if (width > S_MIN_WIDTH && width <= MD_MIN_WIDTH) {
4721
- columnCount.value = grid.columns.sm;
4722
- } else if (width > MD_MIN_WIDTH && width <= L_MIN_WIDTH) {
4723
- columnCount.value = grid.columns.md;
4724
- } else if (width > L_MIN_WIDTH && width <= XL_MIN_WIDTH) {
4725
- columnCount.value = grid.columns.l;
4726
- } else {
4727
- columnCount.value = grid.columns.xl;
4728
- }
4729
- };
4730
- const setAddToCartAmount = (newAddToCartAmount) => {
4731
- if (!newAddToCartAmount) {
4732
- return;
4733
- }
4734
- addToCartAmount.value = newAddToCartAmount;
4735
- };
4736
- const setLayout = (newLayout) => {
4737
- if (!newLayout) {
4738
- return;
4739
- }
4740
- layout.value = newLayout;
4741
- };
4742
- const setLoading = (state) => {
4743
- loading.value = state || false;
4744
- };
4745
- return {
4746
- isMobileSidebarVisible,
4747
- searchResult,
4748
- columnCount,
4749
- addToCartAmount,
4750
- facets,
4751
- filters,
4752
- loading,
4753
- layout,
4754
- currentQueryText,
4755
- totalItems,
4756
- hasResults,
4757
- labeledFilters,
4758
- displayFilters,
4759
- currentFilterCount,
4760
- currentFilterKeys,
4761
- hasAnyFilter,
4762
- itemRange,
4763
- isPageEmpty,
4764
- setSidebarState,
4765
- queryFacet,
4766
- add,
4767
- setColumnCount,
4768
- setAddToCartAmount,
4769
- setLayout,
4770
- setLoading
4771
- };
4772
- });
4773
4849
  const createPublicQuery = (queryParams, sortOptions, defaultPageSize) => {
4774
4850
  var _a;
4775
4851
  const publicQuery = {};
@@ -7935,7 +8011,7 @@ const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
7935
8011
  },
7936
8012
  setup(__props) {
7937
8013
  return (_ctx, _cache) => {
7938
- return vue.openBlock(), vue.createBlock(_sfc_main$12, {
8014
+ return vue.openBlock(), vue.createBlock(_sfc_main$13, {
7939
8015
  item: _ctx.item,
7940
8016
  options: _ctx.options,
7941
8017
  "wrapper-class": "lupa-search-results-image-wrapper",
@@ -15898,4 +15974,5 @@ exports.SearchBox = _sfc_main$R;
15898
15974
  exports.SearchContainer = _sfc_main$1;
15899
15975
  exports.SearchResults = _sfc_main$4;
15900
15976
  exports.getInitialSearchResults = getInitialSearchResults;
15977
+ exports.initPinia = initPinia;
15901
15978
  exports.setupTracking = setupTracking;