@getlupa/client 1.26.1 → 1.26.3
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 -20
- package/dist/lupaSearch.js +64 -20
- package/dist/lupaSearch.mjs +64 -20
- package/dist/lupaSearch.umd.js +64 -20
- 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("");
|
|
@@ -19537,6 +19538,12 @@ var __async = (__this, __arguments, generator) => {
|
|
|
19537
19538
|
var _a25;
|
|
19538
19539
|
return ((_a25 = inputValue.value) == null ? void 0 : _a25.length) >= options.value.minInputLength;
|
|
19539
19540
|
});
|
|
19541
|
+
const setQueryKeyLoading = ({ queryKey, loading }) => {
|
|
19542
|
+
var _a25;
|
|
19543
|
+
loadingResultsByQueryKey.value = __spreadProps2(__spreadValues2({}, (_a25 = loadingResultsByQueryKey.value) != null ? _a25 : {}), {
|
|
19544
|
+
[queryKey]: loading
|
|
19545
|
+
});
|
|
19546
|
+
};
|
|
19540
19547
|
const panelItemCounts = computed(
|
|
19541
19548
|
() => options.value.panels.map((p2) => {
|
|
19542
19549
|
var _a25, _b25, _c, _d, _e;
|
|
@@ -19591,6 +19598,9 @@ var __async = (__this, __arguments, generator) => {
|
|
|
19591
19598
|
title: panel.titleKey ? doc2[panel.titleKey] : ""
|
|
19592
19599
|
};
|
|
19593
19600
|
});
|
|
19601
|
+
const anyPanelLoading = computed(
|
|
19602
|
+
() => Object.values(loadingResultsByQueryKey.value).some((v) => v)
|
|
19603
|
+
);
|
|
19594
19604
|
const querySuggestions = (_0) => __async2(null, [_0], function* ({
|
|
19595
19605
|
queryKey,
|
|
19596
19606
|
publicQuery,
|
|
@@ -19601,6 +19611,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
19601
19611
|
const currentRequestId = Date.now();
|
|
19602
19612
|
latestRequestIdByQueryKey[queryKey] = currentRequestId;
|
|
19603
19613
|
const context = getLupaTrackingContext();
|
|
19614
|
+
setQueryKeyLoading({ queryKey, loading: true });
|
|
19604
19615
|
const result2 = yield LupaSearchSdk.suggestions(
|
|
19605
19616
|
queryKey,
|
|
19606
19617
|
__spreadValues2(__spreadValues2({}, publicQuery), context),
|
|
@@ -19628,6 +19639,8 @@ var __async = (__this, __arguments, generator) => {
|
|
|
19628
19639
|
options2.onError(err);
|
|
19629
19640
|
}
|
|
19630
19641
|
return { suggestions: void 0 };
|
|
19642
|
+
} finally {
|
|
19643
|
+
setQueryKeyLoading({ queryKey, loading: false });
|
|
19631
19644
|
}
|
|
19632
19645
|
});
|
|
19633
19646
|
const emitSearchResultsCallback = () => {
|
|
@@ -19651,6 +19664,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
19651
19664
|
try {
|
|
19652
19665
|
const currentRequestId = Date.now();
|
|
19653
19666
|
latestRequestIdByQueryKey[queryKey] = currentRequestId;
|
|
19667
|
+
setQueryKeyLoading({ queryKey, loading: true });
|
|
19654
19668
|
const context = getLupaTrackingContext();
|
|
19655
19669
|
const result2 = yield LupaSearchSdk.query(queryKey, __spreadValues2(__spreadValues2({}, publicQuery), context), options2);
|
|
19656
19670
|
if (latestRequestIdByQueryKey[queryKey] !== currentRequestId) {
|
|
@@ -19669,6 +19683,8 @@ var __async = (__this, __arguments, generator) => {
|
|
|
19669
19683
|
options2.onError(err);
|
|
19670
19684
|
}
|
|
19671
19685
|
return { queryKey, result: { items: [] } };
|
|
19686
|
+
} finally {
|
|
19687
|
+
setQueryKeyLoading({ queryKey, loading: false });
|
|
19672
19688
|
}
|
|
19673
19689
|
});
|
|
19674
19690
|
const highlightChange = ({ action }) => {
|
|
@@ -19699,12 +19715,14 @@ var __async = (__this, __arguments, generator) => {
|
|
|
19699
19715
|
highlightedItem,
|
|
19700
19716
|
highlightedDocument,
|
|
19701
19717
|
hasAnyResults,
|
|
19718
|
+
anyPanelLoading,
|
|
19702
19719
|
querySuggestions,
|
|
19703
19720
|
queryDocuments,
|
|
19704
19721
|
highlightChange,
|
|
19705
19722
|
saveInputValue,
|
|
19706
19723
|
saveOptions,
|
|
19707
|
-
resetHighlightIndex
|
|
19724
|
+
resetHighlightIndex,
|
|
19725
|
+
setQueryKeyLoading
|
|
19708
19726
|
};
|
|
19709
19727
|
});
|
|
19710
19728
|
const Env = {
|
|
@@ -20592,7 +20610,9 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20592
20610
|
items: {},
|
|
20593
20611
|
highlight: { type: Boolean },
|
|
20594
20612
|
queryKey: {},
|
|
20595
|
-
labels: {}
|
|
20613
|
+
labels: {},
|
|
20614
|
+
searchBoxOptions: {},
|
|
20615
|
+
panelOptions: {}
|
|
20596
20616
|
},
|
|
20597
20617
|
emits: ["suggestionSelect"],
|
|
20598
20618
|
setup(__props, { emit: __emit }) {
|
|
@@ -20607,7 +20627,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20607
20627
|
});
|
|
20608
20628
|
const emit2 = __emit;
|
|
20609
20629
|
const searchBoxStore = useSearchBoxStore();
|
|
20610
|
-
const { highlightedItem } = storeToRefs(searchBoxStore);
|
|
20630
|
+
const { highlightedItem, anyPanelLoading } = storeToRefs(searchBoxStore);
|
|
20611
20631
|
const highlightedIndex = computed(() => {
|
|
20612
20632
|
var _a25, _b25, _c;
|
|
20613
20633
|
if (props.queryKey !== ((_a25 = highlightedItem.value) == null ? void 0 : _a25.queryKey)) {
|
|
@@ -20653,6 +20673,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20653
20673
|
});
|
|
20654
20674
|
});
|
|
20655
20675
|
return (_ctx, _cache) => {
|
|
20676
|
+
var _a25, _b25, _c;
|
|
20656
20677
|
return openBlock(), createElementBlock("div", _hoisted_1$1k, [
|
|
20657
20678
|
(openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (item, index) => {
|
|
20658
20679
|
return openBlock(), createBlock(_sfc_main$1D, {
|
|
@@ -20668,7 +20689,11 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20668
20689
|
"data-cy": "lupa-suggestion",
|
|
20669
20690
|
onSelect: handleSelect
|
|
20670
20691
|
}, null, 8, ["class", "suggestion", "highlight", "labels"]);
|
|
20671
|
-
}), 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)
|
|
20672
20697
|
]);
|
|
20673
20698
|
};
|
|
20674
20699
|
}
|
|
@@ -20691,6 +20716,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20691
20716
|
__name: "SearchBoxSuggestionsWrapper",
|
|
20692
20717
|
props: {
|
|
20693
20718
|
panel: {},
|
|
20719
|
+
searchBoxOptions: {},
|
|
20694
20720
|
options: {},
|
|
20695
20721
|
inputValue: {},
|
|
20696
20722
|
debounce: {},
|
|
@@ -20708,9 +20734,11 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20708
20734
|
return (_a25 = suggestionResults.value[props.panel.queryKey]) != null ? _a25 : [];
|
|
20709
20735
|
});
|
|
20710
20736
|
onMounted(() => {
|
|
20737
|
+
searchBoxStore.setQueryKeyLoading({ queryKey: props.panel.queryKey, loading: true });
|
|
20711
20738
|
getSuggestionsDebounced();
|
|
20712
20739
|
});
|
|
20713
20740
|
watch(inputValueProp, () => {
|
|
20741
|
+
searchBoxStore.setQueryKeyLoading({ queryKey: props.panel.queryKey, loading: true });
|
|
20714
20742
|
getSuggestionsDebounced();
|
|
20715
20743
|
});
|
|
20716
20744
|
const getSuggestions = () => {
|
|
@@ -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
|
};
|
|
@@ -31797,9 +31832,11 @@ and ensure you are accounting for this risk.
|
|
|
31797
31832
|
});
|
|
31798
31833
|
const inputValueProp = computed(() => props.inputValue);
|
|
31799
31834
|
onMounted(() => {
|
|
31835
|
+
searchBoxStore.setQueryKeyLoading({ queryKey: props.panel.queryKey, loading: true });
|
|
31800
31836
|
getItemsDebounced();
|
|
31801
31837
|
});
|
|
31802
31838
|
watch(inputValueProp, () => {
|
|
31839
|
+
searchBoxStore.setQueryKeyLoading({ queryKey: props.panel.queryKey, loading: true });
|
|
31803
31840
|
getItemsDebounced();
|
|
31804
31841
|
});
|
|
31805
31842
|
const enhancePanelData = () => __async2(null, null, function* () {
|
|
@@ -31840,9 +31877,10 @@ and ensure you are accounting for this risk.
|
|
|
31840
31877
|
var _a25, _b25;
|
|
31841
31878
|
return openBlock(), createBlock(_sfc_main$1i, {
|
|
31842
31879
|
items: (_b25 = (_a25 = searchResult.value) == null ? void 0 : _a25.items) != null ? _b25 : [],
|
|
31843
|
-
|
|
31880
|
+
"panel-options": _ctx.panel,
|
|
31844
31881
|
labels: _ctx.labels,
|
|
31845
|
-
|
|
31882
|
+
"input-value": _ctx.inputValue,
|
|
31883
|
+
"search-box-options": _ctx.searchBoxOptions,
|
|
31846
31884
|
onProductClick: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("product-click"))
|
|
31847
31885
|
}, createSlots({
|
|
31848
31886
|
default: withCtx(() => {
|
|
@@ -31865,7 +31903,7 @@ and ensure you are accounting for this risk.
|
|
|
31865
31903
|
]),
|
|
31866
31904
|
key: "0"
|
|
31867
31905
|
} : void 0
|
|
31868
|
-
]), 1032, ["items", "
|
|
31906
|
+
]), 1032, ["items", "panel-options", "labels", "input-value", "search-box-options"]);
|
|
31869
31907
|
};
|
|
31870
31908
|
}
|
|
31871
31909
|
});
|
|
@@ -32004,7 +32042,7 @@ and ensure you are accounting for this risk.
|
|
|
32004
32042
|
const panels = computed(() => props.options.panels);
|
|
32005
32043
|
const sdkOptions = computed(() => props.options.options);
|
|
32006
32044
|
const searchBoxStore = useSearchBoxStore();
|
|
32007
|
-
const { suggestionResults, hasAnyResults, panelItemCounts } = storeToRefs(searchBoxStore);
|
|
32045
|
+
const { suggestionResults, hasAnyResults, panelItemCounts, anyPanelLoading } = storeToRefs(searchBoxStore);
|
|
32008
32046
|
const emit2 = __emit;
|
|
32009
32047
|
const isSearchEmpty = computed(() => !props.inputValue || props.inputValue.length < 1);
|
|
32010
32048
|
const displayResults = computed(() => {
|
|
@@ -32192,7 +32230,7 @@ and ensure you are accounting for this risk.
|
|
|
32192
32230
|
], 14, _hoisted_1$12);
|
|
32193
32231
|
}), 128))
|
|
32194
32232
|
], 4),
|
|
32195
|
-
!unref(hasAnyResults) && _ctx.options.showNoResultsPanel ? (openBlock(), createBlock(_sfc_main$1E, {
|
|
32233
|
+
!unref(hasAnyResults) && _ctx.options.showNoResultsPanel && !unref(anyPanelLoading) ? (openBlock(), createBlock(_sfc_main$1E, {
|
|
32196
32234
|
key: 1,
|
|
32197
32235
|
options: _ctx.options
|
|
32198
32236
|
}, null, 8, ["options"])) : createCommentVNode("", true),
|
|
@@ -33374,7 +33412,7 @@ and ensure you are accounting for this risk.
|
|
|
33374
33412
|
facet: {},
|
|
33375
33413
|
currentFilters: {}
|
|
33376
33414
|
},
|
|
33377
|
-
emits: ["select"],
|
|
33415
|
+
emits: ["select", "showMoreClicked", "filterFocused"],
|
|
33378
33416
|
setup(__props, { emit: __emit }) {
|
|
33379
33417
|
const props = __props;
|
|
33380
33418
|
const searchResultStore = useSearchResultStore();
|
|
@@ -33438,6 +33476,9 @@ and ensure you are accounting for this risk.
|
|
|
33438
33476
|
};
|
|
33439
33477
|
const toggleShowAll = () => {
|
|
33440
33478
|
showAll.value = !showAll.value;
|
|
33479
|
+
if (showAll.value) {
|
|
33480
|
+
emit2("showMoreClicked", facet.value.key);
|
|
33481
|
+
}
|
|
33441
33482
|
};
|
|
33442
33483
|
const isChecked = (item) => {
|
|
33443
33484
|
var _a25, _b25;
|
|
@@ -33467,8 +33508,9 @@ and ensure you are accounting for this risk.
|
|
|
33467
33508
|
class: "lupa-term-filter",
|
|
33468
33509
|
"data-cy": "lupa-term-filter",
|
|
33469
33510
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => termFilter.value = $event),
|
|
33470
|
-
placeholder: _ctx.options.labels.facetFilter
|
|
33471
|
-
|
|
33511
|
+
placeholder: _ctx.options.labels.facetFilter,
|
|
33512
|
+
onFocus: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("filterFocused"))
|
|
33513
|
+
}, null, 40, _hoisted_2$E)), [
|
|
33472
33514
|
[vModelText, termFilter.value]
|
|
33473
33515
|
]) : createCommentVNode("", true),
|
|
33474
33516
|
createBaseVNode("div", _hoisted_3$u, [
|
|
@@ -35083,7 +35125,9 @@ and ensure you are accounting for this risk.
|
|
|
35083
35125
|
facet: facet.value,
|
|
35084
35126
|
currentFilters: currentFilters.value[facet.value.key],
|
|
35085
35127
|
options: _ctx.options,
|
|
35086
|
-
onSelect: handleFacetSelect
|
|
35128
|
+
onSelect: handleFacetSelect,
|
|
35129
|
+
onShowMoreClicked: handleFacetQueryFilter,
|
|
35130
|
+
onFilterFocused: handleFacetQueryFilter
|
|
35087
35131
|
}, null, 40, ["facet", "currentFilters", "options"])),
|
|
35088
35132
|
_ctx.clearable ? (openBlock(), createElementBlock("div", {
|
|
35089
35133
|
key: 0,
|
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("");
|
|
@@ -19537,6 +19538,12 @@ const useSearchBoxStore = /* @__PURE__ */ defineStore("searchBox", () => {
|
|
|
19537
19538
|
var _a25;
|
|
19538
19539
|
return ((_a25 = inputValue.value) == null ? void 0 : _a25.length) >= options.value.minInputLength;
|
|
19539
19540
|
});
|
|
19541
|
+
const setQueryKeyLoading = ({ queryKey, loading }) => {
|
|
19542
|
+
var _a25;
|
|
19543
|
+
loadingResultsByQueryKey.value = __spreadProps2(__spreadValues2({}, (_a25 = loadingResultsByQueryKey.value) != null ? _a25 : {}), {
|
|
19544
|
+
[queryKey]: loading
|
|
19545
|
+
});
|
|
19546
|
+
};
|
|
19540
19547
|
const panelItemCounts = computed(
|
|
19541
19548
|
() => options.value.panels.map((p2) => {
|
|
19542
19549
|
var _a25, _b25, _c, _d, _e;
|
|
@@ -19591,6 +19598,9 @@ const useSearchBoxStore = /* @__PURE__ */ defineStore("searchBox", () => {
|
|
|
19591
19598
|
title: panel.titleKey ? doc2[panel.titleKey] : ""
|
|
19592
19599
|
};
|
|
19593
19600
|
});
|
|
19601
|
+
const anyPanelLoading = computed(
|
|
19602
|
+
() => Object.values(loadingResultsByQueryKey.value).some((v) => v)
|
|
19603
|
+
);
|
|
19594
19604
|
const querySuggestions = (_0) => __async2(null, [_0], function* ({
|
|
19595
19605
|
queryKey,
|
|
19596
19606
|
publicQuery,
|
|
@@ -19601,6 +19611,7 @@ const useSearchBoxStore = /* @__PURE__ */ defineStore("searchBox", () => {
|
|
|
19601
19611
|
const currentRequestId = Date.now();
|
|
19602
19612
|
latestRequestIdByQueryKey[queryKey] = currentRequestId;
|
|
19603
19613
|
const context = getLupaTrackingContext();
|
|
19614
|
+
setQueryKeyLoading({ queryKey, loading: true });
|
|
19604
19615
|
const result2 = yield LupaSearchSdk.suggestions(
|
|
19605
19616
|
queryKey,
|
|
19606
19617
|
__spreadValues2(__spreadValues2({}, publicQuery), context),
|
|
@@ -19628,6 +19639,8 @@ const useSearchBoxStore = /* @__PURE__ */ defineStore("searchBox", () => {
|
|
|
19628
19639
|
options2.onError(err);
|
|
19629
19640
|
}
|
|
19630
19641
|
return { suggestions: void 0 };
|
|
19642
|
+
} finally {
|
|
19643
|
+
setQueryKeyLoading({ queryKey, loading: false });
|
|
19631
19644
|
}
|
|
19632
19645
|
});
|
|
19633
19646
|
const emitSearchResultsCallback = () => {
|
|
@@ -19651,6 +19664,7 @@ const useSearchBoxStore = /* @__PURE__ */ defineStore("searchBox", () => {
|
|
|
19651
19664
|
try {
|
|
19652
19665
|
const currentRequestId = Date.now();
|
|
19653
19666
|
latestRequestIdByQueryKey[queryKey] = currentRequestId;
|
|
19667
|
+
setQueryKeyLoading({ queryKey, loading: true });
|
|
19654
19668
|
const context = getLupaTrackingContext();
|
|
19655
19669
|
const result2 = yield LupaSearchSdk.query(queryKey, __spreadValues2(__spreadValues2({}, publicQuery), context), options2);
|
|
19656
19670
|
if (latestRequestIdByQueryKey[queryKey] !== currentRequestId) {
|
|
@@ -19669,6 +19683,8 @@ const useSearchBoxStore = /* @__PURE__ */ defineStore("searchBox", () => {
|
|
|
19669
19683
|
options2.onError(err);
|
|
19670
19684
|
}
|
|
19671
19685
|
return { queryKey, result: { items: [] } };
|
|
19686
|
+
} finally {
|
|
19687
|
+
setQueryKeyLoading({ queryKey, loading: false });
|
|
19672
19688
|
}
|
|
19673
19689
|
});
|
|
19674
19690
|
const highlightChange = ({ action }) => {
|
|
@@ -19699,12 +19715,14 @@ const useSearchBoxStore = /* @__PURE__ */ defineStore("searchBox", () => {
|
|
|
19699
19715
|
highlightedItem,
|
|
19700
19716
|
highlightedDocument,
|
|
19701
19717
|
hasAnyResults,
|
|
19718
|
+
anyPanelLoading,
|
|
19702
19719
|
querySuggestions,
|
|
19703
19720
|
queryDocuments,
|
|
19704
19721
|
highlightChange,
|
|
19705
19722
|
saveInputValue,
|
|
19706
19723
|
saveOptions,
|
|
19707
|
-
resetHighlightIndex
|
|
19724
|
+
resetHighlightIndex,
|
|
19725
|
+
setQueryKeyLoading
|
|
19708
19726
|
};
|
|
19709
19727
|
});
|
|
19710
19728
|
const Env = {
|
|
@@ -20592,7 +20610,9 @@ const _sfc_main$1C = /* @__PURE__ */ defineComponent({
|
|
|
20592
20610
|
items: {},
|
|
20593
20611
|
highlight: { type: Boolean },
|
|
20594
20612
|
queryKey: {},
|
|
20595
|
-
labels: {}
|
|
20613
|
+
labels: {},
|
|
20614
|
+
searchBoxOptions: {},
|
|
20615
|
+
panelOptions: {}
|
|
20596
20616
|
},
|
|
20597
20617
|
emits: ["suggestionSelect"],
|
|
20598
20618
|
setup(__props, { emit: __emit }) {
|
|
@@ -20607,7 +20627,7 @@ const _sfc_main$1C = /* @__PURE__ */ defineComponent({
|
|
|
20607
20627
|
});
|
|
20608
20628
|
const emit2 = __emit;
|
|
20609
20629
|
const searchBoxStore = useSearchBoxStore();
|
|
20610
|
-
const { highlightedItem } = storeToRefs(searchBoxStore);
|
|
20630
|
+
const { highlightedItem, anyPanelLoading } = storeToRefs(searchBoxStore);
|
|
20611
20631
|
const highlightedIndex = computed(() => {
|
|
20612
20632
|
var _a25, _b25, _c;
|
|
20613
20633
|
if (props.queryKey !== ((_a25 = highlightedItem.value) == null ? void 0 : _a25.queryKey)) {
|
|
@@ -20653,6 +20673,7 @@ const _sfc_main$1C = /* @__PURE__ */ defineComponent({
|
|
|
20653
20673
|
});
|
|
20654
20674
|
});
|
|
20655
20675
|
return (_ctx, _cache) => {
|
|
20676
|
+
var _a25, _b25, _c;
|
|
20656
20677
|
return openBlock(), createElementBlock("div", _hoisted_1$1k, [
|
|
20657
20678
|
(openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (item, index) => {
|
|
20658
20679
|
return openBlock(), createBlock(_sfc_main$1D, {
|
|
@@ -20668,7 +20689,11 @@ const _sfc_main$1C = /* @__PURE__ */ defineComponent({
|
|
|
20668
20689
|
"data-cy": "lupa-suggestion",
|
|
20669
20690
|
onSelect: handleSelect
|
|
20670
20691
|
}, null, 8, ["class", "suggestion", "highlight", "labels"]);
|
|
20671
|
-
}), 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)
|
|
20672
20697
|
]);
|
|
20673
20698
|
};
|
|
20674
20699
|
}
|
|
@@ -20691,6 +20716,7 @@ const _sfc_main$1B = /* @__PURE__ */ defineComponent({
|
|
|
20691
20716
|
__name: "SearchBoxSuggestionsWrapper",
|
|
20692
20717
|
props: {
|
|
20693
20718
|
panel: {},
|
|
20719
|
+
searchBoxOptions: {},
|
|
20694
20720
|
options: {},
|
|
20695
20721
|
inputValue: {},
|
|
20696
20722
|
debounce: {},
|
|
@@ -20708,9 +20734,11 @@ const _sfc_main$1B = /* @__PURE__ */ defineComponent({
|
|
|
20708
20734
|
return (_a25 = suggestionResults.value[props.panel.queryKey]) != null ? _a25 : [];
|
|
20709
20735
|
});
|
|
20710
20736
|
onMounted(() => {
|
|
20737
|
+
searchBoxStore.setQueryKeyLoading({ queryKey: props.panel.queryKey, loading: true });
|
|
20711
20738
|
getSuggestionsDebounced();
|
|
20712
20739
|
});
|
|
20713
20740
|
watch(inputValueProp, () => {
|
|
20741
|
+
searchBoxStore.setQueryKeyLoading({ queryKey: props.panel.queryKey, loading: true });
|
|
20714
20742
|
getSuggestionsDebounced();
|
|
20715
20743
|
});
|
|
20716
20744
|
const getSuggestions = () => {
|
|
@@ -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
|
};
|
|
@@ -31797,9 +31832,11 @@ const _sfc_main$1g = /* @__PURE__ */ defineComponent({
|
|
|
31797
31832
|
});
|
|
31798
31833
|
const inputValueProp = computed(() => props.inputValue);
|
|
31799
31834
|
onMounted(() => {
|
|
31835
|
+
searchBoxStore.setQueryKeyLoading({ queryKey: props.panel.queryKey, loading: true });
|
|
31800
31836
|
getItemsDebounced();
|
|
31801
31837
|
});
|
|
31802
31838
|
watch(inputValueProp, () => {
|
|
31839
|
+
searchBoxStore.setQueryKeyLoading({ queryKey: props.panel.queryKey, loading: true });
|
|
31803
31840
|
getItemsDebounced();
|
|
31804
31841
|
});
|
|
31805
31842
|
const enhancePanelData = () => __async2(null, null, function* () {
|
|
@@ -31840,9 +31877,10 @@ const _sfc_main$1g = /* @__PURE__ */ defineComponent({
|
|
|
31840
31877
|
var _a25, _b25;
|
|
31841
31878
|
return openBlock(), createBlock(_sfc_main$1i, {
|
|
31842
31879
|
items: (_b25 = (_a25 = searchResult.value) == null ? void 0 : _a25.items) != null ? _b25 : [],
|
|
31843
|
-
|
|
31880
|
+
"panel-options": _ctx.panel,
|
|
31844
31881
|
labels: _ctx.labels,
|
|
31845
|
-
|
|
31882
|
+
"input-value": _ctx.inputValue,
|
|
31883
|
+
"search-box-options": _ctx.searchBoxOptions,
|
|
31846
31884
|
onProductClick: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("product-click"))
|
|
31847
31885
|
}, createSlots({
|
|
31848
31886
|
default: withCtx(() => {
|
|
@@ -31865,7 +31903,7 @@ const _sfc_main$1g = /* @__PURE__ */ defineComponent({
|
|
|
31865
31903
|
]),
|
|
31866
31904
|
key: "0"
|
|
31867
31905
|
} : void 0
|
|
31868
|
-
]), 1032, ["items", "
|
|
31906
|
+
]), 1032, ["items", "panel-options", "labels", "input-value", "search-box-options"]);
|
|
31869
31907
|
};
|
|
31870
31908
|
}
|
|
31871
31909
|
});
|
|
@@ -32004,7 +32042,7 @@ const _sfc_main$1e = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValu
|
|
|
32004
32042
|
const panels = computed(() => props.options.panels);
|
|
32005
32043
|
const sdkOptions = computed(() => props.options.options);
|
|
32006
32044
|
const searchBoxStore = useSearchBoxStore();
|
|
32007
|
-
const { suggestionResults, hasAnyResults, panelItemCounts } = storeToRefs(searchBoxStore);
|
|
32045
|
+
const { suggestionResults, hasAnyResults, panelItemCounts, anyPanelLoading } = storeToRefs(searchBoxStore);
|
|
32008
32046
|
const emit2 = __emit;
|
|
32009
32047
|
const isSearchEmpty = computed(() => !props.inputValue || props.inputValue.length < 1);
|
|
32010
32048
|
const displayResults = computed(() => {
|
|
@@ -32192,7 +32230,7 @@ const _sfc_main$1e = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValu
|
|
|
32192
32230
|
], 14, _hoisted_1$12);
|
|
32193
32231
|
}), 128))
|
|
32194
32232
|
], 4),
|
|
32195
|
-
!unref(hasAnyResults) && _ctx.options.showNoResultsPanel ? (openBlock(), createBlock(_sfc_main$1E, {
|
|
32233
|
+
!unref(hasAnyResults) && _ctx.options.showNoResultsPanel && !unref(anyPanelLoading) ? (openBlock(), createBlock(_sfc_main$1E, {
|
|
32196
32234
|
key: 1,
|
|
32197
32235
|
options: _ctx.options
|
|
32198
32236
|
}, null, 8, ["options"])) : createCommentVNode("", true),
|
|
@@ -33374,7 +33412,7 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
|
|
|
33374
33412
|
facet: {},
|
|
33375
33413
|
currentFilters: {}
|
|
33376
33414
|
},
|
|
33377
|
-
emits: ["select"],
|
|
33415
|
+
emits: ["select", "showMoreClicked", "filterFocused"],
|
|
33378
33416
|
setup(__props, { emit: __emit }) {
|
|
33379
33417
|
const props = __props;
|
|
33380
33418
|
const searchResultStore = useSearchResultStore();
|
|
@@ -33438,6 +33476,9 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
|
|
|
33438
33476
|
};
|
|
33439
33477
|
const toggleShowAll = () => {
|
|
33440
33478
|
showAll.value = !showAll.value;
|
|
33479
|
+
if (showAll.value) {
|
|
33480
|
+
emit2("showMoreClicked", facet.value.key);
|
|
33481
|
+
}
|
|
33441
33482
|
};
|
|
33442
33483
|
const isChecked = (item) => {
|
|
33443
33484
|
var _a25, _b25;
|
|
@@ -33467,8 +33508,9 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
|
|
|
33467
33508
|
class: "lupa-term-filter",
|
|
33468
33509
|
"data-cy": "lupa-term-filter",
|
|
33469
33510
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => termFilter.value = $event),
|
|
33470
|
-
placeholder: _ctx.options.labels.facetFilter
|
|
33471
|
-
|
|
33511
|
+
placeholder: _ctx.options.labels.facetFilter,
|
|
33512
|
+
onFocus: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("filterFocused"))
|
|
33513
|
+
}, null, 40, _hoisted_2$E)), [
|
|
33472
33514
|
[vModelText, termFilter.value]
|
|
33473
33515
|
]) : createCommentVNode("", true),
|
|
33474
33516
|
createBaseVNode("div", _hoisted_3$u, [
|
|
@@ -35083,7 +35125,9 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
|
|
|
35083
35125
|
facet: facet.value,
|
|
35084
35126
|
currentFilters: currentFilters.value[facet.value.key],
|
|
35085
35127
|
options: _ctx.options,
|
|
35086
|
-
onSelect: handleFacetSelect
|
|
35128
|
+
onSelect: handleFacetSelect,
|
|
35129
|
+
onShowMoreClicked: handleFacetQueryFilter,
|
|
35130
|
+
onFilterFocused: handleFacetQueryFilter
|
|
35087
35131
|
}, null, 40, ["facet", "currentFilters", "options"])),
|
|
35088
35132
|
_ctx.clearable ? (openBlock(), createElementBlock("div", {
|
|
35089
35133
|
key: 0,
|
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("");
|
|
@@ -19535,6 +19536,12 @@ const useSearchBoxStore = /* @__PURE__ */ defineStore("searchBox", () => {
|
|
|
19535
19536
|
var _a25;
|
|
19536
19537
|
return ((_a25 = inputValue.value) == null ? void 0 : _a25.length) >= options.value.minInputLength;
|
|
19537
19538
|
});
|
|
19539
|
+
const setQueryKeyLoading = ({ queryKey, loading }) => {
|
|
19540
|
+
var _a25;
|
|
19541
|
+
loadingResultsByQueryKey.value = __spreadProps2(__spreadValues2({}, (_a25 = loadingResultsByQueryKey.value) != null ? _a25 : {}), {
|
|
19542
|
+
[queryKey]: loading
|
|
19543
|
+
});
|
|
19544
|
+
};
|
|
19538
19545
|
const panelItemCounts = computed(
|
|
19539
19546
|
() => options.value.panels.map((p2) => {
|
|
19540
19547
|
var _a25, _b25, _c, _d, _e;
|
|
@@ -19589,6 +19596,9 @@ const useSearchBoxStore = /* @__PURE__ */ defineStore("searchBox", () => {
|
|
|
19589
19596
|
title: panel.titleKey ? doc2[panel.titleKey] : ""
|
|
19590
19597
|
};
|
|
19591
19598
|
});
|
|
19599
|
+
const anyPanelLoading = computed(
|
|
19600
|
+
() => Object.values(loadingResultsByQueryKey.value).some((v) => v)
|
|
19601
|
+
);
|
|
19592
19602
|
const querySuggestions = (_0) => __async2(null, [_0], function* ({
|
|
19593
19603
|
queryKey,
|
|
19594
19604
|
publicQuery,
|
|
@@ -19599,6 +19609,7 @@ const useSearchBoxStore = /* @__PURE__ */ defineStore("searchBox", () => {
|
|
|
19599
19609
|
const currentRequestId = Date.now();
|
|
19600
19610
|
latestRequestIdByQueryKey[queryKey] = currentRequestId;
|
|
19601
19611
|
const context = getLupaTrackingContext();
|
|
19612
|
+
setQueryKeyLoading({ queryKey, loading: true });
|
|
19602
19613
|
const result2 = yield LupaSearchSdk.suggestions(
|
|
19603
19614
|
queryKey,
|
|
19604
19615
|
__spreadValues2(__spreadValues2({}, publicQuery), context),
|
|
@@ -19626,6 +19637,8 @@ const useSearchBoxStore = /* @__PURE__ */ defineStore("searchBox", () => {
|
|
|
19626
19637
|
options2.onError(err);
|
|
19627
19638
|
}
|
|
19628
19639
|
return { suggestions: void 0 };
|
|
19640
|
+
} finally {
|
|
19641
|
+
setQueryKeyLoading({ queryKey, loading: false });
|
|
19629
19642
|
}
|
|
19630
19643
|
});
|
|
19631
19644
|
const emitSearchResultsCallback = () => {
|
|
@@ -19649,6 +19662,7 @@ const useSearchBoxStore = /* @__PURE__ */ defineStore("searchBox", () => {
|
|
|
19649
19662
|
try {
|
|
19650
19663
|
const currentRequestId = Date.now();
|
|
19651
19664
|
latestRequestIdByQueryKey[queryKey] = currentRequestId;
|
|
19665
|
+
setQueryKeyLoading({ queryKey, loading: true });
|
|
19652
19666
|
const context = getLupaTrackingContext();
|
|
19653
19667
|
const result2 = yield LupaSearchSdk.query(queryKey, __spreadValues2(__spreadValues2({}, publicQuery), context), options2);
|
|
19654
19668
|
if (latestRequestIdByQueryKey[queryKey] !== currentRequestId) {
|
|
@@ -19667,6 +19681,8 @@ const useSearchBoxStore = /* @__PURE__ */ defineStore("searchBox", () => {
|
|
|
19667
19681
|
options2.onError(err);
|
|
19668
19682
|
}
|
|
19669
19683
|
return { queryKey, result: { items: [] } };
|
|
19684
|
+
} finally {
|
|
19685
|
+
setQueryKeyLoading({ queryKey, loading: false });
|
|
19670
19686
|
}
|
|
19671
19687
|
});
|
|
19672
19688
|
const highlightChange = ({ action }) => {
|
|
@@ -19697,12 +19713,14 @@ const useSearchBoxStore = /* @__PURE__ */ defineStore("searchBox", () => {
|
|
|
19697
19713
|
highlightedItem,
|
|
19698
19714
|
highlightedDocument,
|
|
19699
19715
|
hasAnyResults,
|
|
19716
|
+
anyPanelLoading,
|
|
19700
19717
|
querySuggestions,
|
|
19701
19718
|
queryDocuments,
|
|
19702
19719
|
highlightChange,
|
|
19703
19720
|
saveInputValue,
|
|
19704
19721
|
saveOptions,
|
|
19705
|
-
resetHighlightIndex
|
|
19722
|
+
resetHighlightIndex,
|
|
19723
|
+
setQueryKeyLoading
|
|
19706
19724
|
};
|
|
19707
19725
|
});
|
|
19708
19726
|
const Env = {
|
|
@@ -20590,7 +20608,9 @@ const _sfc_main$1C = /* @__PURE__ */ defineComponent({
|
|
|
20590
20608
|
items: {},
|
|
20591
20609
|
highlight: { type: Boolean },
|
|
20592
20610
|
queryKey: {},
|
|
20593
|
-
labels: {}
|
|
20611
|
+
labels: {},
|
|
20612
|
+
searchBoxOptions: {},
|
|
20613
|
+
panelOptions: {}
|
|
20594
20614
|
},
|
|
20595
20615
|
emits: ["suggestionSelect"],
|
|
20596
20616
|
setup(__props, { emit: __emit }) {
|
|
@@ -20605,7 +20625,7 @@ const _sfc_main$1C = /* @__PURE__ */ defineComponent({
|
|
|
20605
20625
|
});
|
|
20606
20626
|
const emit2 = __emit;
|
|
20607
20627
|
const searchBoxStore = useSearchBoxStore();
|
|
20608
|
-
const { highlightedItem } = storeToRefs(searchBoxStore);
|
|
20628
|
+
const { highlightedItem, anyPanelLoading } = storeToRefs(searchBoxStore);
|
|
20609
20629
|
const highlightedIndex = computed(() => {
|
|
20610
20630
|
var _a25, _b25, _c;
|
|
20611
20631
|
if (props.queryKey !== ((_a25 = highlightedItem.value) == null ? void 0 : _a25.queryKey)) {
|
|
@@ -20651,6 +20671,7 @@ const _sfc_main$1C = /* @__PURE__ */ defineComponent({
|
|
|
20651
20671
|
});
|
|
20652
20672
|
});
|
|
20653
20673
|
return (_ctx, _cache) => {
|
|
20674
|
+
var _a25, _b25, _c;
|
|
20654
20675
|
return openBlock(), createElementBlock("div", _hoisted_1$1k, [
|
|
20655
20676
|
(openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (item, index) => {
|
|
20656
20677
|
return openBlock(), createBlock(_sfc_main$1D, {
|
|
@@ -20666,7 +20687,11 @@ const _sfc_main$1C = /* @__PURE__ */ defineComponent({
|
|
|
20666
20687
|
"data-cy": "lupa-suggestion",
|
|
20667
20688
|
onSelect: handleSelect
|
|
20668
20689
|
}, null, 8, ["class", "suggestion", "highlight", "labels"]);
|
|
20669
|
-
}), 128))
|
|
20690
|
+
}), 128)),
|
|
20691
|
+
((_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, {
|
|
20692
|
+
key: 0,
|
|
20693
|
+
options: _ctx.searchBoxOptions
|
|
20694
|
+
}, null, 8, ["options"])) : createCommentVNode("", true)
|
|
20670
20695
|
]);
|
|
20671
20696
|
};
|
|
20672
20697
|
}
|
|
@@ -20689,6 +20714,7 @@ const _sfc_main$1B = /* @__PURE__ */ defineComponent({
|
|
|
20689
20714
|
__name: "SearchBoxSuggestionsWrapper",
|
|
20690
20715
|
props: {
|
|
20691
20716
|
panel: {},
|
|
20717
|
+
searchBoxOptions: {},
|
|
20692
20718
|
options: {},
|
|
20693
20719
|
inputValue: {},
|
|
20694
20720
|
debounce: {},
|
|
@@ -20706,9 +20732,11 @@ const _sfc_main$1B = /* @__PURE__ */ defineComponent({
|
|
|
20706
20732
|
return (_a25 = suggestionResults.value[props.panel.queryKey]) != null ? _a25 : [];
|
|
20707
20733
|
});
|
|
20708
20734
|
onMounted(() => {
|
|
20735
|
+
searchBoxStore.setQueryKeyLoading({ queryKey: props.panel.queryKey, loading: true });
|
|
20709
20736
|
getSuggestionsDebounced();
|
|
20710
20737
|
});
|
|
20711
20738
|
watch(inputValueProp, () => {
|
|
20739
|
+
searchBoxStore.setQueryKeyLoading({ queryKey: props.panel.queryKey, loading: true });
|
|
20712
20740
|
getSuggestionsDebounced();
|
|
20713
20741
|
});
|
|
20714
20742
|
const getSuggestions = () => {
|
|
@@ -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
|
};
|
|
@@ -31795,9 +31830,11 @@ const _sfc_main$1g = /* @__PURE__ */ defineComponent({
|
|
|
31795
31830
|
});
|
|
31796
31831
|
const inputValueProp = computed(() => props.inputValue);
|
|
31797
31832
|
onMounted(() => {
|
|
31833
|
+
searchBoxStore.setQueryKeyLoading({ queryKey: props.panel.queryKey, loading: true });
|
|
31798
31834
|
getItemsDebounced();
|
|
31799
31835
|
});
|
|
31800
31836
|
watch(inputValueProp, () => {
|
|
31837
|
+
searchBoxStore.setQueryKeyLoading({ queryKey: props.panel.queryKey, loading: true });
|
|
31801
31838
|
getItemsDebounced();
|
|
31802
31839
|
});
|
|
31803
31840
|
const enhancePanelData = () => __async2(null, null, function* () {
|
|
@@ -31838,9 +31875,10 @@ const _sfc_main$1g = /* @__PURE__ */ defineComponent({
|
|
|
31838
31875
|
var _a25, _b25;
|
|
31839
31876
|
return openBlock(), createBlock(_sfc_main$1i, {
|
|
31840
31877
|
items: (_b25 = (_a25 = searchResult.value) == null ? void 0 : _a25.items) != null ? _b25 : [],
|
|
31841
|
-
|
|
31878
|
+
"panel-options": _ctx.panel,
|
|
31842
31879
|
labels: _ctx.labels,
|
|
31843
|
-
|
|
31880
|
+
"input-value": _ctx.inputValue,
|
|
31881
|
+
"search-box-options": _ctx.searchBoxOptions,
|
|
31844
31882
|
onProductClick: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("product-click"))
|
|
31845
31883
|
}, createSlots({
|
|
31846
31884
|
default: withCtx(() => {
|
|
@@ -31863,7 +31901,7 @@ const _sfc_main$1g = /* @__PURE__ */ defineComponent({
|
|
|
31863
31901
|
]),
|
|
31864
31902
|
key: "0"
|
|
31865
31903
|
} : void 0
|
|
31866
|
-
]), 1032, ["items", "
|
|
31904
|
+
]), 1032, ["items", "panel-options", "labels", "input-value", "search-box-options"]);
|
|
31867
31905
|
};
|
|
31868
31906
|
}
|
|
31869
31907
|
});
|
|
@@ -32002,7 +32040,7 @@ const _sfc_main$1e = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValu
|
|
|
32002
32040
|
const panels = computed(() => props.options.panels);
|
|
32003
32041
|
const sdkOptions = computed(() => props.options.options);
|
|
32004
32042
|
const searchBoxStore = useSearchBoxStore();
|
|
32005
|
-
const { suggestionResults, hasAnyResults, panelItemCounts } = storeToRefs(searchBoxStore);
|
|
32043
|
+
const { suggestionResults, hasAnyResults, panelItemCounts, anyPanelLoading } = storeToRefs(searchBoxStore);
|
|
32006
32044
|
const emit2 = __emit;
|
|
32007
32045
|
const isSearchEmpty = computed(() => !props.inputValue || props.inputValue.length < 1);
|
|
32008
32046
|
const displayResults = computed(() => {
|
|
@@ -32190,7 +32228,7 @@ const _sfc_main$1e = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValu
|
|
|
32190
32228
|
], 14, _hoisted_1$12);
|
|
32191
32229
|
}), 128))
|
|
32192
32230
|
], 4),
|
|
32193
|
-
!unref(hasAnyResults) && _ctx.options.showNoResultsPanel ? (openBlock(), createBlock(_sfc_main$1E, {
|
|
32231
|
+
!unref(hasAnyResults) && _ctx.options.showNoResultsPanel && !unref(anyPanelLoading) ? (openBlock(), createBlock(_sfc_main$1E, {
|
|
32194
32232
|
key: 1,
|
|
32195
32233
|
options: _ctx.options
|
|
32196
32234
|
}, null, 8, ["options"])) : createCommentVNode("", true),
|
|
@@ -33372,7 +33410,7 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
|
|
|
33372
33410
|
facet: {},
|
|
33373
33411
|
currentFilters: {}
|
|
33374
33412
|
},
|
|
33375
|
-
emits: ["select"],
|
|
33413
|
+
emits: ["select", "showMoreClicked", "filterFocused"],
|
|
33376
33414
|
setup(__props, { emit: __emit }) {
|
|
33377
33415
|
const props = __props;
|
|
33378
33416
|
const searchResultStore = useSearchResultStore();
|
|
@@ -33436,6 +33474,9 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
|
|
|
33436
33474
|
};
|
|
33437
33475
|
const toggleShowAll = () => {
|
|
33438
33476
|
showAll.value = !showAll.value;
|
|
33477
|
+
if (showAll.value) {
|
|
33478
|
+
emit2("showMoreClicked", facet.value.key);
|
|
33479
|
+
}
|
|
33439
33480
|
};
|
|
33440
33481
|
const isChecked = (item) => {
|
|
33441
33482
|
var _a25, _b25;
|
|
@@ -33465,8 +33506,9 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
|
|
|
33465
33506
|
class: "lupa-term-filter",
|
|
33466
33507
|
"data-cy": "lupa-term-filter",
|
|
33467
33508
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => termFilter.value = $event),
|
|
33468
|
-
placeholder: _ctx.options.labels.facetFilter
|
|
33469
|
-
|
|
33509
|
+
placeholder: _ctx.options.labels.facetFilter,
|
|
33510
|
+
onFocus: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("filterFocused"))
|
|
33511
|
+
}, null, 40, _hoisted_2$E)), [
|
|
33470
33512
|
[vModelText, termFilter.value]
|
|
33471
33513
|
]) : createCommentVNode("", true),
|
|
33472
33514
|
createBaseVNode("div", _hoisted_3$u, [
|
|
@@ -35081,7 +35123,9 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
|
|
|
35081
35123
|
facet: facet.value,
|
|
35082
35124
|
currentFilters: currentFilters.value[facet.value.key],
|
|
35083
35125
|
options: _ctx.options,
|
|
35084
|
-
onSelect: handleFacetSelect
|
|
35126
|
+
onSelect: handleFacetSelect,
|
|
35127
|
+
onShowMoreClicked: handleFacetQueryFilter,
|
|
35128
|
+
onFilterFocused: handleFacetQueryFilter
|
|
35085
35129
|
}, null, 40, ["facet", "currentFilters", "options"])),
|
|
35086
35130
|
_ctx.clearable ? (openBlock(), createElementBlock("div", {
|
|
35087
35131
|
key: 0,
|
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("");
|
|
@@ -19539,6 +19540,12 @@ var __async = (__this, __arguments, generator) => {
|
|
|
19539
19540
|
var _a25;
|
|
19540
19541
|
return ((_a25 = inputValue.value) == null ? void 0 : _a25.length) >= options.value.minInputLength;
|
|
19541
19542
|
});
|
|
19543
|
+
const setQueryKeyLoading = ({ queryKey, loading }) => {
|
|
19544
|
+
var _a25;
|
|
19545
|
+
loadingResultsByQueryKey.value = __spreadProps2(__spreadValues2({}, (_a25 = loadingResultsByQueryKey.value) != null ? _a25 : {}), {
|
|
19546
|
+
[queryKey]: loading
|
|
19547
|
+
});
|
|
19548
|
+
};
|
|
19542
19549
|
const panelItemCounts = computed(
|
|
19543
19550
|
() => options.value.panels.map((p2) => {
|
|
19544
19551
|
var _a25, _b25, _c, _d, _e;
|
|
@@ -19593,6 +19600,9 @@ var __async = (__this, __arguments, generator) => {
|
|
|
19593
19600
|
title: panel.titleKey ? doc2[panel.titleKey] : ""
|
|
19594
19601
|
};
|
|
19595
19602
|
});
|
|
19603
|
+
const anyPanelLoading = computed(
|
|
19604
|
+
() => Object.values(loadingResultsByQueryKey.value).some((v) => v)
|
|
19605
|
+
);
|
|
19596
19606
|
const querySuggestions = (_0) => __async2(null, [_0], function* ({
|
|
19597
19607
|
queryKey,
|
|
19598
19608
|
publicQuery,
|
|
@@ -19603,6 +19613,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
19603
19613
|
const currentRequestId = Date.now();
|
|
19604
19614
|
latestRequestIdByQueryKey[queryKey] = currentRequestId;
|
|
19605
19615
|
const context = getLupaTrackingContext();
|
|
19616
|
+
setQueryKeyLoading({ queryKey, loading: true });
|
|
19606
19617
|
const result2 = yield LupaSearchSdk.suggestions(
|
|
19607
19618
|
queryKey,
|
|
19608
19619
|
__spreadValues2(__spreadValues2({}, publicQuery), context),
|
|
@@ -19630,6 +19641,8 @@ var __async = (__this, __arguments, generator) => {
|
|
|
19630
19641
|
options2.onError(err);
|
|
19631
19642
|
}
|
|
19632
19643
|
return { suggestions: void 0 };
|
|
19644
|
+
} finally {
|
|
19645
|
+
setQueryKeyLoading({ queryKey, loading: false });
|
|
19633
19646
|
}
|
|
19634
19647
|
});
|
|
19635
19648
|
const emitSearchResultsCallback = () => {
|
|
@@ -19653,6 +19666,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
19653
19666
|
try {
|
|
19654
19667
|
const currentRequestId = Date.now();
|
|
19655
19668
|
latestRequestIdByQueryKey[queryKey] = currentRequestId;
|
|
19669
|
+
setQueryKeyLoading({ queryKey, loading: true });
|
|
19656
19670
|
const context = getLupaTrackingContext();
|
|
19657
19671
|
const result2 = yield LupaSearchSdk.query(queryKey, __spreadValues2(__spreadValues2({}, publicQuery), context), options2);
|
|
19658
19672
|
if (latestRequestIdByQueryKey[queryKey] !== currentRequestId) {
|
|
@@ -19671,6 +19685,8 @@ var __async = (__this, __arguments, generator) => {
|
|
|
19671
19685
|
options2.onError(err);
|
|
19672
19686
|
}
|
|
19673
19687
|
return { queryKey, result: { items: [] } };
|
|
19688
|
+
} finally {
|
|
19689
|
+
setQueryKeyLoading({ queryKey, loading: false });
|
|
19674
19690
|
}
|
|
19675
19691
|
});
|
|
19676
19692
|
const highlightChange = ({ action }) => {
|
|
@@ -19701,12 +19717,14 @@ var __async = (__this, __arguments, generator) => {
|
|
|
19701
19717
|
highlightedItem,
|
|
19702
19718
|
highlightedDocument,
|
|
19703
19719
|
hasAnyResults,
|
|
19720
|
+
anyPanelLoading,
|
|
19704
19721
|
querySuggestions,
|
|
19705
19722
|
queryDocuments,
|
|
19706
19723
|
highlightChange,
|
|
19707
19724
|
saveInputValue,
|
|
19708
19725
|
saveOptions,
|
|
19709
|
-
resetHighlightIndex
|
|
19726
|
+
resetHighlightIndex,
|
|
19727
|
+
setQueryKeyLoading
|
|
19710
19728
|
};
|
|
19711
19729
|
});
|
|
19712
19730
|
const Env = {
|
|
@@ -20594,7 +20612,9 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20594
20612
|
items: {},
|
|
20595
20613
|
highlight: { type: Boolean },
|
|
20596
20614
|
queryKey: {},
|
|
20597
|
-
labels: {}
|
|
20615
|
+
labels: {},
|
|
20616
|
+
searchBoxOptions: {},
|
|
20617
|
+
panelOptions: {}
|
|
20598
20618
|
},
|
|
20599
20619
|
emits: ["suggestionSelect"],
|
|
20600
20620
|
setup(__props, { emit: __emit }) {
|
|
@@ -20609,7 +20629,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20609
20629
|
});
|
|
20610
20630
|
const emit2 = __emit;
|
|
20611
20631
|
const searchBoxStore = useSearchBoxStore();
|
|
20612
|
-
const { highlightedItem } = storeToRefs(searchBoxStore);
|
|
20632
|
+
const { highlightedItem, anyPanelLoading } = storeToRefs(searchBoxStore);
|
|
20613
20633
|
const highlightedIndex = computed(() => {
|
|
20614
20634
|
var _a25, _b25, _c;
|
|
20615
20635
|
if (props.queryKey !== ((_a25 = highlightedItem.value) == null ? void 0 : _a25.queryKey)) {
|
|
@@ -20655,6 +20675,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20655
20675
|
});
|
|
20656
20676
|
});
|
|
20657
20677
|
return (_ctx, _cache) => {
|
|
20678
|
+
var _a25, _b25, _c;
|
|
20658
20679
|
return openBlock(), createElementBlock("div", _hoisted_1$1k, [
|
|
20659
20680
|
(openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (item, index) => {
|
|
20660
20681
|
return openBlock(), createBlock(_sfc_main$1D, {
|
|
@@ -20670,7 +20691,11 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20670
20691
|
"data-cy": "lupa-suggestion",
|
|
20671
20692
|
onSelect: handleSelect
|
|
20672
20693
|
}, null, 8, ["class", "suggestion", "highlight", "labels"]);
|
|
20673
|
-
}), 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)
|
|
20674
20699
|
]);
|
|
20675
20700
|
};
|
|
20676
20701
|
}
|
|
@@ -20693,6 +20718,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20693
20718
|
__name: "SearchBoxSuggestionsWrapper",
|
|
20694
20719
|
props: {
|
|
20695
20720
|
panel: {},
|
|
20721
|
+
searchBoxOptions: {},
|
|
20696
20722
|
options: {},
|
|
20697
20723
|
inputValue: {},
|
|
20698
20724
|
debounce: {},
|
|
@@ -20710,9 +20736,11 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20710
20736
|
return (_a25 = suggestionResults.value[props.panel.queryKey]) != null ? _a25 : [];
|
|
20711
20737
|
});
|
|
20712
20738
|
onMounted(() => {
|
|
20739
|
+
searchBoxStore.setQueryKeyLoading({ queryKey: props.panel.queryKey, loading: true });
|
|
20713
20740
|
getSuggestionsDebounced();
|
|
20714
20741
|
});
|
|
20715
20742
|
watch(inputValueProp, () => {
|
|
20743
|
+
searchBoxStore.setQueryKeyLoading({ queryKey: props.panel.queryKey, loading: true });
|
|
20716
20744
|
getSuggestionsDebounced();
|
|
20717
20745
|
});
|
|
20718
20746
|
const getSuggestions = () => {
|
|
@@ -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
|
};
|
|
@@ -31799,9 +31834,11 @@ and ensure you are accounting for this risk.
|
|
|
31799
31834
|
});
|
|
31800
31835
|
const inputValueProp = computed(() => props.inputValue);
|
|
31801
31836
|
onMounted(() => {
|
|
31837
|
+
searchBoxStore.setQueryKeyLoading({ queryKey: props.panel.queryKey, loading: true });
|
|
31802
31838
|
getItemsDebounced();
|
|
31803
31839
|
});
|
|
31804
31840
|
watch(inputValueProp, () => {
|
|
31841
|
+
searchBoxStore.setQueryKeyLoading({ queryKey: props.panel.queryKey, loading: true });
|
|
31805
31842
|
getItemsDebounced();
|
|
31806
31843
|
});
|
|
31807
31844
|
const enhancePanelData = () => __async2(null, null, function* () {
|
|
@@ -31842,9 +31879,10 @@ and ensure you are accounting for this risk.
|
|
|
31842
31879
|
var _a25, _b25;
|
|
31843
31880
|
return openBlock(), createBlock(_sfc_main$1i, {
|
|
31844
31881
|
items: (_b25 = (_a25 = searchResult.value) == null ? void 0 : _a25.items) != null ? _b25 : [],
|
|
31845
|
-
|
|
31882
|
+
"panel-options": _ctx.panel,
|
|
31846
31883
|
labels: _ctx.labels,
|
|
31847
|
-
|
|
31884
|
+
"input-value": _ctx.inputValue,
|
|
31885
|
+
"search-box-options": _ctx.searchBoxOptions,
|
|
31848
31886
|
onProductClick: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("product-click"))
|
|
31849
31887
|
}, createSlots({
|
|
31850
31888
|
default: withCtx(() => {
|
|
@@ -31867,7 +31905,7 @@ and ensure you are accounting for this risk.
|
|
|
31867
31905
|
]),
|
|
31868
31906
|
key: "0"
|
|
31869
31907
|
} : void 0
|
|
31870
|
-
]), 1032, ["items", "
|
|
31908
|
+
]), 1032, ["items", "panel-options", "labels", "input-value", "search-box-options"]);
|
|
31871
31909
|
};
|
|
31872
31910
|
}
|
|
31873
31911
|
});
|
|
@@ -32006,7 +32044,7 @@ and ensure you are accounting for this risk.
|
|
|
32006
32044
|
const panels = computed(() => props.options.panels);
|
|
32007
32045
|
const sdkOptions = computed(() => props.options.options);
|
|
32008
32046
|
const searchBoxStore = useSearchBoxStore();
|
|
32009
|
-
const { suggestionResults, hasAnyResults, panelItemCounts } = storeToRefs(searchBoxStore);
|
|
32047
|
+
const { suggestionResults, hasAnyResults, panelItemCounts, anyPanelLoading } = storeToRefs(searchBoxStore);
|
|
32010
32048
|
const emit2 = __emit;
|
|
32011
32049
|
const isSearchEmpty = computed(() => !props.inputValue || props.inputValue.length < 1);
|
|
32012
32050
|
const displayResults = computed(() => {
|
|
@@ -32194,7 +32232,7 @@ and ensure you are accounting for this risk.
|
|
|
32194
32232
|
], 14, _hoisted_1$12);
|
|
32195
32233
|
}), 128))
|
|
32196
32234
|
], 4),
|
|
32197
|
-
!unref(hasAnyResults) && _ctx.options.showNoResultsPanel ? (openBlock(), createBlock(_sfc_main$1E, {
|
|
32235
|
+
!unref(hasAnyResults) && _ctx.options.showNoResultsPanel && !unref(anyPanelLoading) ? (openBlock(), createBlock(_sfc_main$1E, {
|
|
32198
32236
|
key: 1,
|
|
32199
32237
|
options: _ctx.options
|
|
32200
32238
|
}, null, 8, ["options"])) : createCommentVNode("", true),
|
|
@@ -33376,7 +33414,7 @@ and ensure you are accounting for this risk.
|
|
|
33376
33414
|
facet: {},
|
|
33377
33415
|
currentFilters: {}
|
|
33378
33416
|
},
|
|
33379
|
-
emits: ["select"],
|
|
33417
|
+
emits: ["select", "showMoreClicked", "filterFocused"],
|
|
33380
33418
|
setup(__props, { emit: __emit }) {
|
|
33381
33419
|
const props = __props;
|
|
33382
33420
|
const searchResultStore = useSearchResultStore();
|
|
@@ -33440,6 +33478,9 @@ and ensure you are accounting for this risk.
|
|
|
33440
33478
|
};
|
|
33441
33479
|
const toggleShowAll = () => {
|
|
33442
33480
|
showAll.value = !showAll.value;
|
|
33481
|
+
if (showAll.value) {
|
|
33482
|
+
emit2("showMoreClicked", facet.value.key);
|
|
33483
|
+
}
|
|
33443
33484
|
};
|
|
33444
33485
|
const isChecked = (item) => {
|
|
33445
33486
|
var _a25, _b25;
|
|
@@ -33469,8 +33510,9 @@ and ensure you are accounting for this risk.
|
|
|
33469
33510
|
class: "lupa-term-filter",
|
|
33470
33511
|
"data-cy": "lupa-term-filter",
|
|
33471
33512
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => termFilter.value = $event),
|
|
33472
|
-
placeholder: _ctx.options.labels.facetFilter
|
|
33473
|
-
|
|
33513
|
+
placeholder: _ctx.options.labels.facetFilter,
|
|
33514
|
+
onFocus: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("filterFocused"))
|
|
33515
|
+
}, null, 40, _hoisted_2$E)), [
|
|
33474
33516
|
[vModelText, termFilter.value]
|
|
33475
33517
|
]) : createCommentVNode("", true),
|
|
33476
33518
|
createBaseVNode("div", _hoisted_3$u, [
|
|
@@ -35085,7 +35127,9 @@ and ensure you are accounting for this risk.
|
|
|
35085
35127
|
facet: facet.value,
|
|
35086
35128
|
currentFilters: currentFilters.value[facet.value.key],
|
|
35087
35129
|
options: _ctx.options,
|
|
35088
|
-
onSelect: handleFacetSelect
|
|
35130
|
+
onSelect: handleFacetSelect,
|
|
35131
|
+
onShowMoreClicked: handleFacetQueryFilter,
|
|
35132
|
+
onFilterFocused: handleFacetQueryFilter
|
|
35089
35133
|
}, null, 40, ["facet", "currentFilters", "options"])),
|
|
35090
35134
|
_ctx.clearable ? (openBlock(), createElementBlock("div", {
|
|
35091
35135
|
key: 0,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getlupa/client",
|
|
3
|
-
"version": "1.26.
|
|
3
|
+
"version": "1.26.3",
|
|
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.1",
|
|
24
24
|
"@rushstack/eslint-patch": "^1.12.0",
|
|
25
25
|
"@tsconfig/node18": "^18.2.4",
|
|
26
26
|
"@types/jsdom": "^21.1.7",
|