@getlupa/client 1.8.8 → 1.9.0
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 +172 -63
- package/dist/lupaSearch.js +172 -63
- package/dist/lupaSearch.mjs +172 -63
- package/dist/lupaSearch.umd.js +172 -63
- package/package.json +2 -2
package/dist/lupaSearch.js
CHANGED
|
@@ -6544,7 +6544,8 @@ const trackLupaEvent = (queryKey, data = {}, options) => {
|
|
|
6544
6544
|
itemId: (_b = data.itemId) != null ? _b : "",
|
|
6545
6545
|
name: data.type,
|
|
6546
6546
|
userId: getUserKey(),
|
|
6547
|
-
sessionId: getSessionKey()
|
|
6547
|
+
sessionId: getSessionKey(),
|
|
6548
|
+
filters: data.filters
|
|
6548
6549
|
};
|
|
6549
6550
|
LupaSearchSdk.track(queryKey, eventData, options);
|
|
6550
6551
|
};
|
|
@@ -6648,9 +6649,6 @@ const track = (queryKey, data = {}, options) => {
|
|
|
6648
6649
|
return;
|
|
6649
6650
|
}
|
|
6650
6651
|
trackAnalyticsEvent(data);
|
|
6651
|
-
if (!hasSearchQuery) {
|
|
6652
|
-
return;
|
|
6653
|
-
}
|
|
6654
6652
|
trackLupaEvent(queryKey, data, options);
|
|
6655
6653
|
};
|
|
6656
6654
|
const DEFAULT_SEARCH_BOX_OPTIONS$1 = {
|
|
@@ -6927,6 +6925,7 @@ var DocumentElementType = /* @__PURE__ */ ((DocumentElementType2) => {
|
|
|
6927
6925
|
var SearchBoxPanelType = /* @__PURE__ */ ((SearchBoxPanelType2) => {
|
|
6928
6926
|
SearchBoxPanelType2["SUGGESTION"] = "suggestion";
|
|
6929
6927
|
SearchBoxPanelType2["DOCUMENT"] = "document";
|
|
6928
|
+
SearchBoxPanelType2["RELATED_SOURCE"] = "related-source";
|
|
6930
6929
|
return SearchBoxPanelType2;
|
|
6931
6930
|
})(SearchBoxPanelType || {});
|
|
6932
6931
|
var BadgeType = /* @__PURE__ */ ((BadgeType2) => {
|
|
@@ -7843,12 +7842,12 @@ const _hoisted_1$1c = { id: "lupa-search-box-input-container" };
|
|
|
7843
7842
|
const _hoisted_2$P = { class: "lupa-input-clear" };
|
|
7844
7843
|
const _hoisted_3$A = { id: "lupa-search-box-input" };
|
|
7845
7844
|
const _hoisted_4$s = ["value"];
|
|
7846
|
-
const _hoisted_5$
|
|
7845
|
+
const _hoisted_5$h = ["aria-label", "placeholder"];
|
|
7847
7846
|
const _hoisted_6$9 = {
|
|
7848
7847
|
key: 0,
|
|
7849
7848
|
class: "lupa-close-label"
|
|
7850
7849
|
};
|
|
7851
|
-
const _sfc_main$
|
|
7850
|
+
const _sfc_main$1l = /* @__PURE__ */ defineComponent({
|
|
7852
7851
|
__name: "SearchBoxInput",
|
|
7853
7852
|
props: {
|
|
7854
7853
|
options: {},
|
|
@@ -7956,7 +7955,7 @@ const _sfc_main$1k = /* @__PURE__ */ defineComponent({
|
|
|
7956
7955
|
placeholder: labels.value.placeholder,
|
|
7957
7956
|
onInput: handleInput,
|
|
7958
7957
|
onFocus: handleFocus
|
|
7959
|
-
}), null, 16, _hoisted_5$
|
|
7958
|
+
}), null, 16, _hoisted_5$h), [
|
|
7960
7959
|
[vModelText, inputValue.value]
|
|
7961
7960
|
])
|
|
7962
7961
|
]),
|
|
@@ -7971,7 +7970,7 @@ const _sfc_main$1k = /* @__PURE__ */ defineComponent({
|
|
|
7971
7970
|
};
|
|
7972
7971
|
}
|
|
7973
7972
|
});
|
|
7974
|
-
const _sfc_main$
|
|
7973
|
+
const _sfc_main$1k = /* @__PURE__ */ defineComponent({
|
|
7975
7974
|
__name: "SearchBoxMoreResults",
|
|
7976
7975
|
props: {
|
|
7977
7976
|
labels: {},
|
|
@@ -8005,7 +8004,7 @@ const _sfc_main$1j = /* @__PURE__ */ defineComponent({
|
|
|
8005
8004
|
});
|
|
8006
8005
|
const _hoisted_1$1b = { class: "lupa-search-box-history-item" };
|
|
8007
8006
|
const _hoisted_2$O = { class: "lupa-search-box-history-item-content" };
|
|
8008
|
-
const _sfc_main$
|
|
8007
|
+
const _sfc_main$1j = /* @__PURE__ */ defineComponent({
|
|
8009
8008
|
__name: "SearchBoxHistoryItem",
|
|
8010
8009
|
props: {
|
|
8011
8010
|
item: {},
|
|
@@ -8040,7 +8039,7 @@ const _hoisted_1$1a = {
|
|
|
8040
8039
|
key: 0,
|
|
8041
8040
|
class: "lupa-search-box-history-panel"
|
|
8042
8041
|
};
|
|
8043
|
-
const _sfc_main$
|
|
8042
|
+
const _sfc_main$1i = /* @__PURE__ */ defineComponent({
|
|
8044
8043
|
__name: "SearchBoxHistoryPanel",
|
|
8045
8044
|
props: {
|
|
8046
8045
|
options: {}
|
|
@@ -8083,7 +8082,7 @@ const _sfc_main$1h = /* @__PURE__ */ defineComponent({
|
|
|
8083
8082
|
return (_ctx, _cache) => {
|
|
8084
8083
|
return hasHistory.value ? (openBlock(), createElementBlock("div", _hoisted_1$1a, [
|
|
8085
8084
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(history), (item, index) => {
|
|
8086
|
-
return openBlock(), createBlock(_sfc_main$
|
|
8085
|
+
return openBlock(), createBlock(_sfc_main$1j, {
|
|
8087
8086
|
key: item,
|
|
8088
8087
|
item,
|
|
8089
8088
|
highlighted: index === highlightIndex.value,
|
|
@@ -8100,7 +8099,7 @@ const _sfc_main$1h = /* @__PURE__ */ defineComponent({
|
|
|
8100
8099
|
}
|
|
8101
8100
|
});
|
|
8102
8101
|
const _hoisted_1$19 = { class: "lupa-search-box-no-results" };
|
|
8103
|
-
const _sfc_main$
|
|
8102
|
+
const _sfc_main$1h = /* @__PURE__ */ defineComponent({
|
|
8104
8103
|
__name: "SearchBoxNoResults",
|
|
8105
8104
|
props: {
|
|
8106
8105
|
labels: {}
|
|
@@ -8126,11 +8125,11 @@ const _hoisted_4$r = {
|
|
|
8126
8125
|
class: "lupa-suggestion-facet-label",
|
|
8127
8126
|
"data-cy": "lupa-suggestion-facet-label"
|
|
8128
8127
|
};
|
|
8129
|
-
const _hoisted_5$
|
|
8128
|
+
const _hoisted_5$g = {
|
|
8130
8129
|
class: "lupa-suggestion-facet-value",
|
|
8131
8130
|
"data-cy": "lupa-suggestion-facet-value"
|
|
8132
8131
|
};
|
|
8133
|
-
const _sfc_main$
|
|
8132
|
+
const _sfc_main$1g = /* @__PURE__ */ defineComponent({
|
|
8134
8133
|
__name: "SearchBoxSuggestion",
|
|
8135
8134
|
props: {
|
|
8136
8135
|
suggestion: {},
|
|
@@ -8169,7 +8168,7 @@ const _sfc_main$1f = /* @__PURE__ */ defineComponent({
|
|
|
8169
8168
|
}, null, 8, _hoisted_1$18)) : (openBlock(), createElementBlock("div", _hoisted_2$N, toDisplayString(_ctx.suggestion.display), 1)),
|
|
8170
8169
|
_ctx.suggestion.facet ? (openBlock(), createElementBlock("div", _hoisted_3$z, [
|
|
8171
8170
|
createBaseVNode("span", _hoisted_4$r, toDisplayString(facetLabel.value), 1),
|
|
8172
|
-
createBaseVNode("span", _hoisted_5$
|
|
8171
|
+
createBaseVNode("span", _hoisted_5$g, toDisplayString(_ctx.suggestion.facet.title), 1)
|
|
8173
8172
|
])) : createCommentVNode("", true)
|
|
8174
8173
|
]);
|
|
8175
8174
|
};
|
|
@@ -8179,7 +8178,7 @@ const _hoisted_1$17 = {
|
|
|
8179
8178
|
id: "lupa-search-box-suggestions",
|
|
8180
8179
|
"data-cy": "lupa-search-box-suggestions"
|
|
8181
8180
|
};
|
|
8182
|
-
const _sfc_main$
|
|
8181
|
+
const _sfc_main$1f = /* @__PURE__ */ defineComponent({
|
|
8183
8182
|
__name: "SearchBoxSuggestions",
|
|
8184
8183
|
props: {
|
|
8185
8184
|
items: {},
|
|
@@ -8241,7 +8240,7 @@ const _sfc_main$1e = /* @__PURE__ */ defineComponent({
|
|
|
8241
8240
|
return (_ctx, _cache) => {
|
|
8242
8241
|
return openBlock(), createElementBlock("div", _hoisted_1$17, [
|
|
8243
8242
|
(openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (item, index) => {
|
|
8244
|
-
return openBlock(), createBlock(_sfc_main$
|
|
8243
|
+
return openBlock(), createBlock(_sfc_main$1g, {
|
|
8245
8244
|
key: getSuggestionKey(item),
|
|
8246
8245
|
class: normalizeClass(["lupa-suggestion", index === highlightedIndex.value ? "lupa-suggestion-highlighted" : ""]),
|
|
8247
8246
|
suggestion: item,
|
|
@@ -8269,7 +8268,7 @@ const debounce$1 = (func, timeout) => {
|
|
|
8269
8268
|
}, timeout);
|
|
8270
8269
|
};
|
|
8271
8270
|
};
|
|
8272
|
-
const _sfc_main$
|
|
8271
|
+
const _sfc_main$1e = /* @__PURE__ */ defineComponent({
|
|
8273
8272
|
__name: "SearchBoxSuggestionsWrapper",
|
|
8274
8273
|
props: {
|
|
8275
8274
|
panel: {},
|
|
@@ -8310,7 +8309,7 @@ const _sfc_main$1d = /* @__PURE__ */ defineComponent({
|
|
|
8310
8309
|
};
|
|
8311
8310
|
const getSuggestionsDebounced = debounce$1(getSuggestions, props.debounce);
|
|
8312
8311
|
return (_ctx, _cache) => {
|
|
8313
|
-
return openBlock(), createBlock(_sfc_main$
|
|
8312
|
+
return openBlock(), createBlock(_sfc_main$1f, {
|
|
8314
8313
|
items: searchResult.value,
|
|
8315
8314
|
highlight: _ctx.panel.highlight,
|
|
8316
8315
|
queryKey: _ctx.panel.queryKey,
|
|
@@ -8396,7 +8395,7 @@ const joinUrlParts = (...parts) => {
|
|
|
8396
8395
|
return (_c = (_b = (_a = parts == null ? void 0 : parts.map((part) => part.replace(/(^\/+|\/+$)/g, ""))) == null ? void 0 : _a.filter((part) => part !== "")) == null ? void 0 : _b.join("/")) != null ? _c : "";
|
|
8397
8396
|
};
|
|
8398
8397
|
const _hoisted_1$16 = ["src"];
|
|
8399
|
-
const _sfc_main$
|
|
8398
|
+
const _sfc_main$1d = /* @__PURE__ */ defineComponent({
|
|
8400
8399
|
__name: "ProductImage",
|
|
8401
8400
|
props: {
|
|
8402
8401
|
item: {},
|
|
@@ -8454,7 +8453,7 @@ const _sfc_main$1c = /* @__PURE__ */ defineComponent({
|
|
|
8454
8453
|
};
|
|
8455
8454
|
}
|
|
8456
8455
|
});
|
|
8457
|
-
const _sfc_main$
|
|
8456
|
+
const _sfc_main$1c = /* @__PURE__ */ defineComponent({
|
|
8458
8457
|
__name: "SearchBoxProductImage",
|
|
8459
8458
|
props: {
|
|
8460
8459
|
item: {},
|
|
@@ -8462,7 +8461,7 @@ const _sfc_main$1b = /* @__PURE__ */ defineComponent({
|
|
|
8462
8461
|
},
|
|
8463
8462
|
setup(__props) {
|
|
8464
8463
|
return (_ctx, _cache) => {
|
|
8465
|
-
return openBlock(), createBlock(_sfc_main$
|
|
8464
|
+
return openBlock(), createBlock(_sfc_main$1d, {
|
|
8466
8465
|
item: _ctx.item,
|
|
8467
8466
|
options: _ctx.options,
|
|
8468
8467
|
"wrapper-class": "lupa-search-box-image-wrapper",
|
|
@@ -8476,7 +8475,7 @@ const _hoisted_2$M = {
|
|
|
8476
8475
|
key: 1,
|
|
8477
8476
|
class: "lupa-search-box-product-title"
|
|
8478
8477
|
};
|
|
8479
|
-
const _sfc_main$
|
|
8478
|
+
const _sfc_main$1b = /* @__PURE__ */ defineComponent({
|
|
8480
8479
|
__name: "SearchBoxProductTitle",
|
|
8481
8480
|
props: {
|
|
8482
8481
|
item: {},
|
|
@@ -8507,7 +8506,7 @@ const _hoisted_2$L = {
|
|
|
8507
8506
|
key: 1,
|
|
8508
8507
|
class: "lupa-search-box-product-description"
|
|
8509
8508
|
};
|
|
8510
|
-
const _sfc_main$
|
|
8509
|
+
const _sfc_main$1a = /* @__PURE__ */ defineComponent({
|
|
8511
8510
|
__name: "SearchBoxProductDescription",
|
|
8512
8511
|
props: {
|
|
8513
8512
|
item: {},
|
|
@@ -8532,7 +8531,7 @@ const _sfc_main$19 = /* @__PURE__ */ defineComponent({
|
|
|
8532
8531
|
}
|
|
8533
8532
|
});
|
|
8534
8533
|
const _hoisted_1$13 = { class: "lupa-search-box-product-price" };
|
|
8535
|
-
const _sfc_main$
|
|
8534
|
+
const _sfc_main$19 = /* @__PURE__ */ defineComponent({
|
|
8536
8535
|
__name: "SearchBoxProductPrice",
|
|
8537
8536
|
props: {
|
|
8538
8537
|
item: {},
|
|
@@ -8557,7 +8556,7 @@ const _sfc_main$18 = /* @__PURE__ */ defineComponent({
|
|
|
8557
8556
|
}
|
|
8558
8557
|
});
|
|
8559
8558
|
const _hoisted_1$12 = { class: "lupa-search-box-product-regular-price" };
|
|
8560
|
-
const _sfc_main$
|
|
8559
|
+
const _sfc_main$18 = /* @__PURE__ */ defineComponent({
|
|
8561
8560
|
__name: "SearchBoxProductRegularPrice",
|
|
8562
8561
|
props: {
|
|
8563
8562
|
item: {},
|
|
@@ -8583,8 +8582,8 @@ const _hoisted_1$11 = ["innerHTML"];
|
|
|
8583
8582
|
const _hoisted_2$K = { key: 0 };
|
|
8584
8583
|
const _hoisted_3$y = { key: 1 };
|
|
8585
8584
|
const _hoisted_4$q = { class: "lupa-search-box-custom-label" };
|
|
8586
|
-
const _hoisted_5$
|
|
8587
|
-
const _sfc_main$
|
|
8585
|
+
const _hoisted_5$f = { class: "lupa-search-box-custom-text" };
|
|
8586
|
+
const _sfc_main$17 = /* @__PURE__ */ defineComponent({
|
|
8588
8587
|
__name: "SearchBoxProductCustom",
|
|
8589
8588
|
props: {
|
|
8590
8589
|
item: {},
|
|
@@ -8616,14 +8615,14 @@ const _sfc_main$16 = /* @__PURE__ */ defineComponent({
|
|
|
8616
8615
|
}, toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), [
|
|
8617
8616
|
!label.value ? (openBlock(), createElementBlock("div", _hoisted_2$K, toDisplayString(text.value), 1)) : (openBlock(), createElementBlock("div", _hoisted_3$y, [
|
|
8618
8617
|
createBaseVNode("div", _hoisted_4$q, toDisplayString(label.value), 1),
|
|
8619
|
-
createBaseVNode("div", _hoisted_5$
|
|
8618
|
+
createBaseVNode("div", _hoisted_5$f, toDisplayString(text.value), 1)
|
|
8620
8619
|
]))
|
|
8621
8620
|
], 16));
|
|
8622
8621
|
};
|
|
8623
8622
|
}
|
|
8624
8623
|
});
|
|
8625
8624
|
const _hoisted_1$10 = ["innerHTML"];
|
|
8626
|
-
const _sfc_main$
|
|
8625
|
+
const _sfc_main$16 = /* @__PURE__ */ defineComponent({
|
|
8627
8626
|
__name: "SearchBoxProductCustomHtml",
|
|
8628
8627
|
props: {
|
|
8629
8628
|
item: {},
|
|
@@ -8840,7 +8839,7 @@ const useSearchResultStore = defineStore("searchResult", () => {
|
|
|
8840
8839
|
const _hoisted_1$$ = { class: "lupa-search-box-add-to-cart-wrapper" };
|
|
8841
8840
|
const _hoisted_2$J = { class: "lupa-search-box-product-addtocart" };
|
|
8842
8841
|
const _hoisted_3$x = ["onClick", "disabled"];
|
|
8843
|
-
const _sfc_main$
|
|
8842
|
+
const _sfc_main$15 = /* @__PURE__ */ defineComponent({
|
|
8844
8843
|
__name: "SearchBoxProductAddToCart",
|
|
8845
8844
|
props: {
|
|
8846
8845
|
item: {},
|
|
@@ -8883,17 +8882,17 @@ const _sfc_main$14 = /* @__PURE__ */ defineComponent({
|
|
|
8883
8882
|
});
|
|
8884
8883
|
const __default__$4 = {
|
|
8885
8884
|
components: {
|
|
8886
|
-
SearchBoxProductImage: _sfc_main$
|
|
8887
|
-
SearchBoxProductTitle: _sfc_main$
|
|
8888
|
-
SearchBoxProductDescription: _sfc_main$
|
|
8889
|
-
SearchBoxProductPrice: _sfc_main$
|
|
8890
|
-
SearchBoxProductRegularPrice: _sfc_main$
|
|
8891
|
-
SearchBoxProductCustom: _sfc_main$
|
|
8892
|
-
SearchBoxProductCustomHtml: _sfc_main$
|
|
8893
|
-
SearchBoxProductAddToCart: _sfc_main$
|
|
8885
|
+
SearchBoxProductImage: _sfc_main$1c,
|
|
8886
|
+
SearchBoxProductTitle: _sfc_main$1b,
|
|
8887
|
+
SearchBoxProductDescription: _sfc_main$1a,
|
|
8888
|
+
SearchBoxProductPrice: _sfc_main$19,
|
|
8889
|
+
SearchBoxProductRegularPrice: _sfc_main$18,
|
|
8890
|
+
SearchBoxProductCustom: _sfc_main$17,
|
|
8891
|
+
SearchBoxProductCustomHtml: _sfc_main$16,
|
|
8892
|
+
SearchBoxProductAddToCart: _sfc_main$15
|
|
8894
8893
|
}
|
|
8895
8894
|
};
|
|
8896
|
-
const _sfc_main$
|
|
8895
|
+
const _sfc_main$14 = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValues2({}, __default__$4), {
|
|
8897
8896
|
__name: "SearchBoxProductElement",
|
|
8898
8897
|
props: {
|
|
8899
8898
|
item: {},
|
|
@@ -8959,7 +8958,7 @@ const _hoisted_4$p = {
|
|
|
8959
8958
|
key: 0,
|
|
8960
8959
|
class: "lupa-search-box-product-add-to-cart-section"
|
|
8961
8960
|
};
|
|
8962
|
-
const _sfc_main$
|
|
8961
|
+
const _sfc_main$13 = /* @__PURE__ */ defineComponent({
|
|
8963
8962
|
__name: "SearchBoxProduct",
|
|
8964
8963
|
props: {
|
|
8965
8964
|
item: {},
|
|
@@ -9017,7 +9016,7 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
|
|
|
9017
9016
|
}), [
|
|
9018
9017
|
createBaseVNode("div", _hoisted_2$I, [
|
|
9019
9018
|
(openBlock(true), createElementBlock(Fragment, null, renderList(imageElements.value, (element) => {
|
|
9020
|
-
return openBlock(), createBlock(_sfc_main$
|
|
9019
|
+
return openBlock(), createBlock(_sfc_main$14, {
|
|
9021
9020
|
class: "lupa-search-box-product-element",
|
|
9022
9021
|
item: _ctx.item,
|
|
9023
9022
|
element,
|
|
@@ -9029,7 +9028,7 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
|
|
|
9029
9028
|
]),
|
|
9030
9029
|
createBaseVNode("div", _hoisted_3$w, [
|
|
9031
9030
|
(openBlock(true), createElementBlock(Fragment, null, renderList(detailElements.value, (element) => {
|
|
9032
|
-
return openBlock(), createBlock(_sfc_main$
|
|
9031
|
+
return openBlock(), createBlock(_sfc_main$14, {
|
|
9033
9032
|
class: "lupa-search-box-product-element",
|
|
9034
9033
|
item: _ctx.item,
|
|
9035
9034
|
element,
|
|
@@ -9040,7 +9039,7 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
|
|
|
9040
9039
|
}), 128))
|
|
9041
9040
|
]),
|
|
9042
9041
|
addToCartElement.value ? (openBlock(), createElementBlock("div", _hoisted_4$p, [
|
|
9043
|
-
createVNode(_sfc_main$
|
|
9042
|
+
createVNode(_sfc_main$14, {
|
|
9044
9043
|
class: "lupa-search-box-product-element",
|
|
9045
9044
|
item: _ctx.item,
|
|
9046
9045
|
element: addToCartElement.value,
|
|
@@ -9064,6 +9063,7 @@ const getSearchTrackingData = (searchText, type) => {
|
|
|
9064
9063
|
};
|
|
9065
9064
|
const useTrackingStore = defineStore("tracking", () => {
|
|
9066
9065
|
const optionsStore = useOptionsStore();
|
|
9066
|
+
const searchResultStore = useSearchResultStore();
|
|
9067
9067
|
const trackSearch = ({
|
|
9068
9068
|
queryKey,
|
|
9069
9069
|
query,
|
|
@@ -9101,7 +9101,8 @@ const useTrackingStore = defineStore("tracking", () => {
|
|
|
9101
9101
|
track(
|
|
9102
9102
|
queryKey,
|
|
9103
9103
|
__spreadProps2(__spreadValues2({}, data), {
|
|
9104
|
-
analytics: data.analytics ? __spreadProps2(__spreadValues2({}, data.analytics), { items: mappedItems }) : void 0
|
|
9104
|
+
analytics: data.analytics ? __spreadProps2(__spreadValues2({}, data.analytics), { items: mappedItems }) : void 0,
|
|
9105
|
+
filters: searchResultStore.hasAnyFilter ? searchResultStore.filters : void 0
|
|
9105
9106
|
}),
|
|
9106
9107
|
options
|
|
9107
9108
|
);
|
|
@@ -9109,7 +9110,7 @@ const useTrackingStore = defineStore("tracking", () => {
|
|
|
9109
9110
|
return { trackSearch, trackResults, trackEvent };
|
|
9110
9111
|
});
|
|
9111
9112
|
const _hoisted_1$Z = { id: "lupa-search-box-products" };
|
|
9112
|
-
const _sfc_main$
|
|
9113
|
+
const _sfc_main$12 = /* @__PURE__ */ defineComponent({
|
|
9113
9114
|
__name: "SearchBoxProducts",
|
|
9114
9115
|
props: {
|
|
9115
9116
|
items: {},
|
|
@@ -9182,7 +9183,7 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
|
|
|
9182
9183
|
itemClicked: handleProductClick
|
|
9183
9184
|
});
|
|
9184
9185
|
}), 128)) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(_ctx.items, (item, index) => {
|
|
9185
|
-
return openBlock(), createBlock(_sfc_main$
|
|
9186
|
+
return openBlock(), createBlock(_sfc_main$13, {
|
|
9186
9187
|
key: index,
|
|
9187
9188
|
item,
|
|
9188
9189
|
panelOptions: _ctx.panelOptions,
|
|
@@ -9196,7 +9197,7 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
|
|
|
9196
9197
|
};
|
|
9197
9198
|
}
|
|
9198
9199
|
});
|
|
9199
|
-
const _sfc_main$
|
|
9200
|
+
const _sfc_main$11 = /* @__PURE__ */ defineComponent({
|
|
9200
9201
|
__name: "SearchBoxProductsWrapper",
|
|
9201
9202
|
props: {
|
|
9202
9203
|
panel: {},
|
|
@@ -9248,7 +9249,7 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
|
|
|
9248
9249
|
const getItemsDebounced = debounce$1(getItems, props.debounce);
|
|
9249
9250
|
return (_ctx, _cache) => {
|
|
9250
9251
|
var _a, _b;
|
|
9251
|
-
return openBlock(), createBlock(_sfc_main$
|
|
9252
|
+
return openBlock(), createBlock(_sfc_main$12, {
|
|
9252
9253
|
items: (_b = (_a = searchResult.value) == null ? void 0 : _a.items) != null ? _b : [],
|
|
9253
9254
|
panelOptions: _ctx.panel,
|
|
9254
9255
|
labels: _ctx.labels,
|
|
@@ -9266,6 +9267,95 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
|
|
|
9266
9267
|
};
|
|
9267
9268
|
}
|
|
9268
9269
|
});
|
|
9270
|
+
const _sfc_main$10 = /* @__PURE__ */ defineComponent({
|
|
9271
|
+
__name: "SearchBoxRelatedSourceWrapper",
|
|
9272
|
+
props: {
|
|
9273
|
+
panel: {},
|
|
9274
|
+
inputValue: {},
|
|
9275
|
+
options: {},
|
|
9276
|
+
labels: {},
|
|
9277
|
+
debounce: {}
|
|
9278
|
+
},
|
|
9279
|
+
emits: ["fetched"],
|
|
9280
|
+
setup(__props, { emit: emit2 }) {
|
|
9281
|
+
const props = __props;
|
|
9282
|
+
const searchBoxStore = useSearchBoxStore();
|
|
9283
|
+
const { docResults } = storeToRefs(searchBoxStore);
|
|
9284
|
+
const searchResult = ref(null);
|
|
9285
|
+
const options = computed(() => props.options);
|
|
9286
|
+
const relatedSourceIds = computed(() => {
|
|
9287
|
+
var _a, _b, _c;
|
|
9288
|
+
const queryKey = (_a = props.panel.sourceIds) == null ? void 0 : _a.queryKey;
|
|
9289
|
+
if (!queryKey) {
|
|
9290
|
+
return [];
|
|
9291
|
+
}
|
|
9292
|
+
const currentDocumentItems = (_c = (_b = docResults == null ? void 0 : docResults.value[queryKey]) == null ? void 0 : _b.items) != null ? _c : [];
|
|
9293
|
+
const allFieldValues = currentDocumentItems.map((item) => item[props.panel.sourceIds.field]).flat();
|
|
9294
|
+
const uniqueFieldValues = Array.from(new Set(allFieldValues));
|
|
9295
|
+
return uniqueFieldValues;
|
|
9296
|
+
});
|
|
9297
|
+
const inputValueProp = computed(() => props.inputValue);
|
|
9298
|
+
onMounted(() => {
|
|
9299
|
+
getItemsDebounced();
|
|
9300
|
+
});
|
|
9301
|
+
watch(relatedSourceIds, () => {
|
|
9302
|
+
getItemsDebounced();
|
|
9303
|
+
});
|
|
9304
|
+
watch(inputValueProp, () => {
|
|
9305
|
+
getItemsDebounced();
|
|
9306
|
+
});
|
|
9307
|
+
const fetchRelatedItems = () => __async(this, null, function* () {
|
|
9308
|
+
var _a, _b;
|
|
9309
|
+
if (!((_a = props.panel.target) == null ? void 0 : _a.queryKey) || !relatedSourceIds.value.length) {
|
|
9310
|
+
return { items: [], success: true, searchText: "", total: 0 };
|
|
9311
|
+
}
|
|
9312
|
+
try {
|
|
9313
|
+
const result = yield LupaSearchSdk.queryByIds(
|
|
9314
|
+
(_b = props.panel.target) == null ? void 0 : _b.queryKey,
|
|
9315
|
+
relatedSourceIds.value,
|
|
9316
|
+
options.value
|
|
9317
|
+
);
|
|
9318
|
+
if (!result.success) {
|
|
9319
|
+
return { items: [], success: true, searchText: "", total: 0 };
|
|
9320
|
+
}
|
|
9321
|
+
return result;
|
|
9322
|
+
} catch (err) {
|
|
9323
|
+
console.error(err);
|
|
9324
|
+
if (options == null ? void 0 : options.value.onError) {
|
|
9325
|
+
options.value.onError(err);
|
|
9326
|
+
}
|
|
9327
|
+
return { items: [], success: true, searchText: "", total: 0 };
|
|
9328
|
+
}
|
|
9329
|
+
});
|
|
9330
|
+
const getItems = () => __async(this, null, function* () {
|
|
9331
|
+
searchResult.value = yield fetchRelatedItems();
|
|
9332
|
+
});
|
|
9333
|
+
const getItemsDebounced = debounce$1(getItems, props.debounce);
|
|
9334
|
+
const documentPanelOptions = computed(() => {
|
|
9335
|
+
return __spreadProps2(__spreadValues2({}, props.panel), {
|
|
9336
|
+
type: SearchBoxPanelType.DOCUMENT
|
|
9337
|
+
});
|
|
9338
|
+
});
|
|
9339
|
+
return (_ctx, _cache) => {
|
|
9340
|
+
var _a, _b;
|
|
9341
|
+
return openBlock(), createBlock(_sfc_main$12, {
|
|
9342
|
+
items: (_b = (_a = searchResult.value) == null ? void 0 : _a.items) != null ? _b : [],
|
|
9343
|
+
panelOptions: documentPanelOptions.value,
|
|
9344
|
+
labels: _ctx.labels,
|
|
9345
|
+
inputValue: _ctx.inputValue,
|
|
9346
|
+
onProductClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("product-click"))
|
|
9347
|
+
}, createSlots({ _: 2 }, [
|
|
9348
|
+
_ctx.$slots.productCard ? {
|
|
9349
|
+
name: "productCard",
|
|
9350
|
+
fn: withCtx((props2) => [
|
|
9351
|
+
renderSlot(_ctx.$slots, "productCard", normalizeProps(guardReactiveProps(props2)))
|
|
9352
|
+
]),
|
|
9353
|
+
key: "0"
|
|
9354
|
+
} : void 0
|
|
9355
|
+
]), 1032, ["items", "panelOptions", "labels", "inputValue"]);
|
|
9356
|
+
};
|
|
9357
|
+
}
|
|
9358
|
+
});
|
|
9269
9359
|
const _hoisted_1$Y = {
|
|
9270
9360
|
key: 0,
|
|
9271
9361
|
id: "lupa-search-box-panel"
|
|
@@ -9273,16 +9363,21 @@ const _hoisted_1$Y = {
|
|
|
9273
9363
|
const _hoisted_2$H = ["data-cy"];
|
|
9274
9364
|
const _hoisted_3$v = {
|
|
9275
9365
|
key: 0,
|
|
9276
|
-
class: "lupa-panel-title"
|
|
9366
|
+
class: "lupa-panel-title lupa-panel-title-top-results"
|
|
9277
9367
|
};
|
|
9278
9368
|
const _hoisted_4$o = {
|
|
9369
|
+
key: 1,
|
|
9370
|
+
class: "lupa-panel-title"
|
|
9371
|
+
};
|
|
9372
|
+
const _hoisted_5$e = {
|
|
9279
9373
|
key: 1,
|
|
9280
9374
|
id: "lupa-search-box-panel"
|
|
9281
9375
|
};
|
|
9282
9376
|
const __default__$3 = {
|
|
9283
9377
|
components: {
|
|
9284
|
-
SearchBoxSuggestionsWrapper: _sfc_main$
|
|
9285
|
-
SearchBoxProductsWrapper: _sfc_main$
|
|
9378
|
+
SearchBoxSuggestionsWrapper: _sfc_main$1e,
|
|
9379
|
+
SearchBoxProductsWrapper: _sfc_main$11,
|
|
9380
|
+
SearchBoxRelatedSourceWrapper: _sfc_main$10
|
|
9286
9381
|
}
|
|
9287
9382
|
};
|
|
9288
9383
|
const _sfc_main$$ = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValues2({}, __default__$3), {
|
|
@@ -9376,6 +9471,8 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
|
|
|
9376
9471
|
switch (type) {
|
|
9377
9472
|
case "suggestion":
|
|
9378
9473
|
return "SearchBoxSuggestionsWrapper";
|
|
9474
|
+
case "related-source":
|
|
9475
|
+
return "SearchBoxRelatedSourceWrapper";
|
|
9379
9476
|
default:
|
|
9380
9477
|
return "SearchBoxProductsWrapper";
|
|
9381
9478
|
}
|
|
@@ -9401,6 +9498,17 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
|
|
|
9401
9498
|
const panel = panelItemCounts.value.find((v) => v.queryKey === queryKey);
|
|
9402
9499
|
return (panel == null ? void 0 : panel.count) > 0 && (panel == null ? void 0 : panel.input.length) < 1;
|
|
9403
9500
|
};
|
|
9501
|
+
const canShowPanel = (panel) => {
|
|
9502
|
+
var _a, _b, _c;
|
|
9503
|
+
if (!((_a = panel.visibility) == null ? void 0 : _a.showWhenKeyHasNoResults)) {
|
|
9504
|
+
return true;
|
|
9505
|
+
}
|
|
9506
|
+
const resultCountFromRelatedPanel = (_c = (_b = panelItemCounts.value.find((v) => {
|
|
9507
|
+
var _a2;
|
|
9508
|
+
return v.queryKey === ((_a2 = panel.visibility) == null ? void 0 : _a2.showWhenKeyHasNoResults);
|
|
9509
|
+
})) == null ? void 0 : _b.count) != null ? _c : 0;
|
|
9510
|
+
return resultCountFromRelatedPanel < 1;
|
|
9511
|
+
};
|
|
9404
9512
|
return (_ctx, _cache) => {
|
|
9405
9513
|
var _a;
|
|
9406
9514
|
return openBlock(), createElementBlock("div", {
|
|
@@ -9414,7 +9522,7 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
|
|
|
9414
9522
|
"data-cy": "lupa-main-panel"
|
|
9415
9523
|
}, [
|
|
9416
9524
|
(openBlock(true), createElementBlock(Fragment, null, renderList(displayPanels.value, (panel, index) => {
|
|
9417
|
-
var _a2, _b;
|
|
9525
|
+
var _a2, _b, _c, _d;
|
|
9418
9526
|
return openBlock(), createElementBlock("div", {
|
|
9419
9527
|
key: index,
|
|
9420
9528
|
class: normalizeClass([
|
|
@@ -9424,8 +9532,9 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
|
|
|
9424
9532
|
"data-cy": "lupa-panel-" + panel.type + "-index"
|
|
9425
9533
|
}, [
|
|
9426
9534
|
((_a2 = panel.labels) == null ? void 0 : _a2.topResultsTitle) && showTopResultsPanelTitle(panel.queryKey) ? (openBlock(), createElementBlock("div", _hoisted_3$v, toDisplayString((_b = panel.labels) == null ? void 0 : _b.topResultsTitle), 1)) : createCommentVNode("", true),
|
|
9427
|
-
panel.
|
|
9428
|
-
|
|
9535
|
+
((_c = panel.labels) == null ? void 0 : _c.title) ? (openBlock(), createElementBlock("div", _hoisted_4$o, toDisplayString((_d = panel.labels) == null ? void 0 : _d.title), 1)) : createCommentVNode("", true),
|
|
9536
|
+
panel.queryKey && canShowPanel(panel) ? (openBlock(), createBlock(resolveDynamicComponent(getComponent(panel.type)), {
|
|
9537
|
+
key: 2,
|
|
9429
9538
|
panel,
|
|
9430
9539
|
options: sdkOptions.value,
|
|
9431
9540
|
debounce: _ctx.options.debounce,
|
|
@@ -9446,18 +9555,18 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
|
|
|
9446
9555
|
], 10, _hoisted_2$H);
|
|
9447
9556
|
}), 128))
|
|
9448
9557
|
], 4),
|
|
9449
|
-
!unref(hasAnyResults) && _ctx.options.showNoResultsPanel ? (openBlock(), createBlock(_sfc_main$
|
|
9558
|
+
!unref(hasAnyResults) && _ctx.options.showNoResultsPanel ? (openBlock(), createBlock(_sfc_main$1h, {
|
|
9450
9559
|
key: 0,
|
|
9451
9560
|
labels: labels.value
|
|
9452
9561
|
}, null, 8, ["labels"])) : createCommentVNode("", true),
|
|
9453
|
-
unref(hasAnyResults) || !_ctx.options.hideMoreResultsButtonOnNoResults ? (openBlock(), createBlock(_sfc_main$
|
|
9562
|
+
unref(hasAnyResults) || !_ctx.options.hideMoreResultsButtonOnNoResults ? (openBlock(), createBlock(_sfc_main$1k, {
|
|
9454
9563
|
key: 1,
|
|
9455
9564
|
labels: labels.value,
|
|
9456
9565
|
showTotalCount: (_a = _ctx.options.showTotalCount) != null ? _a : false,
|
|
9457
9566
|
onGoToResults: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("go-to-results"))
|
|
9458
9567
|
}, null, 8, ["labels", "showTotalCount"])) : createCommentVNode("", true)
|
|
9459
|
-
])) : displayHistory.value ? (openBlock(), createElementBlock("div",
|
|
9460
|
-
createVNode(_sfc_main$
|
|
9568
|
+
])) : displayHistory.value ? (openBlock(), createElementBlock("div", _hoisted_5$e, [
|
|
9569
|
+
createVNode(_sfc_main$1i, {
|
|
9461
9570
|
options: _ctx.options.history,
|
|
9462
9571
|
history: history.value,
|
|
9463
9572
|
onGoToResults: handleGoToResults,
|
|
@@ -9727,7 +9836,7 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent({
|
|
|
9727
9836
|
var _a2;
|
|
9728
9837
|
return openBlock(), createElementBlock("div", _hoisted_1$X, [
|
|
9729
9838
|
createBaseVNode("div", _hoisted_2$G, [
|
|
9730
|
-
createVNode(_sfc_main$
|
|
9839
|
+
createVNode(_sfc_main$1l, {
|
|
9731
9840
|
options: inputOptions.value,
|
|
9732
9841
|
suggestedValue: suggestedValue.value,
|
|
9733
9842
|
"can-close": (_a2 = _ctx.isSearchContainer) != null ? _a2 : false,
|
|
@@ -13022,7 +13131,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
13022
13131
|
},
|
|
13023
13132
|
setup(__props) {
|
|
13024
13133
|
return (_ctx, _cache) => {
|
|
13025
|
-
return openBlock(), createBlock(_sfc_main$
|
|
13134
|
+
return openBlock(), createBlock(_sfc_main$1d, {
|
|
13026
13135
|
item: _ctx.item,
|
|
13027
13136
|
options: _ctx.options,
|
|
13028
13137
|
"wrapper-class": "lupa-search-results-image-wrapper",
|
|
@@ -21534,7 +21643,7 @@ const _hoisted_4 = {
|
|
|
21534
21643
|
class: "lupa-chat-spinner-main"
|
|
21535
21644
|
};
|
|
21536
21645
|
const _hoisted_5 = { class: "lupasearch-chat-input" };
|
|
21537
|
-
const _sfc_main$
|
|
21646
|
+
const _sfc_main$1m = /* @__PURE__ */ defineComponent({
|
|
21538
21647
|
__name: "ChatContainer",
|
|
21539
21648
|
props: {
|
|
21540
21649
|
options: {}
|
|
@@ -28012,7 +28121,7 @@ const chat = (options, mountOptions) => {
|
|
|
28012
28121
|
}
|
|
28013
28122
|
return;
|
|
28014
28123
|
}
|
|
28015
|
-
const instance = createVue(options.displayOptions.containerSelector, _sfc_main$
|
|
28124
|
+
const instance = createVue(options.displayOptions.containerSelector, _sfc_main$1m, {
|
|
28016
28125
|
options
|
|
28017
28126
|
});
|
|
28018
28127
|
if (!instance) {
|