@ikas/storefront 0.0.73 → 0.0.74

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
@@ -19731,14 +19731,15 @@ var IkasProductList = /** @class */ (function () {
19731
19731
  this._fetchRequestTime = 0;
19732
19732
  this.router = null;
19733
19733
  this.applyFilters = function () { return __awaiter(_this, void 0, void 0, function () {
19734
+ var resultsSet;
19734
19735
  var _a, _b;
19735
19736
  return __generator(this, function (_c) {
19736
19737
  switch (_c.label) {
19737
19738
  case 0: return [4 /*yield*/, this.getInitial()];
19738
19739
  case 1:
19739
- _c.sent();
19740
+ resultsSet = _c.sent();
19740
19741
  // Change url params
19741
- if (this.isBrowser()) {
19742
+ if (resultsSet && this.isBrowser()) {
19742
19743
  if (this.isFiltered) {
19743
19744
  (_a = this.router) === null || _a === void 0 ? void 0 : _a.replace(location.pathname + "?" + this.filterQueryParams, undefined, { shallow: true });
19744
19745
  }
@@ -19772,6 +19773,14 @@ var IkasProductList = /** @class */ (function () {
19772
19773
  _a.label = 3;
19773
19774
  case 3:
19774
19775
  this.applyQueryParamFilters(queryParams);
19776
+ if (this.isSearch && !this.hasAppliedfilter) {
19777
+ this.data = [];
19778
+ this._page = 1;
19779
+ this._minPage = 1;
19780
+ this._count = 0;
19781
+ this._initialized = true;
19782
+ return [2 /*return*/];
19783
+ }
19775
19784
  if (this.isStatic) {
19776
19785
  page = undefined;
19777
19786
  limit = undefined;
@@ -19808,7 +19817,7 @@ var IkasProductList = /** @class */ (function () {
19808
19817
  this._initialized = true;
19809
19818
  this._page = page || 1;
19810
19819
  this._minPage = this.page;
19811
- return [3 /*break*/, 7];
19820
+ return [2 /*return*/, true];
19812
19821
  case 5:
19813
19822
  err_1 = _a.sent();
19814
19823
  console.log(err_1);
@@ -20054,6 +20063,13 @@ var IkasProductList = /** @class */ (function () {
20054
20063
  enumerable: false,
20055
20064
  configurable: true
20056
20065
  });
20066
+ Object.defineProperty(IkasProductList.prototype, "isSearch", {
20067
+ get: function () {
20068
+ return this._type === IkasProductListType.SEARCH;
20069
+ },
20070
+ enumerable: false,
20071
+ configurable: true
20072
+ });
20057
20073
  Object.defineProperty(IkasProductList.prototype, "hasPrev", {
20058
20074
  get: function () {
20059
20075
  if (this.isStatic ||
@@ -20104,6 +20120,14 @@ var IkasProductList = /** @class */ (function () {
20104
20120
  enumerable: false,
20105
20121
  configurable: true
20106
20122
  });
20123
+ Object.defineProperty(IkasProductList.prototype, "hasAppliedfilter", {
20124
+ get: function () {
20125
+ var _a;
20126
+ return (!!this._searchKeyword || ((_a = this.filters) === null || _a === void 0 ? void 0 : _a.some(function (f) { return !!f.valueList.length; })));
20127
+ },
20128
+ enumerable: false,
20129
+ configurable: true
20130
+ });
20107
20131
  IkasProductList.prototype.searchProducts = function (page, limit) {
20108
20132
  var _a, _b;
20109
20133
  return __awaiter(this, void 0, void 0, function () {
@@ -20263,6 +20287,7 @@ var IkasProductListType;
20263
20287
  IkasProductListType["DISCOUNTED"] = "DISCOUNTED";
20264
20288
  IkasProductListType["RECOMMENDED"] = "RECOMMENDED";
20265
20289
  IkasProductListType["CATEGORY"] = "CATEGORY";
20290
+ IkasProductListType["SEARCH"] = "SEARCH";
20266
20291
  })(IkasProductListType || (IkasProductListType = {}));
20267
20292
  var IkasProductListSortType;
20268
20293
  (function (IkasProductListSortType) {
package/build/index.js CHANGED
@@ -19714,14 +19714,15 @@ var IkasProductList = /** @class */ (function () {
19714
19714
  this._fetchRequestTime = 0;
19715
19715
  this.router = null;
19716
19716
  this.applyFilters = function () { return __awaiter(_this, void 0, void 0, function () {
19717
+ var resultsSet;
19717
19718
  var _a, _b;
19718
19719
  return __generator(this, function (_c) {
19719
19720
  switch (_c.label) {
19720
19721
  case 0: return [4 /*yield*/, this.getInitial()];
19721
19722
  case 1:
19722
- _c.sent();
19723
+ resultsSet = _c.sent();
19723
19724
  // Change url params
19724
- if (this.isBrowser()) {
19725
+ if (resultsSet && this.isBrowser()) {
19725
19726
  if (this.isFiltered) {
19726
19727
  (_a = this.router) === null || _a === void 0 ? void 0 : _a.replace(location.pathname + "?" + this.filterQueryParams, undefined, { shallow: true });
19727
19728
  }
@@ -19755,6 +19756,14 @@ var IkasProductList = /** @class */ (function () {
19755
19756
  _a.label = 3;
19756
19757
  case 3:
19757
19758
  this.applyQueryParamFilters(queryParams);
19759
+ if (this.isSearch && !this.hasAppliedfilter) {
19760
+ this.data = [];
19761
+ this._page = 1;
19762
+ this._minPage = 1;
19763
+ this._count = 0;
19764
+ this._initialized = true;
19765
+ return [2 /*return*/];
19766
+ }
19758
19767
  if (this.isStatic) {
19759
19768
  page = undefined;
19760
19769
  limit = undefined;
@@ -19791,7 +19800,7 @@ var IkasProductList = /** @class */ (function () {
19791
19800
  this._initialized = true;
19792
19801
  this._page = page || 1;
19793
19802
  this._minPage = this.page;
19794
- return [3 /*break*/, 7];
19803
+ return [2 /*return*/, true];
19795
19804
  case 5:
19796
19805
  err_1 = _a.sent();
19797
19806
  console.log(err_1);
@@ -20037,6 +20046,13 @@ var IkasProductList = /** @class */ (function () {
20037
20046
  enumerable: false,
20038
20047
  configurable: true
20039
20048
  });
20049
+ Object.defineProperty(IkasProductList.prototype, "isSearch", {
20050
+ get: function () {
20051
+ return this._type === exports.IkasProductListType.SEARCH;
20052
+ },
20053
+ enumerable: false,
20054
+ configurable: true
20055
+ });
20040
20056
  Object.defineProperty(IkasProductList.prototype, "hasPrev", {
20041
20057
  get: function () {
20042
20058
  if (this.isStatic ||
@@ -20087,6 +20103,14 @@ var IkasProductList = /** @class */ (function () {
20087
20103
  enumerable: false,
20088
20104
  configurable: true
20089
20105
  });
20106
+ Object.defineProperty(IkasProductList.prototype, "hasAppliedfilter", {
20107
+ get: function () {
20108
+ var _a;
20109
+ return (!!this._searchKeyword || ((_a = this.filters) === null || _a === void 0 ? void 0 : _a.some(function (f) { return !!f.valueList.length; })));
20110
+ },
20111
+ enumerable: false,
20112
+ configurable: true
20113
+ });
20090
20114
  IkasProductList.prototype.searchProducts = function (page, limit) {
20091
20115
  var _a, _b;
20092
20116
  return __awaiter(this, void 0, void 0, function () {
@@ -20245,6 +20269,7 @@ var IkasProductList = /** @class */ (function () {
20245
20269
  IkasProductListType["DISCOUNTED"] = "DISCOUNTED";
20246
20270
  IkasProductListType["RECOMMENDED"] = "RECOMMENDED";
20247
20271
  IkasProductListType["CATEGORY"] = "CATEGORY";
20272
+ IkasProductListType["SEARCH"] = "SEARCH";
20248
20273
  })(exports.IkasProductListType || (exports.IkasProductListType = {}));
20249
20274
  (function (IkasProductListSortType) {
20250
20275
  IkasProductListSortType["MOST_SOLD"] = "MOST_SOLD";
@@ -35,11 +35,13 @@ export declare class IkasProductList {
35
35
  get isStatic(): boolean;
36
36
  get isDiscounted(): boolean;
37
37
  get isRecommended(): boolean;
38
+ get isSearch(): boolean;
38
39
  get hasPrev(): boolean;
39
40
  get hasNext(): boolean;
40
41
  get isLoading(): boolean;
41
42
  get filterQueryParams(): string;
42
43
  get filterCategories(): IkasFilterCategory[] | undefined;
44
+ get hasAppliedfilter(): boolean | undefined;
43
45
  private searchProducts;
44
46
  private getFilters;
45
47
  private applyQueryParamFilters;
@@ -94,7 +96,8 @@ export declare enum IkasProductListType {
94
96
  STATIC = "STATIC",
95
97
  DISCOUNTED = "DISCOUNTED",
96
98
  RECOMMENDED = "RECOMMENDED",
97
- CATEGORY = "CATEGORY"
99
+ CATEGORY = "CATEGORY",
100
+ SEARCH = "SEARCH"
98
101
  }
99
102
  export declare enum IkasProductListSortType {
100
103
  MOST_SOLD = "MOST_SOLD",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "0.0.73",
3
+ "version": "0.0.74",
4
4
  "main": "./build/index.js",
5
5
  "module": "./build/index.es.js",
6
6
  "author": "Umut Ozan Yıldırım",