File tree Expand file tree Collapse file tree 3 files changed +21
-19
lines changed
apps/kyb-app/src/pages/CollectionFlow/versions/v2
services/workflows-service Expand file tree Collapse file tree 3 files changed +21
-19
lines changed Original file line number Diff line number Diff line change @@ -61,31 +61,21 @@ export const CollectionFlowV2 = withSessionProtected(() => {
6161 setLogoLoaded ( false ) ;
6262 } , [ customer ?. logoImageUri ] ) ;
6363
64- if (
65- getCollectionFlowState ( collectionFlowData ?. context ) ?. status ===
66- CollectionFlowStatusesEnum . approved
67- ) {
64+ const collectionFlowState = getCollectionFlowState ( collectionFlowData ?. context ) ?. status ;
65+
66+ if ( collectionFlowState === CollectionFlowStatusesEnum . approved ) {
6867 return < Approved /> ;
6968 }
7069
71- if (
72- getCollectionFlowState ( collectionFlowData ?. context ) ?. status ===
73- CollectionFlowStatusesEnum . rejected
74- ) {
70+ if ( collectionFlowState === CollectionFlowStatusesEnum . rejected ) {
7571 return < Rejected /> ;
7672 }
7773
78- if (
79- getCollectionFlowState ( collectionFlowData ?. context ) ?. status ===
80- CollectionFlowStatusesEnum . completed
81- ) {
74+ if ( collectionFlowState === CollectionFlowStatusesEnum . completed ) {
8275 return < CompletedScreen redirectUrl = { successRedirectUrl } /> ;
8376 }
8477
85- if (
86- getCollectionFlowState ( collectionFlowData ?. context ) ?. status ===
87- CollectionFlowStatusesEnum . failed
88- ) {
78+ if ( collectionFlowState === CollectionFlowStatusesEnum . failed ) {
8979 return < FailedScreen redirectUrl = { failureRedirectUrl } /> ;
9080 }
9181
Original file line number Diff line number Diff line change @@ -63,6 +63,8 @@ import {
6363 isType ,
6464 ProcessStatus ,
6565 setCollectionFlowStatus ,
66+ StateTag ,
67+ TStateTag ,
6668 TWorkflowHelpers ,
6769} from '@ballerine/common' ;
6870import {
@@ -1389,10 +1391,20 @@ export class WorkflowService {
13891391 // assign runtime to user, copy the context.
13901392 const currentState = data . state ;
13911393
1394+ const finalStateTags : TStateTag [ ] = [ StateTag . APPROVED , StateTag . REJECTED ] ;
1395+
13921396 // eslint-disable-next-line @typescript-eslint/ban-ts-comment
13931397 // @ts -ignore
1394- // TODO: Use snapshot.done instead
1395- const isFinal = workflowDef . definition ?. states ?. [ currentState ] ?. type === 'final' ;
1398+ const stateHasFinalStateTags = workflowDef . definition ?. states ?. [ currentState ] ?. tags ?. some (
1399+ ( tag : TStateTag ) => finalStateTags . includes ( tag ) ,
1400+ ) ;
1401+
1402+ const isFinal =
1403+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1404+ // @ts -ignore
1405+ // TODO: Use snapshot.done instead
1406+ workflowDef . definition ?. states ?. [ currentState ] ?. type === 'final' || stateHasFinalStateTags ;
1407+
13961408 const isResolved = isFinal || data . status === WorkflowRuntimeDataStatus . completed ;
13971409
13981410 const customer = await this . customerService . getByProjectId ( projectId ) ;
You can’t perform that action at this time.
0 commit comments