@jaak.ai/stamps 2.1.0-beta.1 → 2.1.0-beta.2
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/cjs/jaak-stamps.cjs.entry.js +109 -18
- package/dist/cjs/jaak-stamps.cjs.entry.js.map +1 -1
- package/dist/cjs/jaak-stamps.entry.cjs.js.map +1 -1
- package/dist/collection/components/my-component/my-component.js +25 -16
- package/dist/collection/components/my-component/my-component.js.map +1 -1
- package/dist/collection/services/CameraService.js +84 -2
- package/dist/collection/services/CameraService.js.map +1 -1
- package/dist/components/jaak-stamps.js +109 -18
- package/dist/components/jaak-stamps.js.map +1 -1
- package/dist/esm/jaak-stamps.entry.js +109 -18
- package/dist/esm/jaak-stamps.entry.js.map +1 -1
- package/dist/jaak-stamps-webcomponent/jaak-stamps-webcomponent.esm.js +1 -1
- package/dist/jaak-stamps-webcomponent/jaak-stamps.entry.esm.js.map +1 -1
- package/dist/jaak-stamps-webcomponent/p-c06e5d7b.entry.js +2 -0
- package/dist/jaak-stamps-webcomponent/p-c06e5d7b.entry.js.map +1 -0
- package/dist/types/services/CameraService.d.ts +1 -0
- package/package.json +1 -1
- package/dist/jaak-stamps-webcomponent/p-a76ae84d.entry.js +0 -2
- package/dist/jaak-stamps-webcomponent/p-a76ae84d.entry.js.map +0 -1
|
@@ -175,7 +175,7 @@ export class JaakStamps {
|
|
|
175
175
|
if (!window.ort) {
|
|
176
176
|
this.updateStatus('Preparando herramientas...', 'Configurando funciones de captura', 'initializing');
|
|
177
177
|
const script = document.createElement('script');
|
|
178
|
-
script.src = 'https://cdn.jsdelivr.net/npm/onnxruntime-web/dist/ort.min.js';
|
|
178
|
+
script.src = 'https://cdn.jsdelivr.net/npm/onnxruntime-web@1.23.0/dist/ort.min.js';
|
|
179
179
|
document.head.appendChild(script);
|
|
180
180
|
await new Promise((resolve) => {
|
|
181
181
|
script.onload = () => {
|
|
@@ -983,7 +983,7 @@ export class JaakStamps {
|
|
|
983
983
|
isCapturing: false
|
|
984
984
|
};
|
|
985
985
|
const cameraInfo = this.cameraInfoWithAutofocus;
|
|
986
|
-
return (h("div", { key: '
|
|
986
|
+
return (h("div", { key: 'f9cbca2fd6b8548a29ace7fcb972b53f402f61af', class: "detector-container" }, h("div", { key: '4f3cac734eb6bfd44a8de644eadca17e7893e11a', class: "video-container" }, h("video", { key: '5e15a38c989a72d5274281272d41ba064447ca6f', ref: el => this.videoRef = el, autoplay: true, muted: true, playsinline: true, class: this.shouldMirrorVideo ? 'mirror' : '', style: { display: captureState.isVideoActive ? 'block' : 'none' } }), h("div", { key: '38c8ad8b691db60e9b5a2a8b641fe6febbeacfca', ref: el => this.detectionContainer = el, class: `detection-overlay ${this.shouldMirrorVideo ? 'mirror' : ''}` }, this.debug && this.detectionBoxes.map((box, index) => (h("div", { key: index, class: "detection-box", style: {
|
|
987
987
|
position: 'absolute',
|
|
988
988
|
left: `${box.x}px`,
|
|
989
989
|
top: `${box.y}px`,
|
|
@@ -992,9 +992,9 @@ export class JaakStamps {
|
|
|
992
992
|
border: '2px solid #32406C',
|
|
993
993
|
pointerEvents: 'none',
|
|
994
994
|
boxSizing: 'border-box'
|
|
995
|
-
} })))), this.isMaskReady && (h("div", { key: '
|
|
995
|
+
} })))), this.isMaskReady && (h("div", { key: 'c56fde56b7a86a4e8a4cf558745291ea5cde12fd', class: "overlay-mask" }, h("div", { key: '04ed3f01f271dc84eed594cb4b60c2453645bd41', class: "card-outline" }, h("div", { key: '648bd423a5e886d4768115237de5896c7223b30b', class: "side side-top" }), h("div", { key: 'b8878059493ca61961b9b3c82ecc18b50b79ac85', class: "side side-right" }), h("div", { key: '09e5ad64ff33dbd5c112bf52b71e14409ab6aa65', class: "side side-bottom" }), h("div", { key: 'b8ba3d83c9bc1b4a0da859d7ed4b9a15eaddcc2a', class: "side side-left" })), !captureState.showFlipAnimation && !captureState.showSuccessAnimation && (h("div", { key: '3279701a240f77ac96e68a34ad95c099340c9a6a', class: `guide-text ${this.showPerformanceMessage ? 'performance-warning-text' : ''}` }, this.getGuideText(captureState.step))), captureState.step === 'back' && !captureState.showFlipAnimation && !captureState.showSuccessAnimation && (h("div", { key: '2adf96d0a57e482372fd9586229dac2301b64fd4', class: "back-capture-section" }, h("div", { key: '305a147c9cfee854c60ac946a48a1d21b2792725', class: "back-capture-buttons" }, (!this.useDocumentDetector || this.performanceDegradedMode || this.showManualCaptureButton) && (h("button", { key: '43270a0647f39307229c540dd5130fb58b1ff4fb', class: "capture-button primary-button", onClick: () => this.takeManualScreenshot(), type: "button", disabled: this.processingButton !== null }, this.processingButton === 'capture-back' && (h("span", { key: 'eb4666603774564eef95a120ac13faeb9e10c8b4', class: "button-spinner" })), "Capturar Reverso")), h("button", { key: 'cac667d9548ae2314ad5a677c5ed90f25184f728', class: "skip-button", onClick: () => this.skipBackCapture(), type: "button", disabled: this.processingButton !== null }, this.processingButton === 'skip-back' && (h("span", { key: '0af7aa4106ce189ae2d79bec78ede01abe25b1e7', class: "button-spinner" })), this.enableBackDocumentTimer && this.backDocumentTimerRemaining > 0
|
|
996
996
|
? `Saltar reverso (${this.backDocumentTimerRemaining}s)`
|
|
997
|
-
: 'Saltar reverso')))), captureState.isVideoActive && (h("div", { key: '
|
|
997
|
+
: 'Saltar reverso')))), captureState.isVideoActive && (h("div", { key: 'de6e5c4fad4d4d996b894457c9af52bc71e533fb', class: "camera-controls" }, h("button", { key: 'cfddcf2420d5f5923a6b02ca446bbe1b8e9fc5e4', class: `camera-selector-button ${this.isSwitchingCamera ? 'loading' : ''}`, onClick: () => this.toggleCameraSelector(), type: "button", title: "Seleccionar c\u00E1mara", disabled: this.isSwitchingCamera }, this.isSwitchingCamera ? (h("div", { class: "button-spinner" })) : ('Cámaras')))), this.showCameraSelector && cameraInfo.availableCameras.length > 0 && (h("div", { key: '5fb73f958b9a5a6f9242032c4530b0bdab84f6c5', class: "camera-selector-dropdown" }, h("div", { key: '8ee2d26b1001e571e7b6c326e927926fa08287fd', class: "camera-selector-header" }, h("span", { key: '78350b0fb1bd933f7c8c59d8dab0b7122ffbe363' }, "Seleccionar C\u00E1mara"), h("button", { key: 'bb750e0ddd5a1ee5ff96bd57805a7f90b8821e9f', class: "close-selector", onClick: () => this.toggleCameraSelector(), type: "button" }, "\u00D7")), h("div", { key: 'd0f6343cf1b7367f3da33ec8cf64891109d923b8', class: "camera-list" }, cameraInfo.availableCameras.map((camera) => (h("button", { key: camera.id, class: `camera-option ${cameraInfo.selectedCameraId === camera.id ? 'selected' : ''}`, onClick: () => this.handleCameraSwitch(camera.id), type: "button" }, h("span", { class: "camera-label" }, camera.label || `Cámara ${cameraInfo.availableCameras.indexOf(camera) + 1}`, camera.hasAutofocus && (h("span", { class: "autofocus-icon", title: "Autofoco disponible" }, "\u29BF"))), cameraInfo.selectedCameraId === camera.id && (h("span", { class: "selected-indicator" }, "\u2713")))))), h("div", { key: 'c9642fbfb0acea766d3f0542f4cc9f17f4af4d7b', class: "device-info" }, h("small", { key: 'b6e9507ff7addf011f339f6c22a88a96b40db68a' }, "Dispositivo: ", cameraInfo.deviceType)))), this.showManualCaptureButton && captureState.step === 'front' && !captureState.showFlipAnimation && !captureState.showSuccessAnimation && (h("div", { key: '04ae9262409284782850b90945eb7038673e2097', class: "manual-capture-section" }, h("button", { key: '27c315e503ccba468b89ebd58d6b70f40ddd06ba', class: "manual-capture-button", onClick: () => this.takeManualScreenshot(), type: "button", disabled: this.processingButton !== null }, this.processingButton === 'capture-front' && (h("span", { key: '8f2dcd2df9a218b37eb0b8204a8724362cfeaa53', class: "button-spinner" })), "Capturar Frente"))))), captureState.isCapturing && (h("div", { key: '6fd6fe1d0213b01c8119a67fb8108f73227feee1', class: "capture-animation" })), captureState.showFlipAnimation && (h("div", { key: 'fba3816b48b99ca64510ecbefc0d41431569c9ae', class: "flip-animation" }, h("div", { key: 'beea1c8245b5d81f1008efc6d1b079a61c821e7f', class: "id-card-icon" }), h("div", { key: 'f0fbc34f619a653e2c0ade764ca99e7aa582d157', class: "flip-text" }, "\u00A1Voltea tu identificaci\u00F3n!"))), captureState.showSuccessAnimation && (h("div", { key: 'e4a0e6d31112e3a50024d1d0430b4ad997049fe7', class: "success-animation" }, h("div", { key: '5dd3f781f55630bc904c81207548ae35bc79b452', class: "check-icon" }), h("div", { key: 'a10ebc557582325091efb0abd12d62b27a43b98c', class: "success-text" }, "\u00A1Proceso completado!"))), h("div", { key: '975865955dee1803b5215ecf049701c98b324855', class: `component-status status-${this.currentStatus.type}` }, (this.currentStatus.type === 'loading' || this.currentStatus.type === 'initializing') && (h("div", { key: '84f6f67202e26ce80f7fc5d5f321e23b5bc55c57', class: "status-spinner" })), h("div", { key: 'a1ae56ed156e8feb279a1bf160f749c5d0b5ce45', class: "status-content" }, h("div", { key: 'd62932554cea257ce19763df26e0ba702e50eeca', class: "status-message" }, this.currentStatus.message), this.currentStatus.description && (h("div", { key: 'c5506fa12dd0d37d26dc26c9f2381c843330451f', class: "status-description" }, this.currentStatus.description)))), this.debug && (h("div", { key: '2097eda63185f336f7319014fae2ef6db1e41761', class: "performance-monitor" }, h("div", { key: 'd611c494c6b1a5930ef64aebdcba41e5d94c9ee6', class: "performance-expanded" }, h("div", { key: '800d46831e7b9bec260d9c5e67ea1a3eb9c2933e', class: "metrics-row" }, h("div", { key: 'dd0db1faa9050d98e71da4b5cd26a4a484c37c64', class: "metric-compact" }, h("span", { key: 'f0e6ea61a35ddb2ae5c2a6aff8c255a02c5c1219', class: "metric-label" }, "FPS"), h("span", { key: 'cbf4df4d142f6f01e45f566a8ede8fbbf29ad673', class: `metric-value ${this.performanceData.fps < 15 ? 'warning' : this.performanceData.fps < 10 ? 'danger' : 'good'}` }, this.performanceData.fps)), h("div", { key: '83861ad31fa46c8199a5583e4b3f8eefd44bacd6', class: "metric-compact" }, h("span", { key: '41b8de4cda47959dfc9df393e95fdadde534dd21', class: "metric-label" }, "MEM"), h("span", { key: 'b268f13cc78066e240ed158f1443113a94827aff', class: `metric-value ${this.performanceData.memoryUsage > 100 ? 'warning' : this.performanceData.memoryUsage > 200 ? 'danger' : 'good'}` }, this.performanceData.memoryUsage, "MB"))), h("div", { key: '9f9a9d0690906b186492af23b900c5fa0f5cff89', class: "metrics-row" }, h("div", { key: '84fa6e453dc36e4a74e8b573447b17230766229e', class: "metric-compact" }, h("span", { key: 'f17d52899090c89f532d74c552dd8c5338fc2d83', class: "metric-label" }, "INF"), h("span", { key: '2beca0d7ce55ed574f6b01efc086c5846983e024', class: `metric-value ${this.performanceData.inferenceTime > 100 ? 'warning' : this.performanceData.inferenceTime > 200 ? 'danger' : 'good'}` }, this.performanceData.inferenceTime, "ms")), h("div", { key: '981e300cf076e81bfe946974f6cffd63619eacde', class: "metric-compact" }, h("span", { key: '3dfb0c996a69eb87b0f711322675cad69c471146', class: "metric-label" }, "FRAME"), h("span", { key: '3ae2ac6e90cda77f23e559f3197c3b761f9bdc40', class: `metric-value ${this.performanceData.frameProcessingTime > 50 ? 'warning' : this.performanceData.frameProcessingTime > 100 ? 'danger' : 'good'}` }, this.performanceData.frameProcessingTime, "ms"))), h("div", { key: '2c51216838d87728d9d7764e5ba8a50fa02eb493', class: "metrics-row" }, h("div", { key: 'eda810ffb80ec38ab84583f59b26706f90a50fc9', class: "metric-compact" }, h("span", { key: '978ba9c0c67d6da6b29b3535af33a314bab9276a', class: "metric-label" }, "DET"), h("span", { key: '3e5e169fd4a3906283d8f918b5bbc7c5df6ccd0f', class: "metric-value good" }, this.performanceData.successfulDetections, "/", this.performanceData.totalDetections)), h("div", { key: 'b4b915c745e35c09470a4dc5edfc112d32cfb8b6', class: "metric-compact" }, h("span", { key: '3e2a7b88a4446813c955efb0dfa9e2958e8e1448', class: "metric-label" }, "RATE"), h("span", { key: 'f4f073f7ee622167a241c6a1c535ef580c13d9ab', class: `metric-value ${this.performanceData.detectionRate < 30 ? 'danger' : this.performanceData.detectionRate < 60 ? 'warning' : 'good'}` }, this.performanceData.detectionRate, "%")))))), h("div", { key: '76c556e92f6d7980539f1a30efe8751f665164fb', class: "watermark" }, h("img", { key: 'af23e115d6b4e92a72e55d6d98fde0e4b1d09e9b', src: "https://storage.googleapis.com/jaak-static/commons/powered-by-jaak.png", alt: "Powered by Jaak" })))));
|
|
998
998
|
}
|
|
999
999
|
// Utility methods
|
|
1000
1000
|
updateDetectionBoxes(boxes) {
|
|
@@ -1191,8 +1191,8 @@ export class JaakStamps {
|
|
|
1191
1191
|
if (captureState.step === 'front') {
|
|
1192
1192
|
this.stateManager.setCapturedImages({
|
|
1193
1193
|
front: {
|
|
1194
|
-
fullFrame: captureCanvas.toDataURL('image/
|
|
1195
|
-
cropped: croppedCanvas.toDataURL('image/
|
|
1194
|
+
fullFrame: captureCanvas.toDataURL('image/jpeg'),
|
|
1195
|
+
cropped: croppedCanvas.toDataURL('image/jpeg')
|
|
1196
1196
|
}
|
|
1197
1197
|
});
|
|
1198
1198
|
// Check if document classification is enabled (independent of detector)
|
|
@@ -1232,8 +1232,8 @@ export class JaakStamps {
|
|
|
1232
1232
|
else if (captureState.step === 'back') {
|
|
1233
1233
|
this.stateManager.setCapturedImages({
|
|
1234
1234
|
back: {
|
|
1235
|
-
fullFrame: captureCanvas.toDataURL('image/
|
|
1236
|
-
cropped: croppedCanvas.toDataURL('image/
|
|
1235
|
+
fullFrame: captureCanvas.toDataURL('image/jpeg'),
|
|
1236
|
+
cropped: croppedCanvas.toDataURL('image/jpeg')
|
|
1237
1237
|
}
|
|
1238
1238
|
});
|
|
1239
1239
|
this.completeProcess(false);
|
|
@@ -1271,8 +1271,8 @@ export class JaakStamps {
|
|
|
1271
1271
|
if (captureState.step === 'front') {
|
|
1272
1272
|
this.stateManager.setCapturedImages({
|
|
1273
1273
|
front: {
|
|
1274
|
-
fullFrame: captureCanvas.toDataURL('image/
|
|
1275
|
-
cropped: croppedCanvas.toDataURL('image/
|
|
1274
|
+
fullFrame: captureCanvas.toDataURL('image/jpeg'),
|
|
1275
|
+
cropped: croppedCanvas.toDataURL('image/jpeg')
|
|
1276
1276
|
}
|
|
1277
1277
|
});
|
|
1278
1278
|
// Check if document classification is enabled
|
|
@@ -1304,8 +1304,8 @@ export class JaakStamps {
|
|
|
1304
1304
|
else if (captureState.step === 'back') {
|
|
1305
1305
|
this.stateManager.setCapturedImages({
|
|
1306
1306
|
back: {
|
|
1307
|
-
fullFrame: captureCanvas.toDataURL('image/
|
|
1308
|
-
cropped: croppedCanvas.toDataURL('image/
|
|
1307
|
+
fullFrame: captureCanvas.toDataURL('image/jpeg'),
|
|
1308
|
+
cropped: croppedCanvas.toDataURL('image/jpeg')
|
|
1309
1309
|
}
|
|
1310
1310
|
});
|
|
1311
1311
|
this.completeProcess(false);
|
|
@@ -1431,10 +1431,13 @@ export class JaakStamps {
|
|
|
1431
1431
|
this.useDocumentDetector = false; // Desactivar detector automático
|
|
1432
1432
|
// Actualizar el estado con mensaje de error
|
|
1433
1433
|
this.updateStatus('Modo manual activado', errorMessage, 'error');
|
|
1434
|
-
//
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1434
|
+
// Continuar con la configuración de cámara para mostrar el video
|
|
1435
|
+
this.continueWithCameraSetup().catch(() => {
|
|
1436
|
+
// Si falla la configuración de cámara, mantener el mensaje de error pero cambiar el estado
|
|
1437
|
+
setTimeout(() => {
|
|
1438
|
+
this.updateStatus('Captura manual', 'Use el botón para capturar', 'ready');
|
|
1439
|
+
}, 5000);
|
|
1440
|
+
});
|
|
1438
1441
|
}
|
|
1439
1442
|
stopPerformanceMonitoring() {
|
|
1440
1443
|
// Nota: No necesitamos limpiar más variables porque ya no se usarán
|
|
@@ -1521,6 +1524,12 @@ export class JaakStamps {
|
|
|
1521
1524
|
try {
|
|
1522
1525
|
// Close the selector immediately when user selects a camera
|
|
1523
1526
|
this.showCameraSelector = false;
|
|
1527
|
+
// Check if user selected the same camera that's already active
|
|
1528
|
+
const currentCameraId = this.cameraService.getSelectedCameraId();
|
|
1529
|
+
if (currentCameraId === cameraId) {
|
|
1530
|
+
// Same camera selected, just close the selector without switching
|
|
1531
|
+
return;
|
|
1532
|
+
}
|
|
1524
1533
|
this.isSwitchingCamera = true;
|
|
1525
1534
|
// Stop current video stream
|
|
1526
1535
|
if (this.videoStream) {
|