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.

1,022 lines 86 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] = "93231967-0ab9-43ea-93ea-7f5b6f3290e7", e._sentryDebugIdIdentifier = "sentry-dbid-93231967-0ab9-43ea-93ea-7f5b6f3290e7"); } catch (e) {} import { i as Typography, r as useTranslation } from "./translation-BFxyJ1c5.js"; import { r as Loader, t as Button } from "./Button-oj6H8OrC.js"; import { n as httpGet, s as useApiContext } from "./http-D1NDkBxF.js"; import { t as LegalEntityTypes } from "./legal-entity-type-VIfNYnJP.js"; import { t as useSettingsContext } from "./useSettingsContext-DzwVt0W0.js"; import { r as cloneObject, t as useAnalyticsContext } from "./useAnalyticsContext-BVFDMrVE.js"; import { a as translateTranslatable } from "./utils-B807QaDx.js"; import { t as Header } from "./Header-CPmJyuoP.js"; import { n as datasetUtilities } from "./datasetUtil-Zd4TCTDn.js"; import { y as reverseMapping } from "./processCapabilities-DlZY9-Jc.js"; import { f as hasSolePropInLegalEntity } from "./entityAssociationUtil-BEzUdPbm.js"; import { t as isEeaCountry } from "./country-COrdWGaq.js"; import { t as SettingNames } from "./types-CNZsK2dZ.js"; import { t as useToastContext } from "./useToastContext-CYgfHjSb.js"; import { t as EndStateLayout } from "./EndStateLayout-ChS-vdMt.js"; import { t as useInvalidateRootLegalEntity } from "./invalidateRootLegalEntity-CZr0iiji.js"; import { t as useAssociatedLegalEntity } from "./useAssociatedLegalEntity-zrU8J6iw.js"; import { t as useCreateLegalEntity } from "./useCreateLegalEntity-BK1XURnK.js"; import { t as useUpdateLegalEntity } from "./useUpdateLegalEntity-CtaRaKZ6.js"; import { t as Address } from "./Address-D5EL-3iQ.js"; import { n as FormFlow, r as FormContextProvider, t as useFormContext } from "./useFormContext-Cx9-3iXR.js"; import { i as useFormComposer, n as getRequiredForms, t as addValidityToForms } from "./dropinUtils-IdasFZCU.js"; import { t as ErrorPanel } from "./ErrorPanel-B536hgSc.js"; import { t as createFormUtils } from "./formUtils-DCvL3uZG.js"; import { t as useMultiForm } from "./useMultiForm-B3e1ImN3.js"; import { t as useTaskLandedEvent } from "./useTaskLandedEvent-DInxWeqN.js"; import { c as COUNTRIES_WITH_STATES_DATASET, n as getAddressSchemaLabelsByCountry, t as getAddressSchemaForCountry } from "./utils-CfTVU2Hq.js"; import { i as isValidationError, o as processValidationErrors, s as isMaintenanceModeError } from "./validationError-BzQCrJPn.js"; import { r as formatObject } from "./utils-oc3EdK6K.js"; import { t as localizeDateString } from "./localizeDateString-1A3eC6hp.js"; import { t as Field } from "./Field-pcJkjIG_.js"; import { t as Select } from "./Select-CcSRI-H0.js"; import { t as Checkbox } from "./Checkbox-BCYjFPa4.js"; import { t as getFieldProps } from "./getProps-CkZCnNxW.js"; import { t as Link } from "./Link-6M1PZnz2.js"; import { t as InputText } from "./InputText-C30dZxS4.js"; import { t as InputDate } from "./InputDate-XX9jaw9v.js"; import { n as CountryField } from "./CountryField-Dh4DfjBf.js"; import { t as RadioGroup } from "./RadioGroup-7g7Xv9rl.js"; import { t as currencyByCountry } from "./types-qnPNJzLh.js"; import { a as LegalFormField, i as InputCurrency, n as Currency, o as mapFinancialReportsToFinancialInformation, r as InputNumber, s as mapFinancialInformationToFinancialReport, t as CURRENCY_FIELD } from "./Currency-DtAL1CZd.js"; import { t as NewSummary } from "./NewSummary-C-LKBMpr.js"; import { t as businessFinancingMultiformRules } from "./validate-Da7Onair.js"; import { useEffect, useMemo, useRef, useState } from "preact/hooks"; import { Fragment, jsx, jsxs } from "preact/jsx-runtime"; import { useQuery } from "@tanstack/preact-query"; //#region src/components/EFP/mapping/businessFinancingKeyMappings.ts var businessFinancingBaseMapping = { legalProceedingsDate: "organization.dateOfInitiationOfLegalProceeding", legalInformationInsolvency: "organization.statusOfLegalProceeding", legalEntityIdentifier: "organization.globalLegalEntityIdentifier", naceCode: "organization.economicSector", legalForm: "organization.legalForm", legalName: "organization.legalName", "registrationAddress.city": "organization.registeredAddress.city", "registrationAddress.country": "organization.registeredAddress.country", "registrationAddress.postalCode": "organization.registeredAddress.postalCode", "registrationAddress.stateOrProvince": "organization.registeredAddress.stateOrProvince", "registrationAddress.address": "organization.registeredAddress.street", "registrationAddress.otherAddressInformation": "organization.registeredAddress.street2" }; var businessFinancingIndividualMapping = { gender: "individual.birthData.genderCode", countryOfBirth: "individual.birthData.birthCountry" }; var businessFinancingSoleProprietorMapping = { legalProceedingsDate: "soleProprietorship.dateOfInitiationOfLegalProceeding", legalInformationInsolvency: "soleProprietorship.statusOfLegalProceeding", naceCode: "soleProprietorship.economicSector" }; var businessFinancingComponentsKeyMapping = { ...businessFinancingBaseMapping }; ({ ...businessFinancingIndividualMapping }); var businessFinancingSoleProprietorComponentsKeyMapping = { ...businessFinancingSoleProprietorMapping }; var businessFinancingApiKeyMapping = { ...reverseMapping(businessFinancingBaseMapping) }; var businessFinancingIndividualApiKeyMapping = { ...reverseMapping(businessFinancingIndividualMapping) }; var businessFinancingSoleProprietorApiKeyMapping = { ...reverseMapping(businessFinancingSoleProprietorMapping) }; //#endregion //#region src/components/EFP/mapping/mapBusinessFinancingToLegalEntity.ts var mapBusinessFinancingToLegalEntity = (data, isIndividualOrSoleProprietor, customMapping) => { if (customMapping) return formatObject(data, customMapping); return formatObject(data, isIndividualOrSoleProprietor ? businessFinancingSoleProprietorApiKeyMapping : businessFinancingApiKeyMapping); }; //#endregion //#region src/components/EFP/tasks/BusinessFinancingDropin/types.ts var BusinessFinancingPages = { COMPANY_PAGE: "company", SOLE_PROPRIETOR_PAGE: "soleProprietor", PARENT_COMPANY_PAGE: "parentCompany", ULTIMATE_PARENT_COMPANY_PAGE: "ultimateParentCompany" }; var BusinessFinancingRadioIds = { YES: "Yes", NO: "No" }; var businessFinancingRadioItems = [{ id: BusinessFinancingRadioIds.YES, name: "yes" }, { id: BusinessFinancingRadioIds.NO, name: "no" }]; var businessFinancingParentRadioItems = [{ id: BusinessFinancingRadioIds.YES, name: "yes" }, { id: BusinessFinancingRadioIds.NO, name: "noIdontKnow" }]; var companySchemaKeys = [ "legalForm", "naceCode", "numberOfEmployees", "doesYourCompanyHaveLEI", "legalEntityIdentifier", "isCompanyOwnedByAnotherCompany", "isParentOwnedByAnotherCompany", "financialReportingDate", "currency", "balanceSheetTotal", "annualTurnover", "legalInformationInsolvency", "legalProceedingsDate" ]; var soleProprietorSchemaKeys = [ "gender", "countryOfBirth", "naceCode", "legalInformationInsolvency", "legalProceedingsDate" ]; var parentCompaniesSchemaKeys = [ "legalName", "legalForm", "naceCode", "numberOfEmployees", "doesYourCompanyHaveLEI", "legalEntityIdentifier", "isThisAddressTheMainHeadquarters", "financialReportingDate", "currency", "balanceSheetTotal", "annualTurnover", "legalInformationInsolvency", "legalProceedingsDate", "registrationAddress", "sameAddressAsRootEntity" ]; var businessFinancingForms = { company: { formId: "company", formName: "businessInformation", fields: [...companySchemaKeys] }, soleProprietor: { formId: "soleProprietor", formName: "businessInformation", fields: [...soleProprietorSchemaKeys] }, parentCompany: { formId: "parentCompany", formName: "parentCompanyInformation", fields: [...parentCompaniesSchemaKeys] }, ultimateParentCompany: { formId: "ultimateParentCompany", formName: "ultimateParentCompanyInformation", fields: [...parentCompaniesSchemaKeys] } }; var BusinessFinancingIndices = { COMPANY: "company", SOLE_PROPRIETOR: "soleProprietor", PARENT_COMPANY: "parentCompany", ULTIMATE_PARENT_COMPANY: "ultimateParentCompany" }; //#endregion //#region src/components/EFP/tasks/BusinessFinancingDropin/utils.ts var getLegalEntityId = (businessFinancingIndex, rootLegalEntity) => { if (!rootLegalEntity) return void 0; if (businessFinancingIndex === BusinessFinancingIndices.COMPANY || businessFinancingIndex === BusinessFinancingIndices.SOLE_PROPRIETOR) return rootLegalEntity.id; if (!rootLegalEntity?.entityAssociations) return void 0; const businessFinancingEntityType = BusinessFinancingIndices.PARENT_COMPANY ? "immediateParentCompany" : "ultimateParentCompany"; return (rootLegalEntity.entityAssociations?.find((entity) => entity.type === businessFinancingEntityType))?.legalEntityId; }; var USER_LOCALE = typeof navigator !== "undefined" ? navigator.language : "en-US"; var entityHasParentCompany = (data) => data.company?.isCompanyOwnedByAnotherCompany && data.company?.isCompanyOwnedByAnotherCompany === "Yes"; var entityHasUltimateParentCompany = (data) => data.company?.isParentOwnedByAnotherCompany && data.company?.isParentOwnedByAnotherCompany === "Yes"; var financialReportsToString = (financialReports) => { return { ...financialReports, numberOfEmployees: financialReports.numberOfEmployees ? financialReports.numberOfEmployees.toString() : void 0, annualTurnover: financialReports.annualTurnover ? financialReports.annualTurnover.toString() : void 0, balanceSheetTotal: financialReports.balanceSheetTotal ? financialReports.balanceSheetTotal.toString() : void 0 }; }; /** * Prepares sole proprietor business financing data for submission. * IMPORTANT: Both root LE (individual) and sole prop LE MUST exist before calling this. * This function always returns UPDATE payloads (with IDs), never CREATE payloads. */ var prepareSoleProprietorBusinessFinancingSubmitData = (data, rootLegalEntity, soleProprietorLegalEntity) => { const businessFinancingData = data.soleProprietor; if (!businessFinancingData || !rootLegalEntity?.id || !soleProprietorLegalEntity?.id) return null; const individualChanges = mapBusinessFinancingToLegalEntity(businessFinancingData, true, businessFinancingIndividualApiKeyMapping); const { identificationData: _identificationData, ...individualWithoutIdData } = rootLegalEntity.individual || {}; const individualPayload = { id: rootLegalEntity.id, individual: { ...individualWithoutIdData, ...individualChanges.individual } }; const solePropChanges = mapBusinessFinancingToLegalEntity(businessFinancingData, true, businessFinancingSoleProprietorApiKeyMapping); if (!solePropChanges.soleProprietorship) return null; if (solePropChanges.soleProprietorship.statusOfLegalProceeding === "iDontKnow") solePropChanges.soleProprietorship.statusOfLegalProceeding = "noLegalActionsTaken"; if (solePropChanges.soleProprietorship.statusOfLegalProceeding === "iDontKnow" || solePropChanges.soleProprietorship.statusOfLegalProceeding === "noLegalActionsTaken") solePropChanges.soleProprietorship.dateOfInitiationOfLegalProceeding = ""; return { individualPayload, solePropPayload: { id: soleProprietorLegalEntity.id, soleProprietorship: { ...soleProprietorLegalEntity.soleProprietorship, ...solePropChanges.soleProprietorship } } }; }; var prepareBusinessFinancingSubmitData = (businessFinancingIndex, data, rootLegalEntity) => { const businessFinancingData = data[businessFinancingIndex]; if (!businessFinancingData) return null; if (businessFinancingIndex === BusinessFinancingIndices.PARENT_COMPANY && !entityHasParentCompany(data)) return null; if (businessFinancingIndex === BusinessFinancingIndices.ULTIMATE_PARENT_COMPANY && (!entityHasUltimateParentCompany(data) || !entityHasParentCompany(data))) return null; const businessFinancingDetails = mapBusinessFinancingToLegalEntity(businessFinancingData); const isSoleProprietor = businessFinancingIndex === BusinessFinancingIndices.SOLE_PROPRIETOR; if (isSoleProprietor) throw new Error("Use prepareSoleProprietorBusinessFinancingSubmitData for sole proprietor business financing"); else if (isSoleProprietor === false) { if (!businessFinancingDetails.organization) return null; const businessFinancingCountry = businessFinancingDetails.organization.registeredAddress?.country || rootLegalEntity?.organization?.registeredAddress?.country; const companyData = businessFinancingData; if (companyData.financialReportingDate && isEeaCountry(businessFinancingCountry)) { const { balanceSheetTotal: bst, ...restFinancialReport } = mapFinancialInformationToFinancialReport({ currency: companyData.currency, financialReportingDate: companyData.financialReportingDate, numberOfEmployees: companyData.numberOfEmployees ? Number(companyData.numberOfEmployees) : void 0, balanceSheetTotal: companyData.balanceSheetTotal ? Number(companyData.balanceSheetTotal) : void 0, annualTurnover: companyData.annualTurnover ? Number(companyData.annualTurnover) : void 0 }); const businessFinancingFinancialReport = { ...restFinancialReport, netAssets: bst }; businessFinancingDetails.organization.financialReports = [businessFinancingFinancialReport]; } if (!isEeaCountry(businessFinancingCountry)) businessFinancingDetails.organization.financialReports = void 0; if (businessFinancingDetails.organization.statusOfLegalProceeding === "iDontKnow") businessFinancingDetails.organization.statusOfLegalProceeding = "noLegalActionsTaken"; if (businessFinancingDetails.organization.statusOfLegalProceeding === "iDontKnow" || businessFinancingDetails.organization.statusOfLegalProceeding === "noLegalActionsTaken") businessFinancingDetails.organization.dateOfInitiationOfLegalProceeding = ""; if (companyData.sameAddressAsRootEntity && rootLegalEntity?.organization?.registeredAddress) businessFinancingDetails.organization.registeredAddress = { ...rootLegalEntity.organization.registeredAddress }; if (companyData.isThisAddressTheMainHeadquarters) businessFinancingDetails.organization.principalPlaceOfBusiness = { ...businessFinancingDetails.organization.registeredAddress }; if (companyData.doesYourCompanyHaveLEI !== "Yes") delete businessFinancingDetails.organization.globalLegalEntityIdentifier; } const businessFinancingLegalEntityId = getLegalEntityId(businessFinancingIndex, rootLegalEntity); if (businessFinancingLegalEntityId) { delete businessFinancingDetails.type; businessFinancingDetails.id = businessFinancingLegalEntityId; } else { delete businessFinancingDetails.id; businessFinancingDetails.type = isSoleProprietor ? LegalEntityTypes.SOLE_PROPRIETORSHIP : LegalEntityTypes.ORGANIZATION; } return businessFinancingDetails; }; var appendBusinessFinancingData = (legalOrganization, businessFinancingData) => { if (!legalOrganization || !businessFinancingData) return businessFinancingData; const clonedBusinessFinancingData = { ...businessFinancingData }; let financialReportData = {}; if (legalOrganization.financialReports) { financialReportData = financialReportsToString(mapFinancialReportsToFinancialInformation((Array.isArray(legalOrganization.financialReports) ? legalOrganization.financialReports : [legalOrganization.financialReports]).map(({ netAssets, ...rest }) => ({ ...rest, balanceSheetTotal: rest.balanceSheetTotal ?? netAssets })), false)); if (financialReportData.numberOfEmployees) financialReportData.numberOfEmployees = financialReportData.numberOfEmployees.toString(); } return { ...clonedBusinessFinancingData, ...financialReportData, numberOfEmployees: financialReportData.numberOfEmployees ? financialReportData.numberOfEmployees.toString() : void 0, doesYourCompanyHaveLEI: legalOrganization.globalLegalEntityIdentifier ? "Yes" : "No", isThisAddressTheMainHeadquarters: legalOrganization.principalPlaceOfBusiness ? "Yes" : clonedBusinessFinancingData.isThisAddressTheMainHeadquarters }; }; var appendSoleProprietorBusinessFinancingData = (legalArrangement, businessFinancingData) => { if (!legalArrangement || !businessFinancingData) return businessFinancingData; return { ...businessFinancingData, naceCode: businessFinancingData.naceCode ?? legalArrangement.economicSector, legalInformationInsolvency: businessFinancingData.legalInformationInsolvency ?? legalArrangement.statusOfLegalProceeding, legalProceedingsDate: businessFinancingData.legalProceedingsDate ?? legalArrangement.dateOfInitiationOfLegalProceeding }; }; var handleBusinessFinancingFormSubmission = async (businessFinancingType, details, createFunction, updateFunction, entityId) => { if (!details) throw new Error(`Missing details for ${businessFinancingType}`); try { if (entityId) return await updateFunction({ ...details, id: entityId }); return await createFunction(details); } catch (error) { const businessFinancingError = /* @__PURE__ */ new Error(`Form submission failed for ${businessFinancingType}`); businessFinancingError.actualError = error; businessFinancingError.businessFinancingType = businessFinancingError; throw businessFinancingError; } }; var getCompanySchemaKeys = (country, currentData, schemaKeys) => { const fieldsToRemove = []; if (!isEeaCountry(country)) fieldsToRemove.push("financialReportingDate", "balanceSheetTotal", "annualTurnover", "currency", "numberOfEmployees"); if (currentData.isCompanyOwnedByAnotherCompany !== "Yes") fieldsToRemove.push("isParentOwnedByAnotherCompany"); if (currentData.doesYourCompanyHaveLEI !== "Yes") fieldsToRemove.push("legalEntityIdentifier"); if (!currentData?.legalInformationInsolvency || ["noLegalActionsTaken", "iDontKnow"].includes(currentData?.legalInformationInsolvency)) fieldsToRemove.push("legalProceedingsDate"); return schemaKeys.filter((field) => !fieldsToRemove.includes(field)); }; var getSoleProprietorSchemaKeys = (currentData, schemaKeys) => { const fieldsToRemove = []; if (!currentData?.legalInformationInsolvency || ["noLegalActionsTaken", "iDontKnow"].includes(currentData?.legalInformationInsolvency)) fieldsToRemove.push("legalProceedingsDate"); return schemaKeys.filter((field) => !fieldsToRemove.includes(field)); }; var getParentCompanySchemaKeys = (currentData, schemaKeys, rootEntityAddress) => { const fieldsToRemove = []; if (!isEeaCountry(currentData?.sameAddressAsRootEntity && rootEntityAddress ? rootEntityAddress.country : currentData?.registrationAddress?.country)) fieldsToRemove.push("financialReportingDate", "balanceSheetTotal", "annualTurnover", "currency", "numberOfEmployees"); if (currentData?.sameAddressAsRootEntity) fieldsToRemove.push("registrationAddress"); if (currentData.doesYourCompanyHaveLEI !== "Yes") fieldsToRemove.push("legalEntityIdentifier"); if (!currentData?.legalInformationInsolvency || ["noLegalActionsTaken", "iDontKnow"].includes(currentData?.legalInformationInsolvency)) fieldsToRemove.push("legalProceedingsDate"); return schemaKeys.filter((field) => !fieldsToRemove.includes(field)); }; var getBusinessFinancingRequiredFields = (country, data, rootEntityAddress) => { let requiredFields = void 0; if (!data) return requiredFields; const { company, soleProprietor, parentCompany = {}, ultimateParentCompany = {} } = data; if (soleProprietor) { requiredFields = {}; requiredFields.soleProprietor = getSoleProprietorSchemaKeys(soleProprietor, soleProprietorSchemaKeys); delete requiredFields.company; return requiredFields; } if (company) { requiredFields = {}; requiredFields.company = getCompanySchemaKeys(country, company, companySchemaKeys); } if (company?.isCompanyOwnedByAnotherCompany === "Yes") { const parentCompanyRequiredFields = getParentCompanySchemaKeys(parentCompany, parentCompaniesSchemaKeys, rootEntityAddress); requiredFields = { ...requiredFields, parentCompany: parentCompanyRequiredFields }; } if (company?.isParentOwnedByAnotherCompany === "Yes") { const ultimateParentCompanyRequiredFields = getParentCompanySchemaKeys(ultimateParentCompany, parentCompaniesSchemaKeys, rootEntityAddress); requiredFields = { ...requiredFields, ultimateParentCompany: ultimateParentCompanyRequiredFields }; } return requiredFields; }; var getAddressCountryForParentCompany = (parentCompany, leAddress) => { return parentCompany?.sameAddressAsRootEntity && leAddress ? leAddress?.country : parentCompany?.registrationAddress?.country; }; //#endregion //#region src/components/EmbeddedDropins/BusinessFinancingComponent/utils.ts var getTranslatedGender = (t, gender) => { if (!gender) return void 0; const key = { M: "male", F: "female", U: "preferNotToSay" }[gender]; return key ? t(($) => $[key]) : gender; }; var getTranslatedLegalInsolvency = (t, insolvencyData) => { if (!insolvencyData) return void 0; return insolvencyData === "noLegalActionsTaken" ? t(($) => $["no"]) : t(($) => $[insolvencyData]); }; var getValidUserLocale = (locale) => { try { new Intl.NumberFormat(locale); return locale; } catch (error) { console.warn(`Invalid locale '${locale}' provided. Falling back to 'en-US'.`, error); return "en-US"; } }; var getFormattedAmount = (value, currency) => { if (!value) return void 0; const userLocale = getValidUserLocale(USER_LOCALE); return `${currency} ${Number(value).toLocaleString(userLocale)}`; }; var formatDataForSummary = (language, t, datasetUtils, data, rootLeAddress) => { const summaryData = cloneObject(data) || {}; const { company, parentCompany, ultimateParentCompany, soleProprietor } = summaryData; if (soleProprietor) { soleProprietor.naceCode = soleProprietor.naceCodeLabel; soleProprietor.countryOfBirth = soleProprietor.countryOfBirth ? datasetUtils.getCountryName(soleProprietor.countryOfBirth) ?? void 0 : void 0; soleProprietor.legalInformationInsolvency = getTranslatedLegalInsolvency(t, soleProprietor.legalInformationInsolvency); soleProprietor.legalProceedingsDate = soleProprietor.legalProceedingsDate ? localizeDateString(soleProprietor.legalProceedingsDate, language) : void 0; if (soleProprietor.gender) soleProprietor.gender = getTranslatedGender(t, soleProprietor.gender); } if (company) { company.legalForm = company.legalFormLabel; company.naceCode = company.naceCodeLabel; company.legalEntityIdentifier = company.legalEntityIdentifier ?? "None"; company.legalInformationInsolvency = getTranslatedLegalInsolvency(t, company?.legalInformationInsolvency); company.annualTurnover = getFormattedAmount(company.annualTurnover, company.currency); company.balanceSheetTotal = getFormattedAmount(company.balanceSheetTotal, company.currency); const { legalProceedingsDate, financialReportingDate } = company; company.legalProceedingsDate = legalProceedingsDate ? localizeDateString(legalProceedingsDate, language) : void 0; company.financialReportingDate = financialReportingDate ? localizeDateString(financialReportingDate, language) : void 0; } if (parentCompany) { const { legalName, legalFormLabel, naceCodeLabel, country, legalEntityIdentifier, legalInformationInsolvency, annualTurnover, currency, balanceSheetTotal, legalProceedingsDate, financialReportingDate, sameAddressAsRootEntity, registrationAddress } = parentCompany; if (legalName) { parentCompany.legalForm = legalFormLabel; parentCompany.naceCode = naceCodeLabel; parentCompany.country = country ? datasetUtils.getCountryName(country) : ""; if (registrationAddress) parentCompany.registrationAddress = { ...registrationAddress, country: datasetUtils.getCountryName(registrationAddress?.country) }; parentCompany.legalEntityIdentifier = legalEntityIdentifier ?? "None"; parentCompany.legalInformationInsolvency = getTranslatedLegalInsolvency(t, legalInformationInsolvency); parentCompany.annualTurnover = getFormattedAmount(annualTurnover, currency); parentCompany.balanceSheetTotal = getFormattedAmount(balanceSheetTotal, currency); parentCompany.legalProceedingsDate = legalProceedingsDate ? localizeDateString(legalProceedingsDate, language) : void 0; parentCompany.financialReportingDate = financialReportingDate ? localizeDateString(financialReportingDate, language) : void 0; if (sameAddressAsRootEntity) { delete parentCompany.country; summaryData.parentCompany = { ...parentCompany, registrationAddress: { ...rootLeAddress, country: datasetUtils.getCountryName(rootLeAddress?.country) } }; } } } if (ultimateParentCompany) { const { legalName, legalFormLabel, naceCodeLabel, country, legalEntityIdentifier, legalInformationInsolvency, annualTurnover, currency, balanceSheetTotal, legalProceedingsDate, financialReportingDate, sameAddressAsRootEntity, registrationAddress } = ultimateParentCompany; if (legalName) { ultimateParentCompany.legalForm = legalFormLabel; ultimateParentCompany.naceCode = naceCodeLabel; ultimateParentCompany.country = country ? datasetUtils.getCountryName(country) : ""; if (registrationAddress) ultimateParentCompany.registrationAddress = { ...registrationAddress, country: datasetUtils.getCountryName(registrationAddress?.country) }; ultimateParentCompany.legalEntityIdentifier = legalEntityIdentifier ?? "None"; ultimateParentCompany.legalInformationInsolvency = getTranslatedLegalInsolvency(t, legalInformationInsolvency); ultimateParentCompany.annualTurnover = getFormattedAmount(annualTurnover, currency); ultimateParentCompany.balanceSheetTotal = getFormattedAmount(balanceSheetTotal, currency); ultimateParentCompany.legalProceedingsDate = legalProceedingsDate ? localizeDateString(legalProceedingsDate, language) : void 0; ultimateParentCompany.financialReportingDate = financialReportingDate ? localizeDateString(financialReportingDate, language) : void 0; if (sameAddressAsRootEntity) { delete ultimateParentCompany.country; summaryData.ultimateParentCompany = { ...ultimateParentCompany, registrationAddress: { ...rootLeAddress, country: datasetUtils.getCountryName(rootLeAddress?.country) } }; } } } return summaryData; }; //#endregion //#region src/components/EFP/mapping/mapLegalEntityToBusinessFinancing.ts var mapLegalEntityToBusinessFinancing = (legalEntity) => { if (legalEntity.type === LegalEntityTypes.SOLE_PROPRIETORSHIP) return formatObject(legalEntity, businessFinancingSoleProprietorComponentsKeyMapping); if (legalEntity.type === LegalEntityTypes.INDIVIDUAL) { if (legalEntity.entityAssociations?.find((ea) => ea.entityType === LegalEntityTypes.SOLE_PROPRIETORSHIP && ea.associatorId === legalEntity.id)) { const solePropMapped = formatObject(legalEntity, businessFinancingSoleProprietorComponentsKeyMapping); const birthData = legalEntity.individual?.birthData; return { ...solePropMapped, gender: birthData?.genderCode || legalEntity.individual?.gender, countryOfBirth: birthData?.birthCountry || legalEntity.individual?.countryOfBirth }; } } return formatObject(legalEntity, businessFinancingComponentsKeyMapping); }; //#endregion //#region src/api/datasets/useNaceCodes.ts var getNaceCodes = async (baseUrl) => { return httpGet({ baseUrl, path: `datasets/naceCodes` }); }; var useNaceCodes = (options) => { const { baseUrl } = useApiContext(); return useQuery({ queryKey: ["naceCodes"], queryFn: () => getNaceCodes(baseUrl.value), ...options }); }; //#endregion //#region src/components/EFP/fields/NaceCodeField/NaceCodeField.tsx function NaceCodeField({ name = "naceCode", data, valid, errorMessage, label, readonly, handleChangeFor }) { const { t: commonT } = useTranslation("common"); const { data: naceCodesData } = useNaceCodes(); const handleChangeForRef = useRef(handleChangeFor); useEffect(() => { handleChangeForRef.current = handleChangeFor; }, [handleChangeFor]); const handleChangeForNaceCode = (e) => { const naceCodeEvent = { target: { name: "naceCode", value: e.target.value } }; handleChangeFor("naceCode")(naceCodeEvent); }; useEffect(() => { const naceCodeEvent = { target: { name: "naceCodeLabel", value: naceCodesData?.find((naceCode) => naceCode.id === data.naceCode)?.name } }; handleChangeForRef.current("naceCodeLabel")(naceCodeEvent); }, [data.naceCode, naceCodesData]); return /* @__PURE__ */ jsx(Field, { name, label, errorMessage, isValid: valid.naceCode, children: (childProps) => /* @__PURE__ */ jsx(Select, { ...childProps, name, placeholder: commonT(($) => $["selectOne"]), selected: data.naceCode, items: naceCodesData ?? [], readonly: readonly && !!data, onChange: handleChangeForNaceCode }) }); } var BusinessFinancing_module_default = { "business-financing-lei-radio": "adyen-kyc-business-financing-lei-radio", businessFinancingLeiRadio: "adyen-kyc-business-financing-lei-radio", "business-financing-title": "adyen-kyc-business-financing-title", businessFinancingTitle: "adyen-kyc-business-financing-title", "business-financing-body": "adyen-kyc-business-financing-body", businessFinancingBody: "adyen-kyc-business-financing-body", "business-financing-exposure-financials": "adyen-kyc-business-financing-exposure-financials", businessFinancingExposureFinancials: "adyen-kyc-business-financing-exposure-financials", "business-financing-structured-address": "adyen-kyc-business-financing-structured-address", businessFinancingStructuredAddress: "adyen-kyc-business-financing-structured-address" }; //#endregion //#region src/components/EFP/tasks/BusinessFinancingDropin/BusinessFinancingBusinessInformation.tsx var businessInformationFields = [ "legalForm", "naceCode", "naceCodeLabel", "legalFormLabel", "doesYourCompanyHaveLEI", "legalEntityIdentifier" ]; function BusinessFinancingBusinessInformation(props) { const { data, valid, errors, country, handleFieldChange, fieldValidationErrors, targetPage, sectionHeading, hideSectionHeading, isSoleProprietor } = props; const { t: businessFinancingT } = useTranslation("businessFinancing"); const { t: commonT } = useTranslation("common"); const formUtils = createFormUtils(props, commonT); if (!handleFieldChange) return; const isMainCompany = targetPage === BusinessFinancingPages.COMPANY_PAGE; return /* @__PURE__ */ jsxs(Fragment, { children: [ !hideSectionHeading && /* @__PURE__ */ jsx(Typography, { el: "h3", variant: "title", className: BusinessFinancing_module_default.businessFinancingTitle, children: sectionHeading ? businessFinancingT(($) => $[sectionHeading]) : businessFinancingT(($) => $["businessInformation"]) }), !isSoleProprietor && /* @__PURE__ */ jsx(LegalFormField, { name: "legalForm", countryCode: country, data: { legalForm: data?.legalForm }, valid: { legalForm: valid?.legalForm }, errorMessage: formUtils.getErrorMessage("legalForm", errors, fieldValidationErrors), handleChangeFor: handleFieldChange, readonly: false, label: businessFinancingT(($) => $["businessStructure"]) }), /* @__PURE__ */ jsx(NaceCodeField, { name: "naceCode", data: { naceCode: data?.naceCode }, valid: { naceCode: valid?.naceCode }, errorMessage: formUtils.getErrorMessage("naceCode", errors, fieldValidationErrors), handleChangeFor: handleFieldChange, readonly: false, label: businessFinancingT(($) => $["industryAndNaceCode"]) }), !isSoleProprietor && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Field, { el: "fieldset", name: "doesYourCompanyHaveLEI", label: businessFinancingT(($) => $[isMainCompany ? "doesYourCompanyHaveLEI" : "doesThisCompanyHaveLEI"]), helper: /* @__PURE__ */ jsxs(Typography, { el: "div", variant: "body", color: "secondary", className: BusinessFinancing_module_default.businessFinancingBody, children: [ businessFinancingT(($) => $["anLEIIsAUniqueCode"]), " ", /* @__PURE__ */ jsx(Link, { href: "https://search.gleif.org/#/search/", external: true, inline: true, children: businessFinancingT(($) => $["lookUpYourLEI"]) }) ] }), errorMessage: formUtils.getErrorMessage("doesYourCompanyHaveLEI", errors, fieldValidationErrors), children: (childProps) => /* @__PURE__ */ jsx(RadioGroup, { ...childProps, name: "doesYourCompanyHaveLEI", items: isMainCompany ? businessFinancingRadioItems : businessFinancingParentRadioItems, value: data?.doesYourCompanyHaveLEI, disabled: false, className: BusinessFinancing_module_default.businessFinancingLeiRadio, onChange: handleFieldChange("doesYourCompanyHaveLEI"), "aria-required": true, "aria-invalid": !valid?.doesYourCompanyHaveLEI }) }), data?.doesYourCompanyHaveLEI === "Yes" && /* @__PURE__ */ jsx(Field, { name: "legalEntityIdentifier", label: businessFinancingT(($) => $["legalEntityIdentifier"]), errorMessage: formUtils.getErrorMessage("legalEntityIdentifier", errors, fieldValidationErrors), isValid: valid?.legalEntityIdentifier, helper: commonT(($) => $["enterNCharactersWithAMixForExample"], { numChars: 20, example: "529900T8BM49AURSDO55" }), children: (childProps) => /* @__PURE__ */ jsx(InputText, { ...childProps, name: "legalEntityIdentifier", value: data?.legalEntityIdentifier, readonly: false, onInput: handleFieldChange("legalEntityIdentifier", "input"), onBlur: handleFieldChange("legalEntityIdentifier", "blur"), "aria-required": true, "aria-invalid": !valid?.legalEntityIdentifier, isValid: valid?.legalEntityIdentifier }) })] }) ] }); } //#endregion //#region src/components/EFP/tasks/BusinessFinancingDropin/BusinessFinancingFinancialInformation.tsx var TODAY_DATE$1 = (/* @__PURE__ */ new Date()).toISOString().split("T")[0]; var financialInformationFields = [ "numberOfEmployees", "financialReportingDate", "legalEntityIdentifier", "currency", "balanceSheetTotal", "annualTurnover" ]; function BusinessFinancingFinancialInformation(props) { const { data, valid, errors, country, sectionHeading, handleFieldChange, fieldValidationErrors } = props; const { t: businessFinancingT, i18n: i18next } = useTranslation("businessFinancing"); const { t: commonT } = useTranslation("common"); const formUtils = createFormUtils(props, commonT); const currenciesForCurrCountry = useMemo(() => currencyByCountry[country] ?? [], [country]); if (!handleFieldChange) return; const financialData = data; const financialErrors = errors; const isFinancialDataValid = valid; const [firstCurrency] = currenciesForCurrCountry; const defaultCurrency = firstCurrency ?? "EUR"; if (currenciesForCurrCountry.length === 1 && data?.currency !== firstCurrency) handleFieldChange("currency")(firstCurrency); return /* @__PURE__ */ jsxs("section", { children: [ /* @__PURE__ */ jsx(Typography, { el: "h3", variant: "title", className: BusinessFinancing_module_default.businessFinancingTitle, children: sectionHeading ? businessFinancingT(($) => $[sectionHeading]) : businessFinancingT(($) => $["businessFinancials"]) }), /* @__PURE__ */ jsx(Field, { name: "numberOfEmployees", label: businessFinancingT(($) => $["numberOfEmployees"]), helper: businessFinancingT(($) => $["theNumberOfIndividualsReceivingAWageOrSalary"]), errorMessage: formUtils.getErrorMessage("numberOfEmployees", errors, fieldValidationErrors), isValid: valid?.numberOfEmployees, children: (childProps) => /* @__PURE__ */ jsx(InputNumber, { ...childProps, "aria-required": true, "aria-invalid": !valid?.numberOfEmployees, name: "numberOfEmployees", min: "0", step: "1", value: data?.numberOfEmployees, onInput: handleFieldChange("numberOfEmployees", "input"), onBlur: handleFieldChange("numberOfEmployees", "blur") }) }), currenciesForCurrCountry?.length > 1 && /* @__PURE__ */ jsx(Currency, { country, data: formUtils.getFieldData(financialData, CURRENCY_FIELD), errors: formUtils.getFieldErrors(financialErrors, fieldValidationErrors, CURRENCY_FIELD), handleChangeFor: handleFieldChange, labels: { currency: businessFinancingT(($) => $["financialStatementReportingCurrency"]) }, readonly: formUtils.isReadOnly("currency"), valid: formUtils.getFieldValid(isFinancialDataValid, CURRENCY_FIELD) }), /* @__PURE__ */ jsxs("div", { className: BusinessFinancing_module_default.businessFinancingExposureFinancials, children: [ /* @__PURE__ */ jsx(Field, { name: "balanceSheetTotal", label: businessFinancingT(($) => $["balanceSheetTotal"]), helper: businessFinancingT(($) => $["theSumOfTotalLiabilities"]), errorMessage: formUtils.getErrorMessage("balanceSheetTotal", errors, fieldValidationErrors), isValid: valid?.balanceSheetTotal, children: (childProps) => /* @__PURE__ */ jsx(InputCurrency, { ...childProps, "aria-required": formUtils.isRequiredField("balanceSheetTotal"), "aria-invalid": !valid?.balanceSheetTotal, locale: i18next.language, currency: data?.currency ?? defaultCurrency, amount: data?.balanceSheetTotal ? Number(data?.balanceSheetTotal) : void 0, onAmountChanged: handleFieldChange("balanceSheetTotal") }) }), /* @__PURE__ */ jsx(Field, { name: "financialReportingDate", label: businessFinancingT(($) => $["statementReportingDate"]), helper: businessFinancingT(($) => $["useTheMoreRecentOfTheReportingDates"]), errorMessage: formUtils.getErrorMessage("financialReportingDate", errors, fieldValidationErrors), isValid: valid?.financialReportingDate, children: (childProps) => /* @__PURE__ */ jsx(InputDate, { ...childProps, name: "financialReportingDate", value: data?.financialReportingDate, onInput: handleFieldChange("financialReportingDate", "input"), onBlur: handleFieldChange("financialReportingDate", "blur"), "aria-required": true, "aria-invalid": !valid?.financialReportingDate, max: TODAY_DATE$1 }) }), /* @__PURE__ */ jsx(Field, { name: "annualTurnover", label: businessFinancingT(($) => $["annualTurnover"]), helper: businessFinancingT(($) => $["theAnnualSalesRevenue"]), errorMessage: formUtils.getErrorMessage("annualTurnover", errors, fieldValidationErrors), isValid: valid?.annualTurnover, children: (childProps) => /* @__PURE__ */ jsx(InputCurrency, { ...childProps, name: "annualTurnover", "aria-required": formUtils.isRequiredField("annualTurnover"), "aria-invalid": !valid?.annualTurnover, locale: i18next.language, currency: data?.currency ?? defaultCurrency, amount: data?.annualTurnover ? Number(data?.annualTurnover) : void 0, onAmountChanged: handleFieldChange("annualTurnover") }) }) ] }) ] }); } //#endregion //#region src/components/EFP/tasks/BusinessFinancingDropin/BusinessFinancingLegalInformation.tsx var TODAY_DATE = (/* @__PURE__ */ new Date()).toISOString().split("T")[0]; var legalInformationFields = ["legalInformationInsolvency", "legalProceedingsDate"]; function BusinessFinancingLegalInformation(props) { const { data, valid, errors, fieldValidationErrors, handleFieldChange, sectionHeading } = props; const { t: businessFinancingT } = useTranslation("businessFinancing"); const { t: commonT } = useTranslation("common"); const formUtils = createFormUtils(props, commonT); if (!handleFieldChange) return; const legalInformationInsolvencyItems = [ { id: "noLegalActionsTaken", name: commonT(($) => $["no"]) }, { id: "underJudicialAdministration", name: businessFinancingT(($) => $["yesTheCompanyIsUnderJudicialAdministration"]) }, { id: "bankruptcyInsolvency", name: businessFinancingT(($) => $["yesTheCompanyIsFilingForBankruptcy"]) }, { id: "otherLegalMeasures", name: businessFinancingT(($) => $["yesTheCompanyIsFacingOtherLegalMeasures"]) }, { id: "iDontKnow", name: commonT(($) => $["iDontKnow"]) } ]; const showLegalProceedingsDateField = data?.legalInformationInsolvency && !["noLegalActionsTaken", "iDontKnow"].includes(data?.legalInformationInsolvency); return /* @__PURE__ */ jsxs(Fragment, { children: [ /* @__PURE__ */ jsx(Typography, { el: "h3", variant: "title", className: BusinessFinancing_module_default.businessFinancingTitle, children: sectionHeading ? businessFinancingT(($) => $[sectionHeading]) : businessFinancingT(($) => $["legalInformation"]) }), /* @__PURE__ */ jsx(Field, { name: "legalInformationInsolvency", label: businessFinancingT(($) => $["legalInformationInsolvency"]), errorMessage: formUtils.getErrorMessage("legalInformationInsolvency", errors, fieldValidationErrors), isValid: valid?.legalInformationInsolvency, children: (childProps) => /* @__PURE__ */ jsx(Select, { ...childProps, onChange: handleFieldChange("legalInformationInsolvency", "blur"), name: "legalInformationInsolvency", placeholder: commonT(($) => $["selectOne"]), selected: data?.legalInformationInsolvency, items: legalInformationInsolvencyItems, "aria-required": true, "aria-invalid": !valid?.legalInformationInsolvency }) }), showLegalProceedingsDateField && /* @__PURE__ */ jsx(Field, { name: "legalProceedingsDate", label: businessFinancingT(($) => $["legalProceedingsDate"]), errorMessage: formUtils.getErrorMessage("legalProceedingsDate", errors, fieldValidationErrors), isValid: valid?.legalProceedingsDate, children: (childProps) => /* @__PURE__ */ jsx(InputDate, { ...childProps, name: "legalProceedingsDate", value: data.legalProceedingsDate, onInput: handleFieldChange("legalProceedingsDate", "input"), onBlur: handleFieldChange("legalProceedingsDate", "blur"), "aria-required": true, "aria-invalid": !valid?.legalProceedingsDate, max: TODAY_DATE }) }) ] }); } //#endregion //#region src/components/EFP/tasks/BusinessFinancingDropin/BusinessFinancingOwnershipStructure.tsx var ownershipStructureFields = ["isCompanyOwnedByAnotherCompany", "isParentOwnedByAnotherCompany"]; function BusinessFinancingOwnershipStructure(props) { const { data, valid, errors = {}, legalEntity, fieldValidationErrors, handleFieldChange } = props; const { t: businessFinancingT } = useTranslation("businessFinancing"); const { t: commonT } = useTranslation("common"); const formUtils = createFormUtils(props, commonT); if (!handleFieldChange) return; return /* @__PURE__ */ jsxs(Fragment, { children: [ /* @__PURE__ */ jsx(Typography, { el: "h3", variant: "title", className: BusinessFinancing_module_default.businessFinancingTitle, children: businessFinancingT(($) => $["ownershipStructure"]) }), /* @__PURE__ */ jsx(Field, { el: "fieldset", name: "isCompanyOwnedByAnotherCompany", label: businessFinancingT(($) => $["isCompanyOwnedByAnotherCompany"], { company: legalEntity?.organization ? legalEntity.organization.legalName : "" }), errorMessage: formUtils.getErrorMessage("isCompanyOwnedByAnotherCompany", errors, fieldValidationErrors), helper: /* @__PURE__ */ jsx(Typography, { el: "div", variant: "body", color: "secondary", className: BusinessFinancing_module_default.businessFinancingBody, children: businessFinancingT(($) => $["thisMeansYouHaveAParentCompany"]) }), children: (childProps) => /* @__PURE__ */ jsx(RadioGroup, { ...childProps, name: "isCompanyOwnedByAnotherCompany", items: businessFinancingRadioItems, value: data?.isCompanyOwnedByAnotherCompany, className: BusinessFinancing_module_default.businessFinancingLeiRadio, disabled: false, onChange: handleFieldChange("isCompanyOwnedByAnotherCompany"), "aria-required": true, "aria-invalid": !valid?.isCompanyOwnedByAnotherCompany }) }), data?.isCompanyOwnedByAnotherCompany === "Yes" && /* @__PURE__ */ jsx(Field, { el: "fieldset", name: "isParentOwnedByAnotherCompany", label: businessFinancingT(($) => $["isParentOwnedByAnotherCompany"]), helper: /* @__PURE__ */ jsx(Typography, { el: "div", variant: "body", color: "secondary", className: BusinessFinancing_module_default.businessFinancingBody, children: businessFinancingT(($) => $["thisMeansYouHaveAnUltimateParentCompany"]) }), errorMessage: formUtils.getErrorMessage("isParentOwnedByAnotherCompany", errors, fieldValidationErrors), children: (childProps) => /* @__PURE__ */ jsx(RadioGroup, { ...childProps, name: "isParentOwnedByAnotherCompany", items: businessFinancingRadioItems, value: data.isParentOwnedByAnotherCompany, className: BusinessFinancing_module_default.businessFinancingLeiRadio, disabled: false, onChange: handleFieldChange("isParentOwnedByAnotherCompany"), "aria-required": true, "aria-invalid": !valid?.isParentOwnedByAnotherCompany }) }) ] }); } //#endregion //#region src/components/EFP/tasks/BusinessFinancingDropin/AdditionalFieldsForBusinessFinancingCompany.tsx function AdditionalFieldsForBusinessFinancingCompany(props) { const { t: businessFinancingT } = useTranslation("businessFinancing"); const { t: commonT } = useTranslation("common"); const { form: { handleChangeFor, data, setValid } } = useFormContext(); const { country, formVerificationErrors, legalEntity, fieldValidationErrors } = props; const formUtils = createFormUtils(props, commonT); const handleChange = (fieldName, mode) => handleChangeFor(fieldName, "company", mode); const ownershipStructureProps = getFieldProps(props, ownershipStructureFields); const businessInformationProps = getFieldProps(props, businessInformationFields); const financialInformationProps = getFieldProps(props, financialInformationFields); const legalInformationProps = getFieldProps(props, legalInformationFields); if ((currencyByCountry[country] ?? [])?.length === 1) setValid("currency", true, "company"); return /* @__PURE__ */ jsxs("form", { className: "adyen-kyc__high-exposure-company", children: [ /* @__PURE__ */ jsx(Header, { title: businessFinancingT(($) => $["additionalInformationForBusinessFinancing"]), description: businessFinancingT(($) => $["weNeedAFewMoreDetailsAboutYouAndYourBusiness"]), secondary: true }), /* @__PURE__ */ jsx(ErrorPanel, { verificationErrors: formVerificationErrors, validationErrors: fieldValidationErrors, formUtils, id: "ariaErrorField" }), /* @__PURE__ */ jsx(BusinessFinancingBusinessInformation, { ...businessInformationProps, handleFieldChange: handleChange, country, targetPage: BusinessFinancingPages.COMPANY_PAGE, sectionHeading: "businessInformation", data: formUtils.getFieldData(data?.company ?? {}, businessInformationFields) }), isEeaCountry(country) && /* @__PURE__ */ jsx(BusinessFinancingFinancialInformation, { ...financialInformationProps, handleFieldChange: handleChange, country, targetPage: BusinessFinancingPages.COMPANY_PAGE, data: formUtils.getFieldData(data?.company ?? {}, financialInformationFields) }), /* @__PURE__ */ jsx(BusinessFinancingLegalInformation, { ...legalInformationProps, country, handleFieldChange: handleChange, targetPage: BusinessFinancingPages.COMPANY_PAGE, sectionHeading: "legalInformation", data: formUtils.getFieldData(data?.company ?? {}, legalInformationFields) }), /* @__PURE__ */ jsx(BusinessFinancingOwnershipStructure, { ...ownershipStructureProps, legalEntity, handleFieldChange: handleChange, data: formUtils.getFieldData(data?.company ?? {}, ownershipStructureFields) }) ] }); } //#endregion //#region src/components/EFP/tasks/BusinessFinancingDropin/BusinessFinancingBasicCompanyInformation.tsx var basicInformationFields = ["legalName"]; function BusinessFinancingBasicCompanyInformation(props) { const { data, valid, errors, fieldValidationErrors, handleFieldChange, sectionHeading } = props; const { t: businessFinancingT } = useTranslation("businessFinancing"); const { t: commonT } = useTranslation("common"); const formUtils = createFormUtils(props, commonT); if (!handleFieldChange) return; return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Typography, { el: "h3", variant: "title", className: BusinessFinancing_module_default.businessFinancingTitle, children: sectionHeading ? businessFinancingT(($) => $[sectionHeading]) : businessFinancingT(($) => $["basicCompanyInformation"]) }), /* @__PURE__ */ jsx(Field, { name: "legalName", label: businessFinancingT(($) => $["legalName"]), errorMessage: formUtils.getErrorMessage("legalName", errors, fieldValidationErrors), isValid: valid?.legalName, helper: businessFinancingT(($) => $["legalNameIsUsedToIdentifyABusinessWithTheGovernment"]), helperPosition: "below", children: (childProps) => /* @__PURE__ */ jsx(InputText, { ...childProps, name: "legalName", value: data?.legalName, readonly: false, onInput: handleFieldChange("legalName", "input"), onBlur: handleFieldChange("legalName", "blur"), "aria-required": true, "aria-invalid": !valid?.legalName }) })] }); } //#endregion //#region src/components/EFP/tasks/BusinessFinancingDropin/BusinessFinancingRegisteredAddress.tsx var OPTIONAL_ADDRESS_FIELDS = ["otherAddressInformation"]; var registeredAddressFields = [ "isThisAddressTheMainHeadquarters", "registrationAddress", "sameAddressAsRootEntity" ]; function BusinessFinancingRegisteredAddress(props) { const { data, valid, errors, fieldValidationErrors, shouldValidate, defaultData, handleFieldChange, formId, legalEntity, sectionHeading } = props; const { t: businessFinancingT, i18n } = useTranslation("businessFinancing"); const { t: commonT } = useTranslation("common"); const formUtils = createForm