@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.umd.js
CHANGED
|
@@ -6546,7 +6546,8 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
6546
6546
|
itemId: (_b = data.itemId) != null ? _b : "",
|
|
6547
6547
|
name: data.type,
|
|
6548
6548
|
userId: getUserKey(),
|
|
6549
|
-
sessionId: getSessionKey()
|
|
6549
|
+
sessionId: getSessionKey(),
|
|
6550
|
+
filters: data.filters
|
|
6550
6551
|
};
|
|
6551
6552
|
LupaSearchSdk.track(queryKey, eventData, options);
|
|
6552
6553
|
};
|
|
@@ -6650,9 +6651,6 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
6650
6651
|
return;
|
|
6651
6652
|
}
|
|
6652
6653
|
trackAnalyticsEvent(data);
|
|
6653
|
-
if (!hasSearchQuery) {
|
|
6654
|
-
return;
|
|
6655
|
-
}
|
|
6656
6654
|
trackLupaEvent(queryKey, data, options);
|
|
6657
6655
|
};
|
|
6658
6656
|
const DEFAULT_SEARCH_BOX_OPTIONS$1 = {
|
|
@@ -6929,6 +6927,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
6929
6927
|
var SearchBoxPanelType = /* @__PURE__ */ ((SearchBoxPanelType2) => {
|
|
6930
6928
|
SearchBoxPanelType2["SUGGESTION"] = "suggestion";
|
|
6931
6929
|
SearchBoxPanelType2["DOCUMENT"] = "document";
|
|
6930
|
+
SearchBoxPanelType2["RELATED_SOURCE"] = "related-source";
|
|
6932
6931
|
return SearchBoxPanelType2;
|
|
6933
6932
|
})(SearchBoxPanelType || {});
|
|
6934
6933
|
var BadgeType = /* @__PURE__ */ ((BadgeType2) => {
|
|
@@ -7845,12 +7844,12 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
7845
7844
|
const _hoisted_2$P = { class: "lupa-input-clear" };
|
|
7846
7845
|
const _hoisted_3$A = { id: "lupa-search-box-input" };
|
|
7847
7846
|
const _hoisted_4$s = ["value"];
|
|
7848
|
-
const _hoisted_5$
|
|
7847
|
+
const _hoisted_5$h = ["aria-label", "placeholder"];
|
|
7849
7848
|
const _hoisted_6$9 = {
|
|
7850
7849
|
key: 0,
|
|
7851
7850
|
class: "lupa-close-label"
|
|
7852
7851
|
};
|
|
7853
|
-
const _sfc_main$
|
|
7852
|
+
const _sfc_main$1l = /* @__PURE__ */ defineComponent({
|
|
7854
7853
|
__name: "SearchBoxInput",
|
|
7855
7854
|
props: {
|
|
7856
7855
|
options: {},
|
|
@@ -7958,7 +7957,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
7958
7957
|
placeholder: labels.value.placeholder,
|
|
7959
7958
|
onInput: handleInput,
|
|
7960
7959
|
onFocus: handleFocus
|
|
7961
|
-
}), null, 16, _hoisted_5$
|
|
7960
|
+
}), null, 16, _hoisted_5$h), [
|
|
7962
7961
|
[vModelText, inputValue.value]
|
|
7963
7962
|
])
|
|
7964
7963
|
]),
|
|
@@ -7973,7 +7972,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
7973
7972
|
};
|
|
7974
7973
|
}
|
|
7975
7974
|
});
|
|
7976
|
-
const _sfc_main$
|
|
7975
|
+
const _sfc_main$1k = /* @__PURE__ */ defineComponent({
|
|
7977
7976
|
__name: "SearchBoxMoreResults",
|
|
7978
7977
|
props: {
|
|
7979
7978
|
labels: {},
|
|
@@ -8007,7 +8006,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8007
8006
|
});
|
|
8008
8007
|
const _hoisted_1$1b = { class: "lupa-search-box-history-item" };
|
|
8009
8008
|
const _hoisted_2$O = { class: "lupa-search-box-history-item-content" };
|
|
8010
|
-
const _sfc_main$
|
|
8009
|
+
const _sfc_main$1j = /* @__PURE__ */ defineComponent({
|
|
8011
8010
|
__name: "SearchBoxHistoryItem",
|
|
8012
8011
|
props: {
|
|
8013
8012
|
item: {},
|
|
@@ -8042,7 +8041,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8042
8041
|
key: 0,
|
|
8043
8042
|
class: "lupa-search-box-history-panel"
|
|
8044
8043
|
};
|
|
8045
|
-
const _sfc_main$
|
|
8044
|
+
const _sfc_main$1i = /* @__PURE__ */ defineComponent({
|
|
8046
8045
|
__name: "SearchBoxHistoryPanel",
|
|
8047
8046
|
props: {
|
|
8048
8047
|
options: {}
|
|
@@ -8085,7 +8084,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8085
8084
|
return (_ctx, _cache) => {
|
|
8086
8085
|
return hasHistory.value ? (openBlock(), createElementBlock("div", _hoisted_1$1a, [
|
|
8087
8086
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(history), (item, index) => {
|
|
8088
|
-
return openBlock(), createBlock(_sfc_main$
|
|
8087
|
+
return openBlock(), createBlock(_sfc_main$1j, {
|
|
8089
8088
|
key: item,
|
|
8090
8089
|
item,
|
|
8091
8090
|
highlighted: index === highlightIndex.value,
|
|
@@ -8102,7 +8101,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8102
8101
|
}
|
|
8103
8102
|
});
|
|
8104
8103
|
const _hoisted_1$19 = { class: "lupa-search-box-no-results" };
|
|
8105
|
-
const _sfc_main$
|
|
8104
|
+
const _sfc_main$1h = /* @__PURE__ */ defineComponent({
|
|
8106
8105
|
__name: "SearchBoxNoResults",
|
|
8107
8106
|
props: {
|
|
8108
8107
|
labels: {}
|
|
@@ -8128,11 +8127,11 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8128
8127
|
class: "lupa-suggestion-facet-label",
|
|
8129
8128
|
"data-cy": "lupa-suggestion-facet-label"
|
|
8130
8129
|
};
|
|
8131
|
-
const _hoisted_5$
|
|
8130
|
+
const _hoisted_5$g = {
|
|
8132
8131
|
class: "lupa-suggestion-facet-value",
|
|
8133
8132
|
"data-cy": "lupa-suggestion-facet-value"
|
|
8134
8133
|
};
|
|
8135
|
-
const _sfc_main$
|
|
8134
|
+
const _sfc_main$1g = /* @__PURE__ */ defineComponent({
|
|
8136
8135
|
__name: "SearchBoxSuggestion",
|
|
8137
8136
|
props: {
|
|
8138
8137
|
suggestion: {},
|
|
@@ -8171,7 +8170,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8171
8170
|
}, null, 8, _hoisted_1$18)) : (openBlock(), createElementBlock("div", _hoisted_2$N, toDisplayString(_ctx.suggestion.display), 1)),
|
|
8172
8171
|
_ctx.suggestion.facet ? (openBlock(), createElementBlock("div", _hoisted_3$z, [
|
|
8173
8172
|
createBaseVNode("span", _hoisted_4$r, toDisplayString(facetLabel.value), 1),
|
|
8174
|
-
createBaseVNode("span", _hoisted_5$
|
|
8173
|
+
createBaseVNode("span", _hoisted_5$g, toDisplayString(_ctx.suggestion.facet.title), 1)
|
|
8175
8174
|
])) : createCommentVNode("", true)
|
|
8176
8175
|
]);
|
|
8177
8176
|
};
|
|
@@ -8181,7 +8180,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8181
8180
|
id: "lupa-search-box-suggestions",
|
|
8182
8181
|
"data-cy": "lupa-search-box-suggestions"
|
|
8183
8182
|
};
|
|
8184
|
-
const _sfc_main$
|
|
8183
|
+
const _sfc_main$1f = /* @__PURE__ */ defineComponent({
|
|
8185
8184
|
__name: "SearchBoxSuggestions",
|
|
8186
8185
|
props: {
|
|
8187
8186
|
items: {},
|
|
@@ -8243,7 +8242,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8243
8242
|
return (_ctx, _cache) => {
|
|
8244
8243
|
return openBlock(), createElementBlock("div", _hoisted_1$17, [
|
|
8245
8244
|
(openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (item, index) => {
|
|
8246
|
-
return openBlock(), createBlock(_sfc_main$
|
|
8245
|
+
return openBlock(), createBlock(_sfc_main$1g, {
|
|
8247
8246
|
key: getSuggestionKey(item),
|
|
8248
8247
|
class: normalizeClass(["lupa-suggestion", index === highlightedIndex.value ? "lupa-suggestion-highlighted" : ""]),
|
|
8249
8248
|
suggestion: item,
|
|
@@ -8271,7 +8270,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8271
8270
|
}, timeout);
|
|
8272
8271
|
};
|
|
8273
8272
|
};
|
|
8274
|
-
const _sfc_main$
|
|
8273
|
+
const _sfc_main$1e = /* @__PURE__ */ defineComponent({
|
|
8275
8274
|
__name: "SearchBoxSuggestionsWrapper",
|
|
8276
8275
|
props: {
|
|
8277
8276
|
panel: {},
|
|
@@ -8312,7 +8311,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8312
8311
|
};
|
|
8313
8312
|
const getSuggestionsDebounced = debounce$1(getSuggestions, props.debounce);
|
|
8314
8313
|
return (_ctx, _cache) => {
|
|
8315
|
-
return openBlock(), createBlock(_sfc_main$
|
|
8314
|
+
return openBlock(), createBlock(_sfc_main$1f, {
|
|
8316
8315
|
items: searchResult.value,
|
|
8317
8316
|
highlight: _ctx.panel.highlight,
|
|
8318
8317
|
queryKey: _ctx.panel.queryKey,
|
|
@@ -8398,7 +8397,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8398
8397
|
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 : "";
|
|
8399
8398
|
};
|
|
8400
8399
|
const _hoisted_1$16 = ["src"];
|
|
8401
|
-
const _sfc_main$
|
|
8400
|
+
const _sfc_main$1d = /* @__PURE__ */ defineComponent({
|
|
8402
8401
|
__name: "ProductImage",
|
|
8403
8402
|
props: {
|
|
8404
8403
|
item: {},
|
|
@@ -8456,7 +8455,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8456
8455
|
};
|
|
8457
8456
|
}
|
|
8458
8457
|
});
|
|
8459
|
-
const _sfc_main$
|
|
8458
|
+
const _sfc_main$1c = /* @__PURE__ */ defineComponent({
|
|
8460
8459
|
__name: "SearchBoxProductImage",
|
|
8461
8460
|
props: {
|
|
8462
8461
|
item: {},
|
|
@@ -8464,7 +8463,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8464
8463
|
},
|
|
8465
8464
|
setup(__props) {
|
|
8466
8465
|
return (_ctx, _cache) => {
|
|
8467
|
-
return openBlock(), createBlock(_sfc_main$
|
|
8466
|
+
return openBlock(), createBlock(_sfc_main$1d, {
|
|
8468
8467
|
item: _ctx.item,
|
|
8469
8468
|
options: _ctx.options,
|
|
8470
8469
|
"wrapper-class": "lupa-search-box-image-wrapper",
|
|
@@ -8478,7 +8477,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8478
8477
|
key: 1,
|
|
8479
8478
|
class: "lupa-search-box-product-title"
|
|
8480
8479
|
};
|
|
8481
|
-
const _sfc_main$
|
|
8480
|
+
const _sfc_main$1b = /* @__PURE__ */ defineComponent({
|
|
8482
8481
|
__name: "SearchBoxProductTitle",
|
|
8483
8482
|
props: {
|
|
8484
8483
|
item: {},
|
|
@@ -8509,7 +8508,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8509
8508
|
key: 1,
|
|
8510
8509
|
class: "lupa-search-box-product-description"
|
|
8511
8510
|
};
|
|
8512
|
-
const _sfc_main$
|
|
8511
|
+
const _sfc_main$1a = /* @__PURE__ */ defineComponent({
|
|
8513
8512
|
__name: "SearchBoxProductDescription",
|
|
8514
8513
|
props: {
|
|
8515
8514
|
item: {},
|
|
@@ -8534,7 +8533,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8534
8533
|
}
|
|
8535
8534
|
});
|
|
8536
8535
|
const _hoisted_1$13 = { class: "lupa-search-box-product-price" };
|
|
8537
|
-
const _sfc_main$
|
|
8536
|
+
const _sfc_main$19 = /* @__PURE__ */ defineComponent({
|
|
8538
8537
|
__name: "SearchBoxProductPrice",
|
|
8539
8538
|
props: {
|
|
8540
8539
|
item: {},
|
|
@@ -8559,7 +8558,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8559
8558
|
}
|
|
8560
8559
|
});
|
|
8561
8560
|
const _hoisted_1$12 = { class: "lupa-search-box-product-regular-price" };
|
|
8562
|
-
const _sfc_main$
|
|
8561
|
+
const _sfc_main$18 = /* @__PURE__ */ defineComponent({
|
|
8563
8562
|
__name: "SearchBoxProductRegularPrice",
|
|
8564
8563
|
props: {
|
|
8565
8564
|
item: {},
|
|
@@ -8585,8 +8584,8 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8585
8584
|
const _hoisted_2$K = { key: 0 };
|
|
8586
8585
|
const _hoisted_3$y = { key: 1 };
|
|
8587
8586
|
const _hoisted_4$q = { class: "lupa-search-box-custom-label" };
|
|
8588
|
-
const _hoisted_5$
|
|
8589
|
-
const _sfc_main$
|
|
8587
|
+
const _hoisted_5$f = { class: "lupa-search-box-custom-text" };
|
|
8588
|
+
const _sfc_main$17 = /* @__PURE__ */ defineComponent({
|
|
8590
8589
|
__name: "SearchBoxProductCustom",
|
|
8591
8590
|
props: {
|
|
8592
8591
|
item: {},
|
|
@@ -8618,14 +8617,14 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8618
8617
|
}, toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), [
|
|
8619
8618
|
!label.value ? (openBlock(), createElementBlock("div", _hoisted_2$K, toDisplayString(text.value), 1)) : (openBlock(), createElementBlock("div", _hoisted_3$y, [
|
|
8620
8619
|
createBaseVNode("div", _hoisted_4$q, toDisplayString(label.value), 1),
|
|
8621
|
-
createBaseVNode("div", _hoisted_5$
|
|
8620
|
+
createBaseVNode("div", _hoisted_5$f, toDisplayString(text.value), 1)
|
|
8622
8621
|
]))
|
|
8623
8622
|
], 16));
|
|
8624
8623
|
};
|
|
8625
8624
|
}
|
|
8626
8625
|
});
|
|
8627
8626
|
const _hoisted_1$10 = ["innerHTML"];
|
|
8628
|
-
const _sfc_main$
|
|
8627
|
+
const _sfc_main$16 = /* @__PURE__ */ defineComponent({
|
|
8629
8628
|
__name: "SearchBoxProductCustomHtml",
|
|
8630
8629
|
props: {
|
|
8631
8630
|
item: {},
|
|
@@ -8842,7 +8841,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8842
8841
|
const _hoisted_1$$ = { class: "lupa-search-box-add-to-cart-wrapper" };
|
|
8843
8842
|
const _hoisted_2$J = { class: "lupa-search-box-product-addtocart" };
|
|
8844
8843
|
const _hoisted_3$x = ["onClick", "disabled"];
|
|
8845
|
-
const _sfc_main$
|
|
8844
|
+
const _sfc_main$15 = /* @__PURE__ */ defineComponent({
|
|
8846
8845
|
__name: "SearchBoxProductAddToCart",
|
|
8847
8846
|
props: {
|
|
8848
8847
|
item: {},
|
|
@@ -8885,17 +8884,17 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8885
8884
|
});
|
|
8886
8885
|
const __default__$4 = {
|
|
8887
8886
|
components: {
|
|
8888
|
-
SearchBoxProductImage: _sfc_main$
|
|
8889
|
-
SearchBoxProductTitle: _sfc_main$
|
|
8890
|
-
SearchBoxProductDescription: _sfc_main$
|
|
8891
|
-
SearchBoxProductPrice: _sfc_main$
|
|
8892
|
-
SearchBoxProductRegularPrice: _sfc_main$
|
|
8893
|
-
SearchBoxProductCustom: _sfc_main$
|
|
8894
|
-
SearchBoxProductCustomHtml: _sfc_main$
|
|
8895
|
-
SearchBoxProductAddToCart: _sfc_main$
|
|
8887
|
+
SearchBoxProductImage: _sfc_main$1c,
|
|
8888
|
+
SearchBoxProductTitle: _sfc_main$1b,
|
|
8889
|
+
SearchBoxProductDescription: _sfc_main$1a,
|
|
8890
|
+
SearchBoxProductPrice: _sfc_main$19,
|
|
8891
|
+
SearchBoxProductRegularPrice: _sfc_main$18,
|
|
8892
|
+
SearchBoxProductCustom: _sfc_main$17,
|
|
8893
|
+
SearchBoxProductCustomHtml: _sfc_main$16,
|
|
8894
|
+
SearchBoxProductAddToCart: _sfc_main$15
|
|
8896
8895
|
}
|
|
8897
8896
|
};
|
|
8898
|
-
const _sfc_main$
|
|
8897
|
+
const _sfc_main$14 = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValues2({}, __default__$4), {
|
|
8899
8898
|
__name: "SearchBoxProductElement",
|
|
8900
8899
|
props: {
|
|
8901
8900
|
item: {},
|
|
@@ -8961,7 +8960,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8961
8960
|
key: 0,
|
|
8962
8961
|
class: "lupa-search-box-product-add-to-cart-section"
|
|
8963
8962
|
};
|
|
8964
|
-
const _sfc_main$
|
|
8963
|
+
const _sfc_main$13 = /* @__PURE__ */ defineComponent({
|
|
8965
8964
|
__name: "SearchBoxProduct",
|
|
8966
8965
|
props: {
|
|
8967
8966
|
item: {},
|
|
@@ -9019,7 +9018,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
9019
9018
|
}), [
|
|
9020
9019
|
createBaseVNode("div", _hoisted_2$I, [
|
|
9021
9020
|
(openBlock(true), createElementBlock(Fragment, null, renderList(imageElements.value, (element) => {
|
|
9022
|
-
return openBlock(), createBlock(_sfc_main$
|
|
9021
|
+
return openBlock(), createBlock(_sfc_main$14, {
|
|
9023
9022
|
class: "lupa-search-box-product-element",
|
|
9024
9023
|
item: _ctx.item,
|
|
9025
9024
|
element,
|
|
@@ -9031,7 +9030,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
9031
9030
|
]),
|
|
9032
9031
|
createBaseVNode("div", _hoisted_3$w, [
|
|
9033
9032
|
(openBlock(true), createElementBlock(Fragment, null, renderList(detailElements.value, (element) => {
|
|
9034
|
-
return openBlock(), createBlock(_sfc_main$
|
|
9033
|
+
return openBlock(), createBlock(_sfc_main$14, {
|
|
9035
9034
|
class: "lupa-search-box-product-element",
|
|
9036
9035
|
item: _ctx.item,
|
|
9037
9036
|
element,
|
|
@@ -9042,7 +9041,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
9042
9041
|
}), 128))
|
|
9043
9042
|
]),
|
|
9044
9043
|
addToCartElement.value ? (openBlock(), createElementBlock("div", _hoisted_4$p, [
|
|
9045
|
-
createVNode(_sfc_main$
|
|
9044
|
+
createVNode(_sfc_main$14, {
|
|
9046
9045
|
class: "lupa-search-box-product-element",
|
|
9047
9046
|
item: _ctx.item,
|
|
9048
9047
|
element: addToCartElement.value,
|
|
@@ -9066,6 +9065,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
9066
9065
|
};
|
|
9067
9066
|
const useTrackingStore = defineStore("tracking", () => {
|
|
9068
9067
|
const optionsStore = useOptionsStore();
|
|
9068
|
+
const searchResultStore = useSearchResultStore();
|
|
9069
9069
|
const trackSearch = ({
|
|
9070
9070
|
queryKey,
|
|
9071
9071
|
query,
|
|
@@ -9103,7 +9103,8 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
9103
9103
|
track(
|
|
9104
9104
|
queryKey,
|
|
9105
9105
|
__spreadProps2(__spreadValues2({}, data), {
|
|
9106
|
-
analytics: data.analytics ? __spreadProps2(__spreadValues2({}, data.analytics), { items: mappedItems }) : void 0
|
|
9106
|
+
analytics: data.analytics ? __spreadProps2(__spreadValues2({}, data.analytics), { items: mappedItems }) : void 0,
|
|
9107
|
+
filters: searchResultStore.hasAnyFilter ? searchResultStore.filters : void 0
|
|
9107
9108
|
}),
|
|
9108
9109
|
options
|
|
9109
9110
|
);
|
|
@@ -9111,7 +9112,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
9111
9112
|
return { trackSearch, trackResults, trackEvent };
|
|
9112
9113
|
});
|
|
9113
9114
|
const _hoisted_1$Z = { id: "lupa-search-box-products" };
|
|
9114
|
-
const _sfc_main$
|
|
9115
|
+
const _sfc_main$12 = /* @__PURE__ */ defineComponent({
|
|
9115
9116
|
__name: "SearchBoxProducts",
|
|
9116
9117
|
props: {
|
|
9117
9118
|
items: {},
|
|
@@ -9184,7 +9185,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
9184
9185
|
itemClicked: handleProductClick
|
|
9185
9186
|
});
|
|
9186
9187
|
}), 128)) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(_ctx.items, (item, index) => {
|
|
9187
|
-
return openBlock(), createBlock(_sfc_main$
|
|
9188
|
+
return openBlock(), createBlock(_sfc_main$13, {
|
|
9188
9189
|
key: index,
|
|
9189
9190
|
item,
|
|
9190
9191
|
panelOptions: _ctx.panelOptions,
|
|
@@ -9198,7 +9199,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
9198
9199
|
};
|
|
9199
9200
|
}
|
|
9200
9201
|
});
|
|
9201
|
-
const _sfc_main$
|
|
9202
|
+
const _sfc_main$11 = /* @__PURE__ */ defineComponent({
|
|
9202
9203
|
__name: "SearchBoxProductsWrapper",
|
|
9203
9204
|
props: {
|
|
9204
9205
|
panel: {},
|
|
@@ -9250,7 +9251,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
9250
9251
|
const getItemsDebounced = debounce$1(getItems, props.debounce);
|
|
9251
9252
|
return (_ctx, _cache) => {
|
|
9252
9253
|
var _a, _b;
|
|
9253
|
-
return openBlock(), createBlock(_sfc_main$
|
|
9254
|
+
return openBlock(), createBlock(_sfc_main$12, {
|
|
9254
9255
|
items: (_b = (_a = searchResult.value) == null ? void 0 : _a.items) != null ? _b : [],
|
|
9255
9256
|
panelOptions: _ctx.panel,
|
|
9256
9257
|
labels: _ctx.labels,
|
|
@@ -9268,6 +9269,95 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
9268
9269
|
};
|
|
9269
9270
|
}
|
|
9270
9271
|
});
|
|
9272
|
+
const _sfc_main$10 = /* @__PURE__ */ defineComponent({
|
|
9273
|
+
__name: "SearchBoxRelatedSourceWrapper",
|
|
9274
|
+
props: {
|
|
9275
|
+
panel: {},
|
|
9276
|
+
inputValue: {},
|
|
9277
|
+
options: {},
|
|
9278
|
+
labels: {},
|
|
9279
|
+
debounce: {}
|
|
9280
|
+
},
|
|
9281
|
+
emits: ["fetched"],
|
|
9282
|
+
setup(__props, { emit: emit2 }) {
|
|
9283
|
+
const props = __props;
|
|
9284
|
+
const searchBoxStore = useSearchBoxStore();
|
|
9285
|
+
const { docResults } = storeToRefs(searchBoxStore);
|
|
9286
|
+
const searchResult = ref(null);
|
|
9287
|
+
const options = computed(() => props.options);
|
|
9288
|
+
const relatedSourceIds = computed(() => {
|
|
9289
|
+
var _a, _b, _c;
|
|
9290
|
+
const queryKey = (_a = props.panel.sourceIds) == null ? void 0 : _a.queryKey;
|
|
9291
|
+
if (!queryKey) {
|
|
9292
|
+
return [];
|
|
9293
|
+
}
|
|
9294
|
+
const currentDocumentItems = (_c = (_b = docResults == null ? void 0 : docResults.value[queryKey]) == null ? void 0 : _b.items) != null ? _c : [];
|
|
9295
|
+
const allFieldValues = currentDocumentItems.map((item) => item[props.panel.sourceIds.field]).flat();
|
|
9296
|
+
const uniqueFieldValues = Array.from(new Set(allFieldValues));
|
|
9297
|
+
return uniqueFieldValues;
|
|
9298
|
+
});
|
|
9299
|
+
const inputValueProp = computed(() => props.inputValue);
|
|
9300
|
+
onMounted(() => {
|
|
9301
|
+
getItemsDebounced();
|
|
9302
|
+
});
|
|
9303
|
+
watch(relatedSourceIds, () => {
|
|
9304
|
+
getItemsDebounced();
|
|
9305
|
+
});
|
|
9306
|
+
watch(inputValueProp, () => {
|
|
9307
|
+
getItemsDebounced();
|
|
9308
|
+
});
|
|
9309
|
+
const fetchRelatedItems = () => __async(this, null, function* () {
|
|
9310
|
+
var _a, _b;
|
|
9311
|
+
if (!((_a = props.panel.target) == null ? void 0 : _a.queryKey) || !relatedSourceIds.value.length) {
|
|
9312
|
+
return { items: [], success: true, searchText: "", total: 0 };
|
|
9313
|
+
}
|
|
9314
|
+
try {
|
|
9315
|
+
const result = yield LupaSearchSdk.queryByIds(
|
|
9316
|
+
(_b = props.panel.target) == null ? void 0 : _b.queryKey,
|
|
9317
|
+
relatedSourceIds.value,
|
|
9318
|
+
options.value
|
|
9319
|
+
);
|
|
9320
|
+
if (!result.success) {
|
|
9321
|
+
return { items: [], success: true, searchText: "", total: 0 };
|
|
9322
|
+
}
|
|
9323
|
+
return result;
|
|
9324
|
+
} catch (err) {
|
|
9325
|
+
console.error(err);
|
|
9326
|
+
if (options == null ? void 0 : options.value.onError) {
|
|
9327
|
+
options.value.onError(err);
|
|
9328
|
+
}
|
|
9329
|
+
return { items: [], success: true, searchText: "", total: 0 };
|
|
9330
|
+
}
|
|
9331
|
+
});
|
|
9332
|
+
const getItems = () => __async(this, null, function* () {
|
|
9333
|
+
searchResult.value = yield fetchRelatedItems();
|
|
9334
|
+
});
|
|
9335
|
+
const getItemsDebounced = debounce$1(getItems, props.debounce);
|
|
9336
|
+
const documentPanelOptions = computed(() => {
|
|
9337
|
+
return __spreadProps2(__spreadValues2({}, props.panel), {
|
|
9338
|
+
type: SearchBoxPanelType.DOCUMENT
|
|
9339
|
+
});
|
|
9340
|
+
});
|
|
9341
|
+
return (_ctx, _cache) => {
|
|
9342
|
+
var _a, _b;
|
|
9343
|
+
return openBlock(), createBlock(_sfc_main$12, {
|
|
9344
|
+
items: (_b = (_a = searchResult.value) == null ? void 0 : _a.items) != null ? _b : [],
|
|
9345
|
+
panelOptions: documentPanelOptions.value,
|
|
9346
|
+
labels: _ctx.labels,
|
|
9347
|
+
inputValue: _ctx.inputValue,
|
|
9348
|
+
onProductClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("product-click"))
|
|
9349
|
+
}, createSlots({ _: 2 }, [
|
|
9350
|
+
_ctx.$slots.productCard ? {
|
|
9351
|
+
name: "productCard",
|
|
9352
|
+
fn: withCtx((props2) => [
|
|
9353
|
+
renderSlot(_ctx.$slots, "productCard", normalizeProps(guardReactiveProps(props2)))
|
|
9354
|
+
]),
|
|
9355
|
+
key: "0"
|
|
9356
|
+
} : void 0
|
|
9357
|
+
]), 1032, ["items", "panelOptions", "labels", "inputValue"]);
|
|
9358
|
+
};
|
|
9359
|
+
}
|
|
9360
|
+
});
|
|
9271
9361
|
const _hoisted_1$Y = {
|
|
9272
9362
|
key: 0,
|
|
9273
9363
|
id: "lupa-search-box-panel"
|
|
@@ -9275,16 +9365,21 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
9275
9365
|
const _hoisted_2$H = ["data-cy"];
|
|
9276
9366
|
const _hoisted_3$v = {
|
|
9277
9367
|
key: 0,
|
|
9278
|
-
class: "lupa-panel-title"
|
|
9368
|
+
class: "lupa-panel-title lupa-panel-title-top-results"
|
|
9279
9369
|
};
|
|
9280
9370
|
const _hoisted_4$o = {
|
|
9371
|
+
key: 1,
|
|
9372
|
+
class: "lupa-panel-title"
|
|
9373
|
+
};
|
|
9374
|
+
const _hoisted_5$e = {
|
|
9281
9375
|
key: 1,
|
|
9282
9376
|
id: "lupa-search-box-panel"
|
|
9283
9377
|
};
|
|
9284
9378
|
const __default__$3 = {
|
|
9285
9379
|
components: {
|
|
9286
|
-
SearchBoxSuggestionsWrapper: _sfc_main$
|
|
9287
|
-
SearchBoxProductsWrapper: _sfc_main$
|
|
9380
|
+
SearchBoxSuggestionsWrapper: _sfc_main$1e,
|
|
9381
|
+
SearchBoxProductsWrapper: _sfc_main$11,
|
|
9382
|
+
SearchBoxRelatedSourceWrapper: _sfc_main$10
|
|
9288
9383
|
}
|
|
9289
9384
|
};
|
|
9290
9385
|
const _sfc_main$$ = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValues2({}, __default__$3), {
|
|
@@ -9378,6 +9473,8 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
9378
9473
|
switch (type) {
|
|
9379
9474
|
case "suggestion":
|
|
9380
9475
|
return "SearchBoxSuggestionsWrapper";
|
|
9476
|
+
case "related-source":
|
|
9477
|
+
return "SearchBoxRelatedSourceWrapper";
|
|
9381
9478
|
default:
|
|
9382
9479
|
return "SearchBoxProductsWrapper";
|
|
9383
9480
|
}
|
|
@@ -9403,6 +9500,17 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
9403
9500
|
const panel = panelItemCounts.value.find((v) => v.queryKey === queryKey);
|
|
9404
9501
|
return (panel == null ? void 0 : panel.count) > 0 && (panel == null ? void 0 : panel.input.length) < 1;
|
|
9405
9502
|
};
|
|
9503
|
+
const canShowPanel = (panel) => {
|
|
9504
|
+
var _a, _b, _c;
|
|
9505
|
+
if (!((_a = panel.visibility) == null ? void 0 : _a.showWhenKeyHasNoResults)) {
|
|
9506
|
+
return true;
|
|
9507
|
+
}
|
|
9508
|
+
const resultCountFromRelatedPanel = (_c = (_b = panelItemCounts.value.find((v) => {
|
|
9509
|
+
var _a2;
|
|
9510
|
+
return v.queryKey === ((_a2 = panel.visibility) == null ? void 0 : _a2.showWhenKeyHasNoResults);
|
|
9511
|
+
})) == null ? void 0 : _b.count) != null ? _c : 0;
|
|
9512
|
+
return resultCountFromRelatedPanel < 1;
|
|
9513
|
+
};
|
|
9406
9514
|
return (_ctx, _cache) => {
|
|
9407
9515
|
var _a;
|
|
9408
9516
|
return openBlock(), createElementBlock("div", {
|
|
@@ -9416,7 +9524,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
9416
9524
|
"data-cy": "lupa-main-panel"
|
|
9417
9525
|
}, [
|
|
9418
9526
|
(openBlock(true), createElementBlock(Fragment, null, renderList(displayPanels.value, (panel, index) => {
|
|
9419
|
-
var _a2, _b;
|
|
9527
|
+
var _a2, _b, _c, _d;
|
|
9420
9528
|
return openBlock(), createElementBlock("div", {
|
|
9421
9529
|
key: index,
|
|
9422
9530
|
class: normalizeClass([
|
|
@@ -9426,8 +9534,9 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
9426
9534
|
"data-cy": "lupa-panel-" + panel.type + "-index"
|
|
9427
9535
|
}, [
|
|
9428
9536
|
((_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),
|
|
9429
|
-
panel.
|
|
9430
|
-
|
|
9537
|
+
((_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),
|
|
9538
|
+
panel.queryKey && canShowPanel(panel) ? (openBlock(), createBlock(resolveDynamicComponent(getComponent(panel.type)), {
|
|
9539
|
+
key: 2,
|
|
9431
9540
|
panel,
|
|
9432
9541
|
options: sdkOptions.value,
|
|
9433
9542
|
debounce: _ctx.options.debounce,
|
|
@@ -9448,18 +9557,18 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
9448
9557
|
], 10, _hoisted_2$H);
|
|
9449
9558
|
}), 128))
|
|
9450
9559
|
], 4),
|
|
9451
|
-
!unref(hasAnyResults) && _ctx.options.showNoResultsPanel ? (openBlock(), createBlock(_sfc_main$
|
|
9560
|
+
!unref(hasAnyResults) && _ctx.options.showNoResultsPanel ? (openBlock(), createBlock(_sfc_main$1h, {
|
|
9452
9561
|
key: 0,
|
|
9453
9562
|
labels: labels.value
|
|
9454
9563
|
}, null, 8, ["labels"])) : createCommentVNode("", true),
|
|
9455
|
-
unref(hasAnyResults) || !_ctx.options.hideMoreResultsButtonOnNoResults ? (openBlock(), createBlock(_sfc_main$
|
|
9564
|
+
unref(hasAnyResults) || !_ctx.options.hideMoreResultsButtonOnNoResults ? (openBlock(), createBlock(_sfc_main$1k, {
|
|
9456
9565
|
key: 1,
|
|
9457
9566
|
labels: labels.value,
|
|
9458
9567
|
showTotalCount: (_a = _ctx.options.showTotalCount) != null ? _a : false,
|
|
9459
9568
|
onGoToResults: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("go-to-results"))
|
|
9460
9569
|
}, null, 8, ["labels", "showTotalCount"])) : createCommentVNode("", true)
|
|
9461
|
-
])) : displayHistory.value ? (openBlock(), createElementBlock("div",
|
|
9462
|
-
createVNode(_sfc_main$
|
|
9570
|
+
])) : displayHistory.value ? (openBlock(), createElementBlock("div", _hoisted_5$e, [
|
|
9571
|
+
createVNode(_sfc_main$1i, {
|
|
9463
9572
|
options: _ctx.options.history,
|
|
9464
9573
|
history: history.value,
|
|
9465
9574
|
onGoToResults: handleGoToResults,
|
|
@@ -9729,7 +9838,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
9729
9838
|
var _a2;
|
|
9730
9839
|
return openBlock(), createElementBlock("div", _hoisted_1$X, [
|
|
9731
9840
|
createBaseVNode("div", _hoisted_2$G, [
|
|
9732
|
-
createVNode(_sfc_main$
|
|
9841
|
+
createVNode(_sfc_main$1l, {
|
|
9733
9842
|
options: inputOptions.value,
|
|
9734
9843
|
suggestedValue: suggestedValue.value,
|
|
9735
9844
|
"can-close": (_a2 = _ctx.isSearchContainer) != null ? _a2 : false,
|
|
@@ -13024,7 +13133,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
13024
13133
|
},
|
|
13025
13134
|
setup(__props) {
|
|
13026
13135
|
return (_ctx, _cache) => {
|
|
13027
|
-
return openBlock(), createBlock(_sfc_main$
|
|
13136
|
+
return openBlock(), createBlock(_sfc_main$1d, {
|
|
13028
13137
|
item: _ctx.item,
|
|
13029
13138
|
options: _ctx.options,
|
|
13030
13139
|
"wrapper-class": "lupa-search-results-image-wrapper",
|
|
@@ -21536,7 +21645,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
21536
21645
|
class: "lupa-chat-spinner-main"
|
|
21537
21646
|
};
|
|
21538
21647
|
const _hoisted_5 = { class: "lupasearch-chat-input" };
|
|
21539
|
-
const _sfc_main$
|
|
21648
|
+
const _sfc_main$1m = /* @__PURE__ */ defineComponent({
|
|
21540
21649
|
__name: "ChatContainer",
|
|
21541
21650
|
props: {
|
|
21542
21651
|
options: {}
|
|
@@ -28014,7 +28123,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
28014
28123
|
}
|
|
28015
28124
|
return;
|
|
28016
28125
|
}
|
|
28017
|
-
const instance = createVue(options.displayOptions.containerSelector, _sfc_main$
|
|
28126
|
+
const instance = createVue(options.displayOptions.containerSelector, _sfc_main$1m, {
|
|
28018
28127
|
options
|
|
28019
28128
|
});
|
|
28020
28129
|
if (!instance) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getlupa/client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
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.4",
|
|
23
|
-
"@getlupa/vue": "0.
|
|
23
|
+
"@getlupa/vue": "0.9.0",
|
|
24
24
|
"@rushstack/eslint-patch": "^1.3.2",
|
|
25
25
|
"@tsconfig/node18": "^2.0.1",
|
|
26
26
|
"@types/jsdom": "^21.1.1",
|