@velocitycareerlabs/velocity-registrar-app 1.25.0-dev-build.1ffdaffeb → 1.25.0-dev-build.19bb85136

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@velocitycareerlabs/velocity-registrar-app",
3
- "version": "1.25.0-dev-build.1ffdaffeb",
3
+ "version": "1.25.0-dev-build.19bb85136",
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": "7de2c807fa0972674b42dd5baeaa56ca3de9793f"
62
+ "gitHead": "36c3692cba550b579912ada72e41ce048449dfe8"
63
63
  }
@@ -1,5 +1,4 @@
1
- import React, { useEffect } from 'react';
2
- import { useGetOne } from 'react-admin';
1
+ import React from 'react';
3
2
  import PropTypes from 'prop-types';
4
3
  import { useSelectedOrganization } from '@velocitycareerlabs/components-organizations-registrar';
5
4
  import { Popup } from '@velocitycareerlabs/components-organizations-registrar/components/common';
@@ -7,7 +6,7 @@ import { Loading } from '@velocitycareerlabs/components-organizations-registrar/
7
6
 
8
7
  import { SecureMessageURL } from '../SecureMessageUrl/index.jsx';
9
8
  import { SecureTransfer } from '../SecureTransfer/index.jsx';
10
- import { dataResources } from '../../../../utils/remoteDataProvider';
9
+ import { useSecureSkip } from '../../hooks/useSecureSkip';
11
10
 
12
11
  export const SecureIntegrationPopup = ({
13
12
  isInterceptOnCreateOpen,
@@ -19,25 +18,18 @@ export const SecureIntegrationPopup = ({
19
18
  }) => {
20
19
  const [did] = useSelectedOrganization();
21
20
 
22
- const { data: secureMessageTransfer, isLoading: isCheckingCAOSecureTranferSupport } = useGetOne(
23
- dataResources.SECURE_MESSAGE_SUPPORTED,
24
- {
25
- id: selectedCAO,
26
- },
27
- {
28
- enabled: !!selectedCAO && isIssueOrInspection,
29
- },
30
- );
21
+ const { isLoading } = useSecureSkip({
22
+ isInterceptOnCreateOpen,
23
+ isIssueOrInspection,
24
+ selectedCAO,
25
+ onClose,
26
+ });
31
27
 
32
- useEffect(() => {
33
- if (secureMessageTransfer && !secureMessageTransfer?.supported) {
34
- onClose();
35
- }
36
- }, [secureMessageTransfer, onClose]);
28
+ if (isInterceptOnCreateOpen && isIssueOrInspection && isLoading) {
29
+ return <Loading sx={styles.loading} />;
30
+ }
37
31
 
38
- return isIssueOrInspection && isCheckingCAOSecureTranferSupport ? (
39
- <Loading sx={styles.loading} />
40
- ) : (
32
+ return (
41
33
  <Popup
42
34
  onClose={() => {}}
43
35
  title=""
@@ -0,0 +1,24 @@
1
+ import { useEffect } from 'react';
2
+ import { useGetOne } from 'react-admin';
3
+ import { dataResources } from '../../../utils/remoteDataProvider';
4
+
5
+ export const useSecureSkip = ({
6
+ isInterceptOnCreateOpen,
7
+ isIssueOrInspection,
8
+ selectedCAO,
9
+ onClose,
10
+ }) => {
11
+ const { data, isLoading } = useGetOne(
12
+ dataResources.SECURE_MESSAGE_SUPPORTED,
13
+ { id: selectedCAO },
14
+ { enabled: !!selectedCAO && isIssueOrInspection },
15
+ );
16
+
17
+ useEffect(() => {
18
+ if (isInterceptOnCreateOpen && data?.supported === false) {
19
+ onClose();
20
+ }
21
+ }, [isInterceptOnCreateOpen, data?.supported, onClose]);
22
+
23
+ return { isLoading };
24
+ };