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,320 lines 109 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] = "fad392a1-4d3f-4a8e-8f48-f3e49966b2ab", e._sentryDebugIdIdentifier = "sentry-dbid-fad392a1-4d3f-4a8e-8f48-f3e49966b2ab"); } catch (e) {} import { a as Icon, c as __exportAll, i as Typography, n as addResourceBundles, o as createLogger, r as useTranslation } from "./translation-BYvhW5zA.js"; import { A as _rolldown_dynamic_import_helper_default, k as Header, x as Alert } from "./resolveEnvironment-DNmu53Rr.js"; import { n as IconButton, r as Loader, t as Button } from "./Button-i8I2dHP8.js"; import { n as httpGet, r as httpPost, s as useApiContext } from "./http-8qgzqVqk.js"; import { n as useLegalEntities, r as useLegalEntity, t as ROOT_LE } from "./useLegalEntity-CtlUQv_J.js"; import { t as LegalEntityTypes } from "./legal-entity-type-0MfCGzUf.js"; import { t as getLegalEntityCountry } from "./getLegalEntityCountry-BHh7Ux8v.js"; import { o as objectsDeepEqual } from "./AnalyticsContext-BFrJmsp0.js"; import { t as StackLayout } from "./StackLayout-IUdNMDgW.js"; import { n as TASK_STATUS_POLLING_INTERVAL_MS } from "./taskStatus-BtekPA8E.js"; import { C as EntityTypes } from "./processCapabilities-fPuXc9gL.js"; import { t as TaskTypes } from "./taskTypes-NawDTp5n.js"; import { t as useBusinessLines } from "./useBusinessLines-BFsRoAAj.js"; import { t as Card } from "./Card-BCGLpdw7.js"; import { i as useAnalyticsContext, t as Modal } from "./Modal-BLP2aF-u.js"; import { n as useToastContext, t as useInvalidateRootLegalEntity } from "./invalidateRootLegalEntity-DLpPeD5p.js"; import { n as useCapabilityProblems, t as getProblemsForEntity } from "./getProblemsForEntity-D6XC4DZ2.js"; import { t as Avatar } from "./Avatar-CdBNstmD.js"; import { n as translateTranslatable } from "./utils-C1buyvRw.js"; import { t as Confirm } from "./Confirm-CA-gL38n.js"; import { n as Image } from "./unincorporated-partnership-nnTW3FnG.js"; import { t as useCreateLegalEntity } from "./useCreateLegalEntity-CoBr-K0N.js"; import { t as useUpdateLegalEntity } from "./useUpdateLegalEntity-B0XYfxbB.js"; import { i as FormFlow, n as addValidityToForms, o as useFormComposer, r as getRequiredForms, s as FormContextProvider, t as useFormContext } from "./useFormContext-CYHfY4k5.js"; import { t as StructuredList } from "./StructuredList-CUyo9-3i.js"; import { t as ErrorPanel } from "./ErrorPanel-DGlzO81g.js"; import { t as createFormUtils } from "./formUtils-DVc3a6gf.js"; import { t as useMultiForm } from "./useMultiForm-ducdUyQ6.js"; import { t as useTaskLandedEvent } from "./useTaskLandedEvent-BXtOctC4.js"; import { a as createDocumentRequest, o as documentApiUtils } from "./validate-DkjeS-zE.js"; import { r as formatObject } from "./utils-DdHbAadK.js"; import { t as localizeDateString } from "./localizeDateString-Bmx3yBcR.js"; import { t as Field } from "./Field-DoXLi6EY.js"; import { t as TileGroup } from "./TileGroup-DitwS4Ud.js"; import { t as LandingLayout } from "./LandingLayout-CUAkXrpL.js"; import { t as Select } from "./Select-DUo2rOfa.js"; import { t as Checkbox } from "./Checkbox-D7BRIoQL.js"; import { t as TextArea } from "./TextArea-CT04Dg1N.js"; import { t as Dropzone } from "./Dropzone-BzDQ_VtL.js"; import { t as InputText } from "./InputText-B0N7am-q.js"; import { t as InputDate } from "./InputDate-CPkdZkHB.js"; import { n as CountryField } from "./CountryField-D-Q958WF.js"; import { t as RadioGroup } from "./RadioGroup-qV8mGGwm.js"; import { t as InputGroup } from "./InputGroup-B4U3QVEp.js"; import { t as isEmpty } from "./isEmpty-BVlBH98t.js"; import { t as Currencies } from "./currency-DQwXq9Mc.js"; import { n as validateDateNotInTheFuture } from "./validate-D1IeAEpj.js"; import { t as useTaskStatus } from "./useTaskStatus-wrAxqtIR.js"; import { t as formatAmountWithCurrency } from "./formatCurrency-Cq3WFpdZ.js"; import { lazy } from "preact/compat"; import { useCallback as useCallback$1, useEffect as useEffect$1, useMemo as useMemo$1, useState as useState$1 } from "preact/hooks"; import { Fragment as Fragment$1, jsx, jsxs } from "preact/jsx-runtime"; import { signal } from "@preact/signals"; import { useMutation, useQuery, useQueryClient } from "@tanstack/preact-query"; //#region src/api/businessLines/useUpdateSourceOfFunds.ts var updateSourceOfFunds = async (businessLineId, legalEntityId, baseUrl, data) => { return httpPost({ baseUrl, path: `legalEntities/${legalEntityId}/businessLines/${businessLineId}/sourceOfFunds` }, data); }; var useUpdateSourceOfFunds = (options) => { const { rootLegalEntityId, baseUrl } = useApiContext(); const invalidateRootLegalEntity = useInvalidateRootLegalEntity(); return useMutation({ mutationFn: ({ businessLineId, ...requestData }) => updateSourceOfFunds(businessLineId, rootLegalEntityId.value, baseUrl.value, requestData), onSuccess: async () => { await invalidateRootLegalEntity(); }, ...options }); }; var sourceOfFundsComponentsKeyMapping = { "sourceOfFundsType.type": "sourceOfFunds.type", "additionalData.description": "sourceOfFunds.description", "additionalData.amount": "sourceOfFunds.amount", "additionalData.dateOfFundsReceived": "sourceOfFunds.dateOfFundsReceived", "additionalData.purpose": "sourceOfFunds.purpose", "additionalData.relationship": "sourceOfFunds.relationship", "additionalData.originatorLegalEntityId": "sourceOfFunds.originatorLegalEntityId", "additionalData.financiers": "sourceOfFunds.financiers", "additionalData.cryptocurrencyExchange": "sourceOfFunds.cryptocurrencyExchange", "additionalData.dateOfSourceEvent": "sourceOfFunds.dateOfSourceEvent", "additionalData.website": "sourceOfFunds.website", "additionalData.legalName": "sourceOfFunds.legalName", "additionalData.firstName": "sourceOfFunds.firstName", "additionalData.lastName": "sourceOfFunds.lastName", "additionalData.country": "sourceOfFunds.country", "additionalData.originatorType": "sourceOfFunds.originatorType" }; //#endregion //#region src/components/EFP/mapping/mapSourceOfFundToSourceOfFundsSchema.ts var mapSourceOfFundToSourceOfFundsSchema = (businessLine) => formatObject(businessLine, sourceOfFundsComponentsKeyMapping); //#endregion //#region src/components/EFP/tasks/SourceOfFundsDropin/sofStore.ts var sofErrorMessage = signal(void 0); var setSofErrorMessage = (message) => { sofErrorMessage.value = message; }; var clearSofErrorMessage = () => { sofErrorMessage.value = void 0; }; //#endregion //#region src/api/datasets/useSourceOfFundsTypes.ts var getSourceOfFundsTypes = async (baseUrl) => { return httpGet({ baseUrl, path: `datasets/sourceOfFundsTypes` }); }; var useSourceOfFundsTypes = (options) => { const { baseUrl } = useApiContext(); return useQuery({ queryKey: ["sourceOfFundsTypes"], queryFn: () => getSourceOfFundsTypes(baseUrl.value), ...options }); }; var SourceOfFunds_module_default = { "source-of-funds": "_source-of-funds_1lnfv_1", sourceOfFunds: "_source-of-funds_1lnfv_1", "source-of-funds-awe": "_source-of-funds-awe_1lnfv_10", sourceOfFundsAwe: "_source-of-funds-awe_1lnfv_10", "source-of-funds-wrapper-loading": "_source-of-funds-wrapper-loading_1lnfv_17", sourceOfFundsWrapperLoading: "_source-of-funds-wrapper-loading_1lnfv_17", "source-of-funds-wrapper-heading": "_source-of-funds-wrapper-heading_1lnfv_24", sourceOfFundsWrapperHeading: "_source-of-funds-wrapper-heading_1lnfv_24", "source-of-funds-wrapper-description": "_source-of-funds-wrapper-description_1lnfv_29", sourceOfFundsWrapperDescription: "_source-of-funds-wrapper-description_1lnfv_29", "source-of-funds-same-as-checkbox": "_source-of-funds-same-as-checkbox_1lnfv_33", sourceOfFundsSameAsCheckbox: "_source-of-funds-same-as-checkbox_1lnfv_33", "source-of-funds-getting-started": "_source-of-funds-getting-started_1lnfv_37", sourceOfFundsGettingStarted: "_source-of-funds-getting-started_1lnfv_37", "source-of-funds-getting-started-awe": "_source-of-funds-getting-started-awe_1lnfv_42", sourceOfFundsGettingStartedAwe: "_source-of-funds-getting-started-awe_1lnfv_42", "source-of-funds-getting-started-heading": "_source-of-funds-getting-started-heading_1lnfv_48", sourceOfFundsGettingStartedHeading: "_source-of-funds-getting-started-heading_1lnfv_48", "source-of-funds-getting-started-body": "_source-of-funds-getting-started-body_1lnfv_52", sourceOfFundsGettingStartedBody: "_source-of-funds-getting-started-body_1lnfv_52", "source-of-funds-getting-started-error": "_source-of-funds-getting-started-error_1lnfv_56", sourceOfFundsGettingStartedError: "_source-of-funds-getting-started-error_1lnfv_56", "source-of-funds-getting-started-error-actions": "_source-of-funds-getting-started-error-actions_1lnfv_60", sourceOfFundsGettingStartedErrorActions: "_source-of-funds-getting-started-error-actions_1lnfv_60", "source-of-funds-getting-started-cards": "_source-of-funds-getting-started-cards_1lnfv_64", sourceOfFundsGettingStartedCards: "_source-of-funds-getting-started-cards_1lnfv_64", "source-of-funds-getting-started-cards-card": "_source-of-funds-getting-started-cards-card_1lnfv_70", sourceOfFundsGettingStartedCardsCard: "_source-of-funds-getting-started-cards-card_1lnfv_70", "source-of-funds-getting-started-cards-card-header": "_source-of-funds-getting-started-cards-card-header_1lnfv_76", sourceOfFundsGettingStartedCardsCardHeader: "_source-of-funds-getting-started-cards-card-header_1lnfv_76", "source-of-funds-getting-started-cards-card-body": "_source-of-funds-getting-started-cards-card-body_1lnfv_82", sourceOfFundsGettingStartedCardsCardBody: "_source-of-funds-getting-started-cards-card-body_1lnfv_82", "source-of-funds-getting-started-actions": "_source-of-funds-getting-started-actions_1lnfv_88", sourceOfFundsGettingStartedActions: "_source-of-funds-getting-started-actions_1lnfv_88", "source-of-funds-additional-data-form": "_source-of-funds-additional-data-form_1lnfv_96", sourceOfFundsAdditionalDataForm: "_source-of-funds-additional-data-form_1lnfv_96", "source-of-funds-third-party-funding-financier-group": "_source-of-funds-third-party-funding-financier-group_1lnfv_100", sourceOfFundsThirdPartyFundingFinancierGroup: "_source-of-funds-third-party-funding-financier-group_1lnfv_100", "source-of-funds-third-party-funding-name-avatar-group": "_source-of-funds-third-party-funding-name-avatar-group_1lnfv_117", sourceOfFundsThirdPartyFundingNameAvatarGroup: "_source-of-funds-third-party-funding-name-avatar-group_1lnfv_117", "source-of-funds-third-party-funding-name-address-group": "_source-of-funds-third-party-funding-name-address-group_1lnfv_123", sourceOfFundsThirdPartyFundingNameAddressGroup: "_source-of-funds-third-party-funding-name-address-group_1lnfv_123", "source-of-funds-sof-financier-form-error": "_source-of-funds-sof-financier-form-error_1lnfv_129", sourceOfFundsSofFinancierFormError: "_source-of-funds-sof-financier-form-error_1lnfv_129", "source-of-funds-sof-financier-form-name-group": "_source-of-funds-sof-financier-form-name-group_1lnfv_133", sourceOfFundsSofFinancierFormNameGroup: "_source-of-funds-sof-financier-form-name-group_1lnfv_133", "source-of-funds-financier-footer": "_source-of-funds-financier-footer_1lnfv_138", sourceOfFundsFinancierFooter: "_source-of-funds-financier-footer_1lnfv_138", "source-of-funds-grid-container": "_source-of-funds-grid-container_1lnfv_144", sourceOfFundsGridContainer: "_source-of-funds-grid-container_1lnfv_144", "source-of-funds-sub-heading": "_source-of-funds-sub-heading_1lnfv_150", sourceOfFundsSubHeading: "_source-of-funds-sub-heading_1lnfv_150", "source-of-funds-upload-modal-content-field": "_source-of-funds-upload-modal-content-field_1lnfv_154", sourceOfFundsUploadModalContentField: "_source-of-funds-upload-modal-content-field_1lnfv_154", "source-of-funds-upload-modal-content-field-radio-group": "_source-of-funds-upload-modal-content-field-radio-group_1lnfv_162", sourceOfFundsUploadModalContentFieldRadioGroup: "_source-of-funds-upload-modal-content-field-radio-group_1lnfv_162", "source-of-funds-upload-modal-content-requirements-container": "_source-of-funds-upload-modal-content-requirements-container_1lnfv_167", sourceOfFundsUploadModalContentRequirementsContainer: "_source-of-funds-upload-modal-content-requirements-container_1lnfv_167", "source-of-funds-upload-list-heading": "_source-of-funds-upload-list-heading_1lnfv_175", sourceOfFundsUploadListHeading: "_source-of-funds-upload-list-heading_1lnfv_175", "source-of-funds-modal": "_source-of-funds-modal_1lnfv_180", sourceOfFundsModal: "_source-of-funds-modal_1lnfv_180" }; //#endregion //#region src/components/EFP/tasks/SourceOfFundsDropin/types.ts var additionalDataSchemaKeys = [ "description", "dateOfFundsReceived", "purpose", "relationship", "originatorLegalEntityId", "amount", "financiers", "cryptocurrencyExchange", "dateOfSourceEvent", "website" ]; //#endregion //#region src/components/EFP/tasks/SourceOfFundsDropin/utils.tsx var allowedCurrencies = Object.entries(Currencies).map(([key]) => ({ name: key, id: key })); var TODAY_DATE = (/* @__PURE__ */ new Date()).toISOString().split("T")[0]; var getSchemaForOriginator = (baseSchema, originatorType) => { if (originatorType === "organization") return [...baseSchema, "legalName"]; if (originatorType === "individual") return [ ...baseSchema, "firstName", "lastName" ]; return baseSchema; }; var getAdditionalDataSchemaKeys = (sourceOfFundsType, originatorType) => { switch (sourceOfFundsType) { case "business": return ["amount", "description"]; case "donations": return getSchemaForOriginator([ "dateOfFundsReceived", "purpose", "relationship", "country", "originatorType" ], originatorType); case "inheritance": return getSchemaForOriginator([ "dateOfFundsReceived", "amount", "relationship", "country", "originatorType" ], originatorType); case "thirdPartyFunding": return ["financiers"]; case "cryptocurrencyIncome": return ["cryptocurrencyExchange"]; case "assetSale": return [ "dateOfSourceEvent", "description", "amount" ]; case "gamblingWinnings": return [ "dateOfSourceEvent", "website", "amount" ]; default: return []; } }; var getServiceTranslation = (t, service) => { switch (service) { case "banking": return t(($) => $["businessBankAccounts"]); case "issuing": return t(($) => $["paymentCards"]); case "paymentProcessing": return t(($) => $["acceptingPayments"]); default: return t(($) => $["supportingDocuments"]); } }; var getServiceTranslationSelectTitle = (t, service) => { switch (service) { case "banking": return t(($) => $["forYourBusinessBankAccounts"]); case "issuing": return t(($) => $["forYourPaymentCards"]); case "paymentProcessing": return t(($) => $["whenAcceptingPayments"]); default: return t(($) => $["supportingDocuments"]); } }; var getServiceTranslationKey = (service) => { switch (service) { case "banking": return "bankingService"; case "issuing": return "issuingService"; case "paymentProcessing": return "paymentService"; default: return "supportingDocuments"; } }; var getGettingStartedCardDetails = (sourceOfFundsType, t, data) => { const details = []; sourceOfFundsType?.forEach((type) => { switch (type) { case "amount": details.push({ term: t(($) => $["amount"]), details: data?.amount?.currency && data?.amount?.value ? formatAmountWithCurrency(data.amount.value, data.amount.currency) : "" }); break; case "description": details.push({ term: t(($) => $["description"]), details: data?.description || "" }); break; case "dateOfFundsReceived": details.push({ term: t(($) => $["date"]), details: localizeDateString(data?.dateOfFundsReceived || "", navigator.language) }); break; case "purpose": details.push({ term: t(($) => $["reason"]), details: data?.purpose || "" }); break; case "relationship": details.push({ term: t(($) => $["relationship"]), details: data?.relationship || "" }); break; case "originatorLegalEntityId": details.push({ term: t(($) => $["benefactorDetails"]), details: [data?.legalName ? `${data?.legalName}` : `${data?.firstName} ${data?.lastName}`, /* @__PURE__ */ jsx(Typography, { color: "secondary", children: data?.country || "" }, "location")] }); break; case "financiers": data?.financiers?.map((financier) => { return details.push({ term: t(($) => $["investor"]), details: [ `${financier?.firstName} ${financier?.lastName}`, /* @__PURE__ */ jsx(Typography, { color: "secondary", children: financier?.location || "" }, "location"), /* @__PURE__ */ jsx(Typography, { color: "secondary", children: financier?.amount?.currency && financier?.amount?.value ? formatAmountWithCurrency(financier.amount.value, financier.amount.currency) || "" : "" }, "value") ] }); }); break; case "cryptocurrencyExchange": details.push({ term: t(($) => $["cryptocurrencyExchange"]), details: data?.cryptocurrencyExchange || "" }); break; case "dateOfSourceEvent": details.push({ term: t(($) => $["dateOfSourceEvent"]), details: localizeDateString(data?.dateOfSourceEvent || "", navigator.language) }); break; case "website": details.push({ term: t(($) => $["website"]), details: data?.website || "" }); break; default: break; } }); return details; }; var sourceOfFundsForms = { sourceOfFundsType: { formId: "sourceOfFundsType", formName: "selectASourceOfFunding", fields: ["type"] }, additionalData: { formId: "additionalData", formName: "tellUsMoreAboutThisSource", fields: [...additionalDataSchemaKeys] } }; var getSourceOfFundsRequiredFields = (data) => { const sourceOfFundsType = data?.sourceOfFundsType?.type; const originatorType = data?.additionalData?.originatorType; return { sourceOfFundsType: ["type"], additionalData: getAdditionalDataSchemaKeys(sourceOfFundsType, originatorType) }; }; var typesRequiringAdditionalData = [ "business", "donations", "inheritance", "thirdPartyFunding", "cryptocurrencyIncome", "assetSale", "gamblingWinnings" ]; var getSourceOfFundsRequiredForms = (data) => { return Object.fromEntries(Object.entries(sourceOfFundsForms).filter(([form]) => { if (!data?.type || !typesRequiringAdditionalData.includes(data?.type)) return form !== sourceOfFundsForms.additionalData.formId; return form; })); }; var getInputErrors = ({ formErrors, data, key, value }) => { const isEmpty = value === "" || value === null || value === void 0; let errors = { ...formErrors }; if (isEmpty) errors = { ...formErrors, [key]: "fieldIsRequired" }; else errors = { ...formErrors, [key]: void 0 }; if (["amount", "currency"].includes(key)) { if (data?.amount?.value && data?.amount?.currency) errors = { ...formErrors, amount: void 0 }; if (!data?.amount?.currency) errors = { ...formErrors, amount: "currencyIsRequired" }; if (!data?.amount?.value) errors = { ...formErrors, amount: "amountIsRequired" }; else if (isNaN(data?.amount.value)) errors = { ...formErrors, amount: "pleaseEnterAValidAmount" }; } return errors; }; var getPageHeadings = (type) => { switch (type) { case "cryptocurrencyIncome": return { heading: "cryptocurrencyProceedDetails", description: "tellUsMoreAboutTheCryptocurrency" }; case "assetSale": return { heading: "propertySaleDetails", description: "tellUsMoreAboutTheProperty" }; case "gamblingWinnings": return { heading: "gamblingProceedDetails", description: "tellUsMoreAboutTheGamblingProceeds" }; case "business": return { heading: "businessEarningDetails", description: "tellUsMoreAboutThePreviousBusinessEarnings" }; case "thirdPartyFunding": return { heading: "thirdPartyInvestmentDetails", description: "tellUsMoreAboutTheInvestors" }; case "inheritance": return { heading: "inheritanceDetails", description: "tellUsMoreAboutTheInheritanceProceeds" }; case "donations": return { heading: "giftOrDonationDetails", description: "tellUsMoreAboutTheGiftOrDonationProceeds" }; default: return { heading: "tellUsMoreAboutThisSource" }; } }; var getDocumentRequirements = { loanAgreement: [ "yourBusinessName", "lendersNameAndAddress", "principalAmount", "loanDate", "purposeOfLoan" ], loanStatement: [ "yourBusinessName", "lendersNameAndAddress", "principalAmount", "loanDate", "purposeOfLoan" ], proofOfWalletOwnership: [ "yourBusinessName", "nameOfTheCryptocurrencyExchange", "nameOfTheCoins", "issueDateWithinTheLast12Months" ], transactionStatement: [ "showsYourBusinessName", "showsTheNameOfTheCryptocurrencyExchange", "showsTheNameOfTheCoins", "issueDateWithinTheLast12Months" ], taxFiling: [ "showsYourBusinessName", "showsTheNameOfTheCryptocurrencyExchange", "showsTheNameOfTheCoins", "issueDateWithinTheLast12Months" ], proofOfWinnings: [ "winningProceedAmount", "dateOfWinning", "nameOfCasinoLottery" ], winReport: [ "winningProceedAmount", "dateOfWinning", "nameOfCasinoLottery" ], winLossStatement: [ "winningProceedAmount", "dateOfWinning", "nameOfCasinoLottery" ], taxDeclaration: ["winningProceedAmount", "issuedWithinTheLast12Months"], annualStatements: [ "yourBusinessName", "proofOfAnnualTurnoverAmount", "issueDateWithinTheLast12Months" ], latestTaxFiling: [ "yourBusinessName", "proofOfAnnualTurnoverAmount", "issueDateWithinTheLast12Months" ], letterFromAccountant: [ "yourBusinessName", "proofOfAnnualTurnoverAmount", "signatureAndDateWithinTheLast12Months" ], recentInvoices: ["yourBusinessName", "invoicesFromThe3MostRecentMonths"], bankStatements: [ "yourBusinessName", "issueDate", "banksLogoAndName", "allStatementsFrom3MostRecentMonths" ], payslips: [ "employersName", "issueDate", "banksLogoAndName", "allPayslipsFrom3MostRecentMonths" ], contractSpecifyingDividends: [ "theBusinessName", "termLengthAndDividendYield", "namesOfInvolvedParties" ], latestTaxReturn: ["theBusinessName", "reportedDividendAmount"], investmentCertificate: ["theBusinessName", "termLengthAndDividendYield"], brokerStatements: [ "theBrokerageName", "dividendAmount", "issueDateWithinTheLast3Months", "namesOfInvolvedParties" ], investorContract: [ "yourBusinessName", "nameAddressSignatureOfAllInvestors", "investmentAmount", "fundDepositDate" ], investorMemo: [ "yourBusinessName", "nameAddressSignatureOfAllInvestors", "investmentAmount", "fundDepositDate" ], notarizedStatement: [ "yourBusinessName", "nameAddressSignatureOfAllInvestors", "investmentAmount", "fundDepositDate" ], partnershipAgreement: [ "yourBusinessName", "nameAddressSignatureOfAllInvestors", "investmentAmount", "fundDepositDate" ], proofOfOwnership: [ "descriptionOfProperty", "netProceedAmount", "fundDepositDate", "propertyAddress" ], letterFromAttorney: [ "descriptionOfProperty", "netProceedAmount", "fundDepositDate", "propertyAddress" ], saleContract: [ "descriptionOfProperty", "netProceedAmount", "fundDepositDate", "propertyAddress" ], taxDeclarationProperty: [ "descriptionOfProperty", "netProceedAmount", "fundDepositDate", "propertyAddress" ], titleDeed: [ "descriptionOfProperty", "netProceedAmount", "fundDepositDate", "propertyAddress" ], rentalAgreementOrLease: [ "namesOfLandlordAndTenant", "propertyAddress", "rentAmount" ], proofOfOwnershipRent: ["yourName", "propertyAddress"], giftOrDonationAgreement: [ "donorsName", "fundTransferDate", "fundDepositAmount" ], royaltyAgreement: [ "descriptionOfIntellectualProperty", "royaltyAmount", "agreementPeriod" ], taxDocuments: ["royaltyAmount", "provideMostRecentYearAvailable"], certificateOfInheritance: [ "decedentsName", "inheritanceAmount", "fundDepositDate", "estateAttorneysName" ], grantOfProbate: [ "decedentsName", "inheritanceAmount", "fundDepositDate", "estateAttorneysName" ], letterFromAttorneyOrNotary: [ "decedentsName", "inheritanceAmount", "fundDepositDate", "estateAttorneysName" ], signedCopyOfTheWill: [ "decedentsName", "inheritanceAmount", "fundDepositDate", "estateAttorneysName" ], pensionSlip: [ "yourFullName", "previousEmployersName", "pensionPaymentAmount" ], letterFromPreviousEmployer: [ "yourFullName", "previousEmployersName", "pensionPaymentAmountOrTotalValue" ], pensionStatement: [ "yourFullName", "previousEmployersName", "pensionPaymentAmountOrTotalValue" ], courtOrder: [ "yourFullName", "totalSettlementAmount", "fundDepositDate" ], letterFromAttorneyInsurance: [ "yourFullName", "totalSettlementAmount", "fundDepositDate" ], letterFromInsurer: [ "yourFullName", "totalSettlementAmount", "fundDepositDate" ], confirmationOfGrantOrSubsidy: [ "benefactorsName", "subsidyOrGrantAmount", "timePeriodIfApplicable" ] }; var getDocumentLists = (sourceOfFundsType) => { switch (sourceOfFundsType) { case "loans": return ["loanAgreement", "loanStatement"]; case "gamblingWinnings": return [ "proofOfWinnings", "winReport", "winLossStatement", "taxDeclaration" ]; case "cryptocurrencyIncome": return [ "proofOfWalletOwnership", "transactionStatement", "taxFiling" ]; case "business": return [ "annualStatements", "latestTaxFiling", "letterFromAccountant", "recentInvoices" ]; case "employment": return ["bankStatements", "payslips"]; case "dividendIncome": return [ "contractSpecifyingDividends", "latestTaxReturn", "investmentCertificate", "brokerStatements" ]; case "thirdPartyFunding": return [ "investorContract", "investorMemo", "notarizedStatement", "partnershipAgreement" ]; case "assetSale": return [ "proofOfOwnership", "letterFromAttorney", "saleContract", "taxDeclarationProperty", "titleDeed" ]; case "rentalIncome": return ["rentalAgreementOrLease", "proofOfOwnership"]; case "donations": return ["giftOrDonationAgreement"]; case "royaltyIncome": return ["royaltyAgreement", "taxDocuments"]; case "inheritance": return [ "certificateOfInheritance", "grantOfProbate", "letterFromAttorneyOrNotary", "signedCopyOfTheWill" ]; case "pensionIncome": return [ "pensionSlip", "letterFromPreviousEmployer", "pensionStatement" ]; case "insuranceSettlement": return [ "courtOrder", "letterFromAttorneyInsurance", "letterFromInsurer" ]; case "financialAid": return ["confirmationOfGrantOrSubsidy"]; default: return []; } }; var parseSOFDocumentDescription = (t, documentDescription) => { if (!documentDescription || documentDescription.trim() === "" || !documentDescription.startsWith("$")) return; const [servicePart, typePart] = documentDescription.split("--"); const selectedService = servicePart.split(":")[1]; const documentType = typePart.split(":")[1]; const parsed = { selectedService: getServiceTranslation(t, selectedService || ""), documentType: t(($) => $[documentType]) }; return `${parsed.selectedService} (${parsed.documentType})`; }; var parseOriginatorDetails = (originatorDetails, businessLine) => { const copiedBusinessLine = { ...businessLine }; if (copiedBusinessLine.sourceOfFunds) { if (originatorDetails.organization) { copiedBusinessLine.sourceOfFunds.legalName = originatorDetails.organization.legalName; copiedBusinessLine.sourceOfFunds.country = originatorDetails.organization?.registeredAddress?.country; copiedBusinessLine.sourceOfFunds.originatorType = "organization"; } if (originatorDetails.individual) { copiedBusinessLine.sourceOfFunds.firstName = originatorDetails.individual.name?.firstName; copiedBusinessLine.sourceOfFunds.lastName = originatorDetails.individual.name?.lastName; copiedBusinessLine.sourceOfFunds.country = originatorDetails.individual.residentialAddress?.country; copiedBusinessLine.sourceOfFunds.originatorType = "individual"; } } return copiedBusinessLine; }; var getSourceOfFundsPayload = (sofType, additionalData) => { switch (sofType) { case "business": return { adyenProcessedFunds: false, type: "business", description: additionalData?.description, amount: { currency: additionalData?.amount?.currency ?? "USD", value: additionalData?.amount?.value ?? 0 } }; case "employment": return { adyenProcessedFunds: false, type: "employment" }; case "donations": return { adyenProcessedFunds: false, type: "donations", dateOfFundsReceived: additionalData?.dateOfFundsReceived, purpose: additionalData?.purpose, relationship: additionalData?.relationship, originatorLegalEntityId: additionalData?.originatorLegalEntityId }; case "inheritance": return { adyenProcessedFunds: false, type: "inheritance", dateOfFundsReceived: additionalData?.dateOfFundsReceived, amount: additionalData?.amount, relationship: additionalData?.relationship, originatorLegalEntityId: additionalData?.originatorLegalEntityId }; case "financialAid": return { adyenProcessedFunds: false, type: "financialAid" }; case "rentalIncome": return { adyenProcessedFunds: false, type: "rentalIncome" }; case "dividendIncome": return { adyenProcessedFunds: false, type: "dividendIncome" }; case "royaltyIncome": return { adyenProcessedFunds: false, type: "royaltyIncome" }; case "pensionIncome": return { adyenProcessedFunds: false, type: "pensionIncome" }; case "insuranceSettlement": return { adyenProcessedFunds: false, type: "insuranceSettlement" }; case "thirdPartyFunding": return { adyenProcessedFunds: false, type: "thirdPartyFunding", financiers: additionalData?.financiers }; case "cryptocurrencyIncome": return { adyenProcessedFunds: false, type: "cryptocurrencyIncome", cryptocurrencyExchange: additionalData?.cryptocurrencyExchange }; case "assetSale": return { adyenProcessedFunds: false, type: "assetSale", cryptocurrencyExchange: additionalData?.cryptocurrencyExchange, dateOfSourceEvent: additionalData?.dateOfSourceEvent, description: additionalData?.description, amount: additionalData?.amount }; case "loans": return { adyenProcessedFunds: false, type: "loans" }; case "gamblingWinnings": return { adyenProcessedFunds: false, type: "gamblingWinnings", dateOfSourceEvent: additionalData?.dateOfSourceEvent, website: additionalData?.website && !additionalData.website.startsWith("http://") && !additionalData.website.startsWith("https://") ? `https://${additionalData.website}` : additionalData?.website, amount: additionalData?.amount }; default: return { adyenProcessedFunds: true }; } }; var parseSofOriginatorPayload = (additionalData) => { let sofOriginator; if (additionalData?.originatorType === "individual") sofOriginator = { type: LegalEntityTypes.INDIVIDUAL, individual: { name: { firstName: additionalData?.firstName ?? "", lastName: additionalData?.lastName ?? "" }, residentialAddress: { country: additionalData?.country } } }; else sofOriginator = { type: LegalEntityTypes.ORGANIZATION, organization: { legalName: additionalData?.legalName ?? "", registeredAddress: { country: additionalData?.country } } }; return sofOriginator; }; var formatDateForInput = (isoDateString) => { if (!isoDateString) return ""; try { const datePart = isoDateString.split("T")[0]; if (/^\d{4}-\d{2}-\d{2}$/.test(datePart)) return datePart; return ""; } catch { return ""; } }; var getSofCardDetails = (t, sourceOfFunds) => { if (!sourceOfFunds) return ""; if (sourceOfFunds?.adyenProcessedFunds) return t(($) => $["transactionsOnThisPlatform"]); if (sourceOfFunds?.type) return sourceOfFunds?.type ? t(($) => $[sofCategoryItemMapper[sourceOfFunds.type]]) : ""; return ""; }; var ALLOWED_SOF_SERVICES = ["issuing", "banking"]; /** * Returns business lines that require SoF (based on ALLOWED_SOF_SERVICES) */ var getApplicableBusinessLines = (businessLines) => { return businessLines.filter((bl) => ALLOWED_SOF_SERVICES.includes(bl.service)); }; /** * Deep comparison of SoF data. * Returns true if all business-relevant fields are identical. */ var areSourceOfFundsEqual = (sof1, sof2) => { const type1 = sof1.sourceOfFundsType?.type; if (type1 !== sof2.sourceOfFundsType?.type) return false; if (type1 === "donations" || type1 === "inheritance") { const ad1 = sof1.additionalData || {}; const ad2 = sof2.additionalData || {}; if (ad1.originatorType !== ad2.originatorType) return false; if (ad1.originatorType === "individual") return ad1.firstName === ad2.firstName && ad1.lastName === ad2.lastName && ad1.country === ad2.country && ad1.relationship === ad2.relationship && ad1.purpose === ad2.purpose && ad1.dateOfFundsReceived === ad2.dateOfFundsReceived; else if (ad1.originatorType === "organization") return ad1.legalName === ad2.legalName && ad1.country === ad2.country && ad1.relationship === ad2.relationship && ad1.purpose === ad2.purpose && ad1.dateOfFundsReceived === ad2.dateOfFundsReceived; return false; } const ad1 = sof1.additionalData || {}; const ad2 = sof2.additionalData || {}; const keys1 = Object.keys(ad1); const keys2 = Object.keys(ad2); if (keys1.length !== keys2.length) return false; return keys1.every((key) => { const val1 = ad1[key]; const val2 = ad2[key]; return JSON.stringify(val1) === JSON.stringify(val2); }); }; var SOF_INVALID_INPUT_ERROR_CODES = ["1_93", "1_94"]; var getRelevantErrors = (problems, targetCodes) => { if (!problems) return false; return problems.flatMap((problem) => (problem.verificationErrors || []).filter((error) => targetCodes.includes(error.code) || (error.subErrors || []).some((sub) => targetCodes.includes(sub.code)))); }; var getUniqueRemediationActions = (error) => { return [...error.remediatingActions || [], ...error.subErrors?.flatMap((sub) => sub.remediatingActions || []) || []].filter((action, i, arr) => arr.findIndex((a) => a.code === action.code) === i); }; var sofCategoryItemMapper = { business: "otherBusinessEarnings", employment: "employmentWages", cryptocurrencyIncome: "cryptocurrency", dividendIncome: "dividends", loans: "loans", financialAid: "financialAid", thirdPartyFunding: "thirdPartyFunding", rentalIncome: "rentalIncome", royaltyIncome: "royaltyIncome", gamblingWinnings: "gambling", inheritance: "inheritance", pensionIncome: "pensionIncome", insuranceSettlement: "insuranceSettlement", assetSale: "propertySale", donations: "giftOrDonation" }; /** * Prepares additional data for originator creation/update. * When useSameAs is true, appends the originatorLegalEntityId from the source * so that createOrUpdateOriginator can update the existing LE instead of creating a new one. */ var getAdditionalDataForOriginator = (additionalData, sourceAdditionalData, useSameAs) => { if (useSameAs) return { ...additionalData, originatorLegalEntityId: sourceAdditionalData?.originatorLegalEntityId }; return additionalData; }; //#endregion //#region src/components/EFP/tasks/SourceOfFundsDropin/SOFAdditionalData/AdditionalDataForAssetSale.tsx function AdditionalDataForAssetSale(props) { const [isFocused, setIsFocused] = useState$1(false); const { formUtils, data, errors, valid, fieldProblems, handleChangeFor, handleAmountChange } = props; const { t: commonT } = useTranslation("common"); const handleOnAmountBlur = () => { setIsFocused(false); handleAmountChange("amount"); }; return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("div", { className: SourceOfFunds_module_default.sourceOfFundsGridContainer, children: [/* @__PURE__ */ jsx(Field, { el: "fieldset", name: "amount", label: formUtils.getLabel("amount", "saleAmount"), errorMessage: formUtils.getErrorMessage("amount", errors, fieldProblems), children: (childProps) => /* @__PURE__ */ jsxs(InputGroup, { ...childProps, id: "currencyGroup", isFocused, isInvalid: Boolean(!valid.amount && errors.amount), children: [/* @__PURE__ */ jsx(Select, { name: "currency", "aria-label": commonT(($) => $["currency"]), isMulti: false, items: allowedCurrencies, selected: data.amount?.currency, placeholder: commonT(($) => $["select"]), onChange: handleAmountChange("currency"), minimal: true }), /* @__PURE__ */ jsx(InputText, { ...childProps, name: "amount", value: data.amount?.value, readonly: formUtils.isReadOnly("amount"), onInput: handleAmountChange("amount"), onBlur: handleOnAmountBlur, "aria-required": true, "aria-invalid": !valid.amount, isValid: valid.amount, onFocusHandler: () => setIsFocused(true) })] }) }), /* @__PURE__ */ jsx(Field, { name: "dateOfSourceEvent", label: formUtils.getLabel("dateOfSourceEvent", "dateOfSale"), errorMessage: formUtils.getErrorMessage("dateOfSourceEvent", errors, fieldProblems), isValid: valid.dateOfSourceEvent, children: (childProps) => /* @__PURE__ */ jsx(InputDate, { ...childProps, name: "dateOfSourceEvent", value: formatDateForInput(data.dateOfSourceEvent), onInput: handleChangeFor("dateOfSourceEvent", "input"), onBlur: handleChangeFor("dateOfSourceEvent", "blur"), "aria-required": true, "aria-invalid": !valid.dateOfSourceEvent, max: TODAY_DATE }) })] }), /* @__PURE__ */ jsx(Field, { name: "description", label: formUtils.getLabel("description", "propertyDescription"), errorMessage: formUtils.getErrorMessage("description", errors, fieldProblems), isValid: valid.description, children: (childProps) => /* @__PURE__ */ jsx(TextArea, { ...childProps, name: "description", value: data.description, maxLength: 200, onInput: handleChangeFor("description"), onBlur: handleChangeFor("description"), "aria-invalid": !valid.description }) })] }); } //#endregion //#region src/components/EFP/tasks/SourceOfFundsDropin/SOFAdditionalData/AdditionalDataForBusiness.tsx function AdditionalDataForBusiness(props) { const [isFocused, setIsFocused] = useState$1(false); const { formUtils, data, errors, valid, fieldProblems, handleChangeFor, handleAmountChange } = props; const { t: commonT } = useTranslation("common"); const handleOnAmountBlur = () => { setIsFocused(false); handleAmountChange("amount"); }; return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Field, { el: "fieldset", name: "amount", label: formUtils.getLabel("amount", "annualTurnover"), errorMessage: formUtils.getErrorMessage("amount", errors, fieldProblems), helper: commonT(($) => $["useFiguresFromTheMostRecentYearAvailable"]), helperPosition: "below", children: (childProps) => /* @__PURE__ */ jsxs(InputGroup, { ...childProps, id: "currencyGroup", isFocused, isInvalid: Boolean(!valid.amount && errors.amount), children: [/* @__PURE__ */ jsx(Select, { name: "currency", "aria-label": commonT(($) => $["currency"]), isMulti: false, items: allowedCurrencies, selected: data.amount?.currency, placeholder: commonT(($) => $["select"]), onChange: handleAmountChange("currency"), minimal: true }), /* @__PURE__ */ jsx(InputText, { ...childProps, name: "amount", value: data.amount?.value, readonly: formUtils.isReadOnly("amount"), onInput: handleAmountChange("amount"), onBlur: handleOnAmountBlur, "aria-required": true, "aria-invalid": !valid.amount, isValid: valid.amount, onFocusHandler: () => setIsFocused(true) })] }) }), /* @__PURE__ */ jsx(Field, { name: "description", label: formUtils.getLabel("description", "businessDescription"), errorMessage: formUtils.getErrorMessage("description", errors, fieldProblems), isValid: valid.description, children: (childProps) => /* @__PURE__ */ jsx(TextArea, { ...childProps, name: "description", value: data.description, maxLength: 200, onInput: handleChangeFor("description"), onBlur: handleChangeFor("description"), "aria-invalid": !valid.description }) })] }); } //#endregion //#region src/components/EFP/tasks/SourceOfFundsDropin/SOFAdditionalData/AdditionalDataForCryptocurrency.tsx function AdditionalDataForCryptocurrency(props) { const { t: sofT } = useTranslation("sof"); const { formUtils, data, errors, valid, fieldProblems, handleChangeFor } = props; return /* @__PURE__ */ jsx(Field, { name: "cryptocurrencyExchange", label: formUtils.getLabel("cryptocurrencyExchange", "cryptocurrencyExchange"), errorMessage: formUtils.getErrorMessage("cryptocurrencyExchange", errors, fieldProblems), isValid: valid.cryptocurrencyExchange, helper: sofT(($) => $["nameOfTheExchangeWhereTheCryptocurrencyWasHeldPriorToSale"]), helperPosition: "below", children: (childProps) => /* @__PURE__ */ jsx(InputText, { ...childProps, name: "cryptocurrencyExchange", value: data.cryptocurrencyExchange, readonly: formUtils.isReadOnly("cryptocurrencyExchange"), onInput: handleChangeFor("cryptocurrencyExchange", "input"), onBlur: handleChangeFor("cryptocurrencyExchange", "blur"), "aria-required": true, "aria-invalid": !valid.cryptocurrencyExchange, isValid: valid.cryptocurrencyExchange }) }); } //#endregion //#region src/components/EFP/tasks/SourceOfFundsDropin/SOFAdditionalData/AdditionalDataOriginatorLegalEntity.tsx var radioItems = [{ id: "individual", name: "individual" }, { id: "organization", name: "organization" }]; function AdditionalDataOriginatorLegalEntity(props) { const { t: sofT } = useTranslation("sof"); const { formUtils, data, errors, valid, fieldProblems, handleChangeFor, sourceOfFundsType } = props; const isDonations = sourceOfFundsType === "donations"; const countryTranslationKey = isDonations && data?.originatorType === "individual" ? "donorsCountryOfResidence" : data?.originatorType === "organization" ? "organizationsCountryOfOperation" : "decedentsCountryOfDeath"; return /* @__PURE__ */ jsxs(Fragment$1, { children: [ /* @__PURE__ */ jsx(Field, { el: "fieldset", name: "originatorType", className: SourceOfFunds_module_default.sourceOfFundsUploadModalContentField, label: sofT(($) => $[isDonations ? "whereDidThisGiftOrDonationComeFrom" : "whereDidThisInheritanceComeFrom"]), errorMessage: formUtils.getErrorMessage("originatorType", errors, fieldProblems), isValid: valid.originatorType, children: (childProps) => /* @__PURE__ */ jsx(RadioGroup, { ...childProps, name: "originatorType", className: SourceOfFunds_module_default.sourceOfFundsUploadModalContentFieldRadioGroup, items: radioItems, value: data.originatorType, disabled: false, onChange: handleChangeFor("originatorType", "input"), "aria-required": true }) }), data?.originatorType === "organization" && /* @__PURE__ */ jsx(Field, { name: "legalName", label: formUtils.getLabel("legalName", "organizationsLegalName"), errorMessage: formUtils.getErrorMessage("legalName", errors, fieldProblems), isValid: valid.legalName, children: (childProps) => /* @__PURE__ */ jsx(InputText, { ...childProps, name: "legalName", value: data.legalName, readonly: formUtils.isReadOnly("legalName"), onInput: handleChangeFor("legalName", "input"), onBlur: handleChangeFor("legalName", "blur"), "aria-required": true, "aria-invalid": !valid.legalName, isValid: valid.legalName }) }), data?.originatorType === "individual" && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Field, { name: "firstName", label: formUtils.getLabel("firstName", isDonations ? "donorsLegalFirstName" : "decedentsLegalFirstName"), errorMessage: formUtils.getErrorMessage("firstName", errors, fieldProblems), isValid: valid.firstName, children: (childProps) => /* @__PURE__ */ jsx(InputText, { ...childProps, name: "firstName", value: data.firstName, readonly: formUtils.isReadOnly("firstName"), onInput: handleChangeFor("firstName", "input"), onBlur: handleChangeFor("firstName", "blur"), "aria-required": true, "aria-invalid": !valid.firstName, isValid: valid.firstName }) }), /* @__PURE__ */ jsx(Field, { name: "lastName", label: formUtils.getLabel("lastName", isDonations ? "donorsLegalLastName" : "decedentsLegalLastName"), errorMessage: formUtils.getErrorMessage("lastName", errors, fieldProblems), isValid: valid.lastName, children: (childProps) => /* @__PURE__ */ jsx(InputText, { ...childProps, name: "lastName", value: data.lastName, readonly: formUtils.isReadOnly("lastName"), onInput: handleChangeFor("lastName", "input"), onBlur: handleChangeFor("lastName", "blur"), "aria-required": true, "aria-invalid": !valid.lastName, isValid: valid.lastName }) })] }), data?.originatorType && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Field, { name: "relationship", label: formUtils.getLabel("relationship", isDonations && data?.originatorType === "individual" ? "yourRelationshipToDonor" : data?.originatorType === "organization" ? "yourRelationshipToOrganization" : "yourRelationshipToDecedent"), errorMessage: formUtils.getErrorMessage("relationship", errors, fieldProblems), isValid: valid.relationship, children: (childProps) => /* @__PURE__ */ jsx(InputText, { ...childProps, name: "relationship", value: data.relationship, readonly: formUtils.isReadOnly("relationship"), onInput: handleChangeFor("relationship", "input"), onBlur: handleChangeFor("relationship", "blur"), "aria-required": true, "aria-invalid": !valid.relationship, isValid: valid.relationship }) }), /* @__PURE__ */ jsx(CountryField, { data: { country: data.country }, valid: { country: valid.country }, errors: { country: formUtils.getErrorMessage("country", errors, fieldProblems) }, labels: { country: sofT(($) => $[countryTranslationKey]) }, readonly: formUtils.isReadOnly("country"), handleChangeFor })] }) ] }); } //#endregion //#region src/components/EFP/tasks/SourceOfFundsDropin/SOFAdditionalData/AdditionalDataForDonation.tsx function AdditionalDataForDonation(props) { const { formUtils, data, errors, valid, fieldProblems, handleChangeFor } = props; return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(AdditionalDataOriginatorLegalEntity, { formUtils, handleChangeFor, data, errors, valid, fieldProblems, sourceOfFundsType: "donations" }), /* @__PURE__ */ jsxs("div", { className: SourceOfFunds_module_default.sourceOfFundsGridContainer, children: [/* @__PURE__ */ jsx(Field, { name: "purpose", label: formUtils.getLabel("purpose", "reason"), errorMessage: formUtils.getErrorMessage("purpose", errors, fieldProblems), isValid: valid.purpose, children: (childProps) => /* @__PURE__ */ jsx(InputText, { ...childProps, name: "purpose", value: data.purpose, readonly: formUtils.isReadOnly("purpose"), onInput: handleChangeFor("purpose", "input"), onBlur: handleChangeFor("purpose", "blur"), "aria-required": true, "aria-invalid": !valid.purpose, isValid: valid.purpose }) }), /* @__PURE__ */ jsx(Field, { name: "dateOfFundsReceived", label: formUtils.getLabel("dateOfFundsReceived", "date"), errorMessage: formUtils.getErrorMessage("dateOfFundsReceived", errors, fieldProblems), isValid: valid.dateOfFundsReceived, children: (childProps) => /* @__PURE__ */ jsx(InputDate, { ...childProps, name: "dateOfFundsReceived", value: formatDateForInput(data.dateOfFundsReceived), onInput: handleChangeFor("dateOfFundsReceived", "input"), onBlur: handleChangeFor("dateOfFundsReceived", "blur"), "aria-required": true, "aria-invalid": !valid.dateOfFundsReceived, max: TODAY_DATE }) })] })] }); } //#endregion //#region src/components/EFP/tasks/SourceOfFundsDropin/SOFAdditionalData/AdditionalDataForGambling.tsx function AdditionalDataForGambling(props) { const { t: commonT } = useTranslation("common"); const [focusedInput, setFocusedInput] = useState$1(); const { formUtils, data, errors, valid, fieldProblems, handleChangeFor, handleAmountChange } = props; const handleOnAmountBlur = () => { setFocusedInput(void 0); handleAmountChange("amount"); }; return /* @__PURE__ */ jsxs(Fragment$1, { children: [ /* @__PURE__ */ jsx(Field, { el: "fieldset", name: "amount", label: formUtils.getLabel("amount", "totalAmountWon"), errorMessage: formUtils.getErrorMessage("amount", errors, fieldProblems), children: (childProps) => /* @__PURE__ */ jsxs(InputGroup, { ...childProps, id: "currencyGroup", isFocused: focusedInput === "amount", isInvalid: Boolean(!valid.amount && errors.amount), children: [/* @__PURE__ */ jsx(Select, { name: "currency", "aria-label": commonT(($) => $["currency"]), isMulti: false, items: allowedCurrencies, selected: data.amount?.currency, placeholder: commonT(($) => $["select"]), onChange: handleAmountChange("currency"), minimal: true }), /* @__PURE__ */ jsx(InputText, { ...childProps, name: "amount", value: data.amount?.value, readonly: formUtils.isReadOnly("amount"), onInput: handleAmountChange("amount"), onBlur: handleOnAmountBlur, "aria-required": true, "aria-invalid": !valid.amount, isValid: valid.amount, onFocusHandle