@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.mjs
CHANGED
|
@@ -5747,55 +5747,6 @@ function normalizeContainer(container) {
|
|
|
5747
5747
|
}
|
|
5748
5748
|
return container;
|
|
5749
5749
|
}
|
|
5750
|
-
var isVue2$1 = false;
|
|
5751
|
-
/*!
|
|
5752
|
-
* pinia v2.1.4
|
|
5753
|
-
* (c) 2023 Eduardo San Martin Morote
|
|
5754
|
-
* @license MIT
|
|
5755
|
-
*/
|
|
5756
|
-
const piniaSymbol$1 = (
|
|
5757
|
-
/* istanbul ignore next */
|
|
5758
|
-
Symbol()
|
|
5759
|
-
);
|
|
5760
|
-
var MutationType$1;
|
|
5761
|
-
(function(MutationType2) {
|
|
5762
|
-
MutationType2["direct"] = "direct";
|
|
5763
|
-
MutationType2["patchObject"] = "patch object";
|
|
5764
|
-
MutationType2["patchFunction"] = "patch function";
|
|
5765
|
-
})(MutationType$1 || (MutationType$1 = {}));
|
|
5766
|
-
function createPinia$1() {
|
|
5767
|
-
const scope = effectScope(true);
|
|
5768
|
-
const state = scope.run(() => ref({}));
|
|
5769
|
-
let _p = [];
|
|
5770
|
-
let toBeInstalled = [];
|
|
5771
|
-
const pinia = markRaw({
|
|
5772
|
-
install(app2) {
|
|
5773
|
-
{
|
|
5774
|
-
pinia._a = app2;
|
|
5775
|
-
app2.provide(piniaSymbol$1, pinia);
|
|
5776
|
-
app2.config.globalProperties.$pinia = pinia;
|
|
5777
|
-
toBeInstalled.forEach((plugin) => _p.push(plugin));
|
|
5778
|
-
toBeInstalled = [];
|
|
5779
|
-
}
|
|
5780
|
-
},
|
|
5781
|
-
use(plugin) {
|
|
5782
|
-
if (!this._a && !isVue2$1) {
|
|
5783
|
-
toBeInstalled.push(plugin);
|
|
5784
|
-
} else {
|
|
5785
|
-
_p.push(plugin);
|
|
5786
|
-
}
|
|
5787
|
-
return this;
|
|
5788
|
-
},
|
|
5789
|
-
_p,
|
|
5790
|
-
// it's actually undefined here
|
|
5791
|
-
// @ts-expect-error
|
|
5792
|
-
_a: null,
|
|
5793
|
-
_e: scope,
|
|
5794
|
-
_s: /* @__PURE__ */ new Map(),
|
|
5795
|
-
state
|
|
5796
|
-
});
|
|
5797
|
-
return pinia;
|
|
5798
|
-
}
|
|
5799
5750
|
var __defProp2 = Object.defineProperty;
|
|
5800
5751
|
var __defProps2 = Object.defineProperties;
|
|
5801
5752
|
var __getOwnPropDescs2 = Object.getOwnPropertyDescriptors;
|
|
@@ -7680,16 +7631,16 @@ const useSearchBoxStore = defineStore("searchBox", () => {
|
|
|
7680
7631
|
resetHighlightIndex
|
|
7681
7632
|
};
|
|
7682
7633
|
});
|
|
7683
|
-
const _hoisted_1$
|
|
7684
|
-
const _hoisted_2$
|
|
7685
|
-
const _hoisted_3$
|
|
7686
|
-
const _hoisted_4$
|
|
7634
|
+
const _hoisted_1$12 = { id: "lupa-search-box-input-container" };
|
|
7635
|
+
const _hoisted_2$I = { class: "lupa-input-clear" };
|
|
7636
|
+
const _hoisted_3$u = { id: "lupa-search-box-input" };
|
|
7637
|
+
const _hoisted_4$m = ["value"];
|
|
7687
7638
|
const _hoisted_5$c = ["placeholder"];
|
|
7688
7639
|
const _hoisted_6$6 = {
|
|
7689
7640
|
key: 0,
|
|
7690
7641
|
class: "lupa-close-label"
|
|
7691
7642
|
};
|
|
7692
|
-
const _sfc_main$
|
|
7643
|
+
const _sfc_main$1a = /* @__PURE__ */ defineComponent({
|
|
7693
7644
|
__name: "SearchBoxInput",
|
|
7694
7645
|
props: {
|
|
7695
7646
|
options: {},
|
|
@@ -7766,19 +7717,19 @@ const _sfc_main$19 = /* @__PURE__ */ defineComponent({
|
|
|
7766
7717
|
};
|
|
7767
7718
|
__expose({ focus });
|
|
7768
7719
|
return (_ctx, _cache) => {
|
|
7769
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
7770
|
-
createBaseVNode("div", _hoisted_2$
|
|
7720
|
+
return openBlock(), createElementBlock("div", _hoisted_1$12, [
|
|
7721
|
+
createBaseVNode("div", _hoisted_2$I, [
|
|
7771
7722
|
createBaseVNode("div", {
|
|
7772
7723
|
class: normalizeClass(["lupa-input-clear-content", { "lupa-input-clear-filled": inputValue.value }]),
|
|
7773
7724
|
onClick: clear2
|
|
7774
7725
|
}, null, 2)
|
|
7775
7726
|
]),
|
|
7776
|
-
createBaseVNode("div", _hoisted_3$
|
|
7727
|
+
createBaseVNode("div", _hoisted_3$u, [
|
|
7777
7728
|
createBaseVNode("input", {
|
|
7778
7729
|
class: "lupa-hint",
|
|
7779
7730
|
value: showHint.value ? suggestedValue.value.item.suggestion : "",
|
|
7780
7731
|
disabled: ""
|
|
7781
|
-
}, null, 8, _hoisted_4$
|
|
7732
|
+
}, null, 8, _hoisted_4$m),
|
|
7782
7733
|
withDirectives(createBaseVNode("input", mergeProps({
|
|
7783
7734
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputValue.value = $event)
|
|
7784
7735
|
}, inputAttributes.value, {
|
|
@@ -7806,7 +7757,7 @@ const _sfc_main$19 = /* @__PURE__ */ defineComponent({
|
|
|
7806
7757
|
};
|
|
7807
7758
|
}
|
|
7808
7759
|
});
|
|
7809
|
-
const _sfc_main$
|
|
7760
|
+
const _sfc_main$19 = /* @__PURE__ */ defineComponent({
|
|
7810
7761
|
__name: "SearchBoxMoreResults",
|
|
7811
7762
|
props: {
|
|
7812
7763
|
labels: {},
|
|
@@ -7838,9 +7789,9 @@ const _sfc_main$18 = /* @__PURE__ */ defineComponent({
|
|
|
7838
7789
|
};
|
|
7839
7790
|
}
|
|
7840
7791
|
});
|
|
7841
|
-
const _hoisted_1$
|
|
7842
|
-
const _hoisted_2$
|
|
7843
|
-
const _sfc_main$
|
|
7792
|
+
const _hoisted_1$11 = { class: "lupa-search-box-history-item" };
|
|
7793
|
+
const _hoisted_2$H = { class: "lupa-search-box-history-item-content" };
|
|
7794
|
+
const _sfc_main$18 = /* @__PURE__ */ defineComponent({
|
|
7844
7795
|
__name: "SearchBoxHistoryItem",
|
|
7845
7796
|
props: {
|
|
7846
7797
|
item: {},
|
|
@@ -7856,8 +7807,8 @@ const _sfc_main$17 = /* @__PURE__ */ defineComponent({
|
|
|
7856
7807
|
emit2("click", { query: props.item });
|
|
7857
7808
|
};
|
|
7858
7809
|
return (_ctx, _cache) => {
|
|
7859
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
7860
|
-
createBaseVNode("div", _hoisted_2$
|
|
7810
|
+
return openBlock(), createElementBlock("div", _hoisted_1$11, [
|
|
7811
|
+
createBaseVNode("div", _hoisted_2$H, [
|
|
7861
7812
|
createBaseVNode("div", {
|
|
7862
7813
|
class: normalizeClass(["lupa-search-box-history-item-text", { "lupa-search-box-history-item-highlighted": _ctx.highlighted }]),
|
|
7863
7814
|
onClick: click2
|
|
@@ -7871,11 +7822,11 @@ const _sfc_main$17 = /* @__PURE__ */ defineComponent({
|
|
|
7871
7822
|
};
|
|
7872
7823
|
}
|
|
7873
7824
|
});
|
|
7874
|
-
const _hoisted_1
|
|
7825
|
+
const _hoisted_1$10 = {
|
|
7875
7826
|
key: 0,
|
|
7876
7827
|
class: "lupa-search-box-history-panel"
|
|
7877
7828
|
};
|
|
7878
|
-
const _sfc_main$
|
|
7829
|
+
const _sfc_main$17 = /* @__PURE__ */ defineComponent({
|
|
7879
7830
|
__name: "SearchBoxHistoryPanel",
|
|
7880
7831
|
props: {
|
|
7881
7832
|
options: {}
|
|
@@ -7916,9 +7867,9 @@ const _sfc_main$16 = /* @__PURE__ */ defineComponent({
|
|
|
7916
7867
|
}
|
|
7917
7868
|
};
|
|
7918
7869
|
return (_ctx, _cache) => {
|
|
7919
|
-
return hasHistory.value ? (openBlock(), createElementBlock("div", _hoisted_1
|
|
7870
|
+
return hasHistory.value ? (openBlock(), createElementBlock("div", _hoisted_1$10, [
|
|
7920
7871
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(history), (item, index) => {
|
|
7921
|
-
return openBlock(), createBlock(_sfc_main$
|
|
7872
|
+
return openBlock(), createBlock(_sfc_main$18, {
|
|
7922
7873
|
key: item,
|
|
7923
7874
|
item,
|
|
7924
7875
|
highlighted: index === highlightIndex.value,
|
|
@@ -7934,18 +7885,18 @@ const _sfc_main$16 = /* @__PURE__ */ defineComponent({
|
|
|
7934
7885
|
};
|
|
7935
7886
|
}
|
|
7936
7887
|
});
|
|
7937
|
-
const _hoisted_1
|
|
7938
|
-
const _hoisted_2$
|
|
7888
|
+
const _hoisted_1$$ = ["innerHTML"];
|
|
7889
|
+
const _hoisted_2$G = {
|
|
7939
7890
|
key: 1,
|
|
7940
7891
|
"data-cy": "lupa-suggestion-value",
|
|
7941
7892
|
class: "lupa-suggestion-value"
|
|
7942
7893
|
};
|
|
7943
|
-
const _hoisted_3$
|
|
7894
|
+
const _hoisted_3$t = {
|
|
7944
7895
|
key: 2,
|
|
7945
7896
|
class: "lupa-suggestion-facet",
|
|
7946
7897
|
"data-cy": "lupa-suggestion-facet"
|
|
7947
7898
|
};
|
|
7948
|
-
const _hoisted_4$
|
|
7899
|
+
const _hoisted_4$l = {
|
|
7949
7900
|
class: "lupa-suggestion-facet-label",
|
|
7950
7901
|
"data-cy": "lupa-suggestion-facet-label"
|
|
7951
7902
|
};
|
|
@@ -7953,7 +7904,7 @@ const _hoisted_5$b = {
|
|
|
7953
7904
|
class: "lupa-suggestion-facet-value",
|
|
7954
7905
|
"data-cy": "lupa-suggestion-facet-value"
|
|
7955
7906
|
};
|
|
7956
|
-
const _sfc_main$
|
|
7907
|
+
const _sfc_main$16 = /* @__PURE__ */ defineComponent({
|
|
7957
7908
|
__name: "SearchBoxSuggestion",
|
|
7958
7909
|
props: {
|
|
7959
7910
|
suggestion: {},
|
|
@@ -7989,20 +7940,20 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
|
|
|
7989
7940
|
class: "lupa-suggestion-value",
|
|
7990
7941
|
"data-cy": "lupa-suggestion-value",
|
|
7991
7942
|
innerHTML: _ctx.suggestion.displayHighlight
|
|
7992
|
-
}, null, 8, _hoisted_1
|
|
7993
|
-
_ctx.suggestion.facet ? (openBlock(), createElementBlock("div", _hoisted_3$
|
|
7994
|
-
createBaseVNode("span", _hoisted_4$
|
|
7943
|
+
}, null, 8, _hoisted_1$$)) : (openBlock(), createElementBlock("div", _hoisted_2$G, toDisplayString(_ctx.suggestion.display), 1)),
|
|
7944
|
+
_ctx.suggestion.facet ? (openBlock(), createElementBlock("div", _hoisted_3$t, [
|
|
7945
|
+
createBaseVNode("span", _hoisted_4$l, toDisplayString(facetLabel.value), 1),
|
|
7995
7946
|
createBaseVNode("span", _hoisted_5$b, toDisplayString(_ctx.suggestion.facet.title), 1)
|
|
7996
7947
|
])) : createCommentVNode("", true)
|
|
7997
7948
|
]);
|
|
7998
7949
|
};
|
|
7999
7950
|
}
|
|
8000
7951
|
});
|
|
8001
|
-
const _hoisted_1$
|
|
7952
|
+
const _hoisted_1$_ = {
|
|
8002
7953
|
id: "lupa-search-box-suggestions",
|
|
8003
7954
|
"data-cy": "lupa-search-box-suggestions"
|
|
8004
7955
|
};
|
|
8005
|
-
const _sfc_main$
|
|
7956
|
+
const _sfc_main$15 = /* @__PURE__ */ defineComponent({
|
|
8006
7957
|
__name: "SearchBoxSuggestions",
|
|
8007
7958
|
props: {
|
|
8008
7959
|
items: {},
|
|
@@ -8062,9 +8013,9 @@ const _sfc_main$14 = /* @__PURE__ */ defineComponent({
|
|
|
8062
8013
|
});
|
|
8063
8014
|
});
|
|
8064
8015
|
return (_ctx, _cache) => {
|
|
8065
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
8016
|
+
return openBlock(), createElementBlock("div", _hoisted_1$_, [
|
|
8066
8017
|
(openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (item, index) => {
|
|
8067
|
-
return openBlock(), createBlock(_sfc_main$
|
|
8018
|
+
return openBlock(), createBlock(_sfc_main$16, {
|
|
8068
8019
|
key: getSuggestionKey(item),
|
|
8069
8020
|
class: normalizeClass(["lupa-suggestion", index === highlightedIndex.value ? "lupa-suggestion-highlighted" : ""]),
|
|
8070
8021
|
suggestion: item,
|
|
@@ -8092,7 +8043,7 @@ const debounce$1 = (func, timeout) => {
|
|
|
8092
8043
|
}, timeout);
|
|
8093
8044
|
};
|
|
8094
8045
|
};
|
|
8095
|
-
const _sfc_main$
|
|
8046
|
+
const _sfc_main$14 = /* @__PURE__ */ defineComponent({
|
|
8096
8047
|
__name: "SearchBoxSuggestionsWrapper",
|
|
8097
8048
|
props: {
|
|
8098
8049
|
panel: {},
|
|
@@ -8133,7 +8084,7 @@ const _sfc_main$13 = /* @__PURE__ */ defineComponent({
|
|
|
8133
8084
|
};
|
|
8134
8085
|
const getSuggestionsDebounced = debounce$1(getSuggestions, props.debounce);
|
|
8135
8086
|
return (_ctx, _cache) => {
|
|
8136
|
-
return openBlock(), createBlock(_sfc_main$
|
|
8087
|
+
return openBlock(), createBlock(_sfc_main$15, {
|
|
8137
8088
|
items: searchResult.value,
|
|
8138
8089
|
highlight: _ctx.panel.highlight,
|
|
8139
8090
|
queryKey: _ctx.panel.queryKey,
|
|
@@ -8211,8 +8162,8 @@ const useDynamicDataStore = defineStore("dynamicData", () => {
|
|
|
8211
8162
|
});
|
|
8212
8163
|
return { dynamicDataIdMap, loading, enhanceSearchResultsWithDynamicData };
|
|
8213
8164
|
});
|
|
8214
|
-
const _hoisted_1$
|
|
8215
|
-
const _sfc_main$
|
|
8165
|
+
const _hoisted_1$Z = ["src"];
|
|
8166
|
+
const _sfc_main$13 = /* @__PURE__ */ defineComponent({
|
|
8216
8167
|
__name: "ProductImage",
|
|
8217
8168
|
props: {
|
|
8218
8169
|
item: {},
|
|
@@ -8260,12 +8211,12 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
|
|
|
8260
8211
|
class: normalizeClass((_b = _ctx.imageClass) != null ? _b : ""),
|
|
8261
8212
|
src: finalUrl.value,
|
|
8262
8213
|
onError: replaceWithPlaceholder
|
|
8263
|
-
}, null, 42, _hoisted_1$
|
|
8214
|
+
}, null, 42, _hoisted_1$Z)
|
|
8264
8215
|
], 2);
|
|
8265
8216
|
};
|
|
8266
8217
|
}
|
|
8267
8218
|
});
|
|
8268
|
-
const _sfc_main$
|
|
8219
|
+
const _sfc_main$12 = /* @__PURE__ */ defineComponent({
|
|
8269
8220
|
__name: "SearchBoxProductImage",
|
|
8270
8221
|
props: {
|
|
8271
8222
|
item: {},
|
|
@@ -8273,7 +8224,7 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
|
|
|
8273
8224
|
},
|
|
8274
8225
|
setup(__props) {
|
|
8275
8226
|
return (_ctx, _cache) => {
|
|
8276
|
-
return openBlock(), createBlock(_sfc_main$
|
|
8227
|
+
return openBlock(), createBlock(_sfc_main$13, {
|
|
8277
8228
|
item: _ctx.item,
|
|
8278
8229
|
options: _ctx.options,
|
|
8279
8230
|
"wrapper-class": "lupa-search-box-image-wrapper",
|
|
@@ -8282,12 +8233,12 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
|
|
|
8282
8233
|
};
|
|
8283
8234
|
}
|
|
8284
8235
|
});
|
|
8285
|
-
const _hoisted_1$
|
|
8286
|
-
const _hoisted_2$
|
|
8236
|
+
const _hoisted_1$Y = ["innerHTML"];
|
|
8237
|
+
const _hoisted_2$F = {
|
|
8287
8238
|
key: 1,
|
|
8288
8239
|
class: "lupa-search-box-product-title"
|
|
8289
8240
|
};
|
|
8290
|
-
const _sfc_main$
|
|
8241
|
+
const _sfc_main$11 = /* @__PURE__ */ defineComponent({
|
|
8291
8242
|
__name: "SearchBoxProductTitle",
|
|
8292
8243
|
props: {
|
|
8293
8244
|
item: {},
|
|
@@ -8307,18 +8258,18 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
|
|
|
8307
8258
|
key: 0,
|
|
8308
8259
|
class: "lupa-search-box-product-title",
|
|
8309
8260
|
innerHTML: title.value
|
|
8310
|
-
}, null, 8, _hoisted_1$
|
|
8261
|
+
}, null, 8, _hoisted_1$Y)) : (openBlock(), createElementBlock("div", _hoisted_2$F, [
|
|
8311
8262
|
createBaseVNode("strong", null, toDisplayString(title.value), 1)
|
|
8312
8263
|
]));
|
|
8313
8264
|
};
|
|
8314
8265
|
}
|
|
8315
8266
|
});
|
|
8316
|
-
const _hoisted_1$
|
|
8317
|
-
const _hoisted_2$
|
|
8267
|
+
const _hoisted_1$X = ["innerHTML"];
|
|
8268
|
+
const _hoisted_2$E = {
|
|
8318
8269
|
key: 1,
|
|
8319
8270
|
class: "lupa-search-box-product-description"
|
|
8320
8271
|
};
|
|
8321
|
-
const _sfc_main
|
|
8272
|
+
const _sfc_main$10 = /* @__PURE__ */ defineComponent({
|
|
8322
8273
|
__name: "SearchBoxProductDescription",
|
|
8323
8274
|
props: {
|
|
8324
8275
|
item: {},
|
|
@@ -8338,12 +8289,12 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent({
|
|
|
8338
8289
|
key: 0,
|
|
8339
8290
|
class: "lupa-search-box-product-description",
|
|
8340
8291
|
innerHTML: description.value
|
|
8341
|
-
}, null, 8, _hoisted_1$
|
|
8292
|
+
}, null, 8, _hoisted_1$X)) : (openBlock(), createElementBlock("div", _hoisted_2$E, toDisplayString(description.value), 1));
|
|
8342
8293
|
};
|
|
8343
8294
|
}
|
|
8344
8295
|
});
|
|
8345
|
-
const _hoisted_1$
|
|
8346
|
-
const _sfc_main
|
|
8296
|
+
const _hoisted_1$W = { class: "lupa-search-box-product-price" };
|
|
8297
|
+
const _sfc_main$$ = /* @__PURE__ */ defineComponent({
|
|
8347
8298
|
__name: "SearchBoxProductPrice",
|
|
8348
8299
|
props: {
|
|
8349
8300
|
item: {},
|
|
@@ -8361,14 +8312,14 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent({
|
|
|
8361
8312
|
);
|
|
8362
8313
|
});
|
|
8363
8314
|
return (_ctx, _cache) => {
|
|
8364
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
8315
|
+
return openBlock(), createElementBlock("div", _hoisted_1$W, [
|
|
8365
8316
|
createBaseVNode("strong", null, toDisplayString(price.value), 1)
|
|
8366
8317
|
]);
|
|
8367
8318
|
};
|
|
8368
8319
|
}
|
|
8369
8320
|
});
|
|
8370
|
-
const _hoisted_1$
|
|
8371
|
-
const _sfc_main$
|
|
8321
|
+
const _hoisted_1$V = { class: "lupa-search-box-product-regular-price" };
|
|
8322
|
+
const _sfc_main$_ = /* @__PURE__ */ defineComponent({
|
|
8372
8323
|
__name: "SearchBoxProductRegularPrice",
|
|
8373
8324
|
props: {
|
|
8374
8325
|
item: {},
|
|
@@ -8386,16 +8337,16 @@ const _sfc_main$Z = /* @__PURE__ */ defineComponent({
|
|
|
8386
8337
|
);
|
|
8387
8338
|
});
|
|
8388
8339
|
return (_ctx, _cache) => {
|
|
8389
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
8340
|
+
return openBlock(), createElementBlock("div", _hoisted_1$V, toDisplayString(price.value), 1);
|
|
8390
8341
|
};
|
|
8391
8342
|
}
|
|
8392
8343
|
});
|
|
8393
|
-
const _hoisted_1$
|
|
8394
|
-
const _hoisted_2$
|
|
8395
|
-
const _hoisted_3$
|
|
8396
|
-
const _hoisted_4$
|
|
8344
|
+
const _hoisted_1$U = ["innerHTML"];
|
|
8345
|
+
const _hoisted_2$D = { key: 0 };
|
|
8346
|
+
const _hoisted_3$s = { key: 1 };
|
|
8347
|
+
const _hoisted_4$k = { class: "lupa-search-box-custom-label" };
|
|
8397
8348
|
const _hoisted_5$a = { class: "lupa-search-box-custom-text" };
|
|
8398
|
-
const _sfc_main$
|
|
8349
|
+
const _sfc_main$Z = /* @__PURE__ */ defineComponent({
|
|
8399
8350
|
__name: "SearchBoxProductCustom",
|
|
8400
8351
|
props: {
|
|
8401
8352
|
item: {},
|
|
@@ -8421,52 +8372,288 @@ const _sfc_main$Y = /* @__PURE__ */ defineComponent({
|
|
|
8421
8372
|
key: 0,
|
|
8422
8373
|
class: [className.value, "lupa-search-box-product-custom"],
|
|
8423
8374
|
innerHTML: text.value
|
|
8424
|
-
}, toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), null, 16, _hoisted_1$
|
|
8375
|
+
}, toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), null, 16, _hoisted_1$U)) : (openBlock(), createElementBlock("div", mergeProps({
|
|
8425
8376
|
key: 1,
|
|
8426
8377
|
class: [className.value, "lupa-search-box-product-custom"]
|
|
8427
8378
|
}, toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), [
|
|
8428
|
-
!label.value ? (openBlock(), createElementBlock("div", _hoisted_2$
|
|
8429
|
-
createBaseVNode("div", _hoisted_4$
|
|
8379
|
+
!label.value ? (openBlock(), createElementBlock("div", _hoisted_2$D, toDisplayString(text.value), 1)) : (openBlock(), createElementBlock("div", _hoisted_3$s, [
|
|
8380
|
+
createBaseVNode("div", _hoisted_4$k, toDisplayString(label.value), 1),
|
|
8430
8381
|
createBaseVNode("div", _hoisted_5$a, toDisplayString(text.value), 1)
|
|
8431
8382
|
]))
|
|
8432
8383
|
], 16));
|
|
8433
8384
|
};
|
|
8434
8385
|
}
|
|
8435
8386
|
});
|
|
8436
|
-
const _hoisted_1$
|
|
8437
|
-
const _sfc_main$
|
|
8387
|
+
const _hoisted_1$T = ["innerHTML"];
|
|
8388
|
+
const _sfc_main$Y = /* @__PURE__ */ defineComponent({
|
|
8438
8389
|
__name: "SearchBoxProductCustomHtml",
|
|
8439
8390
|
props: {
|
|
8440
8391
|
item: {},
|
|
8441
8392
|
options: {}
|
|
8442
8393
|
},
|
|
8443
|
-
setup(__props) {
|
|
8394
|
+
setup(__props) {
|
|
8395
|
+
const props = __props;
|
|
8396
|
+
const text = computed(() => props.options.html(props.item));
|
|
8397
|
+
const className = computed(() => props.options.className);
|
|
8398
|
+
const handleClick = () => __async(this, null, function* () {
|
|
8399
|
+
if (!props.options.action) {
|
|
8400
|
+
return;
|
|
8401
|
+
}
|
|
8402
|
+
yield props.options.action(props.item);
|
|
8403
|
+
});
|
|
8404
|
+
return (_ctx, _cache) => {
|
|
8405
|
+
return openBlock(), createElementBlock("div", mergeProps({
|
|
8406
|
+
class: className.value,
|
|
8407
|
+
innerHTML: text.value
|
|
8408
|
+
}, toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), null, 16, _hoisted_1$T);
|
|
8409
|
+
};
|
|
8410
|
+
}
|
|
8411
|
+
});
|
|
8412
|
+
var ResultsLayoutEnum = /* @__PURE__ */ ((ResultsLayoutEnum2) => {
|
|
8413
|
+
ResultsLayoutEnum2["GRID"] = "Grid";
|
|
8414
|
+
ResultsLayoutEnum2["LIST"] = "List";
|
|
8415
|
+
return ResultsLayoutEnum2;
|
|
8416
|
+
})(ResultsLayoutEnum || {});
|
|
8417
|
+
const RESULT_ROOT_ID = "lupa-search-results";
|
|
8418
|
+
const SHADOW_ROOT_ID = "lupa-shadow-id";
|
|
8419
|
+
const CONTAINER_ROOT_ID = "lupa-search-container";
|
|
8420
|
+
const scrollToSearchResults = (timeout = 500) => {
|
|
8421
|
+
if (timeout) {
|
|
8422
|
+
setTimeout(() => scrollTo(RESULT_ROOT_ID), timeout);
|
|
8423
|
+
} else {
|
|
8424
|
+
scrollTo(RESULT_ROOT_ID);
|
|
8425
|
+
}
|
|
8426
|
+
};
|
|
8427
|
+
const scrollTo = (elementId) => {
|
|
8428
|
+
var _a, _b;
|
|
8429
|
+
let el = document.getElementById(elementId);
|
|
8430
|
+
const shadowRoot = (_a = document.getElementById(SHADOW_ROOT_ID)) == null ? void 0 : _a.shadowRoot;
|
|
8431
|
+
if (!el) {
|
|
8432
|
+
el = (_b = shadowRoot == null ? void 0 : shadowRoot.getElementById(elementId)) != null ? _b : null;
|
|
8433
|
+
}
|
|
8434
|
+
if (!el) {
|
|
8435
|
+
return;
|
|
8436
|
+
}
|
|
8437
|
+
const searchContainer2 = shadowRoot ? shadowRoot.getElementById(CONTAINER_ROOT_ID) : void 0;
|
|
8438
|
+
const container = searchContainer2 != null ? searchContainer2 : window;
|
|
8439
|
+
container.scrollTo({
|
|
8440
|
+
top: el.offsetTop,
|
|
8441
|
+
behavior: "smooth"
|
|
8442
|
+
});
|
|
8443
|
+
};
|
|
8444
|
+
const disableBodyScroll = () => {
|
|
8445
|
+
const scrollY = window.scrollY;
|
|
8446
|
+
document.body.style.position = "fixed";
|
|
8447
|
+
document.body.style.top = `-${scrollY}px`;
|
|
8448
|
+
};
|
|
8449
|
+
const enableBodyScroll = () => {
|
|
8450
|
+
const scrollY = document.body.style.top;
|
|
8451
|
+
document.body.style.position = "";
|
|
8452
|
+
document.body.style.top = "";
|
|
8453
|
+
window.scrollTo(0, parseInt(scrollY || "0") * -1);
|
|
8454
|
+
};
|
|
8455
|
+
const setDocumentTitle = (template, textToInsert = "") => {
|
|
8456
|
+
document.title = addParamsToLabel(template, textToInsert);
|
|
8457
|
+
};
|
|
8458
|
+
const useSearchResultStore = defineStore("searchResult", () => {
|
|
8459
|
+
const searchResult = ref({});
|
|
8460
|
+
const columnCount = ref(2);
|
|
8461
|
+
const addToCartAmount = ref(1);
|
|
8462
|
+
const layout = ref(ResultsLayoutEnum.GRID);
|
|
8463
|
+
const loading = ref(false);
|
|
8464
|
+
const isMobileSidebarVisible = ref(false);
|
|
8465
|
+
const optionsStore = useOptionsStore();
|
|
8466
|
+
const paramsStore = useParamsStore();
|
|
8467
|
+
const facets = computed(() => searchResult.value.facets);
|
|
8468
|
+
const filters = computed(() => searchResult.value.filters);
|
|
8469
|
+
const currentQueryText = computed(() => searchResult.value.searchText);
|
|
8470
|
+
const totalItems = computed(() => searchResult.value.total);
|
|
8471
|
+
const hasResults = computed(() => totalItems.value > 0);
|
|
8472
|
+
const labeledFilters = computed(
|
|
8473
|
+
() => getLabeledFilters(unfoldFilters(filters.value), facets.value)
|
|
8474
|
+
);
|
|
8475
|
+
const displayFilters = computed(() => {
|
|
8476
|
+
var _a, _b;
|
|
8477
|
+
const initialFilters = optionsStore.initialFilters;
|
|
8478
|
+
return (_b = (_a = labeledFilters.value) == null ? void 0 : _a.filter((f2) => !(initialFilters == null ? void 0 : initialFilters[f2.key]))) != null ? _b : [];
|
|
8479
|
+
});
|
|
8480
|
+
const currentFilterCount = computed(() => {
|
|
8481
|
+
var _a, _b;
|
|
8482
|
+
return (_b = (_a = displayFilters.value) == null ? void 0 : _a.length) != null ? _b : 0;
|
|
8483
|
+
});
|
|
8484
|
+
const currentFilterKeys = computed(() => {
|
|
8485
|
+
var _a;
|
|
8486
|
+
return Object.keys((_a = filters.value) != null ? _a : {});
|
|
8487
|
+
});
|
|
8488
|
+
const hasAnyFilter = computed(() => {
|
|
8489
|
+
var _a;
|
|
8490
|
+
return Object.keys((_a = filters.value) != null ? _a : {}).length > 0;
|
|
8491
|
+
});
|
|
8492
|
+
const itemRange = computed(() => {
|
|
8493
|
+
var _a, _b;
|
|
8494
|
+
const limit = (_a = paramsStore.limit) != null ? _a : 0;
|
|
8495
|
+
const offset = (_b = searchResult.value.offset) != null ? _b : 0;
|
|
8496
|
+
return [offset + 1, Math.min(offset + limit, totalItems.value)];
|
|
8497
|
+
});
|
|
8498
|
+
const isPageEmpty = computed(
|
|
8499
|
+
() => {
|
|
8500
|
+
var _a;
|
|
8501
|
+
return hasResults.value && ((_a = searchResult.value.offset) != null ? _a : 0) >= totalItems.value;
|
|
8502
|
+
}
|
|
8503
|
+
);
|
|
8504
|
+
const setSidebarState = ({ visible }) => {
|
|
8505
|
+
if (visible) {
|
|
8506
|
+
disableBodyScroll();
|
|
8507
|
+
} else {
|
|
8508
|
+
enableBodyScroll();
|
|
8509
|
+
}
|
|
8510
|
+
isMobileSidebarVisible.value = visible;
|
|
8511
|
+
};
|
|
8512
|
+
const queryFacet = (_0) => __async(void 0, [_0], function* ({ queryKey, facetKey }) {
|
|
8513
|
+
var _a, _b, _c, _d;
|
|
8514
|
+
const query = { searchText: "", filters: __spreadValues2({}, filters.value) };
|
|
8515
|
+
const options = (_a = optionsStore.envOptions) != null ? _a : { environment: "production" };
|
|
8516
|
+
const result = yield LupaSearchSdk.query(queryKey, query, options);
|
|
8517
|
+
if (!result.success) {
|
|
8518
|
+
return;
|
|
8519
|
+
}
|
|
8520
|
+
const facet = (_b = result.facets) == null ? void 0 : _b.find((f2) => f2.key === facetKey);
|
|
8521
|
+
const facetItems = (_c = facet == null ? void 0 : facet.items) != null ? _c : [];
|
|
8522
|
+
const updatedResult = __spreadProps2(__spreadValues2({}, searchResult.value), {
|
|
8523
|
+
facets: (_d = facets.value) == null ? void 0 : _d.map((f2) => f2.key === facetKey ? __spreadProps2(__spreadValues2({}, f2), { items: facetItems }) : f2)
|
|
8524
|
+
});
|
|
8525
|
+
searchResult.value = updatedResult;
|
|
8526
|
+
});
|
|
8527
|
+
const add2 = (newSearchResult) => {
|
|
8528
|
+
var _a, _b;
|
|
8529
|
+
if (!newSearchResult) {
|
|
8530
|
+
return {
|
|
8531
|
+
searchResult: searchResult.value,
|
|
8532
|
+
pageSize: searchResult.value.limit || 0
|
|
8533
|
+
};
|
|
8534
|
+
}
|
|
8535
|
+
if (typeof document !== "undefined") {
|
|
8536
|
+
setDocumentTitle(
|
|
8537
|
+
(_b = (_a = optionsStore.searchResultOptions) == null ? void 0 : _a.labels) == null ? void 0 : _b.htmlTitleTemplate,
|
|
8538
|
+
newSearchResult.searchText
|
|
8539
|
+
);
|
|
8540
|
+
}
|
|
8541
|
+
searchResult.value = newSearchResult;
|
|
8542
|
+
return { searchResult: newSearchResult };
|
|
8543
|
+
};
|
|
8544
|
+
const setColumnCount = ({ width, grid }) => {
|
|
8545
|
+
if (!width || !grid) {
|
|
8546
|
+
return;
|
|
8547
|
+
}
|
|
8548
|
+
if (width <= S_MIN_WIDTH) {
|
|
8549
|
+
columnCount.value = grid.columns.xs;
|
|
8550
|
+
} else if (width > S_MIN_WIDTH && width <= MD_MIN_WIDTH) {
|
|
8551
|
+
columnCount.value = grid.columns.sm;
|
|
8552
|
+
} else if (width > MD_MIN_WIDTH && width <= L_MIN_WIDTH) {
|
|
8553
|
+
columnCount.value = grid.columns.md;
|
|
8554
|
+
} else if (width > L_MIN_WIDTH && width <= XL_MIN_WIDTH) {
|
|
8555
|
+
columnCount.value = grid.columns.l;
|
|
8556
|
+
} else {
|
|
8557
|
+
columnCount.value = grid.columns.xl;
|
|
8558
|
+
}
|
|
8559
|
+
};
|
|
8560
|
+
const setAddToCartAmount = (newAddToCartAmount) => {
|
|
8561
|
+
if (!newAddToCartAmount) {
|
|
8562
|
+
return;
|
|
8563
|
+
}
|
|
8564
|
+
addToCartAmount.value = newAddToCartAmount;
|
|
8565
|
+
};
|
|
8566
|
+
const setLayout = (newLayout) => {
|
|
8567
|
+
if (!newLayout) {
|
|
8568
|
+
return;
|
|
8569
|
+
}
|
|
8570
|
+
layout.value = newLayout;
|
|
8571
|
+
};
|
|
8572
|
+
const setLoading = (state) => {
|
|
8573
|
+
loading.value = state || false;
|
|
8574
|
+
};
|
|
8575
|
+
return {
|
|
8576
|
+
isMobileSidebarVisible,
|
|
8577
|
+
searchResult,
|
|
8578
|
+
columnCount,
|
|
8579
|
+
addToCartAmount,
|
|
8580
|
+
facets,
|
|
8581
|
+
filters,
|
|
8582
|
+
loading,
|
|
8583
|
+
layout,
|
|
8584
|
+
currentQueryText,
|
|
8585
|
+
totalItems,
|
|
8586
|
+
hasResults,
|
|
8587
|
+
labeledFilters,
|
|
8588
|
+
displayFilters,
|
|
8589
|
+
currentFilterCount,
|
|
8590
|
+
currentFilterKeys,
|
|
8591
|
+
hasAnyFilter,
|
|
8592
|
+
itemRange,
|
|
8593
|
+
isPageEmpty,
|
|
8594
|
+
setSidebarState,
|
|
8595
|
+
queryFacet,
|
|
8596
|
+
add: add2,
|
|
8597
|
+
setColumnCount,
|
|
8598
|
+
setAddToCartAmount,
|
|
8599
|
+
setLayout,
|
|
8600
|
+
setLoading
|
|
8601
|
+
};
|
|
8602
|
+
});
|
|
8603
|
+
const _hoisted_1$S = { class: "lupa-search-results-add-to-cart-wrapper" };
|
|
8604
|
+
const _hoisted_2$C = { class: "lupa-search-results-product-addtocart" };
|
|
8605
|
+
const _hoisted_3$r = ["onClick", "disabled"];
|
|
8606
|
+
const _sfc_main$X = /* @__PURE__ */ defineComponent({
|
|
8607
|
+
__name: "SearchBoxProductAddToCart",
|
|
8608
|
+
props: {
|
|
8609
|
+
item: {},
|
|
8610
|
+
options: {},
|
|
8611
|
+
inStock: { type: Boolean }
|
|
8612
|
+
},
|
|
8613
|
+
emits: ["productEvent"],
|
|
8614
|
+
setup(__props, { emit: emit2 }) {
|
|
8444
8615
|
const props = __props;
|
|
8445
|
-
const
|
|
8446
|
-
|
|
8616
|
+
const inStockValue = computed(() => {
|
|
8617
|
+
var _a;
|
|
8618
|
+
return (_a = props.inStock) != null ? _a : true;
|
|
8619
|
+
});
|
|
8620
|
+
const searchResultStore = useSearchResultStore();
|
|
8621
|
+
const { addToCartAmount } = storeToRefs(searchResultStore);
|
|
8622
|
+
const loading = ref(false);
|
|
8623
|
+
const label = computed(() => {
|
|
8624
|
+
return props.options.labels.addToCart;
|
|
8625
|
+
});
|
|
8447
8626
|
const handleClick = () => __async(this, null, function* () {
|
|
8448
|
-
|
|
8449
|
-
|
|
8450
|
-
}
|
|
8451
|
-
|
|
8627
|
+
loading.value = true;
|
|
8628
|
+
yield props.options.action(props.item, addToCartAmount.value);
|
|
8629
|
+
emit2("productEvent", { type: "addToCart" });
|
|
8630
|
+
loading.value = false;
|
|
8452
8631
|
});
|
|
8453
8632
|
return (_ctx, _cache) => {
|
|
8454
|
-
return openBlock(), createElementBlock("div",
|
|
8455
|
-
|
|
8456
|
-
|
|
8457
|
-
|
|
8633
|
+
return openBlock(), createElementBlock("div", _hoisted_1$S, [
|
|
8634
|
+
createBaseVNode("div", _hoisted_2$C, [
|
|
8635
|
+
createBaseVNode("button", {
|
|
8636
|
+
onClick: withModifiers(handleClick, ["stop", "prevent"]),
|
|
8637
|
+
class: normalizeClass(loading.value ? "lupa-add-to-cart-loading" : "lupa-add-to-cart"),
|
|
8638
|
+
"data-cy": "lupa-add-to-cart",
|
|
8639
|
+
type: "button",
|
|
8640
|
+
disabled: !inStockValue.value || loading.value
|
|
8641
|
+
}, toDisplayString(label.value), 11, _hoisted_3$r)
|
|
8642
|
+
])
|
|
8643
|
+
]);
|
|
8458
8644
|
};
|
|
8459
8645
|
}
|
|
8460
8646
|
});
|
|
8461
8647
|
const __default__$4 = {
|
|
8462
8648
|
components: {
|
|
8463
|
-
SearchBoxProductImage: _sfc_main$
|
|
8464
|
-
SearchBoxProductTitle: _sfc_main$
|
|
8465
|
-
SearchBoxProductDescription: _sfc_main
|
|
8466
|
-
SearchBoxProductPrice: _sfc_main
|
|
8467
|
-
SearchBoxProductRegularPrice: _sfc_main$
|
|
8468
|
-
SearchBoxProductCustom: _sfc_main$
|
|
8469
|
-
SearchBoxProductCustomHtml: _sfc_main$
|
|
8649
|
+
SearchBoxProductImage: _sfc_main$12,
|
|
8650
|
+
SearchBoxProductTitle: _sfc_main$11,
|
|
8651
|
+
SearchBoxProductDescription: _sfc_main$10,
|
|
8652
|
+
SearchBoxProductPrice: _sfc_main$$,
|
|
8653
|
+
SearchBoxProductRegularPrice: _sfc_main$_,
|
|
8654
|
+
SearchBoxProductCustom: _sfc_main$Z,
|
|
8655
|
+
SearchBoxProductCustomHtml: _sfc_main$Y,
|
|
8656
|
+
SearchBoxProductAddToCart: _sfc_main$X
|
|
8470
8657
|
}
|
|
8471
8658
|
};
|
|
8472
8659
|
const _sfc_main$W = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValues2({}, __default__$4), {
|
|
@@ -8474,7 +8661,8 @@ const _sfc_main$W = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
|
|
|
8474
8661
|
props: {
|
|
8475
8662
|
item: {},
|
|
8476
8663
|
element: {},
|
|
8477
|
-
labels: {}
|
|
8664
|
+
labels: {},
|
|
8665
|
+
isInStock: { type: Boolean }
|
|
8478
8666
|
},
|
|
8479
8667
|
setup(__props) {
|
|
8480
8668
|
const props = __props;
|
|
@@ -8496,6 +8684,8 @@ const _sfc_main$W = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
|
|
|
8496
8684
|
return "search-box-product-custom";
|
|
8497
8685
|
case DocumentElementType.CUSTOM_HTML:
|
|
8498
8686
|
return "search-box-product-custom-html";
|
|
8687
|
+
case DocumentElementType.ADDTOCART:
|
|
8688
|
+
return "search-box-product-add-to-cart";
|
|
8499
8689
|
}
|
|
8500
8690
|
return "search-box-product-title";
|
|
8501
8691
|
});
|
|
@@ -8519,8 +8709,9 @@ const _sfc_main$W = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
|
|
|
8519
8709
|
item: enhancedItem.value,
|
|
8520
8710
|
options: _ctx.element,
|
|
8521
8711
|
labels: _ctx.labels,
|
|
8522
|
-
class: normalizeClass({ "lupa-loading-dynamic-data": isLoadingDynamicData.value })
|
|
8523
|
-
|
|
8712
|
+
class: normalizeClass({ "lupa-loading-dynamic-data": isLoadingDynamicData.value }),
|
|
8713
|
+
inStock: _ctx.isInStock
|
|
8714
|
+
}, null, 8, ["item", "options", "labels", "class", "inStock"])) : createCommentVNode("", true);
|
|
8524
8715
|
};
|
|
8525
8716
|
}
|
|
8526
8717
|
}));
|
|
@@ -8582,6 +8773,10 @@ const useTrackingStore = defineStore("tracking", () => {
|
|
|
8582
8773
|
const _hoisted_1$R = ["href"];
|
|
8583
8774
|
const _hoisted_2$B = { class: "lupa-search-box-product-image-section" };
|
|
8584
8775
|
const _hoisted_3$q = { class: "lupa-search-box-product-details-section" };
|
|
8776
|
+
const _hoisted_4$j = {
|
|
8777
|
+
key: 0,
|
|
8778
|
+
class: "lupa-search-box-product-add-to-cart-section"
|
|
8779
|
+
};
|
|
8585
8780
|
const _sfc_main$V = /* @__PURE__ */ defineComponent({
|
|
8586
8781
|
__name: "SearchBoxProduct",
|
|
8587
8782
|
props: {
|
|
@@ -8597,6 +8792,7 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
|
|
|
8597
8792
|
const historyStore = useHistoryStore();
|
|
8598
8793
|
const trackingStore = useTrackingStore();
|
|
8599
8794
|
const optionsStore = useOptionsStore();
|
|
8795
|
+
const isInStock = ref(true);
|
|
8600
8796
|
const { boxRoutingBehavior } = storeToRefs(optionsStore);
|
|
8601
8797
|
const link = computed(() => {
|
|
8602
8798
|
var _a, _b;
|
|
@@ -8608,7 +8804,9 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
|
|
|
8608
8804
|
});
|
|
8609
8805
|
const detailElements = computed(() => {
|
|
8610
8806
|
var _a, _b;
|
|
8611
|
-
return (_b = (_a = props.panelOptions.elements) == null ? void 0 : _a.filter(
|
|
8807
|
+
return (_b = (_a = props.panelOptions.elements) == null ? void 0 : _a.filter(
|
|
8808
|
+
(e) => e.type !== DocumentElementType.IMAGE && e.type !== DocumentElementType.ADDTOCART
|
|
8809
|
+
)) != null ? _b : [];
|
|
8612
8810
|
});
|
|
8613
8811
|
const id = computed(() => {
|
|
8614
8812
|
if (props.panelOptions.idKey) {
|
|
@@ -8626,6 +8824,10 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
|
|
|
8626
8824
|
});
|
|
8627
8825
|
return title2;
|
|
8628
8826
|
});
|
|
8827
|
+
const addToCartElement = computed(() => {
|
|
8828
|
+
var _a;
|
|
8829
|
+
return (_a = props.panelOptions.elements) == null ? void 0 : _a.find((e) => e.type === DocumentElementType.ADDTOCART);
|
|
8830
|
+
});
|
|
8629
8831
|
const handleClick = (event) => {
|
|
8630
8832
|
var _a;
|
|
8631
8833
|
if (props.panelOptions.titleKey) {
|
|
@@ -8655,6 +8857,12 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
|
|
|
8655
8857
|
emit2("product-click");
|
|
8656
8858
|
handleRoutingEvent(link.value, event, boxRoutingBehavior.value === "event");
|
|
8657
8859
|
};
|
|
8860
|
+
onMounted(() => {
|
|
8861
|
+
checkIfIsInStock();
|
|
8862
|
+
});
|
|
8863
|
+
const checkIfIsInStock = () => __async(this, null, function* () {
|
|
8864
|
+
isInStock.value = props.panelOptions.isInStock ? yield props.panelOptions.isInStock(props.item) : true;
|
|
8865
|
+
});
|
|
8658
8866
|
return (_ctx, _cache) => {
|
|
8659
8867
|
return openBlock(), createElementBlock("a", {
|
|
8660
8868
|
class: normalizeClass(["lupa-search-box-product", { "lupa-search-box-product-highlighted": _ctx.highlighted }]),
|
|
@@ -8685,7 +8893,17 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
|
|
|
8685
8893
|
link: link.value
|
|
8686
8894
|
}, null, 8, ["item", "element", "labels", "link"]);
|
|
8687
8895
|
}), 128))
|
|
8688
|
-
])
|
|
8896
|
+
]),
|
|
8897
|
+
addToCartElement.value ? (openBlock(), createElementBlock("div", _hoisted_4$j, [
|
|
8898
|
+
createVNode(_sfc_main$W, {
|
|
8899
|
+
class: "lupa-search-box-product-element",
|
|
8900
|
+
item: _ctx.item,
|
|
8901
|
+
element: addToCartElement.value,
|
|
8902
|
+
labels: _ctx.labels,
|
|
8903
|
+
link: link.value,
|
|
8904
|
+
isInStock: isInStock.value
|
|
8905
|
+
}, null, 8, ["item", "element", "labels", "link", "isInStock"])
|
|
8906
|
+
])) : createCommentVNode("", true)
|
|
8689
8907
|
], 10, _hoisted_1$R);
|
|
8690
8908
|
};
|
|
8691
8909
|
}
|
|
@@ -8819,7 +9037,7 @@ const _hoisted_3$p = {
|
|
|
8819
9037
|
};
|
|
8820
9038
|
const __default__$3 = {
|
|
8821
9039
|
components: {
|
|
8822
|
-
SearchBoxSuggestionsWrapper: _sfc_main$
|
|
9040
|
+
SearchBoxSuggestionsWrapper: _sfc_main$14,
|
|
8823
9041
|
SearchBoxProductsWrapper: _sfc_main$T
|
|
8824
9042
|
}
|
|
8825
9043
|
};
|
|
@@ -8969,13 +9187,13 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
|
|
|
8969
9187
|
], 10, _hoisted_2$A);
|
|
8970
9188
|
}), 128))
|
|
8971
9189
|
]),
|
|
8972
|
-
createVNode(_sfc_main$
|
|
9190
|
+
createVNode(_sfc_main$19, {
|
|
8973
9191
|
labels: labels.value,
|
|
8974
9192
|
showTotalCount: (_a = _ctx.options.showTotalCount) != null ? _a : false,
|
|
8975
9193
|
onGoToResults: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("go-to-results"))
|
|
8976
9194
|
}, null, 8, ["labels", "showTotalCount"])
|
|
8977
9195
|
], 512)) : displayHistory.value ? (openBlock(), createElementBlock("div", _hoisted_3$p, [
|
|
8978
|
-
createVNode(_sfc_main$
|
|
9196
|
+
createVNode(_sfc_main$17, {
|
|
8979
9197
|
ref: "panel",
|
|
8980
9198
|
options: _ctx.options.history,
|
|
8981
9199
|
history: history.value,
|
|
@@ -9236,7 +9454,7 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({
|
|
|
9236
9454
|
var _a2;
|
|
9237
9455
|
return openBlock(), createElementBlock("div", _hoisted_1$O, [
|
|
9238
9456
|
createBaseVNode("div", _hoisted_2$z, [
|
|
9239
|
-
createVNode(_sfc_main$
|
|
9457
|
+
createVNode(_sfc_main$1a, {
|
|
9240
9458
|
options: inputOptions.value,
|
|
9241
9459
|
suggestedValue: suggestedValue.value,
|
|
9242
9460
|
"can-close": (_a2 = _ctx.isSearchContainer) != null ? _a2 : false,
|
|
@@ -9270,197 +9488,6 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({
|
|
|
9270
9488
|
};
|
|
9271
9489
|
}
|
|
9272
9490
|
});
|
|
9273
|
-
var ResultsLayoutEnum = /* @__PURE__ */ ((ResultsLayoutEnum2) => {
|
|
9274
|
-
ResultsLayoutEnum2["GRID"] = "Grid";
|
|
9275
|
-
ResultsLayoutEnum2["LIST"] = "List";
|
|
9276
|
-
return ResultsLayoutEnum2;
|
|
9277
|
-
})(ResultsLayoutEnum || {});
|
|
9278
|
-
const RESULT_ROOT_ID = "lupa-search-results";
|
|
9279
|
-
const SHADOW_ROOT_ID = "lupa-shadow-id";
|
|
9280
|
-
const CONTAINER_ROOT_ID = "lupa-search-container";
|
|
9281
|
-
const scrollToSearchResults = (timeout = 500) => {
|
|
9282
|
-
if (timeout) {
|
|
9283
|
-
setTimeout(() => scrollTo(RESULT_ROOT_ID), timeout);
|
|
9284
|
-
} else {
|
|
9285
|
-
scrollTo(RESULT_ROOT_ID);
|
|
9286
|
-
}
|
|
9287
|
-
};
|
|
9288
|
-
const scrollTo = (elementId) => {
|
|
9289
|
-
var _a, _b;
|
|
9290
|
-
let el = document.getElementById(elementId);
|
|
9291
|
-
const shadowRoot = (_a = document.getElementById(SHADOW_ROOT_ID)) == null ? void 0 : _a.shadowRoot;
|
|
9292
|
-
if (!el) {
|
|
9293
|
-
el = (_b = shadowRoot == null ? void 0 : shadowRoot.getElementById(elementId)) != null ? _b : null;
|
|
9294
|
-
}
|
|
9295
|
-
if (!el) {
|
|
9296
|
-
return;
|
|
9297
|
-
}
|
|
9298
|
-
const searchContainer2 = shadowRoot ? shadowRoot.getElementById(CONTAINER_ROOT_ID) : void 0;
|
|
9299
|
-
const container = searchContainer2 != null ? searchContainer2 : window;
|
|
9300
|
-
container.scrollTo({
|
|
9301
|
-
top: el.offsetTop,
|
|
9302
|
-
behavior: "smooth"
|
|
9303
|
-
});
|
|
9304
|
-
};
|
|
9305
|
-
const disableBodyScroll = () => {
|
|
9306
|
-
const scrollY = window.scrollY;
|
|
9307
|
-
document.body.style.position = "fixed";
|
|
9308
|
-
document.body.style.top = `-${scrollY}px`;
|
|
9309
|
-
};
|
|
9310
|
-
const enableBodyScroll = () => {
|
|
9311
|
-
const scrollY = document.body.style.top;
|
|
9312
|
-
document.body.style.position = "";
|
|
9313
|
-
document.body.style.top = "";
|
|
9314
|
-
window.scrollTo(0, parseInt(scrollY || "0") * -1);
|
|
9315
|
-
};
|
|
9316
|
-
const setDocumentTitle = (template, textToInsert = "") => {
|
|
9317
|
-
document.title = addParamsToLabel(template, textToInsert);
|
|
9318
|
-
};
|
|
9319
|
-
const useSearchResultStore = defineStore("searchResult", () => {
|
|
9320
|
-
const searchResult = ref({});
|
|
9321
|
-
const columnCount = ref(2);
|
|
9322
|
-
const addToCartAmount = ref(1);
|
|
9323
|
-
const layout = ref(ResultsLayoutEnum.GRID);
|
|
9324
|
-
const loading = ref(false);
|
|
9325
|
-
const isMobileSidebarVisible = ref(false);
|
|
9326
|
-
const optionsStore = useOptionsStore();
|
|
9327
|
-
const paramsStore = useParamsStore();
|
|
9328
|
-
const facets = computed(() => searchResult.value.facets);
|
|
9329
|
-
const filters = computed(() => searchResult.value.filters);
|
|
9330
|
-
const currentQueryText = computed(() => searchResult.value.searchText);
|
|
9331
|
-
const totalItems = computed(() => searchResult.value.total);
|
|
9332
|
-
const hasResults = computed(() => totalItems.value > 0);
|
|
9333
|
-
const labeledFilters = computed(
|
|
9334
|
-
() => getLabeledFilters(unfoldFilters(filters.value), facets.value)
|
|
9335
|
-
);
|
|
9336
|
-
const displayFilters = computed(() => {
|
|
9337
|
-
var _a, _b;
|
|
9338
|
-
const initialFilters = optionsStore.initialFilters;
|
|
9339
|
-
return (_b = (_a = labeledFilters.value) == null ? void 0 : _a.filter((f2) => !(initialFilters == null ? void 0 : initialFilters[f2.key]))) != null ? _b : [];
|
|
9340
|
-
});
|
|
9341
|
-
const currentFilterCount = computed(() => {
|
|
9342
|
-
var _a, _b;
|
|
9343
|
-
return (_b = (_a = displayFilters.value) == null ? void 0 : _a.length) != null ? _b : 0;
|
|
9344
|
-
});
|
|
9345
|
-
const currentFilterKeys = computed(() => {
|
|
9346
|
-
var _a;
|
|
9347
|
-
return Object.keys((_a = filters.value) != null ? _a : {});
|
|
9348
|
-
});
|
|
9349
|
-
const hasAnyFilter = computed(() => {
|
|
9350
|
-
var _a;
|
|
9351
|
-
return Object.keys((_a = filters.value) != null ? _a : {}).length > 0;
|
|
9352
|
-
});
|
|
9353
|
-
const itemRange = computed(() => {
|
|
9354
|
-
var _a, _b;
|
|
9355
|
-
const limit = (_a = paramsStore.limit) != null ? _a : 0;
|
|
9356
|
-
const offset = (_b = searchResult.value.offset) != null ? _b : 0;
|
|
9357
|
-
return [offset + 1, Math.min(offset + limit, totalItems.value)];
|
|
9358
|
-
});
|
|
9359
|
-
const isPageEmpty = computed(
|
|
9360
|
-
() => {
|
|
9361
|
-
var _a;
|
|
9362
|
-
return hasResults.value && ((_a = searchResult.value.offset) != null ? _a : 0) >= totalItems.value;
|
|
9363
|
-
}
|
|
9364
|
-
);
|
|
9365
|
-
const setSidebarState = ({ visible }) => {
|
|
9366
|
-
if (visible) {
|
|
9367
|
-
disableBodyScroll();
|
|
9368
|
-
} else {
|
|
9369
|
-
enableBodyScroll();
|
|
9370
|
-
}
|
|
9371
|
-
isMobileSidebarVisible.value = visible;
|
|
9372
|
-
};
|
|
9373
|
-
const queryFacet = (_0) => __async(void 0, [_0], function* ({ queryKey, facetKey }) {
|
|
9374
|
-
var _a, _b, _c, _d;
|
|
9375
|
-
const query = { searchText: "", filters: __spreadValues2({}, filters.value) };
|
|
9376
|
-
const options = (_a = optionsStore.envOptions) != null ? _a : { environment: "production" };
|
|
9377
|
-
const result = yield LupaSearchSdk.query(queryKey, query, options);
|
|
9378
|
-
if (!result.success) {
|
|
9379
|
-
return;
|
|
9380
|
-
}
|
|
9381
|
-
const facet = (_b = result.facets) == null ? void 0 : _b.find((f2) => f2.key === facetKey);
|
|
9382
|
-
const facetItems = (_c = facet == null ? void 0 : facet.items) != null ? _c : [];
|
|
9383
|
-
const updatedResult = __spreadProps2(__spreadValues2({}, searchResult.value), {
|
|
9384
|
-
facets: (_d = facets.value) == null ? void 0 : _d.map((f2) => f2.key === facetKey ? __spreadProps2(__spreadValues2({}, f2), { items: facetItems }) : f2)
|
|
9385
|
-
});
|
|
9386
|
-
searchResult.value = updatedResult;
|
|
9387
|
-
});
|
|
9388
|
-
const add2 = (newSearchResult) => {
|
|
9389
|
-
var _a, _b;
|
|
9390
|
-
if (!newSearchResult) {
|
|
9391
|
-
return {
|
|
9392
|
-
searchResult: searchResult.value,
|
|
9393
|
-
pageSize: searchResult.value.limit || 0
|
|
9394
|
-
};
|
|
9395
|
-
}
|
|
9396
|
-
if (typeof document !== "undefined") {
|
|
9397
|
-
setDocumentTitle(
|
|
9398
|
-
(_b = (_a = optionsStore.searchResultOptions) == null ? void 0 : _a.labels) == null ? void 0 : _b.htmlTitleTemplate,
|
|
9399
|
-
newSearchResult.searchText
|
|
9400
|
-
);
|
|
9401
|
-
}
|
|
9402
|
-
searchResult.value = newSearchResult;
|
|
9403
|
-
return { searchResult: newSearchResult };
|
|
9404
|
-
};
|
|
9405
|
-
const setColumnCount = ({ width, grid }) => {
|
|
9406
|
-
if (!width || !grid) {
|
|
9407
|
-
return;
|
|
9408
|
-
}
|
|
9409
|
-
if (width <= S_MIN_WIDTH) {
|
|
9410
|
-
columnCount.value = grid.columns.xs;
|
|
9411
|
-
} else if (width > S_MIN_WIDTH && width <= MD_MIN_WIDTH) {
|
|
9412
|
-
columnCount.value = grid.columns.sm;
|
|
9413
|
-
} else if (width > MD_MIN_WIDTH && width <= L_MIN_WIDTH) {
|
|
9414
|
-
columnCount.value = grid.columns.md;
|
|
9415
|
-
} else if (width > L_MIN_WIDTH && width <= XL_MIN_WIDTH) {
|
|
9416
|
-
columnCount.value = grid.columns.l;
|
|
9417
|
-
} else {
|
|
9418
|
-
columnCount.value = grid.columns.xl;
|
|
9419
|
-
}
|
|
9420
|
-
};
|
|
9421
|
-
const setAddToCartAmount = (newAddToCartAmount) => {
|
|
9422
|
-
if (!newAddToCartAmount) {
|
|
9423
|
-
return;
|
|
9424
|
-
}
|
|
9425
|
-
addToCartAmount.value = newAddToCartAmount;
|
|
9426
|
-
};
|
|
9427
|
-
const setLayout = (newLayout) => {
|
|
9428
|
-
if (!newLayout) {
|
|
9429
|
-
return;
|
|
9430
|
-
}
|
|
9431
|
-
layout.value = newLayout;
|
|
9432
|
-
};
|
|
9433
|
-
const setLoading = (state) => {
|
|
9434
|
-
loading.value = state || false;
|
|
9435
|
-
};
|
|
9436
|
-
return {
|
|
9437
|
-
isMobileSidebarVisible,
|
|
9438
|
-
searchResult,
|
|
9439
|
-
columnCount,
|
|
9440
|
-
addToCartAmount,
|
|
9441
|
-
facets,
|
|
9442
|
-
filters,
|
|
9443
|
-
loading,
|
|
9444
|
-
layout,
|
|
9445
|
-
currentQueryText,
|
|
9446
|
-
totalItems,
|
|
9447
|
-
hasResults,
|
|
9448
|
-
labeledFilters,
|
|
9449
|
-
displayFilters,
|
|
9450
|
-
currentFilterCount,
|
|
9451
|
-
currentFilterKeys,
|
|
9452
|
-
hasAnyFilter,
|
|
9453
|
-
itemRange,
|
|
9454
|
-
isPageEmpty,
|
|
9455
|
-
setSidebarState,
|
|
9456
|
-
queryFacet,
|
|
9457
|
-
add: add2,
|
|
9458
|
-
setColumnCount,
|
|
9459
|
-
setAddToCartAmount,
|
|
9460
|
-
setLayout,
|
|
9461
|
-
setLoading
|
|
9462
|
-
};
|
|
9463
|
-
});
|
|
9464
9491
|
const createPublicQuery = (queryParams, sortOptions, defaultPageSize) => {
|
|
9465
9492
|
var _a;
|
|
9466
9493
|
const publicQuery = {};
|
|
@@ -12610,7 +12637,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
12610
12637
|
},
|
|
12611
12638
|
setup(__props) {
|
|
12612
12639
|
return (_ctx, _cache) => {
|
|
12613
|
-
return openBlock(), createBlock(_sfc_main$
|
|
12640
|
+
return openBlock(), createBlock(_sfc_main$13, {
|
|
12614
12641
|
item: _ctx.item,
|
|
12615
12642
|
options: _ctx.options,
|
|
12616
12643
|
"wrapper-class": "lupa-search-results-image-wrapper",
|
|
@@ -20428,7 +20455,7 @@ const _hoisted_2 = {
|
|
|
20428
20455
|
class: "lupa-recommended-products",
|
|
20429
20456
|
"data-cy": "lupa-recommended-products"
|
|
20430
20457
|
};
|
|
20431
|
-
const _sfc_main$
|
|
20458
|
+
const _sfc_main$1b = /* @__PURE__ */ defineComponent({
|
|
20432
20459
|
__name: "Recommendations",
|
|
20433
20460
|
props: {
|
|
20434
20461
|
options: {}
|
|
@@ -20543,17 +20570,17 @@ const _sfc_main$1a = /* @__PURE__ */ defineComponent({
|
|
|
20543
20570
|
};
|
|
20544
20571
|
}
|
|
20545
20572
|
});
|
|
20546
|
-
let piniaInstance
|
|
20547
|
-
const initPinia
|
|
20548
|
-
if (piniaInstance
|
|
20549
|
-
return piniaInstance
|
|
20573
|
+
let piniaInstance = null;
|
|
20574
|
+
const initPinia = () => {
|
|
20575
|
+
if (piniaInstance) {
|
|
20576
|
+
return piniaInstance;
|
|
20550
20577
|
}
|
|
20551
20578
|
const pinia = createPinia();
|
|
20552
|
-
piniaInstance
|
|
20579
|
+
piniaInstance = pinia;
|
|
20553
20580
|
return pinia;
|
|
20554
20581
|
};
|
|
20555
20582
|
const setupTracking = (options) => {
|
|
20556
|
-
const pinia = initPinia
|
|
20583
|
+
const pinia = initPinia();
|
|
20557
20584
|
const store = useOptionsStore(pinia);
|
|
20558
20585
|
initTracking(options);
|
|
20559
20586
|
store.setTrackingOptions({ options });
|
|
@@ -26361,7 +26388,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
26361
26388
|
};
|
|
26362
26389
|
__expose({ fetch: fetch2 });
|
|
26363
26390
|
return (_ctx, _cache) => {
|
|
26364
|
-
return openBlock(), createBlock(unref(_sfc_main$
|
|
26391
|
+
return openBlock(), createBlock(unref(_sfc_main$1b), {
|
|
26365
26392
|
options: _ctx.recommendationOptions,
|
|
26366
26393
|
ref_key: "productRecommendations",
|
|
26367
26394
|
ref: productRecommendations
|
|
@@ -26421,15 +26448,6 @@ const app = {
|
|
|
26421
26448
|
searchContainer: {},
|
|
26422
26449
|
recommendations: {}
|
|
26423
26450
|
};
|
|
26424
|
-
let piniaInstance = null;
|
|
26425
|
-
const initPinia = () => {
|
|
26426
|
-
if (piniaInstance) {
|
|
26427
|
-
return piniaInstance;
|
|
26428
|
-
}
|
|
26429
|
-
const pinia = createPinia$1();
|
|
26430
|
-
piniaInstance = pinia;
|
|
26431
|
-
return pinia;
|
|
26432
|
-
};
|
|
26433
26451
|
const tracking = (options) => {
|
|
26434
26452
|
setupTracking(options);
|
|
26435
26453
|
};
|
|
@@ -26514,7 +26532,7 @@ const productList = (options, mountOptions) => {
|
|
|
26514
26532
|
return;
|
|
26515
26533
|
}
|
|
26516
26534
|
const instance = createVue(options.containerSelector, _sfc_main$2, {
|
|
26517
|
-
|
|
26535
|
+
productListOptions: options
|
|
26518
26536
|
});
|
|
26519
26537
|
if (!instance) {
|
|
26520
26538
|
return;
|