@jaak.ai/stamps 2.1.0-dev.4 → 2.1.0-dev.6
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-webcomponent.cjs.js +1 -1
- package/dist/cjs/jaak-stamps.cjs.entry.js +9 -15
- package/dist/cjs/jaak-stamps.cjs.entry.js.map +1 -1
- package/dist/cjs/jaak-stamps.entry.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/my-component/my-component.js +11 -16
- package/dist/collection/components/my-component/my-component.js.map +1 -1
- package/dist/components/jaak-stamps.js +10 -15
- package/dist/components/jaak-stamps.js.map +1 -1
- package/dist/esm/jaak-stamps-webcomponent.js +1 -1
- package/dist/esm/jaak-stamps.entry.js +9 -15
- package/dist/esm/jaak-stamps.entry.js.map +1 -1
- package/dist/esm/loader.js +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-d05dc382.entry.js +2 -0
- package/dist/jaak-stamps-webcomponent/p-d05dc382.entry.js.map +1 -0
- package/dist/types/components/my-component/my-component.d.ts +2 -0
- package/package.json +1 -1
- package/dist/jaak-stamps-webcomponent/p-091d609b.entry.js +0 -2
- package/dist/jaak-stamps-webcomponent/p-091d609b.entry.js.map +0 -1
|
@@ -1149,6 +1149,7 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
|
|
|
1149
1149
|
showManualCaptureButton = false;
|
|
1150
1150
|
performanceDegradedMode = false; // Auto-switched to manual mode due to performance
|
|
1151
1151
|
showPerformanceMessage = false; // Show performance message temporarily
|
|
1152
|
+
captureStateVersion = 0; // Triggers re-render when StateManager changes
|
|
1152
1153
|
// Services
|
|
1153
1154
|
serviceContainer;
|
|
1154
1155
|
eventBus;
|
|
@@ -1354,6 +1355,9 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
|
|
|
1354
1355
|
this.updateMaskDimensions(rect);
|
|
1355
1356
|
}
|
|
1356
1357
|
}
|
|
1358
|
+
triggerRerender() {
|
|
1359
|
+
this.captureStateVersion = this.captureStateVersion + 1;
|
|
1360
|
+
}
|
|
1357
1361
|
getGuideText(step) {
|
|
1358
1362
|
if (step === 'completed') {
|
|
1359
1363
|
return 'Proceso completado';
|
|
@@ -1595,7 +1599,6 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
|
|
|
1595
1599
|
await this.detectionService.loadModel();
|
|
1596
1600
|
}
|
|
1597
1601
|
catch (modelError) {
|
|
1598
|
-
console.error('Error cargando modelo de detección:', modelError);
|
|
1599
1602
|
this.switchToManualModeWithError('Error al cargar modelo de detección');
|
|
1600
1603
|
throw modelError;
|
|
1601
1604
|
}
|
|
@@ -1604,7 +1607,6 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
|
|
|
1604
1607
|
await this.detectionService.loadClassificationModel();
|
|
1605
1608
|
}
|
|
1606
1609
|
catch (classificationError) {
|
|
1607
|
-
console.error('Error cargando modelo de clasificación:', classificationError);
|
|
1608
1610
|
this.switchToManualModeWithError('Error al cargar modelo de clasificación');
|
|
1609
1611
|
throw classificationError;
|
|
1610
1612
|
}
|
|
@@ -1728,7 +1730,6 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
|
|
|
1728
1730
|
await this.detectionService.loadModel();
|
|
1729
1731
|
}
|
|
1730
1732
|
catch (modelError) {
|
|
1731
|
-
console.error('Error cargando modelo de detección:', modelError);
|
|
1732
1733
|
this.switchToManualModeWithError('Error al cargar modelo de detección');
|
|
1733
1734
|
throw modelError;
|
|
1734
1735
|
}
|
|
@@ -1737,7 +1738,6 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
|
|
|
1737
1738
|
await this.detectionService.loadClassificationModel();
|
|
1738
1739
|
}
|
|
1739
1740
|
catch (classificationError) {
|
|
1740
|
-
console.error('Error cargando modelo de clasificación:', classificationError);
|
|
1741
1741
|
this.switchToManualModeWithError('Error al cargar modelo de clasificación');
|
|
1742
1742
|
throw classificationError;
|
|
1743
1743
|
}
|
|
@@ -1853,7 +1853,6 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
|
|
|
1853
1853
|
inputTensor = this.detectionService.preprocess(this.videoRef);
|
|
1854
1854
|
}
|
|
1855
1855
|
catch (preprocessError) {
|
|
1856
|
-
console.error('Error en preprocesamiento:', preprocessError);
|
|
1857
1856
|
this.switchToManualModeWithError('Error al procesar imagen');
|
|
1858
1857
|
return;
|
|
1859
1858
|
}
|
|
@@ -1863,7 +1862,6 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
|
|
|
1863
1862
|
inferenceTime = performance.now() - inferenceStartTime;
|
|
1864
1863
|
}
|
|
1865
1864
|
catch (inferenceError) {
|
|
1866
|
-
console.error('Error en inferencia ONNX:', inferenceError);
|
|
1867
1865
|
this.switchToManualModeWithError('Error en detección automática');
|
|
1868
1866
|
return;
|
|
1869
1867
|
}
|
|
@@ -1988,7 +1986,7 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
|
|
|
1988
1986
|
isCapturing: false
|
|
1989
1987
|
};
|
|
1990
1988
|
const cameraInfo = this.cameraInfoWithAutofocus;
|
|
1991
|
-
return (h("div", { key: '
|
|
1989
|
+
return (h("div", { key: '42958507f3463e8506bdd240b3f478f6e3bf1746', class: "detector-container" }, h("div", { key: '775a9c1df2075236c0b0bfe4a39eace38d099b09', class: "video-container" }, h("video", { key: '035d92f2c167087e95689dd7997ac20b8404ac1e', ref: el => this.videoRef = el, autoplay: true, muted: true, playsinline: true, class: this.shouldMirrorVideo ? 'mirror' : '', style: { display: captureState.isVideoActive ? 'block' : 'none' } }), h("div", { key: 'e7fee77cba28b3e4149319ce7998b06af5c4075c', 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: {
|
|
1992
1990
|
position: 'absolute',
|
|
1993
1991
|
left: `${box.x}px`,
|
|
1994
1992
|
top: `${box.y}px`,
|
|
@@ -1997,9 +1995,9 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
|
|
|
1997
1995
|
border: '2px solid #32406C',
|
|
1998
1996
|
pointerEvents: 'none',
|
|
1999
1997
|
boxSizing: 'border-box'
|
|
2000
|
-
} })))), this.isMaskReady && (h("div", { key: '
|
|
1998
|
+
} })))), this.isMaskReady && (h("div", { key: '3d7ab5706479922c4321953a18c0026f4be2ba07', class: "overlay-mask" }, h("div", { key: '410d98aa7ed52604760e12a1d8c8dc5a94a4e0d8', class: "card-outline" }, h("div", { key: 'b51b8b7df3ef5c5d3a9bfa43d704d06aef14b2cf', class: "side side-top" }), h("div", { key: 'e2c8f24094d2a9356248234c8a7a2d8aca07f3e6', class: "side side-right" }), h("div", { key: 'e4f92a79ac4c8af8d1e51e03d743b4814ffd2c00', class: "side side-bottom" }), h("div", { key: '400c294159a44f6211eb84a4e457b1406f541f44', class: "side side-left" })), !captureState.showFlipAnimation && !captureState.showSuccessAnimation && (h("div", { key: '69c4ed1c4d5bd21bdaf0795a49cf3dd9a59502f4', class: `guide-text ${this.showPerformanceMessage ? 'performance-warning-text' : ''}` }, this.getGuideText(captureState.step))), captureState.step === 'back' && !captureState.showFlipAnimation && !captureState.showSuccessAnimation && (h("div", { key: '92164199e91c9cbf40a94a87b0457e76c566e252', class: "back-capture-section" }, h("div", { key: '22ad40233923be0909529927779f09a6917895ee', class: "back-capture-buttons" }, (!this.useDocumentDetector || this.performanceDegradedMode) && (h("button", { key: '3c65c3bd5687d709a5f4d1c9fe2293cfd320f269', class: "capture-button primary-button", onClick: () => this.takeManualScreenshot(), type: "button", disabled: captureState.isCapturing }, captureState.isCapturing ? 'Capturando...' : 'Capturar Reverso')), h("button", { key: 'ad6cb7eb1ce70af2fb3d5a8d031801a850605baa', class: "skip-button", onClick: () => this.skipBackCapture(), type: "button" }, this.enableBackDocumentTimer && this.backDocumentTimerRemaining > 0
|
|
2001
1999
|
? `Saltar reverso (${this.backDocumentTimerRemaining}s)`
|
|
2002
|
-
: 'Saltar reverso')))), captureState.isVideoActive && (h("div", { key: '
|
|
2000
|
+
: 'Saltar reverso')))), captureState.isVideoActive && (h("div", { key: '9b87c7e4f5ab646ec35e5f81833a6c9e9ac5d5c8', class: "camera-controls" }, h("button", { key: 'c9c741f3885b56162de343b18efa8764f0c2c001', 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: 'b4f5c63464085c135dda068c929b147cfd84238f', class: "camera-selector-dropdown" }, h("div", { key: '06072cad9c132f1926b4070c0c3d714b76cc6636', class: "camera-selector-header" }, h("span", { key: '85a813b383f6cf1fd505239781d8a5ea60cbae58' }, "Seleccionar C\u00E1mara"), h("button", { key: 'c1588cea255bcf7151ca2e9d0583d149122784d7', class: "close-selector", onClick: () => this.toggleCameraSelector(), type: "button" }, "\u00D7")), h("div", { key: '62864eaea7aac898d27d8995fcede3788383918f', 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: '1288fb31a8f3290bf5a280390c52af5b1dce75b5', class: "device-info" }, h("small", { key: 'efdf5a337cd07fc14112d3bd883298cb586f67f5' }, "Dispositivo: ", cameraInfo.deviceType)))), this.showManualCaptureButton && captureState.step === 'front' && !captureState.showFlipAnimation && !captureState.showSuccessAnimation && (h("div", { key: '6b18401230001a923e139f3f2a704ac44b8f52f4', class: "manual-capture-section" }, h("button", { key: '8269121d4822b8d7cb01b966d3b701cc297b8856', class: "manual-capture-button", onClick: () => this.takeManualScreenshot(), type: "button", disabled: captureState.isCapturing }, captureState.isCapturing ? 'Capturando...' : 'Capturar Frente'))))), captureState.isCapturing && (h("div", { key: '8920362bb45d0f024149440a914a2144e16783b0', class: "capture-animation" })), captureState.showFlipAnimation && (h("div", { key: '644baeaf145477d31439e7f28a5c262064f4db95', class: "flip-animation" }, h("div", { key: '467c703d5ac600f12f7456e2c51bf0d1ec94a638', class: "id-card-icon" }), h("div", { key: '8f2cef3855202d959a6e7884f1d74d78e3ef66ac', class: "flip-text" }, "\u00A1Voltea tu identificaci\u00F3n!"))), captureState.showSuccessAnimation && (h("div", { key: '651898dc58e10886d0b4696f2036af7bf68640ef', class: "success-animation" }, h("div", { key: '7b3e1626aa02131af0f860dc5ea8c8f0e4d6655b', class: "check-icon" }), h("div", { key: '571dcad0d407c275dd4ceaa04d2de4bbed7a9181', class: "success-text" }, "\u00A1Proceso completado!"))), h("div", { key: 'f2efae53af3ca6a38735f7fb06708101a811e1fe', class: `component-status status-${this.currentStatus.type}` }, (this.currentStatus.type === 'loading' || this.currentStatus.type === 'initializing') && (h("div", { key: '6f9268bfcc01b305c2d415b2bbbd3197b228d487', class: "status-spinner" })), h("div", { key: '17f0f0c8c4debb57408d1bed95dd8a6c180affb5', class: "status-content" }, h("div", { key: '6af3696c54d05bea334c24fe7713e658ef1c9d3e', class: "status-message" }, this.currentStatus.message), this.currentStatus.description && (h("div", { key: '99d8fe46dd0c4e3f779c8d3a7fc6314b551f8424', class: "status-description" }, this.currentStatus.description)))), this.debug && (h("div", { key: '4b25e47a42a9f20713167c0f89f8adb07090a6e5', class: "performance-monitor" }, h("div", { key: 'b323c4cb466bfe50d105ea165d361b4240e97cbf', class: "performance-expanded" }, h("div", { key: '001d7d5cc4024162d24a9f46e2bc4b978ad0166b', class: "metrics-row" }, h("div", { key: 'd3f8281b92075b48f4fff22a6cbb020e98055f74', class: "metric-compact" }, h("span", { key: 'c140d8d5596ed3a3f176daf3e7a74bc12ef9fa56', class: "metric-label" }, "FPS"), h("span", { key: 'f88d7a211bc516757ef6842c5a9acb4bb9c3ff9b', class: `metric-value ${this.performanceData.fps < 15 ? 'warning' : this.performanceData.fps < 10 ? 'danger' : 'good'}` }, this.performanceData.fps)), h("div", { key: '6f4b8aac4f1f1f086d0038b42ddd12b4bdff15ea', class: "metric-compact" }, h("span", { key: '8a222b05e739012a67f98f73bbba0ba042420b08', class: "metric-label" }, "MEM"), h("span", { key: '1a2f785d57ba926900eca868b890c677ce0adafc', class: `metric-value ${this.performanceData.memoryUsage > 100 ? 'warning' : this.performanceData.memoryUsage > 200 ? 'danger' : 'good'}` }, this.performanceData.memoryUsage, "MB"))), h("div", { key: 'e2dc13638b3cffa1245ed6b1485d85982215a23d', class: "metrics-row" }, h("div", { key: '3356b3dc77e2c2adc33f0483b46958495ea963a6', class: "metric-compact" }, h("span", { key: '9d6a01153605f15dd13a46fc6de7e43bcec3c4d7', class: "metric-label" }, "INF"), h("span", { key: '6db223f93179706ab9f9d19807247f69dc2555bf', class: `metric-value ${this.performanceData.inferenceTime > 100 ? 'warning' : this.performanceData.inferenceTime > 200 ? 'danger' : 'good'}` }, this.performanceData.inferenceTime, "ms")), h("div", { key: '920f5f8a7d98d4c30644584ee4177b7f0b9d4ce6', class: "metric-compact" }, h("span", { key: 'e27e9a6410f9e9ccb789500e23a0a6140d5cc56e', class: "metric-label" }, "FRAME"), h("span", { key: 'e2229a1d7c05c6503a6aaf85951dfbdb93d8922f', class: `metric-value ${this.performanceData.frameProcessingTime > 50 ? 'warning' : this.performanceData.frameProcessingTime > 100 ? 'danger' : 'good'}` }, this.performanceData.frameProcessingTime, "ms"))), h("div", { key: '33bc285a3ece3bc0887249fc158f63a34fbd84fd', class: "metrics-row" }, h("div", { key: '9904884ea06b18561e6996fc996c8522f01138b8', class: "metric-compact" }, h("span", { key: 'df4bc26fe4af5e1203cbc1c82d104ac1c64a0d31', class: "metric-label" }, "DET"), h("span", { key: '760931f01f32761f80bedb579652018cedeb6edb', class: "metric-value good" }, this.performanceData.successfulDetections, "/", this.performanceData.totalDetections)), h("div", { key: '9f1e5b50979e54fdb58ade2df5e1a990b8ddd1a3', class: "metric-compact" }, h("span", { key: '698e460b3b7b13747cdc27743348c580eab337ad', class: "metric-label" }, "RATE"), h("span", { key: '466b3b790ce6d3c680bb7629592b67e57be3cee5', class: `metric-value ${this.performanceData.detectionRate < 30 ? 'danger' : this.performanceData.detectionRate < 60 ? 'warning' : 'good'}` }, this.performanceData.detectionRate, "%")))))), h("div", { key: '2c093210e7b929967b690c60cfc0943274db2409', class: "watermark" }, h("img", { key: '9e30dc6b9cd294e5dc3059ea98c61a45a50c4255', src: "https://storage.googleapis.com/jaak-static/commons/powered-by-jaak.png", alt: "Powered by Jaak" })))));
|
|
2003
2001
|
}
|
|
2004
2002
|
// Utility methods
|
|
2005
2003
|
updateDetectionBoxes(boxes) {
|
|
@@ -2197,7 +2195,6 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
|
|
|
2197
2195
|
}
|
|
2198
2196
|
}
|
|
2199
2197
|
catch (classifyError) {
|
|
2200
|
-
console.error('Error clasificando documento:', classifyError);
|
|
2201
2198
|
// No cambiar a manual aquí, solo registrar el error y continuar
|
|
2202
2199
|
}
|
|
2203
2200
|
}
|
|
@@ -2206,11 +2203,13 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
|
|
|
2206
2203
|
isDetectionPaused: true,
|
|
2207
2204
|
showFlipAnimation: true
|
|
2208
2205
|
});
|
|
2206
|
+
this.triggerRerender();
|
|
2209
2207
|
setTimeout(() => {
|
|
2210
2208
|
this.stateManager.updateCaptureState({
|
|
2211
2209
|
showFlipAnimation: false,
|
|
2212
2210
|
isDetectionPaused: false
|
|
2213
2211
|
});
|
|
2212
|
+
this.triggerRerender();
|
|
2214
2213
|
this.startBackDocumentTimer();
|
|
2215
2214
|
}, 3000);
|
|
2216
2215
|
}
|
|
@@ -2268,7 +2267,6 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
|
|
|
2268
2267
|
}
|
|
2269
2268
|
}
|
|
2270
2269
|
catch (classifyError) {
|
|
2271
|
-
console.error('Error clasificando documento:', classifyError);
|
|
2272
2270
|
// No cambiar a manual aquí, solo registrar el error y continuar
|
|
2273
2271
|
}
|
|
2274
2272
|
}
|
|
@@ -2327,7 +2325,6 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
|
|
|
2327
2325
|
}
|
|
2328
2326
|
// Método para cambiar a modo manual por errores de ONNX
|
|
2329
2327
|
switchToManualModeWithError(errorMessage) {
|
|
2330
|
-
console.error(`[ONNX Error] ${errorMessage}`);
|
|
2331
2328
|
// Solo cambiar si el detector está habilitado y no se ha cambiado ya
|
|
2332
2329
|
if (!this.useDocumentDetector || this.hasAutoSwitchedToManual) {
|
|
2333
2330
|
return;
|
|
@@ -2352,16 +2349,13 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
|
|
|
2352
2349
|
}
|
|
2353
2350
|
// Método para liberar recursos de ONNX cuando se cambia a modo manual
|
|
2354
2351
|
releaseOnnxResources() {
|
|
2355
|
-
console.log('[ONNX] Liberando recursos de modelos ONNX...');
|
|
2356
2352
|
try {
|
|
2357
2353
|
// Liberar recursos del servicio de detección
|
|
2358
2354
|
if (this.detectionService) {
|
|
2359
2355
|
this.detectionService.cleanup();
|
|
2360
|
-
console.log('[ONNX] Recursos de ONNX liberados exitosamente');
|
|
2361
2356
|
}
|
|
2362
2357
|
}
|
|
2363
2358
|
catch (error) {
|
|
2364
|
-
console.error('[ONNX] Error al liberar recursos:', error);
|
|
2365
2359
|
}
|
|
2366
2360
|
}
|
|
2367
2361
|
completeProcess(skippedBack = false) {
|
|
@@ -2643,6 +2637,7 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
|
|
|
2643
2637
|
"showManualCaptureButton": [32],
|
|
2644
2638
|
"performanceDegradedMode": [32],
|
|
2645
2639
|
"showPerformanceMessage": [32],
|
|
2640
|
+
"captureStateVersion": [32],
|
|
2646
2641
|
"getCapturedImages": [64],
|
|
2647
2642
|
"isProcessCompleted": [64],
|
|
2648
2643
|
"startCapture": [64],
|