Skip to content

Commit

Permalink
chore: clean up E-Signet / OIDP verification button code (#7862)
Browse files Browse the repository at this point in the history
* chore: clean up oidpcallback frontend code

* chore: clean up verificationbutton

* chore: remove the backend functionality

* revert: codegen changes

* chore: remove oidp related changes from client/utils/gateway.ts
  • Loading branch information
naftis authored Oct 29, 2024
1 parent a55dd49 commit 74c5f3f
Show file tree
Hide file tree
Showing 35 changed files with 40 additions and 2,689 deletions.
515 changes: 33 additions & 482 deletions packages/client/graphql.schema.json

Large diffs are not rendered by default.

10 changes: 0 additions & 10 deletions packages/client/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ import { AdministrativeLevels } from '@client/views/Organisation/AdministrativeL
import { VerifyCertificatePage } from '@client/views/VerifyCertificate/VerifyCertificatePage'
import { IssueCertificate } from '@client/views/IssueCertificate/IssueCertificate'
import { IssuePayment } from '@client/views/IssueCertificate/IssueCollectorForm/IssuePayment'
import { OIDPVerificationCallback } from './views/OIDPVerificationCallback/OIDPVerificationCallback'
import { ApolloProvider } from '@client/utils/ApolloProvider'
import { Home } from '@client/views/OfficeHome/Home'
import { PrintRecord } from './views/PrintRecord/PrintRecord'
Expand Down Expand Up @@ -533,15 +532,6 @@ export function App(props: IAppProps) {
}
component={IssuePayment}
/>
<ProtectedRoute
exact
path={
routes.OIDP_VERIFICATION_CALLBACK
}
component={
OIDPVerificationCallback
}
/>
<ProtectedRoute
exact
path={routes.PRINT_RECORD}
Expand Down
30 changes: 0 additions & 30 deletions packages/client/src/components/form/FormFieldGenerator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ import {
DATE_RANGE_PICKER,
IDateRangePickerValue,
TIME,
NID_VERIFICATION_BUTTON,
INidVerificationButton,
DIVIDER,
HEADING3,
SUBSECTION_HEADER,
Expand Down Expand Up @@ -132,9 +130,6 @@ import { buttonMessages } from '@client/i18n/messages/buttons'
import { DateRangePickerForFormField } from '@client/components/DateRangePickerForFormField'
import { IAdvancedSearchFormState } from '@client/search/advancedSearch/utils'
import { UserDetails } from '@client/utils/userUtils'
import { VerificationButton } from '@opencrvs/components/lib/VerificationButton'
import { useOnlineStatus } from '@client/utils'
import { useNidAuthentication } from '@client/views/OIDPVerificationCallback/utils'
import { BulletList, Divider, InputLabel, Stack } from '@opencrvs/components'
import { Heading2, Heading3 } from '@opencrvs/components/lib/Headings/Headings'
import { SignatureUploader } from './SignatureField/SignatureUploader'
Expand Down Expand Up @@ -235,7 +230,6 @@ const GeneratedInputField = React.memo<GeneratedInputFieldProps>(
(val: string) => setFieldValue(fieldDefinition.name, val),
[fieldDefinition.name, setFieldValue]
)
const isOnline = useOnlineStatus()

const inputProps = {
id: fieldDefinition.name,
Expand Down Expand Up @@ -615,21 +609,6 @@ const GeneratedInputField = React.memo<GeneratedInputFieldProps>(
)
}

if (fieldDefinition.type === NID_VERIFICATION_BUTTON) {
return (
<InputField {...inputFieldProps}>
<VerificationButton
id={fieldDefinition.name}
onClick={fieldDefinition.onClick}
labelForVerified={fieldDefinition.labelForVerified}
labelForUnverified={fieldDefinition.labelForUnverified}
labelForOffline={fieldDefinition.labelForOffline}
status={!isOnline ? 'offline' : value ? 'verified' : 'unverified'}
/>
</InputField>
)
}

if (fieldDefinition.type === REDIRECT) {
return (
<RedirectField
Expand Down Expand Up @@ -791,7 +770,6 @@ interface IFormSectionProps {
interface IStateProps {
offlineCountryConfig: IOfflineData
userDetails: UserDetails | null
onNidAuthenticationClick: () => void
}

interface IDispatchProps {
Expand Down Expand Up @@ -1120,18 +1098,12 @@ class FormSectionComponent extends React.Component<Props> {
field.searchableType as LocationType[]
)
}
: field.type === NID_VERIFICATION_BUTTON
? ({
...field,
onClick: this.props.onNidAuthenticationClick
} as INidVerificationButton)
: field

if (
field.type === FETCH_BUTTON ||
field.type === FIELD_WITH_DYNAMIC_DEFINITIONS ||
field.type === SELECT_WITH_DYNAMIC_OPTIONS ||
field.type === NID_VERIFICATION_BUTTON ||
field.type === BUTTON
) {
return (
Expand Down Expand Up @@ -1311,7 +1283,6 @@ export const FormFieldGenerator: React.FC<IFormSectionProps> = (props) => {
const userDetails = useSelector(getUserDetails)
const intl = useIntl()
const dispatch = useDispatch()
const { onClick: onNidAuthenticationClick } = useNidAuthentication()

return (
<Formik<IFormSectionData>
Expand Down Expand Up @@ -1345,7 +1316,6 @@ export const FormFieldGenerator: React.FC<IFormSectionProps> = (props) => {
offlineCountryConfig={offlineCountryConfig}
userDetails={userDetails}
dynamicDispatch={(...args) => dispatch(dynamicDispatch(...args))}
onNidAuthenticationClick={onNidAuthenticationClick}
/>
)}
</Formik>
Expand Down
16 changes: 0 additions & 16 deletions packages/client/src/forms/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ export const DYNAMIC_LIST = 'DYNAMIC_LIST'
export const FETCH_BUTTON = 'FETCH_BUTTON'
export const LOCATION_SEARCH_INPUT = 'LOCATION_SEARCH_INPUT'
export const TIME = 'TIME'
export const NID_VERIFICATION_BUTTON = 'NID_VERIFICATION_BUTTON'
export const DIVIDER = 'DIVIDER'
export const HEADING3 = 'HEADING3'
export const SIGNATURE = 'SIGNATURE'
Expand Down Expand Up @@ -716,12 +715,6 @@ export interface ITimeFormFIeld extends IFormFieldBase {
type: typeof TIME
ignorePlaceHolder?: boolean
}
export interface INidVerificationButton extends IFormFieldBase {
type: typeof NID_VERIFICATION_BUTTON
labelForVerified: MessageDescriptor
labelForUnverified: MessageDescriptor
labelForOffline: MessageDescriptor
}

export interface ISignatureFormField extends IFormFieldBase {
type: typeof SIGNATURE
Expand Down Expand Up @@ -790,7 +783,6 @@ export type IFormField =
| ILocationSearchInputFormField
| IDateRangePickerFormField
| ITimeFormFIeld
| INidVerificationButton
| IDividerFormField
| ISignatureFormField
| IHttpFormField
Expand Down Expand Up @@ -1231,13 +1223,6 @@ export interface Ii18nLoaderButtonField extends Ii18nFormFieldBase {
errorText: string
networkErrorText: string
}
export interface Ii18nNidVerificationButtonField extends Ii18nFormFieldBase {
type: typeof NID_VERIFICATION_BUTTON
onClick: () => void
labelForVerified: string
labelForUnverified: string
labelForOffline: string
}

export interface I18nDividerField extends Ii18nFormFieldBase {
type: typeof DIVIDER
Expand Down Expand Up @@ -1317,7 +1302,6 @@ export type Ii18nFormField =
| Ii18nLocationSearchInputFormField
| Ii18nDateRangePickerFormField
| Ii18nTimeFormField
| Ii18nNidVerificationButtonField
| I18nDividerField
| I18nHeading3Field
| Ii18nSignatureField
Expand Down
14 changes: 0 additions & 14 deletions packages/client/src/forms/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ import {
FIELD_WITH_DYNAMIC_DEFINITIONS,
IRadioGroupWithNestedFieldsFormField,
ISelectFormFieldWithOptions,
NID_VERIFICATION_BUTTON,
INidVerificationButton,
BULLET_LIST,
HIDDEN,
Ii18nHiddenFormField,
Expand Down Expand Up @@ -190,18 +188,6 @@ export const internationaliseFieldObject = (
)
}

if (base.type === NID_VERIFICATION_BUTTON) {
;(base as any).labelForVerified = intl.formatMessage(
(field as INidVerificationButton).labelForVerified
)
;(base as any).labelForUnverified = intl.formatMessage(
(field as INidVerificationButton).labelForUnverified
)
;(base as any).labelForOffline = intl.formatMessage(
(field as INidVerificationButton).labelForOffline
)
}

if (isFieldButton(field)) {
;(base as Ii18nButtonFormField).buttonLabel = intl.formatMessage(
field.buttonLabel
Expand Down
33 changes: 0 additions & 33 deletions packages/client/src/i18n/messages/views/nidVerificationCallback.ts

This file was deleted.

2 changes: 0 additions & 2 deletions packages/client/src/navigation/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,4 @@ export const VIEW_RECORD = '/:declarationId/viewRecord'
export const VIEW_VERIFY_CERTIFICATE = '/verify-certificate/:declarationId'
export const ORGANISATIONS_INDEX = '/organisation/:locationId?'

export const OIDP_VERIFICATION_CALLBACK = '/mosip-callback'

export const PRINT_RECORD = '/print-record/:declarationId'
8 changes: 0 additions & 8 deletions packages/client/src/setupTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,3 @@ vi.mock('react-router', async () => ({
section: 'child'
}))
}))

vi.mock('@client/views/OIDPVerificationCallback/utils', async () => ({
...((await vi.importActual(
'@client/views/OIDPVerificationCallback/utils'
)) as any),
useExtractCallBackState: vi.fn(),
useQueryParams: vi.fn()
}))
46 changes: 0 additions & 46 deletions packages/client/src/tests/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1179,39 +1179,6 @@ input ObservationFHIRIDS {
lastPreviousLiveBirth: String
}

type OIDPUserAddress {
formatted: String
street_address: String
locality: String
region: String
postal_code: String
city: String
country: String
}

type OIDPUserInfo {
sub: String!
name: String
given_name: String
family_name: String
middle_name: String
nickname: String
preferred_username: String
profile: String
picture: String
website: String
email: String
email_verified: Boolean
gender: String
birthdate: String
zoneinfo: String
locale: String
phone_number: String
phone_number_verified: Boolean
address: OIDPUserAddress
updated_at: Int
}

type OperationHistorySearchSet {
operationType: String
operatedOn: Date
Expand Down Expand Up @@ -1455,12 +1422,6 @@ type Query {
getActiveCertificatesSVG: [CertificateSVG!]
fetchSystem(clientId: ID!): System
informantSMSNotifications: [SMSNotification!]
getOIDPUserInfo(
code: String!
clientId: String!
redirectUri: String!
grantType: String
): UserInfo
}

type QuestionnaireQuestion {
Expand Down Expand Up @@ -1944,13 +1905,6 @@ input UserIdentifierInput {
value: String
}

type UserInfo {
oidpUserInfo: OIDPUserInfo
districtFhirId: String
stateFhirId: String
locationLevel3FhirId: String
}

input UserInput {
id: ID
name: [HumanNameInput!]!
Expand Down
Loading

0 comments on commit 74c5f3f

Please sign in to comment.