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