@getlupa/client 1.15.10 → 1.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.iife.js +168 -126
- package/dist/lupaSearch.js +168 -126
- package/dist/lupaSearch.mjs +168 -126
- package/dist/lupaSearch.umd.js +168 -126
- package/dist/src/index.d.ts +2 -1
- package/dist/src/modules/pluginManager/PluginConfigurationManager.d.ts +2 -1
- package/dist/src/types/OptionOverrides.d.ts +7 -0
- package/dist/src/utils/merger.utils.d.ts +1 -0
- package/package.json +2 -2
package/dist/lupaSearch.mjs
CHANGED
|
@@ -69,9 +69,9 @@ const isDate = (val) => toTypeString(val) === "[object Date]";
|
|
|
69
69
|
const isFunction$1 = (val) => typeof val === "function";
|
|
70
70
|
const isString = (val) => typeof val === "string";
|
|
71
71
|
const isSymbol = (val) => typeof val === "symbol";
|
|
72
|
-
const isObject$
|
|
72
|
+
const isObject$3 = (val) => val !== null && typeof val === "object";
|
|
73
73
|
const isPromise$1 = (val) => {
|
|
74
|
-
return isObject$
|
|
74
|
+
return isObject$3(val) && isFunction$1(val.then) && isFunction$1(val.catch);
|
|
75
75
|
};
|
|
76
76
|
const objectToString$1 = Object.prototype.toString;
|
|
77
77
|
const toTypeString = (value) => objectToString$1.call(value);
|
|
@@ -145,7 +145,7 @@ function normalizeStyle(value) {
|
|
|
145
145
|
return res;
|
|
146
146
|
} else if (isString(value)) {
|
|
147
147
|
return value;
|
|
148
|
-
} else if (isObject$
|
|
148
|
+
} else if (isObject$3(value)) {
|
|
149
149
|
return value;
|
|
150
150
|
}
|
|
151
151
|
}
|
|
@@ -173,7 +173,7 @@ function normalizeClass(value) {
|
|
|
173
173
|
res += normalized + " ";
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
|
-
} else if (isObject$
|
|
176
|
+
} else if (isObject$3(value)) {
|
|
177
177
|
for (const name in value) {
|
|
178
178
|
if (value[name]) {
|
|
179
179
|
res += name + " ";
|
|
@@ -226,8 +226,8 @@ function looseEqual(a, b) {
|
|
|
226
226
|
if (aValidType || bValidType) {
|
|
227
227
|
return aValidType && bValidType ? looseCompareArrays(a, b) : false;
|
|
228
228
|
}
|
|
229
|
-
aValidType = isObject$
|
|
230
|
-
bValidType = isObject$
|
|
229
|
+
aValidType = isObject$3(a);
|
|
230
|
+
bValidType = isObject$3(b);
|
|
231
231
|
if (aValidType || bValidType) {
|
|
232
232
|
if (!aValidType || !bValidType) {
|
|
233
233
|
return false;
|
|
@@ -251,7 +251,7 @@ function looseIndexOf(arr, val) {
|
|
|
251
251
|
return arr.findIndex((item) => looseEqual(item, val));
|
|
252
252
|
}
|
|
253
253
|
const toDisplayString = (val) => {
|
|
254
|
-
return isString(val) ? val : val == null ? "" : isArray$1(val) || isObject$
|
|
254
|
+
return isString(val) ? val : val == null ? "" : isArray$1(val) || isObject$3(val) && (val.toString === objectToString$1 || !isFunction$1(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val);
|
|
255
255
|
};
|
|
256
256
|
const replacer = (_key, val) => {
|
|
257
257
|
if (val && val.__v_isRef) {
|
|
@@ -267,7 +267,7 @@ const replacer = (_key, val) => {
|
|
|
267
267
|
return {
|
|
268
268
|
[`Set(${val.size})`]: [...val.values()]
|
|
269
269
|
};
|
|
270
|
-
} else if (isObject$
|
|
270
|
+
} else if (isObject$3(val) && !isArray$1(val) && !isPlainObject$4(val)) {
|
|
271
271
|
return String(val);
|
|
272
272
|
}
|
|
273
273
|
return val;
|
|
@@ -660,7 +660,7 @@ function createGetter(isReadonly2 = false, shallow = false) {
|
|
|
660
660
|
if (isRef(res)) {
|
|
661
661
|
return targetIsArray && isIntegerKey(key) ? res : res.value;
|
|
662
662
|
}
|
|
663
|
-
if (isObject$
|
|
663
|
+
if (isObject$3(res)) {
|
|
664
664
|
return isReadonly2 ? readonly(res) : reactive(res);
|
|
665
665
|
}
|
|
666
666
|
return res;
|
|
@@ -1054,7 +1054,7 @@ function readonly(target) {
|
|
|
1054
1054
|
);
|
|
1055
1055
|
}
|
|
1056
1056
|
function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
|
|
1057
|
-
if (!isObject$
|
|
1057
|
+
if (!isObject$3(target)) {
|
|
1058
1058
|
return target;
|
|
1059
1059
|
}
|
|
1060
1060
|
if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
|
|
@@ -1098,8 +1098,8 @@ function markRaw(value) {
|
|
|
1098
1098
|
def(value, "__v_skip", true);
|
|
1099
1099
|
return value;
|
|
1100
1100
|
}
|
|
1101
|
-
const toReactive = (value) => isObject$
|
|
1102
|
-
const toReadonly = (value) => isObject$
|
|
1101
|
+
const toReactive = (value) => isObject$3(value) ? reactive(value) : value;
|
|
1102
|
+
const toReadonly = (value) => isObject$3(value) ? readonly(value) : value;
|
|
1103
1103
|
function trackRefValue(ref2) {
|
|
1104
1104
|
if (shouldTrack && activeEffect) {
|
|
1105
1105
|
ref2 = toRaw(ref2);
|
|
@@ -1209,7 +1209,7 @@ function toRef(source, key, defaultValue) {
|
|
|
1209
1209
|
return source;
|
|
1210
1210
|
} else if (isFunction$1(source)) {
|
|
1211
1211
|
return new GetterRefImpl(source);
|
|
1212
|
-
} else if (isObject$
|
|
1212
|
+
} else if (isObject$3(source) && arguments.length > 1) {
|
|
1213
1213
|
return propertyToRef(source, key, defaultValue);
|
|
1214
1214
|
} else {
|
|
1215
1215
|
return ref(source);
|
|
@@ -1529,7 +1529,7 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
|
1529
1529
|
}
|
|
1530
1530
|
}
|
|
1531
1531
|
if (!raw && !hasExtends) {
|
|
1532
|
-
if (isObject$
|
|
1532
|
+
if (isObject$3(comp)) {
|
|
1533
1533
|
cache.set(comp, null);
|
|
1534
1534
|
}
|
|
1535
1535
|
return null;
|
|
@@ -1539,7 +1539,7 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
|
1539
1539
|
} else {
|
|
1540
1540
|
extend(normalized, raw);
|
|
1541
1541
|
}
|
|
1542
|
-
if (isObject$
|
|
1542
|
+
if (isObject$3(comp)) {
|
|
1543
1543
|
cache.set(comp, normalized);
|
|
1544
1544
|
}
|
|
1545
1545
|
return normalized;
|
|
@@ -1947,7 +1947,7 @@ function createPathGetter(ctx, path) {
|
|
|
1947
1947
|
};
|
|
1948
1948
|
}
|
|
1949
1949
|
function traverse(value, seen) {
|
|
1950
|
-
if (!isObject$
|
|
1950
|
+
if (!isObject$3(value) || value["__v_skip"]) {
|
|
1951
1951
|
return value;
|
|
1952
1952
|
}
|
|
1953
1953
|
seen = seen || /* @__PURE__ */ new Set();
|
|
@@ -2482,7 +2482,7 @@ function renderList(source, renderItem, cache, index) {
|
|
|
2482
2482
|
for (let i = 0; i < source; i++) {
|
|
2483
2483
|
ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
|
|
2484
2484
|
}
|
|
2485
|
-
} else if (isObject$
|
|
2485
|
+
} else if (isObject$3(source)) {
|
|
2486
2486
|
if (source[Symbol.iterator]) {
|
|
2487
2487
|
ret = Array.from(
|
|
2488
2488
|
source,
|
|
@@ -2759,7 +2759,7 @@ function applyOptions(instance) {
|
|
|
2759
2759
|
}
|
|
2760
2760
|
if (dataOptions) {
|
|
2761
2761
|
const data = dataOptions.call(publicThis, publicThis);
|
|
2762
|
-
if (!isObject$
|
|
2762
|
+
if (!isObject$3(data))
|
|
2763
2763
|
;
|
|
2764
2764
|
else {
|
|
2765
2765
|
instance.data = reactive(data);
|
|
@@ -2847,7 +2847,7 @@ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP)
|
|
|
2847
2847
|
for (const key in injectOptions) {
|
|
2848
2848
|
const opt = injectOptions[key];
|
|
2849
2849
|
let injected;
|
|
2850
|
-
if (isObject$
|
|
2850
|
+
if (isObject$3(opt)) {
|
|
2851
2851
|
if ("default" in opt) {
|
|
2852
2852
|
injected = inject(
|
|
2853
2853
|
opt.from || key,
|
|
@@ -2889,7 +2889,7 @@ function createWatcher(raw, ctx, publicThis, key) {
|
|
|
2889
2889
|
}
|
|
2890
2890
|
} else if (isFunction$1(raw)) {
|
|
2891
2891
|
watch(getter, raw.bind(publicThis));
|
|
2892
|
-
} else if (isObject$
|
|
2892
|
+
} else if (isObject$3(raw)) {
|
|
2893
2893
|
if (isArray$1(raw)) {
|
|
2894
2894
|
raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
|
|
2895
2895
|
} else {
|
|
@@ -2926,7 +2926,7 @@ function resolveMergedOptions(instance) {
|
|
|
2926
2926
|
}
|
|
2927
2927
|
mergeOptions(resolved, base, optionMergeStrategies);
|
|
2928
2928
|
}
|
|
2929
|
-
if (isObject$
|
|
2929
|
+
if (isObject$3(base)) {
|
|
2930
2930
|
cache.set(base, resolved);
|
|
2931
2931
|
}
|
|
2932
2932
|
return resolved;
|
|
@@ -3067,7 +3067,7 @@ function createAppAPI(render4, hydrate) {
|
|
|
3067
3067
|
if (!isFunction$1(rootComponent)) {
|
|
3068
3068
|
rootComponent = extend({}, rootComponent);
|
|
3069
3069
|
}
|
|
3070
|
-
if (rootProps != null && !isObject$
|
|
3070
|
+
if (rootProps != null && !isObject$3(rootProps)) {
|
|
3071
3071
|
rootProps = null;
|
|
3072
3072
|
}
|
|
3073
3073
|
const context = createAppContext();
|
|
@@ -3411,7 +3411,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
3411
3411
|
}
|
|
3412
3412
|
}
|
|
3413
3413
|
if (!raw && !hasExtends) {
|
|
3414
|
-
if (isObject$
|
|
3414
|
+
if (isObject$3(comp)) {
|
|
3415
3415
|
cache.set(comp, EMPTY_ARR);
|
|
3416
3416
|
}
|
|
3417
3417
|
return EMPTY_ARR;
|
|
@@ -3448,7 +3448,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
3448
3448
|
}
|
|
3449
3449
|
}
|
|
3450
3450
|
const res = [normalized, needCastKeys];
|
|
3451
|
-
if (isObject$
|
|
3451
|
+
if (isObject$3(comp)) {
|
|
3452
3452
|
cache.set(comp, res);
|
|
3453
3453
|
}
|
|
3454
3454
|
return res;
|
|
@@ -5112,14 +5112,14 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
|
|
|
5112
5112
|
if (klass && !isString(klass)) {
|
|
5113
5113
|
props.class = normalizeClass(klass);
|
|
5114
5114
|
}
|
|
5115
|
-
if (isObject$
|
|
5115
|
+
if (isObject$3(style)) {
|
|
5116
5116
|
if (isProxy(style) && !isArray$1(style)) {
|
|
5117
5117
|
style = extend({}, style);
|
|
5118
5118
|
}
|
|
5119
5119
|
props.style = normalizeStyle(style);
|
|
5120
5120
|
}
|
|
5121
5121
|
}
|
|
5122
|
-
const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject$
|
|
5122
|
+
const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject$3(type) ? 4 : isFunction$1(type) ? 2 : 0;
|
|
5123
5123
|
return createBaseVNode(
|
|
5124
5124
|
type,
|
|
5125
5125
|
props,
|
|
@@ -5456,7 +5456,7 @@ function handleSetupResult(instance, setupResult, isSSR) {
|
|
|
5456
5456
|
} else {
|
|
5457
5457
|
instance.render = setupResult;
|
|
5458
5458
|
}
|
|
5459
|
-
} else if (isObject$
|
|
5459
|
+
} else if (isObject$3(setupResult)) {
|
|
5460
5460
|
instance.setupState = proxyRefs(setupResult);
|
|
5461
5461
|
} else
|
|
5462
5462
|
;
|
|
@@ -5548,7 +5548,7 @@ const computed = (getterOrOptions, debugOptions) => {
|
|
|
5548
5548
|
function h$1(type, propsOrChildren, children) {
|
|
5549
5549
|
const l = arguments.length;
|
|
5550
5550
|
if (l === 2) {
|
|
5551
|
-
if (isObject$
|
|
5551
|
+
if (isObject$3(propsOrChildren) && !isArray$1(propsOrChildren)) {
|
|
5552
5552
|
if (isVNode(propsOrChildren)) {
|
|
5553
5553
|
return createVNode(type, null, [propsOrChildren]);
|
|
5554
5554
|
}
|
|
@@ -6054,7 +6054,7 @@ function resolveTransitionProps(rawProps) {
|
|
|
6054
6054
|
function normalizeDuration(duration) {
|
|
6055
6055
|
if (duration == null) {
|
|
6056
6056
|
return null;
|
|
6057
|
-
} else if (isObject$
|
|
6057
|
+
} else if (isObject$3(duration)) {
|
|
6058
6058
|
return [NumberOf(duration.enter), NumberOf(duration.leave)];
|
|
6059
6059
|
} else {
|
|
6060
6060
|
const n = NumberOf(duration);
|
|
@@ -12900,18 +12900,18 @@ Object.defineProperty(isPlainObject$2, "__esModule", { value: true });
|
|
|
12900
12900
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
12901
12901
|
* Released under the MIT License.
|
|
12902
12902
|
*/
|
|
12903
|
-
function isObject(o) {
|
|
12903
|
+
function isObject$2(o) {
|
|
12904
12904
|
return Object.prototype.toString.call(o) === "[object Object]";
|
|
12905
12905
|
}
|
|
12906
12906
|
function isPlainObject$1(o) {
|
|
12907
12907
|
var ctor, prot;
|
|
12908
|
-
if (isObject(o) === false)
|
|
12908
|
+
if (isObject$2(o) === false)
|
|
12909
12909
|
return false;
|
|
12910
12910
|
ctor = o.constructor;
|
|
12911
12911
|
if (ctor === void 0)
|
|
12912
12912
|
return true;
|
|
12913
12913
|
prot = ctor.prototype;
|
|
12914
|
-
if (isObject(prot) === false)
|
|
12914
|
+
if (isObject$2(prot) === false)
|
|
12915
12915
|
return false;
|
|
12916
12916
|
if (prot.hasOwnProperty("isPrototypeOf") === false) {
|
|
12917
12917
|
return false;
|
|
@@ -17697,12 +17697,12 @@ sanitizeHtml.defaults = {
|
|
|
17697
17697
|
enforceHtmlBoundary: false,
|
|
17698
17698
|
parseStyleAttributes: true
|
|
17699
17699
|
};
|
|
17700
|
-
sanitizeHtml.simpleTransform = function(newTagName, newAttribs,
|
|
17701
|
-
|
|
17700
|
+
sanitizeHtml.simpleTransform = function(newTagName, newAttribs, merge2) {
|
|
17701
|
+
merge2 = merge2 === void 0 ? true : merge2;
|
|
17702
17702
|
newAttribs = newAttribs || {};
|
|
17703
17703
|
return function(tagName, attribs) {
|
|
17704
17704
|
let attrib;
|
|
17705
|
-
if (
|
|
17705
|
+
if (merge2) {
|
|
17706
17706
|
for (attrib in newAttribs) {
|
|
17707
17707
|
attribs[attrib] = newAttribs[attrib];
|
|
17708
17708
|
}
|
|
@@ -19700,6 +19700,74 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
|
|
|
19700
19700
|
};
|
|
19701
19701
|
}
|
|
19702
19702
|
});
|
|
19703
|
+
const extractValue = (options) => {
|
|
19704
|
+
switch (options.extractFrom) {
|
|
19705
|
+
case "url":
|
|
19706
|
+
return extractFromUrl(options);
|
|
19707
|
+
case "localStorage":
|
|
19708
|
+
case "sessionStorage":
|
|
19709
|
+
return extractFromStorage(options);
|
|
19710
|
+
case "htmlElementText":
|
|
19711
|
+
return extractFromHtmlElementText(options);
|
|
19712
|
+
case "cookie":
|
|
19713
|
+
return extractFromCookie(options);
|
|
19714
|
+
default:
|
|
19715
|
+
return options.default;
|
|
19716
|
+
}
|
|
19717
|
+
};
|
|
19718
|
+
const extractFromCookie = (options) => {
|
|
19719
|
+
var _a, _b;
|
|
19720
|
+
try {
|
|
19721
|
+
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}=`));
|
|
19722
|
+
return cookieValue ? cookieValue.split("=")[1] : options.default;
|
|
19723
|
+
} catch (e2) {
|
|
19724
|
+
return options.default;
|
|
19725
|
+
}
|
|
19726
|
+
};
|
|
19727
|
+
const extractFromUrl = (options) => {
|
|
19728
|
+
const regex = new RegExp(options.regex);
|
|
19729
|
+
const match = window.location.href.match(regex);
|
|
19730
|
+
return match ? match[1] : options.default;
|
|
19731
|
+
};
|
|
19732
|
+
const extractFromStorage = (options) => {
|
|
19733
|
+
const storage = options.extractFrom === "localStorage" ? localStorage : sessionStorage;
|
|
19734
|
+
let rawValue2 = "";
|
|
19735
|
+
try {
|
|
19736
|
+
rawValue2 = storage.getItem(options.key);
|
|
19737
|
+
} catch (e2) {
|
|
19738
|
+
return options.default;
|
|
19739
|
+
}
|
|
19740
|
+
if (rawValue2) {
|
|
19741
|
+
try {
|
|
19742
|
+
const parsedValue = JSON.parse(rawValue2);
|
|
19743
|
+
return options.path ? getValueFromPath(parsedValue, options.path) : parsedValue;
|
|
19744
|
+
} catch (e2) {
|
|
19745
|
+
return rawValue2;
|
|
19746
|
+
}
|
|
19747
|
+
}
|
|
19748
|
+
return options.default;
|
|
19749
|
+
};
|
|
19750
|
+
const extractFromHtmlElementText = (options) => {
|
|
19751
|
+
var _a;
|
|
19752
|
+
const element = document.querySelector(options.querySelector);
|
|
19753
|
+
return element ? ((_a = element.textContent) == null ? void 0 : _a.trim()) || options.default : options.default;
|
|
19754
|
+
};
|
|
19755
|
+
const getValueFromPath = (obj, path) => {
|
|
19756
|
+
return path.split(".").reduce((value, key) => value && value[key] || null, obj);
|
|
19757
|
+
};
|
|
19758
|
+
const processExtractionObject = (value = {}) => {
|
|
19759
|
+
var _a;
|
|
19760
|
+
const parsedObject = {};
|
|
19761
|
+
for (const key in value) {
|
|
19762
|
+
if (isObject$1(value[key]) && ((_a = value[key]) == null ? void 0 : _a.extractFrom)) {
|
|
19763
|
+
const extractedValue = extractValue(value[key]);
|
|
19764
|
+
parsedObject[key] = Array.isArray(extractedValue) ? extractedValue : [extractedValue];
|
|
19765
|
+
} else {
|
|
19766
|
+
parsedObject[key] = value[key];
|
|
19767
|
+
}
|
|
19768
|
+
}
|
|
19769
|
+
return parsedObject;
|
|
19770
|
+
};
|
|
19703
19771
|
const _sfc_main$11 = /* @__PURE__ */ defineComponent({
|
|
19704
19772
|
__name: "SearchBoxProductsWrapper",
|
|
19705
19773
|
props: {
|
|
@@ -19723,6 +19791,9 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
|
|
|
19723
19791
|
const showGoToResultsButton = computed(() => {
|
|
19724
19792
|
return props.panel.showGoToResults;
|
|
19725
19793
|
});
|
|
19794
|
+
const extractedInitialFilters = computed(() => {
|
|
19795
|
+
return __spreadValues2({}, processExtractionObject(props.searchBoxOptions.initialFilters));
|
|
19796
|
+
});
|
|
19726
19797
|
const inputValueProp = computed(() => props.inputValue);
|
|
19727
19798
|
onMounted(() => {
|
|
19728
19799
|
getItemsDebounced();
|
|
@@ -19740,7 +19811,11 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
|
|
|
19740
19811
|
const getItems = () => {
|
|
19741
19812
|
searchBoxStore.queryDocuments({
|
|
19742
19813
|
queryKey: props.panel.queryKey,
|
|
19743
|
-
publicQuery: {
|
|
19814
|
+
publicQuery: {
|
|
19815
|
+
searchText: props.inputValue,
|
|
19816
|
+
limit: props.panel.limit,
|
|
19817
|
+
filters: extractedInitialFilters.value
|
|
19818
|
+
},
|
|
19744
19819
|
options: props.options
|
|
19745
19820
|
}).then(({ result: result2 }) => {
|
|
19746
19821
|
if (!(result2 == null ? void 0 : result2.items.length)) {
|
|
@@ -20169,6 +20244,9 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent({
|
|
|
20169
20244
|
const focused = ref(false);
|
|
20170
20245
|
const searchBoxInput = ref(null);
|
|
20171
20246
|
const { highlightedDocument } = storeToRefs(searchBoxStore);
|
|
20247
|
+
computed(() => {
|
|
20248
|
+
return __spreadValues2({}, processExtractionObject(props.options.initialFilters));
|
|
20249
|
+
});
|
|
20172
20250
|
const searchValue = computed(() => {
|
|
20173
20251
|
return suggestedValue.value.override ? suggestedValue.value.item.suggestion : inputValue.value;
|
|
20174
20252
|
});
|
|
@@ -20194,7 +20272,8 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent({
|
|
|
20194
20272
|
"hideMoreResultsButtonOnNoResults",
|
|
20195
20273
|
"showNoResultsPanel",
|
|
20196
20274
|
"expandOnSinglePanel",
|
|
20197
|
-
"showMoreResultsButton"
|
|
20275
|
+
"showMoreResultsButton",
|
|
20276
|
+
"initialFilters"
|
|
20198
20277
|
])
|
|
20199
20278
|
);
|
|
20200
20279
|
const searchTriggers = computed(() => {
|
|
@@ -25429,9 +25508,12 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
25429
25508
|
const dynamicDataStore = useDynamicDataStore();
|
|
25430
25509
|
const screenStore = useScreenStore();
|
|
25431
25510
|
const redirectionStore = useRedirectionStore();
|
|
25511
|
+
const extractedInitialFilters = computed(() => {
|
|
25512
|
+
return __spreadValues2({}, processExtractionObject(props.options.initialFilters));
|
|
25513
|
+
});
|
|
25432
25514
|
const initialFilters = computed(() => {
|
|
25433
|
-
var _a;
|
|
25434
|
-
return (_a = props.initialFilters) != null ? _a : {};
|
|
25515
|
+
var _a, _b;
|
|
25516
|
+
return (_b = (_a = props.initialFilters) != null ? _a : extractedInitialFilters.value) != null ? _b : {};
|
|
25435
25517
|
});
|
|
25436
25518
|
const { currentQueryText, hasResults, currentFilterCount } = storeToRefs(searchResultStore);
|
|
25437
25519
|
const { searchString, sortParams } = storeToRefs(paramStore);
|
|
@@ -25737,62 +25819,6 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
25737
25819
|
};
|
|
25738
25820
|
}
|
|
25739
25821
|
});
|
|
25740
|
-
const extractValue = (options) => {
|
|
25741
|
-
switch (options.extractFrom) {
|
|
25742
|
-
case "url":
|
|
25743
|
-
return extractFromUrl(options);
|
|
25744
|
-
case "localStorage":
|
|
25745
|
-
case "sessionStorage":
|
|
25746
|
-
return extractFromStorage(options);
|
|
25747
|
-
case "htmlElementText":
|
|
25748
|
-
return extractFromHtmlElementText(options);
|
|
25749
|
-
default:
|
|
25750
|
-
return options.default;
|
|
25751
|
-
}
|
|
25752
|
-
};
|
|
25753
|
-
const extractFromUrl = (options) => {
|
|
25754
|
-
const regex = new RegExp(options.regex);
|
|
25755
|
-
const match = window.location.href.match(regex);
|
|
25756
|
-
return match ? match[1] : options.default;
|
|
25757
|
-
};
|
|
25758
|
-
const extractFromStorage = (options) => {
|
|
25759
|
-
const storage = options.extractFrom === "localStorage" ? localStorage : sessionStorage;
|
|
25760
|
-
let rawValue2 = "";
|
|
25761
|
-
try {
|
|
25762
|
-
rawValue2 = storage.getItem(options.key);
|
|
25763
|
-
} catch (e2) {
|
|
25764
|
-
return options.default;
|
|
25765
|
-
}
|
|
25766
|
-
if (rawValue2) {
|
|
25767
|
-
try {
|
|
25768
|
-
const parsedValue = JSON.parse(rawValue2);
|
|
25769
|
-
return options.path ? getValueFromPath(parsedValue, options.path) : parsedValue;
|
|
25770
|
-
} catch (e2) {
|
|
25771
|
-
return rawValue2;
|
|
25772
|
-
}
|
|
25773
|
-
}
|
|
25774
|
-
return options.default;
|
|
25775
|
-
};
|
|
25776
|
-
const extractFromHtmlElementText = (options) => {
|
|
25777
|
-
var _a;
|
|
25778
|
-
const element = document.querySelector(options.querySelector);
|
|
25779
|
-
return element ? ((_a = element.textContent) == null ? void 0 : _a.trim()) || options.default : options.default;
|
|
25780
|
-
};
|
|
25781
|
-
const getValueFromPath = (obj, path) => {
|
|
25782
|
-
return path.split(".").reduce((value, key) => value && value[key] || null, obj);
|
|
25783
|
-
};
|
|
25784
|
-
const processExtractionObject = (value = {}) => {
|
|
25785
|
-
var _a;
|
|
25786
|
-
const parsedObject = {};
|
|
25787
|
-
for (const key in value) {
|
|
25788
|
-
if (isObject$1(value[key]) && ((_a = value[key]) == null ? void 0 : _a.extractFrom)) {
|
|
25789
|
-
parsedObject[key] = extractValue(value[key]);
|
|
25790
|
-
} else {
|
|
25791
|
-
parsedObject[key] = value[key];
|
|
25792
|
-
}
|
|
25793
|
-
}
|
|
25794
|
-
return parsedObject;
|
|
25795
|
-
};
|
|
25796
25822
|
const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
25797
25823
|
__name: "ProductList",
|
|
25798
25824
|
props: {
|
|
@@ -25812,7 +25838,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
25812
25838
|
var _a;
|
|
25813
25839
|
(_a = searchResults2.value) == null ? void 0 : _a.handleMounted();
|
|
25814
25840
|
};
|
|
25815
|
-
computed(() => {
|
|
25841
|
+
const initialFilters = computed(() => {
|
|
25816
25842
|
return __spreadValues2({}, processExtractionObject(props.options.initialFilters));
|
|
25817
25843
|
});
|
|
25818
25844
|
__expose({ fetch: fetch2 });
|
|
@@ -25820,7 +25846,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
25820
25846
|
return openBlock(), createElementBlock("div", null, [
|
|
25821
25847
|
createVNode(_sfc_main$e, {
|
|
25822
25848
|
options: componentOptions.value,
|
|
25823
|
-
"initial-filters":
|
|
25849
|
+
"initial-filters": initialFilters.value,
|
|
25824
25850
|
"is-product-list": true,
|
|
25825
25851
|
ref_key: "searchResults",
|
|
25826
25852
|
ref: searchResults2
|
|
@@ -30208,7 +30234,7 @@ lodash$1.exports;
|
|
|
30208
30234
|
});
|
|
30209
30235
|
return result3;
|
|
30210
30236
|
}
|
|
30211
|
-
var
|
|
30237
|
+
var merge2 = createAssigner(function(object, source, srcIndex) {
|
|
30212
30238
|
baseMerge(object, source, srcIndex);
|
|
30213
30239
|
});
|
|
30214
30240
|
var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
|
|
@@ -30898,7 +30924,7 @@ lodash$1.exports;
|
|
|
30898
30924
|
lodash2.matches = matches;
|
|
30899
30925
|
lodash2.matchesProperty = matchesProperty;
|
|
30900
30926
|
lodash2.memoize = memoize;
|
|
30901
|
-
lodash2.merge =
|
|
30927
|
+
lodash2.merge = merge2;
|
|
30902
30928
|
lodash2.mergeWith = mergeWith;
|
|
30903
30929
|
lodash2.method = method;
|
|
30904
30930
|
lodash2.methodOf = methodOf;
|
|
@@ -37734,7 +37760,7 @@ lodash.exports;
|
|
|
37734
37760
|
});
|
|
37735
37761
|
return result3;
|
|
37736
37762
|
}
|
|
37737
|
-
var
|
|
37763
|
+
var merge2 = createAssigner(function(object, source, srcIndex) {
|
|
37738
37764
|
baseMerge(object, source, srcIndex);
|
|
37739
37765
|
});
|
|
37740
37766
|
var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
|
|
@@ -38424,7 +38450,7 @@ lodash.exports;
|
|
|
38424
38450
|
lodash2.matches = matches;
|
|
38425
38451
|
lodash2.matchesProperty = matchesProperty;
|
|
38426
38452
|
lodash2.memoize = memoize;
|
|
38427
|
-
lodash2.merge =
|
|
38453
|
+
lodash2.merge = merge2;
|
|
38428
38454
|
lodash2.mergeWith = mergeWith;
|
|
38429
38455
|
lodash2.method = method;
|
|
38430
38456
|
lodash2.methodOf = methodOf;
|
|
@@ -39581,6 +39607,14 @@ const waitForElementToBeVisible = (element, retries = 0, maxRetries = 30, interv
|
|
|
39581
39607
|
}, interval);
|
|
39582
39608
|
});
|
|
39583
39609
|
});
|
|
39610
|
+
const isObject = (item) => typeof item === "object" && !Array.isArray(item);
|
|
39611
|
+
const merge = (target, source) => {
|
|
39612
|
+
const isDeep = (prop) => isObject(source[prop]) && Object.prototype.hasOwnProperty.call(target, prop) && isObject(target[prop]);
|
|
39613
|
+
const replaced = Object.getOwnPropertyNames(source).map((prop) => ({
|
|
39614
|
+
[prop]: isDeep(prop) ? merge(target[prop], source[prop]) : source[prop]
|
|
39615
|
+
})).reduce((a, b) => __spreadValues(__spreadValues({}, a), b), {});
|
|
39616
|
+
return __spreadValues(__spreadValues({}, target), replaced);
|
|
39617
|
+
};
|
|
39584
39618
|
const saveToLocalStorage = (key, value) => {
|
|
39585
39619
|
try {
|
|
39586
39620
|
localStorage.setItem(key, JSON.stringify(value));
|
|
@@ -39632,7 +39666,7 @@ const getQueryParam = (name) => {
|
|
|
39632
39666
|
const PREVIEW_PARAMETER = "lupaSearchPreview";
|
|
39633
39667
|
const MAX_ELEMENT_MOUNT_RETRIES = 25;
|
|
39634
39668
|
let styleElement = null;
|
|
39635
|
-
const loadAndSaveConfigurationFromServer = (
|
|
39669
|
+
const loadAndSaveConfigurationFromServer = (_0, ..._1) => __async(void 0, [_0, ..._1], function* (configurationKey, options = { environment: "production" }) {
|
|
39636
39670
|
const configuration = yield fetchPluginConfiguration(
|
|
39637
39671
|
options,
|
|
39638
39672
|
configurationKey
|
|
@@ -39657,7 +39691,7 @@ const checkIsPreviewMode = () => {
|
|
|
39657
39691
|
}
|
|
39658
39692
|
return isPreviewMode;
|
|
39659
39693
|
};
|
|
39660
|
-
const loadConfigurations = (configurationKey, isPreviewMode, options) => __async(void 0, null, function* () {
|
|
39694
|
+
const loadConfigurations = (configurationKey, isPreviewMode, options, optionOverrides) => __async(void 0, null, function* () {
|
|
39661
39695
|
if (isPreviewMode) {
|
|
39662
39696
|
return loadAndSaveConfigurationFromServer(configurationKey, options);
|
|
39663
39697
|
}
|
|
@@ -39675,7 +39709,7 @@ const loadConfigurations = (configurationKey, isPreviewMode, options) => __async
|
|
|
39675
39709
|
const isPreviewMode2 = checkIsPreviewMode();
|
|
39676
39710
|
const configuration = isPreviewMode2 ? (_a = newestConfiguration.previewConfiguration) != null ? _a : newestConfiguration.configuration : newestConfiguration.configuration;
|
|
39677
39711
|
if (configuration) {
|
|
39678
|
-
yield mount(configuration, options, false, true);
|
|
39712
|
+
yield mount(configuration, options, optionOverrides, false, true);
|
|
39679
39713
|
} else {
|
|
39680
39714
|
removeFromLocalStorage(configurationKey);
|
|
39681
39715
|
window.location.reload();
|
|
@@ -39706,7 +39740,8 @@ const applyStyles = (configuration) => __async(void 0, null, function* () {
|
|
|
39706
39740
|
}
|
|
39707
39741
|
document.head.appendChild(styleElement);
|
|
39708
39742
|
});
|
|
39709
|
-
const mountSearchBox = (configuration, options, fetch2 = true, remount = false) => __async(void 0, null, function* () {
|
|
39743
|
+
const mountSearchBox = (configuration, options, optionOverrides, fetch2 = true, remount = false) => __async(void 0, null, function* () {
|
|
39744
|
+
var _a;
|
|
39710
39745
|
if (!configuration.searchBox) {
|
|
39711
39746
|
return;
|
|
39712
39747
|
}
|
|
@@ -39723,9 +39758,11 @@ const mountSearchBox = (configuration, options, fetch2 = true, remount = false)
|
|
|
39723
39758
|
);
|
|
39724
39759
|
return;
|
|
39725
39760
|
}
|
|
39726
|
-
|
|
39761
|
+
const mergedOptions = merge(resolvedConfiguration, (_a = optionOverrides == null ? void 0 : optionOverrides.searchBox) != null ? _a : {});
|
|
39762
|
+
searchBox(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
|
|
39727
39763
|
});
|
|
39728
|
-
const mountSearchResults = (configuration, options, fetch2 = true, remount = false) => __async(void 0, null, function* () {
|
|
39764
|
+
const mountSearchResults = (configuration, options, optionOverrides, fetch2 = true, remount = false) => __async(void 0, null, function* () {
|
|
39765
|
+
var _a;
|
|
39729
39766
|
if (!configuration.searchResults) {
|
|
39730
39767
|
return;
|
|
39731
39768
|
}
|
|
@@ -39742,9 +39779,11 @@ const mountSearchResults = (configuration, options, fetch2 = true, remount = fal
|
|
|
39742
39779
|
);
|
|
39743
39780
|
return;
|
|
39744
39781
|
}
|
|
39745
|
-
|
|
39782
|
+
const mergedOptions = merge(resolvedConfiguration, (_a = optionOverrides == null ? void 0 : optionOverrides.searchResults) != null ? _a : {});
|
|
39783
|
+
searchResults(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
|
|
39746
39784
|
});
|
|
39747
|
-
const mountProductList = (configuration, options, fetch2 = true, remount = false) => __async(void 0, null, function* () {
|
|
39785
|
+
const mountProductList = (configuration, options, optionOverrides, fetch2 = true, remount = false) => __async(void 0, null, function* () {
|
|
39786
|
+
var _a;
|
|
39748
39787
|
if (!configuration.productList) {
|
|
39749
39788
|
return;
|
|
39750
39789
|
}
|
|
@@ -39764,12 +39803,14 @@ const mountProductList = (configuration, options, fetch2 = true, remount = false
|
|
|
39764
39803
|
);
|
|
39765
39804
|
return;
|
|
39766
39805
|
}
|
|
39767
|
-
|
|
39768
|
-
|
|
39769
|
-
|
|
39806
|
+
const mergedOptions = merge(
|
|
39807
|
+
__spreadValues(__spreadValues({}, resolvedSearchResultsConfiguration), resolvedConfiguration),
|
|
39808
|
+
(_a = optionOverrides == null ? void 0 : optionOverrides.productList) != null ? _a : {}
|
|
39770
39809
|
);
|
|
39810
|
+
productList(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
|
|
39771
39811
|
});
|
|
39772
|
-
const mountRecommendations = (configuration, options, fetch2 = true, remount = false) => __async(void 0, null, function* () {
|
|
39812
|
+
const mountRecommendations = (configuration, options, optionOverrides, fetch2 = true, remount = false) => __async(void 0, null, function* () {
|
|
39813
|
+
var _a;
|
|
39773
39814
|
if (!configuration.recommendations) {
|
|
39774
39815
|
return;
|
|
39775
39816
|
}
|
|
@@ -39791,10 +39832,11 @@ const mountRecommendations = (configuration, options, fetch2 = true, remount = f
|
|
|
39791
39832
|
);
|
|
39792
39833
|
return;
|
|
39793
39834
|
}
|
|
39794
|
-
|
|
39795
|
-
|
|
39796
|
-
|
|
39835
|
+
const mergedOptions = merge(
|
|
39836
|
+
__spreadValues(__spreadValues({}, resolvedSearchResultsConfiguration), resolvedConfiguration),
|
|
39837
|
+
(_a = optionOverrides == null ? void 0 : optionOverrides.recommendations) != null ? _a : {}
|
|
39797
39838
|
);
|
|
39839
|
+
recommendations(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
|
|
39798
39840
|
});
|
|
39799
39841
|
const mountChat = (configuration, options, fetch2 = true, remount = false) => __async(void 0, null, function* () {
|
|
39800
39842
|
if (!configuration.genAiChat) {
|
|
@@ -39821,24 +39863,24 @@ const mountChat = (configuration, options, fetch2 = true, remount = false) => __
|
|
|
39821
39863
|
{ fetch: fetch2, allowedMountUrls }
|
|
39822
39864
|
);
|
|
39823
39865
|
});
|
|
39824
|
-
const mount = (
|
|
39866
|
+
const mount = (_0, ..._1) => __async(void 0, [_0, ..._1], function* (configuration, options = { environment: "production" }, optionOverrides = {}, fetch2 = true, remount = false) {
|
|
39825
39867
|
yield applyStyles(configuration);
|
|
39826
39868
|
const mountPromises = [
|
|
39827
|
-
mountSearchBox(configuration, options, fetch2, remount),
|
|
39828
|
-
mountSearchResults(configuration, options, fetch2, remount),
|
|
39829
|
-
mountProductList(configuration, options, fetch2, remount),
|
|
39830
|
-
mountRecommendations(configuration, options, fetch2, remount),
|
|
39869
|
+
mountSearchBox(configuration, options, optionOverrides, fetch2, remount),
|
|
39870
|
+
mountSearchResults(configuration, options, optionOverrides, fetch2, remount),
|
|
39871
|
+
mountProductList(configuration, options, optionOverrides, fetch2, remount),
|
|
39872
|
+
mountRecommendations(configuration, options, optionOverrides, fetch2, remount),
|
|
39831
39873
|
mountChat(configuration, options, fetch2, remount)
|
|
39832
39874
|
];
|
|
39833
39875
|
yield Promise.all(mountPromises);
|
|
39834
39876
|
});
|
|
39835
|
-
const init$1 = (
|
|
39877
|
+
const init$1 = (_0, ..._1) => __async(void 0, [_0, ..._1], function* (configurationKey, options = { environment: "production" }, optionOverrides = {}) {
|
|
39836
39878
|
var _a;
|
|
39837
39879
|
const isPreviewMode = checkIsPreviewMode();
|
|
39838
|
-
const plugin2 = yield loadConfigurations(configurationKey, isPreviewMode, options);
|
|
39880
|
+
const plugin2 = yield loadConfigurations(configurationKey, isPreviewMode, options, optionOverrides);
|
|
39839
39881
|
const configuration = isPreviewMode ? (_a = plugin2.previewConfiguration) != null ? _a : plugin2.configuration : plugin2.configuration;
|
|
39840
39882
|
if (configuration) {
|
|
39841
|
-
yield mount(configuration, options);
|
|
39883
|
+
yield mount(configuration, options, optionOverrides);
|
|
39842
39884
|
}
|
|
39843
39885
|
});
|
|
39844
39886
|
const PluginConfigurationManager = {
|
|
@@ -39847,8 +39889,8 @@ const PluginConfigurationManager = {
|
|
|
39847
39889
|
const tracking = (options) => {
|
|
39848
39890
|
setupTracking(options);
|
|
39849
39891
|
};
|
|
39850
|
-
const init = (configurationKey, options) => {
|
|
39851
|
-
return PluginConfigurationManager.init(configurationKey, options);
|
|
39892
|
+
const init = (configurationKey, options, optionOverrides) => {
|
|
39893
|
+
return PluginConfigurationManager.init(configurationKey, options, optionOverrides);
|
|
39852
39894
|
};
|
|
39853
39895
|
const lupaSearch = {
|
|
39854
39896
|
init,
|