Skip to content

Commit 33e0ec4

Browse files
authored
dev to sb (#3420)
* BAL-3932: Create directors with entity.variant of director (#3399) * feat: added variant to end user & updated entity creation & updated endpoints * feat: updated context schema & dto fix * chore: lock fix * chore: bump * Bal 4297 documents tracker mapping (#3402) * feat: added variant to end user & updated entity creation & updated endpoints * feat: reworked documents mapping & fixed state computation * fix: post merge fix * fix: added assert valid project ids * chore: bump kyb & ui (#3415) * fix: fixed edit buttons (#3417) * fix: added handling for pattern errors & schema fixes (#3416) * fix: added handling for pattern errors & schema fixes * feat: added flags support to pattern validator * chore: bump * fix: fixed schema * chore: cleaned logs * feat: reorganized schemas
1 parent 2093cc5 commit 33e0ec4

File tree

64 files changed

+18611
-50468
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+18611
-50468
lines changed

apps/backoffice-v2/CHANGELOG.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,32 @@
11
# @ballerine/backoffice-v2
22

3+
## 0.7.169
4+
5+
### Patch Changes
6+
7+
- Updated dependencies
8+
- @ballerine/ui@0.7.169
9+
- @ballerine/react-pdf-toolkit@1.2.130
10+
11+
## 0.7.168
12+
13+
### Patch Changes
14+
15+
- Updated dependencies
16+
- @ballerine/ui@0.7.168
17+
- @ballerine/react-pdf-toolkit@1.2.129
18+
19+
## 0.7.167
20+
21+
### Patch Changes
22+
23+
- Updated dependencies
24+
- @ballerine/common@0.9.117
25+
- @ballerine/ui@0.7.167
26+
- @ballerine/workflow-browser-sdk@0.6.141
27+
- @ballerine/react-pdf-toolkit@1.2.128
28+
- @ballerine/workflow-node-sdk@0.6.141
29+
330
## 0.7.166
431

532
### Patch Changes

apps/backoffice-v2/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ballerine/backoffice-v2",
3-
"version": "0.7.166",
3+
"version": "0.7.169",
44
"description": "Ballerine - Backoffice",
55
"homepage": "https://github.com/ballerine-io/ballerine",
66
"type": "module",
@@ -52,12 +52,12 @@
5252
"preview": "vite preview"
5353
},
5454
"dependencies": {
55-
"@ballerine/react-pdf-toolkit": "^1.2.127",
56-
"@ballerine/ui": "0.7.164",
55+
"@ballerine/react-pdf-toolkit": "^1.2.130",
56+
"@ballerine/ui": "0.7.169",
5757
"@ballerine/blocks": "0.2.47",
58-
"@ballerine/common": "0.9.116",
59-
"@ballerine/workflow-browser-sdk": "0.6.140",
60-
"@ballerine/workflow-node-sdk": "0.6.140",
58+
"@ballerine/common": "0.9.117",
59+
"@ballerine/workflow-browser-sdk": "0.6.141",
60+
"@ballerine/workflow-node-sdk": "0.6.141",
6161
"@fontsource/inter": "^4.5.15",
6262
"@formkit/auto-animate": "0.8.2",
6363
"@hookform/resolvers": "^3.1.0",

apps/backoffice-v2/src/common/components/molecules/DocumentTracker/hooks/useDocumentTracker.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export const useDocumentTracker = ({ workflowId }: { workflowId: string }) => {
4646
templateId: identifier.document.type,
4747
entity: {
4848
id: identifier.entity.id,
49-
type: identifier.entity.entityType,
49+
type: identifier.entity.variant,
5050
},
5151
})),
5252
}),

apps/backoffice-v2/src/domains/documents/schemas.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
import { ObjectWithIdSchema } from '@/lib/zod/utils/object-with-id/object-with-id';
22
import { z } from 'zod';
3+
import { EndUserVariantSchema, EntityType } from '../individuals/fetchers';
34

45
export const EndUserSchema = ObjectWithIdSchema.extend({
56
firstName: z.string(),
67
lastName: z.string(),
8+
variant: EndUserVariantSchema.optional().nullable(),
79
});
810

9-
export const EntityType = {
10-
BUSINESS: 'business',
11-
UBO: 'ubo',
12-
DIRECTOR: 'director',
13-
} as const;
14-
1511
export const DocumentTrackerItemSchema = z.object({
1612
documentId: z.string().nullable(),
1713
status: z.enum(['provided', 'unprovided', 'requested']),
@@ -25,16 +21,16 @@ export const DocumentTrackerItemSchema = z.object({
2521
issuingVersion: z.string(),
2622
version: z.string(),
2723
}),
28-
entity: z.discriminatedUnion('entityType', [
24+
entity: z.discriminatedUnion('variant', [
2925
ObjectWithIdSchema.extend({
30-
entityType: z.literal(EntityType.BUSINESS),
26+
variant: z.literal(EntityType.BUSINESS),
3127
companyName: z.string(),
3228
}),
3329
EndUserSchema.extend({
34-
entityType: z.literal(EntityType.UBO),
30+
variant: z.literal(EntityType.UBO),
3531
}),
3632
EndUserSchema.extend({
37-
entityType: z.literal(EntityType.DIRECTOR),
33+
variant: z.literal(EntityType.DIRECTOR),
3834
}),
3935
]),
4036
}),

apps/backoffice-v2/src/domains/individuals/fetchers.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ import { HitSchema } from '@/lib/blocks/components/AmlBlock/utils/aml-adapter';
88

99
import { apiClient } from '@/common/api-client/api-client';
1010

11+
export const EntityType = {
12+
BUSINESS: 'business',
13+
UBO: 'ubo',
14+
DIRECTOR: 'director',
15+
} as const;
16+
17+
export const EndUserVariantSchema = z.enum([EntityType.UBO, EntityType.DIRECTOR]);
18+
1119
export const EndUserSchema = z.object({
1220
id: z.string(),
1321
firstName: z.string(),
@@ -38,6 +46,7 @@ export const EndUserSchema = z.object({
3846
}),
3947
})
4048
.optional(),
49+
variant: z.enum(['director', 'ubo']).optional().nullable(),
4150
createdFrom: z.enum(['user', 'analyst', 'registry']).nullable().optional(),
4251
});
4352

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { TWorkflowById } from '@/domains/workflows/fetchers';
2-
import { selectDirectors } from '@/pages/Entity/selectors/selectDirectors';
32

43
export const getDirectorsIdsFromWorkflow = (workflow: TWorkflowById) =>
5-
selectDirectors(workflow)
6-
.map(director => director.ballerineEntityId)
7-
.filter(Boolean);
4+
workflow.endUsers?.filter(endUser => endUser.variant === 'director').map(endUser => endUser.id) ||
5+
[];

apps/backoffice-v2/src/lib/blocks/hooks/useDirectorsDocuments/useDirectorsDocuments.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export const useDirectorsDocuments = (workflow: TWorkflowById) => {
99

1010
const { documents, documentsSchemas, isLoading } = useWorkflowDocumentsAdapter({
1111
entityIds,
12+
// TODO: Remove once documents v1 are deprecated
1213
documents: (workflow?.context?.entity?.data?.additionalInfo?.directors?.flatMap(
1314
director => director.documents ?? [],
1415
) ?? []) as TDocument[],

apps/backoffice-v2/src/lib/blocks/hooks/useEntityInfoBlock/useEntityInfoBlock.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,5 +117,5 @@ export const useEntityInfoBlock = ({
117117
.buildFlat(),
118118
})
119119
.build();
120-
}, [entity, workflow]);
120+
}, [entity, workflow, onEdit, isEditDisabled]);
121121
};

apps/backoffice-v2/src/lib/blocks/hooks/useKYCBusinessInformationBlock/useKYCBusinessInformationBlock.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { useEntityInfoBlock } from '@/lib/blocks/hooks/useEntityInfoBlock/useEnt
44
import { useCaseState } from '@/pages/Entity/components/Case/hooks/useCaseState/useCaseState';
55
import { useCurrentCaseQuery } from '@/pages/Entity/hooks/useCurrentCaseQuery/useCurrentCaseQuery';
66
import { StateTag } from '@ballerine/common';
7+
import { EDIT_TEMPLATES } from '@/pages/Entity/components/Case/components/CaseOptions/hooks/useEditCollectionFlow';
78

89
export const useKYCBusinessInformationBlock = () => {
910
const { data: workflow } = useCurrentCaseQuery();
@@ -19,7 +20,7 @@ export const useKYCBusinessInformationBlock = () => {
1920
...entityDataAdditionalInfo
2021
} = workflow?.context?.entity?.data?.additionalInfo ?? {};
2122

22-
const { onEditCollectionFlow } = useEditCollectionFlow();
23+
const { onEditCollectionFlow } = useEditCollectionFlow(EDIT_TEMPLATES.COMPANY_DETAILS);
2324
const { data: session } = useAuthenticatedUserQuery();
2425
const caseState = useCaseState(session?.user ?? null, workflow);
2526

@@ -31,7 +32,7 @@ export const useKYCBusinessInformationBlock = () => {
3132
!workflow?.tags?.includes(StateTag.MANUAL_REVIEW),
3233
!workflow?.workflowDefinition?.config?.editableContext?.entityInfo,
3334
].some(Boolean),
34-
onEdit: onEditCollectionFlow({ steps: ['company_details'] }),
35+
onEdit: onEditCollectionFlow,
3536
});
3637

3738
return blocks;
Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,7 @@
11
import { TWorkflowById } from '@/domains/workflows/fetchers';
22

33
export const getUbosEntityIdsFromWorkflow = (workflow: TWorkflowById) => {
4-
const directorsIds =
5-
workflow?.context?.entity?.data?.additionalInfo?.directors
6-
?.map(director => director.ballerineEntityId)
7-
.filter(Boolean) ?? [];
8-
94
return (
10-
workflow?.childWorkflows
11-
?.filter(
12-
childWorkflow =>
13-
childWorkflow.context?.entity?.variant === 'ubo' &&
14-
!directorsIds.includes(childWorkflow.context?.entity?.ballerineEntityId),
15-
)
16-
?.map(childWorkflow => childWorkflow.context?.entity?.ballerineEntityId)
17-
.filter(Boolean) ?? []
5+
workflow.endUsers?.filter(endUser => endUser.variant === 'ubo').map(endUser => endUser.id) || []
186
);
197
};

0 commit comments

Comments
 (0)