Skip to content

Commit c34b041

Browse files
committed
Merge branch 'dev' into bal-4241-create-zod-schema-for-ui-definition-validation
2 parents 93e3a9e + 4b8d1a2 commit c34b041

File tree

169 files changed

+4856
-1324
lines changed

Some content is hidden

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

169 files changed

+4856
-1324
lines changed

.cursor/rules/workflows-service.mdc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
description: Workflow Service Rules
33
globs: ["services/workflows-service/**/*.{ts}"]
4+
45
---
56
### Code Organization & Structure
67

.vscode/extensions.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"bradlc.vscode-tailwindcss",
99
"github.vscode-github-actions",
1010
"streetsidesoftware.code-spell-checker",
11-
"orta.vscode-jest"
11+
"orta.vscode-jest",
12+
"alefragnani.bookmarks"
1213
]
1314
}

.vscode/settings.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,7 @@
1313
"**/data-migrations": false
1414
},
1515
"search.followSymlinks": true,
16-
"search.useIgnoreFiles": false
16+
"search.useIgnoreFiles": false,
17+
"bookmarks.saveBookmarksInProject": true,
18+
"bookmarks.saveBookmarksInProjectFilePath": ".vscode/bookmarks.json"
1719
}

apps/backoffice-v2/CHANGELOG.md

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

3+
## 0.7.171
4+
5+
### Patch Changes
6+
7+
- Updated dependencies
8+
- @ballerine/ui@0.7.171
9+
- @ballerine/react-pdf-toolkit@1.2.131
10+
11+
## 0.7.170
12+
13+
### Patch Changes
14+
15+
- Updated dependencies
16+
- @ballerine/common@0.9.118
17+
- @ballerine/workflow-browser-sdk@0.6.142
18+
- @ballerine/workflow-node-sdk@0.6.142
19+
20+
## 0.7.169
21+
22+
### Patch Changes
23+
24+
- Updated dependencies
25+
- @ballerine/ui@0.7.169
26+
- @ballerine/react-pdf-toolkit@1.2.130
27+
28+
## 0.7.168
29+
30+
### Patch Changes
31+
32+
- Updated dependencies
33+
- @ballerine/ui@0.7.168
34+
- @ballerine/react-pdf-toolkit@1.2.129
35+
36+
## 0.7.167
37+
38+
### Patch Changes
39+
40+
- Updated dependencies
41+
- @ballerine/common@0.9.117
42+
- @ballerine/ui@0.7.167
43+
- @ballerine/workflow-browser-sdk@0.6.141
44+
- @ballerine/react-pdf-toolkit@1.2.128
45+
- @ballerine/workflow-node-sdk@0.6.141
46+
47+
## 0.7.166
48+
49+
### Patch Changes
50+
51+
- Updated dependencies
52+
- @ballerine/common@0.9.116
53+
- @ballerine/workflow-browser-sdk@0.6.140
54+
- @ballerine/workflow-node-sdk@0.6.140
55+
56+
## 0.7.165
57+
58+
### Patch Changes
59+
60+
- Updated dependencies
61+
- @ballerine/common@0.9.115
62+
- @ballerine/workflow-browser-sdk@0.6.139
63+
- @ballerine/workflow-node-sdk@0.6.139
64+
65+
## 0.7.164
66+
67+
### Patch Changes
68+
69+
- version bump
70+
- Updated dependencies
71+
- @ballerine/ui@0.7.164
72+
- @ballerine/react-pdf-toolkit@1.2.127
73+
74+
## 0.7.163
75+
76+
### Patch Changes
77+
78+
- bump
79+
- Updated dependencies
80+
- @ballerine/workflow-browser-sdk@0.6.137
81+
- @ballerine/workflow-node-sdk@0.6.137
82+
- @ballerine/common@0.9.113
83+
- @ballerine/ui@0.7.163
84+
- @ballerine/react-pdf-toolkit@1.2.126
85+
386
## 0.7.162
487

588
### 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.162",
3+
"version": "0.7.171",
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.125",
56-
"@ballerine/ui": "0.7.162",
55+
"@ballerine/react-pdf-toolkit": "^1.2.131",
56+
"@ballerine/ui": "0.7.171",
5757
"@ballerine/blocks": "0.2.47",
58-
"@ballerine/common": "0.9.112",
59-
"@ballerine/workflow-browser-sdk": "0.6.135",
60-
"@ballerine/workflow-node-sdk": "0.6.135",
58+
"@ballerine/common": "0.9.118",
59+
"@ballerine/workflow-browser-sdk": "0.6.142",
60+
"@ballerine/workflow-node-sdk": "0.6.142",
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
}),
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
export class HttpError extends Error {
2-
constructor(public code: number, public message: string) {
2+
constructor(
3+
public code: number,
4+
public message: string,
5+
public errors?: Array<{ message: string; path?: string }>,
6+
) {
37
super(message);
48
}
59
}

apps/backoffice-v2/src/common/utils/fetcher/fetcher.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,14 @@ export const fetcher: IFetcher = async ({
5252
let message = `${res.statusText} (${res.status})`;
5353

5454
if (res.status === 400) {
55-
const json = await res.json();
55+
const json = (await res.json()) as { errors?: Array<{ message: string }>; message?: string };
5656

5757
if (Array.isArray(json?.errors)) {
5858
message = json?.errors?.map(({ message }) => `${message}\n`)?.join('');
5959
} else if (json.message) {
6060
message = json.message;
6161
}
62+
throw new HttpError(res.status, message, json?.errors);
6263
}
6364

6465
console.error(message);

apps/backoffice-v2/src/domains/business-reports/hooks/mutations/useCreateBusinessReportBatchMutation/useCreateBusinessReportBatchMutation.tsx

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ export const useCreateBusinessReportBatchMutation = ({
1111
reportType,
1212
workflowVersion,
1313
onSuccess,
14+
onError,
1415
}: {
1516
reportType: MerchantReportType;
1617
workflowVersion: string;
1718
onSuccess?: <TData>(data: TData) => void;
19+
onError?: (error: HttpError) => void;
1820
}) => {
1921
const queryClient = useQueryClient();
2022

@@ -36,18 +38,6 @@ export const useCreateBusinessReportBatchMutation = ({
3638

3739
onSuccess?.(data);
3840
},
39-
onError: (error: unknown) => {
40-
if (error instanceof HttpError && error.code === 400) {
41-
toast.error(error.message);
42-
43-
return;
44-
}
45-
46-
toast.error(
47-
t(`toast:batch_business_report_creation.error`, {
48-
errorMessage: isObject(error) && 'message' in error ? error.message : error,
49-
}),
50-
);
51-
},
41+
onError,
5242
});
5343
};

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
}),

0 commit comments

Comments
 (0)