@adyen/kyc-components 3.21.3 → 3.21.5

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.
@@ -6539,17 +6539,27 @@ const taxIdNumberOptions = {
6539
6539
  name: "socialSecurityNumber",
6540
6540
  applicableOnlyFor: [CompanyTypesValue.SOLE_PROPRIETORSHIP]
6541
6541
  }],
6542
+ [CountryCodes.PuertoRico]: [{
6543
+ id: "EIN",
6544
+ name: "ein"
6545
+ }, {
6546
+ id: "SSN",
6547
+ name: "ssn",
6548
+ applicableOnlyFor: [CompanyTypesValue.SOLE_PROPRIETORSHIP]
6549
+ }],
6542
6550
  [CountryCodes.UnitedStates]: [{
6543
6551
  id: "EIN",
6544
6552
  name: "ein"
6545
6553
  }, {
6546
6554
  id: "SSN",
6547
- name: "ssn"
6555
+ name: "ssn",
6556
+ applicableOnlyFor: [CompanyTypesValue.SOLE_PROPRIETORSHIP]
6548
6557
  }]
6549
6558
  };
6550
6559
  const getTaxIdNumberOptions = (country2, companyType2) => {
6551
6560
  const optionsForCountry = taxIdNumberOptions[country2];
6552
6561
  if (!companyType2 || !optionsForCountry) return optionsForCountry;
6562
+ if (country2 === "US" || country2 === "PR") return optionsForCountry.filter((option) => option.id === "EIN");
6553
6563
  return optionsForCountry.filter((option) => {
6554
6564
  var _a;
6555
6565
  return ((_a = option.applicableOnlyFor) == null ? void 0 : _a.includes(companyType2)) ?? true;
@@ -15478,6 +15488,12 @@ function IdDocumentManualUploadComponent(props) {
15478
15488
  });
15479
15489
  }
15480
15490
  const IdDocumentManualUpload = memo(IdDocumentManualUploadComponent, (prevProps, nextProps) => objectsDeepEqual(prevProps.data, nextProps.data) && objectsDeepEqual(prevProps.formVerificationErrors, nextProps.formVerificationErrors) && objectsDeepEqual(prevProps.fieldValidationErrors, nextProps.fieldValidationErrors) && prevProps.shouldValidate === nextProps.shouldValidate && prevProps.name === nextProps.name);
15491
+ const CoreContext = createContext(void 0);
15492
+ const useCoreContext = () => {
15493
+ const context = useContext(CoreContext);
15494
+ if (!context) throw Error("You need a <CoreProvider> to use core context");
15495
+ return context;
15496
+ };
15481
15497
  const useIdVerificationToken = ({
15482
15498
  userDetails,
15483
15499
  legalEntityId,
@@ -15490,6 +15506,7 @@ const useIdVerificationToken = ({
15490
15506
  residencyCountry: residencyCountry2
15491
15507
  } = userDetails;
15492
15508
  const [sdkToken2, setSdkToken2] = useState();
15509
+ const [providerId, setProviderId] = useState();
15493
15510
  const [loadingStatus, setLoadingStatus] = useState();
15494
15511
  const hasAllUserDetails = userDetails && Object.values(userDetails).every(Boolean);
15495
15512
  useEffect(() => {
@@ -15514,9 +15531,11 @@ const useIdVerificationToken = ({
15514
15531
  // Do not include legalEntityId if we don't know yet. Eg.: decision-makers flow the associated legalEntityId.
15515
15532
  };
15516
15533
  const {
15517
- sdkToken: sdkToken22
15534
+ sdkToken: sdkToken22,
15535
+ id: providerId2
15518
15536
  } = await handleGetIdVerificationToken("", data);
15519
15537
  setSdkToken2(sdkToken22);
15538
+ setProviderId(providerId2);
15520
15539
  } catch (e) {
15521
15540
  onIdVerificationError == null ? void 0 : onIdVerificationError(e);
15522
15541
  } finally {
@@ -15525,6 +15544,7 @@ const useIdVerificationToken = ({
15525
15544
  })().catch(console.error);
15526
15545
  }, [firstName2, lastName2, residencyCountry2, hasAllUserDetails]);
15527
15546
  return {
15547
+ providerId,
15528
15548
  sdkToken: sdkToken2,
15529
15549
  loadingStatus
15530
15550
  };
@@ -15643,9 +15663,13 @@ function IdVerificationComponent({
15643
15663
  const {
15644
15664
  i18n
15645
15665
  } = useI18nContext();
15666
+ const {
15667
+ setIdVerificationProviderId
15668
+ } = useCoreContext();
15646
15669
  const {
15647
15670
  sdkToken: sdkToken2,
15648
- loadingStatus
15671
+ loadingStatus,
15672
+ providerId
15649
15673
  } = useIdVerificationToken({
15650
15674
  userDetails,
15651
15675
  legalEntityId,
@@ -15655,7 +15679,8 @@ function IdVerificationComponent({
15655
15679
  const onfidoSdk = useRef();
15656
15680
  useEffect(() => {
15657
15681
  (async () => {
15658
- if (!sdkToken2) return;
15682
+ if (!sdkToken2 || !providerId) return;
15683
+ setIdVerificationProviderId(providerId);
15659
15684
  onfidoSdk.current = await initOnfido({
15660
15685
  token: sdkToken2,
15661
15686
  i18n,
@@ -19995,12 +20020,6 @@ function BankVerification(props) {
19995
20020
  });
19996
20021
  }
19997
20022
  const BankVerification$1 = memo(BankVerification);
19998
- const CoreContext = createContext(void 0);
19999
- const useCoreContext = () => {
20000
- const context = useContext(CoreContext);
20001
- if (!context) throw Error("You need a <CoreProvider> to use core context");
20002
- return context;
20003
- };
20004
20023
  const countriesWithMultipleCurrencies = /* @__PURE__ */ new Set([CountryCodes.Bulgaria, CountryCodes.Canada, CountryCodes.Croatia, CountryCodes.CzechRepublic, CountryCodes.Hungary, CountryCodes.Romania, CountryCodes.Switzerland]);
20005
20024
  const countriesWithLocalFormat = /* @__PURE__ */ new Set([CountryCodes.Denmark, CountryCodes.Norway, CountryCodes.Poland, CountryCodes.Sweden, CountryCodes.UnitedKingdom]);
20006
20025
  const payoutCurrencySupport = {
@@ -32149,8 +32168,12 @@ function IndividualDropinComponent({
32149
32168
  var _a, _b, _c, _d;
32150
32169
  const {
32151
32170
  accountHolder: accountHolder2,
32152
- setAccountHolder
32171
+ setAccountHolder,
32172
+ idVerificationProviderId
32153
32173
  } = useCoreContext();
32174
+ const {
32175
+ isEmbeddedDropin
32176
+ } = useAuthContext();
32154
32177
  const {
32155
32178
  i18n
32156
32179
  } = useI18nContext();
@@ -32304,6 +32327,10 @@ function IndividualDropinComponent({
32304
32327
  };
32305
32328
  const handleInstantIdVerificationStartCheck = async (onfidoResponse, legalEntityId) => {
32306
32329
  const data2 = {
32330
+ // providerId is not required in HO as this is already present in the startCheck endpoint
32331
+ ...isEmbeddedDropin && {
32332
+ providerId: idVerificationProviderId
32333
+ },
32307
32334
  legalEntityId,
32308
32335
  captureMetadata: onfidoResponse
32309
32336
  };
@@ -36409,6 +36436,22 @@ const acceptServiceAgreement = async (context, termsOfServiceDocumentId, data) =
36409
36436
  termsOfServiceDocumentId
36410
36437
  });
36411
36438
  };
36439
+ const confirmDataReview = async (context) => {
36440
+ const {
36441
+ loadingContext,
36442
+ legalEntityId
36443
+ } = context;
36444
+ return httpPost({
36445
+ loadingContext,
36446
+ errorLevel: "warn",
36447
+ errorMessage: `Failed to confirm data review`,
36448
+ path: `${legalEntityId}/confirmDataReview`,
36449
+ authentication: "jwt",
36450
+ headers: {
36451
+ "Content-Type": "application/json"
36452
+ }
36453
+ });
36454
+ };
36412
36455
  const createTrustedTransferInstrument = async (context, code2, state2) => {
36413
36456
  const {
36414
36457
  loadingContext,
@@ -36477,6 +36520,22 @@ const generateOnboardingLink = async (context, config) => {
36477
36520
  }
36478
36521
  }, config);
36479
36522
  };
36523
+ const getAcceptedServiceAgreement = async (context, termsOfServiceAcceptanceReference, documentFormat) => {
36524
+ const {
36525
+ loadingContext,
36526
+ legalEntityId
36527
+ } = context;
36528
+ return httpGet({
36529
+ loadingContext,
36530
+ errorLevel: "warn",
36531
+ errorMessage: `Failed to get service agreement`,
36532
+ path: `${legalEntityId}/termsOfService/acceptedTermsOfServiceDocument/${termsOfServiceAcceptanceReference}?documentformat=${documentFormat} `,
36533
+ authentication: "jwt",
36534
+ headers: {
36535
+ "Content-Type": "application/json"
36536
+ }
36537
+ });
36538
+ };
36480
36539
  const getAddress = async (context, addressId) => {
36481
36540
  const {
36482
36541
  loadingContext,
@@ -36763,7 +36822,23 @@ const useComponentApi = (rootLegalEntityId) => {
36763
36822
  acceptServiceAgreement: async (legalEntityId, termsOfServiceDocumentId, data) => acceptServiceAgreement({
36764
36823
  ...baseRequestContext,
36765
36824
  legalEntityId
36766
- }, termsOfServiceDocumentId, data)
36825
+ }, termsOfServiceDocumentId, data),
36826
+ getAcceptedServiceAgreement: async (legalEntityId, termsOfServiceAcceptanceReference) => getAcceptedServiceAgreement({
36827
+ ...baseRequestContext,
36828
+ legalEntityId
36829
+ }, termsOfServiceAcceptanceReference, "JSON"),
36830
+ downloadAcceptedServiceAgreement: async (legalEntityId, termsOfServiceAcceptanceReference) => getAcceptedServiceAgreement({
36831
+ ...baseRequestContext,
36832
+ legalEntityId
36833
+ }, termsOfServiceAcceptanceReference, "PDF"),
36834
+ downloadUnacceptedServiceAgreement: async (legalEntityId, serviceAgreementRequest) => getServiceAgreement({
36835
+ ...baseRequestContext,
36836
+ legalEntityId
36837
+ }, serviceAgreementRequest),
36838
+ confirmDataReview: async (legalEntityId) => confirmDataReview({
36839
+ ...baseRequestContext,
36840
+ legalEntityId
36841
+ })
36767
36842
  };
36768
36843
  }, [base, rootLegalEntityId]);
36769
36844
  };
@@ -37241,7 +37316,11 @@ function OnboardingDropinComponent({
37241
37316
  getServiceAgreementStatus: getServiceAgreementStatus2,
37242
37317
  getServiceAgreement: getServiceAgreement2,
37243
37318
  acceptServiceAgreement: acceptServiceAgreement2,
37244
- getBankVerificationVendor: getBankVerificationVendor2
37319
+ getAcceptedServiceAgreement: getAcceptedServiceAgreement2,
37320
+ downloadAcceptedServiceAgreement,
37321
+ downloadUnacceptedServiceAgreement,
37322
+ getBankVerificationVendor: getBankVerificationVendor2,
37323
+ confirmDataReview: confirmDataReview2
37245
37324
  } = useComponentApi(legalEntityId);
37246
37325
  const [legalEntity, setLegalEntity] = useState();
37247
37326
  const [loadingStatus, setLoadingStatus] = useState("loading");
@@ -37281,12 +37360,16 @@ function OnboardingDropinComponent({
37281
37360
  handleGetServiceAgreementStatus: getServiceAgreementStatus2,
37282
37361
  handleGetServiceAgreement: getServiceAgreement2,
37283
37362
  handleSignServiceAgreement: acceptServiceAgreement2,
37363
+ handleViewAcceptedTermsOfServiceDocument: getAcceptedServiceAgreement2,
37364
+ handleDownloadAcceptedTermsOfServiceDocument: downloadAcceptedServiceAgreement,
37365
+ handleDownloadUnacceptedTermsOfServiceDocument: downloadUnacceptedServiceAgreement,
37284
37366
  handleCreateTransferInstrument: createTransferInstrument2,
37285
37367
  handleGetTransferInstrument: getTransferInstrument2,
37286
37368
  handleDeleteTransferInstrument: deleteTransferInstrument2,
37287
37369
  handleUpdateTransferInstrument: updateTransferInstrument2,
37288
37370
  handleCreateTrustedTransferInstrument: createTrustedTransferInstrument2,
37289
- handleGetBankVerificationVendors: (country2) => getBankVerificationVendor2(country2, openBankingPartnerConfigId)
37371
+ handleGetBankVerificationVendors: (country2) => getBankVerificationVendor2(country2, openBankingPartnerConfigId),
37372
+ handleReviewConfirm: confirmDataReview2
37290
37373
  });
37291
37374
  }
37292
37375
  var HighExposurePagesEnums = /* @__PURE__ */ ((HighExposurePagesEnums2) => {
@@ -38953,7 +39036,7 @@ const ConfigurationApiProvider = ({
38953
39036
  isEmbeddedDropin,
38954
39037
  loadingContext
38955
39038
  } = authContext;
38956
- const sdkVersion = "3.21.3";
39039
+ const sdkVersion = "3.21.5";
38957
39040
  useAnalytics({
38958
39041
  onUserEvent,
38959
39042
  legalEntityId: rootLegalEntityId,
@@ -38996,6 +39079,7 @@ const CoreProvider = ({
38996
39079
  setAccountHolder
38997
39080
  } = useAccountHolder(rootLegalEntityId);
38998
39081
  const [accountFormat, setAccountFormat] = useState("local");
39082
+ const [idVerificationProviderId, setIdVerificationProviderId] = useState();
38999
39083
  const allowedCountries = useAllowedCountries();
39000
39084
  const isCountryAllowed = (allowedCountries == null ? void 0 : allowedCountries.includes(contextCountry)) ?? true;
39001
39085
  useEffect(() => {
@@ -39013,8 +39097,10 @@ const CoreProvider = ({
39013
39097
  setAccountHolder,
39014
39098
  accountHolder: accountHolder2,
39015
39099
  setAccountFormat,
39016
- accountFormat
39017
- }), [contextCountry, accountHolder2, accountFormat]);
39100
+ accountFormat,
39101
+ idVerificationProviderId,
39102
+ setIdVerificationProviderId
39103
+ }), [contextCountry, accountHolder2, accountFormat, idVerificationProviderId]);
39018
39104
  return jsx(CoreContext.Provider, {
39019
39105
  value: contextValue,
39020
39106
  children
@@ -131,12 +131,21 @@ export declare const taxIdNumberOptions: {
131
131
  readonly name: "socialSecurityNumber";
132
132
  readonly applicableOnlyFor: readonly [CompanyTypesValue.SOLE_PROPRIETORSHIP];
133
133
  }];
134
+ readonly PR: readonly [{
135
+ readonly id: "EIN";
136
+ readonly name: "ein";
137
+ }, {
138
+ readonly id: "SSN";
139
+ readonly name: "ssn";
140
+ readonly applicableOnlyFor: readonly [CompanyTypesValue.SOLE_PROPRIETORSHIP];
141
+ }];
134
142
  readonly US: readonly [{
135
143
  readonly id: "EIN";
136
144
  readonly name: "ein";
137
145
  }, {
138
146
  readonly id: "SSN";
139
147
  readonly name: "ssn";
148
+ readonly applicableOnlyFor: readonly [CompanyTypesValue.SOLE_PROPRIETORSHIP];
140
149
  }];
141
150
  };
142
151
  export declare const getTaxIdNumberOptions: (country: CountryCode, companyType: CompanyTypesValue | LegalEntityType.TRUST | undefined) => readonly TaxIdNumberOption[] | undefined;
@@ -8,5 +8,7 @@ export interface CoreContextType {
8
8
  accountHolder: AccountHolderOption | null;
9
9
  setAccountFormat: (bankAccountFormat: BankAccountFormatType) => void;
10
10
  accountFormat: BankAccountFormatType;
11
+ idVerificationProviderId: string | undefined;
12
+ setIdVerificationProviderId: (idVerificationProviderId: string) => void;
11
13
  }
12
14
  export declare const CoreContext: import("preact").Context<CoreContextType>;
@@ -0,0 +1,3 @@
1
+ import type { ReviewCompletion } from '../../models/api/review';
2
+ import type { ComponentApiRequestContext } from '../types';
3
+ export declare const confirmDataReview: (context: ComponentApiRequestContext) => Promise<ReviewCompletion>;
@@ -0,0 +1,3 @@
1
+ import type { ServiceAgreementAcceptedDocumentResponse, TermsOfServiceDocumentFormat } from '../../models/api/contracts';
2
+ import type { ComponentApiRequestContext } from '../types';
3
+ export declare const getAcceptedServiceAgreement: (context: ComponentApiRequestContext, termsOfServiceAcceptanceReference: string, documentFormat: TermsOfServiceDocumentFormat) => Promise<ServiceAgreementAcceptedDocumentResponse>;
@@ -31,6 +31,10 @@ export type ComponentApi = {
31
31
  getServiceAgreementAcceptanceInfos: Required<DropinAPIHandlers>['handleGetServiceAgreementAcceptanceInfos'];
32
32
  getServiceAgreement: Required<DropinAPIHandlers>['handleGetServiceAgreement'];
33
33
  acceptServiceAgreement: Required<DropinAPIHandlers>['handleSignServiceAgreement'];
34
+ getAcceptedServiceAgreement: Required<DropinAPIHandlers>['handleViewAcceptedTermsOfServiceDocument'];
35
+ downloadAcceptedServiceAgreement: Required<DropinAPIHandlers>['handleDownloadAcceptedTermsOfServiceDocument'];
36
+ downloadUnacceptedServiceAgreement: Required<DropinAPIHandlers>['handleDownloadUnacceptedTermsOfServiceDocument'];
37
+ confirmDataReview: Required<DropinAPIHandlers>['handleReviewConfirm'];
34
38
  };
35
39
  export declare const COMPONENTS_API_VERSION = "v1";
36
40
  /**
@@ -7,6 +7,7 @@ export declare const useIdVerificationToken: ({ userDetails, legalEntityId, hand
7
7
  handleGetIdVerificationToken: Required<DropinAPIHandlers>["handleGetIdVerificationToken"];
8
8
  onIdVerificationError: ((error: any) => void) | undefined;
9
9
  }) => {
10
+ providerId: string;
10
11
  sdkToken: string;
11
12
  loadingStatus: LoadingStatus;
12
13
  };
@@ -33,6 +33,7 @@ export interface PciStatus {
33
33
  signingRequired: string | boolean;
34
34
  hasDocuments?: boolean;
35
35
  }
36
+ export type TermsOfServiceDocumentFormat = 'PDF' | 'JSON';
36
37
  export interface ServiceAgreementRequest {
37
38
  type: ServiceAgreementType;
38
39
  language: string;
@@ -43,7 +44,7 @@ export interface ServiceAgreementResponse extends ServiceAgreementRequest {
43
44
  document: string | undefined;
44
45
  }
45
46
  export interface ServiceAgreementUnacceptedDocumentRequest extends ServiceAgreementRequest {
46
- termsOfServiceDocumentFormat?: string;
47
+ termsOfServiceDocumentFormat?: TermsOfServiceDocumentFormat;
47
48
  }
48
49
  export interface ServiceAgreementSignRequest {
49
50
  acceptedBy: string;
@@ -22,6 +22,7 @@ export interface InstantIdVerificationTokenResponse {
22
22
  sdkToken: string;
23
23
  }
24
24
  export interface InstantIdVerificationStartCheckRequest {
25
+ providerId?: string;
25
26
  legalEntityId: string;
26
27
  captureMetadata: OnfidoCaptureSchema;
27
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adyen/kyc-components",
3
- "version": "3.21.3",
3
+ "version": "3.21.5",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "files": [