@adyen/kyc-components 3.12.0 → 3.12.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.";
@@ -1580,6 +1581,7 @@ const defaultTrans = {
1580
1581
  serviceAgreementSignedSuccessfully,
1581
1582
  serviceAgreementSignFailed,
1582
1583
  failedToGetServiceAgreementStatus,
1584
+ failedToFetchAcceptedByName,
1583
1585
  failedToGetServiceAgreement,
1584
1586
  failedToGetServiceAgreementInSelectedLanguageFallbackToEn,
1585
1587
  iHaveReadAndIAcceptTheseTerms,
@@ -27229,6 +27231,28 @@ const useHasSeenSingpassSelection = ({
27229
27231
  setHasSeenSingpassSelection
27230
27232
  };
27231
27233
  };
27234
+ const useShouldShowSingpass = ({
27235
+ isExperimentEnabled = false,
27236
+ legalEntity,
27237
+ accountHolder: accountHolder2,
27238
+ handleOpenSingpassAuthorizationLink
27239
+ }) => {
27240
+ const shouldShowSingpassForAccountHolder = (newAccountHolder) => {
27241
+ if (!isExperimentEnabled) {
27242
+ return false;
27243
+ }
27244
+ const country2 = getLegalEntityCountry(legalEntity);
27245
+ const isSingpassEnabled = Boolean(handleOpenSingpassAuthorizationLink && country2 === CountryCodes.Singapore);
27246
+ if (newAccountHolder) {
27247
+ return isSingpassEnabled && newAccountHolder === "theCompanyIWorkFor";
27248
+ }
27249
+ return isSingpassEnabled && (legalEntity == null ? void 0 : legalEntity.type) === LegalEntityType.ORGANIZATION;
27250
+ };
27251
+ return {
27252
+ shouldShowSingpass: shouldShowSingpassForAccountHolder(accountHolder2),
27253
+ shouldShowSingpassForAccountHolder
27254
+ };
27255
+ };
27232
27256
  const logger$e = createLogger("useAssociatedLegalArrangement");
27233
27257
  function useAssociatedLegalArrangement({
27234
27258
  rootLegalEntity,
@@ -29286,7 +29310,6 @@ const SingpassSelection = (props) => {
29286
29310
  });
29287
29311
  const methodsMetadata = getSetupAccountMethodMetadata();
29288
29312
  return jsx("div", {
29289
- className: "adl-u-display-flex adl-u-justify-content-center",
29290
29313
  children: jsxs("div", {
29291
29314
  className: "adyen-kyc-singpass-selection",
29292
29315
  children: [jsx("header", {
@@ -32975,17 +32998,27 @@ function DropinComposerComponent({
32975
32998
  });
32976
32999
  const [tasks, setTasks] = useState([]);
32977
33000
  const [rootLegalEntity, setRootLegalEntity] = useState(legalEntityResponse);
32978
- const rootLegalEntityCountry = rootLegalEntity.type === LegalEntityType.INDIVIDUAL ? rootLegalEntity.individual.residentialAddress.country : rootLegalEntity.organization.registeredAddress.country;
32979
- const isSoleProp = accountHolder2 === "mySoleProprietorName" || hasSolePropInLegalEntity(legalEntityResponse);
32980
- const isSingpassEnabled = rootLegalEntityCountry === CountryCodes.Singapore && isSingpassExperimentEnabled && !hasSeenSingpassSelection;
32981
- const shouldShowSingpass = isSingpassEnabled && (isSoleProp || legalEntityResponse.type === LegalEntityType.ORGANIZATION);
33001
+ const rootLegalEntityCountry = getLegalEntityCountry(rootLegalEntity);
33002
+ const {
33003
+ handleOpenSingpassAuthorizationLink
33004
+ } = args;
33005
+ const {
33006
+ shouldShowSingpass,
33007
+ shouldShowSingpassForAccountHolder
33008
+ } = useShouldShowSingpass({
33009
+ isExperimentEnabled: isSingpassExperimentEnabled,
33010
+ legalEntity: legalEntityResponse,
33011
+ accountHolder: accountHolder2,
33012
+ handleOpenSingpassAuthorizationLink
33013
+ });
33014
+ const shouldShowSingpassSelection = shouldShowSingpass && !hasSeenSingpassSelection;
32982
33015
  const initialTask = useMemo(() => {
32983
33016
  if (isNewEntryFlowEnabled && (!accountHolder2 || legalEntityResponse.id !== leId)) {
32984
33017
  return TaskTypes.BUSINESS_TYPE_SELECTION;
32985
33018
  }
32986
33019
  if (showIntroduction)
32987
33020
  return TaskTypes.INTRODUCTION;
32988
- if (isSingpassEnabled)
33021
+ if (shouldShowSingpassSelection)
32989
33022
  return TaskTypes.SINGPASS_SELECTION;
32990
33023
  return TaskTypes.TASKS_OVERVIEW;
32991
33024
  }, [showIntroduction, isNewEntryFlowEnabled, accountHolder2, legalEntityResponse, leId]);
@@ -33069,11 +33102,19 @@ function DropinComposerComponent({
33069
33102
  getPciTemplate2().catch(logger$b.error);
33070
33103
  }, [getPciTemplate2, tasks]);
33071
33104
  const addFetchedAcceptedByName = async (acceptanceInfo) => {
33072
- const acceptedByEntity = await (args == null ? void 0 : args.handleGetLegalEntity(acceptanceInfo.acceptedBy));
33073
- return {
33074
- ...acceptanceInfo,
33075
- acceptedByName: getLegalEntityNameBasedOnType(acceptedByEntity)
33076
- };
33105
+ try {
33106
+ const acceptedByEntity = await (args == null ? void 0 : args.handleGetLegalEntity(acceptanceInfo.acceptedBy));
33107
+ return {
33108
+ ...acceptanceInfo,
33109
+ acceptedByName: getLegalEntityNameBasedOnType(acceptedByEntity)
33110
+ };
33111
+ } catch (e) {
33112
+ logger$b.warn(i18n.get("failedToFetchAcceptedByName"));
33113
+ return {
33114
+ ...acceptanceInfo,
33115
+ acceptedByName: null
33116
+ };
33117
+ }
33077
33118
  };
33078
33119
  const getServiceAgreementAcceptanceInfos = async () => {
33079
33120
  if (rootLegalEntity.id && (args == null ? void 0 : args.handleGetServiceAgreementAcceptanceInfos)) {
@@ -33267,10 +33308,7 @@ function DropinComposerComponent({
33267
33308
  }
33268
33309
  };
33269
33310
  const handleSingpassSelectionNextClick = async (method) => {
33270
- const {
33271
- handleOpenSingpassAuthorizationLink
33272
- } = args;
33273
- if (method === "singpass" && handleOpenSingpassAuthorizationLink) {
33311
+ if (method === "singpass" && shouldShowSingpass) {
33274
33312
  try {
33275
33313
  const {
33276
33314
  item: {
@@ -33556,7 +33594,7 @@ function DropinComposerComponent({
33556
33594
  onNavigateTo(TaskTypes.INTRODUCTION);
33557
33595
  return;
33558
33596
  }
33559
- if (isSingpassEnabled && newAccountHolder === "theCompanyIWorkFor" || newAccountHolder === "mySoleProprietorName") {
33597
+ if (shouldShowSingpassForAccountHolder(newAccountHolder) && !hasSeenSingpassSelection) {
33560
33598
  onNavigateTo(TaskTypes.SINGPASS_SELECTION);
33561
33599
  return;
33562
33600
  }
@@ -33580,7 +33618,7 @@ function DropinComposerComponent({
33580
33618
  legalEntity: rootLegalEntity,
33581
33619
  onExitIntroduction: () => {
33582
33620
  setHasSeenIntroduction(true);
33583
- if (shouldShowSingpass) {
33621
+ if (shouldShowSingpassSelection) {
33584
33622
  onNavigateTo(TaskTypes.SINGPASS_SELECTION);
33585
33623
  return;
33586
33624
  }
@@ -35780,7 +35818,7 @@ const ConfigurationApiProvider = ({
35780
35818
  isEmbeddedDropin,
35781
35819
  loadingContext
35782
35820
  } = authContext;
35783
- const sdkVersion = "3.12.0";
35821
+ const sdkVersion = "3.12.2";
35784
35822
  useAnalytics({
35785
35823
  onUserEvent,
35786
35824
  legalEntityId: rootLegalEntityId,
package/dist/style.css CHANGED
@@ -85934,7 +85934,8 @@ a.adl-button:disabled, a.adl-button.adl-button--disabled {
85934
85934
  /* #region Inline components */
85935
85935
  /* #endregion */
85936
85936
  .adyen-kyc-business-type-selection {
85937
- max-width: 544px;
85937
+ margin-left: auto;
85938
+ margin-right: auto;
85938
85939
  }
85939
85940
  .adyen-kyc-business-type-selection__nav {
85940
85941
  margin-top: 32px;
@@ -99788,6 +99789,8 @@ a.adl-button:disabled, a.adl-button.adl-button--disabled {
99788
99789
  /* #endregion */
99789
99790
  .adyen-kyc-singpass-selection {
99790
99791
  max-width: 544px;
99792
+ margin-left: auto;
99793
+ margin-right: auto;
99791
99794
  }
99792
99795
  .adyen-kyc-singpass-selection__nav {
99793
99796
  margin-top: 32px;
@@ -107374,6 +107377,9 @@ a.adl-button:disabled, a.adl-button.adl-button--disabled {
107374
107377
  .adyen-task-list-group__header .adl-heading {
107375
107378
  font-weight: 500;
107376
107379
  }
107380
+ .adyen-task-list-group > .adl-card__body {
107381
+ padding: 16px 0;
107382
+ }
107377
107383
  .adyen-task-list-group + .adyen-task-list-group {
107378
107384
  margin-top: 16px;
107379
107385
  }/* #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;
@@ -21,7 +21,7 @@ interface SingpassLinkResponseItem {
21
21
  authUrl: string;
22
22
  success: boolean;
23
23
  }
24
- interface SingpassLinkResponse {
24
+ export interface SingpassLinkResponse {
25
25
  item: SingpassLinkResponseItem;
26
26
  }
27
27
  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": "3.12.0",
3
+ "version": "3.12.2",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "files": [