@getlupa/client 0.6.0-alpha-13 → 0.6.0-alpha-16
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/cjs/components/search-results/filters/facets/FacetDisplay.vue.d.ts +9 -0
- package/dist/cjs/constants/global.const.d.ts +1 -1
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.min.js +122 -12
- package/dist/cjs/store/modules/searchResult.d.ts +5 -0
- package/dist/cjs/types/search-results/SearchResultsOptions.d.ts +5 -0
- package/dist/es/components/search-results/filters/facets/FacetDisplay.vue.d.ts +9 -0
- package/dist/es/constants/global.const.d.ts +1 -1
- package/dist/es/index.d.ts +2 -2
- package/dist/es/index.min.js +122 -12
- package/dist/es/store/modules/searchResult.d.ts +5 -0
- package/dist/es/types/search-results/SearchResultsOptions.d.ts +5 -0
- package/dist/iife/components/search-results/filters/facets/FacetDisplay.vue.d.ts +9 -0
- package/dist/iife/constants/global.const.d.ts +1 -1
- package/dist/iife/index.d.ts +2 -2
- package/dist/iife/index.min.js +1 -1
- package/dist/iife/store/modules/searchResult.d.ts +5 -0
- package/dist/iife/types/search-results/SearchResultsOptions.d.ts +5 -0
- package/package.json +1 -1
|
@@ -7,14 +7,23 @@ export default class FacetDisplay extends Vue {
|
|
|
7
7
|
facet: FacetResult;
|
|
8
8
|
currentFilters: FilterGroup;
|
|
9
9
|
clearable: boolean;
|
|
10
|
+
currentFilterKeys: string[];
|
|
10
11
|
isOpen: boolean;
|
|
11
12
|
get facetType(): string;
|
|
12
13
|
get hasItems(): boolean;
|
|
13
14
|
get hasFilter(): boolean;
|
|
15
|
+
get filterQueryKey(): string | undefined;
|
|
16
|
+
get activeFilterKeys(): string;
|
|
14
17
|
mounted(): void;
|
|
15
18
|
beforeDestroy(): void;
|
|
16
19
|
handleMouseClick(e: MouseEvent): void;
|
|
20
|
+
handleParamsChange(): void;
|
|
21
|
+
queryFacet: ({ queryKey, facetKey, }: {
|
|
22
|
+
queryKey: string;
|
|
23
|
+
facetKey: string;
|
|
24
|
+
}) => Promise<void>;
|
|
17
25
|
toggleFacet(): void;
|
|
26
|
+
handleFacetQueryFilter(): void;
|
|
18
27
|
handleFacetSelect(item: FacetAction): void;
|
|
19
28
|
clear(): void;
|
|
20
29
|
}
|
|
@@ -8,7 +8,7 @@ export declare const S_MIN_WIDTH = 575;
|
|
|
8
8
|
export declare const MD_MIN_WIDTH = 767;
|
|
9
9
|
export declare const L_MIN_WIDTH = 991;
|
|
10
10
|
export declare const XL_MIN_WIDTH = 1199;
|
|
11
|
-
export declare const MAX_FACET_VALUES =
|
|
11
|
+
export declare const MAX_FACET_VALUES = 5000;
|
|
12
12
|
export declare const CURRENCY_KEY_INDICATOR = "price";
|
|
13
13
|
export declare const DEFAULT_PAGE_SIZE = 12;
|
|
14
14
|
export declare const LUPA_ROUTING_EVENT = "lupaRedirect";
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SearchBoxOptions } from "./types/search-box/SearchBoxOptions";
|
|
2
|
-
import { CallbackContext, FacetStyle, SearchResultEventCallbacks, SearchResultsOptions } from "./types/search-results/SearchResultsOptions";
|
|
2
|
+
import { CallbackContext, FacetFilterQuery, FacetStyle, SearchResultEventCallbacks, SearchResultsOptions } from "./types/search-results/SearchResultsOptions";
|
|
3
3
|
import { SdkOptions, TrackingOptions, Environment, SortDirection } from "./types/General";
|
|
4
4
|
import { ProductListOptions } from "./types/product-list/ProductListOptions";
|
|
5
5
|
import { AddToCartElement, CustomDocumentElement, CustomHtmlElement, DescriptionDocumentElement, DocumentElement, DocumentElementType, ImageDocumentElement, PriceElement, RatingElement, RegularPriceDocumentElement, TitleDocumentElement } from "./types/DocumentElement";
|
|
@@ -17,5 +17,5 @@ declare const lupaSearch: {
|
|
|
17
17
|
clearSearchResults: () => void;
|
|
18
18
|
clearProductList: () => void;
|
|
19
19
|
};
|
|
20
|
-
export { TrackingOptions, SearchBoxOptions, SearchResultsOptions, ProductListOptions, SdkOptions, DocumentElementType, SearchBoxPanelType, FacetStyle, Environment, RoutingBehavior, AnchorPosition, BadgeType, SortDirection, DocumentElement, ImageDocumentElement, TitleDocumentElement, DescriptionDocumentElement, CustomDocumentElement, PriceElement, RegularPriceDocumentElement, RatingElement, AddToCartElement, CustomHtmlElement, SortOptions, SearchResultsSortOptions, SearchResultEventCallbacks, CallbackContext, };
|
|
20
|
+
export { TrackingOptions, SearchBoxOptions, SearchResultsOptions, ProductListOptions, SdkOptions, DocumentElementType, SearchBoxPanelType, FacetStyle, Environment, RoutingBehavior, AnchorPosition, BadgeType, SortDirection, DocumentElement, ImageDocumentElement, TitleDocumentElement, DescriptionDocumentElement, CustomDocumentElement, PriceElement, RegularPriceDocumentElement, RatingElement, AddToCartElement, CustomHtmlElement, SortOptions, SearchResultsSortOptions, SearchResultEventCallbacks, CallbackContext, FacetFilterQuery, };
|
|
21
21
|
export default lupaSearch;
|
package/dist/cjs/index.min.js
CHANGED
|
@@ -21676,7 +21676,7 @@ var S_MIN_WIDTH = 575;
|
|
|
21676
21676
|
var MD_MIN_WIDTH = 767;
|
|
21677
21677
|
var L_MIN_WIDTH = 991;
|
|
21678
21678
|
var XL_MIN_WIDTH = 1199;
|
|
21679
|
-
var MAX_FACET_VALUES =
|
|
21679
|
+
var MAX_FACET_VALUES = 5000;
|
|
21680
21680
|
var CURRENCY_KEY_INDICATOR = "price";
|
|
21681
21681
|
var DEFAULT_PAGE_SIZE = 12;
|
|
21682
21682
|
var LUPA_ROUTING_EVENT = "lupaRedirect";
|
|
@@ -25609,7 +25609,7 @@ var toggleHierarchyParam = function toggleHierarchyParam() {
|
|
|
25609
25609
|
return getMostSpecificHierarchyTerms([param].concat(_toConsumableArray(params)));
|
|
25610
25610
|
};
|
|
25611
25611
|
|
|
25612
|
-
var searchResult$
|
|
25612
|
+
var searchResult$i = namespace("searchResult");
|
|
25613
25613
|
var params$c = namespace("params");
|
|
25614
25614
|
var options$a = namespace("options");
|
|
25615
25615
|
|
|
@@ -25680,13 +25680,13 @@ __decorate([Prop({
|
|
|
25680
25680
|
default: false
|
|
25681
25681
|
})], CurrentFilters.prototype, "expandable", void 0);
|
|
25682
25682
|
|
|
25683
|
-
__decorate([searchResult$
|
|
25683
|
+
__decorate([searchResult$i.Getter("filters")], CurrentFilters.prototype, "currentFilters", void 0);
|
|
25684
25684
|
|
|
25685
|
-
__decorate([searchResult$
|
|
25685
|
+
__decorate([searchResult$i.Getter("facets")], CurrentFilters.prototype, "facets", void 0);
|
|
25686
25686
|
|
|
25687
|
-
__decorate([searchResult$
|
|
25687
|
+
__decorate([searchResult$i.Getter("displayFilters")], CurrentFilters.prototype, "displayFilters", void 0);
|
|
25688
25688
|
|
|
25689
|
-
__decorate([searchResult$
|
|
25689
|
+
__decorate([searchResult$i.Getter("currentFilterCount")], CurrentFilters.prototype, "currentFilterCount", void 0);
|
|
25690
25690
|
|
|
25691
25691
|
__decorate([options$a.Getter("initialFilters")], CurrentFilters.prototype, "initialFilters", void 0);
|
|
25692
25692
|
|
|
@@ -29317,6 +29317,8 @@ var __vue_component__$J = /*#__PURE__*/normalizeComponent({
|
|
|
29317
29317
|
staticRenderFns: __vue_staticRenderFns__$J
|
|
29318
29318
|
}, __vue_inject_styles__$J, __vue_script__$J, __vue_scope_id__$J, __vue_is_functional_template__$J, __vue_module_identifier__$J, false, undefined, undefined, undefined);
|
|
29319
29319
|
|
|
29320
|
+
var searchResult$h = namespace("searchResult");
|
|
29321
|
+
|
|
29320
29322
|
var FacetDisplay = /*#__PURE__*/function (_Vue) {
|
|
29321
29323
|
_inherits(FacetDisplay, _Vue);
|
|
29322
29324
|
|
|
@@ -29364,7 +29366,23 @@ var FacetDisplay = /*#__PURE__*/function (_Vue) {
|
|
|
29364
29366
|
}, {
|
|
29365
29367
|
key: "hasFilter",
|
|
29366
29368
|
get: function get() {
|
|
29367
|
-
|
|
29369
|
+
var _a;
|
|
29370
|
+
|
|
29371
|
+
return Boolean(((_a = this.currentFilters) !== null && _a !== void 0 ? _a : {})[this.facet.key]);
|
|
29372
|
+
}
|
|
29373
|
+
}, {
|
|
29374
|
+
key: "filterQueryKey",
|
|
29375
|
+
get: function get() {
|
|
29376
|
+
var _a, _b;
|
|
29377
|
+
|
|
29378
|
+
return (_b = (_a = this.options.facetFilterQueries) === null || _a === void 0 ? void 0 : _a[this.facet.key]) === null || _b === void 0 ? void 0 : _b.queryKey;
|
|
29379
|
+
}
|
|
29380
|
+
}, {
|
|
29381
|
+
key: "activeFilterKeys",
|
|
29382
|
+
get: function get() {
|
|
29383
|
+
var _a;
|
|
29384
|
+
|
|
29385
|
+
return ((_a = this.currentFilterKeys) !== null && _a !== void 0 ? _a : []).join(",");
|
|
29368
29386
|
}
|
|
29369
29387
|
}, {
|
|
29370
29388
|
key: "mounted",
|
|
@@ -29399,10 +29417,28 @@ var FacetDisplay = /*#__PURE__*/function (_Vue) {
|
|
|
29399
29417
|
this.isOpen = false;
|
|
29400
29418
|
}
|
|
29401
29419
|
}
|
|
29420
|
+
}, {
|
|
29421
|
+
key: "handleParamsChange",
|
|
29422
|
+
value: function handleParamsChange() {
|
|
29423
|
+
this.handleFacetQueryFilter();
|
|
29424
|
+
}
|
|
29402
29425
|
}, {
|
|
29403
29426
|
key: "toggleFacet",
|
|
29404
29427
|
value: function toggleFacet() {
|
|
29405
29428
|
this.isOpen = !this.isOpen;
|
|
29429
|
+
this.handleFacetQueryFilter();
|
|
29430
|
+
}
|
|
29431
|
+
}, {
|
|
29432
|
+
key: "handleFacetQueryFilter",
|
|
29433
|
+
value: function handleFacetQueryFilter() {
|
|
29434
|
+
if (!this.filterQueryKey || !this.isOpen) {
|
|
29435
|
+
return;
|
|
29436
|
+
}
|
|
29437
|
+
|
|
29438
|
+
this.queryFacet({
|
|
29439
|
+
queryKey: this.filterQueryKey,
|
|
29440
|
+
facetKey: this.facet.key
|
|
29441
|
+
});
|
|
29406
29442
|
}
|
|
29407
29443
|
}, {
|
|
29408
29444
|
key: "handleFacetSelect",
|
|
@@ -29438,6 +29474,12 @@ __decorate([Prop({
|
|
|
29438
29474
|
default: false
|
|
29439
29475
|
})], FacetDisplay.prototype, "clearable", void 0);
|
|
29440
29476
|
|
|
29477
|
+
__decorate([searchResult$h.Getter("currentFilterKeys")], FacetDisplay.prototype, "currentFilterKeys", void 0);
|
|
29478
|
+
|
|
29479
|
+
__decorate([Watch("activeFilterKeys")], FacetDisplay.prototype, "handleParamsChange", null);
|
|
29480
|
+
|
|
29481
|
+
__decorate([searchResult$h.Action("queryFacet")], FacetDisplay.prototype, "queryFacet", void 0);
|
|
29482
|
+
|
|
29441
29483
|
FacetDisplay = __decorate([Component({
|
|
29442
29484
|
name: "facetDisplay",
|
|
29443
29485
|
components: {
|
|
@@ -34811,6 +34853,8 @@ var SearchResults = /*#__PURE__*/function (_Vue) {
|
|
|
34811
34853
|
}, {
|
|
34812
34854
|
key: "mounted",
|
|
34813
34855
|
value: function mounted() {
|
|
34856
|
+
var _a, _b;
|
|
34857
|
+
|
|
34814
34858
|
window.addEventListener("resize", this.handleResize);
|
|
34815
34859
|
this.setSearchResultOptions({
|
|
34816
34860
|
options: this.options
|
|
@@ -34819,6 +34863,7 @@ var SearchResults = /*#__PURE__*/function (_Vue) {
|
|
|
34819
34863
|
this.setInitialFilters({
|
|
34820
34864
|
initialFilters: this.initialFilters
|
|
34821
34865
|
});
|
|
34866
|
+
(_b = (_a = this.options.callbacks) === null || _a === void 0 ? void 0 : _a.onMounted) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
34822
34867
|
}
|
|
34823
34868
|
}, {
|
|
34824
34869
|
key: "beforeDestroy",
|
|
@@ -36508,6 +36553,13 @@ var SearchResultModule = /*#__PURE__*/function (_VuexModule) {
|
|
|
36508
36553
|
|
|
36509
36554
|
return (_b = (_a = this.displayFilters) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
36510
36555
|
}
|
|
36556
|
+
}, {
|
|
36557
|
+
key: "currentFilterKeys",
|
|
36558
|
+
get: function get() {
|
|
36559
|
+
var _a;
|
|
36560
|
+
|
|
36561
|
+
return Object.keys((_a = this.currentFilters) !== null && _a !== void 0 ? _a : {});
|
|
36562
|
+
}
|
|
36511
36563
|
}, {
|
|
36512
36564
|
key: "hasAnyFilter",
|
|
36513
36565
|
get: function get() {
|
|
@@ -36562,6 +36614,62 @@ var SearchResultModule = /*#__PURE__*/function (_VuexModule) {
|
|
|
36562
36614
|
this.addToCartAmount = addToCartAmount || this.addToCartAmount;
|
|
36563
36615
|
this.layout = layout || this.layout;
|
|
36564
36616
|
}
|
|
36617
|
+
}, {
|
|
36618
|
+
key: "queryFacet",
|
|
36619
|
+
value: function queryFacet(_ref3) {
|
|
36620
|
+
var queryKey = _ref3.queryKey,
|
|
36621
|
+
facetKey = _ref3.facetKey;
|
|
36622
|
+
|
|
36623
|
+
var _a, _b, _c, _d, _e;
|
|
36624
|
+
|
|
36625
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee() {
|
|
36626
|
+
var query, options, result, facet, facetItems, updatedResult;
|
|
36627
|
+
return regenerator.wrap(function _callee$(_context) {
|
|
36628
|
+
while (1) {
|
|
36629
|
+
switch (_context.prev = _context.next) {
|
|
36630
|
+
case 0:
|
|
36631
|
+
query = {
|
|
36632
|
+
searchText: "",
|
|
36633
|
+
filters: Object.assign({}, this.currentFilters)
|
|
36634
|
+
};
|
|
36635
|
+
options = (_a = this.context.rootGetters["options/envOptions"]) !== null && _a !== void 0 ? _a : {};
|
|
36636
|
+
_context.next = 4;
|
|
36637
|
+
return getLupaSdk.query(queryKey, query, options);
|
|
36638
|
+
|
|
36639
|
+
case 4:
|
|
36640
|
+
result = _context.sent;
|
|
36641
|
+
|
|
36642
|
+
if (result.success) {
|
|
36643
|
+
_context.next = 7;
|
|
36644
|
+
break;
|
|
36645
|
+
}
|
|
36646
|
+
|
|
36647
|
+
return _context.abrupt("return");
|
|
36648
|
+
|
|
36649
|
+
case 7:
|
|
36650
|
+
facet = (_b = result.facets) === null || _b === void 0 ? void 0 : _b.find(function (f) {
|
|
36651
|
+
return f.key === facetKey;
|
|
36652
|
+
});
|
|
36653
|
+
facetItems = (_d = (_c = facet) === null || _c === void 0 ? void 0 : _c.items) !== null && _d !== void 0 ? _d : [];
|
|
36654
|
+
updatedResult = Object.assign(Object.assign({}, this.searchResult), {
|
|
36655
|
+
facets: (_e = this.facets) === null || _e === void 0 ? void 0 : _e.map(function (f) {
|
|
36656
|
+
return f.key === facetKey ? Object.assign(Object.assign({}, f), {
|
|
36657
|
+
items: facetItems
|
|
36658
|
+
}) : f;
|
|
36659
|
+
})
|
|
36660
|
+
});
|
|
36661
|
+
this.context.commit("save", {
|
|
36662
|
+
searchResult: updatedResult
|
|
36663
|
+
});
|
|
36664
|
+
|
|
36665
|
+
case 11:
|
|
36666
|
+
case "end":
|
|
36667
|
+
return _context.stop();
|
|
36668
|
+
}
|
|
36669
|
+
}
|
|
36670
|
+
}, _callee, this);
|
|
36671
|
+
}));
|
|
36672
|
+
}
|
|
36565
36673
|
}, {
|
|
36566
36674
|
key: "load",
|
|
36567
36675
|
value: function load(loading) {
|
|
@@ -36569,8 +36677,8 @@ var SearchResultModule = /*#__PURE__*/function (_VuexModule) {
|
|
|
36569
36677
|
}
|
|
36570
36678
|
}, {
|
|
36571
36679
|
key: "setScreenWidth",
|
|
36572
|
-
value: function setScreenWidth(
|
|
36573
|
-
var width =
|
|
36680
|
+
value: function setScreenWidth(_ref4) {
|
|
36681
|
+
var width = _ref4.width;
|
|
36574
36682
|
this.screenWidth = width;
|
|
36575
36683
|
}
|
|
36576
36684
|
}, {
|
|
@@ -36591,9 +36699,9 @@ var SearchResultModule = /*#__PURE__*/function (_VuexModule) {
|
|
|
36591
36699
|
}
|
|
36592
36700
|
}, {
|
|
36593
36701
|
key: "setColumnCount",
|
|
36594
|
-
value: function setColumnCount(
|
|
36595
|
-
var width =
|
|
36596
|
-
grid =
|
|
36702
|
+
value: function setColumnCount(_ref5) {
|
|
36703
|
+
var width = _ref5.width,
|
|
36704
|
+
grid = _ref5.grid;
|
|
36597
36705
|
|
|
36598
36706
|
if (!width || !grid) {
|
|
36599
36707
|
return {
|
|
@@ -36663,6 +36771,8 @@ __decorate([Mutation], SearchResultModule.prototype, "setSidebarVisibility", nul
|
|
|
36663
36771
|
|
|
36664
36772
|
__decorate([Mutation], SearchResultModule.prototype, "save", null);
|
|
36665
36773
|
|
|
36774
|
+
__decorate([Action], SearchResultModule.prototype, "queryFacet", null);
|
|
36775
|
+
|
|
36666
36776
|
__decorate([Mutation], SearchResultModule.prototype, "load", null);
|
|
36667
36777
|
|
|
36668
36778
|
__decorate([Mutation], SearchResultModule.prototype, "setScreenWidth", null);
|
|
@@ -21,6 +21,7 @@ export default class SearchResultModule extends VuexModule {
|
|
|
21
21
|
get labeledFilters(): LabeledFilter[];
|
|
22
22
|
get displayFilters(): LabeledFilter[];
|
|
23
23
|
get currentFilterCount(): number;
|
|
24
|
+
get currentFilterKeys(): string[];
|
|
24
25
|
get hasAnyFilter(): boolean;
|
|
25
26
|
get itemRange(): number[];
|
|
26
27
|
get isMobileWidth(): boolean;
|
|
@@ -34,6 +35,10 @@ export default class SearchResultModule extends VuexModule {
|
|
|
34
35
|
addToCartAmount?: number;
|
|
35
36
|
layout?: ResultsLayout;
|
|
36
37
|
}): void;
|
|
38
|
+
queryFacet({ queryKey, facetKey, }: {
|
|
39
|
+
queryKey: string;
|
|
40
|
+
facetKey: string;
|
|
41
|
+
}): Promise<void>;
|
|
37
42
|
load(loading: boolean): void;
|
|
38
43
|
setScreenWidth({ width }: {
|
|
39
44
|
width: number;
|
|
@@ -27,6 +27,7 @@ export declare type SearchResultEventCallbacks = {
|
|
|
27
27
|
onSearchResults?: (context: CallbackContext) => unknown;
|
|
28
28
|
onAdditionalPanelResults?: (context: CallbackContext) => unknown;
|
|
29
29
|
onCategoryFilterResults?: (context: CallbackContext) => unknown;
|
|
30
|
+
onMounted?: () => unknown;
|
|
30
31
|
};
|
|
31
32
|
export declare type SearchResultsOptionLabels = SearchResultsPaginationLabels & SearchResultsDidYouMeanLabels & SearchResultsSimilarQueriesLabels & {
|
|
32
33
|
sortBy: string;
|
|
@@ -108,6 +109,9 @@ export declare type ResultCurrentFilterOptions = {
|
|
|
108
109
|
};
|
|
109
110
|
};
|
|
110
111
|
export declare type FacetStyle = "sidebar" | "top-dropdown";
|
|
112
|
+
export declare type FacetFilterQuery = {
|
|
113
|
+
queryKey: string;
|
|
114
|
+
};
|
|
111
115
|
export declare type ResultFacetOptions = {
|
|
112
116
|
labels: {
|
|
113
117
|
title: string;
|
|
@@ -139,6 +143,7 @@ export declare type ResultFacetOptions = {
|
|
|
139
143
|
type: FacetStyle;
|
|
140
144
|
};
|
|
141
145
|
exclude?: string[];
|
|
146
|
+
facetFilterQueries?: Record<string, FacetFilterQuery>;
|
|
142
147
|
};
|
|
143
148
|
export declare type SearchResultsFilterOptions = {
|
|
144
149
|
currentFilters?: ResultCurrentFilterOptions;
|
|
@@ -7,14 +7,23 @@ export default class FacetDisplay extends Vue {
|
|
|
7
7
|
facet: FacetResult;
|
|
8
8
|
currentFilters: FilterGroup;
|
|
9
9
|
clearable: boolean;
|
|
10
|
+
currentFilterKeys: string[];
|
|
10
11
|
isOpen: boolean;
|
|
11
12
|
get facetType(): string;
|
|
12
13
|
get hasItems(): boolean;
|
|
13
14
|
get hasFilter(): boolean;
|
|
15
|
+
get filterQueryKey(): string | undefined;
|
|
16
|
+
get activeFilterKeys(): string;
|
|
14
17
|
mounted(): void;
|
|
15
18
|
beforeDestroy(): void;
|
|
16
19
|
handleMouseClick(e: MouseEvent): void;
|
|
20
|
+
handleParamsChange(): void;
|
|
21
|
+
queryFacet: ({ queryKey, facetKey, }: {
|
|
22
|
+
queryKey: string;
|
|
23
|
+
facetKey: string;
|
|
24
|
+
}) => Promise<void>;
|
|
17
25
|
toggleFacet(): void;
|
|
26
|
+
handleFacetQueryFilter(): void;
|
|
18
27
|
handleFacetSelect(item: FacetAction): void;
|
|
19
28
|
clear(): void;
|
|
20
29
|
}
|
|
@@ -8,7 +8,7 @@ export declare const S_MIN_WIDTH = 575;
|
|
|
8
8
|
export declare const MD_MIN_WIDTH = 767;
|
|
9
9
|
export declare const L_MIN_WIDTH = 991;
|
|
10
10
|
export declare const XL_MIN_WIDTH = 1199;
|
|
11
|
-
export declare const MAX_FACET_VALUES =
|
|
11
|
+
export declare const MAX_FACET_VALUES = 5000;
|
|
12
12
|
export declare const CURRENCY_KEY_INDICATOR = "price";
|
|
13
13
|
export declare const DEFAULT_PAGE_SIZE = 12;
|
|
14
14
|
export declare const LUPA_ROUTING_EVENT = "lupaRedirect";
|
package/dist/es/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SearchBoxOptions } from "./types/search-box/SearchBoxOptions";
|
|
2
|
-
import { CallbackContext, FacetStyle, SearchResultEventCallbacks, SearchResultsOptions } from "./types/search-results/SearchResultsOptions";
|
|
2
|
+
import { CallbackContext, FacetFilterQuery, FacetStyle, SearchResultEventCallbacks, SearchResultsOptions } from "./types/search-results/SearchResultsOptions";
|
|
3
3
|
import { SdkOptions, TrackingOptions, Environment, SortDirection } from "./types/General";
|
|
4
4
|
import { ProductListOptions } from "./types/product-list/ProductListOptions";
|
|
5
5
|
import { AddToCartElement, CustomDocumentElement, CustomHtmlElement, DescriptionDocumentElement, DocumentElement, DocumentElementType, ImageDocumentElement, PriceElement, RatingElement, RegularPriceDocumentElement, TitleDocumentElement } from "./types/DocumentElement";
|
|
@@ -17,5 +17,5 @@ declare const lupaSearch: {
|
|
|
17
17
|
clearSearchResults: () => void;
|
|
18
18
|
clearProductList: () => void;
|
|
19
19
|
};
|
|
20
|
-
export { TrackingOptions, SearchBoxOptions, SearchResultsOptions, ProductListOptions, SdkOptions, DocumentElementType, SearchBoxPanelType, FacetStyle, Environment, RoutingBehavior, AnchorPosition, BadgeType, SortDirection, DocumentElement, ImageDocumentElement, TitleDocumentElement, DescriptionDocumentElement, CustomDocumentElement, PriceElement, RegularPriceDocumentElement, RatingElement, AddToCartElement, CustomHtmlElement, SortOptions, SearchResultsSortOptions, SearchResultEventCallbacks, CallbackContext, };
|
|
20
|
+
export { TrackingOptions, SearchBoxOptions, SearchResultsOptions, ProductListOptions, SdkOptions, DocumentElementType, SearchBoxPanelType, FacetStyle, Environment, RoutingBehavior, AnchorPosition, BadgeType, SortDirection, DocumentElement, ImageDocumentElement, TitleDocumentElement, DescriptionDocumentElement, CustomDocumentElement, PriceElement, RegularPriceDocumentElement, RatingElement, AddToCartElement, CustomHtmlElement, SortOptions, SearchResultsSortOptions, SearchResultEventCallbacks, CallbackContext, FacetFilterQuery, };
|
|
21
21
|
export default lupaSearch;
|
package/dist/es/index.min.js
CHANGED
|
@@ -21672,7 +21672,7 @@ var S_MIN_WIDTH = 575;
|
|
|
21672
21672
|
var MD_MIN_WIDTH = 767;
|
|
21673
21673
|
var L_MIN_WIDTH = 991;
|
|
21674
21674
|
var XL_MIN_WIDTH = 1199;
|
|
21675
|
-
var MAX_FACET_VALUES =
|
|
21675
|
+
var MAX_FACET_VALUES = 5000;
|
|
21676
21676
|
var CURRENCY_KEY_INDICATOR = "price";
|
|
21677
21677
|
var DEFAULT_PAGE_SIZE = 12;
|
|
21678
21678
|
var LUPA_ROUTING_EVENT = "lupaRedirect";
|
|
@@ -25605,7 +25605,7 @@ var toggleHierarchyParam = function toggleHierarchyParam() {
|
|
|
25605
25605
|
return getMostSpecificHierarchyTerms([param].concat(_toConsumableArray(params)));
|
|
25606
25606
|
};
|
|
25607
25607
|
|
|
25608
|
-
var searchResult$
|
|
25608
|
+
var searchResult$i = namespace("searchResult");
|
|
25609
25609
|
var params$c = namespace("params");
|
|
25610
25610
|
var options$a = namespace("options");
|
|
25611
25611
|
|
|
@@ -25676,13 +25676,13 @@ __decorate([Prop({
|
|
|
25676
25676
|
default: false
|
|
25677
25677
|
})], CurrentFilters.prototype, "expandable", void 0);
|
|
25678
25678
|
|
|
25679
|
-
__decorate([searchResult$
|
|
25679
|
+
__decorate([searchResult$i.Getter("filters")], CurrentFilters.prototype, "currentFilters", void 0);
|
|
25680
25680
|
|
|
25681
|
-
__decorate([searchResult$
|
|
25681
|
+
__decorate([searchResult$i.Getter("facets")], CurrentFilters.prototype, "facets", void 0);
|
|
25682
25682
|
|
|
25683
|
-
__decorate([searchResult$
|
|
25683
|
+
__decorate([searchResult$i.Getter("displayFilters")], CurrentFilters.prototype, "displayFilters", void 0);
|
|
25684
25684
|
|
|
25685
|
-
__decorate([searchResult$
|
|
25685
|
+
__decorate([searchResult$i.Getter("currentFilterCount")], CurrentFilters.prototype, "currentFilterCount", void 0);
|
|
25686
25686
|
|
|
25687
25687
|
__decorate([options$a.Getter("initialFilters")], CurrentFilters.prototype, "initialFilters", void 0);
|
|
25688
25688
|
|
|
@@ -29313,6 +29313,8 @@ var __vue_component__$J = /*#__PURE__*/normalizeComponent({
|
|
|
29313
29313
|
staticRenderFns: __vue_staticRenderFns__$J
|
|
29314
29314
|
}, __vue_inject_styles__$J, __vue_script__$J, __vue_scope_id__$J, __vue_is_functional_template__$J, __vue_module_identifier__$J, false, undefined, undefined, undefined);
|
|
29315
29315
|
|
|
29316
|
+
var searchResult$h = namespace("searchResult");
|
|
29317
|
+
|
|
29316
29318
|
var FacetDisplay = /*#__PURE__*/function (_Vue) {
|
|
29317
29319
|
_inherits(FacetDisplay, _Vue);
|
|
29318
29320
|
|
|
@@ -29360,7 +29362,23 @@ var FacetDisplay = /*#__PURE__*/function (_Vue) {
|
|
|
29360
29362
|
}, {
|
|
29361
29363
|
key: "hasFilter",
|
|
29362
29364
|
get: function get() {
|
|
29363
|
-
|
|
29365
|
+
var _a;
|
|
29366
|
+
|
|
29367
|
+
return Boolean(((_a = this.currentFilters) !== null && _a !== void 0 ? _a : {})[this.facet.key]);
|
|
29368
|
+
}
|
|
29369
|
+
}, {
|
|
29370
|
+
key: "filterQueryKey",
|
|
29371
|
+
get: function get() {
|
|
29372
|
+
var _a, _b;
|
|
29373
|
+
|
|
29374
|
+
return (_b = (_a = this.options.facetFilterQueries) === null || _a === void 0 ? void 0 : _a[this.facet.key]) === null || _b === void 0 ? void 0 : _b.queryKey;
|
|
29375
|
+
}
|
|
29376
|
+
}, {
|
|
29377
|
+
key: "activeFilterKeys",
|
|
29378
|
+
get: function get() {
|
|
29379
|
+
var _a;
|
|
29380
|
+
|
|
29381
|
+
return ((_a = this.currentFilterKeys) !== null && _a !== void 0 ? _a : []).join(",");
|
|
29364
29382
|
}
|
|
29365
29383
|
}, {
|
|
29366
29384
|
key: "mounted",
|
|
@@ -29395,10 +29413,28 @@ var FacetDisplay = /*#__PURE__*/function (_Vue) {
|
|
|
29395
29413
|
this.isOpen = false;
|
|
29396
29414
|
}
|
|
29397
29415
|
}
|
|
29416
|
+
}, {
|
|
29417
|
+
key: "handleParamsChange",
|
|
29418
|
+
value: function handleParamsChange() {
|
|
29419
|
+
this.handleFacetQueryFilter();
|
|
29420
|
+
}
|
|
29398
29421
|
}, {
|
|
29399
29422
|
key: "toggleFacet",
|
|
29400
29423
|
value: function toggleFacet() {
|
|
29401
29424
|
this.isOpen = !this.isOpen;
|
|
29425
|
+
this.handleFacetQueryFilter();
|
|
29426
|
+
}
|
|
29427
|
+
}, {
|
|
29428
|
+
key: "handleFacetQueryFilter",
|
|
29429
|
+
value: function handleFacetQueryFilter() {
|
|
29430
|
+
if (!this.filterQueryKey || !this.isOpen) {
|
|
29431
|
+
return;
|
|
29432
|
+
}
|
|
29433
|
+
|
|
29434
|
+
this.queryFacet({
|
|
29435
|
+
queryKey: this.filterQueryKey,
|
|
29436
|
+
facetKey: this.facet.key
|
|
29437
|
+
});
|
|
29402
29438
|
}
|
|
29403
29439
|
}, {
|
|
29404
29440
|
key: "handleFacetSelect",
|
|
@@ -29434,6 +29470,12 @@ __decorate([Prop({
|
|
|
29434
29470
|
default: false
|
|
29435
29471
|
})], FacetDisplay.prototype, "clearable", void 0);
|
|
29436
29472
|
|
|
29473
|
+
__decorate([searchResult$h.Getter("currentFilterKeys")], FacetDisplay.prototype, "currentFilterKeys", void 0);
|
|
29474
|
+
|
|
29475
|
+
__decorate([Watch("activeFilterKeys")], FacetDisplay.prototype, "handleParamsChange", null);
|
|
29476
|
+
|
|
29477
|
+
__decorate([searchResult$h.Action("queryFacet")], FacetDisplay.prototype, "queryFacet", void 0);
|
|
29478
|
+
|
|
29437
29479
|
FacetDisplay = __decorate([Component({
|
|
29438
29480
|
name: "facetDisplay",
|
|
29439
29481
|
components: {
|
|
@@ -34807,6 +34849,8 @@ var SearchResults = /*#__PURE__*/function (_Vue) {
|
|
|
34807
34849
|
}, {
|
|
34808
34850
|
key: "mounted",
|
|
34809
34851
|
value: function mounted() {
|
|
34852
|
+
var _a, _b;
|
|
34853
|
+
|
|
34810
34854
|
window.addEventListener("resize", this.handleResize);
|
|
34811
34855
|
this.setSearchResultOptions({
|
|
34812
34856
|
options: this.options
|
|
@@ -34815,6 +34859,7 @@ var SearchResults = /*#__PURE__*/function (_Vue) {
|
|
|
34815
34859
|
this.setInitialFilters({
|
|
34816
34860
|
initialFilters: this.initialFilters
|
|
34817
34861
|
});
|
|
34862
|
+
(_b = (_a = this.options.callbacks) === null || _a === void 0 ? void 0 : _a.onMounted) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
34818
34863
|
}
|
|
34819
34864
|
}, {
|
|
34820
34865
|
key: "beforeDestroy",
|
|
@@ -36504,6 +36549,13 @@ var SearchResultModule = /*#__PURE__*/function (_VuexModule) {
|
|
|
36504
36549
|
|
|
36505
36550
|
return (_b = (_a = this.displayFilters) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
36506
36551
|
}
|
|
36552
|
+
}, {
|
|
36553
|
+
key: "currentFilterKeys",
|
|
36554
|
+
get: function get() {
|
|
36555
|
+
var _a;
|
|
36556
|
+
|
|
36557
|
+
return Object.keys((_a = this.currentFilters) !== null && _a !== void 0 ? _a : {});
|
|
36558
|
+
}
|
|
36507
36559
|
}, {
|
|
36508
36560
|
key: "hasAnyFilter",
|
|
36509
36561
|
get: function get() {
|
|
@@ -36558,6 +36610,62 @@ var SearchResultModule = /*#__PURE__*/function (_VuexModule) {
|
|
|
36558
36610
|
this.addToCartAmount = addToCartAmount || this.addToCartAmount;
|
|
36559
36611
|
this.layout = layout || this.layout;
|
|
36560
36612
|
}
|
|
36613
|
+
}, {
|
|
36614
|
+
key: "queryFacet",
|
|
36615
|
+
value: function queryFacet(_ref3) {
|
|
36616
|
+
var queryKey = _ref3.queryKey,
|
|
36617
|
+
facetKey = _ref3.facetKey;
|
|
36618
|
+
|
|
36619
|
+
var _a, _b, _c, _d, _e;
|
|
36620
|
+
|
|
36621
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee() {
|
|
36622
|
+
var query, options, result, facet, facetItems, updatedResult;
|
|
36623
|
+
return regenerator.wrap(function _callee$(_context) {
|
|
36624
|
+
while (1) {
|
|
36625
|
+
switch (_context.prev = _context.next) {
|
|
36626
|
+
case 0:
|
|
36627
|
+
query = {
|
|
36628
|
+
searchText: "",
|
|
36629
|
+
filters: Object.assign({}, this.currentFilters)
|
|
36630
|
+
};
|
|
36631
|
+
options = (_a = this.context.rootGetters["options/envOptions"]) !== null && _a !== void 0 ? _a : {};
|
|
36632
|
+
_context.next = 4;
|
|
36633
|
+
return getLupaSdk.query(queryKey, query, options);
|
|
36634
|
+
|
|
36635
|
+
case 4:
|
|
36636
|
+
result = _context.sent;
|
|
36637
|
+
|
|
36638
|
+
if (result.success) {
|
|
36639
|
+
_context.next = 7;
|
|
36640
|
+
break;
|
|
36641
|
+
}
|
|
36642
|
+
|
|
36643
|
+
return _context.abrupt("return");
|
|
36644
|
+
|
|
36645
|
+
case 7:
|
|
36646
|
+
facet = (_b = result.facets) === null || _b === void 0 ? void 0 : _b.find(function (f) {
|
|
36647
|
+
return f.key === facetKey;
|
|
36648
|
+
});
|
|
36649
|
+
facetItems = (_d = (_c = facet) === null || _c === void 0 ? void 0 : _c.items) !== null && _d !== void 0 ? _d : [];
|
|
36650
|
+
updatedResult = Object.assign(Object.assign({}, this.searchResult), {
|
|
36651
|
+
facets: (_e = this.facets) === null || _e === void 0 ? void 0 : _e.map(function (f) {
|
|
36652
|
+
return f.key === facetKey ? Object.assign(Object.assign({}, f), {
|
|
36653
|
+
items: facetItems
|
|
36654
|
+
}) : f;
|
|
36655
|
+
})
|
|
36656
|
+
});
|
|
36657
|
+
this.context.commit("save", {
|
|
36658
|
+
searchResult: updatedResult
|
|
36659
|
+
});
|
|
36660
|
+
|
|
36661
|
+
case 11:
|
|
36662
|
+
case "end":
|
|
36663
|
+
return _context.stop();
|
|
36664
|
+
}
|
|
36665
|
+
}
|
|
36666
|
+
}, _callee, this);
|
|
36667
|
+
}));
|
|
36668
|
+
}
|
|
36561
36669
|
}, {
|
|
36562
36670
|
key: "load",
|
|
36563
36671
|
value: function load(loading) {
|
|
@@ -36565,8 +36673,8 @@ var SearchResultModule = /*#__PURE__*/function (_VuexModule) {
|
|
|
36565
36673
|
}
|
|
36566
36674
|
}, {
|
|
36567
36675
|
key: "setScreenWidth",
|
|
36568
|
-
value: function setScreenWidth(
|
|
36569
|
-
var width =
|
|
36676
|
+
value: function setScreenWidth(_ref4) {
|
|
36677
|
+
var width = _ref4.width;
|
|
36570
36678
|
this.screenWidth = width;
|
|
36571
36679
|
}
|
|
36572
36680
|
}, {
|
|
@@ -36587,9 +36695,9 @@ var SearchResultModule = /*#__PURE__*/function (_VuexModule) {
|
|
|
36587
36695
|
}
|
|
36588
36696
|
}, {
|
|
36589
36697
|
key: "setColumnCount",
|
|
36590
|
-
value: function setColumnCount(
|
|
36591
|
-
var width =
|
|
36592
|
-
grid =
|
|
36698
|
+
value: function setColumnCount(_ref5) {
|
|
36699
|
+
var width = _ref5.width,
|
|
36700
|
+
grid = _ref5.grid;
|
|
36593
36701
|
|
|
36594
36702
|
if (!width || !grid) {
|
|
36595
36703
|
return {
|
|
@@ -36659,6 +36767,8 @@ __decorate([Mutation], SearchResultModule.prototype, "setSidebarVisibility", nul
|
|
|
36659
36767
|
|
|
36660
36768
|
__decorate([Mutation], SearchResultModule.prototype, "save", null);
|
|
36661
36769
|
|
|
36770
|
+
__decorate([Action], SearchResultModule.prototype, "queryFacet", null);
|
|
36771
|
+
|
|
36662
36772
|
__decorate([Mutation], SearchResultModule.prototype, "load", null);
|
|
36663
36773
|
|
|
36664
36774
|
__decorate([Mutation], SearchResultModule.prototype, "setScreenWidth", null);
|
|
@@ -21,6 +21,7 @@ export default class SearchResultModule extends VuexModule {
|
|
|
21
21
|
get labeledFilters(): LabeledFilter[];
|
|
22
22
|
get displayFilters(): LabeledFilter[];
|
|
23
23
|
get currentFilterCount(): number;
|
|
24
|
+
get currentFilterKeys(): string[];
|
|
24
25
|
get hasAnyFilter(): boolean;
|
|
25
26
|
get itemRange(): number[];
|
|
26
27
|
get isMobileWidth(): boolean;
|
|
@@ -34,6 +35,10 @@ export default class SearchResultModule extends VuexModule {
|
|
|
34
35
|
addToCartAmount?: number;
|
|
35
36
|
layout?: ResultsLayout;
|
|
36
37
|
}): void;
|
|
38
|
+
queryFacet({ queryKey, facetKey, }: {
|
|
39
|
+
queryKey: string;
|
|
40
|
+
facetKey: string;
|
|
41
|
+
}): Promise<void>;
|
|
37
42
|
load(loading: boolean): void;
|
|
38
43
|
setScreenWidth({ width }: {
|
|
39
44
|
width: number;
|
|
@@ -27,6 +27,7 @@ export declare type SearchResultEventCallbacks = {
|
|
|
27
27
|
onSearchResults?: (context: CallbackContext) => unknown;
|
|
28
28
|
onAdditionalPanelResults?: (context: CallbackContext) => unknown;
|
|
29
29
|
onCategoryFilterResults?: (context: CallbackContext) => unknown;
|
|
30
|
+
onMounted?: () => unknown;
|
|
30
31
|
};
|
|
31
32
|
export declare type SearchResultsOptionLabels = SearchResultsPaginationLabels & SearchResultsDidYouMeanLabels & SearchResultsSimilarQueriesLabels & {
|
|
32
33
|
sortBy: string;
|
|
@@ -108,6 +109,9 @@ export declare type ResultCurrentFilterOptions = {
|
|
|
108
109
|
};
|
|
109
110
|
};
|
|
110
111
|
export declare type FacetStyle = "sidebar" | "top-dropdown";
|
|
112
|
+
export declare type FacetFilterQuery = {
|
|
113
|
+
queryKey: string;
|
|
114
|
+
};
|
|
111
115
|
export declare type ResultFacetOptions = {
|
|
112
116
|
labels: {
|
|
113
117
|
title: string;
|
|
@@ -139,6 +143,7 @@ export declare type ResultFacetOptions = {
|
|
|
139
143
|
type: FacetStyle;
|
|
140
144
|
};
|
|
141
145
|
exclude?: string[];
|
|
146
|
+
facetFilterQueries?: Record<string, FacetFilterQuery>;
|
|
142
147
|
};
|
|
143
148
|
export declare type SearchResultsFilterOptions = {
|
|
144
149
|
currentFilters?: ResultCurrentFilterOptions;
|