@getlupa/client 1.13.7 → 1.13.8
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 +398 -341
- package/dist/lupaSearch.js +398 -341
- package/dist/lupaSearch.mjs +398 -341
- package/dist/lupaSearch.umd.js +398 -341
- package/dist/src/utils/document.utils.d.ts +1 -0
- package/dist/src/utils/storage.utils.d.ts +2 -0
- package/package.json +1 -1
package/dist/lupaSearch.umd.js
CHANGED
|
@@ -1548,12 +1548,12 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
1548
1548
|
}
|
|
1549
1549
|
return normalized;
|
|
1550
1550
|
}
|
|
1551
|
-
function isEmitListener(
|
|
1552
|
-
if (!
|
|
1551
|
+
function isEmitListener(options2, key) {
|
|
1552
|
+
if (!options2 || !isOn(key)) {
|
|
1553
1553
|
return false;
|
|
1554
1554
|
}
|
|
1555
1555
|
key = key.slice(2).replace(/Once$/, "");
|
|
1556
|
-
return hasOwn(
|
|
1556
|
+
return hasOwn(options2, key[0].toLowerCase() + key.slice(1)) || hasOwn(options2, hyphenate(key)) || hasOwn(options2, key);
|
|
1557
1557
|
}
|
|
1558
1558
|
let currentRenderingInstance = null;
|
|
1559
1559
|
let currentScopeId = null;
|
|
@@ -1779,8 +1779,8 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
1779
1779
|
}
|
|
1780
1780
|
}
|
|
1781
1781
|
const INITIAL_WATCHER_VALUE = {};
|
|
1782
|
-
function watch(source, cb,
|
|
1783
|
-
return doWatch(source, cb,
|
|
1782
|
+
function watch(source, cb, options2) {
|
|
1783
|
+
return doWatch(source, cb, options2);
|
|
1784
1784
|
}
|
|
1785
1785
|
function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EMPTY_OBJ) {
|
|
1786
1786
|
var _a;
|
|
@@ -1920,7 +1920,7 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
1920
1920
|
ssrCleanup.push(unwatch);
|
|
1921
1921
|
return unwatch;
|
|
1922
1922
|
}
|
|
1923
|
-
function instanceWatch(source, value,
|
|
1923
|
+
function instanceWatch(source, value, options2) {
|
|
1924
1924
|
const publicThis = this.proxy;
|
|
1925
1925
|
const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
|
|
1926
1926
|
let cb;
|
|
@@ -1928,11 +1928,11 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
1928
1928
|
cb = value;
|
|
1929
1929
|
} else {
|
|
1930
1930
|
cb = value.handler;
|
|
1931
|
-
|
|
1931
|
+
options2 = value;
|
|
1932
1932
|
}
|
|
1933
1933
|
const cur = currentInstance;
|
|
1934
1934
|
setCurrentInstance(this);
|
|
1935
|
-
const res = doWatch(getter, cb.bind(publicThis),
|
|
1935
|
+
const res = doWatch(getter, cb.bind(publicThis), options2);
|
|
1936
1936
|
if (cur) {
|
|
1937
1937
|
setCurrentInstance(cur);
|
|
1938
1938
|
} else {
|
|
@@ -2341,12 +2341,12 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
2341
2341
|
}
|
|
2342
2342
|
return ret;
|
|
2343
2343
|
}
|
|
2344
|
-
function defineComponent(
|
|
2345
|
-
return isFunction(
|
|
2344
|
+
function defineComponent(options2, extraOptions) {
|
|
2345
|
+
return isFunction(options2) ? (
|
|
2346
2346
|
// #8326: extend call and options.name access are considered side-effects
|
|
2347
2347
|
// by Rollup, so we have to wrap it in a pure-annotated IIFE.
|
|
2348
|
-
/* @__PURE__ */ (() => extend({ name:
|
|
2349
|
-
) :
|
|
2348
|
+
/* @__PURE__ */ (() => extend({ name: options2.name }, extraOptions, { setup: options2 }))()
|
|
2349
|
+
) : options2;
|
|
2350
2350
|
}
|
|
2351
2351
|
const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
|
|
2352
2352
|
const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
|
|
@@ -2707,12 +2707,12 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
2707
2707
|
}
|
|
2708
2708
|
let shouldCacheAccess = true;
|
|
2709
2709
|
function applyOptions(instance) {
|
|
2710
|
-
const
|
|
2710
|
+
const options2 = resolveMergedOptions(instance);
|
|
2711
2711
|
const publicThis = instance.proxy;
|
|
2712
2712
|
const ctx = instance.ctx;
|
|
2713
2713
|
shouldCacheAccess = false;
|
|
2714
|
-
if (
|
|
2715
|
-
callHook$1(
|
|
2714
|
+
if (options2.beforeCreate) {
|
|
2715
|
+
callHook$1(options2.beforeCreate, instance, "bc");
|
|
2716
2716
|
}
|
|
2717
2717
|
const {
|
|
2718
2718
|
// state
|
|
@@ -2746,7 +2746,7 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
2746
2746
|
components,
|
|
2747
2747
|
directives,
|
|
2748
2748
|
filters
|
|
2749
|
-
} =
|
|
2749
|
+
} = options2;
|
|
2750
2750
|
const checkDuplicateProperties = null;
|
|
2751
2751
|
if (injectOptions) {
|
|
2752
2752
|
resolveInjections(injectOptions, ctx, checkDuplicateProperties);
|
|
@@ -3090,15 +3090,15 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
3090
3090
|
},
|
|
3091
3091
|
set config(v) {
|
|
3092
3092
|
},
|
|
3093
|
-
use(plugin, ...
|
|
3093
|
+
use(plugin, ...options2) {
|
|
3094
3094
|
if (installedPlugins.has(plugin))
|
|
3095
3095
|
;
|
|
3096
3096
|
else if (plugin && isFunction(plugin.install)) {
|
|
3097
3097
|
installedPlugins.add(plugin);
|
|
3098
|
-
plugin.install(app2, ...
|
|
3098
|
+
plugin.install(app2, ...options2);
|
|
3099
3099
|
} else if (isFunction(plugin)) {
|
|
3100
3100
|
installedPlugins.add(plugin);
|
|
3101
|
-
plugin(app2, ...
|
|
3101
|
+
plugin(app2, ...options2);
|
|
3102
3102
|
} else
|
|
3103
3103
|
;
|
|
3104
3104
|
return app2;
|
|
@@ -3222,7 +3222,7 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
3222
3222
|
vnode: { patchFlag }
|
|
3223
3223
|
} = instance;
|
|
3224
3224
|
const rawCurrentProps = toRaw(props);
|
|
3225
|
-
const [
|
|
3225
|
+
const [options2] = instance.propsOptions;
|
|
3226
3226
|
let hasAttrsChanged = false;
|
|
3227
3227
|
if (
|
|
3228
3228
|
// always force full diff in dev
|
|
@@ -3238,7 +3238,7 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
3238
3238
|
continue;
|
|
3239
3239
|
}
|
|
3240
3240
|
const value = rawProps[key];
|
|
3241
|
-
if (
|
|
3241
|
+
if (options2) {
|
|
3242
3242
|
if (hasOwn(attrs, key)) {
|
|
3243
3243
|
if (value !== attrs[key]) {
|
|
3244
3244
|
attrs[key] = value;
|
|
@@ -3247,7 +3247,7 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
3247
3247
|
} else {
|
|
3248
3248
|
const camelizedKey = camelize(key);
|
|
3249
3249
|
props[camelizedKey] = resolvePropValue(
|
|
3250
|
-
|
|
3250
|
+
options2,
|
|
3251
3251
|
rawCurrentProps,
|
|
3252
3252
|
camelizedKey,
|
|
3253
3253
|
value,
|
|
@@ -3274,12 +3274,12 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
3274
3274
|
!hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
|
|
3275
3275
|
// and converted to camelCase (#955)
|
|
3276
3276
|
((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
|
|
3277
|
-
if (
|
|
3277
|
+
if (options2) {
|
|
3278
3278
|
if (rawPrevProps && // for camelCase
|
|
3279
3279
|
(rawPrevProps[key] !== void 0 || // for kebab-case
|
|
3280
3280
|
rawPrevProps[kebabKey] !== void 0)) {
|
|
3281
3281
|
props[key] = resolvePropValue(
|
|
3282
|
-
|
|
3282
|
+
options2,
|
|
3283
3283
|
rawCurrentProps,
|
|
3284
3284
|
key,
|
|
3285
3285
|
void 0,
|
|
@@ -3307,7 +3307,7 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
3307
3307
|
}
|
|
3308
3308
|
}
|
|
3309
3309
|
function setFullProps(instance, rawProps, props, attrs) {
|
|
3310
|
-
const [
|
|
3310
|
+
const [options2, needCastKeys] = instance.propsOptions;
|
|
3311
3311
|
let hasAttrsChanged = false;
|
|
3312
3312
|
let rawCastValues;
|
|
3313
3313
|
if (rawProps) {
|
|
@@ -3317,7 +3317,7 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
3317
3317
|
}
|
|
3318
3318
|
const value = rawProps[key];
|
|
3319
3319
|
let camelKey;
|
|
3320
|
-
if (
|
|
3320
|
+
if (options2 && hasOwn(options2, camelKey = camelize(key))) {
|
|
3321
3321
|
if (!needCastKeys || !needCastKeys.includes(camelKey)) {
|
|
3322
3322
|
props[camelKey] = value;
|
|
3323
3323
|
} else {
|
|
@@ -3337,7 +3337,7 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
3337
3337
|
for (let i = 0; i < needCastKeys.length; i++) {
|
|
3338
3338
|
const key = needCastKeys[i];
|
|
3339
3339
|
props[key] = resolvePropValue(
|
|
3340
|
-
|
|
3340
|
+
options2,
|
|
3341
3341
|
rawCurrentProps,
|
|
3342
3342
|
key,
|
|
3343
3343
|
castValues[key],
|
|
@@ -3348,8 +3348,8 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
3348
3348
|
}
|
|
3349
3349
|
return hasAttrsChanged;
|
|
3350
3350
|
}
|
|
3351
|
-
function resolvePropValue(
|
|
3352
|
-
const opt =
|
|
3351
|
+
function resolvePropValue(options2, props, key, value, instance, isAbsent) {
|
|
3352
|
+
const opt = options2[key];
|
|
3353
3353
|
if (opt != null) {
|
|
3354
3354
|
const hasDefault = hasOwn(opt, "default");
|
|
3355
3355
|
if (hasDefault && value === void 0) {
|
|
@@ -3643,10 +3643,10 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
3643
3643
|
}
|
|
3644
3644
|
}
|
|
3645
3645
|
const queuePostRenderEffect = queueEffectWithSuspense;
|
|
3646
|
-
function createRenderer(
|
|
3647
|
-
return baseCreateRenderer(
|
|
3646
|
+
function createRenderer(options2) {
|
|
3647
|
+
return baseCreateRenderer(options2);
|
|
3648
3648
|
}
|
|
3649
|
-
function baseCreateRenderer(
|
|
3649
|
+
function baseCreateRenderer(options2, createHydrationFns) {
|
|
3650
3650
|
const target = getGlobalThis();
|
|
3651
3651
|
target.__VUE__ = true;
|
|
3652
3652
|
const {
|
|
@@ -3662,7 +3662,7 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
3662
3662
|
nextSibling: hostNextSibling,
|
|
3663
3663
|
setScopeId: hostSetScopeId = NOOP,
|
|
3664
3664
|
insertStaticContent: hostInsertStaticContent
|
|
3665
|
-
} =
|
|
3665
|
+
} = options2;
|
|
3666
3666
|
const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, isSVG = false, slotScopeIds = null, optimized = !!n2.dynamicChildren) => {
|
|
3667
3667
|
if (n1 === n2) {
|
|
3668
3668
|
return;
|
|
@@ -4882,7 +4882,7 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
4882
4882
|
pc: patchChildren,
|
|
4883
4883
|
pbc: patchBlockChildren,
|
|
4884
4884
|
n: getNextHostNode,
|
|
4885
|
-
o:
|
|
4885
|
+
o: options2
|
|
4886
4886
|
};
|
|
4887
4887
|
let hydrate;
|
|
4888
4888
|
let hydrateNode;
|
|
@@ -5785,11 +5785,11 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
5785
5785
|
}
|
|
5786
5786
|
needRemove && el.removeAttribute(key);
|
|
5787
5787
|
}
|
|
5788
|
-
function addEventListener(el, event, handler,
|
|
5789
|
-
el.addEventListener(event, handler,
|
|
5788
|
+
function addEventListener(el, event, handler, options2) {
|
|
5789
|
+
el.addEventListener(event, handler, options2);
|
|
5790
5790
|
}
|
|
5791
|
-
function removeEventListener(el, event, handler,
|
|
5792
|
-
el.removeEventListener(event, handler,
|
|
5791
|
+
function removeEventListener(el, event, handler, options2) {
|
|
5792
|
+
el.removeEventListener(event, handler, options2);
|
|
5793
5793
|
}
|
|
5794
5794
|
function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
|
|
5795
5795
|
const invokers = el._vei || (el._vei = {});
|
|
@@ -5797,29 +5797,29 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
5797
5797
|
if (nextValue && existingInvoker) {
|
|
5798
5798
|
existingInvoker.value = nextValue;
|
|
5799
5799
|
} else {
|
|
5800
|
-
const [name,
|
|
5800
|
+
const [name, options2] = parseName(rawName);
|
|
5801
5801
|
if (nextValue) {
|
|
5802
5802
|
const invoker = invokers[rawName] = createInvoker(nextValue, instance);
|
|
5803
|
-
addEventListener(el, name, invoker,
|
|
5803
|
+
addEventListener(el, name, invoker, options2);
|
|
5804
5804
|
} else if (existingInvoker) {
|
|
5805
|
-
removeEventListener(el, name, existingInvoker,
|
|
5805
|
+
removeEventListener(el, name, existingInvoker, options2);
|
|
5806
5806
|
invokers[rawName] = void 0;
|
|
5807
5807
|
}
|
|
5808
5808
|
}
|
|
5809
5809
|
}
|
|
5810
5810
|
const optionsModifierRE = /(?:Once|Passive|Capture)$/;
|
|
5811
5811
|
function parseName(name) {
|
|
5812
|
-
let
|
|
5812
|
+
let options2;
|
|
5813
5813
|
if (optionsModifierRE.test(name)) {
|
|
5814
|
-
|
|
5814
|
+
options2 = {};
|
|
5815
5815
|
let m2;
|
|
5816
5816
|
while (m2 = name.match(optionsModifierRE)) {
|
|
5817
5817
|
name = name.slice(0, name.length - m2[0].length);
|
|
5818
|
-
|
|
5818
|
+
options2[m2[0].toLowerCase()] = true;
|
|
5819
5819
|
}
|
|
5820
5820
|
}
|
|
5821
5821
|
const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2));
|
|
5822
|
-
return [event,
|
|
5822
|
+
return [event, options2];
|
|
5823
5823
|
}
|
|
5824
5824
|
let cachedNow = 0;
|
|
5825
5825
|
const p$1 = /* @__PURE__ */ Promise.resolve();
|
|
@@ -6498,8 +6498,8 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
6498
6498
|
function isComputed(o) {
|
|
6499
6499
|
return !!(isRef(o) && o.effect);
|
|
6500
6500
|
}
|
|
6501
|
-
function createOptionsStore(id,
|
|
6502
|
-
const { state, actions, getters } =
|
|
6501
|
+
function createOptionsStore(id, options2, pinia, hot) {
|
|
6502
|
+
const { state, actions, getters } = options2;
|
|
6503
6503
|
const initialState = pinia.state.value[id];
|
|
6504
6504
|
let store;
|
|
6505
6505
|
function setup() {
|
|
@@ -6518,12 +6518,12 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
6518
6518
|
return computedGetters;
|
|
6519
6519
|
}, {}));
|
|
6520
6520
|
}
|
|
6521
|
-
store = createSetupStore(id, setup,
|
|
6521
|
+
store = createSetupStore(id, setup, options2, pinia, hot, true);
|
|
6522
6522
|
return store;
|
|
6523
6523
|
}
|
|
6524
|
-
function createSetupStore($id, setup,
|
|
6524
|
+
function createSetupStore($id, setup, options2 = {}, pinia, hot, isOptionsStore) {
|
|
6525
6525
|
let scope;
|
|
6526
|
-
const optionsForPlugin = assign({ actions: {} },
|
|
6526
|
+
const optionsForPlugin = assign({ actions: {} }, options2);
|
|
6527
6527
|
const $subscribeOptions = {
|
|
6528
6528
|
deep: true
|
|
6529
6529
|
// flush: 'post',
|
|
@@ -6570,7 +6570,7 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
6570
6570
|
triggerSubscriptions(subscriptions, subscriptionMutation, pinia.state.value[$id]);
|
|
6571
6571
|
}
|
|
6572
6572
|
const $reset = isOptionsStore ? function $reset2() {
|
|
6573
|
-
const { state } =
|
|
6573
|
+
const { state } = options2;
|
|
6574
6574
|
const newState = state ? state() : {};
|
|
6575
6575
|
this.$patch(($state) => {
|
|
6576
6576
|
assign($state, newState);
|
|
@@ -6631,17 +6631,17 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
6631
6631
|
$onAction: addSubscription.bind(null, actionSubscriptions),
|
|
6632
6632
|
$patch,
|
|
6633
6633
|
$reset,
|
|
6634
|
-
$subscribe(callback,
|
|
6635
|
-
const removeSubscription = addSubscription(subscriptions, callback,
|
|
6634
|
+
$subscribe(callback, options22 = {}) {
|
|
6635
|
+
const removeSubscription = addSubscription(subscriptions, callback, options22.detached, () => stopWatcher());
|
|
6636
6636
|
const stopWatcher = scope.run(() => watch(() => pinia.state.value[$id], (state) => {
|
|
6637
|
-
if (
|
|
6637
|
+
if (options22.flush === "sync" ? isSyncListening : isListening) {
|
|
6638
6638
|
callback({
|
|
6639
6639
|
storeId: $id,
|
|
6640
6640
|
type: MutationType.direct,
|
|
6641
6641
|
events: debuggerEvents
|
|
6642
6642
|
}, state);
|
|
6643
6643
|
}
|
|
6644
|
-
}, assign({}, $subscribeOptions,
|
|
6644
|
+
}, assign({}, $subscribeOptions, options22)));
|
|
6645
6645
|
return removeSubscription;
|
|
6646
6646
|
},
|
|
6647
6647
|
$dispose
|
|
@@ -6699,8 +6699,8 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
6699
6699
|
})));
|
|
6700
6700
|
}
|
|
6701
6701
|
});
|
|
6702
|
-
if (initialState && isOptionsStore &&
|
|
6703
|
-
|
|
6702
|
+
if (initialState && isOptionsStore && options2.hydrate) {
|
|
6703
|
+
options2.hydrate(store.$state, initialState);
|
|
6704
6704
|
}
|
|
6705
6705
|
isListening = true;
|
|
6706
6706
|
isSyncListening = true;
|
|
@@ -6708,13 +6708,13 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
6708
6708
|
}
|
|
6709
6709
|
function defineStore(idOrOptions, setup, setupOptions) {
|
|
6710
6710
|
let id;
|
|
6711
|
-
let
|
|
6711
|
+
let options2;
|
|
6712
6712
|
const isSetupStore = typeof setup === "function";
|
|
6713
6713
|
if (typeof idOrOptions === "string") {
|
|
6714
6714
|
id = idOrOptions;
|
|
6715
|
-
|
|
6715
|
+
options2 = isSetupStore ? setupOptions : setup;
|
|
6716
6716
|
} else {
|
|
6717
|
-
|
|
6717
|
+
options2 = idOrOptions;
|
|
6718
6718
|
id = idOrOptions.id;
|
|
6719
6719
|
}
|
|
6720
6720
|
function useStore(pinia, hot) {
|
|
@@ -6727,9 +6727,9 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
6727
6727
|
pinia = activePinia;
|
|
6728
6728
|
if (!pinia._s.has(id)) {
|
|
6729
6729
|
if (isSetupStore) {
|
|
6730
|
-
createSetupStore(id, setup,
|
|
6730
|
+
createSetupStore(id, setup, options2, pinia);
|
|
6731
6731
|
} else {
|
|
6732
|
-
createOptionsStore(id,
|
|
6732
|
+
createOptionsStore(id, options2, pinia);
|
|
6733
6733
|
}
|
|
6734
6734
|
}
|
|
6735
6735
|
const store = pinia._s.get(id);
|
|
@@ -6845,9 +6845,9 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
6845
6845
|
headers: Object.assign(Object.assign({}, defaultConfig.headers), customHeaders !== null && customHeaders !== void 0 ? customHeaders : {})
|
|
6846
6846
|
};
|
|
6847
6847
|
};
|
|
6848
|
-
const searchCustom = (query,
|
|
6848
|
+
const searchCustom = (query, options2) => __awaiter(void 0, void 0, void 0, function* () {
|
|
6849
6849
|
var _a;
|
|
6850
|
-
const res = yield fetch(
|
|
6850
|
+
const res = yield fetch(options2.customUrl, Object.assign(Object.assign({}, customRequestConfig({ customHeaders: options2.customHeaders })), { body: JSON.stringify(Object.assign({ publicQuery: query }, (_a = options2.customPayload) !== null && _a !== void 0 ? _a : {})) }));
|
|
6851
6851
|
if (res.status < 400) {
|
|
6852
6852
|
const data = yield res.json();
|
|
6853
6853
|
return Object.assign(Object.assign({}, data), { success: true });
|
|
@@ -6855,9 +6855,9 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
6855
6855
|
const errors = yield res.json();
|
|
6856
6856
|
return { success: false, errors };
|
|
6857
6857
|
});
|
|
6858
|
-
const suggestCustom = (query,
|
|
6858
|
+
const suggestCustom = (query, options2) => __awaiter(void 0, void 0, void 0, function* () {
|
|
6859
6859
|
var _b;
|
|
6860
|
-
const res = yield fetch(
|
|
6860
|
+
const res = yield fetch(options2.customUrl, Object.assign(Object.assign({}, customRequestConfig({ customHeaders: options2.customHeaders })), { body: JSON.stringify(Object.assign({ publicQuery: query }, (_b = options2.customPayload) !== null && _b !== void 0 ? _b : {})) }));
|
|
6861
6861
|
if (res.status < 400) {
|
|
6862
6862
|
const items = yield res.json();
|
|
6863
6863
|
return { items, success: true };
|
|
@@ -6943,29 +6943,29 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
6943
6943
|
return { success: false, errors };
|
|
6944
6944
|
});
|
|
6945
6945
|
const LupaSearchSdk = {
|
|
6946
|
-
query: (queryKey, publicQuery,
|
|
6947
|
-
if (
|
|
6948
|
-
return searchCustom(publicQuery,
|
|
6946
|
+
query: (queryKey, publicQuery, options2 = null) => {
|
|
6947
|
+
if (options2 === null || options2 === void 0 ? void 0 : options2.customUrl) {
|
|
6948
|
+
return searchCustom(publicQuery, options2);
|
|
6949
6949
|
}
|
|
6950
|
-
return search(queryKey, publicQuery, (
|
|
6950
|
+
return search(queryKey, publicQuery, (options2 === null || options2 === void 0 ? void 0 : options2.environment) || "production", options2 === null || options2 === void 0 ? void 0 : options2.customBaseUrl);
|
|
6951
6951
|
},
|
|
6952
|
-
suggestions: (queryKey, suggestionQuery,
|
|
6953
|
-
if (
|
|
6954
|
-
return suggestCustom(suggestionQuery,
|
|
6952
|
+
suggestions: (queryKey, suggestionQuery, options2 = null) => {
|
|
6953
|
+
if (options2 === null || options2 === void 0 ? void 0 : options2.customUrl) {
|
|
6954
|
+
return suggestCustom(suggestionQuery, options2);
|
|
6955
6955
|
}
|
|
6956
|
-
return suggest(queryKey, suggestionQuery, (
|
|
6956
|
+
return suggest(queryKey, suggestionQuery, (options2 === null || options2 === void 0 ? void 0 : options2.environment) || "production", options2 === null || options2 === void 0 ? void 0 : options2.customBaseUrl);
|
|
6957
6957
|
},
|
|
6958
|
-
track: (queryKey, eventData,
|
|
6959
|
-
return track$1(queryKey, eventData, (
|
|
6958
|
+
track: (queryKey, eventData, options2 = null) => {
|
|
6959
|
+
return track$1(queryKey, eventData, (options2 === null || options2 === void 0 ? void 0 : options2.environment) || "production", options2 === null || options2 === void 0 ? void 0 : options2.customBaseUrl);
|
|
6960
6960
|
},
|
|
6961
|
-
recommend: (queryKey, recommendForId, filters,
|
|
6962
|
-
return recommend(queryKey, recommendForId, filters, (
|
|
6961
|
+
recommend: (queryKey, recommendForId, filters, options2 = null) => {
|
|
6962
|
+
return recommend(queryKey, recommendForId, filters, (options2 === null || options2 === void 0 ? void 0 : options2.environment) || "production", options2 === null || options2 === void 0 ? void 0 : options2.customBaseUrl);
|
|
6963
6963
|
},
|
|
6964
|
-
queryByIds: (queryKey, ids,
|
|
6965
|
-
return queryByIds(queryKey, ids, (
|
|
6964
|
+
queryByIds: (queryKey, ids, options2 = null) => {
|
|
6965
|
+
return queryByIds(queryKey, ids, (options2 === null || options2 === void 0 ? void 0 : options2.environment) || "production", options2 === null || options2 === void 0 ? void 0 : options2.customBaseUrl);
|
|
6966
6966
|
},
|
|
6967
|
-
loadRedirectionRules: (queryKey,
|
|
6968
|
-
return loadRedirectionRules(queryKey, (
|
|
6967
|
+
loadRedirectionRules: (queryKey, options2 = null) => {
|
|
6968
|
+
return loadRedirectionRules(queryKey, (options2 === null || options2 === void 0 ? void 0 : options2.environment) || "production", options2 === null || options2 === void 0 ? void 0 : options2.customBaseUrl);
|
|
6969
6969
|
}
|
|
6970
6970
|
};
|
|
6971
6971
|
const getNormalizedString = (str) => {
|
|
@@ -7160,20 +7160,20 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
7160
7160
|
return void 0;
|
|
7161
7161
|
}
|
|
7162
7162
|
};
|
|
7163
|
-
const initTracking = (
|
|
7164
|
-
initBaseTracking(Boolean(
|
|
7165
|
-
if (
|
|
7163
|
+
const initTracking = (options2) => {
|
|
7164
|
+
initBaseTracking(Boolean(options2.trackBase));
|
|
7165
|
+
if (options2.trackSession) {
|
|
7166
7166
|
initSessionTracking();
|
|
7167
7167
|
} else {
|
|
7168
7168
|
clearSessionTracking();
|
|
7169
7169
|
}
|
|
7170
|
-
if (
|
|
7171
|
-
initUserTracking(
|
|
7170
|
+
if (options2.trackUser) {
|
|
7171
|
+
initUserTracking(options2.userKey);
|
|
7172
7172
|
} else {
|
|
7173
7173
|
clearUserTracking();
|
|
7174
7174
|
}
|
|
7175
|
-
if (
|
|
7176
|
-
initAnalyticsTracking(
|
|
7175
|
+
if (options2.analytics) {
|
|
7176
|
+
initAnalyticsTracking(options2.analytics);
|
|
7177
7177
|
}
|
|
7178
7178
|
};
|
|
7179
7179
|
const getLupaTrackingContext = () => {
|
|
@@ -7185,7 +7185,7 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
7185
7185
|
sessionId: getSessionKey()
|
|
7186
7186
|
};
|
|
7187
7187
|
};
|
|
7188
|
-
const trackLupaEvent = (queryKey, data = {},
|
|
7188
|
+
const trackLupaEvent = (queryKey, data = {}, options2) => {
|
|
7189
7189
|
var _a, _b;
|
|
7190
7190
|
if (!queryKey || !data.type) {
|
|
7191
7191
|
return;
|
|
@@ -7198,7 +7198,7 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
7198
7198
|
sessionId: getSessionKey(),
|
|
7199
7199
|
filters: data.filters
|
|
7200
7200
|
};
|
|
7201
|
-
LupaSearchSdk.track(queryKey, eventData,
|
|
7201
|
+
LupaSearchSdk.track(queryKey, eventData, options2);
|
|
7202
7202
|
};
|
|
7203
7203
|
const sendGa = (name, ...args) => {
|
|
7204
7204
|
window.ga(() => {
|
|
@@ -7214,24 +7214,24 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
7214
7214
|
const trackAnalyticsEvent = (data) => {
|
|
7215
7215
|
var _a, _b, _c;
|
|
7216
7216
|
try {
|
|
7217
|
-
const
|
|
7217
|
+
const options2 = JSON.parse(
|
|
7218
7218
|
(_a = window.sessionStorage.getItem(TRACKING_ANALYTICS_KEY)) != null ? _a : "{}"
|
|
7219
7219
|
);
|
|
7220
|
-
if (!data.analytics || !
|
|
7220
|
+
if (!data.analytics || !options2.enabled || ((_c = options2.ignoreEvents) == null ? void 0 : _c.includes((_b = data.analytics) == null ? void 0 : _b.type))) {
|
|
7221
7221
|
return;
|
|
7222
7222
|
}
|
|
7223
|
-
switch (
|
|
7223
|
+
switch (options2.type) {
|
|
7224
7224
|
case "ua":
|
|
7225
|
-
sendUaAnalyticsEvent(data,
|
|
7225
|
+
sendUaAnalyticsEvent(data, options2);
|
|
7226
7226
|
break;
|
|
7227
7227
|
case "ga4":
|
|
7228
|
-
sendGa4AnalyticsEvent(data,
|
|
7228
|
+
sendGa4AnalyticsEvent(data, options2);
|
|
7229
7229
|
break;
|
|
7230
7230
|
case "debug":
|
|
7231
7231
|
processDebugEvent(data);
|
|
7232
7232
|
break;
|
|
7233
7233
|
default:
|
|
7234
|
-
sendUaAnalyticsEvent(data,
|
|
7234
|
+
sendUaAnalyticsEvent(data, options2);
|
|
7235
7235
|
}
|
|
7236
7236
|
} catch (e2) {
|
|
7237
7237
|
console.error("Unable to send an event to google analytics");
|
|
@@ -7244,7 +7244,7 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
7244
7244
|
items: (_b = data.analytics) == null ? void 0 : _b.items
|
|
7245
7245
|
} : void 0;
|
|
7246
7246
|
};
|
|
7247
|
-
const sendUaAnalyticsEvent = (data,
|
|
7247
|
+
const sendUaAnalyticsEvent = (data, options2) => {
|
|
7248
7248
|
var _a, _b, _c, _d;
|
|
7249
7249
|
const ga = window.ga;
|
|
7250
7250
|
if (!ga) {
|
|
@@ -7254,12 +7254,12 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
7254
7254
|
sendGa(
|
|
7255
7255
|
"send",
|
|
7256
7256
|
"event",
|
|
7257
|
-
|
|
7257
|
+
options2.parentEventName,
|
|
7258
7258
|
(_b = (_a = data.analytics) == null ? void 0 : _a.type) != null ? _b : "",
|
|
7259
7259
|
(_d = (_c = data.analytics) == null ? void 0 : _c.label) != null ? _d : ""
|
|
7260
7260
|
);
|
|
7261
7261
|
};
|
|
7262
|
-
const sendGa4AnalyticsEvent = (data,
|
|
7262
|
+
const sendGa4AnalyticsEvent = (data, options2) => {
|
|
7263
7263
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
7264
7264
|
if (!window || !window.dataLayer) {
|
|
7265
7265
|
console.error("dataLayer object not found.");
|
|
@@ -7274,7 +7274,7 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
7274
7274
|
ecommerce: parseEcommerceData(data, (_c = data.analytics) == null ? void 0 : _c.listLabel)
|
|
7275
7275
|
}, (_e = (_d = data.analytics) == null ? void 0 : _d.additionalParams) != null ? _e : {});
|
|
7276
7276
|
window.dataLayer.push(__spreadValues({
|
|
7277
|
-
event: (_g = (_f = data.analytics) == null ? void 0 : _f.type) != null ? _g :
|
|
7277
|
+
event: (_g = (_f = data.analytics) == null ? void 0 : _f.type) != null ? _g : options2.parentEventName
|
|
7278
7278
|
}, params));
|
|
7279
7279
|
};
|
|
7280
7280
|
const processDebugEvent = (data) => {
|
|
@@ -7290,7 +7290,7 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
7290
7290
|
};
|
|
7291
7291
|
console.debug("Analytics debug event:", params);
|
|
7292
7292
|
};
|
|
7293
|
-
const track = (queryKey, data = {},
|
|
7293
|
+
const track = (queryKey, data = {}, options2) => {
|
|
7294
7294
|
var _a;
|
|
7295
7295
|
if (!isTrackingEnabled()) {
|
|
7296
7296
|
return;
|
|
@@ -7300,7 +7300,7 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
7300
7300
|
return;
|
|
7301
7301
|
}
|
|
7302
7302
|
trackAnalyticsEvent(data);
|
|
7303
|
-
trackLupaEvent(queryKey, data,
|
|
7303
|
+
trackLupaEvent(queryKey, data, options2);
|
|
7304
7304
|
};
|
|
7305
7305
|
const DEFAULT_SEARCH_BOX_OPTIONS$1 = {
|
|
7306
7306
|
inputSelector: "#searchBox",
|
|
@@ -7548,14 +7548,14 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
7548
7548
|
return pageSizes.xl;
|
|
7549
7549
|
}
|
|
7550
7550
|
});
|
|
7551
|
-
const setSearchBoxOptions = ({ options }) => {
|
|
7552
|
-
searchBoxOptions.value =
|
|
7551
|
+
const setSearchBoxOptions = ({ options: options2 }) => {
|
|
7552
|
+
searchBoxOptions.value = options2;
|
|
7553
7553
|
};
|
|
7554
|
-
const setTrackingOptions = ({ options }) => {
|
|
7555
|
-
trackingOptions.value =
|
|
7554
|
+
const setTrackingOptions = ({ options: options2 }) => {
|
|
7555
|
+
trackingOptions.value = options2;
|
|
7556
7556
|
};
|
|
7557
|
-
const setSearchResultOptions = ({ options }) => {
|
|
7558
|
-
searchResultOptions.value =
|
|
7557
|
+
const setSearchResultOptions = ({ options: options2 }) => {
|
|
7558
|
+
searchResultOptions.value = options2;
|
|
7559
7559
|
};
|
|
7560
7560
|
const setInitialFilters = ({ initialFilters: initialFilters2 }) => {
|
|
7561
7561
|
searchResultInitialFilters.value = initialFilters2;
|
|
@@ -8103,7 +8103,7 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
8103
8103
|
}
|
|
8104
8104
|
return false;
|
|
8105
8105
|
};
|
|
8106
|
-
const initiate = (config,
|
|
8106
|
+
const initiate = (config, options2) => __async(void 0, null, function* () {
|
|
8107
8107
|
var _a, _b, _c, _d;
|
|
8108
8108
|
if ((_a = redirectionOptions.value) == null ? void 0 : _a.enabled) {
|
|
8109
8109
|
return;
|
|
@@ -8117,7 +8117,7 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
8117
8117
|
return;
|
|
8118
8118
|
}
|
|
8119
8119
|
try {
|
|
8120
|
-
const result = yield LupaSearchSdk.loadRedirectionRules(config.queryKey,
|
|
8120
|
+
const result = yield LupaSearchSdk.loadRedirectionRules(config.queryKey, options2);
|
|
8121
8121
|
if (!((_d = result == null ? void 0 : result.rules) == null ? void 0 : _d.length)) {
|
|
8122
8122
|
return;
|
|
8123
8123
|
}
|
|
@@ -8374,7 +8374,7 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
8374
8374
|
return suggestions.reduce((a, c2) => [...a, ...flattenSuggestion(c2, inputValue)], seed);
|
|
8375
8375
|
};
|
|
8376
8376
|
const useSearchBoxStore = defineStore("searchBox", () => {
|
|
8377
|
-
const
|
|
8377
|
+
const options2 = ref(DEFAULT_SEARCH_BOX_OPTIONS$1);
|
|
8378
8378
|
const docResults = ref({});
|
|
8379
8379
|
const suggestionResults = ref({});
|
|
8380
8380
|
const highlightedIndex = ref(-1);
|
|
@@ -8383,10 +8383,10 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
8383
8383
|
const historyStore = useHistoryStore();
|
|
8384
8384
|
const resultsVisible = computed(() => {
|
|
8385
8385
|
var _a;
|
|
8386
|
-
return ((_a = inputValue.value) == null ? void 0 : _a.length) >=
|
|
8386
|
+
return ((_a = inputValue.value) == null ? void 0 : _a.length) >= options2.value.minInputLength;
|
|
8387
8387
|
});
|
|
8388
8388
|
const panelItemCounts = computed(
|
|
8389
|
-
() =>
|
|
8389
|
+
() => options2.value.panels.map((p2) => {
|
|
8390
8390
|
var _a, _b, _c, _d, _e;
|
|
8391
8391
|
if (p2.type === SearchBoxPanelType.SUGGESTION) {
|
|
8392
8392
|
return {
|
|
@@ -8442,7 +8442,7 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
8442
8442
|
const querySuggestions = (_0) => __async(void 0, [_0], function* ({
|
|
8443
8443
|
queryKey,
|
|
8444
8444
|
publicQuery,
|
|
8445
|
-
options:
|
|
8445
|
+
options: options22
|
|
8446
8446
|
}) {
|
|
8447
8447
|
var _a;
|
|
8448
8448
|
try {
|
|
@@ -8450,7 +8450,7 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
8450
8450
|
const result = yield LupaSearchSdk.suggestions(
|
|
8451
8451
|
queryKey,
|
|
8452
8452
|
__spreadValues(__spreadValues({}, publicQuery), context),
|
|
8453
|
-
|
|
8453
|
+
options22
|
|
8454
8454
|
);
|
|
8455
8455
|
if (!result.success) {
|
|
8456
8456
|
return { suggestions: void 0 };
|
|
@@ -8467,16 +8467,16 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
8467
8467
|
};
|
|
8468
8468
|
} catch (err) {
|
|
8469
8469
|
console.error(err);
|
|
8470
|
-
if (
|
|
8471
|
-
|
|
8470
|
+
if (options22 == null ? void 0 : options22.onError) {
|
|
8471
|
+
options22.onError(err);
|
|
8472
8472
|
}
|
|
8473
8473
|
return { suggestions: void 0 };
|
|
8474
8474
|
}
|
|
8475
8475
|
});
|
|
8476
8476
|
const emitSearchResultsCallback = () => {
|
|
8477
8477
|
var _a;
|
|
8478
|
-
if ((_a =
|
|
8479
|
-
|
|
8478
|
+
if ((_a = options2.value.callbacks) == null ? void 0 : _a.onSearchBoxResults) {
|
|
8479
|
+
options2.value.callbacks.onSearchBoxResults({
|
|
8480
8480
|
hasAnyResults: hasAnyResults.value,
|
|
8481
8481
|
docResults: docResults.value,
|
|
8482
8482
|
suggestionResults: suggestionResults.value,
|
|
@@ -8489,11 +8489,11 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
8489
8489
|
const queryDocuments = (_0) => __async(void 0, [_0], function* ({
|
|
8490
8490
|
queryKey,
|
|
8491
8491
|
publicQuery,
|
|
8492
|
-
options:
|
|
8492
|
+
options: options22
|
|
8493
8493
|
}) {
|
|
8494
8494
|
try {
|
|
8495
8495
|
const context = getLupaTrackingContext();
|
|
8496
|
-
const result = yield LupaSearchSdk.query(queryKey, __spreadValues(__spreadValues({}, publicQuery), context),
|
|
8496
|
+
const result = yield LupaSearchSdk.query(queryKey, __spreadValues(__spreadValues({}, publicQuery), context), options22);
|
|
8497
8497
|
if (!result.success) {
|
|
8498
8498
|
return { queryKey, result: { items: [] } };
|
|
8499
8499
|
}
|
|
@@ -8503,8 +8503,8 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
8503
8503
|
return { queryKey, result };
|
|
8504
8504
|
} catch (err) {
|
|
8505
8505
|
console.error(err);
|
|
8506
|
-
if (
|
|
8507
|
-
|
|
8506
|
+
if (options22 == null ? void 0 : options22.onError) {
|
|
8507
|
+
options22.onError(err);
|
|
8508
8508
|
}
|
|
8509
8509
|
return { queryKey, result: { items: [] } };
|
|
8510
8510
|
}
|
|
@@ -8523,10 +8523,10 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
8523
8523
|
inputValue.value = input;
|
|
8524
8524
|
};
|
|
8525
8525
|
const saveOptions = ({ newOptions }) => {
|
|
8526
|
-
|
|
8526
|
+
options2.value = newOptions;
|
|
8527
8527
|
};
|
|
8528
8528
|
return {
|
|
8529
|
-
options,
|
|
8529
|
+
options: options2,
|
|
8530
8530
|
docResults,
|
|
8531
8531
|
suggestionResults,
|
|
8532
8532
|
highlightedIndex,
|
|
@@ -8698,13 +8698,13 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
8698
8698
|
setup(__props, { emit: emit2 }) {
|
|
8699
8699
|
const props = __props;
|
|
8700
8700
|
const searchBoxStore = useSearchBoxStore();
|
|
8701
|
-
const { docResults, options } = storeToRefs(searchBoxStore);
|
|
8701
|
+
const { docResults, options: options2 } = storeToRefs(searchBoxStore);
|
|
8702
8702
|
const totalCount = computed(() => {
|
|
8703
8703
|
var _a, _b, _c;
|
|
8704
8704
|
if (!props.showTotalCount) {
|
|
8705
8705
|
return "";
|
|
8706
8706
|
}
|
|
8707
|
-
const queryKey = (_b = (_a =
|
|
8707
|
+
const queryKey = (_b = (_a = options2.value) == null ? void 0 : _a.panels.find((x) => x.type === "document")) == null ? void 0 : _b.queryKey;
|
|
8708
8708
|
const total = queryKey ? (_c = docResults.value[queryKey]) == null ? void 0 : _c.total : "";
|
|
8709
8709
|
return total ? `(${total})` : "";
|
|
8710
8710
|
});
|
|
@@ -9590,8 +9590,8 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
9590
9590
|
const queryFacet = (_0) => __async(void 0, [_0], function* ({ queryKey, facetKey }) {
|
|
9591
9591
|
var _a, _b, _c, _d;
|
|
9592
9592
|
const query = { searchText: "", filters: __spreadValues({}, filters.value) };
|
|
9593
|
-
const
|
|
9594
|
-
const result = yield LupaSearchSdk.query(queryKey, query,
|
|
9593
|
+
const options2 = (_a = optionsStore.envOptions) != null ? _a : { environment: "production" };
|
|
9594
|
+
const result = yield LupaSearchSdk.query(queryKey, query, options2);
|
|
9595
9595
|
if (!result.success) {
|
|
9596
9596
|
return;
|
|
9597
9597
|
}
|
|
@@ -10216,31 +10216,31 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
10216
10216
|
type = "search_query"
|
|
10217
10217
|
}) => {
|
|
10218
10218
|
var _a, _b;
|
|
10219
|
-
const
|
|
10219
|
+
const options2 = (_a = optionsStore.envOptions) != null ? _a : { environment: "production" };
|
|
10220
10220
|
const hasFilters = Object.keys((_b = query.filters) != null ? _b : {}).length > 0;
|
|
10221
10221
|
if (hasFilters) {
|
|
10222
10222
|
const data2 = getSearchTrackingData(query.searchText, "search_filters");
|
|
10223
|
-
track(queryKey, data2,
|
|
10223
|
+
track(queryKey, data2, options2);
|
|
10224
10224
|
return;
|
|
10225
10225
|
}
|
|
10226
10226
|
const data = getSearchTrackingData(query.searchText, type);
|
|
10227
|
-
track(queryKey, data,
|
|
10227
|
+
track(queryKey, data, options2);
|
|
10228
10228
|
};
|
|
10229
10229
|
const trackResults = ({
|
|
10230
10230
|
queryKey,
|
|
10231
10231
|
results
|
|
10232
10232
|
}) => {
|
|
10233
10233
|
var _a;
|
|
10234
|
-
const
|
|
10234
|
+
const options2 = (_a = optionsStore.envOptions) != null ? _a : { environment: "production" };
|
|
10235
10235
|
if (results.total > 0) {
|
|
10236
10236
|
return;
|
|
10237
10237
|
}
|
|
10238
10238
|
const data = getSearchTrackingData(results.searchText, "search_zero_results");
|
|
10239
|
-
track(queryKey, data,
|
|
10239
|
+
track(queryKey, data, options2);
|
|
10240
10240
|
};
|
|
10241
10241
|
const trackEvent = ({ queryKey, data }) => {
|
|
10242
10242
|
var _a, _b, _c, _d, _e;
|
|
10243
|
-
const
|
|
10243
|
+
const options2 = (_a = optionsStore.envOptions) != null ? _a : { environment: "production" };
|
|
10244
10244
|
const trackingOptions = (_b = optionsStore.trackingOptions) != null ? _b : {};
|
|
10245
10245
|
const items = (_d = (_c = data.analytics) == null ? void 0 : _c.items) != null ? _d : [];
|
|
10246
10246
|
const mappedItems = ((_e = trackingOptions.analytics) == null ? void 0 : _e.itemMap) ? items.map(trackingOptions.analytics.itemMap) : items;
|
|
@@ -10250,7 +10250,7 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
10250
10250
|
analytics: data.analytics ? __spreadProps(__spreadValues({}, data.analytics), { items: mappedItems }) : void 0,
|
|
10251
10251
|
filters: searchResultStore.hasAnyFilter ? searchResultStore.filters : void 0
|
|
10252
10252
|
}),
|
|
10253
|
-
|
|
10253
|
+
options2
|
|
10254
10254
|
);
|
|
10255
10255
|
};
|
|
10256
10256
|
return { trackSearch, trackResults, trackEvent };
|
|
@@ -10491,7 +10491,7 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
10491
10491
|
const mounted = ref(false);
|
|
10492
10492
|
const { docResults } = storeToRefs(searchBoxStore);
|
|
10493
10493
|
const searchResult = ref(null);
|
|
10494
|
-
const
|
|
10494
|
+
const options2 = computed(() => props.options);
|
|
10495
10495
|
const relatedSourceIds = computed(() => {
|
|
10496
10496
|
var _a, _b, _c;
|
|
10497
10497
|
const queryKey = (_a = props.panel.sourceIds) == null ? void 0 : _a.queryKey;
|
|
@@ -10522,7 +10522,7 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
10522
10522
|
const result = yield LupaSearchSdk.queryByIds(
|
|
10523
10523
|
(_b = props.panel.target) == null ? void 0 : _b.queryKey,
|
|
10524
10524
|
relatedSourceIds.value,
|
|
10525
|
-
|
|
10525
|
+
options2.value
|
|
10526
10526
|
);
|
|
10527
10527
|
if (!result.success) {
|
|
10528
10528
|
return { items: [], success: true, searchText: "", total: 0 };
|
|
@@ -10530,8 +10530,8 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
10530
10530
|
return result;
|
|
10531
10531
|
} catch (err) {
|
|
10532
10532
|
console.error(err);
|
|
10533
|
-
if (
|
|
10534
|
-
|
|
10533
|
+
if (options2 == null ? void 0 : options2.value.onError) {
|
|
10534
|
+
options2.value.onError(err);
|
|
10535
10535
|
}
|
|
10536
10536
|
return { items: [], success: true, searchText: "", total: 0 };
|
|
10537
10537
|
}
|
|
@@ -19733,17 +19733,17 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
19733
19733
|
result2.placeholder = curryRight.placeholder;
|
|
19734
19734
|
return result2;
|
|
19735
19735
|
}
|
|
19736
|
-
function debounce2(func, wait,
|
|
19736
|
+
function debounce2(func, wait, options2) {
|
|
19737
19737
|
var lastArgs, lastThis, maxWait, result2, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
|
|
19738
19738
|
if (typeof func != "function") {
|
|
19739
19739
|
throw new TypeError2(FUNC_ERROR_TEXT);
|
|
19740
19740
|
}
|
|
19741
19741
|
wait = toNumber2(wait) || 0;
|
|
19742
|
-
if (isObject2(
|
|
19743
|
-
leading = !!
|
|
19744
|
-
maxing = "maxWait" in
|
|
19745
|
-
maxWait = maxing ? nativeMax(toNumber2(
|
|
19746
|
-
trailing = "trailing" in
|
|
19742
|
+
if (isObject2(options2)) {
|
|
19743
|
+
leading = !!options2.leading;
|
|
19744
|
+
maxing = "maxWait" in options2;
|
|
19745
|
+
maxWait = maxing ? nativeMax(toNumber2(options2.maxWait) || 0, wait) : maxWait;
|
|
19746
|
+
trailing = "trailing" in options2 ? !!options2.trailing : trailing;
|
|
19747
19747
|
}
|
|
19748
19748
|
function invokeFunc(time) {
|
|
19749
19749
|
var args = lastArgs, thisArg = lastThis;
|
|
@@ -19904,14 +19904,14 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
19904
19904
|
return apply(func, this, otherArgs);
|
|
19905
19905
|
});
|
|
19906
19906
|
}
|
|
19907
|
-
function throttle2(func, wait,
|
|
19907
|
+
function throttle2(func, wait, options2) {
|
|
19908
19908
|
var leading = true, trailing = true;
|
|
19909
19909
|
if (typeof func != "function") {
|
|
19910
19910
|
throw new TypeError2(FUNC_ERROR_TEXT);
|
|
19911
19911
|
}
|
|
19912
|
-
if (isObject2(
|
|
19913
|
-
leading = "leading" in
|
|
19914
|
-
trailing = "trailing" in
|
|
19912
|
+
if (isObject2(options2)) {
|
|
19913
|
+
leading = "leading" in options2 ? !!options2.leading : leading;
|
|
19914
|
+
trailing = "trailing" in options2 ? !!options2.trailing : trailing;
|
|
19915
19915
|
}
|
|
19916
19916
|
return debounce2(func, wait, {
|
|
19917
19917
|
"leading": leading,
|
|
@@ -20554,20 +20554,20 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
20554
20554
|
target = baseToString(target);
|
|
20555
20555
|
return string.slice(position, position + target.length) == target;
|
|
20556
20556
|
}
|
|
20557
|
-
function template(string,
|
|
20557
|
+
function template(string, options2, guard) {
|
|
20558
20558
|
var settings = lodash2.templateSettings;
|
|
20559
|
-
if (guard && isIterateeCall(string,
|
|
20560
|
-
|
|
20559
|
+
if (guard && isIterateeCall(string, options2, guard)) {
|
|
20560
|
+
options2 = undefined$1;
|
|
20561
20561
|
}
|
|
20562
20562
|
string = toString(string);
|
|
20563
|
-
|
|
20564
|
-
var imports = assignInWith({},
|
|
20565
|
-
var isEscaping, isEvaluating, index = 0, interpolate =
|
|
20563
|
+
options2 = assignInWith({}, options2, settings, customDefaultsAssignIn);
|
|
20564
|
+
var imports = assignInWith({}, options2.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys);
|
|
20565
|
+
var isEscaping, isEvaluating, index = 0, interpolate = options2.interpolate || reNoMatch, source = "__p += '";
|
|
20566
20566
|
var reDelimiters = RegExp2(
|
|
20567
|
-
(
|
|
20567
|
+
(options2.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options2.evaluate || reNoMatch).source + "|$",
|
|
20568
20568
|
"g"
|
|
20569
20569
|
);
|
|
20570
|
-
var sourceURL = "//# sourceURL=" + (hasOwnProperty2.call(
|
|
20570
|
+
var sourceURL = "//# sourceURL=" + (hasOwnProperty2.call(options2, "sourceURL") ? (options2.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n";
|
|
20571
20571
|
string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
|
|
20572
20572
|
interpolateValue || (interpolateValue = esTemplateValue);
|
|
20573
20573
|
source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
|
|
@@ -20586,7 +20586,7 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
20586
20586
|
return match;
|
|
20587
20587
|
});
|
|
20588
20588
|
source += "';\n";
|
|
20589
|
-
var variable = hasOwnProperty2.call(
|
|
20589
|
+
var variable = hasOwnProperty2.call(options2, "variable") && options2.variable;
|
|
20590
20590
|
if (!variable) {
|
|
20591
20591
|
source = "with (obj) {\n" + source + "\n}\n";
|
|
20592
20592
|
} else if (reForbiddenIdentifierChars.test(variable)) {
|
|
@@ -20642,12 +20642,12 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
20642
20642
|
var strSymbols = stringToArray(string), start = charsStartIndex(strSymbols, stringToArray(chars));
|
|
20643
20643
|
return castSlice(strSymbols, start).join("");
|
|
20644
20644
|
}
|
|
20645
|
-
function truncate(string,
|
|
20645
|
+
function truncate(string, options2) {
|
|
20646
20646
|
var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION;
|
|
20647
|
-
if (isObject2(
|
|
20648
|
-
var separator = "separator" in
|
|
20649
|
-
length = "length" in
|
|
20650
|
-
omission = "omission" in
|
|
20647
|
+
if (isObject2(options2)) {
|
|
20648
|
+
var separator = "separator" in options2 ? options2.separator : separator;
|
|
20649
|
+
length = "length" in options2 ? toInteger(options2.length) : length;
|
|
20650
|
+
omission = "omission" in options2 ? baseToString(options2.omission) : omission;
|
|
20651
20651
|
}
|
|
20652
20652
|
string = toString(string);
|
|
20653
20653
|
var strLength = string.length;
|
|
@@ -20772,15 +20772,15 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
20772
20772
|
return baseInvoke(object, path, args);
|
|
20773
20773
|
};
|
|
20774
20774
|
});
|
|
20775
|
-
function mixin(object, source,
|
|
20775
|
+
function mixin(object, source, options2) {
|
|
20776
20776
|
var props = keys(source), methodNames = baseFunctions(source, props);
|
|
20777
|
-
if (
|
|
20778
|
-
|
|
20777
|
+
if (options2 == null && !(isObject2(source) && (methodNames.length || !props.length))) {
|
|
20778
|
+
options2 = source;
|
|
20779
20779
|
source = object;
|
|
20780
20780
|
object = this;
|
|
20781
20781
|
methodNames = baseFunctions(source, keys(source));
|
|
20782
20782
|
}
|
|
20783
|
-
var chain2 = !(isObject2(
|
|
20783
|
+
var chain2 = !(isObject2(options2) && "chain" in options2) || !!options2.chain, isFunc = isFunction2(object);
|
|
20784
20784
|
arrayEach(methodNames, function(methodName) {
|
|
20785
20785
|
var func = source[methodName];
|
|
20786
20786
|
object[methodName] = func;
|
|
@@ -21403,12 +21403,12 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
21403
21403
|
const searchResults2 = ref(null);
|
|
21404
21404
|
const searchBox2 = ref(null);
|
|
21405
21405
|
const fullSearchResultsOptions = computed(() => {
|
|
21406
|
-
const
|
|
21407
|
-
return lodashExports$1.merge({}, DEFAULT_OPTIONS_RESULTS$1,
|
|
21406
|
+
const options2 = lodashExports$1.cloneDeep(props.options.searchResults);
|
|
21407
|
+
return lodashExports$1.merge({}, DEFAULT_OPTIONS_RESULTS$1, options2);
|
|
21408
21408
|
});
|
|
21409
21409
|
const fullSearchBoxOptions = computed(() => {
|
|
21410
|
-
const
|
|
21411
|
-
return lodashExports$1.merge({}, DEFAULT_SEARCH_BOX_OPTIONS$1,
|
|
21410
|
+
const options2 = lodashExports$1.cloneDeep(props.options.searchBox);
|
|
21411
|
+
return lodashExports$1.merge({}, DEFAULT_SEARCH_BOX_OPTIONS$1, options2);
|
|
21412
21412
|
});
|
|
21413
21413
|
const fetch2 = () => {
|
|
21414
21414
|
var _a, _b;
|
|
@@ -22416,37 +22416,37 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
22416
22416
|
}
|
|
22417
22417
|
return Env[environment] || Env["production"];
|
|
22418
22418
|
};
|
|
22419
|
-
const suggestSearchChatPhrases = (
|
|
22419
|
+
const suggestSearchChatPhrases = (options2, request, chatSettings) => __async(void 0, null, function* () {
|
|
22420
22420
|
var _a, _b, _c;
|
|
22421
|
-
const { environment, customBaseUrl } =
|
|
22421
|
+
const { environment, customBaseUrl } = options2;
|
|
22422
22422
|
const model = (chatSettings == null ? void 0 : chatSettings.model) ? `?model=${chatSettings.model}` : ``;
|
|
22423
22423
|
try {
|
|
22424
22424
|
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat${model}`, __spreadProps(__spreadValues({}, DEFAULT_REQUEST_CONFIG), {
|
|
22425
22425
|
body: JSON.stringify(request),
|
|
22426
|
-
headers: __spreadValues(__spreadValues({}, DEFAULT_HEADERS), (_a =
|
|
22426
|
+
headers: __spreadValues(__spreadValues({}, DEFAULT_HEADERS), (_a = options2.customHeaders) != null ? _a : {})
|
|
22427
22427
|
}));
|
|
22428
22428
|
if (res.status < 400) {
|
|
22429
22429
|
const data = yield res.json();
|
|
22430
22430
|
return __spreadProps(__spreadValues({}, data), { success: true });
|
|
22431
22431
|
}
|
|
22432
22432
|
const errors = yield res.json();
|
|
22433
|
-
(_b =
|
|
22433
|
+
(_b = options2 == null ? void 0 : options2.onError) == null ? void 0 : _b.call(options2, errors);
|
|
22434
22434
|
return { success: false, errors };
|
|
22435
22435
|
} catch (e2) {
|
|
22436
|
-
(_c =
|
|
22436
|
+
(_c = options2 == null ? void 0 : options2.onError) == null ? void 0 : _c.call(options2, e2);
|
|
22437
22437
|
return { success: false, errors: [e2] };
|
|
22438
22438
|
}
|
|
22439
22439
|
});
|
|
22440
|
-
const suggestPhraseAlternatives = (
|
|
22440
|
+
const suggestPhraseAlternatives = (options2, request, chatSettings) => __async(void 0, null, function* () {
|
|
22441
22441
|
var _a, _b, _c;
|
|
22442
|
-
const { environment, customBaseUrl } =
|
|
22442
|
+
const { environment, customBaseUrl } = options2;
|
|
22443
22443
|
const model = (chatSettings == null ? void 0 : chatSettings.model) ? `?model=${chatSettings.model}` : ``;
|
|
22444
22444
|
try {
|
|
22445
22445
|
const res = yield fetch(
|
|
22446
22446
|
`${getApiUrl(environment, customBaseUrl)}chat/phraseAlternatives${model}`,
|
|
22447
22447
|
__spreadProps(__spreadValues({}, DEFAULT_REQUEST_CONFIG), {
|
|
22448
22448
|
body: JSON.stringify(request),
|
|
22449
|
-
headers: __spreadValues(__spreadValues({}, DEFAULT_HEADERS), (_a =
|
|
22449
|
+
headers: __spreadValues(__spreadValues({}, DEFAULT_HEADERS), (_a = options2.customHeaders) != null ? _a : {})
|
|
22450
22450
|
})
|
|
22451
22451
|
);
|
|
22452
22452
|
if (res.status < 400) {
|
|
@@ -22454,31 +22454,31 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
22454
22454
|
return __spreadProps(__spreadValues({}, data), { success: true });
|
|
22455
22455
|
}
|
|
22456
22456
|
const errors = yield res.json();
|
|
22457
|
-
(_b =
|
|
22457
|
+
(_b = options2 == null ? void 0 : options2.onError) == null ? void 0 : _b.call(options2, errors);
|
|
22458
22458
|
return { success: false, errors };
|
|
22459
22459
|
} catch (e2) {
|
|
22460
|
-
(_c =
|
|
22460
|
+
(_c = options2 == null ? void 0 : options2.onError) == null ? void 0 : _c.call(options2, e2);
|
|
22461
22461
|
return { success: false, errors: [e2] };
|
|
22462
22462
|
}
|
|
22463
22463
|
});
|
|
22464
|
-
const suggestBestProductMatches = (
|
|
22464
|
+
const suggestBestProductMatches = (options2, request, chatSettings) => __async(void 0, null, function* () {
|
|
22465
22465
|
var _a, _b, _c;
|
|
22466
|
-
const { environment, customBaseUrl } =
|
|
22466
|
+
const { environment, customBaseUrl } = options2;
|
|
22467
22467
|
const model = (chatSettings == null ? void 0 : chatSettings.model) ? `?model=${chatSettings.model}` : ``;
|
|
22468
22468
|
try {
|
|
22469
22469
|
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/bestProducts${model}`, __spreadProps(__spreadValues({}, DEFAULT_REQUEST_CONFIG), {
|
|
22470
22470
|
body: JSON.stringify(request),
|
|
22471
|
-
headers: __spreadValues(__spreadValues({}, DEFAULT_HEADERS), (_a =
|
|
22471
|
+
headers: __spreadValues(__spreadValues({}, DEFAULT_HEADERS), (_a = options2.customHeaders) != null ? _a : {})
|
|
22472
22472
|
}));
|
|
22473
22473
|
if (res.status < 400) {
|
|
22474
22474
|
const data = yield res.json();
|
|
22475
22475
|
return __spreadProps(__spreadValues({}, data), { success: true });
|
|
22476
22476
|
}
|
|
22477
22477
|
const errors = yield res.json();
|
|
22478
|
-
(_b =
|
|
22478
|
+
(_b = options2 == null ? void 0 : options2.onError) == null ? void 0 : _b.call(options2, errors);
|
|
22479
22479
|
return { success: false, errors };
|
|
22480
22480
|
} catch (e2) {
|
|
22481
|
-
(_c =
|
|
22481
|
+
(_c = options2 == null ? void 0 : options2.onError) == null ? void 0 : _c.call(options2, e2);
|
|
22482
22482
|
return { success: false, errors: [e2] };
|
|
22483
22483
|
}
|
|
22484
22484
|
});
|
|
@@ -22503,12 +22503,12 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
22503
22503
|
}
|
|
22504
22504
|
return history;
|
|
22505
22505
|
};
|
|
22506
|
-
const getTextResponseChunkStream = (
|
|
22506
|
+
const getTextResponseChunkStream = (options2, request, onChunkReceived, chatSettings) => {
|
|
22507
22507
|
var _a;
|
|
22508
22508
|
const model = (chatSettings == null ? void 0 : chatSettings.model) ? `?model=${chatSettings.model}` : ``;
|
|
22509
|
-
fetch(`${getApiUrl(
|
|
22509
|
+
fetch(`${getApiUrl(options2.environment, options2.customBaseUrl)}chat/text${model}`, __spreadProps(__spreadValues({}, DEFAULT_REQUEST_CONFIG), {
|
|
22510
22510
|
body: JSON.stringify(request),
|
|
22511
|
-
headers: __spreadValues(__spreadValues({}, DEFAULT_HEADERS), (_a =
|
|
22511
|
+
headers: __spreadValues(__spreadValues({}, DEFAULT_HEADERS), (_a = options2.customHeaders) != null ? _a : {})
|
|
22512
22512
|
})).then((response) => {
|
|
22513
22513
|
const reader = response.body.getReader();
|
|
22514
22514
|
return reader.read().then(function processStream({ done, value }) {
|
|
@@ -22937,15 +22937,15 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
22937
22937
|
};
|
|
22938
22938
|
}
|
|
22939
22939
|
});
|
|
22940
|
-
const fetchPluginConfiguration = (
|
|
22940
|
+
const fetchPluginConfiguration = (options2, configurationKey) => __async(void 0, null, function* () {
|
|
22941
22941
|
var _a, _b, _c;
|
|
22942
|
-
const { environment, customBaseUrl } =
|
|
22942
|
+
const { environment, customBaseUrl } = options2;
|
|
22943
22943
|
try {
|
|
22944
22944
|
const res = yield fetch(
|
|
22945
22945
|
`${getApiUrl(environment, customBaseUrl)}plugin/configurations/${configurationKey}`,
|
|
22946
22946
|
__spreadProps(__spreadValues({}, DEFAULT_REQUEST_CONFIG), {
|
|
22947
22947
|
method: "GET",
|
|
22948
|
-
headers: __spreadValues(__spreadValues({}, DEFAULT_HEADERS), (_a =
|
|
22948
|
+
headers: __spreadValues(__spreadValues({}, DEFAULT_HEADERS), (_a = options2.customHeaders) != null ? _a : {})
|
|
22949
22949
|
})
|
|
22950
22950
|
);
|
|
22951
22951
|
if (res.status < 400) {
|
|
@@ -22953,10 +22953,10 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
22953
22953
|
return __spreadValues({}, data);
|
|
22954
22954
|
}
|
|
22955
22955
|
const errors = yield res.json();
|
|
22956
|
-
(_b =
|
|
22956
|
+
(_b = options2 == null ? void 0 : options2.onError) == null ? void 0 : _b.call(options2, errors);
|
|
22957
22957
|
return null;
|
|
22958
22958
|
} catch (e2) {
|
|
22959
|
-
(_c =
|
|
22959
|
+
(_c = options2 == null ? void 0 : options2.onError) == null ? void 0 : _c.call(options2, e2);
|
|
22960
22960
|
return null;
|
|
22961
22961
|
}
|
|
22962
22962
|
});
|
|
@@ -22969,24 +22969,24 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
22969
22969
|
piniaInstance = pinia;
|
|
22970
22970
|
return pinia;
|
|
22971
22971
|
};
|
|
22972
|
-
const setupTracking = (
|
|
22972
|
+
const setupTracking = (options2) => {
|
|
22973
22973
|
const pinia = initPinia();
|
|
22974
22974
|
const store = useOptionsStore(pinia);
|
|
22975
|
-
initTracking(
|
|
22976
|
-
store.setTrackingOptions({ options });
|
|
22975
|
+
initTracking(options2);
|
|
22976
|
+
store.setTrackingOptions({ options: options2 });
|
|
22977
22977
|
};
|
|
22978
|
-
const displayDiscountedPriceSection = (doc2,
|
|
22978
|
+
const displayDiscountedPriceSection = (doc2, options2) => {
|
|
22979
22979
|
var _a, _b;
|
|
22980
|
-
const discountPrice = doc2[(_a =
|
|
22981
|
-
const regularPrice = doc2[(_b =
|
|
22980
|
+
const discountPrice = doc2[(_a = options2.fields.discountPriceKey) != null ? _a : ""];
|
|
22981
|
+
const regularPrice = doc2[(_b = options2.fields.regularPriceKey) != null ? _b : ""];
|
|
22982
22982
|
return discountPrice && regularPrice && discountPrice < regularPrice;
|
|
22983
22983
|
};
|
|
22984
|
-
const displayRegularPriceSection = (doc2,
|
|
22984
|
+
const displayRegularPriceSection = (doc2, options2) => {
|
|
22985
22985
|
var _a, _b;
|
|
22986
|
-
const discountPrice = doc2[(_a =
|
|
22987
|
-
const regularPrice = doc2[(_b =
|
|
22986
|
+
const discountPrice = doc2[(_a = options2.fields.discountPriceKey) != null ? _a : ""];
|
|
22987
|
+
const regularPrice = doc2[(_b = options2.fields.regularPriceKey) != null ? _b : ""];
|
|
22988
22988
|
const anyPrice = discountPrice || regularPrice;
|
|
22989
|
-
return anyPrice && !displayDiscountedPriceSection(doc2,
|
|
22989
|
+
return anyPrice && !displayDiscountedPriceSection(doc2, options2);
|
|
22990
22990
|
};
|
|
22991
22991
|
const escapeHtml = (source) => {
|
|
22992
22992
|
if (!source) {
|
|
@@ -27147,17 +27147,17 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
27147
27147
|
result2.placeholder = curryRight.placeholder;
|
|
27148
27148
|
return result2;
|
|
27149
27149
|
}
|
|
27150
|
-
function debounce2(func, wait,
|
|
27150
|
+
function debounce2(func, wait, options2) {
|
|
27151
27151
|
var lastArgs, lastThis, maxWait, result2, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
|
|
27152
27152
|
if (typeof func != "function") {
|
|
27153
27153
|
throw new TypeError2(FUNC_ERROR_TEXT);
|
|
27154
27154
|
}
|
|
27155
27155
|
wait = toNumber2(wait) || 0;
|
|
27156
|
-
if (isObject2(
|
|
27157
|
-
leading = !!
|
|
27158
|
-
maxing = "maxWait" in
|
|
27159
|
-
maxWait = maxing ? nativeMax(toNumber2(
|
|
27160
|
-
trailing = "trailing" in
|
|
27156
|
+
if (isObject2(options2)) {
|
|
27157
|
+
leading = !!options2.leading;
|
|
27158
|
+
maxing = "maxWait" in options2;
|
|
27159
|
+
maxWait = maxing ? nativeMax(toNumber2(options2.maxWait) || 0, wait) : maxWait;
|
|
27160
|
+
trailing = "trailing" in options2 ? !!options2.trailing : trailing;
|
|
27161
27161
|
}
|
|
27162
27162
|
function invokeFunc(time) {
|
|
27163
27163
|
var args = lastArgs, thisArg = lastThis;
|
|
@@ -27318,14 +27318,14 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
27318
27318
|
return apply(func, this, otherArgs);
|
|
27319
27319
|
});
|
|
27320
27320
|
}
|
|
27321
|
-
function throttle2(func, wait,
|
|
27321
|
+
function throttle2(func, wait, options2) {
|
|
27322
27322
|
var leading = true, trailing = true;
|
|
27323
27323
|
if (typeof func != "function") {
|
|
27324
27324
|
throw new TypeError2(FUNC_ERROR_TEXT);
|
|
27325
27325
|
}
|
|
27326
|
-
if (isObject2(
|
|
27327
|
-
leading = "leading" in
|
|
27328
|
-
trailing = "trailing" in
|
|
27326
|
+
if (isObject2(options2)) {
|
|
27327
|
+
leading = "leading" in options2 ? !!options2.leading : leading;
|
|
27328
|
+
trailing = "trailing" in options2 ? !!options2.trailing : trailing;
|
|
27329
27329
|
}
|
|
27330
27330
|
return debounce2(func, wait, {
|
|
27331
27331
|
"leading": leading,
|
|
@@ -27968,20 +27968,20 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
27968
27968
|
target = baseToString(target);
|
|
27969
27969
|
return string.slice(position, position + target.length) == target;
|
|
27970
27970
|
}
|
|
27971
|
-
function template(string,
|
|
27971
|
+
function template(string, options2, guard) {
|
|
27972
27972
|
var settings = lodash2.templateSettings;
|
|
27973
|
-
if (guard && isIterateeCall(string,
|
|
27974
|
-
|
|
27973
|
+
if (guard && isIterateeCall(string, options2, guard)) {
|
|
27974
|
+
options2 = undefined$1;
|
|
27975
27975
|
}
|
|
27976
27976
|
string = toString(string);
|
|
27977
|
-
|
|
27978
|
-
var imports = assignInWith({},
|
|
27979
|
-
var isEscaping, isEvaluating, index = 0, interpolate =
|
|
27977
|
+
options2 = assignInWith({}, options2, settings, customDefaultsAssignIn);
|
|
27978
|
+
var imports = assignInWith({}, options2.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys);
|
|
27979
|
+
var isEscaping, isEvaluating, index = 0, interpolate = options2.interpolate || reNoMatch, source = "__p += '";
|
|
27980
27980
|
var reDelimiters = RegExp2(
|
|
27981
|
-
(
|
|
27981
|
+
(options2.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options2.evaluate || reNoMatch).source + "|$",
|
|
27982
27982
|
"g"
|
|
27983
27983
|
);
|
|
27984
|
-
var sourceURL = "//# sourceURL=" + (hasOwnProperty2.call(
|
|
27984
|
+
var sourceURL = "//# sourceURL=" + (hasOwnProperty2.call(options2, "sourceURL") ? (options2.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n";
|
|
27985
27985
|
string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
|
|
27986
27986
|
interpolateValue || (interpolateValue = esTemplateValue);
|
|
27987
27987
|
source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
|
|
@@ -28000,7 +28000,7 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
28000
28000
|
return match;
|
|
28001
28001
|
});
|
|
28002
28002
|
source += "';\n";
|
|
28003
|
-
var variable = hasOwnProperty2.call(
|
|
28003
|
+
var variable = hasOwnProperty2.call(options2, "variable") && options2.variable;
|
|
28004
28004
|
if (!variable) {
|
|
28005
28005
|
source = "with (obj) {\n" + source + "\n}\n";
|
|
28006
28006
|
} else if (reForbiddenIdentifierChars.test(variable)) {
|
|
@@ -28056,12 +28056,12 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
28056
28056
|
var strSymbols = stringToArray(string), start = charsStartIndex(strSymbols, stringToArray(chars));
|
|
28057
28057
|
return castSlice(strSymbols, start).join("");
|
|
28058
28058
|
}
|
|
28059
|
-
function truncate(string,
|
|
28059
|
+
function truncate(string, options2) {
|
|
28060
28060
|
var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION;
|
|
28061
|
-
if (isObject2(
|
|
28062
|
-
var separator = "separator" in
|
|
28063
|
-
length = "length" in
|
|
28064
|
-
omission = "omission" in
|
|
28061
|
+
if (isObject2(options2)) {
|
|
28062
|
+
var separator = "separator" in options2 ? options2.separator : separator;
|
|
28063
|
+
length = "length" in options2 ? toInteger(options2.length) : length;
|
|
28064
|
+
omission = "omission" in options2 ? baseToString(options2.omission) : omission;
|
|
28065
28065
|
}
|
|
28066
28066
|
string = toString(string);
|
|
28067
28067
|
var strLength = string.length;
|
|
@@ -28186,15 +28186,15 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
28186
28186
|
return baseInvoke(object, path, args);
|
|
28187
28187
|
};
|
|
28188
28188
|
});
|
|
28189
|
-
function mixin(object, source,
|
|
28189
|
+
function mixin(object, source, options2) {
|
|
28190
28190
|
var props = keys(source), methodNames = baseFunctions(source, props);
|
|
28191
|
-
if (
|
|
28192
|
-
|
|
28191
|
+
if (options2 == null && !(isObject2(source) && (methodNames.length || !props.length))) {
|
|
28192
|
+
options2 = source;
|
|
28193
28193
|
source = object;
|
|
28194
28194
|
object = this;
|
|
28195
28195
|
methodNames = baseFunctions(source, keys(source));
|
|
28196
28196
|
}
|
|
28197
|
-
var chain2 = !(isObject2(
|
|
28197
|
+
var chain2 = !(isObject2(options2) && "chain" in options2) || !!options2.chain, isFunc = isFunction2(object);
|
|
28198
28198
|
arrayEach(methodNames, function(methodName) {
|
|
28199
28199
|
var func = source[methodName];
|
|
28200
28200
|
object[methodName] = func;
|
|
@@ -28858,8 +28858,8 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
28858
28858
|
const props = __props;
|
|
28859
28859
|
const searchBox2 = ref(null);
|
|
28860
28860
|
const fullSearchBoxOptions = computed(() => {
|
|
28861
|
-
const
|
|
28862
|
-
return lodashExports.merge(lodashExports.cloneDeep(DEFAULT_SEARCH_BOX_OPTIONS),
|
|
28861
|
+
const options2 = lodashExports.cloneDeep(props.searchBoxOptions);
|
|
28862
|
+
return lodashExports.merge(lodashExports.cloneDeep(DEFAULT_SEARCH_BOX_OPTIONS), options2);
|
|
28863
28863
|
});
|
|
28864
28864
|
const fetch2 = () => {
|
|
28865
28865
|
var _a;
|
|
@@ -28985,8 +28985,8 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
28985
28985
|
const props = __props;
|
|
28986
28986
|
const searchResults2 = ref(null);
|
|
28987
28987
|
const fullSearchResultsOptions = computed(() => {
|
|
28988
|
-
const
|
|
28989
|
-
return lodashExports.merge(lodashExports.cloneDeep(DEFAULT_OPTIONS_RESULTS),
|
|
28988
|
+
const options2 = lodashExports.cloneDeep(props.searchResultsOptions);
|
|
28989
|
+
return lodashExports.merge(lodashExports.cloneDeep(DEFAULT_OPTIONS_RESULTS), options2);
|
|
28990
28990
|
});
|
|
28991
28991
|
const fetch2 = () => {
|
|
28992
28992
|
var _a;
|
|
@@ -29147,7 +29147,7 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
29147
29147
|
host,
|
|
29148
29148
|
manager,
|
|
29149
29149
|
styleUrl,
|
|
29150
|
-
options
|
|
29150
|
+
options: options2
|
|
29151
29151
|
}) => {
|
|
29152
29152
|
var _a;
|
|
29153
29153
|
if (host.shadowRoot) {
|
|
@@ -29170,9 +29170,9 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
29170
29170
|
const shadow = host.attachShadow({ mode: "open" });
|
|
29171
29171
|
shadow.appendChild(manager);
|
|
29172
29172
|
shadow.appendChild(link);
|
|
29173
|
-
if ((_a =
|
|
29173
|
+
if ((_a = options2 == null ? void 0 : options2.layout) == null ? void 0 : _a.marginLeft) {
|
|
29174
29174
|
const style = document.createElement("style");
|
|
29175
|
-
style.innerHTML = `.lupa-search-container-overlay { width: calc(100% - ${
|
|
29175
|
+
style.innerHTML = `.lupa-search-container-overlay { width: calc(100% - ${options2.layout.marginLeft}px); margin-left: ${options2.layout.marginLeft}px; }`;
|
|
29176
29176
|
shadow.appendChild(style);
|
|
29177
29177
|
}
|
|
29178
29178
|
};
|
|
@@ -29196,7 +29196,7 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
29196
29196
|
return newElement;
|
|
29197
29197
|
}
|
|
29198
29198
|
};
|
|
29199
|
-
const createVue = (selector, mountingBehavior = "replace", rootComponent,
|
|
29199
|
+
const createVue = (selector, mountingBehavior = "replace", rootComponent, options2, mountToParent = false) => {
|
|
29200
29200
|
const pinia = initPinia();
|
|
29201
29201
|
const element = typeof selector === "string" ? document.querySelector(selector) : selector;
|
|
29202
29202
|
const mountElement = getMountElement(element, mountingBehavior, mountToParent);
|
|
@@ -29205,7 +29205,7 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
29205
29205
|
return;
|
|
29206
29206
|
}
|
|
29207
29207
|
let mountedComponent = null;
|
|
29208
|
-
const props = reactive(__spreadValues2({},
|
|
29208
|
+
const props = reactive(__spreadValues2({}, options2));
|
|
29209
29209
|
const app2 = createApp({
|
|
29210
29210
|
render: () => mountedComponent = h$1(rootComponent, props)
|
|
29211
29211
|
});
|
|
@@ -29224,10 +29224,10 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
29224
29224
|
recommendations: {},
|
|
29225
29225
|
chat: {}
|
|
29226
29226
|
};
|
|
29227
|
-
const applySearchBox = (
|
|
29228
|
-
const existingInstance = app.box[
|
|
29227
|
+
const applySearchBox = (options2, mountOptions) => {
|
|
29228
|
+
const existingInstance = app.box[options2.inputSelector];
|
|
29229
29229
|
if (existingInstance) {
|
|
29230
|
-
existingInstance.props.searchBoxOptions =
|
|
29230
|
+
existingInstance.props.searchBoxOptions = options2;
|
|
29231
29231
|
if (mountOptions == null ? void 0 : mountOptions.fetch) {
|
|
29232
29232
|
setTimeout(() => {
|
|
29233
29233
|
var _a, _b, _c, _d;
|
|
@@ -29237,28 +29237,28 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
29237
29237
|
return;
|
|
29238
29238
|
}
|
|
29239
29239
|
const instance = createVue(
|
|
29240
|
-
|
|
29240
|
+
options2.inputSelector,
|
|
29241
29241
|
mountOptions == null ? void 0 : mountOptions.mountingBehavior,
|
|
29242
29242
|
_sfc_main$4,
|
|
29243
|
-
{ searchBoxOptions:
|
|
29243
|
+
{ searchBoxOptions: options2 },
|
|
29244
29244
|
true
|
|
29245
29245
|
);
|
|
29246
29246
|
if (!instance) {
|
|
29247
29247
|
return;
|
|
29248
29248
|
}
|
|
29249
|
-
app.box[
|
|
29249
|
+
app.box[options2.inputSelector] = instance;
|
|
29250
29250
|
};
|
|
29251
|
-
const searchBox = (
|
|
29251
|
+
const searchBox = (options2, mountOptions) => {
|
|
29252
29252
|
var _a;
|
|
29253
|
-
const inputs = (_a =
|
|
29253
|
+
const inputs = (_a = options2.inputSelector) == null ? void 0 : _a.split(",");
|
|
29254
29254
|
for (const input of inputs) {
|
|
29255
|
-
applySearchBox(__spreadProps2(__spreadValues2({},
|
|
29255
|
+
applySearchBox(__spreadProps2(__spreadValues2({}, options2), { inputSelector: input.trim() }), mountOptions);
|
|
29256
29256
|
}
|
|
29257
29257
|
};
|
|
29258
|
-
const searchResults = (
|
|
29259
|
-
const existingInstance = app.results[
|
|
29258
|
+
const searchResults = (options2, mountOptions) => {
|
|
29259
|
+
const existingInstance = app.results[options2.containerSelector];
|
|
29260
29260
|
if (existingInstance) {
|
|
29261
|
-
existingInstance.props.searchResultsOptions =
|
|
29261
|
+
existingInstance.props.searchResultsOptions = options2;
|
|
29262
29262
|
if (mountOptions == null ? void 0 : mountOptions.fetch) {
|
|
29263
29263
|
setTimeout(() => {
|
|
29264
29264
|
var _a, _b, _c, _d;
|
|
@@ -29268,22 +29268,22 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
29268
29268
|
return;
|
|
29269
29269
|
}
|
|
29270
29270
|
const instance = createVue(
|
|
29271
|
-
|
|
29271
|
+
options2.containerSelector,
|
|
29272
29272
|
mountOptions == null ? void 0 : mountOptions.mountingBehavior,
|
|
29273
29273
|
_sfc_main$3,
|
|
29274
29274
|
{
|
|
29275
|
-
searchResultsOptions:
|
|
29275
|
+
searchResultsOptions: options2
|
|
29276
29276
|
}
|
|
29277
29277
|
);
|
|
29278
29278
|
if (!instance) {
|
|
29279
29279
|
return;
|
|
29280
29280
|
}
|
|
29281
|
-
app.results[
|
|
29281
|
+
app.results[options2.containerSelector] = instance;
|
|
29282
29282
|
};
|
|
29283
|
-
const productList = (
|
|
29284
|
-
const existingInstance = app.productList[
|
|
29283
|
+
const productList = (options2, mountOptions) => {
|
|
29284
|
+
const existingInstance = app.productList[options2.containerSelector];
|
|
29285
29285
|
if (existingInstance) {
|
|
29286
|
-
existingInstance.props.productListOptions =
|
|
29286
|
+
existingInstance.props.productListOptions = options2;
|
|
29287
29287
|
if (mountOptions == null ? void 0 : mountOptions.fetch) {
|
|
29288
29288
|
setTimeout(() => {
|
|
29289
29289
|
var _a, _b, _c, _d;
|
|
@@ -29293,23 +29293,23 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
29293
29293
|
return;
|
|
29294
29294
|
}
|
|
29295
29295
|
const instance = createVue(
|
|
29296
|
-
|
|
29296
|
+
options2.containerSelector,
|
|
29297
29297
|
mountOptions == null ? void 0 : mountOptions.mountingBehavior,
|
|
29298
29298
|
_sfc_main$2,
|
|
29299
29299
|
{
|
|
29300
|
-
productListOptions:
|
|
29300
|
+
productListOptions: options2
|
|
29301
29301
|
}
|
|
29302
29302
|
);
|
|
29303
29303
|
if (!instance) {
|
|
29304
29304
|
return;
|
|
29305
29305
|
}
|
|
29306
|
-
app.productList[
|
|
29306
|
+
app.productList[options2.containerSelector] = instance;
|
|
29307
29307
|
};
|
|
29308
|
-
const searchContainer = (
|
|
29308
|
+
const searchContainer = (options2, mountOptions) => {
|
|
29309
29309
|
var _a, _b, _c, _d, _e, _f;
|
|
29310
|
-
const existingInstance = app.searchContainer[
|
|
29310
|
+
const existingInstance = app.searchContainer[options2.trigger];
|
|
29311
29311
|
if (existingInstance) {
|
|
29312
|
-
existingInstance.props.searchContainerOptions =
|
|
29312
|
+
existingInstance.props.searchContainerOptions = options2;
|
|
29313
29313
|
(_d = (_c = (_b = (_a = existingInstance.mountedComponent) == null ? void 0 : _a.component) == null ? void 0 : _b.exposed) == null ? void 0 : _c.reloadOptions) == null ? void 0 : _d.call(_c);
|
|
29314
29314
|
if (mountOptions == null ? void 0 : mountOptions.fetch) {
|
|
29315
29315
|
setTimeout(() => {
|
|
@@ -29325,17 +29325,17 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
29325
29325
|
attatchShadowDom({
|
|
29326
29326
|
host,
|
|
29327
29327
|
manager,
|
|
29328
|
-
styleUrl: (_f = (_e =
|
|
29329
|
-
options:
|
|
29328
|
+
styleUrl: (_f = (_e = options2.options) == null ? void 0 : _e.styleLink) != null ? _f : DEFAULT_CONTAINER_STYLE,
|
|
29329
|
+
options: options2.options
|
|
29330
29330
|
});
|
|
29331
29331
|
document.body.appendChild(host);
|
|
29332
29332
|
const instance = createVue(manager, mountOptions == null ? void 0 : mountOptions.mountingBehavior, _sfc_main$1, {
|
|
29333
|
-
searchContainerOptions:
|
|
29333
|
+
searchContainerOptions: options2
|
|
29334
29334
|
});
|
|
29335
29335
|
if (!instance) {
|
|
29336
29336
|
return;
|
|
29337
29337
|
}
|
|
29338
|
-
app.searchContainer[
|
|
29338
|
+
app.searchContainer[options2.trigger] = instance;
|
|
29339
29339
|
};
|
|
29340
29340
|
const preconfiguredSearchContainer = (preconfiguredSearchContainerOptions, mountOptions) => {
|
|
29341
29341
|
const searchBox2 = SearchContainerConfigurationService.getSearchBoxComponent(
|
|
@@ -29354,10 +29354,10 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
29354
29354
|
mountOptions
|
|
29355
29355
|
);
|
|
29356
29356
|
};
|
|
29357
|
-
const recommendations = (
|
|
29358
|
-
const existingInstance = app.recommendations[
|
|
29357
|
+
const recommendations = (options2, mountOptions) => {
|
|
29358
|
+
const existingInstance = app.recommendations[options2.containerSelector];
|
|
29359
29359
|
if (existingInstance) {
|
|
29360
|
-
existingInstance.props.recommendationOptions =
|
|
29360
|
+
existingInstance.props.recommendationOptions = options2;
|
|
29361
29361
|
if (mountOptions == null ? void 0 : mountOptions.fetch) {
|
|
29362
29362
|
setTimeout(() => {
|
|
29363
29363
|
var _a, _b, _c, _d;
|
|
@@ -29367,22 +29367,22 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
29367
29367
|
return;
|
|
29368
29368
|
}
|
|
29369
29369
|
const instance = createVue(
|
|
29370
|
-
|
|
29370
|
+
options2.containerSelector,
|
|
29371
29371
|
mountOptions == null ? void 0 : mountOptions.mountingBehavior,
|
|
29372
29372
|
_sfc_main,
|
|
29373
29373
|
{
|
|
29374
|
-
recommendationOptions:
|
|
29374
|
+
recommendationOptions: options2
|
|
29375
29375
|
}
|
|
29376
29376
|
);
|
|
29377
29377
|
if (!instance) {
|
|
29378
29378
|
return;
|
|
29379
29379
|
}
|
|
29380
|
-
app.recommendations[
|
|
29380
|
+
app.recommendations[options2.containerSelector] = instance;
|
|
29381
29381
|
};
|
|
29382
|
-
const chat = (
|
|
29383
|
-
const existingInstance = app.chat[
|
|
29382
|
+
const chat = (options2, mountOptions) => {
|
|
29383
|
+
const existingInstance = app.chat[options2.displayOptions.containerSelector];
|
|
29384
29384
|
if (existingInstance) {
|
|
29385
|
-
existingInstance.props.options =
|
|
29385
|
+
existingInstance.props.options = options2;
|
|
29386
29386
|
if (mountOptions == null ? void 0 : mountOptions.fetch) {
|
|
29387
29387
|
setTimeout(() => {
|
|
29388
29388
|
var _a, _b, _c, _d;
|
|
@@ -29392,17 +29392,17 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
29392
29392
|
return;
|
|
29393
29393
|
}
|
|
29394
29394
|
const instance = createVue(
|
|
29395
|
-
|
|
29395
|
+
options2.displayOptions.containerSelector,
|
|
29396
29396
|
mountOptions == null ? void 0 : mountOptions.mountingBehavior,
|
|
29397
29397
|
_sfc_main$1o,
|
|
29398
29398
|
{
|
|
29399
|
-
options
|
|
29399
|
+
options: options2
|
|
29400
29400
|
}
|
|
29401
29401
|
);
|
|
29402
29402
|
if (!instance) {
|
|
29403
29403
|
return;
|
|
29404
29404
|
}
|
|
29405
|
-
app.chat[
|
|
29405
|
+
app.chat[options2.displayOptions.containerSelector] = instance;
|
|
29406
29406
|
};
|
|
29407
29407
|
const clearInstance = (element, app2) => {
|
|
29408
29408
|
var _a;
|
|
@@ -29488,6 +29488,32 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
29488
29488
|
} catch (e2) {
|
|
29489
29489
|
}
|
|
29490
29490
|
};
|
|
29491
|
+
const waitForElementToBeVisible = (element, retries = 0, maxRetries = 30, interval = 10) => __async2(this, null, function* () {
|
|
29492
|
+
let foundElement = null;
|
|
29493
|
+
if (typeof element === "string") {
|
|
29494
|
+
foundElement = document.querySelector(element);
|
|
29495
|
+
} else {
|
|
29496
|
+
foundElement = element;
|
|
29497
|
+
}
|
|
29498
|
+
if (foundElement) {
|
|
29499
|
+
return true;
|
|
29500
|
+
}
|
|
29501
|
+
if (retries >= maxRetries) {
|
|
29502
|
+
return false;
|
|
29503
|
+
}
|
|
29504
|
+
return new Promise((resolve2) => {
|
|
29505
|
+
setTimeout(() => {
|
|
29506
|
+
resolve2(
|
|
29507
|
+
waitForElementToBeVisible(
|
|
29508
|
+
element,
|
|
29509
|
+
retries + 1,
|
|
29510
|
+
maxRetries,
|
|
29511
|
+
Math.min(500, interval + Math.round(0.5 * interval))
|
|
29512
|
+
)
|
|
29513
|
+
);
|
|
29514
|
+
}, interval);
|
|
29515
|
+
});
|
|
29516
|
+
});
|
|
29491
29517
|
const saveToLocalStorage = (key, value) => {
|
|
29492
29518
|
try {
|
|
29493
29519
|
localStorage.setItem(key, JSON.stringify(value));
|
|
@@ -29502,6 +29528,12 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
29502
29528
|
return null;
|
|
29503
29529
|
}
|
|
29504
29530
|
};
|
|
29531
|
+
const removeFromLocalStorage = (key) => {
|
|
29532
|
+
try {
|
|
29533
|
+
localStorage.removeItem(key);
|
|
29534
|
+
} catch (e2) {
|
|
29535
|
+
}
|
|
29536
|
+
};
|
|
29505
29537
|
const saveToSessionStorage = (key, value) => {
|
|
29506
29538
|
try {
|
|
29507
29539
|
sessionStorage.setItem(key, JSON.stringify(value));
|
|
@@ -29516,6 +29548,12 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
29516
29548
|
return null;
|
|
29517
29549
|
}
|
|
29518
29550
|
};
|
|
29551
|
+
const removeFromSessionStorage = (key) => {
|
|
29552
|
+
try {
|
|
29553
|
+
sessionStorage.removeItem(key);
|
|
29554
|
+
} catch (e2) {
|
|
29555
|
+
}
|
|
29556
|
+
};
|
|
29519
29557
|
const getQueryParam = (name) => {
|
|
29520
29558
|
try {
|
|
29521
29559
|
const urlParams = new URLSearchParams(window.location.search);
|
|
@@ -29525,25 +29563,11 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
29525
29563
|
}
|
|
29526
29564
|
};
|
|
29527
29565
|
const PREVIEW_PARAMETER = "lupaSearchPreview";
|
|
29566
|
+
const MAX_ELEMENT_MOUNT_RETRIES = 25;
|
|
29528
29567
|
let styleElement = null;
|
|
29529
|
-
const
|
|
29530
|
-
if (retries > maxRetries) {
|
|
29531
|
-
return false;
|
|
29532
|
-
}
|
|
29533
|
-
if (typeof element === "string") {
|
|
29534
|
-
element = document.querySelector(element);
|
|
29535
|
-
}
|
|
29536
|
-
if (element) {
|
|
29537
|
-
return true;
|
|
29538
|
-
} else {
|
|
29539
|
-
setTimeout(() => {
|
|
29540
|
-
waitForElementToBeVisible(element, retries + 1, maxRetries, interval + 10);
|
|
29541
|
-
}, interval);
|
|
29542
|
-
}
|
|
29543
|
-
});
|
|
29544
|
-
const loadAndSaveConfigurationFromServer = (configurationKey, options) => __async2(this, null, function* () {
|
|
29568
|
+
const loadAndSaveConfigurationFromServer = (configurationKey, options2) => __async2(this, null, function* () {
|
|
29545
29569
|
const configuration2 = yield fetchPluginConfiguration(
|
|
29546
|
-
|
|
29570
|
+
options2,
|
|
29547
29571
|
configurationKey
|
|
29548
29572
|
);
|
|
29549
29573
|
if (!configuration2) {
|
|
@@ -29562,13 +29586,13 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
29562
29586
|
if (isPreviewMode) {
|
|
29563
29587
|
saveToSessionStorage(PREVIEW_PARAMETER, isPreviewMode);
|
|
29564
29588
|
} else {
|
|
29565
|
-
|
|
29589
|
+
removeFromSessionStorage(PREVIEW_PARAMETER);
|
|
29566
29590
|
}
|
|
29567
29591
|
return isPreviewMode;
|
|
29568
29592
|
};
|
|
29569
|
-
const loadConfigurations = (configurationKey, isPreviewMode,
|
|
29593
|
+
const loadConfigurations = (configurationKey, isPreviewMode, options2) => __async2(this, null, function* () {
|
|
29570
29594
|
if (isPreviewMode) {
|
|
29571
|
-
return loadAndSaveConfigurationFromServer(configurationKey,
|
|
29595
|
+
return loadAndSaveConfigurationFromServer(configurationKey, options2);
|
|
29572
29596
|
}
|
|
29573
29597
|
const existingConfiguration = tryLoadFromLocalStorage(configurationKey);
|
|
29574
29598
|
if (existingConfiguration) {
|
|
@@ -29576,22 +29600,27 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
29576
29600
|
var _a;
|
|
29577
29601
|
const newestConfiguration = yield loadAndSaveConfigurationFromServer(
|
|
29578
29602
|
configurationKey,
|
|
29579
|
-
|
|
29603
|
+
options2
|
|
29580
29604
|
);
|
|
29581
29605
|
if (existingConfiguration.updatedAt === newestConfiguration.updatedAt) {
|
|
29582
29606
|
return;
|
|
29583
29607
|
}
|
|
29584
29608
|
const isPreviewMode2 = checkIsPreviewMode();
|
|
29585
29609
|
const configuration2 = isPreviewMode2 ? (_a = newestConfiguration.previewConfiguration) != null ? _a : newestConfiguration.configuration : newestConfiguration.configuration;
|
|
29586
|
-
|
|
29587
|
-
|
|
29610
|
+
if (configuration2) {
|
|
29611
|
+
yield mount(configuration2, options2, false, true);
|
|
29612
|
+
} else {
|
|
29613
|
+
removeFromLocalStorage(configurationKey);
|
|
29614
|
+
window.location.reload();
|
|
29615
|
+
}
|
|
29616
|
+
}));
|
|
29588
29617
|
return existingConfiguration;
|
|
29589
29618
|
}
|
|
29590
|
-
return loadAndSaveConfigurationFromServer(configurationKey,
|
|
29619
|
+
return loadAndSaveConfigurationFromServer(configurationKey, options2);
|
|
29591
29620
|
});
|
|
29592
29621
|
const applyStyles = (configuration2) => __async2(this, null, function* () {
|
|
29593
29622
|
var _a;
|
|
29594
|
-
const visible2 = yield waitForElementToBeVisible(document.head);
|
|
29623
|
+
const visible2 = yield waitForElementToBeVisible(document.head, 0, 20, 5);
|
|
29595
29624
|
if (!visible2) {
|
|
29596
29625
|
console.error("Failed to apply custom LupaSearch styles, head element not found");
|
|
29597
29626
|
return;
|
|
@@ -29610,35 +29639,43 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
29610
29639
|
}
|
|
29611
29640
|
document.head.appendChild(styleElement);
|
|
29612
29641
|
});
|
|
29613
|
-
const mountSearchBox = (configuration, fetch = true) => __async2(this, null, function* () {
|
|
29642
|
+
const mountSearchBox = (configuration, options, fetch = true, remount = false) => __async2(this, null, function* () {
|
|
29614
29643
|
if (!configuration.searchBox) {
|
|
29615
29644
|
return;
|
|
29616
29645
|
}
|
|
29617
29646
|
const resolvedConfiguration = eval(`(${configuration.searchBox})`);
|
|
29618
|
-
const visible = yield waitForElementToBeVisible(
|
|
29619
|
-
|
|
29647
|
+
const visible = yield waitForElementToBeVisible(
|
|
29648
|
+
resolvedConfiguration.inputSelector,
|
|
29649
|
+
0,
|
|
29650
|
+
remount ? 0 : MAX_ELEMENT_MOUNT_RETRIES
|
|
29651
|
+
);
|
|
29652
|
+
if (!visible && !remount) {
|
|
29620
29653
|
console.error(
|
|
29621
29654
|
`Failed to mount LupaSearch search box, input element ${resolvedConfiguration.inputSelector} not found`
|
|
29622
29655
|
);
|
|
29623
29656
|
return;
|
|
29624
29657
|
}
|
|
29625
|
-
searchBox(resolvedConfiguration, { fetch });
|
|
29658
|
+
searchBox(__spreadProps2(__spreadValues2({}, resolvedConfiguration), { options }), { fetch });
|
|
29626
29659
|
});
|
|
29627
|
-
const mountSearchResults = (configuration, fetch = true) => __async2(this, null, function* () {
|
|
29660
|
+
const mountSearchResults = (configuration, options, fetch = true, remount = false) => __async2(this, null, function* () {
|
|
29628
29661
|
if (!configuration.searchResults) {
|
|
29629
29662
|
return;
|
|
29630
29663
|
}
|
|
29631
29664
|
const resolvedConfiguration = eval(`(${configuration.searchResults})`);
|
|
29632
|
-
const visible = yield waitForElementToBeVisible(
|
|
29633
|
-
|
|
29665
|
+
const visible = yield waitForElementToBeVisible(
|
|
29666
|
+
resolvedConfiguration.containerSelector,
|
|
29667
|
+
0,
|
|
29668
|
+
remount ? 0 : MAX_ELEMENT_MOUNT_RETRIES
|
|
29669
|
+
);
|
|
29670
|
+
if (!visible && !remount) {
|
|
29634
29671
|
console.error(
|
|
29635
29672
|
`Failed to mount LupaSearch search results, element ${resolvedConfiguration.containerSelector} not found`
|
|
29636
29673
|
);
|
|
29637
29674
|
return;
|
|
29638
29675
|
}
|
|
29639
|
-
searchResults(resolvedConfiguration, { fetch });
|
|
29676
|
+
searchResults(__spreadProps2(__spreadValues2({}, resolvedConfiguration), { options }), { fetch });
|
|
29640
29677
|
});
|
|
29641
|
-
const mountProductList = (configuration, fetch = true) => __async2(this, null, function* () {
|
|
29678
|
+
const mountProductList = (configuration, options, fetch = true, remount = false) => __async2(this, null, function* () {
|
|
29642
29679
|
if (!configuration.productList) {
|
|
29643
29680
|
return;
|
|
29644
29681
|
}
|
|
@@ -29646,16 +29683,23 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
29646
29683
|
`(${configuration.searchResults})`
|
|
29647
29684
|
);
|
|
29648
29685
|
const resolvedConfiguration = eval(`(${configuration.productList})`);
|
|
29649
|
-
const visible = yield waitForElementToBeVisible(
|
|
29650
|
-
|
|
29686
|
+
const visible = yield waitForElementToBeVisible(
|
|
29687
|
+
resolvedConfiguration.containerSelector,
|
|
29688
|
+
0,
|
|
29689
|
+
remount ? 0 : MAX_ELEMENT_MOUNT_RETRIES
|
|
29690
|
+
);
|
|
29691
|
+
if (!visible && !remount) {
|
|
29651
29692
|
console.error(
|
|
29652
29693
|
`Failed to mount LupaSearch product list, element ${resolvedConfiguration.containerSelector} not found`
|
|
29653
29694
|
);
|
|
29654
29695
|
return;
|
|
29655
29696
|
}
|
|
29656
|
-
productList(
|
|
29697
|
+
productList(
|
|
29698
|
+
__spreadProps2(__spreadValues2(__spreadValues2({}, resolvedSearchResultsConfiguration), resolvedConfiguration), { options }),
|
|
29699
|
+
{ fetch }
|
|
29700
|
+
);
|
|
29657
29701
|
});
|
|
29658
|
-
const mountRecommendations = (configuration, fetch = true) => __async2(this, null, function* () {
|
|
29702
|
+
const mountRecommendations = (configuration, options, fetch = true, remount = false) => __async2(this, null, function* () {
|
|
29659
29703
|
if (!configuration.recommendations) {
|
|
29660
29704
|
return;
|
|
29661
29705
|
}
|
|
@@ -29665,16 +29709,23 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
29665
29709
|
const resolvedConfiguration = eval(
|
|
29666
29710
|
`(${configuration.recommendations})`
|
|
29667
29711
|
);
|
|
29668
|
-
const visible = yield waitForElementToBeVisible(
|
|
29669
|
-
|
|
29712
|
+
const visible = yield waitForElementToBeVisible(
|
|
29713
|
+
resolvedConfiguration.containerSelector,
|
|
29714
|
+
0,
|
|
29715
|
+
remount ? 0 : MAX_ELEMENT_MOUNT_RETRIES
|
|
29716
|
+
);
|
|
29717
|
+
if (!visible && !remount) {
|
|
29670
29718
|
console.error(
|
|
29671
29719
|
`Failed to mount LupaSearch recommendations, element ${resolvedConfiguration.containerSelector} not found`
|
|
29672
29720
|
);
|
|
29673
29721
|
return;
|
|
29674
29722
|
}
|
|
29675
|
-
recommendations(
|
|
29723
|
+
recommendations(
|
|
29724
|
+
__spreadProps2(__spreadValues2(__spreadValues2({}, resolvedSearchResultsConfiguration), resolvedConfiguration), { options }),
|
|
29725
|
+
{ fetch }
|
|
29726
|
+
);
|
|
29676
29727
|
});
|
|
29677
|
-
const mountChat = (configuration, fetch = true) => __async2(this, null, function* () {
|
|
29728
|
+
const mountChat = (configuration, options, fetch = true, remount = false) => __async2(this, null, function* () {
|
|
29678
29729
|
if (!configuration.genAiChat) {
|
|
29679
29730
|
return;
|
|
29680
29731
|
}
|
|
@@ -29682,41 +29733,47 @@ var __async2 = (__this, __arguments, generator) => {
|
|
|
29682
29733
|
`(${configuration.searchResults})`
|
|
29683
29734
|
);
|
|
29684
29735
|
const resolvedConfiguration = eval(`(${configuration.genAiChat})`);
|
|
29685
|
-
const visible = yield waitForElementToBeVisible(
|
|
29686
|
-
|
|
29736
|
+
const visible = yield waitForElementToBeVisible(
|
|
29737
|
+
resolvedConfiguration.containerSelector,
|
|
29738
|
+
0,
|
|
29739
|
+
remount ? 0 : MAX_ELEMENT_MOUNT_RETRIES
|
|
29740
|
+
);
|
|
29741
|
+
if (!visible && !remount) {
|
|
29687
29742
|
console.error(
|
|
29688
29743
|
`Failed to mount LupaSearch chat, element ${resolvedConfiguration.containerSelector} not found`
|
|
29689
29744
|
);
|
|
29690
29745
|
return;
|
|
29691
29746
|
}
|
|
29692
|
-
chat(__spreadValues2(__spreadValues2({}, resolvedSearchResultsConfiguration), resolvedConfiguration), { fetch });
|
|
29747
|
+
chat(__spreadProps2(__spreadValues2(__spreadValues2({}, resolvedSearchResultsConfiguration), resolvedConfiguration), { options }), { fetch });
|
|
29693
29748
|
});
|
|
29694
|
-
const mount = (configuration2, fetch2 = true) => __async2(this, null, function* () {
|
|
29749
|
+
const mount = (configuration2, options2, fetch2 = true, remount2 = false) => __async2(this, null, function* () {
|
|
29695
29750
|
yield applyStyles(configuration2);
|
|
29696
29751
|
const mountPromises = [
|
|
29697
|
-
mountSearchBox(configuration2, fetch2),
|
|
29698
|
-
mountSearchResults(configuration2, fetch2),
|
|
29699
|
-
mountProductList(configuration2, fetch2),
|
|
29700
|
-
mountRecommendations(configuration2, fetch2),
|
|
29701
|
-
mountChat(configuration2, fetch2)
|
|
29752
|
+
mountSearchBox(configuration2, options2, fetch2, remount2),
|
|
29753
|
+
mountSearchResults(configuration2, options2, fetch2, remount2),
|
|
29754
|
+
mountProductList(configuration2, options2, fetch2, remount2),
|
|
29755
|
+
mountRecommendations(configuration2, options2, fetch2, remount2),
|
|
29756
|
+
mountChat(configuration2, options2, fetch2, remount2)
|
|
29702
29757
|
];
|
|
29703
29758
|
yield Promise.all(mountPromises);
|
|
29704
29759
|
});
|
|
29705
|
-
const init$1 = (configurationKey,
|
|
29760
|
+
const init$1 = (configurationKey, options2) => __async2(this, null, function* () {
|
|
29706
29761
|
var _a;
|
|
29707
29762
|
const isPreviewMode = checkIsPreviewMode();
|
|
29708
|
-
const plugin = yield loadConfigurations(configurationKey, isPreviewMode,
|
|
29763
|
+
const plugin = yield loadConfigurations(configurationKey, isPreviewMode, options2);
|
|
29709
29764
|
const configuration2 = isPreviewMode ? (_a = plugin.previewConfiguration) != null ? _a : plugin.configuration : plugin.configuration;
|
|
29710
|
-
|
|
29765
|
+
if (configuration2) {
|
|
29766
|
+
yield mount(configuration2, options2);
|
|
29767
|
+
}
|
|
29711
29768
|
});
|
|
29712
29769
|
const PluginConfigurationManager = {
|
|
29713
29770
|
init: init$1
|
|
29714
29771
|
};
|
|
29715
|
-
const tracking = (
|
|
29716
|
-
setupTracking(
|
|
29772
|
+
const tracking = (options2) => {
|
|
29773
|
+
setupTracking(options2);
|
|
29717
29774
|
};
|
|
29718
|
-
const init = (configurationKey,
|
|
29719
|
-
return PluginConfigurationManager.init(configurationKey,
|
|
29775
|
+
const init = (configurationKey, options2) => {
|
|
29776
|
+
return PluginConfigurationManager.init(configurationKey, options2);
|
|
29720
29777
|
};
|
|
29721
29778
|
const lupaSearch = {
|
|
29722
29779
|
init,
|