@ikas/storefront-next 4.0.0-alpha.7 → 4.0.0-alpha.71

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 +94 -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 +18 -17
  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 -307
  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 -618
  185. package/src/utils/fs.ts +0 -93
  186. package/src/utils/google-fonts.ts +0 -52
  187. package/src/utils/i18n.ts +0 -80
@@ -1,307 +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 CheckoutEN from "@ikas/storefront-assets/checkout/en.js";
9
- //@ts-ignore
10
- import CheckoutTR from "@ikas/storefront-assets/checkout/tr.js";
11
-
12
- import { corsMiddleware } from "./middleware";
13
-
14
- export const uploadTheme = async (
15
- req: NextApiRequest,
16
- res: NextApiResponse
17
- ) => {
18
- await corsMiddleware(req, res);
19
- try {
20
- const theme = await getTheme();
21
-
22
- const localization = await readLocalizationFiles();
23
- const uploadUrl = await saveTheme(theme, localization);
24
-
25
- if (typeof uploadUrl === "string") {
26
- const zipDir = await archiveThemeCode();
27
- const stat = fs.statSync(zipDir);
28
- const success = await _uploadTheme(
29
- uploadUrl,
30
- fs.readFileSync(zipDir),
31
- stat.size
32
- );
33
- console.log(success);
34
- if (success) {
35
- buildTheme();
36
- }
37
- deleteThemeZip(zipDir);
38
- }
39
-
40
- res.statusCode = 200;
41
- res.setHeader("Content-Type", "application/json");
42
- res.json({ status: "ok" });
43
- } catch (err) {
44
- console.log(err);
45
- res.statusCode = 400;
46
- res.setHeader("Content-Type", "application/json");
47
- res.json({ status: "failed" });
48
- }
49
- };
50
-
51
- export const config = {};
52
-
53
- async function archiveThemeCode(): Promise<string> {
54
- const themePath = path.join(process.cwd());
55
-
56
- const filename = "theme.zip";
57
- const dirname = path.join(process.cwd(), filename);
58
- const output = fs.createWriteStream(dirname);
59
- const archive = archiver("zip", {
60
- zlib: {
61
- level: 9,
62
- },
63
- });
64
-
65
- archive.on("warning", function (err) {
66
- if (err.code !== "ENOENT") {
67
- throw err;
68
- }
69
- });
70
-
71
- archive.on("error", function (err) {
72
- throw err;
73
- });
74
-
75
- archive.pipe(output);
76
-
77
- const excludedDirs = ["node_modules", ".next", "out", ".git"];
78
- const files = fs.readdirSync(themePath);
79
-
80
- files.forEach((file) => {
81
- const filePath = path.join(themePath, file);
82
- const stat = fs.lstatSync(filePath);
83
-
84
- if (stat.isDirectory()) {
85
- if (excludedDirs.includes(file)) return;
86
- archive.directory(filePath, file);
87
- } else {
88
- archive.file(filePath, { name: file });
89
- }
90
- });
91
-
92
- await archive.finalize();
93
-
94
- return new Promise((resolve) => {
95
- setTimeout(() => {
96
- resolve(dirname);
97
- }, 2000);
98
- });
99
- }
100
-
101
- async function saveTheme(theme: any, localization: Record<string, any>) {
102
- try {
103
- const locales = Object.keys(localization);
104
- const defaultLocale = locales.some((l) => l === "en") ? "en" : locales[0];
105
- const config = await getStorefrontConfig();
106
-
107
- const response = await axios({
108
- method: "post",
109
- url: process.env.NEXT_PUBLIC_UPLOAD_GQL_URL!,
110
- headers: {
111
- "x-api-key": config.apiKey,
112
- "Content-Type": "application/json",
113
- },
114
- data: JSON.stringify({
115
- query: /* GraphQL */ `
116
- mutation saveTheme($saveThemeInput: SaveThemeInput!) {
117
- saveTheme(input: $saveThemeInput) {
118
- themeVersionId
119
- uploadUrl
120
- }
121
- }
122
- `,
123
- variables: {
124
- saveThemeInput: {
125
- id: config.themeId,
126
- themeJson: JSON.stringify(theme),
127
- locales: Object.entries(localization).map(
128
- ([locale, localeTranslations]) => ({
129
- isDefaultLocale: locale === defaultLocale,
130
- locale,
131
- localeJson: JSON.stringify(localeTranslations),
132
- })
133
- ),
134
- },
135
- },
136
- }),
137
- });
138
-
139
- // const response = await fetch(process.env.NEXT_PUBLIC_UPLOAD_GQL_URL!, {
140
- // method: "POST",
141
- // body: JSON.stringify({
142
- // query: /* GraphQL */ `
143
- // mutation saveTheme($saveThemeInput: SaveThemeInput!) {
144
- // saveTheme(input: $saveThemeInput) {
145
- // themeVersionId
146
- // uploadUrl
147
- // }
148
- // }
149
- // `,
150
- // variables: {
151
- // saveThemeInput: {
152
- // id: config.themeId,
153
- // themeJson: JSON.stringify(theme),
154
- // locales: Object.entries(localization).map(
155
- // ([locale, localeTranslations]) => ({
156
- // isDefaultLocale: locale === defaultLocale,
157
- // locale,
158
- // localeJson: JSON.stringify(localeTranslations),
159
- // })
160
- // ),
161
- // },
162
- // },
163
- // }),
164
- // headers: {
165
- // "x-api-key": config.apiKey,
166
- // "Content-Type": "application/json",
167
- // },
168
- // });
169
- const responseJSON = await response.data();
170
-
171
- if (responseJSON.data && responseJSON.data.saveTheme) {
172
- return responseJSON.data.saveTheme.uploadUrl as string;
173
- }
174
- } catch (err) {
175
- console.log(err);
176
- }
177
- }
178
-
179
- async function _uploadTheme(uploadUrl: string, file: Buffer, size: number) {
180
- const config = {
181
- headers: {
182
- "Content-Type": "application/zip",
183
- "Content-Length": size + "",
184
- },
185
- };
186
-
187
- try {
188
- const res = await axios.put(uploadUrl, file, config);
189
- return res.status === 200;
190
- } catch (err) {
191
- console.log(err);
192
- return false;
193
- }
194
- }
195
-
196
- async function buildTheme() {
197
- try {
198
- const config = await getStorefrontConfig();
199
- const response = await fetch(process.env.NEXT_PUBLIC_UPLOAD_GQL_URL!, {
200
- method: "POST",
201
- body: JSON.stringify({
202
- query: /* GraphQL */ `
203
- mutation buildTheme($buildThemeThemeId: String!) {
204
- buildTheme(themeId: $buildThemeThemeId)
205
- }
206
- `,
207
- variables: {
208
- buildThemeThemeId: config.themeId,
209
- },
210
- }),
211
- headers: {
212
- "x-api-key": config.apiKey,
213
- "Content-Type": "application/json",
214
- },
215
- });
216
- const responseJSON = await response.json();
217
- console.log(responseJSON);
218
- } catch (err) {
219
- console.log(err);
220
- }
221
- }
222
-
223
- function getTheme(): Promise<any> {
224
- return new Promise((resolve, reject) => {
225
- const themePath = path.join(process.cwd(), "src", "theme.json");
226
- fs.readFile(themePath, function (err, file) {
227
- if (err) {
228
- return reject(err);
229
- }
230
- resolve(JSON.parse(file.toString()));
231
- });
232
- });
233
- }
234
-
235
- function getStorefrontConfig(): Promise<Record<string, any>> {
236
- return new Promise((resolve, reject) => {
237
- const themePath = path.join(process.cwd(), "config.json");
238
- fs.readFile(themePath, function (err, file) {
239
- if (err) {
240
- return reject(err);
241
- }
242
- resolve(JSON.parse(file.toString()));
243
- });
244
- });
245
- }
246
-
247
- function deleteThemeZip(zipDir: string) {
248
- fs.unlinkSync(zipDir);
249
- }
250
-
251
- function readLocalizationFiles(): Promise<Record<string, any>> {
252
- return new Promise((resolve, reject) => {
253
- const localesPath = path.join(process.cwd(), "public", "locales");
254
- const stripExtension = (path: string) =>
255
- path.length ? path.split(".")[0] : path;
256
-
257
- fs.readdir(localesPath, function (err, files) {
258
- if (err) {
259
- return reject(err);
260
- }
261
-
262
- const localeDirs = files.filter((file) =>
263
- fs.lstatSync(path.join(localesPath, file)).isDirectory()
264
- );
265
-
266
- const locales: Record<string, any> = {};
267
- let hasError = false;
268
-
269
- localeDirs.forEach((locale) => {
270
- const localeDirPath = path.join(
271
- process.cwd(),
272
- "public",
273
- "locales",
274
- locale
275
- );
276
-
277
- locales[locale] = {};
278
-
279
- try {
280
- const localeFiles = fs.readdirSync(localeDirPath);
281
- localeFiles.forEach((localeFile) => {
282
- const file = fs.readFileSync(
283
- path.join(process.cwd(), "public", "locales", locale, localeFile)
284
- );
285
-
286
- const strippedLocale = stripExtension(locale).toLowerCase();
287
- const namespace = stripExtension(localeFile).toLowerCase();
288
-
289
- locales[strippedLocale][namespace] = JSON.parse(file.toString());
290
-
291
- if (strippedLocale === "tr") {
292
- locales[strippedLocale]["checkout-page"] = CheckoutTR;
293
- } else {
294
- locales[strippedLocale]["checkout-page"] = CheckoutEN;
295
- }
296
- });
297
- } catch (err) {
298
- console.error(err);
299
- hasError = true;
300
- }
301
- });
302
-
303
- if (hasError) reject(null);
304
- else resolve(locales);
305
- });
306
- });
307
- }
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
- };