@swan-io/shared-business 5.2.0 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,29 +3,6 @@
3
3
  "addressFormPart.cityLabel": "Cidade",
4
4
  "addressFormPart.placeholder": "Comece a escrever...",
5
5
  "addressFormPart.postCodeLabel": "Código Postal",
6
- "beneficiaryForm.beneficiary.address": "Encontre o endereço do beneficiário",
7
- "beneficiaryForm.beneficiary.birthCity": "Cidade de nascimento",
8
- "beneficiaryForm.beneficiary.birthCityPlaceholder": "Pesquisar a cidade de nascimento do beneficiário",
9
- "beneficiaryForm.beneficiary.birthCountry": "País de nascimento",
10
- "beneficiaryForm.beneficiary.birthCountryPlaceholder": "Selecione o país de nascimento do beneficiário",
11
- "beneficiaryForm.beneficiary.birthDate": "Data de nascimento",
12
- "beneficiaryForm.beneficiary.birthPostalCode": "Código postal do local de nascimento",
13
- "beneficiaryForm.beneficiary.birthPostalCodePlaceholder": "Introduza o código postal de nascimento do beneficiário",
14
- "beneficiaryForm.beneficiary.country": "País",
15
- "beneficiaryForm.beneficiary.directOrIndirect": "Precisa de escolher pelo menos uma das opções",
16
- "beneficiaryForm.beneficiary.directly": "Diretamente",
17
- "beneficiaryForm.beneficiary.fillBirthCountry": "Necessita preencher primeiro o país de nascimento do beneficiário",
18
- "beneficiaryForm.beneficiary.firstName": "Nome próprio",
19
- "beneficiaryForm.beneficiary.firstNamePlaceholder": "Introduza o nome próprio do beneficiário",
20
- "beneficiaryForm.beneficiary.indirectly": "Indiretamente",
21
- "beneficiaryForm.beneficiary.lastName": "Apelido",
22
- "beneficiaryForm.beneficiary.lastNamePlaceholder": "Introduza o apelido do beneficiário",
23
- "beneficiaryForm.beneficiary.legalRepresentative": "Representante legal",
24
- "beneficiaryForm.beneficiary.other": "Outro",
25
- "beneficiaryForm.beneficiary.ownershipOfCapital": "Titularidade do capital",
26
- "beneficiaryForm.beneficiary.taxIdentificationNumber": "Número de Identificação Fiscal",
27
- "beneficiaryForm.beneficiary.totalCapitalPercentage": "Percentagem total do capital social detido",
28
- "beneficiaryForm.beneficiary.type": "Tipo de controlo exercido",
29
6
  "businessActivity.administrativeServices": "Serviços administrativos",
30
7
  "businessActivity.agriculture": "Agricultura",
31
8
  "businessActivity.arts": "Artes",
@@ -86,6 +63,15 @@
86
63
  "error.network.500": "Erro interno do servidor",
87
64
  "error.network.503": "Serviço indisponível",
88
65
  "error.requiredField": "Este campo é obrigatório",
66
+ "fileInput.browse": "navegar",
67
+ "fileInput.clickToModify": "Clique para modificar",
68
+ "fileInput.dropFile": "Arraste o seu ficheiro, ou {browse}",
69
+ "fileInput.noFile": "Nenhum ficheiro",
70
+ "fileInput.unknownFileName": "nome do ficheiro desconhecido",
71
+ "fileTile.status.Pending": "Verificação pendente",
72
+ "fileTile.status.Refused": "Recusado",
73
+ "fileTile.status.Validated": "Verificado",
74
+ "fileTile.uploading": "A carregar…",
89
75
  "monthlyPaymentVolume.between10000And50000": "Entre €10.000 e €50.000",
90
76
  "monthlyPaymentVolume.between50000And100000": "Entre €50.000 e €100.000",
91
77
  "monthlyPaymentVolume.lessThan10000": "Menos de €10.000",
@@ -270,10 +256,5 @@
270
256
  "supportingDocuments.purpose.UltimateBeneficialOwnerProofOfAddress.description": "",
271
257
  "supportingDocuments.purpose.UltimateBeneficialOwnerProofOfIdentity": "Prova de identidade do Beneficiário Efetivo",
272
258
  "supportingDocuments.purpose.UltimateBeneficialOwnerProofOfIdentity.description": "",
273
- "uploadArea.browse": "navegar",
274
- "uploadArea.dropFile": "Arraste o seu ficheiro, ou {browse}",
275
- "uploadArea.droppedFile": "Clique para modificar",
276
- "uploadArea.noValue": "Nenhum ficheiro",
277
- "uploadArea.unknownFileName": "nome do ficheiro desconhecido",
278
- "uploadArea.uploading": "Carregando…"
259
+ "taxIdentificationNumber.label": "Número de Identificação Fiscal"
279
260
  }
@@ -0,0 +1,19 @@
1
+ export type SwanFileStatusInfo = {
2
+ status: "Uploading";
3
+ progress: number;
4
+ } | {
5
+ status: "Uploaded";
6
+ } | {
7
+ status: "Pending";
8
+ } | {
9
+ status: "Validated";
10
+ } | {
11
+ status: "Refused";
12
+ reason: string;
13
+ };
14
+ export type SwanFile = {
15
+ id: string;
16
+ statusInfo: SwanFileStatusInfo;
17
+ name: string;
18
+ url?: string;
19
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -19,6 +19,6 @@ export declare const locale: Locale;
19
19
  export declare const t: (key: TranslationKey, params?: TranslationParams) => string;
20
20
  export declare const formatNestedMessage: (key: TranslationKey, params: Record<string, string | number | ReactElement<any, string | import("react").JSXElementConstructor<any>> | ((children: ReactNode) => ReactNode)>) => (string | ReactElement<any, string | import("react").JSXElementConstructor<any>>)[];
21
21
  export declare const rifmDateProps: RifmProps;
22
- export declare const isTranslationKey: (value: unknown) => value is "addressFormPart.addressLabel" | "addressFormPart.cityLabel" | "addressFormPart.placeholder" | "addressFormPart.postCodeLabel" | "beneficiaryForm.beneficiary.address" | "beneficiaryForm.beneficiary.birthCity" | "beneficiaryForm.beneficiary.birthCityPlaceholder" | "beneficiaryForm.beneficiary.birthCountry" | "beneficiaryForm.beneficiary.birthCountryPlaceholder" | "beneficiaryForm.beneficiary.birthDate" | "beneficiaryForm.beneficiary.birthPostalCode" | "beneficiaryForm.beneficiary.birthPostalCodePlaceholder" | "beneficiaryForm.beneficiary.country" | "beneficiaryForm.beneficiary.directOrIndirect" | "beneficiaryForm.beneficiary.directly" | "beneficiaryForm.beneficiary.fillBirthCountry" | "beneficiaryForm.beneficiary.firstName" | "beneficiaryForm.beneficiary.firstNamePlaceholder" | "beneficiaryForm.beneficiary.indirectly" | "beneficiaryForm.beneficiary.lastName" | "beneficiaryForm.beneficiary.lastNamePlaceholder" | "beneficiaryForm.beneficiary.legalRepresentative" | "beneficiaryForm.beneficiary.other" | "beneficiaryForm.beneficiary.ownershipOfCapital" | "beneficiaryForm.beneficiary.taxIdentificationNumber" | "beneficiaryForm.beneficiary.totalCapitalPercentage" | "beneficiaryForm.beneficiary.type" | "businessActivity.administrativeServices" | "businessActivity.agriculture" | "businessActivity.arts" | "businessActivity.businessAndRetail" | "businessActivity.construction" | "businessActivity.education" | "businessActivity.electricalDistributionAndWaterSupply" | "businessActivity.financialAndInsuranceOperations" | "businessActivity.health" | "businessActivity.housekeeping" | "businessActivity.informationAndCommunication" | "businessActivity.lodgingAndFoodServices" | "businessActivity.manufacturingAndMining" | "businessActivity.other" | "businessActivity.publicAdministration" | "businessActivity.realEstate" | "businessActivity.scientificActivities" | "businessActivity.transportation" | "common.cancel" | "common.close" | "common.form.help.nbCharacters" | "common.form.help.nbDigits" | "common.form.invalidTaxIdentificationNumber" | "common.form.taxIdentificationNumber.placeholder" | "common.form.taxIdentificationNumber.tooltip.deu" | "common.next" | "common.noResult" | "common.open" | "common.optional" | "common.previous" | "common.remove" | "common.showLess" | "common.showMore" | "common.skipToContent" | "datePicker.day.friday" | "datePicker.day.monday" | "datePicker.day.saturday" | "datePicker.day.sunday" | "datePicker.day.thursday" | "datePicker.day.tuesday" | "datePicker.day.wednesday" | "datePicker.month.april" | "datePicker.month.august" | "datePicker.month.december" | "datePicker.month.february" | "datePicker.month.january" | "datePicker.month.july" | "datePicker.month.june" | "datePicker.month.march" | "datePicker.month.may" | "datePicker.month.next" | "datePicker.month.november" | "datePicker.month.october" | "datePicker.month.previous" | "datePicker.month.september" | "error.generic" | "error.iban.invalid" | "error.network.500" | "error.network.503" | "error.requiredField" | "monthlyPaymentVolume.between10000And50000" | "monthlyPaymentVolume.between50000And100000" | "monthlyPaymentVolume.lessThan10000" | "monthlyPaymentVolume.moreThan100000" | "registrationPage.defaultNumberLabel" | "registrationPage.withOrganismLabel" | "registrationPage.withoutOrganismNameLabel" | "rejection.AccountHolderNotFoundRejection" | "rejection.AccountHolderTypeIndividualRejection" | "rejection.AccountMembershipCannotBeDisabledRejection" | "rejection.AccountMembershipCannotBeUpdatedRejection" | "rejection.AccountMembershipNotAllowedRejection" | "rejection.AccountMembershipNotFoundRejection" | "rejection.AccountMembershipNotReadyToBeBoundRejection" | "rejection.AccountNotEligibleRejection" | "rejection.AccountNotFoundRejection" | "rejection.AccountVerificationAlreadyRejectedRejection" | "rejection.AccountVerificationWrongStatusRejection" | "rejection.AddingCardsToDifferentAccountsRejection" | "rejection.AlreadyValidPhysicalCardRejection" | "rejection.ApplePayNotAllowedForProjectRejection" | "rejection.BadAccountStatusRejection" | "rejection.BadRequestRejection" | "rejection.CannotActivatePhysicalCardRejection" | "rejection.CapitalDepositDocumentCanNotBeUploaded" | "rejection.CardCanNotBeDigitalizedRejection" | "rejection.CardNotFoundRejection" | "rejection.CardProductDisabledRejection" | "rejection.CardProductNotApplicableToPhysicalCardsRejection" | "rejection.CardProductNotFoundRejection" | "rejection.CardProductSuspendedRejection" | "rejection.CardProductUsedRejection" | "rejection.CardWrongStatusRejection" | "rejection.ConsentNotFoundRejection" | "rejection.ConsentTypeNotSupportedByServerConsentRejection" | "rejection.ConsentsAlreadyLinkedToMultiConsentRejection" | "rejection.ConsentsNotAllInCreatedStatusRejection" | "rejection.ConsentsNotFoundRejection" | "rejection.DebtorAccountClosedRejection" | "rejection.DebtorAccountNotAllowedRejection" | "rejection.DigitalCardNotFoundRejection" | "rejection.EnabledCardDesignNotFoundRejection" | "rejection.ExternalAccountAlreadyExistsRejection" | "rejection.ExternalAccountBalanceAlreadyExistsRejection" | "rejection.ForbiddenRejection" | "rejection.FundingLimitExceededRejection" | "rejection.FundingLimitSettingsChangeRequestBadAmountRejection" | "rejection.FundingSourceNotFoundRejection" | "rejection.FundingSourceWrongStatusRejection" | "rejection.GlobalFundingLimitExceededRejection" | "rejection.GlobalInstantFundingLimitExceededRejection" | "rejection.IBANNotReachableRejection" | "rejection.IBANNotValidRejection" | "rejection.IbanValidationRejection" | "rejection.IdentityAlreadyBindToAccountMembershipRejection" | "rejection.InstantFundingLimitExceededRejection" | "rejection.InsufficientFundsRejection" | "rejection.InternalErrorRejection" | "rejection.InvalidArgumentRejection" | "rejection.InvalidPhoneNumberRejection" | "rejection.InvalidSirenNumberRejection" | "rejection.LegalRepresentativeAccountMembershipCannotBeDisabledRejection" | "rejection.LegalRepresentativeAccountMembershipCannotBeSuspendedRejection" | "rejection.MerchantProfileWrongStatusRejection" | "rejection.MissingMandatoryFieldRejection" | "rejection.NotFoundRejection" | "rejection.NotReachableConsentStatusRejection" | "rejection.NotSupportedCountryRejection" | "rejection.OnboardingNotCompletedRejection" | "rejection.PINNotReadyRejection" | "rejection.PaymentMandateMandateNotFoundRejection" | "rejection.PaymentMandateReferenceAlreadyUsedRejection" | "rejection.PaymentMethodNotCompatibleRejection" | "rejection.PermissionCannotBeGrantedRejection" | "rejection.PhysicalCardNotFoundRejection" | "rejection.PhysicalCardWrongStatusRejection" | "rejection.ProjectForbiddenRejection" | "rejection.ProjectFundingLimitExceededRejection" | "rejection.ProjectInstantFundingLimitExceededRejection" | "rejection.ProjectInvalidStatusRejection" | "rejection.ProjectNotFound" | "rejection.ProjectNotFoundRejection" | "rejection.ProjectSettingsForbiddenError" | "rejection.ProjectSettingsNotFound" | "rejection.ProjectSettingsStatusNotReachable" | "rejection.PublicOnboardingDisabledRejection" | "rejection.ReceivedDirectDebitMandateAlreadyExistRejection" | "rejection.ReceivedDirectDebitMandateCanceledRejection" | "rejection.ReceivedDirectDebitMandateNotB2bRejection" | "rejection.ReceivedDirectDebitMandateNotFoundRejection" | "rejection.RefundRejection" | "rejection.RestrictedToUserRejection" | "rejection.SchemeWrongRejection" | "rejection.ServerConsentCredentialsNotValidOrOutdatedRejection" | "rejection.ServerConsentNotAllowedForConsentOperationRejection" | "rejection.ServerConsentNotAllowedForProjectRejection" | "rejection.ServerConsentProjectCredentialMissingRejection" | "rejection.ServerConsentProjectCredentialNotFoundRejection" | "rejection.ServerConsentProjectSettingsNotFoundRejection" | "rejection.ServerConsentSignatureNotValidRejection" | "rejection.StandingOrderNotFoundRejection" | "rejection.SupportingDocumentCollectionNotFoundRejection" | "rejection.SupportingDocumentCollectionStatusDoesNotAllowDeletionRejection" | "rejection.SupportingDocumentCollectionStatusDoesNotAllowUpdateRejection" | "rejection.SupportingDocumentCollectionStatusNotAllowedRejection" | "rejection.SupportingDocumentNotFoundRejection" | "rejection.SupportingDocumentStatusDoesNotAllowDeletionRejection" | "rejection.SupportingDocumentStatusDoesNotAllowUpdateRejection" | "rejection.SupportingDocumentStatusNotAllowedRejection" | "rejection.SupportingDocumentUploadNotAllowedRejection" | "rejection.SuspendReceivedDirectDebitMandatedRejection" | "rejection.TooManyChildConsentsRejection" | "rejection.TooManyItemsRejection" | "rejection.TransactionNotFoundRejection" | "rejection.UpdateUserConsentSettingsTokenRejection" | "rejection.UserNotAllowedToDisableItsOwnAccountMembershipRejection" | "rejection.UserNotAllowedToManageAccountMembershipRejection" | "rejection.UserNotAllowedToSuspendItsOwnAccountMembershipRejection" | "rejection.UserNotCardHolderRejection" | "rejection.ValidationRejection" | "rejection.WrongValueProvidedRejection" | "rib.accountHolder" | "rib.accountNumber" | "rib.address" | "rib.agency" | "rib.bank" | "rib.bankDetails" | "rib.bic" | "rib.iban" | "rib.key" | "rib.nationalCode" | "rib.number" | "rib.partnership" | "supportingDocuments.documentTypes" | "supportingDocuments.errorUpload" | "supportingDocuments.noRequiredDocuments" | "supportingDocuments.downloadTemplate" | "supportingDocuments.powerOfAttorneyModal.title" | "supportingDocuments.powerOfAttorneyModal.description" | "supportingDocuments.help.whatIsThis" | "supportingDocuments.purpose.AdministratorDecisionOfAppointment" | "supportingDocuments.purpose.AdministratorDecisionOfAppointment.description" | "supportingDocuments.purpose.AssociationRegistration" | "supportingDocuments.purpose.AssociationRegistration.description" | "supportingDocuments.purpose.Banking" | "supportingDocuments.purpose.Banking.description" | "supportingDocuments.purpose.CompanyRegistration" | "supportingDocuments.purpose.CompanyRegistration.description" | "supportingDocuments.purpose.FinancialStatements" | "supportingDocuments.purpose.FinancialStatements.description" | "supportingDocuments.purpose.GeneralAssemblyMinutes" | "supportingDocuments.purpose.GeneralAssemblyMinutes.description" | "supportingDocuments.purpose.LegalRepresentativeProofOfIdentity" | "supportingDocuments.purpose.LegalRepresentativeProofOfIdentity.description" | "supportingDocuments.purpose.NIFAccreditationCard" | "supportingDocuments.purpose.NIFAccreditationCard.description" | "supportingDocuments.purpose.Other" | "supportingDocuments.purpose.Other.description" | "supportingDocuments.purpose.PowerOfAttorney" | "supportingDocuments.purpose.PowerOfAttorney.description" | "supportingDocuments.purpose.PresidentDecisionOfAppointment" | "supportingDocuments.purpose.PresidentDecisionOfAppointment.description" | "supportingDocuments.purpose.ProofOfCompanyAddress" | "supportingDocuments.purpose.ProofOfCompanyAddress.description" | "supportingDocuments.purpose.ProofOfCompanyIncome" | "supportingDocuments.purpose.ProofOfCompanyIncome.description" | "supportingDocuments.purpose.ProofOfIdentity" | "supportingDocuments.purpose.ProofOfIdentity.description" | "supportingDocuments.purpose.ProofOfIndividualAddress" | "supportingDocuments.purpose.ProofOfIndividualAddress.description" | "supportingDocuments.purpose.ProofOfIndividualIncome" | "supportingDocuments.purpose.ProofOfIndividualIncome.description" | "supportingDocuments.purpose.ProofOfOriginOfFunds" | "supportingDocuments.purpose.ProofOfOriginOfFunds.description" | "supportingDocuments.purpose.SignedStatus" | "supportingDocuments.purpose.SignedStatus.description" | "supportingDocuments.purpose.SwornStatement" | "supportingDocuments.purpose.SwornStatement.description" | "supportingDocuments.purpose.UBODeclaration" | "supportingDocuments.purpose.UBODeclaration.description" | "supportingDocuments.purpose.UltimateBeneficialOwnerProofOfAddress" | "supportingDocuments.purpose.UltimateBeneficialOwnerProofOfAddress.description" | "supportingDocuments.purpose.UltimateBeneficialOwnerProofOfIdentity" | "supportingDocuments.purpose.UltimateBeneficialOwnerProofOfIdentity.description" | "uploadArea.browse" | "uploadArea.dropFile" | "uploadArea.droppedFile" | "uploadArea.noValue" | "uploadArea.unknownFileName" | "uploadArea.uploading";
22
+ export declare const isTranslationKey: (value: unknown) => value is "addressFormPart.addressLabel" | "addressFormPart.cityLabel" | "addressFormPart.placeholder" | "addressFormPart.postCodeLabel" | "businessActivity.administrativeServices" | "businessActivity.agriculture" | "businessActivity.arts" | "businessActivity.businessAndRetail" | "businessActivity.construction" | "businessActivity.education" | "businessActivity.electricalDistributionAndWaterSupply" | "businessActivity.financialAndInsuranceOperations" | "businessActivity.health" | "businessActivity.housekeeping" | "businessActivity.informationAndCommunication" | "businessActivity.lodgingAndFoodServices" | "businessActivity.manufacturingAndMining" | "businessActivity.other" | "businessActivity.publicAdministration" | "businessActivity.realEstate" | "businessActivity.scientificActivities" | "businessActivity.transportation" | "common.cancel" | "common.close" | "common.form.help.nbCharacters" | "common.form.help.nbDigits" | "common.form.invalidTaxIdentificationNumber" | "common.form.taxIdentificationNumber.placeholder" | "common.form.taxIdentificationNumber.tooltip.deu" | "common.next" | "common.noResult" | "common.open" | "common.optional" | "common.previous" | "common.remove" | "common.showLess" | "common.showMore" | "common.skipToContent" | "datePicker.day.friday" | "datePicker.day.monday" | "datePicker.day.saturday" | "datePicker.day.sunday" | "datePicker.day.thursday" | "datePicker.day.tuesday" | "datePicker.day.wednesday" | "datePicker.month.april" | "datePicker.month.august" | "datePicker.month.december" | "datePicker.month.february" | "datePicker.month.january" | "datePicker.month.july" | "datePicker.month.june" | "datePicker.month.march" | "datePicker.month.may" | "datePicker.month.next" | "datePicker.month.november" | "datePicker.month.october" | "datePicker.month.previous" | "datePicker.month.september" | "error.generic" | "error.iban.invalid" | "error.network.500" | "error.network.503" | "error.requiredField" | "fileInput.browse" | "fileInput.clickToModify" | "fileInput.dropFile" | "fileInput.noFile" | "fileInput.unknownFileName" | "fileTile.status.Pending" | "fileTile.status.Refused" | "fileTile.status.Validated" | "fileTile.uploading" | "monthlyPaymentVolume.between10000And50000" | "monthlyPaymentVolume.between50000And100000" | "monthlyPaymentVolume.lessThan10000" | "monthlyPaymentVolume.moreThan100000" | "registrationPage.defaultNumberLabel" | "registrationPage.withOrganismLabel" | "registrationPage.withoutOrganismNameLabel" | "rejection.AccountHolderNotFoundRejection" | "rejection.AccountHolderTypeIndividualRejection" | "rejection.AccountMembershipCannotBeDisabledRejection" | "rejection.AccountMembershipCannotBeUpdatedRejection" | "rejection.AccountMembershipNotAllowedRejection" | "rejection.AccountMembershipNotFoundRejection" | "rejection.AccountMembershipNotReadyToBeBoundRejection" | "rejection.AccountNotEligibleRejection" | "rejection.AccountNotFoundRejection" | "rejection.AccountVerificationAlreadyRejectedRejection" | "rejection.AccountVerificationWrongStatusRejection" | "rejection.AddingCardsToDifferentAccountsRejection" | "rejection.AlreadyValidPhysicalCardRejection" | "rejection.ApplePayNotAllowedForProjectRejection" | "rejection.BadAccountStatusRejection" | "rejection.BadRequestRejection" | "rejection.CannotActivatePhysicalCardRejection" | "rejection.CapitalDepositDocumentCanNotBeUploaded" | "rejection.CardCanNotBeDigitalizedRejection" | "rejection.CardNotFoundRejection" | "rejection.CardProductDisabledRejection" | "rejection.CardProductNotApplicableToPhysicalCardsRejection" | "rejection.CardProductNotFoundRejection" | "rejection.CardProductSuspendedRejection" | "rejection.CardProductUsedRejection" | "rejection.CardWrongStatusRejection" | "rejection.ConsentNotFoundRejection" | "rejection.ConsentsAlreadyLinkedToMultiConsentRejection" | "rejection.ConsentsNotAllInCreatedStatusRejection" | "rejection.ConsentsNotFoundRejection" | "rejection.ConsentTypeNotSupportedByServerConsentRejection" | "rejection.DebtorAccountClosedRejection" | "rejection.DebtorAccountNotAllowedRejection" | "rejection.DigitalCardNotFoundRejection" | "rejection.EnabledCardDesignNotFoundRejection" | "rejection.ExternalAccountAlreadyExistsRejection" | "rejection.ExternalAccountBalanceAlreadyExistsRejection" | "rejection.ForbiddenRejection" | "rejection.FundingLimitExceededRejection" | "rejection.FundingLimitSettingsChangeRequestBadAmountRejection" | "rejection.FundingSourceNotFoundRejection" | "rejection.FundingSourceWrongStatusRejection" | "rejection.GlobalFundingLimitExceededRejection" | "rejection.GlobalInstantFundingLimitExceededRejection" | "rejection.IBANNotReachableRejection" | "rejection.IBANNotValidRejection" | "rejection.IbanValidationRejection" | "rejection.IdentityAlreadyBindToAccountMembershipRejection" | "rejection.InstantFundingLimitExceededRejection" | "rejection.InsufficientFundsRejection" | "rejection.InternalErrorRejection" | "rejection.InvalidArgumentRejection" | "rejection.InvalidPhoneNumberRejection" | "rejection.InvalidSirenNumberRejection" | "rejection.LegalRepresentativeAccountMembershipCannotBeDisabledRejection" | "rejection.LegalRepresentativeAccountMembershipCannotBeSuspendedRejection" | "rejection.MerchantProfileWrongStatusRejection" | "rejection.MissingMandatoryFieldRejection" | "rejection.NotFoundRejection" | "rejection.NotReachableConsentStatusRejection" | "rejection.NotSupportedCountryRejection" | "rejection.OnboardingNotCompletedRejection" | "rejection.PaymentMandateMandateNotFoundRejection" | "rejection.PaymentMandateReferenceAlreadyUsedRejection" | "rejection.PaymentMethodNotCompatibleRejection" | "rejection.PermissionCannotBeGrantedRejection" | "rejection.PhysicalCardNotFoundRejection" | "rejection.PhysicalCardWrongStatusRejection" | "rejection.PINNotReadyRejection" | "rejection.ProjectForbiddenRejection" | "rejection.ProjectFundingLimitExceededRejection" | "rejection.ProjectInstantFundingLimitExceededRejection" | "rejection.ProjectInvalidStatusRejection" | "rejection.ProjectNotFound" | "rejection.ProjectNotFoundRejection" | "rejection.ProjectSettingsForbiddenError" | "rejection.ProjectSettingsNotFound" | "rejection.ProjectSettingsStatusNotReachable" | "rejection.PublicOnboardingDisabledRejection" | "rejection.ReceivedDirectDebitMandateAlreadyExistRejection" | "rejection.ReceivedDirectDebitMandateCanceledRejection" | "rejection.ReceivedDirectDebitMandateNotB2bRejection" | "rejection.ReceivedDirectDebitMandateNotFoundRejection" | "rejection.RefundRejection" | "rejection.RestrictedToUserRejection" | "rejection.SchemeWrongRejection" | "rejection.ServerConsentCredentialsNotValidOrOutdatedRejection" | "rejection.ServerConsentNotAllowedForConsentOperationRejection" | "rejection.ServerConsentNotAllowedForProjectRejection" | "rejection.ServerConsentProjectCredentialMissingRejection" | "rejection.ServerConsentProjectCredentialNotFoundRejection" | "rejection.ServerConsentProjectSettingsNotFoundRejection" | "rejection.ServerConsentSignatureNotValidRejection" | "rejection.StandingOrderNotFoundRejection" | "rejection.SupportingDocumentCollectionNotFoundRejection" | "rejection.SupportingDocumentCollectionStatusDoesNotAllowDeletionRejection" | "rejection.SupportingDocumentCollectionStatusDoesNotAllowUpdateRejection" | "rejection.SupportingDocumentCollectionStatusNotAllowedRejection" | "rejection.SupportingDocumentNotFoundRejection" | "rejection.SupportingDocumentStatusDoesNotAllowDeletionRejection" | "rejection.SupportingDocumentStatusDoesNotAllowUpdateRejection" | "rejection.SupportingDocumentStatusNotAllowedRejection" | "rejection.SupportingDocumentUploadNotAllowedRejection" | "rejection.SuspendReceivedDirectDebitMandatedRejection" | "rejection.TooManyChildConsentsRejection" | "rejection.TooManyItemsRejection" | "rejection.TransactionNotFoundRejection" | "rejection.UpdateUserConsentSettingsTokenRejection" | "rejection.UserNotAllowedToDisableItsOwnAccountMembershipRejection" | "rejection.UserNotAllowedToManageAccountMembershipRejection" | "rejection.UserNotAllowedToSuspendItsOwnAccountMembershipRejection" | "rejection.UserNotCardHolderRejection" | "rejection.ValidationRejection" | "rejection.WrongValueProvidedRejection" | "rib.accountHolder" | "rib.accountNumber" | "rib.address" | "rib.agency" | "rib.bank" | "rib.bankDetails" | "rib.bic" | "rib.iban" | "rib.key" | "rib.nationalCode" | "rib.number" | "rib.partnership" | "supportingDocuments.documentTypes" | "supportingDocuments.downloadTemplate" | "supportingDocuments.errorUpload" | "supportingDocuments.help.whatIsThis" | "supportingDocuments.noRequiredDocuments" | "supportingDocuments.powerOfAttorneyModal.description" | "supportingDocuments.powerOfAttorneyModal.title" | "supportingDocuments.purpose.AdministratorDecisionOfAppointment.description" | "supportingDocuments.purpose.AdministratorDecisionOfAppointment" | "supportingDocuments.purpose.AssociationRegistration.description" | "supportingDocuments.purpose.AssociationRegistration" | "supportingDocuments.purpose.Banking.description" | "supportingDocuments.purpose.Banking" | "supportingDocuments.purpose.CompanyRegistration.description" | "supportingDocuments.purpose.CompanyRegistration" | "supportingDocuments.purpose.FinancialStatements.description" | "supportingDocuments.purpose.FinancialStatements" | "supportingDocuments.purpose.GeneralAssemblyMinutes.description" | "supportingDocuments.purpose.GeneralAssemblyMinutes" | "supportingDocuments.purpose.LegalRepresentativeProofOfIdentity.description" | "supportingDocuments.purpose.LegalRepresentativeProofOfIdentity" | "supportingDocuments.purpose.NIFAccreditationCard.description" | "supportingDocuments.purpose.NIFAccreditationCard" | "supportingDocuments.purpose.Other.description" | "supportingDocuments.purpose.Other" | "supportingDocuments.purpose.PowerOfAttorney.description" | "supportingDocuments.purpose.PowerOfAttorney" | "supportingDocuments.purpose.PresidentDecisionOfAppointment.description" | "supportingDocuments.purpose.PresidentDecisionOfAppointment" | "supportingDocuments.purpose.ProofOfCompanyAddress.description" | "supportingDocuments.purpose.ProofOfCompanyAddress" | "supportingDocuments.purpose.ProofOfCompanyIncome.description" | "supportingDocuments.purpose.ProofOfCompanyIncome" | "supportingDocuments.purpose.ProofOfIdentity.description" | "supportingDocuments.purpose.ProofOfIdentity" | "supportingDocuments.purpose.ProofOfIndividualAddress.description" | "supportingDocuments.purpose.ProofOfIndividualAddress" | "supportingDocuments.purpose.ProofOfIndividualIncome.description" | "supportingDocuments.purpose.ProofOfIndividualIncome" | "supportingDocuments.purpose.ProofOfOriginOfFunds.description" | "supportingDocuments.purpose.ProofOfOriginOfFunds" | "supportingDocuments.purpose.SignedStatus.description" | "supportingDocuments.purpose.SignedStatus" | "supportingDocuments.purpose.SwornStatement.description" | "supportingDocuments.purpose.SwornStatement" | "supportingDocuments.purpose.UBODeclaration.description" | "supportingDocuments.purpose.UBODeclaration" | "supportingDocuments.purpose.UltimateBeneficialOwnerProofOfAddress.description" | "supportingDocuments.purpose.UltimateBeneficialOwnerProofOfAddress" | "supportingDocuments.purpose.UltimateBeneficialOwnerProofOfIdentity.description" | "supportingDocuments.purpose.UltimateBeneficialOwnerProofOfIdentity" | "taxIdentificationNumber.label";
23
23
  export declare const translateError: (error: unknown) => string;
24
24
  export {};
@@ -1,40 +0,0 @@
1
- /// <reference types="react" />
2
- import { CountryCCA3 } from "../constants/countries";
3
- type BeneficiaryType = "HasCapital" | "LegalRepresentative" | "Other";
4
- type AccountCountry = "DEU" | "ESP" | "FRA" | "NLD";
5
- export type BeneficiaryFormStep = "common" | "address";
6
- export type EditorState = {
7
- reference: string;
8
- firstName: string;
9
- lastName: string;
10
- birthDate: string;
11
- birthCountryCode: CountryCCA3 | undefined;
12
- birthCity: string;
13
- birthCityPostalCode: string;
14
- type: BeneficiaryType;
15
- indirect: boolean;
16
- direct: boolean;
17
- totalCapitalPercentage?: number;
18
- residencyAddressLine1?: string;
19
- residencyAddressCity?: string;
20
- residencyAddressCountry?: string;
21
- residencyAddressPostalCode?: string;
22
- taxIdentificationNumber?: string;
23
- };
24
- type Props = {
25
- initialState?: EditorState;
26
- accountCountry: AccountCountry;
27
- step: BeneficiaryFormStep;
28
- placekitApiKey: string;
29
- onStepChange: (step: BeneficiaryFormStep) => void;
30
- onSave: (editorState: EditorState) => void | Promise<void>;
31
- onClose: () => void;
32
- onCityLoadError: (error: unknown) => void;
33
- };
34
- export type BeneficiaryFormRef = {
35
- cancel: () => void;
36
- submit: () => void;
37
- };
38
- export declare const validateUbo: (editorState: EditorState, accountCountry: AccountCountry) => Partial<Record<keyof EditorState, string | undefined>>;
39
- export declare const BeneficiaryForm: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<BeneficiaryFormRef | undefined>>;
40
- export {};
@@ -1,352 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Option } from "@swan-io/boxed";
3
- import { Box } from "@swan-io/lake/src/components/Box";
4
- import { LakeLabelledCheckbox } from "@swan-io/lake/src/components/LakeCheckbox";
5
- import { LakeLabel } from "@swan-io/lake/src/components/LakeLabel";
6
- import { LakeText } from "@swan-io/lake/src/components/LakeText";
7
- import { LakeTextInput } from "@swan-io/lake/src/components/LakeTextInput";
8
- import { RadioGroup } from "@swan-io/lake/src/components/RadioGroup";
9
- import { ResponsiveContainer } from "@swan-io/lake/src/components/ResponsiveContainer";
10
- import { Space } from "@swan-io/lake/src/components/Space";
11
- import { StepDots } from "@swan-io/lake/src/components/StepDots";
12
- import { breakpoints, colors } from "@swan-io/lake/src/constants/design";
13
- import { noop } from "@swan-io/lake/src/utils/function";
14
- import { isNotNullishOrEmpty } from "@swan-io/lake/src/utils/nullish";
15
- import { pick } from "@swan-io/lake/src/utils/object";
16
- import { combineValidators, useForm } from "@swan-io/use-form";
17
- import { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } from "react";
18
- import { StyleSheet, View } from "react-native";
19
- import { Rifm } from "rifm";
20
- import { match } from "ts-pattern";
21
- import { v4 as uuid } from "uuid";
22
- import { allCountries, isCountryCCA3 } from "../constants/countries";
23
- import { decodeBirthDate, encodeBirthDate } from "../utils/date";
24
- import { locale, rifmDateProps, t } from "../utils/i18n";
25
- import { validateBooleanRequired, validateIndividualTaxNumber, validateNullableRequired, validateRequired, } from "../utils/validation";
26
- import { CountryPicker } from "./CountryPicker";
27
- import { PlacekitAddressSearchInput } from "./PlacekitAddressSearchInput";
28
- import { PlacekitCityInput } from "./PlacekitCityInput";
29
- import { TaxIdentificationNumberInput } from "./TaxIdentificationNumberInput";
30
- const styles = StyleSheet.create({
31
- inputContainer: {
32
- flex: 1,
33
- },
34
- });
35
- const beneficiaryTypes = [
36
- { value: "HasCapital", name: t("beneficiaryForm.beneficiary.ownershipOfCapital") },
37
- {
38
- value: "LegalRepresentative",
39
- name: t("beneficiaryForm.beneficiary.legalRepresentative"),
40
- },
41
- { value: "Other", name: t("beneficiaryForm.beneficiary.other") },
42
- ];
43
- const validateCca3CountryCode = value => {
44
- if (value == null) {
45
- return t("error.requiredField");
46
- }
47
- if (!isCountryCCA3(value)) {
48
- // no need to set an error message because country picker contains only valid values
49
- // this is used only for validateUbo function to display an error indicator without opening UBO modal
50
- return " ";
51
- }
52
- };
53
- export const validateUbo = (editorState, accountCountry) => {
54
- var _a, _b;
55
- const isAddressRequired = match(accountCountry)
56
- .with("DEU", "ESP", () => true)
57
- .otherwise(() => false);
58
- const isBirthInfoRequired = match(accountCountry)
59
- .with("ESP", "FRA", "NLD", () => true)
60
- .otherwise(() => false);
61
- const isTaxIdentificationNumberRequired = accountCountry === "DEU" && editorState.residencyAddressCountry === "DEU";
62
- const validateTaxNumber = isTaxIdentificationNumberRequired
63
- ? combineValidators(validateNullableRequired, validateIndividualTaxNumber(accountCountry))
64
- : validateIndividualTaxNumber(accountCountry);
65
- return {
66
- firstName: validateNullableRequired(editorState.firstName),
67
- lastName: validateNullableRequired(editorState.lastName),
68
- birthDate: isBirthInfoRequired
69
- ? validateNullableRequired(editorState.birthDate)
70
- : undefined,
71
- birthCountryCode: validateCca3CountryCode(editorState.birthCountryCode),
72
- birthCity: isBirthInfoRequired
73
- ? validateNullableRequired(editorState.birthCity)
74
- : undefined,
75
- birthCityPostalCode: isBirthInfoRequired
76
- ? validateNullableRequired(editorState.birthCityPostalCode)
77
- : undefined,
78
- type: validateNullableRequired(editorState.type),
79
- totalCapitalPercentage: editorState.type === "HasCapital"
80
- ? validateNullableRequired((_a = editorState.totalCapitalPercentage) === null || _a === void 0 ? void 0 : _a.toString())
81
- : undefined,
82
- residencyAddressLine1: isAddressRequired
83
- ? validateNullableRequired(editorState.residencyAddressLine1)
84
- : undefined,
85
- residencyAddressCity: isAddressRequired
86
- ? validateNullableRequired(editorState.residencyAddressCity)
87
- : undefined,
88
- residencyAddressCountry: isAddressRequired
89
- ? validateNullableRequired(editorState.residencyAddressCountry)
90
- : undefined,
91
- residencyAddressPostalCode: isAddressRequired
92
- ? validateNullableRequired(editorState.residencyAddressPostalCode)
93
- : undefined,
94
- taxIdentificationNumber: validateTaxNumber((_b = editorState.taxIdentificationNumber) !== null && _b !== void 0 ? _b : ""),
95
- indirect: editorState.type !== "HasCapital" || editorState.direct === true
96
- ? undefined
97
- : validateBooleanRequired(editorState.indirect),
98
- direct: editorState.type !== "HasCapital" || editorState.indirect === true
99
- ? undefined
100
- : validateBooleanRequired(editorState.direct),
101
- };
102
- };
103
- /**
104
- * This component was created to handle validation easily with react-ux-form
105
- * Without this component, we have to validate direct and indirect checkboxes separately
106
- * But validation is run only onChange or onSubmit, so when both checkboxes were unchecked, check one of them doesn't revalidate the other one
107
- * Another way is combining direct and indirect values with `formStatus` but the error appears or disappears too early
108
- * So with this component we need only 1 validator making possible the best UX without caveats
109
- */
110
- const CapitalTypeCheckboxes = ({ value, error, onChange }) => {
111
- return (_jsxs(View, { children: [_jsxs(Box, { direction: "row", alignItems: "center", children: [_jsx(LakeLabelledCheckbox, { value: value === "direct" || value === "both", onValueChange: direct => {
112
- match({ direct, value })
113
- .with({ direct: true, value: "none" }, () => onChange("direct"))
114
- .with({ direct: true, value: "indirect" }, () => onChange("both"))
115
- .with({ direct: false, value: "direct" }, () => onChange("none"))
116
- .with({ direct: false, value: "both" }, () => onChange("indirect"))
117
- // other cases are impossible so we don't need to handle them
118
- .otherwise(noop);
119
- }, label: t("beneficiaryForm.beneficiary.directly"), isError: error != null }), _jsx(Space, { width: 24 }), _jsx(LakeLabelledCheckbox, { value: value === "indirect" || value === "both", onValueChange: indirect => {
120
- match({ indirect, value })
121
- .with({ indirect: true, value: "none" }, () => onChange("indirect"))
122
- .with({ indirect: true, value: "direct" }, () => onChange("both"))
123
- .with({ indirect: false, value: "indirect" }, () => onChange("none"))
124
- .with({ indirect: false, value: "both" }, () => onChange("direct"))
125
- // other cases are impossible so we don't need to handle them
126
- .otherwise(noop);
127
- }, label: t("beneficiaryForm.beneficiary.indirectly"), isError: error != null })] }), _jsx(Space, { height: 4 }), _jsx(LakeText, { color: colors.negative[400], children: error !== null && error !== void 0 ? error : " " })] }));
128
- };
129
- const formSteps = ["common", "address"];
130
- const requiredStepFields = [
131
- "firstName",
132
- "lastName",
133
- "birthDate",
134
- "birthCountryCode",
135
- "birthCity",
136
- "birthCityPostalCode",
137
- "type",
138
- ];
139
- export const BeneficiaryForm = forwardRef(({ initialState, accountCountry, step, placekitApiKey, onStepChange, onClose, onSave, onCityLoadError, }, ref) => {
140
- var _a, _b, _c, _d, _e, _f, _g;
141
- const [reference] = useState(() => { var _a; return (_a = initialState === null || initialState === void 0 ? void 0 : initialState.reference) !== null && _a !== void 0 ? _a : uuid(); });
142
- const isAddressRequired = match(accountCountry)
143
- .with("DEU", "ESP", () => true)
144
- .otherwise(() => false);
145
- const isBirthInfoRequired = match(accountCountry)
146
- .with("ESP", "FRA", "NLD", () => true)
147
- .otherwise(() => false);
148
- const initialAddress = useRef({
149
- residencyAddressLine1: initialState === null || initialState === void 0 ? void 0 : initialState.residencyAddressLine1,
150
- residencyAddressCity: initialState === null || initialState === void 0 ? void 0 : initialState.residencyAddressCity,
151
- residencyAddressPostalCode: initialState === null || initialState === void 0 ? void 0 : initialState.residencyAddressPostalCode,
152
- });
153
- const commonStepValues = useRef();
154
- const initialBirthDate = initialState === null || initialState === void 0 ? void 0 : initialState.birthDate;
155
- const { Field, FieldsListener, setFieldValue, submitForm, listenFields, validateField } = useForm({
156
- firstName: {
157
- initialValue: (_a = initialState === null || initialState === void 0 ? void 0 : initialState.firstName) !== null && _a !== void 0 ? _a : "",
158
- validate: validateNullableRequired,
159
- sanitize: value => value === null || value === void 0 ? void 0 : value.trim(),
160
- },
161
- lastName: {
162
- initialValue: (_b = initialState === null || initialState === void 0 ? void 0 : initialState.lastName) !== null && _b !== void 0 ? _b : "",
163
- validate: validateNullableRequired,
164
- sanitize: value => value === null || value === void 0 ? void 0 : value.trim(),
165
- },
166
- birthDate: {
167
- initialValue: isNotNullishOrEmpty(initialBirthDate)
168
- ? decodeBirthDate(initialBirthDate)
169
- : "",
170
- validate: isBirthInfoRequired ? validateNullableRequired : undefined,
171
- sanitize: value => value === null || value === void 0 ? void 0 : value.trim(),
172
- },
173
- birthCountryCode: {
174
- initialValue: (_c = initialState === null || initialState === void 0 ? void 0 : initialState.birthCountryCode) !== null && _c !== void 0 ? _c : accountCountry,
175
- validate: validateNullableRequired,
176
- },
177
- birthCity: {
178
- initialValue: (_d = initialState === null || initialState === void 0 ? void 0 : initialState.birthCity) !== null && _d !== void 0 ? _d : "",
179
- validate: isBirthInfoRequired ? validateNullableRequired : undefined,
180
- sanitize: value => value === null || value === void 0 ? void 0 : value.trim(),
181
- },
182
- birthCityPostalCode: {
183
- initialValue: (_e = initialState === null || initialState === void 0 ? void 0 : initialState.birthCityPostalCode) !== null && _e !== void 0 ? _e : "",
184
- validate: isBirthInfoRequired ? validateNullableRequired : undefined,
185
- sanitize: value => value === null || value === void 0 ? void 0 : value.trim(),
186
- },
187
- type: {
188
- initialValue: (_f = initialState === null || initialState === void 0 ? void 0 : initialState.type) !== null && _f !== void 0 ? _f : "HasCapital",
189
- validate: validateRequired,
190
- },
191
- capitalType: {
192
- initialValue: match({
193
- direct: initialState === null || initialState === void 0 ? void 0 : initialState.direct,
194
- indirect: initialState === null || initialState === void 0 ? void 0 : initialState.indirect,
195
- })
196
- .returnType()
197
- .with({ direct: true, indirect: true }, () => "both")
198
- .with({ direct: true }, () => "direct")
199
- .with({ indirect: true }, () => "indirect")
200
- .otherwise(() => "none"),
201
- validate: (value, { getFieldValue }) => {
202
- if (getFieldValue("type") === "HasCapital" && value === "none") {
203
- return t("beneficiaryForm.beneficiary.directOrIndirect");
204
- }
205
- },
206
- },
207
- totalCapitalPercentage: {
208
- initialValue: (_g = initialState === null || initialState === void 0 ? void 0 : initialState.totalCapitalPercentage) === null || _g === void 0 ? void 0 : _g.toString(),
209
- validate: validateNullableRequired,
210
- sanitize: value => value === null || value === void 0 ? void 0 : value.trim(),
211
- },
212
- address: {
213
- initialValue: initialState === null || initialState === void 0 ? void 0 : initialState.residencyAddressLine1,
214
- validate: isAddressRequired ? validateNullableRequired : undefined,
215
- sanitize: value => value === null || value === void 0 ? void 0 : value.trim(),
216
- },
217
- city: {
218
- initialValue: initialState === null || initialState === void 0 ? void 0 : initialState.residencyAddressCity,
219
- validate: isAddressRequired ? validateNullableRequired : undefined,
220
- sanitize: value => value === null || value === void 0 ? void 0 : value.trim(),
221
- },
222
- postalCode: {
223
- initialValue: initialState === null || initialState === void 0 ? void 0 : initialState.residencyAddressPostalCode,
224
- validate: isAddressRequired ? validateNullableRequired : undefined,
225
- sanitize: value => value === null || value === void 0 ? void 0 : value.trim(),
226
- },
227
- country: {
228
- initialValue: isCountryCCA3(initialState === null || initialState === void 0 ? void 0 : initialState.residencyAddressCountry)
229
- ? initialState === null || initialState === void 0 ? void 0 : initialState.residencyAddressCountry
230
- : accountCountry,
231
- validate: isAddressRequired ? validateNullableRequired : undefined,
232
- },
233
- taxIdentificationNumber: {
234
- initialValue: initialState === null || initialState === void 0 ? void 0 : initialState.taxIdentificationNumber,
235
- validate: (value, { getFieldValue }) => {
236
- const uboCountry = getFieldValue("country");
237
- if (accountCountry === "DEU" && uboCountry === "DEU") {
238
- return combineValidators(validateNullableRequired, validateIndividualTaxNumber(accountCountry))(value);
239
- }
240
- return validateIndividualTaxNumber(accountCountry)(value);
241
- },
242
- sanitize: value => value === null || value === void 0 ? void 0 : value.trim(),
243
- },
244
- });
245
- const hasBeenSubmittedOnce = useRef(false);
246
- useEffect(() => {
247
- if (initialState != null) {
248
- // submit form to validate all fields
249
- submitForm();
250
- }
251
- }, [initialState, submitForm]);
252
- useEffect(() => {
253
- // store address values on change to set initial values when user use cancel button and go back
254
- // without this, address form part initial values stays empty and city and postal code aren't automatically mounted
255
- return listenFields(["address", "city", "postalCode"], ({ address, city, postalCode }) => {
256
- initialAddress.current = {
257
- residencyAddressLine1: address === null || address === void 0 ? void 0 : address.value,
258
- residencyAddressCity: city === null || city === void 0 ? void 0 : city.value,
259
- residencyAddressPostalCode: postalCode === null || postalCode === void 0 ? void 0 : postalCode.value,
260
- };
261
- });
262
- });
263
- useEffect(() => {
264
- return listenFields(["type"], () => {
265
- if (hasBeenSubmittedOnce.current) {
266
- // The setTimeout is needed here so that the `validateField`
267
- // runs *after* the <Field /> mounts, as it's a no-op if not mounted
268
- setTimeout(() => {
269
- void validateField("totalCapitalPercentage");
270
- }, 100);
271
- }
272
- });
273
- }, [listenFields, validateField]);
274
- useImperativeHandle(ref, () => {
275
- return {
276
- cancel: () => {
277
- match(step)
278
- .with("common", () => onClose())
279
- .with("address", () => onStepChange("common"))
280
- .exhaustive();
281
- },
282
- submit: () => {
283
- hasBeenSubmittedOnce.current = true;
284
- submitForm({
285
- onSuccess: values => {
286
- const firstStepValues = Option.allFromDict(pick(values, requiredStepFields));
287
- if (step === "common" && isAddressRequired && firstStepValues.isSome()) {
288
- commonStepValues.current = {
289
- ...firstStepValues.get(),
290
- capitalType: values.capitalType.getWithDefault(undefined),
291
- totalCapitalPercentage: values.totalCapitalPercentage.getWithDefault(undefined),
292
- address: values.address.getWithDefault(undefined),
293
- city: values.city.getWithDefault(undefined),
294
- postalCode: values.postalCode.getWithDefault(undefined),
295
- country: values.country.getWithDefault(undefined),
296
- taxIdentificationNumber: values.taxIdentificationNumber.getWithDefault(undefined),
297
- };
298
- return onStepChange("address");
299
- }
300
- const secondStepValues = Option.allFromDict(pick({ ...commonStepValues.current, ...values }, requiredStepFields));
301
- if (secondStepValues.isSome()) {
302
- const { birthDate, ...rest } = secondStepValues.get();
303
- const capitalType = values.capitalType.getWithDefault("none");
304
- return onSave({
305
- ...rest,
306
- reference,
307
- birthDate: encodeBirthDate(birthDate),
308
- direct: capitalType === "both" || capitalType === "direct",
309
- indirect: capitalType === "both" || capitalType === "indirect",
310
- totalCapitalPercentage: values.totalCapitalPercentage
311
- .flatMap(value => Option.fromNullable(value))
312
- .map(value => parseInt(value, 10))
313
- .getWithDefault(undefined),
314
- residencyAddressLine1: values.address.getWithDefault(undefined),
315
- residencyAddressCity: values.city.getWithDefault(undefined),
316
- residencyAddressCountry: values.country.getWithDefault(undefined),
317
- residencyAddressPostalCode: values.postalCode.getWithDefault(undefined),
318
- taxIdentificationNumber: values.taxIdentificationNumber.getWithDefault(undefined),
319
- });
320
- }
321
- },
322
- });
323
- },
324
- };
325
- });
326
- const onSuggestion = useCallback((place) => {
327
- setFieldValue("address", place.completeAddress);
328
- setFieldValue("city", place.city);
329
- if (place.postalCode != null) {
330
- setFieldValue("postalCode", place.postalCode);
331
- }
332
- }, [setFieldValue]);
333
- return (_jsx(ResponsiveContainer, { breakpoint: breakpoints.tiny, children: ({ small }) => (_jsxs(_Fragment, { children: [match(step)
334
- .with("common", () => (_jsxs(View, { role: "form", children: [_jsxs(Box, { direction: small ? "column" : "row", children: [_jsx(Field, { name: "firstName", children: ({ value, onChange, error }) => (_jsx(LakeLabel, { label: t("beneficiaryForm.beneficiary.firstName"), style: styles.inputContainer, render: id => (_jsx(LakeTextInput, { error: error, placeholder: t("beneficiaryForm.beneficiary.firstNamePlaceholder"), id: id, value: value, onChangeText: onChange })) })) }), _jsx(Space, { width: 12 }), _jsx(Field, { name: "lastName", children: ({ value, onChange, error }) => (_jsx(LakeLabel, { label: t("beneficiaryForm.beneficiary.lastName"), style: styles.inputContainer, render: id => (_jsx(LakeTextInput, { error: error, placeholder: t("beneficiaryForm.beneficiary.lastNamePlaceholder"), id: id, value: value, onChangeText: onChange })) })) })] }), _jsxs(Box, { direction: small ? "column" : "row", children: [_jsx(Field, { name: "birthDate", children: ({ value, onChange, error }) => (_jsx(LakeLabel, { label: t("beneficiaryForm.beneficiary.birthDate"), optionalLabel: isBirthInfoRequired ? undefined : t("common.optional"), style: styles.inputContainer, render: id => (_jsx(Rifm, { value: value !== null && value !== void 0 ? value : "", onChange: onChange, ...rifmDateProps, children: ({ value, onChange }) => (_jsx(LakeTextInput, { error: error, placeholder: locale.datePlaceholder, id: id, value: value, onChange: onChange })) })) })) }), _jsx(Space, { width: 12 }), _jsx(Field, { name: "birthCountryCode", children: ({ value, onChange, error }) => (_jsx(LakeLabel, { label: t("beneficiaryForm.beneficiary.birthCountry"), style: styles.inputContainer, render: id => (_jsx(CountryPicker, { id: id, error: error, value: value, placeholder: t("beneficiaryForm.beneficiary.birthCountryPlaceholder"), countries: allCountries, onValueChange: onChange })) })) })] }), _jsx(Box, { direction: small ? "column" : "row", children: _jsx(FieldsListener, { names: ["birthCountryCode"], children: ({ birthCountryCode }) => (_jsxs(_Fragment, { children: [_jsx(Field, { name: "birthCity", children: ({ value, onChange, error }) => (_jsx(LakeLabel, { label: t("beneficiaryForm.beneficiary.birthCity"), optionalLabel: isBirthInfoRequired ? undefined : t("common.optional"), style: styles.inputContainer, render: id => (_jsx(PlacekitCityInput, { id: id, apiKey: placekitApiKey, error: error, country: birthCountryCode.value, value: value !== null && value !== void 0 ? value : "", onValueChange: onChange, placeholder: birthCountryCode.value == null
335
- ? t("beneficiaryForm.beneficiary.fillBirthCountry")
336
- : t("beneficiaryForm.beneficiary.birthCityPlaceholder"), onSuggestion: place => {
337
- onChange(place.city);
338
- if (place.postalCode != null) {
339
- setFieldValue("birthCityPostalCode", place.postalCode);
340
- }
341
- }, onLoadError: onCityLoadError })) })) }), _jsx(Space, { width: 12 }), _jsx(Field, { name: "birthCityPostalCode", children: ({ value, onChange, error }) => (_jsx(LakeLabel, { label: t("beneficiaryForm.beneficiary.birthPostalCode"), optionalLabel: isBirthInfoRequired ? undefined : t("common.optional"), style: styles.inputContainer, render: id => (_jsx(LakeTextInput, { error: error, placeholder: birthCountryCode.value == null
342
- ? t("beneficiaryForm.beneficiary.fillBirthCountry")
343
- : t("beneficiaryForm.beneficiary.birthPostalCodePlaceholder"), id: id, disabled: birthCountryCode.value === undefined, value: value, onChangeText: onChange })) })) })] })) }) }), _jsx(Field, { name: "type", children: ({ value, onChange }) => (_jsx(LakeLabel, { label: t("beneficiaryForm.beneficiary.type"), type: "radioGroup", render: () => (_jsx(RadioGroup, { direction: "row", value: value, onValueChange: onChange, items: beneficiaryTypes })) })) }), _jsx(FieldsListener, { names: ["type"], children: ({ type }) => type.value === "HasCapital" ? (_jsxs(_Fragment, { children: [_jsx(Field, { name: "totalCapitalPercentage", children: ({ value, onChange, error }) => (_jsx(LakeLabel, { label: t("beneficiaryForm.beneficiary.totalCapitalPercentage"), render: id => (_jsx(LakeTextInput, { error: error, unit: "%", inputMode: "decimal", "aria-valuemin": 0, "aria-valuemax": 100, id: id, value: value, onChangeText: onChange })) })) }), _jsx(Space, { height: 12 }), _jsx(Field, { name: "capitalType", children: ({ value, error, onChange }) => (_jsx(CapitalTypeCheckboxes, { value: value !== null && value !== void 0 ? value : "none", error: error, onChange: onChange })) })] })) : null })] })))
344
- .with("address", () => (_jsxs(View, { role: "form", children: [_jsx(Field, { name: "country", children: ({ value, onChange }) => (_jsx(LakeLabel, { label: t("beneficiaryForm.beneficiary.country"), render: id => (_jsx(CountryPicker, { id: id, value: value, countries: allCountries, onValueChange: onChange })) })) }), _jsx(Space, { height: 12 }), _jsx(FieldsListener, { names: ["country"], children: ({ country }) => (_jsxs(_Fragment, { children: [_jsx(Field, { name: "address", children: ({ ref, value, onChange, error }) => (_jsx(LakeLabel, { label: t("beneficiaryForm.beneficiary.address"), render: id => {
345
- var _a;
346
- return (_jsx(PlacekitAddressSearchInput, { inputRef: ref, apiKey: placekitApiKey, emptyResultText: t("common.noResult"), placeholder: t("addressFormPart.placeholder"), language: locale.language, id: id, country: (_a = country.value) !== null && _a !== void 0 ? _a : accountCountry, value: value, error: error, onValueChange: onChange, onSuggestion: onSuggestion }));
347
- } })) }), _jsx(Space, { height: 12 }), _jsx(Field, { name: "city", children: ({ ref, value, valid, error, onChange }) => (_jsx(LakeLabel, { label: t("addressFormPart.cityLabel"), render: id => (_jsx(LakeTextInput, { ref: ref, id: id, value: value, valid: valid, error: error, onChangeText: onChange })) })) }), _jsx(Space, { height: 12 }), _jsx(Field, { name: "postalCode", children: ({ ref, value, valid, error, onChange }) => (_jsx(LakeLabel, { label: t("addressFormPart.postCodeLabel"), render: id => (_jsx(LakeTextInput, { ref: ref, id: id, value: value, valid: valid, error: error, onChangeText: onChange })) })) }), ((accountCountry === "DEU" && (country === null || country === void 0 ? void 0 : country.value) === "DEU") ||
348
- accountCountry === "ESP") && (_jsxs(_Fragment, { children: [_jsx(Space, { height: 12 }), _jsx(Field, { name: "taxIdentificationNumber", children: ({ value, error, valid, onChange }) => (_jsx(TaxIdentificationNumberInput, { value: value !== null && value !== void 0 ? value : "", error: error, valid: valid, onChange: onChange, accountCountry: accountCountry, isCompany: false,
349
- // is mandatory for German accounts with UBO living in Germany
350
- required: accountCountry === "DEU" && (country === null || country === void 0 ? void 0 : country.value) === "DEU" })) })] }))] })) })] })))
351
- .exhaustive(), isAddressRequired && (_jsxs(_Fragment, { children: [_jsx(Space, { height: 12 }), _jsx(StepDots, { currentStep: step, steps: formSteps })] }))] })) }));
352
- });
@@ -1,33 +0,0 @@
1
- import { ForwardedRef } from "react";
2
- export type Document<Purpose extends string> = {
3
- id: string;
4
- name?: string;
5
- downloadUrl?: string;
6
- purpose: Purpose;
7
- };
8
- type Props<Purpose extends string> = {
9
- getAwsUrl: (file: File, purpose: Purpose) => Promise<{
10
- upload: {
11
- url: string;
12
- fields: {
13
- key: string;
14
- value: string;
15
- }[];
16
- };
17
- id: string;
18
- }>;
19
- documents: Document<Purpose>[];
20
- requiredDocumentPurposes: Purpose[];
21
- onChange?: (documents: Document<Purpose>[]) => void;
22
- onboardingLanguage?: string;
23
- };
24
- export type SupportingDocumentRef = {
25
- submit: (callback: (value: boolean) => void) => void;
26
- };
27
- export declare const getSupportingDocumentPurposeLabel: (purpose: string) => string;
28
- export declare const getSupportingDocumentPurposeDescriptionLabel: (purpose: string) => string;
29
- declare const SupportingDocumentWithRef: <Purpose extends string>({ documents, getAwsUrl, onChange, requiredDocumentPurposes, onboardingLanguage, }: Props<Purpose>, externalRef: ForwardedRef<SupportingDocumentRef>) => import("react/jsx-runtime").JSX.Element;
30
- export declare const SupportingDocument: <I extends string>(props: Props<I> & {
31
- ref?: ForwardedRef<SupportingDocumentRef> | undefined;
32
- }) => ReturnType<typeof SupportingDocumentWithRef>;
33
- export {};