@adyen/kyc-components 3.11.0 → 3.11.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.
@@ -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,
@@ -26143,8 +26148,9 @@ const CompanyStructureValidation = {
26143
26148
  }
26144
26149
  };
26145
26150
  const COMPANY_STRUCTURE_FORM_ID = "companyStructure";
26146
- const companyStructureFields = ["entityType"];
26151
+ const companyStructureFields = ["entityType", "accountHolder"];
26147
26152
  function CompanyStructureComponent({
26153
+ id: id2,
26148
26154
  data,
26149
26155
  labels: labels2,
26150
26156
  heading,
@@ -26152,7 +26158,9 @@ function CompanyStructureComponent({
26152
26158
  formVerificationErrors,
26153
26159
  fieldValidationErrors,
26154
26160
  requiredFields,
26155
- kompanyVerifiedData
26161
+ country: country2,
26162
+ kompanyVerifiedData,
26163
+ ...props
26156
26164
  }) {
26157
26165
  var _a;
26158
26166
  const {
@@ -26202,6 +26210,19 @@ function CompanyStructureComponent({
26202
26210
  });
26203
26211
  }, [formSchema, formData, formErrors, formValid, formFieldProblems, updateStateSlice]);
26204
26212
  const companyTypeOptions = isNewEntryFlowEnabled ? companyTypes.filter((companyType2) => companyType2.id !== CompanyTypesValue.INCORPORATED_PARTNERSHIP && companyType2.id !== CompanyTypesValue.INCORPORATED_ASSOCIATION) : companyTypes;
26213
+ const companyTypeExamples2 = useCompanyTypeExamples(country2);
26214
+ const accountHolderProps = getFieldProps({
26215
+ id: id2,
26216
+ data,
26217
+ labels: labels2,
26218
+ heading,
26219
+ description: description2,
26220
+ formVerificationErrors,
26221
+ fieldValidationErrors,
26222
+ requiredFields,
26223
+ country: country2,
26224
+ ...props
26225
+ }, accountHolderFields);
26205
26226
  return jsxs("form", {
26206
26227
  children: [jsx(FormHeader, {
26207
26228
  heading,
@@ -26216,18 +26237,24 @@ function CompanyStructureComponent({
26216
26237
  useLabelElement: false,
26217
26238
  errorMessage: formUtils.getErrorMessage("entityType", formErrors, formFieldProblems),
26218
26239
  classNameModifiers: ["entityType"],
26219
- children: (childProps) => jsx(RadioGroupCard, {
26240
+ children: (childProps) => jsx(EntityTypeRadioGroupCard, {
26220
26241
  ...childProps,
26221
26242
  "aria-required": true,
26222
26243
  "aria-label": formUtils.getLabel("entityType", "whatTypeOfCompanyDoYouHave"),
26223
26244
  "aria-invalid": !formValid.entityType,
26224
26245
  name: "entityType",
26225
26246
  items: companyTypeOptions,
26226
- selected: companyTypeOptions.find((type) => type.id === (formData == null ? void 0 : formData.entityType)),
26247
+ selected: companyTypeOptions.find((type) => type.id === formData.entityType),
26227
26248
  readonly: disabled,
26228
- isItemDisabled: () => disabled,
26229
- onSelect: (item) => handleChangeFor("entityType")(item.id)
26249
+ onSelect: (item) => handleChangeFor("entityType")(item.id),
26250
+ examples: companyTypeExamples2
26230
26251
  })
26252
+ }), !isNewEntryFlowEnabled && country2 && jsx(AccountHolder, {
26253
+ ...accountHolderProps,
26254
+ dataStoreId: id2,
26255
+ legalEntityType: LegalEntityType.ORGANIZATION,
26256
+ country: country2,
26257
+ onChange: (value) => handleChangeFor("accountHolder")(value.data.accountHolder)
26231
26258
  })]
26232
26259
  });
26233
26260
  }
@@ -26495,7 +26522,7 @@ const mapApiDocumentToCompanySearchDocuments = (entityId) => {
26495
26522
  } : void 0
26496
26523
  };
26497
26524
  };
26498
- const mapLegalEntityToCompanySearchSchema = (legalEntity) => {
26525
+ const mapLegalEntityToCompanySearchSchema = (legalEntity, isChangingType) => {
26499
26526
  const companySearchSchema = {
26500
26527
  companyBasics: {},
26501
26528
  companyRegistrationAddress: {},
@@ -26540,7 +26567,10 @@ const mapLegalEntityToCompanySearchSchema = (legalEntity) => {
26540
26567
  case "companyStructure": {
26541
26568
  return {
26542
26569
  ...componentData,
26543
- [key]: value
26570
+ [key]: {
26571
+ ...value,
26572
+ accountHolder: getDefaultAccountHolderType(legalEntity, isChangingType)
26573
+ }
26544
26574
  };
26545
26575
  }
26546
26576
  case "companyRegistrationDocument": {
@@ -26571,6 +26601,7 @@ function useCompanySearchTaskSubmit({
26571
26601
  legalEntityResponse,
26572
26602
  problems,
26573
26603
  baseTrackingPayload,
26604
+ isTargetLegalEntityType,
26574
26605
  documentUtils,
26575
26606
  setProblems,
26576
26607
  setLoadingStatus,
@@ -26632,7 +26663,7 @@ function useCompanySearchTaskSubmit({
26632
26663
  legalEntityName: ((_c = data.companyBasics) == null ? void 0 : _c.legalCompanyName) ?? null,
26633
26664
  usedAdditionalAddress: ((_d = data.companyRegistrationAddress) == null ? void 0 : _d.operationalAddressIsSame) === operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_NOT_SAME
26634
26665
  };
26635
- const savedLegalEntityData = mapLegalEntityToCompanySearchSchema(legalEntityResponse);
26666
+ const savedLegalEntityData = mapLegalEntityToCompanySearchSchema(legalEntityResponse, isTargetLegalEntityType);
26636
26667
  const filteredData = removeOldDataBySchema(data, savedLegalEntityData);
26637
26668
  const legalEntity = {
26638
26669
  ...mapCompanySearchSchemaToLegalEntity(filteredData),
@@ -26705,7 +26736,7 @@ function useCompanySearchTaskSubmit({
26705
26736
  };
26706
26737
  }
26707
26738
  function CompanySearchComponent(props) {
26708
- var _a, _b, _c, _d, _e;
26739
+ var _a, _b, _c, _d, _e, _f;
26709
26740
  const {
26710
26741
  i18n
26711
26742
  } = useI18nContext();
@@ -26721,12 +26752,14 @@ function CompanySearchComponent(props) {
26721
26752
  handleCompanyDeepSearch,
26722
26753
  handleGetCompanyDataset,
26723
26754
  handleRefreshCompanyDataset,
26724
- handleVerifyTin
26755
+ handleVerifyTin,
26756
+ onTypeSwitch
26725
26757
  } = props;
26726
26758
  const globalData = useGlobalData();
26727
26759
  const [kompanyAddress, setKompanyAddress] = useState();
26728
26760
  const [kompanyVerifiedData, setKompanyVerifiedData] = useState();
26729
26761
  const formWrapperClasses = (formId) => (activeForm == null ? void 0 : activeForm.formId) !== formId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper";
26762
+ this.customNavigationHandler = ((_a = globalData.companyStructure) == null ? void 0 : _a.accountHolder) === "myName" ? () => onTypeSwitch == null ? void 0 : onTypeSwitch(LegalEntityType.INDIVIDUAL) : null;
26730
26763
  return jsxs("div", {
26731
26764
  className: "adyen-kyc-company",
26732
26765
  children: [jsx("div", {
@@ -26736,7 +26769,7 @@ function CompanySearchComponent(props) {
26736
26769
  id: forms.companyBasics.formId,
26737
26770
  heading: i18n.get(forms.companyBasics.formName),
26738
26771
  country: country2,
26739
- companyType: (_a = globalData == null ? void 0 : globalData.companyStructure) == null ? void 0 : _a.entityType,
26772
+ companyType: (_b = globalData == null ? void 0 : globalData.companyStructure) == null ? void 0 : _b.entityType,
26740
26773
  isTopLevelEntity,
26741
26774
  baseTrackingPayload,
26742
26775
  handleCompanyIndexSearch,
@@ -26770,6 +26803,7 @@ function CompanySearchComponent(props) {
26770
26803
  id: forms.companyStructure.formId,
26771
26804
  heading: i18n.get(forms.companyStructure.formName),
26772
26805
  description: i18n.get(forms.companyStructure.formDescription),
26806
+ country: country2,
26773
26807
  kompanyVerifiedData
26774
26808
  })
26775
26809
  }), jsx("div", {
@@ -26779,8 +26813,8 @@ function CompanySearchComponent(props) {
26779
26813
  id: forms.companyOtherDetails.formId,
26780
26814
  heading: i18n.get(forms.companyOtherDetails.formName),
26781
26815
  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,
26816
+ legalCompanyName: (_c = globalData == null ? void 0 : globalData.companyBasics) == null ? void 0 : _c.legalCompanyName,
26817
+ companyType: (_d = globalData == null ? void 0 : globalData.companyStructure) == null ? void 0 : _d.entityType,
26784
26818
  kompanyVerifiedData
26785
26819
  })
26786
26820
  }), jsx("div", {
@@ -26791,7 +26825,7 @@ function CompanySearchComponent(props) {
26791
26825
  heading: forms.companyRegistrationDocument.formHeading,
26792
26826
  description: forms.companyRegistrationDocument.formDescription,
26793
26827
  country: country2,
26794
- companyType: (_d = globalData.companyStructure) == null ? void 0 : _d.entityType
26828
+ companyType: (_e = globalData.companyStructure) == null ? void 0 : _e.entityType
26795
26829
  })
26796
26830
  }), jsx("div", {
26797
26831
  className: formWrapperClasses(forms.companyTaxDocument.formId),
@@ -26801,7 +26835,7 @@ function CompanySearchComponent(props) {
26801
26835
  heading: forms.companyTaxDocument.formHeading,
26802
26836
  description: forms.companyTaxDocument.formDescription,
26803
26837
  country: country2,
26804
- companyType: (_e = globalData.companyStructure) == null ? void 0 : _e.entityType
26838
+ companyType: (_f = globalData.companyStructure) == null ? void 0 : _f.entityType
26805
26839
  }) : jsx(DocumentUpload, {
26806
26840
  ...getFormProps(props, forms.companyTaxDocument.formId),
26807
26841
  id: forms.companyTaxDocument.formId,
@@ -26833,6 +26867,7 @@ function CompanySearchDropinComponent({
26833
26867
  country: parentCountry,
26834
26868
  problems: propProblems,
26835
26869
  legalEntityResponse,
26870
+ isTargetLegalEntityType,
26836
26871
  parentLegalEntity,
26837
26872
  trackingConfig,
26838
26873
  eventEmitter,
@@ -26854,7 +26889,8 @@ function CompanySearchDropinComponent({
26854
26889
  handleCompanyDeepSearch,
26855
26890
  handleGetCompanyDataset,
26856
26891
  handleRefreshCompanyDataset,
26857
- handleVerifyTin
26892
+ handleVerifyTin,
26893
+ onTypeSwitch
26858
26894
  }) {
26859
26895
  var _a, _b, _c, _d;
26860
26896
  const {
@@ -26880,7 +26916,7 @@ function CompanySearchDropinComponent({
26880
26916
  isExperimentEnabled
26881
26917
  } = useExperimentsContext();
26882
26918
  const [loadingStatus, setLoadingStatus] = useState("success");
26883
- const [initialData, setInitialData] = useState(mapLegalEntityToCompanySearchSchema(legalEntityResponse));
26919
+ const [initialData, setInitialData] = useState(mapLegalEntityToCompanySearchSchema(legalEntityResponse, Boolean(isTargetLegalEntityType)));
26884
26920
  const country2 = useMemo(() => {
26885
26921
  var _a2;
26886
26922
  return ((_a2 = currentState.data.companyBasics) == null ? void 0 : _a2.country) ?? parentCountry;
@@ -26966,6 +27002,7 @@ function CompanySearchDropinComponent({
26966
27002
  legalEntityResponse,
26967
27003
  problems,
26968
27004
  baseTrackingPayload,
27005
+ isTargetLegalEntityType: Boolean(isTargetLegalEntityType),
26969
27006
  documentUtils,
26970
27007
  setProblems,
26971
27008
  setLoadingStatus,
@@ -27024,6 +27061,7 @@ function CompanySearchDropinComponent({
27024
27061
  activeForm,
27025
27062
  shouldValidate,
27026
27063
  isTopLevelEntity: taskType === TaskTypes.COMPANY_SEARCH,
27064
+ onTypeSwitch,
27027
27065
  baseTrackingPayload,
27028
27066
  handleAddressSearch,
27029
27067
  handleFindAddress,
@@ -33468,7 +33506,9 @@ function DropinComposerComponent({
33468
33506
  handleCompanyDeepSearch: args.handleCompanyDeepSearch,
33469
33507
  handleGetCompanyDataset: args.handleGetCompanyDataset,
33470
33508
  handleRefreshCompanyDataset: args.handleRefreshCompanyDataset,
33471
- handleVerifyTin: args.handleVerifyTin
33509
+ handleVerifyTin: args.handleVerifyTin,
33510
+ onTypeSwitch: navigateToTypeSwitcher,
33511
+ isTargetLegalEntityType: legalEntityType === LegalEntityType.ORGANIZATION
33472
33512
  });
33473
33513
  case TaskTypes.TRUST_MEMBER_COMPANY:
33474
33514
  return jsx(CompanyDropinComponent, {
@@ -35448,7 +35488,7 @@ const ConfigurationApiProvider = ({
35448
35488
  isEmbeddedDropin,
35449
35489
  loadingContext
35450
35490
  } = authContext;
35451
- const sdkVersion = "3.11.0";
35491
+ const sdkVersion = "3.11.1";
35452
35492
  useAnalytics({
35453
35493
  onUserEvent,
35454
35494
  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.1",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "files": [