@getlupa/client 0.5.1-alpha-8 → 0.5.1-alpha-11
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/SearchResults.vue.d.ts +1 -0
- package/dist/cjs/components/search-results/products/pagination/SearchResultsPageSelect.vue.d.ts +5 -0
- package/dist/cjs/index.d.ts +1 -2
- package/dist/cjs/index.min.js +90 -17
- package/dist/cjs/store/modules/options.d.ts +3 -0
- package/dist/cjs/types/General.d.ts +4 -2
- 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-results/SearchResults.vue.d.ts +1 -0
- package/dist/es/components/search-results/products/pagination/SearchResultsPageSelect.vue.d.ts +5 -0
- package/dist/es/index.d.ts +1 -2
- package/dist/es/index.min.js +90 -13
- package/dist/es/store/modules/options.d.ts +3 -0
- package/dist/es/types/General.d.ts +4 -2
- 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-results/SearchResults.vue.d.ts +1 -0
- package/dist/iife/components/search-results/products/pagination/SearchResultsPageSelect.vue.d.ts +5 -0
- package/dist/iife/index.d.ts +1 -2
- package/dist/iife/index.min.js +1 -1
- package/dist/iife/store/modules/options.d.ts +3 -0
- package/dist/iife/types/General.d.ts +4 -2
- 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/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -51,6 +51,7 @@ export default class SearchResults extends Vue {
|
|
|
51
51
|
setLoading: (loading: boolean) => {
|
|
52
52
|
loading: boolean;
|
|
53
53
|
};
|
|
54
|
+
defaultSearchResultPageSize: number;
|
|
54
55
|
handleUrlChange(params?: URLSearchParams): void;
|
|
55
56
|
query(publicQuery: PublicQuery): void;
|
|
56
57
|
handleResults({ queryKey, results, }: {
|
package/dist/cjs/components/search-results/products/pagination/SearchResultsPageSelect.vue.d.ts
CHANGED
|
@@ -5,6 +5,11 @@ export default class SearchResultsPageSelect extends Vue {
|
|
|
5
5
|
label: string;
|
|
6
6
|
options: PaginationPageSelect;
|
|
7
7
|
get pages(): number[];
|
|
8
|
+
get lastPage(): number | undefined;
|
|
9
|
+
get showLastPage(): boolean;
|
|
10
|
+
get showLastPageSeparator(): boolean;
|
|
11
|
+
get showFirstPage(): boolean;
|
|
12
|
+
get showFirstPageSeparator(): boolean;
|
|
8
13
|
appendParams: ({ params, paramsToRemove, }: {
|
|
9
14
|
params: {
|
|
10
15
|
name: string;
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { SearchBoxOptions } from "./types/search-box/SearchBoxOptions";
|
|
2
2
|
import { FacetStyle, SearchResultsOptions } from "./types/search-results/SearchResultsOptions";
|
|
3
|
-
import { SdkOptions, TrackingOptions } from "./types/General";
|
|
3
|
+
import { SdkOptions, TrackingOptions, Environment, SortDirection } from "./types/General";
|
|
4
4
|
import { ProductListOptions } from "./types/product-list/ProductListOptions";
|
|
5
5
|
import { DocumentElementType } from "./types/DocumentElement";
|
|
6
6
|
import { SearchBoxPanelType } from "./types/search-box/SearchBoxPanel";
|
|
7
|
-
import { Environment, SortDirection } from "@getlupa/client-sdk/Types";
|
|
8
7
|
import { RoutingBehavior } from "./types/search-results/RoutingBehavior";
|
|
9
8
|
import { AnchorPosition } from "./types/search-results/SearchResultsProductCardOptions";
|
|
10
9
|
import { BadgeType } from "./types/search-results/BadgeOptions";
|
package/dist/cjs/index.min.js
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var Types = require('@getlupa/client-sdk/Types');
|
|
6
|
-
|
|
7
5
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
8
6
|
|
|
9
7
|
function getDefaultExportFromCjs (x) {
|
|
@@ -21895,8 +21893,8 @@ var DEFAULT_OPTIONS_RESULTS = {
|
|
|
21895
21893
|
}]
|
|
21896
21894
|
};
|
|
21897
21895
|
|
|
21898
|
-
var createPublicQuery = function createPublicQuery(queryParams, sortOptions // will be removed when vuex is implemented
|
|
21899
|
-
) {
|
|
21896
|
+
var createPublicQuery = function createPublicQuery(queryParams, sortOptions, // will be removed when vuex is implemented
|
|
21897
|
+
defaultPageSize) {
|
|
21900
21898
|
var _a;
|
|
21901
21899
|
|
|
21902
21900
|
var publicQuery = {};
|
|
@@ -21914,11 +21912,11 @@ var createPublicQuery = function createPublicQuery(queryParams, sortOptions // w
|
|
|
21914
21912
|
break;
|
|
21915
21913
|
|
|
21916
21914
|
case QUERY_PARAMS_PARSED.LIMIT:
|
|
21917
|
-
publicQuery.limit = Number(value);
|
|
21915
|
+
publicQuery.limit = Number(value) || defaultPageSize;
|
|
21918
21916
|
break;
|
|
21919
21917
|
|
|
21920
21918
|
case QUERY_PARAMS_PARSED.PAGE:
|
|
21921
|
-
publicQuery.offset = getOffset(Number(value), Number(queryParams[QUERY_PARAMS_PARSED.LIMIT]) || DEFAULT_OPTIONS_RESULTS.pagination.sizeSelection.sizes[0]);
|
|
21919
|
+
publicQuery.offset = getOffset(Number(value), Number(queryParams[QUERY_PARAMS_PARSED.LIMIT]) || defaultPageSize || DEFAULT_OPTIONS_RESULTS.pagination.sizeSelection.sizes[0]);
|
|
21922
21920
|
break;
|
|
21923
21921
|
|
|
21924
21922
|
case QUERY_PARAMS_PARSED.SORT:
|
|
@@ -27456,6 +27454,16 @@ var handleRoutingEvent = function handleRoutingEvent(link, event) {
|
|
|
27456
27454
|
event === null || event === void 0 ? void 0 : event.preventDefault();
|
|
27457
27455
|
emitRoutingEvent(link);
|
|
27458
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
|
+
};
|
|
27459
27467
|
|
|
27460
27468
|
var CategoryFilterItem = /*#__PURE__*/function (_Vue) {
|
|
27461
27469
|
_inherits(CategoryFilterItem, _Vue);
|
|
@@ -30567,6 +30575,35 @@ var SearchResultsPageSelect = /*#__PURE__*/function (_Vue) {
|
|
|
30567
30575
|
return i && i >= left && i < right;
|
|
30568
30576
|
});
|
|
30569
30577
|
}
|
|
30578
|
+
}, {
|
|
30579
|
+
key: "lastPage",
|
|
30580
|
+
get: function get() {
|
|
30581
|
+
var _a;
|
|
30582
|
+
|
|
30583
|
+
return (_a = this.options.count) !== null && _a !== void 0 ? _a : undefined;
|
|
30584
|
+
}
|
|
30585
|
+
}, {
|
|
30586
|
+
key: "showLastPage",
|
|
30587
|
+
get: function get() {
|
|
30588
|
+
return Boolean(this.lastPage && !this.pages.includes(this.lastPage));
|
|
30589
|
+
}
|
|
30590
|
+
}, {
|
|
30591
|
+
key: "showLastPageSeparator",
|
|
30592
|
+
get: function get() {
|
|
30593
|
+
var _a;
|
|
30594
|
+
|
|
30595
|
+
return this.showLastPage && !this.pages.includes(((_a = this.lastPage) !== null && _a !== void 0 ? _a : 0) - 1);
|
|
30596
|
+
}
|
|
30597
|
+
}, {
|
|
30598
|
+
key: "showFirstPage",
|
|
30599
|
+
get: function get() {
|
|
30600
|
+
return !this.pages.includes(1);
|
|
30601
|
+
}
|
|
30602
|
+
}, {
|
|
30603
|
+
key: "showFirstPageSeparator",
|
|
30604
|
+
get: function get() {
|
|
30605
|
+
return this.showFirstPage && !this.pages.includes(2);
|
|
30606
|
+
}
|
|
30570
30607
|
}, {
|
|
30571
30608
|
key: "handlePageChange",
|
|
30572
30609
|
value: function handlePageChange(page) {
|
|
@@ -30623,7 +30660,16 @@ var __vue_render__$i = function __vue_render__() {
|
|
|
30623
30660
|
return _vm.handlePageChange(_vm.options.selectedPage - 1);
|
|
30624
30661
|
}
|
|
30625
30662
|
}
|
|
30626
|
-
}, [_vm._v("\n <\n ")]) : _vm._e(), _vm._v(" "), _vm.
|
|
30663
|
+
}, [_vm._v("\n <\n ")]) : _vm._e(), _vm._v(" "), _vm.showFirstPage ? [_c("div", {
|
|
30664
|
+
staticClass: "lupa-page-number lupa-page-number-first",
|
|
30665
|
+
on: {
|
|
30666
|
+
click: function click() {
|
|
30667
|
+
return _vm.handlePageChange(1);
|
|
30668
|
+
}
|
|
30669
|
+
}
|
|
30670
|
+
}, [_vm._v("\n 1\n ")]), _vm._v(" "), _vm.showFirstPageSeparator ? _c("div", {
|
|
30671
|
+
staticClass: "lupa-page-number-separator"
|
|
30672
|
+
}, [_vm._v("\n ...\n ")]) : _vm._e()] : _vm._e(), _vm._v(" "), _vm._l(_vm.pages, function (page) {
|
|
30627
30673
|
return _c("div", {
|
|
30628
30674
|
key: page,
|
|
30629
30675
|
class: ["lupa-page-number", page === _vm.options.selectedPage ? "lupa-page-number-selected" : ""],
|
|
@@ -30636,7 +30682,16 @@ var __vue_render__$i = function __vue_render__() {
|
|
|
30636
30682
|
}
|
|
30637
30683
|
}
|
|
30638
30684
|
}, [_vm._v("\n " + _vm._s(page) + "\n ")]);
|
|
30639
|
-
}), _vm._v(" "), _vm.
|
|
30685
|
+
}), _vm._v(" "), _vm.showLastPage ? [_vm.showLastPageSeparator ? _c("div", {
|
|
30686
|
+
staticClass: "lupa-page-number-separator"
|
|
30687
|
+
}, [_vm._v("\n ...\n ")]) : _vm._e(), _vm._v(" "), _c("div", {
|
|
30688
|
+
staticClass: "lupa-page-number lupa-page-number-last",
|
|
30689
|
+
on: {
|
|
30690
|
+
click: function click() {
|
|
30691
|
+
return _vm.handlePageChange(_vm.lastPage);
|
|
30692
|
+
}
|
|
30693
|
+
}
|
|
30694
|
+
}, [_vm._v("\n " + _vm._s(_vm.lastPage) + "\n ")])] : _vm._e(), _vm._v(" "), _vm.options.selectedPage < _vm.options.count ? _c("div", {
|
|
30640
30695
|
class: _vm.label === ">" ? "lupa-page-arrow" : "lupa-show-more",
|
|
30641
30696
|
attrs: {
|
|
30642
30697
|
"data-cy": "lupa-show-more"
|
|
@@ -32341,10 +32396,10 @@ var SearchResults = /*#__PURE__*/function (_Vue) {
|
|
|
32341
32396
|
key: "mounted",
|
|
32342
32397
|
value: function mounted() {
|
|
32343
32398
|
window.addEventListener("resize", this.handleResize);
|
|
32344
|
-
this.handleMounted();
|
|
32345
32399
|
this.setSearchResultOptions({
|
|
32346
32400
|
options: this.options
|
|
32347
32401
|
});
|
|
32402
|
+
this.handleMounted();
|
|
32348
32403
|
this.setInitialFilters({
|
|
32349
32404
|
initialFilters: this.initialFilters
|
|
32350
32405
|
});
|
|
@@ -32374,7 +32429,7 @@ var SearchResults = /*#__PURE__*/function (_Vue) {
|
|
|
32374
32429
|
key: "handleUrlChange",
|
|
32375
32430
|
value: function handleUrlChange(params) {
|
|
32376
32431
|
var searchParams = params || new URLSearchParams(window.location.search);
|
|
32377
|
-
var publicQuery = createPublicQuery(parseParams(searchParams), this.options.sort);
|
|
32432
|
+
var publicQuery = createPublicQuery(parseParams(searchParams), this.options.sort, this.defaultSearchResultPageSize);
|
|
32378
32433
|
this.setLoading(true);
|
|
32379
32434
|
this.query(getPublicQuery(publicQuery, this.initialFilters, this.isProductList));
|
|
32380
32435
|
}
|
|
@@ -32388,7 +32443,10 @@ var SearchResults = /*#__PURE__*/function (_Vue) {
|
|
|
32388
32443
|
query: publicQuery
|
|
32389
32444
|
});
|
|
32390
32445
|
var context = getLupaTrackingContext();
|
|
32391
|
-
var
|
|
32446
|
+
var limit = publicQuery.limit || this.defaultSearchResultPageSize;
|
|
32447
|
+
var query = Object.assign(Object.assign(Object.assign({}, publicQuery), context), {
|
|
32448
|
+
limit: limit
|
|
32449
|
+
});
|
|
32392
32450
|
getLupaSdk.query(this.options.queryKey, query, this.options.options).then(function (res) {
|
|
32393
32451
|
var _a, _b;
|
|
32394
32452
|
|
|
@@ -32497,6 +32555,8 @@ __decorate([searchResult$1.Action("add")], SearchResults.prototype, "addSearchRe
|
|
|
32497
32555
|
|
|
32498
32556
|
__decorate([searchResult$1.Action("setLoading")], SearchResults.prototype, "setLoading", void 0);
|
|
32499
32557
|
|
|
32558
|
+
__decorate([options$1.Getter("defaultSearchResultPageSize")], SearchResults.prototype, "defaultSearchResultPageSize", void 0);
|
|
32559
|
+
|
|
32500
32560
|
__decorate([searchResult$1.Action("setColumnCount")], SearchResults.prototype, "setColumnCount", void 0);
|
|
32501
32561
|
|
|
32502
32562
|
SearchResults = __decorate([Component({
|
|
@@ -34211,7 +34271,7 @@ var ParamsModule = /*#__PURE__*/function (_VuexModule) {
|
|
|
34211
34271
|
}, {
|
|
34212
34272
|
key: "limit",
|
|
34213
34273
|
get: function get() {
|
|
34214
|
-
return Number(this.params[QUERY_PARAMS_PARSED.LIMIT]) || this.defaultLimit;
|
|
34274
|
+
return Number(this.params[QUERY_PARAMS_PARSED.LIMIT]) || this.context.rootGetters["options/defaultSearchResultPageSize"] || this.defaultLimit;
|
|
34215
34275
|
}
|
|
34216
34276
|
}, {
|
|
34217
34277
|
key: "sort",
|
|
@@ -34287,6 +34347,8 @@ var ParamsModule = /*#__PURE__*/function (_VuexModule) {
|
|
|
34287
34347
|
var searchText = _ref3.searchText,
|
|
34288
34348
|
facet = _ref3.facet;
|
|
34289
34349
|
|
|
34350
|
+
var _a;
|
|
34351
|
+
|
|
34290
34352
|
if (!this.searchResultsLink || this.searchResultsLink === window.location.pathname) {
|
|
34291
34353
|
var facetParam = facet ? [getFacetParam(facet.key, [facet.title])] : [];
|
|
34292
34354
|
this.context.dispatch("appendParams", {
|
|
@@ -34297,7 +34359,8 @@ var ParamsModule = /*#__PURE__*/function (_VuexModule) {
|
|
|
34297
34359
|
paramsToRemove: "all"
|
|
34298
34360
|
});
|
|
34299
34361
|
} else {
|
|
34300
|
-
|
|
34362
|
+
var routing = (_a = this.context.rootGetters["options/boxRoutingBehavior"]) !== null && _a !== void 0 ? _a : "direct-link";
|
|
34363
|
+
redirectToResultsPage(this.searchResultsLink, searchText, facet, routing);
|
|
34301
34364
|
}
|
|
34302
34365
|
|
|
34303
34366
|
this.context.dispatch("tracking/track", {
|
|
@@ -34443,6 +34506,20 @@ var OptionsModule = /*#__PURE__*/function (_VuexModule) {
|
|
|
34443
34506
|
get: function get() {
|
|
34444
34507
|
return this.searchResultInitialFilters;
|
|
34445
34508
|
}
|
|
34509
|
+
}, {
|
|
34510
|
+
key: "boxRoutingBehavior",
|
|
34511
|
+
get: function get() {
|
|
34512
|
+
var _a;
|
|
34513
|
+
|
|
34514
|
+
return (_a = this.searchBoxOptions.routingBehavior) !== null && _a !== void 0 ? _a : "direct-link";
|
|
34515
|
+
}
|
|
34516
|
+
}, {
|
|
34517
|
+
key: "defaultSearchResultPageSize",
|
|
34518
|
+
get: function get() {
|
|
34519
|
+
var _a, _b, _c, _d, _e;
|
|
34520
|
+
|
|
34521
|
+
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;
|
|
34522
|
+
}
|
|
34446
34523
|
}, {
|
|
34447
34524
|
key: "setSearchBoxOptions",
|
|
34448
34525
|
value: function setSearchBoxOptions(_ref) {
|
|
@@ -34671,8 +34748,4 @@ var lupaSearch = {
|
|
|
34671
34748
|
clearProductList: clearProductList
|
|
34672
34749
|
};
|
|
34673
34750
|
|
|
34674
|
-
Object.defineProperty(exports, 'SortDirection', {
|
|
34675
|
-
enumerable: true,
|
|
34676
|
-
get: function () { return Types.SortDirection; }
|
|
34677
|
-
});
|
|
34678
34751
|
exports["default"] = lupaSearch;
|
|
@@ -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;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Environment } from "@getlupa/client-sdk/Types";
|
|
2
1
|
import { AnalyticsOptions } from "./AnalyticsOptions";
|
|
2
|
+
import { Environment as SdkEnvironment, SortDirection as SdkSortDirection } from "@getlupa/client-sdk/Types";
|
|
3
3
|
export declare type SdkOptions = {
|
|
4
|
-
environment:
|
|
4
|
+
environment: SdkEnvironment;
|
|
5
5
|
customUrl?: string;
|
|
6
6
|
customPayload?: Record<string, unknown>;
|
|
7
7
|
customHeaders?: Record<string, string>;
|
|
@@ -14,3 +14,5 @@ export declare type TrackingOptions = {
|
|
|
14
14
|
userKey?: string;
|
|
15
15
|
analytics?: AnalyticsOptions;
|
|
16
16
|
};
|
|
17
|
+
export declare type SortDirection = SdkSortDirection;
|
|
18
|
+
export declare type Environment = SdkEnvironment;
|
|
@@ -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;
|
|
@@ -51,6 +51,7 @@ export default class SearchResults extends Vue {
|
|
|
51
51
|
setLoading: (loading: boolean) => {
|
|
52
52
|
loading: boolean;
|
|
53
53
|
};
|
|
54
|
+
defaultSearchResultPageSize: number;
|
|
54
55
|
handleUrlChange(params?: URLSearchParams): void;
|
|
55
56
|
query(publicQuery: PublicQuery): void;
|
|
56
57
|
handleResults({ queryKey, results, }: {
|
package/dist/es/components/search-results/products/pagination/SearchResultsPageSelect.vue.d.ts
CHANGED
|
@@ -5,6 +5,11 @@ export default class SearchResultsPageSelect extends Vue {
|
|
|
5
5
|
label: string;
|
|
6
6
|
options: PaginationPageSelect;
|
|
7
7
|
get pages(): number[];
|
|
8
|
+
get lastPage(): number | undefined;
|
|
9
|
+
get showLastPage(): boolean;
|
|
10
|
+
get showLastPageSeparator(): boolean;
|
|
11
|
+
get showFirstPage(): boolean;
|
|
12
|
+
get showFirstPageSeparator(): boolean;
|
|
8
13
|
appendParams: ({ params, paramsToRemove, }: {
|
|
9
14
|
params: {
|
|
10
15
|
name: string;
|
package/dist/es/index.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { SearchBoxOptions } from "./types/search-box/SearchBoxOptions";
|
|
2
2
|
import { FacetStyle, SearchResultsOptions } from "./types/search-results/SearchResultsOptions";
|
|
3
|
-
import { SdkOptions, TrackingOptions } from "./types/General";
|
|
3
|
+
import { SdkOptions, TrackingOptions, Environment, SortDirection } from "./types/General";
|
|
4
4
|
import { ProductListOptions } from "./types/product-list/ProductListOptions";
|
|
5
5
|
import { DocumentElementType } from "./types/DocumentElement";
|
|
6
6
|
import { SearchBoxPanelType } from "./types/search-box/SearchBoxPanel";
|
|
7
|
-
import { Environment, SortDirection } from "@getlupa/client-sdk/Types";
|
|
8
7
|
import { RoutingBehavior } from "./types/search-results/RoutingBehavior";
|
|
9
8
|
import { AnchorPosition } from "./types/search-results/SearchResultsProductCardOptions";
|
|
10
9
|
import { BadgeType } from "./types/search-results/BadgeOptions";
|
package/dist/es/index.min.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
export { SortDirection } from '@getlupa/client-sdk/Types';
|
|
2
|
-
|
|
3
1
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
4
2
|
|
|
5
3
|
function getDefaultExportFromCjs (x) {
|
|
@@ -21891,8 +21889,8 @@ var DEFAULT_OPTIONS_RESULTS = {
|
|
|
21891
21889
|
}]
|
|
21892
21890
|
};
|
|
21893
21891
|
|
|
21894
|
-
var createPublicQuery = function createPublicQuery(queryParams, sortOptions // will be removed when vuex is implemented
|
|
21895
|
-
) {
|
|
21892
|
+
var createPublicQuery = function createPublicQuery(queryParams, sortOptions, // will be removed when vuex is implemented
|
|
21893
|
+
defaultPageSize) {
|
|
21896
21894
|
var _a;
|
|
21897
21895
|
|
|
21898
21896
|
var publicQuery = {};
|
|
@@ -21910,11 +21908,11 @@ var createPublicQuery = function createPublicQuery(queryParams, sortOptions // w
|
|
|
21910
21908
|
break;
|
|
21911
21909
|
|
|
21912
21910
|
case QUERY_PARAMS_PARSED.LIMIT:
|
|
21913
|
-
publicQuery.limit = Number(value);
|
|
21911
|
+
publicQuery.limit = Number(value) || defaultPageSize;
|
|
21914
21912
|
break;
|
|
21915
21913
|
|
|
21916
21914
|
case QUERY_PARAMS_PARSED.PAGE:
|
|
21917
|
-
publicQuery.offset = getOffset(Number(value), Number(queryParams[QUERY_PARAMS_PARSED.LIMIT]) || DEFAULT_OPTIONS_RESULTS.pagination.sizeSelection.sizes[0]);
|
|
21915
|
+
publicQuery.offset = getOffset(Number(value), Number(queryParams[QUERY_PARAMS_PARSED.LIMIT]) || defaultPageSize || DEFAULT_OPTIONS_RESULTS.pagination.sizeSelection.sizes[0]);
|
|
21918
21916
|
break;
|
|
21919
21917
|
|
|
21920
21918
|
case QUERY_PARAMS_PARSED.SORT:
|
|
@@ -27452,6 +27450,16 @@ var handleRoutingEvent = function handleRoutingEvent(link, event) {
|
|
|
27452
27450
|
event === null || event === void 0 ? void 0 : event.preventDefault();
|
|
27453
27451
|
emitRoutingEvent(link);
|
|
27454
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
|
+
};
|
|
27455
27463
|
|
|
27456
27464
|
var CategoryFilterItem = /*#__PURE__*/function (_Vue) {
|
|
27457
27465
|
_inherits(CategoryFilterItem, _Vue);
|
|
@@ -30563,6 +30571,35 @@ var SearchResultsPageSelect = /*#__PURE__*/function (_Vue) {
|
|
|
30563
30571
|
return i && i >= left && i < right;
|
|
30564
30572
|
});
|
|
30565
30573
|
}
|
|
30574
|
+
}, {
|
|
30575
|
+
key: "lastPage",
|
|
30576
|
+
get: function get() {
|
|
30577
|
+
var _a;
|
|
30578
|
+
|
|
30579
|
+
return (_a = this.options.count) !== null && _a !== void 0 ? _a : undefined;
|
|
30580
|
+
}
|
|
30581
|
+
}, {
|
|
30582
|
+
key: "showLastPage",
|
|
30583
|
+
get: function get() {
|
|
30584
|
+
return Boolean(this.lastPage && !this.pages.includes(this.lastPage));
|
|
30585
|
+
}
|
|
30586
|
+
}, {
|
|
30587
|
+
key: "showLastPageSeparator",
|
|
30588
|
+
get: function get() {
|
|
30589
|
+
var _a;
|
|
30590
|
+
|
|
30591
|
+
return this.showLastPage && !this.pages.includes(((_a = this.lastPage) !== null && _a !== void 0 ? _a : 0) - 1);
|
|
30592
|
+
}
|
|
30593
|
+
}, {
|
|
30594
|
+
key: "showFirstPage",
|
|
30595
|
+
get: function get() {
|
|
30596
|
+
return !this.pages.includes(1);
|
|
30597
|
+
}
|
|
30598
|
+
}, {
|
|
30599
|
+
key: "showFirstPageSeparator",
|
|
30600
|
+
get: function get() {
|
|
30601
|
+
return this.showFirstPage && !this.pages.includes(2);
|
|
30602
|
+
}
|
|
30566
30603
|
}, {
|
|
30567
30604
|
key: "handlePageChange",
|
|
30568
30605
|
value: function handlePageChange(page) {
|
|
@@ -30619,7 +30656,16 @@ var __vue_render__$i = function __vue_render__() {
|
|
|
30619
30656
|
return _vm.handlePageChange(_vm.options.selectedPage - 1);
|
|
30620
30657
|
}
|
|
30621
30658
|
}
|
|
30622
|
-
}, [_vm._v("\n <\n ")]) : _vm._e(), _vm._v(" "), _vm.
|
|
30659
|
+
}, [_vm._v("\n <\n ")]) : _vm._e(), _vm._v(" "), _vm.showFirstPage ? [_c("div", {
|
|
30660
|
+
staticClass: "lupa-page-number lupa-page-number-first",
|
|
30661
|
+
on: {
|
|
30662
|
+
click: function click() {
|
|
30663
|
+
return _vm.handlePageChange(1);
|
|
30664
|
+
}
|
|
30665
|
+
}
|
|
30666
|
+
}, [_vm._v("\n 1\n ")]), _vm._v(" "), _vm.showFirstPageSeparator ? _c("div", {
|
|
30667
|
+
staticClass: "lupa-page-number-separator"
|
|
30668
|
+
}, [_vm._v("\n ...\n ")]) : _vm._e()] : _vm._e(), _vm._v(" "), _vm._l(_vm.pages, function (page) {
|
|
30623
30669
|
return _c("div", {
|
|
30624
30670
|
key: page,
|
|
30625
30671
|
class: ["lupa-page-number", page === _vm.options.selectedPage ? "lupa-page-number-selected" : ""],
|
|
@@ -30632,7 +30678,16 @@ var __vue_render__$i = function __vue_render__() {
|
|
|
30632
30678
|
}
|
|
30633
30679
|
}
|
|
30634
30680
|
}, [_vm._v("\n " + _vm._s(page) + "\n ")]);
|
|
30635
|
-
}), _vm._v(" "), _vm.
|
|
30681
|
+
}), _vm._v(" "), _vm.showLastPage ? [_vm.showLastPageSeparator ? _c("div", {
|
|
30682
|
+
staticClass: "lupa-page-number-separator"
|
|
30683
|
+
}, [_vm._v("\n ...\n ")]) : _vm._e(), _vm._v(" "), _c("div", {
|
|
30684
|
+
staticClass: "lupa-page-number lupa-page-number-last",
|
|
30685
|
+
on: {
|
|
30686
|
+
click: function click() {
|
|
30687
|
+
return _vm.handlePageChange(_vm.lastPage);
|
|
30688
|
+
}
|
|
30689
|
+
}
|
|
30690
|
+
}, [_vm._v("\n " + _vm._s(_vm.lastPage) + "\n ")])] : _vm._e(), _vm._v(" "), _vm.options.selectedPage < _vm.options.count ? _c("div", {
|
|
30636
30691
|
class: _vm.label === ">" ? "lupa-page-arrow" : "lupa-show-more",
|
|
30637
30692
|
attrs: {
|
|
30638
30693
|
"data-cy": "lupa-show-more"
|
|
@@ -32337,10 +32392,10 @@ var SearchResults = /*#__PURE__*/function (_Vue) {
|
|
|
32337
32392
|
key: "mounted",
|
|
32338
32393
|
value: function mounted() {
|
|
32339
32394
|
window.addEventListener("resize", this.handleResize);
|
|
32340
|
-
this.handleMounted();
|
|
32341
32395
|
this.setSearchResultOptions({
|
|
32342
32396
|
options: this.options
|
|
32343
32397
|
});
|
|
32398
|
+
this.handleMounted();
|
|
32344
32399
|
this.setInitialFilters({
|
|
32345
32400
|
initialFilters: this.initialFilters
|
|
32346
32401
|
});
|
|
@@ -32370,7 +32425,7 @@ var SearchResults = /*#__PURE__*/function (_Vue) {
|
|
|
32370
32425
|
key: "handleUrlChange",
|
|
32371
32426
|
value: function handleUrlChange(params) {
|
|
32372
32427
|
var searchParams = params || new URLSearchParams(window.location.search);
|
|
32373
|
-
var publicQuery = createPublicQuery(parseParams(searchParams), this.options.sort);
|
|
32428
|
+
var publicQuery = createPublicQuery(parseParams(searchParams), this.options.sort, this.defaultSearchResultPageSize);
|
|
32374
32429
|
this.setLoading(true);
|
|
32375
32430
|
this.query(getPublicQuery(publicQuery, this.initialFilters, this.isProductList));
|
|
32376
32431
|
}
|
|
@@ -32384,7 +32439,10 @@ var SearchResults = /*#__PURE__*/function (_Vue) {
|
|
|
32384
32439
|
query: publicQuery
|
|
32385
32440
|
});
|
|
32386
32441
|
var context = getLupaTrackingContext();
|
|
32387
|
-
var
|
|
32442
|
+
var limit = publicQuery.limit || this.defaultSearchResultPageSize;
|
|
32443
|
+
var query = Object.assign(Object.assign(Object.assign({}, publicQuery), context), {
|
|
32444
|
+
limit: limit
|
|
32445
|
+
});
|
|
32388
32446
|
getLupaSdk.query(this.options.queryKey, query, this.options.options).then(function (res) {
|
|
32389
32447
|
var _a, _b;
|
|
32390
32448
|
|
|
@@ -32493,6 +32551,8 @@ __decorate([searchResult$1.Action("add")], SearchResults.prototype, "addSearchRe
|
|
|
32493
32551
|
|
|
32494
32552
|
__decorate([searchResult$1.Action("setLoading")], SearchResults.prototype, "setLoading", void 0);
|
|
32495
32553
|
|
|
32554
|
+
__decorate([options$1.Getter("defaultSearchResultPageSize")], SearchResults.prototype, "defaultSearchResultPageSize", void 0);
|
|
32555
|
+
|
|
32496
32556
|
__decorate([searchResult$1.Action("setColumnCount")], SearchResults.prototype, "setColumnCount", void 0);
|
|
32497
32557
|
|
|
32498
32558
|
SearchResults = __decorate([Component({
|
|
@@ -34207,7 +34267,7 @@ var ParamsModule = /*#__PURE__*/function (_VuexModule) {
|
|
|
34207
34267
|
}, {
|
|
34208
34268
|
key: "limit",
|
|
34209
34269
|
get: function get() {
|
|
34210
|
-
return Number(this.params[QUERY_PARAMS_PARSED.LIMIT]) || this.defaultLimit;
|
|
34270
|
+
return Number(this.params[QUERY_PARAMS_PARSED.LIMIT]) || this.context.rootGetters["options/defaultSearchResultPageSize"] || this.defaultLimit;
|
|
34211
34271
|
}
|
|
34212
34272
|
}, {
|
|
34213
34273
|
key: "sort",
|
|
@@ -34283,6 +34343,8 @@ var ParamsModule = /*#__PURE__*/function (_VuexModule) {
|
|
|
34283
34343
|
var searchText = _ref3.searchText,
|
|
34284
34344
|
facet = _ref3.facet;
|
|
34285
34345
|
|
|
34346
|
+
var _a;
|
|
34347
|
+
|
|
34286
34348
|
if (!this.searchResultsLink || this.searchResultsLink === window.location.pathname) {
|
|
34287
34349
|
var facetParam = facet ? [getFacetParam(facet.key, [facet.title])] : [];
|
|
34288
34350
|
this.context.dispatch("appendParams", {
|
|
@@ -34293,7 +34355,8 @@ var ParamsModule = /*#__PURE__*/function (_VuexModule) {
|
|
|
34293
34355
|
paramsToRemove: "all"
|
|
34294
34356
|
});
|
|
34295
34357
|
} else {
|
|
34296
|
-
|
|
34358
|
+
var routing = (_a = this.context.rootGetters["options/boxRoutingBehavior"]) !== null && _a !== void 0 ? _a : "direct-link";
|
|
34359
|
+
redirectToResultsPage(this.searchResultsLink, searchText, facet, routing);
|
|
34297
34360
|
}
|
|
34298
34361
|
|
|
34299
34362
|
this.context.dispatch("tracking/track", {
|
|
@@ -34439,6 +34502,20 @@ var OptionsModule = /*#__PURE__*/function (_VuexModule) {
|
|
|
34439
34502
|
get: function get() {
|
|
34440
34503
|
return this.searchResultInitialFilters;
|
|
34441
34504
|
}
|
|
34505
|
+
}, {
|
|
34506
|
+
key: "boxRoutingBehavior",
|
|
34507
|
+
get: function get() {
|
|
34508
|
+
var _a;
|
|
34509
|
+
|
|
34510
|
+
return (_a = this.searchBoxOptions.routingBehavior) !== null && _a !== void 0 ? _a : "direct-link";
|
|
34511
|
+
}
|
|
34512
|
+
}, {
|
|
34513
|
+
key: "defaultSearchResultPageSize",
|
|
34514
|
+
get: function get() {
|
|
34515
|
+
var _a, _b, _c, _d, _e;
|
|
34516
|
+
|
|
34517
|
+
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;
|
|
34518
|
+
}
|
|
34442
34519
|
}, {
|
|
34443
34520
|
key: "setSearchBoxOptions",
|
|
34444
34521
|
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;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Environment } from "@getlupa/client-sdk/Types";
|
|
2
1
|
import { AnalyticsOptions } from "./AnalyticsOptions";
|
|
2
|
+
import { Environment as SdkEnvironment, SortDirection as SdkSortDirection } from "@getlupa/client-sdk/Types";
|
|
3
3
|
export declare type SdkOptions = {
|
|
4
|
-
environment:
|
|
4
|
+
environment: SdkEnvironment;
|
|
5
5
|
customUrl?: string;
|
|
6
6
|
customPayload?: Record<string, unknown>;
|
|
7
7
|
customHeaders?: Record<string, string>;
|
|
@@ -14,3 +14,5 @@ export declare type TrackingOptions = {
|
|
|
14
14
|
userKey?: string;
|
|
15
15
|
analytics?: AnalyticsOptions;
|
|
16
16
|
};
|
|
17
|
+
export declare type SortDirection = SdkSortDirection;
|
|
18
|
+
export declare type Environment = SdkEnvironment;
|
|
@@ -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;
|
|
@@ -51,6 +51,7 @@ export default class SearchResults extends Vue {
|
|
|
51
51
|
setLoading: (loading: boolean) => {
|
|
52
52
|
loading: boolean;
|
|
53
53
|
};
|
|
54
|
+
defaultSearchResultPageSize: number;
|
|
54
55
|
handleUrlChange(params?: URLSearchParams): void;
|
|
55
56
|
query(publicQuery: PublicQuery): void;
|
|
56
57
|
handleResults({ queryKey, results, }: {
|
package/dist/iife/components/search-results/products/pagination/SearchResultsPageSelect.vue.d.ts
CHANGED
|
@@ -5,6 +5,11 @@ export default class SearchResultsPageSelect extends Vue {
|
|
|
5
5
|
label: string;
|
|
6
6
|
options: PaginationPageSelect;
|
|
7
7
|
get pages(): number[];
|
|
8
|
+
get lastPage(): number | undefined;
|
|
9
|
+
get showLastPage(): boolean;
|
|
10
|
+
get showLastPageSeparator(): boolean;
|
|
11
|
+
get showFirstPage(): boolean;
|
|
12
|
+
get showFirstPageSeparator(): boolean;
|
|
8
13
|
appendParams: ({ params, paramsToRemove, }: {
|
|
9
14
|
params: {
|
|
10
15
|
name: string;
|
package/dist/iife/index.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { SearchBoxOptions } from "./types/search-box/SearchBoxOptions";
|
|
2
2
|
import { FacetStyle, SearchResultsOptions } from "./types/search-results/SearchResultsOptions";
|
|
3
|
-
import { SdkOptions, TrackingOptions } from "./types/General";
|
|
3
|
+
import { SdkOptions, TrackingOptions, Environment, SortDirection } from "./types/General";
|
|
4
4
|
import { ProductListOptions } from "./types/product-list/ProductListOptions";
|
|
5
5
|
import { DocumentElementType } from "./types/DocumentElement";
|
|
6
6
|
import { SearchBoxPanelType } from "./types/search-box/SearchBoxPanel";
|
|
7
|
-
import { Environment, SortDirection } from "@getlupa/client-sdk/Types";
|
|
8
7
|
import { RoutingBehavior } from "./types/search-results/RoutingBehavior";
|
|
9
8
|
import { AnchorPosition } from "./types/search-results/SearchResultsProductCardOptions";
|
|
10
9
|
import { BadgeType } from "./types/search-results/BadgeOptions";
|