@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.
39 lines (38 loc) • 1.73 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] = "b234228b-6e72-43dc-a6d1-11b8a261a6f5", e._sentryDebugIdIdentifier = "sentry-dbid-b234228b-6e72-43dc-a6d1-11b8a261a6f5");
} catch (e) {}
import { r as useTranslation } from "./translation-BFxyJ1c5.js";
import { t as Alert } from "./Alert-C6gL3JIt.js";
import { jsx } from "preact/jsx-runtime";
//#region src/components/ui/molecules/Alert/VerificationErrorAlert.tsx
var VerificationErrorAlert = ({ className, problems, children, fallbackErrorMessage }) => {
const { t } = useTranslation("common");
if (problems?.verificationErrors && Object.keys(problems.verificationErrors).length > 0) {
const childErrors = Object.values(problems.verificationErrors).reduce((acc, parentChildErrors) => {
acc = {
...acc,
...parentChildErrors
};
return acc;
}, {});
const childErrorCodes = Object.keys(childErrors);
if (childErrorCodes.length === 1) {
const remediationActions = Object.values(childErrors?.[childErrorCodes?.[0]] ?? {}).flat();
if (remediationActions.length === 1) return /* @__PURE__ */ jsx(Alert, {
className,
variant: "error",
title: `${t(($) => $[`errorMessage_${childErrorCodes[0]}`])}. ${t(($) => $[`remediationMessage_${remediationActions[0].code}`])}`,
children
});
}
}
return /* @__PURE__ */ jsx(Alert, {
className,
variant: "error",
title: fallbackErrorMessage ?? t(($) => $["verificationErrorMessage"]),
children
});
};
//#endregion
export { VerificationErrorAlert as t };