@adyen/kyc-components 2.47.2 → 2.48.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/dist/es/adyen-kyc-components.es.js +1730 -931
  2. package/dist/es/{arrow-right-DF4Qe-8E.js → arrow-right-C4o8oS1C.js} +1 -1
  3. package/dist/es/{chevron-down-BzENwYSf.js → chevron-down-C8-1xmDI.js} +1 -1
  4. package/dist/es/chevron-left-DSyI3arz.js +11 -0
  5. package/dist/es/{chevron-right-DczMHcvL.js → chevron-right-BDZzxAre.js} +1 -1
  6. package/dist/es/{cross-BadGfrgB.js → cross-D-SQig6J.js} +1 -1
  7. package/dist/es/{download-DGC5_Bxe.js → download-COfxdarq.js} +1 -1
  8. package/dist/style.css +382 -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/FieldContainer.d.ts +1 -0
  33. package/dist/types/components/internal/Address/components/SearchAddress.d.ts +1 -1
  34. package/dist/types/components/internal/Address/types.d.ts +3 -0
  35. package/dist/types/components/internal/Alert/Alert.d.ts +1 -1
  36. package/dist/types/components/internal/Alert/types.d.ts +4 -7
  37. package/dist/types/components/internal/Card/Card.d.ts +1 -1
  38. package/dist/types/components/internal/Card/CardGroup.d.ts +1 -1
  39. package/dist/types/components/internal/Card/index.d.ts +2 -0
  40. package/dist/types/components/internal/Card/types.d.ts +2 -0
  41. package/dist/types/components/internal/DBANameField/DBANameField.d.ts +1 -1
  42. package/dist/types/components/internal/DBANameField/fieldConfig.d.ts +1 -0
  43. package/dist/types/components/internal/DBANameField/types.d.ts +1 -1
  44. package/dist/types/components/internal/Icon/Icon.d.ts +1 -0
  45. package/dist/types/components/internal/Link/Link.d.ts +1 -1
  46. package/dist/types/components/internal/Link/types.d.ts +0 -3
  47. package/dist/types/components/internal/Loader/Loader.d.ts +7 -9
  48. package/dist/types/components/internal/LoaderWrapper/LoaderWrapper.d.ts +1 -2
  49. package/dist/types/core/core.d.ts +1 -1
  50. package/dist/types/core/hooks/useBankConfigurationHandlers.d.ts +3 -1
  51. package/dist/types/core/hooks/useForm/reducer.d.ts +4 -2
  52. package/dist/types/core/hooks/useForm/types.d.ts +11 -0
  53. package/dist/types/core/hooks/useForm/useForm.d.ts +2 -1
  54. package/dist/types/core/hooks/useUnifyLoadingStatus.d.ts +2 -0
  55. package/dist/types/core/models/api/company-search.d.ts +1 -0
  56. package/dist/types/core/models/api/organization.d.ts +1 -0
  57. package/dist/types/core/models/country-code.d.ts +1 -0
  58. package/dist/types/core/process-field-configurations.d.ts +3 -2
  59. package/dist/types/utils/birth-date-utils.d.ts +11 -0
  60. package/dist/types/utils/mapping/componentApiMapping.d.ts +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
  }
@@ -7699,7 +7757,7 @@ const businessRegistrationNumberPatterns = {
7699
7757
  [StateCodesUS.Georgia]: /^\d{10}$/,
7700
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)$/,
7701
7759
  [StateCodesUS.Idaho]: /^\d{6}$/,
7702
- [StateCodesUS.Illinois]: /^\d{12}$/,
7760
+ [StateCodesUS.Illinois]: /^\d{8}$/,
7703
7761
  [StateCodesUS.Indiana]: /^\d{10}$/,
7704
7762
  [StateCodesUS.Iowa]: /^\d{4,10}$/,
7705
7763
  [StateCodesUS.Kansas]: /^\d{10}$/,
@@ -8666,7 +8724,7 @@ class UserEvents {
8666
8724
  }
8667
8725
  }
8668
8726
  const userEvents = new UserEvents();
8669
- 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";
8670
8728
  const Accordion = ({
8671
8729
  title,
8672
8730
  children,
@@ -10575,7 +10633,7 @@ const businessDetailsBase = {
10575
10633
  legalCompanyName: {
10576
10634
  rule: "REQUIRED"
10577
10635
  },
10578
- hasDBA: {
10636
+ hasDba: {
10579
10637
  rule: "REQUIRED"
10580
10638
  },
10581
10639
  dbaName: {
@@ -11049,7 +11107,7 @@ const RadioCard = ({
11049
11107
  }), loading2 ? jsx("span", {
11050
11108
  className: "adyen-kyc-radio-card__loading-icon",
11051
11109
  children: jsx(Loader, {
11052
- size: "xsmall",
11110
+ size: "small",
11053
11111
  dot: true
11054
11112
  })
11055
11113
  }) : jsx(InputRadio, {
@@ -11583,7 +11641,7 @@ const accountHolderValidationRules = {
11583
11641
  }
11584
11642
  };
11585
11643
  const accountHolderFields = ["accountHolder"];
11586
- const logger$t = createLogger("AccountHolder");
11644
+ const logger$v = createLogger("AccountHolder");
11587
11645
  function getAvailableAccountHolderOptions(legalEntityType, isChangeOfLegalEntityTypeAllowed, isTrustFlowEnabled, isSoleProprietorshipAllowed, isChangeToMyNameAllowed) {
11588
11646
  switch (legalEntityType) {
11589
11647
  case LegalEntityType.ORGANIZATION: {
@@ -11593,7 +11651,7 @@ function getAvailableAccountHolderOptions(legalEntityType, isChangeOfLegalEntity
11593
11651
  return [...isChangeToMyNameAllowed ? ["myName"] : [], ...isChangeOfLegalEntityTypeAllowed ? ["theCompanyIWorkFor"] : [], ...isTrustFlowEnabled ? ["aTrust"] : [], ...isSoleProprietorshipAllowed ? ["mySoleProprietorName"] : []];
11594
11652
  }
11595
11653
  default:
11596
- 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}'`);
11597
11655
  return [];
11598
11656
  }
11599
11657
  }
@@ -12147,7 +12205,7 @@ function Dropzone(props) {
12147
12205
  })]
12148
12206
  });
12149
12207
  }
12150
- const logger$s = createLogger("TextArea");
12208
+ const logger$u = createLogger("TextArea");
12151
12209
  function TextArea(props) {
12152
12210
  const {
12153
12211
  classNameModifiers,
@@ -12168,7 +12226,7 @@ function TextArea(props) {
12168
12226
  } = useI18nContext();
12169
12227
  const [value, setValue] = useState("");
12170
12228
  if (Object.prototype.hasOwnProperty.call(props, "onChange")) {
12171
- 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");
12172
12230
  }
12173
12231
  const handleInput = (e) => {
12174
12232
  var _a;
@@ -12541,7 +12599,7 @@ function FieldContainer(props) {
12541
12599
  },
12542
12600
  readonly: readOnly,
12543
12601
  classNameModifiers,
12544
- className: hideField ? "adyen-kyc-u-display-none" : "",
12602
+ className: hideField ? "adyen-kyc-search-fieldcontainer-hide" : "",
12545
12603
  handleChangeFor
12546
12604
  });
12547
12605
  case "stateOrProvince":
@@ -12589,7 +12647,7 @@ function FieldContainer(props) {
12589
12647
  };
12590
12648
  if (hideField) {
12591
12649
  return jsx("div", {
12592
- className: "adyen-kyc-u-display-none",
12650
+ className: "adyen-kyc-search-fieldcontainer-hide",
12593
12651
  children: renderField(fieldName)
12594
12652
  });
12595
12653
  }
@@ -12614,7 +12672,7 @@ function useIsElementVisible(ref, fallback = true) {
12614
12672
  }, [ref]);
12615
12673
  return isOnScreen;
12616
12674
  }
12617
- const logger$r = createLogger("SearchAddress");
12675
+ const logger$t = createLogger("SearchAddress");
12618
12676
  const SearchAddress = ({
12619
12677
  data,
12620
12678
  legalEntityId,
@@ -12623,7 +12681,8 @@ const SearchAddress = ({
12623
12681
  handleAddressSearch,
12624
12682
  handleFindAddress,
12625
12683
  addressType,
12626
- kompanyAddress
12684
+ kompanyAddress,
12685
+ kompanyPrefilled = false
12627
12686
  }) => {
12628
12687
  const {
12629
12688
  i18n
@@ -12644,10 +12703,10 @@ const SearchAddress = ({
12644
12703
  }
12645
12704
  }, [kompanyAddress]);
12646
12705
  useEffect(() => {
12647
- if (isVisible && kompanyAddress && addressType === "registrationAddress") {
12706
+ if (isVisible && kompanyAddress && addressType === "registrationAddress" && !kompanyPrefilled) {
12648
12707
  setShowSearchList(true);
12649
12708
  }
12650
- }, [isVisible, kompanyAddress, addressType]);
12709
+ }, [isVisible, kompanyAddress, addressType, kompanyPrefilled]);
12651
12710
  useEffect(() => {
12652
12711
  setItems([]);
12653
12712
  setResetSearch(true);
@@ -12657,7 +12716,7 @@ const SearchAddress = ({
12657
12716
  const response = await handleFindAddress(selectedAddressId);
12658
12717
  autocompleteAddressForm(response);
12659
12718
  } catch (e) {
12660
- logger$r.error(e);
12719
+ logger$t.error(e);
12661
12720
  }
12662
12721
  };
12663
12722
  const onDrilldown = async (selectedAddress) => {
@@ -12669,7 +12728,7 @@ const SearchAddress = ({
12669
12728
  }, legalEntityId);
12670
12729
  setItems((response == null ? void 0 : response.results) || []);
12671
12730
  } catch (e) {
12672
- logger$r.error(e);
12731
+ logger$t.error(e);
12673
12732
  }
12674
12733
  };
12675
12734
  const onChange = (e) => {
@@ -12724,7 +12783,7 @@ const SearchAddress = ({
12724
12783
  setItems([]);
12725
12784
  }
12726
12785
  } catch (e) {
12727
- logger$r.error(e);
12786
+ logger$t.error(e);
12728
12787
  }
12729
12788
  setLoading(false);
12730
12789
  }
@@ -13157,11 +13216,15 @@ function Address(props) {
13157
13216
  id: id2,
13158
13217
  hideCountry,
13159
13218
  heading,
13219
+ verifiedBusiness,
13160
13220
  kompanyAddress
13161
13221
  } = props;
13162
13222
  const {
13163
13223
  i18n
13164
13224
  } = useI18nContext();
13225
+ const {
13226
+ isExperimentEnabled
13227
+ } = useExperimentsContext();
13165
13228
  const [showAutocompletedAddressFields, setShowAutocompletedAddressFields] = useState(false);
13166
13229
  const [showAddAddressButton, setShowAddAddressButton] = useState(true);
13167
13230
  const [isHandlerPresent, setIsHandlerPresent] = useState(false);
@@ -13180,7 +13243,9 @@ function Address(props) {
13180
13243
  fieldProblems,
13181
13244
  handleChangeFor,
13182
13245
  triggerValidation,
13183
- schema
13246
+ resetToDefaultData,
13247
+ schema,
13248
+ setData
13184
13249
  } = useForm({
13185
13250
  ...props,
13186
13251
  schema: requiredFields,
@@ -13270,6 +13335,24 @@ function Address(props) {
13270
13335
  setShowAddAddressButton(false);
13271
13336
  }
13272
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]);
13273
13356
  const getComponent = (fieldName) => {
13274
13357
  if (!formUtils.isRequiredField(fieldName)) return null;
13275
13358
  const hideField = fieldName === "country" && hideCountry;
@@ -13344,7 +13427,8 @@ function Address(props) {
13344
13427
  legalEntityId,
13345
13428
  autocompleteAddressForm,
13346
13429
  addressType,
13347
- kompanyAddress
13430
+ kompanyAddress: (verifiedBusiness == null ? void 0 : verifiedBusiness.address) ?? kompanyAddress,
13431
+ kompanyPrefilled: canAutofillVerifiedBusinessAddress
13348
13432
  }), jsxs("div", {
13349
13433
  className: "adyen-kyc-search-address--below",
13350
13434
  children: [jsxs("span", {
@@ -13423,6 +13507,7 @@ function RegistrationAddressComponent(props) {
13423
13507
  country: country2,
13424
13508
  data,
13425
13509
  validators: validators2,
13510
+ verifiedBusiness,
13426
13511
  kompanyAddress
13427
13512
  } = props;
13428
13513
  const {
@@ -13430,7 +13515,8 @@ function RegistrationAddressComponent(props) {
13430
13515
  optionalFields: registrationAddressOptionalFields,
13431
13516
  readOnlyFields: registrationAddressReadOnlyFields,
13432
13517
  obscuredFields: registrationAddressObscuredFields,
13433
- verifyFields: registrationAddressVerifyFields
13518
+ verifyFields: registrationAddressVerifyFields,
13519
+ trustedFields: registrationAddressTrustedFields
13434
13520
  } = getFormProps(props, registrationAddressFormID);
13435
13521
  const {
13436
13522
  data: formData,
@@ -13444,7 +13530,8 @@ function RegistrationAddressComponent(props) {
13444
13530
  defaultData: data,
13445
13531
  rules: validators2 || registrationAddressValidationRules,
13446
13532
  obscuredFields: [],
13447
- optionalFields: registrationAddressOptionalFields
13533
+ optionalFields: registrationAddressOptionalFields,
13534
+ trustedFields: registrationAddressTrustedFields
13448
13535
  });
13449
13536
  const mergedProps = {
13450
13537
  ...props,
@@ -13452,7 +13539,8 @@ function RegistrationAddressComponent(props) {
13452
13539
  optionalFields: registrationAddressOptionalFields,
13453
13540
  readOnlyFields: registrationAddressReadOnlyFields,
13454
13541
  obscuredFields: registrationAddressObscuredFields,
13455
- verifyFields: registrationAddressVerifyFields
13542
+ verifyFields: registrationAddressVerifyFields,
13543
+ trustedFields: registrationAddressTrustedFields
13456
13544
  };
13457
13545
  const formUtils = formUtilities(mergedProps, i18n);
13458
13546
  const stateRef = useRef({
@@ -13505,6 +13593,7 @@ function RegistrationAddressComponent(props) {
13505
13593
  addressType: "registrationAddress",
13506
13594
  handleAddressSearch,
13507
13595
  handleFindAddress,
13596
+ verifiedBusiness,
13508
13597
  kompanyAddress
13509
13598
  }), jsx(FormHeader, {
13510
13599
  classNames: "adyen-kyc-u-margin-top-32",
@@ -14123,7 +14212,7 @@ const getFileExtention = (fileName2) => fileName2.split(".").pop();
14123
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];
14124
14213
  const COUNTRIES_THAT_DONT_REQUIRE_COMPANY_REGISTRATION = [CountryCodes.PuertoRico, CountryCodes.UnitedStates];
14125
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];
14126
- const COUNTRIES_WITH_OPTIONAL_REGISTRATION_NUMBER = [CountryCodes.UnitedStates];
14215
+ [CountryCodes.UnitedStates];
14127
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];
14128
14217
  const COUNTRIES_THAT_DO_NOT_USE_TAX_ID_FOR_SOLE_PROP = [CountryCodes.NewZealand, CountryCodes.Singapore];
14129
14218
  const COUNTRIES_WITH_POSSIBLE_TAX_EXEMPTION_FOR_COMPANIES = [
@@ -14210,9 +14299,6 @@ const rules$2 = ({
14210
14299
  if (!COUNTRIES_THAT_DONT_REQUIRE_COMPANY_REGISTRATION.includes(country2)) {
14211
14300
  return "REQUIRED";
14212
14301
  }
14213
- if (isExperimentEnabled("EnableNewBusinessDetailsFlow") && COUNTRIES_WITH_OPTIONAL_REGISTRATION_NUMBER.includes(country2)) {
14214
- return "OPTIONAL";
14215
- }
14216
14302
  },
14217
14303
  countryRequiresDateOfIncorporationForCompanies: () => {
14218
14304
  if (COUNTRIES_THAT_REQUIRE_DATE_OF_INCORPORATION.includes(country2)) {
@@ -14393,6 +14479,7 @@ const businessDetailsBaseMapping = {
14393
14479
  "basicInformation.isUen": "organization.isUen",
14394
14480
  "companyStructure.entityType": "organization.type",
14395
14481
  "additionalInformation.legalCompanyName": "organization.legalName",
14482
+ "additionalInformation.legalFormDescription": "organization.legalFormDescription",
14396
14483
  "additionalInformation.dbaName": "organization.doingBusinessAs",
14397
14484
  "additionalInformation.registrationNumber": "organization.registrationNumber",
14398
14485
  "additionalInformation.taxInformation": "organization.taxInformation",
@@ -15436,7 +15523,7 @@ const LoaderWrapper = ({
15436
15523
  const wrapperClass = cx("adyen-kyc-loading-input__form", styles$1["adyen-kyc-loading-input__form"], {
15437
15524
  [styles$1[`adyen-kyc-loading-input__form--loading-opacity${opacity}`]]: status === "loading"
15438
15525
  });
15439
- const loaderClass = cx({
15526
+ const loaderWrapperClass = cx({
15440
15527
  [styles$1["adyen-kyc-loading-input__loader"]]: true,
15441
15528
  [styles$1["adyen-kyc-loading-input__loader--active"]]: status === "loading" && showSpinner
15442
15529
  });
@@ -15447,7 +15534,7 @@ const LoaderWrapper = ({
15447
15534
  position: "relative"
15448
15535
  },
15449
15536
  children: [jsx("div", {
15450
- className: loaderClass,
15537
+ className: loaderWrapperClass,
15451
15538
  children: jsx(Loader, {
15452
15539
  size: loaderSize
15453
15540
  })
@@ -15507,7 +15594,7 @@ const initOnfido = async ({
15507
15594
  language: getOnfidoLocaleConfig(i18n)
15508
15595
  });
15509
15596
  };
15510
- const logger$q = createLogger("IdVerificationComponent");
15597
+ const logger$s = createLogger("IdVerificationComponent");
15511
15598
  function IdVerificationComponent({
15512
15599
  userDetails,
15513
15600
  legalEntityId,
@@ -15539,7 +15626,7 @@ function IdVerificationComponent({
15539
15626
  onIdVerificationError,
15540
15627
  onIdVerificationComplete
15541
15628
  });
15542
- })().catch(logger$q.error);
15629
+ })().catch(logger$s.error);
15543
15630
  return () => {
15544
15631
  if (onfidoSdk.current) onfidoSdk.current.tearDown();
15545
15632
  };
@@ -15589,7 +15676,7 @@ function IdDocumentAlreadyUpload(props) {
15589
15676
  })]
15590
15677
  });
15591
15678
  }
15592
- const logger$p = createLogger("IdDocumentInstantVerificationComponent");
15679
+ const logger$r = createLogger("IdDocumentInstantVerificationComponent");
15593
15680
  const idVerificationSchema = ["instantIdVerificationData", "idDocumentType"];
15594
15681
  const documentTypeValidationRules = {
15595
15682
  instantIdVerificationData: {
@@ -15671,7 +15758,7 @@ function IdDocumentInstantVerificationComponent(props) {
15671
15758
  userDetails: props.userDetails,
15672
15759
  legalEntityId: props.legalEntityId,
15673
15760
  onIdVerificationComplete: handleIdVerificationComplete,
15674
- onIdVerificationError: logger$p.error
15761
+ onIdVerificationError: logger$r.error
15675
15762
  }), jsxs("div", {
15676
15763
  className: "adyen-kyc-document-upload__manual-upload",
15677
15764
  children: [i18n.get("canNotCompleteInstantVerification"), " ", jsx("button", {
@@ -15947,6 +16034,68 @@ function IdVerificationMethodComponent(props) {
15947
16034
  })]
15948
16035
  });
15949
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
+ };
15950
16099
  const COUNTRY_ID_NUMBER_MASKS = {
15951
16100
  [CountryCodes.PuertoRico]: {
15952
16101
  length: 4
@@ -17898,6 +18047,10 @@ function PersonalDetailsComponent(props) {
17898
18047
  } = useSettingsContext();
17899
18048
  const allowedCountries = useAllowedCountries();
17900
18049
  const isNewEntryFlowEnabled = useEnableNewEntryFlow();
18050
+ const {
18051
+ isExperimentEnabled
18052
+ } = useExperimentsContext();
18053
+ const isAgeVerificationEnabled = isExperimentEnabled("EnableAgeVerification");
17901
18054
  const PERSONAL_DETAILS = props.id;
17902
18055
  const {
17903
18056
  residencyCountry: residencyCountry2
@@ -18015,6 +18168,28 @@ function PersonalDetailsComponent(props) {
18015
18168
  useEffect(() => {
18016
18169
  triggerValidation();
18017
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();
18018
18193
  return jsxs(LoaderWrapper, {
18019
18194
  status,
18020
18195
  formOpacityWhenLoading: 0.3,
@@ -18049,11 +18224,12 @@ function PersonalDetailsComponent(props) {
18049
18224
  }), hasRequiredFields(nameProps) && jsx(Name, {
18050
18225
  ...nameProps,
18051
18226
  dataStoreId: PERSONAL_DETAILS
18052
- }), 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, {
18053
18229
  name: "birthDate",
18054
18230
  label: formUtils.getLabel("birthDate"),
18055
18231
  classNameModifiers: ["birthDate"],
18056
- errorMessage: formUtils.getErrorMessage("birthDate", errors, fieldProblems),
18232
+ errorMessage: isAgeVerificationEnabled && birthDateErrorMessage ? true : birthDateErrorMessage,
18057
18233
  isValid: valid.birthDate,
18058
18234
  children: (childProps) => jsx(InputDate, {
18059
18235
  ...childProps,
@@ -18085,6 +18261,29 @@ function PersonalDetailsComponent(props) {
18085
18261
  allowedCountries: isTopLevelEntity ? allowedCountries : void 0,
18086
18262
  classNameModifiers: ["country"],
18087
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
+ })]
18088
18287
  }), jsx(IndividualIdNumberTypeSelector, {
18089
18288
  country: data.residencyCountry,
18090
18289
  setSelected: setIdNumberType,
@@ -18971,6 +19170,7 @@ const ActionBar = ({
18971
19170
  nextButtonLabel,
18972
19171
  hideOnHomeButton,
18973
19172
  hideBackButton,
19173
+ hideNextButton,
18974
19174
  nextButtonDisabled = false
18975
19175
  }) => jsxs("div", {
18976
19176
  className: "adyen-action-bar",
@@ -18982,7 +19182,7 @@ const ActionBar = ({
18982
19182
  secondary: true,
18983
19183
  onClick: () => onBack(),
18984
19184
  testId: "backBtn"
18985
- }), onNext && jsx(Button, {
19185
+ }), onNext && !hideNextButton && jsx(Button, {
18986
19186
  label: nextButtonLabel,
18987
19187
  className: "adyen-action-bar__button",
18988
19188
  onClick: onNext,
@@ -19121,7 +19321,7 @@ class AdyenKycSdkError extends Error {
19121
19321
  }
19122
19322
  let sdkToken;
19123
19323
  let fetchSdkToken;
19124
- const logger$o = createLogger("Session");
19324
+ const logger$q = createLogger("Session");
19125
19325
  const setSdkToken = (token) => {
19126
19326
  sdkToken = token;
19127
19327
  };
@@ -19144,7 +19344,7 @@ const refreshSession = async () => {
19144
19344
  setSdkToken(token);
19145
19345
  isSessionRefreshed = true;
19146
19346
  } catch (e) {
19147
- logger$o.error("Failed to fetch sdk token", e);
19347
+ logger$q.error("Failed to fetch sdk token", e);
19148
19348
  }
19149
19349
  return isSessionRefreshed;
19150
19350
  };
@@ -19154,7 +19354,7 @@ const addAnimationStartListener = (element, listener) => {
19154
19354
  const removeAnimationStartListener = (element, listener) => {
19155
19355
  element.removeEventListener("animationstart", listener, false);
19156
19356
  };
19157
- const logger$n = createLogger("Fetch");
19357
+ const logger$p = createLogger("Fetch");
19158
19358
  const getRequestObject = (options, data) => {
19159
19359
  const {
19160
19360
  headers = [],
@@ -19201,10 +19401,10 @@ const logFetchError = (message, level) => {
19201
19401
  case "info":
19202
19402
  case "warn":
19203
19403
  case "error":
19204
- logger$n[level](message);
19404
+ logger$p[level](message);
19205
19405
  break;
19206
19406
  default:
19207
- logger$n.error(message);
19407
+ logger$p.error(message);
19208
19408
  }
19209
19409
  };
19210
19410
  const handleFetchResponse = async (response, responseType) => {
@@ -19295,7 +19495,7 @@ const RELEVANT_MESSAGE_TYPES = ["account_verification_report_id", "error"];
19295
19495
  const TERMINAL_DATA_PROPS = ["accounts", "error", "reference"];
19296
19496
  const MOUNT_TIMEOUT = 10 * 1e3;
19297
19497
  const TINK_VENDOR = "Tink";
19298
- const logger$m = createLogger("iframeWidget");
19498
+ const logger$o = createLogger("iframeWidget");
19299
19499
  const isObjectData = (data) => typeof data === "object" && !Array.isArray(data) && data !== null;
19300
19500
  const isTerminalMessageData = (data) => isObjectData(data) && Object.entries(data).some(([prop]) => TERMINAL_DATA_PROPS.includes(prop));
19301
19501
  const parseMessageJson = (message) => {
@@ -19313,7 +19513,7 @@ const callbackErrorHandler = async (response) => {
19313
19513
  try {
19314
19514
  await response;
19315
19515
  } catch (ex) {
19316
- logger$m.error(ex);
19516
+ logger$o.error(ex);
19317
19517
  }
19318
19518
  return {
19319
19519
  error: "UNKNOWN_ERROR",
@@ -19416,7 +19616,7 @@ class IFrameWidget {
19416
19616
  message = responseData.errorMessage;
19417
19617
  }
19418
19618
  } catch (ex) {
19419
- logger$m.error(ex);
19619
+ logger$o.error(ex);
19420
19620
  }
19421
19621
  throw new AdyenKycSdkError(reason, jsonData.error);
19422
19622
  }
@@ -19603,7 +19803,7 @@ function BankVerificationWidget({
19603
19803
  ref: widgetContainerRef
19604
19804
  });
19605
19805
  }
19606
- const logger$l = createLogger("BankVerification");
19806
+ const logger$n = createLogger("BankVerification");
19607
19807
  const accountVerificationFields = ["verifiedAccountHolder", "verifiedBankCountry", "verifiedBankName", "verifiedCurrencyCode", "verifiedBankAccountNumber"];
19608
19808
  const InstantVerificationErrorContext = createContext(null);
19609
19809
  const useInstantVerificationErrorNotification = (notificationVisibilityDuration) => {
@@ -19635,7 +19835,7 @@ const usePreferredVendorForCountry = (country2, getBankVerificationVendors) => {
19635
19835
  const vendor = vendors[0];
19636
19836
  setPreferredVendor(vendor.name ? vendor : void 0);
19637
19837
  };
19638
- getPreferredVendor().catch(logger$l.error);
19838
+ getPreferredVendor().catch(logger$n.error);
19639
19839
  }, [country2, getBankVerificationVendors]);
19640
19840
  return preferredVendor;
19641
19841
  };
@@ -20865,7 +21065,7 @@ function PayoutAccountComponent(props) {
20865
21065
  dataStoreId: id2
20866
21066
  }), shouldShowPayoutAlert(country2) && jsx(Alert, {
20867
21067
  hasCloseButton: false,
20868
- type: AlertTypes.BASIC,
21068
+ type: "basic",
20869
21069
  title: getSupportedCurrencyGuidance(i18n, country2, requiredFields)
20870
21070
  })]
20871
21071
  });
@@ -21126,7 +21326,7 @@ function PayoutVerificationMethod(props) {
21126
21326
  children: [jsx(FormHeader, {
21127
21327
  heading: props.heading
21128
21328
  }), instantVerificationError && jsx(Alert, {
21129
- type: AlertTypes.ERROR,
21329
+ type: "error",
21130
21330
  className: "adyen-kyc-instant-verification-error",
21131
21331
  title: instantVerificationError.title,
21132
21332
  hasCloseButton: false,
@@ -22766,7 +22966,7 @@ function VerificationErrors({
22766
22966
  const defaultHeading = parentCode ? getErrorMessage(parentCode) : formUtils.getVal("correctErrorsResubmit");
22767
22967
  return jsx(Alert, {
22768
22968
  title: defaultHeading,
22769
- type: AlertTypes.ERROR,
22969
+ type: "error",
22770
22970
  hasCloseButton: false,
22771
22971
  children: verificationErrorMsg
22772
22972
  });
@@ -22867,13 +23067,13 @@ function Summary({
22867
23067
  children: renderSummaryItems(fieldData, labelData)
22868
23068
  }), jsx(Divider, {})]
22869
23069
  });
22870
- const renderSummaryContent = (data2) => {
23070
+ const renderSummaryContent = (summaryData) => {
22871
23071
  const summaryList = [];
22872
23072
  forms2.forEach(({
22873
23073
  formId,
22874
23074
  formName
22875
23075
  }) => {
22876
- const currentFormData = data2[formId];
23076
+ const currentFormData = summaryData[formId];
22877
23077
  const isFormEmpty = !currentFormData || Object.values(currentFormData).every((value) => isEmpty(value));
22878
23078
  if (isFormEmpty || formId === summaryStep.formId || omittedForms.includes(formId)) return;
22879
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);
@@ -23169,7 +23369,13 @@ const defaultPayoutAccountFormat = {
23169
23369
  [CountryCodes.Sweden]: "local",
23170
23370
  [CountryCodes.UnitedKingdom]: "local"
23171
23371
  };
23172
- 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");
23173
23379
  const useScenarioConfiguration = ({
23174
23380
  getConfigurationData,
23175
23381
  getPayoutAccountFormatData,
@@ -23185,23 +23391,26 @@ const useScenarioConfiguration = ({
23185
23391
  } = useCoreContext();
23186
23392
  const [configurationResponse, setConfigurationResponse] = useState();
23187
23393
  const [accountFormatResponse, setAccountFormatResponse] = useState();
23394
+ const [configurationLoadingStatus, setConfigurationLoadingStatus] = useState("success");
23395
+ const [payoutFormatLoadingStatus, setpayoutFormatLoadingStatus] = useState("success");
23396
+ useUnifyLoadingStatus(setLoadingStatus, configurationLoadingStatus, payoutFormatLoadingStatus);
23188
23397
  useEffect(() => {
23189
- setLoadingStatus("loading");
23398
+ setConfigurationLoadingStatus("loading");
23190
23399
  const makeConfigCallAndSave = async () => {
23191
23400
  try {
23192
23401
  const response = await getConfigurationData();
23193
23402
  setConfigurationResponse(response);
23194
23403
  } catch (err) {
23195
- logger$k.warn("WARNING: Configuration request failed - error:", err);
23404
+ logger$m.warn("WARNING: Configuration request failed - error:", err);
23196
23405
  } finally {
23197
- setLoadingStatus("success");
23406
+ setConfigurationLoadingStatus("success");
23198
23407
  }
23199
23408
  };
23200
- makeConfigCallAndSave().catch(logger$k.error);
23201
- }, [getConfigurationData, setLoadingStatus]);
23409
+ makeConfigCallAndSave().catch(logger$m.error);
23410
+ }, [getConfigurationData, setConfigurationLoadingStatus]);
23202
23411
  useEffect(() => {
23203
- setLoadingStatus("loading");
23204
23412
  if (!getPayoutAccountFormatData) return;
23413
+ setpayoutFormatLoadingStatus("loading");
23205
23414
  const makePayoutFormatCallAndSave = async () => {
23206
23415
  try {
23207
23416
  const response = await getPayoutAccountFormatData();
@@ -23214,13 +23423,13 @@ const useScenarioConfiguration = ({
23214
23423
  const defaultAccountFormat = defaultPayoutAccountFormat[country2] ?? allowedBankAccountFormats[0];
23215
23424
  setAccountFormat(existingBankAccountFormat ?? defaultAccountFormat);
23216
23425
  } catch (err) {
23217
- logger$k.warn("WARNING: Payout format request failed - error:", err);
23426
+ logger$m.warn("WARNING: Payout format request failed - error:", err);
23218
23427
  } finally {
23219
- setLoadingStatus("success");
23428
+ setpayoutFormatLoadingStatus("success");
23220
23429
  }
23221
23430
  };
23222
- makePayoutFormatCallAndSave().catch(logger$k.error);
23223
- }, [country2, setAccountFormat, getPayoutAccountFormatData, setLoadingStatus, existingBankAccountFormat]);
23431
+ makePayoutFormatCallAndSave().catch(logger$m.error);
23432
+ }, [country2, setAccountFormat, getPayoutAccountFormatData, setpayoutFormatLoadingStatus, existingBankAccountFormat]);
23224
23433
  const {
23225
23434
  fieldConfigurations,
23226
23435
  bankVerificationVendors,
@@ -23271,6 +23480,11 @@ const addLinkedFields = (fields) => {
23271
23480
  }
23272
23481
  return [...new Set(withLinkedFields)];
23273
23482
  };
23483
+ var TrustedFieldsProvider = /* @__PURE__ */ ((TrustedFieldsProvider2) => {
23484
+ TrustedFieldsProvider2["SINGPASS"] = "singpass";
23485
+ TrustedFieldsProvider2["KOMPANY"] = "kompany";
23486
+ return TrustedFieldsProvider2;
23487
+ })(TrustedFieldsProvider || {});
23274
23488
  const identityBase = {
23275
23489
  role: {
23276
23490
  rule: "REQUIRED"
@@ -23602,7 +23816,7 @@ const isFieldRequired = (fieldConfigurations, customRules) => {
23602
23816
  }
23603
23817
  return fieldConfigurations && ((fieldConfigurations == null ? void 0 : fieldConfigurations.rule) === "REQUIRED" || (customRules == null ? void 0 : customRules[fieldConfigurations.rule]) && customRules[fieldConfigurations.rule]() === "REQUIRED");
23604
23818
  };
23605
- function getPropsFromConfigurations(scenarioConfiguration, forms2, remediationActions, dataMissingErrors, fieldsWithExistingData, customRules = {}, customLabels2 = {}, customValidators = {}) {
23819
+ function getPropsFromConfigurations(scenarioConfiguration, forms2, remediationActions, dataMissingErrors, fieldsWithExistingData, customRules = {}, customLabels2 = {}, customValidators = {}, legalEntityTrustedFields) {
23606
23820
  var _a;
23607
23821
  const requiredFields = {};
23608
23822
  const optionalFields = {};
@@ -23614,9 +23828,19 @@ function getPropsFromConfigurations(scenarioConfiguration, forms2, remediationAc
23614
23828
  const masks = {};
23615
23829
  const validators2 = {};
23616
23830
  const obscuredFields = {};
23831
+ const trustedFields2 = {};
23617
23832
  if (!scenarioConfiguration) {
23618
23833
  return;
23619
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
+ }, []);
23620
23844
  (_a = Object.entries(forms2)) == null ? void 0 : _a.forEach(([formId, formDetails]) => {
23621
23845
  var _a2;
23622
23846
  const formFieldsWithExistingData = addLinkedFields(fieldsWithExistingData).filter((field) => field.startsWith(formId)).map((field) => field.slice(field.lastIndexOf(".") + 1));
@@ -23628,7 +23852,7 @@ function getPropsFromConfigurations(scenarioConfiguration, forms2, remediationAc
23628
23852
  const isFieldNeededToRemediateDataMissingError = isFieldRequiredToRemediateDataMissingError(formId, field, dataMissingErrors);
23629
23853
  const fieldHasExistingData = formFieldsWithExistingData.includes(field);
23630
23854
  const isRequired = isFieldRequiredByRemediationAction || isRequiredFromFieldConfig || isFieldNeededToRemediateDataMissingError || fieldHasExistingData;
23631
- if (isRequired) {
23855
+ if (isRequired && !readonly.includes(field)) {
23632
23856
  requiredFields[formId] = requiredFields[formId] ? [...requiredFields[formId], field] : [field];
23633
23857
  allFields[formId] = allFields[formId] ? [...allFields[formId], field] : [field];
23634
23858
  }
@@ -23638,6 +23862,10 @@ function getPropsFromConfigurations(scenarioConfiguration, forms2, remediationAc
23638
23862
  optionalFields[formId] = optionalFields[formId] ? [...optionalFields[formId], field] : [field];
23639
23863
  allFields[formId] = allFields[formId] ? [...allFields[formId], field] : [field];
23640
23864
  }
23865
+ const isFieldTrusted = isTrustedField(trustedMappings, formId, field);
23866
+ if (isFieldTrusted) {
23867
+ trustedFields2[formId] = trustedFields2[formId] ? [...trustedFields2[formId], field] : [field];
23868
+ }
23641
23869
  if (fieldConfigurations) {
23642
23870
  const customLabel = (_a3 = customLabels2 == null ? void 0 : customLabels2[field]) == null ? void 0 : _a3.call(customLabels2);
23643
23871
  const label = customLabel || fieldConfigurations.label;
@@ -23707,6 +23935,7 @@ function getPropsFromConfigurations(scenarioConfiguration, forms2, remediationAc
23707
23935
  placeholders,
23708
23936
  validators: validators2,
23709
23937
  obscuredFields,
23938
+ trustedFields: trustedFields2,
23710
23939
  helperText,
23711
23940
  masks
23712
23941
  };
@@ -23727,6 +23956,10 @@ const isFieldRequiredToRemediateDataMissingError = (formId, field, dataMissingEr
23727
23956
  const missingAndLinkedFields = addLinkedFields(missingFields);
23728
23957
  return missingAndLinkedFields.includes(makeTLDSFieldName(formId, field));
23729
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
+ });
23730
23963
  function getBaseTrackingPayload({
23731
23964
  trackingConfig = {
23732
23965
  topLevelLegalEntity: {}
@@ -23956,7 +24189,7 @@ const DateOfIncorporationFieldValidation = () => ({
23956
24189
  errorMessage: "invalidDateOfIncorporation"
23957
24190
  }]
23958
24191
  });
23959
- const DBA_NAME_FIELD = ["hasDBA", "dbaName"];
24192
+ const DBA_NAME_FIELD = ["hasDba", "dbaName"];
23960
24193
  function DBANameField({
23961
24194
  data,
23962
24195
  valid,
@@ -23964,35 +24197,39 @@ function DBANameField({
23964
24197
  labels: labels2,
23965
24198
  helperText,
23966
24199
  readonly,
23967
- handleChangeFor
24200
+ handleChangeFor,
24201
+ setErrors
23968
24202
  }) {
23969
24203
  const {
23970
24204
  i18n
23971
24205
  } = useI18nContext();
23972
- const selected = data.hasDBA ? "yesDba" : "noDba";
23973
- const handleHasDbaChange = (selection) => {
23974
- handleChangeFor("hasDBA")(selection === "yesDba");
23975
- };
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]);
23976
24211
  return jsxs(Fragment, {
23977
24212
  children: [jsx(Field, {
23978
24213
  name: "hasDba",
23979
- label: labels2.hasDBA ?? i18n.get("hasDba"),
23980
- 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,
23981
24218
  children: (childProps) => jsx(RadioGroup, {
23982
24219
  ...childProps,
23983
24220
  name: "hasDba",
23984
24221
  items: [{
23985
- id: "yesDba",
24222
+ id: "yes",
23986
24223
  name: "yes"
23987
24224
  }, {
23988
- id: "noDba",
24225
+ id: "no",
23989
24226
  name: "no"
23990
24227
  }],
23991
- value: selected,
23992
- onChange: (e) => handleHasDbaChange(e.target.value),
24228
+ value: selection,
24229
+ onChange: (e) => handleChangeFor("hasDba")(e.target.value === "yes"),
23993
24230
  horizontal: true
23994
24231
  })
23995
- }), data.hasDBA && jsx(Field, {
24232
+ }), data.hasDba && jsx(Field, {
23996
24233
  name: "dbaName",
23997
24234
  label: labels2.dbaName ?? i18n.get("dbaName"),
23998
24235
  errorMessage: errors.dbaName,
@@ -24013,9 +24250,12 @@ function DBANameField({
24013
24250
  })]
24014
24251
  });
24015
24252
  }
24253
+ const hasDbaFieldMetadata = {
24254
+ validators: [validateNotEmptyOnBlur]
24255
+ };
24016
24256
  const dbaNameFieldMetadata = {
24017
24257
  label: "dbaName",
24018
- validators: validateNotEmptyOnBlur
24258
+ validators: [validateNotEmptyOnBlur]
24019
24259
  };
24020
24260
  const TAX_INFORMATION_FIELD = ["taxInformation", "exemptedFromTax", "isUen"];
24021
24261
  function TaxInformationField({
@@ -24218,8 +24458,76 @@ const defaultFieldConfig$1 = entriesOf(defaultFieldConfig$8).reduce((fieldConfig
24218
24458
  };
24219
24459
  }
24220
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
+ }
24221
24529
  const ADDITIONAL_INFORMATION_FORM_ID = "additionalInformation";
24222
- 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"];
24223
24531
  function AdditionalInformationComponent({
24224
24532
  data,
24225
24533
  labels: labels2,
@@ -24236,8 +24544,11 @@ function AdditionalInformationComponent({
24236
24544
  obscuredFields,
24237
24545
  optionalFields,
24238
24546
  readOnlyFields,
24547
+ trustedFields: trustedFields2,
24239
24548
  country: country2,
24240
- companyType: companyType2 = CompanyTypesValue.PRIVATE_COMPANY
24549
+ companyType: companyType2 = CompanyTypesValue.PRIVATE_COMPANY,
24550
+ verifiedBusiness,
24551
+ showCompanyStructure
24241
24552
  }) {
24242
24553
  var _a, _b, _c, _d;
24243
24554
  const {
@@ -24246,6 +24557,8 @@ function AdditionalInformationComponent({
24246
24557
  const {
24247
24558
  i18n
24248
24559
  } = useI18nContext();
24560
+ const showVerified = !!verifiedBusiness;
24561
+ const showStockData = companyType2 === CompanyTypesValue.PUBLIC_COMPANY;
24249
24562
  const initialFormUtilsProps = useMemo(() => ({
24250
24563
  data,
24251
24564
  labels: labels2,
@@ -24257,8 +24570,9 @@ function AdditionalInformationComponent({
24257
24570
  readOnlyFields,
24258
24571
  optionalFields,
24259
24572
  obscuredFields,
24573
+ trustedFields: trustedFields2,
24260
24574
  shouldValidate
24261
- }), [data, allFields, helperText, labels2, obscuredFields, optionalFields, placeholders, readOnly, readOnlyFields, requiredFields, shouldValidate]);
24575
+ }), [data, labels2, placeholders, helperText, readOnly, allFields, requiredFields, readOnlyFields, optionalFields, obscuredFields, trustedFields2, shouldValidate]);
24262
24576
  const registrationNumberOptions = useMemo(() => getCompanyRegistrationNumberOptions(country2, companyType2), [country2, companyType2]);
24263
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;
24264
24578
  const [registrationNumberType, setRegistrationNumberType] = useState(defaultRegistrationNumberType);
@@ -24267,6 +24581,19 @@ function AdditionalInformationComponent({
24267
24581
  const [taxIdNumberType, setTaxIdNumberType] = useState(defaultTaxIdNumberType);
24268
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;
24269
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]);
24270
24597
  const mergedFieldProps = useMemo(() => {
24271
24598
  var _a2;
24272
24599
  return (_a2 = initialFormUtilsProps.allFields) == null ? void 0 : _a2.reduce((acc, field) => {
@@ -24275,6 +24602,8 @@ function AdditionalInformationComponent({
24275
24602
  return mergeFieldMetadataIntoProps(field, resolveFieldMetadata(defaultFieldConfig$a[country2], {
24276
24603
  isBusiness: true
24277
24604
  }, defaultFieldMetadata$a), acc);
24605
+ case "hasDba":
24606
+ return mergeFieldMetadataIntoProps("hasDba", hasDbaFieldMetadata, acc);
24278
24607
  case "dbaName":
24279
24608
  return mergeFieldMetadataIntoProps("dbaName", dbaNameFieldMetadata, acc);
24280
24609
  case "registrationNumber":
@@ -24311,31 +24640,22 @@ function AdditionalInformationComponent({
24311
24640
  }
24312
24641
  }, initialFormUtilsProps);
24313
24642
  }, [companyType2, country2, initialFormUtilsProps, registrationNumberType, taxIdNumberType, vatNumberType]);
24314
- const getSchema = (currentData) => {
24315
- const fieldsToRemove = [];
24316
- if (currentData.exemptedFromVat) {
24317
- fieldsToRemove.push("vatNumber");
24318
- } else {
24319
- fieldsToRemove.push("vatAbsenceReason");
24320
- }
24321
- if (!currentData.hasDBA) {
24322
- fieldsToRemove.push("dbaName");
24323
- }
24324
- return (requiredFields == null ? void 0 : requiredFields.filter((field) => !fieldsToRemove.includes(field))) ?? [...LEGAL_COMPANY_NAME_FIELD, ...DBA_NAME_FIELD];
24325
- };
24326
24643
  const {
24327
24644
  schema: formSchema,
24328
24645
  data: formData,
24329
24646
  errors: formErrors,
24330
24647
  valid: formValid,
24331
24648
  fieldProblems: formFieldProblems,
24332
- handleChangeFor
24649
+ handleChangeFor,
24650
+ resetToDefaultData,
24651
+ setErrors
24333
24652
  } = useForm({
24334
- schema: getSchema,
24653
+ schema: getFormSchema2,
24335
24654
  defaultData: data,
24336
24655
  rules: mergedFieldProps == null ? void 0 : mergedFieldProps.validators,
24337
24656
  optionalFields: mergedFieldProps == null ? void 0 : mergedFieldProps.optionalFields,
24338
24657
  obscuredFields: mergedFieldProps == null ? void 0 : mergedFieldProps.obscuredFields,
24658
+ trustedFields: mergedFieldProps == null ? void 0 : mergedFieldProps.trustedFields,
24339
24659
  fieldProblems: fieldValidationErrors,
24340
24660
  shouldValidate
24341
24661
  });
@@ -24349,8 +24669,21 @@ function AdditionalInformationComponent({
24349
24669
  fieldProblems: formFieldProblems
24350
24670
  });
24351
24671
  }, [formSchema, formData, formErrors, formFieldProblems, formValid, updateStateSlice]);
24352
- const [showVerified, setShowVerified] = useState(false);
24353
- 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
+ });
24354
24687
  return jsxs("form", {
24355
24688
  children: [jsx(FormHeader, {
24356
24689
  heading,
@@ -24362,18 +24695,13 @@ function AdditionalInformationComponent({
24362
24695
  formUtils
24363
24696
  }), jsxs("div", {
24364
24697
  className: "adyen-kyc-additional-information",
24365
- children: [showVerified && jsxs("div", {
24366
- className: "adyen-kyc-additional-information__verified-information",
24367
- children: [jsx("h3", {
24368
- children: i18n.get("verifiedInformation")
24369
- }), jsx("div", {
24370
- className: "adyen-kyc-verified-information-card"
24371
- })]
24372
- }), jsxs("div", {
24373
- className: "adyen-kyc-additional-information__other-business-information",
24374
- children: [showVerified && jsx("h3", {
24698
+ children: [showVerified && jsx(VerifiedBusinessCard, {
24699
+ verifiedBusiness
24700
+ }), jsxs("section", {
24701
+ children: [showVerified && jsx(Typography, {
24702
+ el: "h3",
24375
24703
  children: i18n.get("otherBusinessInformation")
24376
- }), formUtils.isRequiredField("legalCompanyName") && jsx("div", {
24704
+ }), showField(LEGAL_COMPANY_NAME_FIELD) && jsx("div", {
24377
24705
  className: "adyen-kyc-field-wrapper",
24378
24706
  children: jsx(LegalCompanyNameField, {
24379
24707
  data: formUtils.getFieldData(formData, LEGAL_COMPANY_NAME_FIELD),
@@ -24386,19 +24714,20 @@ function AdditionalInformationComponent({
24386
24714
  readonly: formUtils.isReadOnly("legalCompanyName"),
24387
24715
  handleChangeFor
24388
24716
  })
24389
- }), formUtils.isRequiredField("dbaName") && jsx("div", {
24717
+ }), showField(DBA_NAME_FIELD) && jsx("div", {
24390
24718
  className: "adyen-kyc-field-wrapper",
24391
24719
  children: jsx(DBANameField, {
24392
24720
  data: formUtils.getFieldData(formData, DBA_NAME_FIELD),
24393
24721
  valid: formUtils.getFieldValid(formValid, DBA_NAME_FIELD),
24394
24722
  errors: formUtils.getFieldErrors(formErrors, formFieldProblems, DBA_NAME_FIELD),
24395
24723
  labels: formUtils.getFieldLabels(DBA_NAME_FIELD, {
24396
- hasDBA: "hasDba"
24724
+ hasDba: "hasDba"
24397
24725
  }),
24398
24726
  readonly: formUtils.isReadOnly("dbaName"),
24399
- handleChangeFor
24727
+ handleChangeFor,
24728
+ setErrors
24400
24729
  })
24401
- }), formUtils.isRequiredField("registrationNumber") && jsx("div", {
24730
+ }), showField(BUSINESS_REGISTRATION_NUMBER_FIELD) && jsx("div", {
24402
24731
  className: "adyen-kyc-field-wrapper",
24403
24732
  children: jsx(BusinessRegistrationNumberField, {
24404
24733
  data: formUtils.getFieldData(formData, BUSINESS_REGISTRATION_NUMBER_FIELD),
@@ -24422,7 +24751,7 @@ function AdditionalInformationComponent({
24422
24751
  registrationNumberType,
24423
24752
  setRegistrationNumberType
24424
24753
  })
24425
- }), formUtils.isRequiredField("taxInformation") && jsx("div", {
24754
+ }), showField(TAX_INFORMATION_FIELD) && jsx("div", {
24426
24755
  className: "adyen-kyc-field-wrapper",
24427
24756
  children: jsx(TaxInformationField, {
24428
24757
  data: formUtils.getFieldData(formData, TAX_INFORMATION_FIELD),
@@ -24445,7 +24774,7 @@ function AdditionalInformationComponent({
24445
24774
  setTaxIdNumberType,
24446
24775
  defaultData: data == null ? void 0 : data.taxInformation
24447
24776
  })
24448
- }), formUtils.isRequiredField("vatNumber") && jsx("div", {
24777
+ }), showField(VAT_NUMBER_FIELD) && jsx("div", {
24449
24778
  className: "adyen-kyc-field-wrapper",
24450
24779
  children: jsx(VatNumberField, {
24451
24780
  data: formUtils.getFieldData(formData, VAT_NUMBER_FIELD),
@@ -24464,7 +24793,7 @@ function AdditionalInformationComponent({
24464
24793
  vatNumberType,
24465
24794
  setVatNumberType
24466
24795
  })
24467
- }), formUtils.isRequiredField("dateOfIncorporation") && jsx("div", {
24796
+ }), showField(DATE_OF_INCORPORATION_FIELD) && jsx("div", {
24468
24797
  className: "adyen-kyc-field-wrapper",
24469
24798
  children: jsx(DateOfIncorporationField, {
24470
24799
  data: formUtils.getFieldData(formData, DATE_OF_INCORPORATION_FIELD),
@@ -24478,11 +24807,11 @@ function AdditionalInformationComponent({
24478
24807
  handleChangeFor
24479
24808
  })
24480
24809
  })]
24481
- }), showStockData && jsxs("div", {
24482
- className: "adyen-kyc-additional-information__stock-exchange-information",
24483
- children: [jsx("h3", {
24810
+ }), showStockData && jsxs("section", {
24811
+ children: [jsx(Typography, {
24812
+ el: "h3",
24484
24813
  children: i18n.get("stockExchangeInformation")
24485
- }), formUtils.isRequiredField("stockExchangeMIC") && jsx("div", {
24814
+ }), showField(STOCK_EXCHANGE_MIC_FIELD) && jsx("div", {
24486
24815
  className: "adyen-kyc-field-wrapper",
24487
24816
  children: jsx(StockExchangeMICField, {
24488
24817
  data: formUtils.getFieldData(formData, STOCK_EXCHANGE_MIC_FIELD),
@@ -24496,7 +24825,7 @@ function AdditionalInformationComponent({
24496
24825
  shouldValidate,
24497
24826
  handleChangeFor
24498
24827
  })
24499
- }), formUtils.isRequiredField("stockISIN") && jsx("div", {
24828
+ }), showField(STOCK_ISIN_FIELD) && jsx("div", {
24500
24829
  className: "adyen-kyc-field-wrapper",
24501
24830
  children: jsx(StockISINField, {
24502
24831
  data: formUtils.getFieldData(formData, STOCK_ISIN_FIELD),
@@ -24510,7 +24839,7 @@ function AdditionalInformationComponent({
24510
24839
  shouldValidate,
24511
24840
  handleChangeFor
24512
24841
  })
24513
- }), formUtils.isRequiredField("stockTickerSymbol") && jsx("div", {
24842
+ }), showField(STOCK_TICKER_SYMBOL_FIELD) && jsx("div", {
24514
24843
  className: "adyen-kyc-field-wrapper",
24515
24844
  children: jsx(StockTickerSymbolField, {
24516
24845
  data: formUtils.getFieldData(formData, STOCK_TICKER_SYMBOL_FIELD),
@@ -24620,9 +24949,11 @@ function BasicInformationComponent({
24620
24949
  obscuredFields,
24621
24950
  optionalFields,
24622
24951
  readOnlyFields,
24952
+ trustedFields: trustedFields2,
24623
24953
  country: country2,
24624
24954
  companyType: companyType2 = CompanyTypesValue.PRIVATE_COMPANY,
24625
- isTopLevelEntity
24955
+ isTopLevelEntity,
24956
+ isBusinessSelection
24626
24957
  }) {
24627
24958
  var _a, _b, _c, _d, _e;
24628
24959
  const {
@@ -24647,8 +24978,9 @@ function BasicInformationComponent({
24647
24978
  readOnlyFields,
24648
24979
  optionalFields,
24649
24980
  obscuredFields,
24981
+ trustedFields: trustedFields2,
24650
24982
  shouldValidate
24651
- }), [allFields, helperText, labels2, obscuredFields, optionalFields, placeholders, readOnly, readOnlyFields, requiredFields, shouldValidate]);
24983
+ }), [allFields, helperText, labels2, obscuredFields, optionalFields, placeholders, readOnly, readOnlyFields, requiredFields, trustedFields2, shouldValidate]);
24652
24984
  const registrationNumberOptions = useMemo(() => getCompanyRegistrationNumberOptions(country2, companyType2), [country2, companyType2]);
24653
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;
24654
24986
  const [registrationNumberType, setRegistrationNumberType] = useState(defaultRegistrationNumberType);
@@ -24701,6 +25033,7 @@ function BasicInformationComponent({
24701
25033
  rules: mergedFieldProps == null ? void 0 : mergedFieldProps.validators,
24702
25034
  optionalFields: mergedFieldProps == null ? void 0 : mergedFieldProps.optionalFields,
24703
25035
  obscuredFields: mergedFieldProps == null ? void 0 : mergedFieldProps.obscuredFields,
25036
+ trustedFields: mergedFieldProps == null ? void 0 : mergedFieldProps.trustedFields,
24704
25037
  fieldProblems: fieldValidationErrors,
24705
25038
  shouldValidate
24706
25039
  });
@@ -24715,6 +25048,7 @@ function BasicInformationComponent({
24715
25048
  });
24716
25049
  }, [formSchema, formData, formErrors, formFieldProblems, formValid, updateStateSlice]);
24717
25050
  return jsxs("form", {
25051
+ className: isBusinessSelection ? "adyen-kyc-hide-form" : void 0,
24718
25052
  children: [jsx(FormHeader, {
24719
25053
  heading,
24720
25054
  description: description2
@@ -24725,94 +25059,272 @@ function BasicInformationComponent({
24725
25059
  formUtils
24726
25060
  }), jsxs("div", {
24727
25061
  className: "adyen-kyc-basic-information",
24728
- children: [formUtils.isRequiredField("country") && jsx("div", {
24729
- className: "adyen-kyc-field-wrapper",
24730
- children: jsx(CountryField, {
24731
- data: formUtils.getFieldData(formData, COUNTRY_FIELD),
24732
- valid: formUtils.getFieldValid(formValid, COUNTRY_FIELD),
24733
- errors: formUtils.getFieldErrors(formErrors, formFieldProblems, COUNTRY_FIELD),
24734
- labels: formUtils.getFieldLabels(COUNTRY_FIELD, {
24735
- country: "countryRegionOfEstablishment"
24736
- }),
24737
- readonly: formUtils.isReadOnly("country") || !isAllowedEditPrefilledCountry,
24738
- handleChangeFor,
24739
- allowedCountries: isTopLevelEntity ? allowedCountries : void 0
24740
- })
24741
- }), formUtils.isRequiredField("businessName") && jsx("div", {
24742
- className: "adyen-kyc-field-wrapper",
24743
- children: jsx(BusinessNameField, {
24744
- data: formUtils.getFieldData(formData, BUSINESS_NAME_FIELD),
24745
- valid: formUtils.getFieldValid(formValid, BUSINESS_NAME_FIELD),
24746
- errors: formUtils.getFieldErrors(formErrors, formFieldProblems, BUSINESS_NAME_FIELD),
24747
- labels: formUtils.getFieldLabels(BUSINESS_NAME_FIELD),
24748
- readonly: formUtils.isReadOnly("businessName"),
24749
- handleChangeFor
24750
- })
24751
- }), formUtils.isRequiredField("taxInformation") && jsx("div", {
24752
- className: "adyen-kyc-field-wrapper",
24753
- children: jsx(TaxInformationField, {
24754
- data: formUtils.getFieldData(formData, TAX_INFORMATION_FIELD),
24755
- valid: formUtils.getFieldValid(formValid, TAX_INFORMATION_FIELD),
24756
- errors: formUtils.getFieldErrors(formErrors, formFieldProblems, TAX_INFORMATION_FIELD),
24757
- labels: formUtils.getFieldLabels(TAX_INFORMATION_FIELD, {
24758
- exemptedFromTax: "iDontHaveATaxId"
24759
- }),
24760
- mask: formUtils.getMask("taxInformation"),
24761
- helperText: formUtils.getFieldHelperText(TAX_INFORMATION_FIELD),
24762
- placeholders: formUtils.getFieldPlaceholders(TAX_INFORMATION_FIELD),
24763
- guidanceText: formUtils.getFieldGuidanceText(TAX_INFORMATION_FIELD),
24764
- readonly: formUtils.isReadOnly("taxInformation"),
24765
- shouldValidate,
24766
- handleChangeFor,
24767
- canExempt: formUtils.isRequiredField("exemptedFromTax"),
24768
- registrationNumber: formData.registrationNumber,
24769
- isUen: formUtils.isRequiredField("isUen"),
24770
- country: formData.country ?? country2,
24771
- companyType: companyType2,
24772
- taxIdNumberType,
24773
- setTaxIdNumberType,
24774
- defaultData: data == null ? void 0 : data.taxInformation
24775
- })
24776
- }), formUtils.isRequiredField("stateOrProvince") && jsx("div", {
24777
- className: "adyen-kyc-field-wrapper",
24778
- children: jsx(StateField, {
24779
- data: formUtils.getFieldData(formData, STATE_FIELD),
24780
- valid: formUtils.getFieldValid(formValid, STATE_FIELD),
24781
- errors: formUtils.getFieldErrors(formErrors, formFieldProblems, STATE_FIELD),
24782
- labels: formUtils.getFieldLabels(STATE_FIELD),
24783
- placeholders: formUtils.getFieldPlaceholders(STATE_FIELD),
24784
- readonly: formUtils.isReadOnly("stateOrProvince"),
24785
- handleChangeFor,
24786
- selectedCountry: formData.country
24787
- })
24788
- }), (formUtils.isRequiredField("registrationNumber") || formUtils.isOptionalField("registrationNumber")) && jsx("div", {
24789
- className: "adyen-kyc-field-wrapper",
24790
- children: jsx(BusinessRegistrationNumberField, {
24791
- data: formUtils.getFieldData(formData, BUSINESS_REGISTRATION_NUMBER_FIELD),
24792
- valid: formUtils.getFieldValid(formValid, BUSINESS_REGISTRATION_NUMBER_FIELD),
24793
- errors: formUtils.getFieldErrors(formErrors, formFieldProblems, BUSINESS_REGISTRATION_NUMBER_FIELD),
24794
- labels: formUtils.getFieldLabels(BUSINESS_REGISTRATION_NUMBER_FIELD, {
24795
- exemptedFromRegistrationNumber: "iDontHaveARegistrationNumber"
24796
- }),
24797
- mask: formUtils.getMask("registrationNumber"),
24798
- guidanceText: formUtils.getFieldGuidanceText(BUSINESS_REGISTRATION_NUMBER_FIELD),
24799
- placeholders: formUtils.getFieldPlaceholders(BUSINESS_REGISTRATION_NUMBER_FIELD),
24800
- helperText: formUtils.getFieldHelperText(BUSINESS_REGISTRATION_NUMBER_FIELD),
24801
- readonly: formUtils.isReadOnly("registrationNumber"),
24802
- optional: formUtils.isOptionalField("registrationNumber"),
24803
- shouldValidate,
24804
- handleChangeFor,
24805
- country: formData.country ?? country2,
24806
- canExempt: formUtils.isRequiredField("exemptedFromRegistrationNumber"),
24807
- companyType: companyType2,
24808
- registrationNumberOptions,
24809
- registrationNumberType,
24810
- 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
+ })
24811
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
+ })]
24812
25150
  })]
24813
25151
  })]
24814
25152
  });
24815
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
+ };
24816
25328
  const CompanyStructureValidation = {
24817
25329
  entityType: {
24818
25330
  modes: ["blur"],
@@ -24832,13 +25344,18 @@ function CompanyStructureComponent({
24832
25344
  fieldValidationErrors,
24833
25345
  requiredFields,
24834
25346
  country: country2,
25347
+ verifiedBusiness,
24835
25348
  kompanyVerifiedData,
25349
+ showCompanyStructure,
24836
25350
  ...props
24837
25351
  }) {
24838
25352
  var _a;
24839
25353
  const {
24840
25354
  i18n
24841
25355
  } = useI18nContext();
25356
+ const {
25357
+ isExperimentEnabled
25358
+ } = useExperimentsContext();
24842
25359
  const isNewEntryFlowEnabled = useEnableNewEntryFlow();
24843
25360
  const {
24844
25361
  updateStateSlice
@@ -24850,7 +25367,9 @@ function CompanyStructureComponent({
24850
25367
  valid: formValid,
24851
25368
  errors: formErrors,
24852
25369
  fieldProblems: formFieldProblems,
24853
- handleChangeFor
25370
+ handleChangeFor,
25371
+ setData,
25372
+ setValid
24854
25373
  } = useForm({
24855
25374
  schema,
24856
25375
  defaultData: data,
@@ -24873,6 +25392,20 @@ function CompanyStructureComponent({
24873
25392
  }
24874
25393
  prevVerifiedDataRef.current = kompanyVerifiedData;
24875
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]);
24876
25409
  useEffect(() => {
24877
25410
  updateStateSlice({
24878
25411
  schema: formSchema,
@@ -24938,7 +25471,6 @@ const getForms = (country2) => ({
24938
25471
  formId: "basicInformation",
24939
25472
  formName: "basicInformationFormName",
24940
25473
  formHeading: "basicInformationFormHeading",
24941
- formDescription: "basicInformationFormDescription",
24942
25474
  fields: COUNTRIES_USING_COMPANY_SEARCH.includes(country2) ? basicInformationFields : basicInformationFields.filter((field) => !FIELDS_NEEDED_FOR_COMPANY_SEARCH.includes(field))
24943
25475
  },
24944
25476
  companyStructure: {
@@ -24989,72 +25521,69 @@ const mapApiDocumentToBusinessDetailsDocuments = (entityId) => {
24989
25521
  } : void 0
24990
25522
  };
24991
25523
  };
24992
- const mapBasicInformation = (value) => {
24993
- if (!!value.country && COUNTRIES_USING_COMPANY_SEARCH.includes(value.country)) {
24994
- return value;
24995
- }
24996
- 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]) => {
24997
25527
  if (!FIELDS_NEEDED_FOR_COMPANY_SEARCH.includes(field)) {
24998
25528
  return {
24999
25529
  ...acc,
25000
- [field]: fieldValue
25530
+ [field]: data[field]
25001
25531
  };
25002
25532
  }
25003
25533
  return acc;
25004
25534
  }, {});
25005
- return nonCompanySearchFields;
25006
25535
  };
25007
- const mapAdditionalInformation = (value, legalEntity) => {
25008
- var _a;
25009
- const currentCountry = (_a = legalEntity.organization) == null ? void 0 : _a.registeredAddress.country;
25010
- if (!!currentCountry && COUNTRIES_USING_COMPANY_SEARCH.includes(currentCountry)) {
25011
- const companySearchFields = entriesOf(value).reduce((acc, [field, fieldValue]) => {
25012
- if (!FIELDS_NEEDED_FOR_COMPANY_SEARCH.includes(field)) {
25013
- return {
25014
- ...acc,
25015
- [field]: fieldValue
25016
- };
25017
- }
25018
- return acc;
25019
- }, {});
25020
- return {
25021
- ...companySearchFields,
25022
- hasDBA: !!companySearchFields.dbaName
25023
- };
25024
- }
25025
- return {
25026
- ...value,
25027
- hasDBA: !!value.dbaName
25028
- };
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
+ });
25029
25562
  };
25030
25563
  const mapLegalEntityToBusinessDetailsSchema = (legalEntity, isChangingType, accountHolder2) => {
25031
- const businessDetailsSchema = {
25032
- basicInformation: {},
25033
- companyStructure: {},
25034
- additionalInformation: {},
25035
- companyRegistrationAddress: {},
25036
- companyRegistrationDocument: {},
25037
- companyTaxDocument: {},
25038
- ...formatObject(legalEntity, businessDetailsComponentsKeyMapping)
25039
- };
25040
25564
  const {
25041
25565
  companyRegistrationDocument: companyRegistrationDocument2,
25042
25566
  companyTaxDocument
25043
25567
  } = mapApiDocumentToBusinessDetailsDocuments(legalEntity == null ? void 0 : legalEntity.id);
25044
- 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]) => {
25045
25574
  var _a;
25046
25575
  switch (key) {
25047
25576
  case "basicInformation": {
25048
25577
  return {
25049
25578
  ...componentData,
25050
- [key]: mapBasicInformation(value)
25579
+ [key]: mapBasicInformation(businessDetailsSchema[key])
25051
25580
  };
25052
25581
  }
25053
25582
  case "companyStructure": {
25054
25583
  return {
25055
25584
  ...componentData,
25056
25585
  [key]: {
25057
- ...value,
25586
+ ...businessDetailsSchema[key],
25058
25587
  accountHolder: getDefaultAccountHolderType(legalEntity, isChangingType, accountHolder2) ?? "theCompanyIWorkFor"
25059
25588
  }
25060
25589
  };
@@ -25062,14 +25591,14 @@ const mapLegalEntityToBusinessDetailsSchema = (legalEntity, isChangingType, acco
25062
25591
  case "additionalInformation": {
25063
25592
  return {
25064
25593
  ...componentData,
25065
- [key]: mapAdditionalInformation(value, legalEntity)
25594
+ [key]: mapAdditionalInformation(businessDetailsSchema[key], legalEntity)
25066
25595
  };
25067
25596
  }
25068
25597
  case "companyRegistrationAddress": {
25069
25598
  return {
25070
25599
  ...componentData,
25071
25600
  [key]: {
25072
- ...value,
25601
+ ...businessDetailsSchema[key],
25073
25602
  operationalAddressIsSame: ((_a = legalEntity.organization) == null ? void 0 : _a.principalPlaceOfBusiness) ? operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_NOT_SAME : operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_SAME
25074
25603
  }
25075
25604
  };
@@ -25077,17 +25606,13 @@ const mapLegalEntityToBusinessDetailsSchema = (legalEntity, isChangingType, acco
25077
25606
  case "companyRegistrationDocument": {
25078
25607
  return {
25079
25608
  ...componentData,
25080
- [key]: {
25081
- ...companyRegistrationDocument2
25082
- }
25609
+ [key]: businessDetailsSchema[key]
25083
25610
  };
25084
25611
  }
25085
25612
  case "companyTaxDocument": {
25086
25613
  return {
25087
25614
  ...componentData,
25088
- [key]: {
25089
- ...companyTaxDocument
25090
- }
25615
+ [key]: businessDetailsSchema[key]
25091
25616
  };
25092
25617
  }
25093
25618
  default:
@@ -25095,49 +25620,646 @@ const mapLegalEntityToBusinessDetailsSchema = (legalEntity, isChangingType, acco
25095
25620
  }
25096
25621
  }, {});
25097
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
+ }
25098
26164
  function BusinessDetailsComponent(props) {
25099
- var _a, _b, _c, _d, _e;
26165
+ var _a, _b;
25100
26166
  const {
25101
26167
  i18n
25102
26168
  } = useI18nContext();
26169
+ const {
26170
+ basicInformation: basicInformation2,
26171
+ companyStructure: companyStructure2
26172
+ } = useGlobalData();
25103
26173
  const {
25104
26174
  country: country2,
25105
26175
  isTopLevelEntity,
25106
26176
  activeForm,
25107
26177
  problems,
25108
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,
25109
26192
  handleAddressSearch,
25110
26193
  handleFindAddress,
25111
- handleCompanyIndexSearch,
25112
26194
  handleCompanyDeepSearch,
25113
26195
  handleGetCompanyDataset,
25114
26196
  handleRefreshCompanyDataset,
25115
26197
  handleVerifyTin,
25116
26198
  onTypeSwitch
25117
26199
  } = props;
25118
- const globalData = useGlobalData();
25119
26200
  const forms2 = getForms(country2);
25120
26201
  const formWrapperClasses = (formId) => (activeForm == null ? void 0 : activeForm.formId) !== formId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper";
25121
- 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
+ });
25122
26229
  return jsxs("div", {
25123
- className: "adyen-kyc-business-details",
25124
- children: [jsx("div", {
26230
+ className: classNames,
26231
+ children: [jsxs("div", {
25125
26232
  className: formWrapperClasses(forms2.basicInformation.formId),
25126
- 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, {
25127
26253
  ...getFormProps(props, forms2.basicInformation.formId),
25128
26254
  id: forms2.basicInformation.formId,
25129
26255
  heading: i18n.get((activeForm == null ? void 0 : activeForm.formHeading) ?? forms2.basicInformation.formHeading),
25130
- 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,
25131
26257
  country: country2,
25132
- companyType: (_b = globalData == null ? void 0 : globalData.companyStructure) == null ? void 0 : _b.entityType,
26258
+ companyType: companyStructure2 == null ? void 0 : companyStructure2.entityType,
25133
26259
  isTopLevelEntity,
25134
26260
  baseTrackingPayload,
25135
- handleCompanyIndexSearch,
25136
- handleCompanyDeepSearch,
25137
- handleGetCompanyDataset,
25138
- handleRefreshCompanyDataset,
25139
- handleVerifyTin
25140
- })
26261
+ isBusinessSelection
26262
+ })]
25141
26263
  }), jsx("div", {
25142
26264
  className: formWrapperClasses(forms2.companyStructure.formId),
25143
26265
  children: jsx(CompanyStructureComponent, {
@@ -25145,7 +26267,9 @@ function BusinessDetailsComponent(props) {
25145
26267
  id: forms2.companyStructure.formId,
25146
26268
  heading: i18n.get((activeForm == null ? void 0 : activeForm.formHeading) ?? forms2.companyStructure.formHeading),
25147
26269
  description: i18n.get((activeForm == null ? void 0 : activeForm.formDescription) ?? forms2.companyStructure.formDescription),
25148
- country: country2
26270
+ country: country2,
26271
+ verifiedBusiness,
26272
+ showCompanyStructure
25149
26273
  })
25150
26274
  }), jsx("div", {
25151
26275
  className: formWrapperClasses(forms2.additionalInformation.formId),
@@ -25155,7 +26279,9 @@ function BusinessDetailsComponent(props) {
25155
26279
  heading: i18n.get((activeForm == null ? void 0 : activeForm.formHeading) ?? forms2.additionalInformation.formHeading),
25156
26280
  description: i18n.get((activeForm == null ? void 0 : activeForm.formDescription) ?? forms2.additionalInformation.formDescription),
25157
26281
  country: country2,
25158
- 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
25159
26285
  })
25160
26286
  }), jsx("div", {
25161
26287
  className: formWrapperClasses(forms2.companyRegistrationAddress.formId),
@@ -25169,8 +26295,8 @@ function BusinessDetailsComponent(props) {
25169
26295
  country: country2,
25170
26296
  problems,
25171
26297
  handleAddressSearch,
25172
- handleFindAddress
25173
- // kompanyAddress={kompanyAddress}
26298
+ handleFindAddress,
26299
+ verifiedBusiness
25174
26300
  })
25175
26301
  }), jsx("div", {
25176
26302
  className: formWrapperClasses(forms2.companyRegistrationDocument.formId),
@@ -25180,7 +26306,7 @@ function BusinessDetailsComponent(props) {
25180
26306
  heading: forms2.companyRegistrationDocument.formHeading,
25181
26307
  description: forms2.companyRegistrationDocument.formDescription,
25182
26308
  country: country2,
25183
- companyType: (_d = globalData.companyStructure) == null ? void 0 : _d.entityType
26309
+ companyType: companyStructure2 == null ? void 0 : companyStructure2.entityType
25184
26310
  })
25185
26311
  }), jsx("div", {
25186
26312
  className: formWrapperClasses(forms2.companyTaxDocument.formId),
@@ -25190,7 +26316,7 @@ function BusinessDetailsComponent(props) {
25190
26316
  heading: forms2.companyTaxDocument.formHeading,
25191
26317
  description: forms2.companyTaxDocument.formDescription,
25192
26318
  country: country2,
25193
- companyType: (_e = globalData.companyStructure) == null ? void 0 : _e.entityType
26319
+ companyType: companyStructure2 == null ? void 0 : companyStructure2.entityType
25194
26320
  }) : jsx(DocumentUpload, {
25195
26321
  ...getFormProps(props, forms2.companyTaxDocument.formId),
25196
26322
  id: forms2.companyTaxDocument.formId,
@@ -25392,7 +26518,7 @@ const ExpiredBanner = () => {
25392
26518
  i18n
25393
26519
  } = useI18nContext();
25394
26520
  return jsx(Alert, {
25395
- type: AlertTypes.WARNING,
26521
+ type: "warning",
25396
26522
  title: i18n.get("thisPageIsNowInactive"),
25397
26523
  hasCloseButton: false,
25398
26524
  children: i18n.get("startANewSessionFromTheSamePlaceYouOriginallyAccessed")
@@ -25724,7 +26850,7 @@ const FormNavigationItem = ({
25724
26850
  children: [i18n.get(form.formName), form.hasServerValidationErrors && jsx("span", {
25725
26851
  className: "adyen-kyc-form-navigation__item-icon adyen-kyc-form-navigation__item-icon--error",
25726
26852
  children: jsx(AlertIcon, {
25727
- type: AlertTypes.WARNING
26853
+ type: "warning"
25728
26854
  })
25729
26855
  }), form.isValid && !hasError && jsx("span", {
25730
26856
  className: "adyen-kyc-form-navigation__item-icon adyen-kyc-form-navigation__item-icon--success",
@@ -25801,6 +26927,7 @@ const FormWrapper = ({
25801
26927
  handleBackClick,
25802
26928
  handleHomeClick,
25803
26929
  nextButtonLabel,
26930
+ backButtonLabel,
25804
26931
  homeButtonLabel,
25805
26932
  loadingStatus,
25806
26933
  gotoFormByFormIndex,
@@ -25813,6 +26940,7 @@ const FormWrapper = ({
25813
26940
  hideFooter,
25814
26941
  hideHomeButton,
25815
26942
  hideBackButton,
26943
+ hideNextButton,
25816
26944
  hideNavigation,
25817
26945
  canSubmit: canSubmit2,
25818
26946
  onSubmit,
@@ -25841,7 +26969,7 @@ const FormWrapper = ({
25841
26969
  isExperimentEnabled
25842
26970
  } = useExperimentsContext();
25843
26971
  const showExtraTaxExemptionReasons = isExperimentEnabled(ExperimentNames.ShowExtraTaxExemptionReasons);
25844
- 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);
25845
26973
  const summaryContent = jsx("div", {
25846
26974
  className: "adyen-kyc-form-wrapper",
25847
26975
  children: jsx(Summary, {
@@ -25865,11 +26993,12 @@ const FormWrapper = ({
25865
26993
  onNext: handleNextClick,
25866
26994
  onBack: handleBackClick,
25867
26995
  onHome: onHomeClick,
25868
- backButtonLabel: i18n.get("back"),
26996
+ backButtonLabel: backButtonLabel ?? i18n.get("back"),
25869
26997
  nextButtonLabel,
25870
26998
  homeButtonLabel,
25871
26999
  hideOnHomeButton: hideHomeButton,
25872
- hideBackButton
27000
+ hideBackButton,
27001
+ hideNextButton
25873
27002
  });
25874
27003
  const multiStepForm = jsxs("div", {
25875
27004
  className: "adyen-kyc-form-container",
@@ -25992,22 +27121,27 @@ const mapBusinessDetailsDocumentToApiDocument = async (data, entityId) => {
25992
27121
  return documents2.filter(Boolean);
25993
27122
  };
25994
27123
  const mapBusinessDetailsSchemaToLegalEntity = (data) => {
25995
- 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;
25996
27125
  const requestObj = {
25997
27126
  ...formatObject(data, businessDetailsApiKeyMapping)
25998
27127
  };
25999
- const taxData = ((_a = data.basicInformation) == null ? void 0 : _a.taxInformation) || ((_b = data.additionalInformation) == null ? void 0 : _b.taxInformation);
26000
- 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);
26001
27132
  if (requestObj.organization) {
26002
27133
  if (taxData) {
26003
- 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;
26004
27135
  }
26005
27136
  if (registrationNumber2) {
26006
- 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;
26007
27138
  }
26008
- if ((_k = data.additionalInformation) == null ? void 0 : _k.vatAbsenceReason) {
27139
+ if ((_n = data.additionalInformation) == null ? void 0 : _n.vatAbsenceReason) {
26009
27140
  requestObj.organization.vatNumber = "";
26010
27141
  }
27142
+ if (dbaName2) {
27143
+ requestObj.organization.doingBusinessAs = dbaName2;
27144
+ }
26011
27145
  }
26012
27146
  requestObj.type = LegalEntityType.ORGANIZATION;
26013
27147
  return requestObj;
@@ -26023,7 +27157,7 @@ const canSubmit$3 = (data) => MANDATORY_API_FIELDS.every((detail) => {
26023
27157
  });
26024
27158
  const isDocumentsRequired$3 = (forms2) => forms2.some((form) => documentFormsIds.includes(form.formId));
26025
27159
  const formatBasicInformation = (data, labels2, datasetUtils, companyType2) => {
26026
- var _a, _b, _c, _d, _e;
27160
+ var _a, _b, _c, _d;
26027
27161
  const country2 = data == null ? void 0 : data.country;
26028
27162
  const registrationNumberLabel = resolveFieldMetadata(defaultFieldConfig$9[country2], {
26029
27163
  companyType: companyType2,
@@ -26035,10 +27169,9 @@ const formatBasicInformation = (data, labels2, datasetUtils, companyType2) => {
26035
27169
  companyType: void 0
26036
27170
  }, defaultFieldMetadata$1).label;
26037
27171
  return {
26038
- [((_b = labels2 == null ? void 0 : labels2.basicInformation) == null ? void 0 : _b.businessName) ?? "businessName"]: data.businessName,
26039
- [((_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),
26040
27173
  [getKeyForField("stateOrProvince", data.country)]: datasetUtils.getStateName(data.stateOrProvince, data.country),
26041
- [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,
26042
27175
  [registrationNumberLabel]: data.registrationNumber
26043
27176
  };
26044
27177
  };
@@ -26054,16 +27187,16 @@ const formatAdditionalInformation = (data, labels2, country2, companyType2) => {
26054
27187
  companyType: void 0
26055
27188
  }, defaultFieldMetadata$1).label;
26056
27189
  return {
26057
- [((_b = labels2.additionalInformation) == null ? void 0 : _b.legalCompanyName) ?? "legalCompanyName"]: data.legalCompanyName,
26058
- [((_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,
26059
27192
  [registrationNumberLabel]: data.registrationNumber,
26060
27193
  [taxIdLabel]: (_e = (_d = data.taxInformation) == null ? void 0 : _d.find((taxId2) => country2 === taxId2.country)) == null ? void 0 : _e.number,
26061
- [((_f = labels2.additionalInformation) == null ? void 0 : _f.vatNumber) ?? "vatNumber"]: data.vatNumber,
26062
- [((_g = labels2.additionalInformation) == null ? void 0 : _g.vatAbsenceReason) ?? "vatAbsenceReason"]: data.vatAbsenceReason,
26063
- [((_h = labels2.additionalInformation) == null ? void 0 : _h.dateOfIncorporation) ?? "dateOfIncorporation"]: data.dateOfIncorporation,
26064
- [((_i = labels2.additionalInformation) == null ? void 0 : _i.stockExchangeMIC) ?? "stockExchangeMIC"]: data.stockExchangeMIC,
26065
- [((_j = labels2.additionalInformation) == null ? void 0 : _j.stockISIN) ?? "stockISIN"]: data.stockISIN,
26066
- [((_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
26067
27200
  };
26068
27201
  };
26069
27202
  const formatDataForSummary$1 = (data, forms2, labels2, i18n) => {
@@ -26294,7 +27427,17 @@ function BusinessDetailsDropinComponent({
26294
27427
  useEffect(() => {
26295
27428
  onChange == null ? void 0 : onChange(currentState);
26296
27429
  }, [currentState, onChange]);
26297
- 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
+ }, []);
26298
27441
  const formRef = useRef(null);
26299
27442
  const {
26300
27443
  showToast,
@@ -26314,9 +27457,33 @@ function BusinessDetailsDropinComponent({
26314
27457
  var _a2;
26315
27458
  return ((_a2 = currentState.data.basicInformation) == null ? void 0 : _a2.country) ?? country2;
26316
27459
  }, [(_a = currentState.data.basicInformation) == null ? void 0 : _a.country, country2]);
26317
- const [loadingStatus, setLoadingStatus] = useState("success");
26318
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");
26319
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]);
26320
27487
  const getConfigurationData = useCallback(() => getConfiguration2({
26321
27488
  legalEntityType: LegalEntityType.ORGANIZATION,
26322
27489
  capabilities: capabilities ?? getCapabilities(legalEntityResponse),
@@ -26337,19 +27504,21 @@ function BusinessDetailsDropinComponent({
26337
27504
  isExperimentEnabled
26338
27505
  }), [currentCountry, currentState.data, isExperimentEnabled, taskType]);
26339
27506
  const initialForms = useMemo(() => getForms(currentCountry), [currentCountry]);
26340
- 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]);
26341
27508
  const isSkippingCompanyStructure = useEnableNewEntryFlow() && organizationTypesToSkipCompanyStructureForm.includes((_d = legalEntityResponse == null ? void 0 : legalEntityResponse.organization) == null ? void 0 : _d.type) && accountHolder2 !== "aTrust";
26342
27509
  const forms2 = useMemo(() => {
26343
27510
  const requiredForms = getRequiredForms(initialForms, derivedProps == null ? void 0 : derivedProps.requiredFields, derivedProps == null ? void 0 : derivedProps.optionalFields);
26344
- return addValidityToForms(requiredForms, currentState.validityByForm, problems).filter((form) => isSkippingCompanyStructure ? form.formId !== "companyStructure" : true);
26345
- }, [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]);
26346
27521
  const canSubmitForm = useMemo(() => canSubmit$3(currentState.data) && hasDataChanged(initialData, currentState.data), [initialData, currentState.data]);
26347
- const baseTrackingPayload = useMemo(() => getBaseTrackingPayload({
26348
- trackingConfig,
26349
- parentLegalEntity,
26350
- legalEntity: legalEntityResponse,
26351
- task: taskType
26352
- }), [legalEntityResponse, parentLegalEntity, taskType, trackingConfig]);
26353
27522
  const summaryData = useMemo(() => ({
26354
27523
  data: formatDataForSummary$1(currentState.data, forms2, derivedProps == null ? void 0 : derivedProps.labels, i18n),
26355
27524
  omittedKeys: ["operationalAddressIsSame"]
@@ -26387,32 +27556,78 @@ function BusinessDetailsDropinComponent({
26387
27556
  formRef,
26388
27557
  onSubmit: submitTask
26389
27558
  });
26390
- useEffect(() => {
26391
- var _a2;
26392
- const documentIds = ((_a2 = legalEntityResponse == null ? void 0 : legalEntityResponse.documentDetails) == null ? void 0 : _a2.map((documentReference) => documentReference.id)) || [];
26393
- if (!documentIds.length) return;
26394
- documentUtils.fetchDocuments(documentIds, legalEntityResponse.id).then(() => {
26395
- setInitialData({
26396
- ...initialData,
26397
- ...mapApiDocumentToBusinessDetailsDocuments(legalEntityResponse.id)
26398
- });
26399
- }).catch(() => showToast({
26400
- label: i18n.get("failedToFetchRelevantDocuments"),
26401
- type: "error"
26402
- }));
26403
- }, []);
26404
- useEffect(() => {
26405
- userEvents.addPageView("Business details dropin");
26406
- userEvents.addEvent(BusinessDetailsEvents.TASK_START, {
26407
- segmentation: baseTrackingPayload
26408
- });
26409
- }, [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]);
26410
27624
  return jsx(FormWrapper, {
26411
27625
  taskName: taskName ?? "businessDetails",
26412
- gotoFormByFormIndex,
27626
+ gotoFormByFormIndex: goToForm,
26413
27627
  hideDropinLayout,
26414
- hideHomeButton,
26415
- hideBackButton,
27628
+ hideHomeButton: hideHome,
27629
+ hideBackButton: hideBack,
27630
+ hideNextButton: showBusinessSelection,
26416
27631
  loadingStatus,
26417
27632
  forms: forms2,
26418
27633
  activeForm,
@@ -26424,8 +27639,9 @@ function BusinessDetailsDropinComponent({
26424
27639
  summary: summaryData,
26425
27640
  homeButtonLabel,
26426
27641
  nextButtonLabel,
26427
- handleNextClick,
26428
- handleBackClick,
27642
+ backButtonLabel: i18n.get("goBack"),
27643
+ handleNextClick: nextClick,
27644
+ handleBackClick: backClick,
26429
27645
  handleHomeClick,
26430
27646
  children: jsx(BusinessDetailsComponent, {
26431
27647
  ...derivedProps,
@@ -26438,6 +27654,19 @@ function BusinessDetailsDropinComponent({
26438
27654
  isTopLevelEntity: taskType === TaskTypes.BUSINESS_DETAILS,
26439
27655
  onTypeSwitch,
26440
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,
26441
27670
  handleAddressSearch,
26442
27671
  handleFindAddress,
26443
27672
  handleCompanyIndexSearch,
@@ -26874,247 +28103,6 @@ function CompanyDropinComponent({
26874
28103
  })
26875
28104
  });
26876
28105
  }
26877
- var CompanySearchEvents = /* @__PURE__ */ ((CompanySearchEvents2) => {
26878
- CompanySearchEvents2["TASK_START"] = "CompanySearch_TaskStarted";
26879
- CompanySearchEvents2["TASK_SUBMIT"] = "CompanySearch_TaskSubmitted";
26880
- CompanySearchEvents2["TASK_SAVED"] = "CompanySearch_TaskSaved";
26881
- CompanySearchEvents2["TASK_ERROR"] = "CompanySearch_TaskError";
26882
- CompanySearchEvents2["DOCUMENTS_SAVED"] = "CompanySearch_DocumentsSaved";
26883
- CompanySearchEvents2["DOCUMENTS_ERROR"] = "CompanySearch_DocumentsError";
26884
- CompanySearchEvents2["NO_SEARCH_RESULTS"] = "CompanySearch_NoSearchResults";
26885
- CompanySearchEvents2["TIN_MATCH"] = "CompanySearch_TinMatch";
26886
- CompanySearchEvents2["TIN_NO_MATCH"] = "CompanySearch_TinNoMatch";
26887
- CompanySearchEvents2["SELECTION_RESET"] = "CompanySearch_CompanySelectionReset";
26888
- CompanySearchEvents2["SELECTION_ERROR"] = "CompanySearch_CompanySelectionError";
26889
- return CompanySearchEvents2;
26890
- })(CompanySearchEvents || {});
26891
- const logger$h = createLogger("useCompanySearch");
26892
- const LOW_RISK_COMPANY_DATA_COMPLIANCE_WINDOW = 1577664e5;
26893
- function useCompanySearch({
26894
- defaultData,
26895
- legalCompanyName: legalCompanyName2,
26896
- country: country2,
26897
- stateOrProvince: stateOrProvince2,
26898
- taxIdentificationNumber: taxIdentificationNumber2,
26899
- canVerify,
26900
- limit = 15,
26901
- baseTrackingPayload,
26902
- setKompanyAddress,
26903
- handleChangeFor,
26904
- handleCompanyIndexSearch,
26905
- handleCompanyDeepSearch,
26906
- handleGetCompanyDataset,
26907
- handleRefreshCompanyDataset,
26908
- handleVerifyTin
26909
- }) {
26910
- const [companiesList, setCompaniesList] = useState([]);
26911
- const [selectedCompanyId, setSelectedCompanyId] = useState();
26912
- const [verifiedCompany, setVerifiedCompany] = useState();
26913
- const [status, setStatus] = useState("idle");
26914
- const [error, setError] = useState();
26915
- const isLastUpdateDateCompliant = (company2) => {
26916
- const date = (/* @__PURE__ */ new Date()).toDateString();
26917
- return company2.lastUpdate ? Date.parse(date) - Date.parse(company2.lastUpdate) < LOW_RISK_COMPANY_DATA_COMPLIANCE_WINDOW : false;
26918
- };
26919
- const searchCompanies = useMemo(() => debounce(async ({
26920
- companyName: companyName2,
26921
- companyCountry,
26922
- companyState,
26923
- resultsLimit,
26924
- deepSearch
26925
- }) => {
26926
- try {
26927
- if (!deepSearch) return;
26928
- setStatus("loading");
26929
- setCompaniesList([]);
26930
- const {
26931
- results: deepSearchResults
26932
- } = await deepSearch({
26933
- text: companyName2,
26934
- country: companyCountry,
26935
- state: companyState,
26936
- limit: resultsLimit
26937
- });
26938
- return setCompaniesList(deepSearchResults);
26939
- } catch (e) {
26940
- setStatus("error");
26941
- setError(e);
26942
- } finally {
26943
- setStatus((prevStatus) => prevStatus !== "error" ? "loaded" : prevStatus);
26944
- }
26945
- }, 700), []);
26946
- const retrySearch = useCallback(async () => {
26947
- if (!legalCompanyName2 || !country2 || !stateOrProvince2) {
26948
- return setStatus("idle");
26949
- }
26950
- try {
26951
- if (!handleCompanyDeepSearch) return;
26952
- setStatus("loading");
26953
- setSelectedCompanyId(void 0);
26954
- const {
26955
- results: deepSearchResults
26956
- } = await handleCompanyDeepSearch({
26957
- text: legalCompanyName2,
26958
- country: country2,
26959
- state: stateOrProvince2,
26960
- limit
26961
- });
26962
- return setCompaniesList(deepSearchResults);
26963
- } catch (e) {
26964
- setStatus("error");
26965
- setError(e);
26966
- } finally {
26967
- setStatus((prevStatus) => prevStatus !== "error" ? "loaded" : prevStatus);
26968
- }
26969
- }, [handleCompanyDeepSearch, country2, legalCompanyName2, limit, stateOrProvince2]);
26970
- const verify2 = useCallback(async (companyTIN, company2) => {
26971
- try {
26972
- if (!handleVerifyTin || !handleGetCompanyDataset || !handleRefreshCompanyDataset) return;
26973
- setStatus("loading");
26974
- setSelectedCompanyId(company2.id);
26975
- if (!canVerify || !companyTIN) {
26976
- return setStatus("error");
26977
- }
26978
- const {
26979
- matched
26980
- } = await handleVerifyTin({
26981
- tin: companyTIN,
26982
- name: company2.name
26983
- });
26984
- if (!matched) {
26985
- setStatus("error");
26986
- userEvents.addEvent(CompanySearchEvents.TIN_NO_MATCH, {
26987
- segmentation: {
26988
- ...baseTrackingPayload
26989
- }
26990
- });
26991
- return setError({
26992
- message: "TIN does not match the selected company",
26993
- response: {
26994
- status: 200
26995
- }
26996
- });
26997
- }
26998
- userEvents.addEvent(CompanySearchEvents.TIN_MATCH, {
26999
- segmentation: {
27000
- ...baseTrackingPayload
27001
- }
27002
- });
27003
- const companyData = isLastUpdateDateCompliant(company2) ? await handleGetCompanyDataset({
27004
- companyId: company2.id,
27005
- country: country2
27006
- }) : await handleRefreshCompanyDataset({
27007
- companyId: company2.id,
27008
- country: country2
27009
- });
27010
- return setVerifiedCompany({
27011
- ...companyData,
27012
- state: companyData.state ?? stateOrProvince2
27013
- });
27014
- } catch (e) {
27015
- logger$h.error(e);
27016
- setError(e);
27017
- setStatus("error");
27018
- } finally {
27019
- setStatus((prevStatus) => prevStatus !== "error" ? "loaded" : prevStatus);
27020
- }
27021
- }, [handleVerifyTin, handleGetCompanyDataset, handleRefreshCompanyDataset, canVerify, country2, stateOrProvince2, baseTrackingPayload]);
27022
- const reset = useCallback(() => {
27023
- setStatus("loading");
27024
- setSelectedCompanyId(void 0);
27025
- setVerifiedCompany(void 0);
27026
- setKompanyAddress(void 0);
27027
- setCompaniesList([]);
27028
- if (defaultData) {
27029
- handleChangeFor("legalCompanyName")(defaultData.legalCompanyName);
27030
- }
27031
- }, [defaultData, handleChangeFor, setKompanyAddress]);
27032
- useEffect(() => {
27033
- var _a;
27034
- setError(void 0);
27035
- const isMinLength = legalCompanyName2 && legalCompanyName2.split("").length > 3;
27036
- if (!legalCompanyName2 || !country2 || !stateOrProvince2 || !taxIdentificationNumber2 || !canVerify || !isMinLength) {
27037
- return setStatus("idle");
27038
- }
27039
- if (!verifiedCompany) {
27040
- setSelectedCompanyId(void 0);
27041
- (_a = searchCompanies({
27042
- companyName: legalCompanyName2,
27043
- companyCountry: country2,
27044
- companyState: stateOrProvince2,
27045
- indexSearch: handleCompanyIndexSearch,
27046
- deepSearch: handleCompanyDeepSearch,
27047
- resultsLimit: limit
27048
- })) == null ? void 0 : _a.catch((e) => logger$h.error(e));
27049
- }
27050
- }, [legalCompanyName2, country2, stateOrProvince2, taxIdentificationNumber2, verifiedCompany, searchCompanies, handleCompanyIndexSearch, handleCompanyDeepSearch, limit, canVerify, baseTrackingPayload]);
27051
- useEffect(() => {
27052
- setVerifiedCompany(void 0);
27053
- setSelectedCompanyId(void 0);
27054
- }, [taxIdentificationNumber2]);
27055
- useEffect(() => {
27056
- if (status !== "error") {
27057
- return setError(void 0);
27058
- }
27059
- }, [status]);
27060
- return {
27061
- results: companiesList,
27062
- selectedCompanyId,
27063
- verifiedCompany,
27064
- status,
27065
- error,
27066
- retrySearch,
27067
- verify: verify2,
27068
- reset
27069
- };
27070
- }
27071
- const mapOrganizationTypeToCompanyType = (organizationType) => {
27072
- switch (organizationType) {
27073
- case "BUSINESS":
27074
- return CompanyTypesValue.PRIVATE_COMPANY;
27075
- case "NON_PROFIT":
27076
- return CompanyTypesValue.NON_PROFIT_OR_CHARITABLE;
27077
- case "PUBLIC_COMPANY":
27078
- case "LISTED_PUBLIC_COMPANY":
27079
- return CompanyTypesValue.PUBLIC_COMPANY;
27080
- case "UNLISTED_PUBLIC_COMPANY":
27081
- return CompanyTypesValue.UNLISTED_PUBLIC_COMPANY;
27082
- case "GOVERNMENTAL_ORGANIZATION":
27083
- return CompanyTypesValue.GOVERNMENTAL_ORGANIZATION;
27084
- case "SOLE_PROPRIETOR":
27085
- return CompanyTypesValue.SOLE_PROPRIETORSHIP;
27086
- case "PARTNERSHIP_INCORPORATED":
27087
- return CompanyTypesValue.INCORPORATED_PARTNERSHIP;
27088
- case "ASSOCIATION_INCORPORATED":
27089
- return CompanyTypesValue.INCORPORATED_ASSOCIATION;
27090
- case "OTHER":
27091
- case "PARTNERSHIP":
27092
- default:
27093
- return void 0;
27094
- }
27095
- };
27096
- const mapCompanyDataResponseToFormSchema = (company2) => ({
27097
- companyBasics: {
27098
- country: company2.country,
27099
- stateOrProvince: company2.state,
27100
- legalCompanyName: company2.name
27101
- },
27102
- companyRegistrationAddress: {
27103
- registrationAddress: {
27104
- address: company2.street,
27105
- stateOrProvince: company2.state,
27106
- country: company2.country,
27107
- postalCode: company2.zipcode,
27108
- city: company2.city
27109
- }
27110
- },
27111
- companyStructure: {
27112
- entityType: mapOrganizationTypeToCompanyType(company2.organizationType)
27113
- },
27114
- companyOtherDetails: {
27115
- registrationNumber: company2.registrationNumber
27116
- }
27117
- });
27118
28106
  const CompanyLookupResultsHeader = ({
27119
28107
  results,
27120
28108
  status,
@@ -27189,9 +28177,9 @@ const LookupResultAlert = ({
27189
28177
  i18n
27190
28178
  } = useI18nContext();
27191
28179
  const iconType = {
27192
- verified: AlertTypes.SUCCESS,
27193
- warning: AlertTypes.WARNING,
27194
- error: AlertTypes.ERROR
28180
+ verified: "success",
28181
+ warning: "warning",
28182
+ error: "error"
27195
28183
  };
27196
28184
  return jsxs("div", {
27197
28185
  className: `adyen-company-lookup-result__alert adyen-company-lookup-result__alert--${type}`,
@@ -28150,133 +29138,7 @@ const formatDataForSummary = (data, forms2, labels2, i18n) => {
28150
29138
  }
28151
29139
  }, {});
28152
29140
  };
28153
- const mapCompanySearchDocumentToApiDocument = async (data, entityId) => {
28154
- var _a, _b, _c;
28155
- const {
28156
- companyRegistrationDocument: companyRegistrationDocument2,
28157
- companyTaxDocument
28158
- } = data;
28159
- const entityType2 = "legalEntity";
28160
- 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;
28161
- const documents2 = await Promise.all([
28162
- createDocumentRequest({
28163
- entityId,
28164
- entityType: entityType2,
28165
- documentType: DocumentType.REGISTRATION_DOCUMENT,
28166
- page1: (_b = companyRegistrationDocument2 == null ? void 0 : companyRegistrationDocument2.registrationDocument) == null ? void 0 : _b[0]
28167
- }),
28168
- createDocumentRequest({
28169
- entityId,
28170
- entityType: entityType2,
28171
- documentType: taxDocumentType,
28172
- page1: (_c = companyTaxDocument == null ? void 0 : companyTaxDocument.taxDocument) == null ? void 0 : _c[0]
28173
- })
28174
- // Add this when we need shareholder document functionality
28175
- // createDocumentRequest(legalEntityId, 'legalEntity', DocumentType.SHAREHOLDER_DOCUMENT, shareholderDocument?.[0])
28176
- ]);
28177
- return documents2.filter(Boolean);
28178
- };
28179
- const mapCompanySearchSchemaToLegalEntity = (data) => {
28180
- var _a, _b, _c, _d, _e;
28181
- const requestObj = {
28182
- ...formatObject(data, companySearchApiKeyMapping)
28183
- };
28184
- if (requestObj.organization) {
28185
- if (((_a = data.companyBasics) == null ? void 0 : _a.taxInformation) || ((_b = data.companyOtherDetails) == null ? void 0 : _b.taxInformation)) {
28186
- 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;
28187
- }
28188
- if (requestObj.organization.vatAbsenceReason) {
28189
- requestObj.organization.vatNumber = "";
28190
- }
28191
- }
28192
- requestObj.type = LegalEntityType.ORGANIZATION;
28193
- return requestObj;
28194
- };
28195
- const mapApiDocumentToCompanySearchDocuments = (entityId) => {
28196
- const registrationDocument2 = getDocument$1(entityId, DocumentType.REGISTRATION_DOCUMENT) ?? null;
28197
- const taxDocument2 = getDocument$1(entityId, DocumentType.VAT_DOCUMENT) ?? getDocument$1(entityId, DocumentType.PROOF_OF_ORGANIZATION_TAX_INFO) ?? null;
28198
- return {
28199
- companyRegistrationDocument: registrationDocument2 ? {
28200
- registrationDocument: [mapExistingFile(getPageName(registrationDocument2))]
28201
- } : void 0,
28202
- companyTaxDocument: taxDocument2 ? {
28203
- taxDocument: [mapExistingFile(getPageName(taxDocument2))]
28204
- } : void 0
28205
- };
28206
- };
28207
- const mapLegalEntityToCompanySearchSchema = (legalEntity, isChangingType, accountHolder2) => {
28208
- const companySearchSchema = {
28209
- companyBasics: {},
28210
- companyRegistrationAddress: {},
28211
- companyStructure: {},
28212
- companyOtherDetails: {},
28213
- companyRegistrationDocument: {},
28214
- companyTaxDocument: {},
28215
- ...formatObject(legalEntity, companySearchComponentsKeyMapping)
28216
- };
28217
- const {
28218
- companyRegistrationDocument: companyRegistrationDocument2,
28219
- companyTaxDocument
28220
- } = mapApiDocumentToCompanySearchDocuments(legalEntity == null ? void 0 : legalEntity.id);
28221
- return entriesOf(companySearchSchema).reduce((componentData, [key, value]) => {
28222
- var _a, _b, _c, _d, _e, _f, _g;
28223
- switch (key) {
28224
- case "companyBasics": {
28225
- return {
28226
- ...componentData,
28227
- [key]: value
28228
- };
28229
- }
28230
- case "companyRegistrationAddress": {
28231
- return {
28232
- ...componentData,
28233
- [key]: {
28234
- ...value,
28235
- operationalAddressIsSame: ((_a = legalEntity.organization) == null ? void 0 : _a.principalPlaceOfBusiness) ? operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_NOT_SAME : operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_SAME
28236
- }
28237
- };
28238
- }
28239
- case "companyOtherDetails": {
28240
- return {
28241
- ...componentData,
28242
- [key]: {
28243
- ...value,
28244
- 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,
28245
- 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)
28246
- }
28247
- };
28248
- }
28249
- case "companyStructure": {
28250
- return {
28251
- ...componentData,
28252
- [key]: {
28253
- ...value,
28254
- accountHolder: getDefaultAccountHolderType(legalEntity, isChangingType, accountHolder2)
28255
- }
28256
- };
28257
- }
28258
- case "companyRegistrationDocument": {
28259
- return {
28260
- ...componentData,
28261
- [key]: {
28262
- ...companyRegistrationDocument2
28263
- }
28264
- };
28265
- }
28266
- case "companyTaxDocument": {
28267
- return {
28268
- ...componentData,
28269
- [key]: {
28270
- ...companyTaxDocument
28271
- }
28272
- };
28273
- }
28274
- default:
28275
- return componentData;
28276
- }
28277
- }, {});
28278
- };
28279
- const logger$g = createLogger("useFormTaskSubmit");
29141
+ const logger$h = createLogger("useFormTaskSubmit");
28280
29142
  function useCompanySearchTaskSubmit({
28281
29143
  task,
28282
29144
  forms: forms2,
@@ -28319,7 +29181,7 @@ function useCompanySearchTaskSubmit({
28319
29181
  });
28320
29182
  }
28321
29183
  } catch (e) {
28322
- logger$g.error(e);
29184
+ logger$h.error(e);
28323
29185
  userEvents.addEvent(CompanySearchEvents.DOCUMENTS_ERROR, {
28324
29186
  segmentation: {
28325
29187
  ...baseTrackingPayload,
@@ -28371,7 +29233,7 @@ function useCompanySearchTaskSubmit({
28371
29233
  ...trackingPayload
28372
29234
  }
28373
29235
  });
28374
- logger$g.log(submittedLegalEntity);
29236
+ logger$h.log(submittedLegalEntity);
28375
29237
  clearToasts();
28376
29238
  onExternalSubmit == null ? void 0 : onExternalSubmit(data);
28377
29239
  } catch (e) {
@@ -28395,7 +29257,7 @@ function useCompanySearchTaskSubmit({
28395
29257
  type: "error"
28396
29258
  });
28397
29259
  }
28398
- logger$g.error(e);
29260
+ logger$h.error(e);
28399
29261
  userEvents.addEvent(CompanySearchEvents.TASK_ERROR, {
28400
29262
  segmentation: {
28401
29263
  ...baseTrackingPayload,
@@ -28752,7 +29614,9 @@ function CompanySearchDropinComponent({
28752
29614
  })
28753
29615
  });
28754
29616
  }
28755
- const logger$f = createLogger("useLocalStorage");
29617
+ const IgnoreLocalStorageContext = createContext(false);
29618
+ const useIgnoreLocalStorage = () => useContext(IgnoreLocalStorageContext);
29619
+ const logger$g = createLogger("useLocalStorage");
28756
29620
  const useLocalStorage = (key, defaultValue, options) => {
28757
29621
  const {
28758
29622
  serializer,
@@ -28764,20 +29628,21 @@ const useLocalStorage = (key, defaultValue, options) => {
28764
29628
  syncData: true,
28765
29629
  ...options
28766
29630
  }), [options]);
29631
+ const ignoreLocalStorage = useIgnoreLocalStorage() || typeof window === "undefined";
28767
29632
  const rawValueRef = useRef(null);
28768
29633
  const [value, setValue] = useState(() => {
28769
- if (typeof window === "undefined") return defaultValue;
29634
+ if (ignoreLocalStorage) return defaultValue;
28770
29635
  try {
28771
29636
  rawValueRef.current = window.localStorage.getItem(key);
28772
29637
  const res = rawValueRef.current ? parser(rawValueRef.current) : defaultValue;
28773
29638
  return res;
28774
29639
  } catch (err) {
28775
- logger$f.error(err);
29640
+ logger$g.error(err);
28776
29641
  return defaultValue;
28777
29642
  }
28778
29643
  });
28779
29644
  useEffect(() => {
28780
- if (typeof window === "undefined") return;
29645
+ if (ignoreLocalStorage) return;
28781
29646
  const updateLocalStorage = () => {
28782
29647
  if (value !== void 0) {
28783
29648
  const newValue = serializer(value);
@@ -28803,9 +29668,9 @@ const useLocalStorage = (key, defaultValue, options) => {
28803
29668
  try {
28804
29669
  updateLocalStorage();
28805
29670
  } catch (err) {
28806
- logger$f.error(err);
29671
+ logger$g.error(err);
28807
29672
  }
28808
- }, [value]);
29673
+ }, [value, ignoreLocalStorage]);
28809
29674
  useEffect(() => {
28810
29675
  if (!syncData) return;
28811
29676
  const handleStorageChange = (event) => {
@@ -28816,13 +29681,13 @@ const useLocalStorage = (key, defaultValue, options) => {
28816
29681
  setValue(event.newValue ? parser(event.newValue) : void 0);
28817
29682
  }
28818
29683
  } catch (err) {
28819
- logger$f.error(err);
29684
+ logger$g.error(err);
28820
29685
  }
28821
29686
  };
28822
- if (typeof window === "undefined") return;
29687
+ if (ignoreLocalStorage) return;
28823
29688
  window.addEventListener("storage", handleStorageChange);
28824
29689
  return () => window.removeEventListener("storage", handleStorageChange);
28825
- }, [key, syncData]);
29690
+ }, [key, syncData, ignoreLocalStorage]);
28826
29691
  return [value, setValue];
28827
29692
  };
28828
29693
  const getHasSeenIntroductionStorageKey = (legalEntityId) => `COMPLETED_INTRO-${legalEntityId}`;
@@ -28874,7 +29739,7 @@ const useIsEligibleForSingpass = ({
28874
29739
  const isVanillaIndividual = legalEntityType === LegalEntityType.INDIVIDUAL && !hasSoleProprietor;
28875
29740
  return isVanillaOrganization && isSingpassForCompaniesEnabled || isVanillaIndividual && isSingpassForIndividualsEnabled;
28876
29741
  };
28877
- const logger$e = createLogger("useAssociatedLegalArrangement");
29742
+ const logger$f = createLogger("useAssociatedLegalArrangement");
28878
29743
  function useAssociatedLegalArrangement({
28879
29744
  rootLegalEntity,
28880
29745
  getLegalEntity: getLegalEntity2
@@ -28885,7 +29750,7 @@ function useAssociatedLegalArrangement({
28885
29750
  var _a;
28886
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);
28887
29752
  if (foundEntity == null ? void 0 : foundEntity.legalEntityId) {
28888
- 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);
28889
29754
  }
28890
29755
  }, [getAssociatedEntity, rootLegalEntity == null ? void 0 : rootLegalEntity.entityAssociations]);
28891
29756
  useEffect(() => {
@@ -28907,7 +29772,7 @@ const useCanSeeEntitySelection = (legalEntityId) => {
28907
29772
  setCanSeeEntitySelection: setCanSeeEntitySelectionIntoLocalStorage
28908
29773
  };
28909
29774
  };
28910
- const logger$d = createLogger("useExemptSettlor");
29775
+ const logger$e = createLogger("useExemptSettlor");
28911
29776
  const useExemptSettlor = ({
28912
29777
  trust: trust2,
28913
29778
  handleGetLegalEntity
@@ -28920,7 +29785,7 @@ const useExemptSettlor = ({
28920
29785
  }, [handleGetLegalEntity]);
28921
29786
  useEffect(() => {
28922
29787
  if (!(trust2 == null ? void 0 : trust2.trust)) return;
28923
- updateExemptSettlor(trust2).catch(logger$d.error);
29788
+ updateExemptSettlor(trust2).catch(logger$e.error);
28924
29789
  }, [trust2, updateExemptSettlor]);
28925
29790
  return exemptSettlor;
28926
29791
  };
@@ -28945,11 +29810,6 @@ function useSalesChannelsSettings() {
28945
29810
  return settings;
28946
29811
  }, [isSettingEnabled]);
28947
29812
  }
28948
- var TrustedFieldsProvider = /* @__PURE__ */ ((TrustedFieldsProvider2) => {
28949
- TrustedFieldsProvider2["SINGPASS"] = "singpass";
28950
- TrustedFieldsProvider2["KOMPANY"] = "kompany";
28951
- return TrustedFieldsProvider2;
28952
- })(TrustedFieldsProvider || {});
28953
29813
  const downloadFile = async (base64, filename) => {
28954
29814
  saveBlobAsFile(base64ToBlob(base64), filename);
28955
29815
  };
@@ -29242,7 +30102,7 @@ function AccountSetupRejected() {
29242
30102
  const content = jsxs("div", {
29243
30103
  children: [jsx(AlertIcon, {
29244
30104
  className: "adyen-kyc-alert-error-icon",
29245
- type: AlertTypes.ERROR
30105
+ type: "error"
29246
30106
  }), jsx(FormHeader, {
29247
30107
  heading: i18n.get("cantSetUpAcccount")
29248
30108
  }), jsx("span", {
@@ -29685,15 +30545,6 @@ const iconStatus = (current, min, max) => {
29685
30545
  return isWithinConditionalRange ? "conditionalFinished" : "conditionalEmpty";
29686
30546
  };
29687
30547
  const getEntityStatusRuleDescription = (country2, currentTask, entityLabel) => currentTask === TaskTypes.TRUST_MEMBER_OVERVIEW ? TRUST_DEFAULT_DESCRIPTIONS_MAP[entityLabel] : getDecisionMakerDescriptionMap(country2)[entityLabel];
29688
- function CardGroup({
29689
- className,
29690
- children
29691
- }) {
29692
- return jsx("section", {
29693
- className: cx("adyen-kyc-card-group", className),
29694
- children
29695
- });
29696
- }
29697
30548
  const Status = ({
29698
30549
  text,
29699
30550
  className,
@@ -29707,7 +30558,7 @@ const Status = ({
29707
30558
  children: [jsx("span", {
29708
30559
  className: iconClasses,
29709
30560
  children: icon === "loading" ? jsx(Loader, {
29710
- size: "xsmall",
30561
+ size: "small",
29711
30562
  dot: true
29712
30563
  }) : jsx(Icon, {
29713
30564
  name: icon
@@ -29823,7 +30674,7 @@ const VerificationErrorAlert = ({
29823
30674
  return jsx(Alert, {
29824
30675
  className,
29825
30676
  hasCloseButton: false,
29826
- type: AlertTypes.ERROR,
30677
+ type: "error",
29827
30678
  title: `${childErrorMsg}. ${remediationActionMsg}`
29828
30679
  });
29829
30680
  }
@@ -29832,65 +30683,10 @@ const VerificationErrorAlert = ({
29832
30683
  return jsx(Alert, {
29833
30684
  className,
29834
30685
  hasCloseButton: false,
29835
- type: AlertTypes.ERROR,
30686
+ type: "error",
29836
30687
  title: i18n.get("verificationErrorMessage")
29837
30688
  });
29838
30689
  };
29839
- function Card({
29840
- className,
29841
- children,
29842
- stateful,
29843
- active,
29844
- disabled,
29845
- warning,
29846
- warningMessage,
29847
- title,
29848
- subTitle,
29849
- onClick,
29850
- onKeyDown
29851
- }) {
29852
- const classNames = cx("adyen-kyc-card", className, {
29853
- "adyen-kyc-card--stateful": stateful,
29854
- "adyen-kyc-card--active": stateful && active,
29855
- "adyen-kyc-card--disabled": disabled
29856
- });
29857
- const tabIndex = stateful ? 0 : void 0;
29858
- const role2 = stateful ? "button" : void 0;
29859
- const onClickHandler = (e) => {
29860
- if (disabled) {
29861
- return;
29862
- }
29863
- onClick == null ? void 0 : onClick(e);
29864
- };
29865
- return jsxs("article", {
29866
- className: classNames,
29867
- tabIndex,
29868
- role: role2,
29869
- onClick: onClickHandler,
29870
- onKeyDown,
29871
- children: [title && jsxs("header", {
29872
- className: "adyen-kyc-card__header",
29873
- children: [jsx(Typography, {
29874
- el: "h4",
29875
- variant: "title",
29876
- children: title
29877
- }), subTitle && jsx(Typography, {
29878
- el: "p",
29879
- variant: "body",
29880
- children: subTitle
29881
- })]
29882
- }), jsx("div", {
29883
- role: "region",
29884
- className: "adyen-kyc-card__body",
29885
- children
29886
- }), warning && jsx(Alert, {
29887
- className: "adyen-kyc-card__warning",
29888
- title: warningMessage,
29889
- hasCloseButton: false,
29890
- type: AlertTypes.WARNING
29891
- })]
29892
- });
29893
- }
29894
30690
  function useClickAwayListener(ref, onClickAway) {
29895
30691
  const handleClickAway = useCallback((event) => {
29896
30692
  if (ref.current && !ref.current.contains(event.target)) {
@@ -30278,7 +31074,7 @@ const DecisionMakersComponent = ({
30278
31074
  }
30279
31075
  });
30280
31076
  showToast({
30281
- type: "error",
31077
+ type: "success",
30282
31078
  label: i18n.get("successFullyRemovedDecisionMaker")
30283
31079
  });
30284
31080
  } catch (e) {
@@ -30328,7 +31124,7 @@ const DecisionMakersComponent = ({
30328
31124
  className: "adyen-kyc-decision-makers__warning",
30329
31125
  title: remediationMessages.DECISION_MAKER,
30330
31126
  hasCloseButton: false,
30331
- type: AlertTypes.WARNING
31127
+ type: "warning"
30332
31128
  }), (uniqueDecisionMakers == null ? void 0 : uniqueDecisionMakers.length) > 0 ? jsx(CardGroup, {
30333
31129
  children: uniqueDecisionMakers.map((decisionMaker2) => jsx(EntityAssociation, {
30334
31130
  types: decisionMaker2.types,
@@ -31126,7 +31922,6 @@ const TaskListItem = ({
31126
31922
  handleIsRemoveDisabled
31127
31923
  })
31128
31924
  }) : jsx(Icon, {
31129
- className: "adyen-kyc-u-color-grey-60",
31130
31925
  name: "chevron-right"
31131
31926
  })]
31132
31927
  })]
@@ -31405,7 +32200,7 @@ function TaskListComponent({
31405
32200
  disabled: !canAddPayoutAccount,
31406
32201
  children: [jsx(Icon, {
31407
32202
  name: "plus",
31408
- className: "adyen-kyc-u-padding-top-2 adyen-kyc-u-margin-right-8"
32203
+ className: "adyen-task-list__card-icon "
31409
32204
  }), jsx("span", {
31410
32205
  children: isEnableNewEntryFlowEnabled ? i18n.get("addExtraBankAccount") : i18n.get(hasPayinTaskNotPayout ? "addExtraPayinAccount" : "addExtraPayoutAccount")
31411
32206
  })]
@@ -31500,7 +32295,7 @@ const CompanyTrustMemberTaskItem = ({
31500
32295
  })
31501
32296
  }];
31502
32297
  const infoContent = companyTrustMember.ownerId ? void 0 : jsx(Alert, {
31503
- type: AlertTypes.BASIC,
32298
+ type: "basic",
31504
32299
  hasCloseButton: false,
31505
32300
  title: jsxs(Fragment, {
31506
32301
  children: [i18n.get("helpUsVerifyCompany"), " ", jsx(Link, {
@@ -31797,27 +32592,11 @@ const isNotEmptyBirthDateValidatorRule = {
31797
32592
  const isNotOutOfRangeBirthDateValidatorRule = {
31798
32593
  modes: ["blur"],
31799
32594
  validate: (birthDate2) => !isEmpty(birthDate2) && new Date(birthDate2) < /* @__PURE__ */ new Date(),
31800
- errorMessage: "fieldIsRequired"
31801
- };
31802
- const getAgeToday = (birthdate2) => {
31803
- const today = /* @__PURE__ */ new Date();
31804
- const todayMonth = today.getMonth();
31805
- const todayDay = today.getDate();
31806
- const bdDate = new Date(birthdate2);
31807
- const bdMonth = bdDate.getMonth();
31808
- const yearDifference = today.getFullYear() - bdDate.getFullYear();
31809
- if (todayMonth > bdMonth) {
31810
- return yearDifference;
31811
- }
31812
- if (todayMonth === bdMonth && todayDay >= bdDate.getUTCDate()) {
31813
- return yearDifference;
31814
- }
31815
- return yearDifference - 1;
32595
+ errorMessage: "invalidDateOfBirth"
31816
32596
  };
31817
- const isAgeAtLeastXYearsOld = (age, x) => age >= x;
31818
32597
  const buildMinimumAgeValidationRule = (minimumAge) => ({
31819
32598
  modes: ["blur"],
31820
- validate: (birthDate2) => !!birthDate2 && isAgeAtLeastXYearsOld(getAgeToday(birthDate2), minimumAge),
32599
+ validate: (birthDate2) => !!birthDate2 && getAgeToday(birthDate2) >= minimumAge,
31821
32600
  errorMessage: {
31822
32601
  key: "youMustXYearsOldToContinue",
31823
32602
  values: {
@@ -31829,7 +32608,7 @@ const getCountrySpecificMinimumAgeValidationRule = (country2) => {
31829
32608
  if (!country2) {
31830
32609
  return buildMinimumAgeValidationRule(13);
31831
32610
  }
31832
- if (eeaCountries.some((c) => c === country2)) {
32611
+ if ([...euCountries, CountryCodes.UnitedKingdom, CountryCodes.Switzerland].some((c) => c === country2)) {
31833
32612
  return buildMinimumAgeValidationRule(16);
31834
32613
  }
31835
32614
  switch (country2) {
@@ -32345,21 +33124,26 @@ function IndividualDropinComponent({
32345
33124
  })
32346
33125
  });
32347
33126
  }
33127
+ const logger$d = createLogger("useBankConfigurationHandler");
32348
33128
  const useBankConfigurationHandlers = ({
32349
33129
  isEmbeddedDropin,
32350
33130
  handleGetBankVerificationVendors,
32351
33131
  bankAccountCountry,
32352
33132
  getConfiguration: getConfiguration2,
32353
33133
  legalEntityType,
32354
- capabilities
33134
+ capabilities,
33135
+ setLoadingStatus
32355
33136
  }) => {
32356
33137
  const [bankVerificationVendorsResponse, setBankVerificationVendorsResponse] = useState();
32357
33138
  const callBankVerificationVendorsUpfront = isEmbeddedDropin && handleGetBankVerificationVendors;
32358
33139
  useEffect(() => {
33140
+ setLoadingStatus("loading");
32359
33141
  (async () => {
32360
33142
  const bankVerificationVendorsResponse2 = callBankVerificationVendorsUpfront ? await handleGetBankVerificationVendors(bankAccountCountry) : [];
32361
33143
  setBankVerificationVendorsResponse(bankVerificationVendorsResponse2);
32362
- })();
33144
+ })().catch(logger$d.error).finally(() => {
33145
+ setLoadingStatus("success");
33146
+ });
32363
33147
  }, [bankAccountCountry]);
32364
33148
  const getConfigurationData = useCallback(async () => {
32365
33149
  var _a;
@@ -32534,6 +33318,8 @@ function PayoutDetailsDropinComponent({
32534
33318
  const [skipSubmit, setSkipSubmit] = useState(false);
32535
33319
  const [hideOnHomeButton, setHideHomeButton] = useState(false);
32536
33320
  const [loadingStatus, setLoadingStatus] = useState("success");
33321
+ const [configurationLoadingStatus, setConfigurationLoadingStatus] = useState("success");
33322
+ const [bankVendorsLoadingStatus, setBankVendorsLoadingStatus] = useState("success");
32537
33323
  const [data, setData] = useState(prefilledData);
32538
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));
32539
33325
  const existingBankAccountFormat = transferInstrument ? ((_d = existingPayoutDetails == null ? void 0 : existingPayoutDetails.payoutAccountDetails) == null ? void 0 : _d.iban) ? "iban" : "local" : void 0;
@@ -32558,7 +33344,8 @@ function PayoutDetailsDropinComponent({
32558
33344
  bankAccountCountry: bankAccountCountry ?? defaultPayoutCountry,
32559
33345
  getConfiguration: getConfiguration2,
32560
33346
  legalEntityType: legalEntityResponse.type,
32561
- capabilities
33347
+ capabilities,
33348
+ setLoadingStatus: setConfigurationLoadingStatus
32562
33349
  });
32563
33350
  const getPayoutAccountFormatData = useCallback(async () => getAccountFormatsForCountry(bankAccountCountry ?? defaultPayoutCountry), [bankAccountCountry]);
32564
33351
  const {
@@ -32570,7 +33357,7 @@ function PayoutDetailsDropinComponent({
32570
33357
  getConfigurationData,
32571
33358
  getPayoutAccountFormatData,
32572
33359
  instantVerificationEnabled,
32573
- setLoadingStatus,
33360
+ setLoadingStatus: setBankVendorsLoadingStatus,
32574
33361
  country: bankAccountCountry ?? defaultPayoutCountry,
32575
33362
  existingBankAccountFormat
32576
33363
  });
@@ -32590,6 +33377,7 @@ function PayoutDetailsDropinComponent({
32590
33377
  }), isSettingEnabled(SettingNames.AllowIntraRegionCrossBorderPayout), isExperimentEnabled("EnableNewEntryFlow"));
32591
33378
  }, [bankVerificationVendors]);
32592
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);
32593
33381
  const {
32594
33382
  state: {
32595
33383
  currentState
@@ -34806,6 +35594,17 @@ const useNavigation = ({
34806
35594
  setTaskHistory(taskHistory.slice(0, -1 * stepCount));
34807
35595
  onNavigate == null ? void 0 : onNavigate(prevTask);
34808
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]);
34809
35608
  useEffect(() => {
34810
35609
  const pushedTask = taskHistory.at(-1);
34811
35610
  if (pushedTask === "default") {
@@ -36459,7 +37258,7 @@ const highExposureCompanyDetailsValidations = {
36459
37258
  },
36460
37259
  legalForm: {
36461
37260
  modes: ["blur"],
36462
- validate: (legalForm) => !isEmpty(legalForm),
37261
+ validate: (legalForm2) => !isEmpty(legalForm2),
36463
37262
  errorMessage: "fieldIsRequired"
36464
37263
  },
36465
37264
  naceCode: {
@@ -37583,7 +38382,7 @@ function ViewVerificationStatusComponent({
37583
38382
  return jsx(Alert, {
37584
38383
  title: i18n.get(alertContent),
37585
38384
  hasCloseButton: false,
37586
- type: AlertTypes.ERROR
38385
+ type: "error"
37587
38386
  });
37588
38387
  }
37589
38388
  if (content) {
@@ -38044,7 +38843,7 @@ const ConfigurationApiProvider = ({
38044
38843
  isEmbeddedDropin,
38045
38844
  loadingContext
38046
38845
  } = authContext;
38047
- const sdkVersion = "2.47.2";
38846
+ const sdkVersion = "2.48.1";
38048
38847
  useAnalytics({
38049
38848
  onUserEvent,
38050
38849
  legalEntityId: rootLegalEntityId,
@@ -38458,7 +39257,7 @@ const Toast = ({
38458
39257
  "aria-labelledby": labelId,
38459
39258
  children: [isLoading && jsx("div", {
38460
39259
  className: "adyen-kyc-toast__loader",
38461
- children: jsx(Spinner, {
39260
+ children: jsx(Loader, {
38462
39261
  size: "small"
38463
39262
  })
38464
39263
  }), jsxs("div", {
@@ -38658,10 +39457,10 @@ class UIElement extends BaseElement {
38658
39457
  refreshExpiry: this.props.refreshExpiry,
38659
39458
  eventEmitter: this.eventEmitter,
38660
39459
  children: jsx("div", {
38661
- className: "adyen-kyc-u-width-full",
39460
+ className: "adyen-kyc-ui-element-container-wrapper",
38662
39461
  children: jsx(AutoResizer, {
38663
39462
  children: jsx("div", {
38664
- className: "adyen-kyc-dropin-container adyen-kyc-u-position-relative",
39463
+ className: "adyen-kyc-ui-element-container",
38665
39464
  children: jsx(ToastContextProvider, {
38666
39465
  children: jsx(StateProvider, {
38667
39466
  children: jsx(Component, {