@bigbinary/neeto-assist-frontend 0.0.0-stage → 1.0.1

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 (65) hide show
  1. package/README.md +243 -2
  2. package/app/javascript/src/translations/ar.json +5 -0
  3. package/app/javascript/src/translations/bg.json +5 -0
  4. package/app/javascript/src/translations/ca.json +5 -0
  5. package/app/javascript/src/translations/cs.json +5 -0
  6. package/app/javascript/src/translations/da.json +5 -0
  7. package/app/javascript/src/translations/de.json +5 -0
  8. package/app/javascript/src/translations/en.json +75 -0
  9. package/app/javascript/src/translations/es-MX.json +5 -0
  10. package/app/javascript/src/translations/es.json +5 -0
  11. package/app/javascript/src/translations/et.json +5 -0
  12. package/app/javascript/src/translations/fi.json +5 -0
  13. package/app/javascript/src/translations/fil.json +5 -0
  14. package/app/javascript/src/translations/fr.json +5 -0
  15. package/app/javascript/src/translations/he.json +5 -0
  16. package/app/javascript/src/translations/hi.json +5 -0
  17. package/app/javascript/src/translations/hr.json +5 -0
  18. package/app/javascript/src/translations/hu.json +5 -0
  19. package/app/javascript/src/translations/id.json +5 -0
  20. package/app/javascript/src/translations/index.js +3 -0
  21. package/app/javascript/src/translations/it.json +5 -0
  22. package/app/javascript/src/translations/ja.json +5 -0
  23. package/app/javascript/src/translations/ko.json +5 -0
  24. package/app/javascript/src/translations/nl.json +5 -0
  25. package/app/javascript/src/translations/pl.json +5 -0
  26. package/app/javascript/src/translations/pt-BR.json +5 -0
  27. package/app/javascript/src/translations/pt.json +5 -0
  28. package/app/javascript/src/translations/ro.json +5 -0
  29. package/app/javascript/src/translations/ru.json +5 -0
  30. package/app/javascript/src/translations/sk.json +5 -0
  31. package/app/javascript/src/translations/sl.json +5 -0
  32. package/app/javascript/src/translations/sv.json +5 -0
  33. package/app/javascript/src/translations/th.json +5 -0
  34. package/app/javascript/src/translations/tr.json +5 -0
  35. package/app/javascript/src/translations/uk.json +5 -0
  36. package/app/javascript/src/translations/vi.json +5 -0
  37. package/app/javascript/src/translations/zh-CN.json +5 -0
  38. package/app/javascript/src/translations/zh-TW.json +5 -0
  39. package/dist/.ready +1 -0
  40. package/dist/NeetoAssistButton.js +98 -0
  41. package/dist/NeetoAssistButton.js.map +1 -0
  42. package/dist/NeetoAssistPane.js +975 -0
  43. package/dist/NeetoAssistPane.js.map +1 -0
  44. package/dist/cjs/NeetoAssistButton.js +100 -0
  45. package/dist/cjs/NeetoAssistButton.js.map +1 -0
  46. package/dist/cjs/NeetoAssistPane.js +977 -0
  47. package/dist/cjs/NeetoAssistPane.js.map +1 -0
  48. package/dist/cjs/index.js +30 -0
  49. package/dist/cjs/index.js.map +1 -0
  50. package/dist/cjs/useNeetoAssistStatus.js +18 -0
  51. package/dist/cjs/useNeetoAssistStatus.js.map +1 -0
  52. package/dist/index.js +22 -0
  53. package/dist/index.js.map +1 -0
  54. package/dist/neeto_assist-BbwXxKis.js +121 -0
  55. package/dist/neeto_assist-BbwXxKis.js.map +1 -0
  56. package/dist/neeto_assist-Ha049T0Q.js +102 -0
  57. package/dist/neeto_assist-Ha049T0Q.js.map +1 -0
  58. package/dist/useNeetoAssistStatus.js +16 -0
  59. package/dist/useNeetoAssistStatus.js.map +1 -0
  60. package/dist/useNeetoAssistStore-B5U7FFgQ.js +218 -0
  61. package/dist/useNeetoAssistStore-B5U7FFgQ.js.map +1 -0
  62. package/dist/useNeetoAssistStore-C4fEnA_y.js +232 -0
  63. package/dist/useNeetoAssistStore-C4fEnA_y.js.map +1 -0
  64. package/package.json +231 -4
  65. package/types.d.ts +53 -0
@@ -0,0 +1,975 @@
1
+ import { i as isWebUrl, e as errorMessageKey, b as useAskNeetoAssist, c as useUpdateFeedback, d as isPending, h as hasWrittenReply, s as skippedReasonMessageKey, f as isRateable, u as useNeetoAssistStore, a as useFetchRuns, l as latestDraftId, r as runsInConversationOrder, S as Sparkle } from './useNeetoAssistStore-B5U7FFgQ.js';
2
+ import { useState, useRef, Fragment, createElement, useEffect } from 'react';
3
+ import { Typography, Textarea, Spinner, typographyVariants, Button, Tooltip, Badge } from '@bigbinary/neeto-atoms';
4
+ import { isEmpty } from 'ramda';
5
+ import { e as SUGGESTION_KEYS, M as MAX_QUESTION_LENGTH, f as MAX_NOTE_LENGTH, g as RUN_TEST_ID, h as EXPANDED_PANE_WIDTH, C as COLLAPSED_PANE_WIDTH } from './neeto_assist-Ha049T0Q.js';
6
+ import { withT } from '@bigbinary/neeto-commons-frontend/v2/react-utils';
7
+ import { jsxs, jsx, Fragment as Fragment$1 } from 'react/jsx-runtime';
8
+ import { useTranslation } from 'react-i18next';
9
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
10
+ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
11
+ import classNames from 'classnames';
12
+ import { CircleArrowUp, ExternalLink, CornerDownLeft, Copy, ThumbsUp, ThumbsDown, Minimize2, Maximize2, X } from 'lucide-react';
13
+ import { isNotEmpty } from '@bigbinary/neeto-cist';
14
+ import { copyToClipboard } from '@bigbinary/neeto-commons-frontend/v2/utils';
15
+ import '@babel/runtime/helpers/objectWithoutProperties';
16
+ import '@tanstack/react-query';
17
+ import 'zustand';
18
+ import 'axios';
19
+
20
+ var HEADER_ICON_SIZE = 18;
21
+ var SEND_ICON_SIZE = 24;
22
+ var SCROLL_MARGIN = 8;
23
+
24
+ var CreditsBanner$1 = function CreditsBanner(_ref) {
25
+ var credits = _ref.credits,
26
+ t = _ref.t;
27
+ return /*#__PURE__*/jsxs("div", {
28
+ className: "border-border bg-muted space-y-1 border-t px-4 py-3",
29
+ "data-testid": "neeto-assist-credits-banner",
30
+ children: [/*#__PURE__*/jsx(Typography, {
31
+ variant: "body3",
32
+ children: t("neetoAssist.credits.exhausted")
33
+ }), isWebUrl(credits.buyUrl) ? /*#__PURE__*/jsx("a", {
34
+ className: "text-primary text-sm font-medium hover:underline",
35
+ "data-testid": "neeto-assist-buy-credits-link",
36
+ href: credits.buyUrl,
37
+ rel: "noreferrer",
38
+ target: "_blank",
39
+ children: t("neetoAssist.credits.buy")
40
+ }) : /*#__PURE__*/jsx(Typography, {
41
+ "data-testid": "neeto-assist-ask-admin",
42
+ variant: "body3",
43
+ children: t("neetoAssist.credits.askAdmin")
44
+ })]
45
+ });
46
+ };
47
+ var CreditsBanner = withT(CreditsBanner$1);
48
+
49
+ // crypto.randomUUID exists only on secure pages (HTTPS or localhost). A host in
50
+ // development, such as http://spinkart.lvh.me, gets the same shape of id from
51
+ // crypto.getRandomValues, which every page has.
52
+ var newRequestId = function newRequestId() {
53
+ if (globalThis.crypto.randomUUID) return globalThis.crypto.randomUUID();
54
+ var hex = Array.from(globalThis.crypto.getRandomValues(new Uint8Array(16)), function (_byte) {
55
+ return _byte.toString(16).padStart(2, "0");
56
+ }).join("");
57
+ return [8, 12, 16, 20, 32].map(function (end, index, ends) {
58
+ var _ends;
59
+ return hex.slice((_ends = ends[index - 1]) !== null && _ends !== void 0 ? _ends : 0, end);
60
+ }).join("-");
61
+ };
62
+
63
+ var ErrorMessage$1 = function ErrorMessage(_ref) {
64
+ var error = _ref.error,
65
+ t = _ref.t;
66
+ return /*#__PURE__*/jsx(Typography, {
67
+ color: "destructive",
68
+ "data-testid": "neeto-assist-error",
69
+ variant: "body3",
70
+ children: t(errorMessageKey(error))
71
+ });
72
+ };
73
+ var ErrorMessage = withT(ErrorMessage$1);
74
+
75
+ var EmptyState = function EmptyState(_ref) {
76
+ var conversationId = _ref.conversationId;
77
+ var _useTranslation = useTranslation(),
78
+ t = _useTranslation.t;
79
+ var _useAskNeetoAssist = useAskNeetoAssist(conversationId),
80
+ ask = _useAskNeetoAssist.mutate,
81
+ isPending = _useAskNeetoAssist.isPending,
82
+ error = _useAskNeetoAssist.error;
83
+ return /*#__PURE__*/jsxs("div", {
84
+ className: "flex flex-col gap-4 px-2 pt-4",
85
+ "data-testid": "neeto-assist-empty-state",
86
+ children: [/*#__PURE__*/jsxs("div", {
87
+ children: [/*#__PURE__*/jsx(Typography, {
88
+ variant: "h4",
89
+ children: t("neetoAssist.intro.title")
90
+ }), /*#__PURE__*/jsx(Typography, {
91
+ className: "mt-1",
92
+ color: "muted",
93
+ variant: "body3",
94
+ children: t("neetoAssist.intro.description")
95
+ })]
96
+ }), /*#__PURE__*/jsx("ul", {
97
+ className: "flex flex-col gap-1",
98
+ children: SUGGESTION_KEYS.map(function (key) {
99
+ return /*#__PURE__*/jsx("li", {
100
+ children: /*#__PURE__*/jsxs("button", {
101
+ className: "text-foreground hover:bg-muted -mx-2 flex w-full cursor-pointer items-start gap-2 rounded px-2 py-1.5 text-start text-sm leading-snug disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent",
102
+ "data-testid": "neeto-assist-suggestion",
103
+ disabled: isPending,
104
+ type: "button",
105
+ onClick: function onClick() {
106
+ return ask({
107
+ conversationId: conversationId,
108
+ question: t(key),
109
+ requestId: newRequestId()
110
+ });
111
+ },
112
+ children: [/*#__PURE__*/jsx("span", {
113
+ className: "text-muted-foreground",
114
+ children: "\u203A"
115
+ }), /*#__PURE__*/jsx("span", {
116
+ children: t(key)
117
+ })]
118
+ })
119
+ }, key);
120
+ })
121
+ }), error && /*#__PURE__*/jsx(ErrorMessage, {
122
+ error: error
123
+ })]
124
+ });
125
+ };
126
+
127
+ 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; }
128
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).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; }
129
+ var MessageInput = function MessageInput(_ref) {
130
+ var conversationId = _ref.conversationId;
131
+ var _useTranslation = useTranslation(),
132
+ t = _useTranslation.t;
133
+ var _useState = useState(""),
134
+ _useState2 = _slicedToArray(_useState, 2),
135
+ question = _useState2[0],
136
+ setQuestion = _useState2[1];
137
+ var requestRef = useRef(null);
138
+ var _useAskNeetoAssist = useAskNeetoAssist(conversationId),
139
+ ask = _useAskNeetoAssist.mutate,
140
+ isPending = _useAskNeetoAssist.isPending,
141
+ error = _useAskNeetoAssist.error;
142
+ var trimmedQuestion = question.trim();
143
+ var canSend = !!trimmedQuestion && !isPending;
144
+ var handleSubmit = function handleSubmit(event) {
145
+ var _requestRef$current;
146
+ event.preventDefault();
147
+ if (!canSend) return;
148
+
149
+ // A failed request may already have reached NeetoAssist. Retrying the same
150
+ // question keeps its identity so it cannot create a second run.
151
+ if (((_requestRef$current = requestRef.current) === null || _requestRef$current === void 0 ? void 0 : _requestRef$current.question) !== trimmedQuestion) {
152
+ requestRef.current = {
153
+ question: trimmedQuestion,
154
+ requestId: newRequestId()
155
+ };
156
+ }
157
+ ask(_objectSpread({
158
+ conversationId: conversationId
159
+ }, requestRef.current), {
160
+ onSuccess: function onSuccess() {
161
+ requestRef.current = null;
162
+ setQuestion("");
163
+ }
164
+ });
165
+ };
166
+
167
+ // Enter also confirms a word in an input method for languages such as Japanese,
168
+ // and that must not send the question.
169
+ var handleKeyDown = function handleKeyDown(event) {
170
+ var _event$nativeEvent;
171
+ var isComposing = (_event$nativeEvent = event.nativeEvent) === null || _event$nativeEvent === void 0 ? void 0 : _event$nativeEvent.isComposing;
172
+ if (event.key === "Enter" && !event.shiftKey && !isComposing) {
173
+ handleSubmit(event);
174
+ }
175
+ };
176
+ return /*#__PURE__*/jsxs("form", {
177
+ className: "border-border flex w-full flex-col gap-2 border-t px-4 py-3",
178
+ onSubmit: handleSubmit,
179
+ children: [/*#__PURE__*/jsxs("div", {
180
+ className: "relative",
181
+ children: [/*#__PURE__*/jsx(Textarea, {
182
+ "aria-label": t("neetoAssist.ask.placeholder"),
183
+ className: "w-full pe-12",
184
+ dataTestId: "neeto-assist-ask",
185
+ maxLength: MAX_QUESTION_LENGTH,
186
+ placeholder: t("neetoAssist.ask.placeholder"),
187
+ readOnly: isPending,
188
+ rows: 3,
189
+ value: question,
190
+ onChange: function onChange(event) {
191
+ return setQuestion(event.target.value);
192
+ },
193
+ onKeyDown: handleKeyDown
194
+ }), /*#__PURE__*/jsx("button", {
195
+ "aria-label": t("neetoAssist.ask.submit"),
196
+ "data-testid": "neeto-assist-ask-button",
197
+ disabled: !canSend,
198
+ type: "submit",
199
+ className: classNames("absolute end-2 bottom-2 flex h-7 w-7 items-center justify-center rounded-full transition-opacity", {
200
+ "text-primary hover:opacity-80": canSend,
201
+ "text-muted-foreground cursor-not-allowed opacity-60": !canSend
202
+ }),
203
+ children: isPending ? /*#__PURE__*/jsx(Spinner, {
204
+ size: "sm"
205
+ }) : /*#__PURE__*/jsx(CircleArrowUp, {
206
+ size: SEND_ICON_SIZE
207
+ })
208
+ })]
209
+ }), error && /*#__PURE__*/jsx(ErrorMessage, {
210
+ error: error
211
+ }), /*#__PURE__*/jsxs("div", {
212
+ className: "flex items-center justify-between gap-3",
213
+ children: [/*#__PURE__*/jsx(Typography, {
214
+ color: "muted",
215
+ variant: "body3",
216
+ children: t("neetoAssist.shadowNote")
217
+ }), /*#__PURE__*/jsxs("span", {
218
+ className: "text-muted-foreground shrink-0 text-xs",
219
+ children: [question.length, "/", MAX_QUESTION_LENGTH]
220
+ })]
221
+ })]
222
+ });
223
+ };
224
+
225
+ var Sources = function Sources(_ref) {
226
+ var _ref$sources = _ref.sources,
227
+ sources = _ref$sources === void 0 ? [] : _ref$sources;
228
+ var _useTranslation = useTranslation(),
229
+ t = _useTranslation.t;
230
+ var links = sources.filter(function (_ref2) {
231
+ var url = _ref2.url;
232
+ return isWebUrl(url);
233
+ });
234
+ if (!isNotEmpty(links)) return null;
235
+ return /*#__PURE__*/jsxs("div", {
236
+ className: "space-y-1",
237
+ children: [/*#__PURE__*/jsx(Typography, {
238
+ color: "muted",
239
+ variant: "body3",
240
+ weight: "medium",
241
+ children: t("neetoAssist.run.sources")
242
+ }), /*#__PURE__*/jsx("ul", {
243
+ className: "space-y-1",
244
+ children: links.map(function (_ref3) {
245
+ var title = _ref3.title,
246
+ url = _ref3.url;
247
+ return /*#__PURE__*/jsx("li", {
248
+ children: /*#__PURE__*/jsxs("a", {
249
+ className: "text-primary inline-flex items-center gap-1 break-words text-sm hover:underline",
250
+ href: url,
251
+ rel: "noreferrer",
252
+ target: "_blank",
253
+ children: [/*#__PURE__*/jsx(ExternalLink, {
254
+ className: "shrink-0",
255
+ size: 12
256
+ }), title || url]
257
+ })
258
+ }, url);
259
+ })
260
+ })]
261
+ });
262
+ };
263
+
264
+ var BLOCK_TYPES = {
265
+ HEADING: "heading",
266
+ PARAGRAPH: "paragraph",
267
+ ORDERED_LIST: "orderedList",
268
+ BULLET_LIST: "bulletList"
269
+ };
270
+ var HEADING_PATTERN = /^\s{0,3}#{1,6}\s+(.*)$/;
271
+ var ORDERED_ITEM_PATTERN = /^\s*\d+[.)]\s+(.*)$/;
272
+ var BULLET_ITEM_PATTERN = /^\s*[-*•]\s+(.*)$/;
273
+ var BOLD_PATTERN = /\*\*(.+?)\*\*/;
274
+ var UNSAFE_HTML_CHARACTERS = /[&<>"']/g;
275
+
276
+ // NeetoAssist writes replies and notes in Arion's light markdown: paragraphs
277
+ // split by blank lines, **bold**, numbered and bulleted lists, and ## headings.
278
+ // Model output can carry markup a visitor slipped into the conversation, so
279
+ // text is only ever escaped into HTML or rendered as React text, never trusted
280
+ // as markup.
281
+ var escapeHtmlCharacter = function escapeHtmlCharacter(character) {
282
+ switch (character) {
283
+ case "&":
284
+ return "&amp;";
285
+ case "<":
286
+ return "&lt;";
287
+ case ">":
288
+ return "&gt;";
289
+ case '"':
290
+ return "&quot;";
291
+ default:
292
+ return "&#39;";
293
+ }
294
+ };
295
+ var escapeHtml = function escapeHtml(text) {
296
+ return text.replace(UNSAFE_HTML_CHARACTERS, escapeHtmlCharacter);
297
+ };
298
+
299
+ // "a **b** c" becomes a plain "a ", a bold "b" and a plain " c". An unclosed
300
+ // "**" stays as it is.
301
+ var parseInline = function parseInline(line) {
302
+ return line.split(BOLD_PATTERN).flatMap(function (text, index) {
303
+ return text === "" ? [] : [{
304
+ text: text,
305
+ bold: index % 2 === 1
306
+ }];
307
+ });
308
+ };
309
+ var matchListItem = function matchListItem(line) {
310
+ var orderedItem = line.match(ORDERED_ITEM_PATTERN);
311
+ if (orderedItem) {
312
+ return {
313
+ type: BLOCK_TYPES.ORDERED_LIST,
314
+ text: orderedItem[1]
315
+ };
316
+ }
317
+ var bulletItem = line.match(BULLET_ITEM_PATTERN);
318
+ return bulletItem && {
319
+ type: BLOCK_TYPES.BULLET_LIST,
320
+ text: bulletItem[1]
321
+ };
322
+ };
323
+
324
+ // Blocks hold lines of inline segments: a paragraph's lines, a heading's one
325
+ // line, or each list item's lines. A list carries on across blank lines, since
326
+ // models often leave one between items.
327
+ var parseLightMarkdown = function parseLightMarkdown() {
328
+ var text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
329
+ var blocks = [];
330
+ var openBlock = null;
331
+ var afterBlankLine = false;
332
+ var startBlock = function startBlock(block) {
333
+ blocks.push(block);
334
+ openBlock = block;
335
+ };
336
+ String(text !== null && text !== void 0 ? text : "").replace(/\r\n?/g, "\n").split("\n").forEach(function (line) {
337
+ var _openBlock2;
338
+ if (line.trim() === "") {
339
+ afterBlankLine = true;
340
+ return;
341
+ }
342
+ var heading = line.match(HEADING_PATTERN);
343
+ var listItem = !heading && matchListItem(line);
344
+ var isList = openBlock && openBlock.type !== BLOCK_TYPES.PARAGRAPH;
345
+ if (heading) {
346
+ blocks.push({
347
+ type: BLOCK_TYPES.HEADING,
348
+ lines: [parseInline(heading[1].trim())]
349
+ });
350
+ openBlock = null;
351
+ } else if (listItem) {
352
+ var _openBlock;
353
+ if (((_openBlock = openBlock) === null || _openBlock === void 0 ? void 0 : _openBlock.type) !== listItem.type) {
354
+ startBlock({
355
+ type: listItem.type,
356
+ items: []
357
+ });
358
+ }
359
+ openBlock.items.push([parseInline(listItem.text.trim())]);
360
+ } else if (isList && !afterBlankLine && /^\s/.test(line)) {
361
+ openBlock.items.at(-1).push(parseInline(line.trim()));
362
+ } else if (((_openBlock2 = openBlock) === null || _openBlock2 === void 0 ? void 0 : _openBlock2.type) === BLOCK_TYPES.PARAGRAPH && !afterBlankLine) {
363
+ openBlock.lines.push(parseInline(line.trim()));
364
+ } else {
365
+ startBlock({
366
+ type: BLOCK_TYPES.PARAGRAPH,
367
+ lines: [parseInline(line.trim())]
368
+ });
369
+ }
370
+ afterBlankLine = false;
371
+ });
372
+ return blocks;
373
+ };
374
+ var segmentsToHtml = function segmentsToHtml(segments) {
375
+ return segments.map(function (_ref) {
376
+ var text = _ref.text,
377
+ bold = _ref.bold;
378
+ return bold ? "<strong>".concat(escapeHtml(text), "</strong>") : escapeHtml(text);
379
+ }).join("");
380
+ };
381
+ var linesToHtml = function linesToHtml(lines) {
382
+ return lines.map(segmentsToHtml).join("<br>");
383
+ };
384
+ var listToHtml = function listToHtml(tag, items) {
385
+ return "<".concat(tag, ">").concat(items.map(function (lines) {
386
+ return "<li>".concat(linesToHtml(lines), "</li>");
387
+ }).join(""), "</").concat(tag, ">");
388
+ };
389
+ var blockToHtml = function blockToHtml(block) {
390
+ switch (block.type) {
391
+ case BLOCK_TYPES.HEADING:
392
+ return "<h2>".concat(linesToHtml(block.lines), "</h2>");
393
+ case BLOCK_TYPES.ORDERED_LIST:
394
+ return listToHtml("ol", block.items);
395
+ case BLOCK_TYPES.BULLET_LIST:
396
+ return listToHtml("ul", block.items);
397
+ default:
398
+ return "<p>".concat(linesToHtml(block.lines), "</p>");
399
+ }
400
+ };
401
+
402
+ // HTML for a rich-text composer, made only of p, br, strong, ol, ul, li and h2
403
+ // around escaped text.
404
+ var lightMarkdownToHtml = function lightMarkdownToHtml(text) {
405
+ return parseLightMarkdown(text).map(blockToHtml).join("");
406
+ };
407
+
408
+ var Lines = function Lines(_ref) {
409
+ var lines = _ref.lines;
410
+ return lines.map(function (segments, lineIndex) {
411
+ return /*#__PURE__*/jsxs(Fragment, {
412
+ children: [lineIndex > 0 && /*#__PURE__*/jsx("br", {}), segments.map(function (_ref2, segmentIndex) {
413
+ var text = _ref2.text,
414
+ bold = _ref2.bold;
415
+ return bold ? /*#__PURE__*/jsx("strong", {
416
+ className: "font-semibold",
417
+ children: text
418
+ }, segmentIndex) : /*#__PURE__*/jsx(Fragment, {
419
+ children: text
420
+ }, segmentIndex);
421
+ })]
422
+ }, lineIndex);
423
+ });
424
+ };
425
+
426
+ var Block = function Block(_ref) {
427
+ var block = _ref.block;
428
+ if (block.type === BLOCK_TYPES.HEADING) {
429
+ return /*#__PURE__*/jsx("h2", {
430
+ className: "font-semibold",
431
+ children: /*#__PURE__*/jsx(Lines, {
432
+ lines: block.lines
433
+ })
434
+ });
435
+ }
436
+ if (block.type === BLOCK_TYPES.PARAGRAPH) {
437
+ return /*#__PURE__*/jsx("p", {
438
+ children: /*#__PURE__*/jsx(Lines, {
439
+ lines: block.lines
440
+ })
441
+ });
442
+ }
443
+ var isOrdered = block.type === BLOCK_TYPES.ORDERED_LIST;
444
+ var List = isOrdered ? "ol" : "ul";
445
+ return /*#__PURE__*/jsx(List, {
446
+ className: classNames({
447
+ "list-decimal space-y-1 pl-5": isOrdered,
448
+ "list-disc space-y-1 pl-5": !isOrdered
449
+ }),
450
+ children: block.items.map(function (lines, index) {
451
+ return /*#__PURE__*/jsx("li", {
452
+ children: /*#__PURE__*/jsx(Lines, {
453
+ lines: lines
454
+ })
455
+ }, index);
456
+ })
457
+ });
458
+ };
459
+
460
+ var FormattedText = function FormattedText(_ref) {
461
+ var className = _ref.className,
462
+ text = _ref.text;
463
+ return /*#__PURE__*/jsx("div", {
464
+ className: classNames(typographyVariants({
465
+ variant: "body2"
466
+ }), "space-y-2 break-words", className),
467
+ children: parseLightMarkdown(text).map(function (block, index) {
468
+ return /*#__PURE__*/createElement(Block, {
469
+ block: block,
470
+ key: index
471
+ });
472
+ })
473
+ });
474
+ };
475
+
476
+ var SuggestedReply$1 = function SuggestedReply(_ref) {
477
+ var onUseReply = _ref.onUseReply,
478
+ t = _ref.t,
479
+ text = _ref.text;
480
+ return /*#__PURE__*/jsxs("div", {
481
+ className: "border-border space-y-2 rounded-lg border p-3",
482
+ children: [/*#__PURE__*/jsx(Typography, {
483
+ color: "muted",
484
+ variant: "body3",
485
+ weight: "medium",
486
+ children: t("neetoAssist.run.suggestedReply")
487
+ }), /*#__PURE__*/jsx(FormattedText, {
488
+ text: text
489
+ }), /*#__PURE__*/jsxs("div", {
490
+ className: "flex flex-wrap gap-2",
491
+ children: [onUseReply && /*#__PURE__*/jsx(Button, {
492
+ "data-testid": "neeto-assist-use-reply-button",
493
+ icon: CornerDownLeft,
494
+ label: t("neetoAssist.run.useReply"),
495
+ size: "sm",
496
+ onClick: function onClick() {
497
+ return onUseReply(text, lightMarkdownToHtml(text));
498
+ }
499
+ }), /*#__PURE__*/jsx(Button, {
500
+ "data-testid": "neeto-assist-copy-reply-button",
501
+ icon: Copy,
502
+ label: t("neetoAssist.run.copy"),
503
+ size: "sm",
504
+ variant: "outline",
505
+ onClick: function onClick() {
506
+ return copyToClipboard(text, {
507
+ message: t("neetoAssist.run.copied")
508
+ });
509
+ }
510
+ })]
511
+ })]
512
+ });
513
+ };
514
+ var SuggestedReply = withT(SuggestedReply$1);
515
+
516
+ var Answer = function Answer(_ref) {
517
+ var onUseReply = _ref.onUseReply,
518
+ _ref$run = _ref.run,
519
+ kind = _ref$run.kind,
520
+ outcome = _ref$run.outcome,
521
+ answer = _ref$run.answer,
522
+ suggestedReply = _ref$run.suggestedReply,
523
+ needsHumanAction = _ref$run.needsHumanAction,
524
+ sources = _ref$run.sources;
525
+ var _useTranslation = useTranslation(),
526
+ t = _useTranslation.t;
527
+ if (outcome === "no_answer") {
528
+ return /*#__PURE__*/jsxs("div", {
529
+ className: "space-y-1",
530
+ children: [/*#__PURE__*/jsx(Typography, {
531
+ variant: "body2",
532
+ weight: "medium",
533
+ children: t("neetoAssist.run.noAnswer")
534
+ }), answer && /*#__PURE__*/jsx(FormattedText, {
535
+ className: "text-muted-foreground",
536
+ text: answer
537
+ })]
538
+ });
539
+ }
540
+ return /*#__PURE__*/jsxs(Fragment$1, {
541
+ children: [kind === "ask" && answer && /*#__PURE__*/jsx(FormattedText, {
542
+ text: answer
543
+ }), suggestedReply && /*#__PURE__*/jsx(SuggestedReply, {
544
+ onUseReply: onUseReply,
545
+ text: suggestedReply
546
+ }), needsHumanAction && /*#__PURE__*/jsx(Typography, {
547
+ "data-testid": "neeto-assist-follow-up-note",
548
+ variant: "body3",
549
+ weight: "medium",
550
+ children: t("neetoAssist.run.needsFollowUp")
551
+ }), /*#__PURE__*/jsx(Sources, {
552
+ sources: sources
553
+ })]
554
+ });
555
+ };
556
+
557
+ var Feedback = function Feedback(_ref) {
558
+ var conversationId = _ref.conversationId,
559
+ _ref$run = _ref.run,
560
+ runId = _ref$run.id,
561
+ _ref$run$feedback = _ref$run.feedback,
562
+ feedback = _ref$run$feedback === void 0 ? [] : _ref$run$feedback;
563
+ var _useTranslation = useTranslation(),
564
+ t = _useTranslation.t;
565
+ var _useState = useState(null),
566
+ _useState2 = _slicedToArray(_useState, 2),
567
+ pendingRating = _useState2[0],
568
+ setPendingRating = _useState2[1];
569
+ var _useState3 = useState(false),
570
+ _useState4 = _slicedToArray(_useState3, 2),
571
+ isEditingNote = _useState4[0],
572
+ setIsEditingNote = _useState4[1];
573
+ var _useState5 = useState(""),
574
+ _useState6 = _slicedToArray(_useState5, 2),
575
+ note = _useState6[0],
576
+ setNote = _useState6[1];
577
+ var _useUpdateFeedback = useUpdateFeedback(conversationId),
578
+ updateFeedback = _useUpdateFeedback.mutate,
579
+ isPending = _useUpdateFeedback.isPending,
580
+ error = _useUpdateFeedback.error;
581
+ var ownFeedback = feedback.find(function (_ref2) {
582
+ var _globalProps$user;
583
+ var givenBy = _ref2.givenBy;
584
+ return (givenBy === null || givenBy === void 0 ? void 0 : givenBy.id) === ((_globalProps$user = globalProps.user) === null || _globalProps$user === void 0 ? void 0 : _globalProps$user.id);
585
+ });
586
+ var shownRating = pendingRating !== null && pendingRating !== void 0 ? pendingRating : ownFeedback === null || ownFeedback === void 0 ? void 0 : ownFeedback.rating;
587
+
588
+ // The clicked rating shows until NeetoAssist's own copy of it arrives.
589
+ useEffect(function () {
590
+ if (pendingRating && (ownFeedback === null || ownFeedback === void 0 ? void 0 : ownFeedback.rating) === pendingRating) {
591
+ setPendingRating(null);
592
+ }
593
+ }, [ownFeedback === null || ownFeedback === void 0 ? void 0 : ownFeedback.rating, pendingRating]);
594
+
595
+ // A click on a thumb records the rating at once, so a rep who rates and
596
+ // moves on still leaves it. The note is an optional follow-up.
597
+ var rate = function rate(value) {
598
+ var _ownFeedback$note;
599
+ var savedNote = (_ownFeedback$note = ownFeedback === null || ownFeedback === void 0 ? void 0 : ownFeedback.note) !== null && _ownFeedback$note !== void 0 ? _ownFeedback$note : "";
600
+ setPendingRating(value);
601
+ setNote(savedNote);
602
+ setIsEditingNote(true);
603
+ updateFeedback({
604
+ conversationId: conversationId,
605
+ runId: runId,
606
+ rating: value,
607
+ note: savedNote
608
+ }, {
609
+ onError: function onError() {
610
+ return setPendingRating(null);
611
+ }
612
+ });
613
+ };
614
+ var handleSubmit = function handleSubmit(event) {
615
+ event.preventDefault();
616
+ updateFeedback({
617
+ conversationId: conversationId,
618
+ runId: runId,
619
+ rating: shownRating,
620
+ note: note.trim()
621
+ }, {
622
+ onSuccess: function onSuccess() {
623
+ return setIsEditingNote(false);
624
+ }
625
+ });
626
+ };
627
+ return /*#__PURE__*/jsxs("div", {
628
+ className: "space-y-2",
629
+ children: [/*#__PURE__*/jsxs("div", {
630
+ className: "flex items-center gap-1",
631
+ children: [/*#__PURE__*/jsx(Button, {
632
+ "aria-label": t("neetoAssist.feedback.helpful"),
633
+ "data-testid": "neeto-assist-thumbs-up-button",
634
+ disabled: isPending,
635
+ icon: ThumbsUp,
636
+ size: "icon-sm",
637
+ tooltipProps: {
638
+ content: t("neetoAssist.feedback.helpful")
639
+ },
640
+ variant: shownRating === "up" ? "secondary" : "ghost",
641
+ onClick: function onClick() {
642
+ return rate("up");
643
+ }
644
+ }), /*#__PURE__*/jsx(Button, {
645
+ "aria-label": t("neetoAssist.feedback.notHelpful"),
646
+ "data-testid": "neeto-assist-thumbs-down-button",
647
+ disabled: isPending,
648
+ icon: ThumbsDown,
649
+ size: "icon-sm",
650
+ tooltipProps: {
651
+ content: t("neetoAssist.feedback.notHelpful")
652
+ },
653
+ variant: shownRating === "down" ? "secondary" : "ghost",
654
+ onClick: function onClick() {
655
+ return rate("down");
656
+ }
657
+ })]
658
+ }), error && /*#__PURE__*/jsx(ErrorMessage, {
659
+ error: error
660
+ }), isEditingNote && shownRating && /*#__PURE__*/jsxs("form", {
661
+ className: "space-y-2",
662
+ onSubmit: handleSubmit,
663
+ children: [/*#__PURE__*/jsx(Textarea, {
664
+ "aria-label": t("neetoAssist.feedback.notePlaceholder"),
665
+ dataTestId: "neeto-assist-feedback-note",
666
+ maxLength: MAX_NOTE_LENGTH,
667
+ placeholder: t("neetoAssist.feedback.notePlaceholder"),
668
+ size: "small",
669
+ value: note,
670
+ onChange: function onChange(event) {
671
+ return setNote(event.target.value);
672
+ }
673
+ }), /*#__PURE__*/jsxs("div", {
674
+ className: "flex gap-2",
675
+ children: [/*#__PURE__*/jsx(Button, {
676
+ "data-testid": "neeto-assist-save-feedback-button",
677
+ label: t("neetoAssist.feedback.save"),
678
+ loading: isPending,
679
+ size: "sm",
680
+ type: "submit"
681
+ }), /*#__PURE__*/jsx(Button, {
682
+ label: t("neetoAssist.feedback.close"),
683
+ size: "sm",
684
+ variant: "ghost",
685
+ onClick: function onClick() {
686
+ return setIsEditingNote(false);
687
+ }
688
+ })]
689
+ })]
690
+ }), feedback.map(function (_ref3) {
691
+ var givenBy = _ref3.givenBy,
692
+ givenNote = _ref3.note,
693
+ givenRating = _ref3.rating;
694
+ return /*#__PURE__*/jsxs(Typography, {
695
+ className: "break-words",
696
+ color: "muted",
697
+ variant: "body3",
698
+ children: [givenRating === "up" ? t("neetoAssist.feedback.ratedHelpful", {
699
+ name: givenBy === null || givenBy === void 0 ? void 0 : givenBy.name
700
+ }) : t("neetoAssist.feedback.ratedNotHelpful", {
701
+ name: givenBy === null || givenBy === void 0 ? void 0 : givenBy.name
702
+ }), givenNote && ": ".concat(givenNote)]
703
+ }, givenBy === null || givenBy === void 0 ? void 0 : givenBy.id);
704
+ })]
705
+ });
706
+ };
707
+
708
+ var Question = function Question(_ref) {
709
+ var _ref$run = _ref.run,
710
+ kind = _ref$run.kind,
711
+ question = _ref$run.question,
712
+ requestedBy = _ref$run.requestedBy;
713
+ var _useTranslation = useTranslation(),
714
+ t = _useTranslation.t;
715
+ if (kind === "ask") {
716
+ var _globalProps$user;
717
+ var isOwnQuestion = (requestedBy === null || requestedBy === void 0 ? void 0 : requestedBy.id) === ((_globalProps$user = globalProps.user) === null || _globalProps$user === void 0 ? void 0 : _globalProps$user.id);
718
+ return /*#__PURE__*/jsxs("div", {
719
+ className: "flex flex-col items-end gap-1",
720
+ children: [!isOwnQuestion && /*#__PURE__*/jsx(Typography, {
721
+ color: "muted",
722
+ variant: "body3",
723
+ children: t("neetoAssist.run.repAsked", {
724
+ name: requestedBy === null || requestedBy === void 0 ? void 0 : requestedBy.name
725
+ })
726
+ }), /*#__PURE__*/jsx("div", {
727
+ className: "bg-muted max-w-[80%] rounded-lg px-3 py-2 break-words",
728
+ children: /*#__PURE__*/jsx(Typography, {
729
+ className: "whitespace-pre-wrap",
730
+ variant: "body2",
731
+ children: question
732
+ })
733
+ })]
734
+ });
735
+ }
736
+ return /*#__PURE__*/jsxs("div", {
737
+ className: "border-border space-y-1 border-s-2 ps-3",
738
+ children: [/*#__PURE__*/jsx(Typography, {
739
+ color: "muted",
740
+ variant: "body3",
741
+ weight: "medium",
742
+ children: t("neetoAssist.run.customerWrote")
743
+ }), question && /*#__PURE__*/jsx(Typography, {
744
+ className: "whitespace-pre-wrap break-words",
745
+ variant: "body2",
746
+ children: question
747
+ })]
748
+ });
749
+ };
750
+
751
+ var Run$1 = function Run(_ref) {
752
+ var conversationId = _ref.conversationId,
753
+ onUseReply = _ref.onUseReply,
754
+ run = _ref.run,
755
+ t = _ref.t;
756
+ return /*#__PURE__*/jsxs("div", {
757
+ className: "flex flex-col gap-3",
758
+ "data-testid": RUN_TEST_ID,
759
+ children: [/*#__PURE__*/jsx(Question, {
760
+ run: run
761
+ }), isPending(run) && /*#__PURE__*/jsxs("div", {
762
+ className: "flex items-center gap-1.5",
763
+ children: [/*#__PURE__*/jsx(Spinner, {
764
+ size: "sm"
765
+ }), /*#__PURE__*/jsx(Typography, {
766
+ color: "muted",
767
+ variant: "body3",
768
+ children: t("neetoAssist.run.pending")
769
+ })]
770
+ }), hasWrittenReply(run) && /*#__PURE__*/jsx(Answer, {
771
+ onUseReply: onUseReply,
772
+ run: run
773
+ }), run.status === "skipped" && !hasWrittenReply(run) && /*#__PURE__*/jsx(Typography, {
774
+ color: "muted",
775
+ variant: "body2",
776
+ children: t(skippedReasonMessageKey(run.skippedReason))
777
+ }), run.status === "failed" && /*#__PURE__*/jsx(Typography, {
778
+ color: "muted",
779
+ variant: "body2",
780
+ children: t("neetoAssist.run.failed")
781
+ }), isRateable(run) && /*#__PURE__*/jsx(Feedback, {
782
+ conversationId: conversationId,
783
+ run: run
784
+ })]
785
+ });
786
+ };
787
+ var Run = withT(Run$1);
788
+
789
+ var Conversation = function Conversation(_ref) {
790
+ var conversationId = _ref.conversationId,
791
+ isVisible = _ref.isVisible,
792
+ onUseReply = _ref.onUseReply;
793
+ var listRef = useRef(null);
794
+ var markDraftSeen = useNeetoAssistStore(function (state) {
795
+ return state.markDraftSeen;
796
+ });
797
+ var _useFetchRuns = useFetchRuns(conversationId),
798
+ _useFetchRuns$data = _useFetchRuns.data,
799
+ _useFetchRuns$data2 = _useFetchRuns$data === void 0 ? {} : _useFetchRuns$data,
800
+ _useFetchRuns$data2$r = _useFetchRuns$data2.runs,
801
+ runs = _useFetchRuns$data2$r === void 0 ? [] : _useFetchRuns$data2$r,
802
+ _useFetchRuns$data2$c = _useFetchRuns$data2.credits,
803
+ credits = _useFetchRuns$data2$c === void 0 ? null : _useFetchRuns$data2$c,
804
+ error = _useFetchRuns.error,
805
+ isLoading = _useFetchRuns.isLoading;
806
+ var newestRun = runs[0];
807
+ var draftId = latestDraftId(runs);
808
+
809
+ // The newest run starts at the top of the window, so a long reply is read
810
+ // from its first line.
811
+ useEffect(function () {
812
+ var list = listRef.current;
813
+ var renderedRuns = list === null || list === void 0 ? void 0 : list.querySelectorAll("[data-testid=\"".concat(RUN_TEST_ID, "\"]"));
814
+ var newest = renderedRuns === null || renderedRuns === void 0 ? void 0 : renderedRuns[renderedRuns.length - 1];
815
+ if (!newest) return;
816
+ list.scrollTo({
817
+ top: newest.offsetTop - list.offsetTop - SCROLL_MARGIN
818
+ });
819
+ }, [newestRun === null || newestRun === void 0 ? void 0 : newestRun.id, newestRun === null || newestRun === void 0 ? void 0 : newestRun.status]);
820
+ useEffect(function () {
821
+ if (isVisible && draftId) markDraftSeen(conversationId, draftId);
822
+ }, [conversationId, draftId, isVisible, markDraftSeen]);
823
+ return /*#__PURE__*/jsxs("div", {
824
+ className: "flex min-h-0 w-full flex-1 flex-col",
825
+ children: [/*#__PURE__*/jsxs("div", {
826
+ className: "flex w-full flex-1 flex-col gap-6 overflow-y-auto px-4 py-4",
827
+ ref: listRef,
828
+ children: [isLoading && /*#__PURE__*/jsx(Spinner, {}), !isLoading && !error && isEmpty(runs) && /*#__PURE__*/jsx(EmptyState, {
829
+ conversationId: conversationId
830
+ }), runsInConversationOrder(runs).map(function (run) {
831
+ return /*#__PURE__*/createElement(Run, {
832
+ conversationId: conversationId,
833
+ onUseReply: onUseReply,
834
+ run: run,
835
+ key: run.id
836
+ });
837
+ }), error && /*#__PURE__*/jsx(ErrorMessage, {
838
+ error: error
839
+ })]
840
+ }), credits !== null && credits !== void 0 && credits.exhausted ? /*#__PURE__*/jsx(CreditsBanner, {
841
+ credits: credits
842
+ }) : /*#__PURE__*/jsx(MessageInput, {
843
+ conversationId: conversationId
844
+ })]
845
+ });
846
+ };
847
+
848
+ var Header$1 = function Header(_ref) {
849
+ var isExpanded = _ref.isExpanded,
850
+ onClose = _ref.onClose,
851
+ onToggleExpand = _ref.onToggleExpand,
852
+ t = _ref.t;
853
+ return /*#__PURE__*/jsxs("div", {
854
+ className: "border-border flex items-center justify-between border-b px-4 py-3",
855
+ children: [/*#__PURE__*/jsxs("div", {
856
+ className: "flex items-center gap-2",
857
+ children: [/*#__PURE__*/jsx(Sparkle, {
858
+ className: "text-purple-600",
859
+ size: HEADER_ICON_SIZE
860
+ }), /*#__PURE__*/jsx("span", {
861
+ className: "font-semibold",
862
+ children: t("neetoAssist.title")
863
+ }), /*#__PURE__*/jsx(Tooltip, {
864
+ content: t("neetoAssist.betaNote"),
865
+ position: "bottom",
866
+ children: /*#__PURE__*/jsx("span", {
867
+ children: /*#__PURE__*/jsx(Badge, {
868
+ label: t("neetoAssist.beta"),
869
+ size: "sm",
870
+ variant: "secondary"
871
+ })
872
+ })
873
+ })]
874
+ }), /*#__PURE__*/jsxs("div", {
875
+ className: "text-muted-foreground flex items-center gap-1",
876
+ children: [/*#__PURE__*/jsx("button", {
877
+ className: "hover:bg-muted rounded p-1",
878
+ "data-testid": "neeto-assist-expand-button",
879
+ type: "button",
880
+ "aria-label": isExpanded ? t("neetoAssist.collapse") : t("neetoAssist.expand"),
881
+ onClick: onToggleExpand,
882
+ children: isExpanded ? /*#__PURE__*/jsx(Minimize2, {
883
+ size: HEADER_ICON_SIZE
884
+ }) : /*#__PURE__*/jsx(Maximize2, {
885
+ size: HEADER_ICON_SIZE
886
+ })
887
+ }), /*#__PURE__*/jsx("button", {
888
+ "aria-label": t("neetoAssist.close"),
889
+ className: "hover:bg-muted rounded p-1",
890
+ "data-testid": "neeto-assist-close-button",
891
+ type: "button",
892
+ onClick: onClose,
893
+ children: /*#__PURE__*/jsx(X, {
894
+ size: HEADER_ICON_SIZE
895
+ })
896
+ })]
897
+ })]
898
+ });
899
+ };
900
+ var Header = withT(Header$1);
901
+
902
+ var Pane = function Pane(_ref) {
903
+ var children = _ref.children,
904
+ isExpanded = _ref.isExpanded,
905
+ isOpen = _ref.isOpen;
906
+ var paneWidth = isExpanded ? EXPANDED_PANE_WIDTH : COLLAPSED_PANE_WIDTH;
907
+
908
+ // Lets a host make room with its own CSS while the pane is open.
909
+ useEffect(function () {
910
+ if (!isOpen) return undefined;
911
+ document.documentElement.setAttribute("data-neeto-assist-open", isExpanded ? "expanded" : "default");
912
+ return function () {
913
+ return document.documentElement.removeAttribute("data-neeto-assist-open");
914
+ };
915
+ }, [isExpanded, isOpen]);
916
+ return /*#__PURE__*/jsx("aside", {
917
+ "aria-hidden": !isOpen,
918
+ "data-testid": "neeto-assist-pane",
919
+ className: classNames("flex h-screen shrink-0 flex-col overflow-hidden", {
920
+ "bg-popover border-border border-s": isOpen
921
+ }),
922
+ style: {
923
+ width: isOpen ? paneWidth : "0px",
924
+ visibility: isOpen ? "visible" : "hidden",
925
+ transition: "width 200ms ease, visibility 200ms"
926
+ },
927
+ children: /*#__PURE__*/jsx("div", {
928
+ className: "flex h-full flex-col",
929
+ style: {
930
+ width: paneWidth
931
+ },
932
+ children: children
933
+ })
934
+ });
935
+ };
936
+
937
+ var NeetoAssistPane = function NeetoAssistPane() {
938
+ var isOpen = useNeetoAssistStore(function (state) {
939
+ return state.isOpen;
940
+ });
941
+ var isExpanded = useNeetoAssistStore(function (state) {
942
+ return state.isExpanded;
943
+ });
944
+ var conversation = useNeetoAssistStore(function (state) {
945
+ return state.conversation;
946
+ });
947
+ var close = useNeetoAssistStore(function (state) {
948
+ return state.close;
949
+ });
950
+ var setExpanded = useNeetoAssistStore(function (state) {
951
+ return state.setExpanded;
952
+ });
953
+ var isVisible = isOpen && !!conversation;
954
+ return /*#__PURE__*/jsx(Pane, {
955
+ isExpanded: isExpanded,
956
+ isOpen: isVisible,
957
+ children: conversation && /*#__PURE__*/jsxs(Fragment$1, {
958
+ children: [/*#__PURE__*/jsx(Header, {
959
+ isExpanded: isExpanded,
960
+ onClose: close,
961
+ onToggleExpand: function onToggleExpand() {
962
+ return setExpanded(!isExpanded);
963
+ }
964
+ }), /*#__PURE__*/createElement(Conversation, {
965
+ isVisible: isVisible,
966
+ conversationId: conversation.id,
967
+ key: conversation.id,
968
+ onUseReply: conversation.onUseReply
969
+ })]
970
+ })
971
+ });
972
+ };
973
+
974
+ export { NeetoAssistPane as default };
975
+ //# sourceMappingURL=NeetoAssistPane.js.map