Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add/Remove UBOs sign-off and pr comments #2915

Merged
merged 14 commits into from
Dec 28, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,18 +25,27 @@ 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();
Expand Down Expand Up @@ -119,7 +128,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 @@ -204,7 +213,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 +225,49 @@ 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
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
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/[email protected]

## 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/[email protected]

## 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
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion services/workflows-service/prisma/data-migrations
Loading
Loading