@@ -26,7 +26,7 @@ import {
2626} from '@/pages/Entity/components/Case/components/CaseOptions/hooks/useEditCollectionFlow' ;
2727import { computeIndividualKycCheckStatus } from './compute-individual-kyc-check-status' ;
2828import { useMutateIndividualApprovalDecision } from '@/domains/individuals/mutations/useMutateIndividualApprovalDecision/useMutateIndividualApprovalDecision' ;
29- import { EndUserApprovalState } from '@/domains/individuals/fetchers' ;
29+ import { EndUserApprovalState , TEndUser } from '@/domains/individuals/fetchers' ;
3030
3131export type TCaseBlocksCreationProps = {
3232 workflow : TWorkflowById ;
@@ -174,9 +174,10 @@ export const useTabsToBlocksMap = ({
174174 const initiateSanctionsScreeningEvent = getInitiateSanctionsScreeningEvent (
175175 childWorkflow ?. nextEvents ?? [ ] ,
176176 ) ;
177- const endUser = endUsers ?. find (
178- endUser => endUser . id === childWorkflow ?. context ?. entity ?. data ?. ballerineEntityId ,
179- ) ;
177+ const endUser =
178+ endUsers ?. find (
179+ endUser => endUser . id === childWorkflow ?. context ?. entity ?. data ?. ballerineEntityId ,
180+ ) || ( { } as TEndUser ) ;
180181 const {
181182 amlHits,
182183 id : _id ,
@@ -185,7 +186,7 @@ export const useTabsToBlocksMap = ({
185186 gender,
186187 individualVerificationsChecks,
187188 ...endUserRest
188- } = endUser ?? { } ;
189+ } = endUser ;
189190 const {
190191 gender : genderAdditionalInfo ,
191192 dateOfBirth : dateOfBirthAdditionalInfo ,
@@ -419,8 +420,10 @@ export const useTabsToBlocksMap = ({
419420 ) ,
420421 )
421422 ?. map ( director => {
422- const endUser = endUsers ?. find ( endUser => endUser . id === director . ballerineEntityId ) ;
423- const { amlHits, individualVerificationsChecks, ...directorEndUser } = endUser ?? { } ;
423+ const endUser =
424+ endUsers ?. find ( endUser => endUser . id === director . ballerineEntityId ) ||
425+ ( { } as TEndUser ) ;
426+ const { amlHits, individualVerificationsChecks, ...directorEndUser } = endUser ;
424427 const status = computeIndividualKycCheckStatus ( {
425428 endUser,
426429 tags : [ ] ,
@@ -447,7 +450,8 @@ export const useTabsToBlocksMap = ({
447450 } : NonNullable <
448451 TWorkflowById [ 'context' ] [ 'entity' ] [ 'data' ] [ 'additionalInfo' ] [ 'peopleOfInterest' ]
449452 > [ number ] ) => {
450- const endUser = endUsers ?. find ( endUser => endUser . id === ballerineEntityId ) ;
453+ const endUser =
454+ endUsers ?. find ( endUser => endUser . id === ballerineEntityId ) || ( { } as TEndUser ) ;
451455 const {
452456 id : _id ,
453457 amlHits,
0 commit comments