datakeen-session-react 1.1.202-dev.16 → 1.1.202-dev.17
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 +9 -0
- package/dist/cjs/components/selfie/Video.js +2 -2
- package/dist/cjs/components/selfie/selfie-flow/SelfieFlow.js +4 -2
- package/dist/cjs/components/session/DocumentCheck.js +18 -0
- package/dist/cjs/components/session/EndFlow.js +4 -0
- package/dist/cjs/components/session/Selfie.js +1 -1
- package/dist/cjs/components/signature-electronic/SignatureElectronic.js +9 -2
- package/dist/cjs/components/template/TemplateNodeRenderer.js +3 -1
- package/dist/cjs/components/ui/Button.js +3 -3
- package/dist/cjs/hooks/useClientInfo.js +7 -0
- package/dist/cjs/hooks/useUserInputForm.js +3 -1
- package/dist/cjs/i18n/en.json.js +28 -1
- package/dist/cjs/i18n/es.json.js +28 -1
- package/dist/cjs/i18n/fr.json.js +28 -1
- package/dist/cjs/index.css.js +1 -1
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/preview/DatakeenJourneyPreview.js +257 -0
- package/dist/cjs/preview/PreviewAutomaticStep.js +23 -0
- package/dist/cjs/preview/PreviewBranchPicker.js +54 -0
- package/dist/cjs/preview/PreviewCaptureDisabled.js +19 -0
- package/dist/cjs/preview/previewAdapter.js +27 -0
- package/dist/cjs/preview/previewMode.js +21 -0
- package/dist/cjs/preview/previewNavigation.js +105 -0
- package/dist/cjs/services/api.js +5 -0
- package/dist/cjs/services/cameraService.js +6 -0
- package/dist/cjs/services/realtime/sseClient.js +4 -0
- package/dist/cjs/services/sessionService.js +7 -0
- package/dist/cjs/utils/cssLoader.js +6 -4
- package/dist/cjs/utils/isMobileDevice.js +8 -0
- package/dist/esm/components/document-collection/DocumentCollection.js +10 -1
- package/dist/esm/components/selfie/Video.js +2 -2
- package/dist/esm/components/selfie/selfie-flow/SelfieFlow.js +4 -2
- package/dist/esm/components/session/DocumentCheck.js +18 -0
- package/dist/esm/components/session/EndFlow.js +4 -0
- package/dist/esm/components/session/Selfie.js +1 -1
- package/dist/esm/components/signature-electronic/SignatureElectronic.js +9 -2
- package/dist/esm/components/template/TemplateNodeRenderer.js +3 -1
- package/dist/esm/components/ui/Button.js +3 -3
- package/dist/esm/hooks/useClientInfo.js +7 -0
- package/dist/esm/hooks/useUserInputForm.js +3 -1
- package/dist/esm/i18n/en.json.js +28 -2
- package/dist/esm/i18n/es.json.js +28 -2
- package/dist/esm/i18n/fr.json.js +28 -2
- package/dist/esm/index.css.js +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/preview/DatakeenJourneyPreview.js +253 -0
- package/dist/esm/preview/PreviewAutomaticStep.js +19 -0
- package/dist/esm/preview/PreviewBranchPicker.js +48 -0
- package/dist/esm/preview/PreviewCaptureDisabled.js +15 -0
- package/dist/esm/preview/previewAdapter.js +25 -0
- package/dist/esm/preview/previewMode.js +15 -0
- package/dist/esm/preview/previewNavigation.js +98 -0
- package/dist/esm/services/api.js +5 -0
- package/dist/esm/services/cameraService.js +6 -0
- package/dist/esm/services/realtime/sseClient.js +4 -0
- package/dist/esm/services/sessionService.js +7 -0
- package/dist/esm/utils/cssLoader.js +6 -4
- package/dist/esm/utils/isMobileDevice.js +8 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/preview/DatakeenJourneyPreview.d.ts +6 -0
- package/dist/types/preview/types.d.ts +77 -0
- package/dist/types/services/documentTemplate.d.ts +13 -0
- package/dist/types/types/session.d.ts +254 -1
- package/dist/types/utils/cssLoader.d.ts +0 -4
- package/package.json +1 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var Button = require('../components/ui/Button.js');
|
|
7
|
+
var PageActions = require('../components/ui/PageActions.js');
|
|
8
|
+
var Title = require('../components/ui/Title.js');
|
|
9
|
+
var Subtitle = require('../components/ui/Subtitle.js');
|
|
10
|
+
var MobilePageLayout = require('../components/ui/MobilePageLayout.js');
|
|
11
|
+
var useI18n = require('../hooks/useI18n.js');
|
|
12
|
+
|
|
13
|
+
var PreviewCaptureDisabled = function (_a) {
|
|
14
|
+
var onContinue = _a.onContinue;
|
|
15
|
+
var t = useI18n.useI18n().t;
|
|
16
|
+
return (jsxRuntime.jsx(MobilePageLayout.default, { footer: onContinue ? (jsxRuntime.jsx(PageActions.default, { primary: jsxRuntime.jsx(Button.default, { testId: "dk-preview-capture-continue", onClick: function () { return onContinue(); }, children: t("buttons.continue") }) })) : null, children: jsxRuntime.jsx("div", { "data-testid": "dk-preview-capture-disabled", className: "px-4 py-8 md:px-8 flex flex-col", children: jsxRuntime.jsxs("div", { className: "w-full max-w-md mx-auto space-y-4 text-center", children: [jsxRuntime.jsx(Title.default, { className: "text-xl md:text-2xl", children: t("preview.capture_disabled.title") }), jsxRuntime.jsx(Subtitle.default, { className: "text-sm text-gray-600 leading-relaxed", children: t("preview.capture_disabled.description") })] }) }) }));
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
exports.default = PreviewCaptureDisabled;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tslib_es6 = require('../node_modules/tslib/tslib.es6.js');
|
|
4
|
+
var previewMode = require('./previewMode.js');
|
|
5
|
+
|
|
6
|
+
var DOCUMENT_TEMPLATES_PATH = "document/get-all-document-templates";
|
|
7
|
+
var previewAdapter = function (config) { return tslib_es6.__awaiter(void 0, void 0, void 0, function () {
|
|
8
|
+
var url, data, response;
|
|
9
|
+
var _a;
|
|
10
|
+
return tslib_es6.__generator(this, function (_b) {
|
|
11
|
+
url = (_a = config.url) !== null && _a !== void 0 ? _a : "";
|
|
12
|
+
data = url.includes(DOCUMENT_TEMPLATES_PATH)
|
|
13
|
+
? { status: 200, message: "preview", data: previewMode.getPreviewDocumentTemplates() }
|
|
14
|
+
: {};
|
|
15
|
+
response = {
|
|
16
|
+
data: data,
|
|
17
|
+
status: 200,
|
|
18
|
+
statusText: "OK",
|
|
19
|
+
headers: {},
|
|
20
|
+
config: config,
|
|
21
|
+
request: {},
|
|
22
|
+
};
|
|
23
|
+
return [2 /*return*/, response];
|
|
24
|
+
});
|
|
25
|
+
}); };
|
|
26
|
+
|
|
27
|
+
exports.previewAdapter = previewAdapter;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var previewState = null;
|
|
4
|
+
var enablePreviewMode = function (_a) {
|
|
5
|
+
var device = _a.device, documentTemplates = _a.documentTemplates;
|
|
6
|
+
previewState = { device: device, documentTemplates: documentTemplates !== null && documentTemplates !== void 0 ? documentTemplates : [] };
|
|
7
|
+
};
|
|
8
|
+
var disablePreviewMode = function () {
|
|
9
|
+
previewState = null;
|
|
10
|
+
};
|
|
11
|
+
var isPreviewMode = function () { return previewState !== null; };
|
|
12
|
+
/** Appareil simulé, null hors aperçu. */
|
|
13
|
+
var getPreviewDevice = function () { var _a; return (_a = previewState === null || previewState === void 0 ? void 0 : previewState.device) !== null && _a !== void 0 ? _a : null; };
|
|
14
|
+
/** Modèles de documents fournis par le builder (liste vide hors aperçu ou si non fournis). */
|
|
15
|
+
var getPreviewDocumentTemplates = function () { var _a; return (_a = previewState === null || previewState === void 0 ? void 0 : previewState.documentTemplates) !== null && _a !== void 0 ? _a : []; };
|
|
16
|
+
|
|
17
|
+
exports.disablePreviewMode = disablePreviewMode;
|
|
18
|
+
exports.enablePreviewMode = enablePreviewMode;
|
|
19
|
+
exports.getPreviewDevice = getPreviewDevice;
|
|
20
|
+
exports.getPreviewDocumentTemplates = getPreviewDocumentTemplates;
|
|
21
|
+
exports.isPreviewMode = isPreviewMode;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tslib_es6 = require('../node_modules/tslib/tslib.es6.js');
|
|
4
|
+
var sessionService = require('../services/sessionService.js');
|
|
5
|
+
|
|
6
|
+
/** Nœuds exécutés sans écran pour l'utilisateur final : l'aperçu affiche un écran neutre. */
|
|
7
|
+
var AUTOMATIC_NODE_TYPES = new Set([
|
|
8
|
+
"condition",
|
|
9
|
+
"external-verification",
|
|
10
|
+
"complementary-mandate",
|
|
11
|
+
"pdf-generation",
|
|
12
|
+
"hybrid-verification",
|
|
13
|
+
"task-assignment",
|
|
14
|
+
// Après la fin, sans écran pour l'utilisateur : export et notification de fin de session (APP3-2033).
|
|
15
|
+
"storage-export",
|
|
16
|
+
"session-end-email",
|
|
17
|
+
]);
|
|
18
|
+
var isAutomaticNodeType = function (type) {
|
|
19
|
+
return AUTOMATIC_NODE_TYPES.has(type);
|
|
20
|
+
};
|
|
21
|
+
/** Vue « template » minimale pour les helpers du sessionService (lecture seule). */
|
|
22
|
+
var asTemplate = function (journey) {
|
|
23
|
+
return ({ nodes: journey.nodes, edges: journey.edges });
|
|
24
|
+
};
|
|
25
|
+
var findNode = function (journey, nodeId) {
|
|
26
|
+
return journey.nodes.find(function (n) { return n.id === nodeId; });
|
|
27
|
+
};
|
|
28
|
+
/** Cible du lien sortant du nœud START (null si absent ou non relié). */
|
|
29
|
+
var getFirstScreenNodeId = function (journey) {
|
|
30
|
+
var start = journey.nodes.find(function (n) { return n.type === "start"; });
|
|
31
|
+
if (!start)
|
|
32
|
+
return null;
|
|
33
|
+
var edge = sessionService.findOutgoingEdge(start.id, asTemplate(journey));
|
|
34
|
+
if (!edge || !findNode(journey, edge.target))
|
|
35
|
+
return null;
|
|
36
|
+
return edge.target;
|
|
37
|
+
};
|
|
38
|
+
/** Liens sortants vers un nœud existant, dans l'ordre des edges. */
|
|
39
|
+
var getOutgoingBranches = function (journey, nodeId) {
|
|
40
|
+
return (journey.edges || [])
|
|
41
|
+
.filter(function (edge) { return edge.source === nodeId && !!findNode(journey, edge.target); })
|
|
42
|
+
.map(function (edge) { return ({
|
|
43
|
+
edgeId: edge.id,
|
|
44
|
+
targetId: edge.target,
|
|
45
|
+
handle: edge.sourceHandle || edge.conditionValue || null,
|
|
46
|
+
}); });
|
|
47
|
+
};
|
|
48
|
+
/** Écran à afficher pour un nœud (null, START ou id inconnu → accueil). */
|
|
49
|
+
var resolvePreviewScreen = function (journey, nodeId) {
|
|
50
|
+
if (!nodeId)
|
|
51
|
+
return { kind: "start" };
|
|
52
|
+
var node = findNode(journey, nodeId);
|
|
53
|
+
if (!node || node.type === "start")
|
|
54
|
+
return { kind: "start" };
|
|
55
|
+
if (isAutomaticNodeType(node.type))
|
|
56
|
+
return { kind: "automatic", node: node };
|
|
57
|
+
return { kind: "node", node: node };
|
|
58
|
+
};
|
|
59
|
+
/** Session fictive (jamais terminée, sans données) construite depuis le parcours du builder. */
|
|
60
|
+
var buildPreviewSession = function (journey, device) {
|
|
61
|
+
var _a;
|
|
62
|
+
var template = tslib_es6.__assign({ id: "preview", name: (_a = journey.name) !== null && _a !== void 0 ? _a : "", description: "", version: "", languages: journey.languages ? tslib_es6.__spreadArray([], journey.languages, true) : [], nodes: tslib_es6.__spreadArray([], journey.nodes, true), edges: tslib_es6.__spreadArray([], journey.edges, true), groupId: "", userId: null, created_at: "", updated_at: "", platforms: journey.platforms, logo: journey.logo, showQRCode: journey.showQRCode, buttonBgColor: journey.buttonBgColor, buttonTextColor: journey.buttonTextColor,
|
|
63
|
+
// Textes en cours d'édition : EndFlow ignore un cas sans item (repli sur l'écran standard).
|
|
64
|
+
endScreenConfig: journey.endScreenConfig }, (journey.actionPhrase !== undefined ? { actionPhrase: journey.actionPhrase } : {}));
|
|
65
|
+
return {
|
|
66
|
+
id: "preview",
|
|
67
|
+
userId: null,
|
|
68
|
+
token: "",
|
|
69
|
+
templateId: "preview",
|
|
70
|
+
templateKey: "preview",
|
|
71
|
+
expireTime: 0,
|
|
72
|
+
status: "in-progress",
|
|
73
|
+
result: {},
|
|
74
|
+
landingPage: null,
|
|
75
|
+
withSelfie: null,
|
|
76
|
+
groupId: null,
|
|
77
|
+
userInput: {},
|
|
78
|
+
callbackURL: null,
|
|
79
|
+
webhookURL: "",
|
|
80
|
+
analysisTemplateId: null,
|
|
81
|
+
userAgent: [],
|
|
82
|
+
mobile: device === "mobile",
|
|
83
|
+
analysisId: null,
|
|
84
|
+
currentStep: 0,
|
|
85
|
+
createdAt: "",
|
|
86
|
+
updatedAt: "",
|
|
87
|
+
auditTrail: [],
|
|
88
|
+
user: null,
|
|
89
|
+
analysis: [],
|
|
90
|
+
documents: [],
|
|
91
|
+
template: template,
|
|
92
|
+
retryCounts: {},
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
/** Statut passé à EndFlow pour afficher l'écran conforme / non conforme. */
|
|
96
|
+
var previewEndStatus = function (result) {
|
|
97
|
+
return result === "non_compliant" ? "ai_rejected" : "ai_approved";
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
exports.buildPreviewSession = buildPreviewSession;
|
|
101
|
+
exports.getFirstScreenNodeId = getFirstScreenNodeId;
|
|
102
|
+
exports.getOutgoingBranches = getOutgoingBranches;
|
|
103
|
+
exports.isAutomaticNodeType = isAutomaticNodeType;
|
|
104
|
+
exports.previewEndStatus = previewEndStatus;
|
|
105
|
+
exports.resolvePreviewScreen = resolvePreviewScreen;
|
package/dist/cjs/services/api.js
CHANGED
|
@@ -4,6 +4,8 @@ var tslib_es6 = require('../node_modules/tslib/tslib.es6.js');
|
|
|
4
4
|
var sessionCredentials = require('./sessionCredentials.js');
|
|
5
5
|
var axios = require('axios');
|
|
6
6
|
var env = require('../config/env.js');
|
|
7
|
+
var previewMode = require('../preview/previewMode.js');
|
|
8
|
+
var previewAdapter = require('../preview/previewAdapter.js');
|
|
7
9
|
|
|
8
10
|
// Helpers
|
|
9
11
|
var normalizeBaseURL = function (url) {
|
|
@@ -79,6 +81,9 @@ var ApiService = /** @class */ (function () {
|
|
|
79
81
|
// Intercepteur de requête
|
|
80
82
|
this.client.interceptors.request.use(function (config) {
|
|
81
83
|
var _a, _b;
|
|
84
|
+
// APP3-2057 — aperçu du builder : aucune requête ne part sur le réseau.
|
|
85
|
+
if (previewMode.isPreviewMode())
|
|
86
|
+
config.adapter = previewAdapter.previewAdapter;
|
|
82
87
|
var token = sessionCredentials.credentialForRequest((_a = config.url) !== null && _a !== void 0 ? _a : "");
|
|
83
88
|
if (token)
|
|
84
89
|
config.headers.set("X-Session-Token", token);
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
var tslib_es6 = require('../node_modules/tslib/tslib.es6.js');
|
|
4
4
|
var cameraResolution = require('../utils/cameraResolution.js');
|
|
5
5
|
var professionalImageQuality = require('./professionalImageQuality.js');
|
|
6
|
+
var previewMode = require('../preview/previewMode.js');
|
|
7
|
+
var index = require('../i18n/index.js');
|
|
6
8
|
|
|
7
9
|
// Permit to enable development mode to test without a camera
|
|
8
10
|
var DEV_MODE = false; // import.meta.env.DEV;
|
|
@@ -92,6 +94,10 @@ var CameraService = /** @class */ (function () {
|
|
|
92
94
|
return tslib_es6.__generator(this, function (_b) {
|
|
93
95
|
switch (_b.label) {
|
|
94
96
|
case 0:
|
|
97
|
+
// APP3-2057 — aperçu du builder : la caméra n'est jamais ouverte.
|
|
98
|
+
if (previewMode.isPreviewMode()) {
|
|
99
|
+
return [2 /*return*/, { success: false, error: index.default.t("preview.capture_disabled.title") }];
|
|
100
|
+
}
|
|
95
101
|
if (this.devMode) {
|
|
96
102
|
return [2 /*return*/, this.startMockCamera(videoElement)];
|
|
97
103
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var tslib_es6 = require('../../node_modules/tslib/tslib.es6.js');
|
|
4
4
|
var sseParser = require('./sseParser.js');
|
|
5
|
+
var previewMode = require('../../preview/previewMode.js');
|
|
5
6
|
|
|
6
7
|
var FATAL_STATUSES = new Set([401, 403, 404]);
|
|
7
8
|
/**
|
|
@@ -17,6 +18,9 @@ function openSseStream(_a) {
|
|
|
17
18
|
}
|
|
18
19
|
return fetch.apply(void 0, args);
|
|
19
20
|
} : _b, _c = _a.initialRetryMs, initialRetryMs = _c === void 0 ? 1000 : _c, _d = _a.maxRetryMs, maxRetryMs = _d === void 0 ? 30000 : _d, _e = _a.idleTimeoutMs, idleTimeoutMs = _e === void 0 ? 60000 : _e, _f = _a.random, random = _f === void 0 ? Math.random : _f;
|
|
21
|
+
// APP3-2057 — aperçu du builder : aucun flux temps réel n'est ouvert.
|
|
22
|
+
if (previewMode.isPreviewMode())
|
|
23
|
+
return { close: function () { }, reconnect: function () { } };
|
|
20
24
|
var closed = false;
|
|
21
25
|
var controller = null;
|
|
22
26
|
var timer;
|
|
@@ -4,6 +4,7 @@ var tslib_es6 = require('../node_modules/tslib/tslib.es6.js');
|
|
|
4
4
|
var api = require('./api.js');
|
|
5
5
|
var auditTrailService = require('./auditTrailService.js');
|
|
6
6
|
var sessionMemoryStore = require('./sessionMemoryStore.js');
|
|
7
|
+
var previewMode = require('../preview/previewMode.js');
|
|
7
8
|
|
|
8
9
|
/** Reports camera diagnostics without updating local session state. */
|
|
9
10
|
function reportCaptureDiagnostics(sessionId, nodeId, diag) {
|
|
@@ -401,6 +402,9 @@ var isSessionExpired = function (session) {
|
|
|
401
402
|
* @param options - The options to store
|
|
402
403
|
*/
|
|
403
404
|
var storeDocumentOptions = function (sessionId, documentTypeId, options) {
|
|
405
|
+
// APP3-2057 — aperçu du builder : rien n'est écrit dans le stockage du navigateur.
|
|
406
|
+
if (previewMode.isPreviewMode())
|
|
407
|
+
return;
|
|
404
408
|
if (!sessionId || !documentTypeId || !options || options.length === 0) {
|
|
405
409
|
console.warn("Missing data for storeDocumentOptions:", {
|
|
406
410
|
sessionId: sessionId,
|
|
@@ -469,6 +473,9 @@ var clearStorageBySessionId = function (sessionId) {
|
|
|
469
473
|
* for a given session. This is intentionally aggressive for security.
|
|
470
474
|
*/
|
|
471
475
|
var clearSessionSensitiveData = function (sessionId) {
|
|
476
|
+
// APP3-2057 — aperçu du builder : aucune donnée de session réelle à nettoyer.
|
|
477
|
+
if (previewMode.isPreviewMode())
|
|
478
|
+
return;
|
|
472
479
|
sessionMemoryStore.clearSessionMemory(sessionId);
|
|
473
480
|
if (sessionId) {
|
|
474
481
|
clearStorageBySessionId(sessionId);
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var tslib_es6 = require('../node_modules/tslib/tslib.es6.js');
|
|
4
|
+
var previewMode = require('../preview/previewMode.js');
|
|
4
5
|
|
|
5
|
-
/**
|
|
6
|
-
* CSS Route Loading Utility
|
|
7
|
-
* Dynamically loads and manages CSS files based on routes/components
|
|
8
|
-
*/
|
|
9
6
|
var CSSLoader = /** @class */ (function () {
|
|
10
7
|
function CSSLoader(baseUrl) {
|
|
11
8
|
if (baseUrl === void 0) { baseUrl = ''; }
|
|
@@ -22,6 +19,9 @@ var CSSLoader = /** @class */ (function () {
|
|
|
22
19
|
var fullPath, existing;
|
|
23
20
|
var _this = this;
|
|
24
21
|
return tslib_es6.__generator(this, function (_a) {
|
|
22
|
+
// APP3-2057 — aperçu du builder : aucune balise <link> (pas de GET vers l'hôte).
|
|
23
|
+
if (previewMode.isPreviewMode())
|
|
24
|
+
return [2 /*return*/];
|
|
25
25
|
fullPath = "".concat(this.baseUrl).concat(cssPath);
|
|
26
26
|
existing = this.loadedCSS.get(routeName);
|
|
27
27
|
if (existing) {
|
|
@@ -66,6 +66,8 @@ var CSSLoader = /** @class */ (function () {
|
|
|
66
66
|
* @param cssContent - CSS content as string
|
|
67
67
|
*/
|
|
68
68
|
CSSLoader.prototype.loadInlineCSS = function (routeName, cssContent) {
|
|
69
|
+
if (previewMode.isPreviewMode())
|
|
70
|
+
return;
|
|
69
71
|
// Check if already loaded
|
|
70
72
|
if (this.loadedCSS.has(routeName)) {
|
|
71
73
|
var existing = this.loadedCSS.get(routeName);
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var previewMode = require('../preview/previewMode.js');
|
|
4
|
+
|
|
3
5
|
/**
|
|
4
6
|
* Détection du type d'appareil par userAgent (plus fiable que la largeur d'écran : un poste de
|
|
5
7
|
* bureau dans une fenêtre étroite ne doit pas être traité comme un mobile).
|
|
@@ -8,6 +10,10 @@
|
|
|
8
10
|
* ouvre directement l'application `/scan/:sessionId` plutôt que d'afficher un QR code.
|
|
9
11
|
*/
|
|
10
12
|
var isMobileDevice = function () {
|
|
13
|
+
// APP3-2057 — aperçu du builder : l'appareil choisi prime sur le user-agent du poste.
|
|
14
|
+
var previewDevice = previewMode.getPreviewDevice();
|
|
15
|
+
if (previewDevice)
|
|
16
|
+
return previewDevice === "mobile";
|
|
11
17
|
if (typeof navigator === "undefined")
|
|
12
18
|
return false;
|
|
13
19
|
return /Android|iPhone|iPad|iPod|Opera Mini|IEMobile|WPDesktop/i.test(navigator.userAgent);
|
|
@@ -18,6 +24,8 @@ var isMobileDevice = function () {
|
|
|
18
24
|
* utilisateur) vers le schéma custom de l'app.
|
|
19
25
|
*/
|
|
20
26
|
var isIOSDevice = function () {
|
|
27
|
+
if (previewMode.getPreviewDevice())
|
|
28
|
+
return false;
|
|
21
29
|
if (typeof navigator === "undefined")
|
|
22
30
|
return false;
|
|
23
31
|
return /iPhone|iPad|iPod/i.test(navigator.userAgent);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __assign, __awaiter, __generator, __spreadArray } from '../../node_modules/tslib/tslib.es6.js';
|
|
2
|
-
import {
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
3
|
import { useState, useEffect } from 'react';
|
|
4
4
|
import DocumentCollectionIntroduction from './DocumentCollectionIntroduction.js';
|
|
5
5
|
import DocumentCollectionSelection from './DocumentCollectionSelection.js';
|
|
@@ -18,6 +18,8 @@ import ButtonDesktop from '../ui/ButtonDesktop.js';
|
|
|
18
18
|
import { analyzeFiles } from '../../services/analysis.js';
|
|
19
19
|
import { getNodeRetryCount, incrementNodeRetryCount } from '../../services/retryService.js';
|
|
20
20
|
import { getSession } from '../../context/SessionContext.js';
|
|
21
|
+
import { isPreviewMode } from '../../preview/previewMode.js';
|
|
22
|
+
import PreviewCaptureDisabled from '../../preview/PreviewCaptureDisabled.js';
|
|
21
23
|
import { blobToDataUrl, dataUrlToBlob, resizeAfterCapture } from '../../utils/imageProcessing.js';
|
|
22
24
|
|
|
23
25
|
/**
|
|
@@ -286,6 +288,13 @@ var DocumentCollection = function (_a) {
|
|
|
286
288
|
setCurrentStep(currentStep - 1);
|
|
287
289
|
}
|
|
288
290
|
};
|
|
291
|
+
// APP3-2057 — aperçu du builder : ni caméra, ni upload, ni analyse. Les écrans d'introduction,
|
|
292
|
+
// de sélection et de choix de méthode restent les vrais ; la capture est remplacée.
|
|
293
|
+
if (isPreviewMode() &&
|
|
294
|
+
(currentStep === 4 ||
|
|
295
|
+
(currentStep === 3 && (selectedMethod === "download" || photoSubStep !== "before-recto")))) {
|
|
296
|
+
return jsx(PreviewCaptureDisabled, { onContinue: handleSuccessContinue });
|
|
297
|
+
}
|
|
289
298
|
switch (currentStep) {
|
|
290
299
|
case 0:
|
|
291
300
|
return (jsx(DocumentCollectionIntroduction, { onContinue: handleContinueFromIntroduction, onBack: stepObject.canGoBack ? handleBack : undefined, introductionPage: introductionPage }));
|
|
@@ -6,7 +6,7 @@ import SelfieFlow from './selfie-flow/SelfieFlow.js';
|
|
|
6
6
|
import VideoResetStyles from './VideoResetStyles.js';
|
|
7
7
|
|
|
8
8
|
var Video = function (_a) {
|
|
9
|
-
var setSelfieData = _a.setSelfieData, setStep = _a.setStep, sessionId = _a.sessionId, iad = _a.iad, btnBg = _a.btnBg, btnText = _a.btnText;
|
|
9
|
+
var setSelfieData = _a.setSelfieData, setStep = _a.setStep, sessionId = _a.sessionId, iad = _a.iad, btnBg = _a.btnBg, btnText = _a.btnText, onPreviewContinue = _a.onPreviewContinue;
|
|
10
10
|
// Effet pour ajouter la classe au body lorsque le composant est monté
|
|
11
11
|
useEffect(function () {
|
|
12
12
|
// Empêcher le scroll sur le body lorsque la capture est active
|
|
@@ -28,7 +28,7 @@ var Video = function (_a) {
|
|
|
28
28
|
setStep(1); // Move to the next step after selfie capture
|
|
29
29
|
}, 300);
|
|
30
30
|
};
|
|
31
|
-
return (jsxs("div", { className: "w-full h-full overflow-hidden flex flex-col", children: [jsx(VideoResetStyles, {}), jsx(SelfieFlow, { handleSelfie: handleSelfie, sessionId: sessionId, iad: iad, btnBg: btnBg, btnText: btnText })] }));
|
|
31
|
+
return (jsxs("div", { className: "w-full h-full overflow-hidden flex flex-col", children: [jsx(VideoResetStyles, {}), jsx(SelfieFlow, { handleSelfie: handleSelfie, sessionId: sessionId, iad: iad, btnBg: btnBg, btnText: btnText, onPreviewContinue: onPreviewContinue })] }));
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
export { Video as default };
|
|
@@ -3,16 +3,18 @@ import { lazy, useState, Suspense } from 'react';
|
|
|
3
3
|
import SelfiePreIntroduction from './SelfiePreIntroduction.js';
|
|
4
4
|
import InstructionsSelfie from './InstructionsSelfie.js';
|
|
5
5
|
import LoadingState from '../../states/LoadingState.js';
|
|
6
|
+
import { isPreviewMode } from '../../../preview/previewMode.js';
|
|
7
|
+
import PreviewCaptureDisabled from '../../../preview/PreviewCaptureDisabled.js';
|
|
6
8
|
|
|
7
9
|
var SelfieRecorder = lazy(function () { return import('./SelfieRecorder.js'); });
|
|
8
10
|
var SelfieFlow = function (_a) {
|
|
9
11
|
var _b;
|
|
10
|
-
var handleSelfie = _a.handleSelfie, sessionId = _a.sessionId, iad = _a.iad, btnBg = _a.btnBg, btnText = _a.btnText;
|
|
12
|
+
var handleSelfie = _a.handleSelfie, sessionId = _a.sessionId, iad = _a.iad, btnBg = _a.btnBg, btnText = _a.btnText, onPreviewContinue = _a.onPreviewContinue;
|
|
11
13
|
var _c = useState(-1), internalStep = _c[0], setInternalStep = _c[1]; // Commencer à -1 pour la pré-introduction
|
|
12
14
|
return (jsxs("div", { className: "h-full w-full flex flex-col", style: (_b = {},
|
|
13
15
|
_b["--dk-btn-bg"] = btnBg !== null && btnBg !== void 0 ? btnBg : "#11E5C5",
|
|
14
16
|
_b["--dk-btn-text"] = btnText !== null && btnText !== void 0 ? btnText : "#3C3C40",
|
|
15
|
-
_b), children: [internalStep === -1 && (jsx("div", { className: "flex-1 flex flex-col h-full", children: jsx(SelfiePreIntroduction, { onContinue: function () { return setInternalStep(0); } }) })), internalStep === 0 && (jsx("div", { className: "flex-1 flex flex-col h-full", children: jsx(InstructionsSelfie, { setStep: setInternalStep, onBack: function () { return setInternalStep(-1); } }) })), internalStep === 1 && (jsx("div", { className: "flex-1 flex flex-col h-full overflow-hidden", children: jsx(Suspense, { fallback: jsx(LoadingState, {}), children: jsx(SelfieRecorder, { handleSelfie: handleSelfie, sessionId: sessionId, iad: iad, btnBg: btnBg, btnText: btnText }) }) }))] }));
|
|
17
|
+
_b), children: [internalStep === -1 && (jsx("div", { className: "flex-1 flex flex-col h-full", children: jsx(SelfiePreIntroduction, { onContinue: function () { return setInternalStep(0); } }) })), internalStep === 0 && (jsx("div", { className: "flex-1 flex flex-col h-full", children: jsx(InstructionsSelfie, { setStep: setInternalStep, onBack: function () { return setInternalStep(-1); } }) })), internalStep === 1 && isPreviewMode() && (jsx("div", { className: "flex-1 flex flex-col h-full", children: jsx(PreviewCaptureDisabled, { onContinue: onPreviewContinue }) })), internalStep === 1 && !isPreviewMode() && (jsx("div", { className: "flex-1 flex flex-col h-full overflow-hidden", children: jsx(Suspense, { fallback: jsx(LoadingState, {}), children: jsx(SelfieRecorder, { handleSelfie: handleSelfie, sessionId: sessionId, iad: iad, btnBg: btnBg, btnText: btnText }) }) }))] }));
|
|
16
18
|
};
|
|
17
19
|
|
|
18
20
|
export { SelfieFlow as default };
|
|
@@ -31,6 +31,8 @@ import { hasOutgoingEdgeForHandle, updateSessionUserInput, skipNfcWithReason } f
|
|
|
31
31
|
import NfcScanStep from '../nfc-scan/NfcScanNode.js';
|
|
32
32
|
import NfcChipGate from '../nfc-scan/NfcChipGate.js';
|
|
33
33
|
import NfcFallbackSurvey from '../nfc-scan/NfcFallbackSurvey.js';
|
|
34
|
+
import { isPreviewMode } from '../../preview/previewMode.js';
|
|
35
|
+
import PreviewCaptureDisabled from '../../preview/PreviewCaptureDisabled.js';
|
|
34
36
|
import { resolveControleJdiOutcomeRoute, normalizeMaxResubmissionAction, hasExceededResubmissionAttempts } from './controleJdiPolicy.js';
|
|
35
37
|
import { EUROPEAN_COUNTRY_CODES } from '../../utils/europeanCountries.js';
|
|
36
38
|
|
|
@@ -716,6 +718,17 @@ var DocumentCheck = function (_a) {
|
|
|
716
718
|
setDocStep(function (prev) { return prev - 1; });
|
|
717
719
|
}
|
|
718
720
|
};
|
|
721
|
+
// APP3-2057 — aperçu du builder : ni caméra, ni upload, ni analyse, ni scan NFC. Les écrans
|
|
722
|
+
// d'introduction et de sélection restent les vrais ; la capture est remplacée par un écran neutre.
|
|
723
|
+
var renderPreviewCaptureDisabled = function () {
|
|
724
|
+
var previewTemplate = template;
|
|
725
|
+
return (jsx(PreviewCaptureDisabled, { onContinue: previewTemplate
|
|
726
|
+
? function () { return stepObject.goToNextStep(node.id, previewTemplate); }
|
|
727
|
+
: undefined }));
|
|
728
|
+
};
|
|
729
|
+
if (isPreviewMode() && (docStep === 4 || docStep === 7)) {
|
|
730
|
+
return renderPreviewCaptureDisabled();
|
|
731
|
+
}
|
|
719
732
|
switch (docStep) {
|
|
720
733
|
case -1: {
|
|
721
734
|
var hasIntroduction_1 = ((_f = node.introductionPage) === null || _f === void 0 ? void 0 : _f.title) !== undefined ||
|
|
@@ -758,6 +771,9 @@ var DocumentCheck = function (_a) {
|
|
|
758
771
|
var activeMethod = selectedMethod ||
|
|
759
772
|
(isPictureAllowed && isMobileCapture ? "picture" : "download");
|
|
760
773
|
if (activeMethod === "picture" && isPictureAllowed) {
|
|
774
|
+
if (isPreviewMode() && currentPhotoStep !== "before-recto") {
|
|
775
|
+
return renderPreviewCaptureDisabled();
|
|
776
|
+
}
|
|
761
777
|
var isSingleSided = (selectedDocumentType === null || selectedDocumentType === void 0 ? void 0 : selectedDocumentType.id) === "passport" ||
|
|
762
778
|
(selectedDocumentType === null || selectedDocumentType === void 0 ? void 0 : selectedDocumentType.id) === "pinkDriverLicense";
|
|
763
779
|
var onConfirm = node.withVideo
|
|
@@ -790,6 +806,8 @@ var DocumentCheck = function (_a) {
|
|
|
790
806
|
return (jsx(BeforePhoto, { setStep: function () { return setCurrentPhotoStep("recto"); }, isSingleSided: isSingleSided, onBack: function () { return setDocStep(2); } }));
|
|
791
807
|
}
|
|
792
808
|
else {
|
|
809
|
+
if (isPreviewMode())
|
|
810
|
+
return renderPreviewCaptureDisabled();
|
|
793
811
|
return (jsx(JDIDocumentUpload, { title: (_p = node.documentUpload) === null || _p === void 0 ? void 0 : _p.title, description: (_q = node.documentUpload) === null || _q === void 0 ? void 0 : _q.description, documentType: (selectedDocumentType === null || selectedDocumentType === void 0 ? void 0 : selectedDocumentType.id) || documentTypeId, documentTypeId: documentTypeId, documentLabel: selectedDocumentType === null || selectedDocumentType === void 0 ? void 0 : selectedDocumentType.label, onUpload: handleDocumentUpload, onBack: function () {
|
|
794
812
|
if (isPictureAllowed && isDownloadAllowed) {
|
|
795
813
|
setSelectedMethod(null);
|
|
@@ -15,6 +15,7 @@ import { useI18n } from '../../hooks/useI18n.js';
|
|
|
15
15
|
import useIsMobile from '../../hooks/useIsMobile.js';
|
|
16
16
|
import { resolveEndScreenIcon } from './endScreenIcons.js';
|
|
17
17
|
import { replaceLocation } from '../../utils/navigation.js';
|
|
18
|
+
import { isPreviewMode } from '../../preview/previewMode.js';
|
|
18
19
|
|
|
19
20
|
// Couleur des icônes = couleur du bouton choisie pour le journey (buttonBgColor).
|
|
20
21
|
var ICON_COLOR = "var(--dk-btn-bg, #11e5c5)";
|
|
@@ -101,6 +102,9 @@ var EndFlow = function (_a) {
|
|
|
101
102
|
}, []);
|
|
102
103
|
var handleEndSession = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
103
104
|
return __generator(this, function (_a) {
|
|
105
|
+
// APP3-2057 — aperçu du builder : ni fermeture, ni redirection, ni postMessage, ni nettoyage.
|
|
106
|
+
if (isPreviewMode())
|
|
107
|
+
return [2 /*return*/];
|
|
104
108
|
setIsEnding(true);
|
|
105
109
|
try {
|
|
106
110
|
clearSessionSensitiveData(sessionId);
|
|
@@ -45,7 +45,7 @@ var Selfie = function (_a) {
|
|
|
45
45
|
var handleRetakeSelfie = function () {
|
|
46
46
|
setInternalStep(0);
|
|
47
47
|
};
|
|
48
|
-
return (jsxs("div", { className: "h-full w-full transition-opacity duration-500 ".concat(isTransitioning ? "opacity-50" : "opacity-100"), children: [internalStep === 0 && (jsx(Video, { setSelfieData: setSelfieData, setStep: setInternalStep, sessionId: sessionId, iad: node.iad, btnBg: (_b = template.buttonBgColor) !== null && _b !== void 0 ? _b : "#11E5C5", btnText: (_c = template.buttonTextColor) !== null && _c !== void 0 ? _c : "#3C3C40" })), internalStep === 1 && selfieData && (jsx(SelfieConfirmation, { selfieData: selfieData, onConfirm: handleConfirmSelfie, onRetake: handleRetakeSelfie, setSelfiePhoto: setSelfiePhoto })), internalStep === 2 && selfieData && (jsx(SelfieProcessing, { onProcessingComplete: selfieProcessed, selfieVideo: selfieData, selfiePhoto: selfiePhoto, onRetake: onRetake, nodeId: node.id, onContinueAnyway: node.allowContinueOnFailure === false
|
|
48
|
+
return (jsxs("div", { className: "h-full w-full transition-opacity duration-500 ".concat(isTransitioning ? "opacity-50" : "opacity-100"), children: [internalStep === 0 && (jsx(Video, { setSelfieData: setSelfieData, setStep: setInternalStep, sessionId: sessionId, iad: node.iad, btnBg: (_b = template.buttonBgColor) !== null && _b !== void 0 ? _b : "#11E5C5", btnText: (_c = template.buttonTextColor) !== null && _c !== void 0 ? _c : "#3C3C40", onPreviewContinue: function () { return stepObject.goToNextStep(node.id, template); } })), internalStep === 1 && selfieData && (jsx(SelfieConfirmation, { selfieData: selfieData, onConfirm: handleConfirmSelfie, onRetake: handleRetakeSelfie, setSelfiePhoto: setSelfiePhoto })), internalStep === 2 && selfieData && (jsx(SelfieProcessing, { onProcessingComplete: selfieProcessed, selfieVideo: selfieData, selfiePhoto: selfiePhoto, onRetake: onRetake, nodeId: node.id, onContinueAnyway: node.allowContinueOnFailure === false
|
|
49
49
|
? undefined
|
|
50
50
|
: handleContinueAnyway }))] }));
|
|
51
51
|
};
|
|
@@ -5,6 +5,8 @@ import sdkI18n from '../../i18n/index.js';
|
|
|
5
5
|
import SignatureElectronicIntroduction from './SignatureElectronicIntroduction.js';
|
|
6
6
|
import DocusealSignature from './DocusealSignature.js';
|
|
7
7
|
import SignedDocumentPreview from './SignedDocumentPreview.js';
|
|
8
|
+
import { isPreviewMode } from '../../preview/previewMode.js';
|
|
9
|
+
import PreviewCaptureDisabled from '../../preview/PreviewCaptureDisabled.js';
|
|
8
10
|
|
|
9
11
|
/**
|
|
10
12
|
* Maps an InformationFieldKey (journey field) to the corresponding UserInput key.
|
|
@@ -28,14 +30,15 @@ var SignatureElectronic = function (_a) {
|
|
|
28
30
|
var t = useTranslation("translation", { i18n: sdkI18n }).t;
|
|
29
31
|
var signatureViewStorageKey = useMemo(function () { return "dk-signature-open:".concat(sessionId, ":").concat(external_id !== null && external_id !== void 0 ? external_id : "no-template"); }, [sessionId, external_id]);
|
|
30
32
|
var _c = useState(function () {
|
|
31
|
-
if (typeof window === "undefined")
|
|
33
|
+
if (typeof window === "undefined" || isPreviewMode())
|
|
32
34
|
return false;
|
|
33
35
|
return window.sessionStorage.getItem(signatureViewStorageKey) === "1";
|
|
34
36
|
}), showSignature = _c[0], setShowSignature = _c[1];
|
|
35
37
|
var _d = useState(false), showSignedDocumentPreview = _d[0], setShowSignedDocumentPreview = _d[1];
|
|
36
38
|
var _e = useState(null), signedAt = _e[0], setSignedAt = _e[1];
|
|
37
39
|
useEffect(function () {
|
|
38
|
-
|
|
40
|
+
// APP3-2057 — aperçu du builder : rien n'est écrit dans le stockage du navigateur.
|
|
41
|
+
if (typeof window === "undefined" || isPreviewMode())
|
|
39
42
|
return;
|
|
40
43
|
if (showSignature) {
|
|
41
44
|
window.sessionStorage.setItem(signatureViewStorageKey, "1");
|
|
@@ -115,6 +118,10 @@ var SignatureElectronic = function (_a) {
|
|
|
115
118
|
if (showSignedDocumentPreview) {
|
|
116
119
|
return (jsx(SignedDocumentPreview, { sessionId: sessionId, nodeId: node.id, nodeTitle: node.pageTitle || node.title, completedAt: signedAt, logo: (_b = session === null || session === void 0 ? void 0 : session.template) === null || _b === void 0 ? void 0 : _b.logo, title: node.signedScreenTitle, description: node.signedScreenDescription, downloadHint: node.signedScreenDownloadHint, onContinue: handleContinueFromPreview }));
|
|
117
120
|
}
|
|
121
|
+
// APP3-2057 — aperçu du builder : pas de signature Docuseal (ni jeton, ni iframe tierce).
|
|
122
|
+
if (showSignature && isPreviewMode()) {
|
|
123
|
+
return jsx(PreviewCaptureDisabled, { onContinue: handleContinueFromPreview });
|
|
124
|
+
}
|
|
118
125
|
if (showSignature && external_id) {
|
|
119
126
|
return (jsx(DocusealSignature, { sessionId: sessionId, templateId: external_id, templateName: title, onComplete: handleComplete, onBack: handleBack, prefillValues: prefillValues, readonlyFieldNames: readonlyFieldNames }));
|
|
120
127
|
}
|
|
@@ -18,6 +18,7 @@ import SignatureElectronic from '../signature-electronic/SignatureElectronic.js'
|
|
|
18
18
|
import ExternalVerificationNodeHandler from './ExternalVerificationNodeHandler.js';
|
|
19
19
|
import PdfGeneration from '../session/PdfGeneration.js';
|
|
20
20
|
import LegalConsentNode from '../legal-consent/LegalConsentNode.js';
|
|
21
|
+
import { isMobileDevice } from '../../utils/isMobileDevice.js';
|
|
21
22
|
|
|
22
23
|
var TemplateNodeRenderer = function (_a) {
|
|
23
24
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
@@ -105,7 +106,8 @@ var TemplateNodeRenderer = function (_a) {
|
|
|
105
106
|
return (jsxs("div", { className: "flex flex-col items-center justify-center h-full p-4 text-center", children: [jsx("div", { className: "text-red-500 text-4xl mb-4", children: "\u26A0\uFE0F" }), jsx("h2", { className: "text-xl font-bold text-red-600 mb-2", children: "Erreur de configuration" }), jsx("p", { className: "text-gray-600 mb-4", children: "Le type de document requis n'est pas sp\u00E9cifi\u00E9 dans le template." }), jsx("button", { className: "px-4 py-2 bg-primary text-white rounded hover:bg-primary-dark transition-colors", onClick: function () { return stepObject.setStep(0); }, children: "Recommencer" })] }));
|
|
106
107
|
}
|
|
107
108
|
// Determine if current device is mobile for capture method
|
|
108
|
-
|
|
109
|
+
// (même détection par user-agent ; suit l'appareil simulé en aperçu, APP3-2057).
|
|
110
|
+
var isMobile = isMobileDevice();
|
|
109
111
|
return (jsx(DocumentCheck, { stepObject: stepObject, node: node, sessionId: sessionId, documentTypeId: node.requiredDocumentType, acceptedCountries: node.acceptedCountries, onContinueOnPC: onContinueOnPC, isMobileCapture: isMobileTemplate && isMobile, allowedAddingMethods: node.allowedAddingMethods || ["download", "picture"], template: session.template, templateIndex: templateIndex, setUserInput: setUserInput }, "doc-check-".concat(templateIndex)));
|
|
110
112
|
// }
|
|
111
113
|
}
|
|
@@ -4,7 +4,7 @@ import useIsMobile from '../../hooks/useIsMobile.js';
|
|
|
4
4
|
|
|
5
5
|
var Button = function (_a) {
|
|
6
6
|
var _b, _c;
|
|
7
|
-
var _d = _a.variant, variant = _d === void 0 ? "primary" : _d, children = _a.children, _e = _a.className, className = _e === void 0 ? "" : _e, style = _a.style, onClick = _a.onClick, _f = _a.disabled, disabled = _f === void 0 ? false : _f, _g = _a.type, type = _g === void 0 ? "button" : _g;
|
|
7
|
+
var _d = _a.variant, variant = _d === void 0 ? "primary" : _d, children = _a.children, _e = _a.className, className = _e === void 0 ? "" : _e, style = _a.style, onClick = _a.onClick, _f = _a.disabled, disabled = _f === void 0 ? false : _f, _g = _a.type, type = _g === void 0 ? "button" : _g, testId = _a.testId;
|
|
8
8
|
var isMobile = useIsMobile(768);
|
|
9
9
|
var baseShared = "flex items-center justify-center gap-2 shrink-0 font-poppins text-sm font-medium leading-[110%] transition-filter";
|
|
10
10
|
var base = isMobile
|
|
@@ -13,13 +13,13 @@ var Button = function (_a) {
|
|
|
13
13
|
if (variant === "secondary") {
|
|
14
14
|
return (jsx("button", { type: type, className: "".concat(base, " bg-transparent border border-gray-300 text-gray-600 ").concat(disabled
|
|
15
15
|
? "opacity-60 cursor-not-allowed"
|
|
16
|
-
: "hover:bg-black/5 cursor-pointer", " ").concat(className), onClick: onClick, disabled: disabled, children: children }));
|
|
16
|
+
: "hover:bg-black/5 cursor-pointer", " ").concat(className), onClick: onClick, disabled: disabled, "data-testid": testId, children: children }));
|
|
17
17
|
}
|
|
18
18
|
return (jsx("button", { type: type, className: "".concat(base, " ").concat(disabled
|
|
19
19
|
? "bg-gray-200 text-gray-400 cursor-not-allowed opacity-60"
|
|
20
20
|
: "hover:brightness-110 active:brightness-90 cursor-pointer", " ").concat(className), style: disabled
|
|
21
21
|
? style
|
|
22
|
-
: __assign(__assign({}, style), { backgroundColor: (_b = style === null || style === void 0 ? void 0 : style.backgroundColor) !== null && _b !== void 0 ? _b : "var(--dk-btn-bg)", color: (_c = style === null || style === void 0 ? void 0 : style.color) !== null && _c !== void 0 ? _c : "var(--dk-btn-text)" }), onClick: onClick, disabled: disabled, children: children }));
|
|
22
|
+
: __assign(__assign({}, style), { backgroundColor: (_b = style === null || style === void 0 ? void 0 : style.backgroundColor) !== null && _b !== void 0 ? _b : "var(--dk-btn-bg)", color: (_c = style === null || style === void 0 ? void 0 : style.color) !== null && _c !== void 0 ? _c : "var(--dk-btn-text)" }), onClick: onClick, disabled: disabled, "data-testid": testId, children: children }));
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
export { Button as default };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useState, useEffect } from 'react';
|
|
2
2
|
import { UAParser } from 'ua-parser-js';
|
|
3
|
+
import { isPreviewMode } from '../preview/previewMode.js';
|
|
3
4
|
|
|
4
5
|
var getClientInfoFromUA = function () {
|
|
5
6
|
var uaResult = new UAParser().getResult();
|
|
@@ -18,6 +19,12 @@ var useClientInfo = function () {
|
|
|
18
19
|
var _b = useState(false), isLoaded = _b[0], setIsLoaded = _b[1];
|
|
19
20
|
useEffect(function () {
|
|
20
21
|
var _a = getClientInfoFromUA(), device = _a.device, browser = _a.browser, os = _a.os;
|
|
22
|
+
// APP3-2057 — aperçu du builder : pas de géolocalisation IP (aucun appel tiers).
|
|
23
|
+
if (isPreviewMode()) {
|
|
24
|
+
setInfo({ device: device, browser: browser, os: os, ip: "unknown_ip", location: "unknown_location" });
|
|
25
|
+
setIsLoaded(true);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
21
28
|
fetch("https://ipapi.co/json/")
|
|
22
29
|
.then(function (response) { return response.json(); })
|
|
23
30
|
.then(function (data) {
|
|
@@ -13,6 +13,7 @@ import { useI18n } from './useI18n.js';
|
|
|
13
13
|
import { logFormValidated } from '../services/auditTrailService.js';
|
|
14
14
|
import { fetchSessionById } from '../services/sessionService.js';
|
|
15
15
|
import { extractedRootTarget } from '../utils/extractedCopy.js';
|
|
16
|
+
import { isPreviewMode } from '../preview/previewMode.js';
|
|
16
17
|
|
|
17
18
|
var useUserInputForm = function (_a) {
|
|
18
19
|
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;
|
|
@@ -177,7 +178,8 @@ var useUserInputForm = function (_a) {
|
|
|
177
178
|
clearTimeout(addressRequestState.current.debounce);
|
|
178
179
|
addressRequestState.current.debounce = null;
|
|
179
180
|
}
|
|
180
|
-
|
|
181
|
+
// APP3-2057 — aperçu du builder : pas d'appel au service d'autocomplétion d'adresse.
|
|
182
|
+
if (query.trim().length < 3 || isPreviewMode()) {
|
|
181
183
|
if (addressRequestState.current.controller) {
|
|
182
184
|
addressRequestState.current.controller.abort();
|
|
183
185
|
addressRequestState.current.controller = null;
|