@ikas/storefront 0.0.49 → 0.0.50
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/__generated__/global-types.d.ts +61 -0
- package/build/api/checkout/index.d.ts +1 -0
- package/build/api/customer/__generated__/getMyCustomer.d.ts +1 -0
- package/build/api/customer/__generated__/saveMyCustomer.d.ts +1 -0
- package/build/api/index.d.ts +1 -0
- package/build/api/product-search/__generated__/getProductFilterData.d.ts +27 -0
- package/build/api/product-search/__generated__/searchProducts.d.ts +26 -0
- package/build/api/product-search/index.d.ts +16 -0
- package/build/components/image/index.d.ts +3 -0
- package/build/components/index.d.ts +1 -0
- package/build/index.es.js +1277 -210
- package/build/index.js +1280 -209
- package/build/models/data/category/index.d.ts +2 -0
- package/build/models/data/index.d.ts +1 -0
- package/build/models/data/product/attribute-value/index.d.ts +5 -1
- package/build/models/data/product-attribute/index.d.ts +1 -1
- package/build/models/data/product-filter/index.d.ts +72 -0
- package/build/models/data/simple-product/index.d.ts +134 -0
- package/build/models/data/variant-type/variant-value/index.d.ts +1 -1
- package/build/models/ui/index.d.ts +0 -1
- package/build/models/ui/product-list/index.d.ts +30 -7
- package/build/utils/providers/page-data.d.ts +2 -2
- package/build/utils/providers/prop-value/product-detail.d.ts +2 -2
- package/package.json +1 -1
- package/build/models/ui/product-list/filter.d.ts +0 -18
package/build/index.js
CHANGED
|
@@ -6,7 +6,7 @@ var mobx = require('mobx');
|
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var mobxReactLite = require('mobx-react-lite');
|
|
8
8
|
var router = require('next/router');
|
|
9
|
-
var Image = require('next/image');
|
|
9
|
+
var Image$1 = require('next/image');
|
|
10
10
|
var Link = require('next/link');
|
|
11
11
|
var Head = require('next/head');
|
|
12
12
|
var dynamic = require('next/dynamic');
|
|
@@ -14,7 +14,7 @@ var dynamic = require('next/dynamic');
|
|
|
14
14
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
15
15
|
|
|
16
16
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
17
|
-
var Image__default = /*#__PURE__*/_interopDefaultLegacy(Image);
|
|
17
|
+
var Image__default = /*#__PURE__*/_interopDefaultLegacy(Image$1);
|
|
18
18
|
var Link__default = /*#__PURE__*/_interopDefaultLegacy(Link);
|
|
19
19
|
var Head__default = /*#__PURE__*/_interopDefaultLegacy(Head);
|
|
20
20
|
var dynamic__default = /*#__PURE__*/_interopDefaultLegacy(dynamic);
|
|
@@ -10895,7 +10895,7 @@ var Apollo = /** @class */ (function () {
|
|
|
10895
10895
|
this.createApolloClient = function (apiKey) {
|
|
10896
10896
|
var authLink = setContext(function (_request, _a) {
|
|
10897
10897
|
var headers = _a.headers;
|
|
10898
|
-
var newHeaders = __assign(__assign({}, headers), { "x-api-key": apiKey || IkasStorefrontConfig.config.apiKey });
|
|
10898
|
+
var newHeaders = __assign(__assign({}, headers), { "x-api-key": apiKey || IkasStorefrontConfig.config.apiKey, "X-Operation-Name": _request.operationName });
|
|
10899
10899
|
if (Apollo.customerToken) {
|
|
10900
10900
|
newHeaders.Authorization = "Bearer " + Apollo.customerToken;
|
|
10901
10901
|
}
|
|
@@ -10952,32 +10952,32 @@ var IkasProductListPropValueProvider = /** @class */ (function () {
|
|
|
10952
10952
|
}
|
|
10953
10953
|
IkasProductListPropValueProvider.prototype.getValue = function () {
|
|
10954
10954
|
return __awaiter(this, void 0, void 0, function () {
|
|
10955
|
-
var
|
|
10955
|
+
var filterBrandId, filterCategoryId, category, brand, productList;
|
|
10956
10956
|
return __generator(this, function (_a) {
|
|
10957
10957
|
switch (_a.label) {
|
|
10958
10958
|
case 0:
|
|
10959
|
-
filters = new IkasProductListFilter();
|
|
10960
10959
|
if (this.productListPropValue.productListType === exports.IkasProductListType.ALL) {
|
|
10961
10960
|
// TODO use pageParams to insert filters
|
|
10962
10961
|
if (this.productListPropValue.usePageFilter) {
|
|
10963
10962
|
if (this.pageType === exports.IkasThemePageType.CATEGORY) {
|
|
10964
10963
|
category = this.pageSpecificData;
|
|
10965
|
-
|
|
10964
|
+
filterCategoryId = category.id;
|
|
10966
10965
|
}
|
|
10967
10966
|
else if (this.pageType === exports.IkasThemePageType.BRAND) {
|
|
10968
10967
|
brand = this.pageSpecificData;
|
|
10969
|
-
|
|
10968
|
+
filterBrandId = brand.id;
|
|
10970
10969
|
}
|
|
10971
10970
|
}
|
|
10972
10971
|
}
|
|
10973
|
-
if (this.productListPropValue.productListType ===
|
|
10974
|
-
|
|
10975
|
-
|
|
10976
|
-
|
|
10972
|
+
if (this.productListPropValue.productListType ===
|
|
10973
|
+
exports.IkasProductListType.CATEGORY &&
|
|
10974
|
+
this.productListPropValue.category) {
|
|
10975
|
+
filterCategoryId = this.productListPropValue.category;
|
|
10977
10976
|
}
|
|
10978
10977
|
productList = new IkasProductList({
|
|
10979
10978
|
productListPropValue: this.productListPropValue,
|
|
10980
|
-
|
|
10979
|
+
filterBrandId: filterBrandId,
|
|
10980
|
+
filterCategoryId: filterCategoryId,
|
|
10981
10981
|
});
|
|
10982
10982
|
if (!!this.skipInitialFetch) return [3 /*break*/, 2];
|
|
10983
10983
|
return [4 /*yield*/, productList.getInitial()];
|
|
@@ -11000,7 +11000,7 @@ var IkasProductDetailPropValueProvider = /** @class */ (function () {
|
|
|
11000
11000
|
IkasProductDetailPropValueProvider.prototype.getValue = function () {
|
|
11001
11001
|
var _a;
|
|
11002
11002
|
return __awaiter(this, void 0, void 0, function () {
|
|
11003
|
-
var
|
|
11003
|
+
var productSearchResponse, productList, product, variant;
|
|
11004
11004
|
var _this = this;
|
|
11005
11005
|
return __generator(this, function (_b) {
|
|
11006
11006
|
switch (_b.label) {
|
|
@@ -11008,17 +11008,30 @@ var IkasProductDetailPropValueProvider = /** @class */ (function () {
|
|
|
11008
11008
|
if ((_a = this.productDetailPropValue) === null || _a === void 0 ? void 0 : _a.usePageData) {
|
|
11009
11009
|
return [2 /*return*/, this.pageSpecificData];
|
|
11010
11010
|
}
|
|
11011
|
-
|
|
11012
|
-
|
|
11011
|
+
if (!this.productDetailPropValue.productId)
|
|
11012
|
+
return [2 /*return*/, null];
|
|
11013
|
+
return [4 /*yield*/, IkasProductSearchAPI.searchProducts({
|
|
11014
|
+
productIdList: [this.productDetailPropValue.productId],
|
|
11013
11015
|
})];
|
|
11014
11016
|
case 1:
|
|
11015
|
-
|
|
11016
|
-
|
|
11017
|
-
|
|
11018
|
-
|
|
11019
|
-
|
|
11017
|
+
productSearchResponse = _b.sent();
|
|
11018
|
+
if (productSearchResponse) {
|
|
11019
|
+
productList = productSearchResponse.data;
|
|
11020
|
+
if (productList.length) {
|
|
11021
|
+
product = productList[0];
|
|
11022
|
+
if (product === null || product === void 0 ? void 0 : product.hasVariant) {
|
|
11023
|
+
variant = product.variants.find(function (v) { return v.id === _this.productDetailPropValue.variantId; });
|
|
11024
|
+
if (variant)
|
|
11025
|
+
return [2 /*return*/, new IkasProductDetail(product, variant.variantValues)];
|
|
11026
|
+
else
|
|
11027
|
+
return [2 /*return*/, null];
|
|
11028
|
+
}
|
|
11029
|
+
else {
|
|
11030
|
+
return [2 /*return*/, new IkasProductDetail(product, product.variants[0].variantValues)];
|
|
11031
|
+
}
|
|
11032
|
+
}
|
|
11020
11033
|
}
|
|
11021
|
-
return [2 /*return*/,
|
|
11034
|
+
return [2 /*return*/, null];
|
|
11022
11035
|
}
|
|
11023
11036
|
});
|
|
11024
11037
|
});
|
|
@@ -11994,14 +12007,14 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
11994
12007
|
metaDataResponse = _b.sent();
|
|
11995
12008
|
if (!metaDataResponse)
|
|
11996
12009
|
return [2 /*return*/];
|
|
11997
|
-
return [4 /*yield*/,
|
|
11998
|
-
|
|
12010
|
+
return [4 /*yield*/, IkasProductSearchAPI.searchProducts({
|
|
12011
|
+
productIdList: [metaDataResponse.metaData.targetId],
|
|
11999
12012
|
})];
|
|
12000
12013
|
case 2:
|
|
12001
12014
|
productsResponse = _b.sent();
|
|
12002
|
-
if (!productsResponse.
|
|
12015
|
+
if (!(productsResponse === null || productsResponse === void 0 ? void 0 : productsResponse.data.length))
|
|
12003
12016
|
return [2 /*return*/];
|
|
12004
|
-
product = productsResponse.
|
|
12017
|
+
product = productsResponse.data[0];
|
|
12005
12018
|
isMainProductSlug = slug.length === metaDataResponse.slug.length;
|
|
12006
12019
|
selectedVariantValues = [];
|
|
12007
12020
|
if (!isMainProductSlug) {
|
|
@@ -12162,7 +12175,7 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
12162
12175
|
IkasPageDataProvider.initCategoryListPropValue(prop, propValue, pageComponentPropValue);
|
|
12163
12176
|
break;
|
|
12164
12177
|
case exports.IkasThemeComponentPropType.PRODUCT_LIST:
|
|
12165
|
-
IkasPageDataProvider.initProductListPropValue(prop, propValue, pageComponentPropValue);
|
|
12178
|
+
IkasPageDataProvider.initProductListPropValue(prop, propValue, pageComponentPropValue, router);
|
|
12166
12179
|
break;
|
|
12167
12180
|
case exports.IkasThemeComponentPropType.PRODUCT_DETAIL:
|
|
12168
12181
|
IkasPageDataProvider.initProductDetailPropValue(prop, propValue, pageComponentPropValue, router, isBrowser);
|
|
@@ -12204,11 +12217,11 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
12204
12217
|
IkasPageDataProvider._initCategoryListPropValue = function (propValue) {
|
|
12205
12218
|
return new IkasCategoryList(propValue);
|
|
12206
12219
|
};
|
|
12207
|
-
IkasPageDataProvider.initProductListPropValue = function (prop, propValue, pageComponentPropValue) {
|
|
12208
|
-
pageComponentPropValue.propValues[prop.name] = this._initProductListPropValue(propValue);
|
|
12220
|
+
IkasPageDataProvider.initProductListPropValue = function (prop, propValue, pageComponentPropValue, router) {
|
|
12221
|
+
pageComponentPropValue.propValues[prop.name] = this._initProductListPropValue(propValue, router);
|
|
12209
12222
|
};
|
|
12210
|
-
IkasPageDataProvider._initProductListPropValue = function (propValue) {
|
|
12211
|
-
return new IkasProductList(propValue);
|
|
12223
|
+
IkasPageDataProvider._initProductListPropValue = function (propValue, router) {
|
|
12224
|
+
return new IkasProductList(propValue, router);
|
|
12212
12225
|
};
|
|
12213
12226
|
IkasPageDataProvider.initProductDetailPropValue = function (prop, propValue, pageComponentPropValue, router, isBrowser) {
|
|
12214
12227
|
pageComponentPropValue.propValues[prop.name] = this._initProductDetailPropValue(propValue, router, isBrowser);
|
|
@@ -12286,7 +12299,7 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
12286
12299
|
case exports.IkasThemeCustomDataType.PRODUCT_DETAIL:
|
|
12287
12300
|
return this._initProductDetailPropValue(propValue, router, isBrowser);
|
|
12288
12301
|
case exports.IkasThemeCustomDataType.PRODUCT_LIST:
|
|
12289
|
-
return this._initProductListPropValue(propValue);
|
|
12302
|
+
return this._initProductListPropValue(propValue, router);
|
|
12290
12303
|
case exports.IkasThemeCustomDataType.OBJECT:
|
|
12291
12304
|
var objectValue = {};
|
|
12292
12305
|
for (var _i = 0, _a = customData.nestedData || []; _i < _a.length; _i++) {
|
|
@@ -12436,6 +12449,7 @@ var IkasCategory = /** @class */ (function () {
|
|
|
12436
12449
|
? new IkasHTMLMetaData(data.metaData)
|
|
12437
12450
|
: undefined;
|
|
12438
12451
|
this.image = data.image ? new IkasImage(data.image.id) : null;
|
|
12452
|
+
this.path = data.path || [];
|
|
12439
12453
|
mobx.makeAutoObservable(this);
|
|
12440
12454
|
}
|
|
12441
12455
|
Object.defineProperty(IkasCategory.prototype, "href", {
|
|
@@ -13090,7 +13104,7 @@ var IkasVariantValue = /** @class */ (function () {
|
|
|
13090
13104
|
this.id = data.id || "";
|
|
13091
13105
|
this.name = data.name || "";
|
|
13092
13106
|
this.colorCode = data.colorCode || null;
|
|
13093
|
-
this.
|
|
13107
|
+
this.thumbnailImageId = data.thumbnailImageId || null;
|
|
13094
13108
|
this.variantTypeId = data.variantTypeId || "";
|
|
13095
13109
|
mobx.makeAutoObservable(this);
|
|
13096
13110
|
}
|
|
@@ -13103,8 +13117,8 @@ var IkasVariantValue = /** @class */ (function () {
|
|
|
13103
13117
|
});
|
|
13104
13118
|
Object.defineProperty(IkasVariantValue.prototype, "thumbnailImage", {
|
|
13105
13119
|
get: function () {
|
|
13106
|
-
if (this.
|
|
13107
|
-
return new IkasImage(this.
|
|
13120
|
+
if (this.thumbnailImageId)
|
|
13121
|
+
return new IkasImage(this.thumbnailImageId);
|
|
13108
13122
|
},
|
|
13109
13123
|
enumerable: false,
|
|
13110
13124
|
configurable: true
|
|
@@ -13112,11 +13126,48 @@ var IkasVariantValue = /** @class */ (function () {
|
|
|
13112
13126
|
return IkasVariantValue;
|
|
13113
13127
|
}());
|
|
13114
13128
|
|
|
13129
|
+
var IkasProductAttributeOption = /** @class */ (function () {
|
|
13130
|
+
function IkasProductAttributeOption(data) {
|
|
13131
|
+
if (data === void 0) { data = {}; }
|
|
13132
|
+
this.id = data.id || "";
|
|
13133
|
+
this.name = data.name || "";
|
|
13134
|
+
mobx.makeAutoObservable(this);
|
|
13135
|
+
}
|
|
13136
|
+
return IkasProductAttributeOption;
|
|
13137
|
+
}());
|
|
13138
|
+
|
|
13139
|
+
var IkasProductAttribute = /** @class */ (function () {
|
|
13140
|
+
function IkasProductAttribute(data) {
|
|
13141
|
+
this.id = data.id || "";
|
|
13142
|
+
this.name = data.name || "";
|
|
13143
|
+
this.type = data.type || IkasProductAttributeType.TEXT;
|
|
13144
|
+
this.options = data.options || null;
|
|
13145
|
+
mobx.makeAutoObservable(this);
|
|
13146
|
+
}
|
|
13147
|
+
return IkasProductAttribute;
|
|
13148
|
+
}());
|
|
13149
|
+
var IkasProductAttributeType;
|
|
13150
|
+
(function (IkasProductAttributeType) {
|
|
13151
|
+
IkasProductAttributeType["CHOICE"] = "CHOICE";
|
|
13152
|
+
IkasProductAttributeType["MULTIPLE_CHOICE"] = "MULTIPLE_CHOICE";
|
|
13153
|
+
IkasProductAttributeType["TEXT"] = "TEXT";
|
|
13154
|
+
IkasProductAttributeType["BOOLEAN"] = "BOOLEAN";
|
|
13155
|
+
IkasProductAttributeType["NUMERIC"] = "NUMERIC";
|
|
13156
|
+
IkasProductAttributeType["DATETIME"] = "DATETIME";
|
|
13157
|
+
IkasProductAttributeType["HTML"] = "HTML";
|
|
13158
|
+
})(IkasProductAttributeType || (IkasProductAttributeType = {}));
|
|
13159
|
+
|
|
13115
13160
|
var IkasProductAttributeValue = /** @class */ (function () {
|
|
13116
13161
|
function IkasProductAttributeValue(data) {
|
|
13117
13162
|
this.value = data.value || null;
|
|
13118
13163
|
this.productAttributeId = data.productAttributeId || "";
|
|
13119
13164
|
this.productAttributeOptionId = data.productAttributeOptionId || null;
|
|
13165
|
+
this.productAttribute = data.productAttribute
|
|
13166
|
+
? new IkasProductAttribute(data.productAttribute)
|
|
13167
|
+
: null;
|
|
13168
|
+
this.productAttributeOption = data.productAttributeOption
|
|
13169
|
+
? new IkasProductAttributeOption(data.productAttributeOption)
|
|
13170
|
+
: null;
|
|
13120
13171
|
mobx.makeAutoObservable(this);
|
|
13121
13172
|
}
|
|
13122
13173
|
return IkasProductAttributeValue;
|
|
@@ -13264,26 +13315,189 @@ var IkasProduct = /** @class */ (function () {
|
|
|
13264
13315
|
IkasProductType["MEMBERSHIP"] = "MEMBERSHIP";
|
|
13265
13316
|
})(exports.IkasProductType || (exports.IkasProductType = {}));
|
|
13266
13317
|
|
|
13267
|
-
var
|
|
13268
|
-
function
|
|
13318
|
+
var IkasProductFilter = /** @class */ (function () {
|
|
13319
|
+
function IkasProductFilter(data) {
|
|
13320
|
+
if (data === void 0) { data = {}; }
|
|
13321
|
+
this.values = null;
|
|
13322
|
+
this.customValues = null;
|
|
13323
|
+
// Extra
|
|
13324
|
+
this.numberRange = null; // Selected range value for the number slider
|
|
13325
|
+
this.numberRangeLimit = null; // Limits for the number range slider
|
|
13326
|
+
this.numberRangeListOptions = null; // List options for the number range select
|
|
13269
13327
|
this.id = data.id || "";
|
|
13328
|
+
this.key = data.key || "";
|
|
13270
13329
|
this.name = data.name || "";
|
|
13271
|
-
this.
|
|
13272
|
-
this.
|
|
13330
|
+
this.order = data.order || 0;
|
|
13331
|
+
this.type = data.type || exports.IkasProductFilterType.BRAND;
|
|
13332
|
+
this.displayType = data.displayType || exports.IkasProductFilterDisplayType.BOX;
|
|
13333
|
+
this.isMultiSelect = data.isMultiSelect || false;
|
|
13334
|
+
this.values = data.values
|
|
13335
|
+
? data.values.map(function (v) { return new IkasApplicableProductFilterValue(v); })
|
|
13336
|
+
: null;
|
|
13337
|
+
this.customValues = data.customValues || null;
|
|
13338
|
+
if (this.displayType === exports.IkasProductFilterDisplayType.NUMBER_RANGE_LIST &&
|
|
13339
|
+
this.customValues &&
|
|
13340
|
+
this.customValues.length) {
|
|
13341
|
+
this.numberRangeListOptions = this.customValues.map(function (cv) {
|
|
13342
|
+
return new NumberRangeListOption(__assign(__assign({ key: cv }, parseRangeStr(cv)), { isSelected: false }));
|
|
13343
|
+
});
|
|
13344
|
+
}
|
|
13345
|
+
if (this.displayType === exports.IkasProductFilterDisplayType.NUMBER_RANGE &&
|
|
13346
|
+
this.customValues &&
|
|
13347
|
+
this.customValues.length) {
|
|
13348
|
+
var value = this.customValues[0];
|
|
13349
|
+
this.numberRangeLimit = parseRangeStr(value);
|
|
13350
|
+
}
|
|
13273
13351
|
mobx.makeAutoObservable(this);
|
|
13274
13352
|
}
|
|
13275
|
-
|
|
13353
|
+
Object.defineProperty(IkasProductFilter.prototype, "isCustomValueFilter", {
|
|
13354
|
+
get: function () {
|
|
13355
|
+
return [
|
|
13356
|
+
exports.IkasProductFilterDisplayType.NUMBER_RANGE_LIST,
|
|
13357
|
+
exports.IkasProductFilterDisplayType.NUMBER_RANGE,
|
|
13358
|
+
].includes(this.displayType);
|
|
13359
|
+
},
|
|
13360
|
+
enumerable: false,
|
|
13361
|
+
configurable: true
|
|
13362
|
+
});
|
|
13363
|
+
Object.defineProperty(IkasProductFilter.prototype, "valueList", {
|
|
13364
|
+
get: function () {
|
|
13365
|
+
var _this = this;
|
|
13366
|
+
var _a;
|
|
13367
|
+
if (this.numberRange)
|
|
13368
|
+
return [this.rangeToId(this.numberRange)];
|
|
13369
|
+
if (this.numberRangeListOptions)
|
|
13370
|
+
return this.numberRangeListOptions
|
|
13371
|
+
.filter(function (o) { return o.isSelected; })
|
|
13372
|
+
.map(function (o) { return _this.rangeToId(o); });
|
|
13373
|
+
return ((_a = this.values) === null || _a === void 0 ? void 0 : _a.filter(function (v) { return v.isSelected; }).map(function (v) { return v.id; })) || [];
|
|
13374
|
+
},
|
|
13375
|
+
enumerable: false,
|
|
13376
|
+
configurable: true
|
|
13377
|
+
});
|
|
13378
|
+
Object.defineProperty(IkasProductFilter.prototype, "keyList", {
|
|
13379
|
+
get: function () {
|
|
13380
|
+
var _this = this;
|
|
13381
|
+
var _a;
|
|
13382
|
+
if (this.numberRange)
|
|
13383
|
+
return [this.rangeToId(this.numberRange)];
|
|
13384
|
+
if (this.numberRangeListOptions)
|
|
13385
|
+
return this.numberRangeListOptions
|
|
13386
|
+
.filter(function (o) { return o.isSelected; })
|
|
13387
|
+
.map(function (o) { return _this.rangeToId(o); });
|
|
13388
|
+
return ((_a = this.values) === null || _a === void 0 ? void 0 : _a.filter(function (v) { return v.isSelected; }).map(function (v) { return v.key; })) || [];
|
|
13389
|
+
},
|
|
13390
|
+
enumerable: false,
|
|
13391
|
+
configurable: true
|
|
13392
|
+
});
|
|
13393
|
+
IkasProductFilter.prototype.clear = function () {
|
|
13394
|
+
var _a, _b;
|
|
13395
|
+
this.numberRange = null;
|
|
13396
|
+
(_a = this.numberRangeListOptions) === null || _a === void 0 ? void 0 : _a.forEach(function (o) { return (o.isSelected = false); });
|
|
13397
|
+
(_b = this.values) === null || _b === void 0 ? void 0 : _b.forEach(function (v) { return (v.isSelected = false); });
|
|
13398
|
+
};
|
|
13399
|
+
IkasProductFilter.prototype.toInput = function () {
|
|
13400
|
+
return {
|
|
13401
|
+
id: this.key,
|
|
13402
|
+
type: this.type,
|
|
13403
|
+
valueList: this.valueList,
|
|
13404
|
+
};
|
|
13405
|
+
};
|
|
13406
|
+
IkasProductFilter.prototype.rangeToId = function (range) {
|
|
13407
|
+
return range.from + ":" + (range.to || "");
|
|
13408
|
+
};
|
|
13409
|
+
return IkasProductFilter;
|
|
13276
13410
|
}());
|
|
13277
|
-
var
|
|
13278
|
-
|
|
13279
|
-
|
|
13280
|
-
|
|
13281
|
-
|
|
13282
|
-
|
|
13283
|
-
|
|
13284
|
-
|
|
13285
|
-
|
|
13286
|
-
|
|
13411
|
+
var IkasApplicableProductFilterValue = /** @class */ (function () {
|
|
13412
|
+
function IkasApplicableProductFilterValue(data) {
|
|
13413
|
+
if (data === void 0) { data = {}; }
|
|
13414
|
+
this.colorCode = null;
|
|
13415
|
+
this.thumbnailImageId = null;
|
|
13416
|
+
this.thumbnailImage = null;
|
|
13417
|
+
// Extra
|
|
13418
|
+
this._isSelected = false;
|
|
13419
|
+
this.id = data.id || "";
|
|
13420
|
+
this.key = data.key || "";
|
|
13421
|
+
this.name = data.name || "";
|
|
13422
|
+
this.colorCode = data.colorCode || null;
|
|
13423
|
+
this.thumbnailImageId = data.thumbnailImageId || null;
|
|
13424
|
+
if (this.thumbnailImageId)
|
|
13425
|
+
this.thumbnailImage = new IkasImage(this.thumbnailImageId);
|
|
13426
|
+
this._isSelected = data.isSelected || false;
|
|
13427
|
+
mobx.makeAutoObservable(this);
|
|
13428
|
+
}
|
|
13429
|
+
Object.defineProperty(IkasApplicableProductFilterValue.prototype, "isSelected", {
|
|
13430
|
+
get: function () {
|
|
13431
|
+
return this._isSelected;
|
|
13432
|
+
},
|
|
13433
|
+
set: function (value) {
|
|
13434
|
+
this._isSelected = value;
|
|
13435
|
+
},
|
|
13436
|
+
enumerable: false,
|
|
13437
|
+
configurable: true
|
|
13438
|
+
});
|
|
13439
|
+
return IkasApplicableProductFilterValue;
|
|
13440
|
+
}());
|
|
13441
|
+
var IkasProductFilterValue = /** @class */ (function () {
|
|
13442
|
+
function IkasProductFilterValue(data) {
|
|
13443
|
+
this.id = data.id;
|
|
13444
|
+
this.type = data.type;
|
|
13445
|
+
this.valueList = data.valueList;
|
|
13446
|
+
mobx.makeAutoObservable(this);
|
|
13447
|
+
}
|
|
13448
|
+
return IkasProductFilterValue;
|
|
13449
|
+
}());
|
|
13450
|
+
(function (IkasProductFilterType) {
|
|
13451
|
+
IkasProductFilterType["ATTRIBUTE"] = "ATTRIBUTE";
|
|
13452
|
+
IkasProductFilterType["BRAND"] = "BRAND";
|
|
13453
|
+
IkasProductFilterType["DISCOUNT_RATIO"] = "DISCOUNT_RATIO";
|
|
13454
|
+
IkasProductFilterType["PRICE"] = "PRICE";
|
|
13455
|
+
IkasProductFilterType["STOCK_STATUS"] = "STOCK_STATUS";
|
|
13456
|
+
IkasProductFilterType["TAG"] = "TAG";
|
|
13457
|
+
IkasProductFilterType["VARIANT_TYPE"] = "VARIANT_TYPE";
|
|
13458
|
+
})(exports.IkasProductFilterType || (exports.IkasProductFilterType = {}));
|
|
13459
|
+
(function (IkasProductFilterDisplayType) {
|
|
13460
|
+
IkasProductFilterDisplayType["BOX"] = "BOX";
|
|
13461
|
+
IkasProductFilterDisplayType["DATE_RANGE"] = "DATE_RANGE";
|
|
13462
|
+
IkasProductFilterDisplayType["LIST"] = "LIST";
|
|
13463
|
+
IkasProductFilterDisplayType["NUMBER_RANGE_LIST"] = "NUMBER_RANGE_LIST";
|
|
13464
|
+
IkasProductFilterDisplayType["NUMBER_RANGE"] = "NUMBER_RANGE";
|
|
13465
|
+
IkasProductFilterDisplayType["SWATCH"] = "SWATCH";
|
|
13466
|
+
})(exports.IkasProductFilterDisplayType || (exports.IkasProductFilterDisplayType = {}));
|
|
13467
|
+
var RangeValue = /** @class */ (function () {
|
|
13468
|
+
function RangeValue(data) {
|
|
13469
|
+
this.from = data.from || 0;
|
|
13470
|
+
this.to = data.to || null;
|
|
13471
|
+
mobx.makeAutoObservable(this);
|
|
13472
|
+
}
|
|
13473
|
+
return RangeValue;
|
|
13474
|
+
}());
|
|
13475
|
+
var NumberRangeListOption = /** @class */ (function () {
|
|
13476
|
+
function NumberRangeListOption(data) {
|
|
13477
|
+
this.from = data.from || 0;
|
|
13478
|
+
this.to = data.to || null;
|
|
13479
|
+
this.key = data.key || "";
|
|
13480
|
+
this.isSelected = data.isSelected || false;
|
|
13481
|
+
mobx.makeAutoObservable(this);
|
|
13482
|
+
}
|
|
13483
|
+
return NumberRangeListOption;
|
|
13484
|
+
}());
|
|
13485
|
+
function parseRangeStr(rangeStr) {
|
|
13486
|
+
try {
|
|
13487
|
+
var parsedValues = rangeStr.split(":").map(function (i) { return parseInt(i); });
|
|
13488
|
+
return new RangeValue({
|
|
13489
|
+
from: isNaN(parsedValues[0]) ? 0 : parsedValues[0],
|
|
13490
|
+
to: isNaN(parsedValues[1]) ? undefined : parsedValues[1],
|
|
13491
|
+
});
|
|
13492
|
+
}
|
|
13493
|
+
catch (err) {
|
|
13494
|
+
console.log(err);
|
|
13495
|
+
return new RangeValue({
|
|
13496
|
+
from: 0,
|
|
13497
|
+
to: 0,
|
|
13498
|
+
});
|
|
13499
|
+
}
|
|
13500
|
+
}
|
|
13287
13501
|
|
|
13288
13502
|
var IkasOrderTransaction = /** @class */ (function () {
|
|
13289
13503
|
function IkasOrderTransaction(data) {
|
|
@@ -14272,111 +14486,611 @@ var IkasProductDetail = /** @class */ (function () {
|
|
|
14272
14486
|
return IkasProductDetail;
|
|
14273
14487
|
}());
|
|
14274
14488
|
|
|
14275
|
-
var
|
|
14276
|
-
|
|
14277
|
-
|
|
14278
|
-
|
|
14279
|
-
|
|
14280
|
-
|
|
14281
|
-
|
|
14282
|
-
|
|
14283
|
-
|
|
14284
|
-
|
|
14285
|
-
|
|
14286
|
-
|
|
14287
|
-
|
|
14288
|
-
|
|
14289
|
-
|
|
14489
|
+
var strictUriEncode = str => encodeURIComponent(str).replace(/[!'()*]/g, x => `%${x.charCodeAt(0).toString(16).toUpperCase()}`);
|
|
14490
|
+
|
|
14491
|
+
var token = '%[a-f0-9]{2}';
|
|
14492
|
+
var singleMatcher = new RegExp(token, 'gi');
|
|
14493
|
+
var multiMatcher = new RegExp('(' + token + ')+', 'gi');
|
|
14494
|
+
|
|
14495
|
+
function decodeComponents(components, split) {
|
|
14496
|
+
try {
|
|
14497
|
+
// Try to decode the entire string first
|
|
14498
|
+
return decodeURIComponent(components.join(''));
|
|
14499
|
+
} catch (err) {
|
|
14500
|
+
// Do nothing
|
|
14501
|
+
}
|
|
14502
|
+
|
|
14503
|
+
if (components.length === 1) {
|
|
14504
|
+
return components;
|
|
14505
|
+
}
|
|
14506
|
+
|
|
14507
|
+
split = split || 1;
|
|
14508
|
+
|
|
14509
|
+
// Split the array in 2 parts
|
|
14510
|
+
var left = components.slice(0, split);
|
|
14511
|
+
var right = components.slice(split);
|
|
14512
|
+
|
|
14513
|
+
return Array.prototype.concat.call([], decodeComponents(left), decodeComponents(right));
|
|
14514
|
+
}
|
|
14515
|
+
|
|
14516
|
+
function decode(input) {
|
|
14517
|
+
try {
|
|
14518
|
+
return decodeURIComponent(input);
|
|
14519
|
+
} catch (err) {
|
|
14520
|
+
var tokens = input.match(singleMatcher);
|
|
14521
|
+
|
|
14522
|
+
for (var i = 1; i < tokens.length; i++) {
|
|
14523
|
+
input = decodeComponents(tokens, i).join('');
|
|
14524
|
+
|
|
14525
|
+
tokens = input.match(singleMatcher);
|
|
14526
|
+
}
|
|
14527
|
+
|
|
14528
|
+
return input;
|
|
14529
|
+
}
|
|
14530
|
+
}
|
|
14531
|
+
|
|
14532
|
+
function customDecodeURIComponent(input) {
|
|
14533
|
+
// Keep track of all the replacements and prefill the map with the `BOM`
|
|
14534
|
+
var replaceMap = {
|
|
14535
|
+
'%FE%FF': '\uFFFD\uFFFD',
|
|
14536
|
+
'%FF%FE': '\uFFFD\uFFFD'
|
|
14537
|
+
};
|
|
14538
|
+
|
|
14539
|
+
var match = multiMatcher.exec(input);
|
|
14540
|
+
while (match) {
|
|
14541
|
+
try {
|
|
14542
|
+
// Decode as big chunks as possible
|
|
14543
|
+
replaceMap[match[0]] = decodeURIComponent(match[0]);
|
|
14544
|
+
} catch (err) {
|
|
14545
|
+
var result = decode(match[0]);
|
|
14546
|
+
|
|
14547
|
+
if (result !== match[0]) {
|
|
14548
|
+
replaceMap[match[0]] = result;
|
|
14549
|
+
}
|
|
14550
|
+
}
|
|
14551
|
+
|
|
14552
|
+
match = multiMatcher.exec(input);
|
|
14553
|
+
}
|
|
14554
|
+
|
|
14555
|
+
// Add `%C2` at the end of the map to make sure it does not replace the combinator before everything else
|
|
14556
|
+
replaceMap['%C2'] = '\uFFFD';
|
|
14557
|
+
|
|
14558
|
+
var entries = Object.keys(replaceMap);
|
|
14559
|
+
|
|
14560
|
+
for (var i = 0; i < entries.length; i++) {
|
|
14561
|
+
// Replace all decoded components
|
|
14562
|
+
var key = entries[i];
|
|
14563
|
+
input = input.replace(new RegExp(key, 'g'), replaceMap[key]);
|
|
14564
|
+
}
|
|
14565
|
+
|
|
14566
|
+
return input;
|
|
14567
|
+
}
|
|
14568
|
+
|
|
14569
|
+
var decodeUriComponent = function (encodedURI) {
|
|
14570
|
+
if (typeof encodedURI !== 'string') {
|
|
14571
|
+
throw new TypeError('Expected `encodedURI` to be of type `string`, got `' + typeof encodedURI + '`');
|
|
14572
|
+
}
|
|
14573
|
+
|
|
14574
|
+
try {
|
|
14575
|
+
encodedURI = encodedURI.replace(/\+/g, ' ');
|
|
14576
|
+
|
|
14577
|
+
// Try the built in decoder first
|
|
14578
|
+
return decodeURIComponent(encodedURI);
|
|
14579
|
+
} catch (err) {
|
|
14580
|
+
// Fallback to a more advanced decoder
|
|
14581
|
+
return customDecodeURIComponent(encodedURI);
|
|
14582
|
+
}
|
|
14583
|
+
};
|
|
14584
|
+
|
|
14585
|
+
var splitOnFirst = (string, separator) => {
|
|
14586
|
+
if (!(typeof string === 'string' && typeof separator === 'string')) {
|
|
14587
|
+
throw new TypeError('Expected the arguments to be of type `string`');
|
|
14588
|
+
}
|
|
14589
|
+
|
|
14590
|
+
if (separator === '') {
|
|
14591
|
+
return [string];
|
|
14592
|
+
}
|
|
14593
|
+
|
|
14594
|
+
const separatorIndex = string.indexOf(separator);
|
|
14595
|
+
|
|
14596
|
+
if (separatorIndex === -1) {
|
|
14597
|
+
return [string];
|
|
14598
|
+
}
|
|
14599
|
+
|
|
14600
|
+
return [
|
|
14601
|
+
string.slice(0, separatorIndex),
|
|
14602
|
+
string.slice(separatorIndex + separator.length)
|
|
14603
|
+
];
|
|
14604
|
+
};
|
|
14605
|
+
|
|
14606
|
+
var queryString = createCommonjsModule(function (module, exports) {
|
|
14607
|
+
|
|
14608
|
+
|
|
14609
|
+
|
|
14610
|
+
|
|
14611
|
+
const isNullOrUndefined = value => value === null || value === undefined;
|
|
14612
|
+
|
|
14613
|
+
function encoderForArrayFormat(options) {
|
|
14614
|
+
switch (options.arrayFormat) {
|
|
14615
|
+
case 'index':
|
|
14616
|
+
return key => (result, value) => {
|
|
14617
|
+
const index = result.length;
|
|
14618
|
+
|
|
14619
|
+
if (
|
|
14620
|
+
value === undefined ||
|
|
14621
|
+
(options.skipNull && value === null) ||
|
|
14622
|
+
(options.skipEmptyString && value === '')
|
|
14623
|
+
) {
|
|
14624
|
+
return result;
|
|
14625
|
+
}
|
|
14626
|
+
|
|
14627
|
+
if (value === null) {
|
|
14628
|
+
return [...result, [encode(key, options), '[', index, ']'].join('')];
|
|
14629
|
+
}
|
|
14630
|
+
|
|
14631
|
+
return [
|
|
14632
|
+
...result,
|
|
14633
|
+
[encode(key, options), '[', encode(index, options), ']=', encode(value, options)].join('')
|
|
14634
|
+
];
|
|
14635
|
+
};
|
|
14636
|
+
|
|
14637
|
+
case 'bracket':
|
|
14638
|
+
return key => (result, value) => {
|
|
14639
|
+
if (
|
|
14640
|
+
value === undefined ||
|
|
14641
|
+
(options.skipNull && value === null) ||
|
|
14642
|
+
(options.skipEmptyString && value === '')
|
|
14643
|
+
) {
|
|
14644
|
+
return result;
|
|
14645
|
+
}
|
|
14646
|
+
|
|
14647
|
+
if (value === null) {
|
|
14648
|
+
return [...result, [encode(key, options), '[]'].join('')];
|
|
14649
|
+
}
|
|
14650
|
+
|
|
14651
|
+
return [...result, [encode(key, options), '[]=', encode(value, options)].join('')];
|
|
14652
|
+
};
|
|
14653
|
+
|
|
14654
|
+
case 'comma':
|
|
14655
|
+
case 'separator':
|
|
14656
|
+
return key => (result, value) => {
|
|
14657
|
+
if (value === null || value === undefined || value.length === 0) {
|
|
14658
|
+
return result;
|
|
14659
|
+
}
|
|
14660
|
+
|
|
14661
|
+
if (result.length === 0) {
|
|
14662
|
+
return [[encode(key, options), '=', encode(value, options)].join('')];
|
|
14663
|
+
}
|
|
14664
|
+
|
|
14665
|
+
return [[result, encode(value, options)].join(options.arrayFormatSeparator)];
|
|
14666
|
+
};
|
|
14667
|
+
|
|
14668
|
+
default:
|
|
14669
|
+
return key => (result, value) => {
|
|
14670
|
+
if (
|
|
14671
|
+
value === undefined ||
|
|
14672
|
+
(options.skipNull && value === null) ||
|
|
14673
|
+
(options.skipEmptyString && value === '')
|
|
14674
|
+
) {
|
|
14675
|
+
return result;
|
|
14676
|
+
}
|
|
14677
|
+
|
|
14678
|
+
if (value === null) {
|
|
14679
|
+
return [...result, encode(key, options)];
|
|
14680
|
+
}
|
|
14681
|
+
|
|
14682
|
+
return [...result, [encode(key, options), '=', encode(value, options)].join('')];
|
|
14683
|
+
};
|
|
14684
|
+
}
|
|
14685
|
+
}
|
|
14686
|
+
|
|
14687
|
+
function parserForArrayFormat(options) {
|
|
14688
|
+
let result;
|
|
14689
|
+
|
|
14690
|
+
switch (options.arrayFormat) {
|
|
14691
|
+
case 'index':
|
|
14692
|
+
return (key, value, accumulator) => {
|
|
14693
|
+
result = /\[(\d*)\]$/.exec(key);
|
|
14694
|
+
|
|
14695
|
+
key = key.replace(/\[\d*\]$/, '');
|
|
14696
|
+
|
|
14697
|
+
if (!result) {
|
|
14698
|
+
accumulator[key] = value;
|
|
14699
|
+
return;
|
|
14700
|
+
}
|
|
14701
|
+
|
|
14702
|
+
if (accumulator[key] === undefined) {
|
|
14703
|
+
accumulator[key] = {};
|
|
14704
|
+
}
|
|
14705
|
+
|
|
14706
|
+
accumulator[key][result[1]] = value;
|
|
14707
|
+
};
|
|
14708
|
+
|
|
14709
|
+
case 'bracket':
|
|
14710
|
+
return (key, value, accumulator) => {
|
|
14711
|
+
result = /(\[\])$/.exec(key);
|
|
14712
|
+
key = key.replace(/\[\]$/, '');
|
|
14713
|
+
|
|
14714
|
+
if (!result) {
|
|
14715
|
+
accumulator[key] = value;
|
|
14716
|
+
return;
|
|
14717
|
+
}
|
|
14718
|
+
|
|
14719
|
+
if (accumulator[key] === undefined) {
|
|
14720
|
+
accumulator[key] = [value];
|
|
14721
|
+
return;
|
|
14722
|
+
}
|
|
14723
|
+
|
|
14724
|
+
accumulator[key] = [].concat(accumulator[key], value);
|
|
14725
|
+
};
|
|
14726
|
+
|
|
14727
|
+
case 'comma':
|
|
14728
|
+
case 'separator':
|
|
14729
|
+
return (key, value, accumulator) => {
|
|
14730
|
+
const isArray = typeof value === 'string' && value.includes(options.arrayFormatSeparator);
|
|
14731
|
+
const isEncodedArray = (typeof value === 'string' && !isArray && decode(value, options).includes(options.arrayFormatSeparator));
|
|
14732
|
+
value = isEncodedArray ? decode(value, options) : value;
|
|
14733
|
+
const newValue = isArray || isEncodedArray ? value.split(options.arrayFormatSeparator).map(item => decode(item, options)) : value === null ? value : decode(value, options);
|
|
14734
|
+
accumulator[key] = newValue;
|
|
14735
|
+
};
|
|
14736
|
+
|
|
14737
|
+
default:
|
|
14738
|
+
return (key, value, accumulator) => {
|
|
14739
|
+
if (accumulator[key] === undefined) {
|
|
14740
|
+
accumulator[key] = value;
|
|
14741
|
+
return;
|
|
14742
|
+
}
|
|
14743
|
+
|
|
14744
|
+
accumulator[key] = [].concat(accumulator[key], value);
|
|
14745
|
+
};
|
|
14746
|
+
}
|
|
14747
|
+
}
|
|
14748
|
+
|
|
14749
|
+
function validateArrayFormatSeparator(value) {
|
|
14750
|
+
if (typeof value !== 'string' || value.length !== 1) {
|
|
14751
|
+
throw new TypeError('arrayFormatSeparator must be single character string');
|
|
14752
|
+
}
|
|
14753
|
+
}
|
|
14754
|
+
|
|
14755
|
+
function encode(value, options) {
|
|
14756
|
+
if (options.encode) {
|
|
14757
|
+
return options.strict ? strictUriEncode(value) : encodeURIComponent(value);
|
|
14758
|
+
}
|
|
14759
|
+
|
|
14760
|
+
return value;
|
|
14761
|
+
}
|
|
14762
|
+
|
|
14763
|
+
function decode(value, options) {
|
|
14764
|
+
if (options.decode) {
|
|
14765
|
+
return decodeUriComponent(value);
|
|
14766
|
+
}
|
|
14767
|
+
|
|
14768
|
+
return value;
|
|
14769
|
+
}
|
|
14770
|
+
|
|
14771
|
+
function keysSorter(input) {
|
|
14772
|
+
if (Array.isArray(input)) {
|
|
14773
|
+
return input.sort();
|
|
14774
|
+
}
|
|
14775
|
+
|
|
14776
|
+
if (typeof input === 'object') {
|
|
14777
|
+
return keysSorter(Object.keys(input))
|
|
14778
|
+
.sort((a, b) => Number(a) - Number(b))
|
|
14779
|
+
.map(key => input[key]);
|
|
14780
|
+
}
|
|
14781
|
+
|
|
14782
|
+
return input;
|
|
14783
|
+
}
|
|
14784
|
+
|
|
14785
|
+
function removeHash(input) {
|
|
14786
|
+
const hashStart = input.indexOf('#');
|
|
14787
|
+
if (hashStart !== -1) {
|
|
14788
|
+
input = input.slice(0, hashStart);
|
|
14789
|
+
}
|
|
14790
|
+
|
|
14791
|
+
return input;
|
|
14792
|
+
}
|
|
14793
|
+
|
|
14794
|
+
function getHash(url) {
|
|
14795
|
+
let hash = '';
|
|
14796
|
+
const hashStart = url.indexOf('#');
|
|
14797
|
+
if (hashStart !== -1) {
|
|
14798
|
+
hash = url.slice(hashStart);
|
|
14799
|
+
}
|
|
14800
|
+
|
|
14801
|
+
return hash;
|
|
14802
|
+
}
|
|
14803
|
+
|
|
14804
|
+
function extract(input) {
|
|
14805
|
+
input = removeHash(input);
|
|
14806
|
+
const queryStart = input.indexOf('?');
|
|
14807
|
+
if (queryStart === -1) {
|
|
14808
|
+
return '';
|
|
14809
|
+
}
|
|
14810
|
+
|
|
14811
|
+
return input.slice(queryStart + 1);
|
|
14812
|
+
}
|
|
14813
|
+
|
|
14814
|
+
function parseValue(value, options) {
|
|
14815
|
+
if (options.parseNumbers && !Number.isNaN(Number(value)) && (typeof value === 'string' && value.trim() !== '')) {
|
|
14816
|
+
value = Number(value);
|
|
14817
|
+
} else if (options.parseBooleans && value !== null && (value.toLowerCase() === 'true' || value.toLowerCase() === 'false')) {
|
|
14818
|
+
value = value.toLowerCase() === 'true';
|
|
14819
|
+
}
|
|
14820
|
+
|
|
14821
|
+
return value;
|
|
14822
|
+
}
|
|
14823
|
+
|
|
14824
|
+
function parse(query, options) {
|
|
14825
|
+
options = Object.assign({
|
|
14826
|
+
decode: true,
|
|
14827
|
+
sort: true,
|
|
14828
|
+
arrayFormat: 'none',
|
|
14829
|
+
arrayFormatSeparator: ',',
|
|
14830
|
+
parseNumbers: false,
|
|
14831
|
+
parseBooleans: false
|
|
14832
|
+
}, options);
|
|
14833
|
+
|
|
14834
|
+
validateArrayFormatSeparator(options.arrayFormatSeparator);
|
|
14835
|
+
|
|
14836
|
+
const formatter = parserForArrayFormat(options);
|
|
14837
|
+
|
|
14838
|
+
// Create an object with no prototype
|
|
14839
|
+
const ret = Object.create(null);
|
|
14840
|
+
|
|
14841
|
+
if (typeof query !== 'string') {
|
|
14842
|
+
return ret;
|
|
14843
|
+
}
|
|
14844
|
+
|
|
14845
|
+
query = query.trim().replace(/^[?#&]/, '');
|
|
14846
|
+
|
|
14847
|
+
if (!query) {
|
|
14848
|
+
return ret;
|
|
14849
|
+
}
|
|
14850
|
+
|
|
14851
|
+
for (const param of query.split('&')) {
|
|
14852
|
+
let [key, value] = splitOnFirst(options.decode ? param.replace(/\+/g, ' ') : param, '=');
|
|
14853
|
+
|
|
14854
|
+
// Missing `=` should be `null`:
|
|
14855
|
+
// http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters
|
|
14856
|
+
value = value === undefined ? null : ['comma', 'separator'].includes(options.arrayFormat) ? value : decode(value, options);
|
|
14857
|
+
formatter(decode(key, options), value, ret);
|
|
14858
|
+
}
|
|
14859
|
+
|
|
14860
|
+
for (const key of Object.keys(ret)) {
|
|
14861
|
+
const value = ret[key];
|
|
14862
|
+
if (typeof value === 'object' && value !== null) {
|
|
14863
|
+
for (const k of Object.keys(value)) {
|
|
14864
|
+
value[k] = parseValue(value[k], options);
|
|
14865
|
+
}
|
|
14866
|
+
} else {
|
|
14867
|
+
ret[key] = parseValue(value, options);
|
|
14868
|
+
}
|
|
14869
|
+
}
|
|
14870
|
+
|
|
14871
|
+
if (options.sort === false) {
|
|
14872
|
+
return ret;
|
|
14873
|
+
}
|
|
14874
|
+
|
|
14875
|
+
return (options.sort === true ? Object.keys(ret).sort() : Object.keys(ret).sort(options.sort)).reduce((result, key) => {
|
|
14876
|
+
const value = ret[key];
|
|
14877
|
+
if (Boolean(value) && typeof value === 'object' && !Array.isArray(value)) {
|
|
14878
|
+
// Sort object keys, not values
|
|
14879
|
+
result[key] = keysSorter(value);
|
|
14880
|
+
} else {
|
|
14881
|
+
result[key] = value;
|
|
14882
|
+
}
|
|
14883
|
+
|
|
14884
|
+
return result;
|
|
14885
|
+
}, Object.create(null));
|
|
14886
|
+
}
|
|
14887
|
+
|
|
14888
|
+
exports.extract = extract;
|
|
14889
|
+
exports.parse = parse;
|
|
14890
|
+
|
|
14891
|
+
exports.stringify = (object, options) => {
|
|
14892
|
+
if (!object) {
|
|
14893
|
+
return '';
|
|
14894
|
+
}
|
|
14895
|
+
|
|
14896
|
+
options = Object.assign({
|
|
14897
|
+
encode: true,
|
|
14898
|
+
strict: true,
|
|
14899
|
+
arrayFormat: 'none',
|
|
14900
|
+
arrayFormatSeparator: ','
|
|
14901
|
+
}, options);
|
|
14902
|
+
|
|
14903
|
+
validateArrayFormatSeparator(options.arrayFormatSeparator);
|
|
14904
|
+
|
|
14905
|
+
const shouldFilter = key => (
|
|
14906
|
+
(options.skipNull && isNullOrUndefined(object[key])) ||
|
|
14907
|
+
(options.skipEmptyString && object[key] === '')
|
|
14908
|
+
);
|
|
14909
|
+
|
|
14910
|
+
const formatter = encoderForArrayFormat(options);
|
|
14911
|
+
|
|
14912
|
+
const objectCopy = {};
|
|
14913
|
+
|
|
14914
|
+
for (const key of Object.keys(object)) {
|
|
14915
|
+
if (!shouldFilter(key)) {
|
|
14916
|
+
objectCopy[key] = object[key];
|
|
14917
|
+
}
|
|
14918
|
+
}
|
|
14919
|
+
|
|
14920
|
+
const keys = Object.keys(objectCopy);
|
|
14921
|
+
|
|
14922
|
+
if (options.sort !== false) {
|
|
14923
|
+
keys.sort(options.sort);
|
|
14924
|
+
}
|
|
14925
|
+
|
|
14926
|
+
return keys.map(key => {
|
|
14927
|
+
const value = object[key];
|
|
14928
|
+
|
|
14929
|
+
if (value === undefined) {
|
|
14930
|
+
return '';
|
|
14931
|
+
}
|
|
14932
|
+
|
|
14933
|
+
if (value === null) {
|
|
14934
|
+
return encode(key, options);
|
|
14935
|
+
}
|
|
14936
|
+
|
|
14937
|
+
if (Array.isArray(value)) {
|
|
14938
|
+
return value
|
|
14939
|
+
.reduce(formatter(key), [])
|
|
14940
|
+
.join('&');
|
|
14941
|
+
}
|
|
14942
|
+
|
|
14943
|
+
return encode(key, options) + '=' + encode(value, options);
|
|
14944
|
+
}).filter(x => x.length > 0).join('&');
|
|
14945
|
+
};
|
|
14946
|
+
|
|
14947
|
+
exports.parseUrl = (url, options) => {
|
|
14948
|
+
options = Object.assign({
|
|
14949
|
+
decode: true
|
|
14950
|
+
}, options);
|
|
14951
|
+
|
|
14952
|
+
const [url_, hash] = splitOnFirst(url, '#');
|
|
14953
|
+
|
|
14954
|
+
return Object.assign(
|
|
14955
|
+
{
|
|
14956
|
+
url: url_.split('?')[0] || '',
|
|
14957
|
+
query: parse(extract(url), options)
|
|
14958
|
+
},
|
|
14959
|
+
options && options.parseFragmentIdentifier && hash ? {fragmentIdentifier: decode(hash, options)} : {}
|
|
14960
|
+
);
|
|
14961
|
+
};
|
|
14962
|
+
|
|
14963
|
+
exports.stringifyUrl = (object, options) => {
|
|
14964
|
+
options = Object.assign({
|
|
14965
|
+
encode: true,
|
|
14966
|
+
strict: true
|
|
14967
|
+
}, options);
|
|
14968
|
+
|
|
14969
|
+
const url = removeHash(object.url).split('?')[0] || '';
|
|
14970
|
+
const queryFromUrl = exports.extract(object.url);
|
|
14971
|
+
const parsedQueryFromUrl = exports.parse(queryFromUrl, {sort: false});
|
|
14972
|
+
|
|
14973
|
+
const query = Object.assign(parsedQueryFromUrl, object.query);
|
|
14974
|
+
let queryString = exports.stringify(query, options);
|
|
14975
|
+
if (queryString) {
|
|
14976
|
+
queryString = `?${queryString}`;
|
|
14977
|
+
}
|
|
14978
|
+
|
|
14979
|
+
let hash = getHash(object.url);
|
|
14980
|
+
if (object.fragmentIdentifier) {
|
|
14981
|
+
hash = `#${encode(object.fragmentIdentifier, options)}`;
|
|
14982
|
+
}
|
|
14983
|
+
|
|
14984
|
+
return `${url}${queryString}${hash}`;
|
|
14985
|
+
};
|
|
14986
|
+
});
|
|
14290
14987
|
|
|
14291
14988
|
var IkasProductList = /** @class */ (function () {
|
|
14292
|
-
function IkasProductList(data) {
|
|
14989
|
+
function IkasProductList(data, router) {
|
|
14293
14990
|
var _this = this;
|
|
14991
|
+
this.filters = null;
|
|
14294
14992
|
this._initialized = false;
|
|
14295
14993
|
this._minPage = null;
|
|
14296
|
-
|
|
14297
|
-
this.
|
|
14298
|
-
// Used for recommending products for a specific product
|
|
14994
|
+
this._filterBrandId = null;
|
|
14995
|
+
this._filterCategoryId = null;
|
|
14299
14996
|
this._recommendFor = null; // productId
|
|
14300
14997
|
this._isLoading = false;
|
|
14301
|
-
this.
|
|
14302
|
-
|
|
14303
|
-
|
|
14304
|
-
var _a, _b
|
|
14305
|
-
return __generator(this, function (
|
|
14306
|
-
switch (
|
|
14998
|
+
this._fetchRequestTime = 0;
|
|
14999
|
+
this.router = null;
|
|
15000
|
+
this.applyFilters = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
15001
|
+
var _a, _b;
|
|
15002
|
+
return __generator(this, function (_c) {
|
|
15003
|
+
switch (_c.label) {
|
|
15004
|
+
case 0: return [4 /*yield*/, this.getInitial()];
|
|
15005
|
+
case 1:
|
|
15006
|
+
_c.sent();
|
|
15007
|
+
// Change url params
|
|
15008
|
+
if (this.isBrowser()) {
|
|
15009
|
+
if (this.isFiltered) {
|
|
15010
|
+
(_a = this.router) === null || _a === void 0 ? void 0 : _a.replace(location.pathname + "?" + this.filterQueryParams, undefined, { shallow: true });
|
|
15011
|
+
}
|
|
15012
|
+
else {
|
|
15013
|
+
(_b = this.router) === null || _b === void 0 ? void 0 : _b.replace("" + location.pathname, undefined, {
|
|
15014
|
+
shallow: true,
|
|
15015
|
+
});
|
|
15016
|
+
}
|
|
15017
|
+
}
|
|
15018
|
+
return [2 /*return*/];
|
|
15019
|
+
}
|
|
15020
|
+
});
|
|
15021
|
+
}); };
|
|
15022
|
+
this.getInitial = function (queryParams) { return __awaiter(_this, void 0, void 0, function () {
|
|
15023
|
+
var fetchRequestTime, page, limit, response_1, data, err_1;
|
|
15024
|
+
return __generator(this, function (_a) {
|
|
15025
|
+
switch (_a.label) {
|
|
14307
15026
|
case 0:
|
|
14308
|
-
if (this._isLoading)
|
|
14309
|
-
return [2 /*return*/];
|
|
14310
15027
|
this._isLoading = true;
|
|
14311
|
-
|
|
15028
|
+
fetchRequestTime = Date.now();
|
|
15029
|
+
this._fetchRequestTime = fetchRequestTime;
|
|
15030
|
+
_a.label = 1;
|
|
14312
15031
|
case 1:
|
|
14313
|
-
|
|
14314
|
-
page =
|
|
15032
|
+
_a.trys.push([1, 5, 6, 7]);
|
|
15033
|
+
page = 1;
|
|
14315
15034
|
limit = this._limit;
|
|
15035
|
+
if (!(this.isFilterable && !this.filters)) return [3 /*break*/, 3];
|
|
15036
|
+
return [4 /*yield*/, this.getFilters()];
|
|
15037
|
+
case 2:
|
|
15038
|
+
_a.sent();
|
|
15039
|
+
_a.label = 3;
|
|
15040
|
+
case 3:
|
|
15041
|
+
this.applyQueryParamFilters(queryParams);
|
|
14316
15042
|
if (this.isStatic) {
|
|
14317
15043
|
page = undefined;
|
|
14318
15044
|
limit = undefined;
|
|
14319
15045
|
}
|
|
14320
15046
|
else if (this.isDiscounted) {
|
|
14321
|
-
// TODO use filter
|
|
14322
15047
|
page = 1;
|
|
14323
15048
|
limit = 10;
|
|
14324
15049
|
}
|
|
14325
15050
|
else if (this.isRecommended) {
|
|
14326
|
-
// TODO use filter
|
|
14327
15051
|
page = 1;
|
|
14328
15052
|
limit = 10;
|
|
14329
15053
|
}
|
|
14330
|
-
return [4 /*yield*/,
|
|
14331
|
-
|
|
14332
|
-
|
|
14333
|
-
|
|
14334
|
-
|
|
14335
|
-
|
|
14336
|
-
categoryIds: ((_c = this._filters) === null || _c === void 0 ? void 0 : _c.category) ? [this._filters.category]
|
|
14337
|
-
: undefined,
|
|
14338
|
-
})];
|
|
14339
|
-
case 2:
|
|
14340
|
-
response_1 = _d.sent();
|
|
14341
|
-
data_1 = [];
|
|
15054
|
+
return [4 /*yield*/, this.searchProducts(page || 1, limit || 10)];
|
|
15055
|
+
case 4:
|
|
15056
|
+
response_1 = _a.sent();
|
|
15057
|
+
if (!response_1 || this._fetchRequestTime !== fetchRequestTime)
|
|
15058
|
+
return [2 /*return*/];
|
|
15059
|
+
data = [];
|
|
14342
15060
|
if (this.isStatic) {
|
|
14343
|
-
|
|
14344
|
-
var product = response_1.
|
|
15061
|
+
data = this._productListPropValue.productIds.map(function (pID) {
|
|
15062
|
+
var product = response_1.data.find(function (p) { return p.id === pID.productId; });
|
|
14345
15063
|
var variant = product === null || product === void 0 ? void 0 : product.variants.find(function (v) { return v.id === pID.variantId; });
|
|
14346
15064
|
return new IkasProductDetail(product, variant.variantValues);
|
|
14347
15065
|
});
|
|
14348
15066
|
}
|
|
14349
15067
|
else {
|
|
14350
|
-
|
|
15068
|
+
data = response_1.data.map(function (product) {
|
|
14351
15069
|
return new IkasProductDetail(product, product.variants[0].variantValues);
|
|
14352
15070
|
});
|
|
14353
15071
|
}
|
|
14354
|
-
|
|
14355
|
-
|
|
14356
|
-
|
|
14357
|
-
|
|
14358
|
-
|
|
14359
|
-
|
|
14360
|
-
|
|
14361
|
-
|
|
14362
|
-
err_1 = _d.sent();
|
|
15072
|
+
this.data = data;
|
|
15073
|
+
this._count = response_1.count;
|
|
15074
|
+
this._initialized = true;
|
|
15075
|
+
this._page = page || 1;
|
|
15076
|
+
this._minPage = this.page;
|
|
15077
|
+
return [3 /*break*/, 7];
|
|
15078
|
+
case 5:
|
|
15079
|
+
err_1 = _a.sent();
|
|
14363
15080
|
console.log(err_1);
|
|
14364
|
-
return [3 /*break*/,
|
|
14365
|
-
case
|
|
14366
|
-
|
|
14367
|
-
|
|
14368
|
-
});
|
|
15081
|
+
return [3 /*break*/, 7];
|
|
15082
|
+
case 6:
|
|
15083
|
+
if (fetchRequestTime === this._fetchRequestTime)
|
|
15084
|
+
this._isLoading = false;
|
|
14369
15085
|
return [7 /*endfinally*/];
|
|
14370
|
-
case
|
|
15086
|
+
case 7: return [2 /*return*/];
|
|
14371
15087
|
}
|
|
14372
15088
|
});
|
|
14373
15089
|
}); };
|
|
14374
15090
|
this.getPrev = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
14375
|
-
var
|
|
14376
|
-
|
|
14377
|
-
|
|
14378
|
-
return __generator(this, function (_d) {
|
|
14379
|
-
switch (_d.label) {
|
|
15091
|
+
var minPage, response, data, err_2;
|
|
15092
|
+
return __generator(this, function (_a) {
|
|
15093
|
+
switch (_a.label) {
|
|
14380
15094
|
case 0:
|
|
14381
15095
|
if (this.isStatic ||
|
|
14382
15096
|
this.isDiscounted ||
|
|
@@ -14385,49 +15099,37 @@ var IkasProductList = /** @class */ (function () {
|
|
|
14385
15099
|
!this.hasPrev)
|
|
14386
15100
|
return [2 /*return*/];
|
|
14387
15101
|
this._isLoading = true;
|
|
14388
|
-
|
|
15102
|
+
_a.label = 1;
|
|
14389
15103
|
case 1:
|
|
14390
|
-
|
|
14391
|
-
|
|
14392
|
-
return [4 /*yield*/,
|
|
14393
|
-
idList: this.isStatic
|
|
14394
|
-
? (_a = this._productListPropValue.productIds) === null || _a === void 0 ? void 0 : _a.map(function (p) { return p.productId; }) : undefined,
|
|
14395
|
-
page: minPage_1,
|
|
14396
|
-
limit: this._limit,
|
|
14397
|
-
brandId: ((_b = this._filters) === null || _b === void 0 ? void 0 : _b.brand) ? this._filters.brand : undefined,
|
|
14398
|
-
categoryIds: ((_c = this._filters) === null || _c === void 0 ? void 0 : _c.category) ? [this._filters.category]
|
|
14399
|
-
: undefined,
|
|
14400
|
-
})];
|
|
15104
|
+
_a.trys.push([1, 3, 4, 5]);
|
|
15105
|
+
minPage = this._minPage - 1;
|
|
15106
|
+
return [4 /*yield*/, this.searchProducts(minPage, this.limit)];
|
|
14401
15107
|
case 2:
|
|
14402
|
-
|
|
14403
|
-
|
|
15108
|
+
response = _a.sent();
|
|
15109
|
+
if (!response)
|
|
15110
|
+
return [2 /*return*/];
|
|
15111
|
+
data = response.data.map(function (product) {
|
|
14404
15112
|
return new IkasProductDetail(product, product.variants[0].variantValues);
|
|
14405
15113
|
});
|
|
14406
|
-
|
|
14407
|
-
|
|
14408
|
-
|
|
14409
|
-
_this._minPage = minPage_1;
|
|
14410
|
-
});
|
|
15114
|
+
this.data = data.concat(this.data);
|
|
15115
|
+
this._count = response.count;
|
|
15116
|
+
this._minPage = minPage;
|
|
14411
15117
|
return [3 /*break*/, 5];
|
|
14412
15118
|
case 3:
|
|
14413
|
-
err_2 =
|
|
15119
|
+
err_2 = _a.sent();
|
|
14414
15120
|
console.log(err_2);
|
|
14415
15121
|
return [3 /*break*/, 5];
|
|
14416
15122
|
case 4:
|
|
14417
|
-
|
|
14418
|
-
_this._isLoading = false;
|
|
14419
|
-
});
|
|
15123
|
+
this._isLoading = false;
|
|
14420
15124
|
return [7 /*endfinally*/];
|
|
14421
15125
|
case 5: return [2 /*return*/];
|
|
14422
15126
|
}
|
|
14423
15127
|
});
|
|
14424
15128
|
}); };
|
|
14425
15129
|
this.getNext = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
14426
|
-
var
|
|
14427
|
-
|
|
14428
|
-
|
|
14429
|
-
return __generator(this, function (_c) {
|
|
14430
|
-
switch (_c.label) {
|
|
15130
|
+
var response, data, err_3;
|
|
15131
|
+
return __generator(this, function (_a) {
|
|
15132
|
+
switch (_a.label) {
|
|
14431
15133
|
case 0:
|
|
14432
15134
|
if (this.isStatic ||
|
|
14433
15135
|
this.isDiscounted ||
|
|
@@ -14436,46 +15138,36 @@ var IkasProductList = /** @class */ (function () {
|
|
|
14436
15138
|
!this.hasNext)
|
|
14437
15139
|
return [2 /*return*/];
|
|
14438
15140
|
this._isLoading = true;
|
|
14439
|
-
|
|
15141
|
+
_a.label = 1;
|
|
14440
15142
|
case 1:
|
|
14441
|
-
|
|
14442
|
-
return [4 /*yield*/,
|
|
14443
|
-
page: this.page + 1,
|
|
14444
|
-
limit: this.limit,
|
|
14445
|
-
brandId: ((_a = this._filters) === null || _a === void 0 ? void 0 : _a.brand) ? this._filters.brand : undefined,
|
|
14446
|
-
categoryIds: ((_b = this._filters) === null || _b === void 0 ? void 0 : _b.category) ? [this._filters.category]
|
|
14447
|
-
: undefined,
|
|
14448
|
-
})];
|
|
15143
|
+
_a.trys.push([1, 3, 4, 5]);
|
|
15144
|
+
return [4 /*yield*/, this.searchProducts(this.page + 1, this.limit)];
|
|
14449
15145
|
case 2:
|
|
14450
|
-
|
|
14451
|
-
|
|
15146
|
+
response = _a.sent();
|
|
15147
|
+
if (!response)
|
|
15148
|
+
return [2 /*return*/];
|
|
15149
|
+
data = response.data.map(function (product) {
|
|
14452
15150
|
return new IkasProductDetail(product, product.variants[0].variantValues);
|
|
14453
15151
|
});
|
|
14454
|
-
|
|
14455
|
-
|
|
14456
|
-
|
|
14457
|
-
_this._page = _this.page + 1;
|
|
14458
|
-
});
|
|
15152
|
+
this.data = this.data.concat(data);
|
|
15153
|
+
this._count = response.count;
|
|
15154
|
+
this._page = this.page + 1;
|
|
14459
15155
|
return [3 /*break*/, 5];
|
|
14460
15156
|
case 3:
|
|
14461
|
-
err_3 =
|
|
15157
|
+
err_3 = _a.sent();
|
|
14462
15158
|
console.log(err_3);
|
|
14463
15159
|
return [3 /*break*/, 5];
|
|
14464
15160
|
case 4:
|
|
14465
|
-
|
|
14466
|
-
_this._isLoading = false;
|
|
14467
|
-
});
|
|
15161
|
+
this._isLoading = false;
|
|
14468
15162
|
return [7 /*endfinally*/];
|
|
14469
15163
|
case 5: return [2 /*return*/];
|
|
14470
15164
|
}
|
|
14471
15165
|
});
|
|
14472
15166
|
}); };
|
|
14473
15167
|
this.getPage = function (page) { return __awaiter(_this, void 0, void 0, function () {
|
|
14474
|
-
var
|
|
14475
|
-
|
|
14476
|
-
|
|
14477
|
-
return __generator(this, function (_c) {
|
|
14478
|
-
switch (_c.label) {
|
|
15168
|
+
var response, data, err_4;
|
|
15169
|
+
return __generator(this, function (_a) {
|
|
15170
|
+
switch (_a.label) {
|
|
14479
15171
|
case 0:
|
|
14480
15172
|
if (this._isLoading ||
|
|
14481
15173
|
this.isStatic ||
|
|
@@ -14483,36 +15175,28 @@ var IkasProductList = /** @class */ (function () {
|
|
|
14483
15175
|
this.isRecommended)
|
|
14484
15176
|
return [2 /*return*/];
|
|
14485
15177
|
this._isLoading = true;
|
|
14486
|
-
|
|
15178
|
+
_a.label = 1;
|
|
14487
15179
|
case 1:
|
|
14488
|
-
|
|
14489
|
-
return [4 /*yield*/,
|
|
14490
|
-
page: this.page + 1,
|
|
14491
|
-
limit: this.limit,
|
|
14492
|
-
brandId: ((_a = this._filters) === null || _a === void 0 ? void 0 : _a.brand) ? this._filters.brand : undefined,
|
|
14493
|
-
categoryIds: ((_b = this._filters) === null || _b === void 0 ? void 0 : _b.category) ? [this._filters.category]
|
|
14494
|
-
: undefined,
|
|
14495
|
-
})];
|
|
15180
|
+
_a.trys.push([1, 3, 4, 5]);
|
|
15181
|
+
return [4 /*yield*/, this.searchProducts(page, this.limit)];
|
|
14496
15182
|
case 2:
|
|
14497
|
-
|
|
14498
|
-
|
|
15183
|
+
response = _a.sent();
|
|
15184
|
+
if (!response)
|
|
15185
|
+
return [2 /*return*/];
|
|
15186
|
+
data = response.data.map(function (product) {
|
|
14499
15187
|
return new IkasProductDetail(product, product.variants[0].variantValues);
|
|
14500
15188
|
});
|
|
14501
|
-
|
|
14502
|
-
|
|
14503
|
-
|
|
14504
|
-
|
|
14505
|
-
_this._minPage = page;
|
|
14506
|
-
});
|
|
15189
|
+
this.data = data;
|
|
15190
|
+
this._count = response.count;
|
|
15191
|
+
this._page = page;
|
|
15192
|
+
this._minPage = page;
|
|
14507
15193
|
return [3 /*break*/, 5];
|
|
14508
15194
|
case 3:
|
|
14509
|
-
err_4 =
|
|
15195
|
+
err_4 = _a.sent();
|
|
14510
15196
|
console.log(err_4);
|
|
14511
15197
|
return [3 /*break*/, 5];
|
|
14512
15198
|
case 4:
|
|
14513
|
-
|
|
14514
|
-
_this._isLoading = false;
|
|
14515
|
-
});
|
|
15199
|
+
this._isLoading = false;
|
|
14516
15200
|
return [7 /*endfinally*/];
|
|
14517
15201
|
case 5: return [2 /*return*/];
|
|
14518
15202
|
}
|
|
@@ -14532,12 +15216,21 @@ var IkasProductList = /** @class */ (function () {
|
|
|
14532
15216
|
this._limit = data.limit || data.productListPropValue.initialLimit || 20;
|
|
14533
15217
|
this._page = data.page || 1;
|
|
14534
15218
|
this._count = data.count || 0;
|
|
15219
|
+
this._searchKeyword = data.searchKeyword || "";
|
|
14535
15220
|
this._productListPropValue = data.productListPropValue;
|
|
14536
|
-
this.
|
|
14537
|
-
|
|
14538
|
-
: undefined;
|
|
15221
|
+
this._filterBrandId = data.filterBrandId || null;
|
|
15222
|
+
this._filterCategoryId = data.filterCategoryId || null;
|
|
14539
15223
|
this._recommendFor = data.recommendFor;
|
|
15224
|
+
this.filters = data.filters
|
|
15225
|
+
? data.filters.map(function (f) { return new IkasProductFilter(f); })
|
|
15226
|
+
: null;
|
|
15227
|
+
this.router = router;
|
|
14540
15228
|
mobx.makeAutoObservable(this);
|
|
15229
|
+
console.log("constructor");
|
|
15230
|
+
if (this.isBrowser() && location.search) {
|
|
15231
|
+
var queryParams = this.getQueryParams();
|
|
15232
|
+
this.getInitial(queryParams);
|
|
15233
|
+
}
|
|
14541
15234
|
}
|
|
14542
15235
|
Object.defineProperty(IkasProductList.prototype, "sort", {
|
|
14543
15236
|
get: function () {
|
|
@@ -14567,6 +15260,16 @@ var IkasProductList = /** @class */ (function () {
|
|
|
14567
15260
|
enumerable: false,
|
|
14568
15261
|
configurable: true
|
|
14569
15262
|
});
|
|
15263
|
+
Object.defineProperty(IkasProductList.prototype, "searchKeyword", {
|
|
15264
|
+
get: function () {
|
|
15265
|
+
return this._searchKeyword;
|
|
15266
|
+
},
|
|
15267
|
+
set: function (value) {
|
|
15268
|
+
this._searchKeyword = value;
|
|
15269
|
+
},
|
|
15270
|
+
enumerable: false,
|
|
15271
|
+
configurable: true
|
|
15272
|
+
});
|
|
14570
15273
|
Object.defineProperty(IkasProductList.prototype, "isInitialized", {
|
|
14571
15274
|
get: function () {
|
|
14572
15275
|
return this._initialized;
|
|
@@ -14574,6 +15277,22 @@ var IkasProductList = /** @class */ (function () {
|
|
|
14574
15277
|
enumerable: false,
|
|
14575
15278
|
configurable: true
|
|
14576
15279
|
});
|
|
15280
|
+
Object.defineProperty(IkasProductList.prototype, "isFilterable", {
|
|
15281
|
+
get: function () {
|
|
15282
|
+
return (this._type === exports.IkasProductListType.ALL ||
|
|
15283
|
+
this._type === exports.IkasProductListType.CATEGORY);
|
|
15284
|
+
},
|
|
15285
|
+
enumerable: false,
|
|
15286
|
+
configurable: true
|
|
15287
|
+
});
|
|
15288
|
+
Object.defineProperty(IkasProductList.prototype, "isFiltered", {
|
|
15289
|
+
get: function () {
|
|
15290
|
+
var _a;
|
|
15291
|
+
return (_a = this.filters) === null || _a === void 0 ? void 0 : _a.some(function (f) { return !!f.valueList.length; });
|
|
15292
|
+
},
|
|
15293
|
+
enumerable: false,
|
|
15294
|
+
configurable: true
|
|
15295
|
+
});
|
|
14577
15296
|
Object.defineProperty(IkasProductList.prototype, "isStatic", {
|
|
14578
15297
|
get: function () {
|
|
14579
15298
|
return this._type === exports.IkasProductListType.STATIC;
|
|
@@ -14623,8 +15342,111 @@ var IkasProductList = /** @class */ (function () {
|
|
|
14623
15342
|
enumerable: false,
|
|
14624
15343
|
configurable: true
|
|
14625
15344
|
});
|
|
14626
|
-
IkasProductList.prototype
|
|
14627
|
-
|
|
15345
|
+
Object.defineProperty(IkasProductList.prototype, "filterQueryParams", {
|
|
15346
|
+
get: function () {
|
|
15347
|
+
var _a;
|
|
15348
|
+
var queryParams = {};
|
|
15349
|
+
(_a = this.filters) === null || _a === void 0 ? void 0 : _a.forEach(function (f) {
|
|
15350
|
+
queryParams[f.key] = f.keyList;
|
|
15351
|
+
});
|
|
15352
|
+
return queryString.stringify(queryParams, { arrayFormat: "comma" });
|
|
15353
|
+
},
|
|
15354
|
+
enumerable: false,
|
|
15355
|
+
configurable: true
|
|
15356
|
+
});
|
|
15357
|
+
IkasProductList.prototype.searchProducts = function (page, limit) {
|
|
15358
|
+
var _a, _b;
|
|
15359
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
15360
|
+
var filterList;
|
|
15361
|
+
return __generator(this, function (_c) {
|
|
15362
|
+
switch (_c.label) {
|
|
15363
|
+
case 0:
|
|
15364
|
+
filterList = [];
|
|
15365
|
+
if (this._filterBrandId) {
|
|
15366
|
+
filterList.push(new IkasProductFilterValue({
|
|
15367
|
+
id: this._filterBrandId,
|
|
15368
|
+
type: exports.IkasProductFilterType.BRAND,
|
|
15369
|
+
valueList: [this._filterBrandId],
|
|
15370
|
+
}));
|
|
15371
|
+
}
|
|
15372
|
+
(_a = this.filters) === null || _a === void 0 ? void 0 : _a.forEach(function (filter) {
|
|
15373
|
+
if (filter.valueList.length) {
|
|
15374
|
+
filterList.push(new IkasProductFilterValue({
|
|
15375
|
+
id: filter.id,
|
|
15376
|
+
type: filter.type,
|
|
15377
|
+
valueList: filter.valueList,
|
|
15378
|
+
}));
|
|
15379
|
+
}
|
|
15380
|
+
});
|
|
15381
|
+
return [4 /*yield*/, IkasProductSearchAPI.searchProducts({
|
|
15382
|
+
page: page,
|
|
15383
|
+
perPage: limit,
|
|
15384
|
+
productIdList: this.isStatic
|
|
15385
|
+
? (_b = this._productListPropValue.productIds) === null || _b === void 0 ? void 0 : _b.map(function (p) { return p.productId; }) : undefined,
|
|
15386
|
+
filterList: filterList,
|
|
15387
|
+
categoryIdList: this._filterCategoryId
|
|
15388
|
+
? [this._filterCategoryId]
|
|
15389
|
+
: undefined,
|
|
15390
|
+
query: this._searchKeyword,
|
|
15391
|
+
})];
|
|
15392
|
+
case 1: return [2 /*return*/, _c.sent()];
|
|
15393
|
+
}
|
|
15394
|
+
});
|
|
15395
|
+
});
|
|
15396
|
+
};
|
|
15397
|
+
IkasProductList.prototype.clear = function () {
|
|
15398
|
+
var _a;
|
|
15399
|
+
(_a = this.filters) === null || _a === void 0 ? void 0 : _a.forEach(function (filter) { return filter.clear(); });
|
|
15400
|
+
this._searchKeyword = "";
|
|
15401
|
+
};
|
|
15402
|
+
IkasProductList.prototype.getFilters = function () {
|
|
15403
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
15404
|
+
var _a;
|
|
15405
|
+
return __generator(this, function (_b) {
|
|
15406
|
+
switch (_b.label) {
|
|
15407
|
+
case 0:
|
|
15408
|
+
_a = this;
|
|
15409
|
+
return [4 /*yield*/, IkasProductSearchAPI.getProductFilterData()];
|
|
15410
|
+
case 1:
|
|
15411
|
+
_a.filters = _b.sent();
|
|
15412
|
+
// this._filterCategoryId ? [this._filterCategoryId] : undefined
|
|
15413
|
+
if (this.filters)
|
|
15414
|
+
this.filters.sort(function (f1, f2) { return (f1.order > f2.order ? 1 : -1); });
|
|
15415
|
+
return [2 /*return*/];
|
|
15416
|
+
}
|
|
15417
|
+
});
|
|
15418
|
+
});
|
|
15419
|
+
};
|
|
15420
|
+
IkasProductList.prototype.applyQueryParamFilters = function (queryParams) {
|
|
15421
|
+
var _this = this;
|
|
15422
|
+
try {
|
|
15423
|
+
queryParams === null || queryParams === void 0 ? void 0 : queryParams.forEach(function (value, key) {
|
|
15424
|
+
var _a, _b, _c;
|
|
15425
|
+
var filter = (_a = _this.filters) === null || _a === void 0 ? void 0 : _a.find(function (f) { return f.key === key; });
|
|
15426
|
+
var valueKeys = value.split(",");
|
|
15427
|
+
if (filter) {
|
|
15428
|
+
if (filter.displayType === exports.IkasProductFilterDisplayType.NUMBER_RANGE) {
|
|
15429
|
+
filter.numberRange = new RangeValue(parseRangeStr(value));
|
|
15430
|
+
}
|
|
15431
|
+
else if (filter.displayType ===
|
|
15432
|
+
exports.IkasProductFilterDisplayType.NUMBER_RANGE_LIST) {
|
|
15433
|
+
(_b = filter.numberRangeListOptions) === null || _b === void 0 ? void 0 : _b.forEach(function (o) {
|
|
15434
|
+
if (valueKeys.includes(o.key))
|
|
15435
|
+
o.isSelected = true;
|
|
15436
|
+
});
|
|
15437
|
+
}
|
|
15438
|
+
else {
|
|
15439
|
+
(_c = filter.values) === null || _c === void 0 ? void 0 : _c.forEach(function (filterValue) {
|
|
15440
|
+
if (valueKeys.includes(filterValue.key))
|
|
15441
|
+
filterValue.isSelected = true;
|
|
15442
|
+
});
|
|
15443
|
+
}
|
|
15444
|
+
}
|
|
15445
|
+
});
|
|
15446
|
+
}
|
|
15447
|
+
catch (err) {
|
|
15448
|
+
console.log(err);
|
|
15449
|
+
}
|
|
14628
15450
|
};
|
|
14629
15451
|
IkasProductList.prototype.toJSON = function () {
|
|
14630
15452
|
return {
|
|
@@ -14634,13 +15456,24 @@ var IkasProductList = /** @class */ (function () {
|
|
|
14634
15456
|
limit: this._limit,
|
|
14635
15457
|
page: this._page,
|
|
14636
15458
|
count: this._count,
|
|
15459
|
+
searchKeyword: this._searchKeyword,
|
|
14637
15460
|
initialized: this._initialized,
|
|
14638
15461
|
minPage: this._minPage,
|
|
14639
|
-
|
|
15462
|
+
pageBrandId: this._filterBrandId,
|
|
15463
|
+
pageCategoryId: this._filterCategoryId,
|
|
15464
|
+
filters: this.filters,
|
|
14640
15465
|
recommendFor: this._recommendFor,
|
|
14641
15466
|
productListPropValue: this._productListPropValue,
|
|
14642
15467
|
};
|
|
14643
15468
|
};
|
|
15469
|
+
IkasProductList.prototype.getQueryParams = function () {
|
|
15470
|
+
if (!this.isBrowser())
|
|
15471
|
+
return;
|
|
15472
|
+
return new URLSearchParams(location.search);
|
|
15473
|
+
};
|
|
15474
|
+
IkasProductList.prototype.isBrowser = function () {
|
|
15475
|
+
return typeof window !== "undefined";
|
|
15476
|
+
};
|
|
14644
15477
|
return IkasProductList;
|
|
14645
15478
|
}());
|
|
14646
15479
|
(function (IkasProductListType) {
|
|
@@ -19435,6 +20268,8 @@ var AddressForm = /** @class */ (function () {
|
|
|
19435
20268
|
this.store = props.store;
|
|
19436
20269
|
this.validator = new Validator(this.address, this.validatorRules());
|
|
19437
20270
|
this.listCountries();
|
|
20271
|
+
if (this.address.state)
|
|
20272
|
+
this.listStates();
|
|
19438
20273
|
if (this.address.country)
|
|
19439
20274
|
this.listCities();
|
|
19440
20275
|
if (this.address.city)
|
|
@@ -21889,7 +22724,7 @@ var IkasVariantTypeAPI = /** @class */ (function () {
|
|
|
21889
22724
|
id: vv.id,
|
|
21890
22725
|
name: vv.name,
|
|
21891
22726
|
colorCode: vv.colorCode,
|
|
21892
|
-
|
|
22727
|
+
thumbnailImageId: vv.thumbnailImageId,
|
|
21893
22728
|
variantTypeId: vt.id,
|
|
21894
22729
|
});
|
|
21895
22730
|
}),
|
|
@@ -22147,6 +22982,220 @@ var IkasProductAPI = /** @class */ (function () {
|
|
|
22147
22982
|
}());
|
|
22148
22983
|
var templateObject_1$d;
|
|
22149
22984
|
|
|
22985
|
+
var IkasProductSearchAPI = /** @class */ (function () {
|
|
22986
|
+
function IkasProductSearchAPI() {
|
|
22987
|
+
}
|
|
22988
|
+
IkasProductSearchAPI.searchProducts = function (input) {
|
|
22989
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
22990
|
+
var SEARCH_PRODUCTS, _a, data, errors, err_1;
|
|
22991
|
+
return __generator(this, function (_b) {
|
|
22992
|
+
switch (_b.label) {
|
|
22993
|
+
case 0:
|
|
22994
|
+
_b.trys.push([0, 2, , 3]);
|
|
22995
|
+
SEARCH_PRODUCTS = src(templateObject_1$e || (templateObject_1$e = __makeTemplateObject(["\n query searchProducts($input: SearchInput!) {\n searchProducts(input: $input) {\n count\n data\n facets {\n id\n values {\n count\n id\n }\n }\n limit\n page\n totalCount\n }\n }\n "], ["\n query searchProducts($input: SearchInput!) {\n searchProducts(input: $input) {\n count\n data\n facets {\n id\n values {\n count\n id\n }\n }\n limit\n page\n totalCount\n }\n }\n "])));
|
|
22996
|
+
return [4 /*yield*/, apollo
|
|
22997
|
+
.getClient()
|
|
22998
|
+
.query({
|
|
22999
|
+
query: SEARCH_PRODUCTS,
|
|
23000
|
+
variables: {
|
|
23001
|
+
input: input,
|
|
23002
|
+
},
|
|
23003
|
+
})];
|
|
23004
|
+
case 1:
|
|
23005
|
+
_a = _b.sent(), data = _a.data, errors = _a.errors;
|
|
23006
|
+
if (errors && errors.length) {
|
|
23007
|
+
console.log(errors);
|
|
23008
|
+
return [2 /*return*/];
|
|
23009
|
+
}
|
|
23010
|
+
return [2 /*return*/, __assign(__assign({}, data.searchProducts), { data: data.searchProducts.data.map(function (d) {
|
|
23011
|
+
return simpleToProduct(d);
|
|
23012
|
+
}) })];
|
|
23013
|
+
case 2:
|
|
23014
|
+
err_1 = _b.sent();
|
|
23015
|
+
console.log(err_1);
|
|
23016
|
+
return [3 /*break*/, 3];
|
|
23017
|
+
case 3: return [2 /*return*/];
|
|
23018
|
+
}
|
|
23019
|
+
});
|
|
23020
|
+
});
|
|
23021
|
+
};
|
|
23022
|
+
IkasProductSearchAPI.getProductFilterData = function (categoryIds) {
|
|
23023
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
23024
|
+
var QUERY, _a, data, errors, err_2;
|
|
23025
|
+
return __generator(this, function (_b) {
|
|
23026
|
+
switch (_b.label) {
|
|
23027
|
+
case 0:
|
|
23028
|
+
_b.trys.push([0, 2, , 3]);
|
|
23029
|
+
QUERY = src(templateObject_2$4 || (templateObject_2$4 = __makeTemplateObject(["\n query getProductFilterData($categoryIds: [String!]) {\n getProductFilterData(categoryIds: $categoryIds) {\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 }\n }\n "], ["\n query getProductFilterData($categoryIds: [String!]) {\n getProductFilterData(categoryIds: $categoryIds) {\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 }\n }\n "])));
|
|
23030
|
+
return [4 /*yield*/, apollo
|
|
23031
|
+
.getClient()
|
|
23032
|
+
.query({
|
|
23033
|
+
query: QUERY,
|
|
23034
|
+
variables: {
|
|
23035
|
+
categoryIds: categoryIds || null,
|
|
23036
|
+
},
|
|
23037
|
+
})];
|
|
23038
|
+
case 1:
|
|
23039
|
+
_a = _b.sent(), data = _a.data, errors = _a.errors;
|
|
23040
|
+
if (errors && errors.length) {
|
|
23041
|
+
console.log(errors);
|
|
23042
|
+
return [2 /*return*/];
|
|
23043
|
+
}
|
|
23044
|
+
return [2 /*return*/, data.getProductFilterData.map(function (d) {
|
|
23045
|
+
var _a;
|
|
23046
|
+
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); }) }));
|
|
23047
|
+
})];
|
|
23048
|
+
case 2:
|
|
23049
|
+
err_2 = _b.sent();
|
|
23050
|
+
console.log(err_2);
|
|
23051
|
+
return [3 /*break*/, 3];
|
|
23052
|
+
case 3: return [2 /*return*/];
|
|
23053
|
+
}
|
|
23054
|
+
});
|
|
23055
|
+
});
|
|
23056
|
+
};
|
|
23057
|
+
return IkasProductSearchAPI;
|
|
23058
|
+
}());
|
|
23059
|
+
function simpleToProduct(simple) {
|
|
23060
|
+
var _a, _b, _c, _d, _e;
|
|
23061
|
+
return new IkasProduct({
|
|
23062
|
+
id: simple.id,
|
|
23063
|
+
attributes: (_a = simple.attributes) === null || _a === void 0 ? void 0 : _a.map(function (a) {
|
|
23064
|
+
var _a, _b, _c, _d, _e;
|
|
23065
|
+
return new IkasProductAttributeValue({
|
|
23066
|
+
value: a.value,
|
|
23067
|
+
productAttributeId: (_a = a.productAttribute) === null || _a === void 0 ? void 0 : _a.id,
|
|
23068
|
+
productAttributeOptionId: (_b = a.productAttributeOption) === null || _b === void 0 ? void 0 : _b.id,
|
|
23069
|
+
productAttribute: new IkasProductAttribute({
|
|
23070
|
+
id: (_c = a.productAttribute) === null || _c === void 0 ? void 0 : _c.id,
|
|
23071
|
+
name: (_d = a.productAttribute) === null || _d === void 0 ? void 0 : _d.name,
|
|
23072
|
+
type: (_e = a.productAttribute) === null || _e === void 0 ? void 0 : _e.type,
|
|
23073
|
+
}),
|
|
23074
|
+
productAttributeOption: a.productAttributeOption,
|
|
23075
|
+
});
|
|
23076
|
+
}),
|
|
23077
|
+
brand: new IkasBrand({
|
|
23078
|
+
id: (_b = simple.brand) === null || _b === void 0 ? void 0 : _b.id,
|
|
23079
|
+
name: (_c = simple.brand) === null || _c === void 0 ? void 0 : _c.name,
|
|
23080
|
+
metaData: new IkasHTMLMetaData({
|
|
23081
|
+
slug: ((_d = simple.brand) === null || _d === void 0 ? void 0 : _d.slug) || "",
|
|
23082
|
+
}),
|
|
23083
|
+
}),
|
|
23084
|
+
categories: (_e = simple.categories) === null || _e === void 0 ? void 0 : _e.map(function (c) {
|
|
23085
|
+
return new IkasCategory({
|
|
23086
|
+
id: c.id,
|
|
23087
|
+
name: c.name,
|
|
23088
|
+
path: c.path,
|
|
23089
|
+
metaData: new IkasHTMLMetaData({
|
|
23090
|
+
slug: c.slug || "",
|
|
23091
|
+
}),
|
|
23092
|
+
});
|
|
23093
|
+
}),
|
|
23094
|
+
description: simple.description || undefined,
|
|
23095
|
+
metaData: new IkasHTMLMetaData(simple.metaData || undefined),
|
|
23096
|
+
name: simple.name,
|
|
23097
|
+
shortDescription: simple.shortDescription || undefined,
|
|
23098
|
+
taxValue: simple.taxValue || undefined,
|
|
23099
|
+
type: simple.type || undefined,
|
|
23100
|
+
variantTypes: simple.productVariantTypes.map(function (pvt) {
|
|
23101
|
+
return new IkasProductVariantType({
|
|
23102
|
+
variantType: new IkasVariantType({
|
|
23103
|
+
id: pvt.variantType.id,
|
|
23104
|
+
name: pvt.variantType.name,
|
|
23105
|
+
selectionType: pvt.variantType.selectionType,
|
|
23106
|
+
values: pvt.variantType.values
|
|
23107
|
+
.map(function (v) {
|
|
23108
|
+
return new IkasVariantValue({
|
|
23109
|
+
id: v.id,
|
|
23110
|
+
colorCode: v.colorCode,
|
|
23111
|
+
name: v.name,
|
|
23112
|
+
thumbnailImageId: v.thumbnailImageId,
|
|
23113
|
+
variantTypeId: pvt.variantType.id,
|
|
23114
|
+
});
|
|
23115
|
+
})
|
|
23116
|
+
.filter(function (v) { return pvt.variantValueIds.includes(v.id); }),
|
|
23117
|
+
}),
|
|
23118
|
+
variantValueIds: pvt.variantValueIds,
|
|
23119
|
+
});
|
|
23120
|
+
}),
|
|
23121
|
+
variants: simple.variants.map(function (v) {
|
|
23122
|
+
var _a, _b, _c, _d;
|
|
23123
|
+
return new IkasProductVariant({
|
|
23124
|
+
id: v.id,
|
|
23125
|
+
attributes: (_a = v.attributes) === null || _a === void 0 ? void 0 : _a.map(function (a) {
|
|
23126
|
+
var _a, _b, _c, _d, _e;
|
|
23127
|
+
return new IkasProductAttributeValue({
|
|
23128
|
+
value: a.value,
|
|
23129
|
+
productAttributeId: (_a = a.productAttribute) === null || _a === void 0 ? void 0 : _a.id,
|
|
23130
|
+
productAttributeOptionId: (_b = a.productAttributeOption) === null || _b === void 0 ? void 0 : _b.id,
|
|
23131
|
+
productAttribute: new IkasProductAttribute({
|
|
23132
|
+
id: (_c = a.productAttribute) === null || _c === void 0 ? void 0 : _c.id,
|
|
23133
|
+
name: (_d = a.productAttribute) === null || _d === void 0 ? void 0 : _d.name,
|
|
23134
|
+
type: (_e = a.productAttribute) === null || _e === void 0 ? void 0 : _e.type,
|
|
23135
|
+
}),
|
|
23136
|
+
productAttributeOption: a.productAttributeOption,
|
|
23137
|
+
});
|
|
23138
|
+
}),
|
|
23139
|
+
sku: v.sku,
|
|
23140
|
+
barcodeList: v.barcodeList || undefined,
|
|
23141
|
+
images: (_b = v.images) === null || _b === void 0 ? void 0 : _b.map(function (i) { return new IkasImage(i.id); }),
|
|
23142
|
+
price: new IkasProductPrice((_c = v.prices) === null || _c === void 0 ? void 0 : _c.find(function (p) { return p.priceListId === null; })),
|
|
23143
|
+
stock: v.stocks.length ? v.stocks[0].stockCount : 0,
|
|
23144
|
+
variantValues: (_d = v.variantValues) === null || _d === void 0 ? void 0 : _d.map(function (vv) {
|
|
23145
|
+
var _a;
|
|
23146
|
+
var variantValue = (_a = simple.productVariantTypes
|
|
23147
|
+
.find(function (pvt) { return pvt.variantType.id === vv.variantTypeId; })) === null || _a === void 0 ? void 0 : _a.variantType.values.find(function (_vv) { return _vv.id === vv.variantValueId; });
|
|
23148
|
+
return new IkasVariantValue({
|
|
23149
|
+
id: vv.variantValueId,
|
|
23150
|
+
name: variantValue === null || variantValue === void 0 ? void 0 : variantValue.name,
|
|
23151
|
+
colorCode: variantValue === null || variantValue === void 0 ? void 0 : variantValue.colorCode,
|
|
23152
|
+
thumbnailImageId: variantValue === null || variantValue === void 0 ? void 0 : variantValue.thumbnailImageId,
|
|
23153
|
+
});
|
|
23154
|
+
}),
|
|
23155
|
+
});
|
|
23156
|
+
}),
|
|
23157
|
+
});
|
|
23158
|
+
}
|
|
23159
|
+
var templateObject_1$e, templateObject_2$4;
|
|
23160
|
+
// type SearchInput = {
|
|
23161
|
+
// categoryIdList: string[] | null;
|
|
23162
|
+
// filterList: SearchInputFilter[] | null;
|
|
23163
|
+
// order: SearchInputOrder[] | null;
|
|
23164
|
+
// page: number | null;
|
|
23165
|
+
// perPage: number | null;
|
|
23166
|
+
// priceListId: string | null;
|
|
23167
|
+
// productId: string | null;
|
|
23168
|
+
// query: string | null;
|
|
23169
|
+
// slug: string | null;
|
|
23170
|
+
// };
|
|
23171
|
+
// type SearchInputFilter = {
|
|
23172
|
+
// id: string;
|
|
23173
|
+
// type: ProductFilterType;
|
|
23174
|
+
// valueList: string[];
|
|
23175
|
+
// };
|
|
23176
|
+
// export type SearchInputOrder = {
|
|
23177
|
+
// direction: SortByDirection;
|
|
23178
|
+
// type: SortByType;
|
|
23179
|
+
// };
|
|
23180
|
+
// enum SortByDirection {
|
|
23181
|
+
// ASC = "ASC",
|
|
23182
|
+
// DESC = "DESC",
|
|
23183
|
+
// }
|
|
23184
|
+
// enum SortByType {
|
|
23185
|
+
// CREATED_AT = "CREATED_AT",
|
|
23186
|
+
// DISCOUNT_RATIO = "DISCOUNT_RATIO",
|
|
23187
|
+
// PRICE = "PRICE",
|
|
23188
|
+
// }
|
|
23189
|
+
// export enum ProductFilterType {
|
|
23190
|
+
// ATTRIBUTE = "ATTRIBUTE",
|
|
23191
|
+
// BRAND = "BRAND",
|
|
23192
|
+
// DISCOUNT_RATIO = "DISCOUNT_RATIO",
|
|
23193
|
+
// PRICE = "PRICE",
|
|
23194
|
+
// STOCK_STATUS = "STOCK_STATUS",
|
|
23195
|
+
// TAG = "TAG",
|
|
23196
|
+
// VARIANT_TYPE = "VARIANT_TYPE",
|
|
23197
|
+
// }
|
|
23198
|
+
|
|
22150
23199
|
var IkasProductAttributeAPI = /** @class */ (function () {
|
|
22151
23200
|
function IkasProductAttributeAPI() {
|
|
22152
23201
|
}
|
|
@@ -22156,7 +23205,7 @@ var IkasProductAttributeAPI = /** @class */ (function () {
|
|
|
22156
23205
|
return __generator(this, function (_b) {
|
|
22157
23206
|
switch (_b.label) {
|
|
22158
23207
|
case 0:
|
|
22159
|
-
LIST_PRODUCT_ATTRIBUTES = src(templateObject_1$
|
|
23208
|
+
LIST_PRODUCT_ATTRIBUTES = src(templateObject_1$f || (templateObject_1$f = __makeTemplateObject(["\n query listProductAttribute($id: StringFilterInput!) {\n listProductAttribute(id: $id) {\n id\n createdAt\n updatedAt\n deleted\n name\n description\n type\n options {\n id\n createdAt\n updatedAt\n deleted\n name\n }\n }\n }\n "], ["\n query listProductAttribute($id: StringFilterInput!) {\n listProductAttribute(id: $id) {\n id\n createdAt\n updatedAt\n deleted\n name\n description\n type\n options {\n id\n createdAt\n updatedAt\n deleted\n name\n }\n }\n }\n "])));
|
|
22160
23209
|
_b.label = 1;
|
|
22161
23210
|
case 1:
|
|
22162
23211
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -22189,7 +23238,7 @@ var IkasProductAttributeAPI = /** @class */ (function () {
|
|
|
22189
23238
|
};
|
|
22190
23239
|
return IkasProductAttributeAPI;
|
|
22191
23240
|
}());
|
|
22192
|
-
var templateObject_1$
|
|
23241
|
+
var templateObject_1$f;
|
|
22193
23242
|
|
|
22194
23243
|
var IkasStateAPI = /** @class */ (function () {
|
|
22195
23244
|
function IkasStateAPI() {
|
|
@@ -22200,7 +23249,7 @@ var IkasStateAPI = /** @class */ (function () {
|
|
|
22200
23249
|
return __generator(this, function (_b) {
|
|
22201
23250
|
switch (_b.label) {
|
|
22202
23251
|
case 0:
|
|
22203
|
-
QUERY = src(templateObject_1$
|
|
23252
|
+
QUERY = src(templateObject_1$g || (templateObject_1$g = __makeTemplateObject(["\n query listState($countryId: StringFilterInput!) {\n listState(countryId: $countryId) {\n id\n name\n stateCode\n }\n }\n "], ["\n query listState($countryId: StringFilterInput!) {\n listState(countryId: $countryId) {\n id\n name\n stateCode\n }\n }\n "])));
|
|
22204
23253
|
_b.label = 1;
|
|
22205
23254
|
case 1:
|
|
22206
23255
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -22237,7 +23286,7 @@ var IkasStateAPI = /** @class */ (function () {
|
|
|
22237
23286
|
};
|
|
22238
23287
|
return IkasStateAPI;
|
|
22239
23288
|
}());
|
|
22240
|
-
var templateObject_1$
|
|
23289
|
+
var templateObject_1$g;
|
|
22241
23290
|
|
|
22242
23291
|
var IkasStorefrontDomain = /** @class */ (function () {
|
|
22243
23292
|
function IkasStorefrontDomain(data) {
|
|
@@ -22330,7 +23379,7 @@ var IkasStorefrontAPI = /** @class */ (function () {
|
|
|
22330
23379
|
return __generator(this, function (_b) {
|
|
22331
23380
|
switch (_b.label) {
|
|
22332
23381
|
case 0:
|
|
22333
|
-
QUERY = src(templateObject_1$
|
|
23382
|
+
QUERY = src(templateObject_1$h || (templateObject_1$h = __makeTemplateObject(["\n query getStorefront($storefrontId: String!) {\n getStorefront(id: $storefrontId) {\n id\n name\n themeId\n themeVersionId\n userId\n # domains {\n # id\n # merchantDomainId\n # name\n # redirectDomainName\n # }\n regions {\n id\n locale\n # themeJSON\n privacyPolicy\n returnPolicy\n termsOfService\n }\n }\n }\n "], ["\n query getStorefront($storefrontId: String!) {\n getStorefront(id: $storefrontId) {\n id\n name\n themeId\n themeVersionId\n userId\n # domains {\n # id\n # merchantDomainId\n # name\n # redirectDomainName\n # }\n regions {\n id\n locale\n # themeJSON\n privacyPolicy\n returnPolicy\n termsOfService\n }\n }\n }\n "])));
|
|
22334
23383
|
_b.label = 1;
|
|
22335
23384
|
case 1:
|
|
22336
23385
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -22360,7 +23409,7 @@ var IkasStorefrontAPI = /** @class */ (function () {
|
|
|
22360
23409
|
};
|
|
22361
23410
|
return IkasStorefrontAPI;
|
|
22362
23411
|
}());
|
|
22363
|
-
var templateObject_1$
|
|
23412
|
+
var templateObject_1$h;
|
|
22364
23413
|
|
|
22365
23414
|
var IkasThemeAPI = /** @class */ (function () {
|
|
22366
23415
|
function IkasThemeAPI() {
|
|
@@ -22779,6 +23828,7 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
22779
23828
|
lines = this.cart.items.map(function (i) { return ({
|
|
22780
23829
|
quantity: i.quantity,
|
|
22781
23830
|
variantId: i.variant.id,
|
|
23831
|
+
productId: i.variant.productId,
|
|
22782
23832
|
}); });
|
|
22783
23833
|
return [4 /*yield*/, IkasCheckoutAPI.checkStocks(lines)];
|
|
22784
23834
|
case 1:
|
|
@@ -24988,6 +26038,8 @@ var IkasPageHead = mobxReactLite.observer(function (_a) {
|
|
|
24988
26038
|
var page = _a.page, pageTitle = _a.pageTitle, description = _a.description, pageSpecificDataStr = _a.pageSpecificDataStr, props = __rest(_a, ["page", "pageTitle", "description", "pageSpecificDataStr"]);
|
|
24989
26039
|
var ogpMetas = [];
|
|
24990
26040
|
var schemas = [];
|
|
26041
|
+
var isCanonicalLinkAdd = false;
|
|
26042
|
+
var canonicalHref = "";
|
|
24991
26043
|
if (props.addOgpMetas) {
|
|
24992
26044
|
ogpMetas.push({
|
|
24993
26045
|
property: "og:type",
|
|
@@ -25046,7 +26098,15 @@ var IkasPageHead = mobxReactLite.observer(function (_a) {
|
|
|
25046
26098
|
schemas.push(storeSchema);
|
|
25047
26099
|
}
|
|
25048
26100
|
if (pageSpecificDataStr && (page === null || page === void 0 ? void 0 : page.type) === exports.IkasThemePageType.PRODUCT) {
|
|
25049
|
-
var
|
|
26101
|
+
var productDetailParsed = JSON.parse(pageSpecificDataStr);
|
|
26102
|
+
var productDetail = new IkasProductDetail(productDetailParsed.product, productDetailParsed.selectedVariantValues);
|
|
26103
|
+
if (typeof window !== "undefined" && productDetail.product.hasVariant) {
|
|
26104
|
+
isCanonicalLinkAdd =
|
|
26105
|
+
window.location.pathname !== productDetail.product.href;
|
|
26106
|
+
canonicalHref =
|
|
26107
|
+
"https://" + window.location.hostname + productDetail.product.href;
|
|
26108
|
+
}
|
|
26109
|
+
var schema = createProductSchema(productDetail);
|
|
25050
26110
|
if (schema)
|
|
25051
26111
|
schemas.push(schema);
|
|
25052
26112
|
}
|
|
@@ -25063,6 +26123,7 @@ var IkasPageHead = mobxReactLite.observer(function (_a) {
|
|
|
25063
26123
|
return (React.createElement(Head__default['default'], null,
|
|
25064
26124
|
React.createElement("title", null, pageTitle || ""),
|
|
25065
26125
|
React.createElement("meta", { name: "description", content: description || "" }),
|
|
26126
|
+
isCanonicalLinkAdd && React.createElement("link", { rel: "canonical", href: canonicalHref }),
|
|
25066
26127
|
!!props.addOgpMetas &&
|
|
25067
26128
|
ogpMetas.map(function (ogpMeta, index) { return (React.createElement("meta", { key: ogpMeta.content + "-" + index, property: ogpMeta.property, content: ogpMeta.content })); }),
|
|
25068
26129
|
!!schemas.length &&
|
|
@@ -25096,11 +26157,9 @@ function createStoreSchema(merchantSettings) {
|
|
|
25096
26157
|
url: "https://" + hostname,
|
|
25097
26158
|
};
|
|
25098
26159
|
}
|
|
25099
|
-
function createProductSchema(
|
|
26160
|
+
function createProductSchema(productDetail) {
|
|
25100
26161
|
var _a;
|
|
25101
26162
|
try {
|
|
25102
|
-
var productDetailParsed = JSON.parse(pageSpecificDataStr);
|
|
25103
|
-
var productDetail = new IkasProductDetail(productDetailParsed.product, productDetailParsed.selectedVariantValues);
|
|
25104
26163
|
var isBrowser = typeof window !== "undefined";
|
|
25105
26164
|
if (isBrowser) {
|
|
25106
26165
|
var urlParams = new URLSearchParams(window.location.search);
|
|
@@ -25804,6 +26863,10 @@ var pageStyle$1 = {
|
|
|
25804
26863
|
justifyContent: "space-between",
|
|
25805
26864
|
};
|
|
25806
26865
|
|
|
26866
|
+
var Image = function (props) {
|
|
26867
|
+
return React.createElement(Image__default['default'], __assign({}, props, { unoptimized: true, quality: 100 }));
|
|
26868
|
+
};
|
|
26869
|
+
|
|
25807
26870
|
var GTMHead = function (_a) {
|
|
25808
26871
|
var blockHTML = _a.blockHTML;
|
|
25809
26872
|
var gtmId = process.env.GTM_ID;
|
|
@@ -25832,6 +26895,7 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
25832
26895
|
IkasPage: IkasPage,
|
|
25833
26896
|
IkasPageHead: IkasPageHead,
|
|
25834
26897
|
IkasPageEditor: IkasPageEditor,
|
|
26898
|
+
Image: Image,
|
|
25835
26899
|
GTMHead: GTMHead,
|
|
25836
26900
|
GTMBody: GTMBody,
|
|
25837
26901
|
GTMPageView: GTMPageView,
|
|
@@ -25876,7 +26940,8 @@ var Page$1 = function (_a) {
|
|
|
25876
26940
|
var page = _a.page, pageSpecificDataStr = _a.pageSpecificDataStr, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr, merchantSettings = _a.merchantSettings;
|
|
25877
26941
|
var router$1 = router.useRouter();
|
|
25878
26942
|
var _b = React.useState(false), isBrowser = _b[0], setIsBrowser = _b[1];
|
|
25879
|
-
var
|
|
26943
|
+
var initialPropValues = React.useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router$1); }, [propValuesStr]);
|
|
26944
|
+
var _c = React.useState(initialPropValues), propValues = _c[0], setPropValues = _c[1];
|
|
25880
26945
|
React.useEffect(function () {
|
|
25881
26946
|
setIsBrowser(typeof window !== "undefined");
|
|
25882
26947
|
}, []);
|
|
@@ -26383,6 +27448,7 @@ exports.GTMPageView = GTMPageView;
|
|
|
26383
27448
|
exports.GTMProductView = GTMProductView;
|
|
26384
27449
|
exports.GTMPurchase = GTMPurchase;
|
|
26385
27450
|
exports.GTMRemoveFromCart = GTMRemoveFromCart;
|
|
27451
|
+
exports.IkasApplicableProductFilterValue = IkasApplicableProductFilterValue;
|
|
26386
27452
|
exports.IkasBaseStore = IkasBaseStore;
|
|
26387
27453
|
exports.IkasBrand = IkasBrand;
|
|
26388
27454
|
exports.IkasBrandAPI = IkasBrandAPI;
|
|
@@ -26426,10 +27492,12 @@ exports.IkasProductAttributeAPI = IkasProductAttributeAPI;
|
|
|
26426
27492
|
exports.IkasProductAttributeValue = IkasProductAttributeValue;
|
|
26427
27493
|
exports.IkasProductDetail = IkasProductDetail;
|
|
26428
27494
|
exports.IkasProductDetailPropValue = IkasProductDetailPropValue;
|
|
27495
|
+
exports.IkasProductFilter = IkasProductFilter;
|
|
27496
|
+
exports.IkasProductFilterValue = IkasProductFilterValue;
|
|
26429
27497
|
exports.IkasProductList = IkasProductList;
|
|
26430
|
-
exports.IkasProductListFilter = IkasProductListFilter;
|
|
26431
27498
|
exports.IkasProductListPropValue = IkasProductListPropValue;
|
|
26432
27499
|
exports.IkasProductPrice = IkasProductPrice;
|
|
27500
|
+
exports.IkasProductSearchAPI = IkasProductSearchAPI;
|
|
26433
27501
|
exports.IkasProductVariant = IkasProductVariant;
|
|
26434
27502
|
exports.IkasProductVariantType = IkasProductVariantType;
|
|
26435
27503
|
exports.IkasStateAPI = IkasStateAPI;
|
|
@@ -26446,6 +27514,7 @@ exports.IkasThemeSettings = IkasThemeSettings;
|
|
|
26446
27514
|
exports.IkasVariantType = IkasVariantType;
|
|
26447
27515
|
exports.IkasVariantTypeAPI = IkasVariantTypeAPI;
|
|
26448
27516
|
exports.IkasVariantValue = IkasVariantValue;
|
|
27517
|
+
exports.Image = Image;
|
|
26449
27518
|
exports.IndexPage = home;
|
|
26450
27519
|
exports.LessThanRule = LessThanRule;
|
|
26451
27520
|
exports.LoginForm = LoginForm;
|
|
@@ -26455,6 +27524,7 @@ exports.MinRule = MinRule;
|
|
|
26455
27524
|
exports.OrderDetailPage = _id_$2;
|
|
26456
27525
|
exports.OrdersPage = index$4;
|
|
26457
27526
|
exports.PhoneRule = PhoneRule;
|
|
27527
|
+
exports.RangeValue = RangeValue;
|
|
26458
27528
|
exports.RecoverPasswordForm = RecoverPasswordForm;
|
|
26459
27529
|
exports.RecoverPasswordPage = recoverPassword;
|
|
26460
27530
|
exports.RegisterForm = RegisterForm;
|
|
@@ -26466,6 +27536,7 @@ exports.Validator = Validator;
|
|
|
26466
27536
|
exports.apollo = apollo;
|
|
26467
27537
|
exports.decodeBase64 = decodeBase64;
|
|
26468
27538
|
exports.formatMoney = formatMoney;
|
|
27539
|
+
exports.parseRangeStr = parseRangeStr;
|
|
26469
27540
|
exports.pascalCase = pascalCase;
|
|
26470
27541
|
exports.stringToSlug = stringToSlug;
|
|
26471
27542
|
exports.validatePhoneNumber = validatePhoneNumber;
|