gbc-kyc-kit 1.0.8 → 1.1.1

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 CHANGED
@@ -121,6 +121,7 @@ If you use this components with TypeScript, you should create a customType.d.ts
121
121
  | mode | string | dark, light | Isn't required, the default value is "light". |
122
122
  | clientId | string | Global Bridge Connections send you for email | This value is unique for each client and will be sent for email. |
123
123
  | authorize | promise | () => Promise() | This Function verify clientId vs TOKEN and return accessToken. |
124
+ | dual | boolean | false | Isn't required and the default value is false. Just would used to enable dual upload of ID Document in Document Reader component (Two sides) |
124
125
 
125
126
  ## Document Reader Component
126
127
 
@@ -20283,28 +20283,37 @@ BlackList.propTypes = {
20283
20283
  };
20284
20284
  const DocumentReaderController = (dataDocument, clientId, authorize, inProduction) => {
20285
20285
  const [docImage, setDocImage] = useState({});
20286
- const [image, setImage] = useState("");
20286
+ const [base64, setBase64] = useState({});
20287
20287
  const [message, setMessage] = useState("");
20288
20288
  const [isLoading, setIsLoading] = useState(false);
20289
20289
  const [status, setStatus] = useState(clientId === void 0 ? "CLIENTID" : authorize === void 0 ? "TOKEN" : "");
20290
20290
  const clearState = () => {
20291
20291
  setDocImage({});
20292
- setImage("");
20292
+ setBase64({});
20293
20293
  setStatus("");
20294
20294
  };
20295
20295
  const {
20296
20296
  handleSubmit: simpleHandleSubmit
20297
20297
  } = useForm();
20298
- const handleChangeDocument = (e2) => {
20298
+ const handleChangeDocument = (e2, side) => {
20299
20299
  const file = e2.target.files[0];
20300
+ const {
20301
+ id
20302
+ } = e2.target;
20300
20303
  const reader = new FileReader();
20301
20304
  reader.addEventListener("load", () => {
20302
20305
  const {
20303
20306
  result
20304
20307
  } = reader;
20305
20308
  if (result != null) {
20306
- setImage(result);
20307
- setDocImage(file.name);
20309
+ setBase64({
20310
+ ...base64,
20311
+ [id]: result
20312
+ });
20313
+ setDocImage({
20314
+ ...docImage,
20315
+ [id]: file.name
20316
+ });
20308
20317
  }
20309
20318
  });
20310
20319
  reader.readAsDataURL(file);
@@ -20323,9 +20332,7 @@ const DocumentReaderController = (dataDocument, clientId, authorize, inProductio
20323
20332
  path: "api/v1/kyc-kit/document/recognition",
20324
20333
  inProduction,
20325
20334
  customHeaders,
20326
- bodyParams: {
20327
- image
20328
- }
20335
+ bodyParams: base64
20329
20336
  };
20330
20337
  try {
20331
20338
  const res2 = await request2(parseReq);
@@ -20383,7 +20390,8 @@ function DocumentReader({
20383
20390
  dataDocument,
20384
20391
  clientId,
20385
20392
  authorize,
20386
- inProduction
20393
+ inProduction,
20394
+ dual
20387
20395
  }) {
20388
20396
  const {
20389
20397
  onSendSubmitDocument,
@@ -20422,18 +20430,38 @@ function DocumentReader({
20422
20430
  children: "Utilice la c\xE1mara de su dispositivo para capturar una foto de su documento de identidad."
20423
20431
  }), /* @__PURE__ */ jsxs("label", {
20424
20432
  className: "upload-document",
20425
- children: [/* @__PURE__ */ jsx(UploadIcon, {}), /* @__PURE__ */ jsx("p", {
20426
- children: lib$1(docImage) ? "Cargar documento" : docImage
20433
+ children: [/* @__PURE__ */ jsx(UploadIcon, {}), docImage.firstImage ? /* @__PURE__ */ jsx("p", {
20434
+ children: docImage.firstImage
20435
+ }) : /* @__PURE__ */ jsx("p", {
20436
+ children: "Carga Frontal"
20427
20437
  }), /* @__PURE__ */ jsx("input", {
20428
20438
  type: "file",
20429
20439
  hidden: true,
20430
20440
  accept: "image/*",
20431
20441
  capture: "camera",
20432
- id: "docImage",
20442
+ id: "firstImage",
20433
20443
  onChange: (e2) => {
20434
20444
  handleChangeDocument(e2);
20435
20445
  }
20436
20446
  })]
20447
+ }), dual && /* @__PURE__ */ jsxs(Fragment, {
20448
+ children: [/* @__PURE__ */ jsx("hr", {}), /* @__PURE__ */ jsxs("label", {
20449
+ className: "upload-document",
20450
+ children: [/* @__PURE__ */ jsx(UploadIcon, {}), docImage.secondImage ? /* @__PURE__ */ jsx("p", {
20451
+ children: docImage.secondImage
20452
+ }) : /* @__PURE__ */ jsx("p", {
20453
+ children: "Cargar del Reverso"
20454
+ }), /* @__PURE__ */ jsx("input", {
20455
+ type: "file",
20456
+ hidden: true,
20457
+ accept: "image/*",
20458
+ capture: "camera",
20459
+ id: "secondImage",
20460
+ onChange: (e2) => {
20461
+ handleChangeDocument(e2);
20462
+ }
20463
+ })]
20464
+ })]
20437
20465
  }), /* @__PURE__ */ jsx(CustomButton, {
20438
20466
  type: "submit",
20439
20467
  children: "Procesar"
@@ -20446,7 +20474,8 @@ function DocumentReader({
20446
20474
  DocumentReader.defaultProps = {
20447
20475
  mode: "light",
20448
20476
  loader: false,
20449
- inProduction: "prd"
20477
+ inProduction: "prd",
20478
+ dual: false
20450
20479
  };
20451
20480
  DocumentReader.propTypes = {
20452
20481
  mode: propTypes.exports.PropTypes.string,
@@ -20455,7 +20484,8 @@ DocumentReader.propTypes = {
20455
20484
  clientId: propTypes.exports.PropTypes.string.isRequired,
20456
20485
  authorize: propTypes.exports.PropTypes.func.isRequired,
20457
20486
  dataDocument: propTypes.exports.PropTypes.func.isRequired,
20458
- inProduction: propTypes.exports.PropTypes.string
20487
+ inProduction: propTypes.exports.PropTypes.string,
20488
+ dual: propTypes.exports.PropTypes.bool
20459
20489
  };
20460
20490
  const LivenessCheckController = (clientId, authorize, inProduction) => {
20461
20491
  const [isLoading, setIsLoading] = useState(false);