@ikas/storefront 0.0.152 → 0.0.153

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/build/index.es.js CHANGED
@@ -21138,7 +21138,7 @@ var IkasProductList = /** @class */ (function () {
21138
21138
  _b.label = 1;
21139
21139
  case 1:
21140
21140
  _b.trys.push([1, 5, 6, 7]);
21141
- page = 1;
21141
+ page = this._page || 1;
21142
21142
  limit = this._limit;
21143
21143
  if (!(this.isFilterable && !this.filters)) return [3 /*break*/, 3];
21144
21144
  return [4 /*yield*/, this.getFilters()];
@@ -21360,6 +21360,9 @@ var IkasProductList = /** @class */ (function () {
21360
21360
  : null;
21361
21361
  this.router = router;
21362
21362
  makeAutoObservable(this);
21363
+ if (this.isBrowser()) {
21364
+ this.checkRestoreInfiniteScroll();
21365
+ }
21363
21366
  if (this.isBrowser() &&
21364
21367
  location.search &&
21365
21368
  (this.isFilterable || this._type === IkasProductListType.SEARCH)) {
@@ -21381,6 +21384,13 @@ var IkasProductList = /** @class */ (function () {
21381
21384
  enumerable: false,
21382
21385
  configurable: true
21383
21386
  });
21387
+ Object.defineProperty(IkasProductList.prototype, "pageType", {
21388
+ get: function () {
21389
+ return this._pageType;
21390
+ },
21391
+ enumerable: false,
21392
+ configurable: true
21393
+ });
21384
21394
  Object.defineProperty(IkasProductList.prototype, "page", {
21385
21395
  get: function () {
21386
21396
  return this._page;
@@ -21752,6 +21762,11 @@ var IkasProductList = /** @class */ (function () {
21752
21762
  });
21753
21763
  });
21754
21764
  };
21765
+ IkasProductList.prototype.setVisibleInfiniteScrollPage = function (page) {
21766
+ //@ts-ignore
21767
+ var infiniteScrollPages = IkasStorefrontConfig.store.infiniteScrollPages;
21768
+ infiniteScrollPages[this._productListPropValue.id] = page;
21769
+ };
21755
21770
  IkasProductList.prototype.toJSON = function () {
21756
21771
  return {
21757
21772
  data: this.data,
@@ -21772,6 +21787,22 @@ var IkasProductList = /** @class */ (function () {
21772
21787
  productListPropValue: this._productListPropValue,
21773
21788
  };
21774
21789
  };
21790
+ IkasProductList.prototype.checkRestoreInfiniteScroll = function () {
21791
+ //@ts-ignore
21792
+ var infiniteScrollPages = IkasStorefrontConfig.store.infiniteScrollPages;
21793
+ var page = infiniteScrollPages[this._productListPropValue.id];
21794
+ if (page) {
21795
+ if (this.hasForwardRoute()) {
21796
+ this._page = page;
21797
+ }
21798
+ else {
21799
+ delete infiniteScrollPages[this._productListPropValue.id];
21800
+ }
21801
+ }
21802
+ };
21803
+ IkasProductList.prototype.hasForwardRoute = function () {
21804
+ return this.isBrowser() && !!window.history.forward;
21805
+ };
21775
21806
  IkasProductList.prototype.getQueryParams = function () {
21776
21807
  if (!this.isBrowser())
21777
21808
  return;
@@ -23709,6 +23740,7 @@ var IkasProductListPropValue = /** @class */ (function () {
23709
23740
  // Example collections/man -> lists products inside the "man" category
23710
23741
  this.usePageFilter = null;
23711
23742
  this.category = null;
23743
+ this.id = data.id || "";
23712
23744
  this.productListType = data.productListType || IkasProductListType.ALL;
23713
23745
  this.initialSort = data.initialSort || IkasProductListSortType.LAST_ADDED;
23714
23746
  this.initialLimit = data.initialLimit || 20;
@@ -31366,6 +31398,7 @@ var IkasBaseStore = /** @class */ (function () {
31366
31398
  this.showLocaleOptions = false;
31367
31399
  this.localeChecked = false;
31368
31400
  this.settingsSet = false;
31401
+ this.infiniteScrollPages = {}; // key is productListPropValueId
31369
31402
  this.customerStore = new IkasCustomerStore(this);
31370
31403
  this.cartStore = new IkasCartStore(this);
31371
31404
  makeObservable(this, {
package/build/index.js CHANGED
@@ -21121,7 +21121,7 @@ var IkasProductList = /** @class */ (function () {
21121
21121
  _b.label = 1;
21122
21122
  case 1:
21123
21123
  _b.trys.push([1, 5, 6, 7]);
21124
- page = 1;
21124
+ page = this._page || 1;
21125
21125
  limit = this._limit;
21126
21126
  if (!(this.isFilterable && !this.filters)) return [3 /*break*/, 3];
21127
21127
  return [4 /*yield*/, this.getFilters()];
@@ -21343,6 +21343,9 @@ var IkasProductList = /** @class */ (function () {
21343
21343
  : null;
21344
21344
  this.router = router;
21345
21345
  mobx.makeAutoObservable(this);
21346
+ if (this.isBrowser()) {
21347
+ this.checkRestoreInfiniteScroll();
21348
+ }
21346
21349
  if (this.isBrowser() &&
21347
21350
  location.search &&
21348
21351
  (this.isFilterable || this._type === exports.IkasProductListType.SEARCH)) {
@@ -21364,6 +21367,13 @@ var IkasProductList = /** @class */ (function () {
21364
21367
  enumerable: false,
21365
21368
  configurable: true
21366
21369
  });
21370
+ Object.defineProperty(IkasProductList.prototype, "pageType", {
21371
+ get: function () {
21372
+ return this._pageType;
21373
+ },
21374
+ enumerable: false,
21375
+ configurable: true
21376
+ });
21367
21377
  Object.defineProperty(IkasProductList.prototype, "page", {
21368
21378
  get: function () {
21369
21379
  return this._page;
@@ -21735,6 +21745,11 @@ var IkasProductList = /** @class */ (function () {
21735
21745
  });
21736
21746
  });
21737
21747
  };
21748
+ IkasProductList.prototype.setVisibleInfiniteScrollPage = function (page) {
21749
+ //@ts-ignore
21750
+ var infiniteScrollPages = IkasStorefrontConfig.store.infiniteScrollPages;
21751
+ infiniteScrollPages[this._productListPropValue.id] = page;
21752
+ };
21738
21753
  IkasProductList.prototype.toJSON = function () {
21739
21754
  return {
21740
21755
  data: this.data,
@@ -21755,6 +21770,22 @@ var IkasProductList = /** @class */ (function () {
21755
21770
  productListPropValue: this._productListPropValue,
21756
21771
  };
21757
21772
  };
21773
+ IkasProductList.prototype.checkRestoreInfiniteScroll = function () {
21774
+ //@ts-ignore
21775
+ var infiniteScrollPages = IkasStorefrontConfig.store.infiniteScrollPages;
21776
+ var page = infiniteScrollPages[this._productListPropValue.id];
21777
+ if (page) {
21778
+ if (this.hasForwardRoute()) {
21779
+ this._page = page;
21780
+ }
21781
+ else {
21782
+ delete infiniteScrollPages[this._productListPropValue.id];
21783
+ }
21784
+ }
21785
+ };
21786
+ IkasProductList.prototype.hasForwardRoute = function () {
21787
+ return this.isBrowser() && !!window.history.forward;
21788
+ };
21758
21789
  IkasProductList.prototype.getQueryParams = function () {
21759
21790
  if (!this.isBrowser())
21760
21791
  return;
@@ -23689,6 +23720,7 @@ var IkasProductListPropValue = /** @class */ (function () {
23689
23720
  // Example collections/man -> lists products inside the "man" category
23690
23721
  this.usePageFilter = null;
23691
23722
  this.category = null;
23723
+ this.id = data.id || "";
23692
23724
  this.productListType = data.productListType || exports.IkasProductListType.ALL;
23693
23725
  this.initialSort = data.initialSort || exports.IkasProductListSortType.LAST_ADDED;
23694
23726
  this.initialLimit = data.initialLimit || 20;
@@ -31345,6 +31377,7 @@ var IkasBaseStore = /** @class */ (function () {
31345
31377
  this.showLocaleOptions = false;
31346
31378
  this.localeChecked = false;
31347
31379
  this.settingsSet = false;
31380
+ this.infiniteScrollPages = {}; // key is productListPropValueId
31348
31381
  this.customerStore = new IkasCustomerStore(this);
31349
31382
  this.cartStore = new IkasCartStore(this);
31350
31383
  mobx.makeObservable(this, {
@@ -1,5 +1,6 @@
1
1
  import { IkasProductListSortType, IkasProductListType } from "../../../../ui/index";
2
2
  export declare class IkasProductListPropValue {
3
+ id: string;
3
4
  productListType: IkasProductListType;
4
5
  initialSort?: IkasProductListSortType | null;
5
6
  initialLimit?: number | null;
@@ -26,6 +26,7 @@ export declare class IkasProductList {
26
26
  constructor(data: IkasProductListParams, router?: NextRouter);
27
27
  get sort(): IkasProductListSortType;
28
28
  get limit(): number;
29
+ get pageType(): IkasThemePageType;
29
30
  get page(): number;
30
31
  get count(): number;
31
32
  get pageCount(): number;
@@ -57,6 +58,7 @@ export declare class IkasProductList {
57
58
  getPage: (page: number) => Promise<void>;
58
59
  setSortType(sortType: IkasProductListSortType): Promise<void>;
59
60
  onFilterCategoryClick(filterCategory: IkasFilterCategory, disableRoute?: boolean): Promise<void>;
61
+ setVisibleInfiniteScrollPage(page: number): void;
60
62
  toJSON(): {
61
63
  data: IkasProductDetail[];
62
64
  type: IkasProductListType;
@@ -75,6 +77,8 @@ export declare class IkasProductList {
75
77
  recommendFor: string | null | undefined;
76
78
  productListPropValue: IkasProductListPropValue;
77
79
  };
80
+ private checkRestoreInfiniteScroll;
81
+ private hasForwardRoute;
78
82
  private getQueryParams;
79
83
  private isBrowser;
80
84
  private searchDebouncer;
@@ -10,6 +10,7 @@ export declare class IkasBaseStore {
10
10
  showLocaleOptions: boolean;
11
11
  private localeChecked;
12
12
  private settingsSet;
13
+ private infiniteScrollPages;
13
14
  constructor();
14
15
  checkLocalization(): Promise<void>;
15
16
  setLocalization(localeOption: IkasLocaleOption): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "0.0.152",
3
+ "version": "0.0.153",
4
4
  "main": "./build/index.js",
5
5
  "module": "./build/index.es.js",
6
6
  "author": "Umut Ozan Yıldırım",