Skip to content

Commit 0a60f65

Browse files
Merge branch 'dev' into bal-2806
2 parents d0964e2 + cb1d027 commit 0a60f65

File tree

90 files changed

+1574
-903
lines changed

Some content is hidden

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

90 files changed

+1574
-903
lines changed

apps/backoffice-v2/CHANGELOG.md

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

3+
## 0.7.51
4+
5+
### Patch Changes
6+
7+
- Updated dependencies
8+
- @ballerine/common@0.9.36
9+
- @ballerine/workflow-browser-sdk@0.6.48
10+
- @ballerine/workflow-node-sdk@0.6.48
11+
12+
## 0.7.50
13+
14+
### Patch Changes
15+
16+
- Updated dependencies
17+
- @ballerine/common@0.9.35
18+
- @ballerine/workflow-browser-sdk@0.6.47
19+
- @ballerine/workflow-node-sdk@0.6.47
20+
21+
## 0.7.49
22+
23+
### Patch Changes
24+
25+
- Bump
26+
- Updated dependencies
27+
- @ballerine/blocks@0.2.20
28+
- @ballerine/common@0.9.34
29+
- @ballerine/react-pdf-toolkit@1.2.34
30+
- @ballerine/ui@0.5.34
31+
- @ballerine/workflow-browser-sdk@0.6.46
32+
- @ballerine/workflow-node-sdk@0.6.46
33+
34+
## 0.7.48
35+
36+
### Patch Changes
37+
38+
- @ballerine/workflow-browser-sdk@0.6.45
39+
- @ballerine/workflow-node-sdk@0.6.45
40+
41+
## 0.7.47
42+
43+
### Patch Changes
44+
45+
- Bump
46+
- Updated dependencies
47+
- @ballerine/common@0.9.33
48+
- @ballerine/blocks@0.2.19
49+
- @ballerine/react-pdf-toolkit@1.2.33
50+
- @ballerine/ui@0.5.33
51+
- @ballerine/workflow-browser-sdk@0.6.44
52+
- @ballerine/workflow-node-sdk@0.6.44
53+
354
## 0.7.46
455

556
### Patch Changes

apps/backoffice-v2/package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ballerine/backoffice-v2",
3-
"version": "0.7.46",
3+
"version": "0.7.51",
44
"description": "Ballerine - Backoffice",
55
"homepage": "https://github.com/ballerine-io/ballerine",
66
"repository": {
@@ -50,12 +50,12 @@
5050
"preview": "vite preview"
5151
},
5252
"dependencies": {
53-
"@ballerine/blocks": "0.2.18",
54-
"@ballerine/common": "0.9.32",
55-
"@ballerine/react-pdf-toolkit": "^1.2.31",
56-
"@ballerine/ui": "^0.5.31",
57-
"@ballerine/workflow-browser-sdk": "0.6.43",
58-
"@ballerine/workflow-node-sdk": "0.6.43",
53+
"@ballerine/blocks": "0.2.20",
54+
"@ballerine/common": "0.9.36",
55+
"@ballerine/react-pdf-toolkit": "^1.2.34",
56+
"@ballerine/ui": "^0.5.34",
57+
"@ballerine/workflow-browser-sdk": "0.6.48",
58+
"@ballerine/workflow-node-sdk": "0.6.48",
5959
"@botpress/webchat": "^2.1.10",
6060
"@botpress/webchat-generator": "^0.2.9",
6161
"@fontsource/inter": "^4.5.15",
@@ -98,7 +98,7 @@
9898
"i18next-http-backend": "^2.1.1",
9999
"leaflet": "^1.9.4",
100100
"libphonenumber-js": "^1.10.49",
101-
"lucide-react": "^0.239.0",
101+
"lucide-react": "^0.445.0",
102102
"match-sorter": "^6.3.1",
103103
"msw": "^1.0.0",
104104
"posthog-js": "^1.154.2",
@@ -126,8 +126,8 @@
126126
"zod": "^3.22.3"
127127
},
128128
"devDependencies": {
129-
"@ballerine/config": "^1.1.16",
130-
"@ballerine/eslint-config-react": "^2.0.16",
129+
"@ballerine/config": "^1.1.18",
130+
"@ballerine/eslint-config-react": "^2.0.18",
131131
"@cspell/cspell-types": "^6.31.1",
132132
"@faker-js/faker": "^7.6.0",
133133
"@playwright/test": "^1.32.1",

apps/backoffice-v2/public/locales/en/toast.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@
8181
"pdf_certificate": {
8282
"error": "Failed to open PDF certificate."
8383
},
84+
"document_ocr": {
85+
"success": "OCR performed successfully.",
86+
"error": "Failed to perform OCR on the document."
87+
},
8488
"business_report_creation": {
8589
"success": "Merchant check created successfully.",
8690
"error": "Error occurred while creating a merchant check.",
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { ctw } from '@/common/utils/ctw/ctw';
2+
import { ComponentProps, FunctionComponent } from 'react';
3+
import { Loader2, ScanTextIcon } from 'lucide-react';
4+
5+
export interface IImageOCR extends ComponentProps<'button'> {
6+
onOcrPressed?: () => void;
7+
isOcrDisabled: boolean;
8+
isLoadingOCR?: boolean;
9+
}
10+
11+
export const ImageOCR: FunctionComponent<IImageOCR> = ({
12+
isOcrDisabled,
13+
onOcrPressed,
14+
className,
15+
isLoadingOCR,
16+
...props
17+
}) => (
18+
<button
19+
{...props}
20+
type="button"
21+
className={ctw(
22+
'btn btn-circle btn-ghost btn-sm bg-base-300/70 text-[0.688rem] focus:outline-primary disabled:bg-base-300/70',
23+
isLoadingOCR,
24+
className,
25+
)}
26+
onClick={() => onOcrPressed?.()}
27+
disabled={isOcrDisabled || isLoadingOCR}
28+
>
29+
{isLoadingOCR ? (
30+
<Loader2 className="animate-spin stroke-foreground" />
31+
) : (
32+
<ScanTextIcon className={'p-0.5'} />
33+
)}
34+
</button>
35+
);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const CustomerSchema = z.object({
2727
createBusinessReportBatch: z
2828
.object({ enabled: z.boolean().default(false), options: createBusinessReportOptions })
2929
.optional(),
30+
isDocumentOcrEnabled: z.boolean().default(false).optional(),
3031
})
3132
.nullable(),
3233
config: z
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { useMutation, useQueryClient } from '@tanstack/react-query';
2+
import { fetchWorkflowDocumentOCRResult } from '@/domains/workflows/fetchers';
3+
import { toast } from 'sonner';
4+
import { t } from 'i18next';
5+
import { workflowsQueryKeys } from '@/domains/workflows/query-keys';
6+
import { useFilterId } from '@/common/hooks/useFilterId/useFilterId';
7+
8+
export const useDocumentOcr = ({ workflowId }: { workflowId: string }) => {
9+
const filterId = useFilterId();
10+
const workflowById = workflowsQueryKeys.byId({ workflowId, filterId });
11+
const queryClient = useQueryClient();
12+
13+
return useMutation({
14+
mutationFn: ({ documentId }: { documentId: string }) => {
15+
return fetchWorkflowDocumentOCRResult({
16+
workflowRuntimeId: workflowId,
17+
documentId,
18+
});
19+
},
20+
onSuccess: (data, variables) => {
21+
void queryClient.invalidateQueries(workflowsQueryKeys._def);
22+
toast.success(t('toast:document_ocr.success'));
23+
},
24+
onError: (error, variables) => {
25+
console.error('OCR error:', error, 'for document:', variables.documentId);
26+
void queryClient.invalidateQueries(workflowsQueryKeys._def);
27+
toast.error(t('toast:document_ocr.error'));
28+
},
29+
});
30+
};

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,3 +298,21 @@ export const createWorkflowRequest = async ({
298298

299299
return handleZodError(error, workflow);
300300
};
301+
302+
export const fetchWorkflowDocumentOCRResult = async ({
303+
workflowRuntimeId,
304+
documentId,
305+
}: {
306+
workflowRuntimeId: string;
307+
documentId: string;
308+
}) => {
309+
const [workflow, error] = await apiClient({
310+
method: Method.GET,
311+
url: `${getOriginUrl(
312+
env.VITE_API_URL,
313+
)}/api/v1/internal/workflows/${workflowRuntimeId}/documents/${documentId}/run-ocr`,
314+
schema: z.any(),
315+
});
316+
317+
return handleZodError(error, workflow);
318+
};

apps/backoffice-v2/src/index.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,11 @@
135135
}
136136
}
137137
}
138+
139+
a.bpComposerPoweredBy {
140+
display: none !important;
141+
}
142+
143+
button.bpModalDialogNewConversationButton {
144+
background-color: var(--bpPrimary-500) !important;
145+
}

apps/backoffice-v2/src/lib/blocks/components/CallToActionLegacy/hooks/useCallToActionLegacyLogic/useCallToActionLegacyLogic.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { CommonWorkflowEvent } from '@ballerine/common';
21
import { ComponentProps, FunctionComponent, useCallback, useEffect, useState } from 'react';
32
import { toast } from 'sonner';
43
import { useApproveTaskByIdMutation } from '../../../../../../domains/entities/hooks/mutations/useApproveTaskByIdMutation/useApproveTaskByIdMutation';

apps/backoffice-v2/src/lib/blocks/components/CaseCallToActionLegacy/CaseCallToActionLegacy.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ export const CaseCallToActionLegacy: FunctionComponent<ICaseCallToActionLegacyPr
132132
<DialogFooter>
133133
<DialogClose asChild>
134134
<Button
135-
className={ctw(`gap-x-2`, {
135+
className={ctw(`gap-x-2 !bg-foreground`, {
136136
loading: isLoadingRevisionCase,
137137
})}
138138
disabled={isLoadingRevisionCase}

0 commit comments

Comments
 (0)