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] = "aa11a9cd-4f1e-40d9-a2a0-985ffc532cf7", e._sentryDebugIdIdentifier = "sentry-dbid-aa11a9cd-4f1e-40d9-a2a0-985ffc532cf7"); } catch (e) {} import { f as isEmptyEntity } from "./resolveEnvironment-DNmu53Rr.js"; import { t as LegalEntityTypes } from "./legal-entity-type-0MfCGzUf.js"; import { d as hasOwnEntityAssociationOfType } from "./entityAssociationUtil-C-wflW8q.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 };