@consilioweb/payload-support 2.0.0 → 3.0.0

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.
Files changed (222) hide show
  1. package/README.md +656 -355
  2. package/dist/components/RichTextEditor/index.d.ts +19 -0
  3. package/dist/components/TicketConversation/RewriteDropdown.d.ts +6 -0
  4. package/dist/components/TicketConversation/SkeletonText.d.ts +4 -0
  5. package/dist/components/TicketConversation/components/AISummaryPanel.d.ts +14 -0
  6. package/dist/components/TicketConversation/components/ActionPanels.d.ts +47 -0
  7. package/dist/components/TicketConversation/components/ActivityLog.d.ts +5 -0
  8. package/dist/components/TicketConversation/components/ClientBar.d.ts +5 -0
  9. package/dist/components/TicketConversation/components/ClientHistory.d.ts +24 -0
  10. package/dist/components/TicketConversation/components/CodeBlock.d.ts +26 -0
  11. package/dist/components/TicketConversation/components/CodeBlockInserter.d.ts +12 -0
  12. package/dist/components/TicketConversation/components/QuickActions.d.ts +32 -0
  13. package/dist/components/TicketConversation/components/TicketHeader.d.ts +19 -0
  14. package/dist/components/TicketConversation/components/TimeTrackingPanel.d.ts +24 -0
  15. package/dist/components/TicketConversation/config.d.ts +10 -0
  16. package/dist/components/TicketConversation/config.js +1 -40
  17. package/dist/components/TicketConversation/constants.d.ts +56 -0
  18. package/dist/components/TicketConversation/context.d.ts +53 -0
  19. package/dist/components/TicketConversation/hooks/useAI.d.ts +21 -0
  20. package/dist/components/TicketConversation/hooks/useDocumentIdFromUrl.d.ts +3 -0
  21. package/dist/components/TicketConversation/hooks/useFeatures.d.ts +23 -0
  22. package/dist/components/TicketConversation/hooks/useFeatures.js +61 -0
  23. package/dist/components/TicketConversation/hooks/useMessageActions.d.ts +20 -0
  24. package/dist/components/TicketConversation/hooks/useReply.d.ts +27 -0
  25. package/dist/components/TicketConversation/hooks/useTicketActions.d.ts +58 -0
  26. package/dist/components/TicketConversation/hooks/useTimeTracking.d.ts +18 -0
  27. package/dist/components/TicketConversation/hooks/useTranslation.d.ts +33 -0
  28. package/dist/components/TicketConversation/hooks/useTranslation.js +22 -3
  29. package/dist/components/TicketConversation/index.d.ts +4 -0
  30. package/dist/components/TicketConversation/index.js +2 -2
  31. package/dist/components/TicketConversation/types.d.ts +56 -0
  32. package/dist/components/TicketConversation/utils.d.ts +2 -0
  33. package/dist/index.cjs +392 -320
  34. package/dist/index.d.cts +100 -3
  35. package/dist/index.d.ts +100 -3
  36. package/dist/index.js +388 -321
  37. package/dist/utils/features.d.ts +123 -0
  38. package/dist/utils/features.js +147 -0
  39. package/dist/views/BillingView/client.d.ts +2 -0
  40. package/dist/views/BillingView/index.d.ts +4 -0
  41. package/dist/views/ChatView/client.d.ts +2 -0
  42. package/dist/views/ChatView/client.js +9 -9
  43. package/dist/views/ChatView/index.d.ts +4 -0
  44. package/dist/views/CrmView/client.d.ts +2 -0
  45. package/dist/views/CrmView/client.js +6 -9
  46. package/dist/views/CrmView/index.d.ts +4 -0
  47. package/dist/views/EmailTrackingView/client.d.ts +2 -0
  48. package/dist/views/EmailTrackingView/index.d.ts +4 -0
  49. package/dist/views/ImportConversationView/client.d.ts +2 -0
  50. package/dist/views/ImportConversationView/index.d.ts +4 -0
  51. package/dist/views/LogsView/client.d.ts +2 -0
  52. package/dist/views/LogsView/index.d.ts +4 -0
  53. package/dist/views/NewTicketView/client.d.ts +2 -0
  54. package/dist/views/NewTicketView/index.d.ts +4 -0
  55. package/dist/views/PendingEmailsView/client.d.ts +2 -0
  56. package/dist/views/PendingEmailsView/index.d.ts +4 -0
  57. package/dist/views/SupportDashboardView/client.d.ts +2 -0
  58. package/dist/views/SupportDashboardView/client.js +1 -1
  59. package/dist/views/SupportDashboardView/index.d.ts +4 -0
  60. package/dist/views/TicketDetailView/NextActionItem.d.ts +6 -0
  61. package/dist/views/TicketDetailView/RewriteDropdown.d.ts +7 -0
  62. package/dist/views/TicketDetailView/client.d.ts +2 -0
  63. package/dist/views/TicketDetailView/client.js +2 -2
  64. package/dist/views/TicketDetailView/constants.d.ts +13 -0
  65. package/dist/views/TicketDetailView/helpers.d.ts +2 -0
  66. package/dist/views/TicketDetailView/index.d.ts +4 -0
  67. package/dist/views/TicketDetailView/types.d.ts +40 -0
  68. package/dist/views/TicketInboxView/client.d.ts +2 -0
  69. package/dist/views/TicketInboxView/client.js +5 -5
  70. package/dist/views/TicketInboxView/index.d.ts +4 -0
  71. package/dist/views/TicketingSettingsView/client.d.ts +2 -0
  72. package/dist/views/TicketingSettingsView/client.js +6 -5
  73. package/dist/views/TicketingSettingsView/index.d.ts +4 -0
  74. package/dist/views/TimeDashboardView/client.d.ts +2 -0
  75. package/dist/views/TimeDashboardView/index.d.ts +4 -0
  76. package/dist/views/shared/AdminViewHeader.d.ts +13 -0
  77. package/dist/views/shared/ErrorBoundary.d.ts +17 -0
  78. package/dist/views/shared/Skeleton.d.ts +21 -0
  79. package/dist/views/shared/StatusPill.d.ts +8 -0
  80. package/dist/views/shared/adminTokens.d.ts +19 -0
  81. package/dist/views/shared/config.d.ts +8 -0
  82. package/dist/views/shared/config.js +1 -40
  83. package/dist/views/shared/dateLocale.d.ts +5 -0
  84. package/dist/views/shared/index.d.ts +12 -0
  85. package/dist/views/shared/index.js +2 -1
  86. package/dist/views/shared/locales/en.json +708 -0
  87. package/dist/views/shared/locales/fr.json +708 -0
  88. package/dist/views/shared/sla.d.ts +14 -0
  89. package/dist/views.d.ts +13 -13
  90. package/package.json +26 -41
  91. package/src/collections/SupportClients.ts +29 -0
  92. package/src/collections/TicketCollaborators.ts +6 -1
  93. package/src/collections/TicketMessages.ts +46 -24
  94. package/src/collections/Tickets.ts +117 -79
  95. package/src/collections/TimeEntries.ts +57 -32
  96. package/src/components/TicketConversation/config.ts +16 -80
  97. package/src/components/TicketConversation/hooks/useFeatures.ts +109 -0
  98. package/src/components/TicketConversation/hooks/useTranslation.ts +38 -4
  99. package/src/components/TicketConversation/index.tsx +2 -2
  100. package/src/endpoints/ai.ts +2 -1
  101. package/src/endpoints/client-intelligence.ts +2 -1
  102. package/src/endpoints/process-scheduled.ts +13 -8
  103. package/src/endpoints/round-robin-config.ts +30 -20
  104. package/src/endpoints/settings.ts +28 -77
  105. package/src/index.ts +6 -2
  106. package/src/portal/LiveChat.tsx +33 -22
  107. package/src/portal/auth/tickets/detail/TicketPolling.tsx +5 -1
  108. package/src/types/lucide-react.d.ts +10 -2
  109. package/src/utils/aiAgent.ts +2 -1
  110. package/src/utils/aiProvider.ts +21 -0
  111. package/src/utils/features.ts +297 -0
  112. package/src/utils/fireWebhooks.ts +6 -0
  113. package/src/utils/generateTicketSynthesis.ts +2 -1
  114. package/src/utils/index.ts +4 -2
  115. package/src/utils/readSettings.ts +82 -9
  116. package/src/utils/webhookDispatcher.ts +19 -7
  117. package/src/views/ChatView/client.tsx +13 -9
  118. package/src/views/CrmView/client.tsx +10 -11
  119. package/src/views/SupportDashboardView/client.tsx +1 -1
  120. package/src/views/TicketDetailView/client.tsx +2 -2
  121. package/src/views/TicketInboxView/client.tsx +10 -5
  122. package/src/views/TicketingSettingsView/client.tsx +9 -7
  123. package/src/views/shared/config.ts +14 -80
  124. package/src/views/shared/index.ts +3 -1
  125. package/src/views/shared/locales/en.json +2 -2
  126. package/src/views/shared/locales/fr.json +2 -2
  127. package/dist/components/RichTextEditor/index.cjs +0 -279
  128. package/dist/components/TicketConversation/RewriteDropdown.cjs +0 -98
  129. package/dist/components/TicketConversation/SkeletonText.cjs +0 -21
  130. package/dist/components/TicketConversation/components/AISummaryPanel.cjs +0 -85
  131. package/dist/components/TicketConversation/components/ActionPanels.cjs +0 -193
  132. package/dist/components/TicketConversation/components/ActivityLog.cjs +0 -24
  133. package/dist/components/TicketConversation/components/ClientBar.cjs +0 -43
  134. package/dist/components/TicketConversation/components/ClientHistory.cjs +0 -138
  135. package/dist/components/TicketConversation/components/CodeBlock.cjs +0 -171
  136. package/dist/components/TicketConversation/components/CodeBlockInserter.cjs +0 -156
  137. package/dist/components/TicketConversation/components/QuickActions.cjs +0 -87
  138. package/dist/components/TicketConversation/components/TicketHeader.cjs +0 -93
  139. package/dist/components/TicketConversation/components/TimeTrackingPanel.cjs +0 -134
  140. package/dist/components/TicketConversation/config.cjs +0 -44
  141. package/dist/components/TicketConversation/constants.cjs +0 -127
  142. package/dist/components/TicketConversation/context.cjs +0 -13
  143. package/dist/components/TicketConversation/hooks/useAI.cjs +0 -196
  144. package/dist/components/TicketConversation/hooks/useDocumentIdFromUrl.cjs +0 -20
  145. package/dist/components/TicketConversation/hooks/useMessageActions.cjs +0 -136
  146. package/dist/components/TicketConversation/hooks/useReply.cjs +0 -188
  147. package/dist/components/TicketConversation/hooks/useTicketActions.cjs +0 -290
  148. package/dist/components/TicketConversation/hooks/useTimeTracking.cjs +0 -123
  149. package/dist/components/TicketConversation/hooks/useTranslation.cjs +0 -78
  150. package/dist/components/TicketConversation/index.cjs +0 -1114
  151. package/dist/components/TicketConversation/types.cjs +0 -2
  152. package/dist/components/TicketConversation/utils.cjs +0 -27
  153. package/dist/views/BillingView/client.cjs +0 -469
  154. package/dist/views/BillingView/index.cjs +0 -34
  155. package/dist/views/ChatView/client.cjs +0 -301
  156. package/dist/views/ChatView/index.cjs +0 -34
  157. package/dist/views/CrmView/client.cjs +0 -458
  158. package/dist/views/CrmView/index.cjs +0 -34
  159. package/dist/views/EmailTrackingView/client.cjs +0 -171
  160. package/dist/views/EmailTrackingView/index.cjs +0 -34
  161. package/dist/views/ImportConversationView/client.cjs +0 -238
  162. package/dist/views/ImportConversationView/index.cjs +0 -34
  163. package/dist/views/LogsView/client.cjs +0 -148
  164. package/dist/views/LogsView/index.cjs +0 -32
  165. package/dist/views/NewTicketView/client.cjs +0 -213
  166. package/dist/views/NewTicketView/index.cjs +0 -32
  167. package/dist/views/PendingEmailsView/client.cjs +0 -471
  168. package/dist/views/PendingEmailsView/index.cjs +0 -34
  169. package/dist/views/SupportDashboardView/client.cjs +0 -437
  170. package/dist/views/SupportDashboardView/index.cjs +0 -34
  171. package/dist/views/TicketDetailView/NextActionItem.cjs +0 -40
  172. package/dist/views/TicketDetailView/RewriteDropdown.cjs +0 -80
  173. package/dist/views/TicketDetailView/client.cjs +0 -1412
  174. package/dist/views/TicketDetailView/constants.cjs +0 -20
  175. package/dist/views/TicketDetailView/helpers.cjs +0 -23
  176. package/dist/views/TicketDetailView/index.cjs +0 -34
  177. package/dist/views/TicketDetailView/types.cjs +0 -2
  178. package/dist/views/TicketInboxView/client.cjs +0 -359
  179. package/dist/views/TicketInboxView/index.cjs +0 -32
  180. package/dist/views/TicketingSettingsView/client.cjs +0 -740
  181. package/dist/views/TicketingSettingsView/index.cjs +0 -34
  182. package/dist/views/TimeDashboardView/client.cjs +0 -180
  183. package/dist/views/TimeDashboardView/index.cjs +0 -34
  184. package/dist/views/shared/AdminViewHeader.cjs +0 -68
  185. package/dist/views/shared/ErrorBoundary.cjs +0 -55
  186. package/dist/views/shared/Skeleton.cjs +0 -77
  187. package/dist/views/shared/StatusPill.cjs +0 -47
  188. package/dist/views/shared/adminTokens.cjs +0 -34
  189. package/dist/views/shared/config.cjs +0 -44
  190. package/dist/views/shared/dateLocale.cjs +0 -5
  191. package/dist/views/shared/index.cjs +0 -72
  192. package/dist/views/shared/sla.cjs +0 -37
  193. package/dist/views.cjs +0 -86
  194. package/dist/views.d.cts +0 -13
  195. package/src/__tests__/aiSummaryRendering.test.ts +0 -21
  196. package/src/__tests__/authResponses.test.ts +0 -69
  197. package/src/__tests__/capabilities.test.ts +0 -71
  198. package/src/__tests__/generateTrackingToken.test.ts +0 -67
  199. package/src/__tests__/integration/ai-agent.test.ts +0 -46
  200. package/src/__tests__/integration/auth.test.ts +0 -43
  201. package/src/__tests__/integration/automation-rules.test.ts +0 -68
  202. package/src/__tests__/integration/buildTestPayload.ts +0 -52
  203. package/src/__tests__/integration/channels.test.ts +0 -52
  204. package/src/__tests__/integration/core-behaviors.test.ts +0 -81
  205. package/src/__tests__/integration/dashboard-volume.test.ts +0 -31
  206. package/src/__tests__/integration/digest.test.ts +0 -48
  207. package/src/__tests__/integration/invoice-pdf.test.ts +0 -30
  208. package/src/__tests__/integration/isolation.test.ts +0 -81
  209. package/src/__tests__/integration/mentions-invoice.test.ts +0 -50
  210. package/src/__tests__/integration/nps.test.ts +0 -37
  211. package/src/__tests__/integration/per-team-sla.test.ts +0 -44
  212. package/src/__tests__/integration/push.test.ts +0 -75
  213. package/src/__tests__/integration/sanitization.test.ts +0 -35
  214. package/src/__tests__/integration/sla-pause.test.ts +0 -39
  215. package/src/__tests__/integration/smoke.test.ts +0 -26
  216. package/src/__tests__/integration/snooze.test.ts +0 -68
  217. package/src/__tests__/integration/teams.test.ts +0 -38
  218. package/src/__tests__/rateLimiter.test.ts +0 -83
  219. package/src/__tests__/sanitizeHtml.test.ts +0 -165
  220. package/src/__tests__/sla.test.ts +0 -258
  221. package/src/__tests__/trackOpenEndpoint.test.ts +0 -54
  222. package/src/__tests__/webhookSecurity.test.ts +0 -58
@@ -1,279 +0,0 @@
1
- 'use strict';
2
-
3
- var jsxRuntime = require('react/jsx-runtime');
4
- var react = require('react');
5
-
6
- const RichTextEditor = react.forwardRef(function RichTextEditor2({
7
- initialValue = "",
8
- onChange,
9
- placeholder = "\xC9crivez votre message...",
10
- minHeight = 150,
11
- onFileUpload,
12
- borderColor = "#000",
13
- focusBorderColor = "#00E5FF"
14
- }, ref) {
15
- const editorRef = react.useRef(null);
16
- const fileInputRef = react.useRef(null);
17
- const [focused, setFocused] = react.useState(false);
18
- const [isEmpty, setIsEmpty] = react.useState(!initialValue);
19
- react.useEffect(() => {
20
- if (editorRef.current && initialValue) {
21
- editorRef.current.innerHTML = initialValue;
22
- const text = editorRef.current.innerText?.trim() || "";
23
- setIsEmpty(!text && !editorRef.current.querySelector("img"));
24
- }
25
- }, []);
26
- const emitChange = react.useCallback(() => {
27
- if (!editorRef.current) return;
28
- const html = editorRef.current.innerHTML;
29
- const text = editorRef.current.innerText?.trim() || "";
30
- const empty = !text && !editorRef.current.querySelector("img");
31
- setIsEmpty(empty);
32
- onChange(empty ? "" : html, text);
33
- }, [onChange]);
34
- const exec = react.useCallback((command, value) => {
35
- document.execCommand(command, false, value);
36
- editorRef.current?.focus();
37
- setTimeout(emitChange, 0);
38
- }, [emitChange]);
39
- react.useImperativeHandle(ref, () => ({
40
- clear: () => {
41
- if (editorRef.current) {
42
- editorRef.current.innerHTML = "";
43
- setIsEmpty(true);
44
- onChange("", "");
45
- }
46
- },
47
- setContent: (html) => {
48
- if (editorRef.current) {
49
- editorRef.current.innerHTML = html;
50
- const text = editorRef.current.innerText?.trim() || "";
51
- setIsEmpty(!text && !editorRef.current.querySelector("img"));
52
- onChange(html, text);
53
- }
54
- },
55
- getHtml: () => editorRef.current?.innerHTML || "",
56
- getPlainText: () => editorRef.current?.innerText?.trim() || "",
57
- focus: () => editorRef.current?.focus()
58
- }));
59
- const handleInsertLink = react.useCallback(() => {
60
- const sel = window.getSelection();
61
- if (!sel || sel.isCollapsed) {
62
- const url = prompt("URL du lien :");
63
- if (!url) return;
64
- const text = prompt("Texte du lien :", url) || url;
65
- const safeUrl = url.replace(/"/g, """);
66
- const safeText = text.replace(/</g, "&lt;").replace(/>/g, "&gt;");
67
- document.execCommand("insertHTML", false, `<a href="${safeUrl}" target="_blank" rel="noopener noreferrer">${safeText}</a>`);
68
- editorRef.current?.focus();
69
- setTimeout(emitChange, 0);
70
- } else {
71
- const url = prompt("URL du lien :");
72
- if (url) exec("createLink", url);
73
- }
74
- }, [exec, emitChange]);
75
- const handleImageClick = react.useCallback(() => {
76
- if (onFileUpload) {
77
- fileInputRef.current?.click();
78
- } else {
79
- const url = prompt("URL de l'image :");
80
- if (url) {
81
- const safeUrl = url.replace(/"/g, "&quot;");
82
- document.execCommand("insertHTML", false, `<img src="${safeUrl}" alt="Image" style="max-width:100%;height:auto;border-radius:8px;margin:8px 0;" />`);
83
- editorRef.current?.focus();
84
- setTimeout(emitChange, 0);
85
- }
86
- }
87
- }, [onFileUpload, emitChange]);
88
- const handleFileChange = react.useCallback(async (e) => {
89
- if (!e.target.files || !onFileUpload) return;
90
- for (const file of Array.from(e.target.files)) {
91
- if (!file.type.startsWith("image/")) continue;
92
- const url = await onFileUpload(file);
93
- if (url) {
94
- const safeName = file.name.replace(/"/g, "&quot;");
95
- document.execCommand("insertHTML", false, `<img src="${url}" alt="${safeName}" style="max-width:100%;height:auto;border-radius:8px;margin:8px 0;" />`);
96
- editorRef.current?.focus();
97
- setTimeout(emitChange, 0);
98
- }
99
- }
100
- if (fileInputRef.current) fileInputRef.current.value = "";
101
- }, [onFileUpload, emitChange]);
102
- const handleClearFormat = react.useCallback(() => {
103
- document.execCommand("removeFormat");
104
- document.execCommand("formatBlock", false, "p");
105
- editorRef.current?.focus();
106
- setTimeout(emitChange, 0);
107
- }, [emitChange]);
108
- const handleKeyDown = react.useCallback((e) => {
109
- if (e.key !== "Enter" || e.shiftKey) return;
110
- const sel = window.getSelection();
111
- if (!sel || sel.rangeCount === 0) return;
112
- let node = sel.anchorNode;
113
- let blockquote = null;
114
- while (node && node !== editorRef.current) {
115
- if (node.nodeName === "BLOCKQUOTE") {
116
- blockquote = node;
117
- break;
118
- }
119
- node = node.parentNode;
120
- }
121
- if (!blockquote) return;
122
- const text = blockquote.innerText || "";
123
- if (text.replace(/\n+$/, "").length === 0 || text.endsWith("\n\n") || text.endsWith("\n")) {
124
- e.preventDefault();
125
- const p = document.createElement("p");
126
- p.innerHTML = "<br>";
127
- blockquote.after(p);
128
- if (blockquote.lastChild && blockquote.lastChild.nodeName === "BR") {
129
- blockquote.removeChild(blockquote.lastChild);
130
- }
131
- const range = document.createRange();
132
- range.setStart(p, 0);
133
- range.collapse(true);
134
- sel.removeAllRanges();
135
- sel.addRange(range);
136
- setTimeout(emitChange, 0);
137
- }
138
- }, [emitChange]);
139
- const handlePaste = react.useCallback(async (e) => {
140
- if (!onFileUpload) return;
141
- const items = e.clipboardData?.items;
142
- if (!items) return;
143
- for (const item of Array.from(items)) {
144
- if (item.type.startsWith("image/")) {
145
- e.preventDefault();
146
- const file = item.getAsFile();
147
- if (file) {
148
- const url = await onFileUpload(file);
149
- if (url) {
150
- document.execCommand("insertHTML", false, `<img src="${url}" alt="Image coll\xE9e" style="max-width:100%;height:auto;border-radius:8px;margin:8px 0;" />`);
151
- editorRef.current?.focus();
152
- setTimeout(emitChange, 0);
153
- }
154
- }
155
- return;
156
- }
157
- }
158
- }, [onFileUpload, emitChange]);
159
- const btn = {
160
- border: "none",
161
- background: "transparent",
162
- cursor: "pointer",
163
- padding: "8px 10px",
164
- fontSize: "13px",
165
- fontWeight: 700,
166
- color: "#555",
167
- borderRadius: "5px",
168
- lineHeight: 1,
169
- minHeight: "44px",
170
- minWidth: "44px",
171
- display: "inline-flex",
172
- alignItems: "center",
173
- justifyContent: "center"
174
- };
175
- const sep = {
176
- width: "1px",
177
- height: "18px",
178
- background: "#d1d5db",
179
- margin: "0 4px",
180
- alignSelf: "center"
181
- };
182
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { border: `3px solid ${focused ? focusBorderColor : borderColor}`, borderRadius: "12px", overflow: "hidden", transition: "border-color 0.15s", background: "#fff" }, children: [
183
- /* @__PURE__ */ jsxRuntime.jsx("style", { children: `
184
- .rte-toolbar button:hover { background: #e5e7eb !important; }
185
- .rte-editor blockquote { border-left: 4px solid #00E5FF; margin: 8px 0; padding: 8px 16px; background: #f0f9ff; border-radius: 0 6px 6px 0; }
186
- .rte-editor img { max-width: 100%; height: auto; border-radius: 8px; margin: 8px 0; }
187
- .rte-editor a { color: #00838f; text-decoration: underline; }
188
- .rte-editor ul, .rte-editor ol { margin: 8px 0; padding-left: 24px; }
189
- .rte-editor li { margin: 2px 0; }
190
- .rte-editor p { margin: 0 0 6px 0; }
191
- ` }),
192
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rte-toolbar", style: { display: "flex", alignItems: "center", gap: "2px", padding: "6px 10px", borderBottom: "2px solid #e5e7eb", backgroundColor: "#f9fafb", flexWrap: "wrap" }, children: [
193
- /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", style: btn, onMouseDown: (e) => {
194
- e.preventDefault();
195
- exec("bold");
196
- }, title: "Gras (Ctrl+B)", children: /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "B" }) }),
197
- /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", style: btn, onMouseDown: (e) => {
198
- e.preventDefault();
199
- exec("italic");
200
- }, title: "Italique (Ctrl+I)", children: /* @__PURE__ */ jsxRuntime.jsx("em", { style: { fontStyle: "italic" }, children: "I" }) }),
201
- /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", style: btn, onMouseDown: (e) => {
202
- e.preventDefault();
203
- exec("underline");
204
- }, title: "Soulign\xE9 (Ctrl+U)", children: /* @__PURE__ */ jsxRuntime.jsx("span", { style: { textDecoration: "underline" }, children: "S" }) }),
205
- /* @__PURE__ */ jsxRuntime.jsx("span", { style: sep }),
206
- /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", style: { ...btn, fontSize: "16px" }, onMouseDown: (e) => {
207
- e.preventDefault();
208
- exec("formatBlock", "blockquote");
209
- }, title: "Citation", children: "\u201C\u201D" }),
210
- /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", style: { ...btn, fontSize: "12px" }, onMouseDown: (e) => {
211
- e.preventDefault();
212
- exec("insertUnorderedList");
213
- }, title: "Liste \xE0 puces", children: "\u2022 Liste" }),
214
- /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", style: { ...btn, fontSize: "12px" }, onMouseDown: (e) => {
215
- e.preventDefault();
216
- exec("insertOrderedList");
217
- }, title: "Liste num\xE9rot\xE9e", children: "1. Liste" }),
218
- /* @__PURE__ */ jsxRuntime.jsx("span", { style: sep }),
219
- /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", style: btn, onMouseDown: (e) => {
220
- e.preventDefault();
221
- handleInsertLink();
222
- }, title: "Ins\xE9rer un lien", children: "\u{1F517}" }),
223
- /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", style: btn, onMouseDown: (e) => {
224
- e.preventDefault();
225
- handleImageClick();
226
- }, title: "Ins\xE9rer une image", children: "\u{1F5BC}\uFE0F" }),
227
- /* @__PURE__ */ jsxRuntime.jsx("span", { style: sep }),
228
- /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", style: { ...btn, fontSize: "13px" }, onMouseDown: (e) => {
229
- e.preventDefault();
230
- handleClearFormat();
231
- }, title: "Effacer la mise en forme", children: [
232
- "T",
233
- /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: "10px", verticalAlign: "super" }, children: "\xD7" })
234
- ] })
235
- ] }),
236
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { position: "relative" }, children: [
237
- isEmpty && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { position: "absolute", top: 0, left: 0, right: 0, padding: "14px 16px", color: "#9ca3af", fontSize: "14px", pointerEvents: "none", userSelect: "none" }, children: placeholder }),
238
- /* @__PURE__ */ jsxRuntime.jsx(
239
- "div",
240
- {
241
- ref: editorRef,
242
- className: "rte-editor",
243
- contentEditable: true,
244
- suppressContentEditableWarning: true,
245
- onInput: emitChange,
246
- onFocus: () => setFocused(true),
247
- onBlur: () => {
248
- setFocused(false);
249
- emitChange();
250
- },
251
- onPaste: handlePaste,
252
- onKeyDown: handleKeyDown,
253
- style: {
254
- minHeight: `${minHeight}px`,
255
- padding: "14px 16px",
256
- fontSize: "14px",
257
- lineHeight: 1.6,
258
- color: "#1f2937",
259
- outline: "none",
260
- overflowY: "auto"
261
- }
262
- }
263
- )
264
- ] }),
265
- onFileUpload && /* @__PURE__ */ jsxRuntime.jsx(
266
- "input",
267
- {
268
- ref: fileInputRef,
269
- type: "file",
270
- accept: "image/*",
271
- multiple: true,
272
- onChange: handleFileChange,
273
- style: { display: "none" }
274
- }
275
- )
276
- ] });
277
- });
278
-
279
- exports.RichTextEditor = RichTextEditor;
@@ -1,98 +0,0 @@
1
- 'use strict';
2
-
3
- var jsxRuntime = require('react/jsx-runtime');
4
- var React = require('react');
5
- var constants = require('./constants');
6
-
7
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
-
9
- var React__default = /*#__PURE__*/_interopDefault(React);
10
-
11
- const RewriteDropdown = ({ disabled, loading, onSelect }) => {
12
- const [open, setOpen] = React.useState(false);
13
- const ref = React__default.default.useRef(null);
14
- React__default.default.useEffect(() => {
15
- if (!open) return;
16
- const close = (e) => {
17
- if (ref.current && !ref.current.contains(e.target)) setOpen(false);
18
- };
19
- document.addEventListener("mousedown", close);
20
- return () => document.removeEventListener("mousedown", close);
21
- }, [open]);
22
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref, style: { position: "relative", display: "inline-block" }, children: [
23
- /* @__PURE__ */ jsxRuntime.jsxs(
24
- "button",
25
- {
26
- type: "button",
27
- onClick: () => setOpen(!open),
28
- disabled,
29
- style: {
30
- ...constants.s.outlineBtn("#0891b2", disabled),
31
- fontSize: "11px",
32
- padding: "3px 10px",
33
- borderRadius: "14px",
34
- display: "flex",
35
- alignItems: "center",
36
- gap: "4px"
37
- },
38
- children: [
39
- loading ? "Reformulation..." : "\u270F\uFE0F Reformuler",
40
- !loading && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 9, opacity: 0.7 }, children: "\u25BC" })
41
- ]
42
- }
43
- ),
44
- open && !disabled && !loading && /* @__PURE__ */ jsxRuntime.jsx(
45
- "div",
46
- {
47
- style: {
48
- position: "absolute",
49
- bottom: "100%",
50
- left: 0,
51
- marginBottom: 4,
52
- background: "var(--theme-elevation-0, #fff)",
53
- border: "1px solid var(--theme-elevation-200, #e5e7eb)",
54
- borderRadius: 8,
55
- boxShadow: "0 4px 16px rgba(0,0,0,0.12)",
56
- zIndex: 100,
57
- minWidth: 180,
58
- overflow: "hidden"
59
- },
60
- children: constants.REWRITE_STYLES.map((style) => /* @__PURE__ */ jsxRuntime.jsxs(
61
- "button",
62
- {
63
- type: "button",
64
- onClick: () => {
65
- setOpen(false);
66
- onSelect(style.id);
67
- },
68
- style: {
69
- display: "flex",
70
- flexDirection: "column",
71
- width: "100%",
72
- padding: "8px 12px",
73
- border: "none",
74
- background: "transparent",
75
- cursor: "pointer",
76
- textAlign: "left",
77
- borderBottom: "1px solid var(--theme-elevation-100, #f3f4f6)",
78
- transition: "background 120ms"
79
- },
80
- onMouseEnter: (e) => {
81
- e.target.style.background = "var(--theme-elevation-50, #f9fafb)";
82
- },
83
- onMouseLeave: (e) => {
84
- e.target.style.background = "transparent";
85
- },
86
- children: [
87
- /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 12, fontWeight: 600, color: "var(--theme-text, #111)" }, children: style.label }),
88
- /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 10, color: "var(--theme-elevation-500, #6b7280)" }, children: style.desc })
89
- ]
90
- },
91
- style.id
92
- ))
93
- }
94
- )
95
- ] });
96
- };
97
-
98
- exports.RewriteDropdown = RewriteDropdown;
@@ -1,21 +0,0 @@
1
- 'use strict';
2
-
3
- var jsxRuntime = require('react/jsx-runtime');
4
-
5
- function SkeletonText({ lines = 3 }) {
6
- return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column", gap: "8px", padding: "12px 0" }, children: Array.from({ length: lines }).map((_, i) => /* @__PURE__ */ jsxRuntime.jsx(
7
- "div",
8
- {
9
- style: {
10
- height: "14px",
11
- borderRadius: "4px",
12
- backgroundColor: "#e2e8f0",
13
- width: i === lines - 1 ? "60%" : "100%",
14
- animation: "pulse 1.5s ease-in-out infinite"
15
- }
16
- },
17
- i
18
- )) });
19
- }
20
-
21
- exports.SkeletonText = SkeletonText;
@@ -1,85 +0,0 @@
1
- 'use strict';
2
-
3
- var jsxRuntime = require('react/jsx-runtime');
4
- var constants = require('../constants');
5
-
6
- function renderAiSummary(summary) {
7
- const lines = summary.split("\n");
8
- const result = [];
9
- lines.forEach((line, lineIndex) => {
10
- if (lineIndex > 0) result.push(/* @__PURE__ */ jsxRuntime.jsx("br", {}, `break-${lineIndex}`));
11
- line.split(/(\*\*.*?\*\*)/g).filter(Boolean).forEach((part, partIndex) => {
12
- if (part.startsWith("**") && part.endsWith("**")) {
13
- result.push(/* @__PURE__ */ jsxRuntime.jsx("strong", { children: part.slice(2, -2) }, `${lineIndex}-${partIndex}`));
14
- } else {
15
- result.push(part);
16
- }
17
- });
18
- });
19
- return result;
20
- }
21
- function AISummaryPanel({
22
- showAiSummary,
23
- setShowAiSummary,
24
- aiSummary,
25
- aiGenerating,
26
- aiSaving,
27
- aiSaved,
28
- handleAiGenerate,
29
- handleAiSave
30
- }) {
31
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { marginBottom: "14px" }, children: [
32
- /* @__PURE__ */ jsxRuntime.jsx(
33
- "button",
34
- {
35
- onClick: () => {
36
- setShowAiSummary(!showAiSummary);
37
- if (!showAiSummary && !aiSummary) handleAiGenerate();
38
- },
39
- style: {
40
- ...constants.s.ghostBtn("#17807c", false),
41
- fontSize: "12px",
42
- display: "inline-flex",
43
- alignItems: "center",
44
- gap: "6px"
45
- },
46
- children: showAiSummary ? "Masquer la synth\xE8se IA" : "Synth\xE8se IA"
47
- }
48
- ),
49
- showAiSummary && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: {
50
- marginTop: "10px",
51
- padding: "14px 18px",
52
- borderRadius: "8px",
53
- backgroundColor: "#eef8f7",
54
- border: "1px solid #b8dcda"
55
- }, children: [
56
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: "10px" }, children: [
57
- /* @__PURE__ */ jsxRuntime.jsx("h4", { style: { fontSize: "13px", fontWeight: 600, color: "#17807c", margin: 0 }, children: "Synth\xE8se IA" }),
58
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", gap: "6px" }, children: [
59
- /* @__PURE__ */ jsxRuntime.jsx(
60
- "button",
61
- {
62
- onClick: handleAiGenerate,
63
- disabled: aiGenerating,
64
- style: { ...constants.s.outlineBtn("#17807c", aiGenerating), fontSize: "11px", padding: "4px 10px" },
65
- children: aiGenerating ? "G\xE9n\xE9ration..." : "R\xE9g\xE9n\xE9rer"
66
- }
67
- ),
68
- aiSummary && !aiGenerating && /* @__PURE__ */ jsxRuntime.jsx(
69
- "button",
70
- {
71
- onClick: handleAiSave,
72
- disabled: aiSaving || aiSaved,
73
- style: { ...constants.s.btn(aiSaved ? "#16a34a" : "#2563eb", aiSaving), fontSize: "11px", padding: "4px 10px" },
74
- children: aiSaved ? "Sauvegard\xE9" : aiSaving ? "Sauvegarde..." : "Sauvegarder (note interne)"
75
- }
76
- )
77
- ] })
78
- ] }),
79
- aiGenerating ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", alignItems: "center", gap: "10px", color: "#17807c", fontSize: "13px" }, children: "Analyse de la conversation en cours..." }) : aiSummary ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: "13px", lineHeight: "1.7", color: "#1e1b4b", whiteSpace: "pre-wrap" }, children: renderAiSummary(aiSummary) }) : /* @__PURE__ */ jsxRuntime.jsx("p", { style: { color: "#999", fontStyle: "italic", fontSize: "13px", margin: 0 }, children: `Cliquez sur "R\xE9g\xE9n\xE9rer" pour lancer l'analyse` })
80
- ] })
81
- ] });
82
- }
83
-
84
- exports.AISummaryPanel = AISummaryPanel;
85
- exports.renderAiSummary = renderAiSummary;