@ikas/storefront-next 4.0.0-alpha.55 → 4.0.0-alpha.56

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 (187) hide show
  1. package/build/api/getComponentDirs.d.ts +3 -0
  2. package/build/api/getComponentDirs.js +1 -0
  3. package/build/api/getTheme.d.ts +3 -0
  4. package/build/api/getTheme.js +1 -0
  5. package/{src/api/index.ts → build/api/index.d.ts} +11 -14
  6. package/build/api/index.js +1 -0
  7. package/build/api/middleware.d.ts +3 -0
  8. package/build/api/middleware.js +1 -0
  9. package/build/api/updateTheme.d.ts +9 -0
  10. package/build/api/updateTheme.js +1 -0
  11. package/build/api/uploadTheme.d.ts +3 -0
  12. package/build/api/uploadTheme.js +1 -0
  13. package/build/ext/tslib/tslib.es6.js +1 -0
  14. package/{src/index.ts → build/index.d.ts} +4 -4
  15. package/build/index.js +1 -0
  16. package/build/packages/cmd/build/_virtual/_cloneBuffer.js +1 -0
  17. package/build/packages/cmd/build/_virtual/_commonjsHelpers.js +1 -0
  18. package/build/packages/cmd/build/_virtual/_nodeUtil.js +1 -0
  19. package/build/packages/cmd/build/_virtual/isBuffer.js +1 -0
  20. package/build/packages/cmd/build/ext/lodash/_DataView.js +1 -0
  21. package/build/packages/cmd/build/ext/lodash/_Hash.js +1 -0
  22. package/build/packages/cmd/build/ext/lodash/_ListCache.js +1 -0
  23. package/build/packages/cmd/build/ext/lodash/_Map.js +1 -0
  24. package/build/packages/cmd/build/ext/lodash/_MapCache.js +1 -0
  25. package/build/packages/cmd/build/ext/lodash/_Promise.js +1 -0
  26. package/build/packages/cmd/build/ext/lodash/_Set.js +1 -0
  27. package/build/packages/cmd/build/ext/lodash/_SetCache.js +1 -0
  28. package/build/packages/cmd/build/ext/lodash/_Symbol.js +1 -0
  29. package/build/packages/cmd/build/ext/lodash/_Uint8Array.js +1 -0
  30. package/build/packages/cmd/build/ext/lodash/_WeakMap.js +1 -0
  31. package/build/packages/cmd/build/ext/lodash/_arrayIncludes.js +1 -0
  32. package/build/packages/cmd/build/ext/lodash/_arrayIncludesWith.js +1 -0
  33. package/build/packages/cmd/build/ext/lodash/_arrayLikeKeys.js +1 -0
  34. package/build/packages/cmd/build/ext/lodash/_assocIndexOf.js +1 -0
  35. package/build/packages/cmd/build/ext/lodash/_baseClone.js +1 -0
  36. package/build/packages/cmd/build/ext/lodash/_baseFindIndex.js +1 -0
  37. package/build/packages/cmd/build/ext/lodash/_baseGetTag.js +1 -0
  38. package/build/packages/cmd/build/ext/lodash/_baseIndexOf.js +1 -0
  39. package/build/packages/cmd/build/ext/lodash/_baseIsArguments.js +1 -0
  40. package/build/packages/cmd/build/ext/lodash/_baseIsNaN.js +1 -0
  41. package/build/packages/cmd/build/ext/lodash/_baseIsNative.js +1 -0
  42. package/build/packages/cmd/build/ext/lodash/_baseUniq.js +1 -0
  43. package/build/packages/cmd/build/ext/lodash/_cacheHas.js +1 -0
  44. package/build/packages/cmd/build/ext/lodash/_cloneBuffer.js +1 -0
  45. package/build/packages/cmd/build/ext/lodash/_cloneSymbol.js +1 -0
  46. package/build/packages/cmd/build/ext/lodash/_coreJsData.js +1 -0
  47. package/build/packages/cmd/build/ext/lodash/_createSet.js +1 -0
  48. package/build/packages/cmd/build/ext/lodash/_defineProperty.js +1 -0
  49. package/build/packages/cmd/build/ext/lodash/_freeGlobal.js +1 -0
  50. package/build/packages/cmd/build/ext/lodash/_getMapData.js +1 -0
  51. package/build/packages/cmd/build/ext/lodash/_getNative.js +1 -0
  52. package/build/packages/cmd/build/ext/lodash/_getRawTag.js +1 -0
  53. package/build/packages/cmd/build/ext/lodash/_getTag.js +1 -0
  54. package/build/packages/cmd/build/ext/lodash/_getValue.js +1 -0
  55. package/build/packages/cmd/build/ext/lodash/_hashClear.js +1 -0
  56. package/build/packages/cmd/build/ext/lodash/_hashDelete.js +1 -0
  57. package/build/packages/cmd/build/ext/lodash/_hashGet.js +1 -0
  58. package/build/packages/cmd/build/ext/lodash/_hashHas.js +1 -0
  59. package/build/packages/cmd/build/ext/lodash/_hashSet.js +1 -0
  60. package/build/packages/cmd/build/ext/lodash/_isKeyable.js +1 -0
  61. package/build/packages/cmd/build/ext/lodash/_isMasked.js +1 -0
  62. package/build/packages/cmd/build/ext/lodash/_listCacheClear.js +1 -0
  63. package/build/packages/cmd/build/ext/lodash/_listCacheDelete.js +1 -0
  64. package/build/packages/cmd/build/ext/lodash/_listCacheGet.js +1 -0
  65. package/build/packages/cmd/build/ext/lodash/_listCacheHas.js +1 -0
  66. package/build/packages/cmd/build/ext/lodash/_listCacheSet.js +1 -0
  67. package/build/packages/cmd/build/ext/lodash/_mapCacheClear.js +1 -0
  68. package/build/packages/cmd/build/ext/lodash/_mapCacheDelete.js +1 -0
  69. package/build/packages/cmd/build/ext/lodash/_mapCacheGet.js +1 -0
  70. package/build/packages/cmd/build/ext/lodash/_mapCacheHas.js +1 -0
  71. package/build/packages/cmd/build/ext/lodash/_mapCacheSet.js +1 -0
  72. package/build/packages/cmd/build/ext/lodash/_nativeCreate.js +1 -0
  73. package/build/packages/cmd/build/ext/lodash/_nodeUtil.js +1 -0
  74. package/build/packages/cmd/build/ext/lodash/_objectToString.js +1 -0
  75. package/build/packages/cmd/build/ext/lodash/_root.js +1 -0
  76. package/build/packages/cmd/build/ext/lodash/_setCacheAdd.js +1 -0
  77. package/build/packages/cmd/build/ext/lodash/_setCacheHas.js +1 -0
  78. package/build/packages/cmd/build/ext/lodash/_setToArray.js +1 -0
  79. package/build/packages/cmd/build/ext/lodash/_strictIndexOf.js +1 -0
  80. package/build/packages/cmd/build/ext/lodash/_toSource.js +1 -0
  81. package/build/packages/cmd/build/ext/lodash/eq.js +1 -0
  82. package/build/packages/cmd/build/ext/lodash/isArguments.js +1 -0
  83. package/build/packages/cmd/build/ext/lodash/isBuffer.js +1 -0
  84. package/build/packages/cmd/build/ext/lodash/isFunction.js +1 -0
  85. package/build/packages/cmd/build/ext/lodash/isMap.js +1 -0
  86. package/build/packages/cmd/build/ext/lodash/isObject.js +1 -0
  87. package/build/packages/cmd/build/ext/lodash/isObjectLike.js +1 -0
  88. package/build/packages/cmd/build/ext/lodash/isSet.js +1 -0
  89. package/build/packages/cmd/build/ext/lodash/isTypedArray.js +1 -0
  90. package/build/packages/cmd/build/ext/lodash/noop.js +1 -0
  91. package/build/packages/cmd/build/ext/lodash/stubFalse.js +1 -0
  92. package/build/packages/cmd/build/ext/lodash/uniq.js +1 -0
  93. package/build/packages/cmd/build/ext/tslib/tslib.es6.js +1 -0
  94. package/build/packages/cmd/build/scripts/generators/api/index.js +1 -0
  95. package/build/packages/cmd/build/scripts/generators/api/info.js +1 -0
  96. package/build/packages/cmd/build/scripts/generators/components/index.js +1 -0
  97. package/build/packages/cmd/build/scripts/generators/pages/index.js +1 -0
  98. package/build/packages/cmd/build/scripts/generators/pages/info.js +1 -0
  99. package/build/packages/cmd/build/scripts/generators/theme/index.js +1 -0
  100. package/build/packages/cmd/build/scripts/generators/types/index.js +1 -0
  101. package/build/packages/cmd/build/utils/fs.js +1 -0
  102. package/build/packages/cmd/build/utils/helper.js +1 -0
  103. package/build/pages/404.d.ts +2 -0
  104. package/build/pages/404.js +1 -0
  105. package/build/pages/[slug]/index.d.ts +3 -0
  106. package/build/pages/_slug_/index.js +1 -0
  107. package/build/pages/account/addresses.d.ts +2 -0
  108. package/build/pages/account/addresses.js +1 -0
  109. package/build/pages/account/favorite-products.d.ts +2 -0
  110. package/build/pages/account/favorite-products.js +1 -0
  111. package/build/pages/account/forgot-password.d.ts +2 -0
  112. package/build/pages/account/forgot-password.js +1 -0
  113. package/build/pages/account/index.d.ts +2 -0
  114. package/build/pages/account/index.js +1 -0
  115. package/build/pages/account/login.d.ts +2 -0
  116. package/build/pages/account/login.js +1 -0
  117. package/build/pages/account/orders/[id].d.ts +2 -0
  118. package/build/pages/account/orders/_id_.js +1 -0
  119. package/build/pages/account/orders/index.d.ts +2 -0
  120. package/build/pages/account/orders/index.js +1 -0
  121. package/build/pages/account/raffles.d.ts +2 -0
  122. package/build/pages/account/raffles.js +1 -0
  123. package/build/pages/account/recover-password.d.ts +2 -0
  124. package/build/pages/account/recover-password.js +1 -0
  125. package/build/pages/account/register.d.ts +2 -0
  126. package/build/pages/account/register.js +1 -0
  127. package/build/pages/blog/[slug].d.ts +3 -0
  128. package/build/pages/blog/_slug_.js +1 -0
  129. package/build/pages/blog/index.d.ts +2 -0
  130. package/build/pages/blog/index.js +1 -0
  131. package/build/pages/cart.d.ts +2 -0
  132. package/build/pages/cart.js +1 -0
  133. package/build/pages/checkout.d.ts +2 -0
  134. package/build/pages/checkout.js +1 -0
  135. package/build/pages/editor.d.ts +2 -0
  136. package/build/pages/editor.js +1 -0
  137. package/build/pages/home.d.ts +2 -0
  138. package/build/pages/home.js +1 -0
  139. package/{src/pages/index.ts → build/pages/index.d.ts} +22 -22
  140. package/build/pages/pages/[slug].d.ts +3 -0
  141. package/build/pages/pages/_slug_.js +1 -0
  142. package/build/pages/raffle/[slug].d.ts +3 -0
  143. package/build/pages/raffle/_slug_.js +1 -0
  144. package/build/pages/raffle/index.d.ts +2 -0
  145. package/build/pages/raffle/index.js +1 -0
  146. package/build/pages/search.d.ts +2 -0
  147. package/build/pages/search.js +1 -0
  148. package/build/provider/page-data-next.d.ts +93 -0
  149. package/build/provider/page-data-next.js +1 -0
  150. package/build/utils/fs.d.ts +28 -0
  151. package/build/utils/fs.js +1 -0
  152. package/build/utils/google-fonts.d.ts +2 -0
  153. package/build/utils/google-fonts.js +1 -0
  154. package/build/utils/i18n.d.ts +9 -0
  155. package/build/utils/i18n.js +1 -0
  156. package/package.json +15 -15
  157. package/src/api/getComponentDirs.ts +0 -39
  158. package/src/api/getTheme.ts +0 -22
  159. package/src/api/middleware.ts +0 -24
  160. package/src/api/updateTheme.ts +0 -33
  161. package/src/api/uploadTheme.ts +0 -311
  162. package/src/pages/404.tsx +0 -18
  163. package/src/pages/[slug]/index.tsx +0 -18
  164. package/src/pages/account/addresses.tsx +0 -10
  165. package/src/pages/account/favorite-products.tsx +0 -10
  166. package/src/pages/account/forgot-password.tsx +0 -10
  167. package/src/pages/account/index.tsx +0 -10
  168. package/src/pages/account/login.tsx +0 -10
  169. package/src/pages/account/orders/[id].tsx +0 -10
  170. package/src/pages/account/orders/index.tsx +0 -10
  171. package/src/pages/account/raffles.tsx +0 -10
  172. package/src/pages/account/recover-password.tsx +0 -10
  173. package/src/pages/account/register.tsx +0 -10
  174. package/src/pages/blog/[slug].tsx +0 -17
  175. package/src/pages/blog/index.tsx +0 -10
  176. package/src/pages/cart.tsx +0 -10
  177. package/src/pages/checkout.tsx +0 -10
  178. package/src/pages/editor.tsx +0 -11
  179. package/src/pages/home.tsx +0 -10
  180. package/src/pages/pages/[slug].tsx +0 -72
  181. package/src/pages/raffle/[slug].tsx +0 -17
  182. package/src/pages/raffle/index.tsx +0 -10
  183. package/src/pages/search.tsx +0 -10
  184. package/src/provider/page-data-next.ts +0 -608
  185. package/src/utils/fs.ts +0 -93
  186. package/src/utils/google-fonts.ts +0 -52
  187. package/src/utils/i18n.ts +0 -86
@@ -1,311 +0,0 @@
1
- import fs from "fs";
2
- import path from "path";
3
- import archiver from "archiver";
4
- import { NextApiRequest, NextApiResponse } from "next";
5
- import axios from "axios";
6
-
7
- //@ts-ignore
8
- import CheckoutDE from "@ikas/storefront-assets/checkout/de.js";
9
- //@ts-ignore
10
- import CheckoutEN from "@ikas/storefront-assets/checkout/en.js";
11
- //@ts-ignore
12
- import CheckoutTR from "@ikas/storefront-assets/checkout/tr.js";
13
-
14
- import { corsMiddleware } from "./middleware";
15
-
16
- export const uploadTheme = async (
17
- req: NextApiRequest,
18
- res: NextApiResponse
19
- ) => {
20
- await corsMiddleware(req, res);
21
- try {
22
- const theme = await getTheme();
23
-
24
- const localization = await readLocalizationFiles();
25
- const uploadUrl = await saveTheme(theme, localization);
26
-
27
- if (typeof uploadUrl === "string") {
28
- const zipDir = await archiveThemeCode();
29
- const stat = fs.statSync(zipDir);
30
- const success = await _uploadTheme(
31
- uploadUrl,
32
- fs.readFileSync(zipDir),
33
- stat.size
34
- );
35
- console.log(success);
36
- if (success) {
37
- buildTheme();
38
- }
39
- deleteThemeZip(zipDir);
40
- }
41
-
42
- res.statusCode = 200;
43
- res.setHeader("Content-Type", "application/json");
44
- res.json({ status: "ok" });
45
- } catch (err) {
46
- console.log(err);
47
- res.statusCode = 400;
48
- res.setHeader("Content-Type", "application/json");
49
- res.json({ status: "failed" });
50
- }
51
- };
52
-
53
- export const config = {};
54
-
55
- async function archiveThemeCode(): Promise<string> {
56
- const themePath = path.join(process.cwd());
57
-
58
- const filename = "theme.zip";
59
- const dirname = path.join(process.cwd(), filename);
60
- const output = fs.createWriteStream(dirname);
61
- const archive = archiver("zip", {
62
- zlib: {
63
- level: 9,
64
- },
65
- });
66
-
67
- archive.on("warning", function (err) {
68
- if (err.code !== "ENOENT") {
69
- throw err;
70
- }
71
- });
72
-
73
- archive.on("error", function (err) {
74
- throw err;
75
- });
76
-
77
- archive.pipe(output);
78
-
79
- const excludedDirs = ["node_modules", ".next", "out", ".git"];
80
- const files = fs.readdirSync(themePath);
81
-
82
- files.forEach((file) => {
83
- const filePath = path.join(themePath, file);
84
- const stat = fs.lstatSync(filePath);
85
-
86
- if (stat.isDirectory()) {
87
- if (excludedDirs.includes(file)) return;
88
- archive.directory(filePath, file);
89
- } else {
90
- archive.file(filePath, { name: file });
91
- }
92
- });
93
-
94
- await archive.finalize();
95
-
96
- return new Promise((resolve) => {
97
- setTimeout(() => {
98
- resolve(dirname);
99
- }, 2000);
100
- });
101
- }
102
-
103
- async function saveTheme(theme: any, localization: Record<string, any>) {
104
- try {
105
- const locales = Object.keys(localization);
106
- const defaultLocale = locales.some((l) => l === "en") ? "en" : locales[0];
107
- const config = await getStorefrontConfig();
108
-
109
- const response = await axios({
110
- method: "post",
111
- url: process.env.NEXT_PUBLIC_UPLOAD_GQL_URL!,
112
- headers: {
113
- "x-api-key": config.apiKey,
114
- "Content-Type": "application/json",
115
- },
116
- data: JSON.stringify({
117
- query: /* GraphQL */ `
118
- mutation saveTheme($saveThemeInput: SaveThemeInput!) {
119
- saveTheme(input: $saveThemeInput) {
120
- themeVersionId
121
- uploadUrl
122
- }
123
- }
124
- `,
125
- variables: {
126
- saveThemeInput: {
127
- id: config.themeId,
128
- themeJson: JSON.stringify(theme),
129
- locales: Object.entries(localization).map(
130
- ([locale, localeTranslations]) => ({
131
- isDefaultLocale: locale === defaultLocale,
132
- locale,
133
- localeJson: JSON.stringify(localeTranslations),
134
- })
135
- ),
136
- },
137
- },
138
- }),
139
- });
140
-
141
- // const response = await fetch(process.env.NEXT_PUBLIC_UPLOAD_GQL_URL!, {
142
- // method: "POST",
143
- // body: JSON.stringify({
144
- // query: /* GraphQL */ `
145
- // mutation saveTheme($saveThemeInput: SaveThemeInput!) {
146
- // saveTheme(input: $saveThemeInput) {
147
- // themeVersionId
148
- // uploadUrl
149
- // }
150
- // }
151
- // `,
152
- // variables: {
153
- // saveThemeInput: {
154
- // id: config.themeId,
155
- // themeJson: JSON.stringify(theme),
156
- // locales: Object.entries(localization).map(
157
- // ([locale, localeTranslations]) => ({
158
- // isDefaultLocale: locale === defaultLocale,
159
- // locale,
160
- // localeJson: JSON.stringify(localeTranslations),
161
- // })
162
- // ),
163
- // },
164
- // },
165
- // }),
166
- // headers: {
167
- // "x-api-key": config.apiKey,
168
- // "Content-Type": "application/json",
169
- // },
170
- // });
171
- const responseJSON = await response.data;
172
-
173
- if (responseJSON.data && responseJSON.data.saveTheme) {
174
- return responseJSON.data.saveTheme.uploadUrl as string;
175
- }
176
- } catch (err) {
177
- console.log(err);
178
- }
179
- }
180
-
181
- async function _uploadTheme(uploadUrl: string, file: Buffer, size: number) {
182
- const config = {
183
- headers: {
184
- "Content-Type": "application/zip",
185
- "Content-Length": size + "",
186
- },
187
- };
188
-
189
- try {
190
- const res = await axios.put(uploadUrl, file, config);
191
- return res.status === 200;
192
- } catch (err) {
193
- console.log(err);
194
- return false;
195
- }
196
- }
197
-
198
- async function buildTheme() {
199
- try {
200
- const config = await getStorefrontConfig();
201
- const response = await fetch(process.env.NEXT_PUBLIC_UPLOAD_GQL_URL!, {
202
- method: "POST",
203
- body: JSON.stringify({
204
- query: /* GraphQL */ `
205
- mutation buildTheme($buildThemeThemeId: String!) {
206
- buildTheme(themeId: $buildThemeThemeId)
207
- }
208
- `,
209
- variables: {
210
- buildThemeThemeId: config.themeId,
211
- },
212
- }),
213
- headers: {
214
- "x-api-key": config.apiKey,
215
- "Content-Type": "application/json",
216
- },
217
- });
218
- const responseJSON = await response.json();
219
- console.log(responseJSON);
220
- } catch (err) {
221
- console.log(err);
222
- }
223
- }
224
-
225
- function getTheme(): Promise<any> {
226
- return new Promise((resolve, reject) => {
227
- const themePath = path.join(process.cwd(), "src", "theme.json");
228
- fs.readFile(themePath, function (err, file) {
229
- if (err) {
230
- return reject(err);
231
- }
232
- resolve(JSON.parse(file.toString()));
233
- });
234
- });
235
- }
236
-
237
- function getStorefrontConfig(): Promise<Record<string, any>> {
238
- return new Promise((resolve, reject) => {
239
- const themePath = path.join(process.cwd(), "config.json");
240
- fs.readFile(themePath, function (err, file) {
241
- if (err) {
242
- return reject(err);
243
- }
244
- resolve(JSON.parse(file.toString()));
245
- });
246
- });
247
- }
248
-
249
- function deleteThemeZip(zipDir: string) {
250
- fs.unlinkSync(zipDir);
251
- }
252
-
253
- function readLocalizationFiles(): Promise<Record<string, any>> {
254
- return new Promise((resolve, reject) => {
255
- const localesPath = path.join(process.cwd(), "public", "locales");
256
- const stripExtension = (path: string) =>
257
- path.length ? path.split(".")[0] : path;
258
-
259
- fs.readdir(localesPath, function (err, files) {
260
- if (err) {
261
- return reject(err);
262
- }
263
-
264
- const localeDirs = files.filter((file) =>
265
- fs.lstatSync(path.join(localesPath, file)).isDirectory()
266
- );
267
-
268
- const locales: Record<string, any> = {};
269
- let hasError = false;
270
-
271
- localeDirs.forEach((locale) => {
272
- const localeDirPath = path.join(
273
- process.cwd(),
274
- "public",
275
- "locales",
276
- locale
277
- );
278
-
279
- locales[locale] = {};
280
-
281
- try {
282
- const localeFiles = fs.readdirSync(localeDirPath);
283
- localeFiles.forEach((localeFile) => {
284
- const file = fs.readFileSync(
285
- path.join(process.cwd(), "public", "locales", locale, localeFile)
286
- );
287
-
288
- const strippedLocale = stripExtension(locale).toLowerCase();
289
- const namespace = stripExtension(localeFile).toLowerCase();
290
-
291
- locales[strippedLocale][namespace] = JSON.parse(file.toString());
292
-
293
- if (strippedLocale === "tr") {
294
- locales[strippedLocale]["checkout-page"] = CheckoutTR;
295
- } else if (strippedLocale === "de") {
296
- locales[strippedLocale]["checkout-page"] = CheckoutDE;
297
- } else {
298
- locales[strippedLocale]["checkout-page"] = CheckoutEN;
299
- }
300
- });
301
- } catch (err) {
302
- console.error(err);
303
- hasError = true;
304
- }
305
- });
306
-
307
- if (hasError) reject(null);
308
- else resolve(locales);
309
- });
310
- });
311
- }
package/src/pages/404.tsx DELETED
@@ -1,18 +0,0 @@
1
- import { IkasThemeJsonPageType } from "@ikas/storefront-models";
2
- import { GetStaticProps } from "next";
3
- import { IkasNextPageDataProvider } from "../provider/page-data-next";
4
-
5
- export const getStaticProps: GetStaticProps = async (context) => {
6
- const props = await IkasNextPageDataProvider.getStaticProps(
7
- context,
8
- IkasThemeJsonPageType.NOT_FOUND
9
- );
10
-
11
- //@ts-ignore
12
- if (props.notFound)
13
- return {
14
- props: {},
15
- revalidate: 60,
16
- };
17
- else return props;
18
- };
@@ -1,18 +0,0 @@
1
- import { GetStaticPaths, GetStaticProps } from "next";
2
- import { IkasNextPageDataProvider } from "../../provider/page-data-next";
3
- import { IkasThemeJsonPageType } from "@ikas/storefront-models";
4
-
5
- export const getStaticPaths: GetStaticPaths = async () => {
6
- return {
7
- paths: [],
8
- fallback: "blocking",
9
- };
10
- };
11
-
12
- export const getStaticProps: GetStaticProps = async (context) => {
13
- return await IkasNextPageDataProvider.getStaticProps(context, undefined, [
14
- IkasThemeJsonPageType.BRAND,
15
- IkasThemeJsonPageType.CATEGORY,
16
- IkasThemeJsonPageType.PRODUCT,
17
- ]);
18
- };
@@ -1,10 +0,0 @@
1
- import { IkasThemeJsonPageType } from "@ikas/storefront-models";
2
- import { GetStaticProps } from "next";
3
- import { IkasNextPageDataProvider } from "../../provider/page-data-next";
4
-
5
- export const getStaticProps: GetStaticProps = async (context) => {
6
- return await IkasNextPageDataProvider.getStaticProps(
7
- context,
8
- IkasThemeJsonPageType.ADDRESSES
9
- );
10
- };
@@ -1,10 +0,0 @@
1
- import { IkasThemeJsonPageType } from "@ikas/storefront-models";
2
- import { GetStaticProps } from "next";
3
- import { IkasNextPageDataProvider } from "../../provider/page-data-next";
4
-
5
- export const getStaticProps: GetStaticProps = async (context) => {
6
- return await IkasNextPageDataProvider.getStaticProps(
7
- context,
8
- IkasThemeJsonPageType.FAVORITE_PRODUCTS
9
- );
10
- };
@@ -1,10 +0,0 @@
1
- import { IkasThemeJsonPageType } from "@ikas/storefront-models";
2
- import { GetStaticProps } from "next";
3
- import { IkasNextPageDataProvider } from "../../provider/page-data-next";
4
-
5
- export const getStaticProps: GetStaticProps = async (context) => {
6
- return await IkasNextPageDataProvider.getStaticProps(
7
- context,
8
- IkasThemeJsonPageType.FORGOT_PASSWORD
9
- );
10
- };
@@ -1,10 +0,0 @@
1
- import { IkasThemeJsonPageType } from "@ikas/storefront-models";
2
- import { GetStaticProps } from "next";
3
- import { IkasNextPageDataProvider } from "../../provider/page-data-next";
4
-
5
- export const getStaticProps: GetStaticProps = async (context) => {
6
- return await IkasNextPageDataProvider.getStaticProps(
7
- context,
8
- IkasThemeJsonPageType.ACCOUNT
9
- );
10
- };
@@ -1,10 +0,0 @@
1
- import { IkasThemeJsonPageType } from "@ikas/storefront-models";
2
- import { GetStaticProps } from "next";
3
- import { IkasNextPageDataProvider } from "../../provider/page-data-next";
4
-
5
- export const getStaticProps: GetStaticProps = async (context) => {
6
- return await IkasNextPageDataProvider.getStaticProps(
7
- context,
8
- IkasThemeJsonPageType.LOGIN
9
- );
10
- };
@@ -1,10 +0,0 @@
1
- import { IkasThemeJsonPageType } from "@ikas/storefront-models";
2
- import { GetServerSideProps } from "next";
3
- import { IkasNextPageDataProvider } from "../../../provider/page-data-next";
4
-
5
- export const getServerSideProps: GetServerSideProps = async (context) => {
6
- return await IkasNextPageDataProvider.getServerSideProps(
7
- context,
8
- IkasThemeJsonPageType.ORDER_DETAIL
9
- );
10
- };
@@ -1,10 +0,0 @@
1
- import { IkasThemeJsonPageType } from "@ikas/storefront-models";
2
- import { GetStaticProps } from "next";
3
- import { IkasNextPageDataProvider } from "../../../provider/page-data-next";
4
-
5
- export const getStaticProps: GetStaticProps = async (context) => {
6
- return await IkasNextPageDataProvider.getStaticProps(
7
- context,
8
- IkasThemeJsonPageType.ORDERS
9
- );
10
- };
@@ -1,10 +0,0 @@
1
- import { IkasThemeJsonPageType } from "@ikas/storefront-models";
2
- import { GetStaticProps } from "next";
3
- import { IkasNextPageDataProvider } from "../../provider/page-data-next";
4
-
5
- export const getStaticProps: GetStaticProps = async (context) => {
6
- return await IkasNextPageDataProvider.getStaticProps(
7
- context,
8
- IkasThemeJsonPageType.RAFFLE_ACCOUNT
9
- );
10
- };
@@ -1,10 +0,0 @@
1
- import { IkasThemeJsonPageType } from "@ikas/storefront-models";
2
- import { GetStaticProps } from "next";
3
- import { IkasNextPageDataProvider } from "../../provider/page-data-next";
4
-
5
- export const getStaticProps: GetStaticProps = async (context) => {
6
- return await IkasNextPageDataProvider.getStaticProps(
7
- context,
8
- IkasThemeJsonPageType.RECOVER_PASSWORD
9
- );
10
- };
@@ -1,10 +0,0 @@
1
- import { IkasThemeJsonPageType } from "@ikas/storefront-models";
2
- import { GetStaticProps } from "next";
3
- import { IkasNextPageDataProvider } from "../../provider/page-data-next";
4
-
5
- export const getStaticProps: GetStaticProps = async (context) => {
6
- return await IkasNextPageDataProvider.getStaticProps(
7
- context,
8
- IkasThemeJsonPageType.REGISTER
9
- );
10
- };
@@ -1,17 +0,0 @@
1
- import { IkasThemeJsonPageType } from "@ikas/storefront-models";
2
- import { GetStaticPaths, GetStaticProps } from "next";
3
- import { IkasNextPageDataProvider } from "../../provider/page-data-next";
4
-
5
- export const getStaticPaths: GetStaticPaths = async () => {
6
- return {
7
- paths: [],
8
- fallback: "blocking",
9
- };
10
- };
11
-
12
- export const getStaticProps: GetStaticProps = async (context) => {
13
- return await IkasNextPageDataProvider.getStaticProps(context, undefined, [
14
- IkasThemeJsonPageType.BLOG,
15
- IkasThemeJsonPageType.BLOG_CATEGORY,
16
- ]);
17
- };
@@ -1,10 +0,0 @@
1
- import { IkasThemeJsonPageType } from "@ikas/storefront-models";
2
- import { GetStaticProps } from "next";
3
- import { IkasNextPageDataProvider } from "../../provider/page-data-next";
4
-
5
- export const getStaticProps: GetStaticProps = async (context) => {
6
- return await IkasNextPageDataProvider.getStaticProps(
7
- context,
8
- IkasThemeJsonPageType.BLOG_INDEX
9
- );
10
- };
@@ -1,10 +0,0 @@
1
- import { IkasThemeJsonPageType } from "@ikas/storefront-models";
2
- import { GetStaticProps } from "next";
3
- import { IkasNextPageDataProvider } from "../provider/page-data-next";
4
-
5
- export const getStaticProps: GetStaticProps = async (context) => {
6
- return await IkasNextPageDataProvider.getStaticProps(
7
- context,
8
- IkasThemeJsonPageType.CART
9
- );
10
- };
@@ -1,10 +0,0 @@
1
- import { IkasThemeJsonPageType } from "@ikas/storefront-models";
2
- import { GetStaticProps } from "next";
3
- import { IkasNextPageDataProvider } from "../provider/page-data-next";
4
-
5
- export const getStaticProps: GetStaticProps = async (context) => {
6
- return await IkasNextPageDataProvider.getStaticProps(
7
- context,
8
- IkasThemeJsonPageType.CHECKOUT
9
- );
10
- };
@@ -1,11 +0,0 @@
1
- import { GetStaticProps } from "next";
2
- import { IkasNextPageDataProvider } from "../provider/page-data-next";
3
-
4
- export const getStaticProps: GetStaticProps = async (context) => {
5
- return await IkasNextPageDataProvider.getStaticProps(
6
- context,
7
- undefined,
8
- undefined,
9
- true
10
- );
11
- };
@@ -1,10 +0,0 @@
1
- import { GetStaticProps } from "next";
2
- import { IkasThemeJsonPageType } from "@ikas/storefront-models";
3
- import { IkasNextPageDataProvider } from "../provider/page-data-next";
4
-
5
- export const getStaticProps: GetStaticProps = async (context) => {
6
- return await IkasNextPageDataProvider.getStaticProps(
7
- context,
8
- IkasThemeJsonPageType.INDEX
9
- );
10
- };
@@ -1,72 +0,0 @@
1
- import { IkasThemeJsonPageType } from "@ikas/storefront-models";
2
- import { GetStaticProps, GetStaticPaths } from "next";
3
- import {
4
- IkasNextPageDataProvider,
5
- SettingsData,
6
- } from "../../provider/page-data-next";
7
-
8
- type SlugParams = {
9
- slug: string;
10
- };
11
-
12
- type SlugPair = {
13
- params: SlugParams;
14
- locale?: string;
15
- };
16
-
17
- export const getStaticPaths: GetStaticPaths = async (context) => {
18
- if (!context.locales)
19
- return {
20
- paths: [],
21
- fallback: "blocking",
22
- };
23
-
24
- const allSettings = (await Promise.all(
25
- context.locales.map((locale) =>
26
- IkasNextPageDataProvider.getSettings(locale)
27
- )
28
- )) as SettingsData[];
29
-
30
- const customPagePaths: SlugPair[] = [];
31
-
32
- allSettings.forEach(({ themeLocalization, routing }) => {
33
- if (!themeLocalization) return;
34
-
35
- const customPages = themeLocalization.themeJson.pages.filter(
36
- (p) => p.type === IkasThemeJsonPageType.CUSTOM
37
- );
38
-
39
- customPages.forEach((customPage) => {
40
- if (
41
- customPage.slug &&
42
- !customPagePaths.some((p) => p.params.slug === customPage.slug)
43
- ) {
44
- if (process.env.NEXT_PUBLIC_ENV === "local") {
45
- customPagePaths.push({
46
- params: { slug: customPage.slug },
47
- });
48
- } else {
49
- customPagePaths.push({
50
- params: { slug: customPage.slug },
51
- locale: routing.path || routing.id,
52
- });
53
- }
54
- }
55
- });
56
- });
57
-
58
- return {
59
- paths: customPagePaths.map((p) => ({
60
- params: p.params,
61
- locale: p.locale,
62
- })),
63
- fallback: "blocking",
64
- };
65
- };
66
-
67
- export const getStaticProps: GetStaticProps = async (context) => {
68
- return await IkasNextPageDataProvider.getStaticProps(
69
- context,
70
- IkasThemeJsonPageType.CUSTOM
71
- );
72
- };
@@ -1,17 +0,0 @@
1
- import { IkasThemeJsonPageType } from "@ikas/storefront-models";
2
- import { GetStaticProps, GetStaticPaths } from "next";
3
- import { IkasNextPageDataProvider } from "../../provider/page-data-next";
4
-
5
- export const getStaticPaths: GetStaticPaths = async () => {
6
- return {
7
- paths: [],
8
- fallback: "blocking",
9
- };
10
- };
11
-
12
- export const getStaticProps: GetStaticProps = async (context) => {
13
- return await IkasNextPageDataProvider.getStaticProps(
14
- context,
15
- IkasThemeJsonPageType.RAFFLE_DETAIL
16
- );
17
- };
@@ -1,10 +0,0 @@
1
- import { IkasThemeJsonPageType } from "@ikas/storefront-models";
2
- import { GetStaticProps } from "next";
3
- import { IkasNextPageDataProvider } from "../../provider/page-data-next";
4
-
5
- export const getStaticProps: GetStaticProps = async (context) => {
6
- return await IkasNextPageDataProvider.getStaticProps(
7
- context,
8
- IkasThemeJsonPageType.RAFFLE
9
- );
10
- };
@@ -1,10 +0,0 @@
1
- import { GetStaticProps } from "next";
2
- import { IkasThemeJsonPageType } from "@ikas/storefront-models";
3
- import { IkasNextPageDataProvider } from "../provider/page-data-next";
4
-
5
- export const getStaticProps: GetStaticProps = async (context) => {
6
- return await IkasNextPageDataProvider.getStaticProps(
7
- context,
8
- IkasThemeJsonPageType.SEARCH
9
- );
10
- };