@ikas/storefront 0.0.72 → 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 +31 -4
- package/build/index.js +31 -4
- package/build/models/ui/product-list/index.d.ts +5 -2
- package/package.json +1 -1
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 [
|
|
19820
|
+
return [2 /*return*/, true];
|
|
19812
19821
|
case 5:
|
|
19813
19822
|
err_1 = _a.sent();
|
|
19814
19823
|
console.log(err_1);
|
|
@@ -20028,7 +20037,7 @@ var IkasProductList = /** @class */ (function () {
|
|
|
20028
20037
|
Object.defineProperty(IkasProductList.prototype, "isFiltered", {
|
|
20029
20038
|
get: function () {
|
|
20030
20039
|
var _a;
|
|
20031
|
-
return (_a = this.filters) === null || _a === void 0 ? void 0 : _a.some(function (f) { return !!f.valueList.length; });
|
|
20040
|
+
return (((_a = this.filters) === null || _a === void 0 ? void 0 : _a.some(function (f) { return !!f.valueList.length; })) || !!this._searchKeyword);
|
|
20032
20041
|
},
|
|
20033
20042
|
enumerable: false,
|
|
20034
20043
|
configurable: true
|
|
@@ -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 ||
|
|
@@ -20089,6 +20105,8 @@ var IkasProductList = /** @class */ (function () {
|
|
|
20089
20105
|
(_a = this.filters) === null || _a === void 0 ? void 0 : _a.forEach(function (f) {
|
|
20090
20106
|
queryParams[f.key] = f.keyList;
|
|
20091
20107
|
});
|
|
20108
|
+
if (this._searchKeyword)
|
|
20109
|
+
queryParams.s = this._searchKeyword;
|
|
20092
20110
|
return queryString.stringify(queryParams, { arrayFormat: "comma" });
|
|
20093
20111
|
},
|
|
20094
20112
|
enumerable: false,
|
|
@@ -20102,6 +20120,14 @@ var IkasProductList = /** @class */ (function () {
|
|
|
20102
20120
|
enumerable: false,
|
|
20103
20121
|
configurable: true
|
|
20104
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
|
+
});
|
|
20105
20131
|
IkasProductList.prototype.searchProducts = function (page, limit) {
|
|
20106
20132
|
var _a, _b;
|
|
20107
20133
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -20261,6 +20287,7 @@ var IkasProductListType;
|
|
|
20261
20287
|
IkasProductListType["DISCOUNTED"] = "DISCOUNTED";
|
|
20262
20288
|
IkasProductListType["RECOMMENDED"] = "RECOMMENDED";
|
|
20263
20289
|
IkasProductListType["CATEGORY"] = "CATEGORY";
|
|
20290
|
+
IkasProductListType["SEARCH"] = "SEARCH";
|
|
20264
20291
|
})(IkasProductListType || (IkasProductListType = {}));
|
|
20265
20292
|
var IkasProductListSortType;
|
|
20266
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 [
|
|
19803
|
+
return [2 /*return*/, true];
|
|
19795
19804
|
case 5:
|
|
19796
19805
|
err_1 = _a.sent();
|
|
19797
19806
|
console.log(err_1);
|
|
@@ -20011,7 +20020,7 @@ var IkasProductList = /** @class */ (function () {
|
|
|
20011
20020
|
Object.defineProperty(IkasProductList.prototype, "isFiltered", {
|
|
20012
20021
|
get: function () {
|
|
20013
20022
|
var _a;
|
|
20014
|
-
return (_a = this.filters) === null || _a === void 0 ? void 0 : _a.some(function (f) { return !!f.valueList.length; });
|
|
20023
|
+
return (((_a = this.filters) === null || _a === void 0 ? void 0 : _a.some(function (f) { return !!f.valueList.length; })) || !!this._searchKeyword);
|
|
20015
20024
|
},
|
|
20016
20025
|
enumerable: false,
|
|
20017
20026
|
configurable: true
|
|
@@ -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 ||
|
|
@@ -20072,6 +20088,8 @@ var IkasProductList = /** @class */ (function () {
|
|
|
20072
20088
|
(_a = this.filters) === null || _a === void 0 ? void 0 : _a.forEach(function (f) {
|
|
20073
20089
|
queryParams[f.key] = f.keyList;
|
|
20074
20090
|
});
|
|
20091
|
+
if (this._searchKeyword)
|
|
20092
|
+
queryParams.s = this._searchKeyword;
|
|
20075
20093
|
return queryString.stringify(queryParams, { arrayFormat: "comma" });
|
|
20076
20094
|
},
|
|
20077
20095
|
enumerable: false,
|
|
@@ -20085,6 +20103,14 @@ var IkasProductList = /** @class */ (function () {
|
|
|
20085
20103
|
enumerable: false,
|
|
20086
20104
|
configurable: true
|
|
20087
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
|
+
});
|
|
20088
20114
|
IkasProductList.prototype.searchProducts = function (page, limit) {
|
|
20089
20115
|
var _a, _b;
|
|
20090
20116
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -20243,6 +20269,7 @@ var IkasProductList = /** @class */ (function () {
|
|
|
20243
20269
|
IkasProductListType["DISCOUNTED"] = "DISCOUNTED";
|
|
20244
20270
|
IkasProductListType["RECOMMENDED"] = "RECOMMENDED";
|
|
20245
20271
|
IkasProductListType["CATEGORY"] = "CATEGORY";
|
|
20272
|
+
IkasProductListType["SEARCH"] = "SEARCH";
|
|
20246
20273
|
})(exports.IkasProductListType || (exports.IkasProductListType = {}));
|
|
20247
20274
|
(function (IkasProductListSortType) {
|
|
20248
20275
|
IkasProductListSortType["MOST_SOLD"] = "MOST_SOLD";
|
|
@@ -31,15 +31,17 @@ export declare class IkasProductList {
|
|
|
31
31
|
set searchKeyword(value: string);
|
|
32
32
|
get isInitialized(): boolean;
|
|
33
33
|
get isFilterable(): boolean;
|
|
34
|
-
get isFiltered(): boolean
|
|
34
|
+
get isFiltered(): boolean;
|
|
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",
|