@ikas/storefront 4.0.0-alpha.39 → 4.0.0-alpha.4

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.
Files changed (62) hide show
  1. package/package.json +13 -13
  2. package/src/analytics/analytics.ts +1 -2
  3. package/src/analytics/googleUniversal.ts +2 -12
  4. package/src/analytics/head/index.tsx +2 -1
  5. package/src/analytics/ikas.ts +6 -24
  6. package/src/components/checkout/components/address-form/index.tsx +1 -1
  7. package/src/components/checkout/components/cart-summary/cart-item/index.tsx +9 -11
  8. package/src/components/checkout/components/cart-summary/cart-item/style.module.scss +10 -7
  9. package/src/components/checkout/components/cart-summary/index.tsx +17 -41
  10. package/src/components/checkout/components/customer-addresses/index.tsx +2 -6
  11. package/src/components/checkout/components/form-item/index.tsx +11 -9
  12. package/src/components/checkout/components/master-pass/credit-card-form/index.tsx +0 -2
  13. package/src/components/checkout/components/offer-product/index.tsx +19 -16
  14. package/src/components/checkout/components/offer-product/style.module.scss +3 -1
  15. package/src/components/checkout/components/phone-number-input/get-countries.ts +5 -37
  16. package/src/components/checkout/components/phone-number-input/index.tsx +10 -15
  17. package/src/components/checkout/components/phone-number-input/locale/en.ts +257 -0
  18. package/src/components/checkout/index.tsx +12 -14
  19. package/src/components/checkout/model.ts +61 -95
  20. package/src/components/checkout/modelMasterPass.ts +2 -2
  21. package/src/components/checkout/steps/step-payment/index.tsx +1 -6
  22. package/src/components/checkout/steps/step-payment/payment-gateways/index.tsx +3 -12
  23. package/src/components/checkout/steps/step-payment/payment-gateways/installments/index.tsx +3 -5
  24. package/src/components/checkout/steps/step-payment/style.module.scss +0 -5
  25. package/src/components/checkout/steps/step-shipping/index.tsx +4 -9
  26. package/src/components/checkout/steps/step-success/index.tsx +3 -4
  27. package/src/components/page/head.tsx +0 -12
  28. package/src/components/page/index.tsx +9 -10
  29. package/src/components/page-editor/ThemeComponentEditor.tsx +8 -15
  30. package/src/components/page-editor/model.ts +107 -44
  31. package/src/models/data/cart/campaign-offer/index.ts +2 -13
  32. package/src/models/data/cart/index.ts +1 -1
  33. package/src/models/data/category/path-item/index.ts +0 -4
  34. package/src/models/data/checkout/index.ts +3 -11
  35. package/src/models/data/checkout-settings/price/index.ts +0 -2
  36. package/src/models/data/merchant-settings/index.ts +0 -9
  37. package/src/models/data/order/index.ts +32 -51
  38. package/src/models/data/order/line-item/index.ts +13 -34
  39. package/src/models/data/order/line-item/variant/value/index.ts +1 -1
  40. package/src/models/data/order/transaction/index.ts +5 -2
  41. package/src/models/data/product/filter/index.ts +13 -4
  42. package/src/models/data/product/index.ts +3 -21
  43. package/src/models/data/product/option-set/index.ts +0 -4
  44. package/src/models/data/product/option-set/option/index.ts +10 -33
  45. package/src/models/data/product/variant/index.ts +1 -23
  46. package/src/models/data/product/variant/price/index.ts +9 -23
  47. package/src/models/data/product/variant-type/index.ts +0 -2
  48. package/src/models/data/raffle/index.ts +7 -9
  49. package/src/models/data/state/index.ts +2 -6
  50. package/src/models/data/storefront/index.ts +0 -2
  51. package/src/models/ui/product-list/index.ts +17 -26
  52. package/src/models/ui/raffle-list/index.ts +1 -1
  53. package/src/models/ui/validator/form/raffle-form.ts +3 -16
  54. package/src/models/ui/validator/rules/index.ts +13 -14
  55. package/src/page-data-init/index.ts +404 -159
  56. package/src/pages/checkout.tsx +1 -2
  57. package/src/pages/editor.tsx +2 -5
  58. package/src/store/cart/index.ts +2 -2
  59. package/src/store/customer/index.ts +17 -7
  60. package/src/store/raffle/index.ts +10 -7
  61. package/src/utils/constants.ts +1 -1
  62. package/src/utils/currency.ts +183 -9
@@ -3,6 +3,7 @@ import { IkasCategoryListParams } from "../models/ui/category-list";
3
3
  import { IkasAttributeList } from "../models/ui/product-attribute-list";
4
4
  import { IkasProductListParams } from "../models/ui/product-list";
5
5
  import { IkasRaffleListParams } from "../models/ui/raffle-list";
6
+ import { observable } from "mobx";
6
7
 
7
8
  import {
8
9
  IkasThemeJsonSettings,
@@ -53,7 +54,7 @@ import {
53
54
  import _cloneDeep from "lodash/cloneDeep";
54
55
 
55
56
  export class IkasPageDataInit {
56
- static pageSpecificData: any = {};
57
+ static pageSpecificData: any = observable({});
57
58
 
58
59
  static setPageSpecificData(
59
60
  pageSpecificData: any,
@@ -70,8 +71,7 @@ export class IkasPageDataInit {
70
71
  const product = pageSpecificData as IkasProduct;
71
72
  IkasPageDataInit.pageSpecificData = new IkasProduct({
72
73
  ...product,
73
- selectedVariantValues:
74
- product.selectedVariantValues || product.variants[0].variantValues,
74
+ selectedVariantValues: product.selectedVariantValues,
75
75
  });
76
76
  if (isBrowser) {
77
77
  this._initProductOnBrowser(IkasPageDataInit.pageSpecificData);
@@ -112,136 +112,215 @@ export class IkasPageDataInit {
112
112
  return typeof window === "undefined";
113
113
  }
114
114
 
115
- static initPagePropValues(
116
- pageComponentPropValues: IkasPageComponentPropValue[],
115
+ static initPropValues(
116
+ _pageComponentPropValues: IkasPageComponentPropValue[],
117
117
  settings: IkasThemeJsonSettings,
118
118
  isBrowser?: boolean
119
119
  ) {
120
- return pageComponentPropValues.map((pageComponentPropValue) =>
121
- IkasPageDataInit.initPageComponentPropValue(
122
- pageComponentPropValue,
123
- settings,
124
- isBrowser
125
- )
126
- );
127
- }
128
-
129
- static initPageComponentPropValue(
130
- pageComponentPropValue: IkasPageComponentPropValue,
131
- settings: IkasThemeJsonSettings,
132
- isBrowser?: boolean
133
- ) {
134
- const props = pageComponentPropValue.component.props;
135
- const initializedPropValues: Record<string, any> = {};
120
+ const pageComponentPropValues = _cloneDeep(_pageComponentPropValues);
136
121
 
137
- props.map((prop) => {
138
- const propValue = pageComponentPropValue.propValues[prop.name];
122
+ pageComponentPropValues.forEach((pageComponentPropValue) => {
123
+ const props = pageComponentPropValue.component.props;
139
124
 
140
- initializedPropValues[prop.name] = IkasPageDataInit.initPropValue(
141
- prop,
142
- propValue,
143
- settings,
144
- isBrowser
145
- );
146
- });
147
-
148
- return new IkasPageComponentPropValue({
149
- ...pageComponentPropValue,
150
- propValues: initializedPropValues,
151
- });
152
- }
153
-
154
- static initPropValue(
155
- prop: IkasThemeJsonComponentProp,
156
- propValue: any,
157
- settings: IkasThemeJsonSettings,
158
- isBrowser?: boolean
159
- ) {
160
- if (propValue === null || propValue === undefined) return null;
125
+ props.forEach((prop) => {
126
+ const propValue = pageComponentPropValue.propValues[prop.name];
127
+ if (propValue === null || propValue === undefined) return;
161
128
 
162
- switch (prop.type) {
163
- case IkasThemeJsonComponentPropType.IMAGE:
164
- return IkasPageDataInit.initImagePropValue(propValue);
165
-
166
- case IkasThemeJsonComponentPropType.IMAGE_LIST:
167
- return IkasPageDataInit.initImageListPropValue(propValue);
168
-
169
- case IkasThemeJsonComponentPropType.BRAND:
170
- return IkasPageDataInit.initBrandPropValue(propValue);
129
+ switch (prop.type) {
130
+ case IkasThemeJsonComponentPropType.IMAGE:
131
+ IkasPageDataInit.initImagePropValue(
132
+ prop,
133
+ propValue,
134
+ pageComponentPropValue
135
+ );
136
+ break;
171
137
 
172
- case IkasThemeJsonComponentPropType.BRAND_LIST:
173
- return IkasPageDataInit.initBrandListPropValue(propValue);
138
+ case IkasThemeJsonComponentPropType.IMAGE_LIST:
139
+ IkasPageDataInit.initImageListPropValue(
140
+ prop,
141
+ propValue,
142
+ pageComponentPropValue
143
+ );
144
+ break;
174
145
 
175
- case IkasThemeJsonComponentPropType.CATEGORY:
176
- return IkasPageDataInit.initCategoryPropValue(propValue);
146
+ case IkasThemeJsonComponentPropType.BRAND:
147
+ IkasPageDataInit.initBrandPropValue(
148
+ prop,
149
+ propValue,
150
+ pageComponentPropValue
151
+ );
152
+ break;
177
153
 
178
- case IkasThemeJsonComponentPropType.CATEGORY_LIST:
179
- return IkasPageDataInit.initCategoryListPropValue(propValue);
154
+ case IkasThemeJsonComponentPropType.BRAND_LIST:
155
+ IkasPageDataInit.initBrandListPropValue(
156
+ prop,
157
+ propValue,
158
+ pageComponentPropValue
159
+ );
160
+ break;
180
161
 
181
- case IkasThemeJsonComponentPropType.PRODUCT_LIST:
182
- return IkasPageDataInit.initProductListPropValue(propValue);
162
+ case IkasThemeJsonComponentPropType.CATEGORY:
163
+ IkasPageDataInit.initCategoryPropValue(
164
+ prop,
165
+ propValue,
166
+ pageComponentPropValue
167
+ );
168
+ break;
183
169
 
184
- case IkasThemeJsonComponentPropType.PRODUCT_DETAIL:
185
- return IkasPageDataInit.initProductPropValue(propValue);
170
+ case IkasThemeJsonComponentPropType.CATEGORY_LIST:
171
+ IkasPageDataInit.initCategoryListPropValue(
172
+ prop,
173
+ propValue,
174
+ pageComponentPropValue
175
+ );
176
+ break;
186
177
 
187
- case IkasThemeJsonComponentPropType.PRODUCT_ATTRIBUTE:
188
- return IkasPageDataInit.initAttributePropValue(propValue);
178
+ case IkasThemeJsonComponentPropType.PRODUCT_LIST:
179
+ IkasPageDataInit.initProductListPropValue(
180
+ prop,
181
+ propValue,
182
+ pageComponentPropValue
183
+ );
184
+ break;
189
185
 
190
- case IkasThemeJsonComponentPropType.PRODUCT_ATTRIBUTE_LIST:
191
- return IkasPageDataInit.initAttributeListPropValue(propValue);
186
+ case IkasThemeJsonComponentPropType.PRODUCT_DETAIL:
187
+ IkasPageDataInit.initProductPropValue(
188
+ prop,
189
+ propValue,
190
+ pageComponentPropValue
191
+ );
192
+ break;
192
193
 
193
- case IkasThemeJsonComponentPropType.LINK:
194
- case IkasThemeJsonComponentPropType.LIST_OF_LINK:
195
- return IkasPageDataInit.initLinkPropValue(propValue);
194
+ case IkasThemeJsonComponentPropType.PRODUCT_ATTRIBUTE:
195
+ IkasPageDataInit.initAttributePropValue(
196
+ prop,
197
+ propValue,
198
+ pageComponentPropValue
199
+ );
200
+ break;
196
201
 
197
- case IkasThemeJsonComponentPropType.COMPONENT:
198
- return IkasPageDataInit.initComponentPropValue(
199
- propValue,
200
- settings,
201
- isBrowser
202
- );
202
+ case IkasThemeJsonComponentPropType.PRODUCT_ATTRIBUTE_LIST:
203
+ IkasPageDataInit.initAttributeListPropValue(
204
+ prop,
205
+ propValue,
206
+ pageComponentPropValue
207
+ );
208
+ break;
209
+
210
+ case IkasThemeJsonComponentPropType.LINK:
211
+ case IkasThemeJsonComponentPropType.LIST_OF_LINK:
212
+ IkasPageDataInit.initLinkPropValue(
213
+ prop,
214
+ propValue,
215
+ pageComponentPropValue
216
+ );
217
+ break;
218
+
219
+ case IkasThemeJsonComponentPropType.COMPONENT:
220
+ IkasPageDataInit.initComponentPropValue(
221
+ prop,
222
+ propValue,
223
+ pageComponentPropValue,
224
+ settings,
225
+ isBrowser
226
+ );
227
+ break;
228
+
229
+ case IkasThemeJsonComponentPropType.COMPONENT_LIST:
230
+ IkasPageDataInit.initComponentListPropValue(
231
+ prop,
232
+ propValue,
233
+ pageComponentPropValue,
234
+ settings,
235
+ isBrowser
236
+ );
237
+ break;
238
+
239
+ case IkasThemeJsonComponentPropType.CUSTOM:
240
+ IkasPageDataInit.initCustomDataPropValue(
241
+ prop,
242
+ propValue,
243
+ pageComponentPropValue,
244
+ settings,
245
+ isBrowser
246
+ );
247
+ break;
203
248
 
204
- case IkasThemeJsonComponentPropType.COMPONENT_LIST:
205
- return IkasPageDataInit.initComponentListPropValue(
206
- propValue,
207
- settings,
208
- isBrowser
209
- );
249
+ case IkasThemeJsonComponentPropType.BLOG:
250
+ IkasPageDataInit.initBlogPropValue(
251
+ prop,
252
+ propValue,
253
+ pageComponentPropValue
254
+ );
255
+ break;
210
256
 
211
- case IkasThemeJsonComponentPropType.CUSTOM:
212
- return IkasPageDataInit.initCustomDataPropValue(
213
- propValue,
214
- settings,
215
- isBrowser
216
- );
257
+ case IkasThemeJsonComponentPropType.BLOG_LIST:
258
+ IkasPageDataInit.initBlogListPropValue(
259
+ prop,
260
+ propValue,
261
+ pageComponentPropValue
262
+ );
263
+ break;
217
264
 
218
- case IkasThemeJsonComponentPropType.BLOG:
219
- return IkasPageDataInit.initBlogPropValue(propValue);
265
+ case IkasThemeJsonComponentPropType.BLOG_CATEGORY:
266
+ IkasPageDataInit.initBlogCategoryPropValue(
267
+ prop,
268
+ propValue,
269
+ pageComponentPropValue
270
+ );
271
+ break;
220
272
 
221
- case IkasThemeJsonComponentPropType.BLOG_LIST:
222
- return IkasPageDataInit.initBlogListPropValue(propValue);
273
+ case IkasThemeJsonComponentPropType.BLOG_LIST:
274
+ IkasPageDataInit.initBlogCategoryListPropValue(
275
+ prop,
276
+ propValue,
277
+ pageComponentPropValue
278
+ );
279
+ break;
223
280
 
224
- case IkasThemeJsonComponentPropType.BLOG_CATEGORY:
225
- return IkasPageDataInit.initBlogCategoryPropValue(propValue);
281
+ case IkasThemeJsonComponentPropType.RAFFLE:
282
+ IkasPageDataInit.initRafflePropValue(
283
+ prop,
284
+ propValue,
285
+ pageComponentPropValue
286
+ );
287
+ break;
226
288
 
227
- case IkasThemeJsonComponentPropType.BLOG_LIST:
228
- return IkasPageDataInit.initBlogCategoryListPropValue(propValue);
289
+ case IkasThemeJsonComponentPropType.RAFFLE_LIST:
290
+ IkasPageDataInit.initRaffleListPropValue(
291
+ prop,
292
+ propValue,
293
+ pageComponentPropValue
294
+ );
295
+ break;
229
296
 
230
- case IkasThemeJsonComponentPropType.RAFFLE:
231
- return IkasPageDataInit.initRafflePropValue(propValue);
297
+ case IkasThemeJsonComponentPropType.SLIDER:
298
+ IkasPageDataInit.initSliderPropValue(
299
+ prop,
300
+ propValue,
301
+ pageComponentPropValue
302
+ );
303
+ break;
232
304
 
233
- case IkasThemeJsonComponentPropType.RAFFLE_LIST:
234
- return IkasPageDataInit.initRaffleListPropValue(propValue);
305
+ default:
306
+ break;
307
+ }
308
+ });
309
+ });
235
310
 
236
- case IkasThemeJsonComponentPropType.SLIDER:
237
- return IkasPageDataInit.initSliderPropValue(propValue);
311
+ return pageComponentPropValues;
312
+ }
238
313
 
239
- default:
240
- return propValue;
241
- }
314
+ static initBrandPropValue(
315
+ prop: IkasThemeJsonComponentProp,
316
+ propValue: IkasBrandPropValueData,
317
+ pageComponentPropValue: IkasPageComponentPropValue
318
+ ) {
319
+ pageComponentPropValue.propValues[prop.name] =
320
+ IkasPageDataInit._initBrandPropValue(propValue);
242
321
  }
243
322
 
244
- static initBrandPropValue(propValue: IkasBrandPropValueData) {
323
+ static _initBrandPropValue(propValue: IkasBrandPropValueData) {
245
324
  if (propValue.brandPropValue.usePageData && this.pageSpecificData) {
246
325
  return this.pageSpecificData;
247
326
  }
@@ -253,11 +332,29 @@ export class IkasPageDataInit {
253
332
  return getPlaceholderBrand();
254
333
  }
255
334
 
256
- static initBrandListPropValue(propValue: IkasBrandListParams) {
335
+ static initBrandListPropValue(
336
+ prop: IkasThemeJsonComponentProp,
337
+ propValue: any,
338
+ pageComponentPropValue: IkasPageComponentPropValue
339
+ ) {
340
+ pageComponentPropValue.propValues[prop.name] =
341
+ IkasPageDataInit._initBrandListPropValue(propValue);
342
+ }
343
+
344
+ static _initBrandListPropValue(propValue: IkasBrandListParams) {
257
345
  return new IkasBrandList(propValue);
258
346
  }
259
347
 
260
- static initCategoryPropValue(propValue: IkasCategoryPropValueData) {
348
+ static initCategoryPropValue(
349
+ prop: IkasThemeJsonComponentProp,
350
+ propValue: IkasCategoryPropValueData,
351
+ pageComponentPropValue: IkasPageComponentPropValue
352
+ ) {
353
+ pageComponentPropValue.propValues[prop.name] =
354
+ IkasPageDataInit._initCategoryPropValue(propValue);
355
+ }
356
+
357
+ static _initCategoryPropValue(propValue: IkasCategoryPropValueData) {
261
358
  if (propValue.categoryPropValue.usePageData && this.pageSpecificData) {
262
359
  return this.pageSpecificData;
263
360
  }
@@ -269,15 +366,44 @@ export class IkasPageDataInit {
269
366
  return getPlaceholderCategory();
270
367
  }
271
368
 
272
- static initCategoryListPropValue(propValue: IkasCategoryListParams) {
369
+ static initCategoryListPropValue(
370
+ prop: IkasThemeJsonComponentProp,
371
+ propValue: any,
372
+ pageComponentPropValue: IkasPageComponentPropValue
373
+ ) {
374
+ const categoryList = new IkasCategoryList(
375
+ propValue as IkasCategoryListParams
376
+ );
377
+ pageComponentPropValue.propValues[prop.name] = categoryList;
378
+ }
379
+
380
+ static _initCategoryListPropValue(propValue: IkasCategoryListParams) {
273
381
  return new IkasCategoryList(propValue);
274
382
  }
275
383
 
276
- static initProductListPropValue(propValue: IkasProductListParams) {
384
+ static initProductListPropValue(
385
+ prop: IkasThemeJsonComponentProp,
386
+ propValue: any,
387
+ pageComponentPropValue: IkasPageComponentPropValue
388
+ ) {
389
+ pageComponentPropValue.propValues[prop.name] =
390
+ this._initProductListPropValue(propValue);
391
+ }
392
+
393
+ static _initProductListPropValue(propValue: IkasProductListParams) {
277
394
  return new IkasProductList(propValue);
278
395
  }
279
396
 
280
- static initProductPropValue(propValue: IkasProductPropValueData) {
397
+ static initProductPropValue(
398
+ prop: IkasThemeJsonComponentProp,
399
+ propValue: IkasProductPropValueData,
400
+ pageComponentPropValue: IkasPageComponentPropValue
401
+ ) {
402
+ pageComponentPropValue.propValues[prop.name] =
403
+ this._initProductPropValue(propValue);
404
+ }
405
+
406
+ static _initProductPropValue(propValue: IkasProductPropValueData) {
281
407
  let product: IkasProduct = new IkasProduct(getPlaceholderProduct() as any);
282
408
 
283
409
  if (propValue.productDetailPropValue.usePageData && this.pageSpecificData) {
@@ -333,7 +459,16 @@ export class IkasPageDataInit {
333
459
  }
334
460
  }
335
461
 
336
- static initAttributePropValue(propValue: IkasAttributePropValueData) {
462
+ static initAttributePropValue(
463
+ prop: IkasThemeJsonComponentProp,
464
+ propValue: IkasAttributePropValueData,
465
+ pageComponentPropValue: IkasPageComponentPropValue
466
+ ) {
467
+ pageComponentPropValue.propValues[prop.name] =
468
+ IkasPageDataInit._initAttributePropValue(propValue);
469
+ }
470
+
471
+ static _initAttributePropValue(propValue: IkasAttributePropValueData) {
337
472
  let product: IkasProduct | null = null;
338
473
 
339
474
  if (propValue.attributePropValue.usePageData && this.pageSpecificData) {
@@ -350,7 +485,18 @@ export class IkasPageDataInit {
350
485
  return new IkasAttributeDetail(product, propValue.attributePropValue);
351
486
  }
352
487
 
353
- static initAttributeListPropValue(propValue: IkasAttributeListPropValueData) {
488
+ static initAttributeListPropValue(
489
+ prop: IkasThemeJsonComponentProp,
490
+ propValue: IkasAttributeListPropValueData,
491
+ pageComponentPropValue: IkasPageComponentPropValue
492
+ ) {
493
+ pageComponentPropValue.propValues[prop.name] =
494
+ IkasPageDataInit._initAttributeListPropValue(propValue);
495
+ }
496
+
497
+ static _initAttributeListPropValue(
498
+ propValue: IkasAttributeListPropValueData
499
+ ) {
354
500
  let product: IkasProduct | null = null;
355
501
 
356
502
  if (propValue.attributeListPropValue.usePageData && this.pageSpecificData) {
@@ -368,8 +514,15 @@ export class IkasPageDataInit {
368
514
  }
369
515
 
370
516
  static initLinkPropValue(
371
- propValue: IkasNavigationLink | IkasNavigationLink[]
517
+ prop: IkasThemeJsonComponentProp,
518
+ propValue: any,
519
+ pageComponentPropValue: IkasPageComponentPropValue
372
520
  ) {
521
+ pageComponentPropValue.propValues[prop.name] =
522
+ this._initLinkPropValue(propValue);
523
+ }
524
+
525
+ static _initLinkPropValue(propValue: any) {
373
526
  if (Array.isArray(propValue)) {
374
527
  return (propValue as IkasNavigationLink[]).map(
375
528
  (p) =>
@@ -385,21 +538,41 @@ export class IkasPageDataInit {
385
538
  propValue.href,
386
539
  propValue.label,
387
540
  propValue.subLinks,
388
- propValue.isExternal || undefined
541
+ propValue.isExternal
389
542
  );
390
543
  }
391
544
  }
392
545
 
393
- static initImagePropValue(propValue: IkasImage) {
546
+ static initImagePropValue(
547
+ prop: IkasThemeJsonComponentProp,
548
+ propValue: any,
549
+ pageComponentPropValue: IkasPageComponentPropValue
550
+ ) {
551
+ pageComponentPropValue.propValues[prop.name] =
552
+ this._initImagePropValue(propValue);
553
+ }
554
+
555
+ static _initImagePropValue(propValue: any) {
394
556
  return new IkasImage(propValue);
395
557
  }
396
558
 
397
- static initImageListPropValue(propValue: IkasImage[]) {
559
+ static initImageListPropValue(
560
+ prop: IkasThemeJsonComponentProp,
561
+ propValue: any,
562
+ pageComponentPropValue: IkasPageComponentPropValue
563
+ ) {
564
+ pageComponentPropValue.propValues[prop.name] =
565
+ this._initImageListPropValue(propValue);
566
+ }
567
+
568
+ static _initImageListPropValue(propValue: any) {
398
569
  return (propValue as IkasImage[]).map((i) => new IkasImage(i));
399
570
  }
400
571
 
401
572
  static initCustomDataPropValue(
573
+ prop: IkasThemeJsonComponentProp,
402
574
  customDataValue: IkasCustomDataPropValueData | undefined,
575
+ pageComponentPropValue: IkasPageComponentPropValue,
403
576
  settings: IkasThemeJsonSettings,
404
577
  isBrowser?: boolean
405
578
  ) {
@@ -410,12 +583,13 @@ export class IkasPageDataInit {
410
583
  )
411
584
  return;
412
585
 
413
- return this._initCustomDataPropValue(
414
- customDataValue,
415
- new IkasThemeJsonCustomData(customDataValue.customData as any),
416
- settings,
417
- isBrowser
418
- );
586
+ pageComponentPropValue.propValues[prop.name] =
587
+ this._initCustomDataPropValue(
588
+ customDataValue,
589
+ new IkasThemeJsonCustomData(customDataValue.customData as any),
590
+ settings,
591
+ isBrowser
592
+ );
419
593
  }
420
594
 
421
595
  static _initCustomDataPropValue(
@@ -431,58 +605,58 @@ export class IkasPageDataInit {
431
605
 
432
606
  switch (customData.type) {
433
607
  case IkasThemeJsonComponentPropType.BRAND:
434
- return this.initBrandPropValue(propValue);
608
+ return this._initBrandPropValue(propValue);
435
609
 
436
610
  case IkasThemeJsonComponentPropType.BRAND_LIST:
437
- return this.initBrandListPropValue(propValue);
611
+ return this._initBrandListPropValue(propValue);
438
612
 
439
613
  case IkasThemeJsonComponentPropType.CATEGORY_LIST:
440
- return this.initCategoryListPropValue(propValue);
614
+ return this._initCategoryListPropValue(propValue);
441
615
 
442
616
  case IkasThemeJsonComponentPropType.CATEGORY:
443
- return this.initCategoryPropValue(propValue);
617
+ return this._initCategoryPropValue(propValue);
444
618
 
445
619
  case IkasThemeJsonComponentPropType.IMAGE_LIST:
446
- return this.initImageListPropValue(propValue);
620
+ return this._initImageListPropValue(propValue);
447
621
 
448
622
  case IkasThemeJsonComponentPropType.IMAGE:
449
- return this.initImagePropValue(propValue);
623
+ return this._initImagePropValue(propValue);
450
624
 
451
625
  case IkasThemeJsonComponentPropType.LINK:
452
- return this.initLinkPropValue(propValue);
626
+ return this._initLinkPropValue(propValue);
453
627
 
454
628
  case IkasThemeJsonComponentPropType.PRODUCT_DETAIL:
455
- return this.initProductPropValue(propValue);
629
+ return this._initProductPropValue(propValue);
456
630
 
457
631
  case IkasThemeJsonComponentPropType.PRODUCT_LIST:
458
- return this.initProductListPropValue(propValue);
632
+ return this._initProductListPropValue(propValue);
459
633
 
460
634
  case IkasThemeJsonComponentPropType.PRODUCT_ATTRIBUTE:
461
- return this.initAttributePropValue(propValue);
635
+ return this._initAttributePropValue(propValue);
462
636
 
463
637
  case IkasThemeJsonComponentPropType.PRODUCT_ATTRIBUTE_LIST:
464
- return this.initAttributeListPropValue(propValue);
638
+ return this._initAttributeListPropValue(propValue);
465
639
 
466
640
  case IkasThemeJsonComponentPropType.BLOG:
467
- return this.initBlogPropValue(propValue);
641
+ return this._initBlogPropValue(propValue);
468
642
 
469
643
  case IkasThemeJsonComponentPropType.BLOG_LIST:
470
- return this.initBlogListPropValue(propValue);
644
+ return this._initBlogListPropValue(propValue);
471
645
 
472
646
  case IkasThemeJsonComponentPropType.BLOG_CATEGORY:
473
- return this.initBlogCategoryPropValue(propValue);
647
+ return this._initBlogCategoryPropValue(propValue);
474
648
 
475
649
  case IkasThemeJsonComponentPropType.BLOG_CATEGORY_LIST:
476
- return this.initBlogCategoryListPropValue(propValue);
650
+ return this._initBlogCategoryListPropValue(propValue);
477
651
 
478
652
  case IkasThemeJsonComponentPropType.RAFFLE:
479
- return this.initRafflePropValue(propValue);
653
+ return this._initRafflePropValue(propValue);
480
654
 
481
655
  case IkasThemeJsonComponentPropType.RAFFLE_LIST:
482
- return this.initRaffleListPropValue(propValue);
656
+ return this._initRaffleListPropValue(propValue);
483
657
 
484
658
  case IkasThemeJsonComponentPropType.SLIDER:
485
- return this.initSliderPropValue(propValue);
659
+ return this._initSliderPropValue(propValue);
486
660
 
487
661
  case IkasThemeJsonComponentPropType.OBJECT:
488
662
  const objectValue: Record<string, any> = {};
@@ -534,10 +708,10 @@ export class IkasPageDataInit {
534
708
  }
535
709
 
536
710
  case IkasThemeJsonComponentPropType.COMPONENT:
537
- return this.initComponentPropValue(propValue, settings, isBrowser);
711
+ return this._initComponentPropValue(propValue, settings, isBrowser);
538
712
 
539
713
  case IkasThemeJsonComponentPropType.COMPONENT_LIST:
540
- return this.initComponentListPropValue(propValue, settings, isBrowser);
714
+ return this._initComponentListPropValue(propValue, settings, isBrowser);
541
715
 
542
716
  default:
543
717
  return propValue;
@@ -545,11 +719,17 @@ export class IkasPageDataInit {
545
719
  }
546
720
 
547
721
  static initComponentPropValue(
722
+ prop: IkasThemeJsonComponentProp,
548
723
  propValue: IkasPageComponentPropValue[],
724
+ pageComponentPropValue: IkasPageComponentPropValue,
549
725
  settings: IkasThemeJsonSettings,
550
726
  isBrowser?: boolean
551
727
  ) {
552
- return this._initComponentPropValue(propValue, settings, isBrowser);
728
+ pageComponentPropValue.propValues[prop.name] = this._initComponentPropValue(
729
+ propValue,
730
+ settings,
731
+ isBrowser
732
+ );
553
733
  }
554
734
 
555
735
  static _initComponentPropValue(
@@ -561,12 +741,11 @@ export class IkasPageDataInit {
561
741
  if (!pValue) return;
562
742
 
563
743
  const pageComponentPropValue = new IkasPageComponentPropValue(pValue);
564
- const initializedPageComponentPropValues =
565
- IkasPageDataInit.initPagePropValues(
566
- [pageComponentPropValue],
567
- settings,
568
- isBrowser
569
- );
744
+ const initializedPageComponentPropValues = IkasPageDataInit.initPropValues(
745
+ [pageComponentPropValue],
746
+ settings,
747
+ isBrowser
748
+ );
570
749
 
571
750
  if (!initializedPageComponentPropValues.length) return;
572
751
 
@@ -576,11 +755,14 @@ export class IkasPageDataInit {
576
755
  }
577
756
 
578
757
  static initComponentListPropValue(
758
+ prop: IkasThemeJsonComponentProp,
579
759
  propValue: IkasPageComponentPropValue[],
760
+ pageComponentPropValue: IkasPageComponentPropValue,
580
761
  settings: IkasThemeJsonSettings,
581
762
  isBrowser?: boolean
582
763
  ) {
583
- return this._initComponentListPropValue(propValue, settings, isBrowser);
764
+ pageComponentPropValue.propValues[prop.name] =
765
+ this._initComponentListPropValue(propValue, settings, isBrowser);
584
766
  }
585
767
 
586
768
  static _initComponentListPropValue(
@@ -592,7 +774,7 @@ export class IkasPageDataInit {
592
774
  return propValue.map((p: IkasPageComponentPropValue) => {
593
775
  const pageComponentPropValue = new IkasPageComponentPropValue(p);
594
776
  const initializedPageComponentPropValues =
595
- IkasPageDataInit.initPagePropValues(
777
+ IkasPageDataInit.initPropValues(
596
778
  [pageComponentPropValue],
597
779
  settings,
598
780
  isBrowser
@@ -605,7 +787,16 @@ export class IkasPageDataInit {
605
787
  return [];
606
788
  }
607
789
 
608
- static initBlogPropValue(propValue: IkasBlogPropValueData) {
790
+ static initBlogPropValue(
791
+ prop: IkasThemeJsonComponentProp,
792
+ propValue: IkasBlogPropValueData,
793
+ pageComponentPropValue: IkasPageComponentPropValue
794
+ ) {
795
+ pageComponentPropValue.propValues[prop.name] =
796
+ IkasPageDataInit._initBlogPropValue(propValue);
797
+ }
798
+
799
+ static _initBlogPropValue(propValue: IkasBlogPropValueData) {
609
800
  if (propValue.blogPropValue.usePageData && this.pageSpecificData) {
610
801
  return this.pageSpecificData;
611
802
  }
@@ -617,11 +808,29 @@ export class IkasPageDataInit {
617
808
  return getPlaceholderBlog();
618
809
  }
619
810
 
620
- static initBlogListPropValue(propValue: IkasBlogListParams) {
811
+ static initBlogListPropValue(
812
+ prop: IkasThemeJsonComponentProp,
813
+ propValue: any,
814
+ pageComponentPropValue: IkasPageComponentPropValue
815
+ ) {
816
+ pageComponentPropValue.propValues[prop.name] =
817
+ this._initBlogListPropValue(propValue);
818
+ }
819
+
820
+ static _initBlogListPropValue(propValue: IkasBlogListParams) {
621
821
  return new IkasBlogList(propValue);
622
822
  }
623
823
 
624
- static initBlogCategoryPropValue(propValue: IkasBlogCategoryPropValueData) {
824
+ static initBlogCategoryPropValue(
825
+ prop: IkasThemeJsonComponentProp,
826
+ propValue: IkasBlogCategoryPropValueData,
827
+ pageComponentPropValue: IkasPageComponentPropValue
828
+ ) {
829
+ pageComponentPropValue.propValues[prop.name] =
830
+ IkasPageDataInit._initBlogCategoryPropValue(propValue);
831
+ }
832
+
833
+ static _initBlogCategoryPropValue(propValue: IkasBlogCategoryPropValueData) {
625
834
  if (propValue.blogCategoryPropValue.usePageData && this.pageSpecificData) {
626
835
  return this.pageSpecificData;
627
836
  }
@@ -633,11 +842,29 @@ export class IkasPageDataInit {
633
842
  return getPlaceholderBlogCategory();
634
843
  }
635
844
 
636
- static initBlogCategoryListPropValue(propValue: IkasBlogCategoryListParams) {
845
+ static initBlogCategoryListPropValue(
846
+ prop: IkasThemeJsonComponentProp,
847
+ propValue: any,
848
+ pageComponentPropValue: IkasPageComponentPropValue
849
+ ) {
850
+ pageComponentPropValue.propValues[prop.name] =
851
+ this._initBlogCategoryListPropValue(propValue);
852
+ }
853
+
854
+ static _initBlogCategoryListPropValue(propValue: IkasBlogCategoryListParams) {
637
855
  return new IkasBlogCategoryList(propValue);
638
856
  }
639
857
 
640
- static initRafflePropValue(propValue: IkasRafflePropValueData) {
858
+ static initRafflePropValue(
859
+ prop: IkasThemeJsonComponentProp,
860
+ propValue: IkasRafflePropValueData,
861
+ pageComponentPropValue: IkasPageComponentPropValue
862
+ ) {
863
+ pageComponentPropValue.propValues[prop.name] =
864
+ IkasPageDataInit._initRafflePropValue(propValue);
865
+ }
866
+
867
+ static _initRafflePropValue(propValue: IkasRafflePropValueData) {
641
868
  if (propValue.rafflePropValue.usePageData && this.pageSpecificData) {
642
869
  return this.pageSpecificData;
643
870
  }
@@ -649,11 +876,29 @@ export class IkasPageDataInit {
649
876
  return new IkasRaffle(getPlaceholderRaffle() as any);
650
877
  }
651
878
 
652
- static initRaffleListPropValue(propValue: IkasRaffleListParams) {
879
+ static initRaffleListPropValue(
880
+ prop: IkasThemeJsonComponentProp,
881
+ propValue: any,
882
+ pageComponentPropValue: IkasPageComponentPropValue
883
+ ) {
884
+ pageComponentPropValue.propValues[prop.name] =
885
+ this._initRaffleListPropValue(propValue);
886
+ }
887
+
888
+ static _initRaffleListPropValue(propValue: IkasRaffleListParams) {
653
889
  return new IkasRaffleList(propValue);
654
890
  }
655
891
 
656
- static initSliderPropValue(propValue: IkasSliderPropValueData) {
892
+ static initSliderPropValue(
893
+ prop: IkasThemeJsonComponentProp,
894
+ propValue: any,
895
+ pageComponentPropValue: IkasPageComponentPropValue
896
+ ) {
897
+ pageComponentPropValue.propValues[prop.name] =
898
+ this._initSliderPropValue(propValue);
899
+ }
900
+
901
+ static _initSliderPropValue(propValue: IkasSliderPropValueData) {
657
902
  return propValue;
658
903
  }
659
904
  }