@getlupa/vue 0.8.5 → 0.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.js +175 -63
- package/dist/lupaSearch.mjs +175 -63
- package/dist/src/components/search-box/related-source/SearchBoxRelatedSourceWrapper.vue.d.ts +50 -0
- package/dist/src/stores/searchBox.d.ts +6 -6
- package/dist/src/types/search-box/Common.d.ts +2 -1
- package/dist/src/types/search-box/SearchBoxPanel.d.ts +17 -2
- package/package.json +2 -2
package/dist/lupaSearch.js
CHANGED
|
@@ -1900,7 +1900,8 @@ const trackLupaEvent = (queryKey, data = {}, options) => {
|
|
|
1900
1900
|
itemId: (_b = data.itemId) != null ? _b : "",
|
|
1901
1901
|
name: data.type,
|
|
1902
1902
|
userId: getUserKey(),
|
|
1903
|
-
sessionId: getSessionKey()
|
|
1903
|
+
sessionId: getSessionKey(),
|
|
1904
|
+
filters: data.filters
|
|
1904
1905
|
};
|
|
1905
1906
|
LupaSearchSdk.track(queryKey, eventData, options);
|
|
1906
1907
|
};
|
|
@@ -2004,9 +2005,6 @@ const track = (queryKey, data = {}, options) => {
|
|
|
2004
2005
|
return;
|
|
2005
2006
|
}
|
|
2006
2007
|
trackAnalyticsEvent(data);
|
|
2007
|
-
if (!hasSearchQuery) {
|
|
2008
|
-
return;
|
|
2009
|
-
}
|
|
2010
2008
|
trackLupaEvent(queryKey, data, options);
|
|
2011
2009
|
};
|
|
2012
2010
|
const DEFAULT_SEARCH_BOX_OPTIONS = {
|
|
@@ -2283,6 +2281,7 @@ var DocumentElementType = /* @__PURE__ */ ((DocumentElementType2) => {
|
|
|
2283
2281
|
var SearchBoxPanelType = /* @__PURE__ */ ((SearchBoxPanelType2) => {
|
|
2284
2282
|
SearchBoxPanelType2["SUGGESTION"] = "suggestion";
|
|
2285
2283
|
SearchBoxPanelType2["DOCUMENT"] = "document";
|
|
2284
|
+
SearchBoxPanelType2["RELATED_SOURCE"] = "related-source";
|
|
2286
2285
|
return SearchBoxPanelType2;
|
|
2287
2286
|
})(SearchBoxPanelType || {});
|
|
2288
2287
|
var BadgeType = /* @__PURE__ */ ((BadgeType2) => {
|
|
@@ -3199,12 +3198,12 @@ const _hoisted_1$1c = { id: "lupa-search-box-input-container" };
|
|
|
3199
3198
|
const _hoisted_2$P = { class: "lupa-input-clear" };
|
|
3200
3199
|
const _hoisted_3$A = { id: "lupa-search-box-input" };
|
|
3201
3200
|
const _hoisted_4$s = ["value"];
|
|
3202
|
-
const _hoisted_5$
|
|
3201
|
+
const _hoisted_5$h = ["aria-label", "placeholder"];
|
|
3203
3202
|
const _hoisted_6$9 = {
|
|
3204
3203
|
key: 0,
|
|
3205
3204
|
class: "lupa-close-label"
|
|
3206
3205
|
};
|
|
3207
|
-
const _sfc_main$
|
|
3206
|
+
const _sfc_main$1l = /* @__PURE__ */ vue.defineComponent({
|
|
3208
3207
|
__name: "SearchBoxInput",
|
|
3209
3208
|
props: {
|
|
3210
3209
|
options: {},
|
|
@@ -3312,7 +3311,7 @@ const _sfc_main$1k = /* @__PURE__ */ vue.defineComponent({
|
|
|
3312
3311
|
placeholder: labels.value.placeholder,
|
|
3313
3312
|
onInput: handleInput,
|
|
3314
3313
|
onFocus: handleFocus
|
|
3315
|
-
}), null, 16, _hoisted_5$
|
|
3314
|
+
}), null, 16, _hoisted_5$h), [
|
|
3316
3315
|
[vue.vModelText, inputValue.value]
|
|
3317
3316
|
])
|
|
3318
3317
|
]),
|
|
@@ -3327,7 +3326,7 @@ const _sfc_main$1k = /* @__PURE__ */ vue.defineComponent({
|
|
|
3327
3326
|
};
|
|
3328
3327
|
}
|
|
3329
3328
|
});
|
|
3330
|
-
const _sfc_main$
|
|
3329
|
+
const _sfc_main$1k = /* @__PURE__ */ vue.defineComponent({
|
|
3331
3330
|
__name: "SearchBoxMoreResults",
|
|
3332
3331
|
props: {
|
|
3333
3332
|
labels: {},
|
|
@@ -3361,7 +3360,7 @@ const _sfc_main$1j = /* @__PURE__ */ vue.defineComponent({
|
|
|
3361
3360
|
});
|
|
3362
3361
|
const _hoisted_1$1b = { class: "lupa-search-box-history-item" };
|
|
3363
3362
|
const _hoisted_2$O = { class: "lupa-search-box-history-item-content" };
|
|
3364
|
-
const _sfc_main$
|
|
3363
|
+
const _sfc_main$1j = /* @__PURE__ */ vue.defineComponent({
|
|
3365
3364
|
__name: "SearchBoxHistoryItem",
|
|
3366
3365
|
props: {
|
|
3367
3366
|
item: {},
|
|
@@ -3396,7 +3395,7 @@ const _hoisted_1$1a = {
|
|
|
3396
3395
|
key: 0,
|
|
3397
3396
|
class: "lupa-search-box-history-panel"
|
|
3398
3397
|
};
|
|
3399
|
-
const _sfc_main$
|
|
3398
|
+
const _sfc_main$1i = /* @__PURE__ */ vue.defineComponent({
|
|
3400
3399
|
__name: "SearchBoxHistoryPanel",
|
|
3401
3400
|
props: {
|
|
3402
3401
|
options: {}
|
|
@@ -3439,7 +3438,7 @@ const _sfc_main$1h = /* @__PURE__ */ vue.defineComponent({
|
|
|
3439
3438
|
return (_ctx, _cache) => {
|
|
3440
3439
|
return hasHistory.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1a, [
|
|
3441
3440
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(history), (item, index) => {
|
|
3442
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
3441
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$1j, {
|
|
3443
3442
|
key: item,
|
|
3444
3443
|
item,
|
|
3445
3444
|
highlighted: index === highlightIndex.value,
|
|
@@ -3456,7 +3455,7 @@ const _sfc_main$1h = /* @__PURE__ */ vue.defineComponent({
|
|
|
3456
3455
|
}
|
|
3457
3456
|
});
|
|
3458
3457
|
const _hoisted_1$19 = { class: "lupa-search-box-no-results" };
|
|
3459
|
-
const _sfc_main$
|
|
3458
|
+
const _sfc_main$1h = /* @__PURE__ */ vue.defineComponent({
|
|
3460
3459
|
__name: "SearchBoxNoResults",
|
|
3461
3460
|
props: {
|
|
3462
3461
|
labels: {}
|
|
@@ -3482,11 +3481,11 @@ const _hoisted_4$r = {
|
|
|
3482
3481
|
class: "lupa-suggestion-facet-label",
|
|
3483
3482
|
"data-cy": "lupa-suggestion-facet-label"
|
|
3484
3483
|
};
|
|
3485
|
-
const _hoisted_5$
|
|
3484
|
+
const _hoisted_5$g = {
|
|
3486
3485
|
class: "lupa-suggestion-facet-value",
|
|
3487
3486
|
"data-cy": "lupa-suggestion-facet-value"
|
|
3488
3487
|
};
|
|
3489
|
-
const _sfc_main$
|
|
3488
|
+
const _sfc_main$1g = /* @__PURE__ */ vue.defineComponent({
|
|
3490
3489
|
__name: "SearchBoxSuggestion",
|
|
3491
3490
|
props: {
|
|
3492
3491
|
suggestion: {},
|
|
@@ -3525,7 +3524,7 @@ const _sfc_main$1f = /* @__PURE__ */ vue.defineComponent({
|
|
|
3525
3524
|
}, null, 8, _hoisted_1$18)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$N, vue.toDisplayString(_ctx.suggestion.display), 1)),
|
|
3526
3525
|
_ctx.suggestion.facet ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$z, [
|
|
3527
3526
|
vue.createElementVNode("span", _hoisted_4$r, vue.toDisplayString(facetLabel.value), 1),
|
|
3528
|
-
vue.createElementVNode("span", _hoisted_5$
|
|
3527
|
+
vue.createElementVNode("span", _hoisted_5$g, vue.toDisplayString(_ctx.suggestion.facet.title), 1)
|
|
3529
3528
|
])) : vue.createCommentVNode("", true)
|
|
3530
3529
|
]);
|
|
3531
3530
|
};
|
|
@@ -3535,7 +3534,7 @@ const _hoisted_1$17 = {
|
|
|
3535
3534
|
id: "lupa-search-box-suggestions",
|
|
3536
3535
|
"data-cy": "lupa-search-box-suggestions"
|
|
3537
3536
|
};
|
|
3538
|
-
const _sfc_main$
|
|
3537
|
+
const _sfc_main$1f = /* @__PURE__ */ vue.defineComponent({
|
|
3539
3538
|
__name: "SearchBoxSuggestions",
|
|
3540
3539
|
props: {
|
|
3541
3540
|
items: {},
|
|
@@ -3597,7 +3596,7 @@ const _sfc_main$1e = /* @__PURE__ */ vue.defineComponent({
|
|
|
3597
3596
|
return (_ctx, _cache) => {
|
|
3598
3597
|
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$17, [
|
|
3599
3598
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(items.value, (item, index) => {
|
|
3600
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
3599
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$1g, {
|
|
3601
3600
|
key: getSuggestionKey(item),
|
|
3602
3601
|
class: vue.normalizeClass(["lupa-suggestion", index === highlightedIndex.value ? "lupa-suggestion-highlighted" : ""]),
|
|
3603
3602
|
suggestion: item,
|
|
@@ -3625,7 +3624,7 @@ const debounce$1 = (func, timeout) => {
|
|
|
3625
3624
|
}, timeout);
|
|
3626
3625
|
};
|
|
3627
3626
|
};
|
|
3628
|
-
const _sfc_main$
|
|
3627
|
+
const _sfc_main$1e = /* @__PURE__ */ vue.defineComponent({
|
|
3629
3628
|
__name: "SearchBoxSuggestionsWrapper",
|
|
3630
3629
|
props: {
|
|
3631
3630
|
panel: {},
|
|
@@ -3666,7 +3665,7 @@ const _sfc_main$1d = /* @__PURE__ */ vue.defineComponent({
|
|
|
3666
3665
|
};
|
|
3667
3666
|
const getSuggestionsDebounced = debounce$1(getSuggestions, props.debounce);
|
|
3668
3667
|
return (_ctx, _cache) => {
|
|
3669
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
3668
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$1f, {
|
|
3670
3669
|
items: searchResult.value,
|
|
3671
3670
|
highlight: _ctx.panel.highlight,
|
|
3672
3671
|
queryKey: _ctx.panel.queryKey,
|
|
@@ -3752,7 +3751,7 @@ const joinUrlParts = (...parts) => {
|
|
|
3752
3751
|
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 : "";
|
|
3753
3752
|
};
|
|
3754
3753
|
const _hoisted_1$16 = ["src"];
|
|
3755
|
-
const _sfc_main$
|
|
3754
|
+
const _sfc_main$1d = /* @__PURE__ */ vue.defineComponent({
|
|
3756
3755
|
__name: "ProductImage",
|
|
3757
3756
|
props: {
|
|
3758
3757
|
item: {},
|
|
@@ -3810,7 +3809,7 @@ const _sfc_main$1c = /* @__PURE__ */ vue.defineComponent({
|
|
|
3810
3809
|
};
|
|
3811
3810
|
}
|
|
3812
3811
|
});
|
|
3813
|
-
const _sfc_main$
|
|
3812
|
+
const _sfc_main$1c = /* @__PURE__ */ vue.defineComponent({
|
|
3814
3813
|
__name: "SearchBoxProductImage",
|
|
3815
3814
|
props: {
|
|
3816
3815
|
item: {},
|
|
@@ -3818,7 +3817,7 @@ const _sfc_main$1b = /* @__PURE__ */ vue.defineComponent({
|
|
|
3818
3817
|
},
|
|
3819
3818
|
setup(__props) {
|
|
3820
3819
|
return (_ctx, _cache) => {
|
|
3821
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
3820
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$1d, {
|
|
3822
3821
|
item: _ctx.item,
|
|
3823
3822
|
options: _ctx.options,
|
|
3824
3823
|
"wrapper-class": "lupa-search-box-image-wrapper",
|
|
@@ -3832,7 +3831,7 @@ const _hoisted_2$M = {
|
|
|
3832
3831
|
key: 1,
|
|
3833
3832
|
class: "lupa-search-box-product-title"
|
|
3834
3833
|
};
|
|
3835
|
-
const _sfc_main$
|
|
3834
|
+
const _sfc_main$1b = /* @__PURE__ */ vue.defineComponent({
|
|
3836
3835
|
__name: "SearchBoxProductTitle",
|
|
3837
3836
|
props: {
|
|
3838
3837
|
item: {},
|
|
@@ -3863,7 +3862,7 @@ const _hoisted_2$L = {
|
|
|
3863
3862
|
key: 1,
|
|
3864
3863
|
class: "lupa-search-box-product-description"
|
|
3865
3864
|
};
|
|
3866
|
-
const _sfc_main$
|
|
3865
|
+
const _sfc_main$1a = /* @__PURE__ */ vue.defineComponent({
|
|
3867
3866
|
__name: "SearchBoxProductDescription",
|
|
3868
3867
|
props: {
|
|
3869
3868
|
item: {},
|
|
@@ -3888,7 +3887,7 @@ const _sfc_main$19 = /* @__PURE__ */ vue.defineComponent({
|
|
|
3888
3887
|
}
|
|
3889
3888
|
});
|
|
3890
3889
|
const _hoisted_1$13 = { class: "lupa-search-box-product-price" };
|
|
3891
|
-
const _sfc_main$
|
|
3890
|
+
const _sfc_main$19 = /* @__PURE__ */ vue.defineComponent({
|
|
3892
3891
|
__name: "SearchBoxProductPrice",
|
|
3893
3892
|
props: {
|
|
3894
3893
|
item: {},
|
|
@@ -3913,7 +3912,7 @@ const _sfc_main$18 = /* @__PURE__ */ vue.defineComponent({
|
|
|
3913
3912
|
}
|
|
3914
3913
|
});
|
|
3915
3914
|
const _hoisted_1$12 = { class: "lupa-search-box-product-regular-price" };
|
|
3916
|
-
const _sfc_main$
|
|
3915
|
+
const _sfc_main$18 = /* @__PURE__ */ vue.defineComponent({
|
|
3917
3916
|
__name: "SearchBoxProductRegularPrice",
|
|
3918
3917
|
props: {
|
|
3919
3918
|
item: {},
|
|
@@ -3939,8 +3938,8 @@ const _hoisted_1$11 = ["innerHTML"];
|
|
|
3939
3938
|
const _hoisted_2$K = { key: 0 };
|
|
3940
3939
|
const _hoisted_3$y = { key: 1 };
|
|
3941
3940
|
const _hoisted_4$q = { class: "lupa-search-box-custom-label" };
|
|
3942
|
-
const _hoisted_5$
|
|
3943
|
-
const _sfc_main$
|
|
3941
|
+
const _hoisted_5$f = { class: "lupa-search-box-custom-text" };
|
|
3942
|
+
const _sfc_main$17 = /* @__PURE__ */ vue.defineComponent({
|
|
3944
3943
|
__name: "SearchBoxProductCustom",
|
|
3945
3944
|
props: {
|
|
3946
3945
|
item: {},
|
|
@@ -3972,14 +3971,14 @@ const _sfc_main$16 = /* @__PURE__ */ vue.defineComponent({
|
|
|
3972
3971
|
}, vue.toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), [
|
|
3973
3972
|
!label.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$K, vue.toDisplayString(text.value), 1)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$y, [
|
|
3974
3973
|
vue.createElementVNode("div", _hoisted_4$q, vue.toDisplayString(label.value), 1),
|
|
3975
|
-
vue.createElementVNode("div", _hoisted_5$
|
|
3974
|
+
vue.createElementVNode("div", _hoisted_5$f, vue.toDisplayString(text.value), 1)
|
|
3976
3975
|
]))
|
|
3977
3976
|
], 16));
|
|
3978
3977
|
};
|
|
3979
3978
|
}
|
|
3980
3979
|
});
|
|
3981
3980
|
const _hoisted_1$10 = ["innerHTML"];
|
|
3982
|
-
const _sfc_main$
|
|
3981
|
+
const _sfc_main$16 = /* @__PURE__ */ vue.defineComponent({
|
|
3983
3982
|
__name: "SearchBoxProductCustomHtml",
|
|
3984
3983
|
props: {
|
|
3985
3984
|
item: {},
|
|
@@ -4196,7 +4195,7 @@ const useSearchResultStore = defineStore("searchResult", () => {
|
|
|
4196
4195
|
const _hoisted_1$$ = { class: "lupa-search-box-add-to-cart-wrapper" };
|
|
4197
4196
|
const _hoisted_2$J = { class: "lupa-search-box-product-addtocart" };
|
|
4198
4197
|
const _hoisted_3$x = ["onClick", "disabled"];
|
|
4199
|
-
const _sfc_main$
|
|
4198
|
+
const _sfc_main$15 = /* @__PURE__ */ vue.defineComponent({
|
|
4200
4199
|
__name: "SearchBoxProductAddToCart",
|
|
4201
4200
|
props: {
|
|
4202
4201
|
item: {},
|
|
@@ -4239,17 +4238,17 @@ const _sfc_main$14 = /* @__PURE__ */ vue.defineComponent({
|
|
|
4239
4238
|
});
|
|
4240
4239
|
const __default__$4 = {
|
|
4241
4240
|
components: {
|
|
4242
|
-
SearchBoxProductImage: _sfc_main$
|
|
4243
|
-
SearchBoxProductTitle: _sfc_main$
|
|
4244
|
-
SearchBoxProductDescription: _sfc_main$
|
|
4245
|
-
SearchBoxProductPrice: _sfc_main$
|
|
4246
|
-
SearchBoxProductRegularPrice: _sfc_main$
|
|
4247
|
-
SearchBoxProductCustom: _sfc_main$
|
|
4248
|
-
SearchBoxProductCustomHtml: _sfc_main$
|
|
4249
|
-
SearchBoxProductAddToCart: _sfc_main$
|
|
4241
|
+
SearchBoxProductImage: _sfc_main$1c,
|
|
4242
|
+
SearchBoxProductTitle: _sfc_main$1b,
|
|
4243
|
+
SearchBoxProductDescription: _sfc_main$1a,
|
|
4244
|
+
SearchBoxProductPrice: _sfc_main$19,
|
|
4245
|
+
SearchBoxProductRegularPrice: _sfc_main$18,
|
|
4246
|
+
SearchBoxProductCustom: _sfc_main$17,
|
|
4247
|
+
SearchBoxProductCustomHtml: _sfc_main$16,
|
|
4248
|
+
SearchBoxProductAddToCart: _sfc_main$15
|
|
4250
4249
|
}
|
|
4251
4250
|
};
|
|
4252
|
-
const _sfc_main$
|
|
4251
|
+
const _sfc_main$14 = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadValues({}, __default__$4), {
|
|
4253
4252
|
__name: "SearchBoxProductElement",
|
|
4254
4253
|
props: {
|
|
4255
4254
|
item: {},
|
|
@@ -4315,7 +4314,7 @@ const _hoisted_4$p = {
|
|
|
4315
4314
|
key: 0,
|
|
4316
4315
|
class: "lupa-search-box-product-add-to-cart-section"
|
|
4317
4316
|
};
|
|
4318
|
-
const _sfc_main$
|
|
4317
|
+
const _sfc_main$13 = /* @__PURE__ */ vue.defineComponent({
|
|
4319
4318
|
__name: "SearchBoxProduct",
|
|
4320
4319
|
props: {
|
|
4321
4320
|
item: {},
|
|
@@ -4373,7 +4372,7 @@ const _sfc_main$12 = /* @__PURE__ */ vue.defineComponent({
|
|
|
4373
4372
|
}), [
|
|
4374
4373
|
vue.createElementVNode("div", _hoisted_2$I, [
|
|
4375
4374
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(imageElements.value, (element) => {
|
|
4376
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
4375
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$14, {
|
|
4377
4376
|
class: "lupa-search-box-product-element",
|
|
4378
4377
|
item: _ctx.item,
|
|
4379
4378
|
element,
|
|
@@ -4385,7 +4384,7 @@ const _sfc_main$12 = /* @__PURE__ */ vue.defineComponent({
|
|
|
4385
4384
|
]),
|
|
4386
4385
|
vue.createElementVNode("div", _hoisted_3$w, [
|
|
4387
4386
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(detailElements.value, (element) => {
|
|
4388
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
4387
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$14, {
|
|
4389
4388
|
class: "lupa-search-box-product-element",
|
|
4390
4389
|
item: _ctx.item,
|
|
4391
4390
|
element,
|
|
@@ -4396,7 +4395,7 @@ const _sfc_main$12 = /* @__PURE__ */ vue.defineComponent({
|
|
|
4396
4395
|
}), 128))
|
|
4397
4396
|
]),
|
|
4398
4397
|
addToCartElement.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$p, [
|
|
4399
|
-
vue.createVNode(_sfc_main$
|
|
4398
|
+
vue.createVNode(_sfc_main$14, {
|
|
4400
4399
|
class: "lupa-search-box-product-element",
|
|
4401
4400
|
item: _ctx.item,
|
|
4402
4401
|
element: addToCartElement.value,
|
|
@@ -4420,6 +4419,7 @@ const getSearchTrackingData = (searchText, type) => {
|
|
|
4420
4419
|
};
|
|
4421
4420
|
const useTrackingStore = defineStore("tracking", () => {
|
|
4422
4421
|
const optionsStore = useOptionsStore();
|
|
4422
|
+
const searchResultStore = useSearchResultStore();
|
|
4423
4423
|
const trackSearch = ({
|
|
4424
4424
|
queryKey,
|
|
4425
4425
|
query,
|
|
@@ -4457,7 +4457,8 @@ const useTrackingStore = defineStore("tracking", () => {
|
|
|
4457
4457
|
track(
|
|
4458
4458
|
queryKey,
|
|
4459
4459
|
__spreadProps(__spreadValues({}, data), {
|
|
4460
|
-
analytics: data.analytics ? __spreadProps(__spreadValues({}, data.analytics), { items: mappedItems }) : void 0
|
|
4460
|
+
analytics: data.analytics ? __spreadProps(__spreadValues({}, data.analytics), { items: mappedItems }) : void 0,
|
|
4461
|
+
filters: searchResultStore.hasAnyFilter ? searchResultStore.filters : void 0
|
|
4461
4462
|
}),
|
|
4462
4463
|
options
|
|
4463
4464
|
);
|
|
@@ -4465,7 +4466,7 @@ const useTrackingStore = defineStore("tracking", () => {
|
|
|
4465
4466
|
return { trackSearch, trackResults, trackEvent };
|
|
4466
4467
|
});
|
|
4467
4468
|
const _hoisted_1$Z = { id: "lupa-search-box-products" };
|
|
4468
|
-
const _sfc_main$
|
|
4469
|
+
const _sfc_main$12 = /* @__PURE__ */ vue.defineComponent({
|
|
4469
4470
|
__name: "SearchBoxProducts",
|
|
4470
4471
|
props: {
|
|
4471
4472
|
items: {},
|
|
@@ -4538,7 +4539,7 @@ const _sfc_main$11 = /* @__PURE__ */ vue.defineComponent({
|
|
|
4538
4539
|
itemClicked: handleProductClick
|
|
4539
4540
|
});
|
|
4540
4541
|
}), 128)) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(_ctx.items, (item, index) => {
|
|
4541
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
4542
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$13, {
|
|
4542
4543
|
key: index,
|
|
4543
4544
|
item,
|
|
4544
4545
|
panelOptions: _ctx.panelOptions,
|
|
@@ -4552,7 +4553,7 @@ const _sfc_main$11 = /* @__PURE__ */ vue.defineComponent({
|
|
|
4552
4553
|
};
|
|
4553
4554
|
}
|
|
4554
4555
|
});
|
|
4555
|
-
const _sfc_main$
|
|
4556
|
+
const _sfc_main$11 = /* @__PURE__ */ vue.defineComponent({
|
|
4556
4557
|
__name: "SearchBoxProductsWrapper",
|
|
4557
4558
|
props: {
|
|
4558
4559
|
panel: {},
|
|
@@ -4604,7 +4605,7 @@ const _sfc_main$10 = /* @__PURE__ */ vue.defineComponent({
|
|
|
4604
4605
|
const getItemsDebounced = debounce$1(getItems, props.debounce);
|
|
4605
4606
|
return (_ctx, _cache) => {
|
|
4606
4607
|
var _a, _b;
|
|
4607
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
4608
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$12, {
|
|
4608
4609
|
items: (_b = (_a = searchResult.value) == null ? void 0 : _a.items) != null ? _b : [],
|
|
4609
4610
|
panelOptions: _ctx.panel,
|
|
4610
4611
|
labels: _ctx.labels,
|
|
@@ -4622,6 +4623,95 @@ const _sfc_main$10 = /* @__PURE__ */ vue.defineComponent({
|
|
|
4622
4623
|
};
|
|
4623
4624
|
}
|
|
4624
4625
|
});
|
|
4626
|
+
const _sfc_main$10 = /* @__PURE__ */ vue.defineComponent({
|
|
4627
|
+
__name: "SearchBoxRelatedSourceWrapper",
|
|
4628
|
+
props: {
|
|
4629
|
+
panel: {},
|
|
4630
|
+
inputValue: {},
|
|
4631
|
+
options: {},
|
|
4632
|
+
labels: {},
|
|
4633
|
+
debounce: {}
|
|
4634
|
+
},
|
|
4635
|
+
emits: ["fetched"],
|
|
4636
|
+
setup(__props, { emit }) {
|
|
4637
|
+
const props = __props;
|
|
4638
|
+
const searchBoxStore = useSearchBoxStore();
|
|
4639
|
+
const { docResults } = storeToRefs(searchBoxStore);
|
|
4640
|
+
const searchResult = vue.ref(null);
|
|
4641
|
+
const options = vue.computed(() => props.options);
|
|
4642
|
+
const relatedSourceIds = vue.computed(() => {
|
|
4643
|
+
var _a, _b, _c;
|
|
4644
|
+
const queryKey = (_a = props.panel.sourceIds) == null ? void 0 : _a.queryKey;
|
|
4645
|
+
if (!queryKey) {
|
|
4646
|
+
return [];
|
|
4647
|
+
}
|
|
4648
|
+
const currentDocumentItems = (_c = (_b = docResults == null ? void 0 : docResults.value[queryKey]) == null ? void 0 : _b.items) != null ? _c : [];
|
|
4649
|
+
const allFieldValues = currentDocumentItems.map((item) => item[props.panel.sourceIds.field]).flat();
|
|
4650
|
+
const uniqueFieldValues = Array.from(new Set(allFieldValues));
|
|
4651
|
+
return uniqueFieldValues;
|
|
4652
|
+
});
|
|
4653
|
+
const inputValueProp = vue.computed(() => props.inputValue);
|
|
4654
|
+
vue.onMounted(() => {
|
|
4655
|
+
getItemsDebounced();
|
|
4656
|
+
});
|
|
4657
|
+
vue.watch(relatedSourceIds, () => {
|
|
4658
|
+
getItemsDebounced();
|
|
4659
|
+
});
|
|
4660
|
+
vue.watch(inputValueProp, () => {
|
|
4661
|
+
getItemsDebounced();
|
|
4662
|
+
});
|
|
4663
|
+
const fetchRelatedItems = () => __async(this, null, function* () {
|
|
4664
|
+
var _a, _b;
|
|
4665
|
+
if (!((_a = props.panel.target) == null ? void 0 : _a.queryKey) || !relatedSourceIds.value.length) {
|
|
4666
|
+
return { items: [], success: true, searchText: "", total: 0 };
|
|
4667
|
+
}
|
|
4668
|
+
try {
|
|
4669
|
+
const result = yield LupaSearchSdk.queryByIds(
|
|
4670
|
+
(_b = props.panel.target) == null ? void 0 : _b.queryKey,
|
|
4671
|
+
relatedSourceIds.value,
|
|
4672
|
+
options.value
|
|
4673
|
+
);
|
|
4674
|
+
if (!result.success) {
|
|
4675
|
+
return { items: [], success: true, searchText: "", total: 0 };
|
|
4676
|
+
}
|
|
4677
|
+
return result;
|
|
4678
|
+
} catch (err) {
|
|
4679
|
+
console.error(err);
|
|
4680
|
+
if (options == null ? void 0 : options.value.onError) {
|
|
4681
|
+
options.value.onError(err);
|
|
4682
|
+
}
|
|
4683
|
+
return { items: [], success: true, searchText: "", total: 0 };
|
|
4684
|
+
}
|
|
4685
|
+
});
|
|
4686
|
+
const getItems = () => __async(this, null, function* () {
|
|
4687
|
+
searchResult.value = yield fetchRelatedItems();
|
|
4688
|
+
});
|
|
4689
|
+
const getItemsDebounced = debounce$1(getItems, props.debounce);
|
|
4690
|
+
const documentPanelOptions = vue.computed(() => {
|
|
4691
|
+
return __spreadProps(__spreadValues({}, props.panel), {
|
|
4692
|
+
type: SearchBoxPanelType.DOCUMENT
|
|
4693
|
+
});
|
|
4694
|
+
});
|
|
4695
|
+
return (_ctx, _cache) => {
|
|
4696
|
+
var _a, _b;
|
|
4697
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$12, {
|
|
4698
|
+
items: (_b = (_a = searchResult.value) == null ? void 0 : _a.items) != null ? _b : [],
|
|
4699
|
+
panelOptions: documentPanelOptions.value,
|
|
4700
|
+
labels: _ctx.labels,
|
|
4701
|
+
inputValue: _ctx.inputValue,
|
|
4702
|
+
onProductClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("product-click"))
|
|
4703
|
+
}, vue.createSlots({ _: 2 }, [
|
|
4704
|
+
_ctx.$slots.productCard ? {
|
|
4705
|
+
name: "productCard",
|
|
4706
|
+
fn: vue.withCtx((props2) => [
|
|
4707
|
+
vue.renderSlot(_ctx.$slots, "productCard", vue.normalizeProps(vue.guardReactiveProps(props2)))
|
|
4708
|
+
]),
|
|
4709
|
+
key: "0"
|
|
4710
|
+
} : void 0
|
|
4711
|
+
]), 1032, ["items", "panelOptions", "labels", "inputValue"]);
|
|
4712
|
+
};
|
|
4713
|
+
}
|
|
4714
|
+
});
|
|
4625
4715
|
const _hoisted_1$Y = {
|
|
4626
4716
|
key: 0,
|
|
4627
4717
|
id: "lupa-search-box-panel"
|
|
@@ -4629,16 +4719,21 @@ const _hoisted_1$Y = {
|
|
|
4629
4719
|
const _hoisted_2$H = ["data-cy"];
|
|
4630
4720
|
const _hoisted_3$v = {
|
|
4631
4721
|
key: 0,
|
|
4632
|
-
class: "lupa-panel-title"
|
|
4722
|
+
class: "lupa-panel-title lupa-panel-title-top-results"
|
|
4633
4723
|
};
|
|
4634
4724
|
const _hoisted_4$o = {
|
|
4725
|
+
key: 1,
|
|
4726
|
+
class: "lupa-panel-title"
|
|
4727
|
+
};
|
|
4728
|
+
const _hoisted_5$e = {
|
|
4635
4729
|
key: 1,
|
|
4636
4730
|
id: "lupa-search-box-panel"
|
|
4637
4731
|
};
|
|
4638
4732
|
const __default__$3 = {
|
|
4639
4733
|
components: {
|
|
4640
|
-
SearchBoxSuggestionsWrapper: _sfc_main$
|
|
4641
|
-
SearchBoxProductsWrapper: _sfc_main$
|
|
4734
|
+
SearchBoxSuggestionsWrapper: _sfc_main$1e,
|
|
4735
|
+
SearchBoxProductsWrapper: _sfc_main$11,
|
|
4736
|
+
SearchBoxRelatedSourceWrapper: _sfc_main$10
|
|
4642
4737
|
}
|
|
4643
4738
|
};
|
|
4644
4739
|
const _sfc_main$$ = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadValues({}, __default__$3), {
|
|
@@ -4732,6 +4827,8 @@ const _sfc_main$$ = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadVa
|
|
|
4732
4827
|
switch (type) {
|
|
4733
4828
|
case "suggestion":
|
|
4734
4829
|
return "SearchBoxSuggestionsWrapper";
|
|
4830
|
+
case "related-source":
|
|
4831
|
+
return "SearchBoxRelatedSourceWrapper";
|
|
4735
4832
|
default:
|
|
4736
4833
|
return "SearchBoxProductsWrapper";
|
|
4737
4834
|
}
|
|
@@ -4757,6 +4854,17 @@ const _sfc_main$$ = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadVa
|
|
|
4757
4854
|
const panel = panelItemCounts.value.find((v) => v.queryKey === queryKey);
|
|
4758
4855
|
return (panel == null ? void 0 : panel.count) > 0 && (panel == null ? void 0 : panel.input.length) < 1;
|
|
4759
4856
|
};
|
|
4857
|
+
const canShowPanel = (panel) => {
|
|
4858
|
+
var _a, _b, _c;
|
|
4859
|
+
if (!((_a = panel.visibility) == null ? void 0 : _a.showWhenKeyHasNoResults)) {
|
|
4860
|
+
return true;
|
|
4861
|
+
}
|
|
4862
|
+
const resultCountFromRelatedPanel = (_c = (_b = panelItemCounts.value.find((v) => {
|
|
4863
|
+
var _a2;
|
|
4864
|
+
return v.queryKey === ((_a2 = panel.visibility) == null ? void 0 : _a2.showWhenKeyHasNoResults);
|
|
4865
|
+
})) == null ? void 0 : _b.count) != null ? _c : 0;
|
|
4866
|
+
return resultCountFromRelatedPanel < 1;
|
|
4867
|
+
};
|
|
4760
4868
|
return (_ctx, _cache) => {
|
|
4761
4869
|
var _a;
|
|
4762
4870
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
@@ -4770,7 +4878,7 @@ const _sfc_main$$ = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadVa
|
|
|
4770
4878
|
"data-cy": "lupa-main-panel"
|
|
4771
4879
|
}, [
|
|
4772
4880
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(displayPanels.value, (panel, index) => {
|
|
4773
|
-
var _a2, _b;
|
|
4881
|
+
var _a2, _b, _c, _d;
|
|
4774
4882
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
4775
4883
|
key: index,
|
|
4776
4884
|
class: vue.normalizeClass([
|
|
@@ -4780,8 +4888,9 @@ const _sfc_main$$ = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadVa
|
|
|
4780
4888
|
"data-cy": "lupa-panel-" + panel.type + "-index"
|
|
4781
4889
|
}, [
|
|
4782
4890
|
((_a2 = panel.labels) == null ? void 0 : _a2.topResultsTitle) && showTopResultsPanelTitle(panel.queryKey) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$v, vue.toDisplayString((_b = panel.labels) == null ? void 0 : _b.topResultsTitle), 1)) : vue.createCommentVNode("", true),
|
|
4783
|
-
panel.
|
|
4784
|
-
|
|
4891
|
+
((_c = panel.labels) == null ? void 0 : _c.title) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$o, vue.toDisplayString((_d = panel.labels) == null ? void 0 : _d.title), 1)) : vue.createCommentVNode("", true),
|
|
4892
|
+
panel.queryKey && canShowPanel(panel) ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(getComponent(panel.type)), {
|
|
4893
|
+
key: 2,
|
|
4785
4894
|
panel,
|
|
4786
4895
|
options: sdkOptions.value,
|
|
4787
4896
|
debounce: _ctx.options.debounce,
|
|
@@ -4802,18 +4911,18 @@ const _sfc_main$$ = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadVa
|
|
|
4802
4911
|
], 10, _hoisted_2$H);
|
|
4803
4912
|
}), 128))
|
|
4804
4913
|
], 4),
|
|
4805
|
-
!vue.unref(hasAnyResults) && _ctx.options.showNoResultsPanel ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
4914
|
+
!vue.unref(hasAnyResults) && _ctx.options.showNoResultsPanel ? (vue.openBlock(), vue.createBlock(_sfc_main$1h, {
|
|
4806
4915
|
key: 0,
|
|
4807
4916
|
labels: labels.value
|
|
4808
4917
|
}, null, 8, ["labels"])) : vue.createCommentVNode("", true),
|
|
4809
|
-
vue.unref(hasAnyResults) || !_ctx.options.hideMoreResultsButtonOnNoResults ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
4918
|
+
vue.unref(hasAnyResults) || !_ctx.options.hideMoreResultsButtonOnNoResults ? (vue.openBlock(), vue.createBlock(_sfc_main$1k, {
|
|
4810
4919
|
key: 1,
|
|
4811
4920
|
labels: labels.value,
|
|
4812
4921
|
showTotalCount: (_a = _ctx.options.showTotalCount) != null ? _a : false,
|
|
4813
4922
|
onGoToResults: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("go-to-results"))
|
|
4814
4923
|
}, null, 8, ["labels", "showTotalCount"])) : vue.createCommentVNode("", true)
|
|
4815
|
-
])) : displayHistory.value ? (vue.openBlock(), vue.createElementBlock("div",
|
|
4816
|
-
vue.createVNode(_sfc_main$
|
|
4924
|
+
])) : displayHistory.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5$e, [
|
|
4925
|
+
vue.createVNode(_sfc_main$1i, {
|
|
4817
4926
|
options: _ctx.options.history,
|
|
4818
4927
|
history: history.value,
|
|
4819
4928
|
onGoToResults: handleGoToResults,
|
|
@@ -4922,13 +5031,16 @@ const _sfc_main$_ = /* @__PURE__ */ vue.defineComponent({
|
|
|
4922
5031
|
suggestedValue.value = defaultSuggestedValue;
|
|
4923
5032
|
};
|
|
4924
5033
|
const handleKeyDown = (e) => {
|
|
5034
|
+
var _a2, _b;
|
|
4925
5035
|
if (!opened.value) {
|
|
4926
5036
|
return;
|
|
4927
5037
|
}
|
|
4928
5038
|
switch (e.key) {
|
|
4929
5039
|
case "Tab":
|
|
4930
|
-
|
|
4931
|
-
|
|
5040
|
+
if ((_b = (_a2 = suggestedValue == null ? void 0 : suggestedValue.value) == null ? void 0 : _a2.item) == null ? void 0 : _b.suggestion) {
|
|
5041
|
+
e.preventDefault();
|
|
5042
|
+
selectSuggestion(__spreadProps(__spreadValues({}, suggestedValue.value), { override: true }));
|
|
5043
|
+
}
|
|
4932
5044
|
break;
|
|
4933
5045
|
case "Enter":
|
|
4934
5046
|
e.preventDefault();
|
|
@@ -5080,7 +5192,7 @@ const _sfc_main$_ = /* @__PURE__ */ vue.defineComponent({
|
|
|
5080
5192
|
var _a2;
|
|
5081
5193
|
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$X, [
|
|
5082
5194
|
vue.createElementVNode("div", _hoisted_2$G, [
|
|
5083
|
-
vue.createVNode(_sfc_main$
|
|
5195
|
+
vue.createVNode(_sfc_main$1l, {
|
|
5084
5196
|
options: inputOptions.value,
|
|
5085
5197
|
suggestedValue: suggestedValue.value,
|
|
5086
5198
|
"can-close": (_a2 = _ctx.isSearchContainer) != null ? _a2 : false,
|
|
@@ -8391,7 +8503,7 @@ const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
|
|
|
8391
8503
|
},
|
|
8392
8504
|
setup(__props) {
|
|
8393
8505
|
return (_ctx, _cache) => {
|
|
8394
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
8506
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$1d, {
|
|
8395
8507
|
item: _ctx.item,
|
|
8396
8508
|
options: _ctx.options,
|
|
8397
8509
|
"wrapper-class": "lupa-search-results-image-wrapper",
|