@portnet/ui 5.0.25 → 5.0.27

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