@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.mjs
CHANGED
|
@@ -6542,7 +6542,8 @@ const trackLupaEvent = (queryKey, data = {}, options) => {
|
|
|
6542
6542
|
itemId: (_b = data.itemId) != null ? _b : "",
|
|
6543
6543
|
name: data.type,
|
|
6544
6544
|
userId: getUserKey(),
|
|
6545
|
-
sessionId: getSessionKey()
|
|
6545
|
+
sessionId: getSessionKey(),
|
|
6546
|
+
filters: data.filters
|
|
6546
6547
|
};
|
|
6547
6548
|
LupaSearchSdk.track(queryKey, eventData, options);
|
|
6548
6549
|
};
|
|
@@ -6646,9 +6647,6 @@ const track = (queryKey, data = {}, options) => {
|
|
|
6646
6647
|
return;
|
|
6647
6648
|
}
|
|
6648
6649
|
trackAnalyticsEvent(data);
|
|
6649
|
-
if (!hasSearchQuery) {
|
|
6650
|
-
return;
|
|
6651
|
-
}
|
|
6652
6650
|
trackLupaEvent(queryKey, data, options);
|
|
6653
6651
|
};
|
|
6654
6652
|
const DEFAULT_SEARCH_BOX_OPTIONS$1 = {
|
|
@@ -6925,6 +6923,7 @@ var DocumentElementType = /* @__PURE__ */ ((DocumentElementType2) => {
|
|
|
6925
6923
|
var SearchBoxPanelType = /* @__PURE__ */ ((SearchBoxPanelType2) => {
|
|
6926
6924
|
SearchBoxPanelType2["SUGGESTION"] = "suggestion";
|
|
6927
6925
|
SearchBoxPanelType2["DOCUMENT"] = "document";
|
|
6926
|
+
SearchBoxPanelType2["RELATED_SOURCE"] = "related-source";
|
|
6928
6927
|
return SearchBoxPanelType2;
|
|
6929
6928
|
})(SearchBoxPanelType || {});
|
|
6930
6929
|
var BadgeType = /* @__PURE__ */ ((BadgeType2) => {
|
|
@@ -7841,12 +7840,12 @@ const _hoisted_1$1c = { id: "lupa-search-box-input-container" };
|
|
|
7841
7840
|
const _hoisted_2$P = { class: "lupa-input-clear" };
|
|
7842
7841
|
const _hoisted_3$A = { id: "lupa-search-box-input" };
|
|
7843
7842
|
const _hoisted_4$s = ["value"];
|
|
7844
|
-
const _hoisted_5$
|
|
7843
|
+
const _hoisted_5$h = ["aria-label", "placeholder"];
|
|
7845
7844
|
const _hoisted_6$9 = {
|
|
7846
7845
|
key: 0,
|
|
7847
7846
|
class: "lupa-close-label"
|
|
7848
7847
|
};
|
|
7849
|
-
const _sfc_main$
|
|
7848
|
+
const _sfc_main$1l = /* @__PURE__ */ defineComponent({
|
|
7850
7849
|
__name: "SearchBoxInput",
|
|
7851
7850
|
props: {
|
|
7852
7851
|
options: {},
|
|
@@ -7954,7 +7953,7 @@ const _sfc_main$1k = /* @__PURE__ */ defineComponent({
|
|
|
7954
7953
|
placeholder: labels.value.placeholder,
|
|
7955
7954
|
onInput: handleInput,
|
|
7956
7955
|
onFocus: handleFocus
|
|
7957
|
-
}), null, 16, _hoisted_5$
|
|
7956
|
+
}), null, 16, _hoisted_5$h), [
|
|
7958
7957
|
[vModelText, inputValue.value]
|
|
7959
7958
|
])
|
|
7960
7959
|
]),
|
|
@@ -7969,7 +7968,7 @@ const _sfc_main$1k = /* @__PURE__ */ defineComponent({
|
|
|
7969
7968
|
};
|
|
7970
7969
|
}
|
|
7971
7970
|
});
|
|
7972
|
-
const _sfc_main$
|
|
7971
|
+
const _sfc_main$1k = /* @__PURE__ */ defineComponent({
|
|
7973
7972
|
__name: "SearchBoxMoreResults",
|
|
7974
7973
|
props: {
|
|
7975
7974
|
labels: {},
|
|
@@ -8003,7 +8002,7 @@ const _sfc_main$1j = /* @__PURE__ */ defineComponent({
|
|
|
8003
8002
|
});
|
|
8004
8003
|
const _hoisted_1$1b = { class: "lupa-search-box-history-item" };
|
|
8005
8004
|
const _hoisted_2$O = { class: "lupa-search-box-history-item-content" };
|
|
8006
|
-
const _sfc_main$
|
|
8005
|
+
const _sfc_main$1j = /* @__PURE__ */ defineComponent({
|
|
8007
8006
|
__name: "SearchBoxHistoryItem",
|
|
8008
8007
|
props: {
|
|
8009
8008
|
item: {},
|
|
@@ -8038,7 +8037,7 @@ const _hoisted_1$1a = {
|
|
|
8038
8037
|
key: 0,
|
|
8039
8038
|
class: "lupa-search-box-history-panel"
|
|
8040
8039
|
};
|
|
8041
|
-
const _sfc_main$
|
|
8040
|
+
const _sfc_main$1i = /* @__PURE__ */ defineComponent({
|
|
8042
8041
|
__name: "SearchBoxHistoryPanel",
|
|
8043
8042
|
props: {
|
|
8044
8043
|
options: {}
|
|
@@ -8081,7 +8080,7 @@ const _sfc_main$1h = /* @__PURE__ */ defineComponent({
|
|
|
8081
8080
|
return (_ctx, _cache) => {
|
|
8082
8081
|
return hasHistory.value ? (openBlock(), createElementBlock("div", _hoisted_1$1a, [
|
|
8083
8082
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(history), (item, index) => {
|
|
8084
|
-
return openBlock(), createBlock(_sfc_main$
|
|
8083
|
+
return openBlock(), createBlock(_sfc_main$1j, {
|
|
8085
8084
|
key: item,
|
|
8086
8085
|
item,
|
|
8087
8086
|
highlighted: index === highlightIndex.value,
|
|
@@ -8098,7 +8097,7 @@ const _sfc_main$1h = /* @__PURE__ */ defineComponent({
|
|
|
8098
8097
|
}
|
|
8099
8098
|
});
|
|
8100
8099
|
const _hoisted_1$19 = { class: "lupa-search-box-no-results" };
|
|
8101
|
-
const _sfc_main$
|
|
8100
|
+
const _sfc_main$1h = /* @__PURE__ */ defineComponent({
|
|
8102
8101
|
__name: "SearchBoxNoResults",
|
|
8103
8102
|
props: {
|
|
8104
8103
|
labels: {}
|
|
@@ -8124,11 +8123,11 @@ const _hoisted_4$r = {
|
|
|
8124
8123
|
class: "lupa-suggestion-facet-label",
|
|
8125
8124
|
"data-cy": "lupa-suggestion-facet-label"
|
|
8126
8125
|
};
|
|
8127
|
-
const _hoisted_5$
|
|
8126
|
+
const _hoisted_5$g = {
|
|
8128
8127
|
class: "lupa-suggestion-facet-value",
|
|
8129
8128
|
"data-cy": "lupa-suggestion-facet-value"
|
|
8130
8129
|
};
|
|
8131
|
-
const _sfc_main$
|
|
8130
|
+
const _sfc_main$1g = /* @__PURE__ */ defineComponent({
|
|
8132
8131
|
__name: "SearchBoxSuggestion",
|
|
8133
8132
|
props: {
|
|
8134
8133
|
suggestion: {},
|
|
@@ -8167,7 +8166,7 @@ const _sfc_main$1f = /* @__PURE__ */ defineComponent({
|
|
|
8167
8166
|
}, null, 8, _hoisted_1$18)) : (openBlock(), createElementBlock("div", _hoisted_2$N, toDisplayString(_ctx.suggestion.display), 1)),
|
|
8168
8167
|
_ctx.suggestion.facet ? (openBlock(), createElementBlock("div", _hoisted_3$z, [
|
|
8169
8168
|
createBaseVNode("span", _hoisted_4$r, toDisplayString(facetLabel.value), 1),
|
|
8170
|
-
createBaseVNode("span", _hoisted_5$
|
|
8169
|
+
createBaseVNode("span", _hoisted_5$g, toDisplayString(_ctx.suggestion.facet.title), 1)
|
|
8171
8170
|
])) : createCommentVNode("", true)
|
|
8172
8171
|
]);
|
|
8173
8172
|
};
|
|
@@ -8177,7 +8176,7 @@ const _hoisted_1$17 = {
|
|
|
8177
8176
|
id: "lupa-search-box-suggestions",
|
|
8178
8177
|
"data-cy": "lupa-search-box-suggestions"
|
|
8179
8178
|
};
|
|
8180
|
-
const _sfc_main$
|
|
8179
|
+
const _sfc_main$1f = /* @__PURE__ */ defineComponent({
|
|
8181
8180
|
__name: "SearchBoxSuggestions",
|
|
8182
8181
|
props: {
|
|
8183
8182
|
items: {},
|
|
@@ -8239,7 +8238,7 @@ const _sfc_main$1e = /* @__PURE__ */ defineComponent({
|
|
|
8239
8238
|
return (_ctx, _cache) => {
|
|
8240
8239
|
return openBlock(), createElementBlock("div", _hoisted_1$17, [
|
|
8241
8240
|
(openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (item, index) => {
|
|
8242
|
-
return openBlock(), createBlock(_sfc_main$
|
|
8241
|
+
return openBlock(), createBlock(_sfc_main$1g, {
|
|
8243
8242
|
key: getSuggestionKey(item),
|
|
8244
8243
|
class: normalizeClass(["lupa-suggestion", index === highlightedIndex.value ? "lupa-suggestion-highlighted" : ""]),
|
|
8245
8244
|
suggestion: item,
|
|
@@ -8267,7 +8266,7 @@ const debounce$1 = (func, timeout) => {
|
|
|
8267
8266
|
}, timeout);
|
|
8268
8267
|
};
|
|
8269
8268
|
};
|
|
8270
|
-
const _sfc_main$
|
|
8269
|
+
const _sfc_main$1e = /* @__PURE__ */ defineComponent({
|
|
8271
8270
|
__name: "SearchBoxSuggestionsWrapper",
|
|
8272
8271
|
props: {
|
|
8273
8272
|
panel: {},
|
|
@@ -8308,7 +8307,7 @@ const _sfc_main$1d = /* @__PURE__ */ defineComponent({
|
|
|
8308
8307
|
};
|
|
8309
8308
|
const getSuggestionsDebounced = debounce$1(getSuggestions, props.debounce);
|
|
8310
8309
|
return (_ctx, _cache) => {
|
|
8311
|
-
return openBlock(), createBlock(_sfc_main$
|
|
8310
|
+
return openBlock(), createBlock(_sfc_main$1f, {
|
|
8312
8311
|
items: searchResult.value,
|
|
8313
8312
|
highlight: _ctx.panel.highlight,
|
|
8314
8313
|
queryKey: _ctx.panel.queryKey,
|
|
@@ -8394,7 +8393,7 @@ const joinUrlParts = (...parts) => {
|
|
|
8394
8393
|
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 : "";
|
|
8395
8394
|
};
|
|
8396
8395
|
const _hoisted_1$16 = ["src"];
|
|
8397
|
-
const _sfc_main$
|
|
8396
|
+
const _sfc_main$1d = /* @__PURE__ */ defineComponent({
|
|
8398
8397
|
__name: "ProductImage",
|
|
8399
8398
|
props: {
|
|
8400
8399
|
item: {},
|
|
@@ -8452,7 +8451,7 @@ const _sfc_main$1c = /* @__PURE__ */ defineComponent({
|
|
|
8452
8451
|
};
|
|
8453
8452
|
}
|
|
8454
8453
|
});
|
|
8455
|
-
const _sfc_main$
|
|
8454
|
+
const _sfc_main$1c = /* @__PURE__ */ defineComponent({
|
|
8456
8455
|
__name: "SearchBoxProductImage",
|
|
8457
8456
|
props: {
|
|
8458
8457
|
item: {},
|
|
@@ -8460,7 +8459,7 @@ const _sfc_main$1b = /* @__PURE__ */ defineComponent({
|
|
|
8460
8459
|
},
|
|
8461
8460
|
setup(__props) {
|
|
8462
8461
|
return (_ctx, _cache) => {
|
|
8463
|
-
return openBlock(), createBlock(_sfc_main$
|
|
8462
|
+
return openBlock(), createBlock(_sfc_main$1d, {
|
|
8464
8463
|
item: _ctx.item,
|
|
8465
8464
|
options: _ctx.options,
|
|
8466
8465
|
"wrapper-class": "lupa-search-box-image-wrapper",
|
|
@@ -8474,7 +8473,7 @@ const _hoisted_2$M = {
|
|
|
8474
8473
|
key: 1,
|
|
8475
8474
|
class: "lupa-search-box-product-title"
|
|
8476
8475
|
};
|
|
8477
|
-
const _sfc_main$
|
|
8476
|
+
const _sfc_main$1b = /* @__PURE__ */ defineComponent({
|
|
8478
8477
|
__name: "SearchBoxProductTitle",
|
|
8479
8478
|
props: {
|
|
8480
8479
|
item: {},
|
|
@@ -8505,7 +8504,7 @@ const _hoisted_2$L = {
|
|
|
8505
8504
|
key: 1,
|
|
8506
8505
|
class: "lupa-search-box-product-description"
|
|
8507
8506
|
};
|
|
8508
|
-
const _sfc_main$
|
|
8507
|
+
const _sfc_main$1a = /* @__PURE__ */ defineComponent({
|
|
8509
8508
|
__name: "SearchBoxProductDescription",
|
|
8510
8509
|
props: {
|
|
8511
8510
|
item: {},
|
|
@@ -8530,7 +8529,7 @@ const _sfc_main$19 = /* @__PURE__ */ defineComponent({
|
|
|
8530
8529
|
}
|
|
8531
8530
|
});
|
|
8532
8531
|
const _hoisted_1$13 = { class: "lupa-search-box-product-price" };
|
|
8533
|
-
const _sfc_main$
|
|
8532
|
+
const _sfc_main$19 = /* @__PURE__ */ defineComponent({
|
|
8534
8533
|
__name: "SearchBoxProductPrice",
|
|
8535
8534
|
props: {
|
|
8536
8535
|
item: {},
|
|
@@ -8555,7 +8554,7 @@ const _sfc_main$18 = /* @__PURE__ */ defineComponent({
|
|
|
8555
8554
|
}
|
|
8556
8555
|
});
|
|
8557
8556
|
const _hoisted_1$12 = { class: "lupa-search-box-product-regular-price" };
|
|
8558
|
-
const _sfc_main$
|
|
8557
|
+
const _sfc_main$18 = /* @__PURE__ */ defineComponent({
|
|
8559
8558
|
__name: "SearchBoxProductRegularPrice",
|
|
8560
8559
|
props: {
|
|
8561
8560
|
item: {},
|
|
@@ -8581,8 +8580,8 @@ const _hoisted_1$11 = ["innerHTML"];
|
|
|
8581
8580
|
const _hoisted_2$K = { key: 0 };
|
|
8582
8581
|
const _hoisted_3$y = { key: 1 };
|
|
8583
8582
|
const _hoisted_4$q = { class: "lupa-search-box-custom-label" };
|
|
8584
|
-
const _hoisted_5$
|
|
8585
|
-
const _sfc_main$
|
|
8583
|
+
const _hoisted_5$f = { class: "lupa-search-box-custom-text" };
|
|
8584
|
+
const _sfc_main$17 = /* @__PURE__ */ defineComponent({
|
|
8586
8585
|
__name: "SearchBoxProductCustom",
|
|
8587
8586
|
props: {
|
|
8588
8587
|
item: {},
|
|
@@ -8614,14 +8613,14 @@ const _sfc_main$16 = /* @__PURE__ */ defineComponent({
|
|
|
8614
8613
|
}, toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), [
|
|
8615
8614
|
!label.value ? (openBlock(), createElementBlock("div", _hoisted_2$K, toDisplayString(text.value), 1)) : (openBlock(), createElementBlock("div", _hoisted_3$y, [
|
|
8616
8615
|
createBaseVNode("div", _hoisted_4$q, toDisplayString(label.value), 1),
|
|
8617
|
-
createBaseVNode("div", _hoisted_5$
|
|
8616
|
+
createBaseVNode("div", _hoisted_5$f, toDisplayString(text.value), 1)
|
|
8618
8617
|
]))
|
|
8619
8618
|
], 16));
|
|
8620
8619
|
};
|
|
8621
8620
|
}
|
|
8622
8621
|
});
|
|
8623
8622
|
const _hoisted_1$10 = ["innerHTML"];
|
|
8624
|
-
const _sfc_main$
|
|
8623
|
+
const _sfc_main$16 = /* @__PURE__ */ defineComponent({
|
|
8625
8624
|
__name: "SearchBoxProductCustomHtml",
|
|
8626
8625
|
props: {
|
|
8627
8626
|
item: {},
|
|
@@ -8838,7 +8837,7 @@ const useSearchResultStore = defineStore("searchResult", () => {
|
|
|
8838
8837
|
const _hoisted_1$$ = { class: "lupa-search-box-add-to-cart-wrapper" };
|
|
8839
8838
|
const _hoisted_2$J = { class: "lupa-search-box-product-addtocart" };
|
|
8840
8839
|
const _hoisted_3$x = ["onClick", "disabled"];
|
|
8841
|
-
const _sfc_main$
|
|
8840
|
+
const _sfc_main$15 = /* @__PURE__ */ defineComponent({
|
|
8842
8841
|
__name: "SearchBoxProductAddToCart",
|
|
8843
8842
|
props: {
|
|
8844
8843
|
item: {},
|
|
@@ -8881,17 +8880,17 @@ const _sfc_main$14 = /* @__PURE__ */ defineComponent({
|
|
|
8881
8880
|
});
|
|
8882
8881
|
const __default__$4 = {
|
|
8883
8882
|
components: {
|
|
8884
|
-
SearchBoxProductImage: _sfc_main$
|
|
8885
|
-
SearchBoxProductTitle: _sfc_main$
|
|
8886
|
-
SearchBoxProductDescription: _sfc_main$
|
|
8887
|
-
SearchBoxProductPrice: _sfc_main$
|
|
8888
|
-
SearchBoxProductRegularPrice: _sfc_main$
|
|
8889
|
-
SearchBoxProductCustom: _sfc_main$
|
|
8890
|
-
SearchBoxProductCustomHtml: _sfc_main$
|
|
8891
|
-
SearchBoxProductAddToCart: _sfc_main$
|
|
8883
|
+
SearchBoxProductImage: _sfc_main$1c,
|
|
8884
|
+
SearchBoxProductTitle: _sfc_main$1b,
|
|
8885
|
+
SearchBoxProductDescription: _sfc_main$1a,
|
|
8886
|
+
SearchBoxProductPrice: _sfc_main$19,
|
|
8887
|
+
SearchBoxProductRegularPrice: _sfc_main$18,
|
|
8888
|
+
SearchBoxProductCustom: _sfc_main$17,
|
|
8889
|
+
SearchBoxProductCustomHtml: _sfc_main$16,
|
|
8890
|
+
SearchBoxProductAddToCart: _sfc_main$15
|
|
8892
8891
|
}
|
|
8893
8892
|
};
|
|
8894
|
-
const _sfc_main$
|
|
8893
|
+
const _sfc_main$14 = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValues2({}, __default__$4), {
|
|
8895
8894
|
__name: "SearchBoxProductElement",
|
|
8896
8895
|
props: {
|
|
8897
8896
|
item: {},
|
|
@@ -8957,7 +8956,7 @@ const _hoisted_4$p = {
|
|
|
8957
8956
|
key: 0,
|
|
8958
8957
|
class: "lupa-search-box-product-add-to-cart-section"
|
|
8959
8958
|
};
|
|
8960
|
-
const _sfc_main$
|
|
8959
|
+
const _sfc_main$13 = /* @__PURE__ */ defineComponent({
|
|
8961
8960
|
__name: "SearchBoxProduct",
|
|
8962
8961
|
props: {
|
|
8963
8962
|
item: {},
|
|
@@ -9015,7 +9014,7 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
|
|
|
9015
9014
|
}), [
|
|
9016
9015
|
createBaseVNode("div", _hoisted_2$I, [
|
|
9017
9016
|
(openBlock(true), createElementBlock(Fragment, null, renderList(imageElements.value, (element) => {
|
|
9018
|
-
return openBlock(), createBlock(_sfc_main$
|
|
9017
|
+
return openBlock(), createBlock(_sfc_main$14, {
|
|
9019
9018
|
class: "lupa-search-box-product-element",
|
|
9020
9019
|
item: _ctx.item,
|
|
9021
9020
|
element,
|
|
@@ -9027,7 +9026,7 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
|
|
|
9027
9026
|
]),
|
|
9028
9027
|
createBaseVNode("div", _hoisted_3$w, [
|
|
9029
9028
|
(openBlock(true), createElementBlock(Fragment, null, renderList(detailElements.value, (element) => {
|
|
9030
|
-
return openBlock(), createBlock(_sfc_main$
|
|
9029
|
+
return openBlock(), createBlock(_sfc_main$14, {
|
|
9031
9030
|
class: "lupa-search-box-product-element",
|
|
9032
9031
|
item: _ctx.item,
|
|
9033
9032
|
element,
|
|
@@ -9038,7 +9037,7 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
|
|
|
9038
9037
|
}), 128))
|
|
9039
9038
|
]),
|
|
9040
9039
|
addToCartElement.value ? (openBlock(), createElementBlock("div", _hoisted_4$p, [
|
|
9041
|
-
createVNode(_sfc_main$
|
|
9040
|
+
createVNode(_sfc_main$14, {
|
|
9042
9041
|
class: "lupa-search-box-product-element",
|
|
9043
9042
|
item: _ctx.item,
|
|
9044
9043
|
element: addToCartElement.value,
|
|
@@ -9062,6 +9061,7 @@ const getSearchTrackingData = (searchText, type) => {
|
|
|
9062
9061
|
};
|
|
9063
9062
|
const useTrackingStore = defineStore("tracking", () => {
|
|
9064
9063
|
const optionsStore = useOptionsStore();
|
|
9064
|
+
const searchResultStore = useSearchResultStore();
|
|
9065
9065
|
const trackSearch = ({
|
|
9066
9066
|
queryKey,
|
|
9067
9067
|
query,
|
|
@@ -9099,7 +9099,8 @@ const useTrackingStore = defineStore("tracking", () => {
|
|
|
9099
9099
|
track(
|
|
9100
9100
|
queryKey,
|
|
9101
9101
|
__spreadProps2(__spreadValues2({}, data), {
|
|
9102
|
-
analytics: data.analytics ? __spreadProps2(__spreadValues2({}, data.analytics), { items: mappedItems }) : void 0
|
|
9102
|
+
analytics: data.analytics ? __spreadProps2(__spreadValues2({}, data.analytics), { items: mappedItems }) : void 0,
|
|
9103
|
+
filters: searchResultStore.hasAnyFilter ? searchResultStore.filters : void 0
|
|
9103
9104
|
}),
|
|
9104
9105
|
options
|
|
9105
9106
|
);
|
|
@@ -9107,7 +9108,7 @@ const useTrackingStore = defineStore("tracking", () => {
|
|
|
9107
9108
|
return { trackSearch, trackResults, trackEvent };
|
|
9108
9109
|
});
|
|
9109
9110
|
const _hoisted_1$Z = { id: "lupa-search-box-products" };
|
|
9110
|
-
const _sfc_main$
|
|
9111
|
+
const _sfc_main$12 = /* @__PURE__ */ defineComponent({
|
|
9111
9112
|
__name: "SearchBoxProducts",
|
|
9112
9113
|
props: {
|
|
9113
9114
|
items: {},
|
|
@@ -9180,7 +9181,7 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
|
|
|
9180
9181
|
itemClicked: handleProductClick
|
|
9181
9182
|
});
|
|
9182
9183
|
}), 128)) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(_ctx.items, (item, index) => {
|
|
9183
|
-
return openBlock(), createBlock(_sfc_main$
|
|
9184
|
+
return openBlock(), createBlock(_sfc_main$13, {
|
|
9184
9185
|
key: index,
|
|
9185
9186
|
item,
|
|
9186
9187
|
panelOptions: _ctx.panelOptions,
|
|
@@ -9194,7 +9195,7 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
|
|
|
9194
9195
|
};
|
|
9195
9196
|
}
|
|
9196
9197
|
});
|
|
9197
|
-
const _sfc_main$
|
|
9198
|
+
const _sfc_main$11 = /* @__PURE__ */ defineComponent({
|
|
9198
9199
|
__name: "SearchBoxProductsWrapper",
|
|
9199
9200
|
props: {
|
|
9200
9201
|
panel: {},
|
|
@@ -9246,7 +9247,7 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
|
|
|
9246
9247
|
const getItemsDebounced = debounce$1(getItems, props.debounce);
|
|
9247
9248
|
return (_ctx, _cache) => {
|
|
9248
9249
|
var _a, _b;
|
|
9249
|
-
return openBlock(), createBlock(_sfc_main$
|
|
9250
|
+
return openBlock(), createBlock(_sfc_main$12, {
|
|
9250
9251
|
items: (_b = (_a = searchResult.value) == null ? void 0 : _a.items) != null ? _b : [],
|
|
9251
9252
|
panelOptions: _ctx.panel,
|
|
9252
9253
|
labels: _ctx.labels,
|
|
@@ -9264,6 +9265,95 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
|
|
|
9264
9265
|
};
|
|
9265
9266
|
}
|
|
9266
9267
|
});
|
|
9268
|
+
const _sfc_main$10 = /* @__PURE__ */ defineComponent({
|
|
9269
|
+
__name: "SearchBoxRelatedSourceWrapper",
|
|
9270
|
+
props: {
|
|
9271
|
+
panel: {},
|
|
9272
|
+
inputValue: {},
|
|
9273
|
+
options: {},
|
|
9274
|
+
labels: {},
|
|
9275
|
+
debounce: {}
|
|
9276
|
+
},
|
|
9277
|
+
emits: ["fetched"],
|
|
9278
|
+
setup(__props, { emit: emit2 }) {
|
|
9279
|
+
const props = __props;
|
|
9280
|
+
const searchBoxStore = useSearchBoxStore();
|
|
9281
|
+
const { docResults } = storeToRefs(searchBoxStore);
|
|
9282
|
+
const searchResult = ref(null);
|
|
9283
|
+
const options = computed(() => props.options);
|
|
9284
|
+
const relatedSourceIds = computed(() => {
|
|
9285
|
+
var _a, _b, _c;
|
|
9286
|
+
const queryKey = (_a = props.panel.sourceIds) == null ? void 0 : _a.queryKey;
|
|
9287
|
+
if (!queryKey) {
|
|
9288
|
+
return [];
|
|
9289
|
+
}
|
|
9290
|
+
const currentDocumentItems = (_c = (_b = docResults == null ? void 0 : docResults.value[queryKey]) == null ? void 0 : _b.items) != null ? _c : [];
|
|
9291
|
+
const allFieldValues = currentDocumentItems.map((item) => item[props.panel.sourceIds.field]).flat();
|
|
9292
|
+
const uniqueFieldValues = Array.from(new Set(allFieldValues));
|
|
9293
|
+
return uniqueFieldValues;
|
|
9294
|
+
});
|
|
9295
|
+
const inputValueProp = computed(() => props.inputValue);
|
|
9296
|
+
onMounted(() => {
|
|
9297
|
+
getItemsDebounced();
|
|
9298
|
+
});
|
|
9299
|
+
watch(relatedSourceIds, () => {
|
|
9300
|
+
getItemsDebounced();
|
|
9301
|
+
});
|
|
9302
|
+
watch(inputValueProp, () => {
|
|
9303
|
+
getItemsDebounced();
|
|
9304
|
+
});
|
|
9305
|
+
const fetchRelatedItems = () => __async(this, null, function* () {
|
|
9306
|
+
var _a, _b;
|
|
9307
|
+
if (!((_a = props.panel.target) == null ? void 0 : _a.queryKey) || !relatedSourceIds.value.length) {
|
|
9308
|
+
return { items: [], success: true, searchText: "", total: 0 };
|
|
9309
|
+
}
|
|
9310
|
+
try {
|
|
9311
|
+
const result = yield LupaSearchSdk.queryByIds(
|
|
9312
|
+
(_b = props.panel.target) == null ? void 0 : _b.queryKey,
|
|
9313
|
+
relatedSourceIds.value,
|
|
9314
|
+
options.value
|
|
9315
|
+
);
|
|
9316
|
+
if (!result.success) {
|
|
9317
|
+
return { items: [], success: true, searchText: "", total: 0 };
|
|
9318
|
+
}
|
|
9319
|
+
return result;
|
|
9320
|
+
} catch (err) {
|
|
9321
|
+
console.error(err);
|
|
9322
|
+
if (options == null ? void 0 : options.value.onError) {
|
|
9323
|
+
options.value.onError(err);
|
|
9324
|
+
}
|
|
9325
|
+
return { items: [], success: true, searchText: "", total: 0 };
|
|
9326
|
+
}
|
|
9327
|
+
});
|
|
9328
|
+
const getItems = () => __async(this, null, function* () {
|
|
9329
|
+
searchResult.value = yield fetchRelatedItems();
|
|
9330
|
+
});
|
|
9331
|
+
const getItemsDebounced = debounce$1(getItems, props.debounce);
|
|
9332
|
+
const documentPanelOptions = computed(() => {
|
|
9333
|
+
return __spreadProps2(__spreadValues2({}, props.panel), {
|
|
9334
|
+
type: SearchBoxPanelType.DOCUMENT
|
|
9335
|
+
});
|
|
9336
|
+
});
|
|
9337
|
+
return (_ctx, _cache) => {
|
|
9338
|
+
var _a, _b;
|
|
9339
|
+
return openBlock(), createBlock(_sfc_main$12, {
|
|
9340
|
+
items: (_b = (_a = searchResult.value) == null ? void 0 : _a.items) != null ? _b : [],
|
|
9341
|
+
panelOptions: documentPanelOptions.value,
|
|
9342
|
+
labels: _ctx.labels,
|
|
9343
|
+
inputValue: _ctx.inputValue,
|
|
9344
|
+
onProductClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("product-click"))
|
|
9345
|
+
}, createSlots({ _: 2 }, [
|
|
9346
|
+
_ctx.$slots.productCard ? {
|
|
9347
|
+
name: "productCard",
|
|
9348
|
+
fn: withCtx((props2) => [
|
|
9349
|
+
renderSlot(_ctx.$slots, "productCard", normalizeProps(guardReactiveProps(props2)))
|
|
9350
|
+
]),
|
|
9351
|
+
key: "0"
|
|
9352
|
+
} : void 0
|
|
9353
|
+
]), 1032, ["items", "panelOptions", "labels", "inputValue"]);
|
|
9354
|
+
};
|
|
9355
|
+
}
|
|
9356
|
+
});
|
|
9267
9357
|
const _hoisted_1$Y = {
|
|
9268
9358
|
key: 0,
|
|
9269
9359
|
id: "lupa-search-box-panel"
|
|
@@ -9271,16 +9361,21 @@ const _hoisted_1$Y = {
|
|
|
9271
9361
|
const _hoisted_2$H = ["data-cy"];
|
|
9272
9362
|
const _hoisted_3$v = {
|
|
9273
9363
|
key: 0,
|
|
9274
|
-
class: "lupa-panel-title"
|
|
9364
|
+
class: "lupa-panel-title lupa-panel-title-top-results"
|
|
9275
9365
|
};
|
|
9276
9366
|
const _hoisted_4$o = {
|
|
9367
|
+
key: 1,
|
|
9368
|
+
class: "lupa-panel-title"
|
|
9369
|
+
};
|
|
9370
|
+
const _hoisted_5$e = {
|
|
9277
9371
|
key: 1,
|
|
9278
9372
|
id: "lupa-search-box-panel"
|
|
9279
9373
|
};
|
|
9280
9374
|
const __default__$3 = {
|
|
9281
9375
|
components: {
|
|
9282
|
-
SearchBoxSuggestionsWrapper: _sfc_main$
|
|
9283
|
-
SearchBoxProductsWrapper: _sfc_main$
|
|
9376
|
+
SearchBoxSuggestionsWrapper: _sfc_main$1e,
|
|
9377
|
+
SearchBoxProductsWrapper: _sfc_main$11,
|
|
9378
|
+
SearchBoxRelatedSourceWrapper: _sfc_main$10
|
|
9284
9379
|
}
|
|
9285
9380
|
};
|
|
9286
9381
|
const _sfc_main$$ = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValues2({}, __default__$3), {
|
|
@@ -9374,6 +9469,8 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
|
|
|
9374
9469
|
switch (type) {
|
|
9375
9470
|
case "suggestion":
|
|
9376
9471
|
return "SearchBoxSuggestionsWrapper";
|
|
9472
|
+
case "related-source":
|
|
9473
|
+
return "SearchBoxRelatedSourceWrapper";
|
|
9377
9474
|
default:
|
|
9378
9475
|
return "SearchBoxProductsWrapper";
|
|
9379
9476
|
}
|
|
@@ -9399,6 +9496,17 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
|
|
|
9399
9496
|
const panel = panelItemCounts.value.find((v) => v.queryKey === queryKey);
|
|
9400
9497
|
return (panel == null ? void 0 : panel.count) > 0 && (panel == null ? void 0 : panel.input.length) < 1;
|
|
9401
9498
|
};
|
|
9499
|
+
const canShowPanel = (panel) => {
|
|
9500
|
+
var _a, _b, _c;
|
|
9501
|
+
if (!((_a = panel.visibility) == null ? void 0 : _a.showWhenKeyHasNoResults)) {
|
|
9502
|
+
return true;
|
|
9503
|
+
}
|
|
9504
|
+
const resultCountFromRelatedPanel = (_c = (_b = panelItemCounts.value.find((v) => {
|
|
9505
|
+
var _a2;
|
|
9506
|
+
return v.queryKey === ((_a2 = panel.visibility) == null ? void 0 : _a2.showWhenKeyHasNoResults);
|
|
9507
|
+
})) == null ? void 0 : _b.count) != null ? _c : 0;
|
|
9508
|
+
return resultCountFromRelatedPanel < 1;
|
|
9509
|
+
};
|
|
9402
9510
|
return (_ctx, _cache) => {
|
|
9403
9511
|
var _a;
|
|
9404
9512
|
return openBlock(), createElementBlock("div", {
|
|
@@ -9412,7 +9520,7 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
|
|
|
9412
9520
|
"data-cy": "lupa-main-panel"
|
|
9413
9521
|
}, [
|
|
9414
9522
|
(openBlock(true), createElementBlock(Fragment, null, renderList(displayPanels.value, (panel, index) => {
|
|
9415
|
-
var _a2, _b;
|
|
9523
|
+
var _a2, _b, _c, _d;
|
|
9416
9524
|
return openBlock(), createElementBlock("div", {
|
|
9417
9525
|
key: index,
|
|
9418
9526
|
class: normalizeClass([
|
|
@@ -9422,8 +9530,9 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
|
|
|
9422
9530
|
"data-cy": "lupa-panel-" + panel.type + "-index"
|
|
9423
9531
|
}, [
|
|
9424
9532
|
((_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),
|
|
9425
|
-
panel.
|
|
9426
|
-
|
|
9533
|
+
((_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),
|
|
9534
|
+
panel.queryKey && canShowPanel(panel) ? (openBlock(), createBlock(resolveDynamicComponent(getComponent(panel.type)), {
|
|
9535
|
+
key: 2,
|
|
9427
9536
|
panel,
|
|
9428
9537
|
options: sdkOptions.value,
|
|
9429
9538
|
debounce: _ctx.options.debounce,
|
|
@@ -9444,18 +9553,18 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
|
|
|
9444
9553
|
], 10, _hoisted_2$H);
|
|
9445
9554
|
}), 128))
|
|
9446
9555
|
], 4),
|
|
9447
|
-
!unref(hasAnyResults) && _ctx.options.showNoResultsPanel ? (openBlock(), createBlock(_sfc_main$
|
|
9556
|
+
!unref(hasAnyResults) && _ctx.options.showNoResultsPanel ? (openBlock(), createBlock(_sfc_main$1h, {
|
|
9448
9557
|
key: 0,
|
|
9449
9558
|
labels: labels.value
|
|
9450
9559
|
}, null, 8, ["labels"])) : createCommentVNode("", true),
|
|
9451
|
-
unref(hasAnyResults) || !_ctx.options.hideMoreResultsButtonOnNoResults ? (openBlock(), createBlock(_sfc_main$
|
|
9560
|
+
unref(hasAnyResults) || !_ctx.options.hideMoreResultsButtonOnNoResults ? (openBlock(), createBlock(_sfc_main$1k, {
|
|
9452
9561
|
key: 1,
|
|
9453
9562
|
labels: labels.value,
|
|
9454
9563
|
showTotalCount: (_a = _ctx.options.showTotalCount) != null ? _a : false,
|
|
9455
9564
|
onGoToResults: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("go-to-results"))
|
|
9456
9565
|
}, null, 8, ["labels", "showTotalCount"])) : createCommentVNode("", true)
|
|
9457
|
-
])) : displayHistory.value ? (openBlock(), createElementBlock("div",
|
|
9458
|
-
createVNode(_sfc_main$
|
|
9566
|
+
])) : displayHistory.value ? (openBlock(), createElementBlock("div", _hoisted_5$e, [
|
|
9567
|
+
createVNode(_sfc_main$1i, {
|
|
9459
9568
|
options: _ctx.options.history,
|
|
9460
9569
|
history: history.value,
|
|
9461
9570
|
onGoToResults: handleGoToResults,
|
|
@@ -9725,7 +9834,7 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent({
|
|
|
9725
9834
|
var _a2;
|
|
9726
9835
|
return openBlock(), createElementBlock("div", _hoisted_1$X, [
|
|
9727
9836
|
createBaseVNode("div", _hoisted_2$G, [
|
|
9728
|
-
createVNode(_sfc_main$
|
|
9837
|
+
createVNode(_sfc_main$1l, {
|
|
9729
9838
|
options: inputOptions.value,
|
|
9730
9839
|
suggestedValue: suggestedValue.value,
|
|
9731
9840
|
"can-close": (_a2 = _ctx.isSearchContainer) != null ? _a2 : false,
|
|
@@ -13020,7 +13129,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
13020
13129
|
},
|
|
13021
13130
|
setup(__props) {
|
|
13022
13131
|
return (_ctx, _cache) => {
|
|
13023
|
-
return openBlock(), createBlock(_sfc_main$
|
|
13132
|
+
return openBlock(), createBlock(_sfc_main$1d, {
|
|
13024
13133
|
item: _ctx.item,
|
|
13025
13134
|
options: _ctx.options,
|
|
13026
13135
|
"wrapper-class": "lupa-search-results-image-wrapper",
|
|
@@ -21532,7 +21641,7 @@ const _hoisted_4 = {
|
|
|
21532
21641
|
class: "lupa-chat-spinner-main"
|
|
21533
21642
|
};
|
|
21534
21643
|
const _hoisted_5 = { class: "lupasearch-chat-input" };
|
|
21535
|
-
const _sfc_main$
|
|
21644
|
+
const _sfc_main$1m = /* @__PURE__ */ defineComponent({
|
|
21536
21645
|
__name: "ChatContainer",
|
|
21537
21646
|
props: {
|
|
21538
21647
|
options: {}
|
|
@@ -28010,7 +28119,7 @@ const chat = (options, mountOptions) => {
|
|
|
28010
28119
|
}
|
|
28011
28120
|
return;
|
|
28012
28121
|
}
|
|
28013
|
-
const instance = createVue(options.displayOptions.containerSelector, _sfc_main$
|
|
28122
|
+
const instance = createVue(options.displayOptions.containerSelector, _sfc_main$1m, {
|
|
28014
28123
|
options
|
|
28015
28124
|
});
|
|
28016
28125
|
if (!instance) {
|