@portnet/ui 5.0.25 → 5.0.28

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.
@@ -0,0 +1,4167 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ require("core-js/modules/es.symbol.description.js");
8
+ require("core-js/modules/es.array.includes.js");
9
+ require("core-js/modules/es.array-buffer.constructor.js");
10
+ require("core-js/modules/es.array-buffer.slice.js");
11
+ require("core-js/modules/es.promise.js");
12
+ require("core-js/modules/es.regexp.exec.js");
13
+ require("core-js/modules/es.regexp.test.js");
14
+ require("core-js/modules/es.string.includes.js");
15
+ require("core-js/modules/es.string.split.js");
16
+ require("core-js/modules/es.string.trim.js");
17
+ require("core-js/modules/es.typed-array.uint8-array.js");
18
+ require("core-js/modules/es.typed-array.fill.js");
19
+ require("core-js/modules/es.typed-array.set.js");
20
+ require("core-js/modules/es.typed-array.sort.js");
21
+ require("core-js/modules/es.typed-array.to-locale-string.js");
22
+ require("core-js/modules/esnext.iterator.constructor.js");
23
+ require("core-js/modules/esnext.iterator.filter.js");
24
+ require("core-js/modules/esnext.iterator.for-each.js");
25
+ require("core-js/modules/esnext.iterator.map.js");
26
+ require("core-js/modules/web.dom-collections.iterator.js");
27
+ require("core-js/modules/web.url.js");
28
+ require("core-js/modules/web.url.to-json.js");
29
+ require("core-js/modules/web.url-search-params.js");
30
+ var _react = require("react");
31
+ var _reactRedux = require("react-redux");
32
+ var _reactQuery = require("react-query");
33
+ var _reactFontawesome = require("@fortawesome/react-fontawesome");
34
+ var _reactToastify = require("react-toastify");
35
+ var _reactstrap = require("reactstrap");
36
+ var _freeRegularSvgIcons = require("@fortawesome/free-regular-svg-icons");
37
+ var _dompurify = _interopRequireDefault(require("dompurify"));
38
+ var _freeSolidSvgIcons = require("@fortawesome/free-solid-svg-icons");
39
+ var _iconsMaterial = require("@mui/icons-material");
40
+ var _material = require("@mui/material");
41
+ require("../../styles/help-widget.css");
42
+ require("../../styles/ReclamationFormModal.css");
43
+ var _useReclamation = require("../../hooks/useReclamation");
44
+ var _guides = _interopRequireDefault(require("../../assets/guides"));
45
+ var _PuiHelpWidgetContext = require("../common/PuiHelpWidgetContext");
46
+ var _tijariaLogo = _interopRequireDefault(require("../../assets/images/tijariaLogo.ico"));
47
+ var _GuideImage = require("./GuideImage");
48
+ var _jsxRuntime = require("react/jsx-runtime");
49
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
50
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
51
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
52
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
53
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
54
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
55
+ const WIDGET_FONT = "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif";
56
+ const ContentPanel = _ref => {
57
+ let {
58
+ isOpen,
59
+ onClose,
60
+ contentData,
61
+ title = "Contenu",
62
+ showDownloadButton = false,
63
+ showExternalLinkLabel = false,
64
+ onDownload = null,
65
+ loadingDownload = false,
66
+ projectCode = null,
67
+ externalLinkUrl = null,
68
+ guideBaseUrl
69
+ } = _ref;
70
+ const {
71
+ guideImageService
72
+ } = (0, _PuiHelpWidgetContext.useHelpWidget)();
73
+ const [position, setPosition] = (0, _react.useState)({
74
+ x: window.innerWidth - 380,
75
+ y: 40
76
+ });
77
+ const [isDragging, setIsDragging] = (0, _react.useState)(false);
78
+ const [dragStart, setDragStart] = (0, _react.useState)({
79
+ x: 0,
80
+ y: 0
81
+ });
82
+ const panelRef = (0, _react.useRef)(null);
83
+ const firstFocusableRef = (0, _react.useRef)(null);
84
+ const previousActiveElement = (0, _react.useRef)(null);
85
+ const [currentView, setCurrentView] = (0, _react.useState)("list");
86
+ const [selectedSection, setSelectedSection] = (0, _react.useState)(null);
87
+ const [fullscreenImage, setFullscreenImage] = (0, _react.useState)(null);
88
+ const PANEL_WIDTH = 340;
89
+ const PANEL_MAX_HEIGHT = 550;
90
+ const RESIZE_MARGIN = 40;
91
+ const MIN_VISIBLE_WIDTH = 80;
92
+ (0, _react.useEffect)(() => {
93
+ if (contentData) {
94
+ setCurrentView("list");
95
+ setSelectedSection(null);
96
+ }
97
+ }, [contentData]);
98
+ (0, _react.useEffect)(() => {
99
+ return () => {
100
+ guideImageService.clearImageCache();
101
+ };
102
+ }, []);
103
+ const handleSectionClick = section => {
104
+ setSelectedSection(section);
105
+ setCurrentView("detail");
106
+ };
107
+ const handleBack = () => {
108
+ setCurrentView("list");
109
+ setSelectedSection(null);
110
+ };
111
+ const handleOpenInNewWindow = () => {
112
+ if (!selectedSection || !projectCode || !guideBaseUrl) return;
113
+ const url = "".concat(guideBaseUrl, "/#/guide/").concat(projectCode, "?section=").concat(selectedSection.id);
114
+ window.open(url, "_blank");
115
+ };
116
+ const handleImageClick = imageSrc => {
117
+ setFullscreenImage(imageSrc);
118
+ };
119
+ const handleCloseFullscreen = () => {
120
+ setFullscreenImage(null);
121
+ };
122
+ const handleMouseDown = e => {
123
+ if (e.target.closest(".drag-handle")) {
124
+ setIsDragging(true);
125
+ setDragStart({
126
+ x: e.clientX - position.x,
127
+ y: e.clientY - position.y
128
+ });
129
+ }
130
+ };
131
+ const handleMouseMove = e => {
132
+ if (isDragging) {
133
+ const newX = e.clientX - dragStart.x;
134
+ const newY = e.clientY - dragStart.y;
135
+ const constrainedX = Math.max(0, newX);
136
+ const maxX = window.innerWidth - MIN_VISIBLE_WIDTH;
137
+ const finalX = Math.min(constrainedX, maxX);
138
+ const finalY = Math.max(0, newY);
139
+ setPosition({
140
+ x: finalX,
141
+ y: finalY
142
+ });
143
+ }
144
+ };
145
+ const handleMouseUp = () => {
146
+ setIsDragging(false);
147
+ };
148
+ (0, _react.useEffect)(() => {
149
+ const handleResize = () => {
150
+ setPosition(prev => {
151
+ var _panelRef$current;
152
+ const panelHeight = ((_panelRef$current = panelRef.current) === null || _panelRef$current === void 0 ? void 0 : _panelRef$current.offsetHeight) || PANEL_MAX_HEIGHT;
153
+ let newX = prev.x;
154
+ let newY = prev.y;
155
+ const maxX = window.innerWidth - PANEL_WIDTH - RESIZE_MARGIN;
156
+ const maxY = window.innerHeight - panelHeight - RESIZE_MARGIN;
157
+ if (prev.x + PANEL_WIDTH > window.innerWidth - RESIZE_MARGIN) {
158
+ newX = Math.max(RESIZE_MARGIN, maxX);
159
+ }
160
+ if (prev.x < RESIZE_MARGIN) {
161
+ newX = RESIZE_MARGIN;
162
+ }
163
+ if (prev.y + panelHeight > window.innerHeight - RESIZE_MARGIN) {
164
+ newY = Math.max(RESIZE_MARGIN, maxY);
165
+ }
166
+ if (prev.y < RESIZE_MARGIN) {
167
+ newY = RESIZE_MARGIN;
168
+ }
169
+ return {
170
+ x: newX,
171
+ y: newY
172
+ };
173
+ });
174
+ };
175
+ window.addEventListener("resize", handleResize);
176
+ return () => window.removeEventListener("resize", handleResize);
177
+ }, []);
178
+ (0, _react.useEffect)(() => {
179
+ if (isDragging) {
180
+ document.addEventListener("mousemove", handleMouseMove);
181
+ document.addEventListener("mouseup", handleMouseUp);
182
+ return () => {
183
+ document.removeEventListener("mousemove", handleMouseMove);
184
+ document.removeEventListener("mouseup", handleMouseUp);
185
+ };
186
+ }
187
+ }, [isDragging, dragStart]);
188
+ (0, _react.useEffect)(() => {
189
+ const handleEscape = e => {
190
+ if (e.key === "Escape" && fullscreenImage) {
191
+ handleCloseFullscreen();
192
+ }
193
+ };
194
+ window.addEventListener("keydown", handleEscape);
195
+ return () => window.removeEventListener("keydown", handleEscape);
196
+ }, [fullscreenImage]);
197
+ (0, _react.useEffect)(() => {
198
+ if (isOpen) {
199
+ previousActiveElement.current = document.activeElement;
200
+ setTimeout(() => {
201
+ var _firstFocusableRef$cu;
202
+ (_firstFocusableRef$cu = firstFocusableRef.current) === null || _firstFocusableRef$cu === void 0 || _firstFocusableRef$cu.focus();
203
+ }, 100);
204
+ } else {
205
+ if (previousActiveElement.current) {
206
+ previousActiveElement.current.focus();
207
+ }
208
+ }
209
+ }, [isOpen]);
210
+ (0, _react.useEffect)(() => {
211
+ if (!isOpen) return;
212
+ const handleKeyDown = e => {
213
+ if (e.key === "Escape") {
214
+ if (fullscreenImage) {
215
+ return;
216
+ }
217
+ onClose();
218
+ return;
219
+ }
220
+ if (e.key === "Tab") {
221
+ const panel = panelRef.current;
222
+ if (!panel) return;
223
+ const focusableElements = panel.querySelectorAll('button:not([disabled]), [href]:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled])');
224
+ const focusableArray = Array.from(focusableElements);
225
+ const firstElement = focusableArray[0];
226
+ const lastElement = focusableArray[focusableArray.length - 1];
227
+ if (focusableArray.length === 0) return;
228
+ if (e.shiftKey) {
229
+ if (document.activeElement === firstElement) {
230
+ lastElement.focus();
231
+ e.preventDefault();
232
+ }
233
+ } else {
234
+ if (document.activeElement === lastElement) {
235
+ firstElement.focus();
236
+ e.preventDefault();
237
+ }
238
+ }
239
+ }
240
+ };
241
+ document.addEventListener("keydown", handleKeyDown);
242
+ return () => document.removeEventListener("keydown", handleKeyDown);
243
+ }, [isOpen, onClose, fullscreenImage]);
244
+ (0, _react.useEffect)(() => {
245
+ if (isOpen) {
246
+ document.body.style.overflow = "hidden";
247
+ } else {
248
+ document.body.style.overflow = "";
249
+ }
250
+ return () => {
251
+ document.body.style.overflow = "";
252
+ };
253
+ }, [isOpen]);
254
+ (0, _react.useEffect)(() => {
255
+ if (currentView === "detail") {
256
+ setTimeout(() => {
257
+ const panel = panelRef.current;
258
+ if (!panel) return;
259
+ const focusableElements = panel.querySelectorAll('button:not([disabled]), [href]:not([disabled]), [role="button"]:not([disabled])[tabindex="0"]');
260
+ if (focusableElements.length > 0) {
261
+ focusableElements[0].focus();
262
+ }
263
+ }, 100);
264
+ } else if (currentView === "list") {
265
+ setTimeout(() => {
266
+ var _firstFocusableRef$cu2;
267
+ (_firstFocusableRef$cu2 = firstFocusableRef.current) === null || _firstFocusableRef$cu2 === void 0 || _firstFocusableRef$cu2.focus();
268
+ }, 100);
269
+ }
270
+ }, [currentView]);
271
+ if (!isOpen) return null;
272
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
273
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
274
+ ref: panelRef,
275
+ role: "dialog",
276
+ "aria-modal": "true",
277
+ "aria-labelledby": "panel-title",
278
+ style: {
279
+ position: "fixed",
280
+ left: "".concat(position.x, "px"),
281
+ top: "".concat(position.y, "px"),
282
+ width: "360px",
283
+ height: "auto",
284
+ maxHeight: "550px",
285
+ backgroundColor: "white",
286
+ border: "0px solid #dadce0",
287
+ borderRadius: "16px",
288
+ boxShadow: "0px 1px 3px 0px rgba(60, 64, 67, 0.3)",
289
+ zIndex: 10000000,
290
+ display: "flex",
291
+ flexDirection: "column",
292
+ overflow: "hidden",
293
+ fontFamily: "'Google Sans', Roboto, Arial, sans-serif"
294
+ },
295
+ onMouseDown: handleMouseDown,
296
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
297
+ className: "drag-handle",
298
+ style: {
299
+ display: "flex",
300
+ alignItems: "center",
301
+ justifyContent: "center",
302
+ marginTop: "10px",
303
+ padding: "16px 20px",
304
+ cursor: "move",
305
+ userSelect: "none",
306
+ backgroundColor: "white",
307
+ position: "relative"
308
+ },
309
+ children: [currentView === "detail" && /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
310
+ onClick: handleBack,
311
+ "aria-label": "Retour \xE0 la liste",
312
+ tabIndex: 0,
313
+ style: {
314
+ background: "none",
315
+ border: "none",
316
+ cursor: "pointer",
317
+ padding: "8px",
318
+ borderRadius: "50%",
319
+ display: "flex",
320
+ alignItems: "center",
321
+ justifyContent: "center",
322
+ transition: "background-color 0.2s",
323
+ position: "absolute",
324
+ left: "12px",
325
+ order: 1
326
+ },
327
+ onMouseEnter: e => e.currentTarget.style.backgroundColor = "#f1f3f4",
328
+ onMouseLeave: e => e.currentTarget.style.backgroundColor = "transparent",
329
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", {
330
+ xmlns: "http://www.w3.org/2000/svg",
331
+ width: "22",
332
+ height: "22",
333
+ viewBox: "0 0 24 24",
334
+ fill: "none",
335
+ stroke: "#5f6368",
336
+ strokeWidth: "2",
337
+ strokeLinecap: "round",
338
+ strokeLinejoin: "round",
339
+ "aria-hidden": "true",
340
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
341
+ d: "M19 12H5M12 19l-7-7 7-7"
342
+ })
343
+ })
344
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
345
+ id: "panel-title",
346
+ style: {
347
+ margin: 0,
348
+ fontSize: "20px",
349
+ fontWeight: "400",
350
+ color: "#202124",
351
+ letterSpacing: "0",
352
+ order: 2
353
+ },
354
+ children: title
355
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
356
+ ref: firstFocusableRef,
357
+ onClick: onClose,
358
+ "aria-label": "Fermer le panneau",
359
+ tabIndex: 0,
360
+ style: {
361
+ background: "none",
362
+ border: "none",
363
+ cursor: "pointer",
364
+ padding: "8px",
365
+ borderRadius: "50%",
366
+ display: "flex",
367
+ alignItems: "center",
368
+ justifyContent: "center",
369
+ transition: "background-color 0.2s",
370
+ position: "absolute",
371
+ right: "12px",
372
+ order: 3
373
+ },
374
+ onMouseEnter: e => e.currentTarget.style.backgroundColor = "#f1f3f4",
375
+ onMouseLeave: e => e.currentTarget.style.backgroundColor = "transparent",
376
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("svg", {
377
+ xmlns: "http://www.w3.org/2000/svg",
378
+ width: "22",
379
+ height: "22",
380
+ viewBox: "0 0 24 24",
381
+ fill: "none",
382
+ stroke: "#5f6368",
383
+ strokeWidth: "2",
384
+ strokeLinecap: "round",
385
+ strokeLinejoin: "round",
386
+ "aria-hidden": "true",
387
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("line", {
388
+ x1: "18",
389
+ y1: "6",
390
+ x2: "6",
391
+ y2: "18"
392
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("line", {
393
+ x1: "6",
394
+ y1: "6",
395
+ x2: "18",
396
+ y2: "18"
397
+ })]
398
+ })
399
+ })]
400
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
401
+ style: {
402
+ padding: "10px 16px",
403
+ marginBottom: "7px",
404
+ overflowY: "auto",
405
+ flex: 1
406
+ },
407
+ children: currentView === "list" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
408
+ children: !contentData ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
409
+ style: {
410
+ textAlign: "center",
411
+ padding: "20px",
412
+ marginBottom: 9
413
+ },
414
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.CircularProgress, {
415
+ size: 20,
416
+ sx: {
417
+ color: "#1967d2"
418
+ }
419
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
420
+ component: "div",
421
+ sx: {
422
+ fontSize: "14px",
423
+ color: "#202124",
424
+ marginTop: "10px",
425
+ lineHeight: "normal"
426
+ },
427
+ children: "Chargement..."
428
+ })]
429
+ }) : contentData !== null && contentData !== void 0 && contentData.sections && contentData.sections.length > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
430
+ children: [contentData.name && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
431
+ style: {
432
+ marginBottom: "7px"
433
+ },
434
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("h3", {
435
+ style: {
436
+ fontSize: "16px",
437
+ color: "#202124",
438
+ lineHeight: "24px",
439
+ margin: 0,
440
+ fontWeight: "400"
441
+ },
442
+ children: contentData.name
443
+ })
444
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
445
+ style: {
446
+ display: "flex",
447
+ flexDirection: "column",
448
+ gap: "4px"
449
+ },
450
+ children: contentData.sections.map(section => /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
451
+ onClick: () => handleSectionClick(section),
452
+ onKeyDown: e => {
453
+ if (e.key === "Enter" || e.key === " ") {
454
+ e.preventDefault();
455
+ handleSectionClick(section);
456
+ }
457
+ },
458
+ role: "button",
459
+ tabIndex: 0,
460
+ "aria-label": "Ouvrir ".concat(section.title),
461
+ style: {
462
+ display: "flex",
463
+ alignItems: "center",
464
+ padding: "12px 2.2px",
465
+ cursor: "pointer",
466
+ borderRadius: "8px",
467
+ transition: "background-color 0.2s",
468
+ backgroundColor: "transparent"
469
+ },
470
+ onMouseEnter: e => {
471
+ e.currentTarget.style.backgroundColor = "#f1f3f4";
472
+ },
473
+ onMouseLeave: e => {
474
+ e.currentTarget.style.backgroundColor = "transparent";
475
+ },
476
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
477
+ style: {
478
+ minWidth: "34px",
479
+ height: "34px",
480
+ borderRadius: "50%",
481
+ backgroundColor: "#e8f0fe",
482
+ display: "flex",
483
+ alignItems: "center",
484
+ justifyContent: "center",
485
+ marginRight: "12px",
486
+ flexShrink: 0
487
+ },
488
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("svg", {
489
+ xmlns: "http://www.w3.org/2000/svg",
490
+ width: "16",
491
+ height: "16",
492
+ viewBox: "0 0 24 24",
493
+ fill: "none",
494
+ stroke: "#1967d2",
495
+ strokeWidth: "2",
496
+ strokeLinecap: "round",
497
+ strokeLinejoin: "round",
498
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
499
+ d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"
500
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("polyline", {
501
+ points: "14 2 14 8 20 8"
502
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("line", {
503
+ x1: "16",
504
+ y1: "13",
505
+ x2: "8",
506
+ y2: "13"
507
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("line", {
508
+ x1: "16",
509
+ y1: "17",
510
+ x2: "8",
511
+ y2: "17"
512
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("line", {
513
+ x1: "10",
514
+ y1: "9",
515
+ x2: "8",
516
+ y2: "9"
517
+ })]
518
+ })
519
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
520
+ style: {
521
+ flex: 1
522
+ },
523
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
524
+ style: {
525
+ fontSize: "16px",
526
+ color: "#202124",
527
+ fontWeight: "400",
528
+ lineHeight: "20px"
529
+ },
530
+ children: section.title
531
+ })
532
+ })]
533
+ }, section.id))
534
+ }), showDownloadButton && onDownload && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
535
+ style: {
536
+ marginTop: "10px"
537
+ },
538
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
539
+ onClick: onDownload,
540
+ onKeyDown: e => {
541
+ if (e.key === "Enter" || e.key === " ") {
542
+ e.preventDefault();
543
+ onDownload();
544
+ }
545
+ },
546
+ role: "button",
547
+ tabIndex: 0,
548
+ "aria-label": "T\xE9l\xE9charger le guide complet",
549
+ style: {
550
+ display: "flex",
551
+ alignItems: "center",
552
+ justifyContent: "center",
553
+ gap: "6px",
554
+ color: "#1967d2",
555
+ fontSize: "14px",
556
+ textDecoration: "none",
557
+ padding: "8px",
558
+ borderRadius: "4px",
559
+ transition: "background-color 0.2s",
560
+ cursor: loadingDownload ? "not-allowed" : "pointer",
561
+ opacity: loadingDownload ? 0.6 : 1
562
+ },
563
+ onMouseEnter: e => !loadingDownload && (e.currentTarget.style.backgroundColor = "#f1f3f4"),
564
+ onMouseLeave: e => e.currentTarget.style.backgroundColor = "transparent",
565
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
566
+ children: "T\xE9l\xE9charger le guide complet"
567
+ }), loadingDownload ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.CircularProgress, {
568
+ size: 16,
569
+ sx: {
570
+ color: "#1967d2"
571
+ }
572
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsxs)("svg", {
573
+ xmlns: "http://www.w3.org/2000/svg",
574
+ width: "16",
575
+ height: "16",
576
+ viewBox: "0 0 24 24",
577
+ fill: "none",
578
+ stroke: "currentColor",
579
+ strokeWidth: "2",
580
+ strokeLinecap: "round",
581
+ strokeLinejoin: "round",
582
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
583
+ d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"
584
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("polyline", {
585
+ points: "7 10 12 15 17 10"
586
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("line", {
587
+ x1: "12",
588
+ y1: "15",
589
+ x2: "12",
590
+ y2: "3"
591
+ })]
592
+ })]
593
+ })
594
+ }), showExternalLinkLabel && externalLinkUrl && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
595
+ style: {
596
+ marginTop: "10px"
597
+ },
598
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
599
+ onClick: () => window.open(externalLinkUrl, "_blank"),
600
+ onKeyDown: e => {
601
+ if (e.key === "Enter" || e.key === " ") {
602
+ e.preventDefault();
603
+ window.open(externalLinkUrl, "_blank");
604
+ }
605
+ },
606
+ role: "button",
607
+ tabIndex: 0,
608
+ "aria-label": "Voir plus de d\xE9tails (ouvre dans un nouvel onglet)",
609
+ style: {
610
+ display: "flex",
611
+ alignItems: "center",
612
+ justifyContent: "center",
613
+ gap: "6px",
614
+ color: "#1967d2",
615
+ fontSize: "14px",
616
+ textDecoration: "none",
617
+ padding: "8px",
618
+ borderRadius: "4px",
619
+ transition: "background-color 0.2s",
620
+ cursor: "pointer"
621
+ },
622
+ onMouseEnter: e => e.currentTarget.style.backgroundColor = "#f1f3f4",
623
+ onMouseLeave: e => e.currentTarget.style.backgroundColor = "transparent",
624
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
625
+ children: "Voir plus de d\xE9tails"
626
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("svg", {
627
+ xmlns: "http://www.w3.org/2000/svg",
628
+ width: "16",
629
+ height: "16",
630
+ viewBox: "0 0 24 24",
631
+ fill: "none",
632
+ stroke: "currentColor",
633
+ strokeWidth: "2",
634
+ strokeLinecap: "round",
635
+ strokeLinejoin: "round",
636
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
637
+ d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"
638
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("polyline", {
639
+ points: "15 3 21 3 21 9"
640
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("line", {
641
+ x1: "21",
642
+ y1: "3",
643
+ x2: "10",
644
+ y2: "14"
645
+ })]
646
+ })]
647
+ })
648
+ })]
649
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
650
+ style: {
651
+ textAlign: "center",
652
+ padding: "50px 20px",
653
+ color: "#202124"
654
+ },
655
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
656
+ component: "div",
657
+ sx: {
658
+ fontSize: "14px",
659
+ lineHeight: "normal",
660
+ color: "#202124"
661
+ },
662
+ children: "Aucune section disponible."
663
+ })
664
+ })
665
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
666
+ children: selectedSection && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
667
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
668
+ style: {
669
+ marginBottom: "14px",
670
+ marginTop: "4px"
671
+ },
672
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
673
+ style: {
674
+ fontSize: "28px",
675
+ color: "#202124",
676
+ fontWeight: "400",
677
+ lineHeight: "32px",
678
+ margin: 0
679
+ },
680
+ children: selectedSection.title
681
+ })
682
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
683
+ style: {
684
+ marginBottom: "20px"
685
+ },
686
+ children: selectedSection.paragraphs && selectedSection.paragraphs.map((paragraph, index) => {
687
+ const text = typeof paragraph === "string" ? paragraph : paragraph.text;
688
+ const isQuestion = typeof paragraph === "object" && paragraph.isQuestion;
689
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
690
+ style: {
691
+ fontSize: "16px",
692
+ color: "#202124",
693
+ lineHeight: "22px",
694
+ margin: index === 0 ? 0 : "12px 0 0 0",
695
+ fontWeight: isQuestion ? "600" : "400"
696
+ },
697
+ children: text
698
+ }, index);
699
+ })
700
+ }), selectedSection.images && selectedSection.images.length > 0 && projectCode && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GuideImage.GuideImageGallery, {
701
+ projectCode: projectCode,
702
+ imageOrders: selectedSection.images,
703
+ columns: 1,
704
+ onImageClick: handleImageClick
705
+ }), selectedSection.keywords && selectedSection.keywords.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
706
+ style: {
707
+ marginTop: "20px",
708
+ marginBottom: "20px"
709
+ },
710
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h3", {
711
+ style: {
712
+ fontSize: "13px",
713
+ fontWeight: "500",
714
+ color: "#202124",
715
+ margin: "0 0 10px 0",
716
+ letterSpacing: "0.5px"
717
+ },
718
+ children: "Mots-cl\xE9s"
719
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
720
+ style: {
721
+ display: "flex",
722
+ flexWrap: "wrap",
723
+ gap: "6px"
724
+ },
725
+ children: selectedSection.keywords.map((keyword, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
726
+ style: {
727
+ backgroundColor: "#e8f0fe",
728
+ color: "#1967d2",
729
+ padding: "4px 10px",
730
+ borderRadius: "12px",
731
+ fontSize: "12px",
732
+ fontWeight: "500"
733
+ },
734
+ children: keyword
735
+ }, index))
736
+ })]
737
+ }), projectCode && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
738
+ style: {
739
+ marginTop: "24px",
740
+ paddingTop: "16px",
741
+ borderTop: "1px solid #e8eaed"
742
+ },
743
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
744
+ onClick: handleOpenInNewWindow,
745
+ onKeyDown: e => {
746
+ if (e.key === "Enter" || e.key === " ") {
747
+ e.preventDefault();
748
+ handleOpenInNewWindow();
749
+ }
750
+ },
751
+ role: "button",
752
+ tabIndex: 0,
753
+ "aria-label": "Ouvrir dans une nouvelle fen\xEAtre",
754
+ style: {
755
+ display: "flex",
756
+ alignItems: "center",
757
+ justifyContent: "center",
758
+ gap: "6px",
759
+ color: "#1967d2",
760
+ fontSize: "14px",
761
+ padding: "8px",
762
+ borderRadius: "4px",
763
+ cursor: "pointer",
764
+ transition: "background-color 0.2s"
765
+ },
766
+ onMouseEnter: e => e.currentTarget.style.backgroundColor = "#f1f3f4",
767
+ onMouseLeave: e => e.currentTarget.style.backgroundColor = "transparent",
768
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
769
+ children: "Ouvrir dans une nouvelle fen\xEAtre"
770
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("svg", {
771
+ xmlns: "http://www.w3.org/2000/svg",
772
+ width: "16",
773
+ height: "16",
774
+ viewBox: "0 0 24 24",
775
+ fill: "none",
776
+ stroke: "currentColor",
777
+ strokeWidth: "2",
778
+ strokeLinecap: "round",
779
+ strokeLinejoin: "round",
780
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
781
+ d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"
782
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("polyline", {
783
+ points: "15 3 21 3 21 9"
784
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("line", {
785
+ x1: "10",
786
+ y1: "14",
787
+ x2: "21",
788
+ y2: "3"
789
+ })]
790
+ })]
791
+ })
792
+ })]
793
+ })
794
+ })
795
+ })]
796
+ }), fullscreenImage && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
797
+ onClick: handleCloseFullscreen,
798
+ style: {
799
+ position: "fixed",
800
+ top: 0,
801
+ left: 0,
802
+ width: "100vw",
803
+ height: "100vh",
804
+ backgroundColor: "rgba(0, 0, 0, 0.78)",
805
+ zIndex: 20000000,
806
+ display: "flex",
807
+ alignItems: "center",
808
+ justifyContent: "center",
809
+ cursor: "zoom-out",
810
+ animation: "fadeIn 0.2s ease-in-out"
811
+ },
812
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
813
+ onClick: handleCloseFullscreen,
814
+ style: {
815
+ position: "absolute",
816
+ top: "20px",
817
+ right: "20px",
818
+ background: "rgba(255, 255, 255, 0.1)",
819
+ border: "none",
820
+ borderRadius: "50%",
821
+ width: "48px",
822
+ height: "48px",
823
+ cursor: "pointer",
824
+ display: "flex",
825
+ alignItems: "center",
826
+ justifyContent: "center",
827
+ transition: "background-color 0.2s",
828
+ zIndex: 20000001
829
+ },
830
+ onMouseEnter: e => e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 0.2)",
831
+ onMouseLeave: e => e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 0.1)",
832
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("svg", {
833
+ xmlns: "http://www.w3.org/2000/svg",
834
+ width: "24",
835
+ height: "24",
836
+ viewBox: "0 0 24 24",
837
+ fill: "none",
838
+ stroke: "white",
839
+ strokeWidth: "2",
840
+ strokeLinecap: "round",
841
+ strokeLinejoin: "round",
842
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("line", {
843
+ x1: "18",
844
+ y1: "6",
845
+ x2: "6",
846
+ y2: "18"
847
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("line", {
848
+ x1: "6",
849
+ y1: "6",
850
+ x2: "18",
851
+ y2: "18"
852
+ })]
853
+ })
854
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
855
+ src: fullscreenImage,
856
+ alt: "Full screen view",
857
+ onClick: e => e.stopPropagation(),
858
+ style: {
859
+ maxWidth: "90vw",
860
+ maxHeight: "90vh",
861
+ objectFit: "contain",
862
+ cursor: "default",
863
+ boxShadow: "0 4px 20px rgba(0, 0, 0, 0.5)"
864
+ }
865
+ })]
866
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("style", {
867
+ children: "\n @keyframes fadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n \n /* Focus indicators for ContentPanel */\n [role=\"dialog\"] button:focus-visible,\n [role=\"dialog\"] [role=\"button\"]:focus-visible,\n [role=\"dialog\"] a:focus-visible {\n outline: 3px solid #1967d2 !important;\n outline-offset: 2px !important;\n box-shadow: 0 0 0 4px rgba(25, 103, 210, 0.1) !important;\n }\n \n [role=\"dialog\"] button:focus:not(:focus-visible),\n [role=\"dialog\"] a:focus:not(:focus-visible) {\n outline: none;\n }\n "
868
+ })]
869
+ });
870
+ };
871
+ const BottomContent = _ref2 => {
872
+ let {
873
+ showTijaria,
874
+ viewingReclamations,
875
+ viewingTijariaHistory,
876
+ activeChat,
877
+ infoMessages,
878
+ incidentMessages,
879
+ setViewingReclamations,
880
+ setViewingTijariaHistory,
881
+ setActiveChat,
882
+ setInfoMessages,
883
+ setIncidentMessages
884
+ } = _ref2;
885
+ const [selectedConversation, setSelectedConversation] = (0, _react.useState)(null);
886
+ if (viewingReclamations) {
887
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(ReclamationsList, {
888
+ onClose: () => setViewingReclamations(false)
889
+ });
890
+ }
891
+ if (viewingTijariaHistory) {
892
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(TijariaHistory, {
893
+ onClose: () => setViewingTijariaHistory(false),
894
+ setSelectedConversation: setSelectedConversation
895
+ });
896
+ }
897
+ if (activeChat) {
898
+ const messages = activeChat === "info" ? infoMessages : incidentMessages;
899
+ const setMessages = activeChat === "info" ? setInfoMessages : setIncidentMessages;
900
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(CustomChatInterface, {
901
+ type: activeChat,
902
+ onClose: () => setActiveChat(null),
903
+ messages: messages,
904
+ setMessages: setMessages
905
+ });
906
+ }
907
+ if (!showTijaria) {
908
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
909
+ style: {
910
+ flex: 1
911
+ }
912
+ });
913
+ }
914
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(TijariaChatbot, {
915
+ selectedConversation: selectedConversation
916
+ });
917
+ };
918
+ const CustomChatInterface = _ref3 => {
919
+ let {
920
+ type,
921
+ onClose,
922
+ messages,
923
+ setMessages
924
+ } = _ref3;
925
+ const [inputMessage, setInputMessage] = (0, _react.useState)("");
926
+ const [selectedFile, setSelectedFile] = (0, _react.useState)(null);
927
+ const chatRef = (0, _react.useRef)(null);
928
+ const fileInputRef = (0, _react.useRef)(null);
929
+ const chatConfig = {
930
+ info: {
931
+ title: "Live Support",
932
+ icon: _freeSolidSvgIcons.faHeadset,
933
+ color: "#17a2b8",
934
+ placeholder: "Posez votre question..."
935
+ },
936
+ incident: {
937
+ title: "Signaler un incident",
938
+ icon: _freeSolidSvgIcons.faWarning,
939
+ color: "#E82930",
940
+ placeholder: "Décrivez l'incident..."
941
+ }
942
+ };
943
+ const config = chatConfig[type];
944
+ (0, _react.useEffect)(() => {
945
+ if (chatRef.current) {
946
+ chatRef.current.scrollTop = chatRef.current.scrollHeight;
947
+ }
948
+ }, [messages]);
949
+ const handleSendMessage = () => {
950
+ if (!inputMessage.trim() && !selectedFile) return;
951
+ const newMessage = {
952
+ id: Date.now(),
953
+ sender: "user",
954
+ text: inputMessage,
955
+ file: selectedFile,
956
+ timestamp: new Date()
957
+ };
958
+ setMessages([...messages, newMessage]);
959
+ setInputMessage("");
960
+ setSelectedFile(null);
961
+ setTimeout(() => {
962
+ const responseMessage = {
963
+ id: Date.now() + 1,
964
+ sender: "agent",
965
+ text: type === "info" ? "Merci pour votre question. Notre équipe reviendra vers vous dans les plus brefs délais." : "Votre incident a été enregistré. Nous vous contacterons bientôt pour le suivi.",
966
+ timestamp: new Date()
967
+ };
968
+ setMessages(prev => [...prev, responseMessage]);
969
+ }, 1000);
970
+ };
971
+ const handleFileSelect = e => {
972
+ const file = e.target.files[0];
973
+ if (file) {
974
+ setSelectedFile(file);
975
+ }
976
+ };
977
+ const handleKeyPress = e => {
978
+ if (e.key === "Enter" && !e.shiftKey) {
979
+ e.preventDefault();
980
+ handleSendMessage();
981
+ }
982
+ };
983
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
984
+ style: {
985
+ flex: 1,
986
+ display: "flex",
987
+ flexDirection: "column",
988
+ backgroundColor: "#f5f5f5"
989
+ },
990
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
991
+ style: {
992
+ display: "flex",
993
+ justifyContent: "space-between",
994
+ alignItems: "center",
995
+ padding: "12px 16px",
996
+ backgroundColor: "white",
997
+ borderBottom: "1px solid #e0e0e0"
998
+ },
999
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1000
+ style: {
1001
+ display: "flex",
1002
+ alignItems: "center",
1003
+ gap: "12px",
1004
+ paddingTop: 1,
1005
+ paddingBottom: 2.5
1006
+ }
1007
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1008
+ onClick: onClose,
1009
+ style: {
1010
+ cursor: "pointer",
1011
+ color: "#666",
1012
+ padding: "4px",
1013
+ display: "flex",
1014
+ alignItems: "center"
1015
+ },
1016
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
1017
+ icon: _freeSolidSvgIcons.faTimes,
1018
+ style: {
1019
+ fontSize: "16px"
1020
+ }
1021
+ })
1022
+ })]
1023
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1024
+ style: {
1025
+ display: "flex",
1026
+ alignItems: "center",
1027
+ gap: "12px",
1028
+ padding: "16px",
1029
+ backgroundColor: "white",
1030
+ borderBottom: "1px solid #e0e0e0"
1031
+ },
1032
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1033
+ style: {
1034
+ width: "40px",
1035
+ height: "40px",
1036
+ borderRadius: "8px",
1037
+ backgroundColor: "#f5f5f5",
1038
+ display: "flex",
1039
+ alignItems: "center",
1040
+ justifyContent: "center"
1041
+ },
1042
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
1043
+ icon: config.icon,
1044
+ style: {
1045
+ color: config.color,
1046
+ fontSize: "20px"
1047
+ }
1048
+ })
1049
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1050
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1051
+ style: {
1052
+ fontWeight: "400",
1053
+ color: "#333",
1054
+ fontSize: "16px"
1055
+ },
1056
+ children: config.title
1057
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1058
+ style: {
1059
+ color: "#999",
1060
+ fontSize: "12px"
1061
+ },
1062
+ children: "Support Agent"
1063
+ })]
1064
+ })]
1065
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1066
+ ref: chatRef,
1067
+ style: {
1068
+ flex: 1,
1069
+ overflowY: "auto",
1070
+ padding: "16px",
1071
+ backgroundColor: "#f5f5f5"
1072
+ },
1073
+ children: messages.map(message => /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1074
+ style: {
1075
+ display: "flex",
1076
+ flexDirection: "column",
1077
+ alignItems: message.sender === "user" ? "flex-end" : "flex-start",
1078
+ marginBottom: "16px"
1079
+ },
1080
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1081
+ style: {
1082
+ display: "flex",
1083
+ alignItems: "center",
1084
+ gap: "6px",
1085
+ marginBottom: "4px"
1086
+ },
1087
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1088
+ style: {
1089
+ width: "6px",
1090
+ height: "6px",
1091
+ borderRadius: "50%",
1092
+ backgroundColor: message.sender === "user" ? config.color : "#4CAF50"
1093
+ }
1094
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
1095
+ style: {
1096
+ color: "#999",
1097
+ fontSize: "11px"
1098
+ },
1099
+ children: [message.sender === "user" ? "Vous" : "Support", " ", message.timestamp.toLocaleTimeString("fr-FR", {
1100
+ hour: "2-digit",
1101
+ minute: "2-digit"
1102
+ })]
1103
+ })]
1104
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1105
+ style: {
1106
+ maxWidth: "75%",
1107
+ padding: "12px 16px",
1108
+ borderRadius: "8px",
1109
+ backgroundColor: message.sender === "user" ? config.color : "white",
1110
+ color: message.sender === "user" ? "white" : "#333",
1111
+ boxShadow: message.sender !== "user" ? "0 1px 3px rgba(0,0,0,0.1)" : "none"
1112
+ },
1113
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1114
+ style: {
1115
+ fontSize: "14px",
1116
+ lineHeight: "1.5",
1117
+ whiteSpace: "pre-wrap",
1118
+ wordBreak: "break-word"
1119
+ },
1120
+ children: message.text
1121
+ }), message.file && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1122
+ style: {
1123
+ marginTop: "8px",
1124
+ padding: "8px",
1125
+ backgroundColor: message.sender === "user" ? "rgba(255,255,255,0.2)" : "#f5f5f5",
1126
+ borderRadius: "4px",
1127
+ fontSize: "12px",
1128
+ display: "flex",
1129
+ alignItems: "center",
1130
+ gap: "6px"
1131
+ },
1132
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
1133
+ icon: _freeSolidSvgIcons.faPaperclip
1134
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
1135
+ children: message.file.name
1136
+ })]
1137
+ })]
1138
+ }), message.sender === "user" && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
1139
+ style: {
1140
+ color: "#999",
1141
+ fontSize: "10px",
1142
+ marginTop: "4px"
1143
+ },
1144
+ children: "Lu"
1145
+ })]
1146
+ }, message.id))
1147
+ }), selectedFile && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1148
+ style: {
1149
+ padding: "8px 16px",
1150
+ backgroundColor: "#fff3cd",
1151
+ borderTop: "1px solid #ffc107",
1152
+ display: "flex",
1153
+ alignItems: "center",
1154
+ justifyContent: "space-between"
1155
+ },
1156
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1157
+ style: {
1158
+ display: "flex",
1159
+ alignItems: "center",
1160
+ gap: "8px",
1161
+ fontSize: "12px"
1162
+ },
1163
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
1164
+ icon: _freeSolidSvgIcons.faPaperclip,
1165
+ style: {
1166
+ color: "#856404"
1167
+ }
1168
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
1169
+ style: {
1170
+ color: "#856404"
1171
+ },
1172
+ children: selectedFile.name
1173
+ })]
1174
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
1175
+ icon: _freeSolidSvgIcons.faTimes,
1176
+ style: {
1177
+ cursor: "pointer",
1178
+ color: "#856404"
1179
+ },
1180
+ onClick: () => setSelectedFile(null)
1181
+ })]
1182
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1183
+ style: {
1184
+ display: "flex",
1185
+ alignItems: "flex-end",
1186
+ gap: "8px",
1187
+ padding: "12px 16px",
1188
+ backgroundColor: "white",
1189
+ borderTop: "1px solid #e0e0e0"
1190
+ },
1191
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactstrap.Input, {
1192
+ type: "textarea",
1193
+ rows: "1",
1194
+ style: {
1195
+ flex: 1,
1196
+ border: "none",
1197
+ resize: "none",
1198
+ fontSize: "14px",
1199
+ padding: "8px",
1200
+ maxHeight: "100px",
1201
+ overflowY: "auto",
1202
+ outline: "none",
1203
+ boxShadow: "none",
1204
+ fontWeight: "400"
1205
+ },
1206
+ placeholder: config.placeholder,
1207
+ value: inputMessage,
1208
+ onChange: e => setInputMessage(e.target.value),
1209
+ onKeyPress: handleKeyPress
1210
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
1211
+ type: "file",
1212
+ ref: fileInputRef,
1213
+ style: {
1214
+ display: "none"
1215
+ },
1216
+ onChange: handleFileSelect
1217
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1218
+ onClick: () => {
1219
+ var _fileInputRef$current;
1220
+ return (_fileInputRef$current = fileInputRef.current) === null || _fileInputRef$current === void 0 ? void 0 : _fileInputRef$current.click();
1221
+ },
1222
+ style: {
1223
+ cursor: "pointer",
1224
+ color: "#999",
1225
+ padding: "8px",
1226
+ display: "flex",
1227
+ alignItems: "center"
1228
+ },
1229
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
1230
+ icon: _freeSolidSvgIcons.faPaperclip,
1231
+ style: {
1232
+ fontSize: "18px"
1233
+ }
1234
+ })
1235
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1236
+ onClick: handleSendMessage,
1237
+ style: {
1238
+ cursor: inputMessage.trim() || selectedFile ? "pointer" : "not-allowed",
1239
+ color: inputMessage.trim() || selectedFile ? config.color : "#ccc",
1240
+ padding: "8px",
1241
+ display: "flex",
1242
+ alignItems: "center",
1243
+ transition: "color 0.2s"
1244
+ },
1245
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
1246
+ icon: _freeSolidSvgIcons.faPaperPlane,
1247
+ style: {
1248
+ fontSize: "18px"
1249
+ }
1250
+ })
1251
+ })]
1252
+ })]
1253
+ });
1254
+ };
1255
+ const ReclamationFormModal = _ref4 => {
1256
+ let {
1257
+ open,
1258
+ onClose
1259
+ } = _ref4;
1260
+ const [activeStep, setActiveStep] = (0, _react.useState)(0);
1261
+ const [formData, setFormData] = (0, _react.useState)({
1262
+ type: "",
1263
+ service: "",
1264
+ objet: "",
1265
+ sujet: "",
1266
+ files: []
1267
+ });
1268
+ const [submitted, setSubmitted] = (0, _react.useState)(false);
1269
+ const [referenceNumber, setReferenceNumber] = (0, _react.useState)("");
1270
+ const {
1271
+ mutate: createReclamation,
1272
+ isLoading
1273
+ } = (0, _useReclamation.useCreateReclamation)();
1274
+ const {
1275
+ data: listServiceReclamation,
1276
+ isFetching: isFetchingListServiceReclamation
1277
+ } = (0, _useReclamation.useListServiceReclamation)();
1278
+ const [error, setError] = (0, _react.useState)(null);
1279
+ const errorRef = (0, _react.useRef)(null);
1280
+ const CustomPopper = props => /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Popper, _objectSpread(_objectSpread({}, props), {}, {
1281
+ placement: "bottom-start",
1282
+ disablePortal: true
1283
+ }));
1284
+ const reclamationTypes = [{
1285
+ codigo: "BESOIN_INFORMATIONS",
1286
+ libelle: "Besoin d'informations"
1287
+ }, {
1288
+ codigo: "RECLAMATION",
1289
+ libelle: "Réclamation"
1290
+ }, {
1291
+ codigo: "SIGNALER_INCIDENT_TECHNIQUE",
1292
+ libelle: "Signaler un incident technique"
1293
+ }];
1294
+ const steps = ["Type de demande", "Service concerné", "Détails"];
1295
+ const ALLOWED_FILE_TYPES = {
1296
+ extensions: ".pdf,.doc,.docx,.xls,.xlsx,.jpg,.jpeg,.png,.gif",
1297
+ mimeTypes: ["application/pdf", "application/msword", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "image/jpeg", "image/png", "image/gif"]
1298
+ };
1299
+ (0, _react.useEffect)(() => {
1300
+ if (!open) {
1301
+ setTimeout(() => {
1302
+ setActiveStep(0);
1303
+ setFormData({
1304
+ type: "",
1305
+ service: "",
1306
+ objet: "",
1307
+ sujet: "",
1308
+ files: []
1309
+ });
1310
+ setSubmitted(false);
1311
+ setReferenceNumber("");
1312
+ }, 300);
1313
+ }
1314
+ }, [open]);
1315
+ (0, _react.useEffect)(() => {
1316
+ if (error && errorRef.current) {
1317
+ errorRef.current.scrollIntoView({
1318
+ behavior: "smooth",
1319
+ block: "center"
1320
+ });
1321
+ }
1322
+ }, [error]);
1323
+ const handleNext = () => {
1324
+ setActiveStep(prev => prev + 1);
1325
+ };
1326
+ const handleBack = () => {
1327
+ setActiveStep(prev => prev - 1);
1328
+ };
1329
+ const handleTypeChange = value => {
1330
+ setFormData(prev => _objectSpread(_objectSpread({}, prev), {}, {
1331
+ type: value
1332
+ }));
1333
+ };
1334
+ const handleServiceChange = (event, value) => {
1335
+ setFormData(prev => _objectSpread(_objectSpread({}, prev), {}, {
1336
+ service: value
1337
+ }));
1338
+ };
1339
+ const handleFileSelect = event => {
1340
+ const newFiles = Array.from(event.target.files);
1341
+ const maxSize = 2 * 1024 * 1024;
1342
+ let hasErrors = false;
1343
+ let errorMessages = [];
1344
+ setError(null);
1345
+ const validFiles = newFiles.filter(file => {
1346
+ if (!ALLOWED_FILE_TYPES.mimeTypes.includes(file.type)) {
1347
+ const errorMsg = "".concat(file.name, ": Type de fichier non autoris\xE9.");
1348
+ errorMessages.push(errorMsg);
1349
+ hasErrors = true;
1350
+ return false;
1351
+ }
1352
+ if (file.size > maxSize) {
1353
+ const errorMsg = "".concat(file.name, ": Taille sup\xE9rieure \xE0 2 Mo.");
1354
+ errorMessages.push(errorMsg);
1355
+ hasErrors = true;
1356
+ return false;
1357
+ }
1358
+ return true;
1359
+ });
1360
+ if (hasErrors) {
1361
+ const fullError = errorMessages.join(" ");
1362
+ setError(fullError);
1363
+ _reactToastify.toast.error(fullError);
1364
+ }
1365
+ setFormData(prev => _objectSpread(_objectSpread({}, prev), {}, {
1366
+ files: [...prev.files, ...validFiles]
1367
+ }));
1368
+ };
1369
+ const removeFile = indexToRemove => {
1370
+ setFormData(prev => _objectSpread(_objectSpread({}, prev), {}, {
1371
+ files: prev.files.filter((_, index) => index !== indexToRemove)
1372
+ }));
1373
+ };
1374
+ const handleSubmit = () => {
1375
+ setError(null);
1376
+ createReclamation(formData, {
1377
+ onSuccess: res => {
1378
+ setReferenceNumber(res === null || res === void 0 ? void 0 : res.reference);
1379
+ setSubmitted(true);
1380
+ setError(null);
1381
+ },
1382
+ onError: err => {
1383
+ var _err$response$data$me, _err$response;
1384
+ const errorMessage = (_err$response$data$me = (_err$response = err.response) === null || _err$response === void 0 || (_err$response = _err$response.data) === null || _err$response === void 0 ? void 0 : _err$response.message) !== null && _err$response$data$me !== void 0 ? _err$response$data$me : "Une erreur est survenue, veuillez réessayer plus tard.";
1385
+ setError(errorMessage);
1386
+ _reactToastify.toast.error(errorMessage);
1387
+ }
1388
+ });
1389
+ };
1390
+ const handleClose = () => {
1391
+ setError(null);
1392
+ onClose();
1393
+ };
1394
+ const canProceedStep1 = formData.type !== "";
1395
+ const canProceedStep2 = formData.service !== "";
1396
+ const canSubmit = formData.objet && formData.sujet;
1397
+ const renderStepContent = () => {
1398
+ switch (activeStep) {
1399
+ case 0:
1400
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Fade, {
1401
+ in: true,
1402
+ timeout: 500,
1403
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
1404
+ className: "step-content",
1405
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
1406
+ variant: "h5",
1407
+ className: "step-title",
1408
+ gutterBottom: true,
1409
+ children: "Quel est le type de votre demande ?"
1410
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
1411
+ variant: "body2",
1412
+ color: "text.secondary",
1413
+ sx: {
1414
+ mb: 4
1415
+ },
1416
+ children: "S\xE9lectionnez le type qui correspond le mieux \xE0 votre besoin"
1417
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.FormControl, {
1418
+ fullWidth: true,
1419
+ variant: "outlined",
1420
+ className: "type-select",
1421
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.InputLabel, {
1422
+ id: "type-label",
1423
+ children: "Type de demande"
1424
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Select, {
1425
+ labelId: "type-label",
1426
+ value: formData.type,
1427
+ onChange: e => handleTypeChange(e.target.value),
1428
+ label: "Type de demande",
1429
+ children: reclamationTypes.map(type => /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.MenuItem, {
1430
+ value: type.codigo,
1431
+ children: type.libelle
1432
+ }, type.codigo))
1433
+ })]
1434
+ })]
1435
+ })
1436
+ });
1437
+ case 1:
1438
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Fade, {
1439
+ in: true,
1440
+ timeout: 500,
1441
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
1442
+ className: "step-content",
1443
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
1444
+ variant: "h5",
1445
+ className: "step-title",
1446
+ gutterBottom: true,
1447
+ children: "Quel service est concern\xE9 ?"
1448
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
1449
+ variant: "body2",
1450
+ color: "text.secondary",
1451
+ sx: {
1452
+ mb: formData.type === "Besoin d'informations" ? 3 : 4
1453
+ },
1454
+ children: "Recherchez et s\xE9lectionnez le service appropri\xE9"
1455
+ }), formData.type === "Besoin d'informations" && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Alert, {
1456
+ severity: "Besoin d'informations",
1457
+ icon: false,
1458
+ sx: {
1459
+ mb: 3,
1460
+ pt: 1,
1461
+ pb: 1,
1462
+ borderRadius: 2,
1463
+ backgroundColor: "#f5f9ff",
1464
+ border: "1px solid #90caf9",
1465
+ display: "flex",
1466
+ flexDirection: "column",
1467
+ maxWidth: 400,
1468
+ mx: "auto"
1469
+ },
1470
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.AlertTitle, {
1471
+ sx: {
1472
+ fontWeight: 600
1473
+ },
1474
+ children: "Besoin d'aide imm\xE9diate ?"
1475
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Typography, {
1476
+ variant: "body2",
1477
+ sx: {
1478
+ mt: 0.5,
1479
+ textAlign: "center"
1480
+ },
1481
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("strong", {
1482
+ children: "Assistance t\xE9l\xE9phonique: "
1483
+ }), " \uD83D\uDCDE +212 520 47 31 00"]
1484
+ })]
1485
+ }), formData.type === "Besoin d'informations" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
1486
+ sx: {
1487
+ mt: 3
1488
+ }
1489
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Autocomplete, {
1490
+ options: listServiceReclamation || [],
1491
+ loading: isFetchingListServiceReclamation,
1492
+ value: formData.service || "",
1493
+ onChange: handleServiceChange,
1494
+ getOptionLabel: option => (option === null || option === void 0 ? void 0 : option.libelle) || "",
1495
+ renderInput: params => /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, _objectSpread(_objectSpread({}, params), {}, {
1496
+ label: "Rechercher un service",
1497
+ placeholder: "Commencez \xE0 taper...",
1498
+ variant: "outlined",
1499
+ fullWidth: true
1500
+ })),
1501
+ renderOption: (props, option) => /*#__PURE__*/(0, _jsxRuntime.jsx)("li", _objectSpread(_objectSpread({}, props), {}, {
1502
+ className: "service-option",
1503
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
1504
+ display: "flex",
1505
+ alignItems: "center",
1506
+ gap: 1,
1507
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
1508
+ className: "service-bullet"
1509
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
1510
+ children: option === null || option === void 0 ? void 0 : option.libelle
1511
+ })]
1512
+ })
1513
+ })),
1514
+ PopperComponent: CustomPopper,
1515
+ noOptionsText: "Aucun service trouv\xE9",
1516
+ className: "service-autocomplete"
1517
+ })]
1518
+ })
1519
+ });
1520
+ case 2:
1521
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Fade, {
1522
+ in: true,
1523
+ timeout: 500,
1524
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
1525
+ className: "step-content details-step",
1526
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
1527
+ variant: "h5",
1528
+ className: "step-title",
1529
+ gutterBottom: true,
1530
+ children: "Compl\xE9tez votre demande"
1531
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
1532
+ variant: "body2",
1533
+ color: "text.secondary",
1534
+ sx: {
1535
+ mb: 4
1536
+ },
1537
+ children: "Fournissez les d\xE9tails n\xE9cessaires pour traiter votre demande"
1538
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
1539
+ className: "form-fields",
1540
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, {
1541
+ fullWidth: true,
1542
+ required: true,
1543
+ label: "Objet",
1544
+ placeholder: "R\xE9sum\xE9 de votre demande",
1545
+ value: formData.objet,
1546
+ onChange: e => setFormData(prev => _objectSpread(_objectSpread({}, prev), {}, {
1547
+ objet: e.target.value
1548
+ })),
1549
+ variant: "outlined",
1550
+ className: "form-field"
1551
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, {
1552
+ fullWidth: true,
1553
+ required: true,
1554
+ label: "Sujet",
1555
+ placeholder: "D\xE9crivez en d\xE9tail votre demande...",
1556
+ value: formData.sujet,
1557
+ onChange: e => setFormData(prev => _objectSpread(_objectSpread({}, prev), {}, {
1558
+ sujet: e.target.value
1559
+ })),
1560
+ variant: "outlined",
1561
+ multiline: true,
1562
+ rows: 6,
1563
+ className: "form-field",
1564
+ inputProps: {
1565
+ maxLength: 500
1566
+ }
1567
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
1568
+ className: "file-upload-section",
1569
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
1570
+ type: "file",
1571
+ id: "file-upload",
1572
+ accept: ALLOWED_FILE_TYPES.extensions,
1573
+ hidden: true,
1574
+ multiple: true,
1575
+ onChange: handleFileSelect
1576
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
1577
+ htmlFor: "file-upload",
1578
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
1579
+ variant: "outlined",
1580
+ component: "span",
1581
+ startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.CloudUpload, {}),
1582
+ className: "upload-button",
1583
+ fullWidth: true,
1584
+ children: "Joindre des fichiers (optionnel)"
1585
+ })
1586
+ }), error && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Alert, {
1587
+ ref: errorRef,
1588
+ severity: "error",
1589
+ onClose: () => setError(null),
1590
+ style: {
1591
+ marginTop: "12px"
1592
+ },
1593
+ children: error
1594
+ }), formData.files.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
1595
+ sx: {
1596
+ mt: 2,
1597
+ display: "flex",
1598
+ flexWrap: "wrap",
1599
+ gap: 1
1600
+ },
1601
+ children: formData.files.map((file, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Chip, {
1602
+ icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.AttachFile, {}),
1603
+ label: file.name,
1604
+ onDelete: () => removeFile(index),
1605
+ className: "file-chip",
1606
+ color: "primary",
1607
+ variant: "outlined"
1608
+ }, index))
1609
+ })]
1610
+ })]
1611
+ })]
1612
+ })
1613
+ });
1614
+ default:
1615
+ return null;
1616
+ }
1617
+ };
1618
+ if (submitted) {
1619
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Dialog, {
1620
+ open: open,
1621
+ onClose: handleClose,
1622
+ maxWidth: "sm",
1623
+ fullWidth: true,
1624
+ className: "reclamation-modal success-modal",
1625
+ PaperProps: {
1626
+ className: "modal-paper"
1627
+ },
1628
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.DialogContent, {
1629
+ className: "success-content",
1630
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Zoom, {
1631
+ in: true,
1632
+ timeout: 500,
1633
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
1634
+ className: "success-container",
1635
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.CheckCircle, {
1636
+ className: "success-icon"
1637
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
1638
+ variant: "h5",
1639
+ className: "success-title",
1640
+ gutterBottom: true,
1641
+ children: "Demande enregistr\xE9e !"
1642
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
1643
+ variant: "body1",
1644
+ color: "text.secondary",
1645
+ sx: {
1646
+ mb: 3
1647
+ },
1648
+ children: "Votre demande a \xE9t\xE9 prise en charge avec succ\xE8s"
1649
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Paper, {
1650
+ elevation: 3,
1651
+ className: "reference-box",
1652
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
1653
+ variant: "h5",
1654
+ className: "reference-number",
1655
+ children: referenceNumber
1656
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
1657
+ variant: "caption",
1658
+ color: "text.secondary",
1659
+ sx: {
1660
+ mt: 1,
1661
+ display: "block"
1662
+ },
1663
+ children: "Conservez ce num\xE9ro pour suivre votre demande"
1664
+ })]
1665
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
1666
+ variant: "contained",
1667
+ onClick: handleClose,
1668
+ size: "large",
1669
+ className: "close-success-button",
1670
+ fullWidth: true,
1671
+ children: "Fermer"
1672
+ })]
1673
+ })
1674
+ })
1675
+ })
1676
+ });
1677
+ }
1678
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Dialog, {
1679
+ open: open,
1680
+ onClose: handleClose,
1681
+ maxWidth: "md",
1682
+ fullWidth: true,
1683
+ scroll: "body",
1684
+ className: "reclamation-modal",
1685
+ PaperProps: {
1686
+ className: "modal-paper"
1687
+ },
1688
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
1689
+ className: "modal-header",
1690
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
1691
+ display: "flex",
1692
+ alignItems: "center",
1693
+ gap: 2,
1694
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
1695
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
1696
+ variant: "h6",
1697
+ className: "header-title",
1698
+ children: "Nouvelle r\xE9clamation"
1699
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Typography, {
1700
+ variant: "caption",
1701
+ color: "white",
1702
+ children: ["Remplissez ce formulaire en ", steps.length, " \xE9tapes"]
1703
+ })]
1704
+ })
1705
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
1706
+ onClick: handleClose,
1707
+ className: "close-button",
1708
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.Close, {})
1709
+ })]
1710
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
1711
+ className: "progress-section",
1712
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.LinearProgress, {
1713
+ variant: "determinate",
1714
+ value: activeStep / (steps.length - 1) * 100,
1715
+ className: "progress-bar"
1716
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Stepper, {
1717
+ activeStep: activeStep,
1718
+ className: "stepper",
1719
+ children: steps.map(label => /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Step, {
1720
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.StepLabel, {
1721
+ children: label
1722
+ })
1723
+ }, label))
1724
+ })]
1725
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.DialogContent, {
1726
+ className: "modal-content",
1727
+ style: {
1728
+ overflow: activeStep === 1 ? "visible" : "auto"
1729
+ },
1730
+ children: renderStepContent()
1731
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
1732
+ className: "modal-footer",
1733
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
1734
+ onClick: handleBack,
1735
+ disabled: activeStep === 0,
1736
+ startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.ArrowBack, {}),
1737
+ className: "back-button",
1738
+ children: "Retour"
1739
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
1740
+ flex: 1
1741
+ }), activeStep < steps.length - 1 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
1742
+ variant: "contained",
1743
+ onClick: handleNext,
1744
+ endIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.ArrowForward, {}),
1745
+ disabled: activeStep === 0 && !canProceedStep1 || activeStep === 1 && !canProceedStep2,
1746
+ className: "next-button",
1747
+ children: "Suivant"
1748
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
1749
+ variant: "contained",
1750
+ onClick: handleSubmit,
1751
+ disabled: !canSubmit || isLoading,
1752
+ className: "submit-button",
1753
+ startIcon: isLoading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.CircularProgress, {
1754
+ size: 16,
1755
+ sx: {
1756
+ color: "var(--primary-color, #222f67)"
1757
+ }
1758
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.CheckCircle, {}),
1759
+ children: isLoading ? "Envoi en cours..." : "Soumettre"
1760
+ })]
1761
+ })]
1762
+ });
1763
+ };
1764
+ const ReclamationsList = _ref5 => {
1765
+ var _selectedReclamation$, _selectedReclamation$2, _selectedReclamation$3;
1766
+ let {
1767
+ onClose
1768
+ } = _ref5;
1769
+ const queryClient = (0, _reactQuery.useQueryClient)();
1770
+ const [selectedReclamation, setSelectedReclamation] = (0, _react.useState)(null);
1771
+ const [detailsDialogOpen, setDetailsDialogOpen] = (0, _react.useState)(false);
1772
+ const [page, setPage] = (0, _react.useState)(1);
1773
+ const [search, setSearch] = (0, _react.useState)();
1774
+ const [searchKey, setSearchKey] = (0, _react.useState)("");
1775
+ const STATUT_REPONDUE = "REPONDUE";
1776
+ const STATUT_EN_ATTENTE_COMPLEMENT = "EN_ATTENTE_COMPLEMENT";
1777
+ const STATUT_COLOR_MAP = {
1778
+ EN_ATTENTE: "#2196F3",
1779
+ EN_COURS: "#FF9800",
1780
+ REPONDUE: "#9C27B0",
1781
+ REOUVERTE: "#FF5722",
1782
+ CLOTUREE: "#4CAF50",
1783
+ TRAITE: "#4CAF50"
1784
+ };
1785
+ const STATUT_ICON_MAP = {
1786
+ EN_ATTENTE: "🕐",
1787
+ EN_COURS: "⚙️",
1788
+ REPONDUE: "💬",
1789
+ REOUVERTE: "🔄",
1790
+ CLOTUREE: "🔒"
1791
+ };
1792
+ const getStatusColorByCode = code => STATUT_COLOR_MAP[(code || "").toUpperCase()] || "#757575";
1793
+ const [reouvreDialogOpen, setReouvreDialogOpen] = (0, _react.useState)(false);
1794
+ const [reouvreDescription, setReouvreDescription] = (0, _react.useState)("");
1795
+ const [reouvreFiles, setReouvreFiles] = (0, _react.useState)([]);
1796
+ const reouvreFileInputRef = (0, _react.useRef)(null);
1797
+ const {
1798
+ data: reclamations,
1799
+ isFetching,
1800
+ error
1801
+ } = (0, _useReclamation.useListReclamation)(page, searchKey);
1802
+ const {
1803
+ mutate: downloadDocument,
1804
+ isLoading: isDownloading,
1805
+ error: errorDownloadDocument
1806
+ } = (0, _useReclamation.useDownloadDocument)();
1807
+ const {
1808
+ mutate: clotureReclamation,
1809
+ isLoading: isCloturing
1810
+ } = (0, _useReclamation.useClotureReclamation)();
1811
+ const {
1812
+ mutate: reouvreReclamation,
1813
+ isLoading: isReouvring
1814
+ } = (0, _useReclamation.useReouvreReclamation)();
1815
+ const getStatusColor = statut => {
1816
+ switch ((statut || "").toLowerCase()) {
1817
+ case "traité":
1818
+ case "cloturee":
1819
+ return "#4CAF50";
1820
+ case "en cours":
1821
+ return "#FF9800";
1822
+ case "en attente":
1823
+ return "#2196F3";
1824
+ case "repondue":
1825
+ return "#9C27B0";
1826
+ case "reouverte":
1827
+ return "#FF5722";
1828
+ default:
1829
+ return "#757575";
1830
+ }
1831
+ };
1832
+ const isHtml = str => /<\/?[a-z][\s\S]*>/i.test(str);
1833
+ const renderTextWithLinks = text => {
1834
+ if (!text) return null;
1835
+ const parts = text.split(/(https?:\/\/[^\s)]+)/g);
1836
+ return parts.map((part, i) => /^https?:\/\//.test(part) ? /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
1837
+ href: part,
1838
+ target: "_blank",
1839
+ rel: "noopener noreferrer",
1840
+ style: {
1841
+ color: "var(--primary-color, #222f67)",
1842
+ wordBreak: "break-all"
1843
+ },
1844
+ children: part
1845
+ }, i) : /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
1846
+ children: part
1847
+ }, i));
1848
+ };
1849
+ const handleReclamationClick = reclamation => {
1850
+ setSelectedReclamation(reclamation);
1851
+ setDetailsDialogOpen(true);
1852
+ };
1853
+ const handleCloseDetails = () => {
1854
+ setDetailsDialogOpen(false);
1855
+ setSelectedReclamation(null);
1856
+ };
1857
+ const handleCloturer = () => {
1858
+ if (!(selectedReclamation !== null && selectedReclamation !== void 0 && selectedReclamation.id)) return;
1859
+ clotureReclamation(selectedReclamation.id, {
1860
+ onSuccess: () => {
1861
+ queryClient.invalidateQueries("reclamations");
1862
+ handleCloseDetails();
1863
+ _reactToastify.toast.success("Réclamation clôturée avec succès.");
1864
+ },
1865
+ onError: err => {
1866
+ var _err$response$data$me2, _err$response2;
1867
+ const msg = (_err$response$data$me2 = (_err$response2 = err.response) === null || _err$response2 === void 0 || (_err$response2 = _err$response2.data) === null || _err$response2 === void 0 ? void 0 : _err$response2.message) !== null && _err$response$data$me2 !== void 0 ? _err$response$data$me2 : "Une erreur est survenue lors de la clôture.";
1868
+ _reactToastify.toast.error(msg);
1869
+ }
1870
+ });
1871
+ };
1872
+ const handleOpenReouvreDialog = () => {
1873
+ setReouvreDescription("");
1874
+ setReouvreFiles([]);
1875
+ setReouvreDialogOpen(true);
1876
+ };
1877
+ const handleCloseReouvreDialog = () => {
1878
+ setReouvreDialogOpen(false);
1879
+ setReouvreDescription("");
1880
+ setReouvreFiles([]);
1881
+ };
1882
+ const handleReouvreFileSelect = e => {
1883
+ const selected = Array.from(e.target.files);
1884
+ setReouvreFiles(prev => [...prev, ...selected]);
1885
+ e.target.value = "";
1886
+ };
1887
+ const handleRemoveReouvreFile = index => {
1888
+ setReouvreFiles(prev => prev.filter((_, i) => i !== index));
1889
+ };
1890
+ const handleSubmitReouvreture = () => {
1891
+ if (!(selectedReclamation !== null && selectedReclamation !== void 0 && selectedReclamation.id) || !reouvreDescription.trim()) return;
1892
+ const formData = new FormData();
1893
+ formData.append("description", reouvreDescription.trim());
1894
+ reouvreFiles.forEach(file => formData.append("files", file));
1895
+ reouvreReclamation({
1896
+ id: selectedReclamation.id,
1897
+ formData
1898
+ }, {
1899
+ onSuccess: () => {
1900
+ queryClient.invalidateQueries("reclamations");
1901
+ handleCloseReouvreDialog();
1902
+ handleCloseDetails();
1903
+ _reactToastify.toast.success((selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.statutCode) === STATUT_EN_ATTENTE_COMPLEMENT ? "Compléments ajoutés avec succès." : "Réclamation réouverte avec succès.");
1904
+ },
1905
+ onError: err => {
1906
+ var _err$response$data$me3, _err$response3;
1907
+ const msg = (_err$response$data$me3 = (_err$response3 = err.response) === null || _err$response3 === void 0 || (_err$response3 = _err$response3.data) === null || _err$response3 === void 0 ? void 0 : _err$response3.message) !== null && _err$response$data$me3 !== void 0 ? _err$response$data$me3 : (selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.statutCode) === STATUT_EN_ATTENTE_COMPLEMENT ? "Une erreur est survenue lors de l'ajout des compléments." : "Une erreur est survenue lors de la réouverture.";
1908
+ _reactToastify.toast.error(msg);
1909
+ }
1910
+ });
1911
+ };
1912
+ const formatDate = dateString => {
1913
+ const date = new Date(dateString);
1914
+ return date.toLocaleDateString("fr-FR", {
1915
+ day: "2-digit",
1916
+ month: "2-digit",
1917
+ year: "numeric",
1918
+ hour: "2-digit",
1919
+ minute: "2-digit"
1920
+ });
1921
+ };
1922
+ const handleDownload = (documentGuid, documentName) => {
1923
+ downloadDocument(documentGuid, {
1924
+ onSuccess: res => {
1925
+ if (!(res !== null && res !== void 0 && res.data) || !(res !== null && res !== void 0 && res.fileName)) {
1926
+ console.error("No file data or filename received");
1927
+ return;
1928
+ }
1929
+ const byteCharacters = atob(res.data);
1930
+ const byteNumbers = new Array(byteCharacters.length);
1931
+ for (let i = 0; i < byteCharacters.length; i++) {
1932
+ byteNumbers[i] = byteCharacters.charCodeAt(i);
1933
+ }
1934
+ const byteArray = new Uint8Array(byteNumbers);
1935
+ const blob = new Blob([byteArray], {
1936
+ type: "application/octet-stream"
1937
+ });
1938
+ const link = document.createElement("a");
1939
+ link.href = URL.createObjectURL(blob);
1940
+ link.download = documentName;
1941
+ document.body.appendChild(link);
1942
+ link.click();
1943
+ document.body.removeChild(link);
1944
+ URL.revokeObjectURL(link.href);
1945
+ },
1946
+ onError: err => {
1947
+ console.error("Error downloading document:", err);
1948
+ }
1949
+ });
1950
+ };
1951
+ const onSearch = () => {
1952
+ setPage(1);
1953
+ setSearchKey(search);
1954
+ };
1955
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
1956
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1957
+ style: {
1958
+ flex: 1,
1959
+ display: "flex",
1960
+ flexDirection: "column",
1961
+ backgroundColor: "#f5f5f5",
1962
+ minHeight: 0
1963
+ },
1964
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1965
+ style: {
1966
+ display: "flex",
1967
+ justifyContent: "space-between",
1968
+ alignItems: "center",
1969
+ padding: "16px",
1970
+ backgroundColor: "white",
1971
+ borderBottom: "1px solid #e0e0e0"
1972
+ },
1973
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1974
+ style: {
1975
+ display: "flex",
1976
+ alignItems: "center",
1977
+ gap: "12px"
1978
+ },
1979
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
1980
+ icon: _freeSolidSvgIcons.faClipboardList,
1981
+ style: {
1982
+ color: "var(--primary-color, #222f67)",
1983
+ fontSize: "20px"
1984
+ }
1985
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1986
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
1987
+ component: "div",
1988
+ sx: {
1989
+ fontWeight: "600",
1990
+ color: "#333",
1991
+ fontSize: "16px",
1992
+ fontFamily: WIDGET_FONT,
1993
+ margin: 0,
1994
+ lineHeight: "normal"
1995
+ },
1996
+ children: "Mes r\xE9clamations"
1997
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Typography, {
1998
+ component: "div",
1999
+ sx: {
2000
+ color: "#999",
2001
+ fontSize: "12px",
2002
+ fontFamily: WIDGET_FONT,
2003
+ margin: 0,
2004
+ lineHeight: "normal"
2005
+ },
2006
+ children: [(reclamations === null || reclamations === void 0 ? void 0 : reclamations.totalElements) || 0, " r\xE9clamation(s)"]
2007
+ })]
2008
+ })]
2009
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2010
+ onClick: onClose,
2011
+ style: {
2012
+ cursor: "pointer",
2013
+ color: "#666",
2014
+ padding: "4px",
2015
+ display: "flex",
2016
+ alignItems: "center"
2017
+ },
2018
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
2019
+ icon: _freeSolidSvgIcons.faTimes,
2020
+ style: {
2021
+ fontSize: "16px"
2022
+ }
2023
+ })
2024
+ })]
2025
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2026
+ className: "search-fields",
2027
+ style: {
2028
+ display: "flex",
2029
+ justifyContent: "center",
2030
+ padding: "12px",
2031
+ paddingBottom: "0px"
2032
+ },
2033
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, {
2034
+ placeholder: "R\xE9clamation / R\xE9f\xE9rence",
2035
+ variant: "outlined",
2036
+ size: "small",
2037
+ value: search,
2038
+ onChange: e => setSearch(e.target.value),
2039
+ fullWidth: true,
2040
+ InputLabelProps: {
2041
+ style: {
2042
+ fontSize: 12
2043
+ }
2044
+ },
2045
+ sx: {
2046
+ "& .MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline": {
2047
+ borderColor: "var(--primary-color, #222f67)"
2048
+ }
2049
+ }
2050
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
2051
+ onClick: onSearch,
2052
+ variant: "contained",
2053
+ sx: {
2054
+ minWidth: "48px",
2055
+ width: "48px",
2056
+ height: "40px",
2057
+ borderRadius: "5px",
2058
+ backgroundColor: "var(--primary-color, #222f67)",
2059
+ "&:hover": {
2060
+ backgroundColor: "var(--primary-color, #222f67)",
2061
+ opacity: 0.9
2062
+ },
2063
+ flexShrink: 0,
2064
+ marginLeft: "0px",
2065
+ boxShadow: "none",
2066
+ padding: 0
2067
+ },
2068
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.Search, {
2069
+ sx: {
2070
+ color: "white",
2071
+ fontSize: "25px"
2072
+ }
2073
+ })
2074
+ })]
2075
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2076
+ style: {
2077
+ flex: 1,
2078
+ overflowY: "auto",
2079
+ padding: "8px",
2080
+ minHeight: 0
2081
+ },
2082
+ children: isFetching ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2083
+ style: {
2084
+ display: "flex",
2085
+ justifyContent: "center",
2086
+ padding: "24px"
2087
+ },
2088
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.CircularProgress, {
2089
+ size: 32,
2090
+ sx: {
2091
+ color: "var(--primary-color, #222f67)"
2092
+ }
2093
+ })
2094
+ }) : (reclamations === null || reclamations === void 0 ? void 0 : reclamations.totalElements) === 0 ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2095
+ style: {
2096
+ display: "flex",
2097
+ flexDirection: "column",
2098
+ alignItems: "center",
2099
+ justifyContent: "center",
2100
+ padding: "40px 20px",
2101
+ color: "#999"
2102
+ },
2103
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
2104
+ icon: _freeSolidSvgIcons.faClipboardList,
2105
+ style: {
2106
+ fontSize: "48px",
2107
+ marginBottom: "32px"
2108
+ }
2109
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2110
+ component: "div",
2111
+ sx: {
2112
+ fontSize: "14px",
2113
+ textAlign: "center",
2114
+ fontFamily: WIDGET_FONT,
2115
+ lineHeight: "normal",
2116
+ color: "#999"
2117
+ },
2118
+ children: "Aucune r\xE9clamation trouv\xE9e"
2119
+ })]
2120
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2121
+ children: [((reclamations === null || reclamations === void 0 ? void 0 : reclamations.content) || []).map(reclamation => /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2122
+ onClick: () => handleReclamationClick(reclamation),
2123
+ style: {
2124
+ backgroundColor: "white",
2125
+ borderRadius: "8px",
2126
+ padding: "16px",
2127
+ marginBottom: "5px",
2128
+ cursor: "pointer",
2129
+ boxShadow: "0 1px 3px rgba(0,0,0,0.1)",
2130
+ transition: "all 0.2s ease",
2131
+ border: "1px solid #e0e0e0"
2132
+ },
2133
+ onMouseEnter: e => {
2134
+ e.currentTarget.style.boxShadow = "0 4px 8px rgba(0,0,0,0.15)";
2135
+ e.currentTarget.style.transform = "translateY(-2px)";
2136
+ },
2137
+ onMouseLeave: e => {
2138
+ e.currentTarget.style.boxShadow = "0 1px 3px rgba(0,0,0,0.1)";
2139
+ e.currentTarget.style.transform = "translateY(0)";
2140
+ },
2141
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2142
+ style: {
2143
+ display: "flex",
2144
+ justifyContent: "space-between",
2145
+ alignItems: "center",
2146
+ marginBottom: "12px"
2147
+ },
2148
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2149
+ component: "div",
2150
+ sx: {
2151
+ fontWeight: "600",
2152
+ color: "var(--primary-color, #222f67)",
2153
+ fontSize: "14px",
2154
+ fontFamily: WIDGET_FONT,
2155
+ lineHeight: "normal"
2156
+ },
2157
+ children: reclamation === null || reclamation === void 0 ? void 0 : reclamation.reference
2158
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2159
+ component: "div",
2160
+ sx: {
2161
+ padding: "4px 12px",
2162
+ borderRadius: "12px",
2163
+ backgroundColor: getStatusColor(reclamation === null || reclamation === void 0 ? void 0 : reclamation.statut) + "20",
2164
+ color: getStatusColor(reclamation === null || reclamation === void 0 ? void 0 : reclamation.statut),
2165
+ fontSize: "11px",
2166
+ fontWeight: "600",
2167
+ fontFamily: WIDGET_FONT,
2168
+ lineHeight: "normal"
2169
+ },
2170
+ children: reclamation === null || reclamation === void 0 ? void 0 : reclamation.statut
2171
+ })]
2172
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2173
+ component: "div",
2174
+ sx: {
2175
+ fontWeight: "500",
2176
+ color: "#333",
2177
+ fontSize: "13px",
2178
+ marginBottom: "8px",
2179
+ fontFamily: WIDGET_FONT,
2180
+ lineHeight: "normal"
2181
+ },
2182
+ children: reclamation === null || reclamation === void 0 ? void 0 : reclamation.objet
2183
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2184
+ style: {
2185
+ display: "flex",
2186
+ justifyContent: "space-between",
2187
+ alignItems: "center"
2188
+ },
2189
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2190
+ component: "div",
2191
+ sx: {
2192
+ color: "#999",
2193
+ fontSize: "11px",
2194
+ fontFamily: WIDGET_FONT,
2195
+ lineHeight: "normal"
2196
+ },
2197
+ children: formatDate(reclamation === null || reclamation === void 0 ? void 0 : reclamation.dateCreation)
2198
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Typography, {
2199
+ component: "div",
2200
+ sx: {
2201
+ display: "flex",
2202
+ alignItems: "center",
2203
+ gap: "4px",
2204
+ color: "var(--primary-color, #222f67)",
2205
+ fontSize: "11px",
2206
+ fontWeight: "500",
2207
+ fontFamily: WIDGET_FONT,
2208
+ lineHeight: "normal"
2209
+ },
2210
+ children: ["Voir d\xE9tails", /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
2211
+ icon: _freeSolidSvgIcons.faEye
2212
+ })]
2213
+ })]
2214
+ })]
2215
+ }, reclamation === null || reclamation === void 0 ? void 0 : reclamation.id)), (reclamations === null || reclamations === void 0 ? void 0 : reclamations.totalPages) > 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2216
+ style: {
2217
+ display: "flex",
2218
+ justifyContent: "center",
2219
+ marginTop: "8px",
2220
+ marginBottom: "8px"
2221
+ },
2222
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Pagination, {
2223
+ size: "small",
2224
+ variant: "outlined",
2225
+ count: (reclamations === null || reclamations === void 0 ? void 0 : reclamations.totalPages) || 0,
2226
+ page: page,
2227
+ onChange: (event, value) => setPage(value)
2228
+ })
2229
+ })]
2230
+ })
2231
+ })]
2232
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Dialog, {
2233
+ open: detailsDialogOpen,
2234
+ onClose: handleCloseDetails,
2235
+ maxWidth: "sm",
2236
+ fullWidth: true,
2237
+ PaperProps: {
2238
+ sx: {
2239
+ borderRadius: 3,
2240
+ boxShadow: "0 8px 32px rgba(0,0,0,0.12)"
2241
+ }
2242
+ },
2243
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.DialogTitle, {
2244
+ sx: {
2245
+ backgroundColor: "#f8f9fa",
2246
+ borderBottom: "1px solid #e0e0e0",
2247
+ display: "flex",
2248
+ justifyContent: "space-between",
2249
+ alignItems: "center",
2250
+ padding: "20px 24px"
2251
+ },
2252
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2253
+ style: {
2254
+ display: "flex",
2255
+ alignItems: "center",
2256
+ gap: "12px"
2257
+ },
2258
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
2259
+ icon: _freeSolidSvgIcons.faInfoCircle,
2260
+ style: {
2261
+ color: "var(--primary-color, #222f67)",
2262
+ fontSize: "20px"
2263
+ }
2264
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2265
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2266
+ component: "div",
2267
+ sx: {
2268
+ fontWeight: "700",
2269
+ fontSize: "16px",
2270
+ margin: 0
2271
+ },
2272
+ children: "D\xE9tails de la r\xE9clamation"
2273
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2274
+ component: "div",
2275
+ sx: {
2276
+ color: "#666",
2277
+ fontSize: "12px",
2278
+ marginTop: "3px"
2279
+ },
2280
+ children: selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.reference
2281
+ })]
2282
+ })]
2283
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Chip, {
2284
+ label: selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.statut,
2285
+ size: "small",
2286
+ sx: {
2287
+ backgroundColor: getStatusColor((selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.statut) || "") + "20",
2288
+ color: getStatusColor((selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.statut) || ""),
2289
+ fontWeight: 600,
2290
+ fontSize: "11px"
2291
+ }
2292
+ })]
2293
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.DialogContent, {
2294
+ sx: {
2295
+ padding: "24px"
2296
+ },
2297
+ children: selectedReclamation && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2298
+ style: {
2299
+ display: "flex",
2300
+ flexDirection: "column",
2301
+ gap: "20px"
2302
+ },
2303
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2304
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2305
+ component: "div",
2306
+ sx: {
2307
+ fontSize: "11px",
2308
+ color: "#999",
2309
+ fontWeight: "500",
2310
+ marginBottom: "6px",
2311
+ textTransform: "uppercase",
2312
+ letterSpacing: "0.5px",
2313
+ fontWeight: "500",
2314
+ fontFamily: WIDGET_FONT
2315
+ },
2316
+ children: "Type de demande"
2317
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2318
+ component: "div",
2319
+ sx: {
2320
+ fontSize: "14px",
2321
+ color: "#333",
2322
+ fontWeight: "500",
2323
+ fontFamily: WIDGET_FONT
2324
+ },
2325
+ children: selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.type
2326
+ })]
2327
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2328
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2329
+ component: "div",
2330
+ sx: {
2331
+ fontSize: "11px",
2332
+ color: "#999",
2333
+ fontWeight: "500",
2334
+ marginBottom: "6px",
2335
+ textTransform: "uppercase",
2336
+ letterSpacing: "0.5px",
2337
+ fontFamily: WIDGET_FONT
2338
+ },
2339
+ children: "Service concern\xE9"
2340
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2341
+ component: "div",
2342
+ sx: {
2343
+ fontSize: "14px",
2344
+ color: "#333",
2345
+ fontWeight: "500",
2346
+ fontFamily: WIDGET_FONT
2347
+ },
2348
+ children: selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.service
2349
+ })]
2350
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2351
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2352
+ component: "div",
2353
+ sx: {
2354
+ fontSize: "11px",
2355
+ color: "#999",
2356
+ fontWeight: "500",
2357
+ marginBottom: "6px",
2358
+ textTransform: "uppercase",
2359
+ letterSpacing: "0.5px",
2360
+ fontFamily: WIDGET_FONT
2361
+ },
2362
+ children: "R\xE9f\xE9rence"
2363
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2364
+ component: "div",
2365
+ sx: {
2366
+ fontSize: "14px",
2367
+ color: "#333",
2368
+ fontWeight: "500",
2369
+ fontFamily: WIDGET_FONT
2370
+ },
2371
+ children: selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.reference
2372
+ })]
2373
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2374
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2375
+ component: "div",
2376
+ sx: {
2377
+ fontSize: "11px",
2378
+ color: "#999",
2379
+ fontWeight: "500",
2380
+ marginBottom: "6px",
2381
+ textTransform: "uppercase",
2382
+ letterSpacing: "0.5px",
2383
+ fontFamily: WIDGET_FONT
2384
+ },
2385
+ children: "Objet"
2386
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2387
+ component: "div",
2388
+ sx: {
2389
+ fontSize: "14px",
2390
+ color: "#333",
2391
+ fontWeight: "500",
2392
+ fontFamily: WIDGET_FONT
2393
+ },
2394
+ children: selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.objet
2395
+ })]
2396
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2397
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2398
+ component: "div",
2399
+ sx: {
2400
+ fontSize: "11px",
2401
+ color: "#999",
2402
+ fontWeight: "500",
2403
+ marginBottom: "6px",
2404
+ textTransform: "uppercase",
2405
+ letterSpacing: "0.5px",
2406
+ fontFamily: WIDGET_FONT
2407
+ },
2408
+ children: "Description"
2409
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2410
+ component: "div",
2411
+ sx: {
2412
+ fontSize: "14px",
2413
+ color: "#333",
2414
+ lineHeight: "1.6",
2415
+ backgroundColor: "#f8f9fa",
2416
+ padding: "12px",
2417
+ borderRadius: "8px",
2418
+ border: "1px solid #e0e0e0",
2419
+ whiteSpace: "pre-line",
2420
+ fontFamily: WIDGET_FONT
2421
+ },
2422
+ children: selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.description
2423
+ })]
2424
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2425
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2426
+ component: "div",
2427
+ sx: {
2428
+ fontSize: "11px",
2429
+ color: "#999",
2430
+ fontWeight: "500",
2431
+ marginBottom: "6px",
2432
+ textTransform: "uppercase",
2433
+ letterSpacing: "0.5px",
2434
+ fontFamily: WIDGET_FONT
2435
+ },
2436
+ children: "Date de cr\xE9ation"
2437
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2438
+ component: "div",
2439
+ sx: {
2440
+ fontSize: "14px",
2441
+ color: "#333",
2442
+ fontWeight: "500",
2443
+ fontFamily: WIDGET_FONT
2444
+ },
2445
+ children: formatDate(selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.dateCreation)
2446
+ })]
2447
+ }), (selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.documents) && (selectedReclamation === null || selectedReclamation === void 0 || (_selectedReclamation$ = selectedReclamation.documents) === null || _selectedReclamation$ === void 0 ? void 0 : _selectedReclamation$.length) > 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2448
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Typography, {
2449
+ component: "div",
2450
+ sx: {
2451
+ fontSize: "11px",
2452
+ color: "#999",
2453
+ fontWeight: "500",
2454
+ marginBottom: "12px",
2455
+ textTransform: "uppercase",
2456
+ letterSpacing: "0.5px",
2457
+ fontFamily: WIDGET_FONT
2458
+ },
2459
+ children: ["Pi\xE8ces jointes (", selectedReclamation === null || selectedReclamation === void 0 || (_selectedReclamation$2 = selectedReclamation.documents) === null || _selectedReclamation$2 === void 0 ? void 0 : _selectedReclamation$2.length, ")"]
2460
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2461
+ style: {
2462
+ display: "flex",
2463
+ flexDirection: "column",
2464
+ gap: "8px"
2465
+ },
2466
+ children: selectedReclamation.documents.map((document, index) => /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2467
+ style: {
2468
+ display: "flex",
2469
+ alignItems: "center",
2470
+ gap: "12px",
2471
+ padding: "12px",
2472
+ backgroundColor: "#f8f9fa",
2473
+ borderRadius: "8px",
2474
+ border: "1px solid #e0e0e0",
2475
+ cursor: isDownloading ? "not-allowed" : "pointer",
2476
+ opacity: isDownloading ? 0.6 : 1,
2477
+ transition: "all 0.2s ease"
2478
+ },
2479
+ onClick: () => !isDownloading && handleDownload(document.documentGuid, document.documentName),
2480
+ onMouseEnter: e => {
2481
+ if (!isDownloading) {
2482
+ e.currentTarget.style.backgroundColor = "#e9ecef";
2483
+ e.currentTarget.style.borderColor = "var(--primary-color, #222f67)";
2484
+ }
2485
+ },
2486
+ onMouseLeave: e => {
2487
+ if (!isDownloading) {
2488
+ e.currentTarget.style.backgroundColor = "#f8f9fa";
2489
+ e.currentTarget.style.borderColor = "#e0e0e0";
2490
+ }
2491
+ },
2492
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
2493
+ icon: _freeSolidSvgIcons.faPaperclip,
2494
+ style: {
2495
+ color: "var(--primary-color, #222f67)",
2496
+ fontSize: "16px"
2497
+ }
2498
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2499
+ style: {
2500
+ flex: 1
2501
+ },
2502
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2503
+ component: "div",
2504
+ sx: {
2505
+ fontSize: "13px",
2506
+ color: "#333",
2507
+ fontWeight: "500",
2508
+ fontFamily: WIDGET_FONT
2509
+ },
2510
+ children: document.documentName
2511
+ }), document.dateUpload && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Typography, {
2512
+ component: "div",
2513
+ sx: {
2514
+ fontSize: "11px",
2515
+ color: "#999",
2516
+ marginTop: "2px",
2517
+ fontFamily: WIDGET_FONT
2518
+ },
2519
+ children: ["Ajout\xE9 le ", formatDate(document.dateUpload)]
2520
+ })]
2521
+ }), isDownloading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.CircularProgress, {
2522
+ size: 16,
2523
+ style: {
2524
+ color: "var(--primary-color, #222f67)"
2525
+ }
2526
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
2527
+ icon: _freeSolidSvgIcons.faDownload,
2528
+ style: {
2529
+ color: "var(--primary-color, #222f67)",
2530
+ fontSize: "14px"
2531
+ }
2532
+ })]
2533
+ }, document.id || index))
2534
+ })]
2535
+ }), (selectedReclamation === null || selectedReclamation === void 0 || (_selectedReclamation$3 = selectedReclamation.statusHistories) === null || _selectedReclamation$3 === void 0 ? void 0 : _selectedReclamation$3.length) > 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2536
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2537
+ style: {
2538
+ fontSize: "11px",
2539
+ color: "#999",
2540
+ fontWeight: "600",
2541
+ marginBottom: "16px",
2542
+ textTransform: "uppercase",
2543
+ letterSpacing: "0.5px",
2544
+ fontFamily: WIDGET_FONT
2545
+ },
2546
+ children: "Historique des statuts"
2547
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2548
+ style: {
2549
+ position: "relative",
2550
+ paddingLeft: "24px"
2551
+ },
2552
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2553
+ style: {
2554
+ position: "absolute",
2555
+ left: "8px",
2556
+ top: "6px",
2557
+ bottom: "6px",
2558
+ width: "2px",
2559
+ backgroundColor: "#e0e0e0"
2560
+ }
2561
+ }), selectedReclamation.statusHistories.map((entry, index) => {
2562
+ var _entry$documents;
2563
+ const color = getStatusColorByCode(entry.statutApresCode);
2564
+ const isLast = index === selectedReclamation.statusHistories.length - 1;
2565
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2566
+ style: {
2567
+ position: "relative",
2568
+ marginBottom: isLast ? 0 : "20px"
2569
+ },
2570
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2571
+ style: {
2572
+ position: "absolute",
2573
+ left: "-20px",
2574
+ top: "4px",
2575
+ width: "12px",
2576
+ height: "12px",
2577
+ borderRadius: "50%",
2578
+ backgroundColor: color,
2579
+ border: "2px solid white",
2580
+ boxShadow: "0 0 0 2px ".concat(color)
2581
+ }
2582
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2583
+ style: {
2584
+ backgroundColor: "#f8f9fa",
2585
+ borderRadius: "8px",
2586
+ border: "1px solid ".concat(color, "22"),
2587
+ padding: "12px"
2588
+ },
2589
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2590
+ style: {
2591
+ display: "flex",
2592
+ justifyContent: "space-between",
2593
+ alignItems: "flex-start",
2594
+ marginBottom: entry.commentaire ? "10px" : 0
2595
+ },
2596
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2597
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2598
+ style: {
2599
+ display: "flex",
2600
+ alignItems: "center",
2601
+ gap: "6px",
2602
+ marginBottom: "2px"
2603
+ },
2604
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2605
+ style: {
2606
+ fontSize: "11px"
2607
+ },
2608
+ children: STATUT_ICON_MAP[entry.statutApresCode] || "📋"
2609
+ }), entry.statutAvantCode && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
2610
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2611
+ style: {
2612
+ fontSize: "11px",
2613
+ color: getStatusColorByCode(entry.statutAvantCode),
2614
+ fontWeight: "600",
2615
+ fontFamily: WIDGET_FONT
2616
+ },
2617
+ children: entry.statutAvantLibelle
2618
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2619
+ style: {
2620
+ fontSize: "11px",
2621
+ color: "#999"
2622
+ },
2623
+ children: "\u2192"
2624
+ })]
2625
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2626
+ style: {
2627
+ fontSize: "11px",
2628
+ color,
2629
+ fontWeight: "700",
2630
+ fontFamily: WIDGET_FONT
2631
+ },
2632
+ children: entry.statutApresLibelle
2633
+ })]
2634
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2635
+ style: {
2636
+ fontSize: "11px",
2637
+ color: "#999",
2638
+ fontFamily: WIDGET_FONT
2639
+ },
2640
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
2641
+ children: [entry.changedByNom ? entry.changedByNom : "Service Odoo", " \xB7 "]
2642
+ }), formatDate(entry.dateChangement)]
2643
+ })]
2644
+ })
2645
+ }), entry.commentaire && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2646
+ style: {
2647
+ fontSize: "13px",
2648
+ color: "#333",
2649
+ lineHeight: "1.5",
2650
+ fontFamily: WIDGET_FONT,
2651
+ backgroundColor: "white",
2652
+ padding: "8px 10px",
2653
+ borderRadius: "6px",
2654
+ border: "1px solid #e0e0e0",
2655
+ whiteSpace: "pre-line"
2656
+ },
2657
+ children: entry.commentaire
2658
+ }), entry.reponse && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2659
+ style: {
2660
+ marginTop: "8px",
2661
+ fontSize: "13px",
2662
+ color: "#333",
2663
+ lineHeight: "1.5",
2664
+ fontFamily: WIDGET_FONT,
2665
+ backgroundColor: "#f0f4ff",
2666
+ padding: "8px 10px",
2667
+ borderRadius: "6px",
2668
+ border: "1px solid #c5d0f0",
2669
+ whiteSpace: "pre-line"
2670
+ },
2671
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2672
+ style: {
2673
+ fontSize: "11px",
2674
+ fontWeight: "600",
2675
+ color: "#555",
2676
+ display: "block",
2677
+ marginBottom: "4px"
2678
+ },
2679
+ children: "\uD83D\uDCAC R\xE9ponse"
2680
+ }), isHtml(entry.reponse) ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2681
+ style: {
2682
+ whiteSpace: "normal"
2683
+ },
2684
+ dangerouslySetInnerHTML: {
2685
+ __html: _dompurify.default.sanitize(entry.reponse)
2686
+ }
2687
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2688
+ style: {
2689
+ whiteSpace: "pre-line"
2690
+ },
2691
+ children: entry.reponse
2692
+ })]
2693
+ }), ((_entry$documents = entry.documents) === null || _entry$documents === void 0 ? void 0 : _entry$documents.length) > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2694
+ style: {
2695
+ marginTop: "8px",
2696
+ display: "flex",
2697
+ flexDirection: "column",
2698
+ gap: "6px"
2699
+ },
2700
+ children: entry.documents.map((doc, di) => /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2701
+ style: {
2702
+ display: "flex",
2703
+ alignItems: "center",
2704
+ gap: "8px",
2705
+ padding: "6px 10px",
2706
+ backgroundColor: "white",
2707
+ borderRadius: "6px",
2708
+ border: "1px solid #e0e0e0",
2709
+ cursor: isDownloading ? "not-allowed" : "pointer",
2710
+ opacity: isDownloading ? 0.6 : 1
2711
+ },
2712
+ onClick: () => !isDownloading && handleDownload(doc.documentGuid, doc.documentName),
2713
+ onMouseEnter: e => {
2714
+ if (!isDownloading) e.currentTarget.style.backgroundColor = "#f0f0f0";
2715
+ },
2716
+ onMouseLeave: e => {
2717
+ if (!isDownloading) e.currentTarget.style.backgroundColor = "white";
2718
+ },
2719
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
2720
+ icon: _freeSolidSvgIcons.faPaperclip,
2721
+ style: {
2722
+ color: "var(--primary-color, #222f67)",
2723
+ fontSize: "12px"
2724
+ }
2725
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2726
+ style: {
2727
+ flex: 1,
2728
+ fontSize: "12px",
2729
+ color: "#333",
2730
+ fontFamily: WIDGET_FONT
2731
+ },
2732
+ children: doc.documentName
2733
+ }), isDownloading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.CircularProgress, {
2734
+ size: 12,
2735
+ style: {
2736
+ color: "var(--primary-color, #222f67)"
2737
+ }
2738
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
2739
+ icon: _freeSolidSvgIcons.faDownload,
2740
+ style: {
2741
+ color: "var(--primary-color, #222f67)",
2742
+ fontSize: "12px"
2743
+ }
2744
+ })]
2745
+ }, doc.id || di))
2746
+ })]
2747
+ })]
2748
+ }, entry.id || index);
2749
+ })]
2750
+ })]
2751
+ })]
2752
+ })
2753
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.DialogActions, {
2754
+ sx: {
2755
+ padding: "16px 24px",
2756
+ borderTop: "1px solid #e0e0e0",
2757
+ backgroundColor: "#f8f9fa",
2758
+ gap: "8px"
2759
+ },
2760
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
2761
+ onClick: handleCloseDetails,
2762
+ variant: "outlined",
2763
+ sx: {
2764
+ color: "var(--primary-color, #222f67)",
2765
+ borderColor: "var(--primary-color, #222f67)",
2766
+ padding: "5.5px 23px",
2767
+ borderRadius: "6px",
2768
+ fontWeight: "500",
2769
+ fontSize: "14px",
2770
+ textTransform: "none",
2771
+ boxShadow: "none",
2772
+ "&:hover": {
2773
+ borderColor: "var(--primary-color, #222f67)",
2774
+ backgroundColor: "rgba(34, 47, 103, 0.05)",
2775
+ boxShadow: "none"
2776
+ }
2777
+ },
2778
+ children: "Fermer"
2779
+ }), (selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.statutCode) === STATUT_REPONDUE && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
2780
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
2781
+ variant: "contained",
2782
+ onClick: handleCloturer,
2783
+ disabled: isCloturing,
2784
+ sx: {
2785
+ backgroundColor: "#e53935",
2786
+ color: "white",
2787
+ padding: "5.5px 23px",
2788
+ borderRadius: "6px",
2789
+ fontWeight: "500",
2790
+ fontSize: "14px",
2791
+ textTransform: "none",
2792
+ boxShadow: "none",
2793
+ "&:hover": {
2794
+ backgroundColor: "#c62828",
2795
+ boxShadow: "none"
2796
+ },
2797
+ "&:disabled": {
2798
+ backgroundColor: "#ef9a9a",
2799
+ boxShadow: "none"
2800
+ }
2801
+ },
2802
+ children: isCloturing ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.CircularProgress, {
2803
+ size: 16,
2804
+ sx: {
2805
+ color: "white"
2806
+ }
2807
+ }) : "Clôturer"
2808
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
2809
+ variant: "contained",
2810
+ onClick: handleOpenReouvreDialog,
2811
+ sx: {
2812
+ backgroundColor: "var(--primary-color, #222f67)",
2813
+ color: "white",
2814
+ padding: "5.5px 23px",
2815
+ borderRadius: "6px",
2816
+ fontWeight: "500",
2817
+ fontSize: "14px",
2818
+ textTransform: "none",
2819
+ boxShadow: "none",
2820
+ "&:hover": {
2821
+ backgroundColor: "var(--secondary-color, #2d3d7f)",
2822
+ boxShadow: "none"
2823
+ }
2824
+ },
2825
+ children: "R\xE9ouverture"
2826
+ })]
2827
+ }), (selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.statutCode) === STATUT_EN_ATTENTE_COMPLEMENT && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
2828
+ variant: "contained",
2829
+ onClick: handleOpenReouvreDialog,
2830
+ sx: {
2831
+ backgroundColor: "var(--primary-color, #222f67)",
2832
+ color: "white",
2833
+ padding: "5.5px 23px",
2834
+ borderRadius: "6px",
2835
+ fontWeight: "500",
2836
+ fontSize: "14px",
2837
+ textTransform: "none",
2838
+ boxShadow: "none",
2839
+ "&:hover": {
2840
+ backgroundColor: "var(--secondary-color, #2d3d7f)",
2841
+ boxShadow: "none"
2842
+ }
2843
+ },
2844
+ children: "Ajouter compl\xE9ments"
2845
+ })]
2846
+ })]
2847
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Dialog, {
2848
+ open: reouvreDialogOpen,
2849
+ onClose: handleCloseReouvreDialog,
2850
+ maxWidth: "sm",
2851
+ fullWidth: true,
2852
+ PaperProps: {
2853
+ sx: {
2854
+ borderRadius: 3,
2855
+ boxShadow: "0 8px 32px rgba(0,0,0,0.12)"
2856
+ }
2857
+ },
2858
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.DialogTitle, {
2859
+ sx: {
2860
+ backgroundColor: "#f8f9fa",
2861
+ borderBottom: "1px solid #e0e0e0",
2862
+ display: "flex",
2863
+ justifyContent: "space-between",
2864
+ alignItems: "center",
2865
+ padding: "20px 24px"
2866
+ },
2867
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2868
+ style: {
2869
+ display: "flex",
2870
+ alignItems: "center",
2871
+ gap: "12px"
2872
+ },
2873
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
2874
+ icon: _freeSolidSvgIcons.faReply,
2875
+ style: {
2876
+ color: "var(--primary-color, #222f67)",
2877
+ fontSize: "18px"
2878
+ }
2879
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2880
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2881
+ component: "div",
2882
+ sx: {
2883
+ fontWeight: "700",
2884
+ fontSize: "16px",
2885
+ margin: 0
2886
+ },
2887
+ children: (selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.statutCode) === STATUT_EN_ATTENTE_COMPLEMENT ? "Ajout de compléments" : "Réouverture de la réclamation"
2888
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
2889
+ component: "div",
2890
+ sx: {
2891
+ color: "#666",
2892
+ fontSize: "12px",
2893
+ marginTop: "3px"
2894
+ },
2895
+ children: selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.reference
2896
+ })]
2897
+ })]
2898
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
2899
+ onClick: handleCloseReouvreDialog,
2900
+ size: "small",
2901
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.Close, {
2902
+ fontSize: "small"
2903
+ })
2904
+ })]
2905
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.DialogContent, {
2906
+ sx: {
2907
+ padding: "24px",
2908
+ display: "flex",
2909
+ flexDirection: "column",
2910
+ gap: "20px"
2911
+ },
2912
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, {
2913
+ label: (selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.statutCode) === STATUT_EN_ATTENTE_COMPLEMENT ? "Compléments" : "Description",
2914
+ placeholder: (selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.statutCode) === STATUT_EN_ATTENTE_COMPLEMENT ? "Saisissez les compléments..." : "Décrivez la raison de la réouverture...",
2915
+ value: reouvreDescription,
2916
+ onChange: e => setReouvreDescription(e.target.value),
2917
+ multiline: true,
2918
+ rows: 5,
2919
+ fullWidth: true,
2920
+ required: true,
2921
+ variant: "outlined",
2922
+ inputProps: {
2923
+ maxLength: 500
2924
+ },
2925
+ sx: {
2926
+ mt: 1,
2927
+ "& .MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline": {
2928
+ borderColor: "var(--primary-color, #222f67)"
2929
+ },
2930
+ "& .MuiInputLabel-root.Mui-focused": {
2931
+ color: "var(--primary-color, #222f67)"
2932
+ }
2933
+ }
2934
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2935
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
2936
+ type: "file",
2937
+ ref: reouvreFileInputRef,
2938
+ style: {
2939
+ display: "none"
2940
+ },
2941
+ onChange: handleReouvreFileSelect,
2942
+ accept: ".pdf,.doc,.docx,.xls,.xlsx,.jpg,.jpeg,.png,.gif",
2943
+ multiple: true
2944
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
2945
+ variant: "outlined",
2946
+ startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.AttachFile, {}),
2947
+ onClick: () => {
2948
+ var _reouvreFileInputRef$;
2949
+ return (_reouvreFileInputRef$ = reouvreFileInputRef.current) === null || _reouvreFileInputRef$ === void 0 ? void 0 : _reouvreFileInputRef$.click();
2950
+ },
2951
+ sx: {
2952
+ borderRadius: "8px",
2953
+ border: "2px dashed var(--primary-color, #222f67)",
2954
+ color: "var(--primary-color, #222f67)",
2955
+ fontWeight: "600",
2956
+ textTransform: "none",
2957
+ width: "100%",
2958
+ "&:hover": {
2959
+ backgroundColor: "rgba(34, 47, 103, 0.05)",
2960
+ borderStyle: "solid"
2961
+ }
2962
+ },
2963
+ children: "Pi\xE8ces jointes (optionnel)"
2964
+ }), reouvreFiles.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
2965
+ sx: {
2966
+ mt: 1,
2967
+ display: "flex",
2968
+ flexWrap: "wrap",
2969
+ gap: 1
2970
+ },
2971
+ children: reouvreFiles.map((file, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Chip, {
2972
+ icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.AttachFile, {}),
2973
+ label: file.name,
2974
+ onDelete: () => handleRemoveReouvreFile(index),
2975
+ sx: {
2976
+ borderRadius: "8px"
2977
+ },
2978
+ color: "primary",
2979
+ variant: "outlined"
2980
+ }, index))
2981
+ })]
2982
+ })]
2983
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.DialogActions, {
2984
+ sx: {
2985
+ padding: "16px 24px",
2986
+ borderTop: "1px solid #e0e0e0",
2987
+ backgroundColor: "#f8f9fa",
2988
+ gap: "8px"
2989
+ },
2990
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
2991
+ onClick: handleCloseReouvreDialog,
2992
+ variant: "outlined",
2993
+ sx: {
2994
+ color: "var(--primary-color, #222f67)",
2995
+ borderColor: "var(--primary-color, #222f67)",
2996
+ padding: "5.5px 23px",
2997
+ borderRadius: "6px",
2998
+ fontWeight: "500",
2999
+ fontSize: "14px",
3000
+ textTransform: "none",
3001
+ boxShadow: "none",
3002
+ "&:hover": {
3003
+ borderColor: "var(--primary-color, #222f67)",
3004
+ backgroundColor: "rgba(34, 47, 103, 0.05)",
3005
+ boxShadow: "none"
3006
+ }
3007
+ },
3008
+ children: "Annuler"
3009
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
3010
+ variant: "contained",
3011
+ onClick: handleSubmitReouvreture,
3012
+ disabled: !reouvreDescription.trim() || isReouvring,
3013
+ sx: {
3014
+ backgroundColor: "var(--primary-color, #222f67)",
3015
+ color: "white",
3016
+ padding: "5.5px 23px",
3017
+ borderRadius: "6px",
3018
+ fontWeight: "500",
3019
+ fontSize: "14px",
3020
+ textTransform: "none",
3021
+ boxShadow: "none",
3022
+ "&:hover": {
3023
+ backgroundColor: "var(--secondary-color, #2d3d7f)",
3024
+ boxShadow: "none"
3025
+ },
3026
+ "&:disabled": {
3027
+ backgroundColor: "rgba(34, 47, 103, 0.4)",
3028
+ boxShadow: "none"
3029
+ }
3030
+ },
3031
+ children: isReouvring ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.CircularProgress, {
3032
+ size: 16,
3033
+ sx: {
3034
+ color: "white"
3035
+ }
3036
+ }) : (selectedReclamation === null || selectedReclamation === void 0 ? void 0 : selectedReclamation.statutCode) === STATUT_EN_ATTENTE_COMPLEMENT ? "Confirmer" : "Confirmer la réouverture"
3037
+ })]
3038
+ })]
3039
+ })]
3040
+ });
3041
+ };
3042
+ const TijariaChatbot = selectedConversation => {
3043
+ const {
3044
+ tijariaUrl,
3045
+ apiAuthUrl,
3046
+ token
3047
+ } = (0, _PuiHelpWidgetContext.useHelpWidget)();
3048
+ const iframeRef = (0, _react.useRef)(null);
3049
+ (0, _react.useEffect)(() => {
3050
+ const handleMessage = event => {
3051
+ if (event.origin !== tijariaUrl) {
3052
+ console.warn("Message from unauthorized origin:", event.origin);
3053
+ return;
3054
+ }
3055
+ if (event.data && event.data.type === "TOKEN_RECEIVED") {
3056
+ console.log("Token delivery confirmed by iframe:", event.data);
3057
+ sessionStorage.setItem("tijaria_token", event.data.token);
3058
+ }
3059
+ };
3060
+ window.addEventListener("message", handleMessage);
3061
+ return () => window.removeEventListener("message", handleMessage);
3062
+ }, []);
3063
+ (0, _react.useEffect)(() => {
3064
+ const iframe = iframeRef.current;
3065
+ const handleLoad = () => {
3066
+ iframe.contentWindow.postMessage({
3067
+ type: "SET_TOKEN",
3068
+ token: token,
3069
+ userInfoApi: "".concat(apiAuthUrl, "/auth/keycloak/user-profile")
3070
+ }, tijariaUrl);
3071
+ };
3072
+ iframe.addEventListener("load", handleLoad);
3073
+ return () => iframe.removeEventListener("load", handleLoad);
3074
+ }, []);
3075
+ (0, _react.useEffect)(() => {
3076
+ // console.log("selectedConversation", selectedConversation);
3077
+ const iframe = iframeRef.current;
3078
+ const handleSelect = () => {
3079
+ iframe.contentWindow.postMessage({
3080
+ type: "CONVERSATION_SELECTED",
3081
+ sessionId: selectedConversation.selectedConversation || null
3082
+ }, tijariaUrl);
3083
+ };
3084
+ iframe.addEventListener("load", handleSelect);
3085
+ return () => iframe.removeEventListener("load", handleSelect);
3086
+ }, [selectedConversation]);
3087
+ const isExpanded = true;
3088
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
3089
+ style: {
3090
+ flex: 1,
3091
+ overflow: "auto",
3092
+ display: "flex",
3093
+ flexDirection: "column"
3094
+ },
3095
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3096
+ style: {
3097
+ flex: 1,
3098
+ position: "relative"
3099
+ },
3100
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("iframe", {
3101
+ ref: iframeRef,
3102
+ id: "chatbot-iframe",
3103
+ title: "TijarIA",
3104
+ src: "".concat(tijariaUrl, "/assistantBot?source=PGU&expanded=").concat(isExpanded),
3105
+ allow: "microphone",
3106
+ sandbox: "allow-popups allow-scripts allow-same-origin",
3107
+ style: {
3108
+ width: "100%",
3109
+ height: "90%",
3110
+ border: "none",
3111
+ position: "absolute",
3112
+ top: 0,
3113
+ left: 0
3114
+ }
3115
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3116
+ onClick: () => {
3117
+ const iframe = iframeRef.current;
3118
+ if (iframe) {
3119
+ iframe.contentWindow.postMessage({
3120
+ type: "toggleSize",
3121
+ isExpanded: true
3122
+ }, tijariaUrl);
3123
+ }
3124
+ },
3125
+ style: {
3126
+ position: "absolute",
3127
+ bottom: "20px",
3128
+ left: "50%",
3129
+ transform: "translateX(-50%)",
3130
+ display: "flex",
3131
+ flexDirection: "row",
3132
+ alignItems: "center",
3133
+ gap: "10px",
3134
+ padding: "8px 16px",
3135
+ border: "none",
3136
+ backgroundColor: "transparent",
3137
+ cursor: "pointer"
3138
+ },
3139
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
3140
+ src: _tijariaLogo.default,
3141
+ alt: "Tijaria Logo",
3142
+ style: {
3143
+ width: "24px",
3144
+ height: "24px",
3145
+ objectFit: "contain",
3146
+ flexShrink: 0
3147
+ }
3148
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
3149
+ component: "div",
3150
+ sx: {
3151
+ fontSize: "16px",
3152
+ fontWeight: "500",
3153
+ fontFamily: WIDGET_FONT,
3154
+ margin: 0,
3155
+ lineHeight: "normal",
3156
+ color: "#495057"
3157
+ },
3158
+ children: "TijarIA"
3159
+ })]
3160
+ })]
3161
+ })
3162
+ });
3163
+ };
3164
+ const TijariaHistory = _ref6 => {
3165
+ let {
3166
+ onClose,
3167
+ setSelectedConversation
3168
+ } = _ref6;
3169
+ const [conversations, setConversations] = (0, _react.useState)([]);
3170
+ const [loading, setLoading] = (0, _react.useState)(true);
3171
+ const [error, setError] = (0, _react.useState)(null);
3172
+ (0, _react.useEffect)(() => {
3173
+ fetchUserHistory();
3174
+ }, []);
3175
+ const fetchUserHistory = async () => {
3176
+ try {
3177
+ setLoading(true);
3178
+ const response = await fetch("https://chatbot-dev.portnet.ma/api/user/getUserHistory", {
3179
+ method: "GET",
3180
+ headers: {
3181
+ Authorization: "Bearer ".concat(sessionStorage.getItem("tijaria_token")),
3182
+ "Content-Type": "application/json"
3183
+ }
3184
+ });
3185
+ if (!response.ok) {
3186
+ throw new Error("Erreur lors de la récupération de l'historique");
3187
+ }
3188
+ const data = await response.json();
3189
+ setConversations(data);
3190
+ setError(null);
3191
+ } catch (err) {
3192
+ console.error("Error fetching history:", err);
3193
+ setError(err.message);
3194
+ setConversations([]);
3195
+ } finally {
3196
+ setLoading(false);
3197
+ }
3198
+ };
3199
+ const handleConversationClick = conversation => {
3200
+ console.log(" Conversation clicked:", conversation);
3201
+ setSelectedConversation(conversation.sessionId);
3202
+ onClose();
3203
+ };
3204
+ const formatDate = dateString => {
3205
+ if (!dateString) return "N/A";
3206
+ const date = new Date(dateString);
3207
+ return date.toLocaleDateString("fr-FR", {
3208
+ day: "2-digit",
3209
+ month: "2-digit",
3210
+ year: "numeric",
3211
+ hour: "2-digit",
3212
+ minute: "2-digit"
3213
+ });
3214
+ };
3215
+ const truncateText = function truncateText(text) {
3216
+ let maxLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 80;
3217
+ if (!text) return "";
3218
+ return text.length > maxLength ? text.substring(0, maxLength) + "..." : text;
3219
+ };
3220
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3221
+ style: {
3222
+ flex: 1,
3223
+ display: "flex",
3224
+ flexDirection: "column",
3225
+ backgroundColor: "#f5f5f5"
3226
+ },
3227
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3228
+ style: {
3229
+ display: "flex",
3230
+ justifyContent: "space-between",
3231
+ alignItems: "center",
3232
+ padding: "16px",
3233
+ backgroundColor: "white",
3234
+ borderBottom: "1px solid #e0e0e0"
3235
+ },
3236
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3237
+ style: {
3238
+ display: "flex",
3239
+ alignItems: "center",
3240
+ gap: "12px"
3241
+ },
3242
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
3243
+ icon: _freeSolidSvgIcons.faComments,
3244
+ style: {
3245
+ color: "var(--primary-color, #222f67)",
3246
+ fontSize: "20px"
3247
+ }
3248
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3249
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
3250
+ component: "div",
3251
+ sx: {
3252
+ fontWeight: "600",
3253
+ color: "#333",
3254
+ fontSize: "16px",
3255
+ fontFamily: WIDGET_FONT,
3256
+ margin: 0,
3257
+ lineHeight: "normal"
3258
+ },
3259
+ children: "Historique TijarIA"
3260
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
3261
+ component: "div",
3262
+ sx: {
3263
+ color: "#999",
3264
+ fontSize: "12px",
3265
+ fontFamily: WIDGET_FONT,
3266
+ margin: 0,
3267
+ lineHeight: "normal"
3268
+ },
3269
+ children: loading ? "Chargement..." : "".concat(conversations.length, " conversation(s)")
3270
+ })]
3271
+ })]
3272
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
3273
+ onClick: onClose,
3274
+ style: {
3275
+ cursor: "pointer",
3276
+ color: "#666",
3277
+ padding: "4px",
3278
+ display: "flex",
3279
+ alignItems: "center"
3280
+ },
3281
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
3282
+ icon: _freeSolidSvgIcons.faTimes,
3283
+ style: {
3284
+ fontSize: "16px"
3285
+ }
3286
+ })
3287
+ })]
3288
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
3289
+ style: {
3290
+ flex: 1,
3291
+ overflowY: "auto",
3292
+ padding: "12px"
3293
+ },
3294
+ children: loading ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3295
+ style: {
3296
+ display: "flex",
3297
+ flexDirection: "column",
3298
+ alignItems: "center",
3299
+ justifyContent: "center",
3300
+ padding: "40px 20px",
3301
+ color: "#999"
3302
+ },
3303
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
3304
+ style: {
3305
+ width: "40px",
3306
+ height: "40px",
3307
+ border: "4px solid #f3f3f3",
3308
+ borderTop: "4px solid var(--primary-color, #222f67)",
3309
+ borderRadius: "50%",
3310
+ animation: "spin 1s linear infinite"
3311
+ }
3312
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("style", {
3313
+ children: "\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "
3314
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
3315
+ component: "div",
3316
+ sx: {
3317
+ fontSize: "14px",
3318
+ marginTop: "32px",
3319
+ fontFamily: WIDGET_FONT,
3320
+ lineHeight: "normal",
3321
+ color: "#999"
3322
+ },
3323
+ children: "Chargement de l'historique..."
3324
+ })]
3325
+ }) : error ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3326
+ style: {
3327
+ display: "flex",
3328
+ flexDirection: "column",
3329
+ alignItems: "center",
3330
+ justifyContent: "center",
3331
+ padding: "40px 20px",
3332
+ color: "#dc3545"
3333
+ },
3334
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
3335
+ icon: _freeSolidSvgIcons.faWarning,
3336
+ style: {
3337
+ fontSize: "48px",
3338
+ marginBottom: "16px"
3339
+ }
3340
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
3341
+ component: "div",
3342
+ sx: {
3343
+ fontSize: "14px",
3344
+ textAlign: "center",
3345
+ fontFamily: WIDGET_FONT,
3346
+ margin: 0,
3347
+ lineHeight: "normal"
3348
+ },
3349
+ children: error
3350
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
3351
+ onClick: fetchUserHistory,
3352
+ variant: "contained",
3353
+ sx: {
3354
+ marginTop: "35px",
3355
+ padding: "6px 20px",
3356
+ backgroundColor: "var(--primary-color, #222f67)",
3357
+ color: "white",
3358
+ borderRadius: "6px",
3359
+ fontSize: "14px",
3360
+ fontWeight: "600",
3361
+ fontFamily: WIDGET_FONT,
3362
+ textTransform: "none",
3363
+ boxShadow: "none",
3364
+ "&:hover": {
3365
+ backgroundColor: "var(--primary-color, #222f67)",
3366
+ opacity: 0.9,
3367
+ boxShadow: "none"
3368
+ }
3369
+ },
3370
+ children: "R\xE9essayer"
3371
+ })]
3372
+ }) : conversations.length === 0 ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3373
+ style: {
3374
+ display: "flex",
3375
+ flexDirection: "column",
3376
+ alignItems: "center",
3377
+ justifyContent: "center",
3378
+ padding: "40px 20px",
3379
+ color: "#999"
3380
+ },
3381
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
3382
+ icon: _freeSolidSvgIcons.faComments,
3383
+ style: {
3384
+ fontSize: "48px",
3385
+ marginBottom: "32px"
3386
+ }
3387
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
3388
+ component: "div",
3389
+ sx: {
3390
+ fontSize: "14px",
3391
+ textAlign: "center",
3392
+ fontFamily: WIDGET_FONT,
3393
+ lineHeight: "normal",
3394
+ color: "#999"
3395
+ },
3396
+ children: "Aucune conversation trouv\xE9e"
3397
+ })]
3398
+ }) : conversations.map((conversation, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
3399
+ onClick: () => handleConversationClick(conversation),
3400
+ style: {
3401
+ backgroundColor: "white",
3402
+ borderRadius: "8px",
3403
+ padding: "16px",
3404
+ marginBottom: "12px",
3405
+ cursor: "pointer",
3406
+ boxShadow: "0 1px 3px rgba(0,0,0,0.1)",
3407
+ transition: "all 0.2s ease",
3408
+ border: "1px solid #e0e0e0"
3409
+ },
3410
+ onMouseEnter: e => {
3411
+ e.currentTarget.style.boxShadow = "0 4px 8px rgba(0,0,0,0.15)";
3412
+ e.currentTarget.style.transform = "translateY(-2px)";
3413
+ },
3414
+ onMouseLeave: e => {
3415
+ e.currentTarget.style.boxShadow = "0 1px 3px rgba(0,0,0,0.1)";
3416
+ e.currentTarget.style.transform = "translateY(0)";
3417
+ },
3418
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3419
+ style: {
3420
+ display: "flex",
3421
+ justifyContent: "space-between",
3422
+ alignItems: "center",
3423
+ marginBottom: "12px"
3424
+ },
3425
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3426
+ style: {
3427
+ display: "flex",
3428
+ alignItems: "center",
3429
+ gap: "8px"
3430
+ },
3431
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
3432
+ icon: _freeSolidSvgIcons.faComments,
3433
+ style: {
3434
+ color: "var(--primary-color, #222f67)",
3435
+ fontSize: "14px"
3436
+ }
3437
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
3438
+ component: "div",
3439
+ sx: {
3440
+ fontWeight: "600",
3441
+ color: "#333",
3442
+ fontSize: "13px",
3443
+ fontFamily: WIDGET_FONT,
3444
+ margin: 0,
3445
+ lineHeight: "normal"
3446
+ },
3447
+ children: truncateText(conversation.title || "Aucun titre disponible")
3448
+ })]
3449
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
3450
+ style: {
3451
+ color: "#999",
3452
+ fontSize: "11px"
3453
+ },
3454
+ children: conversation.createdAt && formatDate(conversation.createdAt)
3455
+ })]
3456
+ })
3457
+ }, conversation.id || index))
3458
+ })]
3459
+ });
3460
+ };
3461
+ const PuiHelpWidget = _ref7 => {
3462
+ let {
3463
+ showReclamation = true,
3464
+ showGuides = false,
3465
+ showTijaria = true,
3466
+ currentProjectCode = null,
3467
+ guideBaseUrl
3468
+ } = _ref7;
3469
+ const [dropdownOpen, setDropdownOpen] = (0, _react.useState)(false);
3470
+ const [isTourActive, setIsTourActive] = (0, _react.useState)(false);
3471
+ const {
3472
+ guideApi
3473
+ } = (0, _PuiHelpWidgetContext.useHelpWidget)();
3474
+ const queryClient = (0, _reactQuery.useQueryClient)();
3475
+ const toggle = () => {
3476
+ setDropdownOpen(prev => !prev);
3477
+ };
3478
+ (0, _react.useEffect)(() => {
3479
+ const openDropdown = () => {
3480
+ setIsOpen(true);
3481
+ setIsTourActive(true);
3482
+ };
3483
+ const closeDropdown = () => {
3484
+ setIsOpen(false);
3485
+ setIsTourActive(false);
3486
+ };
3487
+ window.addEventListener("open-aide-dropdown", openDropdown);
3488
+ window.addEventListener("close-aide-dropdown", closeDropdown);
3489
+ return () => {
3490
+ window.removeEventListener("open-aide-dropdown", openDropdown);
3491
+ window.removeEventListener("close-aide-dropdown", closeDropdown);
3492
+ };
3493
+ }, []);
3494
+ const dispatch = (0, _reactRedux.useDispatch)();
3495
+ const [isOpen, setIsOpen] = (0, _react.useState)(false);
3496
+ const sidebarRef = (0, _react.useRef)(null);
3497
+ const triggerRef = (0, _react.useRef)(null);
3498
+ const firstFocusableRef = (0, _react.useRef)(null);
3499
+ const contactPopoverRef = (0, _react.useRef)(null);
3500
+ const firstContactFocusableRef = (0, _react.useRef)(null);
3501
+ const previousContactActiveElement = (0, _react.useRef)(null);
3502
+ const previousActiveElement = (0, _react.useRef)(null);
3503
+ const [hoveredIndex, setHoveredIndex] = (0, _react.useState)(null);
3504
+ const [activeChat, setActiveChat] = (0, _react.useState)(null);
3505
+ const [infoMessages, setInfoMessages] = (0, _react.useState)([]);
3506
+ const [incidentMessages, setIncidentMessages] = (0, _react.useState)([]);
3507
+ const [reclamationModalOpen, setReclamationModalOpen] = (0, _react.useState)(false);
3508
+ const [viewingReclamations, setViewingReclamations] = (0, _react.useState)(false);
3509
+ const [viewingTijariaHistory, setViewingTijariaHistory] = (0, _react.useState)(false);
3510
+ const [contactUsMenuAnchor, setContactUsMenuAnchor] = (0, _react.useState)(null);
3511
+ const contactUsMenuOpen = Boolean(contactUsMenuAnchor);
3512
+ const [popupPosition, setPopupPosition] = (0, _react.useState)({
3513
+ x: 0,
3514
+ y: 0
3515
+ });
3516
+ const [isDragging, setIsDragging] = (0, _react.useState)(false);
3517
+ const [dragStart, setDragStart] = (0, _react.useState)({
3518
+ x: 0,
3519
+ y: 0
3520
+ });
3521
+ const [guidesPanelOpen, setGuidesPanelOpen] = (0, _react.useState)(false);
3522
+ const [faqPanelOpen, setFaqPanelOpen] = (0, _react.useState)(false);
3523
+ const [guideData, setGuideData] = (0, _react.useState)(null);
3524
+ const [faqData, setFaqData] = (0, _react.useState)(null);
3525
+ const [loadingGuide, setLoadingGuide] = (0, _react.useState)(false);
3526
+ (0, _react.useEffect)(() => {
3527
+ async function fetchGuideData() {
3528
+ if (!showGuides || !currentProjectCode || !guidesPanelOpen) return;
3529
+ try {
3530
+ var _response$data;
3531
+ const response = await guideApi.getGuideContent(currentProjectCode);
3532
+ setGuideData(response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.body);
3533
+ } catch (error) {
3534
+ console.error("Error loading guide data:", error);
3535
+ setGuideData(null);
3536
+ }
3537
+ }
3538
+ fetchGuideData();
3539
+ }, [currentProjectCode, guidesPanelOpen, showGuides]);
3540
+ (0, _react.useEffect)(() => {
3541
+ async function fetchFaqData() {
3542
+ if (!faqPanelOpen) return;
3543
+ try {
3544
+ const faqModule = await _guides.default["FAQ"];
3545
+ const data = faqModule.default || faqModule;
3546
+ setFaqData(data);
3547
+ } catch (error) {
3548
+ console.error("Error loading FAQ data:", error);
3549
+ setFaqData(null);
3550
+ }
3551
+ }
3552
+ fetchFaqData();
3553
+ }, [faqPanelOpen]);
3554
+ const handleGuideMenuClick = event => {
3555
+ setIsOpen(false);
3556
+ setGuidesPanelOpen(true);
3557
+ };
3558
+ const handleFaqClick = () => {
3559
+ setIsOpen(false);
3560
+ setFaqPanelOpen(true);
3561
+ };
3562
+ const handleContactUsClick = event => {
3563
+ const rect = event.currentTarget.getBoundingClientRect();
3564
+ setContactUsMenuAnchor(event.currentTarget);
3565
+ setPopupPosition({
3566
+ x: rect.left - 291,
3567
+ y: rect.top
3568
+ });
3569
+ };
3570
+ const handleContactUsMenuClose = () => {
3571
+ setContactUsMenuAnchor(null);
3572
+ };
3573
+ const handleContactClick = () => {
3574
+ window.location.href = "mailto:support@moroccotradenet.ma";
3575
+ handleContactUsMenuClose();
3576
+ };
3577
+ const handlePdfGuideClick = async () => {
3578
+ setLoadingGuide(true);
3579
+ try {
3580
+ var _response$data2;
3581
+ const response = await guideApi.getGuideByProjectCode(currentProjectCode);
3582
+ const guideData = response === null || response === void 0 || (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.body;
3583
+ if (guideData !== null && guideData !== void 0 && guideData.urlFichier) {
3584
+ const link = document.createElement("a");
3585
+ link.href = guideData.urlFichier;
3586
+ link.setAttribute("download", "");
3587
+ document.body.appendChild(link);
3588
+ link.click();
3589
+ document.body.removeChild(link);
3590
+ } else {
3591
+ console.warn("No PDF guide found for project: ".concat(currentProjectCode));
3592
+ }
3593
+ } catch (error) {
3594
+ console.error("Error fetching guide:", error);
3595
+ } finally {
3596
+ setLoadingGuide(false);
3597
+ }
3598
+ };
3599
+ const handleMouseDown = e => {
3600
+ if (e.target.classList.contains("draggable-handle")) {
3601
+ setIsDragging(true);
3602
+ setDragStart({
3603
+ x: e.clientX - popupPosition.x,
3604
+ y: e.clientY - popupPosition.y
3605
+ });
3606
+ }
3607
+ };
3608
+ const handleMouseMove = e => {
3609
+ if (isDragging) {
3610
+ setPopupPosition({
3611
+ x: e.clientX - dragStart.x,
3612
+ y: e.clientY - dragStart.y
3613
+ });
3614
+ }
3615
+ };
3616
+ const handleMouseUp = () => {
3617
+ setIsDragging(false);
3618
+ };
3619
+ (0, _react.useEffect)(() => {
3620
+ if (isDragging) {
3621
+ document.addEventListener("mousemove", handleMouseMove);
3622
+ document.addEventListener("mouseup", handleMouseUp);
3623
+ return () => {
3624
+ document.removeEventListener("mousemove", handleMouseMove);
3625
+ document.removeEventListener("mouseup", handleMouseUp);
3626
+ };
3627
+ }
3628
+ }, [isDragging, dragStart, popupPosition]);
3629
+ (0, _react.useEffect)(() => {
3630
+ if (isOpen) {
3631
+ previousActiveElement.current = document.activeElement;
3632
+ setTimeout(() => {
3633
+ var _firstFocusableRef$cu3;
3634
+ (_firstFocusableRef$cu3 = firstFocusableRef.current) === null || _firstFocusableRef$cu3 === void 0 || _firstFocusableRef$cu3.focus();
3635
+ }, 100);
3636
+ } else {
3637
+ if (previousActiveElement.current) {
3638
+ previousActiveElement.current.focus();
3639
+ }
3640
+ }
3641
+ }, [isOpen]);
3642
+ (0, _react.useEffect)(() => {
3643
+ if (!isOpen) return;
3644
+ const handleKeyDown = e => {
3645
+ if (e.key === "Escape") {
3646
+ setIsOpen(false);
3647
+ return;
3648
+ }
3649
+ if (e.key === "Tab") {
3650
+ const sidebar = sidebarRef.current;
3651
+ if (!sidebar) return;
3652
+ const focusableElements = sidebar.querySelectorAll('button:not([disabled]), [href]:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled])');
3653
+ const focusableArray = Array.from(focusableElements);
3654
+ const firstElement = focusableArray[0];
3655
+ const lastElement = focusableArray[focusableArray.length - 1];
3656
+ if (focusableArray.length === 0) return;
3657
+ if (e.shiftKey) {
3658
+ if (document.activeElement === firstElement) {
3659
+ lastElement.focus();
3660
+ e.preventDefault();
3661
+ }
3662
+ } else {
3663
+ if (document.activeElement === lastElement) {
3664
+ firstElement.focus();
3665
+ e.preventDefault();
3666
+ }
3667
+ }
3668
+ }
3669
+ };
3670
+ document.addEventListener("keydown", handleKeyDown);
3671
+ return () => document.removeEventListener("keydown", handleKeyDown);
3672
+ }, [isOpen]);
3673
+ (0, _react.useEffect)(() => {
3674
+ if (isOpen) {
3675
+ document.body.style.overflow = "hidden";
3676
+ } else {
3677
+ document.body.style.overflow = "";
3678
+ }
3679
+ return () => {
3680
+ document.body.style.overflow = "";
3681
+ };
3682
+ }, [isOpen]);
3683
+ (0, _react.useEffect)(() => {
3684
+ if (contactUsMenuOpen) {
3685
+ previousContactActiveElement.current = document.activeElement;
3686
+ setTimeout(() => {
3687
+ const popover = contactPopoverRef.current;
3688
+ if (popover) {
3689
+ const firstMenuItem = popover.querySelector('[role="menuitem"]');
3690
+ if (firstMenuItem) {
3691
+ firstMenuItem.focus();
3692
+ }
3693
+ }
3694
+ }, 100);
3695
+ } else {
3696
+ if (previousContactActiveElement.current) {
3697
+ previousContactActiveElement.current.focus();
3698
+ }
3699
+ }
3700
+ }, [contactUsMenuOpen]);
3701
+ (0, _react.useEffect)(() => {
3702
+ if (!contactUsMenuOpen) return;
3703
+ const handleKeyDown = e => {
3704
+ if (e.key === "Escape") {
3705
+ handleContactUsMenuClose();
3706
+ return;
3707
+ }
3708
+ if (e.key === "Tab") {
3709
+ const popover = contactPopoverRef.current;
3710
+ if (!popover) return;
3711
+ const focusableElements = popover.querySelectorAll('button:not([disabled]), [role="menuitem"]:not([disabled]), [href]:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled])');
3712
+ const focusableArray = Array.from(focusableElements);
3713
+ const firstElement = focusableArray[0];
3714
+ const lastElement = focusableArray[focusableArray.length - 1];
3715
+ if (focusableArray.length === 0) return;
3716
+ if (e.shiftKey) {
3717
+ if (document.activeElement === firstElement) {
3718
+ lastElement.focus();
3719
+ e.preventDefault();
3720
+ }
3721
+ } else {
3722
+ if (document.activeElement === lastElement) {
3723
+ firstElement.focus();
3724
+ e.preventDefault();
3725
+ }
3726
+ }
3727
+ }
3728
+ };
3729
+ document.addEventListener("keydown", handleKeyDown);
3730
+ return () => document.removeEventListener("keydown", handleKeyDown);
3731
+ }, [contactUsMenuOpen]);
3732
+ const navigationLinks = [...(showGuides && currentProjectCode ? [{
3733
+ icon: _freeSolidSvgIcons.faBook,
3734
+ title: "Guides utilisateurs",
3735
+ action: handleGuideMenuClick
3736
+ }] : []), {
3737
+ icon: _freeSolidSvgIcons.faPen,
3738
+ title: "Foires aux questions",
3739
+ id: "foire-aux-questions",
3740
+ action: handleFaqClick
3741
+ }, ...(showReclamation ? [{
3742
+ icon: _freeSolidSvgIcons.faClipboardList,
3743
+ title: "Mes réclamations",
3744
+ id: "mes-reclamations",
3745
+ action: () => {
3746
+ queryClient.invalidateQueries("get_list_reclamation");
3747
+ setViewingReclamations(true);
3748
+ }
3749
+ }, {
3750
+ icon: _freeSolidSvgIcons.faBullhorn,
3751
+ title: "Nouvelle réclamation",
3752
+ id: "nouvelle-reclamation",
3753
+ action: () => setReclamationModalOpen(true)
3754
+ }] : []), {
3755
+ icon: _freeSolidSvgIcons.faAddressBook,
3756
+ title: "Contactez-nous",
3757
+ id: "contactez-nous",
3758
+ action: handleContactUsClick
3759
+ },
3760
+ /*{
3761
+ icon: faComments,
3762
+ title: "TijarIA",
3763
+ action: () => {
3764
+ setActiveChat(null);
3765
+ setViewingReclamations(false);
3766
+ },
3767
+ },*/
3768
+ ...(showTijaria ? [{
3769
+ icon: _freeSolidSvgIcons.faCommentDots,
3770
+ title: "TijarIA",
3771
+ id: "tijaria",
3772
+ action: () => {
3773
+ setViewingTijariaHistory(false);
3774
+ setViewingReclamations(false);
3775
+ }
3776
+ }, {
3777
+ icon: _freeSolidSvgIcons.faComments,
3778
+ title: "Historique TijarIA",
3779
+ id: "mes-conversations",
3780
+ action: () => {
3781
+ setViewingTijariaHistory(true);
3782
+ setViewingReclamations(false);
3783
+ }
3784
+ }] : [])];
3785
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
3786
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
3787
+ className: "help-widget-button ".concat(isOpen ? "open" : ""),
3788
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactstrap.Button, {
3789
+ ref: triggerRef,
3790
+ color: "light",
3791
+ className: "help-trigger",
3792
+ onClick: () => setIsOpen(!isOpen),
3793
+ "aria-label": "Ouvrir le centre d'aide",
3794
+ "aria-expanded": isOpen,
3795
+ "aria-controls": "help-sidebar",
3796
+ tabIndex: 0,
3797
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
3798
+ component: "div",
3799
+ sx: {
3800
+ fontWeight: "600",
3801
+ fontSize: "14px",
3802
+ color: "#282828",
3803
+ fontFamily: WIDGET_FONT,
3804
+ margin: 0,
3805
+ padding: 0,
3806
+ lineHeight: "normal"
3807
+ },
3808
+ children: "Besoin d'aide ?"
3809
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
3810
+ icon: isOpen ? _freeSolidSvgIcons.faChevronLeft : _freeSolidSvgIcons.faChevronRight,
3811
+ className: "arrow-icon",
3812
+ "aria-hidden": "true"
3813
+ })]
3814
+ })
3815
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
3816
+ id: "help-sidebar",
3817
+ ref: sidebarRef,
3818
+ className: "help-widget-sidebar ".concat(isOpen ? "open" : ""),
3819
+ role: "dialog",
3820
+ "aria-modal": "true",
3821
+ "aria-labelledby": "help-title",
3822
+ "aria-hidden": !isOpen,
3823
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactstrap.Card, {
3824
+ className: "h-100 border-0 shadow-lg",
3825
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactstrap.CardBody, {
3826
+ className: "p-0 d-flex flex-column",
3827
+ style: {
3828
+ flex: 1,
3829
+ minHeight: 0
3830
+ },
3831
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3832
+ style: {
3833
+ paddingTop: "12px",
3834
+ paddingBottom: "20px",
3835
+ paddingLeft: "17px",
3836
+ paddingRight: "20px",
3837
+ borderBottom: "1px solid #e9ecef",
3838
+ backgroundColor: "white",
3839
+ display: "flex",
3840
+ alignItems: "center",
3841
+ justifyContent: "space-between"
3842
+ },
3843
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3844
+ style: {
3845
+ display: "flex",
3846
+ alignItems: "center"
3847
+ },
3848
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
3849
+ icon: _freeRegularSvgIcons.faQuestionCircle,
3850
+ style: {
3851
+ color: "var(--primary-color, #222f67)",
3852
+ fontSize: "24px",
3853
+ marginRight: "8px",
3854
+ flexShrink: 0
3855
+ },
3856
+ "aria-hidden": "true"
3857
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
3858
+ id: "help-title",
3859
+ component: "div",
3860
+ onClick: () => setIsOpen(false),
3861
+ sx: {
3862
+ margin: 0,
3863
+ color: "#495057",
3864
+ fontWeight: "600",
3865
+ fontSize: "16px",
3866
+ cursor: "pointer",
3867
+ userSelect: "none",
3868
+ flex: 1,
3869
+ lineHeight: "normal",
3870
+ fontFamily: WIDGET_FONT,
3871
+ "&:hover": {
3872
+ color: "var(--primary-color, #222f67)"
3873
+ }
3874
+ },
3875
+ children: "Centre d'aide"
3876
+ })]
3877
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
3878
+ ref: firstFocusableRef,
3879
+ onClick: () => setIsOpen(false),
3880
+ "aria-label": "Fermer le centre d'aide",
3881
+ tabIndex: 0,
3882
+ style: {
3883
+ background: "none",
3884
+ border: "none",
3885
+ fontSize: "20px",
3886
+ cursor: "pointer",
3887
+ padding: "4px 8px",
3888
+ color: "#6c757d",
3889
+ lineHeight: 1,
3890
+ borderRadius: "4px"
3891
+ },
3892
+ onMouseEnter: e => {
3893
+ e.currentTarget.style.backgroundColor = "#f0f0f0";
3894
+ },
3895
+ onMouseLeave: e => {
3896
+ e.currentTarget.style.backgroundColor = "transparent";
3897
+ },
3898
+ children: "\u2715"
3899
+ })]
3900
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
3901
+ style: {
3902
+ padding: "15px 15px",
3903
+ borderBottom: "1px solid #e9ecef",
3904
+ backgroundColor: "white"
3905
+ },
3906
+ children: navigationLinks.map((link, index) => /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3907
+ id: link.id,
3908
+ onClick: link.action,
3909
+ onKeyDown: e => {
3910
+ if (e.key === "Enter" || e.key === " ") {
3911
+ e.preventDefault();
3912
+ link.action(e);
3913
+ }
3914
+ },
3915
+ role: "button",
3916
+ tabIndex: 0,
3917
+ "aria-label": link.title,
3918
+ style: {
3919
+ display: "flex",
3920
+ alignItems: "center",
3921
+ padding: "8px 12px",
3922
+ marginRight: "130px",
3923
+ cursor: "pointer",
3924
+ transition: "all 0.2s ease",
3925
+ borderRadius: "4px",
3926
+ backgroundColor: hoveredIndex === index ? "#f0f0ef" : "transparent"
3927
+ },
3928
+ onMouseEnter: () => setHoveredIndex(index),
3929
+ onMouseLeave: () => setHoveredIndex(null),
3930
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
3931
+ style: {
3932
+ width: "20px",
3933
+ display: "flex",
3934
+ justifyContent: "center",
3935
+ marginRight: "10px"
3936
+ },
3937
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
3938
+ icon: link.icon,
3939
+ style: {
3940
+ color: hoveredIndex === index ? "var(--primary-color, #222f67)" : "#6c757d",
3941
+ fontSize: "14px",
3942
+ transition: "color 0.2s ease"
3943
+ },
3944
+ "aria-hidden": "true"
3945
+ })
3946
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
3947
+ component: "div",
3948
+ sx: {
3949
+ color: hoveredIndex === index ? "var(--primary-color, #222f67)" : "#6c757d",
3950
+ fontSize: "12.2px",
3951
+ fontWeight: "500",
3952
+ transition: "color 0.2s ease",
3953
+ lineHeight: "normal",
3954
+ fontFamily: WIDGET_FONT,
3955
+ margin: 0,
3956
+ padding: 0
3957
+ },
3958
+ children: link.title
3959
+ })]
3960
+ }, index))
3961
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(BottomContent, {
3962
+ showTijaria: showTijaria,
3963
+ viewingReclamations: viewingReclamations,
3964
+ viewingTijariaHistory: viewingTijariaHistory,
3965
+ activeChat: activeChat,
3966
+ infoMessages: infoMessages,
3967
+ incidentMessages: incidentMessages,
3968
+ setViewingReclamations: setViewingReclamations,
3969
+ setViewingTijariaHistory: setViewingTijariaHistory,
3970
+ setActiveChat: setActiveChat,
3971
+ setInfoMessages: setInfoMessages,
3972
+ setIncidentMessages: setIncidentMessages
3973
+ })]
3974
+ })
3975
+ })
3976
+ }), showGuides && /*#__PURE__*/(0, _jsxRuntime.jsx)(ContentPanel, {
3977
+ isOpen: guidesPanelOpen,
3978
+ onClose: () => {
3979
+ setGuidesPanelOpen(false);
3980
+ setGuideData(null);
3981
+ },
3982
+ contentData: guideData,
3983
+ title: "Guide utilisateurs",
3984
+ showDownloadButton: true,
3985
+ onDownload: handlePdfGuideClick,
3986
+ loadingDownload: loadingGuide,
3987
+ projectCode: currentProjectCode,
3988
+ guideBaseUrl: guideBaseUrl
3989
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(ContentPanel, {
3990
+ isOpen: faqPanelOpen,
3991
+ onClose: () => {
3992
+ setFaqPanelOpen(false);
3993
+ setFaqData(null);
3994
+ },
3995
+ contentData: faqData,
3996
+ title: "Foire aux questions",
3997
+ showDownloadButton: false,
3998
+ showExternalLinkLabel: true,
3999
+ externalLinkUrl: "https://www.portnet.ma/faq"
4000
+ }), isOpen && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
4001
+ className: "help-widget-overlay",
4002
+ onClick: () => setIsOpen(false),
4003
+ style: {
4004
+ position: "fixed",
4005
+ top: 0,
4006
+ left: 0,
4007
+ width: "100vw",
4008
+ height: "100vh",
4009
+ backgroundColor: "rgba(0, 0, 0, 0.3)",
4010
+ zIndex: 999
4011
+ }
4012
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Popover, {
4013
+ open: contactUsMenuOpen,
4014
+ anchorEl: contactUsMenuAnchor,
4015
+ onClose: handleContactUsMenuClose,
4016
+ anchorReference: "anchorPosition",
4017
+ anchorPosition: {
4018
+ top: popupPosition.y,
4019
+ left: popupPosition.x
4020
+ },
4021
+ PaperProps: {
4022
+ ref: contactPopoverRef,
4023
+ elevation: 8,
4024
+ sx: {
4025
+ minWidth: 280,
4026
+ borderRadius: 3,
4027
+ overflow: "visible",
4028
+ boxShadow: "0 8px 32px rgba(0,0,0,0.12)"
4029
+ },
4030
+ role: "dialog",
4031
+ "aria-modal": "true",
4032
+ "aria-labelledby": "contact-title"
4033
+ },
4034
+ TransitionProps: {
4035
+ timeout: 300
4036
+ },
4037
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
4038
+ className: "draggable-handle",
4039
+ onMouseDown: handleMouseDown,
4040
+ style: {
4041
+ padding: "16px 20px",
4042
+ borderBottom: "1px solid #e0e0e0",
4043
+ cursor: "move",
4044
+ userSelect: "none",
4045
+ backgroundColor: "#f8f9fa",
4046
+ borderTopLeftRadius: "12px",
4047
+ borderTopRightRadius: "12px",
4048
+ display: "flex",
4049
+ justifyContent: "center",
4050
+ alignItems: "center",
4051
+ position: "relative"
4052
+ },
4053
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
4054
+ style: {
4055
+ display: "flex",
4056
+ alignItems: "center",
4057
+ gap: "8px"
4058
+ },
4059
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
4060
+ component: "div",
4061
+ id: "contact-title",
4062
+ sx: {
4063
+ fontWeight: "600",
4064
+ fontSize: "15px",
4065
+ color: "#333",
4066
+ fontFamily: WIDGET_FONT,
4067
+ margin: 0,
4068
+ padding: 0,
4069
+ lineHeight: "normal"
4070
+ },
4071
+ children: "Contactez-nous"
4072
+ })
4073
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
4074
+ onClick: handleContactUsMenuClose,
4075
+ "aria-label": "Fermer",
4076
+ tabIndex: 0,
4077
+ style: {
4078
+ cursor: "pointer",
4079
+ padding: "4px",
4080
+ borderRadius: "4px",
4081
+ display: "flex",
4082
+ alignItems: "center",
4083
+ justifyContent: "center",
4084
+ transition: "background-color 0.2s",
4085
+ position: "absolute",
4086
+ right: "16px",
4087
+ background: "none",
4088
+ border: "none"
4089
+ },
4090
+ onMouseEnter: e => e.currentTarget.style.backgroundColor = "#e0e0e0",
4091
+ onMouseLeave: e => e.currentTarget.style.backgroundColor = "transparent",
4092
+ onFocus: e => {
4093
+ e.currentTarget.style.backgroundColor = "#e0e0e0";
4094
+ e.currentTarget.style.outline = "2px solid var(--primary-color, #222f67)";
4095
+ e.currentTarget.style.outlineOffset = "2px";
4096
+ },
4097
+ onBlur: e => {
4098
+ e.currentTarget.style.backgroundColor = "transparent";
4099
+ e.currentTarget.style.outline = "none";
4100
+ },
4101
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
4102
+ icon: _freeSolidSvgIcons.faTimes,
4103
+ style: {
4104
+ fontSize: "14px",
4105
+ color: "#666"
4106
+ },
4107
+ "aria-hidden": "true"
4108
+ })
4109
+ })]
4110
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
4111
+ style: {
4112
+ padding: "8px"
4113
+ },
4114
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.MenuItem, {
4115
+ onClick: () => {
4116
+ window.open("tel:+212520473100", "_self");
4117
+ handleContactUsMenuClose();
4118
+ },
4119
+ onKeyDown: e => {
4120
+ if (e.key === "Enter" || e.key === " ") {
4121
+ e.preventDefault();
4122
+ window.open("tel:+212520473100", "_self");
4123
+ handleContactUsMenuClose();
4124
+ }
4125
+ },
4126
+ tabIndex: 0,
4127
+ sx: {
4128
+ borderRadius: 1,
4129
+ mb: 0.5,
4130
+ py: 1.5,
4131
+ "&:hover": {
4132
+ backgroundColor: "var(--primary-alpha-8, rgba(34, 47, 103, 0.08))"
4133
+ },
4134
+ "&:focus": {
4135
+ backgroundColor: "var(--primary-alpha-8, rgba(34, 47, 103, 0.08))",
4136
+ outline: "2px solid var(--primary-color, #222f67)",
4137
+ outlineOffset: "2px"
4138
+ }
4139
+ },
4140
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemIcon, {
4141
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.Phone, {
4142
+ fontSize: "small",
4143
+ sx: {
4144
+ color: "var(--primary-color, #222f67)"
4145
+ },
4146
+ "aria-hidden": "true"
4147
+ })
4148
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
4149
+ primary: "Assistance t\xE9l\xE9phonique",
4150
+ secondary: "+212 520 47 31 00",
4151
+ primaryTypographyProps: {
4152
+ fontSize: "14px",
4153
+ fontWeight: "500"
4154
+ },
4155
+ secondaryTypographyProps: {
4156
+ fontSize: "12px"
4157
+ }
4158
+ })]
4159
+ })
4160
+ })]
4161
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(ReclamationFormModal, {
4162
+ open: reclamationModalOpen,
4163
+ onClose: () => setReclamationModalOpen(false)
4164
+ })]
4165
+ });
4166
+ };
4167
+ var _default = exports.default = PuiHelpWidget;