@ikas/storefront-next 4.0.0-alpha.10
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 +59 -0
- package/src/api/getComponentDirs.ts +39 -0
- package/src/api/getTheme.ts +22 -0
- package/src/api/index.ts +14 -0
- package/src/api/middleware.ts +24 -0
- package/src/api/updateTheme.ts +33 -0
- package/src/api/uploadTheme.ts +307 -0
- package/src/index.ts +4 -0
- package/src/pages/404.tsx +18 -0
- package/src/pages/[slug]/index.tsx +18 -0
- package/src/pages/account/addresses.tsx +10 -0
- package/src/pages/account/favorite-products.tsx +10 -0
- package/src/pages/account/forgot-password.tsx +10 -0
- package/src/pages/account/index.tsx +10 -0
- package/src/pages/account/login.tsx +10 -0
- package/src/pages/account/orders/[id].tsx +10 -0
- package/src/pages/account/orders/index.tsx +10 -0
- package/src/pages/account/raffles.tsx +10 -0
- package/src/pages/account/recover-password.tsx +10 -0
- package/src/pages/account/register.tsx +10 -0
- package/src/pages/blog/[slug].tsx +17 -0
- package/src/pages/blog/index.tsx +10 -0
- package/src/pages/cart.tsx +10 -0
- package/src/pages/checkout.tsx +10 -0
- package/src/pages/editor.tsx +11 -0
- package/src/pages/home.tsx +10 -0
- package/src/pages/index.ts +22 -0
- package/src/pages/pages/[slug].tsx +72 -0
- package/src/pages/raffle/[slug].tsx +17 -0
- package/src/pages/raffle/index.tsx +10 -0
- package/src/pages/search.tsx +10 -0
- package/src/provider/page-data-next.ts +618 -0
- package/src/utils/fs.ts +93 -0
- package/src/utils/google-fonts.ts +52 -0
- package/src/utils/i18n.ts +80 -0
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export * as IndexPage from "./home";
|
|
2
|
+
export * as SlugPage from "./[slug]";
|
|
3
|
+
export * as CustomPage from "./pages/[slug]";
|
|
4
|
+
export * as CheckoutPage from "./checkout";
|
|
5
|
+
export * as AccountPage from "./account/index";
|
|
6
|
+
export * as AddressesPage from "./account/addresses";
|
|
7
|
+
export * as OrdersPage from "./account/orders";
|
|
8
|
+
export * as OrderDetailPage from "./account/orders/[id]";
|
|
9
|
+
export * as LoginPage from "./account/login";
|
|
10
|
+
export * as RegisterPage from "./account/register";
|
|
11
|
+
export * as ForgotPasswordPage from "./account/forgot-password";
|
|
12
|
+
export * as RecoverPasswordPage from "./account/recover-password";
|
|
13
|
+
export * as CartPage from "./cart";
|
|
14
|
+
export * as EditorPage from "./editor";
|
|
15
|
+
export * as FavoriteProductsPage from "./account/favorite-products";
|
|
16
|
+
export * as SearchPage from "./search";
|
|
17
|
+
export * as NotFoundPage from "./404";
|
|
18
|
+
export * as BlogPage from "./blog";
|
|
19
|
+
export * as BlogSlugPage from "./blog/[slug]";
|
|
20
|
+
export * as RafflePage from "./raffle/[slug]";
|
|
21
|
+
export * as RafflesPage from "./raffle/index";
|
|
22
|
+
export * as AccountRafflesPage from "./account/raffles";
|
|
@@ -0,0 +1,72 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
};
|