@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.umd.js
CHANGED
|
@@ -6857,6 +6857,20 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
6857
6857
|
DocumentElementType2["CUSTOM_HTML"] = "customHtml";
|
|
6858
6858
|
return DocumentElementType2;
|
|
6859
6859
|
})(DocumentElementType || {});
|
|
6860
|
+
var SearchBoxPanelType = /* @__PURE__ */ ((SearchBoxPanelType2) => {
|
|
6861
|
+
SearchBoxPanelType2["SUGGESTION"] = "suggestion";
|
|
6862
|
+
SearchBoxPanelType2["DOCUMENT"] = "document";
|
|
6863
|
+
return SearchBoxPanelType2;
|
|
6864
|
+
})(SearchBoxPanelType || {});
|
|
6865
|
+
var BadgeType = /* @__PURE__ */ ((BadgeType2) => {
|
|
6866
|
+
BadgeType2["DISCOUNTPERCENTAGE"] = "discountPercentage";
|
|
6867
|
+
BadgeType2["DISCOUNTAMOUNT"] = "discountAmount";
|
|
6868
|
+
BadgeType2["NEWITEM"] = "newItem";
|
|
6869
|
+
BadgeType2["TEXT"] = "text";
|
|
6870
|
+
BadgeType2["IMAGE"] = "image";
|
|
6871
|
+
BadgeType2["CUSTOM_HTML"] = "customHtml";
|
|
6872
|
+
return BadgeType2;
|
|
6873
|
+
})(BadgeType || {});
|
|
6860
6874
|
const retrieveHistory = () => {
|
|
6861
6875
|
try {
|
|
6862
6876
|
const historyString = window.localStorage.getItem(HISTORY_LOCAL_STORAGE_KEY);
|
|
@@ -7446,11 +7460,6 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
7446
7460
|
setSearchResultsLink
|
|
7447
7461
|
};
|
|
7448
7462
|
});
|
|
7449
|
-
var SearchBoxPanelType = /* @__PURE__ */ ((SearchBoxPanelType2) => {
|
|
7450
|
-
SearchBoxPanelType2["SUGGESTION"] = "suggestion";
|
|
7451
|
-
SearchBoxPanelType2["DOCUMENT"] = "document";
|
|
7452
|
-
return SearchBoxPanelType2;
|
|
7453
|
-
})(SearchBoxPanelType || {});
|
|
7454
7463
|
const flattenFacet = (key, facets, suggestion, inputValue) => {
|
|
7455
7464
|
return facets.map((f2) => ({
|
|
7456
7465
|
displayHighlight: getHint(suggestion.suggestion, inputValue != null ? inputValue : ""),
|
|
@@ -7638,7 +7647,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
7638
7647
|
const _hoisted_1$12 = { id: "lupa-search-box-input-container" };
|
|
7639
7648
|
const _hoisted_2$I = { class: "lupa-input-clear" };
|
|
7640
7649
|
const _hoisted_3$u = { id: "lupa-search-box-input" };
|
|
7641
|
-
const _hoisted_4$
|
|
7650
|
+
const _hoisted_4$n = ["value"];
|
|
7642
7651
|
const _hoisted_5$c = ["placeholder"];
|
|
7643
7652
|
const _hoisted_6$6 = {
|
|
7644
7653
|
key: 0,
|
|
@@ -7733,7 +7742,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
7733
7742
|
class: "lupa-hint",
|
|
7734
7743
|
value: showHint.value ? suggestedValue.value.item.suggestion : "",
|
|
7735
7744
|
disabled: ""
|
|
7736
|
-
}, null, 8, _hoisted_4$
|
|
7745
|
+
}, null, 8, _hoisted_4$n),
|
|
7737
7746
|
withDirectives(createBaseVNode("input", mergeProps({
|
|
7738
7747
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputValue.value = $event)
|
|
7739
7748
|
}, inputAttributes.value, {
|
|
@@ -7900,7 +7909,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
7900
7909
|
class: "lupa-suggestion-facet",
|
|
7901
7910
|
"data-cy": "lupa-suggestion-facet"
|
|
7902
7911
|
};
|
|
7903
|
-
const _hoisted_4$
|
|
7912
|
+
const _hoisted_4$m = {
|
|
7904
7913
|
class: "lupa-suggestion-facet-label",
|
|
7905
7914
|
"data-cy": "lupa-suggestion-facet-label"
|
|
7906
7915
|
};
|
|
@@ -7946,7 +7955,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
7946
7955
|
innerHTML: _ctx.suggestion.displayHighlight
|
|
7947
7956
|
}, null, 8, _hoisted_1$$)) : (openBlock(), createElementBlock("div", _hoisted_2$G, toDisplayString(_ctx.suggestion.display), 1)),
|
|
7948
7957
|
_ctx.suggestion.facet ? (openBlock(), createElementBlock("div", _hoisted_3$t, [
|
|
7949
|
-
createBaseVNode("span", _hoisted_4$
|
|
7958
|
+
createBaseVNode("span", _hoisted_4$m, toDisplayString(facetLabel.value), 1),
|
|
7950
7959
|
createBaseVNode("span", _hoisted_5$b, toDisplayString(_ctx.suggestion.facet.title), 1)
|
|
7951
7960
|
])) : createCommentVNode("", true)
|
|
7952
7961
|
]);
|
|
@@ -8348,7 +8357,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8348
8357
|
const _hoisted_1$U = ["innerHTML"];
|
|
8349
8358
|
const _hoisted_2$D = { key: 0 };
|
|
8350
8359
|
const _hoisted_3$s = { key: 1 };
|
|
8351
|
-
const _hoisted_4$
|
|
8360
|
+
const _hoisted_4$l = { class: "lupa-search-box-custom-label" };
|
|
8352
8361
|
const _hoisted_5$a = { class: "lupa-search-box-custom-text" };
|
|
8353
8362
|
const _sfc_main$Z = /* @__PURE__ */ defineComponent({
|
|
8354
8363
|
__name: "SearchBoxProductCustom",
|
|
@@ -8381,7 +8390,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8381
8390
|
class: [className.value, "lupa-search-box-product-custom"]
|
|
8382
8391
|
}, toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), [
|
|
8383
8392
|
!label.value ? (openBlock(), createElementBlock("div", _hoisted_2$D, toDisplayString(text.value), 1)) : (openBlock(), createElementBlock("div", _hoisted_3$s, [
|
|
8384
|
-
createBaseVNode("div", _hoisted_4$
|
|
8393
|
+
createBaseVNode("div", _hoisted_4$l, toDisplayString(label.value), 1),
|
|
8385
8394
|
createBaseVNode("div", _hoisted_5$a, toDisplayString(text.value), 1)
|
|
8386
8395
|
]))
|
|
8387
8396
|
], 16));
|
|
@@ -8777,7 +8786,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8777
8786
|
const _hoisted_1$R = ["href"];
|
|
8778
8787
|
const _hoisted_2$B = { class: "lupa-search-box-product-image-section" };
|
|
8779
8788
|
const _hoisted_3$q = { class: "lupa-search-box-product-details-section" };
|
|
8780
|
-
const _hoisted_4$
|
|
8789
|
+
const _hoisted_4$k = {
|
|
8781
8790
|
key: 0,
|
|
8782
8791
|
class: "lupa-search-box-product-add-to-cart-section"
|
|
8783
8792
|
};
|
|
@@ -8898,7 +8907,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8898
8907
|
}, null, 8, ["item", "element", "labels", "link"]);
|
|
8899
8908
|
}), 128))
|
|
8900
8909
|
]),
|
|
8901
|
-
addToCartElement.value ? (openBlock(), createElementBlock("div", _hoisted_4$
|
|
8910
|
+
addToCartElement.value ? (openBlock(), createElementBlock("div", _hoisted_4$k, [
|
|
8902
8911
|
createVNode(_sfc_main$W, {
|
|
8903
8912
|
class: "lupa-search-box-product-element",
|
|
8904
8913
|
item: _ctx.item,
|
|
@@ -9030,14 +9039,17 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
9030
9039
|
}
|
|
9031
9040
|
});
|
|
9032
9041
|
const _hoisted_1$P = {
|
|
9042
|
+
key: 0,
|
|
9043
|
+
id: "lupa-search-box-panel"
|
|
9044
|
+
};
|
|
9045
|
+
const _hoisted_2$A = {
|
|
9033
9046
|
class: "lupa-main-panel",
|
|
9034
9047
|
"data-cy": "lupa-main-panel"
|
|
9035
9048
|
};
|
|
9036
|
-
const
|
|
9037
|
-
const
|
|
9049
|
+
const _hoisted_3$p = ["data-cy"];
|
|
9050
|
+
const _hoisted_4$j = {
|
|
9038
9051
|
key: 1,
|
|
9039
|
-
id: "lupa-search-box-panel"
|
|
9040
|
-
ref: "panel"
|
|
9052
|
+
id: "lupa-search-box-panel"
|
|
9041
9053
|
};
|
|
9042
9054
|
const __default__$3 = {
|
|
9043
9055
|
components: {
|
|
@@ -9103,7 +9115,9 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
9103
9115
|
onMounted(() => {
|
|
9104
9116
|
window.addEventListener("resize", appHeight);
|
|
9105
9117
|
window.addEventListener("keydown", handleNavigation);
|
|
9106
|
-
|
|
9118
|
+
setTimeout(() => {
|
|
9119
|
+
appHeight();
|
|
9120
|
+
});
|
|
9107
9121
|
});
|
|
9108
9122
|
onBeforeUnmount(() => {
|
|
9109
9123
|
highlightChange({ action: "clear" });
|
|
@@ -9153,59 +9167,58 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
9153
9167
|
};
|
|
9154
9168
|
return (_ctx, _cache) => {
|
|
9155
9169
|
var _a;
|
|
9156
|
-
return
|
|
9157
|
-
key: 0,
|
|
9158
|
-
id: "lupa-search-box-panel",
|
|
9170
|
+
return openBlock(), createElementBlock("div", {
|
|
9159
9171
|
ref_key: "panelContainer",
|
|
9160
9172
|
ref: panelContainer
|
|
9161
9173
|
}, [
|
|
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
|
-
|
|
9207
|
-
|
|
9208
|
-
|
|
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);
|
|
9209
9222
|
};
|
|
9210
9223
|
}
|
|
9211
9224
|
}));
|
|
@@ -9905,7 +9918,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
9905
9918
|
props: {
|
|
9906
9919
|
options: {}
|
|
9907
9920
|
},
|
|
9908
|
-
setup(__props) {
|
|
9921
|
+
setup(__props, { expose: __expose }) {
|
|
9909
9922
|
const props = __props;
|
|
9910
9923
|
const categoryChildren = ref([]);
|
|
9911
9924
|
const optionStore = useOptionsStore();
|
|
@@ -9984,6 +9997,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
9984
9997
|
}
|
|
9985
9998
|
handleRoutingEvent(backUrlLink.value, event, hasEventRouting.value);
|
|
9986
9999
|
};
|
|
10000
|
+
__expose({ fetch: fetch2 });
|
|
9987
10001
|
return (_ctx, _cache) => {
|
|
9988
10002
|
return openBlock(), createElementBlock("div", _hoisted_1$H, [
|
|
9989
10003
|
createBaseVNode("div", _hoisted_2$t, [
|
|
@@ -11811,8 +11825,9 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
11811
11825
|
options: {},
|
|
11812
11826
|
expandable: { type: Boolean }
|
|
11813
11827
|
},
|
|
11814
|
-
setup(__props) {
|
|
11828
|
+
setup(__props, { expose: __expose }) {
|
|
11815
11829
|
const props = __props;
|
|
11830
|
+
const categoryFilters = ref(null);
|
|
11816
11831
|
const desktopFiltersVisible = computed(() => {
|
|
11817
11832
|
var _a, _b, _c;
|
|
11818
11833
|
return (_c = (_b = (_a = props.options.currentFilters) == null ? void 0 : _a.visibility) == null ? void 0 : _b.desktopSidebar) != null ? _c : true;
|
|
@@ -11824,6 +11839,13 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
11824
11839
|
const showCurrentFilters = computed(() => {
|
|
11825
11840
|
return currentFiltersVisible.value ? Boolean(props.options.facets) : false;
|
|
11826
11841
|
});
|
|
11842
|
+
const fetch2 = () => {
|
|
11843
|
+
var _a;
|
|
11844
|
+
if (categoryFilters.value) {
|
|
11845
|
+
(_a = categoryFilters.value) == null ? void 0 : _a.fetch();
|
|
11846
|
+
}
|
|
11847
|
+
};
|
|
11848
|
+
__expose({ fetch: fetch2 });
|
|
11827
11849
|
return (_ctx, _cache) => {
|
|
11828
11850
|
var _a;
|
|
11829
11851
|
return openBlock(), createElementBlock("div", _hoisted_1$z, [
|
|
@@ -11835,7 +11857,8 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
11835
11857
|
_ctx.options.categories ? (openBlock(), createBlock(_sfc_main$K, {
|
|
11836
11858
|
key: 1,
|
|
11837
11859
|
options: _ctx.options.categories,
|
|
11838
|
-
|
|
11860
|
+
ref_key: "categoryFilters",
|
|
11861
|
+
ref: categoryFilters
|
|
11839
11862
|
}, null, 8, ["options"])) : createCommentVNode("", true),
|
|
11840
11863
|
_ctx.options.facets ? (openBlock(), createBlock(_sfc_main$D, {
|
|
11841
11864
|
key: 2,
|
|
@@ -12422,15 +12445,6 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
12422
12445
|
};
|
|
12423
12446
|
}
|
|
12424
12447
|
});
|
|
12425
|
-
var BadgeType = /* @__PURE__ */ ((BadgeType2) => {
|
|
12426
|
-
BadgeType2["DISCOUNTPERCENTAGE"] = "discountPercentage";
|
|
12427
|
-
BadgeType2["DISCOUNTAMOUNT"] = "discountAmount";
|
|
12428
|
-
BadgeType2["NEWITEM"] = "newItem";
|
|
12429
|
-
BadgeType2["TEXT"] = "text";
|
|
12430
|
-
BadgeType2["IMAGE"] = "image";
|
|
12431
|
-
BadgeType2["CUSTOM_HTML"] = "customHtml";
|
|
12432
|
-
return BadgeType2;
|
|
12433
|
-
})(BadgeType || {});
|
|
12434
12448
|
const _hoisted_1$p = { class: "lupa-generated-badges" };
|
|
12435
12449
|
const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
12436
12450
|
__name: "SearchResultGeneratedBadges",
|
|
@@ -13878,7 +13892,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
13878
13892
|
isContainer: { type: Boolean },
|
|
13879
13893
|
initialData: {}
|
|
13880
13894
|
},
|
|
13881
|
-
setup(__props) {
|
|
13895
|
+
setup(__props, { expose: __expose }) {
|
|
13882
13896
|
const props = __props;
|
|
13883
13897
|
const searchResultStore = useSearchResultStore();
|
|
13884
13898
|
const optionStore = useOptionsStore();
|
|
@@ -13909,12 +13923,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
13909
13923
|
onMounted(() => {
|
|
13910
13924
|
var _a, _b;
|
|
13911
13925
|
window.addEventListener("resize", handleResize);
|
|
13912
|
-
optionStore.setSearchResultOptions({ options: props.options });
|
|
13913
13926
|
if (props.initialData) {
|
|
13914
13927
|
searchResultStore.add(__spreadValues2({}, props.initialData));
|
|
13915
13928
|
}
|
|
13916
13929
|
handleMounted();
|
|
13917
|
-
optionStore.setInitialFilters({ initialFilters: initialFilters.value });
|
|
13918
13930
|
(_b = (_a = props.options.callbacks) == null ? void 0 : _a.onMounted) == null ? void 0 : _b.call(_a);
|
|
13919
13931
|
mounted.value = true;
|
|
13920
13932
|
});
|
|
@@ -14000,6 +14012,8 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
14000
14012
|
};
|
|
14001
14013
|
const handleMounted = () => {
|
|
14002
14014
|
var _a;
|
|
14015
|
+
optionStore.setSearchResultOptions({ options: props.options });
|
|
14016
|
+
optionStore.setInitialFilters({ initialFilters: initialFilters.value });
|
|
14003
14017
|
handleResize();
|
|
14004
14018
|
if (props.isProductList) {
|
|
14005
14019
|
const pageTitle = props.options.labels.htmlTitleTemplate;
|
|
@@ -14053,6 +14067,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
14053
14067
|
}
|
|
14054
14068
|
};
|
|
14055
14069
|
handleCreated();
|
|
14070
|
+
__expose({ handleMounted, handleUrlChange });
|
|
14056
14071
|
return (_ctx, _cache) => {
|
|
14057
14072
|
var _a, _b, _c, _d, _e;
|
|
14058
14073
|
return openBlock(), createElementBlock("div", {
|
|
@@ -26461,26 +26476,29 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
26461
26476
|
const parent = element == null ? void 0 : element.parentElement;
|
|
26462
26477
|
const mountElement = mountToParent ? parent : element;
|
|
26463
26478
|
if (!mountElement) {
|
|
26464
|
-
console.error(`Cannot mount LupaSearch
|
|
26479
|
+
console.error(`Cannot mount LupaSearch component. Element "${selector}" not found`);
|
|
26465
26480
|
return;
|
|
26466
26481
|
}
|
|
26482
|
+
let mountedComponent = null;
|
|
26467
26483
|
const props = reactive(__spreadValues({}, options));
|
|
26468
|
-
const app2 = createApp(
|
|
26484
|
+
const app2 = createApp({
|
|
26485
|
+
render: () => mountedComponent = h$1(rootComponent, props)
|
|
26486
|
+
});
|
|
26469
26487
|
app2.use(pinia);
|
|
26470
26488
|
const mountedApp = app2.mount(mountElement);
|
|
26471
26489
|
if (mountToParent) {
|
|
26472
26490
|
element == null ? void 0 : element.remove();
|
|
26473
26491
|
}
|
|
26474
|
-
return mountedApp;
|
|
26492
|
+
return { mountedApp, mountedComponent, props, app: app2, mountElement };
|
|
26475
26493
|
};
|
|
26476
26494
|
const applySearchBox = (options, mountOptions) => {
|
|
26477
26495
|
const existingInstance = app.box[options.inputSelector];
|
|
26478
26496
|
if (existingInstance) {
|
|
26479
|
-
existingInstance.searchBoxOptions = options;
|
|
26497
|
+
existingInstance.props.searchBoxOptions = options;
|
|
26480
26498
|
if (mountOptions == null ? void 0 : mountOptions.fetch) {
|
|
26481
26499
|
setTimeout(() => {
|
|
26482
|
-
var _a;
|
|
26483
|
-
(_a = existingInstance.
|
|
26500
|
+
var _a, _b, _c, _d;
|
|
26501
|
+
(_d = (_c = (_b = (_a = existingInstance.mountedComponent) == null ? void 0 : _a.component) == null ? void 0 : _b.exposed) == null ? void 0 : _c.fetch) == null ? void 0 : _d.call(_c);
|
|
26484
26502
|
});
|
|
26485
26503
|
}
|
|
26486
26504
|
return;
|
|
@@ -26506,11 +26524,11 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
26506
26524
|
const searchResults = (options, mountOptions) => {
|
|
26507
26525
|
const existingInstance = app.results[options.containerSelector];
|
|
26508
26526
|
if (existingInstance) {
|
|
26509
|
-
existingInstance.searchResultsOptions = options;
|
|
26527
|
+
existingInstance.props.searchResultsOptions = options;
|
|
26510
26528
|
if (mountOptions == null ? void 0 : mountOptions.fetch) {
|
|
26511
26529
|
setTimeout(() => {
|
|
26512
|
-
var _a;
|
|
26513
|
-
(_a = existingInstance.
|
|
26530
|
+
var _a, _b, _c, _d;
|
|
26531
|
+
(_d = (_c = (_b = (_a = existingInstance.mountedComponent) == null ? void 0 : _a.component) == null ? void 0 : _b.exposed) == null ? void 0 : _c.fetch) == null ? void 0 : _d.call(_c);
|
|
26514
26532
|
});
|
|
26515
26533
|
}
|
|
26516
26534
|
return;
|
|
@@ -26526,11 +26544,11 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
26526
26544
|
const productList = (options, mountOptions) => {
|
|
26527
26545
|
const existingInstance = app.productList[options.containerSelector];
|
|
26528
26546
|
if (existingInstance) {
|
|
26529
|
-
existingInstance.productListOptions = options;
|
|
26547
|
+
existingInstance.props.productListOptions = options;
|
|
26530
26548
|
if (mountOptions == null ? void 0 : mountOptions.fetch) {
|
|
26531
26549
|
setTimeout(() => {
|
|
26532
|
-
var _a;
|
|
26533
|
-
(_a = existingInstance.
|
|
26550
|
+
var _a, _b, _c, _d;
|
|
26551
|
+
(_d = (_c = (_b = (_a = existingInstance.mountedComponent) == null ? void 0 : _a.component) == null ? void 0 : _b.exposed) == null ? void 0 : _c.fetch) == null ? void 0 : _d.call(_c);
|
|
26534
26552
|
});
|
|
26535
26553
|
}
|
|
26536
26554
|
return;
|
|
@@ -26544,16 +26562,15 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
26544
26562
|
app.productList[options.containerSelector] = instance;
|
|
26545
26563
|
};
|
|
26546
26564
|
const searchContainer = (options, mountOptions) => {
|
|
26547
|
-
var _a, _b;
|
|
26565
|
+
var _a, _b, _c, _d, _e, _f;
|
|
26548
26566
|
const existingInstance = app.searchContainer[options.trigger];
|
|
26549
26567
|
if (existingInstance) {
|
|
26550
|
-
existingInstance.searchContainerOptions
|
|
26551
|
-
existingInstance.reloadOptions();
|
|
26552
|
-
console.log(existingInstance);
|
|
26568
|
+
existingInstance.props.searchContainerOptions = options;
|
|
26569
|
+
(_d = (_c = (_b = (_a = existingInstance.mountedComponent) == null ? void 0 : _a.component) == null ? void 0 : _b.exposed) == null ? void 0 : _c.reloadOptions) == null ? void 0 : _d.call(_c);
|
|
26553
26570
|
if (mountOptions == null ? void 0 : mountOptions.fetch) {
|
|
26554
26571
|
setTimeout(() => {
|
|
26555
|
-
var _a2;
|
|
26556
|
-
(_a2 = existingInstance.
|
|
26572
|
+
var _a2, _b2, _c2, _d2;
|
|
26573
|
+
(_d2 = (_c2 = (_b2 = (_a2 = existingInstance.mountedComponent) == null ? void 0 : _a2.component) == null ? void 0 : _b2.exposed) == null ? void 0 : _c2.fetch) == null ? void 0 : _d2.call(_c2);
|
|
26557
26574
|
});
|
|
26558
26575
|
}
|
|
26559
26576
|
return;
|
|
@@ -26564,7 +26581,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
26564
26581
|
attatchShadowDom({
|
|
26565
26582
|
host,
|
|
26566
26583
|
manager,
|
|
26567
|
-
styleUrl: (
|
|
26584
|
+
styleUrl: (_f = (_e = options.options) == null ? void 0 : _e.styleLink) != null ? _f : DEFAULT_CONTAINER_STYLE,
|
|
26568
26585
|
options: options.options
|
|
26569
26586
|
});
|
|
26570
26587
|
document.body.appendChild(host);
|
|
@@ -26579,11 +26596,11 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
26579
26596
|
const recommendations = (options, mountOptions) => {
|
|
26580
26597
|
const existingInstance = app.recommendations[options.containerSelector];
|
|
26581
26598
|
if (existingInstance) {
|
|
26582
|
-
existingInstance.recommendationOptions = options;
|
|
26599
|
+
existingInstance.props.recommendationOptions = options;
|
|
26583
26600
|
if (mountOptions == null ? void 0 : mountOptions.fetch) {
|
|
26584
26601
|
setTimeout(() => {
|
|
26585
|
-
var _a;
|
|
26586
|
-
(_a = existingInstance.
|
|
26602
|
+
var _a, _b, _c, _d;
|
|
26603
|
+
(_d = (_c = (_b = (_a = existingInstance.mountedComponent) == null ? void 0 : _a.component) == null ? void 0 : _b.exposed) == null ? void 0 : _c.fetch) == null ? void 0 : _d.call(_c);
|
|
26587
26604
|
});
|
|
26588
26605
|
}
|
|
26589
26606
|
return;
|
|
@@ -26596,21 +26613,20 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
26596
26613
|
}
|
|
26597
26614
|
app.recommendations[options.containerSelector] = instance;
|
|
26598
26615
|
};
|
|
26599
|
-
const clearInstance = (
|
|
26600
|
-
|
|
26601
|
-
|
|
26602
|
-
|
|
26603
|
-
|
|
26604
|
-
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;
|
|
26605
26621
|
};
|
|
26606
26622
|
const clearSearchBox = (selector) => {
|
|
26607
26623
|
try {
|
|
26608
26624
|
if (selector) {
|
|
26609
26625
|
app.box[selector] = null;
|
|
26610
|
-
clearInstance(selector);
|
|
26626
|
+
clearInstance(app.box[selector].mountElement, app.box[selector].app);
|
|
26611
26627
|
}
|
|
26612
26628
|
for (const key in app.box) {
|
|
26613
|
-
clearInstance(key);
|
|
26629
|
+
clearInstance(app.box[key].mountElement, app.box[key].app);
|
|
26614
26630
|
}
|
|
26615
26631
|
app.box = {};
|
|
26616
26632
|
} catch (e) {
|
|
@@ -26620,10 +26636,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
26620
26636
|
try {
|
|
26621
26637
|
if (selector) {
|
|
26622
26638
|
app.results[selector] = null;
|
|
26623
|
-
clearInstance(selector);
|
|
26639
|
+
clearInstance(app.results[selector].mountElement, app.results[selector].app);
|
|
26624
26640
|
}
|
|
26625
26641
|
for (const key in app.results) {
|
|
26626
|
-
clearInstance(key);
|
|
26642
|
+
clearInstance(app.results[key].mountElement, app.results[key].app);
|
|
26627
26643
|
}
|
|
26628
26644
|
app.results = {};
|
|
26629
26645
|
} catch (e) {
|
|
@@ -26633,10 +26649,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
26633
26649
|
try {
|
|
26634
26650
|
if (selector) {
|
|
26635
26651
|
app.productList[selector] = null;
|
|
26636
|
-
clearInstance(selector);
|
|
26652
|
+
clearInstance(app.productList[selector].mountElement, app.productList[selector].app);
|
|
26637
26653
|
}
|
|
26638
26654
|
for (const key in app.productList) {
|
|
26639
|
-
clearInstance(key);
|
|
26655
|
+
clearInstance(app.productList[key].mountElement, app.productList[key].app);
|
|
26640
26656
|
}
|
|
26641
26657
|
app.productList = {};
|
|
26642
26658
|
} catch (e) {
|
|
@@ -26646,10 +26662,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
26646
26662
|
try {
|
|
26647
26663
|
if (selector) {
|
|
26648
26664
|
app.searchContainer[selector] = null;
|
|
26649
|
-
clearInstance(selector);
|
|
26665
|
+
clearInstance(app.searchContainer[selector].mountElement, app.searchContainer[selector].app);
|
|
26650
26666
|
}
|
|
26651
26667
|
for (const key in app.searchContainer) {
|
|
26652
|
-
clearInstance(key);
|
|
26668
|
+
clearInstance(app.searchContainer[key].mountElement, app.searchContainer[key].app);
|
|
26653
26669
|
}
|
|
26654
26670
|
app.searchContainer = {};
|
|
26655
26671
|
} catch (e) {
|
|
@@ -26659,10 +26675,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
26659
26675
|
try {
|
|
26660
26676
|
if (selector) {
|
|
26661
26677
|
app.recommendations[selector] = null;
|
|
26662
|
-
clearInstance(selector);
|
|
26678
|
+
clearInstance(app.recommendations[selector].mountElement, app.recommendations[selector].app);
|
|
26663
26679
|
}
|
|
26664
26680
|
for (const key in app.recommendations) {
|
|
26665
|
-
clearInstance(key);
|
|
26681
|
+
clearInstance(app.recommendations[key].mountElement, app.recommendations[key].app);
|
|
26666
26682
|
}
|
|
26667
26683
|
app.recommendations = {};
|
|
26668
26684
|
} catch (e) {
|
|
@@ -26685,7 +26701,9 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
26685
26701
|
window.getLupa = lupaSearch;
|
|
26686
26702
|
window.lupaSearch = lupaSearch;
|
|
26687
26703
|
}
|
|
26704
|
+
exports2.BadgeType = BadgeType;
|
|
26688
26705
|
exports2.DocumentElementType = DocumentElementType;
|
|
26706
|
+
exports2.SearchBoxPanelType = SearchBoxPanelType;
|
|
26689
26707
|
exports2.default = lupaSearch;
|
|
26690
26708
|
Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
26691
26709
|
});
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Environment, SdkOptions, SortDirection, TrackingOptions, DocumentElement, ImageDocumentElement, TitleDocumentElement, DescriptionDocumentElement, CustomDocumentElement, PriceElement, RegularPriceDocumentElement, RatingElement, AddToCartElement, CustomHtmlElement, SingleStarRatingElement, ProductListOptions, CategoryFilterOptions, ProductRecommendationOptions, RecommendationABTestingOptions, SearchBoxOptions,
|
|
2
|
-
import { DocumentElementType } from '@getlupa/vue';
|
|
1
|
+
import type { Environment, SdkOptions, SortDirection, TrackingOptions, DocumentElement, ImageDocumentElement, TitleDocumentElement, DescriptionDocumentElement, CustomDocumentElement, PriceElement, RegularPriceDocumentElement, RatingElement, AddToCartElement, CustomHtmlElement, SingleStarRatingElement, ProductListOptions, CategoryFilterOptions, ProductRecommendationOptions, RecommendationABTestingOptions, SearchBoxOptions, SearchContainerOptions, SearchContainerConfigOptions, SearchResultBadgeElement, BadgeGenerateSeed, BadgeGenerateOptions, BadgeOptions, RoutingBehavior, SearchResultsOptions, FacetStyle, SearchResultEventCallbacks, CallbackContext, FacetFilterQuery, SearchResultsFilterOptions, ResultFacetOptions, DynamicData, AnchorPosition, SortOptions, SearchResultsSortOptions } from '@getlupa/vue';
|
|
2
|
+
import { DocumentElementType, SearchBoxPanelType, BadgeType, SearchResultBadgeType } from '@getlupa/vue';
|
|
3
3
|
type MountOptions = {
|
|
4
4
|
fetch: boolean;
|
|
5
5
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getlupa/client",
|
|
3
|
-
"version": "1.1.
|
|
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.
|
|
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",
|