Skip to content

Commit

Permalink
Plugins timeout (#2186)
Browse files Browse the repository at this point in the history
* feat: plugins timeout

* feat: renamed variable

* feat: test fix

---------

Co-authored-by: Alon Peretz <[email protected]>
  • Loading branch information
tomer-shvadron and alonp99 authored Mar 12, 2024
1 parent 36f579e commit fecbe64
Show file tree
Hide file tree
Showing 49 changed files with 426 additions and 456 deletions.
12 changes: 12 additions & 0 deletions apps/backoffice-v2/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# @ballerine/backoffice-v2

## 0.5.55

### Patch Changes

- version bump
- Updated dependencies
- @ballerine/blocks@0.1.29
- @ballerine/common@0.7.49
- @ballerine/ui@0.3.31
- @ballerine/workflow-browser-sdk@0.5.49
- @ballerine/workflow-node-sdk@0.5.49

## 0.5.54

### Patch Changes
Expand Down
16 changes: 8 additions & 8 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.5.54",
"version": "0.5.55",
"description": "Ballerine - Backoffice",
"homepage": "https://github.com/ballerine-io/ballerine",
"repository": {
Expand Down Expand Up @@ -50,11 +50,11 @@
"preview": "vite preview"
},
"dependencies": {
"@ballerine/blocks": "0.1.28",
"@ballerine/common": "0.7.48",
"@ballerine/ui": "^0.3.30",
"@ballerine/workflow-browser-sdk": "0.5.48",
"@ballerine/workflow-node-sdk": "0.5.48",
"@ballerine/blocks": "0.1.29",
"@ballerine/common": "0.7.49",
"@ballerine/ui": "^0.3.31",
"@ballerine/workflow-browser-sdk": "0.5.49",
"@ballerine/workflow-node-sdk": "0.5.49",
"@fontsource/inter": "^4.5.15",
"@formkit/auto-animate": "1.0.0-beta.5",
"@hookform/resolvers": "^3.1.0",
Expand Down Expand Up @@ -110,8 +110,8 @@
"zod": "^3.22.3"
},
"devDependencies": {
"@ballerine/config": "^1.0.7",
"@ballerine/eslint-config-react": "^1.0.8",
"@ballerine/config": "^1.0.8",
"@ballerine/eslint-config-react": "^1.0.9",
"@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 @@ -32,6 +32,7 @@ export const useProcessTrackerLogic = ({
() => tags?.find(tag => tagToAccordionCardItem[tag as keyof typeof tagToAccordionCardItem]),
[tags],
);

const steps = useMemo(() => {
return Object.keys(context?.flowConfig?.stepsProgress ?? {})?.sort((a, b) => {
return (
Expand All @@ -51,6 +52,7 @@ export const useProcessTrackerLogic = ({
},
[context?.flowConfig?.stepsProgress],
);

const getPluginByName = useCallback(
(name: string) => {
let plugin: NonNullable<TWorkflowById['context']['pluginsOutput']>[string];
Expand All @@ -67,6 +69,7 @@ export const useProcessTrackerLogic = ({
},
[context?.pluginsOutput],
);

const getUboFlowStatus = useCallback((tags: TWorkflowById['tags']) => {
const tag = tags?.find(tag => tagToIcon[tag as keyof typeof tagToIcon]);

Expand All @@ -85,11 +88,21 @@ export const useProcessTrackerLogic = ({
};
});
}, [getCollectionFlowStatus, steps]);

const thirdPartyProcessesSubitems = useMemo(() => {
return plugins
?.filter(({ name }) => pluginsWhiteList.includes(name as (typeof pluginsWhiteList)[number]))
?.map(({ displayName, name }) => {
const pluginStatus = getPluginByName(name)?.status ?? ProcessStatus.DEFAULT;
const plugin = getPluginByName(name);

if (plugin?.isRequestTimedOut) {
return {
text: <span className={`text-slate-400/40 line-through`}>{displayName}</span>,
leftIcon: processStatusToIcon[ProcessStatus.CANCELED],
};
}

const pluginStatus = plugin?.status ?? ProcessStatus.DEFAULT;

return {
text:
Expand All @@ -102,6 +115,7 @@ export const useProcessTrackerLogic = ({
};
});
}, [getPluginByName, plugins]);

const uboFlowsSubitems = useMemo(() => {
return kycChildWorkflows?.map(({ context, tags }) => {
return {
Expand All @@ -115,7 +129,7 @@ export const useProcessTrackerLogic = ({

useEffect(() => {
onValueChange(tagToAccordionCardItem[tag as keyof typeof tagToAccordionCardItem]);
}, [tag]);
}, [onValueChange, tag]);

return {
uncollapsedItemValue,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,30 @@ export const useKybRegistryInfoBlock = ({ pluginsOutput, workflow }) => {
}
>;
}

if (pluginsOutput?.businessInformation?.isRequestTimedOut) {
return {
type: 'paragraph',
value: (
<span className="flex text-sm text-black/60">
<WarningFilledSvg
className={'mr-[8px] mt-px text-black/20'}
width={'20'}
height={'20'}
/>
<span>
The request timed out either because the company was not found in the registry, or the
information is currently unavailable.
</span>
</span>
),
} satisfies Extract<
Parameters<ReturnType<typeof createBlocksTyped>['addCell']>[0],
{
type: 'paragraph';
}
>;
}
}, [pluginsOutput, workflow]);

return useMemo(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type Ubo = {
export const useUbosRegistryProvidedBlock = (
ubos: Ubo[] | undefined,
message: string | undefined,
isRequestTimedOut: string | undefined,
) => {
const getCell = useCallback(() => {
if (Array.isArray(ubos) && ubos?.length) {
Expand Down Expand Up @@ -66,6 +67,30 @@ export const useUbosRegistryProvidedBlock = (
}
>;
}

if (isRequestTimedOut) {
return {
type: 'paragraph',
value: (
<span className="flex text-sm text-black/60">
<WarningFilledSvg
className={'mr-[8px] mt-px text-black/20'}
width={'20'}
height={'20'}
/>
<span>
The request timed out either because the company was not found in the registry, or the
information is currently unavailable.
</span>
</span>
),
} satisfies Extract<
Parameters<ReturnType<typeof createBlocksTyped>['addCell']>[0],
{
type: 'paragraph';
}
>;
}
}, [message, ubos]);

return useMemo(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ export const useDefaultBlocksLogic = () => {
const ubosRegistryProvidedBlock = useUbosRegistryProvidedBlock(
ubosRegistryProvided,
workflow?.context?.pluginsOutput?.ubo?.message,
workflow?.context?.pluginsOutput?.ubo?.isRequestTimedOut,
);

const directorsUserProvidedBlock = useDirectorsUserProvidedBlock(directorsUserProvided);
Expand Down
11 changes: 11 additions & 0 deletions apps/kyb-app/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# kyb-app

## 0.1.50

### Patch Changes

- version bump
- Updated dependencies
- @ballerine/blocks@0.1.29
- @ballerine/common@0.7.49
- @ballerine/ui@0.3.31
- @ballerine/workflow-browser-sdk@0.5.49

## 0.1.49

### 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.1.49",
"version": "0.1.50",
"type": "module",
"scripts": {
"dev": "vite",
Expand All @@ -14,10 +14,10 @@
"test:dev": "vitest"
},
"dependencies": {
"@ballerine/blocks": "0.1.28",
"@ballerine/common": "^0.7.48",
"@ballerine/ui": "0.3.30",
"@ballerine/workflow-browser-sdk": "0.5.48",
"@ballerine/blocks": "0.1.29",
"@ballerine/common": "^0.7.49",
"@ballerine/ui": "0.3.31",
"@ballerine/workflow-browser-sdk": "0.5.49",
"@lukemorales/query-key-factory": "^1.0.3",
"@radix-ui/react-icons": "^1.3.0",
"@rjsf/core": "^5.9.0",
Expand Down Expand Up @@ -58,8 +58,8 @@
"zod": "^3.21.4"
},
"devDependencies": {
"@ballerine/config": "^1.0.7",
"@ballerine/eslint-config-react": "^1.0.8",
"@ballerine/config": "^1.0.8",
"@ballerine/eslint-config-react": "^1.0.9",
"@jest/globals": "^29.7.0",
"@sentry/vite-plugin": "^2.9.0",
"@testing-library/jest-dom": "^6.1.4",
Expand Down
6 changes: 6 additions & 0 deletions apps/workflows-dashboard/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @ballerine/workflows-dashboard

## 0.1.15

### Patch Changes

- version bump

## 0.1.14

### Patch Changes
Expand Down
6 changes: 3 additions & 3 deletions apps/workflows-dashboard/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@ballerine/workflows-dashboard",
"private": false,
"version": "0.1.14",
"version": "0.1.15",
"type": "module",
"scripts": {
"spellcheck": "cspell \"*\"",
Expand Down Expand Up @@ -53,8 +53,8 @@
"zod": "^3.22.3"
},
"devDependencies": {
"@ballerine/config": "^1.0.7",
"@ballerine/eslint-config-react": "^1.0.8",
"@ballerine/config": "^1.0.8",
"@ballerine/eslint-config-react": "^1.0.9",
"@cspell/cspell-types": "^6.31.1",
"@types/axios": "^0.14.0",
"@types/classnames": "^2.3.1",
Expand Down
9 changes: 9 additions & 0 deletions examples/headless-example/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# @ballerine/headless-example

## 0.1.49

### Patch Changes

- version bump
- Updated dependencies
- @ballerine/common@0.7.49
- @ballerine/workflow-browser-sdk@0.5.49

## 0.1.48

### Patch Changes
Expand Down
6 changes: 3 additions & 3 deletions examples/headless-example/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@ballerine/headless-example",
"private": true,
"version": "0.1.48",
"version": "0.1.49",
"type": "module",
"scripts": {
"spellcheck": "cspell \"*\"",
Expand Down Expand Up @@ -34,8 +34,8 @@
"vite": "^4.1.0"
},
"dependencies": {
"@ballerine/common": "0.7.48",
"@ballerine/workflow-browser-sdk": "0.5.48",
"@ballerine/common": "0.7.49",
"@ballerine/workflow-browser-sdk": "0.5.49",
"@felte/reporter-svelte": "^1.1.5",
"@felte/validator-zod": "^1.0.13",
"@fontsource/inter": "^4.5.15",
Expand Down
8 changes: 8 additions & 0 deletions examples/report-generation-example/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @ballerine/report-generation-example

## 0.0.5

### Patch Changes

- version bump
- Updated dependencies
- @ballerine/react-pdf-toolkit@1.0.16

## 0.0.4

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions examples/report-generation-example/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@ballerine/report-generation-example",
"private": false,
"version": "0.0.4",
"version": "0.0.5",
"type": "module",
"scripts": {
"dev": "vite",
Expand All @@ -10,7 +10,7 @@
"preview": "vite preview"
},
"dependencies": {
"@ballerine/react-pdf-toolkit": "^1.0.15",
"@ballerine/react-pdf-toolkit": "^1.0.16",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
Expand Down
8 changes: 8 additions & 0 deletions packages/blocks/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @ballerine/blocks

## 0.1.29

### Patch Changes

- version bump
- Updated dependencies
- @ballerine/common@0.7.49

## 0.1.28

### Patch Changes
Expand Down
8 changes: 4 additions & 4 deletions packages/blocks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"private": false,
"name": "@ballerine/blocks",
"author": "Ballerine <[email protected]>",
"version": "0.1.28",
"version": "0.1.29",
"description": "blocks",
"module": "./dist/esm/index.js",
"main": "./dist/cjs/index.js",
Expand Down Expand Up @@ -42,8 +42,8 @@
"@babel/preset-env": "7.16.11",
"@babel/preset-react": "^7.22.5",
"@babel/preset-typescript": "7.16.7",
"@ballerine/eslint-config": "^1.0.7",
"@ballerine/config": "^1.0.7",
"@ballerine/eslint-config": "^1.0.8",
"@ballerine/config": "^1.0.8",
"@rollup/plugin-babel": "5.3.1",
"@rollup/plugin-commonjs": "^24.0.1",
"@rollup/plugin-node-resolve": "13.2.1",
Expand Down Expand Up @@ -90,6 +90,6 @@
"vitest": "^0.33.0"
},
"dependencies": {
"@ballerine/common": "^0.7.46"
"@ballerine/common": "^0.7.49"
}
}
Loading

0 comments on commit fecbe64

Please sign in to comment.