@syzy/apphost 1.0.15 → 1.0.17
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/dist/App.d.ts +2 -2
- package/dist/App.js +6 -69
- package/dist/api/mapping-api.js +6 -6
- package/dist/components/Home/Home.js +9 -10
- package/dist/components/Login/Login.js +2 -5
- package/dist/components/Mappings/ComponentMapping/ComponentRoleMapping.js +12 -7
- package/dist/components/Mappings/MappingForm/MappingForm.js +0 -1
- package/dist/config/EnvConfig.d.ts +6 -4
- package/dist/config/EnvConfig.js +6 -4
- package/dist/index.css +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -2
- package/package.json +1 -1
- package/dist/AppHostProvider.d.ts +0 -6
- package/dist/AppHostProvider.js +0 -4
- package/dist/components/NavBar/Sidebar.d.ts +0 -4
- package/dist/components/NavBar/Sidebar.js +0 -56
- package/dist/components/ProfileForm/ProfileForm.d.ts +0 -3
- package/dist/components/ProfileForm/ProfileForm.js +0 -190
- package/dist/components/ProfileForm/ProfileList.d.ts +0 -3
- package/dist/components/ProfileForm/ProfileList.js +0 -33
- package/dist/components/ProfileForm/profileColumns.d.ts +0 -3
- package/dist/components/ProfileForm/profileColumns.js +0 -67
- package/dist/components/ProfileForm/profileSchema.d.ts +0 -52
- package/dist/components/ProfileForm/profileSchema.js +0 -50
- package/dist/components/SettingsPage/SettingsPage.d.ts +0 -3
- package/dist/components/SettingsPage/SettingsPage.js +0 -240
- package/dist/components/api/settings-api.d.ts +0 -26
- package/dist/components/api/settings-api.js +0 -131
- package/dist/config/amplifyConfig.d.ts +0 -1
- package/dist/config/amplifyConfig.js +0 -45
- package/dist/configureAppHost.d.ts +0 -6
- package/dist/configureAppHost.js +0 -5
- package/dist/hoc/withSyzyAuth.d.ts +0 -2
- package/dist/hoc/withSyzyAuth.js +0 -87
- package/dist/hooks/useCurrentUser.d.ts +0 -3
- package/dist/hooks/useCurrentUser.js +0 -6
- package/dist/hooks/useDispatch.d.ts +0 -3
- package/dist/hooks/useDispatch.js +0 -7
- package/dist/hooks/usePermission.d.ts +0 -1
- package/dist/hooks/usePermission.js +0 -7
- package/dist/services/Storage-service.d.ts +0 -2
- package/dist/services/Storage-service.js +0 -26
- package/dist/services/navigationMenu.d.ts +0 -1
- package/dist/services/navigationMenu.js +0 -9
- package/dist/store/AppAction.d.ts +0 -11
- package/dist/store/AppAction.js +0 -5
- package/dist/store/AppContext.d.ts +0 -3
- package/dist/store/AppContext.js +0 -3
- package/dist/store/AppContextType.d.ts +0 -12
- package/dist/store/AppContextType.js +0 -6
- package/dist/store/AppProvider.d.ts +0 -7
- package/dist/store/AppProvider.js +0 -32
- package/dist/store/HostedInContainerContext.d.ts +0 -5
- package/dist/store/HostedInContainerContext.js +0 -11
- package/dist/store/SesssionReducer.d.ts +0 -4
- package/dist/store/SesssionReducer.js +0 -16
- package/dist/types.d.ts +0 -26
- package/dist/types.js +0 -14
package/dist/store/AppAction.js
DELETED
package/dist/store/AppContext.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { AppAction } from "./AppAction";
|
|
2
|
-
export interface AppSession {
|
|
3
|
-
userName: string;
|
|
4
|
-
branchId?: string;
|
|
5
|
-
roles: string[];
|
|
6
|
-
allowedComponents?: string[];
|
|
7
|
-
}
|
|
8
|
-
export declare const defaultSession: AppSession;
|
|
9
|
-
export interface AppContextProps {
|
|
10
|
-
user: AppSession;
|
|
11
|
-
dispatch: React.Dispatch<AppAction>;
|
|
12
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { defaultSession } from "./AppContextType";
|
|
3
|
-
import AppContext from "./AppContext";
|
|
4
|
-
import { ToastContainer } from 'react-toastify';
|
|
5
|
-
import 'react-toastify/dist/ReactToastify.css';
|
|
6
|
-
import { AppActionEnum } from "./AppAction";
|
|
7
|
-
import { sessionStorage } from "aws-amplify/utils";
|
|
8
|
-
import { APPHOSTSESSION_KEY, useSessionReducer } from "./SesssionReducer";
|
|
9
|
-
import { logger } from "../util/Logger";
|
|
10
|
-
const appContextReducer = (state, action) => {
|
|
11
|
-
logger.debug("Action:", action);
|
|
12
|
-
let newState = state;
|
|
13
|
-
switch (action.type) {
|
|
14
|
-
case AppActionEnum.SignIn:
|
|
15
|
-
newState = {
|
|
16
|
-
...action.session,
|
|
17
|
-
};
|
|
18
|
-
break;
|
|
19
|
-
case AppActionEnum.SignOut:
|
|
20
|
-
newState = { ...defaultSession };
|
|
21
|
-
sessionStorage.clear();
|
|
22
|
-
break;
|
|
23
|
-
default:
|
|
24
|
-
newState = state;
|
|
25
|
-
}
|
|
26
|
-
return newState;
|
|
27
|
-
};
|
|
28
|
-
const AppProvider = ({ children }) => {
|
|
29
|
-
const [state, dispatch] = useSessionReducer(appContextReducer, defaultSession, APPHOSTSESSION_KEY);
|
|
30
|
-
return (_jsxs(_Fragment, { children: [_jsx(ToastContainer, { position: "top-right", autoClose: 5000 }), _jsx(AppContext.Provider, { value: { user: state, dispatch }, children: children })] }));
|
|
31
|
-
};
|
|
32
|
-
export default AppProvider;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, useContext } from 'react';
|
|
3
|
-
const HostedInContainerContext = createContext(false);
|
|
4
|
-
export const HostedInContainerProvider = ({ children }) => {
|
|
5
|
-
const isHosted = (() => {
|
|
6
|
-
const urlParams = new URLSearchParams(window.location.search);
|
|
7
|
-
return urlParams.get('hosted_in_container') === 'true';
|
|
8
|
-
})();
|
|
9
|
-
return (_jsx(HostedInContainerContext.Provider, { value: isHosted, children: children }));
|
|
10
|
-
};
|
|
11
|
-
export const useHostedInContainer = () => useContext(HostedInContainerContext);
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { Reducer, Dispatch } from 'react';
|
|
2
|
-
import { AppSession } from './AppContextType';
|
|
3
|
-
export declare const APPHOSTSESSION_KEY = "AppHostSession";
|
|
4
|
-
export declare const useSessionReducer: <T extends AppSession, A>(reducer: Reducer<T, A>, initialState: T, storageKey: string) => [T, Dispatch<A>];
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { useReducer, useEffect } from 'react';
|
|
2
|
-
export const APPHOSTSESSION_KEY = 'AppHostSession';
|
|
3
|
-
export const useSessionReducer = (reducer, initialState, storageKey) => {
|
|
4
|
-
const [state, dispatch] = useReducer(reducer, initialState, () => {
|
|
5
|
-
const value = localStorage.getItem(storageKey); // use storageKey here
|
|
6
|
-
let retState = { ...initialState };
|
|
7
|
-
if (value) {
|
|
8
|
-
retState = JSON.parse(value);
|
|
9
|
-
}
|
|
10
|
-
return retState;
|
|
11
|
-
});
|
|
12
|
-
useEffect(() => {
|
|
13
|
-
localStorage.setItem(storageKey, JSON.stringify(state)); // same key
|
|
14
|
-
}, [storageKey, state]);
|
|
15
|
-
return [state, dispatch];
|
|
16
|
-
};
|
package/dist/types.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export interface Route {
|
|
2
|
-
path: string;
|
|
3
|
-
component: React.ComponentType<any>;
|
|
4
|
-
title: string;
|
|
5
|
-
requiredComponent?: string;
|
|
6
|
-
exact?: boolean;
|
|
7
|
-
acl?: {
|
|
8
|
-
[key in Role]: {
|
|
9
|
-
type: DecisionType;
|
|
10
|
-
meta?: string;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
props?: any;
|
|
14
|
-
}
|
|
15
|
-
export declare enum Role {
|
|
16
|
-
GUEST = "GUEST",
|
|
17
|
-
MEMBER = "MEMBER",
|
|
18
|
-
CHAPTERADMIN = "CHAPTERADMIN",
|
|
19
|
-
SUPPORTADMIN = "SUPPORTADMIN",
|
|
20
|
-
SUPERADMIN = "SUPERADMIN"
|
|
21
|
-
}
|
|
22
|
-
export declare enum DecisionType {
|
|
23
|
-
ALLOW = "allow",
|
|
24
|
-
DENY = "deny",
|
|
25
|
-
REDIRECT = "redirect"
|
|
26
|
-
}
|
package/dist/types.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export var Role;
|
|
2
|
-
(function (Role) {
|
|
3
|
-
Role["GUEST"] = "GUEST";
|
|
4
|
-
Role["MEMBER"] = "MEMBER";
|
|
5
|
-
Role["CHAPTERADMIN"] = "CHAPTERADMIN";
|
|
6
|
-
Role["SUPPORTADMIN"] = "SUPPORTADMIN";
|
|
7
|
-
Role["SUPERADMIN"] = "SUPERADMIN";
|
|
8
|
-
})(Role || (Role = {}));
|
|
9
|
-
export var DecisionType;
|
|
10
|
-
(function (DecisionType) {
|
|
11
|
-
DecisionType["ALLOW"] = "allow";
|
|
12
|
-
DecisionType["DENY"] = "deny";
|
|
13
|
-
DecisionType["REDIRECT"] = "redirect";
|
|
14
|
-
})(DecisionType || (DecisionType = {}));
|