@adyen/kyc-components 2.13.1 → 2.13.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.
- package/dist/es/adyen-kyc-components.es.js +60 -26
- package/dist/types/core/models/api/attachment.d.ts +3 -2
- package/dist/types/core/models/api/individual.d.ts +1 -0
- package/dist/types/utils/mapping/componentApiMapping.d.ts +1 -1
- package/dist/types/utils/mapping/mapping.d.ts +3 -1
- package/package.json +1 -1
|
@@ -11104,7 +11104,7 @@ const createDocumentRequest = async ({
|
|
|
11104
11104
|
attachments: [...page1 && page2 && encodedFront && encodedBack ? [createAttachment(encodedFront, page1.name, "front"), createAttachment(encodedBack, page2.name, "back")] : [createAttachment(encodedFront, page1.name)]]
|
|
11105
11105
|
};
|
|
11106
11106
|
};
|
|
11107
|
-
const createAttachment = (content, pageName, pageType
|
|
11107
|
+
const createAttachment = (content, pageName, pageType) => ({
|
|
11108
11108
|
content,
|
|
11109
11109
|
pageName,
|
|
11110
11110
|
...pageType && {
|
|
@@ -12091,14 +12091,36 @@ const identityTypeToApiIdentityTypeMap = {
|
|
|
12091
12091
|
};
|
|
12092
12092
|
const apiIdentityTypeToIdentityTypeMap = reverseObject(identityTypeToApiIdentityTypeMap);
|
|
12093
12093
|
const adjustIdentificationData = (data, apiData) => {
|
|
12094
|
-
|
|
12095
|
-
|
|
12096
|
-
|
|
12094
|
+
const {
|
|
12095
|
+
typeOfIdentity: typeOfIdentity2,
|
|
12096
|
+
idNumber: idNumber2,
|
|
12097
|
+
idNumberExempt,
|
|
12098
|
+
residencyCountry: residencyCountry2
|
|
12099
|
+
} = data;
|
|
12100
|
+
const identificationData = {
|
|
12097
12101
|
...apiData,
|
|
12098
|
-
number: stripCountryIdFormat(
|
|
12099
|
-
|
|
12100
|
-
type: identityTypeToApiIdentityTypeMap[data.typeOfIdentity] ?? "nationalIdNumber"
|
|
12102
|
+
number: stripCountryIdFormat(idNumber2, residencyCountry2),
|
|
12103
|
+
type: identityTypeToApiIdentityTypeMap[typeOfIdentity2] ?? "nationalIdNumber"
|
|
12101
12104
|
};
|
|
12105
|
+
switch (typeOfIdentity2) {
|
|
12106
|
+
case "passport":
|
|
12107
|
+
return {
|
|
12108
|
+
...identificationData,
|
|
12109
|
+
cardNumber: ""
|
|
12110
|
+
};
|
|
12111
|
+
case "driversLicense":
|
|
12112
|
+
return {
|
|
12113
|
+
...identificationData,
|
|
12114
|
+
expiryDate: ""
|
|
12115
|
+
};
|
|
12116
|
+
default:
|
|
12117
|
+
return idNumber2 === void 0 && idNumberExempt === void 0 ? void 0 : {
|
|
12118
|
+
...identificationData,
|
|
12119
|
+
expiryDate: "",
|
|
12120
|
+
cardNumber: "",
|
|
12121
|
+
nationalIdExempt: apiData.nationalIdExempt ?? !idNumber2
|
|
12122
|
+
};
|
|
12123
|
+
}
|
|
12102
12124
|
};
|
|
12103
12125
|
const mapTransferInstrumentToPayoutAccount = (transferInstrument) => formatObject(transferInstrument, payoutComponentKeyMapping);
|
|
12104
12126
|
const mapPayoutAccountToTransferInstrument = ({
|
|
@@ -12328,10 +12350,17 @@ const mapSolePropToLegalEntity = (data) => {
|
|
|
12328
12350
|
requestObj.type = LegalEntityType.SOLE_PROPRIETORSHIP;
|
|
12329
12351
|
return requestObj;
|
|
12330
12352
|
};
|
|
12331
|
-
const
|
|
12332
|
-
|
|
12333
|
-
|
|
12334
|
-
|
|
12353
|
+
const getPage = ({
|
|
12354
|
+
attachments
|
|
12355
|
+
}, pageType) => {
|
|
12356
|
+
if (!attachments)
|
|
12357
|
+
throw Error("Document has no attachments");
|
|
12358
|
+
const attachment = pageType ? attachments.find((attach) => attach.pageType === pageType) : attachments[0];
|
|
12359
|
+
if (!attachment)
|
|
12360
|
+
throw Error(`Attachment not found${pageType ? ` with type '${pageType}'` : ""}`);
|
|
12361
|
+
return attachment;
|
|
12362
|
+
};
|
|
12363
|
+
const getPageName = (document2, pageType) => getPage(document2, pageType).pageName;
|
|
12335
12364
|
const mapIndividualDocumentToApiDocument = async (data, entityId) => {
|
|
12336
12365
|
var _a, _b, _c, _d;
|
|
12337
12366
|
if (data) {
|
|
@@ -12361,24 +12390,29 @@ const mapIndividualDocumentToApiDocument = async (data, entityId) => {
|
|
|
12361
12390
|
return documents2.filter(Boolean);
|
|
12362
12391
|
}
|
|
12363
12392
|
};
|
|
12393
|
+
const mapApiIdDocumentToSchema = (idDocument2) => {
|
|
12394
|
+
const frontPage2 = getPage(idDocument2, "front");
|
|
12395
|
+
const backPage2 = getPage(idDocument2, "back");
|
|
12396
|
+
return {
|
|
12397
|
+
...frontPage2 ? {
|
|
12398
|
+
idFrontPage: [{
|
|
12399
|
+
name: frontPage2.pageName
|
|
12400
|
+
}]
|
|
12401
|
+
} : {},
|
|
12402
|
+
...backPage2 ? {
|
|
12403
|
+
idBackPage: [{
|
|
12404
|
+
name: backPage2.pageName
|
|
12405
|
+
}]
|
|
12406
|
+
} : {},
|
|
12407
|
+
idDocumentType: idDocument2.type
|
|
12408
|
+
};
|
|
12409
|
+
};
|
|
12364
12410
|
const mapApiDocumentToIndividualDocuments = (entityId) => {
|
|
12365
12411
|
const idDocument2 = getIdDocument(entityId) || null;
|
|
12366
12412
|
const proofOfResidence2 = getDocument$1(entityId, DocumentType.PROOF_OF_RESIDENCY) || null;
|
|
12367
12413
|
const proofOfNationalId2 = getDocument$1(entityId, DocumentType.PROOF_OF_NATIONAL_ID_NUMBER) || null;
|
|
12368
12414
|
return {
|
|
12369
|
-
idDocument:
|
|
12370
|
-
...(idDocument2 == null ? void 0 : idDocument2.attachments[0]) ? {
|
|
12371
|
-
idFrontPage: [{
|
|
12372
|
-
name: getPageName(idDocument2, 0)
|
|
12373
|
-
}]
|
|
12374
|
-
} : {},
|
|
12375
|
-
...(idDocument2 == null ? void 0 : idDocument2.attachments[1]) ? {
|
|
12376
|
-
idBackPage: [{
|
|
12377
|
-
name: getPageName(idDocument2, 1)
|
|
12378
|
-
}]
|
|
12379
|
-
} : {},
|
|
12380
|
-
idDocumentType: idDocument2 == null ? void 0 : idDocument2.type
|
|
12381
|
-
},
|
|
12415
|
+
idDocument: idDocument2 ? mapApiIdDocumentToSchema(idDocument2) : null,
|
|
12382
12416
|
proofOfResidence: proofOfResidence2 ? [{
|
|
12383
12417
|
name: getPageName(proofOfResidence2)
|
|
12384
12418
|
}] : null,
|
|
@@ -12599,14 +12633,14 @@ function IdDocumentManualUploadComponent(props) {
|
|
|
12599
12633
|
if (!isFrontPageSelected && ((_h = document2.attachments) == null ? void 0 : _h[0])) {
|
|
12600
12634
|
setIdFrontPage({
|
|
12601
12635
|
idFrontPage: [{
|
|
12602
|
-
name: getPageName(document2,
|
|
12636
|
+
name: getPageName(document2, "front")
|
|
12603
12637
|
}]
|
|
12604
12638
|
});
|
|
12605
12639
|
}
|
|
12606
12640
|
if (!isBackPageSelected && ((_i = document2.attachments) == null ? void 0 : _i[1])) {
|
|
12607
12641
|
setIdBackPage({
|
|
12608
12642
|
idBackPage: [{
|
|
12609
|
-
name: getPageName(document2,
|
|
12643
|
+
name: getPageName(document2, "back")
|
|
12610
12644
|
}]
|
|
12611
12645
|
});
|
|
12612
12646
|
}
|
|
@@ -38,7 +38,7 @@ export declare const individualComponentsKeyMapping: {
|
|
|
38
38
|
'address.otherAddressInformation': string;
|
|
39
39
|
};
|
|
40
40
|
export declare const individualApiKeyMapping: {
|
|
41
|
-
[x: string]: "personalDetails.firstName" | "personalDetails.lastName" | "personalDetails.issuerState" | "personalDetails.phoneNumber" | "personalDetails.email" | "personalDetails.birthDate" | "personalDetails.idNumber" | "personalDetails.licenseCardNumber" | "personalDetails.nationality" | "personalDetails.jobTitle" | "personalDetails.typeOfIdentity" | "personalDetails.idNumberExempt" | "
|
|
41
|
+
[x: string]: "personalDetails.firstName" | "personalDetails.lastName" | "personalDetails.issuerState" | "personalDetails.expiryDate" | "personalDetails.phoneNumber" | "personalDetails.email" | "personalDetails.birthDate" | "personalDetails.idNumber" | "personalDetails.licenseCardNumber" | "personalDetails.nationality" | "personalDetails.jobTitle" | "personalDetails.typeOfIdentity" | "personalDetails.idNumberExempt" | "address.country" | "address.postalCode" | "address.city" | "address.stateOrProvince" | "address.otherAddressInformation" | "address.address";
|
|
42
42
|
};
|
|
43
43
|
export declare const companyComponentsKeyMapping: {
|
|
44
44
|
'companyNameAndCountry.country': string;
|
|
@@ -5,6 +5,7 @@ import { PayoutDetailsSchema } from '../../components/PayoutDetails/types';
|
|
|
5
5
|
import { PersonalDetailsSchema } from '../../components/PersonalDetails/types';
|
|
6
6
|
import { SolePropSchema } from '../../components/SoleProp/types';
|
|
7
7
|
import { TrustSchema } from '../../components/Trust/types';
|
|
8
|
+
import { Attachment, PageType } from '../../core/models/api/attachment';
|
|
8
9
|
import { Document } from '../../core/models/api/document';
|
|
9
10
|
import { Individual } from '../../core/models/api/individual';
|
|
10
11
|
import { LegalEntity } from '../../core/models/api/legal-entity';
|
|
@@ -34,7 +35,8 @@ export declare const mapTrustToLegalEntity: (data: TrustSchema) => LegalEntity;
|
|
|
34
35
|
export declare const mapLegalEntityToSoleProp: (legalEntity: LegalEntity) => SolePropSchema;
|
|
35
36
|
export declare const mapSolePropToLegalEntity: (data: SolePropSchema) => LegalEntity;
|
|
36
37
|
export type IndividualDocumentFields = Pick<IndividualSchema, 'idDocument' | 'proofOfResidence' | 'proofOfNationalId'>;
|
|
37
|
-
export declare const
|
|
38
|
+
export declare const getPage: ({ attachments }: Document, pageType?: PageType) => Attachment;
|
|
39
|
+
export declare const getPageName: (document: Document, pageType?: PageType) => string;
|
|
38
40
|
export declare const mapIndividualDocumentToApiDocument: (data: IndividualSchema, entityId: string) => Promise<Document[]>;
|
|
39
41
|
export declare const mapApiDocumentToIndividualDocuments: (entityId: string) => IndividualDocumentFields;
|
|
40
42
|
export declare const mapCompanyDocumentToApiDocument: (data: CompanySchema, entityId: string) => Promise<Document[]>;
|