@getlupa/vue 0.15.10 → 0.15.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/lupaSearch.js
CHANGED
|
@@ -14470,6 +14470,74 @@ const _sfc_main$12 = /* @__PURE__ */ vue.defineComponent({
|
|
|
14470
14470
|
};
|
|
14471
14471
|
}
|
|
14472
14472
|
});
|
|
14473
|
+
const extractValue = (options) => {
|
|
14474
|
+
switch (options.extractFrom) {
|
|
14475
|
+
case "url":
|
|
14476
|
+
return extractFromUrl(options);
|
|
14477
|
+
case "localStorage":
|
|
14478
|
+
case "sessionStorage":
|
|
14479
|
+
return extractFromStorage(options);
|
|
14480
|
+
case "htmlElementText":
|
|
14481
|
+
return extractFromHtmlElementText(options);
|
|
14482
|
+
case "cookie":
|
|
14483
|
+
return extractFromCookie(options);
|
|
14484
|
+
default:
|
|
14485
|
+
return options.default;
|
|
14486
|
+
}
|
|
14487
|
+
};
|
|
14488
|
+
const extractFromCookie = (options) => {
|
|
14489
|
+
var _a, _b;
|
|
14490
|
+
try {
|
|
14491
|
+
const cookieValue = (_b = (_a = document.cookie) == null ? void 0 : _a.split("; ")) == null ? void 0 : _b.find((row) => row == null ? void 0 : row.startsWith(`${options.cookieName}=`));
|
|
14492
|
+
return cookieValue ? cookieValue.split("=")[1] : options.default;
|
|
14493
|
+
} catch (e2) {
|
|
14494
|
+
return options.default;
|
|
14495
|
+
}
|
|
14496
|
+
};
|
|
14497
|
+
const extractFromUrl = (options) => {
|
|
14498
|
+
const regex = new RegExp(options.regex);
|
|
14499
|
+
const match = window.location.href.match(regex);
|
|
14500
|
+
return match ? match[1] : options.default;
|
|
14501
|
+
};
|
|
14502
|
+
const extractFromStorage = (options) => {
|
|
14503
|
+
const storage = options.extractFrom === "localStorage" ? localStorage : sessionStorage;
|
|
14504
|
+
let rawValue2 = "";
|
|
14505
|
+
try {
|
|
14506
|
+
rawValue2 = storage.getItem(options.key);
|
|
14507
|
+
} catch (e2) {
|
|
14508
|
+
return options.default;
|
|
14509
|
+
}
|
|
14510
|
+
if (rawValue2) {
|
|
14511
|
+
try {
|
|
14512
|
+
const parsedValue = JSON.parse(rawValue2);
|
|
14513
|
+
return options.path ? getValueFromPath(parsedValue, options.path) : parsedValue;
|
|
14514
|
+
} catch (e2) {
|
|
14515
|
+
return rawValue2;
|
|
14516
|
+
}
|
|
14517
|
+
}
|
|
14518
|
+
return options.default;
|
|
14519
|
+
};
|
|
14520
|
+
const extractFromHtmlElementText = (options) => {
|
|
14521
|
+
var _a;
|
|
14522
|
+
const element = document.querySelector(options.querySelector);
|
|
14523
|
+
return element ? ((_a = element.textContent) == null ? void 0 : _a.trim()) || options.default : options.default;
|
|
14524
|
+
};
|
|
14525
|
+
const getValueFromPath = (obj, path) => {
|
|
14526
|
+
return path.split(".").reduce((value, key) => value && value[key] || null, obj);
|
|
14527
|
+
};
|
|
14528
|
+
const processExtractionObject = (value = {}) => {
|
|
14529
|
+
var _a;
|
|
14530
|
+
const parsedObject = {};
|
|
14531
|
+
for (const key in value) {
|
|
14532
|
+
if (isObject$1(value[key]) && ((_a = value[key]) == null ? void 0 : _a.extractFrom)) {
|
|
14533
|
+
const extractedValue = extractValue(value[key]);
|
|
14534
|
+
parsedObject[key] = Array.isArray(extractedValue) ? extractedValue : [extractedValue];
|
|
14535
|
+
} else {
|
|
14536
|
+
parsedObject[key] = value[key];
|
|
14537
|
+
}
|
|
14538
|
+
}
|
|
14539
|
+
return parsedObject;
|
|
14540
|
+
};
|
|
14473
14541
|
const _sfc_main$11 = /* @__PURE__ */ vue.defineComponent({
|
|
14474
14542
|
__name: "SearchBoxProductsWrapper",
|
|
14475
14543
|
props: {
|
|
@@ -14493,6 +14561,9 @@ const _sfc_main$11 = /* @__PURE__ */ vue.defineComponent({
|
|
|
14493
14561
|
const showGoToResultsButton = vue.computed(() => {
|
|
14494
14562
|
return props.panel.showGoToResults;
|
|
14495
14563
|
});
|
|
14564
|
+
const extractedInitialFilters = vue.computed(() => {
|
|
14565
|
+
return __spreadValues({}, processExtractionObject(props.searchBoxOptions.initialFilters));
|
|
14566
|
+
});
|
|
14496
14567
|
const inputValueProp = vue.computed(() => props.inputValue);
|
|
14497
14568
|
vue.onMounted(() => {
|
|
14498
14569
|
getItemsDebounced();
|
|
@@ -14510,7 +14581,11 @@ const _sfc_main$11 = /* @__PURE__ */ vue.defineComponent({
|
|
|
14510
14581
|
const getItems = () => {
|
|
14511
14582
|
searchBoxStore.queryDocuments({
|
|
14512
14583
|
queryKey: props.panel.queryKey,
|
|
14513
|
-
publicQuery: {
|
|
14584
|
+
publicQuery: {
|
|
14585
|
+
searchText: props.inputValue,
|
|
14586
|
+
limit: props.panel.limit,
|
|
14587
|
+
filters: extractedInitialFilters.value
|
|
14588
|
+
},
|
|
14514
14589
|
options: props.options
|
|
14515
14590
|
}).then(({ result: result2 }) => {
|
|
14516
14591
|
if (!(result2 == null ? void 0 : result2.items.length)) {
|
|
@@ -14939,6 +15014,9 @@ const _sfc_main$_ = /* @__PURE__ */ vue.defineComponent({
|
|
|
14939
15014
|
const focused = vue.ref(false);
|
|
14940
15015
|
const searchBoxInput = vue.ref(null);
|
|
14941
15016
|
const { highlightedDocument } = storeToRefs(searchBoxStore);
|
|
15017
|
+
vue.computed(() => {
|
|
15018
|
+
return __spreadValues({}, processExtractionObject(props.options.initialFilters));
|
|
15019
|
+
});
|
|
14942
15020
|
const searchValue = vue.computed(() => {
|
|
14943
15021
|
return suggestedValue.value.override ? suggestedValue.value.item.suggestion : inputValue.value;
|
|
14944
15022
|
});
|
|
@@ -14964,7 +15042,8 @@ const _sfc_main$_ = /* @__PURE__ */ vue.defineComponent({
|
|
|
14964
15042
|
"hideMoreResultsButtonOnNoResults",
|
|
14965
15043
|
"showNoResultsPanel",
|
|
14966
15044
|
"expandOnSinglePanel",
|
|
14967
|
-
"showMoreResultsButton"
|
|
15045
|
+
"showMoreResultsButton",
|
|
15046
|
+
"initialFilters"
|
|
14968
15047
|
])
|
|
14969
15048
|
);
|
|
14970
15049
|
const searchTriggers = vue.computed(() => {
|
|
@@ -20215,9 +20294,12 @@ const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
|
|
|
20215
20294
|
const dynamicDataStore = useDynamicDataStore();
|
|
20216
20295
|
const screenStore = useScreenStore();
|
|
20217
20296
|
const redirectionStore = useRedirectionStore();
|
|
20297
|
+
const extractedInitialFilters = vue.computed(() => {
|
|
20298
|
+
return __spreadValues({}, processExtractionObject(props.options.initialFilters));
|
|
20299
|
+
});
|
|
20218
20300
|
const initialFilters = vue.computed(() => {
|
|
20219
|
-
var _a;
|
|
20220
|
-
return (_a = props.initialFilters) != null ? _a : {};
|
|
20301
|
+
var _a, _b;
|
|
20302
|
+
return (_b = (_a = props.initialFilters) != null ? _a : extractedInitialFilters.value) != null ? _b : {};
|
|
20221
20303
|
});
|
|
20222
20304
|
const { currentQueryText, hasResults, currentFilterCount } = storeToRefs(searchResultStore);
|
|
20223
20305
|
const { searchString, sortParams } = storeToRefs(paramStore);
|
|
@@ -20523,62 +20605,6 @@ const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
|
|
|
20523
20605
|
};
|
|
20524
20606
|
}
|
|
20525
20607
|
});
|
|
20526
|
-
const extractValue = (options) => {
|
|
20527
|
-
switch (options.extractFrom) {
|
|
20528
|
-
case "url":
|
|
20529
|
-
return extractFromUrl(options);
|
|
20530
|
-
case "localStorage":
|
|
20531
|
-
case "sessionStorage":
|
|
20532
|
-
return extractFromStorage(options);
|
|
20533
|
-
case "htmlElementText":
|
|
20534
|
-
return extractFromHtmlElementText(options);
|
|
20535
|
-
default:
|
|
20536
|
-
return options.default;
|
|
20537
|
-
}
|
|
20538
|
-
};
|
|
20539
|
-
const extractFromUrl = (options) => {
|
|
20540
|
-
const regex = new RegExp(options.regex);
|
|
20541
|
-
const match = window.location.href.match(regex);
|
|
20542
|
-
return match ? match[1] : options.default;
|
|
20543
|
-
};
|
|
20544
|
-
const extractFromStorage = (options) => {
|
|
20545
|
-
const storage = options.extractFrom === "localStorage" ? localStorage : sessionStorage;
|
|
20546
|
-
let rawValue2 = "";
|
|
20547
|
-
try {
|
|
20548
|
-
rawValue2 = storage.getItem(options.key);
|
|
20549
|
-
} catch (e2) {
|
|
20550
|
-
return options.default;
|
|
20551
|
-
}
|
|
20552
|
-
if (rawValue2) {
|
|
20553
|
-
try {
|
|
20554
|
-
const parsedValue = JSON.parse(rawValue2);
|
|
20555
|
-
return options.path ? getValueFromPath(parsedValue, options.path) : parsedValue;
|
|
20556
|
-
} catch (e2) {
|
|
20557
|
-
return rawValue2;
|
|
20558
|
-
}
|
|
20559
|
-
}
|
|
20560
|
-
return options.default;
|
|
20561
|
-
};
|
|
20562
|
-
const extractFromHtmlElementText = (options) => {
|
|
20563
|
-
var _a;
|
|
20564
|
-
const element = document.querySelector(options.querySelector);
|
|
20565
|
-
return element ? ((_a = element.textContent) == null ? void 0 : _a.trim()) || options.default : options.default;
|
|
20566
|
-
};
|
|
20567
|
-
const getValueFromPath = (obj, path) => {
|
|
20568
|
-
return path.split(".").reduce((value, key) => value && value[key] || null, obj);
|
|
20569
|
-
};
|
|
20570
|
-
const processExtractionObject = (value = {}) => {
|
|
20571
|
-
var _a;
|
|
20572
|
-
const parsedObject = {};
|
|
20573
|
-
for (const key in value) {
|
|
20574
|
-
if (isObject$1(value[key]) && ((_a = value[key]) == null ? void 0 : _a.extractFrom)) {
|
|
20575
|
-
parsedObject[key] = extractValue(value[key]);
|
|
20576
|
-
} else {
|
|
20577
|
-
parsedObject[key] = value[key];
|
|
20578
|
-
}
|
|
20579
|
-
}
|
|
20580
|
-
return parsedObject;
|
|
20581
|
-
};
|
|
20582
20608
|
const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
|
|
20583
20609
|
__name: "ProductList",
|
|
20584
20610
|
props: {
|
|
@@ -20598,7 +20624,7 @@ const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
|
|
|
20598
20624
|
var _a;
|
|
20599
20625
|
(_a = searchResults.value) == null ? void 0 : _a.handleMounted();
|
|
20600
20626
|
};
|
|
20601
|
-
vue.computed(() => {
|
|
20627
|
+
const initialFilters = vue.computed(() => {
|
|
20602
20628
|
return __spreadValues({}, processExtractionObject(props.options.initialFilters));
|
|
20603
20629
|
});
|
|
20604
20630
|
__expose({ fetch: fetch2 });
|
|
@@ -20606,7 +20632,7 @@ const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
|
|
|
20606
20632
|
return vue.openBlock(), vue.createElementBlock("div", null, [
|
|
20607
20633
|
vue.createVNode(_sfc_main$e, {
|
|
20608
20634
|
options: componentOptions.value,
|
|
20609
|
-
"initial-filters":
|
|
20635
|
+
"initial-filters": initialFilters.value,
|
|
20610
20636
|
"is-product-list": true,
|
|
20611
20637
|
ref_key: "searchResults",
|
|
20612
20638
|
ref: searchResults
|
package/dist/lupaSearch.mjs
CHANGED
|
@@ -14468,6 +14468,74 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
|
|
|
14468
14468
|
};
|
|
14469
14469
|
}
|
|
14470
14470
|
});
|
|
14471
|
+
const extractValue = (options) => {
|
|
14472
|
+
switch (options.extractFrom) {
|
|
14473
|
+
case "url":
|
|
14474
|
+
return extractFromUrl(options);
|
|
14475
|
+
case "localStorage":
|
|
14476
|
+
case "sessionStorage":
|
|
14477
|
+
return extractFromStorage(options);
|
|
14478
|
+
case "htmlElementText":
|
|
14479
|
+
return extractFromHtmlElementText(options);
|
|
14480
|
+
case "cookie":
|
|
14481
|
+
return extractFromCookie(options);
|
|
14482
|
+
default:
|
|
14483
|
+
return options.default;
|
|
14484
|
+
}
|
|
14485
|
+
};
|
|
14486
|
+
const extractFromCookie = (options) => {
|
|
14487
|
+
var _a, _b;
|
|
14488
|
+
try {
|
|
14489
|
+
const cookieValue = (_b = (_a = document.cookie) == null ? void 0 : _a.split("; ")) == null ? void 0 : _b.find((row) => row == null ? void 0 : row.startsWith(`${options.cookieName}=`));
|
|
14490
|
+
return cookieValue ? cookieValue.split("=")[1] : options.default;
|
|
14491
|
+
} catch (e2) {
|
|
14492
|
+
return options.default;
|
|
14493
|
+
}
|
|
14494
|
+
};
|
|
14495
|
+
const extractFromUrl = (options) => {
|
|
14496
|
+
const regex = new RegExp(options.regex);
|
|
14497
|
+
const match = window.location.href.match(regex);
|
|
14498
|
+
return match ? match[1] : options.default;
|
|
14499
|
+
};
|
|
14500
|
+
const extractFromStorage = (options) => {
|
|
14501
|
+
const storage = options.extractFrom === "localStorage" ? localStorage : sessionStorage;
|
|
14502
|
+
let rawValue2 = "";
|
|
14503
|
+
try {
|
|
14504
|
+
rawValue2 = storage.getItem(options.key);
|
|
14505
|
+
} catch (e2) {
|
|
14506
|
+
return options.default;
|
|
14507
|
+
}
|
|
14508
|
+
if (rawValue2) {
|
|
14509
|
+
try {
|
|
14510
|
+
const parsedValue = JSON.parse(rawValue2);
|
|
14511
|
+
return options.path ? getValueFromPath(parsedValue, options.path) : parsedValue;
|
|
14512
|
+
} catch (e2) {
|
|
14513
|
+
return rawValue2;
|
|
14514
|
+
}
|
|
14515
|
+
}
|
|
14516
|
+
return options.default;
|
|
14517
|
+
};
|
|
14518
|
+
const extractFromHtmlElementText = (options) => {
|
|
14519
|
+
var _a;
|
|
14520
|
+
const element = document.querySelector(options.querySelector);
|
|
14521
|
+
return element ? ((_a = element.textContent) == null ? void 0 : _a.trim()) || options.default : options.default;
|
|
14522
|
+
};
|
|
14523
|
+
const getValueFromPath = (obj, path) => {
|
|
14524
|
+
return path.split(".").reduce((value, key) => value && value[key] || null, obj);
|
|
14525
|
+
};
|
|
14526
|
+
const processExtractionObject = (value = {}) => {
|
|
14527
|
+
var _a;
|
|
14528
|
+
const parsedObject = {};
|
|
14529
|
+
for (const key in value) {
|
|
14530
|
+
if (isObject$1(value[key]) && ((_a = value[key]) == null ? void 0 : _a.extractFrom)) {
|
|
14531
|
+
const extractedValue = extractValue(value[key]);
|
|
14532
|
+
parsedObject[key] = Array.isArray(extractedValue) ? extractedValue : [extractedValue];
|
|
14533
|
+
} else {
|
|
14534
|
+
parsedObject[key] = value[key];
|
|
14535
|
+
}
|
|
14536
|
+
}
|
|
14537
|
+
return parsedObject;
|
|
14538
|
+
};
|
|
14471
14539
|
const _sfc_main$11 = /* @__PURE__ */ defineComponent({
|
|
14472
14540
|
__name: "SearchBoxProductsWrapper",
|
|
14473
14541
|
props: {
|
|
@@ -14491,6 +14559,9 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
|
|
|
14491
14559
|
const showGoToResultsButton = computed(() => {
|
|
14492
14560
|
return props.panel.showGoToResults;
|
|
14493
14561
|
});
|
|
14562
|
+
const extractedInitialFilters = computed(() => {
|
|
14563
|
+
return __spreadValues({}, processExtractionObject(props.searchBoxOptions.initialFilters));
|
|
14564
|
+
});
|
|
14494
14565
|
const inputValueProp = computed(() => props.inputValue);
|
|
14495
14566
|
onMounted(() => {
|
|
14496
14567
|
getItemsDebounced();
|
|
@@ -14508,7 +14579,11 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
|
|
|
14508
14579
|
const getItems = () => {
|
|
14509
14580
|
searchBoxStore.queryDocuments({
|
|
14510
14581
|
queryKey: props.panel.queryKey,
|
|
14511
|
-
publicQuery: {
|
|
14582
|
+
publicQuery: {
|
|
14583
|
+
searchText: props.inputValue,
|
|
14584
|
+
limit: props.panel.limit,
|
|
14585
|
+
filters: extractedInitialFilters.value
|
|
14586
|
+
},
|
|
14512
14587
|
options: props.options
|
|
14513
14588
|
}).then(({ result: result2 }) => {
|
|
14514
14589
|
if (!(result2 == null ? void 0 : result2.items.length)) {
|
|
@@ -14937,6 +15012,9 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent({
|
|
|
14937
15012
|
const focused = ref(false);
|
|
14938
15013
|
const searchBoxInput = ref(null);
|
|
14939
15014
|
const { highlightedDocument } = storeToRefs(searchBoxStore);
|
|
15015
|
+
computed(() => {
|
|
15016
|
+
return __spreadValues({}, processExtractionObject(props.options.initialFilters));
|
|
15017
|
+
});
|
|
14940
15018
|
const searchValue = computed(() => {
|
|
14941
15019
|
return suggestedValue.value.override ? suggestedValue.value.item.suggestion : inputValue.value;
|
|
14942
15020
|
});
|
|
@@ -14962,7 +15040,8 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent({
|
|
|
14962
15040
|
"hideMoreResultsButtonOnNoResults",
|
|
14963
15041
|
"showNoResultsPanel",
|
|
14964
15042
|
"expandOnSinglePanel",
|
|
14965
|
-
"showMoreResultsButton"
|
|
15043
|
+
"showMoreResultsButton",
|
|
15044
|
+
"initialFilters"
|
|
14966
15045
|
])
|
|
14967
15046
|
);
|
|
14968
15047
|
const searchTriggers = computed(() => {
|
|
@@ -20213,9 +20292,12 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
20213
20292
|
const dynamicDataStore = useDynamicDataStore();
|
|
20214
20293
|
const screenStore = useScreenStore();
|
|
20215
20294
|
const redirectionStore = useRedirectionStore();
|
|
20295
|
+
const extractedInitialFilters = computed(() => {
|
|
20296
|
+
return __spreadValues({}, processExtractionObject(props.options.initialFilters));
|
|
20297
|
+
});
|
|
20216
20298
|
const initialFilters = computed(() => {
|
|
20217
|
-
var _a;
|
|
20218
|
-
return (_a = props.initialFilters) != null ? _a : {};
|
|
20299
|
+
var _a, _b;
|
|
20300
|
+
return (_b = (_a = props.initialFilters) != null ? _a : extractedInitialFilters.value) != null ? _b : {};
|
|
20219
20301
|
});
|
|
20220
20302
|
const { currentQueryText, hasResults, currentFilterCount } = storeToRefs(searchResultStore);
|
|
20221
20303
|
const { searchString, sortParams } = storeToRefs(paramStore);
|
|
@@ -20521,62 +20603,6 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
20521
20603
|
};
|
|
20522
20604
|
}
|
|
20523
20605
|
});
|
|
20524
|
-
const extractValue = (options) => {
|
|
20525
|
-
switch (options.extractFrom) {
|
|
20526
|
-
case "url":
|
|
20527
|
-
return extractFromUrl(options);
|
|
20528
|
-
case "localStorage":
|
|
20529
|
-
case "sessionStorage":
|
|
20530
|
-
return extractFromStorage(options);
|
|
20531
|
-
case "htmlElementText":
|
|
20532
|
-
return extractFromHtmlElementText(options);
|
|
20533
|
-
default:
|
|
20534
|
-
return options.default;
|
|
20535
|
-
}
|
|
20536
|
-
};
|
|
20537
|
-
const extractFromUrl = (options) => {
|
|
20538
|
-
const regex = new RegExp(options.regex);
|
|
20539
|
-
const match = window.location.href.match(regex);
|
|
20540
|
-
return match ? match[1] : options.default;
|
|
20541
|
-
};
|
|
20542
|
-
const extractFromStorage = (options) => {
|
|
20543
|
-
const storage = options.extractFrom === "localStorage" ? localStorage : sessionStorage;
|
|
20544
|
-
let rawValue2 = "";
|
|
20545
|
-
try {
|
|
20546
|
-
rawValue2 = storage.getItem(options.key);
|
|
20547
|
-
} catch (e2) {
|
|
20548
|
-
return options.default;
|
|
20549
|
-
}
|
|
20550
|
-
if (rawValue2) {
|
|
20551
|
-
try {
|
|
20552
|
-
const parsedValue = JSON.parse(rawValue2);
|
|
20553
|
-
return options.path ? getValueFromPath(parsedValue, options.path) : parsedValue;
|
|
20554
|
-
} catch (e2) {
|
|
20555
|
-
return rawValue2;
|
|
20556
|
-
}
|
|
20557
|
-
}
|
|
20558
|
-
return options.default;
|
|
20559
|
-
};
|
|
20560
|
-
const extractFromHtmlElementText = (options) => {
|
|
20561
|
-
var _a;
|
|
20562
|
-
const element = document.querySelector(options.querySelector);
|
|
20563
|
-
return element ? ((_a = element.textContent) == null ? void 0 : _a.trim()) || options.default : options.default;
|
|
20564
|
-
};
|
|
20565
|
-
const getValueFromPath = (obj, path) => {
|
|
20566
|
-
return path.split(".").reduce((value, key) => value && value[key] || null, obj);
|
|
20567
|
-
};
|
|
20568
|
-
const processExtractionObject = (value = {}) => {
|
|
20569
|
-
var _a;
|
|
20570
|
-
const parsedObject = {};
|
|
20571
|
-
for (const key in value) {
|
|
20572
|
-
if (isObject$1(value[key]) && ((_a = value[key]) == null ? void 0 : _a.extractFrom)) {
|
|
20573
|
-
parsedObject[key] = extractValue(value[key]);
|
|
20574
|
-
} else {
|
|
20575
|
-
parsedObject[key] = value[key];
|
|
20576
|
-
}
|
|
20577
|
-
}
|
|
20578
|
-
return parsedObject;
|
|
20579
|
-
};
|
|
20580
20606
|
const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
20581
20607
|
__name: "ProductList",
|
|
20582
20608
|
props: {
|
|
@@ -20596,7 +20622,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
20596
20622
|
var _a;
|
|
20597
20623
|
(_a = searchResults.value) == null ? void 0 : _a.handleMounted();
|
|
20598
20624
|
};
|
|
20599
|
-
computed(() => {
|
|
20625
|
+
const initialFilters = computed(() => {
|
|
20600
20626
|
return __spreadValues({}, processExtractionObject(props.options.initialFilters));
|
|
20601
20627
|
});
|
|
20602
20628
|
__expose({ fetch: fetch2 });
|
|
@@ -20604,7 +20630,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
20604
20630
|
return openBlock(), createElementBlock("div", null, [
|
|
20605
20631
|
createVNode(_sfc_main$e, {
|
|
20606
20632
|
options: componentOptions.value,
|
|
20607
|
-
"initial-filters":
|
|
20633
|
+
"initial-filters": initialFilters.value,
|
|
20608
20634
|
"is-product-list": true,
|
|
20609
20635
|
ref_key: "searchResults",
|
|
20610
20636
|
ref: searchResults
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type ExtractFrom = 'url' | 'localStorage' | 'sessionStorage' | 'htmlElementText';
|
|
1
|
+
export type ExtractFrom = 'url' | 'localStorage' | 'sessionStorage' | 'htmlElementText' | 'cookie';
|
|
2
2
|
export type BaseExtractFrom = {
|
|
3
3
|
extractFrom: ExtractFrom;
|
|
4
4
|
default: string | number | Record<string, unknown>;
|
|
@@ -16,4 +16,8 @@ export type ExtractFromHtmlElementText = BaseExtractFrom & {
|
|
|
16
16
|
extractFrom: 'htmlElementText';
|
|
17
17
|
querySelector: string;
|
|
18
18
|
};
|
|
19
|
-
export type
|
|
19
|
+
export type ExtractFromCookie = BaseExtractFrom & {
|
|
20
|
+
extractFrom: 'cookie';
|
|
21
|
+
cookieName: string;
|
|
22
|
+
};
|
|
23
|
+
export type DataExtraction = ExtractFromUrl | ExtractFromStorage | ExtractFromHtmlElementText | ExtractFromCookie;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SearchQueryResult } from '@getlupa/client-sdk/Types';
|
|
1
|
+
import { FilterGroup, SearchQueryResult } from '@getlupa/client-sdk/Types';
|
|
2
2
|
import type { LupaQueryParamValue, SdkOptions } from '../General';
|
|
3
3
|
import type { RoutingBehavior } from '../search-results/RoutingBehavior';
|
|
4
4
|
import type { DynamicData } from '../search-results/SearchResultsOptions';
|
|
@@ -7,6 +7,7 @@ import type { SearchBoxPanel } from './SearchBoxPanel';
|
|
|
7
7
|
import { DisplaySuggestion } from './Common';
|
|
8
8
|
import { QueryParams } from '../search-results/QueryParams';
|
|
9
9
|
import { RedirectionOptions } from '../redirections/RedirectionOptions';
|
|
10
|
+
import { DataExtraction } from '../DataExtraction';
|
|
10
11
|
export type SearchBoxOptions = SearchBoxPanelOptions & {
|
|
11
12
|
inputSelector: string;
|
|
12
13
|
searchTriggers?: string[];
|
|
@@ -69,4 +70,5 @@ export type SearchBoxPanelOptions = SearchBoxInputOptions & {
|
|
|
69
70
|
showMoreResultsButton?: boolean;
|
|
70
71
|
expandOnSinglePanel?: boolean;
|
|
71
72
|
forceFullReloadOnParams?: string[];
|
|
73
|
+
initialFilters?: FilterGroup | Record<string, DataExtraction>;
|
|
72
74
|
};
|
|
@@ -6,6 +6,8 @@ import type { SearchResultsSortOptions } from './SearchResultsSort';
|
|
|
6
6
|
import { RedirectionOptions } from '../redirections/RedirectionOptions';
|
|
7
7
|
import { RelatedQueryOptions } from './RelatedQueryOptions';
|
|
8
8
|
import { RedirectionSuggestionOptions } from './RedirectionSuggestionOptionts';
|
|
9
|
+
import { FilterGroup } from '@getlupa/client-sdk/Types';
|
|
10
|
+
import { DataExtraction } from '../DataExtraction';
|
|
9
11
|
export type SearchResultsOptions = SearchResultsProductOptions & SearchResultsAdditionalPanels & {
|
|
10
12
|
containerSelector: string;
|
|
11
13
|
breadcrumbs: SearchResultsBreadcrumb[];
|
|
@@ -17,6 +19,7 @@ export type SearchResultsOptions = SearchResultsProductOptions & SearchResultsAd
|
|
|
17
19
|
ssr?: SsrOptions;
|
|
18
20
|
redirections?: RedirectionOptions;
|
|
19
21
|
scrollToResults?: ScrollToResultsOptions;
|
|
22
|
+
initialFilters?: FilterGroup | Record<string, DataExtraction>;
|
|
20
23
|
};
|
|
21
24
|
export type ScrollToResultsOptions = {
|
|
22
25
|
enabled?: boolean;
|