@ludo.ninja/components 2.1.0 → 2.1.2

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.
@@ -0,0 +1,2 @@
1
+ declare const Page404: () => import("react/jsx-runtime").JSX.Element;
2
+ export default Page404;
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const jsx_runtime_1 = require("react/jsx-runtime");
7
+ const router_1 = require("next/router");
8
+ const styled_components_1 = __importDefault(require("styled-components"));
9
+ const _404_svg_1 = __importDefault(require("../../public/404/404"));
10
+ const colors_1 = require("@ludo.ninja/ui/build/styles/colors");
11
+ const ScreenWidth_1 = require("../../styles/ScreenWidth");
12
+ const mainLayout_1 = __importDefault(require("../../layouts/custom/mainLayout"));
13
+ const MainButton_1 = __importDefault(require("../../system/Buttons/MainButton"));
14
+ const index_1 = require("../../system/index");
15
+ const ludoDomains_1 = require("@ludo.ninja/core/build/ludoDomains");
16
+ const env_1 = require("../../store/env");
17
+ // Styles
18
+ const StyledNotFoundPage = styled_components_1.default.div `
19
+ .notFoundContent {
20
+ .notFoundCaption {
21
+ font-weight: 700;
22
+ font-size: 3.8em;
23
+ line-height: 1.37em;
24
+ color: ${colors_1.TextGrayColor};
25
+ margin-bottom: 0;
26
+ }
27
+
28
+ .notFoundIcon {
29
+ width: 337px;
30
+ height: 329px;
31
+ }
32
+
33
+ ${ScreenWidth_1.mediaQuery.tablet} {
34
+ flex-direction: column-reverse;
35
+
36
+ .notFoundText {
37
+ margin: 40px 0 0 0;
38
+ text-align: center;
39
+ }
40
+
41
+ .notFoundIcon {
42
+ width: 286px;
43
+ height: 280px;
44
+ }
45
+
46
+ .notFoundCaption {
47
+ font-size: 3em;
48
+ line-height: 1.6em;
49
+ }
50
+ }
51
+
52
+ ${ScreenWidth_1.mediaQuery.phone} {
53
+ .notFoundIcon {
54
+ width: 218px;
55
+ height: 212px;
56
+ }
57
+ }
58
+ }
59
+ `;
60
+ // Component
61
+ const Page404 = () => {
62
+ const router = (0, router_1.useRouter)();
63
+ const NEXT_PUBLIC_ENV_VALUE = (0, env_1.useEnvStore)((state) => state.NEXT_PUBLIC_ENV_VALUE);
64
+ const redirectToHomePage = () => {
65
+ const appDomain = ludoDomains_1.ludoDomains[NEXT_PUBLIC_ENV_VALUE]["app"];
66
+ if (window.origin === appDomain) {
67
+ router.push("/");
68
+ }
69
+ else {
70
+ window.open(appDomain);
71
+ }
72
+ };
73
+ return ((0, jsx_runtime_1.jsx)(mainLayout_1.default, { children: (0, jsx_runtime_1.jsx)(StyledNotFoundPage, { children: (0, jsx_runtime_1.jsxs)(index_1.Flex, { className: "notFoundContent", justifyContent: "center", alignItems: "center", children: [(0, jsx_runtime_1.jsxs)(index_1.Box, { mr: 140, className: "notFoundText", children: [(0, jsx_runtime_1.jsxs)("h1", { className: "notFoundCaption", children: ["Whoops! ", (0, jsx_runtime_1.jsx)("br", {}), " No results found"] }), (0, jsx_runtime_1.jsx)(index_1.Box, { mt: "36px", children: (0, jsx_runtime_1.jsx)(MainButton_1.default, { onClick: redirectToHomePage, variant: "primaryL", text: "Go to Main page" }) })] }), (0, jsx_runtime_1.jsx)(index_1.Box, { children: (0, jsx_runtime_1.jsx)("div", { className: "notFoundIcon", children: (0, jsx_runtime_1.jsx)(_404_svg_1.default, {}) }) })] }) }) }));
74
+ };
75
+ exports.default = Page404;
@@ -0,0 +1,2 @@
1
+ declare const InternalErrorPage: () => import("react/jsx-runtime").JSX.Element;
2
+ export default InternalErrorPage;
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const jsx_runtime_1 = require("react/jsx-runtime");
7
+ const router_1 = require("next/router");
8
+ const styled_components_1 = __importDefault(require("styled-components"));
9
+ const index_1 = require("../../system/index");
10
+ const _500_svg_1 = __importDefault(require("../../public/500/500"));
11
+ const colors_1 = require("@ludo.ninja/ui/build/styles/colors");
12
+ const ScreenWidth_1 = require("../../styles/ScreenWidth");
13
+ const mainLayout_1 = __importDefault(require("../../layouts/custom/mainLayout"));
14
+ const MainButton_1 = __importDefault(require("../../system/Buttons/MainButton"));
15
+ const env_1 = require("../../store/env");
16
+ const ludoDomains_1 = require("@ludo.ninja/core/build/ludoDomains");
17
+ // Styles
18
+ const StyledInternalErrorPage = styled_components_1.default.div `
19
+ .internalErrorContent {
20
+ .internalErrorButton {
21
+ max-width: 230px;
22
+ }
23
+
24
+ .internalErrorCaption {
25
+ font-weight: 700;
26
+ font-size: 3.8em;
27
+ line-height: 1.37em;
28
+ color: ${colors_1.TextGrayColor};
29
+ margin-bottom: 0;
30
+ }
31
+
32
+ .internalErrorIcon {
33
+ width: 337px;
34
+ height: 329px;
35
+ }
36
+
37
+ ${ScreenWidth_1.mediaQuery.tablet} {
38
+ flex-direction: column-reverse;
39
+
40
+ .internalErrorText {
41
+ margin: 40px 0 0 0;
42
+ text-align: center;
43
+ }
44
+
45
+ .internalErrorIcon {
46
+ width: 286px;
47
+ height: 280px;
48
+ }
49
+
50
+ .internalErrorCaption {
51
+ font-size: 3em;
52
+ line-height: 1.6em;
53
+ }
54
+
55
+ .internalErrorButton {
56
+ margin: 30px auto 0 auto;
57
+ }
58
+ }
59
+
60
+ ${ScreenWidth_1.mediaQuery.phone} {
61
+ .internalErrorIcon {
62
+ width: 218px;
63
+ height: 212px;
64
+ }
65
+ }
66
+ }
67
+ `;
68
+ // Component
69
+ const InternalErrorPage = () => {
70
+ const router = (0, router_1.useRouter)();
71
+ const NEXT_PUBLIC_ENV_VALUE = (0, env_1.useEnvStore)((state) => state.NEXT_PUBLIC_ENV_VALUE);
72
+ const redirectToHomePage = () => {
73
+ const appDomain = ludoDomains_1.ludoDomains[NEXT_PUBLIC_ENV_VALUE]["app"];
74
+ if (window.origin === appDomain) {
75
+ router.push("/");
76
+ }
77
+ else {
78
+ window.open(appDomain);
79
+ }
80
+ };
81
+ return ((0, jsx_runtime_1.jsx)(mainLayout_1.default, { children: (0, jsx_runtime_1.jsx)(StyledInternalErrorPage, { children: (0, jsx_runtime_1.jsxs)(index_1.Flex, { className: "internalErrorContent", justifyContent: "center", alignItems: "center", children: [(0, jsx_runtime_1.jsxs)(index_1.Box, { mr: [97], className: "internalErrorText", children: [(0, jsx_runtime_1.jsx)("h1", { className: "internalErrorCaption", children: "Sorry, unexpected error." }), (0, jsx_runtime_1.jsxs)(index_1.H1, { color: colors_1.TextGrayColor, mt: [14], children: ["We are working on fixing the problem.", (0, jsx_runtime_1.jsx)("br", {}), " Please try again later"] }), (0, jsx_runtime_1.jsx)(index_1.Box, { className: "internalErrorButton", mt: [36], children: (0, jsx_runtime_1.jsx)(MainButton_1.default, { onClick: redirectToHomePage, variant: "primaryL", text: "Go to Main page" }) })] }), (0, jsx_runtime_1.jsx)(index_1.Box, { children: (0, jsx_runtime_1.jsx)("div", { className: "internalErrorIcon", children: (0, jsx_runtime_1.jsx)(_500_svg_1.default, {}) }) })] }) }) }));
82
+ };
83
+ exports.default = InternalErrorPage;
@@ -0,0 +1,6 @@
1
+ import { ReactNode } from "react";
2
+ import { AppProps } from "next/app";
3
+ export declare const AppLayout: ({ children, pageProps }: {
4
+ children: ReactNode;
5
+ pageProps: AppProps["pageProps"];
6
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.AppLayout = void 0;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const styled_components_1 = require("styled-components");
9
+ const browser_1 = __importDefault(require("@marker.io/browser"));
10
+ const utils_1 = require("@ludo.ninja/utils");
11
+ const react_1 = require("react");
12
+ const ui_1 = require("../store/ui");
13
+ const client_1 = require("@apollo/client");
14
+ const apollo_1 = require("../hooks/apollo");
15
+ const GlobalLayout_1 = require("./GlobalLayout");
16
+ const store_1 = require("../modules/user/store");
17
+ const index_1 = require("../store/index");
18
+ const env_1 = require("../store/env");
19
+ const AppLayout = ({ children, pageProps }) => {
20
+ const apolloClient = (0, apollo_1.useApollo)(pageProps);
21
+ const theme = (0, ui_1.useUiStore)((state) => state.theme);
22
+ const NODE_ENV = (0, env_1.useEnvStore)(state => state.NODE_ENV);
23
+ (0, react_1.useEffect)(() => {
24
+ if (!utils_1.isServer && NODE_ENV === "production") {
25
+ browser_1.default.loadWidget({ project: "65f2e310e9298c9dca4d4ca9" });
26
+ }
27
+ }, []);
28
+ return ((0, jsx_runtime_1.jsx)(index_1.SSRProvider, { initialState: {
29
+ isMobile: pageProps.isMobile,
30
+ }, children: (0, jsx_runtime_1.jsx)(client_1.ApolloProvider, { client: apolloClient, children: (0, jsx_runtime_1.jsx)(styled_components_1.ThemeProvider, { theme: theme, children: (0, jsx_runtime_1.jsx)(store_1.UserProvider, { initialState: {
31
+ user: pageProps.userData,
32
+ isSignedIn: !!pageProps.userData,
33
+ }, children: (0, jsx_runtime_1.jsx)(GlobalLayout_1.GlobalLayout, { children: children }) }) }) }) }));
34
+ };
35
+ exports.AppLayout = AppLayout;
@@ -9,9 +9,10 @@ const api_1 = require("@ludo.ninja/api");
9
9
  const env_1 = require("../../../store/env");
10
10
  const useRevokeToken_1 = __importDefault(require("../../../api/server-identities/mutations/useRevokeToken"));
11
11
  const store_1 = require("../store");
12
+ const ludoDomains_1 = require("@ludo.ninja/core/build/ludoDomains");
12
13
  const useSignOut = () => {
13
- const { NEXT_PUBLIC_WELCOME_HOST, NEXT_PUBLIC_ENV_DOMAIN } = (0, env_1.useEnvStore)((state) => ({
14
- NEXT_PUBLIC_WELCOME_HOST: state.NEXT_PUBLIC_WELCOME_HOST,
14
+ const { NEXT_PUBLIC_ENV_VALUE, NEXT_PUBLIC_ENV_DOMAIN } = (0, env_1.useEnvStore)((state) => ({
15
+ NEXT_PUBLIC_ENV_VALUE: state.NEXT_PUBLIC_ENV_VALUE,
15
16
  NEXT_PUBLIC_ENV_DOMAIN: state.NEXT_PUBLIC_ENV_DOMAIN,
16
17
  }));
17
18
  const { revokeToken } = (0, useRevokeToken_1.default)();
@@ -30,7 +31,7 @@ const useSignOut = () => {
30
31
  domain: NEXT_PUBLIC_ENV_DOMAIN,
31
32
  });
32
33
  setUser(null);
33
- window.location.replace(NEXT_PUBLIC_WELCOME_HOST);
34
+ window.location.replace(ludoDomains_1.ludoDomains[NEXT_PUBLIC_ENV_VALUE]["welcome"]);
34
35
  }
35
36
  };
36
37
  };
@@ -1,10 +1,7 @@
1
1
  interface IEnvStore {
2
2
  NODE_ENV: string;
3
3
  NEXT_PUBLIC_ENV_VALUE: string;
4
- NEXT_PUBLIC_AUTH_HOST: string;
5
- NEXT_PUBLIC_WELCOME_HOST: string;
6
4
  NEXT_PUBLIC_ENV_DOMAIN: string;
7
- NEXT_PUBLIC_SITE_URL: string;
8
5
  NEXT_PUBLIC_STATIC_DOMAIN: string;
9
6
  getStaticDomain: (env?: string) => string;
10
7
  getMediaDomain: (env?: string) => string;
@@ -5,10 +5,7 @@ const next_zustand_1 = require("next-zustand");
5
5
  const creators = (0, next_zustand_1.createProvider)()((setState, getState) => ({
6
6
  NODE_ENV: '',
7
7
  NEXT_PUBLIC_ENV_VALUE: '',
8
- NEXT_PUBLIC_AUTH_HOST: '',
9
- NEXT_PUBLIC_WELCOME_HOST: '',
10
8
  NEXT_PUBLIC_ENV_DOMAIN: '',
11
- NEXT_PUBLIC_SITE_URL: '',
12
9
  NEXT_PUBLIC_STATIC_DOMAIN: '',
13
10
  getStaticDomain: (env) => {
14
11
  const { NEXT_PUBLIC_STATIC_DOMAIN } = getState();
@@ -2,8 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useRedirectToLoginWindow = void 0;
4
4
  const env_1 = require("../../store/env");
5
+ const ludoDomains_1 = require("@ludo.ninja/core/build/ludoDomains");
5
6
  const useRedirectToLoginWindow = () => {
6
- const NEXT_PUBLIC_AUTH_HOST = (0, env_1.useEnvStore)((state) => state.NEXT_PUBLIC_AUTH_HOST);
7
- return () => window.open(`${NEXT_PUBLIC_AUTH_HOST}/login/?fallback_url=${window.location.href.replace(/\s/g, '')}`, '_self');
7
+ const NEXT_PUBLIC_ENV_VALUE = (0, env_1.useEnvStore)((state) => state.NEXT_PUBLIC_ENV_VALUE);
8
+ return () => window.open(`${ludoDomains_1.ludoDomains[NEXT_PUBLIC_ENV_VALUE]["welcome"]}/login/?fallback_url=${window.location.href.replace(/\s/g, "")}`, "_self");
8
9
  };
9
10
  exports.useRedirectToLoginWindow = useRedirectToLoginWindow;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ludo.ninja/components",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "private": false,
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",