datakeen-session-react 1.1.204 → 1.1.207
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/document-collection/DocumentProcessing.js +3 -1
- package/dist/cjs/components/id-check/Photo.js +42 -36
- package/dist/cjs/components/jdi/JDIProcessing.js +6 -1
- package/dist/cjs/components/nfc-scan/NfcScanNode.js +3 -4
- package/dist/cjs/components/session/DocumentCheck.js +2 -2
- package/dist/cjs/components/signature-electronic/SignatureElectronic.js +13 -30
- package/dist/cjs/components/template/ExternalVerificationNodeHandler.js +94 -63
- package/dist/cjs/hooks/useUserInputForm.js +112 -0
- package/dist/cjs/i18n/en.json.js +10 -0
- package/dist/cjs/i18n/es.json.js +10 -0
- package/dist/cjs/i18n/fr.json.js +10 -0
- package/dist/cjs/index.css.js +1 -1
- package/dist/cjs/services/analysis.js +7 -0
- package/dist/cjs/services/cameraService.js +44 -23
- package/dist/cjs/services/pollingService.js +4 -1
- package/dist/cjs/services/sessionService.js +16 -6
- package/dist/cjs/utils/analysisErrors.js +11 -0
- package/dist/cjs/utils/cameraResolution.js +12 -0
- package/dist/cjs/utils/extractedCopy.js +38 -0
- package/dist/cjs/utils/sessionStatus.js +3 -2
- package/dist/esm/components/document-collection/DocumentCollection.js +2 -2
- package/dist/esm/components/document-collection/DocumentProcessing.js +4 -2
- package/dist/esm/components/id-check/Photo.js +42 -36
- package/dist/esm/components/jdi/JDIProcessing.js +7 -2
- package/dist/esm/components/nfc-scan/NfcScanNode.js +3 -4
- package/dist/esm/components/session/DocumentCheck.js +2 -2
- package/dist/esm/components/signature-electronic/SignatureElectronic.js +13 -30
- package/dist/esm/components/template/ExternalVerificationNodeHandler.js +94 -63
- package/dist/esm/hooks/useUserInputForm.js +113 -1
- package/dist/esm/i18n/en.json.js +10 -0
- package/dist/esm/i18n/es.json.js +10 -0
- package/dist/esm/i18n/fr.json.js +10 -0
- package/dist/esm/index.css.js +1 -1
- package/dist/esm/services/analysis.js +7 -0
- package/dist/esm/services/cameraService.js +44 -23
- package/dist/esm/services/pollingService.js +4 -1
- package/dist/esm/services/sessionService.js +16 -7
- package/dist/esm/utils/analysisErrors.js +10 -1
- package/dist/esm/utils/cameraResolution.js +9 -0
- package/dist/esm/utils/extractedCopy.js +36 -0
- package/dist/esm/utils/sessionStatus.js +3 -2
- package/package.json +2 -1
|
@@ -4,6 +4,7 @@ import { useState, useEffect } from 'react';
|
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import sdkI18n from '../../i18n/index.js';
|
|
6
6
|
import { apiService } from '../../services/api.js';
|
|
7
|
+
import { fetchSessionById } from '../../services/sessionService.js';
|
|
7
8
|
import checkIcon from '../../assets/check.svg.js';
|
|
8
9
|
import LoadingState from '../states/LoadingState.js';
|
|
9
10
|
import Title from '../ui/Title.js';
|
|
@@ -189,10 +190,10 @@ var ExternalVerificationNodeHandler = function (_a) {
|
|
|
189
190
|
useEffect(function () {
|
|
190
191
|
var abortController = new AbortController();
|
|
191
192
|
var run = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
192
|
-
var result, referenceField, referenceValueMasked, resolvedReferenceValue, referenceNodeId, referenceVariable, submittedFirstName, submittedLastName, submittedSiren, nodeInput, userInputFlat, nodeScopedKeys, lookupKeys, referenceValue, allCustomFields, _i, _a, _b, value, str, comparisonConfig, cfg,
|
|
193
|
-
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
194
|
-
return __generator(this, function (
|
|
195
|
-
switch (
|
|
193
|
+
var result, referenceField, referenceValueMasked, resolvedReferenceValue, referenceNodeId, referenceVariable, submittedFirstName, submittedLastName, submittedSiren, nodeInput, userInputFlat, nodeScopedKeys, lookupKeys, referenceValue, allCustomFields, _i, _a, _b, value, str, comparisonConfig, cfg, personRefId_1, personNodeInput_1, fromIdentityCopy, fresh, error_1, flat, isPersonneMorale, sirenKeys, firstNameKeys, lastNameKeys, birthDateKeys, dateOfBirth, response, res, apiErr_1, apiResult, inpi, cfg, isPersonneMorale_1;
|
|
194
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
195
|
+
return __generator(this, function (_y) {
|
|
196
|
+
switch (_y.label) {
|
|
196
197
|
case 0:
|
|
197
198
|
result = {
|
|
198
199
|
isVerified: false,
|
|
@@ -206,9 +207,9 @@ var ExternalVerificationNodeHandler = function (_a) {
|
|
|
206
207
|
submittedFirstName = '';
|
|
207
208
|
submittedLastName = '';
|
|
208
209
|
submittedSiren = '';
|
|
209
|
-
|
|
210
|
+
_y.label = 1;
|
|
210
211
|
case 1:
|
|
211
|
-
|
|
212
|
+
_y.trys.push([1, 15, , 16]);
|
|
212
213
|
if (!(session === null || session === void 0 ? void 0 : session.id))
|
|
213
214
|
throw new Error('Session ID is missing');
|
|
214
215
|
referenceField = normalizeReferenceField(String(nodeData.referenceField || referenceVariable || ''));
|
|
@@ -219,7 +220,7 @@ var ExternalVerificationNodeHandler = function (_a) {
|
|
|
219
220
|
message: 'External verification node is missing reference configuration.',
|
|
220
221
|
errorCode: 'MISSING_REFERENCE_CONFIG',
|
|
221
222
|
};
|
|
222
|
-
return [3 /*break*/,
|
|
223
|
+
return [3 /*break*/, 14];
|
|
223
224
|
case 2:
|
|
224
225
|
nodeInput = userInput[referenceNodeId];
|
|
225
226
|
userInputFlat = userInput;
|
|
@@ -262,71 +263,101 @@ var ExternalVerificationNodeHandler = function (_a) {
|
|
|
262
263
|
message: 'No SIREN/SIRET value found in source node data.',
|
|
263
264
|
errorCode: 'REFERENCE_VALUE_NOT_FOUND',
|
|
264
265
|
};
|
|
265
|
-
return [3 /*break*/,
|
|
266
|
+
return [3 /*break*/, 14];
|
|
266
267
|
case 3:
|
|
267
268
|
resolvedReferenceValue = referenceValue;
|
|
268
269
|
referenceValueMasked = maskReferenceValue(referenceValue);
|
|
269
270
|
comparisonConfig = void 0;
|
|
270
|
-
if (isInpiRbe && ((_d = nodeData.comparisonConfig) === null || _d === void 0 ? void 0 : _d.personReferenceNodeId))
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
271
|
+
if (!(isInpiRbe && ((_d = nodeData.comparisonConfig) === null || _d === void 0 ? void 0 : _d.personReferenceNodeId))) return [3 /*break*/, 9];
|
|
272
|
+
cfg = nodeData.comparisonConfig;
|
|
273
|
+
personRefId_1 = cfg.personReferenceNodeId;
|
|
274
|
+
personNodeInput_1 = userInput[personRefId_1];
|
|
275
|
+
fromIdentityCopy = ((_f = (_e = session.template) === null || _e === void 0 ? void 0 : _e.nodes) !== null && _f !== void 0 ? _f : []).some(function (n) { return n.id === personRefId_1 &&
|
|
276
|
+
(n.type === 'controle-jdi' || n.type === 'identity-control') &&
|
|
277
|
+
n.copyIdentityToUserInput === true; });
|
|
278
|
+
if (!(fromIdentityCopy && !personNodeInput_1)) return [3 /*break*/, 8];
|
|
279
|
+
_y.label = 4;
|
|
280
|
+
case 4:
|
|
281
|
+
_y.trys.push([4, 6, , 7]);
|
|
282
|
+
return [4 /*yield*/, fetchSessionById(session.id)];
|
|
283
|
+
case 5:
|
|
284
|
+
fresh = _y.sent();
|
|
285
|
+
personNodeInput_1 = (_g = fresh === null || fresh === void 0 ? void 0 : fresh.userInput) === null || _g === void 0 ? void 0 : _g[personRefId_1];
|
|
286
|
+
if (personNodeInput_1) {
|
|
287
|
+
setUserInput(function (prev) {
|
|
288
|
+
var _a;
|
|
289
|
+
return (__assign(__assign({}, prev), (_a = {}, _a[personRefId_1] = personNodeInput_1, _a)));
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
return [3 /*break*/, 7];
|
|
293
|
+
case 6:
|
|
294
|
+
error_1 = _y.sent();
|
|
295
|
+
console.warn('[ExternalVerification] Identité reportée indisponible', error_1);
|
|
296
|
+
return [3 /*break*/, 7];
|
|
297
|
+
case 7:
|
|
298
|
+
if (abortController.signal.aborted)
|
|
299
|
+
return [2 /*return*/];
|
|
300
|
+
_y.label = 8;
|
|
301
|
+
case 8:
|
|
302
|
+
personNodeInput_1 = personNodeInput_1 !== null && personNodeInput_1 !== void 0 ? personNodeInput_1 : {};
|
|
303
|
+
flat = fromIdentityCopy ? {} : userInput;
|
|
304
|
+
isPersonneMorale = cfg.personType === 'MORALE';
|
|
305
|
+
if (isPersonneMorale) {
|
|
306
|
+
sirenKeys = expandFieldKey((_h = cfg.personSirenField) !== null && _h !== void 0 ? _h : '').filter(Boolean);
|
|
307
|
+
submittedSiren = (_j = resolveFieldValue(personNodeInput_1, flat, sirenKeys)) !== null && _j !== void 0 ? _j : '';
|
|
308
|
+
if (submittedSiren) {
|
|
309
|
+
comparisonConfig = {
|
|
310
|
+
personType: 'MORALE',
|
|
311
|
+
siren: submittedSiren,
|
|
312
|
+
// Un RBE est toujours une personne physique en droit
|
|
313
|
+
// français : forcé à 'mandataires' quel que soit le
|
|
314
|
+
// contenu de cfg.compareTargets (défense en profondeur).
|
|
315
|
+
compareTargets: ['mandataires'],
|
|
316
|
+
};
|
|
288
317
|
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
}
|
|
318
|
+
}
|
|
319
|
+
else {
|
|
320
|
+
firstNameKeys = expandFieldKey((_k = cfg.personFirstNameField) !== null && _k !== void 0 ? _k : '').filter(Boolean);
|
|
321
|
+
lastNameKeys = expandFieldKey((_l = cfg.personLastNameField) !== null && _l !== void 0 ? _l : '').filter(Boolean);
|
|
322
|
+
birthDateKeys = cfg.personBirthDateField
|
|
323
|
+
? expandFieldKey(cfg.personBirthDateField).filter(Boolean)
|
|
324
|
+
: [];
|
|
325
|
+
submittedFirstName = (_m = resolveFieldValue(personNodeInput_1, flat, firstNameKeys)) !== null && _m !== void 0 ? _m : '';
|
|
326
|
+
submittedLastName = (_o = resolveFieldValue(personNodeInput_1, flat, lastNameKeys)) !== null && _o !== void 0 ? _o : '';
|
|
327
|
+
dateOfBirth = cfg.compareBirthDate && birthDateKeys.length
|
|
328
|
+
? resolveFieldValue(personNodeInput_1, flat, birthDateKeys)
|
|
329
|
+
: undefined;
|
|
330
|
+
if (submittedFirstName && submittedLastName) {
|
|
331
|
+
comparisonConfig = __assign({ firstName: submittedFirstName, lastName: submittedLastName, compareTargets: (_p = cfg.compareTargets) !== null && _p !== void 0 ? _p : ['mandataires'] }, (dateOfBirth ? { dateOfBirth: dateOfBirth } : {}));
|
|
303
332
|
}
|
|
304
333
|
}
|
|
334
|
+
_y.label = 9;
|
|
335
|
+
case 9:
|
|
305
336
|
if (isInpiRbe)
|
|
306
337
|
advanceStep(1);
|
|
307
|
-
|
|
308
|
-
case
|
|
309
|
-
|
|
338
|
+
_y.label = 10;
|
|
339
|
+
case 10:
|
|
340
|
+
_y.trys.push([10, 13, , 14]);
|
|
310
341
|
return [4 /*yield*/, apiService.post("/session/sdk/".concat(session.id, "/verify-external/").concat(node.id), __assign({ apiType: apiType, referenceValue: referenceValue, referenceField: referenceField, enableRnaFallback: isInpiRbe && nodeData.rnaFallbackEnabled === true, enableInseeFallback: isInpiRbe && nodeData.enableInseeFallback === true }, (comparisonConfig ? { comparisonConfig: comparisonConfig } : {})), { signal: abortController.signal })];
|
|
311
|
-
case
|
|
312
|
-
response =
|
|
342
|
+
case 11:
|
|
343
|
+
response = _y.sent();
|
|
313
344
|
if (isInpiRbe)
|
|
314
345
|
advanceStep(2);
|
|
315
346
|
return [4 /*yield*/, new Promise(function (r) { return setTimeout(r, 600); })];
|
|
316
|
-
case
|
|
317
|
-
|
|
318
|
-
res = (
|
|
347
|
+
case 12:
|
|
348
|
+
_y.sent();
|
|
349
|
+
res = (_q = response.data) === null || _q === void 0 ? void 0 : _q.data;
|
|
319
350
|
if (res && typeof res.isVerified === 'boolean') {
|
|
320
351
|
result = res;
|
|
321
352
|
}
|
|
322
|
-
return [3 /*break*/,
|
|
323
|
-
case
|
|
324
|
-
apiErr_1 =
|
|
353
|
+
return [3 /*break*/, 14];
|
|
354
|
+
case 13:
|
|
355
|
+
apiErr_1 = _y.sent();
|
|
325
356
|
if (abortController.signal.aborted)
|
|
326
357
|
return [2 /*return*/];
|
|
327
358
|
if (isInpiRbe)
|
|
328
359
|
advanceStep(2);
|
|
329
|
-
apiResult = (
|
|
360
|
+
apiResult = (_s = (_r = apiErr_1 === null || apiErr_1 === void 0 ? void 0 : apiErr_1.response) === null || _r === void 0 ? void 0 : _r.data) === null || _s === void 0 ? void 0 : _s.data;
|
|
330
361
|
if (apiResult && typeof apiResult.isVerified === 'boolean') {
|
|
331
362
|
result = apiResult;
|
|
332
363
|
}
|
|
@@ -338,18 +369,18 @@ var ExternalVerificationNodeHandler = function (_a) {
|
|
|
338
369
|
errorCode: 'REQUEST_FAILED',
|
|
339
370
|
};
|
|
340
371
|
}
|
|
341
|
-
return [3 /*break*/,
|
|
342
|
-
case
|
|
343
|
-
case
|
|
344
|
-
|
|
372
|
+
return [3 /*break*/, 14];
|
|
373
|
+
case 14: return [3 /*break*/, 16];
|
|
374
|
+
case 15:
|
|
375
|
+
_y.sent();
|
|
345
376
|
result = {
|
|
346
377
|
isVerified: false,
|
|
347
378
|
status: 'external_error',
|
|
348
379
|
message: 'Unexpected error during verification.',
|
|
349
380
|
errorCode: 'UNEXPECTED_ERROR',
|
|
350
381
|
};
|
|
351
|
-
return [3 /*break*/,
|
|
352
|
-
case
|
|
382
|
+
return [3 /*break*/, 16];
|
|
383
|
+
case 16:
|
|
353
384
|
if (abortController.signal.aborted)
|
|
354
385
|
return [2 /*return*/];
|
|
355
386
|
completeSteps();
|
|
@@ -381,13 +412,13 @@ var ExternalVerificationNodeHandler = function (_a) {
|
|
|
381
412
|
// physique, tous les mandataires sont listés : une société
|
|
382
413
|
// mandataire (ex. holding présidente) explique pourquoi la
|
|
383
414
|
// personne saisie n'apparaît pas en direct au RNE.
|
|
384
|
-
mandataires: ((
|
|
415
|
+
mandataires: ((_t = inpi === null || inpi === void 0 ? void 0 : inpi.mandataires) !== null && _t !== void 0 ? _t : []).filter(function (m) {
|
|
385
416
|
return isPersonneMorale_1 ? m.type === 'personne_morale' : true;
|
|
386
417
|
}),
|
|
387
|
-
beneficiairesEffectifs: (
|
|
388
|
-
compareTargets: isPersonneMorale_1 ? ['mandataires'] : ((
|
|
389
|
-
personNodeId: (
|
|
390
|
-
targetDenomination: (
|
|
418
|
+
beneficiairesEffectifs: (_u = inpi === null || inpi === void 0 ? void 0 : inpi.beneficiairesEffectifs) !== null && _u !== void 0 ? _u : [],
|
|
419
|
+
compareTargets: isPersonneMorale_1 ? ['mandataires'] : ((_v = cfg === null || cfg === void 0 ? void 0 : cfg.compareTargets) !== null && _v !== void 0 ? _v : ['mandataires']),
|
|
420
|
+
personNodeId: (_w = cfg === null || cfg === void 0 ? void 0 : cfg.personReferenceNodeId) !== null && _w !== void 0 ? _w : '',
|
|
421
|
+
targetDenomination: (_x = inpi === null || inpi === void 0 ? void 0 : inpi.identite) === null || _x === void 0 ? void 0 : _x.denomination,
|
|
391
422
|
siren: resolvedReferenceValue,
|
|
392
423
|
sirenNodeId: referenceNodeId,
|
|
393
424
|
source: inpi === null || inpi === void 0 ? void 0 : inpi.source,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __assign, __rest, __awaiter, __generator } from '../node_modules/tslib/tslib.es6.js';
|
|
1
|
+
import { __assign, __spreadArray, __rest, __awaiter, __generator } from '../node_modules/tslib/tslib.es6.js';
|
|
2
2
|
import { useMemo, useState, useRef, useEffect } from 'react';
|
|
3
3
|
import { DEFAULT_FIELDS, FALLBACK_ADDRESS_SUGGESTIONS, GEOCODING_AUTOCOMPLETE_ENDPOINT } from '../constants/userInputForm.js';
|
|
4
4
|
import { API_BASE_URL } from '../config/env.js';
|
|
@@ -11,6 +11,8 @@ import { labelToKey } from '../utils/labelToKey.js';
|
|
|
11
11
|
import { DEFAULT_DATE_DISPLAY_FORMAT } from '../types/session.js';
|
|
12
12
|
import { useI18n } from './useI18n.js';
|
|
13
13
|
import { logFormValidated } from '../services/auditTrailService.js';
|
|
14
|
+
import { fetchSessionById } from '../services/sessionService.js';
|
|
15
|
+
import { extractedRootTarget } from '../utils/extractedCopy.js';
|
|
14
16
|
|
|
15
17
|
var useUserInputForm = function (_a) {
|
|
16
18
|
var stepObject = _a.stepObject, setUserInput = _a.setUserInput, initialUserInput = _a.initialUserInput, node = _a.node, template = _a.template, contactInfo = _a.contactInfo, setContactInfo = _a.setContactInfo, onContinueCallback = _a.onContinueCallback, sessionId = _a.sessionId;
|
|
@@ -267,6 +269,116 @@ var useUserInputForm = function (_a) {
|
|
|
267
269
|
form.phoneNumber,
|
|
268
270
|
form.companyName,
|
|
269
271
|
]);
|
|
272
|
+
// APP3-2020 — le serveur reporte prénom, nom et date de naissance lus sur la pièce
|
|
273
|
+
// à la racine de userInput après l'analyse : absents de la mémoire du SDK, on les
|
|
274
|
+
// relit à l'ouverture du formulaire personne physique (une fois par nœud, remount
|
|
275
|
+
// par key). Seules les clés vides sont complétées, en mémoire ET dans le formulaire :
|
|
276
|
+
// l'effet ci-dessus ne re-synchronise pas dès qu'un champ (email de contactInfo) est rempli.
|
|
277
|
+
useEffect(function () {
|
|
278
|
+
var _a;
|
|
279
|
+
if (informationType !== "identity" ||
|
|
280
|
+
!sessionId ||
|
|
281
|
+
(initialUserInput === null || initialUserInput === void 0 ? void 0 : initialUserInput.firstName) ||
|
|
282
|
+
(initialUserInput === null || initialUserInput === void 0 ? void 0 : initialUserInput.lastName) ||
|
|
283
|
+
!((_a = template === null || template === void 0 ? void 0 : template.nodes) !== null && _a !== void 0 ? _a : []).some(function (n) {
|
|
284
|
+
return (n.type === "controle-jdi" || n.type === "identity-control") &&
|
|
285
|
+
n.copyIdentityToUserInput === true;
|
|
286
|
+
})) {
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
var cancelled = false;
|
|
290
|
+
fetchSessionById(sessionId)
|
|
291
|
+
.then(function (fresh) {
|
|
292
|
+
var _a;
|
|
293
|
+
var server = ((_a = fresh === null || fresh === void 0 ? void 0 : fresh.userInput) !== null && _a !== void 0 ? _a : {});
|
|
294
|
+
var fill = ["firstName", "lastName", "birthDate"].filter(function (key) { return typeof server[key] === "string" && server[key]; });
|
|
295
|
+
if (cancelled || !fill.length)
|
|
296
|
+
return;
|
|
297
|
+
setUserInput(function (prev) {
|
|
298
|
+
var next = __assign({}, prev);
|
|
299
|
+
for (var _i = 0, fill_1 = fill; _i < fill_1.length; _i++) {
|
|
300
|
+
var key = fill_1[_i];
|
|
301
|
+
if (!next[key])
|
|
302
|
+
next[key] = server[key];
|
|
303
|
+
}
|
|
304
|
+
return next;
|
|
305
|
+
});
|
|
306
|
+
setForm(function (prev) {
|
|
307
|
+
var next = __assign({}, prev);
|
|
308
|
+
if (!prev.firstName && server.firstName)
|
|
309
|
+
next.firstName = server.firstName;
|
|
310
|
+
if (!prev.lastName && server.lastName)
|
|
311
|
+
next.lastName = server.lastName;
|
|
312
|
+
if (!prev.birthDate && !prev.day && !prev.month && !prev.year && server.birthDate) {
|
|
313
|
+
next.birthDate = server.birthDate;
|
|
314
|
+
Object.assign(next, parseBirthDate(next.birthDate));
|
|
315
|
+
}
|
|
316
|
+
return next;
|
|
317
|
+
});
|
|
318
|
+
})
|
|
319
|
+
.catch(function (error) {
|
|
320
|
+
console.warn("[UserInputForm] Identité reportée indisponible", error);
|
|
321
|
+
});
|
|
322
|
+
return function () {
|
|
323
|
+
cancelled = true;
|
|
324
|
+
};
|
|
325
|
+
}, []); // Une seule relecture à l'ouverture du nœud.
|
|
326
|
+
// APP3-2142 — même principe pour la collecte de documents : le serveur pré-remplit à la
|
|
327
|
+
// racine les champs de formulaire standard reportés depuis un document (ex. raison sociale
|
|
328
|
+
// du KBIS). On relit la session à l'ouverture si un de ces champs manque en mémoire, et on
|
|
329
|
+
// ne complète que les clés vides.
|
|
330
|
+
useEffect(function () {
|
|
331
|
+
var _a;
|
|
332
|
+
if (!sessionId || informationType === "custom")
|
|
333
|
+
return;
|
|
334
|
+
var targets = new Set(((_a = template === null || template === void 0 ? void 0 : template.nodes) !== null && _a !== void 0 ? _a : [])
|
|
335
|
+
.filter(function (n) { return n.type === "document-collection"; })
|
|
336
|
+
.flatMap(function (n) { var _a; return ((_a = n.extractedToUserInput) !== null && _a !== void 0 ? _a : []).map(function (rule) { return extractedRootTarget(rule.field); }); })
|
|
337
|
+
.filter(function (target) { return !!target; }));
|
|
338
|
+
var missing = __spreadArray([], targets, true).filter(function (key) { return !(initialUserInput === null || initialUserInput === void 0 ? void 0 : initialUserInput[key]); });
|
|
339
|
+
if (!missing.length)
|
|
340
|
+
return;
|
|
341
|
+
var cancelled = false;
|
|
342
|
+
fetchSessionById(sessionId)
|
|
343
|
+
.then(function (fresh) {
|
|
344
|
+
var _a;
|
|
345
|
+
var server = ((_a = fresh === null || fresh === void 0 ? void 0 : fresh.userInput) !== null && _a !== void 0 ? _a : {});
|
|
346
|
+
var fill = missing.filter(function (key) { return typeof server[key] === "string" && server[key]; });
|
|
347
|
+
if (cancelled || !fill.length)
|
|
348
|
+
return;
|
|
349
|
+
setUserInput(function (prev) {
|
|
350
|
+
var next = __assign({}, prev);
|
|
351
|
+
for (var _i = 0, fill_2 = fill; _i < fill_2.length; _i++) {
|
|
352
|
+
var key = fill_2[_i];
|
|
353
|
+
if (!next[key])
|
|
354
|
+
next[key] = server[key];
|
|
355
|
+
}
|
|
356
|
+
return next;
|
|
357
|
+
});
|
|
358
|
+
setForm(function (prev) {
|
|
359
|
+
var next = __assign({}, prev);
|
|
360
|
+
for (var _i = 0, fill_3 = fill; _i < fill_3.length; _i++) {
|
|
361
|
+
var key = fill_3[_i];
|
|
362
|
+
if (key === "birthDate") {
|
|
363
|
+
if (!prev.birthDate && !prev.day && !prev.month && !prev.year) {
|
|
364
|
+
next.birthDate = server.birthDate;
|
|
365
|
+
Object.assign(next, parseBirthDate(next.birthDate));
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
else if (key in prev && !next[key]) {
|
|
369
|
+
next[key] = server[key];
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
return next;
|
|
373
|
+
});
|
|
374
|
+
})
|
|
375
|
+
.catch(function (error) {
|
|
376
|
+
console.warn("[UserInputForm] Champs extraits reportés indisponibles", error);
|
|
377
|
+
});
|
|
378
|
+
return function () {
|
|
379
|
+
cancelled = true;
|
|
380
|
+
};
|
|
381
|
+
}, []); // Une seule relecture à l'ouverture du nœud.
|
|
270
382
|
// Re-synchronise customFormData depuis initialUserInput quand on (ré)affiche un
|
|
271
383
|
// nœud DIFFÉRENT sur une instance réutilisée (retour arrière sans remount).
|
|
272
384
|
// Le champ form standard a déjà son propre effet de re-sync ci-dessus ; le
|
package/dist/esm/i18n/en.json.js
CHANGED
|
@@ -781,11 +781,21 @@ 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
|
+
},
|
|
784
790
|
error_title: "Camera error",
|
|
785
791
|
retry: "Retry",
|
|
786
792
|
document_detected: "Document detected"
|
|
787
793
|
},
|
|
788
794
|
photo: {
|
|
795
|
+
hint: {
|
|
796
|
+
too_dark: "Too dark, find more light",
|
|
797
|
+
too_bright: "Too much glare, avoid direct light"
|
|
798
|
+
},
|
|
789
799
|
capture_failed: "Capture failed. Please try again.",
|
|
790
800
|
mode_autocapture: "Autocapture enabled",
|
|
791
801
|
mode_manual: "Manual mode",
|
package/dist/esm/i18n/es.json.js
CHANGED
|
@@ -781,11 +781,21 @@ 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
|
+
},
|
|
784
790
|
error_title: "Error de cámara",
|
|
785
791
|
retry: "Reintentar",
|
|
786
792
|
document_detected: "Documento detectado"
|
|
787
793
|
},
|
|
788
794
|
photo: {
|
|
795
|
+
hint: {
|
|
796
|
+
too_dark: "Demasiado oscuro, busque más luz",
|
|
797
|
+
too_bright: "Demasiados reflejos, evite la luz directa"
|
|
798
|
+
},
|
|
789
799
|
capture_failed: "La captura ha fallado. Inténtalo de nuevo.",
|
|
790
800
|
mode_autocapture: "Captura automática activada",
|
|
791
801
|
mode_manual: "Modo manual",
|
package/dist/esm/i18n/fr.json.js
CHANGED
|
@@ -781,11 +781,21 @@ 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
|
+
},
|
|
784
790
|
error_title: "Erreur de caméra",
|
|
785
791
|
retry: "Réessayer",
|
|
786
792
|
document_detected: "Document détecté"
|
|
787
793
|
},
|
|
788
794
|
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
|
+
},
|
|
789
799
|
capture_failed: "La capture a échoué. Veuillez réessayer.",
|
|
790
800
|
mode_autocapture: "Autocapture activée",
|
|
791
801
|
mode_manual: "Mode manuel",
|