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.

38 lines (37 loc) 1.89 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] = "7f436cd8-46e3-4953-841c-bdf80d4f6089", e._sentryDebugIdIdentifier = "sentry-dbid-7f436cd8-46e3-4953-841c-bdf80d4f6089"); } catch (e) {} import { r as useTranslation } from "./translation-BYvhW5zA.js"; import { C as useDataset, w as datasetIdentifier } from "./resolveEnvironment-DNmu53Rr.js"; import { t as Field } from "./Field-DoXLi6EY.js"; import { t as Select } from "./Select-DUo2rOfa.js"; import { useMemo } from "preact/hooks"; import { jsx } from "preact/jsx-runtime"; //#region src/components/Shared/fields/CountryField/CountryField.tsx var COUNTRY_FIELD = ["country"]; function CountryField({ name = "country", data, valid, errors, labels, readonly, handleChangeFor, helperText, allowedCountries, handleBlur }) { const { t } = useTranslation("common"); const { dataset: countriesFromApi } = useDataset(datasetIdentifier.country); const countries = useMemo(() => countriesFromApi.filter((country) => allowedCountries ? allowedCountries.includes(country.id) : true), [allowedCountries, countriesFromApi]); return /* @__PURE__ */ jsx(Field, { name, label: labels?.country || t(($) => $["country"]), errorMessage: errors.country, isValid: valid.country, helper: helperText, dataTestId: "country", children: (childProps) => /* @__PURE__ */ jsx(Select, { ...childProps, name, placeholder: t(($) => $["selectCountryRegion"]), selected: data.country, items: countries, readonly: (countries.length === 1 || readonly) && !!data, onChange: handleChangeFor("country"), onBlur: handleBlur }) }); } //#endregion export { CountryField as n, COUNTRY_FIELD as t };