@ikas/storefront 0.0.168-alpha.8 → 0.0.168-alpha.9

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.
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import IkasPageEditorViewModel from "../page-editor/model";
2
+ import IkasPageEditorViewModel from "./model";
3
3
  import { IkasThemePageComponent } from "../../models/index";
4
4
  declare type Props = {
5
5
  vm: IkasPageEditorViewModel;
package/build/index.es.js CHANGED
@@ -42947,6 +42947,37 @@ var IkasVariantTypeAPI = /** @class */ (function () {
42947
42947
  }());
42948
42948
  var templateObject_1$g;
42949
42949
 
42950
+ var IkasAttributeList = /** @class */ (function () {
42951
+ function IkasAttributeList(productDetail, attributeListPropValue) {
42952
+ this.productDetail = null;
42953
+ this.productDetail = productDetail;
42954
+ this.attributeListPropValue = attributeListPropValue;
42955
+ makeAutoObservable(this);
42956
+ }
42957
+ Object.defineProperty(IkasAttributeList.prototype, "values", {
42958
+ get: function () {
42959
+ var _this = this;
42960
+ var _a;
42961
+ if (!this.productDetail)
42962
+ return [];
42963
+ var groupedValues = this.productDetail.product.hasVariant
42964
+ ? groupBy_1(this.productDetail.selectedVariant.attributes.filter(function (a) { var _a; return (_a = _this.attributeListPropValue.attributeIds) === null || _a === void 0 ? void 0 : _a.includes(a.productAttributeId || ""); }), "productAttributeId")
42965
+ : groupBy_1(this.productDetail.product.attributes.filter(function (a) { var _a; return (_a = _this.attributeListPropValue.attributeIds) === null || _a === void 0 ? void 0 : _a.includes(a.productAttributeId || ""); }), "productAttributeId");
42966
+ return (((_a = this.attributeListPropValue.attributeIds) === null || _a === void 0 ? void 0 : _a.map(function (attributeId) {
42967
+ var values = groupedValues[attributeId];
42968
+ if ((values === null || values === void 0 ? void 0 : values.length) && values[0].productAttribute)
42969
+ return {
42970
+ attribute: values[0].productAttribute,
42971
+ values: values,
42972
+ };
42973
+ }).filter(function (v) { return !!v; })) || []);
42974
+ },
42975
+ enumerable: false,
42976
+ configurable: true
42977
+ });
42978
+ return IkasAttributeList;
42979
+ }());
42980
+
42950
42981
  var IkasProductListPropValueProvider = /** @class */ (function () {
42951
42982
  function IkasProductListPropValueProvider(pageType, productListPropValue, pageSpecificData) {
42952
42983
  this.pageType = pageType;
@@ -43006,6 +43037,9 @@ function getPlaceholderProduct() {
43006
43037
  variants: [new IkasProductVariant()],
43007
43038
  }), []);
43008
43039
  }
43040
+ function getPlaceholderCategory() {
43041
+ return new IkasCategory();
43042
+ }
43009
43043
  function getPlaceholderBrand() {
43010
43044
  return new IkasBrand();
43011
43045
  }
@@ -43105,38 +43139,43 @@ var IkasBrandListPropValueProvider = /** @class */ (function () {
43105
43139
  }());
43106
43140
 
43107
43141
  var IkasBrandPropValueProvider = /** @class */ (function () {
43108
- function IkasBrandPropValueProvider(prop, pageSpecificData) {
43142
+ function IkasBrandPropValueProvider(prop) {
43109
43143
  this.brandPropValue = prop;
43110
- this.pageSpecificData = pageSpecificData;
43111
43144
  }
43112
43145
  IkasBrandPropValueProvider.prototype.getValue = function () {
43113
43146
  return __awaiter(this, void 0, void 0, function () {
43114
- var response, err_1;
43147
+ var response, brand, err_1;
43115
43148
  return __generator(this, function (_a) {
43116
43149
  switch (_a.label) {
43117
43150
  case 0:
43118
43151
  if (this.brandPropValue.usePageData) {
43119
- return [2 /*return*/, this.pageSpecificData];
43152
+ return [2 /*return*/, {
43153
+ brand: null,
43154
+ brandPropValue: this.brandPropValue,
43155
+ }];
43120
43156
  }
43157
+ if (!this.brandPropValue.brandId)
43158
+ return [2 /*return*/, null];
43121
43159
  _a.label = 1;
43122
43160
  case 1:
43123
43161
  _a.trys.push([1, 3, , 4]);
43124
- if (!this.brandPropValue.brandId)
43125
- return [2 /*return*/, new IkasBrand({})];
43126
43162
  return [4 /*yield*/, IkasBrandAPI.listBrands({
43127
43163
  idList: [this.brandPropValue.brandId],
43128
43164
  })];
43129
43165
  case 2:
43130
43166
  response = _a.sent();
43131
- if (response.brands.length)
43132
- return [2 /*return*/, response.brands[0]];
43133
- else
43134
- return [2 /*return*/, getPlaceholderBrand()];
43167
+ brand = response.brands.length
43168
+ ? response.brands[0]
43169
+ : getPlaceholderBrand();
43170
+ return [2 /*return*/, {
43171
+ brand: brand,
43172
+ brandPropValue: this.brandPropValue,
43173
+ }];
43135
43174
  case 3:
43136
43175
  err_1 = _a.sent();
43137
43176
  console.log(err_1);
43138
43177
  return [3 /*break*/, 4];
43139
- case 4: return [2 /*return*/, new IkasBrand({})];
43178
+ case 4: return [2 /*return*/, null];
43140
43179
  }
43141
43180
  });
43142
43181
  });
@@ -43355,9 +43394,8 @@ var IkasImagePropValueProvider = /** @class */ (function () {
43355
43394
  }());
43356
43395
 
43357
43396
  var IkasCategoryPropValueProvider = /** @class */ (function () {
43358
- function IkasCategoryPropValueProvider(prop, pageSpecificData) {
43397
+ function IkasCategoryPropValueProvider(prop) {
43359
43398
  this.categoryPropValue = prop;
43360
- this.pageSpecificData = pageSpecificData;
43361
43399
  }
43362
43400
  IkasCategoryPropValueProvider.prototype.getValue = function () {
43363
43401
  return __awaiter(this, void 0, void 0, function () {
@@ -43366,7 +43404,10 @@ var IkasCategoryPropValueProvider = /** @class */ (function () {
43366
43404
  switch (_a.label) {
43367
43405
  case 0:
43368
43406
  if (this.categoryPropValue.usePageData) {
43369
- return [2 /*return*/, this.pageSpecificData];
43407
+ return [2 /*return*/, {
43408
+ category: null,
43409
+ categoryPropValue: this.categoryPropValue,
43410
+ }];
43370
43411
  }
43371
43412
  if (!this.categoryPropValue.categoryId)
43372
43413
  return [2 /*return*/, null];
@@ -43378,8 +43419,13 @@ var IkasCategoryPropValueProvider = /** @class */ (function () {
43378
43419
  })];
43379
43420
  case 2:
43380
43421
  response = _a.sent();
43381
- category = response.categories[0];
43382
- return [2 /*return*/, new IkasCategory(category)];
43422
+ category = response.categories.length
43423
+ ? response.categories[0]
43424
+ : getPlaceholderCategory();
43425
+ return [2 /*return*/, {
43426
+ category: category,
43427
+ categoryPropValue: this.categoryPropValue,
43428
+ }];
43383
43429
  case 3:
43384
43430
  err_1 = _a.sent();
43385
43431
  console.log(err_1);
@@ -43431,9 +43477,8 @@ var IkasRichTextPropValueProvider = /** @class */ (function () {
43431
43477
  }());
43432
43478
 
43433
43479
  var IkasBlogPropValueProvider = /** @class */ (function () {
43434
- function IkasBlogPropValueProvider(propValue, pageSpecificData) {
43480
+ function IkasBlogPropValueProvider(propValue) {
43435
43481
  this.blogPropValue = propValue;
43436
- this.pageSpecificData = pageSpecificData;
43437
43482
  }
43438
43483
  IkasBlogPropValueProvider.prototype.getValue = function () {
43439
43484
  var _a;
@@ -43443,7 +43488,10 @@ var IkasBlogPropValueProvider = /** @class */ (function () {
43443
43488
  switch (_b.label) {
43444
43489
  case 0:
43445
43490
  if ((_a = this.blogPropValue) === null || _a === void 0 ? void 0 : _a.usePageData) {
43446
- return [2 /*return*/, this.pageSpecificData || getPlaceholderBlog()];
43491
+ return [2 /*return*/, {
43492
+ blog: null,
43493
+ blogPropValue: this.blogPropValue,
43494
+ }];
43447
43495
  }
43448
43496
  if (!this.blogPropValue.blogId)
43449
43497
  return [2 /*return*/, null];
@@ -43452,10 +43500,10 @@ var IkasBlogPropValueProvider = /** @class */ (function () {
43452
43500
  })];
43453
43501
  case 1:
43454
43502
  blog = _b.sent();
43455
- if (blog)
43456
- return [2 /*return*/, blog];
43457
- else
43458
- return [2 /*return*/, getPlaceholderBlog()];
43503
+ return [2 /*return*/, {
43504
+ blog: blog || getPlaceholderBlog(),
43505
+ blogPropValue: this.blogPropValue,
43506
+ }];
43459
43507
  }
43460
43508
  });
43461
43509
  });
@@ -43516,7 +43564,7 @@ var IkasAttributePropValueProvider = /** @class */ (function () {
43516
43564
  return __generator(this, function (_b) {
43517
43565
  switch (_b.label) {
43518
43566
  case 0:
43519
- if (!this.attributePropValue.attributeId ||
43567
+ if (!this.attributePropValue.attributeId || ((_a = this.attributePropValue) === null || _a === void 0 ? void 0 : _a.usePageData) ||
43520
43568
  (!this.attributePropValue.usePageData &&
43521
43569
  !this.attributePropValue.variantId)) {
43522
43570
  return [2 /*return*/, {
@@ -43524,17 +43572,12 @@ var IkasAttributePropValueProvider = /** @class */ (function () {
43524
43572
  attributePropValue: this.attributePropValue,
43525
43573
  }];
43526
43574
  }
43527
- if (!((_a = this.attributePropValue) === null || _a === void 0 ? void 0 : _a.usePageData)) return [3 /*break*/, 1];
43528
- return [2 /*return*/, {
43529
- productDetail: null,
43530
- attributePropValue: this.attributePropValue,
43531
- }];
43532
- case 1: return [4 /*yield*/, IkasProductSearchAPI.searchProducts({
43533
- productIdList: [this.attributePropValue.productId],
43534
- priceListId: IkasStorefrontConfig.priceListId,
43535
- salesChannelId: IkasStorefrontConfig.salesChannelId,
43536
- })];
43537
- case 2:
43575
+ return [4 /*yield*/, IkasProductSearchAPI.searchProducts({
43576
+ productIdList: [this.attributePropValue.productId],
43577
+ priceListId: IkasStorefrontConfig.priceListId,
43578
+ salesChannelId: IkasStorefrontConfig.salesChannelId,
43579
+ })];
43580
+ case 1:
43538
43581
  productSearchResponse = _b.sent();
43539
43582
  if (productSearchResponse) {
43540
43583
  productList = productSearchResponse.data;
@@ -43551,15 +43594,8 @@ var IkasAttributePropValueProvider = /** @class */ (function () {
43551
43594
  }
43552
43595
  }
43553
43596
  }
43554
- _b.label = 3;
43555
- case 3:
43556
- if (!productDetail)
43557
- return [2 /*return*/, {
43558
- productDetail: null,
43559
- attributePropValue: this.attributePropValue,
43560
- }];
43561
43597
  return [2 /*return*/, {
43562
- productDetail: productDetail,
43598
+ productDetail: productDetail || null,
43563
43599
  attributePropValue: this.attributePropValue,
43564
43600
  }];
43565
43601
  }
@@ -43570,34 +43606,33 @@ var IkasAttributePropValueProvider = /** @class */ (function () {
43570
43606
  }());
43571
43607
 
43572
43608
  var IkasAttributeListPropValueProvider = /** @class */ (function () {
43573
- function IkasAttributeListPropValueProvider(prop, pageSpecificData) {
43609
+ function IkasAttributeListPropValueProvider(prop) {
43574
43610
  this.attributeListPropValue = prop;
43575
- this.pageSpecificData = pageSpecificData;
43576
43611
  }
43577
43612
  IkasAttributeListPropValueProvider.prototype.getValue = function () {
43578
- var _a, _b;
43613
+ var _a;
43579
43614
  return __awaiter(this, void 0, void 0, function () {
43580
- var productDetail, productSearchResponse, productList, product, variant, groupedValues;
43615
+ var productDetail, productSearchResponse, productList, product, variant;
43581
43616
  var _this = this;
43582
- return __generator(this, function (_c) {
43583
- switch (_c.label) {
43617
+ return __generator(this, function (_b) {
43618
+ switch (_b.label) {
43584
43619
  case 0:
43585
43620
  if (!((_a = this.attributeListPropValue.attributeIds) === null || _a === void 0 ? void 0 : _a.length) ||
43586
- (this.attributeListPropValue.usePageData && !this.pageSpecificData) ||
43621
+ this.attributeListPropValue.usePageData ||
43587
43622
  (!this.attributeListPropValue.usePageData &&
43588
43623
  !this.attributeListPropValue.variantId)) {
43589
- return [2 /*return*/, []];
43624
+ return [2 /*return*/, {
43625
+ productDetail: null,
43626
+ attributeListPropValue: this.attributeListPropValue,
43627
+ }];
43590
43628
  }
43591
- if (!((_b = this.attributeListPropValue) === null || _b === void 0 ? void 0 : _b.usePageData)) return [3 /*break*/, 1];
43592
- productDetail = this.pageSpecificData;
43593
- return [3 /*break*/, 3];
43594
- case 1: return [4 /*yield*/, IkasProductSearchAPI.searchProducts({
43595
- productIdList: [this.attributeListPropValue.productId],
43596
- priceListId: IkasStorefrontConfig.priceListId,
43597
- salesChannelId: IkasStorefrontConfig.salesChannelId,
43598
- })];
43599
- case 2:
43600
- productSearchResponse = _c.sent();
43629
+ return [4 /*yield*/, IkasProductSearchAPI.searchProducts({
43630
+ productIdList: [this.attributeListPropValue.productId],
43631
+ priceListId: IkasStorefrontConfig.priceListId,
43632
+ salesChannelId: IkasStorefrontConfig.salesChannelId,
43633
+ })];
43634
+ case 1:
43635
+ productSearchResponse = _b.sent();
43601
43636
  if (productSearchResponse) {
43602
43637
  productList = productSearchResponse.data;
43603
43638
  if (productList.length) {
@@ -43613,23 +43648,10 @@ var IkasAttributeListPropValueProvider = /** @class */ (function () {
43613
43648
  }
43614
43649
  }
43615
43650
  }
43616
- _c.label = 3;
43617
- case 3:
43618
- if (!productDetail)
43619
- return [2 /*return*/, []];
43620
- groupedValues = productDetail.product.hasVariant
43621
- ? groupBy_1(productDetail.selectedVariant.attributes.filter(function (a) { var _a; return (_a = _this.attributeListPropValue.attributeIds) === null || _a === void 0 ? void 0 : _a.includes(a.productAttributeId || ""); }), "productAttributeId")
43622
- : groupBy_1(productDetail.product.attributes.filter(function (a) { var _a; return (_a = _this.attributeListPropValue.attributeIds) === null || _a === void 0 ? void 0 : _a.includes(a.productAttributeId || ""); }), "productAttributeId");
43623
- return [2 /*return*/, this.attributeListPropValue.attributeIds
43624
- .map(function (attributeId) {
43625
- var values = groupedValues[attributeId];
43626
- if ((values === null || values === void 0 ? void 0 : values.length) && values[0].productAttribute)
43627
- return {
43628
- attribute: values[0].productAttribute,
43629
- values: values,
43630
- };
43631
- })
43632
- .filter(function (v) { return !!v; })];
43651
+ return [2 /*return*/, {
43652
+ productDetail: productDetail || null,
43653
+ attributeListPropValue: this.attributeListPropValue,
43654
+ }];
43633
43655
  }
43634
43656
  });
43635
43657
  });
@@ -43638,9 +43660,8 @@ var IkasAttributeListPropValueProvider = /** @class */ (function () {
43638
43660
  }());
43639
43661
 
43640
43662
  var IkasBlogCategoryPropValueProvider = /** @class */ (function () {
43641
- function IkasBlogCategoryPropValueProvider(propValue, pageSpecificData) {
43663
+ function IkasBlogCategoryPropValueProvider(propValue) {
43642
43664
  this.blogCategoryPropValue = propValue;
43643
- this.pageSpecificData = pageSpecificData;
43644
43665
  }
43645
43666
  IkasBlogCategoryPropValueProvider.prototype.getValue = function () {
43646
43667
  var _a;
@@ -43650,7 +43671,10 @@ var IkasBlogCategoryPropValueProvider = /** @class */ (function () {
43650
43671
  switch (_b.label) {
43651
43672
  case 0:
43652
43673
  if ((_a = this.blogCategoryPropValue) === null || _a === void 0 ? void 0 : _a.usePageData) {
43653
- return [2 /*return*/, this.pageSpecificData || getPlaceholderBlogCategory()];
43674
+ return [2 /*return*/, {
43675
+ blogCategory: null,
43676
+ blogCategoryPropValue: this.blogCategoryPropValue,
43677
+ }];
43654
43678
  }
43655
43679
  if (!this.blogCategoryPropValue.blogCategoryId)
43656
43680
  return [2 /*return*/, null];
@@ -43661,10 +43685,10 @@ var IkasBlogCategoryPropValueProvider = /** @class */ (function () {
43661
43685
  })];
43662
43686
  case 1:
43663
43687
  blogCategory = _b.sent();
43664
- if (blogCategory && blogCategory.blogCategories.length)
43665
- return [2 /*return*/, blogCategory.blogCategories[0]];
43666
- else
43667
- return [2 /*return*/, getPlaceholderBlogCategory()];
43688
+ return [2 /*return*/, {
43689
+ blogCategory: blogCategory.blogCategories[0] || getPlaceholderBlogCategory(),
43690
+ blogCategoryPropValue: this.blogCategoryPropValue,
43691
+ }];
43668
43692
  }
43669
43693
  });
43670
43694
  });
@@ -43902,7 +43926,7 @@ var IkasCustomPropValueProvider = /** @class */ (function () {
43902
43926
  return __generator(this, function (_a) {
43903
43927
  switch (_a.label) {
43904
43928
  case 0:
43905
- provider = new IkasBrandPropValueProvider(this.value, this.pageSpecificData);
43929
+ provider = new IkasBrandPropValueProvider(this.value);
43906
43930
  return [4 /*yield*/, provider.getValue()];
43907
43931
  case 1:
43908
43932
  value = _a.sent();
@@ -43938,7 +43962,7 @@ var IkasCustomPropValueProvider = /** @class */ (function () {
43938
43962
  return __generator(this, function (_a) {
43939
43963
  switch (_a.label) {
43940
43964
  case 0:
43941
- provider = new IkasCategoryPropValueProvider(this.value, this.pageSpecificData);
43965
+ provider = new IkasCategoryPropValueProvider(this.value);
43942
43966
  return [4 /*yield*/, provider.getValue()];
43943
43967
  case 1:
43944
43968
  value = _a.sent();
@@ -44100,7 +44124,7 @@ var IkasCustomPropValueProvider = /** @class */ (function () {
44100
44124
  return __generator(this, function (_a) {
44101
44125
  switch (_a.label) {
44102
44126
  case 0:
44103
- provider = new IkasAttributeListPropValueProvider(this.value, this.pageSpecificData);
44127
+ provider = new IkasAttributeListPropValueProvider(this.value);
44104
44128
  return [4 /*yield*/, provider.getValue()];
44105
44129
  case 1:
44106
44130
  value = _a.sent();
@@ -44268,7 +44292,7 @@ var IkasCustomPropValueProvider = /** @class */ (function () {
44268
44292
  return __generator(this, function (_a) {
44269
44293
  switch (_a.label) {
44270
44294
  case 0:
44271
- provider = new IkasBlogPropValueProvider(this.value, this.pageSpecificData);
44295
+ provider = new IkasBlogPropValueProvider(this.value);
44272
44296
  return [4 /*yield*/, provider.getValue()];
44273
44297
  case 1:
44274
44298
  value = _a.sent();
@@ -44304,7 +44328,7 @@ var IkasCustomPropValueProvider = /** @class */ (function () {
44304
44328
  return __generator(this, function (_a) {
44305
44329
  switch (_a.label) {
44306
44330
  case 0:
44307
- provider = new IkasBlogCategoryPropValueProvider(this.value, this.pageSpecificData);
44331
+ provider = new IkasBlogCategoryPropValueProvider(this.value);
44308
44332
  return [4 /*yield*/, provider.getValue()];
44309
44333
  case 1:
44310
44334
  value = _a.sent();
@@ -44738,10 +44762,10 @@ var IkasPageDataProvider = /** @class */ (function () {
44738
44762
  propValueProvider = new IkasAttributePropValueProvider(propValue);
44739
44763
  return [3 /*break*/, 24];
44740
44764
  case 11:
44741
- propValueProvider = new IkasAttributeListPropValueProvider(propValue, this.pageSpecificData);
44765
+ propValueProvider = new IkasAttributeListPropValueProvider(propValue);
44742
44766
  return [3 /*break*/, 24];
44743
44767
  case 12:
44744
- propValueProvider = new IkasCategoryPropValueProvider(propValue, this.pageSpecificData);
44768
+ propValueProvider = new IkasCategoryPropValueProvider(propValue);
44745
44769
  return [3 /*break*/, 24];
44746
44770
  case 13:
44747
44771
  propValueProvider = new IkasCategoryListPropValueProvider(propValue);
@@ -44807,6 +44831,8 @@ var IkasPageDataInit = /** @class */ (function () {
44807
44831
  }
44808
44832
  IkasPageDataInit.setPageSpecificData = function (pageSpecficicDataStr, pageType, isBrowser // Will be sent from reinit on IkasPage
44809
44833
  ) {
44834
+ if (!pageSpecficicDataStr)
44835
+ return;
44810
44836
  var parsed = JSON.parse(pageSpecficicDataStr);
44811
44837
  switch (pageType) {
44812
44838
  case IkasThemePageType.PRODUCT:
@@ -44915,7 +44941,13 @@ var IkasPageDataInit = /** @class */ (function () {
44915
44941
  pageComponentPropValue.propValues[prop.name] = IkasPageDataInit._initBrandPropValue(propValue);
44916
44942
  };
44917
44943
  IkasPageDataInit._initBrandPropValue = function (propValue) {
44918
- return new IkasBrand(propValue);
44944
+ if (propValue.brandPropValue.usePageData) {
44945
+ return this.pageSpecificData;
44946
+ }
44947
+ if (propValue.brand) {
44948
+ return new IkasBrand(propValue.brand);
44949
+ }
44950
+ return getPlaceholderBrand();
44919
44951
  };
44920
44952
  IkasPageDataInit.initBrandListPropValue = function (prop, propValue, pageComponentPropValue) {
44921
44953
  pageComponentPropValue.propValues[prop.name] = IkasPageDataInit._initBrandListPropValue(propValue);
@@ -44927,7 +44959,13 @@ var IkasPageDataInit = /** @class */ (function () {
44927
44959
  pageComponentPropValue.propValues[prop.name] = IkasPageDataInit._initCategoryPropValue(propValue);
44928
44960
  };
44929
44961
  IkasPageDataInit._initCategoryPropValue = function (propValue) {
44930
- return new IkasCategory(propValue);
44962
+ if (propValue.categoryPropValue.usePageData) {
44963
+ return this.pageSpecificData;
44964
+ }
44965
+ if (propValue.category) {
44966
+ return new IkasCategory(propValue.category);
44967
+ }
44968
+ return getPlaceholderCategory();
44931
44969
  };
44932
44970
  IkasPageDataInit.initCategoryListPropValue = function (prop, propValue, pageComponentPropValue) {
44933
44971
  var categoryList = new IkasCategoryList(propValue);
@@ -45003,12 +45041,14 @@ var IkasPageDataInit = /** @class */ (function () {
45003
45041
  pageComponentPropValue.propValues[prop.name] = IkasPageDataInit._initAttributeListPropValue(propValue);
45004
45042
  };
45005
45043
  IkasPageDataInit._initAttributeListPropValue = function (propValue) {
45006
- return propValue
45007
- ? propValue.map(function (p) { return ({
45008
- attribute: new IkasProductAttribute(p.attribute),
45009
- values: p.values.map(function (v) { return new IkasProductAttributeValue(v); }),
45010
- }); })
45011
- : [];
45044
+ var productDetail = null;
45045
+ if (propValue.attributeListPropValue.usePageData) {
45046
+ productDetail = this.pageSpecificData;
45047
+ }
45048
+ else if (propValue.productDetail) {
45049
+ productDetail = new IkasProductDetail(propValue.productDetail.product, propValue.productDetail.selectedVariantValues);
45050
+ }
45051
+ return new IkasAttributeList(productDetail, propValue.attributeListPropValue);
45012
45052
  };
45013
45053
  IkasPageDataInit.initLinkPropValue = function (prop, propValue, pageComponentPropValue) {
45014
45054
  pageComponentPropValue.propValues[prop.name] = this._initLinkPropValue(propValue);
@@ -45153,7 +45193,13 @@ var IkasPageDataInit = /** @class */ (function () {
45153
45193
  pageComponentPropValue.propValues[prop.name] = IkasPageDataInit._initBlogPropValue(propValue);
45154
45194
  };
45155
45195
  IkasPageDataInit._initBlogPropValue = function (propValue) {
45156
- return new IkasBlog(propValue);
45196
+ if (propValue.blogPropValue.usePageData) {
45197
+ return this.pageSpecificData;
45198
+ }
45199
+ if (propValue.blog) {
45200
+ return new IkasBlog(propValue.blog);
45201
+ }
45202
+ return getPlaceholderBlog();
45157
45203
  };
45158
45204
  IkasPageDataInit.initBlogListPropValue = function (prop, propValue, pageComponentPropValue) {
45159
45205
  pageComponentPropValue.propValues[prop.name] = this._initBlogListPropValue(propValue);
@@ -45165,7 +45211,13 @@ var IkasPageDataInit = /** @class */ (function () {
45165
45211
  pageComponentPropValue.propValues[prop.name] = IkasPageDataInit._initBlogCategoryPropValue(propValue);
45166
45212
  };
45167
45213
  IkasPageDataInit._initBlogCategoryPropValue = function (propValue) {
45168
- return new IkasBlogCategory(propValue);
45214
+ if (propValue.blogCategoryPropValue.usePageData) {
45215
+ return this.pageSpecificData;
45216
+ }
45217
+ if (propValue.blogCategory) {
45218
+ return new IkasBlogCategory(propValue.blogCategory);
45219
+ }
45220
+ return getPlaceholderBlogCategory();
45169
45221
  };
45170
45222
  IkasPageDataInit.initBlogCategoryListPropValue = function (prop, propValue, pageComponentPropValue) {
45171
45223
  pageComponentPropValue.propValues[prop.name] = this._initBlogCategoryListPropValue(propValue);
@@ -45194,7 +45246,7 @@ var ThemeComponent = observer(function (_a) {
45194
45246
  if (!Component) {
45195
45247
  console.error("COMPONENT NOT FOUND!", pageComponent.id, pageComponent.componentId, components ? Object.keys(components) : []);
45196
45248
  }
45197
- return (createElement("div", { id: index + "" }, hasNullValue.get() ? null : (createElement(Component, __assign({ key: pageComponent.id }, propValues, { settings: settings, store: store })))));
45249
+ return (createElement("div", { id: index + "" }, hasNullValue.get() ? null : (createElement(Component, __assign({ key: pageComponent.id }, propValues, { settings: settings, store: store, pageSpecificData: IkasPageDataInit.pageSpecificData })))));
45198
45250
  });
45199
45251
 
45200
45252
  var IkasPageHead = observer(function (_a) {
@@ -70480,7 +70532,7 @@ var ThemeEditorComponent = observer(function (_a) {
70480
70532
  };
70481
70533
  var rendered = computed(function () {
70482
70534
  var _a;
70483
- return hasNullValue.get() ? (createElement(ErrorComponent, null)) : (createElement(Component, __assign({ store: store }, propValues, { settings: (_a = vm.theme) === null || _a === void 0 ? void 0 : _a.settings })));
70535
+ return hasNullValue.get() ? (createElement(ErrorComponent, null)) : (createElement(Component, __assign({ store: store }, propValues, { settings: (_a = vm.theme) === null || _a === void 0 ? void 0 : _a.settings, pageSpecificData: IkasPageDataInit.pageSpecificData })));
70484
70536
  });
70485
70537
  return (createElement("div", { ref: ref, style: { position: "relative" }, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onClick: onClick },
70486
70538
  rendered.get(),
package/build/index.js CHANGED
@@ -42926,6 +42926,37 @@ var IkasVariantTypeAPI = /** @class */ (function () {
42926
42926
  }());
42927
42927
  var templateObject_1$g;
42928
42928
 
42929
+ var IkasAttributeList = /** @class */ (function () {
42930
+ function IkasAttributeList(productDetail, attributeListPropValue) {
42931
+ this.productDetail = null;
42932
+ this.productDetail = productDetail;
42933
+ this.attributeListPropValue = attributeListPropValue;
42934
+ mobx.makeAutoObservable(this);
42935
+ }
42936
+ Object.defineProperty(IkasAttributeList.prototype, "values", {
42937
+ get: function () {
42938
+ var _this = this;
42939
+ var _a;
42940
+ if (!this.productDetail)
42941
+ return [];
42942
+ var groupedValues = this.productDetail.product.hasVariant
42943
+ ? groupBy_1(this.productDetail.selectedVariant.attributes.filter(function (a) { var _a; return (_a = _this.attributeListPropValue.attributeIds) === null || _a === void 0 ? void 0 : _a.includes(a.productAttributeId || ""); }), "productAttributeId")
42944
+ : groupBy_1(this.productDetail.product.attributes.filter(function (a) { var _a; return (_a = _this.attributeListPropValue.attributeIds) === null || _a === void 0 ? void 0 : _a.includes(a.productAttributeId || ""); }), "productAttributeId");
42945
+ return (((_a = this.attributeListPropValue.attributeIds) === null || _a === void 0 ? void 0 : _a.map(function (attributeId) {
42946
+ var values = groupedValues[attributeId];
42947
+ if ((values === null || values === void 0 ? void 0 : values.length) && values[0].productAttribute)
42948
+ return {
42949
+ attribute: values[0].productAttribute,
42950
+ values: values,
42951
+ };
42952
+ }).filter(function (v) { return !!v; })) || []);
42953
+ },
42954
+ enumerable: false,
42955
+ configurable: true
42956
+ });
42957
+ return IkasAttributeList;
42958
+ }());
42959
+
42929
42960
  var IkasProductListPropValueProvider = /** @class */ (function () {
42930
42961
  function IkasProductListPropValueProvider(pageType, productListPropValue, pageSpecificData) {
42931
42962
  this.pageType = pageType;
@@ -42985,6 +43016,9 @@ function getPlaceholderProduct() {
42985
43016
  variants: [new IkasProductVariant()],
42986
43017
  }), []);
42987
43018
  }
43019
+ function getPlaceholderCategory() {
43020
+ return new IkasCategory();
43021
+ }
42988
43022
  function getPlaceholderBrand() {
42989
43023
  return new IkasBrand();
42990
43024
  }
@@ -43084,38 +43118,43 @@ var IkasBrandListPropValueProvider = /** @class */ (function () {
43084
43118
  }());
43085
43119
 
43086
43120
  var IkasBrandPropValueProvider = /** @class */ (function () {
43087
- function IkasBrandPropValueProvider(prop, pageSpecificData) {
43121
+ function IkasBrandPropValueProvider(prop) {
43088
43122
  this.brandPropValue = prop;
43089
- this.pageSpecificData = pageSpecificData;
43090
43123
  }
43091
43124
  IkasBrandPropValueProvider.prototype.getValue = function () {
43092
43125
  return __awaiter(this, void 0, void 0, function () {
43093
- var response, err_1;
43126
+ var response, brand, err_1;
43094
43127
  return __generator(this, function (_a) {
43095
43128
  switch (_a.label) {
43096
43129
  case 0:
43097
43130
  if (this.brandPropValue.usePageData) {
43098
- return [2 /*return*/, this.pageSpecificData];
43131
+ return [2 /*return*/, {
43132
+ brand: null,
43133
+ brandPropValue: this.brandPropValue,
43134
+ }];
43099
43135
  }
43136
+ if (!this.brandPropValue.brandId)
43137
+ return [2 /*return*/, null];
43100
43138
  _a.label = 1;
43101
43139
  case 1:
43102
43140
  _a.trys.push([1, 3, , 4]);
43103
- if (!this.brandPropValue.brandId)
43104
- return [2 /*return*/, new IkasBrand({})];
43105
43141
  return [4 /*yield*/, IkasBrandAPI.listBrands({
43106
43142
  idList: [this.brandPropValue.brandId],
43107
43143
  })];
43108
43144
  case 2:
43109
43145
  response = _a.sent();
43110
- if (response.brands.length)
43111
- return [2 /*return*/, response.brands[0]];
43112
- else
43113
- return [2 /*return*/, getPlaceholderBrand()];
43146
+ brand = response.brands.length
43147
+ ? response.brands[0]
43148
+ : getPlaceholderBrand();
43149
+ return [2 /*return*/, {
43150
+ brand: brand,
43151
+ brandPropValue: this.brandPropValue,
43152
+ }];
43114
43153
  case 3:
43115
43154
  err_1 = _a.sent();
43116
43155
  console.log(err_1);
43117
43156
  return [3 /*break*/, 4];
43118
- case 4: return [2 /*return*/, new IkasBrand({})];
43157
+ case 4: return [2 /*return*/, null];
43119
43158
  }
43120
43159
  });
43121
43160
  });
@@ -43334,9 +43373,8 @@ var IkasImagePropValueProvider = /** @class */ (function () {
43334
43373
  }());
43335
43374
 
43336
43375
  var IkasCategoryPropValueProvider = /** @class */ (function () {
43337
- function IkasCategoryPropValueProvider(prop, pageSpecificData) {
43376
+ function IkasCategoryPropValueProvider(prop) {
43338
43377
  this.categoryPropValue = prop;
43339
- this.pageSpecificData = pageSpecificData;
43340
43378
  }
43341
43379
  IkasCategoryPropValueProvider.prototype.getValue = function () {
43342
43380
  return __awaiter(this, void 0, void 0, function () {
@@ -43345,7 +43383,10 @@ var IkasCategoryPropValueProvider = /** @class */ (function () {
43345
43383
  switch (_a.label) {
43346
43384
  case 0:
43347
43385
  if (this.categoryPropValue.usePageData) {
43348
- return [2 /*return*/, this.pageSpecificData];
43386
+ return [2 /*return*/, {
43387
+ category: null,
43388
+ categoryPropValue: this.categoryPropValue,
43389
+ }];
43349
43390
  }
43350
43391
  if (!this.categoryPropValue.categoryId)
43351
43392
  return [2 /*return*/, null];
@@ -43357,8 +43398,13 @@ var IkasCategoryPropValueProvider = /** @class */ (function () {
43357
43398
  })];
43358
43399
  case 2:
43359
43400
  response = _a.sent();
43360
- category = response.categories[0];
43361
- return [2 /*return*/, new IkasCategory(category)];
43401
+ category = response.categories.length
43402
+ ? response.categories[0]
43403
+ : getPlaceholderCategory();
43404
+ return [2 /*return*/, {
43405
+ category: category,
43406
+ categoryPropValue: this.categoryPropValue,
43407
+ }];
43362
43408
  case 3:
43363
43409
  err_1 = _a.sent();
43364
43410
  console.log(err_1);
@@ -43410,9 +43456,8 @@ var IkasRichTextPropValueProvider = /** @class */ (function () {
43410
43456
  }());
43411
43457
 
43412
43458
  var IkasBlogPropValueProvider = /** @class */ (function () {
43413
- function IkasBlogPropValueProvider(propValue, pageSpecificData) {
43459
+ function IkasBlogPropValueProvider(propValue) {
43414
43460
  this.blogPropValue = propValue;
43415
- this.pageSpecificData = pageSpecificData;
43416
43461
  }
43417
43462
  IkasBlogPropValueProvider.prototype.getValue = function () {
43418
43463
  var _a;
@@ -43422,7 +43467,10 @@ var IkasBlogPropValueProvider = /** @class */ (function () {
43422
43467
  switch (_b.label) {
43423
43468
  case 0:
43424
43469
  if ((_a = this.blogPropValue) === null || _a === void 0 ? void 0 : _a.usePageData) {
43425
- return [2 /*return*/, this.pageSpecificData || getPlaceholderBlog()];
43470
+ return [2 /*return*/, {
43471
+ blog: null,
43472
+ blogPropValue: this.blogPropValue,
43473
+ }];
43426
43474
  }
43427
43475
  if (!this.blogPropValue.blogId)
43428
43476
  return [2 /*return*/, null];
@@ -43431,10 +43479,10 @@ var IkasBlogPropValueProvider = /** @class */ (function () {
43431
43479
  })];
43432
43480
  case 1:
43433
43481
  blog = _b.sent();
43434
- if (blog)
43435
- return [2 /*return*/, blog];
43436
- else
43437
- return [2 /*return*/, getPlaceholderBlog()];
43482
+ return [2 /*return*/, {
43483
+ blog: blog || getPlaceholderBlog(),
43484
+ blogPropValue: this.blogPropValue,
43485
+ }];
43438
43486
  }
43439
43487
  });
43440
43488
  });
@@ -43495,7 +43543,7 @@ var IkasAttributePropValueProvider = /** @class */ (function () {
43495
43543
  return __generator(this, function (_b) {
43496
43544
  switch (_b.label) {
43497
43545
  case 0:
43498
- if (!this.attributePropValue.attributeId ||
43546
+ if (!this.attributePropValue.attributeId || ((_a = this.attributePropValue) === null || _a === void 0 ? void 0 : _a.usePageData) ||
43499
43547
  (!this.attributePropValue.usePageData &&
43500
43548
  !this.attributePropValue.variantId)) {
43501
43549
  return [2 /*return*/, {
@@ -43503,17 +43551,12 @@ var IkasAttributePropValueProvider = /** @class */ (function () {
43503
43551
  attributePropValue: this.attributePropValue,
43504
43552
  }];
43505
43553
  }
43506
- if (!((_a = this.attributePropValue) === null || _a === void 0 ? void 0 : _a.usePageData)) return [3 /*break*/, 1];
43507
- return [2 /*return*/, {
43508
- productDetail: null,
43509
- attributePropValue: this.attributePropValue,
43510
- }];
43511
- case 1: return [4 /*yield*/, IkasProductSearchAPI.searchProducts({
43512
- productIdList: [this.attributePropValue.productId],
43513
- priceListId: IkasStorefrontConfig.priceListId,
43514
- salesChannelId: IkasStorefrontConfig.salesChannelId,
43515
- })];
43516
- case 2:
43554
+ return [4 /*yield*/, IkasProductSearchAPI.searchProducts({
43555
+ productIdList: [this.attributePropValue.productId],
43556
+ priceListId: IkasStorefrontConfig.priceListId,
43557
+ salesChannelId: IkasStorefrontConfig.salesChannelId,
43558
+ })];
43559
+ case 1:
43517
43560
  productSearchResponse = _b.sent();
43518
43561
  if (productSearchResponse) {
43519
43562
  productList = productSearchResponse.data;
@@ -43530,15 +43573,8 @@ var IkasAttributePropValueProvider = /** @class */ (function () {
43530
43573
  }
43531
43574
  }
43532
43575
  }
43533
- _b.label = 3;
43534
- case 3:
43535
- if (!productDetail)
43536
- return [2 /*return*/, {
43537
- productDetail: null,
43538
- attributePropValue: this.attributePropValue,
43539
- }];
43540
43576
  return [2 /*return*/, {
43541
- productDetail: productDetail,
43577
+ productDetail: productDetail || null,
43542
43578
  attributePropValue: this.attributePropValue,
43543
43579
  }];
43544
43580
  }
@@ -43549,34 +43585,33 @@ var IkasAttributePropValueProvider = /** @class */ (function () {
43549
43585
  }());
43550
43586
 
43551
43587
  var IkasAttributeListPropValueProvider = /** @class */ (function () {
43552
- function IkasAttributeListPropValueProvider(prop, pageSpecificData) {
43588
+ function IkasAttributeListPropValueProvider(prop) {
43553
43589
  this.attributeListPropValue = prop;
43554
- this.pageSpecificData = pageSpecificData;
43555
43590
  }
43556
43591
  IkasAttributeListPropValueProvider.prototype.getValue = function () {
43557
- var _a, _b;
43592
+ var _a;
43558
43593
  return __awaiter(this, void 0, void 0, function () {
43559
- var productDetail, productSearchResponse, productList, product, variant, groupedValues;
43594
+ var productDetail, productSearchResponse, productList, product, variant;
43560
43595
  var _this = this;
43561
- return __generator(this, function (_c) {
43562
- switch (_c.label) {
43596
+ return __generator(this, function (_b) {
43597
+ switch (_b.label) {
43563
43598
  case 0:
43564
43599
  if (!((_a = this.attributeListPropValue.attributeIds) === null || _a === void 0 ? void 0 : _a.length) ||
43565
- (this.attributeListPropValue.usePageData && !this.pageSpecificData) ||
43600
+ this.attributeListPropValue.usePageData ||
43566
43601
  (!this.attributeListPropValue.usePageData &&
43567
43602
  !this.attributeListPropValue.variantId)) {
43568
- return [2 /*return*/, []];
43603
+ return [2 /*return*/, {
43604
+ productDetail: null,
43605
+ attributeListPropValue: this.attributeListPropValue,
43606
+ }];
43569
43607
  }
43570
- if (!((_b = this.attributeListPropValue) === null || _b === void 0 ? void 0 : _b.usePageData)) return [3 /*break*/, 1];
43571
- productDetail = this.pageSpecificData;
43572
- return [3 /*break*/, 3];
43573
- case 1: return [4 /*yield*/, IkasProductSearchAPI.searchProducts({
43574
- productIdList: [this.attributeListPropValue.productId],
43575
- priceListId: IkasStorefrontConfig.priceListId,
43576
- salesChannelId: IkasStorefrontConfig.salesChannelId,
43577
- })];
43578
- case 2:
43579
- productSearchResponse = _c.sent();
43608
+ return [4 /*yield*/, IkasProductSearchAPI.searchProducts({
43609
+ productIdList: [this.attributeListPropValue.productId],
43610
+ priceListId: IkasStorefrontConfig.priceListId,
43611
+ salesChannelId: IkasStorefrontConfig.salesChannelId,
43612
+ })];
43613
+ case 1:
43614
+ productSearchResponse = _b.sent();
43580
43615
  if (productSearchResponse) {
43581
43616
  productList = productSearchResponse.data;
43582
43617
  if (productList.length) {
@@ -43592,23 +43627,10 @@ var IkasAttributeListPropValueProvider = /** @class */ (function () {
43592
43627
  }
43593
43628
  }
43594
43629
  }
43595
- _c.label = 3;
43596
- case 3:
43597
- if (!productDetail)
43598
- return [2 /*return*/, []];
43599
- groupedValues = productDetail.product.hasVariant
43600
- ? groupBy_1(productDetail.selectedVariant.attributes.filter(function (a) { var _a; return (_a = _this.attributeListPropValue.attributeIds) === null || _a === void 0 ? void 0 : _a.includes(a.productAttributeId || ""); }), "productAttributeId")
43601
- : groupBy_1(productDetail.product.attributes.filter(function (a) { var _a; return (_a = _this.attributeListPropValue.attributeIds) === null || _a === void 0 ? void 0 : _a.includes(a.productAttributeId || ""); }), "productAttributeId");
43602
- return [2 /*return*/, this.attributeListPropValue.attributeIds
43603
- .map(function (attributeId) {
43604
- var values = groupedValues[attributeId];
43605
- if ((values === null || values === void 0 ? void 0 : values.length) && values[0].productAttribute)
43606
- return {
43607
- attribute: values[0].productAttribute,
43608
- values: values,
43609
- };
43610
- })
43611
- .filter(function (v) { return !!v; })];
43630
+ return [2 /*return*/, {
43631
+ productDetail: productDetail || null,
43632
+ attributeListPropValue: this.attributeListPropValue,
43633
+ }];
43612
43634
  }
43613
43635
  });
43614
43636
  });
@@ -43617,9 +43639,8 @@ var IkasAttributeListPropValueProvider = /** @class */ (function () {
43617
43639
  }());
43618
43640
 
43619
43641
  var IkasBlogCategoryPropValueProvider = /** @class */ (function () {
43620
- function IkasBlogCategoryPropValueProvider(propValue, pageSpecificData) {
43642
+ function IkasBlogCategoryPropValueProvider(propValue) {
43621
43643
  this.blogCategoryPropValue = propValue;
43622
- this.pageSpecificData = pageSpecificData;
43623
43644
  }
43624
43645
  IkasBlogCategoryPropValueProvider.prototype.getValue = function () {
43625
43646
  var _a;
@@ -43629,7 +43650,10 @@ var IkasBlogCategoryPropValueProvider = /** @class */ (function () {
43629
43650
  switch (_b.label) {
43630
43651
  case 0:
43631
43652
  if ((_a = this.blogCategoryPropValue) === null || _a === void 0 ? void 0 : _a.usePageData) {
43632
- return [2 /*return*/, this.pageSpecificData || getPlaceholderBlogCategory()];
43653
+ return [2 /*return*/, {
43654
+ blogCategory: null,
43655
+ blogCategoryPropValue: this.blogCategoryPropValue,
43656
+ }];
43633
43657
  }
43634
43658
  if (!this.blogCategoryPropValue.blogCategoryId)
43635
43659
  return [2 /*return*/, null];
@@ -43640,10 +43664,10 @@ var IkasBlogCategoryPropValueProvider = /** @class */ (function () {
43640
43664
  })];
43641
43665
  case 1:
43642
43666
  blogCategory = _b.sent();
43643
- if (blogCategory && blogCategory.blogCategories.length)
43644
- return [2 /*return*/, blogCategory.blogCategories[0]];
43645
- else
43646
- return [2 /*return*/, getPlaceholderBlogCategory()];
43667
+ return [2 /*return*/, {
43668
+ blogCategory: blogCategory.blogCategories[0] || getPlaceholderBlogCategory(),
43669
+ blogCategoryPropValue: this.blogCategoryPropValue,
43670
+ }];
43647
43671
  }
43648
43672
  });
43649
43673
  });
@@ -43881,7 +43905,7 @@ var IkasCustomPropValueProvider = /** @class */ (function () {
43881
43905
  return __generator(this, function (_a) {
43882
43906
  switch (_a.label) {
43883
43907
  case 0:
43884
- provider = new IkasBrandPropValueProvider(this.value, this.pageSpecificData);
43908
+ provider = new IkasBrandPropValueProvider(this.value);
43885
43909
  return [4 /*yield*/, provider.getValue()];
43886
43910
  case 1:
43887
43911
  value = _a.sent();
@@ -43917,7 +43941,7 @@ var IkasCustomPropValueProvider = /** @class */ (function () {
43917
43941
  return __generator(this, function (_a) {
43918
43942
  switch (_a.label) {
43919
43943
  case 0:
43920
- provider = new IkasCategoryPropValueProvider(this.value, this.pageSpecificData);
43944
+ provider = new IkasCategoryPropValueProvider(this.value);
43921
43945
  return [4 /*yield*/, provider.getValue()];
43922
43946
  case 1:
43923
43947
  value = _a.sent();
@@ -44079,7 +44103,7 @@ var IkasCustomPropValueProvider = /** @class */ (function () {
44079
44103
  return __generator(this, function (_a) {
44080
44104
  switch (_a.label) {
44081
44105
  case 0:
44082
- provider = new IkasAttributeListPropValueProvider(this.value, this.pageSpecificData);
44106
+ provider = new IkasAttributeListPropValueProvider(this.value);
44083
44107
  return [4 /*yield*/, provider.getValue()];
44084
44108
  case 1:
44085
44109
  value = _a.sent();
@@ -44247,7 +44271,7 @@ var IkasCustomPropValueProvider = /** @class */ (function () {
44247
44271
  return __generator(this, function (_a) {
44248
44272
  switch (_a.label) {
44249
44273
  case 0:
44250
- provider = new IkasBlogPropValueProvider(this.value, this.pageSpecificData);
44274
+ provider = new IkasBlogPropValueProvider(this.value);
44251
44275
  return [4 /*yield*/, provider.getValue()];
44252
44276
  case 1:
44253
44277
  value = _a.sent();
@@ -44283,7 +44307,7 @@ var IkasCustomPropValueProvider = /** @class */ (function () {
44283
44307
  return __generator(this, function (_a) {
44284
44308
  switch (_a.label) {
44285
44309
  case 0:
44286
- provider = new IkasBlogCategoryPropValueProvider(this.value, this.pageSpecificData);
44310
+ provider = new IkasBlogCategoryPropValueProvider(this.value);
44287
44311
  return [4 /*yield*/, provider.getValue()];
44288
44312
  case 1:
44289
44313
  value = _a.sent();
@@ -44717,10 +44741,10 @@ var IkasPageDataProvider = /** @class */ (function () {
44717
44741
  propValueProvider = new IkasAttributePropValueProvider(propValue);
44718
44742
  return [3 /*break*/, 24];
44719
44743
  case 11:
44720
- propValueProvider = new IkasAttributeListPropValueProvider(propValue, this.pageSpecificData);
44744
+ propValueProvider = new IkasAttributeListPropValueProvider(propValue);
44721
44745
  return [3 /*break*/, 24];
44722
44746
  case 12:
44723
- propValueProvider = new IkasCategoryPropValueProvider(propValue, this.pageSpecificData);
44747
+ propValueProvider = new IkasCategoryPropValueProvider(propValue);
44724
44748
  return [3 /*break*/, 24];
44725
44749
  case 13:
44726
44750
  propValueProvider = new IkasCategoryListPropValueProvider(propValue);
@@ -44786,6 +44810,8 @@ var IkasPageDataInit = /** @class */ (function () {
44786
44810
  }
44787
44811
  IkasPageDataInit.setPageSpecificData = function (pageSpecficicDataStr, pageType, isBrowser // Will be sent from reinit on IkasPage
44788
44812
  ) {
44813
+ if (!pageSpecficicDataStr)
44814
+ return;
44789
44815
  var parsed = JSON.parse(pageSpecficicDataStr);
44790
44816
  switch (pageType) {
44791
44817
  case exports.IkasThemePageType.PRODUCT:
@@ -44894,7 +44920,13 @@ var IkasPageDataInit = /** @class */ (function () {
44894
44920
  pageComponentPropValue.propValues[prop.name] = IkasPageDataInit._initBrandPropValue(propValue);
44895
44921
  };
44896
44922
  IkasPageDataInit._initBrandPropValue = function (propValue) {
44897
- return new IkasBrand(propValue);
44923
+ if (propValue.brandPropValue.usePageData) {
44924
+ return this.pageSpecificData;
44925
+ }
44926
+ if (propValue.brand) {
44927
+ return new IkasBrand(propValue.brand);
44928
+ }
44929
+ return getPlaceholderBrand();
44898
44930
  };
44899
44931
  IkasPageDataInit.initBrandListPropValue = function (prop, propValue, pageComponentPropValue) {
44900
44932
  pageComponentPropValue.propValues[prop.name] = IkasPageDataInit._initBrandListPropValue(propValue);
@@ -44906,7 +44938,13 @@ var IkasPageDataInit = /** @class */ (function () {
44906
44938
  pageComponentPropValue.propValues[prop.name] = IkasPageDataInit._initCategoryPropValue(propValue);
44907
44939
  };
44908
44940
  IkasPageDataInit._initCategoryPropValue = function (propValue) {
44909
- return new IkasCategory(propValue);
44941
+ if (propValue.categoryPropValue.usePageData) {
44942
+ return this.pageSpecificData;
44943
+ }
44944
+ if (propValue.category) {
44945
+ return new IkasCategory(propValue.category);
44946
+ }
44947
+ return getPlaceholderCategory();
44910
44948
  };
44911
44949
  IkasPageDataInit.initCategoryListPropValue = function (prop, propValue, pageComponentPropValue) {
44912
44950
  var categoryList = new IkasCategoryList(propValue);
@@ -44982,12 +45020,14 @@ var IkasPageDataInit = /** @class */ (function () {
44982
45020
  pageComponentPropValue.propValues[prop.name] = IkasPageDataInit._initAttributeListPropValue(propValue);
44983
45021
  };
44984
45022
  IkasPageDataInit._initAttributeListPropValue = function (propValue) {
44985
- return propValue
44986
- ? propValue.map(function (p) { return ({
44987
- attribute: new IkasProductAttribute(p.attribute),
44988
- values: p.values.map(function (v) { return new IkasProductAttributeValue(v); }),
44989
- }); })
44990
- : [];
45023
+ var productDetail = null;
45024
+ if (propValue.attributeListPropValue.usePageData) {
45025
+ productDetail = this.pageSpecificData;
45026
+ }
45027
+ else if (propValue.productDetail) {
45028
+ productDetail = new IkasProductDetail(propValue.productDetail.product, propValue.productDetail.selectedVariantValues);
45029
+ }
45030
+ return new IkasAttributeList(productDetail, propValue.attributeListPropValue);
44991
45031
  };
44992
45032
  IkasPageDataInit.initLinkPropValue = function (prop, propValue, pageComponentPropValue) {
44993
45033
  pageComponentPropValue.propValues[prop.name] = this._initLinkPropValue(propValue);
@@ -45132,7 +45172,13 @@ var IkasPageDataInit = /** @class */ (function () {
45132
45172
  pageComponentPropValue.propValues[prop.name] = IkasPageDataInit._initBlogPropValue(propValue);
45133
45173
  };
45134
45174
  IkasPageDataInit._initBlogPropValue = function (propValue) {
45135
- return new IkasBlog(propValue);
45175
+ if (propValue.blogPropValue.usePageData) {
45176
+ return this.pageSpecificData;
45177
+ }
45178
+ if (propValue.blog) {
45179
+ return new IkasBlog(propValue.blog);
45180
+ }
45181
+ return getPlaceholderBlog();
45136
45182
  };
45137
45183
  IkasPageDataInit.initBlogListPropValue = function (prop, propValue, pageComponentPropValue) {
45138
45184
  pageComponentPropValue.propValues[prop.name] = this._initBlogListPropValue(propValue);
@@ -45144,7 +45190,13 @@ var IkasPageDataInit = /** @class */ (function () {
45144
45190
  pageComponentPropValue.propValues[prop.name] = IkasPageDataInit._initBlogCategoryPropValue(propValue);
45145
45191
  };
45146
45192
  IkasPageDataInit._initBlogCategoryPropValue = function (propValue) {
45147
- return new IkasBlogCategory(propValue);
45193
+ if (propValue.blogCategoryPropValue.usePageData) {
45194
+ return this.pageSpecificData;
45195
+ }
45196
+ if (propValue.blogCategory) {
45197
+ return new IkasBlogCategory(propValue.blogCategory);
45198
+ }
45199
+ return getPlaceholderBlogCategory();
45148
45200
  };
45149
45201
  IkasPageDataInit.initBlogCategoryListPropValue = function (prop, propValue, pageComponentPropValue) {
45150
45202
  pageComponentPropValue.propValues[prop.name] = this._initBlogCategoryListPropValue(propValue);
@@ -45173,7 +45225,7 @@ var ThemeComponent = mobxReactLite.observer(function (_a) {
45173
45225
  if (!Component) {
45174
45226
  console.error("COMPONENT NOT FOUND!", pageComponent.id, pageComponent.componentId, components ? Object.keys(components) : []);
45175
45227
  }
45176
- return (React.createElement("div", { id: index + "" }, hasNullValue.get() ? null : (React.createElement(Component, __assign({ key: pageComponent.id }, propValues, { settings: settings, store: store })))));
45228
+ return (React.createElement("div", { id: index + "" }, hasNullValue.get() ? null : (React.createElement(Component, __assign({ key: pageComponent.id }, propValues, { settings: settings, store: store, pageSpecificData: IkasPageDataInit.pageSpecificData })))));
45177
45229
  });
45178
45230
 
45179
45231
  var IkasPageHead = mobxReactLite.observer(function (_a) {
@@ -70459,7 +70511,7 @@ var ThemeEditorComponent = mobxReactLite.observer(function (_a) {
70459
70511
  };
70460
70512
  var rendered = mobx.computed(function () {
70461
70513
  var _a;
70462
- return hasNullValue.get() ? (React.createElement(ErrorComponent, null)) : (React.createElement(Component, __assign({ store: store }, propValues, { settings: (_a = vm.theme) === null || _a === void 0 ? void 0 : _a.settings })));
70514
+ return hasNullValue.get() ? (React.createElement(ErrorComponent, null)) : (React.createElement(Component, __assign({ store: store }, propValues, { settings: (_a = vm.theme) === null || _a === void 0 ? void 0 : _a.settings, pageSpecificData: IkasPageDataInit.pageSpecificData })));
70463
70515
  });
70464
70516
  return (React.createElement("div", { ref: ref, style: { position: "relative" }, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onClick: onClick },
70465
70517
  rendered.get(),
@@ -0,0 +1,9 @@
1
+ import { IkasProductAttributeMap } from "../../data/index";
2
+ import { IkasProductDetail } from "../product-detail/index";
3
+ import { IkasAttributeListPropValue } from "../../theme/page/component/prop-value/attribute-list";
4
+ export declare class IkasAttributeList {
5
+ productDetail: IkasProductDetail | null;
6
+ attributeListPropValue: IkasAttributeListPropValue;
7
+ constructor(productDetail: IkasProductDetail | null, attributeListPropValue: IkasAttributeListPropValue);
8
+ get values(): IkasProductAttributeMap[];
9
+ }
@@ -1,10 +1,16 @@
1
1
  import { IkasThemePageType } from "../models/index";
2
2
  import { IkasCategoryListParams } from "../models/ui/category-list/index";
3
+ import { IkasAttributeList } from "../models/ui/product-attribute-list/index";
3
4
  import { IkasProductListParams } from "../models/ui/product-list/index";
4
5
  import { NextRouter } from "next/router";
5
- import { IkasThemeSettings, IkasThemeComponentProp, IkasBrand, IkasBrandListParams, IkasBrandList, IkasCategory, IkasCategoryList, IkasProductList, IkasProductDetail, IkasAttributeDetail, IkasProductAttributeValue, IkasProductAttributeMap, IkasProductAttribute, IkasNavigationLink, IkasImage, IkasThemeCustomData, IkasComponentRenderer, IkasBlog, IkasBlogListParams, IkasBlogList, IkasBlogCategory, IkasBlogCategoryListParams, IkasBlogCategoryList } from "../index";
6
+ import { IkasThemeSettings, IkasThemeComponentProp, IkasBrandListParams, IkasBrandList, IkasCategoryList, IkasProductList, IkasProductDetail, IkasAttributeDetail, IkasNavigationLink, IkasImage, IkasThemeCustomData, IkasComponentRenderer, IkasBlogListParams, IkasBlogList, IkasBlogCategoryListParams, IkasBlogCategoryList } from "../index";
6
7
  import { IkasPageComponentPropValue } from "./page-data-get";
7
8
  import { IkasAttributePropValueData } from "./prop-value/attribute";
9
+ import { IkasAttributeListPropValueData } from "./prop-value/attribute-list";
10
+ import { IkasBlogPropValueData } from "./prop-value/blog";
11
+ import { IkasBlogCategoryPropValueData } from "./prop-value/blog-category";
12
+ import { IkasBrandPropValueData } from "./prop-value/brand";
13
+ import { IkasCategoryPropValueData } from "./prop-value/category";
8
14
  import { CustomDataValue } from "./prop-value/custom";
9
15
  import { IkasProductDetailData } from "./prop-value/product-detail";
10
16
  export declare class IkasPageDataInit {
@@ -12,12 +18,12 @@ export declare class IkasPageDataInit {
12
18
  static setPageSpecificData(pageSpecficicDataStr: string, pageType: IkasThemePageType, isBrowser: boolean): void;
13
19
  static isServer(): boolean;
14
20
  static initPropValues(propValuesStr: string, router: NextRouter, settingsStr: string, isBrowser?: boolean): IkasPageComponentPropValue[];
15
- static initBrandPropValue(prop: IkasThemeComponentProp, propValue: any, pageComponentPropValue: IkasPageComponentPropValue): void;
16
- static _initBrandPropValue(propValue: IkasBrand): IkasBrand;
21
+ static initBrandPropValue(prop: IkasThemeComponentProp, propValue: IkasBrandPropValueData, pageComponentPropValue: IkasPageComponentPropValue): void;
22
+ static _initBrandPropValue(propValue: IkasBrandPropValueData): any;
17
23
  static initBrandListPropValue(prop: IkasThemeComponentProp, propValue: any, pageComponentPropValue: IkasPageComponentPropValue): void;
18
24
  static _initBrandListPropValue(propValue: IkasBrandListParams): IkasBrandList;
19
- static initCategoryPropValue(prop: IkasThemeComponentProp, propValue: any, pageComponentPropValue: IkasPageComponentPropValue): void;
20
- static _initCategoryPropValue(propValue: IkasCategory): IkasCategory;
25
+ static initCategoryPropValue(prop: IkasThemeComponentProp, propValue: IkasCategoryPropValueData, pageComponentPropValue: IkasPageComponentPropValue): void;
26
+ static _initCategoryPropValue(propValue: IkasCategoryPropValueData): any;
21
27
  static initCategoryListPropValue(prop: IkasThemeComponentProp, propValue: any, pageComponentPropValue: IkasPageComponentPropValue): void;
22
28
  static _initCategoryListPropValue(propValue: IkasCategoryListParams): IkasCategoryList;
23
29
  static initProductListPropValue(prop: IkasThemeComponentProp, propValue: any, pageComponentPropValue: IkasPageComponentPropValue, router: NextRouter): void;
@@ -27,11 +33,8 @@ export declare class IkasPageDataInit {
27
33
  static _initProductDetailOnBrowser(productDetail: IkasProductDetail): void;
28
34
  static initAttributePropValue(prop: IkasThemeComponentProp, propValue: IkasAttributePropValueData, pageComponentPropValue: IkasPageComponentPropValue): void;
29
35
  static _initAttributePropValue(propValue: IkasAttributePropValueData): IkasAttributeDetail;
30
- static initAttributeListPropValue(prop: IkasThemeComponentProp, propValue: any, pageComponentPropValue: IkasPageComponentPropValue): void;
31
- static _initAttributeListPropValue(propValue: IkasProductAttributeMap[]): {
32
- attribute: IkasProductAttribute;
33
- values: IkasProductAttributeValue[];
34
- }[];
36
+ static initAttributeListPropValue(prop: IkasThemeComponentProp, propValue: IkasAttributeListPropValueData, pageComponentPropValue: IkasPageComponentPropValue): void;
37
+ static _initAttributeListPropValue(propValue: IkasAttributeListPropValueData): IkasAttributeList;
35
38
  static initLinkPropValue(prop: IkasThemeComponentProp, propValue: any, pageComponentPropValue: IkasPageComponentPropValue): void;
36
39
  static _initLinkPropValue(propValue: any): IkasNavigationLink | IkasNavigationLink[] | undefined;
37
40
  static initImagePropValue(prop: IkasThemeComponentProp, propValue: any, pageComponentPropValue: IkasPageComponentPropValue): void;
@@ -44,12 +47,12 @@ export declare class IkasPageDataInit {
44
47
  static _initComponentPropValue(propValue: IkasPageComponentPropValue[], router: NextRouter, settings: IkasThemeSettings, isBrowser?: boolean): IkasComponentRenderer | undefined;
45
48
  static initComponentListPropValue(prop: IkasThemeComponentProp, propValue: IkasPageComponentPropValue[], pageComponentPropValue: IkasPageComponentPropValue, router: NextRouter, settings: IkasThemeSettings, isBrowser?: boolean): void;
46
49
  static _initComponentListPropValue(propValue: IkasPageComponentPropValue[], router: NextRouter, settings: IkasThemeSettings, isBrowser?: boolean): IkasComponentRenderer[];
47
- static initBlogPropValue(prop: IkasThemeComponentProp, propValue: any, pageComponentPropValue: IkasPageComponentPropValue): void;
48
- static _initBlogPropValue(propValue: IkasBlog): IkasBlog;
50
+ static initBlogPropValue(prop: IkasThemeComponentProp, propValue: IkasBlogPropValueData, pageComponentPropValue: IkasPageComponentPropValue): void;
51
+ static _initBlogPropValue(propValue: IkasBlogPropValueData): any;
49
52
  static initBlogListPropValue(prop: IkasThemeComponentProp, propValue: any, pageComponentPropValue: IkasPageComponentPropValue): void;
50
53
  static _initBlogListPropValue(propValue: IkasBlogListParams): IkasBlogList;
51
- static initBlogCategoryPropValue(prop: IkasThemeComponentProp, propValue: any, pageComponentPropValue: IkasPageComponentPropValue): void;
52
- static _initBlogCategoryPropValue(propValue: IkasBlogCategory): IkasBlogCategory;
54
+ static initBlogCategoryPropValue(prop: IkasThemeComponentProp, propValue: IkasBlogCategoryPropValueData, pageComponentPropValue: IkasPageComponentPropValue): void;
55
+ static _initBlogCategoryPropValue(propValue: IkasBlogCategoryPropValueData): any;
53
56
  static initBlogCategoryListPropValue(prop: IkasThemeComponentProp, propValue: any, pageComponentPropValue: IkasPageComponentPropValue): void;
54
57
  static _initBlogCategoryListPropValue(propValue: IkasBlogCategoryListParams): IkasBlogCategoryList;
55
58
  }
@@ -1,9 +1,12 @@
1
+ import { IkasProductDetail } from "../../models/index";
1
2
  import IkasPropValueProvider from "./index";
2
3
  import { IkasAttributeListPropValue } from "../../models/theme/page/component/prop-value/attribute-list";
3
- import { IkasProductAttributeMap } from "../../models/data/product/attribute-value/index";
4
- export declare class IkasAttributeListPropValueProvider implements IkasPropValueProvider<IkasProductAttributeMap[]> {
4
+ export declare class IkasAttributeListPropValueProvider implements IkasPropValueProvider<IkasAttributeListPropValueData> {
5
5
  private attributeListPropValue;
6
- private pageSpecificData?;
7
- constructor(prop: IkasAttributeListPropValue, pageSpecificData?: any);
8
- getValue(): Promise<IkasProductAttributeMap[]>;
6
+ constructor(prop: IkasAttributeListPropValue);
7
+ getValue(): Promise<IkasAttributeListPropValueData>;
9
8
  }
9
+ export declare type IkasAttributeListPropValueData = {
10
+ productDetail: IkasProductDetail | null;
11
+ attributeListPropValue: IkasAttributeListPropValue;
12
+ };
@@ -1,8 +1,11 @@
1
1
  import { IkasBlogCategory, IkasBlogCategoryPropValue } from "../../models/index";
2
2
  import IkasPropValueProvider from "./index";
3
- export declare class IkasBlogCategoryPropValueProvider implements IkasPropValueProvider<IkasBlogCategory | null> {
3
+ export declare class IkasBlogCategoryPropValueProvider implements IkasPropValueProvider<IkasBlogCategoryPropValueData | null> {
4
4
  private blogCategoryPropValue;
5
- private pageSpecificData?;
6
- constructor(propValue: IkasBlogCategoryPropValue, pageSpecificData?: any);
7
- getValue(): Promise<IkasBlogCategory | null>;
5
+ constructor(propValue: IkasBlogCategoryPropValue);
6
+ getValue(): Promise<IkasBlogCategoryPropValueData | null>;
8
7
  }
8
+ export declare type IkasBlogCategoryPropValueData = {
9
+ blogCategory: IkasBlogCategory | null;
10
+ blogCategoryPropValue: IkasBlogCategoryPropValue;
11
+ };
@@ -1,8 +1,11 @@
1
1
  import { IkasBlog, IkasBlogPropValue } from "../../models/index";
2
2
  import IkasPropValueProvider from "./index";
3
- export declare class IkasBlogPropValueProvider implements IkasPropValueProvider<IkasBlog | null> {
3
+ export declare class IkasBlogPropValueProvider implements IkasPropValueProvider<IkasBlogPropValueData | null> {
4
4
  private blogPropValue;
5
- private pageSpecificData?;
6
- constructor(propValue: IkasBlogPropValue, pageSpecificData?: any);
7
- getValue(): Promise<IkasBlog | null>;
5
+ constructor(propValue: IkasBlogPropValue);
6
+ getValue(): Promise<IkasBlogPropValueData | null>;
8
7
  }
8
+ export declare type IkasBlogPropValueData = {
9
+ blog: IkasBlog | null;
10
+ blogPropValue: IkasBlogPropValue;
11
+ };
@@ -1,8 +1,11 @@
1
1
  import { IkasBrand, IkasBrandPropValue } from "../../models/index";
2
2
  import IkasPropValueProvider from "./index";
3
- export declare class IkasBrandPropValueProvider implements IkasPropValueProvider<IkasBrand> {
3
+ export declare class IkasBrandPropValueProvider implements IkasPropValueProvider<IkasBrandPropValueData | null> {
4
4
  private brandPropValue;
5
- private pageSpecificData?;
6
- constructor(prop: IkasBrandPropValue, pageSpecificData?: any);
7
- getValue(): Promise<IkasBrand>;
5
+ constructor(prop: IkasBrandPropValue);
6
+ getValue(): Promise<IkasBrandPropValueData | null>;
8
7
  }
8
+ export declare type IkasBrandPropValueData = {
9
+ brand: IkasBrand | null;
10
+ brandPropValue: IkasBrandPropValue;
11
+ };
@@ -1,8 +1,11 @@
1
1
  import { IkasCategory, IkasCategoryPropValue } from "../../models/index";
2
2
  import IkasPropValueProvider from "./index";
3
- export declare class IkasCategoryPropValueProvider implements IkasPropValueProvider<IkasCategory | null> {
3
+ export declare class IkasCategoryPropValueProvider implements IkasPropValueProvider<IkasCategoryPropValueData | null> {
4
4
  private categoryPropValue;
5
- private pageSpecificData?;
6
- constructor(prop: IkasCategoryPropValue, pageSpecificData?: any);
7
- getValue(): Promise<IkasCategory | null>;
5
+ constructor(prop: IkasCategoryPropValue);
6
+ getValue(): Promise<IkasCategoryPropValueData | null>;
8
7
  }
8
+ export declare type IkasCategoryPropValueData = {
9
+ category: IkasCategory | null;
10
+ categoryPropValue: IkasCategoryPropValue;
11
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "0.0.168-alpha.8",
3
+ "version": "0.0.168-alpha.9",
4
4
  "main": "./build/index.js",
5
5
  "module": "./build/index.es.js",
6
6
  "author": "Umut Ozan Yıldırım",