@getlupa/vue 0.21.1 → 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
CHANGED
|
@@ -12375,13 +12375,13 @@ const unfoldRangeFilter = (key, filter, price = {}) => {
|
|
|
12375
12375
|
}
|
|
12376
12376
|
];
|
|
12377
12377
|
}
|
|
12378
|
-
return [{ key, value: `${gt} - ${lt}`, type: "range" }];
|
|
12378
|
+
return [{ key, value: `${gt != null ? gt : "*"} - ${lt != null ? lt : "*"}`, type: "range" }];
|
|
12379
12379
|
};
|
|
12380
12380
|
const unfoldFilter = (key, filter, price = {}) => {
|
|
12381
12381
|
if (Array.isArray(filter)) {
|
|
12382
12382
|
return unfoldTermFilter(key, filter);
|
|
12383
12383
|
}
|
|
12384
|
-
if (filter.gte) {
|
|
12384
|
+
if (filter.gte || filter.lte || filter.gt || filter.lt) {
|
|
12385
12385
|
return unfoldRangeFilter(key, filter, price);
|
|
12386
12386
|
}
|
|
12387
12387
|
if (filter.terms) {
|
|
@@ -12434,8 +12434,9 @@ const recursiveFilterItem = (item, query = "") => {
|
|
|
12434
12434
|
}) : void 0;
|
|
12435
12435
|
};
|
|
12436
12436
|
const rangeFilterToString = (rangeFilter, separator) => {
|
|
12437
|
+
var _a25, _b25, _c;
|
|
12437
12438
|
separator = separator || FACET_TERM_RANGE_SEPARATOR;
|
|
12438
|
-
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 : "")) : "";
|
|
12439
12440
|
};
|
|
12440
12441
|
const pick = (obj, keys) => {
|
|
12441
12442
|
const ret = /* @__PURE__ */ Object.create({});
|
|
@@ -12494,14 +12495,15 @@ const parseFacetKey = (key, searchParams) => {
|
|
|
12494
12495
|
return (_b25 = (_a25 = searchParams.getAll(key)) == null ? void 0 : _a25.map((v) => decodeURIComponent(v))) != null ? _b25 : [];
|
|
12495
12496
|
}
|
|
12496
12497
|
if (key.startsWith(FACET_PARAMS_TYPE.RANGE)) {
|
|
12498
|
+
const isPrice = key == null ? void 0 : key.includes(CURRENCY_KEY_INDICATOR);
|
|
12497
12499
|
const range2 = searchParams.get(key);
|
|
12498
12500
|
if (!range2) {
|
|
12499
12501
|
return {};
|
|
12500
12502
|
}
|
|
12501
12503
|
const [min, max] = range2.split(FACET_RANGE_SEPARATOR);
|
|
12502
12504
|
return {
|
|
12503
|
-
gte: min,
|
|
12504
|
-
lte: max
|
|
12505
|
+
gte: min || void 0,
|
|
12506
|
+
[isPrice ? "lte" : "lt"]: max || void 0
|
|
12505
12507
|
};
|
|
12506
12508
|
}
|
|
12507
12509
|
if (key.startsWith(FACET_PARAMS_TYPE.HIERARCHY)) {
|
|
@@ -12701,16 +12703,27 @@ const toggleHierarchyFilter = (appendParams, facetAction, getQueryParamName, cur
|
|
|
12701
12703
|
paramsToRemove: [getQueryParamName ? getQueryParamName(QUERY_PARAMS.PAGE) : QUERY_PARAMS.PAGE]
|
|
12702
12704
|
});
|
|
12703
12705
|
};
|
|
12704
|
-
const toggleRangeFilter = (appendParams, facetAction, getQueryParamName, currentFilters) => {
|
|
12706
|
+
const toggleRangeFilter = (appendParams, removeParameters, facetAction, getQueryParamName, currentFilters) => {
|
|
12707
|
+
var _a25, _b25;
|
|
12705
12708
|
const currentFilter = rangeFilterToString(
|
|
12706
12709
|
currentFilters == null ? void 0 : currentFilters[facetAction.key],
|
|
12707
12710
|
FACET_RANGE_SEPARATOR
|
|
12708
12711
|
);
|
|
12709
|
-
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 : "";
|
|
12710
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
|
+
}
|
|
12711
12724
|
appendParams({
|
|
12712
12725
|
params: [getFacetParam(facetAction.key, facetValue, FACET_PARAMS_TYPE.RANGE)],
|
|
12713
|
-
paramsToRemove
|
|
12726
|
+
paramsToRemove,
|
|
12714
12727
|
encode: false
|
|
12715
12728
|
});
|
|
12716
12729
|
};
|
|
@@ -24296,6 +24309,13 @@ const _sfc_main$1i = /* @__PURE__ */ vue.defineComponent({
|
|
|
24296
24309
|
const { addToCartAmount } = storeToRefs(searchResultStore);
|
|
24297
24310
|
const emit = __emit;
|
|
24298
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
|
+
});
|
|
24299
24319
|
const label = vue.computed(() => {
|
|
24300
24320
|
return props.options.labels.addToCart;
|
|
24301
24321
|
});
|
|
@@ -24319,7 +24339,7 @@ const _sfc_main$1i = /* @__PURE__ */ vue.defineComponent({
|
|
|
24319
24339
|
vue.createElementVNode("div", _hoisted_2$O, [
|
|
24320
24340
|
hasLink.value ? (vue.openBlock(), vue.createElementBlock("button", vue.mergeProps({
|
|
24321
24341
|
key: 0,
|
|
24322
|
-
class:
|
|
24342
|
+
class: addToCartButtonClass.value,
|
|
24323
24343
|
"data-cy": "lupa-add-to-cart",
|
|
24324
24344
|
disabled: !inStockValue.value || loading.value
|
|
24325
24345
|
}, _ctx.dynamicAttributes, { onClick: handleClick }), [
|
|
@@ -24327,7 +24347,7 @@ const _sfc_main$1i = /* @__PURE__ */ vue.defineComponent({
|
|
|
24327
24347
|
], 16, _hoisted_3$A)) : (vue.openBlock(), vue.createElementBlock("button", vue.mergeProps({
|
|
24328
24348
|
key: 1,
|
|
24329
24349
|
onClick: vue.withModifiers(handleClick, ["stop", "prevent"]),
|
|
24330
|
-
class:
|
|
24350
|
+
class: addToCartButtonClass.value,
|
|
24331
24351
|
"data-cy": "lupa-add-to-cart",
|
|
24332
24352
|
type: "button",
|
|
24333
24353
|
disabled: !inStockValue.value || loading.value
|
|
@@ -26749,7 +26769,7 @@ const _sfc_main$X = /* @__PURE__ */ vue.defineComponent({
|
|
|
26749
26769
|
});
|
|
26750
26770
|
const handleFacetClick = (item) => {
|
|
26751
26771
|
var _a25;
|
|
26752
|
-
const value = isRange.value ? item.
|
|
26772
|
+
const value = isRange.value ? [item.from, item.to] : (_a25 = item.title) == null ? void 0 : _a25.toString();
|
|
26753
26773
|
emit("select", {
|
|
26754
26774
|
key: facet.value.key,
|
|
26755
26775
|
value,
|
|
@@ -26763,7 +26783,11 @@ const _sfc_main$X = /* @__PURE__ */ vue.defineComponent({
|
|
|
26763
26783
|
var _a25, _b25;
|
|
26764
26784
|
let selectedItems = (_a25 = currentFiltersValue.value) != null ? _a25 : [];
|
|
26765
26785
|
selectedItems = isRange.value && selectedItems ? [rangeFilterToString(selectedItems)] : selectedItems;
|
|
26766
|
-
|
|
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
|
+
}
|
|
26767
26791
|
};
|
|
26768
26792
|
const getItemLabel = (item) => {
|
|
26769
26793
|
var _a25;
|
|
@@ -28237,7 +28261,7 @@ const _sfc_main$T = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadVa
|
|
|
28237
28261
|
},
|
|
28238
28262
|
emits: ["select", "clear"],
|
|
28239
28263
|
setup(__props, { emit: __emit }) {
|
|
28240
|
-
var _a25, _b25;
|
|
28264
|
+
var _a25, _b25, _c;
|
|
28241
28265
|
const props = __props;
|
|
28242
28266
|
const facet = vue.computed(() => {
|
|
28243
28267
|
var _a26;
|
|
@@ -28249,10 +28273,19 @@ const _sfc_main$T = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadVa
|
|
|
28249
28273
|
});
|
|
28250
28274
|
const searchResultStore = useSearchResultStore();
|
|
28251
28275
|
const optionsStore = useOptionsStore();
|
|
28276
|
+
const screenStore = useScreenStore();
|
|
28252
28277
|
const { currentFilterKeys } = storeToRefs(searchResultStore);
|
|
28253
28278
|
const { searchResultOptions } = storeToRefs(optionsStore);
|
|
28279
|
+
const { isMobileWidth } = storeToRefs(screenStore);
|
|
28254
28280
|
const emit = __emit;
|
|
28255
|
-
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);
|
|
28256
28289
|
const facetPanel = vue.ref(null);
|
|
28257
28290
|
const facetType = vue.computed(() => {
|
|
28258
28291
|
switch (facet.value.type) {
|
|
@@ -28515,6 +28548,7 @@ const _sfc_main$Q = /* @__PURE__ */ vue.defineComponent({
|
|
|
28515
28548
|
case "range":
|
|
28516
28549
|
toggleRangeFilter(
|
|
28517
28550
|
paramStore.appendParams,
|
|
28551
|
+
paramStore.removeParameters,
|
|
28518
28552
|
facetAction,
|
|
28519
28553
|
optionsStore.getQueryParamName,
|
|
28520
28554
|
filters.value
|
|
@@ -29672,6 +29706,13 @@ const _sfc_main$y = /* @__PURE__ */ vue.defineComponent({
|
|
|
29672
29706
|
const hasLink = vue.computed(() => {
|
|
29673
29707
|
return Boolean(props.link && props.options.link);
|
|
29674
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
|
+
});
|
|
29675
29716
|
const handleClick = (e2) => __async(null, null, function* () {
|
|
29676
29717
|
if (productCardIsClickable.value && !hasLink.value) {
|
|
29677
29718
|
e2.preventDefault();
|
|
@@ -29692,7 +29733,7 @@ const _sfc_main$y = /* @__PURE__ */ vue.defineComponent({
|
|
|
29692
29733
|
vue.createElementVNode("div", _hoisted_2$o, [
|
|
29693
29734
|
hasLink.value ? (vue.openBlock(), vue.createElementBlock("button", vue.mergeProps({
|
|
29694
29735
|
key: 0,
|
|
29695
|
-
class:
|
|
29736
|
+
class: addToCartButtonClass.value,
|
|
29696
29737
|
"data-cy": "lupa-add-to-cart",
|
|
29697
29738
|
disabled: !inStockValue.value || loading.value
|
|
29698
29739
|
}, _ctx.dynamicAttributes, { onClick: handleClick }), [
|
|
@@ -29700,7 +29741,7 @@ const _sfc_main$y = /* @__PURE__ */ vue.defineComponent({
|
|
|
29700
29741
|
], 16, _hoisted_3$g)) : (vue.openBlock(), vue.createElementBlock("button", vue.mergeProps({
|
|
29701
29742
|
key: 1,
|
|
29702
29743
|
id: id.value,
|
|
29703
|
-
class:
|
|
29744
|
+
class: addToCartButtonClass.value,
|
|
29704
29745
|
"data-cy": "lupa-add-to-cart",
|
|
29705
29746
|
disabled: !inStockValue.value || loading.value
|
|
29706
29747
|
}, _ctx.dynamicAttributes, {
|
package/dist/lupaSearch.mjs
CHANGED
|
@@ -12373,13 +12373,13 @@ const unfoldRangeFilter = (key, filter, price = {}) => {
|
|
|
12373
12373
|
}
|
|
12374
12374
|
];
|
|
12375
12375
|
}
|
|
12376
|
-
return [{ key, value: `${gt} - ${lt}`, type: "range" }];
|
|
12376
|
+
return [{ key, value: `${gt != null ? gt : "*"} - ${lt != null ? lt : "*"}`, type: "range" }];
|
|
12377
12377
|
};
|
|
12378
12378
|
const unfoldFilter = (key, filter, price = {}) => {
|
|
12379
12379
|
if (Array.isArray(filter)) {
|
|
12380
12380
|
return unfoldTermFilter(key, filter);
|
|
12381
12381
|
}
|
|
12382
|
-
if (filter.gte) {
|
|
12382
|
+
if (filter.gte || filter.lte || filter.gt || filter.lt) {
|
|
12383
12383
|
return unfoldRangeFilter(key, filter, price);
|
|
12384
12384
|
}
|
|
12385
12385
|
if (filter.terms) {
|
|
@@ -12432,8 +12432,9 @@ const recursiveFilterItem = (item, query = "") => {
|
|
|
12432
12432
|
}) : void 0;
|
|
12433
12433
|
};
|
|
12434
12434
|
const rangeFilterToString = (rangeFilter, separator) => {
|
|
12435
|
+
var _a25, _b25, _c;
|
|
12435
12436
|
separator = separator || FACET_TERM_RANGE_SEPARATOR;
|
|
12436
|
-
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 : "")) : "";
|
|
12437
12438
|
};
|
|
12438
12439
|
const pick = (obj, keys) => {
|
|
12439
12440
|
const ret = /* @__PURE__ */ Object.create({});
|
|
@@ -12492,14 +12493,15 @@ const parseFacetKey = (key, searchParams) => {
|
|
|
12492
12493
|
return (_b25 = (_a25 = searchParams.getAll(key)) == null ? void 0 : _a25.map((v) => decodeURIComponent(v))) != null ? _b25 : [];
|
|
12493
12494
|
}
|
|
12494
12495
|
if (key.startsWith(FACET_PARAMS_TYPE.RANGE)) {
|
|
12496
|
+
const isPrice = key == null ? void 0 : key.includes(CURRENCY_KEY_INDICATOR);
|
|
12495
12497
|
const range2 = searchParams.get(key);
|
|
12496
12498
|
if (!range2) {
|
|
12497
12499
|
return {};
|
|
12498
12500
|
}
|
|
12499
12501
|
const [min, max] = range2.split(FACET_RANGE_SEPARATOR);
|
|
12500
12502
|
return {
|
|
12501
|
-
gte: min,
|
|
12502
|
-
lte: max
|
|
12503
|
+
gte: min || void 0,
|
|
12504
|
+
[isPrice ? "lte" : "lt"]: max || void 0
|
|
12503
12505
|
};
|
|
12504
12506
|
}
|
|
12505
12507
|
if (key.startsWith(FACET_PARAMS_TYPE.HIERARCHY)) {
|
|
@@ -12699,16 +12701,27 @@ const toggleHierarchyFilter = (appendParams, facetAction, getQueryParamName, cur
|
|
|
12699
12701
|
paramsToRemove: [getQueryParamName ? getQueryParamName(QUERY_PARAMS.PAGE) : QUERY_PARAMS.PAGE]
|
|
12700
12702
|
});
|
|
12701
12703
|
};
|
|
12702
|
-
const toggleRangeFilter = (appendParams, facetAction, getQueryParamName, currentFilters) => {
|
|
12704
|
+
const toggleRangeFilter = (appendParams, removeParameters, facetAction, getQueryParamName, currentFilters) => {
|
|
12705
|
+
var _a25, _b25;
|
|
12703
12706
|
const currentFilter = rangeFilterToString(
|
|
12704
12707
|
currentFilters == null ? void 0 : currentFilters[facetAction.key],
|
|
12705
12708
|
FACET_RANGE_SEPARATOR
|
|
12706
12709
|
);
|
|
12707
|
-
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 : "";
|
|
12708
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
|
+
}
|
|
12709
12722
|
appendParams({
|
|
12710
12723
|
params: [getFacetParam(facetAction.key, facetValue, FACET_PARAMS_TYPE.RANGE)],
|
|
12711
|
-
paramsToRemove
|
|
12724
|
+
paramsToRemove,
|
|
12712
12725
|
encode: false
|
|
12713
12726
|
});
|
|
12714
12727
|
};
|
|
@@ -24294,6 +24307,13 @@ const _sfc_main$1i = /* @__PURE__ */ defineComponent({
|
|
|
24294
24307
|
const { addToCartAmount } = storeToRefs(searchResultStore);
|
|
24295
24308
|
const emit = __emit;
|
|
24296
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
|
+
});
|
|
24297
24317
|
const label = computed(() => {
|
|
24298
24318
|
return props.options.labels.addToCart;
|
|
24299
24319
|
});
|
|
@@ -24317,7 +24337,7 @@ const _sfc_main$1i = /* @__PURE__ */ defineComponent({
|
|
|
24317
24337
|
createElementVNode("div", _hoisted_2$O, [
|
|
24318
24338
|
hasLink.value ? (openBlock(), createElementBlock("button", mergeProps({
|
|
24319
24339
|
key: 0,
|
|
24320
|
-
class:
|
|
24340
|
+
class: addToCartButtonClass.value,
|
|
24321
24341
|
"data-cy": "lupa-add-to-cart",
|
|
24322
24342
|
disabled: !inStockValue.value || loading.value
|
|
24323
24343
|
}, _ctx.dynamicAttributes, { onClick: handleClick }), [
|
|
@@ -24325,7 +24345,7 @@ const _sfc_main$1i = /* @__PURE__ */ defineComponent({
|
|
|
24325
24345
|
], 16, _hoisted_3$A)) : (openBlock(), createElementBlock("button", mergeProps({
|
|
24326
24346
|
key: 1,
|
|
24327
24347
|
onClick: withModifiers(handleClick, ["stop", "prevent"]),
|
|
24328
|
-
class:
|
|
24348
|
+
class: addToCartButtonClass.value,
|
|
24329
24349
|
"data-cy": "lupa-add-to-cart",
|
|
24330
24350
|
type: "button",
|
|
24331
24351
|
disabled: !inStockValue.value || loading.value
|
|
@@ -26747,7 +26767,7 @@ const _sfc_main$X = /* @__PURE__ */ defineComponent({
|
|
|
26747
26767
|
});
|
|
26748
26768
|
const handleFacetClick = (item) => {
|
|
26749
26769
|
var _a25;
|
|
26750
|
-
const value = isRange.value ? item.
|
|
26770
|
+
const value = isRange.value ? [item.from, item.to] : (_a25 = item.title) == null ? void 0 : _a25.toString();
|
|
26751
26771
|
emit("select", {
|
|
26752
26772
|
key: facet.value.key,
|
|
26753
26773
|
value,
|
|
@@ -26761,7 +26781,11 @@ const _sfc_main$X = /* @__PURE__ */ defineComponent({
|
|
|
26761
26781
|
var _a25, _b25;
|
|
26762
26782
|
let selectedItems = (_a25 = currentFiltersValue.value) != null ? _a25 : [];
|
|
26763
26783
|
selectedItems = isRange.value && selectedItems ? [rangeFilterToString(selectedItems)] : selectedItems;
|
|
26764
|
-
|
|
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
|
+
}
|
|
26765
26789
|
};
|
|
26766
26790
|
const getItemLabel = (item) => {
|
|
26767
26791
|
var _a25;
|
|
@@ -28235,7 +28259,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
|
|
|
28235
28259
|
},
|
|
28236
28260
|
emits: ["select", "clear"],
|
|
28237
28261
|
setup(__props, { emit: __emit }) {
|
|
28238
|
-
var _a25, _b25;
|
|
28262
|
+
var _a25, _b25, _c;
|
|
28239
28263
|
const props = __props;
|
|
28240
28264
|
const facet = computed(() => {
|
|
28241
28265
|
var _a26;
|
|
@@ -28247,10 +28271,19 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
|
|
|
28247
28271
|
});
|
|
28248
28272
|
const searchResultStore = useSearchResultStore();
|
|
28249
28273
|
const optionsStore = useOptionsStore();
|
|
28274
|
+
const screenStore = useScreenStore();
|
|
28250
28275
|
const { currentFilterKeys } = storeToRefs(searchResultStore);
|
|
28251
28276
|
const { searchResultOptions } = storeToRefs(optionsStore);
|
|
28277
|
+
const { isMobileWidth } = storeToRefs(screenStore);
|
|
28252
28278
|
const emit = __emit;
|
|
28253
|
-
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);
|
|
28254
28287
|
const facetPanel = ref(null);
|
|
28255
28288
|
const facetType = computed(() => {
|
|
28256
28289
|
switch (facet.value.type) {
|
|
@@ -28513,6 +28546,7 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
|
28513
28546
|
case "range":
|
|
28514
28547
|
toggleRangeFilter(
|
|
28515
28548
|
paramStore.appendParams,
|
|
28549
|
+
paramStore.removeParameters,
|
|
28516
28550
|
facetAction,
|
|
28517
28551
|
optionsStore.getQueryParamName,
|
|
28518
28552
|
filters.value
|
|
@@ -29670,6 +29704,13 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
29670
29704
|
const hasLink = computed(() => {
|
|
29671
29705
|
return Boolean(props.link && props.options.link);
|
|
29672
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
|
+
});
|
|
29673
29714
|
const handleClick = (e2) => __async(null, null, function* () {
|
|
29674
29715
|
if (productCardIsClickable.value && !hasLink.value) {
|
|
29675
29716
|
e2.preventDefault();
|
|
@@ -29690,7 +29731,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
29690
29731
|
createElementVNode("div", _hoisted_2$o, [
|
|
29691
29732
|
hasLink.value ? (openBlock(), createElementBlock("button", mergeProps({
|
|
29692
29733
|
key: 0,
|
|
29693
|
-
class:
|
|
29734
|
+
class: addToCartButtonClass.value,
|
|
29694
29735
|
"data-cy": "lupa-add-to-cart",
|
|
29695
29736
|
disabled: !inStockValue.value || loading.value
|
|
29696
29737
|
}, _ctx.dynamicAttributes, { onClick: handleClick }), [
|
|
@@ -29698,7 +29739,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
29698
29739
|
], 16, _hoisted_3$g)) : (openBlock(), createElementBlock("button", mergeProps({
|
|
29699
29740
|
key: 1,
|
|
29700
29741
|
id: id.value,
|
|
29701
|
-
class:
|
|
29742
|
+
class: addToCartButtonClass.value,
|
|
29702
29743
|
"data-cy": "lupa-add-to-cart",
|
|
29703
29744
|
disabled: !inStockValue.value || loading.value
|
|
29704
29745
|
}, _ctx.dynamicAttributes, {
|
|
@@ -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> & {
|
|
@@ -239,6 +239,10 @@ export type ResultFacetOptions = {
|
|
|
239
239
|
exclude?: string[];
|
|
240
240
|
excludeValues?: Record<string, Record<string, string[]>>;
|
|
241
241
|
expand?: string[];
|
|
242
|
+
expandAll?: {
|
|
243
|
+
desktop?: boolean;
|
|
244
|
+
mobile?: boolean;
|
|
245
|
+
};
|
|
242
246
|
facetFilterQueries?: Record<string, FacetFilterQuery>;
|
|
243
247
|
};
|
|
244
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[];
|