datakeen-session-react 1.1.202-dev.1 → 1.1.202
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/components/document-collection/DocumentCollection.js +2 -2
- package/dist/cjs/components/id-check/Photo.js +36 -42
- package/dist/cjs/components/session/DocumentCheck.js +2 -2
- package/dist/cjs/i18n/en.json.js +0 -10
- package/dist/cjs/i18n/es.json.js +0 -10
- package/dist/cjs/i18n/fr.json.js +0 -10
- package/dist/cjs/index.css.js +1 -1
- package/dist/cjs/services/cameraService.js +23 -44
- package/dist/cjs/services/sessionService.js +6 -16
- package/dist/esm/components/document-collection/DocumentCollection.js +2 -2
- package/dist/esm/components/id-check/Photo.js +36 -42
- package/dist/esm/components/session/DocumentCheck.js +2 -2
- package/dist/esm/i18n/en.json.js +0 -10
- package/dist/esm/i18n/es.json.js +0 -10
- package/dist/esm/i18n/fr.json.js +0 -10
- package/dist/esm/index.css.js +1 -1
- package/dist/esm/services/cameraService.js +23 -44
- package/dist/esm/services/sessionService.js +7 -16
- package/package.json +1 -1
- package/dist/cjs/utils/cameraResolution.js +0 -12
- package/dist/esm/utils/cameraResolution.js +0 -9
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var tslib_es6 = require('../node_modules/tslib/tslib.es6.js');
|
|
4
|
-
var cameraResolution = require('../utils/cameraResolution.js');
|
|
5
4
|
var professionalImageQuality = require('./professionalImageQuality.js');
|
|
6
5
|
|
|
7
6
|
// Permit to enable development mode to test without a camera
|
|
@@ -124,18 +123,18 @@ var CameraService = /** @class */ (function () {
|
|
|
124
123
|
};
|
|
125
124
|
CameraService.prototype._doStartCamera = function (videoElement, options) {
|
|
126
125
|
return tslib_es6.__awaiter(this, void 0, void 0, function () {
|
|
127
|
-
var facingMode, preferImageCapture, desiredWidth, desiredHeight, videoConstraints, stream,
|
|
128
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m
|
|
129
|
-
return tslib_es6.__generator(this, function (
|
|
130
|
-
switch (
|
|
126
|
+
var facingMode, preferImageCapture, desiredWidth, desiredHeight, videoConstraints, stream, err_2, errorMessage;
|
|
127
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
128
|
+
return tslib_es6.__generator(this, function (_o) {
|
|
129
|
+
switch (_o.label) {
|
|
131
130
|
case 0:
|
|
132
131
|
facingMode = (_b = options.facingMode) !== null && _b !== void 0 ? _b : "environment";
|
|
133
132
|
preferImageCapture = (_c = options.preferImageCapture) !== null && _c !== void 0 ? _c : true;
|
|
134
133
|
desiredWidth = (_e = (_d = options.idealResolution) === null || _d === void 0 ? void 0 : _d.width) !== null && _e !== void 0 ? _e : DEFAULT_RESOLUTION.width;
|
|
135
134
|
desiredHeight = (_g = (_f = options.idealResolution) === null || _f === void 0 ? void 0 : _f.height) !== null && _g !== void 0 ? _g : DEFAULT_RESOLUTION.height;
|
|
136
|
-
|
|
135
|
+
_o.label = 1;
|
|
137
136
|
case 1:
|
|
138
|
-
|
|
137
|
+
_o.trys.push([1, 8, , 9]);
|
|
139
138
|
// Close any existing stream before opening a new one
|
|
140
139
|
if (this.stream) {
|
|
141
140
|
this.stream.getTracks().forEach(function (t) { return t.stop(); });
|
|
@@ -158,45 +157,28 @@ var CameraService = /** @class */ (function () {
|
|
|
158
157
|
video: videoConstraints,
|
|
159
158
|
})];
|
|
160
159
|
case 2:
|
|
161
|
-
stream =
|
|
160
|
+
stream = _o.sent();
|
|
162
161
|
this.stream = stream;
|
|
163
162
|
this.videoTrack = (_j = stream.getVideoTracks()[0]) !== null && _j !== void 0 ? _j : null;
|
|
164
163
|
this.lastTrackSettings = (_l = (_k = this.videoTrack) === null || _k === void 0 ? void 0 : _k.getSettings()) !== null && _l !== void 0 ? _l : null;
|
|
165
|
-
retriedWithHd = false;
|
|
166
|
-
if (!(cameraResolution.isBelowHd((_m = this.lastTrackSettings) !== null && _m !== void 0 ? _m : undefined) && desiredWidth / desiredHeight !== 16 / 9)) return [3 /*break*/, 4];
|
|
167
|
-
retriedWithHd = true;
|
|
168
|
-
stream.getTracks().forEach(function (track) { return track.stop(); });
|
|
169
|
-
this.stream = null;
|
|
170
|
-
this.videoTrack = null;
|
|
171
|
-
this.lastTrackSettings = null;
|
|
172
|
-
return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
|
|
173
|
-
video: tslib_es6.__assign(tslib_es6.__assign({}, videoConstraints), { width: { ideal: 1920 }, height: { ideal: 1080 } }),
|
|
174
|
-
})];
|
|
175
|
-
case 3:
|
|
176
|
-
stream = _t.sent();
|
|
177
|
-
this.stream = stream;
|
|
178
|
-
this.videoTrack = (_o = stream.getVideoTracks()[0]) !== null && _o !== void 0 ? _o : null;
|
|
179
|
-
this.lastTrackSettings = (_q = (_p = this.videoTrack) === null || _p === void 0 ? void 0 : _p.getSettings()) !== null && _q !== void 0 ? _q : null;
|
|
180
|
-
_t.label = 4;
|
|
181
|
-
case 4:
|
|
182
164
|
console.debug("[CameraService] Camera opened", {
|
|
183
165
|
desired: { width: desiredWidth, height: desiredHeight },
|
|
184
166
|
actual: this.lastTrackSettings,
|
|
185
167
|
});
|
|
186
|
-
if (!this.videoTrack) return [3 /*break*/,
|
|
187
|
-
|
|
188
|
-
case
|
|
189
|
-
|
|
168
|
+
if (!this.videoTrack) return [3 /*break*/, 6];
|
|
169
|
+
_o.label = 3;
|
|
170
|
+
case 3:
|
|
171
|
+
_o.trys.push([3, 5, , 6]);
|
|
190
172
|
return [4 /*yield*/, this.videoTrack.applyConstraints({
|
|
191
173
|
advanced: [{ focusMode: "continuous" }],
|
|
192
174
|
})];
|
|
175
|
+
case 4:
|
|
176
|
+
_o.sent();
|
|
177
|
+
return [3 /*break*/, 6];
|
|
178
|
+
case 5:
|
|
179
|
+
_o.sent();
|
|
180
|
+
return [3 /*break*/, 6];
|
|
193
181
|
case 6:
|
|
194
|
-
_t.sent();
|
|
195
|
-
return [3 /*break*/, 8];
|
|
196
|
-
case 7:
|
|
197
|
-
_t.sent();
|
|
198
|
-
return [3 /*break*/, 8];
|
|
199
|
-
case 8:
|
|
200
182
|
if (supportsImageCapture() && this.videoTrack && preferImageCapture) {
|
|
201
183
|
try {
|
|
202
184
|
this.imageCapture = new ImageCapture(this.videoTrack);
|
|
@@ -214,18 +196,15 @@ var CameraService = /** @class */ (function () {
|
|
|
214
196
|
}
|
|
215
197
|
videoElement.srcObject = stream;
|
|
216
198
|
return [4 /*yield*/, this.waitForVideoReady(videoElement)];
|
|
217
|
-
case
|
|
218
|
-
|
|
199
|
+
case 7:
|
|
200
|
+
_o.sent();
|
|
219
201
|
return [2 /*return*/, {
|
|
220
202
|
success: true,
|
|
221
|
-
settings: (
|
|
203
|
+
settings: (_m = this.lastTrackSettings) !== null && _m !== void 0 ? _m : undefined,
|
|
222
204
|
captureMethod: this.captureMethod,
|
|
223
|
-
requested: { w: desiredWidth, h: desiredHeight },
|
|
224
|
-
retriedWithHd: retriedWithHd,
|
|
225
|
-
label: (_s = this.videoTrack) === null || _s === void 0 ? void 0 : _s.label,
|
|
226
205
|
}];
|
|
227
|
-
case
|
|
228
|
-
err_2 =
|
|
206
|
+
case 8:
|
|
207
|
+
err_2 = _o.sent();
|
|
229
208
|
console.error("Erreur lors de l'accès à la caméra:", err_2);
|
|
230
209
|
errorMessage = "Une erreur inconnue s'est produite lors de l'accès à la caméra.";
|
|
231
210
|
if (err_2 instanceof DOMException) {
|
|
@@ -241,7 +220,7 @@ var CameraService = /** @class */ (function () {
|
|
|
241
220
|
}
|
|
242
221
|
}
|
|
243
222
|
return [2 /*return*/, { success: false, error: errorMessage }];
|
|
244
|
-
case
|
|
223
|
+
case 9: return [2 /*return*/];
|
|
245
224
|
}
|
|
246
225
|
});
|
|
247
226
|
});
|
|
@@ -5,21 +5,12 @@ var api = require('./api.js');
|
|
|
5
5
|
var auditTrailService = require('./auditTrailService.js');
|
|
6
6
|
var sessionMemoryStore = require('./sessionMemoryStore.js');
|
|
7
7
|
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
case 0: return [4 /*yield*/, api.apiService.patch("/session/sdk/".concat(sessionId), { captureDiagnostics: (_a = {}, _a[nodeId] = diag, _a) })];
|
|
15
|
-
case 1:
|
|
16
|
-
_b.sent();
|
|
17
|
-
return [2 /*return*/];
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
/** Fetches session data by ID from the Datakeen backend. */
|
|
8
|
+
/**
|
|
9
|
+
* Fetches session data by ID from the Datakeen backend
|
|
10
|
+
*
|
|
11
|
+
* @param sessionId - The unique identifier of the session
|
|
12
|
+
* @returns The session data
|
|
13
|
+
*/
|
|
23
14
|
var fetchSessionById = function (sessionId) { return tslib_es6.__awaiter(void 0, void 0, void 0, function () {
|
|
24
15
|
var response, error_1;
|
|
25
16
|
return tslib_es6.__generator(this, function (_a) {
|
|
@@ -527,7 +518,6 @@ exports.getRunPrefillData = getRunPrefillData;
|
|
|
527
518
|
exports.hasOutgoingEdgeForHandle = hasOutgoingEdgeForHandle;
|
|
528
519
|
exports.isSessionExpired = isSessionExpired;
|
|
529
520
|
exports.reconstructHistoryToStep = reconstructHistoryToStep;
|
|
530
|
-
exports.reportCaptureDiagnostics = reportCaptureDiagnostics;
|
|
531
521
|
exports.reportSelfieFailure = reportSelfieFailure;
|
|
532
522
|
exports.resetNfcScan = resetNfcScan;
|
|
533
523
|
exports.sendClientInfo = sendClientInfo;
|
|
@@ -304,7 +304,7 @@ var DocumentCollection = function (_a) {
|
|
|
304
304
|
case "before-recto":
|
|
305
305
|
return jsx(BeforePhoto, { setStep: function () { return setPhotoSubStep("recto"); }, isSingleSided: !requiresTwoSides_1, onBack: handleBack });
|
|
306
306
|
case "recto":
|
|
307
|
-
return jsx(Photo, {
|
|
307
|
+
return jsx(Photo, { onCapture: function (img) { return handlePhotoCapture(img, "recto"); }, automaticCapture: false, maskType: "document" });
|
|
308
308
|
case "preview-recto":
|
|
309
309
|
return (jsx(PhotoPreview, { imageUrl: capturedImages.recto, side: "recto", isSingleSided: !requiresTwoSides_1, onValidate: function () { return setPhotoSubStep(requiresTwoSides_1 ? "before-verso" : "confirmation"); }, onRetake: function () {
|
|
310
310
|
setCapturedImages(function (prev) { var next = __assign({}, prev); delete next.recto; return next; });
|
|
@@ -313,7 +313,7 @@ var DocumentCollection = function (_a) {
|
|
|
313
313
|
case "before-verso":
|
|
314
314
|
return jsx(BeforeVersoPhoto, { setStep: function () { return setPhotoSubStep("verso"); } });
|
|
315
315
|
case "verso":
|
|
316
|
-
return jsx(Photo, {
|
|
316
|
+
return jsx(Photo, { onCapture: function (img) { return handlePhotoCapture(img, "verso"); }, automaticCapture: false, maskType: "document" });
|
|
317
317
|
case "preview-verso":
|
|
318
318
|
return (jsx(PhotoPreview, { imageUrl: capturedImages.verso, side: "verso", onValidate: function () { return setPhotoSubStep("confirmation"); }, onRetake: function () {
|
|
319
319
|
setCapturedImages(function (prev) { var next = __assign({}, prev); delete next.verso; return next; });
|
|
@@ -7,31 +7,27 @@ import CameraError from './CameraError.js';
|
|
|
7
7
|
import CameraMask from './CameraMask.js';
|
|
8
8
|
import OrientationToggle from './OrientationToggle.js';
|
|
9
9
|
import { useI18n } from '../../hooks/useI18n.js';
|
|
10
|
-
import { isBelowHd } from '../../utils/cameraResolution.js';
|
|
11
|
-
import { reportCaptureDiagnostics } from '../../services/sessionService.js';
|
|
12
10
|
import useIsMobile from '../../hooks/useIsMobile.js';
|
|
13
11
|
|
|
14
12
|
var Photo = function (_a) {
|
|
15
|
-
var onCapture = _a.onCapture,
|
|
13
|
+
var onCapture = _a.onCapture, _b = _a.automaticCapture, automaticCapture = _b === void 0 ? false : _b, _c = _a.maskType, maskType = _c === void 0 ? "id" : _c;
|
|
16
14
|
var isMobile = useIsMobile(768);
|
|
17
15
|
var videoRef = useRef(null);
|
|
18
|
-
var _d = useState(false),
|
|
19
|
-
var _e = useState(
|
|
20
|
-
var _f = useState(
|
|
21
|
-
var _g = useState("
|
|
22
|
-
var _h = useState(
|
|
23
|
-
var _j = useState(
|
|
24
|
-
var _k = useState(false),
|
|
25
|
-
var _l = useState(
|
|
26
|
-
var _m = useState(
|
|
27
|
-
var _o = useState(
|
|
28
|
-
var _p = useState(
|
|
29
|
-
var _q = useState(false),
|
|
30
|
-
var _r = useState(null), captureError = _r[0], setCaptureError = _r[1];
|
|
31
|
-
var _s = useState(false), showCaptureFlash = _s[0], setShowCaptureFlash = _s[1];
|
|
16
|
+
var _d = useState(false), isDetecting = _d[0], setIsDetecting = _d[1];
|
|
17
|
+
var _e = useState("environment"), facingMode = _e[0], setFacingMode = _e[1];
|
|
18
|
+
var _f = useState(null), cameraError = _f[0], setCameraError = _f[1];
|
|
19
|
+
var _g = useState(window.matchMedia("(orientation: portrait)").matches), isPortrait = _g[0], setIsPortrait = _g[1];
|
|
20
|
+
var _h = useState(false), isCountingDown = _h[0], setIsCountingDown = _h[1];
|
|
21
|
+
var _j = useState(0), countdown = _j[0], setCountdown = _j[1];
|
|
22
|
+
var _k = useState(false), documentDetected = _k[0], setDocumentDetected = _k[1];
|
|
23
|
+
var _l = useState(undefined), qualityHint = _l[0], setQualityHint = _l[1];
|
|
24
|
+
var _m = useState(true), isInitializing = _m[0], setIsInitializing = _m[1];
|
|
25
|
+
var _o = useState(false), isProcessing = _o[0], setIsProcessing = _o[1];
|
|
26
|
+
var _p = useState(null), captureError = _p[0], setCaptureError = _p[1];
|
|
27
|
+
var _q = useState(false), showCaptureFlash = _q[0], setShowCaptureFlash = _q[1];
|
|
32
28
|
var t = useI18n().t;
|
|
33
|
-
var
|
|
34
|
-
var
|
|
29
|
+
var _r = useState(null); _r[0]; var setLastCaptureMeta = _r[1];
|
|
30
|
+
var _s = useState(null), maskRect = _s[0], setMaskRect = _s[1];
|
|
35
31
|
var countdownIntervalRef = useRef(null);
|
|
36
32
|
var detectionHandlerRef = useRef(null);
|
|
37
33
|
var flashTimeoutRef = useRef(null);
|
|
@@ -220,13 +216,11 @@ var Photo = function (_a) {
|
|
|
220
216
|
useEffect(function () {
|
|
221
217
|
var isCancelled = false;
|
|
222
218
|
var initCamera = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
223
|
-
var result
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
switch (_e.label) {
|
|
219
|
+
var result;
|
|
220
|
+
return __generator(this, function (_a) {
|
|
221
|
+
switch (_a.label) {
|
|
227
222
|
case 0:
|
|
228
223
|
setCameraError(null);
|
|
229
|
-
setLowResolution(false);
|
|
230
224
|
setIsInitializing(true);
|
|
231
225
|
return [4 /*yield*/, cameraService.startCamera(videoRef.current, {
|
|
232
226
|
facingMode: facingMode,
|
|
@@ -234,25 +228,11 @@ var Photo = function (_a) {
|
|
|
234
228
|
preferImageCapture: true,
|
|
235
229
|
})];
|
|
236
230
|
case 1:
|
|
237
|
-
result =
|
|
231
|
+
result = _a.sent();
|
|
238
232
|
if (isCancelled)
|
|
239
233
|
return [2 /*return*/];
|
|
240
234
|
setIsInitializing(false);
|
|
241
235
|
if (result.success) {
|
|
242
|
-
belowHd = isBelowHd(result.settings);
|
|
243
|
-
setLowResolution(belowHd);
|
|
244
|
-
if (sessionId && nodeId) {
|
|
245
|
-
void reportCaptureDiagnostics(sessionId, nodeId, {
|
|
246
|
-
requested: result.requested,
|
|
247
|
-
obtained: { w: (_a = result.settings) === null || _a === void 0 ? void 0 : _a.width, h: (_b = result.settings) === null || _b === void 0 ? void 0 : _b.height, frameRate: (_c = result.settings) === null || _c === void 0 ? void 0 : _c.frameRate },
|
|
248
|
-
retriedWithHd: (_d = result.retriedWithHd) !== null && _d !== void 0 ? _d : false,
|
|
249
|
-
devicePixelRatio: window.devicePixelRatio,
|
|
250
|
-
cameraLabel: result.label,
|
|
251
|
-
lowResolutionWarningShown: belowHd,
|
|
252
|
-
facingMode: facingMode,
|
|
253
|
-
at: new Date().toISOString(),
|
|
254
|
-
}).catch(function () { });
|
|
255
|
-
}
|
|
256
236
|
setLastCaptureMeta(null);
|
|
257
237
|
// Detection also runs in manual mode: it only drives the visual
|
|
258
238
|
// feedback on the mask (documentDetected), it never starts the
|
|
@@ -280,7 +260,7 @@ var Photo = function (_a) {
|
|
|
280
260
|
flashTimeoutRef.current = null;
|
|
281
261
|
}
|
|
282
262
|
};
|
|
283
|
-
}, [facingMode,
|
|
263
|
+
}, [facingMode, clearCountdown, stopDetection]);
|
|
284
264
|
useEffect(function () {
|
|
285
265
|
if (!isDetecting || !videoRef.current) {
|
|
286
266
|
return;
|
|
@@ -323,7 +303,21 @@ var Photo = function (_a) {
|
|
|
323
303
|
setIsInitializing(true);
|
|
324
304
|
stopDetection();
|
|
325
305
|
cameraService.stopCamera();
|
|
326
|
-
|
|
306
|
+
cameraService
|
|
307
|
+
.startCamera(videoRef.current, {
|
|
308
|
+
facingMode: facingMode,
|
|
309
|
+
idealResolution: { width: 4096, height: 3072 },
|
|
310
|
+
preferImageCapture: true,
|
|
311
|
+
})
|
|
312
|
+
.then(function (result) {
|
|
313
|
+
setIsInitializing(false);
|
|
314
|
+
if (result.success) {
|
|
315
|
+
setIsDetecting(true);
|
|
316
|
+
}
|
|
317
|
+
else if (result.error) {
|
|
318
|
+
setCameraError(result.error);
|
|
319
|
+
}
|
|
320
|
+
});
|
|
327
321
|
};
|
|
328
322
|
var handleManualCapture = function () {
|
|
329
323
|
if (isProcessing) {
|
|
@@ -347,7 +341,7 @@ var Photo = function (_a) {
|
|
|
347
341
|
zIndex: isMobile ? 50 : "auto",
|
|
348
342
|
height: "100%",
|
|
349
343
|
width: "100%",
|
|
350
|
-
}, children: [jsx("div", { className: "flex-1 relative overflow-hidden bg-black", children: cameraError ? (jsx("div", { className: "flex items-center justify-center h-full px-4 py-6", children: jsx(CameraError, { errorMessage: cameraError, onRetry: handleRetry }) })) : (jsxs(Fragment, { children: [isInitializing && (jsxs("div", { "data-testid": "camera-initializing", className: "absolute inset-0 z-30 flex flex-col items-center justify-center gap-3 bg-black", children: [jsx("div", { className: "w-10 h-10 border-4 border-white border-t-transparent rounded-full animate-spin" }), jsx("span", { className: "text-white text-sm", children: t("id_check.photo.initializing", "Ouverture de la caméra…") })] })), isProcessing && (jsxs("div", { "data-testid": "camera-processing", className: "absolute inset-0 z-30 flex flex-col items-center justify-center gap-3 bg-black bg-opacity-70", children: [jsx("div", { className: "w-10 h-10 border-4 border-white border-t-transparent rounded-full animate-spin" }), jsx("span", { className: "text-white text-sm", children: t("id_check.photo.processing", "Traitement de l'image…") })] })), jsx("video", { ref: videoRef, autoPlay: true, playsInline: true, muted: true, className: "absolute inset-0 w-full h-full object-cover z-0 bg-black ".concat(facingMode === "user" ? "scale-x-[-1]" : "") }), jsx("div", { className: "absolute top-4 left-1/2 transform -translate-x-1/2 z-50", children: jsx("span", { className: "text-white z-50 text-sm font-semibold drop-shadow-lg", children: automaticCapture ? (jsx("span", { className: "animate-pulse", children: t("id_check.photo.mode_autocapture", "Autocapture activée") })) : (jsx("span", { className: "bg-orange-500 px-2 py-1 rounded hidden", children: t("id_check.photo.mode_manual", "Mode manuel") })) }) }), jsx(CameraMask, { isDetecting: isDetecting, isPortrait: isPortrait, facingMode: facingMode, isCountingDown: isCountingDown, countdown: countdown, maskType: maskType, documentDetected: documentDetected, qualityHint: qualityHint, onMaskRectChange: setMaskRect }), jsx("div", { className: "absolute bottom-20 left-0 right-0 z-20 pointer-events-none", children: jsx("div", { className: "text-center px-4", children: jsx("div", { className: "bg-black bg-opacity-60 text-white text-sm px-4 py-2 rounded-lg inline-block", children: t("id_check.photo.position_document", "Posez le document à plat ou tenez-le dans le cadre") }) }) }), jsx(OrientationToggle, { onCameraToggle: toggleCamera }),
|
|
344
|
+
}, children: [jsx("div", { className: "flex-1 relative overflow-hidden bg-black", children: cameraError ? (jsx("div", { className: "flex items-center justify-center h-full px-4 py-6", children: jsx(CameraError, { errorMessage: cameraError, onRetry: handleRetry }) })) : (jsxs(Fragment, { children: [isInitializing && (jsxs("div", { "data-testid": "camera-initializing", className: "absolute inset-0 z-30 flex flex-col items-center justify-center gap-3 bg-black", children: [jsx("div", { className: "w-10 h-10 border-4 border-white border-t-transparent rounded-full animate-spin" }), jsx("span", { className: "text-white text-sm", children: t("id_check.photo.initializing", "Ouverture de la caméra…") })] })), isProcessing && (jsxs("div", { "data-testid": "camera-processing", className: "absolute inset-0 z-30 flex flex-col items-center justify-center gap-3 bg-black bg-opacity-70", children: [jsx("div", { className: "w-10 h-10 border-4 border-white border-t-transparent rounded-full animate-spin" }), jsx("span", { className: "text-white text-sm", children: t("id_check.photo.processing", "Traitement de l'image…") })] })), jsx("video", { ref: videoRef, autoPlay: true, playsInline: true, muted: true, className: "absolute inset-0 w-full h-full object-cover z-0 bg-black ".concat(facingMode === "user" ? "scale-x-[-1]" : "") }), jsx("div", { className: "absolute top-4 left-1/2 transform -translate-x-1/2 z-50", children: jsx("span", { className: "text-white z-50 text-sm font-semibold drop-shadow-lg", children: automaticCapture ? (jsx("span", { className: "animate-pulse", children: t("id_check.photo.mode_autocapture", "Autocapture activée") })) : (jsx("span", { className: "bg-orange-500 px-2 py-1 rounded hidden", children: t("id_check.photo.mode_manual", "Mode manuel") })) }) }), jsx(CameraMask, { isDetecting: isDetecting, isPortrait: isPortrait, facingMode: facingMode, isCountingDown: isCountingDown, countdown: countdown, maskType: maskType, documentDetected: documentDetected, qualityHint: qualityHint, onMaskRectChange: setMaskRect }), jsx("div", { className: "absolute bottom-20 left-0 right-0 z-20 pointer-events-none", children: jsx("div", { className: "text-center px-4", children: jsx("div", { className: "bg-black bg-opacity-60 text-white text-sm px-4 py-2 rounded-lg inline-block", children: t("id_check.photo.position_document", "Posez le document à plat ou tenez-le dans le cadre") }) }) }), jsx(OrientationToggle, { onCameraToggle: toggleCamera }), showCaptureFlash && (jsx("div", { "data-testid": "capture-flash", className: "absolute inset-0 z-40 bg-white pointer-events-none animate-pulse" }))] })) }), jsx("div", { className: "relative z-20 bg-black bg-opacity-80 p-4", children: jsxs("div", { className: "flex flex-col items-center space-y-4", children: [jsx("button", { onClick: handleManualCapture, className: "w-16 h-16 rounded-full border-4 border-white flex items-center justify-center transition-all duration-150 bg-transparent hover:bg-white hover:bg-opacity-20 cursor-pointer ".concat(showCaptureFlash ? "scale-90 ring-4 ring-[#11E5C5]" : ""), children: jsx("div", { className: "w-8 h-8 bg-white rounded-full" }) }), jsxs("div", { className: "text-white text-center text-sm", children: [jsxs("div", { className: "flex items-center justify-center space-x-2", children: [jsx("div", { className: "w-2 h-2 rounded-full ".concat(automaticCapture
|
|
351
345
|
? "bg-[#11E5C5] animate-pulse"
|
|
352
346
|
: "bg-orange-500") }), jsx("span", { children: statusMessage })] }), captureError && (jsx("p", { className: "text-red-400 text-xs mt-2 text-center", children: captureError }))] })] }) })] }));
|
|
353
347
|
};
|
|
@@ -760,13 +760,13 @@ var DocumentCheck = function (_a) {
|
|
|
760
760
|
return (jsx(BeforePhoto, { setStep: function () { return setCurrentPhotoStep("recto"); }, isSingleSided: isSingleSided, onBack: function () { return setDocStep(2); } }));
|
|
761
761
|
}
|
|
762
762
|
if (currentPhotoStep === "recto") {
|
|
763
|
-
return (jsx(Photo, {
|
|
763
|
+
return (jsx(Photo, { onCapture: function (imageData) { return handlePhotoCapture(imageData, "recto"); } }));
|
|
764
764
|
}
|
|
765
765
|
if (currentPhotoStep === "before-verso") {
|
|
766
766
|
return (jsx(BeforeVersoPhoto, { setStep: function () { return setCurrentPhotoStep("verso"); } }));
|
|
767
767
|
}
|
|
768
768
|
if (currentPhotoStep === "verso") {
|
|
769
|
-
return (jsx(Photo, {
|
|
769
|
+
return (jsx(Photo, { onCapture: function (imageData) { return handlePhotoCapture(imageData, "verso"); } }));
|
|
770
770
|
}
|
|
771
771
|
if (currentPhotoStep === "confirmation") {
|
|
772
772
|
return (jsx(PhotoConfirmation, { imageUrl: capturedImages.recto || "", versoImageUrl: capturedImages.verso, requiresTwoSides: !!capturedImages.verso, onConfirm: onConfirm, onRetry: function () { return setCurrentPhotoStep("before-recto"); }, onRetryAfterProcessing: function () { return setCurrentPhotoStep("before-recto"); }, fileUploaded: fileUploaded, isSingleSided: isSingleSided }));
|
package/dist/esm/i18n/en.json.js
CHANGED
|
@@ -781,21 +781,11 @@ var id_check = {
|
|
|
781
781
|
alt_verso: "Before taking the verso photo"
|
|
782
782
|
},
|
|
783
783
|
camera: {
|
|
784
|
-
low_resolution: {
|
|
785
|
-
title: "Limited camera resolution",
|
|
786
|
-
body: "Your camera resolution is below HD. The photo may be blurry, but you can continue.",
|
|
787
|
-
tips: "Close other apps using the camera, choose another camera or switch to mobile, and improve the lighting.",
|
|
788
|
-
retry: "Try again"
|
|
789
|
-
},
|
|
790
784
|
error_title: "Camera error",
|
|
791
785
|
retry: "Retry",
|
|
792
786
|
document_detected: "Document detected"
|
|
793
787
|
},
|
|
794
788
|
photo: {
|
|
795
|
-
hint: {
|
|
796
|
-
too_dark: "Too dark, find more light",
|
|
797
|
-
too_bright: "Too much glare, avoid direct light"
|
|
798
|
-
},
|
|
799
789
|
capture_failed: "Capture failed. Please try again.",
|
|
800
790
|
mode_autocapture: "Autocapture enabled",
|
|
801
791
|
mode_manual: "Manual mode",
|
package/dist/esm/i18n/es.json.js
CHANGED
|
@@ -781,21 +781,11 @@ var id_check = {
|
|
|
781
781
|
alt_verso: "Antes de tomar la foto del reverso"
|
|
782
782
|
},
|
|
783
783
|
camera: {
|
|
784
|
-
low_resolution: {
|
|
785
|
-
title: "Resolución de cámara limitada",
|
|
786
|
-
body: "La resolución de la cámara es inferior a HD. La foto puede salir borrosa, pero puede continuar.",
|
|
787
|
-
tips: "Cierre otras aplicaciones que usen la cámara, elija otra cámara o pase al móvil y mejore la iluminación.",
|
|
788
|
-
retry: "Reintentar"
|
|
789
|
-
},
|
|
790
784
|
error_title: "Error de cámara",
|
|
791
785
|
retry: "Reintentar",
|
|
792
786
|
document_detected: "Documento detectado"
|
|
793
787
|
},
|
|
794
788
|
photo: {
|
|
795
|
-
hint: {
|
|
796
|
-
too_dark: "Demasiado oscuro, busque más luz",
|
|
797
|
-
too_bright: "Demasiados reflejos, evite la luz directa"
|
|
798
|
-
},
|
|
799
789
|
capture_failed: "La captura ha fallado. Inténtalo de nuevo.",
|
|
800
790
|
mode_autocapture: "Captura automática activada",
|
|
801
791
|
mode_manual: "Modo manual",
|
package/dist/esm/i18n/fr.json.js
CHANGED
|
@@ -781,21 +781,11 @@ var id_check = {
|
|
|
781
781
|
alt_verso: "Avant de prendre la photo du verso"
|
|
782
782
|
},
|
|
783
783
|
camera: {
|
|
784
|
-
low_resolution: {
|
|
785
|
-
title: "Résolution de la caméra limitée",
|
|
786
|
-
body: "La résolution de votre caméra est inférieure à la HD. La photo risque d’être floue, mais vous pouvez continuer.",
|
|
787
|
-
tips: "Fermez les autres applications utilisant la caméra, choisissez une autre caméra ou passez sur mobile, et améliorez l’éclairage.",
|
|
788
|
-
retry: "Réessayer"
|
|
789
|
-
},
|
|
790
784
|
error_title: "Erreur de caméra",
|
|
791
785
|
retry: "Réessayer",
|
|
792
786
|
document_detected: "Document détecté"
|
|
793
787
|
},
|
|
794
788
|
photo: {
|
|
795
|
-
hint: {
|
|
796
|
-
too_dark: "Trop sombre, cherchez plus de lumière",
|
|
797
|
-
too_bright: "Trop de reflets, évitez la lumière directe"
|
|
798
|
-
},
|
|
799
789
|
capture_failed: "La capture a échoué. Veuillez réessayer.",
|
|
800
790
|
mode_autocapture: "Autocapture activée",
|
|
801
791
|
mode_manual: "Mode manuel",
|