@velocitycareerlabs/velocity-registrar-app 1.26.0-dev-build.1bc131916 → 1.26.0-dev-build.1cbfe6788
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/pages/services/ServiceEditForm.jsx +6 -0
- package/src/pages/services/ServiceList.jsx +10 -1
- package/src/pages/services/components/SecureIntegrationPopup/index.jsx +5 -0
- package/src/pages/services/components/SecureMessageUrl/index.jsx +23 -3
- package/src/pages/services/hooks/useAdditionalServiceProperties.js +31 -0
- package/src/pages/services/hooks/useSecureSkip.js +6 -2
- package/src/utils/remoteDataProvider.js +10 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@velocitycareerlabs/velocity-registrar-app",
|
|
3
|
-
"version": "1.26.0-dev-build.
|
|
3
|
+
"version": "1.26.0-dev-build.1cbfe6788",
|
|
4
4
|
"description": "Velocity Registrar",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"publishConfig": {
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"not ie <= 11",
|
|
60
60
|
"not op_mini all"
|
|
61
61
|
],
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "6f3a0a290a380bc0d88730b0fb5320d7032cb3df"
|
|
63
63
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ServicesEdit as ServicesEditmBase } from '@velocitycareerlabs/components-organizations-registrar/components/services';
|
|
2
|
+
import { SecureIntegrationPopup } from './components/SecureIntegrationPopup/index.jsx';
|
|
3
|
+
|
|
4
|
+
export const ServicesEdit = (props) => {
|
|
5
|
+
return <ServicesEditmBase {...props} InterceptOnCreate={SecureIntegrationPopup} />;
|
|
6
|
+
};
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { ServicesList as ServicesListBase } from '@velocitycareerlabs/components-organizations-registrar/pages/services';
|
|
2
2
|
import { ServiceCreateForm } from './ServiceCreateForm.jsx';
|
|
3
|
+
import { ServicesEdit } from './ServiceEditForm.jsx';
|
|
4
|
+
import { useAdditionalServiceProperties } from './hooks/useAdditionalServiceProperties';
|
|
3
5
|
|
|
4
6
|
export const ServicesList = () => {
|
|
5
|
-
|
|
7
|
+
const additionalServiceProperties = useAdditionalServiceProperties();
|
|
8
|
+
return (
|
|
9
|
+
<ServicesListBase
|
|
10
|
+
CreateComponent={ServiceCreateForm}
|
|
11
|
+
EditComponent={ServicesEdit}
|
|
12
|
+
AdditionalServiceProperties={additionalServiceProperties}
|
|
13
|
+
/>
|
|
14
|
+
);
|
|
6
15
|
};
|
|
@@ -15,14 +15,17 @@ export const SecureIntegrationPopup = ({
|
|
|
15
15
|
onClose,
|
|
16
16
|
isIssueOrInspection,
|
|
17
17
|
selectedCAO,
|
|
18
|
+
isCAO,
|
|
18
19
|
}) => {
|
|
19
20
|
const [did] = useSelectedOrganization();
|
|
20
21
|
|
|
21
22
|
const { isLoading } = useSecureSkip({
|
|
22
23
|
isInterceptOnCreateOpen,
|
|
23
24
|
isIssueOrInspection,
|
|
25
|
+
isCAO,
|
|
24
26
|
selectedCAO,
|
|
25
27
|
onClose,
|
|
28
|
+
serviceId,
|
|
26
29
|
});
|
|
27
30
|
|
|
28
31
|
if (isInterceptOnCreateOpen && isIssueOrInspection && isLoading) {
|
|
@@ -36,6 +39,7 @@ export const SecureIntegrationPopup = ({
|
|
|
36
39
|
isOpen={isInterceptOnCreateOpen}
|
|
37
40
|
mainContainerStyles={styles.mainContainer}
|
|
38
41
|
disableCloseButton={true}
|
|
42
|
+
hideBackground={true}
|
|
39
43
|
>
|
|
40
44
|
{isIssueOrInspection ? (
|
|
41
45
|
<SecureTransfer serviceId={serviceId} did={did} onClose={onClose} />
|
|
@@ -58,5 +62,6 @@ SecureIntegrationPopup.propTypes = {
|
|
|
58
62
|
onNext: PropTypes.func.isRequired,
|
|
59
63
|
onClose: PropTypes.func.isRequired,
|
|
60
64
|
isIssueOrInspection: PropTypes.bool.isRequired,
|
|
65
|
+
isCAO: PropTypes.bool.isRequired,
|
|
61
66
|
selectedCAO: PropTypes.string,
|
|
62
67
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React, { useState, useCallback } from 'react';
|
|
2
|
-
import { Form, FormDataConsumer, TextInput } from 'react-admin';
|
|
2
|
+
import { Form, FormDataConsumer, TextInput, useGetOne } from 'react-admin';
|
|
3
3
|
import { Box, Button, Stack, Typography } from '@mui/material';
|
|
4
4
|
import CheckCircleIcon from '@mui/icons-material/CheckCircle';
|
|
5
5
|
import CancelIcon from '@mui/icons-material/Cancel';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
|
|
8
8
|
import { validateUrlOptional } from '../../utils/index.jsx';
|
|
9
|
+
import { dataResources } from '../../../../utils/remoteDataProvider';
|
|
9
10
|
import { useSecureMessageTest } from '../../hooks/useSecureMessageTest';
|
|
10
11
|
import { TestSecureMessageWarning } from './TestSecureMessageWarning/index.jsx';
|
|
11
12
|
import { SaveButton } from './SaveButton/index.jsx';
|
|
@@ -15,6 +16,12 @@ import { TrackTestStatus } from './TrackTestStatus/index.jsx';
|
|
|
15
16
|
export const SecureMessageURL = ({ did, onSave: onSaveCallback, onSkip }) => {
|
|
16
17
|
const [isWarningModalOpen, setIsWarningModalOpen] = useState(false);
|
|
17
18
|
|
|
19
|
+
const { data: secureData, isLoading } = useGetOne(
|
|
20
|
+
dataResources.SECURE_MESSAGE_GET,
|
|
21
|
+
{ id: did },
|
|
22
|
+
{ enabled: !!did },
|
|
23
|
+
);
|
|
24
|
+
|
|
18
25
|
const { onTest, testPassed, testError, testInProgress, tested, reset, onSave, saveInProgress } =
|
|
19
26
|
useSecureMessageTest({
|
|
20
27
|
did,
|
|
@@ -43,7 +50,15 @@ export const SecureMessageURL = ({ did, onSave: onSaveCallback, onSkip }) => {
|
|
|
43
50
|
that the webhook is active and responding before setting this value otherwise the profile
|
|
44
51
|
cannot be saved.
|
|
45
52
|
</Typography>
|
|
46
|
-
<
|
|
53
|
+
<Typography sx={styles.note}>
|
|
54
|
+
Note: This value is shared by all Credential Agent Services and updating it will affect them
|
|
55
|
+
all
|
|
56
|
+
</Typography>
|
|
57
|
+
<Form
|
|
58
|
+
onSubmit={handleSave}
|
|
59
|
+
mode="onChange"
|
|
60
|
+
defaultValues={{ secureMessagesUrl: secureData?.secureMessagesUrl || '' }}
|
|
61
|
+
>
|
|
47
62
|
<TrackTestStatus tested={tested} reset={reset} />
|
|
48
63
|
<FormDataConsumer>
|
|
49
64
|
{({ formData }) => (
|
|
@@ -80,7 +95,7 @@ export const SecureMessageURL = ({ did, onSave: onSaveCallback, onSkip }) => {
|
|
|
80
95
|
</Button>
|
|
81
96
|
<SaveButton
|
|
82
97
|
saveInProgress={saveInProgress || testInProgress}
|
|
83
|
-
disabled={testError}
|
|
98
|
+
disabled={isLoading || testError}
|
|
84
99
|
/>
|
|
85
100
|
</Box>
|
|
86
101
|
<TestSecureMessageWarning
|
|
@@ -148,6 +163,11 @@ const styles = {
|
|
|
148
163
|
borderColor: 'secondary.light',
|
|
149
164
|
color: 'text.primary',
|
|
150
165
|
},
|
|
166
|
+
note: {
|
|
167
|
+
fontWeight: '600',
|
|
168
|
+
marginTop: '16px',
|
|
169
|
+
letterSpacing: '0.02em',
|
|
170
|
+
},
|
|
151
171
|
};
|
|
152
172
|
// eslint-disable-next-line better-mutation/no-mutation
|
|
153
173
|
SecureMessageURL.propTypes = {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { useGetOne } from 'react-admin';
|
|
3
|
+
import {
|
|
4
|
+
useSelectedOrganization,
|
|
5
|
+
CREDENTIAL_TYPES_IDS,
|
|
6
|
+
} from '@velocitycareerlabs/components-organizations-registrar';
|
|
7
|
+
import { dataResources } from '../../../utils/remoteDataProvider';
|
|
8
|
+
|
|
9
|
+
export const useAdditionalServiceProperties = () => {
|
|
10
|
+
const [did] = useSelectedOrganization();
|
|
11
|
+
|
|
12
|
+
const { data: secureData, isLoading } = useGetOne(
|
|
13
|
+
dataResources.SECURE_MESSAGE_GET,
|
|
14
|
+
{ id: did },
|
|
15
|
+
{ enabled: !!did },
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
const additionalServiceProperties = useMemo(() => {
|
|
19
|
+
if (isLoading || !secureData) {
|
|
20
|
+
return {};
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
[CREDENTIAL_TYPES_IDS.VLC_CREDENTIAL_AGENT_OPERATOR]: {
|
|
24
|
+
name: 'Secure URL',
|
|
25
|
+
value: secureData.secureMessagesUrl,
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
}, [isLoading, secureData]);
|
|
29
|
+
|
|
30
|
+
return additionalServiceProperties;
|
|
31
|
+
};
|
|
@@ -5,8 +5,10 @@ import { dataResources } from '../../../utils/remoteDataProvider';
|
|
|
5
5
|
export const useSecureSkip = ({
|
|
6
6
|
isInterceptOnCreateOpen,
|
|
7
7
|
isIssueOrInspection,
|
|
8
|
+
isCAO,
|
|
8
9
|
selectedCAO,
|
|
9
10
|
onClose,
|
|
11
|
+
serviceId,
|
|
10
12
|
}) => {
|
|
11
13
|
const { data, isLoading } = useGetOne(
|
|
12
14
|
dataResources.SECURE_MESSAGE_SUPPORTED,
|
|
@@ -15,10 +17,12 @@ export const useSecureSkip = ({
|
|
|
15
17
|
);
|
|
16
18
|
|
|
17
19
|
useEffect(() => {
|
|
18
|
-
|
|
20
|
+
const otherServiceTypes = !isCAO && !isIssueOrInspection;
|
|
21
|
+
|
|
22
|
+
if (isInterceptOnCreateOpen && (data?.supported === false || !serviceId || otherServiceTypes)) {
|
|
19
23
|
onClose();
|
|
20
24
|
}
|
|
21
|
-
}, [isInterceptOnCreateOpen, data?.supported, onClose]);
|
|
25
|
+
}, [isInterceptOnCreateOpen, data?.supported, onClose, serviceId, isCAO, isIssueOrInspection]);
|
|
22
26
|
|
|
23
27
|
return { isLoading };
|
|
24
28
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export const dataResources = {
|
|
2
2
|
SECURE_MESSAGE_TEST: 'test-url',
|
|
3
3
|
SECURE_MESSAGE_SAVE: 'set-url',
|
|
4
|
+
SECURE_MESSAGE_GET: 'get-url',
|
|
4
5
|
SECURE_MESSAGE_SUPPORTED: 'are-supported',
|
|
5
6
|
SECURE_MESSAGE_TRANSFER: 'transfer-keys',
|
|
6
7
|
};
|
|
@@ -17,6 +18,15 @@ export const extendedRemoteDataProvider = () => {
|
|
|
17
18
|
};
|
|
18
19
|
});
|
|
19
20
|
}
|
|
21
|
+
case dataResources.SECURE_MESSAGE_GET: {
|
|
22
|
+
return client(
|
|
23
|
+
`${apiUrl}/${dataResourcesBase.ORGANIZATIONS}/${params.id}/secure-cao-messages/${resource}`,
|
|
24
|
+
).then(({ json }) => {
|
|
25
|
+
return {
|
|
26
|
+
data: { ...json, id: new Date().getTime() },
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
}
|
|
20
30
|
default: {
|
|
21
31
|
return baseDataProvider.getOne(resource, params);
|
|
22
32
|
}
|