hanbiro-react16-sdk 1.0.25 → 1.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/components/ChatAIDraft/ChatInput.d.ts +27 -0
  2. package/dist/components/ChatAIDraft/ChatInput.js +190 -0
  3. package/dist/components/ChatAIDraft/ChatList/AIAvatar.d.ts +3 -0
  4. package/dist/components/ChatAIDraft/ChatList/AIAvatar.js +24 -0
  5. package/dist/components/ChatAIDraft/ChatList/LoadingDots.d.ts +6 -0
  6. package/dist/components/ChatAIDraft/ChatList/LoadingDots.js +24 -0
  7. package/dist/components/ChatAIDraft/ChatList/MessageItem.d.ts +11 -0
  8. package/dist/components/ChatAIDraft/ChatList/MessageItem.js +124 -0
  9. package/dist/components/ChatAIDraft/ChatList/helpers.d.ts +1 -0
  10. package/dist/components/ChatAIDraft/ChatList/helpers.js +35 -0
  11. package/dist/components/ChatAIDraft/ChatList/index.d.ts +11 -0
  12. package/dist/components/ChatAIDraft/ChatList/index.js +36 -0
  13. package/dist/components/ChatAIDraft/{EmptyState.js → CreatePanel/EmptyState.js} +4 -4
  14. package/dist/components/ChatAIDraft/CreatePanel/index.d.ts +30 -0
  15. package/dist/components/ChatAIDraft/CreatePanel/index.js +173 -0
  16. package/dist/components/ChatAIDraft/ReplyPanel/EmptyState.d.ts +10 -0
  17. package/dist/components/ChatAIDraft/ReplyPanel/EmptyState.js +365 -0
  18. package/dist/components/ChatAIDraft/ReplyPanel/MailListSelect.d.ts +26 -0
  19. package/dist/components/ChatAIDraft/ReplyPanel/MailListSelect.js +480 -0
  20. package/dist/components/ChatAIDraft/ReplyPanel/helper.d.ts +13 -0
  21. package/dist/components/ChatAIDraft/ReplyPanel/helper.js +100 -0
  22. package/dist/components/ChatAIDraft/ReplyPanel/index.d.ts +46 -0
  23. package/dist/components/ChatAIDraft/ReplyPanel/index.js +465 -0
  24. package/dist/components/ChatAIDraft/helper.d.ts +1 -0
  25. package/dist/components/ChatAIDraft/helper.js +12 -1
  26. package/dist/components/ChatAIDraft/index.d.ts +4 -32
  27. package/dist/components/ChatAIDraft/index.js +19 -307
  28. package/dist/components/ChatAIDraft/types.d.ts +36 -0
  29. package/dist/hanbiro-react16-sdk.style.css +41 -1
  30. package/dist/hanbiro-react16-sdk.umd.js +5143 -3379
  31. package/dist/index.js +1 -1
  32. package/dist/node_modules/react-feather/dist/icons/arrow-left.js +73 -0
  33. package/dist/node_modules/react-feather/dist/icons/lock.js +75 -0
  34. package/dist/node_modules/react-feather/dist/icons/mail.js +70 -0
  35. package/dist/node_modules/react-feather/dist/icons/paperclip.js +68 -0
  36. package/dist/node_modules/react-feather/dist/icons/plus.js +76 -0
  37. package/package.json +1 -1
  38. package/dist/components/ChatAIDraft/List.d.ts +0 -10
  39. package/dist/components/ChatAIDraft/List.js +0 -188
  40. /package/dist/components/ChatAIDraft/{EmptyState.d.ts → CreatePanel/EmptyState.d.ts} +0 -0
@@ -0,0 +1,480 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+ var __async = (__this, __arguments, generator) => {
5
+ return new Promise((resolve, reject) => {
6
+ var fulfilled = (value) => {
7
+ try {
8
+ step(generator.next(value));
9
+ } catch (e) {
10
+ reject(e);
11
+ }
12
+ };
13
+ var rejected = (value) => {
14
+ try {
15
+ step(generator.throw(value));
16
+ } catch (e) {
17
+ reject(e);
18
+ }
19
+ };
20
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
21
+ step((generator = generator.apply(__this, __arguments)).next());
22
+ });
23
+ };
24
+ import * as React from "react";
25
+ import { fetchMailList } from "./helper.js";
26
+ import ArrowLeft from "../../../node_modules/react-feather/dist/icons/arrow-left.js";
27
+ import Paperclip from "../../../node_modules/react-feather/dist/icons/paperclip.js";
28
+ const PAGE_SIZE = 6;
29
+ const MAX_SELECTED = 5;
30
+ class MailListSelect extends React.Component {
31
+ constructor(props) {
32
+ super(props);
33
+ __publicField(this, "loadPage", (page) => __async(this, null, function* () {
34
+ this.setState({ isLoading: true });
35
+ const { items, total } = yield fetchMailList({
36
+ page,
37
+ pageSize: PAGE_SIZE,
38
+ accountEmail: this.props.accountEmail
39
+ });
40
+ this.setState({ items, total, page, isLoading: false });
41
+ }));
42
+ __publicField(this, "toggleMid", (mid) => {
43
+ this.setState((prev) => {
44
+ const isSelected = prev.selectedMids.includes(mid);
45
+ if (isSelected) {
46
+ return { selectedMids: prev.selectedMids.filter((m) => m !== mid) };
47
+ }
48
+ if (prev.selectedMids.length >= MAX_SELECTED) {
49
+ return null;
50
+ }
51
+ return { selectedMids: [...prev.selectedMids, mid] };
52
+ });
53
+ });
54
+ __publicField(this, "toggleAll", () => {
55
+ const { items, selectedMids } = this.state;
56
+ const pageMids = items.map((it) => it.mid);
57
+ const allSelected = pageMids.every((m) => selectedMids.includes(m));
58
+ if (allSelected) {
59
+ this.setState({
60
+ selectedMids: selectedMids.filter((m) => !pageMids.includes(m))
61
+ });
62
+ } else {
63
+ const merged = Array.from(/* @__PURE__ */ new Set([...selectedMids, ...pageMids])).slice(
64
+ 0,
65
+ MAX_SELECTED
66
+ );
67
+ this.setState({ selectedMids: merged });
68
+ }
69
+ });
70
+ __publicField(this, "clearAll", () => {
71
+ this.setState({ selectedMids: [] });
72
+ });
73
+ this.state = {
74
+ page: 1,
75
+ total: 0,
76
+ items: [],
77
+ selectedMids: [...props.initialSelected],
78
+ isLoading: false
79
+ };
80
+ }
81
+ componentDidMount() {
82
+ this.loadPage(1);
83
+ }
84
+ renderPagination() {
85
+ const { page, total } = this.state;
86
+ const totalPages = Math.max(1, Math.ceil(total / PAGE_SIZE));
87
+ const pages = [];
88
+ for (let i = 1; i <= totalPages; i++) pages.push(i);
89
+ return /* @__PURE__ */ React.createElement(
90
+ "div",
91
+ {
92
+ style: {
93
+ display: "flex",
94
+ alignItems: "center",
95
+ justifyContent: "center",
96
+ gap: 4,
97
+ padding: "12px 0"
98
+ }
99
+ },
100
+ /* @__PURE__ */ React.createElement(
101
+ "button",
102
+ {
103
+ type: "button",
104
+ onClick: () => page > 1 && this.loadPage(page - 1),
105
+ disabled: page <= 1,
106
+ className: "icon-button small"
107
+ },
108
+ "‹"
109
+ ),
110
+ pages.map((p) => /* @__PURE__ */ React.createElement(
111
+ "button",
112
+ {
113
+ key: p,
114
+ type: "button",
115
+ onClick: () => p !== page && this.loadPage(p),
116
+ style: {
117
+ minWidth: 28,
118
+ height: 28,
119
+ borderRadius: 4,
120
+ border: "none",
121
+ background: p === page ? "var(--primary-main)" : "transparent",
122
+ color: p === page ? "var(--primary-contrasttext)" : "var(--text-primary)",
123
+ cursor: "pointer",
124
+ fontSize: 12,
125
+ fontFamily: "inherit",
126
+ fontWeight: p === page ? 600 : 400
127
+ }
128
+ },
129
+ p
130
+ )),
131
+ /* @__PURE__ */ React.createElement(
132
+ "button",
133
+ {
134
+ type: "button",
135
+ onClick: () => page < totalPages && this.loadPage(page + 1),
136
+ disabled: page >= totalPages,
137
+ className: "icon-button small"
138
+ },
139
+ "›"
140
+ )
141
+ );
142
+ }
143
+ render() {
144
+ const { onCancel, onConfirm } = this.props;
145
+ const { items, total, selectedMids, isLoading } = this.state;
146
+ const pageMids = items.map((it) => it.mid);
147
+ const allOnPageSelected = pageMids.length > 0 && pageMids.every((m) => selectedMids.includes(m));
148
+ return /* @__PURE__ */ React.createElement(
149
+ "div",
150
+ {
151
+ style: {
152
+ display: "flex",
153
+ flexDirection: "column",
154
+ height: "100%",
155
+ background: "#fff",
156
+ fontFamily: "inherit",
157
+ boxSizing: "border-box",
158
+ padding: 16
159
+ }
160
+ },
161
+ /* @__PURE__ */ React.createElement(
162
+ "button",
163
+ {
164
+ type: "button",
165
+ onClick: onCancel,
166
+ className: "text-button",
167
+ style: { alignSelf: "flex-start" }
168
+ },
169
+ /* @__PURE__ */ React.createElement(ArrowLeft, { size: 14 }),
170
+ " Back"
171
+ ),
172
+ /* @__PURE__ */ React.createElement("div", { style: { marginTop: 8 } }, /* @__PURE__ */ React.createElement(
173
+ "div",
174
+ {
175
+ style: {
176
+ fontSize: 14,
177
+ fontWeight: 600,
178
+ color: "var(--text-primary)"
179
+ }
180
+ },
181
+ "Add context from receive history"
182
+ ), /* @__PURE__ */ React.createElement(
183
+ "div",
184
+ {
185
+ style: {
186
+ fontSize: 12,
187
+ color: "var(--text-secondary)",
188
+ marginTop: 2
189
+ }
190
+ },
191
+ "Select related emails to provide AI context."
192
+ )),
193
+ /* @__PURE__ */ React.createElement(
194
+ "div",
195
+ {
196
+ style: {
197
+ display: "flex",
198
+ alignItems: "center",
199
+ justifyContent: "space-between",
200
+ marginTop: 12,
201
+ paddingBottom: 8,
202
+ borderBottom: "1px solid var(--border-light)"
203
+ }
204
+ },
205
+ /* @__PURE__ */ React.createElement(
206
+ "label",
207
+ {
208
+ style: {
209
+ display: "inline-flex",
210
+ alignItems: "center",
211
+ gap: 6,
212
+ fontSize: 12,
213
+ color: "var(--text-primary)",
214
+ cursor: "pointer"
215
+ }
216
+ },
217
+ /* @__PURE__ */ React.createElement(
218
+ "input",
219
+ {
220
+ type: "checkbox",
221
+ checked: allOnPageSelected,
222
+ onChange: this.toggleAll
223
+ }
224
+ ),
225
+ /* @__PURE__ */ React.createElement("span", null, "Select all · ", total, " total")
226
+ ),
227
+ /* @__PURE__ */ React.createElement("span", { style: { fontSize: 11, color: "var(--text-secondary)" } }, "Sort: latest")
228
+ ),
229
+ /* @__PURE__ */ React.createElement(
230
+ "div",
231
+ {
232
+ style: {
233
+ flex: 1,
234
+ minHeight: 0,
235
+ overflowY: "auto",
236
+ paddingRight: 8,
237
+ marginRight: -8
238
+ }
239
+ },
240
+ isLoading ? /* @__PURE__ */ React.createElement(
241
+ "div",
242
+ {
243
+ style: {
244
+ padding: 24,
245
+ textAlign: "center",
246
+ color: "var(--text-secondary)",
247
+ fontSize: 12
248
+ }
249
+ },
250
+ "Loading..."
251
+ ) : items.length === 0 ? /* @__PURE__ */ React.createElement(
252
+ "div",
253
+ {
254
+ style: {
255
+ padding: 24,
256
+ textAlign: "center",
257
+ color: "var(--text-secondary)",
258
+ fontSize: 12
259
+ }
260
+ },
261
+ "No emails found."
262
+ ) : items.map((it) => {
263
+ const isChecked = selectedMids.includes(it.mid);
264
+ const disabled = !isChecked && selectedMids.length >= MAX_SELECTED;
265
+ return /* @__PURE__ */ React.createElement(
266
+ "label",
267
+ {
268
+ key: it.mid,
269
+ style: {
270
+ display: "flex",
271
+ alignItems: "flex-start",
272
+ gap: 10,
273
+ padding: "10px 12px",
274
+ marginTop: 8,
275
+ borderRadius: 8,
276
+ border: isChecked ? "1px solid var(--primary-main)" : "1px solid var(--border-light)",
277
+ background: isChecked ? "var(--primary-lighter)" : "#fff",
278
+ cursor: disabled ? "not-allowed" : "pointer",
279
+ opacity: disabled ? 0.5 : 1
280
+ }
281
+ },
282
+ /* @__PURE__ */ React.createElement(
283
+ "input",
284
+ {
285
+ type: "checkbox",
286
+ checked: isChecked,
287
+ disabled,
288
+ onChange: () => this.toggleMid(it.mid),
289
+ style: { marginTop: 2, flexShrink: 0 }
290
+ }
291
+ ),
292
+ /* @__PURE__ */ React.createElement("div", { style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React.createElement(
293
+ "div",
294
+ {
295
+ style: {
296
+ display: "flex",
297
+ alignItems: "center",
298
+ gap: 6,
299
+ justifyContent: "space-between"
300
+ }
301
+ },
302
+ /* @__PURE__ */ React.createElement(
303
+ "div",
304
+ {
305
+ style: {
306
+ fontSize: 13,
307
+ fontWeight: 600,
308
+ color: "var(--text-primary)",
309
+ whiteSpace: "nowrap",
310
+ overflow: "hidden",
311
+ textOverflow: "ellipsis",
312
+ flex: 1,
313
+ minWidth: 0
314
+ }
315
+ },
316
+ it.subject
317
+ ),
318
+ it.is_file > 0 && /* @__PURE__ */ React.createElement(
319
+ "span",
320
+ {
321
+ style: {
322
+ display: "inline-flex",
323
+ alignItems: "center",
324
+ gap: 2,
325
+ fontSize: 11,
326
+ color: "var(--text-secondary)",
327
+ flexShrink: 0
328
+ }
329
+ },
330
+ /* @__PURE__ */ React.createElement(Paperclip, { size: 10 }),
331
+ it.is_file
332
+ ),
333
+ /* @__PURE__ */ React.createElement(
334
+ "span",
335
+ {
336
+ style: {
337
+ fontSize: 11,
338
+ color: "var(--text-secondary)",
339
+ flexShrink: 0
340
+ }
341
+ },
342
+ it.date
343
+ )
344
+ ), /* @__PURE__ */ React.createElement(
345
+ "div",
346
+ {
347
+ style: {
348
+ fontSize: 12,
349
+ color: "var(--text-secondary)",
350
+ marginTop: 2,
351
+ whiteSpace: "nowrap",
352
+ overflow: "hidden",
353
+ textOverflow: "ellipsis"
354
+ }
355
+ },
356
+ it.from_name,
357
+ it.from_addr ? ` <${it.from_addr}>` : "",
358
+ it.preview ? ` · ${it.preview}` : ""
359
+ ))
360
+ );
361
+ }),
362
+ !isLoading && items.length > 0 && this.renderPagination()
363
+ ),
364
+ /* @__PURE__ */ React.createElement(
365
+ "div",
366
+ {
367
+ style: {
368
+ display: "flex",
369
+ alignItems: "center",
370
+ justifyContent: "space-between",
371
+ paddingTop: 12,
372
+ borderTop: "1px solid var(--border-light)",
373
+ marginTop: 8,
374
+ gap: 8
375
+ }
376
+ },
377
+ /* @__PURE__ */ React.createElement(
378
+ "div",
379
+ {
380
+ style: {
381
+ fontSize: 12,
382
+ color: "var(--text-secondary)",
383
+ display: "inline-flex",
384
+ alignItems: "center",
385
+ gap: 8
386
+ }
387
+ },
388
+ /* @__PURE__ */ React.createElement(
389
+ "span",
390
+ {
391
+ style: {
392
+ background: "var(--primary-main)",
393
+ color: "var(--primary-contrasttext)",
394
+ padding: "2px 8px",
395
+ borderRadius: 999,
396
+ fontWeight: 600
397
+ }
398
+ },
399
+ selectedMids.length,
400
+ "/",
401
+ MAX_SELECTED
402
+ ),
403
+ /* @__PURE__ */ React.createElement("span", null, "selected · up to ", MAX_SELECTED),
404
+ selectedMids.length > 0 && /* @__PURE__ */ React.createElement(
405
+ "button",
406
+ {
407
+ type: "button",
408
+ onClick: this.clearAll,
409
+ style: {
410
+ border: "none",
411
+ background: "transparent",
412
+ color: "var(--primary-main)",
413
+ cursor: "pointer",
414
+ fontSize: 12,
415
+ padding: 0,
416
+ fontFamily: "inherit"
417
+ }
418
+ },
419
+ "Clear all"
420
+ )
421
+ )
422
+ ),
423
+ /* @__PURE__ */ React.createElement(
424
+ "div",
425
+ {
426
+ style: {
427
+ display: "flex",
428
+ gap: 8,
429
+ marginTop: 12
430
+ }
431
+ },
432
+ /* @__PURE__ */ React.createElement(
433
+ "button",
434
+ {
435
+ type: "button",
436
+ onClick: onCancel,
437
+ style: {
438
+ flex: 1,
439
+ padding: "10px 12px",
440
+ borderRadius: 8,
441
+ border: "1px solid var(--border-main)",
442
+ background: "#fff",
443
+ color: "var(--text-primary)",
444
+ cursor: "pointer",
445
+ fontSize: 13,
446
+ fontFamily: "inherit"
447
+ }
448
+ },
449
+ "Cancel"
450
+ ),
451
+ /* @__PURE__ */ React.createElement(
452
+ "button",
453
+ {
454
+ type: "button",
455
+ disabled: selectedMids.length === 0,
456
+ onClick: () => onConfirm(selectedMids),
457
+ style: {
458
+ flex: 2,
459
+ padding: "10px 12px",
460
+ borderRadius: 8,
461
+ border: "none",
462
+ background: selectedMids.length === 0 ? "var(--primary-lighter)" : "var(--primary-main)",
463
+ color: "var(--primary-contrasttext)",
464
+ cursor: selectedMids.length === 0 ? "not-allowed" : "pointer",
465
+ fontSize: 13,
466
+ fontWeight: 600,
467
+ fontFamily: "inherit"
468
+ }
469
+ },
470
+ "Add ",
471
+ selectedMids.length > 0 ? `${selectedMids.length} ` : "",
472
+ "as context →"
473
+ )
474
+ )
475
+ );
476
+ }
477
+ }
478
+ export {
479
+ MailListSelect as default
480
+ };
@@ -0,0 +1,13 @@
1
+ import { ContextMail, MailListItem, MailViewData } from '../types';
2
+
3
+ export interface MailListResponse {
4
+ items: MailListItem[];
5
+ total: number;
6
+ }
7
+ export declare const fetchMailView: (mid: string) => Promise<MailViewData | null>;
8
+ export declare const fetchMailAiContext: (mids: string[]) => Promise<ContextMail[]>;
9
+ export declare const fetchMailList: (params: {
10
+ page: number;
11
+ pageSize: number;
12
+ accountEmail: string;
13
+ }) => Promise<MailListResponse>;
@@ -0,0 +1,100 @@
1
+ var __async = (__this, __arguments, generator) => {
2
+ return new Promise((resolve, reject) => {
3
+ var fulfilled = (value) => {
4
+ try {
5
+ step(generator.next(value));
6
+ } catch (e) {
7
+ reject(e);
8
+ }
9
+ };
10
+ var rejected = (value) => {
11
+ try {
12
+ step(generator.throw(value));
13
+ } catch (e) {
14
+ reject(e);
15
+ }
16
+ };
17
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
18
+ step((generator = generator.apply(__this, __arguments)).next());
19
+ });
20
+ };
21
+ import { apiGet } from "../../../utils/api.js";
22
+ import { extractEmail } from "../helper.js";
23
+ const parseFromField = (raw) => {
24
+ const email = extractEmail(raw);
25
+ const decoded = String(raw || "").replace(/&lt;/g, "<").replace(/&gt;/g, ">");
26
+ const name = decoded.replace(/<[^>]+>/, "").replace(/["']/g, "").trim();
27
+ return { name, email };
28
+ };
29
+ const fetchMailView = (mid) => __async(void 0, null, function* () {
30
+ var _a;
31
+ const { data, ok } = yield apiGet(`/email/all/${mid}`);
32
+ if (!ok || !data) return null;
33
+ const view = ((_a = data == null ? void 0 : data.mailview) == null ? void 0 : _a[0]) || (data == null ? void 0 : data.mailview) || data;
34
+ if (!view) return null;
35
+ const { name, email } = parseFromField((view == null ? void 0 : view.from) || "");
36
+ return {
37
+ mid: (view == null ? void 0 : view.mid) || mid,
38
+ subject: (view == null ? void 0 : view.subject) || (view == null ? void 0 : view.subj) || "",
39
+ from_name: name || (view == null ? void 0 : view.from_name) || "",
40
+ from_addr: email || (view == null ? void 0 : view.from_addr) || "",
41
+ date: (view == null ? void 0 : view.date) || (view == null ? void 0 : view.receivedate) || "",
42
+ ai_contents: (view == null ? void 0 : view.ai_contents) || "",
43
+ contents: (view == null ? void 0 : view.contents) || ""
44
+ };
45
+ });
46
+ const fetchMailAiContext = (mids) => __async(void 0, null, function* () {
47
+ if (!mids.length) return [];
48
+ const ids = mids.join(",");
49
+ const { data, ok } = yield apiGet(
50
+ `/email/ai/aicontext/${ids}?limit=${mids.length}`
51
+ );
52
+ if (!ok || !(data == null ? void 0 : data.items)) return [];
53
+ return data.items.filter((it) => (it == null ? void 0 : it.ok) !== false).map((it) => {
54
+ const { name, email } = parseFromField((it == null ? void 0 : it.fromaddr) || "");
55
+ return {
56
+ mid: (it == null ? void 0 : it.mid) || "",
57
+ subject: (it == null ? void 0 : it.subject) || "",
58
+ from_name: name,
59
+ from_addr: email,
60
+ date: (it == null ? void 0 : it.date) || "",
61
+ ai_contents: (it == null ? void 0 : it.contents) || ""
62
+ };
63
+ });
64
+ });
65
+ const fetchMailList = (params) => __async(void 0, null, function* () {
66
+ var _a;
67
+ const { page, pageSize, accountEmail } = params;
68
+ const offset = (page - 1) * pageSize;
69
+ const query = new URLSearchParams({
70
+ acl: "all",
71
+ act: "maillist",
72
+ mailsort: "date",
73
+ sortkind: "0",
74
+ timemode: "mobile",
75
+ viewcont: `${offset},${pageSize}`,
76
+ searchbox: "all"
77
+ });
78
+ if (accountEmail) query.set("f", accountEmail);
79
+ const { data, ok } = yield apiGet(`/email/list?${query.toString()}`);
80
+ if (!ok || !data) {
81
+ return { items: [], total: 0 };
82
+ }
83
+ const list = (data == null ? void 0 : data.maillist) || [];
84
+ const items = list.map((it) => ({
85
+ mid: (it == null ? void 0 : it.mid) || "",
86
+ subject: (it == null ? void 0 : it.subject) || (it == null ? void 0 : it.subj) || "(no subject)",
87
+ from_name: (it == null ? void 0 : it.from_name) || "",
88
+ from_addr: (it == null ? void 0 : it.from_addr) || "",
89
+ date: (it == null ? void 0 : it.date) || "",
90
+ is_file: Number(it == null ? void 0 : it.is_file) || 0,
91
+ preview: (it == null ? void 0 : it.preview) || (it == null ? void 0 : it.abstract) || (it == null ? void 0 : it.htext) || ""
92
+ }));
93
+ const total = Number((_a = data == null ? void 0 : data.boxinfo) == null ? void 0 : _a.total) || Number(data == null ? void 0 : data.total) || Number(data == null ? void 0 : data.newcount) || items.length;
94
+ return { items, total };
95
+ });
96
+ export {
97
+ fetchMailAiContext,
98
+ fetchMailList,
99
+ fetchMailView
100
+ };
@@ -0,0 +1,46 @@
1
+ import { LabelValue } from '../../../types';
2
+ import { AIMessage, ChatType, ContextMail } from '../types';
3
+ import * as React from "react";
4
+ export interface ReplyPanelProps {
5
+ type: ChatType;
6
+ sourceMid: string;
7
+ defaultLang?: string;
8
+ getEditorContent?: () => string;
9
+ onApply: (params: {
10
+ html: string;
11
+ }) => void;
12
+ }
13
+ type View = "empty" | "list" | "chat";
14
+ interface ReplyPanelState {
15
+ view: View;
16
+ sourceMail: ContextMail | null;
17
+ accountEmail: string;
18
+ selectedMails: ContextMail[];
19
+ isLoadingSource: boolean;
20
+ isLoadingSelected: boolean;
21
+ message: string;
22
+ messages: AIMessage[];
23
+ isSending: boolean;
24
+ lang: LabelValue | null;
25
+ tone: LabelValue | null;
26
+ length: LabelValue | null;
27
+ conversationId: string;
28
+ }
29
+ declare class ReplyPanel extends React.Component<ReplyPanelProps, ReplyPanelState> {
30
+ private rootRef;
31
+ constructor(props: ReplyPanelProps);
32
+ componentDidMount(): void;
33
+ loadSourceMail: () => Promise<void>;
34
+ handleAddClick: () => void;
35
+ handleListCancel: () => void;
36
+ handleListConfirm: (mids: string[]) => Promise<void>;
37
+ handleRemoveSelected: (mid: string) => void;
38
+ handleMessageChange: (value: string) => void;
39
+ handleSubmit: () => Promise<void>;
40
+ setLang: (lang: LabelValue | null) => void;
41
+ setTone: (tone: LabelValue | null) => void;
42
+ setLength: (length: LabelValue | null) => void;
43
+ renderContextHeader(): React.JSX.Element;
44
+ render(): React.JSX.Element;
45
+ }
46
+ export default ReplyPanel;