@adyen/kyc-components 3.64.8 → 3.65.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.
- package/dist/{AccountSetupRejected-CP9jkbCa.js → AccountSetupRejected-8Bcks_Pu.js} +2 -2
- package/dist/{CXEL7IU7-Cy-ydTWh.js → CXEL7IU7-EInZOSNY.js} +3 -3
- package/dist/{CustomerSupport-CbpXcaLL.js → CustomerSupport-BCIrCnC-.js} +3 -3
- package/dist/{DebugModal-B23U9e_H.js → DebugModal-BTbmQWwe.js} +7 -7
- package/dist/{DecisionMakers-HwvsPt2t.js → DecisionMakers-BJ5xphlP.js} +4 -4
- package/dist/{HASRA6WW-Df5UPpuR.js → HASRA6WW-C4T4T8Nn.js} +2 -2
- package/dist/{I3HPI4QX-DSxyrvV1.js → I3HPI4QX-s_JOUk5d.js} +3 -3
- package/dist/{Introduction--cfHmxYn.js → Introduction-DfZOVSDf.js} +2 -2
- package/dist/{Review-PD2SlGvU.js → Review-VgvMT5nK.js} +4 -4
- package/dist/{SingpassSelection-DgEe6r8W.js → SingpassSelection-hpY3DbKh.js} +2 -2
- package/dist/TaxReportingDropin-Dqfa6FM8.js +544 -0
- package/dist/adyen-kyc-components.js +1 -1
- package/dist/adyenConfig.js +1 -1
- package/dist/{bg-BG-NVSBt3tn.js → bg-BG-D5xgOsU2.js} +29 -2
- package/dist/{core-FHBxkwxA.js → core-D8ryGpa4.js} +37127 -37412
- package/dist/{cs-CZ-DqZaIl0x.js → cs-CZ-KVBXiNIz.js} +29 -2
- package/dist/{css-B-GQV8RP.js → css-CycUexVO.js} +2 -2
- package/dist/{da-DK-VDNZINuU.js → da-DK-7spShYAz.js} +29 -2
- package/dist/{de-DE-Cy2I9dDn.js → de-DE-yvRIvFcU.js} +29 -2
- package/dist/{el-GR-DHfRaR8Z.js → el-GR-YWCgriVb.js} +29 -2
- package/dist/{es-ES-DZVd96IC.js → es-ES-CNzD9GEq.js} +29 -2
- package/dist/{et-EE-B-NM8E_e.js → et-EE-DmUotb4z.js} +29 -2
- package/dist/{fi-FI-BbQD08sd.js → fi-FI-TAzpPLK7.js} +29 -2
- package/dist/{fr-FR-B0hRAlYr.js → fr-FR-CIuKbRED.js} +29 -2
- package/dist/{hr-HR-DISs60-D.js → hr-HR-DVgHQ1c2.js} +29 -2
- package/dist/{hu-HU-FdXtQL6g.js → hu-HU-BbcxqNs1.js} +29 -2
- package/dist/{it-IT-DLVitGZp.js → it-IT-B1f9TSeu.js} +29 -2
- package/dist/{json-C4EryEB4.js → json-BNxOWY2H.js} +2 -2
- package/dist/{lt-LT-CCJXOhvW.js → lt-LT-BrIeKggd.js} +29 -2
- package/dist/{lv-LV-BQmI9-a3.js → lv-LV-Bac-1cF2.js} +29 -2
- package/dist/{nl-NL-Bt7RXn3A.js → nl-NL-Ix5Iync5.js} +29 -2
- package/dist/{no-NO-Cca9eM0q.js → no-NO-DNXvLJWB.js} +29 -2
- package/dist/{pl-PL-CVIz0kbw.js → pl-PL-B8kXLpAH.js} +29 -2
- package/dist/{plaintext-C4DxiaSK.js → plaintext-DOua1PdK.js} +2 -2
- package/dist/{pt-PT-DXBtMcCw.js → pt-PT-CVrVM34j.js} +29 -2
- package/dist/{ro-RO-B6yMY4Un.js → ro-RO-Bkrwakp1.js} +29 -2
- package/dist/{sk-SK-CU-2vF-f.js → sk-SK-D2fhxlzK.js} +29 -2
- package/dist/{sl-SI-iSZmm9e_.js → sl-SI-BxHUDGRq.js} +29 -2
- package/dist/style.css +2838 -2873
- package/dist/{sv-SE-Bpawpljv.js → sv-SE-Dj8Q_gMm.js} +29 -2
- package/dist/types/api/documents/useCreateDocument.d.ts +5 -0
- package/dist/types/api/documents/useDeleteDocument.d.ts +5 -0
- package/dist/types/api/documents/useGetDocument.d.ts +5 -0
- package/dist/types/api/documents/useUpdateDocument.d.ts +11 -0
- package/dist/types/api/entityVerifications/useVerifyIdNumber.d.ts +3 -3
- package/dist/types/api/legalEntity/useLegalEntity.d.ts +4 -5
- package/dist/types/api/providersConfiguration/useProviderStatus.d.ts +14 -0
- package/dist/types/api/termsOfService/useAcceptedTermsOfService.d.ts +2 -2
- package/dist/types/api/termsOfService/useTermsOfService.d.ts +1 -0
- package/dist/types/api/transferInstruments/useCreateTransferInstrument.d.ts +2 -0
- package/dist/types/api/transferInstruments/useDeleteTransferInstrument.d.ts +4 -0
- package/dist/types/api/transferInstruments/useGetTransferInstrument.d.ts +12 -0
- package/dist/types/api/transferInstruments/{useTransferInstruments.d.ts → useGetTransferInstruments.d.ts} +5 -1
- package/dist/types/components/BankAccount/forms/PayoutDetails/types.d.ts +1 -1
- package/dist/types/components/BankAccount/tasks/PayoutDetailsDropin/PayoutDetailsDropin.d.ts +1 -1
- package/dist/types/components/Business/forms/rules.d.ts +1 -0
- package/dist/types/components/Business/tasks/BusinessDetailsDropin/BusinessDetailsDropin.d.ts +1 -1
- package/dist/types/components/Business/tasks/BusinessDetailsDropin/types.d.ts +2 -2
- package/dist/types/components/Business/utils/companyUtil.d.ts +4 -0
- package/dist/types/components/Contract/tasks/ServiceAgreementDropin/ServiceAgreementDropin.d.ts +1 -1
- package/dist/types/components/Contract/tasks/ServiceAgreementDropin/types.d.ts +1 -3
- package/dist/types/components/EFP/tasks/SourceOfFundsDropin/SourceOfFundsDropin.d.ts +1 -1
- package/dist/types/components/EFP/tasks/SourceOfFundsDropin/SourceOfFundsUploader/SourceOfFundsUpload.d.ts +1 -2
- package/dist/types/components/EFP/tasks/SourceOfFundsDropin/types.d.ts +2 -6
- package/dist/types/components/EFP/tasks/TaxReportingDropin/types.d.ts +2 -7
- package/dist/types/components/EmbeddedDropins/CreateIndividualComponent/CreateIndividualComponent.d.ts +3 -10
- package/dist/types/components/EmbeddedDropins/ManageTransferInstrumentComponent/ManageTransferInstrumentOverview/ManageTransferInstrumentOverview.d.ts +1 -1
- package/dist/types/components/EmbeddedDropins/ManageTransferInstrumentComponent/ManageTransferInstrumentOverviewItem/ManageTransferInstrumentOverviewItem.d.ts +2 -4
- package/dist/types/components/EmbeddedDropins/ManageTransferInstrumentComponent/ManageTransferInstrumentOverviewItemModal/ManageTransferInstrumentOverviewItemModal.d.ts +1 -1
- package/dist/types/components/EmbeddedDropins/OnboardingDropinComponent/DropinComposer/types.d.ts +2 -16
- package/dist/types/components/Individual/forms/Individual/IdDocumentUpload/types.d.ts +1 -1
- package/dist/types/components/Individual/forms/Individual/PersonalDetails/types.d.ts +2 -1
- package/dist/types/components/Individual/forms/Individual/PersonalDetails/validate.d.ts +3 -2
- package/dist/types/components/Individual/forms/Individual/rules.d.ts +2 -1
- package/dist/types/components/Individual/forms/Individual/types.d.ts +2 -2
- package/dist/types/components/Individual/forms/IndividualOnfido/AdditionalPersonalDetails/AdditionalPersonalDetails.types.d.ts +2 -1
- package/dist/types/components/Individual/forms/IndividualOnfido/AdditionalPersonalDetails/validate.d.ts +3 -2
- package/dist/types/components/Individual/forms/IndividualOnfido/IndividualOnfido.rules.d.ts +2 -1
- package/dist/types/components/Individual/forms/IndividualOnfido/IndividualOnfido.types.d.ts +1 -1
- package/dist/types/components/Individual/tasks/IndividualDropin/IndividualDropin.d.ts +1 -1
- package/dist/types/components/Individual/tasks/IndividualOnfidoDropin/IndividualOnfidoDropin.d.ts +1 -1
- package/dist/types/components/Shared/FormNavigation/FormNavigation.d.ts +1 -1
- package/dist/types/components/Shared/Summary/Summary.d.ts +2 -1
- package/dist/types/components/Shared/fields/IdFieldTypeSelector/TaxIdNumberTypeSelector.d.ts +1 -1
- package/dist/types/components/Shared/fields/IdFieldTypeSelector/countryIdNumberTypes.d.ts +18 -9
- package/dist/types/components/Shared/fields/IdFieldTypeSelector/getDefaultTaxIdNumberType.d.ts +31 -0
- package/dist/types/components/Shared/fields/IdFieldTypeSelector/inferTaxIdNumberType.d.ts +1 -1
- package/dist/types/components/Shared/fields/NumberOfEmployees/types.d.ts +1 -1
- package/dist/types/components/Shared/fields/TaxInformationField/fieldConfig.d.ts +2 -2
- package/dist/types/components/Shared/fields/TaxInformationField/types.d.ts +1 -1
- package/dist/types/components/Shared/forms/Address/utils.d.ts +1 -1
- package/dist/types/components/Shared/forms/FinancialInformation/types.d.ts +1 -1
- package/dist/types/components/Shared/forms/FinancialInformation/validate.d.ts +1 -0
- package/dist/types/components/Trust/tasks/TrustDropin/TrustDropin.d.ts +1 -1
- package/dist/types/components/UnincorporatedPartnership/hooks/useUnincorporatedPartnershipNavigation.d.ts +1 -1
- package/dist/types/components/UnincorporatedPartnership/{UnincorporatedPartnershipMembers → tasks/UnincorporatedPartnershipMembers}/UnincorporatedPartnershipMembersOverview.d.ts +4 -4
- package/dist/types/components/UnincorporatedPartnership/{UnincorporatedPartnershipMembers → tasks/UnincorporatedPartnershipMembers}/types.d.ts +5 -5
- package/dist/types/components/UnincorporatedPartnership/{UnincorporatedPartnershipRoleAndType → tasks/UnincorporatedPartnershipRoleAndType}/UnincorporatedPartnershipRadioGroup.d.ts +1 -1
- package/dist/types/components/UnincorporatedPartnership/{UnincorporatedPartnershipRoleAndType → tasks/UnincorporatedPartnershipRoleAndType}/UnincorporatedPartnershipRoleAndType.d.ts +2 -2
- package/dist/types/components/UnincorporatedPartnership/utils/unincorporatedParnershipUtil.d.ts +2 -1
- package/dist/types/components/UnincorporatedPartnership/utils/unincorporatedPartnershipMembers.d.ts +1 -1
- package/dist/types/components/index.d.ts +1 -18
- package/dist/types/components/ui/molecules/Toast/Toast.d.ts +2 -2
- package/dist/types/components/ui/molecules/Toast/Toast.types.d.ts +8 -7
- package/dist/types/core/models/api/attachment.d.ts +4 -3
- package/dist/types/core/models/api/document.d.ts +4 -29
- package/dist/types/core/models/api/financialReport.d.ts +1 -1
- package/dist/types/core/models/api/get-scenarios.d.ts +2 -1
- package/dist/types/core/models/api/individual.d.ts +2 -0
- package/dist/types/core/models/errors/validation-error.d.ts +5 -7
- package/dist/types/core/models/form-rules.d.ts +2 -0
- package/dist/types/hooks/useComponentApi.d.ts +0 -9
- package/dist/types/stores/globalStore/determineTaskIdentifiers.d.ts +3 -1
- package/dist/types/stores/globalStore/globalStore.d.ts +3 -0
- package/dist/types/stores/globalStore/taskTypes.d.ts +0 -1
- package/dist/types/utils/api/documentUtils.d.ts +2 -2
- package/dist/types/utils/entityStatusUtil.d.ts +1 -1
- package/dist/types/utils/mapping/documentGuidanceMap.d.ts +1 -1
- package/dist/types/utils/roleMetadata.d.ts +1 -1
- package/dist/{yaml-BCEniKV8.js → yaml-DG6kdH_n.js} +2 -2
- package/package.json +3 -1
- package/dist/types/core/models/api/provider-status.d.ts +0 -12
- package/dist/types/core/services/componentApi/create-document.d.ts +0 -3
- package/dist/types/core/services/componentApi/create-transferInstrument.d.ts +0 -3
- package/dist/types/core/services/componentApi/delete-document.d.ts +0 -3
- package/dist/types/core/services/componentApi/get-accepted-service-agreement.d.ts +0 -3
- package/dist/types/core/services/componentApi/get-document.d.ts +0 -3
- package/dist/types/core/services/componentApi/get-provider-status.d.ts +0 -3
- package/dist/types/core/services/componentApi/get-service-agreement.d.ts +0 -3
- package/dist/types/core/services/componentApi/update-document.d.ts +0 -3
|
@@ -0,0 +1,544 @@
|
|
|
1
|
+
;
|
|
2
|
+
{
|
|
3
|
+
try {
|
|
4
|
+
let e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
|
|
5
|
+
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "598f5891-e2d3-4157-a9e8-41608c95562e", e._sentryDebugIdIdentifier = "sentry-dbid-598f5891-e2d3-4157-a9e8-41608c95562e");
|
|
6
|
+
} catch (e) {
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
;
|
|
10
|
+
import { jsx, jsxs, Fragment } from "preact/jsx-runtime";
|
|
11
|
+
import { a7 as useApiContext, ac as useQuery, ad as httpGet, q as Typography, u as useI18nContext, ae as useFormContext, F as Field, af as RadioGroup, ag as getFormProps, h as Icon, ah as isEmpty, r as Svg, ai as sofStyles, B as Button, aj as Card, ak as StructuredList, al as IconButton, H as useQueryClient, n as useAnalyticsContext, x as useLegalEntity, J as useUpdateLegalEntity, a5 as useMultiForm, am as isEmpty$1, an as getRequiredForms, ao as addValidityToForms, g as createLogger, ap as useFormComposer, y as Loader, aq as FormContextProvider, ar as FormWrapper } from "./core-D8ryGpa4.js";
|
|
12
|
+
import { useState, useRef, useEffect, useMemo, useCallback } from "preact/hooks";
|
|
13
|
+
import { signal } from "@preact/signals";
|
|
14
|
+
import cx from "classnames";
|
|
15
|
+
const getTaxClassification = async (legalEntityId, url) => {
|
|
16
|
+
return httpGet({
|
|
17
|
+
loadingContext: url,
|
|
18
|
+
errorLevel: "warn",
|
|
19
|
+
errorMessage: `Failed to fetch Business lines`,
|
|
20
|
+
path: `legalEntities/${legalEntityId}/taxclassification`,
|
|
21
|
+
authentication: "jwt",
|
|
22
|
+
headers: {
|
|
23
|
+
"Content-Type": "application/json"
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
const useTaxClassification = (options) => {
|
|
28
|
+
const { legalEntityId, baseUrl } = useApiContext();
|
|
29
|
+
return useQuery({
|
|
30
|
+
queryKey: ["taxClassification", legalEntityId.value, baseUrl.value],
|
|
31
|
+
queryFn: () => getTaxClassification(legalEntityId.value, baseUrl.value),
|
|
32
|
+
...options
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
const taxClassificationErrorMessage = signal(void 0);
|
|
36
|
+
const setTaxClassificationErrorMessage = (message) => {
|
|
37
|
+
taxClassificationErrorMessage.value = message;
|
|
38
|
+
};
|
|
39
|
+
const clearTaxClassificationErrorMessage = () => {
|
|
40
|
+
taxClassificationErrorMessage.value = void 0;
|
|
41
|
+
};
|
|
42
|
+
const taxReportingDropin = "adyen-kyc-tax-reporting-dropin";
|
|
43
|
+
const textCenter = "adyen-kyc-text-center";
|
|
44
|
+
const radioCaption = "adyen-kyc-radio-caption";
|
|
45
|
+
const taxReportingDropinGettingStarted = "adyen-kyc-tax-reporting-dropin-getting-started";
|
|
46
|
+
const taxReportingDropinFormContainer = "adyen-kyc-tax-reporting-dropin-form-container";
|
|
47
|
+
const subtitle = "adyen-kyc-subtitle";
|
|
48
|
+
const summary = "adyen-kyc-summary";
|
|
49
|
+
const summaryTaxStatusCard = "adyen-kyc-summary-tax-status-card";
|
|
50
|
+
const summaryTaxStatusCardHeader = "adyen-kyc-summary-tax-status-card--header";
|
|
51
|
+
const summaryTaxStatusCardBody = "adyen-kyc-summary-tax-status-card--body";
|
|
52
|
+
const styles$1 = {
|
|
53
|
+
taxReportingDropin,
|
|
54
|
+
textCenter,
|
|
55
|
+
radioCaption,
|
|
56
|
+
taxReportingDropinGettingStarted,
|
|
57
|
+
taxReportingDropinFormContainer,
|
|
58
|
+
subtitle,
|
|
59
|
+
summary,
|
|
60
|
+
summaryTaxStatusCard,
|
|
61
|
+
summaryTaxStatusCardHeader,
|
|
62
|
+
summaryTaxStatusCardBody
|
|
63
|
+
};
|
|
64
|
+
const taxReportingForms = {
|
|
65
|
+
taxClassification: {
|
|
66
|
+
formId: "taxClassification",
|
|
67
|
+
formName: "chooseATaxReportingClassificationOption",
|
|
68
|
+
fields: ["type"]
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
const taxReportingRequiredFields = {
|
|
72
|
+
taxClassification: ["type"]
|
|
73
|
+
};
|
|
74
|
+
const taxReportingOptions = {
|
|
75
|
+
nonFinancialActive: "yourBusinessReceivesTheMajorityOfItsIncomeThroughActiveIncome",
|
|
76
|
+
nonFinancialPassive: "yourBusinessGeneratesMoreThanHalfOfItsRevenueAsPassiveIncome",
|
|
77
|
+
nonFinancialNonReportable: "yourBusinessIsAPublicListedEntity",
|
|
78
|
+
financialNonReportable: "yourBusinessIsAFinancialInstitution"
|
|
79
|
+
};
|
|
80
|
+
const getTaxStatusSummary = (i18n, taxReportingClassification) => {
|
|
81
|
+
var _a;
|
|
82
|
+
const taxStatusDescription = ((_a = taxReportingClassification == null ? void 0 : taxReportingClassification.taxClassification) == null ? void 0 : _a.type) ? taxReportingClassification.taxClassification.type : void 0;
|
|
83
|
+
return taxStatusDescription ? [
|
|
84
|
+
{
|
|
85
|
+
term: i18n.get("status"),
|
|
86
|
+
details: i18n.get(taxStatusDescription)
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
term: i18n.get("description"),
|
|
90
|
+
details: i18n.get(taxReportingOptions[taxStatusDescription])
|
|
91
|
+
}
|
|
92
|
+
] : [];
|
|
93
|
+
};
|
|
94
|
+
const getTaxOptionsRadioItems = (i18n, taxRecommendationData, taxReportingClassification) => {
|
|
95
|
+
const taxOptionsWithoutRecommendation = Object.fromEntries(
|
|
96
|
+
Object.entries(taxReportingOptions).filter(([key]) => key !== (taxRecommendationData == null ? void 0 : taxRecommendationData.type))
|
|
97
|
+
);
|
|
98
|
+
const taxReportingOptionsToShow = (taxRecommendationData == null ? void 0 : taxRecommendationData.type) && !(taxReportingClassification == null ? void 0 : taxReportingClassification.type) ? taxOptionsWithoutRecommendation : taxReportingOptions;
|
|
99
|
+
return Object.entries(taxReportingOptionsToShow).map(([key, value]) => ({
|
|
100
|
+
id: key,
|
|
101
|
+
name: key,
|
|
102
|
+
content: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "secondary", className: styles$1.radioCaption, children: i18n.get(value) })
|
|
103
|
+
}));
|
|
104
|
+
};
|
|
105
|
+
const getRecommendedTaxOptionsRadioItems = (i18n, showRecommendation, taxRecommendationData) => {
|
|
106
|
+
const taxRecommendationType = (taxRecommendationData == null ? void 0 : taxRecommendationData.type) ? taxRecommendationData.type : void 0;
|
|
107
|
+
return showRecommendation && taxRecommendationType ? [
|
|
108
|
+
{
|
|
109
|
+
id: taxRecommendationType,
|
|
110
|
+
name: taxRecommendationType,
|
|
111
|
+
content: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "secondary", className: styles$1.radioCaption, children: i18n.get(taxReportingOptions[taxRecommendationType]) })
|
|
112
|
+
}
|
|
113
|
+
] : [];
|
|
114
|
+
};
|
|
115
|
+
function TaxReportingClassificationForm({
|
|
116
|
+
data,
|
|
117
|
+
taxReportingClassification,
|
|
118
|
+
taxRecommendationData,
|
|
119
|
+
errors
|
|
120
|
+
}) {
|
|
121
|
+
var _a, _b;
|
|
122
|
+
const { i18n } = useI18nContext();
|
|
123
|
+
const { form } = useFormContext();
|
|
124
|
+
const { handleChangeFor } = form;
|
|
125
|
+
const showRecommendation = (taxRecommendationData == null ? void 0 : taxRecommendationData.type) && !(taxReportingClassification == null ? void 0 : taxReportingClassification.type);
|
|
126
|
+
const taxOptionsRadioItems = getTaxOptionsRadioItems(
|
|
127
|
+
i18n,
|
|
128
|
+
taxRecommendationData,
|
|
129
|
+
taxReportingClassification
|
|
130
|
+
);
|
|
131
|
+
const recommendedTaxOptionRadioItems = getRecommendedTaxOptionsRadioItems(
|
|
132
|
+
i18n,
|
|
133
|
+
showRecommendation,
|
|
134
|
+
taxRecommendationData
|
|
135
|
+
);
|
|
136
|
+
const handleFieldChange = (fieldName, mode) => handleChangeFor(fieldName, "taxClassification", mode);
|
|
137
|
+
return /* @__PURE__ */ jsxs("form", { className: "tax-reporting", children: [
|
|
138
|
+
/* @__PURE__ */ jsx(Typography, { variant: "title-l", el: "h2", className: styles$1.textCenter, children: i18n.get("taxStatusSelfCertification") }),
|
|
139
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body", el: "div", className: styles$1.subtitle, children: /* @__PURE__ */ jsx(
|
|
140
|
+
"div",
|
|
141
|
+
{
|
|
142
|
+
dangerouslySetInnerHTML: {
|
|
143
|
+
__html: i18n.get("chooseTheTaxStatusWhichBestRepresentsYourBusiness")
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
) }),
|
|
147
|
+
showRecommendation ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
148
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body-stronger", children: i18n.get("recommendedForYourBusiness") }),
|
|
149
|
+
/* @__PURE__ */ jsx(Field, { name: "type", errorMessage: (_a = errors == null ? void 0 : errors.type) == null ? void 0 : _a.errorMessage, children: (childProps) => /* @__PURE__ */ jsx(
|
|
150
|
+
RadioGroup,
|
|
151
|
+
{
|
|
152
|
+
...childProps,
|
|
153
|
+
name: "type",
|
|
154
|
+
items: recommendedTaxOptionRadioItems,
|
|
155
|
+
value: data == null ? void 0 : data.type,
|
|
156
|
+
onChange: handleFieldChange("type", "input")
|
|
157
|
+
}
|
|
158
|
+
) }),
|
|
159
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body-stronger", children: i18n.get("otherOptions") })
|
|
160
|
+
] }) : null,
|
|
161
|
+
/* @__PURE__ */ jsx(Field, { name: "type", errorMessage: (_b = errors == null ? void 0 : errors.type) == null ? void 0 : _b.errorMessage, children: (childProps) => /* @__PURE__ */ jsx(
|
|
162
|
+
RadioGroup,
|
|
163
|
+
{
|
|
164
|
+
...childProps,
|
|
165
|
+
name: "type",
|
|
166
|
+
items: taxOptionsRadioItems,
|
|
167
|
+
value: data == null ? void 0 : data.type,
|
|
168
|
+
onChange: handleFieldChange("type", "input")
|
|
169
|
+
}
|
|
170
|
+
) })
|
|
171
|
+
] });
|
|
172
|
+
}
|
|
173
|
+
const taxClassificationFormID = taxReportingForms.taxClassification.formId;
|
|
174
|
+
function TaxReporting(props) {
|
|
175
|
+
const { form } = useFormContext();
|
|
176
|
+
const { errors, valid, fieldProblems: fieldValidationErrors } = form;
|
|
177
|
+
const { activeForm: propActiveForm, taxReportingClassification, taxRecommendationData } = props;
|
|
178
|
+
const classificationFormProps = getFormProps(props, taxClassificationFormID);
|
|
179
|
+
const renderActiveForm = (activeForm) => /* @__PURE__ */ jsx(Fragment, { children: (activeForm == null ? void 0 : activeForm.formId) === taxClassificationFormID && /* @__PURE__ */ jsx("div", { className: styles$1.taxReportingDropinFormContainer, children: /* @__PURE__ */ jsx(
|
|
180
|
+
TaxReportingClassificationForm,
|
|
181
|
+
{
|
|
182
|
+
...classificationFormProps,
|
|
183
|
+
taxReportingClassification,
|
|
184
|
+
taxRecommendationData,
|
|
185
|
+
errors: errors == null ? void 0 : errors.taxClassification,
|
|
186
|
+
valid: valid == null ? void 0 : valid.taxClassification,
|
|
187
|
+
fieldValidationErrors: fieldValidationErrors == null ? void 0 : fieldValidationErrors.taxClassification
|
|
188
|
+
}
|
|
189
|
+
) }) });
|
|
190
|
+
return /* @__PURE__ */ jsxs("div", { className: "tax-reporting", children: [
|
|
191
|
+
taxClassificationErrorMessage.value && /* @__PURE__ */ jsxs(
|
|
192
|
+
Typography,
|
|
193
|
+
{
|
|
194
|
+
variant: "caption",
|
|
195
|
+
color: "critical",
|
|
196
|
+
"aria-live": "polite",
|
|
197
|
+
className: "adyen-kyc-u-justify-content-center adyen-kyc-u-display-flex",
|
|
198
|
+
children: [
|
|
199
|
+
/* @__PURE__ */ jsx(Icon, { name: "field-error" }),
|
|
200
|
+
" ",
|
|
201
|
+
/* @__PURE__ */ jsx("div", { children: taxClassificationErrorMessage.value })
|
|
202
|
+
]
|
|
203
|
+
}
|
|
204
|
+
),
|
|
205
|
+
renderActiveForm(propActiveForm)
|
|
206
|
+
] });
|
|
207
|
+
}
|
|
208
|
+
const inTaskStatus = "adyen-kyc-in-task-status";
|
|
209
|
+
const inTaskStatusIndicator = "adyen-kyc-in-task-status-indicator";
|
|
210
|
+
const inTaskStatusIndicatorSuccess = "adyen-kyc-in-task-status-indicator-success";
|
|
211
|
+
const inTaskStatusIndicatorError = "adyen-kyc-in-task-status-indicator-error";
|
|
212
|
+
const inTaskStatusIndicatorWarning = "adyen-kyc-in-task-status-indicator-warning";
|
|
213
|
+
const inTaskStatusLabel = "adyen-kyc-in-task-status-label";
|
|
214
|
+
const styles = {
|
|
215
|
+
inTaskStatus,
|
|
216
|
+
inTaskStatusIndicator,
|
|
217
|
+
inTaskStatusIndicatorSuccess,
|
|
218
|
+
inTaskStatusIndicatorError,
|
|
219
|
+
inTaskStatusIndicatorWarning,
|
|
220
|
+
inTaskStatusLabel
|
|
221
|
+
};
|
|
222
|
+
const getIndicatorLabelAndClassnames = ({
|
|
223
|
+
variant
|
|
224
|
+
}) => {
|
|
225
|
+
if (variant === "success") {
|
|
226
|
+
return {
|
|
227
|
+
indicatorLabel: "taskComplete",
|
|
228
|
+
indicatorClassname: styles.inTaskStatusIndicatorSuccess
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
if (variant === "inProgress") {
|
|
232
|
+
return {
|
|
233
|
+
indicatorLabel: "taskInProgress",
|
|
234
|
+
indicatorClassname: styles.inTaskStatusIndicatorWarning
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
return {
|
|
238
|
+
indicatorLabel: "taskHasErrors",
|
|
239
|
+
indicatorClassname: styles.inTaskStatusIndicatorError
|
|
240
|
+
};
|
|
241
|
+
};
|
|
242
|
+
const TaskStatusIndicator = ({ variant, label }) => {
|
|
243
|
+
const { i18n } = useI18nContext();
|
|
244
|
+
const { indicatorLabel, indicatorClassname } = getIndicatorLabelAndClassnames({ variant });
|
|
245
|
+
const labelToRender = label ?? i18n.get(indicatorLabel);
|
|
246
|
+
return /* @__PURE__ */ jsxs("div", { className: styles.inTaskStatus, children: [
|
|
247
|
+
/* @__PURE__ */ jsx(
|
|
248
|
+
"div",
|
|
249
|
+
{
|
|
250
|
+
"data-testid": "task-status-indicator",
|
|
251
|
+
className: cx(styles.inTaskStatusIndicator, indicatorClassname)
|
|
252
|
+
}
|
|
253
|
+
),
|
|
254
|
+
/* @__PURE__ */ jsx("div", { className: styles.inTaskStatusLabel, children: labelToRender })
|
|
255
|
+
] });
|
|
256
|
+
};
|
|
257
|
+
const TaxReportingGettingStarted = ({
|
|
258
|
+
handleToggleFormVisible,
|
|
259
|
+
handleCancelClick,
|
|
260
|
+
taxReportingClassification
|
|
261
|
+
}) => {
|
|
262
|
+
var _a;
|
|
263
|
+
const { i18n } = useI18nContext();
|
|
264
|
+
const hasTaxReportingClassification = !isEmpty(
|
|
265
|
+
(_a = taxReportingClassification == null ? void 0 : taxReportingClassification.taxClassification) == null ? void 0 : _a.type
|
|
266
|
+
);
|
|
267
|
+
const taxStatusSummary = getTaxStatusSummary(i18n, taxReportingClassification);
|
|
268
|
+
return /* @__PURE__ */ jsxs("div", { className: styles$1.taxReportingDropinGettingStarted, children: [
|
|
269
|
+
!hasTaxReportingClassification && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
270
|
+
/* @__PURE__ */ jsx(
|
|
271
|
+
Svg,
|
|
272
|
+
{
|
|
273
|
+
type: "image",
|
|
274
|
+
testId: "source-of-funds-getting-started-icon",
|
|
275
|
+
name: "tax-reporting-graph",
|
|
276
|
+
className: sofStyles.sourceOfFundsGettingStartedIcon
|
|
277
|
+
}
|
|
278
|
+
),
|
|
279
|
+
/* @__PURE__ */ jsx(
|
|
280
|
+
Typography,
|
|
281
|
+
{
|
|
282
|
+
className: sofStyles.sourceOfFundsGettingStartedHeading,
|
|
283
|
+
el: "h2",
|
|
284
|
+
variant: "title-l",
|
|
285
|
+
children: i18n.get("taxStatusSelfCertification")
|
|
286
|
+
}
|
|
287
|
+
),
|
|
288
|
+
/* @__PURE__ */ jsx(
|
|
289
|
+
Typography,
|
|
290
|
+
{
|
|
291
|
+
className: sofStyles.sourceOfFundsGettingStartedHeading,
|
|
292
|
+
el: "div",
|
|
293
|
+
variant: "body",
|
|
294
|
+
children: i18n.get("toUnderstandIfYourBankAccountDetailsAreReportable")
|
|
295
|
+
}
|
|
296
|
+
),
|
|
297
|
+
/* @__PURE__ */ jsxs("div", { className: sofStyles.sourceOfFundsGettingStartedActions, children: [
|
|
298
|
+
/* @__PURE__ */ jsx(
|
|
299
|
+
Button,
|
|
300
|
+
{
|
|
301
|
+
fullWidth: true,
|
|
302
|
+
testId: "source-of-funds-getting-primary-button",
|
|
303
|
+
onClick: handleToggleFormVisible,
|
|
304
|
+
children: i18n.get("gettingStarted")
|
|
305
|
+
}
|
|
306
|
+
),
|
|
307
|
+
handleCancelClick && /* @__PURE__ */ jsx(
|
|
308
|
+
Button,
|
|
309
|
+
{
|
|
310
|
+
variant: "tertiary",
|
|
311
|
+
fullWidth: true,
|
|
312
|
+
testId: "source-of-funds-getting-cancel-button",
|
|
313
|
+
onClick: handleCancelClick,
|
|
314
|
+
children: i18n.get("backToTaskList")
|
|
315
|
+
}
|
|
316
|
+
)
|
|
317
|
+
] })
|
|
318
|
+
] }),
|
|
319
|
+
hasTaxReportingClassification && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
320
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
321
|
+
/* @__PURE__ */ jsx(TaskStatusIndicator, { variant: "success" }),
|
|
322
|
+
/* @__PURE__ */ jsx(Typography, { className: styles$1.textCenter, el: "h2", variant: "title-l", children: i18n.get("selfCertifiedTaxStatus") }),
|
|
323
|
+
/* @__PURE__ */ jsx(Typography, { className: styles$1.subtitle, el: "div", variant: "body", children: i18n.get("noFurtherActionOrRecertificationIsNeeded") }),
|
|
324
|
+
/* @__PURE__ */ jsx("div", { className: styles$1.summary, children: /* @__PURE__ */ jsx(
|
|
325
|
+
Card,
|
|
326
|
+
{
|
|
327
|
+
className: styles$1.summaryTaxStatusCard,
|
|
328
|
+
headerClassName: styles$1.summaryTaxStatusCardHeader,
|
|
329
|
+
bodyClassName: styles$1.summaryTaxStatusCardBody,
|
|
330
|
+
title: i18n.get("taxStatus"),
|
|
331
|
+
stateful: true,
|
|
332
|
+
headerButton: /* @__PURE__ */ jsx(
|
|
333
|
+
IconButton,
|
|
334
|
+
{
|
|
335
|
+
ariaLabel: "edit",
|
|
336
|
+
icon: "edit",
|
|
337
|
+
onClick: handleToggleFormVisible,
|
|
338
|
+
variant: "tertiary"
|
|
339
|
+
}
|
|
340
|
+
),
|
|
341
|
+
children: /* @__PURE__ */ jsx(StructuredList, { items: taxStatusSummary })
|
|
342
|
+
}
|
|
343
|
+
) })
|
|
344
|
+
] }),
|
|
345
|
+
handleCancelClick && /* @__PURE__ */ jsx(
|
|
346
|
+
Button,
|
|
347
|
+
{
|
|
348
|
+
variant: "secondary",
|
|
349
|
+
testId: "source-of-funds-getting-return-button",
|
|
350
|
+
onClick: handleCancelClick,
|
|
351
|
+
children: i18n.get("backToTaskList")
|
|
352
|
+
}
|
|
353
|
+
)
|
|
354
|
+
] })
|
|
355
|
+
] });
|
|
356
|
+
};
|
|
357
|
+
const logger = createLogger();
|
|
358
|
+
function TaxReportingDropin({ problems, handleHomeClick }) {
|
|
359
|
+
var _a, _b, _c, _d, _e;
|
|
360
|
+
const [loadingStatus, setLoadingStatus] = useState("success");
|
|
361
|
+
const [formVisible, setFormVisible] = useState(false);
|
|
362
|
+
useRef(null);
|
|
363
|
+
const queryClient = useQueryClient();
|
|
364
|
+
const { i18n } = useI18nContext();
|
|
365
|
+
const { data: taxRecommendationData, isLoading: isLoadingTaxRecommendationData } = useTaxClassification();
|
|
366
|
+
const userEvents = useAnalyticsContext();
|
|
367
|
+
const { data: legalEntityData, isLoading } = useLegalEntity();
|
|
368
|
+
const { mutate: updateLegalEntityMutation } = useUpdateLegalEntity({
|
|
369
|
+
onSuccess: async () => {
|
|
370
|
+
await queryClient.invalidateQueries({
|
|
371
|
+
queryKey: ["legalEntity"],
|
|
372
|
+
refetchType: "all"
|
|
373
|
+
});
|
|
374
|
+
await queryClient.invalidateQueries({
|
|
375
|
+
queryKey: ["taxClassification"],
|
|
376
|
+
refetchType: "all"
|
|
377
|
+
});
|
|
378
|
+
await queryClient.invalidateQueries({
|
|
379
|
+
queryKey: ["taskStatus"],
|
|
380
|
+
refetchType: "all"
|
|
381
|
+
});
|
|
382
|
+
handleHomeClick == null ? void 0 : handleHomeClick();
|
|
383
|
+
setFormVisible(false);
|
|
384
|
+
gotoFormByFormIndex(0);
|
|
385
|
+
setTaxClassificationErrorMessage("");
|
|
386
|
+
setLoadingStatus("success");
|
|
387
|
+
},
|
|
388
|
+
onError: (e) => {
|
|
389
|
+
setTaxClassificationErrorMessage((e == null ? void 0 : e.message) || i18n.get("errorUpdatingTaxClassification"));
|
|
390
|
+
setLoadingStatus("success");
|
|
391
|
+
}
|
|
392
|
+
});
|
|
393
|
+
useEffect(() => {
|
|
394
|
+
clearTaxClassificationErrorMessage();
|
|
395
|
+
}, []);
|
|
396
|
+
useEffect(() => {
|
|
397
|
+
userEvents.addTaskEvent("Landed on page", {
|
|
398
|
+
actionType: "start"
|
|
399
|
+
});
|
|
400
|
+
}, [userEvents]);
|
|
401
|
+
const taxReportingClassification = useMemo(
|
|
402
|
+
() => {
|
|
403
|
+
var _a2, _b2;
|
|
404
|
+
return {
|
|
405
|
+
taxClassification: {
|
|
406
|
+
type: (_b2 = (_a2 = legalEntityData == null ? void 0 : legalEntityData.organization) == null ? void 0 : _a2.taxReportingClassification) == null ? void 0 : _b2.type
|
|
407
|
+
}
|
|
408
|
+
};
|
|
409
|
+
},
|
|
410
|
+
[(_b = (_a = legalEntityData == null ? void 0 : legalEntityData.organization) == null ? void 0 : _a.taxReportingClassification) == null ? void 0 : _b.type]
|
|
411
|
+
);
|
|
412
|
+
const defaultData = useMemo(
|
|
413
|
+
() => ({
|
|
414
|
+
...taxReportingClassification
|
|
415
|
+
}),
|
|
416
|
+
[taxReportingClassification]
|
|
417
|
+
);
|
|
418
|
+
const form = useMultiForm({
|
|
419
|
+
requiredFields: taxReportingRequiredFields,
|
|
420
|
+
defaultData
|
|
421
|
+
});
|
|
422
|
+
const { data = taxReportingClassification, setData, triggerValidation } = form;
|
|
423
|
+
const canSubmitForm = useMemo(
|
|
424
|
+
() => {
|
|
425
|
+
var _a2;
|
|
426
|
+
return !isEmpty$1((_a2 = data == null ? void 0 : data.taxClassification) == null ? void 0 : _a2.type);
|
|
427
|
+
},
|
|
428
|
+
[(_c = data == null ? void 0 : data.taxClassification) == null ? void 0 : _c.type]
|
|
429
|
+
);
|
|
430
|
+
useEffect(() => {
|
|
431
|
+
var _a2, _b2, _c2;
|
|
432
|
+
if (!((_a2 = data == null ? void 0 : data.taxClassification) == null ? void 0 : _a2.type) && (((_b2 = taxReportingClassification == null ? void 0 : taxReportingClassification.taxClassification) == null ? void 0 : _b2.type) || (taxRecommendationData == null ? void 0 : taxRecommendationData.type))) {
|
|
433
|
+
setData(
|
|
434
|
+
"type",
|
|
435
|
+
((_c2 = taxReportingClassification == null ? void 0 : taxReportingClassification.taxClassification) == null ? void 0 : _c2.type) ?? (taxRecommendationData == null ? void 0 : taxRecommendationData.type),
|
|
436
|
+
"taxClassification"
|
|
437
|
+
);
|
|
438
|
+
(async () => {
|
|
439
|
+
await triggerValidation("taxClassification");
|
|
440
|
+
})().catch(() => console.error("Error triggering validation"));
|
|
441
|
+
}
|
|
442
|
+
}, [
|
|
443
|
+
(_d = data == null ? void 0 : data.taxClassification) == null ? void 0 : _d.type,
|
|
444
|
+
taxRecommendationData == null ? void 0 : taxRecommendationData.type,
|
|
445
|
+
(_e = taxReportingClassification == null ? void 0 : taxReportingClassification.taxClassification) == null ? void 0 : _e.type,
|
|
446
|
+
setData,
|
|
447
|
+
triggerValidation
|
|
448
|
+
]);
|
|
449
|
+
const forms = useMemo(() => {
|
|
450
|
+
const requiredForms = getRequiredForms(
|
|
451
|
+
taxReportingForms,
|
|
452
|
+
taxReportingRequiredFields,
|
|
453
|
+
void 0
|
|
454
|
+
);
|
|
455
|
+
const requiredFormsWithoutSummary = requiredForms.filter((form2) => form2.formId !== "summary");
|
|
456
|
+
return addValidityToForms(requiredFormsWithoutSummary, form.isValid, problems);
|
|
457
|
+
}, [form.isValid, problems]);
|
|
458
|
+
const handleSubmit = useCallback(async () => {
|
|
459
|
+
var _a2;
|
|
460
|
+
if (!legalEntityData) {
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
463
|
+
setLoadingStatus("loading");
|
|
464
|
+
const taxReportingPayload = {
|
|
465
|
+
businessType: taxRecommendationData == null ? void 0 : taxRecommendationData.businessType,
|
|
466
|
+
financialInstitutionNumber: taxRecommendationData == null ? void 0 : taxRecommendationData.financialInstitutionNumber,
|
|
467
|
+
mainSourceOfIncome: taxRecommendationData == null ? void 0 : taxRecommendationData.mainSourceOfIncome,
|
|
468
|
+
type: (_a2 = data == null ? void 0 : data.taxClassification) == null ? void 0 : _a2.type
|
|
469
|
+
};
|
|
470
|
+
const legalEntityPayload = {
|
|
471
|
+
...legalEntityData,
|
|
472
|
+
// TODO: fix
|
|
473
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
474
|
+
// @ts-ignore use FE validation, not openApi contracts for now
|
|
475
|
+
organization: {
|
|
476
|
+
...legalEntityData.organization,
|
|
477
|
+
taxReportingClassification: taxReportingPayload
|
|
478
|
+
}
|
|
479
|
+
};
|
|
480
|
+
try {
|
|
481
|
+
updateLegalEntityMutation(legalEntityPayload);
|
|
482
|
+
} catch (e) {
|
|
483
|
+
logger.log("Error updating source of funds", e);
|
|
484
|
+
setLoadingStatus("success");
|
|
485
|
+
}
|
|
486
|
+
}, [data, taxRecommendationData, legalEntityData, updateLegalEntityMutation]);
|
|
487
|
+
const handleToggleFormVisible = () => {
|
|
488
|
+
setFormVisible(!formVisible);
|
|
489
|
+
};
|
|
490
|
+
const {
|
|
491
|
+
handleNextClick,
|
|
492
|
+
activeForm,
|
|
493
|
+
setShouldValidate,
|
|
494
|
+
gotoFormByFormIndex,
|
|
495
|
+
steps
|
|
496
|
+
} = useFormComposer({
|
|
497
|
+
problems,
|
|
498
|
+
forms,
|
|
499
|
+
onSubmit: handleSubmit
|
|
500
|
+
});
|
|
501
|
+
return /* @__PURE__ */ jsx("div", { className: styles$1.taxReportingDropin, children: isLoading || isLoadingTaxRecommendationData ? /* @__PURE__ */ jsx(Loader, { size: "medium" }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
502
|
+
!formVisible && /* @__PURE__ */ jsx(
|
|
503
|
+
TaxReportingGettingStarted,
|
|
504
|
+
{
|
|
505
|
+
handleCancelClick: handleHomeClick,
|
|
506
|
+
handleToggleFormVisible,
|
|
507
|
+
taxReportingClassification,
|
|
508
|
+
problems: legalEntityData == null ? void 0 : legalEntityData.problems
|
|
509
|
+
}
|
|
510
|
+
),
|
|
511
|
+
formVisible && /* @__PURE__ */ jsx(FormContextProvider, { form, children: /* @__PURE__ */ jsx(
|
|
512
|
+
FormWrapper,
|
|
513
|
+
{
|
|
514
|
+
taskName: "taxReportingClassification",
|
|
515
|
+
gotoFormByFormIndex,
|
|
516
|
+
hideSidebar: true,
|
|
517
|
+
loadingStatus,
|
|
518
|
+
forms,
|
|
519
|
+
activeForm,
|
|
520
|
+
validateForm: () => setShouldValidate(true),
|
|
521
|
+
onSubmit: handleSubmit,
|
|
522
|
+
problems,
|
|
523
|
+
canSubmit: canSubmitForm,
|
|
524
|
+
handleNextClick,
|
|
525
|
+
showBackButton: true,
|
|
526
|
+
handleBackClick: handleToggleFormVisible,
|
|
527
|
+
handleHomeClick,
|
|
528
|
+
steps,
|
|
529
|
+
children: /* @__PURE__ */ jsx(
|
|
530
|
+
TaxReporting,
|
|
531
|
+
{
|
|
532
|
+
taxReportingClassification: taxReportingClassification == null ? void 0 : taxReportingClassification.taxClassification,
|
|
533
|
+
taxRecommendationData,
|
|
534
|
+
activeForm,
|
|
535
|
+
data
|
|
536
|
+
}
|
|
537
|
+
)
|
|
538
|
+
}
|
|
539
|
+
) })
|
|
540
|
+
] }) });
|
|
541
|
+
}
|
|
542
|
+
export {
|
|
543
|
+
TaxReportingDropin
|
|
544
|
+
};
|