apacuana-sdk-core 1.3.0 → 1.6.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/dist/index.mjs CHANGED
@@ -33048,6 +33048,141 @@ var helpers = {
33048
33048
  createPayloadGetDigest: createPayloadGetDigest
33049
33049
  };
33050
33050
 
33051
+ /**
33052
+ * @typedef {object} GetCustomerData
33053
+ * @property {string} token - El token de sesión del usuario.
33054
+ * @property {object} userData - Los datos del usuario obtenidos.
33055
+ */
33056
+
33057
+ /**
33058
+ * @typedef {object} GetCustomerResponse
33059
+ * @property {true} success - Indica que la operación fue exitosa.
33060
+ * @property {GetCustomerData} data - El payload de la respuesta.
33061
+ */
33062
+
33063
+ /**
33064
+ * Obtiene el token de un usuario a través de una petición POST.
33065
+ * Este método es útil para endpoints que requieren datos en el cuerpo de la petición
33066
+ * para buscar un usuario, como un ID de sesión o un token de acceso.
33067
+ *
33068
+ * @returns {Promise<GetCustomerResponse>} Una promesa que resuelve a un objeto con la respuesta exitosa.
33069
+ * @throws {Error} Si los parámetros de entrada son inválidos.
33070
+ * @throws {ApacuanaAPIError} Si ocurre un error en la API de Apacuana.
33071
+ */
33072
+ var getCustomer = /*#__PURE__*/function () {
33073
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
33074
+ var _getConfig, verificationId, customerId, body, response, _t;
33075
+ return _regenerator().w(function (_context) {
33076
+ while (1) switch (_context.p = _context.n) {
33077
+ case 0:
33078
+ _getConfig = getConfig(), verificationId = _getConfig.verificationId, customerId = _getConfig.customerId;
33079
+ if (!(!verificationId || !customerId)) {
33080
+ _context.n = 1;
33081
+ break;
33082
+ }
33083
+ throw new ApacuanaAPIError("Both 'verificationId' and 'customerId' must be configured.", 400, "CONFIGURATION_ERROR");
33084
+ case 1:
33085
+ body = {
33086
+ verificationid: verificationId,
33087
+ customerid: customerId
33088
+ };
33089
+ _context.p = 2;
33090
+ _context.n = 3;
33091
+ return httpRequest("services/api/register/init", body, "POST");
33092
+ case 3:
33093
+ response = _context.v;
33094
+ if (!(!response.sessionid || !response.entry)) {
33095
+ _context.n = 4;
33096
+ break;
33097
+ }
33098
+ throw new ApacuanaAPIError("The API response does not contain the user.", 200, "INVALID_API_RESPONSE");
33099
+ case 4:
33100
+ return _context.a(2, new ApacuanaSuccess({
33101
+ token: response.sessionid,
33102
+ userData: response.entry
33103
+ }));
33104
+ case 5:
33105
+ _context.p = 5;
33106
+ _t = _context.v;
33107
+ if (!(_t instanceof ApacuanaAPIError)) {
33108
+ _context.n = 6;
33109
+ break;
33110
+ }
33111
+ throw _t;
33112
+ case 6:
33113
+ throw new ApacuanaAPIError("Unexpected failure getting token: ".concat(_t.message || "Unknown error"));
33114
+ case 7:
33115
+ return _context.a(2);
33116
+ }
33117
+ }, _callee, null, [[2, 5]]);
33118
+ }));
33119
+ return function getCustomer() {
33120
+ return _ref.apply(this, arguments);
33121
+ };
33122
+ }();
33123
+
33124
+ /**
33125
+ * @typedef {object} CreateUserPayload
33126
+ * @property {string} usr - Correo electrónico del usuario.
33127
+ * @property {string} pwd - Contraseña del usuario.
33128
+ * @property {string} kinddoc - Tipo de documento de identidad (ej. 'V', 'P', 'E').
33129
+ * @property {string} doc - Número de documento de identidad.
33130
+ */
33131
+
33132
+ /**
33133
+ * @typedef {object} CreateUserResponse
33134
+ * @property {string} message - Mensaje de confirmación de la creación del usuario.
33135
+ */
33136
+
33137
+ /**
33138
+ * Crea un nuevo usuario en la plataforma de Apacuana.
33139
+ * @param {CreateUserPayload} userData - Objeto con los datos del usuario a crear.
33140
+ * @returns {Promise<ApacuanaSuccess>} Una promesa que resuelve a un objeto con la respuesta exitosa.
33141
+ * @throws {ApacuanaAPIError} Si los datos de entrada son inválidos o si ocurre un error en la API.
33142
+ */
33143
+
33144
+ var createApacuanaUser = /*#__PURE__*/function () {
33145
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(userData) {
33146
+ var formData, response, _t2;
33147
+ return _regenerator().w(function (_context2) {
33148
+ while (1) switch (_context2.p = _context2.n) {
33149
+ case 0:
33150
+ _context2.p = 0;
33151
+ formData = new FormData();
33152
+ Object.keys(userData).forEach(function (key) {
33153
+ var value = userData[key];
33154
+ var isRNFile = value && _typeof(value) === "object" && value.uri && value.name && value.type;
33155
+ if (value instanceof File || isRNFile) {
33156
+ formData.append(key, value);
33157
+ } else if (value !== null && value !== undefined) {
33158
+ formData.append(key, String(value));
33159
+ }
33160
+ });
33161
+ _context2.n = 1;
33162
+ return httpRequest("services/api/register/initial", formData, "POST");
33163
+ case 1:
33164
+ response = _context2.v;
33165
+ return _context2.a(2, new ApacuanaSuccess(_objectSpread2({}, response)));
33166
+ case 2:
33167
+ _context2.p = 2;
33168
+ _t2 = _context2.v;
33169
+ if (!(_t2 instanceof ApacuanaAPIError)) {
33170
+ _context2.n = 3;
33171
+ break;
33172
+ }
33173
+ throw _t2;
33174
+ case 3:
33175
+ throw new ApacuanaAPIError("Unexpected failure creating user: ".concat(_t2.message || "Unknown error"));
33176
+ case 4:
33177
+ return _context2.a(2);
33178
+ }
33179
+ }, _callee2, null, [[0, 2]]);
33180
+ }));
33181
+ return function createApacuanaUser(_x) {
33182
+ return _ref2.apply(this, arguments);
33183
+ };
33184
+ }();
33185
+
33051
33186
  /**
33052
33187
  * @param {EncryptedCSRObject} encryptedCSR
33053
33188
  */
@@ -33151,60 +33286,81 @@ var generateCert = /*#__PURE__*/function () {
33151
33286
  * @param {boolean} [isCertificateInDevice=false] - Indicates if the certificate is already on the device.
33152
33287
  * @returns {GetCertStatusResponse} Object with the certificate status and a success indicator.
33153
33288
  */
33154
- var getCertStatus = function getCertStatus() {
33155
- var isCertificateInDevice = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
33156
- var config = getConfig();
33157
- var status = helpers.getCertificateStatus(config.userData, isCertificateInDevice, config.integrationType);
33158
- console.log(status, "Core sdk");
33159
- var parseStatus = PARSE_STATUS[status];
33160
- return new ApacuanaSuccess({
33161
- status: parseStatus
33162
- });
33163
- };
33164
- var getCertTypesOnBoarding = /*#__PURE__*/function () {
33289
+ var getCertStatus = /*#__PURE__*/function () {
33165
33290
  var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
33166
- var response, _t2;
33291
+ var isCertificateInDevice,
33292
+ config,
33293
+ customer,
33294
+ userData,
33295
+ status,
33296
+ parseStatus,
33297
+ _args4 = arguments;
33167
33298
  return _regenerator().w(function (_context4) {
33168
- while (1) switch (_context4.p = _context4.n) {
33299
+ while (1) switch (_context4.n) {
33169
33300
  case 0:
33170
- _context4.p = 0;
33301
+ isCertificateInDevice = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : false;
33302
+ config = getConfig();
33171
33303
  _context4.n = 1;
33304
+ return getCustomer();
33305
+ case 1:
33306
+ customer = _context4.v;
33307
+ userData = customer.data.userData;
33308
+ status = helpers.getCertificateStatus(userData, isCertificateInDevice, config.integrationType);
33309
+ parseStatus = PARSE_STATUS[status];
33310
+ return _context4.a(2, new ApacuanaSuccess({
33311
+ status: parseStatus
33312
+ }));
33313
+ }
33314
+ }, _callee4);
33315
+ }));
33316
+ return function getCertStatus() {
33317
+ return _ref4.apply(this, arguments);
33318
+ };
33319
+ }();
33320
+ var getCertTypesOnBoarding = /*#__PURE__*/function () {
33321
+ var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
33322
+ var response, _t2;
33323
+ return _regenerator().w(function (_context5) {
33324
+ while (1) switch (_context5.p = _context5.n) {
33325
+ case 0:
33326
+ _context5.p = 0;
33327
+ _context5.n = 1;
33172
33328
  return httpRequest("services/api/customer/typeusers", {}, "GET");
33173
33329
  case 1:
33174
- response = _context4.v;
33175
- return _context4.a(2, new ApacuanaSuccess(response));
33330
+ response = _context5.v;
33331
+ return _context5.a(2, new ApacuanaSuccess(response));
33176
33332
  case 2:
33177
- _context4.p = 2;
33178
- _t2 = _context4.v;
33333
+ _context5.p = 2;
33334
+ _t2 = _context5.v;
33179
33335
  if (!(_t2 instanceof ApacuanaAPIError)) {
33180
- _context4.n = 3;
33336
+ _context5.n = 3;
33181
33337
  break;
33182
33338
  }
33183
33339
  throw _t2;
33184
33340
  case 3:
33185
33341
  throw new Error("Failed to get certificate types: ".concat(_t2.message));
33186
33342
  case 4:
33187
- return _context4.a(2);
33343
+ return _context5.a(2);
33188
33344
  }
33189
- }, _callee4, null, [[0, 2]]);
33345
+ }, _callee5, null, [[0, 2]]);
33190
33346
  }));
33191
33347
  return function getCertTypesOnBoarding() {
33192
- return _ref4.apply(this, arguments);
33348
+ return _ref5.apply(this, arguments);
33193
33349
  };
33194
33350
  }();
33195
33351
  var getCertTypesOnPremise = /*#__PURE__*/function () {
33196
- var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
33197
- return _regenerator().w(function (_context5) {
33198
- while (1) switch (_context5.n) {
33352
+ var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
33353
+ return _regenerator().w(function (_context6) {
33354
+ while (1) switch (_context6.n) {
33199
33355
  case 0:
33200
33356
  throw new ApacuanaAPIError("Getting certificate types is not supported for integration type: ONPREMISE", 501, "NOT_IMPLEMENTED");
33201
33357
  case 1:
33202
- return _context5.a(2);
33358
+ return _context6.a(2);
33203
33359
  }
33204
- }, _callee5);
33360
+ }, _callee6);
33205
33361
  }));
33206
33362
  return function getCertTypesOnPremise() {
33207
- return _ref5.apply(this, arguments);
33363
+ return _ref6.apply(this, arguments);
33208
33364
  };
33209
33365
  }();
33210
33366
 
@@ -33215,78 +33371,78 @@ var getCertTypesOnPremise = /*#__PURE__*/function () {
33215
33371
  * @throws {Error} If the request fails for another reason.
33216
33372
  */
33217
33373
  var getCertTypes = /*#__PURE__*/function () {
33218
- var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
33374
+ var _ref7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7() {
33219
33375
  var _getConfig2, integrationType;
33220
- return _regenerator().w(function (_context6) {
33221
- while (1) switch (_context6.n) {
33376
+ return _regenerator().w(function (_context7) {
33377
+ while (1) switch (_context7.n) {
33222
33378
  case 0:
33223
33379
  _getConfig2 = getConfig(), integrationType = _getConfig2.integrationType;
33224
33380
  if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
33225
- _context6.n = 1;
33381
+ _context7.n = 1;
33226
33382
  break;
33227
33383
  }
33228
- return _context6.a(2, getCertTypesOnBoarding());
33384
+ return _context7.a(2, getCertTypesOnBoarding());
33229
33385
  case 1:
33230
33386
  if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
33231
- _context6.n = 2;
33387
+ _context7.n = 2;
33232
33388
  break;
33233
33389
  }
33234
- return _context6.a(2, getCertTypesOnPremise());
33390
+ return _context7.a(2, getCertTypesOnPremise());
33235
33391
  case 2:
33236
33392
  throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
33237
33393
  case 3:
33238
- return _context6.a(2);
33394
+ return _context7.a(2);
33239
33395
  }
33240
- }, _callee6);
33396
+ }, _callee7);
33241
33397
  }));
33242
33398
  return function getCertTypes() {
33243
- return _ref6.apply(this, arguments);
33399
+ return _ref7.apply(this, arguments);
33244
33400
  };
33245
33401
  }();
33246
33402
  var getRequerimentsByTypeUserOnBoarding = /*#__PURE__*/function () {
33247
- var _ref7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(type) {
33403
+ var _ref8 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(type) {
33248
33404
  var response, _t3;
33249
- return _regenerator().w(function (_context7) {
33250
- while (1) switch (_context7.p = _context7.n) {
33405
+ return _regenerator().w(function (_context8) {
33406
+ while (1) switch (_context8.p = _context8.n) {
33251
33407
  case 0:
33252
- _context7.p = 0;
33253
- _context7.n = 1;
33408
+ _context8.p = 0;
33409
+ _context8.n = 1;
33254
33410
  return httpRequest("services/api/customer/documentspref?typeuser=".concat(type), {}, "GET");
33255
33411
  case 1:
33256
- response = _context7.v;
33257
- return _context7.a(2, new ApacuanaSuccess(response));
33412
+ response = _context8.v;
33413
+ return _context8.a(2, new ApacuanaSuccess(response));
33258
33414
  case 2:
33259
- _context7.p = 2;
33260
- _t3 = _context7.v;
33415
+ _context8.p = 2;
33416
+ _t3 = _context8.v;
33261
33417
  if (!(_t3 instanceof ApacuanaAPIError)) {
33262
- _context7.n = 3;
33418
+ _context8.n = 3;
33263
33419
  break;
33264
33420
  }
33265
33421
  throw _t3;
33266
33422
  case 3:
33267
33423
  throw new Error("Failed to get requirements: ".concat(_t3.message));
33268
33424
  case 4:
33269
- return _context7.a(2);
33425
+ return _context8.a(2);
33270
33426
  }
33271
- }, _callee7, null, [[0, 2]]);
33427
+ }, _callee8, null, [[0, 2]]);
33272
33428
  }));
33273
33429
  return function getRequerimentsByTypeUserOnBoarding(_x3) {
33274
- return _ref7.apply(this, arguments);
33430
+ return _ref8.apply(this, arguments);
33275
33431
  };
33276
33432
  }();
33277
33433
  var getRequerimentsByTypeUserOnPremise = /*#__PURE__*/function () {
33278
- var _ref8 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
33279
- return _regenerator().w(function (_context8) {
33280
- while (1) switch (_context8.n) {
33434
+ var _ref9 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9() {
33435
+ return _regenerator().w(function (_context9) {
33436
+ while (1) switch (_context9.n) {
33281
33437
  case 0:
33282
33438
  throw new ApacuanaAPIError("Getting requirements by user type is not supported for integration type: ONPREMISE", 501, "NOT_IMPLEMENTED");
33283
33439
  case 1:
33284
- return _context8.a(2);
33440
+ return _context9.a(2);
33285
33441
  }
33286
- }, _callee8);
33442
+ }, _callee9);
33287
33443
  }));
33288
33444
  return function getRequerimentsByTypeUserOnPremise() {
33289
- return _ref8.apply(this, arguments);
33445
+ return _ref9.apply(this, arguments);
33290
33446
  };
33291
33447
  }();
33292
33448
 
@@ -33299,13 +33455,13 @@ var getRequerimentsByTypeUserOnPremise = /*#__PURE__*/function () {
33299
33455
  * @throws {Error} If the request fails for another reason or the type is invalid.
33300
33456
  */
33301
33457
  var getRequerimentsByTypeUser = /*#__PURE__*/function () {
33302
- var _ref9 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(params) {
33458
+ var _ref0 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(params) {
33303
33459
  var type, _getConfig3, integrationType;
33304
- return _regenerator().w(function (_context9) {
33305
- while (1) switch (_context9.n) {
33460
+ return _regenerator().w(function (_context0) {
33461
+ while (1) switch (_context0.n) {
33306
33462
  case 0:
33307
33463
  if (!(!params || typeof params.type !== "number")) {
33308
- _context9.n = 1;
33464
+ _context0.n = 1;
33309
33465
  break;
33310
33466
  }
33311
33467
  throw new Error('The "params" object with a numeric "type" property is required.');
@@ -33313,25 +33469,25 @@ var getRequerimentsByTypeUser = /*#__PURE__*/function () {
33313
33469
  type = params.type;
33314
33470
  _getConfig3 = getConfig(), integrationType = _getConfig3.integrationType;
33315
33471
  if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
33316
- _context9.n = 2;
33472
+ _context0.n = 2;
33317
33473
  break;
33318
33474
  }
33319
- return _context9.a(2, getRequerimentsByTypeUserOnBoarding(type));
33475
+ return _context0.a(2, getRequerimentsByTypeUserOnBoarding(type));
33320
33476
  case 2:
33321
33477
  if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
33322
- _context9.n = 3;
33478
+ _context0.n = 3;
33323
33479
  break;
33324
33480
  }
33325
- return _context9.a(2, getRequerimentsByTypeUserOnPremise());
33481
+ return _context0.a(2, getRequerimentsByTypeUserOnPremise());
33326
33482
  case 3:
33327
33483
  throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
33328
33484
  case 4:
33329
- return _context9.a(2);
33485
+ return _context0.a(2);
33330
33486
  }
33331
- }, _callee9);
33487
+ }, _callee0);
33332
33488
  }));
33333
33489
  return function getRequerimentsByTypeUser(_x4) {
33334
- return _ref9.apply(this, arguments);
33490
+ return _ref0.apply(this, arguments);
33335
33491
  };
33336
33492
  }();
33337
33493
 
@@ -34202,141 +34358,6 @@ var validateFaceLiveness = /*#__PURE__*/function () {
34202
34358
  };
34203
34359
  }();
34204
34360
 
34205
- /**
34206
- * @typedef {object} GetCustomerData
34207
- * @property {string} token - El token de sesión del usuario.
34208
- * @property {object} userData - Los datos del usuario obtenidos.
34209
- */
34210
-
34211
- /**
34212
- * @typedef {object} GetCustomerResponse
34213
- * @property {true} success - Indica que la operación fue exitosa.
34214
- * @property {GetCustomerData} data - El payload de la respuesta.
34215
- */
34216
-
34217
- /**
34218
- * Obtiene el token de un usuario a través de una petición POST.
34219
- * Este método es útil para endpoints que requieren datos en el cuerpo de la petición
34220
- * para buscar un usuario, como un ID de sesión o un token de acceso.
34221
- *
34222
- * @returns {Promise<GetCustomerResponse>} Una promesa que resuelve a un objeto con la respuesta exitosa.
34223
- * @throws {Error} Si los parámetros de entrada son inválidos.
34224
- * @throws {ApacuanaAPIError} Si ocurre un error en la API de Apacuana.
34225
- */
34226
- var getCustomer = /*#__PURE__*/function () {
34227
- var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
34228
- var _getConfig, verificationId, customerId, body, response, _t;
34229
- return _regenerator().w(function (_context) {
34230
- while (1) switch (_context.p = _context.n) {
34231
- case 0:
34232
- _getConfig = getConfig(), verificationId = _getConfig.verificationId, customerId = _getConfig.customerId;
34233
- if (!(!verificationId || !customerId)) {
34234
- _context.n = 1;
34235
- break;
34236
- }
34237
- throw new ApacuanaAPIError("Both 'verificationId' and 'customerId' must be configured.", 400, "CONFIGURATION_ERROR");
34238
- case 1:
34239
- body = {
34240
- verificationid: verificationId,
34241
- customerid: customerId
34242
- };
34243
- _context.p = 2;
34244
- _context.n = 3;
34245
- return httpRequest("services/api/register/init", body, "POST");
34246
- case 3:
34247
- response = _context.v;
34248
- if (!(!response.sessionid || !response.entry)) {
34249
- _context.n = 4;
34250
- break;
34251
- }
34252
- throw new ApacuanaAPIError("The API response does not contain the user.", 200, "INVALID_API_RESPONSE");
34253
- case 4:
34254
- return _context.a(2, new ApacuanaSuccess({
34255
- token: response.sessionid,
34256
- userData: response.entry
34257
- }));
34258
- case 5:
34259
- _context.p = 5;
34260
- _t = _context.v;
34261
- if (!(_t instanceof ApacuanaAPIError)) {
34262
- _context.n = 6;
34263
- break;
34264
- }
34265
- throw _t;
34266
- case 6:
34267
- throw new ApacuanaAPIError("Unexpected failure getting token: ".concat(_t.message || "Unknown error"));
34268
- case 7:
34269
- return _context.a(2);
34270
- }
34271
- }, _callee, null, [[2, 5]]);
34272
- }));
34273
- return function getCustomer() {
34274
- return _ref.apply(this, arguments);
34275
- };
34276
- }();
34277
-
34278
- /**
34279
- * @typedef {object} CreateUserPayload
34280
- * @property {string} usr - Correo electrónico del usuario.
34281
- * @property {string} pwd - Contraseña del usuario.
34282
- * @property {string} kinddoc - Tipo de documento de identidad (ej. 'V', 'P', 'E').
34283
- * @property {string} doc - Número de documento de identidad.
34284
- */
34285
-
34286
- /**
34287
- * @typedef {object} CreateUserResponse
34288
- * @property {string} message - Mensaje de confirmación de la creación del usuario.
34289
- */
34290
-
34291
- /**
34292
- * Crea un nuevo usuario en la plataforma de Apacuana.
34293
- * @param {CreateUserPayload} userData - Objeto con los datos del usuario a crear.
34294
- * @returns {Promise<ApacuanaSuccess>} Una promesa que resuelve a un objeto con la respuesta exitosa.
34295
- * @throws {ApacuanaAPIError} Si los datos de entrada son inválidos o si ocurre un error en la API.
34296
- */
34297
-
34298
- var createApacuanaUser = /*#__PURE__*/function () {
34299
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(userData) {
34300
- var formData, response, _t2;
34301
- return _regenerator().w(function (_context2) {
34302
- while (1) switch (_context2.p = _context2.n) {
34303
- case 0:
34304
- _context2.p = 0;
34305
- formData = new FormData();
34306
- Object.keys(userData).forEach(function (key) {
34307
- var value = userData[key];
34308
- var isRNFile = value && _typeof(value) === "object" && value.uri && value.name && value.type;
34309
- if (value instanceof File || isRNFile) {
34310
- formData.append(key, value);
34311
- } else if (value !== null && value !== undefined) {
34312
- formData.append(key, String(value));
34313
- }
34314
- });
34315
- _context2.n = 1;
34316
- return httpRequest("services/api/register/initial", formData, "POST");
34317
- case 1:
34318
- response = _context2.v;
34319
- return _context2.a(2, new ApacuanaSuccess(_objectSpread2({}, response)));
34320
- case 2:
34321
- _context2.p = 2;
34322
- _t2 = _context2.v;
34323
- if (!(_t2 instanceof ApacuanaAPIError)) {
34324
- _context2.n = 3;
34325
- break;
34326
- }
34327
- throw _t2;
34328
- case 3:
34329
- throw new ApacuanaAPIError("Unexpected failure creating user: ".concat(_t2.message || "Unknown error"));
34330
- case 4:
34331
- return _context2.a(2);
34332
- }
34333
- }, _callee2, null, [[0, 2]]);
34334
- }));
34335
- return function createApacuanaUser(_x) {
34336
- return _ref2.apply(this, arguments);
34337
- };
34338
- }();
34339
-
34340
34361
  /**
34341
34362
  * Valida si el SDK está inicializado y si se dispone de un customerId.
34342
34363
  * @param {boolean} requiresCustomerId - Indica si la operación necesita un customerId.