@getlupa/client 1.7.0 → 1.8.0
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 +354 -12
- package/dist/lupaSearch.js +354 -12
- package/dist/lupaSearch.mjs +354 -12
- package/dist/lupaSearch.umd.js +354 -12
- package/dist/src/index.d.ts +11 -1
- package/dist/src/modules/preconfiguredContainer/SearchContainerConfigurationService.d.ts +7 -0
- package/dist/src/modules/preconfiguredContainer/configuratorUtils.d.ts +15 -0
- package/dist/src/types/PreconfiguredSearchContainerOptions.d.ts +57 -0
- package/package.json +1 -1
package/dist/lupaSearch.mjs
CHANGED
|
@@ -79,11 +79,11 @@ const hyphenateRE = /\B([A-Z])/g;
|
|
|
79
79
|
const hyphenate = cacheStringFunction(
|
|
80
80
|
(str) => str.replace(hyphenateRE, "-$1").toLowerCase()
|
|
81
81
|
);
|
|
82
|
-
const capitalize$
|
|
82
|
+
const capitalize$2 = cacheStringFunction(
|
|
83
83
|
(str) => str.charAt(0).toUpperCase() + str.slice(1)
|
|
84
84
|
);
|
|
85
85
|
const toHandlerKey = cacheStringFunction(
|
|
86
|
-
(str) => str ? `on${capitalize$
|
|
86
|
+
(str) => str ? `on${capitalize$2(str)}` : ``
|
|
87
87
|
);
|
|
88
88
|
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
|
89
89
|
const invokeArrayFns = (fns, arg) => {
|
|
@@ -2113,7 +2113,7 @@ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false
|
|
|
2113
2113
|
false
|
|
2114
2114
|
/* do not include inferred name to avoid breaking existing code */
|
|
2115
2115
|
);
|
|
2116
|
-
if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize$
|
|
2116
|
+
if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize$2(camelize(name)))) {
|
|
2117
2117
|
return Component;
|
|
2118
2118
|
}
|
|
2119
2119
|
}
|
|
@@ -2130,7 +2130,7 @@ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false
|
|
|
2130
2130
|
}
|
|
2131
2131
|
}
|
|
2132
2132
|
function resolve(registry, name) {
|
|
2133
|
-
return registry && (registry[name] || registry[camelize(name)] || registry[capitalize$
|
|
2133
|
+
return registry && (registry[name] || registry[camelize(name)] || registry[capitalize$2(camelize(name))]);
|
|
2134
2134
|
}
|
|
2135
2135
|
function renderList(source, renderItem, cache, index) {
|
|
2136
2136
|
let ret;
|
|
@@ -5376,7 +5376,7 @@ function autoPrefix(style, rawName) {
|
|
|
5376
5376
|
if (name !== "filter" && name in style) {
|
|
5377
5377
|
return prefixCache[rawName] = name;
|
|
5378
5378
|
}
|
|
5379
|
-
name = capitalize$
|
|
5379
|
+
name = capitalize$2(name);
|
|
5380
5380
|
for (let i = 0; i < prefixes.length; i++) {
|
|
5381
5381
|
const prefixed = prefixes[i] + name;
|
|
5382
5382
|
if (prefixed in style) {
|
|
@@ -6322,7 +6322,7 @@ const getNormalizedString = (str) => {
|
|
|
6322
6322
|
const transformedStr = typeof str === "string" ? str : str.toString();
|
|
6323
6323
|
return transformedStr.normalize === void 0 ? transformedStr.toLocaleLowerCase() : transformedStr.toLocaleLowerCase().normalize("NFKD").replace(/[^\w\s.-_/]/g, "");
|
|
6324
6324
|
};
|
|
6325
|
-
const capitalize = (str) => {
|
|
6325
|
+
const capitalize$1 = (str) => {
|
|
6326
6326
|
if (!str) {
|
|
6327
6327
|
return "";
|
|
6328
6328
|
}
|
|
@@ -6371,7 +6371,7 @@ const normalizeFloat = (value) => {
|
|
|
6371
6371
|
}
|
|
6372
6372
|
return +((_a = value == null ? void 0 : value.replace(/[^0-9,.]/g, "")) == null ? void 0 : _a.replace(",", "."));
|
|
6373
6373
|
};
|
|
6374
|
-
const escapeHtml = (value) => {
|
|
6374
|
+
const escapeHtml$1 = (value) => {
|
|
6375
6375
|
if (!value) {
|
|
6376
6376
|
return "";
|
|
6377
6377
|
}
|
|
@@ -7060,7 +7060,7 @@ const getLabeledFilters = (filters, facets) => {
|
|
|
7060
7060
|
return filters.map((f2) => {
|
|
7061
7061
|
var _a, _b;
|
|
7062
7062
|
return __spreadProps2(__spreadValues2({}, f2), {
|
|
7063
|
-
label: (_b = (_a = facets == null ? void 0 : facets.find((ft) => ft.key === f2.key)) == null ? void 0 : _a.label) != null ? _b : capitalize(f2.key)
|
|
7063
|
+
label: (_b = (_a = facets == null ? void 0 : facets.find((ft) => ft.key === f2.key)) == null ? void 0 : _a.label) != null ? _b : capitalize$1(f2.key)
|
|
7064
7064
|
});
|
|
7065
7065
|
});
|
|
7066
7066
|
};
|
|
@@ -7105,9 +7105,9 @@ const pick = (obj, keys) => {
|
|
|
7105
7105
|
const getHint = (suggestion, inputValue) => {
|
|
7106
7106
|
var _a;
|
|
7107
7107
|
if (!inputValue) {
|
|
7108
|
-
return escapeHtml(suggestion);
|
|
7108
|
+
return escapeHtml$1(suggestion);
|
|
7109
7109
|
}
|
|
7110
|
-
return (_a = suggestion == null ? void 0 : suggestion.replace(inputValue, `<strong>${escapeHtml(inputValue)}</strong>`)) != null ? _a : "";
|
|
7110
|
+
return (_a = suggestion == null ? void 0 : suggestion.replace(inputValue, `<strong>${escapeHtml$1(inputValue)}</strong>`)) != null ? _a : "";
|
|
7111
7111
|
};
|
|
7112
7112
|
const reverseKeyValue = (obj) => {
|
|
7113
7113
|
return Object.fromEntries(Object.entries(obj).map(([k, v]) => [v, k.toLowerCase()]));
|
|
@@ -13689,7 +13689,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
13689
13689
|
return (_b = (_a = props.labels.similarQuery) == null ? void 0 : _a.replace("{1}", "")) != null ? _b : "";
|
|
13690
13690
|
});
|
|
13691
13691
|
const getSimilarQueryContent = (displayQuery) => {
|
|
13692
|
-
return escapeHtml(displayQuery);
|
|
13692
|
+
return escapeHtml$1(displayQuery);
|
|
13693
13693
|
};
|
|
13694
13694
|
const goToResults = ({
|
|
13695
13695
|
searchText,
|
|
@@ -27419,6 +27419,328 @@ const attatchShadowDom = ({
|
|
|
27419
27419
|
shadow.appendChild(style);
|
|
27420
27420
|
}
|
|
27421
27421
|
};
|
|
27422
|
+
const displayDiscountedPriceSection = (doc2, options) => {
|
|
27423
|
+
var _a, _b;
|
|
27424
|
+
const discountPrice = doc2[(_a = options.fields.discountPriceKey) != null ? _a : ""];
|
|
27425
|
+
const regularPrice = doc2[(_b = options.fields.regularPriceKey) != null ? _b : ""];
|
|
27426
|
+
return discountPrice && regularPrice && discountPrice < regularPrice;
|
|
27427
|
+
};
|
|
27428
|
+
const displayRegularPriceSection = (doc2, options) => {
|
|
27429
|
+
var _a, _b;
|
|
27430
|
+
const discountPrice = doc2[(_a = options.fields.discountPriceKey) != null ? _a : ""];
|
|
27431
|
+
const regularPrice = doc2[(_b = options.fields.regularPriceKey) != null ? _b : ""];
|
|
27432
|
+
const anyPrice = discountPrice || regularPrice;
|
|
27433
|
+
return anyPrice && !displayDiscountedPriceSection(doc2, options);
|
|
27434
|
+
};
|
|
27435
|
+
const escapeHtml = (source) => {
|
|
27436
|
+
if (!source) {
|
|
27437
|
+
return source;
|
|
27438
|
+
}
|
|
27439
|
+
return `${source}`.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
27440
|
+
};
|
|
27441
|
+
const toMaxDecimalPlaces = (value, maxDecimal = 2) => {
|
|
27442
|
+
if (!value) {
|
|
27443
|
+
return 0;
|
|
27444
|
+
}
|
|
27445
|
+
try {
|
|
27446
|
+
return +parseFloat(`${value}`).toFixed(maxDecimal);
|
|
27447
|
+
} catch (e) {
|
|
27448
|
+
return `${value}`;
|
|
27449
|
+
}
|
|
27450
|
+
};
|
|
27451
|
+
const capitalize = (value) => {
|
|
27452
|
+
if (!value) {
|
|
27453
|
+
return "";
|
|
27454
|
+
}
|
|
27455
|
+
return value.charAt(0).toLocaleUpperCase() + value.slice(1);
|
|
27456
|
+
};
|
|
27457
|
+
const getAlphanumeric = (value) => {
|
|
27458
|
+
if (!value) {
|
|
27459
|
+
return "";
|
|
27460
|
+
}
|
|
27461
|
+
return value.replace(/[\W_]/g, " ");
|
|
27462
|
+
};
|
|
27463
|
+
const getAdditionalElements = (fields) => {
|
|
27464
|
+
return fields.map((key) => ({
|
|
27465
|
+
type: "custom",
|
|
27466
|
+
key,
|
|
27467
|
+
label: capitalize(getAlphanumeric(key)),
|
|
27468
|
+
className: "lupa-custom",
|
|
27469
|
+
display: (doc2) => Boolean(doc2[key])
|
|
27470
|
+
}));
|
|
27471
|
+
};
|
|
27472
|
+
const addFieldIfKeyExists = (field, key, config) => {
|
|
27473
|
+
if (key) {
|
|
27474
|
+
return config;
|
|
27475
|
+
}
|
|
27476
|
+
return { key: field, type: "customHtml", display: () => false };
|
|
27477
|
+
};
|
|
27478
|
+
const getSearchBoxComponent = ({
|
|
27479
|
+
searchBoxOptions,
|
|
27480
|
+
labels,
|
|
27481
|
+
panelOptions,
|
|
27482
|
+
redirections,
|
|
27483
|
+
placeholderImage
|
|
27484
|
+
}) => {
|
|
27485
|
+
var _a, _b;
|
|
27486
|
+
const panels = [
|
|
27487
|
+
...(panelOptions == null ? void 0 : panelOptions.suggestionPanel) ? [
|
|
27488
|
+
{
|
|
27489
|
+
type: SearchBoxPanelType.SUGGESTION,
|
|
27490
|
+
queryKey: searchBoxOptions.suggestionQueryKey,
|
|
27491
|
+
highlight: true,
|
|
27492
|
+
limit: 8,
|
|
27493
|
+
labels: {
|
|
27494
|
+
topResultsTitle: labels.searchBox.topSuggestionsTitle
|
|
27495
|
+
}
|
|
27496
|
+
}
|
|
27497
|
+
] : [],
|
|
27498
|
+
...(panelOptions == null ? void 0 : panelOptions.docPanel) ? [
|
|
27499
|
+
{
|
|
27500
|
+
type: SearchBoxPanelType.DOCUMENT,
|
|
27501
|
+
queryKey: searchBoxOptions.documentQueryKey,
|
|
27502
|
+
limit: 5,
|
|
27503
|
+
elements: [
|
|
27504
|
+
{
|
|
27505
|
+
type: "image",
|
|
27506
|
+
placeholder: placeholderImage,
|
|
27507
|
+
key: searchBoxOptions.fields.imageKey,
|
|
27508
|
+
baseUrl: searchBoxOptions.fields.baseImageUrl
|
|
27509
|
+
},
|
|
27510
|
+
{
|
|
27511
|
+
type: "title",
|
|
27512
|
+
key: searchBoxOptions.fields.titleKey,
|
|
27513
|
+
maxLines: 2
|
|
27514
|
+
},
|
|
27515
|
+
{
|
|
27516
|
+
type: "regularPrice",
|
|
27517
|
+
key: searchBoxOptions.fields.regularPriceKey,
|
|
27518
|
+
display: (doc2) => searchBoxOptions.fields.regularPriceKey && searchBoxOptions.fields.discountPriceKey && parseFloat(doc2[searchBoxOptions.fields.regularPriceKey]) > parseFloat(doc2[searchBoxOptions.fields.discountPriceKey])
|
|
27519
|
+
},
|
|
27520
|
+
{
|
|
27521
|
+
type: "price",
|
|
27522
|
+
key: searchBoxOptions.fields.discountPriceKey
|
|
27523
|
+
}
|
|
27524
|
+
]
|
|
27525
|
+
}
|
|
27526
|
+
] : []
|
|
27527
|
+
];
|
|
27528
|
+
return {
|
|
27529
|
+
inputSelector: searchBoxOptions.inputSelector,
|
|
27530
|
+
options: {
|
|
27531
|
+
environment: (_a = searchBoxOptions.environment) != null ? _a : "production",
|
|
27532
|
+
customUrl: searchBoxOptions.customUrl,
|
|
27533
|
+
customBaseUrl: searchBoxOptions.customBaseUrl,
|
|
27534
|
+
customPayload: searchBoxOptions.customPayload,
|
|
27535
|
+
customHeaders: searchBoxOptions.customHeaders
|
|
27536
|
+
},
|
|
27537
|
+
showTotalCount: true,
|
|
27538
|
+
expandOnSinglePanel: true,
|
|
27539
|
+
minInputLength: (_b = searchBoxOptions.fields.minInputLength) != null ? _b : 0,
|
|
27540
|
+
debounce: 250,
|
|
27541
|
+
labels: labels.searchBox,
|
|
27542
|
+
links: {
|
|
27543
|
+
searchResults: ""
|
|
27544
|
+
},
|
|
27545
|
+
panels,
|
|
27546
|
+
redirections,
|
|
27547
|
+
history: {
|
|
27548
|
+
labels: {
|
|
27549
|
+
clear: labels.searchBox.clearHistory
|
|
27550
|
+
}
|
|
27551
|
+
}
|
|
27552
|
+
};
|
|
27553
|
+
};
|
|
27554
|
+
const getSearchResultsComponent = ({
|
|
27555
|
+
searchResultOptions,
|
|
27556
|
+
labels,
|
|
27557
|
+
redirections,
|
|
27558
|
+
placeholderImage,
|
|
27559
|
+
configuratorOverrides,
|
|
27560
|
+
callbacks,
|
|
27561
|
+
additionalFields
|
|
27562
|
+
}) => {
|
|
27563
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
27564
|
+
const filters = searchResultOptions.showFacets ? {
|
|
27565
|
+
currentFilters: {
|
|
27566
|
+
visibility: {
|
|
27567
|
+
mobileSidebar: true,
|
|
27568
|
+
mobileToolbar: true
|
|
27569
|
+
},
|
|
27570
|
+
labels: {
|
|
27571
|
+
title: "",
|
|
27572
|
+
clearAll: (_a = labels.facets) == null ? void 0 : _a.clearAll
|
|
27573
|
+
}
|
|
27574
|
+
},
|
|
27575
|
+
facets: {
|
|
27576
|
+
labels: {
|
|
27577
|
+
title: labels.facets.facetTitle,
|
|
27578
|
+
showAll: labels.facets.showAll,
|
|
27579
|
+
facetFilter: labels.facets.facetFilter,
|
|
27580
|
+
facetClear: labels.facets.facetClear
|
|
27581
|
+
},
|
|
27582
|
+
filterable: {
|
|
27583
|
+
minValues: 5
|
|
27584
|
+
},
|
|
27585
|
+
hierarchy: {
|
|
27586
|
+
maxInitialLevel: 2,
|
|
27587
|
+
topLevelValueCountLimit: 5,
|
|
27588
|
+
filterable: true
|
|
27589
|
+
},
|
|
27590
|
+
stats: {
|
|
27591
|
+
slider: true,
|
|
27592
|
+
inputs: true,
|
|
27593
|
+
labels: {
|
|
27594
|
+
from: "",
|
|
27595
|
+
to: ""
|
|
27596
|
+
}
|
|
27597
|
+
},
|
|
27598
|
+
facetValueCountLimit: 8,
|
|
27599
|
+
showDocumentCount: true,
|
|
27600
|
+
style: {
|
|
27601
|
+
type: "sidebar"
|
|
27602
|
+
}
|
|
27603
|
+
}
|
|
27604
|
+
} : {};
|
|
27605
|
+
const columns = (_g = searchResultOptions.gridConfiguration) != null ? _g : {
|
|
27606
|
+
xl: (_b = searchResultOptions.maxColumns) != null ? _b : 4,
|
|
27607
|
+
l: (_c = searchResultOptions.maxColumns) != null ? _c : 3,
|
|
27608
|
+
md: (_d = searchResultOptions.maxColumns) != null ? _d : 3,
|
|
27609
|
+
sm: (_e = searchResultOptions.maxColumns) != null ? _e : 2,
|
|
27610
|
+
xs: (_f = searchResultOptions.maxColumns) != null ? _f : 1
|
|
27611
|
+
};
|
|
27612
|
+
const badges = searchResultOptions.showRelevance ? {
|
|
27613
|
+
badges: {
|
|
27614
|
+
anchor: "tr",
|
|
27615
|
+
elements: [
|
|
27616
|
+
{
|
|
27617
|
+
key: "",
|
|
27618
|
+
type: "customHtml",
|
|
27619
|
+
className: "relevance",
|
|
27620
|
+
html: (doc2) => `${toMaxDecimalPlaces(escapeHtml(doc2._relevance), 3)}`,
|
|
27621
|
+
display: (doc2) => Boolean(doc2._relevance !== void 0)
|
|
27622
|
+
}
|
|
27623
|
+
]
|
|
27624
|
+
}
|
|
27625
|
+
} : {};
|
|
27626
|
+
return __spreadValues(__spreadProps(__spreadValues({
|
|
27627
|
+
options: {
|
|
27628
|
+
environment: (_h = searchResultOptions.environment) != null ? _h : "production",
|
|
27629
|
+
customUrl: searchResultOptions.customUrl,
|
|
27630
|
+
customBaseUrl: searchResultOptions.customBaseUrl,
|
|
27631
|
+
customPayload: searchResultOptions.customPayload,
|
|
27632
|
+
customHeaders: searchResultOptions.customHeaders,
|
|
27633
|
+
onError: searchResultOptions.errorHandler
|
|
27634
|
+
},
|
|
27635
|
+
queryKey: searchResultOptions.queryKey,
|
|
27636
|
+
containerSelector: searchResultOptions.containerSelector,
|
|
27637
|
+
searchTitlePosition: "search-results-top",
|
|
27638
|
+
titleKey: searchResultOptions.fields.titleKey,
|
|
27639
|
+
labels: labels.searchResults,
|
|
27640
|
+
grid: {
|
|
27641
|
+
columns
|
|
27642
|
+
},
|
|
27643
|
+
pagination: {
|
|
27644
|
+
sizeSelection: {
|
|
27645
|
+
position: {
|
|
27646
|
+
top: true,
|
|
27647
|
+
bottom: false
|
|
27648
|
+
},
|
|
27649
|
+
sizes: [12, 24, 36, 48]
|
|
27650
|
+
},
|
|
27651
|
+
pageSelection: {
|
|
27652
|
+
position: {
|
|
27653
|
+
top: false,
|
|
27654
|
+
bottom: true
|
|
27655
|
+
},
|
|
27656
|
+
displayMobile: 3,
|
|
27657
|
+
display: 5
|
|
27658
|
+
}
|
|
27659
|
+
},
|
|
27660
|
+
filters,
|
|
27661
|
+
toolbar: {
|
|
27662
|
+
layoutSelector: false,
|
|
27663
|
+
itemSummary: true,
|
|
27664
|
+
clearFilters: false
|
|
27665
|
+
},
|
|
27666
|
+
isInStock: () => {
|
|
27667
|
+
return true;
|
|
27668
|
+
}
|
|
27669
|
+
}, badges), {
|
|
27670
|
+
links: {
|
|
27671
|
+
details: searchResultOptions.fields.productUrl ? `{${searchResultOptions.fields.productUrl}}` : void 0
|
|
27672
|
+
},
|
|
27673
|
+
callbacks,
|
|
27674
|
+
routingBehavior: callbacks ? "event" : "direct-link",
|
|
27675
|
+
idKey: "id",
|
|
27676
|
+
elements: [
|
|
27677
|
+
{
|
|
27678
|
+
type: "image",
|
|
27679
|
+
placeholder: placeholderImage,
|
|
27680
|
+
key: searchResultOptions.fields.imageKey,
|
|
27681
|
+
baseUrl: searchResultOptions.fields.baseImageUrl,
|
|
27682
|
+
display: () => searchResultOptions.fields.imageKey
|
|
27683
|
+
},
|
|
27684
|
+
addFieldIfKeyExists("_emphasis", (_i = searchResultOptions.fields) == null ? void 0 : _i.emphasizedField, {
|
|
27685
|
+
type: "custom",
|
|
27686
|
+
className: "lupa-custom-emphasis",
|
|
27687
|
+
key: searchResultOptions.fields.emphasizedField,
|
|
27688
|
+
display: () => true
|
|
27689
|
+
}),
|
|
27690
|
+
{
|
|
27691
|
+
type: "title",
|
|
27692
|
+
key: searchResultOptions.fields.titleKey,
|
|
27693
|
+
maxLines: (_j = searchResultOptions.maxLines) != null ? _j : 2,
|
|
27694
|
+
display: (doc2) => searchResultOptions.fields.titleKey && Boolean(doc2[searchResultOptions.fields.titleKey])
|
|
27695
|
+
},
|
|
27696
|
+
...getAdditionalElements(additionalFields),
|
|
27697
|
+
addFieldIfKeyExists("_discountPrice", searchResultOptions.fields.discountPriceKey, {
|
|
27698
|
+
key: searchResultOptions.fields.discountPriceKey,
|
|
27699
|
+
type: "customHtml",
|
|
27700
|
+
className: "lupa-price lupa-price-discounted",
|
|
27701
|
+
display: (doc2) => displayDiscountedPriceSection(doc2, searchResultOptions),
|
|
27702
|
+
html: (doc2) => {
|
|
27703
|
+
var _a2, _b2, _c2, _d2;
|
|
27704
|
+
const currency = escapeHtml(searchResultOptions.fields.currency || "€");
|
|
27705
|
+
const discountPrice = (_b2 = parseFloat(
|
|
27706
|
+
doc2[(_a2 = searchResultOptions.fields.discountPriceKey) != null ? _a2 : ""]
|
|
27707
|
+
)) == null ? void 0 : _b2.toFixed(2);
|
|
27708
|
+
const regularPrice = (_d2 = parseFloat(
|
|
27709
|
+
doc2[(_c2 = searchResultOptions.fields.regularPriceKey) != null ? _c2 : ""]
|
|
27710
|
+
)) == null ? void 0 : _d2.toFixed(2);
|
|
27711
|
+
const discount = `<span class="lupa-discount">${escapeHtml(
|
|
27712
|
+
discountPrice
|
|
27713
|
+
)} ${currency}</span>`;
|
|
27714
|
+
const regular = `<span class="lupa-regular">${escapeHtml(
|
|
27715
|
+
regularPrice
|
|
27716
|
+
)} ${currency}</span>`;
|
|
27717
|
+
return discount + regular;
|
|
27718
|
+
}
|
|
27719
|
+
}),
|
|
27720
|
+
addFieldIfKeyExists("_regularPrice", searchResultOptions.fields.regularPriceKey, {
|
|
27721
|
+
key: searchResultOptions.fields.regularPriceKey,
|
|
27722
|
+
type: "customHtml",
|
|
27723
|
+
className: "lupa-price lupa-price-single",
|
|
27724
|
+
display: (doc2) => displayRegularPriceSection(doc2, searchResultOptions),
|
|
27725
|
+
html: (doc2) => {
|
|
27726
|
+
var _a2, _b2, _c2, _d2;
|
|
27727
|
+
const currency = escapeHtml(searchResultOptions.fields.currency || "€");
|
|
27728
|
+
const price = (_d2 = parseFloat(
|
|
27729
|
+
(_c2 = doc2[(_a2 = searchResultOptions.fields.regularPriceKey) != null ? _a2 : ""]) != null ? _c2 : doc2[(_b2 = searchResultOptions.fields.discountPriceKey) != null ? _b2 : ""]
|
|
27730
|
+
)) == null ? void 0 : _d2.toFixed(2);
|
|
27731
|
+
return `<span class="lupa-final">${escapeHtml(price)} ${currency}</span>`;
|
|
27732
|
+
}
|
|
27733
|
+
})
|
|
27734
|
+
],
|
|
27735
|
+
breadcrumbs: [],
|
|
27736
|
+
sort: [],
|
|
27737
|
+
redirections
|
|
27738
|
+
}), configuratorOverrides);
|
|
27739
|
+
};
|
|
27740
|
+
const SearchContainerConfigurationService = {
|
|
27741
|
+
getSearchBoxComponent,
|
|
27742
|
+
getSearchResultsComponent
|
|
27743
|
+
};
|
|
27422
27744
|
const app = {
|
|
27423
27745
|
box: {},
|
|
27424
27746
|
results: {},
|
|
@@ -27553,6 +27875,23 @@ const searchContainer = (options, mountOptions) => {
|
|
|
27553
27875
|
}
|
|
27554
27876
|
app.searchContainer[options.trigger] = instance;
|
|
27555
27877
|
};
|
|
27878
|
+
const preconfiguredSearchContainer = (preconfiguredSearchContainerOptions, mountOptions) => {
|
|
27879
|
+
const searchBox2 = SearchContainerConfigurationService.getSearchBoxComponent(
|
|
27880
|
+
preconfiguredSearchContainerOptions
|
|
27881
|
+
);
|
|
27882
|
+
const searchResults2 = SearchContainerConfigurationService.getSearchResultsComponent(
|
|
27883
|
+
preconfiguredSearchContainerOptions
|
|
27884
|
+
);
|
|
27885
|
+
searchContainer(
|
|
27886
|
+
{
|
|
27887
|
+
trigger: preconfiguredSearchContainerOptions.trigger,
|
|
27888
|
+
searchBox: searchBox2,
|
|
27889
|
+
searchResults: searchResults2,
|
|
27890
|
+
options: preconfiguredSearchContainerOptions.configuration
|
|
27891
|
+
},
|
|
27892
|
+
mountOptions
|
|
27893
|
+
);
|
|
27894
|
+
};
|
|
27556
27895
|
const recommendations = (options, mountOptions) => {
|
|
27557
27896
|
const existingInstance = app.recommendations[options.containerSelector];
|
|
27558
27897
|
if (existingInstance) {
|
|
@@ -27690,7 +28029,10 @@ const lupaSearch = {
|
|
|
27690
28029
|
clearSearchContainer,
|
|
27691
28030
|
clearRecommendations,
|
|
27692
28031
|
chat,
|
|
27693
|
-
clearChat
|
|
28032
|
+
clearChat,
|
|
28033
|
+
preconfiguredSearchContainer,
|
|
28034
|
+
getSearchBoxComponent: SearchContainerConfigurationService.getSearchBoxComponent,
|
|
28035
|
+
getSearchResultsComponent: SearchContainerConfigurationService.getSearchResultsComponent
|
|
27694
28036
|
};
|
|
27695
28037
|
if (typeof window !== "undefined") {
|
|
27696
28038
|
window.getLupa = lupaSearch;
|