Skip to content

Commit 5dfd727

Browse files
authored
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 612ff39 commit 5dfd727

File tree

16 files changed

+57
-25
lines changed

16 files changed

+57
-25
lines changed

apps/backoffice-v2/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
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+
311
## 0.7.168
412

513
### Patch Changes

apps/backoffice-v2/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ballerine/backoffice-v2",
3-
"version": "0.7.168",
3+
"version": "0.7.169",
44
"description": "Ballerine - Backoffice",
55
"homepage": "https://github.com/ballerine-io/ballerine",
66
"type": "module",
@@ -52,8 +52,8 @@
5252
"preview": "vite preview"
5353
},
5454
"dependencies": {
55-
"@ballerine/react-pdf-toolkit": "^1.2.129",
56-
"@ballerine/ui": "0.7.168",
55+
"@ballerine/react-pdf-toolkit": "^1.2.130",
56+
"@ballerine/ui": "0.7.169",
5757
"@ballerine/blocks": "0.2.47",
5858
"@ballerine/common": "0.9.117",
5959
"@ballerine/workflow-browser-sdk": "0.6.141",

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

Lines changed: 2 additions & 6 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']),

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

Lines changed: 9 additions & 1 deletion
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,7 +46,7 @@ export const EndUserSchema = z.object({
3846
}),
3947
})
4048
.optional(),
41-
variant: z.enum(['director', 'ubo']).optional(),
49+
variant: z.enum(['director', 'ubo']).optional().nullable(),
4250
createdFrom: z.enum(['user', 'analyst', 'registry']).nullable().optional(),
4351
});
4452

apps/backoffice-v2/src/lib/blocks/hooks/useDocumentBlocks/hooks/useDocuments/useDocuments.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ export const useDocuments = (workflow: TWorkflowById) => {
3636
useUbosDocuments(workflow as TWorkflowById),
3737
];
3838

39-
console.log('ubo documents', ubosDocuments);
40-
4139
const businessDocumentsWithEntity = useMemo(
4240
() =>
4341
businessDocuments.map(document => ({

apps/backoffice-v2/src/pages/Entities/components/CaseCreation/components/CaseCreationForm/utils/transform-errors.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ export const transformErrors = (errors: RJSFValidationError[]): RJSFValidationEr
4848
}.`;
4949
}
5050

51-
if (errorCopy.params?.format === 'email') {
52-
errorCopy.message = 'Please provide valid email address.';
51+
if (errorCopy.params?.pattern) {
52+
errorCopy.message = `Text must match the pattern ${errorCopy.params.pattern}`;
5353
}
5454

5555
return errorCopy;

apps/kyb-app/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# kyb-app
22

3+
## 0.3.198
4+
5+
### Patch Changes
6+
7+
- Bump
8+
- Updated dependencies
9+
- @ballerine/ui@0.7.169
10+
311
## 0.3.197
412

513
### Patch Changes

apps/kyb-app/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@ballerine/kyb-app",
33
"private": true,
4-
"version": "0.3.197",
4+
"version": "0.3.198",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",
@@ -18,7 +18,7 @@
1818
"dependencies": {
1919
"@ballerine/blocks": "0.2.47",
2020
"@ballerine/common": "^0.9.117",
21-
"@ballerine/ui": "0.7.168",
21+
"@ballerine/ui": "0.7.169",
2222
"@ballerine/workflow-browser-sdk": "0.6.141",
2323
"@lukemorales/query-key-factory": "^1.0.3",
2424
"@radix-ui/react-icons": "^1.3.0",

packages/react-pdf-toolkit/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# @ballerine/react-pdf-toolkit
22

3+
## 1.2.130
4+
5+
### Patch Changes
6+
7+
- Updated dependencies
8+
- @ballerine/ui@0.7.169
9+
310
## 1.2.129
411

512
### Patch Changes

packages/react-pdf-toolkit/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@ballerine/react-pdf-toolkit",
33
"private": false,
4-
"version": "1.2.129",
4+
"version": "1.2.130",
55
"types": "./dist/build.d.ts",
66
"main": "./dist/react-pdf-toolkit.js",
77
"module": "./dist/react-pdf-toolkit.mjs",
@@ -27,7 +27,7 @@
2727
},
2828
"dependencies": {
2929
"@ballerine/config": "^1.1.44",
30-
"@ballerine/ui": "0.7.168",
30+
"@ballerine/ui": "0.7.169",
3131
"@react-pdf/renderer": "^3.1.14",
3232
"@sinclair/typebox": "^0.31.7",
3333
"ajv": "^8.12.0",

0 commit comments

Comments
 (0)