@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.
@@ -73,9 +73,9 @@ var __async = (__this, __arguments, generator) => {
73
73
  const isFunction$1 = (val) => typeof val === "function";
74
74
  const isString = (val) => typeof val === "string";
75
75
  const isSymbol = (val) => typeof val === "symbol";
76
- const isObject$2 = (val) => val !== null && typeof val === "object";
76
+ const isObject$3 = (val) => val !== null && typeof val === "object";
77
77
  const isPromise$1 = (val) => {
78
- return isObject$2(val) && isFunction$1(val.then) && isFunction$1(val.catch);
78
+ return isObject$3(val) && isFunction$1(val.then) && isFunction$1(val.catch);
79
79
  };
80
80
  const objectToString$1 = Object.prototype.toString;
81
81
  const toTypeString = (value) => objectToString$1.call(value);
@@ -149,7 +149,7 @@ var __async = (__this, __arguments, generator) => {
149
149
  return res;
150
150
  } else if (isString(value)) {
151
151
  return value;
152
- } else if (isObject$2(value)) {
152
+ } else if (isObject$3(value)) {
153
153
  return value;
154
154
  }
155
155
  }
@@ -177,7 +177,7 @@ var __async = (__this, __arguments, generator) => {
177
177
  res += normalized + " ";
178
178
  }
179
179
  }
180
- } else if (isObject$2(value)) {
180
+ } else if (isObject$3(value)) {
181
181
  for (const name in value) {
182
182
  if (value[name]) {
183
183
  res += name + " ";
@@ -230,8 +230,8 @@ var __async = (__this, __arguments, generator) => {
230
230
  if (aValidType || bValidType) {
231
231
  return aValidType && bValidType ? looseCompareArrays(a, b) : false;
232
232
  }
233
- aValidType = isObject$2(a);
234
- bValidType = isObject$2(b);
233
+ aValidType = isObject$3(a);
234
+ bValidType = isObject$3(b);
235
235
  if (aValidType || bValidType) {
236
236
  if (!aValidType || !bValidType) {
237
237
  return false;
@@ -255,7 +255,7 @@ var __async = (__this, __arguments, generator) => {
255
255
  return arr.findIndex((item) => looseEqual(item, val));
256
256
  }
257
257
  const toDisplayString = (val) => {
258
- 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);
258
+ 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);
259
259
  };
260
260
  const replacer = (_key, val) => {
261
261
  if (val && val.__v_isRef) {
@@ -271,7 +271,7 @@ var __async = (__this, __arguments, generator) => {
271
271
  return {
272
272
  [`Set(${val.size})`]: [...val.values()]
273
273
  };
274
- } else if (isObject$2(val) && !isArray$1(val) && !isPlainObject$4(val)) {
274
+ } else if (isObject$3(val) && !isArray$1(val) && !isPlainObject$4(val)) {
275
275
  return String(val);
276
276
  }
277
277
  return val;
@@ -664,7 +664,7 @@ var __async = (__this, __arguments, generator) => {
664
664
  if (isRef(res)) {
665
665
  return targetIsArray && isIntegerKey(key) ? res : res.value;
666
666
  }
667
- if (isObject$2(res)) {
667
+ if (isObject$3(res)) {
668
668
  return isReadonly2 ? readonly(res) : reactive(res);
669
669
  }
670
670
  return res;
@@ -1058,7 +1058,7 @@ var __async = (__this, __arguments, generator) => {
1058
1058
  );
1059
1059
  }
1060
1060
  function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
1061
- if (!isObject$2(target)) {
1061
+ if (!isObject$3(target)) {
1062
1062
  return target;
1063
1063
  }
1064
1064
  if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
@@ -1102,8 +1102,8 @@ var __async = (__this, __arguments, generator) => {
1102
1102
  def(value, "__v_skip", true);
1103
1103
  return value;
1104
1104
  }
1105
- const toReactive = (value) => isObject$2(value) ? reactive(value) : value;
1106
- const toReadonly = (value) => isObject$2(value) ? readonly(value) : value;
1105
+ const toReactive = (value) => isObject$3(value) ? reactive(value) : value;
1106
+ const toReadonly = (value) => isObject$3(value) ? readonly(value) : value;
1107
1107
  function trackRefValue(ref2) {
1108
1108
  if (shouldTrack && activeEffect) {
1109
1109
  ref2 = toRaw(ref2);
@@ -1213,7 +1213,7 @@ var __async = (__this, __arguments, generator) => {
1213
1213
  return source;
1214
1214
  } else if (isFunction$1(source)) {
1215
1215
  return new GetterRefImpl(source);
1216
- } else if (isObject$2(source) && arguments.length > 1) {
1216
+ } else if (isObject$3(source) && arguments.length > 1) {
1217
1217
  return propertyToRef(source, key, defaultValue);
1218
1218
  } else {
1219
1219
  return ref(source);
@@ -1533,7 +1533,7 @@ var __async = (__this, __arguments, generator) => {
1533
1533
  }
1534
1534
  }
1535
1535
  if (!raw && !hasExtends) {
1536
- if (isObject$2(comp)) {
1536
+ if (isObject$3(comp)) {
1537
1537
  cache.set(comp, null);
1538
1538
  }
1539
1539
  return null;
@@ -1543,7 +1543,7 @@ var __async = (__this, __arguments, generator) => {
1543
1543
  } else {
1544
1544
  extend(normalized, raw);
1545
1545
  }
1546
- if (isObject$2(comp)) {
1546
+ if (isObject$3(comp)) {
1547
1547
  cache.set(comp, normalized);
1548
1548
  }
1549
1549
  return normalized;
@@ -1951,7 +1951,7 @@ var __async = (__this, __arguments, generator) => {
1951
1951
  };
1952
1952
  }
1953
1953
  function traverse(value, seen) {
1954
- if (!isObject$2(value) || value["__v_skip"]) {
1954
+ if (!isObject$3(value) || value["__v_skip"]) {
1955
1955
  return value;
1956
1956
  }
1957
1957
  seen = seen || /* @__PURE__ */ new Set();
@@ -2486,7 +2486,7 @@ var __async = (__this, __arguments, generator) => {
2486
2486
  for (let i = 0; i < source; i++) {
2487
2487
  ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
2488
2488
  }
2489
- } else if (isObject$2(source)) {
2489
+ } else if (isObject$3(source)) {
2490
2490
  if (source[Symbol.iterator]) {
2491
2491
  ret = Array.from(
2492
2492
  source,
@@ -2763,7 +2763,7 @@ var __async = (__this, __arguments, generator) => {
2763
2763
  }
2764
2764
  if (dataOptions) {
2765
2765
  const data = dataOptions.call(publicThis, publicThis);
2766
- if (!isObject$2(data))
2766
+ if (!isObject$3(data))
2767
2767
  ;
2768
2768
  else {
2769
2769
  instance.data = reactive(data);
@@ -2851,7 +2851,7 @@ var __async = (__this, __arguments, generator) => {
2851
2851
  for (const key in injectOptions) {
2852
2852
  const opt = injectOptions[key];
2853
2853
  let injected;
2854
- if (isObject$2(opt)) {
2854
+ if (isObject$3(opt)) {
2855
2855
  if ("default" in opt) {
2856
2856
  injected = inject(
2857
2857
  opt.from || key,
@@ -2893,7 +2893,7 @@ var __async = (__this, __arguments, generator) => {
2893
2893
  }
2894
2894
  } else if (isFunction$1(raw)) {
2895
2895
  watch(getter, raw.bind(publicThis));
2896
- } else if (isObject$2(raw)) {
2896
+ } else if (isObject$3(raw)) {
2897
2897
  if (isArray$1(raw)) {
2898
2898
  raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
2899
2899
  } else {
@@ -2930,7 +2930,7 @@ var __async = (__this, __arguments, generator) => {
2930
2930
  }
2931
2931
  mergeOptions(resolved, base, optionMergeStrategies);
2932
2932
  }
2933
- if (isObject$2(base)) {
2933
+ if (isObject$3(base)) {
2934
2934
  cache.set(base, resolved);
2935
2935
  }
2936
2936
  return resolved;
@@ -3071,7 +3071,7 @@ var __async = (__this, __arguments, generator) => {
3071
3071
  if (!isFunction$1(rootComponent)) {
3072
3072
  rootComponent = extend({}, rootComponent);
3073
3073
  }
3074
- if (rootProps != null && !isObject$2(rootProps)) {
3074
+ if (rootProps != null && !isObject$3(rootProps)) {
3075
3075
  rootProps = null;
3076
3076
  }
3077
3077
  const context = createAppContext();
@@ -3415,7 +3415,7 @@ var __async = (__this, __arguments, generator) => {
3415
3415
  }
3416
3416
  }
3417
3417
  if (!raw && !hasExtends) {
3418
- if (isObject$2(comp)) {
3418
+ if (isObject$3(comp)) {
3419
3419
  cache.set(comp, EMPTY_ARR);
3420
3420
  }
3421
3421
  return EMPTY_ARR;
@@ -3452,7 +3452,7 @@ var __async = (__this, __arguments, generator) => {
3452
3452
  }
3453
3453
  }
3454
3454
  const res = [normalized, needCastKeys];
3455
- if (isObject$2(comp)) {
3455
+ if (isObject$3(comp)) {
3456
3456
  cache.set(comp, res);
3457
3457
  }
3458
3458
  return res;
@@ -5116,14 +5116,14 @@ var __async = (__this, __arguments, generator) => {
5116
5116
  if (klass && !isString(klass)) {
5117
5117
  props.class = normalizeClass(klass);
5118
5118
  }
5119
- if (isObject$2(style)) {
5119
+ if (isObject$3(style)) {
5120
5120
  if (isProxy(style) && !isArray$1(style)) {
5121
5121
  style = extend({}, style);
5122
5122
  }
5123
5123
  props.style = normalizeStyle(style);
5124
5124
  }
5125
5125
  }
5126
- const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject$2(type) ? 4 : isFunction$1(type) ? 2 : 0;
5126
+ const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject$3(type) ? 4 : isFunction$1(type) ? 2 : 0;
5127
5127
  return createBaseVNode(
5128
5128
  type,
5129
5129
  props,
@@ -5460,7 +5460,7 @@ var __async = (__this, __arguments, generator) => {
5460
5460
  } else {
5461
5461
  instance.render = setupResult;
5462
5462
  }
5463
- } else if (isObject$2(setupResult)) {
5463
+ } else if (isObject$3(setupResult)) {
5464
5464
  instance.setupState = proxyRefs(setupResult);
5465
5465
  } else
5466
5466
  ;
@@ -5552,7 +5552,7 @@ var __async = (__this, __arguments, generator) => {
5552
5552
  function h$1(type, propsOrChildren, children) {
5553
5553
  const l = arguments.length;
5554
5554
  if (l === 2) {
5555
- if (isObject$2(propsOrChildren) && !isArray$1(propsOrChildren)) {
5555
+ if (isObject$3(propsOrChildren) && !isArray$1(propsOrChildren)) {
5556
5556
  if (isVNode(propsOrChildren)) {
5557
5557
  return createVNode(type, null, [propsOrChildren]);
5558
5558
  }
@@ -6058,7 +6058,7 @@ var __async = (__this, __arguments, generator) => {
6058
6058
  function normalizeDuration(duration) {
6059
6059
  if (duration == null) {
6060
6060
  return null;
6061
- } else if (isObject$2(duration)) {
6061
+ } else if (isObject$3(duration)) {
6062
6062
  return [NumberOf(duration.enter), NumberOf(duration.leave)];
6063
6063
  } else {
6064
6064
  const n = NumberOf(duration);
@@ -12904,18 +12904,18 @@ var __async = (__this, __arguments, generator) => {
12904
12904
  * Copyright (c) 2014-2017, Jon Schlinkert.
12905
12905
  * Released under the MIT License.
12906
12906
  */
12907
- function isObject(o) {
12907
+ function isObject$2(o) {
12908
12908
  return Object.prototype.toString.call(o) === "[object Object]";
12909
12909
  }
12910
12910
  function isPlainObject$1(o) {
12911
12911
  var ctor, prot;
12912
- if (isObject(o) === false)
12912
+ if (isObject$2(o) === false)
12913
12913
  return false;
12914
12914
  ctor = o.constructor;
12915
12915
  if (ctor === void 0)
12916
12916
  return true;
12917
12917
  prot = ctor.prototype;
12918
- if (isObject(prot) === false)
12918
+ if (isObject$2(prot) === false)
12919
12919
  return false;
12920
12920
  if (prot.hasOwnProperty("isPrototypeOf") === false) {
12921
12921
  return false;
@@ -17701,12 +17701,12 @@ and ensure you are accounting for this risk.
17701
17701
  enforceHtmlBoundary: false,
17702
17702
  parseStyleAttributes: true
17703
17703
  };
17704
- sanitizeHtml.simpleTransform = function(newTagName, newAttribs, merge) {
17705
- merge = merge === void 0 ? true : merge;
17704
+ sanitizeHtml.simpleTransform = function(newTagName, newAttribs, merge2) {
17705
+ merge2 = merge2 === void 0 ? true : merge2;
17706
17706
  newAttribs = newAttribs || {};
17707
17707
  return function(tagName, attribs) {
17708
17708
  let attrib;
17709
- if (merge) {
17709
+ if (merge2) {
17710
17710
  for (attrib in newAttribs) {
17711
17711
  attribs[attrib] = newAttribs[attrib];
17712
17712
  }
@@ -19704,6 +19704,74 @@ and ensure you are accounting for this risk.
19704
19704
  };
19705
19705
  }
19706
19706
  });
19707
+ const extractValue = (options) => {
19708
+ switch (options.extractFrom) {
19709
+ case "url":
19710
+ return extractFromUrl(options);
19711
+ case "localStorage":
19712
+ case "sessionStorage":
19713
+ return extractFromStorage(options);
19714
+ case "htmlElementText":
19715
+ return extractFromHtmlElementText(options);
19716
+ case "cookie":
19717
+ return extractFromCookie(options);
19718
+ default:
19719
+ return options.default;
19720
+ }
19721
+ };
19722
+ const extractFromCookie = (options) => {
19723
+ var _a, _b;
19724
+ try {
19725
+ 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}=`));
19726
+ return cookieValue ? cookieValue.split("=")[1] : options.default;
19727
+ } catch (e2) {
19728
+ return options.default;
19729
+ }
19730
+ };
19731
+ const extractFromUrl = (options) => {
19732
+ const regex = new RegExp(options.regex);
19733
+ const match = window.location.href.match(regex);
19734
+ return match ? match[1] : options.default;
19735
+ };
19736
+ const extractFromStorage = (options) => {
19737
+ const storage = options.extractFrom === "localStorage" ? localStorage : sessionStorage;
19738
+ let rawValue2 = "";
19739
+ try {
19740
+ rawValue2 = storage.getItem(options.key);
19741
+ } catch (e2) {
19742
+ return options.default;
19743
+ }
19744
+ if (rawValue2) {
19745
+ try {
19746
+ const parsedValue = JSON.parse(rawValue2);
19747
+ return options.path ? getValueFromPath(parsedValue, options.path) : parsedValue;
19748
+ } catch (e2) {
19749
+ return rawValue2;
19750
+ }
19751
+ }
19752
+ return options.default;
19753
+ };
19754
+ const extractFromHtmlElementText = (options) => {
19755
+ var _a;
19756
+ const element = document.querySelector(options.querySelector);
19757
+ return element ? ((_a = element.textContent) == null ? void 0 : _a.trim()) || options.default : options.default;
19758
+ };
19759
+ const getValueFromPath = (obj, path) => {
19760
+ return path.split(".").reduce((value, key) => value && value[key] || null, obj);
19761
+ };
19762
+ const processExtractionObject = (value = {}) => {
19763
+ var _a;
19764
+ const parsedObject = {};
19765
+ for (const key in value) {
19766
+ if (isObject$1(value[key]) && ((_a = value[key]) == null ? void 0 : _a.extractFrom)) {
19767
+ const extractedValue = extractValue(value[key]);
19768
+ parsedObject[key] = Array.isArray(extractedValue) ? extractedValue : [extractedValue];
19769
+ } else {
19770
+ parsedObject[key] = value[key];
19771
+ }
19772
+ }
19773
+ return parsedObject;
19774
+ };
19707
19775
  const _sfc_main$11 = /* @__PURE__ */ defineComponent({
19708
19776
  __name: "SearchBoxProductsWrapper",
19709
19777
  props: {
@@ -19727,6 +19795,9 @@ and ensure you are accounting for this risk.
19727
19795
  const showGoToResultsButton = computed(() => {
19728
19796
  return props.panel.showGoToResults;
19729
19797
  });
19798
+ const extractedInitialFilters = computed(() => {
19799
+ return __spreadValues2({}, processExtractionObject(props.searchBoxOptions.initialFilters));
19800
+ });
19730
19801
  const inputValueProp = computed(() => props.inputValue);
19731
19802
  onMounted(() => {
19732
19803
  getItemsDebounced();
@@ -19744,7 +19815,11 @@ and ensure you are accounting for this risk.
19744
19815
  const getItems = () => {
19745
19816
  searchBoxStore.queryDocuments({
19746
19817
  queryKey: props.panel.queryKey,
19747
- publicQuery: { searchText: props.inputValue, limit: props.panel.limit },
19818
+ publicQuery: {
19819
+ searchText: props.inputValue,
19820
+ limit: props.panel.limit,
19821
+ filters: extractedInitialFilters.value
19822
+ },
19748
19823
  options: props.options
19749
19824
  }).then(({ result: result2 }) => {
19750
19825
  if (!(result2 == null ? void 0 : result2.items.length)) {
@@ -20173,6 +20248,9 @@ and ensure you are accounting for this risk.
20173
20248
  const focused = ref(false);
20174
20249
  const searchBoxInput = ref(null);
20175
20250
  const { highlightedDocument } = storeToRefs(searchBoxStore);
20251
+ computed(() => {
20252
+ return __spreadValues2({}, processExtractionObject(props.options.initialFilters));
20253
+ });
20176
20254
  const searchValue = computed(() => {
20177
20255
  return suggestedValue.value.override ? suggestedValue.value.item.suggestion : inputValue.value;
20178
20256
  });
@@ -20198,7 +20276,8 @@ and ensure you are accounting for this risk.
20198
20276
  "hideMoreResultsButtonOnNoResults",
20199
20277
  "showNoResultsPanel",
20200
20278
  "expandOnSinglePanel",
20201
- "showMoreResultsButton"
20279
+ "showMoreResultsButton",
20280
+ "initialFilters"
20202
20281
  ])
20203
20282
  );
20204
20283
  const searchTriggers = computed(() => {
@@ -25325,7 +25404,10 @@ and ensure you are accounting for this risk.
25325
25404
  class: "lupa-category-back"
25326
25405
  };
25327
25406
  const _hoisted_3$6 = ["href"];
25328
- const _hoisted_4$3 = { class: "lupa-child-category-list" };
25407
+ const _hoisted_4$3 = {
25408
+ key: 1,
25409
+ class: "lupa-child-category-list"
25410
+ };
25329
25411
  const _sfc_main$f = /* @__PURE__ */ defineComponent({
25330
25412
  __name: "CategoryTopFilters",
25331
25413
  props: {
@@ -25339,6 +25421,10 @@ and ensure you are accounting for this risk.
25339
25421
  var _a, _b;
25340
25422
  return Boolean((_b = (_a = props.options.categories) == null ? void 0 : _a.back) == null ? void 0 : _b.title);
25341
25423
  });
25424
+ const hasRelatedCategoryChildren = computed(() => {
25425
+ var _a;
25426
+ return ((_a = relatedCategoryChildren.value) == null ? void 0 : _a.length) > 0;
25427
+ });
25342
25428
  const backTitle = computed(() => {
25343
25429
  var _a, _b;
25344
25430
  return (_b = (_a = props.options.categories) == null ? void 0 : _a.back) == null ? void 0 : _b.title;
@@ -25365,7 +25451,10 @@ and ensure you are accounting for this risk.
25365
25451
  };
25366
25452
  return (_ctx, _cache) => {
25367
25453
  return openBlock(), createElementBlock("div", {
25368
- class: normalizeClass(["lupa-category-top-mobile-filters", { "lupa-has-back-button": hasBackButton.value }])
25454
+ class: normalizeClass(["lupa-category-top-mobile-filters", {
25455
+ "lupa-has-back-button": hasBackButton.value,
25456
+ "has-related-category-children": hasRelatedCategoryChildren.value
25457
+ }])
25369
25458
  }, [
25370
25459
  createBaseVNode("div", _hoisted_1$d, [
25371
25460
  hasBackButton.value ? (openBlock(), createElementBlock("div", _hoisted_2$a, [
@@ -25375,7 +25464,7 @@ and ensure you are accounting for this risk.
25375
25464
  onClick: handleNavigationBack
25376
25465
  }, toDisplayString(backTitle.value), 9, _hoisted_3$6)
25377
25466
  ])) : createCommentVNode("", true),
25378
- createBaseVNode("div", _hoisted_4$3, [
25467
+ hasRelatedCategoryChildren.value ? (openBlock(), createElementBlock("div", _hoisted_4$3, [
25379
25468
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(relatedCategoryChildren), (child) => {
25380
25469
  return openBlock(), createBlock(_sfc_main$U, {
25381
25470
  key: getCategoryKey(child),
@@ -25383,7 +25472,7 @@ and ensure you are accounting for this risk.
25383
25472
  options: categoryOptions.value
25384
25473
  }, null, 8, ["item", "options"]);
25385
25474
  }), 128))
25386
- ]),
25475
+ ])) : createCommentVNode("", true),
25387
25476
  createVNode(_sfc_main$B, {
25388
25477
  class: "lupa-toolbar-mobile",
25389
25478
  "pagination-location": "top",
@@ -25423,9 +25512,12 @@ and ensure you are accounting for this risk.
25423
25512
  const dynamicDataStore = useDynamicDataStore();
25424
25513
  const screenStore = useScreenStore();
25425
25514
  const redirectionStore = useRedirectionStore();
25515
+ const extractedInitialFilters = computed(() => {
25516
+ return __spreadValues2({}, processExtractionObject(props.options.initialFilters));
25517
+ });
25426
25518
  const initialFilters = computed(() => {
25427
- var _a;
25428
- return (_a = props.initialFilters) != null ? _a : {};
25519
+ var _a, _b;
25520
+ return (_b = (_a = props.initialFilters) != null ? _a : extractedInitialFilters.value) != null ? _b : {};
25429
25521
  });
25430
25522
  const { currentQueryText, hasResults, currentFilterCount } = storeToRefs(searchResultStore);
25431
25523
  const { searchString, sortParams } = storeToRefs(paramStore);
@@ -25731,62 +25823,6 @@ and ensure you are accounting for this risk.
25731
25823
  };
25732
25824
  }
25733
25825
  });
25734
- const extractValue = (options) => {
25735
- switch (options.extractFrom) {
25736
- case "url":
25737
- return extractFromUrl(options);
25738
- case "localStorage":
25739
- case "sessionStorage":
25740
- return extractFromStorage(options);
25741
- case "htmlElementText":
25742
- return extractFromHtmlElementText(options);
25743
- default:
25744
- return options.default;
25745
- }
25746
- };
25747
- const extractFromUrl = (options) => {
25748
- const regex = new RegExp(options.regex);
25749
- const match = window.location.href.match(regex);
25750
- return match ? match[1] : options.default;
25751
- };
25752
- const extractFromStorage = (options) => {
25753
- const storage = options.extractFrom === "localStorage" ? localStorage : sessionStorage;
25754
- let rawValue2 = "";
25755
- try {
25756
- rawValue2 = storage.getItem(options.key);
25757
- } catch (e2) {
25758
- return options.default;
25759
- }
25760
- if (rawValue2) {
25761
- try {
25762
- const parsedValue = JSON.parse(rawValue2);
25763
- return options.path ? getValueFromPath(parsedValue, options.path) : parsedValue;
25764
- } catch (e2) {
25765
- return rawValue2;
25766
- }
25767
- }
25768
- return options.default;
25769
- };
25770
- const extractFromHtmlElementText = (options) => {
25771
- var _a;
25772
- const element = document.querySelector(options.querySelector);
25773
- return element ? ((_a = element.textContent) == null ? void 0 : _a.trim()) || options.default : options.default;
25774
- };
25775
- const getValueFromPath = (obj, path) => {
25776
- return path.split(".").reduce((value, key) => value && value[key] || null, obj);
25777
- };
25778
- const processExtractionObject = (value = {}) => {
25779
- var _a;
25780
- const parsedObject = {};
25781
- for (const key in value) {
25782
- if (isObject$1(value[key]) && ((_a = value[key]) == null ? void 0 : _a.extractFrom)) {
25783
- parsedObject[key] = extractValue(value[key]);
25784
- } else {
25785
- parsedObject[key] = value[key];
25786
- }
25787
- }
25788
- return parsedObject;
25789
- };
25790
25826
  const _sfc_main$c = /* @__PURE__ */ defineComponent({
25791
25827
  __name: "ProductList",
25792
25828
  props: {
@@ -25806,7 +25842,7 @@ and ensure you are accounting for this risk.
25806
25842
  var _a;
25807
25843
  (_a = searchResults2.value) == null ? void 0 : _a.handleMounted();
25808
25844
  };
25809
- computed(() => {
25845
+ const initialFilters = computed(() => {
25810
25846
  return __spreadValues2({}, processExtractionObject(props.options.initialFilters));
25811
25847
  });
25812
25848
  __expose({ fetch: fetch2 });
@@ -25814,7 +25850,7 @@ and ensure you are accounting for this risk.
25814
25850
  return openBlock(), createElementBlock("div", null, [
25815
25851
  createVNode(_sfc_main$e, {
25816
25852
  options: componentOptions.value,
25817
- "initial-filters": _ctx.options.initialFilters,
25853
+ "initial-filters": initialFilters.value,
25818
25854
  "is-product-list": true,
25819
25855
  ref_key: "searchResults",
25820
25856
  ref: searchResults2
@@ -30202,7 +30238,7 @@ and ensure you are accounting for this risk.
30202
30238
  });
30203
30239
  return result3;
30204
30240
  }
30205
- var merge = createAssigner(function(object, source, srcIndex) {
30241
+ var merge2 = createAssigner(function(object, source, srcIndex) {
30206
30242
  baseMerge(object, source, srcIndex);
30207
30243
  });
30208
30244
  var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
@@ -30892,7 +30928,7 @@ and ensure you are accounting for this risk.
30892
30928
  lodash2.matches = matches;
30893
30929
  lodash2.matchesProperty = matchesProperty;
30894
30930
  lodash2.memoize = memoize;
30895
- lodash2.merge = merge;
30931
+ lodash2.merge = merge2;
30896
30932
  lodash2.mergeWith = mergeWith;
30897
30933
  lodash2.method = method;
30898
30934
  lodash2.methodOf = methodOf;
@@ -37728,7 +37764,7 @@ and ensure you are accounting for this risk.
37728
37764
  });
37729
37765
  return result3;
37730
37766
  }
37731
- var merge = createAssigner(function(object, source, srcIndex) {
37767
+ var merge2 = createAssigner(function(object, source, srcIndex) {
37732
37768
  baseMerge(object, source, srcIndex);
37733
37769
  });
37734
37770
  var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
@@ -38418,7 +38454,7 @@ and ensure you are accounting for this risk.
38418
38454
  lodash2.matches = matches;
38419
38455
  lodash2.matchesProperty = matchesProperty;
38420
38456
  lodash2.memoize = memoize;
38421
- lodash2.merge = merge;
38457
+ lodash2.merge = merge2;
38422
38458
  lodash2.mergeWith = mergeWith;
38423
38459
  lodash2.method = method;
38424
38460
  lodash2.methodOf = methodOf;
@@ -39575,6 +39611,14 @@ and ensure you are accounting for this risk.
39575
39611
  }, interval);
39576
39612
  });
39577
39613
  });
39614
+ const isObject = (item) => typeof item === "object" && !Array.isArray(item);
39615
+ const merge = (target, source) => {
39616
+ const isDeep = (prop) => isObject(source[prop]) && Object.prototype.hasOwnProperty.call(target, prop) && isObject(target[prop]);
39617
+ const replaced = Object.getOwnPropertyNames(source).map((prop) => ({
39618
+ [prop]: isDeep(prop) ? merge(target[prop], source[prop]) : source[prop]
39619
+ })).reduce((a, b) => __spreadValues(__spreadValues({}, a), b), {});
39620
+ return __spreadValues(__spreadValues({}, target), replaced);
39621
+ };
39578
39622
  const saveToLocalStorage = (key, value) => {
39579
39623
  try {
39580
39624
  localStorage.setItem(key, JSON.stringify(value));
@@ -39626,7 +39670,7 @@ and ensure you are accounting for this risk.
39626
39670
  const PREVIEW_PARAMETER = "lupaSearchPreview";
39627
39671
  const MAX_ELEMENT_MOUNT_RETRIES = 25;
39628
39672
  let styleElement = null;
39629
- const loadAndSaveConfigurationFromServer = (configurationKey, options) => __async(this, null, function* () {
39673
+ const loadAndSaveConfigurationFromServer = (_0, ..._1) => __async(this, [_0, ..._1], function* (configurationKey, options = { environment: "production" }) {
39630
39674
  const configuration = yield fetchPluginConfiguration(
39631
39675
  options,
39632
39676
  configurationKey
@@ -39651,7 +39695,7 @@ and ensure you are accounting for this risk.
39651
39695
  }
39652
39696
  return isPreviewMode;
39653
39697
  };
39654
- const loadConfigurations = (configurationKey, isPreviewMode, options) => __async(this, null, function* () {
39698
+ const loadConfigurations = (configurationKey, isPreviewMode, options, optionOverrides) => __async(this, null, function* () {
39655
39699
  if (isPreviewMode) {
39656
39700
  return loadAndSaveConfigurationFromServer(configurationKey, options);
39657
39701
  }
@@ -39669,7 +39713,7 @@ and ensure you are accounting for this risk.
39669
39713
  const isPreviewMode2 = checkIsPreviewMode();
39670
39714
  const configuration = isPreviewMode2 ? (_a = newestConfiguration.previewConfiguration) != null ? _a : newestConfiguration.configuration : newestConfiguration.configuration;
39671
39715
  if (configuration) {
39672
- yield mount(configuration, options, false, true);
39716
+ yield mount(configuration, options, optionOverrides, false, true);
39673
39717
  } else {
39674
39718
  removeFromLocalStorage(configurationKey);
39675
39719
  window.location.reload();
@@ -39700,7 +39744,8 @@ and ensure you are accounting for this risk.
39700
39744
  }
39701
39745
  document.head.appendChild(styleElement);
39702
39746
  });
39703
- const mountSearchBox = (configuration, options, fetch2 = true, remount = false) => __async(this, null, function* () {
39747
+ const mountSearchBox = (configuration, options, optionOverrides, fetch2 = true, remount = false) => __async(this, null, function* () {
39748
+ var _a;
39704
39749
  if (!configuration.searchBox) {
39705
39750
  return;
39706
39751
  }
@@ -39717,9 +39762,11 @@ and ensure you are accounting for this risk.
39717
39762
  );
39718
39763
  return;
39719
39764
  }
39720
- searchBox(__spreadProps(__spreadValues({}, resolvedConfiguration), { options }), { fetch: fetch2, allowedMountUrls });
39765
+ const mergedOptions = merge(resolvedConfiguration, (_a = optionOverrides == null ? void 0 : optionOverrides.searchBox) != null ? _a : {});
39766
+ searchBox(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
39721
39767
  });
39722
- const mountSearchResults = (configuration, options, fetch2 = true, remount = false) => __async(this, null, function* () {
39768
+ const mountSearchResults = (configuration, options, optionOverrides, fetch2 = true, remount = false) => __async(this, null, function* () {
39769
+ var _a;
39723
39770
  if (!configuration.searchResults) {
39724
39771
  return;
39725
39772
  }
@@ -39736,9 +39783,11 @@ and ensure you are accounting for this risk.
39736
39783
  );
39737
39784
  return;
39738
39785
  }
39739
- searchResults(__spreadProps(__spreadValues({}, resolvedConfiguration), { options }), { fetch: fetch2, allowedMountUrls });
39786
+ const mergedOptions = merge(resolvedConfiguration, (_a = optionOverrides == null ? void 0 : optionOverrides.searchResults) != null ? _a : {});
39787
+ searchResults(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
39740
39788
  });
39741
- const mountProductList = (configuration, options, fetch2 = true, remount = false) => __async(this, null, function* () {
39789
+ const mountProductList = (configuration, options, optionOverrides, fetch2 = true, remount = false) => __async(this, null, function* () {
39790
+ var _a;
39742
39791
  if (!configuration.productList) {
39743
39792
  return;
39744
39793
  }
@@ -39758,12 +39807,14 @@ and ensure you are accounting for this risk.
39758
39807
  );
39759
39808
  return;
39760
39809
  }
39761
- productList(
39762
- __spreadProps(__spreadValues(__spreadValues({}, resolvedSearchResultsConfiguration), resolvedConfiguration), { options }),
39763
- { fetch: fetch2, allowedMountUrls }
39810
+ const mergedOptions = merge(
39811
+ __spreadValues(__spreadValues({}, resolvedSearchResultsConfiguration), resolvedConfiguration),
39812
+ (_a = optionOverrides == null ? void 0 : optionOverrides.productList) != null ? _a : {}
39764
39813
  );
39814
+ productList(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
39765
39815
  });
39766
- const mountRecommendations = (configuration, options, fetch2 = true, remount = false) => __async(this, null, function* () {
39816
+ const mountRecommendations = (configuration, options, optionOverrides, fetch2 = true, remount = false) => __async(this, null, function* () {
39817
+ var _a;
39767
39818
  if (!configuration.recommendations) {
39768
39819
  return;
39769
39820
  }
@@ -39785,10 +39836,11 @@ and ensure you are accounting for this risk.
39785
39836
  );
39786
39837
  return;
39787
39838
  }
39788
- recommendations(
39789
- __spreadProps(__spreadValues(__spreadValues({}, resolvedSearchResultsConfiguration), resolvedConfiguration), { options }),
39790
- { fetch: fetch2, allowedMountUrls }
39839
+ const mergedOptions = merge(
39840
+ __spreadValues(__spreadValues({}, resolvedSearchResultsConfiguration), resolvedConfiguration),
39841
+ (_a = optionOverrides == null ? void 0 : optionOverrides.recommendations) != null ? _a : {}
39791
39842
  );
39843
+ recommendations(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
39792
39844
  });
39793
39845
  const mountChat = (configuration, options, fetch2 = true, remount = false) => __async(this, null, function* () {
39794
39846
  if (!configuration.genAiChat) {
@@ -39815,24 +39867,24 @@ and ensure you are accounting for this risk.
39815
39867
  { fetch: fetch2, allowedMountUrls }
39816
39868
  );
39817
39869
  });
39818
- const mount = (configuration, options, fetch2 = true, remount = false) => __async(this, null, function* () {
39870
+ const mount = (_0, ..._1) => __async(this, [_0, ..._1], function* (configuration, options = { environment: "production" }, optionOverrides = {}, fetch2 = true, remount = false) {
39819
39871
  yield applyStyles(configuration);
39820
39872
  const mountPromises = [
39821
- mountSearchBox(configuration, options, fetch2, remount),
39822
- mountSearchResults(configuration, options, fetch2, remount),
39823
- mountProductList(configuration, options, fetch2, remount),
39824
- mountRecommendations(configuration, options, fetch2, remount),
39873
+ mountSearchBox(configuration, options, optionOverrides, fetch2, remount),
39874
+ mountSearchResults(configuration, options, optionOverrides, fetch2, remount),
39875
+ mountProductList(configuration, options, optionOverrides, fetch2, remount),
39876
+ mountRecommendations(configuration, options, optionOverrides, fetch2, remount),
39825
39877
  mountChat(configuration, options, fetch2, remount)
39826
39878
  ];
39827
39879
  yield Promise.all(mountPromises);
39828
39880
  });
39829
- const init$1 = (configurationKey, options) => __async(this, null, function* () {
39881
+ const init$1 = (_0, ..._1) => __async(this, [_0, ..._1], function* (configurationKey, options = { environment: "production" }, optionOverrides = {}) {
39830
39882
  var _a;
39831
39883
  const isPreviewMode = checkIsPreviewMode();
39832
- const plugin = yield loadConfigurations(configurationKey, isPreviewMode, options);
39884
+ const plugin = yield loadConfigurations(configurationKey, isPreviewMode, options, optionOverrides);
39833
39885
  const configuration = isPreviewMode ? (_a = plugin.previewConfiguration) != null ? _a : plugin.configuration : plugin.configuration;
39834
39886
  if (configuration) {
39835
- yield mount(configuration, options);
39887
+ yield mount(configuration, options, optionOverrides);
39836
39888
  }
39837
39889
  });
39838
39890
  const PluginConfigurationManager = {
@@ -39841,8 +39893,8 @@ and ensure you are accounting for this risk.
39841
39893
  const tracking = (options) => {
39842
39894
  setupTracking(options);
39843
39895
  };
39844
- const init = (configurationKey, options) => {
39845
- return PluginConfigurationManager.init(configurationKey, options);
39896
+ const init = (configurationKey, options, optionOverrides) => {
39897
+ return PluginConfigurationManager.init(configurationKey, options, optionOverrides);
39846
39898
  };
39847
39899
  const lupaSearch = {
39848
39900
  init,