@@ -97,7 +97,6 @@ import { InformativeRadioGroup } from '@client/views/PrintCertificate/Informativ
9797import { DocumentUploaderWithOption } from './DocumentUploadfield/DocumentUploaderWithOption'
9898import {
9999 WrappedComponentProps as IntlShapeProps ,
100- FormattedMessage ,
101100 MessageDescriptor ,
102101 useIntl
103102} from 'react-intl'
@@ -114,11 +113,7 @@ import { IOfflineData, LocationType } from '@client/offline/reducer'
114113import { isEqual , flatten } from 'lodash'
115114import { SimpleDocumentUploader } from './DocumentUploadfield/SimpleDocumentUploader'
116115import { getOfflineData } from '@client/offline/selectors'
117- import {
118- dynamicDispatch ,
119- IDeclaration ,
120- writeDeclaration
121- } from '@client/declarations'
116+ import { dynamicDispatch } from '@client/declarations'
122117import { useDispatch , useSelector } from 'react-redux'
123118import { LocationSearch } from '@opencrvs/components/lib/LocationSearch'
124119import { REGEXP_NUMBER_INPUT_NON_NUMERIC } from '@client/utils/constants'
@@ -131,16 +126,7 @@ import { IBaseAdvancedSearchState } from '@client/search/advancedSearch/utils'
131126import { UserDetails } from '@client/utils/userUtils'
132127import { VerificationButton } from '@opencrvs/components/lib/VerificationButton'
133128import { useOnlineStatus } from '@client/utils'
134- import {
135- match ,
136- RouteComponentProps ,
137- useHistory ,
138- useLocation ,
139- useRouteMatch ,
140- withRouter
141- } from 'react-router'
142- import { saveDraftAndRedirectToNidIntegration } from '@client/views/OIDPVerificationCallback/utils'
143- import { getDraftsState } from '@client/declarations/selectors'
129+ import { useNidAuthentication } from '@client/views/OIDPVerificationCallback/utils'
144130import { BulletList , Divider } from '@opencrvs/components'
145131import { Heading2 , Heading3 } from '@opencrvs/components/lib/Headings/Headings'
146132
@@ -778,7 +764,7 @@ interface IFormSectionProps {
778764interface IStateProps {
779765 offlineCountryConfig : IOfflineData
780766 userDetails : UserDetails | null
781- declarations : IDeclaration [ ] | null
767+ onNidAuthenticationClick : ( ) => void
782768}
783769
784770interface IDispatchProps {
@@ -789,7 +775,7 @@ type Props = IFormSectionProps &
789775 IStateProps &
790776 IDispatchProps &
791777 FormikProps < IFormSectionData > &
792- IntlShapeProps & { match : match }
778+ IntlShapeProps
793779
794780interface IQueryData {
795781 [ key : string ] : any
@@ -1072,29 +1058,7 @@ class FormSectionComponent extends React.Component<Props> {
10721058 : field . type === NID_VERIFICATION_BUTTON
10731059 ? ( {
10741060 ...field ,
1075- onClick : ( ) => {
1076- const matchParams = this . props . match . params as {
1077- declarationId : string
1078- groupId : string
1079- pageId : string
1080- }
1081- const declaration = this . props . declarations ?. find (
1082- ( declaration ) =>
1083- declaration . id === matchParams . declarationId
1084- )
1085- if ( ! declaration ) {
1086- return
1087- }
1088- saveDraftAndRedirectToNidIntegration (
1089- declaration ,
1090- writeDeclaration ,
1091- offlineCountryConfig ,
1092- matchParams . declarationId ,
1093- matchParams . pageId ,
1094- this . props . match . url
1095- )
1096- }
1097- //TODO: HANDLE FETCH FOR NID
1061+ onClick : this . props . onNidAuthenticationClick
10981062 } as INidVerificationButton )
10991063 : field
11001064
@@ -1270,8 +1234,7 @@ export const FormFieldGenerator: React.FC<IFormSectionProps> = (props) => {
12701234 const userDetails = useSelector ( getUserDetails )
12711235 const intl = useIntl ( )
12721236 const dispatch = useDispatch ( )
1273- const match = useRouteMatch ( )
1274- const { declarations } = useSelector ( getDraftsState )
1237+ const { onClick : onNidAuthenticationClick } = useNidAuthentication ( )
12751238
12761239 return (
12771240 < Formik < IFormSectionData >
@@ -1297,8 +1260,7 @@ export const FormFieldGenerator: React.FC<IFormSectionProps> = (props) => {
12971260 offlineCountryConfig = { offlineCountryConfig }
12981261 userDetails = { userDetails }
12991262 dynamicDispatch = { ( ...args ) => dispatch ( dynamicDispatch ( ...args ) ) }
1300- match = { match }
1301- declarations = { declarations }
1263+ onNidAuthenticationClick = { onNidAuthenticationClick }
13021264 />
13031265 ) }
13041266 </ Formik >
0 commit comments