Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:ballerine-io/ballerine into bal-3400
Browse files Browse the repository at this point in the history
  • Loading branch information
MatanYadaev committed Jan 21, 2025
2 parents 49f09b5 + b220184 commit a73d796
Show file tree
Hide file tree
Showing 79 changed files with 1,004 additions and 688 deletions.
26 changes: 26 additions & 0 deletions apps/backoffice-v2/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
# @ballerine/backoffice-v2

## 0.7.95

### Patch Changes

- version bump
- Updated dependencies
- @ballerine/workflow-browser-sdk@0.6.87
- @ballerine/workflow-node-sdk@0.6.87
- @ballerine/blocks@0.2.34
- @ballerine/common@0.9.68
- @ballerine/ui@0.5.67
- @ballerine/react-pdf-toolkit@1.2.67

## 0.7.94

### Patch Changes

- version bump
- Updated dependencies
- @ballerine/react-pdf-toolkit@1.2.66
- @ballerine/workflow-browser-sdk@0.6.86
- @ballerine/workflow-node-sdk@0.6.86
- @ballerine/blocks@0.2.33
- @ballerine/common@0.9.67
- @ballerine/ui@0.5.66

## 0.7.93

### Patch Changes
Expand Down
18 changes: 9 additions & 9 deletions apps/backoffice-v2/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ballerine/backoffice-v2",
"version": "0.7.93",
"version": "0.7.95",
"description": "Ballerine - Backoffice",
"homepage": "https://github.com/ballerine-io/ballerine",
"type": "module",
Expand Down Expand Up @@ -52,12 +52,12 @@
"preview": "vite preview"
},
"dependencies": {
"@ballerine/blocks": "0.2.32",
"@ballerine/common": "0.9.66",
"@ballerine/workflow-browser-sdk": "0.6.85",
"@ballerine/workflow-node-sdk": "0.6.85",
"@ballerine/react-pdf-toolkit": "^1.2.62",
"@ballerine/ui": "^0.5.62",
"@ballerine/blocks": "0.2.34",
"@ballerine/common": "0.9.68",
"@ballerine/workflow-browser-sdk": "0.6.87",
"@ballerine/workflow-node-sdk": "0.6.87",
"@ballerine/react-pdf-toolkit": "^1.2.67",
"@ballerine/ui": "^0.5.67",
"@botpress/webchat": "^2.1.10",
"@botpress/webchat-generator": "^0.2.9",
"@fontsource/inter": "^4.5.15",
Expand Down Expand Up @@ -152,8 +152,8 @@
"zod": "^3.23.4"
},
"devDependencies": {
"@ballerine/config": "^1.1.30",
"@ballerine/eslint-config-react": "^2.0.30",
"@ballerine/config": "^1.1.32",
"@ballerine/eslint-config-react": "^2.0.32",
"@cspell/cspell-types": "^6.31.1",
"@faker-js/faker": "^7.6.0",
"@playwright/test": "^1.32.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ import { TNoteableType } from '@/domains/notes/types';

export const useCreateNoteMutation = ({
onSuccess,
disableToast = false,
}: {
onSuccess?: <TData>(data: TData) => void;
disableToast: boolean;
}) => {
const queryClient = useQueryClient();

Expand Down Expand Up @@ -41,7 +43,9 @@ export const useCreateNoteMutation = ({
onSuccess: data => {
void queryClient.invalidateQueries();

toast.success(t(`toast:note_created.success`));
if (!disableToast) {
toast.success(t(`toast:note_created.success`));
}

onSuccess?.(data);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ import { createBlocksTyped } from '@/lib/blocks/create-blocks-typed/create-block
import { WarningFilledSvg } from '@ballerine/ui';

export const useKybRegistryInfoBlock = ({ pluginsOutput, workflow }) => {
const isBankAccountVerification = useMemo(
() => !!pluginsOutput?.bankAccountVerification,
[pluginsOutput?.bankAccountVerification],
);

const getCell = useCallback(() => {
if (Object.keys(pluginsOutput?.businessInformation?.data?.[0] ?? {}).length) {
return {
Expand All @@ -28,6 +33,39 @@ export const useKybRegistryInfoBlock = ({ pluginsOutput, workflow }) => {
>;
}

if (Object.keys(pluginsOutput?.bankAccountVerification?.clientResponsePayload ?? {}).length) {
const data = {
...pluginsOutput?.bankAccountVerification?.responseHeader.overallResponse,
decisionElements:
pluginsOutput?.bankAccountVerification?.clientResponsePayload.decisionElements,
orchestrationDecisions:
pluginsOutput?.bankAccountVerification?.clientResponsePayload.orchestrationDecisions,
};

return {
id: 'nested-details',
type: 'details',
hideSeparator: true,
value: {
data: Object.entries(data)
?.filter(([property]) => {
console.log(property);

return !['tenantID', 'clientReferenceId'].includes(property);
})
.map(([title, value]) => ({
title,
value,
})),
},
} satisfies Extract<
Parameters<ReturnType<typeof createBlocksTyped>['addCell']>[0],
{
type: 'details';
}
>;
}

const message =
pluginsOutput?.businessInformation?.message ??
pluginsOutput?.businessInformation?.data?.message;
Expand Down Expand Up @@ -94,12 +132,12 @@ export const useKybRegistryInfoBlock = ({ pluginsOutput, workflow }) => {
.addCell({
id: 'nested-details-heading',
type: 'heading',
value: 'Registry Information',
value: isBankAccountVerification ? 'Bank Account Verification' : 'Registry Information',
})
.addCell({
id: 'nested-details-subheading',
type: 'subheading',
value: 'Registry-Provided Data',
value: `${isBankAccountVerification ? 'Experian' : 'Registry'}-Provided Data`,
props: {
className: 'mb-4',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,7 @@ export const useDefaultBlocksLogic = () => {
...entityDataAdditionalInfo
} = workflow?.context?.entity?.data?.additionalInfo ?? {};
const { website: websiteBasicRequirement, processingDetails, ...storeInfo } = store ?? {};
const kycChildWorkflows = workflow?.childWorkflows?.filter(
childWorkflow => childWorkflow?.context?.entity?.type === 'individual',
);

const kybChildWorkflows = workflow?.childWorkflows?.filter(
childWorkflow => childWorkflow?.context?.entity?.type === 'business',
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,10 @@ export const MerchantMonitoringBusinessReport: FunctionComponent = () => {
</FormControl>
<FormMessage />
<SelectContent>
{deboardingReasonOptions?.map(({ label, value }, index) => {
{deboardingReasonOptions?.map((option, index) => {
return (
<SelectItem key={index} value={value}>
{label}
<SelectItem key={index} value={option}>
{option}
</SelectItem>
);
})}
Expand Down Expand Up @@ -223,15 +223,12 @@ export const MerchantMonitoringBusinessReport: FunctionComponent = () => {
throw new Error('Merchant ID is missing');
}

turnOngoingMonitoringOn(
{ merchantId: businessReport.merchantId },
{
onSuccess: () => {
setIsDeboardModalOpen(false);
setIsDropdownOpen(false);
},
turnOngoingMonitoringOn(businessReport.merchantId, {
onSuccess: () => {
setIsDeboardModalOpen(false);
setIsDropdownOpen(false);
},
);
});
}}
variant={'ghost'}
className="justify-start"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import { handleZodError } from '@/common/utils/handle-zod-error/handle-zod-error
export type TurnOngoingMonitoringBody = z.infer<typeof TurnOngoingMonitoringBodySchema>;
export const TurnOngoingMonitoringBodySchema = z.object({
state: z.string(),
reason: z.string().optional(),
userReason: z.string().optional(),
});

export type TurnOngoingMonitoringResponse = z.infer<typeof TurnOngoingMonitoringResponseSchema>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ParsedBooleanSchema, useReportTabs } from '@ballerine/ui';
import { t } from 'i18next';
import { capitalize } from 'lodash-es';
import { useCallback, useMemo } from 'react';
import { SubmitHandler, useForm } from 'react-hook-form';
import { useNavigate, useParams } from 'react-router-dom';
Expand All @@ -15,6 +16,7 @@ import {
MERCHANT_REPORT_TYPES_MAP,
} from '@/domains/business-reports/constants';
import { useBusinessReportByIdQuery } from '@/domains/business-reports/hooks/queries/useBusinessReportByIdQuery/useBusinessReportByIdQuery';
import { useCreateNoteMutation } from '@/domains/notes/hooks/mutations/useCreateNoteMutation/useCreateNoteMutation';
import { useNotesByNoteable } from '@/domains/notes/hooks/queries/useNotesByNoteable/useNotesByNoteable';
import { useToggleMonitoringMutation } from '@/pages/MerchantMonitoringBusinessReport/hooks/useToggleMonitoringMutation/useToggleMonitoringMutation';
import { isObject } from '@ballerine/common';
Expand Down Expand Up @@ -56,11 +58,11 @@ const statusToBadgeData = {
} as const;

const deboardingReasonOptions = [
{ value: 'fraud', label: 'Fraudulent Activity Detected' },
{ value: 'regulations', label: 'Non-Compliance with Regulations' },
{ value: 'disputes', label: 'Excessive Chargebacks or Disputes' },
{ value: 'expired', label: 'Business Relationship Ended' },
{ value: 'other', label: 'Other' },
'Fraudulent Activity Detected',
'Non-Compliance with Regulations',
'Excessive Chargebacks or Disputes',
'Business Relationship Ended',
'Other',
] as const;

export const useMerchantMonitoringBusinessReportLogic = () => {
Expand Down Expand Up @@ -92,12 +94,21 @@ export const useMerchantMonitoringBusinessReportLogic = () => {
throw new Error('Merchant ID is missing');
}

return turnOffMonitoringMutation.mutate({ merchantId: businessReport.merchantId, body: data });
return turnOffMonitoringMutation.mutate(businessReport.merchantId);
};

const { mutateAsync: mutateCreateNote } = useCreateNoteMutation({ disableToast: true });
const turnOnMonitoringMutation = useToggleMonitoringMutation({
state: 'on',
onSuccess: () => {
void mutateCreateNote({
content: 'Monitoring turned on',
entityId: businessReport?.merchantId ?? '',
entityType: 'Business',
noteableId: businessReport?.id ?? '',
noteableType: 'Report',
parentNoteId: null,
});
toast.success(t(`toast:business_monitoring_on.success`));
},
onError: error => {
Expand All @@ -112,6 +123,22 @@ export const useMerchantMonitoringBusinessReportLogic = () => {
const turnOffMonitoringMutation = useToggleMonitoringMutation({
state: 'off',
onSuccess: () => {
const { reason, userReason } = form.getValues();
const content = [
'Monitoring turned off',
reason ? `with reason: ${capitalize(reason)}` : null,
userReason ? `(${userReason})` : '',
]
.filter(Boolean)
.join(' ');
void mutateCreateNote({
content,
entityId: businessReport?.merchantId ?? '',
entityType: 'Business',
noteableId: businessReport?.id ?? '',
noteableType: 'Report',
parentNoteId: null,
});
setIsDeboardModalOpen(false);
setIsDropdownOpen(false);
form.reset();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ import { useMutation, useQueryClient } from '@tanstack/react-query';
import { toast } from 'sonner';

import { HttpError } from '@/common/errors/http-error';
import {
turnOngoingMonitoring,
TurnOngoingMonitoringBody,
} from '@/pages/MerchantMonitoringBusinessReport/fetchers';
import { turnOngoingMonitoring } from '@/pages/MerchantMonitoringBusinessReport/fetchers';

export const useToggleMonitoringMutation = ({
state,
Expand All @@ -19,10 +16,8 @@ export const useToggleMonitoringMutation = ({
const queryClient = useQueryClient();

return useMutation({
mutationFn: async (data: {
merchantId: string;
body?: Omit<TurnOngoingMonitoringBody, 'state'>;
}) => turnOngoingMonitoring({ merchantId: data.merchantId, body: { ...data.body, state } }),
mutationFn: async (merchantId: string) =>
turnOngoingMonitoring({ merchantId, body: { state } }),
onSuccess: data => {
void queryClient.invalidateQueries();

Expand Down
10 changes: 10 additions & 0 deletions apps/kyb-app/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# kyb-app

## 0.3.114

### Patch Changes

- Updated dependencies
- @ballerine/workflow-browser-sdk@0.6.87
- @ballerine/blocks@0.2.34
- @ballerine/common@0.9.68
- @ballerine/ui@0.5.67

## 0.3.113

### Patch Changes
Expand Down
14 changes: 7 additions & 7 deletions apps/kyb-app/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@ballerine/kyb-app",
"private": true,
"version": "0.3.113",
"version": "0.3.114",
"type": "module",
"scripts": {
"dev": "vite",
Expand All @@ -16,10 +16,10 @@
"test:dev": "vitest"
},
"dependencies": {
"@ballerine/blocks": "0.2.32",
"@ballerine/common": "^0.9.66",
"@ballerine/workflow-browser-sdk": "0.6.85",
"@ballerine/ui": "0.5.66",
"@ballerine/blocks": "0.2.34",
"@ballerine/common": "^0.9.68",
"@ballerine/workflow-browser-sdk": "0.6.87",
"@ballerine/ui": "0.5.67",
"@lukemorales/query-key-factory": "^1.0.3",
"@radix-ui/react-icons": "^1.3.0",
"@rjsf/core": "^5.9.0",
Expand Down Expand Up @@ -65,8 +65,8 @@
"zod": "^3.23.4"
},
"devDependencies": {
"@ballerine/config": "^1.1.30",
"@ballerine/eslint-config-react": "^2.0.30",
"@ballerine/config": "^1.1.32",
"@ballerine/eslint-config-react": "^2.0.32",
"@jest/globals": "^29.7.0",
"@sentry/vite-plugin": "^2.9.0",
"@testing-library/jest-dom": "^6.1.4",
Expand Down
18 changes: 18 additions & 0 deletions apps/workflows-dashboard/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# @ballerine/workflows-dashboard

## 0.2.32

### Patch Changes

- version bump
- Updated dependencies
- @ballerine/common@0.9.68
- @ballerine/ui@0.5.67

## 0.2.31

### Patch Changes

- version bump
- Updated dependencies
- @ballerine/common@0.9.67
- @ballerine/ui@0.5.66

## 0.2.30

### Patch Changes
Expand Down
Loading

0 comments on commit a73d796

Please sign in to comment.