@adyen/kyc-components 3.11.0 → 3.11.2

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.
@@ -11098,8 +11098,13 @@ function AccountHolder(props) {
11098
11098
  fieldProblems: props == null ? void 0 : props.fieldValidationErrors
11099
11099
  });
11100
11100
  useEffect(() => {
11101
- var _a2, _b;
11102
- (_b = (_a2 = stateRef.current) == null ? void 0 : _a2.setState) == null ? void 0 : _b.call(_a2, {
11101
+ var _a2, _b, _c;
11102
+ (_a2 = props.onChange) == null ? void 0 : _a2.call(props, {
11103
+ data,
11104
+ valid,
11105
+ errors
11106
+ });
11107
+ (_c = (_b = stateRef.current) == null ? void 0 : _b.setState) == null ? void 0 : _c.call(_b, {
11103
11108
  type: "addToState",
11104
11109
  value: {
11105
11110
  data,
@@ -13668,7 +13673,7 @@ const getAccountIdentificationFromPayoutAccountSchema = (payoutAccount2, bankCou
13668
13673
  case "hkLocal":
13669
13674
  return {
13670
13675
  ...localAccount,
13671
- clearingCode: payoutAccount2.branchCode
13676
+ clearingCode: payoutAccount2.bankCode
13672
13677
  };
13673
13678
  case "nzLocal":
13674
13679
  return {
@@ -20131,20 +20136,6 @@ const defaultFieldConfig$2 = {
20131
20136
  }
20132
20137
  }
20133
20138
  },
20134
- [CountryCodes.HongKong]: {
20135
- label: "branchCode",
20136
- validators: validatePatternOnBlur(/^\d{3}$/),
20137
- mask: {
20138
- mask: makeMask(...numericInputs(3))
20139
- },
20140
- guidanceText: {
20141
- key: "enterNDigitsForExample",
20142
- values: {
20143
- numDigits: "3",
20144
- example: "100"
20145
- }
20146
- }
20147
- },
20148
20139
  [CountryCodes.UnitedStates]: {
20149
20140
  label: "achRoutingNumber",
20150
20141
  validators: validatePatternOnBlur(/^\d{9}$/),
@@ -26143,8 +26134,9 @@ const CompanyStructureValidation = {
26143
26134
  }
26144
26135
  };
26145
26136
  const COMPANY_STRUCTURE_FORM_ID = "companyStructure";
26146
- const companyStructureFields = ["entityType"];
26137
+ const companyStructureFields = ["entityType", "accountHolder"];
26147
26138
  function CompanyStructureComponent({
26139
+ id: id2,
26148
26140
  data,
26149
26141
  labels: labels2,
26150
26142
  heading,
@@ -26152,7 +26144,9 @@ function CompanyStructureComponent({
26152
26144
  formVerificationErrors,
26153
26145
  fieldValidationErrors,
26154
26146
  requiredFields,
26155
- kompanyVerifiedData
26147
+ country: country2,
26148
+ kompanyVerifiedData,
26149
+ ...props
26156
26150
  }) {
26157
26151
  var _a;
26158
26152
  const {
@@ -26202,6 +26196,19 @@ function CompanyStructureComponent({
26202
26196
  });
26203
26197
  }, [formSchema, formData, formErrors, formValid, formFieldProblems, updateStateSlice]);
26204
26198
  const companyTypeOptions = isNewEntryFlowEnabled ? companyTypes.filter((companyType2) => companyType2.id !== CompanyTypesValue.INCORPORATED_PARTNERSHIP && companyType2.id !== CompanyTypesValue.INCORPORATED_ASSOCIATION) : companyTypes;
26199
+ const companyTypeExamples2 = useCompanyTypeExamples(country2);
26200
+ const accountHolderProps = getFieldProps({
26201
+ id: id2,
26202
+ data,
26203
+ labels: labels2,
26204
+ heading,
26205
+ description: description2,
26206
+ formVerificationErrors,
26207
+ fieldValidationErrors,
26208
+ requiredFields,
26209
+ country: country2,
26210
+ ...props
26211
+ }, accountHolderFields);
26205
26212
  return jsxs("form", {
26206
26213
  children: [jsx(FormHeader, {
26207
26214
  heading,
@@ -26216,18 +26223,24 @@ function CompanyStructureComponent({
26216
26223
  useLabelElement: false,
26217
26224
  errorMessage: formUtils.getErrorMessage("entityType", formErrors, formFieldProblems),
26218
26225
  classNameModifiers: ["entityType"],
26219
- children: (childProps) => jsx(RadioGroupCard, {
26226
+ children: (childProps) => jsx(EntityTypeRadioGroupCard, {
26220
26227
  ...childProps,
26221
26228
  "aria-required": true,
26222
26229
  "aria-label": formUtils.getLabel("entityType", "whatTypeOfCompanyDoYouHave"),
26223
26230
  "aria-invalid": !formValid.entityType,
26224
26231
  name: "entityType",
26225
26232
  items: companyTypeOptions,
26226
- selected: companyTypeOptions.find((type) => type.id === (formData == null ? void 0 : formData.entityType)),
26233
+ selected: companyTypeOptions.find((type) => type.id === formData.entityType),
26227
26234
  readonly: disabled,
26228
- isItemDisabled: () => disabled,
26229
- onSelect: (item) => handleChangeFor("entityType")(item.id)
26235
+ onSelect: (item) => handleChangeFor("entityType")(item.id),
26236
+ examples: companyTypeExamples2
26230
26237
  })
26238
+ }), !isNewEntryFlowEnabled && country2 && jsx(AccountHolder, {
26239
+ ...accountHolderProps,
26240
+ dataStoreId: id2,
26241
+ legalEntityType: LegalEntityType.ORGANIZATION,
26242
+ country: country2,
26243
+ onChange: (value) => handleChangeFor("accountHolder")(value.data.accountHolder)
26231
26244
  })]
26232
26245
  });
26233
26246
  }
@@ -26495,7 +26508,7 @@ const mapApiDocumentToCompanySearchDocuments = (entityId) => {
26495
26508
  } : void 0
26496
26509
  };
26497
26510
  };
26498
- const mapLegalEntityToCompanySearchSchema = (legalEntity) => {
26511
+ const mapLegalEntityToCompanySearchSchema = (legalEntity, isChangingType) => {
26499
26512
  const companySearchSchema = {
26500
26513
  companyBasics: {},
26501
26514
  companyRegistrationAddress: {},
@@ -26540,7 +26553,10 @@ const mapLegalEntityToCompanySearchSchema = (legalEntity) => {
26540
26553
  case "companyStructure": {
26541
26554
  return {
26542
26555
  ...componentData,
26543
- [key]: value
26556
+ [key]: {
26557
+ ...value,
26558
+ accountHolder: getDefaultAccountHolderType(legalEntity, isChangingType)
26559
+ }
26544
26560
  };
26545
26561
  }
26546
26562
  case "companyRegistrationDocument": {
@@ -26571,6 +26587,7 @@ function useCompanySearchTaskSubmit({
26571
26587
  legalEntityResponse,
26572
26588
  problems,
26573
26589
  baseTrackingPayload,
26590
+ isTargetLegalEntityType,
26574
26591
  documentUtils,
26575
26592
  setProblems,
26576
26593
  setLoadingStatus,
@@ -26632,7 +26649,7 @@ function useCompanySearchTaskSubmit({
26632
26649
  legalEntityName: ((_c = data.companyBasics) == null ? void 0 : _c.legalCompanyName) ?? null,
26633
26650
  usedAdditionalAddress: ((_d = data.companyRegistrationAddress) == null ? void 0 : _d.operationalAddressIsSame) === operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_NOT_SAME
26634
26651
  };
26635
- const savedLegalEntityData = mapLegalEntityToCompanySearchSchema(legalEntityResponse);
26652
+ const savedLegalEntityData = mapLegalEntityToCompanySearchSchema(legalEntityResponse, isTargetLegalEntityType);
26636
26653
  const filteredData = removeOldDataBySchema(data, savedLegalEntityData);
26637
26654
  const legalEntity = {
26638
26655
  ...mapCompanySearchSchemaToLegalEntity(filteredData),
@@ -26705,7 +26722,7 @@ function useCompanySearchTaskSubmit({
26705
26722
  };
26706
26723
  }
26707
26724
  function CompanySearchComponent(props) {
26708
- var _a, _b, _c, _d, _e;
26725
+ var _a, _b, _c, _d, _e, _f;
26709
26726
  const {
26710
26727
  i18n
26711
26728
  } = useI18nContext();
@@ -26721,12 +26738,14 @@ function CompanySearchComponent(props) {
26721
26738
  handleCompanyDeepSearch,
26722
26739
  handleGetCompanyDataset,
26723
26740
  handleRefreshCompanyDataset,
26724
- handleVerifyTin
26741
+ handleVerifyTin,
26742
+ onTypeSwitch
26725
26743
  } = props;
26726
26744
  const globalData = useGlobalData();
26727
26745
  const [kompanyAddress, setKompanyAddress] = useState();
26728
26746
  const [kompanyVerifiedData, setKompanyVerifiedData] = useState();
26729
26747
  const formWrapperClasses = (formId) => (activeForm == null ? void 0 : activeForm.formId) !== formId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper";
26748
+ this.customNavigationHandler = ((_a = globalData.companyStructure) == null ? void 0 : _a.accountHolder) === "myName" ? () => onTypeSwitch == null ? void 0 : onTypeSwitch(LegalEntityType.INDIVIDUAL) : null;
26730
26749
  return jsxs("div", {
26731
26750
  className: "adyen-kyc-company",
26732
26751
  children: [jsx("div", {
@@ -26736,7 +26755,7 @@ function CompanySearchComponent(props) {
26736
26755
  id: forms.companyBasics.formId,
26737
26756
  heading: i18n.get(forms.companyBasics.formName),
26738
26757
  country: country2,
26739
- companyType: (_a = globalData == null ? void 0 : globalData.companyStructure) == null ? void 0 : _a.entityType,
26758
+ companyType: (_b = globalData == null ? void 0 : globalData.companyStructure) == null ? void 0 : _b.entityType,
26740
26759
  isTopLevelEntity,
26741
26760
  baseTrackingPayload,
26742
26761
  handleCompanyIndexSearch,
@@ -26770,6 +26789,7 @@ function CompanySearchComponent(props) {
26770
26789
  id: forms.companyStructure.formId,
26771
26790
  heading: i18n.get(forms.companyStructure.formName),
26772
26791
  description: i18n.get(forms.companyStructure.formDescription),
26792
+ country: country2,
26773
26793
  kompanyVerifiedData
26774
26794
  })
26775
26795
  }), jsx("div", {
@@ -26779,8 +26799,8 @@ function CompanySearchComponent(props) {
26779
26799
  id: forms.companyOtherDetails.formId,
26780
26800
  heading: i18n.get(forms.companyOtherDetails.formName),
26781
26801
  country: country2,
26782
- legalCompanyName: (_b = globalData == null ? void 0 : globalData.companyBasics) == null ? void 0 : _b.legalCompanyName,
26783
- companyType: (_c = globalData == null ? void 0 : globalData.companyStructure) == null ? void 0 : _c.entityType,
26802
+ legalCompanyName: (_c = globalData == null ? void 0 : globalData.companyBasics) == null ? void 0 : _c.legalCompanyName,
26803
+ companyType: (_d = globalData == null ? void 0 : globalData.companyStructure) == null ? void 0 : _d.entityType,
26784
26804
  kompanyVerifiedData
26785
26805
  })
26786
26806
  }), jsx("div", {
@@ -26791,7 +26811,7 @@ function CompanySearchComponent(props) {
26791
26811
  heading: forms.companyRegistrationDocument.formHeading,
26792
26812
  description: forms.companyRegistrationDocument.formDescription,
26793
26813
  country: country2,
26794
- companyType: (_d = globalData.companyStructure) == null ? void 0 : _d.entityType
26814
+ companyType: (_e = globalData.companyStructure) == null ? void 0 : _e.entityType
26795
26815
  })
26796
26816
  }), jsx("div", {
26797
26817
  className: formWrapperClasses(forms.companyTaxDocument.formId),
@@ -26801,7 +26821,7 @@ function CompanySearchComponent(props) {
26801
26821
  heading: forms.companyTaxDocument.formHeading,
26802
26822
  description: forms.companyTaxDocument.formDescription,
26803
26823
  country: country2,
26804
- companyType: (_e = globalData.companyStructure) == null ? void 0 : _e.entityType
26824
+ companyType: (_f = globalData.companyStructure) == null ? void 0 : _f.entityType
26805
26825
  }) : jsx(DocumentUpload, {
26806
26826
  ...getFormProps(props, forms.companyTaxDocument.formId),
26807
26827
  id: forms.companyTaxDocument.formId,
@@ -26833,6 +26853,7 @@ function CompanySearchDropinComponent({
26833
26853
  country: parentCountry,
26834
26854
  problems: propProblems,
26835
26855
  legalEntityResponse,
26856
+ isTargetLegalEntityType,
26836
26857
  parentLegalEntity,
26837
26858
  trackingConfig,
26838
26859
  eventEmitter,
@@ -26854,7 +26875,8 @@ function CompanySearchDropinComponent({
26854
26875
  handleCompanyDeepSearch,
26855
26876
  handleGetCompanyDataset,
26856
26877
  handleRefreshCompanyDataset,
26857
- handleVerifyTin
26878
+ handleVerifyTin,
26879
+ onTypeSwitch
26858
26880
  }) {
26859
26881
  var _a, _b, _c, _d;
26860
26882
  const {
@@ -26880,7 +26902,7 @@ function CompanySearchDropinComponent({
26880
26902
  isExperimentEnabled
26881
26903
  } = useExperimentsContext();
26882
26904
  const [loadingStatus, setLoadingStatus] = useState("success");
26883
- const [initialData, setInitialData] = useState(mapLegalEntityToCompanySearchSchema(legalEntityResponse));
26905
+ const [initialData, setInitialData] = useState(mapLegalEntityToCompanySearchSchema(legalEntityResponse, Boolean(isTargetLegalEntityType)));
26884
26906
  const country2 = useMemo(() => {
26885
26907
  var _a2;
26886
26908
  return ((_a2 = currentState.data.companyBasics) == null ? void 0 : _a2.country) ?? parentCountry;
@@ -26966,6 +26988,7 @@ function CompanySearchDropinComponent({
26966
26988
  legalEntityResponse,
26967
26989
  problems,
26968
26990
  baseTrackingPayload,
26991
+ isTargetLegalEntityType: Boolean(isTargetLegalEntityType),
26969
26992
  documentUtils,
26970
26993
  setProblems,
26971
26994
  setLoadingStatus,
@@ -27024,6 +27047,7 @@ function CompanySearchDropinComponent({
27024
27047
  activeForm,
27025
27048
  shouldValidate,
27026
27049
  isTopLevelEntity: taskType === TaskTypes.COMPANY_SEARCH,
27050
+ onTypeSwitch,
27027
27051
  baseTrackingPayload,
27028
27052
  handleAddressSearch,
27029
27053
  handleFindAddress,
@@ -33468,7 +33492,9 @@ function DropinComposerComponent({
33468
33492
  handleCompanyDeepSearch: args.handleCompanyDeepSearch,
33469
33493
  handleGetCompanyDataset: args.handleGetCompanyDataset,
33470
33494
  handleRefreshCompanyDataset: args.handleRefreshCompanyDataset,
33471
- handleVerifyTin: args.handleVerifyTin
33495
+ handleVerifyTin: args.handleVerifyTin,
33496
+ onTypeSwitch: navigateToTypeSwitcher,
33497
+ isTargetLegalEntityType: legalEntityType === LegalEntityType.ORGANIZATION
33472
33498
  });
33473
33499
  case TaskTypes.TRUST_MEMBER_COMPANY:
33474
33500
  return jsx(CompanyDropinComponent, {
@@ -35448,7 +35474,7 @@ const ConfigurationApiProvider = ({
35448
35474
  isEmbeddedDropin,
35449
35475
  loadingContext
35450
35476
  } = authContext;
35451
- const sdkVersion = "3.11.0";
35477
+ const sdkVersion = "3.11.2";
35452
35478
  useAnalytics({
35453
35479
  onUserEvent,
35454
35480
  legalEntityId: rootLegalEntityId,
package/dist/style.css CHANGED
@@ -80083,6 +80083,8 @@ a.adl-button:disabled, a.adl-button.adl-button--disabled {
80083
80083
  padding-bottom: 4px;
80084
80084
  }
80085
80085
  .adyen-company-lookup-results-list__result-option {
80086
+ display: flex;
80087
+ justify-content: space-between;
80086
80088
  background-color: #fff;
80087
80089
  box-shadow: 0 1px 1px rgba(0, 17, 44, 0.12), 0 1px 3px rgba(0, 17, 44, 0.14);
80088
80090
  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": "3.11.0",
3
+ "version": "3.11.2",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "files": [