@getlupa/vue 0.17.4 → 0.17.6
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 +72 -39
- package/dist/lupaSearch.mjs +72 -39
- package/dist/src/types/DocumentElement.d.ts +1 -1
- package/dist/src/types/search-results/FilterTranslationOptions.d.ts +4 -0
- package/dist/src/types/search-results/SearchResultsOptions.d.ts +2 -0
- package/dist/src/utils/filter.utils.d.ts +2 -1
- package/dist/src/utils/translation.utils.d.ts +10 -0
- package/package.json +3 -2
package/dist/lupaSearch.js
CHANGED
|
@@ -2569,6 +2569,14 @@ const formatPriceSummary = ([min, max], currency, separator = ",", currencyTempl
|
|
|
2569
2569
|
}
|
|
2570
2570
|
return `< ${formatPrice(max, currency, separator, currencyTemplate)}`;
|
|
2571
2571
|
};
|
|
2572
|
+
const getTranslatedFacetKey = (facet, translations) => {
|
|
2573
|
+
var _a, _b;
|
|
2574
|
+
return (_b = (_a = translations == null ? void 0 : translations.keyTranslations) == null ? void 0 : _a[facet.key]) != null ? _b : facet.label;
|
|
2575
|
+
};
|
|
2576
|
+
const getTranslatedFacetValue = (facet, value, translations) => {
|
|
2577
|
+
var _a, _b, _c;
|
|
2578
|
+
return (_c = (_b = (_a = translations == null ? void 0 : translations.valueTranslations) == null ? void 0 : _a[facet.key]) == null ? void 0 : _b[value == null ? void 0 : value.title]) != null ? _c : value.title;
|
|
2579
|
+
};
|
|
2572
2580
|
const formatRange = (filter2) => {
|
|
2573
2581
|
var _a, _b;
|
|
2574
2582
|
const lt = (_a = filter2.lt) != null ? _a : filter2.lte;
|
|
@@ -2628,11 +2636,12 @@ const unfoldFilters = (filters, price = {}) => {
|
|
|
2628
2636
|
const seed = [];
|
|
2629
2637
|
return Object.entries(filters).reduce((a, c2) => [...a, ...unfoldFilter(...c2, price)], seed);
|
|
2630
2638
|
};
|
|
2631
|
-
const getLabeledFilters = (filters, facets2) => {
|
|
2639
|
+
const getLabeledFilters = (filters, facets2, translations) => {
|
|
2632
2640
|
return filters.map((f2) => {
|
|
2633
|
-
var _a, _b;
|
|
2641
|
+
var _a, _b, _c, _d;
|
|
2634
2642
|
return __spreadProps(__spreadValues({}, f2), {
|
|
2635
|
-
label: (
|
|
2643
|
+
label: (_d = (_c = (_a = translations == null ? void 0 : translations.keyTranslations) == null ? void 0 : _a[f2.key]) != null ? _c : (_b = facets2 == null ? void 0 : facets2.find((ft) => ft.key === f2.key)) == null ? void 0 : _b.label) != null ? _d : capitalize$1(f2.key),
|
|
2644
|
+
value: getTranslatedFacetValue({ key: f2.key }, { title: f2.value }, translations)
|
|
2636
2645
|
});
|
|
2637
2646
|
});
|
|
2638
2647
|
};
|
|
@@ -8985,7 +8994,7 @@ const useSearchBoxStore = defineStore("searchBox", () => {
|
|
|
8985
8994
|
};
|
|
8986
8995
|
});
|
|
8987
8996
|
const _hoisted_1$1i = { id: "lupa-search-box-input-container" };
|
|
8988
|
-
const _hoisted_2$
|
|
8997
|
+
const _hoisted_2$T = { class: "lupa-input-clear" };
|
|
8989
8998
|
const _hoisted_3$C = { id: "lupa-search-box-input" };
|
|
8990
8999
|
const _hoisted_4$s = ["value"];
|
|
8991
9000
|
const _hoisted_5$j = ["aria-label", "placeholder"];
|
|
@@ -9082,7 +9091,7 @@ const _sfc_main$1v = /* @__PURE__ */ vue.defineComponent({
|
|
|
9082
9091
|
__expose({ focus });
|
|
9083
9092
|
return (_ctx, _cache) => {
|
|
9084
9093
|
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1i, [
|
|
9085
|
-
vue.createElementVNode("div", _hoisted_2$
|
|
9094
|
+
vue.createElementVNode("div", _hoisted_2$T, [
|
|
9086
9095
|
vue.createElementVNode("div", {
|
|
9087
9096
|
class: vue.normalizeClass(["lupa-input-clear-content", { "lupa-input-clear-filled": inputValue.value }]),
|
|
9088
9097
|
onClick: clear
|
|
@@ -9165,7 +9174,7 @@ const _sfc_main$1u = /* @__PURE__ */ vue.defineComponent({
|
|
|
9165
9174
|
}
|
|
9166
9175
|
});
|
|
9167
9176
|
const _hoisted_1$1h = { class: "lupa-search-box-history-item" };
|
|
9168
|
-
const _hoisted_2$
|
|
9177
|
+
const _hoisted_2$S = { class: "lupa-search-box-history-item-content" };
|
|
9169
9178
|
const _sfc_main$1t = /* @__PURE__ */ vue.defineComponent({
|
|
9170
9179
|
__name: "SearchBoxHistoryItem",
|
|
9171
9180
|
props: {
|
|
@@ -9183,7 +9192,7 @@ const _sfc_main$1t = /* @__PURE__ */ vue.defineComponent({
|
|
|
9183
9192
|
};
|
|
9184
9193
|
return (_ctx, _cache) => {
|
|
9185
9194
|
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1h, [
|
|
9186
|
-
vue.createElementVNode("div", _hoisted_2$
|
|
9195
|
+
vue.createElementVNode("div", _hoisted_2$S, [
|
|
9187
9196
|
vue.createElementVNode("div", {
|
|
9188
9197
|
class: vue.normalizeClass(["lupa-search-box-history-item-text", { "lupa-search-box-history-item-highlighted": _ctx.highlighted }]),
|
|
9189
9198
|
onClick: click2
|
|
@@ -9310,7 +9319,7 @@ const generateGridTemplate = (elements) => {
|
|
|
9310
9319
|
return gridTemplate.join(" ");
|
|
9311
9320
|
};
|
|
9312
9321
|
const _hoisted_1$1e = ["innerHTML"];
|
|
9313
|
-
const _hoisted_2$
|
|
9322
|
+
const _hoisted_2$R = {
|
|
9314
9323
|
key: 1,
|
|
9315
9324
|
"data-cy": "lupa-suggestion-value",
|
|
9316
9325
|
class: "lupa-suggestion-value"
|
|
@@ -9364,7 +9373,7 @@ const _sfc_main$1q = /* @__PURE__ */ vue.defineComponent({
|
|
|
9364
9373
|
class: "lupa-suggestion-value",
|
|
9365
9374
|
"data-cy": "lupa-suggestion-value",
|
|
9366
9375
|
innerHTML: _ctx.suggestion.displayHighlight
|
|
9367
|
-
}, null, 8, _hoisted_1$1e)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$
|
|
9376
|
+
}, null, 8, _hoisted_1$1e)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$R, vue.toDisplayString(_ctx.suggestion.display), 1)),
|
|
9368
9377
|
_ctx.suggestion.facet ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$B, [
|
|
9369
9378
|
vue.createElementVNode("span", _hoisted_4$r, vue.toDisplayString(facetLabel.value), 1),
|
|
9370
9379
|
vue.createElementVNode("span", _hoisted_5$i, vue.toDisplayString(_ctx.suggestion.facet.title), 1)
|
|
@@ -18553,6 +18562,11 @@ const processDisplayCondition = (displayCondition, doc = {}) => {
|
|
|
18553
18562
|
case "exists": {
|
|
18554
18563
|
return fields == null ? void 0 : fields.every((field) => getFieldValue(doc, field) !== void 0);
|
|
18555
18564
|
}
|
|
18565
|
+
case "notExists": {
|
|
18566
|
+
return fields == null ? void 0 : fields.every(
|
|
18567
|
+
(field) => getFieldValue(doc, field) === void 0 || getFieldValue(doc, field) === null
|
|
18568
|
+
);
|
|
18569
|
+
}
|
|
18556
18570
|
case "equals": {
|
|
18557
18571
|
if (fields.length < 2)
|
|
18558
18572
|
return false;
|
|
@@ -18609,7 +18623,7 @@ const replaceImageWithPlaceholder = (e2, placeholder) => {
|
|
|
18609
18623
|
}
|
|
18610
18624
|
};
|
|
18611
18625
|
const _hoisted_1$1c = ["src"];
|
|
18612
|
-
const _hoisted_2$
|
|
18626
|
+
const _hoisted_2$Q = ["src"];
|
|
18613
18627
|
const _sfc_main$1n = /* @__PURE__ */ vue.defineComponent({
|
|
18614
18628
|
__name: "ProductImage",
|
|
18615
18629
|
props: {
|
|
@@ -18760,7 +18774,7 @@ const _sfc_main$1n = /* @__PURE__ */ vue.defineComponent({
|
|
|
18760
18774
|
class: ["lupa-images-main-image", { [_ctx.imageClass]: true }],
|
|
18761
18775
|
style: styleOverride.value,
|
|
18762
18776
|
src: finalMainImageUrl.value
|
|
18763
|
-
}, { alt: imageAlt.value ? imageAlt.value : void 0 }, { onError: replaceWithPlaceholder }), null, 16, _hoisted_2$
|
|
18777
|
+
}, { alt: imageAlt.value ? imageAlt.value : void 0 }, { onError: replaceWithPlaceholder }), null, 16, _hoisted_2$Q))
|
|
18764
18778
|
], 38);
|
|
18765
18779
|
};
|
|
18766
18780
|
}
|
|
@@ -18783,7 +18797,7 @@ const _sfc_main$1m = /* @__PURE__ */ vue.defineComponent({
|
|
|
18783
18797
|
}
|
|
18784
18798
|
});
|
|
18785
18799
|
const _hoisted_1$1b = ["innerHTML"];
|
|
18786
|
-
const _hoisted_2$
|
|
18800
|
+
const _hoisted_2$P = {
|
|
18787
18801
|
key: 1,
|
|
18788
18802
|
class: "lupa-search-box-product-title"
|
|
18789
18803
|
};
|
|
@@ -18810,14 +18824,14 @@ const _sfc_main$1l = /* @__PURE__ */ vue.defineComponent({
|
|
|
18810
18824
|
key: 0,
|
|
18811
18825
|
class: "lupa-search-box-product-title",
|
|
18812
18826
|
innerHTML: sanitizedTitle.value
|
|
18813
|
-
}, null, 8, _hoisted_1$1b)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$
|
|
18827
|
+
}, null, 8, _hoisted_1$1b)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$P, [
|
|
18814
18828
|
vue.createElementVNode("strong", null, vue.toDisplayString(title.value), 1)
|
|
18815
18829
|
]));
|
|
18816
18830
|
};
|
|
18817
18831
|
}
|
|
18818
18832
|
});
|
|
18819
18833
|
const _hoisted_1$1a = ["innerHTML"];
|
|
18820
|
-
const _hoisted_2$
|
|
18834
|
+
const _hoisted_2$O = {
|
|
18821
18835
|
key: 1,
|
|
18822
18836
|
class: "lupa-search-box-product-description"
|
|
18823
18837
|
};
|
|
@@ -18844,7 +18858,7 @@ const _sfc_main$1k = /* @__PURE__ */ vue.defineComponent({
|
|
|
18844
18858
|
key: 0,
|
|
18845
18859
|
class: "lupa-search-box-product-description",
|
|
18846
18860
|
innerHTML: sanitizedDescription.value
|
|
18847
|
-
}, null, 8, _hoisted_1$1a)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$
|
|
18861
|
+
}, null, 8, _hoisted_1$1a)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$O, vue.toDisplayString(description.value), 1));
|
|
18848
18862
|
};
|
|
18849
18863
|
}
|
|
18850
18864
|
});
|
|
@@ -18903,7 +18917,7 @@ const _sfc_main$1i = /* @__PURE__ */ vue.defineComponent({
|
|
|
18903
18917
|
}
|
|
18904
18918
|
});
|
|
18905
18919
|
const _hoisted_1$18 = ["innerHTML"];
|
|
18906
|
-
const _hoisted_2$
|
|
18920
|
+
const _hoisted_2$N = { key: 0 };
|
|
18907
18921
|
const _hoisted_3$A = { key: 1 };
|
|
18908
18922
|
const _hoisted_4$q = { class: "lupa-search-box-custom-label" };
|
|
18909
18923
|
const _hoisted_5$h = { class: "lupa-search-box-custom-text" };
|
|
@@ -18937,7 +18951,7 @@ const _sfc_main$1h = /* @__PURE__ */ vue.defineComponent({
|
|
|
18937
18951
|
key: 1,
|
|
18938
18952
|
class: [className.value, "lupa-search-box-product-custom"]
|
|
18939
18953
|
}, vue.toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), [
|
|
18940
|
-
!label.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$
|
|
18954
|
+
!label.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$N, vue.toDisplayString(text.value), 1)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$A, [
|
|
18941
18955
|
vue.createElementVNode("div", _hoisted_4$q, vue.toDisplayString(label.value), 1),
|
|
18942
18956
|
vue.createElementVNode("div", _hoisted_5$h, vue.toDisplayString(text.value), 1)
|
|
18943
18957
|
]))
|
|
@@ -19060,6 +19074,10 @@ const useSearchResultStore = defineStore("searchResult", () => {
|
|
|
19060
19074
|
var _a, _b, _c;
|
|
19061
19075
|
return (_c = (_b = (_a = searchResultOptions.value) == null ? void 0 : _a.labels) == null ? void 0 : _b.currencyTemplate) != null ? _c : "";
|
|
19062
19076
|
});
|
|
19077
|
+
const filterTranslations = vue.computed(() => {
|
|
19078
|
+
var _a, _b, _c;
|
|
19079
|
+
return (_c = (_b = (_a = searchResultOptions.value) == null ? void 0 : _a.filters) == null ? void 0 : _b.translations) != null ? _c : {};
|
|
19080
|
+
});
|
|
19063
19081
|
const labeledFilters = vue.computed(
|
|
19064
19082
|
() => getLabeledFilters(
|
|
19065
19083
|
unfoldFilters(filters.value, {
|
|
@@ -19068,7 +19086,8 @@ const useSearchResultStore = defineStore("searchResult", () => {
|
|
|
19068
19086
|
separator: priceSeparator.value,
|
|
19069
19087
|
currencyTemplate: currencyTemplate.value
|
|
19070
19088
|
}),
|
|
19071
|
-
facets2.value
|
|
19089
|
+
facets2.value,
|
|
19090
|
+
filterTranslations.value
|
|
19072
19091
|
)
|
|
19073
19092
|
);
|
|
19074
19093
|
const displayFilters = vue.computed(() => {
|
|
@@ -19251,7 +19270,7 @@ const useSearchResultStore = defineStore("searchResult", () => {
|
|
|
19251
19270
|
};
|
|
19252
19271
|
});
|
|
19253
19272
|
const _hoisted_1$16 = { class: "lupa-search-box-add-to-cart-wrapper" };
|
|
19254
|
-
const _hoisted_2$
|
|
19273
|
+
const _hoisted_2$M = { class: "lupa-search-box-product-addtocart" };
|
|
19255
19274
|
const _hoisted_3$z = ["onClick", "disabled"];
|
|
19256
19275
|
const _sfc_main$1f = /* @__PURE__ */ vue.defineComponent({
|
|
19257
19276
|
__name: "SearchBoxProductAddToCart",
|
|
@@ -19288,7 +19307,7 @@ const _sfc_main$1f = /* @__PURE__ */ vue.defineComponent({
|
|
|
19288
19307
|
});
|
|
19289
19308
|
return (_ctx, _cache) => {
|
|
19290
19309
|
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$16, [
|
|
19291
|
-
vue.createElementVNode("div", _hoisted_2$
|
|
19310
|
+
vue.createElementVNode("div", _hoisted_2$M, [
|
|
19292
19311
|
vue.createElementVNode("button", vue.mergeProps({
|
|
19293
19312
|
onClick: vue.withModifiers(handleClick, ["stop", "prevent"]),
|
|
19294
19313
|
class: loading.value ? "lupa-add-to-cart-loading" : "lupa-add-to-cart",
|
|
@@ -19402,7 +19421,7 @@ const _sfc_main$1e = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadV
|
|
|
19402
19421
|
}
|
|
19403
19422
|
}));
|
|
19404
19423
|
const _hoisted_1$14 = { class: "lupa-badge-title" };
|
|
19405
|
-
const _hoisted_2$
|
|
19424
|
+
const _hoisted_2$L = ["src"];
|
|
19406
19425
|
const _hoisted_3$y = { key: 1 };
|
|
19407
19426
|
const _hoisted_4$p = {
|
|
19408
19427
|
key: 0,
|
|
@@ -19445,7 +19464,7 @@ const _sfc_main$1d = /* @__PURE__ */ vue.defineComponent({
|
|
|
19445
19464
|
image.value ? (vue.openBlock(), vue.createElementBlock("img", {
|
|
19446
19465
|
key: 0,
|
|
19447
19466
|
src: image.value
|
|
19448
|
-
}, null, 8, _hoisted_2$
|
|
19467
|
+
}, null, 8, _hoisted_2$L)) : vue.createCommentVNode("", true),
|
|
19449
19468
|
hasTitleText.value && showTitle.value ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_3$y, vue.toDisplayString(_ctx.badge.titleText), 1)) : vue.createCommentVNode("", true)
|
|
19450
19469
|
]),
|
|
19451
19470
|
hasAdditionalText.value ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_4$p, vue.toDisplayString(_ctx.badge.additionalText), 1)) : vue.createCommentVNode("", true)
|
|
@@ -19545,7 +19564,7 @@ const _sfc_main$1a = /* @__PURE__ */ vue.defineComponent({
|
|
|
19545
19564
|
}
|
|
19546
19565
|
});
|
|
19547
19566
|
const _hoisted_1$10 = { class: "lupa-image-badges" };
|
|
19548
|
-
const _hoisted_2$
|
|
19567
|
+
const _hoisted_2$K = ["src"];
|
|
19549
19568
|
const _sfc_main$19 = /* @__PURE__ */ vue.defineComponent({
|
|
19550
19569
|
__name: "ImageBadge",
|
|
19551
19570
|
props: {
|
|
@@ -19574,7 +19593,7 @@ const _sfc_main$19 = /* @__PURE__ */ vue.defineComponent({
|
|
|
19574
19593
|
}, [
|
|
19575
19594
|
vue.createElementVNode("img", {
|
|
19576
19595
|
src: getImageUrl(item)
|
|
19577
|
-
}, null, 8, _hoisted_2$
|
|
19596
|
+
}, null, 8, _hoisted_2$K)
|
|
19578
19597
|
]);
|
|
19579
19598
|
}), 128))
|
|
19580
19599
|
]);
|
|
@@ -19733,7 +19752,7 @@ const _sfc_main$17 = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadV
|
|
|
19733
19752
|
}
|
|
19734
19753
|
}));
|
|
19735
19754
|
const _hoisted_1$_ = ["href"];
|
|
19736
|
-
const _hoisted_2$
|
|
19755
|
+
const _hoisted_2$J = { class: "lupa-search-box-product-details-section" };
|
|
19737
19756
|
const _hoisted_3$x = {
|
|
19738
19757
|
key: 0,
|
|
19739
19758
|
class: "lupa-search-box-product-add-to-cart-section"
|
|
@@ -19834,7 +19853,7 @@ const _sfc_main$16 = /* @__PURE__ */ vue.defineComponent({
|
|
|
19834
19853
|
}, null, 8, ["item", "element", "labels", "link"]);
|
|
19835
19854
|
}), 128))
|
|
19836
19855
|
], 4),
|
|
19837
|
-
vue.createElementVNode("div", _hoisted_2$
|
|
19856
|
+
vue.createElementVNode("div", _hoisted_2$J, [
|
|
19838
19857
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(detailElements.value, (element) => {
|
|
19839
19858
|
var _a;
|
|
19840
19859
|
return vue.openBlock(), vue.createBlock(_sfc_main$1e, {
|
|
@@ -20040,7 +20059,7 @@ const _sfc_main$15 = /* @__PURE__ */ vue.defineComponent({
|
|
|
20040
20059
|
}
|
|
20041
20060
|
});
|
|
20042
20061
|
const _hoisted_1$Y = { class: "lupa-search-box-documents-go-to-results-wrapper" };
|
|
20043
|
-
const _hoisted_2$
|
|
20062
|
+
const _hoisted_2$I = { key: 0 };
|
|
20044
20063
|
const _sfc_main$14 = /* @__PURE__ */ vue.defineComponent({
|
|
20045
20064
|
__name: "SearchBoxProductsGoToResultsButton",
|
|
20046
20065
|
props: {
|
|
@@ -20077,7 +20096,7 @@ const _sfc_main$14 = /* @__PURE__ */ vue.defineComponent({
|
|
|
20077
20096
|
onClick: goToResults
|
|
20078
20097
|
}, [
|
|
20079
20098
|
vue.createTextVNode(vue.toDisplayString(goToResultsLabel.value) + " ", 1),
|
|
20080
|
-
totalCount.value ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$
|
|
20099
|
+
totalCount.value ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$I, " " + vue.toDisplayString(totalCount.value), 1)) : vue.createCommentVNode("", true)
|
|
20081
20100
|
])
|
|
20082
20101
|
]);
|
|
20083
20102
|
};
|
|
@@ -20345,7 +20364,7 @@ const _hoisted_1$X = {
|
|
|
20345
20364
|
key: 0,
|
|
20346
20365
|
id: "lupa-search-box-panel"
|
|
20347
20366
|
};
|
|
20348
|
-
const _hoisted_2$
|
|
20367
|
+
const _hoisted_2$H = ["data-cy"];
|
|
20349
20368
|
const _hoisted_3$w = {
|
|
20350
20369
|
key: 0,
|
|
20351
20370
|
class: "lupa-panel-title lupa-panel-title-top-results"
|
|
@@ -20565,7 +20584,7 @@ const _sfc_main$11 = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadV
|
|
|
20565
20584
|
key: "0"
|
|
20566
20585
|
} : void 0
|
|
20567
20586
|
]), 1064, ["panel", "search-box-options", "options", "debounce", "inputValue", "labels"])) : vue.createCommentVNode("", true)
|
|
20568
|
-
], 14, _hoisted_2$
|
|
20587
|
+
], 14, _hoisted_2$H);
|
|
20569
20588
|
}), 128))
|
|
20570
20589
|
], 4),
|
|
20571
20590
|
!vue.unref(hasAnyResults) && _ctx.options.showNoResultsPanel ? (vue.openBlock(), vue.createBlock(_sfc_main$1r, {
|
|
@@ -20604,8 +20623,7 @@ const unbindSearchTriggers = (triggers = [], event) => {
|
|
|
20604
20623
|
const elements = getElements(triggers);
|
|
20605
20624
|
elements.forEach((e2) => e2 == null ? void 0 : e2.removeEventListener(BIND_EVENT, event));
|
|
20606
20625
|
};
|
|
20607
|
-
const _hoisted_1$W = {
|
|
20608
|
-
const _hoisted_2$H = { class: "lupa-search-box-wrapper" };
|
|
20626
|
+
const _hoisted_1$W = { class: "lupa-search-box-wrapper" };
|
|
20609
20627
|
const _sfc_main$10 = /* @__PURE__ */ vue.defineComponent({
|
|
20610
20628
|
__name: "SearchBox",
|
|
20611
20629
|
props: {
|
|
@@ -20916,8 +20934,11 @@ const _sfc_main$10 = /* @__PURE__ */ vue.defineComponent({
|
|
|
20916
20934
|
};
|
|
20917
20935
|
return (_ctx, _cache) => {
|
|
20918
20936
|
var _a2;
|
|
20919
|
-
return vue.openBlock(), vue.createElementBlock("div",
|
|
20920
|
-
|
|
20937
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
20938
|
+
id: "lupa-search-box",
|
|
20939
|
+
class: vue.normalizeClass({ "lupa-search-box-opened": opened.value })
|
|
20940
|
+
}, [
|
|
20941
|
+
vue.createElementVNode("div", _hoisted_1$W, [
|
|
20921
20942
|
vue.createVNode(_sfc_main$1v, {
|
|
20922
20943
|
options: inputOptions.value,
|
|
20923
20944
|
suggestedValue: suggestedValue.value,
|
|
@@ -20952,7 +20973,7 @@ const _sfc_main$10 = /* @__PURE__ */ vue.defineComponent({
|
|
|
20952
20973
|
} : void 0
|
|
20953
20974
|
]), 1032, ["options", "inputValue", "isSearchContainer", "focused"])) : vue.createCommentVNode("", true)
|
|
20954
20975
|
])
|
|
20955
|
-
]);
|
|
20976
|
+
], 2);
|
|
20956
20977
|
};
|
|
20957
20978
|
}
|
|
20958
20979
|
});
|
|
@@ -21562,6 +21583,8 @@ const _sfc_main$U = /* @__PURE__ */ vue.defineComponent({
|
|
|
21562
21583
|
setup(__props, { emit }) {
|
|
21563
21584
|
const props = __props;
|
|
21564
21585
|
const searchResultStore = useSearchResultStore();
|
|
21586
|
+
const optionsStore = useOptionsStore();
|
|
21587
|
+
const { searchResultOptions } = storeToRefs(optionsStore);
|
|
21565
21588
|
const facet = vue.computed(() => {
|
|
21566
21589
|
var _a;
|
|
21567
21590
|
return (_a = props.facet) != null ? _a : { type: "terms", items: [], key: "" };
|
|
@@ -21621,6 +21644,10 @@ const _sfc_main$U = /* @__PURE__ */ vue.defineComponent({
|
|
|
21621
21644
|
selectedItems = isRange.value && selectedItems ? [rangeFilterToString(selectedItems)] : selectedItems;
|
|
21622
21645
|
return selectedItems == null ? void 0 : selectedItems.includes((_b = item.title) == null ? void 0 : _b.toString());
|
|
21623
21646
|
};
|
|
21647
|
+
const getItemLabel = (item) => {
|
|
21648
|
+
var _a;
|
|
21649
|
+
return getTranslatedFacetValue(props.facet, item, (_a = searchResultOptions.value.filters) == null ? void 0 : _a.translations);
|
|
21650
|
+
};
|
|
21624
21651
|
return (_ctx, _cache) => {
|
|
21625
21652
|
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$O, [
|
|
21626
21653
|
isFilterable.value ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
|
|
@@ -21646,7 +21673,7 @@ const _sfc_main$U = /* @__PURE__ */ vue.defineComponent({
|
|
|
21646
21673
|
}, null, 2)
|
|
21647
21674
|
]),
|
|
21648
21675
|
vue.createElementVNode("div", _hoisted_6$8, [
|
|
21649
|
-
vue.createElementVNode("span", _hoisted_7$6, vue.toDisplayString(item
|
|
21676
|
+
vue.createElementVNode("span", _hoisted_7$6, vue.toDisplayString(getItemLabel(item)), 1),
|
|
21650
21677
|
_ctx.options.showDocumentCount ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_8$2, "(" + vue.toDisplayString(item.count) + ")", 1)) : vue.createCommentVNode("", true)
|
|
21651
21678
|
])
|
|
21652
21679
|
], 10, _hoisted_4$j);
|
|
@@ -23130,7 +23157,9 @@ const _sfc_main$Q = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadVa
|
|
|
23130
23157
|
return (_a2 = props.currentFilters) != null ? _a2 : {};
|
|
23131
23158
|
});
|
|
23132
23159
|
const searchResultStore = useSearchResultStore();
|
|
23160
|
+
const optionsStore = useOptionsStore();
|
|
23133
23161
|
const { currentFilterKeys } = storeToRefs(searchResultStore);
|
|
23162
|
+
const { searchResultOptions } = storeToRefs(optionsStore);
|
|
23134
23163
|
const isOpen = vue.ref((_b = (_a = props.options.expand) == null ? void 0 : _a.includes(props.facet.key)) != null ? _b : false);
|
|
23135
23164
|
const facetPanel = vue.ref(null);
|
|
23136
23165
|
const facetType = vue.computed(() => {
|
|
@@ -23169,6 +23198,10 @@ const _sfc_main$Q = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadVa
|
|
|
23169
23198
|
const facetKeyClass = vue.computed(() => {
|
|
23170
23199
|
return `lupa-facet-${facet.value.key}`;
|
|
23171
23200
|
});
|
|
23201
|
+
const facetLabel = vue.computed(() => {
|
|
23202
|
+
var _a2;
|
|
23203
|
+
return getTranslatedFacetKey(props.facet, (_a2 = searchResultOptions.value.filters) == null ? void 0 : _a2.translations);
|
|
23204
|
+
});
|
|
23172
23205
|
vue.onMounted(() => {
|
|
23173
23206
|
var _a2;
|
|
23174
23207
|
if (((_a2 = props.options.style) == null ? void 0 : _a2.type) === "top-dropdown") {
|
|
@@ -23224,7 +23257,7 @@ const _sfc_main$Q = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadVa
|
|
|
23224
23257
|
"data-cy": "lupa-search-result-facet-label",
|
|
23225
23258
|
onClick: toggleFacet
|
|
23226
23259
|
}, [
|
|
23227
|
-
vue.createElementVNode("div", _hoisted_1$K, vue.toDisplayString(
|
|
23260
|
+
vue.createElementVNode("div", _hoisted_1$K, vue.toDisplayString(facetLabel.value), 1),
|
|
23228
23261
|
vue.createElementVNode("div", {
|
|
23229
23262
|
class: vue.normalizeClass(["lupa-facet-label-caret", isOpen.value && "open"])
|
|
23230
23263
|
}, null, 2)
|
|
@@ -23726,10 +23759,10 @@ const _sfc_main$H = /* @__PURE__ */ vue.defineComponent({
|
|
|
23726
23759
|
const activeLabel = vue.computed(() => props.labels.mobileFilterButtonActive);
|
|
23727
23760
|
const openLabel = vue.computed(() => props.labels.mobileFilterButtonOpen);
|
|
23728
23761
|
const label = vue.computed(() => {
|
|
23729
|
-
if (isSidebarVisible.value) {
|
|
23762
|
+
if (isSidebarVisible.value && openLabel.value) {
|
|
23730
23763
|
return openLabel.value;
|
|
23731
23764
|
}
|
|
23732
|
-
if (hasActiveFilters.value) {
|
|
23765
|
+
if (hasActiveFilters.value && activeLabel.value) {
|
|
23733
23766
|
return activeLabel.value;
|
|
23734
23767
|
}
|
|
23735
23768
|
return defaultLabel.value;
|
package/dist/lupaSearch.mjs
CHANGED
|
@@ -2567,6 +2567,14 @@ const formatPriceSummary = ([min, max], currency, separator = ",", currencyTempl
|
|
|
2567
2567
|
}
|
|
2568
2568
|
return `< ${formatPrice(max, currency, separator, currencyTemplate)}`;
|
|
2569
2569
|
};
|
|
2570
|
+
const getTranslatedFacetKey = (facet, translations) => {
|
|
2571
|
+
var _a, _b;
|
|
2572
|
+
return (_b = (_a = translations == null ? void 0 : translations.keyTranslations) == null ? void 0 : _a[facet.key]) != null ? _b : facet.label;
|
|
2573
|
+
};
|
|
2574
|
+
const getTranslatedFacetValue = (facet, value, translations) => {
|
|
2575
|
+
var _a, _b, _c;
|
|
2576
|
+
return (_c = (_b = (_a = translations == null ? void 0 : translations.valueTranslations) == null ? void 0 : _a[facet.key]) == null ? void 0 : _b[value == null ? void 0 : value.title]) != null ? _c : value.title;
|
|
2577
|
+
};
|
|
2570
2578
|
const formatRange = (filter2) => {
|
|
2571
2579
|
var _a, _b;
|
|
2572
2580
|
const lt = (_a = filter2.lt) != null ? _a : filter2.lte;
|
|
@@ -2626,11 +2634,12 @@ const unfoldFilters = (filters, price = {}) => {
|
|
|
2626
2634
|
const seed = [];
|
|
2627
2635
|
return Object.entries(filters).reduce((a, c2) => [...a, ...unfoldFilter(...c2, price)], seed);
|
|
2628
2636
|
};
|
|
2629
|
-
const getLabeledFilters = (filters, facets2) => {
|
|
2637
|
+
const getLabeledFilters = (filters, facets2, translations) => {
|
|
2630
2638
|
return filters.map((f2) => {
|
|
2631
|
-
var _a, _b;
|
|
2639
|
+
var _a, _b, _c, _d;
|
|
2632
2640
|
return __spreadProps(__spreadValues({}, f2), {
|
|
2633
|
-
label: (
|
|
2641
|
+
label: (_d = (_c = (_a = translations == null ? void 0 : translations.keyTranslations) == null ? void 0 : _a[f2.key]) != null ? _c : (_b = facets2 == null ? void 0 : facets2.find((ft) => ft.key === f2.key)) == null ? void 0 : _b.label) != null ? _d : capitalize$1(f2.key),
|
|
2642
|
+
value: getTranslatedFacetValue({ key: f2.key }, { title: f2.value }, translations)
|
|
2634
2643
|
});
|
|
2635
2644
|
});
|
|
2636
2645
|
};
|
|
@@ -8983,7 +8992,7 @@ const useSearchBoxStore = defineStore("searchBox", () => {
|
|
|
8983
8992
|
};
|
|
8984
8993
|
});
|
|
8985
8994
|
const _hoisted_1$1i = { id: "lupa-search-box-input-container" };
|
|
8986
|
-
const _hoisted_2$
|
|
8995
|
+
const _hoisted_2$T = { class: "lupa-input-clear" };
|
|
8987
8996
|
const _hoisted_3$C = { id: "lupa-search-box-input" };
|
|
8988
8997
|
const _hoisted_4$s = ["value"];
|
|
8989
8998
|
const _hoisted_5$j = ["aria-label", "placeholder"];
|
|
@@ -9080,7 +9089,7 @@ const _sfc_main$1v = /* @__PURE__ */ defineComponent({
|
|
|
9080
9089
|
__expose({ focus });
|
|
9081
9090
|
return (_ctx, _cache) => {
|
|
9082
9091
|
return openBlock(), createElementBlock("div", _hoisted_1$1i, [
|
|
9083
|
-
createElementVNode("div", _hoisted_2$
|
|
9092
|
+
createElementVNode("div", _hoisted_2$T, [
|
|
9084
9093
|
createElementVNode("div", {
|
|
9085
9094
|
class: normalizeClass(["lupa-input-clear-content", { "lupa-input-clear-filled": inputValue.value }]),
|
|
9086
9095
|
onClick: clear
|
|
@@ -9163,7 +9172,7 @@ const _sfc_main$1u = /* @__PURE__ */ defineComponent({
|
|
|
9163
9172
|
}
|
|
9164
9173
|
});
|
|
9165
9174
|
const _hoisted_1$1h = { class: "lupa-search-box-history-item" };
|
|
9166
|
-
const _hoisted_2$
|
|
9175
|
+
const _hoisted_2$S = { class: "lupa-search-box-history-item-content" };
|
|
9167
9176
|
const _sfc_main$1t = /* @__PURE__ */ defineComponent({
|
|
9168
9177
|
__name: "SearchBoxHistoryItem",
|
|
9169
9178
|
props: {
|
|
@@ -9181,7 +9190,7 @@ const _sfc_main$1t = /* @__PURE__ */ defineComponent({
|
|
|
9181
9190
|
};
|
|
9182
9191
|
return (_ctx, _cache) => {
|
|
9183
9192
|
return openBlock(), createElementBlock("div", _hoisted_1$1h, [
|
|
9184
|
-
createElementVNode("div", _hoisted_2$
|
|
9193
|
+
createElementVNode("div", _hoisted_2$S, [
|
|
9185
9194
|
createElementVNode("div", {
|
|
9186
9195
|
class: normalizeClass(["lupa-search-box-history-item-text", { "lupa-search-box-history-item-highlighted": _ctx.highlighted }]),
|
|
9187
9196
|
onClick: click2
|
|
@@ -9308,7 +9317,7 @@ const generateGridTemplate = (elements) => {
|
|
|
9308
9317
|
return gridTemplate.join(" ");
|
|
9309
9318
|
};
|
|
9310
9319
|
const _hoisted_1$1e = ["innerHTML"];
|
|
9311
|
-
const _hoisted_2$
|
|
9320
|
+
const _hoisted_2$R = {
|
|
9312
9321
|
key: 1,
|
|
9313
9322
|
"data-cy": "lupa-suggestion-value",
|
|
9314
9323
|
class: "lupa-suggestion-value"
|
|
@@ -9362,7 +9371,7 @@ const _sfc_main$1q = /* @__PURE__ */ defineComponent({
|
|
|
9362
9371
|
class: "lupa-suggestion-value",
|
|
9363
9372
|
"data-cy": "lupa-suggestion-value",
|
|
9364
9373
|
innerHTML: _ctx.suggestion.displayHighlight
|
|
9365
|
-
}, null, 8, _hoisted_1$1e)) : (openBlock(), createElementBlock("div", _hoisted_2$
|
|
9374
|
+
}, null, 8, _hoisted_1$1e)) : (openBlock(), createElementBlock("div", _hoisted_2$R, toDisplayString(_ctx.suggestion.display), 1)),
|
|
9366
9375
|
_ctx.suggestion.facet ? (openBlock(), createElementBlock("div", _hoisted_3$B, [
|
|
9367
9376
|
createElementVNode("span", _hoisted_4$r, toDisplayString(facetLabel.value), 1),
|
|
9368
9377
|
createElementVNode("span", _hoisted_5$i, toDisplayString(_ctx.suggestion.facet.title), 1)
|
|
@@ -18551,6 +18560,11 @@ const processDisplayCondition = (displayCondition, doc = {}) => {
|
|
|
18551
18560
|
case "exists": {
|
|
18552
18561
|
return fields == null ? void 0 : fields.every((field) => getFieldValue(doc, field) !== void 0);
|
|
18553
18562
|
}
|
|
18563
|
+
case "notExists": {
|
|
18564
|
+
return fields == null ? void 0 : fields.every(
|
|
18565
|
+
(field) => getFieldValue(doc, field) === void 0 || getFieldValue(doc, field) === null
|
|
18566
|
+
);
|
|
18567
|
+
}
|
|
18554
18568
|
case "equals": {
|
|
18555
18569
|
if (fields.length < 2)
|
|
18556
18570
|
return false;
|
|
@@ -18607,7 +18621,7 @@ const replaceImageWithPlaceholder = (e2, placeholder) => {
|
|
|
18607
18621
|
}
|
|
18608
18622
|
};
|
|
18609
18623
|
const _hoisted_1$1c = ["src"];
|
|
18610
|
-
const _hoisted_2$
|
|
18624
|
+
const _hoisted_2$Q = ["src"];
|
|
18611
18625
|
const _sfc_main$1n = /* @__PURE__ */ defineComponent({
|
|
18612
18626
|
__name: "ProductImage",
|
|
18613
18627
|
props: {
|
|
@@ -18758,7 +18772,7 @@ const _sfc_main$1n = /* @__PURE__ */ defineComponent({
|
|
|
18758
18772
|
class: ["lupa-images-main-image", { [_ctx.imageClass]: true }],
|
|
18759
18773
|
style: styleOverride.value,
|
|
18760
18774
|
src: finalMainImageUrl.value
|
|
18761
|
-
}, { alt: imageAlt.value ? imageAlt.value : void 0 }, { onError: replaceWithPlaceholder }), null, 16, _hoisted_2$
|
|
18775
|
+
}, { alt: imageAlt.value ? imageAlt.value : void 0 }, { onError: replaceWithPlaceholder }), null, 16, _hoisted_2$Q))
|
|
18762
18776
|
], 38);
|
|
18763
18777
|
};
|
|
18764
18778
|
}
|
|
@@ -18781,7 +18795,7 @@ const _sfc_main$1m = /* @__PURE__ */ defineComponent({
|
|
|
18781
18795
|
}
|
|
18782
18796
|
});
|
|
18783
18797
|
const _hoisted_1$1b = ["innerHTML"];
|
|
18784
|
-
const _hoisted_2$
|
|
18798
|
+
const _hoisted_2$P = {
|
|
18785
18799
|
key: 1,
|
|
18786
18800
|
class: "lupa-search-box-product-title"
|
|
18787
18801
|
};
|
|
@@ -18808,14 +18822,14 @@ const _sfc_main$1l = /* @__PURE__ */ defineComponent({
|
|
|
18808
18822
|
key: 0,
|
|
18809
18823
|
class: "lupa-search-box-product-title",
|
|
18810
18824
|
innerHTML: sanitizedTitle.value
|
|
18811
|
-
}, null, 8, _hoisted_1$1b)) : (openBlock(), createElementBlock("div", _hoisted_2$
|
|
18825
|
+
}, null, 8, _hoisted_1$1b)) : (openBlock(), createElementBlock("div", _hoisted_2$P, [
|
|
18812
18826
|
createElementVNode("strong", null, toDisplayString(title.value), 1)
|
|
18813
18827
|
]));
|
|
18814
18828
|
};
|
|
18815
18829
|
}
|
|
18816
18830
|
});
|
|
18817
18831
|
const _hoisted_1$1a = ["innerHTML"];
|
|
18818
|
-
const _hoisted_2$
|
|
18832
|
+
const _hoisted_2$O = {
|
|
18819
18833
|
key: 1,
|
|
18820
18834
|
class: "lupa-search-box-product-description"
|
|
18821
18835
|
};
|
|
@@ -18842,7 +18856,7 @@ const _sfc_main$1k = /* @__PURE__ */ defineComponent({
|
|
|
18842
18856
|
key: 0,
|
|
18843
18857
|
class: "lupa-search-box-product-description",
|
|
18844
18858
|
innerHTML: sanitizedDescription.value
|
|
18845
|
-
}, null, 8, _hoisted_1$1a)) : (openBlock(), createElementBlock("div", _hoisted_2$
|
|
18859
|
+
}, null, 8, _hoisted_1$1a)) : (openBlock(), createElementBlock("div", _hoisted_2$O, toDisplayString(description.value), 1));
|
|
18846
18860
|
};
|
|
18847
18861
|
}
|
|
18848
18862
|
});
|
|
@@ -18901,7 +18915,7 @@ const _sfc_main$1i = /* @__PURE__ */ defineComponent({
|
|
|
18901
18915
|
}
|
|
18902
18916
|
});
|
|
18903
18917
|
const _hoisted_1$18 = ["innerHTML"];
|
|
18904
|
-
const _hoisted_2$
|
|
18918
|
+
const _hoisted_2$N = { key: 0 };
|
|
18905
18919
|
const _hoisted_3$A = { key: 1 };
|
|
18906
18920
|
const _hoisted_4$q = { class: "lupa-search-box-custom-label" };
|
|
18907
18921
|
const _hoisted_5$h = { class: "lupa-search-box-custom-text" };
|
|
@@ -18935,7 +18949,7 @@ const _sfc_main$1h = /* @__PURE__ */ defineComponent({
|
|
|
18935
18949
|
key: 1,
|
|
18936
18950
|
class: [className.value, "lupa-search-box-product-custom"]
|
|
18937
18951
|
}, toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), [
|
|
18938
|
-
!label.value ? (openBlock(), createElementBlock("div", _hoisted_2$
|
|
18952
|
+
!label.value ? (openBlock(), createElementBlock("div", _hoisted_2$N, toDisplayString(text.value), 1)) : (openBlock(), createElementBlock("div", _hoisted_3$A, [
|
|
18939
18953
|
createElementVNode("div", _hoisted_4$q, toDisplayString(label.value), 1),
|
|
18940
18954
|
createElementVNode("div", _hoisted_5$h, toDisplayString(text.value), 1)
|
|
18941
18955
|
]))
|
|
@@ -19058,6 +19072,10 @@ const useSearchResultStore = defineStore("searchResult", () => {
|
|
|
19058
19072
|
var _a, _b, _c;
|
|
19059
19073
|
return (_c = (_b = (_a = searchResultOptions.value) == null ? void 0 : _a.labels) == null ? void 0 : _b.currencyTemplate) != null ? _c : "";
|
|
19060
19074
|
});
|
|
19075
|
+
const filterTranslations = computed(() => {
|
|
19076
|
+
var _a, _b, _c;
|
|
19077
|
+
return (_c = (_b = (_a = searchResultOptions.value) == null ? void 0 : _a.filters) == null ? void 0 : _b.translations) != null ? _c : {};
|
|
19078
|
+
});
|
|
19061
19079
|
const labeledFilters = computed(
|
|
19062
19080
|
() => getLabeledFilters(
|
|
19063
19081
|
unfoldFilters(filters.value, {
|
|
@@ -19066,7 +19084,8 @@ const useSearchResultStore = defineStore("searchResult", () => {
|
|
|
19066
19084
|
separator: priceSeparator.value,
|
|
19067
19085
|
currencyTemplate: currencyTemplate.value
|
|
19068
19086
|
}),
|
|
19069
|
-
facets2.value
|
|
19087
|
+
facets2.value,
|
|
19088
|
+
filterTranslations.value
|
|
19070
19089
|
)
|
|
19071
19090
|
);
|
|
19072
19091
|
const displayFilters = computed(() => {
|
|
@@ -19249,7 +19268,7 @@ const useSearchResultStore = defineStore("searchResult", () => {
|
|
|
19249
19268
|
};
|
|
19250
19269
|
});
|
|
19251
19270
|
const _hoisted_1$16 = { class: "lupa-search-box-add-to-cart-wrapper" };
|
|
19252
|
-
const _hoisted_2$
|
|
19271
|
+
const _hoisted_2$M = { class: "lupa-search-box-product-addtocart" };
|
|
19253
19272
|
const _hoisted_3$z = ["onClick", "disabled"];
|
|
19254
19273
|
const _sfc_main$1f = /* @__PURE__ */ defineComponent({
|
|
19255
19274
|
__name: "SearchBoxProductAddToCart",
|
|
@@ -19286,7 +19305,7 @@ const _sfc_main$1f = /* @__PURE__ */ defineComponent({
|
|
|
19286
19305
|
});
|
|
19287
19306
|
return (_ctx, _cache) => {
|
|
19288
19307
|
return openBlock(), createElementBlock("div", _hoisted_1$16, [
|
|
19289
|
-
createElementVNode("div", _hoisted_2$
|
|
19308
|
+
createElementVNode("div", _hoisted_2$M, [
|
|
19290
19309
|
createElementVNode("button", mergeProps({
|
|
19291
19310
|
onClick: withModifiers(handleClick, ["stop", "prevent"]),
|
|
19292
19311
|
class: loading.value ? "lupa-add-to-cart-loading" : "lupa-add-to-cart",
|
|
@@ -19400,7 +19419,7 @@ const _sfc_main$1e = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValue
|
|
|
19400
19419
|
}
|
|
19401
19420
|
}));
|
|
19402
19421
|
const _hoisted_1$14 = { class: "lupa-badge-title" };
|
|
19403
|
-
const _hoisted_2$
|
|
19422
|
+
const _hoisted_2$L = ["src"];
|
|
19404
19423
|
const _hoisted_3$y = { key: 1 };
|
|
19405
19424
|
const _hoisted_4$p = {
|
|
19406
19425
|
key: 0,
|
|
@@ -19443,7 +19462,7 @@ const _sfc_main$1d = /* @__PURE__ */ defineComponent({
|
|
|
19443
19462
|
image.value ? (openBlock(), createElementBlock("img", {
|
|
19444
19463
|
key: 0,
|
|
19445
19464
|
src: image.value
|
|
19446
|
-
}, null, 8, _hoisted_2$
|
|
19465
|
+
}, null, 8, _hoisted_2$L)) : createCommentVNode("", true),
|
|
19447
19466
|
hasTitleText.value && showTitle.value ? (openBlock(), createElementBlock("span", _hoisted_3$y, toDisplayString(_ctx.badge.titleText), 1)) : createCommentVNode("", true)
|
|
19448
19467
|
]),
|
|
19449
19468
|
hasAdditionalText.value ? (openBlock(), createElementBlock("span", _hoisted_4$p, toDisplayString(_ctx.badge.additionalText), 1)) : createCommentVNode("", true)
|
|
@@ -19543,7 +19562,7 @@ const _sfc_main$1a = /* @__PURE__ */ defineComponent({
|
|
|
19543
19562
|
}
|
|
19544
19563
|
});
|
|
19545
19564
|
const _hoisted_1$10 = { class: "lupa-image-badges" };
|
|
19546
|
-
const _hoisted_2$
|
|
19565
|
+
const _hoisted_2$K = ["src"];
|
|
19547
19566
|
const _sfc_main$19 = /* @__PURE__ */ defineComponent({
|
|
19548
19567
|
__name: "ImageBadge",
|
|
19549
19568
|
props: {
|
|
@@ -19572,7 +19591,7 @@ const _sfc_main$19 = /* @__PURE__ */ defineComponent({
|
|
|
19572
19591
|
}, [
|
|
19573
19592
|
createElementVNode("img", {
|
|
19574
19593
|
src: getImageUrl(item)
|
|
19575
|
-
}, null, 8, _hoisted_2$
|
|
19594
|
+
}, null, 8, _hoisted_2$K)
|
|
19576
19595
|
]);
|
|
19577
19596
|
}), 128))
|
|
19578
19597
|
]);
|
|
@@ -19731,7 +19750,7 @@ const _sfc_main$17 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValue
|
|
|
19731
19750
|
}
|
|
19732
19751
|
}));
|
|
19733
19752
|
const _hoisted_1$_ = ["href"];
|
|
19734
|
-
const _hoisted_2$
|
|
19753
|
+
const _hoisted_2$J = { class: "lupa-search-box-product-details-section" };
|
|
19735
19754
|
const _hoisted_3$x = {
|
|
19736
19755
|
key: 0,
|
|
19737
19756
|
class: "lupa-search-box-product-add-to-cart-section"
|
|
@@ -19832,7 +19851,7 @@ const _sfc_main$16 = /* @__PURE__ */ defineComponent({
|
|
|
19832
19851
|
}, null, 8, ["item", "element", "labels", "link"]);
|
|
19833
19852
|
}), 128))
|
|
19834
19853
|
], 4),
|
|
19835
|
-
createElementVNode("div", _hoisted_2$
|
|
19854
|
+
createElementVNode("div", _hoisted_2$J, [
|
|
19836
19855
|
(openBlock(true), createElementBlock(Fragment, null, renderList(detailElements.value, (element) => {
|
|
19837
19856
|
var _a;
|
|
19838
19857
|
return openBlock(), createBlock(_sfc_main$1e, {
|
|
@@ -20038,7 +20057,7 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
|
|
|
20038
20057
|
}
|
|
20039
20058
|
});
|
|
20040
20059
|
const _hoisted_1$Y = { class: "lupa-search-box-documents-go-to-results-wrapper" };
|
|
20041
|
-
const _hoisted_2$
|
|
20060
|
+
const _hoisted_2$I = { key: 0 };
|
|
20042
20061
|
const _sfc_main$14 = /* @__PURE__ */ defineComponent({
|
|
20043
20062
|
__name: "SearchBoxProductsGoToResultsButton",
|
|
20044
20063
|
props: {
|
|
@@ -20075,7 +20094,7 @@ const _sfc_main$14 = /* @__PURE__ */ defineComponent({
|
|
|
20075
20094
|
onClick: goToResults
|
|
20076
20095
|
}, [
|
|
20077
20096
|
createTextVNode(toDisplayString(goToResultsLabel.value) + " ", 1),
|
|
20078
|
-
totalCount.value ? (openBlock(), createElementBlock("span", _hoisted_2$
|
|
20097
|
+
totalCount.value ? (openBlock(), createElementBlock("span", _hoisted_2$I, " " + toDisplayString(totalCount.value), 1)) : createCommentVNode("", true)
|
|
20079
20098
|
])
|
|
20080
20099
|
]);
|
|
20081
20100
|
};
|
|
@@ -20343,7 +20362,7 @@ const _hoisted_1$X = {
|
|
|
20343
20362
|
key: 0,
|
|
20344
20363
|
id: "lupa-search-box-panel"
|
|
20345
20364
|
};
|
|
20346
|
-
const _hoisted_2$
|
|
20365
|
+
const _hoisted_2$H = ["data-cy"];
|
|
20347
20366
|
const _hoisted_3$w = {
|
|
20348
20367
|
key: 0,
|
|
20349
20368
|
class: "lupa-panel-title lupa-panel-title-top-results"
|
|
@@ -20563,7 +20582,7 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValue
|
|
|
20563
20582
|
key: "0"
|
|
20564
20583
|
} : void 0
|
|
20565
20584
|
]), 1064, ["panel", "search-box-options", "options", "debounce", "inputValue", "labels"])) : createCommentVNode("", true)
|
|
20566
|
-
], 14, _hoisted_2$
|
|
20585
|
+
], 14, _hoisted_2$H);
|
|
20567
20586
|
}), 128))
|
|
20568
20587
|
], 4),
|
|
20569
20588
|
!unref(hasAnyResults) && _ctx.options.showNoResultsPanel ? (openBlock(), createBlock(_sfc_main$1r, {
|
|
@@ -20602,8 +20621,7 @@ const unbindSearchTriggers = (triggers = [], event) => {
|
|
|
20602
20621
|
const elements = getElements(triggers);
|
|
20603
20622
|
elements.forEach((e2) => e2 == null ? void 0 : e2.removeEventListener(BIND_EVENT, event));
|
|
20604
20623
|
};
|
|
20605
|
-
const _hoisted_1$W = {
|
|
20606
|
-
const _hoisted_2$H = { class: "lupa-search-box-wrapper" };
|
|
20624
|
+
const _hoisted_1$W = { class: "lupa-search-box-wrapper" };
|
|
20607
20625
|
const _sfc_main$10 = /* @__PURE__ */ defineComponent({
|
|
20608
20626
|
__name: "SearchBox",
|
|
20609
20627
|
props: {
|
|
@@ -20914,8 +20932,11 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
|
|
|
20914
20932
|
};
|
|
20915
20933
|
return (_ctx, _cache) => {
|
|
20916
20934
|
var _a2;
|
|
20917
|
-
return openBlock(), createElementBlock("div",
|
|
20918
|
-
|
|
20935
|
+
return openBlock(), createElementBlock("div", {
|
|
20936
|
+
id: "lupa-search-box",
|
|
20937
|
+
class: normalizeClass({ "lupa-search-box-opened": opened.value })
|
|
20938
|
+
}, [
|
|
20939
|
+
createElementVNode("div", _hoisted_1$W, [
|
|
20919
20940
|
createVNode(_sfc_main$1v, {
|
|
20920
20941
|
options: inputOptions.value,
|
|
20921
20942
|
suggestedValue: suggestedValue.value,
|
|
@@ -20950,7 +20971,7 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
|
|
|
20950
20971
|
} : void 0
|
|
20951
20972
|
]), 1032, ["options", "inputValue", "isSearchContainer", "focused"])) : createCommentVNode("", true)
|
|
20952
20973
|
])
|
|
20953
|
-
]);
|
|
20974
|
+
], 2);
|
|
20954
20975
|
};
|
|
20955
20976
|
}
|
|
20956
20977
|
});
|
|
@@ -21560,6 +21581,8 @@ const _sfc_main$U = /* @__PURE__ */ defineComponent({
|
|
|
21560
21581
|
setup(__props, { emit }) {
|
|
21561
21582
|
const props = __props;
|
|
21562
21583
|
const searchResultStore = useSearchResultStore();
|
|
21584
|
+
const optionsStore = useOptionsStore();
|
|
21585
|
+
const { searchResultOptions } = storeToRefs(optionsStore);
|
|
21563
21586
|
const facet = computed(() => {
|
|
21564
21587
|
var _a;
|
|
21565
21588
|
return (_a = props.facet) != null ? _a : { type: "terms", items: [], key: "" };
|
|
@@ -21619,6 +21642,10 @@ const _sfc_main$U = /* @__PURE__ */ defineComponent({
|
|
|
21619
21642
|
selectedItems = isRange.value && selectedItems ? [rangeFilterToString(selectedItems)] : selectedItems;
|
|
21620
21643
|
return selectedItems == null ? void 0 : selectedItems.includes((_b = item.title) == null ? void 0 : _b.toString());
|
|
21621
21644
|
};
|
|
21645
|
+
const getItemLabel = (item) => {
|
|
21646
|
+
var _a;
|
|
21647
|
+
return getTranslatedFacetValue(props.facet, item, (_a = searchResultOptions.value.filters) == null ? void 0 : _a.translations);
|
|
21648
|
+
};
|
|
21622
21649
|
return (_ctx, _cache) => {
|
|
21623
21650
|
return openBlock(), createElementBlock("div", _hoisted_1$O, [
|
|
21624
21651
|
isFilterable.value ? withDirectives((openBlock(), createElementBlock("input", {
|
|
@@ -21644,7 +21671,7 @@ const _sfc_main$U = /* @__PURE__ */ defineComponent({
|
|
|
21644
21671
|
}, null, 2)
|
|
21645
21672
|
]),
|
|
21646
21673
|
createElementVNode("div", _hoisted_6$8, [
|
|
21647
|
-
createElementVNode("span", _hoisted_7$6, toDisplayString(item
|
|
21674
|
+
createElementVNode("span", _hoisted_7$6, toDisplayString(getItemLabel(item)), 1),
|
|
21648
21675
|
_ctx.options.showDocumentCount ? (openBlock(), createElementBlock("span", _hoisted_8$2, "(" + toDisplayString(item.count) + ")", 1)) : createCommentVNode("", true)
|
|
21649
21676
|
])
|
|
21650
21677
|
], 10, _hoisted_4$j);
|
|
@@ -23128,7 +23155,9 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
|
|
|
23128
23155
|
return (_a2 = props.currentFilters) != null ? _a2 : {};
|
|
23129
23156
|
});
|
|
23130
23157
|
const searchResultStore = useSearchResultStore();
|
|
23158
|
+
const optionsStore = useOptionsStore();
|
|
23131
23159
|
const { currentFilterKeys } = storeToRefs(searchResultStore);
|
|
23160
|
+
const { searchResultOptions } = storeToRefs(optionsStore);
|
|
23132
23161
|
const isOpen = ref((_b = (_a = props.options.expand) == null ? void 0 : _a.includes(props.facet.key)) != null ? _b : false);
|
|
23133
23162
|
const facetPanel = ref(null);
|
|
23134
23163
|
const facetType = computed(() => {
|
|
@@ -23167,6 +23196,10 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
|
|
|
23167
23196
|
const facetKeyClass = computed(() => {
|
|
23168
23197
|
return `lupa-facet-${facet.value.key}`;
|
|
23169
23198
|
});
|
|
23199
|
+
const facetLabel = computed(() => {
|
|
23200
|
+
var _a2;
|
|
23201
|
+
return getTranslatedFacetKey(props.facet, (_a2 = searchResultOptions.value.filters) == null ? void 0 : _a2.translations);
|
|
23202
|
+
});
|
|
23170
23203
|
onMounted(() => {
|
|
23171
23204
|
var _a2;
|
|
23172
23205
|
if (((_a2 = props.options.style) == null ? void 0 : _a2.type) === "top-dropdown") {
|
|
@@ -23222,7 +23255,7 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
|
|
|
23222
23255
|
"data-cy": "lupa-search-result-facet-label",
|
|
23223
23256
|
onClick: toggleFacet
|
|
23224
23257
|
}, [
|
|
23225
|
-
createElementVNode("div", _hoisted_1$K, toDisplayString(
|
|
23258
|
+
createElementVNode("div", _hoisted_1$K, toDisplayString(facetLabel.value), 1),
|
|
23226
23259
|
createElementVNode("div", {
|
|
23227
23260
|
class: normalizeClass(["lupa-facet-label-caret", isOpen.value && "open"])
|
|
23228
23261
|
}, null, 2)
|
|
@@ -23724,10 +23757,10 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
|
23724
23757
|
const activeLabel = computed(() => props.labels.mobileFilterButtonActive);
|
|
23725
23758
|
const openLabel = computed(() => props.labels.mobileFilterButtonOpen);
|
|
23726
23759
|
const label = computed(() => {
|
|
23727
|
-
if (isSidebarVisible.value) {
|
|
23760
|
+
if (isSidebarVisible.value && openLabel.value) {
|
|
23728
23761
|
return openLabel.value;
|
|
23729
23762
|
}
|
|
23730
|
-
if (hasActiveFilters.value) {
|
|
23763
|
+
if (hasActiveFilters.value && activeLabel.value) {
|
|
23731
23764
|
return activeLabel.value;
|
|
23732
23765
|
}
|
|
23733
23766
|
return defaultLabel.value;
|
|
@@ -11,7 +11,7 @@ export declare enum DocumentElementType {
|
|
|
11
11
|
CUSTOM_HTML = "customHtml"
|
|
12
12
|
}
|
|
13
13
|
export type DisplayCondition = {
|
|
14
|
-
condition: 'exists' | 'equals' | 'notEquals' | 'greaterThan' | 'lessThan' | 'greaterThanOrEquals' | 'lessThanOrEquals';
|
|
14
|
+
condition: 'exists' | 'notExists' | 'equals' | 'notEquals' | 'greaterThan' | 'lessThan' | 'greaterThanOrEquals' | 'lessThanOrEquals';
|
|
15
15
|
fields: (string | number)[];
|
|
16
16
|
};
|
|
17
17
|
export type DynamicAttribute = {
|
|
@@ -8,6 +8,7 @@ import { RelatedQueryOptions } from './RelatedQueryOptions';
|
|
|
8
8
|
import { RedirectionSuggestionOptions } from './RedirectionSuggestionOptionts';
|
|
9
9
|
import { FilterGroup } from '@getlupa/client-sdk/Types';
|
|
10
10
|
import { DataExtraction } from '../DataExtraction';
|
|
11
|
+
import { FilterTranslationOptions } from './FilterTranslationOptions';
|
|
11
12
|
export type SearchResultsOptions = SearchResultsProductOptions & SearchResultsAdditionalPanels & {
|
|
12
13
|
containerSelector: string;
|
|
13
14
|
breadcrumbs: SearchResultsBreadcrumb[];
|
|
@@ -231,6 +232,7 @@ export type SearchResultsFilterOptions = {
|
|
|
231
232
|
currentFilters?: ResultCurrentFilterOptions;
|
|
232
233
|
facets?: ResultFacetOptions;
|
|
233
234
|
categories?: CategoryFilterOptions;
|
|
235
|
+
translations?: FilterTranslationOptions;
|
|
234
236
|
};
|
|
235
237
|
export type SearchResultsBreadcrumb = {
|
|
236
238
|
label: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { LabeledFilter, UnfoldedFilter } from '../types/search-results/Filters';
|
|
2
2
|
import type { FacetResult, FilterGroup, FilterGroupItemTypeRange, HierarchyTree } from '@getlupa/client-sdk/Types';
|
|
3
|
+
import { FilterTranslationOptions } from '../types/search-results/FilterTranslationOptions';
|
|
3
4
|
export declare const formatRange: (filter: FilterGroupItemTypeRange) => string;
|
|
4
5
|
export declare const unfoldFilters: (filters?: FilterGroup, price?: {
|
|
5
6
|
keys?: string[];
|
|
@@ -7,7 +8,7 @@ export declare const unfoldFilters: (filters?: FilterGroup, price?: {
|
|
|
7
8
|
separator?: string;
|
|
8
9
|
currencyTemplate?: string;
|
|
9
10
|
}) => UnfoldedFilter[];
|
|
10
|
-
export declare const getLabeledFilters: (filters: UnfoldedFilter[], facets?: FacetResult[]) => LabeledFilter[];
|
|
11
|
+
export declare const getLabeledFilters: (filters: UnfoldedFilter[], facets?: FacetResult[], translations?: FilterTranslationOptions) => LabeledFilter[];
|
|
11
12
|
export declare const isFacetKey: (key: string) => boolean;
|
|
12
13
|
export declare const isArrayKey: (key: string) => boolean;
|
|
13
14
|
export declare const getMostSpecificHierarchyTerms: (terms: string[]) => string[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FilterTranslationOptions } from '../types/search-results/FilterTranslationOptions';
|
|
2
|
+
export declare const getTranslatedFacetKey: (facet: {
|
|
3
|
+
key: string;
|
|
4
|
+
label: string;
|
|
5
|
+
}, translations?: FilterTranslationOptions) => string;
|
|
6
|
+
export declare const getTranslatedFacetValue: (facet: {
|
|
7
|
+
key: string;
|
|
8
|
+
}, value: {
|
|
9
|
+
title: string;
|
|
10
|
+
}, translations?: FilterTranslationOptions) => string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getlupa/vue",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.6",
|
|
4
4
|
"main": "dist/lupaSearch.mjs",
|
|
5
5
|
"module": "dist/lupaSearch.mjs",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
@@ -70,5 +70,6 @@
|
|
|
70
70
|
"dependencies": {
|
|
71
71
|
"mustache": "^4.2.0",
|
|
72
72
|
"sanitize-html": "^2.13.0"
|
|
73
|
-
}
|
|
73
|
+
},
|
|
74
|
+
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
|
74
75
|
}
|