@getlupa/client 1.26.0 → 1.26.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lupaSearch.iife.js +64 -21
- package/dist/lupaSearch.js +64 -21
- package/dist/lupaSearch.mjs +64 -21
- package/dist/lupaSearch.umd.js +64 -21
- package/dist/types/PreconfiguredSearchContainerOptions.d.ts +1 -0
- package/package.json +2 -2
package/dist/lupaSearch.iife.js
CHANGED
|
@@ -19528,6 +19528,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
19528
19528
|
const options = ref(DEFAULT_SEARCH_BOX_OPTIONS$1);
|
|
19529
19529
|
const docResults = ref({});
|
|
19530
19530
|
const suggestionResults = ref({});
|
|
19531
|
+
const loadingResultsByQueryKey = ref({});
|
|
19531
19532
|
const highlightedIndex = ref(-1);
|
|
19532
19533
|
const inputValue = ref("");
|
|
19533
19534
|
const resultInputValue = ref("");
|
|
@@ -19591,16 +19592,22 @@ var __async = (__this, __arguments, generator) => {
|
|
|
19591
19592
|
title: panel.titleKey ? doc2[panel.titleKey] : ""
|
|
19592
19593
|
};
|
|
19593
19594
|
});
|
|
19595
|
+
const anyPanelLoading = computed(
|
|
19596
|
+
() => Object.values(loadingResultsByQueryKey.value).some((v) => v)
|
|
19597
|
+
);
|
|
19594
19598
|
const querySuggestions = (_0) => __async2(null, [_0], function* ({
|
|
19595
19599
|
queryKey,
|
|
19596
19600
|
publicQuery,
|
|
19597
19601
|
options: options2
|
|
19598
19602
|
}) {
|
|
19599
|
-
var _a25;
|
|
19603
|
+
var _a25, _b25, _c;
|
|
19600
19604
|
try {
|
|
19601
19605
|
const currentRequestId = Date.now();
|
|
19602
19606
|
latestRequestIdByQueryKey[queryKey] = currentRequestId;
|
|
19603
19607
|
const context = getLupaTrackingContext();
|
|
19608
|
+
loadingResultsByQueryKey.value = __spreadProps2(__spreadValues2({}, (_a25 = loadingResultsByQueryKey.value) != null ? _a25 : {}), {
|
|
19609
|
+
[queryKey]: true
|
|
19610
|
+
});
|
|
19604
19611
|
const result2 = yield LupaSearchSdk.suggestions(
|
|
19605
19612
|
queryKey,
|
|
19606
19613
|
__spreadValues2(__spreadValues2({}, publicQuery), context),
|
|
@@ -19614,7 +19621,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
19614
19621
|
}
|
|
19615
19622
|
highlightChange({ action: "clear" });
|
|
19616
19623
|
suggestionResults.value = __spreadProps2(__spreadValues2({}, suggestionResults.value), {
|
|
19617
|
-
[queryKey]: flattenSuggestions(result2.items, (
|
|
19624
|
+
[queryKey]: flattenSuggestions(result2.items, (_b25 = publicQuery.searchText) != null ? _b25 : "")
|
|
19618
19625
|
});
|
|
19619
19626
|
inputValue.value = publicQuery.searchText;
|
|
19620
19627
|
resultInputValue.value = publicQuery.searchText;
|
|
@@ -19628,6 +19635,10 @@ var __async = (__this, __arguments, generator) => {
|
|
|
19628
19635
|
options2.onError(err);
|
|
19629
19636
|
}
|
|
19630
19637
|
return { suggestions: void 0 };
|
|
19638
|
+
} finally {
|
|
19639
|
+
loadingResultsByQueryKey.value = __spreadProps2(__spreadValues2({}, (_c = loadingResultsByQueryKey.value) != null ? _c : {}), {
|
|
19640
|
+
[queryKey]: false
|
|
19641
|
+
});
|
|
19631
19642
|
}
|
|
19632
19643
|
});
|
|
19633
19644
|
const emitSearchResultsCallback = () => {
|
|
@@ -19648,9 +19659,13 @@ var __async = (__this, __arguments, generator) => {
|
|
|
19648
19659
|
publicQuery,
|
|
19649
19660
|
options: options2
|
|
19650
19661
|
}) {
|
|
19662
|
+
var _a25, _b25;
|
|
19651
19663
|
try {
|
|
19652
19664
|
const currentRequestId = Date.now();
|
|
19653
19665
|
latestRequestIdByQueryKey[queryKey] = currentRequestId;
|
|
19666
|
+
loadingResultsByQueryKey.value = __spreadProps2(__spreadValues2({}, (_a25 = loadingResultsByQueryKey.value) != null ? _a25 : {}), {
|
|
19667
|
+
[queryKey]: true
|
|
19668
|
+
});
|
|
19654
19669
|
const context = getLupaTrackingContext();
|
|
19655
19670
|
const result2 = yield LupaSearchSdk.query(queryKey, __spreadValues2(__spreadValues2({}, publicQuery), context), options2);
|
|
19656
19671
|
if (latestRequestIdByQueryKey[queryKey] !== currentRequestId) {
|
|
@@ -19669,6 +19684,10 @@ var __async = (__this, __arguments, generator) => {
|
|
|
19669
19684
|
options2.onError(err);
|
|
19670
19685
|
}
|
|
19671
19686
|
return { queryKey, result: { items: [] } };
|
|
19687
|
+
} finally {
|
|
19688
|
+
loadingResultsByQueryKey.value = __spreadProps2(__spreadValues2({}, (_b25 = loadingResultsByQueryKey.value) != null ? _b25 : {}), {
|
|
19689
|
+
[queryKey]: false
|
|
19690
|
+
});
|
|
19672
19691
|
}
|
|
19673
19692
|
});
|
|
19674
19693
|
const highlightChange = ({ action }) => {
|
|
@@ -19699,6 +19718,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
19699
19718
|
highlightedItem,
|
|
19700
19719
|
highlightedDocument,
|
|
19701
19720
|
hasAnyResults,
|
|
19721
|
+
anyPanelLoading,
|
|
19702
19722
|
querySuggestions,
|
|
19703
19723
|
queryDocuments,
|
|
19704
19724
|
highlightChange,
|
|
@@ -20592,7 +20612,9 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20592
20612
|
items: {},
|
|
20593
20613
|
highlight: { type: Boolean },
|
|
20594
20614
|
queryKey: {},
|
|
20595
|
-
labels: {}
|
|
20615
|
+
labels: {},
|
|
20616
|
+
searchBoxOptions: {},
|
|
20617
|
+
panelOptions: {}
|
|
20596
20618
|
},
|
|
20597
20619
|
emits: ["suggestionSelect"],
|
|
20598
20620
|
setup(__props, { emit: __emit }) {
|
|
@@ -20607,7 +20629,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20607
20629
|
});
|
|
20608
20630
|
const emit2 = __emit;
|
|
20609
20631
|
const searchBoxStore = useSearchBoxStore();
|
|
20610
|
-
const { highlightedItem } = storeToRefs(searchBoxStore);
|
|
20632
|
+
const { highlightedItem, anyPanelLoading } = storeToRefs(searchBoxStore);
|
|
20611
20633
|
const highlightedIndex = computed(() => {
|
|
20612
20634
|
var _a25, _b25, _c;
|
|
20613
20635
|
if (props.queryKey !== ((_a25 = highlightedItem.value) == null ? void 0 : _a25.queryKey)) {
|
|
@@ -20653,6 +20675,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20653
20675
|
});
|
|
20654
20676
|
});
|
|
20655
20677
|
return (_ctx, _cache) => {
|
|
20678
|
+
var _a25, _b25, _c;
|
|
20656
20679
|
return openBlock(), createElementBlock("div", _hoisted_1$1k, [
|
|
20657
20680
|
(openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (item, index) => {
|
|
20658
20681
|
return openBlock(), createBlock(_sfc_main$1D, {
|
|
@@ -20668,7 +20691,11 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20668
20691
|
"data-cy": "lupa-suggestion",
|
|
20669
20692
|
onSelect: handleSelect
|
|
20670
20693
|
}, null, 8, ["class", "suggestion", "highlight", "labels"]);
|
|
20671
|
-
}), 128))
|
|
20694
|
+
}), 128)),
|
|
20695
|
+
((_b25 = (_a25 = items.value) == null ? void 0 : _a25.length) != null ? _b25 : 0) === 0 && ((_c = _ctx.panelOptions) == null ? void 0 : _c.showPanelZeroResults) && _ctx.searchBoxOptions && !unref(anyPanelLoading) ? (openBlock(), createBlock(_sfc_main$1E, {
|
|
20696
|
+
key: 0,
|
|
20697
|
+
options: _ctx.searchBoxOptions
|
|
20698
|
+
}, null, 8, ["options"])) : createCommentVNode("", true)
|
|
20672
20699
|
]);
|
|
20673
20700
|
};
|
|
20674
20701
|
}
|
|
@@ -20691,6 +20718,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20691
20718
|
__name: "SearchBoxSuggestionsWrapper",
|
|
20692
20719
|
props: {
|
|
20693
20720
|
panel: {},
|
|
20721
|
+
searchBoxOptions: {},
|
|
20694
20722
|
options: {},
|
|
20695
20723
|
inputValue: {},
|
|
20696
20724
|
debounce: {},
|
|
@@ -20735,8 +20763,10 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20735
20763
|
highlight: _ctx.panel.highlight,
|
|
20736
20764
|
queryKey: _ctx.panel.queryKey,
|
|
20737
20765
|
labels: _ctx.labels,
|
|
20766
|
+
"search-box-options": _ctx.searchBoxOptions,
|
|
20767
|
+
"panel-options": _ctx.panel,
|
|
20738
20768
|
onSuggestionSelect: _cache[0] || (_cache[0] = (item) => _ctx.$emit("itemSelect", item))
|
|
20739
|
-
}, null, 8, ["items", "highlight", "queryKey", "labels"]);
|
|
20769
|
+
}, null, 8, ["items", "highlight", "queryKey", "labels", "search-box-options", "panel-options"]);
|
|
20740
20770
|
};
|
|
20741
20771
|
}
|
|
20742
20772
|
});
|
|
@@ -30559,7 +30589,7 @@ and ensure you are accounting for this risk.
|
|
|
30559
30589
|
};
|
|
30560
30590
|
const queryFacet = (_0) => __async2(null, [_0], function* ({ queryKey, facetKey }) {
|
|
30561
30591
|
var _a25, _b25, _c, _d;
|
|
30562
|
-
const query = { searchText: "", filters: __spreadValues2({}, filters.value) };
|
|
30592
|
+
const query = { searchText: currentQueryText.value || "", filters: __spreadValues2({}, filters.value) };
|
|
30563
30593
|
const options = (_a25 = optionsStore.envOptions) != null ? _a25 : { environment: "production" };
|
|
30564
30594
|
const result2 = yield LupaSearchSdk.query(queryKey, query, options);
|
|
30565
30595
|
if (!result2.success) {
|
|
@@ -31503,7 +31533,8 @@ and ensure you are accounting for this risk.
|
|
|
31503
31533
|
items: {},
|
|
31504
31534
|
inputValue: {},
|
|
31505
31535
|
panelOptions: {},
|
|
31506
|
-
labels: {}
|
|
31536
|
+
labels: {},
|
|
31537
|
+
searchBoxOptions: {}
|
|
31507
31538
|
},
|
|
31508
31539
|
emits: ["product-click"],
|
|
31509
31540
|
setup(__props, { emit: __emit }) {
|
|
@@ -31514,7 +31545,7 @@ and ensure you are accounting for this risk.
|
|
|
31514
31545
|
const optionsStore = useOptionsStore();
|
|
31515
31546
|
const { boxRoutingBehavior } = storeToRefs(optionsStore);
|
|
31516
31547
|
const emit2 = __emit;
|
|
31517
|
-
const { highlightedItem } = storeToRefs(searchBoxStore);
|
|
31548
|
+
const { highlightedItem, anyPanelLoading } = storeToRefs(searchBoxStore);
|
|
31518
31549
|
const highlightedIndex = computed(() => {
|
|
31519
31550
|
var _a25, _b25, _c;
|
|
31520
31551
|
if (props.panelOptions.queryKey !== ((_a25 = highlightedItem.value) == null ? void 0 : _a25.queryKey)) {
|
|
@@ -31592,7 +31623,7 @@ and ensure you are accounting for this risk.
|
|
|
31592
31623
|
}
|
|
31593
31624
|
};
|
|
31594
31625
|
return (_ctx, _cache) => {
|
|
31595
|
-
var _a25, _b25, _c;
|
|
31626
|
+
var _a25, _b25, _c, _d, _e, _f;
|
|
31596
31627
|
return openBlock(), createElementBlock("div", {
|
|
31597
31628
|
id: "lupa-search-box-products",
|
|
31598
31629
|
class: normalizeClass({ "lupa-search-box-products-expanded": showAll.value })
|
|
@@ -31622,11 +31653,15 @@ and ensure you are accounting for this risk.
|
|
|
31622
31653
|
key: 2,
|
|
31623
31654
|
innerHTML: _ctx.panelOptions.appendCustomHtml
|
|
31624
31655
|
}, null, 8, _hoisted_1$14)) : createCommentVNode("", true),
|
|
31625
|
-
|
|
31656
|
+
((_c = (_b25 = _ctx.items) == null ? void 0 : _b25.length) != null ? _c : 0) === 0 && ((_d = _ctx.panelOptions) == null ? void 0 : _d.showPanelZeroResults) && _ctx.searchBoxOptions && !unref(anyPanelLoading) ? (openBlock(), createBlock(_sfc_main$1E, {
|
|
31626
31657
|
key: 3,
|
|
31658
|
+
options: _ctx.searchBoxOptions
|
|
31659
|
+
}, null, 8, ["options"])) : createCommentVNode("", true),
|
|
31660
|
+
showAllItemsToggleButton.value ? (openBlock(), createElementBlock("a", {
|
|
31661
|
+
key: 4,
|
|
31627
31662
|
class: "lupa-search-box-expand",
|
|
31628
31663
|
onClick: _cache[0] || (_cache[0] = ($event) => showAll.value = !showAll.value)
|
|
31629
|
-
}, toDisplayString(showAll.value ? (
|
|
31664
|
+
}, toDisplayString(showAll.value ? (_e = _ctx.labels) == null ? void 0 : _e.showLess : (_f = _ctx.labels) == null ? void 0 : _f.showMore), 1)) : createCommentVNode("", true),
|
|
31630
31665
|
renderSlot(_ctx.$slots, "default")
|
|
31631
31666
|
], 2);
|
|
31632
31667
|
};
|
|
@@ -31840,9 +31875,10 @@ and ensure you are accounting for this risk.
|
|
|
31840
31875
|
var _a25, _b25;
|
|
31841
31876
|
return openBlock(), createBlock(_sfc_main$1i, {
|
|
31842
31877
|
items: (_b25 = (_a25 = searchResult.value) == null ? void 0 : _a25.items) != null ? _b25 : [],
|
|
31843
|
-
|
|
31878
|
+
"panel-options": _ctx.panel,
|
|
31844
31879
|
labels: _ctx.labels,
|
|
31845
|
-
|
|
31880
|
+
"input-value": _ctx.inputValue,
|
|
31881
|
+
"search-box-options": _ctx.searchBoxOptions,
|
|
31846
31882
|
onProductClick: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("product-click"))
|
|
31847
31883
|
}, createSlots({
|
|
31848
31884
|
default: withCtx(() => {
|
|
@@ -31865,7 +31901,7 @@ and ensure you are accounting for this risk.
|
|
|
31865
31901
|
]),
|
|
31866
31902
|
key: "0"
|
|
31867
31903
|
} : void 0
|
|
31868
|
-
]), 1032, ["items", "
|
|
31904
|
+
]), 1032, ["items", "panel-options", "labels", "input-value", "search-box-options"]);
|
|
31869
31905
|
};
|
|
31870
31906
|
}
|
|
31871
31907
|
});
|
|
@@ -32004,7 +32040,7 @@ and ensure you are accounting for this risk.
|
|
|
32004
32040
|
const panels = computed(() => props.options.panels);
|
|
32005
32041
|
const sdkOptions = computed(() => props.options.options);
|
|
32006
32042
|
const searchBoxStore = useSearchBoxStore();
|
|
32007
|
-
const { suggestionResults, hasAnyResults, panelItemCounts } = storeToRefs(searchBoxStore);
|
|
32043
|
+
const { suggestionResults, hasAnyResults, panelItemCounts, anyPanelLoading } = storeToRefs(searchBoxStore);
|
|
32008
32044
|
const emit2 = __emit;
|
|
32009
32045
|
const isSearchEmpty = computed(() => !props.inputValue || props.inputValue.length < 1);
|
|
32010
32046
|
const displayResults = computed(() => {
|
|
@@ -32192,7 +32228,7 @@ and ensure you are accounting for this risk.
|
|
|
32192
32228
|
], 14, _hoisted_1$12);
|
|
32193
32229
|
}), 128))
|
|
32194
32230
|
], 4),
|
|
32195
|
-
!unref(hasAnyResults) && _ctx.options.showNoResultsPanel ? (openBlock(), createBlock(_sfc_main$1E, {
|
|
32231
|
+
!unref(hasAnyResults) && _ctx.options.showNoResultsPanel && !unref(anyPanelLoading) ? (openBlock(), createBlock(_sfc_main$1E, {
|
|
32196
32232
|
key: 1,
|
|
32197
32233
|
options: _ctx.options
|
|
32198
32234
|
}, null, 8, ["options"])) : createCommentVNode("", true),
|
|
@@ -33374,7 +33410,7 @@ and ensure you are accounting for this risk.
|
|
|
33374
33410
|
facet: {},
|
|
33375
33411
|
currentFilters: {}
|
|
33376
33412
|
},
|
|
33377
|
-
emits: ["select"],
|
|
33413
|
+
emits: ["select", "showMoreClicked", "filterFocused"],
|
|
33378
33414
|
setup(__props, { emit: __emit }) {
|
|
33379
33415
|
const props = __props;
|
|
33380
33416
|
const searchResultStore = useSearchResultStore();
|
|
@@ -33438,6 +33474,9 @@ and ensure you are accounting for this risk.
|
|
|
33438
33474
|
};
|
|
33439
33475
|
const toggleShowAll = () => {
|
|
33440
33476
|
showAll.value = !showAll.value;
|
|
33477
|
+
if (showAll.value) {
|
|
33478
|
+
emit2("showMoreClicked", facet.value.key);
|
|
33479
|
+
}
|
|
33441
33480
|
};
|
|
33442
33481
|
const isChecked = (item) => {
|
|
33443
33482
|
var _a25, _b25;
|
|
@@ -33467,8 +33506,9 @@ and ensure you are accounting for this risk.
|
|
|
33467
33506
|
class: "lupa-term-filter",
|
|
33468
33507
|
"data-cy": "lupa-term-filter",
|
|
33469
33508
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => termFilter.value = $event),
|
|
33470
|
-
placeholder: _ctx.options.labels.facetFilter
|
|
33471
|
-
|
|
33509
|
+
placeholder: _ctx.options.labels.facetFilter,
|
|
33510
|
+
onFocus: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("filterFocused"))
|
|
33511
|
+
}, null, 40, _hoisted_2$E)), [
|
|
33472
33512
|
[vModelText, termFilter.value]
|
|
33473
33513
|
]) : createCommentVNode("", true),
|
|
33474
33514
|
createBaseVNode("div", _hoisted_3$u, [
|
|
@@ -35083,7 +35123,9 @@ and ensure you are accounting for this risk.
|
|
|
35083
35123
|
facet: facet.value,
|
|
35084
35124
|
currentFilters: currentFilters.value[facet.value.key],
|
|
35085
35125
|
options: _ctx.options,
|
|
35086
|
-
onSelect: handleFacetSelect
|
|
35126
|
+
onSelect: handleFacetSelect,
|
|
35127
|
+
onShowMoreClicked: handleFacetQueryFilter,
|
|
35128
|
+
onFilterFocused: handleFacetQueryFilter
|
|
35087
35129
|
}, null, 40, ["facet", "currentFilters", "options"])),
|
|
35088
35130
|
_ctx.clearable ? (openBlock(), createElementBlock("div", {
|
|
35089
35131
|
key: 0,
|
|
@@ -41757,6 +41799,7 @@ and ensure you are accounting for this risk.
|
|
|
41757
41799
|
customBaseUrl: searchResultOptions.customBaseUrl,
|
|
41758
41800
|
customPayload: searchResultOptions.customPayload,
|
|
41759
41801
|
customHeaders: searchResultOptions.customHeaders,
|
|
41802
|
+
customRelatedQueriesUrl: searchResultOptions.customRelatedQueriesUrl,
|
|
41760
41803
|
onError: searchResultOptions.errorHandler
|
|
41761
41804
|
},
|
|
41762
41805
|
queryKey: searchResultOptions.queryKey,
|
package/dist/lupaSearch.js
CHANGED
|
@@ -19528,6 +19528,7 @@ const useSearchBoxStore = /* @__PURE__ */ defineStore("searchBox", () => {
|
|
|
19528
19528
|
const options = ref(DEFAULT_SEARCH_BOX_OPTIONS$1);
|
|
19529
19529
|
const docResults = ref({});
|
|
19530
19530
|
const suggestionResults = ref({});
|
|
19531
|
+
const loadingResultsByQueryKey = ref({});
|
|
19531
19532
|
const highlightedIndex = ref(-1);
|
|
19532
19533
|
const inputValue = ref("");
|
|
19533
19534
|
const resultInputValue = ref("");
|
|
@@ -19591,16 +19592,22 @@ const useSearchBoxStore = /* @__PURE__ */ defineStore("searchBox", () => {
|
|
|
19591
19592
|
title: panel.titleKey ? doc2[panel.titleKey] : ""
|
|
19592
19593
|
};
|
|
19593
19594
|
});
|
|
19595
|
+
const anyPanelLoading = computed(
|
|
19596
|
+
() => Object.values(loadingResultsByQueryKey.value).some((v) => v)
|
|
19597
|
+
);
|
|
19594
19598
|
const querySuggestions = (_0) => __async2(null, [_0], function* ({
|
|
19595
19599
|
queryKey,
|
|
19596
19600
|
publicQuery,
|
|
19597
19601
|
options: options2
|
|
19598
19602
|
}) {
|
|
19599
|
-
var _a25;
|
|
19603
|
+
var _a25, _b25, _c;
|
|
19600
19604
|
try {
|
|
19601
19605
|
const currentRequestId = Date.now();
|
|
19602
19606
|
latestRequestIdByQueryKey[queryKey] = currentRequestId;
|
|
19603
19607
|
const context = getLupaTrackingContext();
|
|
19608
|
+
loadingResultsByQueryKey.value = __spreadProps2(__spreadValues2({}, (_a25 = loadingResultsByQueryKey.value) != null ? _a25 : {}), {
|
|
19609
|
+
[queryKey]: true
|
|
19610
|
+
});
|
|
19604
19611
|
const result2 = yield LupaSearchSdk.suggestions(
|
|
19605
19612
|
queryKey,
|
|
19606
19613
|
__spreadValues2(__spreadValues2({}, publicQuery), context),
|
|
@@ -19614,7 +19621,7 @@ const useSearchBoxStore = /* @__PURE__ */ defineStore("searchBox", () => {
|
|
|
19614
19621
|
}
|
|
19615
19622
|
highlightChange({ action: "clear" });
|
|
19616
19623
|
suggestionResults.value = __spreadProps2(__spreadValues2({}, suggestionResults.value), {
|
|
19617
|
-
[queryKey]: flattenSuggestions(result2.items, (
|
|
19624
|
+
[queryKey]: flattenSuggestions(result2.items, (_b25 = publicQuery.searchText) != null ? _b25 : "")
|
|
19618
19625
|
});
|
|
19619
19626
|
inputValue.value = publicQuery.searchText;
|
|
19620
19627
|
resultInputValue.value = publicQuery.searchText;
|
|
@@ -19628,6 +19635,10 @@ const useSearchBoxStore = /* @__PURE__ */ defineStore("searchBox", () => {
|
|
|
19628
19635
|
options2.onError(err);
|
|
19629
19636
|
}
|
|
19630
19637
|
return { suggestions: void 0 };
|
|
19638
|
+
} finally {
|
|
19639
|
+
loadingResultsByQueryKey.value = __spreadProps2(__spreadValues2({}, (_c = loadingResultsByQueryKey.value) != null ? _c : {}), {
|
|
19640
|
+
[queryKey]: false
|
|
19641
|
+
});
|
|
19631
19642
|
}
|
|
19632
19643
|
});
|
|
19633
19644
|
const emitSearchResultsCallback = () => {
|
|
@@ -19648,9 +19659,13 @@ const useSearchBoxStore = /* @__PURE__ */ defineStore("searchBox", () => {
|
|
|
19648
19659
|
publicQuery,
|
|
19649
19660
|
options: options2
|
|
19650
19661
|
}) {
|
|
19662
|
+
var _a25, _b25;
|
|
19651
19663
|
try {
|
|
19652
19664
|
const currentRequestId = Date.now();
|
|
19653
19665
|
latestRequestIdByQueryKey[queryKey] = currentRequestId;
|
|
19666
|
+
loadingResultsByQueryKey.value = __spreadProps2(__spreadValues2({}, (_a25 = loadingResultsByQueryKey.value) != null ? _a25 : {}), {
|
|
19667
|
+
[queryKey]: true
|
|
19668
|
+
});
|
|
19654
19669
|
const context = getLupaTrackingContext();
|
|
19655
19670
|
const result2 = yield LupaSearchSdk.query(queryKey, __spreadValues2(__spreadValues2({}, publicQuery), context), options2);
|
|
19656
19671
|
if (latestRequestIdByQueryKey[queryKey] !== currentRequestId) {
|
|
@@ -19669,6 +19684,10 @@ const useSearchBoxStore = /* @__PURE__ */ defineStore("searchBox", () => {
|
|
|
19669
19684
|
options2.onError(err);
|
|
19670
19685
|
}
|
|
19671
19686
|
return { queryKey, result: { items: [] } };
|
|
19687
|
+
} finally {
|
|
19688
|
+
loadingResultsByQueryKey.value = __spreadProps2(__spreadValues2({}, (_b25 = loadingResultsByQueryKey.value) != null ? _b25 : {}), {
|
|
19689
|
+
[queryKey]: false
|
|
19690
|
+
});
|
|
19672
19691
|
}
|
|
19673
19692
|
});
|
|
19674
19693
|
const highlightChange = ({ action }) => {
|
|
@@ -19699,6 +19718,7 @@ const useSearchBoxStore = /* @__PURE__ */ defineStore("searchBox", () => {
|
|
|
19699
19718
|
highlightedItem,
|
|
19700
19719
|
highlightedDocument,
|
|
19701
19720
|
hasAnyResults,
|
|
19721
|
+
anyPanelLoading,
|
|
19702
19722
|
querySuggestions,
|
|
19703
19723
|
queryDocuments,
|
|
19704
19724
|
highlightChange,
|
|
@@ -20592,7 +20612,9 @@ const _sfc_main$1C = /* @__PURE__ */ defineComponent({
|
|
|
20592
20612
|
items: {},
|
|
20593
20613
|
highlight: { type: Boolean },
|
|
20594
20614
|
queryKey: {},
|
|
20595
|
-
labels: {}
|
|
20615
|
+
labels: {},
|
|
20616
|
+
searchBoxOptions: {},
|
|
20617
|
+
panelOptions: {}
|
|
20596
20618
|
},
|
|
20597
20619
|
emits: ["suggestionSelect"],
|
|
20598
20620
|
setup(__props, { emit: __emit }) {
|
|
@@ -20607,7 +20629,7 @@ const _sfc_main$1C = /* @__PURE__ */ defineComponent({
|
|
|
20607
20629
|
});
|
|
20608
20630
|
const emit2 = __emit;
|
|
20609
20631
|
const searchBoxStore = useSearchBoxStore();
|
|
20610
|
-
const { highlightedItem } = storeToRefs(searchBoxStore);
|
|
20632
|
+
const { highlightedItem, anyPanelLoading } = storeToRefs(searchBoxStore);
|
|
20611
20633
|
const highlightedIndex = computed(() => {
|
|
20612
20634
|
var _a25, _b25, _c;
|
|
20613
20635
|
if (props.queryKey !== ((_a25 = highlightedItem.value) == null ? void 0 : _a25.queryKey)) {
|
|
@@ -20653,6 +20675,7 @@ const _sfc_main$1C = /* @__PURE__ */ defineComponent({
|
|
|
20653
20675
|
});
|
|
20654
20676
|
});
|
|
20655
20677
|
return (_ctx, _cache) => {
|
|
20678
|
+
var _a25, _b25, _c;
|
|
20656
20679
|
return openBlock(), createElementBlock("div", _hoisted_1$1k, [
|
|
20657
20680
|
(openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (item, index) => {
|
|
20658
20681
|
return openBlock(), createBlock(_sfc_main$1D, {
|
|
@@ -20668,7 +20691,11 @@ const _sfc_main$1C = /* @__PURE__ */ defineComponent({
|
|
|
20668
20691
|
"data-cy": "lupa-suggestion",
|
|
20669
20692
|
onSelect: handleSelect
|
|
20670
20693
|
}, null, 8, ["class", "suggestion", "highlight", "labels"]);
|
|
20671
|
-
}), 128))
|
|
20694
|
+
}), 128)),
|
|
20695
|
+
((_b25 = (_a25 = items.value) == null ? void 0 : _a25.length) != null ? _b25 : 0) === 0 && ((_c = _ctx.panelOptions) == null ? void 0 : _c.showPanelZeroResults) && _ctx.searchBoxOptions && !unref(anyPanelLoading) ? (openBlock(), createBlock(_sfc_main$1E, {
|
|
20696
|
+
key: 0,
|
|
20697
|
+
options: _ctx.searchBoxOptions
|
|
20698
|
+
}, null, 8, ["options"])) : createCommentVNode("", true)
|
|
20672
20699
|
]);
|
|
20673
20700
|
};
|
|
20674
20701
|
}
|
|
@@ -20691,6 +20718,7 @@ const _sfc_main$1B = /* @__PURE__ */ defineComponent({
|
|
|
20691
20718
|
__name: "SearchBoxSuggestionsWrapper",
|
|
20692
20719
|
props: {
|
|
20693
20720
|
panel: {},
|
|
20721
|
+
searchBoxOptions: {},
|
|
20694
20722
|
options: {},
|
|
20695
20723
|
inputValue: {},
|
|
20696
20724
|
debounce: {},
|
|
@@ -20735,8 +20763,10 @@ const _sfc_main$1B = /* @__PURE__ */ defineComponent({
|
|
|
20735
20763
|
highlight: _ctx.panel.highlight,
|
|
20736
20764
|
queryKey: _ctx.panel.queryKey,
|
|
20737
20765
|
labels: _ctx.labels,
|
|
20766
|
+
"search-box-options": _ctx.searchBoxOptions,
|
|
20767
|
+
"panel-options": _ctx.panel,
|
|
20738
20768
|
onSuggestionSelect: _cache[0] || (_cache[0] = (item) => _ctx.$emit("itemSelect", item))
|
|
20739
|
-
}, null, 8, ["items", "highlight", "queryKey", "labels"]);
|
|
20769
|
+
}, null, 8, ["items", "highlight", "queryKey", "labels", "search-box-options", "panel-options"]);
|
|
20740
20770
|
};
|
|
20741
20771
|
}
|
|
20742
20772
|
});
|
|
@@ -30559,7 +30589,7 @@ const useSearchResultStore = /* @__PURE__ */ defineStore("searchResult", () => {
|
|
|
30559
30589
|
};
|
|
30560
30590
|
const queryFacet = (_0) => __async2(null, [_0], function* ({ queryKey, facetKey }) {
|
|
30561
30591
|
var _a25, _b25, _c, _d;
|
|
30562
|
-
const query = { searchText: "", filters: __spreadValues2({}, filters.value) };
|
|
30592
|
+
const query = { searchText: currentQueryText.value || "", filters: __spreadValues2({}, filters.value) };
|
|
30563
30593
|
const options = (_a25 = optionsStore.envOptions) != null ? _a25 : { environment: "production" };
|
|
30564
30594
|
const result2 = yield LupaSearchSdk.query(queryKey, query, options);
|
|
30565
30595
|
if (!result2.success) {
|
|
@@ -31503,7 +31533,8 @@ const _sfc_main$1i = /* @__PURE__ */ defineComponent({
|
|
|
31503
31533
|
items: {},
|
|
31504
31534
|
inputValue: {},
|
|
31505
31535
|
panelOptions: {},
|
|
31506
|
-
labels: {}
|
|
31536
|
+
labels: {},
|
|
31537
|
+
searchBoxOptions: {}
|
|
31507
31538
|
},
|
|
31508
31539
|
emits: ["product-click"],
|
|
31509
31540
|
setup(__props, { emit: __emit }) {
|
|
@@ -31514,7 +31545,7 @@ const _sfc_main$1i = /* @__PURE__ */ defineComponent({
|
|
|
31514
31545
|
const optionsStore = useOptionsStore();
|
|
31515
31546
|
const { boxRoutingBehavior } = storeToRefs(optionsStore);
|
|
31516
31547
|
const emit2 = __emit;
|
|
31517
|
-
const { highlightedItem } = storeToRefs(searchBoxStore);
|
|
31548
|
+
const { highlightedItem, anyPanelLoading } = storeToRefs(searchBoxStore);
|
|
31518
31549
|
const highlightedIndex = computed(() => {
|
|
31519
31550
|
var _a25, _b25, _c;
|
|
31520
31551
|
if (props.panelOptions.queryKey !== ((_a25 = highlightedItem.value) == null ? void 0 : _a25.queryKey)) {
|
|
@@ -31592,7 +31623,7 @@ const _sfc_main$1i = /* @__PURE__ */ defineComponent({
|
|
|
31592
31623
|
}
|
|
31593
31624
|
};
|
|
31594
31625
|
return (_ctx, _cache) => {
|
|
31595
|
-
var _a25, _b25, _c;
|
|
31626
|
+
var _a25, _b25, _c, _d, _e, _f;
|
|
31596
31627
|
return openBlock(), createElementBlock("div", {
|
|
31597
31628
|
id: "lupa-search-box-products",
|
|
31598
31629
|
class: normalizeClass({ "lupa-search-box-products-expanded": showAll.value })
|
|
@@ -31622,11 +31653,15 @@ const _sfc_main$1i = /* @__PURE__ */ defineComponent({
|
|
|
31622
31653
|
key: 2,
|
|
31623
31654
|
innerHTML: _ctx.panelOptions.appendCustomHtml
|
|
31624
31655
|
}, null, 8, _hoisted_1$14)) : createCommentVNode("", true),
|
|
31625
|
-
|
|
31656
|
+
((_c = (_b25 = _ctx.items) == null ? void 0 : _b25.length) != null ? _c : 0) === 0 && ((_d = _ctx.panelOptions) == null ? void 0 : _d.showPanelZeroResults) && _ctx.searchBoxOptions && !unref(anyPanelLoading) ? (openBlock(), createBlock(_sfc_main$1E, {
|
|
31626
31657
|
key: 3,
|
|
31658
|
+
options: _ctx.searchBoxOptions
|
|
31659
|
+
}, null, 8, ["options"])) : createCommentVNode("", true),
|
|
31660
|
+
showAllItemsToggleButton.value ? (openBlock(), createElementBlock("a", {
|
|
31661
|
+
key: 4,
|
|
31627
31662
|
class: "lupa-search-box-expand",
|
|
31628
31663
|
onClick: _cache[0] || (_cache[0] = ($event) => showAll.value = !showAll.value)
|
|
31629
|
-
}, toDisplayString(showAll.value ? (
|
|
31664
|
+
}, toDisplayString(showAll.value ? (_e = _ctx.labels) == null ? void 0 : _e.showLess : (_f = _ctx.labels) == null ? void 0 : _f.showMore), 1)) : createCommentVNode("", true),
|
|
31630
31665
|
renderSlot(_ctx.$slots, "default")
|
|
31631
31666
|
], 2);
|
|
31632
31667
|
};
|
|
@@ -31840,9 +31875,10 @@ const _sfc_main$1g = /* @__PURE__ */ defineComponent({
|
|
|
31840
31875
|
var _a25, _b25;
|
|
31841
31876
|
return openBlock(), createBlock(_sfc_main$1i, {
|
|
31842
31877
|
items: (_b25 = (_a25 = searchResult.value) == null ? void 0 : _a25.items) != null ? _b25 : [],
|
|
31843
|
-
|
|
31878
|
+
"panel-options": _ctx.panel,
|
|
31844
31879
|
labels: _ctx.labels,
|
|
31845
|
-
|
|
31880
|
+
"input-value": _ctx.inputValue,
|
|
31881
|
+
"search-box-options": _ctx.searchBoxOptions,
|
|
31846
31882
|
onProductClick: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("product-click"))
|
|
31847
31883
|
}, createSlots({
|
|
31848
31884
|
default: withCtx(() => {
|
|
@@ -31865,7 +31901,7 @@ const _sfc_main$1g = /* @__PURE__ */ defineComponent({
|
|
|
31865
31901
|
]),
|
|
31866
31902
|
key: "0"
|
|
31867
31903
|
} : void 0
|
|
31868
|
-
]), 1032, ["items", "
|
|
31904
|
+
]), 1032, ["items", "panel-options", "labels", "input-value", "search-box-options"]);
|
|
31869
31905
|
};
|
|
31870
31906
|
}
|
|
31871
31907
|
});
|
|
@@ -32004,7 +32040,7 @@ const _sfc_main$1e = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValu
|
|
|
32004
32040
|
const panels = computed(() => props.options.panels);
|
|
32005
32041
|
const sdkOptions = computed(() => props.options.options);
|
|
32006
32042
|
const searchBoxStore = useSearchBoxStore();
|
|
32007
|
-
const { suggestionResults, hasAnyResults, panelItemCounts } = storeToRefs(searchBoxStore);
|
|
32043
|
+
const { suggestionResults, hasAnyResults, panelItemCounts, anyPanelLoading } = storeToRefs(searchBoxStore);
|
|
32008
32044
|
const emit2 = __emit;
|
|
32009
32045
|
const isSearchEmpty = computed(() => !props.inputValue || props.inputValue.length < 1);
|
|
32010
32046
|
const displayResults = computed(() => {
|
|
@@ -32192,7 +32228,7 @@ const _sfc_main$1e = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValu
|
|
|
32192
32228
|
], 14, _hoisted_1$12);
|
|
32193
32229
|
}), 128))
|
|
32194
32230
|
], 4),
|
|
32195
|
-
!unref(hasAnyResults) && _ctx.options.showNoResultsPanel ? (openBlock(), createBlock(_sfc_main$1E, {
|
|
32231
|
+
!unref(hasAnyResults) && _ctx.options.showNoResultsPanel && !unref(anyPanelLoading) ? (openBlock(), createBlock(_sfc_main$1E, {
|
|
32196
32232
|
key: 1,
|
|
32197
32233
|
options: _ctx.options
|
|
32198
32234
|
}, null, 8, ["options"])) : createCommentVNode("", true),
|
|
@@ -33374,7 +33410,7 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
|
|
|
33374
33410
|
facet: {},
|
|
33375
33411
|
currentFilters: {}
|
|
33376
33412
|
},
|
|
33377
|
-
emits: ["select"],
|
|
33413
|
+
emits: ["select", "showMoreClicked", "filterFocused"],
|
|
33378
33414
|
setup(__props, { emit: __emit }) {
|
|
33379
33415
|
const props = __props;
|
|
33380
33416
|
const searchResultStore = useSearchResultStore();
|
|
@@ -33438,6 +33474,9 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
|
|
|
33438
33474
|
};
|
|
33439
33475
|
const toggleShowAll = () => {
|
|
33440
33476
|
showAll.value = !showAll.value;
|
|
33477
|
+
if (showAll.value) {
|
|
33478
|
+
emit2("showMoreClicked", facet.value.key);
|
|
33479
|
+
}
|
|
33441
33480
|
};
|
|
33442
33481
|
const isChecked = (item) => {
|
|
33443
33482
|
var _a25, _b25;
|
|
@@ -33467,8 +33506,9 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
|
|
|
33467
33506
|
class: "lupa-term-filter",
|
|
33468
33507
|
"data-cy": "lupa-term-filter",
|
|
33469
33508
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => termFilter.value = $event),
|
|
33470
|
-
placeholder: _ctx.options.labels.facetFilter
|
|
33471
|
-
|
|
33509
|
+
placeholder: _ctx.options.labels.facetFilter,
|
|
33510
|
+
onFocus: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("filterFocused"))
|
|
33511
|
+
}, null, 40, _hoisted_2$E)), [
|
|
33472
33512
|
[vModelText, termFilter.value]
|
|
33473
33513
|
]) : createCommentVNode("", true),
|
|
33474
33514
|
createBaseVNode("div", _hoisted_3$u, [
|
|
@@ -35083,7 +35123,9 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
|
|
|
35083
35123
|
facet: facet.value,
|
|
35084
35124
|
currentFilters: currentFilters.value[facet.value.key],
|
|
35085
35125
|
options: _ctx.options,
|
|
35086
|
-
onSelect: handleFacetSelect
|
|
35126
|
+
onSelect: handleFacetSelect,
|
|
35127
|
+
onShowMoreClicked: handleFacetQueryFilter,
|
|
35128
|
+
onFilterFocused: handleFacetQueryFilter
|
|
35087
35129
|
}, null, 40, ["facet", "currentFilters", "options"])),
|
|
35088
35130
|
_ctx.clearable ? (openBlock(), createElementBlock("div", {
|
|
35089
35131
|
key: 0,
|
|
@@ -41757,6 +41799,7 @@ const getSearchResultsComponent = ({
|
|
|
41757
41799
|
customBaseUrl: searchResultOptions.customBaseUrl,
|
|
41758
41800
|
customPayload: searchResultOptions.customPayload,
|
|
41759
41801
|
customHeaders: searchResultOptions.customHeaders,
|
|
41802
|
+
customRelatedQueriesUrl: searchResultOptions.customRelatedQueriesUrl,
|
|
41760
41803
|
onError: searchResultOptions.errorHandler
|
|
41761
41804
|
},
|
|
41762
41805
|
queryKey: searchResultOptions.queryKey,
|
package/dist/lupaSearch.mjs
CHANGED
|
@@ -19526,6 +19526,7 @@ const useSearchBoxStore = /* @__PURE__ */ defineStore("searchBox", () => {
|
|
|
19526
19526
|
const options = ref(DEFAULT_SEARCH_BOX_OPTIONS$1);
|
|
19527
19527
|
const docResults = ref({});
|
|
19528
19528
|
const suggestionResults = ref({});
|
|
19529
|
+
const loadingResultsByQueryKey = ref({});
|
|
19529
19530
|
const highlightedIndex = ref(-1);
|
|
19530
19531
|
const inputValue = ref("");
|
|
19531
19532
|
const resultInputValue = ref("");
|
|
@@ -19589,16 +19590,22 @@ const useSearchBoxStore = /* @__PURE__ */ defineStore("searchBox", () => {
|
|
|
19589
19590
|
title: panel.titleKey ? doc2[panel.titleKey] : ""
|
|
19590
19591
|
};
|
|
19591
19592
|
});
|
|
19593
|
+
const anyPanelLoading = computed(
|
|
19594
|
+
() => Object.values(loadingResultsByQueryKey.value).some((v) => v)
|
|
19595
|
+
);
|
|
19592
19596
|
const querySuggestions = (_0) => __async2(null, [_0], function* ({
|
|
19593
19597
|
queryKey,
|
|
19594
19598
|
publicQuery,
|
|
19595
19599
|
options: options2
|
|
19596
19600
|
}) {
|
|
19597
|
-
var _a25;
|
|
19601
|
+
var _a25, _b25, _c;
|
|
19598
19602
|
try {
|
|
19599
19603
|
const currentRequestId = Date.now();
|
|
19600
19604
|
latestRequestIdByQueryKey[queryKey] = currentRequestId;
|
|
19601
19605
|
const context = getLupaTrackingContext();
|
|
19606
|
+
loadingResultsByQueryKey.value = __spreadProps2(__spreadValues2({}, (_a25 = loadingResultsByQueryKey.value) != null ? _a25 : {}), {
|
|
19607
|
+
[queryKey]: true
|
|
19608
|
+
});
|
|
19602
19609
|
const result2 = yield LupaSearchSdk.suggestions(
|
|
19603
19610
|
queryKey,
|
|
19604
19611
|
__spreadValues2(__spreadValues2({}, publicQuery), context),
|
|
@@ -19612,7 +19619,7 @@ const useSearchBoxStore = /* @__PURE__ */ defineStore("searchBox", () => {
|
|
|
19612
19619
|
}
|
|
19613
19620
|
highlightChange({ action: "clear" });
|
|
19614
19621
|
suggestionResults.value = __spreadProps2(__spreadValues2({}, suggestionResults.value), {
|
|
19615
|
-
[queryKey]: flattenSuggestions(result2.items, (
|
|
19622
|
+
[queryKey]: flattenSuggestions(result2.items, (_b25 = publicQuery.searchText) != null ? _b25 : "")
|
|
19616
19623
|
});
|
|
19617
19624
|
inputValue.value = publicQuery.searchText;
|
|
19618
19625
|
resultInputValue.value = publicQuery.searchText;
|
|
@@ -19626,6 +19633,10 @@ const useSearchBoxStore = /* @__PURE__ */ defineStore("searchBox", () => {
|
|
|
19626
19633
|
options2.onError(err);
|
|
19627
19634
|
}
|
|
19628
19635
|
return { suggestions: void 0 };
|
|
19636
|
+
} finally {
|
|
19637
|
+
loadingResultsByQueryKey.value = __spreadProps2(__spreadValues2({}, (_c = loadingResultsByQueryKey.value) != null ? _c : {}), {
|
|
19638
|
+
[queryKey]: false
|
|
19639
|
+
});
|
|
19629
19640
|
}
|
|
19630
19641
|
});
|
|
19631
19642
|
const emitSearchResultsCallback = () => {
|
|
@@ -19646,9 +19657,13 @@ const useSearchBoxStore = /* @__PURE__ */ defineStore("searchBox", () => {
|
|
|
19646
19657
|
publicQuery,
|
|
19647
19658
|
options: options2
|
|
19648
19659
|
}) {
|
|
19660
|
+
var _a25, _b25;
|
|
19649
19661
|
try {
|
|
19650
19662
|
const currentRequestId = Date.now();
|
|
19651
19663
|
latestRequestIdByQueryKey[queryKey] = currentRequestId;
|
|
19664
|
+
loadingResultsByQueryKey.value = __spreadProps2(__spreadValues2({}, (_a25 = loadingResultsByQueryKey.value) != null ? _a25 : {}), {
|
|
19665
|
+
[queryKey]: true
|
|
19666
|
+
});
|
|
19652
19667
|
const context = getLupaTrackingContext();
|
|
19653
19668
|
const result2 = yield LupaSearchSdk.query(queryKey, __spreadValues2(__spreadValues2({}, publicQuery), context), options2);
|
|
19654
19669
|
if (latestRequestIdByQueryKey[queryKey] !== currentRequestId) {
|
|
@@ -19667,6 +19682,10 @@ const useSearchBoxStore = /* @__PURE__ */ defineStore("searchBox", () => {
|
|
|
19667
19682
|
options2.onError(err);
|
|
19668
19683
|
}
|
|
19669
19684
|
return { queryKey, result: { items: [] } };
|
|
19685
|
+
} finally {
|
|
19686
|
+
loadingResultsByQueryKey.value = __spreadProps2(__spreadValues2({}, (_b25 = loadingResultsByQueryKey.value) != null ? _b25 : {}), {
|
|
19687
|
+
[queryKey]: false
|
|
19688
|
+
});
|
|
19670
19689
|
}
|
|
19671
19690
|
});
|
|
19672
19691
|
const highlightChange = ({ action }) => {
|
|
@@ -19697,6 +19716,7 @@ const useSearchBoxStore = /* @__PURE__ */ defineStore("searchBox", () => {
|
|
|
19697
19716
|
highlightedItem,
|
|
19698
19717
|
highlightedDocument,
|
|
19699
19718
|
hasAnyResults,
|
|
19719
|
+
anyPanelLoading,
|
|
19700
19720
|
querySuggestions,
|
|
19701
19721
|
queryDocuments,
|
|
19702
19722
|
highlightChange,
|
|
@@ -20590,7 +20610,9 @@ const _sfc_main$1C = /* @__PURE__ */ defineComponent({
|
|
|
20590
20610
|
items: {},
|
|
20591
20611
|
highlight: { type: Boolean },
|
|
20592
20612
|
queryKey: {},
|
|
20593
|
-
labels: {}
|
|
20613
|
+
labels: {},
|
|
20614
|
+
searchBoxOptions: {},
|
|
20615
|
+
panelOptions: {}
|
|
20594
20616
|
},
|
|
20595
20617
|
emits: ["suggestionSelect"],
|
|
20596
20618
|
setup(__props, { emit: __emit }) {
|
|
@@ -20605,7 +20627,7 @@ const _sfc_main$1C = /* @__PURE__ */ defineComponent({
|
|
|
20605
20627
|
});
|
|
20606
20628
|
const emit2 = __emit;
|
|
20607
20629
|
const searchBoxStore = useSearchBoxStore();
|
|
20608
|
-
const { highlightedItem } = storeToRefs(searchBoxStore);
|
|
20630
|
+
const { highlightedItem, anyPanelLoading } = storeToRefs(searchBoxStore);
|
|
20609
20631
|
const highlightedIndex = computed(() => {
|
|
20610
20632
|
var _a25, _b25, _c;
|
|
20611
20633
|
if (props.queryKey !== ((_a25 = highlightedItem.value) == null ? void 0 : _a25.queryKey)) {
|
|
@@ -20651,6 +20673,7 @@ const _sfc_main$1C = /* @__PURE__ */ defineComponent({
|
|
|
20651
20673
|
});
|
|
20652
20674
|
});
|
|
20653
20675
|
return (_ctx, _cache) => {
|
|
20676
|
+
var _a25, _b25, _c;
|
|
20654
20677
|
return openBlock(), createElementBlock("div", _hoisted_1$1k, [
|
|
20655
20678
|
(openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (item, index) => {
|
|
20656
20679
|
return openBlock(), createBlock(_sfc_main$1D, {
|
|
@@ -20666,7 +20689,11 @@ const _sfc_main$1C = /* @__PURE__ */ defineComponent({
|
|
|
20666
20689
|
"data-cy": "lupa-suggestion",
|
|
20667
20690
|
onSelect: handleSelect
|
|
20668
20691
|
}, null, 8, ["class", "suggestion", "highlight", "labels"]);
|
|
20669
|
-
}), 128))
|
|
20692
|
+
}), 128)),
|
|
20693
|
+
((_b25 = (_a25 = items.value) == null ? void 0 : _a25.length) != null ? _b25 : 0) === 0 && ((_c = _ctx.panelOptions) == null ? void 0 : _c.showPanelZeroResults) && _ctx.searchBoxOptions && !unref(anyPanelLoading) ? (openBlock(), createBlock(_sfc_main$1E, {
|
|
20694
|
+
key: 0,
|
|
20695
|
+
options: _ctx.searchBoxOptions
|
|
20696
|
+
}, null, 8, ["options"])) : createCommentVNode("", true)
|
|
20670
20697
|
]);
|
|
20671
20698
|
};
|
|
20672
20699
|
}
|
|
@@ -20689,6 +20716,7 @@ const _sfc_main$1B = /* @__PURE__ */ defineComponent({
|
|
|
20689
20716
|
__name: "SearchBoxSuggestionsWrapper",
|
|
20690
20717
|
props: {
|
|
20691
20718
|
panel: {},
|
|
20719
|
+
searchBoxOptions: {},
|
|
20692
20720
|
options: {},
|
|
20693
20721
|
inputValue: {},
|
|
20694
20722
|
debounce: {},
|
|
@@ -20733,8 +20761,10 @@ const _sfc_main$1B = /* @__PURE__ */ defineComponent({
|
|
|
20733
20761
|
highlight: _ctx.panel.highlight,
|
|
20734
20762
|
queryKey: _ctx.panel.queryKey,
|
|
20735
20763
|
labels: _ctx.labels,
|
|
20764
|
+
"search-box-options": _ctx.searchBoxOptions,
|
|
20765
|
+
"panel-options": _ctx.panel,
|
|
20736
20766
|
onSuggestionSelect: _cache[0] || (_cache[0] = (item) => _ctx.$emit("itemSelect", item))
|
|
20737
|
-
}, null, 8, ["items", "highlight", "queryKey", "labels"]);
|
|
20767
|
+
}, null, 8, ["items", "highlight", "queryKey", "labels", "search-box-options", "panel-options"]);
|
|
20738
20768
|
};
|
|
20739
20769
|
}
|
|
20740
20770
|
});
|
|
@@ -30557,7 +30587,7 @@ const useSearchResultStore = /* @__PURE__ */ defineStore("searchResult", () => {
|
|
|
30557
30587
|
};
|
|
30558
30588
|
const queryFacet = (_0) => __async2(null, [_0], function* ({ queryKey, facetKey }) {
|
|
30559
30589
|
var _a25, _b25, _c, _d;
|
|
30560
|
-
const query = { searchText: "", filters: __spreadValues2({}, filters.value) };
|
|
30590
|
+
const query = { searchText: currentQueryText.value || "", filters: __spreadValues2({}, filters.value) };
|
|
30561
30591
|
const options = (_a25 = optionsStore.envOptions) != null ? _a25 : { environment: "production" };
|
|
30562
30592
|
const result2 = yield LupaSearchSdk.query(queryKey, query, options);
|
|
30563
30593
|
if (!result2.success) {
|
|
@@ -31501,7 +31531,8 @@ const _sfc_main$1i = /* @__PURE__ */ defineComponent({
|
|
|
31501
31531
|
items: {},
|
|
31502
31532
|
inputValue: {},
|
|
31503
31533
|
panelOptions: {},
|
|
31504
|
-
labels: {}
|
|
31534
|
+
labels: {},
|
|
31535
|
+
searchBoxOptions: {}
|
|
31505
31536
|
},
|
|
31506
31537
|
emits: ["product-click"],
|
|
31507
31538
|
setup(__props, { emit: __emit }) {
|
|
@@ -31512,7 +31543,7 @@ const _sfc_main$1i = /* @__PURE__ */ defineComponent({
|
|
|
31512
31543
|
const optionsStore = useOptionsStore();
|
|
31513
31544
|
const { boxRoutingBehavior } = storeToRefs(optionsStore);
|
|
31514
31545
|
const emit2 = __emit;
|
|
31515
|
-
const { highlightedItem } = storeToRefs(searchBoxStore);
|
|
31546
|
+
const { highlightedItem, anyPanelLoading } = storeToRefs(searchBoxStore);
|
|
31516
31547
|
const highlightedIndex = computed(() => {
|
|
31517
31548
|
var _a25, _b25, _c;
|
|
31518
31549
|
if (props.panelOptions.queryKey !== ((_a25 = highlightedItem.value) == null ? void 0 : _a25.queryKey)) {
|
|
@@ -31590,7 +31621,7 @@ const _sfc_main$1i = /* @__PURE__ */ defineComponent({
|
|
|
31590
31621
|
}
|
|
31591
31622
|
};
|
|
31592
31623
|
return (_ctx, _cache) => {
|
|
31593
|
-
var _a25, _b25, _c;
|
|
31624
|
+
var _a25, _b25, _c, _d, _e, _f;
|
|
31594
31625
|
return openBlock(), createElementBlock("div", {
|
|
31595
31626
|
id: "lupa-search-box-products",
|
|
31596
31627
|
class: normalizeClass({ "lupa-search-box-products-expanded": showAll.value })
|
|
@@ -31620,11 +31651,15 @@ const _sfc_main$1i = /* @__PURE__ */ defineComponent({
|
|
|
31620
31651
|
key: 2,
|
|
31621
31652
|
innerHTML: _ctx.panelOptions.appendCustomHtml
|
|
31622
31653
|
}, null, 8, _hoisted_1$14)) : createCommentVNode("", true),
|
|
31623
|
-
|
|
31654
|
+
((_c = (_b25 = _ctx.items) == null ? void 0 : _b25.length) != null ? _c : 0) === 0 && ((_d = _ctx.panelOptions) == null ? void 0 : _d.showPanelZeroResults) && _ctx.searchBoxOptions && !unref(anyPanelLoading) ? (openBlock(), createBlock(_sfc_main$1E, {
|
|
31624
31655
|
key: 3,
|
|
31656
|
+
options: _ctx.searchBoxOptions
|
|
31657
|
+
}, null, 8, ["options"])) : createCommentVNode("", true),
|
|
31658
|
+
showAllItemsToggleButton.value ? (openBlock(), createElementBlock("a", {
|
|
31659
|
+
key: 4,
|
|
31625
31660
|
class: "lupa-search-box-expand",
|
|
31626
31661
|
onClick: _cache[0] || (_cache[0] = ($event) => showAll.value = !showAll.value)
|
|
31627
|
-
}, toDisplayString(showAll.value ? (
|
|
31662
|
+
}, toDisplayString(showAll.value ? (_e = _ctx.labels) == null ? void 0 : _e.showLess : (_f = _ctx.labels) == null ? void 0 : _f.showMore), 1)) : createCommentVNode("", true),
|
|
31628
31663
|
renderSlot(_ctx.$slots, "default")
|
|
31629
31664
|
], 2);
|
|
31630
31665
|
};
|
|
@@ -31838,9 +31873,10 @@ const _sfc_main$1g = /* @__PURE__ */ defineComponent({
|
|
|
31838
31873
|
var _a25, _b25;
|
|
31839
31874
|
return openBlock(), createBlock(_sfc_main$1i, {
|
|
31840
31875
|
items: (_b25 = (_a25 = searchResult.value) == null ? void 0 : _a25.items) != null ? _b25 : [],
|
|
31841
|
-
|
|
31876
|
+
"panel-options": _ctx.panel,
|
|
31842
31877
|
labels: _ctx.labels,
|
|
31843
|
-
|
|
31878
|
+
"input-value": _ctx.inputValue,
|
|
31879
|
+
"search-box-options": _ctx.searchBoxOptions,
|
|
31844
31880
|
onProductClick: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("product-click"))
|
|
31845
31881
|
}, createSlots({
|
|
31846
31882
|
default: withCtx(() => {
|
|
@@ -31863,7 +31899,7 @@ const _sfc_main$1g = /* @__PURE__ */ defineComponent({
|
|
|
31863
31899
|
]),
|
|
31864
31900
|
key: "0"
|
|
31865
31901
|
} : void 0
|
|
31866
|
-
]), 1032, ["items", "
|
|
31902
|
+
]), 1032, ["items", "panel-options", "labels", "input-value", "search-box-options"]);
|
|
31867
31903
|
};
|
|
31868
31904
|
}
|
|
31869
31905
|
});
|
|
@@ -32002,7 +32038,7 @@ const _sfc_main$1e = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValu
|
|
|
32002
32038
|
const panels = computed(() => props.options.panels);
|
|
32003
32039
|
const sdkOptions = computed(() => props.options.options);
|
|
32004
32040
|
const searchBoxStore = useSearchBoxStore();
|
|
32005
|
-
const { suggestionResults, hasAnyResults, panelItemCounts } = storeToRefs(searchBoxStore);
|
|
32041
|
+
const { suggestionResults, hasAnyResults, panelItemCounts, anyPanelLoading } = storeToRefs(searchBoxStore);
|
|
32006
32042
|
const emit2 = __emit;
|
|
32007
32043
|
const isSearchEmpty = computed(() => !props.inputValue || props.inputValue.length < 1);
|
|
32008
32044
|
const displayResults = computed(() => {
|
|
@@ -32190,7 +32226,7 @@ const _sfc_main$1e = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValu
|
|
|
32190
32226
|
], 14, _hoisted_1$12);
|
|
32191
32227
|
}), 128))
|
|
32192
32228
|
], 4),
|
|
32193
|
-
!unref(hasAnyResults) && _ctx.options.showNoResultsPanel ? (openBlock(), createBlock(_sfc_main$1E, {
|
|
32229
|
+
!unref(hasAnyResults) && _ctx.options.showNoResultsPanel && !unref(anyPanelLoading) ? (openBlock(), createBlock(_sfc_main$1E, {
|
|
32194
32230
|
key: 1,
|
|
32195
32231
|
options: _ctx.options
|
|
32196
32232
|
}, null, 8, ["options"])) : createCommentVNode("", true),
|
|
@@ -33372,7 +33408,7 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
|
|
|
33372
33408
|
facet: {},
|
|
33373
33409
|
currentFilters: {}
|
|
33374
33410
|
},
|
|
33375
|
-
emits: ["select"],
|
|
33411
|
+
emits: ["select", "showMoreClicked", "filterFocused"],
|
|
33376
33412
|
setup(__props, { emit: __emit }) {
|
|
33377
33413
|
const props = __props;
|
|
33378
33414
|
const searchResultStore = useSearchResultStore();
|
|
@@ -33436,6 +33472,9 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
|
|
|
33436
33472
|
};
|
|
33437
33473
|
const toggleShowAll = () => {
|
|
33438
33474
|
showAll.value = !showAll.value;
|
|
33475
|
+
if (showAll.value) {
|
|
33476
|
+
emit2("showMoreClicked", facet.value.key);
|
|
33477
|
+
}
|
|
33439
33478
|
};
|
|
33440
33479
|
const isChecked = (item) => {
|
|
33441
33480
|
var _a25, _b25;
|
|
@@ -33465,8 +33504,9 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
|
|
|
33465
33504
|
class: "lupa-term-filter",
|
|
33466
33505
|
"data-cy": "lupa-term-filter",
|
|
33467
33506
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => termFilter.value = $event),
|
|
33468
|
-
placeholder: _ctx.options.labels.facetFilter
|
|
33469
|
-
|
|
33507
|
+
placeholder: _ctx.options.labels.facetFilter,
|
|
33508
|
+
onFocus: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("filterFocused"))
|
|
33509
|
+
}, null, 40, _hoisted_2$E)), [
|
|
33470
33510
|
[vModelText, termFilter.value]
|
|
33471
33511
|
]) : createCommentVNode("", true),
|
|
33472
33512
|
createBaseVNode("div", _hoisted_3$u, [
|
|
@@ -35081,7 +35121,9 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
|
|
|
35081
35121
|
facet: facet.value,
|
|
35082
35122
|
currentFilters: currentFilters.value[facet.value.key],
|
|
35083
35123
|
options: _ctx.options,
|
|
35084
|
-
onSelect: handleFacetSelect
|
|
35124
|
+
onSelect: handleFacetSelect,
|
|
35125
|
+
onShowMoreClicked: handleFacetQueryFilter,
|
|
35126
|
+
onFilterFocused: handleFacetQueryFilter
|
|
35085
35127
|
}, null, 40, ["facet", "currentFilters", "options"])),
|
|
35086
35128
|
_ctx.clearable ? (openBlock(), createElementBlock("div", {
|
|
35087
35129
|
key: 0,
|
|
@@ -41755,6 +41797,7 @@ const getSearchResultsComponent = ({
|
|
|
41755
41797
|
customBaseUrl: searchResultOptions.customBaseUrl,
|
|
41756
41798
|
customPayload: searchResultOptions.customPayload,
|
|
41757
41799
|
customHeaders: searchResultOptions.customHeaders,
|
|
41800
|
+
customRelatedQueriesUrl: searchResultOptions.customRelatedQueriesUrl,
|
|
41758
41801
|
onError: searchResultOptions.errorHandler
|
|
41759
41802
|
},
|
|
41760
41803
|
queryKey: searchResultOptions.queryKey,
|
package/dist/lupaSearch.umd.js
CHANGED
|
@@ -19530,6 +19530,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
19530
19530
|
const options = ref(DEFAULT_SEARCH_BOX_OPTIONS$1);
|
|
19531
19531
|
const docResults = ref({});
|
|
19532
19532
|
const suggestionResults = ref({});
|
|
19533
|
+
const loadingResultsByQueryKey = ref({});
|
|
19533
19534
|
const highlightedIndex = ref(-1);
|
|
19534
19535
|
const inputValue = ref("");
|
|
19535
19536
|
const resultInputValue = ref("");
|
|
@@ -19593,16 +19594,22 @@ var __async = (__this, __arguments, generator) => {
|
|
|
19593
19594
|
title: panel.titleKey ? doc2[panel.titleKey] : ""
|
|
19594
19595
|
};
|
|
19595
19596
|
});
|
|
19597
|
+
const anyPanelLoading = computed(
|
|
19598
|
+
() => Object.values(loadingResultsByQueryKey.value).some((v) => v)
|
|
19599
|
+
);
|
|
19596
19600
|
const querySuggestions = (_0) => __async2(null, [_0], function* ({
|
|
19597
19601
|
queryKey,
|
|
19598
19602
|
publicQuery,
|
|
19599
19603
|
options: options2
|
|
19600
19604
|
}) {
|
|
19601
|
-
var _a25;
|
|
19605
|
+
var _a25, _b25, _c;
|
|
19602
19606
|
try {
|
|
19603
19607
|
const currentRequestId = Date.now();
|
|
19604
19608
|
latestRequestIdByQueryKey[queryKey] = currentRequestId;
|
|
19605
19609
|
const context = getLupaTrackingContext();
|
|
19610
|
+
loadingResultsByQueryKey.value = __spreadProps2(__spreadValues2({}, (_a25 = loadingResultsByQueryKey.value) != null ? _a25 : {}), {
|
|
19611
|
+
[queryKey]: true
|
|
19612
|
+
});
|
|
19606
19613
|
const result2 = yield LupaSearchSdk.suggestions(
|
|
19607
19614
|
queryKey,
|
|
19608
19615
|
__spreadValues2(__spreadValues2({}, publicQuery), context),
|
|
@@ -19616,7 +19623,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
19616
19623
|
}
|
|
19617
19624
|
highlightChange({ action: "clear" });
|
|
19618
19625
|
suggestionResults.value = __spreadProps2(__spreadValues2({}, suggestionResults.value), {
|
|
19619
|
-
[queryKey]: flattenSuggestions(result2.items, (
|
|
19626
|
+
[queryKey]: flattenSuggestions(result2.items, (_b25 = publicQuery.searchText) != null ? _b25 : "")
|
|
19620
19627
|
});
|
|
19621
19628
|
inputValue.value = publicQuery.searchText;
|
|
19622
19629
|
resultInputValue.value = publicQuery.searchText;
|
|
@@ -19630,6 +19637,10 @@ var __async = (__this, __arguments, generator) => {
|
|
|
19630
19637
|
options2.onError(err);
|
|
19631
19638
|
}
|
|
19632
19639
|
return { suggestions: void 0 };
|
|
19640
|
+
} finally {
|
|
19641
|
+
loadingResultsByQueryKey.value = __spreadProps2(__spreadValues2({}, (_c = loadingResultsByQueryKey.value) != null ? _c : {}), {
|
|
19642
|
+
[queryKey]: false
|
|
19643
|
+
});
|
|
19633
19644
|
}
|
|
19634
19645
|
});
|
|
19635
19646
|
const emitSearchResultsCallback = () => {
|
|
@@ -19650,9 +19661,13 @@ var __async = (__this, __arguments, generator) => {
|
|
|
19650
19661
|
publicQuery,
|
|
19651
19662
|
options: options2
|
|
19652
19663
|
}) {
|
|
19664
|
+
var _a25, _b25;
|
|
19653
19665
|
try {
|
|
19654
19666
|
const currentRequestId = Date.now();
|
|
19655
19667
|
latestRequestIdByQueryKey[queryKey] = currentRequestId;
|
|
19668
|
+
loadingResultsByQueryKey.value = __spreadProps2(__spreadValues2({}, (_a25 = loadingResultsByQueryKey.value) != null ? _a25 : {}), {
|
|
19669
|
+
[queryKey]: true
|
|
19670
|
+
});
|
|
19656
19671
|
const context = getLupaTrackingContext();
|
|
19657
19672
|
const result2 = yield LupaSearchSdk.query(queryKey, __spreadValues2(__spreadValues2({}, publicQuery), context), options2);
|
|
19658
19673
|
if (latestRequestIdByQueryKey[queryKey] !== currentRequestId) {
|
|
@@ -19671,6 +19686,10 @@ var __async = (__this, __arguments, generator) => {
|
|
|
19671
19686
|
options2.onError(err);
|
|
19672
19687
|
}
|
|
19673
19688
|
return { queryKey, result: { items: [] } };
|
|
19689
|
+
} finally {
|
|
19690
|
+
loadingResultsByQueryKey.value = __spreadProps2(__spreadValues2({}, (_b25 = loadingResultsByQueryKey.value) != null ? _b25 : {}), {
|
|
19691
|
+
[queryKey]: false
|
|
19692
|
+
});
|
|
19674
19693
|
}
|
|
19675
19694
|
});
|
|
19676
19695
|
const highlightChange = ({ action }) => {
|
|
@@ -19701,6 +19720,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
19701
19720
|
highlightedItem,
|
|
19702
19721
|
highlightedDocument,
|
|
19703
19722
|
hasAnyResults,
|
|
19723
|
+
anyPanelLoading,
|
|
19704
19724
|
querySuggestions,
|
|
19705
19725
|
queryDocuments,
|
|
19706
19726
|
highlightChange,
|
|
@@ -20594,7 +20614,9 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20594
20614
|
items: {},
|
|
20595
20615
|
highlight: { type: Boolean },
|
|
20596
20616
|
queryKey: {},
|
|
20597
|
-
labels: {}
|
|
20617
|
+
labels: {},
|
|
20618
|
+
searchBoxOptions: {},
|
|
20619
|
+
panelOptions: {}
|
|
20598
20620
|
},
|
|
20599
20621
|
emits: ["suggestionSelect"],
|
|
20600
20622
|
setup(__props, { emit: __emit }) {
|
|
@@ -20609,7 +20631,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20609
20631
|
});
|
|
20610
20632
|
const emit2 = __emit;
|
|
20611
20633
|
const searchBoxStore = useSearchBoxStore();
|
|
20612
|
-
const { highlightedItem } = storeToRefs(searchBoxStore);
|
|
20634
|
+
const { highlightedItem, anyPanelLoading } = storeToRefs(searchBoxStore);
|
|
20613
20635
|
const highlightedIndex = computed(() => {
|
|
20614
20636
|
var _a25, _b25, _c;
|
|
20615
20637
|
if (props.queryKey !== ((_a25 = highlightedItem.value) == null ? void 0 : _a25.queryKey)) {
|
|
@@ -20655,6 +20677,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20655
20677
|
});
|
|
20656
20678
|
});
|
|
20657
20679
|
return (_ctx, _cache) => {
|
|
20680
|
+
var _a25, _b25, _c;
|
|
20658
20681
|
return openBlock(), createElementBlock("div", _hoisted_1$1k, [
|
|
20659
20682
|
(openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (item, index) => {
|
|
20660
20683
|
return openBlock(), createBlock(_sfc_main$1D, {
|
|
@@ -20670,7 +20693,11 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20670
20693
|
"data-cy": "lupa-suggestion",
|
|
20671
20694
|
onSelect: handleSelect
|
|
20672
20695
|
}, null, 8, ["class", "suggestion", "highlight", "labels"]);
|
|
20673
|
-
}), 128))
|
|
20696
|
+
}), 128)),
|
|
20697
|
+
((_b25 = (_a25 = items.value) == null ? void 0 : _a25.length) != null ? _b25 : 0) === 0 && ((_c = _ctx.panelOptions) == null ? void 0 : _c.showPanelZeroResults) && _ctx.searchBoxOptions && !unref(anyPanelLoading) ? (openBlock(), createBlock(_sfc_main$1E, {
|
|
20698
|
+
key: 0,
|
|
20699
|
+
options: _ctx.searchBoxOptions
|
|
20700
|
+
}, null, 8, ["options"])) : createCommentVNode("", true)
|
|
20674
20701
|
]);
|
|
20675
20702
|
};
|
|
20676
20703
|
}
|
|
@@ -20693,6 +20720,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20693
20720
|
__name: "SearchBoxSuggestionsWrapper",
|
|
20694
20721
|
props: {
|
|
20695
20722
|
panel: {},
|
|
20723
|
+
searchBoxOptions: {},
|
|
20696
20724
|
options: {},
|
|
20697
20725
|
inputValue: {},
|
|
20698
20726
|
debounce: {},
|
|
@@ -20737,8 +20765,10 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20737
20765
|
highlight: _ctx.panel.highlight,
|
|
20738
20766
|
queryKey: _ctx.panel.queryKey,
|
|
20739
20767
|
labels: _ctx.labels,
|
|
20768
|
+
"search-box-options": _ctx.searchBoxOptions,
|
|
20769
|
+
"panel-options": _ctx.panel,
|
|
20740
20770
|
onSuggestionSelect: _cache[0] || (_cache[0] = (item) => _ctx.$emit("itemSelect", item))
|
|
20741
|
-
}, null, 8, ["items", "highlight", "queryKey", "labels"]);
|
|
20771
|
+
}, null, 8, ["items", "highlight", "queryKey", "labels", "search-box-options", "panel-options"]);
|
|
20742
20772
|
};
|
|
20743
20773
|
}
|
|
20744
20774
|
});
|
|
@@ -30561,7 +30591,7 @@ and ensure you are accounting for this risk.
|
|
|
30561
30591
|
};
|
|
30562
30592
|
const queryFacet = (_0) => __async2(null, [_0], function* ({ queryKey, facetKey }) {
|
|
30563
30593
|
var _a25, _b25, _c, _d;
|
|
30564
|
-
const query = { searchText: "", filters: __spreadValues2({}, filters.value) };
|
|
30594
|
+
const query = { searchText: currentQueryText.value || "", filters: __spreadValues2({}, filters.value) };
|
|
30565
30595
|
const options = (_a25 = optionsStore.envOptions) != null ? _a25 : { environment: "production" };
|
|
30566
30596
|
const result2 = yield LupaSearchSdk.query(queryKey, query, options);
|
|
30567
30597
|
if (!result2.success) {
|
|
@@ -31505,7 +31535,8 @@ and ensure you are accounting for this risk.
|
|
|
31505
31535
|
items: {},
|
|
31506
31536
|
inputValue: {},
|
|
31507
31537
|
panelOptions: {},
|
|
31508
|
-
labels: {}
|
|
31538
|
+
labels: {},
|
|
31539
|
+
searchBoxOptions: {}
|
|
31509
31540
|
},
|
|
31510
31541
|
emits: ["product-click"],
|
|
31511
31542
|
setup(__props, { emit: __emit }) {
|
|
@@ -31516,7 +31547,7 @@ and ensure you are accounting for this risk.
|
|
|
31516
31547
|
const optionsStore = useOptionsStore();
|
|
31517
31548
|
const { boxRoutingBehavior } = storeToRefs(optionsStore);
|
|
31518
31549
|
const emit2 = __emit;
|
|
31519
|
-
const { highlightedItem } = storeToRefs(searchBoxStore);
|
|
31550
|
+
const { highlightedItem, anyPanelLoading } = storeToRefs(searchBoxStore);
|
|
31520
31551
|
const highlightedIndex = computed(() => {
|
|
31521
31552
|
var _a25, _b25, _c;
|
|
31522
31553
|
if (props.panelOptions.queryKey !== ((_a25 = highlightedItem.value) == null ? void 0 : _a25.queryKey)) {
|
|
@@ -31594,7 +31625,7 @@ and ensure you are accounting for this risk.
|
|
|
31594
31625
|
}
|
|
31595
31626
|
};
|
|
31596
31627
|
return (_ctx, _cache) => {
|
|
31597
|
-
var _a25, _b25, _c;
|
|
31628
|
+
var _a25, _b25, _c, _d, _e, _f;
|
|
31598
31629
|
return openBlock(), createElementBlock("div", {
|
|
31599
31630
|
id: "lupa-search-box-products",
|
|
31600
31631
|
class: normalizeClass({ "lupa-search-box-products-expanded": showAll.value })
|
|
@@ -31624,11 +31655,15 @@ and ensure you are accounting for this risk.
|
|
|
31624
31655
|
key: 2,
|
|
31625
31656
|
innerHTML: _ctx.panelOptions.appendCustomHtml
|
|
31626
31657
|
}, null, 8, _hoisted_1$14)) : createCommentVNode("", true),
|
|
31627
|
-
|
|
31658
|
+
((_c = (_b25 = _ctx.items) == null ? void 0 : _b25.length) != null ? _c : 0) === 0 && ((_d = _ctx.panelOptions) == null ? void 0 : _d.showPanelZeroResults) && _ctx.searchBoxOptions && !unref(anyPanelLoading) ? (openBlock(), createBlock(_sfc_main$1E, {
|
|
31628
31659
|
key: 3,
|
|
31660
|
+
options: _ctx.searchBoxOptions
|
|
31661
|
+
}, null, 8, ["options"])) : createCommentVNode("", true),
|
|
31662
|
+
showAllItemsToggleButton.value ? (openBlock(), createElementBlock("a", {
|
|
31663
|
+
key: 4,
|
|
31629
31664
|
class: "lupa-search-box-expand",
|
|
31630
31665
|
onClick: _cache[0] || (_cache[0] = ($event) => showAll.value = !showAll.value)
|
|
31631
|
-
}, toDisplayString(showAll.value ? (
|
|
31666
|
+
}, toDisplayString(showAll.value ? (_e = _ctx.labels) == null ? void 0 : _e.showLess : (_f = _ctx.labels) == null ? void 0 : _f.showMore), 1)) : createCommentVNode("", true),
|
|
31632
31667
|
renderSlot(_ctx.$slots, "default")
|
|
31633
31668
|
], 2);
|
|
31634
31669
|
};
|
|
@@ -31842,9 +31877,10 @@ and ensure you are accounting for this risk.
|
|
|
31842
31877
|
var _a25, _b25;
|
|
31843
31878
|
return openBlock(), createBlock(_sfc_main$1i, {
|
|
31844
31879
|
items: (_b25 = (_a25 = searchResult.value) == null ? void 0 : _a25.items) != null ? _b25 : [],
|
|
31845
|
-
|
|
31880
|
+
"panel-options": _ctx.panel,
|
|
31846
31881
|
labels: _ctx.labels,
|
|
31847
|
-
|
|
31882
|
+
"input-value": _ctx.inputValue,
|
|
31883
|
+
"search-box-options": _ctx.searchBoxOptions,
|
|
31848
31884
|
onProductClick: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("product-click"))
|
|
31849
31885
|
}, createSlots({
|
|
31850
31886
|
default: withCtx(() => {
|
|
@@ -31867,7 +31903,7 @@ and ensure you are accounting for this risk.
|
|
|
31867
31903
|
]),
|
|
31868
31904
|
key: "0"
|
|
31869
31905
|
} : void 0
|
|
31870
|
-
]), 1032, ["items", "
|
|
31906
|
+
]), 1032, ["items", "panel-options", "labels", "input-value", "search-box-options"]);
|
|
31871
31907
|
};
|
|
31872
31908
|
}
|
|
31873
31909
|
});
|
|
@@ -32006,7 +32042,7 @@ and ensure you are accounting for this risk.
|
|
|
32006
32042
|
const panels = computed(() => props.options.panels);
|
|
32007
32043
|
const sdkOptions = computed(() => props.options.options);
|
|
32008
32044
|
const searchBoxStore = useSearchBoxStore();
|
|
32009
|
-
const { suggestionResults, hasAnyResults, panelItemCounts } = storeToRefs(searchBoxStore);
|
|
32045
|
+
const { suggestionResults, hasAnyResults, panelItemCounts, anyPanelLoading } = storeToRefs(searchBoxStore);
|
|
32010
32046
|
const emit2 = __emit;
|
|
32011
32047
|
const isSearchEmpty = computed(() => !props.inputValue || props.inputValue.length < 1);
|
|
32012
32048
|
const displayResults = computed(() => {
|
|
@@ -32194,7 +32230,7 @@ and ensure you are accounting for this risk.
|
|
|
32194
32230
|
], 14, _hoisted_1$12);
|
|
32195
32231
|
}), 128))
|
|
32196
32232
|
], 4),
|
|
32197
|
-
!unref(hasAnyResults) && _ctx.options.showNoResultsPanel ? (openBlock(), createBlock(_sfc_main$1E, {
|
|
32233
|
+
!unref(hasAnyResults) && _ctx.options.showNoResultsPanel && !unref(anyPanelLoading) ? (openBlock(), createBlock(_sfc_main$1E, {
|
|
32198
32234
|
key: 1,
|
|
32199
32235
|
options: _ctx.options
|
|
32200
32236
|
}, null, 8, ["options"])) : createCommentVNode("", true),
|
|
@@ -33376,7 +33412,7 @@ and ensure you are accounting for this risk.
|
|
|
33376
33412
|
facet: {},
|
|
33377
33413
|
currentFilters: {}
|
|
33378
33414
|
},
|
|
33379
|
-
emits: ["select"],
|
|
33415
|
+
emits: ["select", "showMoreClicked", "filterFocused"],
|
|
33380
33416
|
setup(__props, { emit: __emit }) {
|
|
33381
33417
|
const props = __props;
|
|
33382
33418
|
const searchResultStore = useSearchResultStore();
|
|
@@ -33440,6 +33476,9 @@ and ensure you are accounting for this risk.
|
|
|
33440
33476
|
};
|
|
33441
33477
|
const toggleShowAll = () => {
|
|
33442
33478
|
showAll.value = !showAll.value;
|
|
33479
|
+
if (showAll.value) {
|
|
33480
|
+
emit2("showMoreClicked", facet.value.key);
|
|
33481
|
+
}
|
|
33443
33482
|
};
|
|
33444
33483
|
const isChecked = (item) => {
|
|
33445
33484
|
var _a25, _b25;
|
|
@@ -33469,8 +33508,9 @@ and ensure you are accounting for this risk.
|
|
|
33469
33508
|
class: "lupa-term-filter",
|
|
33470
33509
|
"data-cy": "lupa-term-filter",
|
|
33471
33510
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => termFilter.value = $event),
|
|
33472
|
-
placeholder: _ctx.options.labels.facetFilter
|
|
33473
|
-
|
|
33511
|
+
placeholder: _ctx.options.labels.facetFilter,
|
|
33512
|
+
onFocus: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("filterFocused"))
|
|
33513
|
+
}, null, 40, _hoisted_2$E)), [
|
|
33474
33514
|
[vModelText, termFilter.value]
|
|
33475
33515
|
]) : createCommentVNode("", true),
|
|
33476
33516
|
createBaseVNode("div", _hoisted_3$u, [
|
|
@@ -35085,7 +35125,9 @@ and ensure you are accounting for this risk.
|
|
|
35085
35125
|
facet: facet.value,
|
|
35086
35126
|
currentFilters: currentFilters.value[facet.value.key],
|
|
35087
35127
|
options: _ctx.options,
|
|
35088
|
-
onSelect: handleFacetSelect
|
|
35128
|
+
onSelect: handleFacetSelect,
|
|
35129
|
+
onShowMoreClicked: handleFacetQueryFilter,
|
|
35130
|
+
onFilterFocused: handleFacetQueryFilter
|
|
35089
35131
|
}, null, 40, ["facet", "currentFilters", "options"])),
|
|
35090
35132
|
_ctx.clearable ? (openBlock(), createElementBlock("div", {
|
|
35091
35133
|
key: 0,
|
|
@@ -41759,6 +41801,7 @@ and ensure you are accounting for this risk.
|
|
|
41759
41801
|
customBaseUrl: searchResultOptions.customBaseUrl,
|
|
41760
41802
|
customPayload: searchResultOptions.customPayload,
|
|
41761
41803
|
customHeaders: searchResultOptions.customHeaders,
|
|
41804
|
+
customRelatedQueriesUrl: searchResultOptions.customRelatedQueriesUrl,
|
|
41762
41805
|
onError: searchResultOptions.errorHandler
|
|
41763
41806
|
},
|
|
41764
41807
|
queryKey: searchResultOptions.queryKey,
|
|
@@ -33,6 +33,7 @@ export type SearchResultDemoOptions = {
|
|
|
33
33
|
environment?: string;
|
|
34
34
|
customUrl?: string;
|
|
35
35
|
customBaseUrl?: string;
|
|
36
|
+
customRelatedQueriesUrl?: string;
|
|
36
37
|
customPayload?: Record<string, unknown>;
|
|
37
38
|
customHeaders?: Record<string, string>;
|
|
38
39
|
gridConfiguration?: Record<string, number>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getlupa/client",
|
|
3
|
-
"version": "1.26.
|
|
3
|
+
"version": "1.26.2",
|
|
4
4
|
"main": "dist/lupaSearch.js",
|
|
5
5
|
"module": "dist/lupaSearch.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@getlupa/client-sdk": "^1.8.1",
|
|
23
|
-
"@getlupa/vue": "0.
|
|
23
|
+
"@getlupa/vue": "0.26.0",
|
|
24
24
|
"@rushstack/eslint-patch": "^1.12.0",
|
|
25
25
|
"@tsconfig/node18": "^18.2.4",
|
|
26
26
|
"@types/jsdom": "^21.1.7",
|