@adyen/kyc-components 3.21.4 → 3.22.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.
Files changed (72) hide show
  1. package/dist/es/adyen-kyc-components.es.js +1820 -947
  2. package/dist/es/{arrow-right-DF4Qe-8E.js → arrow-right-C4o8oS1C.js} +1 -1
  3. package/dist/es/{chevron-down-BzENwYSf.js → chevron-down-C8-1xmDI.js} +1 -1
  4. package/dist/es/chevron-left-DSyI3arz.js +11 -0
  5. package/dist/es/{chevron-right-DczMHcvL.js → chevron-right-BDZzxAre.js} +1 -1
  6. package/dist/es/{cross-BadGfrgB.js → cross-D-SQig6J.js} +1 -1
  7. package/dist/es/{download-DGC5_Bxe.js → download-COfxdarq.js} +1 -1
  8. package/dist/style.css +380 -2145
  9. package/dist/types/components/AdditionalInformation/VerifiedBusinessCard.d.ts +7 -0
  10. package/dist/types/components/AdditionalInformation/component/AdditionalInformationComponent.d.ts +1 -1
  11. package/dist/types/components/AdditionalInformation/types.d.ts +4 -0
  12. package/dist/types/components/BasicInformation/component/BasicInformationComponent.d.ts +1 -1
  13. package/dist/types/components/BasicInformation/types.d.ts +2 -8
  14. package/dist/types/components/BusinessDetails/component/BusinessDetailsComponent.d.ts +1 -0
  15. package/dist/types/components/BusinessDetails/forms.d.ts +1 -2
  16. package/dist/types/components/BusinessDetails/types.d.ts +15 -0
  17. package/dist/types/components/BusinessSelection/BusinessInformationCard.d.ts +16 -0
  18. package/dist/types/components/BusinessSelection/component/BusinessSelectionComponent.d.ts +3 -0
  19. package/dist/types/components/BusinessSelection/index.d.ts +1 -0
  20. package/dist/types/components/BusinessSelection/types.d.ts +25 -0
  21. package/dist/types/components/CompanyStructure/component/CompanyStructureComponent.d.ts +1 -1
  22. package/dist/types/components/CompanyStructure/types.d.ts +3 -0
  23. package/dist/types/components/Dropins/BusinessDetailsDropin/types.d.ts +2 -1
  24. package/dist/types/components/Dropins/DropinLayout/ActionBar/ActionBar.d.ts +1 -1
  25. package/dist/types/components/Dropins/DropinLayout/ActionBar/type.d.ts +1 -0
  26. package/dist/types/components/Dropins/FormNavigation/FormNavigation.d.ts +1 -2
  27. package/dist/types/components/Dropins/FormNavigation/index.d.ts +1 -1
  28. package/dist/types/components/Dropins/FormWrapper/FormWrapper.d.ts +3 -1
  29. package/dist/types/components/Individual/validators.d.ts +1 -2
  30. package/dist/types/components/RegistrationAddress/types.d.ts +2 -0
  31. package/dist/types/components/UIElement/UIElement.d.ts +22 -0
  32. package/dist/types/components/internal/Address/components/SearchAddress.d.ts +1 -1
  33. package/dist/types/components/internal/Address/types.d.ts +3 -0
  34. package/dist/types/components/internal/Alert/Alert.d.ts +1 -1
  35. package/dist/types/components/internal/Alert/types.d.ts +4 -7
  36. package/dist/types/components/internal/Card/Card.d.ts +1 -1
  37. package/dist/types/components/internal/Card/CardGroup.d.ts +1 -1
  38. package/dist/types/components/internal/Card/index.d.ts +2 -0
  39. package/dist/types/components/internal/Card/types.d.ts +2 -0
  40. package/dist/types/components/internal/DBANameField/DBANameField.d.ts +1 -1
  41. package/dist/types/components/internal/DBANameField/fieldConfig.d.ts +1 -0
  42. package/dist/types/components/internal/DBANameField/types.d.ts +1 -1
  43. package/dist/types/components/internal/Icon/Icon.d.ts +1 -0
  44. package/dist/types/components/internal/Link/Link.d.ts +1 -1
  45. package/dist/types/components/internal/Link/types.d.ts +0 -3
  46. package/dist/types/components/internal/Loader/Loader.d.ts +7 -9
  47. package/dist/types/components/internal/LoaderWrapper/LoaderWrapper.d.ts +1 -2
  48. package/dist/types/core/Context/CoreContext.d.ts +2 -0
  49. package/dist/types/core/Services/componentApi/confirm-data-review.d.ts +3 -0
  50. package/dist/types/core/Services/componentApi/get-accepted-service-agreement.d.ts +3 -0
  51. package/dist/types/core/core.d.ts +1 -1
  52. package/dist/types/core/hooks/useBankConfigurationHandlers.d.ts +3 -1
  53. package/dist/types/core/hooks/useComponentApi.d.ts +4 -0
  54. package/dist/types/core/hooks/useForm/reducer.d.ts +4 -2
  55. package/dist/types/core/hooks/useForm/types.d.ts +11 -0
  56. package/dist/types/core/hooks/useForm/useForm.d.ts +2 -1
  57. package/dist/types/core/hooks/useIdVerificationToken.d.ts +1 -0
  58. package/dist/types/core/hooks/useUnifyLoadingStatus.d.ts +2 -0
  59. package/dist/types/core/models/api/company-search.d.ts +1 -0
  60. package/dist/types/core/models/api/contracts.d.ts +2 -1
  61. package/dist/types/core/models/api/instant-id-verification.d.ts +1 -0
  62. package/dist/types/core/models/api/organization.d.ts +1 -0
  63. package/dist/types/core/models/country-code.d.ts +1 -0
  64. package/dist/types/core/process-field-configurations.d.ts +3 -2
  65. package/dist/types/utils/birth-date-utils.d.ts +11 -0
  66. package/dist/types/utils/mapping/componentApiMapping.d.ts +1 -0
  67. package/dist/types/utils/regex/patternValidators.d.ts +1 -1
  68. package/dist/types/utils/testing/IgnoreLocalStorage.d.ts +5 -0
  69. package/package.json +13 -1
  70. package/dist/types/components/UIElement.d.ts +0 -22
  71. package/dist/types/components/internal/Loader/index.d.ts +0 -2
  72. package/dist/types/components/internal/Spinner/Spinner.d.ts +0 -16
@@ -431,7 +431,7 @@ const invalidDateOfIncorporation = "Please enter a valid date of incorporation";
431
431
  const successfullyUpdatedDetails = "Successfully updated details";
432
432
  const failedToUpdateDetails = "Failed to update details";
433
433
  const idDocumentAlreadyUploaded = "Identity document has already been uploaded or is too large; try another";
434
- const bankStatementAlreadyUploaded = "Bank statement has already been uploaded, is too large, or the the account has already been added; try another";
434
+ const bankStatementAlreadyUploaded = "Bank statement has already been uploaded, is too large, or the account has already been added; try another";
435
435
  const successfullyVerifiedIdNumber = "Successfully verified %{idNumber}";
436
436
  const failedFetchingDecisionMaker = "Failed to get decision maker details";
437
437
  const fileUpload = "File upload";
@@ -982,12 +982,23 @@ const companyRegistrationDocumentFormDescription = "We need an official document
982
982
  const companyTaxDocumentFormName = "Tax document";
983
983
  const companyTaxDocumentFormHeading = "Upload a tax document";
984
984
  const companyTaxDocumentFormDescription = "We need an official document to verify your organization’s tax details.";
985
- const basicInformationFormName = "Basic information";
986
- const basicInformationFormHeading = "Basic information about your business";
987
- const basicInformationFormDescription = "To get started, fill in some information about your business so we can get you verified post-haste.";
988
- const additionalInformationFormName = "Additional information";
989
- const additionalInformationFormHeading = "Additional information about your business";
990
- const additionalInformationFormDescription = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus id dolor feugiat, suscipit lacus id, semper ante. Vestibulum scelerisque condimentum dolor, in consectetur odio eleifend sed.";
985
+ const businessSelection__heading = "Select your business";
986
+ const businessSelection__searching = "We're searching for your business - this can take a few moments";
987
+ const businessSelection__verifying = "We're processing your business details";
988
+ const businessSelection__footer = "Can't find your business?";
989
+ const businessSelection__footerButton = "Add details manually";
990
+ const businessSelection__invalidTin = "This company's TIN doesn't match yours";
991
+ const businessSelection__failedToLoad = "Business details failed to load";
992
+ const legalForm = "Legal form";
993
+ const thisIsMyBusiness = "This is my business";
994
+ const basicInformationFormName = "Basic details";
995
+ const basicInformationFormHeading = "Basic details about your business";
996
+ const additionalInformationFormName = "Additional details";
997
+ const additionalInformationFormHeading = "Additional business details";
998
+ const additionalInformationFormDescription = "To continue, we need to know a little bit more about your business and it's operations. ";
999
+ const showDetails = "Show details";
1000
+ const hideDetails = "Hide details";
1001
+ const showOnMap = "Show on map";
991
1002
  const errorMessage_1_10 = "Information couldn’t be verified";
992
1003
  const errorMessage_1_11 = "Document didn’t meet requirements";
993
1004
  const errorMessage_1_12 = "Legal entity declined";
@@ -1355,7 +1366,6 @@ const bankDetailsBeingProcessed = "Your bank details are being processed at the
1355
1366
  const bankDetailsVerified = "Your bank details are verified and you are ready to use it.";
1356
1367
  const bankDetailsNotVerified = "Bank account details couldn't be verified. Review the information to see what needs to be adjusted.";
1357
1368
  const unableToProceedUsingFunctionality = "Unfortunately you are unable to proceed using this functionality.";
1358
- const showDetails = "Show details";
1359
1369
  const missingDetailsToPerformPayouts = "We are missing some details in order to perform payouts, please add it.";
1360
1370
  const completeAddingAccount = "Complete adding account";
1361
1371
  const removeThisBankAccount = "Remove this bank account";
@@ -1404,6 +1414,8 @@ const ultimateParentCompanyInformation = "Ultimate parent company information";
1404
1414
  const inThePreviousStepOwnedByAnUltimateParentCompany = "In a previous step, you indicated that your business’ parent company was owned by an ultimate parent company. We need to know some information about this company before submitting your application.";
1405
1415
  const doesThisCompanyHaveLEI = "Does this company have a Legal Entity Identifier (LEI)?";
1406
1416
  const iDontKnow = "I don't know";
1417
+ const becauseYoureUnderXWeNeedToCollectInformationAboutALegalRepresentative = "Because you're under %{age}, we need to collect information about a legal representative in another step";
1418
+ const aLegalRepresentativeIsRequired = "A legal representative is required";
1407
1419
  const defaultTrans = {
1408
1420
  smartling,
1409
1421
  close,
@@ -2356,12 +2368,23 @@ const defaultTrans = {
2356
2368
  companyTaxDocumentFormName,
2357
2369
  companyTaxDocumentFormHeading,
2358
2370
  companyTaxDocumentFormDescription,
2371
+ businessSelection__heading,
2372
+ businessSelection__searching,
2373
+ businessSelection__verifying,
2374
+ businessSelection__footer,
2375
+ businessSelection__footerButton,
2376
+ businessSelection__invalidTin,
2377
+ businessSelection__failedToLoad,
2378
+ legalForm,
2379
+ thisIsMyBusiness,
2359
2380
  basicInformationFormName,
2360
2381
  basicInformationFormHeading,
2361
- basicInformationFormDescription,
2362
2382
  additionalInformationFormName,
2363
2383
  additionalInformationFormHeading,
2364
2384
  additionalInformationFormDescription,
2385
+ showDetails,
2386
+ hideDetails,
2387
+ showOnMap,
2365
2388
  errorMessage_1_10,
2366
2389
  errorMessage_1_11,
2367
2390
  errorMessage_1_12,
@@ -2729,7 +2752,6 @@ const defaultTrans = {
2729
2752
  bankDetailsVerified,
2730
2753
  bankDetailsNotVerified,
2731
2754
  unableToProceedUsingFunctionality,
2732
- showDetails,
2733
2755
  missingDetailsToPerformPayouts,
2734
2756
  completeAddingAccount,
2735
2757
  removeThisBankAccount,
@@ -2779,7 +2801,9 @@ const defaultTrans = {
2779
2801
  ultimateParentCompanyInformation,
2780
2802
  inThePreviousStepOwnedByAnUltimateParentCompany,
2781
2803
  doesThisCompanyHaveLEI,
2782
- iDontKnow
2804
+ iDontKnow,
2805
+ becauseYoureUnderXWeNeedToCollectInformationAboutALegalRepresentative,
2806
+ aLegalRepresentativeIsRequired
2783
2807
  };
2784
2808
  const FALLBACK_LOCALE = "en-US";
2785
2809
  const defaultTranslation = Object.entries(defaultTrans).reduce((acc, [translationKey, translationValue]) => translationKey !== "smartling" ? {
@@ -3218,22 +3242,23 @@ const createLogger = (namespace) => {
3218
3242
  };
3219
3243
  const icons = {
3220
3244
  "arrow-left": lazy(() => import("./arrow-left-CCxYxfCP.js")),
3221
- "arrow-right": lazy(() => import("./arrow-right-DF4Qe-8E.js")),
3245
+ "arrow-right": lazy(() => import("./arrow-right-C4o8oS1C.js")),
3222
3246
  bin: lazy(() => import("./bin-CGwewvcn.js")),
3223
3247
  check: lazy(() => import("./check-CeSLN4_9.js")),
3224
3248
  checkmark: lazy(() => import("./checkmark-DEh9MPYR.js")),
3225
3249
  "checkmark-small": lazy(() => import("./checkmark-small-D_9HLctx.js")),
3226
- "chevron-down": lazy(() => import("./chevron-down-BzENwYSf.js")),
3227
- "chevron-right": lazy(() => import("./chevron-right-DczMHcvL.js")),
3250
+ "chevron-down": lazy(() => import("./chevron-down-C8-1xmDI.js")),
3251
+ "chevron-right": lazy(() => import("./chevron-right-BDZzxAre.js")),
3252
+ "chevron-left": lazy(() => import("./chevron-left-DSyI3arz.js")),
3228
3253
  "chevron-up": lazy(() => import("./chevron-up-BLtnROd5.js")),
3229
3254
  company: lazy(() => import("./company-D5_F_6SW.js")),
3230
3255
  "company-2": lazy(() => import("./company-2-JG34IScE.js")),
3231
3256
  contract: lazy(() => import("./contract-C6wDy9zU.js")),
3232
3257
  "controlling-person": lazy(() => import("./controlling-person-C4KoSyi2.js")),
3233
- cross: lazy(() => import("./cross-BadGfrgB.js")),
3258
+ cross: lazy(() => import("./cross-D-SQig6J.js")),
3234
3259
  "decision-maker": lazy(() => import("./decision-maker-Cef3-OzY.js")),
3235
3260
  document: lazy(() => import("./document-Cg4kZHpA.js")),
3236
- download: lazy(() => import("./download-DGC5_Bxe.js")),
3261
+ download: lazy(() => import("./download-COfxdarq.js")),
3237
3262
  edit: lazy(() => import("./edit--fDhojib.js")),
3238
3263
  "field-error": lazy(() => import("./field-error-WElEN1mN.js")),
3239
3264
  "info-circle": lazy(() => import("./info-circle-DkHN1ugA.js")),
@@ -3257,7 +3282,7 @@ const icons = {
3257
3282
  warning: lazy(() => import("./warning-99uFf1WU.js")),
3258
3283
  wrong: lazy(() => import("./wrong-1wvh7nZe.js"))
3259
3284
  };
3260
- const logger$B = createLogger("Icon");
3285
+ const logger$D = createLogger("Icon");
3261
3286
  const Icon = ({
3262
3287
  className,
3263
3288
  name,
@@ -3265,7 +3290,7 @@ const Icon = ({
3265
3290
  }) => {
3266
3291
  const LazyLoadedIcon = icons[name];
3267
3292
  if (!LazyLoadedIcon) {
3268
- logger$B.error(`No such icon: "${name}"`);
3293
+ logger$D.error(`No such icon: "${name}"`);
3269
3294
  return null;
3270
3295
  }
3271
3296
  return jsx("span", {
@@ -3279,14 +3304,17 @@ const Icon = ({
3279
3304
  })
3280
3305
  });
3281
3306
  };
3282
- const Spinner = ({
3307
+ const Loader = ({
3283
3308
  inline = false,
3284
- size = "large"
3309
+ size = "large",
3310
+ dot = false
3285
3311
  }) => jsx("div", {
3286
- className: `adyen-kyc-spinner__wrapper ${inline ? "adyen-kyc-spinner__wrapper--inline" : ""}`,
3312
+ className: `adyen-kyc-loader__wrapper ${inline ? "adyen-kyc-loader__wrapper--inline" : ""}`,
3287
3313
  children: jsx("div", {
3288
- className: `adyen-kyc-spinner adyen-kyc-spinner--${size}`,
3289
- role: "progressbar"
3314
+ role: "progressbar",
3315
+ className: cx("adyen-kyc-loader", `adyen-kyc-loader--${size}`, {
3316
+ "adyen-kyc-loader--dot": dot
3317
+ })
3290
3318
  })
3291
3319
  });
3292
3320
  const Button = ({
@@ -3321,7 +3349,7 @@ const Button = ({
3321
3349
  children: label
3322
3350
  }), jsx("span", {
3323
3351
  className: "adyen-kyc-button__loader-container--active",
3324
- children: jsx(Spinner, {
3352
+ children: jsx(Loader, {
3325
3353
  size: "small"
3326
3354
  })
3327
3355
  })]
@@ -3363,21 +3391,15 @@ const Button = ({
3363
3391
  const Divider = () => jsx("hr", {
3364
3392
  className: "adyen-kyc-divider"
3365
3393
  });
3366
- var AlertTypes = /* @__PURE__ */ ((AlertTypes2) => {
3367
- AlertTypes2[AlertTypes2["BASIC"] = 0] = "BASIC";
3368
- AlertTypes2[AlertTypes2["INFO"] = 1] = "INFO";
3369
- AlertTypes2[AlertTypes2["ERROR"] = 2] = "ERROR";
3370
- AlertTypes2[AlertTypes2["WARNING"] = 3] = "WARNING";
3371
- AlertTypes2[AlertTypes2["SUCCESS"] = 4] = "SUCCESS";
3372
- return AlertTypes2;
3373
- })(AlertTypes || {});
3374
3394
  const Alert = ({
3375
3395
  title,
3376
- type = AlertTypes.BASIC,
3396
+ type = "basic",
3377
3397
  className,
3378
3398
  hasCloseButton = true,
3399
+ actionButton,
3379
3400
  children,
3380
- icon
3401
+ icon,
3402
+ testId
3381
3403
  }) => {
3382
3404
  const {
3383
3405
  i18n
@@ -3386,11 +3408,11 @@ const Alert = ({
3386
3408
  if (isClosed) return null;
3387
3409
  const closeAlert = () => setIsClosed(true);
3388
3410
  const classNames = cx("adyen-kyc-alert", className, {
3389
- "adyen-kyc-alert--basic": type === AlertTypes.BASIC,
3390
- "adyen-kyc-alert--information": type === AlertTypes.INFO,
3391
- "adyen-kyc-alert--error": type === AlertTypes.ERROR,
3392
- "adyen-kyc-alert--warning": type === AlertTypes.WARNING,
3393
- "adyen-kyc-alert--success": type === AlertTypes.SUCCESS
3411
+ "adyen-kyc-alert--basic": type === "basic",
3412
+ "adyen-kyc-alert--information": type === "info",
3413
+ "adyen-kyc-alert--error": type === "error",
3414
+ "adyen-kyc-alert--warning": type === "warning",
3415
+ "adyen-kyc-alert--success": type === "success"
3394
3416
  });
3395
3417
  const renderIcon = () => {
3396
3418
  if (icon === false) {
@@ -3409,24 +3431,20 @@ const Alert = ({
3409
3431
  return jsxs("div", {
3410
3432
  className: classNames,
3411
3433
  role: "alert",
3434
+ "data-testid": testId,
3412
3435
  children: [jsxs("div", {
3413
3436
  className: "adyen-kyc-alert__header",
3414
3437
  children: [renderIcon(), title && jsx("span", {
3415
- className: cx("adyen-kyc-alert__title", {
3416
- "adyen-kyc-alert__title--no-content": !children
3417
- }),
3438
+ className: "adyen-kyc-alert__title",
3418
3439
  children: title
3419
- }), hasCloseButton && jsx("button", {
3420
- "aria-label": i18n.get("close"),
3421
- className: "adyen-kyc-alert__dismiss",
3440
+ }), hasCloseButton && !actionButton && jsx(Button, {
3441
+ label: i18n.get("close"),
3442
+ tertiary: true,
3443
+ icon: "cross",
3422
3444
  onClick: closeAlert,
3423
- type: "button",
3424
- children: jsx(Icon, {
3425
- name: "cross",
3426
- className: "adyen-kyc-alert__dismiss__icon"
3427
- })
3428
- })]
3429
- }), jsx("div", {
3445
+ className: "adyen-kyc-close-button"
3446
+ }), !!actionButton && actionButton]
3447
+ }), children && jsx("div", {
3430
3448
  className: "adyen-kyc-alert__explanation",
3431
3449
  children
3432
3450
  })]
@@ -3437,23 +3455,23 @@ const AlertIcon = ({
3437
3455
  type
3438
3456
  }) => {
3439
3457
  switch (type) {
3440
- case AlertTypes.SUCCESS:
3458
+ case "success":
3441
3459
  return jsx(Icon, {
3442
3460
  name: "check",
3443
3461
  className
3444
3462
  });
3445
- case AlertTypes.ERROR:
3463
+ case "error":
3446
3464
  return jsx(Icon, {
3447
3465
  name: "field-error",
3448
3466
  className
3449
3467
  });
3450
- case AlertTypes.WARNING:
3468
+ case "warning":
3451
3469
  return jsx(Icon, {
3452
3470
  name: "warning",
3453
3471
  className
3454
3472
  });
3455
- case AlertTypes.INFO:
3456
- case AlertTypes.BASIC:
3473
+ case "info":
3474
+ case "basic":
3457
3475
  default:
3458
3476
  return jsx(Icon, {
3459
3477
  name: "info-circle",
@@ -3469,7 +3487,7 @@ function useFormRouterContext() {
3469
3487
  }
3470
3488
  return context;
3471
3489
  }
3472
- const logger$A = createLogger("Link");
3490
+ const logger$C = createLogger("Link");
3473
3491
  const getIconClass = (icon, external) => {
3474
3492
  if (external) {
3475
3493
  return "adyen-kyc-link__icon adyen-kyc-icon-external-link";
@@ -3481,7 +3499,7 @@ const getIconClass = (icon, external) => {
3481
3499
  };
3482
3500
  const isValidLink = (href) => {
3483
3501
  if (href === "#") {
3484
- logger$A.error('Links must include a valid href. If your href is "#", consider using a Button instead');
3502
+ logger$C.error('Links must include a valid href. If your href is "#", consider using a Button instead');
3485
3503
  return false;
3486
3504
  }
3487
3505
  return true;
@@ -3492,10 +3510,7 @@ const Link = ({
3492
3510
  href,
3493
3511
  external,
3494
3512
  icon,
3495
- underline,
3496
- inheritStyles,
3497
3513
  showAsButton,
3498
- iconLeft = false,
3499
3514
  onClick
3500
3515
  }) => {
3501
3516
  if (!isValidLink(href)) return null;
@@ -3504,13 +3519,9 @@ const Link = ({
3504
3519
  const showIcon = icon || external;
3505
3520
  const iconClass = showIcon && getIconClass(icon, external);
3506
3521
  const classNames = showAsButton ? cx("adyen-kyc-button", className, {
3507
- "adyen-kyc-button--icon": showIcon && !iconLeft,
3508
- "adyen-kyc-button--icon-left": showIcon && iconLeft
3522
+ "adyen-kyc-button--icon": showIcon
3509
3523
  }) : cx("adyen-kyc-link", className, {
3510
- "adyen-kyc-link--with-icon": showIcon,
3511
- "adyen-kyc-link--underline": underline,
3512
- "adyen-kyc-link--inherit": inheritStyles,
3513
- "adyen-kyc-link--icon-left": iconLeft
3524
+ "adyen-kyc-link--with-icon": showIcon
3514
3525
  });
3515
3526
  return jsxs("a", {
3516
3527
  href,
@@ -3519,7 +3530,7 @@ const Link = ({
3519
3530
  rel,
3520
3531
  onClick,
3521
3532
  children: [jsx("span", {
3522
- className: "adyen-kyc-link__text",
3533
+ className: "adyen-kyc-link__text adyen-kyc-link--inherit",
3523
3534
  children
3524
3535
  }), showIcon && icon && iconClass && jsx(Icon, {
3525
3536
  name: icon,
@@ -3556,7 +3567,7 @@ function ServerValidationErrors({
3556
3567
  }).toString(), [formUtils, validationErrorFieldNames]);
3557
3568
  return jsx(Alert, {
3558
3569
  title: formUtils.getVal("informationCouldNotBeSubmitted"),
3559
- type: AlertTypes.ERROR,
3570
+ type: "error",
3560
3571
  hasCloseButton: false,
3561
3572
  children: (validationErrorFieldNames == null ? void 0 : validationErrorFieldNames.length) === 1 ? jsxs("div", {
3562
3573
  "data-testid": "validation-error--case-1",
@@ -3623,7 +3634,7 @@ var LegalEntityType = /* @__PURE__ */ ((LegalEntityType2) => {
3623
3634
  return LegalEntityType2;
3624
3635
  })(LegalEntityType || {});
3625
3636
  function getFormProps(props, innerFormId) {
3626
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
3637
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
3627
3638
  if (!innerFormId) {
3628
3639
  return null;
3629
3640
  }
@@ -3640,14 +3651,15 @@ function getFormProps(props, innerFormId) {
3640
3651
  optionalFields: ((_j = props.optionalFields) == null ? void 0 : _j[innerFormId]) ?? [],
3641
3652
  obscuredFields: ((_k = props.obscuredFields) == null ? void 0 : _k[innerFormId]) ?? [],
3642
3653
  verifyFields: ((_l = props.verifyFields) == null ? void 0 : _l[innerFormId]) ?? [],
3643
- formVerificationErrors: ((_n = (_m = props.problems) == null ? void 0 : _m.verificationErrors) == null ? void 0 : _n[innerFormId]) ?? {},
3644
- fieldValidationErrors: ((_p = (_o = props.problems) == null ? void 0 : _o.validationErrors) == null ? void 0 : _p[innerFormId]) ?? {},
3654
+ trustedFields: ((_m = props.trustedFields) == null ? void 0 : _m[innerFormId]) ?? [],
3655
+ formVerificationErrors: ((_o = (_n = props.problems) == null ? void 0 : _n.verificationErrors) == null ? void 0 : _o[innerFormId]) ?? {},
3656
+ fieldValidationErrors: ((_q = (_p = props.problems) == null ? void 0 : _p.validationErrors) == null ? void 0 : _q[innerFormId]) ?? {},
3645
3657
  /*
3646
3658
  Validators should be `null` and not `{}` by default to make it easier to short circuit it with predetermined validators.
3647
3659
  For example `rules: props.validators || personalDetailsValidationRules`.
3648
3660
  */
3649
- validators: ((_q = props.validators) == null ? void 0 : _q[innerFormId]) ? {
3650
- ...(_r = props.validators) == null ? void 0 : _r[innerFormId]
3661
+ validators: ((_r = props.validators) == null ? void 0 : _r[innerFormId]) ? {
3662
+ ...(_s = props.validators) == null ? void 0 : _s[innerFormId]
3651
3663
  } : null,
3652
3664
  /*
3653
3665
  activeForm check is required for shouldValidate because we render all forms in a multistep form.
@@ -3674,6 +3686,7 @@ function getNestedOuterFormPropsFromOuterFormProps(props, innerFormId) {
3674
3686
  optionalFields,
3675
3687
  obscuredFields,
3676
3688
  verifyFields,
3689
+ trustedFields: trustedFields2,
3677
3690
  problems,
3678
3691
  validators: validators2,
3679
3692
  shouldValidate
@@ -3690,6 +3703,7 @@ function getNestedOuterFormPropsFromOuterFormProps(props, innerFormId) {
3690
3703
  optionalFields,
3691
3704
  obscuredFields,
3692
3705
  verifyFields,
3706
+ trustedFields: trustedFields2,
3693
3707
  // the rest we just pass along for now, as they will be eventually be processed by getFormProps
3694
3708
  problems,
3695
3709
  validators: validators2,
@@ -3710,10 +3724,11 @@ function getFieldProps(props, innerFormFields) {
3710
3724
  optionalFields: [],
3711
3725
  readOnlyFields: [],
3712
3726
  verifyFields: [],
3727
+ trustedFields: [],
3713
3728
  fieldValidationErrors: {}
3714
3729
  };
3715
3730
  innerFormFields.forEach((field) => {
3716
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
3731
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
3717
3732
  nestedFormProps.placeholders[field] = (_a = props.placeholders) == null ? void 0 : _a[field];
3718
3733
  nestedFormProps.labels[field] = (_b = props.labels) == null ? void 0 : _b[field];
3719
3734
  nestedFormProps.helperText[field] = (_c = props.helperText) == null ? void 0 : _c[field];
@@ -3740,11 +3755,14 @@ function getFieldProps(props, innerFormFields) {
3740
3755
  if ((_l = props.obscuredFields) == null ? void 0 : _l.includes(field)) {
3741
3756
  nestedFormProps.obscuredFields.push(field);
3742
3757
  }
3743
- if ((_m = props.validators) == null ? void 0 : _m[field]) {
3758
+ if ((_m = props.trustedFields) == null ? void 0 : _m.includes(field)) {
3759
+ nestedFormProps.trustedFields.push(field);
3760
+ }
3761
+ if ((_n = props.validators) == null ? void 0 : _n[field]) {
3744
3762
  if (!(nestedFormProps == null ? void 0 : nestedFormProps.validators)) {
3745
3763
  nestedFormProps.validators = {};
3746
3764
  }
3747
- nestedFormProps.validators[field] = (_n = props.validators) == null ? void 0 : _n[field];
3765
+ nestedFormProps.validators[field] = (_o = props.validators) == null ? void 0 : _o[field];
3748
3766
  }
3749
3767
  nestedFormProps.shouldValidate = props.shouldValidate;
3750
3768
  });
@@ -3810,7 +3828,7 @@ const useSetting = (settingName) => {
3810
3828
  } = context;
3811
3829
  return getSetting(settingName);
3812
3830
  };
3813
- const logger$z = createLogger("useAllowedCountries");
3831
+ const logger$B = createLogger("useAllowedCountries");
3814
3832
  const useAllowedCountries = () => {
3815
3833
  const acceptedCountries = useSetting("acceptedCountries");
3816
3834
  const {
@@ -3819,7 +3837,7 @@ const useAllowedCountries = () => {
3819
3837
  const [allowedCountries, setAllowedCountries] = useState(acceptedCountries);
3820
3838
  useEffect(() => {
3821
3839
  if (acceptedCountries !== void 0) return;
3822
- getAllowedCountries2().then((response) => setAllowedCountries(response.countries)).catch(logger$z.error);
3840
+ getAllowedCountries2().then((response) => setAllowedCountries(response.countries)).catch(logger$B.error);
3823
3841
  }, [acceptedCountries]);
3824
3842
  return allowedCountries;
3825
3843
  };
@@ -3877,6 +3895,7 @@ function init({
3877
3895
  fieldProblems,
3878
3896
  obscuredFields,
3879
3897
  optionalFields,
3898
+ trustedFields: trustedFields2,
3880
3899
  formatters,
3881
3900
  staticValidate,
3882
3901
  asyncValidate
@@ -3892,7 +3911,8 @@ function init({
3892
3911
  state: {
3893
3912
  data: defaultData,
3894
3913
  obscuredFields,
3895
- optionalFields
3914
+ optionalFields,
3915
+ trustedFields: trustedFields2
3896
3916
  }
3897
3917
  },
3898
3918
  staticValidate,
@@ -3947,7 +3967,8 @@ function init({
3947
3967
  errors: {},
3948
3968
  fieldProblems: {},
3949
3969
  obscuredFields,
3950
- optionalFields
3970
+ optionalFields,
3971
+ trustedFields: trustedFields2
3951
3972
  });
3952
3973
  return formData;
3953
3974
  }
@@ -3956,6 +3977,7 @@ function reducer({
3956
3977
  asyncValidate,
3957
3978
  obscuredFields,
3958
3979
  optionalFields,
3980
+ trustedFields: trustedFields2,
3959
3981
  formatters
3960
3982
  }) {
3961
3983
  return (state2, {
@@ -4027,6 +4049,7 @@ function reducer({
4027
4049
  fieldProblems,
4028
4050
  obscuredFields,
4029
4051
  optionalFields,
4052
+ trustedFields: trustedFields2,
4030
4053
  staticValidate,
4031
4054
  asyncValidate
4032
4055
  });
@@ -4060,6 +4083,7 @@ function reducer({
4060
4083
  fieldProblems: updatedFieldProblems,
4061
4084
  obscuredFields,
4062
4085
  optionalFields,
4086
+ trustedFields: trustedFields2,
4063
4087
  local
4064
4088
  };
4065
4089
  }
@@ -4172,7 +4196,7 @@ function reducer({
4172
4196
  }
4173
4197
  };
4174
4198
  }
4175
- const logger$y = createLogger("useAsyncValidator");
4199
+ const logger$A = createLogger("useAsyncValidator");
4176
4200
  const useAsyncValidator = (asyncRules) => {
4177
4201
  const [asyncValidationResults, setAsyncValidationResults] = useState({});
4178
4202
  const clearAsyncValidationResults = useCallback(() => setAsyncValidationResults({}), []);
@@ -4193,7 +4217,7 @@ const useAsyncValidator = (asyncRules) => {
4193
4217
  hasError: !isValid
4194
4218
  }])
4195
4219
  });
4196
- }).catch(logger$y.error);
4220
+ }).catch(logger$A.error);
4197
4221
  }, [asyncRules, clearAsyncValidationResults]);
4198
4222
  return {
4199
4223
  asyncValidationResults,
@@ -4253,6 +4277,7 @@ function useForm({
4253
4277
  fieldProblems,
4254
4278
  obscuredFields,
4255
4279
  optionalFields,
4280
+ trustedFields: trustedFields2,
4256
4281
  formatters,
4257
4282
  shouldValidate = false
4258
4283
  }) {
@@ -4270,18 +4295,20 @@ function useForm({
4270
4295
  asyncValidate: triggerAsyncValidation,
4271
4296
  obscuredFields,
4272
4297
  optionalFields,
4298
+ trustedFields: trustedFields2,
4273
4299
  formatters
4274
- }), [triggerStaticValidation, triggerAsyncValidation, obscuredFields, optionalFields, formatters]);
4300
+ }), [triggerStaticValidation, triggerAsyncValidation, obscuredFields, optionalFields, trustedFields2, formatters]);
4275
4301
  const initialData = useMemo(() => ({
4276
4302
  schema: getSchema,
4277
4303
  defaultData,
4278
4304
  fieldProblems,
4279
4305
  obscuredFields,
4280
4306
  optionalFields,
4307
+ trustedFields: trustedFields2,
4281
4308
  formatters,
4282
4309
  staticValidate: triggerStaticValidation,
4283
4310
  asyncValidate: triggerAsyncValidation
4284
- }), [getSchema, defaultData, fieldProblems, obscuredFields, optionalFields, formatters, triggerStaticValidation, triggerAsyncValidation]);
4311
+ }), [getSchema, defaultData, fieldProblems, obscuredFields, optionalFields, trustedFields2, formatters, triggerStaticValidation, triggerAsyncValidation]);
4285
4312
  const [state2, dispatch] = useReducer(getReducer(), initialData, init);
4286
4313
  const isValid = useMemo(() => {
4287
4314
  var _a;
@@ -4339,6 +4366,16 @@ function useForm({
4339
4366
  defaultData
4340
4367
  });
4341
4368
  }, [defaultData]);
4369
+ const resetToDefaultData = useCallback(() => {
4370
+ getSchema.forEach((field) => {
4371
+ if (!defaultData || typeof defaultData[field] !== "undefined") {
4372
+ return handleChangeFor(field)(defaultData == null ? void 0 : defaultData[field]);
4373
+ }
4374
+ setValid(field, false);
4375
+ setErrors(field, null);
4376
+ setData(field, defaultData[field]);
4377
+ });
4378
+ }, [defaultData, getSchema, handleChangeFor, setData, setErrors, setValid]);
4342
4379
  useEffect(() => {
4343
4380
  const newSchema = getRequiredFields(state2.data);
4344
4381
  if (!doArraysMatch(state2.schema, newSchema)) {
@@ -4364,6 +4401,7 @@ function useForm({
4364
4401
  setFieldProblems,
4365
4402
  handleChangeFor,
4366
4403
  triggerValidation,
4404
+ resetToDefaultData,
4367
4405
  isValid,
4368
4406
  schema: state2.schema,
4369
4407
  valid: state2.valid,
@@ -4577,7 +4615,7 @@ const Field = ({
4577
4615
  children: helper
4578
4616
  }), isLoading && jsx("span", {
4579
4617
  className: "adyen-kyc-input__inline-validation adyen-kyc-input__inline-validation--loading",
4580
- children: jsx(Spinner, {
4618
+ children: jsx(Loader, {
4581
4619
  size: "small"
4582
4620
  })
4583
4621
  }), isValid && jsx("span", {
@@ -4619,18 +4657,6 @@ function uuidv4() {
4619
4657
  return v.toString(16);
4620
4658
  });
4621
4659
  }
4622
- const Loader = ({
4623
- inline = false,
4624
- size = "large",
4625
- dot = false
4626
- }) => jsx("div", {
4627
- className: `adyen-kyc-loader__wrapper ${inline ? "adyen-kyc-loader__wrapper--inline" : ""}`,
4628
- children: jsx("div", {
4629
- className: cx("adyen-kyc-loading-indicator", `adyen-kyc-loading-indicator--${size}`, {
4630
- "adyen-kyc-loading-indicator--dot": dot
4631
- })
4632
- })
4633
- });
4634
4660
  const Tag = ({
4635
4661
  className,
4636
4662
  variant = "blue",
@@ -4779,7 +4805,7 @@ const SelectButtonContentSingle = ({
4779
4805
  type: "text",
4780
4806
  value: textFilter
4781
4807
  }), isSearch && loading2 && jsx(Loader, {
4782
- size: "xsmall",
4808
+ size: "small",
4783
4809
  dot: true
4784
4810
  })]
4785
4811
  });
@@ -5703,6 +5729,36 @@ var CountryCodes = /* @__PURE__ */ ((CountryCodes2) => {
5703
5729
  CountryCodes2["Zimbabwe"] = "ZW";
5704
5730
  return CountryCodes2;
5705
5731
  })(CountryCodes || {});
5732
+ const euCountries = [
5733
+ "AT",
5734
+ "BE",
5735
+ "BG",
5736
+ "CY",
5737
+ "CZ",
5738
+ "DE",
5739
+ "DK",
5740
+ "EE",
5741
+ "ES",
5742
+ "FI",
5743
+ "FR",
5744
+ "GR",
5745
+ "HR",
5746
+ "HU",
5747
+ "IE",
5748
+ "IT",
5749
+ "LT",
5750
+ "LU",
5751
+ "LV",
5752
+ "MT",
5753
+ "NL",
5754
+ "PL",
5755
+ "PT",
5756
+ "RO",
5757
+ "SE",
5758
+ "SI",
5759
+ "SK"
5760
+ /* Slovakia */
5761
+ ];
5706
5762
  const validateNotEmptyOnBlur = {
5707
5763
  modes: ["blur"],
5708
5764
  validate: (val) => !isEmpty(val),
@@ -6182,7 +6238,7 @@ const deriveInputState = (isValid, isFocused, isDisabled, isOptional, hasNullish
6182
6238
  };
6183
6239
  };
6184
6240
  const MISMATCH_ANIMATION_NAME = "mismatchShake";
6185
- const logger$x = createLogger("MaskedInputText");
6241
+ const logger$z = createLogger("MaskedInputText");
6186
6242
  const MaskedInputText = ({
6187
6243
  value,
6188
6244
  onInput,
@@ -6223,7 +6279,7 @@ const MaskedInputText = ({
6223
6279
  };
6224
6280
  useEffect(() => {
6225
6281
  if (!mask) {
6226
- logger$x.warn("`mask` is undefined. No masking of input will take place.");
6282
+ logger$z.warn("`mask` is undefined. No masking of input will take place.");
6227
6283
  }
6228
6284
  }, [mask]);
6229
6285
  const getMaskResult = useCallback((pureValue) => {
@@ -6248,7 +6304,7 @@ const MaskedInputText = ({
6248
6304
  return;
6249
6305
  }
6250
6306
  const fallback = displayValueToPure(maskResult.partialDisplayValue);
6251
- logger$x.warn(`Value received "${value}" does not match mask`, maskResult, `
6307
+ logger$z.warn(`Value received "${value}" does not match mask`, maskResult, `
6252
6308
  Falling back to partially valid value "${fallback}"`);
6253
6309
  onInput(fallback);
6254
6310
  }
@@ -7749,7 +7805,7 @@ const businessRegistrationNumberPatterns = {
7749
7805
  [StateCodesUS.Georgia]: /^\d{10}$/,
7750
7806
  [StateCodesUS.Hawaii]: /^\d{5,8}(C1|C2|C3|C4|C5|D1|D2|D3|D4|F1|F2|L1|L2|N1|N2|P1|P2|T1|T2|T3|T4|T5|T6|T7|T8|ZZ)$/,
7751
7807
  [StateCodesUS.Idaho]: /^\d{6}$/,
7752
- [StateCodesUS.Illinois]: /^\d{12}$/,
7808
+ [StateCodesUS.Illinois]: /^\d{8}$/,
7753
7809
  [StateCodesUS.Indiana]: /^\d{10}$/,
7754
7810
  [StateCodesUS.Iowa]: /^\d{4,10}$/,
7755
7811
  [StateCodesUS.Kansas]: /^\d{10}$/,
@@ -8716,7 +8772,7 @@ class UserEvents {
8716
8772
  }
8717
8773
  }
8718
8774
  const userEvents = new UserEvents();
8719
- const ChevronDownIcon = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%2015%2015'%3e%3cdefs%3e%3cpath%20id='chevron-down_svg__a'%20d='M2%205a1%201%200%200%201%201.74-.67L7.5%208.51l3.76-4.18a1%201%200%200%201%201.48%201.34l-4.5%205a1%201%200%200%201-1.48%200l-4.5-5A1%201%200%200%201%202%205'/%3e%3c/defs%3e%3cuse%20xlink:href='%23chevron-down_svg__a'%20fill-rule='evenodd'/%3e%3c/svg%3e";
8775
+ const ChevronDownIcon = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%2015%2015'%3e%3cdefs%3e%3cpath%20fill='currentColor'%20id='chevron-down_svg__a'%20d='M2%205a1%201%200%200%201%201.74-.67L7.5%208.51l3.76-4.18a1%201%200%200%201%201.48%201.34l-4.5%205a1%201%200%200%201-1.48%200l-4.5-5A1%201%200%200%201%202%205'/%3e%3c/defs%3e%3cuse%20xlink:href='%23chevron-down_svg__a'%20fill-rule='evenodd'/%3e%3c/svg%3e";
8720
8776
  const Accordion = ({
8721
8777
  title,
8722
8778
  children,
@@ -10625,7 +10681,7 @@ const businessDetailsBase = {
10625
10681
  legalCompanyName: {
10626
10682
  rule: "REQUIRED"
10627
10683
  },
10628
- hasDBA: {
10684
+ hasDba: {
10629
10685
  rule: "REQUIRED"
10630
10686
  },
10631
10687
  dbaName: {
@@ -11099,7 +11155,7 @@ const RadioCard = ({
11099
11155
  }), loading2 ? jsx("span", {
11100
11156
  className: "adyen-kyc-radio-card__loading-icon",
11101
11157
  children: jsx(Loader, {
11102
- size: "xsmall",
11158
+ size: "small",
11103
11159
  dot: true
11104
11160
  })
11105
11161
  }) : jsx(InputRadio, {
@@ -11632,7 +11688,7 @@ const accountHolderValidationRules = {
11632
11688
  }
11633
11689
  };
11634
11690
  const accountHolderFields = ["accountHolder"];
11635
- const logger$w = createLogger("AccountHolder");
11691
+ const logger$y = createLogger("AccountHolder");
11636
11692
  function getAvailableAccountHolderOptions(legalEntityType, isChangeOfLegalEntityTypeAllowed, isTrustFlowEnabled, isSoleProprietorshipAllowed, isChangeToMyNameAllowed) {
11637
11693
  switch (legalEntityType) {
11638
11694
  case LegalEntityType.ORGANIZATION: {
@@ -11642,7 +11698,7 @@ function getAvailableAccountHolderOptions(legalEntityType, isChangeOfLegalEntity
11642
11698
  return [...isChangeToMyNameAllowed ? ["myName"] : [], ...isChangeOfLegalEntityTypeAllowed ? ["theCompanyIWorkFor"] : [], ...isTrustFlowEnabled ? ["aTrust"] : [], ...isSoleProprietorshipAllowed ? ["mySoleProprietorName"] : []];
11643
11699
  }
11644
11700
  default:
11645
- logger$w.error(`No available account holder options for legal entity type '${legalEntityType}'`);
11701
+ logger$y.error(`No available account holder options for legal entity type '${legalEntityType}'`);
11646
11702
  return [];
11647
11703
  }
11648
11704
  }
@@ -12196,7 +12252,7 @@ function Dropzone(props) {
12196
12252
  })]
12197
12253
  });
12198
12254
  }
12199
- const logger$v = createLogger("TextArea");
12255
+ const logger$x = createLogger("TextArea");
12200
12256
  function TextArea(props) {
12201
12257
  const {
12202
12258
  classNameModifiers,
@@ -12217,7 +12273,7 @@ function TextArea(props) {
12217
12273
  } = useI18nContext();
12218
12274
  const [value, setValue] = useState("");
12219
12275
  if (Object.prototype.hasOwnProperty.call(props, "onChange")) {
12220
- logger$v.error("Error: Form fields that rely on InputBase may not have an onChange property");
12276
+ logger$x.error("Error: Form fields that rely on InputBase may not have an onChange property");
12221
12277
  }
12222
12278
  const handleInput = (e) => {
12223
12279
  var _a;
@@ -12663,7 +12719,7 @@ function useIsElementVisible(ref, fallback = true) {
12663
12719
  }, [ref]);
12664
12720
  return isOnScreen;
12665
12721
  }
12666
- const logger$u = createLogger("SearchAddress");
12722
+ const logger$w = createLogger("SearchAddress");
12667
12723
  const SearchAddress = ({
12668
12724
  data,
12669
12725
  legalEntityId,
@@ -12672,7 +12728,8 @@ const SearchAddress = ({
12672
12728
  handleAddressSearch,
12673
12729
  handleFindAddress,
12674
12730
  addressType,
12675
- kompanyAddress
12731
+ kompanyAddress,
12732
+ kompanyPrefilled = false
12676
12733
  }) => {
12677
12734
  const {
12678
12735
  i18n
@@ -12693,10 +12750,10 @@ const SearchAddress = ({
12693
12750
  }
12694
12751
  }, [kompanyAddress]);
12695
12752
  useEffect(() => {
12696
- if (isVisible && kompanyAddress && addressType === "registrationAddress") {
12753
+ if (isVisible && kompanyAddress && addressType === "registrationAddress" && !kompanyPrefilled) {
12697
12754
  setShowSearchList(true);
12698
12755
  }
12699
- }, [isVisible, kompanyAddress, addressType]);
12756
+ }, [isVisible, kompanyAddress, addressType, kompanyPrefilled]);
12700
12757
  useEffect(() => {
12701
12758
  setItems([]);
12702
12759
  setResetSearch(true);
@@ -12706,7 +12763,7 @@ const SearchAddress = ({
12706
12763
  const response = await handleFindAddress(selectedAddressId);
12707
12764
  autocompleteAddressForm(response);
12708
12765
  } catch (e) {
12709
- logger$u.error(e);
12766
+ logger$w.error(e);
12710
12767
  }
12711
12768
  };
12712
12769
  const onDrilldown = async (selectedAddress) => {
@@ -12718,7 +12775,7 @@ const SearchAddress = ({
12718
12775
  }, legalEntityId);
12719
12776
  setItems((response == null ? void 0 : response.results) || []);
12720
12777
  } catch (e) {
12721
- logger$u.error(e);
12778
+ logger$w.error(e);
12722
12779
  }
12723
12780
  };
12724
12781
  const onChange = (e) => {
@@ -12773,7 +12830,7 @@ const SearchAddress = ({
12773
12830
  setItems([]);
12774
12831
  }
12775
12832
  } catch (e) {
12776
- logger$u.error(e);
12833
+ logger$w.error(e);
12777
12834
  }
12778
12835
  setLoading(false);
12779
12836
  }
@@ -13206,11 +13263,15 @@ function Address(props) {
13206
13263
  id: id2,
13207
13264
  hideCountry,
13208
13265
  heading,
13266
+ verifiedBusiness,
13209
13267
  kompanyAddress
13210
13268
  } = props;
13211
13269
  const {
13212
13270
  i18n
13213
13271
  } = useI18nContext();
13272
+ const {
13273
+ isExperimentEnabled
13274
+ } = useExperimentsContext();
13214
13275
  const [showAutocompletedAddressFields, setShowAutocompletedAddressFields] = useState(false);
13215
13276
  const [showAddAddressButton, setShowAddAddressButton] = useState(true);
13216
13277
  const [isHandlerPresent, setIsHandlerPresent] = useState(false);
@@ -13229,7 +13290,9 @@ function Address(props) {
13229
13290
  fieldProblems,
13230
13291
  handleChangeFor,
13231
13292
  triggerValidation,
13232
- schema
13293
+ resetToDefaultData,
13294
+ schema,
13295
+ setData
13233
13296
  } = useForm({
13234
13297
  ...props,
13235
13298
  schema: requiredFields,
@@ -13319,6 +13382,24 @@ function Address(props) {
13319
13382
  setShowAddAddressButton(false);
13320
13383
  }
13321
13384
  }, [shouldValidate]);
13385
+ const canAutofillVerifiedBusinessAddress = Boolean((verifiedBusiness == null ? void 0 : verifiedBusiness.street) && (verifiedBusiness == null ? void 0 : verifiedBusiness.city) && (verifiedBusiness == null ? void 0 : verifiedBusiness.state) && verifiedBusiness.zipcode);
13386
+ useEffect(() => {
13387
+ if (!isExperimentEnabled("EnableNewBusinessDetailsFlow")) return;
13388
+ if (verifiedBusiness && canAutofillVerifiedBusinessAddress) {
13389
+ setShowAutocompletedAddressFields(true);
13390
+ setShowAddAddressButton(false);
13391
+ setData("address", verifiedBusiness.street);
13392
+ setData("city", verifiedBusiness.city);
13393
+ setData("stateOrProvince", verifiedBusiness.state);
13394
+ setData("postalCode", verifiedBusiness.zipcode);
13395
+ return triggerValidation();
13396
+ }
13397
+ if (!(dataProp == null ? void 0 : dataProp.address) || !(dataProp == null ? void 0 : dataProp.city) || !(dataProp == null ? void 0 : dataProp.postalCode)) {
13398
+ setShowAutocompletedAddressFields(false);
13399
+ setShowAddAddressButton(true);
13400
+ resetToDefaultData();
13401
+ }
13402
+ }, [canAutofillVerifiedBusinessAddress, verifiedBusiness]);
13322
13403
  const getComponent = (fieldName) => {
13323
13404
  if (!formUtils.isRequiredField(fieldName)) return null;
13324
13405
  const hideField = fieldName === "country" && hideCountry;
@@ -13393,7 +13474,8 @@ function Address(props) {
13393
13474
  legalEntityId,
13394
13475
  autocompleteAddressForm,
13395
13476
  addressType,
13396
- kompanyAddress
13477
+ kompanyAddress: (verifiedBusiness == null ? void 0 : verifiedBusiness.address) ?? kompanyAddress,
13478
+ kompanyPrefilled: canAutofillVerifiedBusinessAddress
13397
13479
  }), jsxs("div", {
13398
13480
  className: "adyen-kyc-search-address--below",
13399
13481
  children: [jsxs("span", {
@@ -13472,6 +13554,7 @@ function RegistrationAddressComponent(props) {
13472
13554
  country: country2,
13473
13555
  data,
13474
13556
  validators: validators2,
13557
+ verifiedBusiness,
13475
13558
  kompanyAddress
13476
13559
  } = props;
13477
13560
  const {
@@ -13479,7 +13562,8 @@ function RegistrationAddressComponent(props) {
13479
13562
  optionalFields: registrationAddressOptionalFields,
13480
13563
  readOnlyFields: registrationAddressReadOnlyFields,
13481
13564
  obscuredFields: registrationAddressObscuredFields,
13482
- verifyFields: registrationAddressVerifyFields
13565
+ verifyFields: registrationAddressVerifyFields,
13566
+ trustedFields: registrationAddressTrustedFields
13483
13567
  } = getFormProps(props, registrationAddressFormID);
13484
13568
  const {
13485
13569
  data: formData,
@@ -13493,7 +13577,8 @@ function RegistrationAddressComponent(props) {
13493
13577
  defaultData: data,
13494
13578
  rules: validators2 || registrationAddressValidationRules,
13495
13579
  obscuredFields: [],
13496
- optionalFields: registrationAddressOptionalFields
13580
+ optionalFields: registrationAddressOptionalFields,
13581
+ trustedFields: registrationAddressTrustedFields
13497
13582
  });
13498
13583
  const mergedProps = {
13499
13584
  ...props,
@@ -13501,7 +13586,8 @@ function RegistrationAddressComponent(props) {
13501
13586
  optionalFields: registrationAddressOptionalFields,
13502
13587
  readOnlyFields: registrationAddressReadOnlyFields,
13503
13588
  obscuredFields: registrationAddressObscuredFields,
13504
- verifyFields: registrationAddressVerifyFields
13589
+ verifyFields: registrationAddressVerifyFields,
13590
+ trustedFields: registrationAddressTrustedFields
13505
13591
  };
13506
13592
  const formUtils = formUtilities(mergedProps, i18n);
13507
13593
  const stateRef = useRef({
@@ -13554,6 +13640,7 @@ function RegistrationAddressComponent(props) {
13554
13640
  addressType: "registrationAddress",
13555
13641
  handleAddressSearch,
13556
13642
  handleFindAddress,
13643
+ verifiedBusiness,
13557
13644
  kompanyAddress
13558
13645
  }), jsx(FormHeader, {
13559
13646
  classNames: "adyen-kyc-u-margin-top-32",
@@ -14172,7 +14259,7 @@ const getFileExtention = (fileName2) => fileName2.split(".").pop();
14172
14259
  const COUNTRIES_THAT_DONT_REQUIRE_SOLE_PROP_REGISTRATION = [CountryCodes.Australia, CountryCodes.Gibraltar, CountryCodes.Guernsey, CountryCodes.HongKong, CountryCodes.Ireland, CountryCodes.IsleOfMan, CountryCodes.Jersey, CountryCodes.Malta, CountryCodes.PuertoRico, CountryCodes.Spain, CountryCodes.UnitedKingdom, CountryCodes.UnitedStates];
14173
14260
  const COUNTRIES_THAT_DONT_REQUIRE_COMPANY_REGISTRATION = [CountryCodes.PuertoRico, CountryCodes.UnitedStates];
14174
14261
  const COUNTRIES_WITH_POSSIBLE_REGISTRATION_EXEMPTIONS_FOR_SOLE_PROPS = [CountryCodes.Austria, CountryCodes.Canada, CountryCodes.Finland, CountryCodes.Germany, CountryCodes.Lithuania, CountryCodes.Luxembourg, CountryCodes.Poland, CountryCodes.Sweden, CountryCodes.Switzerland];
14175
- const COUNTRIES_WITH_OPTIONAL_REGISTRATION_NUMBER = [CountryCodes.UnitedStates];
14262
+ [CountryCodes.UnitedStates];
14176
14263
  const COUNTRIES_THAT_USE_TAX_ID_INSTEAD_OF_VAT = [CountryCodes.Australia, CountryCodes.Canada, CountryCodes.Gibraltar, CountryCodes.HongKong, CountryCodes.NewZealand, CountryCodes.PuertoRico, CountryCodes.Singapore, CountryCodes.UnitedStates, CountryCodes.Guernsey, CountryCodes.Jersey, CountryCodes.IsleOfMan];
14177
14264
  const COUNTRIES_THAT_DO_NOT_USE_TAX_ID_FOR_SOLE_PROP = [CountryCodes.NewZealand, CountryCodes.Singapore];
14178
14265
  const COUNTRIES_WITH_POSSIBLE_TAX_EXEMPTION_FOR_COMPANIES = [
@@ -14259,9 +14346,6 @@ const rules$2 = ({
14259
14346
  if (!COUNTRIES_THAT_DONT_REQUIRE_COMPANY_REGISTRATION.includes(country2)) {
14260
14347
  return "REQUIRED";
14261
14348
  }
14262
- if (isExperimentEnabled("EnableNewBusinessDetailsFlow") && COUNTRIES_WITH_OPTIONAL_REGISTRATION_NUMBER.includes(country2)) {
14263
- return "OPTIONAL";
14264
- }
14265
14349
  },
14266
14350
  countryRequiresDateOfIncorporationForCompanies: () => {
14267
14351
  if (COUNTRIES_THAT_REQUIRE_DATE_OF_INCORPORATION.includes(country2)) {
@@ -14518,6 +14602,7 @@ const businessDetailsBaseMapping = {
14518
14602
  "basicInformation.isUen": "organization.isUen",
14519
14603
  "companyStructure.entityType": "organization.type",
14520
14604
  "additionalInformation.legalCompanyName": "organization.legalName",
14605
+ "additionalInformation.legalFormDescription": "organization.legalFormDescription",
14521
14606
  "additionalInformation.dbaName": "organization.doingBusinessAs",
14522
14607
  "additionalInformation.registrationNumber": "organization.registrationNumber",
14523
14608
  "additionalInformation.taxInformation": "organization.taxInformation",
@@ -15488,6 +15573,12 @@ function IdDocumentManualUploadComponent(props) {
15488
15573
  });
15489
15574
  }
15490
15575
  const IdDocumentManualUpload = memo(IdDocumentManualUploadComponent, (prevProps, nextProps) => objectsDeepEqual(prevProps.data, nextProps.data) && objectsDeepEqual(prevProps.formVerificationErrors, nextProps.formVerificationErrors) && objectsDeepEqual(prevProps.fieldValidationErrors, nextProps.fieldValidationErrors) && prevProps.shouldValidate === nextProps.shouldValidate && prevProps.name === nextProps.name);
15576
+ const CoreContext = createContext(void 0);
15577
+ const useCoreContext = () => {
15578
+ const context = useContext(CoreContext);
15579
+ if (!context) throw Error("You need a <CoreProvider> to use core context");
15580
+ return context;
15581
+ };
15491
15582
  const useIdVerificationToken = ({
15492
15583
  userDetails,
15493
15584
  legalEntityId,
@@ -15500,6 +15591,7 @@ const useIdVerificationToken = ({
15500
15591
  residencyCountry: residencyCountry2
15501
15592
  } = userDetails;
15502
15593
  const [sdkToken2, setSdkToken2] = useState();
15594
+ const [providerId, setProviderId] = useState();
15503
15595
  const [loadingStatus, setLoadingStatus] = useState();
15504
15596
  const hasAllUserDetails = userDetails && Object.values(userDetails).every(Boolean);
15505
15597
  useEffect(() => {
@@ -15524,9 +15616,11 @@ const useIdVerificationToken = ({
15524
15616
  // Do not include legalEntityId if we don't know yet. Eg.: decision-makers flow the associated legalEntityId.
15525
15617
  };
15526
15618
  const {
15527
- sdkToken: sdkToken22
15619
+ sdkToken: sdkToken22,
15620
+ id: providerId2
15528
15621
  } = await handleGetIdVerificationToken("", data);
15529
15622
  setSdkToken2(sdkToken22);
15623
+ setProviderId(providerId2);
15530
15624
  } catch (e) {
15531
15625
  onIdVerificationError == null ? void 0 : onIdVerificationError(e);
15532
15626
  } finally {
@@ -15535,6 +15629,7 @@ const useIdVerificationToken = ({
15535
15629
  })().catch(console.error);
15536
15630
  }, [firstName2, lastName2, residencyCountry2, hasAllUserDetails]);
15537
15631
  return {
15632
+ providerId,
15538
15633
  sdkToken: sdkToken2,
15539
15634
  loadingStatus
15540
15635
  };
@@ -15570,7 +15665,7 @@ const LoaderWrapper = ({
15570
15665
  const wrapperClass = cx("adyen-kyc-loading-input__form", styles$1["adyen-kyc-loading-input__form"], {
15571
15666
  [styles$1[`adyen-kyc-loading-input__form--loading-opacity${opacity}`]]: status === "loading"
15572
15667
  });
15573
- const loaderClass = cx({
15668
+ const loaderWrapperClass = cx({
15574
15669
  [styles$1["adyen-kyc-loading-input__loader"]]: true,
15575
15670
  [styles$1["adyen-kyc-loading-input__loader--active"]]: status === "loading" && showSpinner
15576
15671
  });
@@ -15581,7 +15676,7 @@ const LoaderWrapper = ({
15581
15676
  position: "relative"
15582
15677
  },
15583
15678
  children: [jsx("div", {
15584
- className: loaderClass,
15679
+ className: loaderWrapperClass,
15585
15680
  children: jsx(Loader, {
15586
15681
  size: loaderSize
15587
15682
  })
@@ -15641,7 +15736,7 @@ const initOnfido = async ({
15641
15736
  language: getOnfidoLocaleConfig(i18n)
15642
15737
  });
15643
15738
  };
15644
- const logger$t = createLogger("IdVerificationComponent");
15739
+ const logger$v = createLogger("IdVerificationComponent");
15645
15740
  function IdVerificationComponent({
15646
15741
  userDetails,
15647
15742
  legalEntityId,
@@ -15653,9 +15748,13 @@ function IdVerificationComponent({
15653
15748
  const {
15654
15749
  i18n
15655
15750
  } = useI18nContext();
15751
+ const {
15752
+ setIdVerificationProviderId
15753
+ } = useCoreContext();
15656
15754
  const {
15657
15755
  sdkToken: sdkToken2,
15658
- loadingStatus
15756
+ loadingStatus,
15757
+ providerId
15659
15758
  } = useIdVerificationToken({
15660
15759
  userDetails,
15661
15760
  legalEntityId,
@@ -15665,7 +15764,8 @@ function IdVerificationComponent({
15665
15764
  const onfidoSdk = useRef();
15666
15765
  useEffect(() => {
15667
15766
  (async () => {
15668
- if (!sdkToken2) return;
15767
+ if (!sdkToken2 || !providerId) return;
15768
+ setIdVerificationProviderId(providerId);
15669
15769
  onfidoSdk.current = await initOnfido({
15670
15770
  token: sdkToken2,
15671
15771
  i18n,
@@ -15673,7 +15773,7 @@ function IdVerificationComponent({
15673
15773
  onIdVerificationError,
15674
15774
  onIdVerificationComplete
15675
15775
  });
15676
- })().catch(logger$t.error);
15776
+ })().catch(logger$v.error);
15677
15777
  return () => {
15678
15778
  if (onfidoSdk.current) onfidoSdk.current.tearDown();
15679
15779
  };
@@ -15723,7 +15823,7 @@ function IdDocumentAlreadyUpload(props) {
15723
15823
  })]
15724
15824
  });
15725
15825
  }
15726
- const logger$s = createLogger("IdDocumentInstantVerificationComponent");
15826
+ const logger$u = createLogger("IdDocumentInstantVerificationComponent");
15727
15827
  const idVerificationSchema = ["instantIdVerificationData", "idDocumentType"];
15728
15828
  const documentTypeValidationRules = {
15729
15829
  instantIdVerificationData: {
@@ -15805,7 +15905,7 @@ function IdDocumentInstantVerificationComponent(props) {
15805
15905
  userDetails: props.userDetails,
15806
15906
  legalEntityId: props.legalEntityId,
15807
15907
  onIdVerificationComplete: handleIdVerificationComplete,
15808
- onIdVerificationError: logger$s.error
15908
+ onIdVerificationError: logger$u.error
15809
15909
  }), jsxs("div", {
15810
15910
  className: "adyen-kyc-document-upload__manual-upload",
15811
15911
  children: [i18n.get("canNotCompleteInstantVerification"), " ", jsx("button", {
@@ -16081,6 +16181,68 @@ function IdVerificationMethodComponent(props) {
16081
16181
  })]
16082
16182
  });
16083
16183
  }
16184
+ const getAgeToday = (birthdate2) => {
16185
+ const today = /* @__PURE__ */ new Date();
16186
+ const todayMonth = today.getMonth();
16187
+ const todayDay = today.getDate();
16188
+ const bdDate = new Date(birthdate2);
16189
+ const bdMonth = bdDate.getMonth();
16190
+ const yearDifference = today.getFullYear() - bdDate.getFullYear();
16191
+ if (todayMonth > bdMonth) {
16192
+ return yearDifference;
16193
+ }
16194
+ if (todayMonth === bdMonth && todayDay >= bdDate.getUTCDate()) {
16195
+ return yearDifference;
16196
+ }
16197
+ return yearDifference - 1;
16198
+ };
16199
+ const getAgeRangeForLegalRepresentative = (country2) => {
16200
+ if (euCountries.some((c) => c === country2)) {
16201
+ return {
16202
+ min: 16,
16203
+ max: 18
16204
+ };
16205
+ }
16206
+ switch (country2) {
16207
+ case CountryCodes.HongKong:
16208
+ case CountryCodes.Singapore:
16209
+ return;
16210
+ default:
16211
+ return {
16212
+ min: 13,
16213
+ max: 18
16214
+ };
16215
+ }
16216
+ };
16217
+ const getLegalRepresentativeWarningMessage = ({
16218
+ data: {
16219
+ birthDate: birthDate2,
16220
+ residencyCountry: residencyCountry2
16221
+ }
16222
+ }) => {
16223
+ if (!residencyCountry2) {
16224
+ return;
16225
+ }
16226
+ if (!birthDate2) {
16227
+ return;
16228
+ }
16229
+ const ageRange = getAgeRangeForLegalRepresentative(residencyCountry2);
16230
+ if (!ageRange) {
16231
+ return;
16232
+ }
16233
+ const age = getAgeToday(birthDate2);
16234
+ if (ageRange.min <= age && age < ageRange.max) {
16235
+ return {
16236
+ title: "aLegalRepresentativeIsRequired",
16237
+ message: {
16238
+ key: "becauseYoureUnderXWeNeedToCollectInformationAboutALegalRepresentative",
16239
+ values: {
16240
+ age: ageRange.max.toString()
16241
+ }
16242
+ }
16243
+ };
16244
+ }
16245
+ };
16084
16246
  const COUNTRY_ID_NUMBER_MASKS = {
16085
16247
  [CountryCodes.PuertoRico]: {
16086
16248
  length: 4
@@ -18032,6 +18194,10 @@ function PersonalDetailsComponent(props) {
18032
18194
  } = useSettingsContext();
18033
18195
  const allowedCountries = useAllowedCountries();
18034
18196
  const isNewEntryFlowEnabled = useEnableNewEntryFlow();
18197
+ const {
18198
+ isExperimentEnabled
18199
+ } = useExperimentsContext();
18200
+ const isAgeVerificationEnabled = isExperimentEnabled("EnableAgeVerification");
18035
18201
  const PERSONAL_DETAILS = props.id;
18036
18202
  const {
18037
18203
  residencyCountry: residencyCountry2
@@ -18149,6 +18315,28 @@ function PersonalDetailsComponent(props) {
18149
18315
  useEffect(() => {
18150
18316
  triggerValidation();
18151
18317
  }, [residencyCountry2]);
18318
+ const birthDateErrorMessage = formUtils.getErrorMessage("birthDate", errors, fieldProblems);
18319
+ const getAlertProps = () => {
18320
+ if (typeof birthDateErrorMessage === "string") {
18321
+ return {
18322
+ title: birthDateErrorMessage,
18323
+ hasCloseButton: false,
18324
+ type: "error"
18325
+ };
18326
+ }
18327
+ const translatableWarningMessage = getLegalRepresentativeWarningMessage({
18328
+ data
18329
+ });
18330
+ if (translatableWarningMessage) {
18331
+ return {
18332
+ title: i18n.get(translatableWarningMessage.title),
18333
+ hasCloseButton: false,
18334
+ type: "warning",
18335
+ children: i18n.get(translatableWarningMessage.message)
18336
+ };
18337
+ }
18338
+ };
18339
+ const alertProps = getAlertProps();
18152
18340
  return jsxs(LoaderWrapper, {
18153
18341
  status,
18154
18342
  formOpacityWhenLoading: 0.3,
@@ -18183,11 +18371,12 @@ function PersonalDetailsComponent(props) {
18183
18371
  }), hasRequiredFields(nameProps) && jsx(Name, {
18184
18372
  ...nameProps,
18185
18373
  dataStoreId: PERSONAL_DETAILS
18186
- }), formUtils.isRequiredField("birthDate") && jsx(Field, {
18374
+ }), !isAgeVerificationEnabled && formUtils.isRequiredField("birthDate") && // we reverse the order of birthDate and Country field in age verification feature
18375
+ jsx(Field, {
18187
18376
  name: "birthDate",
18188
18377
  label: formUtils.getLabel("birthDate"),
18189
18378
  classNameModifiers: ["birthDate"],
18190
- errorMessage: formUtils.getErrorMessage("birthDate", errors, fieldProblems),
18379
+ errorMessage: isAgeVerificationEnabled && birthDateErrorMessage ? true : birthDateErrorMessage,
18191
18380
  isValid: valid.birthDate,
18192
18381
  children: (childProps) => jsx(InputDate, {
18193
18382
  ...childProps,
@@ -18219,6 +18408,29 @@ function PersonalDetailsComponent(props) {
18219
18408
  allowedCountries: isTopLevelEntity ? allowedCountries : void 0,
18220
18409
  classNameModifiers: ["country"],
18221
18410
  handleChangeFor: () => handleChangeFor("residencyCountry", "input")
18411
+ }), isAgeVerificationEnabled && formUtils.isRequiredField("birthDate") && jsxs(Fragment, {
18412
+ children: [jsx(Field, {
18413
+ name: "birthDate",
18414
+ label: formUtils.getLabel("birthDate"),
18415
+ classNameModifiers: ["birthDate"],
18416
+ errorMessage: isAgeVerificationEnabled && birthDateErrorMessage ? true : birthDateErrorMessage,
18417
+ isValid: valid.birthDate,
18418
+ children: (childProps) => jsx(InputDate, {
18419
+ ...childProps,
18420
+ name: "birthDate",
18421
+ value: data.birthDate,
18422
+ placeholder: i18n.get("datePlaceholder"),
18423
+ readonly: formUtils.isReadOnly("birthDate"),
18424
+ onInput: handleChangeFor("birthDate", "input"),
18425
+ onBlur: handleChangeFor("birthDate", "blur"),
18426
+ "aria-required": true,
18427
+ "aria-label": formUtils.getLabel("birthDate"),
18428
+ "aria-invalid": !valid.birthDate,
18429
+ max: formatDateObj(/* @__PURE__ */ new Date())
18430
+ })
18431
+ }), isAgeVerificationEnabled && alertProps && jsx(Alert, {
18432
+ ...alertProps
18433
+ })]
18222
18434
  }), jsx(IndividualIdNumberTypeSelector, {
18223
18435
  country: data.residencyCountry,
18224
18436
  setSelected: setIdNumberType,
@@ -19135,6 +19347,7 @@ const ActionBar = ({
19135
19347
  nextButtonLabel,
19136
19348
  hideOnHomeButton,
19137
19349
  hideBackButton,
19350
+ hideNextButton,
19138
19351
  nextButtonDisabled = false
19139
19352
  }) => jsxs("div", {
19140
19353
  className: "adyen-action-bar",
@@ -19146,7 +19359,7 @@ const ActionBar = ({
19146
19359
  secondary: true,
19147
19360
  onClick: () => onBack(),
19148
19361
  testId: "backBtn"
19149
- }), onNext && jsx(Button, {
19362
+ }), onNext && !hideNextButton && jsx(Button, {
19150
19363
  label: nextButtonLabel,
19151
19364
  className: "adyen-action-bar__button",
19152
19365
  onClick: onNext,
@@ -19285,7 +19498,7 @@ class AdyenKycSdkError extends Error {
19285
19498
  }
19286
19499
  let sdkToken;
19287
19500
  let fetchSdkToken;
19288
- const logger$r = createLogger("Session");
19501
+ const logger$t = createLogger("Session");
19289
19502
  const setSdkToken = (token) => {
19290
19503
  sdkToken = token;
19291
19504
  };
@@ -19308,7 +19521,7 @@ const refreshSession = async () => {
19308
19521
  setSdkToken(token);
19309
19522
  isSessionRefreshed = true;
19310
19523
  } catch (e) {
19311
- logger$r.error("Failed to fetch sdk token", e);
19524
+ logger$t.error("Failed to fetch sdk token", e);
19312
19525
  }
19313
19526
  return isSessionRefreshed;
19314
19527
  };
@@ -19318,7 +19531,7 @@ const addAnimationStartListener = (element, listener) => {
19318
19531
  const removeAnimationStartListener = (element, listener) => {
19319
19532
  element.removeEventListener("animationstart", listener, false);
19320
19533
  };
19321
- const logger$q = createLogger("Fetch");
19534
+ const logger$s = createLogger("Fetch");
19322
19535
  const getRequestObject = (options, data) => {
19323
19536
  const {
19324
19537
  headers = [],
@@ -19365,10 +19578,10 @@ const logFetchError = (message, level) => {
19365
19578
  case "info":
19366
19579
  case "warn":
19367
19580
  case "error":
19368
- logger$q[level](message);
19581
+ logger$s[level](message);
19369
19582
  break;
19370
19583
  default:
19371
- logger$q.error(message);
19584
+ logger$s.error(message);
19372
19585
  }
19373
19586
  };
19374
19587
  const handleFetchResponse = async (response, responseType) => {
@@ -19466,7 +19679,7 @@ const RELEVANT_MESSAGE_TYPES = ["account_verification_report_id", "error"];
19466
19679
  const TERMINAL_DATA_PROPS = ["accounts", "error", "reference"];
19467
19680
  const MOUNT_TIMEOUT = 10 * 1e3;
19468
19681
  const TINK_VENDOR = "Tink";
19469
- const logger$p = createLogger("iframeWidget");
19682
+ const logger$r = createLogger("iframeWidget");
19470
19683
  const isObjectData = (data) => typeof data === "object" && !Array.isArray(data) && data !== null;
19471
19684
  const isTerminalMessageData = (data) => isObjectData(data) && Object.entries(data).some(([prop]) => TERMINAL_DATA_PROPS.includes(prop));
19472
19685
  const parseMessageJson = (message) => {
@@ -19484,7 +19697,7 @@ const callbackErrorHandler = async (response) => {
19484
19697
  try {
19485
19698
  await response;
19486
19699
  } catch (ex) {
19487
- logger$p.error(ex);
19700
+ logger$r.error(ex);
19488
19701
  }
19489
19702
  return {
19490
19703
  error: "UNKNOWN_ERROR",
@@ -19587,7 +19800,7 @@ class IFrameWidget {
19587
19800
  message = responseData.errorMessage;
19588
19801
  }
19589
19802
  } catch (ex) {
19590
- logger$p.error(ex);
19803
+ logger$r.error(ex);
19591
19804
  }
19592
19805
  throw new AdyenKycSdkError(reason, jsonData.error);
19593
19806
  }
@@ -19774,7 +19987,7 @@ function BankVerificationWidget({
19774
19987
  ref: widgetContainerRef
19775
19988
  });
19776
19989
  }
19777
- const logger$o = createLogger("BankVerification");
19990
+ const logger$q = createLogger("BankVerification");
19778
19991
  const accountVerificationFields = ["verifiedAccountHolder", "verifiedBankCountry", "verifiedBankName", "verifiedCurrencyCode", "verifiedBankAccountNumber"];
19779
19992
  const InstantVerificationErrorContext = createContext(null);
19780
19993
  const useInstantVerificationErrorNotification = (notificationVisibilityDuration) => {
@@ -19806,7 +20019,7 @@ const usePreferredVendorForCountry = (country2, getBankVerificationVendors) => {
19806
20019
  const vendor = vendors[0];
19807
20020
  setPreferredVendor(vendor.name ? vendor : void 0);
19808
20021
  };
19809
- getPreferredVendor().catch(logger$o.error);
20022
+ getPreferredVendor().catch(logger$q.error);
19810
20023
  }, [country2, getBankVerificationVendors]);
19811
20024
  return preferredVendor;
19812
20025
  };
@@ -20005,12 +20218,6 @@ function BankVerification(props) {
20005
20218
  });
20006
20219
  }
20007
20220
  const BankVerification$1 = memo(BankVerification);
20008
- const CoreContext = createContext(void 0);
20009
- const useCoreContext = () => {
20010
- const context = useContext(CoreContext);
20011
- if (!context) throw Error("You need a <CoreProvider> to use core context");
20012
- return context;
20013
- };
20014
20221
  const countriesWithMultipleCurrencies = /* @__PURE__ */ new Set([CountryCodes.Bulgaria, CountryCodes.Canada, CountryCodes.Croatia, CountryCodes.CzechRepublic, CountryCodes.Hungary, CountryCodes.Romania, CountryCodes.Switzerland]);
20015
20222
  const countriesWithLocalFormat = /* @__PURE__ */ new Set([CountryCodes.Denmark, CountryCodes.Norway, CountryCodes.Poland, CountryCodes.Sweden, CountryCodes.UnitedKingdom]);
20016
20223
  const payoutCurrencySupport = {
@@ -21024,12 +21231,12 @@ function PayoutAccountComponent(props) {
21024
21231
  dataStoreId: id2
21025
21232
  }), shouldShowPayoutAlert(country2) && jsx(Alert, {
21026
21233
  hasCloseButton: false,
21027
- type: AlertTypes.BASIC,
21234
+ type: "basic",
21028
21235
  title: getSupportedCurrencyGuidance(i18n, country2, requiredFields)
21029
21236
  }), arePayoutAccountDetailsInvalid && jsx(Alert, {
21030
21237
  hasCloseButton: false,
21031
- className: "adl-u-margin-top-16",
21032
- type: AlertTypes.ERROR,
21238
+ className: "adyen-kyc-u-margin-top-16",
21239
+ type: "error",
21033
21240
  title: invalidFieldNames ? i18n.get("enterValid_", {
21034
21241
  values: {
21035
21242
  fieldNames: invalidFieldNames
@@ -21294,7 +21501,7 @@ function PayoutVerificationMethod(props) {
21294
21501
  children: [jsx(FormHeader, {
21295
21502
  heading: props.heading
21296
21503
  }), instantVerificationError && jsx(Alert, {
21297
- type: AlertTypes.ERROR,
21504
+ type: "error",
21298
21505
  className: "adyen-kyc-instant-verification-error",
21299
21506
  title: instantVerificationError.title,
21300
21507
  hasCloseButton: false,
@@ -23010,7 +23217,7 @@ function VerificationErrors({
23010
23217
  const defaultHeading = parentCode ? getErrorMessage(parentCode) : formUtils.getVal("correctErrorsResubmit");
23011
23218
  return jsx(Alert, {
23012
23219
  title: defaultHeading,
23013
- type: AlertTypes.ERROR,
23220
+ type: "error",
23014
23221
  hasCloseButton: false,
23015
23222
  children: verificationErrorMsg
23016
23223
  });
@@ -23115,13 +23322,13 @@ function Summary({
23115
23322
  children: renderSummaryItems(fieldData, labelData)
23116
23323
  }), jsx(Divider, {})]
23117
23324
  });
23118
- const renderSummaryContent = (data2) => {
23325
+ const renderSummaryContent = (summaryData) => {
23119
23326
  const summaryList = [];
23120
23327
  forms2.forEach(({
23121
23328
  formId,
23122
23329
  formName
23123
23330
  }) => {
23124
- const currentFormData = data2[formId];
23331
+ const currentFormData = summaryData[formId];
23125
23332
  const isFormEmpty = !currentFormData || Object.values(currentFormData).every((value) => isEmpty(value));
23126
23333
  if (isFormEmpty || formId === summaryStep.formId || omittedForms.includes(formId)) return;
23127
23334
  const summaryItems = currentFormData.hasInnerForms ? renderInnerForms(labels2 == null ? void 0 : labels2[formId], formId, currentFormData) : renderSummarySection(currentFormData, labels2 == null ? void 0 : labels2[formId], i18n.get(formName), formId);
@@ -23411,7 +23618,13 @@ const defaultPayoutAccountFormat = {
23411
23618
  [CountryCodes.Sweden]: "local",
23412
23619
  [CountryCodes.UnitedKingdom]: "local"
23413
23620
  };
23414
- const logger$n = createLogger("useScenarioConfiguration");
23621
+ const useUnifyLoadingStatus = (setParentLoadingStatus, ...childLoadingStatuses) => {
23622
+ useEffect(() => {
23623
+ const loadingStatus = childLoadingStatuses.some((status) => status === "loading") ? "loading" : "success";
23624
+ setParentLoadingStatus(loadingStatus);
23625
+ }, [...childLoadingStatuses]);
23626
+ };
23627
+ const logger$p = createLogger("useScenarioConfiguration");
23415
23628
  const useScenarioConfiguration = ({
23416
23629
  getConfigurationData,
23417
23630
  getPayoutAccountFormatData,
@@ -23427,23 +23640,26 @@ const useScenarioConfiguration = ({
23427
23640
  } = useCoreContext();
23428
23641
  const [configurationResponse, setConfigurationResponse] = useState();
23429
23642
  const [accountFormatResponse, setAccountFormatResponse] = useState();
23643
+ const [configurationLoadingStatus, setConfigurationLoadingStatus] = useState("success");
23644
+ const [payoutFormatLoadingStatus, setpayoutFormatLoadingStatus] = useState("success");
23645
+ useUnifyLoadingStatus(setLoadingStatus, configurationLoadingStatus, payoutFormatLoadingStatus);
23430
23646
  useEffect(() => {
23431
- setLoadingStatus("loading");
23647
+ setConfigurationLoadingStatus("loading");
23432
23648
  const makeConfigCallAndSave = async () => {
23433
23649
  try {
23434
23650
  const response = await getConfigurationData();
23435
23651
  setConfigurationResponse(response);
23436
23652
  } catch (err) {
23437
- logger$n.warn("WARNING: Configuration request failed - error:", err);
23653
+ logger$p.warn("WARNING: Configuration request failed - error:", err);
23438
23654
  } finally {
23439
- setLoadingStatus("success");
23655
+ setConfigurationLoadingStatus("success");
23440
23656
  }
23441
23657
  };
23442
- makeConfigCallAndSave().catch(logger$n.error);
23443
- }, [getConfigurationData, setLoadingStatus]);
23658
+ makeConfigCallAndSave().catch(logger$p.error);
23659
+ }, [getConfigurationData, setConfigurationLoadingStatus]);
23444
23660
  useEffect(() => {
23445
- setLoadingStatus("loading");
23446
23661
  if (!getPayoutAccountFormatData) return;
23662
+ setpayoutFormatLoadingStatus("loading");
23447
23663
  const makePayoutFormatCallAndSave = async () => {
23448
23664
  try {
23449
23665
  const response = await getPayoutAccountFormatData();
@@ -23456,13 +23672,13 @@ const useScenarioConfiguration = ({
23456
23672
  const defaultAccountFormat = defaultPayoutAccountFormat[country2] ?? allowedBankAccountFormats[0];
23457
23673
  setAccountFormat(existingBankAccountFormat ?? defaultAccountFormat);
23458
23674
  } catch (err) {
23459
- logger$n.warn("WARNING: Payout format request failed - error:", err);
23675
+ logger$p.warn("WARNING: Payout format request failed - error:", err);
23460
23676
  } finally {
23461
- setLoadingStatus("success");
23677
+ setpayoutFormatLoadingStatus("success");
23462
23678
  }
23463
23679
  };
23464
- makePayoutFormatCallAndSave().catch(logger$n.error);
23465
- }, [country2, setAccountFormat, getPayoutAccountFormatData, setLoadingStatus, existingBankAccountFormat]);
23680
+ makePayoutFormatCallAndSave().catch(logger$p.error);
23681
+ }, [country2, setAccountFormat, getPayoutAccountFormatData, setpayoutFormatLoadingStatus, existingBankAccountFormat]);
23466
23682
  const {
23467
23683
  fieldConfigurations,
23468
23684
  bankVerificationVendors,
@@ -23513,6 +23729,11 @@ const addLinkedFields = (fields) => {
23513
23729
  }
23514
23730
  return [...new Set(withLinkedFields)];
23515
23731
  };
23732
+ var TrustedFieldsProvider = /* @__PURE__ */ ((TrustedFieldsProvider2) => {
23733
+ TrustedFieldsProvider2["SINGPASS"] = "singpass";
23734
+ TrustedFieldsProvider2["KOMPANY"] = "kompany";
23735
+ return TrustedFieldsProvider2;
23736
+ })(TrustedFieldsProvider || {});
23516
23737
  const identityBase = {
23517
23738
  role: {
23518
23739
  rule: "REQUIRED"
@@ -23844,7 +24065,7 @@ const isFieldRequired = (fieldConfigurations, customRules) => {
23844
24065
  }
23845
24066
  return fieldConfigurations && ((fieldConfigurations == null ? void 0 : fieldConfigurations.rule) === "REQUIRED" || (customRules == null ? void 0 : customRules[fieldConfigurations.rule]) && customRules[fieldConfigurations.rule]() === "REQUIRED");
23846
24067
  };
23847
- function getPropsFromConfigurations(scenarioConfiguration, forms2, remediationActions, dataMissingErrors, fieldsWithExistingData, customRules = {}, customLabels2 = {}, customValidators = {}) {
24068
+ function getPropsFromConfigurations(scenarioConfiguration, forms2, remediationActions, dataMissingErrors, fieldsWithExistingData, customRules = {}, customLabels2 = {}, customValidators = {}, legalEntityTrustedFields) {
23848
24069
  var _a;
23849
24070
  const requiredFields = {};
23850
24071
  const optionalFields = {};
@@ -23856,9 +24077,19 @@ function getPropsFromConfigurations(scenarioConfiguration, forms2, remediationAc
23856
24077
  const masks = {};
23857
24078
  const validators2 = {};
23858
24079
  const obscuredFields = {};
24080
+ const trustedFields2 = {};
23859
24081
  if (!scenarioConfiguration) {
23860
24082
  return;
23861
24083
  }
24084
+ const readonly = ["legalFormDescription"];
24085
+ const trustedMappings = legalEntityTrustedFields == null ? void 0 : legalEntityTrustedFields.reduce((acc, trusted) => {
24086
+ switch (trusted.provider) {
24087
+ case TrustedFieldsProvider.KOMPANY:
24088
+ return [...acc, ...trusted.fields.map((tf) => businessDetailsApiKeyMapping[tf])];
24089
+ default:
24090
+ return acc;
24091
+ }
24092
+ }, []);
23862
24093
  (_a = Object.entries(forms2)) == null ? void 0 : _a.forEach(([formId, formDetails]) => {
23863
24094
  var _a2;
23864
24095
  const formFieldsWithExistingData = addLinkedFields(fieldsWithExistingData).filter((field) => field.startsWith(formId)).map((field) => field.slice(field.lastIndexOf(".") + 1));
@@ -23870,7 +24101,7 @@ function getPropsFromConfigurations(scenarioConfiguration, forms2, remediationAc
23870
24101
  const isFieldNeededToRemediateDataMissingError = isFieldRequiredToRemediateDataMissingError(formId, field, dataMissingErrors);
23871
24102
  const fieldHasExistingData = formFieldsWithExistingData.includes(field);
23872
24103
  const isRequired = isFieldRequiredByRemediationAction || isRequiredFromFieldConfig || isFieldNeededToRemediateDataMissingError || fieldHasExistingData;
23873
- if (isRequired) {
24104
+ if (isRequired && !readonly.includes(field)) {
23874
24105
  requiredFields[formId] = requiredFields[formId] ? [...requiredFields[formId], field] : [field];
23875
24106
  allFields[formId] = allFields[formId] ? [...allFields[formId], field] : [field];
23876
24107
  }
@@ -23880,6 +24111,10 @@ function getPropsFromConfigurations(scenarioConfiguration, forms2, remediationAc
23880
24111
  optionalFields[formId] = optionalFields[formId] ? [...optionalFields[formId], field] : [field];
23881
24112
  allFields[formId] = allFields[formId] ? [...allFields[formId], field] : [field];
23882
24113
  }
24114
+ const isFieldTrusted = isTrustedField(trustedMappings, formId, field);
24115
+ if (isFieldTrusted) {
24116
+ trustedFields2[formId] = trustedFields2[formId] ? [...trustedFields2[formId], field] : [field];
24117
+ }
23883
24118
  if (fieldConfigurations) {
23884
24119
  const customLabel = (_a3 = customLabels2 == null ? void 0 : customLabels2[field]) == null ? void 0 : _a3.call(customLabels2);
23885
24120
  const label = customLabel || fieldConfigurations.label;
@@ -23949,6 +24184,7 @@ function getPropsFromConfigurations(scenarioConfiguration, forms2, remediationAc
23949
24184
  placeholders,
23950
24185
  validators: validators2,
23951
24186
  obscuredFields,
24187
+ trustedFields: trustedFields2,
23952
24188
  helperText,
23953
24189
  masks
23954
24190
  };
@@ -23969,6 +24205,10 @@ const isFieldRequiredToRemediateDataMissingError = (formId, field, dataMissingEr
23969
24205
  const missingAndLinkedFields = addLinkedFields(missingFields);
23970
24206
  return missingAndLinkedFields.includes(makeTLDSFieldName(formId, field));
23971
24207
  };
24208
+ const isTrustedField = (trustedFields2, formId, field) => trustedFields2 == null ? void 0 : trustedFields2.some((trustedField) => {
24209
+ const split = trustedField.split(".");
24210
+ return split[0] === formId && split[split.length - 1] === field;
24211
+ });
23972
24212
  function getBaseTrackingPayload({
23973
24213
  trackingConfig = {
23974
24214
  topLevelLegalEntity: {}
@@ -24198,7 +24438,7 @@ const DateOfIncorporationFieldValidation = () => ({
24198
24438
  errorMessage: "invalidDateOfIncorporation"
24199
24439
  }]
24200
24440
  });
24201
- const DBA_NAME_FIELD = ["hasDBA", "dbaName"];
24441
+ const DBA_NAME_FIELD = ["hasDba", "dbaName"];
24202
24442
  function DBANameField({
24203
24443
  data,
24204
24444
  valid,
@@ -24206,35 +24446,39 @@ function DBANameField({
24206
24446
  labels: labels2,
24207
24447
  helperText,
24208
24448
  readonly,
24209
- handleChangeFor
24449
+ handleChangeFor,
24450
+ setErrors
24210
24451
  }) {
24211
24452
  const {
24212
24453
  i18n
24213
24454
  } = useI18nContext();
24214
- const selected = data.hasDBA ? "yesDba" : "noDba";
24215
- const handleHasDbaChange = (selection) => {
24216
- handleChangeFor("hasDBA")(selection === "yesDba");
24217
- };
24455
+ const selection = useMemo(() => {
24456
+ if (typeof data.hasDba === "undefined") return;
24457
+ if (!data.hasDba) setErrors == null ? void 0 : setErrors("dbaName", null);
24458
+ return data.hasDba ? "yes" : "no";
24459
+ }, [data.hasDba, setErrors]);
24218
24460
  return jsxs(Fragment, {
24219
24461
  children: [jsx(Field, {
24220
24462
  name: "hasDba",
24221
- label: labels2.hasDBA ?? i18n.get("hasDba"),
24222
- helper: (helperText == null ? void 0 : helperText.hasDBA) ?? i18n.get("hasDba__helperText"),
24463
+ label: labels2.hasDba ?? i18n.get("hasDba"),
24464
+ helper: (helperText == null ? void 0 : helperText.hasDba) ?? i18n.get("hasDba__helperText"),
24465
+ isValid: valid.hasDba,
24466
+ errorMessage: errors.hasDba,
24223
24467
  children: (childProps) => jsx(RadioGroup, {
24224
24468
  ...childProps,
24225
24469
  name: "hasDba",
24226
24470
  items: [{
24227
- id: "yesDba",
24471
+ id: "yes",
24228
24472
  name: "yes"
24229
24473
  }, {
24230
- id: "noDba",
24474
+ id: "no",
24231
24475
  name: "no"
24232
24476
  }],
24233
- value: selected,
24234
- onChange: (e) => handleHasDbaChange(e.target.value),
24477
+ value: selection,
24478
+ onChange: (e) => handleChangeFor("hasDba")(e.target.value === "yes"),
24235
24479
  horizontal: true
24236
24480
  })
24237
- }), data.hasDBA && jsx(Field, {
24481
+ }), data.hasDba && jsx(Field, {
24238
24482
  name: "dbaName",
24239
24483
  label: labels2.dbaName ?? i18n.get("dbaName"),
24240
24484
  errorMessage: errors.dbaName,
@@ -24255,9 +24499,12 @@ function DBANameField({
24255
24499
  })]
24256
24500
  });
24257
24501
  }
24502
+ const hasDbaFieldMetadata = {
24503
+ validators: [validateNotEmptyOnBlur]
24504
+ };
24258
24505
  const dbaNameFieldMetadata = {
24259
24506
  label: "dbaName",
24260
- validators: validateNotEmptyOnBlur
24507
+ validators: [validateNotEmptyOnBlur]
24261
24508
  };
24262
24509
  const TAX_INFORMATION_FIELD = ["taxInformation", "exemptedFromTax", "isUen"];
24263
24510
  function TaxInformationField({
@@ -24460,8 +24707,76 @@ const defaultFieldConfig$1 = entriesOf(defaultFieldConfig$8).reduce((fieldConfig
24460
24707
  };
24461
24708
  }
24462
24709
  }), {});
24710
+ function VerifiedBusinessCard({
24711
+ verifiedBusiness
24712
+ }) {
24713
+ const {
24714
+ i18n
24715
+ } = useI18nContext();
24716
+ const [expanded, setExpanded] = useState(false);
24717
+ const address2 = (verifiedBusiness == null ? void 0 : verifiedBusiness.street) && (verifiedBusiness == null ? void 0 : verifiedBusiness.city) && (verifiedBusiness == null ? void 0 : verifiedBusiness.state) && (verifiedBusiness == null ? void 0 : verifiedBusiness.zipcode) ? `${verifiedBusiness == null ? void 0 : verifiedBusiness.street} ${verifiedBusiness.city} ${verifiedBusiness.state} ${verifiedBusiness.zipcode}` : verifiedBusiness == null ? void 0 : verifiedBusiness.address;
24718
+ const addressLink = (verifiedBusiness == null ? void 0 : verifiedBusiness.address) ? `https://www.google.com/maps/place/${verifiedBusiness == null ? void 0 : verifiedBusiness.address.replaceAll(" ", "+")}` : void 0;
24719
+ return jsxs("section", {
24720
+ children: [jsx(Typography, {
24721
+ el: "h3",
24722
+ children: i18n.get("verifiedInformation")
24723
+ }), jsxs("div", {
24724
+ className: "adyen-kyc-verified-business-card",
24725
+ children: [jsxs("ul", {
24726
+ children: [jsxs("li", {
24727
+ children: [jsx(Typography, {
24728
+ className: "adyen-kyc-verified-business-card__data-title ",
24729
+ children: i18n.get("legalCompanyName__US")
24730
+ }), jsx(Typography, {
24731
+ children: verifiedBusiness == null ? void 0 : verifiedBusiness.name
24732
+ })]
24733
+ }), jsxs("li", {
24734
+ children: [jsx(Typography, {
24735
+ className: "adyen-kyc-verified-business-card__data-title ",
24736
+ children: i18n.get("registrationNumber__US")
24737
+ }), jsx(Typography, {
24738
+ children: verifiedBusiness == null ? void 0 : verifiedBusiness.registrationNumber
24739
+ })]
24740
+ })]
24741
+ }), jsx(Divider, {}), expanded && jsxs(Fragment, {
24742
+ children: [((verifiedBusiness == null ? void 0 : verifiedBusiness.legalForm) || address2) && jsxs("ul", {
24743
+ children: [(verifiedBusiness == null ? void 0 : verifiedBusiness.legalForm) && jsxs("li", {
24744
+ children: [jsx(Typography, {
24745
+ className: "adyen-kyc-verified-business-card__data-title ",
24746
+ children: i18n.get("legalForm")
24747
+ }), jsx(Typography, {
24748
+ children: verifiedBusiness == null ? void 0 : verifiedBusiness.legalForm
24749
+ })]
24750
+ }), address2 && jsxs("li", {
24751
+ children: [jsx(Typography, {
24752
+ className: "adyen-kyc-verified-business-card__data-title ",
24753
+ children: i18n.get("address")
24754
+ }), jsx(Typography, {
24755
+ children: jsxs("div", {
24756
+ className: "adyen-kyc-verified-business-card__address",
24757
+ children: [address2, jsx("a", {
24758
+ href: addressLink,
24759
+ target: "_blank",
24760
+ rel: "noreferrer",
24761
+ children: i18n.get("showOnMap")
24762
+ })]
24763
+ })
24764
+ })]
24765
+ })]
24766
+ }), jsx(Divider, {})]
24767
+ }), jsx("div", {
24768
+ className: "adyen-kyc-verified-business-card__button",
24769
+ children: jsx(Button, {
24770
+ label: expanded ? i18n.get("hideDetails") : i18n.get("showDetails"),
24771
+ showAsLink: true,
24772
+ onClick: () => setExpanded(!expanded)
24773
+ })
24774
+ })]
24775
+ })]
24776
+ });
24777
+ }
24463
24778
  const ADDITIONAL_INFORMATION_FORM_ID = "additionalInformation";
24464
- const additionalInformationFields = [...LEGAL_COMPANY_NAME_FIELD, ...DBA_NAME_FIELD, ...BUSINESS_REGISTRATION_NUMBER_FIELD, ...TAX_INFORMATION_FIELD, ...VAT_NUMBER_FIELD, ...DATE_OF_INCORPORATION_FIELD, ...STOCK_EXCHANGE_MIC_FIELD, ...STOCK_ISIN_FIELD, ...STOCK_TICKER_SYMBOL_FIELD];
24779
+ const additionalInformationFields = [...LEGAL_COMPANY_NAME_FIELD, ...DBA_NAME_FIELD, ...BUSINESS_REGISTRATION_NUMBER_FIELD, ...TAX_INFORMATION_FIELD, ...VAT_NUMBER_FIELD, ...DATE_OF_INCORPORATION_FIELD, ...STOCK_EXCHANGE_MIC_FIELD, ...STOCK_ISIN_FIELD, ...STOCK_TICKER_SYMBOL_FIELD, "legalFormDescription"];
24465
24780
  function AdditionalInformationComponent({
24466
24781
  data,
24467
24782
  labels: labels2,
@@ -24478,8 +24793,11 @@ function AdditionalInformationComponent({
24478
24793
  obscuredFields,
24479
24794
  optionalFields,
24480
24795
  readOnlyFields,
24796
+ trustedFields: trustedFields2,
24481
24797
  country: country2,
24482
- companyType: companyType2 = CompanyTypesValue.PRIVATE_COMPANY
24798
+ companyType: companyType2 = CompanyTypesValue.PRIVATE_COMPANY,
24799
+ verifiedBusiness,
24800
+ showCompanyStructure
24483
24801
  }) {
24484
24802
  var _a, _b, _c, _d;
24485
24803
  const {
@@ -24488,6 +24806,8 @@ function AdditionalInformationComponent({
24488
24806
  const {
24489
24807
  i18n
24490
24808
  } = useI18nContext();
24809
+ const showVerified = !!verifiedBusiness;
24810
+ const showStockData = companyType2 === CompanyTypesValue.PUBLIC_COMPANY;
24491
24811
  const initialFormUtilsProps = useMemo(() => ({
24492
24812
  data,
24493
24813
  labels: labels2,
@@ -24499,8 +24819,9 @@ function AdditionalInformationComponent({
24499
24819
  readOnlyFields,
24500
24820
  optionalFields,
24501
24821
  obscuredFields,
24822
+ trustedFields: trustedFields2,
24502
24823
  shouldValidate
24503
- }), [data, allFields, helperText, labels2, obscuredFields, optionalFields, placeholders, readOnly, readOnlyFields, requiredFields, shouldValidate]);
24824
+ }), [data, labels2, placeholders, helperText, readOnly, allFields, requiredFields, readOnlyFields, optionalFields, obscuredFields, trustedFields2, shouldValidate]);
24504
24825
  const registrationNumberOptions = useMemo(() => getCompanyRegistrationNumberOptions(country2, companyType2), [country2, companyType2]);
24505
24826
  const defaultRegistrationNumberType = (data == null ? void 0 : data.registrationNumber) ? inferCompanyRegistrationNumberType(data == null ? void 0 : data.registrationNumber, country2, companyType2) : registrationNumberOptions == null ? void 0 : registrationNumberOptions[0].id;
24506
24827
  const [registrationNumberType, setRegistrationNumberType] = useState(defaultRegistrationNumberType);
@@ -24509,6 +24830,19 @@ function AdditionalInformationComponent({
24509
24830
  const [taxIdNumberType, setTaxIdNumberType] = useState(defaultTaxIdNumberType);
24510
24831
  const defaultVatNumberType = (data == null ? void 0 : data.vatNumber) ? inferTaxIdNumberType(data == null ? void 0 : data.vatNumber, country2) : (_d = taxIdNumberOptions[country2]) == null ? void 0 : _d[0].id;
24511
24832
  const [vatNumberType, setVatNumberType] = useState(defaultVatNumberType);
24833
+ const getFormSchema2 = useCallback((currentData) => {
24834
+ var _a2;
24835
+ const fieldsToRemove = [];
24836
+ if (currentData.exemptedFromVat) {
24837
+ fieldsToRemove.push("vatNumber");
24838
+ } else {
24839
+ fieldsToRemove.push("vatAbsenceReason");
24840
+ }
24841
+ if (!currentData.hasDba) {
24842
+ fieldsToRemove.push("dbaName");
24843
+ }
24844
+ return ((_a2 = initialFormUtilsProps.requiredFields) == null ? void 0 : _a2.filter((field) => !fieldsToRemove.includes(field))) ?? [...LEGAL_COMPANY_NAME_FIELD, ...DBA_NAME_FIELD];
24845
+ }, [initialFormUtilsProps.requiredFields]);
24512
24846
  const mergedFieldProps = useMemo(() => {
24513
24847
  var _a2;
24514
24848
  return (_a2 = initialFormUtilsProps.allFields) == null ? void 0 : _a2.reduce((acc, field) => {
@@ -24517,6 +24851,8 @@ function AdditionalInformationComponent({
24517
24851
  return mergeFieldMetadataIntoProps(field, resolveFieldMetadata(defaultFieldConfig$a[country2], {
24518
24852
  isBusiness: true
24519
24853
  }, defaultFieldMetadata$a), acc);
24854
+ case "hasDba":
24855
+ return mergeFieldMetadataIntoProps("hasDba", hasDbaFieldMetadata, acc);
24520
24856
  case "dbaName":
24521
24857
  return mergeFieldMetadataIntoProps("dbaName", dbaNameFieldMetadata, acc);
24522
24858
  case "registrationNumber":
@@ -24553,31 +24889,22 @@ function AdditionalInformationComponent({
24553
24889
  }
24554
24890
  }, initialFormUtilsProps);
24555
24891
  }, [companyType2, country2, initialFormUtilsProps, registrationNumberType, taxIdNumberType, vatNumberType]);
24556
- const getSchema = (currentData) => {
24557
- const fieldsToRemove = [];
24558
- if (currentData.exemptedFromVat) {
24559
- fieldsToRemove.push("vatNumber");
24560
- } else {
24561
- fieldsToRemove.push("vatAbsenceReason");
24562
- }
24563
- if (!currentData.hasDBA) {
24564
- fieldsToRemove.push("dbaName");
24565
- }
24566
- return (requiredFields == null ? void 0 : requiredFields.filter((field) => !fieldsToRemove.includes(field))) ?? [...LEGAL_COMPANY_NAME_FIELD, ...DBA_NAME_FIELD];
24567
- };
24568
24892
  const {
24569
24893
  schema: formSchema,
24570
24894
  data: formData,
24571
24895
  errors: formErrors,
24572
24896
  valid: formValid,
24573
24897
  fieldProblems: formFieldProblems,
24574
- handleChangeFor
24898
+ handleChangeFor,
24899
+ resetToDefaultData,
24900
+ setErrors
24575
24901
  } = useForm({
24576
- schema: getSchema,
24902
+ schema: getFormSchema2,
24577
24903
  defaultData: data,
24578
24904
  rules: mergedFieldProps == null ? void 0 : mergedFieldProps.validators,
24579
24905
  optionalFields: mergedFieldProps == null ? void 0 : mergedFieldProps.optionalFields,
24580
24906
  obscuredFields: mergedFieldProps == null ? void 0 : mergedFieldProps.obscuredFields,
24907
+ trustedFields: mergedFieldProps == null ? void 0 : mergedFieldProps.trustedFields,
24581
24908
  fieldProblems: fieldValidationErrors,
24582
24909
  shouldValidate
24583
24910
  });
@@ -24591,8 +24918,21 @@ function AdditionalInformationComponent({
24591
24918
  fieldProblems: formFieldProblems
24592
24919
  });
24593
24920
  }, [formSchema, formData, formErrors, formFieldProblems, formValid, updateStateSlice]);
24594
- const [showVerified, setShowVerified] = useState(false);
24595
- const showStockData = companyType2 === CompanyTypesValue.PUBLIC_COMPANY;
24921
+ useEffect(() => {
24922
+ if (verifiedBusiness && verifiedBusiness.name !== formData.legalCompanyName) return handleChangeFor("legalCompanyName")(verifiedBusiness.name);
24923
+ if (!verifiedBusiness && !showCompanyStructure) {
24924
+ return resetToDefaultData();
24925
+ }
24926
+ }, [formData.legalCompanyName, verifiedBusiness, showCompanyStructure]);
24927
+ const showField = (fieldKeys) => fieldKeys.some((field) => {
24928
+ switch (field) {
24929
+ case "legalCompanyName": {
24930
+ return (formUtils.isRequiredField(field) || formUtils.isOptionalField(field)) && !(verifiedBusiness == null ? void 0 : verifiedBusiness.name);
24931
+ }
24932
+ default:
24933
+ return formUtils.isRequiredField(field) || formUtils.isOptionalField(field);
24934
+ }
24935
+ });
24596
24936
  return jsxs("form", {
24597
24937
  children: [jsx(FormHeader, {
24598
24938
  heading,
@@ -24604,18 +24944,13 @@ function AdditionalInformationComponent({
24604
24944
  formUtils
24605
24945
  }), jsxs("div", {
24606
24946
  className: "adyen-kyc-additional-information",
24607
- children: [showVerified && jsxs("div", {
24608
- className: "adyen-kyc-additional-information__verified-information",
24609
- children: [jsx("h3", {
24610
- children: i18n.get("verifiedInformation")
24611
- }), jsx("div", {
24612
- className: "adyen-kyc-verified-information-card"
24613
- })]
24614
- }), jsxs("div", {
24615
- className: "adyen-kyc-additional-information__other-business-information",
24616
- children: [showVerified && jsx("h3", {
24947
+ children: [showVerified && jsx(VerifiedBusinessCard, {
24948
+ verifiedBusiness
24949
+ }), jsxs("section", {
24950
+ children: [showVerified && jsx(Typography, {
24951
+ el: "h3",
24617
24952
  children: i18n.get("otherBusinessInformation")
24618
- }), formUtils.isRequiredField("legalCompanyName") && jsx("div", {
24953
+ }), showField(LEGAL_COMPANY_NAME_FIELD) && jsx("div", {
24619
24954
  className: "adyen-kyc-field-wrapper",
24620
24955
  children: jsx(LegalCompanyNameField, {
24621
24956
  data: formUtils.getFieldData(formData, LEGAL_COMPANY_NAME_FIELD),
@@ -24628,19 +24963,20 @@ function AdditionalInformationComponent({
24628
24963
  readonly: formUtils.isReadOnly("legalCompanyName"),
24629
24964
  handleChangeFor
24630
24965
  })
24631
- }), formUtils.isRequiredField("dbaName") && jsx("div", {
24966
+ }), showField(DBA_NAME_FIELD) && jsx("div", {
24632
24967
  className: "adyen-kyc-field-wrapper",
24633
24968
  children: jsx(DBANameField, {
24634
24969
  data: formUtils.getFieldData(formData, DBA_NAME_FIELD),
24635
24970
  valid: formUtils.getFieldValid(formValid, DBA_NAME_FIELD),
24636
24971
  errors: formUtils.getFieldErrors(formErrors, formFieldProblems, DBA_NAME_FIELD),
24637
24972
  labels: formUtils.getFieldLabels(DBA_NAME_FIELD, {
24638
- hasDBA: "hasDba"
24973
+ hasDba: "hasDba"
24639
24974
  }),
24640
24975
  readonly: formUtils.isReadOnly("dbaName"),
24641
- handleChangeFor
24976
+ handleChangeFor,
24977
+ setErrors
24642
24978
  })
24643
- }), formUtils.isRequiredField("registrationNumber") && jsx("div", {
24979
+ }), showField(BUSINESS_REGISTRATION_NUMBER_FIELD) && jsx("div", {
24644
24980
  className: "adyen-kyc-field-wrapper",
24645
24981
  children: jsx(BusinessRegistrationNumberField, {
24646
24982
  data: formUtils.getFieldData(formData, BUSINESS_REGISTRATION_NUMBER_FIELD),
@@ -24664,7 +25000,7 @@ function AdditionalInformationComponent({
24664
25000
  registrationNumberType,
24665
25001
  setRegistrationNumberType
24666
25002
  })
24667
- }), formUtils.isRequiredField("taxInformation") && jsx("div", {
25003
+ }), showField(TAX_INFORMATION_FIELD) && jsx("div", {
24668
25004
  className: "adyen-kyc-field-wrapper",
24669
25005
  children: jsx(TaxInformationField, {
24670
25006
  data: formUtils.getFieldData(formData, TAX_INFORMATION_FIELD),
@@ -24687,7 +25023,7 @@ function AdditionalInformationComponent({
24687
25023
  setTaxIdNumberType,
24688
25024
  defaultData: data == null ? void 0 : data.taxInformation
24689
25025
  })
24690
- }), formUtils.isRequiredField("vatNumber") && jsx("div", {
25026
+ }), showField(VAT_NUMBER_FIELD) && jsx("div", {
24691
25027
  className: "adyen-kyc-field-wrapper",
24692
25028
  children: jsx(VatNumberField, {
24693
25029
  data: formUtils.getFieldData(formData, VAT_NUMBER_FIELD),
@@ -24706,7 +25042,7 @@ function AdditionalInformationComponent({
24706
25042
  vatNumberType,
24707
25043
  setVatNumberType
24708
25044
  })
24709
- }), formUtils.isRequiredField("dateOfIncorporation") && jsx("div", {
25045
+ }), showField(DATE_OF_INCORPORATION_FIELD) && jsx("div", {
24710
25046
  className: "adyen-kyc-field-wrapper",
24711
25047
  children: jsx(DateOfIncorporationField, {
24712
25048
  data: formUtils.getFieldData(formData, DATE_OF_INCORPORATION_FIELD),
@@ -24720,11 +25056,11 @@ function AdditionalInformationComponent({
24720
25056
  handleChangeFor
24721
25057
  })
24722
25058
  })]
24723
- }), showStockData && jsxs("div", {
24724
- className: "adyen-kyc-additional-information__stock-exchange-information",
24725
- children: [jsx("h3", {
25059
+ }), showStockData && jsxs("section", {
25060
+ children: [jsx(Typography, {
25061
+ el: "h3",
24726
25062
  children: i18n.get("stockExchangeInformation")
24727
- }), formUtils.isRequiredField("stockExchangeMIC") && jsx("div", {
25063
+ }), showField(STOCK_EXCHANGE_MIC_FIELD) && jsx("div", {
24728
25064
  className: "adyen-kyc-field-wrapper",
24729
25065
  children: jsx(StockExchangeMICField, {
24730
25066
  data: formUtils.getFieldData(formData, STOCK_EXCHANGE_MIC_FIELD),
@@ -24738,7 +25074,7 @@ function AdditionalInformationComponent({
24738
25074
  shouldValidate,
24739
25075
  handleChangeFor
24740
25076
  })
24741
- }), formUtils.isRequiredField("stockISIN") && jsx("div", {
25077
+ }), showField(STOCK_ISIN_FIELD) && jsx("div", {
24742
25078
  className: "adyen-kyc-field-wrapper",
24743
25079
  children: jsx(StockISINField, {
24744
25080
  data: formUtils.getFieldData(formData, STOCK_ISIN_FIELD),
@@ -24752,7 +25088,7 @@ function AdditionalInformationComponent({
24752
25088
  shouldValidate,
24753
25089
  handleChangeFor
24754
25090
  })
24755
- }), formUtils.isRequiredField("stockTickerSymbol") && jsx("div", {
25091
+ }), showField(STOCK_TICKER_SYMBOL_FIELD) && jsx("div", {
24756
25092
  className: "adyen-kyc-field-wrapper",
24757
25093
  children: jsx(StockTickerSymbolField, {
24758
25094
  data: formUtils.getFieldData(formData, STOCK_TICKER_SYMBOL_FIELD),
@@ -24862,9 +25198,11 @@ function BasicInformationComponent({
24862
25198
  obscuredFields,
24863
25199
  optionalFields,
24864
25200
  readOnlyFields,
25201
+ trustedFields: trustedFields2,
24865
25202
  country: country2,
24866
25203
  companyType: companyType2 = CompanyTypesValue.PRIVATE_COMPANY,
24867
- isTopLevelEntity
25204
+ isTopLevelEntity,
25205
+ isBusinessSelection
24868
25206
  }) {
24869
25207
  var _a, _b, _c, _d, _e;
24870
25208
  const {
@@ -24889,8 +25227,9 @@ function BasicInformationComponent({
24889
25227
  readOnlyFields,
24890
25228
  optionalFields,
24891
25229
  obscuredFields,
25230
+ trustedFields: trustedFields2,
24892
25231
  shouldValidate
24893
- }), [allFields, helperText, labels2, obscuredFields, optionalFields, placeholders, readOnly, readOnlyFields, requiredFields, shouldValidate]);
25232
+ }), [allFields, helperText, labels2, obscuredFields, optionalFields, placeholders, readOnly, readOnlyFields, requiredFields, trustedFields2, shouldValidate]);
24894
25233
  const registrationNumberOptions = useMemo(() => getCompanyRegistrationNumberOptions(country2, companyType2), [country2, companyType2]);
24895
25234
  const defaultRegistrationNumberType = (data == null ? void 0 : data.registrationNumber) ? inferCompanyRegistrationNumberType(data == null ? void 0 : data.registrationNumber, country2, companyType2) : (_a = registrationNumberOptions == null ? void 0 : registrationNumberOptions[0]) == null ? void 0 : _a.id;
24896
25235
  const [registrationNumberType, setRegistrationNumberType] = useState(defaultRegistrationNumberType);
@@ -24943,6 +25282,7 @@ function BasicInformationComponent({
24943
25282
  rules: mergedFieldProps == null ? void 0 : mergedFieldProps.validators,
24944
25283
  optionalFields: mergedFieldProps == null ? void 0 : mergedFieldProps.optionalFields,
24945
25284
  obscuredFields: mergedFieldProps == null ? void 0 : mergedFieldProps.obscuredFields,
25285
+ trustedFields: mergedFieldProps == null ? void 0 : mergedFieldProps.trustedFields,
24946
25286
  fieldProblems: fieldValidationErrors,
24947
25287
  shouldValidate
24948
25288
  });
@@ -24957,6 +25297,7 @@ function BasicInformationComponent({
24957
25297
  });
24958
25298
  }, [formSchema, formData, formErrors, formFieldProblems, formValid, updateStateSlice]);
24959
25299
  return jsxs("form", {
25300
+ className: isBusinessSelection ? "adyen-kyc-hide-form" : void 0,
24960
25301
  children: [jsx(FormHeader, {
24961
25302
  heading,
24962
25303
  description: description2
@@ -24967,94 +25308,272 @@ function BasicInformationComponent({
24967
25308
  formUtils
24968
25309
  }), jsxs("div", {
24969
25310
  className: "adyen-kyc-basic-information",
24970
- children: [formUtils.isRequiredField("country") && jsx("div", {
24971
- className: "adyen-kyc-field-wrapper",
24972
- children: jsx(CountryField, {
24973
- data: formUtils.getFieldData(formData, COUNTRY_FIELD),
24974
- valid: formUtils.getFieldValid(formValid, COUNTRY_FIELD),
24975
- errors: formUtils.getFieldErrors(formErrors, formFieldProblems, COUNTRY_FIELD),
24976
- labels: formUtils.getFieldLabels(COUNTRY_FIELD, {
24977
- country: "countryRegionOfEstablishment"
24978
- }),
24979
- readonly: formUtils.isReadOnly("country") || !isAllowedEditPrefilledCountry,
24980
- handleChangeFor,
24981
- allowedCountries: isTopLevelEntity ? allowedCountries : void 0
24982
- })
24983
- }), formUtils.isRequiredField("businessName") && jsx("div", {
24984
- className: "adyen-kyc-field-wrapper",
24985
- children: jsx(BusinessNameField, {
24986
- data: formUtils.getFieldData(formData, BUSINESS_NAME_FIELD),
24987
- valid: formUtils.getFieldValid(formValid, BUSINESS_NAME_FIELD),
24988
- errors: formUtils.getFieldErrors(formErrors, formFieldProblems, BUSINESS_NAME_FIELD),
24989
- labels: formUtils.getFieldLabels(BUSINESS_NAME_FIELD),
24990
- readonly: formUtils.isReadOnly("businessName"),
24991
- handleChangeFor
24992
- })
24993
- }), formUtils.isRequiredField("taxInformation") && jsx("div", {
24994
- className: "adyen-kyc-field-wrapper",
24995
- children: jsx(TaxInformationField, {
24996
- data: formUtils.getFieldData(formData, TAX_INFORMATION_FIELD),
24997
- valid: formUtils.getFieldValid(formValid, TAX_INFORMATION_FIELD),
24998
- errors: formUtils.getFieldErrors(formErrors, formFieldProblems, TAX_INFORMATION_FIELD),
24999
- labels: formUtils.getFieldLabels(TAX_INFORMATION_FIELD, {
25000
- exemptedFromTax: "iDontHaveATaxId"
25001
- }),
25002
- mask: formUtils.getMask("taxInformation"),
25003
- helperText: formUtils.getFieldHelperText(TAX_INFORMATION_FIELD),
25004
- placeholders: formUtils.getFieldPlaceholders(TAX_INFORMATION_FIELD),
25005
- guidanceText: formUtils.getFieldGuidanceText(TAX_INFORMATION_FIELD),
25006
- readonly: formUtils.isReadOnly("taxInformation"),
25007
- shouldValidate,
25008
- handleChangeFor,
25009
- canExempt: formUtils.isRequiredField("exemptedFromTax"),
25010
- registrationNumber: formData.registrationNumber,
25011
- isUen: formUtils.isRequiredField("isUen"),
25012
- country: formData.country ?? country2,
25013
- companyType: companyType2,
25014
- taxIdNumberType,
25015
- setTaxIdNumberType,
25016
- defaultData: data == null ? void 0 : data.taxInformation
25017
- })
25018
- }), formUtils.isRequiredField("stateOrProvince") && jsx("div", {
25019
- className: "adyen-kyc-field-wrapper",
25020
- children: jsx(StateField, {
25021
- data: formUtils.getFieldData(formData, STATE_FIELD),
25022
- valid: formUtils.getFieldValid(formValid, STATE_FIELD),
25023
- errors: formUtils.getFieldErrors(formErrors, formFieldProblems, STATE_FIELD),
25024
- labels: formUtils.getFieldLabels(STATE_FIELD),
25025
- placeholders: formUtils.getFieldPlaceholders(STATE_FIELD),
25026
- readonly: formUtils.isReadOnly("stateOrProvince"),
25027
- handleChangeFor,
25028
- selectedCountry: formData.country
25029
- })
25030
- }), (formUtils.isRequiredField("registrationNumber") || formUtils.isOptionalField("registrationNumber")) && jsx("div", {
25031
- className: "adyen-kyc-field-wrapper",
25032
- children: jsx(BusinessRegistrationNumberField, {
25033
- data: formUtils.getFieldData(formData, BUSINESS_REGISTRATION_NUMBER_FIELD),
25034
- valid: formUtils.getFieldValid(formValid, BUSINESS_REGISTRATION_NUMBER_FIELD),
25035
- errors: formUtils.getFieldErrors(formErrors, formFieldProblems, BUSINESS_REGISTRATION_NUMBER_FIELD),
25036
- labels: formUtils.getFieldLabels(BUSINESS_REGISTRATION_NUMBER_FIELD, {
25037
- exemptedFromRegistrationNumber: "iDontHaveARegistrationNumber"
25038
- }),
25039
- mask: formUtils.getMask("registrationNumber"),
25040
- guidanceText: formUtils.getFieldGuidanceText(BUSINESS_REGISTRATION_NUMBER_FIELD),
25041
- placeholders: formUtils.getFieldPlaceholders(BUSINESS_REGISTRATION_NUMBER_FIELD),
25042
- helperText: formUtils.getFieldHelperText(BUSINESS_REGISTRATION_NUMBER_FIELD),
25043
- readonly: formUtils.isReadOnly("registrationNumber"),
25044
- optional: formUtils.isOptionalField("registrationNumber"),
25045
- shouldValidate,
25046
- handleChangeFor,
25047
- country: formData.country ?? country2,
25048
- canExempt: formUtils.isRequiredField("exemptedFromRegistrationNumber"),
25049
- companyType: companyType2,
25050
- registrationNumberOptions,
25051
- registrationNumberType,
25052
- setRegistrationNumberType
25311
+ children: [jsx("fieldset", {
25312
+ children: jsx("div", {
25313
+ className: "adyen-kyc-field-wrapper",
25314
+ children: jsx(CountryField, {
25315
+ data: formUtils.getFieldData(formData, COUNTRY_FIELD),
25316
+ valid: formUtils.getFieldValid(formValid, COUNTRY_FIELD),
25317
+ errors: formUtils.getFieldErrors(formErrors, formFieldProblems, COUNTRY_FIELD),
25318
+ labels: formUtils.getFieldLabels(COUNTRY_FIELD, {
25319
+ country: "countryRegionOfEstablishment"
25320
+ }),
25321
+ readonly: formUtils.isReadOnly("country") || !isAllowedEditPrefilledCountry,
25322
+ handleChangeFor,
25323
+ allowedCountries: isTopLevelEntity ? allowedCountries : void 0
25324
+ })
25053
25325
  })
25326
+ }), COUNTRIES_USING_COMPANY_SEARCH.includes(formData.country ?? country2) && jsxs("fieldset", {
25327
+ children: [formUtils.isRequiredField("businessName") && jsx("div", {
25328
+ className: "adyen-kyc-field-wrapper",
25329
+ children: jsx(BusinessNameField, {
25330
+ data: formUtils.getFieldData(formData, BUSINESS_NAME_FIELD),
25331
+ valid: formUtils.getFieldValid(formValid, BUSINESS_NAME_FIELD),
25332
+ errors: formUtils.getFieldErrors(formErrors, formFieldProblems, BUSINESS_NAME_FIELD),
25333
+ labels: formUtils.getFieldLabels(BUSINESS_NAME_FIELD),
25334
+ readonly: formUtils.isReadOnly("businessName"),
25335
+ handleChangeFor
25336
+ })
25337
+ }), formUtils.isRequiredField("taxInformation") && jsx("div", {
25338
+ className: "adyen-kyc-field-wrapper",
25339
+ children: jsx(TaxInformationField, {
25340
+ data: formUtils.getFieldData(formData, TAX_INFORMATION_FIELD),
25341
+ valid: formUtils.getFieldValid(formValid, TAX_INFORMATION_FIELD),
25342
+ errors: formUtils.getFieldErrors(formErrors, formFieldProblems, TAX_INFORMATION_FIELD),
25343
+ labels: formUtils.getFieldLabels(TAX_INFORMATION_FIELD, {
25344
+ exemptedFromTax: "iDontHaveATaxId"
25345
+ }),
25346
+ mask: formUtils.getMask("taxInformation"),
25347
+ helperText: formUtils.getFieldHelperText(TAX_INFORMATION_FIELD),
25348
+ placeholders: formUtils.getFieldPlaceholders(TAX_INFORMATION_FIELD),
25349
+ guidanceText: formUtils.getFieldGuidanceText(TAX_INFORMATION_FIELD),
25350
+ readonly: formUtils.isReadOnly("taxInformation"),
25351
+ shouldValidate,
25352
+ handleChangeFor,
25353
+ canExempt: formUtils.isRequiredField("exemptedFromTax"),
25354
+ registrationNumber: formData.registrationNumber,
25355
+ isUen: formUtils.isRequiredField("isUen"),
25356
+ country: formData.country ?? country2,
25357
+ companyType: companyType2,
25358
+ taxIdNumberType,
25359
+ setTaxIdNumberType,
25360
+ defaultData: data == null ? void 0 : data.taxInformation
25361
+ })
25362
+ }), formUtils.isRequiredField("stateOrProvince") && jsx("div", {
25363
+ className: "adyen-kyc-field-wrapper",
25364
+ children: jsx(StateField, {
25365
+ data: formUtils.getFieldData(formData, STATE_FIELD),
25366
+ valid: formUtils.getFieldValid(formValid, STATE_FIELD),
25367
+ errors: formUtils.getFieldErrors(formErrors, formFieldProblems, STATE_FIELD),
25368
+ labels: formUtils.getFieldLabels(STATE_FIELD),
25369
+ placeholders: formUtils.getFieldPlaceholders(STATE_FIELD),
25370
+ readonly: formUtils.isReadOnly("stateOrProvince"),
25371
+ handleChangeFor,
25372
+ selectedCountry: formData.country
25373
+ })
25374
+ }), (formUtils.isRequiredField("registrationNumber") || formUtils.isOptionalField("registrationNumber")) && jsx("div", {
25375
+ className: "adyen-kyc-field-wrapper",
25376
+ children: jsx(BusinessRegistrationNumberField, {
25377
+ data: formUtils.getFieldData(formData, BUSINESS_REGISTRATION_NUMBER_FIELD),
25378
+ valid: formUtils.getFieldValid(formValid, BUSINESS_REGISTRATION_NUMBER_FIELD),
25379
+ errors: formUtils.getFieldErrors(formErrors, formFieldProblems, BUSINESS_REGISTRATION_NUMBER_FIELD),
25380
+ labels: formUtils.getFieldLabels(BUSINESS_REGISTRATION_NUMBER_FIELD, {
25381
+ exemptedFromRegistrationNumber: "iDontHaveARegistrationNumber"
25382
+ }),
25383
+ mask: formUtils.getMask("registrationNumber"),
25384
+ guidanceText: formUtils.getFieldGuidanceText(BUSINESS_REGISTRATION_NUMBER_FIELD),
25385
+ placeholders: formUtils.getFieldPlaceholders(BUSINESS_REGISTRATION_NUMBER_FIELD),
25386
+ helperText: formUtils.getFieldHelperText(BUSINESS_REGISTRATION_NUMBER_FIELD),
25387
+ readonly: formUtils.isReadOnly("registrationNumber"),
25388
+ optional: formUtils.isOptionalField("registrationNumber"),
25389
+ shouldValidate,
25390
+ handleChangeFor,
25391
+ country: formData.country ?? country2,
25392
+ canExempt: formUtils.isRequiredField("exemptedFromRegistrationNumber"),
25393
+ companyType: companyType2,
25394
+ registrationNumberOptions,
25395
+ registrationNumberType,
25396
+ setRegistrationNumberType
25397
+ })
25398
+ })]
25054
25399
  })]
25055
25400
  })]
25056
25401
  });
25057
25402
  }
25403
+ const mapOrganizationTypeToCompanyType = (organizationType) => {
25404
+ switch (organizationType) {
25405
+ case "BUSINESS":
25406
+ return CompanyTypesValue.PRIVATE_COMPANY;
25407
+ case "NON_PROFIT":
25408
+ return CompanyTypesValue.NON_PROFIT_OR_CHARITABLE;
25409
+ case "PUBLIC_COMPANY":
25410
+ case "LISTED_PUBLIC_COMPANY":
25411
+ return CompanyTypesValue.PUBLIC_COMPANY;
25412
+ case "UNLISTED_PUBLIC_COMPANY":
25413
+ return CompanyTypesValue.UNLISTED_PUBLIC_COMPANY;
25414
+ case "GOVERNMENTAL_ORGANIZATION":
25415
+ return CompanyTypesValue.GOVERNMENTAL_ORGANIZATION;
25416
+ case "SOLE_PROPRIETOR":
25417
+ return CompanyTypesValue.SOLE_PROPRIETORSHIP;
25418
+ case "PARTNERSHIP_INCORPORATED":
25419
+ return CompanyTypesValue.INCORPORATED_PARTNERSHIP;
25420
+ case "ASSOCIATION_INCORPORATED":
25421
+ return CompanyTypesValue.INCORPORATED_ASSOCIATION;
25422
+ case "OTHER":
25423
+ case "PARTNERSHIP":
25424
+ return void 0;
25425
+ default:
25426
+ return CompanyTypesValue.PRIVATE_COMPANY;
25427
+ }
25428
+ };
25429
+ const mapCompanyDataResponseToFormSchema = (company2) => ({
25430
+ companyBasics: {
25431
+ country: company2.country,
25432
+ stateOrProvince: company2.state,
25433
+ legalCompanyName: company2.name
25434
+ },
25435
+ companyRegistrationAddress: {
25436
+ registrationAddress: {
25437
+ address: company2.street,
25438
+ stateOrProvince: company2.state,
25439
+ country: company2.country,
25440
+ postalCode: company2.zipcode,
25441
+ city: company2.city
25442
+ }
25443
+ },
25444
+ companyStructure: {
25445
+ entityType: mapOrganizationTypeToCompanyType(company2.organizationType)
25446
+ },
25447
+ companyOtherDetails: {
25448
+ registrationNumber: company2.registrationNumber
25449
+ }
25450
+ });
25451
+ const mapCompanySearchDocumentToApiDocument = async (data, entityId) => {
25452
+ var _a, _b, _c;
25453
+ const {
25454
+ companyRegistrationDocument: companyRegistrationDocument2,
25455
+ companyTaxDocument
25456
+ } = data;
25457
+ const entityType2 = "legalEntity";
25458
+ const taxDocumentType = COUNTRIES_THAT_USE_TAX_ID_INSTEAD_OF_VAT.includes((_a = data.companyBasics) == null ? void 0 : _a.country) ? DocumentType.PROOF_OF_ORGANIZATION_TAX_INFO : DocumentType.VAT_DOCUMENT;
25459
+ const documents2 = await Promise.all([
25460
+ createDocumentRequest({
25461
+ entityId,
25462
+ entityType: entityType2,
25463
+ documentType: DocumentType.REGISTRATION_DOCUMENT,
25464
+ page1: (_b = companyRegistrationDocument2 == null ? void 0 : companyRegistrationDocument2.registrationDocument) == null ? void 0 : _b[0]
25465
+ }),
25466
+ createDocumentRequest({
25467
+ entityId,
25468
+ entityType: entityType2,
25469
+ documentType: taxDocumentType,
25470
+ page1: (_c = companyTaxDocument == null ? void 0 : companyTaxDocument.taxDocument) == null ? void 0 : _c[0]
25471
+ })
25472
+ // Add this when we need shareholder document functionality
25473
+ // createDocumentRequest(legalEntityId, 'legalEntity', DocumentType.SHAREHOLDER_DOCUMENT, shareholderDocument?.[0])
25474
+ ]);
25475
+ return documents2.filter(Boolean);
25476
+ };
25477
+ const mapCompanySearchSchemaToLegalEntity = (data) => {
25478
+ var _a, _b, _c, _d, _e;
25479
+ const requestObj = {
25480
+ ...formatObject(data, companySearchApiKeyMapping)
25481
+ };
25482
+ if (requestObj.organization) {
25483
+ if (((_a = data.companyBasics) == null ? void 0 : _a.taxInformation) || ((_b = data.companyOtherDetails) == null ? void 0 : _b.taxInformation)) {
25484
+ requestObj.organization.taxInformation = ((_c = data.companyBasics) == null ? void 0 : _c.country) === "US" ? (_d = data.companyBasics) == null ? void 0 : _d.taxInformation : (_e = data.companyOtherDetails) == null ? void 0 : _e.taxInformation;
25485
+ }
25486
+ if (requestObj.organization.vatAbsenceReason) {
25487
+ requestObj.organization.vatNumber = "";
25488
+ }
25489
+ }
25490
+ requestObj.type = LegalEntityType.ORGANIZATION;
25491
+ return requestObj;
25492
+ };
25493
+ const mapApiDocumentToCompanySearchDocuments = (entityId) => {
25494
+ const registrationDocument2 = getDocument$1(entityId, DocumentType.REGISTRATION_DOCUMENT) ?? null;
25495
+ const taxDocument2 = getDocument$1(entityId, DocumentType.VAT_DOCUMENT) ?? getDocument$1(entityId, DocumentType.PROOF_OF_ORGANIZATION_TAX_INFO) ?? null;
25496
+ return {
25497
+ companyRegistrationDocument: registrationDocument2 ? {
25498
+ registrationDocument: [mapExistingFile(getPageName(registrationDocument2))]
25499
+ } : void 0,
25500
+ companyTaxDocument: taxDocument2 ? {
25501
+ taxDocument: [mapExistingFile(getPageName(taxDocument2))]
25502
+ } : void 0
25503
+ };
25504
+ };
25505
+ const mapLegalEntityToCompanySearchSchema = (legalEntity, isChangingType, accountHolder2) => {
25506
+ const companySearchSchema = {
25507
+ companyBasics: {},
25508
+ companyRegistrationAddress: {},
25509
+ companyStructure: {},
25510
+ companyOtherDetails: {},
25511
+ companyRegistrationDocument: {},
25512
+ companyTaxDocument: {},
25513
+ ...formatObject(legalEntity, companySearchComponentsKeyMapping)
25514
+ };
25515
+ const {
25516
+ companyRegistrationDocument: companyRegistrationDocument2,
25517
+ companyTaxDocument
25518
+ } = mapApiDocumentToCompanySearchDocuments(legalEntity == null ? void 0 : legalEntity.id);
25519
+ return entriesOf(companySearchSchema).reduce((componentData, [key, value]) => {
25520
+ var _a, _b, _c, _d, _e, _f, _g;
25521
+ switch (key) {
25522
+ case "companyBasics": {
25523
+ return {
25524
+ ...componentData,
25525
+ [key]: value
25526
+ };
25527
+ }
25528
+ case "companyRegistrationAddress": {
25529
+ return {
25530
+ ...componentData,
25531
+ [key]: {
25532
+ ...value,
25533
+ operationalAddressIsSame: ((_a = legalEntity.organization) == null ? void 0 : _a.principalPlaceOfBusiness) ? operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_NOT_SAME : operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_SAME
25534
+ }
25535
+ };
25536
+ }
25537
+ case "companyOtherDetails": {
25538
+ return {
25539
+ ...componentData,
25540
+ [key]: {
25541
+ ...value,
25542
+ tradingName: !((_b = legalEntity.organization) == null ? void 0 : _b.doingBusinessAs) ? (_c = legalEntity.organization) == null ? void 0 : _c.legalName : (_d = legalEntity.organization) == null ? void 0 : _d.doingBusinessAs,
25543
+ sameNameAsLegalName: !((_e = legalEntity.organization) == null ? void 0 : _e.doingBusinessAs) || ((_f = legalEntity.organization) == null ? void 0 : _f.doingBusinessAs) === ((_g = legalEntity.organization) == null ? void 0 : _g.legalName)
25544
+ }
25545
+ };
25546
+ }
25547
+ case "companyStructure": {
25548
+ return {
25549
+ ...componentData,
25550
+ [key]: {
25551
+ ...value,
25552
+ accountHolder: getDefaultAccountHolderType(legalEntity, isChangingType, accountHolder2)
25553
+ }
25554
+ };
25555
+ }
25556
+ case "companyRegistrationDocument": {
25557
+ return {
25558
+ ...componentData,
25559
+ [key]: {
25560
+ ...companyRegistrationDocument2
25561
+ }
25562
+ };
25563
+ }
25564
+ case "companyTaxDocument": {
25565
+ return {
25566
+ ...componentData,
25567
+ [key]: {
25568
+ ...companyTaxDocument
25569
+ }
25570
+ };
25571
+ }
25572
+ default:
25573
+ return componentData;
25574
+ }
25575
+ }, {});
25576
+ };
25058
25577
  const CompanyStructureValidation = {
25059
25578
  entityType: {
25060
25579
  modes: ["blur"],
@@ -25074,13 +25593,18 @@ function CompanyStructureComponent({
25074
25593
  fieldValidationErrors,
25075
25594
  requiredFields,
25076
25595
  country: country2,
25596
+ verifiedBusiness,
25077
25597
  kompanyVerifiedData,
25598
+ showCompanyStructure,
25078
25599
  ...props
25079
25600
  }) {
25080
25601
  var _a;
25081
25602
  const {
25082
25603
  i18n
25083
25604
  } = useI18nContext();
25605
+ const {
25606
+ isExperimentEnabled
25607
+ } = useExperimentsContext();
25084
25608
  const isNewEntryFlowEnabled = useEnableNewEntryFlow();
25085
25609
  const {
25086
25610
  updateStateSlice
@@ -25092,7 +25616,9 @@ function CompanyStructureComponent({
25092
25616
  valid: formValid,
25093
25617
  errors: formErrors,
25094
25618
  fieldProblems: formFieldProblems,
25095
- handleChangeFor
25619
+ handleChangeFor,
25620
+ setData,
25621
+ setValid
25096
25622
  } = useForm({
25097
25623
  schema,
25098
25624
  defaultData: data,
@@ -25115,6 +25641,20 @@ function CompanyStructureComponent({
25115
25641
  }
25116
25642
  prevVerifiedDataRef.current = kompanyVerifiedData;
25117
25643
  }, [kompanyVerifiedData]);
25644
+ useEffect(() => {
25645
+ if (!isExperimentEnabled("EnableNewBusinessDetailsFlow")) return;
25646
+ if (!showCompanyStructure) {
25647
+ setValid("entityType", false);
25648
+ return setData("entityType", data == null ? void 0 : data.entityType);
25649
+ }
25650
+ if (!verifiedBusiness && (data == null ? void 0 : data.entityType)) {
25651
+ return handleChangeFor("entityType")(data == null ? void 0 : data.entityType);
25652
+ }
25653
+ const type = mapOrganizationTypeToCompanyType(verifiedBusiness == null ? void 0 : verifiedBusiness.organizationType);
25654
+ if (verifiedBusiness && type && (data == null ? void 0 : data.entityType) !== type) {
25655
+ return setData("entityType", type);
25656
+ }
25657
+ }, [data == null ? void 0 : data.entityType, isExperimentEnabled, setData, setValid, showCompanyStructure, verifiedBusiness]);
25118
25658
  useEffect(() => {
25119
25659
  updateStateSlice({
25120
25660
  schema: formSchema,
@@ -25180,7 +25720,6 @@ const getForms = (country2) => ({
25180
25720
  formId: "basicInformation",
25181
25721
  formName: "basicInformationFormName",
25182
25722
  formHeading: "basicInformationFormHeading",
25183
- formDescription: "basicInformationFormDescription",
25184
25723
  fields: COUNTRIES_USING_COMPANY_SEARCH.includes(country2) ? basicInformationFields : basicInformationFields.filter((field) => !FIELDS_NEEDED_FOR_COMPANY_SEARCH.includes(field))
25185
25724
  },
25186
25725
  companyStructure: {
@@ -25231,72 +25770,69 @@ const mapApiDocumentToBusinessDetailsDocuments = (entityId) => {
25231
25770
  } : void 0
25232
25771
  };
25233
25772
  };
25234
- const mapBasicInformation = (value) => {
25235
- if (!!value.country && COUNTRIES_USING_COMPANY_SEARCH.includes(value.country)) {
25236
- return value;
25237
- }
25238
- const nonCompanySearchFields = entriesOf(value).reduce((acc, [field, fieldValue]) => {
25773
+ const mapBasicInformation = (data) => {
25774
+ if (!data) return;
25775
+ return !!data.country && COUNTRIES_USING_COMPANY_SEARCH.includes(data.country) ? data : entriesOf(data).reduce((acc, [field]) => {
25239
25776
  if (!FIELDS_NEEDED_FOR_COMPANY_SEARCH.includes(field)) {
25240
25777
  return {
25241
25778
  ...acc,
25242
- [field]: fieldValue
25779
+ [field]: data[field]
25243
25780
  };
25244
25781
  }
25245
25782
  return acc;
25246
25783
  }, {});
25247
- return nonCompanySearchFields;
25248
25784
  };
25249
- const mapAdditionalInformation = (value, legalEntity) => {
25250
- var _a;
25251
- const currentCountry = (_a = legalEntity.organization) == null ? void 0 : _a.registeredAddress.country;
25252
- if (!!currentCountry && COUNTRIES_USING_COMPANY_SEARCH.includes(currentCountry)) {
25253
- const companySearchFields = entriesOf(value).reduce((acc, [field, fieldValue]) => {
25254
- if (!FIELDS_NEEDED_FOR_COMPANY_SEARCH.includes(field)) {
25255
- return {
25256
- ...acc,
25257
- [field]: fieldValue
25258
- };
25259
- }
25260
- return acc;
25261
- }, {});
25262
- return {
25263
- ...companySearchFields,
25264
- hasDBA: !!companySearchFields.dbaName
25265
- };
25266
- }
25267
- return {
25268
- ...value,
25269
- hasDBA: !!value.dbaName
25270
- };
25785
+ const mapAdditionalInformation = (data, legalEntity) => {
25786
+ var _a, _b, _c, _d;
25787
+ if (!data) return;
25788
+ const dbaName2 = ((_a = legalEntity.organization) == null ? void 0 : _a.doingBusinessAs) ? ((_b = legalEntity.organization) == null ? void 0 : _b.doingBusinessAs) !== ((_c = legalEntity.organization) == null ? void 0 : _c.legalName) ? {
25789
+ hasDba: true
25790
+ } : {
25791
+ hasDba: false
25792
+ } : {};
25793
+ const currentCountry = (_d = legalEntity.organization) == null ? void 0 : _d.registeredAddress.country;
25794
+ return entriesOf(data).reduce((acc, [field]) => {
25795
+ if (!COUNTRIES_USING_COMPANY_SEARCH.includes(currentCountry)) {
25796
+ return {
25797
+ ...acc,
25798
+ [field]: data[field]
25799
+ };
25800
+ }
25801
+ if (!FIELDS_NEEDED_FOR_COMPANY_SEARCH.includes(field)) {
25802
+ return {
25803
+ ...acc,
25804
+ [field]: data[field]
25805
+ };
25806
+ }
25807
+ return acc;
25808
+ }, {
25809
+ ...dbaName2
25810
+ });
25271
25811
  };
25272
25812
  const mapLegalEntityToBusinessDetailsSchema = (legalEntity, isChangingType, accountHolder2) => {
25273
- const businessDetailsSchema = {
25274
- basicInformation: {},
25275
- companyStructure: {},
25276
- additionalInformation: {},
25277
- companyRegistrationAddress: {},
25278
- companyRegistrationDocument: {},
25279
- companyTaxDocument: {},
25280
- ...formatObject(legalEntity, businessDetailsComponentsKeyMapping)
25281
- };
25282
25813
  const {
25283
25814
  companyRegistrationDocument: companyRegistrationDocument2,
25284
25815
  companyTaxDocument
25285
25816
  } = mapApiDocumentToBusinessDetailsDocuments(legalEntity == null ? void 0 : legalEntity.id);
25286
- return entriesOf(businessDetailsSchema).reduce((componentData, [key, value]) => {
25817
+ const businessDetailsSchema = {
25818
+ ...formatObject(legalEntity, businessDetailsComponentsKeyMapping),
25819
+ companyRegistrationDocument: companyRegistrationDocument2,
25820
+ companyTaxDocument
25821
+ };
25822
+ return entriesOf(businessDetailsSchema).reduce((componentData, [key]) => {
25287
25823
  var _a;
25288
25824
  switch (key) {
25289
25825
  case "basicInformation": {
25290
25826
  return {
25291
25827
  ...componentData,
25292
- [key]: mapBasicInformation(value)
25828
+ [key]: mapBasicInformation(businessDetailsSchema[key])
25293
25829
  };
25294
25830
  }
25295
25831
  case "companyStructure": {
25296
25832
  return {
25297
25833
  ...componentData,
25298
25834
  [key]: {
25299
- ...value,
25835
+ ...businessDetailsSchema[key],
25300
25836
  accountHolder: getDefaultAccountHolderType(legalEntity, isChangingType, accountHolder2) ?? "theCompanyIWorkFor"
25301
25837
  }
25302
25838
  };
@@ -25304,14 +25840,14 @@ const mapLegalEntityToBusinessDetailsSchema = (legalEntity, isChangingType, acco
25304
25840
  case "additionalInformation": {
25305
25841
  return {
25306
25842
  ...componentData,
25307
- [key]: mapAdditionalInformation(value, legalEntity)
25843
+ [key]: mapAdditionalInformation(businessDetailsSchema[key], legalEntity)
25308
25844
  };
25309
25845
  }
25310
25846
  case "companyRegistrationAddress": {
25311
25847
  return {
25312
25848
  ...componentData,
25313
25849
  [key]: {
25314
- ...value,
25850
+ ...businessDetailsSchema[key],
25315
25851
  operationalAddressIsSame: ((_a = legalEntity.organization) == null ? void 0 : _a.principalPlaceOfBusiness) ? operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_NOT_SAME : operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_SAME
25316
25852
  }
25317
25853
  };
@@ -25319,17 +25855,13 @@ const mapLegalEntityToBusinessDetailsSchema = (legalEntity, isChangingType, acco
25319
25855
  case "companyRegistrationDocument": {
25320
25856
  return {
25321
25857
  ...componentData,
25322
- [key]: {
25323
- ...companyRegistrationDocument2
25324
- }
25858
+ [key]: businessDetailsSchema[key]
25325
25859
  };
25326
25860
  }
25327
25861
  case "companyTaxDocument": {
25328
25862
  return {
25329
25863
  ...componentData,
25330
- [key]: {
25331
- ...companyTaxDocument
25332
- }
25864
+ [key]: businessDetailsSchema[key]
25333
25865
  };
25334
25866
  }
25335
25867
  default:
@@ -25337,49 +25869,646 @@ const mapLegalEntityToBusinessDetailsSchema = (legalEntity, isChangingType, acco
25337
25869
  }
25338
25870
  }, {});
25339
25871
  };
25872
+ var CompanySearchEvents = /* @__PURE__ */ ((CompanySearchEvents2) => {
25873
+ CompanySearchEvents2["TASK_START"] = "CompanySearch_TaskStarted";
25874
+ CompanySearchEvents2["TASK_SUBMIT"] = "CompanySearch_TaskSubmitted";
25875
+ CompanySearchEvents2["TASK_SAVED"] = "CompanySearch_TaskSaved";
25876
+ CompanySearchEvents2["TASK_ERROR"] = "CompanySearch_TaskError";
25877
+ CompanySearchEvents2["DOCUMENTS_SAVED"] = "CompanySearch_DocumentsSaved";
25878
+ CompanySearchEvents2["DOCUMENTS_ERROR"] = "CompanySearch_DocumentsError";
25879
+ CompanySearchEvents2["NO_SEARCH_RESULTS"] = "CompanySearch_NoSearchResults";
25880
+ CompanySearchEvents2["TIN_MATCH"] = "CompanySearch_TinMatch";
25881
+ CompanySearchEvents2["TIN_NO_MATCH"] = "CompanySearch_TinNoMatch";
25882
+ CompanySearchEvents2["SELECTION_RESET"] = "CompanySearch_CompanySelectionReset";
25883
+ CompanySearchEvents2["SELECTION_ERROR"] = "CompanySearch_CompanySelectionError";
25884
+ return CompanySearchEvents2;
25885
+ })(CompanySearchEvents || {});
25886
+ const logger$o = createLogger("useCompanySearch");
25887
+ const LOW_RISK_COMPANY_DATA_COMPLIANCE_WINDOW = 1577664e5;
25888
+ function useCompanySearch({
25889
+ defaultData,
25890
+ legalCompanyName: legalCompanyName2,
25891
+ country: country2,
25892
+ stateOrProvince: stateOrProvince2,
25893
+ taxIdentificationNumber: taxIdentificationNumber2,
25894
+ canVerify,
25895
+ limit = 15,
25896
+ baseTrackingPayload,
25897
+ setKompanyAddress,
25898
+ handleChangeFor,
25899
+ handleCompanyIndexSearch,
25900
+ handleCompanyDeepSearch,
25901
+ handleGetCompanyDataset,
25902
+ handleRefreshCompanyDataset,
25903
+ handleVerifyTin
25904
+ }) {
25905
+ const [companiesList, setCompaniesList] = useState([]);
25906
+ const [selectedCompanyId, setSelectedCompanyId] = useState();
25907
+ const [verifiedCompany, setVerifiedCompany] = useState();
25908
+ const [status, setStatus] = useState("idle");
25909
+ const [error, setError] = useState();
25910
+ const isLastUpdateDateCompliant = (company2) => {
25911
+ const date = (/* @__PURE__ */ new Date()).toDateString();
25912
+ return company2.lastUpdate ? Date.parse(date) - Date.parse(company2.lastUpdate) < LOW_RISK_COMPANY_DATA_COMPLIANCE_WINDOW : false;
25913
+ };
25914
+ const searchCompanies = useMemo(() => debounce(async ({
25915
+ companyName: companyName2,
25916
+ companyCountry,
25917
+ companyState,
25918
+ resultsLimit,
25919
+ deepSearch
25920
+ }) => {
25921
+ try {
25922
+ if (!deepSearch) return;
25923
+ setStatus("loading");
25924
+ setCompaniesList([]);
25925
+ const {
25926
+ results: deepSearchResults
25927
+ } = await deepSearch({
25928
+ text: companyName2,
25929
+ country: companyCountry,
25930
+ state: companyState,
25931
+ limit: resultsLimit
25932
+ });
25933
+ return setCompaniesList(deepSearchResults);
25934
+ } catch (e) {
25935
+ setStatus("error");
25936
+ setError(e);
25937
+ } finally {
25938
+ setStatus((prevStatus) => prevStatus !== "error" ? "loaded" : prevStatus);
25939
+ }
25940
+ }, 700), []);
25941
+ const retrySearch = useCallback(async () => {
25942
+ if (!legalCompanyName2 || !country2 || !stateOrProvince2) {
25943
+ return setStatus("idle");
25944
+ }
25945
+ try {
25946
+ if (!handleCompanyDeepSearch) return;
25947
+ setStatus("loading");
25948
+ setSelectedCompanyId(void 0);
25949
+ const {
25950
+ results: deepSearchResults
25951
+ } = await handleCompanyDeepSearch({
25952
+ text: legalCompanyName2,
25953
+ country: country2,
25954
+ state: stateOrProvince2,
25955
+ limit
25956
+ });
25957
+ return setCompaniesList(deepSearchResults);
25958
+ } catch (e) {
25959
+ setStatus("error");
25960
+ setError(e);
25961
+ } finally {
25962
+ setStatus((prevStatus) => prevStatus !== "error" ? "loaded" : prevStatus);
25963
+ }
25964
+ }, [handleCompanyDeepSearch, country2, legalCompanyName2, limit, stateOrProvince2]);
25965
+ const verify2 = useCallback(async (companyTIN, company2) => {
25966
+ try {
25967
+ if (!handleVerifyTin || !handleGetCompanyDataset || !handleRefreshCompanyDataset) return;
25968
+ setStatus("loading");
25969
+ setSelectedCompanyId(company2.id);
25970
+ if (!canVerify || !companyTIN) {
25971
+ return setStatus("error");
25972
+ }
25973
+ const {
25974
+ matched
25975
+ } = await handleVerifyTin({
25976
+ tin: companyTIN,
25977
+ name: company2.name
25978
+ });
25979
+ if (!matched) {
25980
+ setStatus("error");
25981
+ userEvents.addEvent(CompanySearchEvents.TIN_NO_MATCH, {
25982
+ segmentation: {
25983
+ ...baseTrackingPayload
25984
+ }
25985
+ });
25986
+ return setError({
25987
+ message: "TIN does not match the selected company",
25988
+ response: {
25989
+ status: 200
25990
+ }
25991
+ });
25992
+ }
25993
+ userEvents.addEvent(CompanySearchEvents.TIN_MATCH, {
25994
+ segmentation: {
25995
+ ...baseTrackingPayload
25996
+ }
25997
+ });
25998
+ const companyData = isLastUpdateDateCompliant(company2) ? await handleGetCompanyDataset({
25999
+ companyId: company2.id,
26000
+ country: country2
26001
+ }) : await handleRefreshCompanyDataset({
26002
+ companyId: company2.id,
26003
+ country: country2
26004
+ });
26005
+ return setVerifiedCompany({
26006
+ ...companyData,
26007
+ state: companyData.state ?? stateOrProvince2
26008
+ });
26009
+ } catch (e) {
26010
+ logger$o.error(e);
26011
+ setError(e);
26012
+ setStatus("error");
26013
+ } finally {
26014
+ setStatus((prevStatus) => prevStatus !== "error" ? "loaded" : prevStatus);
26015
+ }
26016
+ }, [handleVerifyTin, handleGetCompanyDataset, handleRefreshCompanyDataset, canVerify, country2, stateOrProvince2, baseTrackingPayload]);
26017
+ const reset = useCallback(() => {
26018
+ setStatus("loading");
26019
+ setSelectedCompanyId(void 0);
26020
+ setVerifiedCompany(void 0);
26021
+ setKompanyAddress(void 0);
26022
+ setCompaniesList([]);
26023
+ if (defaultData) {
26024
+ handleChangeFor("legalCompanyName")(defaultData.legalCompanyName);
26025
+ }
26026
+ }, [defaultData, handleChangeFor, setKompanyAddress]);
26027
+ useEffect(() => {
26028
+ var _a;
26029
+ setError(void 0);
26030
+ const isMinLength = legalCompanyName2 && legalCompanyName2.split("").length > 3;
26031
+ if (!legalCompanyName2 || !country2 || !stateOrProvince2 || !taxIdentificationNumber2 || !canVerify || !isMinLength) {
26032
+ return setStatus("idle");
26033
+ }
26034
+ if (!verifiedCompany) {
26035
+ setSelectedCompanyId(void 0);
26036
+ (_a = searchCompanies({
26037
+ companyName: legalCompanyName2,
26038
+ companyCountry: country2,
26039
+ companyState: stateOrProvince2,
26040
+ indexSearch: handleCompanyIndexSearch,
26041
+ deepSearch: handleCompanyDeepSearch,
26042
+ resultsLimit: limit
26043
+ })) == null ? void 0 : _a.catch((e) => logger$o.error(e));
26044
+ }
26045
+ }, [legalCompanyName2, country2, stateOrProvince2, taxIdentificationNumber2, verifiedCompany, searchCompanies, handleCompanyIndexSearch, handleCompanyDeepSearch, limit, canVerify, baseTrackingPayload]);
26046
+ useEffect(() => {
26047
+ setVerifiedCompany(void 0);
26048
+ setSelectedCompanyId(void 0);
26049
+ }, [taxIdentificationNumber2]);
26050
+ useEffect(() => {
26051
+ if (status !== "error") {
26052
+ return setError(void 0);
26053
+ }
26054
+ }, [status]);
26055
+ return {
26056
+ results: companiesList,
26057
+ selectedCompanyId,
26058
+ verifiedCompany,
26059
+ status,
26060
+ error,
26061
+ retrySearch,
26062
+ verify: verify2,
26063
+ reset
26064
+ };
26065
+ }
26066
+ function Card({
26067
+ className,
26068
+ children,
26069
+ stateful,
26070
+ active,
26071
+ disabled,
26072
+ warning,
26073
+ warningMessage,
26074
+ title,
26075
+ subTitle,
26076
+ headerButton,
26077
+ onClick,
26078
+ onKeyDown
26079
+ }) {
26080
+ const classNames = cx("adyen-kyc-card", className, {
26081
+ "adyen-kyc-card--stateful": stateful,
26082
+ "adyen-kyc-card--active": stateful && active,
26083
+ "adyen-kyc-card--disabled": disabled
26084
+ });
26085
+ const headerClassNames = cx("adyen-kyc-card__header", {
26086
+ "adyen-kyc-card__header--button": headerButton
26087
+ });
26088
+ const tabIndex = stateful ? 0 : void 0;
26089
+ const role2 = stateful ? "button" : void 0;
26090
+ const onClickHandler = (e) => {
26091
+ if (disabled) {
26092
+ return;
26093
+ }
26094
+ onClick == null ? void 0 : onClick(e);
26095
+ };
26096
+ const onKeyDownHandler = (e) => {
26097
+ if (onKeyDown) {
26098
+ onKeyDown(e);
26099
+ }
26100
+ };
26101
+ return jsxs("article", {
26102
+ className: classNames,
26103
+ tabIndex,
26104
+ role: role2,
26105
+ onClick: onClickHandler,
26106
+ onKeyDown: onKeyDownHandler,
26107
+ children: [title && jsxs("header", {
26108
+ className: headerClassNames,
26109
+ children: [jsxs("div", {
26110
+ className: "adyen-kyc-card-title",
26111
+ children: [jsx(Typography, {
26112
+ el: "h4",
26113
+ variant: "title",
26114
+ children: title
26115
+ }), subTitle && jsx(Typography, {
26116
+ el: "p",
26117
+ variant: "body",
26118
+ children: subTitle
26119
+ })]
26120
+ }), headerButton && headerButton]
26121
+ }), children && jsx("div", {
26122
+ role: "region",
26123
+ className: "adyen-kyc-card__body",
26124
+ children
26125
+ }), warning && jsx(Alert, {
26126
+ className: "adyen-kyc-card__warning",
26127
+ title: warningMessage,
26128
+ hasCloseButton: false,
26129
+ type: "warning"
26130
+ })]
26131
+ });
26132
+ }
26133
+ function CardGroup({
26134
+ className,
26135
+ children,
26136
+ spaced = false
26137
+ }) {
26138
+ const baseClass = spaced ? "adyen-kyc-card-group-spaced" : "adyen-kyc-card-group";
26139
+ return jsx("section", {
26140
+ className: cx(baseClass, className),
26141
+ children
26142
+ });
26143
+ }
26144
+ function BusinessInformation({
26145
+ fetching,
26146
+ selectedBusiness
26147
+ }) {
26148
+ const {
26149
+ i18n
26150
+ } = useI18nContext();
26151
+ const businessInformationClass = cx("adyen-kyc-business-information", {
26152
+ "adyen-kyc-business-information--loading": fetching
26153
+ });
26154
+ return jsx("div", {
26155
+ className: businessInformationClass,
26156
+ children: fetching ? jsx(Loader, {
26157
+ size: "large"
26158
+ }) : jsxs("ul", {
26159
+ className: "adyen-kyc-business-information__business-data",
26160
+ children: [(selectedBusiness == null ? void 0 : selectedBusiness.legalForm) && jsxs("li", {
26161
+ children: [jsx(Typography, {
26162
+ className: "adyen-kyc-business-data__key",
26163
+ color: "secondary",
26164
+ children: i18n.get("legalForm")
26165
+ }), jsx(Typography, {
26166
+ children: selectedBusiness == null ? void 0 : selectedBusiness.legalForm
26167
+ })]
26168
+ }), jsxs("li", {
26169
+ children: [jsx(Typography, {
26170
+ className: "adyen-kyc-business-data__key",
26171
+ color: "secondary",
26172
+ children: i18n.get("legalCompanyName__US")
26173
+ }), jsx(Typography, {
26174
+ children: selectedBusiness == null ? void 0 : selectedBusiness.name
26175
+ })]
26176
+ }), (selectedBusiness == null ? void 0 : selectedBusiness.address) && jsxs("li", {
26177
+ children: [jsx(Typography, {
26178
+ className: "adyen-kyc-business-data__key",
26179
+ color: "secondary",
26180
+ children: i18n.get("address")
26181
+ }), jsx(Typography, {
26182
+ children: selectedBusiness == null ? void 0 : selectedBusiness.address
26183
+ })]
26184
+ })]
26185
+ })
26186
+ });
26187
+ }
26188
+ function BusinessInformationCard({
26189
+ result,
26190
+ selectedBusinessId,
26191
+ currentBusinessSelection,
26192
+ fetching,
26193
+ failedToLoad,
26194
+ invalidTin,
26195
+ handleSelectBusiness,
26196
+ handleConfirmSelection,
26197
+ setIsBusinessSelection
26198
+ }) {
26199
+ const {
26200
+ i18n
26201
+ } = useI18nContext();
26202
+ return jsx(Card, {
26203
+ "aria-selected": selectedBusinessId === result.id,
26204
+ className: "adyen-kyc-business-information-card",
26205
+ title: result.name,
26206
+ subTitle: result.registrationNumber,
26207
+ stateful: true,
26208
+ active: selectedBusinessId === result.id,
26209
+ headerButton: selectedBusinessId === result.id && !fetching && !failedToLoad ? jsx(Button, {
26210
+ label: i18n.get("thisIsMyBusiness"),
26211
+ onClick: () => handleConfirmSelection(),
26212
+ testId: "selectBusiness",
26213
+ disabled: invalidTin
26214
+ }) : null,
26215
+ onClick: () => handleSelectBusiness(result),
26216
+ onKeyDown: handleKeys(["Enter"], () => handleSelectBusiness(result)),
26217
+ children: selectedBusinessId === result.id && jsxs(Fragment, {
26218
+ children: [jsx(Divider, {}), invalidTin && jsx(Alert, {
26219
+ type: "warning",
26220
+ title: i18n.get("businessSelection__invalidTin"),
26221
+ actionButton: jsx(Button, {
26222
+ label: "Go back",
26223
+ testId: "backBtn",
26224
+ onClick: () => setIsBusinessSelection(false),
26225
+ showAsLink: true
26226
+ }),
26227
+ testId: "invalidTin"
26228
+ }), failedToLoad && jsx(Alert, {
26229
+ type: "info",
26230
+ title: i18n.get("businessSelection__failedToLoad"),
26231
+ actionButton: jsx(Button, {
26232
+ label: "Try again",
26233
+ testId: "reloadBusiness",
26234
+ onClick: () => handleSelectBusiness(result),
26235
+ showAsLink: true
26236
+ }),
26237
+ testId: "failedToLoad"
26238
+ }), !failedToLoad && jsx(BusinessInformation, {
26239
+ fetching,
26240
+ selectedBusiness: currentBusinessSelection
26241
+ })]
26242
+ })
26243
+ });
26244
+ }
26245
+ const logger$n = createLogger("BusinessSelection");
26246
+ function BusinessSelectionComponent({
26247
+ country: country2,
26248
+ state: state2,
26249
+ tin,
26250
+ searchName,
26251
+ searchResults,
26252
+ proceedToNextForm,
26253
+ isLoading,
26254
+ setIsLoading,
26255
+ setVerifiedBusiness,
26256
+ setShowCompanyStructure,
26257
+ setIsBusinessSelection,
26258
+ setSearchName,
26259
+ setSearchResults,
26260
+ handleNextClick,
26261
+ handleCompanyDeepSearch,
26262
+ handleGetCompanyDataset,
26263
+ handleRefreshCompanyDataset,
26264
+ handleVerifyTin
26265
+ }) {
26266
+ const {
26267
+ basicInformation: basicInformation2
26268
+ } = useGlobalData();
26269
+ const shouldSearch = useMemo(() => Boolean(searchResults && searchName !== (basicInformation2 == null ? void 0 : basicInformation2.businessName)), [basicInformation2 == null ? void 0 : basicInformation2.businessName, searchName, searchResults]);
26270
+ useEffect(() => {
26271
+ if (!searchResults || shouldSearch) {
26272
+ searchForBusiness().catch(() => setSearchResults([]));
26273
+ }
26274
+ }, [searchResults, shouldSearch]);
26275
+ useEffect(() => {
26276
+ if (proceedToNextForm) {
26277
+ handleNextClick();
26278
+ }
26279
+ }, [handleNextClick, proceedToNextForm]);
26280
+ const {
26281
+ i18n
26282
+ } = useI18nContext();
26283
+ const [fetching, setFetching] = useState(false);
26284
+ const [selectedBusinessId, setSelectedBusinessId] = useState();
26285
+ const [currentBusinessSelection, setCurrentBusinessSelection] = useState();
26286
+ const [invalidTin, setInvalidTin] = useState(false);
26287
+ const [failedToLoad, setFailedToLoad] = useState(false);
26288
+ const fetchBusinessData = useCallback(async (company2) => {
26289
+ const date = (/* @__PURE__ */ new Date()).toDateString();
26290
+ const isDataCompliant = company2.lastUpdate ? Date.parse(date) - Date.parse(company2.lastUpdate) < LOW_RISK_COMPANY_DATA_COMPLIANCE_WINDOW : false;
26291
+ return isDataCompliant ? handleGetCompanyDataset == null ? void 0 : handleGetCompanyDataset({
26292
+ companyId: company2.id,
26293
+ country: "US"
26294
+ }) : handleRefreshCompanyDataset == null ? void 0 : handleRefreshCompanyDataset({
26295
+ companyId: company2.id,
26296
+ country: "US"
26297
+ });
26298
+ }, [handleGetCompanyDataset, handleRefreshCompanyDataset]);
26299
+ const handleSelectBusiness = useCallback(async (result) => {
26300
+ if ((currentBusinessSelection == null ? void 0 : currentBusinessSelection.id) === result.id && !failedToLoad) return;
26301
+ try {
26302
+ setFailedToLoad(false);
26303
+ setInvalidTin(false);
26304
+ setVerifiedBusiness(void 0);
26305
+ setSelectedBusinessId(result.id);
26306
+ setFetching(true);
26307
+ const businessData = await fetchBusinessData(result);
26308
+ setCurrentBusinessSelection(businessData);
26309
+ } catch (e) {
26310
+ setFailedToLoad(true);
26311
+ logger$n.error(e);
26312
+ } finally {
26313
+ setFetching(false);
26314
+ }
26315
+ }, [currentBusinessSelection == null ? void 0 : currentBusinessSelection.id, failedToLoad, fetchBusinessData, setVerifiedBusiness]);
26316
+ const handleConfirmSelection = useCallback(async (data) => {
26317
+ const business = currentBusinessSelection ?? data;
26318
+ if (!tin || !(business == null ? void 0 : business.name) || !business || invalidTin) return;
26319
+ try {
26320
+ setInvalidTin(false);
26321
+ setIsLoading(true);
26322
+ const res = await (handleVerifyTin == null ? void 0 : handleVerifyTin({
26323
+ tin,
26324
+ name: business == null ? void 0 : business.name
26325
+ }));
26326
+ if (res == null ? void 0 : res.matched) {
26327
+ setVerifiedBusiness(business);
26328
+ } else {
26329
+ setInvalidTin(true);
26330
+ }
26331
+ } catch (e) {
26332
+ logger$n.error(e);
26333
+ } finally {
26334
+ setIsLoading(false);
26335
+ }
26336
+ }, [currentBusinessSelection, handleVerifyTin, invalidTin, setIsLoading, setVerifiedBusiness, tin]);
26337
+ const searchForBusiness = useCallback(async () => {
26338
+ var _a;
26339
+ if (!(basicInformation2 == null ? void 0 : basicInformation2.businessName) || !country2 || !state2 || !handleCompanyDeepSearch) return;
26340
+ try {
26341
+ setIsLoading(true);
26342
+ setSearchName(basicInformation2 == null ? void 0 : basicInformation2.businessName);
26343
+ const {
26344
+ results
26345
+ } = await handleCompanyDeepSearch({
26346
+ text: basicInformation2 == null ? void 0 : basicInformation2.businessName,
26347
+ country: country2,
26348
+ state: state2,
26349
+ limit: 15
26350
+ });
26351
+ setSearchResults(results);
26352
+ if (!(results == null ? void 0 : results.length)) {
26353
+ setShowCompanyStructure(true);
26354
+ }
26355
+ if (results.length === 1) {
26356
+ setSelectedBusinessId((_a = results[0]) == null ? void 0 : _a.id);
26357
+ setFailedToLoad(false);
26358
+ const data = await fetchBusinessData(results[0]).catch(() => setFailedToLoad(true));
26359
+ if (data) {
26360
+ setCurrentBusinessSelection(data);
26361
+ await handleConfirmSelection(data);
26362
+ }
26363
+ }
26364
+ } catch (e) {
26365
+ logger$n.error(e);
26366
+ } finally {
26367
+ setIsLoading(false);
26368
+ }
26369
+ }, [basicInformation2 == null ? void 0 : basicInformation2.businessName, country2, state2, handleCompanyDeepSearch, setIsLoading, setSearchName, setSearchResults, setShowCompanyStructure, fetchBusinessData, handleConfirmSelection]);
26370
+ const handleManualDataEntry = useCallback(() => {
26371
+ setShowCompanyStructure(true);
26372
+ }, [setShowCompanyStructure]);
26373
+ return jsx("div", {
26374
+ className: "adyen-kyc-business-selection",
26375
+ children: isLoading || !searchResults ? jsxs("div", {
26376
+ className: "adyen-kyc-business-selection__loader",
26377
+ children: [jsx(Loader, {
26378
+ size: "large"
26379
+ }), jsx(Typography, {
26380
+ el: "span",
26381
+ children: !currentBusinessSelection ? i18n.get("businessSelection__searching") : i18n.get("businessSelection__verifying")
26382
+ })]
26383
+ }) : jsxs(Fragment, {
26384
+ children: [jsx(FormHeader, {
26385
+ heading: i18n.get("businessSelection__heading")
26386
+ }), jsxs(CardGroup, {
26387
+ spaced: true,
26388
+ children: [searchResults == null ? void 0 : searchResults.map((result) => jsx(BusinessInformationCard, {
26389
+ result,
26390
+ selectedBusinessId,
26391
+ currentBusinessSelection,
26392
+ fetching,
26393
+ failedToLoad,
26394
+ invalidTin,
26395
+ handleSelectBusiness,
26396
+ handleConfirmSelection,
26397
+ setIsBusinessSelection
26398
+ }, result.id)), jsxs(Typography, {
26399
+ el: "span",
26400
+ color: "secondary",
26401
+ className: "adyen-kyc-business-selection__footer",
26402
+ children: [i18n.get("businessSelection__footer"), jsx(Button, {
26403
+ label: i18n.get("businessSelection__footerButton"),
26404
+ showAsLink: true,
26405
+ onClick: handleManualDataEntry,
26406
+ testId: "manualDataEntry"
26407
+ })]
26408
+ })]
26409
+ })]
26410
+ })
26411
+ });
26412
+ }
25340
26413
  function BusinessDetailsComponent(props) {
25341
- var _a, _b, _c, _d, _e;
26414
+ var _a, _b;
25342
26415
  const {
25343
26416
  i18n
25344
26417
  } = useI18nContext();
26418
+ const {
26419
+ basicInformation: basicInformation2,
26420
+ companyStructure: companyStructure2
26421
+ } = useGlobalData();
25345
26422
  const {
25346
26423
  country: country2,
25347
26424
  isTopLevelEntity,
25348
26425
  activeForm,
25349
26426
  problems,
25350
26427
  baseTrackingPayload,
26428
+ isBusinessSelection,
26429
+ setIsBusinessSelection,
26430
+ isLoading,
26431
+ setIsLoading,
26432
+ searchName,
26433
+ setSearchName,
26434
+ searchResults,
26435
+ setSearchResults,
26436
+ verifiedBusiness,
26437
+ setVerifiedBusiness,
26438
+ showCompanyStructure,
26439
+ setShowCompanyStructure,
26440
+ handleNextClick,
25351
26441
  handleAddressSearch,
25352
26442
  handleFindAddress,
25353
- handleCompanyIndexSearch,
25354
26443
  handleCompanyDeepSearch,
25355
26444
  handleGetCompanyDataset,
25356
26445
  handleRefreshCompanyDataset,
25357
26446
  handleVerifyTin,
25358
26447
  onTypeSwitch
25359
26448
  } = props;
25360
- const globalData = useGlobalData();
25361
26449
  const forms2 = getForms(country2);
25362
26450
  const formWrapperClasses = (formId) => (activeForm == null ? void 0 : activeForm.formId) !== formId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper";
25363
- this.customNavigationHandler = ((_a = globalData.companyStructure) == null ? void 0 : _a.accountHolder) === "myName" ? () => onTypeSwitch == null ? void 0 : onTypeSwitch(LegalEntityType.INDIVIDUAL) : null;
26451
+ useEffect(() => {
26452
+ if (searchName !== (basicInformation2 == null ? void 0 : basicInformation2.businessName)) {
26453
+ setShowCompanyStructure(false);
26454
+ setIsBusinessSelection(false);
26455
+ }
26456
+ }, [basicInformation2 == null ? void 0 : basicInformation2.businessName, searchName, setIsBusinessSelection, setShowCompanyStructure]);
26457
+ const canSkipBusinessSelection = useMemo(() => Boolean(!isLoading && searchResults && !searchResults.length && showCompanyStructure), [isLoading, searchResults, showCompanyStructure]);
26458
+ const proceedToNextForm = useMemo(() => {
26459
+ if ((basicInformation2 == null ? void 0 : basicInformation2.country) !== "US") return false;
26460
+ switch (activeForm == null ? void 0 : activeForm.formId) {
26461
+ case "basicInformation": {
26462
+ return (verifiedBusiness == null ? void 0 : verifiedBusiness.legalForm) ? isBusinessSelection : canSkipBusinessSelection || showCompanyStructure;
26463
+ }
26464
+ default:
26465
+ return false;
26466
+ }
26467
+ }, [basicInformation2 == null ? void 0 : basicInformation2.country, activeForm == null ? void 0 : activeForm.formId, verifiedBusiness == null ? void 0 : verifiedBusiness.legalForm, isBusinessSelection, canSkipBusinessSelection, showCompanyStructure]);
26468
+ const getCustomNavigationHandler = useCallback(() => {
26469
+ switch (activeForm == null ? void 0 : activeForm.formId) {
26470
+ default:
26471
+ return (companyStructure2 == null ? void 0 : companyStructure2.accountHolder) === "myName" ? onTypeSwitch == null ? void 0 : onTypeSwitch(LegalEntityType.INDIVIDUAL) : null;
26472
+ }
26473
+ }, [activeForm == null ? void 0 : activeForm.formId, companyStructure2 == null ? void 0 : companyStructure2.accountHolder, onTypeSwitch]);
26474
+ this.customNavigationHandler = getCustomNavigationHandler();
26475
+ const classNames = cx("adyen-kyc-business-details", {
26476
+ "adyen-kyc-business-details--hide": (activeForm == null ? void 0 : activeForm.formId) === "summary"
26477
+ });
25364
26478
  return jsxs("div", {
25365
- className: "adyen-kyc-business-details",
25366
- children: [jsx("div", {
26479
+ className: classNames,
26480
+ children: [jsxs("div", {
25367
26481
  className: formWrapperClasses(forms2.basicInformation.formId),
25368
- children: jsx(BasicInformationComponent, {
26482
+ children: [isBusinessSelection && (basicInformation2 == null ? void 0 : basicInformation2.country) === "US" && jsx(BusinessSelectionComponent, {
26483
+ country: basicInformation2 == null ? void 0 : basicInformation2.country,
26484
+ state: basicInformation2 == null ? void 0 : basicInformation2.stateOrProvince,
26485
+ tin: (_b = (_a = basicInformation2 == null ? void 0 : basicInformation2.taxInformation) == null ? void 0 : _a.find((taxId2) => taxId2.country === country2)) == null ? void 0 : _b.number,
26486
+ searchName,
26487
+ proceedToNextForm,
26488
+ isLoading,
26489
+ setIsLoading,
26490
+ setVerifiedBusiness,
26491
+ setShowCompanyStructure,
26492
+ setIsBusinessSelection,
26493
+ searchResults,
26494
+ setSearchResults,
26495
+ setSearchName,
26496
+ handleNextClick,
26497
+ handleCompanyDeepSearch,
26498
+ handleGetCompanyDataset,
26499
+ handleRefreshCompanyDataset,
26500
+ handleVerifyTin
26501
+ }), jsx(BasicInformationComponent, {
25369
26502
  ...getFormProps(props, forms2.basicInformation.formId),
25370
26503
  id: forms2.basicInformation.formId,
25371
26504
  heading: i18n.get((activeForm == null ? void 0 : activeForm.formHeading) ?? forms2.basicInformation.formHeading),
25372
- description: i18n.get((activeForm == null ? void 0 : activeForm.formDescription) ?? forms2.basicInformation.formDescription),
26505
+ description: (activeForm == null ? void 0 : activeForm.formDescription) ? i18n.get(activeForm == null ? void 0 : activeForm.formDescription) : void 0,
25373
26506
  country: country2,
25374
- companyType: (_b = globalData == null ? void 0 : globalData.companyStructure) == null ? void 0 : _b.entityType,
26507
+ companyType: companyStructure2 == null ? void 0 : companyStructure2.entityType,
25375
26508
  isTopLevelEntity,
25376
26509
  baseTrackingPayload,
25377
- handleCompanyIndexSearch,
25378
- handleCompanyDeepSearch,
25379
- handleGetCompanyDataset,
25380
- handleRefreshCompanyDataset,
25381
- handleVerifyTin
25382
- })
26510
+ isBusinessSelection
26511
+ })]
25383
26512
  }), jsx("div", {
25384
26513
  className: formWrapperClasses(forms2.companyStructure.formId),
25385
26514
  children: jsx(CompanyStructureComponent, {
@@ -25387,7 +26516,9 @@ function BusinessDetailsComponent(props) {
25387
26516
  id: forms2.companyStructure.formId,
25388
26517
  heading: i18n.get((activeForm == null ? void 0 : activeForm.formHeading) ?? forms2.companyStructure.formHeading),
25389
26518
  description: i18n.get((activeForm == null ? void 0 : activeForm.formDescription) ?? forms2.companyStructure.formDescription),
25390
- country: country2
26519
+ country: country2,
26520
+ verifiedBusiness,
26521
+ showCompanyStructure
25391
26522
  })
25392
26523
  }), jsx("div", {
25393
26524
  className: formWrapperClasses(forms2.additionalInformation.formId),
@@ -25397,7 +26528,9 @@ function BusinessDetailsComponent(props) {
25397
26528
  heading: i18n.get((activeForm == null ? void 0 : activeForm.formHeading) ?? forms2.additionalInformation.formHeading),
25398
26529
  description: i18n.get((activeForm == null ? void 0 : activeForm.formDescription) ?? forms2.additionalInformation.formDescription),
25399
26530
  country: country2,
25400
- companyType: (_c = globalData == null ? void 0 : globalData.companyStructure) == null ? void 0 : _c.entityType
26531
+ companyType: companyStructure2 == null ? void 0 : companyStructure2.entityType,
26532
+ verifiedBusiness,
26533
+ showCompanyStructure
25401
26534
  })
25402
26535
  }), jsx("div", {
25403
26536
  className: formWrapperClasses(forms2.companyRegistrationAddress.formId),
@@ -25411,8 +26544,8 @@ function BusinessDetailsComponent(props) {
25411
26544
  country: country2,
25412
26545
  problems,
25413
26546
  handleAddressSearch,
25414
- handleFindAddress
25415
- // kompanyAddress={kompanyAddress}
26547
+ handleFindAddress,
26548
+ verifiedBusiness
25416
26549
  })
25417
26550
  }), jsx("div", {
25418
26551
  className: formWrapperClasses(forms2.companyRegistrationDocument.formId),
@@ -25422,7 +26555,7 @@ function BusinessDetailsComponent(props) {
25422
26555
  heading: forms2.companyRegistrationDocument.formHeading,
25423
26556
  description: forms2.companyRegistrationDocument.formDescription,
25424
26557
  country: country2,
25425
- companyType: (_d = globalData.companyStructure) == null ? void 0 : _d.entityType
26558
+ companyType: companyStructure2 == null ? void 0 : companyStructure2.entityType
25426
26559
  })
25427
26560
  }), jsx("div", {
25428
26561
  className: formWrapperClasses(forms2.companyTaxDocument.formId),
@@ -25432,7 +26565,7 @@ function BusinessDetailsComponent(props) {
25432
26565
  heading: forms2.companyTaxDocument.formHeading,
25433
26566
  description: forms2.companyTaxDocument.formDescription,
25434
26567
  country: country2,
25435
- companyType: (_e = globalData.companyStructure) == null ? void 0 : _e.entityType
26568
+ companyType: companyStructure2 == null ? void 0 : companyStructure2.entityType
25436
26569
  }) : jsx(DocumentUpload, {
25437
26570
  ...getFormProps(props, forms2.companyTaxDocument.formId),
25438
26571
  id: forms2.companyTaxDocument.formId,
@@ -25634,7 +26767,7 @@ const ExpiredBanner = () => {
25634
26767
  i18n
25635
26768
  } = useI18nContext();
25636
26769
  return jsx(Alert, {
25637
- type: AlertTypes.WARNING,
26770
+ type: "warning",
25638
26771
  title: i18n.get("thisPageIsNowInactive"),
25639
26772
  hasCloseButton: false,
25640
26773
  children: i18n.get("startANewSessionFromTheSamePlaceYouOriginallyAccessed")
@@ -25966,7 +27099,7 @@ const FormNavigationItem = ({
25966
27099
  children: [i18n.get(form.formName), form.hasServerValidationErrors && jsx("span", {
25967
27100
  className: "adyen-kyc-form-navigation__item-icon adyen-kyc-form-navigation__item-icon--error",
25968
27101
  children: jsx(AlertIcon, {
25969
- type: AlertTypes.WARNING
27102
+ type: "warning"
25970
27103
  })
25971
27104
  }), form.isValid && !hasError && jsx("span", {
25972
27105
  className: "adyen-kyc-form-navigation__item-icon adyen-kyc-form-navigation__item-icon--success",
@@ -26043,6 +27176,7 @@ const FormWrapper = ({
26043
27176
  handleBackClick,
26044
27177
  handleHomeClick,
26045
27178
  nextButtonLabel,
27179
+ backButtonLabel,
26046
27180
  homeButtonLabel,
26047
27181
  loadingStatus,
26048
27182
  gotoFormByFormIndex,
@@ -26055,6 +27189,7 @@ const FormWrapper = ({
26055
27189
  hideFooter,
26056
27190
  hideHomeButton,
26057
27191
  hideBackButton,
27192
+ hideNextButton,
26058
27193
  hideNavigation,
26059
27194
  canSubmit: canSubmit2,
26060
27195
  onSubmit,
@@ -26083,7 +27218,7 @@ const FormWrapper = ({
26083
27218
  isExperimentEnabled
26084
27219
  } = useExperimentsContext();
26085
27220
  const showExtraTaxExemptionReasons = isExperimentEnabled(ExperimentNames.ShowExtraTaxExemptionReasons);
26086
- const showTaxExemptedLegalCaption = showExtraTaxExemptionReasons && ((_a = summaryData.companyRegistrationDetails) == null ? void 0 : _a.vatAbsenceReason) && ["companyDetails"].includes(taskName);
27221
+ const showTaxExemptedLegalCaption = showExtraTaxExemptionReasons && ((_a = summaryData.companyRegistrationDetails) == null ? void 0 : _a.vatAbsenceReason) && ["companyDetails", "businessDetails"].includes(taskName);
26087
27222
  const summaryContent = jsx("div", {
26088
27223
  className: "adyen-kyc-form-wrapper",
26089
27224
  children: jsx(Summary, {
@@ -26107,11 +27242,12 @@ const FormWrapper = ({
26107
27242
  onNext: handleNextClick,
26108
27243
  onBack: handleBackClick,
26109
27244
  onHome: onHomeClick,
26110
- backButtonLabel: i18n.get("back"),
27245
+ backButtonLabel: backButtonLabel ?? i18n.get("back"),
26111
27246
  nextButtonLabel,
26112
27247
  homeButtonLabel,
26113
27248
  hideOnHomeButton: hideHomeButton,
26114
- hideBackButton
27249
+ hideBackButton,
27250
+ hideNextButton
26115
27251
  });
26116
27252
  const multiStepForm = jsxs("div", {
26117
27253
  className: "adyen-kyc-form-container",
@@ -26234,22 +27370,27 @@ const mapBusinessDetailsDocumentToApiDocument = async (data, entityId) => {
26234
27370
  return documents2.filter(Boolean);
26235
27371
  };
26236
27372
  const mapBusinessDetailsSchemaToLegalEntity = (data) => {
26237
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
27373
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
26238
27374
  const requestObj = {
26239
27375
  ...formatObject(data, businessDetailsApiKeyMapping)
26240
27376
  };
26241
- const taxData = ((_a = data.basicInformation) == null ? void 0 : _a.taxInformation) || ((_b = data.additionalInformation) == null ? void 0 : _b.taxInformation);
26242
- const registrationNumber2 = ((_c = data.basicInformation) == null ? void 0 : _c.registrationNumber) || ((_d = data.additionalInformation) == null ? void 0 : _d.registrationNumber);
27377
+ (_a = requestObj.organization) == null ? true : delete _a.legalFormDescription;
27378
+ const taxData = ((_b = data.basicInformation) == null ? void 0 : _b.taxInformation) || ((_c = data.additionalInformation) == null ? void 0 : _c.taxInformation);
27379
+ const registrationNumber2 = ((_d = data.basicInformation) == null ? void 0 : _d.registrationNumber) || ((_e = data.additionalInformation) == null ? void 0 : _e.registrationNumber);
27380
+ const dbaName2 = ((_f = data.additionalInformation) == null ? void 0 : _f.dbaName) || ((_g = data.additionalInformation) == null ? void 0 : _g.legalCompanyName);
26243
27381
  if (requestObj.organization) {
26244
27382
  if (taxData) {
26245
- requestObj.organization.taxInformation = COUNTRIES_USING_COMPANY_SEARCH.includes((_e = data.basicInformation) == null ? void 0 : _e.country) ? (_f = data.basicInformation) == null ? void 0 : _f.taxInformation : (_g = data.additionalInformation) == null ? void 0 : _g.taxInformation;
27383
+ requestObj.organization.taxInformation = COUNTRIES_USING_COMPANY_SEARCH.includes((_h = data.basicInformation) == null ? void 0 : _h.country) ? (_i = data.basicInformation) == null ? void 0 : _i.taxInformation : (_j = data.additionalInformation) == null ? void 0 : _j.taxInformation;
26246
27384
  }
26247
27385
  if (registrationNumber2) {
26248
- requestObj.organization.registrationNumber = COUNTRIES_USING_COMPANY_SEARCH.includes((_h = data.basicInformation) == null ? void 0 : _h.country) ? (_i = data.basicInformation) == null ? void 0 : _i.registrationNumber : (_j = data.additionalInformation) == null ? void 0 : _j.registrationNumber;
27386
+ requestObj.organization.registrationNumber = COUNTRIES_USING_COMPANY_SEARCH.includes((_k = data.basicInformation) == null ? void 0 : _k.country) ? (_l = data.basicInformation) == null ? void 0 : _l.registrationNumber : (_m = data.additionalInformation) == null ? void 0 : _m.registrationNumber;
26249
27387
  }
26250
- if ((_k = data.additionalInformation) == null ? void 0 : _k.vatAbsenceReason) {
27388
+ if ((_n = data.additionalInformation) == null ? void 0 : _n.vatAbsenceReason) {
26251
27389
  requestObj.organization.vatNumber = "";
26252
27390
  }
27391
+ if (dbaName2) {
27392
+ requestObj.organization.doingBusinessAs = dbaName2;
27393
+ }
26253
27394
  }
26254
27395
  requestObj.type = LegalEntityType.ORGANIZATION;
26255
27396
  return requestObj;
@@ -26265,7 +27406,7 @@ const canSubmit$3 = (data) => MANDATORY_API_FIELDS.every((detail) => {
26265
27406
  });
26266
27407
  const isDocumentsRequired$3 = (forms2) => forms2.some((form) => documentFormsIds.includes(form.formId));
26267
27408
  const formatBasicInformation = (data, labels2, datasetUtils, companyType2) => {
26268
- var _a, _b, _c, _d, _e;
27409
+ var _a, _b, _c, _d;
26269
27410
  const country2 = data == null ? void 0 : data.country;
26270
27411
  const registrationNumberLabel = resolveFieldMetadata(defaultFieldConfig$9[country2], {
26271
27412
  companyType: companyType2,
@@ -26277,10 +27418,9 @@ const formatBasicInformation = (data, labels2, datasetUtils, companyType2) => {
26277
27418
  companyType: void 0
26278
27419
  }, defaultFieldMetadata$1).label;
26279
27420
  return {
26280
- [((_b = labels2 == null ? void 0 : labels2.basicInformation) == null ? void 0 : _b.businessName) ?? "businessName"]: data.businessName,
26281
- [((_c = labels2 == null ? void 0 : labels2.basicInformation) == null ? void 0 : _c.country) ?? "country"]: datasetUtils.getCountryName(data.country),
27421
+ [((_b = labels2 == null ? void 0 : labels2.basicInformation) == null ? void 0 : _b.country) ?? "country"]: datasetUtils.getCountryName(data.country),
26282
27422
  [getKeyForField("stateOrProvince", data.country)]: datasetUtils.getStateName(data.stateOrProvince, data.country),
26283
- [taxIdLabel]: (_e = (_d = data.taxInformation) == null ? void 0 : _d.find((taxId2) => data.country === taxId2.country)) == null ? void 0 : _e.number,
27423
+ [taxIdLabel]: (_d = (_c = data.taxInformation) == null ? void 0 : _c.find((taxId2) => data.country === taxId2.country)) == null ? void 0 : _d.number,
26284
27424
  [registrationNumberLabel]: data.registrationNumber
26285
27425
  };
26286
27426
  };
@@ -26296,16 +27436,16 @@ const formatAdditionalInformation = (data, labels2, country2, companyType2) => {
26296
27436
  companyType: void 0
26297
27437
  }, defaultFieldMetadata$1).label;
26298
27438
  return {
26299
- [((_b = labels2.additionalInformation) == null ? void 0 : _b.legalCompanyName) ?? "legalCompanyName"]: data.legalCompanyName,
26300
- [((_c = labels2.additionalInformation) == null ? void 0 : _c.dbaName) ?? "dbaName"]: data.dbaName,
27439
+ [((_b = labels2 == null ? void 0 : labels2.additionalInformation) == null ? void 0 : _b.legalCompanyName) ?? "legalCompanyName"]: data.legalCompanyName,
27440
+ [((_c = labels2 == null ? void 0 : labels2.additionalInformation) == null ? void 0 : _c.dbaName) ?? "dbaName"]: data.dbaName,
26301
27441
  [registrationNumberLabel]: data.registrationNumber,
26302
27442
  [taxIdLabel]: (_e = (_d = data.taxInformation) == null ? void 0 : _d.find((taxId2) => country2 === taxId2.country)) == null ? void 0 : _e.number,
26303
- [((_f = labels2.additionalInformation) == null ? void 0 : _f.vatNumber) ?? "vatNumber"]: data.vatNumber,
26304
- [((_g = labels2.additionalInformation) == null ? void 0 : _g.vatAbsenceReason) ?? "vatAbsenceReason"]: data.vatAbsenceReason,
26305
- [((_h = labels2.additionalInformation) == null ? void 0 : _h.dateOfIncorporation) ?? "dateOfIncorporation"]: data.dateOfIncorporation,
26306
- [((_i = labels2.additionalInformation) == null ? void 0 : _i.stockExchangeMIC) ?? "stockExchangeMIC"]: data.stockExchangeMIC,
26307
- [((_j = labels2.additionalInformation) == null ? void 0 : _j.stockISIN) ?? "stockISIN"]: data.stockISIN,
26308
- [((_k = labels2.additionalInformation) == null ? void 0 : _k.stockTickerSymbol) ?? "stockTickerSymbol"]: data.stockTickerSymbol
27443
+ [((_f = labels2 == null ? void 0 : labels2.additionalInformation) == null ? void 0 : _f.vatNumber) ?? "vatNumber"]: data.vatNumber,
27444
+ [((_g = labels2 == null ? void 0 : labels2.additionalInformation) == null ? void 0 : _g.vatAbsenceReason) ?? "vatAbsenceReason"]: data.vatAbsenceReason,
27445
+ [((_h = labels2 == null ? void 0 : labels2.additionalInformation) == null ? void 0 : _h.dateOfIncorporation) ?? "dateOfIncorporation"]: data.dateOfIncorporation,
27446
+ [((_i = labels2 == null ? void 0 : labels2.additionalInformation) == null ? void 0 : _i.stockExchangeMIC) ?? "stockExchangeMIC"]: data.stockExchangeMIC,
27447
+ [((_j = labels2 == null ? void 0 : labels2.additionalInformation) == null ? void 0 : _j.stockISIN) ?? "stockISIN"]: data.stockISIN,
27448
+ [((_k = labels2 == null ? void 0 : labels2.additionalInformation) == null ? void 0 : _k.stockTickerSymbol) ?? "stockTickerSymbol"]: data.stockTickerSymbol
26309
27449
  };
26310
27450
  };
26311
27451
  const formatDataForSummary$1 = (data, forms2, labels2, i18n) => {
@@ -26536,7 +27676,17 @@ function BusinessDetailsDropinComponent({
26536
27676
  useEffect(() => {
26537
27677
  onChange == null ? void 0 : onChange(currentState);
26538
27678
  }, [currentState, onChange]);
26539
- const documentUtils = documentApiUtils(handleCreateDocument, handleGetDocument, handleUpdateDocument);
27679
+ useEffect(() => {
27680
+ userEvents.addPageView("Business details dropin");
27681
+ userEvents.addEvent(BusinessDetailsEvents.TASK_START, {
27682
+ segmentation: getBaseTrackingPayload({
27683
+ trackingConfig,
27684
+ parentLegalEntity,
27685
+ legalEntity: legalEntityResponse,
27686
+ task: taskType
27687
+ })
27688
+ });
27689
+ }, []);
26540
27690
  const formRef = useRef(null);
26541
27691
  const {
26542
27692
  showToast,
@@ -26556,9 +27706,33 @@ function BusinessDetailsDropinComponent({
26556
27706
  var _a2;
26557
27707
  return ((_a2 = currentState.data.basicInformation) == null ? void 0 : _a2.country) ?? country2;
26558
27708
  }, [(_a = currentState.data.basicInformation) == null ? void 0 : _a.country, country2]);
26559
- const [loadingStatus, setLoadingStatus] = useState("success");
26560
27709
  const [initialData, setInitialData] = useState(mapLegalEntityToBusinessDetailsSchema(legalEntityResponse, Boolean(isTargetLegalEntityType), isNewEntryFlowEnabled ? accountHolder2 : void 0));
27710
+ const documentUtils = documentApiUtils(handleCreateDocument, handleGetDocument, handleUpdateDocument);
27711
+ useEffect(() => {
27712
+ var _a2;
27713
+ const documentIds = ((_a2 = legalEntityResponse == null ? void 0 : legalEntityResponse.documentDetails) == null ? void 0 : _a2.map((documentReference) => documentReference.id)) || [];
27714
+ if (!documentIds.length) return;
27715
+ documentUtils.fetchDocuments(documentIds, legalEntityResponse.id).then(() => {
27716
+ setInitialData({
27717
+ ...initialData,
27718
+ ...mapApiDocumentToBusinessDetailsDocuments(legalEntityResponse.id)
27719
+ });
27720
+ }).catch(() => showToast({
27721
+ label: i18n.get("failedToFetchRelevantDocuments"),
27722
+ type: "error"
27723
+ }));
27724
+ }, []);
27725
+ const [loadingStatus, setLoadingStatus] = useState("success");
26561
27726
  const [currentProblems, setCurrentProblems] = useState(problems ?? ((_c = (_b = getCapabilityProblems(legalEntityResponse, currentCountry, isExperimentEnabled)) == null ? void 0 : _b.LegalEntity) == null ? void 0 : _c[legalEntityResponse.id]));
27727
+ const [isLoading, setIsLoading] = useState(true);
27728
+ const [isBusinessSelection, setIsBusinessSelection] = useState(false);
27729
+ const [showCompanyStructure, setShowCompanyStructure] = useState(currentCountry !== "US");
27730
+ const baseTrackingPayload = useMemo(() => getBaseTrackingPayload({
27731
+ trackingConfig,
27732
+ parentLegalEntity,
27733
+ legalEntity: legalEntityResponse,
27734
+ task: taskType
27735
+ }), [legalEntityResponse, parentLegalEntity, taskType, trackingConfig]);
26562
27736
  const getConfigurationData = useCallback(() => getConfiguration2({
26563
27737
  legalEntityType: LegalEntityType.ORGANIZATION,
26564
27738
  capabilities: capabilities ?? getCapabilities(legalEntityResponse),
@@ -26579,19 +27753,21 @@ function BusinessDetailsDropinComponent({
26579
27753
  isExperimentEnabled
26580
27754
  }), [currentCountry, currentState.data, isExperimentEnabled, taskType]);
26581
27755
  const initialForms = useMemo(() => getForms(currentCountry), [currentCountry]);
26582
- const derivedProps = useMemo(() => getPropsFromConfigurations(fieldConfigurations, initialForms, (problems == null ? void 0 : problems.remediationActions) ? Object.values(problems == null ? void 0 : problems.remediationActions) : [], (problems == null ? void 0 : problems.missingData) ?? [], legalEntityResponse ? getFieldsWithExistingData(legalEntityResponse, isExperimentEnabled) : [], customRules), [customRules, fieldConfigurations, initialForms, isExperimentEnabled, legalEntityResponse, problems == null ? void 0 : problems.missingData, problems == null ? void 0 : problems.remediationActions]);
27756
+ const derivedProps = useMemo(() => getPropsFromConfigurations(fieldConfigurations, initialForms, (problems == null ? void 0 : problems.remediationActions) ? Object.values(problems == null ? void 0 : problems.remediationActions) : [], (problems == null ? void 0 : problems.missingData) ?? [], legalEntityResponse ? getFieldsWithExistingData(legalEntityResponse, isExperimentEnabled) : [], customRules, {}, {}, legalEntityResponse.trustedFields), [customRules, fieldConfigurations, initialForms, isExperimentEnabled, legalEntityResponse, problems == null ? void 0 : problems.missingData, problems == null ? void 0 : problems.remediationActions]);
26583
27757
  const isSkippingCompanyStructure = useEnableNewEntryFlow() && organizationTypesToSkipCompanyStructureForm.includes((_d = legalEntityResponse == null ? void 0 : legalEntityResponse.organization) == null ? void 0 : _d.type) && accountHolder2 !== "aTrust";
26584
27758
  const forms2 = useMemo(() => {
26585
27759
  const requiredForms = getRequiredForms(initialForms, derivedProps == null ? void 0 : derivedProps.requiredFields, derivedProps == null ? void 0 : derivedProps.optionalFields);
26586
- return addValidityToForms(requiredForms, currentState.validityByForm, problems).filter((form) => isSkippingCompanyStructure ? form.formId !== "companyStructure" : true);
26587
- }, [initialForms, derivedProps == null ? void 0 : derivedProps.requiredFields, derivedProps == null ? void 0 : derivedProps.optionalFields, currentState.validityByForm, problems, isSkippingCompanyStructure]);
27760
+ return addValidityToForms(requiredForms, currentState.validityByForm, problems).filter((form) => {
27761
+ switch (form.formId) {
27762
+ case "companyStructure": {
27763
+ return currentCountry !== "US" && !isSkippingCompanyStructure || showCompanyStructure;
27764
+ }
27765
+ default:
27766
+ return true;
27767
+ }
27768
+ });
27769
+ }, [initialForms, derivedProps == null ? void 0 : derivedProps.requiredFields, derivedProps == null ? void 0 : derivedProps.optionalFields, currentState.validityByForm, problems, currentCountry, isSkippingCompanyStructure, showCompanyStructure]);
26588
27770
  const canSubmitForm = useMemo(() => canSubmit$3(currentState.data) && hasDataChanged(initialData, currentState.data), [initialData, currentState.data]);
26589
- const baseTrackingPayload = useMemo(() => getBaseTrackingPayload({
26590
- trackingConfig,
26591
- parentLegalEntity,
26592
- legalEntity: legalEntityResponse,
26593
- task: taskType
26594
- }), [legalEntityResponse, parentLegalEntity, taskType, trackingConfig]);
26595
27771
  const summaryData = useMemo(() => ({
26596
27772
  data: formatDataForSummary$1(currentState.data, forms2, derivedProps == null ? void 0 : derivedProps.labels, i18n),
26597
27773
  omittedKeys: ["operationalAddressIsSame"]
@@ -26629,32 +27805,78 @@ function BusinessDetailsDropinComponent({
26629
27805
  formRef,
26630
27806
  onSubmit: submitTask
26631
27807
  });
26632
- useEffect(() => {
26633
- var _a2;
26634
- const documentIds = ((_a2 = legalEntityResponse == null ? void 0 : legalEntityResponse.documentDetails) == null ? void 0 : _a2.map((documentReference) => documentReference.id)) || [];
26635
- if (!documentIds.length) return;
26636
- documentUtils.fetchDocuments(documentIds, legalEntityResponse.id).then(() => {
26637
- setInitialData({
26638
- ...initialData,
26639
- ...mapApiDocumentToBusinessDetailsDocuments(legalEntityResponse.id)
26640
- });
26641
- }).catch(() => showToast({
26642
- label: i18n.get("failedToFetchRelevantDocuments"),
26643
- type: "error"
26644
- }));
26645
- }, []);
26646
- useEffect(() => {
26647
- userEvents.addPageView("Business details dropin");
26648
- userEvents.addEvent(BusinessDetailsEvents.TASK_START, {
26649
- segmentation: baseTrackingPayload
26650
- });
26651
- }, [baseTrackingPayload]);
27808
+ const [searchName, setSearchName] = useState();
27809
+ const [searchResults, setSearchResults] = useState();
27810
+ const [verifiedBusiness, setVerifiedBusiness] = useState();
27811
+ const showBusinessSelection = useMemo(() => isBusinessSelection && activeForm.formId === "basicInformation", [activeForm.formId, isBusinessSelection]);
27812
+ const hideBack = useMemo(() => {
27813
+ if (!COUNTRIES_USING_COMPANY_SEARCH.includes(currentCountry)) return hideBackButton;
27814
+ if (showBusinessSelection) {
27815
+ return isLoading ? hideBackButton : false;
27816
+ }
27817
+ return hideBackButton;
27818
+ }, [currentCountry, hideBackButton, showBusinessSelection, isLoading]);
27819
+ const hideHome = useMemo(() => isLoading && showBusinessSelection ? true : hideHomeButton, [hideHomeButton, isLoading, showBusinessSelection]);
27820
+ const goToForm = useCallback((index) => {
27821
+ const form = forms2[index].formId;
27822
+ if (!COUNTRIES_USING_COMPANY_SEARCH.includes(currentCountry)) return gotoFormByFormIndex(index);
27823
+ switch (form) {
27824
+ case "basicInformation": {
27825
+ if (!canSubmitForm) {
27826
+ setVerifiedBusiness(void 0);
27827
+ setShowCompanyStructure(false);
27828
+ setIsBusinessSelection(false);
27829
+ }
27830
+ break;
27831
+ }
27832
+ case "additionalInformation": {
27833
+ if (!isBusinessSelection) setIsBusinessSelection(true);
27834
+ break;
27835
+ }
27836
+ }
27837
+ return gotoFormByFormIndex(index);
27838
+ }, [canSubmitForm, currentCountry, forms2, gotoFormByFormIndex, isBusinessSelection]);
27839
+ const nextClick = useCallback(() => {
27840
+ if (!COUNTRIES_USING_COMPANY_SEARCH.includes(currentCountry)) return handleNextClick();
27841
+ switch (activeForm.formId) {
27842
+ case "basicInformation":
27843
+ if (showCompanyStructure) {
27844
+ return handleNextClick();
27845
+ }
27846
+ return isBusinessSelection ? handleNextClick() : setIsBusinessSelection(true);
27847
+ default:
27848
+ return handleNextClick();
27849
+ }
27850
+ }, [activeForm.formId, currentCountry, handleNextClick, isBusinessSelection, showCompanyStructure]);
27851
+ const backClick = useCallback(() => {
27852
+ if (!COUNTRIES_USING_COMPANY_SEARCH.includes(country2)) return handleNextClick();
27853
+ switch (activeForm.formId) {
27854
+ case "basicInformation": {
27855
+ return showBusinessSelection ? setIsBusinessSelection(false) : void 0;
27856
+ }
27857
+ case "companyStructure": {
27858
+ if (!isLoading && searchResults && !searchResults.length) {
27859
+ setIsBusinessSelection(false);
27860
+ } else {
27861
+ setShowCompanyStructure(false);
27862
+ }
27863
+ return handleBackClick == null ? void 0 : handleBackClick();
27864
+ }
27865
+ case "additionalInformation": {
27866
+ setVerifiedBusiness(void 0);
27867
+ return handleBackClick == null ? void 0 : handleBackClick();
27868
+ }
27869
+ default:
27870
+ return handleBackClick == null ? void 0 : handleBackClick();
27871
+ }
27872
+ }, [activeForm.formId, country2, handleBackClick, handleNextClick, isLoading, searchResults, showBusinessSelection]);
26652
27873
  return jsx(FormWrapper, {
26653
27874
  taskName: taskName ?? "businessDetails",
26654
- gotoFormByFormIndex,
27875
+ gotoFormByFormIndex: goToForm,
26655
27876
  hideDropinLayout,
26656
- hideHomeButton,
26657
- hideBackButton,
27877
+ hideHomeButton: hideHome,
27878
+ hideBackButton: hideBack,
27879
+ hideNextButton: showBusinessSelection,
26658
27880
  loadingStatus,
26659
27881
  forms: forms2,
26660
27882
  activeForm,
@@ -26666,8 +27888,9 @@ function BusinessDetailsDropinComponent({
26666
27888
  summary: summaryData,
26667
27889
  homeButtonLabel,
26668
27890
  nextButtonLabel,
26669
- handleNextClick,
26670
- handleBackClick,
27891
+ backButtonLabel: i18n.get("goBack"),
27892
+ handleNextClick: nextClick,
27893
+ handleBackClick: backClick,
26671
27894
  handleHomeClick,
26672
27895
  children: jsx(BusinessDetailsComponent, {
26673
27896
  ...derivedProps,
@@ -26680,6 +27903,19 @@ function BusinessDetailsDropinComponent({
26680
27903
  isTopLevelEntity: taskType === TaskTypes.BUSINESS_DETAILS,
26681
27904
  onTypeSwitch,
26682
27905
  baseTrackingPayload,
27906
+ isBusinessSelection: showBusinessSelection,
27907
+ setIsBusinessSelection,
27908
+ searchName,
27909
+ setSearchName,
27910
+ searchResults,
27911
+ setSearchResults,
27912
+ verifiedBusiness,
27913
+ setVerifiedBusiness,
27914
+ isLoading,
27915
+ setIsLoading,
27916
+ showCompanyStructure,
27917
+ setShowCompanyStructure,
27918
+ handleNextClick: nextClick,
26683
27919
  handleAddressSearch,
26684
27920
  handleFindAddress,
26685
27921
  handleCompanyIndexSearch,
@@ -27116,247 +28352,6 @@ function CompanyDropinComponent({
27116
28352
  })
27117
28353
  });
27118
28354
  }
27119
- var CompanySearchEvents = /* @__PURE__ */ ((CompanySearchEvents2) => {
27120
- CompanySearchEvents2["TASK_START"] = "CompanySearch_TaskStarted";
27121
- CompanySearchEvents2["TASK_SUBMIT"] = "CompanySearch_TaskSubmitted";
27122
- CompanySearchEvents2["TASK_SAVED"] = "CompanySearch_TaskSaved";
27123
- CompanySearchEvents2["TASK_ERROR"] = "CompanySearch_TaskError";
27124
- CompanySearchEvents2["DOCUMENTS_SAVED"] = "CompanySearch_DocumentsSaved";
27125
- CompanySearchEvents2["DOCUMENTS_ERROR"] = "CompanySearch_DocumentsError";
27126
- CompanySearchEvents2["NO_SEARCH_RESULTS"] = "CompanySearch_NoSearchResults";
27127
- CompanySearchEvents2["TIN_MATCH"] = "CompanySearch_TinMatch";
27128
- CompanySearchEvents2["TIN_NO_MATCH"] = "CompanySearch_TinNoMatch";
27129
- CompanySearchEvents2["SELECTION_RESET"] = "CompanySearch_CompanySelectionReset";
27130
- CompanySearchEvents2["SELECTION_ERROR"] = "CompanySearch_CompanySelectionError";
27131
- return CompanySearchEvents2;
27132
- })(CompanySearchEvents || {});
27133
- const logger$k = createLogger("useCompanySearch");
27134
- const LOW_RISK_COMPANY_DATA_COMPLIANCE_WINDOW = 1577664e5;
27135
- function useCompanySearch({
27136
- defaultData,
27137
- legalCompanyName: legalCompanyName2,
27138
- country: country2,
27139
- stateOrProvince: stateOrProvince2,
27140
- taxIdentificationNumber: taxIdentificationNumber2,
27141
- canVerify,
27142
- limit = 15,
27143
- baseTrackingPayload,
27144
- setKompanyAddress,
27145
- handleChangeFor,
27146
- handleCompanyIndexSearch,
27147
- handleCompanyDeepSearch,
27148
- handleGetCompanyDataset,
27149
- handleRefreshCompanyDataset,
27150
- handleVerifyTin
27151
- }) {
27152
- const [companiesList, setCompaniesList] = useState([]);
27153
- const [selectedCompanyId, setSelectedCompanyId] = useState();
27154
- const [verifiedCompany, setVerifiedCompany] = useState();
27155
- const [status, setStatus] = useState("idle");
27156
- const [error, setError] = useState();
27157
- const isLastUpdateDateCompliant = (company2) => {
27158
- const date = (/* @__PURE__ */ new Date()).toDateString();
27159
- return company2.lastUpdate ? Date.parse(date) - Date.parse(company2.lastUpdate) < LOW_RISK_COMPANY_DATA_COMPLIANCE_WINDOW : false;
27160
- };
27161
- const searchCompanies = useMemo(() => debounce(async ({
27162
- companyName: companyName2,
27163
- companyCountry,
27164
- companyState,
27165
- resultsLimit,
27166
- deepSearch
27167
- }) => {
27168
- try {
27169
- if (!deepSearch) return;
27170
- setStatus("loading");
27171
- setCompaniesList([]);
27172
- const {
27173
- results: deepSearchResults
27174
- } = await deepSearch({
27175
- text: companyName2,
27176
- country: companyCountry,
27177
- state: companyState,
27178
- limit: resultsLimit
27179
- });
27180
- return setCompaniesList(deepSearchResults);
27181
- } catch (e) {
27182
- setStatus("error");
27183
- setError(e);
27184
- } finally {
27185
- setStatus((prevStatus) => prevStatus !== "error" ? "loaded" : prevStatus);
27186
- }
27187
- }, 700), []);
27188
- const retrySearch = useCallback(async () => {
27189
- if (!legalCompanyName2 || !country2 || !stateOrProvince2) {
27190
- return setStatus("idle");
27191
- }
27192
- try {
27193
- if (!handleCompanyDeepSearch) return;
27194
- setStatus("loading");
27195
- setSelectedCompanyId(void 0);
27196
- const {
27197
- results: deepSearchResults
27198
- } = await handleCompanyDeepSearch({
27199
- text: legalCompanyName2,
27200
- country: country2,
27201
- state: stateOrProvince2,
27202
- limit
27203
- });
27204
- return setCompaniesList(deepSearchResults);
27205
- } catch (e) {
27206
- setStatus("error");
27207
- setError(e);
27208
- } finally {
27209
- setStatus((prevStatus) => prevStatus !== "error" ? "loaded" : prevStatus);
27210
- }
27211
- }, [handleCompanyDeepSearch, country2, legalCompanyName2, limit, stateOrProvince2]);
27212
- const verify2 = useCallback(async (companyTIN, company2) => {
27213
- try {
27214
- if (!handleVerifyTin || !handleGetCompanyDataset || !handleRefreshCompanyDataset) return;
27215
- setStatus("loading");
27216
- setSelectedCompanyId(company2.id);
27217
- if (!canVerify || !companyTIN) {
27218
- return setStatus("error");
27219
- }
27220
- const {
27221
- matched
27222
- } = await handleVerifyTin({
27223
- tin: companyTIN,
27224
- name: company2.name
27225
- });
27226
- if (!matched) {
27227
- setStatus("error");
27228
- userEvents.addEvent(CompanySearchEvents.TIN_NO_MATCH, {
27229
- segmentation: {
27230
- ...baseTrackingPayload
27231
- }
27232
- });
27233
- return setError({
27234
- message: "TIN does not match the selected company",
27235
- response: {
27236
- status: 200
27237
- }
27238
- });
27239
- }
27240
- userEvents.addEvent(CompanySearchEvents.TIN_MATCH, {
27241
- segmentation: {
27242
- ...baseTrackingPayload
27243
- }
27244
- });
27245
- const companyData = isLastUpdateDateCompliant(company2) ? await handleGetCompanyDataset({
27246
- companyId: company2.id,
27247
- country: country2
27248
- }) : await handleRefreshCompanyDataset({
27249
- companyId: company2.id,
27250
- country: country2
27251
- });
27252
- return setVerifiedCompany({
27253
- ...companyData,
27254
- state: companyData.state ?? stateOrProvince2
27255
- });
27256
- } catch (e) {
27257
- logger$k.error(e);
27258
- setError(e);
27259
- setStatus("error");
27260
- } finally {
27261
- setStatus((prevStatus) => prevStatus !== "error" ? "loaded" : prevStatus);
27262
- }
27263
- }, [handleVerifyTin, handleGetCompanyDataset, handleRefreshCompanyDataset, canVerify, country2, stateOrProvince2, baseTrackingPayload]);
27264
- const reset = useCallback(() => {
27265
- setStatus("loading");
27266
- setSelectedCompanyId(void 0);
27267
- setVerifiedCompany(void 0);
27268
- setKompanyAddress(void 0);
27269
- setCompaniesList([]);
27270
- if (defaultData) {
27271
- handleChangeFor("legalCompanyName")(defaultData.legalCompanyName);
27272
- }
27273
- }, [defaultData, handleChangeFor, setKompanyAddress]);
27274
- useEffect(() => {
27275
- var _a;
27276
- setError(void 0);
27277
- const isMinLength = legalCompanyName2 && legalCompanyName2.split("").length > 3;
27278
- if (!legalCompanyName2 || !country2 || !stateOrProvince2 || !taxIdentificationNumber2 || !canVerify || !isMinLength) {
27279
- return setStatus("idle");
27280
- }
27281
- if (!verifiedCompany) {
27282
- setSelectedCompanyId(void 0);
27283
- (_a = searchCompanies({
27284
- companyName: legalCompanyName2,
27285
- companyCountry: country2,
27286
- companyState: stateOrProvince2,
27287
- indexSearch: handleCompanyIndexSearch,
27288
- deepSearch: handleCompanyDeepSearch,
27289
- resultsLimit: limit
27290
- })) == null ? void 0 : _a.catch((e) => logger$k.error(e));
27291
- }
27292
- }, [legalCompanyName2, country2, stateOrProvince2, taxIdentificationNumber2, verifiedCompany, searchCompanies, handleCompanyIndexSearch, handleCompanyDeepSearch, limit, canVerify, baseTrackingPayload]);
27293
- useEffect(() => {
27294
- setVerifiedCompany(void 0);
27295
- setSelectedCompanyId(void 0);
27296
- }, [taxIdentificationNumber2]);
27297
- useEffect(() => {
27298
- if (status !== "error") {
27299
- return setError(void 0);
27300
- }
27301
- }, [status]);
27302
- return {
27303
- results: companiesList,
27304
- selectedCompanyId,
27305
- verifiedCompany,
27306
- status,
27307
- error,
27308
- retrySearch,
27309
- verify: verify2,
27310
- reset
27311
- };
27312
- }
27313
- const mapOrganizationTypeToCompanyType = (organizationType) => {
27314
- switch (organizationType) {
27315
- case "BUSINESS":
27316
- return CompanyTypesValue.PRIVATE_COMPANY;
27317
- case "NON_PROFIT":
27318
- return CompanyTypesValue.NON_PROFIT_OR_CHARITABLE;
27319
- case "PUBLIC_COMPANY":
27320
- case "LISTED_PUBLIC_COMPANY":
27321
- return CompanyTypesValue.PUBLIC_COMPANY;
27322
- case "UNLISTED_PUBLIC_COMPANY":
27323
- return CompanyTypesValue.UNLISTED_PUBLIC_COMPANY;
27324
- case "GOVERNMENTAL_ORGANIZATION":
27325
- return CompanyTypesValue.GOVERNMENTAL_ORGANIZATION;
27326
- case "SOLE_PROPRIETOR":
27327
- return CompanyTypesValue.SOLE_PROPRIETORSHIP;
27328
- case "PARTNERSHIP_INCORPORATED":
27329
- return CompanyTypesValue.INCORPORATED_PARTNERSHIP;
27330
- case "ASSOCIATION_INCORPORATED":
27331
- return CompanyTypesValue.INCORPORATED_ASSOCIATION;
27332
- case "OTHER":
27333
- case "PARTNERSHIP":
27334
- default:
27335
- return void 0;
27336
- }
27337
- };
27338
- const mapCompanyDataResponseToFormSchema = (company2) => ({
27339
- companyBasics: {
27340
- country: company2.country,
27341
- stateOrProvince: company2.state,
27342
- legalCompanyName: company2.name
27343
- },
27344
- companyRegistrationAddress: {
27345
- registrationAddress: {
27346
- address: company2.street,
27347
- stateOrProvince: company2.state,
27348
- country: company2.country,
27349
- postalCode: company2.zipcode,
27350
- city: company2.city
27351
- }
27352
- },
27353
- companyStructure: {
27354
- entityType: mapOrganizationTypeToCompanyType(company2.organizationType)
27355
- },
27356
- companyOtherDetails: {
27357
- registrationNumber: company2.registrationNumber
27358
- }
27359
- });
27360
28355
  const CompanyLookupResultsHeader = ({
27361
28356
  results,
27362
28357
  status,
@@ -27431,9 +28426,9 @@ const LookupResultAlert = ({
27431
28426
  i18n
27432
28427
  } = useI18nContext();
27433
28428
  const iconType = {
27434
- verified: AlertTypes.SUCCESS,
27435
- warning: AlertTypes.WARNING,
27436
- error: AlertTypes.ERROR
28429
+ verified: "success",
28430
+ warning: "warning",
28431
+ error: "error"
27437
28432
  };
27438
28433
  return jsxs("div", {
27439
28434
  className: `adyen-company-lookup-result__alert adyen-company-lookup-result__alert--${type}`,
@@ -28392,133 +29387,7 @@ const formatDataForSummary = (data, forms2, labels2, i18n) => {
28392
29387
  }
28393
29388
  }, {});
28394
29389
  };
28395
- const mapCompanySearchDocumentToApiDocument = async (data, entityId) => {
28396
- var _a, _b, _c;
28397
- const {
28398
- companyRegistrationDocument: companyRegistrationDocument2,
28399
- companyTaxDocument
28400
- } = data;
28401
- const entityType2 = "legalEntity";
28402
- const taxDocumentType = COUNTRIES_THAT_USE_TAX_ID_INSTEAD_OF_VAT.includes((_a = data.companyBasics) == null ? void 0 : _a.country) ? DocumentType.PROOF_OF_ORGANIZATION_TAX_INFO : DocumentType.VAT_DOCUMENT;
28403
- const documents2 = await Promise.all([
28404
- createDocumentRequest({
28405
- entityId,
28406
- entityType: entityType2,
28407
- documentType: DocumentType.REGISTRATION_DOCUMENT,
28408
- page1: (_b = companyRegistrationDocument2 == null ? void 0 : companyRegistrationDocument2.registrationDocument) == null ? void 0 : _b[0]
28409
- }),
28410
- createDocumentRequest({
28411
- entityId,
28412
- entityType: entityType2,
28413
- documentType: taxDocumentType,
28414
- page1: (_c = companyTaxDocument == null ? void 0 : companyTaxDocument.taxDocument) == null ? void 0 : _c[0]
28415
- })
28416
- // Add this when we need shareholder document functionality
28417
- // createDocumentRequest(legalEntityId, 'legalEntity', DocumentType.SHAREHOLDER_DOCUMENT, shareholderDocument?.[0])
28418
- ]);
28419
- return documents2.filter(Boolean);
28420
- };
28421
- const mapCompanySearchSchemaToLegalEntity = (data) => {
28422
- var _a, _b, _c, _d, _e;
28423
- const requestObj = {
28424
- ...formatObject(data, companySearchApiKeyMapping)
28425
- };
28426
- if (requestObj.organization) {
28427
- if (((_a = data.companyBasics) == null ? void 0 : _a.taxInformation) || ((_b = data.companyOtherDetails) == null ? void 0 : _b.taxInformation)) {
28428
- requestObj.organization.taxInformation = ((_c = data.companyBasics) == null ? void 0 : _c.country) === "US" ? (_d = data.companyBasics) == null ? void 0 : _d.taxInformation : (_e = data.companyOtherDetails) == null ? void 0 : _e.taxInformation;
28429
- }
28430
- if (requestObj.organization.vatAbsenceReason) {
28431
- requestObj.organization.vatNumber = "";
28432
- }
28433
- }
28434
- requestObj.type = LegalEntityType.ORGANIZATION;
28435
- return requestObj;
28436
- };
28437
- const mapApiDocumentToCompanySearchDocuments = (entityId) => {
28438
- const registrationDocument2 = getDocument$1(entityId, DocumentType.REGISTRATION_DOCUMENT) ?? null;
28439
- const taxDocument2 = getDocument$1(entityId, DocumentType.VAT_DOCUMENT) ?? getDocument$1(entityId, DocumentType.PROOF_OF_ORGANIZATION_TAX_INFO) ?? null;
28440
- return {
28441
- companyRegistrationDocument: registrationDocument2 ? {
28442
- registrationDocument: [mapExistingFile(getPageName(registrationDocument2))]
28443
- } : void 0,
28444
- companyTaxDocument: taxDocument2 ? {
28445
- taxDocument: [mapExistingFile(getPageName(taxDocument2))]
28446
- } : void 0
28447
- };
28448
- };
28449
- const mapLegalEntityToCompanySearchSchema = (legalEntity, isChangingType, accountHolder2) => {
28450
- const companySearchSchema = {
28451
- companyBasics: {},
28452
- companyRegistrationAddress: {},
28453
- companyStructure: {},
28454
- companyOtherDetails: {},
28455
- companyRegistrationDocument: {},
28456
- companyTaxDocument: {},
28457
- ...formatObject(legalEntity, companySearchComponentsKeyMapping)
28458
- };
28459
- const {
28460
- companyRegistrationDocument: companyRegistrationDocument2,
28461
- companyTaxDocument
28462
- } = mapApiDocumentToCompanySearchDocuments(legalEntity == null ? void 0 : legalEntity.id);
28463
- return entriesOf(companySearchSchema).reduce((componentData, [key, value]) => {
28464
- var _a, _b, _c, _d, _e, _f, _g;
28465
- switch (key) {
28466
- case "companyBasics": {
28467
- return {
28468
- ...componentData,
28469
- [key]: value
28470
- };
28471
- }
28472
- case "companyRegistrationAddress": {
28473
- return {
28474
- ...componentData,
28475
- [key]: {
28476
- ...value,
28477
- operationalAddressIsSame: ((_a = legalEntity.organization) == null ? void 0 : _a.principalPlaceOfBusiness) ? operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_NOT_SAME : operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_SAME
28478
- }
28479
- };
28480
- }
28481
- case "companyOtherDetails": {
28482
- return {
28483
- ...componentData,
28484
- [key]: {
28485
- ...value,
28486
- tradingName: !((_b = legalEntity.organization) == null ? void 0 : _b.doingBusinessAs) ? (_c = legalEntity.organization) == null ? void 0 : _c.legalName : (_d = legalEntity.organization) == null ? void 0 : _d.doingBusinessAs,
28487
- sameNameAsLegalName: !((_e = legalEntity.organization) == null ? void 0 : _e.doingBusinessAs) || ((_f = legalEntity.organization) == null ? void 0 : _f.doingBusinessAs) === ((_g = legalEntity.organization) == null ? void 0 : _g.legalName)
28488
- }
28489
- };
28490
- }
28491
- case "companyStructure": {
28492
- return {
28493
- ...componentData,
28494
- [key]: {
28495
- ...value,
28496
- accountHolder: getDefaultAccountHolderType(legalEntity, isChangingType, accountHolder2)
28497
- }
28498
- };
28499
- }
28500
- case "companyRegistrationDocument": {
28501
- return {
28502
- ...componentData,
28503
- [key]: {
28504
- ...companyRegistrationDocument2
28505
- }
28506
- };
28507
- }
28508
- case "companyTaxDocument": {
28509
- return {
28510
- ...componentData,
28511
- [key]: {
28512
- ...companyTaxDocument
28513
- }
28514
- };
28515
- }
28516
- default:
28517
- return componentData;
28518
- }
28519
- }, {});
28520
- };
28521
- const logger$j = createLogger("useFormTaskSubmit");
29390
+ const logger$k = createLogger("useFormTaskSubmit");
28522
29391
  function useCompanySearchTaskSubmit({
28523
29392
  task,
28524
29393
  forms: forms2,
@@ -28561,7 +29430,7 @@ function useCompanySearchTaskSubmit({
28561
29430
  });
28562
29431
  }
28563
29432
  } catch (e) {
28564
- logger$j.error(e);
29433
+ logger$k.error(e);
28565
29434
  userEvents.addEvent(CompanySearchEvents.DOCUMENTS_ERROR, {
28566
29435
  segmentation: {
28567
29436
  ...baseTrackingPayload,
@@ -28613,7 +29482,7 @@ function useCompanySearchTaskSubmit({
28613
29482
  ...trackingPayload
28614
29483
  }
28615
29484
  });
28616
- logger$j.log(submittedLegalEntity);
29485
+ logger$k.log(submittedLegalEntity);
28617
29486
  clearToasts();
28618
29487
  onExternalSubmit == null ? void 0 : onExternalSubmit(data);
28619
29488
  } catch (e) {
@@ -28637,7 +29506,7 @@ function useCompanySearchTaskSubmit({
28637
29506
  type: "error"
28638
29507
  });
28639
29508
  }
28640
- logger$j.error(e);
29509
+ logger$k.error(e);
28641
29510
  userEvents.addEvent(CompanySearchEvents.TASK_ERROR, {
28642
29511
  segmentation: {
28643
29512
  ...baseTrackingPayload,
@@ -28994,7 +29863,9 @@ function CompanySearchDropinComponent({
28994
29863
  })
28995
29864
  });
28996
29865
  }
28997
- const logger$i = createLogger("useLocalStorage");
29866
+ const IgnoreLocalStorageContext = createContext(false);
29867
+ const useIgnoreLocalStorage = () => useContext(IgnoreLocalStorageContext);
29868
+ const logger$j = createLogger("useLocalStorage");
28998
29869
  const useLocalStorage = (key, defaultValue, options) => {
28999
29870
  const {
29000
29871
  serializer,
@@ -29006,20 +29877,21 @@ const useLocalStorage = (key, defaultValue, options) => {
29006
29877
  syncData: true,
29007
29878
  ...options
29008
29879
  }), [options]);
29880
+ const ignoreLocalStorage = useIgnoreLocalStorage() || typeof window === "undefined";
29009
29881
  const rawValueRef = useRef(null);
29010
29882
  const [value, setValue] = useState(() => {
29011
- if (typeof window === "undefined") return defaultValue;
29883
+ if (ignoreLocalStorage) return defaultValue;
29012
29884
  try {
29013
29885
  rawValueRef.current = window.localStorage.getItem(key);
29014
29886
  const res = rawValueRef.current ? parser(rawValueRef.current) : defaultValue;
29015
29887
  return res;
29016
29888
  } catch (err) {
29017
- logger$i.error(err);
29889
+ logger$j.error(err);
29018
29890
  return defaultValue;
29019
29891
  }
29020
29892
  });
29021
29893
  useEffect(() => {
29022
- if (typeof window === "undefined") return;
29894
+ if (ignoreLocalStorage) return;
29023
29895
  const updateLocalStorage = () => {
29024
29896
  if (value !== void 0) {
29025
29897
  const newValue = serializer(value);
@@ -29045,9 +29917,9 @@ const useLocalStorage = (key, defaultValue, options) => {
29045
29917
  try {
29046
29918
  updateLocalStorage();
29047
29919
  } catch (err) {
29048
- logger$i.error(err);
29920
+ logger$j.error(err);
29049
29921
  }
29050
- }, [value]);
29922
+ }, [value, ignoreLocalStorage]);
29051
29923
  useEffect(() => {
29052
29924
  if (!syncData) return;
29053
29925
  const handleStorageChange = (event) => {
@@ -29058,13 +29930,13 @@ const useLocalStorage = (key, defaultValue, options) => {
29058
29930
  setValue(event.newValue ? parser(event.newValue) : void 0);
29059
29931
  }
29060
29932
  } catch (err) {
29061
- logger$i.error(err);
29933
+ logger$j.error(err);
29062
29934
  }
29063
29935
  };
29064
- if (typeof window === "undefined") return;
29936
+ if (ignoreLocalStorage) return;
29065
29937
  window.addEventListener("storage", handleStorageChange);
29066
29938
  return () => window.removeEventListener("storage", handleStorageChange);
29067
- }, [key, syncData]);
29939
+ }, [key, syncData, ignoreLocalStorage]);
29068
29940
  return [value, setValue];
29069
29941
  };
29070
29942
  const getHasSeenIntroductionStorageKey = (legalEntityId) => `COMPLETED_INTRO-${legalEntityId}`;
@@ -29116,7 +29988,7 @@ const useIsEligibleForSingpass = ({
29116
29988
  const isVanillaIndividual = legalEntityType === LegalEntityType.INDIVIDUAL && !hasSoleProprietor;
29117
29989
  return isVanillaOrganization && isSingpassForCompaniesEnabled || isVanillaIndividual && isSingpassForIndividualsEnabled;
29118
29990
  };
29119
- const logger$h = createLogger("useAssociatedLegalArrangement");
29991
+ const logger$i = createLogger("useAssociatedLegalArrangement");
29120
29992
  function useAssociatedLegalArrangement({
29121
29993
  rootLegalEntity,
29122
29994
  getLegalEntity: getLegalEntity2
@@ -29127,7 +29999,7 @@ function useAssociatedLegalArrangement({
29127
29999
  var _a;
29128
30000
  const foundEntity = (_a = rootLegalEntity == null ? void 0 : rootLegalEntity.entityAssociations) == null ? void 0 : _a.find((entity) => entity.type === LegalEntityType.SOLE_PROPRIETORSHIP || entity.type === LegalEntityType.TRUST);
29129
30001
  if (foundEntity == null ? void 0 : foundEntity.legalEntityId) {
29130
- getAssociatedEntity(foundEntity == null ? void 0 : foundEntity.legalEntityId).then((res) => setAssociatedLegalArrangement(res)).catch(logger$h.error);
30002
+ getAssociatedEntity(foundEntity == null ? void 0 : foundEntity.legalEntityId).then((res) => setAssociatedLegalArrangement(res)).catch(logger$i.error);
29131
30003
  }
29132
30004
  }, [getAssociatedEntity, rootLegalEntity == null ? void 0 : rootLegalEntity.entityAssociations]);
29133
30005
  useEffect(() => {
@@ -29149,7 +30021,7 @@ const useCanSeeEntitySelection = (legalEntityId) => {
29149
30021
  setCanSeeEntitySelection: setCanSeeEntitySelectionIntoLocalStorage
29150
30022
  };
29151
30023
  };
29152
- const logger$g = createLogger("useExemptSettlor");
30024
+ const logger$h = createLogger("useExemptSettlor");
29153
30025
  const useExemptSettlor = ({
29154
30026
  trust: trust2,
29155
30027
  handleGetLegalEntity
@@ -29162,7 +30034,7 @@ const useExemptSettlor = ({
29162
30034
  }, [handleGetLegalEntity]);
29163
30035
  useEffect(() => {
29164
30036
  if (!(trust2 == null ? void 0 : trust2.trust)) return;
29165
- updateExemptSettlor(trust2).catch(logger$g.error);
30037
+ updateExemptSettlor(trust2).catch(logger$h.error);
29166
30038
  }, [trust2, updateExemptSettlor]);
29167
30039
  return exemptSettlor;
29168
30040
  };
@@ -29187,11 +30059,6 @@ function useSalesChannelsSettings() {
29187
30059
  return settings;
29188
30060
  }, [isSettingEnabled]);
29189
30061
  }
29190
- var TrustedFieldsProvider = /* @__PURE__ */ ((TrustedFieldsProvider2) => {
29191
- TrustedFieldsProvider2["SINGPASS"] = "singpass";
29192
- TrustedFieldsProvider2["KOMPANY"] = "kompany";
29193
- return TrustedFieldsProvider2;
29194
- })(TrustedFieldsProvider || {});
29195
30062
  const downloadFile = async (base64, filename) => {
29196
30063
  saveBlobAsFile(base64ToBlob(base64), filename);
29197
30064
  };
@@ -29484,7 +30351,7 @@ function AccountSetupRejected() {
29484
30351
  const content = jsxs("div", {
29485
30352
  children: [jsx(AlertIcon, {
29486
30353
  className: "adyen-kyc-alert-error-icon",
29487
- type: AlertTypes.ERROR
30354
+ type: "error"
29488
30355
  }), jsx(FormHeader, {
29489
30356
  heading: i18n.get("cantSetUpAcccount")
29490
30357
  }), jsx("span", {
@@ -29927,15 +30794,6 @@ const iconStatus = (current, min, max) => {
29927
30794
  return isWithinConditionalRange ? "conditionalFinished" : "conditionalEmpty";
29928
30795
  };
29929
30796
  const getEntityStatusRuleDescription = (country2, currentTask, entityLabel) => currentTask === TaskTypes.TRUST_MEMBER_OVERVIEW ? TRUST_DEFAULT_DESCRIPTIONS_MAP[entityLabel] : getDecisionMakerDescriptionMap(country2)[entityLabel];
29930
- function CardGroup({
29931
- className,
29932
- children
29933
- }) {
29934
- return jsx("section", {
29935
- className: cx("adyen-kyc-card-group", className),
29936
- children
29937
- });
29938
- }
29939
30797
  const Status = ({
29940
30798
  text,
29941
30799
  className,
@@ -30084,7 +30942,7 @@ const VerificationErrorAlert = ({
30084
30942
  return jsx(Alert, {
30085
30943
  className,
30086
30944
  hasCloseButton: false,
30087
- type: AlertTypes.ERROR,
30945
+ type: "error",
30088
30946
  title: `${childErrorMsg}. ${remediationActionMsg}`,
30089
30947
  children
30090
30948
  });
@@ -30094,66 +30952,11 @@ const VerificationErrorAlert = ({
30094
30952
  return jsx(Alert, {
30095
30953
  className,
30096
30954
  hasCloseButton: false,
30097
- type: AlertTypes.ERROR,
30955
+ type: "error",
30098
30956
  title: i18n.get("verificationErrorMessage"),
30099
30957
  children
30100
30958
  });
30101
30959
  };
30102
- function Card({
30103
- className,
30104
- children,
30105
- stateful,
30106
- active,
30107
- disabled,
30108
- warning,
30109
- warningMessage,
30110
- title,
30111
- subTitle,
30112
- onClick,
30113
- onKeyDown
30114
- }) {
30115
- const classNames = cx("adyen-kyc-card", className, {
30116
- "adyen-kyc-card--stateful": stateful,
30117
- "adyen-kyc-card--active": stateful && active,
30118
- "adyen-kyc-card--disabled": disabled
30119
- });
30120
- const tabIndex = stateful ? 0 : void 0;
30121
- const role2 = stateful ? "button" : void 0;
30122
- const onClickHandler = (e) => {
30123
- if (disabled) {
30124
- return;
30125
- }
30126
- onClick == null ? void 0 : onClick(e);
30127
- };
30128
- return jsxs("article", {
30129
- className: classNames,
30130
- tabIndex,
30131
- role: role2,
30132
- onClick: onClickHandler,
30133
- onKeyDown,
30134
- children: [title && jsxs("header", {
30135
- className: "adyen-kyc-card__header",
30136
- children: [jsx(Typography, {
30137
- el: "h4",
30138
- variant: "title",
30139
- children: title
30140
- }), subTitle && jsx(Typography, {
30141
- el: "p",
30142
- variant: "body",
30143
- children: subTitle
30144
- })]
30145
- }), jsx("div", {
30146
- role: "region",
30147
- className: "adyen-kyc-card__body",
30148
- children
30149
- }), warning && jsx(Alert, {
30150
- className: "adyen-kyc-card__warning",
30151
- title: warningMessage,
30152
- hasCloseButton: false,
30153
- type: AlertTypes.WARNING
30154
- })]
30155
- });
30156
- }
30157
30960
  function useClickAwayListener(ref, onClickAway) {
30158
30961
  const handleClickAway = useCallback((event) => {
30159
30962
  if (ref.current && !ref.current.contains(event.target)) {
@@ -30541,7 +31344,7 @@ const DecisionMakersComponent = ({
30541
31344
  }
30542
31345
  });
30543
31346
  showToast({
30544
- type: "error",
31347
+ type: "success",
30545
31348
  label: i18n.get("successFullyRemovedDecisionMaker")
30546
31349
  });
30547
31350
  } catch (e) {
@@ -30591,7 +31394,7 @@ const DecisionMakersComponent = ({
30591
31394
  className: "adyen-kyc-decision-makers__warning",
30592
31395
  title: remediationMessages.DECISION_MAKER,
30593
31396
  hasCloseButton: false,
30594
- type: AlertTypes.WARNING
31397
+ type: "warning"
30595
31398
  }), (uniqueDecisionMakers == null ? void 0 : uniqueDecisionMakers.length) > 0 ? jsx(CardGroup, {
30596
31399
  children: uniqueDecisionMakers.map((decisionMaker2) => jsx(EntityAssociation, {
30597
31400
  types: decisionMaker2.types,
@@ -31389,7 +32192,6 @@ const TaskListItem = ({
31389
32192
  handleIsRemoveDisabled
31390
32193
  })
31391
32194
  }) : jsx(Icon, {
31392
- className: "adyen-kyc-u-color-grey-60",
31393
32195
  name: "chevron-right"
31394
32196
  })]
31395
32197
  })]
@@ -31668,7 +32470,7 @@ function TaskListComponent({
31668
32470
  disabled: !canAddPayoutAccount,
31669
32471
  children: [jsx(Icon, {
31670
32472
  name: "plus",
31671
- className: "adyen-kyc-u-padding-top-2 adyen-kyc-u-margin-right-8"
32473
+ className: "adyen-task-list__card-icon "
31672
32474
  }), jsx("span", {
31673
32475
  children: isEnableNewEntryFlowEnabled ? i18n.get("addExtraBankAccount") : i18n.get(hasPayinTaskNotPayout ? "addExtraPayinAccount" : "addExtraPayoutAccount")
31674
32476
  })]
@@ -31763,7 +32565,7 @@ const CompanyTrustMemberTaskItem = ({
31763
32565
  })
31764
32566
  }];
31765
32567
  const infoContent = companyTrustMember.ownerId ? void 0 : jsx(Alert, {
31766
- type: AlertTypes.BASIC,
32568
+ type: "basic",
31767
32569
  hasCloseButton: false,
31768
32570
  title: jsxs(Fragment, {
31769
32571
  children: [i18n.get("helpUsVerifyCompany"), " ", jsx(Link, {
@@ -32060,27 +32862,11 @@ const isNotEmptyBirthDateValidatorRule = {
32060
32862
  const isNotOutOfRangeBirthDateValidatorRule = {
32061
32863
  modes: ["blur"],
32062
32864
  validate: (birthDate2) => !isEmpty(birthDate2) && new Date(birthDate2) < /* @__PURE__ */ new Date(),
32063
- errorMessage: "fieldIsRequired"
32865
+ errorMessage: "invalidDateOfBirth"
32064
32866
  };
32065
- const getAgeToday = (birthdate2) => {
32066
- const today = /* @__PURE__ */ new Date();
32067
- const todayMonth = today.getMonth();
32068
- const todayDay = today.getDate();
32069
- const bdDate = new Date(birthdate2);
32070
- const bdMonth = bdDate.getMonth();
32071
- const yearDifference = today.getFullYear() - bdDate.getFullYear();
32072
- if (todayMonth > bdMonth) {
32073
- return yearDifference;
32074
- }
32075
- if (todayMonth === bdMonth && todayDay >= bdDate.getUTCDate()) {
32076
- return yearDifference;
32077
- }
32078
- return yearDifference - 1;
32079
- };
32080
- const isAgeAtLeastXYearsOld = (age, x) => age >= x;
32081
32867
  const buildMinimumAgeValidationRule = (minimumAge) => ({
32082
32868
  modes: ["blur"],
32083
- validate: (birthDate2) => !!birthDate2 && isAgeAtLeastXYearsOld(getAgeToday(birthDate2), minimumAge),
32869
+ validate: (birthDate2) => !!birthDate2 && getAgeToday(birthDate2) >= minimumAge,
32084
32870
  errorMessage: {
32085
32871
  key: "youMustXYearsOldToContinue",
32086
32872
  values: {
@@ -32092,7 +32878,7 @@ const getCountrySpecificMinimumAgeValidationRule = (country2) => {
32092
32878
  if (!country2) {
32093
32879
  return buildMinimumAgeValidationRule(13);
32094
32880
  }
32095
- if (eeaCountries.some((c) => c === country2)) {
32881
+ if ([...euCountries, CountryCodes.UnitedKingdom, CountryCodes.Switzerland].some((c) => c === country2)) {
32096
32882
  return buildMinimumAgeValidationRule(16);
32097
32883
  }
32098
32884
  switch (country2) {
@@ -32159,8 +32945,12 @@ function IndividualDropinComponent({
32159
32945
  var _a, _b, _c, _d;
32160
32946
  const {
32161
32947
  accountHolder: accountHolder2,
32162
- setAccountHolder
32948
+ setAccountHolder,
32949
+ idVerificationProviderId
32163
32950
  } = useCoreContext();
32951
+ const {
32952
+ isEmbeddedDropin
32953
+ } = useAuthContext();
32164
32954
  const {
32165
32955
  i18n
32166
32956
  } = useI18nContext();
@@ -32314,6 +33104,10 @@ function IndividualDropinComponent({
32314
33104
  };
32315
33105
  const handleInstantIdVerificationStartCheck = async (onfidoResponse, legalEntityId) => {
32316
33106
  const data2 = {
33107
+ // providerId is not required in HO as this is already present in the startCheck endpoint
33108
+ ...isEmbeddedDropin && {
33109
+ providerId: idVerificationProviderId
33110
+ },
32317
33111
  legalEntityId,
32318
33112
  captureMetadata: onfidoResponse
32319
33113
  };
@@ -32604,21 +33398,26 @@ function IndividualDropinComponent({
32604
33398
  })
32605
33399
  });
32606
33400
  }
33401
+ const logger$g = createLogger("useBankConfigurationHandler");
32607
33402
  const useBankConfigurationHandlers = ({
32608
33403
  isEmbeddedDropin,
32609
33404
  handleGetBankVerificationVendors,
32610
33405
  bankAccountCountry,
32611
33406
  getConfiguration: getConfiguration2,
32612
33407
  legalEntityType,
32613
- capabilities
33408
+ capabilities,
33409
+ setLoadingStatus
32614
33410
  }) => {
32615
33411
  const [bankVerificationVendorsResponse, setBankVerificationVendorsResponse] = useState();
32616
33412
  const callBankVerificationVendorsUpfront = isEmbeddedDropin && handleGetBankVerificationVendors;
32617
33413
  useEffect(() => {
33414
+ setLoadingStatus("loading");
32618
33415
  (async () => {
32619
33416
  const bankVerificationVendorsResponse2 = callBankVerificationVendorsUpfront ? await handleGetBankVerificationVendors(bankAccountCountry) : [];
32620
33417
  setBankVerificationVendorsResponse(bankVerificationVendorsResponse2);
32621
- })();
33418
+ })().catch(logger$g.error).finally(() => {
33419
+ setLoadingStatus("success");
33420
+ });
32622
33421
  }, [bankAccountCountry]);
32623
33422
  const getConfigurationData = useCallback(async () => {
32624
33423
  var _a;
@@ -32798,6 +33597,8 @@ function PayoutDetailsDropinComponent({
32798
33597
  const [skipSubmit, setSkipSubmit] = useState(false);
32799
33598
  const [hideOnHomeButton, setHideHomeButton] = useState(false);
32800
33599
  const [loadingStatus, setLoadingStatus] = useState("success");
33600
+ const [configurationLoadingStatus, setConfigurationLoadingStatus] = useState("success");
33601
+ const [bankVendorsLoadingStatus, setBankVendorsLoadingStatus] = useState("success");
32801
33602
  const [data, setData] = useState(prefilledData);
32802
33603
  const [problems, setProblems] = useState(propProblems || ((transferInstrument == null ? void 0 : transferInstrument.id) ? (_e = (_d = getCapabilityProblems(legalEntityResponse, bankAccountCountry)) == null ? void 0 : _d.BankAccount) == null ? void 0 : _e[transferInstrument.id] : void 0));
32803
33604
  const [accountDetailsFromInput, setAccountDetailsFromInput] = useState(prefilledData.payoutAccountDetails);
@@ -32834,7 +33635,8 @@ function PayoutDetailsDropinComponent({
32834
33635
  bankAccountCountry,
32835
33636
  getConfiguration: getConfiguration2,
32836
33637
  legalEntityType: legalEntityResponse.type,
32837
- capabilities
33638
+ capabilities,
33639
+ setLoadingStatus: setConfigurationLoadingStatus
32838
33640
  });
32839
33641
  const getPayoutAccountFormatData = useCallback(async () => getAccountFormatsForCountry(bankAccountCountry), [bankAccountCountry]);
32840
33642
  const {
@@ -32846,7 +33648,7 @@ function PayoutDetailsDropinComponent({
32846
33648
  getConfigurationData,
32847
33649
  getPayoutAccountFormatData,
32848
33650
  instantVerificationEnabled,
32849
- setLoadingStatus,
33651
+ setLoadingStatus: setBankVendorsLoadingStatus,
32850
33652
  country: bankAccountCountry,
32851
33653
  existingBankAccountFormat
32852
33654
  });
@@ -32866,6 +33668,7 @@ function PayoutDetailsDropinComponent({
32866
33668
  }), isSettingEnabled(SettingNames.AllowIntraRegionCrossBorderPayout), isExperimentEnabled("EnableNewEntryFlow"));
32867
33669
  }, [bankVerificationVendors]);
32868
33670
  const derivedProps = useMemo(() => getPropsFromConfigurations(fieldConfigurations, payoutDetailsSteps, (problems == null ? void 0 : problems.remediationActions) ? Object.values(problems == null ? void 0 : problems.remediationActions) : [], (problems == null ? void 0 : problems.missingData) ?? [], [], fieldsFromCustomRules, fieldsFormCustomLabels), [fieldConfigurations, fieldsFromCustomRules, problems == null ? void 0 : problems.remediationActions]);
33671
+ useUnifyLoadingStatus(setLoadingStatus, configurationLoadingStatus, bankVendorsLoadingStatus);
32869
33672
  const forms2 = useMemo(() => {
32870
33673
  const requiredForms = getRequiredForms(payoutDetailsSteps, derivedProps == null ? void 0 : derivedProps.requiredFields, derivedProps == null ? void 0 : derivedProps.optionalFields);
32871
33674
  return addValidityToForms(requiredForms, formValidity, problems);
@@ -35058,6 +35861,17 @@ const useNavigation = ({
35058
35861
  setTaskHistory(taskHistory.slice(0, -1 * stepCount));
35059
35862
  onNavigate == null ? void 0 : onNavigate(prevTask);
35060
35863
  }, [taskHistory, onNavigate]);
35864
+ useEffect(() => {
35865
+ if (!window.history.state) window.history.pushState({}, "");
35866
+ const handleBrowserBackButton = () => {
35867
+ if (window.history.state === null) window.history.pushState({}, "");
35868
+ navigateTo(TaskTypes.TASKS_OVERVIEW);
35869
+ };
35870
+ window.addEventListener("popstate", handleBrowserBackButton);
35871
+ return () => {
35872
+ window.removeEventListener("popstate", handleBrowserBackButton);
35873
+ };
35874
+ }, [navigateTo]);
35061
35875
  useEffect(() => {
35062
35876
  const pushedTask = taskHistory.at(-1);
35063
35877
  if (pushedTask === "default") {
@@ -36419,6 +37233,22 @@ const acceptServiceAgreement = async (context, termsOfServiceDocumentId, data) =
36419
37233
  termsOfServiceDocumentId
36420
37234
  });
36421
37235
  };
37236
+ const confirmDataReview = async (context) => {
37237
+ const {
37238
+ loadingContext,
37239
+ legalEntityId
37240
+ } = context;
37241
+ return httpPost({
37242
+ loadingContext,
37243
+ errorLevel: "warn",
37244
+ errorMessage: `Failed to confirm data review`,
37245
+ path: `${legalEntityId}/confirmDataReview`,
37246
+ authentication: "jwt",
37247
+ headers: {
37248
+ "Content-Type": "application/json"
37249
+ }
37250
+ });
37251
+ };
36422
37252
  const createTrustedTransferInstrument = async (context, code2, state2) => {
36423
37253
  const {
36424
37254
  loadingContext,
@@ -36487,6 +37317,22 @@ const generateOnboardingLink = async (context, config) => {
36487
37317
  }
36488
37318
  }, config);
36489
37319
  };
37320
+ const getAcceptedServiceAgreement = async (context, termsOfServiceAcceptanceReference, documentFormat) => {
37321
+ const {
37322
+ loadingContext,
37323
+ legalEntityId
37324
+ } = context;
37325
+ return httpGet({
37326
+ loadingContext,
37327
+ errorLevel: "warn",
37328
+ errorMessage: `Failed to get service agreement`,
37329
+ path: `${legalEntityId}/termsOfService/acceptedTermsOfServiceDocument/${termsOfServiceAcceptanceReference}?documentformat=${documentFormat} `,
37330
+ authentication: "jwt",
37331
+ headers: {
37332
+ "Content-Type": "application/json"
37333
+ }
37334
+ });
37335
+ };
36490
37336
  const getAddress = async (context, addressId) => {
36491
37337
  const {
36492
37338
  loadingContext,
@@ -36773,7 +37619,23 @@ const useComponentApi = (rootLegalEntityId) => {
36773
37619
  acceptServiceAgreement: async (legalEntityId, termsOfServiceDocumentId, data) => acceptServiceAgreement({
36774
37620
  ...baseRequestContext,
36775
37621
  legalEntityId
36776
- }, termsOfServiceDocumentId, data)
37622
+ }, termsOfServiceDocumentId, data),
37623
+ getAcceptedServiceAgreement: async (legalEntityId, termsOfServiceAcceptanceReference) => getAcceptedServiceAgreement({
37624
+ ...baseRequestContext,
37625
+ legalEntityId
37626
+ }, termsOfServiceAcceptanceReference, "JSON"),
37627
+ downloadAcceptedServiceAgreement: async (legalEntityId, termsOfServiceAcceptanceReference) => getAcceptedServiceAgreement({
37628
+ ...baseRequestContext,
37629
+ legalEntityId
37630
+ }, termsOfServiceAcceptanceReference, "PDF"),
37631
+ downloadUnacceptedServiceAgreement: async (legalEntityId, serviceAgreementRequest) => getServiceAgreement({
37632
+ ...baseRequestContext,
37633
+ legalEntityId
37634
+ }, serviceAgreementRequest),
37635
+ confirmDataReview: async (legalEntityId) => confirmDataReview({
37636
+ ...baseRequestContext,
37637
+ legalEntityId
37638
+ })
36777
37639
  };
36778
37640
  }, [base, rootLegalEntityId]);
36779
37641
  };
@@ -37251,7 +38113,11 @@ function OnboardingDropinComponent({
37251
38113
  getServiceAgreementStatus: getServiceAgreementStatus2,
37252
38114
  getServiceAgreement: getServiceAgreement2,
37253
38115
  acceptServiceAgreement: acceptServiceAgreement2,
37254
- getBankVerificationVendor: getBankVerificationVendor2
38116
+ getAcceptedServiceAgreement: getAcceptedServiceAgreement2,
38117
+ downloadAcceptedServiceAgreement,
38118
+ downloadUnacceptedServiceAgreement,
38119
+ getBankVerificationVendor: getBankVerificationVendor2,
38120
+ confirmDataReview: confirmDataReview2
37255
38121
  } = useComponentApi(legalEntityId);
37256
38122
  const [legalEntity, setLegalEntity] = useState();
37257
38123
  const [loadingStatus, setLoadingStatus] = useState("loading");
@@ -37291,12 +38157,16 @@ function OnboardingDropinComponent({
37291
38157
  handleGetServiceAgreementStatus: getServiceAgreementStatus2,
37292
38158
  handleGetServiceAgreement: getServiceAgreement2,
37293
38159
  handleSignServiceAgreement: acceptServiceAgreement2,
38160
+ handleViewAcceptedTermsOfServiceDocument: getAcceptedServiceAgreement2,
38161
+ handleDownloadAcceptedTermsOfServiceDocument: downloadAcceptedServiceAgreement,
38162
+ handleDownloadUnacceptedTermsOfServiceDocument: downloadUnacceptedServiceAgreement,
37294
38163
  handleCreateTransferInstrument: createTransferInstrument2,
37295
38164
  handleGetTransferInstrument: getTransferInstrument2,
37296
38165
  handleDeleteTransferInstrument: deleteTransferInstrument2,
37297
38166
  handleUpdateTransferInstrument: updateTransferInstrument2,
37298
38167
  handleCreateTrustedTransferInstrument: createTrustedTransferInstrument2,
37299
- handleGetBankVerificationVendors: (country2) => getBankVerificationVendor2(country2, openBankingPartnerConfigId)
38168
+ handleGetBankVerificationVendors: (country2) => getBankVerificationVendor2(country2, openBankingPartnerConfigId),
38169
+ handleReviewConfirm: confirmDataReview2
37300
38170
  });
37301
38171
  }
37302
38172
  var HighExposurePagesEnums = /* @__PURE__ */ ((HighExposurePagesEnums2) => {
@@ -37336,7 +38206,7 @@ const highExposureCompanyDetailsValidations = {
37336
38206
  },
37337
38207
  legalForm: {
37338
38208
  modes: ["blur"],
37339
- validate: (legalForm) => !isEmpty(legalForm),
38209
+ validate: (legalForm2) => !isEmpty(legalForm2),
37340
38210
  errorMessage: "fieldIsRequired"
37341
38211
  },
37342
38212
  naceCode: {
@@ -38460,7 +39330,7 @@ function ViewVerificationStatusComponent({
38460
39330
  return jsx(Alert, {
38461
39331
  title: i18n.get(alertContent),
38462
39332
  hasCloseButton: false,
38463
- type: AlertTypes.ERROR
39333
+ type: "error"
38464
39334
  });
38465
39335
  }
38466
39336
  if (content) {
@@ -38963,7 +39833,7 @@ const ConfigurationApiProvider = ({
38963
39833
  isEmbeddedDropin,
38964
39834
  loadingContext
38965
39835
  } = authContext;
38966
- const sdkVersion = "3.21.4";
39836
+ const sdkVersion = "3.22.0";
38967
39837
  useAnalytics({
38968
39838
  onUserEvent,
38969
39839
  legalEntityId: rootLegalEntityId,
@@ -39006,6 +39876,7 @@ const CoreProvider = ({
39006
39876
  setAccountHolder
39007
39877
  } = useAccountHolder(rootLegalEntityId);
39008
39878
  const [accountFormat, setAccountFormat] = useState("local");
39879
+ const [idVerificationProviderId, setIdVerificationProviderId] = useState();
39009
39880
  const allowedCountries = useAllowedCountries();
39010
39881
  const isCountryAllowed = (allowedCountries == null ? void 0 : allowedCountries.includes(contextCountry)) ?? true;
39011
39882
  useEffect(() => {
@@ -39023,8 +39894,10 @@ const CoreProvider = ({
39023
39894
  setAccountHolder,
39024
39895
  accountHolder: accountHolder2,
39025
39896
  setAccountFormat,
39026
- accountFormat
39027
- }), [contextCountry, accountHolder2, accountFormat]);
39897
+ accountFormat,
39898
+ idVerificationProviderId,
39899
+ setIdVerificationProviderId
39900
+ }), [contextCountry, accountHolder2, accountFormat, idVerificationProviderId]);
39028
39901
  return jsx(CoreContext.Provider, {
39029
39902
  value: contextValue,
39030
39903
  children
@@ -39378,7 +40251,7 @@ const Toast = ({
39378
40251
  "aria-labelledby": labelId,
39379
40252
  children: [isLoading && jsx("div", {
39380
40253
  className: "adyen-kyc-toast__loader",
39381
- children: jsx(Spinner, {
40254
+ children: jsx(Loader, {
39382
40255
  size: "small"
39383
40256
  })
39384
40257
  }), jsxs("div", {
@@ -39578,10 +40451,10 @@ class UIElement extends BaseElement {
39578
40451
  refreshExpiry: this.props.refreshExpiry,
39579
40452
  eventEmitter: this.eventEmitter,
39580
40453
  children: jsx("div", {
39581
- className: "adyen-kyc-u-width-full",
40454
+ className: "adyen-kyc-ui-element-container-wrapper",
39582
40455
  children: jsx(AutoResizer, {
39583
40456
  children: jsx("div", {
39584
- className: "adyen-kyc-dropin-container adyen-kyc-u-position-relative",
40457
+ className: "adyen-kyc-ui-element-container",
39585
40458
  children: jsx(ToastContextProvider, {
39586
40459
  children: jsx(StateProvider, {
39587
40460
  children: jsx(Component, {