apacuana-sdk-core 0.10.0 → 0.12.0
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/README.md +305 -286
- package/coverage/clover.xml +345 -248
- package/coverage/coverage-final.json +9 -7
- package/coverage/lcov-report/index.html +41 -26
- package/coverage/lcov-report/src/api/certs.js.html +162 -87
- package/coverage/lcov-report/src/api/faceLiveness.js.html +523 -0
- package/coverage/lcov-report/src/api/index.html +43 -28
- package/coverage/lcov-report/src/api/revocations.js.html +132 -90
- package/coverage/lcov-report/src/api/signatures.js.html +25 -253
- package/coverage/lcov-report/src/api/users.js.html +23 -14
- package/coverage/lcov-report/src/config/index.html +1 -1
- package/coverage/lcov-report/src/config/index.js.html +1 -1
- package/coverage/lcov-report/src/errors/index.html +1 -1
- package/coverage/lcov-report/src/errors/index.js.html +8 -8
- package/coverage/lcov-report/src/index.html +13 -13
- package/coverage/lcov-report/src/index.js.html +96 -12
- package/coverage/lcov-report/src/success/index.html +116 -0
- package/coverage/lcov-report/src/success/index.js.html +106 -0
- package/coverage/lcov-report/src/utils/constant.js.html +4 -4
- package/coverage/lcov-report/src/utils/helpers.js.html +1 -1
- package/coverage/lcov-report/src/utils/httpClient.js.html +1 -1
- package/coverage/lcov-report/src/utils/index.html +1 -1
- package/coverage/lcov.info +597 -414
- package/dist/api/certs.d.ts +9 -70
- package/dist/api/faceLiveness.d.ts +6 -0
- package/dist/api/revocations.d.ts +6 -42
- package/dist/api/signatures.d.ts +11 -153
- package/dist/api/users.d.ts +16 -6
- package/dist/index.d.ts +6 -0
- package/dist/index.js +513 -259
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +513 -259
- package/dist/index.mjs.map +1 -1
- package/dist/success/index.d.ts +7 -0
- package/dist/types/certs.d.ts +97 -0
- package/dist/types/faceLiveness.d.ts +11 -0
- package/dist/types/revocations.d.ts +51 -0
- package/dist/types/signatures.d.ts +147 -0
- package/dist/types/users.d.ts +260 -0
- package/package.json +1 -1
- package/src/api/certs.js +74 -49
- package/src/api/faceLiveness.js +146 -0
- package/src/api/revocations.js +76 -62
- package/src/api/signatures.js +21 -97
- package/src/api/users.js +12 -9
- package/src/index.js +33 -5
- package/src/success/index.js +8 -0
- package/src/types/certs.js +56 -0
- package/src/types/faceLiveness.js +16 -0
- package/src/types/revocations.js +45 -0
- package/src/types/signatures.js +91 -0
- package/src/types/users.js +73 -0
- package/tests/api/certs.test.js +99 -6
- package/tests/api/faceLiveness.test.js +170 -0
- package/tests/api/revocations.test.js +35 -35
- package/tests/api/signatures.test.js +11 -5
- package/tests/api/users.test.js +3 -2
- package/tests/index.test.js +16 -8
package/dist/index.mjs
CHANGED
|
@@ -529,11 +529,25 @@ var httpRequest = /*#__PURE__*/function () {
|
|
|
529
529
|
};
|
|
530
530
|
}();
|
|
531
531
|
|
|
532
|
+
var ApacuanaSuccess = /*#__PURE__*/_createClass(function ApacuanaSuccess(data) {
|
|
533
|
+
var statusCode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200;
|
|
534
|
+
_classCallCheck(this, ApacuanaSuccess);
|
|
535
|
+
this.success = true;
|
|
536
|
+
this.statusCode = statusCode;
|
|
537
|
+
this.name = "ApacuanaSuccess";
|
|
538
|
+
this.data = data;
|
|
539
|
+
});
|
|
540
|
+
|
|
532
541
|
/**
|
|
533
|
-
* @typedef {object}
|
|
542
|
+
* @typedef {object} GetCustomerData
|
|
534
543
|
* @property {string} token - El token de sesión del usuario.
|
|
535
544
|
* @property {object} userData - Los datos del usuario obtenidos.
|
|
536
|
-
|
|
545
|
+
*/
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* @typedef {object} GetCustomerResponse
|
|
549
|
+
* @property {true} success - Indica que la operación fue exitosa.
|
|
550
|
+
* @property {GetCustomerData} data - El payload de la respuesta.
|
|
537
551
|
*/
|
|
538
552
|
|
|
539
553
|
/**
|
|
@@ -541,7 +555,7 @@ var httpRequest = /*#__PURE__*/function () {
|
|
|
541
555
|
* Este método es útil para endpoints que requieren datos en el cuerpo de la petición
|
|
542
556
|
* para buscar un usuario, como un ID de sesión o un token de acceso.
|
|
543
557
|
*
|
|
544
|
-
* @returns {Promise<GetCustomerResponse>}
|
|
558
|
+
* @returns {Promise<GetCustomerResponse>} Una promesa que resuelve a un objeto con la respuesta exitosa.
|
|
545
559
|
* @throws {Error} Si los parámetros de entrada son inválidos.
|
|
546
560
|
* @throws {ApacuanaAPIError} Si ocurre un error en la API de Apacuana.
|
|
547
561
|
*/
|
|
@@ -573,11 +587,10 @@ var getCustomer = /*#__PURE__*/function () {
|
|
|
573
587
|
}
|
|
574
588
|
throw new ApacuanaAPIError("The API response does not contain the user.", 200, "INVALID_API_RESPONSE");
|
|
575
589
|
case 4:
|
|
576
|
-
return _context.a(2, {
|
|
590
|
+
return _context.a(2, new ApacuanaSuccess({
|
|
577
591
|
token: response.sessionid,
|
|
578
|
-
userData: response.entry
|
|
579
|
-
|
|
580
|
-
});
|
|
592
|
+
userData: response.entry
|
|
593
|
+
}));
|
|
581
594
|
case 5:
|
|
582
595
|
_context.p = 5;
|
|
583
596
|
_t = _context.v;
|
|
@@ -598,122 +611,185 @@ var getCustomer = /*#__PURE__*/function () {
|
|
|
598
611
|
};
|
|
599
612
|
}();
|
|
600
613
|
|
|
601
|
-
/**
|
|
602
|
-
|
|
603
|
-
* @property {string} revocationStatus - El estado de la solicitud de revocación (e.g., "pending").
|
|
604
|
-
* @property {string|number} requestId - El ID de la solicitud de revocación.
|
|
605
|
-
*/
|
|
614
|
+
/** @typedef {import("../types/revocations").RequestRevocationResponse} RequestRevocationResponse */
|
|
615
|
+
/** @typedef {import("../types/revocations").GetRevocationReasonsResponse} GetRevocationReasonsResponse */
|
|
606
616
|
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
* @param {string} reasonCode - Código o descripción del motivo de la revocación.
|
|
610
|
-
* @returns {Promise<RequestRevocationResponse>} Objeto con el estado de la solicitud de revocación.
|
|
611
|
-
*/
|
|
612
|
-
/**
|
|
613
|
-
* @typedef {object} RevocationResponse
|
|
614
|
-
* @property {boolean} success - Indicates if the revocation request was successful.
|
|
615
|
-
* @property {string} [message] - A message providing details about the outcome.
|
|
616
|
-
*/
|
|
617
|
-
|
|
618
|
-
/**
|
|
619
|
-
* @typedef {object} RevocationReason
|
|
620
|
-
* @property {string} code - The code for the revocation reason.
|
|
621
|
-
* @property {string} description - The description of the revocation reason.
|
|
622
|
-
*/
|
|
623
|
-
|
|
624
|
-
/**
|
|
625
|
-
* @typedef {object} RevocationReasonsResponse
|
|
626
|
-
* @property {boolean} success - Indicates if the request was successful.
|
|
627
|
-
* @property {RevocationReason[]} reasons - A list of revocation reasons.
|
|
628
|
-
*/
|
|
629
|
-
|
|
630
|
-
/**
|
|
631
|
-
* Requests the revocation of a certificate.
|
|
632
|
-
* @param {number} reasonCode - Código o descripción del motivo de la revocación.
|
|
633
|
-
* @returns {Promise<RevocationResponse>} An object indicating the success of the request.
|
|
634
|
-
* @throws {ApacuanaAPIError} If the revocation request fails.
|
|
635
|
-
*/
|
|
636
|
-
var requestRevocation = /*#__PURE__*/function () {
|
|
637
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(reasonCode) {
|
|
617
|
+
var requestRevocationOnBoarding = /*#__PURE__*/function () {
|
|
618
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(params) {
|
|
638
619
|
var response, _t;
|
|
639
620
|
return _regenerator().w(function (_context) {
|
|
640
621
|
while (1) switch (_context.p = _context.n) {
|
|
641
622
|
case 0:
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
}
|
|
646
|
-
throw new Error("Código de motivo es requerido para requestRevocation.");
|
|
623
|
+
_context.p = 0;
|
|
624
|
+
_context.n = 1;
|
|
625
|
+
return httpRequest("services/api/onboardingclient/requestcert", params, "POST");
|
|
647
626
|
case 1:
|
|
648
|
-
_context.p = 1;
|
|
649
|
-
_context.n = 2;
|
|
650
|
-
return httpRequest("services/api/onboardingclient/requestcert", {
|
|
651
|
-
reason: reasonCode
|
|
652
|
-
}, "POST");
|
|
653
|
-
case 2:
|
|
654
627
|
response = _context.v;
|
|
655
|
-
return _context.a(2, response);
|
|
656
|
-
case
|
|
657
|
-
_context.p =
|
|
628
|
+
return _context.a(2, new ApacuanaSuccess(response));
|
|
629
|
+
case 2:
|
|
630
|
+
_context.p = 2;
|
|
658
631
|
_t = _context.v;
|
|
659
|
-
|
|
632
|
+
if (!(_t instanceof ApacuanaAPIError)) {
|
|
633
|
+
_context.n = 3;
|
|
634
|
+
break;
|
|
635
|
+
}
|
|
636
|
+
throw _t;
|
|
637
|
+
case 3:
|
|
638
|
+
throw new Error("Failed to request revocation: ".concat(_t.message));
|
|
660
639
|
case 4:
|
|
661
640
|
return _context.a(2);
|
|
662
641
|
}
|
|
663
|
-
}, _callee, null, [[
|
|
642
|
+
}, _callee, null, [[0, 2]]);
|
|
664
643
|
}));
|
|
665
|
-
return function
|
|
644
|
+
return function requestRevocationOnBoarding(_x) {
|
|
666
645
|
return _ref.apply(this, arguments);
|
|
667
646
|
};
|
|
668
647
|
}();
|
|
648
|
+
var requestRevocationOnPremise = /*#__PURE__*/function () {
|
|
649
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
650
|
+
return _regenerator().w(function (_context2) {
|
|
651
|
+
while (1) switch (_context2.n) {
|
|
652
|
+
case 0:
|
|
653
|
+
throw new ApacuanaAPIError("Requesting revocation is not supported for integration type: ONPREMISE", 501, "NOT_IMPLEMENTED");
|
|
654
|
+
case 1:
|
|
655
|
+
return _context2.a(2);
|
|
656
|
+
}
|
|
657
|
+
}, _callee2);
|
|
658
|
+
}));
|
|
659
|
+
return function requestRevocationOnPremise() {
|
|
660
|
+
return _ref2.apply(this, arguments);
|
|
661
|
+
};
|
|
662
|
+
}();
|
|
669
663
|
|
|
670
664
|
/**
|
|
671
|
-
*
|
|
672
|
-
* @
|
|
673
|
-
* @
|
|
665
|
+
* Solicita la revocación de un certificado.
|
|
666
|
+
* @param {object} params - Parámetros para la solicitud.
|
|
667
|
+
* @param {number} params.reasonCode - El código de la razón de la revocación.
|
|
668
|
+
* @returns {Promise<RequestRevocationResponse>} Una promesa que resuelve con la confirmación de la solicitud.
|
|
669
|
+
* @throws {Error} Si los parámetros son inválidos.
|
|
674
670
|
*/
|
|
675
|
-
var
|
|
676
|
-
var
|
|
677
|
-
var _getConfig, integrationType
|
|
678
|
-
return _regenerator().w(function (
|
|
679
|
-
while (1) switch (
|
|
671
|
+
var requestRevocation = /*#__PURE__*/function () {
|
|
672
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(params) {
|
|
673
|
+
var _getConfig, integrationType;
|
|
674
|
+
return _regenerator().w(function (_context3) {
|
|
675
|
+
while (1) switch (_context3.n) {
|
|
680
676
|
case 0:
|
|
677
|
+
if (!(!params || typeof params.reasonCode !== "number")) {
|
|
678
|
+
_context3.n = 1;
|
|
679
|
+
break;
|
|
680
|
+
}
|
|
681
|
+
throw new Error('The "params" object with a numeric "reasonCode" property is required.');
|
|
682
|
+
case 1:
|
|
681
683
|
_getConfig = getConfig(), integrationType = _getConfig.integrationType;
|
|
684
|
+
if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
|
|
685
|
+
_context3.n = 2;
|
|
686
|
+
break;
|
|
687
|
+
}
|
|
688
|
+
return _context3.a(2, requestRevocationOnBoarding(params));
|
|
689
|
+
case 2:
|
|
682
690
|
if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
|
|
683
|
-
|
|
691
|
+
_context3.n = 3;
|
|
684
692
|
break;
|
|
685
693
|
}
|
|
686
|
-
|
|
694
|
+
return _context3.a(2, requestRevocationOnPremise(params));
|
|
695
|
+
case 3:
|
|
696
|
+
throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
|
|
697
|
+
case 4:
|
|
698
|
+
return _context3.a(2);
|
|
699
|
+
}
|
|
700
|
+
}, _callee3);
|
|
701
|
+
}));
|
|
702
|
+
return function requestRevocation(_x2) {
|
|
703
|
+
return _ref3.apply(this, arguments);
|
|
704
|
+
};
|
|
705
|
+
}();
|
|
706
|
+
var getRevocationReasonsOnBoarding = /*#__PURE__*/function () {
|
|
707
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
|
|
708
|
+
var response, _t2;
|
|
709
|
+
return _regenerator().w(function (_context4) {
|
|
710
|
+
while (1) switch (_context4.p = _context4.n) {
|
|
711
|
+
case 0:
|
|
712
|
+
_context4.p = 0;
|
|
713
|
+
_context4.n = 1;
|
|
714
|
+
return httpRequest("config/api/revocation/reasonsonboarding", {}, "GET");
|
|
687
715
|
case 1:
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
case 2:
|
|
692
|
-
response = _context2.v;
|
|
693
|
-
if (response.records) {
|
|
694
|
-
_context2.n = 3;
|
|
716
|
+
response = _context4.v;
|
|
717
|
+
if (!(!response || !response.records)) {
|
|
718
|
+
_context4.n = 2;
|
|
695
719
|
break;
|
|
696
720
|
}
|
|
697
721
|
throw new ApacuanaAPIError("Failed to fetch revocation reasons.");
|
|
722
|
+
case 2:
|
|
723
|
+
return _context4.a(2, new ApacuanaSuccess({
|
|
724
|
+
reasons: response.records
|
|
725
|
+
}));
|
|
698
726
|
case 3:
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
_context2.p = 4;
|
|
702
|
-
_t2 = _context2.v;
|
|
727
|
+
_context4.p = 3;
|
|
728
|
+
_t2 = _context4.v;
|
|
703
729
|
if (!(_t2 instanceof ApacuanaAPIError)) {
|
|
704
|
-
|
|
730
|
+
_context4.n = 4;
|
|
705
731
|
break;
|
|
706
732
|
}
|
|
707
733
|
throw _t2;
|
|
734
|
+
case 4:
|
|
735
|
+
throw new Error("Failed to get revocation reasons: ".concat(_t2.message));
|
|
708
736
|
case 5:
|
|
709
|
-
|
|
710
|
-
case 6:
|
|
711
|
-
return _context2.a(2);
|
|
737
|
+
return _context4.a(2);
|
|
712
738
|
}
|
|
713
|
-
},
|
|
739
|
+
}, _callee4, null, [[0, 3]]);
|
|
740
|
+
}));
|
|
741
|
+
return function getRevocationReasonsOnBoarding() {
|
|
742
|
+
return _ref4.apply(this, arguments);
|
|
743
|
+
};
|
|
744
|
+
}();
|
|
745
|
+
var getRevocationReasonsOnPremise = /*#__PURE__*/function () {
|
|
746
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
|
|
747
|
+
return _regenerator().w(function (_context5) {
|
|
748
|
+
while (1) switch (_context5.n) {
|
|
749
|
+
case 0:
|
|
750
|
+
throw new ApacuanaAPIError("Getting revocation reasons is not supported for integration type: ONPREMISE", 501, "NOT_IMPLEMENTED");
|
|
751
|
+
case 1:
|
|
752
|
+
return _context5.a(2);
|
|
753
|
+
}
|
|
754
|
+
}, _callee5);
|
|
755
|
+
}));
|
|
756
|
+
return function getRevocationReasonsOnPremise() {
|
|
757
|
+
return _ref5.apply(this, arguments);
|
|
758
|
+
};
|
|
759
|
+
}();
|
|
760
|
+
|
|
761
|
+
/**
|
|
762
|
+
* Obtiene la lista de razones de revocación de certificados.
|
|
763
|
+
* @returns {Promise<GetRevocationReasonsResponse>} Una promesa que resuelve con la lista de razones de revocación.
|
|
764
|
+
* @throws {ApacuanaAPIError} Si la llamada a la API falla o el tipo de integración no es soportado.
|
|
765
|
+
*/
|
|
766
|
+
var getRevocationReasons = /*#__PURE__*/function () {
|
|
767
|
+
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
|
|
768
|
+
var _getConfig2, integrationType;
|
|
769
|
+
return _regenerator().w(function (_context6) {
|
|
770
|
+
while (1) switch (_context6.n) {
|
|
771
|
+
case 0:
|
|
772
|
+
_getConfig2 = getConfig(), integrationType = _getConfig2.integrationType;
|
|
773
|
+
if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
|
|
774
|
+
_context6.n = 1;
|
|
775
|
+
break;
|
|
776
|
+
}
|
|
777
|
+
return _context6.a(2, getRevocationReasonsOnBoarding());
|
|
778
|
+
case 1:
|
|
779
|
+
if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
|
|
780
|
+
_context6.n = 2;
|
|
781
|
+
break;
|
|
782
|
+
}
|
|
783
|
+
return _context6.a(2, getRevocationReasonsOnPremise());
|
|
784
|
+
case 2:
|
|
785
|
+
throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
|
|
786
|
+
case 3:
|
|
787
|
+
return _context6.a(2);
|
|
788
|
+
}
|
|
789
|
+
}, _callee6);
|
|
714
790
|
}));
|
|
715
791
|
return function getRevocationReasons() {
|
|
716
|
-
return
|
|
792
|
+
return _ref6.apply(this, arguments);
|
|
717
793
|
};
|
|
718
794
|
}();
|
|
719
795
|
|
|
@@ -32951,24 +33027,6 @@ var helpers = {
|
|
|
32951
33027
|
validateOnBoardingSignDocumentData: validateOnBoardingSignDocumentData
|
|
32952
33028
|
};
|
|
32953
33029
|
|
|
32954
|
-
/**
|
|
32955
|
-
* @typedef {object} GenerateCertResponse
|
|
32956
|
-
* @property {string} cert - El certificado generado en formato string.
|
|
32957
|
-
* @property {string} certifiedid - El ID del certificado generado.
|
|
32958
|
-
* @property {boolean} success - Indica si la operación fue exitosa.
|
|
32959
|
-
*/
|
|
32960
|
-
|
|
32961
|
-
/**
|
|
32962
|
-
* @typedef {object} GetCertStatusResponse
|
|
32963
|
-
* @property {string} status - El estado actual del certificado del usuario.
|
|
32964
|
-
* @property {boolean} success - Indica si la operación fue exitosa.
|
|
32965
|
-
*/
|
|
32966
|
-
|
|
32967
|
-
/**
|
|
32968
|
-
* @typedef {object} EncryptedCSRObject
|
|
32969
|
-
* @property {string} csr - The encrypted Certificate Signing Request.
|
|
32970
|
-
*/
|
|
32971
|
-
|
|
32972
33030
|
/**
|
|
32973
33031
|
* @param {EncryptedCSRObject} encryptedCSR
|
|
32974
33032
|
*/
|
|
@@ -32990,11 +33048,10 @@ var generateCertOnBoarding = /*#__PURE__*/function () {
|
|
|
32990
33048
|
}
|
|
32991
33049
|
throw new ApacuanaAPIError("The API response does not contain the certificate.", response.status, "INVALID_API_RESPONSE");
|
|
32992
33050
|
case 2:
|
|
32993
|
-
return _context.a(2, {
|
|
33051
|
+
return _context.a(2, new ApacuanaSuccess({
|
|
32994
33052
|
cert: cert,
|
|
32995
|
-
certifiedid: certifiedid
|
|
32996
|
-
|
|
32997
|
-
});
|
|
33053
|
+
certifiedid: certifiedid
|
|
33054
|
+
}));
|
|
32998
33055
|
case 3:
|
|
32999
33056
|
_context.p = 3;
|
|
33000
33057
|
_t = _context.v;
|
|
@@ -33077,24 +33134,10 @@ var getCertStatus = function getCertStatus() {
|
|
|
33077
33134
|
var isCertificateInDevice = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
33078
33135
|
var config = getConfig();
|
|
33079
33136
|
var status = helpers.getCertificateStatus(config.userData, isCertificateInDevice);
|
|
33080
|
-
return {
|
|
33081
|
-
status: status
|
|
33082
|
-
|
|
33083
|
-
};
|
|
33137
|
+
return new ApacuanaSuccess({
|
|
33138
|
+
status: status
|
|
33139
|
+
});
|
|
33084
33140
|
};
|
|
33085
|
-
|
|
33086
|
-
/**
|
|
33087
|
-
* @typedef {object} CertType
|
|
33088
|
-
* @property {string} id - The ID of the certificate type.
|
|
33089
|
-
* @property {string} name - The name of the certificate type.
|
|
33090
|
-
*/
|
|
33091
|
-
|
|
33092
|
-
/**
|
|
33093
|
-
* @typedef {object} GetCertTypesResponse
|
|
33094
|
-
* @property {Array<CertType>} types - A list of available certificate types.
|
|
33095
|
-
* @property {boolean} success - Indicates if the operation was successful.
|
|
33096
|
-
*/
|
|
33097
|
-
|
|
33098
33141
|
var getCertTypesOnBoarding = /*#__PURE__*/function () {
|
|
33099
33142
|
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
|
|
33100
33143
|
var response, _t2;
|
|
@@ -33106,9 +33149,7 @@ var getCertTypesOnBoarding = /*#__PURE__*/function () {
|
|
|
33106
33149
|
return httpRequest("services/api/customer/typeusers", {}, "GET");
|
|
33107
33150
|
case 1:
|
|
33108
33151
|
response = _context4.v;
|
|
33109
|
-
return _context4.a(2,
|
|
33110
|
-
success: true
|
|
33111
|
-
}));
|
|
33152
|
+
return _context4.a(2, new ApacuanaSuccess(response));
|
|
33112
33153
|
case 2:
|
|
33113
33154
|
_context4.p = 2;
|
|
33114
33155
|
_t2 = _context4.v;
|
|
@@ -33179,19 +33220,6 @@ var getCertTypes = /*#__PURE__*/function () {
|
|
|
33179
33220
|
return _ref6.apply(this, arguments);
|
|
33180
33221
|
};
|
|
33181
33222
|
}();
|
|
33182
|
-
|
|
33183
|
-
/**
|
|
33184
|
-
* @typedef {object} Requirement
|
|
33185
|
-
* @property {string} id - The ID of the requirement.
|
|
33186
|
-
* @property {string} description - The description of the requirement.
|
|
33187
|
-
*/
|
|
33188
|
-
|
|
33189
|
-
/**
|
|
33190
|
-
* @typedef {object} GetRequirementsResponse
|
|
33191
|
-
* @property {Array<Requirement>} requirements - A list of requirements for the user type.
|
|
33192
|
-
* @property {boolean} success - Indicates if the operation was successful.
|
|
33193
|
-
*/
|
|
33194
|
-
|
|
33195
33223
|
var getRequerimentsByTypeUserOnBoarding = /*#__PURE__*/function () {
|
|
33196
33224
|
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(type) {
|
|
33197
33225
|
var response, _t3;
|
|
@@ -33203,9 +33231,7 @@ var getRequerimentsByTypeUserOnBoarding = /*#__PURE__*/function () {
|
|
|
33203
33231
|
return httpRequest("services/api/customer/documentspref?typeuser=".concat(type), {}, "GET");
|
|
33204
33232
|
case 1:
|
|
33205
33233
|
response = _context7.v;
|
|
33206
|
-
return _context7.a(2,
|
|
33207
|
-
success: true
|
|
33208
|
-
}));
|
|
33234
|
+
return _context7.a(2, new ApacuanaSuccess(response));
|
|
33209
33235
|
case 2:
|
|
33210
33236
|
_context7.p = 2;
|
|
33211
33237
|
_t3 = _context7.v;
|
|
@@ -33285,70 +33311,106 @@ var getRequerimentsByTypeUser = /*#__PURE__*/function () {
|
|
|
33285
33311
|
return _ref9.apply(this, arguments);
|
|
33286
33312
|
};
|
|
33287
33313
|
}();
|
|
33288
|
-
|
|
33289
|
-
|
|
33290
|
-
|
|
33291
|
-
|
|
33292
|
-
|
|
33293
|
-
|
|
33294
|
-
|
|
33295
|
-
|
|
33296
|
-
|
|
33297
|
-
|
|
33298
|
-
|
|
33299
|
-
|
|
33300
|
-
|
|
33301
|
-
|
|
33302
|
-
|
|
33303
|
-
|
|
33304
|
-
|
|
33305
|
-
|
|
33306
|
-
|
|
33307
|
-
|
|
33308
|
-
|
|
33309
|
-
|
|
33310
|
-
|
|
33311
|
-
|
|
33312
|
-
|
|
33313
|
-
|
|
33314
|
-
|
|
33315
|
-
|
|
33316
|
-
|
|
33317
|
-
|
|
33318
|
-
|
|
33319
|
-
*/
|
|
33320
|
-
|
|
33321
|
-
|
|
33322
|
-
|
|
33323
|
-
|
|
33324
|
-
|
|
33325
|
-
|
|
33326
|
-
|
|
33327
|
-
|
|
33328
|
-
|
|
33329
|
-
|
|
33330
|
-
|
|
33331
|
-
|
|
33332
|
-
|
|
33333
|
-
|
|
33334
|
-
*/
|
|
33314
|
+
var requestCertificateOnBoarding = /*#__PURE__*/function () {
|
|
33315
|
+
var _ref0 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(params) {
|
|
33316
|
+
var response, _t4;
|
|
33317
|
+
return _regenerator().w(function (_context0) {
|
|
33318
|
+
while (1) switch (_context0.p = _context0.n) {
|
|
33319
|
+
case 0:
|
|
33320
|
+
_context0.p = 0;
|
|
33321
|
+
_context0.n = 1;
|
|
33322
|
+
return httpRequest("services/api/customer/request-certificate", params, "POST");
|
|
33323
|
+
case 1:
|
|
33324
|
+
response = _context0.v;
|
|
33325
|
+
return _context0.a(2, new ApacuanaSuccess(response));
|
|
33326
|
+
case 2:
|
|
33327
|
+
_context0.p = 2;
|
|
33328
|
+
_t4 = _context0.v;
|
|
33329
|
+
if (!(_t4 instanceof ApacuanaAPIError)) {
|
|
33330
|
+
_context0.n = 3;
|
|
33331
|
+
break;
|
|
33332
|
+
}
|
|
33333
|
+
throw _t4;
|
|
33334
|
+
case 3:
|
|
33335
|
+
throw new Error("Failed to request certificate: ".concat(_t4.message));
|
|
33336
|
+
case 4:
|
|
33337
|
+
return _context0.a(2);
|
|
33338
|
+
}
|
|
33339
|
+
}, _callee0, null, [[0, 2]]);
|
|
33340
|
+
}));
|
|
33341
|
+
return function requestCertificateOnBoarding(_x5) {
|
|
33342
|
+
return _ref0.apply(this, arguments);
|
|
33343
|
+
};
|
|
33344
|
+
}();
|
|
33345
|
+
var requestCertificateOnPremise = /*#__PURE__*/function () {
|
|
33346
|
+
var _ref1 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
|
|
33347
|
+
return _regenerator().w(function (_context1) {
|
|
33348
|
+
while (1) switch (_context1.n) {
|
|
33349
|
+
case 0:
|
|
33350
|
+
throw new ApacuanaAPIError("Requesting a certificate is not supported for integration type: ONPREMISE", 501, "NOT_IMPLEMENTED");
|
|
33351
|
+
case 1:
|
|
33352
|
+
return _context1.a(2);
|
|
33353
|
+
}
|
|
33354
|
+
}, _callee1);
|
|
33355
|
+
}));
|
|
33356
|
+
return function requestCertificateOnPremise() {
|
|
33357
|
+
return _ref1.apply(this, arguments);
|
|
33358
|
+
};
|
|
33359
|
+
}();
|
|
33335
33360
|
|
|
33336
33361
|
/**
|
|
33337
|
-
*
|
|
33338
|
-
* @
|
|
33339
|
-
* @
|
|
33340
|
-
* @
|
|
33341
|
-
* @
|
|
33362
|
+
* Requests a certificate for the user.
|
|
33363
|
+
* @param {CertificateRequestParams} params - The parameters for the certificate request.
|
|
33364
|
+
* @returns {Promise<RequestCertificateResponse>} Object with a confirmation message and a success indicator.
|
|
33365
|
+
* @throws {ApacuanaAPIError} If the API response is invalid or the integration type is not supported.
|
|
33366
|
+
* @throws {Error} If the request fails for another reason or the params are invalid.
|
|
33342
33367
|
*/
|
|
33368
|
+
var requestCertificate = /*#__PURE__*/function () {
|
|
33369
|
+
var _ref10 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(params) {
|
|
33370
|
+
var _getConfig4, integrationType;
|
|
33371
|
+
return _regenerator().w(function (_context10) {
|
|
33372
|
+
while (1) switch (_context10.n) {
|
|
33373
|
+
case 0:
|
|
33374
|
+
if (!(!params || typeof params.type !== "number" || !Array.isArray(params.documents))) {
|
|
33375
|
+
_context10.n = 1;
|
|
33376
|
+
break;
|
|
33377
|
+
}
|
|
33378
|
+
throw new Error('The "params" object with a numeric "type" property and a "documents" array is required.');
|
|
33379
|
+
case 1:
|
|
33380
|
+
_getConfig4 = getConfig(), integrationType = _getConfig4.integrationType;
|
|
33381
|
+
if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
|
|
33382
|
+
_context10.n = 2;
|
|
33383
|
+
break;
|
|
33384
|
+
}
|
|
33385
|
+
return _context10.a(2, requestCertificateOnBoarding(params));
|
|
33386
|
+
case 2:
|
|
33387
|
+
if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
|
|
33388
|
+
_context10.n = 3;
|
|
33389
|
+
break;
|
|
33390
|
+
}
|
|
33391
|
+
return _context10.a(2, requestCertificateOnPremise());
|
|
33392
|
+
case 3:
|
|
33393
|
+
throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
|
|
33394
|
+
case 4:
|
|
33395
|
+
return _context10.a(2);
|
|
33396
|
+
}
|
|
33397
|
+
}, _callee10);
|
|
33398
|
+
}));
|
|
33399
|
+
return function requestCertificate(_x6) {
|
|
33400
|
+
return _ref10.apply(this, arguments);
|
|
33401
|
+
};
|
|
33402
|
+
}();
|
|
33343
33403
|
|
|
33344
|
-
/**
|
|
33345
|
-
|
|
33346
|
-
|
|
33347
|
-
|
|
33348
|
-
|
|
33349
|
-
|
|
33350
|
-
|
|
33351
|
-
*/
|
|
33404
|
+
/** @typedef {import("../types/signatures").Signer} Signer */
|
|
33405
|
+
/** @typedef {import("../types/signatures").SignerData} SignerData */
|
|
33406
|
+
/** @typedef {import("../types/signatures").AddSignerResponse} AddSignerResponse */
|
|
33407
|
+
/** @typedef {import("../types/signatures").GetDigestData} GetDigestData */
|
|
33408
|
+
/** @typedef {import("../types/signatures").GetDigestResponse} GetDigestResponse */
|
|
33409
|
+
/** @typedef {import("../types/signatures").GetDocsParams} GetDocsParams */
|
|
33410
|
+
/** @typedef {import("../types/signatures").GetDocsResponse} GetDocsResponse */
|
|
33411
|
+
/** @typedef {import("../types/signatures").SignDocumentData} SignDocumentData */
|
|
33412
|
+
/** @typedef {import("../types/signatures").SignaturePosition} SignaturePosition */
|
|
33413
|
+
/** @typedef {import("../types/signatures").OnboardingSignerData} OnboardingSignerData */
|
|
33352
33414
|
|
|
33353
33415
|
// =================================================================
|
|
33354
33416
|
// Internal Functions
|
|
@@ -33379,7 +33441,7 @@ var signDocumentOnBoarding = /*#__PURE__*/function () {
|
|
|
33379
33441
|
return httpRequest("services/api/documents/sign/".concat(signature.id), signBody, "PUT");
|
|
33380
33442
|
case 2:
|
|
33381
33443
|
response = _context.v;
|
|
33382
|
-
return _context.a(2, response);
|
|
33444
|
+
return _context.a(2, new ApacuanaSuccess(response));
|
|
33383
33445
|
case 3:
|
|
33384
33446
|
_context.p = 3;
|
|
33385
33447
|
_t = _context.v;
|
|
@@ -33434,10 +33496,9 @@ var getDigestToSignOnBoarding = /*#__PURE__*/function () {
|
|
|
33434
33496
|
}
|
|
33435
33497
|
throw new ApacuanaAPIError("Signature generation failed: digest not found in the response.", 500, "API_RESPONSE_ERROR");
|
|
33436
33498
|
case 2:
|
|
33437
|
-
return _context3.a(2, {
|
|
33438
|
-
digest: digest
|
|
33439
|
-
|
|
33440
|
-
});
|
|
33499
|
+
return _context3.a(2, new ApacuanaSuccess({
|
|
33500
|
+
digest: digest
|
|
33501
|
+
}));
|
|
33441
33502
|
case 3:
|
|
33442
33503
|
_context3.p = 3;
|
|
33443
33504
|
_t2 = _context3.v;
|
|
@@ -33483,10 +33544,9 @@ var addSignerOnBoarding = /*#__PURE__*/function () {
|
|
|
33483
33544
|
_context5.n = 2;
|
|
33484
33545
|
return httpRequest("services/api/documents/signing", signerData, "POST");
|
|
33485
33546
|
case 2:
|
|
33486
|
-
return _context5.a(2, {
|
|
33487
|
-
signer: signerData.typedoc + signerData.doc
|
|
33488
|
-
|
|
33489
|
-
});
|
|
33547
|
+
return _context5.a(2, new ApacuanaSuccess({
|
|
33548
|
+
signer: signerData.typedoc + signerData.doc
|
|
33549
|
+
}));
|
|
33490
33550
|
case 3:
|
|
33491
33551
|
_context5.p = 3;
|
|
33492
33552
|
_t3 = _context5.v;
|
|
@@ -33563,11 +33623,10 @@ var getDocsOnBoarding = /*#__PURE__*/function () {
|
|
|
33563
33623
|
return httpRequest(apiUrl, {}, "GET");
|
|
33564
33624
|
case 2:
|
|
33565
33625
|
response = _context8.v;
|
|
33566
|
-
return _context8.a(2, {
|
|
33626
|
+
return _context8.a(2, new ApacuanaSuccess({
|
|
33567
33627
|
totalRecords: response.numofrecords,
|
|
33568
|
-
records: response.records
|
|
33569
|
-
|
|
33570
|
-
});
|
|
33628
|
+
records: response.records
|
|
33629
|
+
}));
|
|
33571
33630
|
case 3:
|
|
33572
33631
|
_context8.p = 3;
|
|
33573
33632
|
_t4 = _context8.v;
|
|
@@ -33601,9 +33660,7 @@ var uploadSignatureVariantOnBoarding = /*#__PURE__*/function () {
|
|
|
33601
33660
|
}, "POST");
|
|
33602
33661
|
case 2:
|
|
33603
33662
|
response = _context9.v;
|
|
33604
|
-
return _context9.a(2,
|
|
33605
|
-
success: true
|
|
33606
|
-
}));
|
|
33663
|
+
return _context9.a(2, new ApacuanaSuccess(response));
|
|
33607
33664
|
case 3:
|
|
33608
33665
|
_context9.p = 3;
|
|
33609
33666
|
_t5 = _context9.v;
|
|
@@ -33650,9 +33707,7 @@ var getSignatureVariantOnBoarding = /*#__PURE__*/function () {
|
|
|
33650
33707
|
return httpRequest("services/api/customer/getsignaturephotosdk/".concat(customerId), {}, "GET");
|
|
33651
33708
|
case 2:
|
|
33652
33709
|
response = _context1.v;
|
|
33653
|
-
return _context1.a(2,
|
|
33654
|
-
success: true
|
|
33655
|
-
}));
|
|
33710
|
+
return _context1.a(2, new ApacuanaSuccess(response));
|
|
33656
33711
|
case 3:
|
|
33657
33712
|
_context1.p = 3;
|
|
33658
33713
|
_t6 = _context1.v;
|
|
@@ -33698,9 +33753,7 @@ var deleteSignatureVariantOnBoarding = /*#__PURE__*/function () {
|
|
|
33698
33753
|
return httpRequest("services/api/customer/cleansignaturephoto", {}, "DELETE");
|
|
33699
33754
|
case 1:
|
|
33700
33755
|
response = _context11.v;
|
|
33701
|
-
return _context11.a(2,
|
|
33702
|
-
success: true
|
|
33703
|
-
}));
|
|
33756
|
+
return _context11.a(2, new ApacuanaSuccess(response));
|
|
33704
33757
|
case 2:
|
|
33705
33758
|
_context11.p = 2;
|
|
33706
33759
|
_t7 = _context11.v;
|
|
@@ -33820,31 +33873,6 @@ var getDigest = /*#__PURE__*/function () {
|
|
|
33820
33873
|
* @returns {Promise<AddSignerResponse>} Una promesa que resuelve a un objeto con el resultado de la operación.
|
|
33821
33874
|
* @throws {ApacuanaAPIError} Si los datos del firmante son inválidos, la llamada a la API falla, o el tipo de integración no es soportado.
|
|
33822
33875
|
*/
|
|
33823
|
-
/**
|
|
33824
|
-
* @typedef {object} SignaturePosition
|
|
33825
|
-
* @property {number} page - The page number for the signature.
|
|
33826
|
-
* @property {number} x - The x-coordinate for the signature's position (from 0 to 1).
|
|
33827
|
-
* @property {number} y - The y-coordinate for the signature's position (from 0 to 1).
|
|
33828
|
-
*/
|
|
33829
|
-
|
|
33830
|
-
/**
|
|
33831
|
-
* @typedef {object} OnboardingSignerData
|
|
33832
|
-
* @property {string} name - The name of the document.
|
|
33833
|
-
* @property {string} reference - An external reference for the document.
|
|
33834
|
-
* @property {string} typedoc - The type of document of the signer (e.g., "V", "E", "J").
|
|
33835
|
-
* @property {string} doc - The document number of the signer.
|
|
33836
|
-
* @property {SignaturePosition[]} signature - An array of signature positions.
|
|
33837
|
-
*/
|
|
33838
|
-
|
|
33839
|
-
/**
|
|
33840
|
-
* Adds a new signer to the signature process.
|
|
33841
|
-
* This function acts as a dispatcher, delegating to the appropriate implementation
|
|
33842
|
-
* based on the configured integration type.
|
|
33843
|
-
*
|
|
33844
|
-
* @param {OnboardingSignerData | object} signerData - The signer's data. The structure depends on the integration type.
|
|
33845
|
-
* @returns {Promise<object>} The result from the API.
|
|
33846
|
-
* @throws {ApacuanaAPIError} If signerData is invalid or if the integration type is not supported.
|
|
33847
|
-
*/
|
|
33848
33876
|
var addSigner = /*#__PURE__*/function () {
|
|
33849
33877
|
var _ref16 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(signerData) {
|
|
33850
33878
|
var _getConfig5, integrationType;
|
|
@@ -34043,6 +34071,216 @@ var deleteSignatureVariant = /*#__PURE__*/function () {
|
|
|
34043
34071
|
};
|
|
34044
34072
|
}();
|
|
34045
34073
|
|
|
34074
|
+
/**
|
|
34075
|
+
* Creates a new Face Liveness session.
|
|
34076
|
+
* @returns {Promise<CreateFaceLivenessSessionResponse>} Object with the session ID and a success indicator.
|
|
34077
|
+
* @throws {ApacuanaAPIError} If the API response is invalid or the integration type is not supported.
|
|
34078
|
+
* @throws {Error} If the request fails for another reason.
|
|
34079
|
+
*/
|
|
34080
|
+
var createFaceLivenessSessionOnBoarding = /*#__PURE__*/function () {
|
|
34081
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
34082
|
+
var response, _t;
|
|
34083
|
+
return _regenerator().w(function (_context) {
|
|
34084
|
+
while (1) switch (_context.p = _context.n) {
|
|
34085
|
+
case 0:
|
|
34086
|
+
_context.p = 0;
|
|
34087
|
+
_context.n = 1;
|
|
34088
|
+
return httpRequest("services/api/faceliveness/create", {}, "POST");
|
|
34089
|
+
case 1:
|
|
34090
|
+
response = _context.v;
|
|
34091
|
+
if (response.sessionid) {
|
|
34092
|
+
_context.n = 2;
|
|
34093
|
+
break;
|
|
34094
|
+
}
|
|
34095
|
+
throw new ApacuanaAPIError("The API response does not contain the session ID.", response.status, "INVALID_API_RESPONSE");
|
|
34096
|
+
case 2:
|
|
34097
|
+
return _context.a(2, new ApacuanaSuccess({
|
|
34098
|
+
sessionId: response.sessionid
|
|
34099
|
+
}));
|
|
34100
|
+
case 3:
|
|
34101
|
+
_context.p = 3;
|
|
34102
|
+
_t = _context.v;
|
|
34103
|
+
if (!(_t instanceof ApacuanaAPIError)) {
|
|
34104
|
+
_context.n = 4;
|
|
34105
|
+
break;
|
|
34106
|
+
}
|
|
34107
|
+
throw _t;
|
|
34108
|
+
case 4:
|
|
34109
|
+
throw new ApacuanaAPIError("Failed to create Face Liveness session: ".concat(_t.message));
|
|
34110
|
+
case 5:
|
|
34111
|
+
return _context.a(2);
|
|
34112
|
+
}
|
|
34113
|
+
}, _callee, null, [[0, 3]]);
|
|
34114
|
+
}));
|
|
34115
|
+
return function createFaceLivenessSessionOnBoarding() {
|
|
34116
|
+
return _ref.apply(this, arguments);
|
|
34117
|
+
};
|
|
34118
|
+
}();
|
|
34119
|
+
var createFaceLivenessSessionOnPremise = /*#__PURE__*/function () {
|
|
34120
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
34121
|
+
return _regenerator().w(function (_context2) {
|
|
34122
|
+
while (1) switch (_context2.n) {
|
|
34123
|
+
case 0:
|
|
34124
|
+
throw new ApacuanaAPIError("Creating a Face Liveness session is not supported for integration type: ONPREMISE", 501, "NOT_IMPLEMENTED");
|
|
34125
|
+
case 1:
|
|
34126
|
+
return _context2.a(2);
|
|
34127
|
+
}
|
|
34128
|
+
}, _callee2);
|
|
34129
|
+
}));
|
|
34130
|
+
return function createFaceLivenessSessionOnPremise() {
|
|
34131
|
+
return _ref2.apply(this, arguments);
|
|
34132
|
+
};
|
|
34133
|
+
}();
|
|
34134
|
+
var validateFaceLivenessOnBoarding = /*#__PURE__*/function () {
|
|
34135
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(sessionId) {
|
|
34136
|
+
var response, status, _t2, _t3;
|
|
34137
|
+
return _regenerator().w(function (_context3) {
|
|
34138
|
+
while (1) switch (_context3.p = _context3.n) {
|
|
34139
|
+
case 0:
|
|
34140
|
+
_context3.p = 0;
|
|
34141
|
+
_context3.n = 1;
|
|
34142
|
+
return httpRequest("services/api/faceliveness/validate", {
|
|
34143
|
+
sessionid: sessionId
|
|
34144
|
+
}, "POST");
|
|
34145
|
+
case 1:
|
|
34146
|
+
response = _context3.v;
|
|
34147
|
+
return _context3.a(2, new ApacuanaSuccess(_objectSpread2({
|
|
34148
|
+
status: "verified"
|
|
34149
|
+
}, response)));
|
|
34150
|
+
case 2:
|
|
34151
|
+
_context3.p = 2;
|
|
34152
|
+
_t2 = _context3.v;
|
|
34153
|
+
if (!(_t2 instanceof ApacuanaAPIError)) {
|
|
34154
|
+
_context3.n = 9;
|
|
34155
|
+
break;
|
|
34156
|
+
}
|
|
34157
|
+
_t3 = _t2.statusCode;
|
|
34158
|
+
_context3.n = _t3 === 402 ? 3 : _t3 === 403 ? 4 : _t3 === 406 ? 5 : _t3 === 408 ? 6 : 7;
|
|
34159
|
+
break;
|
|
34160
|
+
case 3:
|
|
34161
|
+
status = "waitingForScan";
|
|
34162
|
+
return _context3.a(3, 8);
|
|
34163
|
+
case 4:
|
|
34164
|
+
status = "rejected";
|
|
34165
|
+
return _context3.a(3, 8);
|
|
34166
|
+
case 5:
|
|
34167
|
+
status = "processing";
|
|
34168
|
+
return _context3.a(3, 8);
|
|
34169
|
+
case 6:
|
|
34170
|
+
status = "expired";
|
|
34171
|
+
return _context3.a(3, 8);
|
|
34172
|
+
case 7:
|
|
34173
|
+
throw _t2;
|
|
34174
|
+
case 8:
|
|
34175
|
+
return _context3.a(2, new ApacuanaSuccess({
|
|
34176
|
+
status: status
|
|
34177
|
+
}));
|
|
34178
|
+
case 9:
|
|
34179
|
+
throw _t2;
|
|
34180
|
+
case 10:
|
|
34181
|
+
return _context3.a(2);
|
|
34182
|
+
}
|
|
34183
|
+
}, _callee3, null, [[0, 2]]);
|
|
34184
|
+
}));
|
|
34185
|
+
return function validateFaceLivenessOnBoarding(_x) {
|
|
34186
|
+
return _ref3.apply(this, arguments);
|
|
34187
|
+
};
|
|
34188
|
+
}();
|
|
34189
|
+
var validateFaceLivenessOnPremise = /*#__PURE__*/function () {
|
|
34190
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
|
|
34191
|
+
return _regenerator().w(function (_context4) {
|
|
34192
|
+
while (1) switch (_context4.n) {
|
|
34193
|
+
case 0:
|
|
34194
|
+
throw new ApacuanaAPIError("Validating a Face Liveness session is not supported for integration type: ONPREMISE", 501, "NOT_IMPLEMENTED");
|
|
34195
|
+
case 1:
|
|
34196
|
+
return _context4.a(2);
|
|
34197
|
+
}
|
|
34198
|
+
}, _callee4);
|
|
34199
|
+
}));
|
|
34200
|
+
return function validateFaceLivenessOnPremise() {
|
|
34201
|
+
return _ref4.apply(this, arguments);
|
|
34202
|
+
};
|
|
34203
|
+
}();
|
|
34204
|
+
|
|
34205
|
+
/**
|
|
34206
|
+
* Creates a new Face Liveness session.
|
|
34207
|
+
* @returns {Promise<CreateFaceLivenessSessionResponse>} Object with the session ID and a success indicator.
|
|
34208
|
+
* @throws {ApacuanaAPIError} If the API response is invalid or the integration type is not supported.
|
|
34209
|
+
* @throws {Error} If the request fails for another reason.
|
|
34210
|
+
*/
|
|
34211
|
+
var createFaceLivenessSession = /*#__PURE__*/function () {
|
|
34212
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
|
|
34213
|
+
var _getConfig, integrationType;
|
|
34214
|
+
return _regenerator().w(function (_context5) {
|
|
34215
|
+
while (1) switch (_context5.n) {
|
|
34216
|
+
case 0:
|
|
34217
|
+
_getConfig = getConfig(), integrationType = _getConfig.integrationType;
|
|
34218
|
+
if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
|
|
34219
|
+
_context5.n = 1;
|
|
34220
|
+
break;
|
|
34221
|
+
}
|
|
34222
|
+
return _context5.a(2, createFaceLivenessSessionOnBoarding());
|
|
34223
|
+
case 1:
|
|
34224
|
+
if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
|
|
34225
|
+
_context5.n = 2;
|
|
34226
|
+
break;
|
|
34227
|
+
}
|
|
34228
|
+
return _context5.a(2, createFaceLivenessSessionOnPremise());
|
|
34229
|
+
case 2:
|
|
34230
|
+
throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
|
|
34231
|
+
case 3:
|
|
34232
|
+
return _context5.a(2);
|
|
34233
|
+
}
|
|
34234
|
+
}, _callee5);
|
|
34235
|
+
}));
|
|
34236
|
+
return function createFaceLivenessSession() {
|
|
34237
|
+
return _ref5.apply(this, arguments);
|
|
34238
|
+
};
|
|
34239
|
+
}();
|
|
34240
|
+
|
|
34241
|
+
/**
|
|
34242
|
+
* Validates a Face Liveness session and returns its status.
|
|
34243
|
+
* @param {{sessionId: string}} params - Object containing the session ID.
|
|
34244
|
+
* @returns {Promise<ApacuanaSuccess>} Object with the validation status.
|
|
34245
|
+
* @throws {ApacuanaAPIError} If the API response is invalid or the integration type is not supported.
|
|
34246
|
+
*/
|
|
34247
|
+
var validateFaceLiveness = /*#__PURE__*/function () {
|
|
34248
|
+
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(_ref6) {
|
|
34249
|
+
var sessionId, _getConfig2, integrationType;
|
|
34250
|
+
return _regenerator().w(function (_context6) {
|
|
34251
|
+
while (1) switch (_context6.n) {
|
|
34252
|
+
case 0:
|
|
34253
|
+
sessionId = _ref6.sessionId;
|
|
34254
|
+
if (sessionId) {
|
|
34255
|
+
_context6.n = 1;
|
|
34256
|
+
break;
|
|
34257
|
+
}
|
|
34258
|
+
throw new ApacuanaAPIError("sessionId is a required parameter.", 400, "INVALID_PARAMETER");
|
|
34259
|
+
case 1:
|
|
34260
|
+
_getConfig2 = getConfig(), integrationType = _getConfig2.integrationType;
|
|
34261
|
+
if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
|
|
34262
|
+
_context6.n = 2;
|
|
34263
|
+
break;
|
|
34264
|
+
}
|
|
34265
|
+
return _context6.a(2, validateFaceLivenessOnBoarding(sessionId));
|
|
34266
|
+
case 2:
|
|
34267
|
+
if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
|
|
34268
|
+
_context6.n = 3;
|
|
34269
|
+
break;
|
|
34270
|
+
}
|
|
34271
|
+
return _context6.a(2, validateFaceLivenessOnPremise());
|
|
34272
|
+
case 3:
|
|
34273
|
+
throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
|
|
34274
|
+
case 4:
|
|
34275
|
+
return _context6.a(2);
|
|
34276
|
+
}
|
|
34277
|
+
}, _callee6);
|
|
34278
|
+
}));
|
|
34279
|
+
return function validateFaceLiveness(_x2) {
|
|
34280
|
+
return _ref7.apply(this, arguments);
|
|
34281
|
+
};
|
|
34282
|
+
}();
|
|
34283
|
+
|
|
34046
34284
|
var apacuana = {
|
|
34047
34285
|
/**
|
|
34048
34286
|
* Inicializa el Apacuana SDK con la configuración necesaria y obtiene
|
|
@@ -34058,7 +34296,7 @@ var apacuana = {
|
|
|
34058
34296
|
*/
|
|
34059
34297
|
init: function () {
|
|
34060
34298
|
var _init = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(config) {
|
|
34061
|
-
var currentConfig,
|
|
34299
|
+
var currentConfig, customer, _customer$data, token, userData, _t;
|
|
34062
34300
|
return _regenerator().w(function (_context) {
|
|
34063
34301
|
while (1) switch (_context.p = _context.n) {
|
|
34064
34302
|
case 0:
|
|
@@ -34070,27 +34308,37 @@ var apacuana = {
|
|
|
34070
34308
|
_context.n = 1;
|
|
34071
34309
|
break;
|
|
34072
34310
|
}
|
|
34073
|
-
throw new
|
|
34311
|
+
throw new ApacuanaAPIError("Apacuana SDK: La configuración de CustomerId no se ha guardado" + " correctamente.", 400, {
|
|
34312
|
+
code: "CONFIG_ERROR"
|
|
34313
|
+
});
|
|
34074
34314
|
case 1:
|
|
34075
34315
|
_context.n = 2;
|
|
34076
34316
|
return getCustomer();
|
|
34077
34317
|
case 2:
|
|
34078
|
-
|
|
34079
|
-
token =
|
|
34080
|
-
userData = _yield$getCustomer.userData;
|
|
34318
|
+
customer = _context.v;
|
|
34319
|
+
_customer$data = customer.data, token = _customer$data.token, userData = _customer$data.userData;
|
|
34081
34320
|
setConfig(_objectSpread2(_objectSpread2({}, currentConfig), {}, {
|
|
34082
34321
|
token: token,
|
|
34083
34322
|
userData: userData
|
|
34084
34323
|
}));
|
|
34085
34324
|
setAuthToken(token);
|
|
34086
|
-
return _context.a(2,
|
|
34325
|
+
return _context.a(2, new ApacuanaSuccess({
|
|
34326
|
+
initialized: true,
|
|
34327
|
+
message: "SDK inicializado correctamente."
|
|
34328
|
+
}));
|
|
34087
34329
|
case 3:
|
|
34088
34330
|
_context.p = 3;
|
|
34089
34331
|
_t = _context.v;
|
|
34090
34332
|
// eslint-disable-next-line no-console
|
|
34091
34333
|
console.error("Error durante la inicialización del SDK:", _t);
|
|
34334
|
+
if (!(_t instanceof ApacuanaAPIError)) {
|
|
34335
|
+
_context.n = 4;
|
|
34336
|
+
break;
|
|
34337
|
+
}
|
|
34092
34338
|
throw _t;
|
|
34093
34339
|
case 4:
|
|
34340
|
+
throw new ApacuanaAPIError(_t.message || "Error desconocido durante la inicialización.", 500, _t);
|
|
34341
|
+
case 5:
|
|
34094
34342
|
return _context.a(2);
|
|
34095
34343
|
}
|
|
34096
34344
|
}, _callee, null, [[0, 3]]);
|
|
@@ -34100,6 +34348,9 @@ var apacuana = {
|
|
|
34100
34348
|
}
|
|
34101
34349
|
return init;
|
|
34102
34350
|
}(),
|
|
34351
|
+
/**
|
|
34352
|
+
* Permite obtener la configuración actual del SDK.
|
|
34353
|
+
*/
|
|
34103
34354
|
close: function close$1() {
|
|
34104
34355
|
return close();
|
|
34105
34356
|
},
|
|
@@ -34117,7 +34368,10 @@ var apacuana = {
|
|
|
34117
34368
|
getSignatureVariant: getSignatureVariant,
|
|
34118
34369
|
deleteSignatureVariant: deleteSignatureVariant,
|
|
34119
34370
|
getCertTypes: getCertTypes,
|
|
34120
|
-
getRequerimentsByTypeUser: getRequerimentsByTypeUser
|
|
34371
|
+
getRequerimentsByTypeUser: getRequerimentsByTypeUser,
|
|
34372
|
+
createFaceLivenessSession: createFaceLivenessSession,
|
|
34373
|
+
validateFaceLiveness: validateFaceLiveness,
|
|
34374
|
+
requestCertificate: requestCertificate
|
|
34121
34375
|
};
|
|
34122
34376
|
|
|
34123
34377
|
export { apacuana as default };
|