@getlupa/client 1.1.2 → 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.
- package/dist/lupaSearch.iife.js +139 -121
- package/dist/lupaSearch.js +139 -121
- package/dist/lupaSearch.mjs +139 -121
- package/dist/lupaSearch.umd.js +139 -121
- package/dist/src/index.d.ts +2 -2
- package/package.json +2 -2
package/dist/lupaSearch.iife.js
CHANGED
|
@@ -6855,6 +6855,20 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
6855
6855
|
DocumentElementType2["CUSTOM_HTML"] = "customHtml";
|
|
6856
6856
|
return DocumentElementType2;
|
|
6857
6857
|
})(DocumentElementType || {});
|
|
6858
|
+
var SearchBoxPanelType = /* @__PURE__ */ ((SearchBoxPanelType2) => {
|
|
6859
|
+
SearchBoxPanelType2["SUGGESTION"] = "suggestion";
|
|
6860
|
+
SearchBoxPanelType2["DOCUMENT"] = "document";
|
|
6861
|
+
return SearchBoxPanelType2;
|
|
6862
|
+
})(SearchBoxPanelType || {});
|
|
6863
|
+
var BadgeType = /* @__PURE__ */ ((BadgeType2) => {
|
|
6864
|
+
BadgeType2["DISCOUNTPERCENTAGE"] = "discountPercentage";
|
|
6865
|
+
BadgeType2["DISCOUNTAMOUNT"] = "discountAmount";
|
|
6866
|
+
BadgeType2["NEWITEM"] = "newItem";
|
|
6867
|
+
BadgeType2["TEXT"] = "text";
|
|
6868
|
+
BadgeType2["IMAGE"] = "image";
|
|
6869
|
+
BadgeType2["CUSTOM_HTML"] = "customHtml";
|
|
6870
|
+
return BadgeType2;
|
|
6871
|
+
})(BadgeType || {});
|
|
6858
6872
|
const retrieveHistory = () => {
|
|
6859
6873
|
try {
|
|
6860
6874
|
const historyString = window.localStorage.getItem(HISTORY_LOCAL_STORAGE_KEY);
|
|
@@ -7444,11 +7458,6 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
7444
7458
|
setSearchResultsLink
|
|
7445
7459
|
};
|
|
7446
7460
|
});
|
|
7447
|
-
var SearchBoxPanelType = /* @__PURE__ */ ((SearchBoxPanelType2) => {
|
|
7448
|
-
SearchBoxPanelType2["SUGGESTION"] = "suggestion";
|
|
7449
|
-
SearchBoxPanelType2["DOCUMENT"] = "document";
|
|
7450
|
-
return SearchBoxPanelType2;
|
|
7451
|
-
})(SearchBoxPanelType || {});
|
|
7452
7461
|
const flattenFacet = (key, facets, suggestion, inputValue) => {
|
|
7453
7462
|
return facets.map((f2) => ({
|
|
7454
7463
|
displayHighlight: getHint(suggestion.suggestion, inputValue != null ? inputValue : ""),
|
|
@@ -7636,7 +7645,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
7636
7645
|
const _hoisted_1$12 = { id: "lupa-search-box-input-container" };
|
|
7637
7646
|
const _hoisted_2$I = { class: "lupa-input-clear" };
|
|
7638
7647
|
const _hoisted_3$u = { id: "lupa-search-box-input" };
|
|
7639
|
-
const _hoisted_4$
|
|
7648
|
+
const _hoisted_4$n = ["value"];
|
|
7640
7649
|
const _hoisted_5$c = ["placeholder"];
|
|
7641
7650
|
const _hoisted_6$6 = {
|
|
7642
7651
|
key: 0,
|
|
@@ -7731,7 +7740,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
7731
7740
|
class: "lupa-hint",
|
|
7732
7741
|
value: showHint.value ? suggestedValue.value.item.suggestion : "",
|
|
7733
7742
|
disabled: ""
|
|
7734
|
-
}, null, 8, _hoisted_4$
|
|
7743
|
+
}, null, 8, _hoisted_4$n),
|
|
7735
7744
|
withDirectives(createBaseVNode("input", mergeProps({
|
|
7736
7745
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputValue.value = $event)
|
|
7737
7746
|
}, inputAttributes.value, {
|
|
@@ -7898,7 +7907,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
7898
7907
|
class: "lupa-suggestion-facet",
|
|
7899
7908
|
"data-cy": "lupa-suggestion-facet"
|
|
7900
7909
|
};
|
|
7901
|
-
const _hoisted_4$
|
|
7910
|
+
const _hoisted_4$m = {
|
|
7902
7911
|
class: "lupa-suggestion-facet-label",
|
|
7903
7912
|
"data-cy": "lupa-suggestion-facet-label"
|
|
7904
7913
|
};
|
|
@@ -7944,7 +7953,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
7944
7953
|
innerHTML: _ctx.suggestion.displayHighlight
|
|
7945
7954
|
}, null, 8, _hoisted_1$$)) : (openBlock(), createElementBlock("div", _hoisted_2$G, toDisplayString(_ctx.suggestion.display), 1)),
|
|
7946
7955
|
_ctx.suggestion.facet ? (openBlock(), createElementBlock("div", _hoisted_3$t, [
|
|
7947
|
-
createBaseVNode("span", _hoisted_4$
|
|
7956
|
+
createBaseVNode("span", _hoisted_4$m, toDisplayString(facetLabel.value), 1),
|
|
7948
7957
|
createBaseVNode("span", _hoisted_5$b, toDisplayString(_ctx.suggestion.facet.title), 1)
|
|
7949
7958
|
])) : createCommentVNode("", true)
|
|
7950
7959
|
]);
|
|
@@ -8346,7 +8355,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8346
8355
|
const _hoisted_1$U = ["innerHTML"];
|
|
8347
8356
|
const _hoisted_2$D = { key: 0 };
|
|
8348
8357
|
const _hoisted_3$s = { key: 1 };
|
|
8349
|
-
const _hoisted_4$
|
|
8358
|
+
const _hoisted_4$l = { class: "lupa-search-box-custom-label" };
|
|
8350
8359
|
const _hoisted_5$a = { class: "lupa-search-box-custom-text" };
|
|
8351
8360
|
const _sfc_main$Z = /* @__PURE__ */ defineComponent({
|
|
8352
8361
|
__name: "SearchBoxProductCustom",
|
|
@@ -8379,7 +8388,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8379
8388
|
class: [className.value, "lupa-search-box-product-custom"]
|
|
8380
8389
|
}, toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), [
|
|
8381
8390
|
!label.value ? (openBlock(), createElementBlock("div", _hoisted_2$D, toDisplayString(text.value), 1)) : (openBlock(), createElementBlock("div", _hoisted_3$s, [
|
|
8382
|
-
createBaseVNode("div", _hoisted_4$
|
|
8391
|
+
createBaseVNode("div", _hoisted_4$l, toDisplayString(label.value), 1),
|
|
8383
8392
|
createBaseVNode("div", _hoisted_5$a, toDisplayString(text.value), 1)
|
|
8384
8393
|
]))
|
|
8385
8394
|
], 16));
|
|
@@ -8775,7 +8784,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8775
8784
|
const _hoisted_1$R = ["href"];
|
|
8776
8785
|
const _hoisted_2$B = { class: "lupa-search-box-product-image-section" };
|
|
8777
8786
|
const _hoisted_3$q = { class: "lupa-search-box-product-details-section" };
|
|
8778
|
-
const _hoisted_4$
|
|
8787
|
+
const _hoisted_4$k = {
|
|
8779
8788
|
key: 0,
|
|
8780
8789
|
class: "lupa-search-box-product-add-to-cart-section"
|
|
8781
8790
|
};
|
|
@@ -8896,7 +8905,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8896
8905
|
}, null, 8, ["item", "element", "labels", "link"]);
|
|
8897
8906
|
}), 128))
|
|
8898
8907
|
]),
|
|
8899
|
-
addToCartElement.value ? (openBlock(), createElementBlock("div", _hoisted_4$
|
|
8908
|
+
addToCartElement.value ? (openBlock(), createElementBlock("div", _hoisted_4$k, [
|
|
8900
8909
|
createVNode(_sfc_main$W, {
|
|
8901
8910
|
class: "lupa-search-box-product-element",
|
|
8902
8911
|
item: _ctx.item,
|
|
@@ -9028,14 +9037,17 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
9028
9037
|
}
|
|
9029
9038
|
});
|
|
9030
9039
|
const _hoisted_1$P = {
|
|
9040
|
+
key: 0,
|
|
9041
|
+
id: "lupa-search-box-panel"
|
|
9042
|
+
};
|
|
9043
|
+
const _hoisted_2$A = {
|
|
9031
9044
|
class: "lupa-main-panel",
|
|
9032
9045
|
"data-cy": "lupa-main-panel"
|
|
9033
9046
|
};
|
|
9034
|
-
const
|
|
9035
|
-
const
|
|
9047
|
+
const _hoisted_3$p = ["data-cy"];
|
|
9048
|
+
const _hoisted_4$j = {
|
|
9036
9049
|
key: 1,
|
|
9037
|
-
id: "lupa-search-box-panel"
|
|
9038
|
-
ref: "panel"
|
|
9050
|
+
id: "lupa-search-box-panel"
|
|
9039
9051
|
};
|
|
9040
9052
|
const __default__$3 = {
|
|
9041
9053
|
components: {
|
|
@@ -9101,7 +9113,9 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
9101
9113
|
onMounted(() => {
|
|
9102
9114
|
window.addEventListener("resize", appHeight);
|
|
9103
9115
|
window.addEventListener("keydown", handleNavigation);
|
|
9104
|
-
|
|
9116
|
+
setTimeout(() => {
|
|
9117
|
+
appHeight();
|
|
9118
|
+
});
|
|
9105
9119
|
});
|
|
9106
9120
|
onBeforeUnmount(() => {
|
|
9107
9121
|
highlightChange({ action: "clear" });
|
|
@@ -9151,59 +9165,58 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
9151
9165
|
};
|
|
9152
9166
|
return (_ctx, _cache) => {
|
|
9153
9167
|
var _a;
|
|
9154
|
-
return
|
|
9155
|
-
key: 0,
|
|
9156
|
-
id: "lupa-search-box-panel",
|
|
9168
|
+
return openBlock(), createElementBlock("div", {
|
|
9157
9169
|
ref_key: "panelContainer",
|
|
9158
9170
|
ref: panelContainer
|
|
9159
9171
|
}, [
|
|
9160
|
-
|
|
9161
|
-
(
|
|
9162
|
-
|
|
9163
|
-
|
|
9164
|
-
|
|
9165
|
-
|
|
9166
|
-
|
|
9167
|
-
|
|
9168
|
-
|
|
9169
|
-
|
|
9170
|
-
|
|
9171
|
-
|
|
9172
|
-
|
|
9173
|
-
|
|
9174
|
-
|
|
9175
|
-
|
|
9176
|
-
|
|
9177
|
-
|
|
9178
|
-
|
|
9179
|
-
|
|
9180
|
-
|
|
9181
|
-
|
|
9182
|
-
|
|
9183
|
-
|
|
9184
|
-
|
|
9185
|
-
|
|
9186
|
-
|
|
9187
|
-
|
|
9188
|
-
|
|
9189
|
-
|
|
9190
|
-
|
|
9191
|
-
|
|
9192
|
-
|
|
9193
|
-
|
|
9194
|
-
|
|
9195
|
-
|
|
9196
|
-
|
|
9197
|
-
|
|
9198
|
-
|
|
9199
|
-
|
|
9200
|
-
|
|
9201
|
-
|
|
9202
|
-
|
|
9203
|
-
|
|
9204
|
-
|
|
9205
|
-
|
|
9206
|
-
|
|
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);
|
|
9207
9220
|
};
|
|
9208
9221
|
}
|
|
9209
9222
|
}));
|
|
@@ -9903,7 +9916,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
9903
9916
|
props: {
|
|
9904
9917
|
options: {}
|
|
9905
9918
|
},
|
|
9906
|
-
setup(__props) {
|
|
9919
|
+
setup(__props, { expose: __expose }) {
|
|
9907
9920
|
const props = __props;
|
|
9908
9921
|
const categoryChildren = ref([]);
|
|
9909
9922
|
const optionStore = useOptionsStore();
|
|
@@ -9982,6 +9995,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
9982
9995
|
}
|
|
9983
9996
|
handleRoutingEvent(backUrlLink.value, event, hasEventRouting.value);
|
|
9984
9997
|
};
|
|
9998
|
+
__expose({ fetch: fetch2 });
|
|
9985
9999
|
return (_ctx, _cache) => {
|
|
9986
10000
|
return openBlock(), createElementBlock("div", _hoisted_1$H, [
|
|
9987
10001
|
createBaseVNode("div", _hoisted_2$t, [
|
|
@@ -11809,8 +11823,9 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
11809
11823
|
options: {},
|
|
11810
11824
|
expandable: { type: Boolean }
|
|
11811
11825
|
},
|
|
11812
|
-
setup(__props) {
|
|
11826
|
+
setup(__props, { expose: __expose }) {
|
|
11813
11827
|
const props = __props;
|
|
11828
|
+
const categoryFilters = ref(null);
|
|
11814
11829
|
const desktopFiltersVisible = computed(() => {
|
|
11815
11830
|
var _a, _b, _c;
|
|
11816
11831
|
return (_c = (_b = (_a = props.options.currentFilters) == null ? void 0 : _a.visibility) == null ? void 0 : _b.desktopSidebar) != null ? _c : true;
|
|
@@ -11822,6 +11837,13 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
11822
11837
|
const showCurrentFilters = computed(() => {
|
|
11823
11838
|
return currentFiltersVisible.value ? Boolean(props.options.facets) : false;
|
|
11824
11839
|
});
|
|
11840
|
+
const fetch2 = () => {
|
|
11841
|
+
var _a;
|
|
11842
|
+
if (categoryFilters.value) {
|
|
11843
|
+
(_a = categoryFilters.value) == null ? void 0 : _a.fetch();
|
|
11844
|
+
}
|
|
11845
|
+
};
|
|
11846
|
+
__expose({ fetch: fetch2 });
|
|
11825
11847
|
return (_ctx, _cache) => {
|
|
11826
11848
|
var _a;
|
|
11827
11849
|
return openBlock(), createElementBlock("div", _hoisted_1$z, [
|
|
@@ -11833,7 +11855,8 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
11833
11855
|
_ctx.options.categories ? (openBlock(), createBlock(_sfc_main$K, {
|
|
11834
11856
|
key: 1,
|
|
11835
11857
|
options: _ctx.options.categories,
|
|
11836
|
-
|
|
11858
|
+
ref_key: "categoryFilters",
|
|
11859
|
+
ref: categoryFilters
|
|
11837
11860
|
}, null, 8, ["options"])) : createCommentVNode("", true),
|
|
11838
11861
|
_ctx.options.facets ? (openBlock(), createBlock(_sfc_main$D, {
|
|
11839
11862
|
key: 2,
|
|
@@ -12420,15 +12443,6 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
12420
12443
|
};
|
|
12421
12444
|
}
|
|
12422
12445
|
});
|
|
12423
|
-
var BadgeType = /* @__PURE__ */ ((BadgeType2) => {
|
|
12424
|
-
BadgeType2["DISCOUNTPERCENTAGE"] = "discountPercentage";
|
|
12425
|
-
BadgeType2["DISCOUNTAMOUNT"] = "discountAmount";
|
|
12426
|
-
BadgeType2["NEWITEM"] = "newItem";
|
|
12427
|
-
BadgeType2["TEXT"] = "text";
|
|
12428
|
-
BadgeType2["IMAGE"] = "image";
|
|
12429
|
-
BadgeType2["CUSTOM_HTML"] = "customHtml";
|
|
12430
|
-
return BadgeType2;
|
|
12431
|
-
})(BadgeType || {});
|
|
12432
12446
|
const _hoisted_1$p = { class: "lupa-generated-badges" };
|
|
12433
12447
|
const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
12434
12448
|
__name: "SearchResultGeneratedBadges",
|
|
@@ -13876,7 +13890,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
13876
13890
|
isContainer: { type: Boolean },
|
|
13877
13891
|
initialData: {}
|
|
13878
13892
|
},
|
|
13879
|
-
setup(__props) {
|
|
13893
|
+
setup(__props, { expose: __expose }) {
|
|
13880
13894
|
const props = __props;
|
|
13881
13895
|
const searchResultStore = useSearchResultStore();
|
|
13882
13896
|
const optionStore = useOptionsStore();
|
|
@@ -13907,12 +13921,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
13907
13921
|
onMounted(() => {
|
|
13908
13922
|
var _a, _b;
|
|
13909
13923
|
window.addEventListener("resize", handleResize);
|
|
13910
|
-
optionStore.setSearchResultOptions({ options: props.options });
|
|
13911
13924
|
if (props.initialData) {
|
|
13912
13925
|
searchResultStore.add(__spreadValues2({}, props.initialData));
|
|
13913
13926
|
}
|
|
13914
13927
|
handleMounted();
|
|
13915
|
-
optionStore.setInitialFilters({ initialFilters: initialFilters.value });
|
|
13916
13928
|
(_b = (_a = props.options.callbacks) == null ? void 0 : _a.onMounted) == null ? void 0 : _b.call(_a);
|
|
13917
13929
|
mounted.value = true;
|
|
13918
13930
|
});
|
|
@@ -13998,6 +14010,8 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
13998
14010
|
};
|
|
13999
14011
|
const handleMounted = () => {
|
|
14000
14012
|
var _a;
|
|
14013
|
+
optionStore.setSearchResultOptions({ options: props.options });
|
|
14014
|
+
optionStore.setInitialFilters({ initialFilters: initialFilters.value });
|
|
14001
14015
|
handleResize();
|
|
14002
14016
|
if (props.isProductList) {
|
|
14003
14017
|
const pageTitle = props.options.labels.htmlTitleTemplate;
|
|
@@ -14051,6 +14065,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
14051
14065
|
}
|
|
14052
14066
|
};
|
|
14053
14067
|
handleCreated();
|
|
14068
|
+
__expose({ handleMounted, handleUrlChange });
|
|
14054
14069
|
return (_ctx, _cache) => {
|
|
14055
14070
|
var _a, _b, _c, _d, _e;
|
|
14056
14071
|
return openBlock(), createElementBlock("div", {
|
|
@@ -26459,26 +26474,29 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
26459
26474
|
const parent = element == null ? void 0 : element.parentElement;
|
|
26460
26475
|
const mountElement = mountToParent ? parent : element;
|
|
26461
26476
|
if (!mountElement) {
|
|
26462
|
-
console.error(`Cannot mount LupaSearch
|
|
26477
|
+
console.error(`Cannot mount LupaSearch component. Element "${selector}" not found`);
|
|
26463
26478
|
return;
|
|
26464
26479
|
}
|
|
26480
|
+
let mountedComponent = null;
|
|
26465
26481
|
const props = reactive(__spreadValues({}, options));
|
|
26466
|
-
const app2 = createApp(
|
|
26482
|
+
const app2 = createApp({
|
|
26483
|
+
render: () => mountedComponent = h$1(rootComponent, props)
|
|
26484
|
+
});
|
|
26467
26485
|
app2.use(pinia);
|
|
26468
26486
|
const mountedApp = app2.mount(mountElement);
|
|
26469
26487
|
if (mountToParent) {
|
|
26470
26488
|
element == null ? void 0 : element.remove();
|
|
26471
26489
|
}
|
|
26472
|
-
return mountedApp;
|
|
26490
|
+
return { mountedApp, mountedComponent, props, app: app2, mountElement };
|
|
26473
26491
|
};
|
|
26474
26492
|
const applySearchBox = (options, mountOptions) => {
|
|
26475
26493
|
const existingInstance = app.box[options.inputSelector];
|
|
26476
26494
|
if (existingInstance) {
|
|
26477
|
-
existingInstance.searchBoxOptions = options;
|
|
26495
|
+
existingInstance.props.searchBoxOptions = options;
|
|
26478
26496
|
if (mountOptions == null ? void 0 : mountOptions.fetch) {
|
|
26479
26497
|
setTimeout(() => {
|
|
26480
|
-
var _a;
|
|
26481
|
-
(_a = existingInstance.
|
|
26498
|
+
var _a, _b, _c, _d;
|
|
26499
|
+
(_d = (_c = (_b = (_a = existingInstance.mountedComponent) == null ? void 0 : _a.component) == null ? void 0 : _b.exposed) == null ? void 0 : _c.fetch) == null ? void 0 : _d.call(_c);
|
|
26482
26500
|
});
|
|
26483
26501
|
}
|
|
26484
26502
|
return;
|
|
@@ -26504,11 +26522,11 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
26504
26522
|
const searchResults = (options, mountOptions) => {
|
|
26505
26523
|
const existingInstance = app.results[options.containerSelector];
|
|
26506
26524
|
if (existingInstance) {
|
|
26507
|
-
existingInstance.searchResultsOptions = options;
|
|
26525
|
+
existingInstance.props.searchResultsOptions = options;
|
|
26508
26526
|
if (mountOptions == null ? void 0 : mountOptions.fetch) {
|
|
26509
26527
|
setTimeout(() => {
|
|
26510
|
-
var _a;
|
|
26511
|
-
(_a = existingInstance.
|
|
26528
|
+
var _a, _b, _c, _d;
|
|
26529
|
+
(_d = (_c = (_b = (_a = existingInstance.mountedComponent) == null ? void 0 : _a.component) == null ? void 0 : _b.exposed) == null ? void 0 : _c.fetch) == null ? void 0 : _d.call(_c);
|
|
26512
26530
|
});
|
|
26513
26531
|
}
|
|
26514
26532
|
return;
|
|
@@ -26524,11 +26542,11 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
26524
26542
|
const productList = (options, mountOptions) => {
|
|
26525
26543
|
const existingInstance = app.productList[options.containerSelector];
|
|
26526
26544
|
if (existingInstance) {
|
|
26527
|
-
existingInstance.productListOptions = options;
|
|
26545
|
+
existingInstance.props.productListOptions = options;
|
|
26528
26546
|
if (mountOptions == null ? void 0 : mountOptions.fetch) {
|
|
26529
26547
|
setTimeout(() => {
|
|
26530
|
-
var _a;
|
|
26531
|
-
(_a = existingInstance.
|
|
26548
|
+
var _a, _b, _c, _d;
|
|
26549
|
+
(_d = (_c = (_b = (_a = existingInstance.mountedComponent) == null ? void 0 : _a.component) == null ? void 0 : _b.exposed) == null ? void 0 : _c.fetch) == null ? void 0 : _d.call(_c);
|
|
26532
26550
|
});
|
|
26533
26551
|
}
|
|
26534
26552
|
return;
|
|
@@ -26542,16 +26560,15 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
26542
26560
|
app.productList[options.containerSelector] = instance;
|
|
26543
26561
|
};
|
|
26544
26562
|
const searchContainer = (options, mountOptions) => {
|
|
26545
|
-
var _a, _b;
|
|
26563
|
+
var _a, _b, _c, _d, _e, _f;
|
|
26546
26564
|
const existingInstance = app.searchContainer[options.trigger];
|
|
26547
26565
|
if (existingInstance) {
|
|
26548
|
-
existingInstance.searchContainerOptions
|
|
26549
|
-
existingInstance.reloadOptions();
|
|
26550
|
-
console.log(existingInstance);
|
|
26566
|
+
existingInstance.props.searchContainerOptions = options;
|
|
26567
|
+
(_d = (_c = (_b = (_a = existingInstance.mountedComponent) == null ? void 0 : _a.component) == null ? void 0 : _b.exposed) == null ? void 0 : _c.reloadOptions) == null ? void 0 : _d.call(_c);
|
|
26551
26568
|
if (mountOptions == null ? void 0 : mountOptions.fetch) {
|
|
26552
26569
|
setTimeout(() => {
|
|
26553
|
-
var _a2;
|
|
26554
|
-
(_a2 = existingInstance.
|
|
26570
|
+
var _a2, _b2, _c2, _d2;
|
|
26571
|
+
(_d2 = (_c2 = (_b2 = (_a2 = existingInstance.mountedComponent) == null ? void 0 : _a2.component) == null ? void 0 : _b2.exposed) == null ? void 0 : _c2.fetch) == null ? void 0 : _d2.call(_c2);
|
|
26555
26572
|
});
|
|
26556
26573
|
}
|
|
26557
26574
|
return;
|
|
@@ -26562,7 +26579,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
26562
26579
|
attatchShadowDom({
|
|
26563
26580
|
host,
|
|
26564
26581
|
manager,
|
|
26565
|
-
styleUrl: (
|
|
26582
|
+
styleUrl: (_f = (_e = options.options) == null ? void 0 : _e.styleLink) != null ? _f : DEFAULT_CONTAINER_STYLE,
|
|
26566
26583
|
options: options.options
|
|
26567
26584
|
});
|
|
26568
26585
|
document.body.appendChild(host);
|
|
@@ -26577,11 +26594,11 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
26577
26594
|
const recommendations = (options, mountOptions) => {
|
|
26578
26595
|
const existingInstance = app.recommendations[options.containerSelector];
|
|
26579
26596
|
if (existingInstance) {
|
|
26580
|
-
existingInstance.recommendationOptions = options;
|
|
26597
|
+
existingInstance.props.recommendationOptions = options;
|
|
26581
26598
|
if (mountOptions == null ? void 0 : mountOptions.fetch) {
|
|
26582
26599
|
setTimeout(() => {
|
|
26583
|
-
var _a;
|
|
26584
|
-
(_a = existingInstance.
|
|
26600
|
+
var _a, _b, _c, _d;
|
|
26601
|
+
(_d = (_c = (_b = (_a = existingInstance.mountedComponent) == null ? void 0 : _a.component) == null ? void 0 : _b.exposed) == null ? void 0 : _c.fetch) == null ? void 0 : _d.call(_c);
|
|
26585
26602
|
});
|
|
26586
26603
|
}
|
|
26587
26604
|
return;
|
|
@@ -26594,21 +26611,20 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
26594
26611
|
}
|
|
26595
26612
|
app.recommendations[options.containerSelector] = instance;
|
|
26596
26613
|
};
|
|
26597
|
-
const clearInstance = (
|
|
26598
|
-
|
|
26599
|
-
|
|
26600
|
-
|
|
26601
|
-
|
|
26602
|
-
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;
|
|
26603
26619
|
};
|
|
26604
26620
|
const clearSearchBox = (selector) => {
|
|
26605
26621
|
try {
|
|
26606
26622
|
if (selector) {
|
|
26607
26623
|
app.box[selector] = null;
|
|
26608
|
-
clearInstance(selector);
|
|
26624
|
+
clearInstance(app.box[selector].mountElement, app.box[selector].app);
|
|
26609
26625
|
}
|
|
26610
26626
|
for (const key in app.box) {
|
|
26611
|
-
clearInstance(key);
|
|
26627
|
+
clearInstance(app.box[key].mountElement, app.box[key].app);
|
|
26612
26628
|
}
|
|
26613
26629
|
app.box = {};
|
|
26614
26630
|
} catch (e) {
|
|
@@ -26618,10 +26634,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
26618
26634
|
try {
|
|
26619
26635
|
if (selector) {
|
|
26620
26636
|
app.results[selector] = null;
|
|
26621
|
-
clearInstance(selector);
|
|
26637
|
+
clearInstance(app.results[selector].mountElement, app.results[selector].app);
|
|
26622
26638
|
}
|
|
26623
26639
|
for (const key in app.results) {
|
|
26624
|
-
clearInstance(key);
|
|
26640
|
+
clearInstance(app.results[key].mountElement, app.results[key].app);
|
|
26625
26641
|
}
|
|
26626
26642
|
app.results = {};
|
|
26627
26643
|
} catch (e) {
|
|
@@ -26631,10 +26647,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
26631
26647
|
try {
|
|
26632
26648
|
if (selector) {
|
|
26633
26649
|
app.productList[selector] = null;
|
|
26634
|
-
clearInstance(selector);
|
|
26650
|
+
clearInstance(app.productList[selector].mountElement, app.productList[selector].app);
|
|
26635
26651
|
}
|
|
26636
26652
|
for (const key in app.productList) {
|
|
26637
|
-
clearInstance(key);
|
|
26653
|
+
clearInstance(app.productList[key].mountElement, app.productList[key].app);
|
|
26638
26654
|
}
|
|
26639
26655
|
app.productList = {};
|
|
26640
26656
|
} catch (e) {
|
|
@@ -26644,10 +26660,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
26644
26660
|
try {
|
|
26645
26661
|
if (selector) {
|
|
26646
26662
|
app.searchContainer[selector] = null;
|
|
26647
|
-
clearInstance(selector);
|
|
26663
|
+
clearInstance(app.searchContainer[selector].mountElement, app.searchContainer[selector].app);
|
|
26648
26664
|
}
|
|
26649
26665
|
for (const key in app.searchContainer) {
|
|
26650
|
-
clearInstance(key);
|
|
26666
|
+
clearInstance(app.searchContainer[key].mountElement, app.searchContainer[key].app);
|
|
26651
26667
|
}
|
|
26652
26668
|
app.searchContainer = {};
|
|
26653
26669
|
} catch (e) {
|
|
@@ -26657,10 +26673,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
26657
26673
|
try {
|
|
26658
26674
|
if (selector) {
|
|
26659
26675
|
app.recommendations[selector] = null;
|
|
26660
|
-
clearInstance(selector);
|
|
26676
|
+
clearInstance(app.recommendations[selector].mountElement, app.recommendations[selector].app);
|
|
26661
26677
|
}
|
|
26662
26678
|
for (const key in app.recommendations) {
|
|
26663
|
-
clearInstance(key);
|
|
26679
|
+
clearInstance(app.recommendations[key].mountElement, app.recommendations[key].app);
|
|
26664
26680
|
}
|
|
26665
26681
|
app.recommendations = {};
|
|
26666
26682
|
} catch (e) {
|
|
@@ -26683,7 +26699,9 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
26683
26699
|
window.getLupa = lupaSearch;
|
|
26684
26700
|
window.lupaSearch = lupaSearch;
|
|
26685
26701
|
}
|
|
26702
|
+
exports.BadgeType = BadgeType;
|
|
26686
26703
|
exports.DocumentElementType = DocumentElementType;
|
|
26704
|
+
exports.SearchBoxPanelType = SearchBoxPanelType;
|
|
26687
26705
|
exports.default = lupaSearch;
|
|
26688
26706
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
26689
26707
|
return exports;
|