@getlupa/client 1.15.10 → 1.15.13
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 +172 -132
- package/dist/lupaSearch.js +172 -132
- package/dist/lupaSearch.mjs +172 -132
- package/dist/lupaSearch.umd.js +172 -132
- 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,10 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
|
|
|
19723
19791
|
const showGoToResultsButton = computed(() => {
|
|
19724
19792
|
return props.panel.showGoToResults;
|
|
19725
19793
|
});
|
|
19794
|
+
const extractedInitialFilters = computed(() => {
|
|
19795
|
+
var _a;
|
|
19796
|
+
return __spreadValues2({}, processExtractionObject((_a = props.panel) == null ? void 0 : _a.initialFilters));
|
|
19797
|
+
});
|
|
19726
19798
|
const inputValueProp = computed(() => props.inputValue);
|
|
19727
19799
|
onMounted(() => {
|
|
19728
19800
|
getItemsDebounced();
|
|
@@ -19740,7 +19812,11 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
|
|
|
19740
19812
|
const getItems = () => {
|
|
19741
19813
|
searchBoxStore.queryDocuments({
|
|
19742
19814
|
queryKey: props.panel.queryKey,
|
|
19743
|
-
publicQuery: {
|
|
19815
|
+
publicQuery: {
|
|
19816
|
+
searchText: props.inputValue,
|
|
19817
|
+
limit: props.panel.limit,
|
|
19818
|
+
filters: extractedInitialFilters.value
|
|
19819
|
+
},
|
|
19744
19820
|
options: props.options
|
|
19745
19821
|
}).then(({ result: result2 }) => {
|
|
19746
19822
|
if (!(result2 == null ? void 0 : result2.items.length)) {
|
|
@@ -25095,12 +25171,12 @@ const _hoisted_3$7 = {
|
|
|
25095
25171
|
"data-cy": "lupa-no-results-in-page"
|
|
25096
25172
|
};
|
|
25097
25173
|
const _hoisted_4$4 = {
|
|
25098
|
-
key:
|
|
25174
|
+
key: 4,
|
|
25099
25175
|
class: "lupa-empty-results",
|
|
25100
25176
|
"data-cy": "lupa-no-results"
|
|
25101
25177
|
};
|
|
25102
|
-
const _hoisted_5$1 = { key:
|
|
25103
|
-
const _hoisted_6$1 = { key:
|
|
25178
|
+
const _hoisted_5$1 = { key: 5 };
|
|
25179
|
+
const _hoisted_6$1 = { key: 6 };
|
|
25104
25180
|
const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
25105
25181
|
__name: "SearchResultsProducts",
|
|
25106
25182
|
props: {
|
|
@@ -25221,10 +25297,11 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
25221
25297
|
location: "top",
|
|
25222
25298
|
sdkOptions: _ctx.options.options
|
|
25223
25299
|
}, null, 8, ["options", "sdkOptions"]),
|
|
25224
|
-
|
|
25300
|
+
_ctx.options.relatedQueries ? (openBlock(), createBlock(_sfc_main$i, {
|
|
25301
|
+
key: 1,
|
|
25225
25302
|
options: _ctx.options.relatedQueries
|
|
25226
|
-
}, null, 8, ["options"]),
|
|
25227
|
-
unref(hasResults) ? (openBlock(), createElementBlock(Fragment, { key:
|
|
25303
|
+
}, null, 8, ["options"])) : createCommentVNode("", true),
|
|
25304
|
+
unref(hasResults) ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
25228
25305
|
showTopFilters.value ? (openBlock(), createBlock(_sfc_main$H, {
|
|
25229
25306
|
key: 0,
|
|
25230
25307
|
options: (_a = _ctx.options.filters) != null ? _a : {}
|
|
@@ -25244,7 +25321,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
25244
25321
|
expandable: !desktopFiltersExpanded.value
|
|
25245
25322
|
}, null, 8, ["class", "options", "expandable"])) : createCommentVNode("", true)
|
|
25246
25323
|
], 64)) : createCommentVNode("", true),
|
|
25247
|
-
unref(hasResults) ? (openBlock(), createElementBlock(Fragment, { key:
|
|
25324
|
+
unref(hasResults) ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
|
|
25248
25325
|
createVNode(_sfc_main$B, {
|
|
25249
25326
|
class: "lupa-toolbar-top",
|
|
25250
25327
|
options: _ctx.options,
|
|
@@ -25429,9 +25506,12 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
25429
25506
|
const dynamicDataStore = useDynamicDataStore();
|
|
25430
25507
|
const screenStore = useScreenStore();
|
|
25431
25508
|
const redirectionStore = useRedirectionStore();
|
|
25509
|
+
const extractedInitialFilters = computed(() => {
|
|
25510
|
+
return __spreadValues2({}, processExtractionObject(props.options.initialFilters));
|
|
25511
|
+
});
|
|
25432
25512
|
const initialFilters = computed(() => {
|
|
25433
|
-
var _a;
|
|
25434
|
-
return (_a = props.initialFilters) != null ? _a : {};
|
|
25513
|
+
var _a, _b;
|
|
25514
|
+
return (_b = (_a = props.initialFilters) != null ? _a : extractedInitialFilters.value) != null ? _b : {};
|
|
25435
25515
|
});
|
|
25436
25516
|
const { currentQueryText, hasResults, currentFilterCount } = storeToRefs(searchResultStore);
|
|
25437
25517
|
const { searchString, sortParams } = storeToRefs(paramStore);
|
|
@@ -25737,62 +25817,6 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
25737
25817
|
};
|
|
25738
25818
|
}
|
|
25739
25819
|
});
|
|
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
25820
|
const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
25797
25821
|
__name: "ProductList",
|
|
25798
25822
|
props: {
|
|
@@ -25812,7 +25836,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
25812
25836
|
var _a;
|
|
25813
25837
|
(_a = searchResults2.value) == null ? void 0 : _a.handleMounted();
|
|
25814
25838
|
};
|
|
25815
|
-
computed(() => {
|
|
25839
|
+
const initialFilters = computed(() => {
|
|
25816
25840
|
return __spreadValues2({}, processExtractionObject(props.options.initialFilters));
|
|
25817
25841
|
});
|
|
25818
25842
|
__expose({ fetch: fetch2 });
|
|
@@ -25820,7 +25844,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
25820
25844
|
return openBlock(), createElementBlock("div", null, [
|
|
25821
25845
|
createVNode(_sfc_main$e, {
|
|
25822
25846
|
options: componentOptions.value,
|
|
25823
|
-
"initial-filters":
|
|
25847
|
+
"initial-filters": initialFilters.value,
|
|
25824
25848
|
"is-product-list": true,
|
|
25825
25849
|
ref_key: "searchResults",
|
|
25826
25850
|
ref: searchResults2
|
|
@@ -30208,7 +30232,7 @@ lodash$1.exports;
|
|
|
30208
30232
|
});
|
|
30209
30233
|
return result3;
|
|
30210
30234
|
}
|
|
30211
|
-
var
|
|
30235
|
+
var merge2 = createAssigner(function(object, source, srcIndex) {
|
|
30212
30236
|
baseMerge(object, source, srcIndex);
|
|
30213
30237
|
});
|
|
30214
30238
|
var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
|
|
@@ -30898,7 +30922,7 @@ lodash$1.exports;
|
|
|
30898
30922
|
lodash2.matches = matches;
|
|
30899
30923
|
lodash2.matchesProperty = matchesProperty;
|
|
30900
30924
|
lodash2.memoize = memoize;
|
|
30901
|
-
lodash2.merge =
|
|
30925
|
+
lodash2.merge = merge2;
|
|
30902
30926
|
lodash2.mergeWith = mergeWith;
|
|
30903
30927
|
lodash2.method = method;
|
|
30904
30928
|
lodash2.methodOf = methodOf;
|
|
@@ -37734,7 +37758,7 @@ lodash.exports;
|
|
|
37734
37758
|
});
|
|
37735
37759
|
return result3;
|
|
37736
37760
|
}
|
|
37737
|
-
var
|
|
37761
|
+
var merge2 = createAssigner(function(object, source, srcIndex) {
|
|
37738
37762
|
baseMerge(object, source, srcIndex);
|
|
37739
37763
|
});
|
|
37740
37764
|
var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
|
|
@@ -38424,7 +38448,7 @@ lodash.exports;
|
|
|
38424
38448
|
lodash2.matches = matches;
|
|
38425
38449
|
lodash2.matchesProperty = matchesProperty;
|
|
38426
38450
|
lodash2.memoize = memoize;
|
|
38427
|
-
lodash2.merge =
|
|
38451
|
+
lodash2.merge = merge2;
|
|
38428
38452
|
lodash2.mergeWith = mergeWith;
|
|
38429
38453
|
lodash2.method = method;
|
|
38430
38454
|
lodash2.methodOf = methodOf;
|
|
@@ -39581,6 +39605,14 @@ const waitForElementToBeVisible = (element, retries = 0, maxRetries = 30, interv
|
|
|
39581
39605
|
}, interval);
|
|
39582
39606
|
});
|
|
39583
39607
|
});
|
|
39608
|
+
const isObject = (item) => typeof item === "object" && !Array.isArray(item);
|
|
39609
|
+
const merge = (target, source) => {
|
|
39610
|
+
const isDeep = (prop) => isObject(source[prop]) && Object.prototype.hasOwnProperty.call(target, prop) && isObject(target[prop]);
|
|
39611
|
+
const replaced = Object.getOwnPropertyNames(source).map((prop) => ({
|
|
39612
|
+
[prop]: isDeep(prop) ? merge(target[prop], source[prop]) : source[prop]
|
|
39613
|
+
})).reduce((a, b) => __spreadValues(__spreadValues({}, a), b), {});
|
|
39614
|
+
return __spreadValues(__spreadValues({}, target), replaced);
|
|
39615
|
+
};
|
|
39584
39616
|
const saveToLocalStorage = (key, value) => {
|
|
39585
39617
|
try {
|
|
39586
39618
|
localStorage.setItem(key, JSON.stringify(value));
|
|
@@ -39632,7 +39664,7 @@ const getQueryParam = (name) => {
|
|
|
39632
39664
|
const PREVIEW_PARAMETER = "lupaSearchPreview";
|
|
39633
39665
|
const MAX_ELEMENT_MOUNT_RETRIES = 25;
|
|
39634
39666
|
let styleElement = null;
|
|
39635
|
-
const loadAndSaveConfigurationFromServer = (
|
|
39667
|
+
const loadAndSaveConfigurationFromServer = (_0, ..._1) => __async(void 0, [_0, ..._1], function* (configurationKey, options = { environment: "production" }) {
|
|
39636
39668
|
const configuration = yield fetchPluginConfiguration(
|
|
39637
39669
|
options,
|
|
39638
39670
|
configurationKey
|
|
@@ -39657,7 +39689,7 @@ const checkIsPreviewMode = () => {
|
|
|
39657
39689
|
}
|
|
39658
39690
|
return isPreviewMode;
|
|
39659
39691
|
};
|
|
39660
|
-
const loadConfigurations = (configurationKey, isPreviewMode, options) => __async(void 0, null, function* () {
|
|
39692
|
+
const loadConfigurations = (configurationKey, isPreviewMode, options, optionOverrides) => __async(void 0, null, function* () {
|
|
39661
39693
|
if (isPreviewMode) {
|
|
39662
39694
|
return loadAndSaveConfigurationFromServer(configurationKey, options);
|
|
39663
39695
|
}
|
|
@@ -39675,7 +39707,7 @@ const loadConfigurations = (configurationKey, isPreviewMode, options) => __async
|
|
|
39675
39707
|
const isPreviewMode2 = checkIsPreviewMode();
|
|
39676
39708
|
const configuration = isPreviewMode2 ? (_a = newestConfiguration.previewConfiguration) != null ? _a : newestConfiguration.configuration : newestConfiguration.configuration;
|
|
39677
39709
|
if (configuration) {
|
|
39678
|
-
yield mount(configuration, options, false, true);
|
|
39710
|
+
yield mount(configuration, options, optionOverrides, false, true);
|
|
39679
39711
|
} else {
|
|
39680
39712
|
removeFromLocalStorage(configurationKey);
|
|
39681
39713
|
window.location.reload();
|
|
@@ -39706,7 +39738,8 @@ const applyStyles = (configuration) => __async(void 0, null, function* () {
|
|
|
39706
39738
|
}
|
|
39707
39739
|
document.head.appendChild(styleElement);
|
|
39708
39740
|
});
|
|
39709
|
-
const mountSearchBox = (configuration, options, fetch2 = true, remount = false) => __async(void 0, null, function* () {
|
|
39741
|
+
const mountSearchBox = (configuration, options, optionOverrides, fetch2 = true, remount = false) => __async(void 0, null, function* () {
|
|
39742
|
+
var _a;
|
|
39710
39743
|
if (!configuration.searchBox) {
|
|
39711
39744
|
return;
|
|
39712
39745
|
}
|
|
@@ -39723,9 +39756,11 @@ const mountSearchBox = (configuration, options, fetch2 = true, remount = false)
|
|
|
39723
39756
|
);
|
|
39724
39757
|
return;
|
|
39725
39758
|
}
|
|
39726
|
-
|
|
39759
|
+
const mergedOptions = merge(resolvedConfiguration, (_a = optionOverrides == null ? void 0 : optionOverrides.searchBox) != null ? _a : {});
|
|
39760
|
+
searchBox(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
|
|
39727
39761
|
});
|
|
39728
|
-
const mountSearchResults = (configuration, options, fetch2 = true, remount = false) => __async(void 0, null, function* () {
|
|
39762
|
+
const mountSearchResults = (configuration, options, optionOverrides, fetch2 = true, remount = false) => __async(void 0, null, function* () {
|
|
39763
|
+
var _a;
|
|
39729
39764
|
if (!configuration.searchResults) {
|
|
39730
39765
|
return;
|
|
39731
39766
|
}
|
|
@@ -39742,9 +39777,11 @@ const mountSearchResults = (configuration, options, fetch2 = true, remount = fal
|
|
|
39742
39777
|
);
|
|
39743
39778
|
return;
|
|
39744
39779
|
}
|
|
39745
|
-
|
|
39780
|
+
const mergedOptions = merge(resolvedConfiguration, (_a = optionOverrides == null ? void 0 : optionOverrides.searchResults) != null ? _a : {});
|
|
39781
|
+
searchResults(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
|
|
39746
39782
|
});
|
|
39747
|
-
const mountProductList = (configuration, options, fetch2 = true, remount = false) => __async(void 0, null, function* () {
|
|
39783
|
+
const mountProductList = (configuration, options, optionOverrides, fetch2 = true, remount = false) => __async(void 0, null, function* () {
|
|
39784
|
+
var _a;
|
|
39748
39785
|
if (!configuration.productList) {
|
|
39749
39786
|
return;
|
|
39750
39787
|
}
|
|
@@ -39764,12 +39801,14 @@ const mountProductList = (configuration, options, fetch2 = true, remount = false
|
|
|
39764
39801
|
);
|
|
39765
39802
|
return;
|
|
39766
39803
|
}
|
|
39767
|
-
|
|
39768
|
-
|
|
39769
|
-
|
|
39804
|
+
const mergedOptions = merge(
|
|
39805
|
+
__spreadValues(__spreadValues({}, resolvedSearchResultsConfiguration), resolvedConfiguration),
|
|
39806
|
+
(_a = optionOverrides == null ? void 0 : optionOverrides.productList) != null ? _a : {}
|
|
39770
39807
|
);
|
|
39808
|
+
productList(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
|
|
39771
39809
|
});
|
|
39772
|
-
const mountRecommendations = (configuration, options, fetch2 = true, remount = false) => __async(void 0, null, function* () {
|
|
39810
|
+
const mountRecommendations = (configuration, options, optionOverrides, fetch2 = true, remount = false) => __async(void 0, null, function* () {
|
|
39811
|
+
var _a;
|
|
39773
39812
|
if (!configuration.recommendations) {
|
|
39774
39813
|
return;
|
|
39775
39814
|
}
|
|
@@ -39791,10 +39830,11 @@ const mountRecommendations = (configuration, options, fetch2 = true, remount = f
|
|
|
39791
39830
|
);
|
|
39792
39831
|
return;
|
|
39793
39832
|
}
|
|
39794
|
-
|
|
39795
|
-
|
|
39796
|
-
|
|
39833
|
+
const mergedOptions = merge(
|
|
39834
|
+
__spreadValues(__spreadValues({}, resolvedSearchResultsConfiguration), resolvedConfiguration),
|
|
39835
|
+
(_a = optionOverrides == null ? void 0 : optionOverrides.recommendations) != null ? _a : {}
|
|
39797
39836
|
);
|
|
39837
|
+
recommendations(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
|
|
39798
39838
|
});
|
|
39799
39839
|
const mountChat = (configuration, options, fetch2 = true, remount = false) => __async(void 0, null, function* () {
|
|
39800
39840
|
if (!configuration.genAiChat) {
|
|
@@ -39821,24 +39861,24 @@ const mountChat = (configuration, options, fetch2 = true, remount = false) => __
|
|
|
39821
39861
|
{ fetch: fetch2, allowedMountUrls }
|
|
39822
39862
|
);
|
|
39823
39863
|
});
|
|
39824
|
-
const mount = (
|
|
39864
|
+
const mount = (_0, ..._1) => __async(void 0, [_0, ..._1], function* (configuration, options = { environment: "production" }, optionOverrides = {}, fetch2 = true, remount = false) {
|
|
39825
39865
|
yield applyStyles(configuration);
|
|
39826
39866
|
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),
|
|
39867
|
+
mountSearchBox(configuration, options, optionOverrides, fetch2, remount),
|
|
39868
|
+
mountSearchResults(configuration, options, optionOverrides, fetch2, remount),
|
|
39869
|
+
mountProductList(configuration, options, optionOverrides, fetch2, remount),
|
|
39870
|
+
mountRecommendations(configuration, options, optionOverrides, fetch2, remount),
|
|
39831
39871
|
mountChat(configuration, options, fetch2, remount)
|
|
39832
39872
|
];
|
|
39833
39873
|
yield Promise.all(mountPromises);
|
|
39834
39874
|
});
|
|
39835
|
-
const init$1 = (
|
|
39875
|
+
const init$1 = (_0, ..._1) => __async(void 0, [_0, ..._1], function* (configurationKey, options = { environment: "production" }, optionOverrides = {}) {
|
|
39836
39876
|
var _a;
|
|
39837
39877
|
const isPreviewMode = checkIsPreviewMode();
|
|
39838
|
-
const plugin2 = yield loadConfigurations(configurationKey, isPreviewMode, options);
|
|
39878
|
+
const plugin2 = yield loadConfigurations(configurationKey, isPreviewMode, options, optionOverrides);
|
|
39839
39879
|
const configuration = isPreviewMode ? (_a = plugin2.previewConfiguration) != null ? _a : plugin2.configuration : plugin2.configuration;
|
|
39840
39880
|
if (configuration) {
|
|
39841
|
-
yield mount(configuration, options);
|
|
39881
|
+
yield mount(configuration, options, optionOverrides);
|
|
39842
39882
|
}
|
|
39843
39883
|
});
|
|
39844
39884
|
const PluginConfigurationManager = {
|
|
@@ -39847,8 +39887,8 @@ const PluginConfigurationManager = {
|
|
|
39847
39887
|
const tracking = (options) => {
|
|
39848
39888
|
setupTracking(options);
|
|
39849
39889
|
};
|
|
39850
|
-
const init = (configurationKey, options) => {
|
|
39851
|
-
return PluginConfigurationManager.init(configurationKey, options);
|
|
39890
|
+
const init = (configurationKey, options, optionOverrides) => {
|
|
39891
|
+
return PluginConfigurationManager.init(configurationKey, options, optionOverrides);
|
|
39852
39892
|
};
|
|
39853
39893
|
const lupaSearch = {
|
|
39854
39894
|
init,
|