@ikas/storefront 0.0.156 → 0.0.158-alpha.1

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
@@ -17476,6 +17476,7 @@ var IkasCustomerStore = /** @class */ (function () {
17476
17476
  this.tokenExpiry = null;
17477
17477
  this.baseStore = null;
17478
17478
  this._initialized = false;
17479
+ this._visitorSubscribedEmail = false;
17479
17480
  this.login = function (email, password) { return __awaiter(_this, void 0, void 0, function () {
17480
17481
  var response, cart;
17481
17482
  var _a;
@@ -17713,8 +17714,14 @@ var IkasCustomerStore = /** @class */ (function () {
17713
17714
  case 0: return [4 /*yield*/, IkasCustomerAPI.createCustomerEmailSubscription(email)];
17714
17715
  case 1:
17715
17716
  isSuccess = _a.sent();
17716
- if (isSuccess)
17717
+ if (isSuccess) {
17717
17718
  window.localStorage.setItem(LS_CUSTOMER_SUB_KEY, "true");
17719
+ if (this.customer)
17720
+ this.customer.subscriptionStatus ===
17721
+ IkasCustomerEmailSubscriptionStatus.SUBSCRIBED;
17722
+ else
17723
+ this._visitorSubscribedEmail = true;
17724
+ }
17718
17725
  return [2 /*return*/, isSuccess];
17719
17726
  }
17720
17727
  });
@@ -17733,7 +17740,7 @@ var IkasCustomerStore = /** @class */ (function () {
17733
17740
  Object.defineProperty(IkasCustomerStore.prototype, "canCreateEmailSubscription", {
17734
17741
  get: function () {
17735
17742
  var _a;
17736
- if (((_a = this.customer) === null || _a === void 0 ? void 0 : _a.isSubscribed) || isServer$3)
17743
+ if (((_a = this.customer) === null || _a === void 0 ? void 0 : _a.isSubscribed) || isServer$3 || this._visitorSubscribedEmail)
17737
17744
  return false;
17738
17745
  var alreadySubbed = window.localStorage.getItem(LS_CUSTOMER_SUB_KEY);
17739
17746
  return !alreadySubbed;
@@ -21458,13 +21465,25 @@ var IkasProductList = /** @class */ (function () {
21458
21465
  if (location.search &&
21459
21466
  (this.isFilterable || this._type === IkasProductListType.SEARCH)) {
21460
21467
  var queryParams = this.getQueryParams();
21461
- this.getInitial(queryParams);
21468
+ this.getInitial(queryParams, this._page > 1);
21462
21469
  }
21463
21470
  else if (this._page > 1) {
21464
21471
  this.getInitial(undefined, true);
21465
21472
  }
21466
21473
  }
21467
21474
  }
21475
+ Object.defineProperty(IkasProductList.prototype, "id", {
21476
+ get: function () {
21477
+ var id = this._productListPropValue.id;
21478
+ if (this._filterCategoryId)
21479
+ id += this._filterCategoryId;
21480
+ if (this._filterBrandId)
21481
+ id += this._filterBrandId;
21482
+ return id;
21483
+ },
21484
+ enumerable: false,
21485
+ configurable: true
21486
+ });
21468
21487
  Object.defineProperty(IkasProductList.prototype, "sort", {
21469
21488
  get: function () {
21470
21489
  return this._sort;
@@ -21493,6 +21512,13 @@ var IkasProductList = /** @class */ (function () {
21493
21512
  enumerable: false,
21494
21513
  configurable: true
21495
21514
  });
21515
+ Object.defineProperty(IkasProductList.prototype, "minPage", {
21516
+ get: function () {
21517
+ return this._minPage || 1;
21518
+ },
21519
+ enumerable: false,
21520
+ configurable: true
21521
+ });
21496
21522
  Object.defineProperty(IkasProductList.prototype, "count", {
21497
21523
  get: function () {
21498
21524
  return this._count;
@@ -21860,7 +21886,7 @@ var IkasProductList = /** @class */ (function () {
21860
21886
  IkasProductList.prototype.setVisibleInfiniteScrollPage = function (page) {
21861
21887
  //@ts-ignore
21862
21888
  var infiniteScrollPages = IkasStorefrontConfig.store.infiniteScrollPages;
21863
- infiniteScrollPages[this._productListPropValue.id] = page;
21889
+ infiniteScrollPages[this.id] = page;
21864
21890
  };
21865
21891
  IkasProductList.prototype.toJSON = function () {
21866
21892
  return {
@@ -21885,13 +21911,13 @@ var IkasProductList = /** @class */ (function () {
21885
21911
  IkasProductList.prototype.checkRestoreInfiniteScroll = function () {
21886
21912
  //@ts-ignore
21887
21913
  var infiniteScrollPages = IkasStorefrontConfig.store.infiniteScrollPages;
21888
- var page = infiniteScrollPages[this._productListPropValue.id];
21914
+ var page = infiniteScrollPages[this.id];
21889
21915
  if (page) {
21890
21916
  if (this.hasForwardRoute()) {
21891
21917
  this._page = page;
21892
21918
  }
21893
21919
  else {
21894
- delete infiniteScrollPages[this._productListPropValue.id];
21920
+ delete infiniteScrollPages[this.id];
21895
21921
  }
21896
21922
  }
21897
21923
  };
@@ -27666,7 +27692,7 @@ var IkasCustomerAPI = /** @class */ (function () {
27666
27692
  case 3:
27667
27693
  err_11 = _a.sent();
27668
27694
  console.log(err_11);
27669
- return [3 /*break*/, 4];
27695
+ return [2 /*return*/, false];
27670
27696
  case 4: return [2 /*return*/, true];
27671
27697
  }
27672
27698
  });
package/build/index.js CHANGED
@@ -17482,6 +17482,7 @@ var IkasCustomerStore = /** @class */ (function () {
17482
17482
  this.tokenExpiry = null;
17483
17483
  this.baseStore = null;
17484
17484
  this._initialized = false;
17485
+ this._visitorSubscribedEmail = false;
17485
17486
  this.login = function (email, password) { return __awaiter(_this, void 0, void 0, function () {
17486
17487
  var response, cart;
17487
17488
  var _a;
@@ -17719,8 +17720,14 @@ var IkasCustomerStore = /** @class */ (function () {
17719
17720
  case 0: return [4 /*yield*/, IkasCustomerAPI.createCustomerEmailSubscription(email)];
17720
17721
  case 1:
17721
17722
  isSuccess = _a.sent();
17722
- if (isSuccess)
17723
+ if (isSuccess) {
17723
17724
  window.localStorage.setItem(LS_CUSTOMER_SUB_KEY, "true");
17725
+ if (this.customer)
17726
+ this.customer.subscriptionStatus ===
17727
+ IkasCustomerEmailSubscriptionStatus.SUBSCRIBED;
17728
+ else
17729
+ this._visitorSubscribedEmail = true;
17730
+ }
17724
17731
  return [2 /*return*/, isSuccess];
17725
17732
  }
17726
17733
  });
@@ -17739,7 +17746,7 @@ var IkasCustomerStore = /** @class */ (function () {
17739
17746
  Object.defineProperty(IkasCustomerStore.prototype, "canCreateEmailSubscription", {
17740
17747
  get: function () {
17741
17748
  var _a;
17742
- if (((_a = this.customer) === null || _a === void 0 ? void 0 : _a.isSubscribed) || isServer$3)
17749
+ if (((_a = this.customer) === null || _a === void 0 ? void 0 : _a.isSubscribed) || isServer$3 || this._visitorSubscribedEmail)
17743
17750
  return false;
17744
17751
  var alreadySubbed = window.localStorage.getItem(LS_CUSTOMER_SUB_KEY);
17745
17752
  return !alreadySubbed;
@@ -21441,13 +21448,25 @@ var IkasProductList = /** @class */ (function () {
21441
21448
  if (location.search &&
21442
21449
  (this.isFilterable || this._type === exports.IkasProductListType.SEARCH)) {
21443
21450
  var queryParams = this.getQueryParams();
21444
- this.getInitial(queryParams);
21451
+ this.getInitial(queryParams, this._page > 1);
21445
21452
  }
21446
21453
  else if (this._page > 1) {
21447
21454
  this.getInitial(undefined, true);
21448
21455
  }
21449
21456
  }
21450
21457
  }
21458
+ Object.defineProperty(IkasProductList.prototype, "id", {
21459
+ get: function () {
21460
+ var id = this._productListPropValue.id;
21461
+ if (this._filterCategoryId)
21462
+ id += this._filterCategoryId;
21463
+ if (this._filterBrandId)
21464
+ id += this._filterBrandId;
21465
+ return id;
21466
+ },
21467
+ enumerable: false,
21468
+ configurable: true
21469
+ });
21451
21470
  Object.defineProperty(IkasProductList.prototype, "sort", {
21452
21471
  get: function () {
21453
21472
  return this._sort;
@@ -21476,6 +21495,13 @@ var IkasProductList = /** @class */ (function () {
21476
21495
  enumerable: false,
21477
21496
  configurable: true
21478
21497
  });
21498
+ Object.defineProperty(IkasProductList.prototype, "minPage", {
21499
+ get: function () {
21500
+ return this._minPage || 1;
21501
+ },
21502
+ enumerable: false,
21503
+ configurable: true
21504
+ });
21479
21505
  Object.defineProperty(IkasProductList.prototype, "count", {
21480
21506
  get: function () {
21481
21507
  return this._count;
@@ -21843,7 +21869,7 @@ var IkasProductList = /** @class */ (function () {
21843
21869
  IkasProductList.prototype.setVisibleInfiniteScrollPage = function (page) {
21844
21870
  //@ts-ignore
21845
21871
  var infiniteScrollPages = IkasStorefrontConfig.store.infiniteScrollPages;
21846
- infiniteScrollPages[this._productListPropValue.id] = page;
21872
+ infiniteScrollPages[this.id] = page;
21847
21873
  };
21848
21874
  IkasProductList.prototype.toJSON = function () {
21849
21875
  return {
@@ -21868,13 +21894,13 @@ var IkasProductList = /** @class */ (function () {
21868
21894
  IkasProductList.prototype.checkRestoreInfiniteScroll = function () {
21869
21895
  //@ts-ignore
21870
21896
  var infiniteScrollPages = IkasStorefrontConfig.store.infiniteScrollPages;
21871
- var page = infiniteScrollPages[this._productListPropValue.id];
21897
+ var page = infiniteScrollPages[this.id];
21872
21898
  if (page) {
21873
21899
  if (this.hasForwardRoute()) {
21874
21900
  this._page = page;
21875
21901
  }
21876
21902
  else {
21877
- delete infiniteScrollPages[this._productListPropValue.id];
21903
+ delete infiniteScrollPages[this.id];
21878
21904
  }
21879
21905
  }
21880
21906
  };
@@ -27645,7 +27671,7 @@ var IkasCustomerAPI = /** @class */ (function () {
27645
27671
  case 3:
27646
27672
  err_11 = _a.sent();
27647
27673
  console.log(err_11);
27648
- return [3 /*break*/, 4];
27674
+ return [2 /*return*/, false];
27649
27675
  case 4: return [2 /*return*/, true];
27650
27676
  }
27651
27677
  });
@@ -24,10 +24,12 @@ export declare class IkasProductList {
24
24
  private _fetchRequestTime;
25
25
  private router?;
26
26
  constructor(data: IkasProductListParams, router?: NextRouter);
27
+ private get id();
27
28
  get sort(): IkasProductListSortType;
28
29
  get limit(): number;
29
30
  get pageType(): IkasThemePageType;
30
31
  get page(): number;
32
+ get minPage(): number;
31
33
  get count(): number;
32
34
  get pageCount(): number;
33
35
  get searchKeyword(): string;
@@ -12,6 +12,7 @@ export declare class IkasCustomerStore {
12
12
  tokenExpiry?: number | null;
13
13
  private baseStore?;
14
14
  private _initialized;
15
+ private _visitorSubscribedEmail;
15
16
  constructor(baseStore?: IkasBaseStore);
16
17
  get initialized(): boolean;
17
18
  get canCreateEmailSubscription(): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "0.0.156",
3
+ "version": "0.0.158-alpha.1",
4
4
  "main": "./build/index.js",
5
5
  "module": "./build/index.es.js",
6
6
  "author": "Umut Ozan Yıldırım",