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