@adyen/kyc-components 2.37.0 → 2.37.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.
@@ -11042,8 +11042,13 @@ function AccountHolder(props) {
11042
11042
  fieldProblems: props == null ? void 0 : props.fieldValidationErrors
11043
11043
  });
11044
11044
  useEffect(() => {
11045
- var _a2, _b;
11046
- (_b = (_a2 = stateRef.current) == null ? void 0 : _a2.setState) == null ? void 0 : _b.call(_a2, {
11045
+ var _a2, _b, _c;
11046
+ (_a2 = props.onChange) == null ? void 0 : _a2.call(props, {
11047
+ data,
11048
+ valid,
11049
+ errors
11050
+ });
11051
+ (_c = (_b = stateRef.current) == null ? void 0 : _b.setState) == null ? void 0 : _c.call(_b, {
11047
11052
  type: "addToState",
11048
11053
  value: {
11049
11054
  data,
@@ -25879,8 +25884,9 @@ const CompanyStructureValidation = {
25879
25884
  }
25880
25885
  };
25881
25886
  const COMPANY_STRUCTURE_FORM_ID = "companyStructure";
25882
- const companyStructureFields = ["entityType"];
25887
+ const companyStructureFields = ["entityType", "accountHolder"];
25883
25888
  function CompanyStructureComponent({
25889
+ id: id2,
25884
25890
  data,
25885
25891
  labels: labels2,
25886
25892
  heading,
@@ -25888,7 +25894,9 @@ function CompanyStructureComponent({
25888
25894
  formVerificationErrors,
25889
25895
  fieldValidationErrors,
25890
25896
  requiredFields,
25891
- kompanyVerifiedData
25897
+ country: country2,
25898
+ kompanyVerifiedData,
25899
+ ...props
25892
25900
  }) {
25893
25901
  var _a;
25894
25902
  const {
@@ -25938,6 +25946,19 @@ function CompanyStructureComponent({
25938
25946
  });
25939
25947
  }, [formSchema, formData, formErrors, formValid, formFieldProblems, updateStateSlice]);
25940
25948
  const companyTypeOptions = isNewEntryFlowEnabled ? companyTypes.filter((companyType2) => companyType2.id !== CompanyTypesValue.INCORPORATED_PARTNERSHIP && companyType2.id !== CompanyTypesValue.INCORPORATED_ASSOCIATION) : companyTypes;
25949
+ const companyTypeExamples2 = useCompanyTypeExamples(country2);
25950
+ const accountHolderProps = getFieldProps({
25951
+ id: id2,
25952
+ data,
25953
+ labels: labels2,
25954
+ heading,
25955
+ description: description2,
25956
+ formVerificationErrors,
25957
+ fieldValidationErrors,
25958
+ requiredFields,
25959
+ country: country2,
25960
+ ...props
25961
+ }, accountHolderFields);
25941
25962
  return jsxs("form", {
25942
25963
  children: [jsx(FormHeader, {
25943
25964
  heading,
@@ -25952,18 +25973,24 @@ function CompanyStructureComponent({
25952
25973
  useLabelElement: false,
25953
25974
  errorMessage: formUtils.getErrorMessage("entityType", formErrors, formFieldProblems),
25954
25975
  classNameModifiers: ["entityType"],
25955
- children: (childProps) => jsx(RadioGroupCard, {
25976
+ children: (childProps) => jsx(EntityTypeRadioGroupCard, {
25956
25977
  ...childProps,
25957
25978
  "aria-required": true,
25958
25979
  "aria-label": formUtils.getLabel("entityType", "whatTypeOfCompanyDoYouHave"),
25959
25980
  "aria-invalid": !formValid.entityType,
25960
25981
  name: "entityType",
25961
25982
  items: companyTypeOptions,
25962
- selected: companyTypeOptions.find((type) => type.id === (formData == null ? void 0 : formData.entityType)),
25983
+ selected: companyTypeOptions.find((type) => type.id === formData.entityType),
25963
25984
  readonly: disabled,
25964
- isItemDisabled: () => disabled,
25965
- onSelect: (item) => handleChangeFor("entityType")(item.id)
25985
+ onSelect: (item) => handleChangeFor("entityType")(item.id),
25986
+ examples: companyTypeExamples2
25966
25987
  })
25988
+ }), !isNewEntryFlowEnabled && country2 && jsx(AccountHolder, {
25989
+ ...accountHolderProps,
25990
+ dataStoreId: id2,
25991
+ legalEntityType: LegalEntityType.ORGANIZATION,
25992
+ country: country2,
25993
+ onChange: (value) => handleChangeFor("accountHolder")(value.data.accountHolder)
25967
25994
  })]
25968
25995
  });
25969
25996
  }
@@ -26231,7 +26258,7 @@ const mapApiDocumentToCompanySearchDocuments = (entityId) => {
26231
26258
  } : void 0
26232
26259
  };
26233
26260
  };
26234
- const mapLegalEntityToCompanySearchSchema = (legalEntity) => {
26261
+ const mapLegalEntityToCompanySearchSchema = (legalEntity, isChangingType) => {
26235
26262
  const companySearchSchema = {
26236
26263
  companyBasics: {},
26237
26264
  companyRegistrationAddress: {},
@@ -26276,7 +26303,10 @@ const mapLegalEntityToCompanySearchSchema = (legalEntity) => {
26276
26303
  case "companyStructure": {
26277
26304
  return {
26278
26305
  ...componentData,
26279
- [key]: value
26306
+ [key]: {
26307
+ ...value,
26308
+ accountHolder: getDefaultAccountHolderType(legalEntity, isChangingType)
26309
+ }
26280
26310
  };
26281
26311
  }
26282
26312
  case "companyRegistrationDocument": {
@@ -26307,6 +26337,7 @@ function useCompanySearchTaskSubmit({
26307
26337
  legalEntityResponse,
26308
26338
  problems,
26309
26339
  baseTrackingPayload,
26340
+ isTargetLegalEntityType,
26310
26341
  documentUtils,
26311
26342
  setProblems,
26312
26343
  setLoadingStatus,
@@ -26368,7 +26399,7 @@ function useCompanySearchTaskSubmit({
26368
26399
  legalEntityName: ((_c = data.companyBasics) == null ? void 0 : _c.legalCompanyName) ?? null,
26369
26400
  usedAdditionalAddress: ((_d = data.companyRegistrationAddress) == null ? void 0 : _d.operationalAddressIsSame) === operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_NOT_SAME
26370
26401
  };
26371
- const savedLegalEntityData = mapLegalEntityToCompanySearchSchema(legalEntityResponse);
26402
+ const savedLegalEntityData = mapLegalEntityToCompanySearchSchema(legalEntityResponse, isTargetLegalEntityType);
26372
26403
  const filteredData = removeOldDataBySchema(data, savedLegalEntityData);
26373
26404
  const legalEntity = {
26374
26405
  ...mapCompanySearchSchemaToLegalEntity(filteredData),
@@ -26441,7 +26472,7 @@ function useCompanySearchTaskSubmit({
26441
26472
  };
26442
26473
  }
26443
26474
  function CompanySearchComponent(props) {
26444
- var _a, _b, _c, _d, _e;
26475
+ var _a, _b, _c, _d, _e, _f;
26445
26476
  const {
26446
26477
  i18n
26447
26478
  } = useI18nContext();
@@ -26457,12 +26488,14 @@ function CompanySearchComponent(props) {
26457
26488
  handleCompanyDeepSearch,
26458
26489
  handleGetCompanyDataset,
26459
26490
  handleRefreshCompanyDataset,
26460
- handleVerifyTin
26491
+ handleVerifyTin,
26492
+ onTypeSwitch
26461
26493
  } = props;
26462
26494
  const globalData = useGlobalData();
26463
26495
  const [kompanyAddress, setKompanyAddress] = useState();
26464
26496
  const [kompanyVerifiedData, setKompanyVerifiedData] = useState();
26465
26497
  const formWrapperClasses = (formId) => (activeForm == null ? void 0 : activeForm.formId) !== formId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper";
26498
+ this.customNavigationHandler = ((_a = globalData.companyStructure) == null ? void 0 : _a.accountHolder) === "myName" ? () => onTypeSwitch == null ? void 0 : onTypeSwitch(LegalEntityType.INDIVIDUAL) : null;
26466
26499
  return jsxs("div", {
26467
26500
  className: "adyen-kyc-company",
26468
26501
  children: [jsx("div", {
@@ -26472,7 +26505,7 @@ function CompanySearchComponent(props) {
26472
26505
  id: forms.companyBasics.formId,
26473
26506
  heading: i18n.get(forms.companyBasics.formName),
26474
26507
  country: country2,
26475
- companyType: (_a = globalData == null ? void 0 : globalData.companyStructure) == null ? void 0 : _a.entityType,
26508
+ companyType: (_b = globalData == null ? void 0 : globalData.companyStructure) == null ? void 0 : _b.entityType,
26476
26509
  isTopLevelEntity,
26477
26510
  baseTrackingPayload,
26478
26511
  handleCompanyIndexSearch,
@@ -26506,6 +26539,7 @@ function CompanySearchComponent(props) {
26506
26539
  id: forms.companyStructure.formId,
26507
26540
  heading: i18n.get(forms.companyStructure.formName),
26508
26541
  description: i18n.get(forms.companyStructure.formDescription),
26542
+ country: country2,
26509
26543
  kompanyVerifiedData
26510
26544
  })
26511
26545
  }), jsx("div", {
@@ -26515,8 +26549,8 @@ function CompanySearchComponent(props) {
26515
26549
  id: forms.companyOtherDetails.formId,
26516
26550
  heading: i18n.get(forms.companyOtherDetails.formName),
26517
26551
  country: country2,
26518
- legalCompanyName: (_b = globalData == null ? void 0 : globalData.companyBasics) == null ? void 0 : _b.legalCompanyName,
26519
- companyType: (_c = globalData == null ? void 0 : globalData.companyStructure) == null ? void 0 : _c.entityType,
26552
+ legalCompanyName: (_c = globalData == null ? void 0 : globalData.companyBasics) == null ? void 0 : _c.legalCompanyName,
26553
+ companyType: (_d = globalData == null ? void 0 : globalData.companyStructure) == null ? void 0 : _d.entityType,
26520
26554
  kompanyVerifiedData
26521
26555
  })
26522
26556
  }), jsx("div", {
@@ -26527,7 +26561,7 @@ function CompanySearchComponent(props) {
26527
26561
  heading: forms.companyRegistrationDocument.formHeading,
26528
26562
  description: forms.companyRegistrationDocument.formDescription,
26529
26563
  country: country2,
26530
- companyType: (_d = globalData.companyStructure) == null ? void 0 : _d.entityType
26564
+ companyType: (_e = globalData.companyStructure) == null ? void 0 : _e.entityType
26531
26565
  })
26532
26566
  }), jsx("div", {
26533
26567
  className: formWrapperClasses(forms.companyTaxDocument.formId),
@@ -26537,7 +26571,7 @@ function CompanySearchComponent(props) {
26537
26571
  heading: forms.companyTaxDocument.formHeading,
26538
26572
  description: forms.companyTaxDocument.formDescription,
26539
26573
  country: country2,
26540
- companyType: (_e = globalData.companyStructure) == null ? void 0 : _e.entityType
26574
+ companyType: (_f = globalData.companyStructure) == null ? void 0 : _f.entityType
26541
26575
  }) : jsx(DocumentUpload, {
26542
26576
  ...getFormProps(props, forms.companyTaxDocument.formId),
26543
26577
  id: forms.companyTaxDocument.formId,
@@ -26569,6 +26603,7 @@ function CompanySearchDropinComponent({
26569
26603
  country: parentCountry,
26570
26604
  problems: propProblems,
26571
26605
  legalEntityResponse,
26606
+ isTargetLegalEntityType,
26572
26607
  parentLegalEntity,
26573
26608
  trackingConfig,
26574
26609
  eventEmitter,
@@ -26590,7 +26625,8 @@ function CompanySearchDropinComponent({
26590
26625
  handleCompanyDeepSearch,
26591
26626
  handleGetCompanyDataset,
26592
26627
  handleRefreshCompanyDataset,
26593
- handleVerifyTin
26628
+ handleVerifyTin,
26629
+ onTypeSwitch
26594
26630
  }) {
26595
26631
  var _a, _b, _c, _d;
26596
26632
  const {
@@ -26616,7 +26652,7 @@ function CompanySearchDropinComponent({
26616
26652
  isExperimentEnabled
26617
26653
  } = useExperimentsContext();
26618
26654
  const [loadingStatus, setLoadingStatus] = useState("success");
26619
- const [initialData, setInitialData] = useState(mapLegalEntityToCompanySearchSchema(legalEntityResponse));
26655
+ const [initialData, setInitialData] = useState(mapLegalEntityToCompanySearchSchema(legalEntityResponse, Boolean(isTargetLegalEntityType)));
26620
26656
  const country2 = useMemo(() => {
26621
26657
  var _a2;
26622
26658
  return ((_a2 = currentState.data.companyBasics) == null ? void 0 : _a2.country) ?? parentCountry;
@@ -26702,6 +26738,7 @@ function CompanySearchDropinComponent({
26702
26738
  legalEntityResponse,
26703
26739
  problems,
26704
26740
  baseTrackingPayload,
26741
+ isTargetLegalEntityType: Boolean(isTargetLegalEntityType),
26705
26742
  documentUtils,
26706
26743
  setProblems,
26707
26744
  setLoadingStatus,
@@ -26760,6 +26797,7 @@ function CompanySearchDropinComponent({
26760
26797
  activeForm,
26761
26798
  shouldValidate,
26762
26799
  isTopLevelEntity: taskType === TaskTypes.COMPANY_SEARCH,
26800
+ onTypeSwitch,
26763
26801
  baseTrackingPayload,
26764
26802
  handleAddressSearch,
26765
26803
  handleFindAddress,
@@ -33190,7 +33228,9 @@ function DropinComposerComponent({
33190
33228
  handleCompanyDeepSearch: args.handleCompanyDeepSearch,
33191
33229
  handleGetCompanyDataset: args.handleGetCompanyDataset,
33192
33230
  handleRefreshCompanyDataset: args.handleRefreshCompanyDataset,
33193
- handleVerifyTin: args.handleVerifyTin
33231
+ handleVerifyTin: args.handleVerifyTin,
33232
+ onTypeSwitch: navigateToTypeSwitcher,
33233
+ isTargetLegalEntityType: legalEntityType === LegalEntityType.ORGANIZATION
33194
33234
  });
33195
33235
  case TaskTypes.TRUST_MEMBER_COMPANY:
33196
33236
  return jsx(CompanyDropinComponent, {
@@ -34514,7 +34554,7 @@ const ConfigurationApiProvider = ({
34514
34554
  isEmbeddedDropin,
34515
34555
  loadingContext
34516
34556
  } = authContext;
34517
- const sdkVersion = "2.37.0";
34557
+ const sdkVersion = "2.37.1";
34518
34558
  useAnalytics({
34519
34559
  onUserEvent,
34520
34560
  legalEntityId: rootLegalEntityId,
package/dist/style.css CHANGED
@@ -80066,6 +80066,8 @@ a.adl-button:disabled, a.adl-button.adl-button--disabled {
80066
80066
  padding-bottom: 4px;
80067
80067
  }
80068
80068
  .adyen-company-lookup-results-list__result-option {
80069
+ display: flex;
80070
+ justify-content: space-between;
80069
80071
  background-color: #fff;
80070
80072
  box-shadow: 0 1px 1px rgba(0, 17, 44, 0.12), 0 1px 3px rgba(0, 17, 44, 0.14);
80071
80073
  border: 1px solid #fff;
@@ -15,7 +15,7 @@ export declare const forms: {
15
15
  readonly formId: keyof CompanySearchSchema;
16
16
  readonly formName: "companyStructureFormName";
17
17
  readonly formDescription: "companyStructureFormDescription";
18
- readonly fields: "entityType"[];
18
+ readonly fields: (keyof import("../CompanyStructure/types").CompanyStructureSchema)[];
19
19
  };
20
20
  readonly companyOtherDetails: {
21
21
  readonly formId: keyof CompanySearchSchema;
@@ -1,4 +1,5 @@
1
1
  import type { BaseOuterFormProps } from '../../core/hooks/useForm';
2
+ import type { LegalEntityType } from '../../core/models/api/legal-entity-type';
2
3
  import type { CountryCode } from '../../core/models/country-code';
3
4
  import type { FormModel } from '../../core/models/form';
4
5
  import type { BaseTrackingPayload } from '../../core/utils';
@@ -29,4 +30,5 @@ export interface CompanySearchProps extends BaseOuterFormProps<CompanySearchSche
29
30
  handleRefreshCompanyDataset: DropinAPIHandlers['handleRefreshCompanyDataset'];
30
31
  handleVerifyTin: DropinAPIHandlers['handleVerifyTin'];
31
32
  onSubmit?: (company: CompanySearchSchema) => void;
33
+ onTypeSwitch?: (legalEntityType: LegalEntityType) => void;
32
34
  }
@@ -3,4 +3,4 @@ import { CompanySearchSchema } from '../../CompanySearch/types';
3
3
  import { CompanyStructureProps, CompanyStructureSchema } from '../types';
4
4
  export declare const COMPANY_STRUCTURE_FORM_ID: keyof CompanySearchSchema;
5
5
  export declare const companyStructureFields: Array<keyof CompanyStructureSchema>;
6
- export declare function CompanyStructureComponent({ data, labels, heading, description, formVerificationErrors, fieldValidationErrors, requiredFields, kompanyVerifiedData, }: CompanyStructureProps): import("preact").JSX.Element;
6
+ export declare function CompanyStructureComponent({ id, data, labels, heading, description, formVerificationErrors, fieldValidationErrors, requiredFields, country, kompanyVerifiedData, ...props }: CompanyStructureProps): import("preact").JSX.Element;
@@ -1,9 +1,12 @@
1
1
  import type { BaseInnerFormProps } from '../../core/hooks/useForm';
2
2
  import type { CompanyTypesValue } from '../../core/models/api/company-types-value';
3
+ import type { CountryCode } from '../../core/models/country-code';
3
4
  import type { CompanySearchSchema } from '../CompanySearch/types';
4
- export interface CompanyStructureSchema {
5
+ import type { AccountHolderSchema } from '../internal/AccountHolder/types';
6
+ export interface CompanyStructureSchema extends AccountHolderSchema {
5
7
  entityType?: CompanyTypesValue;
6
8
  }
7
9
  export interface CompanyStructureProps extends BaseInnerFormProps<CompanyStructureSchema> {
10
+ country: CountryCode;
8
11
  kompanyVerifiedData?: CompanySearchSchema;
9
12
  }
@@ -1,2 +1,2 @@
1
1
  import { CompanySearchDropinProps } from '../types';
2
- export declare function CompanySearchDropinComponent({ country: parentCountry, problems: propProblems, legalEntityResponse, parentLegalEntity, trackingConfig, eventEmitter, taskType, capabilities, taskName, hideDropinLayout, homeButtonLabel, onChange, onSubmit: onExternalSubmit, handleHomeClick, handleCreateDocument, handleGetDocument, handleUpdateDocument, handleAddressSearch, handleFindAddress, handleUpdateLegalEntity, handleCompanyIndexSearch, handleCompanyDeepSearch, handleGetCompanyDataset, handleRefreshCompanyDataset, handleVerifyTin, }: CompanySearchDropinProps): import("preact").JSX.Element;
2
+ export declare function CompanySearchDropinComponent({ country: parentCountry, problems: propProblems, legalEntityResponse, isTargetLegalEntityType, parentLegalEntity, trackingConfig, eventEmitter, taskType, capabilities, taskName, hideDropinLayout, homeButtonLabel, onChange, onSubmit: onExternalSubmit, handleHomeClick, handleCreateDocument, handleGetDocument, handleUpdateDocument, handleAddressSearch, handleFindAddress, handleUpdateLegalEntity, handleCompanyIndexSearch, handleCompanyDeepSearch, handleGetCompanyDataset, handleRefreshCompanyDataset, handleVerifyTin, onTypeSwitch, }: CompanySearchDropinProps): import("preact").JSX.Element;
@@ -18,6 +18,7 @@ export declare enum CompanySearchEvents {
18
18
  export type CompanySearchDropinApihandler = Required<Pick<DropinAPIHandlers, 'handleCreateDocument' | 'handleGetDocument' | 'handleUpdateDocument' | 'handleUpdateLegalEntity'>>;
19
19
  export interface CompanySearchDropinProps extends Omit<CompanySearchProps, 'isTopLevelEntity' | 'baseTrackingPayload'>, CompanySearchDropinApihandler, DropinProps {
20
20
  legalEntityResponse: ExistingLegalEntity;
21
+ isTargetLegalEntityType?: boolean;
21
22
  parentLegalEntity?: LegalEntity;
22
23
  associationDetail?: TrustMember;
23
24
  }
@@ -21,6 +21,7 @@ export interface FormTaskSubmitOptions {
21
21
  legalEntityResponse: ExistingLegalEntity;
22
22
  problems?: EntityProblems;
23
23
  baseTrackingPayload: BaseTrackingPayload;
24
+ isTargetLegalEntityType: boolean;
24
25
  documentUtils: DocumentApiUtils;
25
26
  setProblems: StateUpdater<EntityProblems | undefined>;
26
27
  setLoadingStatus: StateUpdater<LoadingStatus>;
@@ -30,4 +31,4 @@ export interface FormTaskSubmitOptions {
30
31
  export type FormTaskSubmit<FormTaskSchema> = {
31
32
  submit: (options: SubmitOptions<FormTaskSchema>) => Promise<void>;
32
33
  };
33
- export declare function useCompanySearchTaskSubmit<FormTaskSchema extends CompanySearchSchema>({ task, forms, legalEntityResponse, problems, baseTrackingPayload, documentUtils, setProblems, setLoadingStatus, onExternalSubmit, handleUpdateLegalEntity, }: FormTaskSubmitOptions): FormTaskSubmit<FormTaskSchema>;
34
+ export declare function useCompanySearchTaskSubmit<FormTaskSchema extends CompanySearchSchema>({ task, forms, legalEntityResponse, problems, baseTrackingPayload, isTargetLegalEntityType, documentUtils, setProblems, setLoadingStatus, onExternalSubmit, handleUpdateLegalEntity, }: FormTaskSubmitOptions): FormTaskSubmit<FormTaskSchema>;
@@ -1,4 +1,4 @@
1
1
  import { CompanySearchSchema } from '../../../components/CompanySearch/types';
2
2
  import { ExistingLegalEntity } from '../../../core/models/api/legal-entity';
3
3
  export declare const mapApiDocumentToCompanySearchDocuments: (entityId: string) => CompanySearchSchema;
4
- export declare const mapLegalEntityToCompanySearchSchema: (legalEntity: ExistingLegalEntity) => CompanySearchSchema;
4
+ export declare const mapLegalEntityToCompanySearchSchema: (legalEntity: ExistingLegalEntity, isChangingType: boolean) => CompanySearchSchema;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adyen/kyc-components",
3
- "version": "2.37.0",
3
+ "version": "2.37.1",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "files": [