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.

45 lines (44 loc) 2.67 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] = "e67f75b1-98bb-44a5-be16-fd9650e7f13a", e._sentryDebugIdIdentifier = "sentry-dbid-e67f75b1-98bb-44a5-be16-fd9650e7f13a"); } catch (e) {} import { t as LegalEntityTypes } from "./legal-entity-type-VIfNYnJP.js"; import { d as hasOwnEntityAssociationOfType } from "./entityAssociationUtil-BEzUdPbm.js"; import { t as isEmptyEntity } from "./isEmptyEntity-BM_3oo07.js"; //#region src/utils/accountHolderUtils.ts var capabilitiesToPreventTypeChange = [ "receivePayments", "issueCard", "useCard", "withdrawFromAtm", "withdrawFromAtmInRestrictedCountries", "useCardInRestrictedCountries", "useCardInRestrictedIndustries", "issueBankAccount", "sendToThirdParty", "receiveFromThirdParty", "getGrantOffers", "receiveGrants" ]; var entityTypeToCorrespondingAccountHolderOption = { [LegalEntityTypes.INDIVIDUAL]: "myName", [LegalEntityTypes.ORGANIZATION]: "theCompanyIWorkFor", [LegalEntityTypes.SOLE_PROPRIETORSHIP]: "mySoleProprietorName", [LegalEntityTypes.TRUST]: "aTrust", [LegalEntityTypes.UNINCORPORATED_PARTNERSHIP]: "anUnincorporatedPartnership" }; /** ** Account holder option is not stored in backend as it does not effect any check evaluations. ** The value is computed in the front end based on the associations and current flow of the legalEntity * */ var getDefaultAccountHolderType = (legalEntityResponse, isTypeChanging = false, accountHolder) => { if (!legalEntityResponse?.type) return void 0; if (hasOwnEntityAssociationOfType(LegalEntityTypes.SOLE_PROPRIETORSHIP, legalEntityResponse.entityAssociations, legalEntityResponse.id)) return "mySoleProprietorName"; if (hasOwnEntityAssociationOfType(LegalEntityTypes.TRUST, legalEntityResponse.entityAssociations, legalEntityResponse.id)) return "aTrust"; if (hasOwnEntityAssociationOfType(LegalEntityTypes.UNINCORPORATED_PARTNERSHIP, legalEntityResponse.entityAssociations, legalEntityResponse.id)) return "anUnincorporatedPartnership"; if (accountHolder) return accountHolder; if (isTypeChanging || !isEmptyEntity(legalEntityResponse)) return entityTypeToCorrespondingAccountHolderOption[legalEntityResponse.type]; }; var allowIndividualWithoutSoleProp = (capabilities) => !capabilities?.map((c) => c.replace("Commercial", "").replace("Consumer", "")).some((c) => capabilitiesToPreventTypeChange.includes(c)); //#endregion export { getDefaultAccountHolderType as n, allowIndividualWithoutSoleProp as t };