@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.
Files changed (59) hide show
  1. package/dist/App.d.ts +2 -2
  2. package/dist/App.js +6 -69
  3. package/dist/api/mapping-api.js +6 -6
  4. package/dist/components/Home/Home.js +9 -10
  5. package/dist/components/Login/Login.js +2 -5
  6. package/dist/components/Mappings/ComponentMapping/ComponentRoleMapping.js +12 -7
  7. package/dist/components/Mappings/MappingForm/MappingForm.js +0 -1
  8. package/dist/config/EnvConfig.d.ts +6 -4
  9. package/dist/config/EnvConfig.js +6 -4
  10. package/dist/index.css +1 -1
  11. package/dist/index.d.ts +0 -2
  12. package/dist/index.js +0 -2
  13. package/package.json +1 -1
  14. package/dist/AppHostProvider.d.ts +0 -6
  15. package/dist/AppHostProvider.js +0 -4
  16. package/dist/components/NavBar/Sidebar.d.ts +0 -4
  17. package/dist/components/NavBar/Sidebar.js +0 -56
  18. package/dist/components/ProfileForm/ProfileForm.d.ts +0 -3
  19. package/dist/components/ProfileForm/ProfileForm.js +0 -190
  20. package/dist/components/ProfileForm/ProfileList.d.ts +0 -3
  21. package/dist/components/ProfileForm/ProfileList.js +0 -33
  22. package/dist/components/ProfileForm/profileColumns.d.ts +0 -3
  23. package/dist/components/ProfileForm/profileColumns.js +0 -67
  24. package/dist/components/ProfileForm/profileSchema.d.ts +0 -52
  25. package/dist/components/ProfileForm/profileSchema.js +0 -50
  26. package/dist/components/SettingsPage/SettingsPage.d.ts +0 -3
  27. package/dist/components/SettingsPage/SettingsPage.js +0 -240
  28. package/dist/components/api/settings-api.d.ts +0 -26
  29. package/dist/components/api/settings-api.js +0 -131
  30. package/dist/config/amplifyConfig.d.ts +0 -1
  31. package/dist/config/amplifyConfig.js +0 -45
  32. package/dist/configureAppHost.d.ts +0 -6
  33. package/dist/configureAppHost.js +0 -5
  34. package/dist/hoc/withSyzyAuth.d.ts +0 -2
  35. package/dist/hoc/withSyzyAuth.js +0 -87
  36. package/dist/hooks/useCurrentUser.d.ts +0 -3
  37. package/dist/hooks/useCurrentUser.js +0 -6
  38. package/dist/hooks/useDispatch.d.ts +0 -3
  39. package/dist/hooks/useDispatch.js +0 -7
  40. package/dist/hooks/usePermission.d.ts +0 -1
  41. package/dist/hooks/usePermission.js +0 -7
  42. package/dist/services/Storage-service.d.ts +0 -2
  43. package/dist/services/Storage-service.js +0 -26
  44. package/dist/services/navigationMenu.d.ts +0 -1
  45. package/dist/services/navigationMenu.js +0 -9
  46. package/dist/store/AppAction.d.ts +0 -11
  47. package/dist/store/AppAction.js +0 -5
  48. package/dist/store/AppContext.d.ts +0 -3
  49. package/dist/store/AppContext.js +0 -3
  50. package/dist/store/AppContextType.d.ts +0 -12
  51. package/dist/store/AppContextType.js +0 -6
  52. package/dist/store/AppProvider.d.ts +0 -7
  53. package/dist/store/AppProvider.js +0 -32
  54. package/dist/store/HostedInContainerContext.d.ts +0 -5
  55. package/dist/store/HostedInContainerContext.js +0 -11
  56. package/dist/store/SesssionReducer.d.ts +0 -4
  57. package/dist/store/SesssionReducer.js +0 -16
  58. package/dist/types.d.ts +0 -26
  59. package/dist/types.js +0 -14
@@ -1,11 +0,0 @@
1
- import { AppSession } from "./AppContextType";
2
- export declare enum AppActionEnum {
3
- SignIn = "SIGNIN",
4
- SignOut = "SIGNOUT"
5
- }
6
- export type AppAction = {
7
- type: AppActionEnum.SignIn;
8
- session: AppSession;
9
- } | {
10
- type: AppActionEnum.SignOut;
11
- };
@@ -1,5 +0,0 @@
1
- export var AppActionEnum;
2
- (function (AppActionEnum) {
3
- AppActionEnum["SignIn"] = "SIGNIN";
4
- AppActionEnum["SignOut"] = "SIGNOUT";
5
- })(AppActionEnum || (AppActionEnum = {}));
@@ -1,3 +0,0 @@
1
- import { AppContextProps } from './AppContextType';
2
- declare const AppContext: import("react").Context<AppContextProps | undefined>;
3
- export default AppContext;
@@ -1,3 +0,0 @@
1
- import { createContext } from 'react';
2
- const AppContext = createContext(undefined);
3
- export default AppContext;
@@ -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,6 +0,0 @@
1
- export const defaultSession = {
2
- userName: '',
3
- branchId: undefined,
4
- roles: [],
5
- allowedComponents: [],
6
- };
@@ -1,7 +0,0 @@
1
- import React, { ReactNode } from "react";
2
- import 'react-toastify/dist/ReactToastify.css';
3
- interface AppProviderProps {
4
- children: ReactNode;
5
- }
6
- declare const AppProvider: React.FC<AppProviderProps>;
7
- export default AppProvider;
@@ -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,5 +0,0 @@
1
- import React from 'react';
2
- export declare const HostedInContainerProvider: React.FC<{
3
- children: React.ReactNode;
4
- }>;
5
- export declare const useHostedInContainer: () => boolean;
@@ -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 = {}));