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

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