@ikas/storefront 4.0.0-alpha.32 → 4.0.0-alpha.34
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 +11 -11
- package/src/components/checkout/model.ts +5 -0
- package/src/components/checkout/steps/step-payment/index.tsx +6 -1
- package/src/components/checkout/steps/step-payment/style.module.scss +5 -0
- package/src/components/page/index.tsx +5 -6
- package/src/components/page-editor/ThemeComponentEditor.tsx +15 -8
- package/src/components/page-editor/model.ts +35 -32
- package/src/models/data/cart/index.ts +1 -1
- package/src/models/data/checkout/index.ts +5 -1
- package/src/models/data/order/index.ts +13 -8
- package/src/models/data/state/index.ts +6 -2
- package/src/models/ui/product-list/index.ts +26 -11
- package/src/page-data-init/index.ts +143 -398
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ikas/storefront",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.34",
|
|
4
4
|
"description": "Storefront functionality for ikas storefront themes.",
|
|
5
5
|
"author": "Umut Ozan Yıldırım",
|
|
6
6
|
"license": "ISC",
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
"libphonenumber-js": "^1.10.6"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@ikas/storefront-api": "^4.0.0-alpha.
|
|
28
|
-
"@ikas/storefront-config": "^4.0.0-alpha.
|
|
29
|
-
"@ikas/storefront-model-functions": "^4.0.0-alpha.
|
|
30
|
-
"@ikas/storefront-models": "^4.0.0-alpha.
|
|
31
|
-
"@ikas/storefront-providers": "^4.0.0-alpha.
|
|
27
|
+
"@ikas/storefront-api": "^4.0.0-alpha.34",
|
|
28
|
+
"@ikas/storefront-config": "^4.0.0-alpha.34",
|
|
29
|
+
"@ikas/storefront-model-functions": "^4.0.0-alpha.34",
|
|
30
|
+
"@ikas/storefront-models": "^4.0.0-alpha.34",
|
|
31
|
+
"@ikas/storefront-providers": "^4.0.0-alpha.34",
|
|
32
32
|
"@rollup/plugin-commonjs": "^22.0.0",
|
|
33
33
|
"@rollup/plugin-json": "^4.1.0",
|
|
34
34
|
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
@@ -52,11 +52,11 @@
|
|
|
52
52
|
"html-react-parser": "^1.4.0"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"@ikas/storefront-api": "^4.0.0-alpha.
|
|
56
|
-
"@ikas/storefront-config": "^4.0.0-alpha.
|
|
57
|
-
"@ikas/storefront-model-functions": "^4.0.0-alpha.
|
|
58
|
-
"@ikas/storefront-models": "^4.0.0-alpha.
|
|
59
|
-
"@ikas/storefront-providers": "^4.0.0-alpha.
|
|
55
|
+
"@ikas/storefront-api": "^4.0.0-alpha.34",
|
|
56
|
+
"@ikas/storefront-config": "^4.0.0-alpha.34",
|
|
57
|
+
"@ikas/storefront-model-functions": "^4.0.0-alpha.34",
|
|
58
|
+
"@ikas/storefront-models": "^4.0.0-alpha.34",
|
|
59
|
+
"@ikas/storefront-providers": "^4.0.0-alpha.34",
|
|
60
60
|
"mobx": "^6.1.3",
|
|
61
61
|
"mobx-react-lite": "^3.1.5",
|
|
62
62
|
"next": "12.2.0",
|
|
@@ -762,6 +762,8 @@ export default class CheckoutViewModel {
|
|
|
762
762
|
const newCart = await this.saveCart();
|
|
763
763
|
|
|
764
764
|
if (newCart) this.checkout = new IkasCheckout(newCart);
|
|
765
|
+
if (this.checkout.shippingAddress)
|
|
766
|
+
this.checkout.shippingAddress.checkoutSettings = this.checkoutSettings;
|
|
765
767
|
this.isChangingShippingMethod = false;
|
|
766
768
|
};
|
|
767
769
|
|
|
@@ -986,6 +988,9 @@ export default class CheckoutViewModel {
|
|
|
986
988
|
customer.addresses.push(newAddress);
|
|
987
989
|
|
|
988
990
|
await this.store.customerStore.saveCustomer(customer);
|
|
991
|
+
this.store.customerStore.customer.addresses?.forEach(
|
|
992
|
+
(address) => (address.checkoutSettings = this.checkoutSettings)
|
|
993
|
+
);
|
|
989
994
|
|
|
990
995
|
if (type === "shipping") {
|
|
991
996
|
this.checkout.shippingAddress!.id = newAddress.id;
|
|
@@ -48,7 +48,12 @@ export const CheckoutStepPayment: React.FC<Props> = observer(({ vm }) => {
|
|
|
48
48
|
const policyLabel = policyInputData.map((p) =>
|
|
49
49
|
p.isVariable ? (
|
|
50
50
|
<span
|
|
51
|
-
className={
|
|
51
|
+
className={[
|
|
52
|
+
styles.TermsLabelSpan,
|
|
53
|
+
vm.isErrorsVisible && !vm.isTermsAndConditionsChecked
|
|
54
|
+
? styles.Error
|
|
55
|
+
: "",
|
|
56
|
+
].join(" ")}
|
|
52
57
|
onClick={
|
|
53
58
|
p.value === "{{ ackPrivacyPolicy }}"
|
|
54
59
|
? onShowPrivacyPolicyClick
|
|
@@ -75,7 +75,11 @@ export const IkasPage: React.FC<IkasPageProps> = observer(
|
|
|
75
75
|
pageType,
|
|
76
76
|
isBrowser
|
|
77
77
|
);
|
|
78
|
-
return IkasPageDataInit.
|
|
78
|
+
return IkasPageDataInit.initPagePropValues(
|
|
79
|
+
propValues,
|
|
80
|
+
settings,
|
|
81
|
+
isBrowser
|
|
82
|
+
);
|
|
79
83
|
}, [isBrowser, propValues, pageType, settings, pageSpecificData]);
|
|
80
84
|
|
|
81
85
|
React.useEffect(() => {
|
|
@@ -183,11 +187,6 @@ async function handleAnalytics(
|
|
|
183
187
|
if (pageType === IkasThemeJsonPageType.PRODUCT) {
|
|
184
188
|
const product = pageSpecificData as IkasProduct;
|
|
185
189
|
|
|
186
|
-
const isBrowser = typeof window !== "undefined";
|
|
187
|
-
// if (isBrowser) {
|
|
188
|
-
// IkasPageDataInit._initProductOnBrowser(product);
|
|
189
|
-
// }
|
|
190
|
-
|
|
191
190
|
Analytics.productView(product);
|
|
192
191
|
|
|
193
192
|
//@ts-ignore
|
|
@@ -15,6 +15,11 @@ import {
|
|
|
15
15
|
import { IkasStorefrontConfig } from "@ikas/storefront-config";
|
|
16
16
|
import { IkasPageDataInit } from "../../page-data-init";
|
|
17
17
|
import { IkasBaseStore } from "../../store";
|
|
18
|
+
import {
|
|
19
|
+
IkasCheckout,
|
|
20
|
+
IkasOrderLineItem,
|
|
21
|
+
IkasCheckoutSettings,
|
|
22
|
+
} from "../../models/data";
|
|
18
23
|
|
|
19
24
|
type Props = {
|
|
20
25
|
vm: IkasPageEditorViewModel;
|
|
@@ -59,7 +64,7 @@ export class ThemeEditorComponent extends React.Component<Props> {
|
|
|
59
64
|
get pageComponentPropValue() {
|
|
60
65
|
const { vm, pageComponent } = this.props;
|
|
61
66
|
|
|
62
|
-
return vm.
|
|
67
|
+
return vm.initializedPropValues.find(
|
|
63
68
|
(pc) => pc.pageComponent.id === pageComponent.id
|
|
64
69
|
);
|
|
65
70
|
}
|
|
@@ -70,13 +75,16 @@ export class ThemeEditorComponent extends React.Component<Props> {
|
|
|
70
75
|
|
|
71
76
|
if (vm.page?.type === IkasThemeJsonPageType.CHECKOUT) {
|
|
72
77
|
const checkoutProps: IkasCheckoutPageProps = {
|
|
73
|
-
checkout: {
|
|
78
|
+
checkout: new IkasCheckout({
|
|
79
|
+
currencyCode: "TRY",
|
|
80
|
+
currencySymbol: "₺",
|
|
74
81
|
orderLineItems: [
|
|
75
|
-
{
|
|
82
|
+
new IkasOrderLineItem({
|
|
76
83
|
id: "",
|
|
77
84
|
createdAt: 0,
|
|
78
85
|
updatedAt: 0,
|
|
79
86
|
currencyCode: "TRY",
|
|
87
|
+
currencySymbol: "₺",
|
|
80
88
|
discount: null,
|
|
81
89
|
discountPrice: null,
|
|
82
90
|
finalPrice: 100,
|
|
@@ -106,11 +114,10 @@ export class ThemeEditorComponent extends React.Component<Props> {
|
|
|
106
114
|
variantValues: [],
|
|
107
115
|
},
|
|
108
116
|
orderedAt: 0,
|
|
109
|
-
|
|
110
|
-
},
|
|
117
|
+
}),
|
|
111
118
|
],
|
|
112
|
-
}
|
|
113
|
-
checkoutSettings: {
|
|
119
|
+
}),
|
|
120
|
+
checkoutSettings: new IkasCheckoutSettings({
|
|
114
121
|
createdAt: 0,
|
|
115
122
|
updatedAt: 0,
|
|
116
123
|
id: "",
|
|
@@ -126,7 +133,7 @@ export class ThemeEditorComponent extends React.Component<Props> {
|
|
|
126
133
|
showCheckoutNote: true,
|
|
127
134
|
showTermsAndConditionsCheckbox: true,
|
|
128
135
|
storefrontId: "",
|
|
129
|
-
},
|
|
136
|
+
}),
|
|
130
137
|
customizationProps: {
|
|
131
138
|
...propValues,
|
|
132
139
|
},
|
|
@@ -14,7 +14,10 @@ import {
|
|
|
14
14
|
IkasThemeJsonSettings,
|
|
15
15
|
IkasVariantValue,
|
|
16
16
|
} from "../../models";
|
|
17
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
IkasPageComponentPropValue,
|
|
19
|
+
IkasPageDataProvider,
|
|
20
|
+
} from "@ikas/storefront-providers";
|
|
18
21
|
import { makeAutoObservable, reaction } from "mobx";
|
|
19
22
|
import { NextRouter } from "next/router.js";
|
|
20
23
|
import { IkasPageDataInit } from "../../page-data-init";
|
|
@@ -24,6 +27,7 @@ import BlogStore from "../../store/blog";
|
|
|
24
27
|
import RaffleStore from "../../store/raffle";
|
|
25
28
|
import ProductStore from "../../store/product";
|
|
26
29
|
import { setAPIClientConfig } from "@ikas/storefront-api";
|
|
30
|
+
import { runInAction } from "mobx";
|
|
27
31
|
|
|
28
32
|
const PACKAGE_VERSION = "2.0.20";
|
|
29
33
|
// import { version as PACKAGE_VERSION } from "../../../package.json";
|
|
@@ -44,6 +48,7 @@ export default class IkasPageEditorViewModel {
|
|
|
44
48
|
pageParams: Record<string, any> = {};
|
|
45
49
|
apiKey?: string | null = null;
|
|
46
50
|
pageDataProvider?: IkasPageDataProvider | null = null;
|
|
51
|
+
initializedPropValues: IkasPageComponentPropValue[] = [];
|
|
47
52
|
|
|
48
53
|
router: NextRouter;
|
|
49
54
|
|
|
@@ -367,18 +372,20 @@ export default class IkasPageEditorViewModel {
|
|
|
367
372
|
this.pageParams
|
|
368
373
|
);
|
|
369
374
|
|
|
370
|
-
|
|
371
|
-
|
|
375
|
+
runInAction(() => {
|
|
376
|
+
IkasBaseStore.getInstance().currentPageType = pageType;
|
|
377
|
+
this.pageDataProvider = pageDataProvider;
|
|
372
378
|
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
379
|
+
if (pageType === IkasThemeJsonPageType.CUSTOM)
|
|
380
|
+
this.page = this.theme?.pages.find(
|
|
381
|
+
(p) => p.type === pageType && p.slug === this.pageParams.slug
|
|
382
|
+
);
|
|
383
|
+
else this.page = this.theme?.pages.find((p) => p.type === pageType);
|
|
378
384
|
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
385
|
+
requestAnimationFrame(() => {
|
|
386
|
+
document.body.scrollTop = 0;
|
|
387
|
+
if (document.scrollingElement) document.scrollingElement.scrollTop = 0;
|
|
388
|
+
});
|
|
382
389
|
});
|
|
383
390
|
|
|
384
391
|
this.sendMessage(BridgeMessageType.EDITOR_PAGE_CHANGE, {
|
|
@@ -505,8 +512,8 @@ export default class IkasPageEditorViewModel {
|
|
|
505
512
|
IkasPageDataInit.pageSpecificData = undefined;
|
|
506
513
|
}
|
|
507
514
|
|
|
508
|
-
|
|
509
|
-
pageDataProvider
|
|
515
|
+
this.initializedPropValues = IkasPageDataInit.initPagePropValues(
|
|
516
|
+
pageDataProvider.$pageComponentPropValues,
|
|
510
517
|
theme!.settings,
|
|
511
518
|
false
|
|
512
519
|
);
|
|
@@ -608,31 +615,28 @@ export default class IkasPageEditorViewModel {
|
|
|
608
615
|
|
|
609
616
|
if (!prop || !this.selectedPageComponent) return;
|
|
610
617
|
|
|
611
|
-
const pageComponentPropValues =
|
|
612
|
-
this.
|
|
613
|
-
|
|
614
|
-
|
|
618
|
+
const pageComponentPropValues = this.initializedPropValues.find(
|
|
619
|
+
(pv) => pv.pageComponent.id === this.selectedPageComponentId
|
|
620
|
+
);
|
|
621
|
+
if (!this.pageDataProvider || !pageComponentPropValues) return;
|
|
615
622
|
|
|
616
623
|
this.selectedPageComponent.propValues[propName] = value;
|
|
617
624
|
|
|
618
|
-
if (!this.pageDataProvider) return;
|
|
619
|
-
|
|
620
625
|
const propValue = await this.pageDataProvider.getPageComponentPropValue(
|
|
621
626
|
this.selectedPageComponent,
|
|
622
627
|
prop
|
|
623
628
|
);
|
|
624
629
|
|
|
625
|
-
if (propValue
|
|
630
|
+
if (propValue && JSON.stringify(propValue).includes("href"))
|
|
626
631
|
await this.pageDataProvider.setLinkSlugs();
|
|
627
632
|
|
|
628
|
-
|
|
629
|
-
pageComponentPropValues.propValues[propName] = propValue;
|
|
633
|
+
pageComponentPropValues.propValues[propName] =
|
|
630
634
|
IkasPageDataInit.initPropValue(
|
|
631
|
-
|
|
635
|
+
prop,
|
|
636
|
+
propValue,
|
|
632
637
|
this.theme!.settings,
|
|
633
638
|
true
|
|
634
639
|
);
|
|
635
|
-
}
|
|
636
640
|
};
|
|
637
641
|
|
|
638
642
|
handleUpdatePageParams = async (data: any) => {
|
|
@@ -700,15 +704,14 @@ export default class IkasPageEditorViewModel {
|
|
|
700
704
|
const pageComponentPropValues =
|
|
701
705
|
await this.pageDataProvider!.getPageComponentPropValues(pageComponent);
|
|
702
706
|
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
707
|
+
const initializedPageComponentPropValues =
|
|
708
|
+
IkasPageDataInit.initPageComponentPropValue(
|
|
709
|
+
pageComponentPropValues,
|
|
710
|
+
this.theme!.settings,
|
|
711
|
+
true
|
|
712
|
+
);
|
|
708
713
|
|
|
709
|
-
this.
|
|
710
|
-
pageComponentPropValues
|
|
711
|
-
);
|
|
714
|
+
this.initializedPropValues.push(initializedPageComponentPropValues);
|
|
712
715
|
this.pageComponents.push(pageComponent);
|
|
713
716
|
};
|
|
714
717
|
|
|
@@ -12,7 +12,7 @@ export class IkasCart extends IkasOrder implements ICart {
|
|
|
12
12
|
shippingZoneRateId: string | null = null;
|
|
13
13
|
stockLocationId: string | null = null;
|
|
14
14
|
|
|
15
|
-
constructor(data: ICart) {
|
|
15
|
+
constructor(data: Partial<ICart>) {
|
|
16
16
|
super(data);
|
|
17
17
|
|
|
18
18
|
this.availableShippingMethods =
|
|
@@ -17,9 +17,13 @@ export class IkasCheckout extends IkasCart implements ICheckout {
|
|
|
17
17
|
selectedPaymentGateway?: IkasPaymentGateway | null = null;
|
|
18
18
|
masterPassPaymentGateway?: IkasPaymentGateway | null = null;
|
|
19
19
|
|
|
20
|
-
constructor(data: IkasCheckoutConstructorData) {
|
|
20
|
+
constructor(data: Partial<IkasCheckoutConstructorData>) {
|
|
21
21
|
super(data);
|
|
22
22
|
|
|
23
|
+
this.appliedCouponCode = data.couponCode;
|
|
24
|
+
this.selectedPaymentGateway = data.selectedPaymentGateway;
|
|
25
|
+
this.masterPassPaymentGateway = data.masterPassPaymentGateway;
|
|
26
|
+
|
|
23
27
|
makeObservable(this, {
|
|
24
28
|
appliedCouponCode: observable,
|
|
25
29
|
selectedPaymentGateway: observable,
|
|
@@ -58,15 +58,15 @@ export class IkasOrder extends IkasBaseModel implements IOrder {
|
|
|
58
58
|
// Extra
|
|
59
59
|
refundSettings?: IkasOrderRefundSettings | null;
|
|
60
60
|
|
|
61
|
-
constructor(data: IOrderConstructorData) {
|
|
62
|
-
super(data);
|
|
61
|
+
constructor(data: Partial<IOrderConstructorData>) {
|
|
62
|
+
super(data as any);
|
|
63
63
|
|
|
64
64
|
this.billingAddress = data.billingAddress
|
|
65
65
|
? new IkasOrderAddress(data.billingAddress)
|
|
66
66
|
: null;
|
|
67
67
|
this.cancelReason = data.cancelReason || null;
|
|
68
68
|
this.cancelledAt = data.cancelledAt || null;
|
|
69
|
-
this.currencyCode = data.currencyCode;
|
|
69
|
+
this.currencyCode = data.currencyCode || "";
|
|
70
70
|
this.currencySymbol = data.currencySymbol || null;
|
|
71
71
|
this.customer = data.customer ? new IkasOrderCustomer(data.customer) : null;
|
|
72
72
|
this.customerId = data.customerId || null;
|
|
@@ -80,7 +80,9 @@ export class IkasOrder extends IkasBaseModel implements IOrder {
|
|
|
80
80
|
this.orderAdjustments =
|
|
81
81
|
data.orderAdjustments?.map((oa) => new IkasOrderAdjustment(oa)) || null;
|
|
82
82
|
this.orderLineItems =
|
|
83
|
-
data.orderLineItems
|
|
83
|
+
data.orderLineItems
|
|
84
|
+
?.map((oli) => new IkasOrderLineItem(oli))
|
|
85
|
+
.filter((i) => !i.deleted) || [];
|
|
84
86
|
this.orderNumber = data.orderNumber || null;
|
|
85
87
|
this.orderPackageStatus = data.orderPackageStatus || null;
|
|
86
88
|
this.orderPackages =
|
|
@@ -92,12 +94,15 @@ export class IkasOrder extends IkasBaseModel implements IOrder {
|
|
|
92
94
|
this.shippingAddress = data.shippingAddress
|
|
93
95
|
? new IkasOrderAddress(data.shippingAddress)
|
|
94
96
|
: null;
|
|
95
|
-
this.
|
|
96
|
-
|
|
97
|
+
this.shippingLines =
|
|
98
|
+
data.shippingLines?.map((sl) => new IkasOrderShippingLine(sl)) || null;
|
|
99
|
+
this.shippingMethod =
|
|
100
|
+
data.shippingMethod || IkasOrderShippingMethod.SHIPMENT;
|
|
101
|
+
this.status = data.status || IkasOrderStatus.CREATED;
|
|
97
102
|
this.taxLines =
|
|
98
103
|
data.taxLines?.map((tl) => new IkasOrderTaxLine(tl)) || null;
|
|
99
|
-
this.totalFinalPrice = data.totalFinalPrice;
|
|
100
|
-
this.totalPrice = data.totalPrice;
|
|
104
|
+
this.totalFinalPrice = data.totalFinalPrice ?? 0;
|
|
105
|
+
this.totalPrice = data.totalPrice ?? 0;
|
|
101
106
|
|
|
102
107
|
this.refundSettings = data.refundSettings;
|
|
103
108
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IkasBaseModel } from "../base";
|
|
2
2
|
import { IkasState as IState } from "@ikas/storefront-models";
|
|
3
|
-
import {
|
|
3
|
+
import { makeObservable, observable } from "mobx";
|
|
4
4
|
|
|
5
5
|
export class IkasState extends IkasBaseModel implements IState {
|
|
6
6
|
countryId: string;
|
|
@@ -13,6 +13,10 @@ export class IkasState extends IkasBaseModel implements IState {
|
|
|
13
13
|
this.name = data.name;
|
|
14
14
|
this.stateCode = data.stateCode;
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
makeObservable(this, {
|
|
17
|
+
countryId: observable,
|
|
18
|
+
name: observable,
|
|
19
|
+
stateCode: observable,
|
|
20
|
+
});
|
|
17
21
|
}
|
|
18
22
|
}
|
|
@@ -56,31 +56,45 @@ export class IkasProductList {
|
|
|
56
56
|
private _fetchRequestTime = 0;
|
|
57
57
|
private router?: NextRouter | null = null;
|
|
58
58
|
|
|
59
|
-
constructor(
|
|
59
|
+
constructor(
|
|
60
|
+
data: IkasProductListParams | IkasProductList,
|
|
61
|
+
router?: NextRouter
|
|
62
|
+
) {
|
|
63
|
+
const _params = data as IkasProductListParams;
|
|
64
|
+
const _list = data as IkasProductList;
|
|
65
|
+
|
|
60
66
|
this.data = data.data ? data.data.map((d) => new IkasProduct(d)) : [];
|
|
61
67
|
this._type =
|
|
62
|
-
|
|
63
|
-
|
|
68
|
+
_params.type ||
|
|
69
|
+
_list._type ||
|
|
70
|
+
_params.productListPropValue.productListType ||
|
|
71
|
+
_list._productListPropValue.productListType ||
|
|
64
72
|
IkasProductListType.ALL;
|
|
65
73
|
this._pageType = data.pageType;
|
|
66
74
|
this._sort =
|
|
67
75
|
data.sort ||
|
|
68
76
|
data.productListPropValue.initialSort ||
|
|
69
77
|
IkasProductListSortType.LAST_ADDED;
|
|
70
|
-
|
|
71
|
-
|
|
78
|
+
this._limit =
|
|
79
|
+
data.limit ||
|
|
80
|
+
_params.productListPropValue.initialLimit ||
|
|
81
|
+
_list._productListPropValue.initialLimit ||
|
|
82
|
+
20;
|
|
72
83
|
this._page = data.page || 1;
|
|
73
84
|
this._minPage = data.minPage || null;
|
|
74
85
|
this._count = data.count || 0;
|
|
75
86
|
this._searchKeyword = data.searchKeyword || "";
|
|
76
|
-
this._productListPropValue =
|
|
87
|
+
this._productListPropValue =
|
|
88
|
+
_params.productListPropValue || _list._productListPropValue;
|
|
77
89
|
|
|
78
|
-
this._filterBrandId =
|
|
79
|
-
this._filterCategoryId =
|
|
90
|
+
this._filterBrandId = _params.filterBrandId || _list._filterBrandId || null;
|
|
91
|
+
this._filterCategoryId =
|
|
92
|
+
_params.filterCategoryId || _list._filterCategoryId || null;
|
|
80
93
|
|
|
81
|
-
this._relatedProductData =
|
|
94
|
+
this._relatedProductData =
|
|
95
|
+
_params.relatedProductData || _list._relatedProductData || null;
|
|
82
96
|
|
|
83
|
-
this._recommendFor =
|
|
97
|
+
this._recommendFor = _params.recommendFor || _list._recommendFor;
|
|
84
98
|
|
|
85
99
|
this.filters = data.filters
|
|
86
100
|
? data.filters.map((f) => new IkasProductFilter(f, this))
|
|
@@ -88,7 +102,8 @@ export class IkasProductList {
|
|
|
88
102
|
this._filterCategories = data.filterCategories
|
|
89
103
|
? data.filterCategories.map((c) => new IkasFilterCategory(c))
|
|
90
104
|
: null;
|
|
91
|
-
this.pageSpecificData =
|
|
105
|
+
this.pageSpecificData =
|
|
106
|
+
_params.pageSpecificData || _list.pageSpecificData || null;
|
|
92
107
|
|
|
93
108
|
this.router = router;
|
|
94
109
|
|
|
@@ -112,225 +112,136 @@ export class IkasPageDataInit {
|
|
|
112
112
|
return typeof window === "undefined";
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
static
|
|
115
|
+
static initPagePropValues(
|
|
116
116
|
pageComponentPropValues: IkasPageComponentPropValue[],
|
|
117
117
|
settings: IkasThemeJsonSettings,
|
|
118
118
|
isBrowser?: boolean
|
|
119
119
|
) {
|
|
120
|
-
pageComponentPropValues.
|
|
121
|
-
IkasPageDataInit.
|
|
120
|
+
return pageComponentPropValues.map((pageComponentPropValue) =>
|
|
121
|
+
IkasPageDataInit.initPageComponentPropValue(
|
|
122
122
|
pageComponentPropValue,
|
|
123
123
|
settings,
|
|
124
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> = {};
|
|
136
|
+
|
|
137
|
+
props.map((prop) => {
|
|
138
|
+
const propValue = pageComponentPropValue.propValues[prop.name];
|
|
139
|
+
|
|
140
|
+
initializedPropValues[prop.name] = IkasPageDataInit.initPropValue(
|
|
141
|
+
prop,
|
|
142
|
+
propValue,
|
|
143
|
+
settings,
|
|
144
|
+
isBrowser
|
|
125
145
|
);
|
|
126
146
|
});
|
|
127
147
|
|
|
128
|
-
return
|
|
148
|
+
return new IkasPageComponentPropValue({
|
|
149
|
+
...pageComponentPropValue,
|
|
150
|
+
propValues: initializedPropValues,
|
|
151
|
+
});
|
|
129
152
|
}
|
|
130
153
|
|
|
131
154
|
static initPropValue(
|
|
132
|
-
|
|
155
|
+
prop: IkasThemeJsonComponentProp,
|
|
156
|
+
propValue: any,
|
|
133
157
|
settings: IkasThemeJsonSettings,
|
|
134
158
|
isBrowser?: boolean
|
|
135
159
|
) {
|
|
136
|
-
|
|
160
|
+
if (propValue === null || propValue === undefined) return null;
|
|
137
161
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
switch (prop.type) {
|
|
143
|
-
case IkasThemeJsonComponentPropType.IMAGE:
|
|
144
|
-
IkasPageDataInit.initImagePropValue(
|
|
145
|
-
prop,
|
|
146
|
-
propValue,
|
|
147
|
-
pageComponentPropValue
|
|
148
|
-
);
|
|
149
|
-
break;
|
|
162
|
+
switch (prop.type) {
|
|
163
|
+
case IkasThemeJsonComponentPropType.IMAGE:
|
|
164
|
+
return IkasPageDataInit.initImagePropValue(propValue);
|
|
150
165
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
prop,
|
|
154
|
-
propValue,
|
|
155
|
-
pageComponentPropValue
|
|
156
|
-
);
|
|
157
|
-
break;
|
|
166
|
+
case IkasThemeJsonComponentPropType.IMAGE_LIST:
|
|
167
|
+
return IkasPageDataInit.initImageListPropValue(propValue);
|
|
158
168
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
prop,
|
|
162
|
-
propValue,
|
|
163
|
-
pageComponentPropValue
|
|
164
|
-
);
|
|
165
|
-
break;
|
|
169
|
+
case IkasThemeJsonComponentPropType.BRAND:
|
|
170
|
+
return IkasPageDataInit.initBrandPropValue(propValue);
|
|
166
171
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
prop,
|
|
170
|
-
propValue,
|
|
171
|
-
pageComponentPropValue
|
|
172
|
-
);
|
|
173
|
-
break;
|
|
172
|
+
case IkasThemeJsonComponentPropType.BRAND_LIST:
|
|
173
|
+
return IkasPageDataInit.initBrandListPropValue(propValue);
|
|
174
174
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
prop,
|
|
178
|
-
propValue,
|
|
179
|
-
pageComponentPropValue
|
|
180
|
-
);
|
|
181
|
-
break;
|
|
175
|
+
case IkasThemeJsonComponentPropType.CATEGORY:
|
|
176
|
+
return IkasPageDataInit.initCategoryPropValue(propValue);
|
|
182
177
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
prop,
|
|
186
|
-
propValue,
|
|
187
|
-
pageComponentPropValue
|
|
188
|
-
);
|
|
189
|
-
break;
|
|
178
|
+
case IkasThemeJsonComponentPropType.CATEGORY_LIST:
|
|
179
|
+
return IkasPageDataInit.initCategoryListPropValue(propValue);
|
|
190
180
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
prop,
|
|
194
|
-
propValue,
|
|
195
|
-
pageComponentPropValue
|
|
196
|
-
);
|
|
197
|
-
break;
|
|
181
|
+
case IkasThemeJsonComponentPropType.PRODUCT_LIST:
|
|
182
|
+
return IkasPageDataInit.initProductListPropValue(propValue);
|
|
198
183
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
prop,
|
|
202
|
-
propValue,
|
|
203
|
-
pageComponentPropValue
|
|
204
|
-
);
|
|
205
|
-
break;
|
|
184
|
+
case IkasThemeJsonComponentPropType.PRODUCT_DETAIL:
|
|
185
|
+
return IkasPageDataInit.initProductPropValue(propValue);
|
|
206
186
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
prop,
|
|
210
|
-
propValue,
|
|
211
|
-
pageComponentPropValue
|
|
212
|
-
);
|
|
213
|
-
break;
|
|
187
|
+
case IkasThemeJsonComponentPropType.PRODUCT_ATTRIBUTE:
|
|
188
|
+
return IkasPageDataInit.initAttributePropValue(propValue);
|
|
214
189
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
prop,
|
|
218
|
-
propValue,
|
|
219
|
-
pageComponentPropValue
|
|
220
|
-
);
|
|
221
|
-
break;
|
|
222
|
-
|
|
223
|
-
case IkasThemeJsonComponentPropType.LINK:
|
|
224
|
-
case IkasThemeJsonComponentPropType.LIST_OF_LINK:
|
|
225
|
-
IkasPageDataInit.initLinkPropValue(
|
|
226
|
-
prop,
|
|
227
|
-
propValue,
|
|
228
|
-
pageComponentPropValue
|
|
229
|
-
);
|
|
230
|
-
break;
|
|
190
|
+
case IkasThemeJsonComponentPropType.PRODUCT_ATTRIBUTE_LIST:
|
|
191
|
+
return IkasPageDataInit.initAttributeListPropValue(propValue);
|
|
231
192
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
propValue,
|
|
236
|
-
pageComponentPropValue,
|
|
237
|
-
settings,
|
|
238
|
-
isBrowser
|
|
239
|
-
);
|
|
240
|
-
break;
|
|
193
|
+
case IkasThemeJsonComponentPropType.LINK:
|
|
194
|
+
case IkasThemeJsonComponentPropType.LIST_OF_LINK:
|
|
195
|
+
return IkasPageDataInit.initLinkPropValue(propValue);
|
|
241
196
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
isBrowser
|
|
249
|
-
);
|
|
250
|
-
break;
|
|
197
|
+
case IkasThemeJsonComponentPropType.COMPONENT:
|
|
198
|
+
return IkasPageDataInit.initComponentPropValue(
|
|
199
|
+
propValue,
|
|
200
|
+
settings,
|
|
201
|
+
isBrowser
|
|
202
|
+
);
|
|
251
203
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
isBrowser
|
|
259
|
-
);
|
|
260
|
-
break;
|
|
204
|
+
case IkasThemeJsonComponentPropType.COMPONENT_LIST:
|
|
205
|
+
return IkasPageDataInit.initComponentListPropValue(
|
|
206
|
+
propValue,
|
|
207
|
+
settings,
|
|
208
|
+
isBrowser
|
|
209
|
+
);
|
|
261
210
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
break;
|
|
211
|
+
case IkasThemeJsonComponentPropType.CUSTOM:
|
|
212
|
+
return IkasPageDataInit.initCustomDataPropValue(
|
|
213
|
+
propValue,
|
|
214
|
+
settings,
|
|
215
|
+
isBrowser
|
|
216
|
+
);
|
|
269
217
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
prop,
|
|
273
|
-
propValue,
|
|
274
|
-
pageComponentPropValue
|
|
275
|
-
);
|
|
276
|
-
break;
|
|
218
|
+
case IkasThemeJsonComponentPropType.BLOG:
|
|
219
|
+
return IkasPageDataInit.initBlogPropValue(propValue);
|
|
277
220
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
prop,
|
|
281
|
-
propValue,
|
|
282
|
-
pageComponentPropValue
|
|
283
|
-
);
|
|
284
|
-
break;
|
|
221
|
+
case IkasThemeJsonComponentPropType.BLOG_LIST:
|
|
222
|
+
return IkasPageDataInit.initBlogListPropValue(propValue);
|
|
285
223
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
prop,
|
|
289
|
-
propValue,
|
|
290
|
-
pageComponentPropValue
|
|
291
|
-
);
|
|
292
|
-
break;
|
|
224
|
+
case IkasThemeJsonComponentPropType.BLOG_CATEGORY:
|
|
225
|
+
return IkasPageDataInit.initBlogCategoryPropValue(propValue);
|
|
293
226
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
prop,
|
|
297
|
-
propValue,
|
|
298
|
-
pageComponentPropValue
|
|
299
|
-
);
|
|
300
|
-
break;
|
|
227
|
+
case IkasThemeJsonComponentPropType.BLOG_LIST:
|
|
228
|
+
return IkasPageDataInit.initBlogCategoryListPropValue(propValue);
|
|
301
229
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
prop,
|
|
305
|
-
propValue,
|
|
306
|
-
pageComponentPropValue
|
|
307
|
-
);
|
|
308
|
-
break;
|
|
230
|
+
case IkasThemeJsonComponentPropType.RAFFLE:
|
|
231
|
+
return IkasPageDataInit.initRafflePropValue(propValue);
|
|
309
232
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
prop,
|
|
313
|
-
propValue,
|
|
314
|
-
pageComponentPropValue
|
|
315
|
-
);
|
|
316
|
-
break;
|
|
233
|
+
case IkasThemeJsonComponentPropType.RAFFLE_LIST:
|
|
234
|
+
return IkasPageDataInit.initRaffleListPropValue(propValue);
|
|
317
235
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
}
|
|
321
|
-
});
|
|
322
|
-
}
|
|
236
|
+
case IkasThemeJsonComponentPropType.SLIDER:
|
|
237
|
+
return IkasPageDataInit.initSliderPropValue(propValue);
|
|
323
238
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
pageComponentPropValue: IkasPageComponentPropValue
|
|
328
|
-
) {
|
|
329
|
-
pageComponentPropValue.propValues[prop.name] =
|
|
330
|
-
IkasPageDataInit._initBrandPropValue(propValue);
|
|
239
|
+
default:
|
|
240
|
+
return propValue;
|
|
241
|
+
}
|
|
331
242
|
}
|
|
332
243
|
|
|
333
|
-
static
|
|
244
|
+
static initBrandPropValue(propValue: IkasBrandPropValueData) {
|
|
334
245
|
if (propValue.brandPropValue.usePageData && this.pageSpecificData) {
|
|
335
246
|
return this.pageSpecificData;
|
|
336
247
|
}
|
|
@@ -342,29 +253,11 @@ export class IkasPageDataInit {
|
|
|
342
253
|
return getPlaceholderBrand();
|
|
343
254
|
}
|
|
344
255
|
|
|
345
|
-
static initBrandListPropValue(
|
|
346
|
-
prop: IkasThemeJsonComponentProp,
|
|
347
|
-
propValue: any,
|
|
348
|
-
pageComponentPropValue: IkasPageComponentPropValue
|
|
349
|
-
) {
|
|
350
|
-
pageComponentPropValue.propValues[prop.name] =
|
|
351
|
-
IkasPageDataInit._initBrandListPropValue(propValue);
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
static _initBrandListPropValue(propValue: IkasBrandListParams) {
|
|
256
|
+
static initBrandListPropValue(propValue: IkasBrandListParams) {
|
|
355
257
|
return new IkasBrandList(propValue);
|
|
356
258
|
}
|
|
357
259
|
|
|
358
|
-
static initCategoryPropValue(
|
|
359
|
-
prop: IkasThemeJsonComponentProp,
|
|
360
|
-
propValue: IkasCategoryPropValueData,
|
|
361
|
-
pageComponentPropValue: IkasPageComponentPropValue
|
|
362
|
-
) {
|
|
363
|
-
pageComponentPropValue.propValues[prop.name] =
|
|
364
|
-
IkasPageDataInit._initCategoryPropValue(propValue);
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
static _initCategoryPropValue(propValue: IkasCategoryPropValueData) {
|
|
260
|
+
static initCategoryPropValue(propValue: IkasCategoryPropValueData) {
|
|
368
261
|
if (propValue.categoryPropValue.usePageData && this.pageSpecificData) {
|
|
369
262
|
return this.pageSpecificData;
|
|
370
263
|
}
|
|
@@ -376,44 +269,15 @@ export class IkasPageDataInit {
|
|
|
376
269
|
return getPlaceholderCategory();
|
|
377
270
|
}
|
|
378
271
|
|
|
379
|
-
static initCategoryListPropValue(
|
|
380
|
-
prop: IkasThemeJsonComponentProp,
|
|
381
|
-
propValue: any,
|
|
382
|
-
pageComponentPropValue: IkasPageComponentPropValue
|
|
383
|
-
) {
|
|
384
|
-
const categoryList = new IkasCategoryList(
|
|
385
|
-
propValue as IkasCategoryListParams
|
|
386
|
-
);
|
|
387
|
-
pageComponentPropValue.propValues[prop.name] = categoryList;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
static _initCategoryListPropValue(propValue: IkasCategoryListParams) {
|
|
272
|
+
static initCategoryListPropValue(propValue: IkasCategoryListParams) {
|
|
391
273
|
return new IkasCategoryList(propValue);
|
|
392
274
|
}
|
|
393
275
|
|
|
394
|
-
static initProductListPropValue(
|
|
395
|
-
prop: IkasThemeJsonComponentProp,
|
|
396
|
-
propValue: any,
|
|
397
|
-
pageComponentPropValue: IkasPageComponentPropValue
|
|
398
|
-
) {
|
|
399
|
-
pageComponentPropValue.propValues[prop.name] =
|
|
400
|
-
this._initProductListPropValue(propValue);
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
static _initProductListPropValue(propValue: IkasProductListParams) {
|
|
276
|
+
static initProductListPropValue(propValue: IkasProductListParams) {
|
|
404
277
|
return new IkasProductList(propValue);
|
|
405
278
|
}
|
|
406
279
|
|
|
407
|
-
static initProductPropValue(
|
|
408
|
-
prop: IkasThemeJsonComponentProp,
|
|
409
|
-
propValue: IkasProductPropValueData,
|
|
410
|
-
pageComponentPropValue: IkasPageComponentPropValue
|
|
411
|
-
) {
|
|
412
|
-
pageComponentPropValue.propValues[prop.name] =
|
|
413
|
-
this._initProductPropValue(propValue);
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
static _initProductPropValue(propValue: IkasProductPropValueData) {
|
|
280
|
+
static initProductPropValue(propValue: IkasProductPropValueData) {
|
|
417
281
|
let product: IkasProduct = new IkasProduct(getPlaceholderProduct() as any);
|
|
418
282
|
|
|
419
283
|
if (propValue.productDetailPropValue.usePageData && this.pageSpecificData) {
|
|
@@ -469,16 +333,7 @@ export class IkasPageDataInit {
|
|
|
469
333
|
}
|
|
470
334
|
}
|
|
471
335
|
|
|
472
|
-
static initAttributePropValue(
|
|
473
|
-
prop: IkasThemeJsonComponentProp,
|
|
474
|
-
propValue: IkasAttributePropValueData,
|
|
475
|
-
pageComponentPropValue: IkasPageComponentPropValue
|
|
476
|
-
) {
|
|
477
|
-
pageComponentPropValue.propValues[prop.name] =
|
|
478
|
-
IkasPageDataInit._initAttributePropValue(propValue);
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
static _initAttributePropValue(propValue: IkasAttributePropValueData) {
|
|
336
|
+
static initAttributePropValue(propValue: IkasAttributePropValueData) {
|
|
482
337
|
let product: IkasProduct | null = null;
|
|
483
338
|
|
|
484
339
|
if (propValue.attributePropValue.usePageData && this.pageSpecificData) {
|
|
@@ -495,18 +350,7 @@ export class IkasPageDataInit {
|
|
|
495
350
|
return new IkasAttributeDetail(product, propValue.attributePropValue);
|
|
496
351
|
}
|
|
497
352
|
|
|
498
|
-
static initAttributeListPropValue(
|
|
499
|
-
prop: IkasThemeJsonComponentProp,
|
|
500
|
-
propValue: IkasAttributeListPropValueData,
|
|
501
|
-
pageComponentPropValue: IkasPageComponentPropValue
|
|
502
|
-
) {
|
|
503
|
-
pageComponentPropValue.propValues[prop.name] =
|
|
504
|
-
IkasPageDataInit._initAttributeListPropValue(propValue);
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
static _initAttributeListPropValue(
|
|
508
|
-
propValue: IkasAttributeListPropValueData
|
|
509
|
-
) {
|
|
353
|
+
static initAttributeListPropValue(propValue: IkasAttributeListPropValueData) {
|
|
510
354
|
let product: IkasProduct | null = null;
|
|
511
355
|
|
|
512
356
|
if (propValue.attributeListPropValue.usePageData && this.pageSpecificData) {
|
|
@@ -524,15 +368,8 @@ export class IkasPageDataInit {
|
|
|
524
368
|
}
|
|
525
369
|
|
|
526
370
|
static initLinkPropValue(
|
|
527
|
-
|
|
528
|
-
propValue: any,
|
|
529
|
-
pageComponentPropValue: IkasPageComponentPropValue
|
|
371
|
+
propValue: IkasNavigationLink | IkasNavigationLink[]
|
|
530
372
|
) {
|
|
531
|
-
pageComponentPropValue.propValues[prop.name] =
|
|
532
|
-
this._initLinkPropValue(propValue);
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
static _initLinkPropValue(propValue: any) {
|
|
536
373
|
if (Array.isArray(propValue)) {
|
|
537
374
|
return (propValue as IkasNavigationLink[]).map(
|
|
538
375
|
(p) =>
|
|
@@ -548,41 +385,21 @@ export class IkasPageDataInit {
|
|
|
548
385
|
propValue.href,
|
|
549
386
|
propValue.label,
|
|
550
387
|
propValue.subLinks,
|
|
551
|
-
propValue.isExternal
|
|
388
|
+
propValue.isExternal || undefined
|
|
552
389
|
);
|
|
553
390
|
}
|
|
554
391
|
}
|
|
555
392
|
|
|
556
|
-
static initImagePropValue(
|
|
557
|
-
prop: IkasThemeJsonComponentProp,
|
|
558
|
-
propValue: any,
|
|
559
|
-
pageComponentPropValue: IkasPageComponentPropValue
|
|
560
|
-
) {
|
|
561
|
-
pageComponentPropValue.propValues[prop.name] =
|
|
562
|
-
this._initImagePropValue(propValue);
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
static _initImagePropValue(propValue: any) {
|
|
393
|
+
static initImagePropValue(propValue: IkasImage) {
|
|
566
394
|
return new IkasImage(propValue);
|
|
567
395
|
}
|
|
568
396
|
|
|
569
|
-
static initImageListPropValue(
|
|
570
|
-
prop: IkasThemeJsonComponentProp,
|
|
571
|
-
propValue: any,
|
|
572
|
-
pageComponentPropValue: IkasPageComponentPropValue
|
|
573
|
-
) {
|
|
574
|
-
pageComponentPropValue.propValues[prop.name] =
|
|
575
|
-
this._initImageListPropValue(propValue);
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
static _initImageListPropValue(propValue: any) {
|
|
397
|
+
static initImageListPropValue(propValue: IkasImage[]) {
|
|
579
398
|
return (propValue as IkasImage[]).map((i) => new IkasImage(i));
|
|
580
399
|
}
|
|
581
400
|
|
|
582
401
|
static initCustomDataPropValue(
|
|
583
|
-
prop: IkasThemeJsonComponentProp,
|
|
584
402
|
customDataValue: IkasCustomDataPropValueData | undefined,
|
|
585
|
-
pageComponentPropValue: IkasPageComponentPropValue,
|
|
586
403
|
settings: IkasThemeJsonSettings,
|
|
587
404
|
isBrowser?: boolean
|
|
588
405
|
) {
|
|
@@ -593,13 +410,12 @@ export class IkasPageDataInit {
|
|
|
593
410
|
)
|
|
594
411
|
return;
|
|
595
412
|
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
);
|
|
413
|
+
return this._initCustomDataPropValue(
|
|
414
|
+
customDataValue,
|
|
415
|
+
new IkasThemeJsonCustomData(customDataValue.customData as any),
|
|
416
|
+
settings,
|
|
417
|
+
isBrowser
|
|
418
|
+
);
|
|
603
419
|
}
|
|
604
420
|
|
|
605
421
|
static _initCustomDataPropValue(
|
|
@@ -615,58 +431,58 @@ export class IkasPageDataInit {
|
|
|
615
431
|
|
|
616
432
|
switch (customData.type) {
|
|
617
433
|
case IkasThemeJsonComponentPropType.BRAND:
|
|
618
|
-
return this.
|
|
434
|
+
return this.initBrandPropValue(propValue);
|
|
619
435
|
|
|
620
436
|
case IkasThemeJsonComponentPropType.BRAND_LIST:
|
|
621
|
-
return this.
|
|
437
|
+
return this.initBrandListPropValue(propValue);
|
|
622
438
|
|
|
623
439
|
case IkasThemeJsonComponentPropType.CATEGORY_LIST:
|
|
624
|
-
return this.
|
|
440
|
+
return this.initCategoryListPropValue(propValue);
|
|
625
441
|
|
|
626
442
|
case IkasThemeJsonComponentPropType.CATEGORY:
|
|
627
|
-
return this.
|
|
443
|
+
return this.initCategoryPropValue(propValue);
|
|
628
444
|
|
|
629
445
|
case IkasThemeJsonComponentPropType.IMAGE_LIST:
|
|
630
|
-
return this.
|
|
446
|
+
return this.initImageListPropValue(propValue);
|
|
631
447
|
|
|
632
448
|
case IkasThemeJsonComponentPropType.IMAGE:
|
|
633
|
-
return this.
|
|
449
|
+
return this.initImagePropValue(propValue);
|
|
634
450
|
|
|
635
451
|
case IkasThemeJsonComponentPropType.LINK:
|
|
636
|
-
return this.
|
|
452
|
+
return this.initLinkPropValue(propValue);
|
|
637
453
|
|
|
638
454
|
case IkasThemeJsonComponentPropType.PRODUCT_DETAIL:
|
|
639
|
-
return this.
|
|
455
|
+
return this.initProductPropValue(propValue);
|
|
640
456
|
|
|
641
457
|
case IkasThemeJsonComponentPropType.PRODUCT_LIST:
|
|
642
|
-
return this.
|
|
458
|
+
return this.initProductListPropValue(propValue);
|
|
643
459
|
|
|
644
460
|
case IkasThemeJsonComponentPropType.PRODUCT_ATTRIBUTE:
|
|
645
|
-
return this.
|
|
461
|
+
return this.initAttributePropValue(propValue);
|
|
646
462
|
|
|
647
463
|
case IkasThemeJsonComponentPropType.PRODUCT_ATTRIBUTE_LIST:
|
|
648
|
-
return this.
|
|
464
|
+
return this.initAttributeListPropValue(propValue);
|
|
649
465
|
|
|
650
466
|
case IkasThemeJsonComponentPropType.BLOG:
|
|
651
|
-
return this.
|
|
467
|
+
return this.initBlogPropValue(propValue);
|
|
652
468
|
|
|
653
469
|
case IkasThemeJsonComponentPropType.BLOG_LIST:
|
|
654
|
-
return this.
|
|
470
|
+
return this.initBlogListPropValue(propValue);
|
|
655
471
|
|
|
656
472
|
case IkasThemeJsonComponentPropType.BLOG_CATEGORY:
|
|
657
|
-
return this.
|
|
473
|
+
return this.initBlogCategoryPropValue(propValue);
|
|
658
474
|
|
|
659
475
|
case IkasThemeJsonComponentPropType.BLOG_CATEGORY_LIST:
|
|
660
|
-
return this.
|
|
476
|
+
return this.initBlogCategoryListPropValue(propValue);
|
|
661
477
|
|
|
662
478
|
case IkasThemeJsonComponentPropType.RAFFLE:
|
|
663
|
-
return this.
|
|
479
|
+
return this.initRafflePropValue(propValue);
|
|
664
480
|
|
|
665
481
|
case IkasThemeJsonComponentPropType.RAFFLE_LIST:
|
|
666
|
-
return this.
|
|
482
|
+
return this.initRaffleListPropValue(propValue);
|
|
667
483
|
|
|
668
484
|
case IkasThemeJsonComponentPropType.SLIDER:
|
|
669
|
-
return this.
|
|
485
|
+
return this.initSliderPropValue(propValue);
|
|
670
486
|
|
|
671
487
|
case IkasThemeJsonComponentPropType.OBJECT:
|
|
672
488
|
const objectValue: Record<string, any> = {};
|
|
@@ -718,10 +534,10 @@ export class IkasPageDataInit {
|
|
|
718
534
|
}
|
|
719
535
|
|
|
720
536
|
case IkasThemeJsonComponentPropType.COMPONENT:
|
|
721
|
-
return this.
|
|
537
|
+
return this.initComponentPropValue(propValue, settings, isBrowser);
|
|
722
538
|
|
|
723
539
|
case IkasThemeJsonComponentPropType.COMPONENT_LIST:
|
|
724
|
-
return this.
|
|
540
|
+
return this.initComponentListPropValue(propValue, settings, isBrowser);
|
|
725
541
|
|
|
726
542
|
default:
|
|
727
543
|
return propValue;
|
|
@@ -729,17 +545,11 @@ export class IkasPageDataInit {
|
|
|
729
545
|
}
|
|
730
546
|
|
|
731
547
|
static initComponentPropValue(
|
|
732
|
-
prop: IkasThemeJsonComponentProp,
|
|
733
548
|
propValue: IkasPageComponentPropValue[],
|
|
734
|
-
pageComponentPropValue: IkasPageComponentPropValue,
|
|
735
549
|
settings: IkasThemeJsonSettings,
|
|
736
550
|
isBrowser?: boolean
|
|
737
551
|
) {
|
|
738
|
-
|
|
739
|
-
propValue,
|
|
740
|
-
settings,
|
|
741
|
-
isBrowser
|
|
742
|
-
);
|
|
552
|
+
return this._initComponentPropValue(propValue, settings, isBrowser);
|
|
743
553
|
}
|
|
744
554
|
|
|
745
555
|
static _initComponentPropValue(
|
|
@@ -751,11 +561,12 @@ export class IkasPageDataInit {
|
|
|
751
561
|
if (!pValue) return;
|
|
752
562
|
|
|
753
563
|
const pageComponentPropValue = new IkasPageComponentPropValue(pValue);
|
|
754
|
-
const initializedPageComponentPropValues =
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
564
|
+
const initializedPageComponentPropValues =
|
|
565
|
+
IkasPageDataInit.initPagePropValues(
|
|
566
|
+
[pageComponentPropValue],
|
|
567
|
+
settings,
|
|
568
|
+
isBrowser
|
|
569
|
+
);
|
|
759
570
|
|
|
760
571
|
if (!initializedPageComponentPropValues.length) return;
|
|
761
572
|
|
|
@@ -765,14 +576,11 @@ export class IkasPageDataInit {
|
|
|
765
576
|
}
|
|
766
577
|
|
|
767
578
|
static initComponentListPropValue(
|
|
768
|
-
prop: IkasThemeJsonComponentProp,
|
|
769
579
|
propValue: IkasPageComponentPropValue[],
|
|
770
|
-
pageComponentPropValue: IkasPageComponentPropValue,
|
|
771
580
|
settings: IkasThemeJsonSettings,
|
|
772
581
|
isBrowser?: boolean
|
|
773
582
|
) {
|
|
774
|
-
|
|
775
|
-
this._initComponentListPropValue(propValue, settings, isBrowser);
|
|
583
|
+
return this._initComponentListPropValue(propValue, settings, isBrowser);
|
|
776
584
|
}
|
|
777
585
|
|
|
778
586
|
static _initComponentListPropValue(
|
|
@@ -784,7 +592,7 @@ export class IkasPageDataInit {
|
|
|
784
592
|
return propValue.map((p: IkasPageComponentPropValue) => {
|
|
785
593
|
const pageComponentPropValue = new IkasPageComponentPropValue(p);
|
|
786
594
|
const initializedPageComponentPropValues =
|
|
787
|
-
IkasPageDataInit.
|
|
595
|
+
IkasPageDataInit.initPagePropValues(
|
|
788
596
|
[pageComponentPropValue],
|
|
789
597
|
settings,
|
|
790
598
|
isBrowser
|
|
@@ -797,16 +605,7 @@ export class IkasPageDataInit {
|
|
|
797
605
|
return [];
|
|
798
606
|
}
|
|
799
607
|
|
|
800
|
-
static initBlogPropValue(
|
|
801
|
-
prop: IkasThemeJsonComponentProp,
|
|
802
|
-
propValue: IkasBlogPropValueData,
|
|
803
|
-
pageComponentPropValue: IkasPageComponentPropValue
|
|
804
|
-
) {
|
|
805
|
-
pageComponentPropValue.propValues[prop.name] =
|
|
806
|
-
IkasPageDataInit._initBlogPropValue(propValue);
|
|
807
|
-
}
|
|
808
|
-
|
|
809
|
-
static _initBlogPropValue(propValue: IkasBlogPropValueData) {
|
|
608
|
+
static initBlogPropValue(propValue: IkasBlogPropValueData) {
|
|
810
609
|
if (propValue.blogPropValue.usePageData && this.pageSpecificData) {
|
|
811
610
|
return this.pageSpecificData;
|
|
812
611
|
}
|
|
@@ -818,29 +617,11 @@ export class IkasPageDataInit {
|
|
|
818
617
|
return getPlaceholderBlog();
|
|
819
618
|
}
|
|
820
619
|
|
|
821
|
-
static initBlogListPropValue(
|
|
822
|
-
prop: IkasThemeJsonComponentProp,
|
|
823
|
-
propValue: any,
|
|
824
|
-
pageComponentPropValue: IkasPageComponentPropValue
|
|
825
|
-
) {
|
|
826
|
-
pageComponentPropValue.propValues[prop.name] =
|
|
827
|
-
this._initBlogListPropValue(propValue);
|
|
828
|
-
}
|
|
829
|
-
|
|
830
|
-
static _initBlogListPropValue(propValue: IkasBlogListParams) {
|
|
620
|
+
static initBlogListPropValue(propValue: IkasBlogListParams) {
|
|
831
621
|
return new IkasBlogList(propValue);
|
|
832
622
|
}
|
|
833
623
|
|
|
834
|
-
static initBlogCategoryPropValue(
|
|
835
|
-
prop: IkasThemeJsonComponentProp,
|
|
836
|
-
propValue: IkasBlogCategoryPropValueData,
|
|
837
|
-
pageComponentPropValue: IkasPageComponentPropValue
|
|
838
|
-
) {
|
|
839
|
-
pageComponentPropValue.propValues[prop.name] =
|
|
840
|
-
IkasPageDataInit._initBlogCategoryPropValue(propValue);
|
|
841
|
-
}
|
|
842
|
-
|
|
843
|
-
static _initBlogCategoryPropValue(propValue: IkasBlogCategoryPropValueData) {
|
|
624
|
+
static initBlogCategoryPropValue(propValue: IkasBlogCategoryPropValueData) {
|
|
844
625
|
if (propValue.blogCategoryPropValue.usePageData && this.pageSpecificData) {
|
|
845
626
|
return this.pageSpecificData;
|
|
846
627
|
}
|
|
@@ -852,29 +633,11 @@ export class IkasPageDataInit {
|
|
|
852
633
|
return getPlaceholderBlogCategory();
|
|
853
634
|
}
|
|
854
635
|
|
|
855
|
-
static initBlogCategoryListPropValue(
|
|
856
|
-
prop: IkasThemeJsonComponentProp,
|
|
857
|
-
propValue: any,
|
|
858
|
-
pageComponentPropValue: IkasPageComponentPropValue
|
|
859
|
-
) {
|
|
860
|
-
pageComponentPropValue.propValues[prop.name] =
|
|
861
|
-
this._initBlogCategoryListPropValue(propValue);
|
|
862
|
-
}
|
|
863
|
-
|
|
864
|
-
static _initBlogCategoryListPropValue(propValue: IkasBlogCategoryListParams) {
|
|
636
|
+
static initBlogCategoryListPropValue(propValue: IkasBlogCategoryListParams) {
|
|
865
637
|
return new IkasBlogCategoryList(propValue);
|
|
866
638
|
}
|
|
867
639
|
|
|
868
|
-
static initRafflePropValue(
|
|
869
|
-
prop: IkasThemeJsonComponentProp,
|
|
870
|
-
propValue: IkasRafflePropValueData,
|
|
871
|
-
pageComponentPropValue: IkasPageComponentPropValue
|
|
872
|
-
) {
|
|
873
|
-
pageComponentPropValue.propValues[prop.name] =
|
|
874
|
-
IkasPageDataInit._initRafflePropValue(propValue);
|
|
875
|
-
}
|
|
876
|
-
|
|
877
|
-
static _initRafflePropValue(propValue: IkasRafflePropValueData) {
|
|
640
|
+
static initRafflePropValue(propValue: IkasRafflePropValueData) {
|
|
878
641
|
if (propValue.rafflePropValue.usePageData && this.pageSpecificData) {
|
|
879
642
|
return this.pageSpecificData;
|
|
880
643
|
}
|
|
@@ -886,29 +649,11 @@ export class IkasPageDataInit {
|
|
|
886
649
|
return new IkasRaffle(getPlaceholderRaffle() as any);
|
|
887
650
|
}
|
|
888
651
|
|
|
889
|
-
static initRaffleListPropValue(
|
|
890
|
-
prop: IkasThemeJsonComponentProp,
|
|
891
|
-
propValue: any,
|
|
892
|
-
pageComponentPropValue: IkasPageComponentPropValue
|
|
893
|
-
) {
|
|
894
|
-
pageComponentPropValue.propValues[prop.name] =
|
|
895
|
-
this._initRaffleListPropValue(propValue);
|
|
896
|
-
}
|
|
897
|
-
|
|
898
|
-
static _initRaffleListPropValue(propValue: IkasRaffleListParams) {
|
|
652
|
+
static initRaffleListPropValue(propValue: IkasRaffleListParams) {
|
|
899
653
|
return new IkasRaffleList(propValue);
|
|
900
654
|
}
|
|
901
655
|
|
|
902
|
-
static initSliderPropValue(
|
|
903
|
-
prop: IkasThemeJsonComponentProp,
|
|
904
|
-
propValue: any,
|
|
905
|
-
pageComponentPropValue: IkasPageComponentPropValue
|
|
906
|
-
) {
|
|
907
|
-
pageComponentPropValue.propValues[prop.name] =
|
|
908
|
-
this._initSliderPropValue(propValue);
|
|
909
|
-
}
|
|
910
|
-
|
|
911
|
-
static _initSliderPropValue(propValue: IkasSliderPropValueData) {
|
|
656
|
+
static initSliderPropValue(propValue: IkasSliderPropValueData) {
|
|
912
657
|
return propValue;
|
|
913
658
|
}
|
|
914
659
|
}
|