@getlupa/client 1.1.3 → 1.1.5

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.
@@ -7645,7 +7645,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7645
7645
  const _hoisted_1$12 = { id: "lupa-search-box-input-container" };
7646
7646
  const _hoisted_2$I = { class: "lupa-input-clear" };
7647
7647
  const _hoisted_3$u = { id: "lupa-search-box-input" };
7648
- const _hoisted_4$m = ["value"];
7648
+ const _hoisted_4$n = ["value"];
7649
7649
  const _hoisted_5$c = ["placeholder"];
7650
7650
  const _hoisted_6$6 = {
7651
7651
  key: 0,
@@ -7740,7 +7740,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7740
7740
  class: "lupa-hint",
7741
7741
  value: showHint.value ? suggestedValue.value.item.suggestion : "",
7742
7742
  disabled: ""
7743
- }, null, 8, _hoisted_4$m),
7743
+ }, null, 8, _hoisted_4$n),
7744
7744
  withDirectives(createBaseVNode("input", mergeProps({
7745
7745
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputValue.value = $event)
7746
7746
  }, inputAttributes.value, {
@@ -7907,7 +7907,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7907
7907
  class: "lupa-suggestion-facet",
7908
7908
  "data-cy": "lupa-suggestion-facet"
7909
7909
  };
7910
- const _hoisted_4$l = {
7910
+ const _hoisted_4$m = {
7911
7911
  class: "lupa-suggestion-facet-label",
7912
7912
  "data-cy": "lupa-suggestion-facet-label"
7913
7913
  };
@@ -7953,7 +7953,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7953
7953
  innerHTML: _ctx.suggestion.displayHighlight
7954
7954
  }, null, 8, _hoisted_1$$)) : (openBlock(), createElementBlock("div", _hoisted_2$G, toDisplayString(_ctx.suggestion.display), 1)),
7955
7955
  _ctx.suggestion.facet ? (openBlock(), createElementBlock("div", _hoisted_3$t, [
7956
- createBaseVNode("span", _hoisted_4$l, toDisplayString(facetLabel.value), 1),
7956
+ createBaseVNode("span", _hoisted_4$m, toDisplayString(facetLabel.value), 1),
7957
7957
  createBaseVNode("span", _hoisted_5$b, toDisplayString(_ctx.suggestion.facet.title), 1)
7958
7958
  ])) : createCommentVNode("", true)
7959
7959
  ]);
@@ -8355,7 +8355,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8355
8355
  const _hoisted_1$U = ["innerHTML"];
8356
8356
  const _hoisted_2$D = { key: 0 };
8357
8357
  const _hoisted_3$s = { key: 1 };
8358
- const _hoisted_4$k = { class: "lupa-search-box-custom-label" };
8358
+ const _hoisted_4$l = { class: "lupa-search-box-custom-label" };
8359
8359
  const _hoisted_5$a = { class: "lupa-search-box-custom-text" };
8360
8360
  const _sfc_main$Z = /* @__PURE__ */ defineComponent({
8361
8361
  __name: "SearchBoxProductCustom",
@@ -8388,7 +8388,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8388
8388
  class: [className.value, "lupa-search-box-product-custom"]
8389
8389
  }, toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), [
8390
8390
  !label.value ? (openBlock(), createElementBlock("div", _hoisted_2$D, toDisplayString(text.value), 1)) : (openBlock(), createElementBlock("div", _hoisted_3$s, [
8391
- createBaseVNode("div", _hoisted_4$k, toDisplayString(label.value), 1),
8391
+ createBaseVNode("div", _hoisted_4$l, toDisplayString(label.value), 1),
8392
8392
  createBaseVNode("div", _hoisted_5$a, toDisplayString(text.value), 1)
8393
8393
  ]))
8394
8394
  ], 16));
@@ -8784,7 +8784,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8784
8784
  const _hoisted_1$R = ["href"];
8785
8785
  const _hoisted_2$B = { class: "lupa-search-box-product-image-section" };
8786
8786
  const _hoisted_3$q = { class: "lupa-search-box-product-details-section" };
8787
- const _hoisted_4$j = {
8787
+ const _hoisted_4$k = {
8788
8788
  key: 0,
8789
8789
  class: "lupa-search-box-product-add-to-cart-section"
8790
8790
  };
@@ -8905,7 +8905,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8905
8905
  }, null, 8, ["item", "element", "labels", "link"]);
8906
8906
  }), 128))
8907
8907
  ]),
8908
- addToCartElement.value ? (openBlock(), createElementBlock("div", _hoisted_4$j, [
8908
+ addToCartElement.value ? (openBlock(), createElementBlock("div", _hoisted_4$k, [
8909
8909
  createVNode(_sfc_main$W, {
8910
8910
  class: "lupa-search-box-product-element",
8911
8911
  item: _ctx.item,
@@ -9037,14 +9037,17 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
9037
9037
  }
9038
9038
  });
9039
9039
  const _hoisted_1$P = {
9040
+ key: 0,
9041
+ id: "lupa-search-box-panel"
9042
+ };
9043
+ const _hoisted_2$A = {
9040
9044
  class: "lupa-main-panel",
9041
9045
  "data-cy": "lupa-main-panel"
9042
9046
  };
9043
- const _hoisted_2$A = ["data-cy"];
9044
- const _hoisted_3$p = {
9047
+ const _hoisted_3$p = ["data-cy"];
9048
+ const _hoisted_4$j = {
9045
9049
  key: 1,
9046
- id: "lupa-search-box-panel",
9047
- ref: "panel"
9050
+ id: "lupa-search-box-panel"
9048
9051
  };
9049
9052
  const __default__$3 = {
9050
9053
  components: {
@@ -9110,7 +9113,9 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
9110
9113
  onMounted(() => {
9111
9114
  window.addEventListener("resize", appHeight);
9112
9115
  window.addEventListener("keydown", handleNavigation);
9113
- appHeight();
9116
+ setTimeout(() => {
9117
+ appHeight();
9118
+ });
9114
9119
  });
9115
9120
  onBeforeUnmount(() => {
9116
9121
  highlightChange({ action: "clear" });
@@ -9160,59 +9165,58 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
9160
9165
  };
9161
9166
  return (_ctx, _cache) => {
9162
9167
  var _a;
9163
- return displayResults.value ? (openBlock(), createElementBlock("div", {
9164
- key: 0,
9165
- id: "lupa-search-box-panel",
9168
+ return openBlock(), createElementBlock("div", {
9166
9169
  ref_key: "panelContainer",
9167
9170
  ref: panelContainer
9168
9171
  }, [
9169
- createBaseVNode("div", _hoisted_1$P, [
9170
- (openBlock(true), createElementBlock(Fragment, null, renderList(displayPanels.value, (panel, index) => {
9171
- return openBlock(), createElementBlock("div", {
9172
- key: index,
9173
- class: normalizeClass([
9174
- "lupa-panel-" + panel.type + "-index",
9175
- panel.customClassName ? panel.customClassName : ""
9176
- ]),
9177
- "data-cy": "lupa-panel-" + panel.type + "-index"
9178
- }, [
9179
- panel.queryKey ? (openBlock(), createBlock(resolveDynamicComponent(getComponent(panel.type)), {
9180
- key: 0,
9181
- panel,
9182
- options: sdkOptions.value,
9183
- debounce: _ctx.options.debounce,
9184
- inputValue: getInput(panel),
9185
- labels: labels.value,
9186
- onFetched: _cache[0] || (_cache[0] = (data) => _ctx.$emit("fetched", data)),
9187
- onItemSelect: _cache[1] || (_cache[1] = (item) => _ctx.$emit("itemSelect", item)),
9188
- onProductClick: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("product-click"))
9189
- }, createSlots({ _: 2 }, [
9190
- _ctx.$slots.productCard ? {
9191
- name: "productCard",
9192
- fn: withCtx((props2) => [
9193
- renderSlot(_ctx.$slots, "productCard", normalizeProps(guardReactiveProps(props2)))
9194
- ]),
9195
- key: "0"
9196
- } : void 0
9197
- ]), 1064, ["panel", "options", "debounce", "inputValue", "labels"])) : createCommentVNode("", true)
9198
- ], 10, _hoisted_2$A);
9199
- }), 128))
9200
- ]),
9201
- createVNode(_sfc_main$19, {
9202
- labels: labels.value,
9203
- showTotalCount: (_a = _ctx.options.showTotalCount) != null ? _a : false,
9204
- onGoToResults: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("go-to-results"))
9205
- }, null, 8, ["labels", "showTotalCount"])
9206
- ], 512)) : displayHistory.value ? (openBlock(), createElementBlock("div", _hoisted_3$p, [
9207
- createVNode(_sfc_main$17, {
9208
- ref: "panel",
9209
- options: _ctx.options.history,
9210
- history: history.value,
9211
- onGoToResults: handleGoToResults,
9212
- onRemove: remove2,
9213
- onRemoveAll: removeAll
9214
- }, null, 8, ["options", "history"])
9215
- ], 512)) : createCommentVNode("", true);
9172
+ displayResults.value ? (openBlock(), createElementBlock("div", _hoisted_1$P, [
9173
+ createBaseVNode("div", _hoisted_2$A, [
9174
+ (openBlock(true), createElementBlock(Fragment, null, renderList(displayPanels.value, (panel, index) => {
9175
+ return openBlock(), createElementBlock("div", {
9176
+ key: index,
9177
+ class: normalizeClass([
9178
+ "lupa-panel-" + panel.type + "-index",
9179
+ panel.customClassName ? panel.customClassName : ""
9180
+ ]),
9181
+ "data-cy": "lupa-panel-" + panel.type + "-index"
9182
+ }, [
9183
+ panel.queryKey ? (openBlock(), createBlock(resolveDynamicComponent(getComponent(panel.type)), {
9184
+ key: 0,
9185
+ panel,
9186
+ options: sdkOptions.value,
9187
+ debounce: _ctx.options.debounce,
9188
+ inputValue: getInput(panel),
9189
+ labels: labels.value,
9190
+ onFetched: _cache[0] || (_cache[0] = (data) => _ctx.$emit("fetched", data)),
9191
+ onItemSelect: _cache[1] || (_cache[1] = (item) => _ctx.$emit("itemSelect", item)),
9192
+ onProductClick: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("product-click"))
9193
+ }, createSlots({ _: 2 }, [
9194
+ _ctx.$slots.productCard ? {
9195
+ name: "productCard",
9196
+ fn: withCtx((props2) => [
9197
+ renderSlot(_ctx.$slots, "productCard", normalizeProps(guardReactiveProps(props2)))
9198
+ ]),
9199
+ key: "0"
9200
+ } : void 0
9201
+ ]), 1064, ["panel", "options", "debounce", "inputValue", "labels"])) : createCommentVNode("", true)
9202
+ ], 10, _hoisted_3$p);
9203
+ }), 128))
9204
+ ]),
9205
+ createVNode(_sfc_main$19, {
9206
+ labels: labels.value,
9207
+ showTotalCount: (_a = _ctx.options.showTotalCount) != null ? _a : false,
9208
+ onGoToResults: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("go-to-results"))
9209
+ }, null, 8, ["labels", "showTotalCount"])
9210
+ ])) : displayHistory.value ? (openBlock(), createElementBlock("div", _hoisted_4$j, [
9211
+ createVNode(_sfc_main$17, {
9212
+ options: _ctx.options.history,
9213
+ history: history.value,
9214
+ onGoToResults: handleGoToResults,
9215
+ onRemove: remove2,
9216
+ onRemoveAll: removeAll
9217
+ }, null, 8, ["options", "history"])
9218
+ ])) : createCommentVNode("", true)
9219
+ ], 512);
9216
9220
  };
9217
9221
  }
9218
9222
  }));
@@ -14026,7 +14030,6 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
14026
14030
  watch(searchString, () => handleParamsChange());
14027
14031
  const handleParamsChange = () => {
14028
14032
  var _a, _b;
14029
- console.log("search", searchString.value, mounted.value);
14030
14033
  if (props.initialData && !mounted.value) {
14031
14034
  return;
14032
14035
  }
@@ -26483,7 +26486,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26483
26486
  if (mountToParent) {
26484
26487
  element == null ? void 0 : element.remove();
26485
26488
  }
26486
- return { mountedApp, mountedComponent, props };
26489
+ return { mountedApp, mountedComponent, props, app: app2, mountElement };
26487
26490
  };
26488
26491
  const applySearchBox = (options, mountOptions) => {
26489
26492
  const existingInstance = app.box[options.inputSelector];
@@ -26607,21 +26610,20 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26607
26610
  }
26608
26611
  app.recommendations[options.containerSelector] = instance;
26609
26612
  };
26610
- const clearInstance = (selector) => {
26611
- const element = document.querySelector(selector);
26612
- if (!element) {
26613
- return;
26614
- }
26615
- document.body.removeChild(element);
26613
+ const clearInstance = (element, app2) => {
26614
+ var _a;
26615
+ const content = element.innerHTML;
26616
+ (_a = app2 == null ? void 0 : app2.unmount) == null ? void 0 : _a.call(app2);
26617
+ element.innerHTML = content;
26616
26618
  };
26617
26619
  const clearSearchBox = (selector) => {
26618
26620
  try {
26619
26621
  if (selector) {
26620
26622
  app.box[selector] = null;
26621
- clearInstance(selector);
26623
+ clearInstance(app.box[selector].mountElement, app.box[selector].app);
26622
26624
  }
26623
26625
  for (const key in app.box) {
26624
- clearInstance(key);
26626
+ clearInstance(app.box[key].mountElement, app.box[key].app);
26625
26627
  }
26626
26628
  app.box = {};
26627
26629
  } catch (e) {
@@ -26631,10 +26633,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26631
26633
  try {
26632
26634
  if (selector) {
26633
26635
  app.results[selector] = null;
26634
- clearInstance(selector);
26636
+ clearInstance(app.results[selector].mountElement, app.results[selector].app);
26635
26637
  }
26636
26638
  for (const key in app.results) {
26637
- clearInstance(key);
26639
+ clearInstance(app.results[key].mountElement, app.results[key].app);
26638
26640
  }
26639
26641
  app.results = {};
26640
26642
  } catch (e) {
@@ -26644,10 +26646,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26644
26646
  try {
26645
26647
  if (selector) {
26646
26648
  app.productList[selector] = null;
26647
- clearInstance(selector);
26649
+ clearInstance(app.productList[selector].mountElement, app.productList[selector].app);
26648
26650
  }
26649
26651
  for (const key in app.productList) {
26650
- clearInstance(key);
26652
+ clearInstance(app.productList[key].mountElement, app.productList[key].app);
26651
26653
  }
26652
26654
  app.productList = {};
26653
26655
  } catch (e) {
@@ -26657,10 +26659,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26657
26659
  try {
26658
26660
  if (selector) {
26659
26661
  app.searchContainer[selector] = null;
26660
- clearInstance(selector);
26662
+ clearInstance(app.searchContainer[selector].mountElement, app.searchContainer[selector].app);
26661
26663
  }
26662
26664
  for (const key in app.searchContainer) {
26663
- clearInstance(key);
26665
+ clearInstance(app.searchContainer[key].mountElement, app.searchContainer[key].app);
26664
26666
  }
26665
26667
  app.searchContainer = {};
26666
26668
  } catch (e) {
@@ -26670,10 +26672,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26670
26672
  try {
26671
26673
  if (selector) {
26672
26674
  app.recommendations[selector] = null;
26673
- clearInstance(selector);
26675
+ clearInstance(app.recommendations[selector].mountElement, app.recommendations[selector].app);
26674
26676
  }
26675
26677
  for (const key in app.recommendations) {
26676
- clearInstance(key);
26678
+ clearInstance(app.recommendations[key].mountElement, app.recommendations[key].app);
26677
26679
  }
26678
26680
  app.recommendations = {};
26679
26681
  } catch (e) {
@@ -7645,7 +7645,7 @@ const useSearchBoxStore = defineStore("searchBox", () => {
7645
7645
  const _hoisted_1$12 = { id: "lupa-search-box-input-container" };
7646
7646
  const _hoisted_2$I = { class: "lupa-input-clear" };
7647
7647
  const _hoisted_3$u = { id: "lupa-search-box-input" };
7648
- const _hoisted_4$m = ["value"];
7648
+ const _hoisted_4$n = ["value"];
7649
7649
  const _hoisted_5$c = ["placeholder"];
7650
7650
  const _hoisted_6$6 = {
7651
7651
  key: 0,
@@ -7740,7 +7740,7 @@ const _sfc_main$1a = /* @__PURE__ */ defineComponent({
7740
7740
  class: "lupa-hint",
7741
7741
  value: showHint.value ? suggestedValue.value.item.suggestion : "",
7742
7742
  disabled: ""
7743
- }, null, 8, _hoisted_4$m),
7743
+ }, null, 8, _hoisted_4$n),
7744
7744
  withDirectives(createBaseVNode("input", mergeProps({
7745
7745
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputValue.value = $event)
7746
7746
  }, inputAttributes.value, {
@@ -7907,7 +7907,7 @@ const _hoisted_3$t = {
7907
7907
  class: "lupa-suggestion-facet",
7908
7908
  "data-cy": "lupa-suggestion-facet"
7909
7909
  };
7910
- const _hoisted_4$l = {
7910
+ const _hoisted_4$m = {
7911
7911
  class: "lupa-suggestion-facet-label",
7912
7912
  "data-cy": "lupa-suggestion-facet-label"
7913
7913
  };
@@ -7953,7 +7953,7 @@ const _sfc_main$16 = /* @__PURE__ */ defineComponent({
7953
7953
  innerHTML: _ctx.suggestion.displayHighlight
7954
7954
  }, null, 8, _hoisted_1$$)) : (openBlock(), createElementBlock("div", _hoisted_2$G, toDisplayString(_ctx.suggestion.display), 1)),
7955
7955
  _ctx.suggestion.facet ? (openBlock(), createElementBlock("div", _hoisted_3$t, [
7956
- createBaseVNode("span", _hoisted_4$l, toDisplayString(facetLabel.value), 1),
7956
+ createBaseVNode("span", _hoisted_4$m, toDisplayString(facetLabel.value), 1),
7957
7957
  createBaseVNode("span", _hoisted_5$b, toDisplayString(_ctx.suggestion.facet.title), 1)
7958
7958
  ])) : createCommentVNode("", true)
7959
7959
  ]);
@@ -8355,7 +8355,7 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent({
8355
8355
  const _hoisted_1$U = ["innerHTML"];
8356
8356
  const _hoisted_2$D = { key: 0 };
8357
8357
  const _hoisted_3$s = { key: 1 };
8358
- const _hoisted_4$k = { class: "lupa-search-box-custom-label" };
8358
+ const _hoisted_4$l = { class: "lupa-search-box-custom-label" };
8359
8359
  const _hoisted_5$a = { class: "lupa-search-box-custom-text" };
8360
8360
  const _sfc_main$Z = /* @__PURE__ */ defineComponent({
8361
8361
  __name: "SearchBoxProductCustom",
@@ -8388,7 +8388,7 @@ const _sfc_main$Z = /* @__PURE__ */ defineComponent({
8388
8388
  class: [className.value, "lupa-search-box-product-custom"]
8389
8389
  }, toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), [
8390
8390
  !label.value ? (openBlock(), createElementBlock("div", _hoisted_2$D, toDisplayString(text.value), 1)) : (openBlock(), createElementBlock("div", _hoisted_3$s, [
8391
- createBaseVNode("div", _hoisted_4$k, toDisplayString(label.value), 1),
8391
+ createBaseVNode("div", _hoisted_4$l, toDisplayString(label.value), 1),
8392
8392
  createBaseVNode("div", _hoisted_5$a, toDisplayString(text.value), 1)
8393
8393
  ]))
8394
8394
  ], 16));
@@ -8784,7 +8784,7 @@ const useTrackingStore = defineStore("tracking", () => {
8784
8784
  const _hoisted_1$R = ["href"];
8785
8785
  const _hoisted_2$B = { class: "lupa-search-box-product-image-section" };
8786
8786
  const _hoisted_3$q = { class: "lupa-search-box-product-details-section" };
8787
- const _hoisted_4$j = {
8787
+ const _hoisted_4$k = {
8788
8788
  key: 0,
8789
8789
  class: "lupa-search-box-product-add-to-cart-section"
8790
8790
  };
@@ -8905,7 +8905,7 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
8905
8905
  }, null, 8, ["item", "element", "labels", "link"]);
8906
8906
  }), 128))
8907
8907
  ]),
8908
- addToCartElement.value ? (openBlock(), createElementBlock("div", _hoisted_4$j, [
8908
+ addToCartElement.value ? (openBlock(), createElementBlock("div", _hoisted_4$k, [
8909
8909
  createVNode(_sfc_main$W, {
8910
8910
  class: "lupa-search-box-product-element",
8911
8911
  item: _ctx.item,
@@ -9037,14 +9037,17 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
9037
9037
  }
9038
9038
  });
9039
9039
  const _hoisted_1$P = {
9040
+ key: 0,
9041
+ id: "lupa-search-box-panel"
9042
+ };
9043
+ const _hoisted_2$A = {
9040
9044
  class: "lupa-main-panel",
9041
9045
  "data-cy": "lupa-main-panel"
9042
9046
  };
9043
- const _hoisted_2$A = ["data-cy"];
9044
- const _hoisted_3$p = {
9047
+ const _hoisted_3$p = ["data-cy"];
9048
+ const _hoisted_4$j = {
9045
9049
  key: 1,
9046
- id: "lupa-search-box-panel",
9047
- ref: "panel"
9050
+ id: "lupa-search-box-panel"
9048
9051
  };
9049
9052
  const __default__$3 = {
9050
9053
  components: {
@@ -9110,7 +9113,9 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
9110
9113
  onMounted(() => {
9111
9114
  window.addEventListener("resize", appHeight);
9112
9115
  window.addEventListener("keydown", handleNavigation);
9113
- appHeight();
9116
+ setTimeout(() => {
9117
+ appHeight();
9118
+ });
9114
9119
  });
9115
9120
  onBeforeUnmount(() => {
9116
9121
  highlightChange({ action: "clear" });
@@ -9160,59 +9165,58 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
9160
9165
  };
9161
9166
  return (_ctx, _cache) => {
9162
9167
  var _a;
9163
- return displayResults.value ? (openBlock(), createElementBlock("div", {
9164
- key: 0,
9165
- id: "lupa-search-box-panel",
9168
+ return openBlock(), createElementBlock("div", {
9166
9169
  ref_key: "panelContainer",
9167
9170
  ref: panelContainer
9168
9171
  }, [
9169
- createBaseVNode("div", _hoisted_1$P, [
9170
- (openBlock(true), createElementBlock(Fragment, null, renderList(displayPanels.value, (panel, index) => {
9171
- return openBlock(), createElementBlock("div", {
9172
- key: index,
9173
- class: normalizeClass([
9174
- "lupa-panel-" + panel.type + "-index",
9175
- panel.customClassName ? panel.customClassName : ""
9176
- ]),
9177
- "data-cy": "lupa-panel-" + panel.type + "-index"
9178
- }, [
9179
- panel.queryKey ? (openBlock(), createBlock(resolveDynamicComponent(getComponent(panel.type)), {
9180
- key: 0,
9181
- panel,
9182
- options: sdkOptions.value,
9183
- debounce: _ctx.options.debounce,
9184
- inputValue: getInput(panel),
9185
- labels: labels.value,
9186
- onFetched: _cache[0] || (_cache[0] = (data) => _ctx.$emit("fetched", data)),
9187
- onItemSelect: _cache[1] || (_cache[1] = (item) => _ctx.$emit("itemSelect", item)),
9188
- onProductClick: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("product-click"))
9189
- }, createSlots({ _: 2 }, [
9190
- _ctx.$slots.productCard ? {
9191
- name: "productCard",
9192
- fn: withCtx((props2) => [
9193
- renderSlot(_ctx.$slots, "productCard", normalizeProps(guardReactiveProps(props2)))
9194
- ]),
9195
- key: "0"
9196
- } : void 0
9197
- ]), 1064, ["panel", "options", "debounce", "inputValue", "labels"])) : createCommentVNode("", true)
9198
- ], 10, _hoisted_2$A);
9199
- }), 128))
9200
- ]),
9201
- createVNode(_sfc_main$19, {
9202
- labels: labels.value,
9203
- showTotalCount: (_a = _ctx.options.showTotalCount) != null ? _a : false,
9204
- onGoToResults: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("go-to-results"))
9205
- }, null, 8, ["labels", "showTotalCount"])
9206
- ], 512)) : displayHistory.value ? (openBlock(), createElementBlock("div", _hoisted_3$p, [
9207
- createVNode(_sfc_main$17, {
9208
- ref: "panel",
9209
- options: _ctx.options.history,
9210
- history: history.value,
9211
- onGoToResults: handleGoToResults,
9212
- onRemove: remove2,
9213
- onRemoveAll: removeAll
9214
- }, null, 8, ["options", "history"])
9215
- ], 512)) : createCommentVNode("", true);
9172
+ displayResults.value ? (openBlock(), createElementBlock("div", _hoisted_1$P, [
9173
+ createBaseVNode("div", _hoisted_2$A, [
9174
+ (openBlock(true), createElementBlock(Fragment, null, renderList(displayPanels.value, (panel, index) => {
9175
+ return openBlock(), createElementBlock("div", {
9176
+ key: index,
9177
+ class: normalizeClass([
9178
+ "lupa-panel-" + panel.type + "-index",
9179
+ panel.customClassName ? panel.customClassName : ""
9180
+ ]),
9181
+ "data-cy": "lupa-panel-" + panel.type + "-index"
9182
+ }, [
9183
+ panel.queryKey ? (openBlock(), createBlock(resolveDynamicComponent(getComponent(panel.type)), {
9184
+ key: 0,
9185
+ panel,
9186
+ options: sdkOptions.value,
9187
+ debounce: _ctx.options.debounce,
9188
+ inputValue: getInput(panel),
9189
+ labels: labels.value,
9190
+ onFetched: _cache[0] || (_cache[0] = (data) => _ctx.$emit("fetched", data)),
9191
+ onItemSelect: _cache[1] || (_cache[1] = (item) => _ctx.$emit("itemSelect", item)),
9192
+ onProductClick: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("product-click"))
9193
+ }, createSlots({ _: 2 }, [
9194
+ _ctx.$slots.productCard ? {
9195
+ name: "productCard",
9196
+ fn: withCtx((props2) => [
9197
+ renderSlot(_ctx.$slots, "productCard", normalizeProps(guardReactiveProps(props2)))
9198
+ ]),
9199
+ key: "0"
9200
+ } : void 0
9201
+ ]), 1064, ["panel", "options", "debounce", "inputValue", "labels"])) : createCommentVNode("", true)
9202
+ ], 10, _hoisted_3$p);
9203
+ }), 128))
9204
+ ]),
9205
+ createVNode(_sfc_main$19, {
9206
+ labels: labels.value,
9207
+ showTotalCount: (_a = _ctx.options.showTotalCount) != null ? _a : false,
9208
+ onGoToResults: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("go-to-results"))
9209
+ }, null, 8, ["labels", "showTotalCount"])
9210
+ ])) : displayHistory.value ? (openBlock(), createElementBlock("div", _hoisted_4$j, [
9211
+ createVNode(_sfc_main$17, {
9212
+ options: _ctx.options.history,
9213
+ history: history.value,
9214
+ onGoToResults: handleGoToResults,
9215
+ onRemove: remove2,
9216
+ onRemoveAll: removeAll
9217
+ }, null, 8, ["options", "history"])
9218
+ ])) : createCommentVNode("", true)
9219
+ ], 512);
9216
9220
  };
9217
9221
  }
9218
9222
  }));
@@ -14026,7 +14030,6 @@ const _sfc_main$4$1 = /* @__PURE__ */ defineComponent({
14026
14030
  watch(searchString, () => handleParamsChange());
14027
14031
  const handleParamsChange = () => {
14028
14032
  var _a, _b;
14029
- console.log("search", searchString.value, mounted.value);
14030
14033
  if (props.initialData && !mounted.value) {
14031
14034
  return;
14032
14035
  }
@@ -26483,7 +26486,7 @@ const createVue = (selector, rootComponent, options, mountToParent = false) => {
26483
26486
  if (mountToParent) {
26484
26487
  element == null ? void 0 : element.remove();
26485
26488
  }
26486
- return { mountedApp, mountedComponent, props };
26489
+ return { mountedApp, mountedComponent, props, app: app2, mountElement };
26487
26490
  };
26488
26491
  const applySearchBox = (options, mountOptions) => {
26489
26492
  const existingInstance = app.box[options.inputSelector];
@@ -26607,21 +26610,20 @@ const recommendations = (options, mountOptions) => {
26607
26610
  }
26608
26611
  app.recommendations[options.containerSelector] = instance;
26609
26612
  };
26610
- const clearInstance = (selector) => {
26611
- const element = document.querySelector(selector);
26612
- if (!element) {
26613
- return;
26614
- }
26615
- document.body.removeChild(element);
26613
+ const clearInstance = (element, app2) => {
26614
+ var _a;
26615
+ const content = element.innerHTML;
26616
+ (_a = app2 == null ? void 0 : app2.unmount) == null ? void 0 : _a.call(app2);
26617
+ element.innerHTML = content;
26616
26618
  };
26617
26619
  const clearSearchBox = (selector) => {
26618
26620
  try {
26619
26621
  if (selector) {
26620
26622
  app.box[selector] = null;
26621
- clearInstance(selector);
26623
+ clearInstance(app.box[selector].mountElement, app.box[selector].app);
26622
26624
  }
26623
26625
  for (const key in app.box) {
26624
- clearInstance(key);
26626
+ clearInstance(app.box[key].mountElement, app.box[key].app);
26625
26627
  }
26626
26628
  app.box = {};
26627
26629
  } catch (e) {
@@ -26631,10 +26633,10 @@ const clearSearchResults = (selector) => {
26631
26633
  try {
26632
26634
  if (selector) {
26633
26635
  app.results[selector] = null;
26634
- clearInstance(selector);
26636
+ clearInstance(app.results[selector].mountElement, app.results[selector].app);
26635
26637
  }
26636
26638
  for (const key in app.results) {
26637
- clearInstance(key);
26639
+ clearInstance(app.results[key].mountElement, app.results[key].app);
26638
26640
  }
26639
26641
  app.results = {};
26640
26642
  } catch (e) {
@@ -26644,10 +26646,10 @@ const clearProductList = (selector) => {
26644
26646
  try {
26645
26647
  if (selector) {
26646
26648
  app.productList[selector] = null;
26647
- clearInstance(selector);
26649
+ clearInstance(app.productList[selector].mountElement, app.productList[selector].app);
26648
26650
  }
26649
26651
  for (const key in app.productList) {
26650
- clearInstance(key);
26652
+ clearInstance(app.productList[key].mountElement, app.productList[key].app);
26651
26653
  }
26652
26654
  app.productList = {};
26653
26655
  } catch (e) {
@@ -26657,10 +26659,10 @@ const clearSearchContainer = (selector) => {
26657
26659
  try {
26658
26660
  if (selector) {
26659
26661
  app.searchContainer[selector] = null;
26660
- clearInstance(selector);
26662
+ clearInstance(app.searchContainer[selector].mountElement, app.searchContainer[selector].app);
26661
26663
  }
26662
26664
  for (const key in app.searchContainer) {
26663
- clearInstance(key);
26665
+ clearInstance(app.searchContainer[key].mountElement, app.searchContainer[key].app);
26664
26666
  }
26665
26667
  app.searchContainer = {};
26666
26668
  } catch (e) {
@@ -26670,10 +26672,10 @@ const clearRecommendations = (selector) => {
26670
26672
  try {
26671
26673
  if (selector) {
26672
26674
  app.recommendations[selector] = null;
26673
- clearInstance(selector);
26675
+ clearInstance(app.recommendations[selector].mountElement, app.recommendations[selector].app);
26674
26676
  }
26675
26677
  for (const key in app.recommendations) {
26676
- clearInstance(key);
26678
+ clearInstance(app.recommendations[key].mountElement, app.recommendations[key].app);
26677
26679
  }
26678
26680
  app.recommendations = {};
26679
26681
  } catch (e) {
@@ -7643,7 +7643,7 @@ const useSearchBoxStore = defineStore("searchBox", () => {
7643
7643
  const _hoisted_1$12 = { id: "lupa-search-box-input-container" };
7644
7644
  const _hoisted_2$I = { class: "lupa-input-clear" };
7645
7645
  const _hoisted_3$u = { id: "lupa-search-box-input" };
7646
- const _hoisted_4$m = ["value"];
7646
+ const _hoisted_4$n = ["value"];
7647
7647
  const _hoisted_5$c = ["placeholder"];
7648
7648
  const _hoisted_6$6 = {
7649
7649
  key: 0,
@@ -7738,7 +7738,7 @@ const _sfc_main$1a = /* @__PURE__ */ defineComponent({
7738
7738
  class: "lupa-hint",
7739
7739
  value: showHint.value ? suggestedValue.value.item.suggestion : "",
7740
7740
  disabled: ""
7741
- }, null, 8, _hoisted_4$m),
7741
+ }, null, 8, _hoisted_4$n),
7742
7742
  withDirectives(createBaseVNode("input", mergeProps({
7743
7743
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputValue.value = $event)
7744
7744
  }, inputAttributes.value, {
@@ -7905,7 +7905,7 @@ const _hoisted_3$t = {
7905
7905
  class: "lupa-suggestion-facet",
7906
7906
  "data-cy": "lupa-suggestion-facet"
7907
7907
  };
7908
- const _hoisted_4$l = {
7908
+ const _hoisted_4$m = {
7909
7909
  class: "lupa-suggestion-facet-label",
7910
7910
  "data-cy": "lupa-suggestion-facet-label"
7911
7911
  };
@@ -7951,7 +7951,7 @@ const _sfc_main$16 = /* @__PURE__ */ defineComponent({
7951
7951
  innerHTML: _ctx.suggestion.displayHighlight
7952
7952
  }, null, 8, _hoisted_1$$)) : (openBlock(), createElementBlock("div", _hoisted_2$G, toDisplayString(_ctx.suggestion.display), 1)),
7953
7953
  _ctx.suggestion.facet ? (openBlock(), createElementBlock("div", _hoisted_3$t, [
7954
- createBaseVNode("span", _hoisted_4$l, toDisplayString(facetLabel.value), 1),
7954
+ createBaseVNode("span", _hoisted_4$m, toDisplayString(facetLabel.value), 1),
7955
7955
  createBaseVNode("span", _hoisted_5$b, toDisplayString(_ctx.suggestion.facet.title), 1)
7956
7956
  ])) : createCommentVNode("", true)
7957
7957
  ]);
@@ -8353,7 +8353,7 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent({
8353
8353
  const _hoisted_1$U = ["innerHTML"];
8354
8354
  const _hoisted_2$D = { key: 0 };
8355
8355
  const _hoisted_3$s = { key: 1 };
8356
- const _hoisted_4$k = { class: "lupa-search-box-custom-label" };
8356
+ const _hoisted_4$l = { class: "lupa-search-box-custom-label" };
8357
8357
  const _hoisted_5$a = { class: "lupa-search-box-custom-text" };
8358
8358
  const _sfc_main$Z = /* @__PURE__ */ defineComponent({
8359
8359
  __name: "SearchBoxProductCustom",
@@ -8386,7 +8386,7 @@ const _sfc_main$Z = /* @__PURE__ */ defineComponent({
8386
8386
  class: [className.value, "lupa-search-box-product-custom"]
8387
8387
  }, toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), [
8388
8388
  !label.value ? (openBlock(), createElementBlock("div", _hoisted_2$D, toDisplayString(text.value), 1)) : (openBlock(), createElementBlock("div", _hoisted_3$s, [
8389
- createBaseVNode("div", _hoisted_4$k, toDisplayString(label.value), 1),
8389
+ createBaseVNode("div", _hoisted_4$l, toDisplayString(label.value), 1),
8390
8390
  createBaseVNode("div", _hoisted_5$a, toDisplayString(text.value), 1)
8391
8391
  ]))
8392
8392
  ], 16));
@@ -8782,7 +8782,7 @@ const useTrackingStore = defineStore("tracking", () => {
8782
8782
  const _hoisted_1$R = ["href"];
8783
8783
  const _hoisted_2$B = { class: "lupa-search-box-product-image-section" };
8784
8784
  const _hoisted_3$q = { class: "lupa-search-box-product-details-section" };
8785
- const _hoisted_4$j = {
8785
+ const _hoisted_4$k = {
8786
8786
  key: 0,
8787
8787
  class: "lupa-search-box-product-add-to-cart-section"
8788
8788
  };
@@ -8903,7 +8903,7 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
8903
8903
  }, null, 8, ["item", "element", "labels", "link"]);
8904
8904
  }), 128))
8905
8905
  ]),
8906
- addToCartElement.value ? (openBlock(), createElementBlock("div", _hoisted_4$j, [
8906
+ addToCartElement.value ? (openBlock(), createElementBlock("div", _hoisted_4$k, [
8907
8907
  createVNode(_sfc_main$W, {
8908
8908
  class: "lupa-search-box-product-element",
8909
8909
  item: _ctx.item,
@@ -9035,14 +9035,17 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
9035
9035
  }
9036
9036
  });
9037
9037
  const _hoisted_1$P = {
9038
+ key: 0,
9039
+ id: "lupa-search-box-panel"
9040
+ };
9041
+ const _hoisted_2$A = {
9038
9042
  class: "lupa-main-panel",
9039
9043
  "data-cy": "lupa-main-panel"
9040
9044
  };
9041
- const _hoisted_2$A = ["data-cy"];
9042
- const _hoisted_3$p = {
9045
+ const _hoisted_3$p = ["data-cy"];
9046
+ const _hoisted_4$j = {
9043
9047
  key: 1,
9044
- id: "lupa-search-box-panel",
9045
- ref: "panel"
9048
+ id: "lupa-search-box-panel"
9046
9049
  };
9047
9050
  const __default__$3 = {
9048
9051
  components: {
@@ -9108,7 +9111,9 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
9108
9111
  onMounted(() => {
9109
9112
  window.addEventListener("resize", appHeight);
9110
9113
  window.addEventListener("keydown", handleNavigation);
9111
- appHeight();
9114
+ setTimeout(() => {
9115
+ appHeight();
9116
+ });
9112
9117
  });
9113
9118
  onBeforeUnmount(() => {
9114
9119
  highlightChange({ action: "clear" });
@@ -9158,59 +9163,58 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
9158
9163
  };
9159
9164
  return (_ctx, _cache) => {
9160
9165
  var _a;
9161
- return displayResults.value ? (openBlock(), createElementBlock("div", {
9162
- key: 0,
9163
- id: "lupa-search-box-panel",
9166
+ return openBlock(), createElementBlock("div", {
9164
9167
  ref_key: "panelContainer",
9165
9168
  ref: panelContainer
9166
9169
  }, [
9167
- createBaseVNode("div", _hoisted_1$P, [
9168
- (openBlock(true), createElementBlock(Fragment, null, renderList(displayPanels.value, (panel, index) => {
9169
- return openBlock(), createElementBlock("div", {
9170
- key: index,
9171
- class: normalizeClass([
9172
- "lupa-panel-" + panel.type + "-index",
9173
- panel.customClassName ? panel.customClassName : ""
9174
- ]),
9175
- "data-cy": "lupa-panel-" + panel.type + "-index"
9176
- }, [
9177
- panel.queryKey ? (openBlock(), createBlock(resolveDynamicComponent(getComponent(panel.type)), {
9178
- key: 0,
9179
- panel,
9180
- options: sdkOptions.value,
9181
- debounce: _ctx.options.debounce,
9182
- inputValue: getInput(panel),
9183
- labels: labels.value,
9184
- onFetched: _cache[0] || (_cache[0] = (data) => _ctx.$emit("fetched", data)),
9185
- onItemSelect: _cache[1] || (_cache[1] = (item) => _ctx.$emit("itemSelect", item)),
9186
- onProductClick: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("product-click"))
9187
- }, createSlots({ _: 2 }, [
9188
- _ctx.$slots.productCard ? {
9189
- name: "productCard",
9190
- fn: withCtx((props2) => [
9191
- renderSlot(_ctx.$slots, "productCard", normalizeProps(guardReactiveProps(props2)))
9192
- ]),
9193
- key: "0"
9194
- } : void 0
9195
- ]), 1064, ["panel", "options", "debounce", "inputValue", "labels"])) : createCommentVNode("", true)
9196
- ], 10, _hoisted_2$A);
9197
- }), 128))
9198
- ]),
9199
- createVNode(_sfc_main$19, {
9200
- labels: labels.value,
9201
- showTotalCount: (_a = _ctx.options.showTotalCount) != null ? _a : false,
9202
- onGoToResults: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("go-to-results"))
9203
- }, null, 8, ["labels", "showTotalCount"])
9204
- ], 512)) : displayHistory.value ? (openBlock(), createElementBlock("div", _hoisted_3$p, [
9205
- createVNode(_sfc_main$17, {
9206
- ref: "panel",
9207
- options: _ctx.options.history,
9208
- history: history.value,
9209
- onGoToResults: handleGoToResults,
9210
- onRemove: remove2,
9211
- onRemoveAll: removeAll
9212
- }, null, 8, ["options", "history"])
9213
- ], 512)) : createCommentVNode("", true);
9170
+ displayResults.value ? (openBlock(), createElementBlock("div", _hoisted_1$P, [
9171
+ createBaseVNode("div", _hoisted_2$A, [
9172
+ (openBlock(true), createElementBlock(Fragment, null, renderList(displayPanels.value, (panel, index) => {
9173
+ return openBlock(), createElementBlock("div", {
9174
+ key: index,
9175
+ class: normalizeClass([
9176
+ "lupa-panel-" + panel.type + "-index",
9177
+ panel.customClassName ? panel.customClassName : ""
9178
+ ]),
9179
+ "data-cy": "lupa-panel-" + panel.type + "-index"
9180
+ }, [
9181
+ panel.queryKey ? (openBlock(), createBlock(resolveDynamicComponent(getComponent(panel.type)), {
9182
+ key: 0,
9183
+ panel,
9184
+ options: sdkOptions.value,
9185
+ debounce: _ctx.options.debounce,
9186
+ inputValue: getInput(panel),
9187
+ labels: labels.value,
9188
+ onFetched: _cache[0] || (_cache[0] = (data) => _ctx.$emit("fetched", data)),
9189
+ onItemSelect: _cache[1] || (_cache[1] = (item) => _ctx.$emit("itemSelect", item)),
9190
+ onProductClick: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("product-click"))
9191
+ }, createSlots({ _: 2 }, [
9192
+ _ctx.$slots.productCard ? {
9193
+ name: "productCard",
9194
+ fn: withCtx((props2) => [
9195
+ renderSlot(_ctx.$slots, "productCard", normalizeProps(guardReactiveProps(props2)))
9196
+ ]),
9197
+ key: "0"
9198
+ } : void 0
9199
+ ]), 1064, ["panel", "options", "debounce", "inputValue", "labels"])) : createCommentVNode("", true)
9200
+ ], 10, _hoisted_3$p);
9201
+ }), 128))
9202
+ ]),
9203
+ createVNode(_sfc_main$19, {
9204
+ labels: labels.value,
9205
+ showTotalCount: (_a = _ctx.options.showTotalCount) != null ? _a : false,
9206
+ onGoToResults: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("go-to-results"))
9207
+ }, null, 8, ["labels", "showTotalCount"])
9208
+ ])) : displayHistory.value ? (openBlock(), createElementBlock("div", _hoisted_4$j, [
9209
+ createVNode(_sfc_main$17, {
9210
+ options: _ctx.options.history,
9211
+ history: history.value,
9212
+ onGoToResults: handleGoToResults,
9213
+ onRemove: remove2,
9214
+ onRemoveAll: removeAll
9215
+ }, null, 8, ["options", "history"])
9216
+ ])) : createCommentVNode("", true)
9217
+ ], 512);
9214
9218
  };
9215
9219
  }
9216
9220
  }));
@@ -14024,7 +14028,6 @@ const _sfc_main$4$1 = /* @__PURE__ */ defineComponent({
14024
14028
  watch(searchString, () => handleParamsChange());
14025
14029
  const handleParamsChange = () => {
14026
14030
  var _a, _b;
14027
- console.log("search", searchString.value, mounted.value);
14028
14031
  if (props.initialData && !mounted.value) {
14029
14032
  return;
14030
14033
  }
@@ -26481,7 +26484,7 @@ const createVue = (selector, rootComponent, options, mountToParent = false) => {
26481
26484
  if (mountToParent) {
26482
26485
  element == null ? void 0 : element.remove();
26483
26486
  }
26484
- return { mountedApp, mountedComponent, props };
26487
+ return { mountedApp, mountedComponent, props, app: app2, mountElement };
26485
26488
  };
26486
26489
  const applySearchBox = (options, mountOptions) => {
26487
26490
  const existingInstance = app.box[options.inputSelector];
@@ -26605,21 +26608,20 @@ const recommendations = (options, mountOptions) => {
26605
26608
  }
26606
26609
  app.recommendations[options.containerSelector] = instance;
26607
26610
  };
26608
- const clearInstance = (selector) => {
26609
- const element = document.querySelector(selector);
26610
- if (!element) {
26611
- return;
26612
- }
26613
- document.body.removeChild(element);
26611
+ const clearInstance = (element, app2) => {
26612
+ var _a;
26613
+ const content = element.innerHTML;
26614
+ (_a = app2 == null ? void 0 : app2.unmount) == null ? void 0 : _a.call(app2);
26615
+ element.innerHTML = content;
26614
26616
  };
26615
26617
  const clearSearchBox = (selector) => {
26616
26618
  try {
26617
26619
  if (selector) {
26618
26620
  app.box[selector] = null;
26619
- clearInstance(selector);
26621
+ clearInstance(app.box[selector].mountElement, app.box[selector].app);
26620
26622
  }
26621
26623
  for (const key in app.box) {
26622
- clearInstance(key);
26624
+ clearInstance(app.box[key].mountElement, app.box[key].app);
26623
26625
  }
26624
26626
  app.box = {};
26625
26627
  } catch (e) {
@@ -26629,10 +26631,10 @@ const clearSearchResults = (selector) => {
26629
26631
  try {
26630
26632
  if (selector) {
26631
26633
  app.results[selector] = null;
26632
- clearInstance(selector);
26634
+ clearInstance(app.results[selector].mountElement, app.results[selector].app);
26633
26635
  }
26634
26636
  for (const key in app.results) {
26635
- clearInstance(key);
26637
+ clearInstance(app.results[key].mountElement, app.results[key].app);
26636
26638
  }
26637
26639
  app.results = {};
26638
26640
  } catch (e) {
@@ -26642,10 +26644,10 @@ const clearProductList = (selector) => {
26642
26644
  try {
26643
26645
  if (selector) {
26644
26646
  app.productList[selector] = null;
26645
- clearInstance(selector);
26647
+ clearInstance(app.productList[selector].mountElement, app.productList[selector].app);
26646
26648
  }
26647
26649
  for (const key in app.productList) {
26648
- clearInstance(key);
26650
+ clearInstance(app.productList[key].mountElement, app.productList[key].app);
26649
26651
  }
26650
26652
  app.productList = {};
26651
26653
  } catch (e) {
@@ -26655,10 +26657,10 @@ const clearSearchContainer = (selector) => {
26655
26657
  try {
26656
26658
  if (selector) {
26657
26659
  app.searchContainer[selector] = null;
26658
- clearInstance(selector);
26660
+ clearInstance(app.searchContainer[selector].mountElement, app.searchContainer[selector].app);
26659
26661
  }
26660
26662
  for (const key in app.searchContainer) {
26661
- clearInstance(key);
26663
+ clearInstance(app.searchContainer[key].mountElement, app.searchContainer[key].app);
26662
26664
  }
26663
26665
  app.searchContainer = {};
26664
26666
  } catch (e) {
@@ -26668,10 +26670,10 @@ const clearRecommendations = (selector) => {
26668
26670
  try {
26669
26671
  if (selector) {
26670
26672
  app.recommendations[selector] = null;
26671
- clearInstance(selector);
26673
+ clearInstance(app.recommendations[selector].mountElement, app.recommendations[selector].app);
26672
26674
  }
26673
26675
  for (const key in app.recommendations) {
26674
- clearInstance(key);
26676
+ clearInstance(app.recommendations[key].mountElement, app.recommendations[key].app);
26675
26677
  }
26676
26678
  app.recommendations = {};
26677
26679
  } catch (e) {
@@ -7647,7 +7647,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7647
7647
  const _hoisted_1$12 = { id: "lupa-search-box-input-container" };
7648
7648
  const _hoisted_2$I = { class: "lupa-input-clear" };
7649
7649
  const _hoisted_3$u = { id: "lupa-search-box-input" };
7650
- const _hoisted_4$m = ["value"];
7650
+ const _hoisted_4$n = ["value"];
7651
7651
  const _hoisted_5$c = ["placeholder"];
7652
7652
  const _hoisted_6$6 = {
7653
7653
  key: 0,
@@ -7742,7 +7742,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7742
7742
  class: "lupa-hint",
7743
7743
  value: showHint.value ? suggestedValue.value.item.suggestion : "",
7744
7744
  disabled: ""
7745
- }, null, 8, _hoisted_4$m),
7745
+ }, null, 8, _hoisted_4$n),
7746
7746
  withDirectives(createBaseVNode("input", mergeProps({
7747
7747
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputValue.value = $event)
7748
7748
  }, inputAttributes.value, {
@@ -7909,7 +7909,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7909
7909
  class: "lupa-suggestion-facet",
7910
7910
  "data-cy": "lupa-suggestion-facet"
7911
7911
  };
7912
- const _hoisted_4$l = {
7912
+ const _hoisted_4$m = {
7913
7913
  class: "lupa-suggestion-facet-label",
7914
7914
  "data-cy": "lupa-suggestion-facet-label"
7915
7915
  };
@@ -7955,7 +7955,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7955
7955
  innerHTML: _ctx.suggestion.displayHighlight
7956
7956
  }, null, 8, _hoisted_1$$)) : (openBlock(), createElementBlock("div", _hoisted_2$G, toDisplayString(_ctx.suggestion.display), 1)),
7957
7957
  _ctx.suggestion.facet ? (openBlock(), createElementBlock("div", _hoisted_3$t, [
7958
- createBaseVNode("span", _hoisted_4$l, toDisplayString(facetLabel.value), 1),
7958
+ createBaseVNode("span", _hoisted_4$m, toDisplayString(facetLabel.value), 1),
7959
7959
  createBaseVNode("span", _hoisted_5$b, toDisplayString(_ctx.suggestion.facet.title), 1)
7960
7960
  ])) : createCommentVNode("", true)
7961
7961
  ]);
@@ -8357,7 +8357,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8357
8357
  const _hoisted_1$U = ["innerHTML"];
8358
8358
  const _hoisted_2$D = { key: 0 };
8359
8359
  const _hoisted_3$s = { key: 1 };
8360
- const _hoisted_4$k = { class: "lupa-search-box-custom-label" };
8360
+ const _hoisted_4$l = { class: "lupa-search-box-custom-label" };
8361
8361
  const _hoisted_5$a = { class: "lupa-search-box-custom-text" };
8362
8362
  const _sfc_main$Z = /* @__PURE__ */ defineComponent({
8363
8363
  __name: "SearchBoxProductCustom",
@@ -8390,7 +8390,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8390
8390
  class: [className.value, "lupa-search-box-product-custom"]
8391
8391
  }, toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), [
8392
8392
  !label.value ? (openBlock(), createElementBlock("div", _hoisted_2$D, toDisplayString(text.value), 1)) : (openBlock(), createElementBlock("div", _hoisted_3$s, [
8393
- createBaseVNode("div", _hoisted_4$k, toDisplayString(label.value), 1),
8393
+ createBaseVNode("div", _hoisted_4$l, toDisplayString(label.value), 1),
8394
8394
  createBaseVNode("div", _hoisted_5$a, toDisplayString(text.value), 1)
8395
8395
  ]))
8396
8396
  ], 16));
@@ -8786,7 +8786,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8786
8786
  const _hoisted_1$R = ["href"];
8787
8787
  const _hoisted_2$B = { class: "lupa-search-box-product-image-section" };
8788
8788
  const _hoisted_3$q = { class: "lupa-search-box-product-details-section" };
8789
- const _hoisted_4$j = {
8789
+ const _hoisted_4$k = {
8790
8790
  key: 0,
8791
8791
  class: "lupa-search-box-product-add-to-cart-section"
8792
8792
  };
@@ -8907,7 +8907,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8907
8907
  }, null, 8, ["item", "element", "labels", "link"]);
8908
8908
  }), 128))
8909
8909
  ]),
8910
- addToCartElement.value ? (openBlock(), createElementBlock("div", _hoisted_4$j, [
8910
+ addToCartElement.value ? (openBlock(), createElementBlock("div", _hoisted_4$k, [
8911
8911
  createVNode(_sfc_main$W, {
8912
8912
  class: "lupa-search-box-product-element",
8913
8913
  item: _ctx.item,
@@ -9039,14 +9039,17 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
9039
9039
  }
9040
9040
  });
9041
9041
  const _hoisted_1$P = {
9042
+ key: 0,
9043
+ id: "lupa-search-box-panel"
9044
+ };
9045
+ const _hoisted_2$A = {
9042
9046
  class: "lupa-main-panel",
9043
9047
  "data-cy": "lupa-main-panel"
9044
9048
  };
9045
- const _hoisted_2$A = ["data-cy"];
9046
- const _hoisted_3$p = {
9049
+ const _hoisted_3$p = ["data-cy"];
9050
+ const _hoisted_4$j = {
9047
9051
  key: 1,
9048
- id: "lupa-search-box-panel",
9049
- ref: "panel"
9052
+ id: "lupa-search-box-panel"
9050
9053
  };
9051
9054
  const __default__$3 = {
9052
9055
  components: {
@@ -9112,7 +9115,9 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
9112
9115
  onMounted(() => {
9113
9116
  window.addEventListener("resize", appHeight);
9114
9117
  window.addEventListener("keydown", handleNavigation);
9115
- appHeight();
9118
+ setTimeout(() => {
9119
+ appHeight();
9120
+ });
9116
9121
  });
9117
9122
  onBeforeUnmount(() => {
9118
9123
  highlightChange({ action: "clear" });
@@ -9162,59 +9167,58 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
9162
9167
  };
9163
9168
  return (_ctx, _cache) => {
9164
9169
  var _a;
9165
- return displayResults.value ? (openBlock(), createElementBlock("div", {
9166
- key: 0,
9167
- id: "lupa-search-box-panel",
9170
+ return openBlock(), createElementBlock("div", {
9168
9171
  ref_key: "panelContainer",
9169
9172
  ref: panelContainer
9170
9173
  }, [
9171
- createBaseVNode("div", _hoisted_1$P, [
9172
- (openBlock(true), createElementBlock(Fragment, null, renderList(displayPanels.value, (panel, index) => {
9173
- return openBlock(), createElementBlock("div", {
9174
- key: index,
9175
- class: normalizeClass([
9176
- "lupa-panel-" + panel.type + "-index",
9177
- panel.customClassName ? panel.customClassName : ""
9178
- ]),
9179
- "data-cy": "lupa-panel-" + panel.type + "-index"
9180
- }, [
9181
- panel.queryKey ? (openBlock(), createBlock(resolveDynamicComponent(getComponent(panel.type)), {
9182
- key: 0,
9183
- panel,
9184
- options: sdkOptions.value,
9185
- debounce: _ctx.options.debounce,
9186
- inputValue: getInput(panel),
9187
- labels: labels.value,
9188
- onFetched: _cache[0] || (_cache[0] = (data) => _ctx.$emit("fetched", data)),
9189
- onItemSelect: _cache[1] || (_cache[1] = (item) => _ctx.$emit("itemSelect", item)),
9190
- onProductClick: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("product-click"))
9191
- }, createSlots({ _: 2 }, [
9192
- _ctx.$slots.productCard ? {
9193
- name: "productCard",
9194
- fn: withCtx((props2) => [
9195
- renderSlot(_ctx.$slots, "productCard", normalizeProps(guardReactiveProps(props2)))
9196
- ]),
9197
- key: "0"
9198
- } : void 0
9199
- ]), 1064, ["panel", "options", "debounce", "inputValue", "labels"])) : createCommentVNode("", true)
9200
- ], 10, _hoisted_2$A);
9201
- }), 128))
9202
- ]),
9203
- createVNode(_sfc_main$19, {
9204
- labels: labels.value,
9205
- showTotalCount: (_a = _ctx.options.showTotalCount) != null ? _a : false,
9206
- onGoToResults: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("go-to-results"))
9207
- }, null, 8, ["labels", "showTotalCount"])
9208
- ], 512)) : displayHistory.value ? (openBlock(), createElementBlock("div", _hoisted_3$p, [
9209
- createVNode(_sfc_main$17, {
9210
- ref: "panel",
9211
- options: _ctx.options.history,
9212
- history: history.value,
9213
- onGoToResults: handleGoToResults,
9214
- onRemove: remove2,
9215
- onRemoveAll: removeAll
9216
- }, null, 8, ["options", "history"])
9217
- ], 512)) : createCommentVNode("", true);
9174
+ displayResults.value ? (openBlock(), createElementBlock("div", _hoisted_1$P, [
9175
+ createBaseVNode("div", _hoisted_2$A, [
9176
+ (openBlock(true), createElementBlock(Fragment, null, renderList(displayPanels.value, (panel, index) => {
9177
+ return openBlock(), createElementBlock("div", {
9178
+ key: index,
9179
+ class: normalizeClass([
9180
+ "lupa-panel-" + panel.type + "-index",
9181
+ panel.customClassName ? panel.customClassName : ""
9182
+ ]),
9183
+ "data-cy": "lupa-panel-" + panel.type + "-index"
9184
+ }, [
9185
+ panel.queryKey ? (openBlock(), createBlock(resolveDynamicComponent(getComponent(panel.type)), {
9186
+ key: 0,
9187
+ panel,
9188
+ options: sdkOptions.value,
9189
+ debounce: _ctx.options.debounce,
9190
+ inputValue: getInput(panel),
9191
+ labels: labels.value,
9192
+ onFetched: _cache[0] || (_cache[0] = (data) => _ctx.$emit("fetched", data)),
9193
+ onItemSelect: _cache[1] || (_cache[1] = (item) => _ctx.$emit("itemSelect", item)),
9194
+ onProductClick: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("product-click"))
9195
+ }, createSlots({ _: 2 }, [
9196
+ _ctx.$slots.productCard ? {
9197
+ name: "productCard",
9198
+ fn: withCtx((props2) => [
9199
+ renderSlot(_ctx.$slots, "productCard", normalizeProps(guardReactiveProps(props2)))
9200
+ ]),
9201
+ key: "0"
9202
+ } : void 0
9203
+ ]), 1064, ["panel", "options", "debounce", "inputValue", "labels"])) : createCommentVNode("", true)
9204
+ ], 10, _hoisted_3$p);
9205
+ }), 128))
9206
+ ]),
9207
+ createVNode(_sfc_main$19, {
9208
+ labels: labels.value,
9209
+ showTotalCount: (_a = _ctx.options.showTotalCount) != null ? _a : false,
9210
+ onGoToResults: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("go-to-results"))
9211
+ }, null, 8, ["labels", "showTotalCount"])
9212
+ ])) : displayHistory.value ? (openBlock(), createElementBlock("div", _hoisted_4$j, [
9213
+ createVNode(_sfc_main$17, {
9214
+ options: _ctx.options.history,
9215
+ history: history.value,
9216
+ onGoToResults: handleGoToResults,
9217
+ onRemove: remove2,
9218
+ onRemoveAll: removeAll
9219
+ }, null, 8, ["options", "history"])
9220
+ ])) : createCommentVNode("", true)
9221
+ ], 512);
9218
9222
  };
9219
9223
  }
9220
9224
  }));
@@ -14028,7 +14032,6 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
14028
14032
  watch(searchString, () => handleParamsChange());
14029
14033
  const handleParamsChange = () => {
14030
14034
  var _a, _b;
14031
- console.log("search", searchString.value, mounted.value);
14032
14035
  if (props.initialData && !mounted.value) {
14033
14036
  return;
14034
14037
  }
@@ -26485,7 +26488,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26485
26488
  if (mountToParent) {
26486
26489
  element == null ? void 0 : element.remove();
26487
26490
  }
26488
- return { mountedApp, mountedComponent, props };
26491
+ return { mountedApp, mountedComponent, props, app: app2, mountElement };
26489
26492
  };
26490
26493
  const applySearchBox = (options, mountOptions) => {
26491
26494
  const existingInstance = app.box[options.inputSelector];
@@ -26609,21 +26612,20 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26609
26612
  }
26610
26613
  app.recommendations[options.containerSelector] = instance;
26611
26614
  };
26612
- const clearInstance = (selector) => {
26613
- const element = document.querySelector(selector);
26614
- if (!element) {
26615
- return;
26616
- }
26617
- document.body.removeChild(element);
26615
+ const clearInstance = (element, app2) => {
26616
+ var _a;
26617
+ const content = element.innerHTML;
26618
+ (_a = app2 == null ? void 0 : app2.unmount) == null ? void 0 : _a.call(app2);
26619
+ element.innerHTML = content;
26618
26620
  };
26619
26621
  const clearSearchBox = (selector) => {
26620
26622
  try {
26621
26623
  if (selector) {
26622
26624
  app.box[selector] = null;
26623
- clearInstance(selector);
26625
+ clearInstance(app.box[selector].mountElement, app.box[selector].app);
26624
26626
  }
26625
26627
  for (const key in app.box) {
26626
- clearInstance(key);
26628
+ clearInstance(app.box[key].mountElement, app.box[key].app);
26627
26629
  }
26628
26630
  app.box = {};
26629
26631
  } catch (e) {
@@ -26633,10 +26635,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26633
26635
  try {
26634
26636
  if (selector) {
26635
26637
  app.results[selector] = null;
26636
- clearInstance(selector);
26638
+ clearInstance(app.results[selector].mountElement, app.results[selector].app);
26637
26639
  }
26638
26640
  for (const key in app.results) {
26639
- clearInstance(key);
26641
+ clearInstance(app.results[key].mountElement, app.results[key].app);
26640
26642
  }
26641
26643
  app.results = {};
26642
26644
  } catch (e) {
@@ -26646,10 +26648,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26646
26648
  try {
26647
26649
  if (selector) {
26648
26650
  app.productList[selector] = null;
26649
- clearInstance(selector);
26651
+ clearInstance(app.productList[selector].mountElement, app.productList[selector].app);
26650
26652
  }
26651
26653
  for (const key in app.productList) {
26652
- clearInstance(key);
26654
+ clearInstance(app.productList[key].mountElement, app.productList[key].app);
26653
26655
  }
26654
26656
  app.productList = {};
26655
26657
  } catch (e) {
@@ -26659,10 +26661,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26659
26661
  try {
26660
26662
  if (selector) {
26661
26663
  app.searchContainer[selector] = null;
26662
- clearInstance(selector);
26664
+ clearInstance(app.searchContainer[selector].mountElement, app.searchContainer[selector].app);
26663
26665
  }
26664
26666
  for (const key in app.searchContainer) {
26665
- clearInstance(key);
26667
+ clearInstance(app.searchContainer[key].mountElement, app.searchContainer[key].app);
26666
26668
  }
26667
26669
  app.searchContainer = {};
26668
26670
  } catch (e) {
@@ -26672,10 +26674,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26672
26674
  try {
26673
26675
  if (selector) {
26674
26676
  app.recommendations[selector] = null;
26675
- clearInstance(selector);
26677
+ clearInstance(app.recommendations[selector].mountElement, app.recommendations[selector].app);
26676
26678
  }
26677
26679
  for (const key in app.recommendations) {
26678
- clearInstance(key);
26680
+ clearInstance(app.recommendations[key].mountElement, app.recommendations[key].app);
26679
26681
  }
26680
26682
  app.recommendations = {};
26681
26683
  } catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getlupa/client",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
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.6",
23
+ "@getlupa/vue": "0.1.8",
24
24
  "@rushstack/eslint-patch": "^1.3.2",
25
25
  "@tsconfig/node18": "^2.0.1",
26
26
  "@types/jsdom": "^21.1.1",