@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.
109 lines (108 loc) • 4.53 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] = "c54b8b7d-9fda-48b2-9861-cf1c78c51c68", e._sentryDebugIdIdentifier = "sentry-dbid-c54b8b7d-9fda-48b2-9861-cf1c78c51c68");
} catch (e) {}
import { t as CountryCodes } from "./country-code-CJk2hdPu.js";
import { r as KEYBOARD_KEYS } from "./Modal-BLP2aF-u.js";
import { a as validateNotEmptyOnBlur, i as validateLegalCompanyName, r as validateLatinSpaceMarkPunctuationNumbersOnlyOnBlur } from "./patternValidators-DFve5Dzt.js";
import { t as Field } from "./Field-DoXLi6EY.js";
import { t as InputText } from "./InputText-B0N7am-q.js";
import { jsx } from "preact/jsx-runtime";
//#region src/components/Shared/fields/LegalCompanyNameField/fieldConfig.ts
var defaultFieldMetadata = {
label: "legalCompanyName",
validators: validateNotEmptyOnBlur
};
var defaultFieldConfig = {
[CountryCodes.Australia]: {
label: "legalCompanyName",
validators: validateNotEmptyOnBlur
},
[CountryCodes.HongKong]: {
label: "legalCompanyName",
validators: validateNotEmptyOnBlur
},
[CountryCodes.Netherlands]: {
label: "legalCompanyName",
validators: validateNotEmptyOnBlur
},
[CountryCodes.Singapore]: {
label: "legalCompanyName",
validators: validateNotEmptyOnBlur
},
[CountryCodes.UnitedStates]: {
label: "legalCompanyName",
validators: validateNotEmptyOnBlur
}
};
var defaultFieldMetadataV4 = {
label: "legalCompanyName",
validators: validateLegalCompanyName
};
var defaultFieldConfigV4 = {
[CountryCodes.Australia]: {
label: "legalCompanyName",
validators: validateLegalCompanyName
},
[CountryCodes.HongKong]: {
label: "legalCompanyName",
validators: validateLegalCompanyName
},
[CountryCodes.Netherlands]: {
label: "legalCompanyName",
validators: validateLegalCompanyName
},
[CountryCodes.Singapore]: {
label: "legalCompanyName",
validators: validateLegalCompanyName
},
[CountryCodes.UnitedStates]: {
label: "legalCompanyName",
validators: validateLegalCompanyName
},
[CountryCodes.Japan]: {
label: "legalCompanyName__JP",
validators: [...validateLegalCompanyName, validateLatinSpaceMarkPunctuationNumbersOnlyOnBlur]
}
};
/**
* Returns the guidance text for the legal company name field based on country.
*/
var getLegalCompanyNameGuidanceText = (t, { country }) => {
switch (country) {
case CountryCodes.Australia: return t(($) => $["enterTheNameExactlyAsItIsOnYourAustralianSecuritiesAndInvestmentCommission"], { ns: "business" });
case CountryCodes.HongKong: return t(($) => $["enterTheNameExactlyAsItIsOnYourHongKongCompaniesRegistryCertificateOfIncorporation"], { ns: "business" });
case CountryCodes.Netherlands: return t(($) => $["enterTheNameExactlyAsItIsOnYourChamberOfCommerceRegistration"], { ns: "business" });
case CountryCodes.Singapore: return t(($) => $["enterTheNameExactlyAsItIsOnYourAccountingAndCorporateRegulatoryAuthorityBizFile"], { ns: "business" });
case CountryCodes.UnitedStates: return t(($) => $["theBusinessNameExactlyAsItAppearsOnGovernmentOrLegalForms"], { ns: "business" });
default: return t(($) => $["theLegalNameIsUsedToIdentifyABusinessWithTheGovernment"], { ns: "business" });
}
};
//#endregion
//#region src/components/Shared/fields/LegalCompanyNameField/LegalCompanyNameField.tsx
var LEGAL_COMPANY_NAME_FIELD = ["legalCompanyName"];
function LegalCompanyNameField({ data, valid, errors, labels, guidance, readonly, handleChangeFor }) {
const handleKeyDown = (e) => {
if (e.key === KEYBOARD_KEYS.enter) e.preventDefault();
};
return /* @__PURE__ */ jsx(Field, {
name: "legalCompanyName",
label: labels.legalCompanyName,
formatGuidance: guidance,
errorMessage: errors.legalCompanyName,
isValid: valid.legalCompanyName,
children: (childProps) => /* @__PURE__ */ jsx(InputText, {
...childProps,
"aria-required": true,
"aria-invalid": !valid.legalCompanyName,
name: "legalCompanyName",
value: data.legalCompanyName,
readonly,
onInput: handleChangeFor("legalCompanyName", "input"),
onBlur: handleChangeFor("legalCompanyName", "blur"),
onKeyDown: handleKeyDown
})
});
}
//#endregion
export { defaultFieldMetadata as a, defaultFieldConfigV4 as i, LegalCompanyNameField as n, defaultFieldMetadataV4 as o, defaultFieldConfig as r, getLegalCompanyNameGuidanceText as s, LEGAL_COMPANY_NAME_FIELD as t };