@ikas/storefront 0.0.8 → 0.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.js CHANGED
@@ -11655,8 +11655,8 @@ var IkasBrandPropValueProvider = /** @class */ (function () {
11655
11655
  }());
11656
11656
 
11657
11657
  var IkasLinkPropValueProvider = /** @class */ (function () {
11658
- function IkasLinkPropValueProvider(prop, theme) {
11659
- this.linkPropValue = prop;
11658
+ function IkasLinkPropValueProvider(linkPropValue, theme) {
11659
+ this.linkPropValue = linkPropValue;
11660
11660
  this.theme = theme;
11661
11661
  }
11662
11662
  IkasLinkPropValueProvider.prototype.getNavigationLink = function (linkPropValue) {
@@ -11781,6 +11781,122 @@ var IkasNavigationLink = /** @class */ (function () {
11781
11781
  return IkasNavigationLink;
11782
11782
  }());
11783
11783
 
11784
+ var IkasImageListPropValueProvider = /** @class */ (function () {
11785
+ function IkasImageListPropValueProvider(imageListPropValue) {
11786
+ this.imageListPropValue = imageListPropValue;
11787
+ }
11788
+ IkasImageListPropValueProvider.prototype.getValue = function () {
11789
+ return __awaiter(this, void 0, void 0, function () {
11790
+ return __generator(this, function (_a) {
11791
+ return [2 /*return*/, this.imageListPropValue.map(function (i) { return new IkasImage(i); })];
11792
+ });
11793
+ });
11794
+ };
11795
+ return IkasImageListPropValueProvider;
11796
+ }());
11797
+
11798
+ var IkasTextPropValueProvider = /** @class */ (function () {
11799
+ function IkasTextPropValueProvider(textPropValue) {
11800
+ this.text = textPropValue;
11801
+ }
11802
+ IkasTextPropValueProvider.prototype.getValue = function () {
11803
+ return __awaiter(this, void 0, void 0, function () {
11804
+ return __generator(this, function (_a) {
11805
+ return [2 /*return*/, this.text];
11806
+ });
11807
+ });
11808
+ };
11809
+ return IkasTextPropValueProvider;
11810
+ }());
11811
+
11812
+ var IkasBooleanPropValueProvider = /** @class */ (function () {
11813
+ function IkasBooleanPropValueProvider(textPropValue) {
11814
+ this.bool = textPropValue;
11815
+ }
11816
+ IkasBooleanPropValueProvider.prototype.getValue = function () {
11817
+ return __awaiter(this, void 0, void 0, function () {
11818
+ return __generator(this, function (_a) {
11819
+ return [2 /*return*/, this.bool];
11820
+ });
11821
+ });
11822
+ };
11823
+ return IkasBooleanPropValueProvider;
11824
+ }());
11825
+
11826
+ var IkasImagePropValueProvider = /** @class */ (function () {
11827
+ function IkasImagePropValueProvider(imagePropValue) {
11828
+ this.imagePropValue = imagePropValue;
11829
+ }
11830
+ IkasImagePropValueProvider.prototype.getValue = function () {
11831
+ return __awaiter(this, void 0, void 0, function () {
11832
+ return __generator(this, function (_a) {
11833
+ return [2 /*return*/, new IkasImage(this.imagePropValue)];
11834
+ });
11835
+ });
11836
+ };
11837
+ return IkasImagePropValueProvider;
11838
+ }());
11839
+
11840
+ var IkasCategoryPropValueProvider = /** @class */ (function () {
11841
+ function IkasCategoryPropValueProvider(prop, pageSpecificData) {
11842
+ this.categoryPropValue = prop;
11843
+ this.pageSpecificData = pageSpecificData;
11844
+ }
11845
+ IkasCategoryPropValueProvider.prototype.getValue = function () {
11846
+ return __awaiter(this, void 0, void 0, function () {
11847
+ var response, category, err_1;
11848
+ return __generator(this, function (_a) {
11849
+ switch (_a.label) {
11850
+ case 0:
11851
+ if (this.categoryPropValue.usePageData) {
11852
+ return [2 /*return*/, this.pageSpecificData];
11853
+ }
11854
+ _a.label = 1;
11855
+ case 1:
11856
+ _a.trys.push([1, 3, , 4]);
11857
+ return [4 /*yield*/, IkasCategoryAPI.listCategories({
11858
+ idList: [this.categoryPropValue.categoryId],
11859
+ })];
11860
+ case 2:
11861
+ response = _a.sent();
11862
+ category = response.categories[0];
11863
+ return [2 /*return*/, new IkasCategory(category)];
11864
+ case 3:
11865
+ err_1 = _a.sent();
11866
+ console.log(err_1);
11867
+ return [3 /*break*/, 4];
11868
+ case 4: return [2 /*return*/, new IkasCategory({})];
11869
+ }
11870
+ });
11871
+ });
11872
+ };
11873
+ return IkasCategoryPropValueProvider;
11874
+ }());
11875
+
11876
+ var IkasCategoryListPropValueProvider = /** @class */ (function () {
11877
+ function IkasCategoryListPropValueProvider(categoryListPropValue) {
11878
+ this.categoryListPropValue = categoryListPropValue;
11879
+ }
11880
+ IkasCategoryListPropValueProvider.prototype.getValue = function () {
11881
+ return __awaiter(this, void 0, void 0, function () {
11882
+ var categoryList;
11883
+ return __generator(this, function (_a) {
11884
+ switch (_a.label) {
11885
+ case 0:
11886
+ categoryList = new IkasCategoryList({
11887
+ categoryListPropValue: this.categoryListPropValue,
11888
+ });
11889
+ return [4 /*yield*/, categoryList.getInitial()];
11890
+ case 1:
11891
+ _a.sent();
11892
+ return [2 /*return*/, categoryList];
11893
+ }
11894
+ });
11895
+ });
11896
+ };
11897
+ return IkasCategoryListPropValueProvider;
11898
+ }());
11899
+
11784
11900
  var IkasPageDataProvider = /** @class */ (function () {
11785
11901
  function IkasPageDataProvider(theme, pageParams, pageType) {
11786
11902
  this.pageType = null;
@@ -12015,10 +12131,17 @@ var IkasPageDataProvider = /** @class */ (function () {
12015
12131
  return [2 /*return*/, null];
12016
12132
  switch (prop.type) {
12017
12133
  case exports.IkasThemeComponentPropType.TEXT:
12134
+ propValueProvider = new IkasTextPropValueProvider(propValue);
12135
+ break;
12018
12136
  case exports.IkasThemeComponentPropType.BOOLEAN:
12019
- return [2 /*return*/, propValue];
12137
+ propValueProvider = new IkasBooleanPropValueProvider(propValue);
12138
+ break;
12020
12139
  case exports.IkasThemeComponentPropType.IMAGE:
12021
- return [2 /*return*/, new IkasImage(propValue)];
12140
+ propValueProvider = new IkasImagePropValueProvider(propValue);
12141
+ break;
12142
+ case exports.IkasThemeComponentPropType.IMAGE_LIST:
12143
+ propValueProvider = new IkasImageListPropValueProvider(propValue);
12144
+ break;
12022
12145
  case exports.IkasThemeComponentPropType.BRAND:
12023
12146
  propValueProvider = new IkasBrandPropValueProvider(propValue, this.pageSpecificData);
12024
12147
  break;
@@ -12031,6 +12154,12 @@ var IkasPageDataProvider = /** @class */ (function () {
12031
12154
  case exports.IkasThemeComponentPropType.PRODUCT_DETAIL:
12032
12155
  propValueProvider = new IkasProductDetailPropValueProvider(propValue, this.pageSpecificData);
12033
12156
  break;
12157
+ case exports.IkasThemeComponentPropType.CATEGORY:
12158
+ propValueProvider = new IkasCategoryPropValueProvider(propValue, this.pageSpecificData);
12159
+ break;
12160
+ case exports.IkasThemeComponentPropType.CATEGORY_LIST:
12161
+ propValueProvider = new IkasCategoryListPropValueProvider(propValue);
12162
+ break;
12034
12163
  case exports.IkasThemeComponentPropType.LINK:
12035
12164
  case exports.IkasThemeComponentPropType.LIST_OF_LINK:
12036
12165
  propValueProvider = new IkasLinkPropValueProvider(propValue, this.theme);
@@ -12064,9 +12193,15 @@ var IkasPageDataProvider = /** @class */ (function () {
12064
12193
  case exports.IkasThemeComponentPropType.IMAGE:
12065
12194
  IkasPageDataProvider.initImagePropValue(prop, propValue, pageComponentPropValue);
12066
12195
  break;
12196
+ case exports.IkasThemeComponentPropType.IMAGE_LIST:
12197
+ IkasPageDataProvider.initImageListPropValue(prop, propValue, pageComponentPropValue);
12198
+ break;
12067
12199
  case exports.IkasThemeComponentPropType.BRAND_LIST:
12068
12200
  IkasPageDataProvider.initBrandListPropValue(prop, propValue, pageComponentPropValue);
12069
12201
  break;
12202
+ case exports.IkasThemeComponentPropType.CATEGORY_LIST:
12203
+ IkasPageDataProvider.initCategoryListPropValue(prop, propValue, pageComponentPropValue);
12204
+ break;
12070
12205
  case exports.IkasThemeComponentPropType.PRODUCT_LIST:
12071
12206
  IkasPageDataProvider.initProductListPropValue(prop, propValue, pageComponentPropValue);
12072
12207
  break;
@@ -12086,6 +12221,10 @@ var IkasPageDataProvider = /** @class */ (function () {
12086
12221
  var brandList = new IkasBrandList(propValue);
12087
12222
  pageComponentPropValue.propValues[prop.name] = brandList;
12088
12223
  };
12224
+ IkasPageDataProvider.initCategoryListPropValue = function (prop, propValue, pageComponentPropValue) {
12225
+ var categoryList = new IkasCategoryList(propValue);
12226
+ pageComponentPropValue.propValues[prop.name] = categoryList;
12227
+ };
12089
12228
  IkasPageDataProvider.initProductListPropValue = function (prop, propValue, pageComponentPropValue) {
12090
12229
  var productList = new IkasProductList(propValue);
12091
12230
  pageComponentPropValue.propValues[prop.name] = productList;
@@ -12134,6 +12273,9 @@ var IkasPageDataProvider = /** @class */ (function () {
12134
12273
  IkasPageDataProvider.initImagePropValue = function (prop, propValue, pageComponentPropValue) {
12135
12274
  pageComponentPropValue.propValues[prop.name] = new IkasImage(propValue.id);
12136
12275
  };
12276
+ IkasPageDataProvider.initImageListPropValue = function (prop, propValue, pageComponentPropValue) {
12277
+ pageComponentPropValue.propValues[prop.name] = propValue.map(function (i) { return new IkasImage(i.id); });
12278
+ };
12137
12279
  return IkasPageDataProvider;
12138
12280
  }());
12139
12281
  var IkasPageComponentPropValue = /** @class */ (function () {
@@ -13101,56 +13243,6 @@ var IkasTransactionCardTypeEnum;
13101
13243
  IkasTransactionTypeEnum["VOID"] = "VOID";
13102
13244
  })(exports.IkasTransactionTypeEnum || (exports.IkasTransactionTypeEnum = {}));
13103
13245
 
13104
- var IkasThemeComponentProp = /** @class */ (function () {
13105
- function IkasThemeComponentProp(data) {
13106
- this.name = data.name || "";
13107
- this.displayName = data.displayName || "";
13108
- this.type = data.type || exports.IkasThemeComponentPropType.TEXT;
13109
- mobx.makeAutoObservable(this);
13110
- }
13111
- return IkasThemeComponentProp;
13112
- }());
13113
- (function (IkasThemeComponentPropType) {
13114
- IkasThemeComponentPropType["IMAGE"] = "IMAGE";
13115
- IkasThemeComponentPropType["TEXT"] = "TEXT";
13116
- IkasThemeComponentPropType["BOOLEAN"] = "BOOLEAN";
13117
- IkasThemeComponentPropType["LINK"] = "LINK";
13118
- IkasThemeComponentPropType["LIST_OF_LINK"] = "LIST_OF_LINK";
13119
- IkasThemeComponentPropType["PRODUCT_DETAIL"] = "PRODUCT_DETAIL";
13120
- IkasThemeComponentPropType["PRODUCT_LIST"] = "PRODUCT_LIST";
13121
- IkasThemeComponentPropType["BRAND"] = "BRAND";
13122
- IkasThemeComponentPropType["BRAND_LIST"] = "BRAND_LIST";
13123
- IkasThemeComponentPropType["CATEGORY"] = "CATEGORY";
13124
- IkasThemeComponentPropType["CATEGORY_LIST"] = "CATEGORY_LIST";
13125
- // TODO number
13126
- // TODO productAttribute
13127
- })(exports.IkasThemeComponentPropType || (exports.IkasThemeComponentPropType = {}));
13128
-
13129
- var IkasThemeComponent = /** @class */ (function () {
13130
- function IkasThemeComponent(data) {
13131
- this.id = data.id || "";
13132
- this.dir = data.dir || "";
13133
- this.displayName = data.displayName || "";
13134
- this.props = data.props
13135
- ? data.props.map(function (p) { return new IkasThemeComponentProp(p); })
13136
- : [];
13137
- this.isHeader = data.isHeader || false;
13138
- this.isFooter = data.isFooter || false;
13139
- mobx.makeAutoObservable(this);
13140
- }
13141
- return IkasThemeComponent;
13142
- }());
13143
-
13144
- var IkasThemePageComponent = /** @class */ (function () {
13145
- function IkasThemePageComponent(data) {
13146
- this.id = data.id || "";
13147
- this.componentId = data.componentId || "";
13148
- this.propValues = data.propValues || {};
13149
- mobx.makeAutoObservable(this);
13150
- }
13151
- return IkasThemePageComponent;
13152
- }());
13153
-
13154
13246
  // Unique ID creation requires a high quality random # generator. In the browser we therefore
13155
13247
  // require the crypto API and do not support built-in fallback to lower quality random number
13156
13248
  // generators (like Math.random()).
@@ -13225,6 +13317,59 @@ function v4(options, buf, offset) {
13225
13317
  return stringify(rnds);
13226
13318
  }
13227
13319
 
13320
+ var IkasThemeComponentProp = /** @class */ (function () {
13321
+ function IkasThemeComponentProp(data) {
13322
+ this.id = data.id || v4();
13323
+ this.name = data.name || "";
13324
+ this.displayName = data.displayName || "";
13325
+ this.type = data.type || exports.IkasThemeComponentPropType.TEXT;
13326
+ this.isRequired = data.isRequired || false;
13327
+ mobx.makeAutoObservable(this);
13328
+ }
13329
+ return IkasThemeComponentProp;
13330
+ }());
13331
+ (function (IkasThemeComponentPropType) {
13332
+ IkasThemeComponentPropType["TEXT"] = "TEXT";
13333
+ IkasThemeComponentPropType["BOOLEAN"] = "BOOLEAN";
13334
+ IkasThemeComponentPropType["IMAGE"] = "IMAGE";
13335
+ IkasThemeComponentPropType["IMAGE_LIST"] = "IMAGE_LIST";
13336
+ IkasThemeComponentPropType["LINK"] = "LINK";
13337
+ IkasThemeComponentPropType["LIST_OF_LINK"] = "LIST_OF_LINK";
13338
+ IkasThemeComponentPropType["PRODUCT_DETAIL"] = "PRODUCT_DETAIL";
13339
+ IkasThemeComponentPropType["PRODUCT_LIST"] = "PRODUCT_LIST";
13340
+ IkasThemeComponentPropType["BRAND"] = "BRAND";
13341
+ IkasThemeComponentPropType["BRAND_LIST"] = "BRAND_LIST";
13342
+ IkasThemeComponentPropType["CATEGORY"] = "CATEGORY";
13343
+ IkasThemeComponentPropType["CATEGORY_LIST"] = "CATEGORY_LIST";
13344
+ // TODO number
13345
+ // TODO productAttribute
13346
+ })(exports.IkasThemeComponentPropType || (exports.IkasThemeComponentPropType = {}));
13347
+
13348
+ var IkasThemeComponent = /** @class */ (function () {
13349
+ function IkasThemeComponent(data) {
13350
+ this.id = data.id || "";
13351
+ this.dir = data.dir || "";
13352
+ this.displayName = data.displayName || "";
13353
+ this.props = data.props
13354
+ ? data.props.map(function (p) { return new IkasThemeComponentProp(p); })
13355
+ : [];
13356
+ this.isHeader = data.isHeader || false;
13357
+ this.isFooter = data.isFooter || false;
13358
+ mobx.makeAutoObservable(this);
13359
+ }
13360
+ return IkasThemeComponent;
13361
+ }());
13362
+
13363
+ var IkasThemePageComponent = /** @class */ (function () {
13364
+ function IkasThemePageComponent(data) {
13365
+ this.id = data.id || "";
13366
+ this.componentId = data.componentId || "";
13367
+ this.propValues = data.propValues || {};
13368
+ mobx.makeAutoObservable(this);
13369
+ }
13370
+ return IkasThemePageComponent;
13371
+ }());
13372
+
13228
13373
  var IkasThemePage = /** @class */ (function () {
13229
13374
  function IkasThemePage(data) {
13230
13375
  this.id = data.id || v4();
@@ -13613,6 +13758,274 @@ var IkasBrandListPropValue = /** @class */ (function () {
13613
13758
  return IkasBrandListPropValue;
13614
13759
  }());
13615
13760
 
13761
+ var IkasCategoryList = /** @class */ (function () {
13762
+ function IkasCategoryList(data) {
13763
+ var _this = this;
13764
+ this._initialized = false;
13765
+ this._minPage = null;
13766
+ this._isLoading = false;
13767
+ this.getInitial = function () { return __awaiter(_this, void 0, void 0, function () {
13768
+ var response_1, err_1;
13769
+ var _this = this;
13770
+ return __generator(this, function (_a) {
13771
+ switch (_a.label) {
13772
+ case 0:
13773
+ if (this._isLoading)
13774
+ return [2 /*return*/];
13775
+ this._isLoading = true;
13776
+ _a.label = 1;
13777
+ case 1:
13778
+ _a.trys.push([1, 3, 4, 5]);
13779
+ return [4 /*yield*/, IkasCategoryAPI.listCategories({
13780
+ idList: this.isStatic
13781
+ ? this._categoryListPropValue.categoryIds || undefined
13782
+ : undefined,
13783
+ page: this.isStatic ? undefined : this.page,
13784
+ limit: this.isStatic ? undefined : this.limit,
13785
+ })];
13786
+ case 2:
13787
+ response_1 = _a.sent();
13788
+ mobx.runInAction(function () {
13789
+ _this.data = response_1.categories;
13790
+ _this._count = response_1.count;
13791
+ _this._initialized = true;
13792
+ _this._minPage = _this.page;
13793
+ });
13794
+ return [3 /*break*/, 5];
13795
+ case 3:
13796
+ err_1 = _a.sent();
13797
+ console.log(err_1);
13798
+ return [3 /*break*/, 5];
13799
+ case 4:
13800
+ mobx.runInAction(function () {
13801
+ _this._isLoading = false;
13802
+ });
13803
+ return [7 /*endfinally*/];
13804
+ case 5: return [2 /*return*/];
13805
+ }
13806
+ });
13807
+ }); };
13808
+ this.getPrev = function () { return __awaiter(_this, void 0, void 0, function () {
13809
+ var minPage_1, response_2, err_2;
13810
+ var _this = this;
13811
+ return __generator(this, function (_a) {
13812
+ switch (_a.label) {
13813
+ case 0:
13814
+ if (this.isStatic || this._isLoading || !this.hasPrev)
13815
+ return [2 /*return*/];
13816
+ this._isLoading = true;
13817
+ _a.label = 1;
13818
+ case 1:
13819
+ _a.trys.push([1, 3, 4, 5]);
13820
+ minPage_1 = this._minPage - 1;
13821
+ return [4 /*yield*/, IkasCategoryAPI.listCategories({
13822
+ page: minPage_1,
13823
+ limit: this.limit,
13824
+ })];
13825
+ case 2:
13826
+ response_2 = _a.sent();
13827
+ mobx.runInAction(function () {
13828
+ _this.data = response_2.categories.concat(_this.data);
13829
+ _this._count = response_2.count;
13830
+ _this._minPage = minPage_1;
13831
+ });
13832
+ return [3 /*break*/, 5];
13833
+ case 3:
13834
+ err_2 = _a.sent();
13835
+ console.log(err_2);
13836
+ return [3 /*break*/, 5];
13837
+ case 4:
13838
+ mobx.runInAction(function () {
13839
+ _this._isLoading = false;
13840
+ });
13841
+ return [7 /*endfinally*/];
13842
+ case 5: return [2 /*return*/];
13843
+ }
13844
+ });
13845
+ }); };
13846
+ this.getNext = function () { return __awaiter(_this, void 0, void 0, function () {
13847
+ var response_3, err_3;
13848
+ var _this = this;
13849
+ return __generator(this, function (_a) {
13850
+ switch (_a.label) {
13851
+ case 0:
13852
+ if (this.isStatic || this._isLoading || !this.hasNext)
13853
+ return [2 /*return*/];
13854
+ this._isLoading = true;
13855
+ _a.label = 1;
13856
+ case 1:
13857
+ _a.trys.push([1, 3, 4, 5]);
13858
+ return [4 /*yield*/, IkasCategoryAPI.listCategories({
13859
+ page: this.page + 1,
13860
+ limit: this.limit,
13861
+ })];
13862
+ case 2:
13863
+ response_3 = _a.sent();
13864
+ mobx.runInAction(function () {
13865
+ _this.data = _this.data.concat(response_3.categories);
13866
+ _this._count = response_3.count;
13867
+ _this._page = _this.page + 1;
13868
+ });
13869
+ return [3 /*break*/, 5];
13870
+ case 3:
13871
+ err_3 = _a.sent();
13872
+ console.log(err_3);
13873
+ return [3 /*break*/, 5];
13874
+ case 4:
13875
+ mobx.runInAction(function () {
13876
+ _this._isLoading = false;
13877
+ });
13878
+ return [7 /*endfinally*/];
13879
+ case 5: return [2 /*return*/];
13880
+ }
13881
+ });
13882
+ }); };
13883
+ this.getPage = function (page) { return __awaiter(_this, void 0, void 0, function () {
13884
+ var response_4, err_4;
13885
+ var _this = this;
13886
+ return __generator(this, function (_a) {
13887
+ switch (_a.label) {
13888
+ case 0:
13889
+ if (this._isLoading || this.isStatic)
13890
+ return [2 /*return*/];
13891
+ this._isLoading = true;
13892
+ _a.label = 1;
13893
+ case 1:
13894
+ _a.trys.push([1, 3, 4, 5]);
13895
+ return [4 /*yield*/, IkasCategoryAPI.listCategories({
13896
+ page: page,
13897
+ limit: this.limit,
13898
+ })];
13899
+ case 2:
13900
+ response_4 = _a.sent();
13901
+ mobx.runInAction(function () {
13902
+ _this.data = response_4.categories;
13903
+ _this._count = response_4.count;
13904
+ _this._page = page;
13905
+ _this._minPage = page;
13906
+ });
13907
+ return [3 /*break*/, 5];
13908
+ case 3:
13909
+ err_4 = _a.sent();
13910
+ console.log(err_4);
13911
+ return [3 /*break*/, 5];
13912
+ case 4:
13913
+ mobx.runInAction(function () {
13914
+ _this._isLoading = false;
13915
+ });
13916
+ return [7 /*endfinally*/];
13917
+ case 5: return [2 /*return*/];
13918
+ }
13919
+ });
13920
+ }); };
13921
+ this.data = data.data ? data.data.map(function (b) { return new IkasCategory(b); }) : [];
13922
+ this._type =
13923
+ data.type ||
13924
+ data.categoryListPropValue.categoryListType ||
13925
+ exports.IkasCategoryListType.ALL;
13926
+ this._sort =
13927
+ data.sort ||
13928
+ data.categoryListPropValue.initialSort ||
13929
+ exports.IkasCategoryListSortType.A_Z;
13930
+ this._limit = data.limit || data.categoryListPropValue.initialLimit || 20;
13931
+ this._page = data.page || 1;
13932
+ this._count = data.count || 0;
13933
+ this._initialized = data.initialized || false;
13934
+ this._minPage = data.minPage;
13935
+ this._categoryListPropValue = data.categoryListPropValue;
13936
+ mobx.makeAutoObservable(this);
13937
+ }
13938
+ Object.defineProperty(IkasCategoryList.prototype, "sort", {
13939
+ get: function () {
13940
+ return this._sort;
13941
+ },
13942
+ enumerable: false,
13943
+ configurable: true
13944
+ });
13945
+ Object.defineProperty(IkasCategoryList.prototype, "limit", {
13946
+ get: function () {
13947
+ return this._limit;
13948
+ },
13949
+ enumerable: false,
13950
+ configurable: true
13951
+ });
13952
+ Object.defineProperty(IkasCategoryList.prototype, "page", {
13953
+ get: function () {
13954
+ return this._page;
13955
+ },
13956
+ enumerable: false,
13957
+ configurable: true
13958
+ });
13959
+ Object.defineProperty(IkasCategoryList.prototype, "count", {
13960
+ get: function () {
13961
+ return this._count;
13962
+ },
13963
+ enumerable: false,
13964
+ configurable: true
13965
+ });
13966
+ Object.defineProperty(IkasCategoryList.prototype, "isInitialized", {
13967
+ get: function () {
13968
+ return this._initialized;
13969
+ },
13970
+ enumerable: false,
13971
+ configurable: true
13972
+ });
13973
+ Object.defineProperty(IkasCategoryList.prototype, "isStatic", {
13974
+ get: function () {
13975
+ return this._type === exports.IkasCategoryListType.STATIC;
13976
+ },
13977
+ enumerable: false,
13978
+ configurable: true
13979
+ });
13980
+ Object.defineProperty(IkasCategoryList.prototype, "hasPrev", {
13981
+ get: function () {
13982
+ if (this.isStatic || !this._minPage)
13983
+ return false;
13984
+ return this._minPage > 1;
13985
+ },
13986
+ enumerable: false,
13987
+ configurable: true
13988
+ });
13989
+ Object.defineProperty(IkasCategoryList.prototype, "hasNext", {
13990
+ get: function () {
13991
+ if (this.isStatic)
13992
+ return false;
13993
+ return this.page * this.limit < this.count;
13994
+ },
13995
+ enumerable: false,
13996
+ configurable: true
13997
+ });
13998
+ Object.defineProperty(IkasCategoryList.prototype, "isLoading", {
13999
+ get: function () {
14000
+ return this._isLoading;
14001
+ },
14002
+ enumerable: false,
14003
+ configurable: true
14004
+ });
14005
+ IkasCategoryList.prototype.toJSON = function () {
14006
+ return {
14007
+ data: this.data,
14008
+ type: this._type,
14009
+ sort: this._sort,
14010
+ limit: this._limit,
14011
+ page: this._page,
14012
+ count: this._count,
14013
+ initialized: this._initialized,
14014
+ minPage: this._minPage,
14015
+ categoryListPropValue: this._categoryListPropValue,
14016
+ };
14017
+ };
14018
+ return IkasCategoryList;
14019
+ }());
14020
+ (function (IkasCategoryListType) {
14021
+ IkasCategoryListType["ALL"] = "ALL";
14022
+ IkasCategoryListType["STATIC"] = "STATIC";
14023
+ })(exports.IkasCategoryListType || (exports.IkasCategoryListType = {}));
14024
+ (function (IkasCategoryListSortType) {
14025
+ IkasCategoryListSortType["A_Z"] = "A_Z";
14026
+ IkasCategoryListSortType["Z_A"] = "Z_A";
14027
+ })(exports.IkasCategoryListSortType || (exports.IkasCategoryListSortType = {}));
14028
+
13616
14029
  var IkasProductDetail = /** @class */ (function () {
13617
14030
  function IkasProductDetail(product, selectedVariantValues, usePageData, router) {
13618
14031
  this.usePageData = null;
@@ -14091,6 +14504,35 @@ var IkasProductDetailPropValue = /** @class */ (function () {
14091
14504
  return IkasProductDetailPropValue;
14092
14505
  }());
14093
14506
 
14507
+ var IkasCategoryPropValue = /** @class */ (function () {
14508
+ function IkasCategoryPropValue(data) {
14509
+ this.categoryId = null;
14510
+ // Only for category detail page
14511
+ this.usePageData = null;
14512
+ this.categoryId = data.categoryId;
14513
+ this.usePageData = data.usePageData;
14514
+ mobx.makeAutoObservable(this);
14515
+ }
14516
+ return IkasCategoryPropValue;
14517
+ }());
14518
+
14519
+ var IkasCategoryListPropValue = /** @class */ (function () {
14520
+ function IkasCategoryListPropValue(data) {
14521
+ this.initialSort = null;
14522
+ this.initialLimit = null;
14523
+ // Only for static lists
14524
+ this.categoryCount = null;
14525
+ this.categoryIds = null;
14526
+ this.categoryListType = data.categoryListType || exports.IkasCategoryListType.ALL;
14527
+ this.initialSort = data.initialSort || exports.IkasCategoryListSortType.A_Z;
14528
+ this.initialLimit = data.initialLimit || 20;
14529
+ this.categoryCount = data.categoryCount;
14530
+ this.categoryIds = data.categoryIds;
14531
+ mobx.makeAutoObservable(this);
14532
+ }
14533
+ return IkasCategoryListPropValue;
14534
+ }());
14535
+
14094
14536
  var IkasBrandAPI = /** @class */ (function () {
14095
14537
  function IkasBrandAPI() {
14096
14538
  }
@@ -14250,7 +14692,7 @@ var IkasCategoryAPI = /** @class */ (function () {
14250
14692
  return __generator(this, function (_b) {
14251
14693
  switch (_b.label) {
14252
14694
  case 0:
14253
- LIST_QUERY = src(templateObject_1$2 || (templateObject_1$2 = __makeTemplateObject(["\n query listCategory(\n $id: StringFilterInput!\n $paginationInput: PaginationInput\n $name: StringFilterInput\n ) {\n listCategory(id: $id, paginationInput: $paginationInput, name: $name) {\n data {\n id\n createdAt\n updatedAt\n deleted\n name\n parentId\n imageId\n metaData {\n slug\n pageTitle\n description\n targetId\n targetType\n redirectTo\n }\n }\n count\n }\n }\n "], ["\n query listCategory(\n $id: StringFilterInput!\n $paginationInput: PaginationInput\n $name: StringFilterInput\n ) {\n listCategory(id: $id, paginationInput: $paginationInput, name: $name) {\n data {\n id\n createdAt\n updatedAt\n deleted\n name\n parentId\n imageId\n metaData {\n slug\n pageTitle\n description\n targetId\n targetType\n redirectTo\n }\n }\n count\n }\n }\n "])));
14695
+ LIST_QUERY = src(templateObject_1$2 || (templateObject_1$2 = __makeTemplateObject(["\n query listCategory(\n $id: StringFilterInput\n $paginationInput: PaginationInput\n $name: StringFilterInput\n ) {\n listCategory(id: $id, paginationInput: $paginationInput, name: $name) {\n data {\n id\n createdAt\n updatedAt\n deleted\n name\n parentId\n imageId\n metaData {\n slug\n pageTitle\n description\n targetId\n targetType\n redirectTo\n }\n }\n count\n }\n }\n "], ["\n query listCategory(\n $id: StringFilterInput\n $paginationInput: PaginationInput\n $name: StringFilterInput\n ) {\n listCategory(id: $id, paginationInput: $paginationInput, name: $name) {\n data {\n id\n createdAt\n updatedAt\n deleted\n name\n parentId\n imageId\n metaData {\n slug\n pageTitle\n description\n targetId\n targetType\n redirectTo\n }\n }\n count\n }\n }\n "])));
14254
14696
  _b.label = 1;
14255
14697
  case 1:
14256
14698
  _b.trys.push([1, 3, , 4]);
@@ -14259,9 +14701,11 @@ var IkasCategoryAPI = /** @class */ (function () {
14259
14701
  .query({
14260
14702
  query: LIST_QUERY,
14261
14703
  variables: {
14262
- id: {
14263
- in: (params === null || params === void 0 ? void 0 : params.idList) || [],
14264
- },
14704
+ id: (params === null || params === void 0 ? void 0 : params.idList) && params.idList.length
14705
+ ? {
14706
+ in: params.idList,
14707
+ }
14708
+ : undefined,
14265
14709
  paginationInput: (params === null || params === void 0 ? void 0 : params.page) ? {
14266
14710
  page: params.page,
14267
14711
  limit: params.limit || 10,
@@ -18842,7 +19286,7 @@ var IkasProductAPI = /** @class */ (function () {
18842
19286
  return __generator(this, function (_b) {
18843
19287
  switch (_b.label) {
18844
19288
  case 0:
18845
- LIST_PRODUCTS = src(templateObject_1$d || (templateObject_1$d = __makeTemplateObject(["\n query listProduct(\n $id: StringFilterInput\n $paginationInput: PaginationInput\n $search: String\n ) {\n listProduct(\n id: $id\n paginationInput: $paginationInput\n search: $search\n ) {\n data {\n id\n createdAt\n updatedAt\n deleted\n name\n type\n shortDescription\n description\n taxValue\n metaData {\n slug\n pageTitle\n description\n targetId\n targetType\n redirectTo\n }\n categoryIds\n productVariantTypes {\n order\n variantTypeId\n variantValueIds\n }\n variants {\n id\n createdAt\n updatedAt\n deleted\n sku\n barcodeList\n isActive\n variantValueIds {\n variantTypeId\n variantValueId\n }\n attributes {\n value\n productAttributeId\n productAttributeOptionId\n }\n images {\n order\n isMain\n imageId\n }\n prices {\n sellPrice\n discountPrice\n buyPrice\n currency\n salesChannelId\n }\n }\n attributes {\n value\n productAttributeId\n productAttributeOptionId\n }\n }\n count\n }\n }\n "], ["\n query listProduct(\n $id: StringFilterInput\n $paginationInput: PaginationInput\n $search: String\n ) {\n listProduct(\n id: $id\n paginationInput: $paginationInput\n search: $search\n ) {\n data {\n id\n createdAt\n updatedAt\n deleted\n name\n type\n shortDescription\n description\n taxValue\n metaData {\n slug\n pageTitle\n description\n targetId\n targetType\n redirectTo\n }\n categoryIds\n productVariantTypes {\n order\n variantTypeId\n variantValueIds\n }\n variants {\n id\n createdAt\n updatedAt\n deleted\n sku\n barcodeList\n isActive\n variantValueIds {\n variantTypeId\n variantValueId\n }\n attributes {\n value\n productAttributeId\n productAttributeOptionId\n }\n images {\n order\n isMain\n imageId\n }\n prices {\n sellPrice\n discountPrice\n buyPrice\n currency\n salesChannelId\n }\n }\n attributes {\n value\n productAttributeId\n productAttributeOptionId\n }\n }\n count\n }\n }\n "])));
19289
+ LIST_PRODUCTS = src(templateObject_1$d || (templateObject_1$d = __makeTemplateObject(["\n query listProduct(\n $id: StringFilterInput\n $paginationInput: PaginationInput\n $search: String\n ) {\n listProduct(\n id: $id\n paginationInput: $paginationInput\n search: $search\n ) {\n data {\n id\n createdAt\n updatedAt\n deleted\n name\n type\n shortDescription\n description\n taxValue\n metaData {\n slug\n pageTitle\n description\n targetId\n targetType\n redirectTo\n }\n categoryIds\n productVariantTypes {\n order\n variantTypeId\n variantValueIds\n }\n variants {\n id\n createdAt\n updatedAt\n deleted\n sku\n barcodeList\n isActive\n variantValueIds {\n variantTypeId\n variantValueId\n }\n attributes {\n value\n productAttributeId\n productAttributeOptionId\n }\n images {\n order\n isMain\n imageId\n }\n prices {\n sellPrice\n discountPrice\n buyPrice\n currency\n }\n }\n attributes {\n value\n productAttributeId\n productAttributeOptionId\n }\n }\n count\n }\n }\n "], ["\n query listProduct(\n $id: StringFilterInput\n $paginationInput: PaginationInput\n $search: String\n ) {\n listProduct(\n id: $id\n paginationInput: $paginationInput\n search: $search\n ) {\n data {\n id\n createdAt\n updatedAt\n deleted\n name\n type\n shortDescription\n description\n taxValue\n metaData {\n slug\n pageTitle\n description\n targetId\n targetType\n redirectTo\n }\n categoryIds\n productVariantTypes {\n order\n variantTypeId\n variantValueIds\n }\n variants {\n id\n createdAt\n updatedAt\n deleted\n sku\n barcodeList\n isActive\n variantValueIds {\n variantTypeId\n variantValueId\n }\n attributes {\n value\n productAttributeId\n productAttributeOptionId\n }\n images {\n order\n isMain\n imageId\n }\n prices {\n sellPrice\n discountPrice\n buyPrice\n currency\n }\n }\n attributes {\n value\n productAttributeId\n productAttributeOptionId\n }\n }\n count\n }\n }\n "])));
18846
19290
  _b.label = 1;
18847
19291
  case 1:
18848
19292
  _b.trys.push([1, 8, , 9]);
@@ -22770,10 +23214,15 @@ var style = {
22770
23214
  };
22771
23215
 
22772
23216
  var ThemeComponent = mobxReactLite.observer(function (_a) {
22773
- var propValues = _a.propValues, pageComponent = _a.pageComponent, index = _a.index;
23217
+ var pageComponentPropValue = _a.pageComponentPropValue, pageComponent = _a.pageComponent, index = _a.index;
22774
23218
  var store = IkasStorefrontConfig.store, components = IkasStorefrontConfig.components;
23219
+ var propValues = pageComponentPropValue.propValues;
22775
23220
  var hasNullValue = mobx.computed(function () {
22776
- return Object.values(propValues || {}).some(function (pv) { return pv === null || pv === undefined; });
23221
+ return Object.entries(propValues || {}).some(function (_a) {
23222
+ var _b;
23223
+ var propName = _a[0], propValue = _a[1];
23224
+ return (propValue === null || propValue === undefined) && ((_b = pageComponentPropValue.component.props.find(function (p) { return p.name === propName; })) === null || _b === void 0 ? void 0 : _b.isRequired);
23225
+ });
22777
23226
  });
22778
23227
  var Component = components[pageComponent.componentId];
22779
23228
  return (React.createElement("div", { id: index + "" }, hasNullValue.get() ? (React.createElement(ErrorComponent, null)) : (React.createElement(Component, __assign({ key: pageComponent.id }, propValues, { store: store })))));
@@ -22784,7 +23233,7 @@ var IkasPage = mobxReactLite.observer(function (_a) {
22784
23233
  var propValues = _a.propValues, page = _a.page;
22785
23234
  var renderComponent = function (pageComponent, index) {
22786
23235
  var pageComponentPropValue = propValues.find(function (pv) { return pv.pageComponent.id === pageComponent.id; });
22787
- return (React.createElement(ThemeComponent, { key: pageComponent.id, index: index, propValues: pageComponentPropValue.propValues, pageComponent: pageComponent }));
23236
+ return (React.createElement(ThemeComponent, { key: pageComponent.id, index: index, pageComponentPropValue: pageComponentPropValue, pageComponent: pageComponent }));
22788
23237
  };
22789
23238
  var headerComponent = (_b = propValues.find(function (pv) { return pv.component.isHeader; })) === null || _b === void 0 ? void 0 : _b.pageComponent;
22790
23239
  var footerComponent = (_c = propValues.find(function (pv) { return pv.component.isFooter; })) === null || _c === void 0 ? void 0 : _c.pageComponent;
@@ -22840,10 +23289,10 @@ var PageViewModel = /** @class */ (function () {
22840
23289
  case BridgeMessageType.UPDATE_PROP_VALUE: return [3 /*break*/, 3];
22841
23290
  case BridgeMessageType.UPDATE_PAGE_PARAMS: return [3 /*break*/, 5];
22842
23291
  case BridgeMessageType.UPDATE_PAGE_COMPONENT_ORDER: return [3 /*break*/, 7];
22843
- case BridgeMessageType.ADD_NEW_COMPONENT: return [3 /*break*/, 9];
23292
+ case BridgeMessageType.ADD_COMPONENT: return [3 /*break*/, 9];
22844
23293
  case BridgeMessageType.DELETE_COMPONENT: return [3 /*break*/, 10];
22845
23294
  case BridgeMessageType.UPDATE_COMPONENT: return [3 /*break*/, 11];
22846
- case BridgeMessageType.ADD_NEW_PAGE_COMPONENT: return [3 /*break*/, 12];
23295
+ case BridgeMessageType.ADD_PAGE_COMPONENT: return [3 /*break*/, 12];
22847
23296
  case BridgeMessageType.DELETE_PAGE_COMPONENT: return [3 /*break*/, 14];
22848
23297
  case BridgeMessageType.SET_SELECTED_COMPONENT: return [3 /*break*/, 15];
22849
23298
  case BridgeMessageType.SET_HOVERED_COMPONENT: return [3 /*break*/, 16];
@@ -23050,13 +23499,16 @@ var PageViewModel = /** @class */ (function () {
23050
23499
  this.handleAddNewPageComponent = function (data) { return __awaiter(_this, void 0, void 0, function () {
23051
23500
  var pageComponent, pageComponentPropValue;
23052
23501
  var _this = this;
23053
- return __generator(this, function (_a) {
23054
- switch (_a.label) {
23502
+ var _a;
23503
+ return __generator(this, function (_b) {
23504
+ switch (_b.label) {
23055
23505
  case 0:
23056
23506
  pageComponent = new IkasThemePageComponent(data.pageComponent);
23507
+ if ((_a = this.page) === null || _a === void 0 ? void 0 : _a.components.some(function (pc) { return pc.id === pageComponent.id; }))
23508
+ return [2 /*return*/];
23057
23509
  return [4 /*yield*/, this.pageDataProvider.getPageComponentPropValues(pageComponent)];
23058
23510
  case 1:
23059
- pageComponentPropValue = _a.sent();
23511
+ pageComponentPropValue = _b.sent();
23060
23512
  mobx.runInAction(function () {
23061
23513
  var _a;
23062
23514
  _this.pageDataProvider.pageComponentPropValues.push(pageComponentPropValue);
@@ -23117,10 +23569,10 @@ var BridgeMessageType;
23117
23569
  BridgeMessageType["UPDATE_PROP_VALUE"] = "UPDATE_PROP_VALUE";
23118
23570
  BridgeMessageType["UPDATE_PAGE_PARAMS"] = "UPDATE_PAGE_PARAMS";
23119
23571
  BridgeMessageType["UPDATE_PAGE_COMPONENT_ORDER"] = "UPDATE_PAGE_COMPONENT_ORDER";
23120
- BridgeMessageType["ADD_NEW_COMPONENT"] = "ADD_NEW_COMPONENT";
23572
+ BridgeMessageType["ADD_COMPONENT"] = "ADD_COMPONENT";
23121
23573
  BridgeMessageType["DELETE_COMPONENT"] = "DELETE_COMPONENT";
23122
23574
  BridgeMessageType["UPDATE_COMPONENT"] = "UPDATE_COMPONENT";
23123
- BridgeMessageType["ADD_NEW_PAGE_COMPONENT"] = "ADD_NEW_PAGE_COMPONENT";
23575
+ BridgeMessageType["ADD_PAGE_COMPONENT"] = "ADD_PAGE_COMPONENT";
23124
23576
  BridgeMessageType["DELETE_PAGE_COMPONENT"] = "DELETE_PAGE_COMPONENT";
23125
23577
  BridgeMessageType["COMPONENT_MOUSE_OVER"] = "COMPONENT_MOUSE_OVER";
23126
23578
  BridgeMessageType["COMPONENT_MOUSE_LEAVE"] = "COMPONENT_MOUSE_LEAVE";
@@ -23138,10 +23590,10 @@ var ThemeEditorComponent = mobxReactLite.observer(function (_a) {
23138
23590
  React.useEffect(function () {
23139
23591
  vm.setComponentRef(ref.current, pageComponent);
23140
23592
  }, []);
23141
- var pageComponentPropValues = mobx.computed(function () {
23593
+ var pageComponentPropValue = mobx.computed(function () {
23142
23594
  return vm.pageDataProvider.pageComponentPropValues.find(function (pc) { return pc.pageComponent.id === pageComponent.id; });
23143
23595
  });
23144
- var propValues = (_b = pageComponentPropValues.get()) === null || _b === void 0 ? void 0 : _b.propValues;
23596
+ var propValues = (_b = pageComponentPropValue.get()) === null || _b === void 0 ? void 0 : _b.propValues;
23145
23597
  if (!propValues)
23146
23598
  return null;
23147
23599
  var Component = components[pageComponent.componentId];
@@ -23152,7 +23604,12 @@ var ThemeEditorComponent = mobxReactLite.observer(function (_a) {
23152
23604
  return vm.hoveredPageComponentId === pageComponent.id;
23153
23605
  });
23154
23606
  var hasNullValue = mobx.computed(function () {
23155
- return Object.values(propValues || {}).some(function (pv) { return pv === null || pv === undefined; });
23607
+ return Object.entries(propValues || {}).some(function (_a) {
23608
+ var _b, _c;
23609
+ var propName = _a[0], propValue = _a[1];
23610
+ return (propValue === null || propValue === undefined) && ((_c = (_b = pageComponentPropValue
23611
+ .get()) === null || _b === void 0 ? void 0 : _b.component.props.find(function (p) { return p.name === propName; })) === null || _c === void 0 ? void 0 : _c.isRequired);
23612
+ });
23156
23613
  });
23157
23614
  var onMouseEnter = function () {
23158
23615
  vm.onMouseOver(pageComponent.id);
@@ -23720,6 +24177,9 @@ exports.IkasBrandPropValue = IkasBrandPropValue;
23720
24177
  exports.IkasCartAPI = IkasCartAPI;
23721
24178
  exports.IkasCategory = IkasCategory;
23722
24179
  exports.IkasCategoryAPI = IkasCategoryAPI;
24180
+ exports.IkasCategoryList = IkasCategoryList;
24181
+ exports.IkasCategoryListPropValue = IkasCategoryListPropValue;
24182
+ exports.IkasCategoryPropValue = IkasCategoryPropValue;
23723
24183
  exports.IkasCheckout = IkasCheckout;
23724
24184
  exports.IkasCheckoutAPI = IkasCheckoutAPI;
23725
24185
  exports.IkasCheckoutPage = IkasCheckoutPage;