@adyen/kyc-components 2.19.0 → 2.19.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.
@@ -8919,7 +8919,9 @@ function getAvailableAccountHolderOptions(legalEntityType, isChangeOfLegalEntity
8919
8919
  return [];
8920
8920
  }
8921
8921
  }
8922
+ const capabilitiesToPreventTypeChange = ["receivePayments", "issueCard", "useCard", "withdrawFromAtm", "withdrawFromAtmInRestrictedCountries", "receiveFromTransferInstrument", "useCardInRestrictedCountries", "useCardInRestrictedIndustries", "issueBankAccount", "sendToThirdParty", "receiveFromThirdParty", "getGrantOffers", "receiveGrants"];
8922
8923
  function AccountHolder(props) {
8924
+ var _a;
8923
8925
  const {
8924
8926
  i18n
8925
8927
  } = useI18nContext();
@@ -8939,7 +8941,21 @@ function AccountHolder(props) {
8939
8941
  const {
8940
8942
  isExperimentEnabled
8941
8943
  } = useExperimentsContext();
8942
- const defaultData = cloneObject(props.data);
8944
+ const isChangeToMyNameAllowed = !(capabilities == null ? void 0 : capabilities.map((c) => c.replace("Commercial", "").replace("Consumer", "")).some((c) => capabilitiesToPreventTypeChange.includes(c)));
8945
+ const accountHolderOptions = getAvailableAccountHolderOptions(props.legalEntityType, isSettingEnabled(SettingNames.AllowLegalEntityTypeChange), isExperimentEnabled("EnableTrustFlow") && TRUST_COUNTRIES.includes(props.country), SOLE_PROP_COUNTRIES.includes(props.country), isChangeToMyNameAllowed).map((accountHolderOption) => ({
8946
+ id: accountHolderOption,
8947
+ name: i18n.get(accountHolderOption),
8948
+ description: i18n.get(`${accountHolderOption}Description`)
8949
+ }));
8950
+ const isDefaultOptionAvailable = Boolean(accountHolderOptions == null ? void 0 : accountHolderOptions.find(({
8951
+ id: id2
8952
+ }) => {
8953
+ var _a2;
8954
+ return id2 === ((_a2 = props.data) == null ? void 0 : _a2.accountHolder);
8955
+ }));
8956
+ const defaultData = {
8957
+ accountHolder: isDefaultOptionAvailable ? (_a = props.data) == null ? void 0 : _a.accountHolder : void 0
8958
+ };
8943
8959
  if (isExperimentEnabled("EnableNewEntryFlow") && defaultData) {
8944
8960
  defaultData.accountHolder = accountHolder2 || defaultData.accountHolder;
8945
8961
  }
@@ -8957,8 +8973,8 @@ function AccountHolder(props) {
8957
8973
  fieldProblems: props == null ? void 0 : props.fieldValidationErrors
8958
8974
  });
8959
8975
  useEffect(() => {
8960
- var _a, _b;
8961
- (_b = (_a = stateRef.current) == null ? void 0 : _a.setState) == null ? void 0 : _b.call(_a, {
8976
+ var _a2, _b;
8977
+ (_b = (_a2 = stateRef.current) == null ? void 0 : _a2.setState) == null ? void 0 : _b.call(_a2, {
8962
8978
  type: "addToState",
8963
8979
  value: {
8964
8980
  data,
@@ -8971,13 +8987,6 @@ function AccountHolder(props) {
8971
8987
  }, [data, errors, valid, dataStoreId]);
8972
8988
  const formUtils = formUtilities(props, i18n);
8973
8989
  const questionLabel = i18n.get("nameOfBankAccountHolder");
8974
- const capabilitiesToPreventTypeChange = ["receivePayments", "issueCard", "useCard", "withdrawFromAtm", "withdrawFromAtmInRestrictedCountries", "receiveFromTransferInstrument", "useCardInRestrictedCountries", "useCardInRestrictedIndustries", "issueBankAccount", "sendToThirdParty", "receiveFromThirdParty", "getGrantOffers", "receiveGrants"];
8975
- const isChangeToMyNameAllowed = !(capabilities == null ? void 0 : capabilities.map((c) => c.replace("Commercial", "").replace("Consumer", "")).some((c) => capabilitiesToPreventTypeChange.includes(c)));
8976
- const accountHolderOptions = getAvailableAccountHolderOptions(props.legalEntityType, isSettingEnabled(SettingNames.AllowLegalEntityTypeChange), isExperimentEnabled("EnableTrustFlow") && TRUST_COUNTRIES.includes(props.country), SOLE_PROP_COUNTRIES.includes(props.country), isChangeToMyNameAllowed).map((accountHolderOption) => ({
8977
- id: accountHolderOption,
8978
- name: i18n.get(accountHolderOption),
8979
- description: i18n.get(`${accountHolderOption}Description`)
8980
- }));
8981
8990
  return jsxs("div", {
8982
8991
  children: [jsx(StateContextSetter, {
8983
8992
  stateRef
@@ -9226,7 +9235,7 @@ function CompanyTypeComponent(props) {
9226
9235
  "aria-label": formUtils.getLabel("entityType", "whatTypeOfCompanyDoYouHave"),
9227
9236
  "aria-invalid": !valid.entityType
9228
9237
  })
9229
- }), formUtils.isRequiredField("accountHolder") && jsx(AccountHolder, {
9238
+ }), formUtils.isRequiredField("accountHolder") && props.country && jsx(AccountHolder, {
9230
9239
  ...accountHolderProps,
9231
9240
  dataStoreId: COMPANY_TYPE_ID,
9232
9241
  legalEntityType: LegalEntityType.ORGANIZATION,
@@ -15941,7 +15950,7 @@ function PersonalDetailsComponent(props) {
15941
15950
  "aria-label": formUtils.getLabel("jobTitle"),
15942
15951
  "aria-invalid": !valid.birthDate
15943
15952
  })
15944
- }), formUtils.isRequiredField("accountHolder") && jsx(AccountHolder, {
15953
+ }), formUtils.isRequiredField("accountHolder") && data.residencyCountry && jsx(AccountHolder, {
15945
15954
  ...accountHolderProps,
15946
15955
  country: data.residencyCountry,
15947
15956
  dataStoreId: PERSONAL_DETAILS,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adyen/kyc-components",
3
- "version": "2.19.0",
3
+ "version": "2.19.1",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "files": [