@clubmed/usg-chat-ui 1.2.7 → 1.4.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 (63) hide show
  1. package/README.md +36 -0
  2. package/assets/style.css +1 -1
  3. package/chunks/react.esm.js +2012 -1997
  4. package/chunks/react.esm.js.map +1 -1
  5. package/chunks/vi.2VT5v0um.js +1 -0
  6. package/config/chatLabels.d.ts +83 -0
  7. package/config/chatLabels.js +2 -0
  8. package/config/chatLabels.js.map +1 -0
  9. package/contexts/ChatLabelsContext.d.ts +13 -0
  10. package/contexts/ChatLabelsContext.js +24 -0
  11. package/contexts/ChatLabelsContext.js.map +1 -0
  12. package/contexts/ChatLabelsContext.test.d.ts +1 -0
  13. package/contexts/ChatLabelsContext.test.js +23 -0
  14. package/contexts/ChatLabelsContext.test.js.map +1 -0
  15. package/molecules/AiElements/Branch.js +45 -44
  16. package/molecules/AiElements/Branch.js.map +1 -1
  17. package/molecules/AiElements/PromptInput.js +60 -58
  18. package/molecules/AiElements/PromptInput.js.map +1 -1
  19. package/molecules/RichText/useCollaboration.test.js +1 -1
  20. package/organisms/canvas/CanvasLayout.d.ts +2 -1
  21. package/organisms/canvas/CanvasLayout.js +1249 -1248
  22. package/organisms/canvas/CanvasLayout.js.map +1 -1
  23. package/organisms/chat/Chat.d.ts +7 -1
  24. package/organisms/chat/Chat.js +70 -69
  25. package/organisms/chat/Chat.js.map +1 -1
  26. package/organisms/chat/ChatHeader.d.ts +4 -5
  27. package/organisms/chat/ChatHeader.js +36 -39
  28. package/organisms/chat/ChatHeader.js.map +1 -1
  29. package/organisms/chat/ChatHeader.test.d.ts +1 -0
  30. package/organisms/chat/ChatHeader.test.js +18 -0
  31. package/organisms/chat/ChatHeader.test.js.map +1 -0
  32. package/organisms/chat/ChatMessageList.d.ts +1 -2
  33. package/organisms/chat/ChatMessageList.js +73 -58
  34. package/organisms/chat/ChatMessageList.js.map +1 -1
  35. package/organisms/chat/ChatMessageList.test.d.ts +1 -0
  36. package/organisms/chat/ChatMessageList.test.js +67 -0
  37. package/organisms/chat/ChatMessageList.test.js.map +1 -0
  38. package/organisms/chat/ChatSettingsButton.d.ts +2 -0
  39. package/organisms/chat/ChatSettingsButton.js +25 -0
  40. package/organisms/chat/ChatSettingsButton.js.map +1 -0
  41. package/organisms/chat/ChatSettingsButton.test.d.ts +1 -0
  42. package/organisms/chat/ChatSettingsButton.test.js +16 -0
  43. package/organisms/chat/ChatSettingsButton.test.js.map +1 -0
  44. package/organisms/chat/ConversationSidebar.js +45 -44
  45. package/organisms/chat/ConversationSidebar.js.map +1 -1
  46. package/organisms/chat/MessageActions.js +163 -138
  47. package/organisms/chat/MessageActions.js.map +1 -1
  48. package/organisms/chat/MessageRenderers.js +1 -1
  49. package/organisms/chat/PromptComposer.js +19 -14
  50. package/organisms/chat/PromptComposer.js.map +1 -1
  51. package/organisms/chat/SidebarToggleButton.d.ts +2 -1
  52. package/organisms/chat/SidebarToggleButton.js +15 -12
  53. package/organisms/chat/SidebarToggleButton.js.map +1 -1
  54. package/organisms/chat/hooks/useChat.d.ts +1 -1
  55. package/organisms/chat/hooks/useChat.js +83 -83
  56. package/organisms/chat/hooks/useChat.js.map +1 -1
  57. package/package.json +1 -1
  58. package/utils/interpolate.d.ts +5 -0
  59. package/utils/interpolate.js +13 -0
  60. package/utils/interpolate.js.map +1 -0
  61. package/utils/interpolate.test.d.ts +1 -0
  62. package/utils/interpolate.test.js +21 -0
  63. package/utils/interpolate.test.js.map +1 -0
@@ -1,26 +1,27 @@
1
1
  "use client";
2
- import { jsxs as t, Fragment as f, jsx as e } from "react/jsx-runtime";
3
- import { useState as a } from "react";
4
- import { cn as s } from "../../utils/cn.js";
5
- import { useToast as L } from "../../molecules/Notifications/useToast.js";
6
- import { useCanvasStore as V } from "../../utils/canvas-store.js";
7
- import { useChatApiClient as q } from "../../contexts/ChatContext.js";
8
- import { Modal as B } from "../../molecules/Modals/Modal.js";
9
- import { Button as N } from "../../molecules/Buttons/Button.js";
10
- import { Textarea as G } from "../../molecules/Textareas/Textarea.js";
11
- import { C as P } from "../../chunks/check.js";
12
- import { C as U } from "../../chunks/copy.js";
13
- import { R as Z } from "../../chunks/refresh-cw.js";
14
- import { M as D } from "../../chunks/maximize-2.js";
15
- import { c as F } from "../../chunks/createLucideIcon.js";
16
- import { X } from "../../chunks/x.js";
2
+ import { jsxs as r, Fragment as f, jsx as t } from "react/jsx-runtime";
3
+ import { useState as i } from "react";
4
+ import { cn as n } from "../../utils/cn.js";
5
+ import { useToast as de } from "../../molecules/Notifications/useToast.js";
6
+ import { useCanvasStore as me } from "../../utils/canvas-store.js";
7
+ import { useChatApiClient as ue } from "../../contexts/ChatContext.js";
8
+ import { Modal as ge } from "../../molecules/Modals/Modal.js";
9
+ import { Button as A } from "../../molecules/Buttons/Button.js";
10
+ import { Textarea as pe } from "../../molecules/Textareas/Textarea.js";
11
+ import { useChatLabels as fe } from "../../contexts/ChatLabelsContext.js";
12
+ import { C as be } from "../../chunks/check.js";
13
+ import { C as he } from "../../chunks/copy.js";
14
+ import { R as xe } from "../../chunks/refresh-cw.js";
15
+ import { M as ve } from "../../chunks/maximize-2.js";
16
+ import { c as D } from "../../chunks/createLucideIcon.js";
17
+ import { X as ke } from "../../chunks/x.js";
17
18
  /**
18
19
  * @license lucide-react v0.545.0 - ISC
19
20
  *
20
21
  * This source code is licensed under the ISC license.
21
22
  * See the LICENSE file in the root directory of this source tree.
22
23
  */
23
- const $ = [
24
+ const Te = [
24
25
  ["path", { d: "M17 14V2", key: "8ymqnk" }],
25
26
  [
26
27
  "path",
@@ -29,14 +30,14 @@ const $ = [
29
30
  key: "m61m77"
30
31
  }
31
32
  ]
32
- ], y = F("thumbs-down", $);
33
+ ], S = D("thumbs-down", Te);
33
34
  /**
34
35
  * @license lucide-react v0.545.0 - ISC
35
36
  *
36
37
  * This source code is licensed under the ISC license.
37
38
  * See the LICENSE file in the root directory of this source tree.
38
39
  */
39
- const J = [
40
+ const Ce = [
40
41
  ["path", { d: "M7 10v12", key: "1qc93n" }],
41
42
  [
42
43
  "path",
@@ -45,214 +46,238 @@ const J = [
45
46
  key: "emmmcr"
46
47
  }
47
48
  ]
48
- ], M = F("thumbs-up", J);
49
- function ue({
50
- content: p,
51
- messageId: R,
52
- storyId: A,
49
+ ], E = D("thumbs-up", Ce);
50
+ function je({
51
+ content: b,
52
+ messageId: B,
53
+ storyId: R,
53
54
  onRegenerate: h,
54
55
  responseType: d,
55
- canvasData: c,
56
- className: z
56
+ canvasData: m,
57
+ className: P
57
58
  }) {
58
- const [_, b] = a(!1), [o, O] = a(null), [S, u] = a(!1), [n, x] = a(null), [m, g] = a(""), [i, v] = a(!1), { toast: l } = L(), { openApiDocsCanvas: j } = V(), E = q(), I = async () => {
59
+ const [z, x] = i(!1), [s, O] = i(null), [_, u] = i(!1), [a, v] = i(null), [g, p] = i(""), [c, k] = i(!1), { toast: l } = de(), { openApiDocsCanvas: j } = me(), I = ue(), { get: e } = fe(), T = e("messageCopyAriaLabel", "Copier le message"), C = e("messageRegenerateAriaLabel", "Régénérer la réponse"), y = e("messageOpenCanvasAriaLabel", "Ouvrir Canva"), w = e("messageThumbsUpAriaLabel", "Réponse utile"), N = e("messageThumbsDownAriaLabel", "Réponse non utile"), U = e("messageCloseFeedbackAriaLabel", "Fermer"), H = e("messageCopyButtonText", "Copier"), V = e("messageCopySuccessText", "Copié"), q = e("messageCopyToastTitle", "Copié"), G = e(
60
+ "messageCopyToastDescription",
61
+ "Message copié dans le presse-papiers"
62
+ ), Z = e("messageCopyErrorTitle", "Erreur"), X = e(
63
+ "messageCopyErrorDescription",
64
+ "Impossible de copier le message"
65
+ ), $ = e("messageRegenerateButtonText", "Régénérer"), J = e("messageOpenCanvasButtonText", "Ouvrir Canva"), K = e(
66
+ "messageFeedbackPositiveTitle",
67
+ "Merci pour votre feedback !"
68
+ ), Q = e(
69
+ "messageFeedbackNegativeTitle",
70
+ "Aidez-nous à nous améliorer"
71
+ ), W = e(
72
+ "messageFeedbackPromptText",
73
+ "Un commentaire pour nous aider ?"
74
+ ), Y = e(
75
+ "messageFeedbackTextareaPlaceholder",
76
+ "Votre commentaire (optionnel)..."
77
+ ), ee = e("messageFeedbackSkipButtonText", "Passer"), te = e("messageFeedbackSubmitButtonText", "Envoyer"), oe = e("messageFeedbackSubmittingText", "Envoi..."), re = e("messageFeedbackToastTitle", "Merci !"), se = e(
78
+ "messageFeedbackToastDescription",
79
+ "Votre feedback a été enregistré"
80
+ ), ae = e("messageFeedbackToastErrorTitle", "Erreur"), ne = e(
81
+ "messageFeedbackToastErrorDescription",
82
+ "Impossible d'enregistrer le feedback"
83
+ ), ie = async () => {
59
84
  try {
60
- await navigator.clipboard.writeText(p), b(!0), l({
61
- title: "Copié",
62
- description: "Message copié dans le presse-papiers"
63
- }), setTimeout(() => b(!1), 2e3);
64
- } catch (r) {
65
- console.error("Failed to copy:", r), l({
66
- title: "Erreur",
67
- description: "Impossible de copier le message",
85
+ await navigator.clipboard.writeText(b), x(!0), l({
86
+ title: q,
87
+ description: G
88
+ }), setTimeout(() => x(!1), 2e3);
89
+ } catch (o) {
90
+ console.error("Failed to copy:", o), l({
91
+ title: Z,
92
+ description: X,
68
93
  variant: "destructive"
69
94
  });
70
95
  }
71
- }, T = () => {
72
- if (c && d === "api_answer") {
73
- const r = c;
74
- (r.answer || r.sources) && j({
75
- answer: r.answer || p,
76
- sources: r.sources || []
96
+ }, ce = () => {
97
+ if (m && d === "api_answer") {
98
+ const o = m;
99
+ (o.answer || o.sources) && j({
100
+ answer: o.answer || b,
101
+ sources: o.sources || []
77
102
  });
78
103
  }
79
- }, k = (r) => {
80
- o || (x(r), u(!0));
81
- }, w = async (r) => {
82
- if (n) {
83
- v(!0);
104
+ }, F = (o) => {
105
+ s || (v(o), u(!0));
106
+ }, L = async (o) => {
107
+ if (a) {
108
+ k(!0);
84
109
  try {
85
- await E.submitFeedback({
86
- messageId: R,
87
- storyId: A,
88
- rating: n,
89
- comment: r ? m : void 0,
110
+ await I.submitFeedback({
111
+ messageId: B,
112
+ storyId: R,
113
+ rating: a,
114
+ comment: o ? g : void 0,
90
115
  responseType: d
91
- }), O(n), u(!1), g(""), l({
92
- title: "Merci !",
93
- description: "Votre feedback a été enregistré"
116
+ }), O(a), u(!1), p(""), l({
117
+ title: re,
118
+ description: se
94
119
  });
95
- } catch (H) {
96
- console.error("Failed to submit feedback:", H), l({
97
- title: "Erreur",
98
- description: "Impossible d'enregistrer le feedback",
120
+ } catch (le) {
121
+ console.error("Failed to submit feedback:", le), l({
122
+ title: ae,
123
+ description: ne,
99
124
  variant: "destructive"
100
125
  });
101
126
  } finally {
102
- v(!1);
127
+ k(!1);
103
128
  }
104
129
  }
105
- }, C = () => {
106
- u(!1), x(null), g("");
130
+ }, M = () => {
131
+ u(!1), v(null), p("");
107
132
  };
108
- return /* @__PURE__ */ t(f, { children: [
109
- /* @__PURE__ */ t("div", { className: s("flex items-center gap-1.5 mt-3 pt-2 border-t border-border", z), children: [
110
- /* @__PURE__ */ e(
133
+ return /* @__PURE__ */ r(f, { children: [
134
+ /* @__PURE__ */ r("div", { className: n("flex items-center gap-1.5 mt-3 pt-2 border-t border-border", P), children: [
135
+ /* @__PURE__ */ t(
111
136
  "button",
112
137
  {
113
- onClick: I,
138
+ onClick: ie,
114
139
  className: "group flex items-center gap-1.5 px-2.5 py-1.5 rounded-md hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-all duration-200 hover:scale-105 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1 focus:ring-offset-background",
115
- title: "Copier le message",
116
- "aria-label": "Copier le message",
117
- children: _ ? /* @__PURE__ */ t(f, { children: [
118
- /* @__PURE__ */ e(P, { className: "h-3.5 w-3.5 text-positive-foreground" }),
119
- /* @__PURE__ */ e("span", { className: "text-xs font-medium text-positive-foreground", children: "Copié" })
120
- ] }) : /* @__PURE__ */ t(f, { children: [
121
- /* @__PURE__ */ e(U, { className: "h-3.5 w-3.5" }),
122
- /* @__PURE__ */ e("span", { className: "text-xs font-medium hidden sm:inline", children: "Copier" })
140
+ title: T,
141
+ "aria-label": T,
142
+ children: z ? /* @__PURE__ */ r(f, { children: [
143
+ /* @__PURE__ */ t(be, { className: "h-3.5 w-3.5 text-positive-foreground" }),
144
+ /* @__PURE__ */ t("span", { className: "text-xs font-medium text-positive-foreground", children: V })
145
+ ] }) : /* @__PURE__ */ r(f, { children: [
146
+ /* @__PURE__ */ t(he, { className: "h-3.5 w-3.5" }),
147
+ /* @__PURE__ */ t("span", { className: "text-xs font-medium hidden sm:inline", children: H })
123
148
  ] })
124
149
  }
125
150
  ),
126
- h && /* @__PURE__ */ t(
151
+ h && /* @__PURE__ */ r(
127
152
  "button",
128
153
  {
129
154
  onClick: h,
130
155
  className: "group flex items-center gap-1.5 px-2.5 py-1.5 rounded-md hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-all duration-200 hover:scale-105 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1 focus:ring-offset-background",
131
- title: "Régénérer la réponse",
132
- "aria-label": "Régénérer la réponse",
156
+ title: C,
157
+ "aria-label": C,
133
158
  children: [
134
- /* @__PURE__ */ e(Z, { className: "h-3.5 w-3.5 group-hover:rotate-180 transition-transform duration-500" }),
135
- /* @__PURE__ */ e("span", { className: "text-xs font-medium hidden sm:inline", children: "Régénérer" })
159
+ /* @__PURE__ */ t(xe, { className: "h-3.5 w-3.5 group-hover:rotate-180 transition-transform duration-500" }),
160
+ /* @__PURE__ */ t("span", { className: "text-xs font-medium hidden sm:inline", children: $ })
136
161
  ]
137
162
  }
138
163
  ),
139
- d === "api_answer" && c && /* @__PURE__ */ t(
164
+ d === "api_answer" && m && /* @__PURE__ */ r(
140
165
  "button",
141
166
  {
142
- onClick: T,
167
+ onClick: ce,
143
168
  className: "group flex items-center gap-1.5 px-2.5 py-1.5 rounded-md hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-all duration-200 hover:scale-105 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1 focus:ring-offset-background",
144
- title: "Ouvrir Canva",
145
- "aria-label": "Ouvrir Canva",
169
+ title: y,
170
+ "aria-label": y,
146
171
  children: [
147
- /* @__PURE__ */ e(D, { className: "h-3.5 w-3.5 group-hover:scale-110 transition-transform duration-200" }),
148
- /* @__PURE__ */ e("span", { className: "text-xs font-medium hidden sm:inline", children: "Ouvrir Canva" })
172
+ /* @__PURE__ */ t(ve, { className: "h-3.5 w-3.5 group-hover:scale-110 transition-transform duration-200" }),
173
+ /* @__PURE__ */ t("span", { className: "text-xs font-medium hidden sm:inline", children: J })
149
174
  ]
150
175
  }
151
176
  ),
152
- /* @__PURE__ */ e("div", { className: "mx-1 h-4 w-px bg-muted-foreground/20" }),
153
- /* @__PURE__ */ e(
177
+ /* @__PURE__ */ t("div", { className: "mx-1 h-4 w-px bg-muted-foreground/20" }),
178
+ /* @__PURE__ */ t(
154
179
  "button",
155
180
  {
156
- onClick: () => k("positive"),
157
- disabled: o !== null,
158
- className: s(
181
+ onClick: () => F("positive"),
182
+ disabled: s !== null,
183
+ className: n(
159
184
  "group flex items-center gap-1 px-2 py-1.5 rounded-md transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1 focus:ring-offset-background",
160
- o === "positive" ? "bg-green-100 dark:bg-green-900/30 text-green-600 dark:text-green-400" : o !== null ? "opacity-50 cursor-not-allowed text-muted-foreground" : "hover:bg-muted/60 text-muted-foreground hover:text-green-600 dark:hover:text-green-400 hover:scale-105"
185
+ s === "positive" ? "bg-green-100 dark:bg-green-900/30 text-green-600 dark:text-green-400" : s !== null ? "opacity-50 cursor-not-allowed text-muted-foreground" : "hover:bg-muted/60 text-muted-foreground hover:text-green-600 dark:hover:text-green-400 hover:scale-105"
161
186
  ),
162
- title: "Réponse utile",
163
- "aria-label": "Réponse utile",
164
- children: /* @__PURE__ */ e(M, { className: s(
187
+ title: w,
188
+ "aria-label": w,
189
+ children: /* @__PURE__ */ t(E, { className: n(
165
190
  "h-3.5 w-3.5",
166
- o === "positive" && "fill-current"
191
+ s === "positive" && "fill-current"
167
192
  ) })
168
193
  }
169
194
  ),
170
- /* @__PURE__ */ e(
195
+ /* @__PURE__ */ t(
171
196
  "button",
172
197
  {
173
- onClick: () => k("negative"),
174
- disabled: o !== null,
175
- className: s(
198
+ onClick: () => F("negative"),
199
+ disabled: s !== null,
200
+ className: n(
176
201
  "group flex items-center gap-1 px-2 py-1.5 rounded-md transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1 focus:ring-offset-background",
177
- o === "negative" ? "bg-red-100 dark:bg-red-900/30 text-red-600 dark:text-red-400" : o !== null ? "opacity-50 cursor-not-allowed text-muted-foreground" : "hover:bg-muted/60 text-muted-foreground hover:text-red-600 dark:hover:text-red-400 hover:scale-105"
202
+ s === "negative" ? "bg-red-100 dark:bg-red-900/30 text-red-600 dark:text-red-400" : s !== null ? "opacity-50 cursor-not-allowed text-muted-foreground" : "hover:bg-muted/60 text-muted-foreground hover:text-red-600 dark:hover:text-red-400 hover:scale-105"
178
203
  ),
179
- title: "Réponse non utile",
180
- "aria-label": "Réponse non utile",
181
- children: /* @__PURE__ */ e(y, { className: s(
204
+ title: N,
205
+ "aria-label": N,
206
+ children: /* @__PURE__ */ t(S, { className: n(
182
207
  "h-3.5 w-3.5",
183
- o === "negative" && "fill-current"
208
+ s === "negative" && "fill-current"
184
209
  ) })
185
210
  }
186
211
  )
187
212
  ] }),
188
- /* @__PURE__ */ e(
189
- B,
213
+ /* @__PURE__ */ t(
214
+ ge,
190
215
  {
191
- isOpen: S,
192
- onClose: C,
216
+ isOpen: _,
217
+ onClose: M,
193
218
  size: "small",
194
219
  showCloseButton: !1,
195
220
  className: "w-[calc(100vw-2rem)] max-w-md",
196
- children: /* @__PURE__ */ t("div", { className: "relative space-y-4", children: [
197
- /* @__PURE__ */ e(
221
+ children: /* @__PURE__ */ r("div", { className: "relative space-y-4", children: [
222
+ /* @__PURE__ */ t(
198
223
  "button",
199
224
  {
200
225
  type: "button",
201
- onClick: C,
226
+ onClick: M,
202
227
  className: "absolute right-0 top-0 text-muted-foreground hover:text-foreground transition-colors",
203
- "aria-label": "Fermer",
204
- children: /* @__PURE__ */ e(X, { className: "h-4 w-4" })
228
+ "aria-label": U,
229
+ children: /* @__PURE__ */ t(ke, { className: "h-4 w-4" })
205
230
  }
206
231
  ),
207
- /* @__PURE__ */ t(
232
+ /* @__PURE__ */ r(
208
233
  "div",
209
234
  {
210
- className: s(
235
+ className: n(
211
236
  "flex items-start gap-3 rounded-lg border px-4 py-3 sm:px-5 sm:py-4 pt-4",
212
- n === "positive" ? "border-green-200 bg-green-50 dark:bg-green-950/20 text-green-700 dark:text-green-300" : "border-red-200 bg-red-50 dark:bg-red-950/20 text-red-700 dark:text-red-300"
237
+ a === "positive" ? "border-green-200 bg-green-50 dark:bg-green-950/20 text-green-700 dark:text-green-300" : "border-red-200 bg-red-50 dark:bg-red-950/20 text-red-700 dark:text-red-300"
213
238
  ),
214
239
  children: [
215
- /* @__PURE__ */ e("div", { className: "flex h-8 w-8 items-center justify-center rounded-full bg-white/70 dark:bg-background/30", children: n === "positive" ? /* @__PURE__ */ e(M, { className: "h-4 w-4 fill-current" }) : /* @__PURE__ */ e(y, { className: "h-4 w-4 fill-current" }) }),
216
- /* @__PURE__ */ t("div", { className: "space-y-1", children: [
217
- /* @__PURE__ */ e("p", { className: "text-sm font-semibold", children: n === "positive" ? "Merci pour votre feedback !" : "Aidez-nous à nous améliorer" }),
218
- /* @__PURE__ */ e("p", { className: "text-xs sm:text-sm text-muted-foreground", children: "Un commentaire pour nous aider ?" })
240
+ /* @__PURE__ */ t("div", { className: "flex h-8 w-8 items-center justify-center rounded-full bg-white/70 dark:bg-background/30", children: a === "positive" ? /* @__PURE__ */ t(E, { className: "h-4 w-4 fill-current" }) : /* @__PURE__ */ t(S, { className: "h-4 w-4 fill-current" }) }),
241
+ /* @__PURE__ */ r("div", { className: "space-y-1", children: [
242
+ /* @__PURE__ */ t("p", { className: "text-sm font-semibold", children: a === "positive" ? K : Q }),
243
+ /* @__PURE__ */ t("p", { className: "text-xs sm:text-sm text-muted-foreground", children: W })
219
244
  ] })
220
245
  ]
221
246
  }
222
247
  ),
223
- /* @__PURE__ */ e(
224
- G,
248
+ /* @__PURE__ */ t(
249
+ pe,
225
250
  {
226
- placeholder: "Votre commentaire (optionnel)...",
227
- value: m,
228
- onChange: (r) => g(r.target.value),
251
+ placeholder: Y,
252
+ value: g,
253
+ onChange: (o) => p(o.target.value),
229
254
  className: "min-h-[80px] max-h-[150px] w-full resize-none text-sm box-border",
230
- disabled: i
255
+ disabled: c
231
256
  }
232
257
  ),
233
- /* @__PURE__ */ t("div", { className: "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", children: [
234
- /* @__PURE__ */ e(
235
- N,
258
+ /* @__PURE__ */ r("div", { className: "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", children: [
259
+ /* @__PURE__ */ t(
260
+ A,
236
261
  {
237
262
  variant: "ghost",
238
263
  size: "sm",
239
- onClick: () => w(!1),
240
- disabled: i,
264
+ onClick: () => L(!1),
265
+ disabled: c,
241
266
  className: "w-full sm:w-auto text-muted-foreground hover:text-foreground",
242
- children: "Passer"
267
+ children: ee
243
268
  }
244
269
  ),
245
- /* @__PURE__ */ e(
246
- N,
270
+ /* @__PURE__ */ t(
271
+ A,
247
272
  {
248
273
  size: "sm",
249
- onClick: () => w(!0),
250
- disabled: i || !m.trim(),
251
- className: s(
274
+ onClick: () => L(!0),
275
+ disabled: c || !g.trim(),
276
+ className: n(
252
277
  "w-full sm:w-auto",
253
- n === "positive" ? "bg-green-600 hover:bg-green-700 dark:bg-green-500 dark:hover:bg-green-600" : "bg-red-600 hover:bg-red-700 dark:bg-red-500 dark:hover:bg-red-600"
278
+ a === "positive" ? "bg-green-600 hover:bg-green-700 dark:bg-green-500 dark:hover:bg-green-600" : "bg-red-600 hover:bg-red-700 dark:bg-red-500 dark:hover:bg-red-600"
254
279
  ),
255
- children: i ? "Envoi..." : "Envoyer"
280
+ children: c ? oe : te
256
281
  }
257
282
  )
258
283
  ] })
@@ -262,6 +287,6 @@ function ue({
262
287
  ] });
263
288
  }
264
289
  export {
265
- ue as MessageActions
290
+ je as MessageActions
266
291
  };
267
292
  //# sourceMappingURL=MessageActions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MessageActions.js","sources":["../../../../../node_modules/.pnpm/lucide-react@0.545.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/thumbs-down.js","../../../../../node_modules/.pnpm/lucide-react@0.545.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/thumbs-up.js","../../../lib/organisms/chat/MessageActions.tsx"],"sourcesContent":["/**\n * @license lucide-react v0.545.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst __iconNode = [\n [\"path\", { d: \"M17 14V2\", key: \"8ymqnk\" }],\n [\n \"path\",\n {\n d: \"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z\",\n key: \"m61m77\"\n }\n ]\n];\nconst ThumbsDown = createLucideIcon(\"thumbs-down\", __iconNode);\n\nexport { __iconNode, ThumbsDown as default };\n//# sourceMappingURL=thumbs-down.js.map\n","/**\n * @license lucide-react v0.545.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst __iconNode = [\n [\"path\", { d: \"M7 10v12\", key: \"1qc93n\" }],\n [\n \"path\",\n {\n d: \"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z\",\n key: \"emmmcr\"\n }\n ]\n];\nconst ThumbsUp = createLucideIcon(\"thumbs-up\", __iconNode);\n\nexport { __iconNode, ThumbsUp as default };\n//# sourceMappingURL=thumbs-up.js.map\n","\"use client\";\n\nimport { useState } from \"react\";\nimport type { ChangeEvent } from \"react\";\nimport { Copy, RefreshCw, Check, Maximize2, ThumbsUp, ThumbsDown, X } from \"lucide-react\";\nimport { cn } from \"@clubmed/usg-chat-ui/utils/cn\";\nimport { useToast } from \"@clubmed/usg-chat-ui/molecules/Notifications/useToast\";\nimport { useCanvasStore } from \"@clubmed/usg-chat-ui/utils/canvas-store\";\nimport { useChatApiClient } from \"@clubmed/usg-chat-ui/contexts/ChatContext\";\nimport { Modal } from \"@clubmed/usg-chat-ui/molecules/Modals/Modal\";\nimport { Button } from \"@clubmed/usg-chat-ui/molecules/Buttons/Button\";\nimport { Textarea } from \"@clubmed/usg-chat-ui/molecules/Textareas/Textarea\";\n\ninterface MessageActionsProps {\n content: string;\n messageId?: string;\n storyId?: string;\n onRegenerate?: () => void;\n responseType?: \"message\" | \"story\" | \"api_answer\" | \"followup_questions\" | \"release_note\";\n canvasData?: Record<string, unknown>;\n className?: string;\n}\n\nexport function MessageActions({ \n content, \n messageId,\n storyId,\n onRegenerate, \n responseType,\n canvasData,\n className \n}: MessageActionsProps) {\n const [copied, setCopied] = useState(false);\n const [feedbackGiven, setFeedbackGiven] = useState<\"positive\" | \"negative\" | null>(null);\n const [showFeedbackModal, setShowFeedbackModal] = useState(false);\n const [pendingRating, setPendingRating] = useState<\"positive\" | \"negative\" | null>(null);\n const [feedbackComment, setFeedbackComment] = useState(\"\");\n const [isSubmitting, setIsSubmitting] = useState(false);\n const { toast } = useToast();\n const { openApiDocsCanvas } = useCanvasStore();\n const apiClient = useChatApiClient();\n\n const handleCopy = async () => {\n try {\n await navigator.clipboard.writeText(content);\n setCopied(true);\n toast({\n title: \"Copié\",\n description: \"Message copié dans le presse-papiers\",\n });\n setTimeout(() => setCopied(false), 2000);\n } catch (error) {\n console.error(\"Failed to copy:\", error);\n toast({\n title: \"Erreur\",\n description: \"Impossible de copier le message\",\n variant: \"destructive\",\n });\n }\n };\n\n const handleOpenApiCanvas = () => {\n if (canvasData && responseType === \"api_answer\") {\n const apiData = canvasData as {\n answer?: string;\n sources?: Array<{ title: string; href: string; score?: number }>;\n };\n \n if (apiData.answer || apiData.sources) {\n openApiDocsCanvas({\n answer: apiData.answer || content,\n sources: apiData.sources || [],\n });\n }\n }\n };\n\n const handleFeedbackClick = (rating: \"positive\" | \"negative\") => {\n if (feedbackGiven) return; // Already gave feedback\n setPendingRating(rating);\n setShowFeedbackModal(true);\n };\n\n const submitFeedback = async (withComment: boolean) => {\n if (!pendingRating) return;\n \n setIsSubmitting(true);\n try {\n await apiClient.submitFeedback({\n messageId,\n storyId,\n rating: pendingRating,\n comment: withComment ? feedbackComment : undefined,\n responseType: responseType as \"story\" | \"release_note\" | \"api_answer\" | \"message\" | undefined,\n });\n \n setFeedbackGiven(pendingRating);\n setShowFeedbackModal(false);\n setFeedbackComment(\"\");\n \n toast({\n title: \"Merci !\",\n description: \"Votre feedback a été enregistré\",\n });\n } catch (error) {\n console.error(\"Failed to submit feedback:\", error);\n toast({\n title: \"Erreur\",\n description: \"Impossible d'enregistrer le feedback\",\n variant: \"destructive\",\n });\n } finally {\n setIsSubmitting(false);\n }\n };\n\n const handleModalClose = () => {\n setShowFeedbackModal(false);\n setPendingRating(null);\n setFeedbackComment(\"\");\n };\n\n return (\n <>\n <div className={cn(\"flex items-center gap-1.5 mt-3 pt-2 border-t border-border\", className)}>\n <button\n onClick={handleCopy}\n className=\"group flex items-center gap-1.5 px-2.5 py-1.5 rounded-md hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-all duration-200 hover:scale-105 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1 focus:ring-offset-background\"\n title=\"Copier le message\"\n aria-label=\"Copier le message\"\n >\n {copied ? (\n <>\n <Check className=\"h-3.5 w-3.5 text-positive-foreground\" />\n <span className=\"text-xs font-medium text-positive-foreground\">Copié</span>\n </>\n ) : (\n <>\n <Copy className=\"h-3.5 w-3.5\" />\n <span className=\"text-xs font-medium hidden sm:inline\">Copier</span>\n </>\n )}\n </button>\n \n {onRegenerate && (\n <button\n onClick={onRegenerate}\n className=\"group flex items-center gap-1.5 px-2.5 py-1.5 rounded-md hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-all duration-200 hover:scale-105 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1 focus:ring-offset-background\"\n title=\"Régénérer la réponse\"\n aria-label=\"Régénérer la réponse\"\n >\n <RefreshCw className=\"h-3.5 w-3.5 group-hover:rotate-180 transition-transform duration-500\" />\n <span className=\"text-xs font-medium hidden sm:inline\">Régénérer</span>\n </button>\n )}\n \n {responseType === \"api_answer\" && canvasData && (\n <button\n onClick={handleOpenApiCanvas}\n className=\"group flex items-center gap-1.5 px-2.5 py-1.5 rounded-md hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-all duration-200 hover:scale-105 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1 focus:ring-offset-background\"\n title=\"Ouvrir Canva\"\n aria-label=\"Ouvrir Canva\"\n >\n <Maximize2 className=\"h-3.5 w-3.5 group-hover:scale-110 transition-transform duration-200\" />\n <span className=\"text-xs font-medium hidden sm:inline\">Ouvrir Canva</span>\n </button>\n )}\n\n {/* Feedback buttons - separator */}\n <div className=\"mx-1 h-4 w-px bg-muted-foreground/20\" />\n\n {/* Thumbs Up */}\n <button\n onClick={() => handleFeedbackClick(\"positive\")}\n disabled={feedbackGiven !== null}\n className={cn(\n \"group flex items-center gap-1 px-2 py-1.5 rounded-md transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1 focus:ring-offset-background\",\n feedbackGiven === \"positive\"\n ? \"bg-green-100 dark:bg-green-900/30 text-green-600 dark:text-green-400\"\n : feedbackGiven !== null\n ? \"opacity-50 cursor-not-allowed text-muted-foreground\"\n : \"hover:bg-muted/60 text-muted-foreground hover:text-green-600 dark:hover:text-green-400 hover:scale-105\"\n )}\n title=\"Réponse utile\"\n aria-label=\"Réponse utile\"\n >\n <ThumbsUp className={cn(\n \"h-3.5 w-3.5\",\n feedbackGiven === \"positive\" && \"fill-current\"\n )} />\n </button>\n\n {/* Thumbs Down */}\n <button\n onClick={() => handleFeedbackClick(\"negative\")}\n disabled={feedbackGiven !== null}\n className={cn(\n \"group flex items-center gap-1 px-2 py-1.5 rounded-md transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1 focus:ring-offset-background\",\n feedbackGiven === \"negative\"\n ? \"bg-red-100 dark:bg-red-900/30 text-red-600 dark:text-red-400\"\n : feedbackGiven !== null\n ? \"opacity-50 cursor-not-allowed text-muted-foreground\"\n : \"hover:bg-muted/60 text-muted-foreground hover:text-red-600 dark:hover:text-red-400 hover:scale-105\"\n )}\n title=\"Réponse non utile\"\n aria-label=\"Réponse non utile\"\n >\n <ThumbsDown className={cn(\n \"h-3.5 w-3.5\",\n feedbackGiven === \"negative\" && \"fill-current\"\n )} />\n </button>\n </div>\n\n <Modal\n isOpen={showFeedbackModal}\n onClose={handleModalClose}\n size=\"small\"\n showCloseButton={false}\n className=\"w-[calc(100vw-2rem)] max-w-md\"\n >\n <div className=\"relative space-y-4\">\n <button\n type=\"button\"\n onClick={handleModalClose}\n className=\"absolute right-0 top-0 text-muted-foreground hover:text-foreground transition-colors\"\n aria-label=\"Fermer\"\n >\n <X className=\"h-4 w-4\" />\n </button>\n\n <div\n className={cn(\n \"flex items-start gap-3 rounded-lg border px-4 py-3 sm:px-5 sm:py-4 pt-4\",\n pendingRating === \"positive\"\n ? \"border-green-200 bg-green-50 dark:bg-green-950/20 text-green-700 dark:text-green-300\"\n : \"border-red-200 bg-red-50 dark:bg-red-950/20 text-red-700 dark:text-red-300\"\n )}\n >\n <div className=\"flex h-8 w-8 items-center justify-center rounded-full bg-white/70 dark:bg-background/30\">\n {pendingRating === \"positive\" ? (\n <ThumbsUp className=\"h-4 w-4 fill-current\" />\n ) : (\n <ThumbsDown className=\"h-4 w-4 fill-current\" />\n )}\n </div>\n <div className=\"space-y-1\">\n <p className=\"text-sm font-semibold\">\n {pendingRating === \"positive\"\n ? \"Merci pour votre feedback !\"\n : \"Aidez-nous à nous améliorer\"}\n </p>\n <p className=\"text-xs sm:text-sm text-muted-foreground\">\n Un commentaire pour nous aider ?\n </p>\n </div>\n </div>\n\n <Textarea\n placeholder=\"Votre commentaire (optionnel)...\"\n value={feedbackComment}\n onChange={(event: ChangeEvent<HTMLTextAreaElement>) =>\n setFeedbackComment(event.target.value)\n }\n className=\"min-h-[80px] max-h-[150px] w-full resize-none text-sm box-border\"\n disabled={isSubmitting}\n />\n\n <div className=\"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end\">\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => submitFeedback(false)}\n disabled={isSubmitting}\n className=\"w-full sm:w-auto text-muted-foreground hover:text-foreground\"\n >\n Passer\n </Button>\n <Button\n size=\"sm\"\n onClick={() => submitFeedback(true)}\n disabled={isSubmitting || !feedbackComment.trim()}\n className={cn(\n \"w-full sm:w-auto\",\n pendingRating === \"positive\"\n ? \"bg-green-600 hover:bg-green-700 dark:bg-green-500 dark:hover:bg-green-600\"\n : \"bg-red-600 hover:bg-red-700 dark:bg-red-500 dark:hover:bg-red-600\"\n )}\n >\n {isSubmitting ? \"Envoi...\" : \"Envoyer\"}\n </Button>\n </div>\n </div>\n </Modal>\n </>\n );\n}\n"],"names":["__iconNode","ThumbsDown","createLucideIcon","ThumbsUp","MessageActions","content","messageId","storyId","onRegenerate","responseType","canvasData","className","copied","setCopied","useState","feedbackGiven","setFeedbackGiven","showFeedbackModal","setShowFeedbackModal","pendingRating","setPendingRating","feedbackComment","setFeedbackComment","isSubmitting","setIsSubmitting","toast","useToast","openApiDocsCanvas","useCanvasStore","apiClient","useChatApiClient","handleCopy","error","handleOpenApiCanvas","apiData","handleFeedbackClick","rating","submitFeedback","withComment","handleModalClose","jsxs","Fragment","cn","jsx","Check","Copy","RefreshCw","Maximize2","Modal","Textarea","event","Button"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,IAAa;AAAA,EACjB,CAAC,QAAQ,EAAE,GAAG,YAAY,KAAK,SAAQ,CAAE;AAAA,EACzC;AAAA,IACE;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,KAAK;AAAA,IACX;AAAA,EACA;AACA,GACMC,IAAaC,EAAiB,eAAeF,CAAU;ACnB7D;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,IAAa;AAAA,EACjB,CAAC,QAAQ,EAAE,GAAG,YAAY,KAAK,SAAQ,CAAE;AAAA,EACzC;AAAA,IACE;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,KAAK;AAAA,IACX;AAAA,EACA;AACA,GACMG,IAAWD,EAAiB,aAAaF,CAAU;ACIlD,SAASI,GAAe;AAAA,EAC7B,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,cAAAC;AAAA,EACA,cAAAC;AAAA,EACA,YAAAC;AAAA,EACA,WAAAC;AACF,GAAwB;AACtB,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAK,GACpC,CAACC,GAAeC,CAAgB,IAAIF,EAAyC,IAAI,GACjF,CAACG,GAAmBC,CAAoB,IAAIJ,EAAS,EAAK,GAC1D,CAACK,GAAeC,CAAgB,IAAIN,EAAyC,IAAI,GACjF,CAACO,GAAiBC,CAAkB,IAAIR,EAAS,EAAE,GACnD,CAACS,GAAcC,CAAe,IAAIV,EAAS,EAAK,GAChD,EAAE,OAAAW,EAAA,IAAUC,EAAA,GACZ,EAAE,mBAAAC,EAAA,IAAsBC,EAAA,GACxBC,IAAYC,EAAA,GAEZC,IAAa,YAA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ACX,UAAA;AAAA,cAAA;AAAA,YAAA;AAAA,YAGD,gBAAAoB;AAAA,cAACQ;AAAA,cAAA;AAAA,gBACC,MAAK;AAAA,gBACL,SAAS,MAAMd,EAAe,EAAI;AAAA,gBAClC,UAAUd,KAAgB,CAACF,EAAgB,KAAA;AAAA,gBAC3C,WAAWqB;AAAA,kBACT;AAAA,kBACAvB,MAAkB,aACd,8EACA;AAAA,gBAAA;AAAA,gBAGL,cAAe,aAAa;AAAA,cAAA;AAAA,YAAA;AAAA,UAC/B,EAAA,CACF;AAAA,QAAA,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;","x_google_ignoreList":[0,1]}
1
+ {"version":3,"file":"MessageActions.js","sources":["../../../../../node_modules/.pnpm/lucide-react@0.545.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/thumbs-down.js","../../../../../node_modules/.pnpm/lucide-react@0.545.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/thumbs-up.js","../../../lib/organisms/chat/MessageActions.tsx"],"sourcesContent":["/**\n * @license lucide-react v0.545.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst __iconNode = [\n [\"path\", { d: \"M17 14V2\", key: \"8ymqnk\" }],\n [\n \"path\",\n {\n d: \"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z\",\n key: \"m61m77\"\n }\n ]\n];\nconst ThumbsDown = createLucideIcon(\"thumbs-down\", __iconNode);\n\nexport { __iconNode, ThumbsDown as default };\n//# sourceMappingURL=thumbs-down.js.map\n","/**\n * @license lucide-react v0.545.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst __iconNode = [\n [\"path\", { d: \"M7 10v12\", key: \"1qc93n\" }],\n [\n \"path\",\n {\n d: \"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z\",\n key: \"emmmcr\"\n }\n ]\n];\nconst ThumbsUp = createLucideIcon(\"thumbs-up\", __iconNode);\n\nexport { __iconNode, ThumbsUp as default };\n//# sourceMappingURL=thumbs-up.js.map\n","\"use client\";\n\nimport {useState} from \"react\";\nimport type {ChangeEvent} from \"react\";\nimport {Copy, RefreshCw, Check, Maximize2, ThumbsUp, ThumbsDown, X} from \"lucide-react\";\nimport {cn} from \"@clubmed/usg-chat-ui/utils/cn\";\nimport {useToast} from \"@clubmed/usg-chat-ui/molecules/Notifications/useToast\";\nimport {useCanvasStore} from \"@clubmed/usg-chat-ui/utils/canvas-store\";\nimport {useChatApiClient} from \"@clubmed/usg-chat-ui/contexts/ChatContext\";\nimport {Modal} from \"@clubmed/usg-chat-ui/molecules/Modals/Modal\";\nimport {Button} from \"@clubmed/usg-chat-ui/molecules/Buttons/Button\";\nimport {Textarea} from \"@clubmed/usg-chat-ui/molecules/Textareas/Textarea\";\nimport {useChatLabels} from \"../../contexts/ChatLabelsContext\";\n\ninterface MessageActionsProps {\n content: string;\n messageId?: string;\n storyId?: string;\n onRegenerate?: () => void;\n responseType?: \"message\" | \"story\" | \"api_answer\" | \"followup_questions\" | \"release_note\";\n canvasData?: Record<string, unknown>;\n className?: string;\n}\n\nexport function MessageActions({ \n content, \n messageId,\n storyId,\n onRegenerate, \n responseType,\n canvasData,\n className \n}: MessageActionsProps) {\n const [copied, setCopied] = useState(false);\n const [feedbackGiven, setFeedbackGiven] = useState<\"positive\" | \"negative\" | null>(null);\n const [showFeedbackModal, setShowFeedbackModal] = useState(false);\n const [pendingRating, setPendingRating] = useState<\"positive\" | \"negative\" | null>(null);\n const [feedbackComment, setFeedbackComment] = useState(\"\");\n const [isSubmitting, setIsSubmitting] = useState(false);\n const { toast } = useToast();\n const { openApiDocsCanvas } = useCanvasStore();\n const apiClient = useChatApiClient();\n const {get} = useChatLabels();\n const copyLabel = get(\"messageCopyAriaLabel\", \"Copier le message\");\n const regenerateLabel = get(\"messageRegenerateAriaLabel\", \"Régénérer la réponse\");\n const openCanvasLabel = get(\"messageOpenCanvasAriaLabel\", \"Ouvrir Canva\");\n const thumbsUpLabel = get(\"messageThumbsUpAriaLabel\", \"Réponse utile\");\n const thumbsDownLabel = get(\"messageThumbsDownAriaLabel\", \"Réponse non utile\");\n const closeFeedbackLabel = get(\"messageCloseFeedbackAriaLabel\", \"Fermer\");\n const copyButtonText = get(\"messageCopyButtonText\", \"Copier\");\n const copySuccessText = get(\"messageCopySuccessText\", \"Copié\");\n const copyToastTitle = get(\"messageCopyToastTitle\", \"Copié\");\n const copyToastDescription = get(\n \"messageCopyToastDescription\",\n \"Message copié dans le presse-papiers\"\n );\n const copyErrorTitle = get(\"messageCopyErrorTitle\", \"Erreur\");\n const copyErrorDescription = get(\n \"messageCopyErrorDescription\",\n \"Impossible de copier le message\"\n );\n const regenerateButtonText = get(\"messageRegenerateButtonText\", \"Régénérer\");\n const openCanvasButtonText = get(\"messageOpenCanvasButtonText\", \"Ouvrir Canva\");\n const feedbackPositiveTitle = get(\n \"messageFeedbackPositiveTitle\",\n \"Merci pour votre feedback !\"\n );\n const feedbackNegativeTitle = get(\n \"messageFeedbackNegativeTitle\",\n \"Aidez-nous à nous améliorer\"\n );\n const feedbackPromptText = get(\n \"messageFeedbackPromptText\",\n \"Un commentaire pour nous aider ?\"\n );\n const feedbackTextareaPlaceholder = get(\n \"messageFeedbackTextareaPlaceholder\",\n \"Votre commentaire (optionnel)...\"\n );\n const feedbackSkipText = get(\"messageFeedbackSkipButtonText\", \"Passer\");\n const feedbackSubmitText = get(\"messageFeedbackSubmitButtonText\", \"Envoyer\");\n const feedbackSubmittingText = get(\"messageFeedbackSubmittingText\", \"Envoi...\");\n const feedbackToastTitle = get(\"messageFeedbackToastTitle\", \"Merci !\");\n const feedbackToastDescription = get(\n \"messageFeedbackToastDescription\",\n \"Votre feedback a été enregistré\"\n );\n const feedbackToastErrorTitle = get(\"messageFeedbackToastErrorTitle\", \"Erreur\");\n const feedbackToastErrorDescription = get(\n \"messageFeedbackToastErrorDescription\",\n \"Impossible d'enregistrer le feedback\"\n );\n\n const handleCopy = async () => {\n try {\n await navigator.clipboard.writeText(content);\n setCopied(true);\n toast({\n title: copyToastTitle,\n description: copyToastDescription,\n });\n setTimeout(() => setCopied(false), 2000);\n } catch (error) {\n console.error(\"Failed to copy:\", error);\n toast({\n title: copyErrorTitle,\n description: copyErrorDescription,\n variant: \"destructive\",\n });\n }\n };\n\n const handleOpenApiCanvas = () => {\n if (canvasData && responseType === \"api_answer\") {\n const apiData = canvasData as {\n answer?: string;\n sources?: Array<{ title: string; href: string; score?: number }>;\n };\n \n if (apiData.answer || apiData.sources) {\n openApiDocsCanvas({\n answer: apiData.answer || content,\n sources: apiData.sources || [],\n });\n }\n }\n };\n\n const handleFeedbackClick = (rating: \"positive\" | \"negative\") => {\n if (feedbackGiven) return; // Already gave feedback\n setPendingRating(rating);\n setShowFeedbackModal(true);\n };\n\n const submitFeedback = async (withComment: boolean) => {\n if (!pendingRating) return;\n \n setIsSubmitting(true);\n try {\n await apiClient.submitFeedback({\n messageId,\n storyId,\n rating: pendingRating,\n comment: withComment ? feedbackComment : undefined,\n responseType: responseType as \"story\" | \"release_note\" | \"api_answer\" | \"message\" | undefined,\n });\n \n setFeedbackGiven(pendingRating);\n setShowFeedbackModal(false);\n setFeedbackComment(\"\");\n \n toast({\n title: feedbackToastTitle,\n description: feedbackToastDescription,\n });\n } catch (error) {\n console.error(\"Failed to submit feedback:\", error);\n toast({\n title: feedbackToastErrorTitle,\n description: feedbackToastErrorDescription,\n variant: \"destructive\",\n });\n } finally {\n setIsSubmitting(false);\n }\n };\n\n const handleModalClose = () => {\n setShowFeedbackModal(false);\n setPendingRating(null);\n setFeedbackComment(\"\");\n };\n\n return (\n <>\n <div className={cn(\"flex items-center gap-1.5 mt-3 pt-2 border-t border-border\", className)}>\n <button\n onClick={handleCopy}\n className=\"group flex items-center gap-1.5 px-2.5 py-1.5 rounded-md hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-all duration-200 hover:scale-105 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1 focus:ring-offset-background\"\n title={copyLabel}\n aria-label={copyLabel}\n >\n {copied ? (\n <>\n <Check className=\"h-3.5 w-3.5 text-positive-foreground\" />\n <span className=\"text-xs font-medium text-positive-foreground\">{copySuccessText}</span>\n </>\n ) : (\n <>\n <Copy className=\"h-3.5 w-3.5\" />\n <span className=\"text-xs font-medium hidden sm:inline\">{copyButtonText}</span>\n </>\n )}\n </button>\n \n {onRegenerate && (\n <button\n onClick={onRegenerate}\n className=\"group flex items-center gap-1.5 px-2.5 py-1.5 rounded-md hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-all duration-200 hover:scale-105 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1 focus:ring-offset-background\"\n title={regenerateLabel}\n aria-label={regenerateLabel}\n >\n <RefreshCw className=\"h-3.5 w-3.5 group-hover:rotate-180 transition-transform duration-500\" />\n <span className=\"text-xs font-medium hidden sm:inline\">{regenerateButtonText}</span>\n </button>\n )}\n \n {responseType === \"api_answer\" && canvasData && (\n <button\n onClick={handleOpenApiCanvas}\n className=\"group flex items-center gap-1.5 px-2.5 py-1.5 rounded-md hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-all duration-200 hover:scale-105 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1 focus:ring-offset-background\"\n title={openCanvasLabel}\n aria-label={openCanvasLabel}\n >\n <Maximize2 className=\"h-3.5 w-3.5 group-hover:scale-110 transition-transform duration-200\" />\n <span className=\"text-xs font-medium hidden sm:inline\">{openCanvasButtonText}</span>\n </button>\n )}\n\n {/* Feedback buttons - separator */}\n <div className=\"mx-1 h-4 w-px bg-muted-foreground/20\" />\n\n {/* Thumbs Up */}\n <button\n onClick={() => handleFeedbackClick(\"positive\")}\n disabled={feedbackGiven !== null}\n className={cn(\n \"group flex items-center gap-1 px-2 py-1.5 rounded-md transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1 focus:ring-offset-background\",\n feedbackGiven === \"positive\"\n ? \"bg-green-100 dark:bg-green-900/30 text-green-600 dark:text-green-400\"\n : feedbackGiven !== null\n ? \"opacity-50 cursor-not-allowed text-muted-foreground\"\n : \"hover:bg-muted/60 text-muted-foreground hover:text-green-600 dark:hover:text-green-400 hover:scale-105\"\n )}\n title={thumbsUpLabel}\n aria-label={thumbsUpLabel}\n >\n <ThumbsUp className={cn(\n \"h-3.5 w-3.5\",\n feedbackGiven === \"positive\" && \"fill-current\"\n )} />\n </button>\n\n {/* Thumbs Down */}\n <button\n onClick={() => handleFeedbackClick(\"negative\")}\n disabled={feedbackGiven !== null}\n className={cn(\n \"group flex items-center gap-1 px-2 py-1.5 rounded-md transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1 focus:ring-offset-background\",\n feedbackGiven === \"negative\"\n ? \"bg-red-100 dark:bg-red-900/30 text-red-600 dark:text-red-400\"\n : feedbackGiven !== null\n ? \"opacity-50 cursor-not-allowed text-muted-foreground\"\n : \"hover:bg-muted/60 text-muted-foreground hover:text-red-600 dark:hover:text-red-400 hover:scale-105\"\n )}\n title={thumbsDownLabel}\n aria-label={thumbsDownLabel}\n >\n <ThumbsDown className={cn(\n \"h-3.5 w-3.5\",\n feedbackGiven === \"negative\" && \"fill-current\"\n )} />\n </button>\n </div>\n\n <Modal\n isOpen={showFeedbackModal}\n onClose={handleModalClose}\n size=\"small\"\n showCloseButton={false}\n className=\"w-[calc(100vw-2rem)] max-w-md\"\n >\n <div className=\"relative space-y-4\">\n <button\n type=\"button\"\n onClick={handleModalClose}\n className=\"absolute right-0 top-0 text-muted-foreground hover:text-foreground transition-colors\"\n aria-label={closeFeedbackLabel}\n >\n <X className=\"h-4 w-4\" />\n </button>\n\n <div\n className={cn(\n \"flex items-start gap-3 rounded-lg border px-4 py-3 sm:px-5 sm:py-4 pt-4\",\n pendingRating === \"positive\"\n ? \"border-green-200 bg-green-50 dark:bg-green-950/20 text-green-700 dark:text-green-300\"\n : \"border-red-200 bg-red-50 dark:bg-red-950/20 text-red-700 dark:text-red-300\"\n )}\n >\n <div className=\"flex h-8 w-8 items-center justify-center rounded-full bg-white/70 dark:bg-background/30\">\n {pendingRating === \"positive\" ? (\n <ThumbsUp className=\"h-4 w-4 fill-current\" />\n ) : (\n <ThumbsDown className=\"h-4 w-4 fill-current\" />\n )}\n </div>\n <div className=\"space-y-1\">\n <p className=\"text-sm font-semibold\">\n {pendingRating === \"positive\"\n ? feedbackPositiveTitle\n : feedbackNegativeTitle}\n </p>\n <p className=\"text-xs sm:text-sm text-muted-foreground\">\n {feedbackPromptText}\n </p>\n </div>\n </div>\n\n <Textarea\n placeholder={feedbackTextareaPlaceholder}\n value={feedbackComment}\n onChange={(event: ChangeEvent<HTMLTextAreaElement>) =>\n setFeedbackComment(event.target.value)\n }\n className=\"min-h-[80px] max-h-[150px] w-full resize-none text-sm box-border\"\n disabled={isSubmitting}\n />\n\n <div className=\"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end\">\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => submitFeedback(false)}\n disabled={isSubmitting}\n className=\"w-full sm:w-auto text-muted-foreground hover:text-foreground\"\n >\n {feedbackSkipText}\n </Button>\n <Button\n size=\"sm\"\n onClick={() => submitFeedback(true)}\n disabled={isSubmitting || !feedbackComment.trim()}\n className={cn(\n \"w-full sm:w-auto\",\n pendingRating === \"positive\"\n ? \"bg-green-600 hover:bg-green-700 dark:bg-green-500 dark:hover:bg-green-600\"\n : \"bg-red-600 hover:bg-red-700 dark:bg-red-500 dark:hover:bg-red-600\"\n )}\n >\n {isSubmitting ? feedbackSubmittingText : feedbackSubmitText}\n </Button>\n </div>\n </div>\n </Modal>\n </>\n );\n}\n"],"names":["__iconNode","ThumbsDown","createLucideIcon","ThumbsUp","MessageActions","content","messageId","storyId","onRegenerate","responseType","canvasData","className","copied","setCopied","useState","feedbackGiven","setFeedbackGiven","showFeedbackModal","setShowFeedbackModal","pendingRating","setPendingRating","feedbackComment","setFeedbackComment","isSubmitting","setIsSubmitting","toast","useToast","openApiDocsCanvas","useCanvasStore","apiClient","useChatApiClient","get","useChatLabels","copyLabel","regenerateLabel","openCanvasLabel","thumbsUpLabel","thumbsDownLabel","closeFeedbackLabel","copyButtonText","copySuccessText","copyToastTitle","copyToastDescription","copyErrorTitle","copyErrorDescription","regenerateButtonText","openCanvasButtonText","feedbackPositiveTitle","feedbackNegativeTitle","feedbackPromptText","feedbackTextareaPlaceholder","feedbackSkipText","feedbackSubmitText","feedbackSubmittingText","feedbackToastTitle","feedbackToastDescription","feedbackToastErrorTitle","feedbackToastErrorDescription","handleCopy","error","handleOpenApiCanvas","apiData","handleFeedbackClick","rating","submitFeedback","withComment","handleModalClose","jsxs","Fragment","cn","jsx","Check","Copy","RefreshCw","Maximize2","Modal","X","Textarea","event","Button"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB,CAAC,QAAQ,EAAE,GAAG,YAAY,KAAK,SAAQ,CAAE;AAAA,EACzC;AAAA,IACE;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,KAAK;AAAA,IACX;AAAA,EACA;AACA,GACMC,IAAaC,EAAiB,eAAeF,EAAU;ACnB7D;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB,CAAC,QAAQ,EAAE,GAAG,YAAY,KAAK,SAAQ,CAAE;AAAA,EACzC;AAA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C,OAAE,WAAU,yBACV,UAAAnD,MAAkB,aACf4B,IACAC,GACN;AAAA,kBACA,gBAAAsB,EAAC,KAAA,EAAE,WAAU,4CACV,UAAArB,EAAA,CACH;AAAA,gBAAA,EAAA,CACF;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA;AAAA,UAGF,gBAAAqB;AAAA,YAACO;AAAA,YAAA;AAAA,cACC,aAAa3B;AAAA,cACb,OAAO7B;AAAA,cACP,UAAU,CAACyD,MACTxD,EAAmBwD,EAAM,OAAO,KAAK;AAAA,cAEvC,WAAU;AAAA,cACV,UAAUvD;AAAA,YAAA;AAAA,UAAA;AAAA,UAGZ,gBAAA4C,EAAC,OAAA,EAAI,WAAU,0DACb,UAAA;AAAA,YAAA,gBAAAG;AAAA,cAACS;AAAA,cAAA;AAAA,gBACC,SAAQ;AAAA,gBACR,MAAK;AAAA,gBACL,SAAS,MAAMf,EAAe,EAAK;AAAA,gBACnC,UAAUzC;AAAA,gBACV,WAAU;AAAA,gBAET,UAAA4B;AAAA,cAAA;AAAA,YAAA;AAAA,YAEH,gBAAAmB;AAAA,cAACS;AAAA,cAAA;AAAA,gBACC,MAAK;AAAA,gBACL,SAAS,MAAMf,EAAe,EAAI;AAAA,gBAClC,UAAUzC,KAAgB,CAACF,EAAgB,KAAA;AAAA,gBAC3C,WAAWgD;AAAA,kBACT;AAAA,kBACAlD,MAAkB,aACd,8EACA;AAAA,gBAAA;AAAA,gBAGL,cAAekC,KAAyBD;AAAA,cAAA;AAAA,YAAA;AAAA,UAC3C,EAAA,CACF;AAAA,QAAA,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;","x_google_ignoreList":[0,1]}
@@ -9,8 +9,8 @@ import { Sources as k, SourcesTrigger as A, SourcesContent as R, Source as C } f
9
9
  import { Reasoning as M, ReasoningTrigger as S, ReasoningContent as z } from "../../molecules/AiElements/Reasoning.js";
10
10
  import { useCanvasStore as b } from "../../utils/canvas-store.js";
11
11
  import { c as _ } from "../../chunks/createLucideIcon.js";
12
- import { C as w } from "../../chunks/chevron-right.js";
13
12
  import { N as j } from "../../chunks/newspaper.js";
13
+ import { C as w } from "../../chunks/chevron-right.js";
14
14
  /**
15
15
  * @license lucide-react v0.545.0 - ISC
16
16
  *
@@ -1,39 +1,44 @@
1
1
  "use client";
2
- import { jsx as t, jsxs as o } from "react/jsx-runtime";
3
- import { PromptInput as m, PromptInputBody as p, PromptInputTextarea as c, PromptInputFooter as i, PromptInputSubmit as h } from "../../molecules/AiElements/PromptInput.js";
4
- function u({ value: e, isLoading: n, onChange: s, onSubmit: d }) {
5
- return /* @__PURE__ */ t("div", { className: "p-3 sm:p-4", children: /* @__PURE__ */ o(m, { onSubmit: d, children: [
6
- /* @__PURE__ */ t(p, { children: /* @__PURE__ */ t(
7
- c,
2
+ import { jsx as t, jsxs as n } from "react/jsx-runtime";
3
+ import { PromptInput as c, PromptInputBody as l, PromptInputTextarea as a, PromptInputFooter as h, PromptInputSubmit as i } from "../../molecules/AiElements/PromptInput.js";
4
+ import { useChatLabels as x } from "../../contexts/ChatLabelsContext.js";
5
+ function g({ value: e, isLoading: o, onChange: s, onSubmit: p }) {
6
+ const { get: d } = x(), m = d(
7
+ "promptComposerPlaceholder",
8
+ "Décrivez votre besoin ou tapez /help pour l'aide..."
9
+ );
10
+ return /* @__PURE__ */ t("div", { className: "p-3 sm:p-4", children: /* @__PURE__ */ n(c, { onSubmit: p, children: [
11
+ /* @__PURE__ */ t(l, { children: /* @__PURE__ */ t(
12
+ a,
8
13
  {
9
14
  value: e,
10
15
  onChange: (r) => {
11
16
  s(r.target.value);
12
17
  },
13
- placeholder: "Décrivez votre besoin ou tapez /help pour l'aide...",
14
- disabled: n,
18
+ placeholder: m,
19
+ disabled: o,
15
20
  onKeyDown: (r) => {
16
- r.key === "Enter" && !r.shiftKey && !n && (e != null && e.trim()) && (r.preventDefault(), d({ text: e }));
21
+ r.key === "Enter" && !r.shiftKey && !o && (e != null && e.trim()) && (r.preventDefault(), p({ text: e }));
17
22
  }
18
23
  }
19
24
  ) }),
20
- /* @__PURE__ */ o(i, { children: [
21
- /* @__PURE__ */ o("p", { className: "text-xs text-muted-foreground hidden sm:block", children: [
25
+ /* @__PURE__ */ n(h, { children: [
26
+ /* @__PURE__ */ n("p", { className: "text-xs text-muted-foreground hidden sm:block", children: [
22
27
  "Commandes: /settings, /help, /clear •",
23
28
  " ",
24
29
  /* @__PURE__ */ t("kbd", { className: "px-1.5 py-0.5 rounded bg-muted text-xs font-mono", children: "Enter" }),
25
30
  " pour envoyer"
26
31
  ] }),
27
- /* @__PURE__ */ o("p", { className: "text-xs text-muted-foreground sm:hidden", children: [
32
+ /* @__PURE__ */ n("p", { className: "text-xs text-muted-foreground sm:hidden", children: [
28
33
  /* @__PURE__ */ t("kbd", { className: "px-1.5 py-0.5 rounded bg-muted text-xs font-mono", children: "Enter" }),
29
34
  " pour envoyer"
30
35
  ] }),
31
36
  /* @__PURE__ */ t("div", { className: "flex-1" }),
32
- /* @__PURE__ */ t(h, { disabled: n || !(e != null && e.trim()), status: n ? "streaming" : "ready" })
37
+ /* @__PURE__ */ t(i, { disabled: o || !(e != null && e.trim()), status: o ? "streaming" : "ready" })
33
38
  ] })
34
39
  ] }) });
35
40
  }
36
41
  export {
37
- u as PromptComposer
42
+ g as PromptComposer
38
43
  };
39
44
  //# sourceMappingURL=PromptComposer.js.map