@getlupa/vue 0.8.6 → 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 +170 -61
- package/dist/lupaSearch.mjs +170 -61
- 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,
|
|
@@ -5083,7 +5192,7 @@ const _sfc_main$_ = /* @__PURE__ */ vue.defineComponent({
|
|
|
5083
5192
|
var _a2;
|
|
5084
5193
|
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$X, [
|
|
5085
5194
|
vue.createElementVNode("div", _hoisted_2$G, [
|
|
5086
|
-
vue.createVNode(_sfc_main$
|
|
5195
|
+
vue.createVNode(_sfc_main$1l, {
|
|
5087
5196
|
options: inputOptions.value,
|
|
5088
5197
|
suggestedValue: suggestedValue.value,
|
|
5089
5198
|
"can-close": (_a2 = _ctx.isSearchContainer) != null ? _a2 : false,
|
|
@@ -8394,7 +8503,7 @@ const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
|
|
|
8394
8503
|
},
|
|
8395
8504
|
setup(__props) {
|
|
8396
8505
|
return (_ctx, _cache) => {
|
|
8397
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
8506
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$1d, {
|
|
8398
8507
|
item: _ctx.item,
|
|
8399
8508
|
options: _ctx.options,
|
|
8400
8509
|
"wrapper-class": "lupa-search-results-image-wrapper",
|
package/dist/lupaSearch.mjs
CHANGED
|
@@ -1898,7 +1898,8 @@ const trackLupaEvent = (queryKey, data = {}, options) => {
|
|
|
1898
1898
|
itemId: (_b = data.itemId) != null ? _b : "",
|
|
1899
1899
|
name: data.type,
|
|
1900
1900
|
userId: getUserKey(),
|
|
1901
|
-
sessionId: getSessionKey()
|
|
1901
|
+
sessionId: getSessionKey(),
|
|
1902
|
+
filters: data.filters
|
|
1902
1903
|
};
|
|
1903
1904
|
LupaSearchSdk.track(queryKey, eventData, options);
|
|
1904
1905
|
};
|
|
@@ -2002,9 +2003,6 @@ const track = (queryKey, data = {}, options) => {
|
|
|
2002
2003
|
return;
|
|
2003
2004
|
}
|
|
2004
2005
|
trackAnalyticsEvent(data);
|
|
2005
|
-
if (!hasSearchQuery) {
|
|
2006
|
-
return;
|
|
2007
|
-
}
|
|
2008
2006
|
trackLupaEvent(queryKey, data, options);
|
|
2009
2007
|
};
|
|
2010
2008
|
const DEFAULT_SEARCH_BOX_OPTIONS = {
|
|
@@ -2281,6 +2279,7 @@ var DocumentElementType = /* @__PURE__ */ ((DocumentElementType2) => {
|
|
|
2281
2279
|
var SearchBoxPanelType = /* @__PURE__ */ ((SearchBoxPanelType2) => {
|
|
2282
2280
|
SearchBoxPanelType2["SUGGESTION"] = "suggestion";
|
|
2283
2281
|
SearchBoxPanelType2["DOCUMENT"] = "document";
|
|
2282
|
+
SearchBoxPanelType2["RELATED_SOURCE"] = "related-source";
|
|
2284
2283
|
return SearchBoxPanelType2;
|
|
2285
2284
|
})(SearchBoxPanelType || {});
|
|
2286
2285
|
var BadgeType = /* @__PURE__ */ ((BadgeType2) => {
|
|
@@ -3197,12 +3196,12 @@ const _hoisted_1$1c = { id: "lupa-search-box-input-container" };
|
|
|
3197
3196
|
const _hoisted_2$P = { class: "lupa-input-clear" };
|
|
3198
3197
|
const _hoisted_3$A = { id: "lupa-search-box-input" };
|
|
3199
3198
|
const _hoisted_4$s = ["value"];
|
|
3200
|
-
const _hoisted_5$
|
|
3199
|
+
const _hoisted_5$h = ["aria-label", "placeholder"];
|
|
3201
3200
|
const _hoisted_6$9 = {
|
|
3202
3201
|
key: 0,
|
|
3203
3202
|
class: "lupa-close-label"
|
|
3204
3203
|
};
|
|
3205
|
-
const _sfc_main$
|
|
3204
|
+
const _sfc_main$1l = /* @__PURE__ */ defineComponent({
|
|
3206
3205
|
__name: "SearchBoxInput",
|
|
3207
3206
|
props: {
|
|
3208
3207
|
options: {},
|
|
@@ -3310,7 +3309,7 @@ const _sfc_main$1k = /* @__PURE__ */ defineComponent({
|
|
|
3310
3309
|
placeholder: labels.value.placeholder,
|
|
3311
3310
|
onInput: handleInput,
|
|
3312
3311
|
onFocus: handleFocus
|
|
3313
|
-
}), null, 16, _hoisted_5$
|
|
3312
|
+
}), null, 16, _hoisted_5$h), [
|
|
3314
3313
|
[vModelText, inputValue.value]
|
|
3315
3314
|
])
|
|
3316
3315
|
]),
|
|
@@ -3325,7 +3324,7 @@ const _sfc_main$1k = /* @__PURE__ */ defineComponent({
|
|
|
3325
3324
|
};
|
|
3326
3325
|
}
|
|
3327
3326
|
});
|
|
3328
|
-
const _sfc_main$
|
|
3327
|
+
const _sfc_main$1k = /* @__PURE__ */ defineComponent({
|
|
3329
3328
|
__name: "SearchBoxMoreResults",
|
|
3330
3329
|
props: {
|
|
3331
3330
|
labels: {},
|
|
@@ -3359,7 +3358,7 @@ const _sfc_main$1j = /* @__PURE__ */ defineComponent({
|
|
|
3359
3358
|
});
|
|
3360
3359
|
const _hoisted_1$1b = { class: "lupa-search-box-history-item" };
|
|
3361
3360
|
const _hoisted_2$O = { class: "lupa-search-box-history-item-content" };
|
|
3362
|
-
const _sfc_main$
|
|
3361
|
+
const _sfc_main$1j = /* @__PURE__ */ defineComponent({
|
|
3363
3362
|
__name: "SearchBoxHistoryItem",
|
|
3364
3363
|
props: {
|
|
3365
3364
|
item: {},
|
|
@@ -3394,7 +3393,7 @@ const _hoisted_1$1a = {
|
|
|
3394
3393
|
key: 0,
|
|
3395
3394
|
class: "lupa-search-box-history-panel"
|
|
3396
3395
|
};
|
|
3397
|
-
const _sfc_main$
|
|
3396
|
+
const _sfc_main$1i = /* @__PURE__ */ defineComponent({
|
|
3398
3397
|
__name: "SearchBoxHistoryPanel",
|
|
3399
3398
|
props: {
|
|
3400
3399
|
options: {}
|
|
@@ -3437,7 +3436,7 @@ const _sfc_main$1h = /* @__PURE__ */ defineComponent({
|
|
|
3437
3436
|
return (_ctx, _cache) => {
|
|
3438
3437
|
return hasHistory.value ? (openBlock(), createElementBlock("div", _hoisted_1$1a, [
|
|
3439
3438
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(history), (item, index) => {
|
|
3440
|
-
return openBlock(), createBlock(_sfc_main$
|
|
3439
|
+
return openBlock(), createBlock(_sfc_main$1j, {
|
|
3441
3440
|
key: item,
|
|
3442
3441
|
item,
|
|
3443
3442
|
highlighted: index === highlightIndex.value,
|
|
@@ -3454,7 +3453,7 @@ const _sfc_main$1h = /* @__PURE__ */ defineComponent({
|
|
|
3454
3453
|
}
|
|
3455
3454
|
});
|
|
3456
3455
|
const _hoisted_1$19 = { class: "lupa-search-box-no-results" };
|
|
3457
|
-
const _sfc_main$
|
|
3456
|
+
const _sfc_main$1h = /* @__PURE__ */ defineComponent({
|
|
3458
3457
|
__name: "SearchBoxNoResults",
|
|
3459
3458
|
props: {
|
|
3460
3459
|
labels: {}
|
|
@@ -3480,11 +3479,11 @@ const _hoisted_4$r = {
|
|
|
3480
3479
|
class: "lupa-suggestion-facet-label",
|
|
3481
3480
|
"data-cy": "lupa-suggestion-facet-label"
|
|
3482
3481
|
};
|
|
3483
|
-
const _hoisted_5$
|
|
3482
|
+
const _hoisted_5$g = {
|
|
3484
3483
|
class: "lupa-suggestion-facet-value",
|
|
3485
3484
|
"data-cy": "lupa-suggestion-facet-value"
|
|
3486
3485
|
};
|
|
3487
|
-
const _sfc_main$
|
|
3486
|
+
const _sfc_main$1g = /* @__PURE__ */ defineComponent({
|
|
3488
3487
|
__name: "SearchBoxSuggestion",
|
|
3489
3488
|
props: {
|
|
3490
3489
|
suggestion: {},
|
|
@@ -3523,7 +3522,7 @@ const _sfc_main$1f = /* @__PURE__ */ defineComponent({
|
|
|
3523
3522
|
}, null, 8, _hoisted_1$18)) : (openBlock(), createElementBlock("div", _hoisted_2$N, toDisplayString(_ctx.suggestion.display), 1)),
|
|
3524
3523
|
_ctx.suggestion.facet ? (openBlock(), createElementBlock("div", _hoisted_3$z, [
|
|
3525
3524
|
createElementVNode("span", _hoisted_4$r, toDisplayString(facetLabel.value), 1),
|
|
3526
|
-
createElementVNode("span", _hoisted_5$
|
|
3525
|
+
createElementVNode("span", _hoisted_5$g, toDisplayString(_ctx.suggestion.facet.title), 1)
|
|
3527
3526
|
])) : createCommentVNode("", true)
|
|
3528
3527
|
]);
|
|
3529
3528
|
};
|
|
@@ -3533,7 +3532,7 @@ const _hoisted_1$17 = {
|
|
|
3533
3532
|
id: "lupa-search-box-suggestions",
|
|
3534
3533
|
"data-cy": "lupa-search-box-suggestions"
|
|
3535
3534
|
};
|
|
3536
|
-
const _sfc_main$
|
|
3535
|
+
const _sfc_main$1f = /* @__PURE__ */ defineComponent({
|
|
3537
3536
|
__name: "SearchBoxSuggestions",
|
|
3538
3537
|
props: {
|
|
3539
3538
|
items: {},
|
|
@@ -3595,7 +3594,7 @@ const _sfc_main$1e = /* @__PURE__ */ defineComponent({
|
|
|
3595
3594
|
return (_ctx, _cache) => {
|
|
3596
3595
|
return openBlock(), createElementBlock("div", _hoisted_1$17, [
|
|
3597
3596
|
(openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (item, index) => {
|
|
3598
|
-
return openBlock(), createBlock(_sfc_main$
|
|
3597
|
+
return openBlock(), createBlock(_sfc_main$1g, {
|
|
3599
3598
|
key: getSuggestionKey(item),
|
|
3600
3599
|
class: normalizeClass(["lupa-suggestion", index === highlightedIndex.value ? "lupa-suggestion-highlighted" : ""]),
|
|
3601
3600
|
suggestion: item,
|
|
@@ -3623,7 +3622,7 @@ const debounce$1 = (func, timeout) => {
|
|
|
3623
3622
|
}, timeout);
|
|
3624
3623
|
};
|
|
3625
3624
|
};
|
|
3626
|
-
const _sfc_main$
|
|
3625
|
+
const _sfc_main$1e = /* @__PURE__ */ defineComponent({
|
|
3627
3626
|
__name: "SearchBoxSuggestionsWrapper",
|
|
3628
3627
|
props: {
|
|
3629
3628
|
panel: {},
|
|
@@ -3664,7 +3663,7 @@ const _sfc_main$1d = /* @__PURE__ */ defineComponent({
|
|
|
3664
3663
|
};
|
|
3665
3664
|
const getSuggestionsDebounced = debounce$1(getSuggestions, props.debounce);
|
|
3666
3665
|
return (_ctx, _cache) => {
|
|
3667
|
-
return openBlock(), createBlock(_sfc_main$
|
|
3666
|
+
return openBlock(), createBlock(_sfc_main$1f, {
|
|
3668
3667
|
items: searchResult.value,
|
|
3669
3668
|
highlight: _ctx.panel.highlight,
|
|
3670
3669
|
queryKey: _ctx.panel.queryKey,
|
|
@@ -3750,7 +3749,7 @@ const joinUrlParts = (...parts) => {
|
|
|
3750
3749
|
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 : "";
|
|
3751
3750
|
};
|
|
3752
3751
|
const _hoisted_1$16 = ["src"];
|
|
3753
|
-
const _sfc_main$
|
|
3752
|
+
const _sfc_main$1d = /* @__PURE__ */ defineComponent({
|
|
3754
3753
|
__name: "ProductImage",
|
|
3755
3754
|
props: {
|
|
3756
3755
|
item: {},
|
|
@@ -3808,7 +3807,7 @@ const _sfc_main$1c = /* @__PURE__ */ defineComponent({
|
|
|
3808
3807
|
};
|
|
3809
3808
|
}
|
|
3810
3809
|
});
|
|
3811
|
-
const _sfc_main$
|
|
3810
|
+
const _sfc_main$1c = /* @__PURE__ */ defineComponent({
|
|
3812
3811
|
__name: "SearchBoxProductImage",
|
|
3813
3812
|
props: {
|
|
3814
3813
|
item: {},
|
|
@@ -3816,7 +3815,7 @@ const _sfc_main$1b = /* @__PURE__ */ defineComponent({
|
|
|
3816
3815
|
},
|
|
3817
3816
|
setup(__props) {
|
|
3818
3817
|
return (_ctx, _cache) => {
|
|
3819
|
-
return openBlock(), createBlock(_sfc_main$
|
|
3818
|
+
return openBlock(), createBlock(_sfc_main$1d, {
|
|
3820
3819
|
item: _ctx.item,
|
|
3821
3820
|
options: _ctx.options,
|
|
3822
3821
|
"wrapper-class": "lupa-search-box-image-wrapper",
|
|
@@ -3830,7 +3829,7 @@ const _hoisted_2$M = {
|
|
|
3830
3829
|
key: 1,
|
|
3831
3830
|
class: "lupa-search-box-product-title"
|
|
3832
3831
|
};
|
|
3833
|
-
const _sfc_main$
|
|
3832
|
+
const _sfc_main$1b = /* @__PURE__ */ defineComponent({
|
|
3834
3833
|
__name: "SearchBoxProductTitle",
|
|
3835
3834
|
props: {
|
|
3836
3835
|
item: {},
|
|
@@ -3861,7 +3860,7 @@ const _hoisted_2$L = {
|
|
|
3861
3860
|
key: 1,
|
|
3862
3861
|
class: "lupa-search-box-product-description"
|
|
3863
3862
|
};
|
|
3864
|
-
const _sfc_main$
|
|
3863
|
+
const _sfc_main$1a = /* @__PURE__ */ defineComponent({
|
|
3865
3864
|
__name: "SearchBoxProductDescription",
|
|
3866
3865
|
props: {
|
|
3867
3866
|
item: {},
|
|
@@ -3886,7 +3885,7 @@ const _sfc_main$19 = /* @__PURE__ */ defineComponent({
|
|
|
3886
3885
|
}
|
|
3887
3886
|
});
|
|
3888
3887
|
const _hoisted_1$13 = { class: "lupa-search-box-product-price" };
|
|
3889
|
-
const _sfc_main$
|
|
3888
|
+
const _sfc_main$19 = /* @__PURE__ */ defineComponent({
|
|
3890
3889
|
__name: "SearchBoxProductPrice",
|
|
3891
3890
|
props: {
|
|
3892
3891
|
item: {},
|
|
@@ -3911,7 +3910,7 @@ const _sfc_main$18 = /* @__PURE__ */ defineComponent({
|
|
|
3911
3910
|
}
|
|
3912
3911
|
});
|
|
3913
3912
|
const _hoisted_1$12 = { class: "lupa-search-box-product-regular-price" };
|
|
3914
|
-
const _sfc_main$
|
|
3913
|
+
const _sfc_main$18 = /* @__PURE__ */ defineComponent({
|
|
3915
3914
|
__name: "SearchBoxProductRegularPrice",
|
|
3916
3915
|
props: {
|
|
3917
3916
|
item: {},
|
|
@@ -3937,8 +3936,8 @@ const _hoisted_1$11 = ["innerHTML"];
|
|
|
3937
3936
|
const _hoisted_2$K = { key: 0 };
|
|
3938
3937
|
const _hoisted_3$y = { key: 1 };
|
|
3939
3938
|
const _hoisted_4$q = { class: "lupa-search-box-custom-label" };
|
|
3940
|
-
const _hoisted_5$
|
|
3941
|
-
const _sfc_main$
|
|
3939
|
+
const _hoisted_5$f = { class: "lupa-search-box-custom-text" };
|
|
3940
|
+
const _sfc_main$17 = /* @__PURE__ */ defineComponent({
|
|
3942
3941
|
__name: "SearchBoxProductCustom",
|
|
3943
3942
|
props: {
|
|
3944
3943
|
item: {},
|
|
@@ -3970,14 +3969,14 @@ const _sfc_main$16 = /* @__PURE__ */ defineComponent({
|
|
|
3970
3969
|
}, toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), [
|
|
3971
3970
|
!label.value ? (openBlock(), createElementBlock("div", _hoisted_2$K, toDisplayString(text.value), 1)) : (openBlock(), createElementBlock("div", _hoisted_3$y, [
|
|
3972
3971
|
createElementVNode("div", _hoisted_4$q, toDisplayString(label.value), 1),
|
|
3973
|
-
createElementVNode("div", _hoisted_5$
|
|
3972
|
+
createElementVNode("div", _hoisted_5$f, toDisplayString(text.value), 1)
|
|
3974
3973
|
]))
|
|
3975
3974
|
], 16));
|
|
3976
3975
|
};
|
|
3977
3976
|
}
|
|
3978
3977
|
});
|
|
3979
3978
|
const _hoisted_1$10 = ["innerHTML"];
|
|
3980
|
-
const _sfc_main$
|
|
3979
|
+
const _sfc_main$16 = /* @__PURE__ */ defineComponent({
|
|
3981
3980
|
__name: "SearchBoxProductCustomHtml",
|
|
3982
3981
|
props: {
|
|
3983
3982
|
item: {},
|
|
@@ -4194,7 +4193,7 @@ const useSearchResultStore = defineStore("searchResult", () => {
|
|
|
4194
4193
|
const _hoisted_1$$ = { class: "lupa-search-box-add-to-cart-wrapper" };
|
|
4195
4194
|
const _hoisted_2$J = { class: "lupa-search-box-product-addtocart" };
|
|
4196
4195
|
const _hoisted_3$x = ["onClick", "disabled"];
|
|
4197
|
-
const _sfc_main$
|
|
4196
|
+
const _sfc_main$15 = /* @__PURE__ */ defineComponent({
|
|
4198
4197
|
__name: "SearchBoxProductAddToCart",
|
|
4199
4198
|
props: {
|
|
4200
4199
|
item: {},
|
|
@@ -4237,17 +4236,17 @@ const _sfc_main$14 = /* @__PURE__ */ defineComponent({
|
|
|
4237
4236
|
});
|
|
4238
4237
|
const __default__$4 = {
|
|
4239
4238
|
components: {
|
|
4240
|
-
SearchBoxProductImage: _sfc_main$
|
|
4241
|
-
SearchBoxProductTitle: _sfc_main$
|
|
4242
|
-
SearchBoxProductDescription: _sfc_main$
|
|
4243
|
-
SearchBoxProductPrice: _sfc_main$
|
|
4244
|
-
SearchBoxProductRegularPrice: _sfc_main$
|
|
4245
|
-
SearchBoxProductCustom: _sfc_main$
|
|
4246
|
-
SearchBoxProductCustomHtml: _sfc_main$
|
|
4247
|
-
SearchBoxProductAddToCart: _sfc_main$
|
|
4239
|
+
SearchBoxProductImage: _sfc_main$1c,
|
|
4240
|
+
SearchBoxProductTitle: _sfc_main$1b,
|
|
4241
|
+
SearchBoxProductDescription: _sfc_main$1a,
|
|
4242
|
+
SearchBoxProductPrice: _sfc_main$19,
|
|
4243
|
+
SearchBoxProductRegularPrice: _sfc_main$18,
|
|
4244
|
+
SearchBoxProductCustom: _sfc_main$17,
|
|
4245
|
+
SearchBoxProductCustomHtml: _sfc_main$16,
|
|
4246
|
+
SearchBoxProductAddToCart: _sfc_main$15
|
|
4248
4247
|
}
|
|
4249
4248
|
};
|
|
4250
|
-
const _sfc_main$
|
|
4249
|
+
const _sfc_main$14 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$4), {
|
|
4251
4250
|
__name: "SearchBoxProductElement",
|
|
4252
4251
|
props: {
|
|
4253
4252
|
item: {},
|
|
@@ -4313,7 +4312,7 @@ const _hoisted_4$p = {
|
|
|
4313
4312
|
key: 0,
|
|
4314
4313
|
class: "lupa-search-box-product-add-to-cart-section"
|
|
4315
4314
|
};
|
|
4316
|
-
const _sfc_main$
|
|
4315
|
+
const _sfc_main$13 = /* @__PURE__ */ defineComponent({
|
|
4317
4316
|
__name: "SearchBoxProduct",
|
|
4318
4317
|
props: {
|
|
4319
4318
|
item: {},
|
|
@@ -4371,7 +4370,7 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
|
|
|
4371
4370
|
}), [
|
|
4372
4371
|
createElementVNode("div", _hoisted_2$I, [
|
|
4373
4372
|
(openBlock(true), createElementBlock(Fragment, null, renderList(imageElements.value, (element) => {
|
|
4374
|
-
return openBlock(), createBlock(_sfc_main$
|
|
4373
|
+
return openBlock(), createBlock(_sfc_main$14, {
|
|
4375
4374
|
class: "lupa-search-box-product-element",
|
|
4376
4375
|
item: _ctx.item,
|
|
4377
4376
|
element,
|
|
@@ -4383,7 +4382,7 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
|
|
|
4383
4382
|
]),
|
|
4384
4383
|
createElementVNode("div", _hoisted_3$w, [
|
|
4385
4384
|
(openBlock(true), createElementBlock(Fragment, null, renderList(detailElements.value, (element) => {
|
|
4386
|
-
return openBlock(), createBlock(_sfc_main$
|
|
4385
|
+
return openBlock(), createBlock(_sfc_main$14, {
|
|
4387
4386
|
class: "lupa-search-box-product-element",
|
|
4388
4387
|
item: _ctx.item,
|
|
4389
4388
|
element,
|
|
@@ -4394,7 +4393,7 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
|
|
|
4394
4393
|
}), 128))
|
|
4395
4394
|
]),
|
|
4396
4395
|
addToCartElement.value ? (openBlock(), createElementBlock("div", _hoisted_4$p, [
|
|
4397
|
-
createVNode(_sfc_main$
|
|
4396
|
+
createVNode(_sfc_main$14, {
|
|
4398
4397
|
class: "lupa-search-box-product-element",
|
|
4399
4398
|
item: _ctx.item,
|
|
4400
4399
|
element: addToCartElement.value,
|
|
@@ -4418,6 +4417,7 @@ const getSearchTrackingData = (searchText, type) => {
|
|
|
4418
4417
|
};
|
|
4419
4418
|
const useTrackingStore = defineStore("tracking", () => {
|
|
4420
4419
|
const optionsStore = useOptionsStore();
|
|
4420
|
+
const searchResultStore = useSearchResultStore();
|
|
4421
4421
|
const trackSearch = ({
|
|
4422
4422
|
queryKey,
|
|
4423
4423
|
query,
|
|
@@ -4455,7 +4455,8 @@ const useTrackingStore = defineStore("tracking", () => {
|
|
|
4455
4455
|
track(
|
|
4456
4456
|
queryKey,
|
|
4457
4457
|
__spreadProps(__spreadValues({}, data), {
|
|
4458
|
-
analytics: data.analytics ? __spreadProps(__spreadValues({}, data.analytics), { items: mappedItems }) : void 0
|
|
4458
|
+
analytics: data.analytics ? __spreadProps(__spreadValues({}, data.analytics), { items: mappedItems }) : void 0,
|
|
4459
|
+
filters: searchResultStore.hasAnyFilter ? searchResultStore.filters : void 0
|
|
4459
4460
|
}),
|
|
4460
4461
|
options
|
|
4461
4462
|
);
|
|
@@ -4463,7 +4464,7 @@ const useTrackingStore = defineStore("tracking", () => {
|
|
|
4463
4464
|
return { trackSearch, trackResults, trackEvent };
|
|
4464
4465
|
});
|
|
4465
4466
|
const _hoisted_1$Z = { id: "lupa-search-box-products" };
|
|
4466
|
-
const _sfc_main$
|
|
4467
|
+
const _sfc_main$12 = /* @__PURE__ */ defineComponent({
|
|
4467
4468
|
__name: "SearchBoxProducts",
|
|
4468
4469
|
props: {
|
|
4469
4470
|
items: {},
|
|
@@ -4536,7 +4537,7 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
|
|
|
4536
4537
|
itemClicked: handleProductClick
|
|
4537
4538
|
});
|
|
4538
4539
|
}), 128)) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(_ctx.items, (item, index) => {
|
|
4539
|
-
return openBlock(), createBlock(_sfc_main$
|
|
4540
|
+
return openBlock(), createBlock(_sfc_main$13, {
|
|
4540
4541
|
key: index,
|
|
4541
4542
|
item,
|
|
4542
4543
|
panelOptions: _ctx.panelOptions,
|
|
@@ -4550,7 +4551,7 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
|
|
|
4550
4551
|
};
|
|
4551
4552
|
}
|
|
4552
4553
|
});
|
|
4553
|
-
const _sfc_main$
|
|
4554
|
+
const _sfc_main$11 = /* @__PURE__ */ defineComponent({
|
|
4554
4555
|
__name: "SearchBoxProductsWrapper",
|
|
4555
4556
|
props: {
|
|
4556
4557
|
panel: {},
|
|
@@ -4602,7 +4603,7 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
|
|
|
4602
4603
|
const getItemsDebounced = debounce$1(getItems, props.debounce);
|
|
4603
4604
|
return (_ctx, _cache) => {
|
|
4604
4605
|
var _a, _b;
|
|
4605
|
-
return openBlock(), createBlock(_sfc_main$
|
|
4606
|
+
return openBlock(), createBlock(_sfc_main$12, {
|
|
4606
4607
|
items: (_b = (_a = searchResult.value) == null ? void 0 : _a.items) != null ? _b : [],
|
|
4607
4608
|
panelOptions: _ctx.panel,
|
|
4608
4609
|
labels: _ctx.labels,
|
|
@@ -4620,6 +4621,95 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
|
|
|
4620
4621
|
};
|
|
4621
4622
|
}
|
|
4622
4623
|
});
|
|
4624
|
+
const _sfc_main$10 = /* @__PURE__ */ defineComponent({
|
|
4625
|
+
__name: "SearchBoxRelatedSourceWrapper",
|
|
4626
|
+
props: {
|
|
4627
|
+
panel: {},
|
|
4628
|
+
inputValue: {},
|
|
4629
|
+
options: {},
|
|
4630
|
+
labels: {},
|
|
4631
|
+
debounce: {}
|
|
4632
|
+
},
|
|
4633
|
+
emits: ["fetched"],
|
|
4634
|
+
setup(__props, { emit }) {
|
|
4635
|
+
const props = __props;
|
|
4636
|
+
const searchBoxStore = useSearchBoxStore();
|
|
4637
|
+
const { docResults } = storeToRefs(searchBoxStore);
|
|
4638
|
+
const searchResult = ref(null);
|
|
4639
|
+
const options = computed(() => props.options);
|
|
4640
|
+
const relatedSourceIds = computed(() => {
|
|
4641
|
+
var _a, _b, _c;
|
|
4642
|
+
const queryKey = (_a = props.panel.sourceIds) == null ? void 0 : _a.queryKey;
|
|
4643
|
+
if (!queryKey) {
|
|
4644
|
+
return [];
|
|
4645
|
+
}
|
|
4646
|
+
const currentDocumentItems = (_c = (_b = docResults == null ? void 0 : docResults.value[queryKey]) == null ? void 0 : _b.items) != null ? _c : [];
|
|
4647
|
+
const allFieldValues = currentDocumentItems.map((item) => item[props.panel.sourceIds.field]).flat();
|
|
4648
|
+
const uniqueFieldValues = Array.from(new Set(allFieldValues));
|
|
4649
|
+
return uniqueFieldValues;
|
|
4650
|
+
});
|
|
4651
|
+
const inputValueProp = computed(() => props.inputValue);
|
|
4652
|
+
onMounted(() => {
|
|
4653
|
+
getItemsDebounced();
|
|
4654
|
+
});
|
|
4655
|
+
watch(relatedSourceIds, () => {
|
|
4656
|
+
getItemsDebounced();
|
|
4657
|
+
});
|
|
4658
|
+
watch(inputValueProp, () => {
|
|
4659
|
+
getItemsDebounced();
|
|
4660
|
+
});
|
|
4661
|
+
const fetchRelatedItems = () => __async(this, null, function* () {
|
|
4662
|
+
var _a, _b;
|
|
4663
|
+
if (!((_a = props.panel.target) == null ? void 0 : _a.queryKey) || !relatedSourceIds.value.length) {
|
|
4664
|
+
return { items: [], success: true, searchText: "", total: 0 };
|
|
4665
|
+
}
|
|
4666
|
+
try {
|
|
4667
|
+
const result = yield LupaSearchSdk.queryByIds(
|
|
4668
|
+
(_b = props.panel.target) == null ? void 0 : _b.queryKey,
|
|
4669
|
+
relatedSourceIds.value,
|
|
4670
|
+
options.value
|
|
4671
|
+
);
|
|
4672
|
+
if (!result.success) {
|
|
4673
|
+
return { items: [], success: true, searchText: "", total: 0 };
|
|
4674
|
+
}
|
|
4675
|
+
return result;
|
|
4676
|
+
} catch (err) {
|
|
4677
|
+
console.error(err);
|
|
4678
|
+
if (options == null ? void 0 : options.value.onError) {
|
|
4679
|
+
options.value.onError(err);
|
|
4680
|
+
}
|
|
4681
|
+
return { items: [], success: true, searchText: "", total: 0 };
|
|
4682
|
+
}
|
|
4683
|
+
});
|
|
4684
|
+
const getItems = () => __async(this, null, function* () {
|
|
4685
|
+
searchResult.value = yield fetchRelatedItems();
|
|
4686
|
+
});
|
|
4687
|
+
const getItemsDebounced = debounce$1(getItems, props.debounce);
|
|
4688
|
+
const documentPanelOptions = computed(() => {
|
|
4689
|
+
return __spreadProps(__spreadValues({}, props.panel), {
|
|
4690
|
+
type: SearchBoxPanelType.DOCUMENT
|
|
4691
|
+
});
|
|
4692
|
+
});
|
|
4693
|
+
return (_ctx, _cache) => {
|
|
4694
|
+
var _a, _b;
|
|
4695
|
+
return openBlock(), createBlock(_sfc_main$12, {
|
|
4696
|
+
items: (_b = (_a = searchResult.value) == null ? void 0 : _a.items) != null ? _b : [],
|
|
4697
|
+
panelOptions: documentPanelOptions.value,
|
|
4698
|
+
labels: _ctx.labels,
|
|
4699
|
+
inputValue: _ctx.inputValue,
|
|
4700
|
+
onProductClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("product-click"))
|
|
4701
|
+
}, createSlots({ _: 2 }, [
|
|
4702
|
+
_ctx.$slots.productCard ? {
|
|
4703
|
+
name: "productCard",
|
|
4704
|
+
fn: withCtx((props2) => [
|
|
4705
|
+
renderSlot(_ctx.$slots, "productCard", normalizeProps(guardReactiveProps(props2)))
|
|
4706
|
+
]),
|
|
4707
|
+
key: "0"
|
|
4708
|
+
} : void 0
|
|
4709
|
+
]), 1032, ["items", "panelOptions", "labels", "inputValue"]);
|
|
4710
|
+
};
|
|
4711
|
+
}
|
|
4712
|
+
});
|
|
4623
4713
|
const _hoisted_1$Y = {
|
|
4624
4714
|
key: 0,
|
|
4625
4715
|
id: "lupa-search-box-panel"
|
|
@@ -4627,16 +4717,21 @@ const _hoisted_1$Y = {
|
|
|
4627
4717
|
const _hoisted_2$H = ["data-cy"];
|
|
4628
4718
|
const _hoisted_3$v = {
|
|
4629
4719
|
key: 0,
|
|
4630
|
-
class: "lupa-panel-title"
|
|
4720
|
+
class: "lupa-panel-title lupa-panel-title-top-results"
|
|
4631
4721
|
};
|
|
4632
4722
|
const _hoisted_4$o = {
|
|
4723
|
+
key: 1,
|
|
4724
|
+
class: "lupa-panel-title"
|
|
4725
|
+
};
|
|
4726
|
+
const _hoisted_5$e = {
|
|
4633
4727
|
key: 1,
|
|
4634
4728
|
id: "lupa-search-box-panel"
|
|
4635
4729
|
};
|
|
4636
4730
|
const __default__$3 = {
|
|
4637
4731
|
components: {
|
|
4638
|
-
SearchBoxSuggestionsWrapper: _sfc_main$
|
|
4639
|
-
SearchBoxProductsWrapper: _sfc_main$
|
|
4732
|
+
SearchBoxSuggestionsWrapper: _sfc_main$1e,
|
|
4733
|
+
SearchBoxProductsWrapper: _sfc_main$11,
|
|
4734
|
+
SearchBoxRelatedSourceWrapper: _sfc_main$10
|
|
4640
4735
|
}
|
|
4641
4736
|
};
|
|
4642
4737
|
const _sfc_main$$ = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$3), {
|
|
@@ -4730,6 +4825,8 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
|
|
|
4730
4825
|
switch (type) {
|
|
4731
4826
|
case "suggestion":
|
|
4732
4827
|
return "SearchBoxSuggestionsWrapper";
|
|
4828
|
+
case "related-source":
|
|
4829
|
+
return "SearchBoxRelatedSourceWrapper";
|
|
4733
4830
|
default:
|
|
4734
4831
|
return "SearchBoxProductsWrapper";
|
|
4735
4832
|
}
|
|
@@ -4755,6 +4852,17 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
|
|
|
4755
4852
|
const panel = panelItemCounts.value.find((v) => v.queryKey === queryKey);
|
|
4756
4853
|
return (panel == null ? void 0 : panel.count) > 0 && (panel == null ? void 0 : panel.input.length) < 1;
|
|
4757
4854
|
};
|
|
4855
|
+
const canShowPanel = (panel) => {
|
|
4856
|
+
var _a, _b, _c;
|
|
4857
|
+
if (!((_a = panel.visibility) == null ? void 0 : _a.showWhenKeyHasNoResults)) {
|
|
4858
|
+
return true;
|
|
4859
|
+
}
|
|
4860
|
+
const resultCountFromRelatedPanel = (_c = (_b = panelItemCounts.value.find((v) => {
|
|
4861
|
+
var _a2;
|
|
4862
|
+
return v.queryKey === ((_a2 = panel.visibility) == null ? void 0 : _a2.showWhenKeyHasNoResults);
|
|
4863
|
+
})) == null ? void 0 : _b.count) != null ? _c : 0;
|
|
4864
|
+
return resultCountFromRelatedPanel < 1;
|
|
4865
|
+
};
|
|
4758
4866
|
return (_ctx, _cache) => {
|
|
4759
4867
|
var _a;
|
|
4760
4868
|
return openBlock(), createElementBlock("div", {
|
|
@@ -4768,7 +4876,7 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
|
|
|
4768
4876
|
"data-cy": "lupa-main-panel"
|
|
4769
4877
|
}, [
|
|
4770
4878
|
(openBlock(true), createElementBlock(Fragment, null, renderList(displayPanels.value, (panel, index) => {
|
|
4771
|
-
var _a2, _b;
|
|
4879
|
+
var _a2, _b, _c, _d;
|
|
4772
4880
|
return openBlock(), createElementBlock("div", {
|
|
4773
4881
|
key: index,
|
|
4774
4882
|
class: normalizeClass([
|
|
@@ -4778,8 +4886,9 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
|
|
|
4778
4886
|
"data-cy": "lupa-panel-" + panel.type + "-index"
|
|
4779
4887
|
}, [
|
|
4780
4888
|
((_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),
|
|
4781
|
-
panel.
|
|
4782
|
-
|
|
4889
|
+
((_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),
|
|
4890
|
+
panel.queryKey && canShowPanel(panel) ? (openBlock(), createBlock(resolveDynamicComponent(getComponent(panel.type)), {
|
|
4891
|
+
key: 2,
|
|
4783
4892
|
panel,
|
|
4784
4893
|
options: sdkOptions.value,
|
|
4785
4894
|
debounce: _ctx.options.debounce,
|
|
@@ -4800,18 +4909,18 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
|
|
|
4800
4909
|
], 10, _hoisted_2$H);
|
|
4801
4910
|
}), 128))
|
|
4802
4911
|
], 4),
|
|
4803
|
-
!unref(hasAnyResults) && _ctx.options.showNoResultsPanel ? (openBlock(), createBlock(_sfc_main$
|
|
4912
|
+
!unref(hasAnyResults) && _ctx.options.showNoResultsPanel ? (openBlock(), createBlock(_sfc_main$1h, {
|
|
4804
4913
|
key: 0,
|
|
4805
4914
|
labels: labels.value
|
|
4806
4915
|
}, null, 8, ["labels"])) : createCommentVNode("", true),
|
|
4807
|
-
unref(hasAnyResults) || !_ctx.options.hideMoreResultsButtonOnNoResults ? (openBlock(), createBlock(_sfc_main$
|
|
4916
|
+
unref(hasAnyResults) || !_ctx.options.hideMoreResultsButtonOnNoResults ? (openBlock(), createBlock(_sfc_main$1k, {
|
|
4808
4917
|
key: 1,
|
|
4809
4918
|
labels: labels.value,
|
|
4810
4919
|
showTotalCount: (_a = _ctx.options.showTotalCount) != null ? _a : false,
|
|
4811
4920
|
onGoToResults: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("go-to-results"))
|
|
4812
4921
|
}, null, 8, ["labels", "showTotalCount"])) : createCommentVNode("", true)
|
|
4813
|
-
])) : displayHistory.value ? (openBlock(), createElementBlock("div",
|
|
4814
|
-
createVNode(_sfc_main$
|
|
4922
|
+
])) : displayHistory.value ? (openBlock(), createElementBlock("div", _hoisted_5$e, [
|
|
4923
|
+
createVNode(_sfc_main$1i, {
|
|
4815
4924
|
options: _ctx.options.history,
|
|
4816
4925
|
history: history.value,
|
|
4817
4926
|
onGoToResults: handleGoToResults,
|
|
@@ -5081,7 +5190,7 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent({
|
|
|
5081
5190
|
var _a2;
|
|
5082
5191
|
return openBlock(), createElementBlock("div", _hoisted_1$X, [
|
|
5083
5192
|
createElementVNode("div", _hoisted_2$G, [
|
|
5084
|
-
createVNode(_sfc_main$
|
|
5193
|
+
createVNode(_sfc_main$1l, {
|
|
5085
5194
|
options: inputOptions.value,
|
|
5086
5195
|
suggestedValue: suggestedValue.value,
|
|
5087
5196
|
"can-close": (_a2 = _ctx.isSearchContainer) != null ? _a2 : false,
|
|
@@ -8392,7 +8501,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
8392
8501
|
},
|
|
8393
8502
|
setup(__props) {
|
|
8394
8503
|
return (_ctx, _cache) => {
|
|
8395
|
-
return openBlock(), createBlock(_sfc_main$
|
|
8504
|
+
return openBlock(), createBlock(_sfc_main$1d, {
|
|
8396
8505
|
item: _ctx.item,
|
|
8397
8506
|
options: _ctx.options,
|
|
8398
8507
|
"wrapper-class": "lupa-search-results-image-wrapper",
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { PropType as __PropType } from 'vue';
|
|
2
|
+
import { RelatedSourcePanel } from '../../../types/search-box/SearchBoxPanel';
|
|
3
|
+
import { SdkOptions } from '../../../types/General';
|
|
4
|
+
import { SearchBoxOptionLabels } from '../../../types/search-box/SearchBoxOptions';
|
|
5
|
+
declare const _sfc_main: import("vue").DefineComponent<{
|
|
6
|
+
panel: {
|
|
7
|
+
type: __PropType<RelatedSourcePanel>;
|
|
8
|
+
required: true;
|
|
9
|
+
};
|
|
10
|
+
inputValue: {
|
|
11
|
+
type: __PropType<string>;
|
|
12
|
+
required: true;
|
|
13
|
+
};
|
|
14
|
+
options: {
|
|
15
|
+
type: __PropType<SdkOptions>;
|
|
16
|
+
required: true;
|
|
17
|
+
};
|
|
18
|
+
labels: {
|
|
19
|
+
type: __PropType<SearchBoxOptionLabels>;
|
|
20
|
+
required: false;
|
|
21
|
+
};
|
|
22
|
+
debounce: {
|
|
23
|
+
type: __PropType<number>;
|
|
24
|
+
required: false;
|
|
25
|
+
};
|
|
26
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "fetched"[], "fetched", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
27
|
+
panel: {
|
|
28
|
+
type: __PropType<RelatedSourcePanel>;
|
|
29
|
+
required: true;
|
|
30
|
+
};
|
|
31
|
+
inputValue: {
|
|
32
|
+
type: __PropType<string>;
|
|
33
|
+
required: true;
|
|
34
|
+
};
|
|
35
|
+
options: {
|
|
36
|
+
type: __PropType<SdkOptions>;
|
|
37
|
+
required: true;
|
|
38
|
+
};
|
|
39
|
+
labels: {
|
|
40
|
+
type: __PropType<SearchBoxOptionLabels>;
|
|
41
|
+
required: false;
|
|
42
|
+
};
|
|
43
|
+
debounce: {
|
|
44
|
+
type: __PropType<number>;
|
|
45
|
+
required: false;
|
|
46
|
+
};
|
|
47
|
+
}>> & {
|
|
48
|
+
onFetched?: (...args: any[]) => any;
|
|
49
|
+
}, {}, {}>;
|
|
50
|
+
export default _sfc_main;
|
|
@@ -18,14 +18,14 @@ export declare const useSearchBoxStore: import("pinia").StoreDefinition<"searchB
|
|
|
18
18
|
} | {
|
|
19
19
|
queryKey: string;
|
|
20
20
|
count: number;
|
|
21
|
-
panel: import('../types/search-box/SearchBoxPanel').DocumentSearchBoxPanel;
|
|
21
|
+
panel: import('../types/search-box/SearchBoxPanel').DocumentSearchBoxPanel | import('../types/search-box/SearchBoxPanel').RelatedSourcePanel;
|
|
22
22
|
input: string;
|
|
23
23
|
})[]>;
|
|
24
24
|
totalCount: import("vue").ComputedRef<number>;
|
|
25
25
|
highlightedItem: import("vue").ComputedRef<{
|
|
26
26
|
queryKey: string;
|
|
27
27
|
index: number;
|
|
28
|
-
panel: import('../types/search-box/SearchBoxPanel').DocumentSearchBoxPanel | import('../types/search-box/SearchBoxPanel').SuggestionSearchBoxPanel;
|
|
28
|
+
panel: import('../types/search-box/SearchBoxPanel').DocumentSearchBoxPanel | import('../types/search-box/SearchBoxPanel').SuggestionSearchBoxPanel | import('../types/search-box/SearchBoxPanel').RelatedSourcePanel;
|
|
29
29
|
}>;
|
|
30
30
|
highlightedDocument: import("vue").ComputedRef<{
|
|
31
31
|
doc: any;
|
|
@@ -88,14 +88,14 @@ export declare const useSearchBoxStore: import("pinia").StoreDefinition<"searchB
|
|
|
88
88
|
} | {
|
|
89
89
|
queryKey: string;
|
|
90
90
|
count: number;
|
|
91
|
-
panel: import('../types/search-box/SearchBoxPanel').DocumentSearchBoxPanel;
|
|
91
|
+
panel: import('../types/search-box/SearchBoxPanel').DocumentSearchBoxPanel | import('../types/search-box/SearchBoxPanel').RelatedSourcePanel;
|
|
92
92
|
input: string;
|
|
93
93
|
})[]>;
|
|
94
94
|
totalCount: import("vue").ComputedRef<number>;
|
|
95
95
|
highlightedItem: import("vue").ComputedRef<{
|
|
96
96
|
queryKey: string;
|
|
97
97
|
index: number;
|
|
98
|
-
panel: import('../types/search-box/SearchBoxPanel').DocumentSearchBoxPanel | import('../types/search-box/SearchBoxPanel').SuggestionSearchBoxPanel;
|
|
98
|
+
panel: import('../types/search-box/SearchBoxPanel').DocumentSearchBoxPanel | import('../types/search-box/SearchBoxPanel').SuggestionSearchBoxPanel | import('../types/search-box/SearchBoxPanel').RelatedSourcePanel;
|
|
99
99
|
}>;
|
|
100
100
|
highlightedDocument: import("vue").ComputedRef<{
|
|
101
101
|
doc: any;
|
|
@@ -158,14 +158,14 @@ export declare const useSearchBoxStore: import("pinia").StoreDefinition<"searchB
|
|
|
158
158
|
} | {
|
|
159
159
|
queryKey: string;
|
|
160
160
|
count: number;
|
|
161
|
-
panel: import('../types/search-box/SearchBoxPanel').DocumentSearchBoxPanel;
|
|
161
|
+
panel: import('../types/search-box/SearchBoxPanel').DocumentSearchBoxPanel | import('../types/search-box/SearchBoxPanel').RelatedSourcePanel;
|
|
162
162
|
input: string;
|
|
163
163
|
})[]>;
|
|
164
164
|
totalCount: import("vue").ComputedRef<number>;
|
|
165
165
|
highlightedItem: import("vue").ComputedRef<{
|
|
166
166
|
queryKey: string;
|
|
167
167
|
index: number;
|
|
168
|
-
panel: import('../types/search-box/SearchBoxPanel').DocumentSearchBoxPanel | import('../types/search-box/SearchBoxPanel').SuggestionSearchBoxPanel;
|
|
168
|
+
panel: import('../types/search-box/SearchBoxPanel').DocumentSearchBoxPanel | import('../types/search-box/SearchBoxPanel').SuggestionSearchBoxPanel | import('../types/search-box/SearchBoxPanel').RelatedSourcePanel;
|
|
169
169
|
}>;
|
|
170
170
|
highlightedDocument: import("vue").ComputedRef<{
|
|
171
171
|
doc: any;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Document, Suggestion, ReportableEventType } from '@getlupa/client-sdk/Types';
|
|
1
|
+
import type { Document, Suggestion, ReportableEventType, FilterGroup } from '@getlupa/client-sdk/Types';
|
|
2
2
|
import type { AnalyticsEventType } from '../AnalyticsOptions';
|
|
3
3
|
import type { SearchBoxPanelType } from './SearchBoxPanel';
|
|
4
4
|
export type FetchedData = {
|
|
@@ -42,6 +42,7 @@ export type TrackableEventData = {
|
|
|
42
42
|
options?: {
|
|
43
43
|
allowEmptySearchQuery: boolean;
|
|
44
44
|
};
|
|
45
|
+
filters?: FilterGroup;
|
|
45
46
|
};
|
|
46
47
|
export type HighlightedDocInfo = {
|
|
47
48
|
doc?: Document;
|
|
@@ -3,12 +3,14 @@ import type { Document } from '@getlupa/client-sdk/Types';
|
|
|
3
3
|
import { CustomDocumentHtmlAttributes } from '../General';
|
|
4
4
|
export declare enum SearchBoxPanelType {
|
|
5
5
|
SUGGESTION = "suggestion",
|
|
6
|
-
DOCUMENT = "document"
|
|
6
|
+
DOCUMENT = "document",
|
|
7
|
+
RELATED_SOURCE = "related-source"
|
|
7
8
|
}
|
|
8
9
|
export type SearchBoxPanelLinks = {
|
|
9
10
|
details: string;
|
|
10
11
|
};
|
|
11
12
|
export type SearchBoxPanelLabels = {
|
|
13
|
+
title?: string;
|
|
12
14
|
topResultsTitle?: string;
|
|
13
15
|
};
|
|
14
16
|
export type SearchBoxPanelBase = {
|
|
@@ -16,6 +18,9 @@ export type SearchBoxPanelBase = {
|
|
|
16
18
|
queryKey: string;
|
|
17
19
|
limit: number;
|
|
18
20
|
labels?: SearchBoxPanelLabels;
|
|
21
|
+
visibility?: {
|
|
22
|
+
showWhenKeyHasNoResults?: string;
|
|
23
|
+
};
|
|
19
24
|
};
|
|
20
25
|
export type DocumentSearchBoxPanel = SearchBoxPanelBase & {
|
|
21
26
|
type: SearchBoxPanelType.DOCUMENT;
|
|
@@ -28,9 +33,19 @@ export type DocumentSearchBoxPanel = SearchBoxPanelBase & {
|
|
|
28
33
|
isInStock?: (doc: Document) => boolean;
|
|
29
34
|
customDocumentHtmlAttributes?: CustomDocumentHtmlAttributes;
|
|
30
35
|
};
|
|
36
|
+
export type RelatedSourcePanel = Omit<DocumentSearchBoxPanel, 'type'> & {
|
|
37
|
+
type: SearchBoxPanelType.RELATED_SOURCE;
|
|
38
|
+
sourceIds: {
|
|
39
|
+
queryKey: string;
|
|
40
|
+
field: string;
|
|
41
|
+
};
|
|
42
|
+
target: {
|
|
43
|
+
queryKey: string;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
31
46
|
export type SuggestionSearchBoxPanel = SearchBoxPanelBase & {
|
|
32
47
|
type: SearchBoxPanelType.SUGGESTION;
|
|
33
48
|
highlight: boolean;
|
|
34
49
|
customClassName?: string;
|
|
35
50
|
};
|
|
36
|
-
export type SearchBoxPanel = DocumentSearchBoxPanel | SuggestionSearchBoxPanel;
|
|
51
|
+
export type SearchBoxPanel = DocumentSearchBoxPanel | SuggestionSearchBoxPanel | RelatedSourcePanel;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getlupa/vue",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"main": "dist/lupaSearch.mjs",
|
|
5
5
|
"module": "dist/lupaSearch.mjs",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"vue": "^3.0.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@getlupa/client-sdk": "^1.4.
|
|
26
|
+
"@getlupa/client-sdk": "^1.4.2",
|
|
27
27
|
"@pinia/testing": "^0.1.2",
|
|
28
28
|
"@rollup/plugin-babel": "5.3.0",
|
|
29
29
|
"@rollup/plugin-commonjs": "^21.0.1",
|