@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.
@@ -71,9 +71,9 @@ var __async = (__this, __arguments, generator) => {
71
71
  const isFunction$1 = (val) => typeof val === "function";
72
72
  const isString = (val) => typeof val === "string";
73
73
  const isSymbol = (val) => typeof val === "symbol";
74
- const isObject$2 = (val) => val !== null && typeof val === "object";
74
+ const isObject$3 = (val) => val !== null && typeof val === "object";
75
75
  const isPromise$1 = (val) => {
76
- return isObject$2(val) && isFunction$1(val.then) && isFunction$1(val.catch);
76
+ return isObject$3(val) && isFunction$1(val.then) && isFunction$1(val.catch);
77
77
  };
78
78
  const objectToString$1 = Object.prototype.toString;
79
79
  const toTypeString = (value) => objectToString$1.call(value);
@@ -147,7 +147,7 @@ var __async = (__this, __arguments, generator) => {
147
147
  return res;
148
148
  } else if (isString(value)) {
149
149
  return value;
150
- } else if (isObject$2(value)) {
150
+ } else if (isObject$3(value)) {
151
151
  return value;
152
152
  }
153
153
  }
@@ -175,7 +175,7 @@ var __async = (__this, __arguments, generator) => {
175
175
  res += normalized + " ";
176
176
  }
177
177
  }
178
- } else if (isObject$2(value)) {
178
+ } else if (isObject$3(value)) {
179
179
  for (const name in value) {
180
180
  if (value[name]) {
181
181
  res += name + " ";
@@ -228,8 +228,8 @@ var __async = (__this, __arguments, generator) => {
228
228
  if (aValidType || bValidType) {
229
229
  return aValidType && bValidType ? looseCompareArrays(a, b) : false;
230
230
  }
231
- aValidType = isObject$2(a);
232
- bValidType = isObject$2(b);
231
+ aValidType = isObject$3(a);
232
+ bValidType = isObject$3(b);
233
233
  if (aValidType || bValidType) {
234
234
  if (!aValidType || !bValidType) {
235
235
  return false;
@@ -253,7 +253,7 @@ var __async = (__this, __arguments, generator) => {
253
253
  return arr.findIndex((item) => looseEqual(item, val));
254
254
  }
255
255
  const toDisplayString = (val) => {
256
- 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);
256
+ 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);
257
257
  };
258
258
  const replacer = (_key, val) => {
259
259
  if (val && val.__v_isRef) {
@@ -269,7 +269,7 @@ var __async = (__this, __arguments, generator) => {
269
269
  return {
270
270
  [`Set(${val.size})`]: [...val.values()]
271
271
  };
272
- } else if (isObject$2(val) && !isArray$1(val) && !isPlainObject$4(val)) {
272
+ } else if (isObject$3(val) && !isArray$1(val) && !isPlainObject$4(val)) {
273
273
  return String(val);
274
274
  }
275
275
  return val;
@@ -662,7 +662,7 @@ var __async = (__this, __arguments, generator) => {
662
662
  if (isRef(res)) {
663
663
  return targetIsArray && isIntegerKey(key) ? res : res.value;
664
664
  }
665
- if (isObject$2(res)) {
665
+ if (isObject$3(res)) {
666
666
  return isReadonly2 ? readonly(res) : reactive(res);
667
667
  }
668
668
  return res;
@@ -1056,7 +1056,7 @@ var __async = (__this, __arguments, generator) => {
1056
1056
  );
1057
1057
  }
1058
1058
  function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
1059
- if (!isObject$2(target)) {
1059
+ if (!isObject$3(target)) {
1060
1060
  return target;
1061
1061
  }
1062
1062
  if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
@@ -1100,8 +1100,8 @@ var __async = (__this, __arguments, generator) => {
1100
1100
  def(value, "__v_skip", true);
1101
1101
  return value;
1102
1102
  }
1103
- const toReactive = (value) => isObject$2(value) ? reactive(value) : value;
1104
- const toReadonly = (value) => isObject$2(value) ? readonly(value) : value;
1103
+ const toReactive = (value) => isObject$3(value) ? reactive(value) : value;
1104
+ const toReadonly = (value) => isObject$3(value) ? readonly(value) : value;
1105
1105
  function trackRefValue(ref2) {
1106
1106
  if (shouldTrack && activeEffect) {
1107
1107
  ref2 = toRaw(ref2);
@@ -1211,7 +1211,7 @@ var __async = (__this, __arguments, generator) => {
1211
1211
  return source;
1212
1212
  } else if (isFunction$1(source)) {
1213
1213
  return new GetterRefImpl(source);
1214
- } else if (isObject$2(source) && arguments.length > 1) {
1214
+ } else if (isObject$3(source) && arguments.length > 1) {
1215
1215
  return propertyToRef(source, key, defaultValue);
1216
1216
  } else {
1217
1217
  return ref(source);
@@ -1531,7 +1531,7 @@ var __async = (__this, __arguments, generator) => {
1531
1531
  }
1532
1532
  }
1533
1533
  if (!raw && !hasExtends) {
1534
- if (isObject$2(comp)) {
1534
+ if (isObject$3(comp)) {
1535
1535
  cache.set(comp, null);
1536
1536
  }
1537
1537
  return null;
@@ -1541,7 +1541,7 @@ var __async = (__this, __arguments, generator) => {
1541
1541
  } else {
1542
1542
  extend(normalized, raw);
1543
1543
  }
1544
- if (isObject$2(comp)) {
1544
+ if (isObject$3(comp)) {
1545
1545
  cache.set(comp, normalized);
1546
1546
  }
1547
1547
  return normalized;
@@ -1949,7 +1949,7 @@ var __async = (__this, __arguments, generator) => {
1949
1949
  };
1950
1950
  }
1951
1951
  function traverse(value, seen) {
1952
- if (!isObject$2(value) || value["__v_skip"]) {
1952
+ if (!isObject$3(value) || value["__v_skip"]) {
1953
1953
  return value;
1954
1954
  }
1955
1955
  seen = seen || /* @__PURE__ */ new Set();
@@ -2484,7 +2484,7 @@ var __async = (__this, __arguments, generator) => {
2484
2484
  for (let i = 0; i < source; i++) {
2485
2485
  ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
2486
2486
  }
2487
- } else if (isObject$2(source)) {
2487
+ } else if (isObject$3(source)) {
2488
2488
  if (source[Symbol.iterator]) {
2489
2489
  ret = Array.from(
2490
2490
  source,
@@ -2761,7 +2761,7 @@ var __async = (__this, __arguments, generator) => {
2761
2761
  }
2762
2762
  if (dataOptions) {
2763
2763
  const data = dataOptions.call(publicThis, publicThis);
2764
- if (!isObject$2(data))
2764
+ if (!isObject$3(data))
2765
2765
  ;
2766
2766
  else {
2767
2767
  instance.data = reactive(data);
@@ -2849,7 +2849,7 @@ var __async = (__this, __arguments, generator) => {
2849
2849
  for (const key in injectOptions) {
2850
2850
  const opt = injectOptions[key];
2851
2851
  let injected;
2852
- if (isObject$2(opt)) {
2852
+ if (isObject$3(opt)) {
2853
2853
  if ("default" in opt) {
2854
2854
  injected = inject(
2855
2855
  opt.from || key,
@@ -2891,7 +2891,7 @@ var __async = (__this, __arguments, generator) => {
2891
2891
  }
2892
2892
  } else if (isFunction$1(raw)) {
2893
2893
  watch(getter, raw.bind(publicThis));
2894
- } else if (isObject$2(raw)) {
2894
+ } else if (isObject$3(raw)) {
2895
2895
  if (isArray$1(raw)) {
2896
2896
  raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
2897
2897
  } else {
@@ -2928,7 +2928,7 @@ var __async = (__this, __arguments, generator) => {
2928
2928
  }
2929
2929
  mergeOptions(resolved, base, optionMergeStrategies);
2930
2930
  }
2931
- if (isObject$2(base)) {
2931
+ if (isObject$3(base)) {
2932
2932
  cache.set(base, resolved);
2933
2933
  }
2934
2934
  return resolved;
@@ -3069,7 +3069,7 @@ var __async = (__this, __arguments, generator) => {
3069
3069
  if (!isFunction$1(rootComponent)) {
3070
3070
  rootComponent = extend({}, rootComponent);
3071
3071
  }
3072
- if (rootProps != null && !isObject$2(rootProps)) {
3072
+ if (rootProps != null && !isObject$3(rootProps)) {
3073
3073
  rootProps = null;
3074
3074
  }
3075
3075
  const context = createAppContext();
@@ -3413,7 +3413,7 @@ var __async = (__this, __arguments, generator) => {
3413
3413
  }
3414
3414
  }
3415
3415
  if (!raw && !hasExtends) {
3416
- if (isObject$2(comp)) {
3416
+ if (isObject$3(comp)) {
3417
3417
  cache.set(comp, EMPTY_ARR);
3418
3418
  }
3419
3419
  return EMPTY_ARR;
@@ -3450,7 +3450,7 @@ var __async = (__this, __arguments, generator) => {
3450
3450
  }
3451
3451
  }
3452
3452
  const res = [normalized, needCastKeys];
3453
- if (isObject$2(comp)) {
3453
+ if (isObject$3(comp)) {
3454
3454
  cache.set(comp, res);
3455
3455
  }
3456
3456
  return res;
@@ -5114,14 +5114,14 @@ var __async = (__this, __arguments, generator) => {
5114
5114
  if (klass && !isString(klass)) {
5115
5115
  props.class = normalizeClass(klass);
5116
5116
  }
5117
- if (isObject$2(style)) {
5117
+ if (isObject$3(style)) {
5118
5118
  if (isProxy(style) && !isArray$1(style)) {
5119
5119
  style = extend({}, style);
5120
5120
  }
5121
5121
  props.style = normalizeStyle(style);
5122
5122
  }
5123
5123
  }
5124
- const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject$2(type) ? 4 : isFunction$1(type) ? 2 : 0;
5124
+ const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject$3(type) ? 4 : isFunction$1(type) ? 2 : 0;
5125
5125
  return createBaseVNode(
5126
5126
  type,
5127
5127
  props,
@@ -5458,7 +5458,7 @@ var __async = (__this, __arguments, generator) => {
5458
5458
  } else {
5459
5459
  instance.render = setupResult;
5460
5460
  }
5461
- } else if (isObject$2(setupResult)) {
5461
+ } else if (isObject$3(setupResult)) {
5462
5462
  instance.setupState = proxyRefs(setupResult);
5463
5463
  } else
5464
5464
  ;
@@ -5550,7 +5550,7 @@ var __async = (__this, __arguments, generator) => {
5550
5550
  function h$1(type, propsOrChildren, children) {
5551
5551
  const l = arguments.length;
5552
5552
  if (l === 2) {
5553
- if (isObject$2(propsOrChildren) && !isArray$1(propsOrChildren)) {
5553
+ if (isObject$3(propsOrChildren) && !isArray$1(propsOrChildren)) {
5554
5554
  if (isVNode(propsOrChildren)) {
5555
5555
  return createVNode(type, null, [propsOrChildren]);
5556
5556
  }
@@ -6056,7 +6056,7 @@ var __async = (__this, __arguments, generator) => {
6056
6056
  function normalizeDuration(duration) {
6057
6057
  if (duration == null) {
6058
6058
  return null;
6059
- } else if (isObject$2(duration)) {
6059
+ } else if (isObject$3(duration)) {
6060
6060
  return [NumberOf(duration.enter), NumberOf(duration.leave)];
6061
6061
  } else {
6062
6062
  const n = NumberOf(duration);
@@ -12902,18 +12902,18 @@ var __async = (__this, __arguments, generator) => {
12902
12902
  * Copyright (c) 2014-2017, Jon Schlinkert.
12903
12903
  * Released under the MIT License.
12904
12904
  */
12905
- function isObject(o) {
12905
+ function isObject$2(o) {
12906
12906
  return Object.prototype.toString.call(o) === "[object Object]";
12907
12907
  }
12908
12908
  function isPlainObject$1(o) {
12909
12909
  var ctor, prot;
12910
- if (isObject(o) === false)
12910
+ if (isObject$2(o) === false)
12911
12911
  return false;
12912
12912
  ctor = o.constructor;
12913
12913
  if (ctor === void 0)
12914
12914
  return true;
12915
12915
  prot = ctor.prototype;
12916
- if (isObject(prot) === false)
12916
+ if (isObject$2(prot) === false)
12917
12917
  return false;
12918
12918
  if (prot.hasOwnProperty("isPrototypeOf") === false) {
12919
12919
  return false;
@@ -17699,12 +17699,12 @@ and ensure you are accounting for this risk.
17699
17699
  enforceHtmlBoundary: false,
17700
17700
  parseStyleAttributes: true
17701
17701
  };
17702
- sanitizeHtml.simpleTransform = function(newTagName, newAttribs, merge) {
17703
- merge = merge === void 0 ? true : merge;
17702
+ sanitizeHtml.simpleTransform = function(newTagName, newAttribs, merge2) {
17703
+ merge2 = merge2 === void 0 ? true : merge2;
17704
17704
  newAttribs = newAttribs || {};
17705
17705
  return function(tagName, attribs) {
17706
17706
  let attrib;
17707
- if (merge) {
17707
+ if (merge2) {
17708
17708
  for (attrib in newAttribs) {
17709
17709
  attribs[attrib] = newAttribs[attrib];
17710
17710
  }
@@ -19702,6 +19702,74 @@ and ensure you are accounting for this risk.
19702
19702
  };
19703
19703
  }
19704
19704
  });
19705
+ const extractValue = (options) => {
19706
+ switch (options.extractFrom) {
19707
+ case "url":
19708
+ return extractFromUrl(options);
19709
+ case "localStorage":
19710
+ case "sessionStorage":
19711
+ return extractFromStorage(options);
19712
+ case "htmlElementText":
19713
+ return extractFromHtmlElementText(options);
19714
+ case "cookie":
19715
+ return extractFromCookie(options);
19716
+ default:
19717
+ return options.default;
19718
+ }
19719
+ };
19720
+ const extractFromCookie = (options) => {
19721
+ var _a, _b;
19722
+ try {
19723
+ 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}=`));
19724
+ return cookieValue ? cookieValue.split("=")[1] : options.default;
19725
+ } catch (e2) {
19726
+ return options.default;
19727
+ }
19728
+ };
19729
+ const extractFromUrl = (options) => {
19730
+ const regex = new RegExp(options.regex);
19731
+ const match = window.location.href.match(regex);
19732
+ return match ? match[1] : options.default;
19733
+ };
19734
+ const extractFromStorage = (options) => {
19735
+ const storage = options.extractFrom === "localStorage" ? localStorage : sessionStorage;
19736
+ let rawValue2 = "";
19737
+ try {
19738
+ rawValue2 = storage.getItem(options.key);
19739
+ } catch (e2) {
19740
+ return options.default;
19741
+ }
19742
+ if (rawValue2) {
19743
+ try {
19744
+ const parsedValue = JSON.parse(rawValue2);
19745
+ return options.path ? getValueFromPath(parsedValue, options.path) : parsedValue;
19746
+ } catch (e2) {
19747
+ return rawValue2;
19748
+ }
19749
+ }
19750
+ return options.default;
19751
+ };
19752
+ const extractFromHtmlElementText = (options) => {
19753
+ var _a;
19754
+ const element = document.querySelector(options.querySelector);
19755
+ return element ? ((_a = element.textContent) == null ? void 0 : _a.trim()) || options.default : options.default;
19756
+ };
19757
+ const getValueFromPath = (obj, path) => {
19758
+ return path.split(".").reduce((value, key) => value && value[key] || null, obj);
19759
+ };
19760
+ const processExtractionObject = (value = {}) => {
19761
+ var _a;
19762
+ const parsedObject = {};
19763
+ for (const key in value) {
19764
+ if (isObject$1(value[key]) && ((_a = value[key]) == null ? void 0 : _a.extractFrom)) {
19765
+ const extractedValue = extractValue(value[key]);
19766
+ parsedObject[key] = Array.isArray(extractedValue) ? extractedValue : [extractedValue];
19767
+ } else {
19768
+ parsedObject[key] = value[key];
19769
+ }
19770
+ }
19771
+ return parsedObject;
19772
+ };
19705
19773
  const _sfc_main$11 = /* @__PURE__ */ defineComponent({
19706
19774
  __name: "SearchBoxProductsWrapper",
19707
19775
  props: {
@@ -19725,6 +19793,9 @@ and ensure you are accounting for this risk.
19725
19793
  const showGoToResultsButton = computed(() => {
19726
19794
  return props.panel.showGoToResults;
19727
19795
  });
19796
+ const extractedInitialFilters = computed(() => {
19797
+ return __spreadValues2({}, processExtractionObject(props.searchBoxOptions.initialFilters));
19798
+ });
19728
19799
  const inputValueProp = computed(() => props.inputValue);
19729
19800
  onMounted(() => {
19730
19801
  getItemsDebounced();
@@ -19742,7 +19813,11 @@ and ensure you are accounting for this risk.
19742
19813
  const getItems = () => {
19743
19814
  searchBoxStore.queryDocuments({
19744
19815
  queryKey: props.panel.queryKey,
19745
- publicQuery: { searchText: props.inputValue, limit: props.panel.limit },
19816
+ publicQuery: {
19817
+ searchText: props.inputValue,
19818
+ limit: props.panel.limit,
19819
+ filters: extractedInitialFilters.value
19820
+ },
19746
19821
  options: props.options
19747
19822
  }).then(({ result: result2 }) => {
19748
19823
  if (!(result2 == null ? void 0 : result2.items.length)) {
@@ -20171,6 +20246,9 @@ and ensure you are accounting for this risk.
20171
20246
  const focused = ref(false);
20172
20247
  const searchBoxInput = ref(null);
20173
20248
  const { highlightedDocument } = storeToRefs(searchBoxStore);
20249
+ computed(() => {
20250
+ return __spreadValues2({}, processExtractionObject(props.options.initialFilters));
20251
+ });
20174
20252
  const searchValue = computed(() => {
20175
20253
  return suggestedValue.value.override ? suggestedValue.value.item.suggestion : inputValue.value;
20176
20254
  });
@@ -20196,7 +20274,8 @@ and ensure you are accounting for this risk.
20196
20274
  "hideMoreResultsButtonOnNoResults",
20197
20275
  "showNoResultsPanel",
20198
20276
  "expandOnSinglePanel",
20199
- "showMoreResultsButton"
20277
+ "showMoreResultsButton",
20278
+ "initialFilters"
20200
20279
  ])
20201
20280
  );
20202
20281
  const searchTriggers = computed(() => {
@@ -25323,7 +25402,10 @@ and ensure you are accounting for this risk.
25323
25402
  class: "lupa-category-back"
25324
25403
  };
25325
25404
  const _hoisted_3$6 = ["href"];
25326
- const _hoisted_4$3 = { class: "lupa-child-category-list" };
25405
+ const _hoisted_4$3 = {
25406
+ key: 1,
25407
+ class: "lupa-child-category-list"
25408
+ };
25327
25409
  const _sfc_main$f = /* @__PURE__ */ defineComponent({
25328
25410
  __name: "CategoryTopFilters",
25329
25411
  props: {
@@ -25337,6 +25419,10 @@ and ensure you are accounting for this risk.
25337
25419
  var _a, _b;
25338
25420
  return Boolean((_b = (_a = props.options.categories) == null ? void 0 : _a.back) == null ? void 0 : _b.title);
25339
25421
  });
25422
+ const hasRelatedCategoryChildren = computed(() => {
25423
+ var _a;
25424
+ return ((_a = relatedCategoryChildren.value) == null ? void 0 : _a.length) > 0;
25425
+ });
25340
25426
  const backTitle = computed(() => {
25341
25427
  var _a, _b;
25342
25428
  return (_b = (_a = props.options.categories) == null ? void 0 : _a.back) == null ? void 0 : _b.title;
@@ -25363,7 +25449,10 @@ and ensure you are accounting for this risk.
25363
25449
  };
25364
25450
  return (_ctx, _cache) => {
25365
25451
  return openBlock(), createElementBlock("div", {
25366
- class: normalizeClass(["lupa-category-top-mobile-filters", { "lupa-has-back-button": hasBackButton.value }])
25452
+ class: normalizeClass(["lupa-category-top-mobile-filters", {
25453
+ "lupa-has-back-button": hasBackButton.value,
25454
+ "has-related-category-children": hasRelatedCategoryChildren.value
25455
+ }])
25367
25456
  }, [
25368
25457
  createBaseVNode("div", _hoisted_1$d, [
25369
25458
  hasBackButton.value ? (openBlock(), createElementBlock("div", _hoisted_2$a, [
@@ -25373,7 +25462,7 @@ and ensure you are accounting for this risk.
25373
25462
  onClick: handleNavigationBack
25374
25463
  }, toDisplayString(backTitle.value), 9, _hoisted_3$6)
25375
25464
  ])) : createCommentVNode("", true),
25376
- createBaseVNode("div", _hoisted_4$3, [
25465
+ hasRelatedCategoryChildren.value ? (openBlock(), createElementBlock("div", _hoisted_4$3, [
25377
25466
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(relatedCategoryChildren), (child) => {
25378
25467
  return openBlock(), createBlock(_sfc_main$U, {
25379
25468
  key: getCategoryKey(child),
@@ -25381,7 +25470,7 @@ and ensure you are accounting for this risk.
25381
25470
  options: categoryOptions.value
25382
25471
  }, null, 8, ["item", "options"]);
25383
25472
  }), 128))
25384
- ]),
25473
+ ])) : createCommentVNode("", true),
25385
25474
  createVNode(_sfc_main$B, {
25386
25475
  class: "lupa-toolbar-mobile",
25387
25476
  "pagination-location": "top",
@@ -25421,9 +25510,12 @@ and ensure you are accounting for this risk.
25421
25510
  const dynamicDataStore = useDynamicDataStore();
25422
25511
  const screenStore = useScreenStore();
25423
25512
  const redirectionStore = useRedirectionStore();
25513
+ const extractedInitialFilters = computed(() => {
25514
+ return __spreadValues2({}, processExtractionObject(props.options.initialFilters));
25515
+ });
25424
25516
  const initialFilters = computed(() => {
25425
- var _a;
25426
- return (_a = props.initialFilters) != null ? _a : {};
25517
+ var _a, _b;
25518
+ return (_b = (_a = props.initialFilters) != null ? _a : extractedInitialFilters.value) != null ? _b : {};
25427
25519
  });
25428
25520
  const { currentQueryText, hasResults, currentFilterCount } = storeToRefs(searchResultStore);
25429
25521
  const { searchString, sortParams } = storeToRefs(paramStore);
@@ -25729,62 +25821,6 @@ and ensure you are accounting for this risk.
25729
25821
  };
25730
25822
  }
25731
25823
  });
25732
- const extractValue = (options) => {
25733
- switch (options.extractFrom) {
25734
- case "url":
25735
- return extractFromUrl(options);
25736
- case "localStorage":
25737
- case "sessionStorage":
25738
- return extractFromStorage(options);
25739
- case "htmlElementText":
25740
- return extractFromHtmlElementText(options);
25741
- default:
25742
- return options.default;
25743
- }
25744
- };
25745
- const extractFromUrl = (options) => {
25746
- const regex = new RegExp(options.regex);
25747
- const match = window.location.href.match(regex);
25748
- return match ? match[1] : options.default;
25749
- };
25750
- const extractFromStorage = (options) => {
25751
- const storage = options.extractFrom === "localStorage" ? localStorage : sessionStorage;
25752
- let rawValue2 = "";
25753
- try {
25754
- rawValue2 = storage.getItem(options.key);
25755
- } catch (e2) {
25756
- return options.default;
25757
- }
25758
- if (rawValue2) {
25759
- try {
25760
- const parsedValue = JSON.parse(rawValue2);
25761
- return options.path ? getValueFromPath(parsedValue, options.path) : parsedValue;
25762
- } catch (e2) {
25763
- return rawValue2;
25764
- }
25765
- }
25766
- return options.default;
25767
- };
25768
- const extractFromHtmlElementText = (options) => {
25769
- var _a;
25770
- const element = document.querySelector(options.querySelector);
25771
- return element ? ((_a = element.textContent) == null ? void 0 : _a.trim()) || options.default : options.default;
25772
- };
25773
- const getValueFromPath = (obj, path) => {
25774
- return path.split(".").reduce((value, key) => value && value[key] || null, obj);
25775
- };
25776
- const processExtractionObject = (value = {}) => {
25777
- var _a;
25778
- const parsedObject = {};
25779
- for (const key in value) {
25780
- if (isObject$1(value[key]) && ((_a = value[key]) == null ? void 0 : _a.extractFrom)) {
25781
- parsedObject[key] = extractValue(value[key]);
25782
- } else {
25783
- parsedObject[key] = value[key];
25784
- }
25785
- }
25786
- return parsedObject;
25787
- };
25788
25824
  const _sfc_main$c = /* @__PURE__ */ defineComponent({
25789
25825
  __name: "ProductList",
25790
25826
  props: {
@@ -25804,7 +25840,7 @@ and ensure you are accounting for this risk.
25804
25840
  var _a;
25805
25841
  (_a = searchResults2.value) == null ? void 0 : _a.handleMounted();
25806
25842
  };
25807
- computed(() => {
25843
+ const initialFilters = computed(() => {
25808
25844
  return __spreadValues2({}, processExtractionObject(props.options.initialFilters));
25809
25845
  });
25810
25846
  __expose({ fetch: fetch2 });
@@ -25812,7 +25848,7 @@ and ensure you are accounting for this risk.
25812
25848
  return openBlock(), createElementBlock("div", null, [
25813
25849
  createVNode(_sfc_main$e, {
25814
25850
  options: componentOptions.value,
25815
- "initial-filters": _ctx.options.initialFilters,
25851
+ "initial-filters": initialFilters.value,
25816
25852
  "is-product-list": true,
25817
25853
  ref_key: "searchResults",
25818
25854
  ref: searchResults2
@@ -30200,7 +30236,7 @@ and ensure you are accounting for this risk.
30200
30236
  });
30201
30237
  return result3;
30202
30238
  }
30203
- var merge = createAssigner(function(object, source, srcIndex) {
30239
+ var merge2 = createAssigner(function(object, source, srcIndex) {
30204
30240
  baseMerge(object, source, srcIndex);
30205
30241
  });
30206
30242
  var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
@@ -30890,7 +30926,7 @@ and ensure you are accounting for this risk.
30890
30926
  lodash2.matches = matches;
30891
30927
  lodash2.matchesProperty = matchesProperty;
30892
30928
  lodash2.memoize = memoize;
30893
- lodash2.merge = merge;
30929
+ lodash2.merge = merge2;
30894
30930
  lodash2.mergeWith = mergeWith;
30895
30931
  lodash2.method = method;
30896
30932
  lodash2.methodOf = methodOf;
@@ -37726,7 +37762,7 @@ and ensure you are accounting for this risk.
37726
37762
  });
37727
37763
  return result3;
37728
37764
  }
37729
- var merge = createAssigner(function(object, source, srcIndex) {
37765
+ var merge2 = createAssigner(function(object, source, srcIndex) {
37730
37766
  baseMerge(object, source, srcIndex);
37731
37767
  });
37732
37768
  var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
@@ -38416,7 +38452,7 @@ and ensure you are accounting for this risk.
38416
38452
  lodash2.matches = matches;
38417
38453
  lodash2.matchesProperty = matchesProperty;
38418
38454
  lodash2.memoize = memoize;
38419
- lodash2.merge = merge;
38455
+ lodash2.merge = merge2;
38420
38456
  lodash2.mergeWith = mergeWith;
38421
38457
  lodash2.method = method;
38422
38458
  lodash2.methodOf = methodOf;
@@ -39573,6 +39609,14 @@ and ensure you are accounting for this risk.
39573
39609
  }, interval);
39574
39610
  });
39575
39611
  });
39612
+ const isObject = (item) => typeof item === "object" && !Array.isArray(item);
39613
+ const merge = (target, source) => {
39614
+ const isDeep = (prop) => isObject(source[prop]) && Object.prototype.hasOwnProperty.call(target, prop) && isObject(target[prop]);
39615
+ const replaced = Object.getOwnPropertyNames(source).map((prop) => ({
39616
+ [prop]: isDeep(prop) ? merge(target[prop], source[prop]) : source[prop]
39617
+ })).reduce((a, b) => __spreadValues(__spreadValues({}, a), b), {});
39618
+ return __spreadValues(__spreadValues({}, target), replaced);
39619
+ };
39576
39620
  const saveToLocalStorage = (key, value) => {
39577
39621
  try {
39578
39622
  localStorage.setItem(key, JSON.stringify(value));
@@ -39624,7 +39668,7 @@ and ensure you are accounting for this risk.
39624
39668
  const PREVIEW_PARAMETER = "lupaSearchPreview";
39625
39669
  const MAX_ELEMENT_MOUNT_RETRIES = 25;
39626
39670
  let styleElement = null;
39627
- const loadAndSaveConfigurationFromServer = (configurationKey, options) => __async(this, null, function* () {
39671
+ const loadAndSaveConfigurationFromServer = (_0, ..._1) => __async(this, [_0, ..._1], function* (configurationKey, options = { environment: "production" }) {
39628
39672
  const configuration = yield fetchPluginConfiguration(
39629
39673
  options,
39630
39674
  configurationKey
@@ -39649,7 +39693,7 @@ and ensure you are accounting for this risk.
39649
39693
  }
39650
39694
  return isPreviewMode;
39651
39695
  };
39652
- const loadConfigurations = (configurationKey, isPreviewMode, options) => __async(this, null, function* () {
39696
+ const loadConfigurations = (configurationKey, isPreviewMode, options, optionOverrides) => __async(this, null, function* () {
39653
39697
  if (isPreviewMode) {
39654
39698
  return loadAndSaveConfigurationFromServer(configurationKey, options);
39655
39699
  }
@@ -39667,7 +39711,7 @@ and ensure you are accounting for this risk.
39667
39711
  const isPreviewMode2 = checkIsPreviewMode();
39668
39712
  const configuration = isPreviewMode2 ? (_a = newestConfiguration.previewConfiguration) != null ? _a : newestConfiguration.configuration : newestConfiguration.configuration;
39669
39713
  if (configuration) {
39670
- yield mount(configuration, options, false, true);
39714
+ yield mount(configuration, options, optionOverrides, false, true);
39671
39715
  } else {
39672
39716
  removeFromLocalStorage(configurationKey);
39673
39717
  window.location.reload();
@@ -39698,7 +39742,8 @@ and ensure you are accounting for this risk.
39698
39742
  }
39699
39743
  document.head.appendChild(styleElement);
39700
39744
  });
39701
- const mountSearchBox = (configuration, options, fetch2 = true, remount = false) => __async(this, null, function* () {
39745
+ const mountSearchBox = (configuration, options, optionOverrides, fetch2 = true, remount = false) => __async(this, null, function* () {
39746
+ var _a;
39702
39747
  if (!configuration.searchBox) {
39703
39748
  return;
39704
39749
  }
@@ -39715,9 +39760,11 @@ and ensure you are accounting for this risk.
39715
39760
  );
39716
39761
  return;
39717
39762
  }
39718
- searchBox(__spreadProps(__spreadValues({}, resolvedConfiguration), { options }), { fetch: fetch2, allowedMountUrls });
39763
+ const mergedOptions = merge(resolvedConfiguration, (_a = optionOverrides == null ? void 0 : optionOverrides.searchBox) != null ? _a : {});
39764
+ searchBox(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
39719
39765
  });
39720
- const mountSearchResults = (configuration, options, fetch2 = true, remount = false) => __async(this, null, function* () {
39766
+ const mountSearchResults = (configuration, options, optionOverrides, fetch2 = true, remount = false) => __async(this, null, function* () {
39767
+ var _a;
39721
39768
  if (!configuration.searchResults) {
39722
39769
  return;
39723
39770
  }
@@ -39734,9 +39781,11 @@ and ensure you are accounting for this risk.
39734
39781
  );
39735
39782
  return;
39736
39783
  }
39737
- searchResults(__spreadProps(__spreadValues({}, resolvedConfiguration), { options }), { fetch: fetch2, allowedMountUrls });
39784
+ const mergedOptions = merge(resolvedConfiguration, (_a = optionOverrides == null ? void 0 : optionOverrides.searchResults) != null ? _a : {});
39785
+ searchResults(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
39738
39786
  });
39739
- const mountProductList = (configuration, options, fetch2 = true, remount = false) => __async(this, null, function* () {
39787
+ const mountProductList = (configuration, options, optionOverrides, fetch2 = true, remount = false) => __async(this, null, function* () {
39788
+ var _a;
39740
39789
  if (!configuration.productList) {
39741
39790
  return;
39742
39791
  }
@@ -39756,12 +39805,14 @@ and ensure you are accounting for this risk.
39756
39805
  );
39757
39806
  return;
39758
39807
  }
39759
- productList(
39760
- __spreadProps(__spreadValues(__spreadValues({}, resolvedSearchResultsConfiguration), resolvedConfiguration), { options }),
39761
- { fetch: fetch2, allowedMountUrls }
39808
+ const mergedOptions = merge(
39809
+ __spreadValues(__spreadValues({}, resolvedSearchResultsConfiguration), resolvedConfiguration),
39810
+ (_a = optionOverrides == null ? void 0 : optionOverrides.productList) != null ? _a : {}
39762
39811
  );
39812
+ productList(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
39763
39813
  });
39764
- const mountRecommendations = (configuration, options, fetch2 = true, remount = false) => __async(this, null, function* () {
39814
+ const mountRecommendations = (configuration, options, optionOverrides, fetch2 = true, remount = false) => __async(this, null, function* () {
39815
+ var _a;
39765
39816
  if (!configuration.recommendations) {
39766
39817
  return;
39767
39818
  }
@@ -39783,10 +39834,11 @@ and ensure you are accounting for this risk.
39783
39834
  );
39784
39835
  return;
39785
39836
  }
39786
- recommendations(
39787
- __spreadProps(__spreadValues(__spreadValues({}, resolvedSearchResultsConfiguration), resolvedConfiguration), { options }),
39788
- { fetch: fetch2, allowedMountUrls }
39837
+ const mergedOptions = merge(
39838
+ __spreadValues(__spreadValues({}, resolvedSearchResultsConfiguration), resolvedConfiguration),
39839
+ (_a = optionOverrides == null ? void 0 : optionOverrides.recommendations) != null ? _a : {}
39789
39840
  );
39841
+ recommendations(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
39790
39842
  });
39791
39843
  const mountChat = (configuration, options, fetch2 = true, remount = false) => __async(this, null, function* () {
39792
39844
  if (!configuration.genAiChat) {
@@ -39813,24 +39865,24 @@ and ensure you are accounting for this risk.
39813
39865
  { fetch: fetch2, allowedMountUrls }
39814
39866
  );
39815
39867
  });
39816
- const mount = (configuration, options, fetch2 = true, remount = false) => __async(this, null, function* () {
39868
+ const mount = (_0, ..._1) => __async(this, [_0, ..._1], function* (configuration, options = { environment: "production" }, optionOverrides = {}, fetch2 = true, remount = false) {
39817
39869
  yield applyStyles(configuration);
39818
39870
  const mountPromises = [
39819
- mountSearchBox(configuration, options, fetch2, remount),
39820
- mountSearchResults(configuration, options, fetch2, remount),
39821
- mountProductList(configuration, options, fetch2, remount),
39822
- mountRecommendations(configuration, options, fetch2, remount),
39871
+ mountSearchBox(configuration, options, optionOverrides, fetch2, remount),
39872
+ mountSearchResults(configuration, options, optionOverrides, fetch2, remount),
39873
+ mountProductList(configuration, options, optionOverrides, fetch2, remount),
39874
+ mountRecommendations(configuration, options, optionOverrides, fetch2, remount),
39823
39875
  mountChat(configuration, options, fetch2, remount)
39824
39876
  ];
39825
39877
  yield Promise.all(mountPromises);
39826
39878
  });
39827
- const init$1 = (configurationKey, options) => __async(this, null, function* () {
39879
+ const init$1 = (_0, ..._1) => __async(this, [_0, ..._1], function* (configurationKey, options = { environment: "production" }, optionOverrides = {}) {
39828
39880
  var _a;
39829
39881
  const isPreviewMode = checkIsPreviewMode();
39830
- const plugin = yield loadConfigurations(configurationKey, isPreviewMode, options);
39882
+ const plugin = yield loadConfigurations(configurationKey, isPreviewMode, options, optionOverrides);
39831
39883
  const configuration = isPreviewMode ? (_a = plugin.previewConfiguration) != null ? _a : plugin.configuration : plugin.configuration;
39832
39884
  if (configuration) {
39833
- yield mount(configuration, options);
39885
+ yield mount(configuration, options, optionOverrides);
39834
39886
  }
39835
39887
  });
39836
39888
  const PluginConfigurationManager = {
@@ -39839,8 +39891,8 @@ and ensure you are accounting for this risk.
39839
39891
  const tracking = (options) => {
39840
39892
  setupTracking(options);
39841
39893
  };
39842
- const init = (configurationKey, options) => {
39843
- return PluginConfigurationManager.init(configurationKey, options);
39894
+ const init = (configurationKey, options, optionOverrides) => {
39895
+ return PluginConfigurationManager.init(configurationKey, options, optionOverrides);
39844
39896
  };
39845
39897
  const lupaSearch = {
39846
39898
  init,