import { IFormField , IFormData } from '@client/forms' ; import { GQLContactPoint } from '@opencrvs/gateway/src/graphql/schema' ; export const phoneNumberToFieldTransformer = ( transformedData , queryData , sectionId , field ) => { if ( queryData [ sectionId ] && queryData [ sectionId ] . telecom ) { ; ( queryData [ sectionId ] . telecom as GQLContactPoint [ ] ) . map ( ( tel ) => { if ( tel . system === 'phone' && tel . value ) { transformedData [ sectionId ] [ field . name ] = tel . value ; } return tel ; } ) ; } return transformedData ; } ; export function getInformantSectionTransformer ( transformedData , queryData , sectionId ) { if ( queryData [ sectionId ] . id && queryData [ sectionId ] . individual && queryData [ sectionId ] . individual . id ) { transformedData [ sectionId ] . _fhirIDMap = { relatedPerson : queryData [ sectionId ] . id , individual : queryData [ sectionId ] . individual . id } ; } if ( queryData [ sectionId ] . relationship ) { transformedData [ sectionId ] . relationship = queryData [ sectionId ] . relationship ; } return transformedData ; }