@ikas/storefront 0.0.49 → 0.0.51
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/favorite-product/__generated__/isFavoriteProduct.d.ts +6 -0
- package/build/api/favorite-product/__generated__/listFavoriteProducts.d.ts +12 -0
- package/build/api/favorite-product/__generated__/saveFavoriteProduct.d.ts +7 -0
- package/build/api/favorite-product/index.d.ts +6 -0
- package/build/api/index.d.ts +2 -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 +1513 -210
- package/build/index.js +1519 -209
- package/build/models/data/category/index.d.ts +2 -0
- package/build/models/data/favorite-product/index.d.ts +6 -0
- package/build/models/data/index.d.ts +2 -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/theme/page/index.d.ts +2 -1
- package/build/models/ui/index.d.ts +0 -1
- package/build/models/ui/product-list/index.d.ts +30 -7
- package/build/pages/account/favorite-products.d.ts +11 -0
- package/build/pages/index.d.ts +2 -1
- package/build/store/customer.d.ts +6 -1
- 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,199 @@ 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
|
+
}
|
|
13501
|
+
|
|
13502
|
+
var IkasFavoriteProduct = /** @class */ (function () {
|
|
13503
|
+
function IkasFavoriteProduct(data) {
|
|
13504
|
+
this.id = data.id || "";
|
|
13505
|
+
this.customerId = data.customerId || "";
|
|
13506
|
+
this.productId = data.productId || "";
|
|
13507
|
+
mobx.makeAutoObservable(this);
|
|
13508
|
+
}
|
|
13509
|
+
return IkasFavoriteProduct;
|
|
13510
|
+
}());
|
|
13287
13511
|
|
|
13288
13512
|
var IkasOrderTransaction = /** @class */ (function () {
|
|
13289
13513
|
function IkasOrderTransaction(data) {
|
|
@@ -13551,6 +13775,7 @@ var IkasThemePage = /** @class */ (function () {
|
|
|
13551
13775
|
IkasThemePageType["FORGOT_PASSWORD"] = "FORGOT_PASSWORD";
|
|
13552
13776
|
IkasThemePageType["RECOVER_PASSWORD"] = "RECOVER_PASSWORD";
|
|
13553
13777
|
IkasThemePageType["CART"] = "CART";
|
|
13778
|
+
IkasThemePageType["FAVORITE_PRODUCTS"] = "FAVORITE_PRODUCTS";
|
|
13554
13779
|
})(exports.IkasThemePageType || (exports.IkasThemePageType = {}));
|
|
13555
13780
|
|
|
13556
13781
|
var IkasThemeColor = /** @class */ (function () {
|
|
@@ -14272,111 +14497,611 @@ var IkasProductDetail = /** @class */ (function () {
|
|
|
14272
14497
|
return IkasProductDetail;
|
|
14273
14498
|
}());
|
|
14274
14499
|
|
|
14275
|
-
var
|
|
14276
|
-
|
|
14277
|
-
|
|
14278
|
-
|
|
14279
|
-
|
|
14280
|
-
|
|
14281
|
-
|
|
14282
|
-
|
|
14283
|
-
|
|
14284
|
-
|
|
14285
|
-
|
|
14286
|
-
|
|
14287
|
-
|
|
14288
|
-
|
|
14289
|
-
|
|
14500
|
+
var strictUriEncode = str => encodeURIComponent(str).replace(/[!'()*]/g, x => `%${x.charCodeAt(0).toString(16).toUpperCase()}`);
|
|
14501
|
+
|
|
14502
|
+
var token = '%[a-f0-9]{2}';
|
|
14503
|
+
var singleMatcher = new RegExp(token, 'gi');
|
|
14504
|
+
var multiMatcher = new RegExp('(' + token + ')+', 'gi');
|
|
14505
|
+
|
|
14506
|
+
function decodeComponents(components, split) {
|
|
14507
|
+
try {
|
|
14508
|
+
// Try to decode the entire string first
|
|
14509
|
+
return decodeURIComponent(components.join(''));
|
|
14510
|
+
} catch (err) {
|
|
14511
|
+
// Do nothing
|
|
14512
|
+
}
|
|
14513
|
+
|
|
14514
|
+
if (components.length === 1) {
|
|
14515
|
+
return components;
|
|
14516
|
+
}
|
|
14517
|
+
|
|
14518
|
+
split = split || 1;
|
|
14519
|
+
|
|
14520
|
+
// Split the array in 2 parts
|
|
14521
|
+
var left = components.slice(0, split);
|
|
14522
|
+
var right = components.slice(split);
|
|
14523
|
+
|
|
14524
|
+
return Array.prototype.concat.call([], decodeComponents(left), decodeComponents(right));
|
|
14525
|
+
}
|
|
14526
|
+
|
|
14527
|
+
function decode(input) {
|
|
14528
|
+
try {
|
|
14529
|
+
return decodeURIComponent(input);
|
|
14530
|
+
} catch (err) {
|
|
14531
|
+
var tokens = input.match(singleMatcher);
|
|
14532
|
+
|
|
14533
|
+
for (var i = 1; i < tokens.length; i++) {
|
|
14534
|
+
input = decodeComponents(tokens, i).join('');
|
|
14535
|
+
|
|
14536
|
+
tokens = input.match(singleMatcher);
|
|
14537
|
+
}
|
|
14538
|
+
|
|
14539
|
+
return input;
|
|
14540
|
+
}
|
|
14541
|
+
}
|
|
14542
|
+
|
|
14543
|
+
function customDecodeURIComponent(input) {
|
|
14544
|
+
// Keep track of all the replacements and prefill the map with the `BOM`
|
|
14545
|
+
var replaceMap = {
|
|
14546
|
+
'%FE%FF': '\uFFFD\uFFFD',
|
|
14547
|
+
'%FF%FE': '\uFFFD\uFFFD'
|
|
14548
|
+
};
|
|
14549
|
+
|
|
14550
|
+
var match = multiMatcher.exec(input);
|
|
14551
|
+
while (match) {
|
|
14552
|
+
try {
|
|
14553
|
+
// Decode as big chunks as possible
|
|
14554
|
+
replaceMap[match[0]] = decodeURIComponent(match[0]);
|
|
14555
|
+
} catch (err) {
|
|
14556
|
+
var result = decode(match[0]);
|
|
14557
|
+
|
|
14558
|
+
if (result !== match[0]) {
|
|
14559
|
+
replaceMap[match[0]] = result;
|
|
14560
|
+
}
|
|
14561
|
+
}
|
|
14562
|
+
|
|
14563
|
+
match = multiMatcher.exec(input);
|
|
14564
|
+
}
|
|
14565
|
+
|
|
14566
|
+
// Add `%C2` at the end of the map to make sure it does not replace the combinator before everything else
|
|
14567
|
+
replaceMap['%C2'] = '\uFFFD';
|
|
14568
|
+
|
|
14569
|
+
var entries = Object.keys(replaceMap);
|
|
14570
|
+
|
|
14571
|
+
for (var i = 0; i < entries.length; i++) {
|
|
14572
|
+
// Replace all decoded components
|
|
14573
|
+
var key = entries[i];
|
|
14574
|
+
input = input.replace(new RegExp(key, 'g'), replaceMap[key]);
|
|
14575
|
+
}
|
|
14576
|
+
|
|
14577
|
+
return input;
|
|
14578
|
+
}
|
|
14579
|
+
|
|
14580
|
+
var decodeUriComponent = function (encodedURI) {
|
|
14581
|
+
if (typeof encodedURI !== 'string') {
|
|
14582
|
+
throw new TypeError('Expected `encodedURI` to be of type `string`, got `' + typeof encodedURI + '`');
|
|
14583
|
+
}
|
|
14584
|
+
|
|
14585
|
+
try {
|
|
14586
|
+
encodedURI = encodedURI.replace(/\+/g, ' ');
|
|
14587
|
+
|
|
14588
|
+
// Try the built in decoder first
|
|
14589
|
+
return decodeURIComponent(encodedURI);
|
|
14590
|
+
} catch (err) {
|
|
14591
|
+
// Fallback to a more advanced decoder
|
|
14592
|
+
return customDecodeURIComponent(encodedURI);
|
|
14593
|
+
}
|
|
14594
|
+
};
|
|
14595
|
+
|
|
14596
|
+
var splitOnFirst = (string, separator) => {
|
|
14597
|
+
if (!(typeof string === 'string' && typeof separator === 'string')) {
|
|
14598
|
+
throw new TypeError('Expected the arguments to be of type `string`');
|
|
14599
|
+
}
|
|
14600
|
+
|
|
14601
|
+
if (separator === '') {
|
|
14602
|
+
return [string];
|
|
14603
|
+
}
|
|
14604
|
+
|
|
14605
|
+
const separatorIndex = string.indexOf(separator);
|
|
14606
|
+
|
|
14607
|
+
if (separatorIndex === -1) {
|
|
14608
|
+
return [string];
|
|
14609
|
+
}
|
|
14610
|
+
|
|
14611
|
+
return [
|
|
14612
|
+
string.slice(0, separatorIndex),
|
|
14613
|
+
string.slice(separatorIndex + separator.length)
|
|
14614
|
+
];
|
|
14615
|
+
};
|
|
14616
|
+
|
|
14617
|
+
var queryString = createCommonjsModule(function (module, exports) {
|
|
14618
|
+
|
|
14619
|
+
|
|
14620
|
+
|
|
14621
|
+
|
|
14622
|
+
const isNullOrUndefined = value => value === null || value === undefined;
|
|
14623
|
+
|
|
14624
|
+
function encoderForArrayFormat(options) {
|
|
14625
|
+
switch (options.arrayFormat) {
|
|
14626
|
+
case 'index':
|
|
14627
|
+
return key => (result, value) => {
|
|
14628
|
+
const index = result.length;
|
|
14629
|
+
|
|
14630
|
+
if (
|
|
14631
|
+
value === undefined ||
|
|
14632
|
+
(options.skipNull && value === null) ||
|
|
14633
|
+
(options.skipEmptyString && value === '')
|
|
14634
|
+
) {
|
|
14635
|
+
return result;
|
|
14636
|
+
}
|
|
14637
|
+
|
|
14638
|
+
if (value === null) {
|
|
14639
|
+
return [...result, [encode(key, options), '[', index, ']'].join('')];
|
|
14640
|
+
}
|
|
14641
|
+
|
|
14642
|
+
return [
|
|
14643
|
+
...result,
|
|
14644
|
+
[encode(key, options), '[', encode(index, options), ']=', encode(value, options)].join('')
|
|
14645
|
+
];
|
|
14646
|
+
};
|
|
14647
|
+
|
|
14648
|
+
case 'bracket':
|
|
14649
|
+
return key => (result, value) => {
|
|
14650
|
+
if (
|
|
14651
|
+
value === undefined ||
|
|
14652
|
+
(options.skipNull && value === null) ||
|
|
14653
|
+
(options.skipEmptyString && value === '')
|
|
14654
|
+
) {
|
|
14655
|
+
return result;
|
|
14656
|
+
}
|
|
14657
|
+
|
|
14658
|
+
if (value === null) {
|
|
14659
|
+
return [...result, [encode(key, options), '[]'].join('')];
|
|
14660
|
+
}
|
|
14661
|
+
|
|
14662
|
+
return [...result, [encode(key, options), '[]=', encode(value, options)].join('')];
|
|
14663
|
+
};
|
|
14664
|
+
|
|
14665
|
+
case 'comma':
|
|
14666
|
+
case 'separator':
|
|
14667
|
+
return key => (result, value) => {
|
|
14668
|
+
if (value === null || value === undefined || value.length === 0) {
|
|
14669
|
+
return result;
|
|
14670
|
+
}
|
|
14671
|
+
|
|
14672
|
+
if (result.length === 0) {
|
|
14673
|
+
return [[encode(key, options), '=', encode(value, options)].join('')];
|
|
14674
|
+
}
|
|
14675
|
+
|
|
14676
|
+
return [[result, encode(value, options)].join(options.arrayFormatSeparator)];
|
|
14677
|
+
};
|
|
14678
|
+
|
|
14679
|
+
default:
|
|
14680
|
+
return key => (result, value) => {
|
|
14681
|
+
if (
|
|
14682
|
+
value === undefined ||
|
|
14683
|
+
(options.skipNull && value === null) ||
|
|
14684
|
+
(options.skipEmptyString && value === '')
|
|
14685
|
+
) {
|
|
14686
|
+
return result;
|
|
14687
|
+
}
|
|
14688
|
+
|
|
14689
|
+
if (value === null) {
|
|
14690
|
+
return [...result, encode(key, options)];
|
|
14691
|
+
}
|
|
14692
|
+
|
|
14693
|
+
return [...result, [encode(key, options), '=', encode(value, options)].join('')];
|
|
14694
|
+
};
|
|
14695
|
+
}
|
|
14696
|
+
}
|
|
14697
|
+
|
|
14698
|
+
function parserForArrayFormat(options) {
|
|
14699
|
+
let result;
|
|
14700
|
+
|
|
14701
|
+
switch (options.arrayFormat) {
|
|
14702
|
+
case 'index':
|
|
14703
|
+
return (key, value, accumulator) => {
|
|
14704
|
+
result = /\[(\d*)\]$/.exec(key);
|
|
14705
|
+
|
|
14706
|
+
key = key.replace(/\[\d*\]$/, '');
|
|
14707
|
+
|
|
14708
|
+
if (!result) {
|
|
14709
|
+
accumulator[key] = value;
|
|
14710
|
+
return;
|
|
14711
|
+
}
|
|
14712
|
+
|
|
14713
|
+
if (accumulator[key] === undefined) {
|
|
14714
|
+
accumulator[key] = {};
|
|
14715
|
+
}
|
|
14716
|
+
|
|
14717
|
+
accumulator[key][result[1]] = value;
|
|
14718
|
+
};
|
|
14719
|
+
|
|
14720
|
+
case 'bracket':
|
|
14721
|
+
return (key, value, accumulator) => {
|
|
14722
|
+
result = /(\[\])$/.exec(key);
|
|
14723
|
+
key = key.replace(/\[\]$/, '');
|
|
14724
|
+
|
|
14725
|
+
if (!result) {
|
|
14726
|
+
accumulator[key] = value;
|
|
14727
|
+
return;
|
|
14728
|
+
}
|
|
14729
|
+
|
|
14730
|
+
if (accumulator[key] === undefined) {
|
|
14731
|
+
accumulator[key] = [value];
|
|
14732
|
+
return;
|
|
14733
|
+
}
|
|
14734
|
+
|
|
14735
|
+
accumulator[key] = [].concat(accumulator[key], value);
|
|
14736
|
+
};
|
|
14737
|
+
|
|
14738
|
+
case 'comma':
|
|
14739
|
+
case 'separator':
|
|
14740
|
+
return (key, value, accumulator) => {
|
|
14741
|
+
const isArray = typeof value === 'string' && value.includes(options.arrayFormatSeparator);
|
|
14742
|
+
const isEncodedArray = (typeof value === 'string' && !isArray && decode(value, options).includes(options.arrayFormatSeparator));
|
|
14743
|
+
value = isEncodedArray ? decode(value, options) : value;
|
|
14744
|
+
const newValue = isArray || isEncodedArray ? value.split(options.arrayFormatSeparator).map(item => decode(item, options)) : value === null ? value : decode(value, options);
|
|
14745
|
+
accumulator[key] = newValue;
|
|
14746
|
+
};
|
|
14747
|
+
|
|
14748
|
+
default:
|
|
14749
|
+
return (key, value, accumulator) => {
|
|
14750
|
+
if (accumulator[key] === undefined) {
|
|
14751
|
+
accumulator[key] = value;
|
|
14752
|
+
return;
|
|
14753
|
+
}
|
|
14754
|
+
|
|
14755
|
+
accumulator[key] = [].concat(accumulator[key], value);
|
|
14756
|
+
};
|
|
14757
|
+
}
|
|
14758
|
+
}
|
|
14759
|
+
|
|
14760
|
+
function validateArrayFormatSeparator(value) {
|
|
14761
|
+
if (typeof value !== 'string' || value.length !== 1) {
|
|
14762
|
+
throw new TypeError('arrayFormatSeparator must be single character string');
|
|
14763
|
+
}
|
|
14764
|
+
}
|
|
14765
|
+
|
|
14766
|
+
function encode(value, options) {
|
|
14767
|
+
if (options.encode) {
|
|
14768
|
+
return options.strict ? strictUriEncode(value) : encodeURIComponent(value);
|
|
14769
|
+
}
|
|
14770
|
+
|
|
14771
|
+
return value;
|
|
14772
|
+
}
|
|
14773
|
+
|
|
14774
|
+
function decode(value, options) {
|
|
14775
|
+
if (options.decode) {
|
|
14776
|
+
return decodeUriComponent(value);
|
|
14777
|
+
}
|
|
14778
|
+
|
|
14779
|
+
return value;
|
|
14780
|
+
}
|
|
14781
|
+
|
|
14782
|
+
function keysSorter(input) {
|
|
14783
|
+
if (Array.isArray(input)) {
|
|
14784
|
+
return input.sort();
|
|
14785
|
+
}
|
|
14786
|
+
|
|
14787
|
+
if (typeof input === 'object') {
|
|
14788
|
+
return keysSorter(Object.keys(input))
|
|
14789
|
+
.sort((a, b) => Number(a) - Number(b))
|
|
14790
|
+
.map(key => input[key]);
|
|
14791
|
+
}
|
|
14792
|
+
|
|
14793
|
+
return input;
|
|
14794
|
+
}
|
|
14795
|
+
|
|
14796
|
+
function removeHash(input) {
|
|
14797
|
+
const hashStart = input.indexOf('#');
|
|
14798
|
+
if (hashStart !== -1) {
|
|
14799
|
+
input = input.slice(0, hashStart);
|
|
14800
|
+
}
|
|
14801
|
+
|
|
14802
|
+
return input;
|
|
14803
|
+
}
|
|
14804
|
+
|
|
14805
|
+
function getHash(url) {
|
|
14806
|
+
let hash = '';
|
|
14807
|
+
const hashStart = url.indexOf('#');
|
|
14808
|
+
if (hashStart !== -1) {
|
|
14809
|
+
hash = url.slice(hashStart);
|
|
14810
|
+
}
|
|
14811
|
+
|
|
14812
|
+
return hash;
|
|
14813
|
+
}
|
|
14814
|
+
|
|
14815
|
+
function extract(input) {
|
|
14816
|
+
input = removeHash(input);
|
|
14817
|
+
const queryStart = input.indexOf('?');
|
|
14818
|
+
if (queryStart === -1) {
|
|
14819
|
+
return '';
|
|
14820
|
+
}
|
|
14821
|
+
|
|
14822
|
+
return input.slice(queryStart + 1);
|
|
14823
|
+
}
|
|
14824
|
+
|
|
14825
|
+
function parseValue(value, options) {
|
|
14826
|
+
if (options.parseNumbers && !Number.isNaN(Number(value)) && (typeof value === 'string' && value.trim() !== '')) {
|
|
14827
|
+
value = Number(value);
|
|
14828
|
+
} else if (options.parseBooleans && value !== null && (value.toLowerCase() === 'true' || value.toLowerCase() === 'false')) {
|
|
14829
|
+
value = value.toLowerCase() === 'true';
|
|
14830
|
+
}
|
|
14831
|
+
|
|
14832
|
+
return value;
|
|
14833
|
+
}
|
|
14834
|
+
|
|
14835
|
+
function parse(query, options) {
|
|
14836
|
+
options = Object.assign({
|
|
14837
|
+
decode: true,
|
|
14838
|
+
sort: true,
|
|
14839
|
+
arrayFormat: 'none',
|
|
14840
|
+
arrayFormatSeparator: ',',
|
|
14841
|
+
parseNumbers: false,
|
|
14842
|
+
parseBooleans: false
|
|
14843
|
+
}, options);
|
|
14844
|
+
|
|
14845
|
+
validateArrayFormatSeparator(options.arrayFormatSeparator);
|
|
14846
|
+
|
|
14847
|
+
const formatter = parserForArrayFormat(options);
|
|
14848
|
+
|
|
14849
|
+
// Create an object with no prototype
|
|
14850
|
+
const ret = Object.create(null);
|
|
14851
|
+
|
|
14852
|
+
if (typeof query !== 'string') {
|
|
14853
|
+
return ret;
|
|
14854
|
+
}
|
|
14855
|
+
|
|
14856
|
+
query = query.trim().replace(/^[?#&]/, '');
|
|
14857
|
+
|
|
14858
|
+
if (!query) {
|
|
14859
|
+
return ret;
|
|
14860
|
+
}
|
|
14861
|
+
|
|
14862
|
+
for (const param of query.split('&')) {
|
|
14863
|
+
let [key, value] = splitOnFirst(options.decode ? param.replace(/\+/g, ' ') : param, '=');
|
|
14864
|
+
|
|
14865
|
+
// Missing `=` should be `null`:
|
|
14866
|
+
// http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters
|
|
14867
|
+
value = value === undefined ? null : ['comma', 'separator'].includes(options.arrayFormat) ? value : decode(value, options);
|
|
14868
|
+
formatter(decode(key, options), value, ret);
|
|
14869
|
+
}
|
|
14870
|
+
|
|
14871
|
+
for (const key of Object.keys(ret)) {
|
|
14872
|
+
const value = ret[key];
|
|
14873
|
+
if (typeof value === 'object' && value !== null) {
|
|
14874
|
+
for (const k of Object.keys(value)) {
|
|
14875
|
+
value[k] = parseValue(value[k], options);
|
|
14876
|
+
}
|
|
14877
|
+
} else {
|
|
14878
|
+
ret[key] = parseValue(value, options);
|
|
14879
|
+
}
|
|
14880
|
+
}
|
|
14881
|
+
|
|
14882
|
+
if (options.sort === false) {
|
|
14883
|
+
return ret;
|
|
14884
|
+
}
|
|
14885
|
+
|
|
14886
|
+
return (options.sort === true ? Object.keys(ret).sort() : Object.keys(ret).sort(options.sort)).reduce((result, key) => {
|
|
14887
|
+
const value = ret[key];
|
|
14888
|
+
if (Boolean(value) && typeof value === 'object' && !Array.isArray(value)) {
|
|
14889
|
+
// Sort object keys, not values
|
|
14890
|
+
result[key] = keysSorter(value);
|
|
14891
|
+
} else {
|
|
14892
|
+
result[key] = value;
|
|
14893
|
+
}
|
|
14894
|
+
|
|
14895
|
+
return result;
|
|
14896
|
+
}, Object.create(null));
|
|
14897
|
+
}
|
|
14898
|
+
|
|
14899
|
+
exports.extract = extract;
|
|
14900
|
+
exports.parse = parse;
|
|
14901
|
+
|
|
14902
|
+
exports.stringify = (object, options) => {
|
|
14903
|
+
if (!object) {
|
|
14904
|
+
return '';
|
|
14905
|
+
}
|
|
14906
|
+
|
|
14907
|
+
options = Object.assign({
|
|
14908
|
+
encode: true,
|
|
14909
|
+
strict: true,
|
|
14910
|
+
arrayFormat: 'none',
|
|
14911
|
+
arrayFormatSeparator: ','
|
|
14912
|
+
}, options);
|
|
14913
|
+
|
|
14914
|
+
validateArrayFormatSeparator(options.arrayFormatSeparator);
|
|
14915
|
+
|
|
14916
|
+
const shouldFilter = key => (
|
|
14917
|
+
(options.skipNull && isNullOrUndefined(object[key])) ||
|
|
14918
|
+
(options.skipEmptyString && object[key] === '')
|
|
14919
|
+
);
|
|
14920
|
+
|
|
14921
|
+
const formatter = encoderForArrayFormat(options);
|
|
14922
|
+
|
|
14923
|
+
const objectCopy = {};
|
|
14924
|
+
|
|
14925
|
+
for (const key of Object.keys(object)) {
|
|
14926
|
+
if (!shouldFilter(key)) {
|
|
14927
|
+
objectCopy[key] = object[key];
|
|
14928
|
+
}
|
|
14929
|
+
}
|
|
14930
|
+
|
|
14931
|
+
const keys = Object.keys(objectCopy);
|
|
14932
|
+
|
|
14933
|
+
if (options.sort !== false) {
|
|
14934
|
+
keys.sort(options.sort);
|
|
14935
|
+
}
|
|
14936
|
+
|
|
14937
|
+
return keys.map(key => {
|
|
14938
|
+
const value = object[key];
|
|
14939
|
+
|
|
14940
|
+
if (value === undefined) {
|
|
14941
|
+
return '';
|
|
14942
|
+
}
|
|
14943
|
+
|
|
14944
|
+
if (value === null) {
|
|
14945
|
+
return encode(key, options);
|
|
14946
|
+
}
|
|
14947
|
+
|
|
14948
|
+
if (Array.isArray(value)) {
|
|
14949
|
+
return value
|
|
14950
|
+
.reduce(formatter(key), [])
|
|
14951
|
+
.join('&');
|
|
14952
|
+
}
|
|
14953
|
+
|
|
14954
|
+
return encode(key, options) + '=' + encode(value, options);
|
|
14955
|
+
}).filter(x => x.length > 0).join('&');
|
|
14956
|
+
};
|
|
14957
|
+
|
|
14958
|
+
exports.parseUrl = (url, options) => {
|
|
14959
|
+
options = Object.assign({
|
|
14960
|
+
decode: true
|
|
14961
|
+
}, options);
|
|
14962
|
+
|
|
14963
|
+
const [url_, hash] = splitOnFirst(url, '#');
|
|
14964
|
+
|
|
14965
|
+
return Object.assign(
|
|
14966
|
+
{
|
|
14967
|
+
url: url_.split('?')[0] || '',
|
|
14968
|
+
query: parse(extract(url), options)
|
|
14969
|
+
},
|
|
14970
|
+
options && options.parseFragmentIdentifier && hash ? {fragmentIdentifier: decode(hash, options)} : {}
|
|
14971
|
+
);
|
|
14972
|
+
};
|
|
14973
|
+
|
|
14974
|
+
exports.stringifyUrl = (object, options) => {
|
|
14975
|
+
options = Object.assign({
|
|
14976
|
+
encode: true,
|
|
14977
|
+
strict: true
|
|
14978
|
+
}, options);
|
|
14979
|
+
|
|
14980
|
+
const url = removeHash(object.url).split('?')[0] || '';
|
|
14981
|
+
const queryFromUrl = exports.extract(object.url);
|
|
14982
|
+
const parsedQueryFromUrl = exports.parse(queryFromUrl, {sort: false});
|
|
14983
|
+
|
|
14984
|
+
const query = Object.assign(parsedQueryFromUrl, object.query);
|
|
14985
|
+
let queryString = exports.stringify(query, options);
|
|
14986
|
+
if (queryString) {
|
|
14987
|
+
queryString = `?${queryString}`;
|
|
14988
|
+
}
|
|
14989
|
+
|
|
14990
|
+
let hash = getHash(object.url);
|
|
14991
|
+
if (object.fragmentIdentifier) {
|
|
14992
|
+
hash = `#${encode(object.fragmentIdentifier, options)}`;
|
|
14993
|
+
}
|
|
14994
|
+
|
|
14995
|
+
return `${url}${queryString}${hash}`;
|
|
14996
|
+
};
|
|
14997
|
+
});
|
|
14290
14998
|
|
|
14291
14999
|
var IkasProductList = /** @class */ (function () {
|
|
14292
|
-
function IkasProductList(data) {
|
|
15000
|
+
function IkasProductList(data, router) {
|
|
14293
15001
|
var _this = this;
|
|
15002
|
+
this.filters = null;
|
|
14294
15003
|
this._initialized = false;
|
|
14295
15004
|
this._minPage = null;
|
|
14296
|
-
|
|
14297
|
-
this.
|
|
14298
|
-
// Used for recommending products for a specific product
|
|
15005
|
+
this._filterBrandId = null;
|
|
15006
|
+
this._filterCategoryId = null;
|
|
14299
15007
|
this._recommendFor = null; // productId
|
|
14300
15008
|
this._isLoading = false;
|
|
14301
|
-
this.
|
|
14302
|
-
|
|
14303
|
-
|
|
14304
|
-
var _a, _b
|
|
14305
|
-
return __generator(this, function (
|
|
14306
|
-
switch (
|
|
15009
|
+
this._fetchRequestTime = 0;
|
|
15010
|
+
this.router = null;
|
|
15011
|
+
this.applyFilters = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
15012
|
+
var _a, _b;
|
|
15013
|
+
return __generator(this, function (_c) {
|
|
15014
|
+
switch (_c.label) {
|
|
15015
|
+
case 0: return [4 /*yield*/, this.getInitial()];
|
|
15016
|
+
case 1:
|
|
15017
|
+
_c.sent();
|
|
15018
|
+
// Change url params
|
|
15019
|
+
if (this.isBrowser()) {
|
|
15020
|
+
if (this.isFiltered) {
|
|
15021
|
+
(_a = this.router) === null || _a === void 0 ? void 0 : _a.replace(location.pathname + "?" + this.filterQueryParams, undefined, { shallow: true });
|
|
15022
|
+
}
|
|
15023
|
+
else {
|
|
15024
|
+
(_b = this.router) === null || _b === void 0 ? void 0 : _b.replace("" + location.pathname, undefined, {
|
|
15025
|
+
shallow: true,
|
|
15026
|
+
});
|
|
15027
|
+
}
|
|
15028
|
+
}
|
|
15029
|
+
return [2 /*return*/];
|
|
15030
|
+
}
|
|
15031
|
+
});
|
|
15032
|
+
}); };
|
|
15033
|
+
this.getInitial = function (queryParams) { return __awaiter(_this, void 0, void 0, function () {
|
|
15034
|
+
var fetchRequestTime, page, limit, response_1, data, err_1;
|
|
15035
|
+
return __generator(this, function (_a) {
|
|
15036
|
+
switch (_a.label) {
|
|
14307
15037
|
case 0:
|
|
14308
|
-
if (this._isLoading)
|
|
14309
|
-
return [2 /*return*/];
|
|
14310
15038
|
this._isLoading = true;
|
|
14311
|
-
|
|
15039
|
+
fetchRequestTime = Date.now();
|
|
15040
|
+
this._fetchRequestTime = fetchRequestTime;
|
|
15041
|
+
_a.label = 1;
|
|
14312
15042
|
case 1:
|
|
14313
|
-
|
|
14314
|
-
page =
|
|
15043
|
+
_a.trys.push([1, 5, 6, 7]);
|
|
15044
|
+
page = 1;
|
|
14315
15045
|
limit = this._limit;
|
|
15046
|
+
if (!(this.isFilterable && !this.filters)) return [3 /*break*/, 3];
|
|
15047
|
+
return [4 /*yield*/, this.getFilters()];
|
|
15048
|
+
case 2:
|
|
15049
|
+
_a.sent();
|
|
15050
|
+
_a.label = 3;
|
|
15051
|
+
case 3:
|
|
15052
|
+
this.applyQueryParamFilters(queryParams);
|
|
14316
15053
|
if (this.isStatic) {
|
|
14317
15054
|
page = undefined;
|
|
14318
15055
|
limit = undefined;
|
|
14319
15056
|
}
|
|
14320
15057
|
else if (this.isDiscounted) {
|
|
14321
|
-
// TODO use filter
|
|
14322
15058
|
page = 1;
|
|
14323
15059
|
limit = 10;
|
|
14324
15060
|
}
|
|
14325
15061
|
else if (this.isRecommended) {
|
|
14326
|
-
// TODO use filter
|
|
14327
15062
|
page = 1;
|
|
14328
15063
|
limit = 10;
|
|
14329
15064
|
}
|
|
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 = [];
|
|
15065
|
+
return [4 /*yield*/, this.searchProducts(page || 1, limit || 10)];
|
|
15066
|
+
case 4:
|
|
15067
|
+
response_1 = _a.sent();
|
|
15068
|
+
if (!response_1 || this._fetchRequestTime !== fetchRequestTime)
|
|
15069
|
+
return [2 /*return*/];
|
|
15070
|
+
data = [];
|
|
14342
15071
|
if (this.isStatic) {
|
|
14343
|
-
|
|
14344
|
-
var product = response_1.
|
|
15072
|
+
data = this._productListPropValue.productIds.map(function (pID) {
|
|
15073
|
+
var product = response_1.data.find(function (p) { return p.id === pID.productId; });
|
|
14345
15074
|
var variant = product === null || product === void 0 ? void 0 : product.variants.find(function (v) { return v.id === pID.variantId; });
|
|
14346
15075
|
return new IkasProductDetail(product, variant.variantValues);
|
|
14347
15076
|
});
|
|
14348
15077
|
}
|
|
14349
15078
|
else {
|
|
14350
|
-
|
|
15079
|
+
data = response_1.data.map(function (product) {
|
|
14351
15080
|
return new IkasProductDetail(product, product.variants[0].variantValues);
|
|
14352
15081
|
});
|
|
14353
15082
|
}
|
|
14354
|
-
|
|
14355
|
-
|
|
14356
|
-
|
|
14357
|
-
|
|
14358
|
-
|
|
14359
|
-
|
|
14360
|
-
|
|
14361
|
-
|
|
14362
|
-
err_1 = _d.sent();
|
|
15083
|
+
this.data = data;
|
|
15084
|
+
this._count = response_1.count;
|
|
15085
|
+
this._initialized = true;
|
|
15086
|
+
this._page = page || 1;
|
|
15087
|
+
this._minPage = this.page;
|
|
15088
|
+
return [3 /*break*/, 7];
|
|
15089
|
+
case 5:
|
|
15090
|
+
err_1 = _a.sent();
|
|
14363
15091
|
console.log(err_1);
|
|
14364
|
-
return [3 /*break*/,
|
|
14365
|
-
case
|
|
14366
|
-
|
|
14367
|
-
|
|
14368
|
-
});
|
|
15092
|
+
return [3 /*break*/, 7];
|
|
15093
|
+
case 6:
|
|
15094
|
+
if (fetchRequestTime === this._fetchRequestTime)
|
|
15095
|
+
this._isLoading = false;
|
|
14369
15096
|
return [7 /*endfinally*/];
|
|
14370
|
-
case
|
|
15097
|
+
case 7: return [2 /*return*/];
|
|
14371
15098
|
}
|
|
14372
15099
|
});
|
|
14373
15100
|
}); };
|
|
14374
15101
|
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) {
|
|
15102
|
+
var minPage, response, data, err_2;
|
|
15103
|
+
return __generator(this, function (_a) {
|
|
15104
|
+
switch (_a.label) {
|
|
14380
15105
|
case 0:
|
|
14381
15106
|
if (this.isStatic ||
|
|
14382
15107
|
this.isDiscounted ||
|
|
@@ -14385,49 +15110,37 @@ var IkasProductList = /** @class */ (function () {
|
|
|
14385
15110
|
!this.hasPrev)
|
|
14386
15111
|
return [2 /*return*/];
|
|
14387
15112
|
this._isLoading = true;
|
|
14388
|
-
|
|
15113
|
+
_a.label = 1;
|
|
14389
15114
|
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
|
-
})];
|
|
15115
|
+
_a.trys.push([1, 3, 4, 5]);
|
|
15116
|
+
minPage = this._minPage - 1;
|
|
15117
|
+
return [4 /*yield*/, this.searchProducts(minPage, this.limit)];
|
|
14401
15118
|
case 2:
|
|
14402
|
-
|
|
14403
|
-
|
|
15119
|
+
response = _a.sent();
|
|
15120
|
+
if (!response)
|
|
15121
|
+
return [2 /*return*/];
|
|
15122
|
+
data = response.data.map(function (product) {
|
|
14404
15123
|
return new IkasProductDetail(product, product.variants[0].variantValues);
|
|
14405
15124
|
});
|
|
14406
|
-
|
|
14407
|
-
|
|
14408
|
-
|
|
14409
|
-
_this._minPage = minPage_1;
|
|
14410
|
-
});
|
|
15125
|
+
this.data = data.concat(this.data);
|
|
15126
|
+
this._count = response.count;
|
|
15127
|
+
this._minPage = minPage;
|
|
14411
15128
|
return [3 /*break*/, 5];
|
|
14412
15129
|
case 3:
|
|
14413
|
-
err_2 =
|
|
15130
|
+
err_2 = _a.sent();
|
|
14414
15131
|
console.log(err_2);
|
|
14415
15132
|
return [3 /*break*/, 5];
|
|
14416
15133
|
case 4:
|
|
14417
|
-
|
|
14418
|
-
_this._isLoading = false;
|
|
14419
|
-
});
|
|
15134
|
+
this._isLoading = false;
|
|
14420
15135
|
return [7 /*endfinally*/];
|
|
14421
15136
|
case 5: return [2 /*return*/];
|
|
14422
15137
|
}
|
|
14423
15138
|
});
|
|
14424
15139
|
}); };
|
|
14425
15140
|
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) {
|
|
15141
|
+
var response, data, err_3;
|
|
15142
|
+
return __generator(this, function (_a) {
|
|
15143
|
+
switch (_a.label) {
|
|
14431
15144
|
case 0:
|
|
14432
15145
|
if (this.isStatic ||
|
|
14433
15146
|
this.isDiscounted ||
|
|
@@ -14436,46 +15149,36 @@ var IkasProductList = /** @class */ (function () {
|
|
|
14436
15149
|
!this.hasNext)
|
|
14437
15150
|
return [2 /*return*/];
|
|
14438
15151
|
this._isLoading = true;
|
|
14439
|
-
|
|
15152
|
+
_a.label = 1;
|
|
14440
15153
|
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
|
-
})];
|
|
15154
|
+
_a.trys.push([1, 3, 4, 5]);
|
|
15155
|
+
return [4 /*yield*/, this.searchProducts(this.page + 1, this.limit)];
|
|
14449
15156
|
case 2:
|
|
14450
|
-
|
|
14451
|
-
|
|
15157
|
+
response = _a.sent();
|
|
15158
|
+
if (!response)
|
|
15159
|
+
return [2 /*return*/];
|
|
15160
|
+
data = response.data.map(function (product) {
|
|
14452
15161
|
return new IkasProductDetail(product, product.variants[0].variantValues);
|
|
14453
15162
|
});
|
|
14454
|
-
|
|
14455
|
-
|
|
14456
|
-
|
|
14457
|
-
_this._page = _this.page + 1;
|
|
14458
|
-
});
|
|
15163
|
+
this.data = this.data.concat(data);
|
|
15164
|
+
this._count = response.count;
|
|
15165
|
+
this._page = this.page + 1;
|
|
14459
15166
|
return [3 /*break*/, 5];
|
|
14460
15167
|
case 3:
|
|
14461
|
-
err_3 =
|
|
15168
|
+
err_3 = _a.sent();
|
|
14462
15169
|
console.log(err_3);
|
|
14463
15170
|
return [3 /*break*/, 5];
|
|
14464
15171
|
case 4:
|
|
14465
|
-
|
|
14466
|
-
_this._isLoading = false;
|
|
14467
|
-
});
|
|
15172
|
+
this._isLoading = false;
|
|
14468
15173
|
return [7 /*endfinally*/];
|
|
14469
15174
|
case 5: return [2 /*return*/];
|
|
14470
15175
|
}
|
|
14471
15176
|
});
|
|
14472
15177
|
}); };
|
|
14473
15178
|
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) {
|
|
15179
|
+
var response, data, err_4;
|
|
15180
|
+
return __generator(this, function (_a) {
|
|
15181
|
+
switch (_a.label) {
|
|
14479
15182
|
case 0:
|
|
14480
15183
|
if (this._isLoading ||
|
|
14481
15184
|
this.isStatic ||
|
|
@@ -14483,36 +15186,28 @@ var IkasProductList = /** @class */ (function () {
|
|
|
14483
15186
|
this.isRecommended)
|
|
14484
15187
|
return [2 /*return*/];
|
|
14485
15188
|
this._isLoading = true;
|
|
14486
|
-
|
|
15189
|
+
_a.label = 1;
|
|
14487
15190
|
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
|
-
})];
|
|
15191
|
+
_a.trys.push([1, 3, 4, 5]);
|
|
15192
|
+
return [4 /*yield*/, this.searchProducts(page, this.limit)];
|
|
14496
15193
|
case 2:
|
|
14497
|
-
|
|
14498
|
-
|
|
15194
|
+
response = _a.sent();
|
|
15195
|
+
if (!response)
|
|
15196
|
+
return [2 /*return*/];
|
|
15197
|
+
data = response.data.map(function (product) {
|
|
14499
15198
|
return new IkasProductDetail(product, product.variants[0].variantValues);
|
|
14500
15199
|
});
|
|
14501
|
-
|
|
14502
|
-
|
|
14503
|
-
|
|
14504
|
-
|
|
14505
|
-
_this._minPage = page;
|
|
14506
|
-
});
|
|
15200
|
+
this.data = data;
|
|
15201
|
+
this._count = response.count;
|
|
15202
|
+
this._page = page;
|
|
15203
|
+
this._minPage = page;
|
|
14507
15204
|
return [3 /*break*/, 5];
|
|
14508
15205
|
case 3:
|
|
14509
|
-
err_4 =
|
|
15206
|
+
err_4 = _a.sent();
|
|
14510
15207
|
console.log(err_4);
|
|
14511
15208
|
return [3 /*break*/, 5];
|
|
14512
15209
|
case 4:
|
|
14513
|
-
|
|
14514
|
-
_this._isLoading = false;
|
|
14515
|
-
});
|
|
15210
|
+
this._isLoading = false;
|
|
14516
15211
|
return [7 /*endfinally*/];
|
|
14517
15212
|
case 5: return [2 /*return*/];
|
|
14518
15213
|
}
|
|
@@ -14532,12 +15227,21 @@ var IkasProductList = /** @class */ (function () {
|
|
|
14532
15227
|
this._limit = data.limit || data.productListPropValue.initialLimit || 20;
|
|
14533
15228
|
this._page = data.page || 1;
|
|
14534
15229
|
this._count = data.count || 0;
|
|
15230
|
+
this._searchKeyword = data.searchKeyword || "";
|
|
14535
15231
|
this._productListPropValue = data.productListPropValue;
|
|
14536
|
-
this.
|
|
14537
|
-
|
|
14538
|
-
: undefined;
|
|
15232
|
+
this._filterBrandId = data.filterBrandId || null;
|
|
15233
|
+
this._filterCategoryId = data.filterCategoryId || null;
|
|
14539
15234
|
this._recommendFor = data.recommendFor;
|
|
15235
|
+
this.filters = data.filters
|
|
15236
|
+
? data.filters.map(function (f) { return new IkasProductFilter(f); })
|
|
15237
|
+
: null;
|
|
15238
|
+
this.router = router;
|
|
14540
15239
|
mobx.makeAutoObservable(this);
|
|
15240
|
+
console.log("constructor");
|
|
15241
|
+
if (this.isBrowser() && location.search) {
|
|
15242
|
+
var queryParams = this.getQueryParams();
|
|
15243
|
+
this.getInitial(queryParams);
|
|
15244
|
+
}
|
|
14541
15245
|
}
|
|
14542
15246
|
Object.defineProperty(IkasProductList.prototype, "sort", {
|
|
14543
15247
|
get: function () {
|
|
@@ -14567,6 +15271,16 @@ var IkasProductList = /** @class */ (function () {
|
|
|
14567
15271
|
enumerable: false,
|
|
14568
15272
|
configurable: true
|
|
14569
15273
|
});
|
|
15274
|
+
Object.defineProperty(IkasProductList.prototype, "searchKeyword", {
|
|
15275
|
+
get: function () {
|
|
15276
|
+
return this._searchKeyword;
|
|
15277
|
+
},
|
|
15278
|
+
set: function (value) {
|
|
15279
|
+
this._searchKeyword = value;
|
|
15280
|
+
},
|
|
15281
|
+
enumerable: false,
|
|
15282
|
+
configurable: true
|
|
15283
|
+
});
|
|
14570
15284
|
Object.defineProperty(IkasProductList.prototype, "isInitialized", {
|
|
14571
15285
|
get: function () {
|
|
14572
15286
|
return this._initialized;
|
|
@@ -14574,6 +15288,22 @@ var IkasProductList = /** @class */ (function () {
|
|
|
14574
15288
|
enumerable: false,
|
|
14575
15289
|
configurable: true
|
|
14576
15290
|
});
|
|
15291
|
+
Object.defineProperty(IkasProductList.prototype, "isFilterable", {
|
|
15292
|
+
get: function () {
|
|
15293
|
+
return (this._type === exports.IkasProductListType.ALL ||
|
|
15294
|
+
this._type === exports.IkasProductListType.CATEGORY);
|
|
15295
|
+
},
|
|
15296
|
+
enumerable: false,
|
|
15297
|
+
configurable: true
|
|
15298
|
+
});
|
|
15299
|
+
Object.defineProperty(IkasProductList.prototype, "isFiltered", {
|
|
15300
|
+
get: function () {
|
|
15301
|
+
var _a;
|
|
15302
|
+
return (_a = this.filters) === null || _a === void 0 ? void 0 : _a.some(function (f) { return !!f.valueList.length; });
|
|
15303
|
+
},
|
|
15304
|
+
enumerable: false,
|
|
15305
|
+
configurable: true
|
|
15306
|
+
});
|
|
14577
15307
|
Object.defineProperty(IkasProductList.prototype, "isStatic", {
|
|
14578
15308
|
get: function () {
|
|
14579
15309
|
return this._type === exports.IkasProductListType.STATIC;
|
|
@@ -14623,8 +15353,111 @@ var IkasProductList = /** @class */ (function () {
|
|
|
14623
15353
|
enumerable: false,
|
|
14624
15354
|
configurable: true
|
|
14625
15355
|
});
|
|
14626
|
-
IkasProductList.prototype
|
|
14627
|
-
|
|
15356
|
+
Object.defineProperty(IkasProductList.prototype, "filterQueryParams", {
|
|
15357
|
+
get: function () {
|
|
15358
|
+
var _a;
|
|
15359
|
+
var queryParams = {};
|
|
15360
|
+
(_a = this.filters) === null || _a === void 0 ? void 0 : _a.forEach(function (f) {
|
|
15361
|
+
queryParams[f.key] = f.keyList;
|
|
15362
|
+
});
|
|
15363
|
+
return queryString.stringify(queryParams, { arrayFormat: "comma" });
|
|
15364
|
+
},
|
|
15365
|
+
enumerable: false,
|
|
15366
|
+
configurable: true
|
|
15367
|
+
});
|
|
15368
|
+
IkasProductList.prototype.searchProducts = function (page, limit) {
|
|
15369
|
+
var _a, _b;
|
|
15370
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
15371
|
+
var filterList;
|
|
15372
|
+
return __generator(this, function (_c) {
|
|
15373
|
+
switch (_c.label) {
|
|
15374
|
+
case 0:
|
|
15375
|
+
filterList = [];
|
|
15376
|
+
if (this._filterBrandId) {
|
|
15377
|
+
filterList.push(new IkasProductFilterValue({
|
|
15378
|
+
id: this._filterBrandId,
|
|
15379
|
+
type: exports.IkasProductFilterType.BRAND,
|
|
15380
|
+
valueList: [this._filterBrandId],
|
|
15381
|
+
}));
|
|
15382
|
+
}
|
|
15383
|
+
(_a = this.filters) === null || _a === void 0 ? void 0 : _a.forEach(function (filter) {
|
|
15384
|
+
if (filter.valueList.length) {
|
|
15385
|
+
filterList.push(new IkasProductFilterValue({
|
|
15386
|
+
id: filter.id,
|
|
15387
|
+
type: filter.type,
|
|
15388
|
+
valueList: filter.valueList,
|
|
15389
|
+
}));
|
|
15390
|
+
}
|
|
15391
|
+
});
|
|
15392
|
+
return [4 /*yield*/, IkasProductSearchAPI.searchProducts({
|
|
15393
|
+
page: page,
|
|
15394
|
+
perPage: limit,
|
|
15395
|
+
productIdList: this.isStatic
|
|
15396
|
+
? (_b = this._productListPropValue.productIds) === null || _b === void 0 ? void 0 : _b.map(function (p) { return p.productId; }) : undefined,
|
|
15397
|
+
filterList: filterList,
|
|
15398
|
+
categoryIdList: this._filterCategoryId
|
|
15399
|
+
? [this._filterCategoryId]
|
|
15400
|
+
: undefined,
|
|
15401
|
+
query: this._searchKeyword,
|
|
15402
|
+
})];
|
|
15403
|
+
case 1: return [2 /*return*/, _c.sent()];
|
|
15404
|
+
}
|
|
15405
|
+
});
|
|
15406
|
+
});
|
|
15407
|
+
};
|
|
15408
|
+
IkasProductList.prototype.clear = function () {
|
|
15409
|
+
var _a;
|
|
15410
|
+
(_a = this.filters) === null || _a === void 0 ? void 0 : _a.forEach(function (filter) { return filter.clear(); });
|
|
15411
|
+
this._searchKeyword = "";
|
|
15412
|
+
};
|
|
15413
|
+
IkasProductList.prototype.getFilters = function () {
|
|
15414
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
15415
|
+
var _a;
|
|
15416
|
+
return __generator(this, function (_b) {
|
|
15417
|
+
switch (_b.label) {
|
|
15418
|
+
case 0:
|
|
15419
|
+
_a = this;
|
|
15420
|
+
return [4 /*yield*/, IkasProductSearchAPI.getProductFilterData()];
|
|
15421
|
+
case 1:
|
|
15422
|
+
_a.filters = _b.sent();
|
|
15423
|
+
// this._filterCategoryId ? [this._filterCategoryId] : undefined
|
|
15424
|
+
if (this.filters)
|
|
15425
|
+
this.filters.sort(function (f1, f2) { return (f1.order > f2.order ? 1 : -1); });
|
|
15426
|
+
return [2 /*return*/];
|
|
15427
|
+
}
|
|
15428
|
+
});
|
|
15429
|
+
});
|
|
15430
|
+
};
|
|
15431
|
+
IkasProductList.prototype.applyQueryParamFilters = function (queryParams) {
|
|
15432
|
+
var _this = this;
|
|
15433
|
+
try {
|
|
15434
|
+
queryParams === null || queryParams === void 0 ? void 0 : queryParams.forEach(function (value, key) {
|
|
15435
|
+
var _a, _b, _c;
|
|
15436
|
+
var filter = (_a = _this.filters) === null || _a === void 0 ? void 0 : _a.find(function (f) { return f.key === key; });
|
|
15437
|
+
var valueKeys = value.split(",");
|
|
15438
|
+
if (filter) {
|
|
15439
|
+
if (filter.displayType === exports.IkasProductFilterDisplayType.NUMBER_RANGE) {
|
|
15440
|
+
filter.numberRange = new RangeValue(parseRangeStr(value));
|
|
15441
|
+
}
|
|
15442
|
+
else if (filter.displayType ===
|
|
15443
|
+
exports.IkasProductFilterDisplayType.NUMBER_RANGE_LIST) {
|
|
15444
|
+
(_b = filter.numberRangeListOptions) === null || _b === void 0 ? void 0 : _b.forEach(function (o) {
|
|
15445
|
+
if (valueKeys.includes(o.key))
|
|
15446
|
+
o.isSelected = true;
|
|
15447
|
+
});
|
|
15448
|
+
}
|
|
15449
|
+
else {
|
|
15450
|
+
(_c = filter.values) === null || _c === void 0 ? void 0 : _c.forEach(function (filterValue) {
|
|
15451
|
+
if (valueKeys.includes(filterValue.key))
|
|
15452
|
+
filterValue.isSelected = true;
|
|
15453
|
+
});
|
|
15454
|
+
}
|
|
15455
|
+
}
|
|
15456
|
+
});
|
|
15457
|
+
}
|
|
15458
|
+
catch (err) {
|
|
15459
|
+
console.log(err);
|
|
15460
|
+
}
|
|
14628
15461
|
};
|
|
14629
15462
|
IkasProductList.prototype.toJSON = function () {
|
|
14630
15463
|
return {
|
|
@@ -14634,13 +15467,24 @@ var IkasProductList = /** @class */ (function () {
|
|
|
14634
15467
|
limit: this._limit,
|
|
14635
15468
|
page: this._page,
|
|
14636
15469
|
count: this._count,
|
|
15470
|
+
searchKeyword: this._searchKeyword,
|
|
14637
15471
|
initialized: this._initialized,
|
|
14638
15472
|
minPage: this._minPage,
|
|
14639
|
-
|
|
15473
|
+
pageBrandId: this._filterBrandId,
|
|
15474
|
+
pageCategoryId: this._filterCategoryId,
|
|
15475
|
+
filters: this.filters,
|
|
14640
15476
|
recommendFor: this._recommendFor,
|
|
14641
15477
|
productListPropValue: this._productListPropValue,
|
|
14642
15478
|
};
|
|
14643
15479
|
};
|
|
15480
|
+
IkasProductList.prototype.getQueryParams = function () {
|
|
15481
|
+
if (!this.isBrowser())
|
|
15482
|
+
return;
|
|
15483
|
+
return new URLSearchParams(location.search);
|
|
15484
|
+
};
|
|
15485
|
+
IkasProductList.prototype.isBrowser = function () {
|
|
15486
|
+
return typeof window !== "undefined";
|
|
15487
|
+
};
|
|
14644
15488
|
return IkasProductList;
|
|
14645
15489
|
}());
|
|
14646
15490
|
(function (IkasProductListType) {
|
|
@@ -19435,6 +20279,8 @@ var AddressForm = /** @class */ (function () {
|
|
|
19435
20279
|
this.store = props.store;
|
|
19436
20280
|
this.validator = new Validator(this.address, this.validatorRules());
|
|
19437
20281
|
this.listCountries();
|
|
20282
|
+
if (this.address.state)
|
|
20283
|
+
this.listStates();
|
|
19438
20284
|
if (this.address.country)
|
|
19439
20285
|
this.listCities();
|
|
19440
20286
|
if (this.address.city)
|
|
@@ -21889,7 +22735,7 @@ var IkasVariantTypeAPI = /** @class */ (function () {
|
|
|
21889
22735
|
id: vv.id,
|
|
21890
22736
|
name: vv.name,
|
|
21891
22737
|
colorCode: vv.colorCode,
|
|
21892
|
-
|
|
22738
|
+
thumbnailImageId: vv.thumbnailImageId,
|
|
21893
22739
|
variantTypeId: vt.id,
|
|
21894
22740
|
});
|
|
21895
22741
|
}),
|
|
@@ -22147,6 +22993,220 @@ var IkasProductAPI = /** @class */ (function () {
|
|
|
22147
22993
|
}());
|
|
22148
22994
|
var templateObject_1$d;
|
|
22149
22995
|
|
|
22996
|
+
var IkasProductSearchAPI = /** @class */ (function () {
|
|
22997
|
+
function IkasProductSearchAPI() {
|
|
22998
|
+
}
|
|
22999
|
+
IkasProductSearchAPI.searchProducts = function (input) {
|
|
23000
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
23001
|
+
var SEARCH_PRODUCTS, _a, data, errors, err_1;
|
|
23002
|
+
return __generator(this, function (_b) {
|
|
23003
|
+
switch (_b.label) {
|
|
23004
|
+
case 0:
|
|
23005
|
+
_b.trys.push([0, 2, , 3]);
|
|
23006
|
+
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 "])));
|
|
23007
|
+
return [4 /*yield*/, apollo
|
|
23008
|
+
.getClient()
|
|
23009
|
+
.query({
|
|
23010
|
+
query: SEARCH_PRODUCTS,
|
|
23011
|
+
variables: {
|
|
23012
|
+
input: input,
|
|
23013
|
+
},
|
|
23014
|
+
})];
|
|
23015
|
+
case 1:
|
|
23016
|
+
_a = _b.sent(), data = _a.data, errors = _a.errors;
|
|
23017
|
+
if (errors && errors.length) {
|
|
23018
|
+
console.log(errors);
|
|
23019
|
+
return [2 /*return*/];
|
|
23020
|
+
}
|
|
23021
|
+
return [2 /*return*/, __assign(__assign({}, data.searchProducts), { data: data.searchProducts.data.map(function (d) {
|
|
23022
|
+
return simpleToProduct(d);
|
|
23023
|
+
}) })];
|
|
23024
|
+
case 2:
|
|
23025
|
+
err_1 = _b.sent();
|
|
23026
|
+
console.log(err_1);
|
|
23027
|
+
return [3 /*break*/, 3];
|
|
23028
|
+
case 3: return [2 /*return*/];
|
|
23029
|
+
}
|
|
23030
|
+
});
|
|
23031
|
+
});
|
|
23032
|
+
};
|
|
23033
|
+
IkasProductSearchAPI.getProductFilterData = function (categoryIds) {
|
|
23034
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
23035
|
+
var QUERY, _a, data, errors, err_2;
|
|
23036
|
+
return __generator(this, function (_b) {
|
|
23037
|
+
switch (_b.label) {
|
|
23038
|
+
case 0:
|
|
23039
|
+
_b.trys.push([0, 2, , 3]);
|
|
23040
|
+
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 "])));
|
|
23041
|
+
return [4 /*yield*/, apollo
|
|
23042
|
+
.getClient()
|
|
23043
|
+
.query({
|
|
23044
|
+
query: QUERY,
|
|
23045
|
+
variables: {
|
|
23046
|
+
categoryIds: categoryIds || null,
|
|
23047
|
+
},
|
|
23048
|
+
})];
|
|
23049
|
+
case 1:
|
|
23050
|
+
_a = _b.sent(), data = _a.data, errors = _a.errors;
|
|
23051
|
+
if (errors && errors.length) {
|
|
23052
|
+
console.log(errors);
|
|
23053
|
+
return [2 /*return*/];
|
|
23054
|
+
}
|
|
23055
|
+
return [2 /*return*/, data.getProductFilterData.map(function (d) {
|
|
23056
|
+
var _a;
|
|
23057
|
+
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); }) }));
|
|
23058
|
+
})];
|
|
23059
|
+
case 2:
|
|
23060
|
+
err_2 = _b.sent();
|
|
23061
|
+
console.log(err_2);
|
|
23062
|
+
return [3 /*break*/, 3];
|
|
23063
|
+
case 3: return [2 /*return*/];
|
|
23064
|
+
}
|
|
23065
|
+
});
|
|
23066
|
+
});
|
|
23067
|
+
};
|
|
23068
|
+
return IkasProductSearchAPI;
|
|
23069
|
+
}());
|
|
23070
|
+
function simpleToProduct(simple) {
|
|
23071
|
+
var _a, _b, _c, _d, _e;
|
|
23072
|
+
return new IkasProduct({
|
|
23073
|
+
id: simple.id,
|
|
23074
|
+
attributes: (_a = simple.attributes) === null || _a === void 0 ? void 0 : _a.map(function (a) {
|
|
23075
|
+
var _a, _b, _c, _d, _e;
|
|
23076
|
+
return new IkasProductAttributeValue({
|
|
23077
|
+
value: a.value,
|
|
23078
|
+
productAttributeId: (_a = a.productAttribute) === null || _a === void 0 ? void 0 : _a.id,
|
|
23079
|
+
productAttributeOptionId: (_b = a.productAttributeOption) === null || _b === void 0 ? void 0 : _b.id,
|
|
23080
|
+
productAttribute: new IkasProductAttribute({
|
|
23081
|
+
id: (_c = a.productAttribute) === null || _c === void 0 ? void 0 : _c.id,
|
|
23082
|
+
name: (_d = a.productAttribute) === null || _d === void 0 ? void 0 : _d.name,
|
|
23083
|
+
type: (_e = a.productAttribute) === null || _e === void 0 ? void 0 : _e.type,
|
|
23084
|
+
}),
|
|
23085
|
+
productAttributeOption: a.productAttributeOption,
|
|
23086
|
+
});
|
|
23087
|
+
}),
|
|
23088
|
+
brand: new IkasBrand({
|
|
23089
|
+
id: (_b = simple.brand) === null || _b === void 0 ? void 0 : _b.id,
|
|
23090
|
+
name: (_c = simple.brand) === null || _c === void 0 ? void 0 : _c.name,
|
|
23091
|
+
metaData: new IkasHTMLMetaData({
|
|
23092
|
+
slug: ((_d = simple.brand) === null || _d === void 0 ? void 0 : _d.slug) || "",
|
|
23093
|
+
}),
|
|
23094
|
+
}),
|
|
23095
|
+
categories: (_e = simple.categories) === null || _e === void 0 ? void 0 : _e.map(function (c) {
|
|
23096
|
+
return new IkasCategory({
|
|
23097
|
+
id: c.id,
|
|
23098
|
+
name: c.name,
|
|
23099
|
+
path: c.path,
|
|
23100
|
+
metaData: new IkasHTMLMetaData({
|
|
23101
|
+
slug: c.slug || "",
|
|
23102
|
+
}),
|
|
23103
|
+
});
|
|
23104
|
+
}),
|
|
23105
|
+
description: simple.description || undefined,
|
|
23106
|
+
metaData: new IkasHTMLMetaData(simple.metaData || undefined),
|
|
23107
|
+
name: simple.name,
|
|
23108
|
+
shortDescription: simple.shortDescription || undefined,
|
|
23109
|
+
taxValue: simple.taxValue || undefined,
|
|
23110
|
+
type: simple.type || undefined,
|
|
23111
|
+
variantTypes: simple.productVariantTypes.map(function (pvt) {
|
|
23112
|
+
return new IkasProductVariantType({
|
|
23113
|
+
variantType: new IkasVariantType({
|
|
23114
|
+
id: pvt.variantType.id,
|
|
23115
|
+
name: pvt.variantType.name,
|
|
23116
|
+
selectionType: pvt.variantType.selectionType,
|
|
23117
|
+
values: pvt.variantType.values
|
|
23118
|
+
.map(function (v) {
|
|
23119
|
+
return new IkasVariantValue({
|
|
23120
|
+
id: v.id,
|
|
23121
|
+
colorCode: v.colorCode,
|
|
23122
|
+
name: v.name,
|
|
23123
|
+
thumbnailImageId: v.thumbnailImageId,
|
|
23124
|
+
variantTypeId: pvt.variantType.id,
|
|
23125
|
+
});
|
|
23126
|
+
})
|
|
23127
|
+
.filter(function (v) { return pvt.variantValueIds.includes(v.id); }),
|
|
23128
|
+
}),
|
|
23129
|
+
variantValueIds: pvt.variantValueIds,
|
|
23130
|
+
});
|
|
23131
|
+
}),
|
|
23132
|
+
variants: simple.variants.map(function (v) {
|
|
23133
|
+
var _a, _b, _c, _d;
|
|
23134
|
+
return new IkasProductVariant({
|
|
23135
|
+
id: v.id,
|
|
23136
|
+
attributes: (_a = v.attributes) === null || _a === void 0 ? void 0 : _a.map(function (a) {
|
|
23137
|
+
var _a, _b, _c, _d, _e;
|
|
23138
|
+
return new IkasProductAttributeValue({
|
|
23139
|
+
value: a.value,
|
|
23140
|
+
productAttributeId: (_a = a.productAttribute) === null || _a === void 0 ? void 0 : _a.id,
|
|
23141
|
+
productAttributeOptionId: (_b = a.productAttributeOption) === null || _b === void 0 ? void 0 : _b.id,
|
|
23142
|
+
productAttribute: new IkasProductAttribute({
|
|
23143
|
+
id: (_c = a.productAttribute) === null || _c === void 0 ? void 0 : _c.id,
|
|
23144
|
+
name: (_d = a.productAttribute) === null || _d === void 0 ? void 0 : _d.name,
|
|
23145
|
+
type: (_e = a.productAttribute) === null || _e === void 0 ? void 0 : _e.type,
|
|
23146
|
+
}),
|
|
23147
|
+
productAttributeOption: a.productAttributeOption,
|
|
23148
|
+
});
|
|
23149
|
+
}),
|
|
23150
|
+
sku: v.sku,
|
|
23151
|
+
barcodeList: v.barcodeList || undefined,
|
|
23152
|
+
images: (_b = v.images) === null || _b === void 0 ? void 0 : _b.map(function (i) { return new IkasImage(i.id); }),
|
|
23153
|
+
price: new IkasProductPrice((_c = v.prices) === null || _c === void 0 ? void 0 : _c.find(function (p) { return p.priceListId === null; })),
|
|
23154
|
+
stock: v.stocks.length ? v.stocks[0].stockCount : 0,
|
|
23155
|
+
variantValues: (_d = v.variantValues) === null || _d === void 0 ? void 0 : _d.map(function (vv) {
|
|
23156
|
+
var _a;
|
|
23157
|
+
var variantValue = (_a = simple.productVariantTypes
|
|
23158
|
+
.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; });
|
|
23159
|
+
return new IkasVariantValue({
|
|
23160
|
+
id: vv.variantValueId,
|
|
23161
|
+
name: variantValue === null || variantValue === void 0 ? void 0 : variantValue.name,
|
|
23162
|
+
colorCode: variantValue === null || variantValue === void 0 ? void 0 : variantValue.colorCode,
|
|
23163
|
+
thumbnailImageId: variantValue === null || variantValue === void 0 ? void 0 : variantValue.thumbnailImageId,
|
|
23164
|
+
});
|
|
23165
|
+
}),
|
|
23166
|
+
});
|
|
23167
|
+
}),
|
|
23168
|
+
});
|
|
23169
|
+
}
|
|
23170
|
+
var templateObject_1$e, templateObject_2$4;
|
|
23171
|
+
// type SearchInput = {
|
|
23172
|
+
// categoryIdList: string[] | null;
|
|
23173
|
+
// filterList: SearchInputFilter[] | null;
|
|
23174
|
+
// order: SearchInputOrder[] | null;
|
|
23175
|
+
// page: number | null;
|
|
23176
|
+
// perPage: number | null;
|
|
23177
|
+
// priceListId: string | null;
|
|
23178
|
+
// productId: string | null;
|
|
23179
|
+
// query: string | null;
|
|
23180
|
+
// slug: string | null;
|
|
23181
|
+
// };
|
|
23182
|
+
// type SearchInputFilter = {
|
|
23183
|
+
// id: string;
|
|
23184
|
+
// type: ProductFilterType;
|
|
23185
|
+
// valueList: string[];
|
|
23186
|
+
// };
|
|
23187
|
+
// export type SearchInputOrder = {
|
|
23188
|
+
// direction: SortByDirection;
|
|
23189
|
+
// type: SortByType;
|
|
23190
|
+
// };
|
|
23191
|
+
// enum SortByDirection {
|
|
23192
|
+
// ASC = "ASC",
|
|
23193
|
+
// DESC = "DESC",
|
|
23194
|
+
// }
|
|
23195
|
+
// enum SortByType {
|
|
23196
|
+
// CREATED_AT = "CREATED_AT",
|
|
23197
|
+
// DISCOUNT_RATIO = "DISCOUNT_RATIO",
|
|
23198
|
+
// PRICE = "PRICE",
|
|
23199
|
+
// }
|
|
23200
|
+
// export enum ProductFilterType {
|
|
23201
|
+
// ATTRIBUTE = "ATTRIBUTE",
|
|
23202
|
+
// BRAND = "BRAND",
|
|
23203
|
+
// DISCOUNT_RATIO = "DISCOUNT_RATIO",
|
|
23204
|
+
// PRICE = "PRICE",
|
|
23205
|
+
// STOCK_STATUS = "STOCK_STATUS",
|
|
23206
|
+
// TAG = "TAG",
|
|
23207
|
+
// VARIANT_TYPE = "VARIANT_TYPE",
|
|
23208
|
+
// }
|
|
23209
|
+
|
|
22150
23210
|
var IkasProductAttributeAPI = /** @class */ (function () {
|
|
22151
23211
|
function IkasProductAttributeAPI() {
|
|
22152
23212
|
}
|
|
@@ -22156,7 +23216,7 @@ var IkasProductAttributeAPI = /** @class */ (function () {
|
|
|
22156
23216
|
return __generator(this, function (_b) {
|
|
22157
23217
|
switch (_b.label) {
|
|
22158
23218
|
case 0:
|
|
22159
|
-
LIST_PRODUCT_ATTRIBUTES = src(templateObject_1$
|
|
23219
|
+
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
23220
|
_b.label = 1;
|
|
22161
23221
|
case 1:
|
|
22162
23222
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -22189,7 +23249,103 @@ var IkasProductAttributeAPI = /** @class */ (function () {
|
|
|
22189
23249
|
};
|
|
22190
23250
|
return IkasProductAttributeAPI;
|
|
22191
23251
|
}());
|
|
22192
|
-
var templateObject_1$
|
|
23252
|
+
var templateObject_1$f;
|
|
23253
|
+
|
|
23254
|
+
var IkasFavoriteProductAPI = /** @class */ (function () {
|
|
23255
|
+
function IkasFavoriteProductAPI() {
|
|
23256
|
+
}
|
|
23257
|
+
IkasFavoriteProductAPI.listFavoriteProducts = function () {
|
|
23258
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
23259
|
+
var LIST_FAVORITE_PRODUCTS, _a, data, errors, err_1;
|
|
23260
|
+
return __generator(this, function (_b) {
|
|
23261
|
+
switch (_b.label) {
|
|
23262
|
+
case 0:
|
|
23263
|
+
LIST_FAVORITE_PRODUCTS = src(templateObject_1$g || (templateObject_1$g = __makeTemplateObject(["\n query listFavoriteProducts {\n listFavoriteProducts {\n id\n createdAt\n updatedAt\n deleted\n productId\n customerId\n }\n }\n "], ["\n query listFavoriteProducts {\n listFavoriteProducts {\n id\n createdAt\n updatedAt\n deleted\n productId\n customerId\n }\n }\n "])));
|
|
23264
|
+
_b.label = 1;
|
|
23265
|
+
case 1:
|
|
23266
|
+
_b.trys.push([1, 3, , 4]);
|
|
23267
|
+
return [4 /*yield*/, apollo
|
|
23268
|
+
.getClient()
|
|
23269
|
+
.query({
|
|
23270
|
+
query: LIST_FAVORITE_PRODUCTS,
|
|
23271
|
+
})];
|
|
23272
|
+
case 2:
|
|
23273
|
+
_a = _b.sent(), data = _a.data, errors = _a.errors;
|
|
23274
|
+
if (errors && errors.length)
|
|
23275
|
+
return [2 /*return*/, []];
|
|
23276
|
+
return [2 /*return*/, data.listFavoriteProducts.map(function (fP) { return new IkasFavoriteProduct(fP); })];
|
|
23277
|
+
case 3:
|
|
23278
|
+
err_1 = _b.sent();
|
|
23279
|
+
console.log(err_1);
|
|
23280
|
+
return [3 /*break*/, 4];
|
|
23281
|
+
case 4: return [2 /*return*/, []];
|
|
23282
|
+
}
|
|
23283
|
+
});
|
|
23284
|
+
});
|
|
23285
|
+
};
|
|
23286
|
+
IkasFavoriteProductAPI.isFavoriteProduct = function (productId) {
|
|
23287
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
23288
|
+
var IS_FAVORITE_PRODUCT, _a, data, errors, err_2;
|
|
23289
|
+
return __generator(this, function (_b) {
|
|
23290
|
+
switch (_b.label) {
|
|
23291
|
+
case 0:
|
|
23292
|
+
IS_FAVORITE_PRODUCT = src(templateObject_2$5 || (templateObject_2$5 = __makeTemplateObject(["\n query isFavoriteProduct($productId: String!) {\n isFavoriteProduct(productId: $productId)\n }\n "], ["\n query isFavoriteProduct($productId: String!) {\n isFavoriteProduct(productId: $productId)\n }\n "])));
|
|
23293
|
+
_b.label = 1;
|
|
23294
|
+
case 1:
|
|
23295
|
+
_b.trys.push([1, 3, , 4]);
|
|
23296
|
+
return [4 /*yield*/, apollo
|
|
23297
|
+
.getClient()
|
|
23298
|
+
.query({
|
|
23299
|
+
query: IS_FAVORITE_PRODUCT,
|
|
23300
|
+
variables: { productId: productId },
|
|
23301
|
+
})];
|
|
23302
|
+
case 2:
|
|
23303
|
+
_a = _b.sent(), data = _a.data, errors = _a.errors;
|
|
23304
|
+
if (errors && errors.length)
|
|
23305
|
+
return [2 /*return*/, false];
|
|
23306
|
+
return [2 /*return*/, data.isFavoriteProduct];
|
|
23307
|
+
case 3:
|
|
23308
|
+
err_2 = _b.sent();
|
|
23309
|
+
console.log(err_2);
|
|
23310
|
+
return [3 /*break*/, 4];
|
|
23311
|
+
case 4: return [2 /*return*/, false];
|
|
23312
|
+
}
|
|
23313
|
+
});
|
|
23314
|
+
});
|
|
23315
|
+
};
|
|
23316
|
+
IkasFavoriteProductAPI.saveFavoriteProduct = function (isFavorite, productId) {
|
|
23317
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
23318
|
+
var SAVE_FAVORITE_PRODUCT, _a, data, errors, err_3;
|
|
23319
|
+
return __generator(this, function (_b) {
|
|
23320
|
+
switch (_b.label) {
|
|
23321
|
+
case 0:
|
|
23322
|
+
SAVE_FAVORITE_PRODUCT = src(templateObject_3$2 || (templateObject_3$2 = __makeTemplateObject(["\n mutation saveFavoriteProduct($isFavorite: Boolean!, $productId: String!) {\n saveFavoriteProduct(isFavorite: $isFavorite, productId: $productId)\n }\n "], ["\n mutation saveFavoriteProduct($isFavorite: Boolean!, $productId: String!) {\n saveFavoriteProduct(isFavorite: $isFavorite, productId: $productId)\n }\n "])));
|
|
23323
|
+
_b.label = 1;
|
|
23324
|
+
case 1:
|
|
23325
|
+
_b.trys.push([1, 3, , 4]);
|
|
23326
|
+
return [4 /*yield*/, apollo
|
|
23327
|
+
.getClient()
|
|
23328
|
+
.mutate({
|
|
23329
|
+
mutation: SAVE_FAVORITE_PRODUCT,
|
|
23330
|
+
variables: { isFavorite: isFavorite, productId: productId },
|
|
23331
|
+
})];
|
|
23332
|
+
case 2:
|
|
23333
|
+
_a = _b.sent(), data = _a.data, errors = _a.errors;
|
|
23334
|
+
if (errors && errors.length)
|
|
23335
|
+
return [2 /*return*/, false];
|
|
23336
|
+
return [2 /*return*/, (data === null || data === void 0 ? void 0 : data.saveFavoriteProduct) || true];
|
|
23337
|
+
case 3:
|
|
23338
|
+
err_3 = _b.sent();
|
|
23339
|
+
console.log(err_3);
|
|
23340
|
+
return [3 /*break*/, 4];
|
|
23341
|
+
case 4: return [2 /*return*/, false];
|
|
23342
|
+
}
|
|
23343
|
+
});
|
|
23344
|
+
});
|
|
23345
|
+
};
|
|
23346
|
+
return IkasFavoriteProductAPI;
|
|
23347
|
+
}());
|
|
23348
|
+
var templateObject_1$g, templateObject_2$5, templateObject_3$2;
|
|
22193
23349
|
|
|
22194
23350
|
var IkasStateAPI = /** @class */ (function () {
|
|
22195
23351
|
function IkasStateAPI() {
|
|
@@ -22200,7 +23356,7 @@ var IkasStateAPI = /** @class */ (function () {
|
|
|
22200
23356
|
return __generator(this, function (_b) {
|
|
22201
23357
|
switch (_b.label) {
|
|
22202
23358
|
case 0:
|
|
22203
|
-
QUERY = src(templateObject_1$
|
|
23359
|
+
QUERY = src(templateObject_1$h || (templateObject_1$h = __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
23360
|
_b.label = 1;
|
|
22205
23361
|
case 1:
|
|
22206
23362
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -22237,7 +23393,7 @@ var IkasStateAPI = /** @class */ (function () {
|
|
|
22237
23393
|
};
|
|
22238
23394
|
return IkasStateAPI;
|
|
22239
23395
|
}());
|
|
22240
|
-
var templateObject_1$
|
|
23396
|
+
var templateObject_1$h;
|
|
22241
23397
|
|
|
22242
23398
|
var IkasStorefrontDomain = /** @class */ (function () {
|
|
22243
23399
|
function IkasStorefrontDomain(data) {
|
|
@@ -22330,7 +23486,7 @@ var IkasStorefrontAPI = /** @class */ (function () {
|
|
|
22330
23486
|
return __generator(this, function (_b) {
|
|
22331
23487
|
switch (_b.label) {
|
|
22332
23488
|
case 0:
|
|
22333
|
-
QUERY = src(templateObject_1$
|
|
23489
|
+
QUERY = src(templateObject_1$i || (templateObject_1$i = __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
23490
|
_b.label = 1;
|
|
22335
23491
|
case 1:
|
|
22336
23492
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -22360,7 +23516,7 @@ var IkasStorefrontAPI = /** @class */ (function () {
|
|
|
22360
23516
|
};
|
|
22361
23517
|
return IkasStorefrontAPI;
|
|
22362
23518
|
}());
|
|
22363
|
-
var templateObject_1$
|
|
23519
|
+
var templateObject_1$i;
|
|
22364
23520
|
|
|
22365
23521
|
var IkasThemeAPI = /** @class */ (function () {
|
|
22366
23522
|
function IkasThemeAPI() {
|
|
@@ -22517,6 +23673,107 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
22517
23673
|
});
|
|
22518
23674
|
});
|
|
22519
23675
|
};
|
|
23676
|
+
this.getFavoriteProductsIds = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
23677
|
+
var favoriteProductsResult;
|
|
23678
|
+
return __generator(this, function (_b) {
|
|
23679
|
+
switch (_b.label) {
|
|
23680
|
+
case 0:
|
|
23681
|
+
_b.trys.push([0, 2, , 3]);
|
|
23682
|
+
return [4 /*yield*/, IkasFavoriteProductAPI.listFavoriteProducts()];
|
|
23683
|
+
case 1:
|
|
23684
|
+
favoriteProductsResult = _b.sent();
|
|
23685
|
+
return [2 /*return*/, favoriteProductsResult];
|
|
23686
|
+
case 2:
|
|
23687
|
+
_b.sent();
|
|
23688
|
+
return [2 /*return*/, []];
|
|
23689
|
+
case 3: return [2 /*return*/];
|
|
23690
|
+
}
|
|
23691
|
+
});
|
|
23692
|
+
}); };
|
|
23693
|
+
this.getFavoriteProducts = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
23694
|
+
var favoriteProductsResult, productsResult;
|
|
23695
|
+
return __generator(this, function (_b) {
|
|
23696
|
+
switch (_b.label) {
|
|
23697
|
+
case 0:
|
|
23698
|
+
_b.trys.push([0, 3, , 4]);
|
|
23699
|
+
return [4 /*yield*/, IkasFavoriteProductAPI.listFavoriteProducts()];
|
|
23700
|
+
case 1:
|
|
23701
|
+
favoriteProductsResult = _b.sent();
|
|
23702
|
+
if (!favoriteProductsResult.length)
|
|
23703
|
+
return [2 /*return*/, []];
|
|
23704
|
+
return [4 /*yield*/, IkasProductAPI.listProducts({
|
|
23705
|
+
idList: favoriteProductsResult.map(function (fP) { return fP.productId; }),
|
|
23706
|
+
})];
|
|
23707
|
+
case 2:
|
|
23708
|
+
productsResult = _b.sent();
|
|
23709
|
+
return [2 /*return*/, productsResult.products];
|
|
23710
|
+
case 3:
|
|
23711
|
+
_b.sent();
|
|
23712
|
+
return [2 /*return*/, []];
|
|
23713
|
+
case 4: return [2 /*return*/];
|
|
23714
|
+
}
|
|
23715
|
+
});
|
|
23716
|
+
}); };
|
|
23717
|
+
this.addItemToFavorite = function (productId) { return __awaiter(_this, void 0, void 0, function () {
|
|
23718
|
+
var customerId, result;
|
|
23719
|
+
var _b;
|
|
23720
|
+
return __generator(this, function (_c) {
|
|
23721
|
+
switch (_c.label) {
|
|
23722
|
+
case 0:
|
|
23723
|
+
customerId = (_b = this.customer) === null || _b === void 0 ? void 0 : _b.id;
|
|
23724
|
+
if (!customerId)
|
|
23725
|
+
throw Error("Unauthorized");
|
|
23726
|
+
_c.label = 1;
|
|
23727
|
+
case 1:
|
|
23728
|
+
_c.trys.push([1, 3, , 4]);
|
|
23729
|
+
return [4 /*yield*/, IkasFavoriteProductAPI.saveFavoriteProduct(true, productId)];
|
|
23730
|
+
case 2:
|
|
23731
|
+
result = _c.sent();
|
|
23732
|
+
return [2 /*return*/, result];
|
|
23733
|
+
case 3:
|
|
23734
|
+
_c.sent();
|
|
23735
|
+
return [2 /*return*/, false];
|
|
23736
|
+
case 4: return [2 /*return*/];
|
|
23737
|
+
}
|
|
23738
|
+
});
|
|
23739
|
+
}); };
|
|
23740
|
+
this.removeItemFromFavorite = function (productId) { return __awaiter(_this, void 0, void 0, function () {
|
|
23741
|
+
var customerId, result;
|
|
23742
|
+
var _b;
|
|
23743
|
+
return __generator(this, function (_c) {
|
|
23744
|
+
switch (_c.label) {
|
|
23745
|
+
case 0:
|
|
23746
|
+
customerId = (_b = this.customer) === null || _b === void 0 ? void 0 : _b.id;
|
|
23747
|
+
if (!customerId)
|
|
23748
|
+
throw Error("Unauthorized");
|
|
23749
|
+
_c.label = 1;
|
|
23750
|
+
case 1:
|
|
23751
|
+
_c.trys.push([1, 3, , 4]);
|
|
23752
|
+
return [4 /*yield*/, IkasFavoriteProductAPI.saveFavoriteProduct(false, productId)];
|
|
23753
|
+
case 2:
|
|
23754
|
+
result = _c.sent();
|
|
23755
|
+
return [2 /*return*/, result];
|
|
23756
|
+
case 3:
|
|
23757
|
+
_c.sent();
|
|
23758
|
+
return [2 /*return*/, false];
|
|
23759
|
+
case 4: return [2 /*return*/];
|
|
23760
|
+
}
|
|
23761
|
+
});
|
|
23762
|
+
}); };
|
|
23763
|
+
this.isProductFavorite = function (productId) { return __awaiter(_this, void 0, void 0, function () {
|
|
23764
|
+
var customerId;
|
|
23765
|
+
var _a;
|
|
23766
|
+
return __generator(this, function (_b) {
|
|
23767
|
+
switch (_b.label) {
|
|
23768
|
+
case 0:
|
|
23769
|
+
customerId = (_a = this.customer) === null || _a === void 0 ? void 0 : _a.id;
|
|
23770
|
+
if (!customerId)
|
|
23771
|
+
throw Error("Unauthorized");
|
|
23772
|
+
return [4 /*yield*/, IkasFavoriteProductAPI.isFavoriteProduct(productId)];
|
|
23773
|
+
case 1: return [2 /*return*/, _b.sent()];
|
|
23774
|
+
}
|
|
23775
|
+
});
|
|
23776
|
+
}); };
|
|
22520
23777
|
this.baseStore = baseStore;
|
|
22521
23778
|
this.init();
|
|
22522
23779
|
mobx.makeAutoObservable(this);
|
|
@@ -22779,6 +24036,7 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
22779
24036
|
lines = this.cart.items.map(function (i) { return ({
|
|
22780
24037
|
quantity: i.quantity,
|
|
22781
24038
|
variantId: i.variant.id,
|
|
24039
|
+
productId: i.variant.productId,
|
|
22782
24040
|
}); });
|
|
22783
24041
|
return [4 /*yield*/, IkasCheckoutAPI.checkStocks(lines)];
|
|
22784
24042
|
case 1:
|
|
@@ -24988,6 +26246,8 @@ var IkasPageHead = mobxReactLite.observer(function (_a) {
|
|
|
24988
26246
|
var page = _a.page, pageTitle = _a.pageTitle, description = _a.description, pageSpecificDataStr = _a.pageSpecificDataStr, props = __rest(_a, ["page", "pageTitle", "description", "pageSpecificDataStr"]);
|
|
24989
26247
|
var ogpMetas = [];
|
|
24990
26248
|
var schemas = [];
|
|
26249
|
+
var isCanonicalLinkAdd = false;
|
|
26250
|
+
var canonicalHref = "";
|
|
24991
26251
|
if (props.addOgpMetas) {
|
|
24992
26252
|
ogpMetas.push({
|
|
24993
26253
|
property: "og:type",
|
|
@@ -25046,7 +26306,15 @@ var IkasPageHead = mobxReactLite.observer(function (_a) {
|
|
|
25046
26306
|
schemas.push(storeSchema);
|
|
25047
26307
|
}
|
|
25048
26308
|
if (pageSpecificDataStr && (page === null || page === void 0 ? void 0 : page.type) === exports.IkasThemePageType.PRODUCT) {
|
|
25049
|
-
var
|
|
26309
|
+
var productDetailParsed = JSON.parse(pageSpecificDataStr);
|
|
26310
|
+
var productDetail = new IkasProductDetail(productDetailParsed.product, productDetailParsed.selectedVariantValues);
|
|
26311
|
+
if (typeof window !== "undefined" && productDetail.product.hasVariant) {
|
|
26312
|
+
isCanonicalLinkAdd =
|
|
26313
|
+
window.location.pathname !== productDetail.product.href;
|
|
26314
|
+
canonicalHref =
|
|
26315
|
+
"https://" + window.location.hostname + productDetail.product.href;
|
|
26316
|
+
}
|
|
26317
|
+
var schema = createProductSchema(productDetail);
|
|
25050
26318
|
if (schema)
|
|
25051
26319
|
schemas.push(schema);
|
|
25052
26320
|
}
|
|
@@ -25063,6 +26331,7 @@ var IkasPageHead = mobxReactLite.observer(function (_a) {
|
|
|
25063
26331
|
return (React.createElement(Head__default['default'], null,
|
|
25064
26332
|
React.createElement("title", null, pageTitle || ""),
|
|
25065
26333
|
React.createElement("meta", { name: "description", content: description || "" }),
|
|
26334
|
+
isCanonicalLinkAdd && React.createElement("link", { rel: "canonical", href: canonicalHref }),
|
|
25066
26335
|
!!props.addOgpMetas &&
|
|
25067
26336
|
ogpMetas.map(function (ogpMeta, index) { return (React.createElement("meta", { key: ogpMeta.content + "-" + index, property: ogpMeta.property, content: ogpMeta.content })); }),
|
|
25068
26337
|
!!schemas.length &&
|
|
@@ -25096,11 +26365,9 @@ function createStoreSchema(merchantSettings) {
|
|
|
25096
26365
|
url: "https://" + hostname,
|
|
25097
26366
|
};
|
|
25098
26367
|
}
|
|
25099
|
-
function createProductSchema(
|
|
26368
|
+
function createProductSchema(productDetail) {
|
|
25100
26369
|
var _a;
|
|
25101
26370
|
try {
|
|
25102
|
-
var productDetailParsed = JSON.parse(pageSpecificDataStr);
|
|
25103
|
-
var productDetail = new IkasProductDetail(productDetailParsed.product, productDetailParsed.selectedVariantValues);
|
|
25104
26371
|
var isBrowser = typeof window !== "undefined";
|
|
25105
26372
|
if (isBrowser) {
|
|
25106
26373
|
var urlParams = new URLSearchParams(window.location.search);
|
|
@@ -25804,6 +27071,10 @@ var pageStyle$1 = {
|
|
|
25804
27071
|
justifyContent: "space-between",
|
|
25805
27072
|
};
|
|
25806
27073
|
|
|
27074
|
+
var Image = function (props) {
|
|
27075
|
+
return React.createElement(Image__default['default'], __assign({}, props, { unoptimized: true, quality: 100 }));
|
|
27076
|
+
};
|
|
27077
|
+
|
|
25807
27078
|
var GTMHead = function (_a) {
|
|
25808
27079
|
var blockHTML = _a.blockHTML;
|
|
25809
27080
|
var gtmId = process.env.GTM_ID;
|
|
@@ -25832,6 +27103,7 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
25832
27103
|
IkasPage: IkasPage,
|
|
25833
27104
|
IkasPageHead: IkasPageHead,
|
|
25834
27105
|
IkasPageEditor: IkasPageEditor,
|
|
27106
|
+
Image: Image,
|
|
25835
27107
|
GTMHead: GTMHead,
|
|
25836
27108
|
GTMBody: GTMBody,
|
|
25837
27109
|
GTMPageView: GTMPageView,
|
|
@@ -25876,7 +27148,8 @@ var Page$1 = function (_a) {
|
|
|
25876
27148
|
var page = _a.page, pageSpecificDataStr = _a.pageSpecificDataStr, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr, merchantSettings = _a.merchantSettings;
|
|
25877
27149
|
var router$1 = router.useRouter();
|
|
25878
27150
|
var _b = React.useState(false), isBrowser = _b[0], setIsBrowser = _b[1];
|
|
25879
|
-
var
|
|
27151
|
+
var initialPropValues = React.useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router$1); }, [propValuesStr]);
|
|
27152
|
+
var _c = React.useState(initialPropValues), propValues = _c[0], setPropValues = _c[1];
|
|
25880
27153
|
React.useEffect(function () {
|
|
25881
27154
|
setIsBrowser(typeof window !== "undefined");
|
|
25882
27155
|
}, []);
|
|
@@ -26350,6 +27623,34 @@ var editor$1 = /*#__PURE__*/Object.freeze({
|
|
|
26350
27623
|
'default': editor
|
|
26351
27624
|
});
|
|
26352
27625
|
|
|
27626
|
+
var Page$d = function (_a) {
|
|
27627
|
+
var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr;
|
|
27628
|
+
var router$1 = router.useRouter();
|
|
27629
|
+
var propValues = IkasPageDataProvider.initPropValues(propValuesStr, router$1);
|
|
27630
|
+
return (React.createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
|
|
27631
|
+
};
|
|
27632
|
+
var getStaticProps$b = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
27633
|
+
var theme, provider;
|
|
27634
|
+
return __generator(this, function (_a) {
|
|
27635
|
+
switch (_a.label) {
|
|
27636
|
+
case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
|
|
27637
|
+
case 1:
|
|
27638
|
+
theme = _a.sent();
|
|
27639
|
+
provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.FAVORITE_PRODUCTS);
|
|
27640
|
+
return [4 /*yield*/, provider.getPageData()];
|
|
27641
|
+
case 2:
|
|
27642
|
+
_a.sent();
|
|
27643
|
+
return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
|
|
27644
|
+
}
|
|
27645
|
+
});
|
|
27646
|
+
}); };
|
|
27647
|
+
|
|
27648
|
+
var favoriteProducts = /*#__PURE__*/Object.freeze({
|
|
27649
|
+
__proto__: null,
|
|
27650
|
+
'default': Page$d,
|
|
27651
|
+
getStaticProps: getStaticProps$b
|
|
27652
|
+
});
|
|
27653
|
+
|
|
26353
27654
|
mobx.configure({
|
|
26354
27655
|
enforceActions: "never",
|
|
26355
27656
|
});
|
|
@@ -26371,6 +27672,7 @@ exports.CustomPage = _slug_;
|
|
|
26371
27672
|
exports.EditorPage = editor$1;
|
|
26372
27673
|
exports.EmailRule = EmailRule;
|
|
26373
27674
|
exports.EqualsRule = EqualsRule;
|
|
27675
|
+
exports.FavoriteProductsPage = favoriteProducts;
|
|
26374
27676
|
exports.ForgotPasswordForm = ForgotPasswordForm;
|
|
26375
27677
|
exports.ForgotPasswordPage = forgotPassword;
|
|
26376
27678
|
exports.GTMAddToCart = GTMAddToCart;
|
|
@@ -26383,6 +27685,7 @@ exports.GTMPageView = GTMPageView;
|
|
|
26383
27685
|
exports.GTMProductView = GTMProductView;
|
|
26384
27686
|
exports.GTMPurchase = GTMPurchase;
|
|
26385
27687
|
exports.GTMRemoveFromCart = GTMRemoveFromCart;
|
|
27688
|
+
exports.IkasApplicableProductFilterValue = IkasApplicableProductFilterValue;
|
|
26386
27689
|
exports.IkasBaseStore = IkasBaseStore;
|
|
26387
27690
|
exports.IkasBrand = IkasBrand;
|
|
26388
27691
|
exports.IkasBrandAPI = IkasBrandAPI;
|
|
@@ -26404,6 +27707,8 @@ exports.IkasCustomer = IkasCustomer;
|
|
|
26404
27707
|
exports.IkasCustomerAPI = IkasCustomerAPI;
|
|
26405
27708
|
exports.IkasCustomerAddress = IkasCustomerAddress;
|
|
26406
27709
|
exports.IkasDistrictAPI = IkasDistrictAPI;
|
|
27710
|
+
exports.IkasFavoriteProduct = IkasFavoriteProduct;
|
|
27711
|
+
exports.IkasFavoriteProductAPI = IkasFavoriteProductAPI;
|
|
26407
27712
|
exports.IkasHTMLMetaData = IkasHTMLMetaData;
|
|
26408
27713
|
exports.IkasHTMLMetaDataAPI = IkasHTMLMetaDataAPI;
|
|
26409
27714
|
exports.IkasImage = IkasImage;
|
|
@@ -26426,10 +27731,12 @@ exports.IkasProductAttributeAPI = IkasProductAttributeAPI;
|
|
|
26426
27731
|
exports.IkasProductAttributeValue = IkasProductAttributeValue;
|
|
26427
27732
|
exports.IkasProductDetail = IkasProductDetail;
|
|
26428
27733
|
exports.IkasProductDetailPropValue = IkasProductDetailPropValue;
|
|
27734
|
+
exports.IkasProductFilter = IkasProductFilter;
|
|
27735
|
+
exports.IkasProductFilterValue = IkasProductFilterValue;
|
|
26429
27736
|
exports.IkasProductList = IkasProductList;
|
|
26430
|
-
exports.IkasProductListFilter = IkasProductListFilter;
|
|
26431
27737
|
exports.IkasProductListPropValue = IkasProductListPropValue;
|
|
26432
27738
|
exports.IkasProductPrice = IkasProductPrice;
|
|
27739
|
+
exports.IkasProductSearchAPI = IkasProductSearchAPI;
|
|
26433
27740
|
exports.IkasProductVariant = IkasProductVariant;
|
|
26434
27741
|
exports.IkasProductVariantType = IkasProductVariantType;
|
|
26435
27742
|
exports.IkasStateAPI = IkasStateAPI;
|
|
@@ -26446,6 +27753,7 @@ exports.IkasThemeSettings = IkasThemeSettings;
|
|
|
26446
27753
|
exports.IkasVariantType = IkasVariantType;
|
|
26447
27754
|
exports.IkasVariantTypeAPI = IkasVariantTypeAPI;
|
|
26448
27755
|
exports.IkasVariantValue = IkasVariantValue;
|
|
27756
|
+
exports.Image = Image;
|
|
26449
27757
|
exports.IndexPage = home;
|
|
26450
27758
|
exports.LessThanRule = LessThanRule;
|
|
26451
27759
|
exports.LoginForm = LoginForm;
|
|
@@ -26455,6 +27763,7 @@ exports.MinRule = MinRule;
|
|
|
26455
27763
|
exports.OrderDetailPage = _id_$2;
|
|
26456
27764
|
exports.OrdersPage = index$4;
|
|
26457
27765
|
exports.PhoneRule = PhoneRule;
|
|
27766
|
+
exports.RangeValue = RangeValue;
|
|
26458
27767
|
exports.RecoverPasswordForm = RecoverPasswordForm;
|
|
26459
27768
|
exports.RecoverPasswordPage = recoverPassword;
|
|
26460
27769
|
exports.RegisterForm = RegisterForm;
|
|
@@ -26466,6 +27775,7 @@ exports.Validator = Validator;
|
|
|
26466
27775
|
exports.apollo = apollo;
|
|
26467
27776
|
exports.decodeBase64 = decodeBase64;
|
|
26468
27777
|
exports.formatMoney = formatMoney;
|
|
27778
|
+
exports.parseRangeStr = parseRangeStr;
|
|
26469
27779
|
exports.pascalCase = pascalCase;
|
|
26470
27780
|
exports.stringToSlug = stringToSlug;
|
|
26471
27781
|
exports.validatePhoneNumber = validatePhoneNumber;
|