@adyen/kyc-components 3.12.1 → 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.
@@ -27231,6 +27231,28 @@ const useHasSeenSingpassSelection = ({
27231
27231
  setHasSeenSingpassSelection
27232
27232
  };
27233
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
+ };
27234
27256
  const logger$e = createLogger("useAssociatedLegalArrangement");
27235
27257
  function useAssociatedLegalArrangement({
27236
27258
  rootLegalEntity,
@@ -29288,7 +29310,6 @@ const SingpassSelection = (props) => {
29288
29310
  });
29289
29311
  const methodsMetadata = getSetupAccountMethodMetadata();
29290
29312
  return jsx("div", {
29291
- className: "adl-u-display-flex adl-u-justify-content-center",
29292
29313
  children: jsxs("div", {
29293
29314
  className: "adyen-kyc-singpass-selection",
29294
29315
  children: [jsx("header", {
@@ -32977,17 +32998,27 @@ function DropinComposerComponent({
32977
32998
  });
32978
32999
  const [tasks, setTasks] = useState([]);
32979
33000
  const [rootLegalEntity, setRootLegalEntity] = useState(legalEntityResponse);
32980
- const rootLegalEntityCountry = rootLegalEntity.type === LegalEntityType.INDIVIDUAL ? rootLegalEntity.individual.residentialAddress.country : rootLegalEntity.organization.registeredAddress.country;
32981
- const isSoleProp = accountHolder2 === "mySoleProprietorName" || hasSolePropInLegalEntity(legalEntityResponse);
32982
- const isSingpassEnabled = rootLegalEntityCountry === CountryCodes.Singapore && isSingpassExperimentEnabled && !hasSeenSingpassSelection;
32983
- 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;
32984
33015
  const initialTask = useMemo(() => {
32985
33016
  if (isNewEntryFlowEnabled && (!accountHolder2 || legalEntityResponse.id !== leId)) {
32986
33017
  return TaskTypes.BUSINESS_TYPE_SELECTION;
32987
33018
  }
32988
33019
  if (showIntroduction)
32989
33020
  return TaskTypes.INTRODUCTION;
32990
- if (isSingpassEnabled)
33021
+ if (shouldShowSingpassSelection)
32991
33022
  return TaskTypes.SINGPASS_SELECTION;
32992
33023
  return TaskTypes.TASKS_OVERVIEW;
32993
33024
  }, [showIntroduction, isNewEntryFlowEnabled, accountHolder2, legalEntityResponse, leId]);
@@ -33277,10 +33308,7 @@ function DropinComposerComponent({
33277
33308
  }
33278
33309
  };
33279
33310
  const handleSingpassSelectionNextClick = async (method) => {
33280
- const {
33281
- handleOpenSingpassAuthorizationLink
33282
- } = args;
33283
- if (method === "singpass" && handleOpenSingpassAuthorizationLink) {
33311
+ if (method === "singpass" && shouldShowSingpass) {
33284
33312
  try {
33285
33313
  const {
33286
33314
  item: {
@@ -33566,7 +33594,7 @@ function DropinComposerComponent({
33566
33594
  onNavigateTo(TaskTypes.INTRODUCTION);
33567
33595
  return;
33568
33596
  }
33569
- if (isSingpassEnabled && newAccountHolder === "theCompanyIWorkFor" || newAccountHolder === "mySoleProprietorName") {
33597
+ if (shouldShowSingpassForAccountHolder(newAccountHolder) && !hasSeenSingpassSelection) {
33570
33598
  onNavigateTo(TaskTypes.SINGPASS_SELECTION);
33571
33599
  return;
33572
33600
  }
@@ -33590,7 +33618,7 @@ function DropinComposerComponent({
33590
33618
  legalEntity: rootLegalEntity,
33591
33619
  onExitIntroduction: () => {
33592
33620
  setHasSeenIntroduction(true);
33593
- if (shouldShowSingpass) {
33621
+ if (shouldShowSingpassSelection) {
33594
33622
  onNavigateTo(TaskTypes.SINGPASS_SELECTION);
33595
33623
  return;
33596
33624
  }
@@ -35790,7 +35818,7 @@ const ConfigurationApiProvider = ({
35790
35818
  isEmbeddedDropin,
35791
35819
  loadingContext
35792
35820
  } = authContext;
35793
- const sdkVersion = "3.12.1";
35821
+ const sdkVersion = "3.12.2";
35794
35822
  useAnalytics({
35795
35823
  onUserEvent,
35796
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 */
@@ -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.1",
3
+ "version": "3.12.2",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "files": [