@getlupa/client 1.21.1 → 1.21.3
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/constants/searchResults.const.d.ts +0 -7
- package/dist/lupaSearch.iife.js +58 -18
- package/dist/lupaSearch.js +58 -18
- package/dist/lupaSearch.mjs +58 -18
- package/dist/lupaSearch.umd.js +58 -18
- package/package.json +2 -2
package/dist/lupaSearch.iife.js
CHANGED
|
@@ -18643,13 +18643,13 @@ var __async = (__this, __arguments, generator) => {
|
|
|
18643
18643
|
}
|
|
18644
18644
|
];
|
|
18645
18645
|
}
|
|
18646
|
-
return [{ key, value: `${gt} - ${lt}`, type: "range" }];
|
|
18646
|
+
return [{ key, value: `${gt != null ? gt : "*"} - ${lt != null ? lt : "*"}`, type: "range" }];
|
|
18647
18647
|
};
|
|
18648
18648
|
const unfoldFilter = (key, filter, price = {}) => {
|
|
18649
18649
|
if (Array.isArray(filter)) {
|
|
18650
18650
|
return unfoldTermFilter(key, filter);
|
|
18651
18651
|
}
|
|
18652
|
-
if (filter.gte) {
|
|
18652
|
+
if (filter.gte || filter.lte || filter.gt || filter.lt) {
|
|
18653
18653
|
return unfoldRangeFilter(key, filter, price);
|
|
18654
18654
|
}
|
|
18655
18655
|
if (filter.terms) {
|
|
@@ -18702,8 +18702,9 @@ var __async = (__this, __arguments, generator) => {
|
|
|
18702
18702
|
}) : void 0;
|
|
18703
18703
|
};
|
|
18704
18704
|
const rangeFilterToString = (rangeFilter, separator) => {
|
|
18705
|
+
var _a25, _b25, _c;
|
|
18705
18706
|
separator = separator || FACET_TERM_RANGE_SEPARATOR;
|
|
18706
|
-
return rangeFilter && Object.keys(rangeFilter).length ? rangeFilter.gte + separator + (rangeFilter.lte || rangeFilter.lt) : "";
|
|
18707
|
+
return rangeFilter && Object.keys(rangeFilter).length ? ((_a25 = rangeFilter.gte) != null ? _a25 : "") + separator + (((_b25 = rangeFilter.lte) != null ? _b25 : "") || ((_c = rangeFilter.lt) != null ? _c : "")) : "";
|
|
18707
18708
|
};
|
|
18708
18709
|
const pick = (obj, keys) => {
|
|
18709
18710
|
const ret = /* @__PURE__ */ Object.create({});
|
|
@@ -18762,14 +18763,15 @@ var __async = (__this, __arguments, generator) => {
|
|
|
18762
18763
|
return (_b25 = (_a25 = searchParams.getAll(key)) == null ? void 0 : _a25.map((v) => decodeURIComponent(v))) != null ? _b25 : [];
|
|
18763
18764
|
}
|
|
18764
18765
|
if (key.startsWith(FACET_PARAMS_TYPE.RANGE)) {
|
|
18766
|
+
const isPrice = key == null ? void 0 : key.includes(CURRENCY_KEY_INDICATOR);
|
|
18765
18767
|
const range2 = searchParams.get(key);
|
|
18766
18768
|
if (!range2) {
|
|
18767
18769
|
return {};
|
|
18768
18770
|
}
|
|
18769
18771
|
const [min, max] = range2.split(FACET_RANGE_SEPARATOR);
|
|
18770
18772
|
return {
|
|
18771
|
-
gte: min,
|
|
18772
|
-
lte: max
|
|
18773
|
+
gte: min || void 0,
|
|
18774
|
+
[isPrice ? "lte" : "lt"]: max || void 0
|
|
18773
18775
|
};
|
|
18774
18776
|
}
|
|
18775
18777
|
if (key.startsWith(FACET_PARAMS_TYPE.HIERARCHY)) {
|
|
@@ -18969,16 +18971,27 @@ var __async = (__this, __arguments, generator) => {
|
|
|
18969
18971
|
paramsToRemove: [getQueryParamName ? getQueryParamName(QUERY_PARAMS$1.PAGE) : QUERY_PARAMS$1.PAGE]
|
|
18970
18972
|
});
|
|
18971
18973
|
};
|
|
18972
|
-
const toggleRangeFilter = (appendParams, facetAction, getQueryParamName, currentFilters) => {
|
|
18974
|
+
const toggleRangeFilter = (appendParams, removeParameters, facetAction, getQueryParamName, currentFilters) => {
|
|
18975
|
+
var _a25, _b25;
|
|
18973
18976
|
const currentFilter = rangeFilterToString(
|
|
18974
18977
|
currentFilters == null ? void 0 : currentFilters[facetAction.key],
|
|
18975
18978
|
FACET_RANGE_SEPARATOR
|
|
18976
18979
|
);
|
|
18977
|
-
let facetValue = facetAction.value.join(FACET_RANGE_SEPARATOR);
|
|
18980
|
+
let facetValue = (_b25 = (_a25 = facetAction == null ? void 0 : facetAction.value) == null ? void 0 : _a25.join(FACET_RANGE_SEPARATOR)) != null ? _b25 : "";
|
|
18978
18981
|
facetValue = currentFilter === facetValue ? "" : facetValue;
|
|
18982
|
+
const paramsToRemove = getQueryParamName ? [getQueryParamName(QUERY_PARAMS$1.PAGE)] : [QUERY_PARAMS$1.PAGE];
|
|
18983
|
+
if (!facetValue) {
|
|
18984
|
+
removeParameters({
|
|
18985
|
+
paramsToRemove: [
|
|
18986
|
+
getFacetParam(facetAction.key, "", FACET_PARAMS_TYPE.RANGE).name,
|
|
18987
|
+
...paramsToRemove
|
|
18988
|
+
]
|
|
18989
|
+
});
|
|
18990
|
+
return;
|
|
18991
|
+
}
|
|
18979
18992
|
appendParams({
|
|
18980
18993
|
params: [getFacetParam(facetAction.key, facetValue, FACET_PARAMS_TYPE.RANGE)],
|
|
18981
|
-
paramsToRemove
|
|
18994
|
+
paramsToRemove,
|
|
18982
18995
|
encode: false
|
|
18983
18996
|
});
|
|
18984
18997
|
};
|
|
@@ -30506,6 +30519,13 @@ and ensure you are accounting for this risk.
|
|
|
30506
30519
|
const { addToCartAmount } = storeToRefs(searchResultStore);
|
|
30507
30520
|
const emit2 = __emit;
|
|
30508
30521
|
const loading = ref(false);
|
|
30522
|
+
const addToCartButtonClass = computed(() => {
|
|
30523
|
+
return {
|
|
30524
|
+
[props.options.className]: Boolean(props.options.className),
|
|
30525
|
+
"lupa-add-to-cart-loading": loading.value,
|
|
30526
|
+
"lupa-add-to-cart": !loading.value
|
|
30527
|
+
};
|
|
30528
|
+
});
|
|
30509
30529
|
const label = computed(() => {
|
|
30510
30530
|
return props.options.labels.addToCart;
|
|
30511
30531
|
});
|
|
@@ -30529,7 +30549,7 @@ and ensure you are accounting for this risk.
|
|
|
30529
30549
|
createBaseVNode("div", _hoisted_2$O, [
|
|
30530
30550
|
hasLink.value ? (openBlock(), createElementBlock("button", mergeProps({
|
|
30531
30551
|
key: 0,
|
|
30532
|
-
class:
|
|
30552
|
+
class: addToCartButtonClass.value,
|
|
30533
30553
|
"data-cy": "lupa-add-to-cart",
|
|
30534
30554
|
disabled: !inStockValue.value || loading.value
|
|
30535
30555
|
}, _ctx.dynamicAttributes, { onClick: handleClick }), [
|
|
@@ -30537,7 +30557,7 @@ and ensure you are accounting for this risk.
|
|
|
30537
30557
|
], 16, _hoisted_3$A)) : (openBlock(), createElementBlock("button", mergeProps({
|
|
30538
30558
|
key: 1,
|
|
30539
30559
|
onClick: withModifiers(handleClick, ["stop", "prevent"]),
|
|
30540
|
-
class:
|
|
30560
|
+
class: addToCartButtonClass.value,
|
|
30541
30561
|
"data-cy": "lupa-add-to-cart",
|
|
30542
30562
|
type: "button",
|
|
30543
30563
|
disabled: !inStockValue.value || loading.value
|
|
@@ -32943,7 +32963,7 @@ and ensure you are accounting for this risk.
|
|
|
32943
32963
|
});
|
|
32944
32964
|
const handleFacetClick = (item) => {
|
|
32945
32965
|
var _a25;
|
|
32946
|
-
const value = isRange.value ? item.
|
|
32966
|
+
const value = isRange.value ? [item.from, item.to] : (_a25 = item.title) == null ? void 0 : _a25.toString();
|
|
32947
32967
|
emit2("select", {
|
|
32948
32968
|
key: facet.value.key,
|
|
32949
32969
|
value,
|
|
@@ -32957,7 +32977,11 @@ and ensure you are accounting for this risk.
|
|
|
32957
32977
|
var _a25, _b25;
|
|
32958
32978
|
let selectedItems = (_a25 = currentFiltersValue.value) != null ? _a25 : [];
|
|
32959
32979
|
selectedItems = isRange.value && selectedItems ? [rangeFilterToString(selectedItems)] : selectedItems;
|
|
32960
|
-
|
|
32980
|
+
if (isRange.value) {
|
|
32981
|
+
return selectedItems == null ? void 0 : selectedItems.includes(rangeFilterToString({ gte: item.from, lt: item.to }));
|
|
32982
|
+
} else {
|
|
32983
|
+
return selectedItems == null ? void 0 : selectedItems.includes((_b25 = item.title) == null ? void 0 : _b25.toString());
|
|
32984
|
+
}
|
|
32961
32985
|
};
|
|
32962
32986
|
const getItemLabel = (item) => {
|
|
32963
32987
|
var _a25;
|
|
@@ -34431,7 +34455,7 @@ and ensure you are accounting for this risk.
|
|
|
34431
34455
|
},
|
|
34432
34456
|
emits: ["select", "clear"],
|
|
34433
34457
|
setup(__props, { emit: __emit }) {
|
|
34434
|
-
var _a25, _b25;
|
|
34458
|
+
var _a25, _b25, _c;
|
|
34435
34459
|
const props = __props;
|
|
34436
34460
|
const facet = computed(() => {
|
|
34437
34461
|
var _a26;
|
|
@@ -34443,10 +34467,19 @@ and ensure you are accounting for this risk.
|
|
|
34443
34467
|
});
|
|
34444
34468
|
const searchResultStore = useSearchResultStore();
|
|
34445
34469
|
const optionsStore = useOptionsStore();
|
|
34470
|
+
const screenStore = useScreenStore();
|
|
34446
34471
|
const { currentFilterKeys } = storeToRefs(searchResultStore);
|
|
34447
34472
|
const { searchResultOptions } = storeToRefs(optionsStore);
|
|
34473
|
+
const { isMobileWidth } = storeToRefs(screenStore);
|
|
34448
34474
|
const emit2 = __emit;
|
|
34449
|
-
const
|
|
34475
|
+
const allExpanded = computed(() => {
|
|
34476
|
+
var _a26, _b26, _c2, _d, _e, _f;
|
|
34477
|
+
if (isMobileWidth.value) {
|
|
34478
|
+
return (_c2 = (_b26 = (_a26 = props.options) == null ? void 0 : _a26.expandAll) == null ? void 0 : _b26.mobile) != null ? _c2 : false;
|
|
34479
|
+
}
|
|
34480
|
+
return (_f = (_e = (_d = props.options) == null ? void 0 : _d.expandAll) == null ? void 0 : _e.desktop) != null ? _f : false;
|
|
34481
|
+
});
|
|
34482
|
+
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);
|
|
34450
34483
|
const facetPanel = ref(null);
|
|
34451
34484
|
const facetType = computed(() => {
|
|
34452
34485
|
switch (facet.value.type) {
|
|
@@ -34709,6 +34742,7 @@ and ensure you are accounting for this risk.
|
|
|
34709
34742
|
case "range":
|
|
34710
34743
|
toggleRangeFilter(
|
|
34711
34744
|
paramStore.appendParams,
|
|
34745
|
+
paramStore.removeParameters,
|
|
34712
34746
|
facetAction,
|
|
34713
34747
|
optionsStore.getQueryParamName,
|
|
34714
34748
|
filters.value
|
|
@@ -35866,6 +35900,13 @@ and ensure you are accounting for this risk.
|
|
|
35866
35900
|
const hasLink = computed(() => {
|
|
35867
35901
|
return Boolean(props.link && props.options.link);
|
|
35868
35902
|
});
|
|
35903
|
+
const addToCartButtonClass = computed(() => {
|
|
35904
|
+
return {
|
|
35905
|
+
[props.options.className]: Boolean(props.options.className),
|
|
35906
|
+
"lupa-add-to-cart-loading": loading.value,
|
|
35907
|
+
"lupa-add-to-cart": !loading.value
|
|
35908
|
+
};
|
|
35909
|
+
});
|
|
35869
35910
|
const handleClick = (e2) => __async2(null, null, function* () {
|
|
35870
35911
|
if (productCardIsClickable.value && !hasLink.value) {
|
|
35871
35912
|
e2.preventDefault();
|
|
@@ -35886,7 +35927,7 @@ and ensure you are accounting for this risk.
|
|
|
35886
35927
|
createBaseVNode("div", _hoisted_2$o, [
|
|
35887
35928
|
hasLink.value ? (openBlock(), createElementBlock("button", mergeProps({
|
|
35888
35929
|
key: 0,
|
|
35889
|
-
class:
|
|
35930
|
+
class: addToCartButtonClass.value,
|
|
35890
35931
|
"data-cy": "lupa-add-to-cart",
|
|
35891
35932
|
disabled: !inStockValue.value || loading.value
|
|
35892
35933
|
}, _ctx.dynamicAttributes, { onClick: handleClick }), [
|
|
@@ -35894,7 +35935,7 @@ and ensure you are accounting for this risk.
|
|
|
35894
35935
|
], 16, _hoisted_3$g)) : (openBlock(), createElementBlock("button", mergeProps({
|
|
35895
35936
|
key: 1,
|
|
35896
35937
|
id: id.value,
|
|
35897
|
-
class:
|
|
35938
|
+
class: addToCartButtonClass.value,
|
|
35898
35939
|
"data-cy": "lupa-add-to-cart",
|
|
35899
35940
|
disabled: !inStockValue.value || loading.value
|
|
35900
35941
|
}, _ctx.dynamicAttributes, {
|
|
@@ -46487,8 +46528,7 @@ and ensure you are accounting for this risk.
|
|
|
46487
46528
|
links: {
|
|
46488
46529
|
details: "/{id}"
|
|
46489
46530
|
},
|
|
46490
|
-
elements: []
|
|
46491
|
-
breadcrumbs: [{ label: "Main Page", link: "/" }, { label: "Search: {1}" }]
|
|
46531
|
+
elements: []
|
|
46492
46532
|
};
|
|
46493
46533
|
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
46494
46534
|
__name: "SearchResultsEntry",
|
package/dist/lupaSearch.js
CHANGED
|
@@ -18643,13 +18643,13 @@ const unfoldRangeFilter = (key, filter, price = {}) => {
|
|
|
18643
18643
|
}
|
|
18644
18644
|
];
|
|
18645
18645
|
}
|
|
18646
|
-
return [{ key, value: `${gt} - ${lt}`, type: "range" }];
|
|
18646
|
+
return [{ key, value: `${gt != null ? gt : "*"} - ${lt != null ? lt : "*"}`, type: "range" }];
|
|
18647
18647
|
};
|
|
18648
18648
|
const unfoldFilter = (key, filter, price = {}) => {
|
|
18649
18649
|
if (Array.isArray(filter)) {
|
|
18650
18650
|
return unfoldTermFilter(key, filter);
|
|
18651
18651
|
}
|
|
18652
|
-
if (filter.gte) {
|
|
18652
|
+
if (filter.gte || filter.lte || filter.gt || filter.lt) {
|
|
18653
18653
|
return unfoldRangeFilter(key, filter, price);
|
|
18654
18654
|
}
|
|
18655
18655
|
if (filter.terms) {
|
|
@@ -18702,8 +18702,9 @@ const recursiveFilterItem = (item, query = "") => {
|
|
|
18702
18702
|
}) : void 0;
|
|
18703
18703
|
};
|
|
18704
18704
|
const rangeFilterToString = (rangeFilter, separator) => {
|
|
18705
|
+
var _a25, _b25, _c;
|
|
18705
18706
|
separator = separator || FACET_TERM_RANGE_SEPARATOR;
|
|
18706
|
-
return rangeFilter && Object.keys(rangeFilter).length ? rangeFilter.gte + separator + (rangeFilter.lte || rangeFilter.lt) : "";
|
|
18707
|
+
return rangeFilter && Object.keys(rangeFilter).length ? ((_a25 = rangeFilter.gte) != null ? _a25 : "") + separator + (((_b25 = rangeFilter.lte) != null ? _b25 : "") || ((_c = rangeFilter.lt) != null ? _c : "")) : "";
|
|
18707
18708
|
};
|
|
18708
18709
|
const pick = (obj, keys) => {
|
|
18709
18710
|
const ret = /* @__PURE__ */ Object.create({});
|
|
@@ -18762,14 +18763,15 @@ const parseFacetKey = (key, searchParams) => {
|
|
|
18762
18763
|
return (_b25 = (_a25 = searchParams.getAll(key)) == null ? void 0 : _a25.map((v) => decodeURIComponent(v))) != null ? _b25 : [];
|
|
18763
18764
|
}
|
|
18764
18765
|
if (key.startsWith(FACET_PARAMS_TYPE.RANGE)) {
|
|
18766
|
+
const isPrice = key == null ? void 0 : key.includes(CURRENCY_KEY_INDICATOR);
|
|
18765
18767
|
const range2 = searchParams.get(key);
|
|
18766
18768
|
if (!range2) {
|
|
18767
18769
|
return {};
|
|
18768
18770
|
}
|
|
18769
18771
|
const [min, max] = range2.split(FACET_RANGE_SEPARATOR);
|
|
18770
18772
|
return {
|
|
18771
|
-
gte: min,
|
|
18772
|
-
lte: max
|
|
18773
|
+
gte: min || void 0,
|
|
18774
|
+
[isPrice ? "lte" : "lt"]: max || void 0
|
|
18773
18775
|
};
|
|
18774
18776
|
}
|
|
18775
18777
|
if (key.startsWith(FACET_PARAMS_TYPE.HIERARCHY)) {
|
|
@@ -18969,16 +18971,27 @@ const toggleHierarchyFilter = (appendParams, facetAction, getQueryParamName, cur
|
|
|
18969
18971
|
paramsToRemove: [getQueryParamName ? getQueryParamName(QUERY_PARAMS$1.PAGE) : QUERY_PARAMS$1.PAGE]
|
|
18970
18972
|
});
|
|
18971
18973
|
};
|
|
18972
|
-
const toggleRangeFilter = (appendParams, facetAction, getQueryParamName, currentFilters) => {
|
|
18974
|
+
const toggleRangeFilter = (appendParams, removeParameters, facetAction, getQueryParamName, currentFilters) => {
|
|
18975
|
+
var _a25, _b25;
|
|
18973
18976
|
const currentFilter = rangeFilterToString(
|
|
18974
18977
|
currentFilters == null ? void 0 : currentFilters[facetAction.key],
|
|
18975
18978
|
FACET_RANGE_SEPARATOR
|
|
18976
18979
|
);
|
|
18977
|
-
let facetValue = facetAction.value.join(FACET_RANGE_SEPARATOR);
|
|
18980
|
+
let facetValue = (_b25 = (_a25 = facetAction == null ? void 0 : facetAction.value) == null ? void 0 : _a25.join(FACET_RANGE_SEPARATOR)) != null ? _b25 : "";
|
|
18978
18981
|
facetValue = currentFilter === facetValue ? "" : facetValue;
|
|
18982
|
+
const paramsToRemove = getQueryParamName ? [getQueryParamName(QUERY_PARAMS$1.PAGE)] : [QUERY_PARAMS$1.PAGE];
|
|
18983
|
+
if (!facetValue) {
|
|
18984
|
+
removeParameters({
|
|
18985
|
+
paramsToRemove: [
|
|
18986
|
+
getFacetParam(facetAction.key, "", FACET_PARAMS_TYPE.RANGE).name,
|
|
18987
|
+
...paramsToRemove
|
|
18988
|
+
]
|
|
18989
|
+
});
|
|
18990
|
+
return;
|
|
18991
|
+
}
|
|
18979
18992
|
appendParams({
|
|
18980
18993
|
params: [getFacetParam(facetAction.key, facetValue, FACET_PARAMS_TYPE.RANGE)],
|
|
18981
|
-
paramsToRemove
|
|
18994
|
+
paramsToRemove,
|
|
18982
18995
|
encode: false
|
|
18983
18996
|
});
|
|
18984
18997
|
};
|
|
@@ -30506,6 +30519,13 @@ const _sfc_main$1i = /* @__PURE__ */ defineComponent({
|
|
|
30506
30519
|
const { addToCartAmount } = storeToRefs(searchResultStore);
|
|
30507
30520
|
const emit2 = __emit;
|
|
30508
30521
|
const loading = ref(false);
|
|
30522
|
+
const addToCartButtonClass = computed(() => {
|
|
30523
|
+
return {
|
|
30524
|
+
[props.options.className]: Boolean(props.options.className),
|
|
30525
|
+
"lupa-add-to-cart-loading": loading.value,
|
|
30526
|
+
"lupa-add-to-cart": !loading.value
|
|
30527
|
+
};
|
|
30528
|
+
});
|
|
30509
30529
|
const label = computed(() => {
|
|
30510
30530
|
return props.options.labels.addToCart;
|
|
30511
30531
|
});
|
|
@@ -30529,7 +30549,7 @@ const _sfc_main$1i = /* @__PURE__ */ defineComponent({
|
|
|
30529
30549
|
createBaseVNode("div", _hoisted_2$O, [
|
|
30530
30550
|
hasLink.value ? (openBlock(), createElementBlock("button", mergeProps({
|
|
30531
30551
|
key: 0,
|
|
30532
|
-
class:
|
|
30552
|
+
class: addToCartButtonClass.value,
|
|
30533
30553
|
"data-cy": "lupa-add-to-cart",
|
|
30534
30554
|
disabled: !inStockValue.value || loading.value
|
|
30535
30555
|
}, _ctx.dynamicAttributes, { onClick: handleClick }), [
|
|
@@ -30537,7 +30557,7 @@ const _sfc_main$1i = /* @__PURE__ */ defineComponent({
|
|
|
30537
30557
|
], 16, _hoisted_3$A)) : (openBlock(), createElementBlock("button", mergeProps({
|
|
30538
30558
|
key: 1,
|
|
30539
30559
|
onClick: withModifiers(handleClick, ["stop", "prevent"]),
|
|
30540
|
-
class:
|
|
30560
|
+
class: addToCartButtonClass.value,
|
|
30541
30561
|
"data-cy": "lupa-add-to-cart",
|
|
30542
30562
|
type: "button",
|
|
30543
30563
|
disabled: !inStockValue.value || loading.value
|
|
@@ -32943,7 +32963,7 @@ const _sfc_main$X = /* @__PURE__ */ defineComponent({
|
|
|
32943
32963
|
});
|
|
32944
32964
|
const handleFacetClick = (item) => {
|
|
32945
32965
|
var _a25;
|
|
32946
|
-
const value = isRange.value ? item.
|
|
32966
|
+
const value = isRange.value ? [item.from, item.to] : (_a25 = item.title) == null ? void 0 : _a25.toString();
|
|
32947
32967
|
emit2("select", {
|
|
32948
32968
|
key: facet.value.key,
|
|
32949
32969
|
value,
|
|
@@ -32957,7 +32977,11 @@ const _sfc_main$X = /* @__PURE__ */ defineComponent({
|
|
|
32957
32977
|
var _a25, _b25;
|
|
32958
32978
|
let selectedItems = (_a25 = currentFiltersValue.value) != null ? _a25 : [];
|
|
32959
32979
|
selectedItems = isRange.value && selectedItems ? [rangeFilterToString(selectedItems)] : selectedItems;
|
|
32960
|
-
|
|
32980
|
+
if (isRange.value) {
|
|
32981
|
+
return selectedItems == null ? void 0 : selectedItems.includes(rangeFilterToString({ gte: item.from, lt: item.to }));
|
|
32982
|
+
} else {
|
|
32983
|
+
return selectedItems == null ? void 0 : selectedItems.includes((_b25 = item.title) == null ? void 0 : _b25.toString());
|
|
32984
|
+
}
|
|
32961
32985
|
};
|
|
32962
32986
|
const getItemLabel = (item) => {
|
|
32963
32987
|
var _a25;
|
|
@@ -34431,7 +34455,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
|
|
|
34431
34455
|
},
|
|
34432
34456
|
emits: ["select", "clear"],
|
|
34433
34457
|
setup(__props, { emit: __emit }) {
|
|
34434
|
-
var _a25, _b25;
|
|
34458
|
+
var _a25, _b25, _c;
|
|
34435
34459
|
const props = __props;
|
|
34436
34460
|
const facet = computed(() => {
|
|
34437
34461
|
var _a26;
|
|
@@ -34443,10 +34467,19 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
|
|
|
34443
34467
|
});
|
|
34444
34468
|
const searchResultStore = useSearchResultStore();
|
|
34445
34469
|
const optionsStore = useOptionsStore();
|
|
34470
|
+
const screenStore = useScreenStore();
|
|
34446
34471
|
const { currentFilterKeys } = storeToRefs(searchResultStore);
|
|
34447
34472
|
const { searchResultOptions } = storeToRefs(optionsStore);
|
|
34473
|
+
const { isMobileWidth } = storeToRefs(screenStore);
|
|
34448
34474
|
const emit2 = __emit;
|
|
34449
|
-
const
|
|
34475
|
+
const allExpanded = computed(() => {
|
|
34476
|
+
var _a26, _b26, _c2, _d, _e, _f;
|
|
34477
|
+
if (isMobileWidth.value) {
|
|
34478
|
+
return (_c2 = (_b26 = (_a26 = props.options) == null ? void 0 : _a26.expandAll) == null ? void 0 : _b26.mobile) != null ? _c2 : false;
|
|
34479
|
+
}
|
|
34480
|
+
return (_f = (_e = (_d = props.options) == null ? void 0 : _d.expandAll) == null ? void 0 : _e.desktop) != null ? _f : false;
|
|
34481
|
+
});
|
|
34482
|
+
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);
|
|
34450
34483
|
const facetPanel = ref(null);
|
|
34451
34484
|
const facetType = computed(() => {
|
|
34452
34485
|
switch (facet.value.type) {
|
|
@@ -34709,6 +34742,7 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
|
34709
34742
|
case "range":
|
|
34710
34743
|
toggleRangeFilter(
|
|
34711
34744
|
paramStore.appendParams,
|
|
34745
|
+
paramStore.removeParameters,
|
|
34712
34746
|
facetAction,
|
|
34713
34747
|
optionsStore.getQueryParamName,
|
|
34714
34748
|
filters.value
|
|
@@ -35866,6 +35900,13 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
35866
35900
|
const hasLink = computed(() => {
|
|
35867
35901
|
return Boolean(props.link && props.options.link);
|
|
35868
35902
|
});
|
|
35903
|
+
const addToCartButtonClass = computed(() => {
|
|
35904
|
+
return {
|
|
35905
|
+
[props.options.className]: Boolean(props.options.className),
|
|
35906
|
+
"lupa-add-to-cart-loading": loading.value,
|
|
35907
|
+
"lupa-add-to-cart": !loading.value
|
|
35908
|
+
};
|
|
35909
|
+
});
|
|
35869
35910
|
const handleClick = (e2) => __async2(null, null, function* () {
|
|
35870
35911
|
if (productCardIsClickable.value && !hasLink.value) {
|
|
35871
35912
|
e2.preventDefault();
|
|
@@ -35886,7 +35927,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
35886
35927
|
createBaseVNode("div", _hoisted_2$o, [
|
|
35887
35928
|
hasLink.value ? (openBlock(), createElementBlock("button", mergeProps({
|
|
35888
35929
|
key: 0,
|
|
35889
|
-
class:
|
|
35930
|
+
class: addToCartButtonClass.value,
|
|
35890
35931
|
"data-cy": "lupa-add-to-cart",
|
|
35891
35932
|
disabled: !inStockValue.value || loading.value
|
|
35892
35933
|
}, _ctx.dynamicAttributes, { onClick: handleClick }), [
|
|
@@ -35894,7 +35935,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
35894
35935
|
], 16, _hoisted_3$g)) : (openBlock(), createElementBlock("button", mergeProps({
|
|
35895
35936
|
key: 1,
|
|
35896
35937
|
id: id.value,
|
|
35897
|
-
class:
|
|
35938
|
+
class: addToCartButtonClass.value,
|
|
35898
35939
|
"data-cy": "lupa-add-to-cart",
|
|
35899
35940
|
disabled: !inStockValue.value || loading.value
|
|
35900
35941
|
}, _ctx.dynamicAttributes, {
|
|
@@ -46487,8 +46528,7 @@ const DEFAULT_OPTIONS_RESULTS = {
|
|
|
46487
46528
|
links: {
|
|
46488
46529
|
details: "/{id}"
|
|
46489
46530
|
},
|
|
46490
|
-
elements: []
|
|
46491
|
-
breadcrumbs: [{ label: "Main Page", link: "/" }, { label: "Search: {1}" }]
|
|
46531
|
+
elements: []
|
|
46492
46532
|
};
|
|
46493
46533
|
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
46494
46534
|
__name: "SearchResultsEntry",
|
package/dist/lupaSearch.mjs
CHANGED
|
@@ -18641,13 +18641,13 @@ const unfoldRangeFilter = (key, filter, price = {}) => {
|
|
|
18641
18641
|
}
|
|
18642
18642
|
];
|
|
18643
18643
|
}
|
|
18644
|
-
return [{ key, value: `${gt} - ${lt}`, type: "range" }];
|
|
18644
|
+
return [{ key, value: `${gt != null ? gt : "*"} - ${lt != null ? lt : "*"}`, type: "range" }];
|
|
18645
18645
|
};
|
|
18646
18646
|
const unfoldFilter = (key, filter, price = {}) => {
|
|
18647
18647
|
if (Array.isArray(filter)) {
|
|
18648
18648
|
return unfoldTermFilter(key, filter);
|
|
18649
18649
|
}
|
|
18650
|
-
if (filter.gte) {
|
|
18650
|
+
if (filter.gte || filter.lte || filter.gt || filter.lt) {
|
|
18651
18651
|
return unfoldRangeFilter(key, filter, price);
|
|
18652
18652
|
}
|
|
18653
18653
|
if (filter.terms) {
|
|
@@ -18700,8 +18700,9 @@ const recursiveFilterItem = (item, query = "") => {
|
|
|
18700
18700
|
}) : void 0;
|
|
18701
18701
|
};
|
|
18702
18702
|
const rangeFilterToString = (rangeFilter, separator) => {
|
|
18703
|
+
var _a25, _b25, _c;
|
|
18703
18704
|
separator = separator || FACET_TERM_RANGE_SEPARATOR;
|
|
18704
|
-
return rangeFilter && Object.keys(rangeFilter).length ? rangeFilter.gte + separator + (rangeFilter.lte || rangeFilter.lt) : "";
|
|
18705
|
+
return rangeFilter && Object.keys(rangeFilter).length ? ((_a25 = rangeFilter.gte) != null ? _a25 : "") + separator + (((_b25 = rangeFilter.lte) != null ? _b25 : "") || ((_c = rangeFilter.lt) != null ? _c : "")) : "";
|
|
18705
18706
|
};
|
|
18706
18707
|
const pick = (obj, keys) => {
|
|
18707
18708
|
const ret = /* @__PURE__ */ Object.create({});
|
|
@@ -18760,14 +18761,15 @@ const parseFacetKey = (key, searchParams) => {
|
|
|
18760
18761
|
return (_b25 = (_a25 = searchParams.getAll(key)) == null ? void 0 : _a25.map((v) => decodeURIComponent(v))) != null ? _b25 : [];
|
|
18761
18762
|
}
|
|
18762
18763
|
if (key.startsWith(FACET_PARAMS_TYPE.RANGE)) {
|
|
18764
|
+
const isPrice = key == null ? void 0 : key.includes(CURRENCY_KEY_INDICATOR);
|
|
18763
18765
|
const range2 = searchParams.get(key);
|
|
18764
18766
|
if (!range2) {
|
|
18765
18767
|
return {};
|
|
18766
18768
|
}
|
|
18767
18769
|
const [min, max] = range2.split(FACET_RANGE_SEPARATOR);
|
|
18768
18770
|
return {
|
|
18769
|
-
gte: min,
|
|
18770
|
-
lte: max
|
|
18771
|
+
gte: min || void 0,
|
|
18772
|
+
[isPrice ? "lte" : "lt"]: max || void 0
|
|
18771
18773
|
};
|
|
18772
18774
|
}
|
|
18773
18775
|
if (key.startsWith(FACET_PARAMS_TYPE.HIERARCHY)) {
|
|
@@ -18967,16 +18969,27 @@ const toggleHierarchyFilter = (appendParams, facetAction, getQueryParamName, cur
|
|
|
18967
18969
|
paramsToRemove: [getQueryParamName ? getQueryParamName(QUERY_PARAMS$1.PAGE) : QUERY_PARAMS$1.PAGE]
|
|
18968
18970
|
});
|
|
18969
18971
|
};
|
|
18970
|
-
const toggleRangeFilter = (appendParams, facetAction, getQueryParamName, currentFilters) => {
|
|
18972
|
+
const toggleRangeFilter = (appendParams, removeParameters, facetAction, getQueryParamName, currentFilters) => {
|
|
18973
|
+
var _a25, _b25;
|
|
18971
18974
|
const currentFilter = rangeFilterToString(
|
|
18972
18975
|
currentFilters == null ? void 0 : currentFilters[facetAction.key],
|
|
18973
18976
|
FACET_RANGE_SEPARATOR
|
|
18974
18977
|
);
|
|
18975
|
-
let facetValue = facetAction.value.join(FACET_RANGE_SEPARATOR);
|
|
18978
|
+
let facetValue = (_b25 = (_a25 = facetAction == null ? void 0 : facetAction.value) == null ? void 0 : _a25.join(FACET_RANGE_SEPARATOR)) != null ? _b25 : "";
|
|
18976
18979
|
facetValue = currentFilter === facetValue ? "" : facetValue;
|
|
18980
|
+
const paramsToRemove = getQueryParamName ? [getQueryParamName(QUERY_PARAMS$1.PAGE)] : [QUERY_PARAMS$1.PAGE];
|
|
18981
|
+
if (!facetValue) {
|
|
18982
|
+
removeParameters({
|
|
18983
|
+
paramsToRemove: [
|
|
18984
|
+
getFacetParam(facetAction.key, "", FACET_PARAMS_TYPE.RANGE).name,
|
|
18985
|
+
...paramsToRemove
|
|
18986
|
+
]
|
|
18987
|
+
});
|
|
18988
|
+
return;
|
|
18989
|
+
}
|
|
18977
18990
|
appendParams({
|
|
18978
18991
|
params: [getFacetParam(facetAction.key, facetValue, FACET_PARAMS_TYPE.RANGE)],
|
|
18979
|
-
paramsToRemove
|
|
18992
|
+
paramsToRemove,
|
|
18980
18993
|
encode: false
|
|
18981
18994
|
});
|
|
18982
18995
|
};
|
|
@@ -30504,6 +30517,13 @@ const _sfc_main$1i = /* @__PURE__ */ defineComponent({
|
|
|
30504
30517
|
const { addToCartAmount } = storeToRefs(searchResultStore);
|
|
30505
30518
|
const emit2 = __emit;
|
|
30506
30519
|
const loading = ref(false);
|
|
30520
|
+
const addToCartButtonClass = computed(() => {
|
|
30521
|
+
return {
|
|
30522
|
+
[props.options.className]: Boolean(props.options.className),
|
|
30523
|
+
"lupa-add-to-cart-loading": loading.value,
|
|
30524
|
+
"lupa-add-to-cart": !loading.value
|
|
30525
|
+
};
|
|
30526
|
+
});
|
|
30507
30527
|
const label = computed(() => {
|
|
30508
30528
|
return props.options.labels.addToCart;
|
|
30509
30529
|
});
|
|
@@ -30527,7 +30547,7 @@ const _sfc_main$1i = /* @__PURE__ */ defineComponent({
|
|
|
30527
30547
|
createBaseVNode("div", _hoisted_2$O, [
|
|
30528
30548
|
hasLink.value ? (openBlock(), createElementBlock("button", mergeProps({
|
|
30529
30549
|
key: 0,
|
|
30530
|
-
class:
|
|
30550
|
+
class: addToCartButtonClass.value,
|
|
30531
30551
|
"data-cy": "lupa-add-to-cart",
|
|
30532
30552
|
disabled: !inStockValue.value || loading.value
|
|
30533
30553
|
}, _ctx.dynamicAttributes, { onClick: handleClick }), [
|
|
@@ -30535,7 +30555,7 @@ const _sfc_main$1i = /* @__PURE__ */ defineComponent({
|
|
|
30535
30555
|
], 16, _hoisted_3$A)) : (openBlock(), createElementBlock("button", mergeProps({
|
|
30536
30556
|
key: 1,
|
|
30537
30557
|
onClick: withModifiers(handleClick, ["stop", "prevent"]),
|
|
30538
|
-
class:
|
|
30558
|
+
class: addToCartButtonClass.value,
|
|
30539
30559
|
"data-cy": "lupa-add-to-cart",
|
|
30540
30560
|
type: "button",
|
|
30541
30561
|
disabled: !inStockValue.value || loading.value
|
|
@@ -32941,7 +32961,7 @@ const _sfc_main$X = /* @__PURE__ */ defineComponent({
|
|
|
32941
32961
|
});
|
|
32942
32962
|
const handleFacetClick = (item) => {
|
|
32943
32963
|
var _a25;
|
|
32944
|
-
const value = isRange.value ? item.
|
|
32964
|
+
const value = isRange.value ? [item.from, item.to] : (_a25 = item.title) == null ? void 0 : _a25.toString();
|
|
32945
32965
|
emit2("select", {
|
|
32946
32966
|
key: facet.value.key,
|
|
32947
32967
|
value,
|
|
@@ -32955,7 +32975,11 @@ const _sfc_main$X = /* @__PURE__ */ defineComponent({
|
|
|
32955
32975
|
var _a25, _b25;
|
|
32956
32976
|
let selectedItems = (_a25 = currentFiltersValue.value) != null ? _a25 : [];
|
|
32957
32977
|
selectedItems = isRange.value && selectedItems ? [rangeFilterToString(selectedItems)] : selectedItems;
|
|
32958
|
-
|
|
32978
|
+
if (isRange.value) {
|
|
32979
|
+
return selectedItems == null ? void 0 : selectedItems.includes(rangeFilterToString({ gte: item.from, lt: item.to }));
|
|
32980
|
+
} else {
|
|
32981
|
+
return selectedItems == null ? void 0 : selectedItems.includes((_b25 = item.title) == null ? void 0 : _b25.toString());
|
|
32982
|
+
}
|
|
32959
32983
|
};
|
|
32960
32984
|
const getItemLabel = (item) => {
|
|
32961
32985
|
var _a25;
|
|
@@ -34429,7 +34453,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
|
|
|
34429
34453
|
},
|
|
34430
34454
|
emits: ["select", "clear"],
|
|
34431
34455
|
setup(__props, { emit: __emit }) {
|
|
34432
|
-
var _a25, _b25;
|
|
34456
|
+
var _a25, _b25, _c;
|
|
34433
34457
|
const props = __props;
|
|
34434
34458
|
const facet = computed(() => {
|
|
34435
34459
|
var _a26;
|
|
@@ -34441,10 +34465,19 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
|
|
|
34441
34465
|
});
|
|
34442
34466
|
const searchResultStore = useSearchResultStore();
|
|
34443
34467
|
const optionsStore = useOptionsStore();
|
|
34468
|
+
const screenStore = useScreenStore();
|
|
34444
34469
|
const { currentFilterKeys } = storeToRefs(searchResultStore);
|
|
34445
34470
|
const { searchResultOptions } = storeToRefs(optionsStore);
|
|
34471
|
+
const { isMobileWidth } = storeToRefs(screenStore);
|
|
34446
34472
|
const emit2 = __emit;
|
|
34447
|
-
const
|
|
34473
|
+
const allExpanded = computed(() => {
|
|
34474
|
+
var _a26, _b26, _c2, _d, _e, _f;
|
|
34475
|
+
if (isMobileWidth.value) {
|
|
34476
|
+
return (_c2 = (_b26 = (_a26 = props.options) == null ? void 0 : _a26.expandAll) == null ? void 0 : _b26.mobile) != null ? _c2 : false;
|
|
34477
|
+
}
|
|
34478
|
+
return (_f = (_e = (_d = props.options) == null ? void 0 : _d.expandAll) == null ? void 0 : _e.desktop) != null ? _f : false;
|
|
34479
|
+
});
|
|
34480
|
+
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);
|
|
34448
34481
|
const facetPanel = ref(null);
|
|
34449
34482
|
const facetType = computed(() => {
|
|
34450
34483
|
switch (facet.value.type) {
|
|
@@ -34707,6 +34740,7 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
|
34707
34740
|
case "range":
|
|
34708
34741
|
toggleRangeFilter(
|
|
34709
34742
|
paramStore.appendParams,
|
|
34743
|
+
paramStore.removeParameters,
|
|
34710
34744
|
facetAction,
|
|
34711
34745
|
optionsStore.getQueryParamName,
|
|
34712
34746
|
filters.value
|
|
@@ -35864,6 +35898,13 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
35864
35898
|
const hasLink = computed(() => {
|
|
35865
35899
|
return Boolean(props.link && props.options.link);
|
|
35866
35900
|
});
|
|
35901
|
+
const addToCartButtonClass = computed(() => {
|
|
35902
|
+
return {
|
|
35903
|
+
[props.options.className]: Boolean(props.options.className),
|
|
35904
|
+
"lupa-add-to-cart-loading": loading.value,
|
|
35905
|
+
"lupa-add-to-cart": !loading.value
|
|
35906
|
+
};
|
|
35907
|
+
});
|
|
35867
35908
|
const handleClick = (e2) => __async2(null, null, function* () {
|
|
35868
35909
|
if (productCardIsClickable.value && !hasLink.value) {
|
|
35869
35910
|
e2.preventDefault();
|
|
@@ -35884,7 +35925,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
35884
35925
|
createBaseVNode("div", _hoisted_2$o, [
|
|
35885
35926
|
hasLink.value ? (openBlock(), createElementBlock("button", mergeProps({
|
|
35886
35927
|
key: 0,
|
|
35887
|
-
class:
|
|
35928
|
+
class: addToCartButtonClass.value,
|
|
35888
35929
|
"data-cy": "lupa-add-to-cart",
|
|
35889
35930
|
disabled: !inStockValue.value || loading.value
|
|
35890
35931
|
}, _ctx.dynamicAttributes, { onClick: handleClick }), [
|
|
@@ -35892,7 +35933,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
35892
35933
|
], 16, _hoisted_3$g)) : (openBlock(), createElementBlock("button", mergeProps({
|
|
35893
35934
|
key: 1,
|
|
35894
35935
|
id: id.value,
|
|
35895
|
-
class:
|
|
35936
|
+
class: addToCartButtonClass.value,
|
|
35896
35937
|
"data-cy": "lupa-add-to-cart",
|
|
35897
35938
|
disabled: !inStockValue.value || loading.value
|
|
35898
35939
|
}, _ctx.dynamicAttributes, {
|
|
@@ -46485,8 +46526,7 @@ const DEFAULT_OPTIONS_RESULTS = {
|
|
|
46485
46526
|
links: {
|
|
46486
46527
|
details: "/{id}"
|
|
46487
46528
|
},
|
|
46488
|
-
elements: []
|
|
46489
|
-
breadcrumbs: [{ label: "Main Page", link: "/" }, { label: "Search: {1}" }]
|
|
46529
|
+
elements: []
|
|
46490
46530
|
};
|
|
46491
46531
|
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
46492
46532
|
__name: "SearchResultsEntry",
|
package/dist/lupaSearch.umd.js
CHANGED
|
@@ -18645,13 +18645,13 @@ var __async = (__this, __arguments, generator) => {
|
|
|
18645
18645
|
}
|
|
18646
18646
|
];
|
|
18647
18647
|
}
|
|
18648
|
-
return [{ key, value: `${gt} - ${lt}`, type: "range" }];
|
|
18648
|
+
return [{ key, value: `${gt != null ? gt : "*"} - ${lt != null ? lt : "*"}`, type: "range" }];
|
|
18649
18649
|
};
|
|
18650
18650
|
const unfoldFilter = (key, filter, price = {}) => {
|
|
18651
18651
|
if (Array.isArray(filter)) {
|
|
18652
18652
|
return unfoldTermFilter(key, filter);
|
|
18653
18653
|
}
|
|
18654
|
-
if (filter.gte) {
|
|
18654
|
+
if (filter.gte || filter.lte || filter.gt || filter.lt) {
|
|
18655
18655
|
return unfoldRangeFilter(key, filter, price);
|
|
18656
18656
|
}
|
|
18657
18657
|
if (filter.terms) {
|
|
@@ -18704,8 +18704,9 @@ var __async = (__this, __arguments, generator) => {
|
|
|
18704
18704
|
}) : void 0;
|
|
18705
18705
|
};
|
|
18706
18706
|
const rangeFilterToString = (rangeFilter, separator) => {
|
|
18707
|
+
var _a25, _b25, _c;
|
|
18707
18708
|
separator = separator || FACET_TERM_RANGE_SEPARATOR;
|
|
18708
|
-
return rangeFilter && Object.keys(rangeFilter).length ? rangeFilter.gte + separator + (rangeFilter.lte || rangeFilter.lt) : "";
|
|
18709
|
+
return rangeFilter && Object.keys(rangeFilter).length ? ((_a25 = rangeFilter.gte) != null ? _a25 : "") + separator + (((_b25 = rangeFilter.lte) != null ? _b25 : "") || ((_c = rangeFilter.lt) != null ? _c : "")) : "";
|
|
18709
18710
|
};
|
|
18710
18711
|
const pick = (obj, keys) => {
|
|
18711
18712
|
const ret = /* @__PURE__ */ Object.create({});
|
|
@@ -18764,14 +18765,15 @@ var __async = (__this, __arguments, generator) => {
|
|
|
18764
18765
|
return (_b25 = (_a25 = searchParams.getAll(key)) == null ? void 0 : _a25.map((v) => decodeURIComponent(v))) != null ? _b25 : [];
|
|
18765
18766
|
}
|
|
18766
18767
|
if (key.startsWith(FACET_PARAMS_TYPE.RANGE)) {
|
|
18768
|
+
const isPrice = key == null ? void 0 : key.includes(CURRENCY_KEY_INDICATOR);
|
|
18767
18769
|
const range2 = searchParams.get(key);
|
|
18768
18770
|
if (!range2) {
|
|
18769
18771
|
return {};
|
|
18770
18772
|
}
|
|
18771
18773
|
const [min, max] = range2.split(FACET_RANGE_SEPARATOR);
|
|
18772
18774
|
return {
|
|
18773
|
-
gte: min,
|
|
18774
|
-
lte: max
|
|
18775
|
+
gte: min || void 0,
|
|
18776
|
+
[isPrice ? "lte" : "lt"]: max || void 0
|
|
18775
18777
|
};
|
|
18776
18778
|
}
|
|
18777
18779
|
if (key.startsWith(FACET_PARAMS_TYPE.HIERARCHY)) {
|
|
@@ -18971,16 +18973,27 @@ var __async = (__this, __arguments, generator) => {
|
|
|
18971
18973
|
paramsToRemove: [getQueryParamName ? getQueryParamName(QUERY_PARAMS$1.PAGE) : QUERY_PARAMS$1.PAGE]
|
|
18972
18974
|
});
|
|
18973
18975
|
};
|
|
18974
|
-
const toggleRangeFilter = (appendParams, facetAction, getQueryParamName, currentFilters) => {
|
|
18976
|
+
const toggleRangeFilter = (appendParams, removeParameters, facetAction, getQueryParamName, currentFilters) => {
|
|
18977
|
+
var _a25, _b25;
|
|
18975
18978
|
const currentFilter = rangeFilterToString(
|
|
18976
18979
|
currentFilters == null ? void 0 : currentFilters[facetAction.key],
|
|
18977
18980
|
FACET_RANGE_SEPARATOR
|
|
18978
18981
|
);
|
|
18979
|
-
let facetValue = facetAction.value.join(FACET_RANGE_SEPARATOR);
|
|
18982
|
+
let facetValue = (_b25 = (_a25 = facetAction == null ? void 0 : facetAction.value) == null ? void 0 : _a25.join(FACET_RANGE_SEPARATOR)) != null ? _b25 : "";
|
|
18980
18983
|
facetValue = currentFilter === facetValue ? "" : facetValue;
|
|
18984
|
+
const paramsToRemove = getQueryParamName ? [getQueryParamName(QUERY_PARAMS$1.PAGE)] : [QUERY_PARAMS$1.PAGE];
|
|
18985
|
+
if (!facetValue) {
|
|
18986
|
+
removeParameters({
|
|
18987
|
+
paramsToRemove: [
|
|
18988
|
+
getFacetParam(facetAction.key, "", FACET_PARAMS_TYPE.RANGE).name,
|
|
18989
|
+
...paramsToRemove
|
|
18990
|
+
]
|
|
18991
|
+
});
|
|
18992
|
+
return;
|
|
18993
|
+
}
|
|
18981
18994
|
appendParams({
|
|
18982
18995
|
params: [getFacetParam(facetAction.key, facetValue, FACET_PARAMS_TYPE.RANGE)],
|
|
18983
|
-
paramsToRemove
|
|
18996
|
+
paramsToRemove,
|
|
18984
18997
|
encode: false
|
|
18985
18998
|
});
|
|
18986
18999
|
};
|
|
@@ -30508,6 +30521,13 @@ and ensure you are accounting for this risk.
|
|
|
30508
30521
|
const { addToCartAmount } = storeToRefs(searchResultStore);
|
|
30509
30522
|
const emit2 = __emit;
|
|
30510
30523
|
const loading = ref(false);
|
|
30524
|
+
const addToCartButtonClass = computed(() => {
|
|
30525
|
+
return {
|
|
30526
|
+
[props.options.className]: Boolean(props.options.className),
|
|
30527
|
+
"lupa-add-to-cart-loading": loading.value,
|
|
30528
|
+
"lupa-add-to-cart": !loading.value
|
|
30529
|
+
};
|
|
30530
|
+
});
|
|
30511
30531
|
const label = computed(() => {
|
|
30512
30532
|
return props.options.labels.addToCart;
|
|
30513
30533
|
});
|
|
@@ -30531,7 +30551,7 @@ and ensure you are accounting for this risk.
|
|
|
30531
30551
|
createBaseVNode("div", _hoisted_2$O, [
|
|
30532
30552
|
hasLink.value ? (openBlock(), createElementBlock("button", mergeProps({
|
|
30533
30553
|
key: 0,
|
|
30534
|
-
class:
|
|
30554
|
+
class: addToCartButtonClass.value,
|
|
30535
30555
|
"data-cy": "lupa-add-to-cart",
|
|
30536
30556
|
disabled: !inStockValue.value || loading.value
|
|
30537
30557
|
}, _ctx.dynamicAttributes, { onClick: handleClick }), [
|
|
@@ -30539,7 +30559,7 @@ and ensure you are accounting for this risk.
|
|
|
30539
30559
|
], 16, _hoisted_3$A)) : (openBlock(), createElementBlock("button", mergeProps({
|
|
30540
30560
|
key: 1,
|
|
30541
30561
|
onClick: withModifiers(handleClick, ["stop", "prevent"]),
|
|
30542
|
-
class:
|
|
30562
|
+
class: addToCartButtonClass.value,
|
|
30543
30563
|
"data-cy": "lupa-add-to-cart",
|
|
30544
30564
|
type: "button",
|
|
30545
30565
|
disabled: !inStockValue.value || loading.value
|
|
@@ -32945,7 +32965,7 @@ and ensure you are accounting for this risk.
|
|
|
32945
32965
|
});
|
|
32946
32966
|
const handleFacetClick = (item) => {
|
|
32947
32967
|
var _a25;
|
|
32948
|
-
const value = isRange.value ? item.
|
|
32968
|
+
const value = isRange.value ? [item.from, item.to] : (_a25 = item.title) == null ? void 0 : _a25.toString();
|
|
32949
32969
|
emit2("select", {
|
|
32950
32970
|
key: facet.value.key,
|
|
32951
32971
|
value,
|
|
@@ -32959,7 +32979,11 @@ and ensure you are accounting for this risk.
|
|
|
32959
32979
|
var _a25, _b25;
|
|
32960
32980
|
let selectedItems = (_a25 = currentFiltersValue.value) != null ? _a25 : [];
|
|
32961
32981
|
selectedItems = isRange.value && selectedItems ? [rangeFilterToString(selectedItems)] : selectedItems;
|
|
32962
|
-
|
|
32982
|
+
if (isRange.value) {
|
|
32983
|
+
return selectedItems == null ? void 0 : selectedItems.includes(rangeFilterToString({ gte: item.from, lt: item.to }));
|
|
32984
|
+
} else {
|
|
32985
|
+
return selectedItems == null ? void 0 : selectedItems.includes((_b25 = item.title) == null ? void 0 : _b25.toString());
|
|
32986
|
+
}
|
|
32963
32987
|
};
|
|
32964
32988
|
const getItemLabel = (item) => {
|
|
32965
32989
|
var _a25;
|
|
@@ -34433,7 +34457,7 @@ and ensure you are accounting for this risk.
|
|
|
34433
34457
|
},
|
|
34434
34458
|
emits: ["select", "clear"],
|
|
34435
34459
|
setup(__props, { emit: __emit }) {
|
|
34436
|
-
var _a25, _b25;
|
|
34460
|
+
var _a25, _b25, _c;
|
|
34437
34461
|
const props = __props;
|
|
34438
34462
|
const facet = computed(() => {
|
|
34439
34463
|
var _a26;
|
|
@@ -34445,10 +34469,19 @@ and ensure you are accounting for this risk.
|
|
|
34445
34469
|
});
|
|
34446
34470
|
const searchResultStore = useSearchResultStore();
|
|
34447
34471
|
const optionsStore = useOptionsStore();
|
|
34472
|
+
const screenStore = useScreenStore();
|
|
34448
34473
|
const { currentFilterKeys } = storeToRefs(searchResultStore);
|
|
34449
34474
|
const { searchResultOptions } = storeToRefs(optionsStore);
|
|
34475
|
+
const { isMobileWidth } = storeToRefs(screenStore);
|
|
34450
34476
|
const emit2 = __emit;
|
|
34451
|
-
const
|
|
34477
|
+
const allExpanded = computed(() => {
|
|
34478
|
+
var _a26, _b26, _c2, _d, _e, _f;
|
|
34479
|
+
if (isMobileWidth.value) {
|
|
34480
|
+
return (_c2 = (_b26 = (_a26 = props.options) == null ? void 0 : _a26.expandAll) == null ? void 0 : _b26.mobile) != null ? _c2 : false;
|
|
34481
|
+
}
|
|
34482
|
+
return (_f = (_e = (_d = props.options) == null ? void 0 : _d.expandAll) == null ? void 0 : _e.desktop) != null ? _f : false;
|
|
34483
|
+
});
|
|
34484
|
+
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);
|
|
34452
34485
|
const facetPanel = ref(null);
|
|
34453
34486
|
const facetType = computed(() => {
|
|
34454
34487
|
switch (facet.value.type) {
|
|
@@ -34711,6 +34744,7 @@ and ensure you are accounting for this risk.
|
|
|
34711
34744
|
case "range":
|
|
34712
34745
|
toggleRangeFilter(
|
|
34713
34746
|
paramStore.appendParams,
|
|
34747
|
+
paramStore.removeParameters,
|
|
34714
34748
|
facetAction,
|
|
34715
34749
|
optionsStore.getQueryParamName,
|
|
34716
34750
|
filters.value
|
|
@@ -35868,6 +35902,13 @@ and ensure you are accounting for this risk.
|
|
|
35868
35902
|
const hasLink = computed(() => {
|
|
35869
35903
|
return Boolean(props.link && props.options.link);
|
|
35870
35904
|
});
|
|
35905
|
+
const addToCartButtonClass = computed(() => {
|
|
35906
|
+
return {
|
|
35907
|
+
[props.options.className]: Boolean(props.options.className),
|
|
35908
|
+
"lupa-add-to-cart-loading": loading.value,
|
|
35909
|
+
"lupa-add-to-cart": !loading.value
|
|
35910
|
+
};
|
|
35911
|
+
});
|
|
35871
35912
|
const handleClick = (e2) => __async2(null, null, function* () {
|
|
35872
35913
|
if (productCardIsClickable.value && !hasLink.value) {
|
|
35873
35914
|
e2.preventDefault();
|
|
@@ -35888,7 +35929,7 @@ and ensure you are accounting for this risk.
|
|
|
35888
35929
|
createBaseVNode("div", _hoisted_2$o, [
|
|
35889
35930
|
hasLink.value ? (openBlock(), createElementBlock("button", mergeProps({
|
|
35890
35931
|
key: 0,
|
|
35891
|
-
class:
|
|
35932
|
+
class: addToCartButtonClass.value,
|
|
35892
35933
|
"data-cy": "lupa-add-to-cart",
|
|
35893
35934
|
disabled: !inStockValue.value || loading.value
|
|
35894
35935
|
}, _ctx.dynamicAttributes, { onClick: handleClick }), [
|
|
@@ -35896,7 +35937,7 @@ and ensure you are accounting for this risk.
|
|
|
35896
35937
|
], 16, _hoisted_3$g)) : (openBlock(), createElementBlock("button", mergeProps({
|
|
35897
35938
|
key: 1,
|
|
35898
35939
|
id: id.value,
|
|
35899
|
-
class:
|
|
35940
|
+
class: addToCartButtonClass.value,
|
|
35900
35941
|
"data-cy": "lupa-add-to-cart",
|
|
35901
35942
|
disabled: !inStockValue.value || loading.value
|
|
35902
35943
|
}, _ctx.dynamicAttributes, {
|
|
@@ -46489,8 +46530,7 @@ and ensure you are accounting for this risk.
|
|
|
46489
46530
|
links: {
|
|
46490
46531
|
details: "/{id}"
|
|
46491
46532
|
},
|
|
46492
|
-
elements: []
|
|
46493
|
-
breadcrumbs: [{ label: "Main Page", link: "/" }, { label: "Search: {1}" }]
|
|
46533
|
+
elements: []
|
|
46494
46534
|
};
|
|
46495
46535
|
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
46496
46536
|
__name: "SearchResultsEntry",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getlupa/client",
|
|
3
|
-
"version": "1.21.
|
|
3
|
+
"version": "1.21.3",
|
|
4
4
|
"main": "dist/lupaSearch.js",
|
|
5
5
|
"module": "dist/lupaSearch.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@getlupa/client-sdk": "^1.8.1",
|
|
23
|
-
"@getlupa/vue": "0.21.
|
|
23
|
+
"@getlupa/vue": "0.21.2",
|
|
24
24
|
"@rushstack/eslint-patch": "^1.12.0",
|
|
25
25
|
"@tsconfig/node18": "^18.2.4",
|
|
26
26
|
"@types/jsdom": "^21.1.7",
|