apacuana-sdk-core 1.9.0 → 1.11.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.
Files changed (37) hide show
  1. package/coverage/clover.xml +186 -185
  2. package/coverage/coverage-final.json +4 -4
  3. package/coverage/lcov-report/index.html +10 -10
  4. package/coverage/lcov-report/src/api/certs.js.html +190 -7
  5. package/coverage/lcov-report/src/api/faceLiveness.js.html +1 -1
  6. package/coverage/lcov-report/src/api/index.html +10 -10
  7. package/coverage/lcov-report/src/api/revocations.js.html +1 -1
  8. package/coverage/lcov-report/src/api/signatures.js.html +18 -3
  9. package/coverage/lcov-report/src/api/users.js.html +1 -1
  10. package/coverage/lcov-report/src/config/index.html +1 -1
  11. package/coverage/lcov-report/src/config/index.js.html +1 -1
  12. package/coverage/lcov-report/src/errors/index.html +1 -1
  13. package/coverage/lcov-report/src/errors/index.js.html +1 -1
  14. package/coverage/lcov-report/src/index.html +1 -1
  15. package/coverage/lcov-report/src/index.js.html +14 -2
  16. package/coverage/lcov-report/src/success/index.html +1 -1
  17. package/coverage/lcov-report/src/success/index.js.html +1 -1
  18. package/coverage/lcov-report/src/utils/constant.js.html +5 -2
  19. package/coverage/lcov-report/src/utils/helpers.js.html +1 -1
  20. package/coverage/lcov-report/src/utils/httpClient.js.html +1 -1
  21. package/coverage/lcov-report/src/utils/index.html +1 -1
  22. package/coverage/lcov.info +311 -310
  23. package/dist/api/certs.d.ts +2 -0
  24. package/dist/index.js +70 -2
  25. package/dist/index.js.map +1 -1
  26. package/dist/index.mjs +70 -2
  27. package/dist/index.mjs.map +1 -1
  28. package/dist/types/certs.d.ts +16 -0
  29. package/dist/utils/constant.d.ts +5 -4
  30. package/dist/utils/helpers.d.ts +1 -1
  31. package/package.json +1 -1
  32. package/src/api/certs.js +62 -1
  33. package/src/api/signatures.js +6 -1
  34. package/src/index.js +4 -0
  35. package/src/types/certs.js +9 -0
  36. package/src/utils/constant.js +1 -0
  37. package/tests/api/signatures.test.js +6 -1
package/dist/index.mjs CHANGED
@@ -274,6 +274,7 @@ function _wrapNativeSuper(t) {
274
274
 
275
275
  var STATUS_CERTIFICATE = {
276
276
  request: "SOLICITUD",
277
+ request_cert: "REVISION",
277
278
  generate: "GENERAR",
278
279
  current: "VIGENTE",
279
280
  revoque: "REVOCADO",
@@ -33308,6 +33309,10 @@ var getCertStatus = /*#__PURE__*/function () {
33308
33309
  userData = customer.data.userData;
33309
33310
  status = helpers.getCertificateStatus(userData, isCertificateInDevice, config.integrationType);
33310
33311
  parseStatus = PARSE_STATUS[status];
33312
+ console.log({
33313
+ status: status,
33314
+ parseStatus: parseStatus
33315
+ });
33311
33316
  return _context4.a(2, new ApacuanaSuccess({
33312
33317
  status: parseStatus
33313
33318
  }));
@@ -33492,6 +33497,62 @@ var getRequerimentsByTypeUser = /*#__PURE__*/function () {
33492
33497
  };
33493
33498
  }();
33494
33499
 
33500
+ // const validateCertificateOnBoarding = async (params) => {
33501
+ // throw new ApacuanaAPIError(
33502
+ // "Requesting a certificate is not supported for integration type: ONBOARDING",
33503
+ // 501,
33504
+ // "NOT_IMPLEMENTED"
33505
+ // );
33506
+ // // try {
33507
+ // // const response = await httpRequest(
33508
+ // // "services/api/customer/request-certificate",
33509
+ // // params,
33510
+ // // "POST"
33511
+ // // );
33512
+ // // return new ApacuanaSuccess(response);
33513
+ // // } catch (error) {
33514
+ // // if (error instanceof ApacuanaAPIError) {
33515
+ // // throw error;
33516
+ // // }
33517
+ // // throw new Error(`Failed to request certificate: ${error.message}`);
33518
+ // // }
33519
+ // };
33520
+
33521
+ // const validateCertificateOnPremise = async () => {
33522
+ // throw new ApacuanaAPIError(
33523
+ // "Requesting a certificate is not supported for integration type: ONPREMISE",
33524
+ // 501,
33525
+ // "NOT_IMPLEMENTED"
33526
+ // );
33527
+ // };
33528
+
33529
+ // /**
33530
+ // * Requests a certificate for the user.
33531
+ // * @param {ValidateCertificateRequestParams} params - The parameters for the certificate request.
33532
+ // * @returns {Promise<ValidateCertificateResponseData>} Object with a confirmation message and a success indicator.
33533
+ // * @throws {ApacuanaAPIError} If the API response is invalid or the integration type is not supported.
33534
+ // * @throws {Error} If the request fails for another reason or the params are invalid.
33535
+ // */
33536
+ // export const validateCertificate = async (params) => {
33537
+ // if (!params || typeof params.challenge !== "string") {
33538
+ // throw new Error("Invalid params.");
33539
+ // }
33540
+
33541
+ // const { integrationType } = getConfig();
33542
+ // if (integrationType === INTEGRATION_TYPE.ONBOARDING) {
33543
+ // return requestCertificateOnBoarding(params);
33544
+ // }
33545
+ // if (integrationType === INTEGRATION_TYPE.ONPREMISE) {
33546
+ // return requestCertificateOnPremise();
33547
+ // }
33548
+
33549
+ // throw new ApacuanaAPIError(
33550
+ // `Unsupported integration type: ${integrationType}`,
33551
+ // 400,
33552
+ // "UNSUPPORTED_INTEGRATION_TYPE"
33553
+ // );
33554
+ // };
33555
+
33495
33556
  /** @typedef {import("../types/signatures").Signer} Signer */
33496
33557
  /** @typedef {import("../types/signatures").SignerData} SignerData */
33497
33558
  /** @typedef {import("../types/signatures").AddSignerResponse} AddSignerResponse */
@@ -33613,7 +33674,7 @@ var getDigestToSignOnPremise = /*#__PURE__*/function () {
33613
33674
  }();
33614
33675
  var addSignerOnBoarding = /*#__PURE__*/function () {
33615
33676
  var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(signerData) {
33616
- var payload, _t3;
33677
+ var payload, response, _t3;
33617
33678
  return _regenerator().w(function (_context5) {
33618
33679
  while (1) switch (_context5.p = _context5.n) {
33619
33680
  case 0:
@@ -33622,8 +33683,10 @@ var addSignerOnBoarding = /*#__PURE__*/function () {
33622
33683
  _context5.n = 2;
33623
33684
  return httpRequest("services/api/documents/signingsdk", payload, "POST");
33624
33685
  case 2:
33686
+ response = _context5.v;
33625
33687
  return _context5.a(2, new ApacuanaSuccess({
33626
- signer: signerData.typedoc + signerData.doc
33688
+ signer: signerData.typedoc + signerData.doc,
33689
+ docId: response.data.id
33627
33690
  }));
33628
33691
  case 3:
33629
33692
  _context5.p = 3;
@@ -34503,6 +34566,11 @@ var apacuana = {
34503
34566
  checkSdk(true);
34504
34567
  return validateFaceLiveness(data);
34505
34568
  },
34569
+ // validateCertificate: (data) => {
34570
+ // checkSdk(true);
34571
+ // validateCertificate(data);
34572
+ // },
34573
+
34506
34574
  close: function close$1() {
34507
34575
  return close();
34508
34576
  },