@adyen/kyc-components 3.21.4 → 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.
@@ -15488,6 +15488,12 @@ function IdDocumentManualUploadComponent(props) {
15488
15488
  });
15489
15489
  }
15490
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
+ };
15491
15497
  const useIdVerificationToken = ({
15492
15498
  userDetails,
15493
15499
  legalEntityId,
@@ -15500,6 +15506,7 @@ const useIdVerificationToken = ({
15500
15506
  residencyCountry: residencyCountry2
15501
15507
  } = userDetails;
15502
15508
  const [sdkToken2, setSdkToken2] = useState();
15509
+ const [providerId, setProviderId] = useState();
15503
15510
  const [loadingStatus, setLoadingStatus] = useState();
15504
15511
  const hasAllUserDetails = userDetails && Object.values(userDetails).every(Boolean);
15505
15512
  useEffect(() => {
@@ -15524,9 +15531,11 @@ const useIdVerificationToken = ({
15524
15531
  // Do not include legalEntityId if we don't know yet. Eg.: decision-makers flow the associated legalEntityId.
15525
15532
  };
15526
15533
  const {
15527
- sdkToken: sdkToken22
15534
+ sdkToken: sdkToken22,
15535
+ id: providerId2
15528
15536
  } = await handleGetIdVerificationToken("", data);
15529
15537
  setSdkToken2(sdkToken22);
15538
+ setProviderId(providerId2);
15530
15539
  } catch (e) {
15531
15540
  onIdVerificationError == null ? void 0 : onIdVerificationError(e);
15532
15541
  } finally {
@@ -15535,6 +15544,7 @@ const useIdVerificationToken = ({
15535
15544
  })().catch(console.error);
15536
15545
  }, [firstName2, lastName2, residencyCountry2, hasAllUserDetails]);
15537
15546
  return {
15547
+ providerId,
15538
15548
  sdkToken: sdkToken2,
15539
15549
  loadingStatus
15540
15550
  };
@@ -15653,9 +15663,13 @@ function IdVerificationComponent({
15653
15663
  const {
15654
15664
  i18n
15655
15665
  } = useI18nContext();
15666
+ const {
15667
+ setIdVerificationProviderId
15668
+ } = useCoreContext();
15656
15669
  const {
15657
15670
  sdkToken: sdkToken2,
15658
- loadingStatus
15671
+ loadingStatus,
15672
+ providerId
15659
15673
  } = useIdVerificationToken({
15660
15674
  userDetails,
15661
15675
  legalEntityId,
@@ -15665,7 +15679,8 @@ function IdVerificationComponent({
15665
15679
  const onfidoSdk = useRef();
15666
15680
  useEffect(() => {
15667
15681
  (async () => {
15668
- if (!sdkToken2) return;
15682
+ if (!sdkToken2 || !providerId) return;
15683
+ setIdVerificationProviderId(providerId);
15669
15684
  onfidoSdk.current = await initOnfido({
15670
15685
  token: sdkToken2,
15671
15686
  i18n,
@@ -20005,12 +20020,6 @@ function BankVerification(props) {
20005
20020
  });
20006
20021
  }
20007
20022
  const BankVerification$1 = memo(BankVerification);
20008
- const CoreContext = createContext(void 0);
20009
- const useCoreContext = () => {
20010
- const context = useContext(CoreContext);
20011
- if (!context) throw Error("You need a <CoreProvider> to use core context");
20012
- return context;
20013
- };
20014
20023
  const countriesWithMultipleCurrencies = /* @__PURE__ */ new Set([CountryCodes.Bulgaria, CountryCodes.Canada, CountryCodes.Croatia, CountryCodes.CzechRepublic, CountryCodes.Hungary, CountryCodes.Romania, CountryCodes.Switzerland]);
20015
20024
  const countriesWithLocalFormat = /* @__PURE__ */ new Set([CountryCodes.Denmark, CountryCodes.Norway, CountryCodes.Poland, CountryCodes.Sweden, CountryCodes.UnitedKingdom]);
20016
20025
  const payoutCurrencySupport = {
@@ -32159,8 +32168,12 @@ function IndividualDropinComponent({
32159
32168
  var _a, _b, _c, _d;
32160
32169
  const {
32161
32170
  accountHolder: accountHolder2,
32162
- setAccountHolder
32171
+ setAccountHolder,
32172
+ idVerificationProviderId
32163
32173
  } = useCoreContext();
32174
+ const {
32175
+ isEmbeddedDropin
32176
+ } = useAuthContext();
32164
32177
  const {
32165
32178
  i18n
32166
32179
  } = useI18nContext();
@@ -32314,6 +32327,10 @@ function IndividualDropinComponent({
32314
32327
  };
32315
32328
  const handleInstantIdVerificationStartCheck = async (onfidoResponse, legalEntityId) => {
32316
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
+ },
32317
32334
  legalEntityId,
32318
32335
  captureMetadata: onfidoResponse
32319
32336
  };
@@ -36419,6 +36436,22 @@ const acceptServiceAgreement = async (context, termsOfServiceDocumentId, data) =
36419
36436
  termsOfServiceDocumentId
36420
36437
  });
36421
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
+ };
36422
36455
  const createTrustedTransferInstrument = async (context, code2, state2) => {
36423
36456
  const {
36424
36457
  loadingContext,
@@ -36487,6 +36520,22 @@ const generateOnboardingLink = async (context, config) => {
36487
36520
  }
36488
36521
  }, config);
36489
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
+ };
36490
36539
  const getAddress = async (context, addressId) => {
36491
36540
  const {
36492
36541
  loadingContext,
@@ -36773,7 +36822,23 @@ const useComponentApi = (rootLegalEntityId) => {
36773
36822
  acceptServiceAgreement: async (legalEntityId, termsOfServiceDocumentId, data) => acceptServiceAgreement({
36774
36823
  ...baseRequestContext,
36775
36824
  legalEntityId
36776
- }, 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
+ })
36777
36842
  };
36778
36843
  }, [base, rootLegalEntityId]);
36779
36844
  };
@@ -37251,7 +37316,11 @@ function OnboardingDropinComponent({
37251
37316
  getServiceAgreementStatus: getServiceAgreementStatus2,
37252
37317
  getServiceAgreement: getServiceAgreement2,
37253
37318
  acceptServiceAgreement: acceptServiceAgreement2,
37254
- getBankVerificationVendor: getBankVerificationVendor2
37319
+ getAcceptedServiceAgreement: getAcceptedServiceAgreement2,
37320
+ downloadAcceptedServiceAgreement,
37321
+ downloadUnacceptedServiceAgreement,
37322
+ getBankVerificationVendor: getBankVerificationVendor2,
37323
+ confirmDataReview: confirmDataReview2
37255
37324
  } = useComponentApi(legalEntityId);
37256
37325
  const [legalEntity, setLegalEntity] = useState();
37257
37326
  const [loadingStatus, setLoadingStatus] = useState("loading");
@@ -37291,12 +37360,16 @@ function OnboardingDropinComponent({
37291
37360
  handleGetServiceAgreementStatus: getServiceAgreementStatus2,
37292
37361
  handleGetServiceAgreement: getServiceAgreement2,
37293
37362
  handleSignServiceAgreement: acceptServiceAgreement2,
37363
+ handleViewAcceptedTermsOfServiceDocument: getAcceptedServiceAgreement2,
37364
+ handleDownloadAcceptedTermsOfServiceDocument: downloadAcceptedServiceAgreement,
37365
+ handleDownloadUnacceptedTermsOfServiceDocument: downloadUnacceptedServiceAgreement,
37294
37366
  handleCreateTransferInstrument: createTransferInstrument2,
37295
37367
  handleGetTransferInstrument: getTransferInstrument2,
37296
37368
  handleDeleteTransferInstrument: deleteTransferInstrument2,
37297
37369
  handleUpdateTransferInstrument: updateTransferInstrument2,
37298
37370
  handleCreateTrustedTransferInstrument: createTrustedTransferInstrument2,
37299
- handleGetBankVerificationVendors: (country2) => getBankVerificationVendor2(country2, openBankingPartnerConfigId)
37371
+ handleGetBankVerificationVendors: (country2) => getBankVerificationVendor2(country2, openBankingPartnerConfigId),
37372
+ handleReviewConfirm: confirmDataReview2
37300
37373
  });
37301
37374
  }
37302
37375
  var HighExposurePagesEnums = /* @__PURE__ */ ((HighExposurePagesEnums2) => {
@@ -38963,7 +39036,7 @@ const ConfigurationApiProvider = ({
38963
39036
  isEmbeddedDropin,
38964
39037
  loadingContext
38965
39038
  } = authContext;
38966
- const sdkVersion = "3.21.4";
39039
+ const sdkVersion = "3.21.5";
38967
39040
  useAnalytics({
38968
39041
  onUserEvent,
38969
39042
  legalEntityId: rootLegalEntityId,
@@ -39006,6 +39079,7 @@ const CoreProvider = ({
39006
39079
  setAccountHolder
39007
39080
  } = useAccountHolder(rootLegalEntityId);
39008
39081
  const [accountFormat, setAccountFormat] = useState("local");
39082
+ const [idVerificationProviderId, setIdVerificationProviderId] = useState();
39009
39083
  const allowedCountries = useAllowedCountries();
39010
39084
  const isCountryAllowed = (allowedCountries == null ? void 0 : allowedCountries.includes(contextCountry)) ?? true;
39011
39085
  useEffect(() => {
@@ -39023,8 +39097,10 @@ const CoreProvider = ({
39023
39097
  setAccountHolder,
39024
39098
  accountHolder: accountHolder2,
39025
39099
  setAccountFormat,
39026
- accountFormat
39027
- }), [contextCountry, accountHolder2, accountFormat]);
39100
+ accountFormat,
39101
+ idVerificationProviderId,
39102
+ setIdVerificationProviderId
39103
+ }), [contextCountry, accountHolder2, accountFormat, idVerificationProviderId]);
39028
39104
  return jsx(CoreContext.Provider, {
39029
39105
  value: contextValue,
39030
39106
  children
@@ -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.4",
3
+ "version": "3.21.5",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "files": [