apacuana-sdk-core 1.26.3 → 1.26.5

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 (40) hide show
  1. package/.env +3 -2
  2. package/README.md +31 -0
  3. package/coverage/clover.xml +272 -246
  4. package/coverage/coverage-final.json +5 -5
  5. package/coverage/lcov-report/index.html +33 -33
  6. package/coverage/lcov-report/src/api/certs.js.html +1 -1
  7. package/coverage/lcov-report/src/api/faceLiveness.js.html +1 -1
  8. package/coverage/lcov-report/src/api/index.html +17 -17
  9. package/coverage/lcov-report/src/api/revocations.js.html +1 -1
  10. package/coverage/lcov-report/src/api/signatures.js.html +260 -11
  11. package/coverage/lcov-report/src/api/users.js.html +1 -1
  12. package/coverage/lcov-report/src/config/index.html +1 -1
  13. package/coverage/lcov-report/src/config/index.js.html +1 -1
  14. package/coverage/lcov-report/src/errors/index.html +1 -1
  15. package/coverage/lcov-report/src/errors/index.js.html +8 -8
  16. package/coverage/lcov-report/src/index.html +15 -15
  17. package/coverage/lcov-report/src/index.js.html +23 -8
  18. package/coverage/lcov-report/src/success/index.html +1 -1
  19. package/coverage/lcov-report/src/success/index.js.html +5 -5
  20. package/coverage/lcov-report/src/utils/constant.js.html +1 -1
  21. package/coverage/lcov-report/src/utils/helpers.js.html +1 -1
  22. package/coverage/lcov-report/src/utils/httpClient.js.html +51 -9
  23. package/coverage/lcov-report/src/utils/index.html +12 -12
  24. package/coverage/lcov.info +494 -436
  25. package/dist/api/signatures.d.ts +2 -0
  26. package/dist/index.d.ts +1 -0
  27. package/dist/index.js +245 -119
  28. package/dist/index.js.map +1 -1
  29. package/dist/index.mjs +245 -119
  30. package/dist/index.mjs.map +1 -1
  31. package/dist/types/signatures.d.ts +13 -0
  32. package/dist/utils/httpClient.d.ts +3 -1
  33. package/package.json +1 -1
  34. package/src/api/signatures.js +85 -2
  35. package/src/index.js +5 -0
  36. package/src/types/signatures.js +7 -0
  37. package/src/utils/httpClient.js +16 -2
  38. package/tests/api/signatures.test.js +120 -2
  39. package/tests/integration/createAndLockDocument.test.js +3 -2
  40. package/tests/integration/deleteSignature.test.js +96 -0
package/dist/index.js CHANGED
@@ -465,6 +465,8 @@ var setAuthToken = function setAuthToken(token) {
465
465
  * @param {string} path - La ruta del endpoint de la API.
466
466
  * @param {object} [data={}] - Los datos para enviar en la petición.
467
467
  * @param {string} [method='POST'] - El método HTTP.
468
+ * @param {object} [options={}] - Opciones adicionales.
469
+ * @param {boolean} [options.skipAuth=false] - Si es true, no envía el header Authorization aunque haya un Bearer configurado. Usar para endpoints públicos que solo requieren API keys.
468
470
  * @returns {Promise<object>} Los datos de la respuesta del backend.
469
471
  * @throws {ApacuanaAPIError} Si la petición falla.
470
472
  */
@@ -472,6 +474,7 @@ var httpRequest = /*#__PURE__*/function () {
472
474
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(path) {
473
475
  var data,
474
476
  method,
477
+ options,
475
478
  dataToSend,
476
479
  requestConfig,
477
480
  hasFile,
@@ -485,6 +488,7 @@ var httpRequest = /*#__PURE__*/function () {
485
488
  case 0:
486
489
  data = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
487
490
  method = _args.length > 2 && _args[2] !== undefined ? _args[2] : "POST";
491
+ options = _args.length > 3 && _args[3] !== undefined ? _args[3] : {};
488
492
  if (axiosInstance) {
489
493
  _context.n = 1;
490
494
  break;
@@ -492,6 +496,11 @@ var httpRequest = /*#__PURE__*/function () {
492
496
  throw new Error("Apacuana SDK: Cliente HTTP no inicializado. " + "Llama a apacuana.init() primero.");
493
497
  case 1:
494
498
  requestConfig = {};
499
+ if (options.skipAuth) {
500
+ requestConfig.headers = {
501
+ Authorization: undefined
502
+ };
503
+ }
495
504
  if (typeof FormData !== "undefined" && data instanceof FormData) {
496
505
  dataToSend = data;
497
506
  } else {
@@ -514,9 +523,9 @@ var httpRequest = /*#__PURE__*/function () {
514
523
  break;
515
524
  case 3:
516
525
  _context.n = 4;
517
- return axiosInstance.get(path, {
526
+ return axiosInstance.get(path, _objectSpread2({
518
527
  params: dataToSend
519
- });
528
+ }, requestConfig));
520
529
  case 4:
521
530
  response = _context.v;
522
531
  return _context.a(3, 12);
@@ -33597,6 +33606,7 @@ var getRequerimentsByTypeUser = /*#__PURE__*/function () {
33597
33606
  /** @typedef {import("../types/signatures").SignDocumentData} SignDocumentData */
33598
33607
  /** @typedef {import("../types/signatures").SignaturePosition} SignaturePosition */
33599
33608
  /** @typedef {import("../types/signatures").OnboardingSignerData} OnboardingSignerData */
33609
+ /** @typedef {import("../types/signatures").DeleteSignatureData} DeleteSignatureData */
33600
33610
 
33601
33611
  // =================================================================
33602
33612
  // Internal Functions
@@ -34026,7 +34036,9 @@ var createDocumentOnBoarding = /*#__PURE__*/function () {
34026
34036
  formData.append("reference", documentData.reference);
34027
34037
  _context15.p = 1;
34028
34038
  _context15.n = 2;
34029
- return httpRequest("services/api/documents", formData, "POST");
34039
+ return httpRequest("services/api/documents", formData, "POST", {
34040
+ skipAuth: true
34041
+ });
34030
34042
  case 2:
34031
34043
  response = _context15.v;
34032
34044
  return _context15.a(2, new ApacuanaSuccess({
@@ -34075,7 +34087,9 @@ var lockDocumentOnBoarding = /*#__PURE__*/function () {
34075
34087
  case 0:
34076
34088
  _context17.p = 0;
34077
34089
  _context17.n = 1;
34078
- return httpRequest("services/api/documents/lock/".concat(documentId), {}, "PUT");
34090
+ return httpRequest("services/api/documents/lock/".concat(documentId), {}, "PUT", {
34091
+ skipAuth: true
34092
+ });
34079
34093
  case 1:
34080
34094
  response = _context17.v;
34081
34095
  return _context17.a(2, new ApacuanaSuccess(response));
@@ -34113,6 +34127,58 @@ var lockDocumentOnPremise = /*#__PURE__*/function () {
34113
34127
  return _ref19.apply(this, arguments);
34114
34128
  };
34115
34129
  }();
34130
+ var deleteSignatureOnBoarding = /*#__PURE__*/function () {
34131
+ var _ref21 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(_ref20) {
34132
+ var documentId, signatureId, response, _t1;
34133
+ return _regenerator().w(function (_context19) {
34134
+ while (1) switch (_context19.p = _context19.n) {
34135
+ case 0:
34136
+ documentId = _ref20.documentId, signatureId = _ref20.signatureId;
34137
+ _context19.p = 1;
34138
+ _context19.n = 2;
34139
+ return httpRequest("services/api/documents/signature", {
34140
+ documentid: documentId,
34141
+ signatureid: signatureId
34142
+ }, "DELETE", {
34143
+ skipAuth: true
34144
+ });
34145
+ case 2:
34146
+ response = _context19.v;
34147
+ return _context19.a(2, new ApacuanaSuccess(response));
34148
+ case 3:
34149
+ _context19.p = 3;
34150
+ _t1 = _context19.v;
34151
+ if (!(_t1 instanceof ApacuanaAPIError)) {
34152
+ _context19.n = 4;
34153
+ break;
34154
+ }
34155
+ throw _t1;
34156
+ case 4:
34157
+ throw new ApacuanaAPIError("Failed to delete signature: ".concat(_t1.message || "Unknown error"));
34158
+ case 5:
34159
+ return _context19.a(2);
34160
+ }
34161
+ }, _callee19, null, [[1, 3]]);
34162
+ }));
34163
+ return function deleteSignatureOnBoarding(_x9) {
34164
+ return _ref21.apply(this, arguments);
34165
+ };
34166
+ }();
34167
+ var deleteSignatureOnPremise = /*#__PURE__*/function () {
34168
+ var _ref22 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20() {
34169
+ return _regenerator().w(function (_context20) {
34170
+ while (1) switch (_context20.n) {
34171
+ case 0:
34172
+ throw new ApacuanaAPIError("Deleting signatures from documents is not supported for integration type: ONPREMISE", 501, "NOT_IMPLEMENTED");
34173
+ case 1:
34174
+ return _context20.a(2);
34175
+ }
34176
+ }, _callee20);
34177
+ }));
34178
+ return function deleteSignatureOnPremise() {
34179
+ return _ref22.apply(this, arguments);
34180
+ };
34181
+ }();
34116
34182
 
34117
34183
  // =================================================================
34118
34184
  // Exported Functions
@@ -34126,32 +34192,32 @@ var lockDocumentOnPremise = /*#__PURE__*/function () {
34126
34192
  * @throws {ApacuanaAPIError} Arroja un error 'NOT_IMPLEMENTED' para cualquier tipo de integración.
34127
34193
  */
34128
34194
  var signDocument = /*#__PURE__*/function () {
34129
- var _ref20 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(signData) {
34195
+ var _ref23 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21(signData) {
34130
34196
  var _getConfig3, integrationType;
34131
- return _regenerator().w(function (_context19) {
34132
- while (1) switch (_context19.n) {
34197
+ return _regenerator().w(function (_context21) {
34198
+ while (1) switch (_context21.n) {
34133
34199
  case 0:
34134
34200
  _getConfig3 = getConfig(), integrationType = _getConfig3.integrationType;
34135
34201
  if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
34136
- _context19.n = 1;
34202
+ _context21.n = 1;
34137
34203
  break;
34138
34204
  }
34139
- return _context19.a(2, signDocumentOnBoarding(signData));
34205
+ return _context21.a(2, signDocumentOnBoarding(signData));
34140
34206
  case 1:
34141
34207
  if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
34142
- _context19.n = 2;
34208
+ _context21.n = 2;
34143
34209
  break;
34144
34210
  }
34145
- return _context19.a(2, signDocumentOnPremise());
34211
+ return _context21.a(2, signDocumentOnPremise());
34146
34212
  case 2:
34147
34213
  throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
34148
34214
  case 3:
34149
- return _context19.a(2);
34215
+ return _context21.a(2);
34150
34216
  }
34151
- }, _callee19);
34217
+ }, _callee21);
34152
34218
  }));
34153
- return function signDocument(_x9) {
34154
- return _ref20.apply(this, arguments);
34219
+ return function signDocument(_x0) {
34220
+ return _ref23.apply(this, arguments);
34155
34221
  };
34156
34222
  }();
34157
34223
 
@@ -34162,33 +34228,33 @@ var signDocument = /*#__PURE__*/function () {
34162
34228
  * @throws {ApacuanaAPIError} Si los datos de entrada son inválidos, la llamada a la API falla, o el tipo de integración no es soportado.
34163
34229
  */
34164
34230
  var getDigest = /*#__PURE__*/function () {
34165
- var _ref21 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20(signData) {
34231
+ var _ref24 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee22(signData) {
34166
34232
  var _getConfig4, integrationType;
34167
- return _regenerator().w(function (_context20) {
34168
- while (1) switch (_context20.n) {
34233
+ return _regenerator().w(function (_context22) {
34234
+ while (1) switch (_context22.n) {
34169
34235
  case 0:
34170
34236
  helpers.validateGetDigestData(signData);
34171
34237
  _getConfig4 = getConfig(), integrationType = _getConfig4.integrationType;
34172
34238
  if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
34173
- _context20.n = 1;
34239
+ _context22.n = 1;
34174
34240
  break;
34175
34241
  }
34176
- return _context20.a(2, getDigestToSignOnBoarding(signData));
34242
+ return _context22.a(2, getDigestToSignOnBoarding(signData));
34177
34243
  case 1:
34178
34244
  if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
34179
- _context20.n = 2;
34245
+ _context22.n = 2;
34180
34246
  break;
34181
34247
  }
34182
- return _context20.a(2, getDigestToSignOnPremise());
34248
+ return _context22.a(2, getDigestToSignOnPremise());
34183
34249
  case 2:
34184
34250
  throw new ApacuanaAPIError("Document retrieval is not supported for an unknown integration type: ".concat(integrationType), 501, "NOT_IMPLEMENTED");
34185
34251
  case 3:
34186
- return _context20.a(2);
34252
+ return _context22.a(2);
34187
34253
  }
34188
- }, _callee20);
34254
+ }, _callee22);
34189
34255
  }));
34190
- return function getDigest(_x0) {
34191
- return _ref21.apply(this, arguments);
34256
+ return function getDigest(_x1) {
34257
+ return _ref24.apply(this, arguments);
34192
34258
  };
34193
34259
  }();
34194
34260
 
@@ -34199,38 +34265,38 @@ var getDigest = /*#__PURE__*/function () {
34199
34265
  * @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.
34200
34266
  */
34201
34267
  var addSigner = /*#__PURE__*/function () {
34202
- var _ref22 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21(signerData) {
34268
+ var _ref25 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee23(signerData) {
34203
34269
  var _getConfig5, integrationType;
34204
- return _regenerator().w(function (_context21) {
34205
- while (1) switch (_context21.n) {
34270
+ return _regenerator().w(function (_context23) {
34271
+ while (1) switch (_context23.n) {
34206
34272
  case 0:
34207
34273
  if (!(!signerData || _typeof(signerData) !== "object" || Object.keys(signerData).length === 0)) {
34208
- _context21.n = 1;
34274
+ _context23.n = 1;
34209
34275
  break;
34210
34276
  }
34211
34277
  throw new ApacuanaAPIError("Signer data (signerData) is required and must be a non-empty object.", 400, "INVALID_PARAMETER");
34212
34278
  case 1:
34213
34279
  _getConfig5 = getConfig(), integrationType = _getConfig5.integrationType;
34214
34280
  if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
34215
- _context21.n = 2;
34281
+ _context23.n = 2;
34216
34282
  break;
34217
34283
  }
34218
- return _context21.a(2, addSignerOnBoarding(signerData));
34284
+ return _context23.a(2, addSignerOnBoarding(signerData));
34219
34285
  case 2:
34220
34286
  if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
34221
- _context21.n = 3;
34287
+ _context23.n = 3;
34222
34288
  break;
34223
34289
  }
34224
- return _context21.a(2, addSignerOnPremise());
34290
+ return _context23.a(2, addSignerOnPremise());
34225
34291
  case 3:
34226
34292
  throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
34227
34293
  case 4:
34228
- return _context21.a(2);
34294
+ return _context23.a(2);
34229
34295
  }
34230
- }, _callee21);
34296
+ }, _callee23);
34231
34297
  }));
34232
- return function addSigner(_x1) {
34233
- return _ref22.apply(this, arguments);
34298
+ return function addSigner(_x10) {
34299
+ return _ref25.apply(this, arguments);
34234
34300
  };
34235
34301
  }();
34236
34302
 
@@ -34241,33 +34307,33 @@ var addSigner = /*#__PURE__*/function () {
34241
34307
  * @throws {ApacuanaAPIError} Si los parámetros de paginación son inválidos, 'customerId' no está configurado, la llamada a la API falla, o el tipo de integración no es soportado.
34242
34308
  */
34243
34309
  var getDocs = /*#__PURE__*/function () {
34244
- var _ref23 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee22(data) {
34310
+ var _ref26 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee24(data) {
34245
34311
  var _getConfig6, integrationType;
34246
- return _regenerator().w(function (_context22) {
34247
- while (1) switch (_context22.n) {
34312
+ return _regenerator().w(function (_context24) {
34313
+ while (1) switch (_context24.n) {
34248
34314
  case 0:
34249
34315
  helpers.validateGetDocsData(data);
34250
34316
  _getConfig6 = getConfig(), integrationType = _getConfig6.integrationType;
34251
34317
  if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
34252
- _context22.n = 1;
34318
+ _context24.n = 1;
34253
34319
  break;
34254
34320
  }
34255
- return _context22.a(2, getDocsOnBoarding(data));
34321
+ return _context24.a(2, getDocsOnBoarding(data));
34256
34322
  case 1:
34257
34323
  if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
34258
- _context22.n = 2;
34324
+ _context24.n = 2;
34259
34325
  break;
34260
34326
  }
34261
- return _context22.a(2, getDocsOnPremise());
34327
+ return _context24.a(2, getDocsOnPremise());
34262
34328
  case 2:
34263
34329
  throw new ApacuanaAPIError("Document retrieval is not supported for an unknown integration type: ".concat(integrationType), 501, "NOT_IMPLEMENTED");
34264
34330
  case 3:
34265
- return _context22.a(2);
34331
+ return _context24.a(2);
34266
34332
  }
34267
- }, _callee22);
34333
+ }, _callee24);
34268
34334
  }));
34269
- return function getDocs(_x10) {
34270
- return _ref23.apply(this, arguments);
34335
+ return function getDocs(_x11) {
34336
+ return _ref26.apply(this, arguments);
34271
34337
  };
34272
34338
  }();
34273
34339
 
@@ -34279,50 +34345,50 @@ var getDocs = /*#__PURE__*/function () {
34279
34345
  * @throws {ApacuanaAPIError} Si los datos son inválidos o la llamada a la API falla.
34280
34346
  */
34281
34347
  var uploadSignatureVariant = /*#__PURE__*/function () {
34282
- var _ref24 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee23(data) {
34348
+ var _ref27 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee25(data) {
34283
34349
  var _getConfig7, integrationType;
34284
- return _regenerator().w(function (_context23) {
34285
- while (1) switch (_context23.n) {
34350
+ return _regenerator().w(function (_context25) {
34351
+ while (1) switch (_context25.n) {
34286
34352
  case 0:
34287
34353
  if (!(!data || !data.file)) {
34288
- _context23.n = 1;
34354
+ _context25.n = 1;
34289
34355
  break;
34290
34356
  }
34291
34357
  throw new ApacuanaAPIError("El parámetro 'file' es requerido.", 400, "INVALID_PARAMETER");
34292
34358
  case 1:
34293
34359
  if (!(typeof File === "undefined" || !(data.file instanceof File))) {
34294
- _context23.n = 2;
34360
+ _context25.n = 2;
34295
34361
  break;
34296
34362
  }
34297
34363
  throw new ApacuanaAPIError("El parámetro 'file' debe ser una instancia de 'File'.", 400, "INVALID_PARAMETER");
34298
34364
  case 2:
34299
34365
  if (!(data.file.type !== "image/png")) {
34300
- _context23.n = 3;
34366
+ _context25.n = 3;
34301
34367
  break;
34302
34368
  }
34303
34369
  throw new ApacuanaAPIError("El archivo debe ser de tipo PNG (image/png).", 400, "INVALID_PARAMETER");
34304
34370
  case 3:
34305
34371
  _getConfig7 = getConfig(), integrationType = _getConfig7.integrationType;
34306
34372
  if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
34307
- _context23.n = 4;
34373
+ _context25.n = 4;
34308
34374
  break;
34309
34375
  }
34310
- return _context23.a(2, uploadSignatureVariantOnBoarding(data));
34376
+ return _context25.a(2, uploadSignatureVariantOnBoarding(data));
34311
34377
  case 4:
34312
34378
  if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
34313
- _context23.n = 5;
34379
+ _context25.n = 5;
34314
34380
  break;
34315
34381
  }
34316
- return _context23.a(2, uploadSignatureVariantOnPremise());
34382
+ return _context25.a(2, uploadSignatureVariantOnPremise());
34317
34383
  case 5:
34318
34384
  throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
34319
34385
  case 6:
34320
- return _context23.a(2);
34386
+ return _context25.a(2);
34321
34387
  }
34322
- }, _callee23);
34388
+ }, _callee25);
34323
34389
  }));
34324
- return function uploadSignatureVariant(_x11) {
34325
- return _ref24.apply(this, arguments);
34390
+ return function uploadSignatureVariant(_x12) {
34391
+ return _ref27.apply(this, arguments);
34326
34392
  };
34327
34393
  }();
34328
34394
 
@@ -34332,32 +34398,32 @@ var uploadSignatureVariant = /*#__PURE__*/function () {
34332
34398
  * @throws {ApacuanaAPIError} Si la llamada a la API falla o el tipo de integración no es soportado.
34333
34399
  */
34334
34400
  var getSignatureVariant = /*#__PURE__*/function () {
34335
- var _ref25 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee24() {
34401
+ var _ref28 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee26() {
34336
34402
  var _getConfig8, integrationType;
34337
- return _regenerator().w(function (_context24) {
34338
- while (1) switch (_context24.n) {
34403
+ return _regenerator().w(function (_context26) {
34404
+ while (1) switch (_context26.n) {
34339
34405
  case 0:
34340
34406
  _getConfig8 = getConfig(), integrationType = _getConfig8.integrationType;
34341
34407
  if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
34342
- _context24.n = 1;
34408
+ _context26.n = 1;
34343
34409
  break;
34344
34410
  }
34345
- return _context24.a(2, getSignatureVariantOnBoarding());
34411
+ return _context26.a(2, getSignatureVariantOnBoarding());
34346
34412
  case 1:
34347
34413
  if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
34348
- _context24.n = 2;
34414
+ _context26.n = 2;
34349
34415
  break;
34350
34416
  }
34351
- return _context24.a(2, getSignatureVariantOnPremise());
34417
+ return _context26.a(2, getSignatureVariantOnPremise());
34352
34418
  case 2:
34353
34419
  throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
34354
34420
  case 3:
34355
- return _context24.a(2);
34421
+ return _context26.a(2);
34356
34422
  }
34357
- }, _callee24);
34423
+ }, _callee26);
34358
34424
  }));
34359
34425
  return function getSignatureVariant() {
34360
- return _ref25.apply(this, arguments);
34426
+ return _ref28.apply(this, arguments);
34361
34427
  };
34362
34428
  }();
34363
34429
 
@@ -34367,32 +34433,32 @@ var getSignatureVariant = /*#__PURE__*/function () {
34367
34433
  * @throws {ApacuanaAPIError} Si la llamada a la API falla o el tipo de integración no es soportado.
34368
34434
  */
34369
34435
  var deleteSignatureVariant = /*#__PURE__*/function () {
34370
- var _ref26 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee25() {
34436
+ var _ref29 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee27() {
34371
34437
  var _getConfig9, integrationType;
34372
- return _regenerator().w(function (_context25) {
34373
- while (1) switch (_context25.n) {
34438
+ return _regenerator().w(function (_context27) {
34439
+ while (1) switch (_context27.n) {
34374
34440
  case 0:
34375
34441
  _getConfig9 = getConfig(), integrationType = _getConfig9.integrationType;
34376
34442
  if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
34377
- _context25.n = 1;
34443
+ _context27.n = 1;
34378
34444
  break;
34379
34445
  }
34380
- return _context25.a(2, deleteSignatureVariantOnBoarding());
34446
+ return _context27.a(2, deleteSignatureVariantOnBoarding());
34381
34447
  case 1:
34382
34448
  if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
34383
- _context25.n = 2;
34449
+ _context27.n = 2;
34384
34450
  break;
34385
34451
  }
34386
- return _context25.a(2, deleteSignatureVariantOnPremise());
34452
+ return _context27.a(2, deleteSignatureVariantOnPremise());
34387
34453
  case 2:
34388
34454
  throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
34389
34455
  case 3:
34390
- return _context25.a(2);
34456
+ return _context27.a(2);
34391
34457
  }
34392
- }, _callee25);
34458
+ }, _callee27);
34393
34459
  }));
34394
34460
  return function deleteSignatureVariant() {
34395
- return _ref26.apply(this, arguments);
34461
+ return _ref29.apply(this, arguments);
34396
34462
  };
34397
34463
  }();
34398
34464
 
@@ -34403,32 +34469,32 @@ var deleteSignatureVariant = /*#__PURE__*/function () {
34403
34469
  * @throws {ApacuanaAPIError} Si los datos del signatario son inválidos, la llamada a la API falla, o el tipo de integración no es soportado.
34404
34470
  */
34405
34471
  var addMember = /*#__PURE__*/function () {
34406
- var _ref27 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee26(memberData) {
34472
+ var _ref30 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee28(memberData) {
34407
34473
  var _getConfig0, integrationType;
34408
- return _regenerator().w(function (_context26) {
34409
- while (1) switch (_context26.n) {
34474
+ return _regenerator().w(function (_context28) {
34475
+ while (1) switch (_context28.n) {
34410
34476
  case 0:
34411
34477
  _getConfig0 = getConfig(), integrationType = _getConfig0.integrationType;
34412
34478
  if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
34413
- _context26.n = 1;
34479
+ _context28.n = 1;
34414
34480
  break;
34415
34481
  }
34416
- return _context26.a(2, addMemberOnBoarding(memberData));
34482
+ return _context28.a(2, addMemberOnBoarding(memberData));
34417
34483
  case 1:
34418
34484
  if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
34419
- _context26.n = 2;
34485
+ _context28.n = 2;
34420
34486
  break;
34421
34487
  }
34422
- return _context26.a(2, addMemberOnPremise());
34488
+ return _context28.a(2, addMemberOnPremise());
34423
34489
  case 2:
34424
34490
  throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
34425
34491
  case 3:
34426
- return _context26.a(2);
34492
+ return _context28.a(2);
34427
34493
  }
34428
- }, _callee26);
34494
+ }, _callee28);
34429
34495
  }));
34430
- return function addMember(_x12) {
34431
- return _ref27.apply(this, arguments);
34496
+ return function addMember(_x13) {
34497
+ return _ref30.apply(this, arguments);
34432
34498
  };
34433
34499
  }();
34434
34500
 
@@ -34441,44 +34507,44 @@ var addMember = /*#__PURE__*/function () {
34441
34507
  * @throws {ApacuanaAPIError} Si los datos son inválidos, la llamada a la API falla, o el tipo de integración no es soportado.
34442
34508
  */
34443
34509
  var createDocument = /*#__PURE__*/function () {
34444
- var _ref28 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee27(documentData) {
34510
+ var _ref31 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee29(documentData) {
34445
34511
  var _getConfig1, integrationType;
34446
- return _regenerator().w(function (_context27) {
34447
- while (1) switch (_context27.n) {
34512
+ return _regenerator().w(function (_context29) {
34513
+ while (1) switch (_context29.n) {
34448
34514
  case 0:
34449
34515
  if (!(!documentData || _typeof(documentData) !== "object" || Object.keys(documentData).length === 0)) {
34450
- _context27.n = 1;
34516
+ _context29.n = 1;
34451
34517
  break;
34452
34518
  }
34453
34519
  throw new ApacuanaAPIError("Document data (documentData) is required and must be a non-empty object.", 400, "INVALID_PARAMETER");
34454
34520
  case 1:
34455
34521
  if (!(!documentData.name || !documentData.reference)) {
34456
- _context27.n = 2;
34522
+ _context29.n = 2;
34457
34523
  break;
34458
34524
  }
34459
34525
  throw new ApacuanaAPIError("Fields 'name' and 'reference' are required.", 400, "INVALID_PARAMETER");
34460
34526
  case 2:
34461
34527
  _getConfig1 = getConfig(), integrationType = _getConfig1.integrationType;
34462
34528
  if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
34463
- _context27.n = 3;
34529
+ _context29.n = 3;
34464
34530
  break;
34465
34531
  }
34466
- return _context27.a(2, createDocumentOnBoarding(documentData));
34532
+ return _context29.a(2, createDocumentOnBoarding(documentData));
34467
34533
  case 3:
34468
34534
  if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
34469
- _context27.n = 4;
34535
+ _context29.n = 4;
34470
34536
  break;
34471
34537
  }
34472
- return _context27.a(2, createDocumentOnPremise());
34538
+ return _context29.a(2, createDocumentOnPremise());
34473
34539
  case 4:
34474
34540
  throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
34475
34541
  case 5:
34476
- return _context27.a(2);
34542
+ return _context29.a(2);
34477
34543
  }
34478
- }, _callee27);
34544
+ }, _callee29);
34479
34545
  }));
34480
- return function createDocument(_x13) {
34481
- return _ref28.apply(this, arguments);
34546
+ return function createDocument(_x14) {
34547
+ return _ref31.apply(this, arguments);
34482
34548
  };
34483
34549
  }();
34484
34550
 
@@ -34489,38 +34555,94 @@ var createDocument = /*#__PURE__*/function () {
34489
34555
  * @throws {ApacuanaAPIError} Si el documentId es inválido, la llamada a la API falla, o el tipo de integración no es soportado.
34490
34556
  */
34491
34557
  var lockDocument = /*#__PURE__*/function () {
34492
- var _ref29 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee28(documentId) {
34558
+ var _ref32 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee30(documentId) {
34493
34559
  var _getConfig10, integrationType;
34494
- return _regenerator().w(function (_context28) {
34495
- while (1) switch (_context28.n) {
34560
+ return _regenerator().w(function (_context30) {
34561
+ while (1) switch (_context30.n) {
34496
34562
  case 0:
34497
34563
  if (!(!documentId || typeof documentId !== "string")) {
34498
- _context28.n = 1;
34564
+ _context30.n = 1;
34499
34565
  break;
34500
34566
  }
34501
34567
  throw new ApacuanaAPIError("Field 'documentId' is required and must be a string.", 400, "INVALID_PARAMETER");
34502
34568
  case 1:
34503
34569
  _getConfig10 = getConfig(), integrationType = _getConfig10.integrationType;
34504
34570
  if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
34505
- _context28.n = 2;
34571
+ _context30.n = 2;
34506
34572
  break;
34507
34573
  }
34508
- return _context28.a(2, lockDocumentOnBoarding(documentId));
34574
+ return _context30.a(2, lockDocumentOnBoarding(documentId));
34509
34575
  case 2:
34510
34576
  if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
34511
- _context28.n = 3;
34577
+ _context30.n = 3;
34512
34578
  break;
34513
34579
  }
34514
- return _context28.a(2, lockDocumentOnPremise());
34580
+ return _context30.a(2, lockDocumentOnPremise());
34515
34581
  case 3:
34516
34582
  throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
34517
34583
  case 4:
34518
- return _context28.a(2);
34584
+ return _context30.a(2);
34519
34585
  }
34520
- }, _callee28);
34586
+ }, _callee30);
34521
34587
  }));
34522
- return function lockDocument(_x14) {
34523
- return _ref29.apply(this, arguments);
34588
+ return function lockDocument(_x15) {
34589
+ return _ref32.apply(this, arguments);
34590
+ };
34591
+ }();
34592
+
34593
+ /**
34594
+ * Elimina la firma de un firmante de un documento.
34595
+ * @param {DeleteSignatureData} data - IDs del documento y de la firma.
34596
+ * @param {string} data.documentId - ID (UUID) del documento.
34597
+ * @param {string} data.signatureId - ID (UUID) de la firma a eliminar.
34598
+ * @returns {Promise<object>} Una promesa que resuelve al response de la API.
34599
+ * @throws {ApacuanaAPIError} Si los IDs son inválidos, la llamada a la API falla, o el tipo de integración no es soportado.
34600
+ */
34601
+ var deleteSignature = /*#__PURE__*/function () {
34602
+ var _ref33 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee31(data) {
34603
+ var _getConfig11, integrationType;
34604
+ return _regenerator().w(function (_context31) {
34605
+ while (1) switch (_context31.n) {
34606
+ case 0:
34607
+ if (!(!data || _typeof(data) !== "object" || Object.keys(data).length === 0)) {
34608
+ _context31.n = 1;
34609
+ break;
34610
+ }
34611
+ throw new ApacuanaAPIError("Fields 'documentId' and 'signatureId' are required.", 400, "INVALID_PARAMETER");
34612
+ case 1:
34613
+ if (!(!data.documentId || typeof data.documentId !== "string")) {
34614
+ _context31.n = 2;
34615
+ break;
34616
+ }
34617
+ throw new ApacuanaAPIError("Field 'documentId' is required and must be a string.", 400, "INVALID_PARAMETER");
34618
+ case 2:
34619
+ if (!(!data.signatureId || typeof data.signatureId !== "string")) {
34620
+ _context31.n = 3;
34621
+ break;
34622
+ }
34623
+ throw new ApacuanaAPIError("Field 'signatureId' is required and must be a string.", 400, "INVALID_PARAMETER");
34624
+ case 3:
34625
+ _getConfig11 = getConfig(), integrationType = _getConfig11.integrationType;
34626
+ if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
34627
+ _context31.n = 4;
34628
+ break;
34629
+ }
34630
+ return _context31.a(2, deleteSignatureOnBoarding(data));
34631
+ case 4:
34632
+ if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
34633
+ _context31.n = 5;
34634
+ break;
34635
+ }
34636
+ return _context31.a(2, deleteSignatureOnPremise());
34637
+ case 5:
34638
+ throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
34639
+ case 6:
34640
+ return _context31.a(2);
34641
+ }
34642
+ }, _callee31);
34643
+ }));
34644
+ return function deleteSignature(_x16) {
34645
+ return _ref33.apply(this, arguments);
34524
34646
  };
34525
34647
  }();
34526
34648
 
@@ -34730,6 +34852,10 @@ var apacuana = {
34730
34852
  checkSdk(true);
34731
34853
  return addMember(data);
34732
34854
  },
34855
+ deleteSignature: function deleteSignature$1(data) {
34856
+ checkSdk(false);
34857
+ return deleteSignature(data);
34858
+ },
34733
34859
  deleteSignatureVariant: function deleteSignatureVariant$1() {
34734
34860
  checkSdk(true);
34735
34861
  return deleteSignatureVariant();