@ikas/storefront-providers 4.0.0-alpha.28 → 4.0.0-alpha.3
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ikas/storefront-providers",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.3",
|
|
4
4
|
"description": "Data providers for ikas storefront theme components.",
|
|
5
5
|
"author": "Umut Ozan Yıldırım",
|
|
6
6
|
"license": "ISC",
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@rollup/plugin-commonjs": "^22.0.0",
|
|
20
|
-
"@ikas/storefront-api": "^4.0.0-alpha.
|
|
21
|
-
"@ikas/storefront-config": "^4.0.0-alpha.
|
|
22
|
-
"@ikas/storefront-model-functions": "^4.0.0-alpha.
|
|
23
|
-
"@ikas/storefront-models": "^4.0.0-alpha.
|
|
20
|
+
"@ikas/storefront-api": "^4.0.0-alpha.3",
|
|
21
|
+
"@ikas/storefront-config": "^4.0.0-alpha.3",
|
|
22
|
+
"@ikas/storefront-model-functions": "^4.0.0-alpha.3",
|
|
23
|
+
"@ikas/storefront-models": "^4.0.0-alpha.3",
|
|
24
24
|
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
25
25
|
"@types/lodash": "^4.14.168",
|
|
26
26
|
"@types/react": "^16.9.55",
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"mobx": "^6.1.3",
|
|
40
|
-
"@ikas/storefront-api": "^4.0.0-alpha.
|
|
41
|
-
"@ikas/storefront-config": "^4.0.0-alpha.
|
|
42
|
-
"@ikas/storefront-model-functions": "^4.0.0-alpha.
|
|
43
|
-
"@ikas/storefront-models": "^4.0.0-alpha.
|
|
40
|
+
"@ikas/storefront-api": "^4.0.0-alpha.3",
|
|
41
|
+
"@ikas/storefront-config": "^4.0.0-alpha.3",
|
|
42
|
+
"@ikas/storefront-model-functions": "^4.0.0-alpha.3",
|
|
43
|
+
"@ikas/storefront-models": "^4.0.0-alpha.3",
|
|
44
44
|
"lodash": "^4.17.20"
|
|
45
45
|
}
|
|
46
46
|
}
|
|
@@ -670,21 +670,21 @@ export class IkasPageDataProvider {
|
|
|
670
670
|
switch (type) {
|
|
671
671
|
case "DEFAULT":
|
|
672
672
|
const htmlMetaDataResponse = await listHTMLMetaData({
|
|
673
|
-
|
|
673
|
+
id: { in: idList },
|
|
674
674
|
});
|
|
675
675
|
results = htmlMetaDataResponse.data || [];
|
|
676
676
|
break;
|
|
677
677
|
|
|
678
678
|
case "BLOG":
|
|
679
679
|
const blogMetaDataResponse = await listBlogMetaData({
|
|
680
|
-
|
|
680
|
+
id: { in: idList },
|
|
681
681
|
});
|
|
682
682
|
results = blogMetaDataResponse.data?.data || [];
|
|
683
683
|
break;
|
|
684
684
|
|
|
685
685
|
case "RAFFLE":
|
|
686
686
|
const raffleMetaDataResponse = await listRaffleMetaData({
|
|
687
|
-
|
|
687
|
+
id: { in: idList },
|
|
688
688
|
});
|
|
689
689
|
results = raffleMetaDataResponse.data || [];
|
|
690
690
|
break;
|
|
@@ -7,11 +7,11 @@ export type IkasLinkMetaDataType = "DEFAULT" | "BLOG" | "RAFFLE";
|
|
|
7
7
|
export type IkasLinkMetaDataTargetId = {
|
|
8
8
|
type: IkasLinkMetaDataType;
|
|
9
9
|
id: string;
|
|
10
|
-
navigationLink:
|
|
10
|
+
navigationLink: IkasNavigationLink;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
export class IkasLinkPropValueProvider
|
|
14
|
-
implements IkasPropValueProvider<
|
|
14
|
+
implements IkasPropValueProvider<IkasNavigationLink | IkasNavigationLink[]>
|
|
15
15
|
{
|
|
16
16
|
private linkPropValue: IkasLinkPropValue | IkasLinkPropValue[];
|
|
17
17
|
private theme: IkasThemeJson;
|
|
@@ -29,89 +29,89 @@ export class IkasLinkPropValueProvider
|
|
|
29
29
|
|
|
30
30
|
private async getNavigationLink(
|
|
31
31
|
linkPropValue: IkasLinkPropValue
|
|
32
|
-
): Promise<
|
|
33
|
-
let navigationLink:
|
|
32
|
+
): Promise<IkasNavigationLink> {
|
|
33
|
+
let navigationLink: IkasNavigationLink | undefined;
|
|
34
34
|
|
|
35
35
|
if (linkPropValue.linkType === IkasLinkType.PAGE) {
|
|
36
36
|
// INDEX PAGE
|
|
37
37
|
if (linkPropValue.pageType === IkasThemeJsonPageType.INDEX) {
|
|
38
|
-
navigationLink =
|
|
38
|
+
navigationLink = {
|
|
39
39
|
href: "/",
|
|
40
40
|
label: linkPropValue.label || "",
|
|
41
41
|
subLinks: [],
|
|
42
|
-
}
|
|
42
|
+
};
|
|
43
43
|
} else if (linkPropValue.pageType === IkasThemeJsonPageType.ACCOUNT) {
|
|
44
|
-
navigationLink =
|
|
44
|
+
navigationLink = {
|
|
45
45
|
href: "/account",
|
|
46
46
|
label: linkPropValue.label || "",
|
|
47
47
|
subLinks: [],
|
|
48
|
-
}
|
|
48
|
+
};
|
|
49
49
|
} else if (linkPropValue.pageType === IkasThemeJsonPageType.ADDRESSES) {
|
|
50
|
-
navigationLink =
|
|
50
|
+
navigationLink = {
|
|
51
51
|
href: "/account/addresses",
|
|
52
52
|
label: linkPropValue.label || "",
|
|
53
53
|
subLinks: [],
|
|
54
|
-
}
|
|
54
|
+
};
|
|
55
55
|
} else if (linkPropValue.pageType === IkasThemeJsonPageType.ORDERS) {
|
|
56
|
-
navigationLink =
|
|
56
|
+
navigationLink = {
|
|
57
57
|
href: "/account/orders",
|
|
58
58
|
label: linkPropValue.label || "",
|
|
59
59
|
subLinks: [],
|
|
60
|
-
}
|
|
60
|
+
};
|
|
61
61
|
} else if (
|
|
62
62
|
linkPropValue.pageType === IkasThemeJsonPageType.FAVORITE_PRODUCTS
|
|
63
63
|
) {
|
|
64
|
-
navigationLink =
|
|
64
|
+
navigationLink = {
|
|
65
65
|
href: "/account/favorite-products",
|
|
66
66
|
label: linkPropValue.label || "",
|
|
67
67
|
subLinks: [],
|
|
68
|
-
}
|
|
68
|
+
};
|
|
69
69
|
} else if (linkPropValue.pageType === IkasThemeJsonPageType.LOGIN) {
|
|
70
|
-
navigationLink =
|
|
70
|
+
navigationLink = {
|
|
71
71
|
href: "/account/login",
|
|
72
72
|
label: linkPropValue.label || "",
|
|
73
73
|
subLinks: [],
|
|
74
|
-
}
|
|
74
|
+
};
|
|
75
75
|
} else if (linkPropValue.pageType === IkasThemeJsonPageType.REGISTER) {
|
|
76
|
-
navigationLink =
|
|
76
|
+
navigationLink = {
|
|
77
77
|
href: "/account/register",
|
|
78
78
|
label: linkPropValue.label || "",
|
|
79
79
|
subLinks: [],
|
|
80
|
-
}
|
|
80
|
+
};
|
|
81
81
|
} else if (
|
|
82
82
|
linkPropValue.pageType === IkasThemeJsonPageType.FORGOT_PASSWORD
|
|
83
83
|
) {
|
|
84
|
-
navigationLink =
|
|
84
|
+
navigationLink = {
|
|
85
85
|
href: "/account/forgot-password",
|
|
86
86
|
label: linkPropValue.label || "",
|
|
87
87
|
subLinks: [],
|
|
88
|
-
}
|
|
88
|
+
};
|
|
89
89
|
} else if (
|
|
90
90
|
linkPropValue.pageType === IkasThemeJsonPageType.RECOVER_PASSWORD
|
|
91
91
|
) {
|
|
92
|
-
navigationLink =
|
|
92
|
+
navigationLink = {
|
|
93
93
|
href: "/account/recover-password",
|
|
94
94
|
label: linkPropValue.label || "",
|
|
95
95
|
subLinks: [],
|
|
96
|
-
}
|
|
96
|
+
};
|
|
97
97
|
} else if (linkPropValue.pageType === IkasThemeJsonPageType.BLOG_INDEX) {
|
|
98
|
-
navigationLink =
|
|
98
|
+
navigationLink = {
|
|
99
99
|
href: "/blog",
|
|
100
100
|
label: linkPropValue.label || "",
|
|
101
101
|
subLinks: [],
|
|
102
|
-
}
|
|
102
|
+
};
|
|
103
103
|
} else if (linkPropValue.pageType === IkasThemeJsonPageType.CART) {
|
|
104
|
-
navigationLink =
|
|
104
|
+
navigationLink = {
|
|
105
105
|
href: "/cart",
|
|
106
106
|
label: linkPropValue.label || "",
|
|
107
107
|
subLinks: [],
|
|
108
|
-
}
|
|
108
|
+
};
|
|
109
109
|
} else if (linkPropValue.pageType === IkasThemeJsonPageType.SEARCH) {
|
|
110
|
-
navigationLink =
|
|
110
|
+
navigationLink = {
|
|
111
111
|
href: "/search",
|
|
112
112
|
label: linkPropValue.label || "",
|
|
113
113
|
subLinks: [],
|
|
114
|
-
}
|
|
114
|
+
};
|
|
115
115
|
}
|
|
116
116
|
// CUSTOM PAGE
|
|
117
117
|
else if (linkPropValue.pageType === IkasThemeJsonPageType.CUSTOM) {
|
|
@@ -119,11 +119,11 @@ export class IkasLinkPropValueProvider
|
|
|
119
119
|
(p) => p.id === linkPropValue.pageId
|
|
120
120
|
);
|
|
121
121
|
if (themePage) {
|
|
122
|
-
navigationLink =
|
|
122
|
+
navigationLink = {
|
|
123
123
|
href: "/pages/" + themePage.slug,
|
|
124
124
|
label: linkPropValue.label || "",
|
|
125
125
|
subLinks: [],
|
|
126
|
-
}
|
|
126
|
+
};
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
// ITEM PAGES
|
|
@@ -135,11 +135,11 @@ export class IkasLinkPropValueProvider
|
|
|
135
135
|
].includes(linkPropValue.pageType!)
|
|
136
136
|
) {
|
|
137
137
|
if (linkPropValue.itemId) {
|
|
138
|
-
navigationLink =
|
|
138
|
+
navigationLink = {
|
|
139
139
|
href: "/",
|
|
140
140
|
label: linkPropValue.label || "",
|
|
141
141
|
subLinks: [],
|
|
142
|
-
}
|
|
142
|
+
};
|
|
143
143
|
this.linkMetaDataTargetIds.push({
|
|
144
144
|
type: "DEFAULT",
|
|
145
145
|
id: linkPropValue.itemId,
|
|
@@ -155,11 +155,11 @@ export class IkasLinkPropValueProvider
|
|
|
155
155
|
].includes(linkPropValue.pageType!)
|
|
156
156
|
) {
|
|
157
157
|
if (linkPropValue.itemId) {
|
|
158
|
-
navigationLink =
|
|
158
|
+
navigationLink = {
|
|
159
159
|
href: "/blog/",
|
|
160
160
|
label: linkPropValue.label || "",
|
|
161
161
|
subLinks: [],
|
|
162
|
-
}
|
|
162
|
+
};
|
|
163
163
|
this.linkMetaDataTargetIds.push({
|
|
164
164
|
type: "BLOG",
|
|
165
165
|
id: linkPropValue.itemId,
|
|
@@ -170,11 +170,11 @@ export class IkasLinkPropValueProvider
|
|
|
170
170
|
// RAFFLE ITEM PAGE
|
|
171
171
|
else if (linkPropValue.pageType === IkasThemeJsonPageType.RAFFLE_DETAIL) {
|
|
172
172
|
if (linkPropValue.itemId) {
|
|
173
|
-
navigationLink =
|
|
173
|
+
navigationLink = {
|
|
174
174
|
href: "/raffle/",
|
|
175
175
|
label: linkPropValue.label || "",
|
|
176
176
|
subLinks: [],
|
|
177
|
-
}
|
|
177
|
+
};
|
|
178
178
|
this.linkMetaDataTargetIds.push({
|
|
179
179
|
type: "RAFFLE",
|
|
180
180
|
id: linkPropValue.itemId,
|
|
@@ -200,12 +200,12 @@ export class IkasLinkPropValueProvider
|
|
|
200
200
|
}
|
|
201
201
|
// EXTERNAL LINK
|
|
202
202
|
else if (linkPropValue.linkType === IkasLinkType.EXTERNAL) {
|
|
203
|
-
navigationLink =
|
|
203
|
+
navigationLink = {
|
|
204
204
|
href: linkPropValue.externalLink || "",
|
|
205
205
|
label: linkPropValue.label || "",
|
|
206
206
|
subLinks: [],
|
|
207
207
|
isExternal: true,
|
|
208
|
-
}
|
|
208
|
+
};
|
|
209
209
|
}
|
|
210
210
|
|
|
211
211
|
if (navigationLink) {
|
|
@@ -244,7 +244,7 @@ export class IkasLinkPropValueProvider
|
|
|
244
244
|
return navigationLink;
|
|
245
245
|
}
|
|
246
246
|
|
|
247
|
-
return
|
|
247
|
+
return { href: "", label: "", subLinks: [] } as IkasNavigationLink;
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
async getValue(): Promise<IkasNavigationLink | IkasNavigationLink[]> {
|
|
@@ -257,20 +257,3 @@ export class IkasLinkPropValueProvider
|
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
|
-
|
|
261
|
-
// This is a class by choice, mobx creates clones of plain JSON objects, but not class instances
|
|
262
|
-
export class NavigationLink implements IkasNavigationLink {
|
|
263
|
-
href: string;
|
|
264
|
-
label: string;
|
|
265
|
-
subLinks: IkasNavigationLink[];
|
|
266
|
-
isExternal?: boolean | null;
|
|
267
|
-
itemId?: string;
|
|
268
|
-
|
|
269
|
-
constructor(data: IkasNavigationLink) {
|
|
270
|
-
this.href = data.href;
|
|
271
|
-
this.label = data.label;
|
|
272
|
-
this.subLinks = data.subLinks;
|
|
273
|
-
this.isExternal = data.isExternal;
|
|
274
|
-
this.itemId = data.itemId;
|
|
275
|
-
}
|
|
276
|
-
}
|