@ludo.ninja/components 2.1.32 → 2.1.34
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/build/components/Page404/Page404SPA.d.ts +3 -0
- package/build/components/Page404/Page404SPA.js +61 -0
- package/build/components/Page404/index.js +3 -51
- package/build/hooks/apollo/index.d.ts +1 -2
- package/build/hooks/apollo/index.js +3 -3
- package/build/modules/user/auth/useAuthVerification.d.ts +0 -1
- package/build/modules/user/auth/useAuthVerification.js +3 -63
- package/build/modules/user/auth/useVerification.d.ts +1 -0
- package/build/modules/user/auth/useVerification.js +64 -0
- package/package.json +1 -1
|
@@ -0,0 +1,61 @@
|
|
|
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.Page404SPA = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
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 MainButton_1 = __importDefault(require("../../system/Buttons/MainButton"));
|
|
13
|
+
const index_1 = require("../../system/index");
|
|
14
|
+
// Styles
|
|
15
|
+
const StyledNotFoundPage = styled_components_1.default.div `
|
|
16
|
+
.notFoundContent {
|
|
17
|
+
.notFoundCaption {
|
|
18
|
+
font-weight: 700;
|
|
19
|
+
font-size: 3.8em;
|
|
20
|
+
line-height: 1.37em;
|
|
21
|
+
color: ${colors_1.TextGrayColor};
|
|
22
|
+
margin-bottom: 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.notFoundIcon {
|
|
26
|
+
width: 337px;
|
|
27
|
+
height: 329px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
${ScreenWidth_1.mediaQuery.tablet} {
|
|
31
|
+
flex-direction: column-reverse;
|
|
32
|
+
|
|
33
|
+
.notFoundText {
|
|
34
|
+
margin: 40px 0 0 0;
|
|
35
|
+
text-align: center;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.notFoundIcon {
|
|
39
|
+
width: 286px;
|
|
40
|
+
height: 280px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.notFoundCaption {
|
|
44
|
+
font-size: 3em;
|
|
45
|
+
line-height: 1.6em;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
${ScreenWidth_1.mediaQuery.phone} {
|
|
50
|
+
.notFoundIcon {
|
|
51
|
+
width: 218px;
|
|
52
|
+
height: 212px;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
`;
|
|
57
|
+
// Component
|
|
58
|
+
const Page404SPA = ({ redirectToHomePage }) => {
|
|
59
|
+
return ((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, {}) }) })] }) }));
|
|
60
|
+
};
|
|
61
|
+
exports.Page404SPA = Page404SPA;
|
|
@@ -5,58 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
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
8
|
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
9
|
const ludoDomains_1 = require("@ludo.ninja/core/build/ludoDomains");
|
|
16
10
|
const env_1 = require("../../store/env");
|
|
17
|
-
|
|
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
|
-
`;
|
|
11
|
+
const Page404SPA_1 = require("./Page404SPA");
|
|
60
12
|
// Component
|
|
61
13
|
const Page404 = () => {
|
|
62
14
|
const router = (0, router_1.useRouter)();
|
|
@@ -67,9 +19,9 @@ const Page404 = () => {
|
|
|
67
19
|
router.push("/");
|
|
68
20
|
}
|
|
69
21
|
else {
|
|
70
|
-
window.open(appDomain,
|
|
22
|
+
window.open(appDomain, "_self");
|
|
71
23
|
}
|
|
72
24
|
};
|
|
73
|
-
return ((0, jsx_runtime_1.jsx)(mainLayout_1.default, { children: (0, jsx_runtime_1.jsx)(
|
|
25
|
+
return ((0, jsx_runtime_1.jsx)(mainLayout_1.default, { children: (0, jsx_runtime_1.jsx)(Page404SPA_1.Page404SPA, { redirectToHomePage: redirectToHomePage }) }));
|
|
74
26
|
};
|
|
75
27
|
exports.default = Page404;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function useApollo(pageProps: AppProps["pageProps"]): import("@apollo/client").ApolloClient<import("@apollo/client").NormalizedCacheObject>;
|
|
1
|
+
export declare function useApollo(pageProps?: any): import("@apollo/client").ApolloClient<import("@apollo/client").NormalizedCacheObject>;
|
|
@@ -12,11 +12,11 @@ function useApollo(pageProps) {
|
|
|
12
12
|
NEXT_PUBLIC_ENV_VALUE: state.NEXT_PUBLIC_ENV_VALUE,
|
|
13
13
|
NEXT_PUBLIC_ENV_DOMAIN: state.NEXT_PUBLIC_ENV_DOMAIN,
|
|
14
14
|
}));
|
|
15
|
-
const state = pageProps[graphql_1.APOLLO_STATE_PROP_NAME];
|
|
15
|
+
const state = pageProps?.[graphql_1.APOLLO_STATE_PROP_NAME] || null;
|
|
16
16
|
return (0, react_1.useMemo)(() => api_1.graphqlConfig.createErrorAuthInterceptor(api_1.graphqlConfig.initializeApollo(state, NEXT_PUBLIC_ENV_DOMAIN), () => {
|
|
17
17
|
api_1.authCookies.destroyCookies(NEXT_PUBLIC_ENV_DOMAIN);
|
|
18
|
-
(0, nookies_1.destroyCookie)(null,
|
|
19
|
-
path:
|
|
18
|
+
(0, nookies_1.destroyCookie)(null, "authMultiversXWallet", {
|
|
19
|
+
path: "/",
|
|
20
20
|
domain: NEXT_PUBLIC_ENV_DOMAIN,
|
|
21
21
|
});
|
|
22
22
|
window.location.replace(`${ludoDomains_1.ludoDomains[NEXT_PUBLIC_ENV_VALUE]["welcome"]}?alertError=authServerError`);
|
|
@@ -1,72 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.useAuthVerification =
|
|
3
|
+
exports.useAuthVerification = void 0;
|
|
27
4
|
const react_1 = require("react");
|
|
28
5
|
const router_1 = require("next/router");
|
|
29
|
-
const
|
|
30
|
-
const useSignOut_1 = require("./useSignOut");
|
|
31
|
-
const useVerification = () => {
|
|
32
|
-
const signIn = (0, useSignIn_1.useSignIn)();
|
|
33
|
-
const signOut = (0, useSignOut_1.useSignOut)();
|
|
34
|
-
return async (currentLocation) => {
|
|
35
|
-
try {
|
|
36
|
-
const authCookies = await Promise.resolve().then(() => __importStar(require("@ludo.ninja/api/build/cookies"))); //update check version cookie in client
|
|
37
|
-
const authCookiesParsed = authCookies.getCookies();
|
|
38
|
-
if (authCookiesParsed.authToken &&
|
|
39
|
-
authCookiesParsed.wallets &&
|
|
40
|
-
authCookiesParsed.refreshToken &&
|
|
41
|
-
authCookiesParsed.newUser &&
|
|
42
|
-
authCookiesParsed.userId &&
|
|
43
|
-
authCookiesParsed.inviteCode &&
|
|
44
|
-
authCookiesParsed.role) {
|
|
45
|
-
signIn({
|
|
46
|
-
userId: authCookiesParsed.userId,
|
|
47
|
-
wallets: authCookiesParsed.wallets,
|
|
48
|
-
authToken: authCookiesParsed.authToken,
|
|
49
|
-
refreshToken: authCookiesParsed.refreshToken,
|
|
50
|
-
newUser: authCookiesParsed.newUser === "true",
|
|
51
|
-
inviteCode: authCookiesParsed.inviteCode,
|
|
52
|
-
role: authCookiesParsed.role,
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
if (currentLocation !== "/forms/[formId]") {
|
|
57
|
-
await signOut();
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
catch (e) {
|
|
62
|
-
// console.error('verification', e);
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
|
-
exports.useVerification = useVerification;
|
|
6
|
+
const useVerification_1 = require("./useVerification");
|
|
67
7
|
const useAuthVerification = () => {
|
|
68
8
|
const router = (0, router_1.useRouter)();
|
|
69
|
-
const verification = (0,
|
|
9
|
+
const verification = (0, useVerification_1.useVerification)();
|
|
70
10
|
(0, react_1.useEffect)(() => {
|
|
71
11
|
const authVerification = () => verification(router.pathname);
|
|
72
12
|
document.addEventListener("visibilitychange", authVerification);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useVerification: () => (currentLocation: string) => Promise<void>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.useVerification = void 0;
|
|
27
|
+
const useSignIn_1 = require("./useSignIn");
|
|
28
|
+
const useSignOut_1 = require("./useSignOut");
|
|
29
|
+
const useVerification = () => {
|
|
30
|
+
const signIn = (0, useSignIn_1.useSignIn)();
|
|
31
|
+
const signOut = (0, useSignOut_1.useSignOut)();
|
|
32
|
+
return async (currentLocation) => {
|
|
33
|
+
try {
|
|
34
|
+
const authCookies = await Promise.resolve().then(() => __importStar(require("@ludo.ninja/api/build/cookies"))); //update check version cookie in client
|
|
35
|
+
const authCookiesParsed = authCookies.getCookies();
|
|
36
|
+
if (authCookiesParsed.authToken &&
|
|
37
|
+
authCookiesParsed.wallets &&
|
|
38
|
+
authCookiesParsed.refreshToken &&
|
|
39
|
+
authCookiesParsed.newUser &&
|
|
40
|
+
authCookiesParsed.userId &&
|
|
41
|
+
authCookiesParsed.inviteCode &&
|
|
42
|
+
authCookiesParsed.role) {
|
|
43
|
+
signIn({
|
|
44
|
+
userId: authCookiesParsed.userId,
|
|
45
|
+
wallets: authCookiesParsed.wallets,
|
|
46
|
+
authToken: authCookiesParsed.authToken,
|
|
47
|
+
refreshToken: authCookiesParsed.refreshToken,
|
|
48
|
+
newUser: authCookiesParsed.newUser === "true",
|
|
49
|
+
inviteCode: authCookiesParsed.inviteCode,
|
|
50
|
+
role: authCookiesParsed.role,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
if (currentLocation !== "/forms/[formId]") {
|
|
55
|
+
await signOut();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
catch (e) {
|
|
60
|
+
// console.error('verification', e);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
exports.useVerification = useVerification;
|