@adyen/kyc-components 3.63.2 → 3.64.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-Dy_VeWhw.js +14 -0
- package/dist/{OKF6E45R-DJQ6WuJ0.js → CXEL7IU7-DXEnuiiT.js} +2 -2
- package/dist/CustomerSupport-CasBYndK.js +120 -0
- package/dist/{DebugModal-fAWDVtvl.js → DebugModal-IlmV_vyp.js} +6 -6
- package/dist/DecisionMakers-DXIKUq2C.js +220 -0
- package/dist/{WXAWMS3D-C0qahN6N.js → HASRA6WW-DysnKis4.js} +615 -514
- package/dist/{CPIOZS5X-BAPAsUnD.js → I3HPI4QX-CJrdsThE.js} +2 -2
- package/dist/{Introduction-imwEgL7W.js → Introduction-CW1frGWu.js} +1 -5
- package/dist/Review-DtIANMrI.js +73 -0
- package/dist/SingpassSelection-CnBicSOw.js +116 -0
- package/dist/adyen-kyc-components.js +1 -1
- package/dist/adyenConfig.js +1 -1
- package/dist/{core-CtLEZ35m.js → core-Coy1ocfj.js} +30623 -33323
- package/dist/{css-Byr67uS8.js → css-Dt3Xtm1p.js} +1 -1
- package/dist/{json-BOZMhevD.js → json-66NbIsmg.js} +1 -1
- package/dist/{plaintext-jm6guQOB.js → plaintext-ClS07N_Y.js} +1 -1
- package/dist/style.css +479 -467
- package/dist/types/api/companyDataSet/useClearCompanyData.d.ts +2 -0
- package/dist/types/api/createLegalEntity/useCreateLegalEntity.d.ts +17 -0
- package/dist/types/api/legalEntity/useLegalEntity.d.ts +17 -5
- package/dist/types/api/pciTemplate/usePciQuestionnaireList.d.ts +4 -0
- package/dist/types/api/pciTemplate/usePciStatus.d.ts +7 -2
- package/dist/types/api/termsOfService/useAcceptedTermsOfService.d.ts +12 -0
- package/dist/types/api/termsOfService/useTermsOfService.d.ts +13 -0
- package/dist/types/api/transferInstruments/useDeleteTransferInstrument.d.ts +2 -0
- package/dist/types/api/types.d.ts +8 -3
- package/dist/types/api/validation/useValidateAccountIdentification.d.ts +6 -0
- package/dist/types/components/BankAccount/mapping/payoutKeyMappings.d.ts +1 -1
- package/dist/types/components/Business/forms/BusinessDetails/forms.d.ts +44 -0
- package/dist/types/components/Business/forms/{Company/rules.d.ts → rules.d.ts} +4 -6
- package/dist/types/components/Business/hooks/useBusinessData/types.d.ts +1 -1
- package/dist/types/components/Business/hooks/useBusinessData/useBusinessData.d.ts +1 -1
- package/dist/types/components/Business/mapping/businessDetails/solePropBusinessDetailsKeyMappings.d.ts +2 -1
- package/dist/types/components/Business/tasks/BusinessDetailsDropin/BusinessDetailsDropin.d.ts +1 -1
- package/dist/types/components/Business/tasks/BusinessDetailsDropin/businessDetailsFormConfig.d.ts +1 -1
- package/dist/types/components/Business/tasks/BusinessDetailsDropin/types.d.ts +0 -1
- package/dist/types/components/Business/utils/companyTypeMetadata.d.ts +1 -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/Contract/tasks/ServiceAgreementDropin/useServiceAgreement.d.ts +1 -6
- package/dist/types/components/EmbeddedDropins/OnboardingDropinComponent/DropinComposer/types.d.ts +2 -13
- package/dist/types/components/Individual/forms/Individual/types.d.ts +1 -1
- package/dist/types/components/Individual/tasks/DecisionMakers/DecisionMakers.d.ts +6 -1
- package/dist/types/components/Individual/tasks/DecisionMakers/types.d.ts +1 -4
- 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/Introduction/types.d.ts +0 -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/tasks/TaskList/PayoutAccountTaskListItem.d.ts +1 -2
- package/dist/types/components/Shared/tasks/TaskList/TaskList.d.ts +1 -1
- package/dist/types/components/Shared/tasks/TaskList/types.d.ts +0 -1
- package/dist/types/components/UnincorporatedPartnership/UnincorporatedPartnershipRoleAndType/UnincorporatedPartnershipRadioGroup.d.ts +8 -0
- package/dist/types/components/UnincorporatedPartnership/hooks/useUnincorporatedPartnershipNavigation.d.ts +1 -1
- package/dist/types/components/index.d.ts +0 -4
- package/dist/types/components/ui/atoms/Select/Select.d.ts +1 -1
- package/dist/types/components/ui/atoms/Select/Select.types.d.ts +0 -2
- package/dist/types/components/ui/atoms/Select/useSelectFocus.d.ts +21 -0
- package/dist/types/components/ui/atoms/SelectButton/SelectButton.d.ts +2 -1
- package/dist/types/components/ui/atoms/SelectButton/SelectButton.types.d.ts +6 -6
- package/dist/types/components/ui/atoms/SelectList/SelectList.d.ts +2 -1
- package/dist/types/components/ui/atoms/SelectList/SelectList.types.d.ts +4 -3
- package/dist/types/components/ui/atoms/SelectListItem/SelectListItem.d.ts +1 -1
- package/dist/types/components/ui/atoms/SelectListItem/SelectListItem.types.d.ts +1 -0
- package/dist/types/context/ConfigurationApiContext/ConfigurationApiContext.d.ts +1 -3
- package/dist/types/context/ExperimentContext/types.d.ts +84 -4
- package/dist/types/context/StateContext/types.d.ts +2 -4
- package/dist/types/core/constants.d.ts +3 -0
- package/dist/types/core/models/api/contracts.d.ts +0 -1
- package/dist/types/core/models/api/legal-entity.d.ts +4 -5
- package/dist/types/core/models/api/organization.d.ts +2 -1
- package/dist/types/hooks/useComponentApi.d.ts +0 -4
- package/dist/types/stores/globalStore/globalStore.d.ts +4 -1
- package/dist/types/stores/globalStore/taskTypes.d.ts +1 -1
- package/dist/types/utils/api/processCapabilitites.d.ts +1 -2
- package/dist/types/utils/entityStatusUtil.d.ts +1 -1
- package/dist/types/utils/getFieldsWithExistingData.d.ts +1 -3
- package/dist/types/utils/signals/useWatchingSignal.d.ts +9 -0
- package/dist/types/utils/simulateTextChangeFromKeyboardEvent.d.ts +11 -0
- package/dist/{yaml-BZYqXoHq.js → yaml-B7DXCyLe.js} +1 -1
- package/package.json +17 -23
- package/dist/types/components/Business/forms/Company/Company.d.ts +0 -54
- package/dist/types/components/Business/forms/Company/types.d.ts +0 -30
- package/dist/types/components/Business/forms/CompanyType/CompanyType.d.ts +0 -4
- package/dist/types/components/Business/forms/CompanyType/types.d.ts +0 -9
- package/dist/types/components/Business/forms/CompanyType/validate.d.ts +0 -3
- package/dist/types/components/Business/mapping/companyKeyMappings.d.ts +0 -7
- package/dist/types/components/Business/mapping/mapApiDocumentToCompanyDocuments.d.ts +0 -2
- package/dist/types/components/Business/mapping/mapCompanyDocumentToApiDocument.d.ts +0 -3
- package/dist/types/components/Business/mapping/mapCompanyToLegalEntity.d.ts +0 -4
- package/dist/types/components/Business/mapping/mapLegalEntityToCompany.d.ts +0 -4
- package/dist/types/components/Business/tasks/CompanyDropin/CompanyDropin.d.ts +0 -2
- package/dist/types/components/Business/tasks/CompanyDropin/companyFormConfig.d.ts +0 -7
- package/dist/types/components/Business/tasks/CompanyDropin/mandatoryFields.d.ts +0 -3
- package/dist/types/components/Business/tasks/CompanyDropin/types.d.ts +0 -10
- package/dist/types/components/Shared/fields/TradingNameField/TradingNameField.d.ts +0 -3
- package/dist/types/components/Shared/fields/TradingNameField/fieldConfig.d.ts +0 -3
- package/dist/types/components/Shared/fields/TradingNameField/types.d.ts +0 -8
- package/dist/types/components/Shared/forms/CompanyNameAndCountry/CompanyNameAndCountry.d.ts +0 -5
- package/dist/types/components/Shared/forms/CompanyNameAndCountry/validate.d.ts +0 -3
- package/dist/types/components/Shared/forms/CompanyRegistrationDetails/CompanyRegistrationDetails.d.ts +0 -4
- package/dist/types/components/Shared/forms/CompanyRegistrationDetails/types.d.ts +0 -19
- package/dist/types/components/SoleProprietorship/forms/SoleProp/SoleProp.d.ts +0 -33
- package/dist/types/components/SoleProprietorship/forms/SoleProp/types.d.ts +0 -33
- package/dist/types/components/SoleProprietorship/mapping/mapApiDocumentToSolePropDocuments.d.ts +0 -2
- package/dist/types/components/SoleProprietorship/mapping/mapLegalEntityToSoleProp.d.ts +0 -4
- package/dist/types/components/SoleProprietorship/mapping/mapSolePropDocumentToApiDocument.d.ts +0 -3
- package/dist/types/components/SoleProprietorship/mapping/mapSolePropToLegalEntity.d.ts +0 -4
- package/dist/types/components/SoleProprietorship/mapping/solePropKeyMappings.d.ts +0 -7
- package/dist/types/components/SoleProprietorship/tasks/SolePropDropin/SolePropDropin.d.ts +0 -2
- package/dist/types/components/SoleProprietorship/tasks/SolePropDropin/mandatoryFields.d.ts +0 -3
- package/dist/types/components/SoleProprietorship/tasks/SolePropDropin/solePropFormConfig.d.ts +0 -5
- package/dist/types/context/StateContext/StateContextWatcher.d.ts +0 -2
- package/dist/types/core/services/componentApi/clear-company-data.d.ts +0 -2
- package/dist/types/core/services/componentApi/delete-transferInstrument.d.ts +0 -3
- package/dist/types/core/services/componentApi/validate-account-identification.d.ts +0 -4
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsxs, jsx } from "preact/jsx-runtime";
|
|
2
|
+
import { b as useI18nContext, A as AlertIcon, h as FormHeader, D as DropinLayout } from "./core-Coy1ocfj.js";
|
|
3
|
+
function AccountSetupRejected() {
|
|
4
|
+
const { i18n } = useI18nContext();
|
|
5
|
+
const content = /* @__PURE__ */ jsxs("div", { children: [
|
|
6
|
+
/* @__PURE__ */ jsx(AlertIcon, { variant: "error" }),
|
|
7
|
+
/* @__PURE__ */ jsx(FormHeader, { heading: i18n.get("cantSetUpAcccount") }),
|
|
8
|
+
/* @__PURE__ */ jsx("span", { children: i18n.get("accountCantBeSetUp") })
|
|
9
|
+
] });
|
|
10
|
+
return /* @__PURE__ */ jsx(DropinLayout, { content });
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
AccountSetupRejected
|
|
14
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as createLocalStorage, T as THEME_PREFERENCE, P as PiPProvider, a as ThemeContext, b as ParentPanel, C as ContentView, Q as QueryDevtoolsContext } from "./
|
|
2
|
-
import {
|
|
1
|
+
import { c as createLocalStorage, T as THEME_PREFERENCE, P as PiPProvider, a as ThemeContext, b as ParentPanel, C as ContentView, Q as QueryDevtoolsContext } from "./HASRA6WW-DysnKis4.js";
|
|
2
|
+
import { ac as getPreferredColorScheme, ad as createMemo, ae as createComponent } from "./core-Coy1ocfj.js";
|
|
3
3
|
var DevtoolsPanelComponent = (props) => {
|
|
4
4
|
const [localStore, setLocalStore] = createLocalStorage({
|
|
5
5
|
prefix: "TanstackQueryDevtools"
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { jsxs, jsx } from "preact/jsx-runtime";
|
|
2
|
+
import { b as useI18nContext, c as useAnalyticsContext, l as useToastContext, H as useConfigurationApi, i as useLegalEntity, n as useUpdateLegalEntity, m as useQueryClient, I as resolveFieldMetadata, J as contactDetailsValidationRules, K as defaultFieldMetadata, M as fieldConfig, N as getAsyncPhoneValidationRules, O as useMultiForm, h as FormHeader, P as ContactDetails, G as ActionBar, Q as createLogger } from "./core-Coy1ocfj.js";
|
|
3
|
+
import { useCallback, useMemo, useEffect } from "preact/hooks";
|
|
4
|
+
const mapCustomerSupportSchemaToCustomerSupportType = (customerSupport) => {
|
|
5
|
+
var _a, _b, _c;
|
|
6
|
+
return {
|
|
7
|
+
email: ((_a = customerSupport == null ? void 0 : customerSupport.customerSupport) == null ? void 0 : _a.email) || "",
|
|
8
|
+
phone: {
|
|
9
|
+
number: ((_c = (_b = customerSupport == null ? void 0 : customerSupport.customerSupport) == null ? void 0 : _b.phoneNumber) == null ? void 0 : _c.number) || "",
|
|
10
|
+
type: "mobile"
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
const logger = createLogger();
|
|
15
|
+
function CustomerSupport({ country, onSubmit }) {
|
|
16
|
+
var _a, _b, _c, _d;
|
|
17
|
+
const { i18n } = useI18nContext();
|
|
18
|
+
const userEvents = useAnalyticsContext();
|
|
19
|
+
const { showToast } = useToastContext();
|
|
20
|
+
const { validatePhoneNumber } = useConfigurationApi();
|
|
21
|
+
const { data: legalEntity } = useLegalEntity();
|
|
22
|
+
const { mutateAsync: updateLegalEntity } = useUpdateLegalEntity();
|
|
23
|
+
const queryClient = useQueryClient();
|
|
24
|
+
const requiredFields = {
|
|
25
|
+
customerSupport: ["email", "phoneNumber"]
|
|
26
|
+
};
|
|
27
|
+
const validators = useCallback(
|
|
28
|
+
(data2) => {
|
|
29
|
+
var _a2, _b2, _c2;
|
|
30
|
+
return {
|
|
31
|
+
customerSupport: {
|
|
32
|
+
...contactDetailsValidationRules,
|
|
33
|
+
phoneNumber: (_c2 = resolveFieldMetadata(
|
|
34
|
+
fieldConfig[((_b2 = (_a2 = data2 == null ? void 0 : data2.customerSupport) == null ? void 0 : _a2.phoneNumber) == null ? void 0 : _b2.phoneCountryCode) ?? country],
|
|
35
|
+
{},
|
|
36
|
+
defaultFieldMetadata
|
|
37
|
+
)) == null ? void 0 : _c2.validators
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
[country]
|
|
42
|
+
);
|
|
43
|
+
const asyncValidators = useMemo(
|
|
44
|
+
() => ({
|
|
45
|
+
customerSupport: {
|
|
46
|
+
phoneNumber: getAsyncPhoneValidationRules(validatePhoneNumber).phoneNumber
|
|
47
|
+
}
|
|
48
|
+
}),
|
|
49
|
+
[validatePhoneNumber]
|
|
50
|
+
);
|
|
51
|
+
const legalEntityType = legalEntity == null ? void 0 : legalEntity.type;
|
|
52
|
+
const defaultCustomerSupportData = {
|
|
53
|
+
customerSupport: {
|
|
54
|
+
phoneNumber: (_b = (_a = legalEntity == null ? void 0 : legalEntity[legalEntityType]) == null ? void 0 : _a.support) == null ? void 0 : _b.phone,
|
|
55
|
+
email: (_d = (_c = legalEntity == null ? void 0 : legalEntity[legalEntityType]) == null ? void 0 : _c.support) == null ? void 0 : _d.email
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const { data, handleChangeFor, valid, errors, isValid, triggerValidation } = useMultiForm({
|
|
59
|
+
requiredFields,
|
|
60
|
+
defaultData: defaultCustomerSupportData,
|
|
61
|
+
rules: validators,
|
|
62
|
+
asyncRules: asyncValidators
|
|
63
|
+
});
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
userEvents.addTaskEvent("Landed on page", {
|
|
66
|
+
actionType: "start"
|
|
67
|
+
});
|
|
68
|
+
}, [userEvents]);
|
|
69
|
+
const submitForm = async () => {
|
|
70
|
+
const isAsyncValidationValid = await triggerValidation("customerSupport");
|
|
71
|
+
if (!(isValid == null ? void 0 : isValid.customerSupport) || !isAsyncValidationValid) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const support = mapCustomerSupportSchemaToCustomerSupportType(data);
|
|
75
|
+
const payload = {
|
|
76
|
+
[legalEntityType]: { support }
|
|
77
|
+
};
|
|
78
|
+
try {
|
|
79
|
+
const patchLegalEntity = {
|
|
80
|
+
...payload,
|
|
81
|
+
id: legalEntity == null ? void 0 : legalEntity.id
|
|
82
|
+
};
|
|
83
|
+
await updateLegalEntity(patchLegalEntity);
|
|
84
|
+
queryClient.invalidateQueries({ queryKey: ["legalEntity", legalEntity == null ? void 0 : legalEntity.id] });
|
|
85
|
+
onSubmit();
|
|
86
|
+
userEvents.addTaskEvent("Success", {
|
|
87
|
+
actionType: "submit"
|
|
88
|
+
});
|
|
89
|
+
} catch {
|
|
90
|
+
const label = i18n.get("failedToUpdateDetails");
|
|
91
|
+
logger.error(label, payload);
|
|
92
|
+
showToast({ label, type: "error" });
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
const handleFieldChange = (fieldName, mode) => handleChangeFor(fieldName, "customerSupport", mode);
|
|
96
|
+
return /* @__PURE__ */ jsxs("form", { className: "adyen-kyc-individual__customer-support", "aria-describedby": "ariaErrorField", children: [
|
|
97
|
+
/* @__PURE__ */ jsx(
|
|
98
|
+
FormHeader,
|
|
99
|
+
{
|
|
100
|
+
heading: i18n.get("customerSupport"),
|
|
101
|
+
description: i18n.get("howYourCustomersCanReachYou")
|
|
102
|
+
}
|
|
103
|
+
),
|
|
104
|
+
/* @__PURE__ */ jsx(
|
|
105
|
+
ContactDetails,
|
|
106
|
+
{
|
|
107
|
+
data: data.customerSupport,
|
|
108
|
+
errors: errors.customerSupport,
|
|
109
|
+
valid: valid.customerSupport,
|
|
110
|
+
country,
|
|
111
|
+
requiredFields: requiredFields == null ? void 0 : requiredFields.customerSupport,
|
|
112
|
+
handleFieldChange
|
|
113
|
+
}
|
|
114
|
+
),
|
|
115
|
+
/* @__PURE__ */ jsx(ActionBar, { onNext: submitForm, nextButtonLabel: i18n.get("submit") })
|
|
116
|
+
] });
|
|
117
|
+
}
|
|
118
|
+
export {
|
|
119
|
+
CustomerSupport
|
|
120
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "preact/jsx-runtime";
|
|
2
2
|
import { useMemo, useState } from "preact/hooks";
|
|
3
|
-
import { B as Button,
|
|
3
|
+
import { B as Button, Z as Tag, _ as entriesOf, $ as InputText, b as useI18nContext, a0 as splitTaskIdentifier, a1 as TaskItemStatus, a2 as useExperimentsContext, a3 as useSettingsContext, a4 as useGlobalStore, a5 as listToRecord, a6 as valuesOf, a7 as useTaskStatuses, a8 as Modal, Q as createLogger, a9 as Icon, aa as SettingNames, ab as ExperimentNames } from "./core-Coy1ocfj.js";
|
|
4
4
|
const tabs = "adyen-kyc-tabs";
|
|
5
5
|
const styles$1 = {
|
|
6
6
|
tabs
|
|
@@ -135,10 +135,10 @@ const transformModule = (highlights, codeNode, scope) => {
|
|
|
135
135
|
};
|
|
136
136
|
const supportedModules = ["plaintext", "json", "yaml", "css"];
|
|
137
137
|
const moduleMap = {
|
|
138
|
-
plaintext: () => import("./plaintext-
|
|
139
|
-
json: () => import("./json-
|
|
140
|
-
yaml: () => import("./yaml-
|
|
141
|
-
css: () => import("./css-
|
|
138
|
+
plaintext: () => import("./plaintext-ClS07N_Y.js"),
|
|
139
|
+
json: () => import("./json-66NbIsmg.js"),
|
|
140
|
+
yaml: () => import("./yaml-B7DXCyLe.js"),
|
|
141
|
+
css: () => import("./css-Dt3Xtm1p.js")
|
|
142
142
|
};
|
|
143
143
|
const getModule = async (name) => {
|
|
144
144
|
if (!supportedModules.includes(name)) {
|
|
@@ -429,7 +429,7 @@ const DebugModal = ({ onExit }) => {
|
|
|
429
429
|
const [tab, setTab] = useState("metadata");
|
|
430
430
|
const rootLegalEntity = useGlobalStore((store) => store.rootLegalEntity);
|
|
431
431
|
const metadata = {
|
|
432
|
-
sdkVersion: "3.
|
|
432
|
+
sdkVersion: "3.64.0",
|
|
433
433
|
locale: i18n.locale,
|
|
434
434
|
rootLegalEntityId: rootLegalEntity.id
|
|
435
435
|
};
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { jsx, jsxs } from "preact/jsx-runtime";
|
|
2
|
+
import { i as useLegalEntity, j as Loader, k as useGetTaskStatus, b as useI18nContext, c as useAnalyticsContext, l as useToastContext, m as useQueryClient, n as useUpdateLegalEntity, o as getOwnDecisionMakers, p as getAvailableDecisionMakerRoleTypes, q as useDataMissingRemediations, T as TaskTypes, r as getAllowedDecisionMakerRoles, D as DropinLayout, h as FormHeader, E as EntityGuidanceStatus, s as iconStatus, v as ContextGuidance, w as DecisionMakerType, x as Alert, y as CardGroup, z as EntityAssociation, B as Button, G as ActionBar } from "./core-Coy1ocfj.js";
|
|
3
|
+
import { useState, useEffect } from "preact/hooks";
|
|
4
|
+
const DecisionMakers = (props) => {
|
|
5
|
+
const { data, isLoading } = useLegalEntity();
|
|
6
|
+
if (isLoading || !data) {
|
|
7
|
+
return /* @__PURE__ */ jsx(Loader, {});
|
|
8
|
+
}
|
|
9
|
+
return /* @__PURE__ */ jsx(DecisionMakersInner, { ...props, legalEntity: data });
|
|
10
|
+
};
|
|
11
|
+
const DecisionMakersInner = ({
|
|
12
|
+
legalEntity,
|
|
13
|
+
capabilityProblems,
|
|
14
|
+
onNavigateToIndividual,
|
|
15
|
+
navigateBackToTaskList,
|
|
16
|
+
trustedEntityAssociations
|
|
17
|
+
}) => {
|
|
18
|
+
const getTaskStatus = useGetTaskStatus();
|
|
19
|
+
const { i18n } = useI18nContext();
|
|
20
|
+
const userEvents = useAnalyticsContext();
|
|
21
|
+
const { showToast } = useToastContext();
|
|
22
|
+
const [isRemoveDisabled, setIsRemoveDisabled] = useState(false);
|
|
23
|
+
const queryClient = useQueryClient();
|
|
24
|
+
const updateLegalEntity = useUpdateLegalEntity({
|
|
25
|
+
onSuccess: () => {
|
|
26
|
+
queryClient.invalidateQueries({
|
|
27
|
+
queryKey: ["legalEntity", legalEntity.id],
|
|
28
|
+
exact: true,
|
|
29
|
+
refetchType: "active"
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
const decisionMakers = getOwnDecisionMakers(legalEntity);
|
|
34
|
+
const registeredCountry = legalEntity.organization.registeredAddress.country;
|
|
35
|
+
const availableDecisionMakers = getAvailableDecisionMakerRoleTypes(registeredCountry);
|
|
36
|
+
const translationKeys = {
|
|
37
|
+
home: "saveAndGoToOverview"
|
|
38
|
+
};
|
|
39
|
+
const { remediationMessages } = useDataMissingRemediations({
|
|
40
|
+
legalEntityId: legalEntity.id,
|
|
41
|
+
problems: capabilityProblems
|
|
42
|
+
});
|
|
43
|
+
const mappedDecisionMakers = decisionMakers == null ? void 0 : decisionMakers.reduce(
|
|
44
|
+
(mappedDecisionMakers2, decisionMaker) => {
|
|
45
|
+
var _a;
|
|
46
|
+
if (!decisionMaker.legalEntityId) return {};
|
|
47
|
+
const mappedDecisionMaker = mappedDecisionMakers2[decisionMaker.legalEntityId];
|
|
48
|
+
const decisionMakerType = decisionMaker.type;
|
|
49
|
+
mappedDecisionMakers2[decisionMaker.legalEntityId] = {
|
|
50
|
+
reference: decisionMaker.legalEntityId,
|
|
51
|
+
types: mappedDecisionMaker ? [...mappedDecisionMaker.types, decisionMakerType] : [decisionMakerType],
|
|
52
|
+
status: getTaskStatus(TaskTypes.DECISION_MAKER, decisionMaker.legalEntityId),
|
|
53
|
+
name: decisionMaker.name ?? "",
|
|
54
|
+
legalEntityType: decisionMaker.entityType,
|
|
55
|
+
problems: (_a = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _a[decisionMaker.legalEntityId]
|
|
56
|
+
};
|
|
57
|
+
return mappedDecisionMakers2;
|
|
58
|
+
},
|
|
59
|
+
{}
|
|
60
|
+
);
|
|
61
|
+
const uniqueDecisionMakers = mappedDecisionMakers ? Object.values(mappedDecisionMakers) : [];
|
|
62
|
+
const showWarning = Boolean(remediationMessages.DECISION_MAKER && uniqueDecisionMakers.length);
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
userEvents.addTaskEvent("Landed on page", {
|
|
65
|
+
actionType: "start"
|
|
66
|
+
});
|
|
67
|
+
}, [userEvents]);
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
if (showWarning) {
|
|
70
|
+
userEvents.addTaskEvent("Encountered error", {
|
|
71
|
+
task: TaskTypes.DECISION_MAKER_OVERVIEW,
|
|
72
|
+
actionType: "alert",
|
|
73
|
+
label: "missingDecisionMaker"
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}, [remediationMessages.DECISION_MAKER, showWarning, userEvents]);
|
|
77
|
+
const uniqueDecisionMakersPerType = (roleType) => uniqueDecisionMakers.filter(({ types }) => types.includes(roleType)).length;
|
|
78
|
+
const allowedDecisionMakerTypes = getAllowedDecisionMakerRoles(
|
|
79
|
+
legalEntity,
|
|
80
|
+
TaskTypes.DECISION_MAKER
|
|
81
|
+
);
|
|
82
|
+
const haveMaxDecisionMakers = allowedDecisionMakerTypes.length === 0;
|
|
83
|
+
const getDecisionMakerTrackingParams = (decisionMaker) => ({
|
|
84
|
+
task: TaskTypes.DECISION_MAKER_OVERVIEW,
|
|
85
|
+
associatedLegalEntityId: decisionMaker.reference,
|
|
86
|
+
associatedLegalEntityType: decisionMaker.legalEntityType,
|
|
87
|
+
roles: decisionMaker.types
|
|
88
|
+
});
|
|
89
|
+
const addDecisionMakerOnClick = (e) => {
|
|
90
|
+
e.stopPropagation();
|
|
91
|
+
onNavigateToIndividual();
|
|
92
|
+
};
|
|
93
|
+
const editDecisionMaker = (decisionMaker) => {
|
|
94
|
+
onNavigateToIndividual(decisionMaker.reference);
|
|
95
|
+
userEvents.addTaskEvent("Clicked button", {
|
|
96
|
+
...getDecisionMakerTrackingParams(decisionMaker),
|
|
97
|
+
actionType: "edit"
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
const deleteDecisionMaker = async (decisionMaker) => {
|
|
101
|
+
try {
|
|
102
|
+
const updatedEntityAssociations = {
|
|
103
|
+
entityAssociations: (legalEntity.entityAssociations ?? []).filter(
|
|
104
|
+
(entityAssociation) => entityAssociation.legalEntityId !== decisionMaker.reference
|
|
105
|
+
)
|
|
106
|
+
};
|
|
107
|
+
updateLegalEntity.mutate(updatedEntityAssociations);
|
|
108
|
+
const remainingDecisionMakers = decisionMakers.filter(
|
|
109
|
+
(curr) => curr.legalEntityId !== decisionMaker.reference
|
|
110
|
+
);
|
|
111
|
+
userEvents.addTaskEvent("Clicked button", {
|
|
112
|
+
...getDecisionMakerTrackingParams(decisionMaker),
|
|
113
|
+
actionType: "remove",
|
|
114
|
+
remainingDecisionMakers
|
|
115
|
+
});
|
|
116
|
+
showToast({ type: "success", label: i18n.get("successFullyRemovedDecisionMaker") });
|
|
117
|
+
} catch {
|
|
118
|
+
showToast({ type: "error", label: i18n.get("failedToRemoveDecisionMaker") });
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
return /* @__PURE__ */ jsx(
|
|
122
|
+
DropinLayout,
|
|
123
|
+
{
|
|
124
|
+
content: /* @__PURE__ */ jsxs("div", { className: "adyen-kyc-decision-makers adyen-kyc-u-width-full", children: [
|
|
125
|
+
/* @__PURE__ */ jsx(
|
|
126
|
+
FormHeader,
|
|
127
|
+
{
|
|
128
|
+
heading: i18n.get("decisionMaker"),
|
|
129
|
+
description: i18n.get("decisionMakerDescription")
|
|
130
|
+
}
|
|
131
|
+
),
|
|
132
|
+
/* @__PURE__ */ jsx("div", { className: "adyen-kyc-decision-makers__container", children: availableDecisionMakers.map(({ roleType, min }) => /* @__PURE__ */ jsx(
|
|
133
|
+
EntityGuidanceStatus,
|
|
134
|
+
{
|
|
135
|
+
country: registeredCountry,
|
|
136
|
+
currentTask: TaskTypes.DECISION_MAKER_OVERVIEW,
|
|
137
|
+
entityLabel: roleType,
|
|
138
|
+
status: iconStatus(uniqueDecisionMakersPerType(roleType), min)
|
|
139
|
+
},
|
|
140
|
+
roleType
|
|
141
|
+
)) }),
|
|
142
|
+
/* @__PURE__ */ jsx(
|
|
143
|
+
ContextGuidance,
|
|
144
|
+
{
|
|
145
|
+
title: i18n.get("whatIsTheDifferenceBetweenTheseRoles"),
|
|
146
|
+
content: /* @__PURE__ */ jsx("ul", { className: "adyen-kyc-guidance-list", children: availableDecisionMakers.map(({ roleType }) => /* @__PURE__ */ jsx(
|
|
147
|
+
"li",
|
|
148
|
+
{
|
|
149
|
+
dangerouslySetInnerHTML: {
|
|
150
|
+
__html: i18n.get(
|
|
151
|
+
// Map from API names to internal names
|
|
152
|
+
`${roleType === DecisionMakerType.CONTROLLING_PERSON ? "controllingPerson" : roleType === DecisionMakerType.OWNER ? "owner" : roleType}GuideDescription`
|
|
153
|
+
)
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
roleType
|
|
157
|
+
)) }),
|
|
158
|
+
titleId: "whatIsTheDifferenceBetweenTheseRoles",
|
|
159
|
+
contentId: "differenceBetweenAnOwnerControllingPersonAndSignatory"
|
|
160
|
+
}
|
|
161
|
+
),
|
|
162
|
+
showWarning && /* @__PURE__ */ jsx(
|
|
163
|
+
Alert,
|
|
164
|
+
{
|
|
165
|
+
className: "adyen-kyc-decision-makers__warning",
|
|
166
|
+
title: remediationMessages.DECISION_MAKER,
|
|
167
|
+
variant: "warning"
|
|
168
|
+
}
|
|
169
|
+
),
|
|
170
|
+
(uniqueDecisionMakers == null ? void 0 : uniqueDecisionMakers.length) > 0 ? /* @__PURE__ */ jsx(CardGroup, { children: uniqueDecisionMakers.map((decisionMaker) => /* @__PURE__ */ jsx(
|
|
171
|
+
EntityAssociation,
|
|
172
|
+
{
|
|
173
|
+
types: decisionMaker.types,
|
|
174
|
+
name: decisionMaker.name,
|
|
175
|
+
status: decisionMaker.status,
|
|
176
|
+
onNavigateToEntity: () => editDecisionMaker(decisionMaker),
|
|
177
|
+
problems: decisionMaker == null ? void 0 : decisionMaker.problems,
|
|
178
|
+
removeEntity: () => {
|
|
179
|
+
deleteDecisionMaker(decisionMaker);
|
|
180
|
+
},
|
|
181
|
+
isRemoveDisabled: isRemoveDisabled || (trustedEntityAssociations ?? []).some(
|
|
182
|
+
(ea) => ea.reference === decisionMaker.reference
|
|
183
|
+
),
|
|
184
|
+
handleIsRemoveDisabled: setIsRemoveDisabled
|
|
185
|
+
},
|
|
186
|
+
decisionMaker.reference
|
|
187
|
+
)) }) : null,
|
|
188
|
+
/* @__PURE__ */ jsx("div", { className: "adyen-kyc-decision-makers__actions", children: /* @__PURE__ */ jsx(
|
|
189
|
+
Button,
|
|
190
|
+
{
|
|
191
|
+
variant: "secondary",
|
|
192
|
+
icon: "plus",
|
|
193
|
+
onClick: addDecisionMakerOnClick,
|
|
194
|
+
disabled: haveMaxDecisionMakers,
|
|
195
|
+
fullWidth: true,
|
|
196
|
+
children: i18n.get("addDecisionMaker")
|
|
197
|
+
}
|
|
198
|
+
) }),
|
|
199
|
+
/* @__PURE__ */ jsx(
|
|
200
|
+
ActionBar,
|
|
201
|
+
{
|
|
202
|
+
onHome: () => {
|
|
203
|
+
userEvents.addTaskEvent("Clicked button", {
|
|
204
|
+
task: TaskTypes.DECISION_MAKER_OVERVIEW,
|
|
205
|
+
actionType: "back",
|
|
206
|
+
label: translationKeys.home,
|
|
207
|
+
noOfDecisionMakers: decisionMakers.length
|
|
208
|
+
});
|
|
209
|
+
navigateBackToTaskList();
|
|
210
|
+
},
|
|
211
|
+
homeButtonLabel: i18n.get(translationKeys.home)
|
|
212
|
+
}
|
|
213
|
+
)
|
|
214
|
+
] })
|
|
215
|
+
}
|
|
216
|
+
);
|
|
217
|
+
};
|
|
218
|
+
export {
|
|
219
|
+
DecisionMakers
|
|
220
|
+
};
|