@ikas/storefront 0.0.43 → 0.0.45

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.es.js CHANGED
@@ -10963,9 +10963,6 @@ var IkasProductListPropValueProvider = /** @class */ (function () {
10963
10963
  filters.category = this.productListPropValue.category;
10964
10964
  }
10965
10965
  }
10966
- else {
10967
- filters.category = null;
10968
- }
10969
10966
  productList = new IkasProductList({
10970
10967
  productListPropValue: this.productListPropValue,
10971
10968
  filters: filters,
@@ -11334,6 +11331,409 @@ var IkasCategoryListPropValueProvider = /** @class */ (function () {
11334
11331
  return IkasCategoryListPropValueProvider;
11335
11332
  }());
11336
11333
 
11334
+ var IkasCustomPropValueProvider = /** @class */ (function () {
11335
+ function IkasCustomPropValueProvider(value, customData, theme, pageType, pageSpecificData, pageParams) {
11336
+ this.value = value;
11337
+ this.customData = customData;
11338
+ this.theme = theme;
11339
+ this.pageType = pageType;
11340
+ this.pageSpecificData = pageSpecificData;
11341
+ this.pageParams = pageParams;
11342
+ }
11343
+ IkasCustomPropValueProvider.prototype.getValue = function () {
11344
+ return __awaiter(this, void 0, void 0, function () {
11345
+ var customDataValue, _a;
11346
+ return __generator(this, function (_b) {
11347
+ switch (_b.label) {
11348
+ case 0:
11349
+ if (this.value === undefined || this.value === null)
11350
+ return [2 /*return*/];
11351
+ _b.label = 1;
11352
+ case 1:
11353
+ _b.trys.push([1, 32, , 33]);
11354
+ _a = this.customData.type;
11355
+ switch (_a) {
11356
+ case IkasThemeCustomDataType.TEXT: return [3 /*break*/, 2];
11357
+ case IkasThemeCustomDataType.BOOLEAN: return [3 /*break*/, 4];
11358
+ case IkasThemeCustomDataType.BRAND_LIST: return [3 /*break*/, 6];
11359
+ case IkasThemeCustomDataType.BRAND: return [3 /*break*/, 8];
11360
+ case IkasThemeCustomDataType.CATEGORY_LIST: return [3 /*break*/, 10];
11361
+ case IkasThemeCustomDataType.CATEGORY: return [3 /*break*/, 12];
11362
+ case IkasThemeCustomDataType.COLOR: return [3 /*break*/, 14];
11363
+ case IkasThemeCustomDataType.IMAGE_LIST: return [3 /*break*/, 16];
11364
+ case IkasThemeCustomDataType.IMAGE: return [3 /*break*/, 18];
11365
+ case IkasThemeCustomDataType.LINK: return [3 /*break*/, 20];
11366
+ case IkasThemeCustomDataType.LIST_OF_LINK: return [3 /*break*/, 20];
11367
+ case IkasThemeCustomDataType.PRODUCT_DETAIL: return [3 /*break*/, 22];
11368
+ case IkasThemeCustomDataType.PRODUCT_LIST: return [3 /*break*/, 24];
11369
+ case IkasThemeCustomDataType.OBJECT: return [3 /*break*/, 26];
11370
+ case IkasThemeCustomDataType.DYNAMIC_LIST: return [3 /*break*/, 28];
11371
+ case IkasThemeCustomDataType.STATIC_LIST: return [3 /*break*/, 28];
11372
+ }
11373
+ return [3 /*break*/, 30];
11374
+ case 2: return [4 /*yield*/, this.getTextValue()];
11375
+ case 3:
11376
+ customDataValue = _b.sent();
11377
+ return [3 /*break*/, 31];
11378
+ case 4: return [4 /*yield*/, this.getBooleanValue()];
11379
+ case 5:
11380
+ customDataValue = _b.sent();
11381
+ return [3 /*break*/, 31];
11382
+ case 6: return [4 /*yield*/, this.getBrandListPropValue()];
11383
+ case 7:
11384
+ customDataValue = _b.sent();
11385
+ return [3 /*break*/, 31];
11386
+ case 8: return [4 /*yield*/, this.getBrandPropValue()];
11387
+ case 9:
11388
+ customDataValue = _b.sent();
11389
+ return [3 /*break*/, 31];
11390
+ case 10: return [4 /*yield*/, this.getCategoryListPropValue()];
11391
+ case 11:
11392
+ customDataValue = _b.sent();
11393
+ return [3 /*break*/, 31];
11394
+ case 12: return [4 /*yield*/, this.getCategoryPropValue()];
11395
+ case 13:
11396
+ customDataValue = _b.sent();
11397
+ return [3 /*break*/, 31];
11398
+ case 14: return [4 /*yield*/, this.getColorPropValue()];
11399
+ case 15:
11400
+ customDataValue = _b.sent();
11401
+ return [3 /*break*/, 31];
11402
+ case 16: return [4 /*yield*/, this.getImageListPropValue()];
11403
+ case 17:
11404
+ customDataValue = _b.sent();
11405
+ return [3 /*break*/, 31];
11406
+ case 18: return [4 /*yield*/, this.getImagePropValue()];
11407
+ case 19:
11408
+ customDataValue = _b.sent();
11409
+ return [3 /*break*/, 31];
11410
+ case 20: return [4 /*yield*/, this.getLinkPropValue()];
11411
+ case 21:
11412
+ customDataValue = _b.sent();
11413
+ return [3 /*break*/, 31];
11414
+ case 22: return [4 /*yield*/, this.getProductDetailPropValue()];
11415
+ case 23:
11416
+ customDataValue = _b.sent();
11417
+ return [3 /*break*/, 31];
11418
+ case 24: return [4 /*yield*/, this.getProductListPropValue()];
11419
+ case 25:
11420
+ customDataValue = _b.sent();
11421
+ return [3 /*break*/, 31];
11422
+ case 26: return [4 /*yield*/, this.getObjectValue()];
11423
+ case 27:
11424
+ customDataValue = _b.sent();
11425
+ return [3 /*break*/, 31];
11426
+ case 28: return [4 /*yield*/, this.getArrayValue()];
11427
+ case 29:
11428
+ customDataValue = _b.sent();
11429
+ return [3 /*break*/, 31];
11430
+ case 30: return [3 /*break*/, 31];
11431
+ case 31: return [3 /*break*/, 33];
11432
+ case 32:
11433
+ _b.sent();
11434
+ return [2 /*return*/];
11435
+ case 33: return [2 /*return*/, JSON.parse(JSON.stringify(customDataValue))];
11436
+ }
11437
+ });
11438
+ });
11439
+ };
11440
+ IkasCustomPropValueProvider.prototype.getBooleanValue = function () {
11441
+ return __awaiter(this, void 0, void 0, function () {
11442
+ var provider, value;
11443
+ return __generator(this, function (_a) {
11444
+ switch (_a.label) {
11445
+ case 0:
11446
+ provider = new IkasBooleanPropValueProvider(this.value);
11447
+ return [4 /*yield*/, provider.getValue()];
11448
+ case 1:
11449
+ value = _a.sent();
11450
+ return [2 /*return*/, {
11451
+ value: value,
11452
+ customData: this.customData,
11453
+ }];
11454
+ }
11455
+ });
11456
+ });
11457
+ };
11458
+ IkasCustomPropValueProvider.prototype.getBrandListPropValue = function () {
11459
+ return __awaiter(this, void 0, void 0, function () {
11460
+ var provider, value;
11461
+ return __generator(this, function (_a) {
11462
+ switch (_a.label) {
11463
+ case 0:
11464
+ provider = new IkasBrandListPropValueProvider(this.value);
11465
+ return [4 /*yield*/, provider.getValue()];
11466
+ case 1:
11467
+ value = _a.sent();
11468
+ return [2 /*return*/, {
11469
+ value: value,
11470
+ customData: this.customData,
11471
+ }];
11472
+ }
11473
+ });
11474
+ });
11475
+ };
11476
+ IkasCustomPropValueProvider.prototype.getBrandPropValue = function () {
11477
+ return __awaiter(this, void 0, void 0, function () {
11478
+ var provider, value;
11479
+ return __generator(this, function (_a) {
11480
+ switch (_a.label) {
11481
+ case 0:
11482
+ provider = new IkasBrandPropValueProvider(this.value, this.pageSpecificData);
11483
+ return [4 /*yield*/, provider.getValue()];
11484
+ case 1:
11485
+ value = _a.sent();
11486
+ return [2 /*return*/, {
11487
+ value: value,
11488
+ customData: this.customData,
11489
+ }];
11490
+ }
11491
+ });
11492
+ });
11493
+ };
11494
+ IkasCustomPropValueProvider.prototype.getCategoryListPropValue = function () {
11495
+ return __awaiter(this, void 0, void 0, function () {
11496
+ var provider, value;
11497
+ return __generator(this, function (_a) {
11498
+ switch (_a.label) {
11499
+ case 0:
11500
+ provider = new IkasCategoryListPropValueProvider(this.value);
11501
+ return [4 /*yield*/, provider.getValue()];
11502
+ case 1:
11503
+ value = _a.sent();
11504
+ return [2 /*return*/, {
11505
+ value: value,
11506
+ customData: this.customData,
11507
+ }];
11508
+ }
11509
+ });
11510
+ });
11511
+ };
11512
+ IkasCustomPropValueProvider.prototype.getCategoryPropValue = function () {
11513
+ return __awaiter(this, void 0, void 0, function () {
11514
+ var provider, value;
11515
+ return __generator(this, function (_a) {
11516
+ switch (_a.label) {
11517
+ case 0:
11518
+ provider = new IkasCategoryPropValueProvider(this.value, this.pageSpecificData);
11519
+ return [4 /*yield*/, provider.getValue()];
11520
+ case 1:
11521
+ value = _a.sent();
11522
+ return [2 /*return*/, {
11523
+ value: value,
11524
+ customData: this.customData,
11525
+ }];
11526
+ }
11527
+ });
11528
+ });
11529
+ };
11530
+ IkasCustomPropValueProvider.prototype.getColorPropValue = function () {
11531
+ return __awaiter(this, void 0, void 0, function () {
11532
+ var provider, value;
11533
+ return __generator(this, function (_a) {
11534
+ switch (_a.label) {
11535
+ case 0:
11536
+ provider = new IkasColorPropValueProvider(this.value);
11537
+ return [4 /*yield*/, provider.getValue()];
11538
+ case 1:
11539
+ value = _a.sent();
11540
+ return [2 /*return*/, {
11541
+ value: value,
11542
+ customData: this.customData,
11543
+ }];
11544
+ }
11545
+ });
11546
+ });
11547
+ };
11548
+ IkasCustomPropValueProvider.prototype.getImageListPropValue = function () {
11549
+ return __awaiter(this, void 0, void 0, function () {
11550
+ var provider, value;
11551
+ return __generator(this, function (_a) {
11552
+ switch (_a.label) {
11553
+ case 0:
11554
+ provider = new IkasImageListPropValueProvider(this.value);
11555
+ return [4 /*yield*/, provider.getValue()];
11556
+ case 1:
11557
+ value = _a.sent();
11558
+ return [2 /*return*/, {
11559
+ value: value,
11560
+ customData: this.customData,
11561
+ }];
11562
+ }
11563
+ });
11564
+ });
11565
+ };
11566
+ IkasCustomPropValueProvider.prototype.getImagePropValue = function () {
11567
+ return __awaiter(this, void 0, void 0, function () {
11568
+ var provider, value;
11569
+ return __generator(this, function (_a) {
11570
+ switch (_a.label) {
11571
+ case 0:
11572
+ provider = new IkasImagePropValueProvider(this.value);
11573
+ return [4 /*yield*/, provider.getValue()];
11574
+ case 1:
11575
+ value = _a.sent();
11576
+ return [2 /*return*/, {
11577
+ value: value,
11578
+ customData: this.customData,
11579
+ }];
11580
+ }
11581
+ });
11582
+ });
11583
+ };
11584
+ IkasCustomPropValueProvider.prototype.getLinkPropValue = function () {
11585
+ return __awaiter(this, void 0, void 0, function () {
11586
+ var provider, value;
11587
+ return __generator(this, function (_a) {
11588
+ switch (_a.label) {
11589
+ case 0:
11590
+ provider = new IkasLinkPropValueProvider(this.value, this.theme);
11591
+ return [4 /*yield*/, provider.getValue()];
11592
+ case 1:
11593
+ value = _a.sent();
11594
+ return [2 /*return*/, {
11595
+ value: value,
11596
+ customData: this.customData,
11597
+ }];
11598
+ }
11599
+ });
11600
+ });
11601
+ };
11602
+ IkasCustomPropValueProvider.prototype.getProductDetailPropValue = function () {
11603
+ return __awaiter(this, void 0, void 0, function () {
11604
+ var provider, value;
11605
+ return __generator(this, function (_a) {
11606
+ switch (_a.label) {
11607
+ case 0:
11608
+ provider = new IkasProductDetailPropValueProvider(this.value, this.pageSpecificData);
11609
+ return [4 /*yield*/, provider.getValue()];
11610
+ case 1:
11611
+ value = _a.sent();
11612
+ return [2 /*return*/, {
11613
+ value: value,
11614
+ customData: this.customData,
11615
+ }];
11616
+ }
11617
+ });
11618
+ });
11619
+ };
11620
+ IkasCustomPropValueProvider.prototype.getProductListPropValue = function () {
11621
+ return __awaiter(this, void 0, void 0, function () {
11622
+ var provider, value;
11623
+ return __generator(this, function (_a) {
11624
+ switch (_a.label) {
11625
+ case 0:
11626
+ provider = new IkasProductListPropValueProvider(this.pageType, this.value, this.pageParams || {}, this.pageSpecificData);
11627
+ return [4 /*yield*/, provider.getValue()];
11628
+ case 1:
11629
+ value = _a.sent();
11630
+ return [2 /*return*/, {
11631
+ value: value,
11632
+ customData: this.customData,
11633
+ }];
11634
+ }
11635
+ });
11636
+ });
11637
+ };
11638
+ IkasCustomPropValueProvider.prototype.getTextValue = function () {
11639
+ return __awaiter(this, void 0, void 0, function () {
11640
+ var provider, value;
11641
+ return __generator(this, function (_a) {
11642
+ switch (_a.label) {
11643
+ case 0:
11644
+ provider = new IkasTextPropValueProvider(this.value);
11645
+ return [4 /*yield*/, provider.getValue()];
11646
+ case 1:
11647
+ value = _a.sent();
11648
+ return [2 /*return*/, {
11649
+ value: value,
11650
+ customData: this.customData,
11651
+ }];
11652
+ }
11653
+ });
11654
+ });
11655
+ };
11656
+ IkasCustomPropValueProvider.prototype.getObjectValue = function () {
11657
+ return __awaiter(this, void 0, void 0, function () {
11658
+ var objectValue, _i, _a, nestedData, nestedValue, nestedProvider, _itemValue;
11659
+ return __generator(this, function (_b) {
11660
+ switch (_b.label) {
11661
+ case 0:
11662
+ objectValue = {};
11663
+ _i = 0, _a = this.customData.nestedData || [];
11664
+ _b.label = 1;
11665
+ case 1:
11666
+ if (!(_i < _a.length)) return [3 /*break*/, 4];
11667
+ nestedData = _a[_i];
11668
+ if (!nestedData.key)
11669
+ return [3 /*break*/, 3];
11670
+ nestedValue = this.value[nestedData.key];
11671
+ if (nestedData.isRequired &&
11672
+ (nestedValue === undefined || nestedValue === null))
11673
+ throw new Error("Required data is missing");
11674
+ nestedProvider = new IkasCustomPropValueProvider(nestedValue, nestedData, this.theme, this.pageSpecificData);
11675
+ return [4 /*yield*/, nestedProvider.getValue()];
11676
+ case 2:
11677
+ _itemValue = _b.sent();
11678
+ if (nestedData.isRequired &&
11679
+ (_itemValue === null || _itemValue === undefined))
11680
+ throw new Error("Required data is missing");
11681
+ objectValue[nestedData.key] = _itemValue;
11682
+ _b.label = 3;
11683
+ case 3:
11684
+ _i++;
11685
+ return [3 /*break*/, 1];
11686
+ case 4: return [2 /*return*/, {
11687
+ value: objectValue,
11688
+ customData: this.customData,
11689
+ }];
11690
+ }
11691
+ });
11692
+ });
11693
+ };
11694
+ IkasCustomPropValueProvider.prototype.getArrayValue = function () {
11695
+ return __awaiter(this, void 0, void 0, function () {
11696
+ var value, nestedData, _i, _a, itemValue, provider, _itemValue;
11697
+ return __generator(this, function (_b) {
11698
+ switch (_b.label) {
11699
+ case 0:
11700
+ if (!this.value || !Array.isArray(this.value))
11701
+ throw new Error("Incorrect data!");
11702
+ value = [];
11703
+ nestedData = this.customData.nestedData[0];
11704
+ _i = 0, _a = this.value;
11705
+ _b.label = 1;
11706
+ case 1:
11707
+ if (!(_i < _a.length)) return [3 /*break*/, 4];
11708
+ itemValue = _a[_i];
11709
+ if (nestedData.isRequired &&
11710
+ (itemValue === undefined || itemValue === null))
11711
+ throw new Error("Required data is missing");
11712
+ provider = new IkasCustomPropValueProvider(itemValue, nestedData, this.theme, this.pageSpecificData);
11713
+ return [4 /*yield*/, provider.getValue()];
11714
+ case 2:
11715
+ _itemValue = _b.sent();
11716
+ if (nestedData.isRequired &&
11717
+ (_itemValue === null || _itemValue === undefined)) {
11718
+ throw new Error("Required data is missing");
11719
+ }
11720
+ else
11721
+ value.push(_itemValue);
11722
+ _b.label = 3;
11723
+ case 3:
11724
+ _i++;
11725
+ return [3 /*break*/, 1];
11726
+ case 4: return [2 /*return*/, {
11727
+ value: value,
11728
+ customData: this.customData,
11729
+ }];
11730
+ }
11731
+ });
11732
+ });
11733
+ };
11734
+ return IkasCustomPropValueProvider;
11735
+ }());
11736
+
11337
11737
  var IkasPageDataProvider = /** @class */ (function () {
11338
11738
  function IkasPageDataProvider(theme, pageParams, pageType) {
11339
11739
  this.pageType = null;
@@ -11596,7 +11996,7 @@ var IkasPageDataProvider = /** @class */ (function () {
11596
11996
  };
11597
11997
  IkasPageDataProvider.prototype.getPageComponentPropValue = function (pageComponent, prop) {
11598
11998
  return __awaiter(this, void 0, void 0, function () {
11599
- var propValueProvider, propValue;
11999
+ var propValueProvider, propValue, customData;
11600
12000
  return __generator(this, function (_a) {
11601
12001
  switch (_a.label) {
11602
12002
  case 0:
@@ -11641,6 +12041,12 @@ var IkasPageDataProvider = /** @class */ (function () {
11641
12041
  case IkasThemeComponentPropType.COLOR:
11642
12042
  propValueProvider = new IkasColorPropValueProvider(propValue);
11643
12043
  break;
12044
+ case IkasThemeComponentPropType.CUSTOM:
12045
+ customData = this.theme.customData.find(function (cd) { return cd.id === prop.customDataId; });
12046
+ if (!customData)
12047
+ return [2 /*return*/];
12048
+ propValueProvider = new IkasCustomPropValueProvider(propValue, customData, this.theme, this.pageType, this.pageSpecificData, this.pageParams);
12049
+ break;
11644
12050
  }
11645
12051
  return [4 /*yield*/, (propValueProvider === null || propValueProvider === void 0 ? void 0 : propValueProvider.getValue())];
11646
12052
  case 1: return [2 /*return*/, _a.sent()];
@@ -11698,32 +12104,49 @@ var IkasPageDataProvider = /** @class */ (function () {
11698
12104
  case IkasThemeComponentPropType.LIST_OF_LINK:
11699
12105
  IkasPageDataProvider.initLinkPropValue(prop, propValue, pageComponentPropValue);
11700
12106
  break;
12107
+ case IkasThemeComponentPropType.CUSTOM:
12108
+ IkasPageDataProvider.initCustomDataPropValue(prop, propValue, pageComponentPropValue, router, isBrowser);
12109
+ break;
11701
12110
  }
11702
12111
  });
11703
12112
  });
11704
12113
  return pageComponentPropValues;
11705
12114
  };
11706
12115
  IkasPageDataProvider.initBrandPropValue = function (prop, propValue, pageComponentPropValue) {
11707
- var brand = new IkasBrand(propValue);
11708
- pageComponentPropValue.propValues[prop.name] = brand;
12116
+ pageComponentPropValue.propValues[prop.name] = IkasPageDataProvider._initBrandPropValue(propValue);
12117
+ };
12118
+ IkasPageDataProvider._initBrandPropValue = function (propValue) {
12119
+ return new IkasBrand(propValue);
11709
12120
  };
11710
12121
  IkasPageDataProvider.initBrandListPropValue = function (prop, propValue, pageComponentPropValue) {
11711
- var brandList = new IkasBrandList(propValue);
11712
- pageComponentPropValue.propValues[prop.name] = brandList;
12122
+ pageComponentPropValue.propValues[prop.name] = IkasPageDataProvider._initBrandListPropValue(propValue);
12123
+ };
12124
+ IkasPageDataProvider._initBrandListPropValue = function (propValue) {
12125
+ return new IkasBrandList(propValue);
11713
12126
  };
11714
12127
  IkasPageDataProvider.initCategoryPropValue = function (prop, propValue, pageComponentPropValue) {
11715
- var category = new IkasCategory(propValue);
11716
- pageComponentPropValue.propValues[prop.name] = category;
12128
+ pageComponentPropValue.propValues[prop.name] = IkasPageDataProvider._initCategoryPropValue(propValue);
12129
+ };
12130
+ IkasPageDataProvider._initCategoryPropValue = function (propValue) {
12131
+ return new IkasCategory(propValue);
11717
12132
  };
11718
12133
  IkasPageDataProvider.initCategoryListPropValue = function (prop, propValue, pageComponentPropValue) {
11719
12134
  var categoryList = new IkasCategoryList(propValue);
11720
12135
  pageComponentPropValue.propValues[prop.name] = categoryList;
11721
12136
  };
12137
+ IkasPageDataProvider._initCategoryListPropValue = function (propValue) {
12138
+ return new IkasCategoryList(propValue);
12139
+ };
11722
12140
  IkasPageDataProvider.initProductListPropValue = function (prop, propValue, pageComponentPropValue) {
11723
- var productList = new IkasProductList(propValue);
11724
- pageComponentPropValue.propValues[prop.name] = productList;
12141
+ pageComponentPropValue.propValues[prop.name] = this._initProductListPropValue(propValue);
12142
+ };
12143
+ IkasPageDataProvider._initProductListPropValue = function (propValue) {
12144
+ return new IkasProductList(propValue);
11725
12145
  };
11726
12146
  IkasPageDataProvider.initProductDetailPropValue = function (prop, propValue, pageComponentPropValue, router, isBrowser) {
12147
+ pageComponentPropValue.propValues[prop.name] = this._initProductDetailPropValue(propValue, router, isBrowser);
12148
+ };
12149
+ IkasPageDataProvider._initProductDetailPropValue = function (propValue, router, isBrowser) {
11727
12150
  var usePageData = propValue.usePageData;
11728
12151
  var _propValue = propValue;
11729
12152
  var productDetail = new IkasProductDetail(_propValue.product, _propValue.selectedVariantValues);
@@ -11737,23 +12160,92 @@ var IkasPageDataProvider = /** @class */ (function () {
11737
12160
  }
11738
12161
  }
11739
12162
  }
11740
- pageComponentPropValue.propValues[prop.name] = new IkasProductDetail(productDetail.product, productDetail.selectedVariantValues, usePageData, router);
12163
+ return new IkasProductDetail(productDetail.product, productDetail.selectedVariantValues, usePageData, router);
11741
12164
  };
11742
12165
  IkasPageDataProvider.initLinkPropValue = function (prop, propValue, pageComponentPropValue) {
12166
+ pageComponentPropValue.propValues[prop.name] = this._initLinkPropValue(propValue);
12167
+ };
12168
+ IkasPageDataProvider._initLinkPropValue = function (propValue) {
11743
12169
  if (Array.isArray(propValue)) {
11744
- pageComponentPropValue.propValues[prop.name] = propValue.map(function (p) {
12170
+ return propValue.map(function (p) {
11745
12171
  return new IkasNavigationLink(p.href, p.label, p.subLinks, p.isExternal || undefined);
11746
12172
  });
11747
12173
  }
11748
12174
  else if (propValue) {
11749
- pageComponentPropValue.propValues[prop.name] = new IkasNavigationLink(propValue.href, propValue.label, propValue.subLinks, propValue.isExternal);
12175
+ return new IkasNavigationLink(propValue.href, propValue.label, propValue.subLinks, propValue.isExternal);
11750
12176
  }
11751
12177
  };
11752
12178
  IkasPageDataProvider.initImagePropValue = function (prop, propValue, pageComponentPropValue) {
11753
- pageComponentPropValue.propValues[prop.name] = new IkasImage(propValue.id);
12179
+ pageComponentPropValue.propValues[prop.name] = this._initImagePropValue(propValue);
12180
+ };
12181
+ IkasPageDataProvider._initImagePropValue = function (propValue) {
12182
+ return new IkasImage(propValue.id);
11754
12183
  };
11755
12184
  IkasPageDataProvider.initImageListPropValue = function (prop, propValue, pageComponentPropValue) {
11756
- pageComponentPropValue.propValues[prop.name] = propValue.map(function (i) { return new IkasImage(i.id); });
12185
+ pageComponentPropValue.propValues[prop.name] = this._initImageListPropValue(propValue);
12186
+ };
12187
+ IkasPageDataProvider._initImageListPropValue = function (propValue) {
12188
+ return propValue.map(function (i) { return new IkasImage(i.id); });
12189
+ };
12190
+ IkasPageDataProvider.initCustomDataPropValue = function (prop, customDataValue, pageComponentPropValue, router, isBrowser) {
12191
+ if (!customDataValue ||
12192
+ !customDataValue.value ||
12193
+ !customDataValue.customData)
12194
+ return;
12195
+ pageComponentPropValue.propValues[prop.name] = this._initCustomDataPropValue(customDataValue, customDataValue.customData, router, isBrowser);
12196
+ };
12197
+ IkasPageDataProvider._initCustomDataPropValue = function (customDataValue, customData, router, isBrowser) {
12198
+ var _this = this;
12199
+ if (!customDataValue)
12200
+ return null;
12201
+ var propValue = customDataValue.value;
12202
+ if (propValue === null || propValue === undefined)
12203
+ return null;
12204
+ switch (customData.type) {
12205
+ case IkasThemeCustomDataType.BRAND:
12206
+ return this._initBrandPropValue(propValue);
12207
+ case IkasThemeCustomDataType.BRAND_LIST:
12208
+ return this._initBrandListPropValue(propValue);
12209
+ case IkasThemeCustomDataType.CATEGORY_LIST:
12210
+ return this._initCategoryListPropValue(propValue);
12211
+ case IkasThemeCustomDataType.CATEGORY:
12212
+ return this._initCategoryPropValue(propValue);
12213
+ case IkasThemeCustomDataType.IMAGE_LIST:
12214
+ return this._initImageListPropValue(propValue);
12215
+ case IkasThemeCustomDataType.IMAGE:
12216
+ return this._initImagePropValue(propValue);
12217
+ case IkasThemeCustomDataType.LINK:
12218
+ return this._initLinkPropValue(propValue);
12219
+ case IkasThemeCustomDataType.PRODUCT_DETAIL:
12220
+ return this._initProductDetailPropValue(propValue, router, isBrowser);
12221
+ case IkasThemeCustomDataType.PRODUCT_LIST:
12222
+ return this._initProductListPropValue(propValue);
12223
+ case IkasThemeCustomDataType.OBJECT:
12224
+ var objectValue = {};
12225
+ for (var _i = 0, _a = customData.nestedData || []; _i < _a.length; _i++) {
12226
+ var nestedCustomData = _a[_i];
12227
+ var value = propValue[nestedCustomData.key];
12228
+ objectValue[nestedCustomData.key] = this._initCustomDataPropValue(value, nestedCustomData, router, isBrowser);
12229
+ }
12230
+ return objectValue;
12231
+ case IkasThemeCustomDataType.DYNAMIC_LIST:
12232
+ case IkasThemeCustomDataType.STATIC_LIST:
12233
+ try {
12234
+ if (!propValue || !propValue.length)
12235
+ return null;
12236
+ var listValue_1 = [];
12237
+ var nestedCustomData_1 = customData.nestedData[0];
12238
+ propValue.forEach(function (itemValue) {
12239
+ listValue_1.push(_this._initCustomDataPropValue(itemValue, nestedCustomData_1, router, isBrowser));
12240
+ });
12241
+ return listValue_1;
12242
+ }
12243
+ catch (err) {
12244
+ return [];
12245
+ }
12246
+ default:
12247
+ return propValue;
12248
+ }
11757
12249
  };
11758
12250
  return IkasPageDataProvider;
11759
12251
  }());
@@ -12910,6 +13402,7 @@ var IkasThemeComponentProp = /** @class */ (function () {
12910
13402
  this.displayName = data.displayName || "";
12911
13403
  this.type = data.type || IkasThemeComponentPropType.TEXT;
12912
13404
  this.isRequired = data.isRequired || false;
13405
+ this.customDataId = data.customDataId || null;
12913
13406
  makeAutoObservable(this);
12914
13407
  }
12915
13408
  return IkasThemeComponentProp;
@@ -12929,6 +13422,7 @@ var IkasThemeComponentPropType;
12929
13422
  IkasThemeComponentPropType["CATEGORY"] = "CATEGORY";
12930
13423
  IkasThemeComponentPropType["CATEGORY_LIST"] = "CATEGORY_LIST";
12931
13424
  IkasThemeComponentPropType["COLOR"] = "COLOR";
13425
+ IkasThemeComponentPropType["CUSTOM"] = "CUSTOM";
12932
13426
  // TODO number
12933
13427
  // TODO productAttribute
12934
13428
  })(IkasThemeComponentPropType || (IkasThemeComponentPropType = {}));
@@ -12948,6 +13442,55 @@ var IkasThemeComponent = /** @class */ (function () {
12948
13442
  return IkasThemeComponent;
12949
13443
  }());
12950
13444
 
13445
+ var IkasThemeCustomData = /** @class */ (function () {
13446
+ function IkasThemeCustomData(data) {
13447
+ var _this = this;
13448
+ if (data === void 0) { data = {}; }
13449
+ this.id = data.id || "";
13450
+ this.name = data.name || null;
13451
+ this.type = data.type || IkasThemeCustomDataType.TEXT;
13452
+ this.isRequired = data.isRequired !== undefined ? data.isRequired : true;
13453
+ this.key = data.key || null;
13454
+ this.parent = data.parent || null;
13455
+ this.itemCount = data.itemCount || null;
13456
+ this.isRoot = data.isRoot || false;
13457
+ this.nestedData = data.nestedData
13458
+ ? data.nestedData.map(function (nd) {
13459
+ return new IkasThemeCustomData(__assign(__assign({}, nd), { parent: _this }));
13460
+ })
13461
+ : null;
13462
+ if (this.type === IkasThemeCustomDataType.STATIC_LIST && !this.itemCount)
13463
+ this.itemCount = 1;
13464
+ makeAutoObservable(this);
13465
+ }
13466
+ IkasThemeCustomData.prototype.toJSON = function () {
13467
+ var obj = __assign({}, this);
13468
+ delete obj.parent;
13469
+ return obj;
13470
+ };
13471
+ return IkasThemeCustomData;
13472
+ }());
13473
+ var IkasThemeCustomDataType;
13474
+ (function (IkasThemeCustomDataType) {
13475
+ IkasThemeCustomDataType["TEXT"] = "TEXT";
13476
+ IkasThemeCustomDataType["NUMBER"] = "NUMBER";
13477
+ IkasThemeCustomDataType["BOOLEAN"] = "BOOLEAN";
13478
+ IkasThemeCustomDataType["IMAGE"] = "IMAGE";
13479
+ IkasThemeCustomDataType["IMAGE_LIST"] = "IMAGE_LIST";
13480
+ IkasThemeCustomDataType["LINK"] = "LINK";
13481
+ IkasThemeCustomDataType["LIST_OF_LINK"] = "LIST_OF_LINK";
13482
+ IkasThemeCustomDataType["PRODUCT_DETAIL"] = "PRODUCT_DETAIL";
13483
+ IkasThemeCustomDataType["PRODUCT_LIST"] = "PRODUCT_LIST";
13484
+ IkasThemeCustomDataType["BRAND"] = "BRAND";
13485
+ IkasThemeCustomDataType["BRAND_LIST"] = "BRAND_LIST";
13486
+ IkasThemeCustomDataType["CATEGORY"] = "CATEGORY";
13487
+ IkasThemeCustomDataType["CATEGORY_LIST"] = "CATEGORY_LIST";
13488
+ IkasThemeCustomDataType["COLOR"] = "COLOR";
13489
+ IkasThemeCustomDataType["OBJECT"] = "OBJECT";
13490
+ IkasThemeCustomDataType["STATIC_LIST"] = "STATIC_LIST";
13491
+ IkasThemeCustomDataType["DYNAMIC_LIST"] = "DYNAMIC_LIST";
13492
+ })(IkasThemeCustomDataType || (IkasThemeCustomDataType = {}));
13493
+
12951
13494
  var IkasThemePageComponent = /** @class */ (function () {
12952
13495
  function IkasThemePageComponent(data) {
12953
13496
  this.id = data.id || "";
@@ -13016,6 +13559,7 @@ var IkasThemeSettings = /** @class */ (function () {
13016
13559
  var IkasTheme = /** @class */ (function () {
13017
13560
  function IkasTheme(data) {
13018
13561
  if (data === void 0) { data = {}; }
13562
+ var _a;
13019
13563
  this.name = data.name || "";
13020
13564
  this.components = data.components
13021
13565
  ? data.components.map(function (c) { return new IkasThemeComponent(c); })
@@ -13024,6 +13568,8 @@ var IkasTheme = /** @class */ (function () {
13024
13568
  this.settings = data.settings
13025
13569
  ? new IkasThemeSettings(data.settings)
13026
13570
  : new IkasThemeSettings();
13571
+ this.customData = data.customData
13572
+ ? (_a = data.customData) === null || _a === void 0 ? void 0 : _a.map(function (cd) { return new IkasThemeCustomData(cd); }) : [];
13027
13573
  makeAutoObservable(this);
13028
13574
  }
13029
13575
  Object.defineProperty(IkasTheme.prototype, "headerComponent", {
@@ -24874,8 +25420,12 @@ var PageViewModel = /** @class */ (function () {
24874
25420
  case 1:
24875
25421
  propValue = _d.sent();
24876
25422
  runInAction(function () {
24877
- if (pageComponentPropValues)
25423
+ if (pageComponentPropValues) {
24878
25424
  pageComponentPropValues.propValues[propName] = propValue;
25425
+ if (prop.type === IkasThemeComponentPropType.CUSTOM) {
25426
+ IkasPageDataProvider.initCustomDataPropValue(prop, propValue, pageComponentPropValues, _this.router, true);
25427
+ }
25428
+ }
24879
25429
  });
24880
25430
  return [2 /*return*/];
24881
25431
  }
@@ -25660,4 +26210,4 @@ var IkasBaseStore = /** @class */ (function () {
25660
26210
  return IkasBaseStore;
25661
26211
  }());
25662
26212
 
25663
- 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, IkasProductList, IkasProductListFilter, IkasProductListPropValue, IkasProductListSortType, IkasProductListType, IkasProductPrice, IkasProductType, IkasProductVariant, IkasProductVariantType, IkasShippingMethod, IkasShippingMethodEnum, IkasStateAPI, IkasStorefrontAPI, IkasStorefrontConfig, IkasTheme, IkasThemeAPI, IkasThemeComponent, IkasThemeComponentProp, IkasThemeComponentPropType, IkasThemePage, IkasThemePageComponent, IkasThemePageType, IkasThemeSettings, IkasTransactionStatusEnum, IkasTransactionTypeEnum, IkasVariantSelectionType, IkasVariantType, IkasVariantTypeAPI, IkasVariantValue, home as IndexPage, LessThanRule, LoginForm, login as LoginPage, MaxRule, MinRule, _id_$2 as OrderDetailPage, index$4 as OrdersPage, PhoneRule, RecoverPasswordForm, recoverPassword as RecoverPasswordPage, RegisterForm, register as RegisterPage, RequiredRule, index$2 as SlugPage, ValidationRule, Validator, ValidatorErrorType, apollo, decodeBase64, formatMoney, pascalCase, stringToSlug, validatePhoneNumber };
26213
+ 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, IkasProductList, IkasProductListFilter, IkasProductListPropValue, IkasProductListSortType, IkasProductListType, IkasProductPrice, 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, home as IndexPage, LessThanRule, LoginForm, login as LoginPage, MaxRule, MinRule, _id_$2 as OrderDetailPage, index$4 as OrdersPage, PhoneRule, RecoverPasswordForm, recoverPassword as RecoverPasswordPage, RegisterForm, register as RegisterPage, RequiredRule, index$2 as SlugPage, ValidationRule, Validator, ValidatorErrorType, apollo, decodeBase64, formatMoney, pascalCase, stringToSlug, validatePhoneNumber };