@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.
- package/dist/lupaSearch.iife.js +366 -348
- package/dist/lupaSearch.js +366 -348
- package/dist/lupaSearch.mjs +366 -348
- package/dist/lupaSearch.umd.js +366 -348
- package/dist/style.css +1 -1
- package/package.json +2 -4
package/dist/lupaSearch.umd.js
CHANGED
|
@@ -5751,55 +5751,6 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
5751
5751
|
}
|
|
5752
5752
|
return container;
|
|
5753
5753
|
}
|
|
5754
|
-
var isVue2$1 = false;
|
|
5755
|
-
/*!
|
|
5756
|
-
* pinia v2.1.4
|
|
5757
|
-
* (c) 2023 Eduardo San Martin Morote
|
|
5758
|
-
* @license MIT
|
|
5759
|
-
*/
|
|
5760
|
-
const piniaSymbol$1 = (
|
|
5761
|
-
/* istanbul ignore next */
|
|
5762
|
-
Symbol()
|
|
5763
|
-
);
|
|
5764
|
-
var MutationType$1;
|
|
5765
|
-
(function(MutationType2) {
|
|
5766
|
-
MutationType2["direct"] = "direct";
|
|
5767
|
-
MutationType2["patchObject"] = "patch object";
|
|
5768
|
-
MutationType2["patchFunction"] = "patch function";
|
|
5769
|
-
})(MutationType$1 || (MutationType$1 = {}));
|
|
5770
|
-
function createPinia$1() {
|
|
5771
|
-
const scope = effectScope(true);
|
|
5772
|
-
const state = scope.run(() => ref({}));
|
|
5773
|
-
let _p = [];
|
|
5774
|
-
let toBeInstalled = [];
|
|
5775
|
-
const pinia = markRaw({
|
|
5776
|
-
install(app2) {
|
|
5777
|
-
{
|
|
5778
|
-
pinia._a = app2;
|
|
5779
|
-
app2.provide(piniaSymbol$1, pinia);
|
|
5780
|
-
app2.config.globalProperties.$pinia = pinia;
|
|
5781
|
-
toBeInstalled.forEach((plugin) => _p.push(plugin));
|
|
5782
|
-
toBeInstalled = [];
|
|
5783
|
-
}
|
|
5784
|
-
},
|
|
5785
|
-
use(plugin) {
|
|
5786
|
-
if (!this._a && !isVue2$1) {
|
|
5787
|
-
toBeInstalled.push(plugin);
|
|
5788
|
-
} else {
|
|
5789
|
-
_p.push(plugin);
|
|
5790
|
-
}
|
|
5791
|
-
return this;
|
|
5792
|
-
},
|
|
5793
|
-
_p,
|
|
5794
|
-
// it's actually undefined here
|
|
5795
|
-
// @ts-expect-error
|
|
5796
|
-
_a: null,
|
|
5797
|
-
_e: scope,
|
|
5798
|
-
_s: /* @__PURE__ */ new Map(),
|
|
5799
|
-
state
|
|
5800
|
-
});
|
|
5801
|
-
return pinia;
|
|
5802
|
-
}
|
|
5803
5754
|
var __defProp2 = Object.defineProperty;
|
|
5804
5755
|
var __defProps2 = Object.defineProperties;
|
|
5805
5756
|
var __getOwnPropDescs2 = Object.getOwnPropertyDescriptors;
|
|
@@ -7684,16 +7635,16 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
7684
7635
|
resetHighlightIndex
|
|
7685
7636
|
};
|
|
7686
7637
|
});
|
|
7687
|
-
const _hoisted_1$
|
|
7688
|
-
const _hoisted_2$
|
|
7689
|
-
const _hoisted_3$
|
|
7690
|
-
const _hoisted_4$
|
|
7638
|
+
const _hoisted_1$12 = { id: "lupa-search-box-input-container" };
|
|
7639
|
+
const _hoisted_2$I = { class: "lupa-input-clear" };
|
|
7640
|
+
const _hoisted_3$u = { id: "lupa-search-box-input" };
|
|
7641
|
+
const _hoisted_4$m = ["value"];
|
|
7691
7642
|
const _hoisted_5$c = ["placeholder"];
|
|
7692
7643
|
const _hoisted_6$6 = {
|
|
7693
7644
|
key: 0,
|
|
7694
7645
|
class: "lupa-close-label"
|
|
7695
7646
|
};
|
|
7696
|
-
const _sfc_main$
|
|
7647
|
+
const _sfc_main$1a = /* @__PURE__ */ defineComponent({
|
|
7697
7648
|
__name: "SearchBoxInput",
|
|
7698
7649
|
props: {
|
|
7699
7650
|
options: {},
|
|
@@ -7770,19 +7721,19 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
7770
7721
|
};
|
|
7771
7722
|
__expose({ focus });
|
|
7772
7723
|
return (_ctx, _cache) => {
|
|
7773
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
7774
|
-
createBaseVNode("div", _hoisted_2$
|
|
7724
|
+
return openBlock(), createElementBlock("div", _hoisted_1$12, [
|
|
7725
|
+
createBaseVNode("div", _hoisted_2$I, [
|
|
7775
7726
|
createBaseVNode("div", {
|
|
7776
7727
|
class: normalizeClass(["lupa-input-clear-content", { "lupa-input-clear-filled": inputValue.value }]),
|
|
7777
7728
|
onClick: clear2
|
|
7778
7729
|
}, null, 2)
|
|
7779
7730
|
]),
|
|
7780
|
-
createBaseVNode("div", _hoisted_3$
|
|
7731
|
+
createBaseVNode("div", _hoisted_3$u, [
|
|
7781
7732
|
createBaseVNode("input", {
|
|
7782
7733
|
class: "lupa-hint",
|
|
7783
7734
|
value: showHint.value ? suggestedValue.value.item.suggestion : "",
|
|
7784
7735
|
disabled: ""
|
|
7785
|
-
}, null, 8, _hoisted_4$
|
|
7736
|
+
}, null, 8, _hoisted_4$m),
|
|
7786
7737
|
withDirectives(createBaseVNode("input", mergeProps({
|
|
7787
7738
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputValue.value = $event)
|
|
7788
7739
|
}, inputAttributes.value, {
|
|
@@ -7810,7 +7761,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
7810
7761
|
};
|
|
7811
7762
|
}
|
|
7812
7763
|
});
|
|
7813
|
-
const _sfc_main$
|
|
7764
|
+
const _sfc_main$19 = /* @__PURE__ */ defineComponent({
|
|
7814
7765
|
__name: "SearchBoxMoreResults",
|
|
7815
7766
|
props: {
|
|
7816
7767
|
labels: {},
|
|
@@ -7842,9 +7793,9 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
7842
7793
|
};
|
|
7843
7794
|
}
|
|
7844
7795
|
});
|
|
7845
|
-
const _hoisted_1$
|
|
7846
|
-
const _hoisted_2$
|
|
7847
|
-
const _sfc_main$
|
|
7796
|
+
const _hoisted_1$11 = { class: "lupa-search-box-history-item" };
|
|
7797
|
+
const _hoisted_2$H = { class: "lupa-search-box-history-item-content" };
|
|
7798
|
+
const _sfc_main$18 = /* @__PURE__ */ defineComponent({
|
|
7848
7799
|
__name: "SearchBoxHistoryItem",
|
|
7849
7800
|
props: {
|
|
7850
7801
|
item: {},
|
|
@@ -7860,8 +7811,8 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
7860
7811
|
emit2("click", { query: props.item });
|
|
7861
7812
|
};
|
|
7862
7813
|
return (_ctx, _cache) => {
|
|
7863
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
7864
|
-
createBaseVNode("div", _hoisted_2$
|
|
7814
|
+
return openBlock(), createElementBlock("div", _hoisted_1$11, [
|
|
7815
|
+
createBaseVNode("div", _hoisted_2$H, [
|
|
7865
7816
|
createBaseVNode("div", {
|
|
7866
7817
|
class: normalizeClass(["lupa-search-box-history-item-text", { "lupa-search-box-history-item-highlighted": _ctx.highlighted }]),
|
|
7867
7818
|
onClick: click2
|
|
@@ -7875,11 +7826,11 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
7875
7826
|
};
|
|
7876
7827
|
}
|
|
7877
7828
|
});
|
|
7878
|
-
const _hoisted_1
|
|
7829
|
+
const _hoisted_1$10 = {
|
|
7879
7830
|
key: 0,
|
|
7880
7831
|
class: "lupa-search-box-history-panel"
|
|
7881
7832
|
};
|
|
7882
|
-
const _sfc_main$
|
|
7833
|
+
const _sfc_main$17 = /* @__PURE__ */ defineComponent({
|
|
7883
7834
|
__name: "SearchBoxHistoryPanel",
|
|
7884
7835
|
props: {
|
|
7885
7836
|
options: {}
|
|
@@ -7920,9 +7871,9 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
7920
7871
|
}
|
|
7921
7872
|
};
|
|
7922
7873
|
return (_ctx, _cache) => {
|
|
7923
|
-
return hasHistory.value ? (openBlock(), createElementBlock("div", _hoisted_1
|
|
7874
|
+
return hasHistory.value ? (openBlock(), createElementBlock("div", _hoisted_1$10, [
|
|
7924
7875
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(history), (item, index) => {
|
|
7925
|
-
return openBlock(), createBlock(_sfc_main$
|
|
7876
|
+
return openBlock(), createBlock(_sfc_main$18, {
|
|
7926
7877
|
key: item,
|
|
7927
7878
|
item,
|
|
7928
7879
|
highlighted: index === highlightIndex.value,
|
|
@@ -7938,18 +7889,18 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
7938
7889
|
};
|
|
7939
7890
|
}
|
|
7940
7891
|
});
|
|
7941
|
-
const _hoisted_1
|
|
7942
|
-
const _hoisted_2$
|
|
7892
|
+
const _hoisted_1$$ = ["innerHTML"];
|
|
7893
|
+
const _hoisted_2$G = {
|
|
7943
7894
|
key: 1,
|
|
7944
7895
|
"data-cy": "lupa-suggestion-value",
|
|
7945
7896
|
class: "lupa-suggestion-value"
|
|
7946
7897
|
};
|
|
7947
|
-
const _hoisted_3$
|
|
7898
|
+
const _hoisted_3$t = {
|
|
7948
7899
|
key: 2,
|
|
7949
7900
|
class: "lupa-suggestion-facet",
|
|
7950
7901
|
"data-cy": "lupa-suggestion-facet"
|
|
7951
7902
|
};
|
|
7952
|
-
const _hoisted_4$
|
|
7903
|
+
const _hoisted_4$l = {
|
|
7953
7904
|
class: "lupa-suggestion-facet-label",
|
|
7954
7905
|
"data-cy": "lupa-suggestion-facet-label"
|
|
7955
7906
|
};
|
|
@@ -7957,7 +7908,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
7957
7908
|
class: "lupa-suggestion-facet-value",
|
|
7958
7909
|
"data-cy": "lupa-suggestion-facet-value"
|
|
7959
7910
|
};
|
|
7960
|
-
const _sfc_main$
|
|
7911
|
+
const _sfc_main$16 = /* @__PURE__ */ defineComponent({
|
|
7961
7912
|
__name: "SearchBoxSuggestion",
|
|
7962
7913
|
props: {
|
|
7963
7914
|
suggestion: {},
|
|
@@ -7993,20 +7944,20 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
7993
7944
|
class: "lupa-suggestion-value",
|
|
7994
7945
|
"data-cy": "lupa-suggestion-value",
|
|
7995
7946
|
innerHTML: _ctx.suggestion.displayHighlight
|
|
7996
|
-
}, null, 8, _hoisted_1
|
|
7997
|
-
_ctx.suggestion.facet ? (openBlock(), createElementBlock("div", _hoisted_3$
|
|
7998
|
-
createBaseVNode("span", _hoisted_4$
|
|
7947
|
+
}, null, 8, _hoisted_1$$)) : (openBlock(), createElementBlock("div", _hoisted_2$G, toDisplayString(_ctx.suggestion.display), 1)),
|
|
7948
|
+
_ctx.suggestion.facet ? (openBlock(), createElementBlock("div", _hoisted_3$t, [
|
|
7949
|
+
createBaseVNode("span", _hoisted_4$l, toDisplayString(facetLabel.value), 1),
|
|
7999
7950
|
createBaseVNode("span", _hoisted_5$b, toDisplayString(_ctx.suggestion.facet.title), 1)
|
|
8000
7951
|
])) : createCommentVNode("", true)
|
|
8001
7952
|
]);
|
|
8002
7953
|
};
|
|
8003
7954
|
}
|
|
8004
7955
|
});
|
|
8005
|
-
const _hoisted_1$
|
|
7956
|
+
const _hoisted_1$_ = {
|
|
8006
7957
|
id: "lupa-search-box-suggestions",
|
|
8007
7958
|
"data-cy": "lupa-search-box-suggestions"
|
|
8008
7959
|
};
|
|
8009
|
-
const _sfc_main$
|
|
7960
|
+
const _sfc_main$15 = /* @__PURE__ */ defineComponent({
|
|
8010
7961
|
__name: "SearchBoxSuggestions",
|
|
8011
7962
|
props: {
|
|
8012
7963
|
items: {},
|
|
@@ -8066,9 +8017,9 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8066
8017
|
});
|
|
8067
8018
|
});
|
|
8068
8019
|
return (_ctx, _cache) => {
|
|
8069
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
8020
|
+
return openBlock(), createElementBlock("div", _hoisted_1$_, [
|
|
8070
8021
|
(openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (item, index) => {
|
|
8071
|
-
return openBlock(), createBlock(_sfc_main$
|
|
8022
|
+
return openBlock(), createBlock(_sfc_main$16, {
|
|
8072
8023
|
key: getSuggestionKey(item),
|
|
8073
8024
|
class: normalizeClass(["lupa-suggestion", index === highlightedIndex.value ? "lupa-suggestion-highlighted" : ""]),
|
|
8074
8025
|
suggestion: item,
|
|
@@ -8096,7 +8047,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8096
8047
|
}, timeout);
|
|
8097
8048
|
};
|
|
8098
8049
|
};
|
|
8099
|
-
const _sfc_main$
|
|
8050
|
+
const _sfc_main$14 = /* @__PURE__ */ defineComponent({
|
|
8100
8051
|
__name: "SearchBoxSuggestionsWrapper",
|
|
8101
8052
|
props: {
|
|
8102
8053
|
panel: {},
|
|
@@ -8137,7 +8088,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8137
8088
|
};
|
|
8138
8089
|
const getSuggestionsDebounced = debounce$1(getSuggestions, props.debounce);
|
|
8139
8090
|
return (_ctx, _cache) => {
|
|
8140
|
-
return openBlock(), createBlock(_sfc_main$
|
|
8091
|
+
return openBlock(), createBlock(_sfc_main$15, {
|
|
8141
8092
|
items: searchResult.value,
|
|
8142
8093
|
highlight: _ctx.panel.highlight,
|
|
8143
8094
|
queryKey: _ctx.panel.queryKey,
|
|
@@ -8215,8 +8166,8 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8215
8166
|
});
|
|
8216
8167
|
return { dynamicDataIdMap, loading, enhanceSearchResultsWithDynamicData };
|
|
8217
8168
|
});
|
|
8218
|
-
const _hoisted_1$
|
|
8219
|
-
const _sfc_main$
|
|
8169
|
+
const _hoisted_1$Z = ["src"];
|
|
8170
|
+
const _sfc_main$13 = /* @__PURE__ */ defineComponent({
|
|
8220
8171
|
__name: "ProductImage",
|
|
8221
8172
|
props: {
|
|
8222
8173
|
item: {},
|
|
@@ -8264,12 +8215,12 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8264
8215
|
class: normalizeClass((_b = _ctx.imageClass) != null ? _b : ""),
|
|
8265
8216
|
src: finalUrl.value,
|
|
8266
8217
|
onError: replaceWithPlaceholder
|
|
8267
|
-
}, null, 42, _hoisted_1$
|
|
8218
|
+
}, null, 42, _hoisted_1$Z)
|
|
8268
8219
|
], 2);
|
|
8269
8220
|
};
|
|
8270
8221
|
}
|
|
8271
8222
|
});
|
|
8272
|
-
const _sfc_main$
|
|
8223
|
+
const _sfc_main$12 = /* @__PURE__ */ defineComponent({
|
|
8273
8224
|
__name: "SearchBoxProductImage",
|
|
8274
8225
|
props: {
|
|
8275
8226
|
item: {},
|
|
@@ -8277,7 +8228,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8277
8228
|
},
|
|
8278
8229
|
setup(__props) {
|
|
8279
8230
|
return (_ctx, _cache) => {
|
|
8280
|
-
return openBlock(), createBlock(_sfc_main$
|
|
8231
|
+
return openBlock(), createBlock(_sfc_main$13, {
|
|
8281
8232
|
item: _ctx.item,
|
|
8282
8233
|
options: _ctx.options,
|
|
8283
8234
|
"wrapper-class": "lupa-search-box-image-wrapper",
|
|
@@ -8286,12 +8237,12 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8286
8237
|
};
|
|
8287
8238
|
}
|
|
8288
8239
|
});
|
|
8289
|
-
const _hoisted_1$
|
|
8290
|
-
const _hoisted_2$
|
|
8240
|
+
const _hoisted_1$Y = ["innerHTML"];
|
|
8241
|
+
const _hoisted_2$F = {
|
|
8291
8242
|
key: 1,
|
|
8292
8243
|
class: "lupa-search-box-product-title"
|
|
8293
8244
|
};
|
|
8294
|
-
const _sfc_main$
|
|
8245
|
+
const _sfc_main$11 = /* @__PURE__ */ defineComponent({
|
|
8295
8246
|
__name: "SearchBoxProductTitle",
|
|
8296
8247
|
props: {
|
|
8297
8248
|
item: {},
|
|
@@ -8311,18 +8262,18 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8311
8262
|
key: 0,
|
|
8312
8263
|
class: "lupa-search-box-product-title",
|
|
8313
8264
|
innerHTML: title.value
|
|
8314
|
-
}, null, 8, _hoisted_1$
|
|
8265
|
+
}, null, 8, _hoisted_1$Y)) : (openBlock(), createElementBlock("div", _hoisted_2$F, [
|
|
8315
8266
|
createBaseVNode("strong", null, toDisplayString(title.value), 1)
|
|
8316
8267
|
]));
|
|
8317
8268
|
};
|
|
8318
8269
|
}
|
|
8319
8270
|
});
|
|
8320
|
-
const _hoisted_1$
|
|
8321
|
-
const _hoisted_2$
|
|
8271
|
+
const _hoisted_1$X = ["innerHTML"];
|
|
8272
|
+
const _hoisted_2$E = {
|
|
8322
8273
|
key: 1,
|
|
8323
8274
|
class: "lupa-search-box-product-description"
|
|
8324
8275
|
};
|
|
8325
|
-
const _sfc_main
|
|
8276
|
+
const _sfc_main$10 = /* @__PURE__ */ defineComponent({
|
|
8326
8277
|
__name: "SearchBoxProductDescription",
|
|
8327
8278
|
props: {
|
|
8328
8279
|
item: {},
|
|
@@ -8342,12 +8293,12 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8342
8293
|
key: 0,
|
|
8343
8294
|
class: "lupa-search-box-product-description",
|
|
8344
8295
|
innerHTML: description.value
|
|
8345
|
-
}, null, 8, _hoisted_1$
|
|
8296
|
+
}, null, 8, _hoisted_1$X)) : (openBlock(), createElementBlock("div", _hoisted_2$E, toDisplayString(description.value), 1));
|
|
8346
8297
|
};
|
|
8347
8298
|
}
|
|
8348
8299
|
});
|
|
8349
|
-
const _hoisted_1$
|
|
8350
|
-
const _sfc_main
|
|
8300
|
+
const _hoisted_1$W = { class: "lupa-search-box-product-price" };
|
|
8301
|
+
const _sfc_main$$ = /* @__PURE__ */ defineComponent({
|
|
8351
8302
|
__name: "SearchBoxProductPrice",
|
|
8352
8303
|
props: {
|
|
8353
8304
|
item: {},
|
|
@@ -8365,14 +8316,14 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8365
8316
|
);
|
|
8366
8317
|
});
|
|
8367
8318
|
return (_ctx, _cache) => {
|
|
8368
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
8319
|
+
return openBlock(), createElementBlock("div", _hoisted_1$W, [
|
|
8369
8320
|
createBaseVNode("strong", null, toDisplayString(price.value), 1)
|
|
8370
8321
|
]);
|
|
8371
8322
|
};
|
|
8372
8323
|
}
|
|
8373
8324
|
});
|
|
8374
|
-
const _hoisted_1$
|
|
8375
|
-
const _sfc_main$
|
|
8325
|
+
const _hoisted_1$V = { class: "lupa-search-box-product-regular-price" };
|
|
8326
|
+
const _sfc_main$_ = /* @__PURE__ */ defineComponent({
|
|
8376
8327
|
__name: "SearchBoxProductRegularPrice",
|
|
8377
8328
|
props: {
|
|
8378
8329
|
item: {},
|
|
@@ -8390,16 +8341,16 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8390
8341
|
);
|
|
8391
8342
|
});
|
|
8392
8343
|
return (_ctx, _cache) => {
|
|
8393
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
8344
|
+
return openBlock(), createElementBlock("div", _hoisted_1$V, toDisplayString(price.value), 1);
|
|
8394
8345
|
};
|
|
8395
8346
|
}
|
|
8396
8347
|
});
|
|
8397
|
-
const _hoisted_1$
|
|
8398
|
-
const _hoisted_2$
|
|
8399
|
-
const _hoisted_3$
|
|
8400
|
-
const _hoisted_4$
|
|
8348
|
+
const _hoisted_1$U = ["innerHTML"];
|
|
8349
|
+
const _hoisted_2$D = { key: 0 };
|
|
8350
|
+
const _hoisted_3$s = { key: 1 };
|
|
8351
|
+
const _hoisted_4$k = { class: "lupa-search-box-custom-label" };
|
|
8401
8352
|
const _hoisted_5$a = { class: "lupa-search-box-custom-text" };
|
|
8402
|
-
const _sfc_main$
|
|
8353
|
+
const _sfc_main$Z = /* @__PURE__ */ defineComponent({
|
|
8403
8354
|
__name: "SearchBoxProductCustom",
|
|
8404
8355
|
props: {
|
|
8405
8356
|
item: {},
|
|
@@ -8425,52 +8376,288 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8425
8376
|
key: 0,
|
|
8426
8377
|
class: [className.value, "lupa-search-box-product-custom"],
|
|
8427
8378
|
innerHTML: text.value
|
|
8428
|
-
}, toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), null, 16, _hoisted_1$
|
|
8379
|
+
}, toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), null, 16, _hoisted_1$U)) : (openBlock(), createElementBlock("div", mergeProps({
|
|
8429
8380
|
key: 1,
|
|
8430
8381
|
class: [className.value, "lupa-search-box-product-custom"]
|
|
8431
8382
|
}, toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), [
|
|
8432
|
-
!label.value ? (openBlock(), createElementBlock("div", _hoisted_2$
|
|
8433
|
-
createBaseVNode("div", _hoisted_4$
|
|
8383
|
+
!label.value ? (openBlock(), createElementBlock("div", _hoisted_2$D, toDisplayString(text.value), 1)) : (openBlock(), createElementBlock("div", _hoisted_3$s, [
|
|
8384
|
+
createBaseVNode("div", _hoisted_4$k, toDisplayString(label.value), 1),
|
|
8434
8385
|
createBaseVNode("div", _hoisted_5$a, toDisplayString(text.value), 1)
|
|
8435
8386
|
]))
|
|
8436
8387
|
], 16));
|
|
8437
8388
|
};
|
|
8438
8389
|
}
|
|
8439
8390
|
});
|
|
8440
|
-
const _hoisted_1$
|
|
8441
|
-
const _sfc_main$
|
|
8391
|
+
const _hoisted_1$T = ["innerHTML"];
|
|
8392
|
+
const _sfc_main$Y = /* @__PURE__ */ defineComponent({
|
|
8442
8393
|
__name: "SearchBoxProductCustomHtml",
|
|
8443
8394
|
props: {
|
|
8444
8395
|
item: {},
|
|
8445
8396
|
options: {}
|
|
8446
8397
|
},
|
|
8447
|
-
setup(__props) {
|
|
8398
|
+
setup(__props) {
|
|
8399
|
+
const props = __props;
|
|
8400
|
+
const text = computed(() => props.options.html(props.item));
|
|
8401
|
+
const className = computed(() => props.options.className);
|
|
8402
|
+
const handleClick = () => __async(this, null, function* () {
|
|
8403
|
+
if (!props.options.action) {
|
|
8404
|
+
return;
|
|
8405
|
+
}
|
|
8406
|
+
yield props.options.action(props.item);
|
|
8407
|
+
});
|
|
8408
|
+
return (_ctx, _cache) => {
|
|
8409
|
+
return openBlock(), createElementBlock("div", mergeProps({
|
|
8410
|
+
class: className.value,
|
|
8411
|
+
innerHTML: text.value
|
|
8412
|
+
}, toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), null, 16, _hoisted_1$T);
|
|
8413
|
+
};
|
|
8414
|
+
}
|
|
8415
|
+
});
|
|
8416
|
+
var ResultsLayoutEnum = /* @__PURE__ */ ((ResultsLayoutEnum2) => {
|
|
8417
|
+
ResultsLayoutEnum2["GRID"] = "Grid";
|
|
8418
|
+
ResultsLayoutEnum2["LIST"] = "List";
|
|
8419
|
+
return ResultsLayoutEnum2;
|
|
8420
|
+
})(ResultsLayoutEnum || {});
|
|
8421
|
+
const RESULT_ROOT_ID = "lupa-search-results";
|
|
8422
|
+
const SHADOW_ROOT_ID = "lupa-shadow-id";
|
|
8423
|
+
const CONTAINER_ROOT_ID = "lupa-search-container";
|
|
8424
|
+
const scrollToSearchResults = (timeout = 500) => {
|
|
8425
|
+
if (timeout) {
|
|
8426
|
+
setTimeout(() => scrollTo(RESULT_ROOT_ID), timeout);
|
|
8427
|
+
} else {
|
|
8428
|
+
scrollTo(RESULT_ROOT_ID);
|
|
8429
|
+
}
|
|
8430
|
+
};
|
|
8431
|
+
const scrollTo = (elementId) => {
|
|
8432
|
+
var _a, _b;
|
|
8433
|
+
let el = document.getElementById(elementId);
|
|
8434
|
+
const shadowRoot = (_a = document.getElementById(SHADOW_ROOT_ID)) == null ? void 0 : _a.shadowRoot;
|
|
8435
|
+
if (!el) {
|
|
8436
|
+
el = (_b = shadowRoot == null ? void 0 : shadowRoot.getElementById(elementId)) != null ? _b : null;
|
|
8437
|
+
}
|
|
8438
|
+
if (!el) {
|
|
8439
|
+
return;
|
|
8440
|
+
}
|
|
8441
|
+
const searchContainer2 = shadowRoot ? shadowRoot.getElementById(CONTAINER_ROOT_ID) : void 0;
|
|
8442
|
+
const container = searchContainer2 != null ? searchContainer2 : window;
|
|
8443
|
+
container.scrollTo({
|
|
8444
|
+
top: el.offsetTop,
|
|
8445
|
+
behavior: "smooth"
|
|
8446
|
+
});
|
|
8447
|
+
};
|
|
8448
|
+
const disableBodyScroll = () => {
|
|
8449
|
+
const scrollY = window.scrollY;
|
|
8450
|
+
document.body.style.position = "fixed";
|
|
8451
|
+
document.body.style.top = `-${scrollY}px`;
|
|
8452
|
+
};
|
|
8453
|
+
const enableBodyScroll = () => {
|
|
8454
|
+
const scrollY = document.body.style.top;
|
|
8455
|
+
document.body.style.position = "";
|
|
8456
|
+
document.body.style.top = "";
|
|
8457
|
+
window.scrollTo(0, parseInt(scrollY || "0") * -1);
|
|
8458
|
+
};
|
|
8459
|
+
const setDocumentTitle = (template, textToInsert = "") => {
|
|
8460
|
+
document.title = addParamsToLabel(template, textToInsert);
|
|
8461
|
+
};
|
|
8462
|
+
const useSearchResultStore = defineStore("searchResult", () => {
|
|
8463
|
+
const searchResult = ref({});
|
|
8464
|
+
const columnCount = ref(2);
|
|
8465
|
+
const addToCartAmount = ref(1);
|
|
8466
|
+
const layout = ref(ResultsLayoutEnum.GRID);
|
|
8467
|
+
const loading = ref(false);
|
|
8468
|
+
const isMobileSidebarVisible = ref(false);
|
|
8469
|
+
const optionsStore = useOptionsStore();
|
|
8470
|
+
const paramsStore = useParamsStore();
|
|
8471
|
+
const facets = computed(() => searchResult.value.facets);
|
|
8472
|
+
const filters = computed(() => searchResult.value.filters);
|
|
8473
|
+
const currentQueryText = computed(() => searchResult.value.searchText);
|
|
8474
|
+
const totalItems = computed(() => searchResult.value.total);
|
|
8475
|
+
const hasResults = computed(() => totalItems.value > 0);
|
|
8476
|
+
const labeledFilters = computed(
|
|
8477
|
+
() => getLabeledFilters(unfoldFilters(filters.value), facets.value)
|
|
8478
|
+
);
|
|
8479
|
+
const displayFilters = computed(() => {
|
|
8480
|
+
var _a, _b;
|
|
8481
|
+
const initialFilters = optionsStore.initialFilters;
|
|
8482
|
+
return (_b = (_a = labeledFilters.value) == null ? void 0 : _a.filter((f2) => !(initialFilters == null ? void 0 : initialFilters[f2.key]))) != null ? _b : [];
|
|
8483
|
+
});
|
|
8484
|
+
const currentFilterCount = computed(() => {
|
|
8485
|
+
var _a, _b;
|
|
8486
|
+
return (_b = (_a = displayFilters.value) == null ? void 0 : _a.length) != null ? _b : 0;
|
|
8487
|
+
});
|
|
8488
|
+
const currentFilterKeys = computed(() => {
|
|
8489
|
+
var _a;
|
|
8490
|
+
return Object.keys((_a = filters.value) != null ? _a : {});
|
|
8491
|
+
});
|
|
8492
|
+
const hasAnyFilter = computed(() => {
|
|
8493
|
+
var _a;
|
|
8494
|
+
return Object.keys((_a = filters.value) != null ? _a : {}).length > 0;
|
|
8495
|
+
});
|
|
8496
|
+
const itemRange = computed(() => {
|
|
8497
|
+
var _a, _b;
|
|
8498
|
+
const limit = (_a = paramsStore.limit) != null ? _a : 0;
|
|
8499
|
+
const offset = (_b = searchResult.value.offset) != null ? _b : 0;
|
|
8500
|
+
return [offset + 1, Math.min(offset + limit, totalItems.value)];
|
|
8501
|
+
});
|
|
8502
|
+
const isPageEmpty = computed(
|
|
8503
|
+
() => {
|
|
8504
|
+
var _a;
|
|
8505
|
+
return hasResults.value && ((_a = searchResult.value.offset) != null ? _a : 0) >= totalItems.value;
|
|
8506
|
+
}
|
|
8507
|
+
);
|
|
8508
|
+
const setSidebarState = ({ visible }) => {
|
|
8509
|
+
if (visible) {
|
|
8510
|
+
disableBodyScroll();
|
|
8511
|
+
} else {
|
|
8512
|
+
enableBodyScroll();
|
|
8513
|
+
}
|
|
8514
|
+
isMobileSidebarVisible.value = visible;
|
|
8515
|
+
};
|
|
8516
|
+
const queryFacet = (_0) => __async(void 0, [_0], function* ({ queryKey, facetKey }) {
|
|
8517
|
+
var _a, _b, _c, _d;
|
|
8518
|
+
const query = { searchText: "", filters: __spreadValues2({}, filters.value) };
|
|
8519
|
+
const options = (_a = optionsStore.envOptions) != null ? _a : { environment: "production" };
|
|
8520
|
+
const result = yield LupaSearchSdk.query(queryKey, query, options);
|
|
8521
|
+
if (!result.success) {
|
|
8522
|
+
return;
|
|
8523
|
+
}
|
|
8524
|
+
const facet = (_b = result.facets) == null ? void 0 : _b.find((f2) => f2.key === facetKey);
|
|
8525
|
+
const facetItems = (_c = facet == null ? void 0 : facet.items) != null ? _c : [];
|
|
8526
|
+
const updatedResult = __spreadProps2(__spreadValues2({}, searchResult.value), {
|
|
8527
|
+
facets: (_d = facets.value) == null ? void 0 : _d.map((f2) => f2.key === facetKey ? __spreadProps2(__spreadValues2({}, f2), { items: facetItems }) : f2)
|
|
8528
|
+
});
|
|
8529
|
+
searchResult.value = updatedResult;
|
|
8530
|
+
});
|
|
8531
|
+
const add2 = (newSearchResult) => {
|
|
8532
|
+
var _a, _b;
|
|
8533
|
+
if (!newSearchResult) {
|
|
8534
|
+
return {
|
|
8535
|
+
searchResult: searchResult.value,
|
|
8536
|
+
pageSize: searchResult.value.limit || 0
|
|
8537
|
+
};
|
|
8538
|
+
}
|
|
8539
|
+
if (typeof document !== "undefined") {
|
|
8540
|
+
setDocumentTitle(
|
|
8541
|
+
(_b = (_a = optionsStore.searchResultOptions) == null ? void 0 : _a.labels) == null ? void 0 : _b.htmlTitleTemplate,
|
|
8542
|
+
newSearchResult.searchText
|
|
8543
|
+
);
|
|
8544
|
+
}
|
|
8545
|
+
searchResult.value = newSearchResult;
|
|
8546
|
+
return { searchResult: newSearchResult };
|
|
8547
|
+
};
|
|
8548
|
+
const setColumnCount = ({ width, grid }) => {
|
|
8549
|
+
if (!width || !grid) {
|
|
8550
|
+
return;
|
|
8551
|
+
}
|
|
8552
|
+
if (width <= S_MIN_WIDTH) {
|
|
8553
|
+
columnCount.value = grid.columns.xs;
|
|
8554
|
+
} else if (width > S_MIN_WIDTH && width <= MD_MIN_WIDTH) {
|
|
8555
|
+
columnCount.value = grid.columns.sm;
|
|
8556
|
+
} else if (width > MD_MIN_WIDTH && width <= L_MIN_WIDTH) {
|
|
8557
|
+
columnCount.value = grid.columns.md;
|
|
8558
|
+
} else if (width > L_MIN_WIDTH && width <= XL_MIN_WIDTH) {
|
|
8559
|
+
columnCount.value = grid.columns.l;
|
|
8560
|
+
} else {
|
|
8561
|
+
columnCount.value = grid.columns.xl;
|
|
8562
|
+
}
|
|
8563
|
+
};
|
|
8564
|
+
const setAddToCartAmount = (newAddToCartAmount) => {
|
|
8565
|
+
if (!newAddToCartAmount) {
|
|
8566
|
+
return;
|
|
8567
|
+
}
|
|
8568
|
+
addToCartAmount.value = newAddToCartAmount;
|
|
8569
|
+
};
|
|
8570
|
+
const setLayout = (newLayout) => {
|
|
8571
|
+
if (!newLayout) {
|
|
8572
|
+
return;
|
|
8573
|
+
}
|
|
8574
|
+
layout.value = newLayout;
|
|
8575
|
+
};
|
|
8576
|
+
const setLoading = (state) => {
|
|
8577
|
+
loading.value = state || false;
|
|
8578
|
+
};
|
|
8579
|
+
return {
|
|
8580
|
+
isMobileSidebarVisible,
|
|
8581
|
+
searchResult,
|
|
8582
|
+
columnCount,
|
|
8583
|
+
addToCartAmount,
|
|
8584
|
+
facets,
|
|
8585
|
+
filters,
|
|
8586
|
+
loading,
|
|
8587
|
+
layout,
|
|
8588
|
+
currentQueryText,
|
|
8589
|
+
totalItems,
|
|
8590
|
+
hasResults,
|
|
8591
|
+
labeledFilters,
|
|
8592
|
+
displayFilters,
|
|
8593
|
+
currentFilterCount,
|
|
8594
|
+
currentFilterKeys,
|
|
8595
|
+
hasAnyFilter,
|
|
8596
|
+
itemRange,
|
|
8597
|
+
isPageEmpty,
|
|
8598
|
+
setSidebarState,
|
|
8599
|
+
queryFacet,
|
|
8600
|
+
add: add2,
|
|
8601
|
+
setColumnCount,
|
|
8602
|
+
setAddToCartAmount,
|
|
8603
|
+
setLayout,
|
|
8604
|
+
setLoading
|
|
8605
|
+
};
|
|
8606
|
+
});
|
|
8607
|
+
const _hoisted_1$S = { class: "lupa-search-results-add-to-cart-wrapper" };
|
|
8608
|
+
const _hoisted_2$C = { class: "lupa-search-results-product-addtocart" };
|
|
8609
|
+
const _hoisted_3$r = ["onClick", "disabled"];
|
|
8610
|
+
const _sfc_main$X = /* @__PURE__ */ defineComponent({
|
|
8611
|
+
__name: "SearchBoxProductAddToCart",
|
|
8612
|
+
props: {
|
|
8613
|
+
item: {},
|
|
8614
|
+
options: {},
|
|
8615
|
+
inStock: { type: Boolean }
|
|
8616
|
+
},
|
|
8617
|
+
emits: ["productEvent"],
|
|
8618
|
+
setup(__props, { emit: emit2 }) {
|
|
8448
8619
|
const props = __props;
|
|
8449
|
-
const
|
|
8450
|
-
|
|
8620
|
+
const inStockValue = computed(() => {
|
|
8621
|
+
var _a;
|
|
8622
|
+
return (_a = props.inStock) != null ? _a : true;
|
|
8623
|
+
});
|
|
8624
|
+
const searchResultStore = useSearchResultStore();
|
|
8625
|
+
const { addToCartAmount } = storeToRefs(searchResultStore);
|
|
8626
|
+
const loading = ref(false);
|
|
8627
|
+
const label = computed(() => {
|
|
8628
|
+
return props.options.labels.addToCart;
|
|
8629
|
+
});
|
|
8451
8630
|
const handleClick = () => __async(this, null, function* () {
|
|
8452
|
-
|
|
8453
|
-
|
|
8454
|
-
}
|
|
8455
|
-
|
|
8631
|
+
loading.value = true;
|
|
8632
|
+
yield props.options.action(props.item, addToCartAmount.value);
|
|
8633
|
+
emit2("productEvent", { type: "addToCart" });
|
|
8634
|
+
loading.value = false;
|
|
8456
8635
|
});
|
|
8457
8636
|
return (_ctx, _cache) => {
|
|
8458
|
-
return openBlock(), createElementBlock("div",
|
|
8459
|
-
|
|
8460
|
-
|
|
8461
|
-
|
|
8637
|
+
return openBlock(), createElementBlock("div", _hoisted_1$S, [
|
|
8638
|
+
createBaseVNode("div", _hoisted_2$C, [
|
|
8639
|
+
createBaseVNode("button", {
|
|
8640
|
+
onClick: withModifiers(handleClick, ["stop", "prevent"]),
|
|
8641
|
+
class: normalizeClass(loading.value ? "lupa-add-to-cart-loading" : "lupa-add-to-cart"),
|
|
8642
|
+
"data-cy": "lupa-add-to-cart",
|
|
8643
|
+
type: "button",
|
|
8644
|
+
disabled: !inStockValue.value || loading.value
|
|
8645
|
+
}, toDisplayString(label.value), 11, _hoisted_3$r)
|
|
8646
|
+
])
|
|
8647
|
+
]);
|
|
8462
8648
|
};
|
|
8463
8649
|
}
|
|
8464
8650
|
});
|
|
8465
8651
|
const __default__$4 = {
|
|
8466
8652
|
components: {
|
|
8467
|
-
SearchBoxProductImage: _sfc_main$
|
|
8468
|
-
SearchBoxProductTitle: _sfc_main$
|
|
8469
|
-
SearchBoxProductDescription: _sfc_main
|
|
8470
|
-
SearchBoxProductPrice: _sfc_main
|
|
8471
|
-
SearchBoxProductRegularPrice: _sfc_main$
|
|
8472
|
-
SearchBoxProductCustom: _sfc_main$
|
|
8473
|
-
SearchBoxProductCustomHtml: _sfc_main$
|
|
8653
|
+
SearchBoxProductImage: _sfc_main$12,
|
|
8654
|
+
SearchBoxProductTitle: _sfc_main$11,
|
|
8655
|
+
SearchBoxProductDescription: _sfc_main$10,
|
|
8656
|
+
SearchBoxProductPrice: _sfc_main$$,
|
|
8657
|
+
SearchBoxProductRegularPrice: _sfc_main$_,
|
|
8658
|
+
SearchBoxProductCustom: _sfc_main$Z,
|
|
8659
|
+
SearchBoxProductCustomHtml: _sfc_main$Y,
|
|
8660
|
+
SearchBoxProductAddToCart: _sfc_main$X
|
|
8474
8661
|
}
|
|
8475
8662
|
};
|
|
8476
8663
|
const _sfc_main$W = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValues2({}, __default__$4), {
|
|
@@ -8478,7 +8665,8 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8478
8665
|
props: {
|
|
8479
8666
|
item: {},
|
|
8480
8667
|
element: {},
|
|
8481
|
-
labels: {}
|
|
8668
|
+
labels: {},
|
|
8669
|
+
isInStock: { type: Boolean }
|
|
8482
8670
|
},
|
|
8483
8671
|
setup(__props) {
|
|
8484
8672
|
const props = __props;
|
|
@@ -8500,6 +8688,8 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8500
8688
|
return "search-box-product-custom";
|
|
8501
8689
|
case DocumentElementType.CUSTOM_HTML:
|
|
8502
8690
|
return "search-box-product-custom-html";
|
|
8691
|
+
case DocumentElementType.ADDTOCART:
|
|
8692
|
+
return "search-box-product-add-to-cart";
|
|
8503
8693
|
}
|
|
8504
8694
|
return "search-box-product-title";
|
|
8505
8695
|
});
|
|
@@ -8523,8 +8713,9 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8523
8713
|
item: enhancedItem.value,
|
|
8524
8714
|
options: _ctx.element,
|
|
8525
8715
|
labels: _ctx.labels,
|
|
8526
|
-
class: normalizeClass({ "lupa-loading-dynamic-data": isLoadingDynamicData.value })
|
|
8527
|
-
|
|
8716
|
+
class: normalizeClass({ "lupa-loading-dynamic-data": isLoadingDynamicData.value }),
|
|
8717
|
+
inStock: _ctx.isInStock
|
|
8718
|
+
}, null, 8, ["item", "options", "labels", "class", "inStock"])) : createCommentVNode("", true);
|
|
8528
8719
|
};
|
|
8529
8720
|
}
|
|
8530
8721
|
}));
|
|
@@ -8586,6 +8777,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8586
8777
|
const _hoisted_1$R = ["href"];
|
|
8587
8778
|
const _hoisted_2$B = { class: "lupa-search-box-product-image-section" };
|
|
8588
8779
|
const _hoisted_3$q = { class: "lupa-search-box-product-details-section" };
|
|
8780
|
+
const _hoisted_4$j = {
|
|
8781
|
+
key: 0,
|
|
8782
|
+
class: "lupa-search-box-product-add-to-cart-section"
|
|
8783
|
+
};
|
|
8589
8784
|
const _sfc_main$V = /* @__PURE__ */ defineComponent({
|
|
8590
8785
|
__name: "SearchBoxProduct",
|
|
8591
8786
|
props: {
|
|
@@ -8601,6 +8796,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8601
8796
|
const historyStore = useHistoryStore();
|
|
8602
8797
|
const trackingStore = useTrackingStore();
|
|
8603
8798
|
const optionsStore = useOptionsStore();
|
|
8799
|
+
const isInStock = ref(true);
|
|
8604
8800
|
const { boxRoutingBehavior } = storeToRefs(optionsStore);
|
|
8605
8801
|
const link = computed(() => {
|
|
8606
8802
|
var _a, _b;
|
|
@@ -8612,7 +8808,9 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8612
8808
|
});
|
|
8613
8809
|
const detailElements = computed(() => {
|
|
8614
8810
|
var _a, _b;
|
|
8615
|
-
return (_b = (_a = props.panelOptions.elements) == null ? void 0 : _a.filter(
|
|
8811
|
+
return (_b = (_a = props.panelOptions.elements) == null ? void 0 : _a.filter(
|
|
8812
|
+
(e) => e.type !== DocumentElementType.IMAGE && e.type !== DocumentElementType.ADDTOCART
|
|
8813
|
+
)) != null ? _b : [];
|
|
8616
8814
|
});
|
|
8617
8815
|
const id = computed(() => {
|
|
8618
8816
|
if (props.panelOptions.idKey) {
|
|
@@ -8630,6 +8828,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8630
8828
|
});
|
|
8631
8829
|
return title2;
|
|
8632
8830
|
});
|
|
8831
|
+
const addToCartElement = computed(() => {
|
|
8832
|
+
var _a;
|
|
8833
|
+
return (_a = props.panelOptions.elements) == null ? void 0 : _a.find((e) => e.type === DocumentElementType.ADDTOCART);
|
|
8834
|
+
});
|
|
8633
8835
|
const handleClick = (event) => {
|
|
8634
8836
|
var _a;
|
|
8635
8837
|
if (props.panelOptions.titleKey) {
|
|
@@ -8659,6 +8861,12 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8659
8861
|
emit2("product-click");
|
|
8660
8862
|
handleRoutingEvent(link.value, event, boxRoutingBehavior.value === "event");
|
|
8661
8863
|
};
|
|
8864
|
+
onMounted(() => {
|
|
8865
|
+
checkIfIsInStock();
|
|
8866
|
+
});
|
|
8867
|
+
const checkIfIsInStock = () => __async(this, null, function* () {
|
|
8868
|
+
isInStock.value = props.panelOptions.isInStock ? yield props.panelOptions.isInStock(props.item) : true;
|
|
8869
|
+
});
|
|
8662
8870
|
return (_ctx, _cache) => {
|
|
8663
8871
|
return openBlock(), createElementBlock("a", {
|
|
8664
8872
|
class: normalizeClass(["lupa-search-box-product", { "lupa-search-box-product-highlighted": _ctx.highlighted }]),
|
|
@@ -8689,7 +8897,17 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8689
8897
|
link: link.value
|
|
8690
8898
|
}, null, 8, ["item", "element", "labels", "link"]);
|
|
8691
8899
|
}), 128))
|
|
8692
|
-
])
|
|
8900
|
+
]),
|
|
8901
|
+
addToCartElement.value ? (openBlock(), createElementBlock("div", _hoisted_4$j, [
|
|
8902
|
+
createVNode(_sfc_main$W, {
|
|
8903
|
+
class: "lupa-search-box-product-element",
|
|
8904
|
+
item: _ctx.item,
|
|
8905
|
+
element: addToCartElement.value,
|
|
8906
|
+
labels: _ctx.labels,
|
|
8907
|
+
link: link.value,
|
|
8908
|
+
isInStock: isInStock.value
|
|
8909
|
+
}, null, 8, ["item", "element", "labels", "link", "isInStock"])
|
|
8910
|
+
])) : createCommentVNode("", true)
|
|
8693
8911
|
], 10, _hoisted_1$R);
|
|
8694
8912
|
};
|
|
8695
8913
|
}
|
|
@@ -8823,7 +9041,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8823
9041
|
};
|
|
8824
9042
|
const __default__$3 = {
|
|
8825
9043
|
components: {
|
|
8826
|
-
SearchBoxSuggestionsWrapper: _sfc_main$
|
|
9044
|
+
SearchBoxSuggestionsWrapper: _sfc_main$14,
|
|
8827
9045
|
SearchBoxProductsWrapper: _sfc_main$T
|
|
8828
9046
|
}
|
|
8829
9047
|
};
|
|
@@ -8973,13 +9191,13 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8973
9191
|
], 10, _hoisted_2$A);
|
|
8974
9192
|
}), 128))
|
|
8975
9193
|
]),
|
|
8976
|
-
createVNode(_sfc_main$
|
|
9194
|
+
createVNode(_sfc_main$19, {
|
|
8977
9195
|
labels: labels.value,
|
|
8978
9196
|
showTotalCount: (_a = _ctx.options.showTotalCount) != null ? _a : false,
|
|
8979
9197
|
onGoToResults: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("go-to-results"))
|
|
8980
9198
|
}, null, 8, ["labels", "showTotalCount"])
|
|
8981
9199
|
], 512)) : displayHistory.value ? (openBlock(), createElementBlock("div", _hoisted_3$p, [
|
|
8982
|
-
createVNode(_sfc_main$
|
|
9200
|
+
createVNode(_sfc_main$17, {
|
|
8983
9201
|
ref: "panel",
|
|
8984
9202
|
options: _ctx.options.history,
|
|
8985
9203
|
history: history.value,
|
|
@@ -9240,7 +9458,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
9240
9458
|
var _a2;
|
|
9241
9459
|
return openBlock(), createElementBlock("div", _hoisted_1$O, [
|
|
9242
9460
|
createBaseVNode("div", _hoisted_2$z, [
|
|
9243
|
-
createVNode(_sfc_main$
|
|
9461
|
+
createVNode(_sfc_main$1a, {
|
|
9244
9462
|
options: inputOptions.value,
|
|
9245
9463
|
suggestedValue: suggestedValue.value,
|
|
9246
9464
|
"can-close": (_a2 = _ctx.isSearchContainer) != null ? _a2 : false,
|
|
@@ -9274,197 +9492,6 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
9274
9492
|
};
|
|
9275
9493
|
}
|
|
9276
9494
|
});
|
|
9277
|
-
var ResultsLayoutEnum = /* @__PURE__ */ ((ResultsLayoutEnum2) => {
|
|
9278
|
-
ResultsLayoutEnum2["GRID"] = "Grid";
|
|
9279
|
-
ResultsLayoutEnum2["LIST"] = "List";
|
|
9280
|
-
return ResultsLayoutEnum2;
|
|
9281
|
-
})(ResultsLayoutEnum || {});
|
|
9282
|
-
const RESULT_ROOT_ID = "lupa-search-results";
|
|
9283
|
-
const SHADOW_ROOT_ID = "lupa-shadow-id";
|
|
9284
|
-
const CONTAINER_ROOT_ID = "lupa-search-container";
|
|
9285
|
-
const scrollToSearchResults = (timeout = 500) => {
|
|
9286
|
-
if (timeout) {
|
|
9287
|
-
setTimeout(() => scrollTo(RESULT_ROOT_ID), timeout);
|
|
9288
|
-
} else {
|
|
9289
|
-
scrollTo(RESULT_ROOT_ID);
|
|
9290
|
-
}
|
|
9291
|
-
};
|
|
9292
|
-
const scrollTo = (elementId) => {
|
|
9293
|
-
var _a, _b;
|
|
9294
|
-
let el = document.getElementById(elementId);
|
|
9295
|
-
const shadowRoot = (_a = document.getElementById(SHADOW_ROOT_ID)) == null ? void 0 : _a.shadowRoot;
|
|
9296
|
-
if (!el) {
|
|
9297
|
-
el = (_b = shadowRoot == null ? void 0 : shadowRoot.getElementById(elementId)) != null ? _b : null;
|
|
9298
|
-
}
|
|
9299
|
-
if (!el) {
|
|
9300
|
-
return;
|
|
9301
|
-
}
|
|
9302
|
-
const searchContainer2 = shadowRoot ? shadowRoot.getElementById(CONTAINER_ROOT_ID) : void 0;
|
|
9303
|
-
const container = searchContainer2 != null ? searchContainer2 : window;
|
|
9304
|
-
container.scrollTo({
|
|
9305
|
-
top: el.offsetTop,
|
|
9306
|
-
behavior: "smooth"
|
|
9307
|
-
});
|
|
9308
|
-
};
|
|
9309
|
-
const disableBodyScroll = () => {
|
|
9310
|
-
const scrollY = window.scrollY;
|
|
9311
|
-
document.body.style.position = "fixed";
|
|
9312
|
-
document.body.style.top = `-${scrollY}px`;
|
|
9313
|
-
};
|
|
9314
|
-
const enableBodyScroll = () => {
|
|
9315
|
-
const scrollY = document.body.style.top;
|
|
9316
|
-
document.body.style.position = "";
|
|
9317
|
-
document.body.style.top = "";
|
|
9318
|
-
window.scrollTo(0, parseInt(scrollY || "0") * -1);
|
|
9319
|
-
};
|
|
9320
|
-
const setDocumentTitle = (template, textToInsert = "") => {
|
|
9321
|
-
document.title = addParamsToLabel(template, textToInsert);
|
|
9322
|
-
};
|
|
9323
|
-
const useSearchResultStore = defineStore("searchResult", () => {
|
|
9324
|
-
const searchResult = ref({});
|
|
9325
|
-
const columnCount = ref(2);
|
|
9326
|
-
const addToCartAmount = ref(1);
|
|
9327
|
-
const layout = ref(ResultsLayoutEnum.GRID);
|
|
9328
|
-
const loading = ref(false);
|
|
9329
|
-
const isMobileSidebarVisible = ref(false);
|
|
9330
|
-
const optionsStore = useOptionsStore();
|
|
9331
|
-
const paramsStore = useParamsStore();
|
|
9332
|
-
const facets = computed(() => searchResult.value.facets);
|
|
9333
|
-
const filters = computed(() => searchResult.value.filters);
|
|
9334
|
-
const currentQueryText = computed(() => searchResult.value.searchText);
|
|
9335
|
-
const totalItems = computed(() => searchResult.value.total);
|
|
9336
|
-
const hasResults = computed(() => totalItems.value > 0);
|
|
9337
|
-
const labeledFilters = computed(
|
|
9338
|
-
() => getLabeledFilters(unfoldFilters(filters.value), facets.value)
|
|
9339
|
-
);
|
|
9340
|
-
const displayFilters = computed(() => {
|
|
9341
|
-
var _a, _b;
|
|
9342
|
-
const initialFilters = optionsStore.initialFilters;
|
|
9343
|
-
return (_b = (_a = labeledFilters.value) == null ? void 0 : _a.filter((f2) => !(initialFilters == null ? void 0 : initialFilters[f2.key]))) != null ? _b : [];
|
|
9344
|
-
});
|
|
9345
|
-
const currentFilterCount = computed(() => {
|
|
9346
|
-
var _a, _b;
|
|
9347
|
-
return (_b = (_a = displayFilters.value) == null ? void 0 : _a.length) != null ? _b : 0;
|
|
9348
|
-
});
|
|
9349
|
-
const currentFilterKeys = computed(() => {
|
|
9350
|
-
var _a;
|
|
9351
|
-
return Object.keys((_a = filters.value) != null ? _a : {});
|
|
9352
|
-
});
|
|
9353
|
-
const hasAnyFilter = computed(() => {
|
|
9354
|
-
var _a;
|
|
9355
|
-
return Object.keys((_a = filters.value) != null ? _a : {}).length > 0;
|
|
9356
|
-
});
|
|
9357
|
-
const itemRange = computed(() => {
|
|
9358
|
-
var _a, _b;
|
|
9359
|
-
const limit = (_a = paramsStore.limit) != null ? _a : 0;
|
|
9360
|
-
const offset = (_b = searchResult.value.offset) != null ? _b : 0;
|
|
9361
|
-
return [offset + 1, Math.min(offset + limit, totalItems.value)];
|
|
9362
|
-
});
|
|
9363
|
-
const isPageEmpty = computed(
|
|
9364
|
-
() => {
|
|
9365
|
-
var _a;
|
|
9366
|
-
return hasResults.value && ((_a = searchResult.value.offset) != null ? _a : 0) >= totalItems.value;
|
|
9367
|
-
}
|
|
9368
|
-
);
|
|
9369
|
-
const setSidebarState = ({ visible }) => {
|
|
9370
|
-
if (visible) {
|
|
9371
|
-
disableBodyScroll();
|
|
9372
|
-
} else {
|
|
9373
|
-
enableBodyScroll();
|
|
9374
|
-
}
|
|
9375
|
-
isMobileSidebarVisible.value = visible;
|
|
9376
|
-
};
|
|
9377
|
-
const queryFacet = (_0) => __async(void 0, [_0], function* ({ queryKey, facetKey }) {
|
|
9378
|
-
var _a, _b, _c, _d;
|
|
9379
|
-
const query = { searchText: "", filters: __spreadValues2({}, filters.value) };
|
|
9380
|
-
const options = (_a = optionsStore.envOptions) != null ? _a : { environment: "production" };
|
|
9381
|
-
const result = yield LupaSearchSdk.query(queryKey, query, options);
|
|
9382
|
-
if (!result.success) {
|
|
9383
|
-
return;
|
|
9384
|
-
}
|
|
9385
|
-
const facet = (_b = result.facets) == null ? void 0 : _b.find((f2) => f2.key === facetKey);
|
|
9386
|
-
const facetItems = (_c = facet == null ? void 0 : facet.items) != null ? _c : [];
|
|
9387
|
-
const updatedResult = __spreadProps2(__spreadValues2({}, searchResult.value), {
|
|
9388
|
-
facets: (_d = facets.value) == null ? void 0 : _d.map((f2) => f2.key === facetKey ? __spreadProps2(__spreadValues2({}, f2), { items: facetItems }) : f2)
|
|
9389
|
-
});
|
|
9390
|
-
searchResult.value = updatedResult;
|
|
9391
|
-
});
|
|
9392
|
-
const add2 = (newSearchResult) => {
|
|
9393
|
-
var _a, _b;
|
|
9394
|
-
if (!newSearchResult) {
|
|
9395
|
-
return {
|
|
9396
|
-
searchResult: searchResult.value,
|
|
9397
|
-
pageSize: searchResult.value.limit || 0
|
|
9398
|
-
};
|
|
9399
|
-
}
|
|
9400
|
-
if (typeof document !== "undefined") {
|
|
9401
|
-
setDocumentTitle(
|
|
9402
|
-
(_b = (_a = optionsStore.searchResultOptions) == null ? void 0 : _a.labels) == null ? void 0 : _b.htmlTitleTemplate,
|
|
9403
|
-
newSearchResult.searchText
|
|
9404
|
-
);
|
|
9405
|
-
}
|
|
9406
|
-
searchResult.value = newSearchResult;
|
|
9407
|
-
return { searchResult: newSearchResult };
|
|
9408
|
-
};
|
|
9409
|
-
const setColumnCount = ({ width, grid }) => {
|
|
9410
|
-
if (!width || !grid) {
|
|
9411
|
-
return;
|
|
9412
|
-
}
|
|
9413
|
-
if (width <= S_MIN_WIDTH) {
|
|
9414
|
-
columnCount.value = grid.columns.xs;
|
|
9415
|
-
} else if (width > S_MIN_WIDTH && width <= MD_MIN_WIDTH) {
|
|
9416
|
-
columnCount.value = grid.columns.sm;
|
|
9417
|
-
} else if (width > MD_MIN_WIDTH && width <= L_MIN_WIDTH) {
|
|
9418
|
-
columnCount.value = grid.columns.md;
|
|
9419
|
-
} else if (width > L_MIN_WIDTH && width <= XL_MIN_WIDTH) {
|
|
9420
|
-
columnCount.value = grid.columns.l;
|
|
9421
|
-
} else {
|
|
9422
|
-
columnCount.value = grid.columns.xl;
|
|
9423
|
-
}
|
|
9424
|
-
};
|
|
9425
|
-
const setAddToCartAmount = (newAddToCartAmount) => {
|
|
9426
|
-
if (!newAddToCartAmount) {
|
|
9427
|
-
return;
|
|
9428
|
-
}
|
|
9429
|
-
addToCartAmount.value = newAddToCartAmount;
|
|
9430
|
-
};
|
|
9431
|
-
const setLayout = (newLayout) => {
|
|
9432
|
-
if (!newLayout) {
|
|
9433
|
-
return;
|
|
9434
|
-
}
|
|
9435
|
-
layout.value = newLayout;
|
|
9436
|
-
};
|
|
9437
|
-
const setLoading = (state) => {
|
|
9438
|
-
loading.value = state || false;
|
|
9439
|
-
};
|
|
9440
|
-
return {
|
|
9441
|
-
isMobileSidebarVisible,
|
|
9442
|
-
searchResult,
|
|
9443
|
-
columnCount,
|
|
9444
|
-
addToCartAmount,
|
|
9445
|
-
facets,
|
|
9446
|
-
filters,
|
|
9447
|
-
loading,
|
|
9448
|
-
layout,
|
|
9449
|
-
currentQueryText,
|
|
9450
|
-
totalItems,
|
|
9451
|
-
hasResults,
|
|
9452
|
-
labeledFilters,
|
|
9453
|
-
displayFilters,
|
|
9454
|
-
currentFilterCount,
|
|
9455
|
-
currentFilterKeys,
|
|
9456
|
-
hasAnyFilter,
|
|
9457
|
-
itemRange,
|
|
9458
|
-
isPageEmpty,
|
|
9459
|
-
setSidebarState,
|
|
9460
|
-
queryFacet,
|
|
9461
|
-
add: add2,
|
|
9462
|
-
setColumnCount,
|
|
9463
|
-
setAddToCartAmount,
|
|
9464
|
-
setLayout,
|
|
9465
|
-
setLoading
|
|
9466
|
-
};
|
|
9467
|
-
});
|
|
9468
9495
|
const createPublicQuery = (queryParams, sortOptions, defaultPageSize) => {
|
|
9469
9496
|
var _a;
|
|
9470
9497
|
const publicQuery = {};
|
|
@@ -12614,7 +12641,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
12614
12641
|
},
|
|
12615
12642
|
setup(__props) {
|
|
12616
12643
|
return (_ctx, _cache) => {
|
|
12617
|
-
return openBlock(), createBlock(_sfc_main$
|
|
12644
|
+
return openBlock(), createBlock(_sfc_main$13, {
|
|
12618
12645
|
item: _ctx.item,
|
|
12619
12646
|
options: _ctx.options,
|
|
12620
12647
|
"wrapper-class": "lupa-search-results-image-wrapper",
|
|
@@ -20432,7 +20459,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
20432
20459
|
class: "lupa-recommended-products",
|
|
20433
20460
|
"data-cy": "lupa-recommended-products"
|
|
20434
20461
|
};
|
|
20435
|
-
const _sfc_main$
|
|
20462
|
+
const _sfc_main$1b = /* @__PURE__ */ defineComponent({
|
|
20436
20463
|
__name: "Recommendations",
|
|
20437
20464
|
props: {
|
|
20438
20465
|
options: {}
|
|
@@ -20547,17 +20574,17 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
20547
20574
|
};
|
|
20548
20575
|
}
|
|
20549
20576
|
});
|
|
20550
|
-
let piniaInstance
|
|
20551
|
-
const initPinia
|
|
20552
|
-
if (piniaInstance
|
|
20553
|
-
return piniaInstance
|
|
20577
|
+
let piniaInstance = null;
|
|
20578
|
+
const initPinia = () => {
|
|
20579
|
+
if (piniaInstance) {
|
|
20580
|
+
return piniaInstance;
|
|
20554
20581
|
}
|
|
20555
20582
|
const pinia = createPinia();
|
|
20556
|
-
piniaInstance
|
|
20583
|
+
piniaInstance = pinia;
|
|
20557
20584
|
return pinia;
|
|
20558
20585
|
};
|
|
20559
20586
|
const setupTracking = (options) => {
|
|
20560
|
-
const pinia = initPinia
|
|
20587
|
+
const pinia = initPinia();
|
|
20561
20588
|
const store = useOptionsStore(pinia);
|
|
20562
20589
|
initTracking(options);
|
|
20563
20590
|
store.setTrackingOptions({ options });
|
|
@@ -26365,7 +26392,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
26365
26392
|
};
|
|
26366
26393
|
__expose({ fetch: fetch2 });
|
|
26367
26394
|
return (_ctx, _cache) => {
|
|
26368
|
-
return openBlock(), createBlock(unref(_sfc_main$
|
|
26395
|
+
return openBlock(), createBlock(unref(_sfc_main$1b), {
|
|
26369
26396
|
options: _ctx.recommendationOptions,
|
|
26370
26397
|
ref_key: "productRecommendations",
|
|
26371
26398
|
ref: productRecommendations
|
|
@@ -26425,15 +26452,6 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
26425
26452
|
searchContainer: {},
|
|
26426
26453
|
recommendations: {}
|
|
26427
26454
|
};
|
|
26428
|
-
let piniaInstance = null;
|
|
26429
|
-
const initPinia = () => {
|
|
26430
|
-
if (piniaInstance) {
|
|
26431
|
-
return piniaInstance;
|
|
26432
|
-
}
|
|
26433
|
-
const pinia = createPinia$1();
|
|
26434
|
-
piniaInstance = pinia;
|
|
26435
|
-
return pinia;
|
|
26436
|
-
};
|
|
26437
26455
|
const tracking = (options) => {
|
|
26438
26456
|
setupTracking(options);
|
|
26439
26457
|
};
|
|
@@ -26518,7 +26536,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
26518
26536
|
return;
|
|
26519
26537
|
}
|
|
26520
26538
|
const instance = createVue(options.containerSelector, _sfc_main$2, {
|
|
26521
|
-
|
|
26539
|
+
productListOptions: options
|
|
26522
26540
|
});
|
|
26523
26541
|
if (!instance) {
|
|
26524
26542
|
return;
|