@adyen/kyc-components 2.13.2 → 2.13.4

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.
@@ -12391,8 +12391,13 @@ const mapIndividualDocumentToApiDocument = async (data, entityId) => {
12391
12391
  }
12392
12392
  };
12393
12393
  const mapApiIdDocumentToSchema = (idDocument2) => {
12394
- const frontPage2 = getPage(idDocument2, "front");
12395
- const backPage2 = getPage(idDocument2, "back");
12394
+ const {
12395
+ hasBackPage
12396
+ } = idDocumentTypeOptions.find(({
12397
+ id: id2
12398
+ }) => id2 === idDocument2.type);
12399
+ const frontPage2 = hasBackPage ? getPage(idDocument2, "front") : getPage(idDocument2);
12400
+ const backPage2 = hasBackPage ? getPage(idDocument2, "back") : void 0;
12396
12401
  return {
12397
12402
  ...frontPage2 ? {
12398
12403
  idFrontPage: [{
@@ -12622,40 +12627,34 @@ function IdDocumentManualUploadComponent(props) {
12622
12627
  prevState,
12623
12628
  changeInitiatedBy
12624
12629
  }) => {
12625
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i;
12626
- if (changeInitiatedBy === "idDocument") {
12627
- if (((_b = (_a2 = currentState == null ? void 0 : currentState.data) == null ? void 0 : _a2.idDocument) == null ? void 0 : _b.idDocumentType) !== ((_d = (_c = prevState == null ? void 0 : prevState.data) == null ? void 0 : _c.idDocument) == null ? void 0 : _d.idDocumentType)) {
12628
- const data2 = (_e = currentState.data) == null ? void 0 : _e.idDocument;
12629
- const document2 = (data2 == null ? void 0 : data2.idDocumentType) ? getDocument$1(props.legalEntityId, data2.idDocumentType) : void 0;
12630
- const isFrontPageSelected = ((_f = data2 == null ? void 0 : data2.idFrontPage) == null ? void 0 : _f[0]) instanceof File;
12631
- const isBackPageSelected = ((_g = data2 == null ? void 0 : data2.idBackPage) == null ? void 0 : _g[0]) instanceof File;
12632
- if (document2) {
12633
- if (!isFrontPageSelected && ((_h = document2.attachments) == null ? void 0 : _h[0])) {
12634
- setIdFrontPage({
12635
- idFrontPage: [{
12636
- name: getPageName(document2, "front")
12637
- }]
12638
- });
12639
- }
12640
- if (!isBackPageSelected && ((_i = document2.attachments) == null ? void 0 : _i[1])) {
12641
- setIdBackPage({
12642
- idBackPage: [{
12643
- name: getPageName(document2, "back")
12644
- }]
12645
- });
12646
- }
12647
- } else {
12648
- if (!isFrontPageSelected) {
12649
- setIdFrontPage({
12650
- idFrontPage: null
12651
- });
12652
- }
12653
- if (!isBackPageSelected) {
12654
- setIdBackPage({
12655
- idBackPage: null
12656
- });
12657
- }
12658
- }
12630
+ var _a2, _b, _c, _d, _e, _f;
12631
+ if (changeInitiatedBy === "idDocument" && ((_b = (_a2 = currentState == null ? void 0 : currentState.data) == null ? void 0 : _a2.idDocument) == null ? void 0 : _b.idDocumentType) !== ((_d = (_c = prevState == null ? void 0 : prevState.data) == null ? void 0 : _c.idDocument) == null ? void 0 : _d.idDocumentType)) {
12632
+ const idDocumentType = (_f = (_e = currentState.data) == null ? void 0 : _e.idDocument) == null ? void 0 : _f.idDocumentType;
12633
+ const document2 = idDocumentType ? getDocument$1(props.legalEntityId, idDocumentType) : void 0;
12634
+ if (!document2) {
12635
+ setIdFrontPage({
12636
+ idFrontPage: null
12637
+ });
12638
+ setIdBackPage({
12639
+ idBackPage: null
12640
+ });
12641
+ } else if (hasBackPage(idDocumentType)) {
12642
+ setIdFrontPage({
12643
+ idFrontPage: [{
12644
+ name: getPageName(document2, "front")
12645
+ }]
12646
+ });
12647
+ setIdBackPage({
12648
+ idBackPage: [{
12649
+ name: getPageName(document2, "back")
12650
+ }]
12651
+ });
12652
+ } else {
12653
+ setIdFrontPage({
12654
+ idFrontPage: [{
12655
+ name: getPageName(document2)
12656
+ }]
12657
+ });
12659
12658
  }
12660
12659
  }
12661
12660
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adyen/kyc-components",
3
- "version": "2.13.2",
3
+ "version": "2.13.4",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "files": [