gbc-kyc-kit 2.2.2 → 2.2.3
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/gbc-kyc-kit.es.js +116 -28
- package/dist/gbc-kyc-kit.umd.js +64 -64
- package/package.json +1 -1
package/dist/gbc-kyc-kit.es.js
CHANGED
|
@@ -18487,7 +18487,7 @@ function CustomButton({
|
|
|
18487
18487
|
href
|
|
18488
18488
|
}) {
|
|
18489
18489
|
return /* @__PURE__ */ jsx$1("div", {
|
|
18490
|
-
className: `button-container m-0 mt-2`,
|
|
18490
|
+
className: `button-container m-0 mt-2 testing`,
|
|
18491
18491
|
children: /* @__PURE__ */ jsx$1("button", {
|
|
18492
18492
|
type,
|
|
18493
18493
|
name,
|
|
@@ -39051,6 +39051,14 @@ const DocumentReaderController = (dataDocument, clientId, authorize, eventId, so
|
|
|
39051
39051
|
setBase64(newImage);
|
|
39052
39052
|
setActivateCamera(false);
|
|
39053
39053
|
};
|
|
39054
|
+
const onUploadImage2 = async (side, image) => {
|
|
39055
|
+
const newImage = Object.assign(base64, {
|
|
39056
|
+
[side]: image
|
|
39057
|
+
});
|
|
39058
|
+
console.log(newImage);
|
|
39059
|
+
setBase64(newImage);
|
|
39060
|
+
setActivateCamera(false);
|
|
39061
|
+
};
|
|
39054
39062
|
const usePortrait = () => {
|
|
39055
39063
|
const [isPortrait2, setIsPortrait] = useState(window.innerHeight > window.innerWidth);
|
|
39056
39064
|
useEffect(() => {
|
|
@@ -39103,26 +39111,52 @@ const DocumentReaderController = (dataDocument, clientId, authorize, eventId, so
|
|
|
39103
39111
|
webcamRef,
|
|
39104
39112
|
activateCamera,
|
|
39105
39113
|
setActivateCamera,
|
|
39106
|
-
videoConstraints
|
|
39114
|
+
videoConstraints,
|
|
39115
|
+
onUploadImage2
|
|
39107
39116
|
};
|
|
39108
39117
|
};
|
|
39109
39118
|
const validateErrorMessageOCR = (message) => {
|
|
39110
39119
|
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 == "";
|
|
39111
39120
|
};
|
|
39112
|
-
function
|
|
39121
|
+
function UploadDocument2({
|
|
39113
39122
|
setActivateCamera,
|
|
39114
39123
|
activateCamera,
|
|
39115
|
-
webcamRef,
|
|
39116
|
-
Webcam: Webcam2,
|
|
39117
39124
|
videoConstraints,
|
|
39118
39125
|
base64,
|
|
39119
|
-
detail
|
|
39126
|
+
detail,
|
|
39127
|
+
videoRef,
|
|
39128
|
+
streamRef,
|
|
39129
|
+
onTapToFocus
|
|
39120
39130
|
}) {
|
|
39131
|
+
useEffect(() => {
|
|
39132
|
+
if (activateCamera && videoRef.current) {
|
|
39133
|
+
navigator.mediaDevices.getUserMedia({
|
|
39134
|
+
video: videoConstraints || {
|
|
39135
|
+
facingMode: "environment"
|
|
39136
|
+
},
|
|
39137
|
+
audio: false
|
|
39138
|
+
}).then((stream) => {
|
|
39139
|
+
if (videoRef.current) {
|
|
39140
|
+
videoRef.current.srcObject = stream;
|
|
39141
|
+
videoRef.current.play();
|
|
39142
|
+
streamRef.current = stream;
|
|
39143
|
+
}
|
|
39144
|
+
}).catch((err) => {
|
|
39145
|
+
console.error("Error al acceder a la c\xE1mara:", err);
|
|
39146
|
+
});
|
|
39147
|
+
}
|
|
39148
|
+
return () => {
|
|
39149
|
+
if (streamRef.current) {
|
|
39150
|
+
streamRef.current.getTracks().forEach((track) => track.stop());
|
|
39151
|
+
streamRef.current = null;
|
|
39152
|
+
}
|
|
39153
|
+
};
|
|
39154
|
+
}, [activateCamera, videoConstraints]);
|
|
39121
39155
|
return /* @__PURE__ */ jsx$1("div", {
|
|
39122
39156
|
className: "drag-zone",
|
|
39123
39157
|
children: /* @__PURE__ */ jsx$1(Box$1, {
|
|
39124
39158
|
className: "drag-and-drop-container",
|
|
39125
|
-
children: /* @__PURE__ */
|
|
39159
|
+
children: /* @__PURE__ */ jsx$1(Box$1, {
|
|
39126
39160
|
onClick: () => setActivateCamera(true),
|
|
39127
39161
|
position: "relative",
|
|
39128
39162
|
zIndex: 1,
|
|
@@ -39132,12 +39166,8 @@ function UploadDocument({
|
|
|
39132
39166
|
display: "flex",
|
|
39133
39167
|
justifyContent: "center",
|
|
39134
39168
|
alignItems: "center",
|
|
39135
|
-
children:
|
|
39136
|
-
ref:
|
|
39137
|
-
videoConstraints,
|
|
39138
|
-
screenshotFormat: "image/jpeg",
|
|
39139
|
-
forceScreenshotSourceSize: true,
|
|
39140
|
-
audio: false,
|
|
39169
|
+
children: activateCamera ? /* @__PURE__ */ jsx$1("video", {
|
|
39170
|
+
ref: videoRef,
|
|
39141
39171
|
style: {
|
|
39142
39172
|
width: "100%",
|
|
39143
39173
|
height: "100%",
|
|
@@ -39147,8 +39177,12 @@ function UploadDocument({
|
|
|
39147
39177
|
left: "50%",
|
|
39148
39178
|
transform: "translate(-50%, -50%)",
|
|
39149
39179
|
borderRadius: "5px"
|
|
39150
|
-
}
|
|
39151
|
-
|
|
39180
|
+
},
|
|
39181
|
+
onClick: onTapToFocus,
|
|
39182
|
+
playsInline: true,
|
|
39183
|
+
muted: true,
|
|
39184
|
+
autoPlay: true
|
|
39185
|
+
}) : /* @__PURE__ */ jsxs(Box$1, {
|
|
39152
39186
|
children: [/* @__PURE__ */ jsx$1(CloudUploadIcon, {}), /* @__PURE__ */ jsx$1(Typography$1, {
|
|
39153
39187
|
variant: "h6",
|
|
39154
39188
|
className: "title",
|
|
@@ -39158,7 +39192,7 @@ function UploadDocument({
|
|
|
39158
39192
|
variant: "body2",
|
|
39159
39193
|
children: detail
|
|
39160
39194
|
})]
|
|
39161
|
-
})
|
|
39195
|
+
})
|
|
39162
39196
|
})
|
|
39163
39197
|
})
|
|
39164
39198
|
});
|
|
@@ -39179,6 +39213,7 @@ function CustomTabPanel(props) {
|
|
|
39179
39213
|
onUploadImage,
|
|
39180
39214
|
dualModeRequired,
|
|
39181
39215
|
status,
|
|
39216
|
+
onUploadImage2,
|
|
39182
39217
|
...other
|
|
39183
39218
|
} = props;
|
|
39184
39219
|
return /* @__PURE__ */ jsx$1("div", {
|
|
@@ -39213,7 +39248,8 @@ function SideDocsSelector({
|
|
|
39213
39248
|
videoConstraints,
|
|
39214
39249
|
onUploadImage,
|
|
39215
39250
|
dualModeRequired,
|
|
39216
|
-
status
|
|
39251
|
+
status,
|
|
39252
|
+
onUploadImage2
|
|
39217
39253
|
}) {
|
|
39218
39254
|
const [value, setValue] = React$2.useState(0);
|
|
39219
39255
|
const [showZoom, setShowZoom] = React$2.useState(false);
|
|
@@ -39230,6 +39266,54 @@ function SideDocsSelector({
|
|
|
39230
39266
|
const toggleZoom = () => {
|
|
39231
39267
|
setShowZoom(!showZoom);
|
|
39232
39268
|
};
|
|
39269
|
+
const videoRef = useRef(null);
|
|
39270
|
+
const streamRef = useRef(null);
|
|
39271
|
+
const takeScreenshot = (side) => {
|
|
39272
|
+
const video = videoRef.current;
|
|
39273
|
+
if (!video)
|
|
39274
|
+
return;
|
|
39275
|
+
const canvas = document.createElement("canvas");
|
|
39276
|
+
canvas.width = video.videoWidth;
|
|
39277
|
+
canvas.height = video.videoHeight;
|
|
39278
|
+
const ctx = canvas.getContext("2d");
|
|
39279
|
+
ctx && ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
|
|
39280
|
+
const imageData = canvas.toDataURL("image/jpeg");
|
|
39281
|
+
onUploadImage2(side, imageData);
|
|
39282
|
+
};
|
|
39283
|
+
const handleTapToFocus = async () => {
|
|
39284
|
+
var _a;
|
|
39285
|
+
if (!streamRef.current)
|
|
39286
|
+
return;
|
|
39287
|
+
const [track] = streamRef.current.getVideoTracks();
|
|
39288
|
+
const capabilities = track.getCapabilities();
|
|
39289
|
+
track.getSettings();
|
|
39290
|
+
if (capabilities.focusMode && capabilities.focusMode.includes("manual")) {
|
|
39291
|
+
try {
|
|
39292
|
+
await track.applyConstraints({
|
|
39293
|
+
advanced: [{
|
|
39294
|
+
focusMode: "manual",
|
|
39295
|
+
focusDistance: (_a = capabilities.focusDistance) == null ? void 0 : _a.min
|
|
39296
|
+
}]
|
|
39297
|
+
});
|
|
39298
|
+
console.log("Enfoque manual aplicado");
|
|
39299
|
+
} catch (err) {
|
|
39300
|
+
console.error("Error al aplicar enfoque manual:", err);
|
|
39301
|
+
}
|
|
39302
|
+
} else if (capabilities.focusMode && capabilities.focusMode.includes("continuous")) {
|
|
39303
|
+
try {
|
|
39304
|
+
await track.applyConstraints({
|
|
39305
|
+
advanced: [{
|
|
39306
|
+
focusMode: "continuous"
|
|
39307
|
+
}]
|
|
39308
|
+
});
|
|
39309
|
+
console.log("Enfoque autom\xE1tico reiniciado");
|
|
39310
|
+
} catch (err) {
|
|
39311
|
+
console.error("Error al reiniciar enfoque autom\xE1tico:", err);
|
|
39312
|
+
}
|
|
39313
|
+
} else {
|
|
39314
|
+
console.warn("El dispositivo no permite controlar el enfoque");
|
|
39315
|
+
}
|
|
39316
|
+
};
|
|
39233
39317
|
return /* @__PURE__ */ jsxs(Box$1, {
|
|
39234
39318
|
sx: {
|
|
39235
39319
|
width: "100%"
|
|
@@ -39334,19 +39418,20 @@ function SideDocsSelector({
|
|
|
39334
39418
|
})
|
|
39335
39419
|
})]
|
|
39336
39420
|
})]
|
|
39337
|
-
}) : /* @__PURE__ */ jsx$1(
|
|
39421
|
+
}) : /* @__PURE__ */ jsx$1(UploadDocument2, {
|
|
39422
|
+
videoRef,
|
|
39423
|
+
streamRef,
|
|
39338
39424
|
setActivateCamera,
|
|
39339
39425
|
activateCamera,
|
|
39340
|
-
webcamRef,
|
|
39341
|
-
Webcam: Webcam2,
|
|
39342
39426
|
videoConstraints,
|
|
39343
39427
|
base64,
|
|
39344
|
-
detail: "Subir frontal del documento"
|
|
39428
|
+
detail: "Subir frontal del documento",
|
|
39429
|
+
onTapToFocus: handleTapToFocus
|
|
39345
39430
|
}), /* @__PURE__ */ jsxs(Box$1, {
|
|
39346
39431
|
width: "100%",
|
|
39347
39432
|
children: [activateCamera && /* @__PURE__ */ jsx$1(CustomButton, {
|
|
39348
39433
|
type: "button",
|
|
39349
|
-
onClick: () =>
|
|
39434
|
+
onClick: () => takeScreenshot("firstImage"),
|
|
39350
39435
|
children: "Capturar"
|
|
39351
39436
|
}), !status && Object.keys(base64).length > 0 && !activateCamera && lib$1(status) && (!dualModeRequired && base64.firstImage || dualModeRequired && base64.firstImage && base64.secondImage) && /* @__PURE__ */ jsx$1(CustomButton, {
|
|
39352
39437
|
type: "submit",
|
|
@@ -39439,19 +39524,20 @@ function SideDocsSelector({
|
|
|
39439
39524
|
})
|
|
39440
39525
|
})]
|
|
39441
39526
|
})]
|
|
39442
|
-
}) : /* @__PURE__ */ jsx$1(
|
|
39527
|
+
}) : /* @__PURE__ */ jsx$1(UploadDocument2, {
|
|
39528
|
+
videoRef,
|
|
39529
|
+
streamRef,
|
|
39443
39530
|
setActivateCamera,
|
|
39444
39531
|
activateCamera,
|
|
39445
|
-
webcamRef,
|
|
39446
|
-
Webcam: Webcam2,
|
|
39447
39532
|
videoConstraints,
|
|
39448
39533
|
base64,
|
|
39449
|
-
detail: "Subir reverso del documento"
|
|
39534
|
+
detail: "Subir reverso del documento",
|
|
39535
|
+
onTapToFocus: handleTapToFocus
|
|
39450
39536
|
}), /* @__PURE__ */ jsxs(Box$1, {
|
|
39451
39537
|
width: "100%",
|
|
39452
39538
|
children: [activateCamera && /* @__PURE__ */ jsx$1(CustomButton, {
|
|
39453
39539
|
type: "button",
|
|
39454
|
-
onClick: () =>
|
|
39540
|
+
onClick: () => takeScreenshot("secondImage"),
|
|
39455
39541
|
children: "Capturar"
|
|
39456
39542
|
}), !status && Object.keys(base64).length > 0 && !activateCamera && lib$1(status) && (!dualModeRequired && base64.secondImage && base64.firstImage || dualModeRequired && base64.firstImage && base64.secondImage) && /* @__PURE__ */ jsx$1(CustomButton, {
|
|
39457
39543
|
type: "submit",
|
|
@@ -39914,6 +40000,7 @@ function DocumentReader({
|
|
|
39914
40000
|
base64,
|
|
39915
40001
|
countryCode,
|
|
39916
40002
|
onUploadImage,
|
|
40003
|
+
onUploadImage2,
|
|
39917
40004
|
activateCamera,
|
|
39918
40005
|
setActivateCamera,
|
|
39919
40006
|
webcamRef,
|
|
@@ -39959,7 +40046,8 @@ function DocumentReader({
|
|
|
39959
40046
|
videoConstraints,
|
|
39960
40047
|
onUploadImage,
|
|
39961
40048
|
dualModeRequired,
|
|
39962
|
-
status
|
|
40049
|
+
status,
|
|
40050
|
+
onUploadImage2
|
|
39963
40051
|
})]
|
|
39964
40052
|
})
|
|
39965
40053
|
})]
|