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.

100 lines (99 loc) 4.46 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] = "23039134-cf84-4112-91bc-0c3b9327a2b2", e._sentryDebugIdIdentifier = "sentry-dbid-23039134-cf84-4112-91bc-0c3b9327a2b2"); } catch (e) {} import { t as LegalEntityTypes } from "./legal-entity-type-VIfNYnJP.js"; import { t as CountryCodes } from "./country-code-CX5KqMBr.js"; import { i as getDirectEntityAssociations } from "./entityAssociationUtil-BEzUdPbm.js"; import { n as getDecisionMakers } from "./decisionMakerRoles-CAy-eeNV.js"; import { n as TrustMemberGuidanceLabels, r as TrustMemberTypes } from "./trustMemberGuidance-B3VWjXzg.js"; //#region src/components/Trust/forms/TrustRegistrationDetails/types.ts var nzSpecificTrustTypes = [ "discretionaryTrust", "familyTrust", "charitableTrust", "businessTrust", "otherTrust" ]; var auSpecificTrustTypes = [ "cashManagementTrust", "corporateUnitTrust", "deceasedEstate", "discretionaryInvestmentTrust", "discretionaryServicesManagementTrust", "discretionaryTradingTrust", "firstHomeSaverAccountsTrust", "fixedTrust", "fixedUnitTrust", "hybridTrust", "listedPublicUnitTrust", "otherTrust", "pooledSuperannuationTrust", "publicTradingTrust", "unlistedPublicUnitTrust" ]; var countryToTrustTypes = { [CountryCodes.Australia]: auSpecificTrustTypes, [CountryCodes.NewZealand]: nzSpecificTrustTypes }; //#endregion //#region src/components/Trust/utils/trustMemberRequirements.ts var DEFAULT_TRUST_MEMBER_REQUIREMENTS = [ { roleTypes: [TrustMemberTypes.SETTLOR], min: 1, max: 1, label: TrustMemberGuidanceLabels.SETTLOR }, { roleTypes: [TrustMemberTypes.DEFINED_BENEFICIARY, TrustMemberTypes.UNDEFINED_BENEFICIARY], min: 1, max: Infinity, label: TrustMemberGuidanceLabels.BENEFICIARY }, { roleTypes: [TrustMemberTypes.PROTECTOR], min: 0, max: Infinity, label: TrustMemberGuidanceLabels.PROTECTOR }, { roleTypes: [TrustMemberTypes.TRUSTEE], min: 1, max: Infinity, label: TrustMemberGuidanceLabels.TRUSTEE } ]; //#endregion //#region src/components/Trust/utils/trustUtil.ts var isPartOfTrustFromLegalEntity = (legalEntity) => legalEntity?.entityAssociations?.some((ea) => ea.entityType === LegalEntityTypes.TRUST && ea.associatorId === legalEntity.id); var getOwnTrustMembersLegalEntityIds = (rootLegalEntity) => { const trustLegalEntityId = getOwnTrustLegalEntityId(rootLegalEntity); if (!trustLegalEntityId) return []; const trustMemberIds = getDirectEntityAssociations(rootLegalEntity, trustLegalEntityId).map((association) => association.legalEntityId).filter((id) => id !== void 0); return [...trustMemberIds, ...trustMemberIds.flatMap((trustMemberId) => getTrustMemberCompanyDecisionMakerIds(rootLegalEntity, trustMemberId))]; }; var getTrustMemberCompanyDecisionMakerIds = (rootLegalEntity, trustMemberCompanyId) => { return getDecisionMakers(rootLegalEntity, trustMemberCompanyId).map((association) => association.legalEntityId).filter((id) => id !== void 0); }; var getOwnTrustLegalEntityId = (legalEntity) => legalEntity?.entityAssociations?.find((ea) => ea.entityType === LegalEntityTypes.TRUST && ea.associatorId === legalEntity.id)?.legalEntityId; var getOwnTrustLegalEntityIdAsArray = (legalEntity) => { const trustLegalEntityId = getOwnTrustLegalEntityId(legalEntity); return trustLegalEntityId ? [trustLegalEntityId] : []; }; var getOwnTrustProblems = (legalEntity, capabilityProblems) => { const trustLegalEntityId = getOwnTrustLegalEntityId(legalEntity); if (trustLegalEntityId) return capabilityProblems?.LegalEntity?.[trustLegalEntityId]; }; var hasRequiredTrustMemberCount = (trustMembers) => { if (!trustMembers.length) return false; return DEFAULT_TRUST_MEMBER_REQUIREMENTS.every(({ roleTypes, min }) => { if (min === 0) return true; return (trustMembers.filter(({ roles }) => roleTypes.some((label) => roles.includes(label)))?.length ?? 0) >= min; }); }; var getCountrySpecificTrustTypeOptions = (country) => { return countryToTrustTypes[country] || []; }; //#endregion export { hasRequiredTrustMemberCount as a, getOwnTrustProblems as i, getOwnTrustLegalEntityIdAsArray as n, isPartOfTrustFromLegalEntity as o, getOwnTrustMembersLegalEntityIds as r, DEFAULT_TRUST_MEMBER_REQUIREMENTS as s, getCountrySpecificTrustTypeOptions as t };