@getlupa/client 1.15.9 → 1.15.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -69,9 +69,9 @@ const isDate = (val) => toTypeString(val) === "[object Date]";
69
69
  const isFunction$1 = (val) => typeof val === "function";
70
70
  const isString = (val) => typeof val === "string";
71
71
  const isSymbol = (val) => typeof val === "symbol";
72
- const isObject$2 = (val) => val !== null && typeof val === "object";
72
+ const isObject$3 = (val) => val !== null && typeof val === "object";
73
73
  const isPromise$1 = (val) => {
74
- return isObject$2(val) && isFunction$1(val.then) && isFunction$1(val.catch);
74
+ return isObject$3(val) && isFunction$1(val.then) && isFunction$1(val.catch);
75
75
  };
76
76
  const objectToString$1 = Object.prototype.toString;
77
77
  const toTypeString = (value) => objectToString$1.call(value);
@@ -145,7 +145,7 @@ function normalizeStyle(value) {
145
145
  return res;
146
146
  } else if (isString(value)) {
147
147
  return value;
148
- } else if (isObject$2(value)) {
148
+ } else if (isObject$3(value)) {
149
149
  return value;
150
150
  }
151
151
  }
@@ -173,7 +173,7 @@ function normalizeClass(value) {
173
173
  res += normalized + " ";
174
174
  }
175
175
  }
176
- } else if (isObject$2(value)) {
176
+ } else if (isObject$3(value)) {
177
177
  for (const name in value) {
178
178
  if (value[name]) {
179
179
  res += name + " ";
@@ -226,8 +226,8 @@ function looseEqual(a, b) {
226
226
  if (aValidType || bValidType) {
227
227
  return aValidType && bValidType ? looseCompareArrays(a, b) : false;
228
228
  }
229
- aValidType = isObject$2(a);
230
- bValidType = isObject$2(b);
229
+ aValidType = isObject$3(a);
230
+ bValidType = isObject$3(b);
231
231
  if (aValidType || bValidType) {
232
232
  if (!aValidType || !bValidType) {
233
233
  return false;
@@ -251,7 +251,7 @@ function looseIndexOf(arr, val) {
251
251
  return arr.findIndex((item) => looseEqual(item, val));
252
252
  }
253
253
  const toDisplayString = (val) => {
254
- return isString(val) ? val : val == null ? "" : isArray$1(val) || isObject$2(val) && (val.toString === objectToString$1 || !isFunction$1(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val);
254
+ return isString(val) ? val : val == null ? "" : isArray$1(val) || isObject$3(val) && (val.toString === objectToString$1 || !isFunction$1(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val);
255
255
  };
256
256
  const replacer = (_key, val) => {
257
257
  if (val && val.__v_isRef) {
@@ -267,7 +267,7 @@ const replacer = (_key, val) => {
267
267
  return {
268
268
  [`Set(${val.size})`]: [...val.values()]
269
269
  };
270
- } else if (isObject$2(val) && !isArray$1(val) && !isPlainObject$4(val)) {
270
+ } else if (isObject$3(val) && !isArray$1(val) && !isPlainObject$4(val)) {
271
271
  return String(val);
272
272
  }
273
273
  return val;
@@ -660,7 +660,7 @@ function createGetter(isReadonly2 = false, shallow = false) {
660
660
  if (isRef(res)) {
661
661
  return targetIsArray && isIntegerKey(key) ? res : res.value;
662
662
  }
663
- if (isObject$2(res)) {
663
+ if (isObject$3(res)) {
664
664
  return isReadonly2 ? readonly(res) : reactive(res);
665
665
  }
666
666
  return res;
@@ -1054,7 +1054,7 @@ function readonly(target) {
1054
1054
  );
1055
1055
  }
1056
1056
  function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
1057
- if (!isObject$2(target)) {
1057
+ if (!isObject$3(target)) {
1058
1058
  return target;
1059
1059
  }
1060
1060
  if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
@@ -1098,8 +1098,8 @@ function markRaw(value) {
1098
1098
  def(value, "__v_skip", true);
1099
1099
  return value;
1100
1100
  }
1101
- const toReactive = (value) => isObject$2(value) ? reactive(value) : value;
1102
- const toReadonly = (value) => isObject$2(value) ? readonly(value) : value;
1101
+ const toReactive = (value) => isObject$3(value) ? reactive(value) : value;
1102
+ const toReadonly = (value) => isObject$3(value) ? readonly(value) : value;
1103
1103
  function trackRefValue(ref2) {
1104
1104
  if (shouldTrack && activeEffect) {
1105
1105
  ref2 = toRaw(ref2);
@@ -1209,7 +1209,7 @@ function toRef(source, key, defaultValue) {
1209
1209
  return source;
1210
1210
  } else if (isFunction$1(source)) {
1211
1211
  return new GetterRefImpl(source);
1212
- } else if (isObject$2(source) && arguments.length > 1) {
1212
+ } else if (isObject$3(source) && arguments.length > 1) {
1213
1213
  return propertyToRef(source, key, defaultValue);
1214
1214
  } else {
1215
1215
  return ref(source);
@@ -1529,7 +1529,7 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
1529
1529
  }
1530
1530
  }
1531
1531
  if (!raw && !hasExtends) {
1532
- if (isObject$2(comp)) {
1532
+ if (isObject$3(comp)) {
1533
1533
  cache.set(comp, null);
1534
1534
  }
1535
1535
  return null;
@@ -1539,7 +1539,7 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
1539
1539
  } else {
1540
1540
  extend(normalized, raw);
1541
1541
  }
1542
- if (isObject$2(comp)) {
1542
+ if (isObject$3(comp)) {
1543
1543
  cache.set(comp, normalized);
1544
1544
  }
1545
1545
  return normalized;
@@ -1947,7 +1947,7 @@ function createPathGetter(ctx, path) {
1947
1947
  };
1948
1948
  }
1949
1949
  function traverse(value, seen) {
1950
- if (!isObject$2(value) || value["__v_skip"]) {
1950
+ if (!isObject$3(value) || value["__v_skip"]) {
1951
1951
  return value;
1952
1952
  }
1953
1953
  seen = seen || /* @__PURE__ */ new Set();
@@ -2482,7 +2482,7 @@ function renderList(source, renderItem, cache, index) {
2482
2482
  for (let i = 0; i < source; i++) {
2483
2483
  ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
2484
2484
  }
2485
- } else if (isObject$2(source)) {
2485
+ } else if (isObject$3(source)) {
2486
2486
  if (source[Symbol.iterator]) {
2487
2487
  ret = Array.from(
2488
2488
  source,
@@ -2759,7 +2759,7 @@ function applyOptions(instance) {
2759
2759
  }
2760
2760
  if (dataOptions) {
2761
2761
  const data = dataOptions.call(publicThis, publicThis);
2762
- if (!isObject$2(data))
2762
+ if (!isObject$3(data))
2763
2763
  ;
2764
2764
  else {
2765
2765
  instance.data = reactive(data);
@@ -2847,7 +2847,7 @@ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP)
2847
2847
  for (const key in injectOptions) {
2848
2848
  const opt = injectOptions[key];
2849
2849
  let injected;
2850
- if (isObject$2(opt)) {
2850
+ if (isObject$3(opt)) {
2851
2851
  if ("default" in opt) {
2852
2852
  injected = inject(
2853
2853
  opt.from || key,
@@ -2889,7 +2889,7 @@ function createWatcher(raw, ctx, publicThis, key) {
2889
2889
  }
2890
2890
  } else if (isFunction$1(raw)) {
2891
2891
  watch(getter, raw.bind(publicThis));
2892
- } else if (isObject$2(raw)) {
2892
+ } else if (isObject$3(raw)) {
2893
2893
  if (isArray$1(raw)) {
2894
2894
  raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
2895
2895
  } else {
@@ -2926,7 +2926,7 @@ function resolveMergedOptions(instance) {
2926
2926
  }
2927
2927
  mergeOptions(resolved, base, optionMergeStrategies);
2928
2928
  }
2929
- if (isObject$2(base)) {
2929
+ if (isObject$3(base)) {
2930
2930
  cache.set(base, resolved);
2931
2931
  }
2932
2932
  return resolved;
@@ -3067,7 +3067,7 @@ function createAppAPI(render4, hydrate) {
3067
3067
  if (!isFunction$1(rootComponent)) {
3068
3068
  rootComponent = extend({}, rootComponent);
3069
3069
  }
3070
- if (rootProps != null && !isObject$2(rootProps)) {
3070
+ if (rootProps != null && !isObject$3(rootProps)) {
3071
3071
  rootProps = null;
3072
3072
  }
3073
3073
  const context = createAppContext();
@@ -3411,7 +3411,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
3411
3411
  }
3412
3412
  }
3413
3413
  if (!raw && !hasExtends) {
3414
- if (isObject$2(comp)) {
3414
+ if (isObject$3(comp)) {
3415
3415
  cache.set(comp, EMPTY_ARR);
3416
3416
  }
3417
3417
  return EMPTY_ARR;
@@ -3448,7 +3448,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
3448
3448
  }
3449
3449
  }
3450
3450
  const res = [normalized, needCastKeys];
3451
- if (isObject$2(comp)) {
3451
+ if (isObject$3(comp)) {
3452
3452
  cache.set(comp, res);
3453
3453
  }
3454
3454
  return res;
@@ -5112,14 +5112,14 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
5112
5112
  if (klass && !isString(klass)) {
5113
5113
  props.class = normalizeClass(klass);
5114
5114
  }
5115
- if (isObject$2(style)) {
5115
+ if (isObject$3(style)) {
5116
5116
  if (isProxy(style) && !isArray$1(style)) {
5117
5117
  style = extend({}, style);
5118
5118
  }
5119
5119
  props.style = normalizeStyle(style);
5120
5120
  }
5121
5121
  }
5122
- const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject$2(type) ? 4 : isFunction$1(type) ? 2 : 0;
5122
+ const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject$3(type) ? 4 : isFunction$1(type) ? 2 : 0;
5123
5123
  return createBaseVNode(
5124
5124
  type,
5125
5125
  props,
@@ -5456,7 +5456,7 @@ function handleSetupResult(instance, setupResult, isSSR) {
5456
5456
  } else {
5457
5457
  instance.render = setupResult;
5458
5458
  }
5459
- } else if (isObject$2(setupResult)) {
5459
+ } else if (isObject$3(setupResult)) {
5460
5460
  instance.setupState = proxyRefs(setupResult);
5461
5461
  } else
5462
5462
  ;
@@ -5548,7 +5548,7 @@ const computed = (getterOrOptions, debugOptions) => {
5548
5548
  function h$1(type, propsOrChildren, children) {
5549
5549
  const l = arguments.length;
5550
5550
  if (l === 2) {
5551
- if (isObject$2(propsOrChildren) && !isArray$1(propsOrChildren)) {
5551
+ if (isObject$3(propsOrChildren) && !isArray$1(propsOrChildren)) {
5552
5552
  if (isVNode(propsOrChildren)) {
5553
5553
  return createVNode(type, null, [propsOrChildren]);
5554
5554
  }
@@ -6054,7 +6054,7 @@ function resolveTransitionProps(rawProps) {
6054
6054
  function normalizeDuration(duration) {
6055
6055
  if (duration == null) {
6056
6056
  return null;
6057
- } else if (isObject$2(duration)) {
6057
+ } else if (isObject$3(duration)) {
6058
6058
  return [NumberOf(duration.enter), NumberOf(duration.leave)];
6059
6059
  } else {
6060
6060
  const n = NumberOf(duration);
@@ -12900,18 +12900,18 @@ Object.defineProperty(isPlainObject$2, "__esModule", { value: true });
12900
12900
  * Copyright (c) 2014-2017, Jon Schlinkert.
12901
12901
  * Released under the MIT License.
12902
12902
  */
12903
- function isObject(o) {
12903
+ function isObject$2(o) {
12904
12904
  return Object.prototype.toString.call(o) === "[object Object]";
12905
12905
  }
12906
12906
  function isPlainObject$1(o) {
12907
12907
  var ctor, prot;
12908
- if (isObject(o) === false)
12908
+ if (isObject$2(o) === false)
12909
12909
  return false;
12910
12910
  ctor = o.constructor;
12911
12911
  if (ctor === void 0)
12912
12912
  return true;
12913
12913
  prot = ctor.prototype;
12914
- if (isObject(prot) === false)
12914
+ if (isObject$2(prot) === false)
12915
12915
  return false;
12916
12916
  if (prot.hasOwnProperty("isPrototypeOf") === false) {
12917
12917
  return false;
@@ -17697,12 +17697,12 @@ sanitizeHtml.defaults = {
17697
17697
  enforceHtmlBoundary: false,
17698
17698
  parseStyleAttributes: true
17699
17699
  };
17700
- sanitizeHtml.simpleTransform = function(newTagName, newAttribs, merge) {
17701
- merge = merge === void 0 ? true : merge;
17700
+ sanitizeHtml.simpleTransform = function(newTagName, newAttribs, merge2) {
17701
+ merge2 = merge2 === void 0 ? true : merge2;
17702
17702
  newAttribs = newAttribs || {};
17703
17703
  return function(tagName, attribs) {
17704
17704
  let attrib;
17705
- if (merge) {
17705
+ if (merge2) {
17706
17706
  for (attrib in newAttribs) {
17707
17707
  attribs[attrib] = newAttribs[attrib];
17708
17708
  }
@@ -19700,6 +19700,74 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
19700
19700
  };
19701
19701
  }
19702
19702
  });
19703
+ const extractValue = (options) => {
19704
+ switch (options.extractFrom) {
19705
+ case "url":
19706
+ return extractFromUrl(options);
19707
+ case "localStorage":
19708
+ case "sessionStorage":
19709
+ return extractFromStorage(options);
19710
+ case "htmlElementText":
19711
+ return extractFromHtmlElementText(options);
19712
+ case "cookie":
19713
+ return extractFromCookie(options);
19714
+ default:
19715
+ return options.default;
19716
+ }
19717
+ };
19718
+ const extractFromCookie = (options) => {
19719
+ var _a, _b;
19720
+ try {
19721
+ const cookieValue = (_b = (_a = document.cookie) == null ? void 0 : _a.split("; ")) == null ? void 0 : _b.find((row) => row == null ? void 0 : row.startsWith(`${options.cookieName}=`));
19722
+ return cookieValue ? cookieValue.split("=")[1] : options.default;
19723
+ } catch (e2) {
19724
+ return options.default;
19725
+ }
19726
+ };
19727
+ const extractFromUrl = (options) => {
19728
+ const regex = new RegExp(options.regex);
19729
+ const match = window.location.href.match(regex);
19730
+ return match ? match[1] : options.default;
19731
+ };
19732
+ const extractFromStorage = (options) => {
19733
+ const storage = options.extractFrom === "localStorage" ? localStorage : sessionStorage;
19734
+ let rawValue2 = "";
19735
+ try {
19736
+ rawValue2 = storage.getItem(options.key);
19737
+ } catch (e2) {
19738
+ return options.default;
19739
+ }
19740
+ if (rawValue2) {
19741
+ try {
19742
+ const parsedValue = JSON.parse(rawValue2);
19743
+ return options.path ? getValueFromPath(parsedValue, options.path) : parsedValue;
19744
+ } catch (e2) {
19745
+ return rawValue2;
19746
+ }
19747
+ }
19748
+ return options.default;
19749
+ };
19750
+ const extractFromHtmlElementText = (options) => {
19751
+ var _a;
19752
+ const element = document.querySelector(options.querySelector);
19753
+ return element ? ((_a = element.textContent) == null ? void 0 : _a.trim()) || options.default : options.default;
19754
+ };
19755
+ const getValueFromPath = (obj, path) => {
19756
+ return path.split(".").reduce((value, key) => value && value[key] || null, obj);
19757
+ };
19758
+ const processExtractionObject = (value = {}) => {
19759
+ var _a;
19760
+ const parsedObject = {};
19761
+ for (const key in value) {
19762
+ if (isObject$1(value[key]) && ((_a = value[key]) == null ? void 0 : _a.extractFrom)) {
19763
+ const extractedValue = extractValue(value[key]);
19764
+ parsedObject[key] = Array.isArray(extractedValue) ? extractedValue : [extractedValue];
19765
+ } else {
19766
+ parsedObject[key] = value[key];
19767
+ }
19768
+ }
19769
+ return parsedObject;
19770
+ };
19703
19771
  const _sfc_main$11 = /* @__PURE__ */ defineComponent({
19704
19772
  __name: "SearchBoxProductsWrapper",
19705
19773
  props: {
@@ -19723,6 +19791,9 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
19723
19791
  const showGoToResultsButton = computed(() => {
19724
19792
  return props.panel.showGoToResults;
19725
19793
  });
19794
+ const extractedInitialFilters = computed(() => {
19795
+ return __spreadValues2({}, processExtractionObject(props.searchBoxOptions.initialFilters));
19796
+ });
19726
19797
  const inputValueProp = computed(() => props.inputValue);
19727
19798
  onMounted(() => {
19728
19799
  getItemsDebounced();
@@ -19740,7 +19811,11 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
19740
19811
  const getItems = () => {
19741
19812
  searchBoxStore.queryDocuments({
19742
19813
  queryKey: props.panel.queryKey,
19743
- publicQuery: { searchText: props.inputValue, limit: props.panel.limit },
19814
+ publicQuery: {
19815
+ searchText: props.inputValue,
19816
+ limit: props.panel.limit,
19817
+ filters: extractedInitialFilters.value
19818
+ },
19744
19819
  options: props.options
19745
19820
  }).then(({ result: result2 }) => {
19746
19821
  if (!(result2 == null ? void 0 : result2.items.length)) {
@@ -20169,6 +20244,9 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent({
20169
20244
  const focused = ref(false);
20170
20245
  const searchBoxInput = ref(null);
20171
20246
  const { highlightedDocument } = storeToRefs(searchBoxStore);
20247
+ computed(() => {
20248
+ return __spreadValues2({}, processExtractionObject(props.options.initialFilters));
20249
+ });
20172
20250
  const searchValue = computed(() => {
20173
20251
  return suggestedValue.value.override ? suggestedValue.value.item.suggestion : inputValue.value;
20174
20252
  });
@@ -20194,7 +20272,8 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent({
20194
20272
  "hideMoreResultsButtonOnNoResults",
20195
20273
  "showNoResultsPanel",
20196
20274
  "expandOnSinglePanel",
20197
- "showMoreResultsButton"
20275
+ "showMoreResultsButton",
20276
+ "initialFilters"
20198
20277
  ])
20199
20278
  );
20200
20279
  const searchTriggers = computed(() => {
@@ -25321,7 +25400,10 @@ const _hoisted_2$a = {
25321
25400
  class: "lupa-category-back"
25322
25401
  };
25323
25402
  const _hoisted_3$6 = ["href"];
25324
- const _hoisted_4$3 = { class: "lupa-child-category-list" };
25403
+ const _hoisted_4$3 = {
25404
+ key: 1,
25405
+ class: "lupa-child-category-list"
25406
+ };
25325
25407
  const _sfc_main$f = /* @__PURE__ */ defineComponent({
25326
25408
  __name: "CategoryTopFilters",
25327
25409
  props: {
@@ -25335,6 +25417,10 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
25335
25417
  var _a, _b;
25336
25418
  return Boolean((_b = (_a = props.options.categories) == null ? void 0 : _a.back) == null ? void 0 : _b.title);
25337
25419
  });
25420
+ const hasRelatedCategoryChildren = computed(() => {
25421
+ var _a;
25422
+ return ((_a = relatedCategoryChildren.value) == null ? void 0 : _a.length) > 0;
25423
+ });
25338
25424
  const backTitle = computed(() => {
25339
25425
  var _a, _b;
25340
25426
  return (_b = (_a = props.options.categories) == null ? void 0 : _a.back) == null ? void 0 : _b.title;
@@ -25361,7 +25447,10 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
25361
25447
  };
25362
25448
  return (_ctx, _cache) => {
25363
25449
  return openBlock(), createElementBlock("div", {
25364
- class: normalizeClass(["lupa-category-top-mobile-filters", { "lupa-has-back-button": hasBackButton.value }])
25450
+ class: normalizeClass(["lupa-category-top-mobile-filters", {
25451
+ "lupa-has-back-button": hasBackButton.value,
25452
+ "has-related-category-children": hasRelatedCategoryChildren.value
25453
+ }])
25365
25454
  }, [
25366
25455
  createBaseVNode("div", _hoisted_1$d, [
25367
25456
  hasBackButton.value ? (openBlock(), createElementBlock("div", _hoisted_2$a, [
@@ -25371,7 +25460,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
25371
25460
  onClick: handleNavigationBack
25372
25461
  }, toDisplayString(backTitle.value), 9, _hoisted_3$6)
25373
25462
  ])) : createCommentVNode("", true),
25374
- createBaseVNode("div", _hoisted_4$3, [
25463
+ hasRelatedCategoryChildren.value ? (openBlock(), createElementBlock("div", _hoisted_4$3, [
25375
25464
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(relatedCategoryChildren), (child) => {
25376
25465
  return openBlock(), createBlock(_sfc_main$U, {
25377
25466
  key: getCategoryKey(child),
@@ -25379,7 +25468,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
25379
25468
  options: categoryOptions.value
25380
25469
  }, null, 8, ["item", "options"]);
25381
25470
  }), 128))
25382
- ]),
25471
+ ])) : createCommentVNode("", true),
25383
25472
  createVNode(_sfc_main$B, {
25384
25473
  class: "lupa-toolbar-mobile",
25385
25474
  "pagination-location": "top",
@@ -25419,9 +25508,12 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
25419
25508
  const dynamicDataStore = useDynamicDataStore();
25420
25509
  const screenStore = useScreenStore();
25421
25510
  const redirectionStore = useRedirectionStore();
25511
+ const extractedInitialFilters = computed(() => {
25512
+ return __spreadValues2({}, processExtractionObject(props.options.initialFilters));
25513
+ });
25422
25514
  const initialFilters = computed(() => {
25423
- var _a;
25424
- return (_a = props.initialFilters) != null ? _a : {};
25515
+ var _a, _b;
25516
+ return (_b = (_a = props.initialFilters) != null ? _a : extractedInitialFilters.value) != null ? _b : {};
25425
25517
  });
25426
25518
  const { currentQueryText, hasResults, currentFilterCount } = storeToRefs(searchResultStore);
25427
25519
  const { searchString, sortParams } = storeToRefs(paramStore);
@@ -25727,62 +25819,6 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
25727
25819
  };
25728
25820
  }
25729
25821
  });
25730
- const extractValue = (options) => {
25731
- switch (options.extractFrom) {
25732
- case "url":
25733
- return extractFromUrl(options);
25734
- case "localStorage":
25735
- case "sessionStorage":
25736
- return extractFromStorage(options);
25737
- case "htmlElementText":
25738
- return extractFromHtmlElementText(options);
25739
- default:
25740
- return options.default;
25741
- }
25742
- };
25743
- const extractFromUrl = (options) => {
25744
- const regex = new RegExp(options.regex);
25745
- const match = window.location.href.match(regex);
25746
- return match ? match[1] : options.default;
25747
- };
25748
- const extractFromStorage = (options) => {
25749
- const storage = options.extractFrom === "localStorage" ? localStorage : sessionStorage;
25750
- let rawValue2 = "";
25751
- try {
25752
- rawValue2 = storage.getItem(options.key);
25753
- } catch (e2) {
25754
- return options.default;
25755
- }
25756
- if (rawValue2) {
25757
- try {
25758
- const parsedValue = JSON.parse(rawValue2);
25759
- return options.path ? getValueFromPath(parsedValue, options.path) : parsedValue;
25760
- } catch (e2) {
25761
- return rawValue2;
25762
- }
25763
- }
25764
- return options.default;
25765
- };
25766
- const extractFromHtmlElementText = (options) => {
25767
- var _a;
25768
- const element = document.querySelector(options.querySelector);
25769
- return element ? ((_a = element.textContent) == null ? void 0 : _a.trim()) || options.default : options.default;
25770
- };
25771
- const getValueFromPath = (obj, path) => {
25772
- return path.split(".").reduce((value, key) => value && value[key] || null, obj);
25773
- };
25774
- const processExtractionObject = (value = {}) => {
25775
- var _a;
25776
- const parsedObject = {};
25777
- for (const key in value) {
25778
- if (isObject$1(value[key]) && ((_a = value[key]) == null ? void 0 : _a.extractFrom)) {
25779
- parsedObject[key] = extractValue(value[key]);
25780
- } else {
25781
- parsedObject[key] = value[key];
25782
- }
25783
- }
25784
- return parsedObject;
25785
- };
25786
25822
  const _sfc_main$c = /* @__PURE__ */ defineComponent({
25787
25823
  __name: "ProductList",
25788
25824
  props: {
@@ -25802,7 +25838,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
25802
25838
  var _a;
25803
25839
  (_a = searchResults2.value) == null ? void 0 : _a.handleMounted();
25804
25840
  };
25805
- computed(() => {
25841
+ const initialFilters = computed(() => {
25806
25842
  return __spreadValues2({}, processExtractionObject(props.options.initialFilters));
25807
25843
  });
25808
25844
  __expose({ fetch: fetch2 });
@@ -25810,7 +25846,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
25810
25846
  return openBlock(), createElementBlock("div", null, [
25811
25847
  createVNode(_sfc_main$e, {
25812
25848
  options: componentOptions.value,
25813
- "initial-filters": _ctx.options.initialFilters,
25849
+ "initial-filters": initialFilters.value,
25814
25850
  "is-product-list": true,
25815
25851
  ref_key: "searchResults",
25816
25852
  ref: searchResults2
@@ -30198,7 +30234,7 @@ lodash$1.exports;
30198
30234
  });
30199
30235
  return result3;
30200
30236
  }
30201
- var merge = createAssigner(function(object, source, srcIndex) {
30237
+ var merge2 = createAssigner(function(object, source, srcIndex) {
30202
30238
  baseMerge(object, source, srcIndex);
30203
30239
  });
30204
30240
  var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
@@ -30888,7 +30924,7 @@ lodash$1.exports;
30888
30924
  lodash2.matches = matches;
30889
30925
  lodash2.matchesProperty = matchesProperty;
30890
30926
  lodash2.memoize = memoize;
30891
- lodash2.merge = merge;
30927
+ lodash2.merge = merge2;
30892
30928
  lodash2.mergeWith = mergeWith;
30893
30929
  lodash2.method = method;
30894
30930
  lodash2.methodOf = methodOf;
@@ -37724,7 +37760,7 @@ lodash.exports;
37724
37760
  });
37725
37761
  return result3;
37726
37762
  }
37727
- var merge = createAssigner(function(object, source, srcIndex) {
37763
+ var merge2 = createAssigner(function(object, source, srcIndex) {
37728
37764
  baseMerge(object, source, srcIndex);
37729
37765
  });
37730
37766
  var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
@@ -38414,7 +38450,7 @@ lodash.exports;
38414
38450
  lodash2.matches = matches;
38415
38451
  lodash2.matchesProperty = matchesProperty;
38416
38452
  lodash2.memoize = memoize;
38417
- lodash2.merge = merge;
38453
+ lodash2.merge = merge2;
38418
38454
  lodash2.mergeWith = mergeWith;
38419
38455
  lodash2.method = method;
38420
38456
  lodash2.methodOf = methodOf;
@@ -39571,6 +39607,14 @@ const waitForElementToBeVisible = (element, retries = 0, maxRetries = 30, interv
39571
39607
  }, interval);
39572
39608
  });
39573
39609
  });
39610
+ const isObject = (item) => typeof item === "object" && !Array.isArray(item);
39611
+ const merge = (target, source) => {
39612
+ const isDeep = (prop) => isObject(source[prop]) && Object.prototype.hasOwnProperty.call(target, prop) && isObject(target[prop]);
39613
+ const replaced = Object.getOwnPropertyNames(source).map((prop) => ({
39614
+ [prop]: isDeep(prop) ? merge(target[prop], source[prop]) : source[prop]
39615
+ })).reduce((a, b) => __spreadValues(__spreadValues({}, a), b), {});
39616
+ return __spreadValues(__spreadValues({}, target), replaced);
39617
+ };
39574
39618
  const saveToLocalStorage = (key, value) => {
39575
39619
  try {
39576
39620
  localStorage.setItem(key, JSON.stringify(value));
@@ -39622,7 +39666,7 @@ const getQueryParam = (name) => {
39622
39666
  const PREVIEW_PARAMETER = "lupaSearchPreview";
39623
39667
  const MAX_ELEMENT_MOUNT_RETRIES = 25;
39624
39668
  let styleElement = null;
39625
- const loadAndSaveConfigurationFromServer = (configurationKey, options) => __async(void 0, null, function* () {
39669
+ const loadAndSaveConfigurationFromServer = (_0, ..._1) => __async(void 0, [_0, ..._1], function* (configurationKey, options = { environment: "production" }) {
39626
39670
  const configuration = yield fetchPluginConfiguration(
39627
39671
  options,
39628
39672
  configurationKey
@@ -39647,7 +39691,7 @@ const checkIsPreviewMode = () => {
39647
39691
  }
39648
39692
  return isPreviewMode;
39649
39693
  };
39650
- const loadConfigurations = (configurationKey, isPreviewMode, options) => __async(void 0, null, function* () {
39694
+ const loadConfigurations = (configurationKey, isPreviewMode, options, optionOverrides) => __async(void 0, null, function* () {
39651
39695
  if (isPreviewMode) {
39652
39696
  return loadAndSaveConfigurationFromServer(configurationKey, options);
39653
39697
  }
@@ -39665,7 +39709,7 @@ const loadConfigurations = (configurationKey, isPreviewMode, options) => __async
39665
39709
  const isPreviewMode2 = checkIsPreviewMode();
39666
39710
  const configuration = isPreviewMode2 ? (_a = newestConfiguration.previewConfiguration) != null ? _a : newestConfiguration.configuration : newestConfiguration.configuration;
39667
39711
  if (configuration) {
39668
- yield mount(configuration, options, false, true);
39712
+ yield mount(configuration, options, optionOverrides, false, true);
39669
39713
  } else {
39670
39714
  removeFromLocalStorage(configurationKey);
39671
39715
  window.location.reload();
@@ -39696,7 +39740,8 @@ const applyStyles = (configuration) => __async(void 0, null, function* () {
39696
39740
  }
39697
39741
  document.head.appendChild(styleElement);
39698
39742
  });
39699
- const mountSearchBox = (configuration, options, fetch2 = true, remount = false) => __async(void 0, null, function* () {
39743
+ const mountSearchBox = (configuration, options, optionOverrides, fetch2 = true, remount = false) => __async(void 0, null, function* () {
39744
+ var _a;
39700
39745
  if (!configuration.searchBox) {
39701
39746
  return;
39702
39747
  }
@@ -39713,9 +39758,11 @@ const mountSearchBox = (configuration, options, fetch2 = true, remount = false)
39713
39758
  );
39714
39759
  return;
39715
39760
  }
39716
- searchBox(__spreadProps(__spreadValues({}, resolvedConfiguration), { options }), { fetch: fetch2, allowedMountUrls });
39761
+ const mergedOptions = merge(resolvedConfiguration, (_a = optionOverrides == null ? void 0 : optionOverrides.searchBox) != null ? _a : {});
39762
+ searchBox(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
39717
39763
  });
39718
- const mountSearchResults = (configuration, options, fetch2 = true, remount = false) => __async(void 0, null, function* () {
39764
+ const mountSearchResults = (configuration, options, optionOverrides, fetch2 = true, remount = false) => __async(void 0, null, function* () {
39765
+ var _a;
39719
39766
  if (!configuration.searchResults) {
39720
39767
  return;
39721
39768
  }
@@ -39732,9 +39779,11 @@ const mountSearchResults = (configuration, options, fetch2 = true, remount = fal
39732
39779
  );
39733
39780
  return;
39734
39781
  }
39735
- searchResults(__spreadProps(__spreadValues({}, resolvedConfiguration), { options }), { fetch: fetch2, allowedMountUrls });
39782
+ const mergedOptions = merge(resolvedConfiguration, (_a = optionOverrides == null ? void 0 : optionOverrides.searchResults) != null ? _a : {});
39783
+ searchResults(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
39736
39784
  });
39737
- const mountProductList = (configuration, options, fetch2 = true, remount = false) => __async(void 0, null, function* () {
39785
+ const mountProductList = (configuration, options, optionOverrides, fetch2 = true, remount = false) => __async(void 0, null, function* () {
39786
+ var _a;
39738
39787
  if (!configuration.productList) {
39739
39788
  return;
39740
39789
  }
@@ -39754,12 +39803,14 @@ const mountProductList = (configuration, options, fetch2 = true, remount = false
39754
39803
  );
39755
39804
  return;
39756
39805
  }
39757
- productList(
39758
- __spreadProps(__spreadValues(__spreadValues({}, resolvedSearchResultsConfiguration), resolvedConfiguration), { options }),
39759
- { fetch: fetch2, allowedMountUrls }
39806
+ const mergedOptions = merge(
39807
+ __spreadValues(__spreadValues({}, resolvedSearchResultsConfiguration), resolvedConfiguration),
39808
+ (_a = optionOverrides == null ? void 0 : optionOverrides.productList) != null ? _a : {}
39760
39809
  );
39810
+ productList(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
39761
39811
  });
39762
- const mountRecommendations = (configuration, options, fetch2 = true, remount = false) => __async(void 0, null, function* () {
39812
+ const mountRecommendations = (configuration, options, optionOverrides, fetch2 = true, remount = false) => __async(void 0, null, function* () {
39813
+ var _a;
39763
39814
  if (!configuration.recommendations) {
39764
39815
  return;
39765
39816
  }
@@ -39781,10 +39832,11 @@ const mountRecommendations = (configuration, options, fetch2 = true, remount = f
39781
39832
  );
39782
39833
  return;
39783
39834
  }
39784
- recommendations(
39785
- __spreadProps(__spreadValues(__spreadValues({}, resolvedSearchResultsConfiguration), resolvedConfiguration), { options }),
39786
- { fetch: fetch2, allowedMountUrls }
39835
+ const mergedOptions = merge(
39836
+ __spreadValues(__spreadValues({}, resolvedSearchResultsConfiguration), resolvedConfiguration),
39837
+ (_a = optionOverrides == null ? void 0 : optionOverrides.recommendations) != null ? _a : {}
39787
39838
  );
39839
+ recommendations(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
39788
39840
  });
39789
39841
  const mountChat = (configuration, options, fetch2 = true, remount = false) => __async(void 0, null, function* () {
39790
39842
  if (!configuration.genAiChat) {
@@ -39811,24 +39863,24 @@ const mountChat = (configuration, options, fetch2 = true, remount = false) => __
39811
39863
  { fetch: fetch2, allowedMountUrls }
39812
39864
  );
39813
39865
  });
39814
- const mount = (configuration, options, fetch2 = true, remount = false) => __async(void 0, null, function* () {
39866
+ const mount = (_0, ..._1) => __async(void 0, [_0, ..._1], function* (configuration, options = { environment: "production" }, optionOverrides = {}, fetch2 = true, remount = false) {
39815
39867
  yield applyStyles(configuration);
39816
39868
  const mountPromises = [
39817
- mountSearchBox(configuration, options, fetch2, remount),
39818
- mountSearchResults(configuration, options, fetch2, remount),
39819
- mountProductList(configuration, options, fetch2, remount),
39820
- mountRecommendations(configuration, options, fetch2, remount),
39869
+ mountSearchBox(configuration, options, optionOverrides, fetch2, remount),
39870
+ mountSearchResults(configuration, options, optionOverrides, fetch2, remount),
39871
+ mountProductList(configuration, options, optionOverrides, fetch2, remount),
39872
+ mountRecommendations(configuration, options, optionOverrides, fetch2, remount),
39821
39873
  mountChat(configuration, options, fetch2, remount)
39822
39874
  ];
39823
39875
  yield Promise.all(mountPromises);
39824
39876
  });
39825
- const init$1 = (configurationKey, options) => __async(void 0, null, function* () {
39877
+ const init$1 = (_0, ..._1) => __async(void 0, [_0, ..._1], function* (configurationKey, options = { environment: "production" }, optionOverrides = {}) {
39826
39878
  var _a;
39827
39879
  const isPreviewMode = checkIsPreviewMode();
39828
- const plugin2 = yield loadConfigurations(configurationKey, isPreviewMode, options);
39880
+ const plugin2 = yield loadConfigurations(configurationKey, isPreviewMode, options, optionOverrides);
39829
39881
  const configuration = isPreviewMode ? (_a = plugin2.previewConfiguration) != null ? _a : plugin2.configuration : plugin2.configuration;
39830
39882
  if (configuration) {
39831
- yield mount(configuration, options);
39883
+ yield mount(configuration, options, optionOverrides);
39832
39884
  }
39833
39885
  });
39834
39886
  const PluginConfigurationManager = {
@@ -39837,8 +39889,8 @@ const PluginConfigurationManager = {
39837
39889
  const tracking = (options) => {
39838
39890
  setupTracking(options);
39839
39891
  };
39840
- const init = (configurationKey, options) => {
39841
- return PluginConfigurationManager.init(configurationKey, options);
39892
+ const init = (configurationKey, options, optionOverrides) => {
39893
+ return PluginConfigurationManager.init(configurationKey, options, optionOverrides);
39842
39894
  };
39843
39895
  const lupaSearch = {
39844
39896
  init,