feat: introduce propTypes
This commit is contained in:

committed by
Ali BARIN

parent
bfc7d5d0dd
commit
7afdf43872
@@ -1,3 +1,4 @@
|
|||||||
node_modules
|
node_modules
|
||||||
build
|
build
|
||||||
source
|
source
|
||||||
|
.eslintrc.js
|
||||||
|
@@ -4,4 +4,7 @@ module.exports = {
|
|||||||
'plugin:@tanstack/eslint-plugin-query/recommended',
|
'plugin:@tanstack/eslint-plugin-query/recommended',
|
||||||
'prettier',
|
'prettier',
|
||||||
],
|
],
|
||||||
|
rules: {
|
||||||
|
'react/prop-types': 'warn',
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
@@ -19,7 +19,6 @@
|
|||||||
"@testing-library/user-event": "^12.1.10",
|
"@testing-library/user-event": "^12.1.10",
|
||||||
"clipboard-copy": "^4.0.1",
|
"clipboard-copy": "^4.0.1",
|
||||||
"compare-versions": "^4.1.3",
|
"compare-versions": "^4.1.3",
|
||||||
"eslint-plugin-react": "^7.33.2",
|
|
||||||
"graphql": "^15.6.0",
|
"graphql": "^15.6.0",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"luxon": "^2.3.1",
|
"luxon": "^2.3.1",
|
||||||
@@ -47,7 +46,7 @@
|
|||||||
"build:watch": "yarn nodemon --exec react-scripts build --watch 'src/**/*.ts' --watch 'public/**/*' --ext ts,html",
|
"build:watch": "yarn nodemon --exec react-scripts build --watch 'src/**/*.ts' --watch 'public/**/*' --ext ts,html",
|
||||||
"test": "react-scripts test",
|
"test": "react-scripts test",
|
||||||
"eject": "react-scripts eject",
|
"eject": "react-scripts eject",
|
||||||
"lint": "eslint .",
|
"lint": "eslint src --ext .js,.jsx",
|
||||||
"prepack": "yarn build"
|
"prepack": "yarn build"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
import MenuItem from '@mui/material/MenuItem';
|
import MenuItem from '@mui/material/MenuItem';
|
||||||
import Menu from '@mui/material/Menu';
|
import Menu from '@mui/material/Menu';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
@@ -51,4 +52,12 @@ function AccountDropdownMenu(props) {
|
|||||||
</Menu>
|
</Menu>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AccountDropdownMenu.propTypes = {
|
||||||
|
open: PropTypes.bool.isRequired,
|
||||||
|
onClose: PropTypes.func.isRequired,
|
||||||
|
anchorEl: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
|
||||||
|
id: PropTypes.string.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
export default AccountDropdownMenu;
|
export default AccountDropdownMenu;
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
import PropTypes from 'prop-types';
|
||||||
import LoadingButton from '@mui/lab/LoadingButton';
|
import LoadingButton from '@mui/lab/LoadingButton';
|
||||||
import Alert from '@mui/material/Alert';
|
import Alert from '@mui/material/Alert';
|
||||||
import Dialog from '@mui/material/Dialog';
|
import Dialog from '@mui/material/Dialog';
|
||||||
@@ -6,6 +7,8 @@ import DialogContentText from '@mui/material/DialogContentText';
|
|||||||
import DialogTitle from '@mui/material/DialogTitle';
|
import DialogTitle from '@mui/material/DialogTitle';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { useNavigate, useSearchParams } from 'react-router-dom';
|
import { useNavigate, useSearchParams } from 'react-router-dom';
|
||||||
|
|
||||||
|
import { AppPropType } from 'propTypes/propTypes';
|
||||||
import AppAuthClientsDialog from 'components/AppAuthClientsDialog/index.ee';
|
import AppAuthClientsDialog from 'components/AppAuthClientsDialog/index.ee';
|
||||||
import InputCreator from 'components/InputCreator';
|
import InputCreator from 'components/InputCreator';
|
||||||
import * as URLS from 'config/urls';
|
import * as URLS from 'config/urls';
|
||||||
@@ -13,7 +16,8 @@ import useAuthenticateApp from 'hooks/useAuthenticateApp.ee';
|
|||||||
import useFormatMessage from 'hooks/useFormatMessage';
|
import useFormatMessage from 'hooks/useFormatMessage';
|
||||||
import { generateExternalLink } from 'helpers/translationValues';
|
import { generateExternalLink } from 'helpers/translationValues';
|
||||||
import { Form } from './style';
|
import { Form } from './style';
|
||||||
export default function AddAppConnection(props) {
|
|
||||||
|
function AddAppConnection(props) {
|
||||||
const { application, connectionId, onClose } = props;
|
const { application, connectionId, onClose } = props;
|
||||||
const { name, authDocUrl, key, auth } = application;
|
const { name, authDocUrl, key, auth } = application;
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@@ -137,3 +141,11 @@ export default function AddAppConnection(props) {
|
|||||||
</Dialog>
|
</Dialog>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AddAppConnection.propTypes = {
|
||||||
|
onClose: PropTypes.func.isRequired,
|
||||||
|
application: AppPropType.isRequired,
|
||||||
|
connectionId: PropTypes.string,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default AddAppConnection;
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
import { useLazyQuery } from '@apollo/client';
|
import { useLazyQuery } from '@apollo/client';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import debounce from 'lodash/debounce';
|
import debounce from 'lodash/debounce';
|
||||||
@@ -23,13 +24,14 @@ import * as URLS from 'config/urls';
|
|||||||
import AppIcon from 'components/AppIcon';
|
import AppIcon from 'components/AppIcon';
|
||||||
import { GET_APPS } from 'graphql/queries/get-apps';
|
import { GET_APPS } from 'graphql/queries/get-apps';
|
||||||
import useFormatMessage from 'hooks/useFormatMessage';
|
import useFormatMessage from 'hooks/useFormatMessage';
|
||||||
|
|
||||||
function createConnectionOrFlow(appKey, supportsConnections = false) {
|
function createConnectionOrFlow(appKey, supportsConnections = false) {
|
||||||
if (!supportsConnections) {
|
if (!supportsConnections) {
|
||||||
return URLS.CREATE_FLOW_WITH_APP(appKey);
|
return URLS.CREATE_FLOW_WITH_APP(appKey);
|
||||||
}
|
}
|
||||||
return URLS.APP_ADD_CONNECTION(appKey);
|
return URLS.APP_ADD_CONNECTION(appKey);
|
||||||
}
|
}
|
||||||
export default function AddNewAppConnection(props) {
|
function AddNewAppConnection(props) {
|
||||||
const { onClose } = props;
|
const { onClose } = props;
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const matchSmallScreens = useMediaQuery(theme.breakpoints.down('sm'));
|
const matchSmallScreens = useMediaQuery(theme.breakpoints.down('sm'));
|
||||||
@@ -136,3 +138,9 @@ export default function AddNewAppConnection(props) {
|
|||||||
</Dialog>
|
</Dialog>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AddNewAppConnection.propTypes = {
|
||||||
|
onClose: PropTypes.func.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default AddNewAppConnection;
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
import React from 'react';
|
import * as React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
import LoadingButton from '@mui/lab/LoadingButton';
|
import LoadingButton from '@mui/lab/LoadingButton';
|
||||||
import Alert from '@mui/material/Alert';
|
import Alert from '@mui/material/Alert';
|
||||||
import Dialog from '@mui/material/Dialog';
|
import Dialog from '@mui/material/Dialog';
|
||||||
@@ -6,12 +7,16 @@ import DialogContent from '@mui/material/DialogContent';
|
|||||||
import DialogContentText from '@mui/material/DialogContentText';
|
import DialogContentText from '@mui/material/DialogContentText';
|
||||||
import DialogTitle from '@mui/material/DialogTitle';
|
import DialogTitle from '@mui/material/DialogTitle';
|
||||||
import CircularProgress from '@mui/material/CircularProgress';
|
import CircularProgress from '@mui/material/CircularProgress';
|
||||||
|
import { ApolloError } from '@apollo/client';
|
||||||
|
|
||||||
|
import { FieldPropType } from 'propTypes/propTypes';
|
||||||
import useFormatMessage from 'hooks/useFormatMessage';
|
import useFormatMessage from 'hooks/useFormatMessage';
|
||||||
import InputCreator from 'components/InputCreator';
|
import InputCreator from 'components/InputCreator';
|
||||||
import Switch from 'components/Switch';
|
import Switch from 'components/Switch';
|
||||||
import TextField from 'components/TextField';
|
import TextField from 'components/TextField';
|
||||||
import { Form } from './style';
|
import { Form } from './style';
|
||||||
export default function AdminApplicationAuthClientDialog(props) {
|
|
||||||
|
function AdminApplicationAuthClientDialog(props) {
|
||||||
const {
|
const {
|
||||||
error,
|
error,
|
||||||
onClose,
|
onClose,
|
||||||
@@ -80,3 +85,17 @@ export default function AdminApplicationAuthClientDialog(props) {
|
|||||||
</Dialog>
|
</Dialog>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AdminApplicationAuthClientDialog.propTypes = {
|
||||||
|
error: PropTypes.instanceOf(ApolloError),
|
||||||
|
onClose: PropTypes.func.isRequired,
|
||||||
|
title: PropTypes.string.isRequired,
|
||||||
|
loading: PropTypes.bool.isRequired,
|
||||||
|
submitHandler: PropTypes.func.isRequired,
|
||||||
|
authFields: PropTypes.arrayOf(FieldPropType),
|
||||||
|
submitting: PropTypes.bool.isRequired,
|
||||||
|
defaultValues: PropTypes.object.isRequired,
|
||||||
|
disabled: PropTypes.bool,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default AdminApplicationAuthClientDialog;
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
import PropTypes from 'prop-types';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import CircularProgress from '@mui/material/CircularProgress';
|
import CircularProgress from '@mui/material/CircularProgress';
|
||||||
import Stack from '@mui/material/Stack';
|
import Stack from '@mui/material/Stack';
|
||||||
@@ -11,6 +12,7 @@ import * as URLS from 'config/urls';
|
|||||||
import useFormatMessage from 'hooks/useFormatMessage';
|
import useFormatMessage from 'hooks/useFormatMessage';
|
||||||
import useAppAuthClients from 'hooks/useAppAuthClients.ee';
|
import useAppAuthClients from 'hooks/useAppAuthClients.ee';
|
||||||
import NoResultFound from 'components/NoResultFound';
|
import NoResultFound from 'components/NoResultFound';
|
||||||
|
|
||||||
function AdminApplicationAuthClients(props) {
|
function AdminApplicationAuthClients(props) {
|
||||||
const { appKey } = props;
|
const { appKey } = props;
|
||||||
const formatMessage = useFormatMessage();
|
const formatMessage = useFormatMessage();
|
||||||
@@ -72,4 +74,9 @@ function AdminApplicationAuthClients(props) {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AdminApplicationAuthClients.propTypes = {
|
||||||
|
appKey: PropTypes.string.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
export default AdminApplicationAuthClients;
|
export default AdminApplicationAuthClients;
|
||||||
|
@@ -1,11 +1,15 @@
|
|||||||
|
import PropTypes from 'prop-types';
|
||||||
import React, { useCallback, useMemo } from 'react';
|
import React, { useCallback, useMemo } from 'react';
|
||||||
import { useMutation } from '@apollo/client';
|
import { useMutation } from '@apollo/client';
|
||||||
|
|
||||||
|
import { AppPropType } from 'propTypes/propTypes';
|
||||||
import { CREATE_APP_CONFIG } from 'graphql/mutations/create-app-config';
|
import { CREATE_APP_CONFIG } from 'graphql/mutations/create-app-config';
|
||||||
import { CREATE_APP_AUTH_CLIENT } from 'graphql/mutations/create-app-auth-client';
|
import { CREATE_APP_AUTH_CLIENT } from 'graphql/mutations/create-app-auth-client';
|
||||||
import useAppConfig from 'hooks/useAppConfig.ee';
|
import useAppConfig from 'hooks/useAppConfig.ee';
|
||||||
import useFormatMessage from 'hooks/useFormatMessage';
|
import useFormatMessage from 'hooks/useFormatMessage';
|
||||||
import AdminApplicationAuthClientDialog from 'components/AdminApplicationAuthClientDialog';
|
import AdminApplicationAuthClientDialog from 'components/AdminApplicationAuthClientDialog';
|
||||||
export default function AdminApplicationCreateAuthClient(props) {
|
|
||||||
|
function AdminApplicationCreateAuthClient(props) {
|
||||||
const { appKey, application, onClose } = props;
|
const { appKey, application, onClose } = props;
|
||||||
const { auth } = application;
|
const { auth } = application;
|
||||||
const formatMessage = useFormatMessage();
|
const formatMessage = useFormatMessage();
|
||||||
@@ -87,3 +91,11 @@ export default function AdminApplicationCreateAuthClient(props) {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AdminApplicationCreateAuthClient.propTypes = {
|
||||||
|
appKey: PropTypes.string.isRequired,
|
||||||
|
application: AppPropType.isRequired,
|
||||||
|
onClose: PropTypes.func.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default AdminApplicationCreateAuthClient;
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
import PropTypes from 'prop-types';
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import useAppConfig from 'hooks/useAppConfig.ee';
|
import useAppConfig from 'hooks/useAppConfig.ee';
|
||||||
import useFormatMessage from 'hooks/useFormatMessage';
|
import useFormatMessage from 'hooks/useFormatMessage';
|
||||||
@@ -11,6 +12,7 @@ import { UPDATE_APP_CONFIG } from 'graphql/mutations/update-app-config';
|
|||||||
import Form from 'components/Form';
|
import Form from 'components/Form';
|
||||||
import { Switch } from './style';
|
import { Switch } from './style';
|
||||||
import useEnqueueSnackbar from 'hooks/useEnqueueSnackbar';
|
import useEnqueueSnackbar from 'hooks/useEnqueueSnackbar';
|
||||||
|
|
||||||
function AdminApplicationSettings(props) {
|
function AdminApplicationSettings(props) {
|
||||||
const { appConfig, loading } = useAppConfig(props.appKey);
|
const { appConfig, loading } = useAppConfig(props.appKey);
|
||||||
const [createAppConfig, { loading: loadingCreateAppConfig }] = useMutation(
|
const [createAppConfig, { loading: loadingCreateAppConfig }] = useMutation(
|
||||||
@@ -109,4 +111,9 @@ function AdminApplicationSettings(props) {
|
|||||||
></Form>
|
></Form>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AdminApplicationSettings.propTypes = {
|
||||||
|
appKey: PropTypes.string.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
export default AdminApplicationSettings;
|
export default AdminApplicationSettings;
|
||||||
|
@@ -1,13 +1,15 @@
|
|||||||
|
import PropTypes from 'prop-types';
|
||||||
import React, { useCallback, useMemo } from 'react';
|
import React, { useCallback, useMemo } from 'react';
|
||||||
import { useParams } from 'react-router-dom';
|
import { useParams } from 'react-router-dom';
|
||||||
import { useMutation } from '@apollo/client';
|
import { useMutation } from '@apollo/client';
|
||||||
|
|
||||||
|
import { AppPropType } from 'propTypes/propTypes';
|
||||||
import { UPDATE_APP_AUTH_CLIENT } from 'graphql/mutations/update-app-auth-client';
|
import { UPDATE_APP_AUTH_CLIENT } from 'graphql/mutations/update-app-auth-client';
|
||||||
import useFormatMessage from 'hooks/useFormatMessage';
|
import useFormatMessage from 'hooks/useFormatMessage';
|
||||||
import AdminApplicationAuthClientDialog from 'components/AdminApplicationAuthClientDialog';
|
import AdminApplicationAuthClientDialog from 'components/AdminApplicationAuthClientDialog';
|
||||||
import useAdminAppAuthClient from 'hooks/useAdminAppAuthClient.ee';
|
import useAdminAppAuthClient from 'hooks/useAdminAppAuthClient.ee';
|
||||||
|
|
||||||
export default function AdminApplicationUpdateAuthClient(props) {
|
function AdminApplicationUpdateAuthClient(props) {
|
||||||
const { application, onClose } = props;
|
const { application, onClose } = props;
|
||||||
const { auth } = application;
|
const { auth } = application;
|
||||||
const formatMessage = useFormatMessage();
|
const formatMessage = useFormatMessage();
|
||||||
@@ -87,3 +89,10 @@ export default function AdminApplicationUpdateAuthClient(props) {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AdminApplicationUpdateAuthClient.propTypes = {
|
||||||
|
application: AppPropType.isRequired,
|
||||||
|
onClose: PropTypes.func.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default AdminApplicationUpdateAuthClient;
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
import PropTypes from 'prop-types';
|
||||||
import ArrowBackIosNewIcon from '@mui/icons-material/ArrowBackIosNew';
|
import ArrowBackIosNewIcon from '@mui/icons-material/ArrowBackIosNew';
|
||||||
import GroupIcon from '@mui/icons-material/Group';
|
import GroupIcon from '@mui/icons-material/Group';
|
||||||
import GroupsIcon from '@mui/icons-material/Groups';
|
import GroupsIcon from '@mui/icons-material/Groups';
|
||||||
@@ -14,6 +15,7 @@ import Drawer from 'components/Drawer';
|
|||||||
import * as URLS from 'config/urls';
|
import * as URLS from 'config/urls';
|
||||||
import useFormatMessage from 'hooks/useFormatMessage';
|
import useFormatMessage from 'hooks/useFormatMessage';
|
||||||
import useCurrentUserAbility from 'hooks/useCurrentUserAbility';
|
import useCurrentUserAbility from 'hooks/useCurrentUserAbility';
|
||||||
|
|
||||||
function createDrawerLinks({
|
function createDrawerLinks({
|
||||||
canReadRole,
|
canReadRole,
|
||||||
canReadUser,
|
canReadUser,
|
||||||
@@ -65,7 +67,8 @@ function createDrawerLinks({
|
|||||||
].filter(Boolean);
|
].filter(Boolean);
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
export default function SettingsLayout({ children }) {
|
|
||||||
|
function SettingsLayout({ children }) {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const formatMessage = useFormatMessage();
|
const formatMessage = useFormatMessage();
|
||||||
const currentUserAbility = useCurrentUserAbility();
|
const currentUserAbility = useCurrentUserAbility();
|
||||||
@@ -83,7 +86,6 @@ export default function SettingsLayout({ children }) {
|
|||||||
currentUserAbility.can('create', 'SamlAuthProvider'),
|
currentUserAbility.can('create', 'SamlAuthProvider'),
|
||||||
canUpdateApp: currentUserAbility.can('update', 'App'),
|
canUpdateApp: currentUserAbility.can('update', 'App'),
|
||||||
});
|
});
|
||||||
const a = 123;
|
|
||||||
const drawerBottomLinks = [
|
const drawerBottomLinks = [
|
||||||
{
|
{
|
||||||
Icon: ArrowBackIosNewIcon,
|
Icon: ArrowBackIosNewIcon,
|
||||||
@@ -118,3 +120,9 @@ export default function SettingsLayout({ children }) {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SettingsLayout.propTypes = {
|
||||||
|
children: PropTypes.node.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default SettingsLayout;
|
||||||
|
@@ -3,6 +3,7 @@ import * as React from 'react';
|
|||||||
import { mutateAndGetClient } from 'graphql/client';
|
import { mutateAndGetClient } from 'graphql/client';
|
||||||
import useAuthentication from 'hooks/useAuthentication';
|
import useAuthentication from 'hooks/useAuthentication';
|
||||||
import useEnqueueSnackbar from 'hooks/useEnqueueSnackbar';
|
import useEnqueueSnackbar from 'hooks/useEnqueueSnackbar';
|
||||||
|
|
||||||
const ApolloProvider = (props) => {
|
const ApolloProvider = (props) => {
|
||||||
const enqueueSnackbar = useEnqueueSnackbar();
|
const enqueueSnackbar = useEnqueueSnackbar();
|
||||||
const authentication = useAuthentication();
|
const authentication = useAuthentication();
|
||||||
@@ -25,4 +26,5 @@ const ApolloProvider = (props) => {
|
|||||||
}, [onError, authentication]);
|
}, [onError, authentication]);
|
||||||
return <BaseApolloProvider client={client} {...props} />;
|
return <BaseApolloProvider client={client} {...props} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ApolloProvider;
|
export default ApolloProvider;
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
import PropTypes from 'prop-types';
|
||||||
import Dialog from '@mui/material/Dialog';
|
import Dialog from '@mui/material/Dialog';
|
||||||
import DialogTitle from '@mui/material/DialogTitle';
|
import DialogTitle from '@mui/material/DialogTitle';
|
||||||
import List from '@mui/material/List';
|
import List from '@mui/material/List';
|
||||||
@@ -7,7 +8,8 @@ import ListItemText from '@mui/material/ListItemText';
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import useAppAuthClients from 'hooks/useAppAuthClients.ee';
|
import useAppAuthClients from 'hooks/useAppAuthClients.ee';
|
||||||
import useFormatMessage from 'hooks/useFormatMessage';
|
import useFormatMessage from 'hooks/useFormatMessage';
|
||||||
export default function AppAuthClientsDialog(props) {
|
|
||||||
|
function AppAuthClientsDialog(props) {
|
||||||
const { appKey, onClientClick, onClose } = props;
|
const { appKey, onClientClick, onClose } = props;
|
||||||
const { appAuthClients } = useAppAuthClients({ appKey, active: true });
|
const { appAuthClients } = useAppAuthClients({ appKey, active: true });
|
||||||
const formatMessage = useFormatMessage();
|
const formatMessage = useFormatMessage();
|
||||||
@@ -37,3 +39,11 @@ export default function AppAuthClientsDialog(props) {
|
|||||||
</Dialog>
|
</Dialog>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AppAuthClientsDialog.propTypes = {
|
||||||
|
appKey: PropTypes.string.isRequired,
|
||||||
|
onClientClick: PropTypes.func.isRequired,
|
||||||
|
onClose: PropTypes.func.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default AppAuthClientsDialog;
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
import PropTypes from 'prop-types';
|
||||||
import AccountCircleIcon from '@mui/icons-material/AccountCircle';
|
import AccountCircleIcon from '@mui/icons-material/AccountCircle';
|
||||||
import MenuIcon from '@mui/icons-material/Menu';
|
import MenuIcon from '@mui/icons-material/Menu';
|
||||||
import MenuOpenIcon from '@mui/icons-material/MenuOpen';
|
import MenuOpenIcon from '@mui/icons-material/MenuOpen';
|
||||||
@@ -13,8 +14,10 @@ import Logo from 'components/Logo/index';
|
|||||||
import TrialStatusBadge from 'components/TrialStatusBadge/index.ee';
|
import TrialStatusBadge from 'components/TrialStatusBadge/index.ee';
|
||||||
import * as URLS from 'config/urls';
|
import * as URLS from 'config/urls';
|
||||||
import { Link } from './style';
|
import { Link } from './style';
|
||||||
|
|
||||||
const accountMenuId = 'account-menu';
|
const accountMenuId = 'account-menu';
|
||||||
export default function AppBar(props) {
|
|
||||||
|
function AppBar(props) {
|
||||||
const { drawerOpen, onDrawerOpen, onDrawerClose, maxWidth = false } = props;
|
const { drawerOpen, onDrawerOpen, onDrawerClose, maxWidth = false } = props;
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const matchSmallScreens = useMediaQuery(theme.breakpoints.down('md'));
|
const matchSmallScreens = useMediaQuery(theme.breakpoints.down('md'));
|
||||||
@@ -73,3 +76,15 @@ export default function AppBar(props) {
|
|||||||
</MuiAppBar>
|
</MuiAppBar>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AppBar.propTypes = {
|
||||||
|
drawerOpen: PropTypes.bool.isRequired,
|
||||||
|
onDrawerOpen: PropTypes.func.isRequired,
|
||||||
|
onDrawerClose: PropTypes.func.isRequired,
|
||||||
|
maxWidth: PropTypes.oneOfType([
|
||||||
|
PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl', false]),
|
||||||
|
PropTypes.string,
|
||||||
|
]),
|
||||||
|
};
|
||||||
|
|
||||||
|
export default AppBar;
|
||||||
|
@@ -1,10 +1,14 @@
|
|||||||
|
import PropTypes from 'prop-types';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import Menu from '@mui/material/Menu';
|
import Menu from '@mui/material/Menu';
|
||||||
import MenuItem from '@mui/material/MenuItem';
|
import MenuItem from '@mui/material/MenuItem';
|
||||||
|
|
||||||
import * as URLS from 'config/urls';
|
import * as URLS from 'config/urls';
|
||||||
import useFormatMessage from 'hooks/useFormatMessage';
|
import useFormatMessage from 'hooks/useFormatMessage';
|
||||||
export default function ContextMenu(props) {
|
import { ConnectionPropType } from 'propTypes/propTypes';
|
||||||
|
|
||||||
|
function ContextMenu(props) {
|
||||||
const {
|
const {
|
||||||
appKey,
|
appKey,
|
||||||
connection,
|
connection,
|
||||||
@@ -61,3 +65,17 @@ export default function ContextMenu(props) {
|
|||||||
</Menu>
|
</Menu>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ContextMenu.propTypes = {
|
||||||
|
appKey: PropTypes.string.isRequired,
|
||||||
|
connection: ConnectionPropType.isRequired,
|
||||||
|
onClose: PropTypes.func.isRequired,
|
||||||
|
onMenuItemClick: PropTypes.func.isRequired,
|
||||||
|
anchorEl: PropTypes.oneOfType([
|
||||||
|
PropTypes.func,
|
||||||
|
PropTypes.shape({ current: PropTypes.instanceOf(Element) }),
|
||||||
|
]),
|
||||||
|
disableReconnection: PropTypes.bool.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ContextMenu;
|
||||||
|
@@ -14,7 +14,9 @@ import ConnectionContextMenu from 'components/AppConnectionContextMenu';
|
|||||||
import { DELETE_CONNECTION } from 'graphql/mutations/delete-connection';
|
import { DELETE_CONNECTION } from 'graphql/mutations/delete-connection';
|
||||||
import { TEST_CONNECTION } from 'graphql/queries/test-connection';
|
import { TEST_CONNECTION } from 'graphql/queries/test-connection';
|
||||||
import useFormatMessage from 'hooks/useFormatMessage';
|
import useFormatMessage from 'hooks/useFormatMessage';
|
||||||
|
import { ConnectionPropType } from 'propTypes/propTypes';
|
||||||
import { CardContent, Typography } from './style';
|
import { CardContent, Typography } from './style';
|
||||||
|
|
||||||
const countTranslation = (value) => (
|
const countTranslation = (value) => (
|
||||||
<>
|
<>
|
||||||
<Typography variant="body1">{value}</Typography>
|
<Typography variant="body1">{value}</Typography>
|
||||||
@@ -166,4 +168,9 @@ function AppConnectionRow(props) {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AppConnectionRow.propTypes = {
|
||||||
|
connection: ConnectionPropType.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
export default AppConnectionRow;
|
export default AppConnectionRow;
|
||||||
|
@@ -1,11 +1,13 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
import { useQuery } from '@apollo/client';
|
import { useQuery } from '@apollo/client';
|
||||||
import { GET_APP_CONNECTIONS } from 'graphql/queries/get-app-connections';
|
import { GET_APP_CONNECTIONS } from 'graphql/queries/get-app-connections';
|
||||||
import AppConnectionRow from 'components/AppConnectionRow';
|
import AppConnectionRow from 'components/AppConnectionRow';
|
||||||
import NoResultFound from 'components/NoResultFound';
|
import NoResultFound from 'components/NoResultFound';
|
||||||
import useFormatMessage from 'hooks/useFormatMessage';
|
import useFormatMessage from 'hooks/useFormatMessage';
|
||||||
import * as URLS from 'config/urls';
|
import * as URLS from 'config/urls';
|
||||||
export default function AppConnections(props) {
|
|
||||||
|
function AppConnections(props) {
|
||||||
const { appKey } = props;
|
const { appKey } = props;
|
||||||
const formatMessage = useFormatMessage();
|
const formatMessage = useFormatMessage();
|
||||||
const { data } = useQuery(GET_APP_CONNECTIONS, {
|
const { data } = useQuery(GET_APP_CONNECTIONS, {
|
||||||
@@ -22,6 +24,7 @@ export default function AppConnections(props) {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{appConnections.map((appConnection) => (
|
{appConnections.map((appConnection) => (
|
||||||
@@ -30,3 +33,9 @@ export default function AppConnections(props) {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AppConnections.propTypes = {
|
||||||
|
appKey: PropTypes.string.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default AppConnections;
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
import PropTypes from 'prop-types';
|
||||||
import { useQuery } from '@apollo/client';
|
import { useQuery } from '@apollo/client';
|
||||||
import { Link, useSearchParams } from 'react-router-dom';
|
import { Link, useSearchParams } from 'react-router-dom';
|
||||||
import { GET_FLOWS } from 'graphql/queries/get-flows';
|
import { GET_FLOWS } from 'graphql/queries/get-flows';
|
||||||
@@ -12,7 +13,7 @@ const getLimitAndOffset = (page) => ({
|
|||||||
limit: FLOW_PER_PAGE,
|
limit: FLOW_PER_PAGE,
|
||||||
offset: (page - 1) * FLOW_PER_PAGE,
|
offset: (page - 1) * FLOW_PER_PAGE,
|
||||||
});
|
});
|
||||||
export default function AppFlows(props) {
|
function AppFlows(props) {
|
||||||
const { appKey } = props;
|
const { appKey } = props;
|
||||||
const formatMessage = useFormatMessage();
|
const formatMessage = useFormatMessage();
|
||||||
const [searchParams, setSearchParams] = useSearchParams();
|
const [searchParams, setSearchParams] = useSearchParams();
|
||||||
@@ -62,3 +63,9 @@ export default function AppFlows(props) {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AppFlows.propTypes = {
|
||||||
|
appKey: PropTypes.string.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default AppFlows;
|
||||||
|
@@ -1,9 +1,10 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
import Avatar from '@mui/material/Avatar';
|
import Avatar from '@mui/material/Avatar';
|
||||||
const inlineImgStyle = {
|
const inlineImgStyle = {
|
||||||
objectFit: 'contain',
|
objectFit: 'contain',
|
||||||
};
|
};
|
||||||
export default function AppIcon(props) {
|
function AppIcon(props) {
|
||||||
const { name, url, color, sx = {}, variant = 'square', ...restProps } = props;
|
const { name, url, color, sx = {}, variant = 'square', ...restProps } = props;
|
||||||
const initialLetter = name?.[0];
|
const initialLetter = name?.[0];
|
||||||
return (
|
return (
|
||||||
@@ -14,8 +15,22 @@ export default function AppIcon(props) {
|
|||||||
imgProps={{ style: inlineImgStyle }}
|
imgProps={{ style: inlineImgStyle }}
|
||||||
src={url}
|
src={url}
|
||||||
alt={name}
|
alt={name}
|
||||||
children={initialLetter}
|
|
||||||
{...restProps}
|
{...restProps}
|
||||||
/>
|
>
|
||||||
|
{initialLetter}
|
||||||
|
</Avatar>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AppIcon.propTypes = {
|
||||||
|
name: PropTypes.string,
|
||||||
|
url: PropTypes.string,
|
||||||
|
color: PropTypes.string,
|
||||||
|
variant: PropTypes.oneOfType([
|
||||||
|
PropTypes.oneOf(['circular', 'rounded', 'square']),
|
||||||
|
PropTypes.string,
|
||||||
|
]),
|
||||||
|
sx: PropTypes.object,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default AppIcon;
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import Card from '@mui/material/Card';
|
import Card from '@mui/material/Card';
|
||||||
import Box from '@mui/material/Box';
|
import Box from '@mui/material/Box';
|
||||||
@@ -6,13 +7,16 @@ import CardActionArea from '@mui/material/CardActionArea';
|
|||||||
import ArrowForwardIosIcon from '@mui/icons-material/ArrowForwardIos';
|
import ArrowForwardIosIcon from '@mui/icons-material/ArrowForwardIos';
|
||||||
import useFormatMessage from 'hooks/useFormatMessage';
|
import useFormatMessage from 'hooks/useFormatMessage';
|
||||||
import AppIcon from 'components/AppIcon';
|
import AppIcon from 'components/AppIcon';
|
||||||
|
import { AppPropType } from 'propTypes/propTypes';
|
||||||
import { CardContent, Typography } from './style';
|
import { CardContent, Typography } from './style';
|
||||||
|
|
||||||
const countTranslation = (value) => (
|
const countTranslation = (value) => (
|
||||||
<>
|
<>
|
||||||
<Typography variant="body1">{value}</Typography>
|
<Typography variant="body1">{value}</Typography>
|
||||||
<br />
|
<br />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
function AppRow(props) {
|
function AppRow(props) {
|
||||||
const formatMessage = useFormatMessage();
|
const formatMessage = useFormatMessage();
|
||||||
const { name, primaryColor, iconUrl, connectionCount, flowCount } =
|
const { name, primaryColor, iconUrl, connectionCount, flowCount } =
|
||||||
@@ -65,4 +69,10 @@ function AppRow(props) {
|
|||||||
</Link>
|
</Link>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AppRow.propTypes = {
|
||||||
|
application: AppPropType.isRequired,
|
||||||
|
url: PropTypes.string.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
export default AppRow;
|
export default AppRow;
|
||||||
|
@@ -1,7 +1,18 @@
|
|||||||
|
import PropTypes from 'prop-types';
|
||||||
import { Can as OriginalCan } from '@casl/react';
|
import { Can as OriginalCan } from '@casl/react';
|
||||||
import * as React from 'react';
|
|
||||||
import useCurrentUserAbility from 'hooks/useCurrentUserAbility';
|
import useCurrentUserAbility from 'hooks/useCurrentUserAbility';
|
||||||
export default function Can(props) {
|
|
||||||
|
function Can(props) {
|
||||||
const currentUserAbility = useCurrentUserAbility();
|
const currentUserAbility = useCurrentUserAbility();
|
||||||
return <OriginalCan ability={currentUserAbility} {...props} />;
|
return <OriginalCan ability={currentUserAbility} {...props} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Can.propTypes = {
|
||||||
|
I: PropTypes.string.isRequired,
|
||||||
|
a: PropTypes.string,
|
||||||
|
an: PropTypes.string,
|
||||||
|
passThrough: PropTypes.bool,
|
||||||
|
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Can;
|
||||||
|
@@ -3,6 +3,7 @@ import { useLocation } from 'react-router-dom';
|
|||||||
import Alert from '@mui/material/Alert';
|
import Alert from '@mui/material/Alert';
|
||||||
import Typography from '@mui/material/Typography';
|
import Typography from '@mui/material/Typography';
|
||||||
import useFormatMessage from 'hooks/useFormatMessage';
|
import useFormatMessage from 'hooks/useFormatMessage';
|
||||||
|
|
||||||
export default function CheckoutCompletedAlert() {
|
export default function CheckoutCompletedAlert() {
|
||||||
const formatMessage = useFormatMessage();
|
const formatMessage = useFormatMessage();
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
import PropTypes from 'prop-types';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import Typography from '@mui/material/Typography';
|
import Typography from '@mui/material/Typography';
|
||||||
import Box from '@mui/material/Box';
|
import Box from '@mui/material/Box';
|
||||||
@@ -11,6 +12,8 @@ import useFormatMessage from 'hooks/useFormatMessage';
|
|||||||
import useApps from 'hooks/useApps';
|
import useApps from 'hooks/useApps';
|
||||||
import { EditorContext } from 'contexts/Editor';
|
import { EditorContext } from 'contexts/Editor';
|
||||||
import FlowSubstepTitle from 'components/FlowSubstepTitle';
|
import FlowSubstepTitle from 'components/FlowSubstepTitle';
|
||||||
|
import { StepPropType, SubstepPropType } from 'propTypes/propTypes';
|
||||||
|
|
||||||
const optionGenerator = (app) => ({
|
const optionGenerator = (app) => ({
|
||||||
label: app.name,
|
label: app.name,
|
||||||
value: app.key,
|
value: app.key,
|
||||||
@@ -222,4 +225,15 @@ function ChooseAppAndEventSubstep(props) {
|
|||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ChooseAppAndEventSubstep.propTypes = {
|
||||||
|
substep: SubstepPropType.isRequired,
|
||||||
|
expanded: PropTypes.bool,
|
||||||
|
onExpand: PropTypes.func.isRequired,
|
||||||
|
onCollapse: PropTypes.func.isRequired,
|
||||||
|
step: StepPropType.isRequired,
|
||||||
|
onSubmit: PropTypes.func.isRequired,
|
||||||
|
onChange: PropTypes.func.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
export default ChooseAppAndEventSubstep;
|
export default ChooseAppAndEventSubstep;
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
import PropTypes from 'prop-types';
|
||||||
import { useLazyQuery, useQuery } from '@apollo/client';
|
import { useLazyQuery, useQuery } from '@apollo/client';
|
||||||
import Autocomplete from '@mui/material/Autocomplete';
|
import Autocomplete from '@mui/material/Autocomplete';
|
||||||
import Button from '@mui/material/Button';
|
import Button from '@mui/material/Button';
|
||||||
@@ -14,14 +15,23 @@ import { GET_APP_CONNECTIONS } from 'graphql/queries/get-app-connections';
|
|||||||
import { TEST_CONNECTION } from 'graphql/queries/test-connection';
|
import { TEST_CONNECTION } from 'graphql/queries/test-connection';
|
||||||
import useAuthenticateApp from 'hooks/useAuthenticateApp.ee';
|
import useAuthenticateApp from 'hooks/useAuthenticateApp.ee';
|
||||||
import useFormatMessage from 'hooks/useFormatMessage';
|
import useFormatMessage from 'hooks/useFormatMessage';
|
||||||
|
import {
|
||||||
|
AppPropType,
|
||||||
|
StepPropType,
|
||||||
|
SubstepPropType,
|
||||||
|
} from 'propTypes/propTypes';
|
||||||
|
|
||||||
const ADD_CONNECTION_VALUE = 'ADD_CONNECTION';
|
const ADD_CONNECTION_VALUE = 'ADD_CONNECTION';
|
||||||
const ADD_SHARED_CONNECTION_VALUE = 'ADD_SHARED_CONNECTION';
|
const ADD_SHARED_CONNECTION_VALUE = 'ADD_SHARED_CONNECTION';
|
||||||
|
|
||||||
const optionGenerator = (connection) => ({
|
const optionGenerator = (connection) => ({
|
||||||
label: connection?.formattedData?.screenName ?? 'Unnamed',
|
label: connection?.formattedData?.screenName ?? 'Unnamed',
|
||||||
value: connection?.id,
|
value: connection?.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
const getOption = (options, connectionId) =>
|
const getOption = (options, connectionId) =>
|
||||||
options.find((connection) => connection.value === connectionId) || null;
|
options.find((connection) => connection.value === connectionId) || null;
|
||||||
|
|
||||||
function ChooseConnectionSubstep(props) {
|
function ChooseConnectionSubstep(props) {
|
||||||
const {
|
const {
|
||||||
substep,
|
substep,
|
||||||
@@ -237,4 +247,16 @@ function ChooseConnectionSubstep(props) {
|
|||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ChooseConnectionSubstep.propTypes = {
|
||||||
|
application: AppPropType.isRequired,
|
||||||
|
substep: SubstepPropType.isRequired,
|
||||||
|
expanded: PropTypes.bool,
|
||||||
|
onExpand: PropTypes.func.isRequired,
|
||||||
|
onCollapse: PropTypes.func.isRequired,
|
||||||
|
onChange: PropTypes.func.isRequired,
|
||||||
|
onSubmit: PropTypes.func.isRequired,
|
||||||
|
step: StepPropType.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
export default ChooseConnectionSubstep;
|
export default ChooseConnectionSubstep;
|
||||||
|
@@ -1,7 +1,10 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
import { Button } from './style';
|
import { Button } from './style';
|
||||||
|
|
||||||
const BG_IMAGE_FALLBACK =
|
const BG_IMAGE_FALLBACK =
|
||||||
'linear-gradient(45deg, #ccc 25%, transparent 25%), linear-gradient(135deg, #ccc 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ccc 75%), linear-gradient(135deg, transparent 75%, #ccc 75%) /*! @noflip */';
|
'linear-gradient(45deg, #ccc 25%, transparent 25%), linear-gradient(135deg, #ccc 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ccc 75%), linear-gradient(135deg, transparent 75%, #ccc 75%) /*! @noflip */';
|
||||||
|
|
||||||
const ColorButton = (props) => {
|
const ColorButton = (props) => {
|
||||||
const {
|
const {
|
||||||
bgColor,
|
bgColor,
|
||||||
@@ -24,4 +27,12 @@ const ColorButton = (props) => {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ColorButton.propTypes = {
|
||||||
|
bgColor: PropTypes.string.isRequired,
|
||||||
|
className: PropTypes.string,
|
||||||
|
disablePopover: PropTypes.bool.isRequired,
|
||||||
|
isBgColorValid: PropTypes.bool.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
export default ColorButton;
|
export default ColorButton;
|
||||||
|
@@ -1,8 +1,10 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
import { Controller, useFormContext } from 'react-hook-form';
|
import { Controller, useFormContext } from 'react-hook-form';
|
||||||
import { MuiColorInput } from 'mui-color-input';
|
import { MuiColorInput } from 'mui-color-input';
|
||||||
import ColorButton from './ColorButton';
|
import ColorButton from './ColorButton';
|
||||||
export default function ColorInput(props) {
|
|
||||||
|
function ColorInput(props) {
|
||||||
const { control } = useFormContext();
|
const { control } = useFormContext();
|
||||||
const {
|
const {
|
||||||
required,
|
required,
|
||||||
@@ -32,3 +34,12 @@ export default function ColorInput(props) {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ColorInput.propTypes = {
|
||||||
|
shouldUnregister: PropTypes.bool,
|
||||||
|
name: PropTypes.string.isRequired,
|
||||||
|
disabled: PropTypes.bool,
|
||||||
|
required: PropTypes.bool,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ColorInput;
|
||||||
|
@@ -1,9 +1,11 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
import { useTheme } from '@mui/material/styles';
|
import { useTheme } from '@mui/material/styles';
|
||||||
import useMediaQuery from '@mui/material/useMediaQuery';
|
import useMediaQuery from '@mui/material/useMediaQuery';
|
||||||
import Button from '@mui/material/Button';
|
import Button from '@mui/material/Button';
|
||||||
import { IconButton } from './style';
|
import { IconButton } from './style';
|
||||||
export default function ConditionalIconButton(props) {
|
|
||||||
|
function ConditionalIconButton(props) {
|
||||||
const { icon, ...buttonProps } = props;
|
const { icon, ...buttonProps } = props;
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const matchSmallScreens = useMediaQuery(theme.breakpoints.down('md'));
|
const matchSmallScreens = useMediaQuery(theme.breakpoints.down('md'));
|
||||||
@@ -24,3 +26,9 @@ export default function ConditionalIconButton(props) {
|
|||||||
}
|
}
|
||||||
return <Button {...buttonProps} />;
|
return <Button {...buttonProps} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ConditionalIconButton.propTypes = {
|
||||||
|
icon: PropTypes.node.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ConditionalIconButton;
|
||||||
|
@@ -1,18 +1,20 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
import Button from '@mui/material/Button';
|
import Button from '@mui/material/Button';
|
||||||
import Dialog from '@mui/material/Dialog';
|
import Dialog from '@mui/material/Dialog';
|
||||||
import DialogActions from '@mui/material/DialogActions';
|
import DialogActions from '@mui/material/DialogActions';
|
||||||
import DialogContent from '@mui/material/DialogContent';
|
import DialogContent from '@mui/material/DialogContent';
|
||||||
import DialogContentText from '@mui/material/DialogContentText';
|
import DialogContentText from '@mui/material/DialogContentText';
|
||||||
import DialogTitle from '@mui/material/DialogTitle';
|
import DialogTitle from '@mui/material/DialogTitle';
|
||||||
export default function ConfirmationDialog(props) {
|
|
||||||
|
function ConfirmationDialog(props) {
|
||||||
const {
|
const {
|
||||||
onClose,
|
onClose,
|
||||||
onConfirm,
|
onConfirm,
|
||||||
title,
|
title,
|
||||||
description,
|
description,
|
||||||
cancelButtonChildren,
|
cancelButtonChildren,
|
||||||
confirmButtionChildren,
|
confirmButtonChildren,
|
||||||
open = true,
|
open = true,
|
||||||
} = props;
|
} = props;
|
||||||
const dataTest = props['data-test'];
|
const dataTest = props['data-test'];
|
||||||
@@ -32,16 +34,29 @@ export default function ConfirmationDialog(props) {
|
|||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{confirmButtionChildren && onConfirm && (
|
{confirmButtonChildren && onConfirm && (
|
||||||
<Button
|
<Button
|
||||||
onClick={onConfirm}
|
onClick={onConfirm}
|
||||||
color="error"
|
color="error"
|
||||||
data-test="confirmation-confirm-button"
|
data-test="confirmation-confirm-button"
|
||||||
>
|
>
|
||||||
{confirmButtionChildren}
|
{confirmButtonChildren}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ConfirmationDialog.propTypes = {
|
||||||
|
onClose: PropTypes.func.isRequired,
|
||||||
|
onConfirm: PropTypes.func.isRequired,
|
||||||
|
title: PropTypes.node.isRequired,
|
||||||
|
description: PropTypes.node.isRequired,
|
||||||
|
cancelButtonChildren: PropTypes.node.isRequired,
|
||||||
|
confirmButtonChildren: PropTypes.node.isRequired,
|
||||||
|
open: PropTypes.bool,
|
||||||
|
'data-test': PropTypes.string,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ConfirmationDialog;
|
||||||
|
@@ -1,8 +1,10 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import MuiContainer from '@mui/material/Container';
|
import MuiContainer from '@mui/material/Container';
|
||||||
|
|
||||||
export default function Container(props) {
|
export default function Container(props) {
|
||||||
return <MuiContainer {...props} />;
|
return <MuiContainer {...props} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
Container.defaultProps = {
|
Container.defaultProps = {
|
||||||
maxWidth: 'lg',
|
maxWidth: 'lg',
|
||||||
};
|
};
|
||||||
|
@@ -1,10 +1,13 @@
|
|||||||
|
import PropTypes from 'prop-types';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { Controller, useFormContext } from 'react-hook-form';
|
import { Controller, useFormContext } from 'react-hook-form';
|
||||||
import FormHelperText from '@mui/material/FormHelperText';
|
import FormHelperText from '@mui/material/FormHelperText';
|
||||||
import Autocomplete, { createFilterOptions } from '@mui/material/Autocomplete';
|
import Autocomplete, { createFilterOptions } from '@mui/material/Autocomplete';
|
||||||
import Typography from '@mui/material/Typography';
|
import Typography from '@mui/material/Typography';
|
||||||
|
|
||||||
const getOption = (options, value) =>
|
const getOption = (options, value) =>
|
||||||
options.find((option) => option.value === value) || null;
|
options.find((option) => option.value === value) || null;
|
||||||
|
|
||||||
// Enables filtering by value in autocomplete dropdown
|
// Enables filtering by value in autocomplete dropdown
|
||||||
const filterOptions = createFilterOptions({
|
const filterOptions = createFilterOptions({
|
||||||
stringify: ({ label, value }) => `
|
stringify: ({ label, value }) => `
|
||||||
@@ -12,6 +15,7 @@ const filterOptions = createFilterOptions({
|
|||||||
${value}
|
${value}
|
||||||
`,
|
`,
|
||||||
});
|
});
|
||||||
|
|
||||||
function ControlledAutocomplete(props) {
|
function ControlledAutocomplete(props) {
|
||||||
const { control, watch, setValue, resetField } = useFormContext();
|
const { control, watch, setValue, resetField } = useFormContext();
|
||||||
const {
|
const {
|
||||||
@@ -113,4 +117,18 @@ function ControlledAutocomplete(props) {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ControlledAutocomplete.propTypes = {
|
||||||
|
shouldUnregister: PropTypes.bool,
|
||||||
|
name: PropTypes.string.isRequired,
|
||||||
|
required: PropTypes.bool,
|
||||||
|
showOptionValue: PropTypes.bool,
|
||||||
|
description: PropTypes.string,
|
||||||
|
dependsOn: PropTypes.arrayOf(PropTypes.string),
|
||||||
|
defaultValue: PropTypes.any,
|
||||||
|
onBlur: PropTypes.func,
|
||||||
|
onChange: PropTypes.func,
|
||||||
|
options: PropTypes.array,
|
||||||
|
};
|
||||||
|
|
||||||
export default ControlledAutocomplete;
|
export default ControlledAutocomplete;
|
||||||
|
@@ -1,7 +1,9 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
import { Controller, useFormContext } from 'react-hook-form';
|
import { Controller, useFormContext } from 'react-hook-form';
|
||||||
import Checkbox from '@mui/material/Checkbox';
|
import Checkbox from '@mui/material/Checkbox';
|
||||||
export default function ControlledCheckbox(props) {
|
|
||||||
|
function ControlledCheckbox(props) {
|
||||||
const { control } = useFormContext();
|
const { control } = useFormContext();
|
||||||
const {
|
const {
|
||||||
required,
|
required,
|
||||||
@@ -52,3 +54,15 @@ export default function ControlledCheckbox(props) {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ControlledCheckbox.propTypes = {
|
||||||
|
name: PropTypes.string.isRequired,
|
||||||
|
defaultValue: PropTypes.bool,
|
||||||
|
dataTest: PropTypes.string,
|
||||||
|
required: PropTypes.bool,
|
||||||
|
disabled: PropTypes.bool,
|
||||||
|
onBlur: PropTypes.func,
|
||||||
|
onChange: PropTypes.func,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ControlledCheckbox;
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
|
import PropTypes from 'prop-types';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { Controller as RHFController, useFormContext } from 'react-hook-form';
|
import { Controller as RHFController, useFormContext } from 'react-hook-form';
|
||||||
|
|
||||||
function Controller(props) {
|
function Controller(props) {
|
||||||
const { control } = useFormContext();
|
const { control } = useFormContext();
|
||||||
const {
|
const {
|
||||||
@@ -20,4 +22,13 @@ function Controller(props) {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Controller.propTypes = {
|
||||||
|
defaultValue: PropTypes.string,
|
||||||
|
name: PropTypes.string.isRequired,
|
||||||
|
required: PropTypes.bool,
|
||||||
|
shouldUnregister: PropTypes.bool,
|
||||||
|
children: PropTypes.element.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
export default Controller;
|
export default Controller;
|
||||||
|
@@ -1,11 +1,14 @@
|
|||||||
|
import PropTypes from 'prop-types';
|
||||||
import Paper from '@mui/material/Paper';
|
import Paper from '@mui/material/Paper';
|
||||||
import Popper from '@mui/material/Popper';
|
import Popper from '@mui/material/Popper';
|
||||||
import Tab from '@mui/material/Tab';
|
import Tab from '@mui/material/Tab';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import Suggestions from 'components/PowerInput/Suggestions';
|
import Suggestions from 'components/PowerInput/Suggestions';
|
||||||
import TabPanel from 'components/TabPanel';
|
import TabPanel from 'components/TabPanel';
|
||||||
|
import { FieldDropdownOptionPropType } from 'propTypes/propTypes';
|
||||||
import Options from './Options';
|
import Options from './Options';
|
||||||
import { Tabs } from './style';
|
import { Tabs } from './style';
|
||||||
|
|
||||||
const CustomOptions = (props) => {
|
const CustomOptions = (props) => {
|
||||||
const {
|
const {
|
||||||
open,
|
open,
|
||||||
@@ -69,4 +72,23 @@ const CustomOptions = (props) => {
|
|||||||
</Popper>
|
</Popper>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CustomOptions.propTypes = {
|
||||||
|
open: PropTypes.bool.isRequired,
|
||||||
|
anchorEl: PropTypes.oneOfType([PropTypes.element, PropTypes.func]).isRequired,
|
||||||
|
data: PropTypes.arrayOf(
|
||||||
|
PropTypes.shape({
|
||||||
|
id: PropTypes.string.isRequired,
|
||||||
|
name: PropTypes.string.isRequired,
|
||||||
|
output: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||||
|
}),
|
||||||
|
).isRequired,
|
||||||
|
options: PropTypes.arrayOf(FieldDropdownOptionPropType).isRequired,
|
||||||
|
onSuggestionClick: PropTypes.func.isRequired,
|
||||||
|
onOptionClick: PropTypes.func.isRequired,
|
||||||
|
onTabChange: PropTypes.func.isRequired,
|
||||||
|
label: PropTypes.string,
|
||||||
|
initialTabIndex: PropTypes.oneOf([0, 1]),
|
||||||
|
};
|
||||||
|
|
||||||
export default CustomOptions;
|
export default CustomOptions;
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
import PropTypes from 'prop-types';
|
||||||
import ListItemButton from '@mui/material/ListItemButton';
|
import ListItemButton from '@mui/material/ListItemButton';
|
||||||
import ListItemText from '@mui/material/ListItemText';
|
import ListItemText from '@mui/material/ListItemText';
|
||||||
import throttle from 'lodash/throttle';
|
import throttle from 'lodash/throttle';
|
||||||
@@ -7,12 +8,16 @@ import { Typography } from '@mui/material';
|
|||||||
import SearchInput from 'components/SearchInput';
|
import SearchInput from 'components/SearchInput';
|
||||||
import useFormatMessage from 'hooks/useFormatMessage';
|
import useFormatMessage from 'hooks/useFormatMessage';
|
||||||
import { SearchInputWrapper } from './style';
|
import { SearchInputWrapper } from './style';
|
||||||
|
import { FieldDropdownOptionPropType } from 'propTypes/propTypes';
|
||||||
|
|
||||||
const SHORT_LIST_LENGTH = 4;
|
const SHORT_LIST_LENGTH = 4;
|
||||||
const LIST_ITEM_HEIGHT = 64;
|
const LIST_ITEM_HEIGHT = 64;
|
||||||
|
|
||||||
const computeListHeight = (currentLength) => {
|
const computeListHeight = (currentLength) => {
|
||||||
const numberOfRenderedItems = Math.min(SHORT_LIST_LENGTH, currentLength);
|
const numberOfRenderedItems = Math.min(SHORT_LIST_LENGTH, currentLength);
|
||||||
return LIST_ITEM_HEIGHT * numberOfRenderedItems;
|
return LIST_ITEM_HEIGHT * numberOfRenderedItems;
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderItemFactory =
|
const renderItemFactory =
|
||||||
({ onOptionClick }) =>
|
({ onOptionClick }) =>
|
||||||
(props) => {
|
(props) => {
|
||||||
@@ -44,6 +49,7 @@ const renderItemFactory =
|
|||||||
</ListItemButton>
|
</ListItemButton>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const Options = (props) => {
|
const Options = (props) => {
|
||||||
const formatMessage = useFormatMessage();
|
const formatMessage = useFormatMessage();
|
||||||
const { data, onOptionClick } = props;
|
const { data, onOptionClick } = props;
|
||||||
@@ -108,4 +114,10 @@ const Options = (props) => {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Options.propTypes = {
|
||||||
|
data: PropTypes.arrayOf(FieldDropdownOptionPropType).isRequired,
|
||||||
|
onOptionClick: PropTypes.func.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
export default Options;
|
export default Options;
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
import PropTypes from 'prop-types';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { useController, useFormContext } from 'react-hook-form';
|
import { useController, useFormContext } from 'react-hook-form';
|
||||||
import { IconButton } from '@mui/material';
|
import { IconButton } from '@mui/material';
|
||||||
@@ -28,6 +29,7 @@ import {
|
|||||||
import CustomOptions from './CustomOptions';
|
import CustomOptions from './CustomOptions';
|
||||||
import { processStepWithExecutions } from 'components/PowerInput/data';
|
import { processStepWithExecutions } from 'components/PowerInput/data';
|
||||||
import { StepExecutionsContext } from 'contexts/StepExecutions';
|
import { StepExecutionsContext } from 'contexts/StepExecutions';
|
||||||
|
|
||||||
function ControlledCustomAutocomplete(props) {
|
function ControlledCustomAutocomplete(props) {
|
||||||
const {
|
const {
|
||||||
defaultValue = '',
|
defaultValue = '',
|
||||||
@@ -257,4 +259,23 @@ function ControlledCustomAutocomplete(props) {
|
|||||||
</Slate>
|
</Slate>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ControlledCustomAutocomplete.propTypes = {
|
||||||
|
options: PropTypes.array,
|
||||||
|
loading: PropTypes.bool.isRequired,
|
||||||
|
showOptionValue: PropTypes.bool,
|
||||||
|
dependsOn: PropTypes.arrayOf(PropTypes.string),
|
||||||
|
defaultValue: PropTypes.string,
|
||||||
|
name: PropTypes.string.isRequired,
|
||||||
|
label: PropTypes.string,
|
||||||
|
type: PropTypes.string,
|
||||||
|
required: PropTypes.bool,
|
||||||
|
readOnly: PropTypes.bool,
|
||||||
|
description: PropTypes.string,
|
||||||
|
docUrl: PropTypes.string,
|
||||||
|
clickToCopy: PropTypes.bool,
|
||||||
|
disabled: PropTypes.bool,
|
||||||
|
shouldUnregister: PropTypes.bool,
|
||||||
|
};
|
||||||
|
|
||||||
export default ControlledCustomAutocomplete;
|
export default ControlledCustomAutocomplete;
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
import useConfig from 'hooks/useConfig';
|
import useConfig from 'hooks/useConfig';
|
||||||
import { LogoImage } from './style.ee';
|
import { LogoImage } from './style.ee';
|
||||||
|
|
||||||
const CustomLogo = () => {
|
const CustomLogo = () => {
|
||||||
const { config, loading } = useConfig(['logo.svgData']);
|
const { config, loading } = useConfig(['logo.svgData']);
|
||||||
if (loading || !config?.['logo.svgData']) return null;
|
if (loading || !config?.['logo.svgData']) return null;
|
||||||
@@ -11,4 +12,5 @@ const CustomLogo = () => {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default CustomLogo;
|
export default CustomLogo;
|
||||||
|
@@ -4,7 +4,7 @@ import { FormattedMessage } from 'react-intl';
|
|||||||
import MationLogo from 'components/MationLogo';
|
import MationLogo from 'components/MationLogo';
|
||||||
import useAutomatischInfo from 'hooks/useAutomatischInfo';
|
import useAutomatischInfo from 'hooks/useAutomatischInfo';
|
||||||
|
|
||||||
export default function DefaultLogo() {
|
const DefaultLogo = () => {
|
||||||
const { data: automatischInfo, isPending } = useAutomatischInfo();
|
const { data: automatischInfo, isPending } = useAutomatischInfo();
|
||||||
const isMation = automatischInfo?.data.isMation;
|
const isMation = automatischInfo?.data.isMation;
|
||||||
|
|
||||||
@@ -16,4 +16,6 @@ export default function DefaultLogo() {
|
|||||||
<FormattedMessage id="brandText" />
|
<FormattedMessage id="brandText" />
|
||||||
</Typography>
|
</Typography>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
|
export default DefaultLogo;
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
import PropTypes from 'prop-types';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import { useMutation } from '@apollo/client';
|
import { useMutation } from '@apollo/client';
|
||||||
@@ -8,7 +9,8 @@ import { DELETE_CURRENT_USER } from 'graphql/mutations/delete-current-user.ee';
|
|||||||
import useAuthentication from 'hooks/useAuthentication';
|
import useAuthentication from 'hooks/useAuthentication';
|
||||||
import useFormatMessage from 'hooks/useFormatMessage';
|
import useFormatMessage from 'hooks/useFormatMessage';
|
||||||
import useCurrentUser from 'hooks/useCurrentUser';
|
import useCurrentUser from 'hooks/useCurrentUser';
|
||||||
export default function DeleteAccountDialog(props) {
|
|
||||||
|
function DeleteAccountDialog(props) {
|
||||||
const [deleteCurrentUser] = useMutation(DELETE_CURRENT_USER);
|
const [deleteCurrentUser] = useMutation(DELETE_CURRENT_USER);
|
||||||
const formatMessage = useFormatMessage();
|
const formatMessage = useFormatMessage();
|
||||||
const currentUser = useCurrentUser();
|
const currentUser = useCurrentUser();
|
||||||
@@ -27,7 +29,13 @@ export default function DeleteAccountDialog(props) {
|
|||||||
onClose={props.onClose}
|
onClose={props.onClose}
|
||||||
onConfirm={handleConfirm}
|
onConfirm={handleConfirm}
|
||||||
cancelButtonChildren={formatMessage('deleteAccountDialog.cancel')}
|
cancelButtonChildren={formatMessage('deleteAccountDialog.cancel')}
|
||||||
confirmButtionChildren={formatMessage('deleteAccountDialog.confirm')}
|
confirmButtonChildren={formatMessage('deleteAccountDialog.confirm')}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DeleteAccountDialog.propTypes = {
|
||||||
|
onClose: PropTypes.func.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default DeleteAccountDialog;
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
import PropTypes from 'prop-types';
|
||||||
import { useMutation } from '@apollo/client';
|
import { useMutation } from '@apollo/client';
|
||||||
import DeleteIcon from '@mui/icons-material/Delete';
|
import DeleteIcon from '@mui/icons-material/Delete';
|
||||||
import IconButton from '@mui/material/IconButton';
|
import IconButton from '@mui/material/IconButton';
|
||||||
@@ -7,7 +8,8 @@ import Can from 'components/Can';
|
|||||||
import ConfirmationDialog from 'components/ConfirmationDialog';
|
import ConfirmationDialog from 'components/ConfirmationDialog';
|
||||||
import { DELETE_ROLE } from 'graphql/mutations/delete-role.ee';
|
import { DELETE_ROLE } from 'graphql/mutations/delete-role.ee';
|
||||||
import useFormatMessage from 'hooks/useFormatMessage';
|
import useFormatMessage from 'hooks/useFormatMessage';
|
||||||
export default function DeleteRoleButton(props) {
|
|
||||||
|
function DeleteRoleButton(props) {
|
||||||
const { disabled, roleId } = props;
|
const { disabled, roleId } = props;
|
||||||
const [showConfirmation, setShowConfirmation] = React.useState(false);
|
const [showConfirmation, setShowConfirmation] = React.useState(false);
|
||||||
const [deleteRole] = useMutation(DELETE_ROLE, {
|
const [deleteRole] = useMutation(DELETE_ROLE, {
|
||||||
@@ -52,9 +54,16 @@ export default function DeleteRoleButton(props) {
|
|||||||
onClose={() => setShowConfirmation(false)}
|
onClose={() => setShowConfirmation(false)}
|
||||||
onConfirm={handleConfirm}
|
onConfirm={handleConfirm}
|
||||||
cancelButtonChildren={formatMessage('deleteRoleButton.cancel')}
|
cancelButtonChildren={formatMessage('deleteRoleButton.cancel')}
|
||||||
confirmButtionChildren={formatMessage('deleteRoleButton.confirm')}
|
confirmButtonChildren={formatMessage('deleteRoleButton.confirm')}
|
||||||
data-test="delete-role-modal"
|
data-test="delete-role-modal"
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DeleteRoleButton.propTypes = {
|
||||||
|
disabled: PropTypes.bool,
|
||||||
|
roleId: PropTypes.string.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default DeleteRoleButton;
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
import PropTypes from 'prop-types';
|
||||||
import { useMutation } from '@apollo/client';
|
import { useMutation } from '@apollo/client';
|
||||||
import DeleteIcon from '@mui/icons-material/Delete';
|
import DeleteIcon from '@mui/icons-material/Delete';
|
||||||
import IconButton from '@mui/material/IconButton';
|
import IconButton from '@mui/material/IconButton';
|
||||||
@@ -6,7 +7,8 @@ import * as React from 'react';
|
|||||||
import ConfirmationDialog from 'components/ConfirmationDialog';
|
import ConfirmationDialog from 'components/ConfirmationDialog';
|
||||||
import { DELETE_USER } from 'graphql/mutations/delete-user.ee';
|
import { DELETE_USER } from 'graphql/mutations/delete-user.ee';
|
||||||
import useFormatMessage from 'hooks/useFormatMessage';
|
import useFormatMessage from 'hooks/useFormatMessage';
|
||||||
export default function DeleteUserButton(props) {
|
|
||||||
|
function DeleteUserButton(props) {
|
||||||
const { userId } = props;
|
const { userId } = props;
|
||||||
const [showConfirmation, setShowConfirmation] = React.useState(false);
|
const [showConfirmation, setShowConfirmation] = React.useState(false);
|
||||||
const [deleteUser] = useMutation(DELETE_USER, {
|
const [deleteUser] = useMutation(DELETE_USER, {
|
||||||
@@ -46,9 +48,15 @@ export default function DeleteUserButton(props) {
|
|||||||
onClose={() => setShowConfirmation(false)}
|
onClose={() => setShowConfirmation(false)}
|
||||||
onConfirm={handleConfirm}
|
onConfirm={handleConfirm}
|
||||||
cancelButtonChildren={formatMessage('deleteUserButton.cancel')}
|
cancelButtonChildren={formatMessage('deleteUserButton.cancel')}
|
||||||
confirmButtionChildren={formatMessage('deleteUserButton.confirm')}
|
confirmButtonChildren={formatMessage('deleteUserButton.confirm')}
|
||||||
data-test="delete-user-modal"
|
data-test="delete-user-modal"
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DeleteUserButton.propTypes = {
|
||||||
|
userId: PropTypes.string.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default DeleteUserButton;
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
import { useTheme } from '@mui/material/styles';
|
import { useTheme } from '@mui/material/styles';
|
||||||
import Toolbar from '@mui/material/Toolbar';
|
import Toolbar from '@mui/material/Toolbar';
|
||||||
import List from '@mui/material/List';
|
import List from '@mui/material/List';
|
||||||
@@ -8,10 +9,12 @@ import Badge from '@mui/material/Badge';
|
|||||||
import ListItemLink from 'components/ListItemLink';
|
import ListItemLink from 'components/ListItemLink';
|
||||||
import useFormatMessage from 'hooks/useFormatMessage';
|
import useFormatMessage from 'hooks/useFormatMessage';
|
||||||
import { Drawer as BaseDrawer } from './style';
|
import { Drawer as BaseDrawer } from './style';
|
||||||
|
|
||||||
const iOS =
|
const iOS =
|
||||||
typeof navigator !== 'undefined' &&
|
typeof navigator !== 'undefined' &&
|
||||||
/iPad|iPhone|iPod/.test(navigator.userAgent);
|
/iPad|iPhone|iPod/.test(navigator.userAgent);
|
||||||
export default function Drawer(props) {
|
|
||||||
|
function Drawer(props) {
|
||||||
const { links = [], bottomLinks = [], ...drawerProps } = props;
|
const { links = [], bottomLinks = [], ...drawerProps } = props;
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const matchSmallScreens = useMediaQuery(theme.breakpoints.down('md'));
|
const matchSmallScreens = useMediaQuery(theme.breakpoints.down('md'));
|
||||||
@@ -70,3 +73,20 @@ export default function Drawer(props) {
|
|||||||
</BaseDrawer>
|
</BaseDrawer>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const DrawerLinkPropTypes = PropTypes.shape({
|
||||||
|
Icon: PropTypes.elementType.isRequired,
|
||||||
|
primary: PropTypes.string.isRequired,
|
||||||
|
to: PropTypes.string.isRequired,
|
||||||
|
target: PropTypes.oneOf(['_blank']),
|
||||||
|
badgeContent: PropTypes.node,
|
||||||
|
dataTest: PropTypes.string,
|
||||||
|
});
|
||||||
|
|
||||||
|
Drawer.propTypes = {
|
||||||
|
links: PropTypes.arrayOf(DrawerLinkPropTypes).isRequired,
|
||||||
|
bottomLinks: PropTypes.arrayOf(DrawerLinkPropTypes),
|
||||||
|
onClose: PropTypes.func.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Drawer;
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
import PropTypes from 'prop-types';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { v4 as uuidv4 } from 'uuid';
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
import { useFormContext, useWatch } from 'react-hook-form';
|
import { useFormContext, useWatch } from 'react-hook-form';
|
||||||
@@ -9,6 +10,8 @@ import RemoveIcon from '@mui/icons-material/Remove';
|
|||||||
import AddIcon from '@mui/icons-material/Add';
|
import AddIcon from '@mui/icons-material/Add';
|
||||||
import InputCreator from 'components/InputCreator';
|
import InputCreator from 'components/InputCreator';
|
||||||
import { EditorContext } from 'contexts/Editor';
|
import { EditorContext } from 'contexts/Editor';
|
||||||
|
import { FieldsPropType } from 'propTypes/propTypes';
|
||||||
|
|
||||||
function DynamicField(props) {
|
function DynamicField(props) {
|
||||||
const { label, description, fields, name, defaultValue, stepId } = props;
|
const { label, description, fields, name, defaultValue, stepId } = props;
|
||||||
const { control, setValue, getValues } = useFormContext();
|
const { control, setValue, getValues } = useFormContext();
|
||||||
@@ -107,4 +110,23 @@ function DynamicField(props) {
|
|||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DynamicField.propTypes = {
|
||||||
|
onChange: PropTypes.func,
|
||||||
|
onBlur: PropTypes.func,
|
||||||
|
defaultValue: PropTypes.arrayOf(PropTypes.object),
|
||||||
|
name: PropTypes.string.isRequired,
|
||||||
|
label: PropTypes.string.isRequired,
|
||||||
|
type: PropTypes.string,
|
||||||
|
required: PropTypes.bool,
|
||||||
|
readOnly: PropTypes.bool,
|
||||||
|
description: PropTypes.string,
|
||||||
|
docUrl: PropTypes.string,
|
||||||
|
clickToCopy: PropTypes.bool,
|
||||||
|
disabled: PropTypes.bool,
|
||||||
|
fields: FieldsPropType.isRequired,
|
||||||
|
shouldUnregister: PropTypes.bool,
|
||||||
|
stepId: PropTypes.string,
|
||||||
|
};
|
||||||
|
|
||||||
export default DynamicField;
|
export default DynamicField;
|
||||||
|
@@ -1,8 +1,11 @@
|
|||||||
|
import PropTypes from 'prop-types';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import Typography from '@mui/material/Typography';
|
import Typography from '@mui/material/Typography';
|
||||||
import EditIcon from '@mui/icons-material/Edit';
|
import EditIcon from '@mui/icons-material/Edit';
|
||||||
import { Box, TextField } from './style';
|
import { Box, TextField } from './style';
|
||||||
|
|
||||||
const noop = () => null;
|
const noop = () => null;
|
||||||
|
|
||||||
function EditableTypography(props) {
|
function EditableTypography(props) {
|
||||||
const { children, onConfirm = noop, sx, ...typographyProps } = props;
|
const { children, onConfirm = noop, sx, ...typographyProps } = props;
|
||||||
const [editing, setEditing] = React.useState(false);
|
const [editing, setEditing] = React.useState(false);
|
||||||
@@ -55,4 +58,11 @@ function EditableTypography(props) {
|
|||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EditableTypography.propTypes = {
|
||||||
|
children: PropTypes.string.isRequired,
|
||||||
|
onConfirm: PropTypes.func,
|
||||||
|
sx: PropTypes.object,
|
||||||
|
};
|
||||||
|
|
||||||
export default EditableTypography;
|
export default EditableTypography;
|
||||||
|
@@ -7,6 +7,8 @@ import { GET_FLOW } from 'graphql/queries/get-flow';
|
|||||||
import { CREATE_STEP } from 'graphql/mutations/create-step';
|
import { CREATE_STEP } from 'graphql/mutations/create-step';
|
||||||
import { UPDATE_STEP } from 'graphql/mutations/update-step';
|
import { UPDATE_STEP } from 'graphql/mutations/update-step';
|
||||||
import FlowStep from 'components/FlowStep';
|
import FlowStep from 'components/FlowStep';
|
||||||
|
import { FlowPropType } from 'propTypes/propTypes';
|
||||||
|
|
||||||
function updateHandlerFactory(flowId, previousStepId) {
|
function updateHandlerFactory(flowId, previousStepId) {
|
||||||
return function createStepUpdateHandler(cache, mutationResult) {
|
return function createStepUpdateHandler(cache, mutationResult) {
|
||||||
const { data } = mutationResult;
|
const { data } = mutationResult;
|
||||||
@@ -28,7 +30,8 @@ function updateHandlerFactory(flowId, previousStepId) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
export default function Editor(props) {
|
|
||||||
|
function Editor(props) {
|
||||||
const [updateStep] = useMutation(UPDATE_STEP);
|
const [updateStep] = useMutation(UPDATE_STEP);
|
||||||
const [createStep, { loading: creationInProgress }] = useMutation(
|
const [createStep, { loading: creationInProgress }] = useMutation(
|
||||||
CREATE_STEP,
|
CREATE_STEP,
|
||||||
@@ -118,3 +121,9 @@ export default function Editor(props) {
|
|||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Editor.propTypes = {
|
||||||
|
flow: FlowPropType.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Editor;
|
||||||
|
@@ -17,6 +17,7 @@ import { UPDATE_FLOW_STATUS } from 'graphql/mutations/update-flow-status';
|
|||||||
import { UPDATE_FLOW } from 'graphql/mutations/update-flow';
|
import { UPDATE_FLOW } from 'graphql/mutations/update-flow';
|
||||||
import { GET_FLOW } from 'graphql/queries/get-flow';
|
import { GET_FLOW } from 'graphql/queries/get-flow';
|
||||||
import * as URLS from 'config/urls';
|
import * as URLS from 'config/urls';
|
||||||
|
|
||||||
export default function EditorLayout() {
|
export default function EditorLayout() {
|
||||||
const { flowId } = useParams();
|
const { flowId } = useParams();
|
||||||
const formatMessage = useFormatMessage();
|
const formatMessage = useFormatMessage();
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
import PropTypes from 'prop-types';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { DateTime } from 'luxon';
|
import { DateTime } from 'luxon';
|
||||||
import Stack from '@mui/material/Stack';
|
import Stack from '@mui/material/Stack';
|
||||||
@@ -5,6 +6,8 @@ import Box from '@mui/material/Box';
|
|||||||
import Tooltip from '@mui/material/Tooltip';
|
import Tooltip from '@mui/material/Tooltip';
|
||||||
import Typography from '@mui/material/Typography';
|
import Typography from '@mui/material/Typography';
|
||||||
import useFormatMessage from 'hooks/useFormatMessage';
|
import useFormatMessage from 'hooks/useFormatMessage';
|
||||||
|
import { ExecutionPropType } from 'propTypes/propTypes';
|
||||||
|
|
||||||
function ExecutionName(props) {
|
function ExecutionName(props) {
|
||||||
return (
|
return (
|
||||||
<Typography variant="h3" gutterBottom>
|
<Typography variant="h3" gutterBottom>
|
||||||
@@ -12,6 +15,11 @@ function ExecutionName(props) {
|
|||||||
</Typography>
|
</Typography>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ExecutionName.propTypes = {
|
||||||
|
name: PropTypes.string.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
function ExecutionId(props) {
|
function ExecutionId(props) {
|
||||||
const formatMessage = useFormatMessage();
|
const formatMessage = useFormatMessage();
|
||||||
const id = (
|
const id = (
|
||||||
@@ -27,6 +35,11 @@ function ExecutionId(props) {
|
|||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ExecutionId.propTypes = {
|
||||||
|
id: PropTypes.string.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
function ExecutionDate(props) {
|
function ExecutionDate(props) {
|
||||||
const createdAt = DateTime.fromMillis(parseInt(props.createdAt, 10));
|
const createdAt = DateTime.fromMillis(parseInt(props.createdAt, 10));
|
||||||
const relativeCreatedAt = createdAt.toRelative();
|
const relativeCreatedAt = createdAt.toRelative();
|
||||||
@@ -40,7 +53,13 @@ function ExecutionDate(props) {
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
export default function ExecutionHeader(props) {
|
|
||||||
|
ExecutionDate.propTypes = {
|
||||||
|
createdAt: PropTypes.oneOfType([PropTypes.string, PropTypes.instanceOf(Date)])
|
||||||
|
.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
function ExecutionHeader(props) {
|
||||||
const { execution } = props;
|
const { execution } = props;
|
||||||
if (!execution) return <React.Fragment />;
|
if (!execution) return <React.Fragment />;
|
||||||
return (
|
return (
|
||||||
@@ -59,3 +78,9 @@ export default function ExecutionHeader(props) {
|
|||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ExecutionHeader.propTypes = {
|
||||||
|
execution: ExecutionPropType,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ExecutionHeader;
|
||||||
|
@@ -9,9 +9,12 @@ import * as URLS from 'config/urls';
|
|||||||
import useFormatMessage from 'hooks/useFormatMessage';
|
import useFormatMessage from 'hooks/useFormatMessage';
|
||||||
import FlowAppIcons from 'components/FlowAppIcons';
|
import FlowAppIcons from 'components/FlowAppIcons';
|
||||||
import { Apps, CardContent, ArrowContainer, Title, Typography } from './style';
|
import { Apps, CardContent, ArrowContainer, Title, Typography } from './style';
|
||||||
export default function ExecutionRow(props) {
|
import { ExecutionPropType } from 'propTypes/propTypes';
|
||||||
|
|
||||||
|
function ExecutionRow(props) {
|
||||||
const formatMessage = useFormatMessage();
|
const formatMessage = useFormatMessage();
|
||||||
const { execution } = props;
|
const { execution } = props;
|
||||||
|
|
||||||
const { flow } = execution;
|
const { flow } = execution;
|
||||||
const createdAt = DateTime.fromMillis(parseInt(execution.createdAt, 10));
|
const createdAt = DateTime.fromMillis(parseInt(execution.createdAt, 10));
|
||||||
const relativeCreatedAt = createdAt.toRelative();
|
const relativeCreatedAt = createdAt.toRelative();
|
||||||
@@ -66,3 +69,9 @@ export default function ExecutionRow(props) {
|
|||||||
</Link>
|
</Link>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ExecutionRow.propTypes = {
|
||||||
|
execution: ExecutionPropType.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ExecutionRow;
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
import PropTypes from 'prop-types';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { DateTime } from 'luxon';
|
import { DateTime } from 'luxon';
|
||||||
import Stack from '@mui/material/Stack';
|
import Stack from '@mui/material/Stack';
|
||||||
@@ -21,6 +22,8 @@ import {
|
|||||||
Metadata,
|
Metadata,
|
||||||
Wrapper,
|
Wrapper,
|
||||||
} from './style';
|
} from './style';
|
||||||
|
import { ExecutionStepPropType, StepPropType } from 'propTypes/propTypes';
|
||||||
|
|
||||||
function ExecutionStepId(props) {
|
function ExecutionStepId(props) {
|
||||||
const formatMessage = useFormatMessage();
|
const formatMessage = useFormatMessage();
|
||||||
const id = (
|
const id = (
|
||||||
@@ -36,6 +39,11 @@ function ExecutionStepId(props) {
|
|||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ExecutionStepId.propTypes = {
|
||||||
|
id: PropTypes.string.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
function ExecutionStepDate(props) {
|
function ExecutionStepDate(props) {
|
||||||
const formatMessage = useFormatMessage();
|
const formatMessage = useFormatMessage();
|
||||||
const createdAt = DateTime.fromMillis(parseInt(props.createdAt, 10));
|
const createdAt = DateTime.fromMillis(parseInt(props.createdAt, 10));
|
||||||
@@ -52,9 +60,15 @@ function ExecutionStepDate(props) {
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ExecutionStepDate.propTypes = {
|
||||||
|
createdAt: PropTypes.string.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
const validIcon = <CheckCircleIcon color="success" />;
|
const validIcon = <CheckCircleIcon color="success" />;
|
||||||
const errorIcon = <ErrorIcon color="error" />;
|
const errorIcon = <ErrorIcon color="error" />;
|
||||||
export default function ExecutionStep(props) {
|
|
||||||
|
function ExecutionStep(props) {
|
||||||
const { executionStep } = props;
|
const { executionStep } = props;
|
||||||
const [activeTabIndex, setActiveTabIndex] = React.useState(0);
|
const [activeTabIndex, setActiveTabIndex] = React.useState(0);
|
||||||
const step = executionStep.step;
|
const step = executionStep.step;
|
||||||
@@ -136,3 +150,12 @@ export default function ExecutionStep(props) {
|
|||||||
</Wrapper>
|
</Wrapper>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ExecutionStep.propTypes = {
|
||||||
|
collapsed: PropTypes.bool,
|
||||||
|
step: StepPropType.isRequired,
|
||||||
|
index: PropTypes.number,
|
||||||
|
executionStep: ExecutionStepPropType.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ExecutionStep;
|
||||||
|
@@ -1,7 +1,9 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
import AppIcon from 'components/AppIcon';
|
import AppIcon from 'components/AppIcon';
|
||||||
import IntermediateStepCount from 'components/IntermediateStepCount';
|
import IntermediateStepCount from 'components/IntermediateStepCount';
|
||||||
export default function FlowAppIcons(props) {
|
|
||||||
|
function FlowAppIcons(props) {
|
||||||
const { steps } = props;
|
const { steps } = props;
|
||||||
const stepsCount = steps.length;
|
const stepsCount = steps.length;
|
||||||
const firstStep = steps[0];
|
const firstStep = steps[0];
|
||||||
@@ -31,3 +33,13 @@ export default function FlowAppIcons(props) {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FlowAppIcons.propTypes = {
|
||||||
|
steps: PropTypes.arrayOf(
|
||||||
|
PropTypes.shape({
|
||||||
|
iconUrl: PropTypes.string,
|
||||||
|
}),
|
||||||
|
).isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default FlowAppIcons;
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
import PropTypes from 'prop-types';
|
||||||
import { useMutation } from '@apollo/client';
|
import { useMutation } from '@apollo/client';
|
||||||
import Menu from '@mui/material/Menu';
|
import Menu from '@mui/material/Menu';
|
||||||
import MenuItem from '@mui/material/MenuItem';
|
import MenuItem from '@mui/material/MenuItem';
|
||||||
@@ -9,7 +10,8 @@ import * as URLS from 'config/urls';
|
|||||||
import { DELETE_FLOW } from 'graphql/mutations/delete-flow';
|
import { DELETE_FLOW } from 'graphql/mutations/delete-flow';
|
||||||
import { DUPLICATE_FLOW } from 'graphql/mutations/duplicate-flow';
|
import { DUPLICATE_FLOW } from 'graphql/mutations/duplicate-flow';
|
||||||
import useFormatMessage from 'hooks/useFormatMessage';
|
import useFormatMessage from 'hooks/useFormatMessage';
|
||||||
export default function ContextMenu(props) {
|
|
||||||
|
function ContextMenu(props) {
|
||||||
const { flowId, onClose, anchorEl } = props;
|
const { flowId, onClose, anchorEl } = props;
|
||||||
const enqueueSnackbar = useEnqueueSnackbar();
|
const enqueueSnackbar = useEnqueueSnackbar();
|
||||||
const [deleteFlow] = useMutation(DELETE_FLOW);
|
const [deleteFlow] = useMutation(DELETE_FLOW);
|
||||||
@@ -80,3 +82,14 @@ export default function ContextMenu(props) {
|
|||||||
</Menu>
|
</Menu>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ContextMenu.propTypes = {
|
||||||
|
flowId: PropTypes.string.isRequired,
|
||||||
|
onClose: PropTypes.func.isRequired,
|
||||||
|
anchorEl: PropTypes.oneOfType([
|
||||||
|
PropTypes.func,
|
||||||
|
PropTypes.shape({ current: PropTypes.instanceOf(Element) }),
|
||||||
|
]).isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ContextMenu;
|
||||||
|
@@ -11,6 +11,8 @@ import FlowContextMenu from 'components/FlowContextMenu';
|
|||||||
import useFormatMessage from 'hooks/useFormatMessage';
|
import useFormatMessage from 'hooks/useFormatMessage';
|
||||||
import * as URLS from 'config/urls';
|
import * as URLS from 'config/urls';
|
||||||
import { Apps, CardContent, ContextMenu, Title, Typography } from './style';
|
import { Apps, CardContent, ContextMenu, Title, Typography } from './style';
|
||||||
|
import { FlowPropType } from 'propTypes/propTypes';
|
||||||
|
|
||||||
function getFlowStatusTranslationKey(status) {
|
function getFlowStatusTranslationKey(status) {
|
||||||
if (status === 'published') {
|
if (status === 'published') {
|
||||||
return 'flow.published';
|
return 'flow.published';
|
||||||
@@ -19,6 +21,7 @@ function getFlowStatusTranslationKey(status) {
|
|||||||
}
|
}
|
||||||
return 'flow.draft';
|
return 'flow.draft';
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFlowStatusColor(status) {
|
function getFlowStatusColor(status) {
|
||||||
if (status === 'published') {
|
if (status === 'published') {
|
||||||
return 'success';
|
return 'success';
|
||||||
@@ -27,7 +30,8 @@ function getFlowStatusColor(status) {
|
|||||||
}
|
}
|
||||||
return 'info';
|
return 'info';
|
||||||
}
|
}
|
||||||
export default function FlowRow(props) {
|
|
||||||
|
function FlowRow(props) {
|
||||||
const formatMessage = useFormatMessage();
|
const formatMessage = useFormatMessage();
|
||||||
const contextButtonRef = React.useRef(null);
|
const contextButtonRef = React.useRef(null);
|
||||||
const [anchorEl, setAnchorEl] = React.useState(null);
|
const [anchorEl, setAnchorEl] = React.useState(null);
|
||||||
@@ -113,3 +117,9 @@ export default function FlowRow(props) {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FlowRow.propTypes = {
|
||||||
|
flow: FlowPropType.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default FlowRow;
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
import PropTypes from 'prop-types';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { useLazyQuery } from '@apollo/client';
|
import { useLazyQuery } from '@apollo/client';
|
||||||
import Stack from '@mui/material/Stack';
|
import Stack from '@mui/material/Stack';
|
||||||
@@ -33,8 +34,11 @@ import {
|
|||||||
Wrapper,
|
Wrapper,
|
||||||
} from './style';
|
} from './style';
|
||||||
import isEmpty from 'helpers/isEmpty';
|
import isEmpty from 'helpers/isEmpty';
|
||||||
|
import { StepPropType } from 'propTypes/propTypes';
|
||||||
|
|
||||||
const validIcon = <CheckCircleIcon color="success" />;
|
const validIcon = <CheckCircleIcon color="success" />;
|
||||||
const errorIcon = <ErrorIcon color="error" />;
|
const errorIcon = <ErrorIcon color="error" />;
|
||||||
|
|
||||||
function generateValidationSchema(substeps) {
|
function generateValidationSchema(substeps) {
|
||||||
const fieldValidations = substeps?.reduce(
|
const fieldValidations = substeps?.reduce(
|
||||||
(allValidations, { arguments: args }) => {
|
(allValidations, { arguments: args }) => {
|
||||||
@@ -91,7 +95,8 @@ function generateValidationSchema(substeps) {
|
|||||||
});
|
});
|
||||||
return yupResolver(validationSchema);
|
return yupResolver(validationSchema);
|
||||||
}
|
}
|
||||||
export default function FlowStep(props) {
|
|
||||||
|
function FlowStep(props) {
|
||||||
const { collapsed, onChange, onContinue } = props;
|
const { collapsed, onChange, onContinue } = props;
|
||||||
const editorContext = React.useContext(EditorContext);
|
const editorContext = React.useContext(EditorContext);
|
||||||
const contextButtonRef = React.useRef(null);
|
const contextButtonRef = React.useRef(null);
|
||||||
@@ -309,3 +314,15 @@ export default function FlowStep(props) {
|
|||||||
</Wrapper>
|
</Wrapper>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FlowStep.propTypes = {
|
||||||
|
collapsed: PropTypes.bool,
|
||||||
|
step: StepPropType.isRequired,
|
||||||
|
index: PropTypes.number,
|
||||||
|
onOpen: PropTypes.func,
|
||||||
|
onClose: PropTypes.func,
|
||||||
|
onChange: PropTypes.func.isRequired,
|
||||||
|
onContinue: PropTypes.func,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default FlowStep;
|
||||||
|
@@ -1,9 +1,11 @@
|
|||||||
|
import PropTypes from 'prop-types';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { useMutation } from '@apollo/client';
|
import { useMutation } from '@apollo/client';
|
||||||
import Menu from '@mui/material/Menu';
|
import Menu from '@mui/material/Menu';
|
||||||
import MenuItem from '@mui/material/MenuItem';
|
import MenuItem from '@mui/material/MenuItem';
|
||||||
import { DELETE_STEP } from 'graphql/mutations/delete-step';
|
import { DELETE_STEP } from 'graphql/mutations/delete-step';
|
||||||
import useFormatMessage from 'hooks/useFormatMessage';
|
import useFormatMessage from 'hooks/useFormatMessage';
|
||||||
|
|
||||||
function FlowStepContextMenu(props) {
|
function FlowStepContextMenu(props) {
|
||||||
const { stepId, onClose, anchorEl, deletable } = props;
|
const { stepId, onClose, anchorEl, deletable } = props;
|
||||||
const [deleteStep] = useMutation(DELETE_STEP, {
|
const [deleteStep] = useMutation(DELETE_STEP, {
|
||||||
@@ -32,4 +34,12 @@ function FlowStepContextMenu(props) {
|
|||||||
</Menu>
|
</Menu>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FlowStepContextMenu.propTypes = {
|
||||||
|
stepId: PropTypes.string.isRequired,
|
||||||
|
onClose: PropTypes.func.isRequired,
|
||||||
|
anchorEl: PropTypes.element.isRequired,
|
||||||
|
deletable: PropTypes.bool.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
export default FlowStepContextMenu;
|
export default FlowStepContextMenu;
|
||||||
|
@@ -91,8 +91,8 @@ function TestSubstep(props) {
|
|||||||
severity="error"
|
severity="error"
|
||||||
sx={{ mb: 2, fontWeight: 500, width: '100%' }}
|
sx={{ mb: 2, fontWeight: 500, width: '100%' }}
|
||||||
>
|
>
|
||||||
{serializeErrors(error.graphQLErrors).map((error) => (
|
{serializeErrors(error.graphQLErrors).map((error, i) => (
|
||||||
<div>{error.message}</div>
|
<div key={i}>{error.message}</div>
|
||||||
))}
|
))}
|
||||||
</Alert>
|
</Alert>
|
||||||
)}
|
)}
|
||||||
|
479
packages/web/src/propTypes/propTypes.js
Normal file
479
packages/web/src/propTypes/propTypes.js
Normal file
@@ -0,0 +1,479 @@
|
|||||||
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
|
export const JSONValuePropType = PropTypes.oneOfType([
|
||||||
|
PropTypes.string,
|
||||||
|
PropTypes.number,
|
||||||
|
PropTypes.bool,
|
||||||
|
PropTypes.object,
|
||||||
|
PropTypes.array,
|
||||||
|
]);
|
||||||
|
|
||||||
|
export const AuthenticationStepFieldPropType = PropTypes.shape({
|
||||||
|
name: PropTypes.string,
|
||||||
|
value: PropTypes.oneOfType([PropTypes.string]),
|
||||||
|
properties: PropTypes.arrayOf(
|
||||||
|
PropTypes.shape({
|
||||||
|
name: PropTypes.string,
|
||||||
|
value: PropTypes.string,
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
});
|
||||||
|
|
||||||
|
export const AuthenticationStepPropType = PropTypes.shape({
|
||||||
|
type: PropTypes.oneOf(['mutation', 'openWithPopup']),
|
||||||
|
name: PropTypes.string,
|
||||||
|
arguments: PropTypes.arrayOf(AuthenticationStepFieldPropType),
|
||||||
|
});
|
||||||
|
|
||||||
|
export const FieldTextPropType = PropTypes.shape({
|
||||||
|
key: PropTypes.string,
|
||||||
|
label: PropTypes.string,
|
||||||
|
type: PropTypes.oneOf(['string']),
|
||||||
|
required: PropTypes.bool,
|
||||||
|
readOnly: PropTypes.bool,
|
||||||
|
value: PropTypes.string,
|
||||||
|
placeholder: PropTypes.oneOfType([PropTypes.string]),
|
||||||
|
description: PropTypes.string,
|
||||||
|
docUrl: PropTypes.string,
|
||||||
|
clickToCopy: PropTypes.bool,
|
||||||
|
variables: PropTypes.bool,
|
||||||
|
dependsOn: PropTypes.arrayOf(PropTypes.string),
|
||||||
|
});
|
||||||
|
|
||||||
|
export const FieldDropdownSourcePropType = PropTypes.shape({
|
||||||
|
type: PropTypes.string,
|
||||||
|
name: PropTypes.string,
|
||||||
|
arguments: PropTypes.arrayOf(
|
||||||
|
PropTypes.shape({
|
||||||
|
name: PropTypes.string,
|
||||||
|
value: PropTypes.string,
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
});
|
||||||
|
|
||||||
|
export const FieldDropdownAdditionalFieldsPropType = PropTypes.shape({
|
||||||
|
type: PropTypes.string,
|
||||||
|
name: PropTypes.string,
|
||||||
|
arguments: PropTypes.arrayOf(
|
||||||
|
PropTypes.shape({
|
||||||
|
name: PropTypes.string,
|
||||||
|
value: PropTypes.string,
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
});
|
||||||
|
|
||||||
|
export const FieldDropdownOptionPropType = PropTypes.shape({
|
||||||
|
label: PropTypes.string,
|
||||||
|
value: PropTypes.oneOfType([
|
||||||
|
PropTypes.bool,
|
||||||
|
PropTypes.string,
|
||||||
|
PropTypes.number,
|
||||||
|
]),
|
||||||
|
});
|
||||||
|
|
||||||
|
export const FieldDropdownPropType = PropTypes.shape({
|
||||||
|
key: PropTypes.string,
|
||||||
|
label: PropTypes.string,
|
||||||
|
type: PropTypes.oneOf(['dropdown']),
|
||||||
|
required: PropTypes.bool,
|
||||||
|
readOnly: PropTypes.bool,
|
||||||
|
value: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
||||||
|
placeholder: PropTypes.oneOfType([PropTypes.string]),
|
||||||
|
description: PropTypes.string,
|
||||||
|
docUrl: PropTypes.string,
|
||||||
|
clickToCopy: PropTypes.bool,
|
||||||
|
variables: PropTypes.bool,
|
||||||
|
dependsOn: PropTypes.arrayOf(PropTypes.string),
|
||||||
|
options: PropTypes.arrayOf(FieldDropdownOptionPropType),
|
||||||
|
source: FieldDropdownSourcePropType,
|
||||||
|
additionalFields: FieldDropdownAdditionalFieldsPropType,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const FieldsPropType = PropTypes.arrayOf(
|
||||||
|
PropTypes.oneOfType([FieldDropdownPropType, FieldTextPropType]),
|
||||||
|
);
|
||||||
|
|
||||||
|
export const FieldDynamicPropType = PropTypes.shape({
|
||||||
|
key: PropTypes.string,
|
||||||
|
label: PropTypes.string,
|
||||||
|
type: PropTypes.oneOf(['dynamic']),
|
||||||
|
required: PropTypes.bool,
|
||||||
|
readOnly: PropTypes.bool,
|
||||||
|
description: PropTypes.string,
|
||||||
|
value: PropTypes.arrayOf(PropTypes.object),
|
||||||
|
fields: FieldsPropType,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const FieldPropType = PropTypes.oneOfType([
|
||||||
|
FieldDropdownPropType,
|
||||||
|
FieldTextPropType,
|
||||||
|
FieldDynamicPropType,
|
||||||
|
]);
|
||||||
|
|
||||||
|
export const SubstepPropType = PropTypes.shape({
|
||||||
|
key: PropTypes.string,
|
||||||
|
name: PropTypes.string,
|
||||||
|
arguments: PropTypes.arrayOf(FieldPropType),
|
||||||
|
});
|
||||||
|
|
||||||
|
export const RawTriggerPropType = PropTypes.shape({
|
||||||
|
name: PropTypes.string,
|
||||||
|
key: PropTypes.string,
|
||||||
|
type: PropTypes.oneOf(['webhook', 'polling']),
|
||||||
|
showWebhookUrl: PropTypes.bool,
|
||||||
|
pollInterval: PropTypes.number,
|
||||||
|
description: PropTypes.string,
|
||||||
|
useSingletonWebhook: PropTypes.bool,
|
||||||
|
singletonWebhookRefValueParameter: PropTypes.string,
|
||||||
|
getInterval: PropTypes.func,
|
||||||
|
run: PropTypes.func,
|
||||||
|
testRun: PropTypes.func,
|
||||||
|
registerHook: PropTypes.func,
|
||||||
|
unregisterHook: PropTypes.func,
|
||||||
|
arguments: PropTypes.arrayOf(FieldPropType),
|
||||||
|
});
|
||||||
|
|
||||||
|
export const TriggerPropType = PropTypes.shape({
|
||||||
|
name: PropTypes.string,
|
||||||
|
key: PropTypes.string,
|
||||||
|
type: PropTypes.oneOf(['webhook', 'polling']),
|
||||||
|
showWebhookUrl: PropTypes.bool,
|
||||||
|
pollInterval: PropTypes.number,
|
||||||
|
description: PropTypes.string,
|
||||||
|
useSingletonWebhook: PropTypes.bool,
|
||||||
|
singletonWebhookRefValueParameter: PropTypes.string,
|
||||||
|
getInterval: PropTypes.func,
|
||||||
|
run: PropTypes.func,
|
||||||
|
testRun: PropTypes.func,
|
||||||
|
registerHook: PropTypes.func,
|
||||||
|
unregisterHook: PropTypes.func,
|
||||||
|
substeps: PropTypes.arrayOf(SubstepPropType),
|
||||||
|
});
|
||||||
|
|
||||||
|
export const RawActionPropType = PropTypes.shape({
|
||||||
|
name: PropTypes.string,
|
||||||
|
key: PropTypes.string,
|
||||||
|
description: PropTypes.string,
|
||||||
|
run: PropTypes.func,
|
||||||
|
arguments: PropTypes.arrayOf(FieldPropType),
|
||||||
|
});
|
||||||
|
|
||||||
|
export const ActionPropType = PropTypes.shape({
|
||||||
|
name: PropTypes.string,
|
||||||
|
key: PropTypes.string,
|
||||||
|
description: PropTypes.string,
|
||||||
|
run: PropTypes.func,
|
||||||
|
substeps: PropTypes.arrayOf(SubstepPropType),
|
||||||
|
});
|
||||||
|
|
||||||
|
export const AuthPropType = PropTypes.shape({
|
||||||
|
generateAuthUrl: PropTypes.func,
|
||||||
|
verifyCredentials: PropTypes.func,
|
||||||
|
isStillVerified: PropTypes.func,
|
||||||
|
refreshToken: PropTypes.func,
|
||||||
|
verifyWebhook: PropTypes.func,
|
||||||
|
isRefreshTokenRequested: PropTypes.bool,
|
||||||
|
fields: PropTypes.arrayOf(FieldPropType),
|
||||||
|
authenticationSteps: PropTypes.arrayOf(AuthenticationStepPropType),
|
||||||
|
reconnectionSteps: PropTypes.arrayOf(AuthenticationStepPropType),
|
||||||
|
sharedAuthenticationSteps: PropTypes.arrayOf(AuthenticationStepPropType),
|
||||||
|
sharedReconnectionSteps: PropTypes.arrayOf(AuthenticationStepPropType),
|
||||||
|
});
|
||||||
|
|
||||||
|
export const AppPropType = PropTypes.shape({
|
||||||
|
name: PropTypes.string,
|
||||||
|
key: PropTypes.string,
|
||||||
|
iconUrl: PropTypes.string,
|
||||||
|
docUrl: PropTypes.string,
|
||||||
|
authDocUrl: PropTypes.string,
|
||||||
|
primaryColor: PropTypes.string,
|
||||||
|
supportsConnections: PropTypes.bool,
|
||||||
|
apiBaseUrl: PropTypes.string,
|
||||||
|
baseUrl: PropTypes.string,
|
||||||
|
auth: AuthPropType,
|
||||||
|
connectionCount: PropTypes.number,
|
||||||
|
flowCount: PropTypes.number,
|
||||||
|
beforeRequest: PropTypes.arrayOf(PropTypes.func),
|
||||||
|
dynamicData: PropTypes.object,
|
||||||
|
dynamicFields: PropTypes.object,
|
||||||
|
triggers: PropTypes.arrayOf(TriggerPropType),
|
||||||
|
actions: PropTypes.arrayOf(ActionPropType),
|
||||||
|
});
|
||||||
|
|
||||||
|
export const ConnectionPropType = PropTypes.shape({
|
||||||
|
id: PropTypes.string,
|
||||||
|
key: PropTypes.string,
|
||||||
|
data: PropTypes.string,
|
||||||
|
formattedData: PropTypes.object,
|
||||||
|
userId: PropTypes.string,
|
||||||
|
verified: PropTypes.bool,
|
||||||
|
count: PropTypes.number,
|
||||||
|
flowCount: PropTypes.number,
|
||||||
|
appData: AppPropType,
|
||||||
|
createdAt: PropTypes.string,
|
||||||
|
reconnectable: PropTypes.bool,
|
||||||
|
appAuthClientId: PropTypes.string,
|
||||||
|
});
|
||||||
|
|
||||||
|
AppPropType.connection = PropTypes.arrayOf(ConnectionPropType);
|
||||||
|
|
||||||
|
export const ExecutionStepPropType = PropTypes.shape({
|
||||||
|
id: PropTypes.string,
|
||||||
|
executionId: PropTypes.string,
|
||||||
|
stepId: PropTypes.string,
|
||||||
|
dataIn: PropTypes.object,
|
||||||
|
dataOut: PropTypes.object,
|
||||||
|
errorDetails: PropTypes.object,
|
||||||
|
status: PropTypes.string,
|
||||||
|
createdAt: PropTypes.string,
|
||||||
|
updatedAt: PropTypes.string,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const FlowPropType = PropTypes.shape({
|
||||||
|
id: PropTypes.string,
|
||||||
|
name: PropTypes.string,
|
||||||
|
userId: PropTypes.string,
|
||||||
|
active: PropTypes.bool,
|
||||||
|
status: PropTypes.oneOf(['paused', 'published', 'draft']),
|
||||||
|
createdAt: PropTypes.oneOfType([
|
||||||
|
PropTypes.string,
|
||||||
|
PropTypes.instanceOf(Date),
|
||||||
|
]),
|
||||||
|
updatedAt: PropTypes.oneOfType([
|
||||||
|
PropTypes.string,
|
||||||
|
PropTypes.instanceOf(Date),
|
||||||
|
]),
|
||||||
|
remoteWebhookId: PropTypes.string,
|
||||||
|
lastInternalId: PropTypes.func,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const StepPropType = PropTypes.shape({
|
||||||
|
id: PropTypes.string,
|
||||||
|
name: PropTypes.string,
|
||||||
|
flowId: PropTypes.string,
|
||||||
|
key: PropTypes.string,
|
||||||
|
appKey: PropTypes.string,
|
||||||
|
iconUrl: PropTypes.string,
|
||||||
|
webhookUrl: PropTypes.string,
|
||||||
|
type: PropTypes.oneOf(['action', 'trigger']),
|
||||||
|
connectionId: PropTypes.string,
|
||||||
|
status: PropTypes.string,
|
||||||
|
position: PropTypes.number,
|
||||||
|
parameters: PropTypes.object,
|
||||||
|
connection: ConnectionPropType,
|
||||||
|
flow: FlowPropType,
|
||||||
|
executionSteps: PropTypes.arrayOf(ExecutionStepPropType),
|
||||||
|
output: PropTypes.object,
|
||||||
|
appData: AppPropType,
|
||||||
|
});
|
||||||
|
|
||||||
|
ExecutionStepPropType.step = StepPropType;
|
||||||
|
FlowPropType.steps = PropTypes.arrayOf(StepPropType);
|
||||||
|
|
||||||
|
export const ExecutionPropType = PropTypes.shape({
|
||||||
|
id: PropTypes.string,
|
||||||
|
flowId: PropTypes.string,
|
||||||
|
flow: FlowPropType,
|
||||||
|
testRun: PropTypes.bool,
|
||||||
|
status: PropTypes.oneOf(['success', 'failure']),
|
||||||
|
executionSteps: PropTypes.arrayOf(ExecutionStepPropType),
|
||||||
|
updatedAt: PropTypes.oneOfType([
|
||||||
|
PropTypes.string,
|
||||||
|
PropTypes.instanceOf(Date),
|
||||||
|
]),
|
||||||
|
createdAt: PropTypes.oneOfType([
|
||||||
|
PropTypes.string,
|
||||||
|
PropTypes.instanceOf(Date),
|
||||||
|
]),
|
||||||
|
});
|
||||||
|
|
||||||
|
export const PermissionPropType = PropTypes.shape({
|
||||||
|
id: PropTypes.string,
|
||||||
|
action: PropTypes.string,
|
||||||
|
subject: PropTypes.string,
|
||||||
|
conditions: PropTypes.arrayOf(PropTypes.string),
|
||||||
|
});
|
||||||
|
|
||||||
|
export const RolePropType = PropTypes.shape({
|
||||||
|
id: PropTypes.string,
|
||||||
|
key: PropTypes.string,
|
||||||
|
name: PropTypes.string,
|
||||||
|
description: PropTypes.string,
|
||||||
|
isAdmin: PropTypes.bool,
|
||||||
|
permissions: PropTypes.arrayOf(PermissionPropType),
|
||||||
|
});
|
||||||
|
|
||||||
|
export const UserPropType = PropTypes.shape({
|
||||||
|
id: PropTypes.string,
|
||||||
|
fullName: PropTypes.string,
|
||||||
|
email: PropTypes.string,
|
||||||
|
password: PropTypes.string,
|
||||||
|
connections: PropTypes.arrayOf(ConnectionPropType),
|
||||||
|
flows: PropTypes.arrayOf(FlowPropType),
|
||||||
|
steps: PropTypes.arrayOf(StepPropType),
|
||||||
|
role: RolePropType,
|
||||||
|
permissions: PropTypes.arrayOf(PermissionPropType),
|
||||||
|
createdAt: PropTypes.oneOfType([
|
||||||
|
PropTypes.string,
|
||||||
|
PropTypes.instanceOf(Date),
|
||||||
|
]),
|
||||||
|
updatedAt: PropTypes.oneOfType([
|
||||||
|
PropTypes.string,
|
||||||
|
PropTypes.instanceOf(Date),
|
||||||
|
]),
|
||||||
|
trialExpiryDate: PropTypes.oneOfType([
|
||||||
|
PropTypes.string,
|
||||||
|
PropTypes.instanceOf(Date),
|
||||||
|
]),
|
||||||
|
});
|
||||||
|
|
||||||
|
export const PermissionCatalogPropType = PropTypes.shape({
|
||||||
|
actions: PropTypes.arrayOf(
|
||||||
|
PropTypes.shape({
|
||||||
|
label: PropTypes.string,
|
||||||
|
key: PropTypes.string,
|
||||||
|
subjects: PropTypes.arrayOf(PropTypes.string),
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
subjects: PropTypes.arrayOf(
|
||||||
|
PropTypes.shape({
|
||||||
|
label: PropTypes.string,
|
||||||
|
key: PropTypes.string,
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
conditions: PropTypes.arrayOf(
|
||||||
|
PropTypes.shape({
|
||||||
|
label: PropTypes.string,
|
||||||
|
key: PropTypes.string,
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
});
|
||||||
|
|
||||||
|
export const ConfigPropType = PropTypes.shape({
|
||||||
|
id: PropTypes.string,
|
||||||
|
key: PropTypes.string,
|
||||||
|
value: PropTypes.object,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const TriggerItemPropType = PropTypes.shape({
|
||||||
|
raw: PropTypes.object,
|
||||||
|
meta: PropTypes.shape({
|
||||||
|
internalId: PropTypes.string,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
export const TriggerOutputPropType = PropTypes.shape({
|
||||||
|
data: PropTypes.arrayOf(TriggerItemPropType),
|
||||||
|
error: PropTypes.object,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const ActionItemPropType = PropTypes.shape({
|
||||||
|
raw: PropTypes.object,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const IActionOutputPropType = PropTypes.shape({
|
||||||
|
data: ActionItemPropType,
|
||||||
|
error: PropTypes.object,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const AuthenticationPropType = PropTypes.shape({
|
||||||
|
client: PropTypes.any,
|
||||||
|
verifyCredentials: PropTypes.func,
|
||||||
|
isStillVerified: PropTypes.func,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const PaymentPlanPropType = PropTypes.shape({
|
||||||
|
price: PropTypes.string,
|
||||||
|
name: PropTypes.string,
|
||||||
|
limit: PropTypes.string,
|
||||||
|
productId: PropTypes.string,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const BillingTextCardActionPropType = PropTypes.shape({
|
||||||
|
type: PropTypes.oneOf(['text']),
|
||||||
|
text: PropTypes.string,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const BillingLinkCardActionPropType = PropTypes.shape({
|
||||||
|
type: PropTypes.oneOf(['link']),
|
||||||
|
text: PropTypes.string,
|
||||||
|
src: PropTypes.string,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const BillingCardActionPropType = PropTypes.oneOfType([
|
||||||
|
BillingTextCardActionPropType,
|
||||||
|
BillingLinkCardActionPropType,
|
||||||
|
]);
|
||||||
|
|
||||||
|
export const SubscriptionPropType = PropTypes.shape({
|
||||||
|
status: PropTypes.string,
|
||||||
|
monthlyQuota: PropTypes.shape({
|
||||||
|
title: PropTypes.string,
|
||||||
|
action: BillingCardActionPropType,
|
||||||
|
}),
|
||||||
|
nextBillDate: PropTypes.shape({
|
||||||
|
title: PropTypes.string,
|
||||||
|
action: BillingCardActionPropType,
|
||||||
|
}),
|
||||||
|
nextBillAmount: PropTypes.shape({
|
||||||
|
title: PropTypes.string,
|
||||||
|
action: BillingCardActionPropType,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
export const InvoicePropType = PropTypes.shape({
|
||||||
|
id: PropTypes.number,
|
||||||
|
amount: PropTypes.number,
|
||||||
|
currency: PropTypes.string,
|
||||||
|
payout_date: PropTypes.string,
|
||||||
|
receipt_url: PropTypes.string,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const SamlAuthProviderPropType = PropTypes.shape({
|
||||||
|
id: PropTypes.string,
|
||||||
|
name: PropTypes.string,
|
||||||
|
certificate: PropTypes.string,
|
||||||
|
signatureAlgorithm: PropTypes.oneOf(['sha1', 'sha256', 'sha512']),
|
||||||
|
issuer: PropTypes.string,
|
||||||
|
entryPoint: PropTypes.string,
|
||||||
|
firstnameAttributeName: PropTypes.string,
|
||||||
|
surnameAttributeName: PropTypes.string,
|
||||||
|
emailAttributeName: PropTypes.string,
|
||||||
|
roleAttributeName: PropTypes.string,
|
||||||
|
defaultRoleId: PropTypes.string,
|
||||||
|
active: PropTypes.bool,
|
||||||
|
loginUrl: PropTypes.string,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const SamlAuthProviderRolePropType = PropTypes.shape({
|
||||||
|
id: PropTypes.string,
|
||||||
|
samlAuthProviderId: PropTypes.string,
|
||||||
|
roleId: PropTypes.string,
|
||||||
|
remoteRoleName: PropTypes.string,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const AppConfigPropType = PropTypes.shape({
|
||||||
|
id: PropTypes.string,
|
||||||
|
key: PropTypes.string,
|
||||||
|
allowCustomConnection: PropTypes.bool,
|
||||||
|
canConnect: PropTypes.bool,
|
||||||
|
canCustomConnect: PropTypes.bool,
|
||||||
|
shared: PropTypes.bool,
|
||||||
|
disabled: PropTypes.bool,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const AppAuthClientPropType = PropTypes.shape({
|
||||||
|
id: PropTypes.string,
|
||||||
|
name: PropTypes.string,
|
||||||
|
appConfigId: PropTypes.string,
|
||||||
|
authDefaults: PropTypes.string,
|
||||||
|
formattedAuthDefaults: PropTypes.object,
|
||||||
|
active: PropTypes.bool,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const NotificationPropType = PropTypes.shape({
|
||||||
|
name: PropTypes.string,
|
||||||
|
createdAt: PropTypes.string,
|
||||||
|
documentationUrl: PropTypes.string,
|
||||||
|
description: PropTypes.string,
|
||||||
|
});
|
Reference in New Issue
Block a user