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