@getlupa/client 0.5.1-alpha-10 → 0.5.1-alpha-13
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 +7 -0
- package/dist/cjs/index.min.js +119 -58
- package/dist/cjs/store/modules/options.d.ts +3 -0
- package/dist/cjs/store/modules/params.d.ts +4 -0
- package/dist/cjs/types/search-box/SearchBoxOptions.d.ts +2 -0
- package/dist/cjs/utils/query.utils.d.ts +1 -1
- package/dist/cjs/utils/routing.utils.d.ts +3 -0
- package/dist/es/components/search-box/products/SearchBoxProduct.vue.d.ts +3 -1
- package/dist/es/components/search-results/SearchResults.vue.d.ts +7 -0
- package/dist/es/index.min.js +119 -58
- package/dist/es/store/modules/options.d.ts +3 -0
- package/dist/es/store/modules/params.d.ts +4 -0
- package/dist/es/types/search-box/SearchBoxOptions.d.ts +2 -0
- package/dist/es/utils/query.utils.d.ts +1 -1
- package/dist/es/utils/routing.utils.d.ts +3 -0
- package/dist/iife/components/search-box/products/SearchBoxProduct.vue.d.ts +3 -1
- package/dist/iife/components/search-results/SearchResults.vue.d.ts +7 -0
- package/dist/iife/index.min.js +1 -1
- package/dist/iife/store/modules/options.d.ts +3 -0
- package/dist/iife/store/modules/params.d.ts +4 -0
- package/dist/iife/types/search-box/SearchBoxOptions.d.ts +2 -0
- package/dist/iife/utils/query.utils.d.ts +1 -1
- package/dist/iife/utils/routing.utils.d.ts +3 -0
- 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
|
};
|
|
@@ -51,6 +57,7 @@ export default class SearchResults extends Vue {
|
|
|
51
57
|
setLoading: (loading: boolean) => {
|
|
52
58
|
loading: boolean;
|
|
53
59
|
};
|
|
60
|
+
defaultSearchResultPageSize: number;
|
|
54
61
|
handleUrlChange(params?: URLSearchParams): void;
|
|
55
62
|
query(publicQuery: PublicQuery): void;
|
|
56
63
|
handleResults({ queryKey, results, }: {
|
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);
|
|
@@ -21893,8 +21929,8 @@ var DEFAULT_OPTIONS_RESULTS = {
|
|
|
21893
21929
|
}]
|
|
21894
21930
|
};
|
|
21895
21931
|
|
|
21896
|
-
var createPublicQuery = function createPublicQuery(queryParams, sortOptions // will be removed when vuex is implemented
|
|
21897
|
-
) {
|
|
21932
|
+
var createPublicQuery = function createPublicQuery(queryParams, sortOptions, // will be removed when vuex is implemented
|
|
21933
|
+
defaultPageSize) {
|
|
21898
21934
|
var _a;
|
|
21899
21935
|
|
|
21900
21936
|
var publicQuery = {};
|
|
@@ -21912,11 +21948,11 @@ var createPublicQuery = function createPublicQuery(queryParams, sortOptions // w
|
|
|
21912
21948
|
break;
|
|
21913
21949
|
|
|
21914
21950
|
case QUERY_PARAMS_PARSED.LIMIT:
|
|
21915
|
-
publicQuery.limit = Number(value);
|
|
21951
|
+
publicQuery.limit = Number(value) || defaultPageSize;
|
|
21916
21952
|
break;
|
|
21917
21953
|
|
|
21918
21954
|
case QUERY_PARAMS_PARSED.PAGE:
|
|
21919
|
-
publicQuery.offset = getOffset(Number(value), Number(queryParams[QUERY_PARAMS_PARSED.LIMIT]) || DEFAULT_OPTIONS_RESULTS.pagination.sizeSelection.sizes[0]);
|
|
21955
|
+
publicQuery.offset = getOffset(Number(value), Number(queryParams[QUERY_PARAMS_PARSED.LIMIT]) || defaultPageSize || DEFAULT_OPTIONS_RESULTS.pagination.sizeSelection.sizes[0]);
|
|
21920
21956
|
break;
|
|
21921
21957
|
|
|
21922
21958
|
case QUERY_PARAMS_PARSED.SORT:
|
|
@@ -27438,23 +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
|
-
|
|
27458
27477
|
var CategoryFilterItem = /*#__PURE__*/function (_Vue) {
|
|
27459
27478
|
_inherits(CategoryFilterItem, _Vue);
|
|
27460
27479
|
|
|
@@ -32375,7 +32394,7 @@ var SearchResults = /*#__PURE__*/function (_Vue) {
|
|
|
32375
32394
|
get: function get() {
|
|
32376
32395
|
var _a, _b, _c;
|
|
32377
32396
|
|
|
32378
|
-
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);
|
|
32379
32398
|
}
|
|
32380
32399
|
}, {
|
|
32381
32400
|
key: "isTitleResultTopPosition",
|
|
@@ -32386,10 +32405,10 @@ var SearchResults = /*#__PURE__*/function (_Vue) {
|
|
|
32386
32405
|
key: "mounted",
|
|
32387
32406
|
value: function mounted() {
|
|
32388
32407
|
window.addEventListener("resize", this.handleResize);
|
|
32389
|
-
this.handleMounted();
|
|
32390
32408
|
this.setSearchResultOptions({
|
|
32391
32409
|
options: this.options
|
|
32392
32410
|
});
|
|
32411
|
+
this.handleMounted();
|
|
32393
32412
|
this.setInitialFilters({
|
|
32394
32413
|
initialFilters: this.initialFilters
|
|
32395
32414
|
});
|
|
@@ -32419,7 +32438,7 @@ var SearchResults = /*#__PURE__*/function (_Vue) {
|
|
|
32419
32438
|
key: "handleUrlChange",
|
|
32420
32439
|
value: function handleUrlChange(params) {
|
|
32421
32440
|
var searchParams = params || new URLSearchParams(window.location.search);
|
|
32422
|
-
var publicQuery = createPublicQuery(parseParams(searchParams), this.options.sort);
|
|
32441
|
+
var publicQuery = createPublicQuery(parseParams(searchParams), this.options.sort, this.defaultSearchResultPageSize);
|
|
32423
32442
|
this.setLoading(true);
|
|
32424
32443
|
this.query(getPublicQuery(publicQuery, this.initialFilters, this.isProductList));
|
|
32425
32444
|
}
|
|
@@ -32433,7 +32452,10 @@ var SearchResults = /*#__PURE__*/function (_Vue) {
|
|
|
32433
32452
|
query: publicQuery
|
|
32434
32453
|
});
|
|
32435
32454
|
var context = getLupaTrackingContext();
|
|
32436
|
-
var
|
|
32455
|
+
var limit = publicQuery.limit || this.defaultSearchResultPageSize;
|
|
32456
|
+
var query = Object.assign(Object.assign(Object.assign({}, publicQuery), context), {
|
|
32457
|
+
limit: limit
|
|
32458
|
+
});
|
|
32437
32459
|
getLupaSdk.query(this.options.queryKey, query, this.options.options).then(function (res) {
|
|
32438
32460
|
var _a, _b;
|
|
32439
32461
|
|
|
@@ -32464,30 +32486,17 @@ var SearchResults = /*#__PURE__*/function (_Vue) {
|
|
|
32464
32486
|
value: function handleResults(_ref) {
|
|
32465
32487
|
var queryKey = _ref.queryKey,
|
|
32466
32488
|
results = _ref.results;
|
|
32489
|
+
|
|
32490
|
+
var _a;
|
|
32491
|
+
|
|
32467
32492
|
this.trackResults({
|
|
32468
32493
|
queryKey: queryKey,
|
|
32469
32494
|
results: results
|
|
32470
32495
|
});
|
|
32471
|
-
|
|
32472
|
-
|
|
32473
|
-
|
|
32474
|
-
|
|
32475
|
-
}
|
|
32476
|
-
|
|
32477
|
-
if (results.total < 1) {
|
|
32478
|
-
this.appendParams({
|
|
32479
|
-
params: [{
|
|
32480
|
-
name: noResultsParam,
|
|
32481
|
-
value: "true"
|
|
32482
|
-
}],
|
|
32483
|
-
save: false
|
|
32484
|
-
});
|
|
32485
|
-
} else {
|
|
32486
|
-
this.removeParams({
|
|
32487
|
-
paramsToRemove: [noResultsParam],
|
|
32488
|
-
save: false
|
|
32489
|
-
});
|
|
32490
|
-
}
|
|
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
|
+
});
|
|
32491
32500
|
}
|
|
32492
32501
|
}, {
|
|
32493
32502
|
key: "handleResize",
|
|
@@ -32518,6 +32527,10 @@ __decorate([Prop({
|
|
|
32518
32527
|
|
|
32519
32528
|
__decorate([searchResult$1.Getter("currentQueryText")], SearchResults.prototype, "currentQueryText", void 0);
|
|
32520
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
|
+
|
|
32521
32534
|
__decorate([tracking$2.Action("trackSearch")], SearchResults.prototype, "trackSearch", void 0);
|
|
32522
32535
|
|
|
32523
32536
|
__decorate([tracking$2.Action("trackResults")], SearchResults.prototype, "trackResults", void 0);
|
|
@@ -32526,6 +32539,8 @@ __decorate([params$1.State("searchString")], SearchResults.prototype, "searchStr
|
|
|
32526
32539
|
|
|
32527
32540
|
__decorate([params$1.Action("setDefaultLimit")], SearchResults.prototype, "setDefaultLimit", void 0);
|
|
32528
32541
|
|
|
32542
|
+
__decorate([params$1.Action("handleNoResultsFlag")], SearchResults.prototype, "handleNoResultsFlag", void 0);
|
|
32543
|
+
|
|
32529
32544
|
__decorate([params$1.Action("add")], SearchResults.prototype, "addParams", void 0);
|
|
32530
32545
|
|
|
32531
32546
|
__decorate([params$1.Action("removeParams")], SearchResults.prototype, "removeParams", void 0);
|
|
@@ -32542,6 +32557,8 @@ __decorate([searchResult$1.Action("add")], SearchResults.prototype, "addSearchRe
|
|
|
32542
32557
|
|
|
32543
32558
|
__decorate([searchResult$1.Action("setLoading")], SearchResults.prototype, "setLoading", void 0);
|
|
32544
32559
|
|
|
32560
|
+
__decorate([options$1.Getter("defaultSearchResultPageSize")], SearchResults.prototype, "defaultSearchResultPageSize", void 0);
|
|
32561
|
+
|
|
32545
32562
|
__decorate([searchResult$1.Action("setColumnCount")], SearchResults.prototype, "setColumnCount", void 0);
|
|
32546
32563
|
|
|
32547
32564
|
SearchResults = __decorate([Component({
|
|
@@ -34256,7 +34273,7 @@ var ParamsModule = /*#__PURE__*/function (_VuexModule) {
|
|
|
34256
34273
|
}, {
|
|
34257
34274
|
key: "limit",
|
|
34258
34275
|
get: function get() {
|
|
34259
|
-
return Number(this.params[QUERY_PARAMS_PARSED.LIMIT]) || this.defaultLimit;
|
|
34276
|
+
return Number(this.params[QUERY_PARAMS_PARSED.LIMIT]) || this.context.rootGetters["options/defaultSearchResultPageSize"] || this.defaultLimit;
|
|
34260
34277
|
}
|
|
34261
34278
|
}, {
|
|
34262
34279
|
key: "sort",
|
|
@@ -34326,11 +34343,38 @@ var ParamsModule = /*#__PURE__*/function (_VuexModule) {
|
|
|
34326
34343
|
searchString: url.search
|
|
34327
34344
|
} : {};
|
|
34328
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
|
+
}
|
|
34329
34371
|
}, {
|
|
34330
34372
|
key: "goToResults",
|
|
34331
|
-
value: function goToResults(
|
|
34332
|
-
var searchText =
|
|
34333
|
-
facet =
|
|
34373
|
+
value: function goToResults(_ref4) {
|
|
34374
|
+
var searchText = _ref4.searchText,
|
|
34375
|
+
facet = _ref4.facet;
|
|
34376
|
+
|
|
34377
|
+
var _a;
|
|
34334
34378
|
|
|
34335
34379
|
if (!this.searchResultsLink || this.searchResultsLink === window.location.pathname) {
|
|
34336
34380
|
var facetParam = facet ? [getFacetParam(facet.key, [facet.title])] : [];
|
|
@@ -34342,7 +34386,8 @@ var ParamsModule = /*#__PURE__*/function (_VuexModule) {
|
|
|
34342
34386
|
paramsToRemove: "all"
|
|
34343
34387
|
});
|
|
34344
34388
|
} else {
|
|
34345
|
-
|
|
34389
|
+
var routing = (_a = this.context.rootGetters["options/boxRoutingBehavior"]) !== null && _a !== void 0 ? _a : "direct-link";
|
|
34390
|
+
redirectToResultsPage(this.searchResultsLink, searchText, facet, routing);
|
|
34346
34391
|
}
|
|
34347
34392
|
|
|
34348
34393
|
this.context.dispatch("tracking/track", {
|
|
@@ -34358,13 +34403,13 @@ var ParamsModule = /*#__PURE__*/function (_VuexModule) {
|
|
|
34358
34403
|
}
|
|
34359
34404
|
}, {
|
|
34360
34405
|
key: "appendParams",
|
|
34361
|
-
value: function appendParams(
|
|
34362
|
-
var params =
|
|
34363
|
-
paramsToRemove =
|
|
34364
|
-
|
|
34365
|
-
encode =
|
|
34366
|
-
|
|
34367
|
-
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;
|
|
34368
34413
|
|
|
34369
34414
|
if (!(params === null || params === void 0 ? void 0 : params.length)) {
|
|
34370
34415
|
return {
|
|
@@ -34431,6 +34476,8 @@ __decorate([Action({
|
|
|
34431
34476
|
commit: "save"
|
|
34432
34477
|
})], ParamsModule.prototype, "removeParams", null);
|
|
34433
34478
|
|
|
34479
|
+
__decorate([Action({})], ParamsModule.prototype, "handleNoResultsFlag", null);
|
|
34480
|
+
|
|
34434
34481
|
__decorate([Action({})], ParamsModule.prototype, "goToResults", null);
|
|
34435
34482
|
|
|
34436
34483
|
__decorate([Action({
|
|
@@ -34488,6 +34535,20 @@ var OptionsModule = /*#__PURE__*/function (_VuexModule) {
|
|
|
34488
34535
|
get: function get() {
|
|
34489
34536
|
return this.searchResultInitialFilters;
|
|
34490
34537
|
}
|
|
34538
|
+
}, {
|
|
34539
|
+
key: "boxRoutingBehavior",
|
|
34540
|
+
get: function get() {
|
|
34541
|
+
var _a;
|
|
34542
|
+
|
|
34543
|
+
return (_a = this.searchBoxOptions.routingBehavior) !== null && _a !== void 0 ? _a : "direct-link";
|
|
34544
|
+
}
|
|
34545
|
+
}, {
|
|
34546
|
+
key: "defaultSearchResultPageSize",
|
|
34547
|
+
get: function get() {
|
|
34548
|
+
var _a, _b, _c, _d, _e;
|
|
34549
|
+
|
|
34550
|
+
return (_e = (_d = (_c = (_b = (_a = this.searchResultOptions) === null || _a === void 0 ? void 0 : _a.pagination) === null || _b === void 0 ? void 0 : _b.sizeSelection) === null || _c === void 0 ? void 0 : _c.sizes) === null || _d === void 0 ? void 0 : _d[0]) !== null && _e !== void 0 ? _e : DEFAULT_PAGE_SIZE;
|
|
34551
|
+
}
|
|
34491
34552
|
}, {
|
|
34492
34553
|
key: "setSearchBoxOptions",
|
|
34493
34554
|
value: function setSearchBoxOptions(_ref) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SearchBoxOptions } from "@/types/search-box/SearchBoxOptions";
|
|
2
|
+
import { RoutingBehavior } from "@/types/search-results/RoutingBehavior";
|
|
2
3
|
import { SearchResultsOptions } from "@/types/search-results/SearchResultsOptions";
|
|
3
4
|
import { FilterGroup, Options } from "@getlupa/client-sdk/Types";
|
|
4
5
|
import { VuexModule } from "vuex-module-decorators";
|
|
@@ -9,6 +10,8 @@ export default class OptionsModule extends VuexModule {
|
|
|
9
10
|
get envOptions(): Options;
|
|
10
11
|
get classMap(): Record<string, string>;
|
|
11
12
|
get initialFilters(): FilterGroup;
|
|
13
|
+
get boxRoutingBehavior(): RoutingBehavior;
|
|
14
|
+
get defaultSearchResultPageSize(): number;
|
|
12
15
|
setSearchBoxOptions({ options }: {
|
|
13
16
|
options: SearchBoxOptions;
|
|
14
17
|
}): void;
|
|
@@ -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;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { SdkOptions } from "../General";
|
|
2
|
+
import { RoutingBehavior } from "../search-results/RoutingBehavior";
|
|
2
3
|
import { SearchBoxHistory } from "./SearchBoxHistory";
|
|
3
4
|
import { SearchBoxPanel } from "./SearchBoxPanel";
|
|
4
5
|
export declare type SearchBoxOptions = SearchBoxPanelOptions & {
|
|
5
6
|
inputSelector: string;
|
|
6
7
|
searchTriggers?: string[];
|
|
8
|
+
routingBehavior?: RoutingBehavior;
|
|
7
9
|
};
|
|
8
10
|
export declare type SearchBoxOptionLabels = {
|
|
9
11
|
placeholder: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { QueryParams } from "@/types/search-results/QueryParams";
|
|
2
2
|
import { SearchResultsSortOptions } from "@/types/search-results/SearchResultsSort";
|
|
3
3
|
import { FilterGroup, PublicQuery } from "@getlupa/client-sdk/Types";
|
|
4
|
-
export declare const createPublicQuery: (queryParams: QueryParams, sortOptions?: SearchResultsSortOptions[] | undefined) => PublicQuery;
|
|
4
|
+
export declare const createPublicQuery: (queryParams: QueryParams, sortOptions?: SearchResultsSortOptions[] | undefined, defaultPageSize?: number | undefined) => PublicQuery;
|
|
5
5
|
export declare const getPublicQuery: (publicQuery: PublicQuery, initialFilters: FilterGroup, isProductList: boolean) => PublicQuery;
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
+
import { InputSuggestionFacet } from "@/types/search-box/Common";
|
|
2
|
+
import { RoutingBehavior } from "..";
|
|
1
3
|
export declare const emitRoutingEvent: (url: string) => void;
|
|
2
4
|
export declare const handleRoutingEvent: (link: string, event?: Event | undefined, hasEventRouting?: boolean) => void;
|
|
5
|
+
export declare const redirectToResultsPage: (link: string, searchText: string, facet?: InputSuggestionFacet | undefined, routingBehavior?: RoutingBehavior) => void;
|
|
@@ -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
|
};
|
|
@@ -51,6 +57,7 @@ export default class SearchResults extends Vue {
|
|
|
51
57
|
setLoading: (loading: boolean) => {
|
|
52
58
|
loading: boolean;
|
|
53
59
|
};
|
|
60
|
+
defaultSearchResultPageSize: number;
|
|
54
61
|
handleUrlChange(params?: URLSearchParams): void;
|
|
55
62
|
query(publicQuery: PublicQuery): void;
|
|
56
63
|
handleResults({ queryKey, results, }: {
|