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.

62 lines (61 loc) 2.7 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] = "d31ddadb-6baa-4e9b-95e6-47891fb8b20f", e._sentryDebugIdIdentifier = "sentry-dbid-d31ddadb-6baa-4e9b-95e6-47891fb8b20f"); } catch (e) {} import { r as useTranslation } from "./translation-BFxyJ1c5.js"; import { t as createFormUtils } from "./formUtils-DCvL3uZG.js"; import { t as Field } from "./Field-pcJkjIG_.js"; import { t as InputText } from "./InputText-C30dZxS4.js"; import { jsx, jsxs } from "preact/jsx-runtime"; //#region src/components/Shared/fields/Name/Name.tsx var nameFields = ["firstName", "lastName"]; function Name(props) { const { data, handleFieldChange, errors, valid, fieldValidationErrors } = props; const { t } = useTranslation("common"); if (!handleFieldChange) return; const formUtils = createFormUtils(props, t); return /* @__PURE__ */ jsxs("div", { className: "adyen-kyc-field-wrapper", children: [formUtils.isRequiredField("firstName") && /* @__PURE__ */ jsx(Field, { name: "firstName", label: formUtils.getLabel("firstName"), className: "adyen-kyc-u-width-half", errorMessage: formUtils.getErrorMessage("firstName", errors, fieldValidationErrors), isValid: valid?.firstName, helper: formUtils.getLabel("enterNameExactlyAsAppearInID"), children: (childProps) => /* @__PURE__ */ jsx(InputText, { ...childProps, name: "firstName", value: data?.firstName, readonly: formUtils.isReadOnly("firstName"), onInput: handleFieldChange("firstName", "input"), onBlur: handleFieldChange("firstName", "blur"), trimOnBlur: true, spellCheck: false, "aria-required": true, "aria-invalid": !valid?.firstName }) }), formUtils.isRequiredField("lastName") && /* @__PURE__ */ jsx(Field, { name: "lastName", label: formUtils.getLabel("lastName"), className: "adyen-kyc-u-width-half", errorMessage: formUtils.getErrorMessage("lastName", errors, fieldValidationErrors), isValid: valid?.lastName, helper: formUtils.getLabel("enterLastNameExactlyAsAppearInID"), children: (childProps) => /* @__PURE__ */ jsx(InputText, { ...childProps, name: "lastName", value: data?.lastName, readonly: formUtils.isReadOnly("lastName"), onInput: handleFieldChange("lastName", "input"), onBlur: handleFieldChange("lastName", "blur"), trimOnBlur: true, spellCheck: false, "aria-required": true, "aria-invalid": !valid?.lastName }) })] }); } //#endregion export { nameFields as n, Name as t };