@getlupa/client 0.6.0-alpha-20 → 0.6.0-alpha-23

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.
Files changed (32) hide show
  1. package/dist/cjs/components/product-list/CategoryDescription.vue.d.ts +0 -1
  2. package/dist/cjs/components/search-results/filters/MobileFilterSidebar.vue.d.ts +1 -1
  3. package/dist/cjs/components/search-results/products/SearchResultsMobileToggle.vue.d.ts +1 -1
  4. package/dist/cjs/components/search-results/products/SearchResultsProducts.vue.d.ts +8 -0
  5. package/dist/cjs/constants/development/searchResultsDev.example.const.d.ts +2 -0
  6. package/dist/cjs/constants/global.const.d.ts +1 -0
  7. package/dist/cjs/index.min.js +120 -47
  8. package/dist/cjs/store/modules/searchResult.d.ts +6 -0
  9. package/dist/cjs/types/search-results/SearchResultsOptions.d.ts +2 -0
  10. package/dist/cjs/utils/scroll.utils.d.ts +2 -0
  11. package/dist/es/components/product-list/CategoryDescription.vue.d.ts +0 -1
  12. package/dist/es/components/search-results/filters/MobileFilterSidebar.vue.d.ts +1 -1
  13. package/dist/es/components/search-results/products/SearchResultsMobileToggle.vue.d.ts +1 -1
  14. package/dist/es/components/search-results/products/SearchResultsProducts.vue.d.ts +8 -0
  15. package/dist/es/constants/development/searchResultsDev.example.const.d.ts +2 -0
  16. package/dist/es/constants/global.const.d.ts +1 -0
  17. package/dist/es/index.min.js +120 -47
  18. package/dist/es/store/modules/searchResult.d.ts +6 -0
  19. package/dist/es/types/search-results/SearchResultsOptions.d.ts +2 -0
  20. package/dist/es/utils/scroll.utils.d.ts +2 -0
  21. package/dist/iife/components/product-list/CategoryDescription.vue.d.ts +0 -1
  22. package/dist/iife/components/search-results/filters/MobileFilterSidebar.vue.d.ts +1 -1
  23. package/dist/iife/components/search-results/products/SearchResultsMobileToggle.vue.d.ts +1 -1
  24. package/dist/iife/components/search-results/products/SearchResultsProducts.vue.d.ts +8 -0
  25. package/dist/iife/constants/development/searchResultsDev.example.const.d.ts +2 -0
  26. package/dist/iife/constants/global.const.d.ts +1 -0
  27. package/dist/iife/index.min.js +1 -1
  28. package/dist/iife/store/modules/searchResult.d.ts +6 -0
  29. package/dist/iife/types/search-results/SearchResultsOptions.d.ts +2 -0
  30. package/dist/iife/utils/scroll.utils.d.ts +2 -0
  31. package/dist/style.css +1 -1
  32. package/package.json +1 -1
@@ -11915,6 +11915,7 @@ const XL_MIN_WIDTH = 1199;
11915
11915
  const MAX_FACET_VALUES = 5000;
11916
11916
  const CURRENCY_KEY_INDICATOR = "price";
11917
11917
  const DEFAULT_PAGE_SIZE = 12;
11918
+ const DEFAULT_PAGE_SIZE_SELECTION = [12, 24, 36, 60];
11918
11919
  const LUPA_ROUTING_EVENT = "lupaRedirect";
11919
11920
 
11920
11921
  const formatRange = (filter) => {
@@ -15755,6 +15756,17 @@ const scrollTo = (elementId) => {
15755
15756
  top: el.offsetTop,
15756
15757
  behavior: "smooth",
15757
15758
  });
15759
+ };
15760
+ const disableBodyScroll = () => {
15761
+ const scrollY = window.scrollY;
15762
+ document.body.style.position = "fixed";
15763
+ document.body.style.top = `-${scrollY}px`;
15764
+ };
15765
+ const enableBodyScroll = () => {
15766
+ const scrollY = document.body.style.top;
15767
+ document.body.style.position = "";
15768
+ document.body.style.top = "";
15769
+ window.scrollTo(0, parseInt(scrollY || "0") * -1);
15758
15770
  };
15759
15771
 
15760
15772
  const searchResult$g = namespace("searchResult");
@@ -16273,15 +16285,15 @@ let MobileFilterSidebar = class MobileFilterSidebar extends Vue$1 {
16273
16285
  return !((_b = (_a = this.options.currentFilters) === null || _a === void 0 ? void 0 : _a.mobileSidebar) === null || _b === void 0 ? void 0 : _b.activeFiltersExpanded);
16274
16286
  }
16275
16287
  handleMobileToggle() {
16276
- this.setSidebarVisibility({ visible: false });
16288
+ this.setSidebarState({ visible: false });
16277
16289
  }
16278
16290
  };
16279
16291
  __decorate([
16280
16292
  Prop()
16281
16293
  ], MobileFilterSidebar.prototype, "options", void 0);
16282
16294
  __decorate([
16283
- searchResult$f.Mutation("setSidebarVisibility")
16284
- ], MobileFilterSidebar.prototype, "setSidebarVisibility", void 0);
16295
+ searchResult$f.Action("setSidebarState")
16296
+ ], MobileFilterSidebar.prototype, "setSidebarState", void 0);
16285
16297
  __decorate([
16286
16298
  searchResult$f.State((state) => state.isMobileSidebarVisible)
16287
16299
  ], MobileFilterSidebar.prototype, "isMobileSidebarVisible", void 0);
@@ -16308,35 +16320,47 @@ var __vue_render__$C = function () {
16308
16320
  var _c = _vm._self._c || _h;
16309
16321
  return _vm.isMobileSidebarVisible
16310
16322
  ? _c("div", { staticClass: "lupa-mobile-filter-sidebar" }, [
16311
- _c("div", { staticClass: "lupa-sidebar-top" }, [
16312
- _c("div", { staticClass: "lupa-sidebar-title" }, [
16313
- _vm._v("\n " + _vm._s(_vm.sidebarTitle) + "\n "),
16314
- _vm.isFilterCountVisible
16315
- ? _c("span", { staticClass: "lupa-sidebar-filter-count" }, [
16316
- _vm._v(_vm._s(_vm.currentFilterCount)),
16317
- ])
16318
- : _vm._e(),
16323
+ _c("div", {
16324
+ staticClass: "lupa-sidebar-close",
16325
+ on: {
16326
+ click: function ($event) {
16327
+ $event.stopPropagation();
16328
+ return _vm.handleMobileToggle.apply(null, arguments)
16329
+ },
16330
+ },
16331
+ }),
16332
+ _vm._v(" "),
16333
+ _c("div", { staticClass: "lupa-mobile-sidebar-content" }, [
16334
+ _c("div", { staticClass: "lupa-sidebar-top" }, [
16335
+ _c("div", { staticClass: "lupa-sidebar-title" }, [
16336
+ _vm._v("\n " + _vm._s(_vm.sidebarTitle) + "\n "),
16337
+ _vm.isFilterCountVisible
16338
+ ? _c("span", { staticClass: "lupa-sidebar-filter-count" }, [
16339
+ _vm._v(_vm._s(_vm.currentFilterCount)),
16340
+ ])
16341
+ : _vm._e(),
16342
+ ]),
16343
+ _vm._v(" "),
16344
+ _c("div", {
16345
+ staticClass: "lupa-filter-toggle-mobile",
16346
+ on: { click: _vm.handleMobileToggle },
16347
+ }),
16319
16348
  ]),
16320
16349
  _vm._v(" "),
16321
- _c("div", {
16322
- staticClass: "lupa-filter-toggle-mobile",
16323
- on: { click: _vm.handleMobileToggle },
16324
- }),
16350
+ _c(
16351
+ "div",
16352
+ { staticClass: "lupa-sidebar-filter-options" },
16353
+ [
16354
+ _c("SearchResultsFilters", {
16355
+ attrs: {
16356
+ options: _vm.options,
16357
+ expandable: _vm.isActiveFiltersExpanded,
16358
+ },
16359
+ }),
16360
+ ],
16361
+ 1
16362
+ ),
16325
16363
  ]),
16326
- _vm._v(" "),
16327
- _c(
16328
- "div",
16329
- { staticClass: "lupa-sidebar-filter-options" },
16330
- [
16331
- _c("SearchResultsFilters", {
16332
- attrs: {
16333
- options: _vm.options,
16334
- expandable: _vm.isActiveFiltersExpanded,
16335
- },
16336
- }),
16337
- ],
16338
- 1
16339
- ),
16340
16364
  ])
16341
16365
  : _vm._e()
16342
16366
  };
@@ -19101,7 +19125,7 @@ __vue_render__$f._withStripped = true;
19101
19125
  const searchResult$8 = namespace("searchResult");
19102
19126
  let SearchResultsMobileToggle = class SearchResultsMobileToggle extends Vue$1 {
19103
19127
  handleMobileToggle() {
19104
- this.setSidebarVisibility({ visible: true });
19128
+ this.setSidebarState({ visible: true });
19105
19129
  }
19106
19130
  };
19107
19131
  __decorate([
@@ -19114,8 +19138,8 @@ __decorate([
19114
19138
  searchResult$8.Getter("currentFilterCount")
19115
19139
  ], SearchResultsMobileToggle.prototype, "currentFilterCount", void 0);
19116
19140
  __decorate([
19117
- searchResult$8.Mutation("setSidebarVisibility")
19118
- ], SearchResultsMobileToggle.prototype, "setSidebarVisibility", void 0);
19141
+ searchResult$8.Action("setSidebarState")
19142
+ ], SearchResultsMobileToggle.prototype, "setSidebarState", void 0);
19119
19143
  SearchResultsMobileToggle = __decorate([
19120
19144
  Component({
19121
19145
  name: "searchResultsMobileToggle",
@@ -19814,6 +19838,11 @@ let SearchResultsProducts = class SearchResultsProducts extends Vue$1 {
19814
19838
  getProductKey(index, product) {
19815
19839
  return getProductKey(index, product, this.options.idKey);
19816
19840
  }
19841
+ goToFirstPage() {
19842
+ this.appendParams({
19843
+ params: [{ name: QUERY_PARAMS.PAGE, value: "1" }],
19844
+ });
19845
+ }
19817
19846
  };
19818
19847
  __decorate([
19819
19848
  Prop()
@@ -19827,6 +19856,9 @@ __decorate([
19827
19856
  __decorate([
19828
19857
  searchResult$4.Getter("currentQueryText")
19829
19858
  ], SearchResultsProducts.prototype, "currentQueryText", void 0);
19859
+ __decorate([
19860
+ searchResult$4.Getter("isPageEmpty")
19861
+ ], SearchResultsProducts.prototype, "isPageEmpty", void 0);
19830
19862
  __decorate([
19831
19863
  searchResult$4.State((state) => state.isMobileSidebarVisible)
19832
19864
  ], SearchResultsProducts.prototype, "isMobileSidebarVisible", void 0);
@@ -19845,6 +19877,9 @@ __decorate([
19845
19877
  __decorate([
19846
19878
  params$2.Getter("page")
19847
19879
  ], SearchResultsProducts.prototype, "page", void 0);
19880
+ __decorate([
19881
+ params$2.Action("appendParams")
19882
+ ], SearchResultsProducts.prototype, "appendParams", void 0);
19848
19883
  SearchResultsProducts = __decorate([
19849
19884
  Component({
19850
19885
  name: "searchResultsProducts",
@@ -19871,10 +19906,7 @@ var __vue_render__$8 = function () {
19871
19906
  var _c = _vm._self._c || _h;
19872
19907
  return _c(
19873
19908
  "div",
19874
- {
19875
- style: { display: _vm.isMobileSidebarVisible ? "none" : "block" },
19876
- attrs: { id: "lupa-search-results-products" },
19877
- },
19909
+ { attrs: { id: "lupa-search-results-products" } },
19878
19910
  [
19879
19911
  _vm.loading && !_vm.isMobileSidebarVisible
19880
19912
  ? _c("spinner", { staticClass: "lupa-loader" })
@@ -19942,6 +19974,38 @@ var __vue_render__$8 = function () {
19942
19974
  1
19943
19975
  ),
19944
19976
  _vm._v(" "),
19977
+ _vm.isPageEmpty && _vm.options.labels.noItemsInPage
19978
+ ? _c(
19979
+ "div",
19980
+ {
19981
+ staticClass: "lupa-empty-results",
19982
+ attrs: { "data-cy": "lupa-no-results-in-page" },
19983
+ },
19984
+ [
19985
+ _vm._v(
19986
+ "\n " +
19987
+ _vm._s(_vm.options.labels.noItemsInPage) +
19988
+ "\n "
19989
+ ),
19990
+ _vm.options.labels.backToFirstPage
19991
+ ? _c(
19992
+ "span",
19993
+ {
19994
+ staticClass: "lupa-empty-page-action",
19995
+ on: { click: _vm.goToFirstPage },
19996
+ },
19997
+ [
19998
+ _vm._v(
19999
+ "\n " +
20000
+ _vm._s(_vm.options.labels.backToFirstPage)
20001
+ ),
20002
+ ]
20003
+ )
20004
+ : _vm._e(),
20005
+ ]
20006
+ )
20007
+ : _vm._e(),
20008
+ _vm._v(" "),
19945
20009
  _c("SearchResultsToolbar", {
19946
20010
  staticClass: "lupa-toolbar-bottom",
19947
20011
  attrs: { options: _vm.options, "pagination-location": "bottom" },
@@ -20751,17 +20815,13 @@ __vue_render__$3._withStripped = true;
20751
20815
  );
20752
20816
 
20753
20817
  let CategoryDescription = class CategoryDescription extends Vue$1 {
20754
- get title() {
20755
- var _a, _b;
20756
- return (_b = (_a = this.options.categories) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.title;
20757
- }
20758
20818
  get description() {
20759
20819
  var _a, _b;
20760
20820
  return (_b = (_a = this.options.categories) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.description;
20761
20821
  }
20762
20822
  get overviewVisible() {
20763
20823
  var _a, _b;
20764
- return Boolean((_b = (_a = this.options.categories) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.title);
20824
+ return Boolean((_b = (_a = this.options.categories) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.description);
20765
20825
  }
20766
20826
  };
20767
20827
  __decorate([
@@ -20787,10 +20847,6 @@ var __vue_render__$2 = function () {
20787
20847
  var _c = _vm._self._c || _h;
20788
20848
  return _vm.overviewVisible
20789
20849
  ? _c("div", { staticClass: "lupa-category-overview" }, [
20790
- _c("div", { staticClass: "lupa-category-title" }, [
20791
- _vm._v(_vm._s(_vm.title)),
20792
- ]),
20793
- _vm._v(" "),
20794
20850
  _c("div", {
20795
20851
  staticClass: "lupa-category-description",
20796
20852
  domProps: { innerHTML: _vm._s(_vm.description) },
@@ -21658,6 +21714,20 @@ let SearchResultModule = class SearchResultModule extends VuexModule {
21658
21714
  return "xl";
21659
21715
  }
21660
21716
  }
21717
+ get isPageEmpty() {
21718
+ var _a;
21719
+ return (this.hasResults && ((_a = this.searchResult.offset) !== null && _a !== void 0 ? _a : 0) >= this.totalItems);
21720
+ }
21721
+ setSidebarState({ visible }) {
21722
+ // Disable body scroll when sidebar is open and preserve scroll position when scrolling is closed
21723
+ if (visible) {
21724
+ disableBodyScroll();
21725
+ }
21726
+ else {
21727
+ enableBodyScroll();
21728
+ }
21729
+ return { visible };
21730
+ }
21661
21731
  setSidebarVisibility({ visible }) {
21662
21732
  this.isMobileSidebarVisible = visible;
21663
21733
  }
@@ -21737,6 +21807,9 @@ let SearchResultModule = class SearchResultModule extends VuexModule {
21737
21807
  return loading || false;
21738
21808
  }
21739
21809
  };
21810
+ __decorate([
21811
+ Action({ commit: "setSidebarVisibility" })
21812
+ ], SearchResultModule.prototype, "setSidebarState", null);
21740
21813
  __decorate([
21741
21814
  Mutation
21742
21815
  ], SearchResultModule.prototype, "setSidebarVisibility", null);
@@ -21970,8 +22043,8 @@ let OptionsModule = class OptionsModule extends VuexModule {
21970
22043
  return (_b = (_a = this.currentResolutionPageSizes) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : DEFAULT_PAGE_SIZE;
21971
22044
  }
21972
22045
  get currentResolutionPageSizes() {
21973
- var _a, _b, _c;
21974
- const pageSizes = (_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;
22046
+ var _a, _b, _c, _d;
22047
+ const pageSizes = (_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 ? _d : DEFAULT_PAGE_SIZE_SELECTION;
21975
22048
  if (Array.isArray(pageSizes)) {
21976
22049
  return pageSizes;
21977
22050
  }
@@ -26,6 +26,12 @@ export default class SearchResultModule extends VuexModule {
26
26
  get itemRange(): number[];
27
27
  get isMobileWidth(): boolean;
28
28
  get currentScreenWidth(): ScreenSize;
29
+ get isPageEmpty(): boolean;
30
+ setSidebarState({ visible }: {
31
+ visible: boolean;
32
+ }): {
33
+ visible: boolean;
34
+ };
29
35
  setSidebarVisibility({ visible }: {
30
36
  visible: boolean;
31
37
  }): void;
@@ -39,6 +39,8 @@ export declare type SearchResultsOptionLabels = SearchResultsPaginationLabels &
39
39
  mobileFilterButton: string;
40
40
  htmlTitleTemplate: string;
41
41
  outOfStock?: string;
42
+ noItemsInPage?: string;
43
+ backToFirstPage?: string;
42
44
  };
43
45
  export declare type SearchResultsAdditionalPanels = {
44
46
  additionalPanels?: SearchResultsAdditionalPanelOptions[];
@@ -1,2 +1,4 @@
1
1
  export declare const scrollToSearchResults: (timeout?: number) => void;
2
2
  export declare const scrollTo: (elementId: string) => void;
3
+ export declare const disableBodyScroll: () => void;
4
+ export declare const enableBodyScroll: () => void;
@@ -2,7 +2,6 @@ import Vue from "vue";
2
2
  import { ProductListOptions } from "@/types/product-list/ProductListOptions";
3
3
  export default class CategoryDescription extends Vue {
4
4
  options: ProductListOptions;
5
- get title(): string | undefined;
6
5
  get description(): string | undefined;
7
6
  get overviewVisible(): boolean;
8
7
  }
@@ -2,7 +2,7 @@ import { SearchResultsFilterOptions } from "@/types/search-results/SearchResults
2
2
  import Vue from "vue";
3
3
  export default class MobileFilterSidebar extends Vue {
4
4
  options: SearchResultsFilterOptions;
5
- setSidebarVisibility: ({ visible, }: {
5
+ setSidebarState: ({ visible, }: {
6
6
  visible: boolean;
7
7
  }) => void;
8
8
  isMobileSidebarVisible: boolean;
@@ -3,7 +3,7 @@ export default class SearchResultsMobileToggle extends Vue {
3
3
  label: string;
4
4
  showFilterCount: boolean;
5
5
  currentFilterCount: number;
6
- setSidebarVisibility: ({ visible, }: {
6
+ setSidebarState: ({ visible, }: {
7
7
  visible: boolean;
8
8
  }) => void;
9
9
  handleMobileToggle(): void;
@@ -8,6 +8,7 @@ export default class SearchResultsProducts extends Vue {
8
8
  loading: boolean;
9
9
  hasResults: boolean;
10
10
  currentQueryText: string;
11
+ isPageEmpty: boolean;
11
12
  isMobileSidebarVisible: boolean;
12
13
  productCardOptions(): SearchResultsProductCardOptions;
13
14
  get similarQueriesLabels(): SearchResultsSimilarQueriesLabels;
@@ -21,4 +22,11 @@ export default class SearchResultsProducts extends Vue {
21
22
  page: number;
22
23
  get columnSize(): string;
23
24
  getProductKey(index: string, product: Document): string;
25
+ appendParams: ({ params, }: {
26
+ params: {
27
+ name: string;
28
+ value: string;
29
+ }[];
30
+ }) => void;
31
+ goToFirstPage(): void;
24
32
  }
@@ -13,6 +13,8 @@ export declare const SEARCH_RESULTS_CONFIGURATION: {
13
13
  priceSeparator: string;
14
14
  showMore: string;
15
15
  emptyResults: string;
16
+ noItemsInPage: string;
17
+ backToFirstPage: string;
16
18
  mobileFilterButton: string;
17
19
  htmlTitleTemplate: string;
18
20
  noResultsSuggestion: string;
@@ -11,4 +11,5 @@ export declare const XL_MIN_WIDTH = 1199;
11
11
  export declare const MAX_FACET_VALUES = 5000;
12
12
  export declare const CURRENCY_KEY_INDICATOR = "price";
13
13
  export declare const DEFAULT_PAGE_SIZE = 12;
14
+ export declare const DEFAULT_PAGE_SIZE_SELECTION: number[];
14
15
  export declare const LUPA_ROUTING_EVENT = "lupaRedirect";