@getlupa/client 0.5.1-alpha-11 → 0.5.1-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-box/products/SearchBoxProduct.vue.d.ts +3 -1
- package/dist/cjs/components/search-results/SearchResults.vue.d.ts +6 -0
- package/dist/cjs/index.min.js +92 -59
- package/dist/cjs/store/modules/params.d.ts +4 -0
- package/dist/es/components/search-box/products/SearchBoxProduct.vue.d.ts +3 -1
- package/dist/es/components/search-results/SearchResults.vue.d.ts +6 -0
- package/dist/es/index.min.js +92 -59
- package/dist/es/store/modules/params.d.ts +4 -0
- package/dist/iife/components/search-box/products/SearchBoxProduct.vue.d.ts +3 -1
- package/dist/iife/components/search-results/SearchResults.vue.d.ts +6 -0
- package/dist/iife/index.min.js +1 -1
- package/dist/iife/store/modules/params.d.ts +4 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -4,12 +4,14 @@ import { DocumentSearchBoxPanel } from "@/types/search-box/SearchBoxPanel";
|
|
|
4
4
|
import { SearchBoxOptionLabels } from "@/types/search-box/SearchBoxOptions";
|
|
5
5
|
import { DocumentElement } from "@/types/DocumentElement";
|
|
6
6
|
import { TrackableEventData } from "@/types/search-box/Common";
|
|
7
|
+
import { RoutingBehavior } from "@/types/search-results/RoutingBehavior";
|
|
7
8
|
export default class SearchBoxProduct extends Vue {
|
|
8
9
|
item: Document;
|
|
9
10
|
inputValue: string;
|
|
10
11
|
panelOptions: DocumentSearchBoxPanel;
|
|
11
12
|
labels?: SearchBoxOptionLabels;
|
|
12
13
|
highlighted?: boolean;
|
|
14
|
+
boxRoutingBehavior: RoutingBehavior;
|
|
13
15
|
trackClick: ({ queryKey, data, }: {
|
|
14
16
|
queryKey: string;
|
|
15
17
|
data: TrackableEventData;
|
|
@@ -21,5 +23,5 @@ export default class SearchBoxProduct extends Vue {
|
|
|
21
23
|
get imageElements(): DocumentElement[];
|
|
22
24
|
get detailElements(): DocumentElement[];
|
|
23
25
|
get id(): string;
|
|
24
|
-
handleClick(): void;
|
|
26
|
+
handleClick(event?: Event): void;
|
|
25
27
|
}
|
|
@@ -8,6 +8,8 @@ export default class SearchResults extends Vue {
|
|
|
8
8
|
isProductList: boolean;
|
|
9
9
|
get productsOptions(): SearchResultsProductOptions;
|
|
10
10
|
currentQueryText: string;
|
|
11
|
+
hasResults: boolean;
|
|
12
|
+
currentFilterCount: number;
|
|
11
13
|
get didYouMeanLabels(): SearchResultsDidYouMeanLabels;
|
|
12
14
|
get showFilterSidebar(): boolean;
|
|
13
15
|
get isTitleResultTopPosition(): boolean;
|
|
@@ -23,6 +25,10 @@ export default class SearchResults extends Vue {
|
|
|
23
25
|
setDefaultLimit: (defaultLimit: number) => {
|
|
24
26
|
defaultLimit: number;
|
|
25
27
|
};
|
|
28
|
+
handleNoResultsFlag: ({ resultCount, noResultsParam, }: {
|
|
29
|
+
resultCount: number;
|
|
30
|
+
noResultsParam?: string;
|
|
31
|
+
}) => void;
|
|
26
32
|
addParams: (params: QueryParams) => {
|
|
27
33
|
params: QueryParams;
|
|
28
34
|
};
|
package/dist/cjs/index.min.js
CHANGED
|
@@ -19712,8 +19712,36 @@ var linksMatch = function linksMatch(link1, link2) {
|
|
|
19712
19712
|
return link1 === link2 || getRelativePath(link1) === getRelativePath(link2);
|
|
19713
19713
|
};
|
|
19714
19714
|
|
|
19715
|
+
var emitRoutingEvent = function emitRoutingEvent(url) {
|
|
19716
|
+
var event = new CustomEvent(LUPA_ROUTING_EVENT, {
|
|
19717
|
+
detail: url
|
|
19718
|
+
});
|
|
19719
|
+
window.dispatchEvent(event);
|
|
19720
|
+
};
|
|
19721
|
+
var handleRoutingEvent = function handleRoutingEvent(link, event) {
|
|
19722
|
+
var hasEventRouting = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
19723
|
+
|
|
19724
|
+
if (!hasEventRouting) {
|
|
19725
|
+
return;
|
|
19726
|
+
}
|
|
19727
|
+
|
|
19728
|
+
event === null || event === void 0 ? void 0 : event.preventDefault();
|
|
19729
|
+
emitRoutingEvent(link);
|
|
19730
|
+
};
|
|
19731
|
+
var redirectToResultsPage = function redirectToResultsPage(link, searchText, facet) {
|
|
19732
|
+
var routingBehavior = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "direct-link";
|
|
19733
|
+
var url = generateResultLink(link, searchText, facet);
|
|
19734
|
+
|
|
19735
|
+
if (routingBehavior === "event") {
|
|
19736
|
+
emitRoutingEvent(url);
|
|
19737
|
+
} else {
|
|
19738
|
+
window.location.assign(url);
|
|
19739
|
+
}
|
|
19740
|
+
};
|
|
19741
|
+
|
|
19715
19742
|
var history$3 = namespace("history");
|
|
19716
19743
|
var tracking$5 = namespace("tracking");
|
|
19744
|
+
var options$9 = namespace("options");
|
|
19717
19745
|
|
|
19718
19746
|
var SearchBoxProduct = /*#__PURE__*/function (_Vue) {
|
|
19719
19747
|
_inherits(SearchBoxProduct, _Vue);
|
|
@@ -19762,7 +19790,7 @@ var SearchBoxProduct = /*#__PURE__*/function (_Vue) {
|
|
|
19762
19790
|
}
|
|
19763
19791
|
}, {
|
|
19764
19792
|
key: "handleClick",
|
|
19765
|
-
value: function handleClick() {
|
|
19793
|
+
value: function handleClick(event) {
|
|
19766
19794
|
if (this.panelOptions.titleKey) {
|
|
19767
19795
|
this.addHistory({
|
|
19768
19796
|
item: this.item[this.panelOptions.titleKey] || ""
|
|
@@ -19785,6 +19813,12 @@ var SearchBoxProduct = /*#__PURE__*/function (_Vue) {
|
|
|
19785
19813
|
}
|
|
19786
19814
|
}
|
|
19787
19815
|
});
|
|
19816
|
+
|
|
19817
|
+
if (!this.link) {
|
|
19818
|
+
return;
|
|
19819
|
+
}
|
|
19820
|
+
|
|
19821
|
+
handleRoutingEvent(this.link, event, this.boxRoutingBehavior === "event");
|
|
19788
19822
|
}
|
|
19789
19823
|
}]);
|
|
19790
19824
|
|
|
@@ -19805,6 +19839,8 @@ __decorate([Prop({
|
|
|
19805
19839
|
default: false
|
|
19806
19840
|
})], SearchBoxProduct.prototype, "highlighted", void 0);
|
|
19807
19841
|
|
|
19842
|
+
__decorate([options$9.Getter("boxRoutingBehavior")], SearchBoxProduct.prototype, "boxRoutingBehavior", void 0);
|
|
19843
|
+
|
|
19808
19844
|
__decorate([tracking$5.Action("track")], SearchBoxProduct.prototype, "trackClick", void 0);
|
|
19809
19845
|
|
|
19810
19846
|
__decorate([history$3.Action("add")], SearchBoxProduct.prototype, "addHistory", void 0);
|
|
@@ -27438,33 +27474,6 @@ var __vue_component__$G = /*#__PURE__*/normalizeComponent({
|
|
|
27438
27474
|
staticRenderFns: __vue_staticRenderFns__$G
|
|
27439
27475
|
}, __vue_inject_styles__$G, __vue_script__$G, __vue_scope_id__$G, __vue_is_functional_template__$G, __vue_module_identifier__$G, false, undefined, undefined, undefined);
|
|
27440
27476
|
|
|
27441
|
-
var emitRoutingEvent = function emitRoutingEvent(url) {
|
|
27442
|
-
var event = new CustomEvent(LUPA_ROUTING_EVENT, {
|
|
27443
|
-
detail: url
|
|
27444
|
-
});
|
|
27445
|
-
window.dispatchEvent(event);
|
|
27446
|
-
};
|
|
27447
|
-
var handleRoutingEvent = function handleRoutingEvent(link, event) {
|
|
27448
|
-
var hasEventRouting = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
27449
|
-
|
|
27450
|
-
if (!hasEventRouting) {
|
|
27451
|
-
return;
|
|
27452
|
-
}
|
|
27453
|
-
|
|
27454
|
-
event === null || event === void 0 ? void 0 : event.preventDefault();
|
|
27455
|
-
emitRoutingEvent(link);
|
|
27456
|
-
};
|
|
27457
|
-
var redirectToResultsPage = function redirectToResultsPage(link, searchText, facet) {
|
|
27458
|
-
var routingBehavior = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "direct-link";
|
|
27459
|
-
var url = generateResultLink(link, searchText, facet);
|
|
27460
|
-
|
|
27461
|
-
if (routingBehavior === "event") {
|
|
27462
|
-
emitRoutingEvent(url);
|
|
27463
|
-
} else {
|
|
27464
|
-
window.location.assign(url);
|
|
27465
|
-
}
|
|
27466
|
-
};
|
|
27467
|
-
|
|
27468
27477
|
var CategoryFilterItem = /*#__PURE__*/function (_Vue) {
|
|
27469
27478
|
_inherits(CategoryFilterItem, _Vue);
|
|
27470
27479
|
|
|
@@ -27846,6 +27855,7 @@ var __vue_render__$D = function __vue_render__() {
|
|
|
27846
27855
|
var _c = _vm._self._c || _h;
|
|
27847
27856
|
|
|
27848
27857
|
return _c("div", {
|
|
27858
|
+
staticClass: "lupa-search-result-filters",
|
|
27849
27859
|
attrs: {
|
|
27850
27860
|
id: "lupa-search-result-filters"
|
|
27851
27861
|
}
|
|
@@ -29872,6 +29882,7 @@ var __vue_render__$m = function __vue_render__() {
|
|
|
29872
29882
|
var _c = _vm._self._c || _h;
|
|
29873
29883
|
|
|
29874
29884
|
return _c("div", {
|
|
29885
|
+
staticClass: "lupa-search-result-product-card",
|
|
29875
29886
|
class: !_vm.isInStock ? "lupa-out-of-stock" : "",
|
|
29876
29887
|
attrs: {
|
|
29877
29888
|
id: "lupa-search-result-product-card",
|
|
@@ -30840,6 +30851,7 @@ var __vue_render__$h = function __vue_render__() {
|
|
|
30840
30851
|
var _c = _vm._self._c || _h;
|
|
30841
30852
|
|
|
30842
30853
|
return _c("div", {
|
|
30854
|
+
staticClass: "lupa-search-results-sort",
|
|
30843
30855
|
attrs: {
|
|
30844
30856
|
id: "lupa-search-results-sort"
|
|
30845
30857
|
}
|
|
@@ -31762,6 +31774,7 @@ var __vue_render__$9 = function __vue_render__() {
|
|
|
31762
31774
|
var _c = _vm._self._c || _h;
|
|
31763
31775
|
|
|
31764
31776
|
return _c("div", {
|
|
31777
|
+
staticClass: "lupa-search-result-filters",
|
|
31765
31778
|
attrs: {
|
|
31766
31779
|
id: "lupa-search-result-filters"
|
|
31767
31780
|
}
|
|
@@ -32385,7 +32398,7 @@ var SearchResults = /*#__PURE__*/function (_Vue) {
|
|
|
32385
32398
|
get: function get() {
|
|
32386
32399
|
var _a, _b, _c;
|
|
32387
32400
|
|
|
32388
|
-
return ((_c = (_b = (_a = this.options.filters) === null || _a === void 0 ? void 0 : _a.facets) === null || _b === void 0 ? void 0 : _b.style) === null || _c === void 0 ? void 0 : _c.type) === "sidebar";
|
|
32401
|
+
return ((_c = (_b = (_a = this.options.filters) === null || _a === void 0 ? void 0 : _a.facets) === null || _b === void 0 ? void 0 : _b.style) === null || _c === void 0 ? void 0 : _c.type) === "sidebar" && (this.hasResults || this.currentFilterCount > 0);
|
|
32389
32402
|
}
|
|
32390
32403
|
}, {
|
|
32391
32404
|
key: "isTitleResultTopPosition",
|
|
@@ -32477,30 +32490,17 @@ var SearchResults = /*#__PURE__*/function (_Vue) {
|
|
|
32477
32490
|
value: function handleResults(_ref) {
|
|
32478
32491
|
var queryKey = _ref.queryKey,
|
|
32479
32492
|
results = _ref.results;
|
|
32493
|
+
|
|
32494
|
+
var _a;
|
|
32495
|
+
|
|
32480
32496
|
this.trackResults({
|
|
32481
32497
|
queryKey: queryKey,
|
|
32482
32498
|
results: results
|
|
32483
32499
|
});
|
|
32484
|
-
|
|
32485
|
-
|
|
32486
|
-
|
|
32487
|
-
|
|
32488
|
-
}
|
|
32489
|
-
|
|
32490
|
-
if (results.total < 1) {
|
|
32491
|
-
this.appendParams({
|
|
32492
|
-
params: [{
|
|
32493
|
-
name: noResultsParam,
|
|
32494
|
-
value: "true"
|
|
32495
|
-
}],
|
|
32496
|
-
save: false
|
|
32497
|
-
});
|
|
32498
|
-
} else {
|
|
32499
|
-
this.removeParams({
|
|
32500
|
-
paramsToRemove: [noResultsParam],
|
|
32501
|
-
save: false
|
|
32502
|
-
});
|
|
32503
|
-
}
|
|
32500
|
+
this.handleNoResultsFlag({
|
|
32501
|
+
resultCount: (_a = results === null || results === void 0 ? void 0 : results.total) !== null && _a !== void 0 ? _a : 0,
|
|
32502
|
+
noResultsParam: this.options.noResultsQueryFlag
|
|
32503
|
+
});
|
|
32504
32504
|
}
|
|
32505
32505
|
}, {
|
|
32506
32506
|
key: "handleResize",
|
|
@@ -32531,6 +32531,10 @@ __decorate([Prop({
|
|
|
32531
32531
|
|
|
32532
32532
|
__decorate([searchResult$1.Getter("currentQueryText")], SearchResults.prototype, "currentQueryText", void 0);
|
|
32533
32533
|
|
|
32534
|
+
__decorate([searchResult$1.Getter("hasResults")], SearchResults.prototype, "hasResults", void 0);
|
|
32535
|
+
|
|
32536
|
+
__decorate([searchResult$1.Getter("currentFilterCount")], SearchResults.prototype, "currentFilterCount", void 0);
|
|
32537
|
+
|
|
32534
32538
|
__decorate([tracking$2.Action("trackSearch")], SearchResults.prototype, "trackSearch", void 0);
|
|
32535
32539
|
|
|
32536
32540
|
__decorate([tracking$2.Action("trackResults")], SearchResults.prototype, "trackResults", void 0);
|
|
@@ -32539,6 +32543,8 @@ __decorate([params$1.State("searchString")], SearchResults.prototype, "searchStr
|
|
|
32539
32543
|
|
|
32540
32544
|
__decorate([params$1.Action("setDefaultLimit")], SearchResults.prototype, "setDefaultLimit", void 0);
|
|
32541
32545
|
|
|
32546
|
+
__decorate([params$1.Action("handleNoResultsFlag")], SearchResults.prototype, "handleNoResultsFlag", void 0);
|
|
32547
|
+
|
|
32542
32548
|
__decorate([params$1.Action("add")], SearchResults.prototype, "addParams", void 0);
|
|
32543
32549
|
|
|
32544
32550
|
__decorate([params$1.Action("removeParams")], SearchResults.prototype, "removeParams", void 0);
|
|
@@ -34341,11 +34347,36 @@ var ParamsModule = /*#__PURE__*/function (_VuexModule) {
|
|
|
34341
34347
|
searchString: url.search
|
|
34342
34348
|
} : {};
|
|
34343
34349
|
}
|
|
34350
|
+
}, {
|
|
34351
|
+
key: "handleNoResultsFlag",
|
|
34352
|
+
value: function handleNoResultsFlag(_ref3) {
|
|
34353
|
+
var resultCount = _ref3.resultCount,
|
|
34354
|
+
noResultsParam = _ref3.noResultsParam;
|
|
34355
|
+
|
|
34356
|
+
if (!noResultsParam || this.searchResultsLink && this.searchResultsLink !== window.location.pathname) {
|
|
34357
|
+
return;
|
|
34358
|
+
}
|
|
34359
|
+
|
|
34360
|
+
if (resultCount < 1) {
|
|
34361
|
+
this.context.dispatch("appendParams", {
|
|
34362
|
+
params: [{
|
|
34363
|
+
name: noResultsParam,
|
|
34364
|
+
value: "true"
|
|
34365
|
+
}],
|
|
34366
|
+
save: false
|
|
34367
|
+
});
|
|
34368
|
+
} else {
|
|
34369
|
+
this.context.dispatch("removeParams", {
|
|
34370
|
+
paramsToRemove: [noResultsParam],
|
|
34371
|
+
save: false
|
|
34372
|
+
});
|
|
34373
|
+
}
|
|
34374
|
+
}
|
|
34344
34375
|
}, {
|
|
34345
34376
|
key: "goToResults",
|
|
34346
|
-
value: function goToResults(
|
|
34347
|
-
var searchText =
|
|
34348
|
-
facet =
|
|
34377
|
+
value: function goToResults(_ref4) {
|
|
34378
|
+
var searchText = _ref4.searchText,
|
|
34379
|
+
facet = _ref4.facet;
|
|
34349
34380
|
|
|
34350
34381
|
var _a;
|
|
34351
34382
|
|
|
@@ -34376,13 +34407,13 @@ var ParamsModule = /*#__PURE__*/function (_VuexModule) {
|
|
|
34376
34407
|
}
|
|
34377
34408
|
}, {
|
|
34378
34409
|
key: "appendParams",
|
|
34379
|
-
value: function appendParams(
|
|
34380
|
-
var params =
|
|
34381
|
-
paramsToRemove =
|
|
34382
|
-
|
|
34383
|
-
encode =
|
|
34384
|
-
|
|
34385
|
-
save =
|
|
34410
|
+
value: function appendParams(_ref5) {
|
|
34411
|
+
var params = _ref5.params,
|
|
34412
|
+
paramsToRemove = _ref5.paramsToRemove,
|
|
34413
|
+
_ref5$encode = _ref5.encode,
|
|
34414
|
+
encode = _ref5$encode === void 0 ? true : _ref5$encode,
|
|
34415
|
+
_ref5$save = _ref5.save,
|
|
34416
|
+
save = _ref5$save === void 0 ? true : _ref5$save;
|
|
34386
34417
|
|
|
34387
34418
|
if (!(params === null || params === void 0 ? void 0 : params.length)) {
|
|
34388
34419
|
return {
|
|
@@ -34449,6 +34480,8 @@ __decorate([Action({
|
|
|
34449
34480
|
commit: "save"
|
|
34450
34481
|
})], ParamsModule.prototype, "removeParams", null);
|
|
34451
34482
|
|
|
34483
|
+
__decorate([Action({})], ParamsModule.prototype, "handleNoResultsFlag", null);
|
|
34484
|
+
|
|
34452
34485
|
__decorate([Action({})], ParamsModule.prototype, "goToResults", null);
|
|
34453
34486
|
|
|
34454
34487
|
__decorate([Action({
|
|
@@ -32,6 +32,10 @@ export default class ParamsModule extends VuexModule {
|
|
|
32
32
|
params?: QueryParams;
|
|
33
33
|
searchString?: string;
|
|
34
34
|
};
|
|
35
|
+
handleNoResultsFlag({ resultCount, noResultsParam, }: {
|
|
36
|
+
resultCount: number;
|
|
37
|
+
noResultsParam?: string;
|
|
38
|
+
}): void;
|
|
35
39
|
goToResults({ searchText, facet, }: {
|
|
36
40
|
searchText: string;
|
|
37
41
|
facet?: InputSuggestionFacet;
|
|
@@ -4,12 +4,14 @@ import { DocumentSearchBoxPanel } from "@/types/search-box/SearchBoxPanel";
|
|
|
4
4
|
import { SearchBoxOptionLabels } from "@/types/search-box/SearchBoxOptions";
|
|
5
5
|
import { DocumentElement } from "@/types/DocumentElement";
|
|
6
6
|
import { TrackableEventData } from "@/types/search-box/Common";
|
|
7
|
+
import { RoutingBehavior } from "@/types/search-results/RoutingBehavior";
|
|
7
8
|
export default class SearchBoxProduct extends Vue {
|
|
8
9
|
item: Document;
|
|
9
10
|
inputValue: string;
|
|
10
11
|
panelOptions: DocumentSearchBoxPanel;
|
|
11
12
|
labels?: SearchBoxOptionLabels;
|
|
12
13
|
highlighted?: boolean;
|
|
14
|
+
boxRoutingBehavior: RoutingBehavior;
|
|
13
15
|
trackClick: ({ queryKey, data, }: {
|
|
14
16
|
queryKey: string;
|
|
15
17
|
data: TrackableEventData;
|
|
@@ -21,5 +23,5 @@ export default class SearchBoxProduct extends Vue {
|
|
|
21
23
|
get imageElements(): DocumentElement[];
|
|
22
24
|
get detailElements(): DocumentElement[];
|
|
23
25
|
get id(): string;
|
|
24
|
-
handleClick(): void;
|
|
26
|
+
handleClick(event?: Event): void;
|
|
25
27
|
}
|
|
@@ -8,6 +8,8 @@ export default class SearchResults extends Vue {
|
|
|
8
8
|
isProductList: boolean;
|
|
9
9
|
get productsOptions(): SearchResultsProductOptions;
|
|
10
10
|
currentQueryText: string;
|
|
11
|
+
hasResults: boolean;
|
|
12
|
+
currentFilterCount: number;
|
|
11
13
|
get didYouMeanLabels(): SearchResultsDidYouMeanLabels;
|
|
12
14
|
get showFilterSidebar(): boolean;
|
|
13
15
|
get isTitleResultTopPosition(): boolean;
|
|
@@ -23,6 +25,10 @@ export default class SearchResults extends Vue {
|
|
|
23
25
|
setDefaultLimit: (defaultLimit: number) => {
|
|
24
26
|
defaultLimit: number;
|
|
25
27
|
};
|
|
28
|
+
handleNoResultsFlag: ({ resultCount, noResultsParam, }: {
|
|
29
|
+
resultCount: number;
|
|
30
|
+
noResultsParam?: string;
|
|
31
|
+
}) => void;
|
|
26
32
|
addParams: (params: QueryParams) => {
|
|
27
33
|
params: QueryParams;
|
|
28
34
|
};
|
package/dist/es/index.min.js
CHANGED
|
@@ -19708,8 +19708,36 @@ var linksMatch = function linksMatch(link1, link2) {
|
|
|
19708
19708
|
return link1 === link2 || getRelativePath(link1) === getRelativePath(link2);
|
|
19709
19709
|
};
|
|
19710
19710
|
|
|
19711
|
+
var emitRoutingEvent = function emitRoutingEvent(url) {
|
|
19712
|
+
var event = new CustomEvent(LUPA_ROUTING_EVENT, {
|
|
19713
|
+
detail: url
|
|
19714
|
+
});
|
|
19715
|
+
window.dispatchEvent(event);
|
|
19716
|
+
};
|
|
19717
|
+
var handleRoutingEvent = function handleRoutingEvent(link, event) {
|
|
19718
|
+
var hasEventRouting = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
19719
|
+
|
|
19720
|
+
if (!hasEventRouting) {
|
|
19721
|
+
return;
|
|
19722
|
+
}
|
|
19723
|
+
|
|
19724
|
+
event === null || event === void 0 ? void 0 : event.preventDefault();
|
|
19725
|
+
emitRoutingEvent(link);
|
|
19726
|
+
};
|
|
19727
|
+
var redirectToResultsPage = function redirectToResultsPage(link, searchText, facet) {
|
|
19728
|
+
var routingBehavior = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "direct-link";
|
|
19729
|
+
var url = generateResultLink(link, searchText, facet);
|
|
19730
|
+
|
|
19731
|
+
if (routingBehavior === "event") {
|
|
19732
|
+
emitRoutingEvent(url);
|
|
19733
|
+
} else {
|
|
19734
|
+
window.location.assign(url);
|
|
19735
|
+
}
|
|
19736
|
+
};
|
|
19737
|
+
|
|
19711
19738
|
var history$3 = namespace("history");
|
|
19712
19739
|
var tracking$5 = namespace("tracking");
|
|
19740
|
+
var options$9 = namespace("options");
|
|
19713
19741
|
|
|
19714
19742
|
var SearchBoxProduct = /*#__PURE__*/function (_Vue) {
|
|
19715
19743
|
_inherits(SearchBoxProduct, _Vue);
|
|
@@ -19758,7 +19786,7 @@ var SearchBoxProduct = /*#__PURE__*/function (_Vue) {
|
|
|
19758
19786
|
}
|
|
19759
19787
|
}, {
|
|
19760
19788
|
key: "handleClick",
|
|
19761
|
-
value: function handleClick() {
|
|
19789
|
+
value: function handleClick(event) {
|
|
19762
19790
|
if (this.panelOptions.titleKey) {
|
|
19763
19791
|
this.addHistory({
|
|
19764
19792
|
item: this.item[this.panelOptions.titleKey] || ""
|
|
@@ -19781,6 +19809,12 @@ var SearchBoxProduct = /*#__PURE__*/function (_Vue) {
|
|
|
19781
19809
|
}
|
|
19782
19810
|
}
|
|
19783
19811
|
});
|
|
19812
|
+
|
|
19813
|
+
if (!this.link) {
|
|
19814
|
+
return;
|
|
19815
|
+
}
|
|
19816
|
+
|
|
19817
|
+
handleRoutingEvent(this.link, event, this.boxRoutingBehavior === "event");
|
|
19784
19818
|
}
|
|
19785
19819
|
}]);
|
|
19786
19820
|
|
|
@@ -19801,6 +19835,8 @@ __decorate([Prop({
|
|
|
19801
19835
|
default: false
|
|
19802
19836
|
})], SearchBoxProduct.prototype, "highlighted", void 0);
|
|
19803
19837
|
|
|
19838
|
+
__decorate([options$9.Getter("boxRoutingBehavior")], SearchBoxProduct.prototype, "boxRoutingBehavior", void 0);
|
|
19839
|
+
|
|
19804
19840
|
__decorate([tracking$5.Action("track")], SearchBoxProduct.prototype, "trackClick", void 0);
|
|
19805
19841
|
|
|
19806
19842
|
__decorate([history$3.Action("add")], SearchBoxProduct.prototype, "addHistory", void 0);
|
|
@@ -27434,33 +27470,6 @@ var __vue_component__$G = /*#__PURE__*/normalizeComponent({
|
|
|
27434
27470
|
staticRenderFns: __vue_staticRenderFns__$G
|
|
27435
27471
|
}, __vue_inject_styles__$G, __vue_script__$G, __vue_scope_id__$G, __vue_is_functional_template__$G, __vue_module_identifier__$G, false, undefined, undefined, undefined);
|
|
27436
27472
|
|
|
27437
|
-
var emitRoutingEvent = function emitRoutingEvent(url) {
|
|
27438
|
-
var event = new CustomEvent(LUPA_ROUTING_EVENT, {
|
|
27439
|
-
detail: url
|
|
27440
|
-
});
|
|
27441
|
-
window.dispatchEvent(event);
|
|
27442
|
-
};
|
|
27443
|
-
var handleRoutingEvent = function handleRoutingEvent(link, event) {
|
|
27444
|
-
var hasEventRouting = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
27445
|
-
|
|
27446
|
-
if (!hasEventRouting) {
|
|
27447
|
-
return;
|
|
27448
|
-
}
|
|
27449
|
-
|
|
27450
|
-
event === null || event === void 0 ? void 0 : event.preventDefault();
|
|
27451
|
-
emitRoutingEvent(link);
|
|
27452
|
-
};
|
|
27453
|
-
var redirectToResultsPage = function redirectToResultsPage(link, searchText, facet) {
|
|
27454
|
-
var routingBehavior = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "direct-link";
|
|
27455
|
-
var url = generateResultLink(link, searchText, facet);
|
|
27456
|
-
|
|
27457
|
-
if (routingBehavior === "event") {
|
|
27458
|
-
emitRoutingEvent(url);
|
|
27459
|
-
} else {
|
|
27460
|
-
window.location.assign(url);
|
|
27461
|
-
}
|
|
27462
|
-
};
|
|
27463
|
-
|
|
27464
27473
|
var CategoryFilterItem = /*#__PURE__*/function (_Vue) {
|
|
27465
27474
|
_inherits(CategoryFilterItem, _Vue);
|
|
27466
27475
|
|
|
@@ -27842,6 +27851,7 @@ var __vue_render__$D = function __vue_render__() {
|
|
|
27842
27851
|
var _c = _vm._self._c || _h;
|
|
27843
27852
|
|
|
27844
27853
|
return _c("div", {
|
|
27854
|
+
staticClass: "lupa-search-result-filters",
|
|
27845
27855
|
attrs: {
|
|
27846
27856
|
id: "lupa-search-result-filters"
|
|
27847
27857
|
}
|
|
@@ -29868,6 +29878,7 @@ var __vue_render__$m = function __vue_render__() {
|
|
|
29868
29878
|
var _c = _vm._self._c || _h;
|
|
29869
29879
|
|
|
29870
29880
|
return _c("div", {
|
|
29881
|
+
staticClass: "lupa-search-result-product-card",
|
|
29871
29882
|
class: !_vm.isInStock ? "lupa-out-of-stock" : "",
|
|
29872
29883
|
attrs: {
|
|
29873
29884
|
id: "lupa-search-result-product-card",
|
|
@@ -30836,6 +30847,7 @@ var __vue_render__$h = function __vue_render__() {
|
|
|
30836
30847
|
var _c = _vm._self._c || _h;
|
|
30837
30848
|
|
|
30838
30849
|
return _c("div", {
|
|
30850
|
+
staticClass: "lupa-search-results-sort",
|
|
30839
30851
|
attrs: {
|
|
30840
30852
|
id: "lupa-search-results-sort"
|
|
30841
30853
|
}
|
|
@@ -31758,6 +31770,7 @@ var __vue_render__$9 = function __vue_render__() {
|
|
|
31758
31770
|
var _c = _vm._self._c || _h;
|
|
31759
31771
|
|
|
31760
31772
|
return _c("div", {
|
|
31773
|
+
staticClass: "lupa-search-result-filters",
|
|
31761
31774
|
attrs: {
|
|
31762
31775
|
id: "lupa-search-result-filters"
|
|
31763
31776
|
}
|
|
@@ -32381,7 +32394,7 @@ var SearchResults = /*#__PURE__*/function (_Vue) {
|
|
|
32381
32394
|
get: function get() {
|
|
32382
32395
|
var _a, _b, _c;
|
|
32383
32396
|
|
|
32384
|
-
return ((_c = (_b = (_a = this.options.filters) === null || _a === void 0 ? void 0 : _a.facets) === null || _b === void 0 ? void 0 : _b.style) === null || _c === void 0 ? void 0 : _c.type) === "sidebar";
|
|
32397
|
+
return ((_c = (_b = (_a = this.options.filters) === null || _a === void 0 ? void 0 : _a.facets) === null || _b === void 0 ? void 0 : _b.style) === null || _c === void 0 ? void 0 : _c.type) === "sidebar" && (this.hasResults || this.currentFilterCount > 0);
|
|
32385
32398
|
}
|
|
32386
32399
|
}, {
|
|
32387
32400
|
key: "isTitleResultTopPosition",
|
|
@@ -32473,30 +32486,17 @@ var SearchResults = /*#__PURE__*/function (_Vue) {
|
|
|
32473
32486
|
value: function handleResults(_ref) {
|
|
32474
32487
|
var queryKey = _ref.queryKey,
|
|
32475
32488
|
results = _ref.results;
|
|
32489
|
+
|
|
32490
|
+
var _a;
|
|
32491
|
+
|
|
32476
32492
|
this.trackResults({
|
|
32477
32493
|
queryKey: queryKey,
|
|
32478
32494
|
results: results
|
|
32479
32495
|
});
|
|
32480
|
-
|
|
32481
|
-
|
|
32482
|
-
|
|
32483
|
-
|
|
32484
|
-
}
|
|
32485
|
-
|
|
32486
|
-
if (results.total < 1) {
|
|
32487
|
-
this.appendParams({
|
|
32488
|
-
params: [{
|
|
32489
|
-
name: noResultsParam,
|
|
32490
|
-
value: "true"
|
|
32491
|
-
}],
|
|
32492
|
-
save: false
|
|
32493
|
-
});
|
|
32494
|
-
} else {
|
|
32495
|
-
this.removeParams({
|
|
32496
|
-
paramsToRemove: [noResultsParam],
|
|
32497
|
-
save: false
|
|
32498
|
-
});
|
|
32499
|
-
}
|
|
32496
|
+
this.handleNoResultsFlag({
|
|
32497
|
+
resultCount: (_a = results === null || results === void 0 ? void 0 : results.total) !== null && _a !== void 0 ? _a : 0,
|
|
32498
|
+
noResultsParam: this.options.noResultsQueryFlag
|
|
32499
|
+
});
|
|
32500
32500
|
}
|
|
32501
32501
|
}, {
|
|
32502
32502
|
key: "handleResize",
|
|
@@ -32527,6 +32527,10 @@ __decorate([Prop({
|
|
|
32527
32527
|
|
|
32528
32528
|
__decorate([searchResult$1.Getter("currentQueryText")], SearchResults.prototype, "currentQueryText", void 0);
|
|
32529
32529
|
|
|
32530
|
+
__decorate([searchResult$1.Getter("hasResults")], SearchResults.prototype, "hasResults", void 0);
|
|
32531
|
+
|
|
32532
|
+
__decorate([searchResult$1.Getter("currentFilterCount")], SearchResults.prototype, "currentFilterCount", void 0);
|
|
32533
|
+
|
|
32530
32534
|
__decorate([tracking$2.Action("trackSearch")], SearchResults.prototype, "trackSearch", void 0);
|
|
32531
32535
|
|
|
32532
32536
|
__decorate([tracking$2.Action("trackResults")], SearchResults.prototype, "trackResults", void 0);
|
|
@@ -32535,6 +32539,8 @@ __decorate([params$1.State("searchString")], SearchResults.prototype, "searchStr
|
|
|
32535
32539
|
|
|
32536
32540
|
__decorate([params$1.Action("setDefaultLimit")], SearchResults.prototype, "setDefaultLimit", void 0);
|
|
32537
32541
|
|
|
32542
|
+
__decorate([params$1.Action("handleNoResultsFlag")], SearchResults.prototype, "handleNoResultsFlag", void 0);
|
|
32543
|
+
|
|
32538
32544
|
__decorate([params$1.Action("add")], SearchResults.prototype, "addParams", void 0);
|
|
32539
32545
|
|
|
32540
32546
|
__decorate([params$1.Action("removeParams")], SearchResults.prototype, "removeParams", void 0);
|
|
@@ -34337,11 +34343,36 @@ var ParamsModule = /*#__PURE__*/function (_VuexModule) {
|
|
|
34337
34343
|
searchString: url.search
|
|
34338
34344
|
} : {};
|
|
34339
34345
|
}
|
|
34346
|
+
}, {
|
|
34347
|
+
key: "handleNoResultsFlag",
|
|
34348
|
+
value: function handleNoResultsFlag(_ref3) {
|
|
34349
|
+
var resultCount = _ref3.resultCount,
|
|
34350
|
+
noResultsParam = _ref3.noResultsParam;
|
|
34351
|
+
|
|
34352
|
+
if (!noResultsParam || this.searchResultsLink && this.searchResultsLink !== window.location.pathname) {
|
|
34353
|
+
return;
|
|
34354
|
+
}
|
|
34355
|
+
|
|
34356
|
+
if (resultCount < 1) {
|
|
34357
|
+
this.context.dispatch("appendParams", {
|
|
34358
|
+
params: [{
|
|
34359
|
+
name: noResultsParam,
|
|
34360
|
+
value: "true"
|
|
34361
|
+
}],
|
|
34362
|
+
save: false
|
|
34363
|
+
});
|
|
34364
|
+
} else {
|
|
34365
|
+
this.context.dispatch("removeParams", {
|
|
34366
|
+
paramsToRemove: [noResultsParam],
|
|
34367
|
+
save: false
|
|
34368
|
+
});
|
|
34369
|
+
}
|
|
34370
|
+
}
|
|
34340
34371
|
}, {
|
|
34341
34372
|
key: "goToResults",
|
|
34342
|
-
value: function goToResults(
|
|
34343
|
-
var searchText =
|
|
34344
|
-
facet =
|
|
34373
|
+
value: function goToResults(_ref4) {
|
|
34374
|
+
var searchText = _ref4.searchText,
|
|
34375
|
+
facet = _ref4.facet;
|
|
34345
34376
|
|
|
34346
34377
|
var _a;
|
|
34347
34378
|
|
|
@@ -34372,13 +34403,13 @@ var ParamsModule = /*#__PURE__*/function (_VuexModule) {
|
|
|
34372
34403
|
}
|
|
34373
34404
|
}, {
|
|
34374
34405
|
key: "appendParams",
|
|
34375
|
-
value: function appendParams(
|
|
34376
|
-
var params =
|
|
34377
|
-
paramsToRemove =
|
|
34378
|
-
|
|
34379
|
-
encode =
|
|
34380
|
-
|
|
34381
|
-
save =
|
|
34406
|
+
value: function appendParams(_ref5) {
|
|
34407
|
+
var params = _ref5.params,
|
|
34408
|
+
paramsToRemove = _ref5.paramsToRemove,
|
|
34409
|
+
_ref5$encode = _ref5.encode,
|
|
34410
|
+
encode = _ref5$encode === void 0 ? true : _ref5$encode,
|
|
34411
|
+
_ref5$save = _ref5.save,
|
|
34412
|
+
save = _ref5$save === void 0 ? true : _ref5$save;
|
|
34382
34413
|
|
|
34383
34414
|
if (!(params === null || params === void 0 ? void 0 : params.length)) {
|
|
34384
34415
|
return {
|
|
@@ -34445,6 +34476,8 @@ __decorate([Action({
|
|
|
34445
34476
|
commit: "save"
|
|
34446
34477
|
})], ParamsModule.prototype, "removeParams", null);
|
|
34447
34478
|
|
|
34479
|
+
__decorate([Action({})], ParamsModule.prototype, "handleNoResultsFlag", null);
|
|
34480
|
+
|
|
34448
34481
|
__decorate([Action({})], ParamsModule.prototype, "goToResults", null);
|
|
34449
34482
|
|
|
34450
34483
|
__decorate([Action({
|
|
@@ -32,6 +32,10 @@ export default class ParamsModule extends VuexModule {
|
|
|
32
32
|
params?: QueryParams;
|
|
33
33
|
searchString?: string;
|
|
34
34
|
};
|
|
35
|
+
handleNoResultsFlag({ resultCount, noResultsParam, }: {
|
|
36
|
+
resultCount: number;
|
|
37
|
+
noResultsParam?: string;
|
|
38
|
+
}): void;
|
|
35
39
|
goToResults({ searchText, facet, }: {
|
|
36
40
|
searchText: string;
|
|
37
41
|
facet?: InputSuggestionFacet;
|
|
@@ -4,12 +4,14 @@ import { DocumentSearchBoxPanel } from "@/types/search-box/SearchBoxPanel";
|
|
|
4
4
|
import { SearchBoxOptionLabels } from "@/types/search-box/SearchBoxOptions";
|
|
5
5
|
import { DocumentElement } from "@/types/DocumentElement";
|
|
6
6
|
import { TrackableEventData } from "@/types/search-box/Common";
|
|
7
|
+
import { RoutingBehavior } from "@/types/search-results/RoutingBehavior";
|
|
7
8
|
export default class SearchBoxProduct extends Vue {
|
|
8
9
|
item: Document;
|
|
9
10
|
inputValue: string;
|
|
10
11
|
panelOptions: DocumentSearchBoxPanel;
|
|
11
12
|
labels?: SearchBoxOptionLabels;
|
|
12
13
|
highlighted?: boolean;
|
|
14
|
+
boxRoutingBehavior: RoutingBehavior;
|
|
13
15
|
trackClick: ({ queryKey, data, }: {
|
|
14
16
|
queryKey: string;
|
|
15
17
|
data: TrackableEventData;
|
|
@@ -21,5 +23,5 @@ export default class SearchBoxProduct extends Vue {
|
|
|
21
23
|
get imageElements(): DocumentElement[];
|
|
22
24
|
get detailElements(): DocumentElement[];
|
|
23
25
|
get id(): string;
|
|
24
|
-
handleClick(): void;
|
|
26
|
+
handleClick(event?: Event): void;
|
|
25
27
|
}
|
|
@@ -8,6 +8,8 @@ export default class SearchResults extends Vue {
|
|
|
8
8
|
isProductList: boolean;
|
|
9
9
|
get productsOptions(): SearchResultsProductOptions;
|
|
10
10
|
currentQueryText: string;
|
|
11
|
+
hasResults: boolean;
|
|
12
|
+
currentFilterCount: number;
|
|
11
13
|
get didYouMeanLabels(): SearchResultsDidYouMeanLabels;
|
|
12
14
|
get showFilterSidebar(): boolean;
|
|
13
15
|
get isTitleResultTopPosition(): boolean;
|
|
@@ -23,6 +25,10 @@ export default class SearchResults extends Vue {
|
|
|
23
25
|
setDefaultLimit: (defaultLimit: number) => {
|
|
24
26
|
defaultLimit: number;
|
|
25
27
|
};
|
|
28
|
+
handleNoResultsFlag: ({ resultCount, noResultsParam, }: {
|
|
29
|
+
resultCount: number;
|
|
30
|
+
noResultsParam?: string;
|
|
31
|
+
}) => void;
|
|
26
32
|
addParams: (params: QueryParams) => {
|
|
27
33
|
params: QueryParams;
|
|
28
34
|
};
|