@adyen/kyc-components 3.21.5 → 3.22.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/dist/es/adyen-kyc-components.es.js +1731 -934
  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 +382 -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/FieldContainer.d.ts +1 -0
  33. package/dist/types/components/internal/Address/components/SearchAddress.d.ts +1 -1
  34. package/dist/types/components/internal/Address/types.d.ts +3 -0
  35. package/dist/types/components/internal/Alert/Alert.d.ts +1 -1
  36. package/dist/types/components/internal/Alert/types.d.ts +4 -7
  37. package/dist/types/components/internal/Card/Card.d.ts +1 -1
  38. package/dist/types/components/internal/Card/CardGroup.d.ts +1 -1
  39. package/dist/types/components/internal/Card/index.d.ts +2 -0
  40. package/dist/types/components/internal/Card/types.d.ts +2 -0
  41. package/dist/types/components/internal/DBANameField/DBANameField.d.ts +1 -1
  42. package/dist/types/components/internal/DBANameField/fieldConfig.d.ts +1 -0
  43. package/dist/types/components/internal/DBANameField/types.d.ts +1 -1
  44. package/dist/types/components/internal/Icon/Icon.d.ts +1 -0
  45. package/dist/types/components/internal/Link/Link.d.ts +1 -1
  46. package/dist/types/components/internal/Link/types.d.ts +0 -3
  47. package/dist/types/components/internal/Loader/Loader.d.ts +7 -9
  48. package/dist/types/components/internal/LoaderWrapper/LoaderWrapper.d.ts +1 -2
  49. package/dist/types/core/core.d.ts +1 -1
  50. package/dist/types/core/hooks/useBankConfigurationHandlers.d.ts +3 -1
  51. package/dist/types/core/hooks/useForm/reducer.d.ts +4 -2
  52. package/dist/types/core/hooks/useForm/types.d.ts +11 -0
  53. package/dist/types/core/hooks/useForm/useForm.d.ts +2 -1
  54. package/dist/types/core/hooks/useUnifyLoadingStatus.d.ts +2 -0
  55. package/dist/types/core/models/api/company-search.d.ts +1 -0
  56. package/dist/types/core/models/api/organization.d.ts +1 -0
  57. package/dist/types/core/models/country-code.d.ts +1 -0
  58. package/dist/types/core/process-field-configurations.d.ts +3 -2
  59. package/dist/types/utils/birth-date-utils.d.ts +11 -0
  60. package/dist/types/utils/mapping/componentApiMapping.d.ts +1 -0
  61. package/dist/types/utils/regex/patternValidators.d.ts +1 -1
  62. package/dist/types/utils/testing/IgnoreLocalStorage.d.ts +5 -0
  63. package/package.json +13 -1
  64. package/dist/types/components/UIElement.d.ts +0 -22
  65. package/dist/types/components/internal/Loader/index.d.ts +0 -2
  66. 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;
@@ -12590,7 +12646,7 @@ function FieldContainer(props) {
12590
12646
  },
12591
12647
  readonly: readOnly,
12592
12648
  classNameModifiers,
12593
- className: hideField ? "adyen-kyc-u-display-none" : "",
12649
+ className: hideField ? "adyen-kyc-search-fieldcontainer-hide" : "",
12594
12650
  handleChangeFor
12595
12651
  });
12596
12652
  case "stateOrProvince":
@@ -12638,7 +12694,7 @@ function FieldContainer(props) {
12638
12694
  };
12639
12695
  if (hideField) {
12640
12696
  return jsx("div", {
12641
- className: "adyen-kyc-u-display-none",
12697
+ className: "adyen-kyc-search-fieldcontainer-hide",
12642
12698
  children: renderField(fieldName)
12643
12699
  });
12644
12700
  }
@@ -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",
@@ -15580,7 +15665,7 @@ const LoaderWrapper = ({
15580
15665
  const wrapperClass = cx("adyen-kyc-loading-input__form", styles$1["adyen-kyc-loading-input__form"], {
15581
15666
  [styles$1[`adyen-kyc-loading-input__form--loading-opacity${opacity}`]]: status === "loading"
15582
15667
  });
15583
- const loaderClass = cx({
15668
+ const loaderWrapperClass = cx({
15584
15669
  [styles$1["adyen-kyc-loading-input__loader"]]: true,
15585
15670
  [styles$1["adyen-kyc-loading-input__loader--active"]]: status === "loading" && showSpinner
15586
15671
  });
@@ -15591,7 +15676,7 @@ const LoaderWrapper = ({
15591
15676
  position: "relative"
15592
15677
  },
15593
15678
  children: [jsx("div", {
15594
- className: loaderClass,
15679
+ className: loaderWrapperClass,
15595
15680
  children: jsx(Loader, {
15596
15681
  size: loaderSize
15597
15682
  })
@@ -15651,7 +15736,7 @@ const initOnfido = async ({
15651
15736
  language: getOnfidoLocaleConfig(i18n)
15652
15737
  });
15653
15738
  };
15654
- const logger$t = createLogger("IdVerificationComponent");
15739
+ const logger$v = createLogger("IdVerificationComponent");
15655
15740
  function IdVerificationComponent({
15656
15741
  userDetails,
15657
15742
  legalEntityId,
@@ -15688,7 +15773,7 @@ function IdVerificationComponent({
15688
15773
  onIdVerificationError,
15689
15774
  onIdVerificationComplete
15690
15775
  });
15691
- })().catch(logger$t.error);
15776
+ })().catch(logger$v.error);
15692
15777
  return () => {
15693
15778
  if (onfidoSdk.current) onfidoSdk.current.tearDown();
15694
15779
  };
@@ -15738,7 +15823,7 @@ function IdDocumentAlreadyUpload(props) {
15738
15823
  })]
15739
15824
  });
15740
15825
  }
15741
- const logger$s = createLogger("IdDocumentInstantVerificationComponent");
15826
+ const logger$u = createLogger("IdDocumentInstantVerificationComponent");
15742
15827
  const idVerificationSchema = ["instantIdVerificationData", "idDocumentType"];
15743
15828
  const documentTypeValidationRules = {
15744
15829
  instantIdVerificationData: {
@@ -15820,7 +15905,7 @@ function IdDocumentInstantVerificationComponent(props) {
15820
15905
  userDetails: props.userDetails,
15821
15906
  legalEntityId: props.legalEntityId,
15822
15907
  onIdVerificationComplete: handleIdVerificationComplete,
15823
- onIdVerificationError: logger$s.error
15908
+ onIdVerificationError: logger$u.error
15824
15909
  }), jsxs("div", {
15825
15910
  className: "adyen-kyc-document-upload__manual-upload",
15826
15911
  children: [i18n.get("canNotCompleteInstantVerification"), " ", jsx("button", {
@@ -16096,6 +16181,68 @@ function IdVerificationMethodComponent(props) {
16096
16181
  })]
16097
16182
  });
16098
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
+ };
16099
16246
  const COUNTRY_ID_NUMBER_MASKS = {
16100
16247
  [CountryCodes.PuertoRico]: {
16101
16248
  length: 4
@@ -18047,6 +18194,10 @@ function PersonalDetailsComponent(props) {
18047
18194
  } = useSettingsContext();
18048
18195
  const allowedCountries = useAllowedCountries();
18049
18196
  const isNewEntryFlowEnabled = useEnableNewEntryFlow();
18197
+ const {
18198
+ isExperimentEnabled
18199
+ } = useExperimentsContext();
18200
+ const isAgeVerificationEnabled = isExperimentEnabled("EnableAgeVerification");
18050
18201
  const PERSONAL_DETAILS = props.id;
18051
18202
  const {
18052
18203
  residencyCountry: residencyCountry2
@@ -18164,6 +18315,28 @@ function PersonalDetailsComponent(props) {
18164
18315
  useEffect(() => {
18165
18316
  triggerValidation();
18166
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();
18167
18340
  return jsxs(LoaderWrapper, {
18168
18341
  status,
18169
18342
  formOpacityWhenLoading: 0.3,
@@ -18198,11 +18371,12 @@ function PersonalDetailsComponent(props) {
18198
18371
  }), hasRequiredFields(nameProps) && jsx(Name, {
18199
18372
  ...nameProps,
18200
18373
  dataStoreId: PERSONAL_DETAILS
18201
- }), 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, {
18202
18376
  name: "birthDate",
18203
18377
  label: formUtils.getLabel("birthDate"),
18204
18378
  classNameModifiers: ["birthDate"],
18205
- errorMessage: formUtils.getErrorMessage("birthDate", errors, fieldProblems),
18379
+ errorMessage: isAgeVerificationEnabled && birthDateErrorMessage ? true : birthDateErrorMessage,
18206
18380
  isValid: valid.birthDate,
18207
18381
  children: (childProps) => jsx(InputDate, {
18208
18382
  ...childProps,
@@ -18234,6 +18408,29 @@ function PersonalDetailsComponent(props) {
18234
18408
  allowedCountries: isTopLevelEntity ? allowedCountries : void 0,
18235
18409
  classNameModifiers: ["country"],
18236
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
+ })]
18237
18434
  }), jsx(IndividualIdNumberTypeSelector, {
18238
18435
  country: data.residencyCountry,
18239
18436
  setSelected: setIdNumberType,
@@ -19150,6 +19347,7 @@ const ActionBar = ({
19150
19347
  nextButtonLabel,
19151
19348
  hideOnHomeButton,
19152
19349
  hideBackButton,
19350
+ hideNextButton,
19153
19351
  nextButtonDisabled = false
19154
19352
  }) => jsxs("div", {
19155
19353
  className: "adyen-action-bar",
@@ -19161,7 +19359,7 @@ const ActionBar = ({
19161
19359
  secondary: true,
19162
19360
  onClick: () => onBack(),
19163
19361
  testId: "backBtn"
19164
- }), onNext && jsx(Button, {
19362
+ }), onNext && !hideNextButton && jsx(Button, {
19165
19363
  label: nextButtonLabel,
19166
19364
  className: "adyen-action-bar__button",
19167
19365
  onClick: onNext,
@@ -19300,7 +19498,7 @@ class AdyenKycSdkError extends Error {
19300
19498
  }
19301
19499
  let sdkToken;
19302
19500
  let fetchSdkToken;
19303
- const logger$r = createLogger("Session");
19501
+ const logger$t = createLogger("Session");
19304
19502
  const setSdkToken = (token) => {
19305
19503
  sdkToken = token;
19306
19504
  };
@@ -19323,7 +19521,7 @@ const refreshSession = async () => {
19323
19521
  setSdkToken(token);
19324
19522
  isSessionRefreshed = true;
19325
19523
  } catch (e) {
19326
- logger$r.error("Failed to fetch sdk token", e);
19524
+ logger$t.error("Failed to fetch sdk token", e);
19327
19525
  }
19328
19526
  return isSessionRefreshed;
19329
19527
  };
@@ -19333,7 +19531,7 @@ const addAnimationStartListener = (element, listener) => {
19333
19531
  const removeAnimationStartListener = (element, listener) => {
19334
19532
  element.removeEventListener("animationstart", listener, false);
19335
19533
  };
19336
- const logger$q = createLogger("Fetch");
19534
+ const logger$s = createLogger("Fetch");
19337
19535
  const getRequestObject = (options, data) => {
19338
19536
  const {
19339
19537
  headers = [],
@@ -19380,10 +19578,10 @@ const logFetchError = (message, level) => {
19380
19578
  case "info":
19381
19579
  case "warn":
19382
19580
  case "error":
19383
- logger$q[level](message);
19581
+ logger$s[level](message);
19384
19582
  break;
19385
19583
  default:
19386
- logger$q.error(message);
19584
+ logger$s.error(message);
19387
19585
  }
19388
19586
  };
19389
19587
  const handleFetchResponse = async (response, responseType) => {
@@ -19481,7 +19679,7 @@ const RELEVANT_MESSAGE_TYPES = ["account_verification_report_id", "error"];
19481
19679
  const TERMINAL_DATA_PROPS = ["accounts", "error", "reference"];
19482
19680
  const MOUNT_TIMEOUT = 10 * 1e3;
19483
19681
  const TINK_VENDOR = "Tink";
19484
- const logger$p = createLogger("iframeWidget");
19682
+ const logger$r = createLogger("iframeWidget");
19485
19683
  const isObjectData = (data) => typeof data === "object" && !Array.isArray(data) && data !== null;
19486
19684
  const isTerminalMessageData = (data) => isObjectData(data) && Object.entries(data).some(([prop]) => TERMINAL_DATA_PROPS.includes(prop));
19487
19685
  const parseMessageJson = (message) => {
@@ -19499,7 +19697,7 @@ const callbackErrorHandler = async (response) => {
19499
19697
  try {
19500
19698
  await response;
19501
19699
  } catch (ex) {
19502
- logger$p.error(ex);
19700
+ logger$r.error(ex);
19503
19701
  }
19504
19702
  return {
19505
19703
  error: "UNKNOWN_ERROR",
@@ -19602,7 +19800,7 @@ class IFrameWidget {
19602
19800
  message = responseData.errorMessage;
19603
19801
  }
19604
19802
  } catch (ex) {
19605
- logger$p.error(ex);
19803
+ logger$r.error(ex);
19606
19804
  }
19607
19805
  throw new AdyenKycSdkError(reason, jsonData.error);
19608
19806
  }
@@ -19789,7 +19987,7 @@ function BankVerificationWidget({
19789
19987
  ref: widgetContainerRef
19790
19988
  });
19791
19989
  }
19792
- const logger$o = createLogger("BankVerification");
19990
+ const logger$q = createLogger("BankVerification");
19793
19991
  const accountVerificationFields = ["verifiedAccountHolder", "verifiedBankCountry", "verifiedBankName", "verifiedCurrencyCode", "verifiedBankAccountNumber"];
19794
19992
  const InstantVerificationErrorContext = createContext(null);
19795
19993
  const useInstantVerificationErrorNotification = (notificationVisibilityDuration) => {
@@ -19821,7 +20019,7 @@ const usePreferredVendorForCountry = (country2, getBankVerificationVendors) => {
19821
20019
  const vendor = vendors[0];
19822
20020
  setPreferredVendor(vendor.name ? vendor : void 0);
19823
20021
  };
19824
- getPreferredVendor().catch(logger$o.error);
20022
+ getPreferredVendor().catch(logger$q.error);
19825
20023
  }, [country2, getBankVerificationVendors]);
19826
20024
  return preferredVendor;
19827
20025
  };
@@ -21033,12 +21231,12 @@ function PayoutAccountComponent(props) {
21033
21231
  dataStoreId: id2
21034
21232
  }), shouldShowPayoutAlert(country2) && jsx(Alert, {
21035
21233
  hasCloseButton: false,
21036
- type: AlertTypes.BASIC,
21234
+ type: "basic",
21037
21235
  title: getSupportedCurrencyGuidance(i18n, country2, requiredFields)
21038
21236
  }), arePayoutAccountDetailsInvalid && jsx(Alert, {
21039
21237
  hasCloseButton: false,
21040
- className: "adl-u-margin-top-16",
21041
- type: AlertTypes.ERROR,
21238
+ className: "adyen-kyc-u-margin-top-16",
21239
+ type: "error",
21042
21240
  title: invalidFieldNames ? i18n.get("enterValid_", {
21043
21241
  values: {
21044
21242
  fieldNames: invalidFieldNames
@@ -21303,7 +21501,7 @@ function PayoutVerificationMethod(props) {
21303
21501
  children: [jsx(FormHeader, {
21304
21502
  heading: props.heading
21305
21503
  }), instantVerificationError && jsx(Alert, {
21306
- type: AlertTypes.ERROR,
21504
+ type: "error",
21307
21505
  className: "adyen-kyc-instant-verification-error",
21308
21506
  title: instantVerificationError.title,
21309
21507
  hasCloseButton: false,
@@ -23019,7 +23217,7 @@ function VerificationErrors({
23019
23217
  const defaultHeading = parentCode ? getErrorMessage(parentCode) : formUtils.getVal("correctErrorsResubmit");
23020
23218
  return jsx(Alert, {
23021
23219
  title: defaultHeading,
23022
- type: AlertTypes.ERROR,
23220
+ type: "error",
23023
23221
  hasCloseButton: false,
23024
23222
  children: verificationErrorMsg
23025
23223
  });
@@ -23124,13 +23322,13 @@ function Summary({
23124
23322
  children: renderSummaryItems(fieldData, labelData)
23125
23323
  }), jsx(Divider, {})]
23126
23324
  });
23127
- const renderSummaryContent = (data2) => {
23325
+ const renderSummaryContent = (summaryData) => {
23128
23326
  const summaryList = [];
23129
23327
  forms2.forEach(({
23130
23328
  formId,
23131
23329
  formName
23132
23330
  }) => {
23133
- const currentFormData = data2[formId];
23331
+ const currentFormData = summaryData[formId];
23134
23332
  const isFormEmpty = !currentFormData || Object.values(currentFormData).every((value) => isEmpty(value));
23135
23333
  if (isFormEmpty || formId === summaryStep.formId || omittedForms.includes(formId)) return;
23136
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);
@@ -23420,7 +23618,13 @@ const defaultPayoutAccountFormat = {
23420
23618
  [CountryCodes.Sweden]: "local",
23421
23619
  [CountryCodes.UnitedKingdom]: "local"
23422
23620
  };
23423
- 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");
23424
23628
  const useScenarioConfiguration = ({
23425
23629
  getConfigurationData,
23426
23630
  getPayoutAccountFormatData,
@@ -23436,23 +23640,26 @@ const useScenarioConfiguration = ({
23436
23640
  } = useCoreContext();
23437
23641
  const [configurationResponse, setConfigurationResponse] = useState();
23438
23642
  const [accountFormatResponse, setAccountFormatResponse] = useState();
23643
+ const [configurationLoadingStatus, setConfigurationLoadingStatus] = useState("success");
23644
+ const [payoutFormatLoadingStatus, setpayoutFormatLoadingStatus] = useState("success");
23645
+ useUnifyLoadingStatus(setLoadingStatus, configurationLoadingStatus, payoutFormatLoadingStatus);
23439
23646
  useEffect(() => {
23440
- setLoadingStatus("loading");
23647
+ setConfigurationLoadingStatus("loading");
23441
23648
  const makeConfigCallAndSave = async () => {
23442
23649
  try {
23443
23650
  const response = await getConfigurationData();
23444
23651
  setConfigurationResponse(response);
23445
23652
  } catch (err) {
23446
- logger$n.warn("WARNING: Configuration request failed - error:", err);
23653
+ logger$p.warn("WARNING: Configuration request failed - error:", err);
23447
23654
  } finally {
23448
- setLoadingStatus("success");
23655
+ setConfigurationLoadingStatus("success");
23449
23656
  }
23450
23657
  };
23451
- makeConfigCallAndSave().catch(logger$n.error);
23452
- }, [getConfigurationData, setLoadingStatus]);
23658
+ makeConfigCallAndSave().catch(logger$p.error);
23659
+ }, [getConfigurationData, setConfigurationLoadingStatus]);
23453
23660
  useEffect(() => {
23454
- setLoadingStatus("loading");
23455
23661
  if (!getPayoutAccountFormatData) return;
23662
+ setpayoutFormatLoadingStatus("loading");
23456
23663
  const makePayoutFormatCallAndSave = async () => {
23457
23664
  try {
23458
23665
  const response = await getPayoutAccountFormatData();
@@ -23465,13 +23672,13 @@ const useScenarioConfiguration = ({
23465
23672
  const defaultAccountFormat = defaultPayoutAccountFormat[country2] ?? allowedBankAccountFormats[0];
23466
23673
  setAccountFormat(existingBankAccountFormat ?? defaultAccountFormat);
23467
23674
  } catch (err) {
23468
- logger$n.warn("WARNING: Payout format request failed - error:", err);
23675
+ logger$p.warn("WARNING: Payout format request failed - error:", err);
23469
23676
  } finally {
23470
- setLoadingStatus("success");
23677
+ setpayoutFormatLoadingStatus("success");
23471
23678
  }
23472
23679
  };
23473
- makePayoutFormatCallAndSave().catch(logger$n.error);
23474
- }, [country2, setAccountFormat, getPayoutAccountFormatData, setLoadingStatus, existingBankAccountFormat]);
23680
+ makePayoutFormatCallAndSave().catch(logger$p.error);
23681
+ }, [country2, setAccountFormat, getPayoutAccountFormatData, setpayoutFormatLoadingStatus, existingBankAccountFormat]);
23475
23682
  const {
23476
23683
  fieldConfigurations,
23477
23684
  bankVerificationVendors,
@@ -23522,6 +23729,11 @@ const addLinkedFields = (fields) => {
23522
23729
  }
23523
23730
  return [...new Set(withLinkedFields)];
23524
23731
  };
23732
+ var TrustedFieldsProvider = /* @__PURE__ */ ((TrustedFieldsProvider2) => {
23733
+ TrustedFieldsProvider2["SINGPASS"] = "singpass";
23734
+ TrustedFieldsProvider2["KOMPANY"] = "kompany";
23735
+ return TrustedFieldsProvider2;
23736
+ })(TrustedFieldsProvider || {});
23525
23737
  const identityBase = {
23526
23738
  role: {
23527
23739
  rule: "REQUIRED"
@@ -23853,7 +24065,7 @@ const isFieldRequired = (fieldConfigurations, customRules) => {
23853
24065
  }
23854
24066
  return fieldConfigurations && ((fieldConfigurations == null ? void 0 : fieldConfigurations.rule) === "REQUIRED" || (customRules == null ? void 0 : customRules[fieldConfigurations.rule]) && customRules[fieldConfigurations.rule]() === "REQUIRED");
23855
24067
  };
23856
- function getPropsFromConfigurations(scenarioConfiguration, forms2, remediationActions, dataMissingErrors, fieldsWithExistingData, customRules = {}, customLabels2 = {}, customValidators = {}) {
24068
+ function getPropsFromConfigurations(scenarioConfiguration, forms2, remediationActions, dataMissingErrors, fieldsWithExistingData, customRules = {}, customLabels2 = {}, customValidators = {}, legalEntityTrustedFields) {
23857
24069
  var _a;
23858
24070
  const requiredFields = {};
23859
24071
  const optionalFields = {};
@@ -23865,9 +24077,19 @@ function getPropsFromConfigurations(scenarioConfiguration, forms2, remediationAc
23865
24077
  const masks = {};
23866
24078
  const validators2 = {};
23867
24079
  const obscuredFields = {};
24080
+ const trustedFields2 = {};
23868
24081
  if (!scenarioConfiguration) {
23869
24082
  return;
23870
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
+ }, []);
23871
24093
  (_a = Object.entries(forms2)) == null ? void 0 : _a.forEach(([formId, formDetails]) => {
23872
24094
  var _a2;
23873
24095
  const formFieldsWithExistingData = addLinkedFields(fieldsWithExistingData).filter((field) => field.startsWith(formId)).map((field) => field.slice(field.lastIndexOf(".") + 1));
@@ -23879,7 +24101,7 @@ function getPropsFromConfigurations(scenarioConfiguration, forms2, remediationAc
23879
24101
  const isFieldNeededToRemediateDataMissingError = isFieldRequiredToRemediateDataMissingError(formId, field, dataMissingErrors);
23880
24102
  const fieldHasExistingData = formFieldsWithExistingData.includes(field);
23881
24103
  const isRequired = isFieldRequiredByRemediationAction || isRequiredFromFieldConfig || isFieldNeededToRemediateDataMissingError || fieldHasExistingData;
23882
- if (isRequired) {
24104
+ if (isRequired && !readonly.includes(field)) {
23883
24105
  requiredFields[formId] = requiredFields[formId] ? [...requiredFields[formId], field] : [field];
23884
24106
  allFields[formId] = allFields[formId] ? [...allFields[formId], field] : [field];
23885
24107
  }
@@ -23889,6 +24111,10 @@ function getPropsFromConfigurations(scenarioConfiguration, forms2, remediationAc
23889
24111
  optionalFields[formId] = optionalFields[formId] ? [...optionalFields[formId], field] : [field];
23890
24112
  allFields[formId] = allFields[formId] ? [...allFields[formId], field] : [field];
23891
24113
  }
24114
+ const isFieldTrusted = isTrustedField(trustedMappings, formId, field);
24115
+ if (isFieldTrusted) {
24116
+ trustedFields2[formId] = trustedFields2[formId] ? [...trustedFields2[formId], field] : [field];
24117
+ }
23892
24118
  if (fieldConfigurations) {
23893
24119
  const customLabel = (_a3 = customLabels2 == null ? void 0 : customLabels2[field]) == null ? void 0 : _a3.call(customLabels2);
23894
24120
  const label = customLabel || fieldConfigurations.label;
@@ -23958,6 +24184,7 @@ function getPropsFromConfigurations(scenarioConfiguration, forms2, remediationAc
23958
24184
  placeholders,
23959
24185
  validators: validators2,
23960
24186
  obscuredFields,
24187
+ trustedFields: trustedFields2,
23961
24188
  helperText,
23962
24189
  masks
23963
24190
  };
@@ -23978,6 +24205,10 @@ const isFieldRequiredToRemediateDataMissingError = (formId, field, dataMissingEr
23978
24205
  const missingAndLinkedFields = addLinkedFields(missingFields);
23979
24206
  return missingAndLinkedFields.includes(makeTLDSFieldName(formId, field));
23980
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
+ });
23981
24212
  function getBaseTrackingPayload({
23982
24213
  trackingConfig = {
23983
24214
  topLevelLegalEntity: {}
@@ -24207,7 +24438,7 @@ const DateOfIncorporationFieldValidation = () => ({
24207
24438
  errorMessage: "invalidDateOfIncorporation"
24208
24439
  }]
24209
24440
  });
24210
- const DBA_NAME_FIELD = ["hasDBA", "dbaName"];
24441
+ const DBA_NAME_FIELD = ["hasDba", "dbaName"];
24211
24442
  function DBANameField({
24212
24443
  data,
24213
24444
  valid,
@@ -24215,35 +24446,39 @@ function DBANameField({
24215
24446
  labels: labels2,
24216
24447
  helperText,
24217
24448
  readonly,
24218
- handleChangeFor
24449
+ handleChangeFor,
24450
+ setErrors
24219
24451
  }) {
24220
24452
  const {
24221
24453
  i18n
24222
24454
  } = useI18nContext();
24223
- const selected = data.hasDBA ? "yesDba" : "noDba";
24224
- const handleHasDbaChange = (selection) => {
24225
- handleChangeFor("hasDBA")(selection === "yesDba");
24226
- };
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]);
24227
24460
  return jsxs(Fragment, {
24228
24461
  children: [jsx(Field, {
24229
24462
  name: "hasDba",
24230
- label: labels2.hasDBA ?? i18n.get("hasDba"),
24231
- 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,
24232
24467
  children: (childProps) => jsx(RadioGroup, {
24233
24468
  ...childProps,
24234
24469
  name: "hasDba",
24235
24470
  items: [{
24236
- id: "yesDba",
24471
+ id: "yes",
24237
24472
  name: "yes"
24238
24473
  }, {
24239
- id: "noDba",
24474
+ id: "no",
24240
24475
  name: "no"
24241
24476
  }],
24242
- value: selected,
24243
- onChange: (e) => handleHasDbaChange(e.target.value),
24477
+ value: selection,
24478
+ onChange: (e) => handleChangeFor("hasDba")(e.target.value === "yes"),
24244
24479
  horizontal: true
24245
24480
  })
24246
- }), data.hasDBA && jsx(Field, {
24481
+ }), data.hasDba && jsx(Field, {
24247
24482
  name: "dbaName",
24248
24483
  label: labels2.dbaName ?? i18n.get("dbaName"),
24249
24484
  errorMessage: errors.dbaName,
@@ -24264,9 +24499,12 @@ function DBANameField({
24264
24499
  })]
24265
24500
  });
24266
24501
  }
24502
+ const hasDbaFieldMetadata = {
24503
+ validators: [validateNotEmptyOnBlur]
24504
+ };
24267
24505
  const dbaNameFieldMetadata = {
24268
24506
  label: "dbaName",
24269
- validators: validateNotEmptyOnBlur
24507
+ validators: [validateNotEmptyOnBlur]
24270
24508
  };
24271
24509
  const TAX_INFORMATION_FIELD = ["taxInformation", "exemptedFromTax", "isUen"];
24272
24510
  function TaxInformationField({
@@ -24469,8 +24707,76 @@ const defaultFieldConfig$1 = entriesOf(defaultFieldConfig$8).reduce((fieldConfig
24469
24707
  };
24470
24708
  }
24471
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
+ }
24472
24778
  const ADDITIONAL_INFORMATION_FORM_ID = "additionalInformation";
24473
- 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"];
24474
24780
  function AdditionalInformationComponent({
24475
24781
  data,
24476
24782
  labels: labels2,
@@ -24487,8 +24793,11 @@ function AdditionalInformationComponent({
24487
24793
  obscuredFields,
24488
24794
  optionalFields,
24489
24795
  readOnlyFields,
24796
+ trustedFields: trustedFields2,
24490
24797
  country: country2,
24491
- companyType: companyType2 = CompanyTypesValue.PRIVATE_COMPANY
24798
+ companyType: companyType2 = CompanyTypesValue.PRIVATE_COMPANY,
24799
+ verifiedBusiness,
24800
+ showCompanyStructure
24492
24801
  }) {
24493
24802
  var _a, _b, _c, _d;
24494
24803
  const {
@@ -24497,6 +24806,8 @@ function AdditionalInformationComponent({
24497
24806
  const {
24498
24807
  i18n
24499
24808
  } = useI18nContext();
24809
+ const showVerified = !!verifiedBusiness;
24810
+ const showStockData = companyType2 === CompanyTypesValue.PUBLIC_COMPANY;
24500
24811
  const initialFormUtilsProps = useMemo(() => ({
24501
24812
  data,
24502
24813
  labels: labels2,
@@ -24508,8 +24819,9 @@ function AdditionalInformationComponent({
24508
24819
  readOnlyFields,
24509
24820
  optionalFields,
24510
24821
  obscuredFields,
24822
+ trustedFields: trustedFields2,
24511
24823
  shouldValidate
24512
- }), [data, allFields, helperText, labels2, obscuredFields, optionalFields, placeholders, readOnly, readOnlyFields, requiredFields, shouldValidate]);
24824
+ }), [data, labels2, placeholders, helperText, readOnly, allFields, requiredFields, readOnlyFields, optionalFields, obscuredFields, trustedFields2, shouldValidate]);
24513
24825
  const registrationNumberOptions = useMemo(() => getCompanyRegistrationNumberOptions(country2, companyType2), [country2, companyType2]);
24514
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;
24515
24827
  const [registrationNumberType, setRegistrationNumberType] = useState(defaultRegistrationNumberType);
@@ -24518,6 +24830,19 @@ function AdditionalInformationComponent({
24518
24830
  const [taxIdNumberType, setTaxIdNumberType] = useState(defaultTaxIdNumberType);
24519
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;
24520
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]);
24521
24846
  const mergedFieldProps = useMemo(() => {
24522
24847
  var _a2;
24523
24848
  return (_a2 = initialFormUtilsProps.allFields) == null ? void 0 : _a2.reduce((acc, field) => {
@@ -24526,6 +24851,8 @@ function AdditionalInformationComponent({
24526
24851
  return mergeFieldMetadataIntoProps(field, resolveFieldMetadata(defaultFieldConfig$a[country2], {
24527
24852
  isBusiness: true
24528
24853
  }, defaultFieldMetadata$a), acc);
24854
+ case "hasDba":
24855
+ return mergeFieldMetadataIntoProps("hasDba", hasDbaFieldMetadata, acc);
24529
24856
  case "dbaName":
24530
24857
  return mergeFieldMetadataIntoProps("dbaName", dbaNameFieldMetadata, acc);
24531
24858
  case "registrationNumber":
@@ -24562,31 +24889,22 @@ function AdditionalInformationComponent({
24562
24889
  }
24563
24890
  }, initialFormUtilsProps);
24564
24891
  }, [companyType2, country2, initialFormUtilsProps, registrationNumberType, taxIdNumberType, vatNumberType]);
24565
- const getSchema = (currentData) => {
24566
- const fieldsToRemove = [];
24567
- if (currentData.exemptedFromVat) {
24568
- fieldsToRemove.push("vatNumber");
24569
- } else {
24570
- fieldsToRemove.push("vatAbsenceReason");
24571
- }
24572
- if (!currentData.hasDBA) {
24573
- fieldsToRemove.push("dbaName");
24574
- }
24575
- return (requiredFields == null ? void 0 : requiredFields.filter((field) => !fieldsToRemove.includes(field))) ?? [...LEGAL_COMPANY_NAME_FIELD, ...DBA_NAME_FIELD];
24576
- };
24577
24892
  const {
24578
24893
  schema: formSchema,
24579
24894
  data: formData,
24580
24895
  errors: formErrors,
24581
24896
  valid: formValid,
24582
24897
  fieldProblems: formFieldProblems,
24583
- handleChangeFor
24898
+ handleChangeFor,
24899
+ resetToDefaultData,
24900
+ setErrors
24584
24901
  } = useForm({
24585
- schema: getSchema,
24902
+ schema: getFormSchema2,
24586
24903
  defaultData: data,
24587
24904
  rules: mergedFieldProps == null ? void 0 : mergedFieldProps.validators,
24588
24905
  optionalFields: mergedFieldProps == null ? void 0 : mergedFieldProps.optionalFields,
24589
24906
  obscuredFields: mergedFieldProps == null ? void 0 : mergedFieldProps.obscuredFields,
24907
+ trustedFields: mergedFieldProps == null ? void 0 : mergedFieldProps.trustedFields,
24590
24908
  fieldProblems: fieldValidationErrors,
24591
24909
  shouldValidate
24592
24910
  });
@@ -24600,8 +24918,21 @@ function AdditionalInformationComponent({
24600
24918
  fieldProblems: formFieldProblems
24601
24919
  });
24602
24920
  }, [formSchema, formData, formErrors, formFieldProblems, formValid, updateStateSlice]);
24603
- const [showVerified, setShowVerified] = useState(false);
24604
- 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
+ });
24605
24936
  return jsxs("form", {
24606
24937
  children: [jsx(FormHeader, {
24607
24938
  heading,
@@ -24613,18 +24944,13 @@ function AdditionalInformationComponent({
24613
24944
  formUtils
24614
24945
  }), jsxs("div", {
24615
24946
  className: "adyen-kyc-additional-information",
24616
- children: [showVerified && jsxs("div", {
24617
- className: "adyen-kyc-additional-information__verified-information",
24618
- children: [jsx("h3", {
24619
- children: i18n.get("verifiedInformation")
24620
- }), jsx("div", {
24621
- className: "adyen-kyc-verified-information-card"
24622
- })]
24623
- }), jsxs("div", {
24624
- className: "adyen-kyc-additional-information__other-business-information",
24625
- children: [showVerified && jsx("h3", {
24947
+ children: [showVerified && jsx(VerifiedBusinessCard, {
24948
+ verifiedBusiness
24949
+ }), jsxs("section", {
24950
+ children: [showVerified && jsx(Typography, {
24951
+ el: "h3",
24626
24952
  children: i18n.get("otherBusinessInformation")
24627
- }), formUtils.isRequiredField("legalCompanyName") && jsx("div", {
24953
+ }), showField(LEGAL_COMPANY_NAME_FIELD) && jsx("div", {
24628
24954
  className: "adyen-kyc-field-wrapper",
24629
24955
  children: jsx(LegalCompanyNameField, {
24630
24956
  data: formUtils.getFieldData(formData, LEGAL_COMPANY_NAME_FIELD),
@@ -24637,19 +24963,20 @@ function AdditionalInformationComponent({
24637
24963
  readonly: formUtils.isReadOnly("legalCompanyName"),
24638
24964
  handleChangeFor
24639
24965
  })
24640
- }), formUtils.isRequiredField("dbaName") && jsx("div", {
24966
+ }), showField(DBA_NAME_FIELD) && jsx("div", {
24641
24967
  className: "adyen-kyc-field-wrapper",
24642
24968
  children: jsx(DBANameField, {
24643
24969
  data: formUtils.getFieldData(formData, DBA_NAME_FIELD),
24644
24970
  valid: formUtils.getFieldValid(formValid, DBA_NAME_FIELD),
24645
24971
  errors: formUtils.getFieldErrors(formErrors, formFieldProblems, DBA_NAME_FIELD),
24646
24972
  labels: formUtils.getFieldLabels(DBA_NAME_FIELD, {
24647
- hasDBA: "hasDba"
24973
+ hasDba: "hasDba"
24648
24974
  }),
24649
24975
  readonly: formUtils.isReadOnly("dbaName"),
24650
- handleChangeFor
24976
+ handleChangeFor,
24977
+ setErrors
24651
24978
  })
24652
- }), formUtils.isRequiredField("registrationNumber") && jsx("div", {
24979
+ }), showField(BUSINESS_REGISTRATION_NUMBER_FIELD) && jsx("div", {
24653
24980
  className: "adyen-kyc-field-wrapper",
24654
24981
  children: jsx(BusinessRegistrationNumberField, {
24655
24982
  data: formUtils.getFieldData(formData, BUSINESS_REGISTRATION_NUMBER_FIELD),
@@ -24673,7 +25000,7 @@ function AdditionalInformationComponent({
24673
25000
  registrationNumberType,
24674
25001
  setRegistrationNumberType
24675
25002
  })
24676
- }), formUtils.isRequiredField("taxInformation") && jsx("div", {
25003
+ }), showField(TAX_INFORMATION_FIELD) && jsx("div", {
24677
25004
  className: "adyen-kyc-field-wrapper",
24678
25005
  children: jsx(TaxInformationField, {
24679
25006
  data: formUtils.getFieldData(formData, TAX_INFORMATION_FIELD),
@@ -24696,7 +25023,7 @@ function AdditionalInformationComponent({
24696
25023
  setTaxIdNumberType,
24697
25024
  defaultData: data == null ? void 0 : data.taxInformation
24698
25025
  })
24699
- }), formUtils.isRequiredField("vatNumber") && jsx("div", {
25026
+ }), showField(VAT_NUMBER_FIELD) && jsx("div", {
24700
25027
  className: "adyen-kyc-field-wrapper",
24701
25028
  children: jsx(VatNumberField, {
24702
25029
  data: formUtils.getFieldData(formData, VAT_NUMBER_FIELD),
@@ -24715,7 +25042,7 @@ function AdditionalInformationComponent({
24715
25042
  vatNumberType,
24716
25043
  setVatNumberType
24717
25044
  })
24718
- }), formUtils.isRequiredField("dateOfIncorporation") && jsx("div", {
25045
+ }), showField(DATE_OF_INCORPORATION_FIELD) && jsx("div", {
24719
25046
  className: "adyen-kyc-field-wrapper",
24720
25047
  children: jsx(DateOfIncorporationField, {
24721
25048
  data: formUtils.getFieldData(formData, DATE_OF_INCORPORATION_FIELD),
@@ -24729,11 +25056,11 @@ function AdditionalInformationComponent({
24729
25056
  handleChangeFor
24730
25057
  })
24731
25058
  })]
24732
- }), showStockData && jsxs("div", {
24733
- className: "adyen-kyc-additional-information__stock-exchange-information",
24734
- children: [jsx("h3", {
25059
+ }), showStockData && jsxs("section", {
25060
+ children: [jsx(Typography, {
25061
+ el: "h3",
24735
25062
  children: i18n.get("stockExchangeInformation")
24736
- }), formUtils.isRequiredField("stockExchangeMIC") && jsx("div", {
25063
+ }), showField(STOCK_EXCHANGE_MIC_FIELD) && jsx("div", {
24737
25064
  className: "adyen-kyc-field-wrapper",
24738
25065
  children: jsx(StockExchangeMICField, {
24739
25066
  data: formUtils.getFieldData(formData, STOCK_EXCHANGE_MIC_FIELD),
@@ -24747,7 +25074,7 @@ function AdditionalInformationComponent({
24747
25074
  shouldValidate,
24748
25075
  handleChangeFor
24749
25076
  })
24750
- }), formUtils.isRequiredField("stockISIN") && jsx("div", {
25077
+ }), showField(STOCK_ISIN_FIELD) && jsx("div", {
24751
25078
  className: "adyen-kyc-field-wrapper",
24752
25079
  children: jsx(StockISINField, {
24753
25080
  data: formUtils.getFieldData(formData, STOCK_ISIN_FIELD),
@@ -24761,7 +25088,7 @@ function AdditionalInformationComponent({
24761
25088
  shouldValidate,
24762
25089
  handleChangeFor
24763
25090
  })
24764
- }), formUtils.isRequiredField("stockTickerSymbol") && jsx("div", {
25091
+ }), showField(STOCK_TICKER_SYMBOL_FIELD) && jsx("div", {
24765
25092
  className: "adyen-kyc-field-wrapper",
24766
25093
  children: jsx(StockTickerSymbolField, {
24767
25094
  data: formUtils.getFieldData(formData, STOCK_TICKER_SYMBOL_FIELD),
@@ -24871,9 +25198,11 @@ function BasicInformationComponent({
24871
25198
  obscuredFields,
24872
25199
  optionalFields,
24873
25200
  readOnlyFields,
25201
+ trustedFields: trustedFields2,
24874
25202
  country: country2,
24875
25203
  companyType: companyType2 = CompanyTypesValue.PRIVATE_COMPANY,
24876
- isTopLevelEntity
25204
+ isTopLevelEntity,
25205
+ isBusinessSelection
24877
25206
  }) {
24878
25207
  var _a, _b, _c, _d, _e;
24879
25208
  const {
@@ -24898,8 +25227,9 @@ function BasicInformationComponent({
24898
25227
  readOnlyFields,
24899
25228
  optionalFields,
24900
25229
  obscuredFields,
25230
+ trustedFields: trustedFields2,
24901
25231
  shouldValidate
24902
- }), [allFields, helperText, labels2, obscuredFields, optionalFields, placeholders, readOnly, readOnlyFields, requiredFields, shouldValidate]);
25232
+ }), [allFields, helperText, labels2, obscuredFields, optionalFields, placeholders, readOnly, readOnlyFields, requiredFields, trustedFields2, shouldValidate]);
24903
25233
  const registrationNumberOptions = useMemo(() => getCompanyRegistrationNumberOptions(country2, companyType2), [country2, companyType2]);
24904
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;
24905
25235
  const [registrationNumberType, setRegistrationNumberType] = useState(defaultRegistrationNumberType);
@@ -24952,6 +25282,7 @@ function BasicInformationComponent({
24952
25282
  rules: mergedFieldProps == null ? void 0 : mergedFieldProps.validators,
24953
25283
  optionalFields: mergedFieldProps == null ? void 0 : mergedFieldProps.optionalFields,
24954
25284
  obscuredFields: mergedFieldProps == null ? void 0 : mergedFieldProps.obscuredFields,
25285
+ trustedFields: mergedFieldProps == null ? void 0 : mergedFieldProps.trustedFields,
24955
25286
  fieldProblems: fieldValidationErrors,
24956
25287
  shouldValidate
24957
25288
  });
@@ -24966,6 +25297,7 @@ function BasicInformationComponent({
24966
25297
  });
24967
25298
  }, [formSchema, formData, formErrors, formFieldProblems, formValid, updateStateSlice]);
24968
25299
  return jsxs("form", {
25300
+ className: isBusinessSelection ? "adyen-kyc-hide-form" : void 0,
24969
25301
  children: [jsx(FormHeader, {
24970
25302
  heading,
24971
25303
  description: description2
@@ -24976,94 +25308,272 @@ function BasicInformationComponent({
24976
25308
  formUtils
24977
25309
  }), jsxs("div", {
24978
25310
  className: "adyen-kyc-basic-information",
24979
- children: [formUtils.isRequiredField("country") && jsx("div", {
24980
- className: "adyen-kyc-field-wrapper",
24981
- children: jsx(CountryField, {
24982
- data: formUtils.getFieldData(formData, COUNTRY_FIELD),
24983
- valid: formUtils.getFieldValid(formValid, COUNTRY_FIELD),
24984
- errors: formUtils.getFieldErrors(formErrors, formFieldProblems, COUNTRY_FIELD),
24985
- labels: formUtils.getFieldLabels(COUNTRY_FIELD, {
24986
- country: "countryRegionOfEstablishment"
24987
- }),
24988
- readonly: formUtils.isReadOnly("country") || !isAllowedEditPrefilledCountry,
24989
- handleChangeFor,
24990
- allowedCountries: isTopLevelEntity ? allowedCountries : void 0
24991
- })
24992
- }), formUtils.isRequiredField("businessName") && jsx("div", {
24993
- className: "adyen-kyc-field-wrapper",
24994
- children: jsx(BusinessNameField, {
24995
- data: formUtils.getFieldData(formData, BUSINESS_NAME_FIELD),
24996
- valid: formUtils.getFieldValid(formValid, BUSINESS_NAME_FIELD),
24997
- errors: formUtils.getFieldErrors(formErrors, formFieldProblems, BUSINESS_NAME_FIELD),
24998
- labels: formUtils.getFieldLabels(BUSINESS_NAME_FIELD),
24999
- readonly: formUtils.isReadOnly("businessName"),
25000
- handleChangeFor
25001
- })
25002
- }), formUtils.isRequiredField("taxInformation") && jsx("div", {
25003
- className: "adyen-kyc-field-wrapper",
25004
- children: jsx(TaxInformationField, {
25005
- data: formUtils.getFieldData(formData, TAX_INFORMATION_FIELD),
25006
- valid: formUtils.getFieldValid(formValid, TAX_INFORMATION_FIELD),
25007
- errors: formUtils.getFieldErrors(formErrors, formFieldProblems, TAX_INFORMATION_FIELD),
25008
- labels: formUtils.getFieldLabels(TAX_INFORMATION_FIELD, {
25009
- exemptedFromTax: "iDontHaveATaxId"
25010
- }),
25011
- mask: formUtils.getMask("taxInformation"),
25012
- helperText: formUtils.getFieldHelperText(TAX_INFORMATION_FIELD),
25013
- placeholders: formUtils.getFieldPlaceholders(TAX_INFORMATION_FIELD),
25014
- guidanceText: formUtils.getFieldGuidanceText(TAX_INFORMATION_FIELD),
25015
- readonly: formUtils.isReadOnly("taxInformation"),
25016
- shouldValidate,
25017
- handleChangeFor,
25018
- canExempt: formUtils.isRequiredField("exemptedFromTax"),
25019
- registrationNumber: formData.registrationNumber,
25020
- isUen: formUtils.isRequiredField("isUen"),
25021
- country: formData.country ?? country2,
25022
- companyType: companyType2,
25023
- taxIdNumberType,
25024
- setTaxIdNumberType,
25025
- defaultData: data == null ? void 0 : data.taxInformation
25026
- })
25027
- }), formUtils.isRequiredField("stateOrProvince") && jsx("div", {
25028
- className: "adyen-kyc-field-wrapper",
25029
- children: jsx(StateField, {
25030
- data: formUtils.getFieldData(formData, STATE_FIELD),
25031
- valid: formUtils.getFieldValid(formValid, STATE_FIELD),
25032
- errors: formUtils.getFieldErrors(formErrors, formFieldProblems, STATE_FIELD),
25033
- labels: formUtils.getFieldLabels(STATE_FIELD),
25034
- placeholders: formUtils.getFieldPlaceholders(STATE_FIELD),
25035
- readonly: formUtils.isReadOnly("stateOrProvince"),
25036
- handleChangeFor,
25037
- selectedCountry: formData.country
25038
- })
25039
- }), (formUtils.isRequiredField("registrationNumber") || formUtils.isOptionalField("registrationNumber")) && jsx("div", {
25040
- className: "adyen-kyc-field-wrapper",
25041
- children: jsx(BusinessRegistrationNumberField, {
25042
- data: formUtils.getFieldData(formData, BUSINESS_REGISTRATION_NUMBER_FIELD),
25043
- valid: formUtils.getFieldValid(formValid, BUSINESS_REGISTRATION_NUMBER_FIELD),
25044
- errors: formUtils.getFieldErrors(formErrors, formFieldProblems, BUSINESS_REGISTRATION_NUMBER_FIELD),
25045
- labels: formUtils.getFieldLabels(BUSINESS_REGISTRATION_NUMBER_FIELD, {
25046
- exemptedFromRegistrationNumber: "iDontHaveARegistrationNumber"
25047
- }),
25048
- mask: formUtils.getMask("registrationNumber"),
25049
- guidanceText: formUtils.getFieldGuidanceText(BUSINESS_REGISTRATION_NUMBER_FIELD),
25050
- placeholders: formUtils.getFieldPlaceholders(BUSINESS_REGISTRATION_NUMBER_FIELD),
25051
- helperText: formUtils.getFieldHelperText(BUSINESS_REGISTRATION_NUMBER_FIELD),
25052
- readonly: formUtils.isReadOnly("registrationNumber"),
25053
- optional: formUtils.isOptionalField("registrationNumber"),
25054
- shouldValidate,
25055
- handleChangeFor,
25056
- country: formData.country ?? country2,
25057
- canExempt: formUtils.isRequiredField("exemptedFromRegistrationNumber"),
25058
- companyType: companyType2,
25059
- registrationNumberOptions,
25060
- registrationNumberType,
25061
- 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
+ })
25062
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
+ })]
25063
25399
  })]
25064
25400
  })]
25065
25401
  });
25066
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
+ };
25067
25577
  const CompanyStructureValidation = {
25068
25578
  entityType: {
25069
25579
  modes: ["blur"],
@@ -25083,13 +25593,18 @@ function CompanyStructureComponent({
25083
25593
  fieldValidationErrors,
25084
25594
  requiredFields,
25085
25595
  country: country2,
25596
+ verifiedBusiness,
25086
25597
  kompanyVerifiedData,
25598
+ showCompanyStructure,
25087
25599
  ...props
25088
25600
  }) {
25089
25601
  var _a;
25090
25602
  const {
25091
25603
  i18n
25092
25604
  } = useI18nContext();
25605
+ const {
25606
+ isExperimentEnabled
25607
+ } = useExperimentsContext();
25093
25608
  const isNewEntryFlowEnabled = useEnableNewEntryFlow();
25094
25609
  const {
25095
25610
  updateStateSlice
@@ -25101,7 +25616,9 @@ function CompanyStructureComponent({
25101
25616
  valid: formValid,
25102
25617
  errors: formErrors,
25103
25618
  fieldProblems: formFieldProblems,
25104
- handleChangeFor
25619
+ handleChangeFor,
25620
+ setData,
25621
+ setValid
25105
25622
  } = useForm({
25106
25623
  schema,
25107
25624
  defaultData: data,
@@ -25124,6 +25641,20 @@ function CompanyStructureComponent({
25124
25641
  }
25125
25642
  prevVerifiedDataRef.current = kompanyVerifiedData;
25126
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]);
25127
25658
  useEffect(() => {
25128
25659
  updateStateSlice({
25129
25660
  schema: formSchema,
@@ -25189,7 +25720,6 @@ const getForms = (country2) => ({
25189
25720
  formId: "basicInformation",
25190
25721
  formName: "basicInformationFormName",
25191
25722
  formHeading: "basicInformationFormHeading",
25192
- formDescription: "basicInformationFormDescription",
25193
25723
  fields: COUNTRIES_USING_COMPANY_SEARCH.includes(country2) ? basicInformationFields : basicInformationFields.filter((field) => !FIELDS_NEEDED_FOR_COMPANY_SEARCH.includes(field))
25194
25724
  },
25195
25725
  companyStructure: {
@@ -25240,72 +25770,69 @@ const mapApiDocumentToBusinessDetailsDocuments = (entityId) => {
25240
25770
  } : void 0
25241
25771
  };
25242
25772
  };
25243
- const mapBasicInformation = (value) => {
25244
- if (!!value.country && COUNTRIES_USING_COMPANY_SEARCH.includes(value.country)) {
25245
- return value;
25246
- }
25247
- 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]) => {
25248
25776
  if (!FIELDS_NEEDED_FOR_COMPANY_SEARCH.includes(field)) {
25249
25777
  return {
25250
25778
  ...acc,
25251
- [field]: fieldValue
25779
+ [field]: data[field]
25252
25780
  };
25253
25781
  }
25254
25782
  return acc;
25255
25783
  }, {});
25256
- return nonCompanySearchFields;
25257
25784
  };
25258
- const mapAdditionalInformation = (value, legalEntity) => {
25259
- var _a;
25260
- const currentCountry = (_a = legalEntity.organization) == null ? void 0 : _a.registeredAddress.country;
25261
- if (!!currentCountry && COUNTRIES_USING_COMPANY_SEARCH.includes(currentCountry)) {
25262
- const companySearchFields = entriesOf(value).reduce((acc, [field, fieldValue]) => {
25263
- if (!FIELDS_NEEDED_FOR_COMPANY_SEARCH.includes(field)) {
25264
- return {
25265
- ...acc,
25266
- [field]: fieldValue
25267
- };
25268
- }
25269
- return acc;
25270
- }, {});
25271
- return {
25272
- ...companySearchFields,
25273
- hasDBA: !!companySearchFields.dbaName
25274
- };
25275
- }
25276
- return {
25277
- ...value,
25278
- hasDBA: !!value.dbaName
25279
- };
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
+ });
25280
25811
  };
25281
25812
  const mapLegalEntityToBusinessDetailsSchema = (legalEntity, isChangingType, accountHolder2) => {
25282
- const businessDetailsSchema = {
25283
- basicInformation: {},
25284
- companyStructure: {},
25285
- additionalInformation: {},
25286
- companyRegistrationAddress: {},
25287
- companyRegistrationDocument: {},
25288
- companyTaxDocument: {},
25289
- ...formatObject(legalEntity, businessDetailsComponentsKeyMapping)
25290
- };
25291
25813
  const {
25292
25814
  companyRegistrationDocument: companyRegistrationDocument2,
25293
25815
  companyTaxDocument
25294
25816
  } = mapApiDocumentToBusinessDetailsDocuments(legalEntity == null ? void 0 : legalEntity.id);
25295
- 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]) => {
25296
25823
  var _a;
25297
25824
  switch (key) {
25298
25825
  case "basicInformation": {
25299
25826
  return {
25300
25827
  ...componentData,
25301
- [key]: mapBasicInformation(value)
25828
+ [key]: mapBasicInformation(businessDetailsSchema[key])
25302
25829
  };
25303
25830
  }
25304
25831
  case "companyStructure": {
25305
25832
  return {
25306
25833
  ...componentData,
25307
25834
  [key]: {
25308
- ...value,
25835
+ ...businessDetailsSchema[key],
25309
25836
  accountHolder: getDefaultAccountHolderType(legalEntity, isChangingType, accountHolder2) ?? "theCompanyIWorkFor"
25310
25837
  }
25311
25838
  };
@@ -25313,14 +25840,14 @@ const mapLegalEntityToBusinessDetailsSchema = (legalEntity, isChangingType, acco
25313
25840
  case "additionalInformation": {
25314
25841
  return {
25315
25842
  ...componentData,
25316
- [key]: mapAdditionalInformation(value, legalEntity)
25843
+ [key]: mapAdditionalInformation(businessDetailsSchema[key], legalEntity)
25317
25844
  };
25318
25845
  }
25319
25846
  case "companyRegistrationAddress": {
25320
25847
  return {
25321
25848
  ...componentData,
25322
25849
  [key]: {
25323
- ...value,
25850
+ ...businessDetailsSchema[key],
25324
25851
  operationalAddressIsSame: ((_a = legalEntity.organization) == null ? void 0 : _a.principalPlaceOfBusiness) ? operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_NOT_SAME : operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_SAME
25325
25852
  }
25326
25853
  };
@@ -25328,17 +25855,13 @@ const mapLegalEntityToBusinessDetailsSchema = (legalEntity, isChangingType, acco
25328
25855
  case "companyRegistrationDocument": {
25329
25856
  return {
25330
25857
  ...componentData,
25331
- [key]: {
25332
- ...companyRegistrationDocument2
25333
- }
25858
+ [key]: businessDetailsSchema[key]
25334
25859
  };
25335
25860
  }
25336
25861
  case "companyTaxDocument": {
25337
25862
  return {
25338
25863
  ...componentData,
25339
- [key]: {
25340
- ...companyTaxDocument
25341
- }
25864
+ [key]: businessDetailsSchema[key]
25342
25865
  };
25343
25866
  }
25344
25867
  default:
@@ -25346,49 +25869,646 @@ const mapLegalEntityToBusinessDetailsSchema = (legalEntity, isChangingType, acco
25346
25869
  }
25347
25870
  }, {});
25348
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
+ }
25349
26413
  function BusinessDetailsComponent(props) {
25350
- var _a, _b, _c, _d, _e;
26414
+ var _a, _b;
25351
26415
  const {
25352
26416
  i18n
25353
26417
  } = useI18nContext();
26418
+ const {
26419
+ basicInformation: basicInformation2,
26420
+ companyStructure: companyStructure2
26421
+ } = useGlobalData();
25354
26422
  const {
25355
26423
  country: country2,
25356
26424
  isTopLevelEntity,
25357
26425
  activeForm,
25358
26426
  problems,
25359
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,
25360
26441
  handleAddressSearch,
25361
26442
  handleFindAddress,
25362
- handleCompanyIndexSearch,
25363
26443
  handleCompanyDeepSearch,
25364
26444
  handleGetCompanyDataset,
25365
26445
  handleRefreshCompanyDataset,
25366
26446
  handleVerifyTin,
25367
26447
  onTypeSwitch
25368
26448
  } = props;
25369
- const globalData = useGlobalData();
25370
26449
  const forms2 = getForms(country2);
25371
26450
  const formWrapperClasses = (formId) => (activeForm == null ? void 0 : activeForm.formId) !== formId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper";
25372
- 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
+ });
25373
26478
  return jsxs("div", {
25374
- className: "adyen-kyc-business-details",
25375
- children: [jsx("div", {
26479
+ className: classNames,
26480
+ children: [jsxs("div", {
25376
26481
  className: formWrapperClasses(forms2.basicInformation.formId),
25377
- 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, {
25378
26502
  ...getFormProps(props, forms2.basicInformation.formId),
25379
26503
  id: forms2.basicInformation.formId,
25380
26504
  heading: i18n.get((activeForm == null ? void 0 : activeForm.formHeading) ?? forms2.basicInformation.formHeading),
25381
- 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,
25382
26506
  country: country2,
25383
- companyType: (_b = globalData == null ? void 0 : globalData.companyStructure) == null ? void 0 : _b.entityType,
26507
+ companyType: companyStructure2 == null ? void 0 : companyStructure2.entityType,
25384
26508
  isTopLevelEntity,
25385
26509
  baseTrackingPayload,
25386
- handleCompanyIndexSearch,
25387
- handleCompanyDeepSearch,
25388
- handleGetCompanyDataset,
25389
- handleRefreshCompanyDataset,
25390
- handleVerifyTin
25391
- })
26510
+ isBusinessSelection
26511
+ })]
25392
26512
  }), jsx("div", {
25393
26513
  className: formWrapperClasses(forms2.companyStructure.formId),
25394
26514
  children: jsx(CompanyStructureComponent, {
@@ -25396,7 +26516,9 @@ function BusinessDetailsComponent(props) {
25396
26516
  id: forms2.companyStructure.formId,
25397
26517
  heading: i18n.get((activeForm == null ? void 0 : activeForm.formHeading) ?? forms2.companyStructure.formHeading),
25398
26518
  description: i18n.get((activeForm == null ? void 0 : activeForm.formDescription) ?? forms2.companyStructure.formDescription),
25399
- country: country2
26519
+ country: country2,
26520
+ verifiedBusiness,
26521
+ showCompanyStructure
25400
26522
  })
25401
26523
  }), jsx("div", {
25402
26524
  className: formWrapperClasses(forms2.additionalInformation.formId),
@@ -25406,7 +26528,9 @@ function BusinessDetailsComponent(props) {
25406
26528
  heading: i18n.get((activeForm == null ? void 0 : activeForm.formHeading) ?? forms2.additionalInformation.formHeading),
25407
26529
  description: i18n.get((activeForm == null ? void 0 : activeForm.formDescription) ?? forms2.additionalInformation.formDescription),
25408
26530
  country: country2,
25409
- 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
25410
26534
  })
25411
26535
  }), jsx("div", {
25412
26536
  className: formWrapperClasses(forms2.companyRegistrationAddress.formId),
@@ -25420,8 +26544,8 @@ function BusinessDetailsComponent(props) {
25420
26544
  country: country2,
25421
26545
  problems,
25422
26546
  handleAddressSearch,
25423
- handleFindAddress
25424
- // kompanyAddress={kompanyAddress}
26547
+ handleFindAddress,
26548
+ verifiedBusiness
25425
26549
  })
25426
26550
  }), jsx("div", {
25427
26551
  className: formWrapperClasses(forms2.companyRegistrationDocument.formId),
@@ -25431,7 +26555,7 @@ function BusinessDetailsComponent(props) {
25431
26555
  heading: forms2.companyRegistrationDocument.formHeading,
25432
26556
  description: forms2.companyRegistrationDocument.formDescription,
25433
26557
  country: country2,
25434
- companyType: (_d = globalData.companyStructure) == null ? void 0 : _d.entityType
26558
+ companyType: companyStructure2 == null ? void 0 : companyStructure2.entityType
25435
26559
  })
25436
26560
  }), jsx("div", {
25437
26561
  className: formWrapperClasses(forms2.companyTaxDocument.formId),
@@ -25441,7 +26565,7 @@ function BusinessDetailsComponent(props) {
25441
26565
  heading: forms2.companyTaxDocument.formHeading,
25442
26566
  description: forms2.companyTaxDocument.formDescription,
25443
26567
  country: country2,
25444
- companyType: (_e = globalData.companyStructure) == null ? void 0 : _e.entityType
26568
+ companyType: companyStructure2 == null ? void 0 : companyStructure2.entityType
25445
26569
  }) : jsx(DocumentUpload, {
25446
26570
  ...getFormProps(props, forms2.companyTaxDocument.formId),
25447
26571
  id: forms2.companyTaxDocument.formId,
@@ -25643,7 +26767,7 @@ const ExpiredBanner = () => {
25643
26767
  i18n
25644
26768
  } = useI18nContext();
25645
26769
  return jsx(Alert, {
25646
- type: AlertTypes.WARNING,
26770
+ type: "warning",
25647
26771
  title: i18n.get("thisPageIsNowInactive"),
25648
26772
  hasCloseButton: false,
25649
26773
  children: i18n.get("startANewSessionFromTheSamePlaceYouOriginallyAccessed")
@@ -25975,7 +27099,7 @@ const FormNavigationItem = ({
25975
27099
  children: [i18n.get(form.formName), form.hasServerValidationErrors && jsx("span", {
25976
27100
  className: "adyen-kyc-form-navigation__item-icon adyen-kyc-form-navigation__item-icon--error",
25977
27101
  children: jsx(AlertIcon, {
25978
- type: AlertTypes.WARNING
27102
+ type: "warning"
25979
27103
  })
25980
27104
  }), form.isValid && !hasError && jsx("span", {
25981
27105
  className: "adyen-kyc-form-navigation__item-icon adyen-kyc-form-navigation__item-icon--success",
@@ -26052,6 +27176,7 @@ const FormWrapper = ({
26052
27176
  handleBackClick,
26053
27177
  handleHomeClick,
26054
27178
  nextButtonLabel,
27179
+ backButtonLabel,
26055
27180
  homeButtonLabel,
26056
27181
  loadingStatus,
26057
27182
  gotoFormByFormIndex,
@@ -26064,6 +27189,7 @@ const FormWrapper = ({
26064
27189
  hideFooter,
26065
27190
  hideHomeButton,
26066
27191
  hideBackButton,
27192
+ hideNextButton,
26067
27193
  hideNavigation,
26068
27194
  canSubmit: canSubmit2,
26069
27195
  onSubmit,
@@ -26092,7 +27218,7 @@ const FormWrapper = ({
26092
27218
  isExperimentEnabled
26093
27219
  } = useExperimentsContext();
26094
27220
  const showExtraTaxExemptionReasons = isExperimentEnabled(ExperimentNames.ShowExtraTaxExemptionReasons);
26095
- 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);
26096
27222
  const summaryContent = jsx("div", {
26097
27223
  className: "adyen-kyc-form-wrapper",
26098
27224
  children: jsx(Summary, {
@@ -26116,11 +27242,12 @@ const FormWrapper = ({
26116
27242
  onNext: handleNextClick,
26117
27243
  onBack: handleBackClick,
26118
27244
  onHome: onHomeClick,
26119
- backButtonLabel: i18n.get("back"),
27245
+ backButtonLabel: backButtonLabel ?? i18n.get("back"),
26120
27246
  nextButtonLabel,
26121
27247
  homeButtonLabel,
26122
27248
  hideOnHomeButton: hideHomeButton,
26123
- hideBackButton
27249
+ hideBackButton,
27250
+ hideNextButton
26124
27251
  });
26125
27252
  const multiStepForm = jsxs("div", {
26126
27253
  className: "adyen-kyc-form-container",
@@ -26243,22 +27370,27 @@ const mapBusinessDetailsDocumentToApiDocument = async (data, entityId) => {
26243
27370
  return documents2.filter(Boolean);
26244
27371
  };
26245
27372
  const mapBusinessDetailsSchemaToLegalEntity = (data) => {
26246
- 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;
26247
27374
  const requestObj = {
26248
27375
  ...formatObject(data, businessDetailsApiKeyMapping)
26249
27376
  };
26250
- const taxData = ((_a = data.basicInformation) == null ? void 0 : _a.taxInformation) || ((_b = data.additionalInformation) == null ? void 0 : _b.taxInformation);
26251
- 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);
26252
27381
  if (requestObj.organization) {
26253
27382
  if (taxData) {
26254
- 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;
26255
27384
  }
26256
27385
  if (registrationNumber2) {
26257
- 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;
26258
27387
  }
26259
- if ((_k = data.additionalInformation) == null ? void 0 : _k.vatAbsenceReason) {
27388
+ if ((_n = data.additionalInformation) == null ? void 0 : _n.vatAbsenceReason) {
26260
27389
  requestObj.organization.vatNumber = "";
26261
27390
  }
27391
+ if (dbaName2) {
27392
+ requestObj.organization.doingBusinessAs = dbaName2;
27393
+ }
26262
27394
  }
26263
27395
  requestObj.type = LegalEntityType.ORGANIZATION;
26264
27396
  return requestObj;
@@ -26274,7 +27406,7 @@ const canSubmit$3 = (data) => MANDATORY_API_FIELDS.every((detail) => {
26274
27406
  });
26275
27407
  const isDocumentsRequired$3 = (forms2) => forms2.some((form) => documentFormsIds.includes(form.formId));
26276
27408
  const formatBasicInformation = (data, labels2, datasetUtils, companyType2) => {
26277
- var _a, _b, _c, _d, _e;
27409
+ var _a, _b, _c, _d;
26278
27410
  const country2 = data == null ? void 0 : data.country;
26279
27411
  const registrationNumberLabel = resolveFieldMetadata(defaultFieldConfig$9[country2], {
26280
27412
  companyType: companyType2,
@@ -26286,10 +27418,9 @@ const formatBasicInformation = (data, labels2, datasetUtils, companyType2) => {
26286
27418
  companyType: void 0
26287
27419
  }, defaultFieldMetadata$1).label;
26288
27420
  return {
26289
- [((_b = labels2 == null ? void 0 : labels2.basicInformation) == null ? void 0 : _b.businessName) ?? "businessName"]: data.businessName,
26290
- [((_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),
26291
27422
  [getKeyForField("stateOrProvince", data.country)]: datasetUtils.getStateName(data.stateOrProvince, data.country),
26292
- [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,
26293
27424
  [registrationNumberLabel]: data.registrationNumber
26294
27425
  };
26295
27426
  };
@@ -26305,16 +27436,16 @@ const formatAdditionalInformation = (data, labels2, country2, companyType2) => {
26305
27436
  companyType: void 0
26306
27437
  }, defaultFieldMetadata$1).label;
26307
27438
  return {
26308
- [((_b = labels2.additionalInformation) == null ? void 0 : _b.legalCompanyName) ?? "legalCompanyName"]: data.legalCompanyName,
26309
- [((_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,
26310
27441
  [registrationNumberLabel]: data.registrationNumber,
26311
27442
  [taxIdLabel]: (_e = (_d = data.taxInformation) == null ? void 0 : _d.find((taxId2) => country2 === taxId2.country)) == null ? void 0 : _e.number,
26312
- [((_f = labels2.additionalInformation) == null ? void 0 : _f.vatNumber) ?? "vatNumber"]: data.vatNumber,
26313
- [((_g = labels2.additionalInformation) == null ? void 0 : _g.vatAbsenceReason) ?? "vatAbsenceReason"]: data.vatAbsenceReason,
26314
- [((_h = labels2.additionalInformation) == null ? void 0 : _h.dateOfIncorporation) ?? "dateOfIncorporation"]: data.dateOfIncorporation,
26315
- [((_i = labels2.additionalInformation) == null ? void 0 : _i.stockExchangeMIC) ?? "stockExchangeMIC"]: data.stockExchangeMIC,
26316
- [((_j = labels2.additionalInformation) == null ? void 0 : _j.stockISIN) ?? "stockISIN"]: data.stockISIN,
26317
- [((_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
26318
27449
  };
26319
27450
  };
26320
27451
  const formatDataForSummary$1 = (data, forms2, labels2, i18n) => {
@@ -26545,7 +27676,17 @@ function BusinessDetailsDropinComponent({
26545
27676
  useEffect(() => {
26546
27677
  onChange == null ? void 0 : onChange(currentState);
26547
27678
  }, [currentState, onChange]);
26548
- 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
+ }, []);
26549
27690
  const formRef = useRef(null);
26550
27691
  const {
26551
27692
  showToast,
@@ -26565,9 +27706,33 @@ function BusinessDetailsDropinComponent({
26565
27706
  var _a2;
26566
27707
  return ((_a2 = currentState.data.basicInformation) == null ? void 0 : _a2.country) ?? country2;
26567
27708
  }, [(_a = currentState.data.basicInformation) == null ? void 0 : _a.country, country2]);
26568
- const [loadingStatus, setLoadingStatus] = useState("success");
26569
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");
26570
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]);
26571
27736
  const getConfigurationData = useCallback(() => getConfiguration2({
26572
27737
  legalEntityType: LegalEntityType.ORGANIZATION,
26573
27738
  capabilities: capabilities ?? getCapabilities(legalEntityResponse),
@@ -26588,19 +27753,21 @@ function BusinessDetailsDropinComponent({
26588
27753
  isExperimentEnabled
26589
27754
  }), [currentCountry, currentState.data, isExperimentEnabled, taskType]);
26590
27755
  const initialForms = useMemo(() => getForms(currentCountry), [currentCountry]);
26591
- 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]);
26592
27757
  const isSkippingCompanyStructure = useEnableNewEntryFlow() && organizationTypesToSkipCompanyStructureForm.includes((_d = legalEntityResponse == null ? void 0 : legalEntityResponse.organization) == null ? void 0 : _d.type) && accountHolder2 !== "aTrust";
26593
27758
  const forms2 = useMemo(() => {
26594
27759
  const requiredForms = getRequiredForms(initialForms, derivedProps == null ? void 0 : derivedProps.requiredFields, derivedProps == null ? void 0 : derivedProps.optionalFields);
26595
- return addValidityToForms(requiredForms, currentState.validityByForm, problems).filter((form) => isSkippingCompanyStructure ? form.formId !== "companyStructure" : true);
26596
- }, [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]);
26597
27770
  const canSubmitForm = useMemo(() => canSubmit$3(currentState.data) && hasDataChanged(initialData, currentState.data), [initialData, currentState.data]);
26598
- const baseTrackingPayload = useMemo(() => getBaseTrackingPayload({
26599
- trackingConfig,
26600
- parentLegalEntity,
26601
- legalEntity: legalEntityResponse,
26602
- task: taskType
26603
- }), [legalEntityResponse, parentLegalEntity, taskType, trackingConfig]);
26604
27771
  const summaryData = useMemo(() => ({
26605
27772
  data: formatDataForSummary$1(currentState.data, forms2, derivedProps == null ? void 0 : derivedProps.labels, i18n),
26606
27773
  omittedKeys: ["operationalAddressIsSame"]
@@ -26638,32 +27805,78 @@ function BusinessDetailsDropinComponent({
26638
27805
  formRef,
26639
27806
  onSubmit: submitTask
26640
27807
  });
26641
- useEffect(() => {
26642
- var _a2;
26643
- const documentIds = ((_a2 = legalEntityResponse == null ? void 0 : legalEntityResponse.documentDetails) == null ? void 0 : _a2.map((documentReference) => documentReference.id)) || [];
26644
- if (!documentIds.length) return;
26645
- documentUtils.fetchDocuments(documentIds, legalEntityResponse.id).then(() => {
26646
- setInitialData({
26647
- ...initialData,
26648
- ...mapApiDocumentToBusinessDetailsDocuments(legalEntityResponse.id)
26649
- });
26650
- }).catch(() => showToast({
26651
- label: i18n.get("failedToFetchRelevantDocuments"),
26652
- type: "error"
26653
- }));
26654
- }, []);
26655
- useEffect(() => {
26656
- userEvents.addPageView("Business details dropin");
26657
- userEvents.addEvent(BusinessDetailsEvents.TASK_START, {
26658
- segmentation: baseTrackingPayload
26659
- });
26660
- }, [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]);
26661
27873
  return jsx(FormWrapper, {
26662
27874
  taskName: taskName ?? "businessDetails",
26663
- gotoFormByFormIndex,
27875
+ gotoFormByFormIndex: goToForm,
26664
27876
  hideDropinLayout,
26665
- hideHomeButton,
26666
- hideBackButton,
27877
+ hideHomeButton: hideHome,
27878
+ hideBackButton: hideBack,
27879
+ hideNextButton: showBusinessSelection,
26667
27880
  loadingStatus,
26668
27881
  forms: forms2,
26669
27882
  activeForm,
@@ -26675,8 +27888,9 @@ function BusinessDetailsDropinComponent({
26675
27888
  summary: summaryData,
26676
27889
  homeButtonLabel,
26677
27890
  nextButtonLabel,
26678
- handleNextClick,
26679
- handleBackClick,
27891
+ backButtonLabel: i18n.get("goBack"),
27892
+ handleNextClick: nextClick,
27893
+ handleBackClick: backClick,
26680
27894
  handleHomeClick,
26681
27895
  children: jsx(BusinessDetailsComponent, {
26682
27896
  ...derivedProps,
@@ -26689,6 +27903,19 @@ function BusinessDetailsDropinComponent({
26689
27903
  isTopLevelEntity: taskType === TaskTypes.BUSINESS_DETAILS,
26690
27904
  onTypeSwitch,
26691
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,
26692
27919
  handleAddressSearch,
26693
27920
  handleFindAddress,
26694
27921
  handleCompanyIndexSearch,
@@ -27125,247 +28352,6 @@ function CompanyDropinComponent({
27125
28352
  })
27126
28353
  });
27127
28354
  }
27128
- var CompanySearchEvents = /* @__PURE__ */ ((CompanySearchEvents2) => {
27129
- CompanySearchEvents2["TASK_START"] = "CompanySearch_TaskStarted";
27130
- CompanySearchEvents2["TASK_SUBMIT"] = "CompanySearch_TaskSubmitted";
27131
- CompanySearchEvents2["TASK_SAVED"] = "CompanySearch_TaskSaved";
27132
- CompanySearchEvents2["TASK_ERROR"] = "CompanySearch_TaskError";
27133
- CompanySearchEvents2["DOCUMENTS_SAVED"] = "CompanySearch_DocumentsSaved";
27134
- CompanySearchEvents2["DOCUMENTS_ERROR"] = "CompanySearch_DocumentsError";
27135
- CompanySearchEvents2["NO_SEARCH_RESULTS"] = "CompanySearch_NoSearchResults";
27136
- CompanySearchEvents2["TIN_MATCH"] = "CompanySearch_TinMatch";
27137
- CompanySearchEvents2["TIN_NO_MATCH"] = "CompanySearch_TinNoMatch";
27138
- CompanySearchEvents2["SELECTION_RESET"] = "CompanySearch_CompanySelectionReset";
27139
- CompanySearchEvents2["SELECTION_ERROR"] = "CompanySearch_CompanySelectionError";
27140
- return CompanySearchEvents2;
27141
- })(CompanySearchEvents || {});
27142
- const logger$k = createLogger("useCompanySearch");
27143
- const LOW_RISK_COMPANY_DATA_COMPLIANCE_WINDOW = 1577664e5;
27144
- function useCompanySearch({
27145
- defaultData,
27146
- legalCompanyName: legalCompanyName2,
27147
- country: country2,
27148
- stateOrProvince: stateOrProvince2,
27149
- taxIdentificationNumber: taxIdentificationNumber2,
27150
- canVerify,
27151
- limit = 15,
27152
- baseTrackingPayload,
27153
- setKompanyAddress,
27154
- handleChangeFor,
27155
- handleCompanyIndexSearch,
27156
- handleCompanyDeepSearch,
27157
- handleGetCompanyDataset,
27158
- handleRefreshCompanyDataset,
27159
- handleVerifyTin
27160
- }) {
27161
- const [companiesList, setCompaniesList] = useState([]);
27162
- const [selectedCompanyId, setSelectedCompanyId] = useState();
27163
- const [verifiedCompany, setVerifiedCompany] = useState();
27164
- const [status, setStatus] = useState("idle");
27165
- const [error, setError] = useState();
27166
- const isLastUpdateDateCompliant = (company2) => {
27167
- const date = (/* @__PURE__ */ new Date()).toDateString();
27168
- return company2.lastUpdate ? Date.parse(date) - Date.parse(company2.lastUpdate) < LOW_RISK_COMPANY_DATA_COMPLIANCE_WINDOW : false;
27169
- };
27170
- const searchCompanies = useMemo(() => debounce(async ({
27171
- companyName: companyName2,
27172
- companyCountry,
27173
- companyState,
27174
- resultsLimit,
27175
- deepSearch
27176
- }) => {
27177
- try {
27178
- if (!deepSearch) return;
27179
- setStatus("loading");
27180
- setCompaniesList([]);
27181
- const {
27182
- results: deepSearchResults
27183
- } = await deepSearch({
27184
- text: companyName2,
27185
- country: companyCountry,
27186
- state: companyState,
27187
- limit: resultsLimit
27188
- });
27189
- return setCompaniesList(deepSearchResults);
27190
- } catch (e) {
27191
- setStatus("error");
27192
- setError(e);
27193
- } finally {
27194
- setStatus((prevStatus) => prevStatus !== "error" ? "loaded" : prevStatus);
27195
- }
27196
- }, 700), []);
27197
- const retrySearch = useCallback(async () => {
27198
- if (!legalCompanyName2 || !country2 || !stateOrProvince2) {
27199
- return setStatus("idle");
27200
- }
27201
- try {
27202
- if (!handleCompanyDeepSearch) return;
27203
- setStatus("loading");
27204
- setSelectedCompanyId(void 0);
27205
- const {
27206
- results: deepSearchResults
27207
- } = await handleCompanyDeepSearch({
27208
- text: legalCompanyName2,
27209
- country: country2,
27210
- state: stateOrProvince2,
27211
- limit
27212
- });
27213
- return setCompaniesList(deepSearchResults);
27214
- } catch (e) {
27215
- setStatus("error");
27216
- setError(e);
27217
- } finally {
27218
- setStatus((prevStatus) => prevStatus !== "error" ? "loaded" : prevStatus);
27219
- }
27220
- }, [handleCompanyDeepSearch, country2, legalCompanyName2, limit, stateOrProvince2]);
27221
- const verify2 = useCallback(async (companyTIN, company2) => {
27222
- try {
27223
- if (!handleVerifyTin || !handleGetCompanyDataset || !handleRefreshCompanyDataset) return;
27224
- setStatus("loading");
27225
- setSelectedCompanyId(company2.id);
27226
- if (!canVerify || !companyTIN) {
27227
- return setStatus("error");
27228
- }
27229
- const {
27230
- matched
27231
- } = await handleVerifyTin({
27232
- tin: companyTIN,
27233
- name: company2.name
27234
- });
27235
- if (!matched) {
27236
- setStatus("error");
27237
- userEvents.addEvent(CompanySearchEvents.TIN_NO_MATCH, {
27238
- segmentation: {
27239
- ...baseTrackingPayload
27240
- }
27241
- });
27242
- return setError({
27243
- message: "TIN does not match the selected company",
27244
- response: {
27245
- status: 200
27246
- }
27247
- });
27248
- }
27249
- userEvents.addEvent(CompanySearchEvents.TIN_MATCH, {
27250
- segmentation: {
27251
- ...baseTrackingPayload
27252
- }
27253
- });
27254
- const companyData = isLastUpdateDateCompliant(company2) ? await handleGetCompanyDataset({
27255
- companyId: company2.id,
27256
- country: country2
27257
- }) : await handleRefreshCompanyDataset({
27258
- companyId: company2.id,
27259
- country: country2
27260
- });
27261
- return setVerifiedCompany({
27262
- ...companyData,
27263
- state: companyData.state ?? stateOrProvince2
27264
- });
27265
- } catch (e) {
27266
- logger$k.error(e);
27267
- setError(e);
27268
- setStatus("error");
27269
- } finally {
27270
- setStatus((prevStatus) => prevStatus !== "error" ? "loaded" : prevStatus);
27271
- }
27272
- }, [handleVerifyTin, handleGetCompanyDataset, handleRefreshCompanyDataset, canVerify, country2, stateOrProvince2, baseTrackingPayload]);
27273
- const reset = useCallback(() => {
27274
- setStatus("loading");
27275
- setSelectedCompanyId(void 0);
27276
- setVerifiedCompany(void 0);
27277
- setKompanyAddress(void 0);
27278
- setCompaniesList([]);
27279
- if (defaultData) {
27280
- handleChangeFor("legalCompanyName")(defaultData.legalCompanyName);
27281
- }
27282
- }, [defaultData, handleChangeFor, setKompanyAddress]);
27283
- useEffect(() => {
27284
- var _a;
27285
- setError(void 0);
27286
- const isMinLength = legalCompanyName2 && legalCompanyName2.split("").length > 3;
27287
- if (!legalCompanyName2 || !country2 || !stateOrProvince2 || !taxIdentificationNumber2 || !canVerify || !isMinLength) {
27288
- return setStatus("idle");
27289
- }
27290
- if (!verifiedCompany) {
27291
- setSelectedCompanyId(void 0);
27292
- (_a = searchCompanies({
27293
- companyName: legalCompanyName2,
27294
- companyCountry: country2,
27295
- companyState: stateOrProvince2,
27296
- indexSearch: handleCompanyIndexSearch,
27297
- deepSearch: handleCompanyDeepSearch,
27298
- resultsLimit: limit
27299
- })) == null ? void 0 : _a.catch((e) => logger$k.error(e));
27300
- }
27301
- }, [legalCompanyName2, country2, stateOrProvince2, taxIdentificationNumber2, verifiedCompany, searchCompanies, handleCompanyIndexSearch, handleCompanyDeepSearch, limit, canVerify, baseTrackingPayload]);
27302
- useEffect(() => {
27303
- setVerifiedCompany(void 0);
27304
- setSelectedCompanyId(void 0);
27305
- }, [taxIdentificationNumber2]);
27306
- useEffect(() => {
27307
- if (status !== "error") {
27308
- return setError(void 0);
27309
- }
27310
- }, [status]);
27311
- return {
27312
- results: companiesList,
27313
- selectedCompanyId,
27314
- verifiedCompany,
27315
- status,
27316
- error,
27317
- retrySearch,
27318
- verify: verify2,
27319
- reset
27320
- };
27321
- }
27322
- const mapOrganizationTypeToCompanyType = (organizationType) => {
27323
- switch (organizationType) {
27324
- case "BUSINESS":
27325
- return CompanyTypesValue.PRIVATE_COMPANY;
27326
- case "NON_PROFIT":
27327
- return CompanyTypesValue.NON_PROFIT_OR_CHARITABLE;
27328
- case "PUBLIC_COMPANY":
27329
- case "LISTED_PUBLIC_COMPANY":
27330
- return CompanyTypesValue.PUBLIC_COMPANY;
27331
- case "UNLISTED_PUBLIC_COMPANY":
27332
- return CompanyTypesValue.UNLISTED_PUBLIC_COMPANY;
27333
- case "GOVERNMENTAL_ORGANIZATION":
27334
- return CompanyTypesValue.GOVERNMENTAL_ORGANIZATION;
27335
- case "SOLE_PROPRIETOR":
27336
- return CompanyTypesValue.SOLE_PROPRIETORSHIP;
27337
- case "PARTNERSHIP_INCORPORATED":
27338
- return CompanyTypesValue.INCORPORATED_PARTNERSHIP;
27339
- case "ASSOCIATION_INCORPORATED":
27340
- return CompanyTypesValue.INCORPORATED_ASSOCIATION;
27341
- case "OTHER":
27342
- case "PARTNERSHIP":
27343
- default:
27344
- return void 0;
27345
- }
27346
- };
27347
- const mapCompanyDataResponseToFormSchema = (company2) => ({
27348
- companyBasics: {
27349
- country: company2.country,
27350
- stateOrProvince: company2.state,
27351
- legalCompanyName: company2.name
27352
- },
27353
- companyRegistrationAddress: {
27354
- registrationAddress: {
27355
- address: company2.street,
27356
- stateOrProvince: company2.state,
27357
- country: company2.country,
27358
- postalCode: company2.zipcode,
27359
- city: company2.city
27360
- }
27361
- },
27362
- companyStructure: {
27363
- entityType: mapOrganizationTypeToCompanyType(company2.organizationType)
27364
- },
27365
- companyOtherDetails: {
27366
- registrationNumber: company2.registrationNumber
27367
- }
27368
- });
27369
28355
  const CompanyLookupResultsHeader = ({
27370
28356
  results,
27371
28357
  status,
@@ -27440,9 +28426,9 @@ const LookupResultAlert = ({
27440
28426
  i18n
27441
28427
  } = useI18nContext();
27442
28428
  const iconType = {
27443
- verified: AlertTypes.SUCCESS,
27444
- warning: AlertTypes.WARNING,
27445
- error: AlertTypes.ERROR
28429
+ verified: "success",
28430
+ warning: "warning",
28431
+ error: "error"
27446
28432
  };
27447
28433
  return jsxs("div", {
27448
28434
  className: `adyen-company-lookup-result__alert adyen-company-lookup-result__alert--${type}`,
@@ -28401,133 +29387,7 @@ const formatDataForSummary = (data, forms2, labels2, i18n) => {
28401
29387
  }
28402
29388
  }, {});
28403
29389
  };
28404
- const mapCompanySearchDocumentToApiDocument = async (data, entityId) => {
28405
- var _a, _b, _c;
28406
- const {
28407
- companyRegistrationDocument: companyRegistrationDocument2,
28408
- companyTaxDocument
28409
- } = data;
28410
- const entityType2 = "legalEntity";
28411
- 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;
28412
- const documents2 = await Promise.all([
28413
- createDocumentRequest({
28414
- entityId,
28415
- entityType: entityType2,
28416
- documentType: DocumentType.REGISTRATION_DOCUMENT,
28417
- page1: (_b = companyRegistrationDocument2 == null ? void 0 : companyRegistrationDocument2.registrationDocument) == null ? void 0 : _b[0]
28418
- }),
28419
- createDocumentRequest({
28420
- entityId,
28421
- entityType: entityType2,
28422
- documentType: taxDocumentType,
28423
- page1: (_c = companyTaxDocument == null ? void 0 : companyTaxDocument.taxDocument) == null ? void 0 : _c[0]
28424
- })
28425
- // Add this when we need shareholder document functionality
28426
- // createDocumentRequest(legalEntityId, 'legalEntity', DocumentType.SHAREHOLDER_DOCUMENT, shareholderDocument?.[0])
28427
- ]);
28428
- return documents2.filter(Boolean);
28429
- };
28430
- const mapCompanySearchSchemaToLegalEntity = (data) => {
28431
- var _a, _b, _c, _d, _e;
28432
- const requestObj = {
28433
- ...formatObject(data, companySearchApiKeyMapping)
28434
- };
28435
- if (requestObj.organization) {
28436
- if (((_a = data.companyBasics) == null ? void 0 : _a.taxInformation) || ((_b = data.companyOtherDetails) == null ? void 0 : _b.taxInformation)) {
28437
- 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;
28438
- }
28439
- if (requestObj.organization.vatAbsenceReason) {
28440
- requestObj.organization.vatNumber = "";
28441
- }
28442
- }
28443
- requestObj.type = LegalEntityType.ORGANIZATION;
28444
- return requestObj;
28445
- };
28446
- const mapApiDocumentToCompanySearchDocuments = (entityId) => {
28447
- const registrationDocument2 = getDocument$1(entityId, DocumentType.REGISTRATION_DOCUMENT) ?? null;
28448
- const taxDocument2 = getDocument$1(entityId, DocumentType.VAT_DOCUMENT) ?? getDocument$1(entityId, DocumentType.PROOF_OF_ORGANIZATION_TAX_INFO) ?? null;
28449
- return {
28450
- companyRegistrationDocument: registrationDocument2 ? {
28451
- registrationDocument: [mapExistingFile(getPageName(registrationDocument2))]
28452
- } : void 0,
28453
- companyTaxDocument: taxDocument2 ? {
28454
- taxDocument: [mapExistingFile(getPageName(taxDocument2))]
28455
- } : void 0
28456
- };
28457
- };
28458
- const mapLegalEntityToCompanySearchSchema = (legalEntity, isChangingType, accountHolder2) => {
28459
- const companySearchSchema = {
28460
- companyBasics: {},
28461
- companyRegistrationAddress: {},
28462
- companyStructure: {},
28463
- companyOtherDetails: {},
28464
- companyRegistrationDocument: {},
28465
- companyTaxDocument: {},
28466
- ...formatObject(legalEntity, companySearchComponentsKeyMapping)
28467
- };
28468
- const {
28469
- companyRegistrationDocument: companyRegistrationDocument2,
28470
- companyTaxDocument
28471
- } = mapApiDocumentToCompanySearchDocuments(legalEntity == null ? void 0 : legalEntity.id);
28472
- return entriesOf(companySearchSchema).reduce((componentData, [key, value]) => {
28473
- var _a, _b, _c, _d, _e, _f, _g;
28474
- switch (key) {
28475
- case "companyBasics": {
28476
- return {
28477
- ...componentData,
28478
- [key]: value
28479
- };
28480
- }
28481
- case "companyRegistrationAddress": {
28482
- return {
28483
- ...componentData,
28484
- [key]: {
28485
- ...value,
28486
- operationalAddressIsSame: ((_a = legalEntity.organization) == null ? void 0 : _a.principalPlaceOfBusiness) ? operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_NOT_SAME : operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_SAME
28487
- }
28488
- };
28489
- }
28490
- case "companyOtherDetails": {
28491
- return {
28492
- ...componentData,
28493
- [key]: {
28494
- ...value,
28495
- 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,
28496
- 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)
28497
- }
28498
- };
28499
- }
28500
- case "companyStructure": {
28501
- return {
28502
- ...componentData,
28503
- [key]: {
28504
- ...value,
28505
- accountHolder: getDefaultAccountHolderType(legalEntity, isChangingType, accountHolder2)
28506
- }
28507
- };
28508
- }
28509
- case "companyRegistrationDocument": {
28510
- return {
28511
- ...componentData,
28512
- [key]: {
28513
- ...companyRegistrationDocument2
28514
- }
28515
- };
28516
- }
28517
- case "companyTaxDocument": {
28518
- return {
28519
- ...componentData,
28520
- [key]: {
28521
- ...companyTaxDocument
28522
- }
28523
- };
28524
- }
28525
- default:
28526
- return componentData;
28527
- }
28528
- }, {});
28529
- };
28530
- const logger$j = createLogger("useFormTaskSubmit");
29390
+ const logger$k = createLogger("useFormTaskSubmit");
28531
29391
  function useCompanySearchTaskSubmit({
28532
29392
  task,
28533
29393
  forms: forms2,
@@ -28570,7 +29430,7 @@ function useCompanySearchTaskSubmit({
28570
29430
  });
28571
29431
  }
28572
29432
  } catch (e) {
28573
- logger$j.error(e);
29433
+ logger$k.error(e);
28574
29434
  userEvents.addEvent(CompanySearchEvents.DOCUMENTS_ERROR, {
28575
29435
  segmentation: {
28576
29436
  ...baseTrackingPayload,
@@ -28622,7 +29482,7 @@ function useCompanySearchTaskSubmit({
28622
29482
  ...trackingPayload
28623
29483
  }
28624
29484
  });
28625
- logger$j.log(submittedLegalEntity);
29485
+ logger$k.log(submittedLegalEntity);
28626
29486
  clearToasts();
28627
29487
  onExternalSubmit == null ? void 0 : onExternalSubmit(data);
28628
29488
  } catch (e) {
@@ -28646,7 +29506,7 @@ function useCompanySearchTaskSubmit({
28646
29506
  type: "error"
28647
29507
  });
28648
29508
  }
28649
- logger$j.error(e);
29509
+ logger$k.error(e);
28650
29510
  userEvents.addEvent(CompanySearchEvents.TASK_ERROR, {
28651
29511
  segmentation: {
28652
29512
  ...baseTrackingPayload,
@@ -29003,7 +29863,9 @@ function CompanySearchDropinComponent({
29003
29863
  })
29004
29864
  });
29005
29865
  }
29006
- const logger$i = createLogger("useLocalStorage");
29866
+ const IgnoreLocalStorageContext = createContext(false);
29867
+ const useIgnoreLocalStorage = () => useContext(IgnoreLocalStorageContext);
29868
+ const logger$j = createLogger("useLocalStorage");
29007
29869
  const useLocalStorage = (key, defaultValue, options) => {
29008
29870
  const {
29009
29871
  serializer,
@@ -29015,20 +29877,21 @@ const useLocalStorage = (key, defaultValue, options) => {
29015
29877
  syncData: true,
29016
29878
  ...options
29017
29879
  }), [options]);
29880
+ const ignoreLocalStorage = useIgnoreLocalStorage() || typeof window === "undefined";
29018
29881
  const rawValueRef = useRef(null);
29019
29882
  const [value, setValue] = useState(() => {
29020
- if (typeof window === "undefined") return defaultValue;
29883
+ if (ignoreLocalStorage) return defaultValue;
29021
29884
  try {
29022
29885
  rawValueRef.current = window.localStorage.getItem(key);
29023
29886
  const res = rawValueRef.current ? parser(rawValueRef.current) : defaultValue;
29024
29887
  return res;
29025
29888
  } catch (err) {
29026
- logger$i.error(err);
29889
+ logger$j.error(err);
29027
29890
  return defaultValue;
29028
29891
  }
29029
29892
  });
29030
29893
  useEffect(() => {
29031
- if (typeof window === "undefined") return;
29894
+ if (ignoreLocalStorage) return;
29032
29895
  const updateLocalStorage = () => {
29033
29896
  if (value !== void 0) {
29034
29897
  const newValue = serializer(value);
@@ -29054,9 +29917,9 @@ const useLocalStorage = (key, defaultValue, options) => {
29054
29917
  try {
29055
29918
  updateLocalStorage();
29056
29919
  } catch (err) {
29057
- logger$i.error(err);
29920
+ logger$j.error(err);
29058
29921
  }
29059
- }, [value]);
29922
+ }, [value, ignoreLocalStorage]);
29060
29923
  useEffect(() => {
29061
29924
  if (!syncData) return;
29062
29925
  const handleStorageChange = (event) => {
@@ -29067,13 +29930,13 @@ const useLocalStorage = (key, defaultValue, options) => {
29067
29930
  setValue(event.newValue ? parser(event.newValue) : void 0);
29068
29931
  }
29069
29932
  } catch (err) {
29070
- logger$i.error(err);
29933
+ logger$j.error(err);
29071
29934
  }
29072
29935
  };
29073
- if (typeof window === "undefined") return;
29936
+ if (ignoreLocalStorage) return;
29074
29937
  window.addEventListener("storage", handleStorageChange);
29075
29938
  return () => window.removeEventListener("storage", handleStorageChange);
29076
- }, [key, syncData]);
29939
+ }, [key, syncData, ignoreLocalStorage]);
29077
29940
  return [value, setValue];
29078
29941
  };
29079
29942
  const getHasSeenIntroductionStorageKey = (legalEntityId) => `COMPLETED_INTRO-${legalEntityId}`;
@@ -29125,7 +29988,7 @@ const useIsEligibleForSingpass = ({
29125
29988
  const isVanillaIndividual = legalEntityType === LegalEntityType.INDIVIDUAL && !hasSoleProprietor;
29126
29989
  return isVanillaOrganization && isSingpassForCompaniesEnabled || isVanillaIndividual && isSingpassForIndividualsEnabled;
29127
29990
  };
29128
- const logger$h = createLogger("useAssociatedLegalArrangement");
29991
+ const logger$i = createLogger("useAssociatedLegalArrangement");
29129
29992
  function useAssociatedLegalArrangement({
29130
29993
  rootLegalEntity,
29131
29994
  getLegalEntity: getLegalEntity2
@@ -29136,7 +29999,7 @@ function useAssociatedLegalArrangement({
29136
29999
  var _a;
29137
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);
29138
30001
  if (foundEntity == null ? void 0 : foundEntity.legalEntityId) {
29139
- 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);
29140
30003
  }
29141
30004
  }, [getAssociatedEntity, rootLegalEntity == null ? void 0 : rootLegalEntity.entityAssociations]);
29142
30005
  useEffect(() => {
@@ -29158,7 +30021,7 @@ const useCanSeeEntitySelection = (legalEntityId) => {
29158
30021
  setCanSeeEntitySelection: setCanSeeEntitySelectionIntoLocalStorage
29159
30022
  };
29160
30023
  };
29161
- const logger$g = createLogger("useExemptSettlor");
30024
+ const logger$h = createLogger("useExemptSettlor");
29162
30025
  const useExemptSettlor = ({
29163
30026
  trust: trust2,
29164
30027
  handleGetLegalEntity
@@ -29171,7 +30034,7 @@ const useExemptSettlor = ({
29171
30034
  }, [handleGetLegalEntity]);
29172
30035
  useEffect(() => {
29173
30036
  if (!(trust2 == null ? void 0 : trust2.trust)) return;
29174
- updateExemptSettlor(trust2).catch(logger$g.error);
30037
+ updateExemptSettlor(trust2).catch(logger$h.error);
29175
30038
  }, [trust2, updateExemptSettlor]);
29176
30039
  return exemptSettlor;
29177
30040
  };
@@ -29196,11 +30059,6 @@ function useSalesChannelsSettings() {
29196
30059
  return settings;
29197
30060
  }, [isSettingEnabled]);
29198
30061
  }
29199
- var TrustedFieldsProvider = /* @__PURE__ */ ((TrustedFieldsProvider2) => {
29200
- TrustedFieldsProvider2["SINGPASS"] = "singpass";
29201
- TrustedFieldsProvider2["KOMPANY"] = "kompany";
29202
- return TrustedFieldsProvider2;
29203
- })(TrustedFieldsProvider || {});
29204
30062
  const downloadFile = async (base64, filename) => {
29205
30063
  saveBlobAsFile(base64ToBlob(base64), filename);
29206
30064
  };
@@ -29493,7 +30351,7 @@ function AccountSetupRejected() {
29493
30351
  const content = jsxs("div", {
29494
30352
  children: [jsx(AlertIcon, {
29495
30353
  className: "adyen-kyc-alert-error-icon",
29496
- type: AlertTypes.ERROR
30354
+ type: "error"
29497
30355
  }), jsx(FormHeader, {
29498
30356
  heading: i18n.get("cantSetUpAcccount")
29499
30357
  }), jsx("span", {
@@ -29936,15 +30794,6 @@ const iconStatus = (current, min, max) => {
29936
30794
  return isWithinConditionalRange ? "conditionalFinished" : "conditionalEmpty";
29937
30795
  };
29938
30796
  const getEntityStatusRuleDescription = (country2, currentTask, entityLabel) => currentTask === TaskTypes.TRUST_MEMBER_OVERVIEW ? TRUST_DEFAULT_DESCRIPTIONS_MAP[entityLabel] : getDecisionMakerDescriptionMap(country2)[entityLabel];
29939
- function CardGroup({
29940
- className,
29941
- children
29942
- }) {
29943
- return jsx("section", {
29944
- className: cx("adyen-kyc-card-group", className),
29945
- children
29946
- });
29947
- }
29948
30797
  const Status = ({
29949
30798
  text,
29950
30799
  className,
@@ -30093,7 +30942,7 @@ const VerificationErrorAlert = ({
30093
30942
  return jsx(Alert, {
30094
30943
  className,
30095
30944
  hasCloseButton: false,
30096
- type: AlertTypes.ERROR,
30945
+ type: "error",
30097
30946
  title: `${childErrorMsg}. ${remediationActionMsg}`,
30098
30947
  children
30099
30948
  });
@@ -30103,66 +30952,11 @@ const VerificationErrorAlert = ({
30103
30952
  return jsx(Alert, {
30104
30953
  className,
30105
30954
  hasCloseButton: false,
30106
- type: AlertTypes.ERROR,
30955
+ type: "error",
30107
30956
  title: i18n.get("verificationErrorMessage"),
30108
30957
  children
30109
30958
  });
30110
30959
  };
30111
- function Card({
30112
- className,
30113
- children,
30114
- stateful,
30115
- active,
30116
- disabled,
30117
- warning,
30118
- warningMessage,
30119
- title,
30120
- subTitle,
30121
- onClick,
30122
- onKeyDown
30123
- }) {
30124
- const classNames = cx("adyen-kyc-card", className, {
30125
- "adyen-kyc-card--stateful": stateful,
30126
- "adyen-kyc-card--active": stateful && active,
30127
- "adyen-kyc-card--disabled": disabled
30128
- });
30129
- const tabIndex = stateful ? 0 : void 0;
30130
- const role2 = stateful ? "button" : void 0;
30131
- const onClickHandler = (e) => {
30132
- if (disabled) {
30133
- return;
30134
- }
30135
- onClick == null ? void 0 : onClick(e);
30136
- };
30137
- return jsxs("article", {
30138
- className: classNames,
30139
- tabIndex,
30140
- role: role2,
30141
- onClick: onClickHandler,
30142
- onKeyDown,
30143
- children: [title && jsxs("header", {
30144
- className: "adyen-kyc-card__header",
30145
- children: [jsx(Typography, {
30146
- el: "h4",
30147
- variant: "title",
30148
- children: title
30149
- }), subTitle && jsx(Typography, {
30150
- el: "p",
30151
- variant: "body",
30152
- children: subTitle
30153
- })]
30154
- }), jsx("div", {
30155
- role: "region",
30156
- className: "adyen-kyc-card__body",
30157
- children
30158
- }), warning && jsx(Alert, {
30159
- className: "adyen-kyc-card__warning",
30160
- title: warningMessage,
30161
- hasCloseButton: false,
30162
- type: AlertTypes.WARNING
30163
- })]
30164
- });
30165
- }
30166
30960
  function useClickAwayListener(ref, onClickAway) {
30167
30961
  const handleClickAway = useCallback((event) => {
30168
30962
  if (ref.current && !ref.current.contains(event.target)) {
@@ -30550,7 +31344,7 @@ const DecisionMakersComponent = ({
30550
31344
  }
30551
31345
  });
30552
31346
  showToast({
30553
- type: "error",
31347
+ type: "success",
30554
31348
  label: i18n.get("successFullyRemovedDecisionMaker")
30555
31349
  });
30556
31350
  } catch (e) {
@@ -30600,7 +31394,7 @@ const DecisionMakersComponent = ({
30600
31394
  className: "adyen-kyc-decision-makers__warning",
30601
31395
  title: remediationMessages.DECISION_MAKER,
30602
31396
  hasCloseButton: false,
30603
- type: AlertTypes.WARNING
31397
+ type: "warning"
30604
31398
  }), (uniqueDecisionMakers == null ? void 0 : uniqueDecisionMakers.length) > 0 ? jsx(CardGroup, {
30605
31399
  children: uniqueDecisionMakers.map((decisionMaker2) => jsx(EntityAssociation, {
30606
31400
  types: decisionMaker2.types,
@@ -31398,7 +32192,6 @@ const TaskListItem = ({
31398
32192
  handleIsRemoveDisabled
31399
32193
  })
31400
32194
  }) : jsx(Icon, {
31401
- className: "adyen-kyc-u-color-grey-60",
31402
32195
  name: "chevron-right"
31403
32196
  })]
31404
32197
  })]
@@ -31677,7 +32470,7 @@ function TaskListComponent({
31677
32470
  disabled: !canAddPayoutAccount,
31678
32471
  children: [jsx(Icon, {
31679
32472
  name: "plus",
31680
- className: "adyen-kyc-u-padding-top-2 adyen-kyc-u-margin-right-8"
32473
+ className: "adyen-task-list__card-icon "
31681
32474
  }), jsx("span", {
31682
32475
  children: isEnableNewEntryFlowEnabled ? i18n.get("addExtraBankAccount") : i18n.get(hasPayinTaskNotPayout ? "addExtraPayinAccount" : "addExtraPayoutAccount")
31683
32476
  })]
@@ -31772,7 +32565,7 @@ const CompanyTrustMemberTaskItem = ({
31772
32565
  })
31773
32566
  }];
31774
32567
  const infoContent = companyTrustMember.ownerId ? void 0 : jsx(Alert, {
31775
- type: AlertTypes.BASIC,
32568
+ type: "basic",
31776
32569
  hasCloseButton: false,
31777
32570
  title: jsxs(Fragment, {
31778
32571
  children: [i18n.get("helpUsVerifyCompany"), " ", jsx(Link, {
@@ -32069,27 +32862,11 @@ const isNotEmptyBirthDateValidatorRule = {
32069
32862
  const isNotOutOfRangeBirthDateValidatorRule = {
32070
32863
  modes: ["blur"],
32071
32864
  validate: (birthDate2) => !isEmpty(birthDate2) && new Date(birthDate2) < /* @__PURE__ */ new Date(),
32072
- errorMessage: "fieldIsRequired"
32073
- };
32074
- const getAgeToday = (birthdate2) => {
32075
- const today = /* @__PURE__ */ new Date();
32076
- const todayMonth = today.getMonth();
32077
- const todayDay = today.getDate();
32078
- const bdDate = new Date(birthdate2);
32079
- const bdMonth = bdDate.getMonth();
32080
- const yearDifference = today.getFullYear() - bdDate.getFullYear();
32081
- if (todayMonth > bdMonth) {
32082
- return yearDifference;
32083
- }
32084
- if (todayMonth === bdMonth && todayDay >= bdDate.getUTCDate()) {
32085
- return yearDifference;
32086
- }
32087
- return yearDifference - 1;
32865
+ errorMessage: "invalidDateOfBirth"
32088
32866
  };
32089
- const isAgeAtLeastXYearsOld = (age, x) => age >= x;
32090
32867
  const buildMinimumAgeValidationRule = (minimumAge) => ({
32091
32868
  modes: ["blur"],
32092
- validate: (birthDate2) => !!birthDate2 && isAgeAtLeastXYearsOld(getAgeToday(birthDate2), minimumAge),
32869
+ validate: (birthDate2) => !!birthDate2 && getAgeToday(birthDate2) >= minimumAge,
32093
32870
  errorMessage: {
32094
32871
  key: "youMustXYearsOldToContinue",
32095
32872
  values: {
@@ -32101,7 +32878,7 @@ const getCountrySpecificMinimumAgeValidationRule = (country2) => {
32101
32878
  if (!country2) {
32102
32879
  return buildMinimumAgeValidationRule(13);
32103
32880
  }
32104
- if (eeaCountries.some((c) => c === country2)) {
32881
+ if ([...euCountries, CountryCodes.UnitedKingdom, CountryCodes.Switzerland].some((c) => c === country2)) {
32105
32882
  return buildMinimumAgeValidationRule(16);
32106
32883
  }
32107
32884
  switch (country2) {
@@ -32621,21 +33398,26 @@ function IndividualDropinComponent({
32621
33398
  })
32622
33399
  });
32623
33400
  }
33401
+ const logger$g = createLogger("useBankConfigurationHandler");
32624
33402
  const useBankConfigurationHandlers = ({
32625
33403
  isEmbeddedDropin,
32626
33404
  handleGetBankVerificationVendors,
32627
33405
  bankAccountCountry,
32628
33406
  getConfiguration: getConfiguration2,
32629
33407
  legalEntityType,
32630
- capabilities
33408
+ capabilities,
33409
+ setLoadingStatus
32631
33410
  }) => {
32632
33411
  const [bankVerificationVendorsResponse, setBankVerificationVendorsResponse] = useState();
32633
33412
  const callBankVerificationVendorsUpfront = isEmbeddedDropin && handleGetBankVerificationVendors;
32634
33413
  useEffect(() => {
33414
+ setLoadingStatus("loading");
32635
33415
  (async () => {
32636
33416
  const bankVerificationVendorsResponse2 = callBankVerificationVendorsUpfront ? await handleGetBankVerificationVendors(bankAccountCountry) : [];
32637
33417
  setBankVerificationVendorsResponse(bankVerificationVendorsResponse2);
32638
- })();
33418
+ })().catch(logger$g.error).finally(() => {
33419
+ setLoadingStatus("success");
33420
+ });
32639
33421
  }, [bankAccountCountry]);
32640
33422
  const getConfigurationData = useCallback(async () => {
32641
33423
  var _a;
@@ -32815,6 +33597,8 @@ function PayoutDetailsDropinComponent({
32815
33597
  const [skipSubmit, setSkipSubmit] = useState(false);
32816
33598
  const [hideOnHomeButton, setHideHomeButton] = useState(false);
32817
33599
  const [loadingStatus, setLoadingStatus] = useState("success");
33600
+ const [configurationLoadingStatus, setConfigurationLoadingStatus] = useState("success");
33601
+ const [bankVendorsLoadingStatus, setBankVendorsLoadingStatus] = useState("success");
32818
33602
  const [data, setData] = useState(prefilledData);
32819
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));
32820
33604
  const [accountDetailsFromInput, setAccountDetailsFromInput] = useState(prefilledData.payoutAccountDetails);
@@ -32851,7 +33635,8 @@ function PayoutDetailsDropinComponent({
32851
33635
  bankAccountCountry,
32852
33636
  getConfiguration: getConfiguration2,
32853
33637
  legalEntityType: legalEntityResponse.type,
32854
- capabilities
33638
+ capabilities,
33639
+ setLoadingStatus: setConfigurationLoadingStatus
32855
33640
  });
32856
33641
  const getPayoutAccountFormatData = useCallback(async () => getAccountFormatsForCountry(bankAccountCountry), [bankAccountCountry]);
32857
33642
  const {
@@ -32863,7 +33648,7 @@ function PayoutDetailsDropinComponent({
32863
33648
  getConfigurationData,
32864
33649
  getPayoutAccountFormatData,
32865
33650
  instantVerificationEnabled,
32866
- setLoadingStatus,
33651
+ setLoadingStatus: setBankVendorsLoadingStatus,
32867
33652
  country: bankAccountCountry,
32868
33653
  existingBankAccountFormat
32869
33654
  });
@@ -32883,6 +33668,7 @@ function PayoutDetailsDropinComponent({
32883
33668
  }), isSettingEnabled(SettingNames.AllowIntraRegionCrossBorderPayout), isExperimentEnabled("EnableNewEntryFlow"));
32884
33669
  }, [bankVerificationVendors]);
32885
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);
32886
33672
  const forms2 = useMemo(() => {
32887
33673
  const requiredForms = getRequiredForms(payoutDetailsSteps, derivedProps == null ? void 0 : derivedProps.requiredFields, derivedProps == null ? void 0 : derivedProps.optionalFields);
32888
33674
  return addValidityToForms(requiredForms, formValidity, problems);
@@ -35075,6 +35861,17 @@ const useNavigation = ({
35075
35861
  setTaskHistory(taskHistory.slice(0, -1 * stepCount));
35076
35862
  onNavigate == null ? void 0 : onNavigate(prevTask);
35077
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]);
35078
35875
  useEffect(() => {
35079
35876
  const pushedTask = taskHistory.at(-1);
35080
35877
  if (pushedTask === "default") {
@@ -37409,7 +38206,7 @@ const highExposureCompanyDetailsValidations = {
37409
38206
  },
37410
38207
  legalForm: {
37411
38208
  modes: ["blur"],
37412
- validate: (legalForm) => !isEmpty(legalForm),
38209
+ validate: (legalForm2) => !isEmpty(legalForm2),
37413
38210
  errorMessage: "fieldIsRequired"
37414
38211
  },
37415
38212
  naceCode: {
@@ -38533,7 +39330,7 @@ function ViewVerificationStatusComponent({
38533
39330
  return jsx(Alert, {
38534
39331
  title: i18n.get(alertContent),
38535
39332
  hasCloseButton: false,
38536
- type: AlertTypes.ERROR
39333
+ type: "error"
38537
39334
  });
38538
39335
  }
38539
39336
  if (content) {
@@ -39036,7 +39833,7 @@ const ConfigurationApiProvider = ({
39036
39833
  isEmbeddedDropin,
39037
39834
  loadingContext
39038
39835
  } = authContext;
39039
- const sdkVersion = "3.21.5";
39836
+ const sdkVersion = "3.22.1";
39040
39837
  useAnalytics({
39041
39838
  onUserEvent,
39042
39839
  legalEntityId: rootLegalEntityId,
@@ -39454,7 +40251,7 @@ const Toast = ({
39454
40251
  "aria-labelledby": labelId,
39455
40252
  children: [isLoading && jsx("div", {
39456
40253
  className: "adyen-kyc-toast__loader",
39457
- children: jsx(Spinner, {
40254
+ children: jsx(Loader, {
39458
40255
  size: "small"
39459
40256
  })
39460
40257
  }), jsxs("div", {
@@ -39654,10 +40451,10 @@ class UIElement extends BaseElement {
39654
40451
  refreshExpiry: this.props.refreshExpiry,
39655
40452
  eventEmitter: this.eventEmitter,
39656
40453
  children: jsx("div", {
39657
- className: "adyen-kyc-u-width-full",
40454
+ className: "adyen-kyc-ui-element-container-wrapper",
39658
40455
  children: jsx(AutoResizer, {
39659
40456
  children: jsx("div", {
39660
- className: "adyen-kyc-dropin-container adyen-kyc-u-position-relative",
40457
+ className: "adyen-kyc-ui-element-container",
39661
40458
  children: jsx(ToastContextProvider, {
39662
40459
  children: jsx(StateProvider, {
39663
40460
  children: jsx(Component, {