@getlupa/client 1.0.5 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lupaSearch.iife.js +349 -273
- package/dist/lupaSearch.js +349 -273
- package/dist/lupaSearch.mjs +349 -273
- package/dist/lupaSearch.umd.js +349 -273
- package/dist/style.css +1 -1
- package/package.json +2 -2
package/dist/lupaSearch.mjs
CHANGED
|
@@ -7631,16 +7631,16 @@ const useSearchBoxStore = defineStore("searchBox", () => {
|
|
|
7631
7631
|
resetHighlightIndex
|
|
7632
7632
|
};
|
|
7633
7633
|
});
|
|
7634
|
-
const _hoisted_1$
|
|
7635
|
-
const _hoisted_2$
|
|
7636
|
-
const _hoisted_3$
|
|
7637
|
-
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"];
|
|
7638
7638
|
const _hoisted_5$c = ["placeholder"];
|
|
7639
7639
|
const _hoisted_6$6 = {
|
|
7640
7640
|
key: 0,
|
|
7641
7641
|
class: "lupa-close-label"
|
|
7642
7642
|
};
|
|
7643
|
-
const _sfc_main$
|
|
7643
|
+
const _sfc_main$1a = /* @__PURE__ */ defineComponent({
|
|
7644
7644
|
__name: "SearchBoxInput",
|
|
7645
7645
|
props: {
|
|
7646
7646
|
options: {},
|
|
@@ -7717,19 +7717,19 @@ const _sfc_main$19 = /* @__PURE__ */ defineComponent({
|
|
|
7717
7717
|
};
|
|
7718
7718
|
__expose({ focus });
|
|
7719
7719
|
return (_ctx, _cache) => {
|
|
7720
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
7721
|
-
createBaseVNode("div", _hoisted_2$
|
|
7720
|
+
return openBlock(), createElementBlock("div", _hoisted_1$12, [
|
|
7721
|
+
createBaseVNode("div", _hoisted_2$I, [
|
|
7722
7722
|
createBaseVNode("div", {
|
|
7723
7723
|
class: normalizeClass(["lupa-input-clear-content", { "lupa-input-clear-filled": inputValue.value }]),
|
|
7724
7724
|
onClick: clear2
|
|
7725
7725
|
}, null, 2)
|
|
7726
7726
|
]),
|
|
7727
|
-
createBaseVNode("div", _hoisted_3$
|
|
7727
|
+
createBaseVNode("div", _hoisted_3$u, [
|
|
7728
7728
|
createBaseVNode("input", {
|
|
7729
7729
|
class: "lupa-hint",
|
|
7730
7730
|
value: showHint.value ? suggestedValue.value.item.suggestion : "",
|
|
7731
7731
|
disabled: ""
|
|
7732
|
-
}, null, 8, _hoisted_4$
|
|
7732
|
+
}, null, 8, _hoisted_4$m),
|
|
7733
7733
|
withDirectives(createBaseVNode("input", mergeProps({
|
|
7734
7734
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputValue.value = $event)
|
|
7735
7735
|
}, inputAttributes.value, {
|
|
@@ -7757,7 +7757,7 @@ const _sfc_main$19 = /* @__PURE__ */ defineComponent({
|
|
|
7757
7757
|
};
|
|
7758
7758
|
}
|
|
7759
7759
|
});
|
|
7760
|
-
const _sfc_main$
|
|
7760
|
+
const _sfc_main$19 = /* @__PURE__ */ defineComponent({
|
|
7761
7761
|
__name: "SearchBoxMoreResults",
|
|
7762
7762
|
props: {
|
|
7763
7763
|
labels: {},
|
|
@@ -7789,9 +7789,9 @@ const _sfc_main$18 = /* @__PURE__ */ defineComponent({
|
|
|
7789
7789
|
};
|
|
7790
7790
|
}
|
|
7791
7791
|
});
|
|
7792
|
-
const _hoisted_1$
|
|
7793
|
-
const _hoisted_2$
|
|
7794
|
-
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({
|
|
7795
7795
|
__name: "SearchBoxHistoryItem",
|
|
7796
7796
|
props: {
|
|
7797
7797
|
item: {},
|
|
@@ -7807,8 +7807,8 @@ const _sfc_main$17 = /* @__PURE__ */ defineComponent({
|
|
|
7807
7807
|
emit2("click", { query: props.item });
|
|
7808
7808
|
};
|
|
7809
7809
|
return (_ctx, _cache) => {
|
|
7810
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
7811
|
-
createBaseVNode("div", _hoisted_2$
|
|
7810
|
+
return openBlock(), createElementBlock("div", _hoisted_1$11, [
|
|
7811
|
+
createBaseVNode("div", _hoisted_2$H, [
|
|
7812
7812
|
createBaseVNode("div", {
|
|
7813
7813
|
class: normalizeClass(["lupa-search-box-history-item-text", { "lupa-search-box-history-item-highlighted": _ctx.highlighted }]),
|
|
7814
7814
|
onClick: click2
|
|
@@ -7822,11 +7822,11 @@ const _sfc_main$17 = /* @__PURE__ */ defineComponent({
|
|
|
7822
7822
|
};
|
|
7823
7823
|
}
|
|
7824
7824
|
});
|
|
7825
|
-
const _hoisted_1
|
|
7825
|
+
const _hoisted_1$10 = {
|
|
7826
7826
|
key: 0,
|
|
7827
7827
|
class: "lupa-search-box-history-panel"
|
|
7828
7828
|
};
|
|
7829
|
-
const _sfc_main$
|
|
7829
|
+
const _sfc_main$17 = /* @__PURE__ */ defineComponent({
|
|
7830
7830
|
__name: "SearchBoxHistoryPanel",
|
|
7831
7831
|
props: {
|
|
7832
7832
|
options: {}
|
|
@@ -7867,9 +7867,9 @@ const _sfc_main$16 = /* @__PURE__ */ defineComponent({
|
|
|
7867
7867
|
}
|
|
7868
7868
|
};
|
|
7869
7869
|
return (_ctx, _cache) => {
|
|
7870
|
-
return hasHistory.value ? (openBlock(), createElementBlock("div", _hoisted_1
|
|
7870
|
+
return hasHistory.value ? (openBlock(), createElementBlock("div", _hoisted_1$10, [
|
|
7871
7871
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(history), (item, index) => {
|
|
7872
|
-
return openBlock(), createBlock(_sfc_main$
|
|
7872
|
+
return openBlock(), createBlock(_sfc_main$18, {
|
|
7873
7873
|
key: item,
|
|
7874
7874
|
item,
|
|
7875
7875
|
highlighted: index === highlightIndex.value,
|
|
@@ -7885,18 +7885,18 @@ const _sfc_main$16 = /* @__PURE__ */ defineComponent({
|
|
|
7885
7885
|
};
|
|
7886
7886
|
}
|
|
7887
7887
|
});
|
|
7888
|
-
const _hoisted_1
|
|
7889
|
-
const _hoisted_2$
|
|
7888
|
+
const _hoisted_1$$ = ["innerHTML"];
|
|
7889
|
+
const _hoisted_2$G = {
|
|
7890
7890
|
key: 1,
|
|
7891
7891
|
"data-cy": "lupa-suggestion-value",
|
|
7892
7892
|
class: "lupa-suggestion-value"
|
|
7893
7893
|
};
|
|
7894
|
-
const _hoisted_3$
|
|
7894
|
+
const _hoisted_3$t = {
|
|
7895
7895
|
key: 2,
|
|
7896
7896
|
class: "lupa-suggestion-facet",
|
|
7897
7897
|
"data-cy": "lupa-suggestion-facet"
|
|
7898
7898
|
};
|
|
7899
|
-
const _hoisted_4$
|
|
7899
|
+
const _hoisted_4$l = {
|
|
7900
7900
|
class: "lupa-suggestion-facet-label",
|
|
7901
7901
|
"data-cy": "lupa-suggestion-facet-label"
|
|
7902
7902
|
};
|
|
@@ -7904,7 +7904,7 @@ const _hoisted_5$b = {
|
|
|
7904
7904
|
class: "lupa-suggestion-facet-value",
|
|
7905
7905
|
"data-cy": "lupa-suggestion-facet-value"
|
|
7906
7906
|
};
|
|
7907
|
-
const _sfc_main$
|
|
7907
|
+
const _sfc_main$16 = /* @__PURE__ */ defineComponent({
|
|
7908
7908
|
__name: "SearchBoxSuggestion",
|
|
7909
7909
|
props: {
|
|
7910
7910
|
suggestion: {},
|
|
@@ -7940,20 +7940,20 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
|
|
|
7940
7940
|
class: "lupa-suggestion-value",
|
|
7941
7941
|
"data-cy": "lupa-suggestion-value",
|
|
7942
7942
|
innerHTML: _ctx.suggestion.displayHighlight
|
|
7943
|
-
}, null, 8, _hoisted_1
|
|
7944
|
-
_ctx.suggestion.facet ? (openBlock(), createElementBlock("div", _hoisted_3$
|
|
7945
|
-
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),
|
|
7946
7946
|
createBaseVNode("span", _hoisted_5$b, toDisplayString(_ctx.suggestion.facet.title), 1)
|
|
7947
7947
|
])) : createCommentVNode("", true)
|
|
7948
7948
|
]);
|
|
7949
7949
|
};
|
|
7950
7950
|
}
|
|
7951
7951
|
});
|
|
7952
|
-
const _hoisted_1$
|
|
7952
|
+
const _hoisted_1$_ = {
|
|
7953
7953
|
id: "lupa-search-box-suggestions",
|
|
7954
7954
|
"data-cy": "lupa-search-box-suggestions"
|
|
7955
7955
|
};
|
|
7956
|
-
const _sfc_main$
|
|
7956
|
+
const _sfc_main$15 = /* @__PURE__ */ defineComponent({
|
|
7957
7957
|
__name: "SearchBoxSuggestions",
|
|
7958
7958
|
props: {
|
|
7959
7959
|
items: {},
|
|
@@ -8013,9 +8013,9 @@ const _sfc_main$14 = /* @__PURE__ */ defineComponent({
|
|
|
8013
8013
|
});
|
|
8014
8014
|
});
|
|
8015
8015
|
return (_ctx, _cache) => {
|
|
8016
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
8016
|
+
return openBlock(), createElementBlock("div", _hoisted_1$_, [
|
|
8017
8017
|
(openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (item, index) => {
|
|
8018
|
-
return openBlock(), createBlock(_sfc_main$
|
|
8018
|
+
return openBlock(), createBlock(_sfc_main$16, {
|
|
8019
8019
|
key: getSuggestionKey(item),
|
|
8020
8020
|
class: normalizeClass(["lupa-suggestion", index === highlightedIndex.value ? "lupa-suggestion-highlighted" : ""]),
|
|
8021
8021
|
suggestion: item,
|
|
@@ -8043,7 +8043,7 @@ const debounce$1 = (func, timeout) => {
|
|
|
8043
8043
|
}, timeout);
|
|
8044
8044
|
};
|
|
8045
8045
|
};
|
|
8046
|
-
const _sfc_main$
|
|
8046
|
+
const _sfc_main$14 = /* @__PURE__ */ defineComponent({
|
|
8047
8047
|
__name: "SearchBoxSuggestionsWrapper",
|
|
8048
8048
|
props: {
|
|
8049
8049
|
panel: {},
|
|
@@ -8084,7 +8084,7 @@ const _sfc_main$13 = /* @__PURE__ */ defineComponent({
|
|
|
8084
8084
|
};
|
|
8085
8085
|
const getSuggestionsDebounced = debounce$1(getSuggestions, props.debounce);
|
|
8086
8086
|
return (_ctx, _cache) => {
|
|
8087
|
-
return openBlock(), createBlock(_sfc_main$
|
|
8087
|
+
return openBlock(), createBlock(_sfc_main$15, {
|
|
8088
8088
|
items: searchResult.value,
|
|
8089
8089
|
highlight: _ctx.panel.highlight,
|
|
8090
8090
|
queryKey: _ctx.panel.queryKey,
|
|
@@ -8162,8 +8162,8 @@ const useDynamicDataStore = defineStore("dynamicData", () => {
|
|
|
8162
8162
|
});
|
|
8163
8163
|
return { dynamicDataIdMap, loading, enhanceSearchResultsWithDynamicData };
|
|
8164
8164
|
});
|
|
8165
|
-
const _hoisted_1$
|
|
8166
|
-
const _sfc_main$
|
|
8165
|
+
const _hoisted_1$Z = ["src"];
|
|
8166
|
+
const _sfc_main$13 = /* @__PURE__ */ defineComponent({
|
|
8167
8167
|
__name: "ProductImage",
|
|
8168
8168
|
props: {
|
|
8169
8169
|
item: {},
|
|
@@ -8211,12 +8211,12 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
|
|
|
8211
8211
|
class: normalizeClass((_b = _ctx.imageClass) != null ? _b : ""),
|
|
8212
8212
|
src: finalUrl.value,
|
|
8213
8213
|
onError: replaceWithPlaceholder
|
|
8214
|
-
}, null, 42, _hoisted_1$
|
|
8214
|
+
}, null, 42, _hoisted_1$Z)
|
|
8215
8215
|
], 2);
|
|
8216
8216
|
};
|
|
8217
8217
|
}
|
|
8218
8218
|
});
|
|
8219
|
-
const _sfc_main$
|
|
8219
|
+
const _sfc_main$12 = /* @__PURE__ */ defineComponent({
|
|
8220
8220
|
__name: "SearchBoxProductImage",
|
|
8221
8221
|
props: {
|
|
8222
8222
|
item: {},
|
|
@@ -8224,7 +8224,7 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
|
|
|
8224
8224
|
},
|
|
8225
8225
|
setup(__props) {
|
|
8226
8226
|
return (_ctx, _cache) => {
|
|
8227
|
-
return openBlock(), createBlock(_sfc_main$
|
|
8227
|
+
return openBlock(), createBlock(_sfc_main$13, {
|
|
8228
8228
|
item: _ctx.item,
|
|
8229
8229
|
options: _ctx.options,
|
|
8230
8230
|
"wrapper-class": "lupa-search-box-image-wrapper",
|
|
@@ -8233,12 +8233,12 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
|
|
|
8233
8233
|
};
|
|
8234
8234
|
}
|
|
8235
8235
|
});
|
|
8236
|
-
const _hoisted_1$
|
|
8237
|
-
const _hoisted_2$
|
|
8236
|
+
const _hoisted_1$Y = ["innerHTML"];
|
|
8237
|
+
const _hoisted_2$F = {
|
|
8238
8238
|
key: 1,
|
|
8239
8239
|
class: "lupa-search-box-product-title"
|
|
8240
8240
|
};
|
|
8241
|
-
const _sfc_main$
|
|
8241
|
+
const _sfc_main$11 = /* @__PURE__ */ defineComponent({
|
|
8242
8242
|
__name: "SearchBoxProductTitle",
|
|
8243
8243
|
props: {
|
|
8244
8244
|
item: {},
|
|
@@ -8258,18 +8258,18 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
|
|
|
8258
8258
|
key: 0,
|
|
8259
8259
|
class: "lupa-search-box-product-title",
|
|
8260
8260
|
innerHTML: title.value
|
|
8261
|
-
}, null, 8, _hoisted_1$
|
|
8261
|
+
}, null, 8, _hoisted_1$Y)) : (openBlock(), createElementBlock("div", _hoisted_2$F, [
|
|
8262
8262
|
createBaseVNode("strong", null, toDisplayString(title.value), 1)
|
|
8263
8263
|
]));
|
|
8264
8264
|
};
|
|
8265
8265
|
}
|
|
8266
8266
|
});
|
|
8267
|
-
const _hoisted_1$
|
|
8268
|
-
const _hoisted_2$
|
|
8267
|
+
const _hoisted_1$X = ["innerHTML"];
|
|
8268
|
+
const _hoisted_2$E = {
|
|
8269
8269
|
key: 1,
|
|
8270
8270
|
class: "lupa-search-box-product-description"
|
|
8271
8271
|
};
|
|
8272
|
-
const _sfc_main
|
|
8272
|
+
const _sfc_main$10 = /* @__PURE__ */ defineComponent({
|
|
8273
8273
|
__name: "SearchBoxProductDescription",
|
|
8274
8274
|
props: {
|
|
8275
8275
|
item: {},
|
|
@@ -8289,12 +8289,12 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent({
|
|
|
8289
8289
|
key: 0,
|
|
8290
8290
|
class: "lupa-search-box-product-description",
|
|
8291
8291
|
innerHTML: description.value
|
|
8292
|
-
}, null, 8, _hoisted_1$
|
|
8292
|
+
}, null, 8, _hoisted_1$X)) : (openBlock(), createElementBlock("div", _hoisted_2$E, toDisplayString(description.value), 1));
|
|
8293
8293
|
};
|
|
8294
8294
|
}
|
|
8295
8295
|
});
|
|
8296
|
-
const _hoisted_1$
|
|
8297
|
-
const _sfc_main
|
|
8296
|
+
const _hoisted_1$W = { class: "lupa-search-box-product-price" };
|
|
8297
|
+
const _sfc_main$$ = /* @__PURE__ */ defineComponent({
|
|
8298
8298
|
__name: "SearchBoxProductPrice",
|
|
8299
8299
|
props: {
|
|
8300
8300
|
item: {},
|
|
@@ -8312,14 +8312,14 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent({
|
|
|
8312
8312
|
);
|
|
8313
8313
|
});
|
|
8314
8314
|
return (_ctx, _cache) => {
|
|
8315
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
8315
|
+
return openBlock(), createElementBlock("div", _hoisted_1$W, [
|
|
8316
8316
|
createBaseVNode("strong", null, toDisplayString(price.value), 1)
|
|
8317
8317
|
]);
|
|
8318
8318
|
};
|
|
8319
8319
|
}
|
|
8320
8320
|
});
|
|
8321
|
-
const _hoisted_1$
|
|
8322
|
-
const _sfc_main$
|
|
8321
|
+
const _hoisted_1$V = { class: "lupa-search-box-product-regular-price" };
|
|
8322
|
+
const _sfc_main$_ = /* @__PURE__ */ defineComponent({
|
|
8323
8323
|
__name: "SearchBoxProductRegularPrice",
|
|
8324
8324
|
props: {
|
|
8325
8325
|
item: {},
|
|
@@ -8337,16 +8337,16 @@ const _sfc_main$Z = /* @__PURE__ */ defineComponent({
|
|
|
8337
8337
|
);
|
|
8338
8338
|
});
|
|
8339
8339
|
return (_ctx, _cache) => {
|
|
8340
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
8340
|
+
return openBlock(), createElementBlock("div", _hoisted_1$V, toDisplayString(price.value), 1);
|
|
8341
8341
|
};
|
|
8342
8342
|
}
|
|
8343
8343
|
});
|
|
8344
|
-
const _hoisted_1$
|
|
8345
|
-
const _hoisted_2$
|
|
8346
|
-
const _hoisted_3$
|
|
8347
|
-
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" };
|
|
8348
8348
|
const _hoisted_5$a = { class: "lupa-search-box-custom-text" };
|
|
8349
|
-
const _sfc_main$
|
|
8349
|
+
const _sfc_main$Z = /* @__PURE__ */ defineComponent({
|
|
8350
8350
|
__name: "SearchBoxProductCustom",
|
|
8351
8351
|
props: {
|
|
8352
8352
|
item: {},
|
|
@@ -8372,20 +8372,20 @@ const _sfc_main$Y = /* @__PURE__ */ defineComponent({
|
|
|
8372
8372
|
key: 0,
|
|
8373
8373
|
class: [className.value, "lupa-search-box-product-custom"],
|
|
8374
8374
|
innerHTML: text.value
|
|
8375
|
-
}, 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({
|
|
8376
8376
|
key: 1,
|
|
8377
8377
|
class: [className.value, "lupa-search-box-product-custom"]
|
|
8378
8378
|
}, toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), [
|
|
8379
|
-
!label.value ? (openBlock(), createElementBlock("div", _hoisted_2$
|
|
8380
|
-
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),
|
|
8381
8381
|
createBaseVNode("div", _hoisted_5$a, toDisplayString(text.value), 1)
|
|
8382
8382
|
]))
|
|
8383
8383
|
], 16));
|
|
8384
8384
|
};
|
|
8385
8385
|
}
|
|
8386
8386
|
});
|
|
8387
|
-
const _hoisted_1$
|
|
8388
|
-
const _sfc_main$
|
|
8387
|
+
const _hoisted_1$T = ["innerHTML"];
|
|
8388
|
+
const _sfc_main$Y = /* @__PURE__ */ defineComponent({
|
|
8389
8389
|
__name: "SearchBoxProductCustomHtml",
|
|
8390
8390
|
props: {
|
|
8391
8391
|
item: {},
|
|
@@ -8405,19 +8405,255 @@ const _sfc_main$X = /* @__PURE__ */ defineComponent({
|
|
|
8405
8405
|
return openBlock(), createElementBlock("div", mergeProps({
|
|
8406
8406
|
class: className.value,
|
|
8407
8407
|
innerHTML: text.value
|
|
8408
|
-
}, toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), null, 16, _hoisted_1$
|
|
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 }) {
|
|
8615
|
+
const props = __props;
|
|
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
|
+
});
|
|
8626
|
+
const handleClick = () => __async(this, null, function* () {
|
|
8627
|
+
loading.value = true;
|
|
8628
|
+
yield props.options.action(props.item, addToCartAmount.value);
|
|
8629
|
+
emit2("productEvent", { type: "addToCart" });
|
|
8630
|
+
loading.value = false;
|
|
8631
|
+
});
|
|
8632
|
+
return (_ctx, _cache) => {
|
|
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
|
+
]);
|
|
8409
8644
|
};
|
|
8410
8645
|
}
|
|
8411
8646
|
});
|
|
8412
8647
|
const __default__$4 = {
|
|
8413
8648
|
components: {
|
|
8414
|
-
SearchBoxProductImage: _sfc_main$
|
|
8415
|
-
SearchBoxProductTitle: _sfc_main$
|
|
8416
|
-
SearchBoxProductDescription: _sfc_main
|
|
8417
|
-
SearchBoxProductPrice: _sfc_main
|
|
8418
|
-
SearchBoxProductRegularPrice: _sfc_main$
|
|
8419
|
-
SearchBoxProductCustom: _sfc_main$
|
|
8420
|
-
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
|
|
8421
8657
|
}
|
|
8422
8658
|
};
|
|
8423
8659
|
const _sfc_main$W = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValues2({}, __default__$4), {
|
|
@@ -8425,7 +8661,8 @@ const _sfc_main$W = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
|
|
|
8425
8661
|
props: {
|
|
8426
8662
|
item: {},
|
|
8427
8663
|
element: {},
|
|
8428
|
-
labels: {}
|
|
8664
|
+
labels: {},
|
|
8665
|
+
isInStock: { type: Boolean }
|
|
8429
8666
|
},
|
|
8430
8667
|
setup(__props) {
|
|
8431
8668
|
const props = __props;
|
|
@@ -8447,6 +8684,8 @@ const _sfc_main$W = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
|
|
|
8447
8684
|
return "search-box-product-custom";
|
|
8448
8685
|
case DocumentElementType.CUSTOM_HTML:
|
|
8449
8686
|
return "search-box-product-custom-html";
|
|
8687
|
+
case DocumentElementType.ADDTOCART:
|
|
8688
|
+
return "search-box-product-add-to-cart";
|
|
8450
8689
|
}
|
|
8451
8690
|
return "search-box-product-title";
|
|
8452
8691
|
});
|
|
@@ -8470,8 +8709,9 @@ const _sfc_main$W = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
|
|
|
8470
8709
|
item: enhancedItem.value,
|
|
8471
8710
|
options: _ctx.element,
|
|
8472
8711
|
labels: _ctx.labels,
|
|
8473
|
-
class: normalizeClass({ "lupa-loading-dynamic-data": isLoadingDynamicData.value })
|
|
8474
|
-
|
|
8712
|
+
class: normalizeClass({ "lupa-loading-dynamic-data": isLoadingDynamicData.value }),
|
|
8713
|
+
inStock: _ctx.isInStock
|
|
8714
|
+
}, null, 8, ["item", "options", "labels", "class", "inStock"])) : createCommentVNode("", true);
|
|
8475
8715
|
};
|
|
8476
8716
|
}
|
|
8477
8717
|
}));
|
|
@@ -8533,6 +8773,10 @@ const useTrackingStore = defineStore("tracking", () => {
|
|
|
8533
8773
|
const _hoisted_1$R = ["href"];
|
|
8534
8774
|
const _hoisted_2$B = { class: "lupa-search-box-product-image-section" };
|
|
8535
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
|
+
};
|
|
8536
8780
|
const _sfc_main$V = /* @__PURE__ */ defineComponent({
|
|
8537
8781
|
__name: "SearchBoxProduct",
|
|
8538
8782
|
props: {
|
|
@@ -8548,6 +8792,7 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
|
|
|
8548
8792
|
const historyStore = useHistoryStore();
|
|
8549
8793
|
const trackingStore = useTrackingStore();
|
|
8550
8794
|
const optionsStore = useOptionsStore();
|
|
8795
|
+
const isInStock = ref(true);
|
|
8551
8796
|
const { boxRoutingBehavior } = storeToRefs(optionsStore);
|
|
8552
8797
|
const link = computed(() => {
|
|
8553
8798
|
var _a, _b;
|
|
@@ -8559,7 +8804,9 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
|
|
|
8559
8804
|
});
|
|
8560
8805
|
const detailElements = computed(() => {
|
|
8561
8806
|
var _a, _b;
|
|
8562
|
-
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 : [];
|
|
8563
8810
|
});
|
|
8564
8811
|
const id = computed(() => {
|
|
8565
8812
|
if (props.panelOptions.idKey) {
|
|
@@ -8577,6 +8824,10 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
|
|
|
8577
8824
|
});
|
|
8578
8825
|
return title2;
|
|
8579
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
|
+
});
|
|
8580
8831
|
const handleClick = (event) => {
|
|
8581
8832
|
var _a;
|
|
8582
8833
|
if (props.panelOptions.titleKey) {
|
|
@@ -8606,6 +8857,12 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
|
|
|
8606
8857
|
emit2("product-click");
|
|
8607
8858
|
handleRoutingEvent(link.value, event, boxRoutingBehavior.value === "event");
|
|
8608
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
|
+
});
|
|
8609
8866
|
return (_ctx, _cache) => {
|
|
8610
8867
|
return openBlock(), createElementBlock("a", {
|
|
8611
8868
|
class: normalizeClass(["lupa-search-box-product", { "lupa-search-box-product-highlighted": _ctx.highlighted }]),
|
|
@@ -8636,7 +8893,17 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
|
|
|
8636
8893
|
link: link.value
|
|
8637
8894
|
}, null, 8, ["item", "element", "labels", "link"]);
|
|
8638
8895
|
}), 128))
|
|
8639
|
-
])
|
|
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)
|
|
8640
8907
|
], 10, _hoisted_1$R);
|
|
8641
8908
|
};
|
|
8642
8909
|
}
|
|
@@ -8770,7 +9037,7 @@ const _hoisted_3$p = {
|
|
|
8770
9037
|
};
|
|
8771
9038
|
const __default__$3 = {
|
|
8772
9039
|
components: {
|
|
8773
|
-
SearchBoxSuggestionsWrapper: _sfc_main$
|
|
9040
|
+
SearchBoxSuggestionsWrapper: _sfc_main$14,
|
|
8774
9041
|
SearchBoxProductsWrapper: _sfc_main$T
|
|
8775
9042
|
}
|
|
8776
9043
|
};
|
|
@@ -8920,13 +9187,13 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
|
|
|
8920
9187
|
], 10, _hoisted_2$A);
|
|
8921
9188
|
}), 128))
|
|
8922
9189
|
]),
|
|
8923
|
-
createVNode(_sfc_main$
|
|
9190
|
+
createVNode(_sfc_main$19, {
|
|
8924
9191
|
labels: labels.value,
|
|
8925
9192
|
showTotalCount: (_a = _ctx.options.showTotalCount) != null ? _a : false,
|
|
8926
9193
|
onGoToResults: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("go-to-results"))
|
|
8927
9194
|
}, null, 8, ["labels", "showTotalCount"])
|
|
8928
9195
|
], 512)) : displayHistory.value ? (openBlock(), createElementBlock("div", _hoisted_3$p, [
|
|
8929
|
-
createVNode(_sfc_main$
|
|
9196
|
+
createVNode(_sfc_main$17, {
|
|
8930
9197
|
ref: "panel",
|
|
8931
9198
|
options: _ctx.options.history,
|
|
8932
9199
|
history: history.value,
|
|
@@ -9187,7 +9454,7 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({
|
|
|
9187
9454
|
var _a2;
|
|
9188
9455
|
return openBlock(), createElementBlock("div", _hoisted_1$O, [
|
|
9189
9456
|
createBaseVNode("div", _hoisted_2$z, [
|
|
9190
|
-
createVNode(_sfc_main$
|
|
9457
|
+
createVNode(_sfc_main$1a, {
|
|
9191
9458
|
options: inputOptions.value,
|
|
9192
9459
|
suggestedValue: suggestedValue.value,
|
|
9193
9460
|
"can-close": (_a2 = _ctx.isSearchContainer) != null ? _a2 : false,
|
|
@@ -9221,197 +9488,6 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({
|
|
|
9221
9488
|
};
|
|
9222
9489
|
}
|
|
9223
9490
|
});
|
|
9224
|
-
var ResultsLayoutEnum = /* @__PURE__ */ ((ResultsLayoutEnum2) => {
|
|
9225
|
-
ResultsLayoutEnum2["GRID"] = "Grid";
|
|
9226
|
-
ResultsLayoutEnum2["LIST"] = "List";
|
|
9227
|
-
return ResultsLayoutEnum2;
|
|
9228
|
-
})(ResultsLayoutEnum || {});
|
|
9229
|
-
const RESULT_ROOT_ID = "lupa-search-results";
|
|
9230
|
-
const SHADOW_ROOT_ID = "lupa-shadow-id";
|
|
9231
|
-
const CONTAINER_ROOT_ID = "lupa-search-container";
|
|
9232
|
-
const scrollToSearchResults = (timeout = 500) => {
|
|
9233
|
-
if (timeout) {
|
|
9234
|
-
setTimeout(() => scrollTo(RESULT_ROOT_ID), timeout);
|
|
9235
|
-
} else {
|
|
9236
|
-
scrollTo(RESULT_ROOT_ID);
|
|
9237
|
-
}
|
|
9238
|
-
};
|
|
9239
|
-
const scrollTo = (elementId) => {
|
|
9240
|
-
var _a, _b;
|
|
9241
|
-
let el = document.getElementById(elementId);
|
|
9242
|
-
const shadowRoot = (_a = document.getElementById(SHADOW_ROOT_ID)) == null ? void 0 : _a.shadowRoot;
|
|
9243
|
-
if (!el) {
|
|
9244
|
-
el = (_b = shadowRoot == null ? void 0 : shadowRoot.getElementById(elementId)) != null ? _b : null;
|
|
9245
|
-
}
|
|
9246
|
-
if (!el) {
|
|
9247
|
-
return;
|
|
9248
|
-
}
|
|
9249
|
-
const searchContainer2 = shadowRoot ? shadowRoot.getElementById(CONTAINER_ROOT_ID) : void 0;
|
|
9250
|
-
const container = searchContainer2 != null ? searchContainer2 : window;
|
|
9251
|
-
container.scrollTo({
|
|
9252
|
-
top: el.offsetTop,
|
|
9253
|
-
behavior: "smooth"
|
|
9254
|
-
});
|
|
9255
|
-
};
|
|
9256
|
-
const disableBodyScroll = () => {
|
|
9257
|
-
const scrollY = window.scrollY;
|
|
9258
|
-
document.body.style.position = "fixed";
|
|
9259
|
-
document.body.style.top = `-${scrollY}px`;
|
|
9260
|
-
};
|
|
9261
|
-
const enableBodyScroll = () => {
|
|
9262
|
-
const scrollY = document.body.style.top;
|
|
9263
|
-
document.body.style.position = "";
|
|
9264
|
-
document.body.style.top = "";
|
|
9265
|
-
window.scrollTo(0, parseInt(scrollY || "0") * -1);
|
|
9266
|
-
};
|
|
9267
|
-
const setDocumentTitle = (template, textToInsert = "") => {
|
|
9268
|
-
document.title = addParamsToLabel(template, textToInsert);
|
|
9269
|
-
};
|
|
9270
|
-
const useSearchResultStore = defineStore("searchResult", () => {
|
|
9271
|
-
const searchResult = ref({});
|
|
9272
|
-
const columnCount = ref(2);
|
|
9273
|
-
const addToCartAmount = ref(1);
|
|
9274
|
-
const layout = ref(ResultsLayoutEnum.GRID);
|
|
9275
|
-
const loading = ref(false);
|
|
9276
|
-
const isMobileSidebarVisible = ref(false);
|
|
9277
|
-
const optionsStore = useOptionsStore();
|
|
9278
|
-
const paramsStore = useParamsStore();
|
|
9279
|
-
const facets = computed(() => searchResult.value.facets);
|
|
9280
|
-
const filters = computed(() => searchResult.value.filters);
|
|
9281
|
-
const currentQueryText = computed(() => searchResult.value.searchText);
|
|
9282
|
-
const totalItems = computed(() => searchResult.value.total);
|
|
9283
|
-
const hasResults = computed(() => totalItems.value > 0);
|
|
9284
|
-
const labeledFilters = computed(
|
|
9285
|
-
() => getLabeledFilters(unfoldFilters(filters.value), facets.value)
|
|
9286
|
-
);
|
|
9287
|
-
const displayFilters = computed(() => {
|
|
9288
|
-
var _a, _b;
|
|
9289
|
-
const initialFilters = optionsStore.initialFilters;
|
|
9290
|
-
return (_b = (_a = labeledFilters.value) == null ? void 0 : _a.filter((f2) => !(initialFilters == null ? void 0 : initialFilters[f2.key]))) != null ? _b : [];
|
|
9291
|
-
});
|
|
9292
|
-
const currentFilterCount = computed(() => {
|
|
9293
|
-
var _a, _b;
|
|
9294
|
-
return (_b = (_a = displayFilters.value) == null ? void 0 : _a.length) != null ? _b : 0;
|
|
9295
|
-
});
|
|
9296
|
-
const currentFilterKeys = computed(() => {
|
|
9297
|
-
var _a;
|
|
9298
|
-
return Object.keys((_a = filters.value) != null ? _a : {});
|
|
9299
|
-
});
|
|
9300
|
-
const hasAnyFilter = computed(() => {
|
|
9301
|
-
var _a;
|
|
9302
|
-
return Object.keys((_a = filters.value) != null ? _a : {}).length > 0;
|
|
9303
|
-
});
|
|
9304
|
-
const itemRange = computed(() => {
|
|
9305
|
-
var _a, _b;
|
|
9306
|
-
const limit = (_a = paramsStore.limit) != null ? _a : 0;
|
|
9307
|
-
const offset = (_b = searchResult.value.offset) != null ? _b : 0;
|
|
9308
|
-
return [offset + 1, Math.min(offset + limit, totalItems.value)];
|
|
9309
|
-
});
|
|
9310
|
-
const isPageEmpty = computed(
|
|
9311
|
-
() => {
|
|
9312
|
-
var _a;
|
|
9313
|
-
return hasResults.value && ((_a = searchResult.value.offset) != null ? _a : 0) >= totalItems.value;
|
|
9314
|
-
}
|
|
9315
|
-
);
|
|
9316
|
-
const setSidebarState = ({ visible }) => {
|
|
9317
|
-
if (visible) {
|
|
9318
|
-
disableBodyScroll();
|
|
9319
|
-
} else {
|
|
9320
|
-
enableBodyScroll();
|
|
9321
|
-
}
|
|
9322
|
-
isMobileSidebarVisible.value = visible;
|
|
9323
|
-
};
|
|
9324
|
-
const queryFacet = (_0) => __async(void 0, [_0], function* ({ queryKey, facetKey }) {
|
|
9325
|
-
var _a, _b, _c, _d;
|
|
9326
|
-
const query = { searchText: "", filters: __spreadValues2({}, filters.value) };
|
|
9327
|
-
const options = (_a = optionsStore.envOptions) != null ? _a : { environment: "production" };
|
|
9328
|
-
const result = yield LupaSearchSdk.query(queryKey, query, options);
|
|
9329
|
-
if (!result.success) {
|
|
9330
|
-
return;
|
|
9331
|
-
}
|
|
9332
|
-
const facet = (_b = result.facets) == null ? void 0 : _b.find((f2) => f2.key === facetKey);
|
|
9333
|
-
const facetItems = (_c = facet == null ? void 0 : facet.items) != null ? _c : [];
|
|
9334
|
-
const updatedResult = __spreadProps2(__spreadValues2({}, searchResult.value), {
|
|
9335
|
-
facets: (_d = facets.value) == null ? void 0 : _d.map((f2) => f2.key === facetKey ? __spreadProps2(__spreadValues2({}, f2), { items: facetItems }) : f2)
|
|
9336
|
-
});
|
|
9337
|
-
searchResult.value = updatedResult;
|
|
9338
|
-
});
|
|
9339
|
-
const add2 = (newSearchResult) => {
|
|
9340
|
-
var _a, _b;
|
|
9341
|
-
if (!newSearchResult) {
|
|
9342
|
-
return {
|
|
9343
|
-
searchResult: searchResult.value,
|
|
9344
|
-
pageSize: searchResult.value.limit || 0
|
|
9345
|
-
};
|
|
9346
|
-
}
|
|
9347
|
-
if (typeof document !== "undefined") {
|
|
9348
|
-
setDocumentTitle(
|
|
9349
|
-
(_b = (_a = optionsStore.searchResultOptions) == null ? void 0 : _a.labels) == null ? void 0 : _b.htmlTitleTemplate,
|
|
9350
|
-
newSearchResult.searchText
|
|
9351
|
-
);
|
|
9352
|
-
}
|
|
9353
|
-
searchResult.value = newSearchResult;
|
|
9354
|
-
return { searchResult: newSearchResult };
|
|
9355
|
-
};
|
|
9356
|
-
const setColumnCount = ({ width, grid }) => {
|
|
9357
|
-
if (!width || !grid) {
|
|
9358
|
-
return;
|
|
9359
|
-
}
|
|
9360
|
-
if (width <= S_MIN_WIDTH) {
|
|
9361
|
-
columnCount.value = grid.columns.xs;
|
|
9362
|
-
} else if (width > S_MIN_WIDTH && width <= MD_MIN_WIDTH) {
|
|
9363
|
-
columnCount.value = grid.columns.sm;
|
|
9364
|
-
} else if (width > MD_MIN_WIDTH && width <= L_MIN_WIDTH) {
|
|
9365
|
-
columnCount.value = grid.columns.md;
|
|
9366
|
-
} else if (width > L_MIN_WIDTH && width <= XL_MIN_WIDTH) {
|
|
9367
|
-
columnCount.value = grid.columns.l;
|
|
9368
|
-
} else {
|
|
9369
|
-
columnCount.value = grid.columns.xl;
|
|
9370
|
-
}
|
|
9371
|
-
};
|
|
9372
|
-
const setAddToCartAmount = (newAddToCartAmount) => {
|
|
9373
|
-
if (!newAddToCartAmount) {
|
|
9374
|
-
return;
|
|
9375
|
-
}
|
|
9376
|
-
addToCartAmount.value = newAddToCartAmount;
|
|
9377
|
-
};
|
|
9378
|
-
const setLayout = (newLayout) => {
|
|
9379
|
-
if (!newLayout) {
|
|
9380
|
-
return;
|
|
9381
|
-
}
|
|
9382
|
-
layout.value = newLayout;
|
|
9383
|
-
};
|
|
9384
|
-
const setLoading = (state) => {
|
|
9385
|
-
loading.value = state || false;
|
|
9386
|
-
};
|
|
9387
|
-
return {
|
|
9388
|
-
isMobileSidebarVisible,
|
|
9389
|
-
searchResult,
|
|
9390
|
-
columnCount,
|
|
9391
|
-
addToCartAmount,
|
|
9392
|
-
facets,
|
|
9393
|
-
filters,
|
|
9394
|
-
loading,
|
|
9395
|
-
layout,
|
|
9396
|
-
currentQueryText,
|
|
9397
|
-
totalItems,
|
|
9398
|
-
hasResults,
|
|
9399
|
-
labeledFilters,
|
|
9400
|
-
displayFilters,
|
|
9401
|
-
currentFilterCount,
|
|
9402
|
-
currentFilterKeys,
|
|
9403
|
-
hasAnyFilter,
|
|
9404
|
-
itemRange,
|
|
9405
|
-
isPageEmpty,
|
|
9406
|
-
setSidebarState,
|
|
9407
|
-
queryFacet,
|
|
9408
|
-
add: add2,
|
|
9409
|
-
setColumnCount,
|
|
9410
|
-
setAddToCartAmount,
|
|
9411
|
-
setLayout,
|
|
9412
|
-
setLoading
|
|
9413
|
-
};
|
|
9414
|
-
});
|
|
9415
9491
|
const createPublicQuery = (queryParams, sortOptions, defaultPageSize) => {
|
|
9416
9492
|
var _a;
|
|
9417
9493
|
const publicQuery = {};
|
|
@@ -12561,7 +12637,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
12561
12637
|
},
|
|
12562
12638
|
setup(__props) {
|
|
12563
12639
|
return (_ctx, _cache) => {
|
|
12564
|
-
return openBlock(), createBlock(_sfc_main$
|
|
12640
|
+
return openBlock(), createBlock(_sfc_main$13, {
|
|
12565
12641
|
item: _ctx.item,
|
|
12566
12642
|
options: _ctx.options,
|
|
12567
12643
|
"wrapper-class": "lupa-search-results-image-wrapper",
|
|
@@ -20379,7 +20455,7 @@ const _hoisted_2 = {
|
|
|
20379
20455
|
class: "lupa-recommended-products",
|
|
20380
20456
|
"data-cy": "lupa-recommended-products"
|
|
20381
20457
|
};
|
|
20382
|
-
const _sfc_main$
|
|
20458
|
+
const _sfc_main$1b = /* @__PURE__ */ defineComponent({
|
|
20383
20459
|
__name: "Recommendations",
|
|
20384
20460
|
props: {
|
|
20385
20461
|
options: {}
|
|
@@ -26312,7 +26388,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
26312
26388
|
};
|
|
26313
26389
|
__expose({ fetch: fetch2 });
|
|
26314
26390
|
return (_ctx, _cache) => {
|
|
26315
|
-
return openBlock(), createBlock(unref(_sfc_main$
|
|
26391
|
+
return openBlock(), createBlock(unref(_sfc_main$1b), {
|
|
26316
26392
|
options: _ctx.recommendationOptions,
|
|
26317
26393
|
ref_key: "productRecommendations",
|
|
26318
26394
|
ref: productRecommendations
|