@ikas/storefront 0.0.44 → 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 +569 -16
- package/build/index.js +568 -15
- package/build/models/theme/component/prop/index.d.ts +3 -1
- package/build/models/theme/custom-data/index.d.ts +32 -0
- package/build/models/theme/index.d.ts +1 -0
- package/build/models/theme/theme.d.ts +2 -0
- package/build/utils/providers/page-data.d.ts +16 -1
- package/build/utils/providers/prop-value/custom.d.ts +30 -0
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -11343,6 +11343,409 @@ var IkasCategoryListPropValueProvider = /** @class */ (function () {
|
|
|
11343
11343
|
return IkasCategoryListPropValueProvider;
|
|
11344
11344
|
}());
|
|
11345
11345
|
|
|
11346
|
+
var IkasCustomPropValueProvider = /** @class */ (function () {
|
|
11347
|
+
function IkasCustomPropValueProvider(value, customData, theme, pageType, pageSpecificData, pageParams) {
|
|
11348
|
+
this.value = value;
|
|
11349
|
+
this.customData = customData;
|
|
11350
|
+
this.theme = theme;
|
|
11351
|
+
this.pageType = pageType;
|
|
11352
|
+
this.pageSpecificData = pageSpecificData;
|
|
11353
|
+
this.pageParams = pageParams;
|
|
11354
|
+
}
|
|
11355
|
+
IkasCustomPropValueProvider.prototype.getValue = function () {
|
|
11356
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
11357
|
+
var customDataValue, _a;
|
|
11358
|
+
return __generator(this, function (_b) {
|
|
11359
|
+
switch (_b.label) {
|
|
11360
|
+
case 0:
|
|
11361
|
+
if (this.value === undefined || this.value === null)
|
|
11362
|
+
return [2 /*return*/];
|
|
11363
|
+
_b.label = 1;
|
|
11364
|
+
case 1:
|
|
11365
|
+
_b.trys.push([1, 32, , 33]);
|
|
11366
|
+
_a = this.customData.type;
|
|
11367
|
+
switch (_a) {
|
|
11368
|
+
case exports.IkasThemeCustomDataType.TEXT: return [3 /*break*/, 2];
|
|
11369
|
+
case exports.IkasThemeCustomDataType.BOOLEAN: return [3 /*break*/, 4];
|
|
11370
|
+
case exports.IkasThemeCustomDataType.BRAND_LIST: return [3 /*break*/, 6];
|
|
11371
|
+
case exports.IkasThemeCustomDataType.BRAND: return [3 /*break*/, 8];
|
|
11372
|
+
case exports.IkasThemeCustomDataType.CATEGORY_LIST: return [3 /*break*/, 10];
|
|
11373
|
+
case exports.IkasThemeCustomDataType.CATEGORY: return [3 /*break*/, 12];
|
|
11374
|
+
case exports.IkasThemeCustomDataType.COLOR: return [3 /*break*/, 14];
|
|
11375
|
+
case exports.IkasThemeCustomDataType.IMAGE_LIST: return [3 /*break*/, 16];
|
|
11376
|
+
case exports.IkasThemeCustomDataType.IMAGE: return [3 /*break*/, 18];
|
|
11377
|
+
case exports.IkasThemeCustomDataType.LINK: return [3 /*break*/, 20];
|
|
11378
|
+
case exports.IkasThemeCustomDataType.LIST_OF_LINK: return [3 /*break*/, 20];
|
|
11379
|
+
case exports.IkasThemeCustomDataType.PRODUCT_DETAIL: return [3 /*break*/, 22];
|
|
11380
|
+
case exports.IkasThemeCustomDataType.PRODUCT_LIST: return [3 /*break*/, 24];
|
|
11381
|
+
case exports.IkasThemeCustomDataType.OBJECT: return [3 /*break*/, 26];
|
|
11382
|
+
case exports.IkasThemeCustomDataType.DYNAMIC_LIST: return [3 /*break*/, 28];
|
|
11383
|
+
case exports.IkasThemeCustomDataType.STATIC_LIST: return [3 /*break*/, 28];
|
|
11384
|
+
}
|
|
11385
|
+
return [3 /*break*/, 30];
|
|
11386
|
+
case 2: return [4 /*yield*/, this.getTextValue()];
|
|
11387
|
+
case 3:
|
|
11388
|
+
customDataValue = _b.sent();
|
|
11389
|
+
return [3 /*break*/, 31];
|
|
11390
|
+
case 4: return [4 /*yield*/, this.getBooleanValue()];
|
|
11391
|
+
case 5:
|
|
11392
|
+
customDataValue = _b.sent();
|
|
11393
|
+
return [3 /*break*/, 31];
|
|
11394
|
+
case 6: return [4 /*yield*/, this.getBrandListPropValue()];
|
|
11395
|
+
case 7:
|
|
11396
|
+
customDataValue = _b.sent();
|
|
11397
|
+
return [3 /*break*/, 31];
|
|
11398
|
+
case 8: return [4 /*yield*/, this.getBrandPropValue()];
|
|
11399
|
+
case 9:
|
|
11400
|
+
customDataValue = _b.sent();
|
|
11401
|
+
return [3 /*break*/, 31];
|
|
11402
|
+
case 10: return [4 /*yield*/, this.getCategoryListPropValue()];
|
|
11403
|
+
case 11:
|
|
11404
|
+
customDataValue = _b.sent();
|
|
11405
|
+
return [3 /*break*/, 31];
|
|
11406
|
+
case 12: return [4 /*yield*/, this.getCategoryPropValue()];
|
|
11407
|
+
case 13:
|
|
11408
|
+
customDataValue = _b.sent();
|
|
11409
|
+
return [3 /*break*/, 31];
|
|
11410
|
+
case 14: return [4 /*yield*/, this.getColorPropValue()];
|
|
11411
|
+
case 15:
|
|
11412
|
+
customDataValue = _b.sent();
|
|
11413
|
+
return [3 /*break*/, 31];
|
|
11414
|
+
case 16: return [4 /*yield*/, this.getImageListPropValue()];
|
|
11415
|
+
case 17:
|
|
11416
|
+
customDataValue = _b.sent();
|
|
11417
|
+
return [3 /*break*/, 31];
|
|
11418
|
+
case 18: return [4 /*yield*/, this.getImagePropValue()];
|
|
11419
|
+
case 19:
|
|
11420
|
+
customDataValue = _b.sent();
|
|
11421
|
+
return [3 /*break*/, 31];
|
|
11422
|
+
case 20: return [4 /*yield*/, this.getLinkPropValue()];
|
|
11423
|
+
case 21:
|
|
11424
|
+
customDataValue = _b.sent();
|
|
11425
|
+
return [3 /*break*/, 31];
|
|
11426
|
+
case 22: return [4 /*yield*/, this.getProductDetailPropValue()];
|
|
11427
|
+
case 23:
|
|
11428
|
+
customDataValue = _b.sent();
|
|
11429
|
+
return [3 /*break*/, 31];
|
|
11430
|
+
case 24: return [4 /*yield*/, this.getProductListPropValue()];
|
|
11431
|
+
case 25:
|
|
11432
|
+
customDataValue = _b.sent();
|
|
11433
|
+
return [3 /*break*/, 31];
|
|
11434
|
+
case 26: return [4 /*yield*/, this.getObjectValue()];
|
|
11435
|
+
case 27:
|
|
11436
|
+
customDataValue = _b.sent();
|
|
11437
|
+
return [3 /*break*/, 31];
|
|
11438
|
+
case 28: return [4 /*yield*/, this.getArrayValue()];
|
|
11439
|
+
case 29:
|
|
11440
|
+
customDataValue = _b.sent();
|
|
11441
|
+
return [3 /*break*/, 31];
|
|
11442
|
+
case 30: return [3 /*break*/, 31];
|
|
11443
|
+
case 31: return [3 /*break*/, 33];
|
|
11444
|
+
case 32:
|
|
11445
|
+
_b.sent();
|
|
11446
|
+
return [2 /*return*/];
|
|
11447
|
+
case 33: return [2 /*return*/, JSON.parse(JSON.stringify(customDataValue))];
|
|
11448
|
+
}
|
|
11449
|
+
});
|
|
11450
|
+
});
|
|
11451
|
+
};
|
|
11452
|
+
IkasCustomPropValueProvider.prototype.getBooleanValue = function () {
|
|
11453
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
11454
|
+
var provider, value;
|
|
11455
|
+
return __generator(this, function (_a) {
|
|
11456
|
+
switch (_a.label) {
|
|
11457
|
+
case 0:
|
|
11458
|
+
provider = new IkasBooleanPropValueProvider(this.value);
|
|
11459
|
+
return [4 /*yield*/, provider.getValue()];
|
|
11460
|
+
case 1:
|
|
11461
|
+
value = _a.sent();
|
|
11462
|
+
return [2 /*return*/, {
|
|
11463
|
+
value: value,
|
|
11464
|
+
customData: this.customData,
|
|
11465
|
+
}];
|
|
11466
|
+
}
|
|
11467
|
+
});
|
|
11468
|
+
});
|
|
11469
|
+
};
|
|
11470
|
+
IkasCustomPropValueProvider.prototype.getBrandListPropValue = function () {
|
|
11471
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
11472
|
+
var provider, value;
|
|
11473
|
+
return __generator(this, function (_a) {
|
|
11474
|
+
switch (_a.label) {
|
|
11475
|
+
case 0:
|
|
11476
|
+
provider = new IkasBrandListPropValueProvider(this.value);
|
|
11477
|
+
return [4 /*yield*/, provider.getValue()];
|
|
11478
|
+
case 1:
|
|
11479
|
+
value = _a.sent();
|
|
11480
|
+
return [2 /*return*/, {
|
|
11481
|
+
value: value,
|
|
11482
|
+
customData: this.customData,
|
|
11483
|
+
}];
|
|
11484
|
+
}
|
|
11485
|
+
});
|
|
11486
|
+
});
|
|
11487
|
+
};
|
|
11488
|
+
IkasCustomPropValueProvider.prototype.getBrandPropValue = function () {
|
|
11489
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
11490
|
+
var provider, value;
|
|
11491
|
+
return __generator(this, function (_a) {
|
|
11492
|
+
switch (_a.label) {
|
|
11493
|
+
case 0:
|
|
11494
|
+
provider = new IkasBrandPropValueProvider(this.value, this.pageSpecificData);
|
|
11495
|
+
return [4 /*yield*/, provider.getValue()];
|
|
11496
|
+
case 1:
|
|
11497
|
+
value = _a.sent();
|
|
11498
|
+
return [2 /*return*/, {
|
|
11499
|
+
value: value,
|
|
11500
|
+
customData: this.customData,
|
|
11501
|
+
}];
|
|
11502
|
+
}
|
|
11503
|
+
});
|
|
11504
|
+
});
|
|
11505
|
+
};
|
|
11506
|
+
IkasCustomPropValueProvider.prototype.getCategoryListPropValue = function () {
|
|
11507
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
11508
|
+
var provider, value;
|
|
11509
|
+
return __generator(this, function (_a) {
|
|
11510
|
+
switch (_a.label) {
|
|
11511
|
+
case 0:
|
|
11512
|
+
provider = new IkasCategoryListPropValueProvider(this.value);
|
|
11513
|
+
return [4 /*yield*/, provider.getValue()];
|
|
11514
|
+
case 1:
|
|
11515
|
+
value = _a.sent();
|
|
11516
|
+
return [2 /*return*/, {
|
|
11517
|
+
value: value,
|
|
11518
|
+
customData: this.customData,
|
|
11519
|
+
}];
|
|
11520
|
+
}
|
|
11521
|
+
});
|
|
11522
|
+
});
|
|
11523
|
+
};
|
|
11524
|
+
IkasCustomPropValueProvider.prototype.getCategoryPropValue = function () {
|
|
11525
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
11526
|
+
var provider, value;
|
|
11527
|
+
return __generator(this, function (_a) {
|
|
11528
|
+
switch (_a.label) {
|
|
11529
|
+
case 0:
|
|
11530
|
+
provider = new IkasCategoryPropValueProvider(this.value, this.pageSpecificData);
|
|
11531
|
+
return [4 /*yield*/, provider.getValue()];
|
|
11532
|
+
case 1:
|
|
11533
|
+
value = _a.sent();
|
|
11534
|
+
return [2 /*return*/, {
|
|
11535
|
+
value: value,
|
|
11536
|
+
customData: this.customData,
|
|
11537
|
+
}];
|
|
11538
|
+
}
|
|
11539
|
+
});
|
|
11540
|
+
});
|
|
11541
|
+
};
|
|
11542
|
+
IkasCustomPropValueProvider.prototype.getColorPropValue = function () {
|
|
11543
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
11544
|
+
var provider, value;
|
|
11545
|
+
return __generator(this, function (_a) {
|
|
11546
|
+
switch (_a.label) {
|
|
11547
|
+
case 0:
|
|
11548
|
+
provider = new IkasColorPropValueProvider(this.value);
|
|
11549
|
+
return [4 /*yield*/, provider.getValue()];
|
|
11550
|
+
case 1:
|
|
11551
|
+
value = _a.sent();
|
|
11552
|
+
return [2 /*return*/, {
|
|
11553
|
+
value: value,
|
|
11554
|
+
customData: this.customData,
|
|
11555
|
+
}];
|
|
11556
|
+
}
|
|
11557
|
+
});
|
|
11558
|
+
});
|
|
11559
|
+
};
|
|
11560
|
+
IkasCustomPropValueProvider.prototype.getImageListPropValue = function () {
|
|
11561
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
11562
|
+
var provider, value;
|
|
11563
|
+
return __generator(this, function (_a) {
|
|
11564
|
+
switch (_a.label) {
|
|
11565
|
+
case 0:
|
|
11566
|
+
provider = new IkasImageListPropValueProvider(this.value);
|
|
11567
|
+
return [4 /*yield*/, provider.getValue()];
|
|
11568
|
+
case 1:
|
|
11569
|
+
value = _a.sent();
|
|
11570
|
+
return [2 /*return*/, {
|
|
11571
|
+
value: value,
|
|
11572
|
+
customData: this.customData,
|
|
11573
|
+
}];
|
|
11574
|
+
}
|
|
11575
|
+
});
|
|
11576
|
+
});
|
|
11577
|
+
};
|
|
11578
|
+
IkasCustomPropValueProvider.prototype.getImagePropValue = function () {
|
|
11579
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
11580
|
+
var provider, value;
|
|
11581
|
+
return __generator(this, function (_a) {
|
|
11582
|
+
switch (_a.label) {
|
|
11583
|
+
case 0:
|
|
11584
|
+
provider = new IkasImagePropValueProvider(this.value);
|
|
11585
|
+
return [4 /*yield*/, provider.getValue()];
|
|
11586
|
+
case 1:
|
|
11587
|
+
value = _a.sent();
|
|
11588
|
+
return [2 /*return*/, {
|
|
11589
|
+
value: value,
|
|
11590
|
+
customData: this.customData,
|
|
11591
|
+
}];
|
|
11592
|
+
}
|
|
11593
|
+
});
|
|
11594
|
+
});
|
|
11595
|
+
};
|
|
11596
|
+
IkasCustomPropValueProvider.prototype.getLinkPropValue = function () {
|
|
11597
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
11598
|
+
var provider, value;
|
|
11599
|
+
return __generator(this, function (_a) {
|
|
11600
|
+
switch (_a.label) {
|
|
11601
|
+
case 0:
|
|
11602
|
+
provider = new IkasLinkPropValueProvider(this.value, this.theme);
|
|
11603
|
+
return [4 /*yield*/, provider.getValue()];
|
|
11604
|
+
case 1:
|
|
11605
|
+
value = _a.sent();
|
|
11606
|
+
return [2 /*return*/, {
|
|
11607
|
+
value: value,
|
|
11608
|
+
customData: this.customData,
|
|
11609
|
+
}];
|
|
11610
|
+
}
|
|
11611
|
+
});
|
|
11612
|
+
});
|
|
11613
|
+
};
|
|
11614
|
+
IkasCustomPropValueProvider.prototype.getProductDetailPropValue = function () {
|
|
11615
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
11616
|
+
var provider, value;
|
|
11617
|
+
return __generator(this, function (_a) {
|
|
11618
|
+
switch (_a.label) {
|
|
11619
|
+
case 0:
|
|
11620
|
+
provider = new IkasProductDetailPropValueProvider(this.value, this.pageSpecificData);
|
|
11621
|
+
return [4 /*yield*/, provider.getValue()];
|
|
11622
|
+
case 1:
|
|
11623
|
+
value = _a.sent();
|
|
11624
|
+
return [2 /*return*/, {
|
|
11625
|
+
value: value,
|
|
11626
|
+
customData: this.customData,
|
|
11627
|
+
}];
|
|
11628
|
+
}
|
|
11629
|
+
});
|
|
11630
|
+
});
|
|
11631
|
+
};
|
|
11632
|
+
IkasCustomPropValueProvider.prototype.getProductListPropValue = function () {
|
|
11633
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
11634
|
+
var provider, value;
|
|
11635
|
+
return __generator(this, function (_a) {
|
|
11636
|
+
switch (_a.label) {
|
|
11637
|
+
case 0:
|
|
11638
|
+
provider = new IkasProductListPropValueProvider(this.pageType, this.value, this.pageParams || {}, this.pageSpecificData);
|
|
11639
|
+
return [4 /*yield*/, provider.getValue()];
|
|
11640
|
+
case 1:
|
|
11641
|
+
value = _a.sent();
|
|
11642
|
+
return [2 /*return*/, {
|
|
11643
|
+
value: value,
|
|
11644
|
+
customData: this.customData,
|
|
11645
|
+
}];
|
|
11646
|
+
}
|
|
11647
|
+
});
|
|
11648
|
+
});
|
|
11649
|
+
};
|
|
11650
|
+
IkasCustomPropValueProvider.prototype.getTextValue = function () {
|
|
11651
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
11652
|
+
var provider, value;
|
|
11653
|
+
return __generator(this, function (_a) {
|
|
11654
|
+
switch (_a.label) {
|
|
11655
|
+
case 0:
|
|
11656
|
+
provider = new IkasTextPropValueProvider(this.value);
|
|
11657
|
+
return [4 /*yield*/, provider.getValue()];
|
|
11658
|
+
case 1:
|
|
11659
|
+
value = _a.sent();
|
|
11660
|
+
return [2 /*return*/, {
|
|
11661
|
+
value: value,
|
|
11662
|
+
customData: this.customData,
|
|
11663
|
+
}];
|
|
11664
|
+
}
|
|
11665
|
+
});
|
|
11666
|
+
});
|
|
11667
|
+
};
|
|
11668
|
+
IkasCustomPropValueProvider.prototype.getObjectValue = function () {
|
|
11669
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
11670
|
+
var objectValue, _i, _a, nestedData, nestedValue, nestedProvider, _itemValue;
|
|
11671
|
+
return __generator(this, function (_b) {
|
|
11672
|
+
switch (_b.label) {
|
|
11673
|
+
case 0:
|
|
11674
|
+
objectValue = {};
|
|
11675
|
+
_i = 0, _a = this.customData.nestedData || [];
|
|
11676
|
+
_b.label = 1;
|
|
11677
|
+
case 1:
|
|
11678
|
+
if (!(_i < _a.length)) return [3 /*break*/, 4];
|
|
11679
|
+
nestedData = _a[_i];
|
|
11680
|
+
if (!nestedData.key)
|
|
11681
|
+
return [3 /*break*/, 3];
|
|
11682
|
+
nestedValue = this.value[nestedData.key];
|
|
11683
|
+
if (nestedData.isRequired &&
|
|
11684
|
+
(nestedValue === undefined || nestedValue === null))
|
|
11685
|
+
throw new Error("Required data is missing");
|
|
11686
|
+
nestedProvider = new IkasCustomPropValueProvider(nestedValue, nestedData, this.theme, this.pageSpecificData);
|
|
11687
|
+
return [4 /*yield*/, nestedProvider.getValue()];
|
|
11688
|
+
case 2:
|
|
11689
|
+
_itemValue = _b.sent();
|
|
11690
|
+
if (nestedData.isRequired &&
|
|
11691
|
+
(_itemValue === null || _itemValue === undefined))
|
|
11692
|
+
throw new Error("Required data is missing");
|
|
11693
|
+
objectValue[nestedData.key] = _itemValue;
|
|
11694
|
+
_b.label = 3;
|
|
11695
|
+
case 3:
|
|
11696
|
+
_i++;
|
|
11697
|
+
return [3 /*break*/, 1];
|
|
11698
|
+
case 4: return [2 /*return*/, {
|
|
11699
|
+
value: objectValue,
|
|
11700
|
+
customData: this.customData,
|
|
11701
|
+
}];
|
|
11702
|
+
}
|
|
11703
|
+
});
|
|
11704
|
+
});
|
|
11705
|
+
};
|
|
11706
|
+
IkasCustomPropValueProvider.prototype.getArrayValue = function () {
|
|
11707
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
11708
|
+
var value, nestedData, _i, _a, itemValue, provider, _itemValue;
|
|
11709
|
+
return __generator(this, function (_b) {
|
|
11710
|
+
switch (_b.label) {
|
|
11711
|
+
case 0:
|
|
11712
|
+
if (!this.value || !Array.isArray(this.value))
|
|
11713
|
+
throw new Error("Incorrect data!");
|
|
11714
|
+
value = [];
|
|
11715
|
+
nestedData = this.customData.nestedData[0];
|
|
11716
|
+
_i = 0, _a = this.value;
|
|
11717
|
+
_b.label = 1;
|
|
11718
|
+
case 1:
|
|
11719
|
+
if (!(_i < _a.length)) return [3 /*break*/, 4];
|
|
11720
|
+
itemValue = _a[_i];
|
|
11721
|
+
if (nestedData.isRequired &&
|
|
11722
|
+
(itemValue === undefined || itemValue === null))
|
|
11723
|
+
throw new Error("Required data is missing");
|
|
11724
|
+
provider = new IkasCustomPropValueProvider(itemValue, nestedData, this.theme, this.pageSpecificData);
|
|
11725
|
+
return [4 /*yield*/, provider.getValue()];
|
|
11726
|
+
case 2:
|
|
11727
|
+
_itemValue = _b.sent();
|
|
11728
|
+
if (nestedData.isRequired &&
|
|
11729
|
+
(_itemValue === null || _itemValue === undefined)) {
|
|
11730
|
+
throw new Error("Required data is missing");
|
|
11731
|
+
}
|
|
11732
|
+
else
|
|
11733
|
+
value.push(_itemValue);
|
|
11734
|
+
_b.label = 3;
|
|
11735
|
+
case 3:
|
|
11736
|
+
_i++;
|
|
11737
|
+
return [3 /*break*/, 1];
|
|
11738
|
+
case 4: return [2 /*return*/, {
|
|
11739
|
+
value: value,
|
|
11740
|
+
customData: this.customData,
|
|
11741
|
+
}];
|
|
11742
|
+
}
|
|
11743
|
+
});
|
|
11744
|
+
});
|
|
11745
|
+
};
|
|
11746
|
+
return IkasCustomPropValueProvider;
|
|
11747
|
+
}());
|
|
11748
|
+
|
|
11346
11749
|
var IkasPageDataProvider = /** @class */ (function () {
|
|
11347
11750
|
function IkasPageDataProvider(theme, pageParams, pageType) {
|
|
11348
11751
|
this.pageType = null;
|
|
@@ -11605,7 +12008,7 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
11605
12008
|
};
|
|
11606
12009
|
IkasPageDataProvider.prototype.getPageComponentPropValue = function (pageComponent, prop) {
|
|
11607
12010
|
return __awaiter(this, void 0, void 0, function () {
|
|
11608
|
-
var propValueProvider, propValue;
|
|
12011
|
+
var propValueProvider, propValue, customData;
|
|
11609
12012
|
return __generator(this, function (_a) {
|
|
11610
12013
|
switch (_a.label) {
|
|
11611
12014
|
case 0:
|
|
@@ -11650,6 +12053,12 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
11650
12053
|
case exports.IkasThemeComponentPropType.COLOR:
|
|
11651
12054
|
propValueProvider = new IkasColorPropValueProvider(propValue);
|
|
11652
12055
|
break;
|
|
12056
|
+
case exports.IkasThemeComponentPropType.CUSTOM:
|
|
12057
|
+
customData = this.theme.customData.find(function (cd) { return cd.id === prop.customDataId; });
|
|
12058
|
+
if (!customData)
|
|
12059
|
+
return [2 /*return*/];
|
|
12060
|
+
propValueProvider = new IkasCustomPropValueProvider(propValue, customData, this.theme, this.pageType, this.pageSpecificData, this.pageParams);
|
|
12061
|
+
break;
|
|
11653
12062
|
}
|
|
11654
12063
|
return [4 /*yield*/, (propValueProvider === null || propValueProvider === void 0 ? void 0 : propValueProvider.getValue())];
|
|
11655
12064
|
case 1: return [2 /*return*/, _a.sent()];
|
|
@@ -11707,32 +12116,49 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
11707
12116
|
case exports.IkasThemeComponentPropType.LIST_OF_LINK:
|
|
11708
12117
|
IkasPageDataProvider.initLinkPropValue(prop, propValue, pageComponentPropValue);
|
|
11709
12118
|
break;
|
|
12119
|
+
case exports.IkasThemeComponentPropType.CUSTOM:
|
|
12120
|
+
IkasPageDataProvider.initCustomDataPropValue(prop, propValue, pageComponentPropValue, router, isBrowser);
|
|
12121
|
+
break;
|
|
11710
12122
|
}
|
|
11711
12123
|
});
|
|
11712
12124
|
});
|
|
11713
12125
|
return pageComponentPropValues;
|
|
11714
12126
|
};
|
|
11715
12127
|
IkasPageDataProvider.initBrandPropValue = function (prop, propValue, pageComponentPropValue) {
|
|
11716
|
-
|
|
11717
|
-
|
|
12128
|
+
pageComponentPropValue.propValues[prop.name] = IkasPageDataProvider._initBrandPropValue(propValue);
|
|
12129
|
+
};
|
|
12130
|
+
IkasPageDataProvider._initBrandPropValue = function (propValue) {
|
|
12131
|
+
return new IkasBrand(propValue);
|
|
11718
12132
|
};
|
|
11719
12133
|
IkasPageDataProvider.initBrandListPropValue = function (prop, propValue, pageComponentPropValue) {
|
|
11720
|
-
|
|
11721
|
-
|
|
12134
|
+
pageComponentPropValue.propValues[prop.name] = IkasPageDataProvider._initBrandListPropValue(propValue);
|
|
12135
|
+
};
|
|
12136
|
+
IkasPageDataProvider._initBrandListPropValue = function (propValue) {
|
|
12137
|
+
return new IkasBrandList(propValue);
|
|
11722
12138
|
};
|
|
11723
12139
|
IkasPageDataProvider.initCategoryPropValue = function (prop, propValue, pageComponentPropValue) {
|
|
11724
|
-
|
|
11725
|
-
|
|
12140
|
+
pageComponentPropValue.propValues[prop.name] = IkasPageDataProvider._initCategoryPropValue(propValue);
|
|
12141
|
+
};
|
|
12142
|
+
IkasPageDataProvider._initCategoryPropValue = function (propValue) {
|
|
12143
|
+
return new IkasCategory(propValue);
|
|
11726
12144
|
};
|
|
11727
12145
|
IkasPageDataProvider.initCategoryListPropValue = function (prop, propValue, pageComponentPropValue) {
|
|
11728
12146
|
var categoryList = new IkasCategoryList(propValue);
|
|
11729
12147
|
pageComponentPropValue.propValues[prop.name] = categoryList;
|
|
11730
12148
|
};
|
|
12149
|
+
IkasPageDataProvider._initCategoryListPropValue = function (propValue) {
|
|
12150
|
+
return new IkasCategoryList(propValue);
|
|
12151
|
+
};
|
|
11731
12152
|
IkasPageDataProvider.initProductListPropValue = function (prop, propValue, pageComponentPropValue) {
|
|
11732
|
-
|
|
11733
|
-
|
|
12153
|
+
pageComponentPropValue.propValues[prop.name] = this._initProductListPropValue(propValue);
|
|
12154
|
+
};
|
|
12155
|
+
IkasPageDataProvider._initProductListPropValue = function (propValue) {
|
|
12156
|
+
return new IkasProductList(propValue);
|
|
11734
12157
|
};
|
|
11735
12158
|
IkasPageDataProvider.initProductDetailPropValue = function (prop, propValue, pageComponentPropValue, router, isBrowser) {
|
|
12159
|
+
pageComponentPropValue.propValues[prop.name] = this._initProductDetailPropValue(propValue, router, isBrowser);
|
|
12160
|
+
};
|
|
12161
|
+
IkasPageDataProvider._initProductDetailPropValue = function (propValue, router, isBrowser) {
|
|
11736
12162
|
var usePageData = propValue.usePageData;
|
|
11737
12163
|
var _propValue = propValue;
|
|
11738
12164
|
var productDetail = new IkasProductDetail(_propValue.product, _propValue.selectedVariantValues);
|
|
@@ -11746,23 +12172,92 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
11746
12172
|
}
|
|
11747
12173
|
}
|
|
11748
12174
|
}
|
|
11749
|
-
|
|
12175
|
+
return new IkasProductDetail(productDetail.product, productDetail.selectedVariantValues, usePageData, router);
|
|
11750
12176
|
};
|
|
11751
12177
|
IkasPageDataProvider.initLinkPropValue = function (prop, propValue, pageComponentPropValue) {
|
|
12178
|
+
pageComponentPropValue.propValues[prop.name] = this._initLinkPropValue(propValue);
|
|
12179
|
+
};
|
|
12180
|
+
IkasPageDataProvider._initLinkPropValue = function (propValue) {
|
|
11752
12181
|
if (Array.isArray(propValue)) {
|
|
11753
|
-
|
|
12182
|
+
return propValue.map(function (p) {
|
|
11754
12183
|
return new IkasNavigationLink(p.href, p.label, p.subLinks, p.isExternal || undefined);
|
|
11755
12184
|
});
|
|
11756
12185
|
}
|
|
11757
12186
|
else if (propValue) {
|
|
11758
|
-
|
|
12187
|
+
return new IkasNavigationLink(propValue.href, propValue.label, propValue.subLinks, propValue.isExternal);
|
|
11759
12188
|
}
|
|
11760
12189
|
};
|
|
11761
12190
|
IkasPageDataProvider.initImagePropValue = function (prop, propValue, pageComponentPropValue) {
|
|
11762
|
-
pageComponentPropValue.propValues[prop.name] =
|
|
12191
|
+
pageComponentPropValue.propValues[prop.name] = this._initImagePropValue(propValue);
|
|
12192
|
+
};
|
|
12193
|
+
IkasPageDataProvider._initImagePropValue = function (propValue) {
|
|
12194
|
+
return new IkasImage(propValue.id);
|
|
11763
12195
|
};
|
|
11764
12196
|
IkasPageDataProvider.initImageListPropValue = function (prop, propValue, pageComponentPropValue) {
|
|
11765
|
-
pageComponentPropValue.propValues[prop.name] =
|
|
12197
|
+
pageComponentPropValue.propValues[prop.name] = this._initImageListPropValue(propValue);
|
|
12198
|
+
};
|
|
12199
|
+
IkasPageDataProvider._initImageListPropValue = function (propValue) {
|
|
12200
|
+
return propValue.map(function (i) { return new IkasImage(i.id); });
|
|
12201
|
+
};
|
|
12202
|
+
IkasPageDataProvider.initCustomDataPropValue = function (prop, customDataValue, pageComponentPropValue, router, isBrowser) {
|
|
12203
|
+
if (!customDataValue ||
|
|
12204
|
+
!customDataValue.value ||
|
|
12205
|
+
!customDataValue.customData)
|
|
12206
|
+
return;
|
|
12207
|
+
pageComponentPropValue.propValues[prop.name] = this._initCustomDataPropValue(customDataValue, customDataValue.customData, router, isBrowser);
|
|
12208
|
+
};
|
|
12209
|
+
IkasPageDataProvider._initCustomDataPropValue = function (customDataValue, customData, router, isBrowser) {
|
|
12210
|
+
var _this = this;
|
|
12211
|
+
if (!customDataValue)
|
|
12212
|
+
return null;
|
|
12213
|
+
var propValue = customDataValue.value;
|
|
12214
|
+
if (propValue === null || propValue === undefined)
|
|
12215
|
+
return null;
|
|
12216
|
+
switch (customData.type) {
|
|
12217
|
+
case exports.IkasThemeCustomDataType.BRAND:
|
|
12218
|
+
return this._initBrandPropValue(propValue);
|
|
12219
|
+
case exports.IkasThemeCustomDataType.BRAND_LIST:
|
|
12220
|
+
return this._initBrandListPropValue(propValue);
|
|
12221
|
+
case exports.IkasThemeCustomDataType.CATEGORY_LIST:
|
|
12222
|
+
return this._initCategoryListPropValue(propValue);
|
|
12223
|
+
case exports.IkasThemeCustomDataType.CATEGORY:
|
|
12224
|
+
return this._initCategoryPropValue(propValue);
|
|
12225
|
+
case exports.IkasThemeCustomDataType.IMAGE_LIST:
|
|
12226
|
+
return this._initImageListPropValue(propValue);
|
|
12227
|
+
case exports.IkasThemeCustomDataType.IMAGE:
|
|
12228
|
+
return this._initImagePropValue(propValue);
|
|
12229
|
+
case exports.IkasThemeCustomDataType.LINK:
|
|
12230
|
+
return this._initLinkPropValue(propValue);
|
|
12231
|
+
case exports.IkasThemeCustomDataType.PRODUCT_DETAIL:
|
|
12232
|
+
return this._initProductDetailPropValue(propValue, router, isBrowser);
|
|
12233
|
+
case exports.IkasThemeCustomDataType.PRODUCT_LIST:
|
|
12234
|
+
return this._initProductListPropValue(propValue);
|
|
12235
|
+
case exports.IkasThemeCustomDataType.OBJECT:
|
|
12236
|
+
var objectValue = {};
|
|
12237
|
+
for (var _i = 0, _a = customData.nestedData || []; _i < _a.length; _i++) {
|
|
12238
|
+
var nestedCustomData = _a[_i];
|
|
12239
|
+
var value = propValue[nestedCustomData.key];
|
|
12240
|
+
objectValue[nestedCustomData.key] = this._initCustomDataPropValue(value, nestedCustomData, router, isBrowser);
|
|
12241
|
+
}
|
|
12242
|
+
return objectValue;
|
|
12243
|
+
case exports.IkasThemeCustomDataType.DYNAMIC_LIST:
|
|
12244
|
+
case exports.IkasThemeCustomDataType.STATIC_LIST:
|
|
12245
|
+
try {
|
|
12246
|
+
if (!propValue || !propValue.length)
|
|
12247
|
+
return null;
|
|
12248
|
+
var listValue_1 = [];
|
|
12249
|
+
var nestedCustomData_1 = customData.nestedData[0];
|
|
12250
|
+
propValue.forEach(function (itemValue) {
|
|
12251
|
+
listValue_1.push(_this._initCustomDataPropValue(itemValue, nestedCustomData_1, router, isBrowser));
|
|
12252
|
+
});
|
|
12253
|
+
return listValue_1;
|
|
12254
|
+
}
|
|
12255
|
+
catch (err) {
|
|
12256
|
+
return [];
|
|
12257
|
+
}
|
|
12258
|
+
default:
|
|
12259
|
+
return propValue;
|
|
12260
|
+
}
|
|
11766
12261
|
};
|
|
11767
12262
|
return IkasPageDataProvider;
|
|
11768
12263
|
}());
|
|
@@ -12899,6 +13394,7 @@ var IkasThemeComponentProp = /** @class */ (function () {
|
|
|
12899
13394
|
this.displayName = data.displayName || "";
|
|
12900
13395
|
this.type = data.type || exports.IkasThemeComponentPropType.TEXT;
|
|
12901
13396
|
this.isRequired = data.isRequired || false;
|
|
13397
|
+
this.customDataId = data.customDataId || null;
|
|
12902
13398
|
mobx.makeAutoObservable(this);
|
|
12903
13399
|
}
|
|
12904
13400
|
return IkasThemeComponentProp;
|
|
@@ -12917,6 +13413,7 @@ var IkasThemeComponentProp = /** @class */ (function () {
|
|
|
12917
13413
|
IkasThemeComponentPropType["CATEGORY"] = "CATEGORY";
|
|
12918
13414
|
IkasThemeComponentPropType["CATEGORY_LIST"] = "CATEGORY_LIST";
|
|
12919
13415
|
IkasThemeComponentPropType["COLOR"] = "COLOR";
|
|
13416
|
+
IkasThemeComponentPropType["CUSTOM"] = "CUSTOM";
|
|
12920
13417
|
// TODO number
|
|
12921
13418
|
// TODO productAttribute
|
|
12922
13419
|
})(exports.IkasThemeComponentPropType || (exports.IkasThemeComponentPropType = {}));
|
|
@@ -12936,6 +13433,54 @@ var IkasThemeComponent = /** @class */ (function () {
|
|
|
12936
13433
|
return IkasThemeComponent;
|
|
12937
13434
|
}());
|
|
12938
13435
|
|
|
13436
|
+
var IkasThemeCustomData = /** @class */ (function () {
|
|
13437
|
+
function IkasThemeCustomData(data) {
|
|
13438
|
+
var _this = this;
|
|
13439
|
+
if (data === void 0) { data = {}; }
|
|
13440
|
+
this.id = data.id || "";
|
|
13441
|
+
this.name = data.name || null;
|
|
13442
|
+
this.type = data.type || exports.IkasThemeCustomDataType.TEXT;
|
|
13443
|
+
this.isRequired = data.isRequired !== undefined ? data.isRequired : true;
|
|
13444
|
+
this.key = data.key || null;
|
|
13445
|
+
this.parent = data.parent || null;
|
|
13446
|
+
this.itemCount = data.itemCount || null;
|
|
13447
|
+
this.isRoot = data.isRoot || false;
|
|
13448
|
+
this.nestedData = data.nestedData
|
|
13449
|
+
? data.nestedData.map(function (nd) {
|
|
13450
|
+
return new IkasThemeCustomData(__assign(__assign({}, nd), { parent: _this }));
|
|
13451
|
+
})
|
|
13452
|
+
: null;
|
|
13453
|
+
if (this.type === exports.IkasThemeCustomDataType.STATIC_LIST && !this.itemCount)
|
|
13454
|
+
this.itemCount = 1;
|
|
13455
|
+
mobx.makeAutoObservable(this);
|
|
13456
|
+
}
|
|
13457
|
+
IkasThemeCustomData.prototype.toJSON = function () {
|
|
13458
|
+
var obj = __assign({}, this);
|
|
13459
|
+
delete obj.parent;
|
|
13460
|
+
return obj;
|
|
13461
|
+
};
|
|
13462
|
+
return IkasThemeCustomData;
|
|
13463
|
+
}());
|
|
13464
|
+
(function (IkasThemeCustomDataType) {
|
|
13465
|
+
IkasThemeCustomDataType["TEXT"] = "TEXT";
|
|
13466
|
+
IkasThemeCustomDataType["NUMBER"] = "NUMBER";
|
|
13467
|
+
IkasThemeCustomDataType["BOOLEAN"] = "BOOLEAN";
|
|
13468
|
+
IkasThemeCustomDataType["IMAGE"] = "IMAGE";
|
|
13469
|
+
IkasThemeCustomDataType["IMAGE_LIST"] = "IMAGE_LIST";
|
|
13470
|
+
IkasThemeCustomDataType["LINK"] = "LINK";
|
|
13471
|
+
IkasThemeCustomDataType["LIST_OF_LINK"] = "LIST_OF_LINK";
|
|
13472
|
+
IkasThemeCustomDataType["PRODUCT_DETAIL"] = "PRODUCT_DETAIL";
|
|
13473
|
+
IkasThemeCustomDataType["PRODUCT_LIST"] = "PRODUCT_LIST";
|
|
13474
|
+
IkasThemeCustomDataType["BRAND"] = "BRAND";
|
|
13475
|
+
IkasThemeCustomDataType["BRAND_LIST"] = "BRAND_LIST";
|
|
13476
|
+
IkasThemeCustomDataType["CATEGORY"] = "CATEGORY";
|
|
13477
|
+
IkasThemeCustomDataType["CATEGORY_LIST"] = "CATEGORY_LIST";
|
|
13478
|
+
IkasThemeCustomDataType["COLOR"] = "COLOR";
|
|
13479
|
+
IkasThemeCustomDataType["OBJECT"] = "OBJECT";
|
|
13480
|
+
IkasThemeCustomDataType["STATIC_LIST"] = "STATIC_LIST";
|
|
13481
|
+
IkasThemeCustomDataType["DYNAMIC_LIST"] = "DYNAMIC_LIST";
|
|
13482
|
+
})(exports.IkasThemeCustomDataType || (exports.IkasThemeCustomDataType = {}));
|
|
13483
|
+
|
|
12939
13484
|
var IkasThemePageComponent = /** @class */ (function () {
|
|
12940
13485
|
function IkasThemePageComponent(data) {
|
|
12941
13486
|
this.id = data.id || "";
|
|
@@ -13003,6 +13548,7 @@ var IkasThemeSettings = /** @class */ (function () {
|
|
|
13003
13548
|
var IkasTheme = /** @class */ (function () {
|
|
13004
13549
|
function IkasTheme(data) {
|
|
13005
13550
|
if (data === void 0) { data = {}; }
|
|
13551
|
+
var _a;
|
|
13006
13552
|
this.name = data.name || "";
|
|
13007
13553
|
this.components = data.components
|
|
13008
13554
|
? data.components.map(function (c) { return new IkasThemeComponent(c); })
|
|
@@ -13011,6 +13557,8 @@ var IkasTheme = /** @class */ (function () {
|
|
|
13011
13557
|
this.settings = data.settings
|
|
13012
13558
|
? new IkasThemeSettings(data.settings)
|
|
13013
13559
|
: new IkasThemeSettings();
|
|
13560
|
+
this.customData = data.customData
|
|
13561
|
+
? (_a = data.customData) === null || _a === void 0 ? void 0 : _a.map(function (cd) { return new IkasThemeCustomData(cd); }) : [];
|
|
13014
13562
|
mobx.makeAutoObservable(this);
|
|
13015
13563
|
}
|
|
13016
13564
|
Object.defineProperty(IkasTheme.prototype, "headerComponent", {
|
|
@@ -24853,8 +25401,12 @@ var PageViewModel = /** @class */ (function () {
|
|
|
24853
25401
|
case 1:
|
|
24854
25402
|
propValue = _d.sent();
|
|
24855
25403
|
mobx.runInAction(function () {
|
|
24856
|
-
if (pageComponentPropValues)
|
|
25404
|
+
if (pageComponentPropValues) {
|
|
24857
25405
|
pageComponentPropValues.propValues[propName] = propValue;
|
|
25406
|
+
if (prop.type === exports.IkasThemeComponentPropType.CUSTOM) {
|
|
25407
|
+
IkasPageDataProvider.initCustomDataPropValue(prop, propValue, pageComponentPropValues, _this.router, true);
|
|
25408
|
+
}
|
|
25409
|
+
}
|
|
24858
25410
|
});
|
|
24859
25411
|
return [2 /*return*/];
|
|
24860
25412
|
}
|
|
@@ -25717,6 +26269,7 @@ exports.IkasTheme = IkasTheme;
|
|
|
25717
26269
|
exports.IkasThemeAPI = IkasThemeAPI;
|
|
25718
26270
|
exports.IkasThemeComponent = IkasThemeComponent;
|
|
25719
26271
|
exports.IkasThemeComponentProp = IkasThemeComponentProp;
|
|
26272
|
+
exports.IkasThemeCustomData = IkasThemeCustomData;
|
|
25720
26273
|
exports.IkasThemePage = IkasThemePage;
|
|
25721
26274
|
exports.IkasThemePageComponent = IkasThemePageComponent;
|
|
25722
26275
|
exports.IkasThemeSettings = IkasThemeSettings;
|