@velocitycareerlabs/velocity-registrar-app 1.25.0-dev-build.12dfdbbae
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/.env.dev +8 -0
- package/.env.dev.local +9 -0
- package/.env.dev.remote +8 -0
- package/.env.dev.remoteauth +8 -0
- package/.env.full_localdev +9 -0
- package/.env.localdev +9 -0
- package/.env.prod +9 -0
- package/.env.qa +9 -0
- package/.env.staging +9 -0
- package/.eslintrc.js +30 -0
- package/.prettierrc.js +24 -0
- package/LICENSE +248 -0
- package/README.md +130 -0
- package/index.html +32 -0
- package/package.json +64 -0
- package/public/favicon.ico +0 -0
- package/public/favicon.png +0 -0
- package/public/manifest.json +15 -0
- package/src/App.jsx +124 -0
- package/src/AuthProviderBridge.jsx +85 -0
- package/src/ConfigLoader.jsx +23 -0
- package/src/config.js +28 -0
- package/src/fonts/Inter-Regular.ttf +0 -0
- package/src/fonts/Inter-VariableFont_slnt,wght.ttf +0 -0
- package/src/fonts/inter-v12-latin-300.eot +0 -0
- package/src/fonts/inter-v12-latin-300.svg +350 -0
- package/src/fonts/inter-v12-latin-300.ttf +0 -0
- package/src/fonts/inter-v12-latin-300.woff +0 -0
- package/src/fonts/inter-v12-latin-300.woff2 +0 -0
- package/src/fonts/inter-v12-latin-500.eot +0 -0
- package/src/fonts/inter-v12-latin-500.svg +351 -0
- package/src/fonts/inter-v12-latin-500.ttf +0 -0
- package/src/fonts/inter-v12-latin-500.woff +0 -0
- package/src/fonts/inter-v12-latin-500.woff2 +0 -0
- package/src/fonts/inter-v12-latin-600.eot +0 -0
- package/src/fonts/inter-v12-latin-600.svg +351 -0
- package/src/fonts/inter-v12-latin-600.ttf +0 -0
- package/src/fonts/inter-v12-latin-600.woff +0 -0
- package/src/fonts/inter-v12-latin-600.woff2 +0 -0
- package/src/fonts/inter-v12-latin-regular.eot +0 -0
- package/src/fonts/inter-v12-latin-regular.svg +351 -0
- package/src/fonts/inter-v12-latin-regular.ttf +0 -0
- package/src/fonts/inter-v12-latin-regular.woff +0 -0
- package/src/fonts/inter-v12-latin-regular.woff2 +0 -0
- package/src/index.css +60 -0
- package/src/main.jsx +35 -0
- package/vite.config.js +31 -0
package/src/App.jsx
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Velocity Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { Route, useLocation, useNavigate } from 'react-router-dom';
|
|
19
|
+
import { CustomRoutes, Resource } from 'react-admin';
|
|
20
|
+
import React from 'react';
|
|
21
|
+
import { Auth0Provider } from '@auth0/auth0-react';
|
|
22
|
+
import OrganizationIcon from '@mui/icons-material/Business';
|
|
23
|
+
import {
|
|
24
|
+
OrganizationShow,
|
|
25
|
+
OrganizationEdit,
|
|
26
|
+
OrganizationCreate,
|
|
27
|
+
} from '@velocitycareerlabs/components-organizations-registrar/pages/organizations';
|
|
28
|
+
import {
|
|
29
|
+
IndividualsDashboard,
|
|
30
|
+
IndividualsShow,
|
|
31
|
+
IndividualsEdit,
|
|
32
|
+
} from '@velocitycareerlabs/components-organizations-registrar/pages/individuals';
|
|
33
|
+
import { ServicesList } from '@velocitycareerlabs/components-organizations-registrar/pages/services';
|
|
34
|
+
import {
|
|
35
|
+
CreateOrganisationFromInvitation,
|
|
36
|
+
InvitationsList,
|
|
37
|
+
} from '@velocitycareerlabs/components-organizations-registrar/pages/invitations';
|
|
38
|
+
import {
|
|
39
|
+
PrivacyPolicy,
|
|
40
|
+
TermsAndConditions,
|
|
41
|
+
SignatoryLanding,
|
|
42
|
+
} from '@velocitycareerlabs/components-organizations-registrar/pages';
|
|
43
|
+
import { Dashboard } from '@velocitycareerlabs/components-organizations-registrar/components';
|
|
44
|
+
import {
|
|
45
|
+
defaultOAuthScopes,
|
|
46
|
+
registrarApiScopes,
|
|
47
|
+
PublicAppRoot,
|
|
48
|
+
PrivateAppRoot,
|
|
49
|
+
useConfig,
|
|
50
|
+
} from '@velocitycareerlabs/components-organizations-registrar';
|
|
51
|
+
import { AuthProviderBridge } from './AuthProviderBridge.jsx';
|
|
52
|
+
|
|
53
|
+
const PublicRoutes = ['/privacy-policy', '/terms-and-conditions', /^\/signatories\/[^/]+$/];
|
|
54
|
+
|
|
55
|
+
const isPublicRoute = (pathname) =>
|
|
56
|
+
PublicRoutes.some((route) =>
|
|
57
|
+
typeof route === 'string' ? route === pathname : route.test(pathname),
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
const App = () => {
|
|
61
|
+
const location = useLocation();
|
|
62
|
+
if (isPublicRoute(location.pathname)) {
|
|
63
|
+
return (
|
|
64
|
+
<PublicAppRoot>
|
|
65
|
+
<Route path="/privacy-policy" element={<PrivacyPolicy />} />
|
|
66
|
+
<Route path="/terms-and-conditions" element={<TermsAndConditions />} />
|
|
67
|
+
<Route path="/signatories/:response" element={<SignatoryLanding />} />
|
|
68
|
+
</PublicAppRoot>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return <PrivateRegistrarApp />;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const PrivateRegistrarApp = () => {
|
|
76
|
+
const config = useConfig();
|
|
77
|
+
const navigate = useNavigate();
|
|
78
|
+
const onRedirectCallback = (appState) => {
|
|
79
|
+
navigate(appState?.returnTo || window.location.pathname);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<Auth0Provider
|
|
84
|
+
domain={config.authConfig.domain}
|
|
85
|
+
clientId={config.authConfig.clientId}
|
|
86
|
+
useRefreshTokens
|
|
87
|
+
cacheLocation="localstorage"
|
|
88
|
+
onRedirectCallback={onRedirectCallback}
|
|
89
|
+
authorizationParams={{
|
|
90
|
+
audience: config.authConfig.audience,
|
|
91
|
+
scope: `${registrarApiScopes} ${defaultOAuthScopes}`,
|
|
92
|
+
redirect_uri: config.authConfig.redirectUri,
|
|
93
|
+
connection: config.authConfig.connection,
|
|
94
|
+
}}
|
|
95
|
+
>
|
|
96
|
+
<AuthProviderBridge config={config}>
|
|
97
|
+
<PrivateAppRoot>
|
|
98
|
+
<Resource
|
|
99
|
+
name="organizations"
|
|
100
|
+
icon={OrganizationIcon}
|
|
101
|
+
show={OrganizationShow}
|
|
102
|
+
list={Dashboard}
|
|
103
|
+
edit={OrganizationEdit}
|
|
104
|
+
create={OrganizationCreate}
|
|
105
|
+
/>
|
|
106
|
+
<Resource
|
|
107
|
+
name="individuals"
|
|
108
|
+
list={IndividualsDashboard}
|
|
109
|
+
show={IndividualsShow}
|
|
110
|
+
edit={IndividualsEdit}
|
|
111
|
+
/>
|
|
112
|
+
<Resource name="services" list={ServicesList} create={ServicesList} />
|
|
113
|
+
<Resource name="users" />
|
|
114
|
+
<Resource name="invitations" list={InvitationsList} create={InvitationsList} />
|
|
115
|
+
<CustomRoutes noLayout>
|
|
116
|
+
<Route exact path="/invitations/:code" element={<CreateOrganisationFromInvitation />} />
|
|
117
|
+
</CustomRoutes>
|
|
118
|
+
</PrivateAppRoot>
|
|
119
|
+
</AuthProviderBridge>
|
|
120
|
+
</Auth0Provider>
|
|
121
|
+
);
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
export default App;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Velocity Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
import React, { useMemo } from 'react';
|
|
18
|
+
import {
|
|
19
|
+
AuthContext,
|
|
20
|
+
registrarApiScopes,
|
|
21
|
+
} from '@velocitycareerlabs/components-organizations-registrar';
|
|
22
|
+
import { useAuth0 } from '@auth0/auth0-react';
|
|
23
|
+
|
|
24
|
+
/* eslint-disable react/prop-types */
|
|
25
|
+
export const AuthProviderBridge = ({ config: { authConfig }, children }) => {
|
|
26
|
+
const {
|
|
27
|
+
user,
|
|
28
|
+
isAuthenticated,
|
|
29
|
+
isLoading,
|
|
30
|
+
loginWithRedirect,
|
|
31
|
+
logout,
|
|
32
|
+
getAccessTokenSilently,
|
|
33
|
+
getAccessTokenWithPopup,
|
|
34
|
+
} = useAuth0();
|
|
35
|
+
|
|
36
|
+
const auth = useMemo(() => {
|
|
37
|
+
const defaultAccessTokenOptions = {
|
|
38
|
+
audience: authConfig.audience,
|
|
39
|
+
scope: registrarApiScopes,
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
user,
|
|
44
|
+
isLoading,
|
|
45
|
+
isAuthenticated,
|
|
46
|
+
login: (...args) => loginWithRedirect(...args),
|
|
47
|
+
logout: () =>
|
|
48
|
+
logout({
|
|
49
|
+
clientId: authConfig.clientId,
|
|
50
|
+
logoutParams: {
|
|
51
|
+
federated: true,
|
|
52
|
+
returnTo: window.location.origin,
|
|
53
|
+
},
|
|
54
|
+
}),
|
|
55
|
+
getAccessToken: (options = defaultAccessTokenOptions) => {
|
|
56
|
+
try {
|
|
57
|
+
return getAccessTokenSilently(options);
|
|
58
|
+
} catch (e) {
|
|
59
|
+
console.error(e);
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
getAccessTokenWithPopup: (options = defaultAccessTokenOptions) => {
|
|
64
|
+
try {
|
|
65
|
+
return getAccessTokenWithPopup(options);
|
|
66
|
+
} catch (e) {
|
|
67
|
+
console.error(e);
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
}, [
|
|
73
|
+
user,
|
|
74
|
+
isLoading,
|
|
75
|
+
isAuthenticated,
|
|
76
|
+
loginWithRedirect,
|
|
77
|
+
logout,
|
|
78
|
+
getAccessTokenSilently,
|
|
79
|
+
getAccessTokenWithPopup,
|
|
80
|
+
authConfig,
|
|
81
|
+
]);
|
|
82
|
+
/* eslint-enable */
|
|
83
|
+
|
|
84
|
+
return <AuthContext.Provider value={auth}>{children}</AuthContext.Provider>;
|
|
85
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Velocity Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
import React from 'react';
|
|
18
|
+
import { ConfigContext } from '@velocitycareerlabs/components-organizations-registrar';
|
|
19
|
+
|
|
20
|
+
// eslint-disable-next-line react/prop-types
|
|
21
|
+
export const ConfigLoader = ({ config, children }) => (
|
|
22
|
+
<ConfigContext.Provider value={config}>{children}</ConfigContext.Provider>
|
|
23
|
+
);
|
package/src/config.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023 Velocity Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export default {
|
|
18
|
+
authConfig: {
|
|
19
|
+
domain: import.meta.env.VITE_REGISTRAR_AUTH0_DOMAIN,
|
|
20
|
+
clientId: import.meta.env.VITE_REGISTRAR_AUTH0_CLIENT_ID,
|
|
21
|
+
redirectUri: import.meta.env.VITE_REGISTRAR_AUTH0_REDIRECT_URI,
|
|
22
|
+
audience: import.meta.env.VITE_REGISTRAR_AUDIENCE,
|
|
23
|
+
connection: import.meta.env.VITE_REGISTRAR_CONNECTION,
|
|
24
|
+
},
|
|
25
|
+
registrarApi: import.meta.env.VITE_REGISTRAR_API,
|
|
26
|
+
xAutoActivate: import.meta.env.VITE_X_AUTO_ACTIVATE === 'true',
|
|
27
|
+
chainName: import.meta.env.VITE_CHAIN_NAME || 'Devnet',
|
|
28
|
+
};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|