@getlupa/client 0.6.0-alpha-13 → 0.6.0-alpha-14
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/index.d.ts +2 -2
- package/dist/cjs/index.min.js +118 -11
- package/dist/cjs/store/modules/searchResult.d.ts +5 -0
- package/dist/cjs/types/search-results/SearchResultsOptions.d.ts +4 -0
- package/dist/es/components/search-results/filters/facets/FacetDisplay.vue.d.ts +9 -0
- package/dist/es/index.d.ts +2 -2
- package/dist/es/index.min.js +118 -11
- package/dist/es/store/modules/searchResult.d.ts +5 -0
- package/dist/es/types/search-results/SearchResultsOptions.d.ts +4 -0
- package/dist/iife/components/search-results/filters/facets/FacetDisplay.vue.d.ts +9 -0
- 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 +4 -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
|
}
|
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
|
@@ -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: {
|
|
@@ -36508,6 +36550,13 @@ var SearchResultModule = /*#__PURE__*/function (_VuexModule) {
|
|
|
36508
36550
|
|
|
36509
36551
|
return (_b = (_a = this.displayFilters) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
36510
36552
|
}
|
|
36553
|
+
}, {
|
|
36554
|
+
key: "currentFilterKeys",
|
|
36555
|
+
get: function get() {
|
|
36556
|
+
var _a;
|
|
36557
|
+
|
|
36558
|
+
return Object.keys((_a = this.currentFilters) !== null && _a !== void 0 ? _a : {});
|
|
36559
|
+
}
|
|
36511
36560
|
}, {
|
|
36512
36561
|
key: "hasAnyFilter",
|
|
36513
36562
|
get: function get() {
|
|
@@ -36562,6 +36611,62 @@ var SearchResultModule = /*#__PURE__*/function (_VuexModule) {
|
|
|
36562
36611
|
this.addToCartAmount = addToCartAmount || this.addToCartAmount;
|
|
36563
36612
|
this.layout = layout || this.layout;
|
|
36564
36613
|
}
|
|
36614
|
+
}, {
|
|
36615
|
+
key: "queryFacet",
|
|
36616
|
+
value: function queryFacet(_ref3) {
|
|
36617
|
+
var queryKey = _ref3.queryKey,
|
|
36618
|
+
facetKey = _ref3.facetKey;
|
|
36619
|
+
|
|
36620
|
+
var _a, _b, _c, _d, _e;
|
|
36621
|
+
|
|
36622
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee() {
|
|
36623
|
+
var query, options, result, facet, facetItems, updatedResult;
|
|
36624
|
+
return regenerator.wrap(function _callee$(_context) {
|
|
36625
|
+
while (1) {
|
|
36626
|
+
switch (_context.prev = _context.next) {
|
|
36627
|
+
case 0:
|
|
36628
|
+
query = {
|
|
36629
|
+
searchText: "",
|
|
36630
|
+
filters: Object.assign({}, this.currentFilters)
|
|
36631
|
+
};
|
|
36632
|
+
options = (_a = this.context.rootGetters["options/envOptions"]) !== null && _a !== void 0 ? _a : {};
|
|
36633
|
+
_context.next = 4;
|
|
36634
|
+
return getLupaSdk.query(queryKey, query, options);
|
|
36635
|
+
|
|
36636
|
+
case 4:
|
|
36637
|
+
result = _context.sent;
|
|
36638
|
+
|
|
36639
|
+
if (result.success) {
|
|
36640
|
+
_context.next = 7;
|
|
36641
|
+
break;
|
|
36642
|
+
}
|
|
36643
|
+
|
|
36644
|
+
return _context.abrupt("return");
|
|
36645
|
+
|
|
36646
|
+
case 7:
|
|
36647
|
+
facet = (_b = result.facets) === null || _b === void 0 ? void 0 : _b.find(function (f) {
|
|
36648
|
+
return f.key === facetKey;
|
|
36649
|
+
});
|
|
36650
|
+
facetItems = (_d = (_c = facet) === null || _c === void 0 ? void 0 : _c.items) !== null && _d !== void 0 ? _d : [];
|
|
36651
|
+
updatedResult = Object.assign(Object.assign({}, this.searchResult), {
|
|
36652
|
+
facets: (_e = this.facets) === null || _e === void 0 ? void 0 : _e.map(function (f) {
|
|
36653
|
+
return f.key === facetKey ? Object.assign(Object.assign({}, f), {
|
|
36654
|
+
items: facetItems
|
|
36655
|
+
}) : f;
|
|
36656
|
+
})
|
|
36657
|
+
});
|
|
36658
|
+
this.context.commit("save", {
|
|
36659
|
+
searchResult: updatedResult
|
|
36660
|
+
});
|
|
36661
|
+
|
|
36662
|
+
case 11:
|
|
36663
|
+
case "end":
|
|
36664
|
+
return _context.stop();
|
|
36665
|
+
}
|
|
36666
|
+
}
|
|
36667
|
+
}, _callee, this);
|
|
36668
|
+
}));
|
|
36669
|
+
}
|
|
36565
36670
|
}, {
|
|
36566
36671
|
key: "load",
|
|
36567
36672
|
value: function load(loading) {
|
|
@@ -36569,8 +36674,8 @@ var SearchResultModule = /*#__PURE__*/function (_VuexModule) {
|
|
|
36569
36674
|
}
|
|
36570
36675
|
}, {
|
|
36571
36676
|
key: "setScreenWidth",
|
|
36572
|
-
value: function setScreenWidth(
|
|
36573
|
-
var width =
|
|
36677
|
+
value: function setScreenWidth(_ref4) {
|
|
36678
|
+
var width = _ref4.width;
|
|
36574
36679
|
this.screenWidth = width;
|
|
36575
36680
|
}
|
|
36576
36681
|
}, {
|
|
@@ -36591,9 +36696,9 @@ var SearchResultModule = /*#__PURE__*/function (_VuexModule) {
|
|
|
36591
36696
|
}
|
|
36592
36697
|
}, {
|
|
36593
36698
|
key: "setColumnCount",
|
|
36594
|
-
value: function setColumnCount(
|
|
36595
|
-
var width =
|
|
36596
|
-
grid =
|
|
36699
|
+
value: function setColumnCount(_ref5) {
|
|
36700
|
+
var width = _ref5.width,
|
|
36701
|
+
grid = _ref5.grid;
|
|
36597
36702
|
|
|
36598
36703
|
if (!width || !grid) {
|
|
36599
36704
|
return {
|
|
@@ -36663,6 +36768,8 @@ __decorate([Mutation], SearchResultModule.prototype, "setSidebarVisibility", nul
|
|
|
36663
36768
|
|
|
36664
36769
|
__decorate([Mutation], SearchResultModule.prototype, "save", null);
|
|
36665
36770
|
|
|
36771
|
+
__decorate([Action], SearchResultModule.prototype, "queryFacet", null);
|
|
36772
|
+
|
|
36666
36773
|
__decorate([Mutation], SearchResultModule.prototype, "load", null);
|
|
36667
36774
|
|
|
36668
36775
|
__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;
|
|
@@ -108,6 +108,9 @@ export declare type ResultCurrentFilterOptions = {
|
|
|
108
108
|
};
|
|
109
109
|
};
|
|
110
110
|
export declare type FacetStyle = "sidebar" | "top-dropdown";
|
|
111
|
+
export declare type FacetFilterQuery = {
|
|
112
|
+
queryKey: string;
|
|
113
|
+
};
|
|
111
114
|
export declare type ResultFacetOptions = {
|
|
112
115
|
labels: {
|
|
113
116
|
title: string;
|
|
@@ -139,6 +142,7 @@ export declare type ResultFacetOptions = {
|
|
|
139
142
|
type: FacetStyle;
|
|
140
143
|
};
|
|
141
144
|
exclude?: string[];
|
|
145
|
+
facetFilterQueries?: Record<string, FacetFilterQuery>;
|
|
142
146
|
};
|
|
143
147
|
export declare type SearchResultsFilterOptions = {
|
|
144
148
|
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
|
}
|
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
|
@@ -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: {
|
|
@@ -36504,6 +36546,13 @@ var SearchResultModule = /*#__PURE__*/function (_VuexModule) {
|
|
|
36504
36546
|
|
|
36505
36547
|
return (_b = (_a = this.displayFilters) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
36506
36548
|
}
|
|
36549
|
+
}, {
|
|
36550
|
+
key: "currentFilterKeys",
|
|
36551
|
+
get: function get() {
|
|
36552
|
+
var _a;
|
|
36553
|
+
|
|
36554
|
+
return Object.keys((_a = this.currentFilters) !== null && _a !== void 0 ? _a : {});
|
|
36555
|
+
}
|
|
36507
36556
|
}, {
|
|
36508
36557
|
key: "hasAnyFilter",
|
|
36509
36558
|
get: function get() {
|
|
@@ -36558,6 +36607,62 @@ var SearchResultModule = /*#__PURE__*/function (_VuexModule) {
|
|
|
36558
36607
|
this.addToCartAmount = addToCartAmount || this.addToCartAmount;
|
|
36559
36608
|
this.layout = layout || this.layout;
|
|
36560
36609
|
}
|
|
36610
|
+
}, {
|
|
36611
|
+
key: "queryFacet",
|
|
36612
|
+
value: function queryFacet(_ref3) {
|
|
36613
|
+
var queryKey = _ref3.queryKey,
|
|
36614
|
+
facetKey = _ref3.facetKey;
|
|
36615
|
+
|
|
36616
|
+
var _a, _b, _c, _d, _e;
|
|
36617
|
+
|
|
36618
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee() {
|
|
36619
|
+
var query, options, result, facet, facetItems, updatedResult;
|
|
36620
|
+
return regenerator.wrap(function _callee$(_context) {
|
|
36621
|
+
while (1) {
|
|
36622
|
+
switch (_context.prev = _context.next) {
|
|
36623
|
+
case 0:
|
|
36624
|
+
query = {
|
|
36625
|
+
searchText: "",
|
|
36626
|
+
filters: Object.assign({}, this.currentFilters)
|
|
36627
|
+
};
|
|
36628
|
+
options = (_a = this.context.rootGetters["options/envOptions"]) !== null && _a !== void 0 ? _a : {};
|
|
36629
|
+
_context.next = 4;
|
|
36630
|
+
return getLupaSdk.query(queryKey, query, options);
|
|
36631
|
+
|
|
36632
|
+
case 4:
|
|
36633
|
+
result = _context.sent;
|
|
36634
|
+
|
|
36635
|
+
if (result.success) {
|
|
36636
|
+
_context.next = 7;
|
|
36637
|
+
break;
|
|
36638
|
+
}
|
|
36639
|
+
|
|
36640
|
+
return _context.abrupt("return");
|
|
36641
|
+
|
|
36642
|
+
case 7:
|
|
36643
|
+
facet = (_b = result.facets) === null || _b === void 0 ? void 0 : _b.find(function (f) {
|
|
36644
|
+
return f.key === facetKey;
|
|
36645
|
+
});
|
|
36646
|
+
facetItems = (_d = (_c = facet) === null || _c === void 0 ? void 0 : _c.items) !== null && _d !== void 0 ? _d : [];
|
|
36647
|
+
updatedResult = Object.assign(Object.assign({}, this.searchResult), {
|
|
36648
|
+
facets: (_e = this.facets) === null || _e === void 0 ? void 0 : _e.map(function (f) {
|
|
36649
|
+
return f.key === facetKey ? Object.assign(Object.assign({}, f), {
|
|
36650
|
+
items: facetItems
|
|
36651
|
+
}) : f;
|
|
36652
|
+
})
|
|
36653
|
+
});
|
|
36654
|
+
this.context.commit("save", {
|
|
36655
|
+
searchResult: updatedResult
|
|
36656
|
+
});
|
|
36657
|
+
|
|
36658
|
+
case 11:
|
|
36659
|
+
case "end":
|
|
36660
|
+
return _context.stop();
|
|
36661
|
+
}
|
|
36662
|
+
}
|
|
36663
|
+
}, _callee, this);
|
|
36664
|
+
}));
|
|
36665
|
+
}
|
|
36561
36666
|
}, {
|
|
36562
36667
|
key: "load",
|
|
36563
36668
|
value: function load(loading) {
|
|
@@ -36565,8 +36670,8 @@ var SearchResultModule = /*#__PURE__*/function (_VuexModule) {
|
|
|
36565
36670
|
}
|
|
36566
36671
|
}, {
|
|
36567
36672
|
key: "setScreenWidth",
|
|
36568
|
-
value: function setScreenWidth(
|
|
36569
|
-
var width =
|
|
36673
|
+
value: function setScreenWidth(_ref4) {
|
|
36674
|
+
var width = _ref4.width;
|
|
36570
36675
|
this.screenWidth = width;
|
|
36571
36676
|
}
|
|
36572
36677
|
}, {
|
|
@@ -36587,9 +36692,9 @@ var SearchResultModule = /*#__PURE__*/function (_VuexModule) {
|
|
|
36587
36692
|
}
|
|
36588
36693
|
}, {
|
|
36589
36694
|
key: "setColumnCount",
|
|
36590
|
-
value: function setColumnCount(
|
|
36591
|
-
var width =
|
|
36592
|
-
grid =
|
|
36695
|
+
value: function setColumnCount(_ref5) {
|
|
36696
|
+
var width = _ref5.width,
|
|
36697
|
+
grid = _ref5.grid;
|
|
36593
36698
|
|
|
36594
36699
|
if (!width || !grid) {
|
|
36595
36700
|
return {
|
|
@@ -36659,6 +36764,8 @@ __decorate([Mutation], SearchResultModule.prototype, "setSidebarVisibility", nul
|
|
|
36659
36764
|
|
|
36660
36765
|
__decorate([Mutation], SearchResultModule.prototype, "save", null);
|
|
36661
36766
|
|
|
36767
|
+
__decorate([Action], SearchResultModule.prototype, "queryFacet", null);
|
|
36768
|
+
|
|
36662
36769
|
__decorate([Mutation], SearchResultModule.prototype, "load", null);
|
|
36663
36770
|
|
|
36664
36771
|
__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;
|
|
@@ -108,6 +108,9 @@ export declare type ResultCurrentFilterOptions = {
|
|
|
108
108
|
};
|
|
109
109
|
};
|
|
110
110
|
export declare type FacetStyle = "sidebar" | "top-dropdown";
|
|
111
|
+
export declare type FacetFilterQuery = {
|
|
112
|
+
queryKey: string;
|
|
113
|
+
};
|
|
111
114
|
export declare type ResultFacetOptions = {
|
|
112
115
|
labels: {
|
|
113
116
|
title: string;
|
|
@@ -139,6 +142,7 @@ export declare type ResultFacetOptions = {
|
|
|
139
142
|
type: FacetStyle;
|
|
140
143
|
};
|
|
141
144
|
exclude?: string[];
|
|
145
|
+
facetFilterQueries?: Record<string, FacetFilterQuery>;
|
|
142
146
|
};
|
|
143
147
|
export declare type SearchResultsFilterOptions = {
|
|
144
148
|
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
|
}
|
package/dist/iife/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;
|