@getlupa/client 1.8.0 → 1.8.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.iife.js +69 -54
- package/dist/lupaSearch.js +69 -54
- package/dist/lupaSearch.mjs +69 -54
- package/dist/lupaSearch.umd.js +69 -54
- package/package.json +2 -2
package/dist/lupaSearch.iife.js
CHANGED
|
@@ -8356,6 +8356,13 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8356
8356
|
});
|
|
8357
8357
|
return { dynamicDataIdMap, loading, enhanceSearchResultsWithDynamicData };
|
|
8358
8358
|
});
|
|
8359
|
+
const joinUrlParts = (...parts) => {
|
|
8360
|
+
var _a, _b, _c;
|
|
8361
|
+
if (parts.length === 1) {
|
|
8362
|
+
return `${parts[0]}`;
|
|
8363
|
+
}
|
|
8364
|
+
return (_c = (_b = (_a = parts == null ? void 0 : parts.map((part) => part.replace(/(^\/+|\/+$)/g, ""))) == null ? void 0 : _a.filter((part) => part !== "")) == null ? void 0 : _b.join("/")) != null ? _c : "";
|
|
8365
|
+
};
|
|
8359
8366
|
const _hoisted_1$16 = ["src"];
|
|
8360
8367
|
const _sfc_main$1c = /* @__PURE__ */ defineComponent({
|
|
8361
8368
|
__name: "ProductImage",
|
|
@@ -8374,12 +8381,11 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8374
8381
|
return typeof imageUrl2 === "string" && (imageUrl2.indexOf("http://") === 0 || imageUrl2.indexOf("https://") === 0);
|
|
8375
8382
|
});
|
|
8376
8383
|
const imageUrl = computed(() => {
|
|
8377
|
-
var _a;
|
|
8378
8384
|
const imageUrl2 = image.value;
|
|
8379
8385
|
if (hasFullImageUrl.value) {
|
|
8380
8386
|
return imageUrl2;
|
|
8381
8387
|
}
|
|
8382
|
-
return
|
|
8388
|
+
return rootImageUrl.value ? joinUrlParts(rootImageUrl.value, imageUrl2) : `/${imageUrl2}`;
|
|
8383
8389
|
});
|
|
8384
8390
|
const hasImage = computed(() => Boolean(hasFullImageUrl.value || image.value));
|
|
8385
8391
|
const placeholder = computed(() => props.options.placeholder);
|
|
@@ -27484,7 +27490,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
27484
27490
|
redirections,
|
|
27485
27491
|
placeholderImage
|
|
27486
27492
|
}) => {
|
|
27487
|
-
var _a, _b;
|
|
27493
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
27488
27494
|
const panels = [
|
|
27489
27495
|
...(panelOptions == null ? void 0 : panelOptions.suggestionPanel) ? [
|
|
27490
27496
|
{
|
|
@@ -27493,7 +27499,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
27493
27499
|
highlight: true,
|
|
27494
27500
|
limit: 8,
|
|
27495
27501
|
labels: {
|
|
27496
|
-
topResultsTitle: labels.searchBox.topSuggestionsTitle
|
|
27502
|
+
topResultsTitle: (_a = labels == null ? void 0 : labels.searchBox) == null ? void 0 : _a.topSuggestionsTitle
|
|
27497
27503
|
}
|
|
27498
27504
|
}
|
|
27499
27505
|
] : [],
|
|
@@ -27506,22 +27512,25 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
27506
27512
|
{
|
|
27507
27513
|
type: "image",
|
|
27508
27514
|
placeholder: placeholderImage,
|
|
27509
|
-
key: searchBoxOptions.fields.imageKey,
|
|
27510
|
-
baseUrl: searchBoxOptions.fields.baseImageUrl
|
|
27515
|
+
key: (_b = searchBoxOptions.fields) == null ? void 0 : _b.imageKey,
|
|
27516
|
+
baseUrl: (_c = searchBoxOptions.fields) == null ? void 0 : _c.baseImageUrl
|
|
27511
27517
|
},
|
|
27512
27518
|
{
|
|
27513
27519
|
type: "title",
|
|
27514
|
-
key: searchBoxOptions.fields.titleKey,
|
|
27520
|
+
key: (_d = searchBoxOptions.fields) == null ? void 0 : _d.titleKey,
|
|
27515
27521
|
maxLines: 2
|
|
27516
27522
|
},
|
|
27517
27523
|
{
|
|
27518
27524
|
type: "regularPrice",
|
|
27519
|
-
key: searchBoxOptions.fields.regularPriceKey,
|
|
27520
|
-
display: (doc2) =>
|
|
27525
|
+
key: (_e = searchBoxOptions.fields) == null ? void 0 : _e.regularPriceKey,
|
|
27526
|
+
display: (doc2) => {
|
|
27527
|
+
var _a2, _b2, _c2, _d2;
|
|
27528
|
+
return ((_a2 = searchBoxOptions.fields) == null ? void 0 : _a2.regularPriceKey) && ((_b2 = searchBoxOptions.fields) == null ? void 0 : _b2.discountPriceKey) && parseFloat(doc2[(_c2 = searchBoxOptions.fields) == null ? void 0 : _c2.regularPriceKey]) > parseFloat(doc2[(_d2 = searchBoxOptions.fields) == null ? void 0 : _d2.discountPriceKey]);
|
|
27529
|
+
}
|
|
27521
27530
|
},
|
|
27522
27531
|
{
|
|
27523
27532
|
type: "price",
|
|
27524
|
-
key: searchBoxOptions.fields.discountPriceKey
|
|
27533
|
+
key: (_f = searchBoxOptions.fields) == null ? void 0 : _f.discountPriceKey
|
|
27525
27534
|
}
|
|
27526
27535
|
]
|
|
27527
27536
|
}
|
|
@@ -27530,7 +27539,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
27530
27539
|
return {
|
|
27531
27540
|
inputSelector: searchBoxOptions.inputSelector,
|
|
27532
27541
|
options: {
|
|
27533
|
-
environment: (
|
|
27542
|
+
environment: (_g = searchBoxOptions.environment) != null ? _g : "production",
|
|
27534
27543
|
customUrl: searchBoxOptions.customUrl,
|
|
27535
27544
|
customBaseUrl: searchBoxOptions.customBaseUrl,
|
|
27536
27545
|
customPayload: searchBoxOptions.customPayload,
|
|
@@ -27538,9 +27547,9 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
27538
27547
|
},
|
|
27539
27548
|
showTotalCount: true,
|
|
27540
27549
|
expandOnSinglePanel: true,
|
|
27541
|
-
minInputLength: (
|
|
27550
|
+
minInputLength: (_i = (_h = searchBoxOptions.fields) == null ? void 0 : _h.minInputLength) != null ? _i : 0,
|
|
27542
27551
|
debounce: 250,
|
|
27543
|
-
labels: labels.searchBox,
|
|
27552
|
+
labels: labels == null ? void 0 : labels.searchBox,
|
|
27544
27553
|
links: {
|
|
27545
27554
|
searchResults: ""
|
|
27546
27555
|
},
|
|
@@ -27548,7 +27557,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
27548
27557
|
redirections,
|
|
27549
27558
|
history: {
|
|
27550
27559
|
labels: {
|
|
27551
|
-
clear: labels.searchBox.clearHistory
|
|
27560
|
+
clear: (_j = labels == null ? void 0 : labels.searchBox) == null ? void 0 : _j.clearHistory
|
|
27552
27561
|
}
|
|
27553
27562
|
}
|
|
27554
27563
|
};
|
|
@@ -27562,7 +27571,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
27562
27571
|
callbacks,
|
|
27563
27572
|
additionalFields
|
|
27564
27573
|
}) => {
|
|
27565
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
27574
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
27566
27575
|
const filters = searchResultOptions.showFacets ? {
|
|
27567
27576
|
currentFilters: {
|
|
27568
27577
|
visibility: {
|
|
@@ -27571,15 +27580,15 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
27571
27580
|
},
|
|
27572
27581
|
labels: {
|
|
27573
27582
|
title: "",
|
|
27574
|
-
clearAll: (_a = labels.facets) == null ? void 0 : _a.clearAll
|
|
27583
|
+
clearAll: (_a = labels == null ? void 0 : labels.facets) == null ? void 0 : _a.clearAll
|
|
27575
27584
|
}
|
|
27576
27585
|
},
|
|
27577
27586
|
facets: {
|
|
27578
27587
|
labels: {
|
|
27579
|
-
title: labels.facets.facetTitle,
|
|
27580
|
-
showAll: labels.facets.showAll,
|
|
27581
|
-
facetFilter: labels.facets.facetFilter,
|
|
27582
|
-
facetClear: labels.facets.facetClear
|
|
27588
|
+
title: (_b = labels == null ? void 0 : labels.facets) == null ? void 0 : _b.facetTitle,
|
|
27589
|
+
showAll: (_c = labels == null ? void 0 : labels.facets) == null ? void 0 : _c.showAll,
|
|
27590
|
+
facetFilter: (_d = labels == null ? void 0 : labels.facets) == null ? void 0 : _d.facetFilter,
|
|
27591
|
+
facetClear: (_e = labels == null ? void 0 : labels.facets) == null ? void 0 : _e.facetClear
|
|
27583
27592
|
},
|
|
27584
27593
|
filterable: {
|
|
27585
27594
|
minValues: 5
|
|
@@ -27604,12 +27613,12 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
27604
27613
|
}
|
|
27605
27614
|
}
|
|
27606
27615
|
} : {};
|
|
27607
|
-
const columns = (
|
|
27608
|
-
xl: (
|
|
27609
|
-
l: (
|
|
27610
|
-
md: (
|
|
27611
|
-
sm: (
|
|
27612
|
-
xs: (
|
|
27616
|
+
const columns = (_k = searchResultOptions.gridConfiguration) != null ? _k : {
|
|
27617
|
+
xl: (_f = searchResultOptions.maxColumns) != null ? _f : 4,
|
|
27618
|
+
l: (_g = searchResultOptions.maxColumns) != null ? _g : 3,
|
|
27619
|
+
md: (_h = searchResultOptions.maxColumns) != null ? _h : 3,
|
|
27620
|
+
sm: (_i = searchResultOptions.maxColumns) != null ? _i : 2,
|
|
27621
|
+
xs: (_j = searchResultOptions.maxColumns) != null ? _j : 1
|
|
27613
27622
|
};
|
|
27614
27623
|
const badges = searchResultOptions.showRelevance ? {
|
|
27615
27624
|
badges: {
|
|
@@ -27627,7 +27636,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
27627
27636
|
} : {};
|
|
27628
27637
|
return __spreadValues(__spreadProps(__spreadValues({
|
|
27629
27638
|
options: {
|
|
27630
|
-
environment: (
|
|
27639
|
+
environment: (_l = searchResultOptions.environment) != null ? _l : "production",
|
|
27631
27640
|
customUrl: searchResultOptions.customUrl,
|
|
27632
27641
|
customBaseUrl: searchResultOptions.customBaseUrl,
|
|
27633
27642
|
customPayload: searchResultOptions.customPayload,
|
|
@@ -27637,8 +27646,8 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
27637
27646
|
queryKey: searchResultOptions.queryKey,
|
|
27638
27647
|
containerSelector: searchResultOptions.containerSelector,
|
|
27639
27648
|
searchTitlePosition: "search-results-top",
|
|
27640
|
-
titleKey: searchResultOptions.fields.titleKey,
|
|
27641
|
-
labels: labels.searchResults,
|
|
27649
|
+
titleKey: (_m = searchResultOptions.fields) == null ? void 0 : _m.titleKey,
|
|
27650
|
+
labels: labels == null ? void 0 : labels.searchResults,
|
|
27642
27651
|
grid: {
|
|
27643
27652
|
columns
|
|
27644
27653
|
},
|
|
@@ -27670,7 +27679,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
27670
27679
|
}
|
|
27671
27680
|
}, badges), {
|
|
27672
27681
|
links: {
|
|
27673
|
-
details: searchResultOptions.fields.productUrl ? `{${searchResultOptions.fields.productUrl}}` : void 0
|
|
27682
|
+
details: ((_n = searchResultOptions.fields) == null ? void 0 : _n.productUrl) ? `{${(_o = searchResultOptions.fields) == null ? void 0 : _o.productUrl}}` : void 0
|
|
27674
27683
|
},
|
|
27675
27684
|
callbacks,
|
|
27676
27685
|
routingBehavior: callbacks ? "event" : "direct-link",
|
|
@@ -27679,37 +27688,43 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
27679
27688
|
{
|
|
27680
27689
|
type: "image",
|
|
27681
27690
|
placeholder: placeholderImage,
|
|
27682
|
-
key: searchResultOptions.fields.imageKey,
|
|
27683
|
-
baseUrl: searchResultOptions.fields.baseImageUrl,
|
|
27684
|
-
display: () =>
|
|
27691
|
+
key: (_p = searchResultOptions.fields) == null ? void 0 : _p.imageKey,
|
|
27692
|
+
baseUrl: (_q = searchResultOptions.fields) == null ? void 0 : _q.baseImageUrl,
|
|
27693
|
+
display: () => {
|
|
27694
|
+
var _a2;
|
|
27695
|
+
return (_a2 = searchResultOptions.fields) == null ? void 0 : _a2.imageKey;
|
|
27696
|
+
}
|
|
27685
27697
|
},
|
|
27686
|
-
addFieldIfKeyExists("_emphasis", (
|
|
27698
|
+
addFieldIfKeyExists("_emphasis", (_r = searchResultOptions.fields) == null ? void 0 : _r.emphasizedField, {
|
|
27687
27699
|
type: "custom",
|
|
27688
27700
|
className: "lupa-custom-emphasis",
|
|
27689
|
-
key: searchResultOptions.fields.emphasizedField,
|
|
27701
|
+
key: (_s = searchResultOptions.fields) == null ? void 0 : _s.emphasizedField,
|
|
27690
27702
|
display: () => true
|
|
27691
27703
|
}),
|
|
27692
27704
|
{
|
|
27693
27705
|
type: "title",
|
|
27694
|
-
key: searchResultOptions.fields.titleKey,
|
|
27695
|
-
maxLines: (
|
|
27696
|
-
display: (doc2) =>
|
|
27706
|
+
key: (_t = searchResultOptions.fields) == null ? void 0 : _t.titleKey,
|
|
27707
|
+
maxLines: (_u = searchResultOptions.maxLines) != null ? _u : 2,
|
|
27708
|
+
display: (doc2) => {
|
|
27709
|
+
var _a2, _b2;
|
|
27710
|
+
return ((_a2 = searchResultOptions.fields) == null ? void 0 : _a2.titleKey) && Boolean(doc2[(_b2 = searchResultOptions.fields) == null ? void 0 : _b2.titleKey]);
|
|
27711
|
+
}
|
|
27697
27712
|
},
|
|
27698
27713
|
...getAdditionalElements(additionalFields),
|
|
27699
|
-
addFieldIfKeyExists("_discountPrice", searchResultOptions.fields.discountPriceKey, {
|
|
27700
|
-
key: searchResultOptions.fields.discountPriceKey,
|
|
27714
|
+
addFieldIfKeyExists("_discountPrice", (_v = searchResultOptions.fields) == null ? void 0 : _v.discountPriceKey, {
|
|
27715
|
+
key: (_w = searchResultOptions.fields) == null ? void 0 : _w.discountPriceKey,
|
|
27701
27716
|
type: "customHtml",
|
|
27702
27717
|
className: "lupa-price lupa-price-discounted",
|
|
27703
27718
|
display: (doc2) => displayDiscountedPriceSection(doc2, searchResultOptions),
|
|
27704
27719
|
html: (doc2) => {
|
|
27705
|
-
var _a2, _b2, _c2, _d2;
|
|
27706
|
-
const currency = escapeHtml(searchResultOptions.fields.currency || "€");
|
|
27707
|
-
const discountPrice = (
|
|
27708
|
-
doc2[(
|
|
27709
|
-
)) == null ? void 0 : _b2.toFixed(2);
|
|
27710
|
-
const regularPrice = (_d2 = parseFloat(
|
|
27711
|
-
doc2[(_c2 = searchResultOptions.fields.regularPriceKey) != null ? _c2 : ""]
|
|
27720
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
|
|
27721
|
+
const currency = escapeHtml(((_a2 = searchResultOptions.fields) == null ? void 0 : _a2.currency) || "€");
|
|
27722
|
+
const discountPrice = (_d2 = parseFloat(
|
|
27723
|
+
doc2[(_c2 = (_b2 = searchResultOptions.fields) == null ? void 0 : _b2.discountPriceKey) != null ? _c2 : ""]
|
|
27712
27724
|
)) == null ? void 0 : _d2.toFixed(2);
|
|
27725
|
+
const regularPrice = (_g2 = parseFloat(
|
|
27726
|
+
doc2[(_f2 = (_e2 = searchResultOptions.fields) == null ? void 0 : _e2.regularPriceKey) != null ? _f2 : ""]
|
|
27727
|
+
)) == null ? void 0 : _g2.toFixed(2);
|
|
27713
27728
|
const discount = `<span class="lupa-discount">${escapeHtml(
|
|
27714
27729
|
discountPrice
|
|
27715
27730
|
)} ${currency}</span>`;
|
|
@@ -27719,17 +27734,17 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
27719
27734
|
return discount + regular;
|
|
27720
27735
|
}
|
|
27721
27736
|
}),
|
|
27722
|
-
addFieldIfKeyExists("_regularPrice", searchResultOptions.fields.regularPriceKey, {
|
|
27723
|
-
key: searchResultOptions.fields.regularPriceKey,
|
|
27737
|
+
addFieldIfKeyExists("_regularPrice", (_x = searchResultOptions.fields) == null ? void 0 : _x.regularPriceKey, {
|
|
27738
|
+
key: (_y = searchResultOptions.fields) == null ? void 0 : _y.regularPriceKey,
|
|
27724
27739
|
type: "customHtml",
|
|
27725
27740
|
className: "lupa-price lupa-price-single",
|
|
27726
27741
|
display: (doc2) => displayRegularPriceSection(doc2, searchResultOptions),
|
|
27727
27742
|
html: (doc2) => {
|
|
27728
|
-
var _a2, _b2, _c2, _d2;
|
|
27729
|
-
const currency = escapeHtml(searchResultOptions.fields.currency || "€");
|
|
27730
|
-
const price = (
|
|
27731
|
-
(
|
|
27732
|
-
)) == null ? void 0 :
|
|
27743
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
|
|
27744
|
+
const currency = escapeHtml(((_a2 = searchResultOptions.fields) == null ? void 0 : _a2.currency) || "€");
|
|
27745
|
+
const price = (_g2 = parseFloat(
|
|
27746
|
+
(_f2 = doc2[(_c2 = (_b2 = searchResultOptions.fields) == null ? void 0 : _b2.regularPriceKey) != null ? _c2 : ""]) != null ? _f2 : doc2[(_e2 = (_d2 = searchResultOptions.fields) == null ? void 0 : _d2.discountPriceKey) != null ? _e2 : ""]
|
|
27747
|
+
)) == null ? void 0 : _g2.toFixed(2);
|
|
27733
27748
|
return `<span class="lupa-final">${escapeHtml(price)} ${currency}</span>`;
|
|
27734
27749
|
}
|
|
27735
27750
|
})
|
package/dist/lupaSearch.js
CHANGED
|
@@ -8356,6 +8356,13 @@ const useDynamicDataStore = defineStore("dynamicData", () => {
|
|
|
8356
8356
|
});
|
|
8357
8357
|
return { dynamicDataIdMap, loading, enhanceSearchResultsWithDynamicData };
|
|
8358
8358
|
});
|
|
8359
|
+
const joinUrlParts = (...parts) => {
|
|
8360
|
+
var _a, _b, _c;
|
|
8361
|
+
if (parts.length === 1) {
|
|
8362
|
+
return `${parts[0]}`;
|
|
8363
|
+
}
|
|
8364
|
+
return (_c = (_b = (_a = parts == null ? void 0 : parts.map((part) => part.replace(/(^\/+|\/+$)/g, ""))) == null ? void 0 : _a.filter((part) => part !== "")) == null ? void 0 : _b.join("/")) != null ? _c : "";
|
|
8365
|
+
};
|
|
8359
8366
|
const _hoisted_1$16 = ["src"];
|
|
8360
8367
|
const _sfc_main$1c = /* @__PURE__ */ defineComponent({
|
|
8361
8368
|
__name: "ProductImage",
|
|
@@ -8374,12 +8381,11 @@ const _sfc_main$1c = /* @__PURE__ */ defineComponent({
|
|
|
8374
8381
|
return typeof imageUrl2 === "string" && (imageUrl2.indexOf("http://") === 0 || imageUrl2.indexOf("https://") === 0);
|
|
8375
8382
|
});
|
|
8376
8383
|
const imageUrl = computed(() => {
|
|
8377
|
-
var _a;
|
|
8378
8384
|
const imageUrl2 = image.value;
|
|
8379
8385
|
if (hasFullImageUrl.value) {
|
|
8380
8386
|
return imageUrl2;
|
|
8381
8387
|
}
|
|
8382
|
-
return
|
|
8388
|
+
return rootImageUrl.value ? joinUrlParts(rootImageUrl.value, imageUrl2) : `/${imageUrl2}`;
|
|
8383
8389
|
});
|
|
8384
8390
|
const hasImage = computed(() => Boolean(hasFullImageUrl.value || image.value));
|
|
8385
8391
|
const placeholder = computed(() => props.options.placeholder);
|
|
@@ -27484,7 +27490,7 @@ const getSearchBoxComponent = ({
|
|
|
27484
27490
|
redirections,
|
|
27485
27491
|
placeholderImage
|
|
27486
27492
|
}) => {
|
|
27487
|
-
var _a, _b;
|
|
27493
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
27488
27494
|
const panels = [
|
|
27489
27495
|
...(panelOptions == null ? void 0 : panelOptions.suggestionPanel) ? [
|
|
27490
27496
|
{
|
|
@@ -27493,7 +27499,7 @@ const getSearchBoxComponent = ({
|
|
|
27493
27499
|
highlight: true,
|
|
27494
27500
|
limit: 8,
|
|
27495
27501
|
labels: {
|
|
27496
|
-
topResultsTitle: labels.searchBox.topSuggestionsTitle
|
|
27502
|
+
topResultsTitle: (_a = labels == null ? void 0 : labels.searchBox) == null ? void 0 : _a.topSuggestionsTitle
|
|
27497
27503
|
}
|
|
27498
27504
|
}
|
|
27499
27505
|
] : [],
|
|
@@ -27506,22 +27512,25 @@ const getSearchBoxComponent = ({
|
|
|
27506
27512
|
{
|
|
27507
27513
|
type: "image",
|
|
27508
27514
|
placeholder: placeholderImage,
|
|
27509
|
-
key: searchBoxOptions.fields.imageKey,
|
|
27510
|
-
baseUrl: searchBoxOptions.fields.baseImageUrl
|
|
27515
|
+
key: (_b = searchBoxOptions.fields) == null ? void 0 : _b.imageKey,
|
|
27516
|
+
baseUrl: (_c = searchBoxOptions.fields) == null ? void 0 : _c.baseImageUrl
|
|
27511
27517
|
},
|
|
27512
27518
|
{
|
|
27513
27519
|
type: "title",
|
|
27514
|
-
key: searchBoxOptions.fields.titleKey,
|
|
27520
|
+
key: (_d = searchBoxOptions.fields) == null ? void 0 : _d.titleKey,
|
|
27515
27521
|
maxLines: 2
|
|
27516
27522
|
},
|
|
27517
27523
|
{
|
|
27518
27524
|
type: "regularPrice",
|
|
27519
|
-
key: searchBoxOptions.fields.regularPriceKey,
|
|
27520
|
-
display: (doc2) =>
|
|
27525
|
+
key: (_e = searchBoxOptions.fields) == null ? void 0 : _e.regularPriceKey,
|
|
27526
|
+
display: (doc2) => {
|
|
27527
|
+
var _a2, _b2, _c2, _d2;
|
|
27528
|
+
return ((_a2 = searchBoxOptions.fields) == null ? void 0 : _a2.regularPriceKey) && ((_b2 = searchBoxOptions.fields) == null ? void 0 : _b2.discountPriceKey) && parseFloat(doc2[(_c2 = searchBoxOptions.fields) == null ? void 0 : _c2.regularPriceKey]) > parseFloat(doc2[(_d2 = searchBoxOptions.fields) == null ? void 0 : _d2.discountPriceKey]);
|
|
27529
|
+
}
|
|
27521
27530
|
},
|
|
27522
27531
|
{
|
|
27523
27532
|
type: "price",
|
|
27524
|
-
key: searchBoxOptions.fields.discountPriceKey
|
|
27533
|
+
key: (_f = searchBoxOptions.fields) == null ? void 0 : _f.discountPriceKey
|
|
27525
27534
|
}
|
|
27526
27535
|
]
|
|
27527
27536
|
}
|
|
@@ -27530,7 +27539,7 @@ const getSearchBoxComponent = ({
|
|
|
27530
27539
|
return {
|
|
27531
27540
|
inputSelector: searchBoxOptions.inputSelector,
|
|
27532
27541
|
options: {
|
|
27533
|
-
environment: (
|
|
27542
|
+
environment: (_g = searchBoxOptions.environment) != null ? _g : "production",
|
|
27534
27543
|
customUrl: searchBoxOptions.customUrl,
|
|
27535
27544
|
customBaseUrl: searchBoxOptions.customBaseUrl,
|
|
27536
27545
|
customPayload: searchBoxOptions.customPayload,
|
|
@@ -27538,9 +27547,9 @@ const getSearchBoxComponent = ({
|
|
|
27538
27547
|
},
|
|
27539
27548
|
showTotalCount: true,
|
|
27540
27549
|
expandOnSinglePanel: true,
|
|
27541
|
-
minInputLength: (
|
|
27550
|
+
minInputLength: (_i = (_h = searchBoxOptions.fields) == null ? void 0 : _h.minInputLength) != null ? _i : 0,
|
|
27542
27551
|
debounce: 250,
|
|
27543
|
-
labels: labels.searchBox,
|
|
27552
|
+
labels: labels == null ? void 0 : labels.searchBox,
|
|
27544
27553
|
links: {
|
|
27545
27554
|
searchResults: ""
|
|
27546
27555
|
},
|
|
@@ -27548,7 +27557,7 @@ const getSearchBoxComponent = ({
|
|
|
27548
27557
|
redirections,
|
|
27549
27558
|
history: {
|
|
27550
27559
|
labels: {
|
|
27551
|
-
clear: labels.searchBox.clearHistory
|
|
27560
|
+
clear: (_j = labels == null ? void 0 : labels.searchBox) == null ? void 0 : _j.clearHistory
|
|
27552
27561
|
}
|
|
27553
27562
|
}
|
|
27554
27563
|
};
|
|
@@ -27562,7 +27571,7 @@ const getSearchResultsComponent = ({
|
|
|
27562
27571
|
callbacks,
|
|
27563
27572
|
additionalFields
|
|
27564
27573
|
}) => {
|
|
27565
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
27574
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
27566
27575
|
const filters = searchResultOptions.showFacets ? {
|
|
27567
27576
|
currentFilters: {
|
|
27568
27577
|
visibility: {
|
|
@@ -27571,15 +27580,15 @@ const getSearchResultsComponent = ({
|
|
|
27571
27580
|
},
|
|
27572
27581
|
labels: {
|
|
27573
27582
|
title: "",
|
|
27574
|
-
clearAll: (_a = labels.facets) == null ? void 0 : _a.clearAll
|
|
27583
|
+
clearAll: (_a = labels == null ? void 0 : labels.facets) == null ? void 0 : _a.clearAll
|
|
27575
27584
|
}
|
|
27576
27585
|
},
|
|
27577
27586
|
facets: {
|
|
27578
27587
|
labels: {
|
|
27579
|
-
title: labels.facets.facetTitle,
|
|
27580
|
-
showAll: labels.facets.showAll,
|
|
27581
|
-
facetFilter: labels.facets.facetFilter,
|
|
27582
|
-
facetClear: labels.facets.facetClear
|
|
27588
|
+
title: (_b = labels == null ? void 0 : labels.facets) == null ? void 0 : _b.facetTitle,
|
|
27589
|
+
showAll: (_c = labels == null ? void 0 : labels.facets) == null ? void 0 : _c.showAll,
|
|
27590
|
+
facetFilter: (_d = labels == null ? void 0 : labels.facets) == null ? void 0 : _d.facetFilter,
|
|
27591
|
+
facetClear: (_e = labels == null ? void 0 : labels.facets) == null ? void 0 : _e.facetClear
|
|
27583
27592
|
},
|
|
27584
27593
|
filterable: {
|
|
27585
27594
|
minValues: 5
|
|
@@ -27604,12 +27613,12 @@ const getSearchResultsComponent = ({
|
|
|
27604
27613
|
}
|
|
27605
27614
|
}
|
|
27606
27615
|
} : {};
|
|
27607
|
-
const columns = (
|
|
27608
|
-
xl: (
|
|
27609
|
-
l: (
|
|
27610
|
-
md: (
|
|
27611
|
-
sm: (
|
|
27612
|
-
xs: (
|
|
27616
|
+
const columns = (_k = searchResultOptions.gridConfiguration) != null ? _k : {
|
|
27617
|
+
xl: (_f = searchResultOptions.maxColumns) != null ? _f : 4,
|
|
27618
|
+
l: (_g = searchResultOptions.maxColumns) != null ? _g : 3,
|
|
27619
|
+
md: (_h = searchResultOptions.maxColumns) != null ? _h : 3,
|
|
27620
|
+
sm: (_i = searchResultOptions.maxColumns) != null ? _i : 2,
|
|
27621
|
+
xs: (_j = searchResultOptions.maxColumns) != null ? _j : 1
|
|
27613
27622
|
};
|
|
27614
27623
|
const badges = searchResultOptions.showRelevance ? {
|
|
27615
27624
|
badges: {
|
|
@@ -27627,7 +27636,7 @@ const getSearchResultsComponent = ({
|
|
|
27627
27636
|
} : {};
|
|
27628
27637
|
return __spreadValues(__spreadProps(__spreadValues({
|
|
27629
27638
|
options: {
|
|
27630
|
-
environment: (
|
|
27639
|
+
environment: (_l = searchResultOptions.environment) != null ? _l : "production",
|
|
27631
27640
|
customUrl: searchResultOptions.customUrl,
|
|
27632
27641
|
customBaseUrl: searchResultOptions.customBaseUrl,
|
|
27633
27642
|
customPayload: searchResultOptions.customPayload,
|
|
@@ -27637,8 +27646,8 @@ const getSearchResultsComponent = ({
|
|
|
27637
27646
|
queryKey: searchResultOptions.queryKey,
|
|
27638
27647
|
containerSelector: searchResultOptions.containerSelector,
|
|
27639
27648
|
searchTitlePosition: "search-results-top",
|
|
27640
|
-
titleKey: searchResultOptions.fields.titleKey,
|
|
27641
|
-
labels: labels.searchResults,
|
|
27649
|
+
titleKey: (_m = searchResultOptions.fields) == null ? void 0 : _m.titleKey,
|
|
27650
|
+
labels: labels == null ? void 0 : labels.searchResults,
|
|
27642
27651
|
grid: {
|
|
27643
27652
|
columns
|
|
27644
27653
|
},
|
|
@@ -27670,7 +27679,7 @@ const getSearchResultsComponent = ({
|
|
|
27670
27679
|
}
|
|
27671
27680
|
}, badges), {
|
|
27672
27681
|
links: {
|
|
27673
|
-
details: searchResultOptions.fields.productUrl ? `{${searchResultOptions.fields.productUrl}}` : void 0
|
|
27682
|
+
details: ((_n = searchResultOptions.fields) == null ? void 0 : _n.productUrl) ? `{${(_o = searchResultOptions.fields) == null ? void 0 : _o.productUrl}}` : void 0
|
|
27674
27683
|
},
|
|
27675
27684
|
callbacks,
|
|
27676
27685
|
routingBehavior: callbacks ? "event" : "direct-link",
|
|
@@ -27679,37 +27688,43 @@ const getSearchResultsComponent = ({
|
|
|
27679
27688
|
{
|
|
27680
27689
|
type: "image",
|
|
27681
27690
|
placeholder: placeholderImage,
|
|
27682
|
-
key: searchResultOptions.fields.imageKey,
|
|
27683
|
-
baseUrl: searchResultOptions.fields.baseImageUrl,
|
|
27684
|
-
display: () =>
|
|
27691
|
+
key: (_p = searchResultOptions.fields) == null ? void 0 : _p.imageKey,
|
|
27692
|
+
baseUrl: (_q = searchResultOptions.fields) == null ? void 0 : _q.baseImageUrl,
|
|
27693
|
+
display: () => {
|
|
27694
|
+
var _a2;
|
|
27695
|
+
return (_a2 = searchResultOptions.fields) == null ? void 0 : _a2.imageKey;
|
|
27696
|
+
}
|
|
27685
27697
|
},
|
|
27686
|
-
addFieldIfKeyExists("_emphasis", (
|
|
27698
|
+
addFieldIfKeyExists("_emphasis", (_r = searchResultOptions.fields) == null ? void 0 : _r.emphasizedField, {
|
|
27687
27699
|
type: "custom",
|
|
27688
27700
|
className: "lupa-custom-emphasis",
|
|
27689
|
-
key: searchResultOptions.fields.emphasizedField,
|
|
27701
|
+
key: (_s = searchResultOptions.fields) == null ? void 0 : _s.emphasizedField,
|
|
27690
27702
|
display: () => true
|
|
27691
27703
|
}),
|
|
27692
27704
|
{
|
|
27693
27705
|
type: "title",
|
|
27694
|
-
key: searchResultOptions.fields.titleKey,
|
|
27695
|
-
maxLines: (
|
|
27696
|
-
display: (doc2) =>
|
|
27706
|
+
key: (_t = searchResultOptions.fields) == null ? void 0 : _t.titleKey,
|
|
27707
|
+
maxLines: (_u = searchResultOptions.maxLines) != null ? _u : 2,
|
|
27708
|
+
display: (doc2) => {
|
|
27709
|
+
var _a2, _b2;
|
|
27710
|
+
return ((_a2 = searchResultOptions.fields) == null ? void 0 : _a2.titleKey) && Boolean(doc2[(_b2 = searchResultOptions.fields) == null ? void 0 : _b2.titleKey]);
|
|
27711
|
+
}
|
|
27697
27712
|
},
|
|
27698
27713
|
...getAdditionalElements(additionalFields),
|
|
27699
|
-
addFieldIfKeyExists("_discountPrice", searchResultOptions.fields.discountPriceKey, {
|
|
27700
|
-
key: searchResultOptions.fields.discountPriceKey,
|
|
27714
|
+
addFieldIfKeyExists("_discountPrice", (_v = searchResultOptions.fields) == null ? void 0 : _v.discountPriceKey, {
|
|
27715
|
+
key: (_w = searchResultOptions.fields) == null ? void 0 : _w.discountPriceKey,
|
|
27701
27716
|
type: "customHtml",
|
|
27702
27717
|
className: "lupa-price lupa-price-discounted",
|
|
27703
27718
|
display: (doc2) => displayDiscountedPriceSection(doc2, searchResultOptions),
|
|
27704
27719
|
html: (doc2) => {
|
|
27705
|
-
var _a2, _b2, _c2, _d2;
|
|
27706
|
-
const currency = escapeHtml(searchResultOptions.fields.currency || "€");
|
|
27707
|
-
const discountPrice = (
|
|
27708
|
-
doc2[(
|
|
27709
|
-
)) == null ? void 0 : _b2.toFixed(2);
|
|
27710
|
-
const regularPrice = (_d2 = parseFloat(
|
|
27711
|
-
doc2[(_c2 = searchResultOptions.fields.regularPriceKey) != null ? _c2 : ""]
|
|
27720
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
|
|
27721
|
+
const currency = escapeHtml(((_a2 = searchResultOptions.fields) == null ? void 0 : _a2.currency) || "€");
|
|
27722
|
+
const discountPrice = (_d2 = parseFloat(
|
|
27723
|
+
doc2[(_c2 = (_b2 = searchResultOptions.fields) == null ? void 0 : _b2.discountPriceKey) != null ? _c2 : ""]
|
|
27712
27724
|
)) == null ? void 0 : _d2.toFixed(2);
|
|
27725
|
+
const regularPrice = (_g2 = parseFloat(
|
|
27726
|
+
doc2[(_f2 = (_e2 = searchResultOptions.fields) == null ? void 0 : _e2.regularPriceKey) != null ? _f2 : ""]
|
|
27727
|
+
)) == null ? void 0 : _g2.toFixed(2);
|
|
27713
27728
|
const discount = `<span class="lupa-discount">${escapeHtml(
|
|
27714
27729
|
discountPrice
|
|
27715
27730
|
)} ${currency}</span>`;
|
|
@@ -27719,17 +27734,17 @@ const getSearchResultsComponent = ({
|
|
|
27719
27734
|
return discount + regular;
|
|
27720
27735
|
}
|
|
27721
27736
|
}),
|
|
27722
|
-
addFieldIfKeyExists("_regularPrice", searchResultOptions.fields.regularPriceKey, {
|
|
27723
|
-
key: searchResultOptions.fields.regularPriceKey,
|
|
27737
|
+
addFieldIfKeyExists("_regularPrice", (_x = searchResultOptions.fields) == null ? void 0 : _x.regularPriceKey, {
|
|
27738
|
+
key: (_y = searchResultOptions.fields) == null ? void 0 : _y.regularPriceKey,
|
|
27724
27739
|
type: "customHtml",
|
|
27725
27740
|
className: "lupa-price lupa-price-single",
|
|
27726
27741
|
display: (doc2) => displayRegularPriceSection(doc2, searchResultOptions),
|
|
27727
27742
|
html: (doc2) => {
|
|
27728
|
-
var _a2, _b2, _c2, _d2;
|
|
27729
|
-
const currency = escapeHtml(searchResultOptions.fields.currency || "€");
|
|
27730
|
-
const price = (
|
|
27731
|
-
(
|
|
27732
|
-
)) == null ? void 0 :
|
|
27743
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
|
|
27744
|
+
const currency = escapeHtml(((_a2 = searchResultOptions.fields) == null ? void 0 : _a2.currency) || "€");
|
|
27745
|
+
const price = (_g2 = parseFloat(
|
|
27746
|
+
(_f2 = doc2[(_c2 = (_b2 = searchResultOptions.fields) == null ? void 0 : _b2.regularPriceKey) != null ? _c2 : ""]) != null ? _f2 : doc2[(_e2 = (_d2 = searchResultOptions.fields) == null ? void 0 : _d2.discountPriceKey) != null ? _e2 : ""]
|
|
27747
|
+
)) == null ? void 0 : _g2.toFixed(2);
|
|
27733
27748
|
return `<span class="lupa-final">${escapeHtml(price)} ${currency}</span>`;
|
|
27734
27749
|
}
|
|
27735
27750
|
})
|
package/dist/lupaSearch.mjs
CHANGED
|
@@ -8354,6 +8354,13 @@ const useDynamicDataStore = defineStore("dynamicData", () => {
|
|
|
8354
8354
|
});
|
|
8355
8355
|
return { dynamicDataIdMap, loading, enhanceSearchResultsWithDynamicData };
|
|
8356
8356
|
});
|
|
8357
|
+
const joinUrlParts = (...parts) => {
|
|
8358
|
+
var _a, _b, _c;
|
|
8359
|
+
if (parts.length === 1) {
|
|
8360
|
+
return `${parts[0]}`;
|
|
8361
|
+
}
|
|
8362
|
+
return (_c = (_b = (_a = parts == null ? void 0 : parts.map((part) => part.replace(/(^\/+|\/+$)/g, ""))) == null ? void 0 : _a.filter((part) => part !== "")) == null ? void 0 : _b.join("/")) != null ? _c : "";
|
|
8363
|
+
};
|
|
8357
8364
|
const _hoisted_1$16 = ["src"];
|
|
8358
8365
|
const _sfc_main$1c = /* @__PURE__ */ defineComponent({
|
|
8359
8366
|
__name: "ProductImage",
|
|
@@ -8372,12 +8379,11 @@ const _sfc_main$1c = /* @__PURE__ */ defineComponent({
|
|
|
8372
8379
|
return typeof imageUrl2 === "string" && (imageUrl2.indexOf("http://") === 0 || imageUrl2.indexOf("https://") === 0);
|
|
8373
8380
|
});
|
|
8374
8381
|
const imageUrl = computed(() => {
|
|
8375
|
-
var _a;
|
|
8376
8382
|
const imageUrl2 = image.value;
|
|
8377
8383
|
if (hasFullImageUrl.value) {
|
|
8378
8384
|
return imageUrl2;
|
|
8379
8385
|
}
|
|
8380
|
-
return
|
|
8386
|
+
return rootImageUrl.value ? joinUrlParts(rootImageUrl.value, imageUrl2) : `/${imageUrl2}`;
|
|
8381
8387
|
});
|
|
8382
8388
|
const hasImage = computed(() => Boolean(hasFullImageUrl.value || image.value));
|
|
8383
8389
|
const placeholder = computed(() => props.options.placeholder);
|
|
@@ -27482,7 +27488,7 @@ const getSearchBoxComponent = ({
|
|
|
27482
27488
|
redirections,
|
|
27483
27489
|
placeholderImage
|
|
27484
27490
|
}) => {
|
|
27485
|
-
var _a, _b;
|
|
27491
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
27486
27492
|
const panels = [
|
|
27487
27493
|
...(panelOptions == null ? void 0 : panelOptions.suggestionPanel) ? [
|
|
27488
27494
|
{
|
|
@@ -27491,7 +27497,7 @@ const getSearchBoxComponent = ({
|
|
|
27491
27497
|
highlight: true,
|
|
27492
27498
|
limit: 8,
|
|
27493
27499
|
labels: {
|
|
27494
|
-
topResultsTitle: labels.searchBox.topSuggestionsTitle
|
|
27500
|
+
topResultsTitle: (_a = labels == null ? void 0 : labels.searchBox) == null ? void 0 : _a.topSuggestionsTitle
|
|
27495
27501
|
}
|
|
27496
27502
|
}
|
|
27497
27503
|
] : [],
|
|
@@ -27504,22 +27510,25 @@ const getSearchBoxComponent = ({
|
|
|
27504
27510
|
{
|
|
27505
27511
|
type: "image",
|
|
27506
27512
|
placeholder: placeholderImage,
|
|
27507
|
-
key: searchBoxOptions.fields.imageKey,
|
|
27508
|
-
baseUrl: searchBoxOptions.fields.baseImageUrl
|
|
27513
|
+
key: (_b = searchBoxOptions.fields) == null ? void 0 : _b.imageKey,
|
|
27514
|
+
baseUrl: (_c = searchBoxOptions.fields) == null ? void 0 : _c.baseImageUrl
|
|
27509
27515
|
},
|
|
27510
27516
|
{
|
|
27511
27517
|
type: "title",
|
|
27512
|
-
key: searchBoxOptions.fields.titleKey,
|
|
27518
|
+
key: (_d = searchBoxOptions.fields) == null ? void 0 : _d.titleKey,
|
|
27513
27519
|
maxLines: 2
|
|
27514
27520
|
},
|
|
27515
27521
|
{
|
|
27516
27522
|
type: "regularPrice",
|
|
27517
|
-
key: searchBoxOptions.fields.regularPriceKey,
|
|
27518
|
-
display: (doc2) =>
|
|
27523
|
+
key: (_e = searchBoxOptions.fields) == null ? void 0 : _e.regularPriceKey,
|
|
27524
|
+
display: (doc2) => {
|
|
27525
|
+
var _a2, _b2, _c2, _d2;
|
|
27526
|
+
return ((_a2 = searchBoxOptions.fields) == null ? void 0 : _a2.regularPriceKey) && ((_b2 = searchBoxOptions.fields) == null ? void 0 : _b2.discountPriceKey) && parseFloat(doc2[(_c2 = searchBoxOptions.fields) == null ? void 0 : _c2.regularPriceKey]) > parseFloat(doc2[(_d2 = searchBoxOptions.fields) == null ? void 0 : _d2.discountPriceKey]);
|
|
27527
|
+
}
|
|
27519
27528
|
},
|
|
27520
27529
|
{
|
|
27521
27530
|
type: "price",
|
|
27522
|
-
key: searchBoxOptions.fields.discountPriceKey
|
|
27531
|
+
key: (_f = searchBoxOptions.fields) == null ? void 0 : _f.discountPriceKey
|
|
27523
27532
|
}
|
|
27524
27533
|
]
|
|
27525
27534
|
}
|
|
@@ -27528,7 +27537,7 @@ const getSearchBoxComponent = ({
|
|
|
27528
27537
|
return {
|
|
27529
27538
|
inputSelector: searchBoxOptions.inputSelector,
|
|
27530
27539
|
options: {
|
|
27531
|
-
environment: (
|
|
27540
|
+
environment: (_g = searchBoxOptions.environment) != null ? _g : "production",
|
|
27532
27541
|
customUrl: searchBoxOptions.customUrl,
|
|
27533
27542
|
customBaseUrl: searchBoxOptions.customBaseUrl,
|
|
27534
27543
|
customPayload: searchBoxOptions.customPayload,
|
|
@@ -27536,9 +27545,9 @@ const getSearchBoxComponent = ({
|
|
|
27536
27545
|
},
|
|
27537
27546
|
showTotalCount: true,
|
|
27538
27547
|
expandOnSinglePanel: true,
|
|
27539
|
-
minInputLength: (
|
|
27548
|
+
minInputLength: (_i = (_h = searchBoxOptions.fields) == null ? void 0 : _h.minInputLength) != null ? _i : 0,
|
|
27540
27549
|
debounce: 250,
|
|
27541
|
-
labels: labels.searchBox,
|
|
27550
|
+
labels: labels == null ? void 0 : labels.searchBox,
|
|
27542
27551
|
links: {
|
|
27543
27552
|
searchResults: ""
|
|
27544
27553
|
},
|
|
@@ -27546,7 +27555,7 @@ const getSearchBoxComponent = ({
|
|
|
27546
27555
|
redirections,
|
|
27547
27556
|
history: {
|
|
27548
27557
|
labels: {
|
|
27549
|
-
clear: labels.searchBox.clearHistory
|
|
27558
|
+
clear: (_j = labels == null ? void 0 : labels.searchBox) == null ? void 0 : _j.clearHistory
|
|
27550
27559
|
}
|
|
27551
27560
|
}
|
|
27552
27561
|
};
|
|
@@ -27560,7 +27569,7 @@ const getSearchResultsComponent = ({
|
|
|
27560
27569
|
callbacks,
|
|
27561
27570
|
additionalFields
|
|
27562
27571
|
}) => {
|
|
27563
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
27572
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
27564
27573
|
const filters = searchResultOptions.showFacets ? {
|
|
27565
27574
|
currentFilters: {
|
|
27566
27575
|
visibility: {
|
|
@@ -27569,15 +27578,15 @@ const getSearchResultsComponent = ({
|
|
|
27569
27578
|
},
|
|
27570
27579
|
labels: {
|
|
27571
27580
|
title: "",
|
|
27572
|
-
clearAll: (_a = labels.facets) == null ? void 0 : _a.clearAll
|
|
27581
|
+
clearAll: (_a = labels == null ? void 0 : labels.facets) == null ? void 0 : _a.clearAll
|
|
27573
27582
|
}
|
|
27574
27583
|
},
|
|
27575
27584
|
facets: {
|
|
27576
27585
|
labels: {
|
|
27577
|
-
title: labels.facets.facetTitle,
|
|
27578
|
-
showAll: labels.facets.showAll,
|
|
27579
|
-
facetFilter: labels.facets.facetFilter,
|
|
27580
|
-
facetClear: labels.facets.facetClear
|
|
27586
|
+
title: (_b = labels == null ? void 0 : labels.facets) == null ? void 0 : _b.facetTitle,
|
|
27587
|
+
showAll: (_c = labels == null ? void 0 : labels.facets) == null ? void 0 : _c.showAll,
|
|
27588
|
+
facetFilter: (_d = labels == null ? void 0 : labels.facets) == null ? void 0 : _d.facetFilter,
|
|
27589
|
+
facetClear: (_e = labels == null ? void 0 : labels.facets) == null ? void 0 : _e.facetClear
|
|
27581
27590
|
},
|
|
27582
27591
|
filterable: {
|
|
27583
27592
|
minValues: 5
|
|
@@ -27602,12 +27611,12 @@ const getSearchResultsComponent = ({
|
|
|
27602
27611
|
}
|
|
27603
27612
|
}
|
|
27604
27613
|
} : {};
|
|
27605
|
-
const columns = (
|
|
27606
|
-
xl: (
|
|
27607
|
-
l: (
|
|
27608
|
-
md: (
|
|
27609
|
-
sm: (
|
|
27610
|
-
xs: (
|
|
27614
|
+
const columns = (_k = searchResultOptions.gridConfiguration) != null ? _k : {
|
|
27615
|
+
xl: (_f = searchResultOptions.maxColumns) != null ? _f : 4,
|
|
27616
|
+
l: (_g = searchResultOptions.maxColumns) != null ? _g : 3,
|
|
27617
|
+
md: (_h = searchResultOptions.maxColumns) != null ? _h : 3,
|
|
27618
|
+
sm: (_i = searchResultOptions.maxColumns) != null ? _i : 2,
|
|
27619
|
+
xs: (_j = searchResultOptions.maxColumns) != null ? _j : 1
|
|
27611
27620
|
};
|
|
27612
27621
|
const badges = searchResultOptions.showRelevance ? {
|
|
27613
27622
|
badges: {
|
|
@@ -27625,7 +27634,7 @@ const getSearchResultsComponent = ({
|
|
|
27625
27634
|
} : {};
|
|
27626
27635
|
return __spreadValues(__spreadProps(__spreadValues({
|
|
27627
27636
|
options: {
|
|
27628
|
-
environment: (
|
|
27637
|
+
environment: (_l = searchResultOptions.environment) != null ? _l : "production",
|
|
27629
27638
|
customUrl: searchResultOptions.customUrl,
|
|
27630
27639
|
customBaseUrl: searchResultOptions.customBaseUrl,
|
|
27631
27640
|
customPayload: searchResultOptions.customPayload,
|
|
@@ -27635,8 +27644,8 @@ const getSearchResultsComponent = ({
|
|
|
27635
27644
|
queryKey: searchResultOptions.queryKey,
|
|
27636
27645
|
containerSelector: searchResultOptions.containerSelector,
|
|
27637
27646
|
searchTitlePosition: "search-results-top",
|
|
27638
|
-
titleKey: searchResultOptions.fields.titleKey,
|
|
27639
|
-
labels: labels.searchResults,
|
|
27647
|
+
titleKey: (_m = searchResultOptions.fields) == null ? void 0 : _m.titleKey,
|
|
27648
|
+
labels: labels == null ? void 0 : labels.searchResults,
|
|
27640
27649
|
grid: {
|
|
27641
27650
|
columns
|
|
27642
27651
|
},
|
|
@@ -27668,7 +27677,7 @@ const getSearchResultsComponent = ({
|
|
|
27668
27677
|
}
|
|
27669
27678
|
}, badges), {
|
|
27670
27679
|
links: {
|
|
27671
|
-
details: searchResultOptions.fields.productUrl ? `{${searchResultOptions.fields.productUrl}}` : void 0
|
|
27680
|
+
details: ((_n = searchResultOptions.fields) == null ? void 0 : _n.productUrl) ? `{${(_o = searchResultOptions.fields) == null ? void 0 : _o.productUrl}}` : void 0
|
|
27672
27681
|
},
|
|
27673
27682
|
callbacks,
|
|
27674
27683
|
routingBehavior: callbacks ? "event" : "direct-link",
|
|
@@ -27677,37 +27686,43 @@ const getSearchResultsComponent = ({
|
|
|
27677
27686
|
{
|
|
27678
27687
|
type: "image",
|
|
27679
27688
|
placeholder: placeholderImage,
|
|
27680
|
-
key: searchResultOptions.fields.imageKey,
|
|
27681
|
-
baseUrl: searchResultOptions.fields.baseImageUrl,
|
|
27682
|
-
display: () =>
|
|
27689
|
+
key: (_p = searchResultOptions.fields) == null ? void 0 : _p.imageKey,
|
|
27690
|
+
baseUrl: (_q = searchResultOptions.fields) == null ? void 0 : _q.baseImageUrl,
|
|
27691
|
+
display: () => {
|
|
27692
|
+
var _a2;
|
|
27693
|
+
return (_a2 = searchResultOptions.fields) == null ? void 0 : _a2.imageKey;
|
|
27694
|
+
}
|
|
27683
27695
|
},
|
|
27684
|
-
addFieldIfKeyExists("_emphasis", (
|
|
27696
|
+
addFieldIfKeyExists("_emphasis", (_r = searchResultOptions.fields) == null ? void 0 : _r.emphasizedField, {
|
|
27685
27697
|
type: "custom",
|
|
27686
27698
|
className: "lupa-custom-emphasis",
|
|
27687
|
-
key: searchResultOptions.fields.emphasizedField,
|
|
27699
|
+
key: (_s = searchResultOptions.fields) == null ? void 0 : _s.emphasizedField,
|
|
27688
27700
|
display: () => true
|
|
27689
27701
|
}),
|
|
27690
27702
|
{
|
|
27691
27703
|
type: "title",
|
|
27692
|
-
key: searchResultOptions.fields.titleKey,
|
|
27693
|
-
maxLines: (
|
|
27694
|
-
display: (doc2) =>
|
|
27704
|
+
key: (_t = searchResultOptions.fields) == null ? void 0 : _t.titleKey,
|
|
27705
|
+
maxLines: (_u = searchResultOptions.maxLines) != null ? _u : 2,
|
|
27706
|
+
display: (doc2) => {
|
|
27707
|
+
var _a2, _b2;
|
|
27708
|
+
return ((_a2 = searchResultOptions.fields) == null ? void 0 : _a2.titleKey) && Boolean(doc2[(_b2 = searchResultOptions.fields) == null ? void 0 : _b2.titleKey]);
|
|
27709
|
+
}
|
|
27695
27710
|
},
|
|
27696
27711
|
...getAdditionalElements(additionalFields),
|
|
27697
|
-
addFieldIfKeyExists("_discountPrice", searchResultOptions.fields.discountPriceKey, {
|
|
27698
|
-
key: searchResultOptions.fields.discountPriceKey,
|
|
27712
|
+
addFieldIfKeyExists("_discountPrice", (_v = searchResultOptions.fields) == null ? void 0 : _v.discountPriceKey, {
|
|
27713
|
+
key: (_w = searchResultOptions.fields) == null ? void 0 : _w.discountPriceKey,
|
|
27699
27714
|
type: "customHtml",
|
|
27700
27715
|
className: "lupa-price lupa-price-discounted",
|
|
27701
27716
|
display: (doc2) => displayDiscountedPriceSection(doc2, searchResultOptions),
|
|
27702
27717
|
html: (doc2) => {
|
|
27703
|
-
var _a2, _b2, _c2, _d2;
|
|
27704
|
-
const currency = escapeHtml(searchResultOptions.fields.currency || "€");
|
|
27705
|
-
const discountPrice = (
|
|
27706
|
-
doc2[(
|
|
27707
|
-
)) == null ? void 0 : _b2.toFixed(2);
|
|
27708
|
-
const regularPrice = (_d2 = parseFloat(
|
|
27709
|
-
doc2[(_c2 = searchResultOptions.fields.regularPriceKey) != null ? _c2 : ""]
|
|
27718
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
|
|
27719
|
+
const currency = escapeHtml(((_a2 = searchResultOptions.fields) == null ? void 0 : _a2.currency) || "€");
|
|
27720
|
+
const discountPrice = (_d2 = parseFloat(
|
|
27721
|
+
doc2[(_c2 = (_b2 = searchResultOptions.fields) == null ? void 0 : _b2.discountPriceKey) != null ? _c2 : ""]
|
|
27710
27722
|
)) == null ? void 0 : _d2.toFixed(2);
|
|
27723
|
+
const regularPrice = (_g2 = parseFloat(
|
|
27724
|
+
doc2[(_f2 = (_e2 = searchResultOptions.fields) == null ? void 0 : _e2.regularPriceKey) != null ? _f2 : ""]
|
|
27725
|
+
)) == null ? void 0 : _g2.toFixed(2);
|
|
27711
27726
|
const discount = `<span class="lupa-discount">${escapeHtml(
|
|
27712
27727
|
discountPrice
|
|
27713
27728
|
)} ${currency}</span>`;
|
|
@@ -27717,17 +27732,17 @@ const getSearchResultsComponent = ({
|
|
|
27717
27732
|
return discount + regular;
|
|
27718
27733
|
}
|
|
27719
27734
|
}),
|
|
27720
|
-
addFieldIfKeyExists("_regularPrice", searchResultOptions.fields.regularPriceKey, {
|
|
27721
|
-
key: searchResultOptions.fields.regularPriceKey,
|
|
27735
|
+
addFieldIfKeyExists("_regularPrice", (_x = searchResultOptions.fields) == null ? void 0 : _x.regularPriceKey, {
|
|
27736
|
+
key: (_y = searchResultOptions.fields) == null ? void 0 : _y.regularPriceKey,
|
|
27722
27737
|
type: "customHtml",
|
|
27723
27738
|
className: "lupa-price lupa-price-single",
|
|
27724
27739
|
display: (doc2) => displayRegularPriceSection(doc2, searchResultOptions),
|
|
27725
27740
|
html: (doc2) => {
|
|
27726
|
-
var _a2, _b2, _c2, _d2;
|
|
27727
|
-
const currency = escapeHtml(searchResultOptions.fields.currency || "€");
|
|
27728
|
-
const price = (
|
|
27729
|
-
(
|
|
27730
|
-
)) == null ? void 0 :
|
|
27741
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
|
|
27742
|
+
const currency = escapeHtml(((_a2 = searchResultOptions.fields) == null ? void 0 : _a2.currency) || "€");
|
|
27743
|
+
const price = (_g2 = parseFloat(
|
|
27744
|
+
(_f2 = doc2[(_c2 = (_b2 = searchResultOptions.fields) == null ? void 0 : _b2.regularPriceKey) != null ? _c2 : ""]) != null ? _f2 : doc2[(_e2 = (_d2 = searchResultOptions.fields) == null ? void 0 : _d2.discountPriceKey) != null ? _e2 : ""]
|
|
27745
|
+
)) == null ? void 0 : _g2.toFixed(2);
|
|
27731
27746
|
return `<span class="lupa-final">${escapeHtml(price)} ${currency}</span>`;
|
|
27732
27747
|
}
|
|
27733
27748
|
})
|
package/dist/lupaSearch.umd.js
CHANGED
|
@@ -8358,6 +8358,13 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8358
8358
|
});
|
|
8359
8359
|
return { dynamicDataIdMap, loading, enhanceSearchResultsWithDynamicData };
|
|
8360
8360
|
});
|
|
8361
|
+
const joinUrlParts = (...parts) => {
|
|
8362
|
+
var _a, _b, _c;
|
|
8363
|
+
if (parts.length === 1) {
|
|
8364
|
+
return `${parts[0]}`;
|
|
8365
|
+
}
|
|
8366
|
+
return (_c = (_b = (_a = parts == null ? void 0 : parts.map((part) => part.replace(/(^\/+|\/+$)/g, ""))) == null ? void 0 : _a.filter((part) => part !== "")) == null ? void 0 : _b.join("/")) != null ? _c : "";
|
|
8367
|
+
};
|
|
8361
8368
|
const _hoisted_1$16 = ["src"];
|
|
8362
8369
|
const _sfc_main$1c = /* @__PURE__ */ defineComponent({
|
|
8363
8370
|
__name: "ProductImage",
|
|
@@ -8376,12 +8383,11 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8376
8383
|
return typeof imageUrl2 === "string" && (imageUrl2.indexOf("http://") === 0 || imageUrl2.indexOf("https://") === 0);
|
|
8377
8384
|
});
|
|
8378
8385
|
const imageUrl = computed(() => {
|
|
8379
|
-
var _a;
|
|
8380
8386
|
const imageUrl2 = image.value;
|
|
8381
8387
|
if (hasFullImageUrl.value) {
|
|
8382
8388
|
return imageUrl2;
|
|
8383
8389
|
}
|
|
8384
|
-
return
|
|
8390
|
+
return rootImageUrl.value ? joinUrlParts(rootImageUrl.value, imageUrl2) : `/${imageUrl2}`;
|
|
8385
8391
|
});
|
|
8386
8392
|
const hasImage = computed(() => Boolean(hasFullImageUrl.value || image.value));
|
|
8387
8393
|
const placeholder = computed(() => props.options.placeholder);
|
|
@@ -27486,7 +27492,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
27486
27492
|
redirections,
|
|
27487
27493
|
placeholderImage
|
|
27488
27494
|
}) => {
|
|
27489
|
-
var _a, _b;
|
|
27495
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
27490
27496
|
const panels = [
|
|
27491
27497
|
...(panelOptions == null ? void 0 : panelOptions.suggestionPanel) ? [
|
|
27492
27498
|
{
|
|
@@ -27495,7 +27501,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
27495
27501
|
highlight: true,
|
|
27496
27502
|
limit: 8,
|
|
27497
27503
|
labels: {
|
|
27498
|
-
topResultsTitle: labels.searchBox.topSuggestionsTitle
|
|
27504
|
+
topResultsTitle: (_a = labels == null ? void 0 : labels.searchBox) == null ? void 0 : _a.topSuggestionsTitle
|
|
27499
27505
|
}
|
|
27500
27506
|
}
|
|
27501
27507
|
] : [],
|
|
@@ -27508,22 +27514,25 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
27508
27514
|
{
|
|
27509
27515
|
type: "image",
|
|
27510
27516
|
placeholder: placeholderImage,
|
|
27511
|
-
key: searchBoxOptions.fields.imageKey,
|
|
27512
|
-
baseUrl: searchBoxOptions.fields.baseImageUrl
|
|
27517
|
+
key: (_b = searchBoxOptions.fields) == null ? void 0 : _b.imageKey,
|
|
27518
|
+
baseUrl: (_c = searchBoxOptions.fields) == null ? void 0 : _c.baseImageUrl
|
|
27513
27519
|
},
|
|
27514
27520
|
{
|
|
27515
27521
|
type: "title",
|
|
27516
|
-
key: searchBoxOptions.fields.titleKey,
|
|
27522
|
+
key: (_d = searchBoxOptions.fields) == null ? void 0 : _d.titleKey,
|
|
27517
27523
|
maxLines: 2
|
|
27518
27524
|
},
|
|
27519
27525
|
{
|
|
27520
27526
|
type: "regularPrice",
|
|
27521
|
-
key: searchBoxOptions.fields.regularPriceKey,
|
|
27522
|
-
display: (doc2) =>
|
|
27527
|
+
key: (_e = searchBoxOptions.fields) == null ? void 0 : _e.regularPriceKey,
|
|
27528
|
+
display: (doc2) => {
|
|
27529
|
+
var _a2, _b2, _c2, _d2;
|
|
27530
|
+
return ((_a2 = searchBoxOptions.fields) == null ? void 0 : _a2.regularPriceKey) && ((_b2 = searchBoxOptions.fields) == null ? void 0 : _b2.discountPriceKey) && parseFloat(doc2[(_c2 = searchBoxOptions.fields) == null ? void 0 : _c2.regularPriceKey]) > parseFloat(doc2[(_d2 = searchBoxOptions.fields) == null ? void 0 : _d2.discountPriceKey]);
|
|
27531
|
+
}
|
|
27523
27532
|
},
|
|
27524
27533
|
{
|
|
27525
27534
|
type: "price",
|
|
27526
|
-
key: searchBoxOptions.fields.discountPriceKey
|
|
27535
|
+
key: (_f = searchBoxOptions.fields) == null ? void 0 : _f.discountPriceKey
|
|
27527
27536
|
}
|
|
27528
27537
|
]
|
|
27529
27538
|
}
|
|
@@ -27532,7 +27541,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
27532
27541
|
return {
|
|
27533
27542
|
inputSelector: searchBoxOptions.inputSelector,
|
|
27534
27543
|
options: {
|
|
27535
|
-
environment: (
|
|
27544
|
+
environment: (_g = searchBoxOptions.environment) != null ? _g : "production",
|
|
27536
27545
|
customUrl: searchBoxOptions.customUrl,
|
|
27537
27546
|
customBaseUrl: searchBoxOptions.customBaseUrl,
|
|
27538
27547
|
customPayload: searchBoxOptions.customPayload,
|
|
@@ -27540,9 +27549,9 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
27540
27549
|
},
|
|
27541
27550
|
showTotalCount: true,
|
|
27542
27551
|
expandOnSinglePanel: true,
|
|
27543
|
-
minInputLength: (
|
|
27552
|
+
minInputLength: (_i = (_h = searchBoxOptions.fields) == null ? void 0 : _h.minInputLength) != null ? _i : 0,
|
|
27544
27553
|
debounce: 250,
|
|
27545
|
-
labels: labels.searchBox,
|
|
27554
|
+
labels: labels == null ? void 0 : labels.searchBox,
|
|
27546
27555
|
links: {
|
|
27547
27556
|
searchResults: ""
|
|
27548
27557
|
},
|
|
@@ -27550,7 +27559,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
27550
27559
|
redirections,
|
|
27551
27560
|
history: {
|
|
27552
27561
|
labels: {
|
|
27553
|
-
clear: labels.searchBox.clearHistory
|
|
27562
|
+
clear: (_j = labels == null ? void 0 : labels.searchBox) == null ? void 0 : _j.clearHistory
|
|
27554
27563
|
}
|
|
27555
27564
|
}
|
|
27556
27565
|
};
|
|
@@ -27564,7 +27573,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
27564
27573
|
callbacks,
|
|
27565
27574
|
additionalFields
|
|
27566
27575
|
}) => {
|
|
27567
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
27576
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
27568
27577
|
const filters = searchResultOptions.showFacets ? {
|
|
27569
27578
|
currentFilters: {
|
|
27570
27579
|
visibility: {
|
|
@@ -27573,15 +27582,15 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
27573
27582
|
},
|
|
27574
27583
|
labels: {
|
|
27575
27584
|
title: "",
|
|
27576
|
-
clearAll: (_a = labels.facets) == null ? void 0 : _a.clearAll
|
|
27585
|
+
clearAll: (_a = labels == null ? void 0 : labels.facets) == null ? void 0 : _a.clearAll
|
|
27577
27586
|
}
|
|
27578
27587
|
},
|
|
27579
27588
|
facets: {
|
|
27580
27589
|
labels: {
|
|
27581
|
-
title: labels.facets.facetTitle,
|
|
27582
|
-
showAll: labels.facets.showAll,
|
|
27583
|
-
facetFilter: labels.facets.facetFilter,
|
|
27584
|
-
facetClear: labels.facets.facetClear
|
|
27590
|
+
title: (_b = labels == null ? void 0 : labels.facets) == null ? void 0 : _b.facetTitle,
|
|
27591
|
+
showAll: (_c = labels == null ? void 0 : labels.facets) == null ? void 0 : _c.showAll,
|
|
27592
|
+
facetFilter: (_d = labels == null ? void 0 : labels.facets) == null ? void 0 : _d.facetFilter,
|
|
27593
|
+
facetClear: (_e = labels == null ? void 0 : labels.facets) == null ? void 0 : _e.facetClear
|
|
27585
27594
|
},
|
|
27586
27595
|
filterable: {
|
|
27587
27596
|
minValues: 5
|
|
@@ -27606,12 +27615,12 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
27606
27615
|
}
|
|
27607
27616
|
}
|
|
27608
27617
|
} : {};
|
|
27609
|
-
const columns = (
|
|
27610
|
-
xl: (
|
|
27611
|
-
l: (
|
|
27612
|
-
md: (
|
|
27613
|
-
sm: (
|
|
27614
|
-
xs: (
|
|
27618
|
+
const columns = (_k = searchResultOptions.gridConfiguration) != null ? _k : {
|
|
27619
|
+
xl: (_f = searchResultOptions.maxColumns) != null ? _f : 4,
|
|
27620
|
+
l: (_g = searchResultOptions.maxColumns) != null ? _g : 3,
|
|
27621
|
+
md: (_h = searchResultOptions.maxColumns) != null ? _h : 3,
|
|
27622
|
+
sm: (_i = searchResultOptions.maxColumns) != null ? _i : 2,
|
|
27623
|
+
xs: (_j = searchResultOptions.maxColumns) != null ? _j : 1
|
|
27615
27624
|
};
|
|
27616
27625
|
const badges = searchResultOptions.showRelevance ? {
|
|
27617
27626
|
badges: {
|
|
@@ -27629,7 +27638,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
27629
27638
|
} : {};
|
|
27630
27639
|
return __spreadValues(__spreadProps(__spreadValues({
|
|
27631
27640
|
options: {
|
|
27632
|
-
environment: (
|
|
27641
|
+
environment: (_l = searchResultOptions.environment) != null ? _l : "production",
|
|
27633
27642
|
customUrl: searchResultOptions.customUrl,
|
|
27634
27643
|
customBaseUrl: searchResultOptions.customBaseUrl,
|
|
27635
27644
|
customPayload: searchResultOptions.customPayload,
|
|
@@ -27639,8 +27648,8 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
27639
27648
|
queryKey: searchResultOptions.queryKey,
|
|
27640
27649
|
containerSelector: searchResultOptions.containerSelector,
|
|
27641
27650
|
searchTitlePosition: "search-results-top",
|
|
27642
|
-
titleKey: searchResultOptions.fields.titleKey,
|
|
27643
|
-
labels: labels.searchResults,
|
|
27651
|
+
titleKey: (_m = searchResultOptions.fields) == null ? void 0 : _m.titleKey,
|
|
27652
|
+
labels: labels == null ? void 0 : labels.searchResults,
|
|
27644
27653
|
grid: {
|
|
27645
27654
|
columns
|
|
27646
27655
|
},
|
|
@@ -27672,7 +27681,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
27672
27681
|
}
|
|
27673
27682
|
}, badges), {
|
|
27674
27683
|
links: {
|
|
27675
|
-
details: searchResultOptions.fields.productUrl ? `{${searchResultOptions.fields.productUrl}}` : void 0
|
|
27684
|
+
details: ((_n = searchResultOptions.fields) == null ? void 0 : _n.productUrl) ? `{${(_o = searchResultOptions.fields) == null ? void 0 : _o.productUrl}}` : void 0
|
|
27676
27685
|
},
|
|
27677
27686
|
callbacks,
|
|
27678
27687
|
routingBehavior: callbacks ? "event" : "direct-link",
|
|
@@ -27681,37 +27690,43 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
27681
27690
|
{
|
|
27682
27691
|
type: "image",
|
|
27683
27692
|
placeholder: placeholderImage,
|
|
27684
|
-
key: searchResultOptions.fields.imageKey,
|
|
27685
|
-
baseUrl: searchResultOptions.fields.baseImageUrl,
|
|
27686
|
-
display: () =>
|
|
27693
|
+
key: (_p = searchResultOptions.fields) == null ? void 0 : _p.imageKey,
|
|
27694
|
+
baseUrl: (_q = searchResultOptions.fields) == null ? void 0 : _q.baseImageUrl,
|
|
27695
|
+
display: () => {
|
|
27696
|
+
var _a2;
|
|
27697
|
+
return (_a2 = searchResultOptions.fields) == null ? void 0 : _a2.imageKey;
|
|
27698
|
+
}
|
|
27687
27699
|
},
|
|
27688
|
-
addFieldIfKeyExists("_emphasis", (
|
|
27700
|
+
addFieldIfKeyExists("_emphasis", (_r = searchResultOptions.fields) == null ? void 0 : _r.emphasizedField, {
|
|
27689
27701
|
type: "custom",
|
|
27690
27702
|
className: "lupa-custom-emphasis",
|
|
27691
|
-
key: searchResultOptions.fields.emphasizedField,
|
|
27703
|
+
key: (_s = searchResultOptions.fields) == null ? void 0 : _s.emphasizedField,
|
|
27692
27704
|
display: () => true
|
|
27693
27705
|
}),
|
|
27694
27706
|
{
|
|
27695
27707
|
type: "title",
|
|
27696
|
-
key: searchResultOptions.fields.titleKey,
|
|
27697
|
-
maxLines: (
|
|
27698
|
-
display: (doc2) =>
|
|
27708
|
+
key: (_t = searchResultOptions.fields) == null ? void 0 : _t.titleKey,
|
|
27709
|
+
maxLines: (_u = searchResultOptions.maxLines) != null ? _u : 2,
|
|
27710
|
+
display: (doc2) => {
|
|
27711
|
+
var _a2, _b2;
|
|
27712
|
+
return ((_a2 = searchResultOptions.fields) == null ? void 0 : _a2.titleKey) && Boolean(doc2[(_b2 = searchResultOptions.fields) == null ? void 0 : _b2.titleKey]);
|
|
27713
|
+
}
|
|
27699
27714
|
},
|
|
27700
27715
|
...getAdditionalElements(additionalFields),
|
|
27701
|
-
addFieldIfKeyExists("_discountPrice", searchResultOptions.fields.discountPriceKey, {
|
|
27702
|
-
key: searchResultOptions.fields.discountPriceKey,
|
|
27716
|
+
addFieldIfKeyExists("_discountPrice", (_v = searchResultOptions.fields) == null ? void 0 : _v.discountPriceKey, {
|
|
27717
|
+
key: (_w = searchResultOptions.fields) == null ? void 0 : _w.discountPriceKey,
|
|
27703
27718
|
type: "customHtml",
|
|
27704
27719
|
className: "lupa-price lupa-price-discounted",
|
|
27705
27720
|
display: (doc2) => displayDiscountedPriceSection(doc2, searchResultOptions),
|
|
27706
27721
|
html: (doc2) => {
|
|
27707
|
-
var _a2, _b2, _c2, _d2;
|
|
27708
|
-
const currency = escapeHtml(searchResultOptions.fields.currency || "€");
|
|
27709
|
-
const discountPrice = (
|
|
27710
|
-
doc2[(
|
|
27711
|
-
)) == null ? void 0 : _b2.toFixed(2);
|
|
27712
|
-
const regularPrice = (_d2 = parseFloat(
|
|
27713
|
-
doc2[(_c2 = searchResultOptions.fields.regularPriceKey) != null ? _c2 : ""]
|
|
27722
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
|
|
27723
|
+
const currency = escapeHtml(((_a2 = searchResultOptions.fields) == null ? void 0 : _a2.currency) || "€");
|
|
27724
|
+
const discountPrice = (_d2 = parseFloat(
|
|
27725
|
+
doc2[(_c2 = (_b2 = searchResultOptions.fields) == null ? void 0 : _b2.discountPriceKey) != null ? _c2 : ""]
|
|
27714
27726
|
)) == null ? void 0 : _d2.toFixed(2);
|
|
27727
|
+
const regularPrice = (_g2 = parseFloat(
|
|
27728
|
+
doc2[(_f2 = (_e2 = searchResultOptions.fields) == null ? void 0 : _e2.regularPriceKey) != null ? _f2 : ""]
|
|
27729
|
+
)) == null ? void 0 : _g2.toFixed(2);
|
|
27715
27730
|
const discount = `<span class="lupa-discount">${escapeHtml(
|
|
27716
27731
|
discountPrice
|
|
27717
27732
|
)} ${currency}</span>`;
|
|
@@ -27721,17 +27736,17 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
27721
27736
|
return discount + regular;
|
|
27722
27737
|
}
|
|
27723
27738
|
}),
|
|
27724
|
-
addFieldIfKeyExists("_regularPrice", searchResultOptions.fields.regularPriceKey, {
|
|
27725
|
-
key: searchResultOptions.fields.regularPriceKey,
|
|
27739
|
+
addFieldIfKeyExists("_regularPrice", (_x = searchResultOptions.fields) == null ? void 0 : _x.regularPriceKey, {
|
|
27740
|
+
key: (_y = searchResultOptions.fields) == null ? void 0 : _y.regularPriceKey,
|
|
27726
27741
|
type: "customHtml",
|
|
27727
27742
|
className: "lupa-price lupa-price-single",
|
|
27728
27743
|
display: (doc2) => displayRegularPriceSection(doc2, searchResultOptions),
|
|
27729
27744
|
html: (doc2) => {
|
|
27730
|
-
var _a2, _b2, _c2, _d2;
|
|
27731
|
-
const currency = escapeHtml(searchResultOptions.fields.currency || "€");
|
|
27732
|
-
const price = (
|
|
27733
|
-
(
|
|
27734
|
-
)) == null ? void 0 :
|
|
27745
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
|
|
27746
|
+
const currency = escapeHtml(((_a2 = searchResultOptions.fields) == null ? void 0 : _a2.currency) || "€");
|
|
27747
|
+
const price = (_g2 = parseFloat(
|
|
27748
|
+
(_f2 = doc2[(_c2 = (_b2 = searchResultOptions.fields) == null ? void 0 : _b2.regularPriceKey) != null ? _c2 : ""]) != null ? _f2 : doc2[(_e2 = (_d2 = searchResultOptions.fields) == null ? void 0 : _d2.discountPriceKey) != null ? _e2 : ""]
|
|
27749
|
+
)) == null ? void 0 : _g2.toFixed(2);
|
|
27735
27750
|
return `<span class="lupa-final">${escapeHtml(price)} ${currency}</span>`;
|
|
27736
27751
|
}
|
|
27737
27752
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getlupa/client",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.2",
|
|
4
4
|
"main": "dist/lupaSearch.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@getlupa/client-sdk": "^1.3.4",
|
|
23
|
-
"@getlupa/vue": "0.8.
|
|
23
|
+
"@getlupa/vue": "0.8.1",
|
|
24
24
|
"@rushstack/eslint-patch": "^1.3.2",
|
|
25
25
|
"@tsconfig/node18": "^2.0.1",
|
|
26
26
|
"@types/jsdom": "^21.1.1",
|