@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.
- package/package.json +13 -13
- package/src/analytics/analytics.ts +1 -2
- package/src/analytics/googleUniversal.ts +2 -12
- package/src/analytics/head/index.tsx +2 -1
- package/src/analytics/ikas.ts +6 -24
- package/src/components/checkout/components/address-form/index.tsx +1 -1
- package/src/components/checkout/components/cart-summary/cart-item/index.tsx +9 -11
- package/src/components/checkout/components/cart-summary/cart-item/style.module.scss +10 -7
- package/src/components/checkout/components/cart-summary/index.tsx +17 -41
- package/src/components/checkout/components/customer-addresses/index.tsx +2 -6
- package/src/components/checkout/components/form-item/index.tsx +11 -9
- package/src/components/checkout/components/master-pass/credit-card-form/index.tsx +0 -2
- package/src/components/checkout/components/offer-product/index.tsx +19 -16
- package/src/components/checkout/components/offer-product/style.module.scss +3 -1
- package/src/components/checkout/components/phone-number-input/get-countries.ts +5 -37
- package/src/components/checkout/components/phone-number-input/index.tsx +10 -15
- package/src/components/checkout/components/phone-number-input/locale/en.ts +257 -0
- package/src/components/checkout/index.tsx +12 -14
- package/src/components/checkout/model.ts +61 -95
- package/src/components/checkout/modelMasterPass.ts +2 -2
- package/src/components/checkout/steps/step-payment/index.tsx +1 -6
- package/src/components/checkout/steps/step-payment/payment-gateways/index.tsx +3 -12
- package/src/components/checkout/steps/step-payment/payment-gateways/installments/index.tsx +3 -5
- package/src/components/checkout/steps/step-payment/style.module.scss +0 -5
- package/src/components/checkout/steps/step-shipping/index.tsx +4 -9
- package/src/components/checkout/steps/step-success/index.tsx +3 -4
- package/src/components/page/head.tsx +0 -12
- package/src/components/page/index.tsx +9 -10
- package/src/components/page-editor/ThemeComponentEditor.tsx +8 -15
- package/src/components/page-editor/model.ts +107 -44
- package/src/models/data/cart/campaign-offer/index.ts +2 -13
- package/src/models/data/cart/index.ts +1 -1
- package/src/models/data/category/path-item/index.ts +0 -4
- package/src/models/data/checkout/index.ts +3 -11
- package/src/models/data/checkout-settings/price/index.ts +0 -2
- package/src/models/data/merchant-settings/index.ts +0 -9
- package/src/models/data/order/index.ts +32 -51
- package/src/models/data/order/line-item/index.ts +13 -34
- package/src/models/data/order/line-item/variant/value/index.ts +1 -1
- package/src/models/data/order/transaction/index.ts +5 -2
- package/src/models/data/product/filter/index.ts +13 -4
- package/src/models/data/product/index.ts +3 -21
- package/src/models/data/product/option-set/index.ts +0 -4
- package/src/models/data/product/option-set/option/index.ts +10 -33
- package/src/models/data/product/variant/index.ts +1 -23
- package/src/models/data/product/variant/price/index.ts +9 -23
- package/src/models/data/product/variant-type/index.ts +0 -2
- package/src/models/data/raffle/index.ts +7 -9
- package/src/models/data/state/index.ts +2 -6
- package/src/models/data/storefront/index.ts +0 -2
- package/src/models/ui/product-list/index.ts +17 -26
- package/src/models/ui/raffle-list/index.ts +1 -1
- package/src/models/ui/validator/form/raffle-form.ts +3 -16
- package/src/models/ui/validator/rules/index.ts +13 -14
- package/src/page-data-init/index.ts +404 -159
- package/src/pages/checkout.tsx +1 -2
- package/src/pages/editor.tsx +2 -5
- package/src/store/cart/index.ts +2 -2
- package/src/store/customer/index.ts +17 -7
- package/src/store/raffle/index.ts +10 -7
- package/src/utils/constants.ts +1 -1
- 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
|
|
116
|
-
|
|
115
|
+
static initPropValues(
|
|
116
|
+
_pageComponentPropValues: IkasPageComponentPropValue[],
|
|
117
117
|
settings: IkasThemeJsonSettings,
|
|
118
118
|
isBrowser?: boolean
|
|
119
119
|
) {
|
|
120
|
-
|
|
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
|
-
|
|
138
|
-
const
|
|
122
|
+
pageComponentPropValues.forEach((pageComponentPropValue) => {
|
|
123
|
+
const props = pageComponentPropValue.component.props;
|
|
139
124
|
|
|
140
|
-
|
|
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
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
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
|
-
|
|
173
|
-
|
|
138
|
+
case IkasThemeJsonComponentPropType.IMAGE_LIST:
|
|
139
|
+
IkasPageDataInit.initImageListPropValue(
|
|
140
|
+
prop,
|
|
141
|
+
propValue,
|
|
142
|
+
pageComponentPropValue
|
|
143
|
+
);
|
|
144
|
+
break;
|
|
174
145
|
|
|
175
|
-
|
|
176
|
-
|
|
146
|
+
case IkasThemeJsonComponentPropType.BRAND:
|
|
147
|
+
IkasPageDataInit.initBrandPropValue(
|
|
148
|
+
prop,
|
|
149
|
+
propValue,
|
|
150
|
+
pageComponentPropValue
|
|
151
|
+
);
|
|
152
|
+
break;
|
|
177
153
|
|
|
178
|
-
|
|
179
|
-
|
|
154
|
+
case IkasThemeJsonComponentPropType.BRAND_LIST:
|
|
155
|
+
IkasPageDataInit.initBrandListPropValue(
|
|
156
|
+
prop,
|
|
157
|
+
propValue,
|
|
158
|
+
pageComponentPropValue
|
|
159
|
+
);
|
|
160
|
+
break;
|
|
180
161
|
|
|
181
|
-
|
|
182
|
-
|
|
162
|
+
case IkasThemeJsonComponentPropType.CATEGORY:
|
|
163
|
+
IkasPageDataInit.initCategoryPropValue(
|
|
164
|
+
prop,
|
|
165
|
+
propValue,
|
|
166
|
+
pageComponentPropValue
|
|
167
|
+
);
|
|
168
|
+
break;
|
|
183
169
|
|
|
184
|
-
|
|
185
|
-
|
|
170
|
+
case IkasThemeJsonComponentPropType.CATEGORY_LIST:
|
|
171
|
+
IkasPageDataInit.initCategoryListPropValue(
|
|
172
|
+
prop,
|
|
173
|
+
propValue,
|
|
174
|
+
pageComponentPropValue
|
|
175
|
+
);
|
|
176
|
+
break;
|
|
186
177
|
|
|
187
|
-
|
|
188
|
-
|
|
178
|
+
case IkasThemeJsonComponentPropType.PRODUCT_LIST:
|
|
179
|
+
IkasPageDataInit.initProductListPropValue(
|
|
180
|
+
prop,
|
|
181
|
+
propValue,
|
|
182
|
+
pageComponentPropValue
|
|
183
|
+
);
|
|
184
|
+
break;
|
|
189
185
|
|
|
190
|
-
|
|
191
|
-
|
|
186
|
+
case IkasThemeJsonComponentPropType.PRODUCT_DETAIL:
|
|
187
|
+
IkasPageDataInit.initProductPropValue(
|
|
188
|
+
prop,
|
|
189
|
+
propValue,
|
|
190
|
+
pageComponentPropValue
|
|
191
|
+
);
|
|
192
|
+
break;
|
|
192
193
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
194
|
+
case IkasThemeJsonComponentPropType.PRODUCT_ATTRIBUTE:
|
|
195
|
+
IkasPageDataInit.initAttributePropValue(
|
|
196
|
+
prop,
|
|
197
|
+
propValue,
|
|
198
|
+
pageComponentPropValue
|
|
199
|
+
);
|
|
200
|
+
break;
|
|
196
201
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
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
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
249
|
+
case IkasThemeJsonComponentPropType.BLOG:
|
|
250
|
+
IkasPageDataInit.initBlogPropValue(
|
|
251
|
+
prop,
|
|
252
|
+
propValue,
|
|
253
|
+
pageComponentPropValue
|
|
254
|
+
);
|
|
255
|
+
break;
|
|
210
256
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
257
|
+
case IkasThemeJsonComponentPropType.BLOG_LIST:
|
|
258
|
+
IkasPageDataInit.initBlogListPropValue(
|
|
259
|
+
prop,
|
|
260
|
+
propValue,
|
|
261
|
+
pageComponentPropValue
|
|
262
|
+
);
|
|
263
|
+
break;
|
|
217
264
|
|
|
218
|
-
|
|
219
|
-
|
|
265
|
+
case IkasThemeJsonComponentPropType.BLOG_CATEGORY:
|
|
266
|
+
IkasPageDataInit.initBlogCategoryPropValue(
|
|
267
|
+
prop,
|
|
268
|
+
propValue,
|
|
269
|
+
pageComponentPropValue
|
|
270
|
+
);
|
|
271
|
+
break;
|
|
220
272
|
|
|
221
|
-
|
|
222
|
-
|
|
273
|
+
case IkasThemeJsonComponentPropType.BLOG_LIST:
|
|
274
|
+
IkasPageDataInit.initBlogCategoryListPropValue(
|
|
275
|
+
prop,
|
|
276
|
+
propValue,
|
|
277
|
+
pageComponentPropValue
|
|
278
|
+
);
|
|
279
|
+
break;
|
|
223
280
|
|
|
224
|
-
|
|
225
|
-
|
|
281
|
+
case IkasThemeJsonComponentPropType.RAFFLE:
|
|
282
|
+
IkasPageDataInit.initRafflePropValue(
|
|
283
|
+
prop,
|
|
284
|
+
propValue,
|
|
285
|
+
pageComponentPropValue
|
|
286
|
+
);
|
|
287
|
+
break;
|
|
226
288
|
|
|
227
|
-
|
|
228
|
-
|
|
289
|
+
case IkasThemeJsonComponentPropType.RAFFLE_LIST:
|
|
290
|
+
IkasPageDataInit.initRaffleListPropValue(
|
|
291
|
+
prop,
|
|
292
|
+
propValue,
|
|
293
|
+
pageComponentPropValue
|
|
294
|
+
);
|
|
295
|
+
break;
|
|
229
296
|
|
|
230
|
-
|
|
231
|
-
|
|
297
|
+
case IkasThemeJsonComponentPropType.SLIDER:
|
|
298
|
+
IkasPageDataInit.initSliderPropValue(
|
|
299
|
+
prop,
|
|
300
|
+
propValue,
|
|
301
|
+
pageComponentPropValue
|
|
302
|
+
);
|
|
303
|
+
break;
|
|
232
304
|
|
|
233
|
-
|
|
234
|
-
|
|
305
|
+
default:
|
|
306
|
+
break;
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
});
|
|
235
310
|
|
|
236
|
-
|
|
237
|
-
|
|
311
|
+
return pageComponentPropValues;
|
|
312
|
+
}
|
|
238
313
|
|
|
239
|
-
|
|
240
|
-
|
|
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
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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
|
-
|
|
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
|
|
541
|
+
propValue.isExternal
|
|
389
542
|
);
|
|
390
543
|
}
|
|
391
544
|
}
|
|
392
545
|
|
|
393
|
-
static initImagePropValue(
|
|
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(
|
|
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
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
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.
|
|
608
|
+
return this._initBrandPropValue(propValue);
|
|
435
609
|
|
|
436
610
|
case IkasThemeJsonComponentPropType.BRAND_LIST:
|
|
437
|
-
return this.
|
|
611
|
+
return this._initBrandListPropValue(propValue);
|
|
438
612
|
|
|
439
613
|
case IkasThemeJsonComponentPropType.CATEGORY_LIST:
|
|
440
|
-
return this.
|
|
614
|
+
return this._initCategoryListPropValue(propValue);
|
|
441
615
|
|
|
442
616
|
case IkasThemeJsonComponentPropType.CATEGORY:
|
|
443
|
-
return this.
|
|
617
|
+
return this._initCategoryPropValue(propValue);
|
|
444
618
|
|
|
445
619
|
case IkasThemeJsonComponentPropType.IMAGE_LIST:
|
|
446
|
-
return this.
|
|
620
|
+
return this._initImageListPropValue(propValue);
|
|
447
621
|
|
|
448
622
|
case IkasThemeJsonComponentPropType.IMAGE:
|
|
449
|
-
return this.
|
|
623
|
+
return this._initImagePropValue(propValue);
|
|
450
624
|
|
|
451
625
|
case IkasThemeJsonComponentPropType.LINK:
|
|
452
|
-
return this.
|
|
626
|
+
return this._initLinkPropValue(propValue);
|
|
453
627
|
|
|
454
628
|
case IkasThemeJsonComponentPropType.PRODUCT_DETAIL:
|
|
455
|
-
return this.
|
|
629
|
+
return this._initProductPropValue(propValue);
|
|
456
630
|
|
|
457
631
|
case IkasThemeJsonComponentPropType.PRODUCT_LIST:
|
|
458
|
-
return this.
|
|
632
|
+
return this._initProductListPropValue(propValue);
|
|
459
633
|
|
|
460
634
|
case IkasThemeJsonComponentPropType.PRODUCT_ATTRIBUTE:
|
|
461
|
-
return this.
|
|
635
|
+
return this._initAttributePropValue(propValue);
|
|
462
636
|
|
|
463
637
|
case IkasThemeJsonComponentPropType.PRODUCT_ATTRIBUTE_LIST:
|
|
464
|
-
return this.
|
|
638
|
+
return this._initAttributeListPropValue(propValue);
|
|
465
639
|
|
|
466
640
|
case IkasThemeJsonComponentPropType.BLOG:
|
|
467
|
-
return this.
|
|
641
|
+
return this._initBlogPropValue(propValue);
|
|
468
642
|
|
|
469
643
|
case IkasThemeJsonComponentPropType.BLOG_LIST:
|
|
470
|
-
return this.
|
|
644
|
+
return this._initBlogListPropValue(propValue);
|
|
471
645
|
|
|
472
646
|
case IkasThemeJsonComponentPropType.BLOG_CATEGORY:
|
|
473
|
-
return this.
|
|
647
|
+
return this._initBlogCategoryPropValue(propValue);
|
|
474
648
|
|
|
475
649
|
case IkasThemeJsonComponentPropType.BLOG_CATEGORY_LIST:
|
|
476
|
-
return this.
|
|
650
|
+
return this._initBlogCategoryListPropValue(propValue);
|
|
477
651
|
|
|
478
652
|
case IkasThemeJsonComponentPropType.RAFFLE:
|
|
479
|
-
return this.
|
|
653
|
+
return this._initRafflePropValue(propValue);
|
|
480
654
|
|
|
481
655
|
case IkasThemeJsonComponentPropType.RAFFLE_LIST:
|
|
482
|
-
return this.
|
|
656
|
+
return this._initRaffleListPropValue(propValue);
|
|
483
657
|
|
|
484
658
|
case IkasThemeJsonComponentPropType.SLIDER:
|
|
485
|
-
return this.
|
|
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.
|
|
711
|
+
return this._initComponentPropValue(propValue, settings, isBrowser);
|
|
538
712
|
|
|
539
713
|
case IkasThemeJsonComponentPropType.COMPONENT_LIST:
|
|
540
|
-
return this.
|
|
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
|
-
|
|
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
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
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
|
-
|
|
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.
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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
|
}
|