@ikas/storefront 0.0.49 → 0.0.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/__generated__/global-types.d.ts +61 -0
- package/build/api/checkout/index.d.ts +1 -0
- package/build/api/customer/__generated__/getMyCustomer.d.ts +1 -0
- package/build/api/customer/__generated__/saveMyCustomer.d.ts +1 -0
- package/build/api/index.d.ts +1 -0
- package/build/api/product-search/__generated__/getProductFilterData.d.ts +27 -0
- package/build/api/product-search/__generated__/searchProducts.d.ts +26 -0
- package/build/api/product-search/index.d.ts +16 -0
- package/build/components/image/index.d.ts +3 -0
- package/build/components/index.d.ts +1 -0
- package/build/index.es.js +1277 -210
- package/build/index.js +1280 -209
- package/build/models/data/category/index.d.ts +2 -0
- package/build/models/data/index.d.ts +1 -0
- package/build/models/data/product/attribute-value/index.d.ts +5 -1
- package/build/models/data/product-attribute/index.d.ts +1 -1
- package/build/models/data/product-filter/index.d.ts +72 -0
- package/build/models/data/simple-product/index.d.ts +134 -0
- package/build/models/data/variant-type/variant-value/index.d.ts +1 -1
- package/build/models/ui/index.d.ts +0 -1
- package/build/models/ui/product-list/index.d.ts +30 -7
- package/build/utils/providers/page-data.d.ts +2 -2
- package/build/utils/providers/prop-value/product-detail.d.ts +2 -2
- package/package.json +1 -1
- package/build/models/ui/product-list/filter.d.ts +0 -18
package/build/index.es.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { makeAutoObservable, toJS, runInAction, reaction, makeObservable, computed, observable, action, configure } from 'mobx';
|
|
2
|
-
import React, { createElement, useState, useEffect, Fragment, useCallback, useRef } from 'react';
|
|
2
|
+
import React, { createElement, useState, useEffect, Fragment, useCallback, useRef, useMemo } from 'react';
|
|
3
3
|
import { observer } from 'mobx-react-lite';
|
|
4
4
|
import { useRouter } from 'next/router';
|
|
5
|
-
import Image from 'next/image';
|
|
5
|
+
import Image$1 from 'next/image';
|
|
6
6
|
import Link from 'next/link';
|
|
7
7
|
import Head from 'next/head';
|
|
8
8
|
import dynamic from 'next/dynamic';
|
|
@@ -10883,7 +10883,7 @@ var Apollo = /** @class */ (function () {
|
|
|
10883
10883
|
this.createApolloClient = function (apiKey) {
|
|
10884
10884
|
var authLink = setContext(function (_request, _a) {
|
|
10885
10885
|
var headers = _a.headers;
|
|
10886
|
-
var newHeaders = __assign(__assign({}, headers), { "x-api-key": apiKey || IkasStorefrontConfig.config.apiKey });
|
|
10886
|
+
var newHeaders = __assign(__assign({}, headers), { "x-api-key": apiKey || IkasStorefrontConfig.config.apiKey, "X-Operation-Name": _request.operationName });
|
|
10887
10887
|
if (Apollo.customerToken) {
|
|
10888
10888
|
newHeaders.Authorization = "Bearer " + Apollo.customerToken;
|
|
10889
10889
|
}
|
|
@@ -10940,32 +10940,32 @@ var IkasProductListPropValueProvider = /** @class */ (function () {
|
|
|
10940
10940
|
}
|
|
10941
10941
|
IkasProductListPropValueProvider.prototype.getValue = function () {
|
|
10942
10942
|
return __awaiter(this, void 0, void 0, function () {
|
|
10943
|
-
var
|
|
10943
|
+
var filterBrandId, filterCategoryId, category, brand, productList;
|
|
10944
10944
|
return __generator(this, function (_a) {
|
|
10945
10945
|
switch (_a.label) {
|
|
10946
10946
|
case 0:
|
|
10947
|
-
filters = new IkasProductListFilter();
|
|
10948
10947
|
if (this.productListPropValue.productListType === IkasProductListType.ALL) {
|
|
10949
10948
|
// TODO use pageParams to insert filters
|
|
10950
10949
|
if (this.productListPropValue.usePageFilter) {
|
|
10951
10950
|
if (this.pageType === IkasThemePageType.CATEGORY) {
|
|
10952
10951
|
category = this.pageSpecificData;
|
|
10953
|
-
|
|
10952
|
+
filterCategoryId = category.id;
|
|
10954
10953
|
}
|
|
10955
10954
|
else if (this.pageType === IkasThemePageType.BRAND) {
|
|
10956
10955
|
brand = this.pageSpecificData;
|
|
10957
|
-
|
|
10956
|
+
filterBrandId = brand.id;
|
|
10958
10957
|
}
|
|
10959
10958
|
}
|
|
10960
10959
|
}
|
|
10961
|
-
if (this.productListPropValue.productListType ===
|
|
10962
|
-
|
|
10963
|
-
|
|
10964
|
-
|
|
10960
|
+
if (this.productListPropValue.productListType ===
|
|
10961
|
+
IkasProductListType.CATEGORY &&
|
|
10962
|
+
this.productListPropValue.category) {
|
|
10963
|
+
filterCategoryId = this.productListPropValue.category;
|
|
10965
10964
|
}
|
|
10966
10965
|
productList = new IkasProductList({
|
|
10967
10966
|
productListPropValue: this.productListPropValue,
|
|
10968
|
-
|
|
10967
|
+
filterBrandId: filterBrandId,
|
|
10968
|
+
filterCategoryId: filterCategoryId,
|
|
10969
10969
|
});
|
|
10970
10970
|
if (!!this.skipInitialFetch) return [3 /*break*/, 2];
|
|
10971
10971
|
return [4 /*yield*/, productList.getInitial()];
|
|
@@ -10988,7 +10988,7 @@ var IkasProductDetailPropValueProvider = /** @class */ (function () {
|
|
|
10988
10988
|
IkasProductDetailPropValueProvider.prototype.getValue = function () {
|
|
10989
10989
|
var _a;
|
|
10990
10990
|
return __awaiter(this, void 0, void 0, function () {
|
|
10991
|
-
var
|
|
10991
|
+
var productSearchResponse, productList, product, variant;
|
|
10992
10992
|
var _this = this;
|
|
10993
10993
|
return __generator(this, function (_b) {
|
|
10994
10994
|
switch (_b.label) {
|
|
@@ -10996,17 +10996,30 @@ var IkasProductDetailPropValueProvider = /** @class */ (function () {
|
|
|
10996
10996
|
if ((_a = this.productDetailPropValue) === null || _a === void 0 ? void 0 : _a.usePageData) {
|
|
10997
10997
|
return [2 /*return*/, this.pageSpecificData];
|
|
10998
10998
|
}
|
|
10999
|
-
|
|
11000
|
-
|
|
10999
|
+
if (!this.productDetailPropValue.productId)
|
|
11000
|
+
return [2 /*return*/, null];
|
|
11001
|
+
return [4 /*yield*/, IkasProductSearchAPI.searchProducts({
|
|
11002
|
+
productIdList: [this.productDetailPropValue.productId],
|
|
11001
11003
|
})];
|
|
11002
11004
|
case 1:
|
|
11003
|
-
|
|
11004
|
-
|
|
11005
|
-
|
|
11006
|
-
|
|
11007
|
-
|
|
11005
|
+
productSearchResponse = _b.sent();
|
|
11006
|
+
if (productSearchResponse) {
|
|
11007
|
+
productList = productSearchResponse.data;
|
|
11008
|
+
if (productList.length) {
|
|
11009
|
+
product = productList[0];
|
|
11010
|
+
if (product === null || product === void 0 ? void 0 : product.hasVariant) {
|
|
11011
|
+
variant = product.variants.find(function (v) { return v.id === _this.productDetailPropValue.variantId; });
|
|
11012
|
+
if (variant)
|
|
11013
|
+
return [2 /*return*/, new IkasProductDetail(product, variant.variantValues)];
|
|
11014
|
+
else
|
|
11015
|
+
return [2 /*return*/, null];
|
|
11016
|
+
}
|
|
11017
|
+
else {
|
|
11018
|
+
return [2 /*return*/, new IkasProductDetail(product, product.variants[0].variantValues)];
|
|
11019
|
+
}
|
|
11020
|
+
}
|
|
11008
11021
|
}
|
|
11009
|
-
return [2 /*return*/,
|
|
11022
|
+
return [2 /*return*/, null];
|
|
11010
11023
|
}
|
|
11011
11024
|
});
|
|
11012
11025
|
});
|
|
@@ -11982,14 +11995,14 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
11982
11995
|
metaDataResponse = _b.sent();
|
|
11983
11996
|
if (!metaDataResponse)
|
|
11984
11997
|
return [2 /*return*/];
|
|
11985
|
-
return [4 /*yield*/,
|
|
11986
|
-
|
|
11998
|
+
return [4 /*yield*/, IkasProductSearchAPI.searchProducts({
|
|
11999
|
+
productIdList: [metaDataResponse.metaData.targetId],
|
|
11987
12000
|
})];
|
|
11988
12001
|
case 2:
|
|
11989
12002
|
productsResponse = _b.sent();
|
|
11990
|
-
if (!productsResponse.
|
|
12003
|
+
if (!(productsResponse === null || productsResponse === void 0 ? void 0 : productsResponse.data.length))
|
|
11991
12004
|
return [2 /*return*/];
|
|
11992
|
-
product = productsResponse.
|
|
12005
|
+
product = productsResponse.data[0];
|
|
11993
12006
|
isMainProductSlug = slug.length === metaDataResponse.slug.length;
|
|
11994
12007
|
selectedVariantValues = [];
|
|
11995
12008
|
if (!isMainProductSlug) {
|
|
@@ -12150,7 +12163,7 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
12150
12163
|
IkasPageDataProvider.initCategoryListPropValue(prop, propValue, pageComponentPropValue);
|
|
12151
12164
|
break;
|
|
12152
12165
|
case IkasThemeComponentPropType.PRODUCT_LIST:
|
|
12153
|
-
IkasPageDataProvider.initProductListPropValue(prop, propValue, pageComponentPropValue);
|
|
12166
|
+
IkasPageDataProvider.initProductListPropValue(prop, propValue, pageComponentPropValue, router);
|
|
12154
12167
|
break;
|
|
12155
12168
|
case IkasThemeComponentPropType.PRODUCT_DETAIL:
|
|
12156
12169
|
IkasPageDataProvider.initProductDetailPropValue(prop, propValue, pageComponentPropValue, router, isBrowser);
|
|
@@ -12192,11 +12205,11 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
12192
12205
|
IkasPageDataProvider._initCategoryListPropValue = function (propValue) {
|
|
12193
12206
|
return new IkasCategoryList(propValue);
|
|
12194
12207
|
};
|
|
12195
|
-
IkasPageDataProvider.initProductListPropValue = function (prop, propValue, pageComponentPropValue) {
|
|
12196
|
-
pageComponentPropValue.propValues[prop.name] = this._initProductListPropValue(propValue);
|
|
12208
|
+
IkasPageDataProvider.initProductListPropValue = function (prop, propValue, pageComponentPropValue, router) {
|
|
12209
|
+
pageComponentPropValue.propValues[prop.name] = this._initProductListPropValue(propValue, router);
|
|
12197
12210
|
};
|
|
12198
|
-
IkasPageDataProvider._initProductListPropValue = function (propValue) {
|
|
12199
|
-
return new IkasProductList(propValue);
|
|
12211
|
+
IkasPageDataProvider._initProductListPropValue = function (propValue, router) {
|
|
12212
|
+
return new IkasProductList(propValue, router);
|
|
12200
12213
|
};
|
|
12201
12214
|
IkasPageDataProvider.initProductDetailPropValue = function (prop, propValue, pageComponentPropValue, router, isBrowser) {
|
|
12202
12215
|
pageComponentPropValue.propValues[prop.name] = this._initProductDetailPropValue(propValue, router, isBrowser);
|
|
@@ -12274,7 +12287,7 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
12274
12287
|
case IkasThemeCustomDataType.PRODUCT_DETAIL:
|
|
12275
12288
|
return this._initProductDetailPropValue(propValue, router, isBrowser);
|
|
12276
12289
|
case IkasThemeCustomDataType.PRODUCT_LIST:
|
|
12277
|
-
return this._initProductListPropValue(propValue);
|
|
12290
|
+
return this._initProductListPropValue(propValue, router);
|
|
12278
12291
|
case IkasThemeCustomDataType.OBJECT:
|
|
12279
12292
|
var objectValue = {};
|
|
12280
12293
|
for (var _i = 0, _a = customData.nestedData || []; _i < _a.length; _i++) {
|
|
@@ -12425,6 +12438,7 @@ var IkasCategory = /** @class */ (function () {
|
|
|
12425
12438
|
? new IkasHTMLMetaData(data.metaData)
|
|
12426
12439
|
: undefined;
|
|
12427
12440
|
this.image = data.image ? new IkasImage(data.image.id) : null;
|
|
12441
|
+
this.path = data.path || [];
|
|
12428
12442
|
makeAutoObservable(this);
|
|
12429
12443
|
}
|
|
12430
12444
|
Object.defineProperty(IkasCategory.prototype, "href", {
|
|
@@ -13094,7 +13108,7 @@ var IkasVariantValue = /** @class */ (function () {
|
|
|
13094
13108
|
this.id = data.id || "";
|
|
13095
13109
|
this.name = data.name || "";
|
|
13096
13110
|
this.colorCode = data.colorCode || null;
|
|
13097
|
-
this.
|
|
13111
|
+
this.thumbnailImageId = data.thumbnailImageId || null;
|
|
13098
13112
|
this.variantTypeId = data.variantTypeId || "";
|
|
13099
13113
|
makeAutoObservable(this);
|
|
13100
13114
|
}
|
|
@@ -13107,8 +13121,8 @@ var IkasVariantValue = /** @class */ (function () {
|
|
|
13107
13121
|
});
|
|
13108
13122
|
Object.defineProperty(IkasVariantValue.prototype, "thumbnailImage", {
|
|
13109
13123
|
get: function () {
|
|
13110
|
-
if (this.
|
|
13111
|
-
return new IkasImage(this.
|
|
13124
|
+
if (this.thumbnailImageId)
|
|
13125
|
+
return new IkasImage(this.thumbnailImageId);
|
|
13112
13126
|
},
|
|
13113
13127
|
enumerable: false,
|
|
13114
13128
|
configurable: true
|
|
@@ -13116,11 +13130,48 @@ var IkasVariantValue = /** @class */ (function () {
|
|
|
13116
13130
|
return IkasVariantValue;
|
|
13117
13131
|
}());
|
|
13118
13132
|
|
|
13133
|
+
var IkasProductAttributeOption = /** @class */ (function () {
|
|
13134
|
+
function IkasProductAttributeOption(data) {
|
|
13135
|
+
if (data === void 0) { data = {}; }
|
|
13136
|
+
this.id = data.id || "";
|
|
13137
|
+
this.name = data.name || "";
|
|
13138
|
+
makeAutoObservable(this);
|
|
13139
|
+
}
|
|
13140
|
+
return IkasProductAttributeOption;
|
|
13141
|
+
}());
|
|
13142
|
+
|
|
13143
|
+
var IkasProductAttribute = /** @class */ (function () {
|
|
13144
|
+
function IkasProductAttribute(data) {
|
|
13145
|
+
this.id = data.id || "";
|
|
13146
|
+
this.name = data.name || "";
|
|
13147
|
+
this.type = data.type || IkasProductAttributeType.TEXT;
|
|
13148
|
+
this.options = data.options || null;
|
|
13149
|
+
makeAutoObservable(this);
|
|
13150
|
+
}
|
|
13151
|
+
return IkasProductAttribute;
|
|
13152
|
+
}());
|
|
13153
|
+
var IkasProductAttributeType;
|
|
13154
|
+
(function (IkasProductAttributeType) {
|
|
13155
|
+
IkasProductAttributeType["CHOICE"] = "CHOICE";
|
|
13156
|
+
IkasProductAttributeType["MULTIPLE_CHOICE"] = "MULTIPLE_CHOICE";
|
|
13157
|
+
IkasProductAttributeType["TEXT"] = "TEXT";
|
|
13158
|
+
IkasProductAttributeType["BOOLEAN"] = "BOOLEAN";
|
|
13159
|
+
IkasProductAttributeType["NUMERIC"] = "NUMERIC";
|
|
13160
|
+
IkasProductAttributeType["DATETIME"] = "DATETIME";
|
|
13161
|
+
IkasProductAttributeType["HTML"] = "HTML";
|
|
13162
|
+
})(IkasProductAttributeType || (IkasProductAttributeType = {}));
|
|
13163
|
+
|
|
13119
13164
|
var IkasProductAttributeValue = /** @class */ (function () {
|
|
13120
13165
|
function IkasProductAttributeValue(data) {
|
|
13121
13166
|
this.value = data.value || null;
|
|
13122
13167
|
this.productAttributeId = data.productAttributeId || "";
|
|
13123
13168
|
this.productAttributeOptionId = data.productAttributeOptionId || null;
|
|
13169
|
+
this.productAttribute = data.productAttribute
|
|
13170
|
+
? new IkasProductAttribute(data.productAttribute)
|
|
13171
|
+
: null;
|
|
13172
|
+
this.productAttributeOption = data.productAttributeOption
|
|
13173
|
+
? new IkasProductAttributeOption(data.productAttributeOption)
|
|
13174
|
+
: null;
|
|
13124
13175
|
makeAutoObservable(this);
|
|
13125
13176
|
}
|
|
13126
13177
|
return IkasProductAttributeValue;
|
|
@@ -13270,26 +13321,191 @@ var IkasProductType;
|
|
|
13270
13321
|
IkasProductType["MEMBERSHIP"] = "MEMBERSHIP";
|
|
13271
13322
|
})(IkasProductType || (IkasProductType = {}));
|
|
13272
13323
|
|
|
13273
|
-
var
|
|
13274
|
-
function
|
|
13324
|
+
var IkasProductFilter = /** @class */ (function () {
|
|
13325
|
+
function IkasProductFilter(data) {
|
|
13326
|
+
if (data === void 0) { data = {}; }
|
|
13327
|
+
this.values = null;
|
|
13328
|
+
this.customValues = null;
|
|
13329
|
+
// Extra
|
|
13330
|
+
this.numberRange = null; // Selected range value for the number slider
|
|
13331
|
+
this.numberRangeLimit = null; // Limits for the number range slider
|
|
13332
|
+
this.numberRangeListOptions = null; // List options for the number range select
|
|
13275
13333
|
this.id = data.id || "";
|
|
13334
|
+
this.key = data.key || "";
|
|
13276
13335
|
this.name = data.name || "";
|
|
13277
|
-
this.
|
|
13278
|
-
this.
|
|
13336
|
+
this.order = data.order || 0;
|
|
13337
|
+
this.type = data.type || IkasProductFilterType.BRAND;
|
|
13338
|
+
this.displayType = data.displayType || IkasProductFilterDisplayType.BOX;
|
|
13339
|
+
this.isMultiSelect = data.isMultiSelect || false;
|
|
13340
|
+
this.values = data.values
|
|
13341
|
+
? data.values.map(function (v) { return new IkasApplicableProductFilterValue(v); })
|
|
13342
|
+
: null;
|
|
13343
|
+
this.customValues = data.customValues || null;
|
|
13344
|
+
if (this.displayType === IkasProductFilterDisplayType.NUMBER_RANGE_LIST &&
|
|
13345
|
+
this.customValues &&
|
|
13346
|
+
this.customValues.length) {
|
|
13347
|
+
this.numberRangeListOptions = this.customValues.map(function (cv) {
|
|
13348
|
+
return new NumberRangeListOption(__assign(__assign({ key: cv }, parseRangeStr(cv)), { isSelected: false }));
|
|
13349
|
+
});
|
|
13350
|
+
}
|
|
13351
|
+
if (this.displayType === IkasProductFilterDisplayType.NUMBER_RANGE &&
|
|
13352
|
+
this.customValues &&
|
|
13353
|
+
this.customValues.length) {
|
|
13354
|
+
var value = this.customValues[0];
|
|
13355
|
+
this.numberRangeLimit = parseRangeStr(value);
|
|
13356
|
+
}
|
|
13279
13357
|
makeAutoObservable(this);
|
|
13280
13358
|
}
|
|
13281
|
-
|
|
13359
|
+
Object.defineProperty(IkasProductFilter.prototype, "isCustomValueFilter", {
|
|
13360
|
+
get: function () {
|
|
13361
|
+
return [
|
|
13362
|
+
IkasProductFilterDisplayType.NUMBER_RANGE_LIST,
|
|
13363
|
+
IkasProductFilterDisplayType.NUMBER_RANGE,
|
|
13364
|
+
].includes(this.displayType);
|
|
13365
|
+
},
|
|
13366
|
+
enumerable: false,
|
|
13367
|
+
configurable: true
|
|
13368
|
+
});
|
|
13369
|
+
Object.defineProperty(IkasProductFilter.prototype, "valueList", {
|
|
13370
|
+
get: function () {
|
|
13371
|
+
var _this = this;
|
|
13372
|
+
var _a;
|
|
13373
|
+
if (this.numberRange)
|
|
13374
|
+
return [this.rangeToId(this.numberRange)];
|
|
13375
|
+
if (this.numberRangeListOptions)
|
|
13376
|
+
return this.numberRangeListOptions
|
|
13377
|
+
.filter(function (o) { return o.isSelected; })
|
|
13378
|
+
.map(function (o) { return _this.rangeToId(o); });
|
|
13379
|
+
return ((_a = this.values) === null || _a === void 0 ? void 0 : _a.filter(function (v) { return v.isSelected; }).map(function (v) { return v.id; })) || [];
|
|
13380
|
+
},
|
|
13381
|
+
enumerable: false,
|
|
13382
|
+
configurable: true
|
|
13383
|
+
});
|
|
13384
|
+
Object.defineProperty(IkasProductFilter.prototype, "keyList", {
|
|
13385
|
+
get: function () {
|
|
13386
|
+
var _this = this;
|
|
13387
|
+
var _a;
|
|
13388
|
+
if (this.numberRange)
|
|
13389
|
+
return [this.rangeToId(this.numberRange)];
|
|
13390
|
+
if (this.numberRangeListOptions)
|
|
13391
|
+
return this.numberRangeListOptions
|
|
13392
|
+
.filter(function (o) { return o.isSelected; })
|
|
13393
|
+
.map(function (o) { return _this.rangeToId(o); });
|
|
13394
|
+
return ((_a = this.values) === null || _a === void 0 ? void 0 : _a.filter(function (v) { return v.isSelected; }).map(function (v) { return v.key; })) || [];
|
|
13395
|
+
},
|
|
13396
|
+
enumerable: false,
|
|
13397
|
+
configurable: true
|
|
13398
|
+
});
|
|
13399
|
+
IkasProductFilter.prototype.clear = function () {
|
|
13400
|
+
var _a, _b;
|
|
13401
|
+
this.numberRange = null;
|
|
13402
|
+
(_a = this.numberRangeListOptions) === null || _a === void 0 ? void 0 : _a.forEach(function (o) { return (o.isSelected = false); });
|
|
13403
|
+
(_b = this.values) === null || _b === void 0 ? void 0 : _b.forEach(function (v) { return (v.isSelected = false); });
|
|
13404
|
+
};
|
|
13405
|
+
IkasProductFilter.prototype.toInput = function () {
|
|
13406
|
+
return {
|
|
13407
|
+
id: this.key,
|
|
13408
|
+
type: this.type,
|
|
13409
|
+
valueList: this.valueList,
|
|
13410
|
+
};
|
|
13411
|
+
};
|
|
13412
|
+
IkasProductFilter.prototype.rangeToId = function (range) {
|
|
13413
|
+
return range.from + ":" + (range.to || "");
|
|
13414
|
+
};
|
|
13415
|
+
return IkasProductFilter;
|
|
13282
13416
|
}());
|
|
13283
|
-
var
|
|
13284
|
-
|
|
13285
|
-
|
|
13286
|
-
|
|
13287
|
-
|
|
13288
|
-
|
|
13289
|
-
|
|
13290
|
-
|
|
13291
|
-
|
|
13292
|
-
|
|
13417
|
+
var IkasApplicableProductFilterValue = /** @class */ (function () {
|
|
13418
|
+
function IkasApplicableProductFilterValue(data) {
|
|
13419
|
+
if (data === void 0) { data = {}; }
|
|
13420
|
+
this.colorCode = null;
|
|
13421
|
+
this.thumbnailImageId = null;
|
|
13422
|
+
this.thumbnailImage = null;
|
|
13423
|
+
// Extra
|
|
13424
|
+
this._isSelected = false;
|
|
13425
|
+
this.id = data.id || "";
|
|
13426
|
+
this.key = data.key || "";
|
|
13427
|
+
this.name = data.name || "";
|
|
13428
|
+
this.colorCode = data.colorCode || null;
|
|
13429
|
+
this.thumbnailImageId = data.thumbnailImageId || null;
|
|
13430
|
+
if (this.thumbnailImageId)
|
|
13431
|
+
this.thumbnailImage = new IkasImage(this.thumbnailImageId);
|
|
13432
|
+
this._isSelected = data.isSelected || false;
|
|
13433
|
+
makeAutoObservable(this);
|
|
13434
|
+
}
|
|
13435
|
+
Object.defineProperty(IkasApplicableProductFilterValue.prototype, "isSelected", {
|
|
13436
|
+
get: function () {
|
|
13437
|
+
return this._isSelected;
|
|
13438
|
+
},
|
|
13439
|
+
set: function (value) {
|
|
13440
|
+
this._isSelected = value;
|
|
13441
|
+
},
|
|
13442
|
+
enumerable: false,
|
|
13443
|
+
configurable: true
|
|
13444
|
+
});
|
|
13445
|
+
return IkasApplicableProductFilterValue;
|
|
13446
|
+
}());
|
|
13447
|
+
var IkasProductFilterValue = /** @class */ (function () {
|
|
13448
|
+
function IkasProductFilterValue(data) {
|
|
13449
|
+
this.id = data.id;
|
|
13450
|
+
this.type = data.type;
|
|
13451
|
+
this.valueList = data.valueList;
|
|
13452
|
+
makeAutoObservable(this);
|
|
13453
|
+
}
|
|
13454
|
+
return IkasProductFilterValue;
|
|
13455
|
+
}());
|
|
13456
|
+
var IkasProductFilterType;
|
|
13457
|
+
(function (IkasProductFilterType) {
|
|
13458
|
+
IkasProductFilterType["ATTRIBUTE"] = "ATTRIBUTE";
|
|
13459
|
+
IkasProductFilterType["BRAND"] = "BRAND";
|
|
13460
|
+
IkasProductFilterType["DISCOUNT_RATIO"] = "DISCOUNT_RATIO";
|
|
13461
|
+
IkasProductFilterType["PRICE"] = "PRICE";
|
|
13462
|
+
IkasProductFilterType["STOCK_STATUS"] = "STOCK_STATUS";
|
|
13463
|
+
IkasProductFilterType["TAG"] = "TAG";
|
|
13464
|
+
IkasProductFilterType["VARIANT_TYPE"] = "VARIANT_TYPE";
|
|
13465
|
+
})(IkasProductFilterType || (IkasProductFilterType = {}));
|
|
13466
|
+
var IkasProductFilterDisplayType;
|
|
13467
|
+
(function (IkasProductFilterDisplayType) {
|
|
13468
|
+
IkasProductFilterDisplayType["BOX"] = "BOX";
|
|
13469
|
+
IkasProductFilterDisplayType["DATE_RANGE"] = "DATE_RANGE";
|
|
13470
|
+
IkasProductFilterDisplayType["LIST"] = "LIST";
|
|
13471
|
+
IkasProductFilterDisplayType["NUMBER_RANGE_LIST"] = "NUMBER_RANGE_LIST";
|
|
13472
|
+
IkasProductFilterDisplayType["NUMBER_RANGE"] = "NUMBER_RANGE";
|
|
13473
|
+
IkasProductFilterDisplayType["SWATCH"] = "SWATCH";
|
|
13474
|
+
})(IkasProductFilterDisplayType || (IkasProductFilterDisplayType = {}));
|
|
13475
|
+
var RangeValue = /** @class */ (function () {
|
|
13476
|
+
function RangeValue(data) {
|
|
13477
|
+
this.from = data.from || 0;
|
|
13478
|
+
this.to = data.to || null;
|
|
13479
|
+
makeAutoObservable(this);
|
|
13480
|
+
}
|
|
13481
|
+
return RangeValue;
|
|
13482
|
+
}());
|
|
13483
|
+
var NumberRangeListOption = /** @class */ (function () {
|
|
13484
|
+
function NumberRangeListOption(data) {
|
|
13485
|
+
this.from = data.from || 0;
|
|
13486
|
+
this.to = data.to || null;
|
|
13487
|
+
this.key = data.key || "";
|
|
13488
|
+
this.isSelected = data.isSelected || false;
|
|
13489
|
+
makeAutoObservable(this);
|
|
13490
|
+
}
|
|
13491
|
+
return NumberRangeListOption;
|
|
13492
|
+
}());
|
|
13493
|
+
function parseRangeStr(rangeStr) {
|
|
13494
|
+
try {
|
|
13495
|
+
var parsedValues = rangeStr.split(":").map(function (i) { return parseInt(i); });
|
|
13496
|
+
return new RangeValue({
|
|
13497
|
+
from: isNaN(parsedValues[0]) ? 0 : parsedValues[0],
|
|
13498
|
+
to: isNaN(parsedValues[1]) ? undefined : parsedValues[1],
|
|
13499
|
+
});
|
|
13500
|
+
}
|
|
13501
|
+
catch (err) {
|
|
13502
|
+
console.log(err);
|
|
13503
|
+
return new RangeValue({
|
|
13504
|
+
from: 0,
|
|
13505
|
+
to: 0,
|
|
13506
|
+
});
|
|
13507
|
+
}
|
|
13508
|
+
}
|
|
13293
13509
|
|
|
13294
13510
|
var IkasOrderTransaction = /** @class */ (function () {
|
|
13295
13511
|
function IkasOrderTransaction(data) {
|
|
@@ -14288,111 +14504,611 @@ var IkasProductDetail = /** @class */ (function () {
|
|
|
14288
14504
|
return IkasProductDetail;
|
|
14289
14505
|
}());
|
|
14290
14506
|
|
|
14291
|
-
var
|
|
14292
|
-
|
|
14293
|
-
|
|
14294
|
-
|
|
14295
|
-
|
|
14296
|
-
|
|
14297
|
-
|
|
14298
|
-
|
|
14299
|
-
|
|
14300
|
-
|
|
14301
|
-
|
|
14302
|
-
|
|
14303
|
-
|
|
14304
|
-
|
|
14305
|
-
|
|
14507
|
+
var strictUriEncode = str => encodeURIComponent(str).replace(/[!'()*]/g, x => `%${x.charCodeAt(0).toString(16).toUpperCase()}`);
|
|
14508
|
+
|
|
14509
|
+
var token = '%[a-f0-9]{2}';
|
|
14510
|
+
var singleMatcher = new RegExp(token, 'gi');
|
|
14511
|
+
var multiMatcher = new RegExp('(' + token + ')+', 'gi');
|
|
14512
|
+
|
|
14513
|
+
function decodeComponents(components, split) {
|
|
14514
|
+
try {
|
|
14515
|
+
// Try to decode the entire string first
|
|
14516
|
+
return decodeURIComponent(components.join(''));
|
|
14517
|
+
} catch (err) {
|
|
14518
|
+
// Do nothing
|
|
14519
|
+
}
|
|
14520
|
+
|
|
14521
|
+
if (components.length === 1) {
|
|
14522
|
+
return components;
|
|
14523
|
+
}
|
|
14524
|
+
|
|
14525
|
+
split = split || 1;
|
|
14526
|
+
|
|
14527
|
+
// Split the array in 2 parts
|
|
14528
|
+
var left = components.slice(0, split);
|
|
14529
|
+
var right = components.slice(split);
|
|
14530
|
+
|
|
14531
|
+
return Array.prototype.concat.call([], decodeComponents(left), decodeComponents(right));
|
|
14532
|
+
}
|
|
14533
|
+
|
|
14534
|
+
function decode(input) {
|
|
14535
|
+
try {
|
|
14536
|
+
return decodeURIComponent(input);
|
|
14537
|
+
} catch (err) {
|
|
14538
|
+
var tokens = input.match(singleMatcher);
|
|
14539
|
+
|
|
14540
|
+
for (var i = 1; i < tokens.length; i++) {
|
|
14541
|
+
input = decodeComponents(tokens, i).join('');
|
|
14542
|
+
|
|
14543
|
+
tokens = input.match(singleMatcher);
|
|
14544
|
+
}
|
|
14545
|
+
|
|
14546
|
+
return input;
|
|
14547
|
+
}
|
|
14548
|
+
}
|
|
14549
|
+
|
|
14550
|
+
function customDecodeURIComponent(input) {
|
|
14551
|
+
// Keep track of all the replacements and prefill the map with the `BOM`
|
|
14552
|
+
var replaceMap = {
|
|
14553
|
+
'%FE%FF': '\uFFFD\uFFFD',
|
|
14554
|
+
'%FF%FE': '\uFFFD\uFFFD'
|
|
14555
|
+
};
|
|
14556
|
+
|
|
14557
|
+
var match = multiMatcher.exec(input);
|
|
14558
|
+
while (match) {
|
|
14559
|
+
try {
|
|
14560
|
+
// Decode as big chunks as possible
|
|
14561
|
+
replaceMap[match[0]] = decodeURIComponent(match[0]);
|
|
14562
|
+
} catch (err) {
|
|
14563
|
+
var result = decode(match[0]);
|
|
14564
|
+
|
|
14565
|
+
if (result !== match[0]) {
|
|
14566
|
+
replaceMap[match[0]] = result;
|
|
14567
|
+
}
|
|
14568
|
+
}
|
|
14569
|
+
|
|
14570
|
+
match = multiMatcher.exec(input);
|
|
14571
|
+
}
|
|
14572
|
+
|
|
14573
|
+
// Add `%C2` at the end of the map to make sure it does not replace the combinator before everything else
|
|
14574
|
+
replaceMap['%C2'] = '\uFFFD';
|
|
14575
|
+
|
|
14576
|
+
var entries = Object.keys(replaceMap);
|
|
14577
|
+
|
|
14578
|
+
for (var i = 0; i < entries.length; i++) {
|
|
14579
|
+
// Replace all decoded components
|
|
14580
|
+
var key = entries[i];
|
|
14581
|
+
input = input.replace(new RegExp(key, 'g'), replaceMap[key]);
|
|
14582
|
+
}
|
|
14583
|
+
|
|
14584
|
+
return input;
|
|
14585
|
+
}
|
|
14586
|
+
|
|
14587
|
+
var decodeUriComponent = function (encodedURI) {
|
|
14588
|
+
if (typeof encodedURI !== 'string') {
|
|
14589
|
+
throw new TypeError('Expected `encodedURI` to be of type `string`, got `' + typeof encodedURI + '`');
|
|
14590
|
+
}
|
|
14591
|
+
|
|
14592
|
+
try {
|
|
14593
|
+
encodedURI = encodedURI.replace(/\+/g, ' ');
|
|
14594
|
+
|
|
14595
|
+
// Try the built in decoder first
|
|
14596
|
+
return decodeURIComponent(encodedURI);
|
|
14597
|
+
} catch (err) {
|
|
14598
|
+
// Fallback to a more advanced decoder
|
|
14599
|
+
return customDecodeURIComponent(encodedURI);
|
|
14600
|
+
}
|
|
14601
|
+
};
|
|
14602
|
+
|
|
14603
|
+
var splitOnFirst = (string, separator) => {
|
|
14604
|
+
if (!(typeof string === 'string' && typeof separator === 'string')) {
|
|
14605
|
+
throw new TypeError('Expected the arguments to be of type `string`');
|
|
14606
|
+
}
|
|
14607
|
+
|
|
14608
|
+
if (separator === '') {
|
|
14609
|
+
return [string];
|
|
14610
|
+
}
|
|
14611
|
+
|
|
14612
|
+
const separatorIndex = string.indexOf(separator);
|
|
14613
|
+
|
|
14614
|
+
if (separatorIndex === -1) {
|
|
14615
|
+
return [string];
|
|
14616
|
+
}
|
|
14617
|
+
|
|
14618
|
+
return [
|
|
14619
|
+
string.slice(0, separatorIndex),
|
|
14620
|
+
string.slice(separatorIndex + separator.length)
|
|
14621
|
+
];
|
|
14622
|
+
};
|
|
14623
|
+
|
|
14624
|
+
var queryString = createCommonjsModule(function (module, exports) {
|
|
14625
|
+
|
|
14626
|
+
|
|
14627
|
+
|
|
14628
|
+
|
|
14629
|
+
const isNullOrUndefined = value => value === null || value === undefined;
|
|
14630
|
+
|
|
14631
|
+
function encoderForArrayFormat(options) {
|
|
14632
|
+
switch (options.arrayFormat) {
|
|
14633
|
+
case 'index':
|
|
14634
|
+
return key => (result, value) => {
|
|
14635
|
+
const index = result.length;
|
|
14636
|
+
|
|
14637
|
+
if (
|
|
14638
|
+
value === undefined ||
|
|
14639
|
+
(options.skipNull && value === null) ||
|
|
14640
|
+
(options.skipEmptyString && value === '')
|
|
14641
|
+
) {
|
|
14642
|
+
return result;
|
|
14643
|
+
}
|
|
14644
|
+
|
|
14645
|
+
if (value === null) {
|
|
14646
|
+
return [...result, [encode(key, options), '[', index, ']'].join('')];
|
|
14647
|
+
}
|
|
14648
|
+
|
|
14649
|
+
return [
|
|
14650
|
+
...result,
|
|
14651
|
+
[encode(key, options), '[', encode(index, options), ']=', encode(value, options)].join('')
|
|
14652
|
+
];
|
|
14653
|
+
};
|
|
14654
|
+
|
|
14655
|
+
case 'bracket':
|
|
14656
|
+
return key => (result, value) => {
|
|
14657
|
+
if (
|
|
14658
|
+
value === undefined ||
|
|
14659
|
+
(options.skipNull && value === null) ||
|
|
14660
|
+
(options.skipEmptyString && value === '')
|
|
14661
|
+
) {
|
|
14662
|
+
return result;
|
|
14663
|
+
}
|
|
14664
|
+
|
|
14665
|
+
if (value === null) {
|
|
14666
|
+
return [...result, [encode(key, options), '[]'].join('')];
|
|
14667
|
+
}
|
|
14668
|
+
|
|
14669
|
+
return [...result, [encode(key, options), '[]=', encode(value, options)].join('')];
|
|
14670
|
+
};
|
|
14671
|
+
|
|
14672
|
+
case 'comma':
|
|
14673
|
+
case 'separator':
|
|
14674
|
+
return key => (result, value) => {
|
|
14675
|
+
if (value === null || value === undefined || value.length === 0) {
|
|
14676
|
+
return result;
|
|
14677
|
+
}
|
|
14678
|
+
|
|
14679
|
+
if (result.length === 0) {
|
|
14680
|
+
return [[encode(key, options), '=', encode(value, options)].join('')];
|
|
14681
|
+
}
|
|
14682
|
+
|
|
14683
|
+
return [[result, encode(value, options)].join(options.arrayFormatSeparator)];
|
|
14684
|
+
};
|
|
14685
|
+
|
|
14686
|
+
default:
|
|
14687
|
+
return key => (result, value) => {
|
|
14688
|
+
if (
|
|
14689
|
+
value === undefined ||
|
|
14690
|
+
(options.skipNull && value === null) ||
|
|
14691
|
+
(options.skipEmptyString && value === '')
|
|
14692
|
+
) {
|
|
14693
|
+
return result;
|
|
14694
|
+
}
|
|
14695
|
+
|
|
14696
|
+
if (value === null) {
|
|
14697
|
+
return [...result, encode(key, options)];
|
|
14698
|
+
}
|
|
14699
|
+
|
|
14700
|
+
return [...result, [encode(key, options), '=', encode(value, options)].join('')];
|
|
14701
|
+
};
|
|
14702
|
+
}
|
|
14703
|
+
}
|
|
14704
|
+
|
|
14705
|
+
function parserForArrayFormat(options) {
|
|
14706
|
+
let result;
|
|
14707
|
+
|
|
14708
|
+
switch (options.arrayFormat) {
|
|
14709
|
+
case 'index':
|
|
14710
|
+
return (key, value, accumulator) => {
|
|
14711
|
+
result = /\[(\d*)\]$/.exec(key);
|
|
14712
|
+
|
|
14713
|
+
key = key.replace(/\[\d*\]$/, '');
|
|
14714
|
+
|
|
14715
|
+
if (!result) {
|
|
14716
|
+
accumulator[key] = value;
|
|
14717
|
+
return;
|
|
14718
|
+
}
|
|
14719
|
+
|
|
14720
|
+
if (accumulator[key] === undefined) {
|
|
14721
|
+
accumulator[key] = {};
|
|
14722
|
+
}
|
|
14723
|
+
|
|
14724
|
+
accumulator[key][result[1]] = value;
|
|
14725
|
+
};
|
|
14726
|
+
|
|
14727
|
+
case 'bracket':
|
|
14728
|
+
return (key, value, accumulator) => {
|
|
14729
|
+
result = /(\[\])$/.exec(key);
|
|
14730
|
+
key = key.replace(/\[\]$/, '');
|
|
14731
|
+
|
|
14732
|
+
if (!result) {
|
|
14733
|
+
accumulator[key] = value;
|
|
14734
|
+
return;
|
|
14735
|
+
}
|
|
14736
|
+
|
|
14737
|
+
if (accumulator[key] === undefined) {
|
|
14738
|
+
accumulator[key] = [value];
|
|
14739
|
+
return;
|
|
14740
|
+
}
|
|
14741
|
+
|
|
14742
|
+
accumulator[key] = [].concat(accumulator[key], value);
|
|
14743
|
+
};
|
|
14744
|
+
|
|
14745
|
+
case 'comma':
|
|
14746
|
+
case 'separator':
|
|
14747
|
+
return (key, value, accumulator) => {
|
|
14748
|
+
const isArray = typeof value === 'string' && value.includes(options.arrayFormatSeparator);
|
|
14749
|
+
const isEncodedArray = (typeof value === 'string' && !isArray && decode(value, options).includes(options.arrayFormatSeparator));
|
|
14750
|
+
value = isEncodedArray ? decode(value, options) : value;
|
|
14751
|
+
const newValue = isArray || isEncodedArray ? value.split(options.arrayFormatSeparator).map(item => decode(item, options)) : value === null ? value : decode(value, options);
|
|
14752
|
+
accumulator[key] = newValue;
|
|
14753
|
+
};
|
|
14754
|
+
|
|
14755
|
+
default:
|
|
14756
|
+
return (key, value, accumulator) => {
|
|
14757
|
+
if (accumulator[key] === undefined) {
|
|
14758
|
+
accumulator[key] = value;
|
|
14759
|
+
return;
|
|
14760
|
+
}
|
|
14761
|
+
|
|
14762
|
+
accumulator[key] = [].concat(accumulator[key], value);
|
|
14763
|
+
};
|
|
14764
|
+
}
|
|
14765
|
+
}
|
|
14766
|
+
|
|
14767
|
+
function validateArrayFormatSeparator(value) {
|
|
14768
|
+
if (typeof value !== 'string' || value.length !== 1) {
|
|
14769
|
+
throw new TypeError('arrayFormatSeparator must be single character string');
|
|
14770
|
+
}
|
|
14771
|
+
}
|
|
14772
|
+
|
|
14773
|
+
function encode(value, options) {
|
|
14774
|
+
if (options.encode) {
|
|
14775
|
+
return options.strict ? strictUriEncode(value) : encodeURIComponent(value);
|
|
14776
|
+
}
|
|
14777
|
+
|
|
14778
|
+
return value;
|
|
14779
|
+
}
|
|
14780
|
+
|
|
14781
|
+
function decode(value, options) {
|
|
14782
|
+
if (options.decode) {
|
|
14783
|
+
return decodeUriComponent(value);
|
|
14784
|
+
}
|
|
14785
|
+
|
|
14786
|
+
return value;
|
|
14787
|
+
}
|
|
14788
|
+
|
|
14789
|
+
function keysSorter(input) {
|
|
14790
|
+
if (Array.isArray(input)) {
|
|
14791
|
+
return input.sort();
|
|
14792
|
+
}
|
|
14793
|
+
|
|
14794
|
+
if (typeof input === 'object') {
|
|
14795
|
+
return keysSorter(Object.keys(input))
|
|
14796
|
+
.sort((a, b) => Number(a) - Number(b))
|
|
14797
|
+
.map(key => input[key]);
|
|
14798
|
+
}
|
|
14799
|
+
|
|
14800
|
+
return input;
|
|
14801
|
+
}
|
|
14802
|
+
|
|
14803
|
+
function removeHash(input) {
|
|
14804
|
+
const hashStart = input.indexOf('#');
|
|
14805
|
+
if (hashStart !== -1) {
|
|
14806
|
+
input = input.slice(0, hashStart);
|
|
14807
|
+
}
|
|
14808
|
+
|
|
14809
|
+
return input;
|
|
14810
|
+
}
|
|
14811
|
+
|
|
14812
|
+
function getHash(url) {
|
|
14813
|
+
let hash = '';
|
|
14814
|
+
const hashStart = url.indexOf('#');
|
|
14815
|
+
if (hashStart !== -1) {
|
|
14816
|
+
hash = url.slice(hashStart);
|
|
14817
|
+
}
|
|
14818
|
+
|
|
14819
|
+
return hash;
|
|
14820
|
+
}
|
|
14821
|
+
|
|
14822
|
+
function extract(input) {
|
|
14823
|
+
input = removeHash(input);
|
|
14824
|
+
const queryStart = input.indexOf('?');
|
|
14825
|
+
if (queryStart === -1) {
|
|
14826
|
+
return '';
|
|
14827
|
+
}
|
|
14828
|
+
|
|
14829
|
+
return input.slice(queryStart + 1);
|
|
14830
|
+
}
|
|
14831
|
+
|
|
14832
|
+
function parseValue(value, options) {
|
|
14833
|
+
if (options.parseNumbers && !Number.isNaN(Number(value)) && (typeof value === 'string' && value.trim() !== '')) {
|
|
14834
|
+
value = Number(value);
|
|
14835
|
+
} else if (options.parseBooleans && value !== null && (value.toLowerCase() === 'true' || value.toLowerCase() === 'false')) {
|
|
14836
|
+
value = value.toLowerCase() === 'true';
|
|
14837
|
+
}
|
|
14838
|
+
|
|
14839
|
+
return value;
|
|
14840
|
+
}
|
|
14841
|
+
|
|
14842
|
+
function parse(query, options) {
|
|
14843
|
+
options = Object.assign({
|
|
14844
|
+
decode: true,
|
|
14845
|
+
sort: true,
|
|
14846
|
+
arrayFormat: 'none',
|
|
14847
|
+
arrayFormatSeparator: ',',
|
|
14848
|
+
parseNumbers: false,
|
|
14849
|
+
parseBooleans: false
|
|
14850
|
+
}, options);
|
|
14851
|
+
|
|
14852
|
+
validateArrayFormatSeparator(options.arrayFormatSeparator);
|
|
14853
|
+
|
|
14854
|
+
const formatter = parserForArrayFormat(options);
|
|
14855
|
+
|
|
14856
|
+
// Create an object with no prototype
|
|
14857
|
+
const ret = Object.create(null);
|
|
14858
|
+
|
|
14859
|
+
if (typeof query !== 'string') {
|
|
14860
|
+
return ret;
|
|
14861
|
+
}
|
|
14862
|
+
|
|
14863
|
+
query = query.trim().replace(/^[?#&]/, '');
|
|
14864
|
+
|
|
14865
|
+
if (!query) {
|
|
14866
|
+
return ret;
|
|
14867
|
+
}
|
|
14868
|
+
|
|
14869
|
+
for (const param of query.split('&')) {
|
|
14870
|
+
let [key, value] = splitOnFirst(options.decode ? param.replace(/\+/g, ' ') : param, '=');
|
|
14871
|
+
|
|
14872
|
+
// Missing `=` should be `null`:
|
|
14873
|
+
// http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters
|
|
14874
|
+
value = value === undefined ? null : ['comma', 'separator'].includes(options.arrayFormat) ? value : decode(value, options);
|
|
14875
|
+
formatter(decode(key, options), value, ret);
|
|
14876
|
+
}
|
|
14877
|
+
|
|
14878
|
+
for (const key of Object.keys(ret)) {
|
|
14879
|
+
const value = ret[key];
|
|
14880
|
+
if (typeof value === 'object' && value !== null) {
|
|
14881
|
+
for (const k of Object.keys(value)) {
|
|
14882
|
+
value[k] = parseValue(value[k], options);
|
|
14883
|
+
}
|
|
14884
|
+
} else {
|
|
14885
|
+
ret[key] = parseValue(value, options);
|
|
14886
|
+
}
|
|
14887
|
+
}
|
|
14888
|
+
|
|
14889
|
+
if (options.sort === false) {
|
|
14890
|
+
return ret;
|
|
14891
|
+
}
|
|
14892
|
+
|
|
14893
|
+
return (options.sort === true ? Object.keys(ret).sort() : Object.keys(ret).sort(options.sort)).reduce((result, key) => {
|
|
14894
|
+
const value = ret[key];
|
|
14895
|
+
if (Boolean(value) && typeof value === 'object' && !Array.isArray(value)) {
|
|
14896
|
+
// Sort object keys, not values
|
|
14897
|
+
result[key] = keysSorter(value);
|
|
14898
|
+
} else {
|
|
14899
|
+
result[key] = value;
|
|
14900
|
+
}
|
|
14901
|
+
|
|
14902
|
+
return result;
|
|
14903
|
+
}, Object.create(null));
|
|
14904
|
+
}
|
|
14905
|
+
|
|
14906
|
+
exports.extract = extract;
|
|
14907
|
+
exports.parse = parse;
|
|
14908
|
+
|
|
14909
|
+
exports.stringify = (object, options) => {
|
|
14910
|
+
if (!object) {
|
|
14911
|
+
return '';
|
|
14912
|
+
}
|
|
14913
|
+
|
|
14914
|
+
options = Object.assign({
|
|
14915
|
+
encode: true,
|
|
14916
|
+
strict: true,
|
|
14917
|
+
arrayFormat: 'none',
|
|
14918
|
+
arrayFormatSeparator: ','
|
|
14919
|
+
}, options);
|
|
14920
|
+
|
|
14921
|
+
validateArrayFormatSeparator(options.arrayFormatSeparator);
|
|
14922
|
+
|
|
14923
|
+
const shouldFilter = key => (
|
|
14924
|
+
(options.skipNull && isNullOrUndefined(object[key])) ||
|
|
14925
|
+
(options.skipEmptyString && object[key] === '')
|
|
14926
|
+
);
|
|
14927
|
+
|
|
14928
|
+
const formatter = encoderForArrayFormat(options);
|
|
14929
|
+
|
|
14930
|
+
const objectCopy = {};
|
|
14931
|
+
|
|
14932
|
+
for (const key of Object.keys(object)) {
|
|
14933
|
+
if (!shouldFilter(key)) {
|
|
14934
|
+
objectCopy[key] = object[key];
|
|
14935
|
+
}
|
|
14936
|
+
}
|
|
14937
|
+
|
|
14938
|
+
const keys = Object.keys(objectCopy);
|
|
14939
|
+
|
|
14940
|
+
if (options.sort !== false) {
|
|
14941
|
+
keys.sort(options.sort);
|
|
14942
|
+
}
|
|
14943
|
+
|
|
14944
|
+
return keys.map(key => {
|
|
14945
|
+
const value = object[key];
|
|
14946
|
+
|
|
14947
|
+
if (value === undefined) {
|
|
14948
|
+
return '';
|
|
14949
|
+
}
|
|
14950
|
+
|
|
14951
|
+
if (value === null) {
|
|
14952
|
+
return encode(key, options);
|
|
14953
|
+
}
|
|
14954
|
+
|
|
14955
|
+
if (Array.isArray(value)) {
|
|
14956
|
+
return value
|
|
14957
|
+
.reduce(formatter(key), [])
|
|
14958
|
+
.join('&');
|
|
14959
|
+
}
|
|
14960
|
+
|
|
14961
|
+
return encode(key, options) + '=' + encode(value, options);
|
|
14962
|
+
}).filter(x => x.length > 0).join('&');
|
|
14963
|
+
};
|
|
14964
|
+
|
|
14965
|
+
exports.parseUrl = (url, options) => {
|
|
14966
|
+
options = Object.assign({
|
|
14967
|
+
decode: true
|
|
14968
|
+
}, options);
|
|
14969
|
+
|
|
14970
|
+
const [url_, hash] = splitOnFirst(url, '#');
|
|
14971
|
+
|
|
14972
|
+
return Object.assign(
|
|
14973
|
+
{
|
|
14974
|
+
url: url_.split('?')[0] || '',
|
|
14975
|
+
query: parse(extract(url), options)
|
|
14976
|
+
},
|
|
14977
|
+
options && options.parseFragmentIdentifier && hash ? {fragmentIdentifier: decode(hash, options)} : {}
|
|
14978
|
+
);
|
|
14979
|
+
};
|
|
14980
|
+
|
|
14981
|
+
exports.stringifyUrl = (object, options) => {
|
|
14982
|
+
options = Object.assign({
|
|
14983
|
+
encode: true,
|
|
14984
|
+
strict: true
|
|
14985
|
+
}, options);
|
|
14986
|
+
|
|
14987
|
+
const url = removeHash(object.url).split('?')[0] || '';
|
|
14988
|
+
const queryFromUrl = exports.extract(object.url);
|
|
14989
|
+
const parsedQueryFromUrl = exports.parse(queryFromUrl, {sort: false});
|
|
14990
|
+
|
|
14991
|
+
const query = Object.assign(parsedQueryFromUrl, object.query);
|
|
14992
|
+
let queryString = exports.stringify(query, options);
|
|
14993
|
+
if (queryString) {
|
|
14994
|
+
queryString = `?${queryString}`;
|
|
14995
|
+
}
|
|
14996
|
+
|
|
14997
|
+
let hash = getHash(object.url);
|
|
14998
|
+
if (object.fragmentIdentifier) {
|
|
14999
|
+
hash = `#${encode(object.fragmentIdentifier, options)}`;
|
|
15000
|
+
}
|
|
15001
|
+
|
|
15002
|
+
return `${url}${queryString}${hash}`;
|
|
15003
|
+
};
|
|
15004
|
+
});
|
|
14306
15005
|
|
|
14307
15006
|
var IkasProductList = /** @class */ (function () {
|
|
14308
|
-
function IkasProductList(data) {
|
|
15007
|
+
function IkasProductList(data, router) {
|
|
14309
15008
|
var _this = this;
|
|
15009
|
+
this.filters = null;
|
|
14310
15010
|
this._initialized = false;
|
|
14311
15011
|
this._minPage = null;
|
|
14312
|
-
|
|
14313
|
-
this.
|
|
14314
|
-
// Used for recommending products for a specific product
|
|
15012
|
+
this._filterBrandId = null;
|
|
15013
|
+
this._filterCategoryId = null;
|
|
14315
15014
|
this._recommendFor = null; // productId
|
|
14316
15015
|
this._isLoading = false;
|
|
14317
|
-
this.
|
|
14318
|
-
|
|
14319
|
-
|
|
14320
|
-
var _a, _b
|
|
14321
|
-
return __generator(this, function (
|
|
14322
|
-
switch (
|
|
15016
|
+
this._fetchRequestTime = 0;
|
|
15017
|
+
this.router = null;
|
|
15018
|
+
this.applyFilters = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
15019
|
+
var _a, _b;
|
|
15020
|
+
return __generator(this, function (_c) {
|
|
15021
|
+
switch (_c.label) {
|
|
15022
|
+
case 0: return [4 /*yield*/, this.getInitial()];
|
|
15023
|
+
case 1:
|
|
15024
|
+
_c.sent();
|
|
15025
|
+
// Change url params
|
|
15026
|
+
if (this.isBrowser()) {
|
|
15027
|
+
if (this.isFiltered) {
|
|
15028
|
+
(_a = this.router) === null || _a === void 0 ? void 0 : _a.replace(location.pathname + "?" + this.filterQueryParams, undefined, { shallow: true });
|
|
15029
|
+
}
|
|
15030
|
+
else {
|
|
15031
|
+
(_b = this.router) === null || _b === void 0 ? void 0 : _b.replace("" + location.pathname, undefined, {
|
|
15032
|
+
shallow: true,
|
|
15033
|
+
});
|
|
15034
|
+
}
|
|
15035
|
+
}
|
|
15036
|
+
return [2 /*return*/];
|
|
15037
|
+
}
|
|
15038
|
+
});
|
|
15039
|
+
}); };
|
|
15040
|
+
this.getInitial = function (queryParams) { return __awaiter(_this, void 0, void 0, function () {
|
|
15041
|
+
var fetchRequestTime, page, limit, response_1, data, err_1;
|
|
15042
|
+
return __generator(this, function (_a) {
|
|
15043
|
+
switch (_a.label) {
|
|
14323
15044
|
case 0:
|
|
14324
|
-
if (this._isLoading)
|
|
14325
|
-
return [2 /*return*/];
|
|
14326
15045
|
this._isLoading = true;
|
|
14327
|
-
|
|
15046
|
+
fetchRequestTime = Date.now();
|
|
15047
|
+
this._fetchRequestTime = fetchRequestTime;
|
|
15048
|
+
_a.label = 1;
|
|
14328
15049
|
case 1:
|
|
14329
|
-
|
|
14330
|
-
page =
|
|
15050
|
+
_a.trys.push([1, 5, 6, 7]);
|
|
15051
|
+
page = 1;
|
|
14331
15052
|
limit = this._limit;
|
|
15053
|
+
if (!(this.isFilterable && !this.filters)) return [3 /*break*/, 3];
|
|
15054
|
+
return [4 /*yield*/, this.getFilters()];
|
|
15055
|
+
case 2:
|
|
15056
|
+
_a.sent();
|
|
15057
|
+
_a.label = 3;
|
|
15058
|
+
case 3:
|
|
15059
|
+
this.applyQueryParamFilters(queryParams);
|
|
14332
15060
|
if (this.isStatic) {
|
|
14333
15061
|
page = undefined;
|
|
14334
15062
|
limit = undefined;
|
|
14335
15063
|
}
|
|
14336
15064
|
else if (this.isDiscounted) {
|
|
14337
|
-
// TODO use filter
|
|
14338
15065
|
page = 1;
|
|
14339
15066
|
limit = 10;
|
|
14340
15067
|
}
|
|
14341
15068
|
else if (this.isRecommended) {
|
|
14342
|
-
// TODO use filter
|
|
14343
15069
|
page = 1;
|
|
14344
15070
|
limit = 10;
|
|
14345
15071
|
}
|
|
14346
|
-
return [4 /*yield*/,
|
|
14347
|
-
|
|
14348
|
-
|
|
14349
|
-
|
|
14350
|
-
|
|
14351
|
-
|
|
14352
|
-
categoryIds: ((_c = this._filters) === null || _c === void 0 ? void 0 : _c.category) ? [this._filters.category]
|
|
14353
|
-
: undefined,
|
|
14354
|
-
})];
|
|
14355
|
-
case 2:
|
|
14356
|
-
response_1 = _d.sent();
|
|
14357
|
-
data_1 = [];
|
|
15072
|
+
return [4 /*yield*/, this.searchProducts(page || 1, limit || 10)];
|
|
15073
|
+
case 4:
|
|
15074
|
+
response_1 = _a.sent();
|
|
15075
|
+
if (!response_1 || this._fetchRequestTime !== fetchRequestTime)
|
|
15076
|
+
return [2 /*return*/];
|
|
15077
|
+
data = [];
|
|
14358
15078
|
if (this.isStatic) {
|
|
14359
|
-
|
|
14360
|
-
var product = response_1.
|
|
15079
|
+
data = this._productListPropValue.productIds.map(function (pID) {
|
|
15080
|
+
var product = response_1.data.find(function (p) { return p.id === pID.productId; });
|
|
14361
15081
|
var variant = product === null || product === void 0 ? void 0 : product.variants.find(function (v) { return v.id === pID.variantId; });
|
|
14362
15082
|
return new IkasProductDetail(product, variant.variantValues);
|
|
14363
15083
|
});
|
|
14364
15084
|
}
|
|
14365
15085
|
else {
|
|
14366
|
-
|
|
15086
|
+
data = response_1.data.map(function (product) {
|
|
14367
15087
|
return new IkasProductDetail(product, product.variants[0].variantValues);
|
|
14368
15088
|
});
|
|
14369
15089
|
}
|
|
14370
|
-
|
|
14371
|
-
|
|
14372
|
-
|
|
14373
|
-
|
|
14374
|
-
|
|
14375
|
-
|
|
14376
|
-
|
|
14377
|
-
|
|
14378
|
-
err_1 = _d.sent();
|
|
15090
|
+
this.data = data;
|
|
15091
|
+
this._count = response_1.count;
|
|
15092
|
+
this._initialized = true;
|
|
15093
|
+
this._page = page || 1;
|
|
15094
|
+
this._minPage = this.page;
|
|
15095
|
+
return [3 /*break*/, 7];
|
|
15096
|
+
case 5:
|
|
15097
|
+
err_1 = _a.sent();
|
|
14379
15098
|
console.log(err_1);
|
|
14380
|
-
return [3 /*break*/,
|
|
14381
|
-
case
|
|
14382
|
-
|
|
14383
|
-
|
|
14384
|
-
});
|
|
15099
|
+
return [3 /*break*/, 7];
|
|
15100
|
+
case 6:
|
|
15101
|
+
if (fetchRequestTime === this._fetchRequestTime)
|
|
15102
|
+
this._isLoading = false;
|
|
14385
15103
|
return [7 /*endfinally*/];
|
|
14386
|
-
case
|
|
15104
|
+
case 7: return [2 /*return*/];
|
|
14387
15105
|
}
|
|
14388
15106
|
});
|
|
14389
15107
|
}); };
|
|
14390
15108
|
this.getPrev = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
14391
|
-
var
|
|
14392
|
-
|
|
14393
|
-
|
|
14394
|
-
return __generator(this, function (_d) {
|
|
14395
|
-
switch (_d.label) {
|
|
15109
|
+
var minPage, response, data, err_2;
|
|
15110
|
+
return __generator(this, function (_a) {
|
|
15111
|
+
switch (_a.label) {
|
|
14396
15112
|
case 0:
|
|
14397
15113
|
if (this.isStatic ||
|
|
14398
15114
|
this.isDiscounted ||
|
|
@@ -14401,49 +15117,37 @@ var IkasProductList = /** @class */ (function () {
|
|
|
14401
15117
|
!this.hasPrev)
|
|
14402
15118
|
return [2 /*return*/];
|
|
14403
15119
|
this._isLoading = true;
|
|
14404
|
-
|
|
15120
|
+
_a.label = 1;
|
|
14405
15121
|
case 1:
|
|
14406
|
-
|
|
14407
|
-
|
|
14408
|
-
return [4 /*yield*/,
|
|
14409
|
-
idList: this.isStatic
|
|
14410
|
-
? (_a = this._productListPropValue.productIds) === null || _a === void 0 ? void 0 : _a.map(function (p) { return p.productId; }) : undefined,
|
|
14411
|
-
page: minPage_1,
|
|
14412
|
-
limit: this._limit,
|
|
14413
|
-
brandId: ((_b = this._filters) === null || _b === void 0 ? void 0 : _b.brand) ? this._filters.brand : undefined,
|
|
14414
|
-
categoryIds: ((_c = this._filters) === null || _c === void 0 ? void 0 : _c.category) ? [this._filters.category]
|
|
14415
|
-
: undefined,
|
|
14416
|
-
})];
|
|
15122
|
+
_a.trys.push([1, 3, 4, 5]);
|
|
15123
|
+
minPage = this._minPage - 1;
|
|
15124
|
+
return [4 /*yield*/, this.searchProducts(minPage, this.limit)];
|
|
14417
15125
|
case 2:
|
|
14418
|
-
|
|
14419
|
-
|
|
15126
|
+
response = _a.sent();
|
|
15127
|
+
if (!response)
|
|
15128
|
+
return [2 /*return*/];
|
|
15129
|
+
data = response.data.map(function (product) {
|
|
14420
15130
|
return new IkasProductDetail(product, product.variants[0].variantValues);
|
|
14421
15131
|
});
|
|
14422
|
-
|
|
14423
|
-
|
|
14424
|
-
|
|
14425
|
-
_this._minPage = minPage_1;
|
|
14426
|
-
});
|
|
15132
|
+
this.data = data.concat(this.data);
|
|
15133
|
+
this._count = response.count;
|
|
15134
|
+
this._minPage = minPage;
|
|
14427
15135
|
return [3 /*break*/, 5];
|
|
14428
15136
|
case 3:
|
|
14429
|
-
err_2 =
|
|
15137
|
+
err_2 = _a.sent();
|
|
14430
15138
|
console.log(err_2);
|
|
14431
15139
|
return [3 /*break*/, 5];
|
|
14432
15140
|
case 4:
|
|
14433
|
-
|
|
14434
|
-
_this._isLoading = false;
|
|
14435
|
-
});
|
|
15141
|
+
this._isLoading = false;
|
|
14436
15142
|
return [7 /*endfinally*/];
|
|
14437
15143
|
case 5: return [2 /*return*/];
|
|
14438
15144
|
}
|
|
14439
15145
|
});
|
|
14440
15146
|
}); };
|
|
14441
15147
|
this.getNext = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
14442
|
-
var
|
|
14443
|
-
|
|
14444
|
-
|
|
14445
|
-
return __generator(this, function (_c) {
|
|
14446
|
-
switch (_c.label) {
|
|
15148
|
+
var response, data, err_3;
|
|
15149
|
+
return __generator(this, function (_a) {
|
|
15150
|
+
switch (_a.label) {
|
|
14447
15151
|
case 0:
|
|
14448
15152
|
if (this.isStatic ||
|
|
14449
15153
|
this.isDiscounted ||
|
|
@@ -14452,46 +15156,36 @@ var IkasProductList = /** @class */ (function () {
|
|
|
14452
15156
|
!this.hasNext)
|
|
14453
15157
|
return [2 /*return*/];
|
|
14454
15158
|
this._isLoading = true;
|
|
14455
|
-
|
|
15159
|
+
_a.label = 1;
|
|
14456
15160
|
case 1:
|
|
14457
|
-
|
|
14458
|
-
return [4 /*yield*/,
|
|
14459
|
-
page: this.page + 1,
|
|
14460
|
-
limit: this.limit,
|
|
14461
|
-
brandId: ((_a = this._filters) === null || _a === void 0 ? void 0 : _a.brand) ? this._filters.brand : undefined,
|
|
14462
|
-
categoryIds: ((_b = this._filters) === null || _b === void 0 ? void 0 : _b.category) ? [this._filters.category]
|
|
14463
|
-
: undefined,
|
|
14464
|
-
})];
|
|
15161
|
+
_a.trys.push([1, 3, 4, 5]);
|
|
15162
|
+
return [4 /*yield*/, this.searchProducts(this.page + 1, this.limit)];
|
|
14465
15163
|
case 2:
|
|
14466
|
-
|
|
14467
|
-
|
|
15164
|
+
response = _a.sent();
|
|
15165
|
+
if (!response)
|
|
15166
|
+
return [2 /*return*/];
|
|
15167
|
+
data = response.data.map(function (product) {
|
|
14468
15168
|
return new IkasProductDetail(product, product.variants[0].variantValues);
|
|
14469
15169
|
});
|
|
14470
|
-
|
|
14471
|
-
|
|
14472
|
-
|
|
14473
|
-
_this._page = _this.page + 1;
|
|
14474
|
-
});
|
|
15170
|
+
this.data = this.data.concat(data);
|
|
15171
|
+
this._count = response.count;
|
|
15172
|
+
this._page = this.page + 1;
|
|
14475
15173
|
return [3 /*break*/, 5];
|
|
14476
15174
|
case 3:
|
|
14477
|
-
err_3 =
|
|
15175
|
+
err_3 = _a.sent();
|
|
14478
15176
|
console.log(err_3);
|
|
14479
15177
|
return [3 /*break*/, 5];
|
|
14480
15178
|
case 4:
|
|
14481
|
-
|
|
14482
|
-
_this._isLoading = false;
|
|
14483
|
-
});
|
|
15179
|
+
this._isLoading = false;
|
|
14484
15180
|
return [7 /*endfinally*/];
|
|
14485
15181
|
case 5: return [2 /*return*/];
|
|
14486
15182
|
}
|
|
14487
15183
|
});
|
|
14488
15184
|
}); };
|
|
14489
15185
|
this.getPage = function (page) { return __awaiter(_this, void 0, void 0, function () {
|
|
14490
|
-
var
|
|
14491
|
-
|
|
14492
|
-
|
|
14493
|
-
return __generator(this, function (_c) {
|
|
14494
|
-
switch (_c.label) {
|
|
15186
|
+
var response, data, err_4;
|
|
15187
|
+
return __generator(this, function (_a) {
|
|
15188
|
+
switch (_a.label) {
|
|
14495
15189
|
case 0:
|
|
14496
15190
|
if (this._isLoading ||
|
|
14497
15191
|
this.isStatic ||
|
|
@@ -14499,36 +15193,28 @@ var IkasProductList = /** @class */ (function () {
|
|
|
14499
15193
|
this.isRecommended)
|
|
14500
15194
|
return [2 /*return*/];
|
|
14501
15195
|
this._isLoading = true;
|
|
14502
|
-
|
|
15196
|
+
_a.label = 1;
|
|
14503
15197
|
case 1:
|
|
14504
|
-
|
|
14505
|
-
return [4 /*yield*/,
|
|
14506
|
-
page: this.page + 1,
|
|
14507
|
-
limit: this.limit,
|
|
14508
|
-
brandId: ((_a = this._filters) === null || _a === void 0 ? void 0 : _a.brand) ? this._filters.brand : undefined,
|
|
14509
|
-
categoryIds: ((_b = this._filters) === null || _b === void 0 ? void 0 : _b.category) ? [this._filters.category]
|
|
14510
|
-
: undefined,
|
|
14511
|
-
})];
|
|
15198
|
+
_a.trys.push([1, 3, 4, 5]);
|
|
15199
|
+
return [4 /*yield*/, this.searchProducts(page, this.limit)];
|
|
14512
15200
|
case 2:
|
|
14513
|
-
|
|
14514
|
-
|
|
15201
|
+
response = _a.sent();
|
|
15202
|
+
if (!response)
|
|
15203
|
+
return [2 /*return*/];
|
|
15204
|
+
data = response.data.map(function (product) {
|
|
14515
15205
|
return new IkasProductDetail(product, product.variants[0].variantValues);
|
|
14516
15206
|
});
|
|
14517
|
-
|
|
14518
|
-
|
|
14519
|
-
|
|
14520
|
-
|
|
14521
|
-
_this._minPage = page;
|
|
14522
|
-
});
|
|
15207
|
+
this.data = data;
|
|
15208
|
+
this._count = response.count;
|
|
15209
|
+
this._page = page;
|
|
15210
|
+
this._minPage = page;
|
|
14523
15211
|
return [3 /*break*/, 5];
|
|
14524
15212
|
case 3:
|
|
14525
|
-
err_4 =
|
|
15213
|
+
err_4 = _a.sent();
|
|
14526
15214
|
console.log(err_4);
|
|
14527
15215
|
return [3 /*break*/, 5];
|
|
14528
15216
|
case 4:
|
|
14529
|
-
|
|
14530
|
-
_this._isLoading = false;
|
|
14531
|
-
});
|
|
15217
|
+
this._isLoading = false;
|
|
14532
15218
|
return [7 /*endfinally*/];
|
|
14533
15219
|
case 5: return [2 /*return*/];
|
|
14534
15220
|
}
|
|
@@ -14548,12 +15234,21 @@ var IkasProductList = /** @class */ (function () {
|
|
|
14548
15234
|
this._limit = data.limit || data.productListPropValue.initialLimit || 20;
|
|
14549
15235
|
this._page = data.page || 1;
|
|
14550
15236
|
this._count = data.count || 0;
|
|
15237
|
+
this._searchKeyword = data.searchKeyword || "";
|
|
14551
15238
|
this._productListPropValue = data.productListPropValue;
|
|
14552
|
-
this.
|
|
14553
|
-
|
|
14554
|
-
: undefined;
|
|
15239
|
+
this._filterBrandId = data.filterBrandId || null;
|
|
15240
|
+
this._filterCategoryId = data.filterCategoryId || null;
|
|
14555
15241
|
this._recommendFor = data.recommendFor;
|
|
15242
|
+
this.filters = data.filters
|
|
15243
|
+
? data.filters.map(function (f) { return new IkasProductFilter(f); })
|
|
15244
|
+
: null;
|
|
15245
|
+
this.router = router;
|
|
14556
15246
|
makeAutoObservable(this);
|
|
15247
|
+
console.log("constructor");
|
|
15248
|
+
if (this.isBrowser() && location.search) {
|
|
15249
|
+
var queryParams = this.getQueryParams();
|
|
15250
|
+
this.getInitial(queryParams);
|
|
15251
|
+
}
|
|
14557
15252
|
}
|
|
14558
15253
|
Object.defineProperty(IkasProductList.prototype, "sort", {
|
|
14559
15254
|
get: function () {
|
|
@@ -14583,6 +15278,16 @@ var IkasProductList = /** @class */ (function () {
|
|
|
14583
15278
|
enumerable: false,
|
|
14584
15279
|
configurable: true
|
|
14585
15280
|
});
|
|
15281
|
+
Object.defineProperty(IkasProductList.prototype, "searchKeyword", {
|
|
15282
|
+
get: function () {
|
|
15283
|
+
return this._searchKeyword;
|
|
15284
|
+
},
|
|
15285
|
+
set: function (value) {
|
|
15286
|
+
this._searchKeyword = value;
|
|
15287
|
+
},
|
|
15288
|
+
enumerable: false,
|
|
15289
|
+
configurable: true
|
|
15290
|
+
});
|
|
14586
15291
|
Object.defineProperty(IkasProductList.prototype, "isInitialized", {
|
|
14587
15292
|
get: function () {
|
|
14588
15293
|
return this._initialized;
|
|
@@ -14590,6 +15295,22 @@ var IkasProductList = /** @class */ (function () {
|
|
|
14590
15295
|
enumerable: false,
|
|
14591
15296
|
configurable: true
|
|
14592
15297
|
});
|
|
15298
|
+
Object.defineProperty(IkasProductList.prototype, "isFilterable", {
|
|
15299
|
+
get: function () {
|
|
15300
|
+
return (this._type === IkasProductListType.ALL ||
|
|
15301
|
+
this._type === IkasProductListType.CATEGORY);
|
|
15302
|
+
},
|
|
15303
|
+
enumerable: false,
|
|
15304
|
+
configurable: true
|
|
15305
|
+
});
|
|
15306
|
+
Object.defineProperty(IkasProductList.prototype, "isFiltered", {
|
|
15307
|
+
get: function () {
|
|
15308
|
+
var _a;
|
|
15309
|
+
return (_a = this.filters) === null || _a === void 0 ? void 0 : _a.some(function (f) { return !!f.valueList.length; });
|
|
15310
|
+
},
|
|
15311
|
+
enumerable: false,
|
|
15312
|
+
configurable: true
|
|
15313
|
+
});
|
|
14593
15314
|
Object.defineProperty(IkasProductList.prototype, "isStatic", {
|
|
14594
15315
|
get: function () {
|
|
14595
15316
|
return this._type === IkasProductListType.STATIC;
|
|
@@ -14639,8 +15360,111 @@ var IkasProductList = /** @class */ (function () {
|
|
|
14639
15360
|
enumerable: false,
|
|
14640
15361
|
configurable: true
|
|
14641
15362
|
});
|
|
14642
|
-
IkasProductList.prototype
|
|
14643
|
-
|
|
15363
|
+
Object.defineProperty(IkasProductList.prototype, "filterQueryParams", {
|
|
15364
|
+
get: function () {
|
|
15365
|
+
var _a;
|
|
15366
|
+
var queryParams = {};
|
|
15367
|
+
(_a = this.filters) === null || _a === void 0 ? void 0 : _a.forEach(function (f) {
|
|
15368
|
+
queryParams[f.key] = f.keyList;
|
|
15369
|
+
});
|
|
15370
|
+
return queryString.stringify(queryParams, { arrayFormat: "comma" });
|
|
15371
|
+
},
|
|
15372
|
+
enumerable: false,
|
|
15373
|
+
configurable: true
|
|
15374
|
+
});
|
|
15375
|
+
IkasProductList.prototype.searchProducts = function (page, limit) {
|
|
15376
|
+
var _a, _b;
|
|
15377
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
15378
|
+
var filterList;
|
|
15379
|
+
return __generator(this, function (_c) {
|
|
15380
|
+
switch (_c.label) {
|
|
15381
|
+
case 0:
|
|
15382
|
+
filterList = [];
|
|
15383
|
+
if (this._filterBrandId) {
|
|
15384
|
+
filterList.push(new IkasProductFilterValue({
|
|
15385
|
+
id: this._filterBrandId,
|
|
15386
|
+
type: IkasProductFilterType.BRAND,
|
|
15387
|
+
valueList: [this._filterBrandId],
|
|
15388
|
+
}));
|
|
15389
|
+
}
|
|
15390
|
+
(_a = this.filters) === null || _a === void 0 ? void 0 : _a.forEach(function (filter) {
|
|
15391
|
+
if (filter.valueList.length) {
|
|
15392
|
+
filterList.push(new IkasProductFilterValue({
|
|
15393
|
+
id: filter.id,
|
|
15394
|
+
type: filter.type,
|
|
15395
|
+
valueList: filter.valueList,
|
|
15396
|
+
}));
|
|
15397
|
+
}
|
|
15398
|
+
});
|
|
15399
|
+
return [4 /*yield*/, IkasProductSearchAPI.searchProducts({
|
|
15400
|
+
page: page,
|
|
15401
|
+
perPage: limit,
|
|
15402
|
+
productIdList: this.isStatic
|
|
15403
|
+
? (_b = this._productListPropValue.productIds) === null || _b === void 0 ? void 0 : _b.map(function (p) { return p.productId; }) : undefined,
|
|
15404
|
+
filterList: filterList,
|
|
15405
|
+
categoryIdList: this._filterCategoryId
|
|
15406
|
+
? [this._filterCategoryId]
|
|
15407
|
+
: undefined,
|
|
15408
|
+
query: this._searchKeyword,
|
|
15409
|
+
})];
|
|
15410
|
+
case 1: return [2 /*return*/, _c.sent()];
|
|
15411
|
+
}
|
|
15412
|
+
});
|
|
15413
|
+
});
|
|
15414
|
+
};
|
|
15415
|
+
IkasProductList.prototype.clear = function () {
|
|
15416
|
+
var _a;
|
|
15417
|
+
(_a = this.filters) === null || _a === void 0 ? void 0 : _a.forEach(function (filter) { return filter.clear(); });
|
|
15418
|
+
this._searchKeyword = "";
|
|
15419
|
+
};
|
|
15420
|
+
IkasProductList.prototype.getFilters = function () {
|
|
15421
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
15422
|
+
var _a;
|
|
15423
|
+
return __generator(this, function (_b) {
|
|
15424
|
+
switch (_b.label) {
|
|
15425
|
+
case 0:
|
|
15426
|
+
_a = this;
|
|
15427
|
+
return [4 /*yield*/, IkasProductSearchAPI.getProductFilterData()];
|
|
15428
|
+
case 1:
|
|
15429
|
+
_a.filters = _b.sent();
|
|
15430
|
+
// this._filterCategoryId ? [this._filterCategoryId] : undefined
|
|
15431
|
+
if (this.filters)
|
|
15432
|
+
this.filters.sort(function (f1, f2) { return (f1.order > f2.order ? 1 : -1); });
|
|
15433
|
+
return [2 /*return*/];
|
|
15434
|
+
}
|
|
15435
|
+
});
|
|
15436
|
+
});
|
|
15437
|
+
};
|
|
15438
|
+
IkasProductList.prototype.applyQueryParamFilters = function (queryParams) {
|
|
15439
|
+
var _this = this;
|
|
15440
|
+
try {
|
|
15441
|
+
queryParams === null || queryParams === void 0 ? void 0 : queryParams.forEach(function (value, key) {
|
|
15442
|
+
var _a, _b, _c;
|
|
15443
|
+
var filter = (_a = _this.filters) === null || _a === void 0 ? void 0 : _a.find(function (f) { return f.key === key; });
|
|
15444
|
+
var valueKeys = value.split(",");
|
|
15445
|
+
if (filter) {
|
|
15446
|
+
if (filter.displayType === IkasProductFilterDisplayType.NUMBER_RANGE) {
|
|
15447
|
+
filter.numberRange = new RangeValue(parseRangeStr(value));
|
|
15448
|
+
}
|
|
15449
|
+
else if (filter.displayType ===
|
|
15450
|
+
IkasProductFilterDisplayType.NUMBER_RANGE_LIST) {
|
|
15451
|
+
(_b = filter.numberRangeListOptions) === null || _b === void 0 ? void 0 : _b.forEach(function (o) {
|
|
15452
|
+
if (valueKeys.includes(o.key))
|
|
15453
|
+
o.isSelected = true;
|
|
15454
|
+
});
|
|
15455
|
+
}
|
|
15456
|
+
else {
|
|
15457
|
+
(_c = filter.values) === null || _c === void 0 ? void 0 : _c.forEach(function (filterValue) {
|
|
15458
|
+
if (valueKeys.includes(filterValue.key))
|
|
15459
|
+
filterValue.isSelected = true;
|
|
15460
|
+
});
|
|
15461
|
+
}
|
|
15462
|
+
}
|
|
15463
|
+
});
|
|
15464
|
+
}
|
|
15465
|
+
catch (err) {
|
|
15466
|
+
console.log(err);
|
|
15467
|
+
}
|
|
14644
15468
|
};
|
|
14645
15469
|
IkasProductList.prototype.toJSON = function () {
|
|
14646
15470
|
return {
|
|
@@ -14650,13 +15474,24 @@ var IkasProductList = /** @class */ (function () {
|
|
|
14650
15474
|
limit: this._limit,
|
|
14651
15475
|
page: this._page,
|
|
14652
15476
|
count: this._count,
|
|
15477
|
+
searchKeyword: this._searchKeyword,
|
|
14653
15478
|
initialized: this._initialized,
|
|
14654
15479
|
minPage: this._minPage,
|
|
14655
|
-
|
|
15480
|
+
pageBrandId: this._filterBrandId,
|
|
15481
|
+
pageCategoryId: this._filterCategoryId,
|
|
15482
|
+
filters: this.filters,
|
|
14656
15483
|
recommendFor: this._recommendFor,
|
|
14657
15484
|
productListPropValue: this._productListPropValue,
|
|
14658
15485
|
};
|
|
14659
15486
|
};
|
|
15487
|
+
IkasProductList.prototype.getQueryParams = function () {
|
|
15488
|
+
if (!this.isBrowser())
|
|
15489
|
+
return;
|
|
15490
|
+
return new URLSearchParams(location.search);
|
|
15491
|
+
};
|
|
15492
|
+
IkasProductList.prototype.isBrowser = function () {
|
|
15493
|
+
return typeof window !== "undefined";
|
|
15494
|
+
};
|
|
14660
15495
|
return IkasProductList;
|
|
14661
15496
|
}());
|
|
14662
15497
|
var IkasProductListType;
|
|
@@ -19454,6 +20289,8 @@ var AddressForm = /** @class */ (function () {
|
|
|
19454
20289
|
this.store = props.store;
|
|
19455
20290
|
this.validator = new Validator(this.address, this.validatorRules());
|
|
19456
20291
|
this.listCountries();
|
|
20292
|
+
if (this.address.state)
|
|
20293
|
+
this.listStates();
|
|
19457
20294
|
if (this.address.country)
|
|
19458
20295
|
this.listCities();
|
|
19459
20296
|
if (this.address.city)
|
|
@@ -21908,7 +22745,7 @@ var IkasVariantTypeAPI = /** @class */ (function () {
|
|
|
21908
22745
|
id: vv.id,
|
|
21909
22746
|
name: vv.name,
|
|
21910
22747
|
colorCode: vv.colorCode,
|
|
21911
|
-
|
|
22748
|
+
thumbnailImageId: vv.thumbnailImageId,
|
|
21912
22749
|
variantTypeId: vt.id,
|
|
21913
22750
|
});
|
|
21914
22751
|
}),
|
|
@@ -22166,6 +23003,220 @@ var IkasProductAPI = /** @class */ (function () {
|
|
|
22166
23003
|
}());
|
|
22167
23004
|
var templateObject_1$d;
|
|
22168
23005
|
|
|
23006
|
+
var IkasProductSearchAPI = /** @class */ (function () {
|
|
23007
|
+
function IkasProductSearchAPI() {
|
|
23008
|
+
}
|
|
23009
|
+
IkasProductSearchAPI.searchProducts = function (input) {
|
|
23010
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
23011
|
+
var SEARCH_PRODUCTS, _a, data, errors, err_1;
|
|
23012
|
+
return __generator(this, function (_b) {
|
|
23013
|
+
switch (_b.label) {
|
|
23014
|
+
case 0:
|
|
23015
|
+
_b.trys.push([0, 2, , 3]);
|
|
23016
|
+
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 "])));
|
|
23017
|
+
return [4 /*yield*/, apollo
|
|
23018
|
+
.getClient()
|
|
23019
|
+
.query({
|
|
23020
|
+
query: SEARCH_PRODUCTS,
|
|
23021
|
+
variables: {
|
|
23022
|
+
input: input,
|
|
23023
|
+
},
|
|
23024
|
+
})];
|
|
23025
|
+
case 1:
|
|
23026
|
+
_a = _b.sent(), data = _a.data, errors = _a.errors;
|
|
23027
|
+
if (errors && errors.length) {
|
|
23028
|
+
console.log(errors);
|
|
23029
|
+
return [2 /*return*/];
|
|
23030
|
+
}
|
|
23031
|
+
return [2 /*return*/, __assign(__assign({}, data.searchProducts), { data: data.searchProducts.data.map(function (d) {
|
|
23032
|
+
return simpleToProduct(d);
|
|
23033
|
+
}) })];
|
|
23034
|
+
case 2:
|
|
23035
|
+
err_1 = _b.sent();
|
|
23036
|
+
console.log(err_1);
|
|
23037
|
+
return [3 /*break*/, 3];
|
|
23038
|
+
case 3: return [2 /*return*/];
|
|
23039
|
+
}
|
|
23040
|
+
});
|
|
23041
|
+
});
|
|
23042
|
+
};
|
|
23043
|
+
IkasProductSearchAPI.getProductFilterData = function (categoryIds) {
|
|
23044
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
23045
|
+
var QUERY, _a, data, errors, err_2;
|
|
23046
|
+
return __generator(this, function (_b) {
|
|
23047
|
+
switch (_b.label) {
|
|
23048
|
+
case 0:
|
|
23049
|
+
_b.trys.push([0, 2, , 3]);
|
|
23050
|
+
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 "])));
|
|
23051
|
+
return [4 /*yield*/, apollo
|
|
23052
|
+
.getClient()
|
|
23053
|
+
.query({
|
|
23054
|
+
query: QUERY,
|
|
23055
|
+
variables: {
|
|
23056
|
+
categoryIds: categoryIds || null,
|
|
23057
|
+
},
|
|
23058
|
+
})];
|
|
23059
|
+
case 1:
|
|
23060
|
+
_a = _b.sent(), data = _a.data, errors = _a.errors;
|
|
23061
|
+
if (errors && errors.length) {
|
|
23062
|
+
console.log(errors);
|
|
23063
|
+
return [2 /*return*/];
|
|
23064
|
+
}
|
|
23065
|
+
return [2 /*return*/, data.getProductFilterData.map(function (d) {
|
|
23066
|
+
var _a;
|
|
23067
|
+
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); }) }));
|
|
23068
|
+
})];
|
|
23069
|
+
case 2:
|
|
23070
|
+
err_2 = _b.sent();
|
|
23071
|
+
console.log(err_2);
|
|
23072
|
+
return [3 /*break*/, 3];
|
|
23073
|
+
case 3: return [2 /*return*/];
|
|
23074
|
+
}
|
|
23075
|
+
});
|
|
23076
|
+
});
|
|
23077
|
+
};
|
|
23078
|
+
return IkasProductSearchAPI;
|
|
23079
|
+
}());
|
|
23080
|
+
function simpleToProduct(simple) {
|
|
23081
|
+
var _a, _b, _c, _d, _e;
|
|
23082
|
+
return new IkasProduct({
|
|
23083
|
+
id: simple.id,
|
|
23084
|
+
attributes: (_a = simple.attributes) === null || _a === void 0 ? void 0 : _a.map(function (a) {
|
|
23085
|
+
var _a, _b, _c, _d, _e;
|
|
23086
|
+
return new IkasProductAttributeValue({
|
|
23087
|
+
value: a.value,
|
|
23088
|
+
productAttributeId: (_a = a.productAttribute) === null || _a === void 0 ? void 0 : _a.id,
|
|
23089
|
+
productAttributeOptionId: (_b = a.productAttributeOption) === null || _b === void 0 ? void 0 : _b.id,
|
|
23090
|
+
productAttribute: new IkasProductAttribute({
|
|
23091
|
+
id: (_c = a.productAttribute) === null || _c === void 0 ? void 0 : _c.id,
|
|
23092
|
+
name: (_d = a.productAttribute) === null || _d === void 0 ? void 0 : _d.name,
|
|
23093
|
+
type: (_e = a.productAttribute) === null || _e === void 0 ? void 0 : _e.type,
|
|
23094
|
+
}),
|
|
23095
|
+
productAttributeOption: a.productAttributeOption,
|
|
23096
|
+
});
|
|
23097
|
+
}),
|
|
23098
|
+
brand: new IkasBrand({
|
|
23099
|
+
id: (_b = simple.brand) === null || _b === void 0 ? void 0 : _b.id,
|
|
23100
|
+
name: (_c = simple.brand) === null || _c === void 0 ? void 0 : _c.name,
|
|
23101
|
+
metaData: new IkasHTMLMetaData({
|
|
23102
|
+
slug: ((_d = simple.brand) === null || _d === void 0 ? void 0 : _d.slug) || "",
|
|
23103
|
+
}),
|
|
23104
|
+
}),
|
|
23105
|
+
categories: (_e = simple.categories) === null || _e === void 0 ? void 0 : _e.map(function (c) {
|
|
23106
|
+
return new IkasCategory({
|
|
23107
|
+
id: c.id,
|
|
23108
|
+
name: c.name,
|
|
23109
|
+
path: c.path,
|
|
23110
|
+
metaData: new IkasHTMLMetaData({
|
|
23111
|
+
slug: c.slug || "",
|
|
23112
|
+
}),
|
|
23113
|
+
});
|
|
23114
|
+
}),
|
|
23115
|
+
description: simple.description || undefined,
|
|
23116
|
+
metaData: new IkasHTMLMetaData(simple.metaData || undefined),
|
|
23117
|
+
name: simple.name,
|
|
23118
|
+
shortDescription: simple.shortDescription || undefined,
|
|
23119
|
+
taxValue: simple.taxValue || undefined,
|
|
23120
|
+
type: simple.type || undefined,
|
|
23121
|
+
variantTypes: simple.productVariantTypes.map(function (pvt) {
|
|
23122
|
+
return new IkasProductVariantType({
|
|
23123
|
+
variantType: new IkasVariantType({
|
|
23124
|
+
id: pvt.variantType.id,
|
|
23125
|
+
name: pvt.variantType.name,
|
|
23126
|
+
selectionType: pvt.variantType.selectionType,
|
|
23127
|
+
values: pvt.variantType.values
|
|
23128
|
+
.map(function (v) {
|
|
23129
|
+
return new IkasVariantValue({
|
|
23130
|
+
id: v.id,
|
|
23131
|
+
colorCode: v.colorCode,
|
|
23132
|
+
name: v.name,
|
|
23133
|
+
thumbnailImageId: v.thumbnailImageId,
|
|
23134
|
+
variantTypeId: pvt.variantType.id,
|
|
23135
|
+
});
|
|
23136
|
+
})
|
|
23137
|
+
.filter(function (v) { return pvt.variantValueIds.includes(v.id); }),
|
|
23138
|
+
}),
|
|
23139
|
+
variantValueIds: pvt.variantValueIds,
|
|
23140
|
+
});
|
|
23141
|
+
}),
|
|
23142
|
+
variants: simple.variants.map(function (v) {
|
|
23143
|
+
var _a, _b, _c, _d;
|
|
23144
|
+
return new IkasProductVariant({
|
|
23145
|
+
id: v.id,
|
|
23146
|
+
attributes: (_a = v.attributes) === null || _a === void 0 ? void 0 : _a.map(function (a) {
|
|
23147
|
+
var _a, _b, _c, _d, _e;
|
|
23148
|
+
return new IkasProductAttributeValue({
|
|
23149
|
+
value: a.value,
|
|
23150
|
+
productAttributeId: (_a = a.productAttribute) === null || _a === void 0 ? void 0 : _a.id,
|
|
23151
|
+
productAttributeOptionId: (_b = a.productAttributeOption) === null || _b === void 0 ? void 0 : _b.id,
|
|
23152
|
+
productAttribute: new IkasProductAttribute({
|
|
23153
|
+
id: (_c = a.productAttribute) === null || _c === void 0 ? void 0 : _c.id,
|
|
23154
|
+
name: (_d = a.productAttribute) === null || _d === void 0 ? void 0 : _d.name,
|
|
23155
|
+
type: (_e = a.productAttribute) === null || _e === void 0 ? void 0 : _e.type,
|
|
23156
|
+
}),
|
|
23157
|
+
productAttributeOption: a.productAttributeOption,
|
|
23158
|
+
});
|
|
23159
|
+
}),
|
|
23160
|
+
sku: v.sku,
|
|
23161
|
+
barcodeList: v.barcodeList || undefined,
|
|
23162
|
+
images: (_b = v.images) === null || _b === void 0 ? void 0 : _b.map(function (i) { return new IkasImage(i.id); }),
|
|
23163
|
+
price: new IkasProductPrice((_c = v.prices) === null || _c === void 0 ? void 0 : _c.find(function (p) { return p.priceListId === null; })),
|
|
23164
|
+
stock: v.stocks.length ? v.stocks[0].stockCount : 0,
|
|
23165
|
+
variantValues: (_d = v.variantValues) === null || _d === void 0 ? void 0 : _d.map(function (vv) {
|
|
23166
|
+
var _a;
|
|
23167
|
+
var variantValue = (_a = simple.productVariantTypes
|
|
23168
|
+
.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; });
|
|
23169
|
+
return new IkasVariantValue({
|
|
23170
|
+
id: vv.variantValueId,
|
|
23171
|
+
name: variantValue === null || variantValue === void 0 ? void 0 : variantValue.name,
|
|
23172
|
+
colorCode: variantValue === null || variantValue === void 0 ? void 0 : variantValue.colorCode,
|
|
23173
|
+
thumbnailImageId: variantValue === null || variantValue === void 0 ? void 0 : variantValue.thumbnailImageId,
|
|
23174
|
+
});
|
|
23175
|
+
}),
|
|
23176
|
+
});
|
|
23177
|
+
}),
|
|
23178
|
+
});
|
|
23179
|
+
}
|
|
23180
|
+
var templateObject_1$e, templateObject_2$4;
|
|
23181
|
+
// type SearchInput = {
|
|
23182
|
+
// categoryIdList: string[] | null;
|
|
23183
|
+
// filterList: SearchInputFilter[] | null;
|
|
23184
|
+
// order: SearchInputOrder[] | null;
|
|
23185
|
+
// page: number | null;
|
|
23186
|
+
// perPage: number | null;
|
|
23187
|
+
// priceListId: string | null;
|
|
23188
|
+
// productId: string | null;
|
|
23189
|
+
// query: string | null;
|
|
23190
|
+
// slug: string | null;
|
|
23191
|
+
// };
|
|
23192
|
+
// type SearchInputFilter = {
|
|
23193
|
+
// id: string;
|
|
23194
|
+
// type: ProductFilterType;
|
|
23195
|
+
// valueList: string[];
|
|
23196
|
+
// };
|
|
23197
|
+
// export type SearchInputOrder = {
|
|
23198
|
+
// direction: SortByDirection;
|
|
23199
|
+
// type: SortByType;
|
|
23200
|
+
// };
|
|
23201
|
+
// enum SortByDirection {
|
|
23202
|
+
// ASC = "ASC",
|
|
23203
|
+
// DESC = "DESC",
|
|
23204
|
+
// }
|
|
23205
|
+
// enum SortByType {
|
|
23206
|
+
// CREATED_AT = "CREATED_AT",
|
|
23207
|
+
// DISCOUNT_RATIO = "DISCOUNT_RATIO",
|
|
23208
|
+
// PRICE = "PRICE",
|
|
23209
|
+
// }
|
|
23210
|
+
// export enum ProductFilterType {
|
|
23211
|
+
// ATTRIBUTE = "ATTRIBUTE",
|
|
23212
|
+
// BRAND = "BRAND",
|
|
23213
|
+
// DISCOUNT_RATIO = "DISCOUNT_RATIO",
|
|
23214
|
+
// PRICE = "PRICE",
|
|
23215
|
+
// STOCK_STATUS = "STOCK_STATUS",
|
|
23216
|
+
// TAG = "TAG",
|
|
23217
|
+
// VARIANT_TYPE = "VARIANT_TYPE",
|
|
23218
|
+
// }
|
|
23219
|
+
|
|
22169
23220
|
var IkasProductAttributeAPI = /** @class */ (function () {
|
|
22170
23221
|
function IkasProductAttributeAPI() {
|
|
22171
23222
|
}
|
|
@@ -22175,7 +23226,7 @@ var IkasProductAttributeAPI = /** @class */ (function () {
|
|
|
22175
23226
|
return __generator(this, function (_b) {
|
|
22176
23227
|
switch (_b.label) {
|
|
22177
23228
|
case 0:
|
|
22178
|
-
LIST_PRODUCT_ATTRIBUTES = src(templateObject_1$
|
|
23229
|
+
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 "])));
|
|
22179
23230
|
_b.label = 1;
|
|
22180
23231
|
case 1:
|
|
22181
23232
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -22208,7 +23259,7 @@ var IkasProductAttributeAPI = /** @class */ (function () {
|
|
|
22208
23259
|
};
|
|
22209
23260
|
return IkasProductAttributeAPI;
|
|
22210
23261
|
}());
|
|
22211
|
-
var templateObject_1$
|
|
23262
|
+
var templateObject_1$f;
|
|
22212
23263
|
|
|
22213
23264
|
var IkasStateAPI = /** @class */ (function () {
|
|
22214
23265
|
function IkasStateAPI() {
|
|
@@ -22219,7 +23270,7 @@ var IkasStateAPI = /** @class */ (function () {
|
|
|
22219
23270
|
return __generator(this, function (_b) {
|
|
22220
23271
|
switch (_b.label) {
|
|
22221
23272
|
case 0:
|
|
22222
|
-
QUERY = src(templateObject_1$
|
|
23273
|
+
QUERY = src(templateObject_1$g || (templateObject_1$g = __makeTemplateObject(["\n query listState($countryId: StringFilterInput!) {\n listState(countryId: $countryId) {\n id\n name\n stateCode\n }\n }\n "], ["\n query listState($countryId: StringFilterInput!) {\n listState(countryId: $countryId) {\n id\n name\n stateCode\n }\n }\n "])));
|
|
22223
23274
|
_b.label = 1;
|
|
22224
23275
|
case 1:
|
|
22225
23276
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -22256,7 +23307,7 @@ var IkasStateAPI = /** @class */ (function () {
|
|
|
22256
23307
|
};
|
|
22257
23308
|
return IkasStateAPI;
|
|
22258
23309
|
}());
|
|
22259
|
-
var templateObject_1$
|
|
23310
|
+
var templateObject_1$g;
|
|
22260
23311
|
|
|
22261
23312
|
var IkasStorefrontDomain = /** @class */ (function () {
|
|
22262
23313
|
function IkasStorefrontDomain(data) {
|
|
@@ -22349,7 +23400,7 @@ var IkasStorefrontAPI = /** @class */ (function () {
|
|
|
22349
23400
|
return __generator(this, function (_b) {
|
|
22350
23401
|
switch (_b.label) {
|
|
22351
23402
|
case 0:
|
|
22352
|
-
QUERY = src(templateObject_1$
|
|
23403
|
+
QUERY = src(templateObject_1$h || (templateObject_1$h = __makeTemplateObject(["\n query getStorefront($storefrontId: String!) {\n getStorefront(id: $storefrontId) {\n id\n name\n themeId\n themeVersionId\n userId\n # domains {\n # id\n # merchantDomainId\n # name\n # redirectDomainName\n # }\n regions {\n id\n locale\n # themeJSON\n privacyPolicy\n returnPolicy\n termsOfService\n }\n }\n }\n "], ["\n query getStorefront($storefrontId: String!) {\n getStorefront(id: $storefrontId) {\n id\n name\n themeId\n themeVersionId\n userId\n # domains {\n # id\n # merchantDomainId\n # name\n # redirectDomainName\n # }\n regions {\n id\n locale\n # themeJSON\n privacyPolicy\n returnPolicy\n termsOfService\n }\n }\n }\n "])));
|
|
22353
23404
|
_b.label = 1;
|
|
22354
23405
|
case 1:
|
|
22355
23406
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -22379,7 +23430,7 @@ var IkasStorefrontAPI = /** @class */ (function () {
|
|
|
22379
23430
|
};
|
|
22380
23431
|
return IkasStorefrontAPI;
|
|
22381
23432
|
}());
|
|
22382
|
-
var templateObject_1$
|
|
23433
|
+
var templateObject_1$h;
|
|
22383
23434
|
|
|
22384
23435
|
var IkasThemeAPI = /** @class */ (function () {
|
|
22385
23436
|
function IkasThemeAPI() {
|
|
@@ -22798,6 +23849,7 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
22798
23849
|
lines = this.cart.items.map(function (i) { return ({
|
|
22799
23850
|
quantity: i.quantity,
|
|
22800
23851
|
variantId: i.variant.id,
|
|
23852
|
+
productId: i.variant.productId,
|
|
22801
23853
|
}); });
|
|
22802
23854
|
return [4 /*yield*/, IkasCheckoutAPI.checkStocks(lines)];
|
|
22803
23855
|
case 1:
|
|
@@ -25007,6 +26059,8 @@ var IkasPageHead = observer(function (_a) {
|
|
|
25007
26059
|
var page = _a.page, pageTitle = _a.pageTitle, description = _a.description, pageSpecificDataStr = _a.pageSpecificDataStr, props = __rest(_a, ["page", "pageTitle", "description", "pageSpecificDataStr"]);
|
|
25008
26060
|
var ogpMetas = [];
|
|
25009
26061
|
var schemas = [];
|
|
26062
|
+
var isCanonicalLinkAdd = false;
|
|
26063
|
+
var canonicalHref = "";
|
|
25010
26064
|
if (props.addOgpMetas) {
|
|
25011
26065
|
ogpMetas.push({
|
|
25012
26066
|
property: "og:type",
|
|
@@ -25065,7 +26119,15 @@ var IkasPageHead = observer(function (_a) {
|
|
|
25065
26119
|
schemas.push(storeSchema);
|
|
25066
26120
|
}
|
|
25067
26121
|
if (pageSpecificDataStr && (page === null || page === void 0 ? void 0 : page.type) === IkasThemePageType.PRODUCT) {
|
|
25068
|
-
var
|
|
26122
|
+
var productDetailParsed = JSON.parse(pageSpecificDataStr);
|
|
26123
|
+
var productDetail = new IkasProductDetail(productDetailParsed.product, productDetailParsed.selectedVariantValues);
|
|
26124
|
+
if (typeof window !== "undefined" && productDetail.product.hasVariant) {
|
|
26125
|
+
isCanonicalLinkAdd =
|
|
26126
|
+
window.location.pathname !== productDetail.product.href;
|
|
26127
|
+
canonicalHref =
|
|
26128
|
+
"https://" + window.location.hostname + productDetail.product.href;
|
|
26129
|
+
}
|
|
26130
|
+
var schema = createProductSchema(productDetail);
|
|
25069
26131
|
if (schema)
|
|
25070
26132
|
schemas.push(schema);
|
|
25071
26133
|
}
|
|
@@ -25082,6 +26144,7 @@ var IkasPageHead = observer(function (_a) {
|
|
|
25082
26144
|
return (createElement(Head, null,
|
|
25083
26145
|
createElement("title", null, pageTitle || ""),
|
|
25084
26146
|
createElement("meta", { name: "description", content: description || "" }),
|
|
26147
|
+
isCanonicalLinkAdd && createElement("link", { rel: "canonical", href: canonicalHref }),
|
|
25085
26148
|
!!props.addOgpMetas &&
|
|
25086
26149
|
ogpMetas.map(function (ogpMeta, index) { return (createElement("meta", { key: ogpMeta.content + "-" + index, property: ogpMeta.property, content: ogpMeta.content })); }),
|
|
25087
26150
|
!!schemas.length &&
|
|
@@ -25115,11 +26178,9 @@ function createStoreSchema(merchantSettings) {
|
|
|
25115
26178
|
url: "https://" + hostname,
|
|
25116
26179
|
};
|
|
25117
26180
|
}
|
|
25118
|
-
function createProductSchema(
|
|
26181
|
+
function createProductSchema(productDetail) {
|
|
25119
26182
|
var _a;
|
|
25120
26183
|
try {
|
|
25121
|
-
var productDetailParsed = JSON.parse(pageSpecificDataStr);
|
|
25122
|
-
var productDetail = new IkasProductDetail(productDetailParsed.product, productDetailParsed.selectedVariantValues);
|
|
25123
26184
|
var isBrowser = typeof window !== "undefined";
|
|
25124
26185
|
if (isBrowser) {
|
|
25125
26186
|
var urlParams = new URLSearchParams(window.location.search);
|
|
@@ -25305,7 +26366,7 @@ var IkasCheckoutPage = observer(function (_a) {
|
|
|
25305
26366
|
createElement("div", null,
|
|
25306
26367
|
createElement("div", { className: styles$2.Header },
|
|
25307
26368
|
createElement("a", { href: "/" }, !!((_c = vm.merchantSettings) === null || _c === void 0 ? void 0 : _c.logoId) ? (createElement("div", { className: styles$2.Logo },
|
|
25308
|
-
createElement(Image, { layout: "fill", src: vm.merchantSettings.logo.src, quality: 100 }))) : (((_d = vm.merchantSettings) === null || _d === void 0 ? void 0 : _d.merchantName) || ""))),
|
|
26369
|
+
createElement(Image$1, { layout: "fill", src: vm.merchantSettings.logo.src, quality: 100 }))) : (((_d = vm.merchantSettings) === null || _d === void 0 ? void 0 : _d.merchantName) || ""))),
|
|
25309
26370
|
vm.step !== CheckoutStep.SUCCESS && createElement(Breadcrumbs, { vm: vm }),
|
|
25310
26371
|
!!vm.error && renderError(),
|
|
25311
26372
|
createElement("div", { className: styles$2.MobileCartSummary },
|
|
@@ -25823,6 +26884,10 @@ var pageStyle$1 = {
|
|
|
25823
26884
|
justifyContent: "space-between",
|
|
25824
26885
|
};
|
|
25825
26886
|
|
|
26887
|
+
var Image = function (props) {
|
|
26888
|
+
return createElement(Image$1, __assign({}, props, { unoptimized: true, quality: 100 }));
|
|
26889
|
+
};
|
|
26890
|
+
|
|
25826
26891
|
var GTMHead = function (_a) {
|
|
25827
26892
|
var blockHTML = _a.blockHTML;
|
|
25828
26893
|
var gtmId = process.env.GTM_ID;
|
|
@@ -25851,6 +26916,7 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
25851
26916
|
IkasPage: IkasPage,
|
|
25852
26917
|
IkasPageHead: IkasPageHead,
|
|
25853
26918
|
IkasPageEditor: IkasPageEditor,
|
|
26919
|
+
Image: Image,
|
|
25854
26920
|
GTMHead: GTMHead,
|
|
25855
26921
|
GTMBody: GTMBody,
|
|
25856
26922
|
GTMPageView: GTMPageView,
|
|
@@ -25895,7 +26961,8 @@ var Page$1 = function (_a) {
|
|
|
25895
26961
|
var page = _a.page, pageSpecificDataStr = _a.pageSpecificDataStr, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr, merchantSettings = _a.merchantSettings;
|
|
25896
26962
|
var router = useRouter();
|
|
25897
26963
|
var _b = useState(false), isBrowser = _b[0], setIsBrowser = _b[1];
|
|
25898
|
-
var
|
|
26964
|
+
var initialPropValues = useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router); }, [propValuesStr]);
|
|
26965
|
+
var _c = useState(initialPropValues), propValues = _c[0], setPropValues = _c[1];
|
|
25899
26966
|
useEffect(function () {
|
|
25900
26967
|
setIsBrowser(typeof window !== "undefined");
|
|
25901
26968
|
}, []);
|
|
@@ -26380,4 +27447,4 @@ var IkasBaseStore = /** @class */ (function () {
|
|
|
26380
27447
|
return IkasBaseStore;
|
|
26381
27448
|
}());
|
|
26382
27449
|
|
|
26383
|
-
export { AccountInfoForm, index$3 as AccountPage, AddressForm, addresses as AddressesPage, cart as CartPage, _id_$1 as CheckoutPage, _slug_ as CustomPage, editor$1 as EditorPage, EmailRule, EqualsRule, ForgotPasswordForm, forgotPassword as ForgotPasswordPage, GTMAddToCart, GTMBeginCheckout, GTMBody, GTMCheckoutStep, GTMDisableHTML, GTMHead, GTMPageView, GTMProductView, GTMPurchase, GTMRemoveFromCart, IkasAmountTypeEnum$1 as IkasAmountTypeEnum, IkasBaseStore, IkasBrand, IkasBrandAPI, IkasBrandList, IkasBrandListPropValue, IkasBrandListSortType, IkasBrandListType, IkasBrandPropValue, IkasCardAssociation, IkasCardType, IkasCartAPI, IkasCategory, IkasCategoryAPI, IkasCategoryList, IkasCategoryListPropValue, IkasCategoryListSortType, IkasCategoryListType, IkasCategoryPropValue, IkasCheckout, IkasCheckoutAPI, IkasCheckoutPage, IkasCheckoutRecoveryEmailStatus, IkasCheckoutRecoveryStatus, IkasCheckoutStatus, IkasCityAPI, IkasCountryAPI, IkasCustomer, IkasCustomerAPI, IkasCustomerAddress, IkasDistrictAPI, IkasHTMLMetaData, IkasHTMLMetaDataAPI, IkasHTMLMetaDataTargetType, IkasImage, IkasLinkPropValue, IkasLinkType, IkasMerchantAPI, IkasMerchantSettings, IkasNavigationLink, IkasOrder, IkasOrderCancelledReason, IkasOrderLineItem, IkasOrderPackageFulfillStatus, IkasOrderPackageStatus, IkasOrderPaymentStatus, IkasOrderShippingMethod, IkasOrderStatus, IkasOrderTransaction, IkasPage, IkasPageComponentPropValue, IkasPageDataProvider, IkasPageEditor, IkasPageHead, IkasPaymentMethod, IkasProduct, IkasProductAPI, IkasProductAttribute, IkasProductAttributeAPI, IkasProductAttributeValue, IkasProductDetail, IkasProductDetailPropValue,
|
|
27450
|
+
export { AccountInfoForm, index$3 as AccountPage, AddressForm, addresses as AddressesPage, cart as CartPage, _id_$1 as CheckoutPage, _slug_ as CustomPage, editor$1 as EditorPage, EmailRule, EqualsRule, ForgotPasswordForm, forgotPassword as ForgotPasswordPage, GTMAddToCart, GTMBeginCheckout, GTMBody, GTMCheckoutStep, GTMDisableHTML, GTMHead, GTMPageView, GTMProductView, GTMPurchase, GTMRemoveFromCart, IkasAmountTypeEnum$1 as IkasAmountTypeEnum, IkasApplicableProductFilterValue, IkasBaseStore, IkasBrand, IkasBrandAPI, IkasBrandList, IkasBrandListPropValue, IkasBrandListSortType, IkasBrandListType, IkasBrandPropValue, IkasCardAssociation, IkasCardType, IkasCartAPI, IkasCategory, IkasCategoryAPI, IkasCategoryList, IkasCategoryListPropValue, IkasCategoryListSortType, IkasCategoryListType, IkasCategoryPropValue, IkasCheckout, IkasCheckoutAPI, IkasCheckoutPage, IkasCheckoutRecoveryEmailStatus, IkasCheckoutRecoveryStatus, IkasCheckoutStatus, IkasCityAPI, IkasCountryAPI, IkasCustomer, IkasCustomerAPI, IkasCustomerAddress, IkasDistrictAPI, IkasHTMLMetaData, IkasHTMLMetaDataAPI, IkasHTMLMetaDataTargetType, IkasImage, IkasLinkPropValue, IkasLinkType, IkasMerchantAPI, IkasMerchantSettings, IkasNavigationLink, IkasOrder, IkasOrderCancelledReason, IkasOrderLineItem, IkasOrderPackageFulfillStatus, IkasOrderPackageStatus, IkasOrderPaymentStatus, IkasOrderShippingMethod, IkasOrderStatus, IkasOrderTransaction, IkasPage, IkasPageComponentPropValue, IkasPageDataProvider, IkasPageEditor, IkasPageHead, IkasPaymentMethod, IkasProduct, IkasProductAPI, IkasProductAttribute, IkasProductAttributeAPI, IkasProductAttributeValue, IkasProductDetail, IkasProductDetailPropValue, IkasProductFilter, IkasProductFilterDisplayType, IkasProductFilterType, IkasProductFilterValue, IkasProductList, IkasProductListPropValue, IkasProductListSortType, IkasProductListType, IkasProductPrice, IkasProductSearchAPI, IkasProductType, IkasProductVariant, IkasProductVariantType, IkasShippingMethod, IkasShippingMethodEnum, IkasStateAPI, IkasStorefrontAPI, IkasStorefrontConfig, IkasTheme, IkasThemeAPI, IkasThemeComponent, IkasThemeComponentProp, IkasThemeComponentPropType, IkasThemeCustomData, IkasThemeCustomDataType, IkasThemePage, IkasThemePageComponent, IkasThemePageType, IkasThemeSettings, IkasTransactionStatusEnum, IkasTransactionTypeEnum, IkasVariantSelectionType, IkasVariantType, IkasVariantTypeAPI, IkasVariantValue, Image, home as IndexPage, LessThanRule, LoginForm, login as LoginPage, MaxRule, MinRule, _id_$2 as OrderDetailPage, index$4 as OrdersPage, PhoneRule, RangeValue, RecoverPasswordForm, recoverPassword as RecoverPasswordPage, RegisterForm, register as RegisterPage, RequiredRule, index$2 as SlugPage, ValidationRule, Validator, ValidatorErrorType, apollo, decodeBase64, formatMoney, parseRangeStr, pascalCase, stringToSlug, validatePhoneNumber };
|