@ikas/storefront 0.0.56 → 0.0.57
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ProductFilterDisplayTypeEnum, ProductFilterTypeEnum, ProductFilterSortTypeEnum } from "../../../__generated__/global-types";
|
|
2
|
-
export interface
|
|
2
|
+
export interface getProductFilterData_getProductFilterData_filters_values {
|
|
3
3
|
__typename: "ApplicableProductFilterValue";
|
|
4
4
|
colorCode: string | null;
|
|
5
5
|
id: string;
|
|
@@ -7,15 +7,15 @@ export interface getProductFilterData_getProductFilterData_values {
|
|
|
7
7
|
name: string;
|
|
8
8
|
thumbnailImageId: string | null;
|
|
9
9
|
}
|
|
10
|
-
export interface
|
|
10
|
+
export interface getProductFilterData_getProductFilterData_filters_settings {
|
|
11
11
|
__typename: "ProductFilterSettings";
|
|
12
12
|
showCollapsedOnDesktop: boolean;
|
|
13
13
|
showCollapsedOnMobile: boolean;
|
|
14
14
|
sortType: ProductFilterSortTypeEnum;
|
|
15
15
|
useAndFilter: boolean | null;
|
|
16
16
|
}
|
|
17
|
-
export interface
|
|
18
|
-
__typename: "
|
|
17
|
+
export interface getProductFilterData_getProductFilterData_filters {
|
|
18
|
+
__typename: "ProductFilterDataFilter";
|
|
19
19
|
customValues: string[] | null;
|
|
20
20
|
displayType: ProductFilterDisplayTypeEnum;
|
|
21
21
|
id: string;
|
|
@@ -24,12 +24,27 @@ export interface getProductFilterData_getProductFilterData {
|
|
|
24
24
|
name: string;
|
|
25
25
|
order: number;
|
|
26
26
|
type: ProductFilterTypeEnum;
|
|
27
|
-
values:
|
|
28
|
-
settings:
|
|
27
|
+
values: getProductFilterData_getProductFilterData_filters_values[] | null;
|
|
28
|
+
settings: getProductFilterData_getProductFilterData_filters_settings | null;
|
|
29
|
+
}
|
|
30
|
+
export interface getProductFilterData_getProductFilterData_categories_metaData {
|
|
31
|
+
__typename: "HTMLMetaData";
|
|
32
|
+
slug: string;
|
|
33
|
+
}
|
|
34
|
+
export interface getProductFilterData_getProductFilterData_categories {
|
|
35
|
+
__typename: "Category";
|
|
36
|
+
id: string;
|
|
37
|
+
name: string;
|
|
38
|
+
metaData: getProductFilterData_getProductFilterData_categories_metaData | null;
|
|
39
|
+
}
|
|
40
|
+
export interface getProductFilterData_getProductFilterData {
|
|
41
|
+
__typename: "ProductFilterData";
|
|
42
|
+
filters: getProductFilterData_getProductFilterData_filters[];
|
|
43
|
+
categories: getProductFilterData_getProductFilterData_categories[] | null;
|
|
29
44
|
}
|
|
30
45
|
export interface getProductFilterData {
|
|
31
|
-
getProductFilterData: getProductFilterData_getProductFilterData
|
|
46
|
+
getProductFilterData: getProductFilterData_getProductFilterData;
|
|
32
47
|
}
|
|
33
48
|
export interface getProductFilterDataVariables {
|
|
34
|
-
|
|
49
|
+
categoryId?: string | null;
|
|
35
50
|
}
|
|
@@ -2,6 +2,7 @@ import { SearchInput } from "../../__generated__/global-types";
|
|
|
2
2
|
import { IkasProduct } from "../../models/index";
|
|
3
3
|
import * as SearchProductTypes from "./__generated__/searchProducts";
|
|
4
4
|
import { IkasProductFilter } from "../../models/data/product-filter/index";
|
|
5
|
+
import { IkasCategoryPath } from "../../models/data/category/index";
|
|
5
6
|
export declare class IkasProductSearchAPI {
|
|
6
7
|
static searchProducts(input: SearchInput): Promise<{
|
|
7
8
|
data: IkasProduct[];
|
|
@@ -12,5 +13,8 @@ export declare class IkasProductSearchAPI {
|
|
|
12
13
|
page: number;
|
|
13
14
|
totalCount: number;
|
|
14
15
|
} | undefined>;
|
|
15
|
-
static getProductFilterData(
|
|
16
|
+
static getProductFilterData(categoryId?: string): Promise<{
|
|
17
|
+
filters: IkasProductFilter[];
|
|
18
|
+
categories: IkasCategoryPath[] | null;
|
|
19
|
+
} | undefined>;
|
|
16
20
|
}
|
package/build/index.es.js
CHANGED
|
@@ -18512,6 +18512,7 @@ var IkasProductList = /** @class */ (function () {
|
|
|
18512
18512
|
function IkasProductList(data, router) {
|
|
18513
18513
|
var _this = this;
|
|
18514
18514
|
this.filters = null;
|
|
18515
|
+
this.filterCategories = null;
|
|
18515
18516
|
this._initialized = false;
|
|
18516
18517
|
this._minPage = null;
|
|
18517
18518
|
this._filterBrandId = null;
|
|
@@ -18748,6 +18749,9 @@ var IkasProductList = /** @class */ (function () {
|
|
|
18748
18749
|
this.filters = data.filters
|
|
18749
18750
|
? data.filters.map(function (f) { return new IkasProductFilter(f); })
|
|
18750
18751
|
: null;
|
|
18752
|
+
this.filterCategories = data.filterCategories
|
|
18753
|
+
? data.filterCategories.map(function (c) { return new IkasCategoryPath(c); })
|
|
18754
|
+
: null;
|
|
18751
18755
|
this.router = router;
|
|
18752
18756
|
makeAutoObservable(this);
|
|
18753
18757
|
if (this.isBrowser() && location.search) {
|
|
@@ -18924,14 +18928,14 @@ var IkasProductList = /** @class */ (function () {
|
|
|
18924
18928
|
};
|
|
18925
18929
|
IkasProductList.prototype.getFilters = function () {
|
|
18926
18930
|
return __awaiter(this, void 0, void 0, function () {
|
|
18927
|
-
var
|
|
18928
|
-
return __generator(this, function (
|
|
18929
|
-
switch (
|
|
18930
|
-
case 0:
|
|
18931
|
-
_a = this;
|
|
18932
|
-
return [4 /*yield*/, IkasProductSearchAPI.getProductFilterData()];
|
|
18931
|
+
var getFiltersResponse;
|
|
18932
|
+
return __generator(this, function (_a) {
|
|
18933
|
+
switch (_a.label) {
|
|
18934
|
+
case 0: return [4 /*yield*/, IkasProductSearchAPI.getProductFilterData(this._filterCategoryId ? this._filterCategoryId : undefined)];
|
|
18933
18935
|
case 1:
|
|
18934
|
-
|
|
18936
|
+
getFiltersResponse = _a.sent();
|
|
18937
|
+
this.filters = getFiltersResponse === null || getFiltersResponse === void 0 ? void 0 : getFiltersResponse.filters;
|
|
18938
|
+
this.filterCategories = getFiltersResponse === null || getFiltersResponse === void 0 ? void 0 : getFiltersResponse.categories;
|
|
18935
18939
|
if (this.filters)
|
|
18936
18940
|
this.filters.sort(function (f1, f2) { return (f1.order > f2.order ? 1 : -1); });
|
|
18937
18941
|
return [2 /*return*/];
|
|
@@ -18959,7 +18963,8 @@ var IkasProductList = /** @class */ (function () {
|
|
|
18959
18963
|
}
|
|
18960
18964
|
else {
|
|
18961
18965
|
(_c = filter.values) === null || _c === void 0 ? void 0 : _c.forEach(function (filterValue) {
|
|
18962
|
-
if (valueKeys.includes(filterValue.key)
|
|
18966
|
+
if (valueKeys.includes(filterValue.key) &&
|
|
18967
|
+
filterValue.resultCount !== 0)
|
|
18963
18968
|
filterValue.isSelected = true;
|
|
18964
18969
|
});
|
|
18965
18970
|
}
|
|
@@ -18994,6 +18999,10 @@ var IkasProductList = /** @class */ (function () {
|
|
|
18994
18999
|
}
|
|
18995
19000
|
});
|
|
18996
19001
|
};
|
|
19002
|
+
IkasProductList.prototype.onFilterCategoryClick = function (category) {
|
|
19003
|
+
var _a;
|
|
19004
|
+
(_a = this.router) === null || _a === void 0 ? void 0 : _a.push(category.href + window.location.search);
|
|
19005
|
+
};
|
|
18997
19006
|
IkasProductList.prototype.toJSON = function () {
|
|
18998
19007
|
return {
|
|
18999
19008
|
data: this.data,
|
|
@@ -23192,20 +23201,20 @@ var IkasProductSearchAPI = /** @class */ (function () {
|
|
|
23192
23201
|
});
|
|
23193
23202
|
});
|
|
23194
23203
|
};
|
|
23195
|
-
IkasProductSearchAPI.getProductFilterData = function (
|
|
23204
|
+
IkasProductSearchAPI.getProductFilterData = function (categoryId) {
|
|
23196
23205
|
return __awaiter(this, void 0, void 0, function () {
|
|
23197
23206
|
var QUERY, _a, data, errors, err_2;
|
|
23198
23207
|
return __generator(this, function (_b) {
|
|
23199
23208
|
switch (_b.label) {
|
|
23200
23209
|
case 0:
|
|
23201
23210
|
_b.trys.push([0, 2, , 3]);
|
|
23202
|
-
QUERY = src(templateObject_2$4 || (templateObject_2$4 = __makeTemplateObject(["\n query getProductFilterData($
|
|
23211
|
+
QUERY = src(templateObject_2$4 || (templateObject_2$4 = __makeTemplateObject(["\n query getProductFilterData($categoryId: String) {\n getProductFilterData(categoryId: $categoryId) {\n filters {\n customValues\n displayType\n id\n isMultiSelect\n key\n name\n order\n type\n values {\n colorCode\n id\n key\n name\n thumbnailImageId\n }\n settings {\n showCollapsedOnDesktop\n showCollapsedOnMobile\n sortType\n useAndFilter\n }\n }\n categories {\n id\n name\n metaData {\n slug\n }\n }\n }\n }\n "], ["\n query getProductFilterData($categoryId: String) {\n getProductFilterData(categoryId: $categoryId) {\n filters {\n customValues\n displayType\n id\n isMultiSelect\n key\n name\n order\n type\n values {\n colorCode\n id\n key\n name\n thumbnailImageId\n }\n settings {\n showCollapsedOnDesktop\n showCollapsedOnMobile\n sortType\n useAndFilter\n }\n }\n categories {\n id\n name\n metaData {\n slug\n }\n }\n }\n }\n "])));
|
|
23203
23212
|
return [4 /*yield*/, apollo
|
|
23204
23213
|
.getClient()
|
|
23205
23214
|
.query({
|
|
23206
23215
|
query: QUERY,
|
|
23207
23216
|
variables: {
|
|
23208
|
-
|
|
23217
|
+
categoryId: categoryId || null,
|
|
23209
23218
|
},
|
|
23210
23219
|
})];
|
|
23211
23220
|
case 1:
|
|
@@ -23214,12 +23223,24 @@ var IkasProductSearchAPI = /** @class */ (function () {
|
|
|
23214
23223
|
console.log(errors);
|
|
23215
23224
|
return [2 /*return*/];
|
|
23216
23225
|
}
|
|
23217
|
-
return [2 /*return*/,
|
|
23218
|
-
|
|
23219
|
-
|
|
23220
|
-
|
|
23221
|
-
|
|
23222
|
-
|
|
23226
|
+
return [2 /*return*/, {
|
|
23227
|
+
filters: data.getProductFilterData.filters.map(function (d) {
|
|
23228
|
+
var _a;
|
|
23229
|
+
return new IkasProductFilter(__assign(__assign({}, d), { displayType: d.displayType, type: d.type, values: (_a = d.values) === null || _a === void 0 ? void 0 : _a.map(function (v) { return new IkasApplicableProductFilterValue(v); }), settings: d.settings
|
|
23230
|
+
? new IkasProductFilterSettings(__assign(__assign({}, d.settings), { sortType: d.settings.sortType }))
|
|
23231
|
+
: null }));
|
|
23232
|
+
}),
|
|
23233
|
+
categories: data.getProductFilterData.categories
|
|
23234
|
+
? data.getProductFilterData.categories.map(function (c) {
|
|
23235
|
+
var _a;
|
|
23236
|
+
return new IkasCategoryPath({
|
|
23237
|
+
id: c.id,
|
|
23238
|
+
name: c.name,
|
|
23239
|
+
slug: (_a = c.metaData) === null || _a === void 0 ? void 0 : _a.slug,
|
|
23240
|
+
});
|
|
23241
|
+
})
|
|
23242
|
+
: null,
|
|
23243
|
+
}];
|
|
23223
23244
|
case 2:
|
|
23224
23245
|
err_2 = _b.sent();
|
|
23225
23246
|
console.log(err_2);
|
package/build/index.js
CHANGED
|
@@ -18493,6 +18493,7 @@ var IkasProductList = /** @class */ (function () {
|
|
|
18493
18493
|
function IkasProductList(data, router) {
|
|
18494
18494
|
var _this = this;
|
|
18495
18495
|
this.filters = null;
|
|
18496
|
+
this.filterCategories = null;
|
|
18496
18497
|
this._initialized = false;
|
|
18497
18498
|
this._minPage = null;
|
|
18498
18499
|
this._filterBrandId = null;
|
|
@@ -18729,6 +18730,9 @@ var IkasProductList = /** @class */ (function () {
|
|
|
18729
18730
|
this.filters = data.filters
|
|
18730
18731
|
? data.filters.map(function (f) { return new IkasProductFilter(f); })
|
|
18731
18732
|
: null;
|
|
18733
|
+
this.filterCategories = data.filterCategories
|
|
18734
|
+
? data.filterCategories.map(function (c) { return new IkasCategoryPath(c); })
|
|
18735
|
+
: null;
|
|
18732
18736
|
this.router = router;
|
|
18733
18737
|
mobx.makeAutoObservable(this);
|
|
18734
18738
|
if (this.isBrowser() && location.search) {
|
|
@@ -18905,14 +18909,14 @@ var IkasProductList = /** @class */ (function () {
|
|
|
18905
18909
|
};
|
|
18906
18910
|
IkasProductList.prototype.getFilters = function () {
|
|
18907
18911
|
return __awaiter(this, void 0, void 0, function () {
|
|
18908
|
-
var
|
|
18909
|
-
return __generator(this, function (
|
|
18910
|
-
switch (
|
|
18911
|
-
case 0:
|
|
18912
|
-
_a = this;
|
|
18913
|
-
return [4 /*yield*/, IkasProductSearchAPI.getProductFilterData()];
|
|
18912
|
+
var getFiltersResponse;
|
|
18913
|
+
return __generator(this, function (_a) {
|
|
18914
|
+
switch (_a.label) {
|
|
18915
|
+
case 0: return [4 /*yield*/, IkasProductSearchAPI.getProductFilterData(this._filterCategoryId ? this._filterCategoryId : undefined)];
|
|
18914
18916
|
case 1:
|
|
18915
|
-
|
|
18917
|
+
getFiltersResponse = _a.sent();
|
|
18918
|
+
this.filters = getFiltersResponse === null || getFiltersResponse === void 0 ? void 0 : getFiltersResponse.filters;
|
|
18919
|
+
this.filterCategories = getFiltersResponse === null || getFiltersResponse === void 0 ? void 0 : getFiltersResponse.categories;
|
|
18916
18920
|
if (this.filters)
|
|
18917
18921
|
this.filters.sort(function (f1, f2) { return (f1.order > f2.order ? 1 : -1); });
|
|
18918
18922
|
return [2 /*return*/];
|
|
@@ -18940,7 +18944,8 @@ var IkasProductList = /** @class */ (function () {
|
|
|
18940
18944
|
}
|
|
18941
18945
|
else {
|
|
18942
18946
|
(_c = filter.values) === null || _c === void 0 ? void 0 : _c.forEach(function (filterValue) {
|
|
18943
|
-
if (valueKeys.includes(filterValue.key)
|
|
18947
|
+
if (valueKeys.includes(filterValue.key) &&
|
|
18948
|
+
filterValue.resultCount !== 0)
|
|
18944
18949
|
filterValue.isSelected = true;
|
|
18945
18950
|
});
|
|
18946
18951
|
}
|
|
@@ -18975,6 +18980,10 @@ var IkasProductList = /** @class */ (function () {
|
|
|
18975
18980
|
}
|
|
18976
18981
|
});
|
|
18977
18982
|
};
|
|
18983
|
+
IkasProductList.prototype.onFilterCategoryClick = function (category) {
|
|
18984
|
+
var _a;
|
|
18985
|
+
(_a = this.router) === null || _a === void 0 ? void 0 : _a.push(category.href + window.location.search);
|
|
18986
|
+
};
|
|
18978
18987
|
IkasProductList.prototype.toJSON = function () {
|
|
18979
18988
|
return {
|
|
18980
18989
|
data: this.data,
|
|
@@ -23170,20 +23179,20 @@ var IkasProductSearchAPI = /** @class */ (function () {
|
|
|
23170
23179
|
});
|
|
23171
23180
|
});
|
|
23172
23181
|
};
|
|
23173
|
-
IkasProductSearchAPI.getProductFilterData = function (
|
|
23182
|
+
IkasProductSearchAPI.getProductFilterData = function (categoryId) {
|
|
23174
23183
|
return __awaiter(this, void 0, void 0, function () {
|
|
23175
23184
|
var QUERY, _a, data, errors, err_2;
|
|
23176
23185
|
return __generator(this, function (_b) {
|
|
23177
23186
|
switch (_b.label) {
|
|
23178
23187
|
case 0:
|
|
23179
23188
|
_b.trys.push([0, 2, , 3]);
|
|
23180
|
-
QUERY = src(templateObject_2$4 || (templateObject_2$4 = __makeTemplateObject(["\n query getProductFilterData($
|
|
23189
|
+
QUERY = src(templateObject_2$4 || (templateObject_2$4 = __makeTemplateObject(["\n query getProductFilterData($categoryId: String) {\n getProductFilterData(categoryId: $categoryId) {\n filters {\n customValues\n displayType\n id\n isMultiSelect\n key\n name\n order\n type\n values {\n colorCode\n id\n key\n name\n thumbnailImageId\n }\n settings {\n showCollapsedOnDesktop\n showCollapsedOnMobile\n sortType\n useAndFilter\n }\n }\n categories {\n id\n name\n metaData {\n slug\n }\n }\n }\n }\n "], ["\n query getProductFilterData($categoryId: String) {\n getProductFilterData(categoryId: $categoryId) {\n filters {\n customValues\n displayType\n id\n isMultiSelect\n key\n name\n order\n type\n values {\n colorCode\n id\n key\n name\n thumbnailImageId\n }\n settings {\n showCollapsedOnDesktop\n showCollapsedOnMobile\n sortType\n useAndFilter\n }\n }\n categories {\n id\n name\n metaData {\n slug\n }\n }\n }\n }\n "])));
|
|
23181
23190
|
return [4 /*yield*/, apollo
|
|
23182
23191
|
.getClient()
|
|
23183
23192
|
.query({
|
|
23184
23193
|
query: QUERY,
|
|
23185
23194
|
variables: {
|
|
23186
|
-
|
|
23195
|
+
categoryId: categoryId || null,
|
|
23187
23196
|
},
|
|
23188
23197
|
})];
|
|
23189
23198
|
case 1:
|
|
@@ -23192,12 +23201,24 @@ var IkasProductSearchAPI = /** @class */ (function () {
|
|
|
23192
23201
|
console.log(errors);
|
|
23193
23202
|
return [2 /*return*/];
|
|
23194
23203
|
}
|
|
23195
|
-
return [2 /*return*/,
|
|
23196
|
-
|
|
23197
|
-
|
|
23198
|
-
|
|
23199
|
-
|
|
23200
|
-
|
|
23204
|
+
return [2 /*return*/, {
|
|
23205
|
+
filters: data.getProductFilterData.filters.map(function (d) {
|
|
23206
|
+
var _a;
|
|
23207
|
+
return new IkasProductFilter(__assign(__assign({}, d), { displayType: d.displayType, type: d.type, values: (_a = d.values) === null || _a === void 0 ? void 0 : _a.map(function (v) { return new IkasApplicableProductFilterValue(v); }), settings: d.settings
|
|
23208
|
+
? new IkasProductFilterSettings(__assign(__assign({}, d.settings), { sortType: d.settings.sortType }))
|
|
23209
|
+
: null }));
|
|
23210
|
+
}),
|
|
23211
|
+
categories: data.getProductFilterData.categories
|
|
23212
|
+
? data.getProductFilterData.categories.map(function (c) {
|
|
23213
|
+
var _a;
|
|
23214
|
+
return new IkasCategoryPath({
|
|
23215
|
+
id: c.id,
|
|
23216
|
+
name: c.name,
|
|
23217
|
+
slug: (_a = c.metaData) === null || _a === void 0 ? void 0 : _a.slug,
|
|
23218
|
+
});
|
|
23219
|
+
})
|
|
23220
|
+
: null,
|
|
23221
|
+
}];
|
|
23201
23222
|
case 2:
|
|
23202
23223
|
err_2 = _b.sent();
|
|
23203
23224
|
console.log(err_2);
|
|
@@ -2,9 +2,11 @@ import { IkasProductListPropValue } from "../../theme/index";
|
|
|
2
2
|
import { IkasProductDetail } from "../product-detail/index";
|
|
3
3
|
import { IkasProductFilter } from "../../data/product-filter/index";
|
|
4
4
|
import { NextRouter } from "next/router";
|
|
5
|
+
import { IkasCategoryPath } from "../../data/category/index";
|
|
5
6
|
export declare class IkasProductList {
|
|
6
7
|
data: IkasProductDetail[];
|
|
7
8
|
filters?: IkasProductFilter[] | null;
|
|
9
|
+
filterCategories?: IkasCategoryPath[] | null;
|
|
8
10
|
private _type;
|
|
9
11
|
private _sort;
|
|
10
12
|
private _limit;
|
|
@@ -47,6 +49,7 @@ export declare class IkasProductList {
|
|
|
47
49
|
getPrev: () => Promise<void>;
|
|
48
50
|
getNext: () => Promise<void>;
|
|
49
51
|
getPage: (page: number) => Promise<void>;
|
|
52
|
+
onFilterCategoryClick(category: IkasCategoryPath): void;
|
|
50
53
|
toJSON(): {
|
|
51
54
|
data: IkasProductDetail[];
|
|
52
55
|
type: IkasProductListType;
|
|
@@ -79,6 +82,7 @@ export declare type IkasProductListParams = {
|
|
|
79
82
|
filterBrandId?: string;
|
|
80
83
|
filterCategoryId?: string;
|
|
81
84
|
filters?: IkasProductFilter[];
|
|
85
|
+
filterCategories?: IkasCategoryPath[];
|
|
82
86
|
recommendFor?: string;
|
|
83
87
|
productListPropValue: IkasProductListPropValue;
|
|
84
88
|
};
|