|
1 |
| -import { StateTag, TStateTags, isObject } from '@ballerine/common'; |
| 1 | +import { isObject, StateTag, TStateTags } from '@ballerine/common'; |
2 | 2 | import { ComponentProps, useCallback, useMemo } from 'react';
|
3 | 3 |
|
4 | 4 | import { Separator } from '@/common/components/atoms/Separator/Separator';
|
@@ -109,9 +109,36 @@ export const useKycBlock = ({
|
109 | 109 | childWorkflow?.context?.pluginsOutput?.kyc_session[key]?.result?.vendorResult?.aml ??
|
110 | 110 | childWorkflow?.context?.pluginsOutput?.kyc_session[key]?.result?.aml,
|
111 | 111 | );
|
112 |
| - }, [kycSessionKeys]); |
| 112 | + }, [childWorkflow?.context?.pluginsOutput?.kyc_session, kycSessionKeys]); |
| 113 | + const vendor = useMemo(() => { |
| 114 | + if (!kycSessionKeys?.length) { |
| 115 | + return; |
| 116 | + } |
| 117 | + |
| 118 | + const amlVendor = kycSessionKeys |
| 119 | + .map( |
| 120 | + key => |
| 121 | + childWorkflow?.context?.pluginsOutput?.kyc_session[key]?.result?.vendorResult?.aml |
| 122 | + ?.vendor ?? |
| 123 | + childWorkflow?.context?.pluginsOutput?.kyc_session[key]?.result?.aml?.vendor, |
| 124 | + ) |
| 125 | + .filter(Boolean); |
| 126 | + |
| 127 | + if (!amlVendor.length) { |
| 128 | + const kycVendor = kycSessionKeys |
| 129 | + .map(key => childWorkflow?.context?.pluginsOutput?.kyc_session[key]?.vendor) |
| 130 | + .filter(Boolean); |
113 | 131 |
|
114 |
| - const amlBlock = useAmlBlock(amlData); |
| 132 | + return kycVendor.join(', '); |
| 133 | + } |
| 134 | + |
| 135 | + return amlVendor.join(', '); |
| 136 | + }, [childWorkflow?.context?.pluginsOutput?.kyc_session, kycSessionKeys]); |
| 137 | + |
| 138 | + const amlBlock = useAmlBlock({ |
| 139 | + data: amlData, |
| 140 | + vendor: vendor ?? '', |
| 141 | + }); |
115 | 142 |
|
116 | 143 | const documentExtractedData = kycSessionKeys?.length
|
117 | 144 | ? kycSessionKeys?.map((key, index, collection) =>
|
|
0 commit comments