UNPKG

@adyen/kyc-components

Version:

This guide assumes that you have already an account with Adyen. A legalEntity needs to be created, and you need to have a `legalEntityId` to instatiate a Component.

26 lines (25 loc) 1.37 kB
try { let e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack; n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "698b18d3-48fa-4af8-8872-674229442cd0", e._sentryDebugIdIdentifier = "sentry-dbid-698b18d3-48fa-4af8-8872-674229442cd0"); } catch (e) {} import { t as getApiTrustedFields } from "./getTrustedFields-BJ88GlM-.js"; //#region src/components/Individual/tasks/DecisionMakers/getTrustedDecisionMakers.ts function getTrustedDecisionMakers(rootLegalEntity, provider) { return parseTrustedDecisionMakersFromApiFields(getApiTrustedFields(rootLegalEntity, provider)); } function parseTrustedDecisionMakersFromApiFields(trustedApiFields) { const rawTrustedEntityAssociations = trustedApiFields.filter((f) => f.startsWith("entityAssociations")) ?? []; const leIdMap = {}; rawTrustedEntityAssociations.forEach((rtea) => { const [_, role, leId] = rtea.split("."); const trustedRole = role; if (!leIdMap[leId]) leIdMap[leId] = { roles: [trustedRole] }; else leIdMap[leId] = { roles: [...leIdMap[leId].roles, trustedRole] }; }); return Object.keys(leIdMap).map((reference) => ({ reference, types: leIdMap[reference].roles })); } //#endregion export { getTrustedDecisionMakers as t };