@adyen/kyc-components 2.47.1 → 2.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/dist/es/adyen-kyc-components.es.js +1739 -930
  2. package/dist/es/{arrow-right-DF4Qe-8E.js → arrow-right-C4o8oS1C.js} +1 -1
  3. package/dist/es/{chevron-down-BzENwYSf.js → chevron-down-C8-1xmDI.js} +1 -1
  4. package/dist/es/chevron-left-DSyI3arz.js +11 -0
  5. package/dist/es/{chevron-right-DczMHcvL.js → chevron-right-BDZzxAre.js} +1 -1
  6. package/dist/es/{cross-BadGfrgB.js → cross-D-SQig6J.js} +1 -1
  7. package/dist/es/{download-DGC5_Bxe.js → download-COfxdarq.js} +1 -1
  8. package/dist/style.css +380 -2127
  9. package/dist/types/components/AdditionalInformation/VerifiedBusinessCard.d.ts +7 -0
  10. package/dist/types/components/AdditionalInformation/component/AdditionalInformationComponent.d.ts +1 -1
  11. package/dist/types/components/AdditionalInformation/types.d.ts +4 -0
  12. package/dist/types/components/BasicInformation/component/BasicInformationComponent.d.ts +1 -1
  13. package/dist/types/components/BasicInformation/types.d.ts +2 -8
  14. package/dist/types/components/BusinessDetails/component/BusinessDetailsComponent.d.ts +1 -0
  15. package/dist/types/components/BusinessDetails/forms.d.ts +1 -2
  16. package/dist/types/components/BusinessDetails/types.d.ts +15 -0
  17. package/dist/types/components/BusinessSelection/BusinessInformationCard.d.ts +16 -0
  18. package/dist/types/components/BusinessSelection/component/BusinessSelectionComponent.d.ts +3 -0
  19. package/dist/types/components/BusinessSelection/index.d.ts +1 -0
  20. package/dist/types/components/BusinessSelection/types.d.ts +25 -0
  21. package/dist/types/components/CompanyStructure/component/CompanyStructureComponent.d.ts +1 -1
  22. package/dist/types/components/CompanyStructure/types.d.ts +3 -0
  23. package/dist/types/components/Dropins/BusinessDetailsDropin/types.d.ts +2 -1
  24. package/dist/types/components/Dropins/DropinLayout/ActionBar/ActionBar.d.ts +1 -1
  25. package/dist/types/components/Dropins/DropinLayout/ActionBar/type.d.ts +1 -0
  26. package/dist/types/components/Dropins/FormNavigation/FormNavigation.d.ts +1 -2
  27. package/dist/types/components/Dropins/FormNavigation/index.d.ts +1 -1
  28. package/dist/types/components/Dropins/FormWrapper/FormWrapper.d.ts +3 -1
  29. package/dist/types/components/Individual/validators.d.ts +1 -2
  30. package/dist/types/components/RegistrationAddress/types.d.ts +2 -0
  31. package/dist/types/components/UIElement/UIElement.d.ts +22 -0
  32. package/dist/types/components/internal/Address/components/SearchAddress.d.ts +1 -1
  33. package/dist/types/components/internal/Address/types.d.ts +3 -0
  34. package/dist/types/components/internal/Alert/Alert.d.ts +1 -1
  35. package/dist/types/components/internal/Alert/types.d.ts +4 -7
  36. package/dist/types/components/internal/Card/Card.d.ts +1 -1
  37. package/dist/types/components/internal/Card/CardGroup.d.ts +1 -1
  38. package/dist/types/components/internal/Card/index.d.ts +2 -0
  39. package/dist/types/components/internal/Card/types.d.ts +2 -0
  40. package/dist/types/components/internal/DBANameField/DBANameField.d.ts +1 -1
  41. package/dist/types/components/internal/DBANameField/fieldConfig.d.ts +1 -0
  42. package/dist/types/components/internal/DBANameField/types.d.ts +1 -1
  43. package/dist/types/components/internal/Icon/Icon.d.ts +1 -0
  44. package/dist/types/components/internal/IdFieldTypeSelector/countryIdNumberTypes.d.ts +9 -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 +2 -1
  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 -2
  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
@@ -427,7 +427,7 @@ const invalidDateOfIncorporation = "Please enter a valid date of incorporation";
427
427
  const successfullyUpdatedDetails = "Successfully updated details";
428
428
  const failedToUpdateDetails = "Failed to update details";
429
429
  const idDocumentAlreadyUploaded = "Identity document has already been uploaded or is too large; try another";
430
- const bankStatementAlreadyUploaded = "Bank statement has already been uploaded, is too large, or the the account has already been added; try another";
430
+ const bankStatementAlreadyUploaded = "Bank statement has already been uploaded, is too large, or the account has already been added; try another";
431
431
  const successfullyVerifiedIdNumber = "Successfully verified %{idNumber}";
432
432
  const failedFetchingDecisionMaker = "Failed to get decision maker details";
433
433
  const fileUpload = "File upload";
@@ -976,12 +976,23 @@ const companyRegistrationDocumentFormDescription = "We need an official document
976
976
  const companyTaxDocumentFormName = "Tax document";
977
977
  const companyTaxDocumentFormHeading = "Upload a tax document";
978
978
  const companyTaxDocumentFormDescription = "We need an official document to verify your organization’s tax details.";
979
- const basicInformationFormName = "Basic information";
980
- const basicInformationFormHeading = "Basic information about your business";
981
- const basicInformationFormDescription = "To get started, fill in some information about your business so we can get you verified post-haste.";
982
- const additionalInformationFormName = "Additional information";
983
- const additionalInformationFormHeading = "Additional information about your business";
984
- 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.";
979
+ const businessSelection__heading = "Select your business";
980
+ const businessSelection__searching = "We're searching for your business - this can take a few moments";
981
+ const businessSelection__verifying = "We're processing your business details";
982
+ const businessSelection__footer = "Can't find your business?";
983
+ const businessSelection__footerButton = "Add details manually";
984
+ const businessSelection__invalidTin = "This company's TIN doesn't match yours";
985
+ const businessSelection__failedToLoad = "Business details failed to load";
986
+ const legalForm = "Legal form";
987
+ const thisIsMyBusiness = "This is my business";
988
+ const basicInformationFormName = "Basic details";
989
+ const basicInformationFormHeading = "Basic details about your business";
990
+ const additionalInformationFormName = "Additional details";
991
+ const additionalInformationFormHeading = "Additional business details";
992
+ const additionalInformationFormDescription = "To continue, we need to know a little bit more about your business and it's operations. ";
993
+ const showDetails = "Show details";
994
+ const hideDetails = "Hide details";
995
+ const showOnMap = "Show on map";
985
996
  const errorMessage_1_10 = "Information couldn’t be verified";
986
997
  const errorMessage_1_11 = "Document didn’t meet requirements";
987
998
  const errorMessage_1_12 = "Legal entity declined";
@@ -1385,6 +1396,8 @@ const ultimateParentCompanyInformation = "Ultimate parent company information";
1385
1396
  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.";
1386
1397
  const doesThisCompanyHaveLEI = "Does this company have a Legal Entity Identifier (LEI)?";
1387
1398
  const iDontKnow = "I don't know";
1399
+ const becauseYoureUnderXWeNeedToCollectInformationAboutALegalRepresentative = "Because you're under %{age}, we need to collect information about a legal representative in another step";
1400
+ const aLegalRepresentativeIsRequired = "A legal representative is required";
1388
1401
  const defaultTrans = {
1389
1402
  smartling,
1390
1403
  close,
@@ -2331,12 +2344,23 @@ const defaultTrans = {
2331
2344
  companyTaxDocumentFormName,
2332
2345
  companyTaxDocumentFormHeading,
2333
2346
  companyTaxDocumentFormDescription,
2347
+ businessSelection__heading,
2348
+ businessSelection__searching,
2349
+ businessSelection__verifying,
2350
+ businessSelection__footer,
2351
+ businessSelection__footerButton,
2352
+ businessSelection__invalidTin,
2353
+ businessSelection__failedToLoad,
2354
+ legalForm,
2355
+ thisIsMyBusiness,
2334
2356
  basicInformationFormName,
2335
2357
  basicInformationFormHeading,
2336
- basicInformationFormDescription,
2337
2358
  additionalInformationFormName,
2338
2359
  additionalInformationFormHeading,
2339
2360
  additionalInformationFormDescription,
2361
+ showDetails,
2362
+ hideDetails,
2363
+ showOnMap,
2340
2364
  errorMessage_1_10,
2341
2365
  errorMessage_1_11,
2342
2366
  errorMessage_1_12,
@@ -2741,7 +2765,9 @@ const defaultTrans = {
2741
2765
  ultimateParentCompanyInformation,
2742
2766
  inThePreviousStepOwnedByAnUltimateParentCompany,
2743
2767
  doesThisCompanyHaveLEI,
2744
- iDontKnow
2768
+ iDontKnow,
2769
+ becauseYoureUnderXWeNeedToCollectInformationAboutALegalRepresentative,
2770
+ aLegalRepresentativeIsRequired
2745
2771
  };
2746
2772
  const FALLBACK_LOCALE = "en-US";
2747
2773
  const defaultTranslation = Object.entries(defaultTrans).reduce((acc, [translationKey, translationValue]) => translationKey !== "smartling" ? {
@@ -3168,22 +3194,23 @@ const createLogger = (namespace) => {
3168
3194
  };
3169
3195
  const icons = {
3170
3196
  "arrow-left": lazy(() => import("./arrow-left-CCxYxfCP.js")),
3171
- "arrow-right": lazy(() => import("./arrow-right-DF4Qe-8E.js")),
3197
+ "arrow-right": lazy(() => import("./arrow-right-C4o8oS1C.js")),
3172
3198
  bin: lazy(() => import("./bin-CGwewvcn.js")),
3173
3199
  check: lazy(() => import("./check-CeSLN4_9.js")),
3174
3200
  checkmark: lazy(() => import("./checkmark-DEh9MPYR.js")),
3175
3201
  "checkmark-small": lazy(() => import("./checkmark-small-D_9HLctx.js")),
3176
- "chevron-down": lazy(() => import("./chevron-down-BzENwYSf.js")),
3177
- "chevron-right": lazy(() => import("./chevron-right-DczMHcvL.js")),
3202
+ "chevron-down": lazy(() => import("./chevron-down-C8-1xmDI.js")),
3203
+ "chevron-right": lazy(() => import("./chevron-right-BDZzxAre.js")),
3204
+ "chevron-left": lazy(() => import("./chevron-left-DSyI3arz.js")),
3178
3205
  "chevron-up": lazy(() => import("./chevron-up-BLtnROd5.js")),
3179
3206
  company: lazy(() => import("./company-D5_F_6SW.js")),
3180
3207
  "company-2": lazy(() => import("./company-2-JG34IScE.js")),
3181
3208
  contract: lazy(() => import("./contract-C6wDy9zU.js")),
3182
3209
  "controlling-person": lazy(() => import("./controlling-person-C4KoSyi2.js")),
3183
- cross: lazy(() => import("./cross-BadGfrgB.js")),
3210
+ cross: lazy(() => import("./cross-D-SQig6J.js")),
3184
3211
  "decision-maker": lazy(() => import("./decision-maker-Cef3-OzY.js")),
3185
3212
  document: lazy(() => import("./document-Cg4kZHpA.js")),
3186
- download: lazy(() => import("./download-DGC5_Bxe.js")),
3213
+ download: lazy(() => import("./download-COfxdarq.js")),
3187
3214
  edit: lazy(() => import("./edit--fDhojib.js")),
3188
3215
  "field-error": lazy(() => import("./field-error-WElEN1mN.js")),
3189
3216
  "info-circle": lazy(() => import("./info-circle-DkHN1ugA.js")),
@@ -3207,7 +3234,7 @@ const icons = {
3207
3234
  warning: lazy(() => import("./warning-99uFf1WU.js")),
3208
3235
  wrong: lazy(() => import("./wrong-1wvh7nZe.js"))
3209
3236
  };
3210
- const logger$y = createLogger("Icon");
3237
+ const logger$A = createLogger("Icon");
3211
3238
  const Icon = ({
3212
3239
  className,
3213
3240
  name,
@@ -3215,7 +3242,7 @@ const Icon = ({
3215
3242
  }) => {
3216
3243
  const LazyLoadedIcon = icons[name];
3217
3244
  if (!LazyLoadedIcon) {
3218
- logger$y.error(`No such icon: "${name}"`);
3245
+ logger$A.error(`No such icon: "${name}"`);
3219
3246
  return null;
3220
3247
  }
3221
3248
  return jsx("span", {
@@ -3229,14 +3256,17 @@ const Icon = ({
3229
3256
  })
3230
3257
  });
3231
3258
  };
3232
- const Spinner = ({
3259
+ const Loader = ({
3233
3260
  inline = false,
3234
- size = "large"
3261
+ size = "large",
3262
+ dot = false
3235
3263
  }) => jsx("div", {
3236
- className: `adyen-kyc-spinner__wrapper ${inline ? "adyen-kyc-spinner__wrapper--inline" : ""}`,
3264
+ className: `adyen-kyc-loader__wrapper ${inline ? "adyen-kyc-loader__wrapper--inline" : ""}`,
3237
3265
  children: jsx("div", {
3238
- className: `adyen-kyc-spinner adyen-kyc-spinner--${size}`,
3239
- role: "progressbar"
3266
+ role: "progressbar",
3267
+ className: cx("adyen-kyc-loader", `adyen-kyc-loader--${size}`, {
3268
+ "adyen-kyc-loader--dot": dot
3269
+ })
3240
3270
  })
3241
3271
  });
3242
3272
  const Button = ({
@@ -3271,7 +3301,7 @@ const Button = ({
3271
3301
  children: label
3272
3302
  }), jsx("span", {
3273
3303
  className: "adyen-kyc-button__loader-container--active",
3274
- children: jsx(Spinner, {
3304
+ children: jsx(Loader, {
3275
3305
  size: "small"
3276
3306
  })
3277
3307
  })]
@@ -3313,21 +3343,15 @@ const Button = ({
3313
3343
  const Divider = () => jsx("hr", {
3314
3344
  className: "adyen-kyc-divider"
3315
3345
  });
3316
- var AlertTypes = /* @__PURE__ */ ((AlertTypes2) => {
3317
- AlertTypes2[AlertTypes2["BASIC"] = 0] = "BASIC";
3318
- AlertTypes2[AlertTypes2["INFO"] = 1] = "INFO";
3319
- AlertTypes2[AlertTypes2["ERROR"] = 2] = "ERROR";
3320
- AlertTypes2[AlertTypes2["WARNING"] = 3] = "WARNING";
3321
- AlertTypes2[AlertTypes2["SUCCESS"] = 4] = "SUCCESS";
3322
- return AlertTypes2;
3323
- })(AlertTypes || {});
3324
3346
  const Alert = ({
3325
3347
  title,
3326
- type = AlertTypes.BASIC,
3348
+ type = "basic",
3327
3349
  className,
3328
3350
  hasCloseButton = true,
3351
+ actionButton,
3329
3352
  children,
3330
- icon
3353
+ icon,
3354
+ testId
3331
3355
  }) => {
3332
3356
  const {
3333
3357
  i18n
@@ -3336,11 +3360,11 @@ const Alert = ({
3336
3360
  if (isClosed) return null;
3337
3361
  const closeAlert = () => setIsClosed(true);
3338
3362
  const classNames = cx("adyen-kyc-alert", className, {
3339
- "adyen-kyc-alert--basic": type === AlertTypes.BASIC,
3340
- "adyen-kyc-alert--information": type === AlertTypes.INFO,
3341
- "adyen-kyc-alert--error": type === AlertTypes.ERROR,
3342
- "adyen-kyc-alert--warning": type === AlertTypes.WARNING,
3343
- "adyen-kyc-alert--success": type === AlertTypes.SUCCESS
3363
+ "adyen-kyc-alert--basic": type === "basic",
3364
+ "adyen-kyc-alert--information": type === "info",
3365
+ "adyen-kyc-alert--error": type === "error",
3366
+ "adyen-kyc-alert--warning": type === "warning",
3367
+ "adyen-kyc-alert--success": type === "success"
3344
3368
  });
3345
3369
  const renderIcon = () => {
3346
3370
  if (icon === false) {
@@ -3359,24 +3383,20 @@ const Alert = ({
3359
3383
  return jsxs("div", {
3360
3384
  className: classNames,
3361
3385
  role: "alert",
3386
+ "data-testid": testId,
3362
3387
  children: [jsxs("div", {
3363
3388
  className: "adyen-kyc-alert__header",
3364
3389
  children: [renderIcon(), title && jsx("span", {
3365
- className: cx("adyen-kyc-alert__title", {
3366
- "adyen-kyc-alert__title--no-content": !children
3367
- }),
3390
+ className: "adyen-kyc-alert__title",
3368
3391
  children: title
3369
- }), hasCloseButton && jsx("button", {
3370
- "aria-label": i18n.get("close"),
3371
- className: "adyen-kyc-alert__dismiss",
3392
+ }), hasCloseButton && !actionButton && jsx(Button, {
3393
+ label: i18n.get("close"),
3394
+ tertiary: true,
3395
+ icon: "cross",
3372
3396
  onClick: closeAlert,
3373
- type: "button",
3374
- children: jsx(Icon, {
3375
- name: "cross",
3376
- className: "adyen-kyc-alert__dismiss__icon"
3377
- })
3378
- })]
3379
- }), jsx("div", {
3397
+ className: "adyen-kyc-close-button"
3398
+ }), !!actionButton && actionButton]
3399
+ }), children && jsx("div", {
3380
3400
  className: "adyen-kyc-alert__explanation",
3381
3401
  children
3382
3402
  })]
@@ -3387,23 +3407,23 @@ const AlertIcon = ({
3387
3407
  type
3388
3408
  }) => {
3389
3409
  switch (type) {
3390
- case AlertTypes.SUCCESS:
3410
+ case "success":
3391
3411
  return jsx(Icon, {
3392
3412
  name: "check",
3393
3413
  className
3394
3414
  });
3395
- case AlertTypes.ERROR:
3415
+ case "error":
3396
3416
  return jsx(Icon, {
3397
3417
  name: "field-error",
3398
3418
  className
3399
3419
  });
3400
- case AlertTypes.WARNING:
3420
+ case "warning":
3401
3421
  return jsx(Icon, {
3402
3422
  name: "warning",
3403
3423
  className
3404
3424
  });
3405
- case AlertTypes.INFO:
3406
- case AlertTypes.BASIC:
3425
+ case "info":
3426
+ case "basic":
3407
3427
  default:
3408
3428
  return jsx(Icon, {
3409
3429
  name: "info-circle",
@@ -3419,7 +3439,7 @@ function useFormRouterContext() {
3419
3439
  }
3420
3440
  return context;
3421
3441
  }
3422
- const logger$x = createLogger("Link");
3442
+ const logger$z = createLogger("Link");
3423
3443
  const getIconClass = (icon, external) => {
3424
3444
  if (external) {
3425
3445
  return "adyen-kyc-link__icon adyen-kyc-icon-external-link";
@@ -3431,7 +3451,7 @@ const getIconClass = (icon, external) => {
3431
3451
  };
3432
3452
  const isValidLink = (href) => {
3433
3453
  if (href === "#") {
3434
- logger$x.error('Links must include a valid href. If your href is "#", consider using a Button instead');
3454
+ logger$z.error('Links must include a valid href. If your href is "#", consider using a Button instead');
3435
3455
  return false;
3436
3456
  }
3437
3457
  return true;
@@ -3442,10 +3462,7 @@ const Link = ({
3442
3462
  href,
3443
3463
  external,
3444
3464
  icon,
3445
- underline,
3446
- inheritStyles,
3447
3465
  showAsButton,
3448
- iconLeft = false,
3449
3466
  onClick
3450
3467
  }) => {
3451
3468
  if (!isValidLink(href)) return null;
@@ -3454,13 +3471,9 @@ const Link = ({
3454
3471
  const showIcon = icon || external;
3455
3472
  const iconClass = showIcon && getIconClass(icon, external);
3456
3473
  const classNames = showAsButton ? cx("adyen-kyc-button", className, {
3457
- "adyen-kyc-button--icon": showIcon && !iconLeft,
3458
- "adyen-kyc-button--icon-left": showIcon && iconLeft
3474
+ "adyen-kyc-button--icon": showIcon
3459
3475
  }) : cx("adyen-kyc-link", className, {
3460
- "adyen-kyc-link--with-icon": showIcon,
3461
- "adyen-kyc-link--underline": underline,
3462
- "adyen-kyc-link--inherit": inheritStyles,
3463
- "adyen-kyc-link--icon-left": iconLeft
3476
+ "adyen-kyc-link--with-icon": showIcon
3464
3477
  });
3465
3478
  return jsxs("a", {
3466
3479
  href,
@@ -3469,7 +3482,7 @@ const Link = ({
3469
3482
  rel,
3470
3483
  onClick,
3471
3484
  children: [jsx("span", {
3472
- className: "adyen-kyc-link__text",
3485
+ className: "adyen-kyc-link__text adyen-kyc-link--inherit",
3473
3486
  children
3474
3487
  }), showIcon && icon && iconClass && jsx(Icon, {
3475
3488
  name: icon,
@@ -3506,7 +3519,7 @@ function ServerValidationErrors({
3506
3519
  }).toString(), [formUtils, validationErrorFieldNames]);
3507
3520
  return jsx(Alert, {
3508
3521
  title: formUtils.getVal("informationCouldNotBeSubmitted"),
3509
- type: AlertTypes.ERROR,
3522
+ type: "error",
3510
3523
  hasCloseButton: false,
3511
3524
  children: (validationErrorFieldNames == null ? void 0 : validationErrorFieldNames.length) === 1 ? jsxs("div", {
3512
3525
  "data-testid": "validation-error--case-1",
@@ -3573,7 +3586,7 @@ var LegalEntityType = /* @__PURE__ */ ((LegalEntityType2) => {
3573
3586
  return LegalEntityType2;
3574
3587
  })(LegalEntityType || {});
3575
3588
  function getFormProps(props, innerFormId) {
3576
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
3589
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
3577
3590
  if (!innerFormId) {
3578
3591
  return null;
3579
3592
  }
@@ -3590,14 +3603,15 @@ function getFormProps(props, innerFormId) {
3590
3603
  optionalFields: ((_j = props.optionalFields) == null ? void 0 : _j[innerFormId]) ?? [],
3591
3604
  obscuredFields: ((_k = props.obscuredFields) == null ? void 0 : _k[innerFormId]) ?? [],
3592
3605
  verifyFields: ((_l = props.verifyFields) == null ? void 0 : _l[innerFormId]) ?? [],
3593
- formVerificationErrors: ((_n = (_m = props.problems) == null ? void 0 : _m.verificationErrors) == null ? void 0 : _n[innerFormId]) ?? {},
3594
- fieldValidationErrors: ((_p = (_o = props.problems) == null ? void 0 : _o.validationErrors) == null ? void 0 : _p[innerFormId]) ?? {},
3606
+ trustedFields: ((_m = props.trustedFields) == null ? void 0 : _m[innerFormId]) ?? [],
3607
+ formVerificationErrors: ((_o = (_n = props.problems) == null ? void 0 : _n.verificationErrors) == null ? void 0 : _o[innerFormId]) ?? {},
3608
+ fieldValidationErrors: ((_q = (_p = props.problems) == null ? void 0 : _p.validationErrors) == null ? void 0 : _q[innerFormId]) ?? {},
3595
3609
  /*
3596
3610
  Validators should be `null` and not `{}` by default to make it easier to short circuit it with predetermined validators.
3597
3611
  For example `rules: props.validators || personalDetailsValidationRules`.
3598
3612
  */
3599
- validators: ((_q = props.validators) == null ? void 0 : _q[innerFormId]) ? {
3600
- ...(_r = props.validators) == null ? void 0 : _r[innerFormId]
3613
+ validators: ((_r = props.validators) == null ? void 0 : _r[innerFormId]) ? {
3614
+ ...(_s = props.validators) == null ? void 0 : _s[innerFormId]
3601
3615
  } : null,
3602
3616
  /*
3603
3617
  activeForm check is required for shouldValidate because we render all forms in a multistep form.
@@ -3624,6 +3638,7 @@ function getNestedOuterFormPropsFromOuterFormProps(props, innerFormId) {
3624
3638
  optionalFields,
3625
3639
  obscuredFields,
3626
3640
  verifyFields,
3641
+ trustedFields: trustedFields2,
3627
3642
  problems,
3628
3643
  validators: validators2,
3629
3644
  shouldValidate
@@ -3640,6 +3655,7 @@ function getNestedOuterFormPropsFromOuterFormProps(props, innerFormId) {
3640
3655
  optionalFields,
3641
3656
  obscuredFields,
3642
3657
  verifyFields,
3658
+ trustedFields: trustedFields2,
3643
3659
  // the rest we just pass along for now, as they will be eventually be processed by getFormProps
3644
3660
  problems,
3645
3661
  validators: validators2,
@@ -3660,10 +3676,11 @@ function getFieldProps(props, innerFormFields) {
3660
3676
  optionalFields: [],
3661
3677
  readOnlyFields: [],
3662
3678
  verifyFields: [],
3679
+ trustedFields: [],
3663
3680
  fieldValidationErrors: {}
3664
3681
  };
3665
3682
  innerFormFields.forEach((field) => {
3666
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
3683
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
3667
3684
  nestedFormProps.placeholders[field] = (_a = props.placeholders) == null ? void 0 : _a[field];
3668
3685
  nestedFormProps.labels[field] = (_b = props.labels) == null ? void 0 : _b[field];
3669
3686
  nestedFormProps.helperText[field] = (_c = props.helperText) == null ? void 0 : _c[field];
@@ -3690,11 +3707,14 @@ function getFieldProps(props, innerFormFields) {
3690
3707
  if ((_l = props.obscuredFields) == null ? void 0 : _l.includes(field)) {
3691
3708
  nestedFormProps.obscuredFields.push(field);
3692
3709
  }
3693
- if ((_m = props.validators) == null ? void 0 : _m[field]) {
3710
+ if ((_m = props.trustedFields) == null ? void 0 : _m.includes(field)) {
3711
+ nestedFormProps.trustedFields.push(field);
3712
+ }
3713
+ if ((_n = props.validators) == null ? void 0 : _n[field]) {
3694
3714
  if (!(nestedFormProps == null ? void 0 : nestedFormProps.validators)) {
3695
3715
  nestedFormProps.validators = {};
3696
3716
  }
3697
- nestedFormProps.validators[field] = (_n = props.validators) == null ? void 0 : _n[field];
3717
+ nestedFormProps.validators[field] = (_o = props.validators) == null ? void 0 : _o[field];
3698
3718
  }
3699
3719
  nestedFormProps.shouldValidate = props.shouldValidate;
3700
3720
  });
@@ -3760,7 +3780,7 @@ const useSetting = (settingName) => {
3760
3780
  } = context;
3761
3781
  return getSetting(settingName);
3762
3782
  };
3763
- const logger$w = createLogger("useAllowedCountries");
3783
+ const logger$y = createLogger("useAllowedCountries");
3764
3784
  const useAllowedCountries = () => {
3765
3785
  const acceptedCountries = useSetting("acceptedCountries");
3766
3786
  const {
@@ -3769,7 +3789,7 @@ const useAllowedCountries = () => {
3769
3789
  const [allowedCountries, setAllowedCountries] = useState(acceptedCountries);
3770
3790
  useEffect(() => {
3771
3791
  if (acceptedCountries !== void 0) return;
3772
- getAllowedCountries2().then((response) => setAllowedCountries(response.countries)).catch(logger$w.error);
3792
+ getAllowedCountries2().then((response) => setAllowedCountries(response.countries)).catch(logger$y.error);
3773
3793
  }, [acceptedCountries]);
3774
3794
  return allowedCountries;
3775
3795
  };
@@ -3827,6 +3847,7 @@ function init({
3827
3847
  fieldProblems,
3828
3848
  obscuredFields,
3829
3849
  optionalFields,
3850
+ trustedFields: trustedFields2,
3830
3851
  formatters,
3831
3852
  staticValidate,
3832
3853
  asyncValidate
@@ -3842,7 +3863,8 @@ function init({
3842
3863
  state: {
3843
3864
  data: defaultData,
3844
3865
  obscuredFields,
3845
- optionalFields
3866
+ optionalFields,
3867
+ trustedFields: trustedFields2
3846
3868
  }
3847
3869
  },
3848
3870
  staticValidate,
@@ -3897,7 +3919,8 @@ function init({
3897
3919
  errors: {},
3898
3920
  fieldProblems: {},
3899
3921
  obscuredFields,
3900
- optionalFields
3922
+ optionalFields,
3923
+ trustedFields: trustedFields2
3901
3924
  });
3902
3925
  return formData;
3903
3926
  }
@@ -3906,6 +3929,7 @@ function reducer({
3906
3929
  asyncValidate,
3907
3930
  obscuredFields,
3908
3931
  optionalFields,
3932
+ trustedFields: trustedFields2,
3909
3933
  formatters
3910
3934
  }) {
3911
3935
  return (state2, {
@@ -3977,6 +4001,7 @@ function reducer({
3977
4001
  fieldProblems,
3978
4002
  obscuredFields,
3979
4003
  optionalFields,
4004
+ trustedFields: trustedFields2,
3980
4005
  staticValidate,
3981
4006
  asyncValidate
3982
4007
  });
@@ -4010,6 +4035,7 @@ function reducer({
4010
4035
  fieldProblems: updatedFieldProblems,
4011
4036
  obscuredFields,
4012
4037
  optionalFields,
4038
+ trustedFields: trustedFields2,
4013
4039
  local
4014
4040
  };
4015
4041
  }
@@ -4122,7 +4148,7 @@ function reducer({
4122
4148
  }
4123
4149
  };
4124
4150
  }
4125
- const logger$v = createLogger("useAsyncValidator");
4151
+ const logger$x = createLogger("useAsyncValidator");
4126
4152
  const useAsyncValidator = (asyncRules) => {
4127
4153
  const [asyncValidationResults, setAsyncValidationResults] = useState({});
4128
4154
  const clearAsyncValidationResults = useCallback(() => setAsyncValidationResults({}), []);
@@ -4143,7 +4169,7 @@ const useAsyncValidator = (asyncRules) => {
4143
4169
  hasError: !isValid
4144
4170
  }])
4145
4171
  });
4146
- }).catch(logger$v.error);
4172
+ }).catch(logger$x.error);
4147
4173
  }, [asyncRules, clearAsyncValidationResults]);
4148
4174
  return {
4149
4175
  asyncValidationResults,
@@ -4203,6 +4229,7 @@ function useForm({
4203
4229
  fieldProblems,
4204
4230
  obscuredFields,
4205
4231
  optionalFields,
4232
+ trustedFields: trustedFields2,
4206
4233
  formatters,
4207
4234
  shouldValidate = false
4208
4235
  }) {
@@ -4220,18 +4247,20 @@ function useForm({
4220
4247
  asyncValidate: triggerAsyncValidation,
4221
4248
  obscuredFields,
4222
4249
  optionalFields,
4250
+ trustedFields: trustedFields2,
4223
4251
  formatters
4224
- }), [triggerStaticValidation, triggerAsyncValidation, obscuredFields, optionalFields, formatters]);
4252
+ }), [triggerStaticValidation, triggerAsyncValidation, obscuredFields, optionalFields, trustedFields2, formatters]);
4225
4253
  const initialData = useMemo(() => ({
4226
4254
  schema: getSchema,
4227
4255
  defaultData,
4228
4256
  fieldProblems,
4229
4257
  obscuredFields,
4230
4258
  optionalFields,
4259
+ trustedFields: trustedFields2,
4231
4260
  formatters,
4232
4261
  staticValidate: triggerStaticValidation,
4233
4262
  asyncValidate: triggerAsyncValidation
4234
- }), [getSchema, defaultData, fieldProblems, obscuredFields, optionalFields, formatters, triggerStaticValidation, triggerAsyncValidation]);
4263
+ }), [getSchema, defaultData, fieldProblems, obscuredFields, optionalFields, trustedFields2, formatters, triggerStaticValidation, triggerAsyncValidation]);
4235
4264
  const [state2, dispatch] = useReducer(getReducer(), initialData, init);
4236
4265
  const isValid = useMemo(() => {
4237
4266
  var _a;
@@ -4289,6 +4318,16 @@ function useForm({
4289
4318
  defaultData
4290
4319
  });
4291
4320
  }, [defaultData]);
4321
+ const resetToDefaultData = useCallback(() => {
4322
+ getSchema.forEach((field) => {
4323
+ if (!defaultData || typeof defaultData[field] !== "undefined") {
4324
+ return handleChangeFor(field)(defaultData == null ? void 0 : defaultData[field]);
4325
+ }
4326
+ setValid(field, false);
4327
+ setErrors(field, null);
4328
+ setData(field, defaultData[field]);
4329
+ });
4330
+ }, [defaultData, getSchema, handleChangeFor, setData, setErrors, setValid]);
4292
4331
  useEffect(() => {
4293
4332
  const newSchema = getRequiredFields(state2.data);
4294
4333
  if (!doArraysMatch(state2.schema, newSchema)) {
@@ -4314,6 +4353,7 @@ function useForm({
4314
4353
  setFieldProblems,
4315
4354
  handleChangeFor,
4316
4355
  triggerValidation,
4356
+ resetToDefaultData,
4317
4357
  isValid,
4318
4358
  schema: state2.schema,
4319
4359
  valid: state2.valid,
@@ -4527,7 +4567,7 @@ const Field = ({
4527
4567
  children: helper
4528
4568
  }), isLoading && jsx("span", {
4529
4569
  className: "adyen-kyc-input__inline-validation adyen-kyc-input__inline-validation--loading",
4530
- children: jsx(Spinner, {
4570
+ children: jsx(Loader, {
4531
4571
  size: "small"
4532
4572
  })
4533
4573
  }), isValid && jsx("span", {
@@ -4569,18 +4609,6 @@ function uuidv4() {
4569
4609
  return v.toString(16);
4570
4610
  });
4571
4611
  }
4572
- const Loader = ({
4573
- inline = false,
4574
- size = "large",
4575
- dot = false
4576
- }) => jsx("div", {
4577
- className: `adyen-kyc-loader__wrapper ${inline ? "adyen-kyc-loader__wrapper--inline" : ""}`,
4578
- children: jsx("div", {
4579
- className: cx("adyen-kyc-loading-indicator", `adyen-kyc-loading-indicator--${size}`, {
4580
- "adyen-kyc-loading-indicator--dot": dot
4581
- })
4582
- })
4583
- });
4584
4612
  const Tag = ({
4585
4613
  className,
4586
4614
  variant = "blue",
@@ -4729,7 +4757,7 @@ const SelectButtonContentSingle = ({
4729
4757
  type: "text",
4730
4758
  value: textFilter
4731
4759
  }), isSearch && loading2 && jsx(Loader, {
4732
- size: "xsmall",
4760
+ size: "small",
4733
4761
  dot: true
4734
4762
  })]
4735
4763
  });
@@ -5653,6 +5681,36 @@ var CountryCodes = /* @__PURE__ */ ((CountryCodes2) => {
5653
5681
  CountryCodes2["Zimbabwe"] = "ZW";
5654
5682
  return CountryCodes2;
5655
5683
  })(CountryCodes || {});
5684
+ const euCountries = [
5685
+ "AT",
5686
+ "BE",
5687
+ "BG",
5688
+ "CY",
5689
+ "CZ",
5690
+ "DE",
5691
+ "DK",
5692
+ "EE",
5693
+ "ES",
5694
+ "FI",
5695
+ "FR",
5696
+ "GR",
5697
+ "HR",
5698
+ "HU",
5699
+ "IE",
5700
+ "IT",
5701
+ "LT",
5702
+ "LU",
5703
+ "LV",
5704
+ "MT",
5705
+ "NL",
5706
+ "PL",
5707
+ "PT",
5708
+ "RO",
5709
+ "SE",
5710
+ "SI",
5711
+ "SK"
5712
+ /* Slovakia */
5713
+ ];
5656
5714
  const validateNotEmptyOnBlur = {
5657
5715
  modes: ["blur"],
5658
5716
  validate: (val) => !isEmpty(val),
@@ -6132,7 +6190,7 @@ const deriveInputState = (isValid, isFocused, isDisabled, isOptional, hasNullish
6132
6190
  };
6133
6191
  };
6134
6192
  const MISMATCH_ANIMATION_NAME = "mismatchShake";
6135
- const logger$u = createLogger("MaskedInputText");
6193
+ const logger$w = createLogger("MaskedInputText");
6136
6194
  const MaskedInputText = ({
6137
6195
  value,
6138
6196
  onInput,
@@ -6173,7 +6231,7 @@ const MaskedInputText = ({
6173
6231
  };
6174
6232
  useEffect(() => {
6175
6233
  if (!mask) {
6176
- logger$u.warn("`mask` is undefined. No masking of input will take place.");
6234
+ logger$w.warn("`mask` is undefined. No masking of input will take place.");
6177
6235
  }
6178
6236
  }, [mask]);
6179
6237
  const getMaskResult = useCallback((pureValue) => {
@@ -6198,7 +6256,7 @@ const MaskedInputText = ({
6198
6256
  return;
6199
6257
  }
6200
6258
  const fallback = displayValueToPure(maskResult.partialDisplayValue);
6201
- logger$u.warn(`Value received "${value}" does not match mask`, maskResult, `
6259
+ logger$w.warn(`Value received "${value}" does not match mask`, maskResult, `
6202
6260
  Falling back to partially valid value "${fallback}"`);
6203
6261
  onInput(fallback);
6204
6262
  }
@@ -6489,17 +6547,27 @@ const taxIdNumberOptions = {
6489
6547
  name: "socialSecurityNumber",
6490
6548
  applicableOnlyFor: [CompanyTypesValue.SOLE_PROPRIETORSHIP]
6491
6549
  }],
6550
+ [CountryCodes.PuertoRico]: [{
6551
+ id: "EIN",
6552
+ name: "ein"
6553
+ }, {
6554
+ id: "SSN",
6555
+ name: "ssn",
6556
+ applicableOnlyFor: [CompanyTypesValue.SOLE_PROPRIETORSHIP]
6557
+ }],
6492
6558
  [CountryCodes.UnitedStates]: [{
6493
6559
  id: "EIN",
6494
6560
  name: "ein"
6495
6561
  }, {
6496
6562
  id: "SSN",
6497
- name: "ssn"
6563
+ name: "ssn",
6564
+ applicableOnlyFor: [CompanyTypesValue.SOLE_PROPRIETORSHIP]
6498
6565
  }]
6499
6566
  };
6500
6567
  const getTaxIdNumberOptions = (country2, companyType2) => {
6501
6568
  const optionsForCountry = taxIdNumberOptions[country2];
6502
6569
  if (!companyType2 || !optionsForCountry) return optionsForCountry;
6570
+ if (country2 === "US" || country2 === "PR") return optionsForCountry.filter((option) => option.id === "EIN");
6503
6571
  return optionsForCountry.filter((option) => {
6504
6572
  var _a;
6505
6573
  return ((_a = option.applicableOnlyFor) == null ? void 0 : _a.includes(companyType2)) ?? true;
@@ -7689,7 +7757,7 @@ const businessRegistrationNumberPatterns = {
7689
7757
  [StateCodesUS.Georgia]: /^\d{10}$/,
7690
7758
  [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)$/,
7691
7759
  [StateCodesUS.Idaho]: /^\d{6}$/,
7692
- [StateCodesUS.Illinois]: /^\d{12}$/,
7760
+ [StateCodesUS.Illinois]: /^\d{8}$/,
7693
7761
  [StateCodesUS.Indiana]: /^\d{10}$/,
7694
7762
  [StateCodesUS.Iowa]: /^\d{4,10}$/,
7695
7763
  [StateCodesUS.Kansas]: /^\d{10}$/,
@@ -8656,7 +8724,7 @@ class UserEvents {
8656
8724
  }
8657
8725
  }
8658
8726
  const userEvents = new UserEvents();
8659
- 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";
8727
+ 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";
8660
8728
  const Accordion = ({
8661
8729
  title,
8662
8730
  children,
@@ -10565,7 +10633,7 @@ const businessDetailsBase = {
10565
10633
  legalCompanyName: {
10566
10634
  rule: "REQUIRED"
10567
10635
  },
10568
- hasDBA: {
10636
+ hasDba: {
10569
10637
  rule: "REQUIRED"
10570
10638
  },
10571
10639
  dbaName: {
@@ -11039,7 +11107,7 @@ const RadioCard = ({
11039
11107
  }), loading2 ? jsx("span", {
11040
11108
  className: "adyen-kyc-radio-card__loading-icon",
11041
11109
  children: jsx(Loader, {
11042
- size: "xsmall",
11110
+ size: "small",
11043
11111
  dot: true
11044
11112
  })
11045
11113
  }) : jsx(InputRadio, {
@@ -11573,7 +11641,7 @@ const accountHolderValidationRules = {
11573
11641
  }
11574
11642
  };
11575
11643
  const accountHolderFields = ["accountHolder"];
11576
- const logger$t = createLogger("AccountHolder");
11644
+ const logger$v = createLogger("AccountHolder");
11577
11645
  function getAvailableAccountHolderOptions(legalEntityType, isChangeOfLegalEntityTypeAllowed, isTrustFlowEnabled, isSoleProprietorshipAllowed, isChangeToMyNameAllowed) {
11578
11646
  switch (legalEntityType) {
11579
11647
  case LegalEntityType.ORGANIZATION: {
@@ -11583,7 +11651,7 @@ function getAvailableAccountHolderOptions(legalEntityType, isChangeOfLegalEntity
11583
11651
  return [...isChangeToMyNameAllowed ? ["myName"] : [], ...isChangeOfLegalEntityTypeAllowed ? ["theCompanyIWorkFor"] : [], ...isTrustFlowEnabled ? ["aTrust"] : [], ...isSoleProprietorshipAllowed ? ["mySoleProprietorName"] : []];
11584
11652
  }
11585
11653
  default:
11586
- logger$t.error(`No available account holder options for legal entity type '${legalEntityType}'`);
11654
+ logger$v.error(`No available account holder options for legal entity type '${legalEntityType}'`);
11587
11655
  return [];
11588
11656
  }
11589
11657
  }
@@ -12137,7 +12205,7 @@ function Dropzone(props) {
12137
12205
  })]
12138
12206
  });
12139
12207
  }
12140
- const logger$s = createLogger("TextArea");
12208
+ const logger$u = createLogger("TextArea");
12141
12209
  function TextArea(props) {
12142
12210
  const {
12143
12211
  classNameModifiers,
@@ -12158,7 +12226,7 @@ function TextArea(props) {
12158
12226
  } = useI18nContext();
12159
12227
  const [value, setValue] = useState("");
12160
12228
  if (Object.prototype.hasOwnProperty.call(props, "onChange")) {
12161
- logger$s.error("Error: Form fields that rely on InputBase may not have an onChange property");
12229
+ logger$u.error("Error: Form fields that rely on InputBase may not have an onChange property");
12162
12230
  }
12163
12231
  const handleInput = (e) => {
12164
12232
  var _a;
@@ -12604,7 +12672,7 @@ function useIsElementVisible(ref, fallback = true) {
12604
12672
  }, [ref]);
12605
12673
  return isOnScreen;
12606
12674
  }
12607
- const logger$r = createLogger("SearchAddress");
12675
+ const logger$t = createLogger("SearchAddress");
12608
12676
  const SearchAddress = ({
12609
12677
  data,
12610
12678
  legalEntityId,
@@ -12613,7 +12681,8 @@ const SearchAddress = ({
12613
12681
  handleAddressSearch,
12614
12682
  handleFindAddress,
12615
12683
  addressType,
12616
- kompanyAddress
12684
+ kompanyAddress,
12685
+ kompanyPrefilled = false
12617
12686
  }) => {
12618
12687
  const {
12619
12688
  i18n
@@ -12634,10 +12703,10 @@ const SearchAddress = ({
12634
12703
  }
12635
12704
  }, [kompanyAddress]);
12636
12705
  useEffect(() => {
12637
- if (isVisible && kompanyAddress && addressType === "registrationAddress") {
12706
+ if (isVisible && kompanyAddress && addressType === "registrationAddress" && !kompanyPrefilled) {
12638
12707
  setShowSearchList(true);
12639
12708
  }
12640
- }, [isVisible, kompanyAddress, addressType]);
12709
+ }, [isVisible, kompanyAddress, addressType, kompanyPrefilled]);
12641
12710
  useEffect(() => {
12642
12711
  setItems([]);
12643
12712
  setResetSearch(true);
@@ -12647,7 +12716,7 @@ const SearchAddress = ({
12647
12716
  const response = await handleFindAddress(selectedAddressId);
12648
12717
  autocompleteAddressForm(response);
12649
12718
  } catch (e) {
12650
- logger$r.error(e);
12719
+ logger$t.error(e);
12651
12720
  }
12652
12721
  };
12653
12722
  const onDrilldown = async (selectedAddress) => {
@@ -12659,7 +12728,7 @@ const SearchAddress = ({
12659
12728
  }, legalEntityId);
12660
12729
  setItems((response == null ? void 0 : response.results) || []);
12661
12730
  } catch (e) {
12662
- logger$r.error(e);
12731
+ logger$t.error(e);
12663
12732
  }
12664
12733
  };
12665
12734
  const onChange = (e) => {
@@ -12714,7 +12783,7 @@ const SearchAddress = ({
12714
12783
  setItems([]);
12715
12784
  }
12716
12785
  } catch (e) {
12717
- logger$r.error(e);
12786
+ logger$t.error(e);
12718
12787
  }
12719
12788
  setLoading(false);
12720
12789
  }
@@ -13147,11 +13216,15 @@ function Address(props) {
13147
13216
  id: id2,
13148
13217
  hideCountry,
13149
13218
  heading,
13219
+ verifiedBusiness,
13150
13220
  kompanyAddress
13151
13221
  } = props;
13152
13222
  const {
13153
13223
  i18n
13154
13224
  } = useI18nContext();
13225
+ const {
13226
+ isExperimentEnabled
13227
+ } = useExperimentsContext();
13155
13228
  const [showAutocompletedAddressFields, setShowAutocompletedAddressFields] = useState(false);
13156
13229
  const [showAddAddressButton, setShowAddAddressButton] = useState(true);
13157
13230
  const [isHandlerPresent, setIsHandlerPresent] = useState(false);
@@ -13170,7 +13243,9 @@ function Address(props) {
13170
13243
  fieldProblems,
13171
13244
  handleChangeFor,
13172
13245
  triggerValidation,
13173
- schema
13246
+ resetToDefaultData,
13247
+ schema,
13248
+ setData
13174
13249
  } = useForm({
13175
13250
  ...props,
13176
13251
  schema: requiredFields,
@@ -13260,6 +13335,24 @@ function Address(props) {
13260
13335
  setShowAddAddressButton(false);
13261
13336
  }
13262
13337
  }, [shouldValidate]);
13338
+ const canAutofillVerifiedBusinessAddress = Boolean((verifiedBusiness == null ? void 0 : verifiedBusiness.street) && (verifiedBusiness == null ? void 0 : verifiedBusiness.city) && (verifiedBusiness == null ? void 0 : verifiedBusiness.state) && verifiedBusiness.zipcode);
13339
+ useEffect(() => {
13340
+ if (!isExperimentEnabled("EnableNewBusinessDetailsFlow")) return;
13341
+ if (verifiedBusiness && canAutofillVerifiedBusinessAddress) {
13342
+ setShowAutocompletedAddressFields(true);
13343
+ setShowAddAddressButton(false);
13344
+ setData("address", verifiedBusiness.street);
13345
+ setData("city", verifiedBusiness.city);
13346
+ setData("stateOrProvince", verifiedBusiness.state);
13347
+ setData("postalCode", verifiedBusiness.zipcode);
13348
+ return triggerValidation();
13349
+ }
13350
+ if (!(dataProp == null ? void 0 : dataProp.address) || !(dataProp == null ? void 0 : dataProp.city) || !(dataProp == null ? void 0 : dataProp.postalCode)) {
13351
+ setShowAutocompletedAddressFields(false);
13352
+ setShowAddAddressButton(true);
13353
+ resetToDefaultData();
13354
+ }
13355
+ }, [canAutofillVerifiedBusinessAddress, verifiedBusiness]);
13263
13356
  const getComponent = (fieldName) => {
13264
13357
  if (!formUtils.isRequiredField(fieldName)) return null;
13265
13358
  const hideField = fieldName === "country" && hideCountry;
@@ -13334,7 +13427,8 @@ function Address(props) {
13334
13427
  legalEntityId,
13335
13428
  autocompleteAddressForm,
13336
13429
  addressType,
13337
- kompanyAddress
13430
+ kompanyAddress: (verifiedBusiness == null ? void 0 : verifiedBusiness.address) ?? kompanyAddress,
13431
+ kompanyPrefilled: canAutofillVerifiedBusinessAddress
13338
13432
  }), jsxs("div", {
13339
13433
  className: "adyen-kyc-search-address--below",
13340
13434
  children: [jsxs("span", {
@@ -13413,6 +13507,7 @@ function RegistrationAddressComponent(props) {
13413
13507
  country: country2,
13414
13508
  data,
13415
13509
  validators: validators2,
13510
+ verifiedBusiness,
13416
13511
  kompanyAddress
13417
13512
  } = props;
13418
13513
  const {
@@ -13420,7 +13515,8 @@ function RegistrationAddressComponent(props) {
13420
13515
  optionalFields: registrationAddressOptionalFields,
13421
13516
  readOnlyFields: registrationAddressReadOnlyFields,
13422
13517
  obscuredFields: registrationAddressObscuredFields,
13423
- verifyFields: registrationAddressVerifyFields
13518
+ verifyFields: registrationAddressVerifyFields,
13519
+ trustedFields: registrationAddressTrustedFields
13424
13520
  } = getFormProps(props, registrationAddressFormID);
13425
13521
  const {
13426
13522
  data: formData,
@@ -13434,7 +13530,8 @@ function RegistrationAddressComponent(props) {
13434
13530
  defaultData: data,
13435
13531
  rules: validators2 || registrationAddressValidationRules,
13436
13532
  obscuredFields: [],
13437
- optionalFields: registrationAddressOptionalFields
13533
+ optionalFields: registrationAddressOptionalFields,
13534
+ trustedFields: registrationAddressTrustedFields
13438
13535
  });
13439
13536
  const mergedProps = {
13440
13537
  ...props,
@@ -13442,7 +13539,8 @@ function RegistrationAddressComponent(props) {
13442
13539
  optionalFields: registrationAddressOptionalFields,
13443
13540
  readOnlyFields: registrationAddressReadOnlyFields,
13444
13541
  obscuredFields: registrationAddressObscuredFields,
13445
- verifyFields: registrationAddressVerifyFields
13542
+ verifyFields: registrationAddressVerifyFields,
13543
+ trustedFields: registrationAddressTrustedFields
13446
13544
  };
13447
13545
  const formUtils = formUtilities(mergedProps, i18n);
13448
13546
  const stateRef = useRef({
@@ -13495,6 +13593,7 @@ function RegistrationAddressComponent(props) {
13495
13593
  addressType: "registrationAddress",
13496
13594
  handleAddressSearch,
13497
13595
  handleFindAddress,
13596
+ verifiedBusiness,
13498
13597
  kompanyAddress
13499
13598
  }), jsx(FormHeader, {
13500
13599
  classNames: "adyen-kyc-u-margin-top-32",
@@ -14113,7 +14212,7 @@ const getFileExtention = (fileName2) => fileName2.split(".").pop();
14113
14212
  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];
14114
14213
  const COUNTRIES_THAT_DONT_REQUIRE_COMPANY_REGISTRATION = [CountryCodes.PuertoRico, CountryCodes.UnitedStates];
14115
14214
  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];
14116
- const COUNTRIES_WITH_OPTIONAL_REGISTRATION_NUMBER = [CountryCodes.UnitedStates];
14215
+ [CountryCodes.UnitedStates];
14117
14216
  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];
14118
14217
  const COUNTRIES_THAT_DO_NOT_USE_TAX_ID_FOR_SOLE_PROP = [CountryCodes.NewZealand, CountryCodes.Singapore];
14119
14218
  const COUNTRIES_WITH_POSSIBLE_TAX_EXEMPTION_FOR_COMPANIES = [
@@ -14200,9 +14299,6 @@ const rules$2 = ({
14200
14299
  if (!COUNTRIES_THAT_DONT_REQUIRE_COMPANY_REGISTRATION.includes(country2)) {
14201
14300
  return "REQUIRED";
14202
14301
  }
14203
- if (isExperimentEnabled("EnableNewBusinessDetailsFlow") && COUNTRIES_WITH_OPTIONAL_REGISTRATION_NUMBER.includes(country2)) {
14204
- return "OPTIONAL";
14205
- }
14206
14302
  },
14207
14303
  countryRequiresDateOfIncorporationForCompanies: () => {
14208
14304
  if (COUNTRIES_THAT_REQUIRE_DATE_OF_INCORPORATION.includes(country2)) {
@@ -14383,6 +14479,7 @@ const businessDetailsBaseMapping = {
14383
14479
  "basicInformation.isUen": "organization.isUen",
14384
14480
  "companyStructure.entityType": "organization.type",
14385
14481
  "additionalInformation.legalCompanyName": "organization.legalName",
14482
+ "additionalInformation.legalFormDescription": "organization.legalFormDescription",
14386
14483
  "additionalInformation.dbaName": "organization.doingBusinessAs",
14387
14484
  "additionalInformation.registrationNumber": "organization.registrationNumber",
14388
14485
  "additionalInformation.taxInformation": "organization.taxInformation",
@@ -15426,7 +15523,7 @@ const LoaderWrapper = ({
15426
15523
  const wrapperClass = cx("adyen-kyc-loading-input__form", styles$1["adyen-kyc-loading-input__form"], {
15427
15524
  [styles$1[`adyen-kyc-loading-input__form--loading-opacity${opacity}`]]: status === "loading"
15428
15525
  });
15429
- const loaderClass = cx({
15526
+ const loaderWrapperClass = cx({
15430
15527
  [styles$1["adyen-kyc-loading-input__loader"]]: true,
15431
15528
  [styles$1["adyen-kyc-loading-input__loader--active"]]: status === "loading" && showSpinner
15432
15529
  });
@@ -15437,7 +15534,7 @@ const LoaderWrapper = ({
15437
15534
  position: "relative"
15438
15535
  },
15439
15536
  children: [jsx("div", {
15440
- className: loaderClass,
15537
+ className: loaderWrapperClass,
15441
15538
  children: jsx(Loader, {
15442
15539
  size: loaderSize
15443
15540
  })
@@ -15497,7 +15594,7 @@ const initOnfido = async ({
15497
15594
  language: getOnfidoLocaleConfig(i18n)
15498
15595
  });
15499
15596
  };
15500
- const logger$q = createLogger("IdVerificationComponent");
15597
+ const logger$s = createLogger("IdVerificationComponent");
15501
15598
  function IdVerificationComponent({
15502
15599
  userDetails,
15503
15600
  legalEntityId,
@@ -15529,7 +15626,7 @@ function IdVerificationComponent({
15529
15626
  onIdVerificationError,
15530
15627
  onIdVerificationComplete
15531
15628
  });
15532
- })().catch(logger$q.error);
15629
+ })().catch(logger$s.error);
15533
15630
  return () => {
15534
15631
  if (onfidoSdk.current) onfidoSdk.current.tearDown();
15535
15632
  };
@@ -15579,7 +15676,7 @@ function IdDocumentAlreadyUpload(props) {
15579
15676
  })]
15580
15677
  });
15581
15678
  }
15582
- const logger$p = createLogger("IdDocumentInstantVerificationComponent");
15679
+ const logger$r = createLogger("IdDocumentInstantVerificationComponent");
15583
15680
  const idVerificationSchema = ["instantIdVerificationData", "idDocumentType"];
15584
15681
  const documentTypeValidationRules = {
15585
15682
  instantIdVerificationData: {
@@ -15661,7 +15758,7 @@ function IdDocumentInstantVerificationComponent(props) {
15661
15758
  userDetails: props.userDetails,
15662
15759
  legalEntityId: props.legalEntityId,
15663
15760
  onIdVerificationComplete: handleIdVerificationComplete,
15664
- onIdVerificationError: logger$p.error
15761
+ onIdVerificationError: logger$r.error
15665
15762
  }), jsxs("div", {
15666
15763
  className: "adyen-kyc-document-upload__manual-upload",
15667
15764
  children: [i18n.get("canNotCompleteInstantVerification"), " ", jsx("button", {
@@ -15937,6 +16034,68 @@ function IdVerificationMethodComponent(props) {
15937
16034
  })]
15938
16035
  });
15939
16036
  }
16037
+ const getAgeToday = (birthdate2) => {
16038
+ const today = /* @__PURE__ */ new Date();
16039
+ const todayMonth = today.getMonth();
16040
+ const todayDay = today.getDate();
16041
+ const bdDate = new Date(birthdate2);
16042
+ const bdMonth = bdDate.getMonth();
16043
+ const yearDifference = today.getFullYear() - bdDate.getFullYear();
16044
+ if (todayMonth > bdMonth) {
16045
+ return yearDifference;
16046
+ }
16047
+ if (todayMonth === bdMonth && todayDay >= bdDate.getUTCDate()) {
16048
+ return yearDifference;
16049
+ }
16050
+ return yearDifference - 1;
16051
+ };
16052
+ const getAgeRangeForLegalRepresentative = (country2) => {
16053
+ if (euCountries.some((c) => c === country2)) {
16054
+ return {
16055
+ min: 16,
16056
+ max: 18
16057
+ };
16058
+ }
16059
+ switch (country2) {
16060
+ case CountryCodes.HongKong:
16061
+ case CountryCodes.Singapore:
16062
+ return;
16063
+ default:
16064
+ return {
16065
+ min: 13,
16066
+ max: 18
16067
+ };
16068
+ }
16069
+ };
16070
+ const getLegalRepresentativeWarningMessage = ({
16071
+ data: {
16072
+ birthDate: birthDate2,
16073
+ residencyCountry: residencyCountry2
16074
+ }
16075
+ }) => {
16076
+ if (!residencyCountry2) {
16077
+ return;
16078
+ }
16079
+ if (!birthDate2) {
16080
+ return;
16081
+ }
16082
+ const ageRange = getAgeRangeForLegalRepresentative(residencyCountry2);
16083
+ if (!ageRange) {
16084
+ return;
16085
+ }
16086
+ const age = getAgeToday(birthDate2);
16087
+ if (ageRange.min <= age && age < ageRange.max) {
16088
+ return {
16089
+ title: "aLegalRepresentativeIsRequired",
16090
+ message: {
16091
+ key: "becauseYoureUnderXWeNeedToCollectInformationAboutALegalRepresentative",
16092
+ values: {
16093
+ age: ageRange.max.toString()
16094
+ }
16095
+ }
16096
+ };
16097
+ }
16098
+ };
15940
16099
  const COUNTRY_ID_NUMBER_MASKS = {
15941
16100
  [CountryCodes.PuertoRico]: {
15942
16101
  length: 4
@@ -17888,6 +18047,10 @@ function PersonalDetailsComponent(props) {
17888
18047
  } = useSettingsContext();
17889
18048
  const allowedCountries = useAllowedCountries();
17890
18049
  const isNewEntryFlowEnabled = useEnableNewEntryFlow();
18050
+ const {
18051
+ isExperimentEnabled
18052
+ } = useExperimentsContext();
18053
+ const isAgeVerificationEnabled = isExperimentEnabled("EnableAgeVerification");
17891
18054
  const PERSONAL_DETAILS = props.id;
17892
18055
  const {
17893
18056
  residencyCountry: residencyCountry2
@@ -18005,6 +18168,28 @@ function PersonalDetailsComponent(props) {
18005
18168
  useEffect(() => {
18006
18169
  triggerValidation();
18007
18170
  }, [residencyCountry2]);
18171
+ const birthDateErrorMessage = formUtils.getErrorMessage("birthDate", errors, fieldProblems);
18172
+ const getAlertProps = () => {
18173
+ if (typeof birthDateErrorMessage === "string") {
18174
+ return {
18175
+ title: birthDateErrorMessage,
18176
+ hasCloseButton: false,
18177
+ type: "error"
18178
+ };
18179
+ }
18180
+ const translatableWarningMessage = getLegalRepresentativeWarningMessage({
18181
+ data
18182
+ });
18183
+ if (translatableWarningMessage) {
18184
+ return {
18185
+ title: i18n.get(translatableWarningMessage.title),
18186
+ hasCloseButton: false,
18187
+ type: "warning",
18188
+ children: i18n.get(translatableWarningMessage.message)
18189
+ };
18190
+ }
18191
+ };
18192
+ const alertProps = getAlertProps();
18008
18193
  return jsxs(LoaderWrapper, {
18009
18194
  status,
18010
18195
  formOpacityWhenLoading: 0.3,
@@ -18039,11 +18224,12 @@ function PersonalDetailsComponent(props) {
18039
18224
  }), hasRequiredFields(nameProps) && jsx(Name, {
18040
18225
  ...nameProps,
18041
18226
  dataStoreId: PERSONAL_DETAILS
18042
- }), formUtils.isRequiredField("birthDate") && jsx(Field, {
18227
+ }), !isAgeVerificationEnabled && formUtils.isRequiredField("birthDate") && // we reverse the order of birthDate and Country field in age verification feature
18228
+ jsx(Field, {
18043
18229
  name: "birthDate",
18044
18230
  label: formUtils.getLabel("birthDate"),
18045
18231
  classNameModifiers: ["birthDate"],
18046
- errorMessage: formUtils.getErrorMessage("birthDate", errors, fieldProblems),
18232
+ errorMessage: isAgeVerificationEnabled && birthDateErrorMessage ? true : birthDateErrorMessage,
18047
18233
  isValid: valid.birthDate,
18048
18234
  children: (childProps) => jsx(InputDate, {
18049
18235
  ...childProps,
@@ -18075,6 +18261,29 @@ function PersonalDetailsComponent(props) {
18075
18261
  allowedCountries: isTopLevelEntity ? allowedCountries : void 0,
18076
18262
  classNameModifiers: ["country"],
18077
18263
  handleChangeFor: () => handleChangeFor("residencyCountry", "input")
18264
+ }), isAgeVerificationEnabled && formUtils.isRequiredField("birthDate") && jsxs(Fragment, {
18265
+ children: [jsx(Field, {
18266
+ name: "birthDate",
18267
+ label: formUtils.getLabel("birthDate"),
18268
+ classNameModifiers: ["birthDate"],
18269
+ errorMessage: isAgeVerificationEnabled && birthDateErrorMessage ? true : birthDateErrorMessage,
18270
+ isValid: valid.birthDate,
18271
+ children: (childProps) => jsx(InputDate, {
18272
+ ...childProps,
18273
+ name: "birthDate",
18274
+ value: data.birthDate,
18275
+ placeholder: i18n.get("datePlaceholder"),
18276
+ readonly: formUtils.isReadOnly("birthDate"),
18277
+ onInput: handleChangeFor("birthDate", "input"),
18278
+ onBlur: handleChangeFor("birthDate", "blur"),
18279
+ "aria-required": true,
18280
+ "aria-label": formUtils.getLabel("birthDate"),
18281
+ "aria-invalid": !valid.birthDate,
18282
+ max: formatDateObj(/* @__PURE__ */ new Date())
18283
+ })
18284
+ }), isAgeVerificationEnabled && alertProps && jsx(Alert, {
18285
+ ...alertProps
18286
+ })]
18078
18287
  }), jsx(IndividualIdNumberTypeSelector, {
18079
18288
  country: data.residencyCountry,
18080
18289
  setSelected: setIdNumberType,
@@ -18961,6 +19170,7 @@ const ActionBar = ({
18961
19170
  nextButtonLabel,
18962
19171
  hideOnHomeButton,
18963
19172
  hideBackButton,
19173
+ hideNextButton,
18964
19174
  nextButtonDisabled = false
18965
19175
  }) => jsxs("div", {
18966
19176
  className: "adyen-action-bar",
@@ -18972,7 +19182,7 @@ const ActionBar = ({
18972
19182
  secondary: true,
18973
19183
  onClick: () => onBack(),
18974
19184
  testId: "backBtn"
18975
- }), onNext && jsx(Button, {
19185
+ }), onNext && !hideNextButton && jsx(Button, {
18976
19186
  label: nextButtonLabel,
18977
19187
  className: "adyen-action-bar__button",
18978
19188
  onClick: onNext,
@@ -19111,7 +19321,7 @@ class AdyenKycSdkError extends Error {
19111
19321
  }
19112
19322
  let sdkToken;
19113
19323
  let fetchSdkToken;
19114
- const logger$o = createLogger("Session");
19324
+ const logger$q = createLogger("Session");
19115
19325
  const setSdkToken = (token) => {
19116
19326
  sdkToken = token;
19117
19327
  };
@@ -19134,7 +19344,7 @@ const refreshSession = async () => {
19134
19344
  setSdkToken(token);
19135
19345
  isSessionRefreshed = true;
19136
19346
  } catch (e) {
19137
- logger$o.error("Failed to fetch sdk token", e);
19347
+ logger$q.error("Failed to fetch sdk token", e);
19138
19348
  }
19139
19349
  return isSessionRefreshed;
19140
19350
  };
@@ -19144,7 +19354,7 @@ const addAnimationStartListener = (element, listener) => {
19144
19354
  const removeAnimationStartListener = (element, listener) => {
19145
19355
  element.removeEventListener("animationstart", listener, false);
19146
19356
  };
19147
- const logger$n = createLogger("Fetch");
19357
+ const logger$p = createLogger("Fetch");
19148
19358
  const getRequestObject = (options, data) => {
19149
19359
  const {
19150
19360
  headers = [],
@@ -19191,10 +19401,10 @@ const logFetchError = (message, level) => {
19191
19401
  case "info":
19192
19402
  case "warn":
19193
19403
  case "error":
19194
- logger$n[level](message);
19404
+ logger$p[level](message);
19195
19405
  break;
19196
19406
  default:
19197
- logger$n.error(message);
19407
+ logger$p.error(message);
19198
19408
  }
19199
19409
  };
19200
19410
  const handleFetchResponse = async (response, responseType) => {
@@ -19285,7 +19495,7 @@ const RELEVANT_MESSAGE_TYPES = ["account_verification_report_id", "error"];
19285
19495
  const TERMINAL_DATA_PROPS = ["accounts", "error", "reference"];
19286
19496
  const MOUNT_TIMEOUT = 10 * 1e3;
19287
19497
  const TINK_VENDOR = "Tink";
19288
- const logger$m = createLogger("iframeWidget");
19498
+ const logger$o = createLogger("iframeWidget");
19289
19499
  const isObjectData = (data) => typeof data === "object" && !Array.isArray(data) && data !== null;
19290
19500
  const isTerminalMessageData = (data) => isObjectData(data) && Object.entries(data).some(([prop]) => TERMINAL_DATA_PROPS.includes(prop));
19291
19501
  const parseMessageJson = (message) => {
@@ -19303,7 +19513,7 @@ const callbackErrorHandler = async (response) => {
19303
19513
  try {
19304
19514
  await response;
19305
19515
  } catch (ex) {
19306
- logger$m.error(ex);
19516
+ logger$o.error(ex);
19307
19517
  }
19308
19518
  return {
19309
19519
  error: "UNKNOWN_ERROR",
@@ -19406,7 +19616,7 @@ class IFrameWidget {
19406
19616
  message = responseData.errorMessage;
19407
19617
  }
19408
19618
  } catch (ex) {
19409
- logger$m.error(ex);
19619
+ logger$o.error(ex);
19410
19620
  }
19411
19621
  throw new AdyenKycSdkError(reason, jsonData.error);
19412
19622
  }
@@ -19593,7 +19803,7 @@ function BankVerificationWidget({
19593
19803
  ref: widgetContainerRef
19594
19804
  });
19595
19805
  }
19596
- const logger$l = createLogger("BankVerification");
19806
+ const logger$n = createLogger("BankVerification");
19597
19807
  const accountVerificationFields = ["verifiedAccountHolder", "verifiedBankCountry", "verifiedBankName", "verifiedCurrencyCode", "verifiedBankAccountNumber"];
19598
19808
  const InstantVerificationErrorContext = createContext(null);
19599
19809
  const useInstantVerificationErrorNotification = (notificationVisibilityDuration) => {
@@ -19625,7 +19835,7 @@ const usePreferredVendorForCountry = (country2, getBankVerificationVendors) => {
19625
19835
  const vendor = vendors[0];
19626
19836
  setPreferredVendor(vendor.name ? vendor : void 0);
19627
19837
  };
19628
- getPreferredVendor().catch(logger$l.error);
19838
+ getPreferredVendor().catch(logger$n.error);
19629
19839
  }, [country2, getBankVerificationVendors]);
19630
19840
  return preferredVendor;
19631
19841
  };
@@ -20855,7 +21065,7 @@ function PayoutAccountComponent(props) {
20855
21065
  dataStoreId: id2
20856
21066
  }), shouldShowPayoutAlert(country2) && jsx(Alert, {
20857
21067
  hasCloseButton: false,
20858
- type: AlertTypes.BASIC,
21068
+ type: "basic",
20859
21069
  title: getSupportedCurrencyGuidance(i18n, country2, requiredFields)
20860
21070
  })]
20861
21071
  });
@@ -21116,7 +21326,7 @@ function PayoutVerificationMethod(props) {
21116
21326
  children: [jsx(FormHeader, {
21117
21327
  heading: props.heading
21118
21328
  }), instantVerificationError && jsx(Alert, {
21119
- type: AlertTypes.ERROR,
21329
+ type: "error",
21120
21330
  className: "adyen-kyc-instant-verification-error",
21121
21331
  title: instantVerificationError.title,
21122
21332
  hasCloseButton: false,
@@ -22756,7 +22966,7 @@ function VerificationErrors({
22756
22966
  const defaultHeading = parentCode ? getErrorMessage(parentCode) : formUtils.getVal("correctErrorsResubmit");
22757
22967
  return jsx(Alert, {
22758
22968
  title: defaultHeading,
22759
- type: AlertTypes.ERROR,
22969
+ type: "error",
22760
22970
  hasCloseButton: false,
22761
22971
  children: verificationErrorMsg
22762
22972
  });
@@ -22857,13 +23067,13 @@ function Summary({
22857
23067
  children: renderSummaryItems(fieldData, labelData)
22858
23068
  }), jsx(Divider, {})]
22859
23069
  });
22860
- const renderSummaryContent = (data2) => {
23070
+ const renderSummaryContent = (summaryData) => {
22861
23071
  const summaryList = [];
22862
23072
  forms2.forEach(({
22863
23073
  formId,
22864
23074
  formName
22865
23075
  }) => {
22866
- const currentFormData = data2[formId];
23076
+ const currentFormData = summaryData[formId];
22867
23077
  const isFormEmpty = !currentFormData || Object.values(currentFormData).every((value) => isEmpty(value));
22868
23078
  if (isFormEmpty || formId === summaryStep.formId || omittedForms.includes(formId)) return;
22869
23079
  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);
@@ -23159,7 +23369,13 @@ const defaultPayoutAccountFormat = {
23159
23369
  [CountryCodes.Sweden]: "local",
23160
23370
  [CountryCodes.UnitedKingdom]: "local"
23161
23371
  };
23162
- const logger$k = createLogger("useScenarioConfiguration");
23372
+ const useUnifyLoadingStatus = (setParentLoadingStatus, ...childLoadingStatuses) => {
23373
+ useEffect(() => {
23374
+ const loadingStatus = childLoadingStatuses.some((status) => status === "loading") ? "loading" : "success";
23375
+ setParentLoadingStatus(loadingStatus);
23376
+ }, [...childLoadingStatuses]);
23377
+ };
23378
+ const logger$m = createLogger("useScenarioConfiguration");
23163
23379
  const useScenarioConfiguration = ({
23164
23380
  getConfigurationData,
23165
23381
  getPayoutAccountFormatData,
@@ -23175,23 +23391,26 @@ const useScenarioConfiguration = ({
23175
23391
  } = useCoreContext();
23176
23392
  const [configurationResponse, setConfigurationResponse] = useState();
23177
23393
  const [accountFormatResponse, setAccountFormatResponse] = useState();
23394
+ const [configurationLoadingStatus, setConfigurationLoadingStatus] = useState("success");
23395
+ const [payoutFormatLoadingStatus, setpayoutFormatLoadingStatus] = useState("success");
23396
+ useUnifyLoadingStatus(setLoadingStatus, configurationLoadingStatus, payoutFormatLoadingStatus);
23178
23397
  useEffect(() => {
23179
- setLoadingStatus("loading");
23398
+ setConfigurationLoadingStatus("loading");
23180
23399
  const makeConfigCallAndSave = async () => {
23181
23400
  try {
23182
23401
  const response = await getConfigurationData();
23183
23402
  setConfigurationResponse(response);
23184
23403
  } catch (err) {
23185
- logger$k.warn("WARNING: Configuration request failed - error:", err);
23404
+ logger$m.warn("WARNING: Configuration request failed - error:", err);
23186
23405
  } finally {
23187
- setLoadingStatus("success");
23406
+ setConfigurationLoadingStatus("success");
23188
23407
  }
23189
23408
  };
23190
- makeConfigCallAndSave().catch(logger$k.error);
23191
- }, [getConfigurationData, setLoadingStatus]);
23409
+ makeConfigCallAndSave().catch(logger$m.error);
23410
+ }, [getConfigurationData, setConfigurationLoadingStatus]);
23192
23411
  useEffect(() => {
23193
- setLoadingStatus("loading");
23194
23412
  if (!getPayoutAccountFormatData) return;
23413
+ setpayoutFormatLoadingStatus("loading");
23195
23414
  const makePayoutFormatCallAndSave = async () => {
23196
23415
  try {
23197
23416
  const response = await getPayoutAccountFormatData();
@@ -23204,13 +23423,13 @@ const useScenarioConfiguration = ({
23204
23423
  const defaultAccountFormat = defaultPayoutAccountFormat[country2] ?? allowedBankAccountFormats[0];
23205
23424
  setAccountFormat(existingBankAccountFormat ?? defaultAccountFormat);
23206
23425
  } catch (err) {
23207
- logger$k.warn("WARNING: Payout format request failed - error:", err);
23426
+ logger$m.warn("WARNING: Payout format request failed - error:", err);
23208
23427
  } finally {
23209
- setLoadingStatus("success");
23428
+ setpayoutFormatLoadingStatus("success");
23210
23429
  }
23211
23430
  };
23212
- makePayoutFormatCallAndSave().catch(logger$k.error);
23213
- }, [country2, setAccountFormat, getPayoutAccountFormatData, setLoadingStatus, existingBankAccountFormat]);
23431
+ makePayoutFormatCallAndSave().catch(logger$m.error);
23432
+ }, [country2, setAccountFormat, getPayoutAccountFormatData, setpayoutFormatLoadingStatus, existingBankAccountFormat]);
23214
23433
  const {
23215
23434
  fieldConfigurations,
23216
23435
  bankVerificationVendors,
@@ -23261,6 +23480,11 @@ const addLinkedFields = (fields) => {
23261
23480
  }
23262
23481
  return [...new Set(withLinkedFields)];
23263
23482
  };
23483
+ var TrustedFieldsProvider = /* @__PURE__ */ ((TrustedFieldsProvider2) => {
23484
+ TrustedFieldsProvider2["SINGPASS"] = "singpass";
23485
+ TrustedFieldsProvider2["KOMPANY"] = "kompany";
23486
+ return TrustedFieldsProvider2;
23487
+ })(TrustedFieldsProvider || {});
23264
23488
  const identityBase = {
23265
23489
  role: {
23266
23490
  rule: "REQUIRED"
@@ -23592,7 +23816,7 @@ const isFieldRequired = (fieldConfigurations, customRules) => {
23592
23816
  }
23593
23817
  return fieldConfigurations && ((fieldConfigurations == null ? void 0 : fieldConfigurations.rule) === "REQUIRED" || (customRules == null ? void 0 : customRules[fieldConfigurations.rule]) && customRules[fieldConfigurations.rule]() === "REQUIRED");
23594
23818
  };
23595
- function getPropsFromConfigurations(scenarioConfiguration, forms2, remediationActions, dataMissingErrors, fieldsWithExistingData, customRules = {}, customLabels2 = {}, customValidators = {}) {
23819
+ function getPropsFromConfigurations(scenarioConfiguration, forms2, remediationActions, dataMissingErrors, fieldsWithExistingData, customRules = {}, customLabels2 = {}, customValidators = {}, legalEntityTrustedFields) {
23596
23820
  var _a;
23597
23821
  const requiredFields = {};
23598
23822
  const optionalFields = {};
@@ -23604,9 +23828,19 @@ function getPropsFromConfigurations(scenarioConfiguration, forms2, remediationAc
23604
23828
  const masks = {};
23605
23829
  const validators2 = {};
23606
23830
  const obscuredFields = {};
23831
+ const trustedFields2 = {};
23607
23832
  if (!scenarioConfiguration) {
23608
23833
  return;
23609
23834
  }
23835
+ const readonly = ["legalFormDescription"];
23836
+ const trustedMappings = legalEntityTrustedFields == null ? void 0 : legalEntityTrustedFields.reduce((acc, trusted) => {
23837
+ switch (trusted.provider) {
23838
+ case TrustedFieldsProvider.KOMPANY:
23839
+ return [...acc, ...trusted.fields.map((tf) => businessDetailsApiKeyMapping[tf])];
23840
+ default:
23841
+ return acc;
23842
+ }
23843
+ }, []);
23610
23844
  (_a = Object.entries(forms2)) == null ? void 0 : _a.forEach(([formId, formDetails]) => {
23611
23845
  var _a2;
23612
23846
  const formFieldsWithExistingData = addLinkedFields(fieldsWithExistingData).filter((field) => field.startsWith(formId)).map((field) => field.slice(field.lastIndexOf(".") + 1));
@@ -23618,7 +23852,7 @@ function getPropsFromConfigurations(scenarioConfiguration, forms2, remediationAc
23618
23852
  const isFieldNeededToRemediateDataMissingError = isFieldRequiredToRemediateDataMissingError(formId, field, dataMissingErrors);
23619
23853
  const fieldHasExistingData = formFieldsWithExistingData.includes(field);
23620
23854
  const isRequired = isFieldRequiredByRemediationAction || isRequiredFromFieldConfig || isFieldNeededToRemediateDataMissingError || fieldHasExistingData;
23621
- if (isRequired) {
23855
+ if (isRequired && !readonly.includes(field)) {
23622
23856
  requiredFields[formId] = requiredFields[formId] ? [...requiredFields[formId], field] : [field];
23623
23857
  allFields[formId] = allFields[formId] ? [...allFields[formId], field] : [field];
23624
23858
  }
@@ -23628,6 +23862,10 @@ function getPropsFromConfigurations(scenarioConfiguration, forms2, remediationAc
23628
23862
  optionalFields[formId] = optionalFields[formId] ? [...optionalFields[formId], field] : [field];
23629
23863
  allFields[formId] = allFields[formId] ? [...allFields[formId], field] : [field];
23630
23864
  }
23865
+ const isFieldTrusted = isTrustedField(trustedMappings, formId, field);
23866
+ if (isFieldTrusted) {
23867
+ trustedFields2[formId] = trustedFields2[formId] ? [...trustedFields2[formId], field] : [field];
23868
+ }
23631
23869
  if (fieldConfigurations) {
23632
23870
  const customLabel = (_a3 = customLabels2 == null ? void 0 : customLabels2[field]) == null ? void 0 : _a3.call(customLabels2);
23633
23871
  const label = customLabel || fieldConfigurations.label;
@@ -23697,6 +23935,7 @@ function getPropsFromConfigurations(scenarioConfiguration, forms2, remediationAc
23697
23935
  placeholders,
23698
23936
  validators: validators2,
23699
23937
  obscuredFields,
23938
+ trustedFields: trustedFields2,
23700
23939
  helperText,
23701
23940
  masks
23702
23941
  };
@@ -23717,6 +23956,10 @@ const isFieldRequiredToRemediateDataMissingError = (formId, field, dataMissingEr
23717
23956
  const missingAndLinkedFields = addLinkedFields(missingFields);
23718
23957
  return missingAndLinkedFields.includes(makeTLDSFieldName(formId, field));
23719
23958
  };
23959
+ const isTrustedField = (trustedFields2, formId, field) => trustedFields2 == null ? void 0 : trustedFields2.some((trustedField) => {
23960
+ const split = trustedField.split(".");
23961
+ return split[0] === formId && split[split.length - 1] === field;
23962
+ });
23720
23963
  function getBaseTrackingPayload({
23721
23964
  trackingConfig = {
23722
23965
  topLevelLegalEntity: {}
@@ -23946,7 +24189,7 @@ const DateOfIncorporationFieldValidation = () => ({
23946
24189
  errorMessage: "invalidDateOfIncorporation"
23947
24190
  }]
23948
24191
  });
23949
- const DBA_NAME_FIELD = ["hasDBA", "dbaName"];
24192
+ const DBA_NAME_FIELD = ["hasDba", "dbaName"];
23950
24193
  function DBANameField({
23951
24194
  data,
23952
24195
  valid,
@@ -23954,35 +24197,39 @@ function DBANameField({
23954
24197
  labels: labels2,
23955
24198
  helperText,
23956
24199
  readonly,
23957
- handleChangeFor
24200
+ handleChangeFor,
24201
+ setErrors
23958
24202
  }) {
23959
24203
  const {
23960
24204
  i18n
23961
24205
  } = useI18nContext();
23962
- const selected = data.hasDBA ? "yesDba" : "noDba";
23963
- const handleHasDbaChange = (selection) => {
23964
- handleChangeFor("hasDBA")(selection === "yesDba");
23965
- };
24206
+ const selection = useMemo(() => {
24207
+ if (typeof data.hasDba === "undefined") return;
24208
+ if (!data.hasDba) setErrors == null ? void 0 : setErrors("dbaName", null);
24209
+ return data.hasDba ? "yes" : "no";
24210
+ }, [data.hasDba, setErrors]);
23966
24211
  return jsxs(Fragment, {
23967
24212
  children: [jsx(Field, {
23968
24213
  name: "hasDba",
23969
- label: labels2.hasDBA ?? i18n.get("hasDba"),
23970
- helper: (helperText == null ? void 0 : helperText.hasDBA) ?? i18n.get("hasDba__helperText"),
24214
+ label: labels2.hasDba ?? i18n.get("hasDba"),
24215
+ helper: (helperText == null ? void 0 : helperText.hasDba) ?? i18n.get("hasDba__helperText"),
24216
+ isValid: valid.hasDba,
24217
+ errorMessage: errors.hasDba,
23971
24218
  children: (childProps) => jsx(RadioGroup, {
23972
24219
  ...childProps,
23973
24220
  name: "hasDba",
23974
24221
  items: [{
23975
- id: "yesDba",
24222
+ id: "yes",
23976
24223
  name: "yes"
23977
24224
  }, {
23978
- id: "noDba",
24225
+ id: "no",
23979
24226
  name: "no"
23980
24227
  }],
23981
- value: selected,
23982
- onChange: (e) => handleHasDbaChange(e.target.value),
24228
+ value: selection,
24229
+ onChange: (e) => handleChangeFor("hasDba")(e.target.value === "yes"),
23983
24230
  horizontal: true
23984
24231
  })
23985
- }), data.hasDBA && jsx(Field, {
24232
+ }), data.hasDba && jsx(Field, {
23986
24233
  name: "dbaName",
23987
24234
  label: labels2.dbaName ?? i18n.get("dbaName"),
23988
24235
  errorMessage: errors.dbaName,
@@ -24003,9 +24250,12 @@ function DBANameField({
24003
24250
  })]
24004
24251
  });
24005
24252
  }
24253
+ const hasDbaFieldMetadata = {
24254
+ validators: [validateNotEmptyOnBlur]
24255
+ };
24006
24256
  const dbaNameFieldMetadata = {
24007
24257
  label: "dbaName",
24008
- validators: validateNotEmptyOnBlur
24258
+ validators: [validateNotEmptyOnBlur]
24009
24259
  };
24010
24260
  const TAX_INFORMATION_FIELD = ["taxInformation", "exemptedFromTax", "isUen"];
24011
24261
  function TaxInformationField({
@@ -24208,8 +24458,76 @@ const defaultFieldConfig$1 = entriesOf(defaultFieldConfig$8).reduce((fieldConfig
24208
24458
  };
24209
24459
  }
24210
24460
  }), {});
24461
+ function VerifiedBusinessCard({
24462
+ verifiedBusiness
24463
+ }) {
24464
+ const {
24465
+ i18n
24466
+ } = useI18nContext();
24467
+ const [expanded, setExpanded] = useState(false);
24468
+ 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;
24469
+ const addressLink = (verifiedBusiness == null ? void 0 : verifiedBusiness.address) ? `https://www.google.com/maps/place/${verifiedBusiness == null ? void 0 : verifiedBusiness.address.replaceAll(" ", "+")}` : void 0;
24470
+ return jsxs("section", {
24471
+ children: [jsx(Typography, {
24472
+ el: "h3",
24473
+ children: i18n.get("verifiedInformation")
24474
+ }), jsxs("div", {
24475
+ className: "adyen-kyc-verified-business-card",
24476
+ children: [jsxs("ul", {
24477
+ children: [jsxs("li", {
24478
+ children: [jsx(Typography, {
24479
+ className: "adyen-kyc-verified-business-card__data-title ",
24480
+ children: i18n.get("legalCompanyName__US")
24481
+ }), jsx(Typography, {
24482
+ children: verifiedBusiness == null ? void 0 : verifiedBusiness.name
24483
+ })]
24484
+ }), jsxs("li", {
24485
+ children: [jsx(Typography, {
24486
+ className: "adyen-kyc-verified-business-card__data-title ",
24487
+ children: i18n.get("registrationNumber__US")
24488
+ }), jsx(Typography, {
24489
+ children: verifiedBusiness == null ? void 0 : verifiedBusiness.registrationNumber
24490
+ })]
24491
+ })]
24492
+ }), jsx(Divider, {}), expanded && jsxs(Fragment, {
24493
+ children: [((verifiedBusiness == null ? void 0 : verifiedBusiness.legalForm) || address2) && jsxs("ul", {
24494
+ children: [(verifiedBusiness == null ? void 0 : verifiedBusiness.legalForm) && jsxs("li", {
24495
+ children: [jsx(Typography, {
24496
+ className: "adyen-kyc-verified-business-card__data-title ",
24497
+ children: i18n.get("legalForm")
24498
+ }), jsx(Typography, {
24499
+ children: verifiedBusiness == null ? void 0 : verifiedBusiness.legalForm
24500
+ })]
24501
+ }), address2 && jsxs("li", {
24502
+ children: [jsx(Typography, {
24503
+ className: "adyen-kyc-verified-business-card__data-title ",
24504
+ children: i18n.get("address")
24505
+ }), jsx(Typography, {
24506
+ children: jsxs("div", {
24507
+ className: "adyen-kyc-verified-business-card__address",
24508
+ children: [address2, jsx("a", {
24509
+ href: addressLink,
24510
+ target: "_blank",
24511
+ rel: "noreferrer",
24512
+ children: i18n.get("showOnMap")
24513
+ })]
24514
+ })
24515
+ })]
24516
+ })]
24517
+ }), jsx(Divider, {})]
24518
+ }), jsx("div", {
24519
+ className: "adyen-kyc-verified-business-card__button",
24520
+ children: jsx(Button, {
24521
+ label: expanded ? i18n.get("hideDetails") : i18n.get("showDetails"),
24522
+ showAsLink: true,
24523
+ onClick: () => setExpanded(!expanded)
24524
+ })
24525
+ })]
24526
+ })]
24527
+ });
24528
+ }
24211
24529
  const ADDITIONAL_INFORMATION_FORM_ID = "additionalInformation";
24212
- 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];
24530
+ 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"];
24213
24531
  function AdditionalInformationComponent({
24214
24532
  data,
24215
24533
  labels: labels2,
@@ -24226,8 +24544,11 @@ function AdditionalInformationComponent({
24226
24544
  obscuredFields,
24227
24545
  optionalFields,
24228
24546
  readOnlyFields,
24547
+ trustedFields: trustedFields2,
24229
24548
  country: country2,
24230
- companyType: companyType2 = CompanyTypesValue.PRIVATE_COMPANY
24549
+ companyType: companyType2 = CompanyTypesValue.PRIVATE_COMPANY,
24550
+ verifiedBusiness,
24551
+ showCompanyStructure
24231
24552
  }) {
24232
24553
  var _a, _b, _c, _d;
24233
24554
  const {
@@ -24236,6 +24557,8 @@ function AdditionalInformationComponent({
24236
24557
  const {
24237
24558
  i18n
24238
24559
  } = useI18nContext();
24560
+ const showVerified = !!verifiedBusiness;
24561
+ const showStockData = companyType2 === CompanyTypesValue.PUBLIC_COMPANY;
24239
24562
  const initialFormUtilsProps = useMemo(() => ({
24240
24563
  data,
24241
24564
  labels: labels2,
@@ -24247,8 +24570,9 @@ function AdditionalInformationComponent({
24247
24570
  readOnlyFields,
24248
24571
  optionalFields,
24249
24572
  obscuredFields,
24573
+ trustedFields: trustedFields2,
24250
24574
  shouldValidate
24251
- }), [data, allFields, helperText, labels2, obscuredFields, optionalFields, placeholders, readOnly, readOnlyFields, requiredFields, shouldValidate]);
24575
+ }), [data, labels2, placeholders, helperText, readOnly, allFields, requiredFields, readOnlyFields, optionalFields, obscuredFields, trustedFields2, shouldValidate]);
24252
24576
  const registrationNumberOptions = useMemo(() => getCompanyRegistrationNumberOptions(country2, companyType2), [country2, companyType2]);
24253
24577
  const defaultRegistrationNumberType = (data == null ? void 0 : data.registrationNumber) ? inferCompanyRegistrationNumberType(data == null ? void 0 : data.registrationNumber, country2, companyType2) : registrationNumberOptions == null ? void 0 : registrationNumberOptions[0].id;
24254
24578
  const [registrationNumberType, setRegistrationNumberType] = useState(defaultRegistrationNumberType);
@@ -24257,6 +24581,19 @@ function AdditionalInformationComponent({
24257
24581
  const [taxIdNumberType, setTaxIdNumberType] = useState(defaultTaxIdNumberType);
24258
24582
  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;
24259
24583
  const [vatNumberType, setVatNumberType] = useState(defaultVatNumberType);
24584
+ const getFormSchema2 = useCallback((currentData) => {
24585
+ var _a2;
24586
+ const fieldsToRemove = [];
24587
+ if (currentData.exemptedFromVat) {
24588
+ fieldsToRemove.push("vatNumber");
24589
+ } else {
24590
+ fieldsToRemove.push("vatAbsenceReason");
24591
+ }
24592
+ if (!currentData.hasDba) {
24593
+ fieldsToRemove.push("dbaName");
24594
+ }
24595
+ return ((_a2 = initialFormUtilsProps.requiredFields) == null ? void 0 : _a2.filter((field) => !fieldsToRemove.includes(field))) ?? [...LEGAL_COMPANY_NAME_FIELD, ...DBA_NAME_FIELD];
24596
+ }, [initialFormUtilsProps.requiredFields]);
24260
24597
  const mergedFieldProps = useMemo(() => {
24261
24598
  var _a2;
24262
24599
  return (_a2 = initialFormUtilsProps.allFields) == null ? void 0 : _a2.reduce((acc, field) => {
@@ -24265,6 +24602,8 @@ function AdditionalInformationComponent({
24265
24602
  return mergeFieldMetadataIntoProps(field, resolveFieldMetadata(defaultFieldConfig$a[country2], {
24266
24603
  isBusiness: true
24267
24604
  }, defaultFieldMetadata$a), acc);
24605
+ case "hasDba":
24606
+ return mergeFieldMetadataIntoProps("hasDba", hasDbaFieldMetadata, acc);
24268
24607
  case "dbaName":
24269
24608
  return mergeFieldMetadataIntoProps("dbaName", dbaNameFieldMetadata, acc);
24270
24609
  case "registrationNumber":
@@ -24301,31 +24640,22 @@ function AdditionalInformationComponent({
24301
24640
  }
24302
24641
  }, initialFormUtilsProps);
24303
24642
  }, [companyType2, country2, initialFormUtilsProps, registrationNumberType, taxIdNumberType, vatNumberType]);
24304
- const getSchema = (currentData) => {
24305
- const fieldsToRemove = [];
24306
- if (currentData.exemptedFromVat) {
24307
- fieldsToRemove.push("vatNumber");
24308
- } else {
24309
- fieldsToRemove.push("vatAbsenceReason");
24310
- }
24311
- if (!currentData.hasDBA) {
24312
- fieldsToRemove.push("dbaName");
24313
- }
24314
- return (requiredFields == null ? void 0 : requiredFields.filter((field) => !fieldsToRemove.includes(field))) ?? [...LEGAL_COMPANY_NAME_FIELD, ...DBA_NAME_FIELD];
24315
- };
24316
24643
  const {
24317
24644
  schema: formSchema,
24318
24645
  data: formData,
24319
24646
  errors: formErrors,
24320
24647
  valid: formValid,
24321
24648
  fieldProblems: formFieldProblems,
24322
- handleChangeFor
24649
+ handleChangeFor,
24650
+ resetToDefaultData,
24651
+ setErrors
24323
24652
  } = useForm({
24324
- schema: getSchema,
24653
+ schema: getFormSchema2,
24325
24654
  defaultData: data,
24326
24655
  rules: mergedFieldProps == null ? void 0 : mergedFieldProps.validators,
24327
24656
  optionalFields: mergedFieldProps == null ? void 0 : mergedFieldProps.optionalFields,
24328
24657
  obscuredFields: mergedFieldProps == null ? void 0 : mergedFieldProps.obscuredFields,
24658
+ trustedFields: mergedFieldProps == null ? void 0 : mergedFieldProps.trustedFields,
24329
24659
  fieldProblems: fieldValidationErrors,
24330
24660
  shouldValidate
24331
24661
  });
@@ -24339,8 +24669,21 @@ function AdditionalInformationComponent({
24339
24669
  fieldProblems: formFieldProblems
24340
24670
  });
24341
24671
  }, [formSchema, formData, formErrors, formFieldProblems, formValid, updateStateSlice]);
24342
- const [showVerified, setShowVerified] = useState(false);
24343
- const showStockData = companyType2 === CompanyTypesValue.PUBLIC_COMPANY;
24672
+ useEffect(() => {
24673
+ if (verifiedBusiness && verifiedBusiness.name !== formData.legalCompanyName) return handleChangeFor("legalCompanyName")(verifiedBusiness.name);
24674
+ if (!verifiedBusiness && !showCompanyStructure) {
24675
+ return resetToDefaultData();
24676
+ }
24677
+ }, [formData.legalCompanyName, verifiedBusiness, showCompanyStructure]);
24678
+ const showField = (fieldKeys) => fieldKeys.some((field) => {
24679
+ switch (field) {
24680
+ case "legalCompanyName": {
24681
+ return (formUtils.isRequiredField(field) || formUtils.isOptionalField(field)) && !(verifiedBusiness == null ? void 0 : verifiedBusiness.name);
24682
+ }
24683
+ default:
24684
+ return formUtils.isRequiredField(field) || formUtils.isOptionalField(field);
24685
+ }
24686
+ });
24344
24687
  return jsxs("form", {
24345
24688
  children: [jsx(FormHeader, {
24346
24689
  heading,
@@ -24352,18 +24695,13 @@ function AdditionalInformationComponent({
24352
24695
  formUtils
24353
24696
  }), jsxs("div", {
24354
24697
  className: "adyen-kyc-additional-information",
24355
- children: [showVerified && jsxs("div", {
24356
- className: "adyen-kyc-additional-information__verified-information",
24357
- children: [jsx("h3", {
24358
- children: i18n.get("verifiedInformation")
24359
- }), jsx("div", {
24360
- className: "adyen-kyc-verified-information-card"
24361
- })]
24362
- }), jsxs("div", {
24363
- className: "adyen-kyc-additional-information__other-business-information",
24364
- children: [showVerified && jsx("h3", {
24698
+ children: [showVerified && jsx(VerifiedBusinessCard, {
24699
+ verifiedBusiness
24700
+ }), jsxs("section", {
24701
+ children: [showVerified && jsx(Typography, {
24702
+ el: "h3",
24365
24703
  children: i18n.get("otherBusinessInformation")
24366
- }), formUtils.isRequiredField("legalCompanyName") && jsx("div", {
24704
+ }), showField(LEGAL_COMPANY_NAME_FIELD) && jsx("div", {
24367
24705
  className: "adyen-kyc-field-wrapper",
24368
24706
  children: jsx(LegalCompanyNameField, {
24369
24707
  data: formUtils.getFieldData(formData, LEGAL_COMPANY_NAME_FIELD),
@@ -24376,19 +24714,20 @@ function AdditionalInformationComponent({
24376
24714
  readonly: formUtils.isReadOnly("legalCompanyName"),
24377
24715
  handleChangeFor
24378
24716
  })
24379
- }), formUtils.isRequiredField("dbaName") && jsx("div", {
24717
+ }), showField(DBA_NAME_FIELD) && jsx("div", {
24380
24718
  className: "adyen-kyc-field-wrapper",
24381
24719
  children: jsx(DBANameField, {
24382
24720
  data: formUtils.getFieldData(formData, DBA_NAME_FIELD),
24383
24721
  valid: formUtils.getFieldValid(formValid, DBA_NAME_FIELD),
24384
24722
  errors: formUtils.getFieldErrors(formErrors, formFieldProblems, DBA_NAME_FIELD),
24385
24723
  labels: formUtils.getFieldLabels(DBA_NAME_FIELD, {
24386
- hasDBA: "hasDba"
24724
+ hasDba: "hasDba"
24387
24725
  }),
24388
24726
  readonly: formUtils.isReadOnly("dbaName"),
24389
- handleChangeFor
24727
+ handleChangeFor,
24728
+ setErrors
24390
24729
  })
24391
- }), formUtils.isRequiredField("registrationNumber") && jsx("div", {
24730
+ }), showField(BUSINESS_REGISTRATION_NUMBER_FIELD) && jsx("div", {
24392
24731
  className: "adyen-kyc-field-wrapper",
24393
24732
  children: jsx(BusinessRegistrationNumberField, {
24394
24733
  data: formUtils.getFieldData(formData, BUSINESS_REGISTRATION_NUMBER_FIELD),
@@ -24412,7 +24751,7 @@ function AdditionalInformationComponent({
24412
24751
  registrationNumberType,
24413
24752
  setRegistrationNumberType
24414
24753
  })
24415
- }), formUtils.isRequiredField("taxInformation") && jsx("div", {
24754
+ }), showField(TAX_INFORMATION_FIELD) && jsx("div", {
24416
24755
  className: "adyen-kyc-field-wrapper",
24417
24756
  children: jsx(TaxInformationField, {
24418
24757
  data: formUtils.getFieldData(formData, TAX_INFORMATION_FIELD),
@@ -24435,7 +24774,7 @@ function AdditionalInformationComponent({
24435
24774
  setTaxIdNumberType,
24436
24775
  defaultData: data == null ? void 0 : data.taxInformation
24437
24776
  })
24438
- }), formUtils.isRequiredField("vatNumber") && jsx("div", {
24777
+ }), showField(VAT_NUMBER_FIELD) && jsx("div", {
24439
24778
  className: "adyen-kyc-field-wrapper",
24440
24779
  children: jsx(VatNumberField, {
24441
24780
  data: formUtils.getFieldData(formData, VAT_NUMBER_FIELD),
@@ -24454,7 +24793,7 @@ function AdditionalInformationComponent({
24454
24793
  vatNumberType,
24455
24794
  setVatNumberType
24456
24795
  })
24457
- }), formUtils.isRequiredField("dateOfIncorporation") && jsx("div", {
24796
+ }), showField(DATE_OF_INCORPORATION_FIELD) && jsx("div", {
24458
24797
  className: "adyen-kyc-field-wrapper",
24459
24798
  children: jsx(DateOfIncorporationField, {
24460
24799
  data: formUtils.getFieldData(formData, DATE_OF_INCORPORATION_FIELD),
@@ -24468,11 +24807,11 @@ function AdditionalInformationComponent({
24468
24807
  handleChangeFor
24469
24808
  })
24470
24809
  })]
24471
- }), showStockData && jsxs("div", {
24472
- className: "adyen-kyc-additional-information__stock-exchange-information",
24473
- children: [jsx("h3", {
24810
+ }), showStockData && jsxs("section", {
24811
+ children: [jsx(Typography, {
24812
+ el: "h3",
24474
24813
  children: i18n.get("stockExchangeInformation")
24475
- }), formUtils.isRequiredField("stockExchangeMIC") && jsx("div", {
24814
+ }), showField(STOCK_EXCHANGE_MIC_FIELD) && jsx("div", {
24476
24815
  className: "adyen-kyc-field-wrapper",
24477
24816
  children: jsx(StockExchangeMICField, {
24478
24817
  data: formUtils.getFieldData(formData, STOCK_EXCHANGE_MIC_FIELD),
@@ -24486,7 +24825,7 @@ function AdditionalInformationComponent({
24486
24825
  shouldValidate,
24487
24826
  handleChangeFor
24488
24827
  })
24489
- }), formUtils.isRequiredField("stockISIN") && jsx("div", {
24828
+ }), showField(STOCK_ISIN_FIELD) && jsx("div", {
24490
24829
  className: "adyen-kyc-field-wrapper",
24491
24830
  children: jsx(StockISINField, {
24492
24831
  data: formUtils.getFieldData(formData, STOCK_ISIN_FIELD),
@@ -24500,7 +24839,7 @@ function AdditionalInformationComponent({
24500
24839
  shouldValidate,
24501
24840
  handleChangeFor
24502
24841
  })
24503
- }), formUtils.isRequiredField("stockTickerSymbol") && jsx("div", {
24842
+ }), showField(STOCK_TICKER_SYMBOL_FIELD) && jsx("div", {
24504
24843
  className: "adyen-kyc-field-wrapper",
24505
24844
  children: jsx(StockTickerSymbolField, {
24506
24845
  data: formUtils.getFieldData(formData, STOCK_TICKER_SYMBOL_FIELD),
@@ -24610,9 +24949,11 @@ function BasicInformationComponent({
24610
24949
  obscuredFields,
24611
24950
  optionalFields,
24612
24951
  readOnlyFields,
24952
+ trustedFields: trustedFields2,
24613
24953
  country: country2,
24614
24954
  companyType: companyType2 = CompanyTypesValue.PRIVATE_COMPANY,
24615
- isTopLevelEntity
24955
+ isTopLevelEntity,
24956
+ isBusinessSelection
24616
24957
  }) {
24617
24958
  var _a, _b, _c, _d, _e;
24618
24959
  const {
@@ -24637,8 +24978,9 @@ function BasicInformationComponent({
24637
24978
  readOnlyFields,
24638
24979
  optionalFields,
24639
24980
  obscuredFields,
24981
+ trustedFields: trustedFields2,
24640
24982
  shouldValidate
24641
- }), [allFields, helperText, labels2, obscuredFields, optionalFields, placeholders, readOnly, readOnlyFields, requiredFields, shouldValidate]);
24983
+ }), [allFields, helperText, labels2, obscuredFields, optionalFields, placeholders, readOnly, readOnlyFields, requiredFields, trustedFields2, shouldValidate]);
24642
24984
  const registrationNumberOptions = useMemo(() => getCompanyRegistrationNumberOptions(country2, companyType2), [country2, companyType2]);
24643
24985
  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;
24644
24986
  const [registrationNumberType, setRegistrationNumberType] = useState(defaultRegistrationNumberType);
@@ -24691,6 +25033,7 @@ function BasicInformationComponent({
24691
25033
  rules: mergedFieldProps == null ? void 0 : mergedFieldProps.validators,
24692
25034
  optionalFields: mergedFieldProps == null ? void 0 : mergedFieldProps.optionalFields,
24693
25035
  obscuredFields: mergedFieldProps == null ? void 0 : mergedFieldProps.obscuredFields,
25036
+ trustedFields: mergedFieldProps == null ? void 0 : mergedFieldProps.trustedFields,
24694
25037
  fieldProblems: fieldValidationErrors,
24695
25038
  shouldValidate
24696
25039
  });
@@ -24705,6 +25048,7 @@ function BasicInformationComponent({
24705
25048
  });
24706
25049
  }, [formSchema, formData, formErrors, formFieldProblems, formValid, updateStateSlice]);
24707
25050
  return jsxs("form", {
25051
+ className: isBusinessSelection ? "adyen-kyc-hide-form" : void 0,
24708
25052
  children: [jsx(FormHeader, {
24709
25053
  heading,
24710
25054
  description: description2
@@ -24715,94 +25059,272 @@ function BasicInformationComponent({
24715
25059
  formUtils
24716
25060
  }), jsxs("div", {
24717
25061
  className: "adyen-kyc-basic-information",
24718
- children: [formUtils.isRequiredField("country") && jsx("div", {
24719
- className: "adyen-kyc-field-wrapper",
24720
- children: jsx(CountryField, {
24721
- data: formUtils.getFieldData(formData, COUNTRY_FIELD),
24722
- valid: formUtils.getFieldValid(formValid, COUNTRY_FIELD),
24723
- errors: formUtils.getFieldErrors(formErrors, formFieldProblems, COUNTRY_FIELD),
24724
- labels: formUtils.getFieldLabels(COUNTRY_FIELD, {
24725
- country: "countryRegionOfEstablishment"
24726
- }),
24727
- readonly: formUtils.isReadOnly("country") || !isAllowedEditPrefilledCountry,
24728
- handleChangeFor,
24729
- allowedCountries: isTopLevelEntity ? allowedCountries : void 0
24730
- })
24731
- }), formUtils.isRequiredField("businessName") && jsx("div", {
24732
- className: "adyen-kyc-field-wrapper",
24733
- children: jsx(BusinessNameField, {
24734
- data: formUtils.getFieldData(formData, BUSINESS_NAME_FIELD),
24735
- valid: formUtils.getFieldValid(formValid, BUSINESS_NAME_FIELD),
24736
- errors: formUtils.getFieldErrors(formErrors, formFieldProblems, BUSINESS_NAME_FIELD),
24737
- labels: formUtils.getFieldLabels(BUSINESS_NAME_FIELD),
24738
- readonly: formUtils.isReadOnly("businessName"),
24739
- handleChangeFor
24740
- })
24741
- }), formUtils.isRequiredField("taxInformation") && jsx("div", {
24742
- className: "adyen-kyc-field-wrapper",
24743
- children: jsx(TaxInformationField, {
24744
- data: formUtils.getFieldData(formData, TAX_INFORMATION_FIELD),
24745
- valid: formUtils.getFieldValid(formValid, TAX_INFORMATION_FIELD),
24746
- errors: formUtils.getFieldErrors(formErrors, formFieldProblems, TAX_INFORMATION_FIELD),
24747
- labels: formUtils.getFieldLabels(TAX_INFORMATION_FIELD, {
24748
- exemptedFromTax: "iDontHaveATaxId"
24749
- }),
24750
- mask: formUtils.getMask("taxInformation"),
24751
- helperText: formUtils.getFieldHelperText(TAX_INFORMATION_FIELD),
24752
- placeholders: formUtils.getFieldPlaceholders(TAX_INFORMATION_FIELD),
24753
- guidanceText: formUtils.getFieldGuidanceText(TAX_INFORMATION_FIELD),
24754
- readonly: formUtils.isReadOnly("taxInformation"),
24755
- shouldValidate,
24756
- handleChangeFor,
24757
- canExempt: formUtils.isRequiredField("exemptedFromTax"),
24758
- registrationNumber: formData.registrationNumber,
24759
- isUen: formUtils.isRequiredField("isUen"),
24760
- country: formData.country ?? country2,
24761
- companyType: companyType2,
24762
- taxIdNumberType,
24763
- setTaxIdNumberType,
24764
- defaultData: data == null ? void 0 : data.taxInformation
24765
- })
24766
- }), formUtils.isRequiredField("stateOrProvince") && jsx("div", {
24767
- className: "adyen-kyc-field-wrapper",
24768
- children: jsx(StateField, {
24769
- data: formUtils.getFieldData(formData, STATE_FIELD),
24770
- valid: formUtils.getFieldValid(formValid, STATE_FIELD),
24771
- errors: formUtils.getFieldErrors(formErrors, formFieldProblems, STATE_FIELD),
24772
- labels: formUtils.getFieldLabels(STATE_FIELD),
24773
- placeholders: formUtils.getFieldPlaceholders(STATE_FIELD),
24774
- readonly: formUtils.isReadOnly("stateOrProvince"),
24775
- handleChangeFor,
24776
- selectedCountry: formData.country
24777
- })
24778
- }), (formUtils.isRequiredField("registrationNumber") || formUtils.isOptionalField("registrationNumber")) && jsx("div", {
24779
- className: "adyen-kyc-field-wrapper",
24780
- children: jsx(BusinessRegistrationNumberField, {
24781
- data: formUtils.getFieldData(formData, BUSINESS_REGISTRATION_NUMBER_FIELD),
24782
- valid: formUtils.getFieldValid(formValid, BUSINESS_REGISTRATION_NUMBER_FIELD),
24783
- errors: formUtils.getFieldErrors(formErrors, formFieldProblems, BUSINESS_REGISTRATION_NUMBER_FIELD),
24784
- labels: formUtils.getFieldLabels(BUSINESS_REGISTRATION_NUMBER_FIELD, {
24785
- exemptedFromRegistrationNumber: "iDontHaveARegistrationNumber"
24786
- }),
24787
- mask: formUtils.getMask("registrationNumber"),
24788
- guidanceText: formUtils.getFieldGuidanceText(BUSINESS_REGISTRATION_NUMBER_FIELD),
24789
- placeholders: formUtils.getFieldPlaceholders(BUSINESS_REGISTRATION_NUMBER_FIELD),
24790
- helperText: formUtils.getFieldHelperText(BUSINESS_REGISTRATION_NUMBER_FIELD),
24791
- readonly: formUtils.isReadOnly("registrationNumber"),
24792
- optional: formUtils.isOptionalField("registrationNumber"),
24793
- shouldValidate,
24794
- handleChangeFor,
24795
- country: formData.country ?? country2,
24796
- canExempt: formUtils.isRequiredField("exemptedFromRegistrationNumber"),
24797
- companyType: companyType2,
24798
- registrationNumberOptions,
24799
- registrationNumberType,
24800
- setRegistrationNumberType
25062
+ children: [jsx("fieldset", {
25063
+ children: jsx("div", {
25064
+ className: "adyen-kyc-field-wrapper",
25065
+ children: jsx(CountryField, {
25066
+ data: formUtils.getFieldData(formData, COUNTRY_FIELD),
25067
+ valid: formUtils.getFieldValid(formValid, COUNTRY_FIELD),
25068
+ errors: formUtils.getFieldErrors(formErrors, formFieldProblems, COUNTRY_FIELD),
25069
+ labels: formUtils.getFieldLabels(COUNTRY_FIELD, {
25070
+ country: "countryRegionOfEstablishment"
25071
+ }),
25072
+ readonly: formUtils.isReadOnly("country") || !isAllowedEditPrefilledCountry,
25073
+ handleChangeFor,
25074
+ allowedCountries: isTopLevelEntity ? allowedCountries : void 0
25075
+ })
24801
25076
  })
25077
+ }), COUNTRIES_USING_COMPANY_SEARCH.includes(formData.country ?? country2) && jsxs("fieldset", {
25078
+ children: [formUtils.isRequiredField("businessName") && jsx("div", {
25079
+ className: "adyen-kyc-field-wrapper",
25080
+ children: jsx(BusinessNameField, {
25081
+ data: formUtils.getFieldData(formData, BUSINESS_NAME_FIELD),
25082
+ valid: formUtils.getFieldValid(formValid, BUSINESS_NAME_FIELD),
25083
+ errors: formUtils.getFieldErrors(formErrors, formFieldProblems, BUSINESS_NAME_FIELD),
25084
+ labels: formUtils.getFieldLabels(BUSINESS_NAME_FIELD),
25085
+ readonly: formUtils.isReadOnly("businessName"),
25086
+ handleChangeFor
25087
+ })
25088
+ }), formUtils.isRequiredField("taxInformation") && jsx("div", {
25089
+ className: "adyen-kyc-field-wrapper",
25090
+ children: jsx(TaxInformationField, {
25091
+ data: formUtils.getFieldData(formData, TAX_INFORMATION_FIELD),
25092
+ valid: formUtils.getFieldValid(formValid, TAX_INFORMATION_FIELD),
25093
+ errors: formUtils.getFieldErrors(formErrors, formFieldProblems, TAX_INFORMATION_FIELD),
25094
+ labels: formUtils.getFieldLabels(TAX_INFORMATION_FIELD, {
25095
+ exemptedFromTax: "iDontHaveATaxId"
25096
+ }),
25097
+ mask: formUtils.getMask("taxInformation"),
25098
+ helperText: formUtils.getFieldHelperText(TAX_INFORMATION_FIELD),
25099
+ placeholders: formUtils.getFieldPlaceholders(TAX_INFORMATION_FIELD),
25100
+ guidanceText: formUtils.getFieldGuidanceText(TAX_INFORMATION_FIELD),
25101
+ readonly: formUtils.isReadOnly("taxInformation"),
25102
+ shouldValidate,
25103
+ handleChangeFor,
25104
+ canExempt: formUtils.isRequiredField("exemptedFromTax"),
25105
+ registrationNumber: formData.registrationNumber,
25106
+ isUen: formUtils.isRequiredField("isUen"),
25107
+ country: formData.country ?? country2,
25108
+ companyType: companyType2,
25109
+ taxIdNumberType,
25110
+ setTaxIdNumberType,
25111
+ defaultData: data == null ? void 0 : data.taxInformation
25112
+ })
25113
+ }), formUtils.isRequiredField("stateOrProvince") && jsx("div", {
25114
+ className: "adyen-kyc-field-wrapper",
25115
+ children: jsx(StateField, {
25116
+ data: formUtils.getFieldData(formData, STATE_FIELD),
25117
+ valid: formUtils.getFieldValid(formValid, STATE_FIELD),
25118
+ errors: formUtils.getFieldErrors(formErrors, formFieldProblems, STATE_FIELD),
25119
+ labels: formUtils.getFieldLabels(STATE_FIELD),
25120
+ placeholders: formUtils.getFieldPlaceholders(STATE_FIELD),
25121
+ readonly: formUtils.isReadOnly("stateOrProvince"),
25122
+ handleChangeFor,
25123
+ selectedCountry: formData.country
25124
+ })
25125
+ }), (formUtils.isRequiredField("registrationNumber") || formUtils.isOptionalField("registrationNumber")) && jsx("div", {
25126
+ className: "adyen-kyc-field-wrapper",
25127
+ children: jsx(BusinessRegistrationNumberField, {
25128
+ data: formUtils.getFieldData(formData, BUSINESS_REGISTRATION_NUMBER_FIELD),
25129
+ valid: formUtils.getFieldValid(formValid, BUSINESS_REGISTRATION_NUMBER_FIELD),
25130
+ errors: formUtils.getFieldErrors(formErrors, formFieldProblems, BUSINESS_REGISTRATION_NUMBER_FIELD),
25131
+ labels: formUtils.getFieldLabels(BUSINESS_REGISTRATION_NUMBER_FIELD, {
25132
+ exemptedFromRegistrationNumber: "iDontHaveARegistrationNumber"
25133
+ }),
25134
+ mask: formUtils.getMask("registrationNumber"),
25135
+ guidanceText: formUtils.getFieldGuidanceText(BUSINESS_REGISTRATION_NUMBER_FIELD),
25136
+ placeholders: formUtils.getFieldPlaceholders(BUSINESS_REGISTRATION_NUMBER_FIELD),
25137
+ helperText: formUtils.getFieldHelperText(BUSINESS_REGISTRATION_NUMBER_FIELD),
25138
+ readonly: formUtils.isReadOnly("registrationNumber"),
25139
+ optional: formUtils.isOptionalField("registrationNumber"),
25140
+ shouldValidate,
25141
+ handleChangeFor,
25142
+ country: formData.country ?? country2,
25143
+ canExempt: formUtils.isRequiredField("exemptedFromRegistrationNumber"),
25144
+ companyType: companyType2,
25145
+ registrationNumberOptions,
25146
+ registrationNumberType,
25147
+ setRegistrationNumberType
25148
+ })
25149
+ })]
24802
25150
  })]
24803
25151
  })]
24804
25152
  });
24805
25153
  }
25154
+ const mapOrganizationTypeToCompanyType = (organizationType) => {
25155
+ switch (organizationType) {
25156
+ case "BUSINESS":
25157
+ return CompanyTypesValue.PRIVATE_COMPANY;
25158
+ case "NON_PROFIT":
25159
+ return CompanyTypesValue.NON_PROFIT_OR_CHARITABLE;
25160
+ case "PUBLIC_COMPANY":
25161
+ case "LISTED_PUBLIC_COMPANY":
25162
+ return CompanyTypesValue.PUBLIC_COMPANY;
25163
+ case "UNLISTED_PUBLIC_COMPANY":
25164
+ return CompanyTypesValue.UNLISTED_PUBLIC_COMPANY;
25165
+ case "GOVERNMENTAL_ORGANIZATION":
25166
+ return CompanyTypesValue.GOVERNMENTAL_ORGANIZATION;
25167
+ case "SOLE_PROPRIETOR":
25168
+ return CompanyTypesValue.SOLE_PROPRIETORSHIP;
25169
+ case "PARTNERSHIP_INCORPORATED":
25170
+ return CompanyTypesValue.INCORPORATED_PARTNERSHIP;
25171
+ case "ASSOCIATION_INCORPORATED":
25172
+ return CompanyTypesValue.INCORPORATED_ASSOCIATION;
25173
+ case "OTHER":
25174
+ case "PARTNERSHIP":
25175
+ return void 0;
25176
+ default:
25177
+ return CompanyTypesValue.PRIVATE_COMPANY;
25178
+ }
25179
+ };
25180
+ const mapCompanyDataResponseToFormSchema = (company2) => ({
25181
+ companyBasics: {
25182
+ country: company2.country,
25183
+ stateOrProvince: company2.state,
25184
+ legalCompanyName: company2.name
25185
+ },
25186
+ companyRegistrationAddress: {
25187
+ registrationAddress: {
25188
+ address: company2.street,
25189
+ stateOrProvince: company2.state,
25190
+ country: company2.country,
25191
+ postalCode: company2.zipcode,
25192
+ city: company2.city
25193
+ }
25194
+ },
25195
+ companyStructure: {
25196
+ entityType: mapOrganizationTypeToCompanyType(company2.organizationType)
25197
+ },
25198
+ companyOtherDetails: {
25199
+ registrationNumber: company2.registrationNumber
25200
+ }
25201
+ });
25202
+ const mapCompanySearchDocumentToApiDocument = async (data, entityId) => {
25203
+ var _a, _b, _c;
25204
+ const {
25205
+ companyRegistrationDocument: companyRegistrationDocument2,
25206
+ companyTaxDocument
25207
+ } = data;
25208
+ const entityType2 = "legalEntity";
25209
+ 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;
25210
+ const documents2 = await Promise.all([
25211
+ createDocumentRequest({
25212
+ entityId,
25213
+ entityType: entityType2,
25214
+ documentType: DocumentType.REGISTRATION_DOCUMENT,
25215
+ page1: (_b = companyRegistrationDocument2 == null ? void 0 : companyRegistrationDocument2.registrationDocument) == null ? void 0 : _b[0]
25216
+ }),
25217
+ createDocumentRequest({
25218
+ entityId,
25219
+ entityType: entityType2,
25220
+ documentType: taxDocumentType,
25221
+ page1: (_c = companyTaxDocument == null ? void 0 : companyTaxDocument.taxDocument) == null ? void 0 : _c[0]
25222
+ })
25223
+ // Add this when we need shareholder document functionality
25224
+ // createDocumentRequest(legalEntityId, 'legalEntity', DocumentType.SHAREHOLDER_DOCUMENT, shareholderDocument?.[0])
25225
+ ]);
25226
+ return documents2.filter(Boolean);
25227
+ };
25228
+ const mapCompanySearchSchemaToLegalEntity = (data) => {
25229
+ var _a, _b, _c, _d, _e;
25230
+ const requestObj = {
25231
+ ...formatObject(data, companySearchApiKeyMapping)
25232
+ };
25233
+ if (requestObj.organization) {
25234
+ if (((_a = data.companyBasics) == null ? void 0 : _a.taxInformation) || ((_b = data.companyOtherDetails) == null ? void 0 : _b.taxInformation)) {
25235
+ 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;
25236
+ }
25237
+ if (requestObj.organization.vatAbsenceReason) {
25238
+ requestObj.organization.vatNumber = "";
25239
+ }
25240
+ }
25241
+ requestObj.type = LegalEntityType.ORGANIZATION;
25242
+ return requestObj;
25243
+ };
25244
+ const mapApiDocumentToCompanySearchDocuments = (entityId) => {
25245
+ const registrationDocument2 = getDocument$1(entityId, DocumentType.REGISTRATION_DOCUMENT) ?? null;
25246
+ const taxDocument2 = getDocument$1(entityId, DocumentType.VAT_DOCUMENT) ?? getDocument$1(entityId, DocumentType.PROOF_OF_ORGANIZATION_TAX_INFO) ?? null;
25247
+ return {
25248
+ companyRegistrationDocument: registrationDocument2 ? {
25249
+ registrationDocument: [mapExistingFile(getPageName(registrationDocument2))]
25250
+ } : void 0,
25251
+ companyTaxDocument: taxDocument2 ? {
25252
+ taxDocument: [mapExistingFile(getPageName(taxDocument2))]
25253
+ } : void 0
25254
+ };
25255
+ };
25256
+ const mapLegalEntityToCompanySearchSchema = (legalEntity, isChangingType, accountHolder2) => {
25257
+ const companySearchSchema = {
25258
+ companyBasics: {},
25259
+ companyRegistrationAddress: {},
25260
+ companyStructure: {},
25261
+ companyOtherDetails: {},
25262
+ companyRegistrationDocument: {},
25263
+ companyTaxDocument: {},
25264
+ ...formatObject(legalEntity, companySearchComponentsKeyMapping)
25265
+ };
25266
+ const {
25267
+ companyRegistrationDocument: companyRegistrationDocument2,
25268
+ companyTaxDocument
25269
+ } = mapApiDocumentToCompanySearchDocuments(legalEntity == null ? void 0 : legalEntity.id);
25270
+ return entriesOf(companySearchSchema).reduce((componentData, [key, value]) => {
25271
+ var _a, _b, _c, _d, _e, _f, _g;
25272
+ switch (key) {
25273
+ case "companyBasics": {
25274
+ return {
25275
+ ...componentData,
25276
+ [key]: value
25277
+ };
25278
+ }
25279
+ case "companyRegistrationAddress": {
25280
+ return {
25281
+ ...componentData,
25282
+ [key]: {
25283
+ ...value,
25284
+ operationalAddressIsSame: ((_a = legalEntity.organization) == null ? void 0 : _a.principalPlaceOfBusiness) ? operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_NOT_SAME : operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_SAME
25285
+ }
25286
+ };
25287
+ }
25288
+ case "companyOtherDetails": {
25289
+ return {
25290
+ ...componentData,
25291
+ [key]: {
25292
+ ...value,
25293
+ 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,
25294
+ 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)
25295
+ }
25296
+ };
25297
+ }
25298
+ case "companyStructure": {
25299
+ return {
25300
+ ...componentData,
25301
+ [key]: {
25302
+ ...value,
25303
+ accountHolder: getDefaultAccountHolderType(legalEntity, isChangingType, accountHolder2)
25304
+ }
25305
+ };
25306
+ }
25307
+ case "companyRegistrationDocument": {
25308
+ return {
25309
+ ...componentData,
25310
+ [key]: {
25311
+ ...companyRegistrationDocument2
25312
+ }
25313
+ };
25314
+ }
25315
+ case "companyTaxDocument": {
25316
+ return {
25317
+ ...componentData,
25318
+ [key]: {
25319
+ ...companyTaxDocument
25320
+ }
25321
+ };
25322
+ }
25323
+ default:
25324
+ return componentData;
25325
+ }
25326
+ }, {});
25327
+ };
24806
25328
  const CompanyStructureValidation = {
24807
25329
  entityType: {
24808
25330
  modes: ["blur"],
@@ -24822,13 +25344,18 @@ function CompanyStructureComponent({
24822
25344
  fieldValidationErrors,
24823
25345
  requiredFields,
24824
25346
  country: country2,
25347
+ verifiedBusiness,
24825
25348
  kompanyVerifiedData,
25349
+ showCompanyStructure,
24826
25350
  ...props
24827
25351
  }) {
24828
25352
  var _a;
24829
25353
  const {
24830
25354
  i18n
24831
25355
  } = useI18nContext();
25356
+ const {
25357
+ isExperimentEnabled
25358
+ } = useExperimentsContext();
24832
25359
  const isNewEntryFlowEnabled = useEnableNewEntryFlow();
24833
25360
  const {
24834
25361
  updateStateSlice
@@ -24840,7 +25367,9 @@ function CompanyStructureComponent({
24840
25367
  valid: formValid,
24841
25368
  errors: formErrors,
24842
25369
  fieldProblems: formFieldProblems,
24843
- handleChangeFor
25370
+ handleChangeFor,
25371
+ setData,
25372
+ setValid
24844
25373
  } = useForm({
24845
25374
  schema,
24846
25375
  defaultData: data,
@@ -24863,6 +25392,20 @@ function CompanyStructureComponent({
24863
25392
  }
24864
25393
  prevVerifiedDataRef.current = kompanyVerifiedData;
24865
25394
  }, [kompanyVerifiedData]);
25395
+ useEffect(() => {
25396
+ if (!isExperimentEnabled("EnableNewBusinessDetailsFlow")) return;
25397
+ if (!showCompanyStructure) {
25398
+ setValid("entityType", false);
25399
+ return setData("entityType", data == null ? void 0 : data.entityType);
25400
+ }
25401
+ if (!verifiedBusiness && (data == null ? void 0 : data.entityType)) {
25402
+ return handleChangeFor("entityType")(data == null ? void 0 : data.entityType);
25403
+ }
25404
+ const type = mapOrganizationTypeToCompanyType(verifiedBusiness == null ? void 0 : verifiedBusiness.organizationType);
25405
+ if (verifiedBusiness && type && (data == null ? void 0 : data.entityType) !== type) {
25406
+ return setData("entityType", type);
25407
+ }
25408
+ }, [data == null ? void 0 : data.entityType, isExperimentEnabled, setData, setValid, showCompanyStructure, verifiedBusiness]);
24866
25409
  useEffect(() => {
24867
25410
  updateStateSlice({
24868
25411
  schema: formSchema,
@@ -24928,7 +25471,6 @@ const getForms = (country2) => ({
24928
25471
  formId: "basicInformation",
24929
25472
  formName: "basicInformationFormName",
24930
25473
  formHeading: "basicInformationFormHeading",
24931
- formDescription: "basicInformationFormDescription",
24932
25474
  fields: COUNTRIES_USING_COMPANY_SEARCH.includes(country2) ? basicInformationFields : basicInformationFields.filter((field) => !FIELDS_NEEDED_FOR_COMPANY_SEARCH.includes(field))
24933
25475
  },
24934
25476
  companyStructure: {
@@ -24979,72 +25521,69 @@ const mapApiDocumentToBusinessDetailsDocuments = (entityId) => {
24979
25521
  } : void 0
24980
25522
  };
24981
25523
  };
24982
- const mapBasicInformation = (value) => {
24983
- if (!!value.country && COUNTRIES_USING_COMPANY_SEARCH.includes(value.country)) {
24984
- return value;
24985
- }
24986
- const nonCompanySearchFields = entriesOf(value).reduce((acc, [field, fieldValue]) => {
25524
+ const mapBasicInformation = (data) => {
25525
+ if (!data) return;
25526
+ return !!data.country && COUNTRIES_USING_COMPANY_SEARCH.includes(data.country) ? data : entriesOf(data).reduce((acc, [field]) => {
24987
25527
  if (!FIELDS_NEEDED_FOR_COMPANY_SEARCH.includes(field)) {
24988
25528
  return {
24989
25529
  ...acc,
24990
- [field]: fieldValue
25530
+ [field]: data[field]
24991
25531
  };
24992
25532
  }
24993
25533
  return acc;
24994
25534
  }, {});
24995
- return nonCompanySearchFields;
24996
25535
  };
24997
- const mapAdditionalInformation = (value, legalEntity) => {
24998
- var _a;
24999
- const currentCountry = (_a = legalEntity.organization) == null ? void 0 : _a.registeredAddress.country;
25000
- if (!!currentCountry && COUNTRIES_USING_COMPANY_SEARCH.includes(currentCountry)) {
25001
- const companySearchFields = entriesOf(value).reduce((acc, [field, fieldValue]) => {
25002
- if (!FIELDS_NEEDED_FOR_COMPANY_SEARCH.includes(field)) {
25003
- return {
25004
- ...acc,
25005
- [field]: fieldValue
25006
- };
25007
- }
25008
- return acc;
25009
- }, {});
25010
- return {
25011
- ...companySearchFields,
25012
- hasDBA: !!companySearchFields.dbaName
25013
- };
25014
- }
25015
- return {
25016
- ...value,
25017
- hasDBA: !!value.dbaName
25018
- };
25536
+ const mapAdditionalInformation = (data, legalEntity) => {
25537
+ var _a, _b, _c, _d;
25538
+ if (!data) return;
25539
+ 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) ? {
25540
+ hasDba: true
25541
+ } : {
25542
+ hasDba: false
25543
+ } : {};
25544
+ const currentCountry = (_d = legalEntity.organization) == null ? void 0 : _d.registeredAddress.country;
25545
+ return entriesOf(data).reduce((acc, [field]) => {
25546
+ if (!COUNTRIES_USING_COMPANY_SEARCH.includes(currentCountry)) {
25547
+ return {
25548
+ ...acc,
25549
+ [field]: data[field]
25550
+ };
25551
+ }
25552
+ if (!FIELDS_NEEDED_FOR_COMPANY_SEARCH.includes(field)) {
25553
+ return {
25554
+ ...acc,
25555
+ [field]: data[field]
25556
+ };
25557
+ }
25558
+ return acc;
25559
+ }, {
25560
+ ...dbaName2
25561
+ });
25019
25562
  };
25020
25563
  const mapLegalEntityToBusinessDetailsSchema = (legalEntity, isChangingType, accountHolder2) => {
25021
- const businessDetailsSchema = {
25022
- basicInformation: {},
25023
- companyStructure: {},
25024
- additionalInformation: {},
25025
- companyRegistrationAddress: {},
25026
- companyRegistrationDocument: {},
25027
- companyTaxDocument: {},
25028
- ...formatObject(legalEntity, businessDetailsComponentsKeyMapping)
25029
- };
25030
25564
  const {
25031
25565
  companyRegistrationDocument: companyRegistrationDocument2,
25032
25566
  companyTaxDocument
25033
25567
  } = mapApiDocumentToBusinessDetailsDocuments(legalEntity == null ? void 0 : legalEntity.id);
25034
- return entriesOf(businessDetailsSchema).reduce((componentData, [key, value]) => {
25568
+ const businessDetailsSchema = {
25569
+ ...formatObject(legalEntity, businessDetailsComponentsKeyMapping),
25570
+ companyRegistrationDocument: companyRegistrationDocument2,
25571
+ companyTaxDocument
25572
+ };
25573
+ return entriesOf(businessDetailsSchema).reduce((componentData, [key]) => {
25035
25574
  var _a;
25036
25575
  switch (key) {
25037
25576
  case "basicInformation": {
25038
25577
  return {
25039
25578
  ...componentData,
25040
- [key]: mapBasicInformation(value)
25579
+ [key]: mapBasicInformation(businessDetailsSchema[key])
25041
25580
  };
25042
25581
  }
25043
25582
  case "companyStructure": {
25044
25583
  return {
25045
25584
  ...componentData,
25046
25585
  [key]: {
25047
- ...value,
25586
+ ...businessDetailsSchema[key],
25048
25587
  accountHolder: getDefaultAccountHolderType(legalEntity, isChangingType, accountHolder2) ?? "theCompanyIWorkFor"
25049
25588
  }
25050
25589
  };
@@ -25052,14 +25591,14 @@ const mapLegalEntityToBusinessDetailsSchema = (legalEntity, isChangingType, acco
25052
25591
  case "additionalInformation": {
25053
25592
  return {
25054
25593
  ...componentData,
25055
- [key]: mapAdditionalInformation(value, legalEntity)
25594
+ [key]: mapAdditionalInformation(businessDetailsSchema[key], legalEntity)
25056
25595
  };
25057
25596
  }
25058
25597
  case "companyRegistrationAddress": {
25059
25598
  return {
25060
25599
  ...componentData,
25061
25600
  [key]: {
25062
- ...value,
25601
+ ...businessDetailsSchema[key],
25063
25602
  operationalAddressIsSame: ((_a = legalEntity.organization) == null ? void 0 : _a.principalPlaceOfBusiness) ? operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_NOT_SAME : operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_SAME
25064
25603
  }
25065
25604
  };
@@ -25067,17 +25606,13 @@ const mapLegalEntityToBusinessDetailsSchema = (legalEntity, isChangingType, acco
25067
25606
  case "companyRegistrationDocument": {
25068
25607
  return {
25069
25608
  ...componentData,
25070
- [key]: {
25071
- ...companyRegistrationDocument2
25072
- }
25609
+ [key]: businessDetailsSchema[key]
25073
25610
  };
25074
25611
  }
25075
25612
  case "companyTaxDocument": {
25076
25613
  return {
25077
25614
  ...componentData,
25078
- [key]: {
25079
- ...companyTaxDocument
25080
- }
25615
+ [key]: businessDetailsSchema[key]
25081
25616
  };
25082
25617
  }
25083
25618
  default:
@@ -25085,49 +25620,646 @@ const mapLegalEntityToBusinessDetailsSchema = (legalEntity, isChangingType, acco
25085
25620
  }
25086
25621
  }, {});
25087
25622
  };
25623
+ var CompanySearchEvents = /* @__PURE__ */ ((CompanySearchEvents2) => {
25624
+ CompanySearchEvents2["TASK_START"] = "CompanySearch_TaskStarted";
25625
+ CompanySearchEvents2["TASK_SUBMIT"] = "CompanySearch_TaskSubmitted";
25626
+ CompanySearchEvents2["TASK_SAVED"] = "CompanySearch_TaskSaved";
25627
+ CompanySearchEvents2["TASK_ERROR"] = "CompanySearch_TaskError";
25628
+ CompanySearchEvents2["DOCUMENTS_SAVED"] = "CompanySearch_DocumentsSaved";
25629
+ CompanySearchEvents2["DOCUMENTS_ERROR"] = "CompanySearch_DocumentsError";
25630
+ CompanySearchEvents2["NO_SEARCH_RESULTS"] = "CompanySearch_NoSearchResults";
25631
+ CompanySearchEvents2["TIN_MATCH"] = "CompanySearch_TinMatch";
25632
+ CompanySearchEvents2["TIN_NO_MATCH"] = "CompanySearch_TinNoMatch";
25633
+ CompanySearchEvents2["SELECTION_RESET"] = "CompanySearch_CompanySelectionReset";
25634
+ CompanySearchEvents2["SELECTION_ERROR"] = "CompanySearch_CompanySelectionError";
25635
+ return CompanySearchEvents2;
25636
+ })(CompanySearchEvents || {});
25637
+ const logger$l = createLogger("useCompanySearch");
25638
+ const LOW_RISK_COMPANY_DATA_COMPLIANCE_WINDOW = 1577664e5;
25639
+ function useCompanySearch({
25640
+ defaultData,
25641
+ legalCompanyName: legalCompanyName2,
25642
+ country: country2,
25643
+ stateOrProvince: stateOrProvince2,
25644
+ taxIdentificationNumber: taxIdentificationNumber2,
25645
+ canVerify,
25646
+ limit = 15,
25647
+ baseTrackingPayload,
25648
+ setKompanyAddress,
25649
+ handleChangeFor,
25650
+ handleCompanyIndexSearch,
25651
+ handleCompanyDeepSearch,
25652
+ handleGetCompanyDataset,
25653
+ handleRefreshCompanyDataset,
25654
+ handleVerifyTin
25655
+ }) {
25656
+ const [companiesList, setCompaniesList] = useState([]);
25657
+ const [selectedCompanyId, setSelectedCompanyId] = useState();
25658
+ const [verifiedCompany, setVerifiedCompany] = useState();
25659
+ const [status, setStatus] = useState("idle");
25660
+ const [error, setError] = useState();
25661
+ const isLastUpdateDateCompliant = (company2) => {
25662
+ const date = (/* @__PURE__ */ new Date()).toDateString();
25663
+ return company2.lastUpdate ? Date.parse(date) - Date.parse(company2.lastUpdate) < LOW_RISK_COMPANY_DATA_COMPLIANCE_WINDOW : false;
25664
+ };
25665
+ const searchCompanies = useMemo(() => debounce(async ({
25666
+ companyName: companyName2,
25667
+ companyCountry,
25668
+ companyState,
25669
+ resultsLimit,
25670
+ deepSearch
25671
+ }) => {
25672
+ try {
25673
+ if (!deepSearch) return;
25674
+ setStatus("loading");
25675
+ setCompaniesList([]);
25676
+ const {
25677
+ results: deepSearchResults
25678
+ } = await deepSearch({
25679
+ text: companyName2,
25680
+ country: companyCountry,
25681
+ state: companyState,
25682
+ limit: resultsLimit
25683
+ });
25684
+ return setCompaniesList(deepSearchResults);
25685
+ } catch (e) {
25686
+ setStatus("error");
25687
+ setError(e);
25688
+ } finally {
25689
+ setStatus((prevStatus) => prevStatus !== "error" ? "loaded" : prevStatus);
25690
+ }
25691
+ }, 700), []);
25692
+ const retrySearch = useCallback(async () => {
25693
+ if (!legalCompanyName2 || !country2 || !stateOrProvince2) {
25694
+ return setStatus("idle");
25695
+ }
25696
+ try {
25697
+ if (!handleCompanyDeepSearch) return;
25698
+ setStatus("loading");
25699
+ setSelectedCompanyId(void 0);
25700
+ const {
25701
+ results: deepSearchResults
25702
+ } = await handleCompanyDeepSearch({
25703
+ text: legalCompanyName2,
25704
+ country: country2,
25705
+ state: stateOrProvince2,
25706
+ limit
25707
+ });
25708
+ return setCompaniesList(deepSearchResults);
25709
+ } catch (e) {
25710
+ setStatus("error");
25711
+ setError(e);
25712
+ } finally {
25713
+ setStatus((prevStatus) => prevStatus !== "error" ? "loaded" : prevStatus);
25714
+ }
25715
+ }, [handleCompanyDeepSearch, country2, legalCompanyName2, limit, stateOrProvince2]);
25716
+ const verify2 = useCallback(async (companyTIN, company2) => {
25717
+ try {
25718
+ if (!handleVerifyTin || !handleGetCompanyDataset || !handleRefreshCompanyDataset) return;
25719
+ setStatus("loading");
25720
+ setSelectedCompanyId(company2.id);
25721
+ if (!canVerify || !companyTIN) {
25722
+ return setStatus("error");
25723
+ }
25724
+ const {
25725
+ matched
25726
+ } = await handleVerifyTin({
25727
+ tin: companyTIN,
25728
+ name: company2.name
25729
+ });
25730
+ if (!matched) {
25731
+ setStatus("error");
25732
+ userEvents.addEvent(CompanySearchEvents.TIN_NO_MATCH, {
25733
+ segmentation: {
25734
+ ...baseTrackingPayload
25735
+ }
25736
+ });
25737
+ return setError({
25738
+ message: "TIN does not match the selected company",
25739
+ response: {
25740
+ status: 200
25741
+ }
25742
+ });
25743
+ }
25744
+ userEvents.addEvent(CompanySearchEvents.TIN_MATCH, {
25745
+ segmentation: {
25746
+ ...baseTrackingPayload
25747
+ }
25748
+ });
25749
+ const companyData = isLastUpdateDateCompliant(company2) ? await handleGetCompanyDataset({
25750
+ companyId: company2.id,
25751
+ country: country2
25752
+ }) : await handleRefreshCompanyDataset({
25753
+ companyId: company2.id,
25754
+ country: country2
25755
+ });
25756
+ return setVerifiedCompany({
25757
+ ...companyData,
25758
+ state: companyData.state ?? stateOrProvince2
25759
+ });
25760
+ } catch (e) {
25761
+ logger$l.error(e);
25762
+ setError(e);
25763
+ setStatus("error");
25764
+ } finally {
25765
+ setStatus((prevStatus) => prevStatus !== "error" ? "loaded" : prevStatus);
25766
+ }
25767
+ }, [handleVerifyTin, handleGetCompanyDataset, handleRefreshCompanyDataset, canVerify, country2, stateOrProvince2, baseTrackingPayload]);
25768
+ const reset = useCallback(() => {
25769
+ setStatus("loading");
25770
+ setSelectedCompanyId(void 0);
25771
+ setVerifiedCompany(void 0);
25772
+ setKompanyAddress(void 0);
25773
+ setCompaniesList([]);
25774
+ if (defaultData) {
25775
+ handleChangeFor("legalCompanyName")(defaultData.legalCompanyName);
25776
+ }
25777
+ }, [defaultData, handleChangeFor, setKompanyAddress]);
25778
+ useEffect(() => {
25779
+ var _a;
25780
+ setError(void 0);
25781
+ const isMinLength = legalCompanyName2 && legalCompanyName2.split("").length > 3;
25782
+ if (!legalCompanyName2 || !country2 || !stateOrProvince2 || !taxIdentificationNumber2 || !canVerify || !isMinLength) {
25783
+ return setStatus("idle");
25784
+ }
25785
+ if (!verifiedCompany) {
25786
+ setSelectedCompanyId(void 0);
25787
+ (_a = searchCompanies({
25788
+ companyName: legalCompanyName2,
25789
+ companyCountry: country2,
25790
+ companyState: stateOrProvince2,
25791
+ indexSearch: handleCompanyIndexSearch,
25792
+ deepSearch: handleCompanyDeepSearch,
25793
+ resultsLimit: limit
25794
+ })) == null ? void 0 : _a.catch((e) => logger$l.error(e));
25795
+ }
25796
+ }, [legalCompanyName2, country2, stateOrProvince2, taxIdentificationNumber2, verifiedCompany, searchCompanies, handleCompanyIndexSearch, handleCompanyDeepSearch, limit, canVerify, baseTrackingPayload]);
25797
+ useEffect(() => {
25798
+ setVerifiedCompany(void 0);
25799
+ setSelectedCompanyId(void 0);
25800
+ }, [taxIdentificationNumber2]);
25801
+ useEffect(() => {
25802
+ if (status !== "error") {
25803
+ return setError(void 0);
25804
+ }
25805
+ }, [status]);
25806
+ return {
25807
+ results: companiesList,
25808
+ selectedCompanyId,
25809
+ verifiedCompany,
25810
+ status,
25811
+ error,
25812
+ retrySearch,
25813
+ verify: verify2,
25814
+ reset
25815
+ };
25816
+ }
25817
+ function Card({
25818
+ className,
25819
+ children,
25820
+ stateful,
25821
+ active,
25822
+ disabled,
25823
+ warning,
25824
+ warningMessage,
25825
+ title,
25826
+ subTitle,
25827
+ headerButton,
25828
+ onClick,
25829
+ onKeyDown
25830
+ }) {
25831
+ const classNames = cx("adyen-kyc-card", className, {
25832
+ "adyen-kyc-card--stateful": stateful,
25833
+ "adyen-kyc-card--active": stateful && active,
25834
+ "adyen-kyc-card--disabled": disabled
25835
+ });
25836
+ const headerClassNames = cx("adyen-kyc-card__header", {
25837
+ "adyen-kyc-card__header--button": headerButton
25838
+ });
25839
+ const tabIndex = stateful ? 0 : void 0;
25840
+ const role2 = stateful ? "button" : void 0;
25841
+ const onClickHandler = (e) => {
25842
+ if (disabled) {
25843
+ return;
25844
+ }
25845
+ onClick == null ? void 0 : onClick(e);
25846
+ };
25847
+ const onKeyDownHandler = (e) => {
25848
+ if (onKeyDown) {
25849
+ onKeyDown(e);
25850
+ }
25851
+ };
25852
+ return jsxs("article", {
25853
+ className: classNames,
25854
+ tabIndex,
25855
+ role: role2,
25856
+ onClick: onClickHandler,
25857
+ onKeyDown: onKeyDownHandler,
25858
+ children: [title && jsxs("header", {
25859
+ className: headerClassNames,
25860
+ children: [jsxs("div", {
25861
+ className: "adyen-kyc-card-title",
25862
+ children: [jsx(Typography, {
25863
+ el: "h4",
25864
+ variant: "title",
25865
+ children: title
25866
+ }), subTitle && jsx(Typography, {
25867
+ el: "p",
25868
+ variant: "body",
25869
+ children: subTitle
25870
+ })]
25871
+ }), headerButton && headerButton]
25872
+ }), children && jsx("div", {
25873
+ role: "region",
25874
+ className: "adyen-kyc-card__body",
25875
+ children
25876
+ }), warning && jsx(Alert, {
25877
+ className: "adyen-kyc-card__warning",
25878
+ title: warningMessage,
25879
+ hasCloseButton: false,
25880
+ type: "warning"
25881
+ })]
25882
+ });
25883
+ }
25884
+ function CardGroup({
25885
+ className,
25886
+ children,
25887
+ spaced = false
25888
+ }) {
25889
+ const baseClass = spaced ? "adyen-kyc-card-group-spaced" : "adyen-kyc-card-group";
25890
+ return jsx("section", {
25891
+ className: cx(baseClass, className),
25892
+ children
25893
+ });
25894
+ }
25895
+ function BusinessInformation({
25896
+ fetching,
25897
+ selectedBusiness
25898
+ }) {
25899
+ const {
25900
+ i18n
25901
+ } = useI18nContext();
25902
+ const businessInformationClass = cx("adyen-kyc-business-information", {
25903
+ "adyen-kyc-business-information--loading": fetching
25904
+ });
25905
+ return jsx("div", {
25906
+ className: businessInformationClass,
25907
+ children: fetching ? jsx(Loader, {
25908
+ size: "large"
25909
+ }) : jsxs("ul", {
25910
+ className: "adyen-kyc-business-information__business-data",
25911
+ children: [(selectedBusiness == null ? void 0 : selectedBusiness.legalForm) && jsxs("li", {
25912
+ children: [jsx(Typography, {
25913
+ className: "adyen-kyc-business-data__key",
25914
+ color: "secondary",
25915
+ children: i18n.get("legalForm")
25916
+ }), jsx(Typography, {
25917
+ children: selectedBusiness == null ? void 0 : selectedBusiness.legalForm
25918
+ })]
25919
+ }), jsxs("li", {
25920
+ children: [jsx(Typography, {
25921
+ className: "adyen-kyc-business-data__key",
25922
+ color: "secondary",
25923
+ children: i18n.get("legalCompanyName__US")
25924
+ }), jsx(Typography, {
25925
+ children: selectedBusiness == null ? void 0 : selectedBusiness.name
25926
+ })]
25927
+ }), (selectedBusiness == null ? void 0 : selectedBusiness.address) && jsxs("li", {
25928
+ children: [jsx(Typography, {
25929
+ className: "adyen-kyc-business-data__key",
25930
+ color: "secondary",
25931
+ children: i18n.get("address")
25932
+ }), jsx(Typography, {
25933
+ children: selectedBusiness == null ? void 0 : selectedBusiness.address
25934
+ })]
25935
+ })]
25936
+ })
25937
+ });
25938
+ }
25939
+ function BusinessInformationCard({
25940
+ result,
25941
+ selectedBusinessId,
25942
+ currentBusinessSelection,
25943
+ fetching,
25944
+ failedToLoad,
25945
+ invalidTin,
25946
+ handleSelectBusiness,
25947
+ handleConfirmSelection,
25948
+ setIsBusinessSelection
25949
+ }) {
25950
+ const {
25951
+ i18n
25952
+ } = useI18nContext();
25953
+ return jsx(Card, {
25954
+ "aria-selected": selectedBusinessId === result.id,
25955
+ className: "adyen-kyc-business-information-card",
25956
+ title: result.name,
25957
+ subTitle: result.registrationNumber,
25958
+ stateful: true,
25959
+ active: selectedBusinessId === result.id,
25960
+ headerButton: selectedBusinessId === result.id && !fetching && !failedToLoad ? jsx(Button, {
25961
+ label: i18n.get("thisIsMyBusiness"),
25962
+ onClick: () => handleConfirmSelection(),
25963
+ testId: "selectBusiness",
25964
+ disabled: invalidTin
25965
+ }) : null,
25966
+ onClick: () => handleSelectBusiness(result),
25967
+ onKeyDown: handleKeys(["Enter"], () => handleSelectBusiness(result)),
25968
+ children: selectedBusinessId === result.id && jsxs(Fragment, {
25969
+ children: [jsx(Divider, {}), invalidTin && jsx(Alert, {
25970
+ type: "warning",
25971
+ title: i18n.get("businessSelection__invalidTin"),
25972
+ actionButton: jsx(Button, {
25973
+ label: "Go back",
25974
+ testId: "backBtn",
25975
+ onClick: () => setIsBusinessSelection(false),
25976
+ showAsLink: true
25977
+ }),
25978
+ testId: "invalidTin"
25979
+ }), failedToLoad && jsx(Alert, {
25980
+ type: "info",
25981
+ title: i18n.get("businessSelection__failedToLoad"),
25982
+ actionButton: jsx(Button, {
25983
+ label: "Try again",
25984
+ testId: "reloadBusiness",
25985
+ onClick: () => handleSelectBusiness(result),
25986
+ showAsLink: true
25987
+ }),
25988
+ testId: "failedToLoad"
25989
+ }), !failedToLoad && jsx(BusinessInformation, {
25990
+ fetching,
25991
+ selectedBusiness: currentBusinessSelection
25992
+ })]
25993
+ })
25994
+ });
25995
+ }
25996
+ const logger$k = createLogger("BusinessSelection");
25997
+ function BusinessSelectionComponent({
25998
+ country: country2,
25999
+ state: state2,
26000
+ tin,
26001
+ searchName,
26002
+ searchResults,
26003
+ proceedToNextForm,
26004
+ isLoading,
26005
+ setIsLoading,
26006
+ setVerifiedBusiness,
26007
+ setShowCompanyStructure,
26008
+ setIsBusinessSelection,
26009
+ setSearchName,
26010
+ setSearchResults,
26011
+ handleNextClick,
26012
+ handleCompanyDeepSearch,
26013
+ handleGetCompanyDataset,
26014
+ handleRefreshCompanyDataset,
26015
+ handleVerifyTin
26016
+ }) {
26017
+ const {
26018
+ basicInformation: basicInformation2
26019
+ } = useGlobalData();
26020
+ const shouldSearch = useMemo(() => Boolean(searchResults && searchName !== (basicInformation2 == null ? void 0 : basicInformation2.businessName)), [basicInformation2 == null ? void 0 : basicInformation2.businessName, searchName, searchResults]);
26021
+ useEffect(() => {
26022
+ if (!searchResults || shouldSearch) {
26023
+ searchForBusiness().catch(() => setSearchResults([]));
26024
+ }
26025
+ }, [searchResults, shouldSearch]);
26026
+ useEffect(() => {
26027
+ if (proceedToNextForm) {
26028
+ handleNextClick();
26029
+ }
26030
+ }, [handleNextClick, proceedToNextForm]);
26031
+ const {
26032
+ i18n
26033
+ } = useI18nContext();
26034
+ const [fetching, setFetching] = useState(false);
26035
+ const [selectedBusinessId, setSelectedBusinessId] = useState();
26036
+ const [currentBusinessSelection, setCurrentBusinessSelection] = useState();
26037
+ const [invalidTin, setInvalidTin] = useState(false);
26038
+ const [failedToLoad, setFailedToLoad] = useState(false);
26039
+ const fetchBusinessData = useCallback(async (company2) => {
26040
+ const date = (/* @__PURE__ */ new Date()).toDateString();
26041
+ const isDataCompliant = company2.lastUpdate ? Date.parse(date) - Date.parse(company2.lastUpdate) < LOW_RISK_COMPANY_DATA_COMPLIANCE_WINDOW : false;
26042
+ return isDataCompliant ? handleGetCompanyDataset == null ? void 0 : handleGetCompanyDataset({
26043
+ companyId: company2.id,
26044
+ country: "US"
26045
+ }) : handleRefreshCompanyDataset == null ? void 0 : handleRefreshCompanyDataset({
26046
+ companyId: company2.id,
26047
+ country: "US"
26048
+ });
26049
+ }, [handleGetCompanyDataset, handleRefreshCompanyDataset]);
26050
+ const handleSelectBusiness = useCallback(async (result) => {
26051
+ if ((currentBusinessSelection == null ? void 0 : currentBusinessSelection.id) === result.id && !failedToLoad) return;
26052
+ try {
26053
+ setFailedToLoad(false);
26054
+ setInvalidTin(false);
26055
+ setVerifiedBusiness(void 0);
26056
+ setSelectedBusinessId(result.id);
26057
+ setFetching(true);
26058
+ const businessData = await fetchBusinessData(result);
26059
+ setCurrentBusinessSelection(businessData);
26060
+ } catch (e) {
26061
+ setFailedToLoad(true);
26062
+ logger$k.error(e);
26063
+ } finally {
26064
+ setFetching(false);
26065
+ }
26066
+ }, [currentBusinessSelection == null ? void 0 : currentBusinessSelection.id, failedToLoad, fetchBusinessData, setVerifiedBusiness]);
26067
+ const handleConfirmSelection = useCallback(async (data) => {
26068
+ const business = currentBusinessSelection ?? data;
26069
+ if (!tin || !(business == null ? void 0 : business.name) || !business || invalidTin) return;
26070
+ try {
26071
+ setInvalidTin(false);
26072
+ setIsLoading(true);
26073
+ const res = await (handleVerifyTin == null ? void 0 : handleVerifyTin({
26074
+ tin,
26075
+ name: business == null ? void 0 : business.name
26076
+ }));
26077
+ if (res == null ? void 0 : res.matched) {
26078
+ setVerifiedBusiness(business);
26079
+ } else {
26080
+ setInvalidTin(true);
26081
+ }
26082
+ } catch (e) {
26083
+ logger$k.error(e);
26084
+ } finally {
26085
+ setIsLoading(false);
26086
+ }
26087
+ }, [currentBusinessSelection, handleVerifyTin, invalidTin, setIsLoading, setVerifiedBusiness, tin]);
26088
+ const searchForBusiness = useCallback(async () => {
26089
+ var _a;
26090
+ if (!(basicInformation2 == null ? void 0 : basicInformation2.businessName) || !country2 || !state2 || !handleCompanyDeepSearch) return;
26091
+ try {
26092
+ setIsLoading(true);
26093
+ setSearchName(basicInformation2 == null ? void 0 : basicInformation2.businessName);
26094
+ const {
26095
+ results
26096
+ } = await handleCompanyDeepSearch({
26097
+ text: basicInformation2 == null ? void 0 : basicInformation2.businessName,
26098
+ country: country2,
26099
+ state: state2,
26100
+ limit: 15
26101
+ });
26102
+ setSearchResults(results);
26103
+ if (!(results == null ? void 0 : results.length)) {
26104
+ setShowCompanyStructure(true);
26105
+ }
26106
+ if (results.length === 1) {
26107
+ setSelectedBusinessId((_a = results[0]) == null ? void 0 : _a.id);
26108
+ setFailedToLoad(false);
26109
+ const data = await fetchBusinessData(results[0]).catch(() => setFailedToLoad(true));
26110
+ if (data) {
26111
+ setCurrentBusinessSelection(data);
26112
+ await handleConfirmSelection(data);
26113
+ }
26114
+ }
26115
+ } catch (e) {
26116
+ logger$k.error(e);
26117
+ } finally {
26118
+ setIsLoading(false);
26119
+ }
26120
+ }, [basicInformation2 == null ? void 0 : basicInformation2.businessName, country2, state2, handleCompanyDeepSearch, setIsLoading, setSearchName, setSearchResults, setShowCompanyStructure, fetchBusinessData, handleConfirmSelection]);
26121
+ const handleManualDataEntry = useCallback(() => {
26122
+ setShowCompanyStructure(true);
26123
+ }, [setShowCompanyStructure]);
26124
+ return jsx("div", {
26125
+ className: "adyen-kyc-business-selection",
26126
+ children: isLoading || !searchResults ? jsxs("div", {
26127
+ className: "adyen-kyc-business-selection__loader",
26128
+ children: [jsx(Loader, {
26129
+ size: "large"
26130
+ }), jsx(Typography, {
26131
+ el: "span",
26132
+ children: !currentBusinessSelection ? i18n.get("businessSelection__searching") : i18n.get("businessSelection__verifying")
26133
+ })]
26134
+ }) : jsxs(Fragment, {
26135
+ children: [jsx(FormHeader, {
26136
+ heading: i18n.get("businessSelection__heading")
26137
+ }), jsxs(CardGroup, {
26138
+ spaced: true,
26139
+ children: [searchResults == null ? void 0 : searchResults.map((result) => jsx(BusinessInformationCard, {
26140
+ result,
26141
+ selectedBusinessId,
26142
+ currentBusinessSelection,
26143
+ fetching,
26144
+ failedToLoad,
26145
+ invalidTin,
26146
+ handleSelectBusiness,
26147
+ handleConfirmSelection,
26148
+ setIsBusinessSelection
26149
+ }, result.id)), jsxs(Typography, {
26150
+ el: "span",
26151
+ color: "secondary",
26152
+ className: "adyen-kyc-business-selection__footer",
26153
+ children: [i18n.get("businessSelection__footer"), jsx(Button, {
26154
+ label: i18n.get("businessSelection__footerButton"),
26155
+ showAsLink: true,
26156
+ onClick: handleManualDataEntry,
26157
+ testId: "manualDataEntry"
26158
+ })]
26159
+ })]
26160
+ })]
26161
+ })
26162
+ });
26163
+ }
25088
26164
  function BusinessDetailsComponent(props) {
25089
- var _a, _b, _c, _d, _e;
26165
+ var _a, _b;
25090
26166
  const {
25091
26167
  i18n
25092
26168
  } = useI18nContext();
26169
+ const {
26170
+ basicInformation: basicInformation2,
26171
+ companyStructure: companyStructure2
26172
+ } = useGlobalData();
25093
26173
  const {
25094
26174
  country: country2,
25095
26175
  isTopLevelEntity,
25096
26176
  activeForm,
25097
26177
  problems,
25098
26178
  baseTrackingPayload,
26179
+ isBusinessSelection,
26180
+ setIsBusinessSelection,
26181
+ isLoading,
26182
+ setIsLoading,
26183
+ searchName,
26184
+ setSearchName,
26185
+ searchResults,
26186
+ setSearchResults,
26187
+ verifiedBusiness,
26188
+ setVerifiedBusiness,
26189
+ showCompanyStructure,
26190
+ setShowCompanyStructure,
26191
+ handleNextClick,
25099
26192
  handleAddressSearch,
25100
26193
  handleFindAddress,
25101
- handleCompanyIndexSearch,
25102
26194
  handleCompanyDeepSearch,
25103
26195
  handleGetCompanyDataset,
25104
26196
  handleRefreshCompanyDataset,
25105
26197
  handleVerifyTin,
25106
26198
  onTypeSwitch
25107
26199
  } = props;
25108
- const globalData = useGlobalData();
25109
26200
  const forms2 = getForms(country2);
25110
26201
  const formWrapperClasses = (formId) => (activeForm == null ? void 0 : activeForm.formId) !== formId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper";
25111
- this.customNavigationHandler = ((_a = globalData.companyStructure) == null ? void 0 : _a.accountHolder) === "myName" ? () => onTypeSwitch == null ? void 0 : onTypeSwitch(LegalEntityType.INDIVIDUAL) : null;
26202
+ useEffect(() => {
26203
+ if (searchName !== (basicInformation2 == null ? void 0 : basicInformation2.businessName)) {
26204
+ setShowCompanyStructure(false);
26205
+ setIsBusinessSelection(false);
26206
+ }
26207
+ }, [basicInformation2 == null ? void 0 : basicInformation2.businessName, searchName, setIsBusinessSelection, setShowCompanyStructure]);
26208
+ const canSkipBusinessSelection = useMemo(() => Boolean(!isLoading && searchResults && !searchResults.length && showCompanyStructure), [isLoading, searchResults, showCompanyStructure]);
26209
+ const proceedToNextForm = useMemo(() => {
26210
+ if ((basicInformation2 == null ? void 0 : basicInformation2.country) !== "US") return false;
26211
+ switch (activeForm == null ? void 0 : activeForm.formId) {
26212
+ case "basicInformation": {
26213
+ return (verifiedBusiness == null ? void 0 : verifiedBusiness.legalForm) ? isBusinessSelection : canSkipBusinessSelection || showCompanyStructure;
26214
+ }
26215
+ default:
26216
+ return false;
26217
+ }
26218
+ }, [basicInformation2 == null ? void 0 : basicInformation2.country, activeForm == null ? void 0 : activeForm.formId, verifiedBusiness == null ? void 0 : verifiedBusiness.legalForm, isBusinessSelection, canSkipBusinessSelection, showCompanyStructure]);
26219
+ const getCustomNavigationHandler = useCallback(() => {
26220
+ switch (activeForm == null ? void 0 : activeForm.formId) {
26221
+ default:
26222
+ return (companyStructure2 == null ? void 0 : companyStructure2.accountHolder) === "myName" ? onTypeSwitch == null ? void 0 : onTypeSwitch(LegalEntityType.INDIVIDUAL) : null;
26223
+ }
26224
+ }, [activeForm == null ? void 0 : activeForm.formId, companyStructure2 == null ? void 0 : companyStructure2.accountHolder, onTypeSwitch]);
26225
+ this.customNavigationHandler = getCustomNavigationHandler();
26226
+ const classNames = cx("adyen-kyc-business-details", {
26227
+ "adyen-kyc-business-details--hide": (activeForm == null ? void 0 : activeForm.formId) === "summary"
26228
+ });
25112
26229
  return jsxs("div", {
25113
- className: "adyen-kyc-business-details",
25114
- children: [jsx("div", {
26230
+ className: classNames,
26231
+ children: [jsxs("div", {
25115
26232
  className: formWrapperClasses(forms2.basicInformation.formId),
25116
- children: jsx(BasicInformationComponent, {
26233
+ children: [isBusinessSelection && (basicInformation2 == null ? void 0 : basicInformation2.country) === "US" && jsx(BusinessSelectionComponent, {
26234
+ country: basicInformation2 == null ? void 0 : basicInformation2.country,
26235
+ state: basicInformation2 == null ? void 0 : basicInformation2.stateOrProvince,
26236
+ tin: (_b = (_a = basicInformation2 == null ? void 0 : basicInformation2.taxInformation) == null ? void 0 : _a.find((taxId2) => taxId2.country === country2)) == null ? void 0 : _b.number,
26237
+ searchName,
26238
+ proceedToNextForm,
26239
+ isLoading,
26240
+ setIsLoading,
26241
+ setVerifiedBusiness,
26242
+ setShowCompanyStructure,
26243
+ setIsBusinessSelection,
26244
+ searchResults,
26245
+ setSearchResults,
26246
+ setSearchName,
26247
+ handleNextClick,
26248
+ handleCompanyDeepSearch,
26249
+ handleGetCompanyDataset,
26250
+ handleRefreshCompanyDataset,
26251
+ handleVerifyTin
26252
+ }), jsx(BasicInformationComponent, {
25117
26253
  ...getFormProps(props, forms2.basicInformation.formId),
25118
26254
  id: forms2.basicInformation.formId,
25119
26255
  heading: i18n.get((activeForm == null ? void 0 : activeForm.formHeading) ?? forms2.basicInformation.formHeading),
25120
- description: i18n.get((activeForm == null ? void 0 : activeForm.formDescription) ?? forms2.basicInformation.formDescription),
26256
+ description: (activeForm == null ? void 0 : activeForm.formDescription) ? i18n.get(activeForm == null ? void 0 : activeForm.formDescription) : void 0,
25121
26257
  country: country2,
25122
- companyType: (_b = globalData == null ? void 0 : globalData.companyStructure) == null ? void 0 : _b.entityType,
26258
+ companyType: companyStructure2 == null ? void 0 : companyStructure2.entityType,
25123
26259
  isTopLevelEntity,
25124
26260
  baseTrackingPayload,
25125
- handleCompanyIndexSearch,
25126
- handleCompanyDeepSearch,
25127
- handleGetCompanyDataset,
25128
- handleRefreshCompanyDataset,
25129
- handleVerifyTin
25130
- })
26261
+ isBusinessSelection
26262
+ })]
25131
26263
  }), jsx("div", {
25132
26264
  className: formWrapperClasses(forms2.companyStructure.formId),
25133
26265
  children: jsx(CompanyStructureComponent, {
@@ -25135,7 +26267,9 @@ function BusinessDetailsComponent(props) {
25135
26267
  id: forms2.companyStructure.formId,
25136
26268
  heading: i18n.get((activeForm == null ? void 0 : activeForm.formHeading) ?? forms2.companyStructure.formHeading),
25137
26269
  description: i18n.get((activeForm == null ? void 0 : activeForm.formDescription) ?? forms2.companyStructure.formDescription),
25138
- country: country2
26270
+ country: country2,
26271
+ verifiedBusiness,
26272
+ showCompanyStructure
25139
26273
  })
25140
26274
  }), jsx("div", {
25141
26275
  className: formWrapperClasses(forms2.additionalInformation.formId),
@@ -25145,7 +26279,9 @@ function BusinessDetailsComponent(props) {
25145
26279
  heading: i18n.get((activeForm == null ? void 0 : activeForm.formHeading) ?? forms2.additionalInformation.formHeading),
25146
26280
  description: i18n.get((activeForm == null ? void 0 : activeForm.formDescription) ?? forms2.additionalInformation.formDescription),
25147
26281
  country: country2,
25148
- companyType: (_c = globalData == null ? void 0 : globalData.companyStructure) == null ? void 0 : _c.entityType
26282
+ companyType: companyStructure2 == null ? void 0 : companyStructure2.entityType,
26283
+ verifiedBusiness,
26284
+ showCompanyStructure
25149
26285
  })
25150
26286
  }), jsx("div", {
25151
26287
  className: formWrapperClasses(forms2.companyRegistrationAddress.formId),
@@ -25159,8 +26295,8 @@ function BusinessDetailsComponent(props) {
25159
26295
  country: country2,
25160
26296
  problems,
25161
26297
  handleAddressSearch,
25162
- handleFindAddress
25163
- // kompanyAddress={kompanyAddress}
26298
+ handleFindAddress,
26299
+ verifiedBusiness
25164
26300
  })
25165
26301
  }), jsx("div", {
25166
26302
  className: formWrapperClasses(forms2.companyRegistrationDocument.formId),
@@ -25170,7 +26306,7 @@ function BusinessDetailsComponent(props) {
25170
26306
  heading: forms2.companyRegistrationDocument.formHeading,
25171
26307
  description: forms2.companyRegistrationDocument.formDescription,
25172
26308
  country: country2,
25173
- companyType: (_d = globalData.companyStructure) == null ? void 0 : _d.entityType
26309
+ companyType: companyStructure2 == null ? void 0 : companyStructure2.entityType
25174
26310
  })
25175
26311
  }), jsx("div", {
25176
26312
  className: formWrapperClasses(forms2.companyTaxDocument.formId),
@@ -25180,7 +26316,7 @@ function BusinessDetailsComponent(props) {
25180
26316
  heading: forms2.companyTaxDocument.formHeading,
25181
26317
  description: forms2.companyTaxDocument.formDescription,
25182
26318
  country: country2,
25183
- companyType: (_e = globalData.companyStructure) == null ? void 0 : _e.entityType
26319
+ companyType: companyStructure2 == null ? void 0 : companyStructure2.entityType
25184
26320
  }) : jsx(DocumentUpload, {
25185
26321
  ...getFormProps(props, forms2.companyTaxDocument.formId),
25186
26322
  id: forms2.companyTaxDocument.formId,
@@ -25382,7 +26518,7 @@ const ExpiredBanner = () => {
25382
26518
  i18n
25383
26519
  } = useI18nContext();
25384
26520
  return jsx(Alert, {
25385
- type: AlertTypes.WARNING,
26521
+ type: "warning",
25386
26522
  title: i18n.get("thisPageIsNowInactive"),
25387
26523
  hasCloseButton: false,
25388
26524
  children: i18n.get("startANewSessionFromTheSamePlaceYouOriginallyAccessed")
@@ -25714,7 +26850,7 @@ const FormNavigationItem = ({
25714
26850
  children: [i18n.get(form.formName), form.hasServerValidationErrors && jsx("span", {
25715
26851
  className: "adyen-kyc-form-navigation__item-icon adyen-kyc-form-navigation__item-icon--error",
25716
26852
  children: jsx(AlertIcon, {
25717
- type: AlertTypes.WARNING
26853
+ type: "warning"
25718
26854
  })
25719
26855
  }), form.isValid && !hasError && jsx("span", {
25720
26856
  className: "adyen-kyc-form-navigation__item-icon adyen-kyc-form-navigation__item-icon--success",
@@ -25791,6 +26927,7 @@ const FormWrapper = ({
25791
26927
  handleBackClick,
25792
26928
  handleHomeClick,
25793
26929
  nextButtonLabel,
26930
+ backButtonLabel,
25794
26931
  homeButtonLabel,
25795
26932
  loadingStatus,
25796
26933
  gotoFormByFormIndex,
@@ -25803,6 +26940,7 @@ const FormWrapper = ({
25803
26940
  hideFooter,
25804
26941
  hideHomeButton,
25805
26942
  hideBackButton,
26943
+ hideNextButton,
25806
26944
  hideNavigation,
25807
26945
  canSubmit: canSubmit2,
25808
26946
  onSubmit,
@@ -25831,7 +26969,7 @@ const FormWrapper = ({
25831
26969
  isExperimentEnabled
25832
26970
  } = useExperimentsContext();
25833
26971
  const showExtraTaxExemptionReasons = isExperimentEnabled(ExperimentNames.ShowExtraTaxExemptionReasons);
25834
- const showTaxExemptedLegalCaption = showExtraTaxExemptionReasons && ((_a = summaryData.companyRegistrationDetails) == null ? void 0 : _a.vatAbsenceReason) && ["companyDetails"].includes(taskName);
26972
+ const showTaxExemptedLegalCaption = showExtraTaxExemptionReasons && ((_a = summaryData.companyRegistrationDetails) == null ? void 0 : _a.vatAbsenceReason) && ["companyDetails", "businessDetails"].includes(taskName);
25835
26973
  const summaryContent = jsx("div", {
25836
26974
  className: "adyen-kyc-form-wrapper",
25837
26975
  children: jsx(Summary, {
@@ -25855,11 +26993,12 @@ const FormWrapper = ({
25855
26993
  onNext: handleNextClick,
25856
26994
  onBack: handleBackClick,
25857
26995
  onHome: onHomeClick,
25858
- backButtonLabel: i18n.get("back"),
26996
+ backButtonLabel: backButtonLabel ?? i18n.get("back"),
25859
26997
  nextButtonLabel,
25860
26998
  homeButtonLabel,
25861
26999
  hideOnHomeButton: hideHomeButton,
25862
- hideBackButton
27000
+ hideBackButton,
27001
+ hideNextButton
25863
27002
  });
25864
27003
  const multiStepForm = jsxs("div", {
25865
27004
  className: "adyen-kyc-form-container",
@@ -25982,22 +27121,27 @@ const mapBusinessDetailsDocumentToApiDocument = async (data, entityId) => {
25982
27121
  return documents2.filter(Boolean);
25983
27122
  };
25984
27123
  const mapBusinessDetailsSchemaToLegalEntity = (data) => {
25985
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
27124
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
25986
27125
  const requestObj = {
25987
27126
  ...formatObject(data, businessDetailsApiKeyMapping)
25988
27127
  };
25989
- const taxData = ((_a = data.basicInformation) == null ? void 0 : _a.taxInformation) || ((_b = data.additionalInformation) == null ? void 0 : _b.taxInformation);
25990
- const registrationNumber2 = ((_c = data.basicInformation) == null ? void 0 : _c.registrationNumber) || ((_d = data.additionalInformation) == null ? void 0 : _d.registrationNumber);
27128
+ (_a = requestObj.organization) == null ? true : delete _a.legalFormDescription;
27129
+ const taxData = ((_b = data.basicInformation) == null ? void 0 : _b.taxInformation) || ((_c = data.additionalInformation) == null ? void 0 : _c.taxInformation);
27130
+ const registrationNumber2 = ((_d = data.basicInformation) == null ? void 0 : _d.registrationNumber) || ((_e = data.additionalInformation) == null ? void 0 : _e.registrationNumber);
27131
+ const dbaName2 = ((_f = data.additionalInformation) == null ? void 0 : _f.dbaName) || ((_g = data.additionalInformation) == null ? void 0 : _g.legalCompanyName);
25991
27132
  if (requestObj.organization) {
25992
27133
  if (taxData) {
25993
- 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;
27134
+ 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;
25994
27135
  }
25995
27136
  if (registrationNumber2) {
25996
- 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;
27137
+ 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;
25997
27138
  }
25998
- if ((_k = data.additionalInformation) == null ? void 0 : _k.vatAbsenceReason) {
27139
+ if ((_n = data.additionalInformation) == null ? void 0 : _n.vatAbsenceReason) {
25999
27140
  requestObj.organization.vatNumber = "";
26000
27141
  }
27142
+ if (dbaName2) {
27143
+ requestObj.organization.doingBusinessAs = dbaName2;
27144
+ }
26001
27145
  }
26002
27146
  requestObj.type = LegalEntityType.ORGANIZATION;
26003
27147
  return requestObj;
@@ -26013,7 +27157,7 @@ const canSubmit$3 = (data) => MANDATORY_API_FIELDS.every((detail) => {
26013
27157
  });
26014
27158
  const isDocumentsRequired$3 = (forms2) => forms2.some((form) => documentFormsIds.includes(form.formId));
26015
27159
  const formatBasicInformation = (data, labels2, datasetUtils, companyType2) => {
26016
- var _a, _b, _c, _d, _e;
27160
+ var _a, _b, _c, _d;
26017
27161
  const country2 = data == null ? void 0 : data.country;
26018
27162
  const registrationNumberLabel = resolveFieldMetadata(defaultFieldConfig$9[country2], {
26019
27163
  companyType: companyType2,
@@ -26025,10 +27169,9 @@ const formatBasicInformation = (data, labels2, datasetUtils, companyType2) => {
26025
27169
  companyType: void 0
26026
27170
  }, defaultFieldMetadata$1).label;
26027
27171
  return {
26028
- [((_b = labels2 == null ? void 0 : labels2.basicInformation) == null ? void 0 : _b.businessName) ?? "businessName"]: data.businessName,
26029
- [((_c = labels2 == null ? void 0 : labels2.basicInformation) == null ? void 0 : _c.country) ?? "country"]: datasetUtils.getCountryName(data.country),
27172
+ [((_b = labels2 == null ? void 0 : labels2.basicInformation) == null ? void 0 : _b.country) ?? "country"]: datasetUtils.getCountryName(data.country),
26030
27173
  [getKeyForField("stateOrProvince", data.country)]: datasetUtils.getStateName(data.stateOrProvince, data.country),
26031
- [taxIdLabel]: (_e = (_d = data.taxInformation) == null ? void 0 : _d.find((taxId2) => data.country === taxId2.country)) == null ? void 0 : _e.number,
27174
+ [taxIdLabel]: (_d = (_c = data.taxInformation) == null ? void 0 : _c.find((taxId2) => data.country === taxId2.country)) == null ? void 0 : _d.number,
26032
27175
  [registrationNumberLabel]: data.registrationNumber
26033
27176
  };
26034
27177
  };
@@ -26044,16 +27187,16 @@ const formatAdditionalInformation = (data, labels2, country2, companyType2) => {
26044
27187
  companyType: void 0
26045
27188
  }, defaultFieldMetadata$1).label;
26046
27189
  return {
26047
- [((_b = labels2.additionalInformation) == null ? void 0 : _b.legalCompanyName) ?? "legalCompanyName"]: data.legalCompanyName,
26048
- [((_c = labels2.additionalInformation) == null ? void 0 : _c.dbaName) ?? "dbaName"]: data.dbaName,
27190
+ [((_b = labels2 == null ? void 0 : labels2.additionalInformation) == null ? void 0 : _b.legalCompanyName) ?? "legalCompanyName"]: data.legalCompanyName,
27191
+ [((_c = labels2 == null ? void 0 : labels2.additionalInformation) == null ? void 0 : _c.dbaName) ?? "dbaName"]: data.dbaName,
26049
27192
  [registrationNumberLabel]: data.registrationNumber,
26050
27193
  [taxIdLabel]: (_e = (_d = data.taxInformation) == null ? void 0 : _d.find((taxId2) => country2 === taxId2.country)) == null ? void 0 : _e.number,
26051
- [((_f = labels2.additionalInformation) == null ? void 0 : _f.vatNumber) ?? "vatNumber"]: data.vatNumber,
26052
- [((_g = labels2.additionalInformation) == null ? void 0 : _g.vatAbsenceReason) ?? "vatAbsenceReason"]: data.vatAbsenceReason,
26053
- [((_h = labels2.additionalInformation) == null ? void 0 : _h.dateOfIncorporation) ?? "dateOfIncorporation"]: data.dateOfIncorporation,
26054
- [((_i = labels2.additionalInformation) == null ? void 0 : _i.stockExchangeMIC) ?? "stockExchangeMIC"]: data.stockExchangeMIC,
26055
- [((_j = labels2.additionalInformation) == null ? void 0 : _j.stockISIN) ?? "stockISIN"]: data.stockISIN,
26056
- [((_k = labels2.additionalInformation) == null ? void 0 : _k.stockTickerSymbol) ?? "stockTickerSymbol"]: data.stockTickerSymbol
27194
+ [((_f = labels2 == null ? void 0 : labels2.additionalInformation) == null ? void 0 : _f.vatNumber) ?? "vatNumber"]: data.vatNumber,
27195
+ [((_g = labels2 == null ? void 0 : labels2.additionalInformation) == null ? void 0 : _g.vatAbsenceReason) ?? "vatAbsenceReason"]: data.vatAbsenceReason,
27196
+ [((_h = labels2 == null ? void 0 : labels2.additionalInformation) == null ? void 0 : _h.dateOfIncorporation) ?? "dateOfIncorporation"]: data.dateOfIncorporation,
27197
+ [((_i = labels2 == null ? void 0 : labels2.additionalInformation) == null ? void 0 : _i.stockExchangeMIC) ?? "stockExchangeMIC"]: data.stockExchangeMIC,
27198
+ [((_j = labels2 == null ? void 0 : labels2.additionalInformation) == null ? void 0 : _j.stockISIN) ?? "stockISIN"]: data.stockISIN,
27199
+ [((_k = labels2 == null ? void 0 : labels2.additionalInformation) == null ? void 0 : _k.stockTickerSymbol) ?? "stockTickerSymbol"]: data.stockTickerSymbol
26057
27200
  };
26058
27201
  };
26059
27202
  const formatDataForSummary$1 = (data, forms2, labels2, i18n) => {
@@ -26284,7 +27427,17 @@ function BusinessDetailsDropinComponent({
26284
27427
  useEffect(() => {
26285
27428
  onChange == null ? void 0 : onChange(currentState);
26286
27429
  }, [currentState, onChange]);
26287
- const documentUtils = documentApiUtils(handleCreateDocument, handleGetDocument, handleUpdateDocument);
27430
+ useEffect(() => {
27431
+ userEvents.addPageView("Business details dropin");
27432
+ userEvents.addEvent(BusinessDetailsEvents.TASK_START, {
27433
+ segmentation: getBaseTrackingPayload({
27434
+ trackingConfig,
27435
+ parentLegalEntity,
27436
+ legalEntity: legalEntityResponse,
27437
+ task: taskType
27438
+ })
27439
+ });
27440
+ }, []);
26288
27441
  const formRef = useRef(null);
26289
27442
  const {
26290
27443
  showToast,
@@ -26304,9 +27457,33 @@ function BusinessDetailsDropinComponent({
26304
27457
  var _a2;
26305
27458
  return ((_a2 = currentState.data.basicInformation) == null ? void 0 : _a2.country) ?? country2;
26306
27459
  }, [(_a = currentState.data.basicInformation) == null ? void 0 : _a.country, country2]);
26307
- const [loadingStatus, setLoadingStatus] = useState("success");
26308
27460
  const [initialData, setInitialData] = useState(mapLegalEntityToBusinessDetailsSchema(legalEntityResponse, Boolean(isTargetLegalEntityType), isNewEntryFlowEnabled ? accountHolder2 : void 0));
27461
+ const documentUtils = documentApiUtils(handleCreateDocument, handleGetDocument, handleUpdateDocument);
27462
+ useEffect(() => {
27463
+ var _a2;
27464
+ const documentIds = ((_a2 = legalEntityResponse == null ? void 0 : legalEntityResponse.documentDetails) == null ? void 0 : _a2.map((documentReference) => documentReference.id)) || [];
27465
+ if (!documentIds.length) return;
27466
+ documentUtils.fetchDocuments(documentIds, legalEntityResponse.id).then(() => {
27467
+ setInitialData({
27468
+ ...initialData,
27469
+ ...mapApiDocumentToBusinessDetailsDocuments(legalEntityResponse.id)
27470
+ });
27471
+ }).catch(() => showToast({
27472
+ label: i18n.get("failedToFetchRelevantDocuments"),
27473
+ type: "error"
27474
+ }));
27475
+ }, []);
27476
+ const [loadingStatus, setLoadingStatus] = useState("success");
26309
27477
  const [currentProblems, setCurrentProblems] = useState(problems ?? ((_c = (_b = getCapabilityProblems(legalEntityResponse, currentCountry, isExperimentEnabled)) == null ? void 0 : _b.LegalEntity) == null ? void 0 : _c[legalEntityResponse.id]));
27478
+ const [isLoading, setIsLoading] = useState(true);
27479
+ const [isBusinessSelection, setIsBusinessSelection] = useState(false);
27480
+ const [showCompanyStructure, setShowCompanyStructure] = useState(currentCountry !== "US");
27481
+ const baseTrackingPayload = useMemo(() => getBaseTrackingPayload({
27482
+ trackingConfig,
27483
+ parentLegalEntity,
27484
+ legalEntity: legalEntityResponse,
27485
+ task: taskType
27486
+ }), [legalEntityResponse, parentLegalEntity, taskType, trackingConfig]);
26310
27487
  const getConfigurationData = useCallback(() => getConfiguration2({
26311
27488
  legalEntityType: LegalEntityType.ORGANIZATION,
26312
27489
  capabilities: capabilities ?? getCapabilities(legalEntityResponse),
@@ -26327,19 +27504,21 @@ function BusinessDetailsDropinComponent({
26327
27504
  isExperimentEnabled
26328
27505
  }), [currentCountry, currentState.data, isExperimentEnabled, taskType]);
26329
27506
  const initialForms = useMemo(() => getForms(currentCountry), [currentCountry]);
26330
- 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]);
27507
+ 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]);
26331
27508
  const isSkippingCompanyStructure = useEnableNewEntryFlow() && organizationTypesToSkipCompanyStructureForm.includes((_d = legalEntityResponse == null ? void 0 : legalEntityResponse.organization) == null ? void 0 : _d.type) && accountHolder2 !== "aTrust";
26332
27509
  const forms2 = useMemo(() => {
26333
27510
  const requiredForms = getRequiredForms(initialForms, derivedProps == null ? void 0 : derivedProps.requiredFields, derivedProps == null ? void 0 : derivedProps.optionalFields);
26334
- return addValidityToForms(requiredForms, currentState.validityByForm, problems).filter((form) => isSkippingCompanyStructure ? form.formId !== "companyStructure" : true);
26335
- }, [initialForms, derivedProps == null ? void 0 : derivedProps.requiredFields, derivedProps == null ? void 0 : derivedProps.optionalFields, currentState.validityByForm, problems, isSkippingCompanyStructure]);
27511
+ return addValidityToForms(requiredForms, currentState.validityByForm, problems).filter((form) => {
27512
+ switch (form.formId) {
27513
+ case "companyStructure": {
27514
+ return currentCountry !== "US" && !isSkippingCompanyStructure || showCompanyStructure;
27515
+ }
27516
+ default:
27517
+ return true;
27518
+ }
27519
+ });
27520
+ }, [initialForms, derivedProps == null ? void 0 : derivedProps.requiredFields, derivedProps == null ? void 0 : derivedProps.optionalFields, currentState.validityByForm, problems, currentCountry, isSkippingCompanyStructure, showCompanyStructure]);
26336
27521
  const canSubmitForm = useMemo(() => canSubmit$3(currentState.data) && hasDataChanged(initialData, currentState.data), [initialData, currentState.data]);
26337
- const baseTrackingPayload = useMemo(() => getBaseTrackingPayload({
26338
- trackingConfig,
26339
- parentLegalEntity,
26340
- legalEntity: legalEntityResponse,
26341
- task: taskType
26342
- }), [legalEntityResponse, parentLegalEntity, taskType, trackingConfig]);
26343
27522
  const summaryData = useMemo(() => ({
26344
27523
  data: formatDataForSummary$1(currentState.data, forms2, derivedProps == null ? void 0 : derivedProps.labels, i18n),
26345
27524
  omittedKeys: ["operationalAddressIsSame"]
@@ -26377,32 +27556,78 @@ function BusinessDetailsDropinComponent({
26377
27556
  formRef,
26378
27557
  onSubmit: submitTask
26379
27558
  });
26380
- useEffect(() => {
26381
- var _a2;
26382
- const documentIds = ((_a2 = legalEntityResponse == null ? void 0 : legalEntityResponse.documentDetails) == null ? void 0 : _a2.map((documentReference) => documentReference.id)) || [];
26383
- if (!documentIds.length) return;
26384
- documentUtils.fetchDocuments(documentIds, legalEntityResponse.id).then(() => {
26385
- setInitialData({
26386
- ...initialData,
26387
- ...mapApiDocumentToBusinessDetailsDocuments(legalEntityResponse.id)
26388
- });
26389
- }).catch(() => showToast({
26390
- label: i18n.get("failedToFetchRelevantDocuments"),
26391
- type: "error"
26392
- }));
26393
- }, []);
26394
- useEffect(() => {
26395
- userEvents.addPageView("Business details dropin");
26396
- userEvents.addEvent(BusinessDetailsEvents.TASK_START, {
26397
- segmentation: baseTrackingPayload
26398
- });
26399
- }, [baseTrackingPayload]);
27559
+ const [searchName, setSearchName] = useState();
27560
+ const [searchResults, setSearchResults] = useState();
27561
+ const [verifiedBusiness, setVerifiedBusiness] = useState();
27562
+ const showBusinessSelection = useMemo(() => isBusinessSelection && activeForm.formId === "basicInformation", [activeForm.formId, isBusinessSelection]);
27563
+ const hideBack = useMemo(() => {
27564
+ if (!COUNTRIES_USING_COMPANY_SEARCH.includes(currentCountry)) return hideBackButton;
27565
+ if (showBusinessSelection) {
27566
+ return isLoading ? hideBackButton : false;
27567
+ }
27568
+ return hideBackButton;
27569
+ }, [currentCountry, hideBackButton, showBusinessSelection, isLoading]);
27570
+ const hideHome = useMemo(() => isLoading && showBusinessSelection ? true : hideHomeButton, [hideHomeButton, isLoading, showBusinessSelection]);
27571
+ const goToForm = useCallback((index) => {
27572
+ const form = forms2[index].formId;
27573
+ if (!COUNTRIES_USING_COMPANY_SEARCH.includes(currentCountry)) return gotoFormByFormIndex(index);
27574
+ switch (form) {
27575
+ case "basicInformation": {
27576
+ if (!canSubmitForm) {
27577
+ setVerifiedBusiness(void 0);
27578
+ setShowCompanyStructure(false);
27579
+ setIsBusinessSelection(false);
27580
+ }
27581
+ break;
27582
+ }
27583
+ case "additionalInformation": {
27584
+ if (!isBusinessSelection) setIsBusinessSelection(true);
27585
+ break;
27586
+ }
27587
+ }
27588
+ return gotoFormByFormIndex(index);
27589
+ }, [canSubmitForm, currentCountry, forms2, gotoFormByFormIndex, isBusinessSelection]);
27590
+ const nextClick = useCallback(() => {
27591
+ if (!COUNTRIES_USING_COMPANY_SEARCH.includes(currentCountry)) return handleNextClick();
27592
+ switch (activeForm.formId) {
27593
+ case "basicInformation":
27594
+ if (showCompanyStructure) {
27595
+ return handleNextClick();
27596
+ }
27597
+ return isBusinessSelection ? handleNextClick() : setIsBusinessSelection(true);
27598
+ default:
27599
+ return handleNextClick();
27600
+ }
27601
+ }, [activeForm.formId, currentCountry, handleNextClick, isBusinessSelection, showCompanyStructure]);
27602
+ const backClick = useCallback(() => {
27603
+ if (!COUNTRIES_USING_COMPANY_SEARCH.includes(country2)) return handleNextClick();
27604
+ switch (activeForm.formId) {
27605
+ case "basicInformation": {
27606
+ return showBusinessSelection ? setIsBusinessSelection(false) : void 0;
27607
+ }
27608
+ case "companyStructure": {
27609
+ if (!isLoading && searchResults && !searchResults.length) {
27610
+ setIsBusinessSelection(false);
27611
+ } else {
27612
+ setShowCompanyStructure(false);
27613
+ }
27614
+ return handleBackClick == null ? void 0 : handleBackClick();
27615
+ }
27616
+ case "additionalInformation": {
27617
+ setVerifiedBusiness(void 0);
27618
+ return handleBackClick == null ? void 0 : handleBackClick();
27619
+ }
27620
+ default:
27621
+ return handleBackClick == null ? void 0 : handleBackClick();
27622
+ }
27623
+ }, [activeForm.formId, country2, handleBackClick, handleNextClick, isLoading, searchResults, showBusinessSelection]);
26400
27624
  return jsx(FormWrapper, {
26401
27625
  taskName: taskName ?? "businessDetails",
26402
- gotoFormByFormIndex,
27626
+ gotoFormByFormIndex: goToForm,
26403
27627
  hideDropinLayout,
26404
- hideHomeButton,
26405
- hideBackButton,
27628
+ hideHomeButton: hideHome,
27629
+ hideBackButton: hideBack,
27630
+ hideNextButton: showBusinessSelection,
26406
27631
  loadingStatus,
26407
27632
  forms: forms2,
26408
27633
  activeForm,
@@ -26414,8 +27639,9 @@ function BusinessDetailsDropinComponent({
26414
27639
  summary: summaryData,
26415
27640
  homeButtonLabel,
26416
27641
  nextButtonLabel,
26417
- handleNextClick,
26418
- handleBackClick,
27642
+ backButtonLabel: i18n.get("goBack"),
27643
+ handleNextClick: nextClick,
27644
+ handleBackClick: backClick,
26419
27645
  handleHomeClick,
26420
27646
  children: jsx(BusinessDetailsComponent, {
26421
27647
  ...derivedProps,
@@ -26428,6 +27654,19 @@ function BusinessDetailsDropinComponent({
26428
27654
  isTopLevelEntity: taskType === TaskTypes.BUSINESS_DETAILS,
26429
27655
  onTypeSwitch,
26430
27656
  baseTrackingPayload,
27657
+ isBusinessSelection: showBusinessSelection,
27658
+ setIsBusinessSelection,
27659
+ searchName,
27660
+ setSearchName,
27661
+ searchResults,
27662
+ setSearchResults,
27663
+ verifiedBusiness,
27664
+ setVerifiedBusiness,
27665
+ isLoading,
27666
+ setIsLoading,
27667
+ showCompanyStructure,
27668
+ setShowCompanyStructure,
27669
+ handleNextClick: nextClick,
26431
27670
  handleAddressSearch,
26432
27671
  handleFindAddress,
26433
27672
  handleCompanyIndexSearch,
@@ -26864,247 +28103,6 @@ function CompanyDropinComponent({
26864
28103
  })
26865
28104
  });
26866
28105
  }
26867
- var CompanySearchEvents = /* @__PURE__ */ ((CompanySearchEvents2) => {
26868
- CompanySearchEvents2["TASK_START"] = "CompanySearch_TaskStarted";
26869
- CompanySearchEvents2["TASK_SUBMIT"] = "CompanySearch_TaskSubmitted";
26870
- CompanySearchEvents2["TASK_SAVED"] = "CompanySearch_TaskSaved";
26871
- CompanySearchEvents2["TASK_ERROR"] = "CompanySearch_TaskError";
26872
- CompanySearchEvents2["DOCUMENTS_SAVED"] = "CompanySearch_DocumentsSaved";
26873
- CompanySearchEvents2["DOCUMENTS_ERROR"] = "CompanySearch_DocumentsError";
26874
- CompanySearchEvents2["NO_SEARCH_RESULTS"] = "CompanySearch_NoSearchResults";
26875
- CompanySearchEvents2["TIN_MATCH"] = "CompanySearch_TinMatch";
26876
- CompanySearchEvents2["TIN_NO_MATCH"] = "CompanySearch_TinNoMatch";
26877
- CompanySearchEvents2["SELECTION_RESET"] = "CompanySearch_CompanySelectionReset";
26878
- CompanySearchEvents2["SELECTION_ERROR"] = "CompanySearch_CompanySelectionError";
26879
- return CompanySearchEvents2;
26880
- })(CompanySearchEvents || {});
26881
- const logger$h = createLogger("useCompanySearch");
26882
- const LOW_RISK_COMPANY_DATA_COMPLIANCE_WINDOW = 1577664e5;
26883
- function useCompanySearch({
26884
- defaultData,
26885
- legalCompanyName: legalCompanyName2,
26886
- country: country2,
26887
- stateOrProvince: stateOrProvince2,
26888
- taxIdentificationNumber: taxIdentificationNumber2,
26889
- canVerify,
26890
- limit = 15,
26891
- baseTrackingPayload,
26892
- setKompanyAddress,
26893
- handleChangeFor,
26894
- handleCompanyIndexSearch,
26895
- handleCompanyDeepSearch,
26896
- handleGetCompanyDataset,
26897
- handleRefreshCompanyDataset,
26898
- handleVerifyTin
26899
- }) {
26900
- const [companiesList, setCompaniesList] = useState([]);
26901
- const [selectedCompanyId, setSelectedCompanyId] = useState();
26902
- const [verifiedCompany, setVerifiedCompany] = useState();
26903
- const [status, setStatus] = useState("idle");
26904
- const [error, setError] = useState();
26905
- const isLastUpdateDateCompliant = (company2) => {
26906
- const date = (/* @__PURE__ */ new Date()).toDateString();
26907
- return company2.lastUpdate ? Date.parse(date) - Date.parse(company2.lastUpdate) < LOW_RISK_COMPANY_DATA_COMPLIANCE_WINDOW : false;
26908
- };
26909
- const searchCompanies = useMemo(() => debounce(async ({
26910
- companyName: companyName2,
26911
- companyCountry,
26912
- companyState,
26913
- resultsLimit,
26914
- deepSearch
26915
- }) => {
26916
- try {
26917
- if (!deepSearch) return;
26918
- setStatus("loading");
26919
- setCompaniesList([]);
26920
- const {
26921
- results: deepSearchResults
26922
- } = await deepSearch({
26923
- text: companyName2,
26924
- country: companyCountry,
26925
- state: companyState,
26926
- limit: resultsLimit
26927
- });
26928
- return setCompaniesList(deepSearchResults);
26929
- } catch (e) {
26930
- setStatus("error");
26931
- setError(e);
26932
- } finally {
26933
- setStatus((prevStatus) => prevStatus !== "error" ? "loaded" : prevStatus);
26934
- }
26935
- }, 700), []);
26936
- const retrySearch = useCallback(async () => {
26937
- if (!legalCompanyName2 || !country2 || !stateOrProvince2) {
26938
- return setStatus("idle");
26939
- }
26940
- try {
26941
- if (!handleCompanyDeepSearch) return;
26942
- setStatus("loading");
26943
- setSelectedCompanyId(void 0);
26944
- const {
26945
- results: deepSearchResults
26946
- } = await handleCompanyDeepSearch({
26947
- text: legalCompanyName2,
26948
- country: country2,
26949
- state: stateOrProvince2,
26950
- limit
26951
- });
26952
- return setCompaniesList(deepSearchResults);
26953
- } catch (e) {
26954
- setStatus("error");
26955
- setError(e);
26956
- } finally {
26957
- setStatus((prevStatus) => prevStatus !== "error" ? "loaded" : prevStatus);
26958
- }
26959
- }, [handleCompanyDeepSearch, country2, legalCompanyName2, limit, stateOrProvince2]);
26960
- const verify2 = useCallback(async (companyTIN, company2) => {
26961
- try {
26962
- if (!handleVerifyTin || !handleGetCompanyDataset || !handleRefreshCompanyDataset) return;
26963
- setStatus("loading");
26964
- setSelectedCompanyId(company2.id);
26965
- if (!canVerify || !companyTIN) {
26966
- return setStatus("error");
26967
- }
26968
- const {
26969
- matched
26970
- } = await handleVerifyTin({
26971
- tin: companyTIN,
26972
- name: company2.name
26973
- });
26974
- if (!matched) {
26975
- setStatus("error");
26976
- userEvents.addEvent(CompanySearchEvents.TIN_NO_MATCH, {
26977
- segmentation: {
26978
- ...baseTrackingPayload
26979
- }
26980
- });
26981
- return setError({
26982
- message: "TIN does not match the selected company",
26983
- response: {
26984
- status: 200
26985
- }
26986
- });
26987
- }
26988
- userEvents.addEvent(CompanySearchEvents.TIN_MATCH, {
26989
- segmentation: {
26990
- ...baseTrackingPayload
26991
- }
26992
- });
26993
- const companyData = isLastUpdateDateCompliant(company2) ? await handleGetCompanyDataset({
26994
- companyId: company2.id,
26995
- country: country2
26996
- }) : await handleRefreshCompanyDataset({
26997
- companyId: company2.id,
26998
- country: country2
26999
- });
27000
- return setVerifiedCompany({
27001
- ...companyData,
27002
- state: companyData.state ?? stateOrProvince2
27003
- });
27004
- } catch (e) {
27005
- logger$h.error(e);
27006
- setError(e);
27007
- setStatus("error");
27008
- } finally {
27009
- setStatus((prevStatus) => prevStatus !== "error" ? "loaded" : prevStatus);
27010
- }
27011
- }, [handleVerifyTin, handleGetCompanyDataset, handleRefreshCompanyDataset, canVerify, country2, stateOrProvince2, baseTrackingPayload]);
27012
- const reset = useCallback(() => {
27013
- setStatus("loading");
27014
- setSelectedCompanyId(void 0);
27015
- setVerifiedCompany(void 0);
27016
- setKompanyAddress(void 0);
27017
- setCompaniesList([]);
27018
- if (defaultData) {
27019
- handleChangeFor("legalCompanyName")(defaultData.legalCompanyName);
27020
- }
27021
- }, [defaultData, handleChangeFor, setKompanyAddress]);
27022
- useEffect(() => {
27023
- var _a;
27024
- setError(void 0);
27025
- const isMinLength = legalCompanyName2 && legalCompanyName2.split("").length > 3;
27026
- if (!legalCompanyName2 || !country2 || !stateOrProvince2 || !taxIdentificationNumber2 || !canVerify || !isMinLength) {
27027
- return setStatus("idle");
27028
- }
27029
- if (!verifiedCompany) {
27030
- setSelectedCompanyId(void 0);
27031
- (_a = searchCompanies({
27032
- companyName: legalCompanyName2,
27033
- companyCountry: country2,
27034
- companyState: stateOrProvince2,
27035
- indexSearch: handleCompanyIndexSearch,
27036
- deepSearch: handleCompanyDeepSearch,
27037
- resultsLimit: limit
27038
- })) == null ? void 0 : _a.catch((e) => logger$h.error(e));
27039
- }
27040
- }, [legalCompanyName2, country2, stateOrProvince2, taxIdentificationNumber2, verifiedCompany, searchCompanies, handleCompanyIndexSearch, handleCompanyDeepSearch, limit, canVerify, baseTrackingPayload]);
27041
- useEffect(() => {
27042
- setVerifiedCompany(void 0);
27043
- setSelectedCompanyId(void 0);
27044
- }, [taxIdentificationNumber2]);
27045
- useEffect(() => {
27046
- if (status !== "error") {
27047
- return setError(void 0);
27048
- }
27049
- }, [status]);
27050
- return {
27051
- results: companiesList,
27052
- selectedCompanyId,
27053
- verifiedCompany,
27054
- status,
27055
- error,
27056
- retrySearch,
27057
- verify: verify2,
27058
- reset
27059
- };
27060
- }
27061
- const mapOrganizationTypeToCompanyType = (organizationType) => {
27062
- switch (organizationType) {
27063
- case "BUSINESS":
27064
- return CompanyTypesValue.PRIVATE_COMPANY;
27065
- case "NON_PROFIT":
27066
- return CompanyTypesValue.NON_PROFIT_OR_CHARITABLE;
27067
- case "PUBLIC_COMPANY":
27068
- case "LISTED_PUBLIC_COMPANY":
27069
- return CompanyTypesValue.PUBLIC_COMPANY;
27070
- case "UNLISTED_PUBLIC_COMPANY":
27071
- return CompanyTypesValue.UNLISTED_PUBLIC_COMPANY;
27072
- case "GOVERNMENTAL_ORGANIZATION":
27073
- return CompanyTypesValue.GOVERNMENTAL_ORGANIZATION;
27074
- case "SOLE_PROPRIETOR":
27075
- return CompanyTypesValue.SOLE_PROPRIETORSHIP;
27076
- case "PARTNERSHIP_INCORPORATED":
27077
- return CompanyTypesValue.INCORPORATED_PARTNERSHIP;
27078
- case "ASSOCIATION_INCORPORATED":
27079
- return CompanyTypesValue.INCORPORATED_ASSOCIATION;
27080
- case "OTHER":
27081
- case "PARTNERSHIP":
27082
- default:
27083
- return void 0;
27084
- }
27085
- };
27086
- const mapCompanyDataResponseToFormSchema = (company2) => ({
27087
- companyBasics: {
27088
- country: company2.country,
27089
- stateOrProvince: company2.state,
27090
- legalCompanyName: company2.name
27091
- },
27092
- companyRegistrationAddress: {
27093
- registrationAddress: {
27094
- address: company2.street,
27095
- stateOrProvince: company2.state,
27096
- country: company2.country,
27097
- postalCode: company2.zipcode,
27098
- city: company2.city
27099
- }
27100
- },
27101
- companyStructure: {
27102
- entityType: mapOrganizationTypeToCompanyType(company2.organizationType)
27103
- },
27104
- companyOtherDetails: {
27105
- registrationNumber: company2.registrationNumber
27106
- }
27107
- });
27108
28106
  const CompanyLookupResultsHeader = ({
27109
28107
  results,
27110
28108
  status,
@@ -27179,9 +28177,9 @@ const LookupResultAlert = ({
27179
28177
  i18n
27180
28178
  } = useI18nContext();
27181
28179
  const iconType = {
27182
- verified: AlertTypes.SUCCESS,
27183
- warning: AlertTypes.WARNING,
27184
- error: AlertTypes.ERROR
28180
+ verified: "success",
28181
+ warning: "warning",
28182
+ error: "error"
27185
28183
  };
27186
28184
  return jsxs("div", {
27187
28185
  className: `adyen-company-lookup-result__alert adyen-company-lookup-result__alert--${type}`,
@@ -28140,133 +29138,7 @@ const formatDataForSummary = (data, forms2, labels2, i18n) => {
28140
29138
  }
28141
29139
  }, {});
28142
29140
  };
28143
- const mapCompanySearchDocumentToApiDocument = async (data, entityId) => {
28144
- var _a, _b, _c;
28145
- const {
28146
- companyRegistrationDocument: companyRegistrationDocument2,
28147
- companyTaxDocument
28148
- } = data;
28149
- const entityType2 = "legalEntity";
28150
- 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;
28151
- const documents2 = await Promise.all([
28152
- createDocumentRequest({
28153
- entityId,
28154
- entityType: entityType2,
28155
- documentType: DocumentType.REGISTRATION_DOCUMENT,
28156
- page1: (_b = companyRegistrationDocument2 == null ? void 0 : companyRegistrationDocument2.registrationDocument) == null ? void 0 : _b[0]
28157
- }),
28158
- createDocumentRequest({
28159
- entityId,
28160
- entityType: entityType2,
28161
- documentType: taxDocumentType,
28162
- page1: (_c = companyTaxDocument == null ? void 0 : companyTaxDocument.taxDocument) == null ? void 0 : _c[0]
28163
- })
28164
- // Add this when we need shareholder document functionality
28165
- // createDocumentRequest(legalEntityId, 'legalEntity', DocumentType.SHAREHOLDER_DOCUMENT, shareholderDocument?.[0])
28166
- ]);
28167
- return documents2.filter(Boolean);
28168
- };
28169
- const mapCompanySearchSchemaToLegalEntity = (data) => {
28170
- var _a, _b, _c, _d, _e;
28171
- const requestObj = {
28172
- ...formatObject(data, companySearchApiKeyMapping)
28173
- };
28174
- if (requestObj.organization) {
28175
- if (((_a = data.companyBasics) == null ? void 0 : _a.taxInformation) || ((_b = data.companyOtherDetails) == null ? void 0 : _b.taxInformation)) {
28176
- 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;
28177
- }
28178
- if (requestObj.organization.vatAbsenceReason) {
28179
- requestObj.organization.vatNumber = "";
28180
- }
28181
- }
28182
- requestObj.type = LegalEntityType.ORGANIZATION;
28183
- return requestObj;
28184
- };
28185
- const mapApiDocumentToCompanySearchDocuments = (entityId) => {
28186
- const registrationDocument2 = getDocument$1(entityId, DocumentType.REGISTRATION_DOCUMENT) ?? null;
28187
- const taxDocument2 = getDocument$1(entityId, DocumentType.VAT_DOCUMENT) ?? getDocument$1(entityId, DocumentType.PROOF_OF_ORGANIZATION_TAX_INFO) ?? null;
28188
- return {
28189
- companyRegistrationDocument: registrationDocument2 ? {
28190
- registrationDocument: [mapExistingFile(getPageName(registrationDocument2))]
28191
- } : void 0,
28192
- companyTaxDocument: taxDocument2 ? {
28193
- taxDocument: [mapExistingFile(getPageName(taxDocument2))]
28194
- } : void 0
28195
- };
28196
- };
28197
- const mapLegalEntityToCompanySearchSchema = (legalEntity, isChangingType, accountHolder2) => {
28198
- const companySearchSchema = {
28199
- companyBasics: {},
28200
- companyRegistrationAddress: {},
28201
- companyStructure: {},
28202
- companyOtherDetails: {},
28203
- companyRegistrationDocument: {},
28204
- companyTaxDocument: {},
28205
- ...formatObject(legalEntity, companySearchComponentsKeyMapping)
28206
- };
28207
- const {
28208
- companyRegistrationDocument: companyRegistrationDocument2,
28209
- companyTaxDocument
28210
- } = mapApiDocumentToCompanySearchDocuments(legalEntity == null ? void 0 : legalEntity.id);
28211
- return entriesOf(companySearchSchema).reduce((componentData, [key, value]) => {
28212
- var _a, _b, _c, _d, _e, _f, _g;
28213
- switch (key) {
28214
- case "companyBasics": {
28215
- return {
28216
- ...componentData,
28217
- [key]: value
28218
- };
28219
- }
28220
- case "companyRegistrationAddress": {
28221
- return {
28222
- ...componentData,
28223
- [key]: {
28224
- ...value,
28225
- operationalAddressIsSame: ((_a = legalEntity.organization) == null ? void 0 : _a.principalPlaceOfBusiness) ? operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_NOT_SAME : operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_SAME
28226
- }
28227
- };
28228
- }
28229
- case "companyOtherDetails": {
28230
- return {
28231
- ...componentData,
28232
- [key]: {
28233
- ...value,
28234
- 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,
28235
- 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)
28236
- }
28237
- };
28238
- }
28239
- case "companyStructure": {
28240
- return {
28241
- ...componentData,
28242
- [key]: {
28243
- ...value,
28244
- accountHolder: getDefaultAccountHolderType(legalEntity, isChangingType, accountHolder2)
28245
- }
28246
- };
28247
- }
28248
- case "companyRegistrationDocument": {
28249
- return {
28250
- ...componentData,
28251
- [key]: {
28252
- ...companyRegistrationDocument2
28253
- }
28254
- };
28255
- }
28256
- case "companyTaxDocument": {
28257
- return {
28258
- ...componentData,
28259
- [key]: {
28260
- ...companyTaxDocument
28261
- }
28262
- };
28263
- }
28264
- default:
28265
- return componentData;
28266
- }
28267
- }, {});
28268
- };
28269
- const logger$g = createLogger("useFormTaskSubmit");
29141
+ const logger$h = createLogger("useFormTaskSubmit");
28270
29142
  function useCompanySearchTaskSubmit({
28271
29143
  task,
28272
29144
  forms: forms2,
@@ -28309,7 +29181,7 @@ function useCompanySearchTaskSubmit({
28309
29181
  });
28310
29182
  }
28311
29183
  } catch (e) {
28312
- logger$g.error(e);
29184
+ logger$h.error(e);
28313
29185
  userEvents.addEvent(CompanySearchEvents.DOCUMENTS_ERROR, {
28314
29186
  segmentation: {
28315
29187
  ...baseTrackingPayload,
@@ -28361,7 +29233,7 @@ function useCompanySearchTaskSubmit({
28361
29233
  ...trackingPayload
28362
29234
  }
28363
29235
  });
28364
- logger$g.log(submittedLegalEntity);
29236
+ logger$h.log(submittedLegalEntity);
28365
29237
  clearToasts();
28366
29238
  onExternalSubmit == null ? void 0 : onExternalSubmit(data);
28367
29239
  } catch (e) {
@@ -28385,7 +29257,7 @@ function useCompanySearchTaskSubmit({
28385
29257
  type: "error"
28386
29258
  });
28387
29259
  }
28388
- logger$g.error(e);
29260
+ logger$h.error(e);
28389
29261
  userEvents.addEvent(CompanySearchEvents.TASK_ERROR, {
28390
29262
  segmentation: {
28391
29263
  ...baseTrackingPayload,
@@ -28742,7 +29614,9 @@ function CompanySearchDropinComponent({
28742
29614
  })
28743
29615
  });
28744
29616
  }
28745
- const logger$f = createLogger("useLocalStorage");
29617
+ const IgnoreLocalStorageContext = createContext(false);
29618
+ const useIgnoreLocalStorage = () => useContext(IgnoreLocalStorageContext);
29619
+ const logger$g = createLogger("useLocalStorage");
28746
29620
  const useLocalStorage = (key, defaultValue, options) => {
28747
29621
  const {
28748
29622
  serializer,
@@ -28754,20 +29628,21 @@ const useLocalStorage = (key, defaultValue, options) => {
28754
29628
  syncData: true,
28755
29629
  ...options
28756
29630
  }), [options]);
29631
+ const ignoreLocalStorage = useIgnoreLocalStorage() || typeof window === "undefined";
28757
29632
  const rawValueRef = useRef(null);
28758
29633
  const [value, setValue] = useState(() => {
28759
- if (typeof window === "undefined") return defaultValue;
29634
+ if (ignoreLocalStorage) return defaultValue;
28760
29635
  try {
28761
29636
  rawValueRef.current = window.localStorage.getItem(key);
28762
29637
  const res = rawValueRef.current ? parser(rawValueRef.current) : defaultValue;
28763
29638
  return res;
28764
29639
  } catch (err) {
28765
- logger$f.error(err);
29640
+ logger$g.error(err);
28766
29641
  return defaultValue;
28767
29642
  }
28768
29643
  });
28769
29644
  useEffect(() => {
28770
- if (typeof window === "undefined") return;
29645
+ if (ignoreLocalStorage) return;
28771
29646
  const updateLocalStorage = () => {
28772
29647
  if (value !== void 0) {
28773
29648
  const newValue = serializer(value);
@@ -28793,9 +29668,9 @@ const useLocalStorage = (key, defaultValue, options) => {
28793
29668
  try {
28794
29669
  updateLocalStorage();
28795
29670
  } catch (err) {
28796
- logger$f.error(err);
29671
+ logger$g.error(err);
28797
29672
  }
28798
- }, [value]);
29673
+ }, [value, ignoreLocalStorage]);
28799
29674
  useEffect(() => {
28800
29675
  if (!syncData) return;
28801
29676
  const handleStorageChange = (event) => {
@@ -28806,13 +29681,13 @@ const useLocalStorage = (key, defaultValue, options) => {
28806
29681
  setValue(event.newValue ? parser(event.newValue) : void 0);
28807
29682
  }
28808
29683
  } catch (err) {
28809
- logger$f.error(err);
29684
+ logger$g.error(err);
28810
29685
  }
28811
29686
  };
28812
- if (typeof window === "undefined") return;
29687
+ if (ignoreLocalStorage) return;
28813
29688
  window.addEventListener("storage", handleStorageChange);
28814
29689
  return () => window.removeEventListener("storage", handleStorageChange);
28815
- }, [key, syncData]);
29690
+ }, [key, syncData, ignoreLocalStorage]);
28816
29691
  return [value, setValue];
28817
29692
  };
28818
29693
  const getHasSeenIntroductionStorageKey = (legalEntityId) => `COMPLETED_INTRO-${legalEntityId}`;
@@ -28864,7 +29739,7 @@ const useIsEligibleForSingpass = ({
28864
29739
  const isVanillaIndividual = legalEntityType === LegalEntityType.INDIVIDUAL && !hasSoleProprietor;
28865
29740
  return isVanillaOrganization && isSingpassForCompaniesEnabled || isVanillaIndividual && isSingpassForIndividualsEnabled;
28866
29741
  };
28867
- const logger$e = createLogger("useAssociatedLegalArrangement");
29742
+ const logger$f = createLogger("useAssociatedLegalArrangement");
28868
29743
  function useAssociatedLegalArrangement({
28869
29744
  rootLegalEntity,
28870
29745
  getLegalEntity: getLegalEntity2
@@ -28875,7 +29750,7 @@ function useAssociatedLegalArrangement({
28875
29750
  var _a;
28876
29751
  const foundEntity = (_a = rootLegalEntity == null ? void 0 : rootLegalEntity.entityAssociations) == null ? void 0 : _a.find((entity) => entity.type === LegalEntityType.SOLE_PROPRIETORSHIP || entity.type === LegalEntityType.TRUST);
28877
29752
  if (foundEntity == null ? void 0 : foundEntity.legalEntityId) {
28878
- getAssociatedEntity(foundEntity == null ? void 0 : foundEntity.legalEntityId).then((res) => setAssociatedLegalArrangement(res)).catch(logger$e.error);
29753
+ getAssociatedEntity(foundEntity == null ? void 0 : foundEntity.legalEntityId).then((res) => setAssociatedLegalArrangement(res)).catch(logger$f.error);
28879
29754
  }
28880
29755
  }, [getAssociatedEntity, rootLegalEntity == null ? void 0 : rootLegalEntity.entityAssociations]);
28881
29756
  useEffect(() => {
@@ -28897,7 +29772,7 @@ const useCanSeeEntitySelection = (legalEntityId) => {
28897
29772
  setCanSeeEntitySelection: setCanSeeEntitySelectionIntoLocalStorage
28898
29773
  };
28899
29774
  };
28900
- const logger$d = createLogger("useExemptSettlor");
29775
+ const logger$e = createLogger("useExemptSettlor");
28901
29776
  const useExemptSettlor = ({
28902
29777
  trust: trust2,
28903
29778
  handleGetLegalEntity
@@ -28910,7 +29785,7 @@ const useExemptSettlor = ({
28910
29785
  }, [handleGetLegalEntity]);
28911
29786
  useEffect(() => {
28912
29787
  if (!(trust2 == null ? void 0 : trust2.trust)) return;
28913
- updateExemptSettlor(trust2).catch(logger$d.error);
29788
+ updateExemptSettlor(trust2).catch(logger$e.error);
28914
29789
  }, [trust2, updateExemptSettlor]);
28915
29790
  return exemptSettlor;
28916
29791
  };
@@ -28935,11 +29810,6 @@ function useSalesChannelsSettings() {
28935
29810
  return settings;
28936
29811
  }, [isSettingEnabled]);
28937
29812
  }
28938
- var TrustedFieldsProvider = /* @__PURE__ */ ((TrustedFieldsProvider2) => {
28939
- TrustedFieldsProvider2["SINGPASS"] = "singpass";
28940
- TrustedFieldsProvider2["KOMPANY"] = "kompany";
28941
- return TrustedFieldsProvider2;
28942
- })(TrustedFieldsProvider || {});
28943
29813
  const downloadFile = async (base64, filename) => {
28944
29814
  saveBlobAsFile(base64ToBlob(base64), filename);
28945
29815
  };
@@ -29232,7 +30102,7 @@ function AccountSetupRejected() {
29232
30102
  const content = jsxs("div", {
29233
30103
  children: [jsx(AlertIcon, {
29234
30104
  className: "adyen-kyc-alert-error-icon",
29235
- type: AlertTypes.ERROR
30105
+ type: "error"
29236
30106
  }), jsx(FormHeader, {
29237
30107
  heading: i18n.get("cantSetUpAcccount")
29238
30108
  }), jsx("span", {
@@ -29675,15 +30545,6 @@ const iconStatus = (current, min, max) => {
29675
30545
  return isWithinConditionalRange ? "conditionalFinished" : "conditionalEmpty";
29676
30546
  };
29677
30547
  const getEntityStatusRuleDescription = (country2, currentTask, entityLabel) => currentTask === TaskTypes.TRUST_MEMBER_OVERVIEW ? TRUST_DEFAULT_DESCRIPTIONS_MAP[entityLabel] : getDecisionMakerDescriptionMap(country2)[entityLabel];
29678
- function CardGroup({
29679
- className,
29680
- children
29681
- }) {
29682
- return jsx("section", {
29683
- className: cx("adyen-kyc-card-group", className),
29684
- children
29685
- });
29686
- }
29687
30548
  const Status = ({
29688
30549
  text,
29689
30550
  className,
@@ -29697,7 +30558,7 @@ const Status = ({
29697
30558
  children: [jsx("span", {
29698
30559
  className: iconClasses,
29699
30560
  children: icon === "loading" ? jsx(Loader, {
29700
- size: "xsmall",
30561
+ size: "small",
29701
30562
  dot: true
29702
30563
  }) : jsx(Icon, {
29703
30564
  name: icon
@@ -29813,7 +30674,7 @@ const VerificationErrorAlert = ({
29813
30674
  return jsx(Alert, {
29814
30675
  className,
29815
30676
  hasCloseButton: false,
29816
- type: AlertTypes.ERROR,
30677
+ type: "error",
29817
30678
  title: `${childErrorMsg}. ${remediationActionMsg}`
29818
30679
  });
29819
30680
  }
@@ -29822,65 +30683,10 @@ const VerificationErrorAlert = ({
29822
30683
  return jsx(Alert, {
29823
30684
  className,
29824
30685
  hasCloseButton: false,
29825
- type: AlertTypes.ERROR,
30686
+ type: "error",
29826
30687
  title: i18n.get("verificationErrorMessage")
29827
30688
  });
29828
30689
  };
29829
- function Card({
29830
- className,
29831
- children,
29832
- stateful,
29833
- active,
29834
- disabled,
29835
- warning,
29836
- warningMessage,
29837
- title,
29838
- subTitle,
29839
- onClick,
29840
- onKeyDown
29841
- }) {
29842
- const classNames = cx("adyen-kyc-card", className, {
29843
- "adyen-kyc-card--stateful": stateful,
29844
- "adyen-kyc-card--active": stateful && active,
29845
- "adyen-kyc-card--disabled": disabled
29846
- });
29847
- const tabIndex = stateful ? 0 : void 0;
29848
- const role2 = stateful ? "button" : void 0;
29849
- const onClickHandler = (e) => {
29850
- if (disabled) {
29851
- return;
29852
- }
29853
- onClick == null ? void 0 : onClick(e);
29854
- };
29855
- return jsxs("article", {
29856
- className: classNames,
29857
- tabIndex,
29858
- role: role2,
29859
- onClick: onClickHandler,
29860
- onKeyDown,
29861
- children: [title && jsxs("header", {
29862
- className: "adyen-kyc-card__header",
29863
- children: [jsx(Typography, {
29864
- el: "h4",
29865
- variant: "title",
29866
- children: title
29867
- }), subTitle && jsx(Typography, {
29868
- el: "p",
29869
- variant: "body",
29870
- children: subTitle
29871
- })]
29872
- }), jsx("div", {
29873
- role: "region",
29874
- className: "adyen-kyc-card__body",
29875
- children
29876
- }), warning && jsx(Alert, {
29877
- className: "adyen-kyc-card__warning",
29878
- title: warningMessage,
29879
- hasCloseButton: false,
29880
- type: AlertTypes.WARNING
29881
- })]
29882
- });
29883
- }
29884
30690
  function useClickAwayListener(ref, onClickAway) {
29885
30691
  const handleClickAway = useCallback((event) => {
29886
30692
  if (ref.current && !ref.current.contains(event.target)) {
@@ -30268,7 +31074,7 @@ const DecisionMakersComponent = ({
30268
31074
  }
30269
31075
  });
30270
31076
  showToast({
30271
- type: "error",
31077
+ type: "success",
30272
31078
  label: i18n.get("successFullyRemovedDecisionMaker")
30273
31079
  });
30274
31080
  } catch (e) {
@@ -30318,7 +31124,7 @@ const DecisionMakersComponent = ({
30318
31124
  className: "adyen-kyc-decision-makers__warning",
30319
31125
  title: remediationMessages.DECISION_MAKER,
30320
31126
  hasCloseButton: false,
30321
- type: AlertTypes.WARNING
31127
+ type: "warning"
30322
31128
  }), (uniqueDecisionMakers == null ? void 0 : uniqueDecisionMakers.length) > 0 ? jsx(CardGroup, {
30323
31129
  children: uniqueDecisionMakers.map((decisionMaker2) => jsx(EntityAssociation, {
30324
31130
  types: decisionMaker2.types,
@@ -31116,7 +31922,6 @@ const TaskListItem = ({
31116
31922
  handleIsRemoveDisabled
31117
31923
  })
31118
31924
  }) : jsx(Icon, {
31119
- className: "adyen-kyc-u-color-grey-60",
31120
31925
  name: "chevron-right"
31121
31926
  })]
31122
31927
  })]
@@ -31395,7 +32200,7 @@ function TaskListComponent({
31395
32200
  disabled: !canAddPayoutAccount,
31396
32201
  children: [jsx(Icon, {
31397
32202
  name: "plus",
31398
- className: "adyen-kyc-u-padding-top-2 adyen-kyc-u-margin-right-8"
32203
+ className: "adyen-task-list__card-icon "
31399
32204
  }), jsx("span", {
31400
32205
  children: isEnableNewEntryFlowEnabled ? i18n.get("addExtraBankAccount") : i18n.get(hasPayinTaskNotPayout ? "addExtraPayinAccount" : "addExtraPayoutAccount")
31401
32206
  })]
@@ -31490,7 +32295,7 @@ const CompanyTrustMemberTaskItem = ({
31490
32295
  })
31491
32296
  }];
31492
32297
  const infoContent = companyTrustMember.ownerId ? void 0 : jsx(Alert, {
31493
- type: AlertTypes.BASIC,
32298
+ type: "basic",
31494
32299
  hasCloseButton: false,
31495
32300
  title: jsxs(Fragment, {
31496
32301
  children: [i18n.get("helpUsVerifyCompany"), " ", jsx(Link, {
@@ -31787,27 +32592,11 @@ const isNotEmptyBirthDateValidatorRule = {
31787
32592
  const isNotOutOfRangeBirthDateValidatorRule = {
31788
32593
  modes: ["blur"],
31789
32594
  validate: (birthDate2) => !isEmpty(birthDate2) && new Date(birthDate2) < /* @__PURE__ */ new Date(),
31790
- errorMessage: "fieldIsRequired"
31791
- };
31792
- const getAgeToday = (birthdate2) => {
31793
- const today = /* @__PURE__ */ new Date();
31794
- const todayMonth = today.getMonth();
31795
- const todayDay = today.getDate();
31796
- const bdDate = new Date(birthdate2);
31797
- const bdMonth = bdDate.getMonth();
31798
- const yearDifference = today.getFullYear() - bdDate.getFullYear();
31799
- if (todayMonth > bdMonth) {
31800
- return yearDifference;
31801
- }
31802
- if (todayMonth === bdMonth && todayDay >= bdDate.getUTCDate()) {
31803
- return yearDifference;
31804
- }
31805
- return yearDifference - 1;
32595
+ errorMessage: "invalidDateOfBirth"
31806
32596
  };
31807
- const isAgeAtLeastXYearsOld = (age, x) => age >= x;
31808
32597
  const buildMinimumAgeValidationRule = (minimumAge) => ({
31809
32598
  modes: ["blur"],
31810
- validate: (birthDate2) => !!birthDate2 && isAgeAtLeastXYearsOld(getAgeToday(birthDate2), minimumAge),
32599
+ validate: (birthDate2) => !!birthDate2 && getAgeToday(birthDate2) >= minimumAge,
31811
32600
  errorMessage: {
31812
32601
  key: "youMustXYearsOldToContinue",
31813
32602
  values: {
@@ -31819,7 +32608,7 @@ const getCountrySpecificMinimumAgeValidationRule = (country2) => {
31819
32608
  if (!country2) {
31820
32609
  return buildMinimumAgeValidationRule(13);
31821
32610
  }
31822
- if (eeaCountries.some((c) => c === country2)) {
32611
+ if ([...euCountries, CountryCodes.UnitedKingdom, CountryCodes.Switzerland].some((c) => c === country2)) {
31823
32612
  return buildMinimumAgeValidationRule(16);
31824
32613
  }
31825
32614
  switch (country2) {
@@ -32335,21 +33124,26 @@ function IndividualDropinComponent({
32335
33124
  })
32336
33125
  });
32337
33126
  }
33127
+ const logger$d = createLogger("useBankConfigurationHandler");
32338
33128
  const useBankConfigurationHandlers = ({
32339
33129
  isEmbeddedDropin,
32340
33130
  handleGetBankVerificationVendors,
32341
33131
  bankAccountCountry,
32342
33132
  getConfiguration: getConfiguration2,
32343
33133
  legalEntityType,
32344
- capabilities
33134
+ capabilities,
33135
+ setLoadingStatus
32345
33136
  }) => {
32346
33137
  const [bankVerificationVendorsResponse, setBankVerificationVendorsResponse] = useState();
32347
33138
  const callBankVerificationVendorsUpfront = isEmbeddedDropin && handleGetBankVerificationVendors;
32348
33139
  useEffect(() => {
33140
+ setLoadingStatus("loading");
32349
33141
  (async () => {
32350
33142
  const bankVerificationVendorsResponse2 = callBankVerificationVendorsUpfront ? await handleGetBankVerificationVendors(bankAccountCountry) : [];
32351
33143
  setBankVerificationVendorsResponse(bankVerificationVendorsResponse2);
32352
- })();
33144
+ })().catch(logger$d.error).finally(() => {
33145
+ setLoadingStatus("success");
33146
+ });
32353
33147
  }, [bankAccountCountry]);
32354
33148
  const getConfigurationData = useCallback(async () => {
32355
33149
  var _a;
@@ -32524,6 +33318,8 @@ function PayoutDetailsDropinComponent({
32524
33318
  const [skipSubmit, setSkipSubmit] = useState(false);
32525
33319
  const [hideOnHomeButton, setHideHomeButton] = useState(false);
32526
33320
  const [loadingStatus, setLoadingStatus] = useState("success");
33321
+ const [configurationLoadingStatus, setConfigurationLoadingStatus] = useState("success");
33322
+ const [bankVendorsLoadingStatus, setBankVendorsLoadingStatus] = useState("success");
32527
33323
  const [data, setData] = useState(prefilledData);
32528
33324
  const [problems, setProblems] = useState(propProblems || ((transferInstrument == null ? void 0 : transferInstrument.id) ? (_c = (_b = getCapabilityProblems(legalEntityResponse, bankAccountCountry)) == null ? void 0 : _b.BankAccount) == null ? void 0 : _c[transferInstrument.id] : void 0));
32529
33325
  const existingBankAccountFormat = transferInstrument ? ((_d = existingPayoutDetails == null ? void 0 : existingPayoutDetails.payoutAccountDetails) == null ? void 0 : _d.iban) ? "iban" : "local" : void 0;
@@ -32548,7 +33344,8 @@ function PayoutDetailsDropinComponent({
32548
33344
  bankAccountCountry: bankAccountCountry ?? defaultPayoutCountry,
32549
33345
  getConfiguration: getConfiguration2,
32550
33346
  legalEntityType: legalEntityResponse.type,
32551
- capabilities
33347
+ capabilities,
33348
+ setLoadingStatus: setConfigurationLoadingStatus
32552
33349
  });
32553
33350
  const getPayoutAccountFormatData = useCallback(async () => getAccountFormatsForCountry(bankAccountCountry ?? defaultPayoutCountry), [bankAccountCountry]);
32554
33351
  const {
@@ -32560,7 +33357,7 @@ function PayoutDetailsDropinComponent({
32560
33357
  getConfigurationData,
32561
33358
  getPayoutAccountFormatData,
32562
33359
  instantVerificationEnabled,
32563
- setLoadingStatus,
33360
+ setLoadingStatus: setBankVendorsLoadingStatus,
32564
33361
  country: bankAccountCountry ?? defaultPayoutCountry,
32565
33362
  existingBankAccountFormat
32566
33363
  });
@@ -32580,6 +33377,7 @@ function PayoutDetailsDropinComponent({
32580
33377
  }), isSettingEnabled(SettingNames.AllowIntraRegionCrossBorderPayout), isExperimentEnabled("EnableNewEntryFlow"));
32581
33378
  }, [bankVerificationVendors]);
32582
33379
  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]);
33380
+ useUnifyLoadingStatus(setLoadingStatus, configurationLoadingStatus, bankVendorsLoadingStatus);
32583
33381
  const {
32584
33382
  state: {
32585
33383
  currentState
@@ -34796,6 +35594,17 @@ const useNavigation = ({
34796
35594
  setTaskHistory(taskHistory.slice(0, -1 * stepCount));
34797
35595
  onNavigate == null ? void 0 : onNavigate(prevTask);
34798
35596
  }, [taskHistory, onNavigate]);
35597
+ useEffect(() => {
35598
+ if (!window.history.state) window.history.pushState({}, "");
35599
+ const handleBrowserBackButton = () => {
35600
+ if (window.history.state === null) window.history.pushState({}, "");
35601
+ navigateTo(TaskTypes.TASKS_OVERVIEW);
35602
+ };
35603
+ window.addEventListener("popstate", handleBrowserBackButton);
35604
+ return () => {
35605
+ window.removeEventListener("popstate", handleBrowserBackButton);
35606
+ };
35607
+ }, [navigateTo]);
34799
35608
  useEffect(() => {
34800
35609
  const pushedTask = taskHistory.at(-1);
34801
35610
  if (pushedTask === "default") {
@@ -36449,7 +37258,7 @@ const highExposureCompanyDetailsValidations = {
36449
37258
  },
36450
37259
  legalForm: {
36451
37260
  modes: ["blur"],
36452
- validate: (legalForm) => !isEmpty(legalForm),
37261
+ validate: (legalForm2) => !isEmpty(legalForm2),
36453
37262
  errorMessage: "fieldIsRequired"
36454
37263
  },
36455
37264
  naceCode: {
@@ -37573,7 +38382,7 @@ function ViewVerificationStatusComponent({
37573
38382
  return jsx(Alert, {
37574
38383
  title: i18n.get(alertContent),
37575
38384
  hasCloseButton: false,
37576
- type: AlertTypes.ERROR
38385
+ type: "error"
37577
38386
  });
37578
38387
  }
37579
38388
  if (content) {
@@ -38034,7 +38843,7 @@ const ConfigurationApiProvider = ({
38034
38843
  isEmbeddedDropin,
38035
38844
  loadingContext
38036
38845
  } = authContext;
38037
- const sdkVersion = "2.47.1";
38846
+ const sdkVersion = "2.48.0";
38038
38847
  useAnalytics({
38039
38848
  onUserEvent,
38040
38849
  legalEntityId: rootLegalEntityId,
@@ -38448,7 +39257,7 @@ const Toast = ({
38448
39257
  "aria-labelledby": labelId,
38449
39258
  children: [isLoading && jsx("div", {
38450
39259
  className: "adyen-kyc-toast__loader",
38451
- children: jsx(Spinner, {
39260
+ children: jsx(Loader, {
38452
39261
  size: "small"
38453
39262
  })
38454
39263
  }), jsxs("div", {
@@ -38648,10 +39457,10 @@ class UIElement extends BaseElement {
38648
39457
  refreshExpiry: this.props.refreshExpiry,
38649
39458
  eventEmitter: this.eventEmitter,
38650
39459
  children: jsx("div", {
38651
- className: "adyen-kyc-u-width-full",
39460
+ className: "adyen-kyc-ui-element-container-wrapper",
38652
39461
  children: jsx(AutoResizer, {
38653
39462
  children: jsx("div", {
38654
- className: "adyen-kyc-dropin-container adyen-kyc-u-position-relative",
39463
+ className: "adyen-kyc-ui-element-container",
38655
39464
  children: jsx(ToastContextProvider, {
38656
39465
  children: jsx(StateProvider, {
38657
39466
  children: jsx(Component, {