@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.
40 lines (39 loc) • 2.2 kB
JavaScript
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] = "6e3424e9-442b-478e-a0b0-8915c45e4aac", e._sentryDebugIdIdentifier = "sentry-dbid-6e3424e9-442b-478e-a0b0-8915c45e4aac");
} catch (e) {}
import { t as LegalEntityTypes } from "./legal-entity-type-VIfNYnJP.js";
import { t as useSettingsContext } from "./useSettingsContext-DzwVt0W0.js";
import { f as hasSolePropInLegalEntity } from "./entityAssociationUtil-BEzUdPbm.js";
import { o as isPartOfTrustFromLegalEntity } from "./trustUtil-BTHvlo55.js";
import { t as SettingNames } from "./types-CNZsK2dZ.js";
//#region src/hooks/useLegalEntityType.ts
var useLegalEntityType = ({ legalEntity }) => {
const isTrust = isPartOfTrustFromLegalEntity(legalEntity);
const isSoleProprietor = hasSolePropInLegalEntity(legalEntity);
const hasLegalAssociation = isTrust || isSoleProprietor;
switch (legalEntity.type) {
case LegalEntityTypes.INDIVIDUAL:
case LegalEntityTypes.ORGANIZATION:
if (!hasLegalAssociation) return legalEntity.type;
if (isSoleProprietor) return LegalEntityTypes.SOLE_PROPRIETORSHIP;
if (isTrust) return LegalEntityTypes.TRUST;
break;
default: return;
}
};
//#endregion
//#region src/hooks/introduction/useCanSeeIntroduction.ts
var useCanSeeIntroduction = ({ legalEntity }) => {
const legalEntityType = useLegalEntityType({ legalEntity });
const { isSettingEnabled } = useSettingsContext();
switch (legalEntityType) {
case LegalEntityTypes.INDIVIDUAL: return !isSettingEnabled(SettingNames.HideOnboardingIntroductionIndividual);
case LegalEntityTypes.ORGANIZATION: return !isSettingEnabled(SettingNames.HideOnboardingIntroductionOrganization);
case LegalEntityTypes.SOLE_PROPRIETORSHIP: return !isSettingEnabled(SettingNames.HideOnboardingIntroductionSoleProprietor);
case LegalEntityTypes.TRUST: return !isSettingEnabled(SettingNames.HideOnboardingIntroductionTrust);
default: return false;
}
};
//#endregion
export { useLegalEntityType as n, useCanSeeIntroduction as t };