@adyen/kyc-components 2.38.1 → 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.
@@ -26981,6 +26981,28 @@ const useHasSeenSingpassSelection = ({
26981
26981
  setHasSeenSingpassSelection
26982
26982
  };
26983
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
+ };
26984
27006
  const logger$b = createLogger("useAssociatedLegalArrangement");
26985
27007
  function useAssociatedLegalArrangement({
26986
27008
  rootLegalEntity,
@@ -29018,7 +29040,6 @@ const SingpassSelection = (props) => {
29018
29040
  });
29019
29041
  const methodsMetadata = getSetupAccountMethodMetadata();
29020
29042
  return jsx("div", {
29021
- className: "adl-u-display-flex adl-u-justify-content-center",
29022
29043
  children: jsxs("div", {
29023
29044
  className: "adyen-kyc-singpass-selection",
29024
29045
  children: [jsx("header", {
@@ -32713,17 +32734,27 @@ function DropinComposerComponent({
32713
32734
  });
32714
32735
  const [tasks, setTasks] = useState([]);
32715
32736
  const [rootLegalEntity, setRootLegalEntity] = useState(legalEntityResponse);
32716
- const rootLegalEntityCountry = rootLegalEntity.type === LegalEntityType.INDIVIDUAL ? rootLegalEntity.individual.residentialAddress.country : rootLegalEntity.organization.registeredAddress.country;
32717
- const isSoleProp = accountHolder2 === "mySoleProprietorName" || hasSolePropInLegalEntity(legalEntityResponse);
32718
- const isSingpassEnabled = rootLegalEntityCountry === CountryCodes.Singapore && isSingpassExperimentEnabled && !hasSeenSingpassSelection;
32719
- 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;
32720
32751
  const initialTask = useMemo(() => {
32721
32752
  if (isNewEntryFlowEnabled && (!accountHolder2 || legalEntityResponse.id !== leId)) {
32722
32753
  return TaskTypes.BUSINESS_TYPE_SELECTION;
32723
32754
  }
32724
32755
  if (showIntroduction)
32725
32756
  return TaskTypes.INTRODUCTION;
32726
- if (isSingpassEnabled)
32757
+ if (shouldShowSingpassSelection)
32727
32758
  return TaskTypes.SINGPASS_SELECTION;
32728
32759
  return TaskTypes.TASKS_OVERVIEW;
32729
32760
  }, [showIntroduction, isNewEntryFlowEnabled, accountHolder2, legalEntityResponse, leId]);
@@ -33013,10 +33044,7 @@ function DropinComposerComponent({
33013
33044
  }
33014
33045
  };
33015
33046
  const handleSingpassSelectionNextClick = async (method) => {
33016
- const {
33017
- handleOpenSingpassAuthorizationLink
33018
- } = args;
33019
- if (method === "singpass" && handleOpenSingpassAuthorizationLink) {
33047
+ if (method === "singpass" && shouldShowSingpass) {
33020
33048
  try {
33021
33049
  const {
33022
33050
  item: {
@@ -33302,7 +33330,7 @@ function DropinComposerComponent({
33302
33330
  onNavigateTo(TaskTypes.INTRODUCTION);
33303
33331
  return;
33304
33332
  }
33305
- if (isSingpassEnabled && newAccountHolder === "theCompanyIWorkFor" || newAccountHolder === "mySoleProprietorName") {
33333
+ if (shouldShowSingpassForAccountHolder(newAccountHolder) && !hasSeenSingpassSelection) {
33306
33334
  onNavigateTo(TaskTypes.SINGPASS_SELECTION);
33307
33335
  return;
33308
33336
  }
@@ -33326,7 +33354,7 @@ function DropinComposerComponent({
33326
33354
  legalEntity: rootLegalEntity,
33327
33355
  onExitIntroduction: () => {
33328
33356
  setHasSeenIntroduction(true);
33329
- if (shouldShowSingpass) {
33357
+ if (shouldShowSingpassSelection) {
33330
33358
  onNavigateTo(TaskTypes.SINGPASS_SELECTION);
33331
33359
  return;
33332
33360
  }
@@ -34870,7 +34898,7 @@ const ConfigurationApiProvider = ({
34870
34898
  isEmbeddedDropin,
34871
34899
  loadingContext
34872
34900
  } = authContext;
34873
- const sdkVersion = "2.38.1";
34901
+ const sdkVersion = "2.38.2";
34874
34902
  useAnalytics({
34875
34903
  onUserEvent,
34876
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 */
@@ -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.1",
3
+ "version": "2.38.2",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "files": [