@getlupa/client 1.1.2 → 1.1.3

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.
@@ -6855,6 +6855,20 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
6855
6855
  DocumentElementType2["CUSTOM_HTML"] = "customHtml";
6856
6856
  return DocumentElementType2;
6857
6857
  })(DocumentElementType || {});
6858
+ var SearchBoxPanelType = /* @__PURE__ */ ((SearchBoxPanelType2) => {
6859
+ SearchBoxPanelType2["SUGGESTION"] = "suggestion";
6860
+ SearchBoxPanelType2["DOCUMENT"] = "document";
6861
+ return SearchBoxPanelType2;
6862
+ })(SearchBoxPanelType || {});
6863
+ var BadgeType = /* @__PURE__ */ ((BadgeType2) => {
6864
+ BadgeType2["DISCOUNTPERCENTAGE"] = "discountPercentage";
6865
+ BadgeType2["DISCOUNTAMOUNT"] = "discountAmount";
6866
+ BadgeType2["NEWITEM"] = "newItem";
6867
+ BadgeType2["TEXT"] = "text";
6868
+ BadgeType2["IMAGE"] = "image";
6869
+ BadgeType2["CUSTOM_HTML"] = "customHtml";
6870
+ return BadgeType2;
6871
+ })(BadgeType || {});
6858
6872
  const retrieveHistory = () => {
6859
6873
  try {
6860
6874
  const historyString = window.localStorage.getItem(HISTORY_LOCAL_STORAGE_KEY);
@@ -7444,11 +7458,6 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7444
7458
  setSearchResultsLink
7445
7459
  };
7446
7460
  });
7447
- var SearchBoxPanelType = /* @__PURE__ */ ((SearchBoxPanelType2) => {
7448
- SearchBoxPanelType2["SUGGESTION"] = "suggestion";
7449
- SearchBoxPanelType2["DOCUMENT"] = "document";
7450
- return SearchBoxPanelType2;
7451
- })(SearchBoxPanelType || {});
7452
7461
  const flattenFacet = (key, facets, suggestion, inputValue) => {
7453
7462
  return facets.map((f2) => ({
7454
7463
  displayHighlight: getHint(suggestion.suggestion, inputValue != null ? inputValue : ""),
@@ -9903,7 +9912,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
9903
9912
  props: {
9904
9913
  options: {}
9905
9914
  },
9906
- setup(__props) {
9915
+ setup(__props, { expose: __expose }) {
9907
9916
  const props = __props;
9908
9917
  const categoryChildren = ref([]);
9909
9918
  const optionStore = useOptionsStore();
@@ -9982,6 +9991,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
9982
9991
  }
9983
9992
  handleRoutingEvent(backUrlLink.value, event, hasEventRouting.value);
9984
9993
  };
9994
+ __expose({ fetch: fetch2 });
9985
9995
  return (_ctx, _cache) => {
9986
9996
  return openBlock(), createElementBlock("div", _hoisted_1$H, [
9987
9997
  createBaseVNode("div", _hoisted_2$t, [
@@ -11809,8 +11819,9 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
11809
11819
  options: {},
11810
11820
  expandable: { type: Boolean }
11811
11821
  },
11812
- setup(__props) {
11822
+ setup(__props, { expose: __expose }) {
11813
11823
  const props = __props;
11824
+ const categoryFilters = ref(null);
11814
11825
  const desktopFiltersVisible = computed(() => {
11815
11826
  var _a, _b, _c;
11816
11827
  return (_c = (_b = (_a = props.options.currentFilters) == null ? void 0 : _a.visibility) == null ? void 0 : _b.desktopSidebar) != null ? _c : true;
@@ -11822,6 +11833,13 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
11822
11833
  const showCurrentFilters = computed(() => {
11823
11834
  return currentFiltersVisible.value ? Boolean(props.options.facets) : false;
11824
11835
  });
11836
+ const fetch2 = () => {
11837
+ var _a;
11838
+ if (categoryFilters.value) {
11839
+ (_a = categoryFilters.value) == null ? void 0 : _a.fetch();
11840
+ }
11841
+ };
11842
+ __expose({ fetch: fetch2 });
11825
11843
  return (_ctx, _cache) => {
11826
11844
  var _a;
11827
11845
  return openBlock(), createElementBlock("div", _hoisted_1$z, [
@@ -11833,7 +11851,8 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
11833
11851
  _ctx.options.categories ? (openBlock(), createBlock(_sfc_main$K, {
11834
11852
  key: 1,
11835
11853
  options: _ctx.options.categories,
11836
- ref: "categoryFilters"
11854
+ ref_key: "categoryFilters",
11855
+ ref: categoryFilters
11837
11856
  }, null, 8, ["options"])) : createCommentVNode("", true),
11838
11857
  _ctx.options.facets ? (openBlock(), createBlock(_sfc_main$D, {
11839
11858
  key: 2,
@@ -12420,15 +12439,6 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
12420
12439
  };
12421
12440
  }
12422
12441
  });
12423
- var BadgeType = /* @__PURE__ */ ((BadgeType2) => {
12424
- BadgeType2["DISCOUNTPERCENTAGE"] = "discountPercentage";
12425
- BadgeType2["DISCOUNTAMOUNT"] = "discountAmount";
12426
- BadgeType2["NEWITEM"] = "newItem";
12427
- BadgeType2["TEXT"] = "text";
12428
- BadgeType2["IMAGE"] = "image";
12429
- BadgeType2["CUSTOM_HTML"] = "customHtml";
12430
- return BadgeType2;
12431
- })(BadgeType || {});
12432
12442
  const _hoisted_1$p = { class: "lupa-generated-badges" };
12433
12443
  const _sfc_main$s = /* @__PURE__ */ defineComponent({
12434
12444
  __name: "SearchResultGeneratedBadges",
@@ -13876,7 +13886,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
13876
13886
  isContainer: { type: Boolean },
13877
13887
  initialData: {}
13878
13888
  },
13879
- setup(__props) {
13889
+ setup(__props, { expose: __expose }) {
13880
13890
  const props = __props;
13881
13891
  const searchResultStore = useSearchResultStore();
13882
13892
  const optionStore = useOptionsStore();
@@ -13907,12 +13917,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
13907
13917
  onMounted(() => {
13908
13918
  var _a, _b;
13909
13919
  window.addEventListener("resize", handleResize);
13910
- optionStore.setSearchResultOptions({ options: props.options });
13911
13920
  if (props.initialData) {
13912
13921
  searchResultStore.add(__spreadValues2({}, props.initialData));
13913
13922
  }
13914
13923
  handleMounted();
13915
- optionStore.setInitialFilters({ initialFilters: initialFilters.value });
13916
13924
  (_b = (_a = props.options.callbacks) == null ? void 0 : _a.onMounted) == null ? void 0 : _b.call(_a);
13917
13925
  mounted.value = true;
13918
13926
  });
@@ -13998,6 +14006,8 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
13998
14006
  };
13999
14007
  const handleMounted = () => {
14000
14008
  var _a;
14009
+ optionStore.setSearchResultOptions({ options: props.options });
14010
+ optionStore.setInitialFilters({ initialFilters: initialFilters.value });
14001
14011
  handleResize();
14002
14012
  if (props.isProductList) {
14003
14013
  const pageTitle = props.options.labels.htmlTitleTemplate;
@@ -14051,6 +14061,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
14051
14061
  }
14052
14062
  };
14053
14063
  handleCreated();
14064
+ __expose({ handleMounted, handleUrlChange });
14054
14065
  return (_ctx, _cache) => {
14055
14066
  var _a, _b, _c, _d, _e;
14056
14067
  return openBlock(), createElementBlock("div", {
@@ -26459,26 +26470,29 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26459
26470
  const parent = element == null ? void 0 : element.parentElement;
26460
26471
  const mountElement = mountToParent ? parent : element;
26461
26472
  if (!mountElement) {
26462
- console.error(`Cannot mount LupaSearch componbent. Element "${selector}" not found`);
26473
+ console.error(`Cannot mount LupaSearch component. Element "${selector}" not found`);
26463
26474
  return;
26464
26475
  }
26476
+ let mountedComponent = null;
26465
26477
  const props = reactive(__spreadValues({}, options));
26466
- const app2 = createApp(rootComponent, props);
26478
+ const app2 = createApp({
26479
+ render: () => mountedComponent = h$1(rootComponent, props)
26480
+ });
26467
26481
  app2.use(pinia);
26468
26482
  const mountedApp = app2.mount(mountElement);
26469
26483
  if (mountToParent) {
26470
26484
  element == null ? void 0 : element.remove();
26471
26485
  }
26472
- return mountedApp;
26486
+ return { mountedApp, mountedComponent, props };
26473
26487
  };
26474
26488
  const applySearchBox = (options, mountOptions) => {
26475
26489
  const existingInstance = app.box[options.inputSelector];
26476
26490
  if (existingInstance) {
26477
- existingInstance.searchBoxOptions = options;
26491
+ existingInstance.props.searchBoxOptions = options;
26478
26492
  if (mountOptions == null ? void 0 : mountOptions.fetch) {
26479
26493
  setTimeout(() => {
26480
- var _a;
26481
- (_a = existingInstance.fetch) == null ? void 0 : _a.call(existingInstance);
26494
+ var _a, _b, _c, _d;
26495
+ (_d = (_c = (_b = (_a = existingInstance.mountedComponent) == null ? void 0 : _a.component) == null ? void 0 : _b.exposed) == null ? void 0 : _c.fetch) == null ? void 0 : _d.call(_c);
26482
26496
  });
26483
26497
  }
26484
26498
  return;
@@ -26504,11 +26518,11 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26504
26518
  const searchResults = (options, mountOptions) => {
26505
26519
  const existingInstance = app.results[options.containerSelector];
26506
26520
  if (existingInstance) {
26507
- existingInstance.searchResultsOptions = options;
26521
+ existingInstance.props.searchResultsOptions = options;
26508
26522
  if (mountOptions == null ? void 0 : mountOptions.fetch) {
26509
26523
  setTimeout(() => {
26510
- var _a;
26511
- (_a = existingInstance.fetch) == null ? void 0 : _a.call(existingInstance);
26524
+ var _a, _b, _c, _d;
26525
+ (_d = (_c = (_b = (_a = existingInstance.mountedComponent) == null ? void 0 : _a.component) == null ? void 0 : _b.exposed) == null ? void 0 : _c.fetch) == null ? void 0 : _d.call(_c);
26512
26526
  });
26513
26527
  }
26514
26528
  return;
@@ -26524,11 +26538,11 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26524
26538
  const productList = (options, mountOptions) => {
26525
26539
  const existingInstance = app.productList[options.containerSelector];
26526
26540
  if (existingInstance) {
26527
- existingInstance.productListOptions = options;
26541
+ existingInstance.props.productListOptions = options;
26528
26542
  if (mountOptions == null ? void 0 : mountOptions.fetch) {
26529
26543
  setTimeout(() => {
26530
- var _a;
26531
- (_a = existingInstance.fetch) == null ? void 0 : _a.call(existingInstance);
26544
+ var _a, _b, _c, _d;
26545
+ (_d = (_c = (_b = (_a = existingInstance.mountedComponent) == null ? void 0 : _a.component) == null ? void 0 : _b.exposed) == null ? void 0 : _c.fetch) == null ? void 0 : _d.call(_c);
26532
26546
  });
26533
26547
  }
26534
26548
  return;
@@ -26542,16 +26556,15 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26542
26556
  app.productList[options.containerSelector] = instance;
26543
26557
  };
26544
26558
  const searchContainer = (options, mountOptions) => {
26545
- var _a, _b;
26559
+ var _a, _b, _c, _d, _e, _f;
26546
26560
  const existingInstance = app.searchContainer[options.trigger];
26547
26561
  if (existingInstance) {
26548
- existingInstance.searchContainerOptions.value = options;
26549
- existingInstance.reloadOptions();
26550
- console.log(existingInstance);
26562
+ existingInstance.props.searchContainerOptions = options;
26563
+ (_d = (_c = (_b = (_a = existingInstance.mountedComponent) == null ? void 0 : _a.component) == null ? void 0 : _b.exposed) == null ? void 0 : _c.reloadOptions) == null ? void 0 : _d.call(_c);
26551
26564
  if (mountOptions == null ? void 0 : mountOptions.fetch) {
26552
26565
  setTimeout(() => {
26553
- var _a2;
26554
- (_a2 = existingInstance.fetch) == null ? void 0 : _a2.call(existingInstance);
26566
+ var _a2, _b2, _c2, _d2;
26567
+ (_d2 = (_c2 = (_b2 = (_a2 = existingInstance.mountedComponent) == null ? void 0 : _a2.component) == null ? void 0 : _b2.exposed) == null ? void 0 : _c2.fetch) == null ? void 0 : _d2.call(_c2);
26555
26568
  });
26556
26569
  }
26557
26570
  return;
@@ -26562,7 +26575,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26562
26575
  attatchShadowDom({
26563
26576
  host,
26564
26577
  manager,
26565
- styleUrl: (_b = (_a = options.options) == null ? void 0 : _a.styleLink) != null ? _b : DEFAULT_CONTAINER_STYLE,
26578
+ styleUrl: (_f = (_e = options.options) == null ? void 0 : _e.styleLink) != null ? _f : DEFAULT_CONTAINER_STYLE,
26566
26579
  options: options.options
26567
26580
  });
26568
26581
  document.body.appendChild(host);
@@ -26577,11 +26590,11 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26577
26590
  const recommendations = (options, mountOptions) => {
26578
26591
  const existingInstance = app.recommendations[options.containerSelector];
26579
26592
  if (existingInstance) {
26580
- existingInstance.recommendationOptions = options;
26593
+ existingInstance.props.recommendationOptions = options;
26581
26594
  if (mountOptions == null ? void 0 : mountOptions.fetch) {
26582
26595
  setTimeout(() => {
26583
- var _a;
26584
- (_a = existingInstance.fetch) == null ? void 0 : _a.call(existingInstance);
26596
+ var _a, _b, _c, _d;
26597
+ (_d = (_c = (_b = (_a = existingInstance.mountedComponent) == null ? void 0 : _a.component) == null ? void 0 : _b.exposed) == null ? void 0 : _c.fetch) == null ? void 0 : _d.call(_c);
26585
26598
  });
26586
26599
  }
26587
26600
  return;
@@ -26683,7 +26696,9 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26683
26696
  window.getLupa = lupaSearch;
26684
26697
  window.lupaSearch = lupaSearch;
26685
26698
  }
26699
+ exports.BadgeType = BadgeType;
26686
26700
  exports.DocumentElementType = DocumentElementType;
26701
+ exports.SearchBoxPanelType = SearchBoxPanelType;
26687
26702
  exports.default = lupaSearch;
26688
26703
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
26689
26704
  return exports;
@@ -6855,6 +6855,20 @@ var DocumentElementType = /* @__PURE__ */ ((DocumentElementType2) => {
6855
6855
  DocumentElementType2["CUSTOM_HTML"] = "customHtml";
6856
6856
  return DocumentElementType2;
6857
6857
  })(DocumentElementType || {});
6858
+ var SearchBoxPanelType = /* @__PURE__ */ ((SearchBoxPanelType2) => {
6859
+ SearchBoxPanelType2["SUGGESTION"] = "suggestion";
6860
+ SearchBoxPanelType2["DOCUMENT"] = "document";
6861
+ return SearchBoxPanelType2;
6862
+ })(SearchBoxPanelType || {});
6863
+ var BadgeType = /* @__PURE__ */ ((BadgeType2) => {
6864
+ BadgeType2["DISCOUNTPERCENTAGE"] = "discountPercentage";
6865
+ BadgeType2["DISCOUNTAMOUNT"] = "discountAmount";
6866
+ BadgeType2["NEWITEM"] = "newItem";
6867
+ BadgeType2["TEXT"] = "text";
6868
+ BadgeType2["IMAGE"] = "image";
6869
+ BadgeType2["CUSTOM_HTML"] = "customHtml";
6870
+ return BadgeType2;
6871
+ })(BadgeType || {});
6858
6872
  const retrieveHistory = () => {
6859
6873
  try {
6860
6874
  const historyString = window.localStorage.getItem(HISTORY_LOCAL_STORAGE_KEY);
@@ -7444,11 +7458,6 @@ const useParamsStore = defineStore("params", () => {
7444
7458
  setSearchResultsLink
7445
7459
  };
7446
7460
  });
7447
- var SearchBoxPanelType = /* @__PURE__ */ ((SearchBoxPanelType2) => {
7448
- SearchBoxPanelType2["SUGGESTION"] = "suggestion";
7449
- SearchBoxPanelType2["DOCUMENT"] = "document";
7450
- return SearchBoxPanelType2;
7451
- })(SearchBoxPanelType || {});
7452
7461
  const flattenFacet = (key, facets, suggestion, inputValue) => {
7453
7462
  return facets.map((f2) => ({
7454
7463
  displayHighlight: getHint(suggestion.suggestion, inputValue != null ? inputValue : ""),
@@ -9903,7 +9912,7 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
9903
9912
  props: {
9904
9913
  options: {}
9905
9914
  },
9906
- setup(__props) {
9915
+ setup(__props, { expose: __expose }) {
9907
9916
  const props = __props;
9908
9917
  const categoryChildren = ref([]);
9909
9918
  const optionStore = useOptionsStore();
@@ -9982,6 +9991,7 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
9982
9991
  }
9983
9992
  handleRoutingEvent(backUrlLink.value, event, hasEventRouting.value);
9984
9993
  };
9994
+ __expose({ fetch: fetch2 });
9985
9995
  return (_ctx, _cache) => {
9986
9996
  return openBlock(), createElementBlock("div", _hoisted_1$H, [
9987
9997
  createBaseVNode("div", _hoisted_2$t, [
@@ -11809,8 +11819,9 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
11809
11819
  options: {},
11810
11820
  expandable: { type: Boolean }
11811
11821
  },
11812
- setup(__props) {
11822
+ setup(__props, { expose: __expose }) {
11813
11823
  const props = __props;
11824
+ const categoryFilters = ref(null);
11814
11825
  const desktopFiltersVisible = computed(() => {
11815
11826
  var _a, _b, _c;
11816
11827
  return (_c = (_b = (_a = props.options.currentFilters) == null ? void 0 : _a.visibility) == null ? void 0 : _b.desktopSidebar) != null ? _c : true;
@@ -11822,6 +11833,13 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
11822
11833
  const showCurrentFilters = computed(() => {
11823
11834
  return currentFiltersVisible.value ? Boolean(props.options.facets) : false;
11824
11835
  });
11836
+ const fetch2 = () => {
11837
+ var _a;
11838
+ if (categoryFilters.value) {
11839
+ (_a = categoryFilters.value) == null ? void 0 : _a.fetch();
11840
+ }
11841
+ };
11842
+ __expose({ fetch: fetch2 });
11825
11843
  return (_ctx, _cache) => {
11826
11844
  var _a;
11827
11845
  return openBlock(), createElementBlock("div", _hoisted_1$z, [
@@ -11833,7 +11851,8 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
11833
11851
  _ctx.options.categories ? (openBlock(), createBlock(_sfc_main$K, {
11834
11852
  key: 1,
11835
11853
  options: _ctx.options.categories,
11836
- ref: "categoryFilters"
11854
+ ref_key: "categoryFilters",
11855
+ ref: categoryFilters
11837
11856
  }, null, 8, ["options"])) : createCommentVNode("", true),
11838
11857
  _ctx.options.facets ? (openBlock(), createBlock(_sfc_main$D, {
11839
11858
  key: 2,
@@ -12420,15 +12439,6 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
12420
12439
  };
12421
12440
  }
12422
12441
  });
12423
- var BadgeType = /* @__PURE__ */ ((BadgeType2) => {
12424
- BadgeType2["DISCOUNTPERCENTAGE"] = "discountPercentage";
12425
- BadgeType2["DISCOUNTAMOUNT"] = "discountAmount";
12426
- BadgeType2["NEWITEM"] = "newItem";
12427
- BadgeType2["TEXT"] = "text";
12428
- BadgeType2["IMAGE"] = "image";
12429
- BadgeType2["CUSTOM_HTML"] = "customHtml";
12430
- return BadgeType2;
12431
- })(BadgeType || {});
12432
12442
  const _hoisted_1$p = { class: "lupa-generated-badges" };
12433
12443
  const _sfc_main$s = /* @__PURE__ */ defineComponent({
12434
12444
  __name: "SearchResultGeneratedBadges",
@@ -13876,7 +13886,7 @@ const _sfc_main$4$1 = /* @__PURE__ */ defineComponent({
13876
13886
  isContainer: { type: Boolean },
13877
13887
  initialData: {}
13878
13888
  },
13879
- setup(__props) {
13889
+ setup(__props, { expose: __expose }) {
13880
13890
  const props = __props;
13881
13891
  const searchResultStore = useSearchResultStore();
13882
13892
  const optionStore = useOptionsStore();
@@ -13907,12 +13917,10 @@ const _sfc_main$4$1 = /* @__PURE__ */ defineComponent({
13907
13917
  onMounted(() => {
13908
13918
  var _a, _b;
13909
13919
  window.addEventListener("resize", handleResize);
13910
- optionStore.setSearchResultOptions({ options: props.options });
13911
13920
  if (props.initialData) {
13912
13921
  searchResultStore.add(__spreadValues2({}, props.initialData));
13913
13922
  }
13914
13923
  handleMounted();
13915
- optionStore.setInitialFilters({ initialFilters: initialFilters.value });
13916
13924
  (_b = (_a = props.options.callbacks) == null ? void 0 : _a.onMounted) == null ? void 0 : _b.call(_a);
13917
13925
  mounted.value = true;
13918
13926
  });
@@ -13998,6 +14006,8 @@ const _sfc_main$4$1 = /* @__PURE__ */ defineComponent({
13998
14006
  };
13999
14007
  const handleMounted = () => {
14000
14008
  var _a;
14009
+ optionStore.setSearchResultOptions({ options: props.options });
14010
+ optionStore.setInitialFilters({ initialFilters: initialFilters.value });
14001
14011
  handleResize();
14002
14012
  if (props.isProductList) {
14003
14013
  const pageTitle = props.options.labels.htmlTitleTemplate;
@@ -14051,6 +14061,7 @@ const _sfc_main$4$1 = /* @__PURE__ */ defineComponent({
14051
14061
  }
14052
14062
  };
14053
14063
  handleCreated();
14064
+ __expose({ handleMounted, handleUrlChange });
14054
14065
  return (_ctx, _cache) => {
14055
14066
  var _a, _b, _c, _d, _e;
14056
14067
  return openBlock(), createElementBlock("div", {
@@ -26459,26 +26470,29 @@ const createVue = (selector, rootComponent, options, mountToParent = false) => {
26459
26470
  const parent = element == null ? void 0 : element.parentElement;
26460
26471
  const mountElement = mountToParent ? parent : element;
26461
26472
  if (!mountElement) {
26462
- console.error(`Cannot mount LupaSearch componbent. Element "${selector}" not found`);
26473
+ console.error(`Cannot mount LupaSearch component. Element "${selector}" not found`);
26463
26474
  return;
26464
26475
  }
26476
+ let mountedComponent = null;
26465
26477
  const props = reactive(__spreadValues({}, options));
26466
- const app2 = createApp(rootComponent, props);
26478
+ const app2 = createApp({
26479
+ render: () => mountedComponent = h$1(rootComponent, props)
26480
+ });
26467
26481
  app2.use(pinia);
26468
26482
  const mountedApp = app2.mount(mountElement);
26469
26483
  if (mountToParent) {
26470
26484
  element == null ? void 0 : element.remove();
26471
26485
  }
26472
- return mountedApp;
26486
+ return { mountedApp, mountedComponent, props };
26473
26487
  };
26474
26488
  const applySearchBox = (options, mountOptions) => {
26475
26489
  const existingInstance = app.box[options.inputSelector];
26476
26490
  if (existingInstance) {
26477
- existingInstance.searchBoxOptions = options;
26491
+ existingInstance.props.searchBoxOptions = options;
26478
26492
  if (mountOptions == null ? void 0 : mountOptions.fetch) {
26479
26493
  setTimeout(() => {
26480
- var _a;
26481
- (_a = existingInstance.fetch) == null ? void 0 : _a.call(existingInstance);
26494
+ var _a, _b, _c, _d;
26495
+ (_d = (_c = (_b = (_a = existingInstance.mountedComponent) == null ? void 0 : _a.component) == null ? void 0 : _b.exposed) == null ? void 0 : _c.fetch) == null ? void 0 : _d.call(_c);
26482
26496
  });
26483
26497
  }
26484
26498
  return;
@@ -26504,11 +26518,11 @@ const searchBox = (options, mountOptions) => {
26504
26518
  const searchResults = (options, mountOptions) => {
26505
26519
  const existingInstance = app.results[options.containerSelector];
26506
26520
  if (existingInstance) {
26507
- existingInstance.searchResultsOptions = options;
26521
+ existingInstance.props.searchResultsOptions = options;
26508
26522
  if (mountOptions == null ? void 0 : mountOptions.fetch) {
26509
26523
  setTimeout(() => {
26510
- var _a;
26511
- (_a = existingInstance.fetch) == null ? void 0 : _a.call(existingInstance);
26524
+ var _a, _b, _c, _d;
26525
+ (_d = (_c = (_b = (_a = existingInstance.mountedComponent) == null ? void 0 : _a.component) == null ? void 0 : _b.exposed) == null ? void 0 : _c.fetch) == null ? void 0 : _d.call(_c);
26512
26526
  });
26513
26527
  }
26514
26528
  return;
@@ -26524,11 +26538,11 @@ const searchResults = (options, mountOptions) => {
26524
26538
  const productList = (options, mountOptions) => {
26525
26539
  const existingInstance = app.productList[options.containerSelector];
26526
26540
  if (existingInstance) {
26527
- existingInstance.productListOptions = options;
26541
+ existingInstance.props.productListOptions = options;
26528
26542
  if (mountOptions == null ? void 0 : mountOptions.fetch) {
26529
26543
  setTimeout(() => {
26530
- var _a;
26531
- (_a = existingInstance.fetch) == null ? void 0 : _a.call(existingInstance);
26544
+ var _a, _b, _c, _d;
26545
+ (_d = (_c = (_b = (_a = existingInstance.mountedComponent) == null ? void 0 : _a.component) == null ? void 0 : _b.exposed) == null ? void 0 : _c.fetch) == null ? void 0 : _d.call(_c);
26532
26546
  });
26533
26547
  }
26534
26548
  return;
@@ -26542,16 +26556,15 @@ const productList = (options, mountOptions) => {
26542
26556
  app.productList[options.containerSelector] = instance;
26543
26557
  };
26544
26558
  const searchContainer = (options, mountOptions) => {
26545
- var _a, _b;
26559
+ var _a, _b, _c, _d, _e, _f;
26546
26560
  const existingInstance = app.searchContainer[options.trigger];
26547
26561
  if (existingInstance) {
26548
- existingInstance.searchContainerOptions.value = options;
26549
- existingInstance.reloadOptions();
26550
- console.log(existingInstance);
26562
+ existingInstance.props.searchContainerOptions = options;
26563
+ (_d = (_c = (_b = (_a = existingInstance.mountedComponent) == null ? void 0 : _a.component) == null ? void 0 : _b.exposed) == null ? void 0 : _c.reloadOptions) == null ? void 0 : _d.call(_c);
26551
26564
  if (mountOptions == null ? void 0 : mountOptions.fetch) {
26552
26565
  setTimeout(() => {
26553
- var _a2;
26554
- (_a2 = existingInstance.fetch) == null ? void 0 : _a2.call(existingInstance);
26566
+ var _a2, _b2, _c2, _d2;
26567
+ (_d2 = (_c2 = (_b2 = (_a2 = existingInstance.mountedComponent) == null ? void 0 : _a2.component) == null ? void 0 : _b2.exposed) == null ? void 0 : _c2.fetch) == null ? void 0 : _d2.call(_c2);
26555
26568
  });
26556
26569
  }
26557
26570
  return;
@@ -26562,7 +26575,7 @@ const searchContainer = (options, mountOptions) => {
26562
26575
  attatchShadowDom({
26563
26576
  host,
26564
26577
  manager,
26565
- styleUrl: (_b = (_a = options.options) == null ? void 0 : _a.styleLink) != null ? _b : DEFAULT_CONTAINER_STYLE,
26578
+ styleUrl: (_f = (_e = options.options) == null ? void 0 : _e.styleLink) != null ? _f : DEFAULT_CONTAINER_STYLE,
26566
26579
  options: options.options
26567
26580
  });
26568
26581
  document.body.appendChild(host);
@@ -26577,11 +26590,11 @@ const searchContainer = (options, mountOptions) => {
26577
26590
  const recommendations = (options, mountOptions) => {
26578
26591
  const existingInstance = app.recommendations[options.containerSelector];
26579
26592
  if (existingInstance) {
26580
- existingInstance.recommendationOptions = options;
26593
+ existingInstance.props.recommendationOptions = options;
26581
26594
  if (mountOptions == null ? void 0 : mountOptions.fetch) {
26582
26595
  setTimeout(() => {
26583
- var _a;
26584
- (_a = existingInstance.fetch) == null ? void 0 : _a.call(existingInstance);
26596
+ var _a, _b, _c, _d;
26597
+ (_d = (_c = (_b = (_a = existingInstance.mountedComponent) == null ? void 0 : _a.component) == null ? void 0 : _b.exposed) == null ? void 0 : _c.fetch) == null ? void 0 : _d.call(_c);
26585
26598
  });
26586
26599
  }
26587
26600
  return;
@@ -26683,5 +26696,7 @@ if (window) {
26683
26696
  window.getLupa = lupaSearch;
26684
26697
  window.lupaSearch = lupaSearch;
26685
26698
  }
26699
+ exports.BadgeType = BadgeType;
26686
26700
  exports.DocumentElementType = DocumentElementType;
26701
+ exports.SearchBoxPanelType = SearchBoxPanelType;
26687
26702
  exports.default = lupaSearch;
@@ -6853,6 +6853,20 @@ var DocumentElementType = /* @__PURE__ */ ((DocumentElementType2) => {
6853
6853
  DocumentElementType2["CUSTOM_HTML"] = "customHtml";
6854
6854
  return DocumentElementType2;
6855
6855
  })(DocumentElementType || {});
6856
+ var SearchBoxPanelType = /* @__PURE__ */ ((SearchBoxPanelType2) => {
6857
+ SearchBoxPanelType2["SUGGESTION"] = "suggestion";
6858
+ SearchBoxPanelType2["DOCUMENT"] = "document";
6859
+ return SearchBoxPanelType2;
6860
+ })(SearchBoxPanelType || {});
6861
+ var BadgeType = /* @__PURE__ */ ((BadgeType2) => {
6862
+ BadgeType2["DISCOUNTPERCENTAGE"] = "discountPercentage";
6863
+ BadgeType2["DISCOUNTAMOUNT"] = "discountAmount";
6864
+ BadgeType2["NEWITEM"] = "newItem";
6865
+ BadgeType2["TEXT"] = "text";
6866
+ BadgeType2["IMAGE"] = "image";
6867
+ BadgeType2["CUSTOM_HTML"] = "customHtml";
6868
+ return BadgeType2;
6869
+ })(BadgeType || {});
6856
6870
  const retrieveHistory = () => {
6857
6871
  try {
6858
6872
  const historyString = window.localStorage.getItem(HISTORY_LOCAL_STORAGE_KEY);
@@ -7442,11 +7456,6 @@ const useParamsStore = defineStore("params", () => {
7442
7456
  setSearchResultsLink
7443
7457
  };
7444
7458
  });
7445
- var SearchBoxPanelType = /* @__PURE__ */ ((SearchBoxPanelType2) => {
7446
- SearchBoxPanelType2["SUGGESTION"] = "suggestion";
7447
- SearchBoxPanelType2["DOCUMENT"] = "document";
7448
- return SearchBoxPanelType2;
7449
- })(SearchBoxPanelType || {});
7450
7459
  const flattenFacet = (key, facets, suggestion, inputValue) => {
7451
7460
  return facets.map((f2) => ({
7452
7461
  displayHighlight: getHint(suggestion.suggestion, inputValue != null ? inputValue : ""),
@@ -9901,7 +9910,7 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
9901
9910
  props: {
9902
9911
  options: {}
9903
9912
  },
9904
- setup(__props) {
9913
+ setup(__props, { expose: __expose }) {
9905
9914
  const props = __props;
9906
9915
  const categoryChildren = ref([]);
9907
9916
  const optionStore = useOptionsStore();
@@ -9980,6 +9989,7 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
9980
9989
  }
9981
9990
  handleRoutingEvent(backUrlLink.value, event, hasEventRouting.value);
9982
9991
  };
9992
+ __expose({ fetch: fetch2 });
9983
9993
  return (_ctx, _cache) => {
9984
9994
  return openBlock(), createElementBlock("div", _hoisted_1$H, [
9985
9995
  createBaseVNode("div", _hoisted_2$t, [
@@ -11807,8 +11817,9 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
11807
11817
  options: {},
11808
11818
  expandable: { type: Boolean }
11809
11819
  },
11810
- setup(__props) {
11820
+ setup(__props, { expose: __expose }) {
11811
11821
  const props = __props;
11822
+ const categoryFilters = ref(null);
11812
11823
  const desktopFiltersVisible = computed(() => {
11813
11824
  var _a, _b, _c;
11814
11825
  return (_c = (_b = (_a = props.options.currentFilters) == null ? void 0 : _a.visibility) == null ? void 0 : _b.desktopSidebar) != null ? _c : true;
@@ -11820,6 +11831,13 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
11820
11831
  const showCurrentFilters = computed(() => {
11821
11832
  return currentFiltersVisible.value ? Boolean(props.options.facets) : false;
11822
11833
  });
11834
+ const fetch2 = () => {
11835
+ var _a;
11836
+ if (categoryFilters.value) {
11837
+ (_a = categoryFilters.value) == null ? void 0 : _a.fetch();
11838
+ }
11839
+ };
11840
+ __expose({ fetch: fetch2 });
11823
11841
  return (_ctx, _cache) => {
11824
11842
  var _a;
11825
11843
  return openBlock(), createElementBlock("div", _hoisted_1$z, [
@@ -11831,7 +11849,8 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
11831
11849
  _ctx.options.categories ? (openBlock(), createBlock(_sfc_main$K, {
11832
11850
  key: 1,
11833
11851
  options: _ctx.options.categories,
11834
- ref: "categoryFilters"
11852
+ ref_key: "categoryFilters",
11853
+ ref: categoryFilters
11835
11854
  }, null, 8, ["options"])) : createCommentVNode("", true),
11836
11855
  _ctx.options.facets ? (openBlock(), createBlock(_sfc_main$D, {
11837
11856
  key: 2,
@@ -12418,15 +12437,6 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
12418
12437
  };
12419
12438
  }
12420
12439
  });
12421
- var BadgeType = /* @__PURE__ */ ((BadgeType2) => {
12422
- BadgeType2["DISCOUNTPERCENTAGE"] = "discountPercentage";
12423
- BadgeType2["DISCOUNTAMOUNT"] = "discountAmount";
12424
- BadgeType2["NEWITEM"] = "newItem";
12425
- BadgeType2["TEXT"] = "text";
12426
- BadgeType2["IMAGE"] = "image";
12427
- BadgeType2["CUSTOM_HTML"] = "customHtml";
12428
- return BadgeType2;
12429
- })(BadgeType || {});
12430
12440
  const _hoisted_1$p = { class: "lupa-generated-badges" };
12431
12441
  const _sfc_main$s = /* @__PURE__ */ defineComponent({
12432
12442
  __name: "SearchResultGeneratedBadges",
@@ -13874,7 +13884,7 @@ const _sfc_main$4$1 = /* @__PURE__ */ defineComponent({
13874
13884
  isContainer: { type: Boolean },
13875
13885
  initialData: {}
13876
13886
  },
13877
- setup(__props) {
13887
+ setup(__props, { expose: __expose }) {
13878
13888
  const props = __props;
13879
13889
  const searchResultStore = useSearchResultStore();
13880
13890
  const optionStore = useOptionsStore();
@@ -13905,12 +13915,10 @@ const _sfc_main$4$1 = /* @__PURE__ */ defineComponent({
13905
13915
  onMounted(() => {
13906
13916
  var _a, _b;
13907
13917
  window.addEventListener("resize", handleResize);
13908
- optionStore.setSearchResultOptions({ options: props.options });
13909
13918
  if (props.initialData) {
13910
13919
  searchResultStore.add(__spreadValues2({}, props.initialData));
13911
13920
  }
13912
13921
  handleMounted();
13913
- optionStore.setInitialFilters({ initialFilters: initialFilters.value });
13914
13922
  (_b = (_a = props.options.callbacks) == null ? void 0 : _a.onMounted) == null ? void 0 : _b.call(_a);
13915
13923
  mounted.value = true;
13916
13924
  });
@@ -13996,6 +14004,8 @@ const _sfc_main$4$1 = /* @__PURE__ */ defineComponent({
13996
14004
  };
13997
14005
  const handleMounted = () => {
13998
14006
  var _a;
14007
+ optionStore.setSearchResultOptions({ options: props.options });
14008
+ optionStore.setInitialFilters({ initialFilters: initialFilters.value });
13999
14009
  handleResize();
14000
14010
  if (props.isProductList) {
14001
14011
  const pageTitle = props.options.labels.htmlTitleTemplate;
@@ -14049,6 +14059,7 @@ const _sfc_main$4$1 = /* @__PURE__ */ defineComponent({
14049
14059
  }
14050
14060
  };
14051
14061
  handleCreated();
14062
+ __expose({ handleMounted, handleUrlChange });
14052
14063
  return (_ctx, _cache) => {
14053
14064
  var _a, _b, _c, _d, _e;
14054
14065
  return openBlock(), createElementBlock("div", {
@@ -26457,26 +26468,29 @@ const createVue = (selector, rootComponent, options, mountToParent = false) => {
26457
26468
  const parent = element == null ? void 0 : element.parentElement;
26458
26469
  const mountElement = mountToParent ? parent : element;
26459
26470
  if (!mountElement) {
26460
- console.error(`Cannot mount LupaSearch componbent. Element "${selector}" not found`);
26471
+ console.error(`Cannot mount LupaSearch component. Element "${selector}" not found`);
26461
26472
  return;
26462
26473
  }
26474
+ let mountedComponent = null;
26463
26475
  const props = reactive(__spreadValues({}, options));
26464
- const app2 = createApp(rootComponent, props);
26476
+ const app2 = createApp({
26477
+ render: () => mountedComponent = h$1(rootComponent, props)
26478
+ });
26465
26479
  app2.use(pinia);
26466
26480
  const mountedApp = app2.mount(mountElement);
26467
26481
  if (mountToParent) {
26468
26482
  element == null ? void 0 : element.remove();
26469
26483
  }
26470
- return mountedApp;
26484
+ return { mountedApp, mountedComponent, props };
26471
26485
  };
26472
26486
  const applySearchBox = (options, mountOptions) => {
26473
26487
  const existingInstance = app.box[options.inputSelector];
26474
26488
  if (existingInstance) {
26475
- existingInstance.searchBoxOptions = options;
26489
+ existingInstance.props.searchBoxOptions = options;
26476
26490
  if (mountOptions == null ? void 0 : mountOptions.fetch) {
26477
26491
  setTimeout(() => {
26478
- var _a;
26479
- (_a = existingInstance.fetch) == null ? void 0 : _a.call(existingInstance);
26492
+ var _a, _b, _c, _d;
26493
+ (_d = (_c = (_b = (_a = existingInstance.mountedComponent) == null ? void 0 : _a.component) == null ? void 0 : _b.exposed) == null ? void 0 : _c.fetch) == null ? void 0 : _d.call(_c);
26480
26494
  });
26481
26495
  }
26482
26496
  return;
@@ -26502,11 +26516,11 @@ const searchBox = (options, mountOptions) => {
26502
26516
  const searchResults = (options, mountOptions) => {
26503
26517
  const existingInstance = app.results[options.containerSelector];
26504
26518
  if (existingInstance) {
26505
- existingInstance.searchResultsOptions = options;
26519
+ existingInstance.props.searchResultsOptions = options;
26506
26520
  if (mountOptions == null ? void 0 : mountOptions.fetch) {
26507
26521
  setTimeout(() => {
26508
- var _a;
26509
- (_a = existingInstance.fetch) == null ? void 0 : _a.call(existingInstance);
26522
+ var _a, _b, _c, _d;
26523
+ (_d = (_c = (_b = (_a = existingInstance.mountedComponent) == null ? void 0 : _a.component) == null ? void 0 : _b.exposed) == null ? void 0 : _c.fetch) == null ? void 0 : _d.call(_c);
26510
26524
  });
26511
26525
  }
26512
26526
  return;
@@ -26522,11 +26536,11 @@ const searchResults = (options, mountOptions) => {
26522
26536
  const productList = (options, mountOptions) => {
26523
26537
  const existingInstance = app.productList[options.containerSelector];
26524
26538
  if (existingInstance) {
26525
- existingInstance.productListOptions = options;
26539
+ existingInstance.props.productListOptions = options;
26526
26540
  if (mountOptions == null ? void 0 : mountOptions.fetch) {
26527
26541
  setTimeout(() => {
26528
- var _a;
26529
- (_a = existingInstance.fetch) == null ? void 0 : _a.call(existingInstance);
26542
+ var _a, _b, _c, _d;
26543
+ (_d = (_c = (_b = (_a = existingInstance.mountedComponent) == null ? void 0 : _a.component) == null ? void 0 : _b.exposed) == null ? void 0 : _c.fetch) == null ? void 0 : _d.call(_c);
26530
26544
  });
26531
26545
  }
26532
26546
  return;
@@ -26540,16 +26554,15 @@ const productList = (options, mountOptions) => {
26540
26554
  app.productList[options.containerSelector] = instance;
26541
26555
  };
26542
26556
  const searchContainer = (options, mountOptions) => {
26543
- var _a, _b;
26557
+ var _a, _b, _c, _d, _e, _f;
26544
26558
  const existingInstance = app.searchContainer[options.trigger];
26545
26559
  if (existingInstance) {
26546
- existingInstance.searchContainerOptions.value = options;
26547
- existingInstance.reloadOptions();
26548
- console.log(existingInstance);
26560
+ existingInstance.props.searchContainerOptions = options;
26561
+ (_d = (_c = (_b = (_a = existingInstance.mountedComponent) == null ? void 0 : _a.component) == null ? void 0 : _b.exposed) == null ? void 0 : _c.reloadOptions) == null ? void 0 : _d.call(_c);
26549
26562
  if (mountOptions == null ? void 0 : mountOptions.fetch) {
26550
26563
  setTimeout(() => {
26551
- var _a2;
26552
- (_a2 = existingInstance.fetch) == null ? void 0 : _a2.call(existingInstance);
26564
+ var _a2, _b2, _c2, _d2;
26565
+ (_d2 = (_c2 = (_b2 = (_a2 = existingInstance.mountedComponent) == null ? void 0 : _a2.component) == null ? void 0 : _b2.exposed) == null ? void 0 : _c2.fetch) == null ? void 0 : _d2.call(_c2);
26553
26566
  });
26554
26567
  }
26555
26568
  return;
@@ -26560,7 +26573,7 @@ const searchContainer = (options, mountOptions) => {
26560
26573
  attatchShadowDom({
26561
26574
  host,
26562
26575
  manager,
26563
- styleUrl: (_b = (_a = options.options) == null ? void 0 : _a.styleLink) != null ? _b : DEFAULT_CONTAINER_STYLE,
26576
+ styleUrl: (_f = (_e = options.options) == null ? void 0 : _e.styleLink) != null ? _f : DEFAULT_CONTAINER_STYLE,
26564
26577
  options: options.options
26565
26578
  });
26566
26579
  document.body.appendChild(host);
@@ -26575,11 +26588,11 @@ const searchContainer = (options, mountOptions) => {
26575
26588
  const recommendations = (options, mountOptions) => {
26576
26589
  const existingInstance = app.recommendations[options.containerSelector];
26577
26590
  if (existingInstance) {
26578
- existingInstance.recommendationOptions = options;
26591
+ existingInstance.props.recommendationOptions = options;
26579
26592
  if (mountOptions == null ? void 0 : mountOptions.fetch) {
26580
26593
  setTimeout(() => {
26581
- var _a;
26582
- (_a = existingInstance.fetch) == null ? void 0 : _a.call(existingInstance);
26594
+ var _a, _b, _c, _d;
26595
+ (_d = (_c = (_b = (_a = existingInstance.mountedComponent) == null ? void 0 : _a.component) == null ? void 0 : _b.exposed) == null ? void 0 : _c.fetch) == null ? void 0 : _d.call(_c);
26583
26596
  });
26584
26597
  }
26585
26598
  return;
@@ -26682,6 +26695,8 @@ if (window) {
26682
26695
  window.lupaSearch = lupaSearch;
26683
26696
  }
26684
26697
  export {
26698
+ BadgeType,
26685
26699
  DocumentElementType,
26700
+ SearchBoxPanelType,
26686
26701
  lupaSearch as default
26687
26702
  };
@@ -6857,6 +6857,20 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
6857
6857
  DocumentElementType2["CUSTOM_HTML"] = "customHtml";
6858
6858
  return DocumentElementType2;
6859
6859
  })(DocumentElementType || {});
6860
+ var SearchBoxPanelType = /* @__PURE__ */ ((SearchBoxPanelType2) => {
6861
+ SearchBoxPanelType2["SUGGESTION"] = "suggestion";
6862
+ SearchBoxPanelType2["DOCUMENT"] = "document";
6863
+ return SearchBoxPanelType2;
6864
+ })(SearchBoxPanelType || {});
6865
+ var BadgeType = /* @__PURE__ */ ((BadgeType2) => {
6866
+ BadgeType2["DISCOUNTPERCENTAGE"] = "discountPercentage";
6867
+ BadgeType2["DISCOUNTAMOUNT"] = "discountAmount";
6868
+ BadgeType2["NEWITEM"] = "newItem";
6869
+ BadgeType2["TEXT"] = "text";
6870
+ BadgeType2["IMAGE"] = "image";
6871
+ BadgeType2["CUSTOM_HTML"] = "customHtml";
6872
+ return BadgeType2;
6873
+ })(BadgeType || {});
6860
6874
  const retrieveHistory = () => {
6861
6875
  try {
6862
6876
  const historyString = window.localStorage.getItem(HISTORY_LOCAL_STORAGE_KEY);
@@ -7446,11 +7460,6 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7446
7460
  setSearchResultsLink
7447
7461
  };
7448
7462
  });
7449
- var SearchBoxPanelType = /* @__PURE__ */ ((SearchBoxPanelType2) => {
7450
- SearchBoxPanelType2["SUGGESTION"] = "suggestion";
7451
- SearchBoxPanelType2["DOCUMENT"] = "document";
7452
- return SearchBoxPanelType2;
7453
- })(SearchBoxPanelType || {});
7454
7463
  const flattenFacet = (key, facets, suggestion, inputValue) => {
7455
7464
  return facets.map((f2) => ({
7456
7465
  displayHighlight: getHint(suggestion.suggestion, inputValue != null ? inputValue : ""),
@@ -9905,7 +9914,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
9905
9914
  props: {
9906
9915
  options: {}
9907
9916
  },
9908
- setup(__props) {
9917
+ setup(__props, { expose: __expose }) {
9909
9918
  const props = __props;
9910
9919
  const categoryChildren = ref([]);
9911
9920
  const optionStore = useOptionsStore();
@@ -9984,6 +9993,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
9984
9993
  }
9985
9994
  handleRoutingEvent(backUrlLink.value, event, hasEventRouting.value);
9986
9995
  };
9996
+ __expose({ fetch: fetch2 });
9987
9997
  return (_ctx, _cache) => {
9988
9998
  return openBlock(), createElementBlock("div", _hoisted_1$H, [
9989
9999
  createBaseVNode("div", _hoisted_2$t, [
@@ -11811,8 +11821,9 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
11811
11821
  options: {},
11812
11822
  expandable: { type: Boolean }
11813
11823
  },
11814
- setup(__props) {
11824
+ setup(__props, { expose: __expose }) {
11815
11825
  const props = __props;
11826
+ const categoryFilters = ref(null);
11816
11827
  const desktopFiltersVisible = computed(() => {
11817
11828
  var _a, _b, _c;
11818
11829
  return (_c = (_b = (_a = props.options.currentFilters) == null ? void 0 : _a.visibility) == null ? void 0 : _b.desktopSidebar) != null ? _c : true;
@@ -11824,6 +11835,13 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
11824
11835
  const showCurrentFilters = computed(() => {
11825
11836
  return currentFiltersVisible.value ? Boolean(props.options.facets) : false;
11826
11837
  });
11838
+ const fetch2 = () => {
11839
+ var _a;
11840
+ if (categoryFilters.value) {
11841
+ (_a = categoryFilters.value) == null ? void 0 : _a.fetch();
11842
+ }
11843
+ };
11844
+ __expose({ fetch: fetch2 });
11827
11845
  return (_ctx, _cache) => {
11828
11846
  var _a;
11829
11847
  return openBlock(), createElementBlock("div", _hoisted_1$z, [
@@ -11835,7 +11853,8 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
11835
11853
  _ctx.options.categories ? (openBlock(), createBlock(_sfc_main$K, {
11836
11854
  key: 1,
11837
11855
  options: _ctx.options.categories,
11838
- ref: "categoryFilters"
11856
+ ref_key: "categoryFilters",
11857
+ ref: categoryFilters
11839
11858
  }, null, 8, ["options"])) : createCommentVNode("", true),
11840
11859
  _ctx.options.facets ? (openBlock(), createBlock(_sfc_main$D, {
11841
11860
  key: 2,
@@ -12422,15 +12441,6 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
12422
12441
  };
12423
12442
  }
12424
12443
  });
12425
- var BadgeType = /* @__PURE__ */ ((BadgeType2) => {
12426
- BadgeType2["DISCOUNTPERCENTAGE"] = "discountPercentage";
12427
- BadgeType2["DISCOUNTAMOUNT"] = "discountAmount";
12428
- BadgeType2["NEWITEM"] = "newItem";
12429
- BadgeType2["TEXT"] = "text";
12430
- BadgeType2["IMAGE"] = "image";
12431
- BadgeType2["CUSTOM_HTML"] = "customHtml";
12432
- return BadgeType2;
12433
- })(BadgeType || {});
12434
12444
  const _hoisted_1$p = { class: "lupa-generated-badges" };
12435
12445
  const _sfc_main$s = /* @__PURE__ */ defineComponent({
12436
12446
  __name: "SearchResultGeneratedBadges",
@@ -13878,7 +13888,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
13878
13888
  isContainer: { type: Boolean },
13879
13889
  initialData: {}
13880
13890
  },
13881
- setup(__props) {
13891
+ setup(__props, { expose: __expose }) {
13882
13892
  const props = __props;
13883
13893
  const searchResultStore = useSearchResultStore();
13884
13894
  const optionStore = useOptionsStore();
@@ -13909,12 +13919,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
13909
13919
  onMounted(() => {
13910
13920
  var _a, _b;
13911
13921
  window.addEventListener("resize", handleResize);
13912
- optionStore.setSearchResultOptions({ options: props.options });
13913
13922
  if (props.initialData) {
13914
13923
  searchResultStore.add(__spreadValues2({}, props.initialData));
13915
13924
  }
13916
13925
  handleMounted();
13917
- optionStore.setInitialFilters({ initialFilters: initialFilters.value });
13918
13926
  (_b = (_a = props.options.callbacks) == null ? void 0 : _a.onMounted) == null ? void 0 : _b.call(_a);
13919
13927
  mounted.value = true;
13920
13928
  });
@@ -14000,6 +14008,8 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
14000
14008
  };
14001
14009
  const handleMounted = () => {
14002
14010
  var _a;
14011
+ optionStore.setSearchResultOptions({ options: props.options });
14012
+ optionStore.setInitialFilters({ initialFilters: initialFilters.value });
14003
14013
  handleResize();
14004
14014
  if (props.isProductList) {
14005
14015
  const pageTitle = props.options.labels.htmlTitleTemplate;
@@ -14053,6 +14063,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
14053
14063
  }
14054
14064
  };
14055
14065
  handleCreated();
14066
+ __expose({ handleMounted, handleUrlChange });
14056
14067
  return (_ctx, _cache) => {
14057
14068
  var _a, _b, _c, _d, _e;
14058
14069
  return openBlock(), createElementBlock("div", {
@@ -26461,26 +26472,29 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26461
26472
  const parent = element == null ? void 0 : element.parentElement;
26462
26473
  const mountElement = mountToParent ? parent : element;
26463
26474
  if (!mountElement) {
26464
- console.error(`Cannot mount LupaSearch componbent. Element "${selector}" not found`);
26475
+ console.error(`Cannot mount LupaSearch component. Element "${selector}" not found`);
26465
26476
  return;
26466
26477
  }
26478
+ let mountedComponent = null;
26467
26479
  const props = reactive(__spreadValues({}, options));
26468
- const app2 = createApp(rootComponent, props);
26480
+ const app2 = createApp({
26481
+ render: () => mountedComponent = h$1(rootComponent, props)
26482
+ });
26469
26483
  app2.use(pinia);
26470
26484
  const mountedApp = app2.mount(mountElement);
26471
26485
  if (mountToParent) {
26472
26486
  element == null ? void 0 : element.remove();
26473
26487
  }
26474
- return mountedApp;
26488
+ return { mountedApp, mountedComponent, props };
26475
26489
  };
26476
26490
  const applySearchBox = (options, mountOptions) => {
26477
26491
  const existingInstance = app.box[options.inputSelector];
26478
26492
  if (existingInstance) {
26479
- existingInstance.searchBoxOptions = options;
26493
+ existingInstance.props.searchBoxOptions = options;
26480
26494
  if (mountOptions == null ? void 0 : mountOptions.fetch) {
26481
26495
  setTimeout(() => {
26482
- var _a;
26483
- (_a = existingInstance.fetch) == null ? void 0 : _a.call(existingInstance);
26496
+ var _a, _b, _c, _d;
26497
+ (_d = (_c = (_b = (_a = existingInstance.mountedComponent) == null ? void 0 : _a.component) == null ? void 0 : _b.exposed) == null ? void 0 : _c.fetch) == null ? void 0 : _d.call(_c);
26484
26498
  });
26485
26499
  }
26486
26500
  return;
@@ -26506,11 +26520,11 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26506
26520
  const searchResults = (options, mountOptions) => {
26507
26521
  const existingInstance = app.results[options.containerSelector];
26508
26522
  if (existingInstance) {
26509
- existingInstance.searchResultsOptions = options;
26523
+ existingInstance.props.searchResultsOptions = options;
26510
26524
  if (mountOptions == null ? void 0 : mountOptions.fetch) {
26511
26525
  setTimeout(() => {
26512
- var _a;
26513
- (_a = existingInstance.fetch) == null ? void 0 : _a.call(existingInstance);
26526
+ var _a, _b, _c, _d;
26527
+ (_d = (_c = (_b = (_a = existingInstance.mountedComponent) == null ? void 0 : _a.component) == null ? void 0 : _b.exposed) == null ? void 0 : _c.fetch) == null ? void 0 : _d.call(_c);
26514
26528
  });
26515
26529
  }
26516
26530
  return;
@@ -26526,11 +26540,11 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26526
26540
  const productList = (options, mountOptions) => {
26527
26541
  const existingInstance = app.productList[options.containerSelector];
26528
26542
  if (existingInstance) {
26529
- existingInstance.productListOptions = options;
26543
+ existingInstance.props.productListOptions = options;
26530
26544
  if (mountOptions == null ? void 0 : mountOptions.fetch) {
26531
26545
  setTimeout(() => {
26532
- var _a;
26533
- (_a = existingInstance.fetch) == null ? void 0 : _a.call(existingInstance);
26546
+ var _a, _b, _c, _d;
26547
+ (_d = (_c = (_b = (_a = existingInstance.mountedComponent) == null ? void 0 : _a.component) == null ? void 0 : _b.exposed) == null ? void 0 : _c.fetch) == null ? void 0 : _d.call(_c);
26534
26548
  });
26535
26549
  }
26536
26550
  return;
@@ -26544,16 +26558,15 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26544
26558
  app.productList[options.containerSelector] = instance;
26545
26559
  };
26546
26560
  const searchContainer = (options, mountOptions) => {
26547
- var _a, _b;
26561
+ var _a, _b, _c, _d, _e, _f;
26548
26562
  const existingInstance = app.searchContainer[options.trigger];
26549
26563
  if (existingInstance) {
26550
- existingInstance.searchContainerOptions.value = options;
26551
- existingInstance.reloadOptions();
26552
- console.log(existingInstance);
26564
+ existingInstance.props.searchContainerOptions = options;
26565
+ (_d = (_c = (_b = (_a = existingInstance.mountedComponent) == null ? void 0 : _a.component) == null ? void 0 : _b.exposed) == null ? void 0 : _c.reloadOptions) == null ? void 0 : _d.call(_c);
26553
26566
  if (mountOptions == null ? void 0 : mountOptions.fetch) {
26554
26567
  setTimeout(() => {
26555
- var _a2;
26556
- (_a2 = existingInstance.fetch) == null ? void 0 : _a2.call(existingInstance);
26568
+ var _a2, _b2, _c2, _d2;
26569
+ (_d2 = (_c2 = (_b2 = (_a2 = existingInstance.mountedComponent) == null ? void 0 : _a2.component) == null ? void 0 : _b2.exposed) == null ? void 0 : _c2.fetch) == null ? void 0 : _d2.call(_c2);
26557
26570
  });
26558
26571
  }
26559
26572
  return;
@@ -26564,7 +26577,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26564
26577
  attatchShadowDom({
26565
26578
  host,
26566
26579
  manager,
26567
- styleUrl: (_b = (_a = options.options) == null ? void 0 : _a.styleLink) != null ? _b : DEFAULT_CONTAINER_STYLE,
26580
+ styleUrl: (_f = (_e = options.options) == null ? void 0 : _e.styleLink) != null ? _f : DEFAULT_CONTAINER_STYLE,
26568
26581
  options: options.options
26569
26582
  });
26570
26583
  document.body.appendChild(host);
@@ -26579,11 +26592,11 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26579
26592
  const recommendations = (options, mountOptions) => {
26580
26593
  const existingInstance = app.recommendations[options.containerSelector];
26581
26594
  if (existingInstance) {
26582
- existingInstance.recommendationOptions = options;
26595
+ existingInstance.props.recommendationOptions = options;
26583
26596
  if (mountOptions == null ? void 0 : mountOptions.fetch) {
26584
26597
  setTimeout(() => {
26585
- var _a;
26586
- (_a = existingInstance.fetch) == null ? void 0 : _a.call(existingInstance);
26598
+ var _a, _b, _c, _d;
26599
+ (_d = (_c = (_b = (_a = existingInstance.mountedComponent) == null ? void 0 : _a.component) == null ? void 0 : _b.exposed) == null ? void 0 : _c.fetch) == null ? void 0 : _d.call(_c);
26587
26600
  });
26588
26601
  }
26589
26602
  return;
@@ -26685,7 +26698,9 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26685
26698
  window.getLupa = lupaSearch;
26686
26699
  window.lupaSearch = lupaSearch;
26687
26700
  }
26701
+ exports2.BadgeType = BadgeType;
26688
26702
  exports2.DocumentElementType = DocumentElementType;
26703
+ exports2.SearchBoxPanelType = SearchBoxPanelType;
26689
26704
  exports2.default = lupaSearch;
26690
26705
  Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
26691
26706
  });
@@ -1,5 +1,5 @@
1
- import type { Environment, SdkOptions, SortDirection, TrackingOptions, DocumentElement, ImageDocumentElement, TitleDocumentElement, DescriptionDocumentElement, CustomDocumentElement, PriceElement, RegularPriceDocumentElement, RatingElement, AddToCartElement, CustomHtmlElement, SingleStarRatingElement, ProductListOptions, CategoryFilterOptions, ProductRecommendationOptions, RecommendationABTestingOptions, SearchBoxOptions, SearchBoxPanelType, SearchContainerOptions, SearchContainerConfigOptions, BadgeType, SearchResultBadgeType, SearchResultBadgeElement, BadgeGenerateSeed, BadgeGenerateOptions, BadgeOptions, RoutingBehavior, SearchResultsOptions, FacetStyle, SearchResultEventCallbacks, CallbackContext, FacetFilterQuery, SearchResultsFilterOptions, ResultFacetOptions, DynamicData, AnchorPosition, SortOptions, SearchResultsSortOptions } from '@getlupa/vue';
2
- import { DocumentElementType } from '@getlupa/vue';
1
+ import type { Environment, SdkOptions, SortDirection, TrackingOptions, DocumentElement, ImageDocumentElement, TitleDocumentElement, DescriptionDocumentElement, CustomDocumentElement, PriceElement, RegularPriceDocumentElement, RatingElement, AddToCartElement, CustomHtmlElement, SingleStarRatingElement, ProductListOptions, CategoryFilterOptions, ProductRecommendationOptions, RecommendationABTestingOptions, SearchBoxOptions, SearchContainerOptions, SearchContainerConfigOptions, SearchResultBadgeElement, BadgeGenerateSeed, BadgeGenerateOptions, BadgeOptions, RoutingBehavior, SearchResultsOptions, FacetStyle, SearchResultEventCallbacks, CallbackContext, FacetFilterQuery, SearchResultsFilterOptions, ResultFacetOptions, DynamicData, AnchorPosition, SortOptions, SearchResultsSortOptions } from '@getlupa/vue';
2
+ import { DocumentElementType, SearchBoxPanelType, BadgeType, SearchResultBadgeType } from '@getlupa/vue';
3
3
  type MountOptions = {
4
4
  fetch: boolean;
5
5
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getlupa/client",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "main": "dist/lupaSearch.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/src/index.d.ts",
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "devDependencies": {
22
22
  "@getlupa/client-sdk": "^1.3.1",
23
- "@getlupa/vue": "0.1.1",
23
+ "@getlupa/vue": "0.1.6",
24
24
  "@rushstack/eslint-patch": "^1.3.2",
25
25
  "@tsconfig/node18": "^2.0.1",
26
26
  "@types/jsdom": "^21.1.1",