@getlupa/vue 0.21.0 → 0.21.2
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.js +103 -29
- package/dist/lupaSearch.mjs +103 -29
- package/dist/stores/options.d.ts +4 -1
- package/dist/types/DocumentElement.d.ts +1 -4
- package/dist/types/search-box/SearchBoxOptions.d.ts +5 -0
- package/dist/types/search-results/SearchResultsOptions.d.ts +9 -0
- package/dist/utils/filter.toggle.utils.d.ts +2 -2
- package/package.json +1 -1
package/dist/lupaSearch.js
CHANGED
|
@@ -11832,6 +11832,10 @@ const useOptionsStore = /* @__PURE__ */ defineStore("options", () => {
|
|
|
11832
11832
|
return (_b25 = (_a25 = currentResolutionPageSizes.value) == null ? void 0 : _a25[0]) != null ? _b25 : DEFAULT_PAGE_SIZE;
|
|
11833
11833
|
}
|
|
11834
11834
|
);
|
|
11835
|
+
const ariaLabels = vue.computed(() => {
|
|
11836
|
+
var _a25, _b25;
|
|
11837
|
+
return (_b25 = (_a25 = searchResultOptions.value.labels) == null ? void 0 : _a25.aria) != null ? _b25 : {};
|
|
11838
|
+
});
|
|
11835
11839
|
const currentResolutionPageSizes = vue.computed(() => {
|
|
11836
11840
|
var _a25, _b25, _c, _d;
|
|
11837
11841
|
const pageSizes = (_d = (_c = (_b25 = (_a25 = searchResultOptions.value) == null ? void 0 : _a25.pagination) == null ? void 0 : _b25.sizeSelection) == null ? void 0 : _c.sizes) != null ? _d : DEFAULT_PAGE_SIZE_SELECTION;
|
|
@@ -11887,6 +11891,7 @@ const useOptionsStore = /* @__PURE__ */ defineStore("options", () => {
|
|
|
11887
11891
|
defaultSearchResultPageSize,
|
|
11888
11892
|
currentResolutionPageSizes,
|
|
11889
11893
|
productRecommendationOptions,
|
|
11894
|
+
ariaLabels,
|
|
11890
11895
|
setSearchBoxOptions,
|
|
11891
11896
|
setTrackingOptions,
|
|
11892
11897
|
setSearchResultOptions,
|
|
@@ -12370,13 +12375,13 @@ const unfoldRangeFilter = (key, filter, price = {}) => {
|
|
|
12370
12375
|
}
|
|
12371
12376
|
];
|
|
12372
12377
|
}
|
|
12373
|
-
return [{ key, value: `${gt} - ${lt}`, type: "range" }];
|
|
12378
|
+
return [{ key, value: `${gt != null ? gt : "*"} - ${lt != null ? lt : "*"}`, type: "range" }];
|
|
12374
12379
|
};
|
|
12375
12380
|
const unfoldFilter = (key, filter, price = {}) => {
|
|
12376
12381
|
if (Array.isArray(filter)) {
|
|
12377
12382
|
return unfoldTermFilter(key, filter);
|
|
12378
12383
|
}
|
|
12379
|
-
if (filter.gte) {
|
|
12384
|
+
if (filter.gte || filter.lte || filter.gt || filter.lt) {
|
|
12380
12385
|
return unfoldRangeFilter(key, filter, price);
|
|
12381
12386
|
}
|
|
12382
12387
|
if (filter.terms) {
|
|
@@ -12429,8 +12434,9 @@ const recursiveFilterItem = (item, query = "") => {
|
|
|
12429
12434
|
}) : void 0;
|
|
12430
12435
|
};
|
|
12431
12436
|
const rangeFilterToString = (rangeFilter, separator) => {
|
|
12437
|
+
var _a25, _b25, _c;
|
|
12432
12438
|
separator = separator || FACET_TERM_RANGE_SEPARATOR;
|
|
12433
|
-
return rangeFilter && Object.keys(rangeFilter).length ? rangeFilter.gte + separator + (rangeFilter.lte || rangeFilter.lt) : "";
|
|
12439
|
+
return rangeFilter && Object.keys(rangeFilter).length ? ((_a25 = rangeFilter.gte) != null ? _a25 : "") + separator + (((_b25 = rangeFilter.lte) != null ? _b25 : "") || ((_c = rangeFilter.lt) != null ? _c : "")) : "";
|
|
12434
12440
|
};
|
|
12435
12441
|
const pick = (obj, keys) => {
|
|
12436
12442
|
const ret = /* @__PURE__ */ Object.create({});
|
|
@@ -12489,14 +12495,15 @@ const parseFacetKey = (key, searchParams) => {
|
|
|
12489
12495
|
return (_b25 = (_a25 = searchParams.getAll(key)) == null ? void 0 : _a25.map((v) => decodeURIComponent(v))) != null ? _b25 : [];
|
|
12490
12496
|
}
|
|
12491
12497
|
if (key.startsWith(FACET_PARAMS_TYPE.RANGE)) {
|
|
12498
|
+
const isPrice = key == null ? void 0 : key.includes(CURRENCY_KEY_INDICATOR);
|
|
12492
12499
|
const range2 = searchParams.get(key);
|
|
12493
12500
|
if (!range2) {
|
|
12494
12501
|
return {};
|
|
12495
12502
|
}
|
|
12496
12503
|
const [min, max] = range2.split(FACET_RANGE_SEPARATOR);
|
|
12497
12504
|
return {
|
|
12498
|
-
gte: min,
|
|
12499
|
-
lte: max
|
|
12505
|
+
gte: min || void 0,
|
|
12506
|
+
[isPrice ? "lte" : "lt"]: max || void 0
|
|
12500
12507
|
};
|
|
12501
12508
|
}
|
|
12502
12509
|
if (key.startsWith(FACET_PARAMS_TYPE.HIERARCHY)) {
|
|
@@ -12696,16 +12703,27 @@ const toggleHierarchyFilter = (appendParams, facetAction, getQueryParamName, cur
|
|
|
12696
12703
|
paramsToRemove: [getQueryParamName ? getQueryParamName(QUERY_PARAMS.PAGE) : QUERY_PARAMS.PAGE]
|
|
12697
12704
|
});
|
|
12698
12705
|
};
|
|
12699
|
-
const toggleRangeFilter = (appendParams, facetAction, getQueryParamName, currentFilters) => {
|
|
12706
|
+
const toggleRangeFilter = (appendParams, removeParameters, facetAction, getQueryParamName, currentFilters) => {
|
|
12707
|
+
var _a25, _b25;
|
|
12700
12708
|
const currentFilter = rangeFilterToString(
|
|
12701
12709
|
currentFilters == null ? void 0 : currentFilters[facetAction.key],
|
|
12702
12710
|
FACET_RANGE_SEPARATOR
|
|
12703
12711
|
);
|
|
12704
|
-
let facetValue = facetAction.value.join(FACET_RANGE_SEPARATOR);
|
|
12712
|
+
let facetValue = (_b25 = (_a25 = facetAction == null ? void 0 : facetAction.value) == null ? void 0 : _a25.join(FACET_RANGE_SEPARATOR)) != null ? _b25 : "";
|
|
12705
12713
|
facetValue = currentFilter === facetValue ? "" : facetValue;
|
|
12714
|
+
const paramsToRemove = getQueryParamName ? [getQueryParamName(QUERY_PARAMS.PAGE)] : [QUERY_PARAMS.PAGE];
|
|
12715
|
+
if (!facetValue) {
|
|
12716
|
+
removeParameters({
|
|
12717
|
+
paramsToRemove: [
|
|
12718
|
+
getFacetParam(facetAction.key, "", FACET_PARAMS_TYPE.RANGE).name,
|
|
12719
|
+
...paramsToRemove
|
|
12720
|
+
]
|
|
12721
|
+
});
|
|
12722
|
+
return;
|
|
12723
|
+
}
|
|
12706
12724
|
appendParams({
|
|
12707
12725
|
params: [getFacetParam(facetAction.key, facetValue, FACET_PARAMS_TYPE.RANGE)],
|
|
12708
|
-
paramsToRemove
|
|
12726
|
+
paramsToRemove,
|
|
12709
12727
|
encode: false
|
|
12710
12728
|
});
|
|
12711
12729
|
};
|
|
@@ -13499,6 +13517,7 @@ const _hoisted_1$1l = {
|
|
|
13499
13517
|
const _hoisted_2$W = { class: "lupa-dialog-content" };
|
|
13500
13518
|
const _hoisted_3$E = { class: "lupa-listening-text" };
|
|
13501
13519
|
const _hoisted_4$u = { class: "lupa-mic-button-wrapper" };
|
|
13520
|
+
const _hoisted_5$l = ["aria-label"];
|
|
13502
13521
|
const _sfc_main$1z = /* @__PURE__ */ vue.defineComponent({
|
|
13503
13522
|
__name: "VoiceSearchDialog",
|
|
13504
13523
|
props: {
|
|
@@ -13602,6 +13621,7 @@ const _sfc_main$1z = /* @__PURE__ */ vue.defineComponent({
|
|
|
13602
13621
|
reset: dialogReset
|
|
13603
13622
|
});
|
|
13604
13623
|
return (_ctx, _cache) => {
|
|
13624
|
+
var _a25, _b25;
|
|
13605
13625
|
return vue.openBlock(), vue.createElementBlock("div", null, [
|
|
13606
13626
|
props.isOpen ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1l, [
|
|
13607
13627
|
vue.createElementVNode("button", {
|
|
@@ -13613,8 +13633,10 @@ const _sfc_main$1z = /* @__PURE__ */ vue.defineComponent({
|
|
|
13613
13633
|
vue.createElementVNode("div", _hoisted_4$u, [
|
|
13614
13634
|
vue.createElementVNode("button", {
|
|
13615
13635
|
class: vue.normalizeClass(["lupa-mic-button", { recording: vue.unref(isRecording) }]),
|
|
13616
|
-
onClick: handleRecordingButtonClick
|
|
13617
|
-
|
|
13636
|
+
onClick: handleRecordingButtonClick,
|
|
13637
|
+
"aria-controls": "voice-search-microphone",
|
|
13638
|
+
"aria-label": ((_b25 = (_a25 = labels.value) == null ? void 0 : _a25.aria) == null ? void 0 : _b25.microphone) || "Toggle microphone"
|
|
13639
|
+
}, null, 10, _hoisted_5$l),
|
|
13618
13640
|
vue.createVNode(_sfc_main$1A, {
|
|
13619
13641
|
ref_key: "voiceSearchProgressBar",
|
|
13620
13642
|
ref: voiceSearchProgressBar,
|
|
@@ -13640,6 +13662,7 @@ const _hoisted_6$8 = {
|
|
|
13640
13662
|
class: "lupa-close-label"
|
|
13641
13663
|
};
|
|
13642
13664
|
const _hoisted_7$5 = { key: 1 };
|
|
13665
|
+
const _hoisted_8$3 = ["aria-label"];
|
|
13643
13666
|
const _sfc_main$1y = /* @__PURE__ */ vue.defineComponent({
|
|
13644
13667
|
__name: "SearchBoxInput",
|
|
13645
13668
|
props: {
|
|
@@ -13695,6 +13718,10 @@ const _sfc_main$1y = /* @__PURE__ */ vue.defineComponent({
|
|
|
13695
13718
|
var _a25;
|
|
13696
13719
|
return (_a25 = labels.value.searchInputAriaLabel) != null ? _a25 : "Search input";
|
|
13697
13720
|
});
|
|
13721
|
+
const voiceSearchAriaLabel = vue.computed(() => {
|
|
13722
|
+
var _a25, _b25, _c, _d;
|
|
13723
|
+
return (_d = (_c = (_b25 = (_a25 = props.options.voiceSearch) == null ? void 0 : _a25.labels) == null ? void 0 : _b25.aria) == null ? void 0 : _c.openDialog) != null ? _d : "Open voice search dialog";
|
|
13724
|
+
});
|
|
13698
13725
|
vue.onMounted(() => {
|
|
13699
13726
|
document.addEventListener("click", handleClickOutsideVoiceDialogOverlay);
|
|
13700
13727
|
});
|
|
@@ -13815,8 +13842,11 @@ const _sfc_main$1y = /* @__PURE__ */ vue.defineComponent({
|
|
|
13815
13842
|
isVoiceSearchEnabled.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7$5, [
|
|
13816
13843
|
vue.createElementVNode("button", {
|
|
13817
13844
|
onClick: openVoiceSearchDialog,
|
|
13818
|
-
class: "lupa-voice-search-button"
|
|
13819
|
-
|
|
13845
|
+
class: "lupa-voice-search-button",
|
|
13846
|
+
"aria-haspopup": "dialog",
|
|
13847
|
+
"aria-controls": "voice-search-dialog",
|
|
13848
|
+
"aria-label": voiceSearchAriaLabel.value
|
|
13849
|
+
}, null, 8, _hoisted_8$3)
|
|
13820
13850
|
])) : vue.createCommentVNode("", true),
|
|
13821
13851
|
isVoiceSearchEnabled.value ? (vue.openBlock(), vue.createBlock(_sfc_main$1z, {
|
|
13822
13852
|
key: 2,
|
|
@@ -24279,6 +24309,13 @@ const _sfc_main$1i = /* @__PURE__ */ vue.defineComponent({
|
|
|
24279
24309
|
const { addToCartAmount } = storeToRefs(searchResultStore);
|
|
24280
24310
|
const emit = __emit;
|
|
24281
24311
|
const loading = vue.ref(false);
|
|
24312
|
+
const addToCartButtonClass = vue.computed(() => {
|
|
24313
|
+
return {
|
|
24314
|
+
[props.options.className]: Boolean(props.options.className),
|
|
24315
|
+
"lupa-add-to-cart-loading": loading.value,
|
|
24316
|
+
"lupa-add-to-cart": !loading.value
|
|
24317
|
+
};
|
|
24318
|
+
});
|
|
24282
24319
|
const label = vue.computed(() => {
|
|
24283
24320
|
return props.options.labels.addToCart;
|
|
24284
24321
|
});
|
|
@@ -24302,7 +24339,7 @@ const _sfc_main$1i = /* @__PURE__ */ vue.defineComponent({
|
|
|
24302
24339
|
vue.createElementVNode("div", _hoisted_2$O, [
|
|
24303
24340
|
hasLink.value ? (vue.openBlock(), vue.createElementBlock("button", vue.mergeProps({
|
|
24304
24341
|
key: 0,
|
|
24305
|
-
class:
|
|
24342
|
+
class: addToCartButtonClass.value,
|
|
24306
24343
|
"data-cy": "lupa-add-to-cart",
|
|
24307
24344
|
disabled: !inStockValue.value || loading.value
|
|
24308
24345
|
}, _ctx.dynamicAttributes, { onClick: handleClick }), [
|
|
@@ -24310,7 +24347,7 @@ const _sfc_main$1i = /* @__PURE__ */ vue.defineComponent({
|
|
|
24310
24347
|
], 16, _hoisted_3$A)) : (vue.openBlock(), vue.createElementBlock("button", vue.mergeProps({
|
|
24311
24348
|
key: 1,
|
|
24312
24349
|
onClick: vue.withModifiers(handleClick, ["stop", "prevent"]),
|
|
24313
|
-
class:
|
|
24350
|
+
class: addToCartButtonClass.value,
|
|
24314
24351
|
"data-cy": "lupa-add-to-cart",
|
|
24315
24352
|
type: "button",
|
|
24316
24353
|
disabled: !inStockValue.value || loading.value
|
|
@@ -26732,7 +26769,7 @@ const _sfc_main$X = /* @__PURE__ */ vue.defineComponent({
|
|
|
26732
26769
|
});
|
|
26733
26770
|
const handleFacetClick = (item) => {
|
|
26734
26771
|
var _a25;
|
|
26735
|
-
const value = isRange.value ? item.
|
|
26772
|
+
const value = isRange.value ? [item.from, item.to] : (_a25 = item.title) == null ? void 0 : _a25.toString();
|
|
26736
26773
|
emit("select", {
|
|
26737
26774
|
key: facet.value.key,
|
|
26738
26775
|
value,
|
|
@@ -26746,7 +26783,11 @@ const _sfc_main$X = /* @__PURE__ */ vue.defineComponent({
|
|
|
26746
26783
|
var _a25, _b25;
|
|
26747
26784
|
let selectedItems = (_a25 = currentFiltersValue.value) != null ? _a25 : [];
|
|
26748
26785
|
selectedItems = isRange.value && selectedItems ? [rangeFilterToString(selectedItems)] : selectedItems;
|
|
26749
|
-
|
|
26786
|
+
if (isRange.value) {
|
|
26787
|
+
return selectedItems == null ? void 0 : selectedItems.includes(rangeFilterToString({ gte: item.from, lt: item.to }));
|
|
26788
|
+
} else {
|
|
26789
|
+
return selectedItems == null ? void 0 : selectedItems.includes((_b25 = item.title) == null ? void 0 : _b25.toString());
|
|
26790
|
+
}
|
|
26750
26791
|
};
|
|
26751
26792
|
const getItemLabel = (item) => {
|
|
26752
26793
|
var _a25;
|
|
@@ -28185,12 +28226,12 @@ const _sfc_main$U = /* @__PURE__ */ vue.defineComponent({
|
|
|
28185
28226
|
}), 128)),
|
|
28186
28227
|
itemLimit.value < filteredValues.value.length ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
28187
28228
|
key: 1,
|
|
28188
|
-
class:
|
|
28229
|
+
class: "lupa-facet-term lupa-show-more-facet-results",
|
|
28189
28230
|
"data-cy": "lupa-facet-term",
|
|
28190
28231
|
onClick: handleShowAll
|
|
28191
|
-
}, vue.toDisplayString(_ctx.options.labels.showAll),
|
|
28232
|
+
}, vue.toDisplayString(_ctx.options.labels.showAll), 1)) : showAll.value ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
28192
28233
|
key: 2,
|
|
28193
|
-
class: "lupa-facet-term lupa-show-more-facet-results",
|
|
28234
|
+
class: "lupa-facet-term lupa-show-more-facet-results lupa-show-less-facet-results",
|
|
28194
28235
|
onClick: handleCancelShowAll
|
|
28195
28236
|
}, vue.toDisplayString(_ctx.options.labels.showLess), 1)) : vue.createCommentVNode("", true)
|
|
28196
28237
|
]);
|
|
@@ -28220,7 +28261,7 @@ const _sfc_main$T = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadVa
|
|
|
28220
28261
|
},
|
|
28221
28262
|
emits: ["select", "clear"],
|
|
28222
28263
|
setup(__props, { emit: __emit }) {
|
|
28223
|
-
var _a25, _b25;
|
|
28264
|
+
var _a25, _b25, _c;
|
|
28224
28265
|
const props = __props;
|
|
28225
28266
|
const facet = vue.computed(() => {
|
|
28226
28267
|
var _a26;
|
|
@@ -28232,10 +28273,19 @@ const _sfc_main$T = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadVa
|
|
|
28232
28273
|
});
|
|
28233
28274
|
const searchResultStore = useSearchResultStore();
|
|
28234
28275
|
const optionsStore = useOptionsStore();
|
|
28276
|
+
const screenStore = useScreenStore();
|
|
28235
28277
|
const { currentFilterKeys } = storeToRefs(searchResultStore);
|
|
28236
28278
|
const { searchResultOptions } = storeToRefs(optionsStore);
|
|
28279
|
+
const { isMobileWidth } = storeToRefs(screenStore);
|
|
28237
28280
|
const emit = __emit;
|
|
28238
|
-
const
|
|
28281
|
+
const allExpanded = vue.computed(() => {
|
|
28282
|
+
var _a26, _b26, _c2, _d, _e, _f;
|
|
28283
|
+
if (isMobileWidth.value) {
|
|
28284
|
+
return (_c2 = (_b26 = (_a26 = props.options) == null ? void 0 : _a26.expandAll) == null ? void 0 : _b26.mobile) != null ? _c2 : false;
|
|
28285
|
+
}
|
|
28286
|
+
return (_f = (_e = (_d = props.options) == null ? void 0 : _d.expandAll) == null ? void 0 : _e.desktop) != null ? _f : false;
|
|
28287
|
+
});
|
|
28288
|
+
const isOpen = vue.ref((_c = ((_b25 = (_a25 = props.options) == null ? void 0 : _a25.expand) == null ? void 0 : _b25.includes(props.facet.key)) || allExpanded.value) != null ? _c : false);
|
|
28239
28289
|
const facetPanel = vue.ref(null);
|
|
28240
28290
|
const facetType = vue.computed(() => {
|
|
28241
28291
|
switch (facet.value.type) {
|
|
@@ -28498,6 +28548,7 @@ const _sfc_main$Q = /* @__PURE__ */ vue.defineComponent({
|
|
|
28498
28548
|
case "range":
|
|
28499
28549
|
toggleRangeFilter(
|
|
28500
28550
|
paramStore.appendParams,
|
|
28551
|
+
paramStore.removeParameters,
|
|
28501
28552
|
facetAction,
|
|
28502
28553
|
optionsStore.getQueryParamName,
|
|
28503
28554
|
filters.value
|
|
@@ -29028,7 +29079,10 @@ const _hoisted_1$C = {
|
|
|
29028
29079
|
"data-cy": "lupa-search-results-page-size"
|
|
29029
29080
|
};
|
|
29030
29081
|
const _hoisted_2$t = { id: "lupa-select" };
|
|
29031
|
-
const _hoisted_3$l = {
|
|
29082
|
+
const _hoisted_3$l = {
|
|
29083
|
+
class: "lupa-select-label",
|
|
29084
|
+
for: "lupa-page-size-select-dropdown"
|
|
29085
|
+
};
|
|
29032
29086
|
const _hoisted_4$d = ["aria-label"];
|
|
29033
29087
|
const _hoisted_5$a = ["value"];
|
|
29034
29088
|
const _sfc_main$H = /* @__PURE__ */ vue.defineComponent({
|
|
@@ -29041,6 +29095,7 @@ const _sfc_main$H = /* @__PURE__ */ vue.defineComponent({
|
|
|
29041
29095
|
const props = __props;
|
|
29042
29096
|
const paramsStore = useParamsStore();
|
|
29043
29097
|
const optionsStore = useOptionsStore();
|
|
29098
|
+
const { ariaLabels } = storeToRefs(optionsStore);
|
|
29044
29099
|
const select = vue.ref(null);
|
|
29045
29100
|
const prefixLabel = vue.computed(() => {
|
|
29046
29101
|
var _a25, _b25;
|
|
@@ -29059,12 +29114,14 @@ const _sfc_main$H = /* @__PURE__ */ vue.defineComponent({
|
|
|
29059
29114
|
});
|
|
29060
29115
|
};
|
|
29061
29116
|
return (_ctx, _cache) => {
|
|
29117
|
+
var _a25, _b25, _c;
|
|
29062
29118
|
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$C, [
|
|
29063
29119
|
vue.createElementVNode("div", _hoisted_2$t, [
|
|
29064
29120
|
vue.createElementVNode("label", _hoisted_3$l, vue.toDisplayString(label.value), 1),
|
|
29065
29121
|
vue.createElementVNode("select", {
|
|
29122
|
+
id: "lupa-page-size-select-dropdown",
|
|
29066
29123
|
class: "lupa-select-dropdown",
|
|
29067
|
-
"aria-label": label.value,
|
|
29124
|
+
"aria-label": (_c = (_b25 = (_a25 = vue.unref(ariaLabels)) == null ? void 0 : _a25.pageSizeSelect) != null ? _b25 : label.value) != null ? _c : "Select page size",
|
|
29068
29125
|
"data-cy": "lupa-page-size-select-dropdown",
|
|
29069
29126
|
onChange: handleSelect,
|
|
29070
29127
|
ref_key: "select",
|
|
@@ -29087,7 +29144,10 @@ const _hoisted_1$B = {
|
|
|
29087
29144
|
class: "lupa-search-results-sort"
|
|
29088
29145
|
};
|
|
29089
29146
|
const _hoisted_2$s = { id: "lupa-select" };
|
|
29090
|
-
const _hoisted_3$k = {
|
|
29147
|
+
const _hoisted_3$k = {
|
|
29148
|
+
class: "lupa-select-label",
|
|
29149
|
+
for: "lupa-sort-select-dropdown"
|
|
29150
|
+
};
|
|
29091
29151
|
const _hoisted_4$c = ["aria-label"];
|
|
29092
29152
|
const _hoisted_5$9 = ["value"];
|
|
29093
29153
|
const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
|
|
@@ -29101,6 +29161,7 @@ const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
|
|
|
29101
29161
|
const paramStore = useParamsStore();
|
|
29102
29162
|
const optionStore = useOptionsStore();
|
|
29103
29163
|
const { sort } = storeToRefs(paramStore);
|
|
29164
|
+
const { ariaLabels } = storeToRefs(optionStore);
|
|
29104
29165
|
const selectedKey = vue.ref("");
|
|
29105
29166
|
const previousKey = vue.ref("");
|
|
29106
29167
|
const sortItems = vue.computed(() => {
|
|
@@ -29139,12 +29200,14 @@ const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
|
|
|
29139
29200
|
previousKey.value = selectedKey.value;
|
|
29140
29201
|
};
|
|
29141
29202
|
return (_ctx, _cache) => {
|
|
29203
|
+
var _a25, _b25;
|
|
29142
29204
|
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$B, [
|
|
29143
29205
|
vue.createElementVNode("div", _hoisted_2$s, [
|
|
29144
29206
|
vue.createElementVNode("label", _hoisted_3$k, vue.toDisplayString(_ctx.options.label), 1),
|
|
29145
29207
|
vue.withDirectives(vue.createElementVNode("select", {
|
|
29208
|
+
id: "lupa-sort-select-dropdown",
|
|
29146
29209
|
class: "lupa-select-dropdown",
|
|
29147
|
-
"aria-label": _ctx.options.label,
|
|
29210
|
+
"aria-label": (_b25 = (_a25 = vue.unref(ariaLabels)) == null ? void 0 : _a25.sortBySelect) != null ? _b25 : _ctx.options.label,
|
|
29148
29211
|
"data-cy": "lupa-sort-select-dropdown",
|
|
29149
29212
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => selectedKey.value = $event),
|
|
29150
29213
|
onChange: handleSelect,
|
|
@@ -29643,6 +29706,13 @@ const _sfc_main$y = /* @__PURE__ */ vue.defineComponent({
|
|
|
29643
29706
|
const hasLink = vue.computed(() => {
|
|
29644
29707
|
return Boolean(props.link && props.options.link);
|
|
29645
29708
|
});
|
|
29709
|
+
const addToCartButtonClass = vue.computed(() => {
|
|
29710
|
+
return {
|
|
29711
|
+
[props.options.className]: Boolean(props.options.className),
|
|
29712
|
+
"lupa-add-to-cart-loading": loading.value,
|
|
29713
|
+
"lupa-add-to-cart": !loading.value
|
|
29714
|
+
};
|
|
29715
|
+
});
|
|
29646
29716
|
const handleClick = (e2) => __async(null, null, function* () {
|
|
29647
29717
|
if (productCardIsClickable.value && !hasLink.value) {
|
|
29648
29718
|
e2.preventDefault();
|
|
@@ -29663,7 +29733,7 @@ const _sfc_main$y = /* @__PURE__ */ vue.defineComponent({
|
|
|
29663
29733
|
vue.createElementVNode("div", _hoisted_2$o, [
|
|
29664
29734
|
hasLink.value ? (vue.openBlock(), vue.createElementBlock("button", vue.mergeProps({
|
|
29665
29735
|
key: 0,
|
|
29666
|
-
class:
|
|
29736
|
+
class: addToCartButtonClass.value,
|
|
29667
29737
|
"data-cy": "lupa-add-to-cart",
|
|
29668
29738
|
disabled: !inStockValue.value || loading.value
|
|
29669
29739
|
}, _ctx.dynamicAttributes, { onClick: handleClick }), [
|
|
@@ -29671,7 +29741,7 @@ const _sfc_main$y = /* @__PURE__ */ vue.defineComponent({
|
|
|
29671
29741
|
], 16, _hoisted_3$g)) : (vue.openBlock(), vue.createElementBlock("button", vue.mergeProps({
|
|
29672
29742
|
key: 1,
|
|
29673
29743
|
id: id.value,
|
|
29674
|
-
class:
|
|
29744
|
+
class: addToCartButtonClass.value,
|
|
29675
29745
|
"data-cy": "lupa-add-to-cart",
|
|
29676
29746
|
disabled: !inStockValue.value || loading.value
|
|
29677
29747
|
}, _ctx.dynamicAttributes, {
|
|
@@ -33531,6 +33601,10 @@ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
|
|
|
33531
33601
|
const itemId = vue.computed(() => {
|
|
33532
33602
|
return typeof props.options.itemId === "string" || typeof props.options.itemId === "number" || Array.isArray(props.options.itemId) ? props.options.itemId : extractValue(props.options.itemId);
|
|
33533
33603
|
});
|
|
33604
|
+
const wrapAround = vue.computed(() => {
|
|
33605
|
+
var _a25, _b25;
|
|
33606
|
+
return (_b25 = (_a25 = carouselOptions.value) == null ? void 0 : _a25.wrapAround) != null ? _b25 : true;
|
|
33607
|
+
});
|
|
33534
33608
|
const loadLupaRecommendations = () => __async(null, null, function* () {
|
|
33535
33609
|
var _a25, _b25;
|
|
33536
33610
|
recommendationsType.value = "recommendations_lupasearch";
|
|
@@ -33565,7 +33639,7 @@ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
|
|
|
33565
33639
|
hasRecommendations.value ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
|
|
33566
33640
|
title.value ? (vue.openBlock(), vue.createElementBlock("h2", _hoisted_1$9, vue.toDisplayString(title.value), 1)) : vue.createCommentVNode("", true),
|
|
33567
33641
|
!loading.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$6, [
|
|
33568
|
-
layoutType.value === "carousel" ? (vue.openBlock(), vue.createBlock(vue.unref(Carousel), vue.mergeProps({ key: 0 }, carouselOptions.value, { "wrap-around":
|
|
33642
|
+
layoutType.value === "carousel" ? (vue.openBlock(), vue.createBlock(vue.unref(Carousel), vue.mergeProps({ key: 0 }, carouselOptions.value, { "wrap-around": wrapAround.value }), {
|
|
33569
33643
|
addons: vue.withCtx(() => [
|
|
33570
33644
|
vue.createVNode(vue.unref(Navigation))
|
|
33571
33645
|
]),
|
|
@@ -33588,7 +33662,7 @@ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
|
|
|
33588
33662
|
}), 128))
|
|
33589
33663
|
]),
|
|
33590
33664
|
_: 1
|
|
33591
|
-
}, 16)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$3, [
|
|
33665
|
+
}, 16, ["wrap-around"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$3, [
|
|
33592
33666
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(recommendations.value, (product, index) => {
|
|
33593
33667
|
return vue.openBlock(), vue.createBlock(_sfc_main$t, {
|
|
33594
33668
|
style: vue.normalizeStyle(columnSize.value),
|
package/dist/lupaSearch.mjs
CHANGED
|
@@ -11830,6 +11830,10 @@ const useOptionsStore = /* @__PURE__ */ defineStore("options", () => {
|
|
|
11830
11830
|
return (_b25 = (_a25 = currentResolutionPageSizes.value) == null ? void 0 : _a25[0]) != null ? _b25 : DEFAULT_PAGE_SIZE;
|
|
11831
11831
|
}
|
|
11832
11832
|
);
|
|
11833
|
+
const ariaLabels = computed(() => {
|
|
11834
|
+
var _a25, _b25;
|
|
11835
|
+
return (_b25 = (_a25 = searchResultOptions.value.labels) == null ? void 0 : _a25.aria) != null ? _b25 : {};
|
|
11836
|
+
});
|
|
11833
11837
|
const currentResolutionPageSizes = computed(() => {
|
|
11834
11838
|
var _a25, _b25, _c, _d;
|
|
11835
11839
|
const pageSizes = (_d = (_c = (_b25 = (_a25 = searchResultOptions.value) == null ? void 0 : _a25.pagination) == null ? void 0 : _b25.sizeSelection) == null ? void 0 : _c.sizes) != null ? _d : DEFAULT_PAGE_SIZE_SELECTION;
|
|
@@ -11885,6 +11889,7 @@ const useOptionsStore = /* @__PURE__ */ defineStore("options", () => {
|
|
|
11885
11889
|
defaultSearchResultPageSize,
|
|
11886
11890
|
currentResolutionPageSizes,
|
|
11887
11891
|
productRecommendationOptions,
|
|
11892
|
+
ariaLabels,
|
|
11888
11893
|
setSearchBoxOptions,
|
|
11889
11894
|
setTrackingOptions,
|
|
11890
11895
|
setSearchResultOptions,
|
|
@@ -12368,13 +12373,13 @@ const unfoldRangeFilter = (key, filter, price = {}) => {
|
|
|
12368
12373
|
}
|
|
12369
12374
|
];
|
|
12370
12375
|
}
|
|
12371
|
-
return [{ key, value: `${gt} - ${lt}`, type: "range" }];
|
|
12376
|
+
return [{ key, value: `${gt != null ? gt : "*"} - ${lt != null ? lt : "*"}`, type: "range" }];
|
|
12372
12377
|
};
|
|
12373
12378
|
const unfoldFilter = (key, filter, price = {}) => {
|
|
12374
12379
|
if (Array.isArray(filter)) {
|
|
12375
12380
|
return unfoldTermFilter(key, filter);
|
|
12376
12381
|
}
|
|
12377
|
-
if (filter.gte) {
|
|
12382
|
+
if (filter.gte || filter.lte || filter.gt || filter.lt) {
|
|
12378
12383
|
return unfoldRangeFilter(key, filter, price);
|
|
12379
12384
|
}
|
|
12380
12385
|
if (filter.terms) {
|
|
@@ -12427,8 +12432,9 @@ const recursiveFilterItem = (item, query = "") => {
|
|
|
12427
12432
|
}) : void 0;
|
|
12428
12433
|
};
|
|
12429
12434
|
const rangeFilterToString = (rangeFilter, separator) => {
|
|
12435
|
+
var _a25, _b25, _c;
|
|
12430
12436
|
separator = separator || FACET_TERM_RANGE_SEPARATOR;
|
|
12431
|
-
return rangeFilter && Object.keys(rangeFilter).length ? rangeFilter.gte + separator + (rangeFilter.lte || rangeFilter.lt) : "";
|
|
12437
|
+
return rangeFilter && Object.keys(rangeFilter).length ? ((_a25 = rangeFilter.gte) != null ? _a25 : "") + separator + (((_b25 = rangeFilter.lte) != null ? _b25 : "") || ((_c = rangeFilter.lt) != null ? _c : "")) : "";
|
|
12432
12438
|
};
|
|
12433
12439
|
const pick = (obj, keys) => {
|
|
12434
12440
|
const ret = /* @__PURE__ */ Object.create({});
|
|
@@ -12487,14 +12493,15 @@ const parseFacetKey = (key, searchParams) => {
|
|
|
12487
12493
|
return (_b25 = (_a25 = searchParams.getAll(key)) == null ? void 0 : _a25.map((v) => decodeURIComponent(v))) != null ? _b25 : [];
|
|
12488
12494
|
}
|
|
12489
12495
|
if (key.startsWith(FACET_PARAMS_TYPE.RANGE)) {
|
|
12496
|
+
const isPrice = key == null ? void 0 : key.includes(CURRENCY_KEY_INDICATOR);
|
|
12490
12497
|
const range2 = searchParams.get(key);
|
|
12491
12498
|
if (!range2) {
|
|
12492
12499
|
return {};
|
|
12493
12500
|
}
|
|
12494
12501
|
const [min, max] = range2.split(FACET_RANGE_SEPARATOR);
|
|
12495
12502
|
return {
|
|
12496
|
-
gte: min,
|
|
12497
|
-
lte: max
|
|
12503
|
+
gte: min || void 0,
|
|
12504
|
+
[isPrice ? "lte" : "lt"]: max || void 0
|
|
12498
12505
|
};
|
|
12499
12506
|
}
|
|
12500
12507
|
if (key.startsWith(FACET_PARAMS_TYPE.HIERARCHY)) {
|
|
@@ -12694,16 +12701,27 @@ const toggleHierarchyFilter = (appendParams, facetAction, getQueryParamName, cur
|
|
|
12694
12701
|
paramsToRemove: [getQueryParamName ? getQueryParamName(QUERY_PARAMS.PAGE) : QUERY_PARAMS.PAGE]
|
|
12695
12702
|
});
|
|
12696
12703
|
};
|
|
12697
|
-
const toggleRangeFilter = (appendParams, facetAction, getQueryParamName, currentFilters) => {
|
|
12704
|
+
const toggleRangeFilter = (appendParams, removeParameters, facetAction, getQueryParamName, currentFilters) => {
|
|
12705
|
+
var _a25, _b25;
|
|
12698
12706
|
const currentFilter = rangeFilterToString(
|
|
12699
12707
|
currentFilters == null ? void 0 : currentFilters[facetAction.key],
|
|
12700
12708
|
FACET_RANGE_SEPARATOR
|
|
12701
12709
|
);
|
|
12702
|
-
let facetValue = facetAction.value.join(FACET_RANGE_SEPARATOR);
|
|
12710
|
+
let facetValue = (_b25 = (_a25 = facetAction == null ? void 0 : facetAction.value) == null ? void 0 : _a25.join(FACET_RANGE_SEPARATOR)) != null ? _b25 : "";
|
|
12703
12711
|
facetValue = currentFilter === facetValue ? "" : facetValue;
|
|
12712
|
+
const paramsToRemove = getQueryParamName ? [getQueryParamName(QUERY_PARAMS.PAGE)] : [QUERY_PARAMS.PAGE];
|
|
12713
|
+
if (!facetValue) {
|
|
12714
|
+
removeParameters({
|
|
12715
|
+
paramsToRemove: [
|
|
12716
|
+
getFacetParam(facetAction.key, "", FACET_PARAMS_TYPE.RANGE).name,
|
|
12717
|
+
...paramsToRemove
|
|
12718
|
+
]
|
|
12719
|
+
});
|
|
12720
|
+
return;
|
|
12721
|
+
}
|
|
12704
12722
|
appendParams({
|
|
12705
12723
|
params: [getFacetParam(facetAction.key, facetValue, FACET_PARAMS_TYPE.RANGE)],
|
|
12706
|
-
paramsToRemove
|
|
12724
|
+
paramsToRemove,
|
|
12707
12725
|
encode: false
|
|
12708
12726
|
});
|
|
12709
12727
|
};
|
|
@@ -13497,6 +13515,7 @@ const _hoisted_1$1l = {
|
|
|
13497
13515
|
const _hoisted_2$W = { class: "lupa-dialog-content" };
|
|
13498
13516
|
const _hoisted_3$E = { class: "lupa-listening-text" };
|
|
13499
13517
|
const _hoisted_4$u = { class: "lupa-mic-button-wrapper" };
|
|
13518
|
+
const _hoisted_5$l = ["aria-label"];
|
|
13500
13519
|
const _sfc_main$1z = /* @__PURE__ */ defineComponent({
|
|
13501
13520
|
__name: "VoiceSearchDialog",
|
|
13502
13521
|
props: {
|
|
@@ -13600,6 +13619,7 @@ const _sfc_main$1z = /* @__PURE__ */ defineComponent({
|
|
|
13600
13619
|
reset: dialogReset
|
|
13601
13620
|
});
|
|
13602
13621
|
return (_ctx, _cache) => {
|
|
13622
|
+
var _a25, _b25;
|
|
13603
13623
|
return openBlock(), createElementBlock("div", null, [
|
|
13604
13624
|
props.isOpen ? (openBlock(), createElementBlock("div", _hoisted_1$1l, [
|
|
13605
13625
|
createElementVNode("button", {
|
|
@@ -13611,8 +13631,10 @@ const _sfc_main$1z = /* @__PURE__ */ defineComponent({
|
|
|
13611
13631
|
createElementVNode("div", _hoisted_4$u, [
|
|
13612
13632
|
createElementVNode("button", {
|
|
13613
13633
|
class: normalizeClass(["lupa-mic-button", { recording: unref(isRecording) }]),
|
|
13614
|
-
onClick: handleRecordingButtonClick
|
|
13615
|
-
|
|
13634
|
+
onClick: handleRecordingButtonClick,
|
|
13635
|
+
"aria-controls": "voice-search-microphone",
|
|
13636
|
+
"aria-label": ((_b25 = (_a25 = labels.value) == null ? void 0 : _a25.aria) == null ? void 0 : _b25.microphone) || "Toggle microphone"
|
|
13637
|
+
}, null, 10, _hoisted_5$l),
|
|
13616
13638
|
createVNode(_sfc_main$1A, {
|
|
13617
13639
|
ref_key: "voiceSearchProgressBar",
|
|
13618
13640
|
ref: voiceSearchProgressBar,
|
|
@@ -13638,6 +13660,7 @@ const _hoisted_6$8 = {
|
|
|
13638
13660
|
class: "lupa-close-label"
|
|
13639
13661
|
};
|
|
13640
13662
|
const _hoisted_7$5 = { key: 1 };
|
|
13663
|
+
const _hoisted_8$3 = ["aria-label"];
|
|
13641
13664
|
const _sfc_main$1y = /* @__PURE__ */ defineComponent({
|
|
13642
13665
|
__name: "SearchBoxInput",
|
|
13643
13666
|
props: {
|
|
@@ -13693,6 +13716,10 @@ const _sfc_main$1y = /* @__PURE__ */ defineComponent({
|
|
|
13693
13716
|
var _a25;
|
|
13694
13717
|
return (_a25 = labels.value.searchInputAriaLabel) != null ? _a25 : "Search input";
|
|
13695
13718
|
});
|
|
13719
|
+
const voiceSearchAriaLabel = computed(() => {
|
|
13720
|
+
var _a25, _b25, _c, _d;
|
|
13721
|
+
return (_d = (_c = (_b25 = (_a25 = props.options.voiceSearch) == null ? void 0 : _a25.labels) == null ? void 0 : _b25.aria) == null ? void 0 : _c.openDialog) != null ? _d : "Open voice search dialog";
|
|
13722
|
+
});
|
|
13696
13723
|
onMounted(() => {
|
|
13697
13724
|
document.addEventListener("click", handleClickOutsideVoiceDialogOverlay);
|
|
13698
13725
|
});
|
|
@@ -13813,8 +13840,11 @@ const _sfc_main$1y = /* @__PURE__ */ defineComponent({
|
|
|
13813
13840
|
isVoiceSearchEnabled.value ? (openBlock(), createElementBlock("div", _hoisted_7$5, [
|
|
13814
13841
|
createElementVNode("button", {
|
|
13815
13842
|
onClick: openVoiceSearchDialog,
|
|
13816
|
-
class: "lupa-voice-search-button"
|
|
13817
|
-
|
|
13843
|
+
class: "lupa-voice-search-button",
|
|
13844
|
+
"aria-haspopup": "dialog",
|
|
13845
|
+
"aria-controls": "voice-search-dialog",
|
|
13846
|
+
"aria-label": voiceSearchAriaLabel.value
|
|
13847
|
+
}, null, 8, _hoisted_8$3)
|
|
13818
13848
|
])) : createCommentVNode("", true),
|
|
13819
13849
|
isVoiceSearchEnabled.value ? (openBlock(), createBlock(_sfc_main$1z, {
|
|
13820
13850
|
key: 2,
|
|
@@ -24277,6 +24307,13 @@ const _sfc_main$1i = /* @__PURE__ */ defineComponent({
|
|
|
24277
24307
|
const { addToCartAmount } = storeToRefs(searchResultStore);
|
|
24278
24308
|
const emit = __emit;
|
|
24279
24309
|
const loading = ref(false);
|
|
24310
|
+
const addToCartButtonClass = computed(() => {
|
|
24311
|
+
return {
|
|
24312
|
+
[props.options.className]: Boolean(props.options.className),
|
|
24313
|
+
"lupa-add-to-cart-loading": loading.value,
|
|
24314
|
+
"lupa-add-to-cart": !loading.value
|
|
24315
|
+
};
|
|
24316
|
+
});
|
|
24280
24317
|
const label = computed(() => {
|
|
24281
24318
|
return props.options.labels.addToCart;
|
|
24282
24319
|
});
|
|
@@ -24300,7 +24337,7 @@ const _sfc_main$1i = /* @__PURE__ */ defineComponent({
|
|
|
24300
24337
|
createElementVNode("div", _hoisted_2$O, [
|
|
24301
24338
|
hasLink.value ? (openBlock(), createElementBlock("button", mergeProps({
|
|
24302
24339
|
key: 0,
|
|
24303
|
-
class:
|
|
24340
|
+
class: addToCartButtonClass.value,
|
|
24304
24341
|
"data-cy": "lupa-add-to-cart",
|
|
24305
24342
|
disabled: !inStockValue.value || loading.value
|
|
24306
24343
|
}, _ctx.dynamicAttributes, { onClick: handleClick }), [
|
|
@@ -24308,7 +24345,7 @@ const _sfc_main$1i = /* @__PURE__ */ defineComponent({
|
|
|
24308
24345
|
], 16, _hoisted_3$A)) : (openBlock(), createElementBlock("button", mergeProps({
|
|
24309
24346
|
key: 1,
|
|
24310
24347
|
onClick: withModifiers(handleClick, ["stop", "prevent"]),
|
|
24311
|
-
class:
|
|
24348
|
+
class: addToCartButtonClass.value,
|
|
24312
24349
|
"data-cy": "lupa-add-to-cart",
|
|
24313
24350
|
type: "button",
|
|
24314
24351
|
disabled: !inStockValue.value || loading.value
|
|
@@ -26730,7 +26767,7 @@ const _sfc_main$X = /* @__PURE__ */ defineComponent({
|
|
|
26730
26767
|
});
|
|
26731
26768
|
const handleFacetClick = (item) => {
|
|
26732
26769
|
var _a25;
|
|
26733
|
-
const value = isRange.value ? item.
|
|
26770
|
+
const value = isRange.value ? [item.from, item.to] : (_a25 = item.title) == null ? void 0 : _a25.toString();
|
|
26734
26771
|
emit("select", {
|
|
26735
26772
|
key: facet.value.key,
|
|
26736
26773
|
value,
|
|
@@ -26744,7 +26781,11 @@ const _sfc_main$X = /* @__PURE__ */ defineComponent({
|
|
|
26744
26781
|
var _a25, _b25;
|
|
26745
26782
|
let selectedItems = (_a25 = currentFiltersValue.value) != null ? _a25 : [];
|
|
26746
26783
|
selectedItems = isRange.value && selectedItems ? [rangeFilterToString(selectedItems)] : selectedItems;
|
|
26747
|
-
|
|
26784
|
+
if (isRange.value) {
|
|
26785
|
+
return selectedItems == null ? void 0 : selectedItems.includes(rangeFilterToString({ gte: item.from, lt: item.to }));
|
|
26786
|
+
} else {
|
|
26787
|
+
return selectedItems == null ? void 0 : selectedItems.includes((_b25 = item.title) == null ? void 0 : _b25.toString());
|
|
26788
|
+
}
|
|
26748
26789
|
};
|
|
26749
26790
|
const getItemLabel = (item) => {
|
|
26750
26791
|
var _a25;
|
|
@@ -28183,12 +28224,12 @@ const _sfc_main$U = /* @__PURE__ */ defineComponent({
|
|
|
28183
28224
|
}), 128)),
|
|
28184
28225
|
itemLimit.value < filteredValues.value.length ? (openBlock(), createElementBlock("div", {
|
|
28185
28226
|
key: 1,
|
|
28186
|
-
class:
|
|
28227
|
+
class: "lupa-facet-term lupa-show-more-facet-results",
|
|
28187
28228
|
"data-cy": "lupa-facet-term",
|
|
28188
28229
|
onClick: handleShowAll
|
|
28189
|
-
}, toDisplayString(_ctx.options.labels.showAll),
|
|
28230
|
+
}, toDisplayString(_ctx.options.labels.showAll), 1)) : showAll.value ? (openBlock(), createElementBlock("div", {
|
|
28190
28231
|
key: 2,
|
|
28191
|
-
class: "lupa-facet-term lupa-show-more-facet-results",
|
|
28232
|
+
class: "lupa-facet-term lupa-show-more-facet-results lupa-show-less-facet-results",
|
|
28192
28233
|
onClick: handleCancelShowAll
|
|
28193
28234
|
}, toDisplayString(_ctx.options.labels.showLess), 1)) : createCommentVNode("", true)
|
|
28194
28235
|
]);
|
|
@@ -28218,7 +28259,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
|
|
|
28218
28259
|
},
|
|
28219
28260
|
emits: ["select", "clear"],
|
|
28220
28261
|
setup(__props, { emit: __emit }) {
|
|
28221
|
-
var _a25, _b25;
|
|
28262
|
+
var _a25, _b25, _c;
|
|
28222
28263
|
const props = __props;
|
|
28223
28264
|
const facet = computed(() => {
|
|
28224
28265
|
var _a26;
|
|
@@ -28230,10 +28271,19 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
|
|
|
28230
28271
|
});
|
|
28231
28272
|
const searchResultStore = useSearchResultStore();
|
|
28232
28273
|
const optionsStore = useOptionsStore();
|
|
28274
|
+
const screenStore = useScreenStore();
|
|
28233
28275
|
const { currentFilterKeys } = storeToRefs(searchResultStore);
|
|
28234
28276
|
const { searchResultOptions } = storeToRefs(optionsStore);
|
|
28277
|
+
const { isMobileWidth } = storeToRefs(screenStore);
|
|
28235
28278
|
const emit = __emit;
|
|
28236
|
-
const
|
|
28279
|
+
const allExpanded = computed(() => {
|
|
28280
|
+
var _a26, _b26, _c2, _d, _e, _f;
|
|
28281
|
+
if (isMobileWidth.value) {
|
|
28282
|
+
return (_c2 = (_b26 = (_a26 = props.options) == null ? void 0 : _a26.expandAll) == null ? void 0 : _b26.mobile) != null ? _c2 : false;
|
|
28283
|
+
}
|
|
28284
|
+
return (_f = (_e = (_d = props.options) == null ? void 0 : _d.expandAll) == null ? void 0 : _e.desktop) != null ? _f : false;
|
|
28285
|
+
});
|
|
28286
|
+
const isOpen = ref((_c = ((_b25 = (_a25 = props.options) == null ? void 0 : _a25.expand) == null ? void 0 : _b25.includes(props.facet.key)) || allExpanded.value) != null ? _c : false);
|
|
28237
28287
|
const facetPanel = ref(null);
|
|
28238
28288
|
const facetType = computed(() => {
|
|
28239
28289
|
switch (facet.value.type) {
|
|
@@ -28496,6 +28546,7 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
|
28496
28546
|
case "range":
|
|
28497
28547
|
toggleRangeFilter(
|
|
28498
28548
|
paramStore.appendParams,
|
|
28549
|
+
paramStore.removeParameters,
|
|
28499
28550
|
facetAction,
|
|
28500
28551
|
optionsStore.getQueryParamName,
|
|
28501
28552
|
filters.value
|
|
@@ -29026,7 +29077,10 @@ const _hoisted_1$C = {
|
|
|
29026
29077
|
"data-cy": "lupa-search-results-page-size"
|
|
29027
29078
|
};
|
|
29028
29079
|
const _hoisted_2$t = { id: "lupa-select" };
|
|
29029
|
-
const _hoisted_3$l = {
|
|
29080
|
+
const _hoisted_3$l = {
|
|
29081
|
+
class: "lupa-select-label",
|
|
29082
|
+
for: "lupa-page-size-select-dropdown"
|
|
29083
|
+
};
|
|
29030
29084
|
const _hoisted_4$d = ["aria-label"];
|
|
29031
29085
|
const _hoisted_5$a = ["value"];
|
|
29032
29086
|
const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
@@ -29039,6 +29093,7 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
|
29039
29093
|
const props = __props;
|
|
29040
29094
|
const paramsStore = useParamsStore();
|
|
29041
29095
|
const optionsStore = useOptionsStore();
|
|
29096
|
+
const { ariaLabels } = storeToRefs(optionsStore);
|
|
29042
29097
|
const select = ref(null);
|
|
29043
29098
|
const prefixLabel = computed(() => {
|
|
29044
29099
|
var _a25, _b25;
|
|
@@ -29057,12 +29112,14 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
|
29057
29112
|
});
|
|
29058
29113
|
};
|
|
29059
29114
|
return (_ctx, _cache) => {
|
|
29115
|
+
var _a25, _b25, _c;
|
|
29060
29116
|
return openBlock(), createElementBlock("div", _hoisted_1$C, [
|
|
29061
29117
|
createElementVNode("div", _hoisted_2$t, [
|
|
29062
29118
|
createElementVNode("label", _hoisted_3$l, toDisplayString(label.value), 1),
|
|
29063
29119
|
createElementVNode("select", {
|
|
29120
|
+
id: "lupa-page-size-select-dropdown",
|
|
29064
29121
|
class: "lupa-select-dropdown",
|
|
29065
|
-
"aria-label": label.value,
|
|
29122
|
+
"aria-label": (_c = (_b25 = (_a25 = unref(ariaLabels)) == null ? void 0 : _a25.pageSizeSelect) != null ? _b25 : label.value) != null ? _c : "Select page size",
|
|
29066
29123
|
"data-cy": "lupa-page-size-select-dropdown",
|
|
29067
29124
|
onChange: handleSelect,
|
|
29068
29125
|
ref_key: "select",
|
|
@@ -29085,7 +29142,10 @@ const _hoisted_1$B = {
|
|
|
29085
29142
|
class: "lupa-search-results-sort"
|
|
29086
29143
|
};
|
|
29087
29144
|
const _hoisted_2$s = { id: "lupa-select" };
|
|
29088
|
-
const _hoisted_3$k = {
|
|
29145
|
+
const _hoisted_3$k = {
|
|
29146
|
+
class: "lupa-select-label",
|
|
29147
|
+
for: "lupa-sort-select-dropdown"
|
|
29148
|
+
};
|
|
29089
29149
|
const _hoisted_4$c = ["aria-label"];
|
|
29090
29150
|
const _hoisted_5$9 = ["value"];
|
|
29091
29151
|
const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
@@ -29099,6 +29159,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
|
29099
29159
|
const paramStore = useParamsStore();
|
|
29100
29160
|
const optionStore = useOptionsStore();
|
|
29101
29161
|
const { sort } = storeToRefs(paramStore);
|
|
29162
|
+
const { ariaLabels } = storeToRefs(optionStore);
|
|
29102
29163
|
const selectedKey = ref("");
|
|
29103
29164
|
const previousKey = ref("");
|
|
29104
29165
|
const sortItems = computed(() => {
|
|
@@ -29137,12 +29198,14 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
|
29137
29198
|
previousKey.value = selectedKey.value;
|
|
29138
29199
|
};
|
|
29139
29200
|
return (_ctx, _cache) => {
|
|
29201
|
+
var _a25, _b25;
|
|
29140
29202
|
return openBlock(), createElementBlock("div", _hoisted_1$B, [
|
|
29141
29203
|
createElementVNode("div", _hoisted_2$s, [
|
|
29142
29204
|
createElementVNode("label", _hoisted_3$k, toDisplayString(_ctx.options.label), 1),
|
|
29143
29205
|
withDirectives(createElementVNode("select", {
|
|
29206
|
+
id: "lupa-sort-select-dropdown",
|
|
29144
29207
|
class: "lupa-select-dropdown",
|
|
29145
|
-
"aria-label": _ctx.options.label,
|
|
29208
|
+
"aria-label": (_b25 = (_a25 = unref(ariaLabels)) == null ? void 0 : _a25.sortBySelect) != null ? _b25 : _ctx.options.label,
|
|
29146
29209
|
"data-cy": "lupa-sort-select-dropdown",
|
|
29147
29210
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => selectedKey.value = $event),
|
|
29148
29211
|
onChange: handleSelect,
|
|
@@ -29641,6 +29704,13 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
29641
29704
|
const hasLink = computed(() => {
|
|
29642
29705
|
return Boolean(props.link && props.options.link);
|
|
29643
29706
|
});
|
|
29707
|
+
const addToCartButtonClass = computed(() => {
|
|
29708
|
+
return {
|
|
29709
|
+
[props.options.className]: Boolean(props.options.className),
|
|
29710
|
+
"lupa-add-to-cart-loading": loading.value,
|
|
29711
|
+
"lupa-add-to-cart": !loading.value
|
|
29712
|
+
};
|
|
29713
|
+
});
|
|
29644
29714
|
const handleClick = (e2) => __async(null, null, function* () {
|
|
29645
29715
|
if (productCardIsClickable.value && !hasLink.value) {
|
|
29646
29716
|
e2.preventDefault();
|
|
@@ -29661,7 +29731,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
29661
29731
|
createElementVNode("div", _hoisted_2$o, [
|
|
29662
29732
|
hasLink.value ? (openBlock(), createElementBlock("button", mergeProps({
|
|
29663
29733
|
key: 0,
|
|
29664
|
-
class:
|
|
29734
|
+
class: addToCartButtonClass.value,
|
|
29665
29735
|
"data-cy": "lupa-add-to-cart",
|
|
29666
29736
|
disabled: !inStockValue.value || loading.value
|
|
29667
29737
|
}, _ctx.dynamicAttributes, { onClick: handleClick }), [
|
|
@@ -29669,7 +29739,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
29669
29739
|
], 16, _hoisted_3$g)) : (openBlock(), createElementBlock("button", mergeProps({
|
|
29670
29740
|
key: 1,
|
|
29671
29741
|
id: id.value,
|
|
29672
|
-
class:
|
|
29742
|
+
class: addToCartButtonClass.value,
|
|
29673
29743
|
"data-cy": "lupa-add-to-cart",
|
|
29674
29744
|
disabled: !inStockValue.value || loading.value
|
|
29675
29745
|
}, _ctx.dynamicAttributes, {
|
|
@@ -33529,6 +33599,10 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
33529
33599
|
const itemId = computed(() => {
|
|
33530
33600
|
return typeof props.options.itemId === "string" || typeof props.options.itemId === "number" || Array.isArray(props.options.itemId) ? props.options.itemId : extractValue(props.options.itemId);
|
|
33531
33601
|
});
|
|
33602
|
+
const wrapAround = computed(() => {
|
|
33603
|
+
var _a25, _b25;
|
|
33604
|
+
return (_b25 = (_a25 = carouselOptions.value) == null ? void 0 : _a25.wrapAround) != null ? _b25 : true;
|
|
33605
|
+
});
|
|
33532
33606
|
const loadLupaRecommendations = () => __async(null, null, function* () {
|
|
33533
33607
|
var _a25, _b25;
|
|
33534
33608
|
recommendationsType.value = "recommendations_lupasearch";
|
|
@@ -33563,7 +33637,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
33563
33637
|
hasRecommendations.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
33564
33638
|
title.value ? (openBlock(), createElementBlock("h2", _hoisted_1$9, toDisplayString(title.value), 1)) : createCommentVNode("", true),
|
|
33565
33639
|
!loading.value ? (openBlock(), createElementBlock("div", _hoisted_2$6, [
|
|
33566
|
-
layoutType.value === "carousel" ? (openBlock(), createBlock(unref(Carousel), mergeProps({ key: 0 }, carouselOptions.value, { "wrap-around":
|
|
33640
|
+
layoutType.value === "carousel" ? (openBlock(), createBlock(unref(Carousel), mergeProps({ key: 0 }, carouselOptions.value, { "wrap-around": wrapAround.value }), {
|
|
33567
33641
|
addons: withCtx(() => [
|
|
33568
33642
|
createVNode(unref(Navigation))
|
|
33569
33643
|
]),
|
|
@@ -33586,7 +33660,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
33586
33660
|
}), 128))
|
|
33587
33661
|
]),
|
|
33588
33662
|
_: 1
|
|
33589
|
-
}, 16)) : (openBlock(), createElementBlock("div", _hoisted_3$3, [
|
|
33663
|
+
}, 16, ["wrap-around"])) : (openBlock(), createElementBlock("div", _hoisted_3$3, [
|
|
33590
33664
|
(openBlock(true), createElementBlock(Fragment, null, renderList(recommendations.value, (product, index) => {
|
|
33591
33665
|
return openBlock(), createBlock(_sfc_main$t, {
|
|
33592
33666
|
style: normalizeStyle(columnSize.value),
|
package/dist/stores/options.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export declare const useOptionsStore: import('pinia').StoreDefinition<"options",
|
|
|
18
18
|
defaultSearchResultPageSize: import('vue').ComputedRef<number>;
|
|
19
19
|
currentResolutionPageSizes: import('vue').ComputedRef<number[]>;
|
|
20
20
|
productRecommendationOptions: Ref<Partial<ProductRecommendationOptions>, Partial<ProductRecommendationOptions>>;
|
|
21
|
+
ariaLabels: import('vue').ComputedRef<import('../types/search-results/SearchResultsOptions').SearchResultsAriaLabels>;
|
|
21
22
|
setSearchBoxOptions: ({ options }: {
|
|
22
23
|
options: SearchBoxOptions;
|
|
23
24
|
}) => void;
|
|
@@ -47,6 +48,7 @@ export declare const useOptionsStore: import('pinia').StoreDefinition<"options",
|
|
|
47
48
|
defaultSearchResultPageSize: import('vue').ComputedRef<number>;
|
|
48
49
|
currentResolutionPageSizes: import('vue').ComputedRef<number[]>;
|
|
49
50
|
productRecommendationOptions: Ref<Partial<ProductRecommendationOptions>, Partial<ProductRecommendationOptions>>;
|
|
51
|
+
ariaLabels: import('vue').ComputedRef<import('../types/search-results/SearchResultsOptions').SearchResultsAriaLabels>;
|
|
50
52
|
setSearchBoxOptions: ({ options }: {
|
|
51
53
|
options: SearchBoxOptions;
|
|
52
54
|
}) => void;
|
|
@@ -63,7 +65,7 @@ export declare const useOptionsStore: import('pinia').StoreDefinition<"options",
|
|
|
63
65
|
options: ProductRecommendationOptions;
|
|
64
66
|
}) => void;
|
|
65
67
|
getQueryParamName: (param: LupaQueryParamValue) => string;
|
|
66
|
-
}, "initialFilters" | "envOptions" | "multiCurrency" | "classMap" | "boxRoutingBehavior" | "searchResultsRoutingBehavior" | "defaultSearchResultPageSize" | "currentResolutionPageSizes">, Pick<{
|
|
68
|
+
}, "initialFilters" | "envOptions" | "multiCurrency" | "classMap" | "boxRoutingBehavior" | "searchResultsRoutingBehavior" | "defaultSearchResultPageSize" | "currentResolutionPageSizes" | "ariaLabels">, Pick<{
|
|
67
69
|
searchBoxOptions: Ref<SearchBoxOptions, SearchBoxOptions>;
|
|
68
70
|
searchResultOptions: Ref<SearchResultsOptions, SearchResultsOptions>;
|
|
69
71
|
trackingOptions: Ref<TrackingOptions, TrackingOptions>;
|
|
@@ -76,6 +78,7 @@ export declare const useOptionsStore: import('pinia').StoreDefinition<"options",
|
|
|
76
78
|
defaultSearchResultPageSize: import('vue').ComputedRef<number>;
|
|
77
79
|
currentResolutionPageSizes: import('vue').ComputedRef<number[]>;
|
|
78
80
|
productRecommendationOptions: Ref<Partial<ProductRecommendationOptions>, Partial<ProductRecommendationOptions>>;
|
|
81
|
+
ariaLabels: import('vue').ComputedRef<import('../types/search-results/SearchResultsOptions').SearchResultsAriaLabels>;
|
|
79
82
|
setSearchBoxOptions: ({ options }: {
|
|
80
83
|
options: SearchBoxOptions;
|
|
81
84
|
}) => void;
|
|
@@ -27,6 +27,7 @@ export type DocumentElementBase<T = any> = {
|
|
|
27
27
|
group?: string;
|
|
28
28
|
dynamic?: boolean;
|
|
29
29
|
dynamicAttributes?: DynamicAttribute[];
|
|
30
|
+
className: string;
|
|
30
31
|
};
|
|
31
32
|
export type ImageDocumentElement<T = any> = DocumentElementBase<T> & {
|
|
32
33
|
type: DocumentElementType.IMAGE;
|
|
@@ -57,24 +58,20 @@ export type DescriptionDocumentElement<T = any> = DocumentElementBase<T> & {
|
|
|
57
58
|
type: DocumentElementType.DESCRIPTION;
|
|
58
59
|
maxLines?: number;
|
|
59
60
|
key: string;
|
|
60
|
-
className?: string;
|
|
61
61
|
};
|
|
62
62
|
export type CustomDocumentElement<T = any> = DocumentElementBase<T> & {
|
|
63
63
|
type: DocumentElementType.CUSTOM;
|
|
64
64
|
maxLines?: number;
|
|
65
|
-
className?: string;
|
|
66
65
|
key: string;
|
|
67
66
|
label?: string;
|
|
68
67
|
action?: (document: T) => Promise<unknown> | undefined;
|
|
69
68
|
};
|
|
70
69
|
export type PriceElement<T = any> = DocumentElementBase<T> & {
|
|
71
70
|
type: DocumentElementType.PRICE;
|
|
72
|
-
className?: string;
|
|
73
71
|
key: string;
|
|
74
72
|
};
|
|
75
73
|
export type RegularPriceDocumentElement<T = any> = DocumentElementBase<T> & {
|
|
76
74
|
type: DocumentElementType.REGULARPRICE;
|
|
77
|
-
className?: string;
|
|
78
75
|
key: string;
|
|
79
76
|
};
|
|
80
77
|
export type RatingElement<T = any> = DocumentElementBase<T> & {
|
|
@@ -41,6 +41,10 @@ export type VoiceSearchLabels = {
|
|
|
41
41
|
connecting?: string;
|
|
42
42
|
microphoneNotFound?: string;
|
|
43
43
|
microphoneNotAllowed?: string;
|
|
44
|
+
aria?: {
|
|
45
|
+
openDialog?: string;
|
|
46
|
+
microphone?: string;
|
|
47
|
+
};
|
|
44
48
|
};
|
|
45
49
|
export type VoiceSearchOptions = {
|
|
46
50
|
enabled: boolean;
|
|
@@ -59,6 +63,7 @@ export type SearchBoxInputOptions = {
|
|
|
59
63
|
links: SearchBoxOptionLinks;
|
|
60
64
|
inputAttributes?: Record<string, string>;
|
|
61
65
|
showSubmitButton?: boolean;
|
|
66
|
+
voiceSearch?: VoiceSearchOptions;
|
|
62
67
|
};
|
|
63
68
|
export type SearchBoxResultCallbackContext = {
|
|
64
69
|
hasAnyResults?: boolean;
|
|
@@ -73,6 +73,10 @@ export type SearchResultEventCallbacks = {
|
|
|
73
73
|
onSortChange?: (context: SortCallbackContext) => unknown;
|
|
74
74
|
onMounted?: () => unknown;
|
|
75
75
|
};
|
|
76
|
+
export type SearchResultsAriaLabels = {
|
|
77
|
+
pageSizeSelect?: string;
|
|
78
|
+
sortBySelect?: string;
|
|
79
|
+
};
|
|
76
80
|
export type SearchResultsOptionLabels = SearchResultsPaginationLabels & SearchResultsDidYouMeanLabels & SearchResultsSimilarQueriesLabels & SearchResultsSimilarResultsLabels & {
|
|
77
81
|
sortBy: string;
|
|
78
82
|
currency?: string;
|
|
@@ -93,6 +97,7 @@ export type SearchResultsOptionLabels = SearchResultsPaginationLabels & SearchRe
|
|
|
93
97
|
toolbarRightLabel?: string;
|
|
94
98
|
toolbarLeftLabel?: string;
|
|
95
99
|
refinersLoadingNotice?: string;
|
|
100
|
+
aria?: SearchResultsAriaLabels;
|
|
96
101
|
};
|
|
97
102
|
export type SearchResultsAdditionalPanels = {
|
|
98
103
|
additionalPanels?: SearchResultsAdditionalPanelOptions[];
|
|
@@ -234,6 +239,10 @@ export type ResultFacetOptions = {
|
|
|
234
239
|
exclude?: string[];
|
|
235
240
|
excludeValues?: Record<string, Record<string, string[]>>;
|
|
236
241
|
expand?: string[];
|
|
242
|
+
expandAll?: {
|
|
243
|
+
desktop?: boolean;
|
|
244
|
+
mobile?: boolean;
|
|
245
|
+
};
|
|
237
246
|
facetFilterQueries?: Record<string, FacetFilterQuery>;
|
|
238
247
|
};
|
|
239
248
|
export type SearchResultsFilterOptions = {
|
|
@@ -3,7 +3,7 @@ import { FilterType } from '../types/search-results/Filters';
|
|
|
3
3
|
import { FilterGroup } from '@getlupa/client-sdk/Types';
|
|
4
4
|
import { LupaQueryParamValue } from '../types/General';
|
|
5
5
|
type AppendParams = ({ params, paramsToRemove, encode }: {
|
|
6
|
-
params
|
|
6
|
+
params?: {
|
|
7
7
|
name: string;
|
|
8
8
|
value: string | string[];
|
|
9
9
|
}[];
|
|
@@ -17,7 +17,7 @@ export declare const getFacetParam: (key: string, value: string[] | string, type
|
|
|
17
17
|
};
|
|
18
18
|
export declare const toggleTermFilter: (appendParams: AppendParams, facetAction: TermFacetAction, getQueryParamName?: (param: LupaQueryParamValue) => string, currentFilters?: FilterGroup, paramsToRemove?: string[]) => void;
|
|
19
19
|
export declare const toggleHierarchyFilter: (appendParams: AppendParams, facetAction: HierarchyFacetAction, getQueryParamName?: (param: LupaQueryParamValue) => string, currentFilters?: FilterGroup, removeAllLevels?: boolean) => void;
|
|
20
|
-
export declare const toggleRangeFilter: (appendParams: AppendParams, facetAction: RangeFacetAction, getQueryParamName?: (param: LupaQueryParamValue) => string, currentFilters?: FilterGroup) => void;
|
|
20
|
+
export declare const toggleRangeFilter: (appendParams: AppendParams, removeParameters: AppendParams, facetAction: RangeFacetAction, getQueryParamName?: (param: LupaQueryParamValue) => string, currentFilters?: FilterGroup) => void;
|
|
21
21
|
export declare const toggleTermParam: (params?: string[], param?: string) => string[];
|
|
22
22
|
export declare const toggleLastPram: (params?: string[], param?: string) => string[];
|
|
23
23
|
export declare const toggleHierarchyParam: (params?: string[], param?: string, removeAllLevels?: boolean) => string[];
|