gbc-kyc-kit 2.3.7 → 2.3.8

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.
@@ -32835,7 +32835,6 @@ function getDividerUtilityClass(slot) {
32835
32835
  return generateUtilityClass("MuiDivider", slot);
32836
32836
  }
32837
32837
  const dividerClasses = generateUtilityClasses("MuiDivider", ["root", "absolute", "fullWidth", "inset", "middle", "flexItem", "light", "vertical", "withChildren", "withChildrenVertical", "textAlignRight", "textAlignLeft", "wrapper", "wrapperVertical"]);
32838
- var dividerClasses$1 = dividerClasses;
32839
32838
  const _excluded$1m = ["absolute", "children", "className", "component", "flexItem", "light", "orientation", "role", "textAlign", "variant"];
32840
32839
  const useUtilityClasses$13 = (ownerState) => {
32841
32840
  const {
@@ -35469,11 +35468,11 @@ const MenuItemRoot = styled$1(ButtonBase$1, {
35469
35468
  [`&.${menuItemClasses$1.disabled}`]: {
35470
35469
  opacity: (theme.vars || theme).palette.action.disabledOpacity
35471
35470
  },
35472
- [`& + .${dividerClasses$1.root}`]: {
35471
+ [`& + .${dividerClasses.root}`]: {
35473
35472
  marginTop: theme.spacing(1),
35474
35473
  marginBottom: theme.spacing(1)
35475
35474
  },
35476
- [`& + .${dividerClasses$1.inset}`]: {
35475
+ [`& + .${dividerClasses.inset}`]: {
35477
35476
  marginLeft: 52
35478
35477
  },
35479
35478
  [`& .${listItemTextClasses$1.root}`]: {
@@ -39314,6 +39313,8 @@ const DocumentReaderController = (dataDocument, clientId, authorize, eventId, so
39314
39313
  ...error,
39315
39314
  countAttempts: data2.count_try
39316
39315
  });
39316
+ if (error.response.data.code.include("020"))
39317
+ setUploadDocumentByPhone(true);
39317
39318
  if ((_a = error.response.data) == null ? void 0 : _a.message) {
39318
39319
  message2 = error.response.data.message;
39319
39320
  } else if (status2 === 500) {
@@ -39366,10 +39367,10 @@ const DocumentReaderController = (dataDocument, clientId, authorize, eventId, so
39366
39367
  const isPortrait = usePortrait();
39367
39368
  const videoConstraints = useMemo(() => ({
39368
39369
  width: {
39369
- ideal: isPortrait ? 400 : 640
39370
+ ideal: isPortrait ? 1080 : 1920
39370
39371
  },
39371
39372
  height: {
39372
- ideal: isPortrait ? 640 : 400
39373
+ ideal: isPortrait ? 1920 : 1080
39373
39374
  },
39374
39375
  aspectRatio: {
39375
39376
  ideal: 4 / 5
@@ -39414,106 +39415,40 @@ const DocumentReaderController = (dataDocument, clientId, authorize, eventId, so
39414
39415
  const validateErrorMessageOCR = (message) => {
39415
39416
  return message === "Tipo de documento no v\xE1lido" || message === "Datos de la imagen no reconocidas" || message === "Dato no reconocido(Primer Nombre)" || message == "Dato no reconocido(Primer Apellido)" || message == "";
39416
39417
  };
39417
- const DocumentGuide = ({
39418
- documentType = "id"
39418
+ const InstructionsComponent = ({
39419
+ title,
39420
+ subtitle
39419
39421
  }) => {
39420
- const getGuideDimensions = () => {
39421
- switch (documentType) {
39422
- case "passport":
39423
- return {
39424
- width: "85%",
39425
- height: "60%",
39426
- aspectRatio: "1.4"
39427
- };
39428
- case "driverLicense":
39429
- return {
39430
- width: "85%",
39431
- height: "55%",
39432
- aspectRatio: "1.6"
39433
- };
39434
- case "id":
39435
- default:
39436
- return {
39437
- width: "77%",
39438
- height: "90%",
39439
- aspectRatio: "1.6"
39440
- };
39441
- }
39442
- };
39443
- const dimensions = getGuideDimensions();
39444
39422
  return /* @__PURE__ */ jsxs(Box$1, {
39445
- sx: {
39446
- position: "absolute",
39447
- top: "50%",
39448
- left: "50%",
39449
- transform: "translate(-50%, -50%)",
39450
- width: dimensions.width,
39451
- height: dimensions.height,
39452
- border: "2px dashed rgba(255, 255, 255, 0.7)",
39453
- borderRadius: "8px",
39454
- display: "flex",
39455
- flexDirection: "column",
39456
- justifyContent: "center",
39457
- alignItems: "center",
39458
- zIndex: 5,
39459
- pointerEvents: "none"
39460
- },
39461
- children: [/* @__PURE__ */ jsx$1(Box$1, {
39462
- sx: {
39463
- position: "absolute",
39464
- top: 0,
39465
- left: 0,
39466
- width: "20px",
39467
- height: "20px",
39468
- borderTop: "3px solid #4CAF50",
39469
- borderLeft: "3px solid #4CAF50",
39470
- borderTopLeftRadius: "8px"
39471
- }
39472
- }), /* @__PURE__ */ jsx$1(Box$1, {
39473
- sx: {
39474
- position: "absolute",
39475
- top: 0,
39476
- right: 0,
39477
- width: "20px",
39478
- height: "20px",
39479
- borderTop: "3px solid #4CAF50",
39480
- borderRight: "3px solid #4CAF50",
39481
- borderTopRightRadius: "8px"
39482
- }
39483
- }), /* @__PURE__ */ jsx$1(Box$1, {
39484
- sx: {
39485
- position: "absolute",
39486
- bottom: 0,
39487
- left: 0,
39488
- width: "20px",
39489
- height: "20px",
39490
- borderBottom: "3px solid #4CAF50",
39491
- borderLeft: "3px solid #4CAF50",
39492
- borderBottomLeftRadius: "8px"
39493
- }
39494
- }), /* @__PURE__ */ jsx$1(Box$1, {
39495
- sx: {
39496
- position: "absolute",
39497
- bottom: 0,
39498
- right: 0,
39499
- width: "20px",
39500
- height: "20px",
39501
- borderBottom: "3px solid #4CAF50",
39502
- borderRight: "3px solid #4CAF50",
39503
- borderBottomRightRadius: "8px"
39504
- }
39423
+ children: [/* @__PURE__ */ jsx$1(Typography$1, {
39424
+ variant: "h6",
39425
+ className: "title",
39426
+ mt: 2,
39427
+ children: title
39505
39428
  }), /* @__PURE__ */ jsx$1(Typography$1, {
39506
39429
  variant: "body2",
39507
- sx: {
39508
- color: "white",
39509
- textShadow: "0px 0px 3px rgba(0,0,0,0.8)",
39510
- textAlign: "center",
39511
- padding: "0 10px",
39512
- backgroundColor: "rgba(0,0,0,0.5)",
39513
- borderRadius: "4px",
39514
- marginTop: "10px"
39515
- },
39516
- children: "Coloca el documento dentro del marco"
39430
+ children: subtitle
39431
+ }), /* @__PURE__ */ jsxs(List$1, {
39432
+ dense: true,
39433
+ children: [/* @__PURE__ */ jsxs(ListItem$1, {
39434
+ children: [/* @__PURE__ */ jsx$1(ListItemIcon$1, {
39435
+ children: /* @__PURE__ */ jsx$1(LightMode, {})
39436
+ }), /* @__PURE__ */ jsx$1(ListItemText$1, {
39437
+ primary: "Procura tener buena iluminaci\xF3n"
39438
+ })]
39439
+ }), /* @__PURE__ */ jsxs(ListItem$1, {
39440
+ children: [/* @__PURE__ */ jsx$1(ListItemIcon$1, {
39441
+ children: /* @__PURE__ */ jsx$1(SettingsBrightness, {})
39442
+ }), /* @__PURE__ */ jsx$1(ListItemText$1, {
39443
+ primary: "Evita reflejos en el documento de identidad"
39444
+ })]
39445
+ }), /* @__PURE__ */ jsxs(ListItem$1, {
39446
+ children: [/* @__PURE__ */ jsx$1(ListItemIcon$1, {
39447
+ children: /* @__PURE__ */ jsx$1(Spellcheck, {})
39448
+ }), /* @__PURE__ */ jsx$1(ListItemText$1, {
39449
+ primary: "Procura que el texto en el documento sea legible"
39450
+ })]
39451
+ })]
39517
39452
  })]
39518
39453
  });
39519
39454
  };
@@ -39521,29 +39456,17 @@ function UploadDocument2({
39521
39456
  setActivateCamera,
39522
39457
  activateCamera,
39523
39458
  videoConstraints,
39524
- detail,
39525
39459
  videoRef,
39526
39460
  streamRef,
39527
39461
  onTapToFocus,
39528
39462
  title,
39529
- documentType = "id"
39463
+ subtitle
39530
39464
  }) {
39531
- const [focusing, setFocusing] = useState(false);
39532
- const [focusIndicator, setFocusIndicator] = useState(false);
39533
39465
  useEffect(() => {
39534
39466
  if (activateCamera && videoRef.current) {
39535
39467
  navigator.mediaDevices.getUserMedia({
39536
- video: {
39537
- ...videoConstraints || {
39538
- facingMode: "environment"
39539
- },
39540
- advanced: [{
39541
- focusMode: "continuous"
39542
- }, {
39543
- exposureMode: "continuous"
39544
- }, {
39545
- whiteBalanceMode: "continuous"
39546
- }]
39468
+ video: videoConstraints || {
39469
+ facingMode: "environment"
39547
39470
  },
39548
39471
  audio: false
39549
39472
  }).then((stream) => {
@@ -39563,20 +39486,6 @@ function UploadDocument2({
39563
39486
  }
39564
39487
  };
39565
39488
  }, [activateCamera, videoConstraints]);
39566
- const handleTapToFocus = async (e2) => {
39567
- setFocusing(true);
39568
- setFocusIndicator(true);
39569
- const rect = e2.currentTarget.getBoundingClientRect();
39570
- (e2.clientX - rect.left) / rect.width;
39571
- (e2.clientY - rect.top) / rect.height;
39572
- await onTapToFocus();
39573
- setTimeout(() => {
39574
- setFocusing(false);
39575
- setTimeout(() => {
39576
- setFocusIndicator(false);
39577
- }, 500);
39578
- }, 1e3);
39579
- };
39580
39489
  return /* @__PURE__ */ jsx$1("div", {
39581
39490
  className: "drag-zone",
39582
39491
  children: /* @__PURE__ */ jsx$1(Box$1, {
@@ -39591,11 +39500,8 @@ function UploadDocument2({
39591
39500
  display: "flex",
39592
39501
  justifyContent: "center",
39593
39502
  alignItems: "center",
39594
- children: activateCamera ? /* @__PURE__ */ jsxs(Box$1, {
39595
- position: "relative",
39596
- width: "100%",
39597
- height: "100%",
39598
- children: [/* @__PURE__ */ jsx$1("video", {
39503
+ children: activateCamera ? /* @__PURE__ */ jsx$1(Box$1, {
39504
+ children: /* @__PURE__ */ jsx$1("video", {
39599
39505
  ref: videoRef,
39600
39506
  style: {
39601
39507
  width: "100%",
@@ -39607,71 +39513,14 @@ function UploadDocument2({
39607
39513
  transform: "translate(-50%, -50%)",
39608
39514
  borderRadius: "5px"
39609
39515
  },
39610
- onClick: handleTapToFocus,
39516
+ onClick: onTapToFocus,
39611
39517
  playsInline: true,
39612
39518
  muted: true,
39613
39519
  autoPlay: true
39614
- }), /* @__PURE__ */ jsx$1(DocumentGuide, {
39615
- documentType
39616
- }), focusIndicator && /* @__PURE__ */ jsx$1(Box$1, {
39617
- sx: {
39618
- position: "absolute",
39619
- top: "50%",
39620
- left: "50%",
39621
- transform: "translate(-50%, -50%)",
39622
- width: "80px",
39623
- height: "80px",
39624
- border: "2px solid white",
39625
- borderRadius: "50%",
39626
- display: "flex",
39627
- justifyContent: "center",
39628
- alignItems: "center",
39629
- zIndex: 10,
39630
- animation: focusing ? "pulse 1s" : "none",
39631
- "@keyframes pulse": {
39632
- "0%": {
39633
- transform: "translate(-50%, -50%) scale(1)",
39634
- opacity: 1
39635
- },
39636
- "50%": {
39637
- transform: "translate(-50%, -50%) scale(1.2)",
39638
- opacity: 0.7
39639
- },
39640
- "100%": {
39641
- transform: "translate(-50%, -50%) scale(1)",
39642
- opacity: 1
39643
- }
39644
- }
39645
- },
39646
- children: focusing && /* @__PURE__ */ jsx$1(CircularProgress$1, {
39647
- size: 40,
39648
- color: "primary"
39649
- })
39650
- }), /* @__PURE__ */ jsx$1(Box$1, {
39651
- sx: {
39652
- position: "absolute",
39653
- bottom: "10px",
39654
- left: "50%",
39655
- transform: "translateX(-50%)",
39656
- backgroundColor: "rgba(0, 0, 0, 0.6)",
39657
- color: "white",
39658
- padding: "8px 16px",
39659
- borderRadius: "20px",
39660
- fontSize: "14px",
39661
- zIndex: 10
39662
- },
39663
- children: "Toca la pantalla para enfocar en el documento"
39664
- })]
39665
- }) : /* @__PURE__ */ jsxs(Box$1, {
39666
- children: [/* @__PURE__ */ jsx$1(CloudUploadIcon, {}), /* @__PURE__ */ jsx$1(Typography$1, {
39667
- variant: "h6",
39668
- className: "title",
39669
- mt: 2,
39670
- children: title
39671
- }), /* @__PURE__ */ jsx$1(Typography$1, {
39672
- variant: "body2",
39673
- children: detail
39674
- })]
39520
+ })
39521
+ }) : /* @__PURE__ */ jsx$1(InstructionsComponent, {
39522
+ title,
39523
+ subtitle
39675
39524
  })
39676
39525
  })
39677
39526
  })
@@ -39683,65 +39532,28 @@ function UploadByGallery({
39683
39532
  side,
39684
39533
  title,
39685
39534
  subtitle,
39686
- startUpload,
39687
- onClickToContinue
39535
+ startUpload
39688
39536
  }) {
39689
39537
  const handleClick = () => {
39690
39538
  var _a;
39691
39539
  (_a = fileInputRef.current) == null ? void 0 : _a.click();
39692
39540
  };
39693
- return /* @__PURE__ */ jsx$1(Box$1, {
39694
- className: "upload-by-gallery-container",
39695
- children: !startUpload ? /* @__PURE__ */ jsxs(Box$1, {
39696
- children: [/* @__PURE__ */ jsx$1(Typography$1, {
39697
- variant: "h6",
39698
- className: "title",
39699
- mt: 2,
39700
- children: title
39701
- }), /* @__PURE__ */ jsx$1(Typography$1, {
39702
- variant: "body2",
39703
- children: subtitle
39704
- }), /* @__PURE__ */ jsxs(List$1, {
39705
- dense: true,
39706
- children: [/* @__PURE__ */ jsxs(ListItem$1, {
39707
- children: [/* @__PURE__ */ jsx$1(ListItemIcon$1, {
39708
- children: /* @__PURE__ */ jsx$1(LightMode, {})
39709
- }), /* @__PURE__ */ jsx$1(ListItemText$1, {
39710
- primary: "Procura tener buena iluminaci\xF3n"
39711
- })]
39712
- }), /* @__PURE__ */ jsxs(ListItem$1, {
39713
- children: [/* @__PURE__ */ jsx$1(ListItemIcon$1, {
39714
- children: /* @__PURE__ */ jsx$1(SettingsBrightness, {})
39715
- }), /* @__PURE__ */ jsx$1(ListItemText$1, {
39716
- primary: "Evita reflejos en el documento de identidad"
39717
- })]
39718
- }), /* @__PURE__ */ jsxs(ListItem$1, {
39719
- children: [/* @__PURE__ */ jsx$1(ListItemIcon$1, {
39720
- children: /* @__PURE__ */ jsx$1(Spellcheck, {})
39721
- }), /* @__PURE__ */ jsx$1(ListItemText$1, {
39722
- primary: "Procura que el texto en el documento sea legible"
39723
- })]
39724
- })]
39725
- }), /* @__PURE__ */ jsx$1(CustomButton, {
39726
- type: "button",
39727
- onClick: onClickToContinue,
39728
- children: "Continuar"
39729
- })]
39730
- }) : /* @__PURE__ */ jsx$1("div", {
39731
- className: "drag-zone",
39541
+ return /* @__PURE__ */ jsx$1("div", {
39542
+ className: "drag-zone",
39543
+ children: /* @__PURE__ */ jsx$1(Box$1, {
39544
+ className: "drag-and-drop-container",
39732
39545
  children: /* @__PURE__ */ jsx$1(Box$1, {
39733
- className: "drag-and-drop-container",
39734
- children: /* @__PURE__ */ jsxs(Box$1, {
39735
- onClick: () => handleClick(),
39736
- position: "relative",
39737
- zIndex: 1,
39738
- width: "100%",
39739
- height: "100%",
39740
- overflow: "hidden",
39741
- display: "flex",
39742
- justifyContent: "center",
39743
- alignItems: "center",
39744
- padding: 2,
39546
+ onClick: () => handleClick(),
39547
+ position: "relative",
39548
+ zIndex: 1,
39549
+ width: "100%",
39550
+ height: "100%",
39551
+ overflow: "hidden",
39552
+ display: "flex",
39553
+ justifyContent: "center",
39554
+ alignItems: "center",
39555
+ padding: 2,
39556
+ children: startUpload ? /* @__PURE__ */ jsxs(Fragment, {
39745
39557
  children: [/* @__PURE__ */ jsxs("div", {
39746
39558
  style: {
39747
39559
  display: "flex",
@@ -39749,7 +39561,7 @@ function UploadByGallery({
39749
39561
  alignItems: "center",
39750
39562
  justifyContent: "center"
39751
39563
  },
39752
- children: [/* @__PURE__ */ jsx$1(CloudUploadIcon, {}), /* @__PURE__ */ jsxs(Typography$1, {
39564
+ children: [/* @__PURE__ */ jsx$1(CloudUploadIcon, {}), /* @__PURE__ */ jsx$1(Typography$1, {
39753
39565
  variant: "body2",
39754
39566
  style: {
39755
39567
  textAlign: "center",
@@ -39757,9 +39569,7 @@ function UploadByGallery({
39757
39569
  whiteSpace: "none",
39758
39570
  margin: "auto"
39759
39571
  },
39760
- children: [/* @__PURE__ */ jsx$1("strong", {
39761
- children: "Haz clic aqu\xED"
39762
- }), " para subir una foto desde tu dispositivo"]
39572
+ children: "Haz clic aqu\xED para subir una foto desde tu dispositivo"
39763
39573
  })]
39764
39574
  }), /* @__PURE__ */ jsx$1("input", {
39765
39575
  ref: fileInputRef,
@@ -39772,6 +39582,9 @@ function UploadByGallery({
39772
39582
  display: "none"
39773
39583
  }
39774
39584
  })]
39585
+ }) : /* @__PURE__ */ jsx$1(InstructionsComponent, {
39586
+ title,
39587
+ subtitle
39775
39588
  })
39776
39589
  })
39777
39590
  })
@@ -39800,46 +39613,6 @@ const createCanvasFromSource = (source2) => {
39800
39613
  ctx == null ? void 0 : ctx.drawImage(source2, 0, 0, width2, height2);
39801
39614
  return { canvas, ctx };
39802
39615
  };
39803
- const analyzeFocusQuality = async (imageData) => {
39804
- return new Promise((resolve) => {
39805
- if (typeof imageData === "string") {
39806
- const img = new Image();
39807
- img.onload = () => {
39808
- const { canvas, ctx } = createCanvasFromSource(img);
39809
- const result = calculateSharpness(canvas, ctx);
39810
- resolve(result);
39811
- };
39812
- img.src = imageData;
39813
- } else {
39814
- const result = calculateSharpness(imageData, imageData.getContext("2d"));
39815
- resolve(result);
39816
- }
39817
- });
39818
- };
39819
- const calculateSharpness = (canvas, ctx) => {
39820
- if (!ctx) {
39821
- return { isFocused: false, sharpness: 0 };
39822
- }
39823
- const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
39824
- const data2 = imageData.data;
39825
- let sum = 0;
39826
- let sumSquared = 0;
39827
- let count = 0;
39828
- for (let i = 0; i < data2.length; i += 4) {
39829
- const luminance = (data2[i] + data2[i + 1] + data2[i + 2]) / 3;
39830
- sum += luminance;
39831
- sumSquared += luminance * luminance;
39832
- count++;
39833
- }
39834
- const mean = sum / count;
39835
- const variance = sumSquared / count - mean * mean;
39836
- const normalizedVariance = Math.min(variance / 1e3, 1);
39837
- const isFocused = normalizedVariance > 0.3;
39838
- return {
39839
- isFocused,
39840
- sharpness: normalizedVariance
39841
- };
39842
- };
39843
39616
  const isLowEndDevice = () => {
39844
39617
  const cores = navigator.hardwareConcurrency || 2;
39845
39618
  const memory = navigator.deviceMemory || 2;
@@ -39863,7 +39636,6 @@ function CustomTabPanel(props) {
39863
39636
  dualModeRequired,
39864
39637
  status,
39865
39638
  onUploadImage2,
39866
- uploadByGallery,
39867
39639
  ...other
39868
39640
  } = props;
39869
39641
  return /* @__PURE__ */ jsx$1("div", {
@@ -39872,7 +39644,9 @@ function CustomTabPanel(props) {
39872
39644
  id: `simple-tabpanel-${index}`,
39873
39645
  "aria-labelledby": `simple-tab-${index}`,
39874
39646
  ...other,
39647
+ className: "tabpanel",
39875
39648
  children: value === index && /* @__PURE__ */ jsx$1(Box$1, {
39649
+ height: "100%",
39876
39650
  children
39877
39651
  })
39878
39652
  });
@@ -39901,16 +39675,11 @@ function SideDocsSelector({
39901
39675
  status,
39902
39676
  onUploadImage2,
39903
39677
  uploadDocumentByPhone,
39904
- uploadByGallery,
39905
- setUploadDocumentByPhone,
39906
- onSendSubmitDocument,
39907
- documentType = "id"
39678
+ onSendSubmitDocument
39908
39679
  }) {
39909
39680
  const [value, setValue] = React$2.useState(0);
39910
39681
  const [showZoom, setShowZoom] = React$2.useState(false);
39911
- const [countAnalyzedImage, setCountAnalyzedImage] = useState(0);
39912
39682
  const [hideCaptureButton, setHideCaptureButton] = useState(false);
39913
- const [startUpload, setStartUpload] = useState(false);
39914
39683
  const handleChange = (event, newValue) => {
39915
39684
  setValue(newValue);
39916
39685
  };
@@ -39926,6 +39695,17 @@ function SideDocsSelector({
39926
39695
  };
39927
39696
  const videoRef = useRef(null);
39928
39697
  const streamRef = useRef(null);
39698
+ const takeScreenshot = async (side) => {
39699
+ const video = videoRef.current;
39700
+ if (!video)
39701
+ return;
39702
+ const {
39703
+ canvas
39704
+ } = createCanvasFromSource(video);
39705
+ const imageData = canvas.toDataURL("image/jpeg");
39706
+ onUploadImage2(side, imageData);
39707
+ processImage();
39708
+ };
39929
39709
  const handleTapToFocus = async () => {
39930
39710
  var _a, _b;
39931
39711
  if (!streamRef.current)
@@ -39935,12 +39715,12 @@ function SideDocsSelector({
39935
39715
  const settings = (_b = track.getSettings) == null ? void 0 : _b.call(track);
39936
39716
  console.log("focus capabilities:", capabilities);
39937
39717
  console.log("focus settings:", settings);
39938
- if (!capabilities) {
39939
- console.warn("No se puede acceder a las capacidades de la c\xE1mara");
39718
+ if (!capabilities || !capabilities.focusMode) {
39719
+ console.warn("No se puede acceder a las capacidades de enfoque");
39940
39720
  return;
39941
39721
  }
39942
39722
  try {
39943
- if (capabilities.focusMode && capabilities.focusMode.includes("continuous")) {
39723
+ if (capabilities.focusMode.includes("continuous")) {
39944
39724
  await track.applyConstraints({
39945
39725
  frameRate: {
39946
39726
  ideal: 30
@@ -39949,8 +39729,7 @@ function SideDocsSelector({
39949
39729
  focusMode: "continuous"
39950
39730
  }]
39951
39731
  });
39952
- console.log("Enfoque continuo aplicado");
39953
- } else if (capabilities.focusMode && capabilities.focusMode.includes("single-shot")) {
39732
+ } else if (capabilities.focusMode.includes("single-shot")) {
39954
39733
  await track.applyConstraints({
39955
39734
  frameRate: {
39956
39735
  ideal: 30
@@ -39959,97 +39738,45 @@ function SideDocsSelector({
39959
39738
  focusMode: "single-shot"
39960
39739
  }]
39961
39740
  });
39962
- console.log("Enfoque de disparo \xFAnico aplicado");
39963
- } else if (capabilities.focusMode && capabilities.focusMode.includes("manual") && capabilities.focusDistance) {
39964
- const midDistance = (capabilities.focusDistance.min + capabilities.focusDistance.max) / 2;
39741
+ } else if (capabilities.focusMode.includes("manual") && capabilities.focusDistance) {
39965
39742
  await track.applyConstraints({
39966
39743
  frameRate: {
39967
39744
  ideal: 30
39968
39745
  },
39969
39746
  advanced: [{
39970
39747
  focusMode: "manual",
39971
- focusDistance: midDistance
39748
+ focusDistance: capabilities.focusDistance.min
39972
39749
  }]
39973
39750
  });
39974
- console.log("Enfoque manual aplicado a distancia media");
39975
39751
  } else {
39976
39752
  console.warn("No hay modo de enfoque compatible");
39977
39753
  }
39978
- if (capabilities.exposureMode && capabilities.exposureMode.includes("continuous")) {
39979
- await track.applyConstraints({
39980
- advanced: [{
39981
- exposureMode: "continuous"
39982
- }]
39983
- });
39984
- console.log("Exposici\xF3n continua aplicada");
39985
- }
39986
- if (capabilities.whiteBalanceMode && capabilities.whiteBalanceMode.includes("continuous")) {
39987
- await track.applyConstraints({
39988
- advanced: [{
39989
- whiteBalanceMode: "continuous"
39990
- }]
39991
- });
39992
- console.log("Balance de blancos continuo aplicado");
39993
- }
39994
- setTimeout(async () => {
39995
- var _a2;
39996
- const newSettings = (_a2 = track.getSettings) == null ? void 0 : _a2.call(track);
39997
- console.log("Nuevos ajustes despu\xE9s del enfoque:", newSettings);
39998
- }, 1e3);
39999
39754
  } catch (err) {
40000
39755
  console.error("Error al aplicar constraints de enfoque:", err);
40001
39756
  }
40002
39757
  };
40003
- const checkFocusQuality = async (imageData) => {
40004
- return await analyzeFocusQuality(imageData);
40005
- };
40006
- const takeScreenshot = async (side) => {
40007
- const video = videoRef.current;
40008
- if (!video)
40009
- return;
40010
- const {
40011
- canvas
40012
- } = createCanvasFromSource(video);
40013
- const imageData = canvas.toDataURL("image/jpeg");
40014
- const {
40015
- isFocused,
40016
- sharpness
40017
- } = await checkFocusQuality(imageData);
40018
- if (isFocused && sharpness > 0.3) {
40019
- onUploadImage2(side, imageData);
40020
- } else {
40021
- setCountAnalyzedImage((prevState) => {
40022
- return prevState + 1;
40023
- });
40024
- if (countAnalyzedImage >= 1) {
40025
- setUploadDocumentByPhone(true);
40026
- setHideCaptureButton(true);
40027
- setCountAnalyzedImage(0);
40028
- } else {
40029
- alert("La imagen no est\xE1 bien enfocada. Por favor, toca la pantalla para enfocar en el documento y vuelve a intentarlo.");
40030
- }
40031
- }
40032
- };
40033
39758
  const fileInputRef = useRef(null);
40034
39759
  const handleFileChange = async (e2) => {
40035
39760
  const imageData = e2.target.files[0];
40036
39761
  const image = await fileToBase64(imageData);
40037
39762
  const side = e2.target.name;
40038
39763
  onUploadImage2(side, image);
40039
- if (side === "firstImage") {
40040
- handleChange((e22) => e22, 1);
40041
- } else {
39764
+ processImage();
39765
+ };
39766
+ const processImage = () => {
39767
+ if (base64.firstImage && dualModeRequired)
39768
+ handleChange((e2) => e2, 1);
39769
+ if (base64.firstImage && base64.secondImage)
40042
39770
  onSendSubmitDocument();
40043
- }
40044
39771
  };
40045
39772
  const onClickToContinue = () => {
40046
39773
  setHideCaptureButton(false);
40047
- setStartUpload(true);
39774
+ setActivateCamera(true);
40048
39775
  };
40049
- console.log(activateCamera);
40050
39776
  return /* @__PURE__ */ jsxs(Box$1, {
40051
39777
  sx: {
40052
- width: "100%"
39778
+ width: "100%",
39779
+ height: "100%"
40053
39780
  },
40054
39781
  children: [/* @__PURE__ */ jsx$1(Box$1, {
40055
39782
  sx: {
@@ -40081,7 +39808,7 @@ function SideDocsSelector({
40081
39808
  justifyContent: "flex-start",
40082
39809
  alignItems: "flex-start",
40083
39810
  width: "100%",
40084
- children: [base64.firstImage ? /* @__PURE__ */ jsxs("div", {
39811
+ children: [base64.firstImage ? /* @__PURE__ */ jsx$1("div", {
40085
39812
  className: "img-container",
40086
39813
  style: {
40087
39814
  transition: "transform 0.3s ease-in-out, width 0.3s ease-in-out",
@@ -40089,7 +39816,7 @@ function SideDocsSelector({
40089
39816
  position: "relative",
40090
39817
  zIndex: 1
40091
39818
  },
40092
- children: [/* @__PURE__ */ jsx$1("img", {
39819
+ children: /* @__PURE__ */ jsx$1("img", {
40093
39820
  src: base64.firstImage,
40094
39821
  onClick: toggleZoom,
40095
39822
  alt: "thumbnail",
@@ -40098,27 +39825,30 @@ function SideDocsSelector({
40098
39825
  height: "100%",
40099
39826
  objectFit: "cover"
40100
39827
  }
40101
- }), /* @__PURE__ */ jsxs(Box$1, {
40102
- style: {
40103
- position: "absolute",
40104
- top: 0,
40105
- right: 0,
40106
- display: "flex",
40107
- gap: "8px",
40108
- zIndex: 20
40109
- },
39828
+ })
39829
+ }) : uploadDocumentByPhone || isLowEndDevice() ? /* @__PURE__ */ jsx$1(UploadByGallery, {
39830
+ handleFileChange,
39831
+ side: "firstImage",
39832
+ fileInputRef,
39833
+ title: "Cargar documeto",
39834
+ subtitle: "Vamos a cargar el documento desde tu dispositivo. \xA1Ten en cuenta lo siguiente!",
39835
+ startUpload: activateCamera
39836
+ }) : /* @__PURE__ */ jsx$1(UploadDocument2, {
39837
+ videoRef,
39838
+ streamRef,
39839
+ setActivateCamera,
39840
+ activateCamera,
39841
+ videoConstraints,
39842
+ onTapToFocus: handleTapToFocus,
39843
+ title: "Cargar documento",
39844
+ subtitle: "Subir frontal del documento"
39845
+ }), /* @__PURE__ */ jsxs(Box$1, {
39846
+ width: "100%",
39847
+ children: [base64.firstImage && /* @__PURE__ */ jsxs(Box$1, {
39848
+ className: "toolbox-container",
40110
39849
  children: [/* @__PURE__ */ jsx$1(Box$1, {
40111
39850
  className: "zoom-button",
40112
39851
  onClick: toggleZoom,
40113
- sx: {
40114
- backgroundColor: "rgba(255, 255, 255, 0.7)",
40115
- borderRadius: "50%",
40116
- padding: "4px",
40117
- cursor: "pointer",
40118
- display: "flex",
40119
- alignItems: "center",
40120
- justifyContent: "center"
40121
- },
40122
39852
  children: /* @__PURE__ */ jsx$1(MUITooltip, {
40123
39853
  title: "Ampliar",
40124
39854
  placement: "right",
@@ -40132,15 +39862,6 @@ function SideDocsSelector({
40132
39862
  }), /* @__PURE__ */ jsx$1(Box$1, {
40133
39863
  className: "delete-button",
40134
39864
  onClick: () => deleteImage("firstImage"),
40135
- sx: {
40136
- backgroundColor: "rgba(255, 255, 255, 0.7)",
40137
- borderRadius: "50%",
40138
- padding: "4px",
40139
- cursor: "pointer",
40140
- display: "flex",
40141
- alignItems: "center",
40142
- justifyContent: "center"
40143
- },
40144
39865
  children: /* @__PURE__ */ jsx$1(MUITooltip, {
40145
39866
  title: "Vaciar",
40146
39867
  placement: "right",
@@ -40151,34 +39872,25 @@ function SideDocsSelector({
40151
39872
  })
40152
39873
  })
40153
39874
  })]
40154
- })]
40155
- }) : uploadDocumentByPhone || uploadByGallery || isLowEndDevice() ? /* @__PURE__ */ jsx$1(UploadByGallery, {
40156
- handleFileChange,
40157
- side: "firstImage",
40158
- fileInputRef,
40159
- title: "Cargar documeto",
40160
- subtitle: "Vamos a cargar el documento desde tu dispositivo. \xA1Ten en cuenta lo siguiente!",
40161
- onClickToContinue,
40162
- startUpload
40163
- }) : /* @__PURE__ */ jsx$1(UploadDocument2, {
40164
- videoRef,
40165
- streamRef,
40166
- setActivateCamera,
40167
- activateCamera,
40168
- videoConstraints,
40169
- detail: "Subir frontal del documento",
40170
- onTapToFocus: handleTapToFocus,
40171
- title: "Cargar documento",
40172
- documentType
40173
- }), /* @__PURE__ */ jsxs(Box$1, {
40174
- width: "100%",
40175
- children: [activateCamera && !hideCaptureButton && /* @__PURE__ */ jsx$1(CustomButton, {
39875
+ }), !activateCamera && !base64.firstImage && /* @__PURE__ */ jsx$1(CustomButton, {
39876
+ type: "button",
39877
+ onClick: onClickToContinue,
39878
+ children: "Continuar"
39879
+ }), !activateCamera && base64.firstImage && /* @__PURE__ */ jsx$1(CustomButton, {
39880
+ type: "button",
39881
+ onClick: (e2) => handleChange(e2, 1),
39882
+ children: "Cargar reverso del documento"
39883
+ }), activateCamera && !hideCaptureButton && !uploadDocumentByPhone && /* @__PURE__ */ jsx$1(CustomButton, {
40176
39884
  type: "button",
40177
39885
  onClick: () => takeScreenshot("firstImage"),
40178
39886
  children: "Capturar"
40179
- }), !status && Object.keys(base64).length > 0 && !activateCamera && lib$1(status) && (!dualModeRequired && base64.firstImage || dualModeRequired && base64.firstImage && base64.secondImage) && /* @__PURE__ */ jsx$1(CustomButton, {
40180
- type: "submit",
40181
- children: "Procesar"
39887
+ }), !status && Object.keys(base64).length > 0 && !activateCamera && lib$1(status) && (!dualModeRequired && base64.firstImage || dualModeRequired && base64.firstImage && base64.secondImage) && /* @__PURE__ */ jsxs(Box$1, {
39888
+ children: [/* @__PURE__ */ jsx$1(Divider$1, {
39889
+ children: "O"
39890
+ }), /* @__PURE__ */ jsx$1(CustomButton, {
39891
+ type: "submit",
39892
+ children: "Procesar"
39893
+ })]
40182
39894
  })]
40183
39895
  })]
40184
39896
  })
@@ -40197,7 +39909,7 @@ function SideDocsSelector({
40197
39909
  justifyContent: "flex-start",
40198
39910
  alignItems: "flex-start",
40199
39911
  width: "100%",
40200
- children: [base64.secondImage ? /* @__PURE__ */ jsxs("div", {
39912
+ children: [base64.secondImage ? /* @__PURE__ */ jsx$1("div", {
40201
39913
  className: "img-container",
40202
39914
  style: {
40203
39915
  transition: "transform 0.3s ease-in-out, width 0.3s ease-in-out",
@@ -40205,7 +39917,7 @@ function SideDocsSelector({
40205
39917
  position: "relative",
40206
39918
  zIndex: 1
40207
39919
  },
40208
- children: [/* @__PURE__ */ jsx$1("img", {
39920
+ children: /* @__PURE__ */ jsx$1("img", {
40209
39921
  src: base64.secondImage,
40210
39922
  onClick: toggleZoom,
40211
39923
  alt: "thumbnail",
@@ -40214,29 +39926,32 @@ function SideDocsSelector({
40214
39926
  height: "100%",
40215
39927
  objectFit: "cover"
40216
39928
  }
40217
- }), /* @__PURE__ */ jsxs(Box$1, {
40218
- style: {
40219
- position: "absolute",
40220
- top: 0,
40221
- right: 0,
40222
- display: "flex",
40223
- gap: "8px",
40224
- zIndex: 20
40225
- },
39929
+ })
39930
+ }) : uploadDocumentByPhone || isLowEndDevice() ? /* @__PURE__ */ jsx$1(UploadByGallery, {
39931
+ handleFileChange,
39932
+ side: "secondImage",
39933
+ fileInputRef,
39934
+ title: "Bien ahora vamos por el reverso",
39935
+ subtitle: "\xA1Recuerda tener en cuenta lo siguiente!",
39936
+ startUpload: activateCamera
39937
+ }) : /* @__PURE__ */ jsx$1(UploadDocument2, {
39938
+ videoRef,
39939
+ streamRef,
39940
+ setActivateCamera,
39941
+ activateCamera,
39942
+ videoConstraints,
39943
+ title: "Bien ahora carguemos el reverso",
39944
+ subtitle: "Asegurate de que sea legible",
39945
+ onTapToFocus: handleTapToFocus
39946
+ }), /* @__PURE__ */ jsxs(Box$1, {
39947
+ width: "100%",
39948
+ children: [base64.secondImage && /* @__PURE__ */ jsxs(Box$1, {
39949
+ className: "toolbox-container",
40226
39950
  children: [/* @__PURE__ */ jsx$1(Box$1, {
40227
39951
  className: "zoom-button",
40228
39952
  onClick: toggleZoom,
40229
- sx: {
40230
- backgroundColor: "rgba(255, 255, 255, 0.7)",
40231
- borderRadius: "50%",
40232
- padding: "4px",
40233
- cursor: "pointer",
40234
- display: "flex",
40235
- alignItems: "center",
40236
- justifyContent: "center"
40237
- },
40238
39953
  children: /* @__PURE__ */ jsx$1(MUITooltip, {
40239
- title: "Girar",
39954
+ title: "Ampliar",
40240
39955
  placement: "right",
40241
39956
  arrow: true,
40242
39957
  children: /* @__PURE__ */ jsx$1(ZoomInTwoTone, {
@@ -40248,15 +39963,6 @@ function SideDocsSelector({
40248
39963
  }), /* @__PURE__ */ jsx$1(Box$1, {
40249
39964
  className: "delete-button",
40250
39965
  onClick: () => deleteImage("secondImage"),
40251
- sx: {
40252
- backgroundColor: "rgba(255, 255, 255, 0.7)",
40253
- borderRadius: "50%",
40254
- padding: "4px",
40255
- cursor: "pointer",
40256
- display: "flex",
40257
- alignItems: "center",
40258
- justifyContent: "center"
40259
- },
40260
39966
  children: /* @__PURE__ */ jsx$1(MUITooltip, {
40261
39967
  title: "Vaciar",
40262
39968
  placement: "right",
@@ -40267,28 +39973,11 @@ function SideDocsSelector({
40267
39973
  })
40268
39974
  })
40269
39975
  })]
40270
- })]
40271
- }) : uploadDocumentByPhone || uploadByGallery || isLowEndDevice() ? /* @__PURE__ */ jsx$1(UploadByGallery, {
40272
- handleFileChange,
40273
- side: "secondImage",
40274
- fileInputRef,
40275
- title: "Bien ahora vamos por el reverso",
40276
- subtitle: "\xA1Recuerda tener en cuenta lo siguiente!",
40277
- onClickToContinue,
40278
- startUpload
40279
- }) : /* @__PURE__ */ jsx$1(UploadDocument2, {
40280
- videoRef,
40281
- streamRef,
40282
- setActivateCamera,
40283
- activateCamera,
40284
- videoConstraints,
40285
- title: "Bien ahora carguemos el reverso",
40286
- detail: "Asegurate de que sea legible",
40287
- onTapToFocus: handleTapToFocus,
40288
- documentType
40289
- }), /* @__PURE__ */ jsxs(Box$1, {
40290
- width: "100%",
40291
- children: [activateCamera && !hideCaptureButton && /* @__PURE__ */ jsx$1(CustomButton, {
39976
+ }), !activateCamera && !base64.secondImage && /* @__PURE__ */ jsx$1(CustomButton, {
39977
+ type: "button",
39978
+ onClick: onClickToContinue,
39979
+ children: "Continuar"
39980
+ }), activateCamera && !hideCaptureButton && !uploadDocumentByPhone && /* @__PURE__ */ jsx$1(CustomButton, {
40292
39981
  type: "button",
40293
39982
  onClick: () => takeScreenshot("secondImage"),
40294
39983
  children: "Capturar"
@@ -40741,8 +40430,7 @@ function DocumentReader({
40741
40430
  countryCodeAllowed = null,
40742
40431
  validateVpn = false,
40743
40432
  successMessage,
40744
- dualModeRequired = false,
40745
- uploadByGallery = false
40433
+ dualModeRequired = true
40746
40434
  }) {
40747
40435
  const {
40748
40436
  onSendSubmitDocument,
@@ -40764,7 +40452,7 @@ function DocumentReader({
40764
40452
  setUploadDocumentByPhone
40765
40453
  } = DocumentReaderController(dataDocument, clientId, authorize, eventId, source2, inProduction, countryCodeAllowed, validateVpn, successMessage, dualModeRequired);
40766
40454
  return /* @__PURE__ */ jsxs("div", {
40767
- className: `kit-gbc ${mode} without-shadow`,
40455
+ className: `kit-gbc ${mode} without-shadow ocr`,
40768
40456
  children: [/* @__PURE__ */ jsx$1(k$2, {
40769
40457
  position: "top-center",
40770
40458
  autoClose: 5e3,
@@ -40805,7 +40493,6 @@ function DocumentReader({
40805
40493
  status,
40806
40494
  onUploadImage2,
40807
40495
  uploadDocumentByPhone,
40808
- uploadByGallery,
40809
40496
  setUploadDocumentByPhone,
40810
40497
  onSendSubmitDocument
40811
40498
  })]
@@ -40824,8 +40511,7 @@ DocumentReader.propTypes = {
40824
40511
  eventId: propTypes.exports.PropTypes.string,
40825
40512
  validateVpn: propTypes.exports.PropTypes.bool,
40826
40513
  dualModeRequired: propTypes.exports.PropTypes.bool,
40827
- successMessage: propTypes.exports.PropTypes.string,
40828
- uploadByGallery: propTypes.exports.PropTypes.bool
40514
+ successMessage: propTypes.exports.PropTypes.string
40829
40515
  };
40830
40516
  const fetchFaceMatch = async (faceMatch, selfie, inProduction, customHeaders) => {
40831
40517
  const parseReq = {