@ikas/storefront 0.0.8 → 0.0.12

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);
@@ -12067,6 +12196,9 @@ var IkasPageDataProvider = /** @class */ (function () {
12067
12196
  case exports.IkasThemeComponentPropType.BRAND_LIST:
12068
12197
  IkasPageDataProvider.initBrandListPropValue(prop, propValue, pageComponentPropValue);
12069
12198
  break;
12199
+ case exports.IkasThemeComponentPropType.CATEGORY_LIST:
12200
+ IkasPageDataProvider.initCategoryListPropValue(prop, propValue, pageComponentPropValue);
12201
+ break;
12070
12202
  case exports.IkasThemeComponentPropType.PRODUCT_LIST:
12071
12203
  IkasPageDataProvider.initProductListPropValue(prop, propValue, pageComponentPropValue);
12072
12204
  break;
@@ -12086,6 +12218,10 @@ var IkasPageDataProvider = /** @class */ (function () {
12086
12218
  var brandList = new IkasBrandList(propValue);
12087
12219
  pageComponentPropValue.propValues[prop.name] = brandList;
12088
12220
  };
12221
+ IkasPageDataProvider.initCategoryListPropValue = function (prop, propValue, pageComponentPropValue) {
12222
+ var categoryList = new IkasCategoryList(propValue);
12223
+ pageComponentPropValue.propValues[prop.name] = categoryList;
12224
+ };
12089
12225
  IkasPageDataProvider.initProductListPropValue = function (prop, propValue, pageComponentPropValue) {
12090
12226
  var productList = new IkasProductList(propValue);
12091
12227
  pageComponentPropValue.propValues[prop.name] = productList;
@@ -13101,56 +13237,6 @@ var IkasTransactionCardTypeEnum;
13101
13237
  IkasTransactionTypeEnum["VOID"] = "VOID";
13102
13238
  })(exports.IkasTransactionTypeEnum || (exports.IkasTransactionTypeEnum = {}));
13103
13239
 
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
13240
  // Unique ID creation requires a high quality random # generator. In the browser we therefore
13155
13241
  // require the crypto API and do not support built-in fallback to lower quality random number
13156
13242
  // generators (like Math.random()).
@@ -13225,6 +13311,59 @@ function v4(options, buf, offset) {
13225
13311
  return stringify(rnds);
13226
13312
  }
13227
13313
 
13314
+ var IkasThemeComponentProp = /** @class */ (function () {
13315
+ function IkasThemeComponentProp(data) {
13316
+ this.id = data.id || v4();
13317
+ this.name = data.name || "";
13318
+ this.displayName = data.displayName || "";
13319
+ this.type = data.type || exports.IkasThemeComponentPropType.TEXT;
13320
+ this.isRequired = data.isRequired || false;
13321
+ mobx.makeAutoObservable(this);
13322
+ }
13323
+ return IkasThemeComponentProp;
13324
+ }());
13325
+ (function (IkasThemeComponentPropType) {
13326
+ IkasThemeComponentPropType["TEXT"] = "TEXT";
13327
+ IkasThemeComponentPropType["BOOLEAN"] = "BOOLEAN";
13328
+ IkasThemeComponentPropType["IMAGE"] = "IMAGE";
13329
+ IkasThemeComponentPropType["IMAGE_LIST"] = "IMAGE_LIST";
13330
+ IkasThemeComponentPropType["LINK"] = "LINK";
13331
+ IkasThemeComponentPropType["LIST_OF_LINK"] = "LIST_OF_LINK";
13332
+ IkasThemeComponentPropType["PRODUCT_DETAIL"] = "PRODUCT_DETAIL";
13333
+ IkasThemeComponentPropType["PRODUCT_LIST"] = "PRODUCT_LIST";
13334
+ IkasThemeComponentPropType["BRAND"] = "BRAND";
13335
+ IkasThemeComponentPropType["BRAND_LIST"] = "BRAND_LIST";
13336
+ IkasThemeComponentPropType["CATEGORY"] = "CATEGORY";
13337
+ IkasThemeComponentPropType["CATEGORY_LIST"] = "CATEGORY_LIST";
13338
+ // TODO number
13339
+ // TODO productAttribute
13340
+ })(exports.IkasThemeComponentPropType || (exports.IkasThemeComponentPropType = {}));
13341
+
13342
+ var IkasThemeComponent = /** @class */ (function () {
13343
+ function IkasThemeComponent(data) {
13344
+ this.id = data.id || "";
13345
+ this.dir = data.dir || "";
13346
+ this.displayName = data.displayName || "";
13347
+ this.props = data.props
13348
+ ? data.props.map(function (p) { return new IkasThemeComponentProp(p); })
13349
+ : [];
13350
+ this.isHeader = data.isHeader || false;
13351
+ this.isFooter = data.isFooter || false;
13352
+ mobx.makeAutoObservable(this);
13353
+ }
13354
+ return IkasThemeComponent;
13355
+ }());
13356
+
13357
+ var IkasThemePageComponent = /** @class */ (function () {
13358
+ function IkasThemePageComponent(data) {
13359
+ this.id = data.id || "";
13360
+ this.componentId = data.componentId || "";
13361
+ this.propValues = data.propValues || {};
13362
+ mobx.makeAutoObservable(this);
13363
+ }
13364
+ return IkasThemePageComponent;
13365
+ }());
13366
+
13228
13367
  var IkasThemePage = /** @class */ (function () {
13229
13368
  function IkasThemePage(data) {
13230
13369
  this.id = data.id || v4();
@@ -13613,6 +13752,274 @@ var IkasBrandListPropValue = /** @class */ (function () {
13613
13752
  return IkasBrandListPropValue;
13614
13753
  }());
13615
13754
 
13755
+ var IkasCategoryList = /** @class */ (function () {
13756
+ function IkasCategoryList(data) {
13757
+ var _this = this;
13758
+ this._initialized = false;
13759
+ this._minPage = null;
13760
+ this._isLoading = false;
13761
+ this.getInitial = function () { return __awaiter(_this, void 0, void 0, function () {
13762
+ var response_1, err_1;
13763
+ var _this = this;
13764
+ return __generator(this, function (_a) {
13765
+ switch (_a.label) {
13766
+ case 0:
13767
+ if (this._isLoading)
13768
+ return [2 /*return*/];
13769
+ this._isLoading = true;
13770
+ _a.label = 1;
13771
+ case 1:
13772
+ _a.trys.push([1, 3, 4, 5]);
13773
+ return [4 /*yield*/, IkasCategoryAPI.listCategories({
13774
+ idList: this.isStatic
13775
+ ? this._categoryListPropValue.categoryIds || undefined
13776
+ : undefined,
13777
+ page: this.isStatic ? undefined : this.page,
13778
+ limit: this.isStatic ? undefined : this.limit,
13779
+ })];
13780
+ case 2:
13781
+ response_1 = _a.sent();
13782
+ mobx.runInAction(function () {
13783
+ _this.data = response_1.categories;
13784
+ _this._count = response_1.count;
13785
+ _this._initialized = true;
13786
+ _this._minPage = _this.page;
13787
+ });
13788
+ return [3 /*break*/, 5];
13789
+ case 3:
13790
+ err_1 = _a.sent();
13791
+ console.log(err_1);
13792
+ return [3 /*break*/, 5];
13793
+ case 4:
13794
+ mobx.runInAction(function () {
13795
+ _this._isLoading = false;
13796
+ });
13797
+ return [7 /*endfinally*/];
13798
+ case 5: return [2 /*return*/];
13799
+ }
13800
+ });
13801
+ }); };
13802
+ this.getPrev = function () { return __awaiter(_this, void 0, void 0, function () {
13803
+ var minPage_1, response_2, err_2;
13804
+ var _this = this;
13805
+ return __generator(this, function (_a) {
13806
+ switch (_a.label) {
13807
+ case 0:
13808
+ if (this.isStatic || this._isLoading || !this.hasPrev)
13809
+ return [2 /*return*/];
13810
+ this._isLoading = true;
13811
+ _a.label = 1;
13812
+ case 1:
13813
+ _a.trys.push([1, 3, 4, 5]);
13814
+ minPage_1 = this._minPage - 1;
13815
+ return [4 /*yield*/, IkasCategoryAPI.listCategories({
13816
+ page: minPage_1,
13817
+ limit: this.limit,
13818
+ })];
13819
+ case 2:
13820
+ response_2 = _a.sent();
13821
+ mobx.runInAction(function () {
13822
+ _this.data = response_2.categories.concat(_this.data);
13823
+ _this._count = response_2.count;
13824
+ _this._minPage = minPage_1;
13825
+ });
13826
+ return [3 /*break*/, 5];
13827
+ case 3:
13828
+ err_2 = _a.sent();
13829
+ console.log(err_2);
13830
+ return [3 /*break*/, 5];
13831
+ case 4:
13832
+ mobx.runInAction(function () {
13833
+ _this._isLoading = false;
13834
+ });
13835
+ return [7 /*endfinally*/];
13836
+ case 5: return [2 /*return*/];
13837
+ }
13838
+ });
13839
+ }); };
13840
+ this.getNext = function () { return __awaiter(_this, void 0, void 0, function () {
13841
+ var response_3, err_3;
13842
+ var _this = this;
13843
+ return __generator(this, function (_a) {
13844
+ switch (_a.label) {
13845
+ case 0:
13846
+ if (this.isStatic || this._isLoading || !this.hasNext)
13847
+ return [2 /*return*/];
13848
+ this._isLoading = true;
13849
+ _a.label = 1;
13850
+ case 1:
13851
+ _a.trys.push([1, 3, 4, 5]);
13852
+ return [4 /*yield*/, IkasCategoryAPI.listCategories({
13853
+ page: this.page + 1,
13854
+ limit: this.limit,
13855
+ })];
13856
+ case 2:
13857
+ response_3 = _a.sent();
13858
+ mobx.runInAction(function () {
13859
+ _this.data = _this.data.concat(response_3.categories);
13860
+ _this._count = response_3.count;
13861
+ _this._page = _this.page + 1;
13862
+ });
13863
+ return [3 /*break*/, 5];
13864
+ case 3:
13865
+ err_3 = _a.sent();
13866
+ console.log(err_3);
13867
+ return [3 /*break*/, 5];
13868
+ case 4:
13869
+ mobx.runInAction(function () {
13870
+ _this._isLoading = false;
13871
+ });
13872
+ return [7 /*endfinally*/];
13873
+ case 5: return [2 /*return*/];
13874
+ }
13875
+ });
13876
+ }); };
13877
+ this.getPage = function (page) { return __awaiter(_this, void 0, void 0, function () {
13878
+ var response_4, err_4;
13879
+ var _this = this;
13880
+ return __generator(this, function (_a) {
13881
+ switch (_a.label) {
13882
+ case 0:
13883
+ if (this._isLoading || this.isStatic)
13884
+ return [2 /*return*/];
13885
+ this._isLoading = true;
13886
+ _a.label = 1;
13887
+ case 1:
13888
+ _a.trys.push([1, 3, 4, 5]);
13889
+ return [4 /*yield*/, IkasCategoryAPI.listCategories({
13890
+ page: page,
13891
+ limit: this.limit,
13892
+ })];
13893
+ case 2:
13894
+ response_4 = _a.sent();
13895
+ mobx.runInAction(function () {
13896
+ _this.data = response_4.categories;
13897
+ _this._count = response_4.count;
13898
+ _this._page = page;
13899
+ _this._minPage = page;
13900
+ });
13901
+ return [3 /*break*/, 5];
13902
+ case 3:
13903
+ err_4 = _a.sent();
13904
+ console.log(err_4);
13905
+ return [3 /*break*/, 5];
13906
+ case 4:
13907
+ mobx.runInAction(function () {
13908
+ _this._isLoading = false;
13909
+ });
13910
+ return [7 /*endfinally*/];
13911
+ case 5: return [2 /*return*/];
13912
+ }
13913
+ });
13914
+ }); };
13915
+ this.data = data.data ? data.data.map(function (b) { return new IkasCategory(b); }) : [];
13916
+ this._type =
13917
+ data.type ||
13918
+ data.categoryListPropValue.categoryListType ||
13919
+ exports.IkasCategoryListType.ALL;
13920
+ this._sort =
13921
+ data.sort ||
13922
+ data.categoryListPropValue.initialSort ||
13923
+ exports.IkasCategoryListSortType.A_Z;
13924
+ this._limit = data.limit || data.categoryListPropValue.initialLimit || 20;
13925
+ this._page = data.page || 1;
13926
+ this._count = data.count || 0;
13927
+ this._initialized = data.initialized || false;
13928
+ this._minPage = data.minPage;
13929
+ this._categoryListPropValue = data.categoryListPropValue;
13930
+ mobx.makeAutoObservable(this);
13931
+ }
13932
+ Object.defineProperty(IkasCategoryList.prototype, "sort", {
13933
+ get: function () {
13934
+ return this._sort;
13935
+ },
13936
+ enumerable: false,
13937
+ configurable: true
13938
+ });
13939
+ Object.defineProperty(IkasCategoryList.prototype, "limit", {
13940
+ get: function () {
13941
+ return this._limit;
13942
+ },
13943
+ enumerable: false,
13944
+ configurable: true
13945
+ });
13946
+ Object.defineProperty(IkasCategoryList.prototype, "page", {
13947
+ get: function () {
13948
+ return this._page;
13949
+ },
13950
+ enumerable: false,
13951
+ configurable: true
13952
+ });
13953
+ Object.defineProperty(IkasCategoryList.prototype, "count", {
13954
+ get: function () {
13955
+ return this._count;
13956
+ },
13957
+ enumerable: false,
13958
+ configurable: true
13959
+ });
13960
+ Object.defineProperty(IkasCategoryList.prototype, "isInitialized", {
13961
+ get: function () {
13962
+ return this._initialized;
13963
+ },
13964
+ enumerable: false,
13965
+ configurable: true
13966
+ });
13967
+ Object.defineProperty(IkasCategoryList.prototype, "isStatic", {
13968
+ get: function () {
13969
+ return this._type === exports.IkasCategoryListType.STATIC;
13970
+ },
13971
+ enumerable: false,
13972
+ configurable: true
13973
+ });
13974
+ Object.defineProperty(IkasCategoryList.prototype, "hasPrev", {
13975
+ get: function () {
13976
+ if (this.isStatic || !this._minPage)
13977
+ return false;
13978
+ return this._minPage > 1;
13979
+ },
13980
+ enumerable: false,
13981
+ configurable: true
13982
+ });
13983
+ Object.defineProperty(IkasCategoryList.prototype, "hasNext", {
13984
+ get: function () {
13985
+ if (this.isStatic)
13986
+ return false;
13987
+ return this.page * this.limit < this.count;
13988
+ },
13989
+ enumerable: false,
13990
+ configurable: true
13991
+ });
13992
+ Object.defineProperty(IkasCategoryList.prototype, "isLoading", {
13993
+ get: function () {
13994
+ return this._isLoading;
13995
+ },
13996
+ enumerable: false,
13997
+ configurable: true
13998
+ });
13999
+ IkasCategoryList.prototype.toJSON = function () {
14000
+ return {
14001
+ data: this.data,
14002
+ type: this._type,
14003
+ sort: this._sort,
14004
+ limit: this._limit,
14005
+ page: this._page,
14006
+ count: this._count,
14007
+ initialized: this._initialized,
14008
+ minPage: this._minPage,
14009
+ categoryListPropValue: this._categoryListPropValue,
14010
+ };
14011
+ };
14012
+ return IkasCategoryList;
14013
+ }());
14014
+ (function (IkasCategoryListType) {
14015
+ IkasCategoryListType["ALL"] = "ALL";
14016
+ IkasCategoryListType["STATIC"] = "STATIC";
14017
+ })(exports.IkasCategoryListType || (exports.IkasCategoryListType = {}));
14018
+ (function (IkasCategoryListSortType) {
14019
+ IkasCategoryListSortType["A_Z"] = "A_Z";
14020
+ IkasCategoryListSortType["Z_A"] = "Z_A";
14021
+ })(exports.IkasCategoryListSortType || (exports.IkasCategoryListSortType = {}));
14022
+
13616
14023
  var IkasProductDetail = /** @class */ (function () {
13617
14024
  function IkasProductDetail(product, selectedVariantValues, usePageData, router) {
13618
14025
  this.usePageData = null;
@@ -14091,6 +14498,35 @@ var IkasProductDetailPropValue = /** @class */ (function () {
14091
14498
  return IkasProductDetailPropValue;
14092
14499
  }());
14093
14500
 
14501
+ var IkasCategoryPropValue = /** @class */ (function () {
14502
+ function IkasCategoryPropValue(data) {
14503
+ this.categoryId = null;
14504
+ // Only for category detail page
14505
+ this.usePageData = null;
14506
+ this.categoryId = data.categoryId;
14507
+ this.usePageData = data.usePageData;
14508
+ mobx.makeAutoObservable(this);
14509
+ }
14510
+ return IkasCategoryPropValue;
14511
+ }());
14512
+
14513
+ var IkasCategoryListPropValue = /** @class */ (function () {
14514
+ function IkasCategoryListPropValue(data) {
14515
+ this.initialSort = null;
14516
+ this.initialLimit = null;
14517
+ // Only for static lists
14518
+ this.categoryCount = null;
14519
+ this.categoryIds = null;
14520
+ this.categoryListType = data.categoryListType || exports.IkasCategoryListType.ALL;
14521
+ this.initialSort = data.initialSort || exports.IkasCategoryListSortType.A_Z;
14522
+ this.initialLimit = data.initialLimit || 20;
14523
+ this.categoryCount = data.categoryCount;
14524
+ this.categoryIds = data.categoryIds;
14525
+ mobx.makeAutoObservable(this);
14526
+ }
14527
+ return IkasCategoryListPropValue;
14528
+ }());
14529
+
14094
14530
  var IkasBrandAPI = /** @class */ (function () {
14095
14531
  function IkasBrandAPI() {
14096
14532
  }
@@ -14250,7 +14686,7 @@ var IkasCategoryAPI = /** @class */ (function () {
14250
14686
  return __generator(this, function (_b) {
14251
14687
  switch (_b.label) {
14252
14688
  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 "])));
14689
+ 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
14690
  _b.label = 1;
14255
14691
  case 1:
14256
14692
  _b.trys.push([1, 3, , 4]);
@@ -14259,9 +14695,11 @@ var IkasCategoryAPI = /** @class */ (function () {
14259
14695
  .query({
14260
14696
  query: LIST_QUERY,
14261
14697
  variables: {
14262
- id: {
14263
- in: (params === null || params === void 0 ? void 0 : params.idList) || [],
14264
- },
14698
+ id: (params === null || params === void 0 ? void 0 : params.idList) && params.idList.length
14699
+ ? {
14700
+ in: params.idList,
14701
+ }
14702
+ : undefined,
14265
14703
  paginationInput: (params === null || params === void 0 ? void 0 : params.page) ? {
14266
14704
  page: params.page,
14267
14705
  limit: params.limit || 10,
@@ -18842,7 +19280,7 @@ var IkasProductAPI = /** @class */ (function () {
18842
19280
  return __generator(this, function (_b) {
18843
19281
  switch (_b.label) {
18844
19282
  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 "])));
19283
+ 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
19284
  _b.label = 1;
18847
19285
  case 1:
18848
19286
  _b.trys.push([1, 8, , 9]);
@@ -22770,10 +23208,15 @@ var style = {
22770
23208
  };
22771
23209
 
22772
23210
  var ThemeComponent = mobxReactLite.observer(function (_a) {
22773
- var propValues = _a.propValues, pageComponent = _a.pageComponent, index = _a.index;
23211
+ var pageComponentPropValue = _a.pageComponentPropValue, pageComponent = _a.pageComponent, index = _a.index;
22774
23212
  var store = IkasStorefrontConfig.store, components = IkasStorefrontConfig.components;
23213
+ var propValues = pageComponentPropValue.propValues;
22775
23214
  var hasNullValue = mobx.computed(function () {
22776
- return Object.values(propValues || {}).some(function (pv) { return pv === null || pv === undefined; });
23215
+ return Object.entries(propValues || {}).some(function (_a) {
23216
+ var _b;
23217
+ var propName = _a[0], propValue = _a[1];
23218
+ return (propValue === null || propValue === undefined) && ((_b = pageComponentPropValue.component.props.find(function (p) { return p.name === propName; })) === null || _b === void 0 ? void 0 : _b.isRequired);
23219
+ });
22777
23220
  });
22778
23221
  var Component = components[pageComponent.componentId];
22779
23222
  return (React.createElement("div", { id: index + "" }, hasNullValue.get() ? (React.createElement(ErrorComponent, null)) : (React.createElement(Component, __assign({ key: pageComponent.id }, propValues, { store: store })))));
@@ -22784,7 +23227,7 @@ var IkasPage = mobxReactLite.observer(function (_a) {
22784
23227
  var propValues = _a.propValues, page = _a.page;
22785
23228
  var renderComponent = function (pageComponent, index) {
22786
23229
  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 }));
23230
+ return (React.createElement(ThemeComponent, { key: pageComponent.id, index: index, pageComponentPropValue: pageComponentPropValue, pageComponent: pageComponent }));
22788
23231
  };
22789
23232
  var headerComponent = (_b = propValues.find(function (pv) { return pv.component.isHeader; })) === null || _b === void 0 ? void 0 : _b.pageComponent;
22790
23233
  var footerComponent = (_c = propValues.find(function (pv) { return pv.component.isFooter; })) === null || _c === void 0 ? void 0 : _c.pageComponent;
@@ -22840,10 +23283,10 @@ var PageViewModel = /** @class */ (function () {
22840
23283
  case BridgeMessageType.UPDATE_PROP_VALUE: return [3 /*break*/, 3];
22841
23284
  case BridgeMessageType.UPDATE_PAGE_PARAMS: return [3 /*break*/, 5];
22842
23285
  case BridgeMessageType.UPDATE_PAGE_COMPONENT_ORDER: return [3 /*break*/, 7];
22843
- case BridgeMessageType.ADD_NEW_COMPONENT: return [3 /*break*/, 9];
23286
+ case BridgeMessageType.ADD_COMPONENT: return [3 /*break*/, 9];
22844
23287
  case BridgeMessageType.DELETE_COMPONENT: return [3 /*break*/, 10];
22845
23288
  case BridgeMessageType.UPDATE_COMPONENT: return [3 /*break*/, 11];
22846
- case BridgeMessageType.ADD_NEW_PAGE_COMPONENT: return [3 /*break*/, 12];
23289
+ case BridgeMessageType.ADD_PAGE_COMPONENT: return [3 /*break*/, 12];
22847
23290
  case BridgeMessageType.DELETE_PAGE_COMPONENT: return [3 /*break*/, 14];
22848
23291
  case BridgeMessageType.SET_SELECTED_COMPONENT: return [3 /*break*/, 15];
22849
23292
  case BridgeMessageType.SET_HOVERED_COMPONENT: return [3 /*break*/, 16];
@@ -23050,13 +23493,16 @@ var PageViewModel = /** @class */ (function () {
23050
23493
  this.handleAddNewPageComponent = function (data) { return __awaiter(_this, void 0, void 0, function () {
23051
23494
  var pageComponent, pageComponentPropValue;
23052
23495
  var _this = this;
23053
- return __generator(this, function (_a) {
23054
- switch (_a.label) {
23496
+ var _a;
23497
+ return __generator(this, function (_b) {
23498
+ switch (_b.label) {
23055
23499
  case 0:
23056
23500
  pageComponent = new IkasThemePageComponent(data.pageComponent);
23501
+ if ((_a = this.page) === null || _a === void 0 ? void 0 : _a.components.some(function (pc) { return pc.id === pageComponent.id; }))
23502
+ return [2 /*return*/];
23057
23503
  return [4 /*yield*/, this.pageDataProvider.getPageComponentPropValues(pageComponent)];
23058
23504
  case 1:
23059
- pageComponentPropValue = _a.sent();
23505
+ pageComponentPropValue = _b.sent();
23060
23506
  mobx.runInAction(function () {
23061
23507
  var _a;
23062
23508
  _this.pageDataProvider.pageComponentPropValues.push(pageComponentPropValue);
@@ -23117,10 +23563,10 @@ var BridgeMessageType;
23117
23563
  BridgeMessageType["UPDATE_PROP_VALUE"] = "UPDATE_PROP_VALUE";
23118
23564
  BridgeMessageType["UPDATE_PAGE_PARAMS"] = "UPDATE_PAGE_PARAMS";
23119
23565
  BridgeMessageType["UPDATE_PAGE_COMPONENT_ORDER"] = "UPDATE_PAGE_COMPONENT_ORDER";
23120
- BridgeMessageType["ADD_NEW_COMPONENT"] = "ADD_NEW_COMPONENT";
23566
+ BridgeMessageType["ADD_COMPONENT"] = "ADD_COMPONENT";
23121
23567
  BridgeMessageType["DELETE_COMPONENT"] = "DELETE_COMPONENT";
23122
23568
  BridgeMessageType["UPDATE_COMPONENT"] = "UPDATE_COMPONENT";
23123
- BridgeMessageType["ADD_NEW_PAGE_COMPONENT"] = "ADD_NEW_PAGE_COMPONENT";
23569
+ BridgeMessageType["ADD_PAGE_COMPONENT"] = "ADD_PAGE_COMPONENT";
23124
23570
  BridgeMessageType["DELETE_PAGE_COMPONENT"] = "DELETE_PAGE_COMPONENT";
23125
23571
  BridgeMessageType["COMPONENT_MOUSE_OVER"] = "COMPONENT_MOUSE_OVER";
23126
23572
  BridgeMessageType["COMPONENT_MOUSE_LEAVE"] = "COMPONENT_MOUSE_LEAVE";
@@ -23138,10 +23584,10 @@ var ThemeEditorComponent = mobxReactLite.observer(function (_a) {
23138
23584
  React.useEffect(function () {
23139
23585
  vm.setComponentRef(ref.current, pageComponent);
23140
23586
  }, []);
23141
- var pageComponentPropValues = mobx.computed(function () {
23587
+ var pageComponentPropValue = mobx.computed(function () {
23142
23588
  return vm.pageDataProvider.pageComponentPropValues.find(function (pc) { return pc.pageComponent.id === pageComponent.id; });
23143
23589
  });
23144
- var propValues = (_b = pageComponentPropValues.get()) === null || _b === void 0 ? void 0 : _b.propValues;
23590
+ var propValues = (_b = pageComponentPropValue.get()) === null || _b === void 0 ? void 0 : _b.propValues;
23145
23591
  if (!propValues)
23146
23592
  return null;
23147
23593
  var Component = components[pageComponent.componentId];
@@ -23152,7 +23598,12 @@ var ThemeEditorComponent = mobxReactLite.observer(function (_a) {
23152
23598
  return vm.hoveredPageComponentId === pageComponent.id;
23153
23599
  });
23154
23600
  var hasNullValue = mobx.computed(function () {
23155
- return Object.values(propValues || {}).some(function (pv) { return pv === null || pv === undefined; });
23601
+ return Object.entries(propValues || {}).some(function (_a) {
23602
+ var _b, _c;
23603
+ var propName = _a[0], propValue = _a[1];
23604
+ return (propValue === null || propValue === undefined) && ((_c = (_b = pageComponentPropValue
23605
+ .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);
23606
+ });
23156
23607
  });
23157
23608
  var onMouseEnter = function () {
23158
23609
  vm.onMouseOver(pageComponent.id);
@@ -23720,6 +24171,9 @@ exports.IkasBrandPropValue = IkasBrandPropValue;
23720
24171
  exports.IkasCartAPI = IkasCartAPI;
23721
24172
  exports.IkasCategory = IkasCategory;
23722
24173
  exports.IkasCategoryAPI = IkasCategoryAPI;
24174
+ exports.IkasCategoryList = IkasCategoryList;
24175
+ exports.IkasCategoryListPropValue = IkasCategoryListPropValue;
24176
+ exports.IkasCategoryPropValue = IkasCategoryPropValue;
23723
24177
  exports.IkasCheckout = IkasCheckout;
23724
24178
  exports.IkasCheckoutAPI = IkasCheckoutAPI;
23725
24179
  exports.IkasCheckoutPage = IkasCheckoutPage;