Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:ballerine-io/ballerine into bal-3244
Browse files Browse the repository at this point in the history
  • Loading branch information
MatanYadaev committed Dec 29, 2024
2 parents 241b823 + 5cb19c7 commit 52733a9
Show file tree
Hide file tree
Showing 18 changed files with 149 additions and 62 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ Once the process is complete, _2 tabs_ will open in your browser:
We appreciate all types of contributions and believe that an active community is the secret to a rich and stable product.
Here are some of the ways you can contribute:
- Give us feedback in our [Slack community](https://join.slack.com/t/ballerine-oss/shared_invite/zt-1iu6otkok-OqBF3TrcpUmFd9oUjNs2iw)
- Give us feedback in our [Slack community](https://join.slack.com/t/ballerine-oss/shared_invite/zt-1il7txerq-K0YrXtlzMttGgD3XXYxlfw)
- Help with bugs and features on [our Issues page](https://github.com/ballerine-io/ballerine/issues)
- Submit a [feature request](https://github.com/ballerine-io/ballerine/issues/new?assignees=&labels=enhancement%2C+feature&template=feature_request.md) or [bug report](https://github.com/ballerine-io/ballerine/issues/new?assignees=&labels=bug&template=bug_report.md)
Expand Down
4 changes: 3 additions & 1 deletion apps/backoffice-v2/src/domains/ui-definition/fetchers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ import { z } from 'zod';
export const translateUiDefinition = async ({
id,
partialUiDefinition,
locale,
}: {
id: string;
partialUiDefinition: Record<string, unknown>;
locale: string;
}) => {
const [data, error] = await apiClient({
endpoint: `../case-management/ui-definition/${id}/translate/en`,
endpoint: `../case-management/ui-definition/${id}/translate/${locale}`,
method: Method.POST,
body: {
partialUiDefinition,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ import { uiDefinitionQueryKeys } from '@/domains/ui-definition/query-keys';
export const useTranslateUiDefinitionQuery = ({
id,
partialUiDefinition,
locale,
}: {
id: string;
partialUiDefinition: Record<string, unknown>;
locale: string;
}) => {
return useQuery({
...uiDefinitionQueryKeys.translate({ id, partialUiDefinition }),
...uiDefinitionQueryKeys.translate({ id, partialUiDefinition, locale }),
enabled: !!partialUiDefinition && !!id,
});
};
5 changes: 4 additions & 1 deletion apps/backoffice-v2/src/domains/ui-definition/query-keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,21 @@ export const uiDefinitionQueryKeys = createQueryKeys('ui-definition', {
translate: ({
id,
partialUiDefinition,
locale,
}: {
id: string;
partialUiDefinition: Record<string, unknown>;
locale: string;
}) => {
return {
queryKey: [
{
id,
partialUiDefinition,
locale,
},
],
queryFn: () => translateUiDefinition({ id, partialUiDefinition }),
queryFn: () => translateUiDefinition({ id, partialUiDefinition, locale }),
};
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ export const WorkflowDefinitionConfigSchema = z
.optional(),
})
.optional(),
ubos: z
.object({
create: z
.object({
enabled: z.boolean().optional(),
})
.optional(),
})
.optional(),
})
.passthrough()
.nullable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,19 +373,6 @@ export const useKycBlock = ({
className: 'mt-0',
},
})
.addCell({
type: 'callToAction',
value: {
text: 'Initiate KYC',
onClick: onInitiateKyc,
props: {
className:
'justify-self-end px-2 py-0 text-xs aria-disabled:pointer-events-none aria-disabled:opacity-50',
variant: 'outline',
disabled: !event,
},
},
})
.build()
.flat(1),
})
Expand Down Expand Up @@ -564,6 +551,19 @@ export const useKycBlock = ({
className: 'py-4 text-slate-500',
},
})
.addCell({
type: 'callToAction',
value: {
text: 'Initiate KYC',
onClick: onInitiateKyc,
props: {
className:
'px-2 py-0 text-xs aria-disabled:pointer-events-none aria-disabled:opacity-50 ms-3',
variant: 'outline',
disabled: !event,
},
},
})
.buildFlat(),
})
.addCell({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,40 @@ import { transformErrors } from '@/pages/Entities/components/CaseCreation/compon
import { useTranslateUiDefinitionQuery } from '@/domains/ui-definition/hooks/queries/useTranslateUiDefinitionQuery/useTranslateUiDefinitionQuery';
import { useDeleteUbosByIdsMutation } from '@/domains/workflows/hooks/mutations/useDeleteUbosByIdsMutation/useDeleteUbosByIdsMutation';
import { useCreateUboMutation } from '@/domains/workflows/hooks/mutations/useCreateUboMutation/useCreateUboMutation';
import { useLocale } from '@/common/hooks/useLocale/useLocale';

export const useManageUbosBlock = () => {
export const useManageUbosBlock = ({
create,
}: {
create: {
enabled: boolean;
};
}) => {
const { data: workflow } = useCurrentCaseQuery();
const { data: workflowDefinition } = useWorkflowDefinitionByIdQuery({
workflowDefinitionId: workflow?.workflowDefinition?.id ?? '',
});
const uiDefinition = workflowDefinition?.uiDefinitions?.find(
uiDefinition => uiDefinition.uiContext === 'collection_flow',
);
const locale = useLocale();
const { data: translatedUbos } = useTranslateUiDefinitionQuery({
id: uiDefinition?.id ?? '',
partialUiDefinition: ubosFormJsonDefinition,
locale,
});
const { formSchema, uiSchema } = createFormSchemaFromUIElements(translatedUbos ?? {});
const [isAddingUbo, _toggleIsAddingUbo, toggleOnIsAddingUbo, toggleOffIsAddingUbo] = useToggle();
const [isManageUbosOpen, toggleIsManageUbosOpen] = useToggle();
const { mutate: mutateCreateUbo } = useCreateUboMutation({
workflowId: workflow?.id,
onSuccess: toggleOffIsAddingUbo,
onSuccess: () => {
if (!isAddingUbo) {
return;
}

toggleOffIsAddingUbo();
},
});
const { mutate: mutateDeleteUbosByIds } = useDeleteUbosByIdsMutation({
workflowId: workflow?.id,
Expand Down Expand Up @@ -107,6 +123,7 @@ export const useManageUbosBlock = () => {
<Dialog
trigger={
<Button
type={'button'}
variant={'ghost'}
size={'icon'}
className={'aria-disabled:pointer-events-none aria-disabled:opacity-50'}
Expand All @@ -119,7 +136,7 @@ export const useManageUbosBlock = () => {
description={
<p className={`text-sm`}>
Are you sure you want to remove this UBO? This action will be logged, and the
UBO&apos;s data will be removed from the case and webhooks.
UBO&apos;s data will be removed from the case.
</p>
}
content={null}
Expand Down Expand Up @@ -191,8 +208,11 @@ export const useManageUbosBlock = () => {
type: 'node',
value: (
<Dialog
open={isManageUbosOpen}
onOpenChange={toggleIsManageUbosOpen}
trigger={
<Button
type={'button'}
variant="outline"
className={
'ms-auto px-2 py-0 text-xs aria-disabled:pointer-events-none aria-disabled:opacity-50'
Expand All @@ -204,7 +224,7 @@ export const useManageUbosBlock = () => {
}
content={
<div className={'flex flex-col justify-between space-y-4'}>
{!isAddingUbo && (
{(!create.enabled || !isAddingUbo) && (
<div className={'flex flex-col gap-4'}>
<h2 className={'text-lg font-semibold'}>Manage UBOs</h2>
<UrlDataTable
Expand All @@ -216,34 +236,51 @@ export const useManageUbosBlock = () => {
}}
props={{
scroll: {
className: 'h-[73vh]',
className: '[&>div]:max-h-[73vh]',
},
}}
/>
<Button
className={'ms-auto aria-disabled:pointer-events-none aria-disabled:opacity-50'}
onClick={toggleOnIsAddingUbo}
aria-disabled={!caseState.writeEnabled}
>
Add
</Button>
{create.enabled && (
<Button
type={'button'}
className={
'ms-auto aria-disabled:pointer-events-none aria-disabled:opacity-50'
}
onClick={toggleOnIsAddingUbo}
aria-disabled={!caseState.writeEnabled}
>
Add UBO
</Button>
)}
</div>
)}
{isAddingUbo && (
<div className={'flex flex-col gap-4'}>
<Button variant={'ghost'} onClick={toggleOffIsAddingUbo} className={'me-auto'}>
<ArrowLeft className={'text-muted-foreground'} size={14} />
{create.enabled && isAddingUbo && (
<>
<Button
type={'button'}
variant={'ghost'}
onClick={toggleOffIsAddingUbo}
className={
'absolute left-4 top-4 rounded-sm p-0 opacity-70 transition-opacity d-4 hover:bg-transparent hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-slate-400 focus:ring-offset-2 data-[state=open]:bg-slate-100 dark:focus:ring-slate-400 dark:focus:ring-offset-slate-900 dark:data-[state=open]:bg-slate-800'
}
>
<ArrowLeft className={'d-4'} />
</Button>
<ScrollArea orientation={'vertical'} className={'h-[73vh]'}>
<DynamicForm
schema={formSchema}
uiSchema={uiSchema}
onSubmit={onSubmit}
layouts={layouts as typeof baseLayouts}
transformErrors={transformErrors}
/>
</ScrollArea>
</div>

<div className={'flex flex-col gap-4'}>
<h2 className={'text-lg font-semibold'}>Add UBO</h2>
<ScrollArea orientation={'vertical'} className={'h-[73vh]'}>
<DynamicForm
schema={formSchema}
uiSchema={uiSchema}
onSubmit={onSubmit}
layouts={layouts as typeof baseLayouts}
transformErrors={transformErrors}
className={'[&>div>fieldset>div:first-of-type]:py-0 [&>div]:py-0'}
/>
</ScrollArea>
</div>
</>
)}
</div>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,12 @@ export const useDefaultBlocksLogic = () => {
isRequestTimedOut: workflow?.context?.pluginsOutput?.ubo?.isRequestTimedOut,
});

const manageUbosBlock = useManageUbosBlock();
const manageUbosBlock = useManageUbosBlock({
create: {
...workflow?.workflowDefinition?.config?.ubos?.create,
enabled: workflow?.workflowDefinition?.config?.ubos?.create?.enabled ?? false,
},
});

const directorsUserProvidedBlock = useDirectorsUserProvidedBlock(directorsUserProvided);

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

## 0.3.98

### Patch Changes

- Updated dependencies
- @ballerine/ui@0.5.55

## 0.3.97

### Patch Changes
Expand Down
4 changes: 2 additions & 2 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.97",
"version": "0.3.98",
"type": "module",
"scripts": {
"dev": "vite",
Expand All @@ -17,7 +17,7 @@
"dependencies": {
"@ballerine/blocks": "0.2.30",
"@ballerine/common": "^0.9.60",
"@ballerine/ui": "0.5.54",
"@ballerine/ui": "0.5.55",
"@ballerine/workflow-browser-sdk": "0.6.79",
"@lukemorales/query-key-factory": "^1.0.3",
"@radix-ui/react-icons": "^1.3.0",
Expand Down
7 changes: 7 additions & 0 deletions packages/react-pdf-toolkit/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @ballerine/react-pdf-toolkit

## 1.2.55

### Patch Changes

- Updated dependencies
- @ballerine/ui@0.5.55

## 1.2.54

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/react-pdf-toolkit/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@ballerine/react-pdf-toolkit",
"private": false,
"version": "1.2.54",
"version": "1.2.55",
"types": "./dist/build.d.ts",
"main": "./dist/react-pdf-toolkit.js",
"module": "./dist/react-pdf-toolkit.mjs",
Expand All @@ -27,7 +27,7 @@
},
"dependencies": {
"@ballerine/config": "^1.1.28",
"@ballerine/ui": "0.5.54",
"@ballerine/ui": "0.5.55",
"@react-pdf/renderer": "^3.1.14",
"@sinclair/typebox": "^0.31.7",
"ajv": "^8.12.0",
Expand Down
6 changes: 6 additions & 0 deletions packages/ui/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @ballerine/ui

## 0.5.55

### Patch Changes

- Fixed phone input styling

## 0.5.54

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@ballerine/ui",
"private": false,
"version": "0.5.54",
"version": "0.5.55",
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ export const PhoneNumberInput = (props: PhoneNumberInputProps) => {
{...restProps}
disabled={disabled}
disableSearchIcon={disableSearchIcon}
containerClass="flex items-center border border-input h-9 focus-within:ring-ring focus-within:ring-1 rounded-md font-inter disabled:cursor-not-allowed disabled:opacity-50"
inputClass="w-full h-8 border-none outline-none disabled:cursor-not-allowed disabled:opacity-50"
containerClass="flex items-center border border-input focus-within:ring-ring focus-within:ring-1 rounded-md font-inter disabled:cursor-not-allowed disabled:opacity-50"
inputClass="w-full h-8 !border-none outline-none disabled:cursor-not-allowed disabled:opacity-50"
searchClass={styles.searchInput}
inputProps={{ ...restProps.inputProps, 'data-testid': testId }}
buttonClass={clsx(
'border-none rounded-l-md',
'!border-none rounded-l-md',
{ 'cursor-not-allowed opacity-50': disabled },
styles.hiddenArrow,
styles.flagCenter,
Expand Down
Loading

0 comments on commit 52733a9

Please sign in to comment.