@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.js
CHANGED
|
@@ -71,9 +71,9 @@ const isDate = (val) => toTypeString(val) === "[object Date]";
|
|
|
71
71
|
const isFunction$1 = (val) => typeof val === "function";
|
|
72
72
|
const isString = (val) => typeof val === "string";
|
|
73
73
|
const isSymbol = (val) => typeof val === "symbol";
|
|
74
|
-
const isObject$
|
|
74
|
+
const isObject$3 = (val) => val !== null && typeof val === "object";
|
|
75
75
|
const isPromise$1 = (val) => {
|
|
76
|
-
return isObject$
|
|
76
|
+
return isObject$3(val) && isFunction$1(val.then) && isFunction$1(val.catch);
|
|
77
77
|
};
|
|
78
78
|
const objectToString$1 = Object.prototype.toString;
|
|
79
79
|
const toTypeString = (value) => objectToString$1.call(value);
|
|
@@ -147,7 +147,7 @@ function normalizeStyle(value) {
|
|
|
147
147
|
return res;
|
|
148
148
|
} else if (isString(value)) {
|
|
149
149
|
return value;
|
|
150
|
-
} else if (isObject$
|
|
150
|
+
} else if (isObject$3(value)) {
|
|
151
151
|
return value;
|
|
152
152
|
}
|
|
153
153
|
}
|
|
@@ -175,7 +175,7 @@ function normalizeClass(value) {
|
|
|
175
175
|
res += normalized + " ";
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
|
-
} else if (isObject$
|
|
178
|
+
} else if (isObject$3(value)) {
|
|
179
179
|
for (const name in value) {
|
|
180
180
|
if (value[name]) {
|
|
181
181
|
res += name + " ";
|
|
@@ -228,8 +228,8 @@ function looseEqual(a, b) {
|
|
|
228
228
|
if (aValidType || bValidType) {
|
|
229
229
|
return aValidType && bValidType ? looseCompareArrays(a, b) : false;
|
|
230
230
|
}
|
|
231
|
-
aValidType = isObject$
|
|
232
|
-
bValidType = isObject$
|
|
231
|
+
aValidType = isObject$3(a);
|
|
232
|
+
bValidType = isObject$3(b);
|
|
233
233
|
if (aValidType || bValidType) {
|
|
234
234
|
if (!aValidType || !bValidType) {
|
|
235
235
|
return false;
|
|
@@ -253,7 +253,7 @@ function looseIndexOf(arr, val) {
|
|
|
253
253
|
return arr.findIndex((item) => looseEqual(item, val));
|
|
254
254
|
}
|
|
255
255
|
const toDisplayString = (val) => {
|
|
256
|
-
return isString(val) ? val : val == null ? "" : isArray$1(val) || isObject$
|
|
256
|
+
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);
|
|
257
257
|
};
|
|
258
258
|
const replacer = (_key, val) => {
|
|
259
259
|
if (val && val.__v_isRef) {
|
|
@@ -269,7 +269,7 @@ const replacer = (_key, val) => {
|
|
|
269
269
|
return {
|
|
270
270
|
[`Set(${val.size})`]: [...val.values()]
|
|
271
271
|
};
|
|
272
|
-
} else if (isObject$
|
|
272
|
+
} else if (isObject$3(val) && !isArray$1(val) && !isPlainObject$4(val)) {
|
|
273
273
|
return String(val);
|
|
274
274
|
}
|
|
275
275
|
return val;
|
|
@@ -662,7 +662,7 @@ function createGetter(isReadonly2 = false, shallow = false) {
|
|
|
662
662
|
if (isRef(res)) {
|
|
663
663
|
return targetIsArray && isIntegerKey(key) ? res : res.value;
|
|
664
664
|
}
|
|
665
|
-
if (isObject$
|
|
665
|
+
if (isObject$3(res)) {
|
|
666
666
|
return isReadonly2 ? readonly(res) : reactive(res);
|
|
667
667
|
}
|
|
668
668
|
return res;
|
|
@@ -1056,7 +1056,7 @@ function readonly(target) {
|
|
|
1056
1056
|
);
|
|
1057
1057
|
}
|
|
1058
1058
|
function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
|
|
1059
|
-
if (!isObject$
|
|
1059
|
+
if (!isObject$3(target)) {
|
|
1060
1060
|
return target;
|
|
1061
1061
|
}
|
|
1062
1062
|
if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
|
|
@@ -1100,8 +1100,8 @@ function markRaw(value) {
|
|
|
1100
1100
|
def(value, "__v_skip", true);
|
|
1101
1101
|
return value;
|
|
1102
1102
|
}
|
|
1103
|
-
const toReactive = (value) => isObject$
|
|
1104
|
-
const toReadonly = (value) => isObject$
|
|
1103
|
+
const toReactive = (value) => isObject$3(value) ? reactive(value) : value;
|
|
1104
|
+
const toReadonly = (value) => isObject$3(value) ? readonly(value) : value;
|
|
1105
1105
|
function trackRefValue(ref2) {
|
|
1106
1106
|
if (shouldTrack && activeEffect) {
|
|
1107
1107
|
ref2 = toRaw(ref2);
|
|
@@ -1211,7 +1211,7 @@ function toRef(source, key, defaultValue) {
|
|
|
1211
1211
|
return source;
|
|
1212
1212
|
} else if (isFunction$1(source)) {
|
|
1213
1213
|
return new GetterRefImpl(source);
|
|
1214
|
-
} else if (isObject$
|
|
1214
|
+
} else if (isObject$3(source) && arguments.length > 1) {
|
|
1215
1215
|
return propertyToRef(source, key, defaultValue);
|
|
1216
1216
|
} else {
|
|
1217
1217
|
return ref(source);
|
|
@@ -1531,7 +1531,7 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
|
1531
1531
|
}
|
|
1532
1532
|
}
|
|
1533
1533
|
if (!raw && !hasExtends) {
|
|
1534
|
-
if (isObject$
|
|
1534
|
+
if (isObject$3(comp)) {
|
|
1535
1535
|
cache.set(comp, null);
|
|
1536
1536
|
}
|
|
1537
1537
|
return null;
|
|
@@ -1541,7 +1541,7 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
|
1541
1541
|
} else {
|
|
1542
1542
|
extend(normalized, raw);
|
|
1543
1543
|
}
|
|
1544
|
-
if (isObject$
|
|
1544
|
+
if (isObject$3(comp)) {
|
|
1545
1545
|
cache.set(comp, normalized);
|
|
1546
1546
|
}
|
|
1547
1547
|
return normalized;
|
|
@@ -1949,7 +1949,7 @@ function createPathGetter(ctx, path) {
|
|
|
1949
1949
|
};
|
|
1950
1950
|
}
|
|
1951
1951
|
function traverse(value, seen) {
|
|
1952
|
-
if (!isObject$
|
|
1952
|
+
if (!isObject$3(value) || value["__v_skip"]) {
|
|
1953
1953
|
return value;
|
|
1954
1954
|
}
|
|
1955
1955
|
seen = seen || /* @__PURE__ */ new Set();
|
|
@@ -2484,7 +2484,7 @@ function renderList(source, renderItem, cache, index) {
|
|
|
2484
2484
|
for (let i = 0; i < source; i++) {
|
|
2485
2485
|
ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
|
|
2486
2486
|
}
|
|
2487
|
-
} else if (isObject$
|
|
2487
|
+
} else if (isObject$3(source)) {
|
|
2488
2488
|
if (source[Symbol.iterator]) {
|
|
2489
2489
|
ret = Array.from(
|
|
2490
2490
|
source,
|
|
@@ -2761,7 +2761,7 @@ function applyOptions(instance) {
|
|
|
2761
2761
|
}
|
|
2762
2762
|
if (dataOptions) {
|
|
2763
2763
|
const data = dataOptions.call(publicThis, publicThis);
|
|
2764
|
-
if (!isObject$
|
|
2764
|
+
if (!isObject$3(data))
|
|
2765
2765
|
;
|
|
2766
2766
|
else {
|
|
2767
2767
|
instance.data = reactive(data);
|
|
@@ -2849,7 +2849,7 @@ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP)
|
|
|
2849
2849
|
for (const key in injectOptions) {
|
|
2850
2850
|
const opt = injectOptions[key];
|
|
2851
2851
|
let injected;
|
|
2852
|
-
if (isObject$
|
|
2852
|
+
if (isObject$3(opt)) {
|
|
2853
2853
|
if ("default" in opt) {
|
|
2854
2854
|
injected = inject(
|
|
2855
2855
|
opt.from || key,
|
|
@@ -2891,7 +2891,7 @@ function createWatcher(raw, ctx, publicThis, key) {
|
|
|
2891
2891
|
}
|
|
2892
2892
|
} else if (isFunction$1(raw)) {
|
|
2893
2893
|
watch(getter, raw.bind(publicThis));
|
|
2894
|
-
} else if (isObject$
|
|
2894
|
+
} else if (isObject$3(raw)) {
|
|
2895
2895
|
if (isArray$1(raw)) {
|
|
2896
2896
|
raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
|
|
2897
2897
|
} else {
|
|
@@ -2928,7 +2928,7 @@ function resolveMergedOptions(instance) {
|
|
|
2928
2928
|
}
|
|
2929
2929
|
mergeOptions(resolved, base, optionMergeStrategies);
|
|
2930
2930
|
}
|
|
2931
|
-
if (isObject$
|
|
2931
|
+
if (isObject$3(base)) {
|
|
2932
2932
|
cache.set(base, resolved);
|
|
2933
2933
|
}
|
|
2934
2934
|
return resolved;
|
|
@@ -3069,7 +3069,7 @@ function createAppAPI(render4, hydrate) {
|
|
|
3069
3069
|
if (!isFunction$1(rootComponent)) {
|
|
3070
3070
|
rootComponent = extend({}, rootComponent);
|
|
3071
3071
|
}
|
|
3072
|
-
if (rootProps != null && !isObject$
|
|
3072
|
+
if (rootProps != null && !isObject$3(rootProps)) {
|
|
3073
3073
|
rootProps = null;
|
|
3074
3074
|
}
|
|
3075
3075
|
const context = createAppContext();
|
|
@@ -3413,7 +3413,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
3413
3413
|
}
|
|
3414
3414
|
}
|
|
3415
3415
|
if (!raw && !hasExtends) {
|
|
3416
|
-
if (isObject$
|
|
3416
|
+
if (isObject$3(comp)) {
|
|
3417
3417
|
cache.set(comp, EMPTY_ARR);
|
|
3418
3418
|
}
|
|
3419
3419
|
return EMPTY_ARR;
|
|
@@ -3450,7 +3450,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
3450
3450
|
}
|
|
3451
3451
|
}
|
|
3452
3452
|
const res = [normalized, needCastKeys];
|
|
3453
|
-
if (isObject$
|
|
3453
|
+
if (isObject$3(comp)) {
|
|
3454
3454
|
cache.set(comp, res);
|
|
3455
3455
|
}
|
|
3456
3456
|
return res;
|
|
@@ -5114,14 +5114,14 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
|
|
|
5114
5114
|
if (klass && !isString(klass)) {
|
|
5115
5115
|
props.class = normalizeClass(klass);
|
|
5116
5116
|
}
|
|
5117
|
-
if (isObject$
|
|
5117
|
+
if (isObject$3(style)) {
|
|
5118
5118
|
if (isProxy(style) && !isArray$1(style)) {
|
|
5119
5119
|
style = extend({}, style);
|
|
5120
5120
|
}
|
|
5121
5121
|
props.style = normalizeStyle(style);
|
|
5122
5122
|
}
|
|
5123
5123
|
}
|
|
5124
|
-
const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject$
|
|
5124
|
+
const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject$3(type) ? 4 : isFunction$1(type) ? 2 : 0;
|
|
5125
5125
|
return createBaseVNode(
|
|
5126
5126
|
type,
|
|
5127
5127
|
props,
|
|
@@ -5458,7 +5458,7 @@ function handleSetupResult(instance, setupResult, isSSR) {
|
|
|
5458
5458
|
} else {
|
|
5459
5459
|
instance.render = setupResult;
|
|
5460
5460
|
}
|
|
5461
|
-
} else if (isObject$
|
|
5461
|
+
} else if (isObject$3(setupResult)) {
|
|
5462
5462
|
instance.setupState = proxyRefs(setupResult);
|
|
5463
5463
|
} else
|
|
5464
5464
|
;
|
|
@@ -5550,7 +5550,7 @@ const computed = (getterOrOptions, debugOptions) => {
|
|
|
5550
5550
|
function h$1(type, propsOrChildren, children) {
|
|
5551
5551
|
const l = arguments.length;
|
|
5552
5552
|
if (l === 2) {
|
|
5553
|
-
if (isObject$
|
|
5553
|
+
if (isObject$3(propsOrChildren) && !isArray$1(propsOrChildren)) {
|
|
5554
5554
|
if (isVNode(propsOrChildren)) {
|
|
5555
5555
|
return createVNode(type, null, [propsOrChildren]);
|
|
5556
5556
|
}
|
|
@@ -6056,7 +6056,7 @@ function resolveTransitionProps(rawProps) {
|
|
|
6056
6056
|
function normalizeDuration(duration) {
|
|
6057
6057
|
if (duration == null) {
|
|
6058
6058
|
return null;
|
|
6059
|
-
} else if (isObject$
|
|
6059
|
+
} else if (isObject$3(duration)) {
|
|
6060
6060
|
return [NumberOf(duration.enter), NumberOf(duration.leave)];
|
|
6061
6061
|
} else {
|
|
6062
6062
|
const n = NumberOf(duration);
|
|
@@ -12902,18 +12902,18 @@ Object.defineProperty(isPlainObject$2, "__esModule", { value: true });
|
|
|
12902
12902
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
12903
12903
|
* Released under the MIT License.
|
|
12904
12904
|
*/
|
|
12905
|
-
function isObject(o) {
|
|
12905
|
+
function isObject$2(o) {
|
|
12906
12906
|
return Object.prototype.toString.call(o) === "[object Object]";
|
|
12907
12907
|
}
|
|
12908
12908
|
function isPlainObject$1(o) {
|
|
12909
12909
|
var ctor, prot;
|
|
12910
|
-
if (isObject(o) === false)
|
|
12910
|
+
if (isObject$2(o) === false)
|
|
12911
12911
|
return false;
|
|
12912
12912
|
ctor = o.constructor;
|
|
12913
12913
|
if (ctor === void 0)
|
|
12914
12914
|
return true;
|
|
12915
12915
|
prot = ctor.prototype;
|
|
12916
|
-
if (isObject(prot) === false)
|
|
12916
|
+
if (isObject$2(prot) === false)
|
|
12917
12917
|
return false;
|
|
12918
12918
|
if (prot.hasOwnProperty("isPrototypeOf") === false) {
|
|
12919
12919
|
return false;
|
|
@@ -17699,12 +17699,12 @@ sanitizeHtml.defaults = {
|
|
|
17699
17699
|
enforceHtmlBoundary: false,
|
|
17700
17700
|
parseStyleAttributes: true
|
|
17701
17701
|
};
|
|
17702
|
-
sanitizeHtml.simpleTransform = function(newTagName, newAttribs,
|
|
17703
|
-
|
|
17702
|
+
sanitizeHtml.simpleTransform = function(newTagName, newAttribs, merge2) {
|
|
17703
|
+
merge2 = merge2 === void 0 ? true : merge2;
|
|
17704
17704
|
newAttribs = newAttribs || {};
|
|
17705
17705
|
return function(tagName, attribs) {
|
|
17706
17706
|
let attrib;
|
|
17707
|
-
if (
|
|
17707
|
+
if (merge2) {
|
|
17708
17708
|
for (attrib in newAttribs) {
|
|
17709
17709
|
attribs[attrib] = newAttribs[attrib];
|
|
17710
17710
|
}
|
|
@@ -19702,6 +19702,74 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
|
|
|
19702
19702
|
};
|
|
19703
19703
|
}
|
|
19704
19704
|
});
|
|
19705
|
+
const extractValue = (options) => {
|
|
19706
|
+
switch (options.extractFrom) {
|
|
19707
|
+
case "url":
|
|
19708
|
+
return extractFromUrl(options);
|
|
19709
|
+
case "localStorage":
|
|
19710
|
+
case "sessionStorage":
|
|
19711
|
+
return extractFromStorage(options);
|
|
19712
|
+
case "htmlElementText":
|
|
19713
|
+
return extractFromHtmlElementText(options);
|
|
19714
|
+
case "cookie":
|
|
19715
|
+
return extractFromCookie(options);
|
|
19716
|
+
default:
|
|
19717
|
+
return options.default;
|
|
19718
|
+
}
|
|
19719
|
+
};
|
|
19720
|
+
const extractFromCookie = (options) => {
|
|
19721
|
+
var _a, _b;
|
|
19722
|
+
try {
|
|
19723
|
+
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}=`));
|
|
19724
|
+
return cookieValue ? cookieValue.split("=")[1] : options.default;
|
|
19725
|
+
} catch (e2) {
|
|
19726
|
+
return options.default;
|
|
19727
|
+
}
|
|
19728
|
+
};
|
|
19729
|
+
const extractFromUrl = (options) => {
|
|
19730
|
+
const regex = new RegExp(options.regex);
|
|
19731
|
+
const match = window.location.href.match(regex);
|
|
19732
|
+
return match ? match[1] : options.default;
|
|
19733
|
+
};
|
|
19734
|
+
const extractFromStorage = (options) => {
|
|
19735
|
+
const storage = options.extractFrom === "localStorage" ? localStorage : sessionStorage;
|
|
19736
|
+
let rawValue2 = "";
|
|
19737
|
+
try {
|
|
19738
|
+
rawValue2 = storage.getItem(options.key);
|
|
19739
|
+
} catch (e2) {
|
|
19740
|
+
return options.default;
|
|
19741
|
+
}
|
|
19742
|
+
if (rawValue2) {
|
|
19743
|
+
try {
|
|
19744
|
+
const parsedValue = JSON.parse(rawValue2);
|
|
19745
|
+
return options.path ? getValueFromPath(parsedValue, options.path) : parsedValue;
|
|
19746
|
+
} catch (e2) {
|
|
19747
|
+
return rawValue2;
|
|
19748
|
+
}
|
|
19749
|
+
}
|
|
19750
|
+
return options.default;
|
|
19751
|
+
};
|
|
19752
|
+
const extractFromHtmlElementText = (options) => {
|
|
19753
|
+
var _a;
|
|
19754
|
+
const element = document.querySelector(options.querySelector);
|
|
19755
|
+
return element ? ((_a = element.textContent) == null ? void 0 : _a.trim()) || options.default : options.default;
|
|
19756
|
+
};
|
|
19757
|
+
const getValueFromPath = (obj, path) => {
|
|
19758
|
+
return path.split(".").reduce((value, key) => value && value[key] || null, obj);
|
|
19759
|
+
};
|
|
19760
|
+
const processExtractionObject = (value = {}) => {
|
|
19761
|
+
var _a;
|
|
19762
|
+
const parsedObject = {};
|
|
19763
|
+
for (const key in value) {
|
|
19764
|
+
if (isObject$1(value[key]) && ((_a = value[key]) == null ? void 0 : _a.extractFrom)) {
|
|
19765
|
+
const extractedValue = extractValue(value[key]);
|
|
19766
|
+
parsedObject[key] = Array.isArray(extractedValue) ? extractedValue : [extractedValue];
|
|
19767
|
+
} else {
|
|
19768
|
+
parsedObject[key] = value[key];
|
|
19769
|
+
}
|
|
19770
|
+
}
|
|
19771
|
+
return parsedObject;
|
|
19772
|
+
};
|
|
19705
19773
|
const _sfc_main$11 = /* @__PURE__ */ defineComponent({
|
|
19706
19774
|
__name: "SearchBoxProductsWrapper",
|
|
19707
19775
|
props: {
|
|
@@ -19725,6 +19793,9 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
|
|
|
19725
19793
|
const showGoToResultsButton = computed(() => {
|
|
19726
19794
|
return props.panel.showGoToResults;
|
|
19727
19795
|
});
|
|
19796
|
+
const extractedInitialFilters = computed(() => {
|
|
19797
|
+
return __spreadValues2({}, processExtractionObject(props.searchBoxOptions.initialFilters));
|
|
19798
|
+
});
|
|
19728
19799
|
const inputValueProp = computed(() => props.inputValue);
|
|
19729
19800
|
onMounted(() => {
|
|
19730
19801
|
getItemsDebounced();
|
|
@@ -19742,7 +19813,11 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
|
|
|
19742
19813
|
const getItems = () => {
|
|
19743
19814
|
searchBoxStore.queryDocuments({
|
|
19744
19815
|
queryKey: props.panel.queryKey,
|
|
19745
|
-
publicQuery: {
|
|
19816
|
+
publicQuery: {
|
|
19817
|
+
searchText: props.inputValue,
|
|
19818
|
+
limit: props.panel.limit,
|
|
19819
|
+
filters: extractedInitialFilters.value
|
|
19820
|
+
},
|
|
19746
19821
|
options: props.options
|
|
19747
19822
|
}).then(({ result: result2 }) => {
|
|
19748
19823
|
if (!(result2 == null ? void 0 : result2.items.length)) {
|
|
@@ -20171,6 +20246,9 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent({
|
|
|
20171
20246
|
const focused = ref(false);
|
|
20172
20247
|
const searchBoxInput = ref(null);
|
|
20173
20248
|
const { highlightedDocument } = storeToRefs(searchBoxStore);
|
|
20249
|
+
computed(() => {
|
|
20250
|
+
return __spreadValues2({}, processExtractionObject(props.options.initialFilters));
|
|
20251
|
+
});
|
|
20174
20252
|
const searchValue = computed(() => {
|
|
20175
20253
|
return suggestedValue.value.override ? suggestedValue.value.item.suggestion : inputValue.value;
|
|
20176
20254
|
});
|
|
@@ -20196,7 +20274,8 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent({
|
|
|
20196
20274
|
"hideMoreResultsButtonOnNoResults",
|
|
20197
20275
|
"showNoResultsPanel",
|
|
20198
20276
|
"expandOnSinglePanel",
|
|
20199
|
-
"showMoreResultsButton"
|
|
20277
|
+
"showMoreResultsButton",
|
|
20278
|
+
"initialFilters"
|
|
20200
20279
|
])
|
|
20201
20280
|
);
|
|
20202
20281
|
const searchTriggers = computed(() => {
|
|
@@ -25431,9 +25510,12 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
25431
25510
|
const dynamicDataStore = useDynamicDataStore();
|
|
25432
25511
|
const screenStore = useScreenStore();
|
|
25433
25512
|
const redirectionStore = useRedirectionStore();
|
|
25513
|
+
const extractedInitialFilters = computed(() => {
|
|
25514
|
+
return __spreadValues2({}, processExtractionObject(props.options.initialFilters));
|
|
25515
|
+
});
|
|
25434
25516
|
const initialFilters = computed(() => {
|
|
25435
|
-
var _a;
|
|
25436
|
-
return (_a = props.initialFilters) != null ? _a : {};
|
|
25517
|
+
var _a, _b;
|
|
25518
|
+
return (_b = (_a = props.initialFilters) != null ? _a : extractedInitialFilters.value) != null ? _b : {};
|
|
25437
25519
|
});
|
|
25438
25520
|
const { currentQueryText, hasResults, currentFilterCount } = storeToRefs(searchResultStore);
|
|
25439
25521
|
const { searchString, sortParams } = storeToRefs(paramStore);
|
|
@@ -25739,62 +25821,6 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
25739
25821
|
};
|
|
25740
25822
|
}
|
|
25741
25823
|
});
|
|
25742
|
-
const extractValue = (options) => {
|
|
25743
|
-
switch (options.extractFrom) {
|
|
25744
|
-
case "url":
|
|
25745
|
-
return extractFromUrl(options);
|
|
25746
|
-
case "localStorage":
|
|
25747
|
-
case "sessionStorage":
|
|
25748
|
-
return extractFromStorage(options);
|
|
25749
|
-
case "htmlElementText":
|
|
25750
|
-
return extractFromHtmlElementText(options);
|
|
25751
|
-
default:
|
|
25752
|
-
return options.default;
|
|
25753
|
-
}
|
|
25754
|
-
};
|
|
25755
|
-
const extractFromUrl = (options) => {
|
|
25756
|
-
const regex = new RegExp(options.regex);
|
|
25757
|
-
const match = window.location.href.match(regex);
|
|
25758
|
-
return match ? match[1] : options.default;
|
|
25759
|
-
};
|
|
25760
|
-
const extractFromStorage = (options) => {
|
|
25761
|
-
const storage = options.extractFrom === "localStorage" ? localStorage : sessionStorage;
|
|
25762
|
-
let rawValue2 = "";
|
|
25763
|
-
try {
|
|
25764
|
-
rawValue2 = storage.getItem(options.key);
|
|
25765
|
-
} catch (e2) {
|
|
25766
|
-
return options.default;
|
|
25767
|
-
}
|
|
25768
|
-
if (rawValue2) {
|
|
25769
|
-
try {
|
|
25770
|
-
const parsedValue = JSON.parse(rawValue2);
|
|
25771
|
-
return options.path ? getValueFromPath(parsedValue, options.path) : parsedValue;
|
|
25772
|
-
} catch (e2) {
|
|
25773
|
-
return rawValue2;
|
|
25774
|
-
}
|
|
25775
|
-
}
|
|
25776
|
-
return options.default;
|
|
25777
|
-
};
|
|
25778
|
-
const extractFromHtmlElementText = (options) => {
|
|
25779
|
-
var _a;
|
|
25780
|
-
const element = document.querySelector(options.querySelector);
|
|
25781
|
-
return element ? ((_a = element.textContent) == null ? void 0 : _a.trim()) || options.default : options.default;
|
|
25782
|
-
};
|
|
25783
|
-
const getValueFromPath = (obj, path) => {
|
|
25784
|
-
return path.split(".").reduce((value, key) => value && value[key] || null, obj);
|
|
25785
|
-
};
|
|
25786
|
-
const processExtractionObject = (value = {}) => {
|
|
25787
|
-
var _a;
|
|
25788
|
-
const parsedObject = {};
|
|
25789
|
-
for (const key in value) {
|
|
25790
|
-
if (isObject$1(value[key]) && ((_a = value[key]) == null ? void 0 : _a.extractFrom)) {
|
|
25791
|
-
parsedObject[key] = extractValue(value[key]);
|
|
25792
|
-
} else {
|
|
25793
|
-
parsedObject[key] = value[key];
|
|
25794
|
-
}
|
|
25795
|
-
}
|
|
25796
|
-
return parsedObject;
|
|
25797
|
-
};
|
|
25798
25824
|
const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
25799
25825
|
__name: "ProductList",
|
|
25800
25826
|
props: {
|
|
@@ -25814,7 +25840,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
25814
25840
|
var _a;
|
|
25815
25841
|
(_a = searchResults2.value) == null ? void 0 : _a.handleMounted();
|
|
25816
25842
|
};
|
|
25817
|
-
computed(() => {
|
|
25843
|
+
const initialFilters = computed(() => {
|
|
25818
25844
|
return __spreadValues2({}, processExtractionObject(props.options.initialFilters));
|
|
25819
25845
|
});
|
|
25820
25846
|
__expose({ fetch: fetch2 });
|
|
@@ -25822,7 +25848,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
25822
25848
|
return openBlock(), createElementBlock("div", null, [
|
|
25823
25849
|
createVNode(_sfc_main$e, {
|
|
25824
25850
|
options: componentOptions.value,
|
|
25825
|
-
"initial-filters":
|
|
25851
|
+
"initial-filters": initialFilters.value,
|
|
25826
25852
|
"is-product-list": true,
|
|
25827
25853
|
ref_key: "searchResults",
|
|
25828
25854
|
ref: searchResults2
|
|
@@ -30210,7 +30236,7 @@ lodash$1.exports;
|
|
|
30210
30236
|
});
|
|
30211
30237
|
return result3;
|
|
30212
30238
|
}
|
|
30213
|
-
var
|
|
30239
|
+
var merge2 = createAssigner(function(object, source, srcIndex) {
|
|
30214
30240
|
baseMerge(object, source, srcIndex);
|
|
30215
30241
|
});
|
|
30216
30242
|
var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
|
|
@@ -30900,7 +30926,7 @@ lodash$1.exports;
|
|
|
30900
30926
|
lodash2.matches = matches;
|
|
30901
30927
|
lodash2.matchesProperty = matchesProperty;
|
|
30902
30928
|
lodash2.memoize = memoize;
|
|
30903
|
-
lodash2.merge =
|
|
30929
|
+
lodash2.merge = merge2;
|
|
30904
30930
|
lodash2.mergeWith = mergeWith;
|
|
30905
30931
|
lodash2.method = method;
|
|
30906
30932
|
lodash2.methodOf = methodOf;
|
|
@@ -37736,7 +37762,7 @@ lodash.exports;
|
|
|
37736
37762
|
});
|
|
37737
37763
|
return result3;
|
|
37738
37764
|
}
|
|
37739
|
-
var
|
|
37765
|
+
var merge2 = createAssigner(function(object, source, srcIndex) {
|
|
37740
37766
|
baseMerge(object, source, srcIndex);
|
|
37741
37767
|
});
|
|
37742
37768
|
var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
|
|
@@ -38426,7 +38452,7 @@ lodash.exports;
|
|
|
38426
38452
|
lodash2.matches = matches;
|
|
38427
38453
|
lodash2.matchesProperty = matchesProperty;
|
|
38428
38454
|
lodash2.memoize = memoize;
|
|
38429
|
-
lodash2.merge =
|
|
38455
|
+
lodash2.merge = merge2;
|
|
38430
38456
|
lodash2.mergeWith = mergeWith;
|
|
38431
38457
|
lodash2.method = method;
|
|
38432
38458
|
lodash2.methodOf = methodOf;
|
|
@@ -39583,6 +39609,14 @@ const waitForElementToBeVisible = (element, retries = 0, maxRetries = 30, interv
|
|
|
39583
39609
|
}, interval);
|
|
39584
39610
|
});
|
|
39585
39611
|
});
|
|
39612
|
+
const isObject = (item) => typeof item === "object" && !Array.isArray(item);
|
|
39613
|
+
const merge = (target, source) => {
|
|
39614
|
+
const isDeep = (prop) => isObject(source[prop]) && Object.prototype.hasOwnProperty.call(target, prop) && isObject(target[prop]);
|
|
39615
|
+
const replaced = Object.getOwnPropertyNames(source).map((prop) => ({
|
|
39616
|
+
[prop]: isDeep(prop) ? merge(target[prop], source[prop]) : source[prop]
|
|
39617
|
+
})).reduce((a, b) => __spreadValues(__spreadValues({}, a), b), {});
|
|
39618
|
+
return __spreadValues(__spreadValues({}, target), replaced);
|
|
39619
|
+
};
|
|
39586
39620
|
const saveToLocalStorage = (key, value) => {
|
|
39587
39621
|
try {
|
|
39588
39622
|
localStorage.setItem(key, JSON.stringify(value));
|
|
@@ -39634,7 +39668,7 @@ const getQueryParam = (name) => {
|
|
|
39634
39668
|
const PREVIEW_PARAMETER = "lupaSearchPreview";
|
|
39635
39669
|
const MAX_ELEMENT_MOUNT_RETRIES = 25;
|
|
39636
39670
|
let styleElement = null;
|
|
39637
|
-
const loadAndSaveConfigurationFromServer = (
|
|
39671
|
+
const loadAndSaveConfigurationFromServer = (_0, ..._1) => __async(exports, [_0, ..._1], function* (configurationKey, options = { environment: "production" }) {
|
|
39638
39672
|
const configuration = yield fetchPluginConfiguration(
|
|
39639
39673
|
options,
|
|
39640
39674
|
configurationKey
|
|
@@ -39659,7 +39693,7 @@ const checkIsPreviewMode = () => {
|
|
|
39659
39693
|
}
|
|
39660
39694
|
return isPreviewMode;
|
|
39661
39695
|
};
|
|
39662
|
-
const loadConfigurations = (configurationKey, isPreviewMode, options) => __async(exports, null, function* () {
|
|
39696
|
+
const loadConfigurations = (configurationKey, isPreviewMode, options, optionOverrides) => __async(exports, null, function* () {
|
|
39663
39697
|
if (isPreviewMode) {
|
|
39664
39698
|
return loadAndSaveConfigurationFromServer(configurationKey, options);
|
|
39665
39699
|
}
|
|
@@ -39677,7 +39711,7 @@ const loadConfigurations = (configurationKey, isPreviewMode, options) => __async
|
|
|
39677
39711
|
const isPreviewMode2 = checkIsPreviewMode();
|
|
39678
39712
|
const configuration = isPreviewMode2 ? (_a = newestConfiguration.previewConfiguration) != null ? _a : newestConfiguration.configuration : newestConfiguration.configuration;
|
|
39679
39713
|
if (configuration) {
|
|
39680
|
-
yield mount(configuration, options, false, true);
|
|
39714
|
+
yield mount(configuration, options, optionOverrides, false, true);
|
|
39681
39715
|
} else {
|
|
39682
39716
|
removeFromLocalStorage(configurationKey);
|
|
39683
39717
|
window.location.reload();
|
|
@@ -39708,7 +39742,8 @@ const applyStyles = (configuration) => __async(exports, null, function* () {
|
|
|
39708
39742
|
}
|
|
39709
39743
|
document.head.appendChild(styleElement);
|
|
39710
39744
|
});
|
|
39711
|
-
const mountSearchBox = (configuration, options, fetch2 = true, remount = false) => __async(exports, null, function* () {
|
|
39745
|
+
const mountSearchBox = (configuration, options, optionOverrides, fetch2 = true, remount = false) => __async(exports, null, function* () {
|
|
39746
|
+
var _a;
|
|
39712
39747
|
if (!configuration.searchBox) {
|
|
39713
39748
|
return;
|
|
39714
39749
|
}
|
|
@@ -39725,9 +39760,11 @@ const mountSearchBox = (configuration, options, fetch2 = true, remount = false)
|
|
|
39725
39760
|
);
|
|
39726
39761
|
return;
|
|
39727
39762
|
}
|
|
39728
|
-
|
|
39763
|
+
const mergedOptions = merge(resolvedConfiguration, (_a = optionOverrides == null ? void 0 : optionOverrides.searchBox) != null ? _a : {});
|
|
39764
|
+
searchBox(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
|
|
39729
39765
|
});
|
|
39730
|
-
const mountSearchResults = (configuration, options, fetch2 = true, remount = false) => __async(exports, null, function* () {
|
|
39766
|
+
const mountSearchResults = (configuration, options, optionOverrides, fetch2 = true, remount = false) => __async(exports, null, function* () {
|
|
39767
|
+
var _a;
|
|
39731
39768
|
if (!configuration.searchResults) {
|
|
39732
39769
|
return;
|
|
39733
39770
|
}
|
|
@@ -39744,9 +39781,11 @@ const mountSearchResults = (configuration, options, fetch2 = true, remount = fal
|
|
|
39744
39781
|
);
|
|
39745
39782
|
return;
|
|
39746
39783
|
}
|
|
39747
|
-
|
|
39784
|
+
const mergedOptions = merge(resolvedConfiguration, (_a = optionOverrides == null ? void 0 : optionOverrides.searchResults) != null ? _a : {});
|
|
39785
|
+
searchResults(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
|
|
39748
39786
|
});
|
|
39749
|
-
const mountProductList = (configuration, options, fetch2 = true, remount = false) => __async(exports, null, function* () {
|
|
39787
|
+
const mountProductList = (configuration, options, optionOverrides, fetch2 = true, remount = false) => __async(exports, null, function* () {
|
|
39788
|
+
var _a;
|
|
39750
39789
|
if (!configuration.productList) {
|
|
39751
39790
|
return;
|
|
39752
39791
|
}
|
|
@@ -39766,12 +39805,14 @@ const mountProductList = (configuration, options, fetch2 = true, remount = false
|
|
|
39766
39805
|
);
|
|
39767
39806
|
return;
|
|
39768
39807
|
}
|
|
39769
|
-
|
|
39770
|
-
|
|
39771
|
-
|
|
39808
|
+
const mergedOptions = merge(
|
|
39809
|
+
__spreadValues(__spreadValues({}, resolvedSearchResultsConfiguration), resolvedConfiguration),
|
|
39810
|
+
(_a = optionOverrides == null ? void 0 : optionOverrides.productList) != null ? _a : {}
|
|
39772
39811
|
);
|
|
39812
|
+
productList(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
|
|
39773
39813
|
});
|
|
39774
|
-
const mountRecommendations = (configuration, options, fetch2 = true, remount = false) => __async(exports, null, function* () {
|
|
39814
|
+
const mountRecommendations = (configuration, options, optionOverrides, fetch2 = true, remount = false) => __async(exports, null, function* () {
|
|
39815
|
+
var _a;
|
|
39775
39816
|
if (!configuration.recommendations) {
|
|
39776
39817
|
return;
|
|
39777
39818
|
}
|
|
@@ -39793,10 +39834,11 @@ const mountRecommendations = (configuration, options, fetch2 = true, remount = f
|
|
|
39793
39834
|
);
|
|
39794
39835
|
return;
|
|
39795
39836
|
}
|
|
39796
|
-
|
|
39797
|
-
|
|
39798
|
-
|
|
39837
|
+
const mergedOptions = merge(
|
|
39838
|
+
__spreadValues(__spreadValues({}, resolvedSearchResultsConfiguration), resolvedConfiguration),
|
|
39839
|
+
(_a = optionOverrides == null ? void 0 : optionOverrides.recommendations) != null ? _a : {}
|
|
39799
39840
|
);
|
|
39841
|
+
recommendations(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
|
|
39800
39842
|
});
|
|
39801
39843
|
const mountChat = (configuration, options, fetch2 = true, remount = false) => __async(exports, null, function* () {
|
|
39802
39844
|
if (!configuration.genAiChat) {
|
|
@@ -39823,24 +39865,24 @@ const mountChat = (configuration, options, fetch2 = true, remount = false) => __
|
|
|
39823
39865
|
{ fetch: fetch2, allowedMountUrls }
|
|
39824
39866
|
);
|
|
39825
39867
|
});
|
|
39826
|
-
const mount = (configuration, options, fetch2 = true, remount = false)
|
|
39868
|
+
const mount = (_0, ..._1) => __async(exports, [_0, ..._1], function* (configuration, options = { environment: "production" }, optionOverrides = {}, fetch2 = true, remount = false) {
|
|
39827
39869
|
yield applyStyles(configuration);
|
|
39828
39870
|
const mountPromises = [
|
|
39829
|
-
mountSearchBox(configuration, options, fetch2, remount),
|
|
39830
|
-
mountSearchResults(configuration, options, fetch2, remount),
|
|
39831
|
-
mountProductList(configuration, options, fetch2, remount),
|
|
39832
|
-
mountRecommendations(configuration, options, fetch2, remount),
|
|
39871
|
+
mountSearchBox(configuration, options, optionOverrides, fetch2, remount),
|
|
39872
|
+
mountSearchResults(configuration, options, optionOverrides, fetch2, remount),
|
|
39873
|
+
mountProductList(configuration, options, optionOverrides, fetch2, remount),
|
|
39874
|
+
mountRecommendations(configuration, options, optionOverrides, fetch2, remount),
|
|
39833
39875
|
mountChat(configuration, options, fetch2, remount)
|
|
39834
39876
|
];
|
|
39835
39877
|
yield Promise.all(mountPromises);
|
|
39836
39878
|
});
|
|
39837
|
-
const init$1 = (
|
|
39879
|
+
const init$1 = (_0, ..._1) => __async(exports, [_0, ..._1], function* (configurationKey, options = { environment: "production" }, optionOverrides = {}) {
|
|
39838
39880
|
var _a;
|
|
39839
39881
|
const isPreviewMode = checkIsPreviewMode();
|
|
39840
|
-
const plugin2 = yield loadConfigurations(configurationKey, isPreviewMode, options);
|
|
39882
|
+
const plugin2 = yield loadConfigurations(configurationKey, isPreviewMode, options, optionOverrides);
|
|
39841
39883
|
const configuration = isPreviewMode ? (_a = plugin2.previewConfiguration) != null ? _a : plugin2.configuration : plugin2.configuration;
|
|
39842
39884
|
if (configuration) {
|
|
39843
|
-
yield mount(configuration, options);
|
|
39885
|
+
yield mount(configuration, options, optionOverrides);
|
|
39844
39886
|
}
|
|
39845
39887
|
});
|
|
39846
39888
|
const PluginConfigurationManager = {
|
|
@@ -39849,8 +39891,8 @@ const PluginConfigurationManager = {
|
|
|
39849
39891
|
const tracking = (options) => {
|
|
39850
39892
|
setupTracking(options);
|
|
39851
39893
|
};
|
|
39852
|
-
const init = (configurationKey, options) => {
|
|
39853
|
-
return PluginConfigurationManager.init(configurationKey, options);
|
|
39894
|
+
const init = (configurationKey, options, optionOverrides) => {
|
|
39895
|
+
return PluginConfigurationManager.init(configurationKey, options, optionOverrides);
|
|
39854
39896
|
};
|
|
39855
39897
|
const lupaSearch = {
|
|
39856
39898
|
init,
|