@ikas/storefront 0.0.148 → 0.0.150

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
@@ -18453,7 +18453,7 @@ var IkasProductFilter = /** @class */ (function () {
18453
18453
  else if (this.displayType === IkasProductFilterDisplayType.NUMBER_RANGE_LIST) {
18454
18454
  (_a = this.numberRangeListOptions) === null || _a === void 0 ? void 0 : _a.forEach(function (o) {
18455
18455
  if (valueKeys.includes(o.key))
18456
- o.isSelected = true;
18456
+ o._isSelected = true;
18457
18457
  });
18458
18458
  }
18459
18459
  else {
@@ -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()];
@@ -21271,6 +21271,8 @@ var IkasProductList = /** @class */ (function () {
21271
21271
  this.data = this.data.concat(data);
21272
21272
  this._count = response.count;
21273
21273
  this._page = this.page + 1;
21274
+ //@ts-ignore
21275
+ IkasStorefrontConfig.store.infiniteScrollPages[this._pageType] = this._page;
21274
21276
  return [3 /*break*/, 5];
21275
21277
  case 3:
21276
21278
  err_3 = _a.sent();
@@ -21360,6 +21362,9 @@ var IkasProductList = /** @class */ (function () {
21360
21362
  : null;
21361
21363
  this.router = router;
21362
21364
  makeAutoObservable(this);
21365
+ if (this.isBrowser()) {
21366
+ this.checkRestoreInfiniteScroll();
21367
+ }
21363
21368
  if (this.isBrowser() &&
21364
21369
  location.search &&
21365
21370
  (this.isFilterable || this._type === IkasProductListType.SEARCH)) {
@@ -21381,6 +21386,13 @@ var IkasProductList = /** @class */ (function () {
21381
21386
  enumerable: false,
21382
21387
  configurable: true
21383
21388
  });
21389
+ Object.defineProperty(IkasProductList.prototype, "pageType", {
21390
+ get: function () {
21391
+ return this._pageType;
21392
+ },
21393
+ enumerable: false,
21394
+ configurable: true
21395
+ });
21384
21396
  Object.defineProperty(IkasProductList.prototype, "page", {
21385
21397
  get: function () {
21386
21398
  return this._page;
@@ -21772,6 +21784,22 @@ var IkasProductList = /** @class */ (function () {
21772
21784
  productListPropValue: this._productListPropValue,
21773
21785
  };
21774
21786
  };
21787
+ IkasProductList.prototype.checkRestoreInfiniteScroll = function () {
21788
+ //@ts-ignore
21789
+ var infiniteScrollPages = IkasStorefrontConfig.store.infiniteScrollPages;
21790
+ var page = infiniteScrollPages[this._pageType];
21791
+ if (page) {
21792
+ if (this.hasForwardRoute()) {
21793
+ this._page = page;
21794
+ }
21795
+ else {
21796
+ delete infiniteScrollPages[this._pageType];
21797
+ }
21798
+ }
21799
+ };
21800
+ IkasProductList.prototype.hasForwardRoute = function () {
21801
+ return this.isBrowser() && !!window.history.forward;
21802
+ };
21775
21803
  IkasProductList.prototype.getQueryParams = function () {
21776
21804
  if (!this.isBrowser())
21777
21805
  return;
@@ -28684,7 +28712,9 @@ var AddressFormViewModel = /** @class */ (function () {
28684
28712
  get: function () {
28685
28713
  var list = this.countries.map(this.modelToOption);
28686
28714
  list.sort(function (a, b) {
28687
- return a.label.toLowerCase() > b.label.toLowerCase() ? 1 : -1;
28715
+ return a.label.toLocaleLowerCase("tr-TR") > b.label.toLocaleLowerCase("tr-TR")
28716
+ ? 1
28717
+ : -1;
28688
28718
  });
28689
28719
  return list;
28690
28720
  },
@@ -28707,7 +28737,13 @@ var AddressFormViewModel = /** @class */ (function () {
28707
28737
  });
28708
28738
  Object.defineProperty(AddressFormViewModel.prototype, "districtOptions", {
28709
28739
  get: function () {
28710
- return this.districts.map(this.modelToOption);
28740
+ var list = this.districts.map(this.modelToOption);
28741
+ list.sort(function (a, b) {
28742
+ return a.label.toLocaleLowerCase("tr-TR") > b.label.toLocaleLowerCase("tr-TR")
28743
+ ? 1
28744
+ : -1;
28745
+ });
28746
+ return list;
28711
28747
  },
28712
28748
  enumerable: false,
28713
28749
  configurable: true
@@ -31357,6 +31393,7 @@ var IkasBaseStore = /** @class */ (function () {
31357
31393
  this.showLocaleOptions = false;
31358
31394
  this.localeChecked = false;
31359
31395
  this.settingsSet = false;
31396
+ this.infiniteScrollPages = {}; // key is pageType
31360
31397
  this.customerStore = new IkasCustomerStore(this);
31361
31398
  this.cartStore = new IkasCartStore(this);
31362
31399
  makeObservable(this, {
package/build/index.js CHANGED
@@ -18449,7 +18449,7 @@ var IkasProductFilter = /** @class */ (function () {
18449
18449
  else if (this.displayType === exports.IkasProductFilterDisplayType.NUMBER_RANGE_LIST) {
18450
18450
  (_a = this.numberRangeListOptions) === null || _a === void 0 ? void 0 : _a.forEach(function (o) {
18451
18451
  if (valueKeys.includes(o.key))
18452
- o.isSelected = true;
18452
+ o._isSelected = true;
18453
18453
  });
18454
18454
  }
18455
18455
  else {
@@ -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()];
@@ -21254,6 +21254,8 @@ var IkasProductList = /** @class */ (function () {
21254
21254
  this.data = this.data.concat(data);
21255
21255
  this._count = response.count;
21256
21256
  this._page = this.page + 1;
21257
+ //@ts-ignore
21258
+ IkasStorefrontConfig.store.infiniteScrollPages[this._pageType] = this._page;
21257
21259
  return [3 /*break*/, 5];
21258
21260
  case 3:
21259
21261
  err_3 = _a.sent();
@@ -21343,6 +21345,9 @@ var IkasProductList = /** @class */ (function () {
21343
21345
  : null;
21344
21346
  this.router = router;
21345
21347
  mobx.makeAutoObservable(this);
21348
+ if (this.isBrowser()) {
21349
+ this.checkRestoreInfiniteScroll();
21350
+ }
21346
21351
  if (this.isBrowser() &&
21347
21352
  location.search &&
21348
21353
  (this.isFilterable || this._type === exports.IkasProductListType.SEARCH)) {
@@ -21364,6 +21369,13 @@ var IkasProductList = /** @class */ (function () {
21364
21369
  enumerable: false,
21365
21370
  configurable: true
21366
21371
  });
21372
+ Object.defineProperty(IkasProductList.prototype, "pageType", {
21373
+ get: function () {
21374
+ return this._pageType;
21375
+ },
21376
+ enumerable: false,
21377
+ configurable: true
21378
+ });
21367
21379
  Object.defineProperty(IkasProductList.prototype, "page", {
21368
21380
  get: function () {
21369
21381
  return this._page;
@@ -21755,6 +21767,22 @@ var IkasProductList = /** @class */ (function () {
21755
21767
  productListPropValue: this._productListPropValue,
21756
21768
  };
21757
21769
  };
21770
+ IkasProductList.prototype.checkRestoreInfiniteScroll = function () {
21771
+ //@ts-ignore
21772
+ var infiniteScrollPages = IkasStorefrontConfig.store.infiniteScrollPages;
21773
+ var page = infiniteScrollPages[this._pageType];
21774
+ if (page) {
21775
+ if (this.hasForwardRoute()) {
21776
+ this._page = page;
21777
+ }
21778
+ else {
21779
+ delete infiniteScrollPages[this._pageType];
21780
+ }
21781
+ }
21782
+ };
21783
+ IkasProductList.prototype.hasForwardRoute = function () {
21784
+ return this.isBrowser() && !!window.history.forward;
21785
+ };
21758
21786
  IkasProductList.prototype.getQueryParams = function () {
21759
21787
  if (!this.isBrowser())
21760
21788
  return;
@@ -28663,7 +28691,9 @@ var AddressFormViewModel = /** @class */ (function () {
28663
28691
  get: function () {
28664
28692
  var list = this.countries.map(this.modelToOption);
28665
28693
  list.sort(function (a, b) {
28666
- return a.label.toLowerCase() > b.label.toLowerCase() ? 1 : -1;
28694
+ return a.label.toLocaleLowerCase("tr-TR") > b.label.toLocaleLowerCase("tr-TR")
28695
+ ? 1
28696
+ : -1;
28667
28697
  });
28668
28698
  return list;
28669
28699
  },
@@ -28686,7 +28716,13 @@ var AddressFormViewModel = /** @class */ (function () {
28686
28716
  });
28687
28717
  Object.defineProperty(AddressFormViewModel.prototype, "districtOptions", {
28688
28718
  get: function () {
28689
- return this.districts.map(this.modelToOption);
28719
+ var list = this.districts.map(this.modelToOption);
28720
+ list.sort(function (a, b) {
28721
+ return a.label.toLocaleLowerCase("tr-TR") > b.label.toLocaleLowerCase("tr-TR")
28722
+ ? 1
28723
+ : -1;
28724
+ });
28725
+ return list;
28690
28726
  },
28691
28727
  enumerable: false,
28692
28728
  configurable: true
@@ -31336,6 +31372,7 @@ var IkasBaseStore = /** @class */ (function () {
31336
31372
  this.showLocaleOptions = false;
31337
31373
  this.localeChecked = false;
31338
31374
  this.settingsSet = false;
31375
+ this.infiniteScrollPages = {}; // key is pageType
31339
31376
  this.customerStore = new IkasCustomerStore(this);
31340
31377
  this.cartStore = new IkasCartStore(this);
31341
31378
  mobx.makeObservable(this, {
@@ -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;
@@ -75,6 +76,8 @@ export declare class IkasProductList {
75
76
  recommendFor: string | null | undefined;
76
77
  productListPropValue: IkasProductListPropValue;
77
78
  };
79
+ private checkRestoreInfiniteScroll;
80
+ private hasForwardRoute;
78
81
  private getQueryParams;
79
82
  private isBrowser;
80
83
  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.148",
3
+ "version": "0.0.150",
4
4
  "main": "./build/index.js",
5
5
  "module": "./build/index.es.js",
6
6
  "author": "Umut Ozan Yıldırım",