@adyen/kyc-components 2.38.0 → 2.38.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.
@@ -304,6 +304,7 @@ const pciDssQuestionnaire = "PCI DSS questionnaire";
304
304
  const serviceAgreementSignedSuccessfully = "Service agreement signed successfully";
305
305
  const serviceAgreementSignFailed = "Service agreement signing failed";
306
306
  const failedToGetServiceAgreementStatus = "Failed to get the service agreement status";
307
+ const failedToFetchAcceptedByName = "Failed to get the legal entity that accepted service agreement";
307
308
  const failedToGetServiceAgreement = "Failed to get the service agreement";
308
309
  const failedToGetServiceAgreementInSelectedLanguageFallbackToEn = "Failed to get the service agreement in the selected language. Falling back to English.";
309
310
  const iHaveReadAndIAcceptTheseTerms = "I have read and I accept these terms and confirm that I am a legal representative authorized to accept these terms on behalf of the company. I have taken notice of the privacy statement (www.adyen.com/policies-and-disclaimer/privacy-policy) and I consent to my (personal) data being used for the purposes described therein.";
@@ -1561,6 +1562,7 @@ const defaultTrans = {
1561
1562
  serviceAgreementSignedSuccessfully,
1562
1563
  serviceAgreementSignFailed,
1563
1564
  failedToGetServiceAgreementStatus,
1565
+ failedToFetchAcceptedByName,
1564
1566
  failedToGetServiceAgreement,
1565
1567
  failedToGetServiceAgreementInSelectedLanguageFallbackToEn,
1566
1568
  iHaveReadAndIAcceptTheseTerms,
@@ -26979,6 +26981,28 @@ const useHasSeenSingpassSelection = ({
26979
26981
  setHasSeenSingpassSelection
26980
26982
  };
26981
26983
  };
26984
+ const useShouldShowSingpass = ({
26985
+ isExperimentEnabled = false,
26986
+ legalEntity,
26987
+ accountHolder: accountHolder2,
26988
+ handleOpenSingpassAuthorizationLink
26989
+ }) => {
26990
+ const shouldShowSingpassForAccountHolder = (newAccountHolder) => {
26991
+ if (!isExperimentEnabled) {
26992
+ return false;
26993
+ }
26994
+ const country2 = getLegalEntityCountry(legalEntity);
26995
+ const isSingpassEnabled = Boolean(handleOpenSingpassAuthorizationLink && country2 === CountryCodes.Singapore);
26996
+ if (newAccountHolder) {
26997
+ return isSingpassEnabled && newAccountHolder === "theCompanyIWorkFor";
26998
+ }
26999
+ return isSingpassEnabled && (legalEntity == null ? void 0 : legalEntity.type) === LegalEntityType.ORGANIZATION;
27000
+ };
27001
+ return {
27002
+ shouldShowSingpass: shouldShowSingpassForAccountHolder(accountHolder2),
27003
+ shouldShowSingpassForAccountHolder
27004
+ };
27005
+ };
26982
27006
  const logger$b = createLogger("useAssociatedLegalArrangement");
26983
27007
  function useAssociatedLegalArrangement({
26984
27008
  rootLegalEntity,
@@ -29016,7 +29040,6 @@ const SingpassSelection = (props) => {
29016
29040
  });
29017
29041
  const methodsMetadata = getSetupAccountMethodMetadata();
29018
29042
  return jsx("div", {
29019
- className: "adl-u-display-flex adl-u-justify-content-center",
29020
29043
  children: jsxs("div", {
29021
29044
  className: "adyen-kyc-singpass-selection",
29022
29045
  children: [jsx("header", {
@@ -32711,17 +32734,27 @@ function DropinComposerComponent({
32711
32734
  });
32712
32735
  const [tasks, setTasks] = useState([]);
32713
32736
  const [rootLegalEntity, setRootLegalEntity] = useState(legalEntityResponse);
32714
- const rootLegalEntityCountry = rootLegalEntity.type === LegalEntityType.INDIVIDUAL ? rootLegalEntity.individual.residentialAddress.country : rootLegalEntity.organization.registeredAddress.country;
32715
- const isSoleProp = accountHolder2 === "mySoleProprietorName" || hasSolePropInLegalEntity(legalEntityResponse);
32716
- const isSingpassEnabled = rootLegalEntityCountry === CountryCodes.Singapore && isSingpassExperimentEnabled && !hasSeenSingpassSelection;
32717
- const shouldShowSingpass = isSingpassEnabled && (isSoleProp || legalEntityResponse.type === LegalEntityType.ORGANIZATION);
32737
+ const rootLegalEntityCountry = getLegalEntityCountry(rootLegalEntity);
32738
+ const {
32739
+ handleOpenSingpassAuthorizationLink
32740
+ } = args;
32741
+ const {
32742
+ shouldShowSingpass,
32743
+ shouldShowSingpassForAccountHolder
32744
+ } = useShouldShowSingpass({
32745
+ isExperimentEnabled: isSingpassExperimentEnabled,
32746
+ legalEntity: legalEntityResponse,
32747
+ accountHolder: accountHolder2,
32748
+ handleOpenSingpassAuthorizationLink
32749
+ });
32750
+ const shouldShowSingpassSelection = shouldShowSingpass && !hasSeenSingpassSelection;
32718
32751
  const initialTask = useMemo(() => {
32719
32752
  if (isNewEntryFlowEnabled && (!accountHolder2 || legalEntityResponse.id !== leId)) {
32720
32753
  return TaskTypes.BUSINESS_TYPE_SELECTION;
32721
32754
  }
32722
32755
  if (showIntroduction)
32723
32756
  return TaskTypes.INTRODUCTION;
32724
- if (isSingpassEnabled)
32757
+ if (shouldShowSingpassSelection)
32725
32758
  return TaskTypes.SINGPASS_SELECTION;
32726
32759
  return TaskTypes.TASKS_OVERVIEW;
32727
32760
  }, [showIntroduction, isNewEntryFlowEnabled, accountHolder2, legalEntityResponse, leId]);
@@ -32805,11 +32838,19 @@ function DropinComposerComponent({
32805
32838
  getPciTemplate().catch(logger$8.error);
32806
32839
  }, [getPciTemplate, tasks]);
32807
32840
  const addFetchedAcceptedByName = async (acceptanceInfo) => {
32808
- const acceptedByEntity = await (args == null ? void 0 : args.handleGetLegalEntity(acceptanceInfo.acceptedBy));
32809
- return {
32810
- ...acceptanceInfo,
32811
- acceptedByName: getLegalEntityNameBasedOnType(acceptedByEntity)
32812
- };
32841
+ try {
32842
+ const acceptedByEntity = await (args == null ? void 0 : args.handleGetLegalEntity(acceptanceInfo.acceptedBy));
32843
+ return {
32844
+ ...acceptanceInfo,
32845
+ acceptedByName: getLegalEntityNameBasedOnType(acceptedByEntity)
32846
+ };
32847
+ } catch (e) {
32848
+ logger$8.warn(i18n.get("failedToFetchAcceptedByName"));
32849
+ return {
32850
+ ...acceptanceInfo,
32851
+ acceptedByName: null
32852
+ };
32853
+ }
32813
32854
  };
32814
32855
  const getServiceAgreementAcceptanceInfos = async () => {
32815
32856
  if (rootLegalEntity.id && (args == null ? void 0 : args.handleGetServiceAgreementAcceptanceInfos)) {
@@ -33003,10 +33044,7 @@ function DropinComposerComponent({
33003
33044
  }
33004
33045
  };
33005
33046
  const handleSingpassSelectionNextClick = async (method) => {
33006
- const {
33007
- handleOpenSingpassAuthorizationLink
33008
- } = args;
33009
- if (method === "singpass" && handleOpenSingpassAuthorizationLink) {
33047
+ if (method === "singpass" && shouldShowSingpass) {
33010
33048
  try {
33011
33049
  const {
33012
33050
  item: {
@@ -33292,7 +33330,7 @@ function DropinComposerComponent({
33292
33330
  onNavigateTo(TaskTypes.INTRODUCTION);
33293
33331
  return;
33294
33332
  }
33295
- if (isSingpassEnabled && newAccountHolder === "theCompanyIWorkFor" || newAccountHolder === "mySoleProprietorName") {
33333
+ if (shouldShowSingpassForAccountHolder(newAccountHolder) && !hasSeenSingpassSelection) {
33296
33334
  onNavigateTo(TaskTypes.SINGPASS_SELECTION);
33297
33335
  return;
33298
33336
  }
@@ -33316,7 +33354,7 @@ function DropinComposerComponent({
33316
33354
  legalEntity: rootLegalEntity,
33317
33355
  onExitIntroduction: () => {
33318
33356
  setHasSeenIntroduction(true);
33319
- if (shouldShowSingpass) {
33357
+ if (shouldShowSingpassSelection) {
33320
33358
  onNavigateTo(TaskTypes.SINGPASS_SELECTION);
33321
33359
  return;
33322
33360
  }
@@ -34860,7 +34898,7 @@ const ConfigurationApiProvider = ({
34860
34898
  isEmbeddedDropin,
34861
34899
  loadingContext
34862
34900
  } = authContext;
34863
- const sdkVersion = "2.38.0";
34901
+ const sdkVersion = "2.38.2";
34864
34902
  useAnalytics({
34865
34903
  onUserEvent,
34866
34904
  legalEntityId: rootLegalEntityId,
package/dist/style.css CHANGED
@@ -85917,7 +85917,8 @@ a.adl-button:disabled, a.adl-button.adl-button--disabled {
85917
85917
  /* #region Inline components */
85918
85918
  /* #endregion */
85919
85919
  .adyen-kyc-business-type-selection {
85920
- max-width: 544px;
85920
+ margin-left: auto;
85921
+ margin-right: auto;
85921
85922
  }
85922
85923
  .adyen-kyc-business-type-selection__nav {
85923
85924
  margin-top: 32px;
@@ -99765,6 +99766,8 @@ a.adl-button:disabled, a.adl-button.adl-button--disabled {
99765
99766
  /* #endregion */
99766
99767
  .adyen-kyc-singpass-selection {
99767
99768
  max-width: 544px;
99769
+ margin-left: auto;
99770
+ margin-right: auto;
99768
99771
  }
99769
99772
  .adyen-kyc-singpass-selection__nav {
99770
99773
  margin-top: 32px;
@@ -107351,6 +107354,9 @@ a.adl-button:disabled, a.adl-button.adl-button--disabled {
107351
107354
  .adyen-task-list-group__header .adl-heading {
107352
107355
  font-weight: 500;
107353
107356
  }
107357
+ .adyen-task-list-group > .adl-card__body {
107358
+ padding: 16px 0;
107359
+ }
107354
107360
  .adyen-task-list-group + .adyen-task-list-group {
107355
107361
  margin-top: 16px;
107356
107362
  }/* #region Spacing */
@@ -11,7 +11,7 @@ export interface ServiceAgreementAcceptanceInfo {
11
11
  type: ServiceAgreementType;
12
12
  }
13
13
  export interface ServiceAgreementAcceptanceInfoWithName extends ServiceAgreementAcceptanceInfo {
14
- acceptedByName: string;
14
+ acceptedByName?: string;
15
15
  }
16
16
  export interface ServiceAgreementSchema {
17
17
  signer?: string;
@@ -20,7 +20,7 @@ interface SingpassLinkResponseItem {
20
20
  authUrl: string;
21
21
  success: boolean;
22
22
  }
23
- interface SingpassLinkResponse {
23
+ export interface SingpassLinkResponse {
24
24
  item: SingpassLinkResponseItem;
25
25
  }
26
26
  export interface DropinComposerProps extends DropinAPIHandlers, BasicComponentProps {
@@ -0,0 +1,14 @@
1
+ import { SingpassLinkResponse } from '../../../components/Dropins/types';
2
+ import { AccountHolderOption } from '../../../components/internal/AccountHolder/types';
3
+ import { ExistingLegalEntity } from '../../models/api/legal-entity';
4
+ interface UseShouldShowSingpassProps {
5
+ isExperimentEnabled: boolean;
6
+ legalEntity: ExistingLegalEntity;
7
+ accountHolder?: AccountHolderOption;
8
+ handleOpenSingpassAuthorizationLink?: () => Promise<SingpassLinkResponse>;
9
+ }
10
+ export declare const useShouldShowSingpass: ({ isExperimentEnabled, legalEntity, accountHolder, handleOpenSingpassAuthorizationLink, }: UseShouldShowSingpassProps) => {
11
+ shouldShowSingpass: boolean;
12
+ shouldShowSingpassForAccountHolder: (newAccountHolder?: AccountHolderOption) => boolean;
13
+ };
14
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adyen/kyc-components",
3
- "version": "2.38.0",
3
+ "version": "2.38.2",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "files": [