@adyen/kyc-components 2.17.1 → 2.18.1

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.
Files changed (33) hide show
  1. package/dist/es/adyen-kyc-components.es.js +467 -191
  2. package/dist/style.css +12 -11
  3. package/dist/types/components/TaskIntros/TaskIntro.d.ts +6 -6
  4. package/dist/types/components/TaskIntros/TaskIntros.d.ts +6 -6
  5. package/dist/types/components/TaskIntros/constants.d.ts +3 -0
  6. package/dist/types/components/TaskIntros/copy.d.ts +6 -6
  7. package/dist/types/components/TaskIntros/types.d.ts +10 -7
  8. package/dist/types/components/TaskList/component/TaskItemStatus.d.ts +1 -1
  9. package/dist/types/components/TaskList/component/TaskListItem.d.ts +1 -1
  10. package/dist/types/components/TaskList/types.d.ts +3 -1
  11. package/dist/types/components/TrustMembers/component/RootTrusteeTaskItem.d.ts +2 -1
  12. package/dist/types/components/TrustMembers/types.d.ts +1 -1
  13. package/dist/types/components/TrustRoleAndEntityType/convertExistingTrustMember.d.ts +2 -1
  14. package/dist/types/components/TrustRoleAndEntityType/getAvailableRoles.d.ts +2 -0
  15. package/dist/types/components/TrustRoleAndEntityType/types.d.ts +1 -0
  16. package/dist/types/components/internal/Address/utils.d.ts +1 -1
  17. package/dist/types/core/Context/ExperimentContext/types.d.ts +2 -1
  18. package/dist/types/core/Context/SettingsContext/types.d.ts +6 -2
  19. package/dist/types/core/hooks/introduction/useCanSeeIntroduction.d.ts +5 -0
  20. package/dist/types/core/hooks/introduction/useHasSeenIntroduction.d.ts +7 -0
  21. package/dist/types/core/hooks/introduction/useIntroductionScreens.d.ts +8 -0
  22. package/dist/types/core/hooks/introduction/useShouldShowIntroduction.d.ts +5 -0
  23. package/dist/types/core/hooks/useLegalEntityType.d.ts +6 -0
  24. package/dist/types/core/hooks/useLocalStorage.d.ts +5 -2
  25. package/dist/types/core/models/errors/entity-problems.d.ts +1 -1
  26. package/dist/types/language/config.d.ts +38 -27
  27. package/dist/types/utils/decision-maker-roles.d.ts +1 -1
  28. package/dist/types/utils/entity-status-util.d.ts +2 -2
  29. package/dist/types/utils/mapping/trustMembers/getTrustMembers.d.ts +1 -0
  30. package/dist/types/utils/trust-util.d.ts +1 -1
  31. package/dist/types/utils/trustMembers/handlers/addOrUpdateAssociatedTrustMember.d.ts +6 -1
  32. package/package.json +1 -1
  33. package/dist/types/core/hooks/taskIntros.d.ts +0 -10
@@ -276,6 +276,7 @@ const signed = "Signed";
276
276
  const invalidRole = "Please select a role";
277
277
  const unableToVerifyTheIdNumber = "Unable to verify the Id number for the given country";
278
278
  const download = "Download";
279
+ const downloadACopy = "Download a copy";
279
280
  const accountHolder = "Account holder";
280
281
  const accountHolderDescriptionCompany = "The bank account holder has to have the same name as your company.";
281
282
  const accountHolderDescriptionIndividual = "This should be you, since the bank account has to be in your name";
@@ -315,9 +316,9 @@ const directorDescription = "Someone appointed to manage a company's business an
315
316
  const provideAllDirectors = "Add <strong>all directors</strong>. You should have at least 1 director.";
316
317
  const addDecisionMaker = "Add decision-maker";
317
318
  const decisionMakers = "Decision-makers";
318
- const goToIntro = "How does it work?";
319
+ const goToIntroduction = "How does it work?";
319
320
  const goToOverview = "Go to overview";
320
- const goToOverviewFromIntro = "Skip intro";
321
+ const goToOverviewFromIntroduction = "Skip intro";
321
322
  const saveAndGoToOverview = "Save and go to overview";
322
323
  const pleaseEnsureTheFollowing = "Please ensure the following section is fulfilled to complete the review of your data.";
323
324
  const edit = "Edit";
@@ -1090,31 +1091,41 @@ const firstNameOfSettlor = "First name of settlor";
1090
1091
  const lastNameOfSettlor = "Last name of settlor";
1091
1092
  const enterSettlorsFirstNameExactlyAsItAppearsInID = "Enter the settlor's first name(s) exactly as it appears on their identity document";
1092
1093
  const enterSettlorsLastNameExactlyAsItAppearsInID = "Enter the settlor's last name(s) exactly as it appears on their identity document";
1093
- const taskIntroPrologueTitle = "Before you begin...";
1094
- const taskIntroPrologueDescriptionP1 = "We'll ask for some details about your business as part of financial regulations.";
1095
- const taskIntroPrologueDescriptionP2 = "Our advice? Have these details on hand so you can get verified quickly.";
1096
- const taskIntroCompanyTitle = "Company details";
1097
- const taskIntroCompanyDescriptionP1 = "For example, your company name and registration number.";
1098
- const taskIntroCompanyDescriptionP2 = "Where to find this information";
1099
- const taskIntroCompanyDescriptionLI1 = "Your company registration document";
1100
- const taskIntroDecisionMakerTitle = "Decision-makers";
1101
- const taskIntroDecisionMakerDescriptionP1 = "For example, the name and address of important people in your company.";
1102
- const taskIntroDecisionMakerDescriptionP2 = "Where to find this information";
1103
- const taskIntroDecisionMakerDescriptionLI1 = "Driver's license";
1104
- const taskIntroDecisionMakerDescriptionLI2 = "Passport";
1105
- const taskIntroDecisionMakerDescriptionLI3 = "ID document";
1106
- const taskIntroIndividualTitle = "Personal details";
1107
- const taskIntroIndividualDescriptionP1 = "For example, your name and residential address.";
1108
- const taskIntroIndividualDescriptionP2 = "Where to find this information";
1109
- const taskIntroIndividualDescriptionLI1 = "Driver's license";
1110
- const taskIntroIndividualDescriptionLI2 = "Passport";
1111
- const taskIntroIndividualDescriptionLI3 = "ID document";
1112
- const taskIntroPayoutTitle = "Bank account details";
1113
- const taskIntroPayoutDescriptionP1 = "For example, the account holder name and account number.";
1114
- const taskIntroPayoutDescriptionP2 = "This is the bank account you use to send or receive funds.";
1115
- const taskIntroEpilogueTitle = "Why do we need this information?";
1116
- const taskIntroEpilogueDescriptionP1 = "We check all this information against official records to verify your identity and comply with financial regulations.";
1117
- const taskIntroEpilogueDescriptionP2 = "Your information will be used only for these purposes.";
1094
+ const introductionScreenPrologueTitle = "Before you begin...";
1095
+ const introductionScreenPrologueDescriptionP1 = "Well ask for some details about your business as part of financial regulations.";
1096
+ const introductionScreenPrologueDescriptionP2 = "Our advice? Have these details on hand so you can get verified quickly.";
1097
+ const introductionScreenCompanyTitle = "Company details";
1098
+ const introductionScreenCompanyDescriptionP1 = "For example, your company name and registration number.";
1099
+ const introductionScreenCompanyDescriptionP2 = "Where to find this information";
1100
+ const introductionScreenCompanyDescriptionLI1 = "Your company registration document";
1101
+ const introductionScreenIndividualTitle = "Personal details";
1102
+ const introductionScreenIndividualDescriptionP1 = "For example, your name and residential address.";
1103
+ const introductionScreenIndividualDescriptionP2 = "Where to find this information";
1104
+ const introductionScreenIndividualDescriptionLI1 = "Drivers license";
1105
+ const introductionScreenIndividualDescriptionLI2 = "Passport";
1106
+ const introductionScreenIndividualDescriptionLI3 = "ID document";
1107
+ const introductionScreenDecisionMakerTitle = "Decision-makers";
1108
+ const introductionScreenDecisionMakerDescriptionP1 = "For example, the name and address of important people in your company.";
1109
+ const introductionScreenDecisionMakerDescriptionP2 = "Where to find this information";
1110
+ const introductionScreenDecisionMakerDescriptionLI1 = "Drivers license";
1111
+ const introductionScreenDecisionMakerDescriptionLI2 = "Passport";
1112
+ const introductionScreenDecisionMakerDescriptionLI3 = "ID document";
1113
+ const introductionScreenTrustTitle = "Trust details";
1114
+ const introductionScreenTrustDescriptionP1 = "For example, your trust’s name and business number. You’ll also need to upload your trust deed.";
1115
+ const introductionScreenTrustDescriptionP2 = "Where to find this information";
1116
+ const introductionScreenTrustDescriptionLI1 = "Your trust registration document";
1117
+ const introductionScreenTrustMemberTitle = "Trust members";
1118
+ const introductionScreenTrustMemberDescriptionP1 = "The name, date of birth, and address of trust members such as settlors and beneficiaries.";
1119
+ const introductionScreenTrustMemberDescriptionP2 = "Where to find this information";
1120
+ const introductionScreenTrustMemberDescriptionLI1 = "Driver’s license";
1121
+ const introductionScreenTrustMemberDescriptionLI2 = "Passport";
1122
+ const introductionScreenTrustMemberDescriptionLI3 = "ID document";
1123
+ const introductionScreenAccountTitle = "Bank account details";
1124
+ const introductionScreenAccountDescriptionP1 = "For example, the account holder name and account number.";
1125
+ const introductionScreenAccountDescriptionP2 = "This is the bank account you use to send or receive funds.";
1126
+ const introductionScreenEpilogueTitle = "Why do we need this information?";
1127
+ const introductionScreenEpilogueDescriptionP1 = "We check all this information against official records to verify your identity and comply with financial regulations.";
1128
+ const introductionScreenEpilogueDescriptionP2 = "Your information will be used only for these purposes.";
1118
1129
  const defaultTrans = {
1119
1130
  close,
1120
1131
  individual,
@@ -1378,6 +1389,7 @@ const defaultTrans = {
1378
1389
  invalidRole,
1379
1390
  unableToVerifyTheIdNumber,
1380
1391
  download,
1392
+ downloadACopy,
1381
1393
  accountHolder,
1382
1394
  accountHolderDescriptionCompany,
1383
1395
  accountHolderDescriptionIndividual,
@@ -1417,9 +1429,9 @@ const defaultTrans = {
1417
1429
  provideAllDirectors,
1418
1430
  addDecisionMaker,
1419
1431
  decisionMakers,
1420
- goToIntro,
1432
+ goToIntroduction,
1421
1433
  goToOverview,
1422
- goToOverviewFromIntro,
1434
+ goToOverviewFromIntroduction,
1423
1435
  saveAndGoToOverview,
1424
1436
  pleaseEnsureTheFollowing,
1425
1437
  edit,
@@ -2209,31 +2221,41 @@ const defaultTrans = {
2209
2221
  lastNameOfSettlor,
2210
2222
  enterSettlorsFirstNameExactlyAsItAppearsInID,
2211
2223
  enterSettlorsLastNameExactlyAsItAppearsInID,
2212
- taskIntroPrologueTitle,
2213
- taskIntroPrologueDescriptionP1,
2214
- taskIntroPrologueDescriptionP2,
2215
- taskIntroCompanyTitle,
2216
- taskIntroCompanyDescriptionP1,
2217
- taskIntroCompanyDescriptionP2,
2218
- taskIntroCompanyDescriptionLI1,
2219
- taskIntroDecisionMakerTitle,
2220
- taskIntroDecisionMakerDescriptionP1,
2221
- taskIntroDecisionMakerDescriptionP2,
2222
- taskIntroDecisionMakerDescriptionLI1,
2223
- taskIntroDecisionMakerDescriptionLI2,
2224
- taskIntroDecisionMakerDescriptionLI3,
2225
- taskIntroIndividualTitle,
2226
- taskIntroIndividualDescriptionP1,
2227
- taskIntroIndividualDescriptionP2,
2228
- taskIntroIndividualDescriptionLI1,
2229
- taskIntroIndividualDescriptionLI2,
2230
- taskIntroIndividualDescriptionLI3,
2231
- taskIntroPayoutTitle,
2232
- taskIntroPayoutDescriptionP1,
2233
- taskIntroPayoutDescriptionP2,
2234
- taskIntroEpilogueTitle,
2235
- taskIntroEpilogueDescriptionP1,
2236
- taskIntroEpilogueDescriptionP2
2224
+ introductionScreenPrologueTitle,
2225
+ introductionScreenPrologueDescriptionP1,
2226
+ introductionScreenPrologueDescriptionP2,
2227
+ introductionScreenCompanyTitle,
2228
+ introductionScreenCompanyDescriptionP1,
2229
+ introductionScreenCompanyDescriptionP2,
2230
+ introductionScreenCompanyDescriptionLI1,
2231
+ introductionScreenIndividualTitle,
2232
+ introductionScreenIndividualDescriptionP1,
2233
+ introductionScreenIndividualDescriptionP2,
2234
+ introductionScreenIndividualDescriptionLI1,
2235
+ introductionScreenIndividualDescriptionLI2,
2236
+ introductionScreenIndividualDescriptionLI3,
2237
+ introductionScreenDecisionMakerTitle,
2238
+ introductionScreenDecisionMakerDescriptionP1,
2239
+ introductionScreenDecisionMakerDescriptionP2,
2240
+ introductionScreenDecisionMakerDescriptionLI1,
2241
+ introductionScreenDecisionMakerDescriptionLI2,
2242
+ introductionScreenDecisionMakerDescriptionLI3,
2243
+ introductionScreenTrustTitle,
2244
+ introductionScreenTrustDescriptionP1,
2245
+ introductionScreenTrustDescriptionP2,
2246
+ introductionScreenTrustDescriptionLI1,
2247
+ introductionScreenTrustMemberTitle,
2248
+ introductionScreenTrustMemberDescriptionP1,
2249
+ introductionScreenTrustMemberDescriptionP2,
2250
+ introductionScreenTrustMemberDescriptionLI1,
2251
+ introductionScreenTrustMemberDescriptionLI2,
2252
+ introductionScreenTrustMemberDescriptionLI3,
2253
+ introductionScreenAccountTitle,
2254
+ introductionScreenAccountDescriptionP1,
2255
+ introductionScreenAccountDescriptionP2,
2256
+ introductionScreenEpilogueTitle,
2257
+ introductionScreenEpilogueDescriptionP1,
2258
+ introductionScreenEpilogueDescriptionP2
2237
2259
  };
2238
2260
  const FALLBACK_LOCALE = "en-US";
2239
2261
  const defaultTranslation = defaultTrans;
@@ -3160,11 +3182,15 @@ var SettingNames = /* @__PURE__ */ ((SettingNames2) => {
3160
3182
  SettingNames2["AllowIntraRegionCrossBorderPayout"] = "allowIntraRegionCrossBorderPayout";
3161
3183
  SettingNames2["AllowLegalEntityTypeChange"] = "changeLegalEntityType";
3162
3184
  SettingNames2["AllowPrefilledCountryEdit"] = "editPrefilledCountry";
3163
- SettingNames2["ViewOnboardingGuidance"] = "viewOnboardingGuidance";
3164
3185
  SettingNames2["RequirePciSignEcommerce"] = "requirePciSignEcommerce";
3165
3186
  SettingNames2["RequirePciSignPos"] = "requirePciSignPos";
3166
3187
  SettingNames2["RequirePciSignEcomMoto"] = "requirePciSignEcomMoto";
3167
3188
  SettingNames2["RequirePciSignPosMoto"] = "requirePciSignPosMoto";
3189
+ SettingNames2["HideOnboardingIntroductionIndividual"] = "hideOnboardingIntroductionIndividual";
3190
+ SettingNames2["HideOnboardingIntroductionOrganization"] = "hideOnboardingIntroductionOrganization";
3191
+ SettingNames2["HideOnboardingIntroductionTrust"] = "hideOnboardingIntroductionTrust";
3192
+ SettingNames2["HideOnboardingIntroductionSoleProprietor"] = "hideOnboardingIntroductionSoleProprietor";
3193
+ SettingNames2["ViewOnboardingGuidance"] = "viewOnboardingGuidance";
3168
3194
  return SettingNames2;
3169
3195
  })(SettingNames || {});
3170
3196
  const ON_CHANGE_DEBOUNCE_DURATION = 200;
@@ -8714,7 +8740,7 @@ var DecisionMakerType = /* @__PURE__ */ ((DecisionMakerType2) => {
8714
8740
  })(DecisionMakerType || {});
8715
8741
  var TaskTypes = /* @__PURE__ */ ((TaskTypes2) => {
8716
8742
  TaskTypes2["BUSINESS_TYPE_SELECTION"] = "BUSINESS_TYPE_SELECTION";
8717
- TaskTypes2["INTRO"] = "INTRO";
8743
+ TaskTypes2["INTRODUCTION"] = "INTRODUCTION";
8718
8744
  TaskTypes2["TASKS_OVERVIEW"] = "TASKS_OVERVIEW";
8719
8745
  TaskTypes2["REVIEW"] = "REVIEW";
8720
8746
  TaskTypes2["INDIVIDUAL"] = "INDIVIDUAL";
@@ -17160,6 +17186,7 @@ var ExperimentNames = /* @__PURE__ */ ((ExperimentNames2) => {
17160
17186
  ExperimentNames2["OnlyAllowAlphanumericBankAccountNumbers"] = "OnlyAllowAlphanumericBankAccountNumbers";
17161
17187
  ExperimentNames2["EnableNewEntryFlow"] = "EnableNewEntryFlow";
17162
17188
  ExperimentNames2["AllowOrganizationSettlorWithExemptionReason"] = "AllowOrganizationSettlorWithExemptionReason";
17189
+ ExperimentNames2["AllowMoreRolesForMainRootTrustee"] = "AllowMoreRolesForMainRootTrustee";
17163
17190
  return ExperimentNames2;
17164
17191
  })(ExperimentNames || {});
17165
17192
  const stripNonAlphanumeric = (value) => value.replaceAll(/[^0-9a-zA-Z]/g, "");
@@ -19308,7 +19335,7 @@ const entityProblemInitialState = {
19308
19335
  // default status - if the entity is not listed in the problems array
19309
19336
  validationErrors: {}
19310
19337
  };
19311
- const UNRELATED_DATA_MISSING_ERROR_CODES = ["2_8036"];
19338
+ const UNRELATED_DATA_MISSING_ERROR_CODES = ["2_8036", "2_8064", "2_8067", "2_8189"];
19312
19339
  const UNRELATED_INVALID_INPUT_ERROR_CODES = ["1_14", "2_901", "2_902"];
19313
19340
  function getCapabilityProblems(response) {
19314
19341
  const capabilities = (response == null ? void 0 : response.capabilities) || {};
@@ -19349,9 +19376,7 @@ function setVerificationError(error, entityProblems) {
19349
19376
  break;
19350
19377
  }
19351
19378
  case VerificationErrorType.DATA_MISSING: {
19352
- if (!isUnRelatedErrorCode(error)) {
19353
- setMissingDataError(error, entityProblems);
19354
- }
19379
+ setMissingDataError(error, entityProblems);
19355
19380
  break;
19356
19381
  }
19357
19382
  case VerificationErrorType.DATA_REVIEW:
@@ -19365,7 +19390,9 @@ function setVerificationError(error, entityProblems) {
19365
19390
  const isUnRelatedErrorCode = (error) => UNRELATED_DATA_MISSING_ERROR_CODES.includes(error == null ? void 0 : error.code) || UNRELATED_INVALID_INPUT_ERROR_CODES.includes(error == null ? void 0 : error.code);
19366
19391
  function setMissingDataError(verificationError, entityProblems) {
19367
19392
  entityProblems.missingData = entityProblems.missingData ? [...entityProblems.missingData, verificationError] : [verificationError];
19368
- setPriorityStatus(entityProblems, TaskStatus.DETAILS_REQUIRED);
19393
+ if (!isUnRelatedErrorCode(verificationError)) {
19394
+ setPriorityStatus(entityProblems, TaskStatus.DETAILS_REQUIRED);
19395
+ }
19369
19396
  }
19370
19397
  const setReviewRequiredError = (verificationError, entityProblems) => {
19371
19398
  entityProblems.isReviewRequired = true;
@@ -21429,7 +21456,7 @@ function CompanyDropinComponent({
21429
21456
  });
21430
21457
  }
21431
21458
  const logger$8 = createLogger("useLocalStorage");
21432
- function useLocalStorage(key, defaultValue, options) {
21459
+ const useLocalStorage = (key, defaultValue, options) => {
21433
21460
  const {
21434
21461
  serializer,
21435
21462
  parser,
@@ -21505,32 +21532,74 @@ function useLocalStorage(key, defaultValue, options) {
21505
21532
  return () => window.removeEventListener("storage", handleStorageChange);
21506
21533
  }, [key, syncData]);
21507
21534
  return [value, setValue];
21508
- }
21509
- const isIntroForLE = (legalEntity) => Boolean(legalEntity.type) && (legalEntity.type === LegalEntityType.INDIVIDUAL || legalEntity.type === LegalEntityType.ORGANIZATION) && !(hasOwnEntityAssociationOfType(LegalEntityType.SOLE_PROPRIETORSHIP, legalEntity.entityAssociations, legalEntity.id) || hasOwnEntityAssociationOfType(LegalEntityType.TRUST, legalEntity.entityAssociations, legalEntity.id));
21510
- const useCanSeeIntro = (legalEntity) => {
21511
- const {
21512
- isSettingEnabled
21513
- } = useSettingsContext();
21514
- return {
21515
- canSeeIntro: isSettingEnabled("viewOnboardingGuidance") && isIntroForLE(legalEntity)
21516
- };
21517
21535
  };
21518
- const getHasSeenIntroStorageKey = (legalEntityId) => `COMPLETED_INTRO-${legalEntityId}`;
21519
- const useHasSeenIntro = (legalEntityId) => {
21520
- const [hasSeenIntro, setHasSeenIntro] = useLocalStorage(getHasSeenIntroStorageKey(legalEntityId), false);
21536
+ const getHasSeenIntroductionStorageKey = (legalEntityId) => `COMPLETED_INTRO-${legalEntityId}`;
21537
+ const useHasSeenIntroduction = ({
21538
+ legalEntityId
21539
+ }) => {
21540
+ const [hasSeenIntroduction, setHasSeenIntroduction] = useLocalStorage(getHasSeenIntroductionStorageKey(legalEntityId), false);
21521
21541
  return {
21522
- hasSeenIntro,
21523
- setHasSeenIntro
21542
+ hasSeenIntroduction,
21543
+ setHasSeenIntroduction
21524
21544
  };
21525
21545
  };
21526
- const useShouldShowIntro = (legalEntity) => {
21546
+ const useLegalEntityType = ({
21547
+ legalEntity
21548
+ }) => {
21527
21549
  const {
21528
- canSeeIntro
21529
- } = useCanSeeIntro(legalEntity);
21550
+ isExperimentEnabled
21551
+ } = useExperimentsContext();
21552
+ const isTrust = isPartOfTrustFromLegalEntity(legalEntity);
21553
+ const isSoleProprietor = hasSolePropInLegalEntity(legalEntity);
21554
+ const hasLegalAssociation = isTrust || isSoleProprietor;
21555
+ switch (legalEntity.type) {
21556
+ case LegalEntityType.INDIVIDUAL:
21557
+ case LegalEntityType.ORGANIZATION:
21558
+ if (!hasLegalAssociation)
21559
+ return legalEntity.type;
21560
+ if (isSoleProprietor)
21561
+ return LegalEntityType.SOLE_PROPRIETORSHIP;
21562
+ if (isTrust)
21563
+ return isExperimentEnabled(ExperimentNames.EnableTrustFlow) ? LegalEntityType.TRUST : legalEntity.type;
21564
+ break;
21565
+ default:
21566
+ return void 0;
21567
+ }
21568
+ };
21569
+ const useCanSeeIntroduction = ({
21570
+ legalEntity
21571
+ }) => {
21572
+ const legalEntityType = useLegalEntityType({
21573
+ legalEntity
21574
+ });
21575
+ const {
21576
+ isSettingEnabled
21577
+ } = useSettingsContext();
21578
+ switch (legalEntityType) {
21579
+ case LegalEntityType.INDIVIDUAL:
21580
+ return !isSettingEnabled(SettingNames.HideOnboardingIntroductionIndividual);
21581
+ case LegalEntityType.ORGANIZATION:
21582
+ return !isSettingEnabled(SettingNames.HideOnboardingIntroductionOrganization);
21583
+ case LegalEntityType.SOLE_PROPRIETORSHIP:
21584
+ return !isSettingEnabled(SettingNames.HideOnboardingIntroductionSoleProprietor);
21585
+ case LegalEntityType.TRUST:
21586
+ return !isSettingEnabled(SettingNames.HideOnboardingIntroductionTrust);
21587
+ default:
21588
+ return false;
21589
+ }
21590
+ };
21591
+ const useShouldShowIntroduction = ({
21592
+ legalEntity
21593
+ }) => {
21594
+ const canSeeIntroduction = useCanSeeIntroduction({
21595
+ legalEntity
21596
+ });
21530
21597
  const {
21531
- hasSeenIntro
21532
- } = useHasSeenIntro(legalEntity.id);
21533
- return canSeeIntro && !hasSeenIntro;
21598
+ hasSeenIntroduction
21599
+ } = useHasSeenIntroduction({
21600
+ legalEntityId: legalEntity.id
21601
+ });
21602
+ return canSeeIntroduction && !hasSeenIntroduction;
21534
21603
  };
21535
21604
  const useShouldShowBusinessTypeSelection = (accountHolder2) => {
21536
21605
  const {
@@ -21704,7 +21773,7 @@ const mapEntityAssociationsToTrustMembers = (trustEntityId, entityAssociations,
21704
21773
  };
21705
21774
  const mapRootLegalEntityToTrustMember = (rootLegalEntity) => ({
21706
21775
  trustMemberType: "rootTrustee",
21707
- roles: [TrustMemberTypes.TRUSTEE],
21776
+ roles: [],
21708
21777
  legalEntityType: rootLegalEntity.type,
21709
21778
  legalEntityId: rootLegalEntity.id,
21710
21779
  name: getLegalEntityNameBasedOnType(rootLegalEntity)
@@ -21722,6 +21791,23 @@ const getTrustMembers = (trustLE, rootLegalEntity, exemptSettlorLE) => {
21722
21791
  var _a;
21723
21792
  return [mapRootLegalEntityToTrustMember(rootLegalEntity), ...mapEntityAssociationsToTrustMembers(trustLE.id, trustLE.entityAssociations ?? [], exemptSettlorLE), ...mapUndefinedBeneficiaryInfoToTrustMembers(((_a = trustLE.trust) == null ? void 0 : _a.undefinedBeneficiaryInfo) ?? [])];
21724
21793
  };
21794
+ const combineRootLegalEntityWithEntityAssociations = (rootLegalEntity, entityAssociations) => {
21795
+ const roles = entityAssociations.map((entityAssociation) => entityAssociation.type).filter((role2) => role2 === TrustMemberTypes.SETTLOR || role2 === TrustMemberTypes.PROTECTOR);
21796
+ return {
21797
+ trustMemberType: "rootTrustee",
21798
+ roles: [...roles, TrustMemberTypes.TRUSTEE],
21799
+ legalEntityType: rootLegalEntity.type,
21800
+ legalEntityId: rootLegalEntity.id,
21801
+ name: getLegalEntityNameBasedOnType(rootLegalEntity)
21802
+ };
21803
+ };
21804
+ const getRootTrusteeTrustMembers = (trustLE, rootLegalEntity, exemptSettlorLE) => {
21805
+ var _a;
21806
+ const entityAssociations = trustLE.entityAssociations ?? [];
21807
+ const rootLegalEntityAssociations = entityAssociations.filter((a) => a.legalEntityId === rootLegalEntity.id);
21808
+ const nonRootLegalEntityAssociations = entityAssociations.filter((a) => a.legalEntityId !== rootLegalEntity.id);
21809
+ return [combineRootLegalEntityWithEntityAssociations(rootLegalEntity, rootLegalEntityAssociations), ...mapEntityAssociationsToTrustMembers(trustLE.id, nonRootLegalEntityAssociations ?? [], exemptSettlorLE), ...mapUndefinedBeneficiaryInfoToTrustMembers(((_a = trustLE.trust) == null ? void 0 : _a.undefinedBeneficiaryInfo) ?? [])];
21810
+ };
21725
21811
  const mapTrustMemberToEntityAssociations = (trustMember) => {
21726
21812
  var _a, _b;
21727
21813
  if (trustMember.legalEntityId === isNewEntity) {
@@ -21752,6 +21838,22 @@ const addOrUpdateAssociatedTrustMember = async ({
21752
21838
  };
21753
21839
  await handleUpdateLegalEntity(patchLE, trust2.id);
21754
21840
  };
21841
+ const updateRootTrusteeTrustMember = async ({
21842
+ trustMember,
21843
+ trust: trust2,
21844
+ handleUpdateLegalEntity
21845
+ }) => {
21846
+ const otherAssociations = getOwnEntityAssociations(trust2).filter((existingAssociation) => existingAssociation.legalEntityId !== trustMember.legalEntityId);
21847
+ const updatedAssociations = mapRootTrustMemberToEntityAssociations(trustMember);
21848
+ const patchLE = {
21849
+ entityAssociations: [...otherAssociations, ...updatedAssociations]
21850
+ };
21851
+ await handleUpdateLegalEntity(patchLE, trust2.id);
21852
+ };
21853
+ const mapRootTrustMemberToEntityAssociations = (trustMember) => trustMember.roles.filter((r) => r !== "secondaryTrustee").map((role2) => ({
21854
+ legalEntityId: trustMember.legalEntityId,
21855
+ type: role2
21856
+ }));
21755
21857
  const addOrUpdateUndefinedBeneficiary = async ({
21756
21858
  newOrUpdated,
21757
21859
  trust: trust2,
@@ -22376,12 +22478,13 @@ function useDataMissingRemediations({
22376
22478
  const remediation = DATA_MISSING_DECISION_MAKER_ERROR_CODE_MAPPING[error.code];
22377
22479
  return remediation ? [...remediations, remediation] : remediations;
22378
22480
  }, []);
22379
- switch (remediationCodes == null ? void 0 : remediationCodes.length) {
22481
+ const uniqueRemediations = [...new Set(remediationCodes)];
22482
+ switch (uniqueRemediations == null ? void 0 : uniqueRemediations.length) {
22380
22483
  case void 0:
22381
22484
  case 0:
22382
22485
  return void 0;
22383
22486
  case 1:
22384
- return remediationCodes[0] ? i18n.get(`remediationMessage_${remediationCodes[0]}`) : i18n.get("missingMultipleDecisionMakers");
22487
+ return uniqueRemediations[0] ? i18n.get(`remediationMessage_${uniqueRemediations[0]}`) : i18n.get("missingMultipleDecisionMakers");
22385
22488
  default:
22386
22489
  return i18n.get("missingMultipleDecisionMakers");
22387
22490
  }
@@ -22455,6 +22558,7 @@ const Status = ({
22455
22558
  };
22456
22559
  const TaskItemStatus = ({
22457
22560
  status,
22561
+ statusLabel,
22458
22562
  downloadHandler
22459
22563
  }) => {
22460
22564
  const {
@@ -22472,64 +22576,64 @@ const TaskItemStatus = ({
22472
22576
  tabIndex: 0,
22473
22577
  icon: "download",
22474
22578
  onClick: handleDownloadClick,
22475
- children: [i18n.get("download"), " "]
22579
+ children: [statusLabel || i18n.get("download"), " "]
22476
22580
  });
22477
22581
  case TaskStatus.FINISHED:
22478
22582
  return jsx(Status, {
22479
22583
  className: "adl-status--finished",
22480
22584
  iconStatusClass: "adl-status__icon--finished",
22481
22585
  icon: "check",
22482
- text: i18n.get("verified")
22586
+ text: statusLabel || i18n.get("verified")
22483
22587
  });
22484
22588
  case TaskStatus.SIGNED:
22485
22589
  return jsx(Status, {
22486
22590
  className: "adl-status--finished",
22487
22591
  iconStatusClass: "adl-status__icon--finished",
22488
22592
  icon: "check",
22489
- text: i18n.get("signed")
22593
+ text: statusLabel || i18n.get("signed")
22490
22594
  });
22491
22595
  case TaskStatus.ERROR:
22492
22596
  return jsx(Status, {
22493
22597
  className: "adl-status--error",
22494
22598
  iconStatusClass: "adl-status__icon--error",
22495
22599
  icon: "info-circle",
22496
- text: i18n.get("unsuccessful")
22600
+ text: statusLabel || i18n.get("unsuccessful")
22497
22601
  });
22498
22602
  case TaskStatus.PROCESSING:
22499
22603
  return jsx(Status, {
22500
22604
  className: "",
22501
22605
  iconStatusClass: "",
22502
22606
  icon: "loading",
22503
- text: i18n.get("inReview")
22607
+ text: statusLabel || i18n.get("inReview")
22504
22608
  });
22505
22609
  case TaskStatus.SIGN:
22506
22610
  return jsx("span", {
22507
22611
  className: "adl-task-status-sign",
22508
- children: i18n.get("sign")
22612
+ children: statusLabel || i18n.get("sign")
22509
22613
  });
22510
22614
  case TaskStatus.SUBMIT:
22511
22615
  return jsx("span", {
22512
22616
  className: "adl-task-status-submit",
22513
- children: i18n.get("submit")
22617
+ children: statusLabel || i18n.get("submit")
22514
22618
  });
22515
22619
  case TaskStatus.REMOVING:
22516
22620
  return jsx(Status, {
22517
22621
  className: "",
22518
22622
  iconStatusClass: "",
22519
22623
  icon: "loading",
22520
- text: i18n.get("removing")
22624
+ text: statusLabel || i18n.get("removing")
22521
22625
  });
22522
22626
  case "review":
22523
22627
  return jsx("span", {
22524
22628
  className: "adl-task-status-details-required",
22525
- children: i18n.get("verify")
22629
+ children: statusLabel || i18n.get("verify")
22526
22630
  });
22527
22631
  case TaskStatus.DETAILS_REQUIRED:
22528
22632
  case TaskStatus.EMPTY:
22529
22633
  default:
22530
22634
  return jsx("span", {
22531
22635
  className: "adl-task-status-details-required",
22532
- children: i18n.get("add")
22636
+ children: statusLabel || i18n.get("add")
22533
22637
  });
22534
22638
  }
22535
22639
  };
@@ -23256,7 +23360,47 @@ function ReviewComponent({
23256
23360
  footer
23257
23361
  });
23258
23362
  }
23259
- const _taskIntros_component = "";
23363
+ const _introduction_component = "";
23364
+ var IntroductionScreens = ((IntroductionScreens2) => {
23365
+ IntroductionScreens2["PROLOGUE"] = "PROLOGUE";
23366
+ IntroductionScreens2[IntroductionScreens2["COMPANY"] = TaskTypes.COMPANY] = "COMPANY";
23367
+ IntroductionScreens2[IntroductionScreens2["INDIVIDUAL"] = TaskTypes.INDIVIDUAL] = "INDIVIDUAL";
23368
+ IntroductionScreens2[IntroductionScreens2["DECISION_MAKER"] = TaskTypes.DECISION_MAKER] = "DECISION_MAKER";
23369
+ IntroductionScreens2[IntroductionScreens2["TRUST"] = TaskTypes.TRUST] = "TRUST";
23370
+ IntroductionScreens2[IntroductionScreens2["TRUST_MEMBER_OVERVIEW"] = TaskTypes.TRUST_MEMBER_OVERVIEW] = "TRUST_MEMBER_OVERVIEW";
23371
+ IntroductionScreens2["ACCOUNT"] = "ACCOUNT";
23372
+ IntroductionScreens2["EPILOGUE"] = "EPILOGUE";
23373
+ return IntroductionScreens2;
23374
+ })(IntroductionScreens || {});
23375
+ const introductionScreensByLegalEntityType = {
23376
+ [LegalEntityType.INDIVIDUAL]: [IntroductionScreens.PROLOGUE, IntroductionScreens.INDIVIDUAL, IntroductionScreens.ACCOUNT, IntroductionScreens.EPILOGUE],
23377
+ [LegalEntityType.ORGANIZATION]: [IntroductionScreens.PROLOGUE, IntroductionScreens.COMPANY, IntroductionScreens.DECISION_MAKER, IntroductionScreens.ACCOUNT, IntroductionScreens.EPILOGUE],
23378
+ [LegalEntityType.SOLE_PROPRIETORSHIP]: [IntroductionScreens.PROLOGUE, IntroductionScreens.INDIVIDUAL, IntroductionScreens.ACCOUNT, IntroductionScreens.EPILOGUE],
23379
+ [LegalEntityType.TRUST]: [IntroductionScreens.PROLOGUE, IntroductionScreens.COMPANY, IntroductionScreens.INDIVIDUAL, IntroductionScreens.DECISION_MAKER, IntroductionScreens.TRUST, IntroductionScreens.TRUST_MEMBER_OVERVIEW, IntroductionScreens.ACCOUNT, IntroductionScreens.EPILOGUE]
23380
+ };
23381
+ const useIntroductionScreens = ({
23382
+ legalEntity,
23383
+ tasks
23384
+ }) => {
23385
+ const canSeeIntroduction = useCanSeeIntroduction({
23386
+ legalEntity
23387
+ });
23388
+ const legalEntityType = useLegalEntityType({
23389
+ legalEntity
23390
+ });
23391
+ const introductionScreens = useMemo$1(() => legalEntityType ? introductionScreensByLegalEntityType[legalEntityType].filter((screen) => {
23392
+ const isAccountScreen = screen === IntroductionScreens.ACCOUNT;
23393
+ const hasAccountTask = tasks.includes(TaskTypes.PAYIN) || tasks.includes(TaskTypes.PAYOUT);
23394
+ const isTrustScreen = screen === IntroductionScreens.TRUST || screen === IntroductionScreens.TRUST_MEMBER_OVERVIEW;
23395
+ const isTrust = legalEntityType === LegalEntityType.TRUST;
23396
+ if (isAccountScreen)
23397
+ return hasAccountTask;
23398
+ if (isTrustScreen)
23399
+ return isTrust;
23400
+ return tasks.some((task) => screen === task);
23401
+ }) : [], [legalEntityType, tasks]);
23402
+ return canSeeIntroduction && (introductionScreens == null ? void 0 : introductionScreens.length) > 0 ? [IntroductionScreens.PROLOGUE, ...introductionScreens, IntroductionScreens.EPILOGUE] : void 0;
23403
+ };
23260
23404
  const StepProgressIndicator$1 = "";
23261
23405
  const StepProgressIndicator = ({
23262
23406
  activeStepIndex,
@@ -23284,51 +23428,54 @@ const StepProgressIndicator = ({
23284
23428
  }) : null;
23285
23429
  const toCapitalized = (s) => `${s[0].toUpperCase()}${s.slice(1).toLowerCase()}`;
23286
23430
  const toPascalCase = (s) => s.split(/[^A-Za-z]/).map((word) => toCapitalized(word)).join("");
23287
- var IntroDescriptionTranslationKeyElements = /* @__PURE__ */ ((IntroDescriptionTranslationKeyElements2) => {
23288
- IntroDescriptionTranslationKeyElements2["ListItem"] = "LI";
23289
- IntroDescriptionTranslationKeyElements2["Paragraph"] = "P";
23290
- return IntroDescriptionTranslationKeyElements2;
23291
- })(IntroDescriptionTranslationKeyElements || {});
23292
- const getIntroDescriptionTranslationKeys = (translations, factors) => {
23431
+ var IntroductionScreenTranslationKeyElements = /* @__PURE__ */ ((IntroductionScreenTranslationKeyElements2) => {
23432
+ IntroductionScreenTranslationKeyElements2["ListItem"] = "LI";
23433
+ IntroductionScreenTranslationKeyElements2["Paragraph"] = "P";
23434
+ return IntroductionScreenTranslationKeyElements2;
23435
+ })(IntroductionScreenTranslationKeyElements || {});
23436
+ const getIntroductionScreenTranslationKeys = (translations, factors) => {
23293
23437
  const elForKey = (factors.elementType || "").toUpperCase();
23294
23438
  const lForKey = toPascalCase(factors.legalEntityType || "");
23295
- const iForKey = toPascalCase(factors.introType);
23296
- const keyPrefix = `taskIntro${iForKey}Description${elForKey}`;
23297
- const keyPrefixWithL = `taskIntro${iForKey}${lForKey}Description${elForKey}`;
23439
+ const iForKey = toPascalCase(factors.introductionScreen);
23440
+ const keyPrefix = `introductionScreen${iForKey}Description${elForKey}`;
23441
+ const keyPrefixWithL = `introductionScreen${iForKey}${lForKey}Description${elForKey}`;
23298
23442
  const keys = getTranslationKeysByPrefix(translations, keyPrefix);
23299
23443
  const keysWithL = getTranslationKeysByPrefix(translations, keyPrefixWithL);
23300
23444
  return (keysWithL.length ? keysWithL : keys).sort((a, b) => Number(a.charAt(a.length - 1)) - Number(b.charAt(b.length - 1)));
23301
23445
  };
23302
- const TaskIntro = ({
23303
- intro,
23304
- legalEntityType,
23446
+ const IntroductionScreen = ({
23447
+ introductionScreen,
23448
+ legalEntity,
23305
23449
  number: number2
23306
23450
  }) => {
23307
23451
  const {
23308
23452
  i18n
23309
23453
  } = useI18nContext();
23310
- const paragraphKeys = useMemo(() => getIntroDescriptionTranslationKeys(i18n.translations, {
23311
- introType: intro,
23454
+ const legalEntityType = useLegalEntityType({
23455
+ legalEntity
23456
+ });
23457
+ const paragraphKeys = useMemo(() => legalEntityType ? getIntroductionScreenTranslationKeys(i18n.translations, {
23458
+ introductionScreen,
23312
23459
  legalEntityType,
23313
- elementType: IntroDescriptionTranslationKeyElements.Paragraph
23314
- }), [i18n, intro, legalEntityType]);
23315
- const listItemKeys = useMemo(() => getIntroDescriptionTranslationKeys(i18n.translations, {
23316
- introType: intro,
23460
+ elementType: IntroductionScreenTranslationKeyElements.Paragraph
23461
+ }) : void 0, [i18n, introductionScreen, legalEntityType]);
23462
+ const listItemKeys = useMemo(() => legalEntityType ? getIntroductionScreenTranslationKeys(i18n.translations, {
23463
+ introductionScreen,
23317
23464
  legalEntityType,
23318
- elementType: IntroDescriptionTranslationKeyElements.ListItem
23319
- }), [i18n, intro, legalEntityType]);
23465
+ elementType: IntroductionScreenTranslationKeyElements.ListItem
23466
+ }) : void 0, [i18n, introductionScreen, legalEntityType]);
23320
23467
  return jsxs(Fragment, {
23321
23468
  children: [jsx("div", {
23322
- className: "adyen-kyc-task-intros__number",
23469
+ className: "adyen-kyc-introduction__number",
23323
23470
  children: number2
23324
23471
  }), jsx("div", {
23325
- className: "adyen-kyc-task-intros__title",
23326
- children: i18n.get(`taskIntro${toPascalCase(intro)}Title`)
23472
+ className: "adyen-kyc-introduction__title",
23473
+ children: i18n.get(`introductionScreen${toPascalCase(introductionScreen)}Title`)
23327
23474
  }), jsxs("div", {
23328
- className: "adyen-kyc-task-intros__description",
23329
- children: [paragraphKeys.map((key) => jsx("p", {
23475
+ className: "adyen-kyc-introduction__description",
23476
+ children: [!!(paragraphKeys == null ? void 0 : paragraphKeys.length) && paragraphKeys.map((key) => jsx("p", {
23330
23477
  children: i18n.get(key)
23331
- }, key)), !!listItemKeys.length && jsx("ul", {
23478
+ }, key)), !!(listItemKeys == null ? void 0 : listItemKeys.length) && jsx("ul", {
23332
23479
  children: listItemKeys.map((key) => jsx("li", {
23333
23480
  children: i18n.get(key)
23334
23481
  }, key))
@@ -23336,62 +23483,52 @@ const TaskIntro = ({
23336
23483
  })]
23337
23484
  });
23338
23485
  };
23339
- const taskIntrosInOrder = [
23340
- TaskTypes.COMPANY,
23341
- TaskTypes.DECISION_MAKER,
23342
- TaskTypes.INDIVIDUAL,
23343
- // TaskTypes.PAYIN,
23344
- TaskTypes.PAYOUT
23345
- ];
23346
- var ExtraIntroTypes = /* @__PURE__ */ ((ExtraIntroTypes2) => {
23347
- ExtraIntroTypes2["PROLOGUE"] = "prologue";
23348
- ExtraIntroTypes2["EPILOGUE"] = "epilogue";
23349
- return ExtraIntroTypes2;
23350
- })(ExtraIntroTypes || {});
23351
- const TaskIntros = ({
23352
- legalEntityType,
23353
- onExitIntro,
23486
+ const Introduction = ({
23487
+ legalEntity,
23488
+ onExitIntroduction,
23354
23489
  tasks
23355
23490
  }) => {
23356
23491
  const {
23357
23492
  i18n
23358
23493
  } = useI18nContext();
23494
+ const introductionScreens = useIntroductionScreens({
23495
+ legalEntity,
23496
+ tasks
23497
+ });
23359
23498
  const [activeIndex, setActiveIndex] = useState(0);
23360
- const taskIntros = useMemo(() => taskIntrosInOrder.filter((taskIntro) => tasks.some((t) => t === taskIntro)), [tasks]);
23361
- const allIntros = useMemo(() => (taskIntros == null ? void 0 : taskIntros.length) ? [ExtraIntroTypes.PROLOGUE, ...taskIntros, ExtraIntroTypes.EPILOGUE] : void 0, [taskIntros]);
23362
23499
  useEffect(() => {
23363
- if (!taskIntros.length)
23364
- onExitIntro();
23365
- }, [onExitIntro, taskIntros]);
23366
- return (allIntros == null ? void 0 : allIntros.length) ? jsxs("div", {
23367
- className: "adyen-kyc-task-intros",
23500
+ if (!(introductionScreens == null ? void 0 : introductionScreens.length))
23501
+ onExitIntroduction();
23502
+ }, [onExitIntroduction, introductionScreens]);
23503
+ return (introductionScreens == null ? void 0 : introductionScreens.length) ? jsxs("div", {
23504
+ className: "adyen-kyc-introduction",
23368
23505
  children: [jsx(StepProgressIndicator, {
23369
23506
  activeStepIndex: activeIndex,
23370
- stepsCount: allIntros.length
23507
+ stepsCount: introductionScreens.length
23371
23508
  }), jsx("div", {
23372
- className: "adyen-kyc-task-intros__skip",
23509
+ className: "adyen-kyc-introduction__skip",
23373
23510
  children: jsx(Button, {
23374
- label: i18n.get("goToOverviewFromIntro"),
23375
- onClick: () => onExitIntro(),
23511
+ label: i18n.get("goToOverviewFromIntroduction"),
23512
+ onClick: () => onExitIntroduction(),
23376
23513
  showAsLink: true,
23377
23514
  type: "button"
23378
23515
  })
23379
- }), jsx(TaskIntro, {
23380
- intro: allIntros[activeIndex],
23381
- legalEntityType,
23382
- number: activeIndex > 0 && activeIndex < allIntros.length - 1 ? activeIndex : void 0
23516
+ }), jsx(IntroductionScreen, {
23517
+ introductionScreen: introductionScreens[activeIndex],
23518
+ legalEntity,
23519
+ number: activeIndex > 0 && activeIndex < introductionScreens.length - 1 ? activeIndex : void 0
23383
23520
  // prologue and epilogue should not be numbered
23384
- }, allIntros[activeIndex]), jsxs("div", {
23385
- className: "adyen-kyc-task-intros__nav",
23521
+ }, introductionScreens[activeIndex]), jsxs("div", {
23522
+ className: "adyen-kyc-introduction__nav",
23386
23523
  children: [jsx(Button, {
23387
23524
  disabled: activeIndex === 0,
23388
23525
  label: "Back",
23389
23526
  onClick: () => setActiveIndex((currentValue) => currentValue - 1),
23390
23527
  secondary: true,
23391
23528
  type: "button"
23392
- }), activeIndex + 1 === allIntros.length ? jsx(Button, {
23529
+ }), activeIndex + 1 === introductionScreens.length ? jsx(Button, {
23393
23530
  label: "Start",
23394
- onClick: () => onExitIntro(),
23531
+ onClick: () => onExitIntroduction(),
23395
23532
  type: "button"
23396
23533
  }) : jsx(Button, {
23397
23534
  label: "Next",
@@ -23451,6 +23588,7 @@ const TaskListItem = ({
23451
23588
  tagline,
23452
23589
  icon,
23453
23590
  status,
23591
+ statusLabel,
23454
23592
  onNavigateToTask,
23455
23593
  disabled = false,
23456
23594
  problems,
@@ -23511,6 +23649,7 @@ const TaskListItem = ({
23511
23649
  className: "adyen-task-item__status",
23512
23650
  children: [jsx(TaskItemStatus, {
23513
23651
  status: isStatusRemoving ? TaskStatus.REMOVING : status,
23652
+ statusLabel,
23514
23653
  downloadHandler
23515
23654
  }), typeof removeEntity === "function" && typeof handleIsRemoveDisabled === "function" ? jsx("div", {
23516
23655
  className: "adyen-task-item__remove",
@@ -23613,9 +23752,9 @@ function TaskListComponent({
23613
23752
  const {
23614
23753
  isExperimentEnabled
23615
23754
  } = useExperimentsContext();
23616
- const {
23617
- canSeeIntro
23618
- } = useCanSeeIntro(legalEntityResponse);
23755
+ const canSeeIntroduction = useCanSeeIntroduction({
23756
+ legalEntity: legalEntityResponse
23757
+ });
23619
23758
  const {
23620
23759
  remediationMessages
23621
23760
  } = useDataMissingRemediations({
@@ -23657,11 +23796,11 @@ function TaskListComponent({
23657
23796
  const companyTaskDescriptionKey = isReview ? "businessAccountDetailsDescriptionReview" : "businessAccountDetailsDescription";
23658
23797
  const payoutTaskDescriptionKey = isReview ? "payoutAccountsDescriptionReview" : "payoutAccountsDescription";
23659
23798
  return jsxs("div", {
23660
- children: [canSeeIntro && jsx("div", {
23799
+ children: [canSeeIntroduction && jsx("div", {
23661
23800
  className: "adyen-task-list__nav",
23662
23801
  children: jsx(Button, {
23663
- label: i18n.get("goToIntro"),
23664
- onClick: () => onNavigateToTask(TaskTypes.INTRO),
23802
+ label: i18n.get("goToIntroduction"),
23803
+ onClick: () => onNavigateToTask(TaskTypes.INTRODUCTION),
23665
23804
  showAsLink: true,
23666
23805
  type: "button"
23667
23806
  })
@@ -23775,6 +23914,7 @@ function TaskListComponent({
23775
23914
  icon: "pci",
23776
23915
  title: i18n.get("pciDssQuestionnaire"),
23777
23916
  status: canDownloadPci ? TaskStatus.DOWNLOAD : TaskStatus.SIGN,
23917
+ statusLabel: canDownloadPci && i18n.get("downloadACopy"),
23778
23918
  downloadHandler: onPciDownload,
23779
23919
  disabled: isPciTaskDisabled,
23780
23920
  info: isPciTaskDisabled && !canDownloadPci ? i18n.get("requiresDecisionMakers") : null
@@ -23942,12 +24082,33 @@ const RegularTrustMemberTaskItem = ({
23942
24082
  };
23943
24083
  const RootTrusteeTaskItem = ({
23944
24084
  rootTrustee,
23945
- taskStatus
23946
- }) => jsx(EntityAssociation, {
23947
- types: [TrustMemberTypes.TRUSTEE],
23948
- name: rootTrustee.name,
23949
- status: taskStatus
23950
- }, rootTrustee.legalEntityId);
24085
+ taskStatus,
24086
+ onEdit
24087
+ }) => {
24088
+ const {
24089
+ i18n
24090
+ } = useI18nContext();
24091
+ const actions = [{
24092
+ icon: "edit",
24093
+ onSelect: onEdit,
24094
+ label: i18n.get("editEntityDetails"),
24095
+ title: i18n.get("editTrustMember", {
24096
+ values: {
24097
+ trustMember: rootTrustee.name
24098
+ }
24099
+ })
24100
+ }];
24101
+ const {
24102
+ isExperimentEnabled
24103
+ } = useExperimentsContext();
24104
+ const isAllowMoreRolesForMainRootTrustee = isExperimentEnabled("AllowMoreRolesForMainRootTrustee");
24105
+ return jsx(EntityAssociation, {
24106
+ types: isExperimentEnabled("AllowMoreRolesForMainRootTrustee") ? rootTrustee.roles : [TrustMemberTypes.TRUSTEE],
24107
+ name: rootTrustee.name,
24108
+ status: taskStatus,
24109
+ actions: isAllowMoreRolesForMainRootTrustee ? actions : void 0
24110
+ });
24111
+ };
23951
24112
  const UndefinedBeneficiaryTaskItem = ({
23952
24113
  undefinedBeneficiary: undefinedBeneficiary2,
23953
24114
  onEdit,
@@ -23998,6 +24159,10 @@ const TrustMembersOverview = ({
23998
24159
  const trustMembersWithOneOfGivenRoles = (roleTypes) => trustMembers2.filter(({
23999
24160
  roles
24000
24161
  }) => roleTypes.some((label) => roles.includes(label)));
24162
+ const {
24163
+ isExperimentEnabled
24164
+ } = useExperimentsContext();
24165
+ const allowMoreRolesForMainRootTrustee = isExperimentEnabled("AllowMoreRolesForMainRootTrustee");
24001
24166
  return jsx(DropinLayout, {
24002
24167
  content: jsxs("div", {
24003
24168
  className: "adl-trust-members adl-u-width-full",
@@ -24038,15 +24203,17 @@ const TrustMembersOverview = ({
24038
24203
  case "rootTrustee":
24039
24204
  return jsx(RootTrusteeTaskItem, {
24040
24205
  rootTrustee: trustMember,
24041
- taskStatus: getTrustMemberTaskStatus(trustMember)
24042
- });
24206
+ taskStatus: getTrustMemberTaskStatus(trustMember),
24207
+ onEdit: allowMoreRolesForMainRootTrustee ? () => navigateToEditTrustMember(trustMember) : () => {
24208
+ }
24209
+ }, trustMember.legalEntityId);
24043
24210
  case "regular":
24044
24211
  return jsx(RegularTrustMemberTaskItem, {
24045
24212
  trustMember,
24046
24213
  taskStatus: getTrustMemberTaskStatus(trustMember),
24047
24214
  onEdit: () => navigateToEditTrustMember(trustMember),
24048
24215
  onDelete: () => deleteTrustMember(trustMember)
24049
- });
24216
+ }, trustMember.legalEntityId);
24050
24217
  case "company":
24051
24218
  return jsx(CompanyTrustMemberTaskItem, {
24052
24219
  companyTrustMember: trustMember,
@@ -24055,20 +24222,20 @@ const TrustMembersOverview = ({
24055
24222
  onDelete: () => deleteTrustMember(trustMember),
24056
24223
  onEditOwner: () => navigateToEditTrustMemberOwner(trustMember.ownerId, trustMember.legalEntityId),
24057
24224
  onAddOwner: () => navigateToEditTrustMemberOwner("", trustMember.legalEntityId)
24058
- });
24225
+ }, trustMember.legalEntityId);
24059
24226
  case "exemptSettlor":
24060
24227
  return jsx(ExemptSettlorTaskItem, {
24061
24228
  exemptSettlor: trustMember,
24062
24229
  taskStatus: getTrustMemberTaskStatus(trustMember),
24063
24230
  onEdit: () => navigateToEditTrustMember(trustMember),
24064
24231
  onDelete: () => deleteTrustMember(trustMember)
24065
- });
24232
+ }, trustMember.legalEntityId);
24066
24233
  case "undefinedBeneficiary":
24067
24234
  return jsx(UndefinedBeneficiaryTaskItem, {
24068
24235
  undefinedBeneficiary: trustMember,
24069
24236
  onEdit: () => navigateToEditTrustMember(trustMember),
24070
24237
  onDelete: () => deleteTrustMember(trustMember)
24071
- });
24238
+ }, trustMember.reference);
24072
24239
  }
24073
24240
  })
24074
24241
  }), jsx(Button, {
@@ -25575,6 +25742,7 @@ const convertExistingTrustMember = (trustMember) => {
25575
25742
  };
25576
25743
  case "rootTrustee":
25577
25744
  return {
25745
+ trustMemberType: trustMember.trustMemberType,
25578
25746
  entityType: trustMember.legalEntityType,
25579
25747
  role: trustMember.roles,
25580
25748
  settlorExemptionReason: ["noneOfTheAbove"]
@@ -25591,6 +25759,12 @@ const convertExistingTrustMember = (trustMember) => {
25591
25759
  };
25592
25760
  }
25593
25761
  };
25762
+ const convertRootTrusteeTrustMember = (trustMember) => ({
25763
+ trustMemberType: trustMember.trustMemberType,
25764
+ entityType: trustMember.legalEntityType,
25765
+ role: trustMember.roles,
25766
+ settlorExemptionReason: ["noneOfTheAbove"]
25767
+ });
25594
25768
  const allowedCrossoverRolesMatrix = {
25595
25769
  settlor: ["secondaryTrustee", "protector"],
25596
25770
  secondaryTrustee: ["settlor", "protector", "definedBeneficiary"],
@@ -25598,6 +25772,67 @@ const allowedCrossoverRolesMatrix = {
25598
25772
  definedBeneficiary: ["secondaryTrustee", "protector"],
25599
25773
  undefinedBeneficiary: []
25600
25774
  };
25775
+ const allowedCrossoverRolesMatrixByTrustMemberAndLegalEntityType = {
25776
+ rootTrustee: {
25777
+ [LegalEntityType.INDIVIDUAL]: {
25778
+ settlor: ["secondaryTrustee", "protector"],
25779
+ secondaryTrustee: ["settlor", "protector", "definedBeneficiary"],
25780
+ protector: ["settlor", "secondaryTrustee", "definedBeneficiary"],
25781
+ definedBeneficiary: ["secondaryTrustee", "protector"],
25782
+ undefinedBeneficiary: []
25783
+ },
25784
+ [LegalEntityType.ORGANIZATION]: {
25785
+ settlor: ["secondaryTrustee", "protector"],
25786
+ secondaryTrustee: ["settlor", "protector"],
25787
+ protector: ["settlor", "secondaryTrustee"],
25788
+ definedBeneficiary: [],
25789
+ undefinedBeneficiary: []
25790
+ }
25791
+ }
25792
+ };
25793
+ const getAllowedCrossoverRolesMatrixByTrustMemberAndLegalEntityType = (trustMember) => {
25794
+ const {
25795
+ trustMemberType
25796
+ } = trustMember;
25797
+ if (trustMemberType === "undefinedBeneficiary") {
25798
+ return allowedCrossoverRolesMatrix;
25799
+ }
25800
+ const crossoverRolesByTrustMember = allowedCrossoverRolesMatrixByTrustMemberAndLegalEntityType[trustMemberType];
25801
+ if (!crossoverRolesByTrustMember) {
25802
+ return allowedCrossoverRolesMatrix;
25803
+ }
25804
+ const crossoverRoles = crossoverRolesByTrustMember[trustMember.legalEntityType];
25805
+ if (!crossoverRoles) {
25806
+ return allowedCrossoverRolesMatrix;
25807
+ }
25808
+ return crossoverRoles;
25809
+ };
25810
+ const availablesRolesByTrustMemberTypeAndLegalEntityType = {
25811
+ rootTrustee: {
25812
+ [LegalEntityType.INDIVIDUAL]: ["settlor", "protector", "definedBeneficiary"],
25813
+ [LegalEntityType.ORGANIZATION]: ["settlor", "protector"]
25814
+ }
25815
+ };
25816
+ const getAvailableRolesByTrustMemberTypeAndLegalEntityType = (currentRoles, trustMember) => {
25817
+ if (!(currentRoles == null ? void 0 : currentRoles.length)) {
25818
+ const {
25819
+ trustMemberType,
25820
+ legalEntityType
25821
+ } = trustMember;
25822
+ const availableRolesByTrustMemberType = availablesRolesByTrustMemberTypeAndLegalEntityType[trustMemberType];
25823
+ if (!availableRolesByTrustMemberType) {
25824
+ return Object.values(TrustMemberTypes);
25825
+ }
25826
+ const availableRoles = availableRolesByTrustMemberType[legalEntityType];
25827
+ if (!availableRoles) {
25828
+ return Object.values(TrustMemberTypes);
25829
+ }
25830
+ return availableRoles;
25831
+ }
25832
+ const crossoverRolesMatrix = trustMember ? getAllowedCrossoverRolesMatrixByTrustMemberAndLegalEntityType(trustMember) : allowedCrossoverRolesMatrix;
25833
+ const roles = currentRoles.map((role2) => [role2, ...crossoverRolesMatrix[role2]]).reduce((existingAllowed, allowedForRole) => existingAllowed.filter((role2) => allowedForRole.includes(role2)));
25834
+ return roles.filter((r) => r !== "secondaryTrustee");
25835
+ };
25601
25836
  const getAvailableRoles = (currentRoles) => {
25602
25837
  if (!(currentRoles == null ? void 0 : currentRoles.length))
25603
25838
  return Object.values(TrustMemberTypes);
@@ -25660,6 +25895,15 @@ const leTypeCardDetails = {
25660
25895
  description: "businessEntityDescription"
25661
25896
  }
25662
25897
  };
25898
+ const convertExistingTrustMemberToDefaultData = (trustMember, allowMoreRolesForMainRootTrusteeEnabled) => {
25899
+ if (!trustMember) {
25900
+ return {};
25901
+ }
25902
+ if (allowMoreRolesForMainRootTrusteeEnabled && trustMember.trustMemberType === "rootTrustee") {
25903
+ return convertRootTrusteeTrustMember(trustMember);
25904
+ }
25905
+ return convertExistingTrustMember(trustMember);
25906
+ };
25663
25907
  const TrustRoleAndEntityType = (props) => {
25664
25908
  const {
25665
25909
  existingTrustMember,
@@ -25670,7 +25914,11 @@ const TrustRoleAndEntityType = (props) => {
25670
25914
  const {
25671
25915
  i18n
25672
25916
  } = useI18nContext();
25673
- const defaultData = existingTrustMember ? convertExistingTrustMember(existingTrustMember) : {};
25917
+ const {
25918
+ isExperimentEnabled
25919
+ } = useExperimentsContext();
25920
+ const allowMoreRolesForMainRootTrusteeEnabled = isExperimentEnabled("AllowMoreRolesForMainRootTrustee");
25921
+ const defaultData = convertExistingTrustMemberToDefaultData(existingTrustMember, allowMoreRolesForMainRootTrusteeEnabled);
25674
25922
  const formUtils = formUtilities(props, i18n);
25675
25923
  const decideFields = (data2) => {
25676
25924
  var _a, _b;
@@ -25684,7 +25932,7 @@ const TrustRoleAndEntityType = (props) => {
25684
25932
  if (couldBeExemptSettlor(data2)) {
25685
25933
  return isExemptSettlor(data2) ? ["role", "entityType", "settlorExemptionReason", "firstName", "lastName"] : ["role", "entityType", "settlorExemptionReason"];
25686
25934
  }
25687
- return ["role", "entityType"];
25935
+ return allowMoreRolesForMainRootTrusteeEnabled ? ["role", "entityType", "trustMemberType"] : ["role", "entityType"];
25688
25936
  }
25689
25937
  return ["role"];
25690
25938
  };
@@ -25706,7 +25954,7 @@ const TrustRoleAndEntityType = (props) => {
25706
25954
  defaultData,
25707
25955
  fieldProblems: props == null ? void 0 : props.fieldValidationErrors
25708
25956
  });
25709
- const availableRoles = getAvailableRoles(data.role);
25957
+ const availableRoles = allowMoreRolesForMainRootTrusteeEnabled && (existingTrustMember == null ? void 0 : existingTrustMember.trustMemberType) === "rootTrustee" ? getAvailableRolesByTrustMemberTypeAndLegalEntityType(data.role, existingTrustMember) : getAvailableRoles(data.role);
25710
25958
  useEffect(() => {
25711
25959
  (async () => {
25712
25960
  var _a;
@@ -25852,7 +26100,7 @@ const TrustRoleAndEntityType = (props) => {
25852
26100
  name: i18n.get(reason)
25853
26101
  })
25854
26102
  })
25855
- }), (schema == null ? void 0 : schema.includes("firstName")) || schema.includes("lastName") ? jsx(Name, {
26103
+ }), data.trustMemberType !== "rootTrustee" && (schema.includes("firstName") || schema.includes("lastName")) ? jsx(Name, {
25856
26104
  ...nameProps,
25857
26105
  data: {
25858
26106
  firstName: defaultData.firstName,
@@ -25932,6 +26180,7 @@ const decideForms = (trustMember) => {
25932
26180
  case "exemptSettlor":
25933
26181
  return exemptSettlorForms;
25934
26182
  case "rootTrustee":
26183
+ return exemptSettlorForms;
25935
26184
  case "regular":
25936
26185
  case "company":
25937
26186
  return regularForms;
@@ -25940,6 +26189,15 @@ const decideForms = (trustMember) => {
25940
26189
  const convertDataToTrustMember = (data, existingTrustMember, isOrganizationSettlorWithExemptionReasonEnabled2 = false) => {
25941
26190
  var _a;
25942
26191
  const existingId = existingTrustMember ? existingTrustMember.trustMemberType === "undefinedBeneficiary" ? existingTrustMember.reference : existingTrustMember.legalEntityId : void 0;
26192
+ if (data.trustMemberType === "rootTrustee") {
26193
+ return {
26194
+ trustMemberType: "rootTrustee",
26195
+ roles: data.role ?? [],
26196
+ legalEntityType: data.entityType ?? LegalEntityType.ORGANIZATION,
26197
+ legalEntityId: "",
26198
+ name: data.firstName ?? ""
26199
+ };
26200
+ }
25943
26201
  if ((_a = data.role) == null ? void 0 : _a.length) {
25944
26202
  if (isExemptSettlor(data)) {
25945
26203
  if (isOrganizationSettlorWithExemptionReasonEnabled2 && data.entityType === LegalEntityType.ORGANIZATION) {
@@ -27550,18 +27808,22 @@ function DropinComposerComponent({
27550
27808
  const [isLoadingConfiguration, setIsLoadingConfiguration] = useState(false);
27551
27809
  const [pollingId, setPollingId] = useState(null);
27552
27810
  const showBusinessTypeSelection = useShouldShowBusinessTypeSelection(accountHolder2);
27553
- const showIntro = useShouldShowIntro(legalEntityResponse);
27811
+ const showIntroduction = useShouldShowIntroduction({
27812
+ legalEntity: legalEntityResponse
27813
+ });
27554
27814
  const {
27555
- setHasSeenIntro
27556
- } = useHasSeenIntro(legalEntityResponse.id);
27815
+ setHasSeenIntroduction
27816
+ } = useHasSeenIntroduction({
27817
+ legalEntityId: legalEntityResponse.id
27818
+ });
27557
27819
  const [tasks, setTasks] = useState([]);
27558
27820
  const initialTask = useMemo(() => {
27559
27821
  if (showBusinessTypeSelection)
27560
27822
  return TaskTypes.BUSINESS_TYPE_SELECTION;
27561
- if (showIntro)
27562
- return TaskTypes.INTRO;
27823
+ if (showIntroduction)
27824
+ return TaskTypes.INTRODUCTION;
27563
27825
  return TaskTypes.TASKS_OVERVIEW;
27564
- }, [showBusinessTypeSelection, showIntro]);
27826
+ }, [showBusinessTypeSelection, showIntroduction]);
27565
27827
  const [taskHistory, setTaskHistory] = useState([initialTask]);
27566
27828
  const [legalEntity, setLegalEntity] = useState(legalEntityResponse);
27567
27829
  const [associatedLegalEntity, setAssociatedLegalEntity] = useState(null);
@@ -27586,6 +27848,7 @@ function DropinComposerComponent({
27586
27848
  const reviewRequired = (legalEntity == null ? void 0 : legalEntity.id) && ((_d = (_c = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _c[legalEntity.id]) == null ? void 0 : _d.isReviewRequired);
27587
27849
  const additionalSalesChannels = useSalesChannelsSettings();
27588
27850
  const isOrganizationSettlorWithExemptionEnabled = isOrganizationSettlorWithExemptionReasonEnabled(isExperimentEnabled("AllowOrganizationSettlorWithExemptionReason"), trust2 == null ? void 0 : trust2.trust.countryOfGoverningLaw);
27851
+ const allowMoreRolesForMainRootTrustee = isExperimentEnabled("AllowMoreRolesForMainRootTrustee");
27589
27852
  const getLegalEntityProblems = (le) => {
27590
27853
  var _a2;
27591
27854
  if (le == null ? void 0 : le.id) {
@@ -27812,6 +28075,15 @@ function DropinComposerComponent({
27812
28075
  });
27813
28076
  break;
27814
28077
  case "rootTrustee":
28078
+ if (allowMoreRolesForMainRootTrustee && existing) {
28079
+ existing.roles = updated.roles;
28080
+ await updateRootTrusteeTrustMember({
28081
+ trustMember: existing,
28082
+ trust: trust2,
28083
+ handleUpdateLegalEntity: args.handleUpdateLegalEntity
28084
+ });
28085
+ }
28086
+ break;
27815
28087
  default:
27816
28088
  logger$5.warn(`Updating trust member type "${trustMember.trustMemberType}" is not implemented.`);
27817
28089
  }
@@ -28094,14 +28366,14 @@ function DropinComposerComponent({
28094
28366
  onAccountHolderSelect: async (newAccountHolder) => {
28095
28367
  setAccountHolder(newAccountHolder);
28096
28368
  await refreshLegalEntity();
28097
- onNavigateTo(showIntro ? TaskTypes.INTRO : TaskTypes.TASKS_OVERVIEW);
28369
+ onNavigateTo(showIntroduction ? TaskTypes.INTRODUCTION : TaskTypes.TASKS_OVERVIEW);
28098
28370
  }
28099
28371
  });
28100
- case TaskTypes.INTRO:
28101
- return jsx(TaskIntros, {
28102
- legalEntityType: legalEntity.type,
28103
- onExitIntro: () => {
28104
- setHasSeenIntro(true);
28372
+ case TaskTypes.INTRODUCTION:
28373
+ return jsx(Introduction, {
28374
+ legalEntity,
28375
+ onExitIntroduction: () => {
28376
+ setHasSeenIntroduction(true);
28105
28377
  onNavigateTo(TaskTypes.TASKS_OVERVIEW);
28106
28378
  },
28107
28379
  tasks
@@ -28327,7 +28599,7 @@ function DropinComposerComponent({
28327
28599
  });
28328
28600
  case TaskTypes.TRUST_MEMBER_OVERVIEW:
28329
28601
  return jsx(TrustMembersOverview, {
28330
- trustMembers: getTrustMembers(trust2, legalEntity, exemptSettlor),
28602
+ trustMembers: allowMoreRolesForMainRootTrustee ? getRootTrusteeTrustMembers(trust2, legalEntity, exemptSettlor) : getTrustMembers(trust2, legalEntity, exemptSettlor),
28331
28603
  getTrustMemberTaskStatus: (member) => getTaskStatus(EntityType.LEGAL_ENTITY, capabilityProblems, legalEntity, member.trustMemberType === "undefinedBeneficiary" ? void 0 : [member.legalEntityId]),
28332
28604
  navigateBackToTaskList: navigateBack,
28333
28605
  navigateToEditTrustMember: onNavigateToTrustMemberRoleAndType,
@@ -29316,6 +29588,10 @@ const I18nProvider = ({
29316
29588
  const settingsDefaults = {
29317
29589
  changeLegalEntityType: true,
29318
29590
  editPrefilledCountry: true,
29591
+ hideOnboardingIntroductionIndividual: true,
29592
+ hideOnboardingIntroductionOrganization: true,
29593
+ hideOnboardingIntroductionTrust: true,
29594
+ hideOnboardingIntroductionSoleProprietor: true,
29319
29595
  viewOnboardingGuidance: false
29320
29596
  };
29321
29597
  function SettingsContextProvider({