@ikas/storefront 0.0.44 → 0.0.46

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
@@ -11331,6 +11331,409 @@ var IkasCategoryListPropValueProvider = /** @class */ (function () {
11331
11331
  return IkasCategoryListPropValueProvider;
11332
11332
  }());
11333
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
+
11334
11737
  var IkasPageDataProvider = /** @class */ (function () {
11335
11738
  function IkasPageDataProvider(theme, pageParams, pageType) {
11336
11739
  this.pageType = null;
@@ -11593,7 +11996,7 @@ var IkasPageDataProvider = /** @class */ (function () {
11593
11996
  };
11594
11997
  IkasPageDataProvider.prototype.getPageComponentPropValue = function (pageComponent, prop) {
11595
11998
  return __awaiter(this, void 0, void 0, function () {
11596
- var propValueProvider, propValue;
11999
+ var propValueProvider, propValue, customData;
11597
12000
  return __generator(this, function (_a) {
11598
12001
  switch (_a.label) {
11599
12002
  case 0:
@@ -11638,6 +12041,12 @@ var IkasPageDataProvider = /** @class */ (function () {
11638
12041
  case IkasThemeComponentPropType.COLOR:
11639
12042
  propValueProvider = new IkasColorPropValueProvider(propValue);
11640
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;
11641
12050
  }
11642
12051
  return [4 /*yield*/, (propValueProvider === null || propValueProvider === void 0 ? void 0 : propValueProvider.getValue())];
11643
12052
  case 1: return [2 /*return*/, _a.sent()];
@@ -11695,32 +12104,49 @@ var IkasPageDataProvider = /** @class */ (function () {
11695
12104
  case IkasThemeComponentPropType.LIST_OF_LINK:
11696
12105
  IkasPageDataProvider.initLinkPropValue(prop, propValue, pageComponentPropValue);
11697
12106
  break;
12107
+ case IkasThemeComponentPropType.CUSTOM:
12108
+ IkasPageDataProvider.initCustomDataPropValue(prop, propValue, pageComponentPropValue, router, isBrowser);
12109
+ break;
11698
12110
  }
11699
12111
  });
11700
12112
  });
11701
12113
  return pageComponentPropValues;
11702
12114
  };
11703
12115
  IkasPageDataProvider.initBrandPropValue = function (prop, propValue, pageComponentPropValue) {
11704
- var brand = new IkasBrand(propValue);
11705
- pageComponentPropValue.propValues[prop.name] = brand;
12116
+ pageComponentPropValue.propValues[prop.name] = IkasPageDataProvider._initBrandPropValue(propValue);
12117
+ };
12118
+ IkasPageDataProvider._initBrandPropValue = function (propValue) {
12119
+ return new IkasBrand(propValue);
11706
12120
  };
11707
12121
  IkasPageDataProvider.initBrandListPropValue = function (prop, propValue, pageComponentPropValue) {
11708
- var brandList = new IkasBrandList(propValue);
11709
- pageComponentPropValue.propValues[prop.name] = brandList;
12122
+ pageComponentPropValue.propValues[prop.name] = IkasPageDataProvider._initBrandListPropValue(propValue);
12123
+ };
12124
+ IkasPageDataProvider._initBrandListPropValue = function (propValue) {
12125
+ return new IkasBrandList(propValue);
11710
12126
  };
11711
12127
  IkasPageDataProvider.initCategoryPropValue = function (prop, propValue, pageComponentPropValue) {
11712
- var category = new IkasCategory(propValue);
11713
- pageComponentPropValue.propValues[prop.name] = category;
12128
+ pageComponentPropValue.propValues[prop.name] = IkasPageDataProvider._initCategoryPropValue(propValue);
12129
+ };
12130
+ IkasPageDataProvider._initCategoryPropValue = function (propValue) {
12131
+ return new IkasCategory(propValue);
11714
12132
  };
11715
12133
  IkasPageDataProvider.initCategoryListPropValue = function (prop, propValue, pageComponentPropValue) {
11716
12134
  var categoryList = new IkasCategoryList(propValue);
11717
12135
  pageComponentPropValue.propValues[prop.name] = categoryList;
11718
12136
  };
12137
+ IkasPageDataProvider._initCategoryListPropValue = function (propValue) {
12138
+ return new IkasCategoryList(propValue);
12139
+ };
11719
12140
  IkasPageDataProvider.initProductListPropValue = function (prop, propValue, pageComponentPropValue) {
11720
- var productList = new IkasProductList(propValue);
11721
- pageComponentPropValue.propValues[prop.name] = productList;
12141
+ pageComponentPropValue.propValues[prop.name] = this._initProductListPropValue(propValue);
12142
+ };
12143
+ IkasPageDataProvider._initProductListPropValue = function (propValue) {
12144
+ return new IkasProductList(propValue);
11722
12145
  };
11723
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) {
11724
12150
  var usePageData = propValue.usePageData;
11725
12151
  var _propValue = propValue;
11726
12152
  var productDetail = new IkasProductDetail(_propValue.product, _propValue.selectedVariantValues);
@@ -11734,23 +12160,92 @@ var IkasPageDataProvider = /** @class */ (function () {
11734
12160
  }
11735
12161
  }
11736
12162
  }
11737
- pageComponentPropValue.propValues[prop.name] = new IkasProductDetail(productDetail.product, productDetail.selectedVariantValues, usePageData, router);
12163
+ return new IkasProductDetail(productDetail.product, productDetail.selectedVariantValues, usePageData, router);
11738
12164
  };
11739
12165
  IkasPageDataProvider.initLinkPropValue = function (prop, propValue, pageComponentPropValue) {
12166
+ pageComponentPropValue.propValues[prop.name] = this._initLinkPropValue(propValue);
12167
+ };
12168
+ IkasPageDataProvider._initLinkPropValue = function (propValue) {
11740
12169
  if (Array.isArray(propValue)) {
11741
- pageComponentPropValue.propValues[prop.name] = propValue.map(function (p) {
12170
+ return propValue.map(function (p) {
11742
12171
  return new IkasNavigationLink(p.href, p.label, p.subLinks, p.isExternal || undefined);
11743
12172
  });
11744
12173
  }
11745
12174
  else if (propValue) {
11746
- 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);
11747
12176
  }
11748
12177
  };
11749
12178
  IkasPageDataProvider.initImagePropValue = function (prop, propValue, pageComponentPropValue) {
11750
- 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);
11751
12183
  };
11752
12184
  IkasPageDataProvider.initImageListPropValue = function (prop, propValue, pageComponentPropValue) {
11753
- 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
+ }
11754
12249
  };
11755
12250
  return IkasPageDataProvider;
11756
12251
  }());
@@ -11821,10 +12316,7 @@ var IkasImage = /** @class */ (function () {
11821
12316
  });
11822
12317
  Object.defineProperty(IkasImage.prototype, "src", {
11823
12318
  get: function () {
11824
- if (this.id.includes("/"))
11825
- return "" + process.env.NEXT_PUBLIC_IMG_BASE_URL + this.id + "/1920/1920/img.webp";
11826
- var merchantId = decodeBase64(this.editorApiKey || IkasStorefrontConfig.config.apiKey || "");
11827
- return "" + process.env.NEXT_PUBLIC_IMG_BASE_URL + merchantId + "/" + this.id + "/1920/1920/img.webp";
12319
+ return this.getSrc(1920);
11828
12320
  },
11829
12321
  enumerable: false,
11830
12322
  configurable: true
@@ -11839,6 +12331,12 @@ var IkasImage = /** @class */ (function () {
11839
12331
  enumerable: false,
11840
12332
  configurable: true
11841
12333
  });
12334
+ IkasImage.prototype.getSrc = function (size) {
12335
+ if (this.id.includes("/"))
12336
+ return "" + process.env.NEXT_PUBLIC_IMG_BASE_URL + this.id + "/" + size + "/" + size + "/img.webp";
12337
+ var merchantId = decodeBase64(this.editorApiKey || IkasStorefrontConfig.config.apiKey || "");
12338
+ return "" + process.env.NEXT_PUBLIC_IMG_BASE_URL + merchantId + "/" + this.id + "/" + size + "/" + size + "/img.webp";
12339
+ };
11842
12340
  return IkasImage;
11843
12341
  }());
11844
12342
 
@@ -12907,6 +13405,7 @@ var IkasThemeComponentProp = /** @class */ (function () {
12907
13405
  this.displayName = data.displayName || "";
12908
13406
  this.type = data.type || IkasThemeComponentPropType.TEXT;
12909
13407
  this.isRequired = data.isRequired || false;
13408
+ this.customDataId = data.customDataId || null;
12910
13409
  makeAutoObservable(this);
12911
13410
  }
12912
13411
  return IkasThemeComponentProp;
@@ -12926,6 +13425,7 @@ var IkasThemeComponentPropType;
12926
13425
  IkasThemeComponentPropType["CATEGORY"] = "CATEGORY";
12927
13426
  IkasThemeComponentPropType["CATEGORY_LIST"] = "CATEGORY_LIST";
12928
13427
  IkasThemeComponentPropType["COLOR"] = "COLOR";
13428
+ IkasThemeComponentPropType["CUSTOM"] = "CUSTOM";
12929
13429
  // TODO number
12930
13430
  // TODO productAttribute
12931
13431
  })(IkasThemeComponentPropType || (IkasThemeComponentPropType = {}));
@@ -12945,6 +13445,55 @@ var IkasThemeComponent = /** @class */ (function () {
12945
13445
  return IkasThemeComponent;
12946
13446
  }());
12947
13447
 
13448
+ var IkasThemeCustomData = /** @class */ (function () {
13449
+ function IkasThemeCustomData(data) {
13450
+ var _this = this;
13451
+ if (data === void 0) { data = {}; }
13452
+ this.id = data.id || "";
13453
+ this.name = data.name || null;
13454
+ this.type = data.type || IkasThemeCustomDataType.TEXT;
13455
+ this.isRequired = data.isRequired !== undefined ? data.isRequired : true;
13456
+ this.key = data.key || null;
13457
+ this.parent = data.parent || null;
13458
+ this.itemCount = data.itemCount || null;
13459
+ this.isRoot = data.isRoot || false;
13460
+ this.nestedData = data.nestedData
13461
+ ? data.nestedData.map(function (nd) {
13462
+ return new IkasThemeCustomData(__assign(__assign({}, nd), { parent: _this }));
13463
+ })
13464
+ : null;
13465
+ if (this.type === IkasThemeCustomDataType.STATIC_LIST && !this.itemCount)
13466
+ this.itemCount = 1;
13467
+ makeAutoObservable(this);
13468
+ }
13469
+ IkasThemeCustomData.prototype.toJSON = function () {
13470
+ var obj = __assign({}, this);
13471
+ delete obj.parent;
13472
+ return obj;
13473
+ };
13474
+ return IkasThemeCustomData;
13475
+ }());
13476
+ var IkasThemeCustomDataType;
13477
+ (function (IkasThemeCustomDataType) {
13478
+ IkasThemeCustomDataType["TEXT"] = "TEXT";
13479
+ IkasThemeCustomDataType["NUMBER"] = "NUMBER";
13480
+ IkasThemeCustomDataType["BOOLEAN"] = "BOOLEAN";
13481
+ IkasThemeCustomDataType["IMAGE"] = "IMAGE";
13482
+ IkasThemeCustomDataType["IMAGE_LIST"] = "IMAGE_LIST";
13483
+ IkasThemeCustomDataType["LINK"] = "LINK";
13484
+ IkasThemeCustomDataType["LIST_OF_LINK"] = "LIST_OF_LINK";
13485
+ IkasThemeCustomDataType["PRODUCT_DETAIL"] = "PRODUCT_DETAIL";
13486
+ IkasThemeCustomDataType["PRODUCT_LIST"] = "PRODUCT_LIST";
13487
+ IkasThemeCustomDataType["BRAND"] = "BRAND";
13488
+ IkasThemeCustomDataType["BRAND_LIST"] = "BRAND_LIST";
13489
+ IkasThemeCustomDataType["CATEGORY"] = "CATEGORY";
13490
+ IkasThemeCustomDataType["CATEGORY_LIST"] = "CATEGORY_LIST";
13491
+ IkasThemeCustomDataType["COLOR"] = "COLOR";
13492
+ IkasThemeCustomDataType["OBJECT"] = "OBJECT";
13493
+ IkasThemeCustomDataType["STATIC_LIST"] = "STATIC_LIST";
13494
+ IkasThemeCustomDataType["DYNAMIC_LIST"] = "DYNAMIC_LIST";
13495
+ })(IkasThemeCustomDataType || (IkasThemeCustomDataType = {}));
13496
+
12948
13497
  var IkasThemePageComponent = /** @class */ (function () {
12949
13498
  function IkasThemePageComponent(data) {
12950
13499
  this.id = data.id || "";
@@ -13013,6 +13562,7 @@ var IkasThemeSettings = /** @class */ (function () {
13013
13562
  var IkasTheme = /** @class */ (function () {
13014
13563
  function IkasTheme(data) {
13015
13564
  if (data === void 0) { data = {}; }
13565
+ var _a;
13016
13566
  this.name = data.name || "";
13017
13567
  this.components = data.components
13018
13568
  ? data.components.map(function (c) { return new IkasThemeComponent(c); })
@@ -13021,6 +13571,8 @@ var IkasTheme = /** @class */ (function () {
13021
13571
  this.settings = data.settings
13022
13572
  ? new IkasThemeSettings(data.settings)
13023
13573
  : new IkasThemeSettings();
13574
+ this.customData = data.customData
13575
+ ? (_a = data.customData) === null || _a === void 0 ? void 0 : _a.map(function (cd) { return new IkasThemeCustomData(cd); }) : [];
13024
13576
  makeAutoObservable(this);
13025
13577
  }
13026
13578
  Object.defineProperty(IkasTheme.prototype, "headerComponent", {
@@ -24871,8 +25423,12 @@ var PageViewModel = /** @class */ (function () {
24871
25423
  case 1:
24872
25424
  propValue = _d.sent();
24873
25425
  runInAction(function () {
24874
- if (pageComponentPropValues)
25426
+ if (pageComponentPropValues) {
24875
25427
  pageComponentPropValues.propValues[propName] = propValue;
25428
+ if (prop.type === IkasThemeComponentPropType.CUSTOM) {
25429
+ IkasPageDataProvider.initCustomDataPropValue(prop, propValue, pageComponentPropValues, _this.router, true);
25430
+ }
25431
+ }
24876
25432
  });
24877
25433
  return [2 /*return*/];
24878
25434
  }
@@ -25657,4 +26213,4 @@ var IkasBaseStore = /** @class */ (function () {
25657
26213
  return IkasBaseStore;
25658
26214
  }());
25659
26215
 
25660
- 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 };
26216
+ 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 };