@getlupa/client 1.1.3 → 1.1.4

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
  }));
@@ -26483,7 +26487,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26483
26487
  if (mountToParent) {
26484
26488
  element == null ? void 0 : element.remove();
26485
26489
  }
26486
- return { mountedApp, mountedComponent, props };
26490
+ return { mountedApp, mountedComponent, props, app: app2, mountElement };
26487
26491
  };
26488
26492
  const applySearchBox = (options, mountOptions) => {
26489
26493
  const existingInstance = app.box[options.inputSelector];
@@ -26607,21 +26611,20 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26607
26611
  }
26608
26612
  app.recommendations[options.containerSelector] = instance;
26609
26613
  };
26610
- const clearInstance = (selector) => {
26611
- const element = document.querySelector(selector);
26612
- if (!element) {
26613
- return;
26614
- }
26615
- document.body.removeChild(element);
26614
+ const clearInstance = (element, app2) => {
26615
+ var _a;
26616
+ const content = element.innerHTML;
26617
+ (_a = app2 == null ? void 0 : app2.unmount) == null ? void 0 : _a.call(app2);
26618
+ element.innerHTML = content;
26616
26619
  };
26617
26620
  const clearSearchBox = (selector) => {
26618
26621
  try {
26619
26622
  if (selector) {
26620
26623
  app.box[selector] = null;
26621
- clearInstance(selector);
26624
+ clearInstance(app.box[selector].mountElement, app.box[selector].app);
26622
26625
  }
26623
26626
  for (const key in app.box) {
26624
- clearInstance(key);
26627
+ clearInstance(app.box[key].mountElement, app.box[key].app);
26625
26628
  }
26626
26629
  app.box = {};
26627
26630
  } catch (e) {
@@ -26631,10 +26634,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26631
26634
  try {
26632
26635
  if (selector) {
26633
26636
  app.results[selector] = null;
26634
- clearInstance(selector);
26637
+ clearInstance(app.results[selector].mountElement, app.results[selector].app);
26635
26638
  }
26636
26639
  for (const key in app.results) {
26637
- clearInstance(key);
26640
+ clearInstance(app.results[key].mountElement, app.results[key].app);
26638
26641
  }
26639
26642
  app.results = {};
26640
26643
  } catch (e) {
@@ -26644,10 +26647,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26644
26647
  try {
26645
26648
  if (selector) {
26646
26649
  app.productList[selector] = null;
26647
- clearInstance(selector);
26650
+ clearInstance(app.productList[selector].mountElement, app.productList[selector].app);
26648
26651
  }
26649
26652
  for (const key in app.productList) {
26650
- clearInstance(key);
26653
+ clearInstance(app.productList[key].mountElement, app.productList[key].app);
26651
26654
  }
26652
26655
  app.productList = {};
26653
26656
  } catch (e) {
@@ -26657,10 +26660,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26657
26660
  try {
26658
26661
  if (selector) {
26659
26662
  app.searchContainer[selector] = null;
26660
- clearInstance(selector);
26663
+ clearInstance(app.searchContainer[selector].mountElement, app.searchContainer[selector].app);
26661
26664
  }
26662
26665
  for (const key in app.searchContainer) {
26663
- clearInstance(key);
26666
+ clearInstance(app.searchContainer[key].mountElement, app.searchContainer[key].app);
26664
26667
  }
26665
26668
  app.searchContainer = {};
26666
26669
  } catch (e) {
@@ -26670,10 +26673,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26670
26673
  try {
26671
26674
  if (selector) {
26672
26675
  app.recommendations[selector] = null;
26673
- clearInstance(selector);
26676
+ clearInstance(app.recommendations[selector].mountElement, app.recommendations[selector].app);
26674
26677
  }
26675
26678
  for (const key in app.recommendations) {
26676
- clearInstance(key);
26679
+ clearInstance(app.recommendations[key].mountElement, app.recommendations[key].app);
26677
26680
  }
26678
26681
  app.recommendations = {};
26679
26682
  } 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
  }));
@@ -26483,7 +26487,7 @@ const createVue = (selector, rootComponent, options, mountToParent = false) => {
26483
26487
  if (mountToParent) {
26484
26488
  element == null ? void 0 : element.remove();
26485
26489
  }
26486
- return { mountedApp, mountedComponent, props };
26490
+ return { mountedApp, mountedComponent, props, app: app2, mountElement };
26487
26491
  };
26488
26492
  const applySearchBox = (options, mountOptions) => {
26489
26493
  const existingInstance = app.box[options.inputSelector];
@@ -26607,21 +26611,20 @@ const recommendations = (options, mountOptions) => {
26607
26611
  }
26608
26612
  app.recommendations[options.containerSelector] = instance;
26609
26613
  };
26610
- const clearInstance = (selector) => {
26611
- const element = document.querySelector(selector);
26612
- if (!element) {
26613
- return;
26614
- }
26615
- document.body.removeChild(element);
26614
+ const clearInstance = (element, app2) => {
26615
+ var _a;
26616
+ const content = element.innerHTML;
26617
+ (_a = app2 == null ? void 0 : app2.unmount) == null ? void 0 : _a.call(app2);
26618
+ element.innerHTML = content;
26616
26619
  };
26617
26620
  const clearSearchBox = (selector) => {
26618
26621
  try {
26619
26622
  if (selector) {
26620
26623
  app.box[selector] = null;
26621
- clearInstance(selector);
26624
+ clearInstance(app.box[selector].mountElement, app.box[selector].app);
26622
26625
  }
26623
26626
  for (const key in app.box) {
26624
- clearInstance(key);
26627
+ clearInstance(app.box[key].mountElement, app.box[key].app);
26625
26628
  }
26626
26629
  app.box = {};
26627
26630
  } catch (e) {
@@ -26631,10 +26634,10 @@ const clearSearchResults = (selector) => {
26631
26634
  try {
26632
26635
  if (selector) {
26633
26636
  app.results[selector] = null;
26634
- clearInstance(selector);
26637
+ clearInstance(app.results[selector].mountElement, app.results[selector].app);
26635
26638
  }
26636
26639
  for (const key in app.results) {
26637
- clearInstance(key);
26640
+ clearInstance(app.results[key].mountElement, app.results[key].app);
26638
26641
  }
26639
26642
  app.results = {};
26640
26643
  } catch (e) {
@@ -26644,10 +26647,10 @@ const clearProductList = (selector) => {
26644
26647
  try {
26645
26648
  if (selector) {
26646
26649
  app.productList[selector] = null;
26647
- clearInstance(selector);
26650
+ clearInstance(app.productList[selector].mountElement, app.productList[selector].app);
26648
26651
  }
26649
26652
  for (const key in app.productList) {
26650
- clearInstance(key);
26653
+ clearInstance(app.productList[key].mountElement, app.productList[key].app);
26651
26654
  }
26652
26655
  app.productList = {};
26653
26656
  } catch (e) {
@@ -26657,10 +26660,10 @@ const clearSearchContainer = (selector) => {
26657
26660
  try {
26658
26661
  if (selector) {
26659
26662
  app.searchContainer[selector] = null;
26660
- clearInstance(selector);
26663
+ clearInstance(app.searchContainer[selector].mountElement, app.searchContainer[selector].app);
26661
26664
  }
26662
26665
  for (const key in app.searchContainer) {
26663
- clearInstance(key);
26666
+ clearInstance(app.searchContainer[key].mountElement, app.searchContainer[key].app);
26664
26667
  }
26665
26668
  app.searchContainer = {};
26666
26669
  } catch (e) {
@@ -26670,10 +26673,10 @@ const clearRecommendations = (selector) => {
26670
26673
  try {
26671
26674
  if (selector) {
26672
26675
  app.recommendations[selector] = null;
26673
- clearInstance(selector);
26676
+ clearInstance(app.recommendations[selector].mountElement, app.recommendations[selector].app);
26674
26677
  }
26675
26678
  for (const key in app.recommendations) {
26676
- clearInstance(key);
26679
+ clearInstance(app.recommendations[key].mountElement, app.recommendations[key].app);
26677
26680
  }
26678
26681
  app.recommendations = {};
26679
26682
  } 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
  }));
@@ -26481,7 +26485,7 @@ const createVue = (selector, rootComponent, options, mountToParent = false) => {
26481
26485
  if (mountToParent) {
26482
26486
  element == null ? void 0 : element.remove();
26483
26487
  }
26484
- return { mountedApp, mountedComponent, props };
26488
+ return { mountedApp, mountedComponent, props, app: app2, mountElement };
26485
26489
  };
26486
26490
  const applySearchBox = (options, mountOptions) => {
26487
26491
  const existingInstance = app.box[options.inputSelector];
@@ -26605,21 +26609,20 @@ const recommendations = (options, mountOptions) => {
26605
26609
  }
26606
26610
  app.recommendations[options.containerSelector] = instance;
26607
26611
  };
26608
- const clearInstance = (selector) => {
26609
- const element = document.querySelector(selector);
26610
- if (!element) {
26611
- return;
26612
- }
26613
- document.body.removeChild(element);
26612
+ const clearInstance = (element, app2) => {
26613
+ var _a;
26614
+ const content = element.innerHTML;
26615
+ (_a = app2 == null ? void 0 : app2.unmount) == null ? void 0 : _a.call(app2);
26616
+ element.innerHTML = content;
26614
26617
  };
26615
26618
  const clearSearchBox = (selector) => {
26616
26619
  try {
26617
26620
  if (selector) {
26618
26621
  app.box[selector] = null;
26619
- clearInstance(selector);
26622
+ clearInstance(app.box[selector].mountElement, app.box[selector].app);
26620
26623
  }
26621
26624
  for (const key in app.box) {
26622
- clearInstance(key);
26625
+ clearInstance(app.box[key].mountElement, app.box[key].app);
26623
26626
  }
26624
26627
  app.box = {};
26625
26628
  } catch (e) {
@@ -26629,10 +26632,10 @@ const clearSearchResults = (selector) => {
26629
26632
  try {
26630
26633
  if (selector) {
26631
26634
  app.results[selector] = null;
26632
- clearInstance(selector);
26635
+ clearInstance(app.results[selector].mountElement, app.results[selector].app);
26633
26636
  }
26634
26637
  for (const key in app.results) {
26635
- clearInstance(key);
26638
+ clearInstance(app.results[key].mountElement, app.results[key].app);
26636
26639
  }
26637
26640
  app.results = {};
26638
26641
  } catch (e) {
@@ -26642,10 +26645,10 @@ const clearProductList = (selector) => {
26642
26645
  try {
26643
26646
  if (selector) {
26644
26647
  app.productList[selector] = null;
26645
- clearInstance(selector);
26648
+ clearInstance(app.productList[selector].mountElement, app.productList[selector].app);
26646
26649
  }
26647
26650
  for (const key in app.productList) {
26648
- clearInstance(key);
26651
+ clearInstance(app.productList[key].mountElement, app.productList[key].app);
26649
26652
  }
26650
26653
  app.productList = {};
26651
26654
  } catch (e) {
@@ -26655,10 +26658,10 @@ const clearSearchContainer = (selector) => {
26655
26658
  try {
26656
26659
  if (selector) {
26657
26660
  app.searchContainer[selector] = null;
26658
- clearInstance(selector);
26661
+ clearInstance(app.searchContainer[selector].mountElement, app.searchContainer[selector].app);
26659
26662
  }
26660
26663
  for (const key in app.searchContainer) {
26661
- clearInstance(key);
26664
+ clearInstance(app.searchContainer[key].mountElement, app.searchContainer[key].app);
26662
26665
  }
26663
26666
  app.searchContainer = {};
26664
26667
  } catch (e) {
@@ -26668,10 +26671,10 @@ const clearRecommendations = (selector) => {
26668
26671
  try {
26669
26672
  if (selector) {
26670
26673
  app.recommendations[selector] = null;
26671
- clearInstance(selector);
26674
+ clearInstance(app.recommendations[selector].mountElement, app.recommendations[selector].app);
26672
26675
  }
26673
26676
  for (const key in app.recommendations) {
26674
- clearInstance(key);
26677
+ clearInstance(app.recommendations[key].mountElement, app.recommendations[key].app);
26675
26678
  }
26676
26679
  app.recommendations = {};
26677
26680
  } 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
  }));
@@ -26485,7 +26489,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26485
26489
  if (mountToParent) {
26486
26490
  element == null ? void 0 : element.remove();
26487
26491
  }
26488
- return { mountedApp, mountedComponent, props };
26492
+ return { mountedApp, mountedComponent, props, app: app2, mountElement };
26489
26493
  };
26490
26494
  const applySearchBox = (options, mountOptions) => {
26491
26495
  const existingInstance = app.box[options.inputSelector];
@@ -26609,21 +26613,20 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26609
26613
  }
26610
26614
  app.recommendations[options.containerSelector] = instance;
26611
26615
  };
26612
- const clearInstance = (selector) => {
26613
- const element = document.querySelector(selector);
26614
- if (!element) {
26615
- return;
26616
- }
26617
- document.body.removeChild(element);
26616
+ const clearInstance = (element, app2) => {
26617
+ var _a;
26618
+ const content = element.innerHTML;
26619
+ (_a = app2 == null ? void 0 : app2.unmount) == null ? void 0 : _a.call(app2);
26620
+ element.innerHTML = content;
26618
26621
  };
26619
26622
  const clearSearchBox = (selector) => {
26620
26623
  try {
26621
26624
  if (selector) {
26622
26625
  app.box[selector] = null;
26623
- clearInstance(selector);
26626
+ clearInstance(app.box[selector].mountElement, app.box[selector].app);
26624
26627
  }
26625
26628
  for (const key in app.box) {
26626
- clearInstance(key);
26629
+ clearInstance(app.box[key].mountElement, app.box[key].app);
26627
26630
  }
26628
26631
  app.box = {};
26629
26632
  } catch (e) {
@@ -26633,10 +26636,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26633
26636
  try {
26634
26637
  if (selector) {
26635
26638
  app.results[selector] = null;
26636
- clearInstance(selector);
26639
+ clearInstance(app.results[selector].mountElement, app.results[selector].app);
26637
26640
  }
26638
26641
  for (const key in app.results) {
26639
- clearInstance(key);
26642
+ clearInstance(app.results[key].mountElement, app.results[key].app);
26640
26643
  }
26641
26644
  app.results = {};
26642
26645
  } catch (e) {
@@ -26646,10 +26649,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26646
26649
  try {
26647
26650
  if (selector) {
26648
26651
  app.productList[selector] = null;
26649
- clearInstance(selector);
26652
+ clearInstance(app.productList[selector].mountElement, app.productList[selector].app);
26650
26653
  }
26651
26654
  for (const key in app.productList) {
26652
- clearInstance(key);
26655
+ clearInstance(app.productList[key].mountElement, app.productList[key].app);
26653
26656
  }
26654
26657
  app.productList = {};
26655
26658
  } catch (e) {
@@ -26659,10 +26662,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26659
26662
  try {
26660
26663
  if (selector) {
26661
26664
  app.searchContainer[selector] = null;
26662
- clearInstance(selector);
26665
+ clearInstance(app.searchContainer[selector].mountElement, app.searchContainer[selector].app);
26663
26666
  }
26664
26667
  for (const key in app.searchContainer) {
26665
- clearInstance(key);
26668
+ clearInstance(app.searchContainer[key].mountElement, app.searchContainer[key].app);
26666
26669
  }
26667
26670
  app.searchContainer = {};
26668
26671
  } catch (e) {
@@ -26672,10 +26675,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26672
26675
  try {
26673
26676
  if (selector) {
26674
26677
  app.recommendations[selector] = null;
26675
- clearInstance(selector);
26678
+ clearInstance(app.recommendations[selector].mountElement, app.recommendations[selector].app);
26676
26679
  }
26677
26680
  for (const key in app.recommendations) {
26678
- clearInstance(key);
26681
+ clearInstance(app.recommendations[key].mountElement, app.recommendations[key].app);
26679
26682
  }
26680
26683
  app.recommendations = {};
26681
26684
  } 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.4",
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.7",
24
24
  "@rushstack/eslint-patch": "^1.3.2",
25
25
  "@tsconfig/node18": "^2.0.1",
26
26
  "@types/jsdom": "^21.1.1",