hanbiro-react16-sdk 1.0.27 → 1.0.28

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 (45) hide show
  1. package/dist/components/ChatAIDraft/ChatList/LoadingDots.js +4 -3
  2. package/dist/components/ChatAIDraft/ChatList/MessageItem.js +4 -4
  3. package/dist/components/ChatAIDraft/ReplyPanel/BaseModal.d.ts +15 -0
  4. package/dist/components/ChatAIDraft/ReplyPanel/BaseModal.js +101 -0
  5. package/dist/components/ChatAIDraft/ReplyPanel/ContextPreviewModal.d.ts +13 -0
  6. package/dist/components/ChatAIDraft/ReplyPanel/ContextPreviewModal.js +63 -0
  7. package/dist/components/ChatAIDraft/ReplyPanel/EmptyState.d.ts +1 -8
  8. package/dist/components/ChatAIDraft/ReplyPanel/EmptyState.js +1 -217
  9. package/dist/components/ChatAIDraft/ReplyPanel/Header/SelectedChip.d.ts +10 -0
  10. package/dist/components/ChatAIDraft/ReplyPanel/Header/SelectedChip.js +79 -0
  11. package/dist/components/ChatAIDraft/ReplyPanel/Header/SourceCard.d.ts +8 -0
  12. package/dist/components/ChatAIDraft/ReplyPanel/Header/SourceCard.js +52 -0
  13. package/dist/components/ChatAIDraft/ReplyPanel/Header/index.d.ts +12 -0
  14. package/dist/components/ChatAIDraft/ReplyPanel/Header/index.js +135 -0
  15. package/dist/components/ChatAIDraft/ReplyPanel/MailListSelect.d.ts +1 -0
  16. package/dist/components/ChatAIDraft/ReplyPanel/MailListSelect.js +62 -149
  17. package/dist/components/ChatAIDraft/ReplyPanel/index.d.ts +5 -1
  18. package/dist/components/ChatAIDraft/ReplyPanel/index.js +35 -196
  19. package/dist/components/Pagination/index.d.ts +20 -0
  20. package/dist/components/Pagination/index.js +131 -0
  21. package/dist/components/SummaryAIEmails/FilterTabs.d.ts +8 -0
  22. package/dist/components/SummaryAIEmails/FilterTabs.js +57 -0
  23. package/dist/components/SummaryAIEmails/LanguagePopover.d.ts +24 -0
  24. package/dist/components/SummaryAIEmails/LanguagePopover.js +110 -0
  25. package/dist/components/SummaryAIEmails/SummaryItem.d.ts +7 -0
  26. package/dist/components/SummaryAIEmails/SummaryItem.js +74 -0
  27. package/dist/components/SummaryAIEmails/TargetInfoBar.d.ts +9 -0
  28. package/dist/components/SummaryAIEmails/TargetInfoBar.js +81 -0
  29. package/dist/components/SummaryAIEmails/index.d.ts +34 -0
  30. package/dist/components/SummaryAIEmails/index.js +213 -0
  31. package/dist/components/SummaryAIEmails/types.d.ts +16 -0
  32. package/dist/components/SummaryAIEmails/utils.d.ts +11 -0
  33. package/dist/components/SummaryAIEmails/utils.js +46 -0
  34. package/dist/components/index.d.ts +2 -4
  35. package/dist/hanbiro-react16-sdk.style.css +7 -2
  36. package/dist/hanbiro-react16-sdk.umd.js +1958 -965
  37. package/dist/index.js +11 -13
  38. package/dist/node_modules/react-feather/dist/icons/arrow-down.js +73 -0
  39. package/dist/node_modules/react-feather/dist/icons/chevron-left.js +68 -0
  40. package/dist/node_modules/react-feather/dist/icons/chevron-right.js +68 -0
  41. package/dist/node_modules/react-feather/dist/icons/globe.js +77 -0
  42. package/dist/node_modules/react-feather/dist/icons/x.js +76 -0
  43. package/dist/utils/index.d.ts +1 -1
  44. package/dist/utils/url.js +0 -13
  45. package/package.json +1 -1
@@ -0,0 +1,135 @@
1
+ import * as React from "react";
2
+ import SourceCard from "./SourceCard.js";
3
+ import SelectedChip from "./SelectedChip.js";
4
+ import Lock from "../../../../node_modules/react-feather/dist/icons/lock.js";
5
+ import Plus from "../../../../node_modules/react-feather/dist/icons/plus.js";
6
+ const ContextHeader = ({
7
+ sourceMail,
8
+ selectedMails,
9
+ onAddClick,
10
+ onSourceClick,
11
+ onChipClick,
12
+ onRemoveChip
13
+ }) => {
14
+ return /* @__PURE__ */ React.createElement(
15
+ "div",
16
+ {
17
+ style: {
18
+ display: "flex",
19
+ flexDirection: "column",
20
+ gap: 12,
21
+ paddingBottom: 12,
22
+ marginBottom: 12
23
+ }
24
+ },
25
+ sourceMail && /* @__PURE__ */ React.createElement("div", { style: { display: "flex", flexDirection: "column", gap: 6 } }, /* @__PURE__ */ React.createElement(
26
+ "div",
27
+ {
28
+ style: {
29
+ display: "flex",
30
+ alignItems: "center",
31
+ gap: 6,
32
+ fontSize: 12,
33
+ color: "var(--text-primary)",
34
+ fontWeight: 600
35
+ }
36
+ },
37
+ /* @__PURE__ */ React.createElement("span", null, "Source context"),
38
+ /* @__PURE__ */ React.createElement(
39
+ "span",
40
+ {
41
+ style: {
42
+ background: "var(--primary-main)",
43
+ color: "var(--primary-contrasttext)",
44
+ fontSize: 10,
45
+ padding: "1px 6px",
46
+ borderRadius: 999,
47
+ fontWeight: 600
48
+ }
49
+ },
50
+ "1"
51
+ ),
52
+ /* @__PURE__ */ React.createElement(
53
+ "span",
54
+ {
55
+ style: {
56
+ display: "inline-flex",
57
+ alignItems: "center",
58
+ gap: 2,
59
+ fontSize: 11,
60
+ color: "var(--text-secondary)",
61
+ fontWeight: 500
62
+ }
63
+ },
64
+ /* @__PURE__ */ React.createElement(Lock, { size: 11 }),
65
+ " Auto"
66
+ )
67
+ ), /* @__PURE__ */ React.createElement(
68
+ SourceCard,
69
+ {
70
+ mail: sourceMail,
71
+ onClick: () => onSourceClick(sourceMail)
72
+ }
73
+ )),
74
+ /* @__PURE__ */ React.createElement("div", { style: { display: "flex", flexDirection: "column", gap: 6 } }, /* @__PURE__ */ React.createElement(
75
+ "div",
76
+ {
77
+ style: {
78
+ display: "flex",
79
+ alignItems: "center",
80
+ justifyContent: "space-between"
81
+ }
82
+ },
83
+ /* @__PURE__ */ React.createElement(
84
+ "div",
85
+ {
86
+ style: {
87
+ display: "flex",
88
+ alignItems: "center",
89
+ gap: 6,
90
+ fontSize: 12,
91
+ color: "var(--text-primary)",
92
+ fontWeight: 600
93
+ }
94
+ },
95
+ /* @__PURE__ */ React.createElement("span", null, "Selected context"),
96
+ /* @__PURE__ */ React.createElement(
97
+ "span",
98
+ {
99
+ style: {
100
+ background: "var(--background-softGrey)",
101
+ color: "var(--text-primary)",
102
+ fontSize: 10,
103
+ padding: "1px 6px",
104
+ borderRadius: 999,
105
+ fontWeight: 600
106
+ }
107
+ },
108
+ selectedMails.length
109
+ )
110
+ ),
111
+ /* @__PURE__ */ React.createElement(
112
+ "button",
113
+ {
114
+ type: "button",
115
+ onClick: onAddClick,
116
+ className: "text-button primary"
117
+ },
118
+ /* @__PURE__ */ React.createElement(Plus, { size: 12 }),
119
+ " Add"
120
+ )
121
+ ), selectedMails.length > 0 && /* @__PURE__ */ React.createElement("div", { style: { display: "flex", flexWrap: "wrap", gap: 6 } }, selectedMails.map((m, i) => /* @__PURE__ */ React.createElement(
122
+ SelectedChip,
123
+ {
124
+ key: m.mid,
125
+ index: i,
126
+ mail: m,
127
+ onClick: onChipClick,
128
+ onRemove: onRemoveChip
129
+ }
130
+ ))))
131
+ );
132
+ };
133
+ export {
134
+ ContextHeader as default
135
+ };
@@ -3,6 +3,7 @@ import * as React from "react";
3
3
  interface MailListSelectProps {
4
4
  accountEmail: string;
5
5
  initialSelected: string[];
6
+ isConfirming?: boolean;
6
7
  onCancel: () => void;
7
8
  onConfirm: (mids: string[]) => void;
8
9
  }
@@ -22,6 +22,9 @@ var __async = (__this, __arguments, generator) => {
22
22
  });
23
23
  };
24
24
  import * as React from "react";
25
+ import LoadingContainer from "../../LoadingContainer/index.js";
26
+ import LoadingCircular from "../../LoadingCircular/index.js";
27
+ import Pagination from "../../Pagination/index.js";
25
28
  import { fetchMailList } from "./helper.js";
26
29
  import ArrowLeft from "../../../node_modules/react-feather/dist/icons/arrow-left.js";
27
30
  import Paperclip from "../../../node_modules/react-feather/dist/icons/paperclip.js";
@@ -53,19 +56,16 @@ class MailListSelect extends React.Component {
53
56
  });
54
57
  __publicField(this, "toggleAll", () => {
55
58
  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 });
59
+ if (selectedMids.length >= MAX_SELECTED) {
60
+ this.setState({ selectedMids: [] });
61
+ return;
68
62
  }
63
+ const pageMids = items.map((it) => it.mid);
64
+ const merged = Array.from(/* @__PURE__ */ new Set([...selectedMids, ...pageMids])).slice(
65
+ 0,
66
+ MAX_SELECTED
67
+ );
68
+ this.setState({ selectedMids: merged });
69
69
  });
70
70
  __publicField(this, "clearAll", () => {
71
71
  this.setState({ selectedMids: [] });
@@ -84,67 +84,20 @@ class MailListSelect extends React.Component {
84
84
  renderPagination() {
85
85
  const { page, total } = this.state;
86
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
87
  return /* @__PURE__ */ React.createElement(
90
- "div",
88
+ Pagination,
91
89
  {
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
- )
90
+ total,
91
+ page,
92
+ totalPages,
93
+ onChangePage: this.loadPage
94
+ }
141
95
  );
142
96
  }
143
97
  render() {
144
- const { onCancel, onConfirm } = this.props;
98
+ const { onCancel, onConfirm, isConfirming } = this.props;
145
99
  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));
100
+ const isFull = selectedMids.length >= MAX_SELECTED;
148
101
  return /* @__PURE__ */ React.createElement(
149
102
  "div",
150
103
  {
@@ -208,9 +161,9 @@ class MailListSelect extends React.Component {
208
161
  style: {
209
162
  display: "inline-flex",
210
163
  alignItems: "center",
211
- gap: 6,
164
+ gap: 8,
212
165
  fontSize: 12,
213
- color: "var(--text-primary)",
166
+ color: "var(--text-secondary)",
214
167
  cursor: "pointer"
215
168
  }
216
169
  },
@@ -218,11 +171,38 @@ class MailListSelect extends React.Component {
218
171
  "input",
219
172
  {
220
173
  type: "checkbox",
221
- checked: allOnPageSelected,
174
+ checked: isFull,
222
175
  onChange: this.toggleAll
223
176
  }
224
177
  ),
225
- /* @__PURE__ */ React.createElement("span", null, "Select all · ", total, " total")
178
+ /* @__PURE__ */ React.createElement(
179
+ "span",
180
+ {
181
+ style: {
182
+ background: "var(--primary-main)",
183
+ color: "var(--primary-contrasttext)",
184
+ padding: "2px 8px",
185
+ borderRadius: 999,
186
+ fontWeight: 600
187
+ }
188
+ },
189
+ selectedMids.length,
190
+ "/",
191
+ MAX_SELECTED
192
+ ),
193
+ /* @__PURE__ */ React.createElement("span", null, "selected · up to ", MAX_SELECTED),
194
+ selectedMids.length > 0 && /* @__PURE__ */ React.createElement(
195
+ "button",
196
+ {
197
+ type: "button",
198
+ onClick: (e) => {
199
+ e.preventDefault();
200
+ this.clearAll();
201
+ },
202
+ className: "text-button primary"
203
+ },
204
+ "Clear all"
205
+ )
226
206
  ),
227
207
  /* @__PURE__ */ React.createElement("span", { style: { fontSize: 11, color: "var(--text-secondary)" } }, "Sort: latest")
228
208
  ),
@@ -237,18 +217,7 @@ class MailListSelect extends React.Component {
237
217
  marginRight: -8
238
218
  }
239
219
  },
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(
220
+ isLoading ? /* @__PURE__ */ React.createElement(LoadingContainer, { fullHeight: true, size: "small" }) : items.length === 0 ? /* @__PURE__ */ React.createElement(
252
221
  "div",
253
222
  {
254
223
  style: {
@@ -361,65 +330,6 @@ class MailListSelect extends React.Component {
361
330
  }),
362
331
  !isLoading && items.length > 0 && this.renderPagination()
363
332
  ),
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
333
  /* @__PURE__ */ React.createElement(
424
334
  "div",
425
335
  {
@@ -452,24 +362,27 @@ class MailListSelect extends React.Component {
452
362
  "button",
453
363
  {
454
364
  type: "button",
455
- disabled: selectedMids.length === 0,
365
+ disabled: selectedMids.length === 0 || isConfirming,
456
366
  onClick: () => onConfirm(selectedMids),
457
367
  style: {
458
368
  flex: 2,
459
369
  padding: "10px 12px",
460
370
  borderRadius: 8,
461
371
  border: "none",
462
- background: selectedMids.length === 0 ? "var(--primary-lighter)" : "var(--primary-main)",
372
+ background: selectedMids.length === 0 || isConfirming ? "var(--primary-lighter)" : "var(--primary-main)",
463
373
  color: "var(--primary-contrasttext)",
464
- cursor: selectedMids.length === 0 ? "not-allowed" : "pointer",
374
+ cursor: selectedMids.length === 0 || isConfirming ? "not-allowed" : "pointer",
465
375
  fontSize: 13,
466
376
  fontWeight: 600,
467
- fontFamily: "inherit"
377
+ fontFamily: "inherit",
378
+ display: "inline-flex",
379
+ alignItems: "center",
380
+ justifyContent: "center",
381
+ gap: 8
468
382
  }
469
383
  },
470
- "Add ",
471
- selectedMids.length > 0 ? `${selectedMids.length} ` : "",
472
- "as context →"
384
+ isConfirming && /* @__PURE__ */ React.createElement(LoadingCircular, { size: 16, color: "var(--primary-contrasttext)" }),
385
+ /* @__PURE__ */ React.createElement("span", null, "Add ", selectedMids.length > 0 ? `${selectedMids.length} ` : "", "as context →")
473
386
  )
474
387
  )
475
388
  );
@@ -1,3 +1,4 @@
1
+ import { PreviewState } from './ContextPreviewModal';
1
2
  import { LabelValue } from '../../../types';
2
3
  import { AIMessage, ChatType, ContextMail } from '../types';
3
4
  import * as React from "react";
@@ -18,6 +19,7 @@ interface ReplyPanelState {
18
19
  selectedMails: ContextMail[];
19
20
  isLoadingSource: boolean;
20
21
  isLoadingSelected: boolean;
22
+ preview: PreviewState | null;
21
23
  message: string;
22
24
  messages: AIMessage[];
23
25
  isSending: boolean;
@@ -35,12 +37,14 @@ declare class ReplyPanel extends React.Component<ReplyPanelProps, ReplyPanelStat
35
37
  handleListCancel: () => void;
36
38
  handleListConfirm: (mids: string[]) => Promise<void>;
37
39
  handleRemoveSelected: (mid: string) => void;
40
+ handlePreviewSelected: (mail: ContextMail) => void;
41
+ handlePreviewSource: (mail: ContextMail) => void;
42
+ handlePreviewClose: () => void;
38
43
  handleMessageChange: (value: string) => void;
39
44
  handleSubmit: () => Promise<void>;
40
45
  setLang: (lang: LabelValue | null) => void;
41
46
  setTone: (tone: LabelValue | null) => void;
42
47
  setLength: (length: LabelValue | null) => void;
43
- renderContextHeader(): React.JSX.Element;
44
48
  render(): React.JSX.Element;
45
49
  }
46
50
  export default ReplyPanel;