hanbiro-react16-sdk 1.0.27 → 1.0.29

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 (69) hide show
  1. package/README.md +58 -5
  2. package/dist/components/ChatAIDraft/ChatInput.js +3 -1
  3. package/dist/components/ChatAIDraft/ChatList/LoadingDots.js +4 -3
  4. package/dist/components/ChatAIDraft/ChatList/MessageItem.js +7 -5
  5. package/dist/components/ChatAIDraft/CreatePanel/EmptyState.js +15 -15
  6. package/dist/components/ChatAIDraft/CreatePanel/index.js +3 -3
  7. package/dist/components/ChatAIDraft/ReplyPanel/BaseModal.d.ts +15 -0
  8. package/dist/components/ChatAIDraft/ReplyPanel/BaseModal.js +101 -0
  9. package/dist/components/ChatAIDraft/ReplyPanel/ContextPreviewModal.d.ts +13 -0
  10. package/dist/components/ChatAIDraft/ReplyPanel/ContextPreviewModal.js +65 -0
  11. package/dist/components/ChatAIDraft/ReplyPanel/EmptyState.d.ts +1 -8
  12. package/dist/components/ChatAIDraft/ReplyPanel/EmptyState.js +11 -227
  13. package/dist/components/ChatAIDraft/ReplyPanel/Header/SelectedChip.d.ts +10 -0
  14. package/dist/components/ChatAIDraft/ReplyPanel/Header/SelectedChip.js +79 -0
  15. package/dist/components/ChatAIDraft/ReplyPanel/Header/SourceCard.d.ts +8 -0
  16. package/dist/components/ChatAIDraft/ReplyPanel/Header/SourceCard.js +52 -0
  17. package/dist/components/ChatAIDraft/ReplyPanel/Header/index.d.ts +12 -0
  18. package/dist/components/ChatAIDraft/ReplyPanel/Header/index.js +139 -0
  19. package/dist/components/ChatAIDraft/ReplyPanel/MailListSelect.d.ts +1 -0
  20. package/dist/components/ChatAIDraft/ReplyPanel/MailListSelect.js +71 -155
  21. package/dist/components/ChatAIDraft/ReplyPanel/index.d.ts +5 -1
  22. package/dist/components/ChatAIDraft/ReplyPanel/index.js +42 -201
  23. package/dist/components/ChatAIDraft/SettingPopper/index.js +8 -6
  24. package/dist/components/ChatAIDraft/constants.d.ts +2 -2
  25. package/dist/components/ChatAIDraft/constants.js +16 -14
  26. package/dist/components/ChatAIDraft/index.d.ts +1 -0
  27. package/dist/components/ChatAIDraft/index.js +7 -1
  28. package/dist/components/Pagination/index.d.ts +20 -0
  29. package/dist/components/Pagination/index.js +133 -0
  30. package/dist/components/SummaryAIEmails/FilterTabs.d.ts +8 -0
  31. package/dist/components/SummaryAIEmails/FilterTabs.js +59 -0
  32. package/dist/components/SummaryAIEmails/LanguagePopover.d.ts +24 -0
  33. package/dist/components/SummaryAIEmails/LanguagePopover.js +110 -0
  34. package/dist/components/SummaryAIEmails/SummaryItem.d.ts +7 -0
  35. package/dist/components/SummaryAIEmails/SummaryItem.js +76 -0
  36. package/dist/components/SummaryAIEmails/TargetInfoBar.d.ts +9 -0
  37. package/dist/components/SummaryAIEmails/TargetInfoBar.js +81 -0
  38. package/dist/components/SummaryAIEmails/index.d.ts +35 -0
  39. package/dist/components/SummaryAIEmails/index.js +222 -0
  40. package/dist/components/SummaryAIEmails/types.d.ts +16 -0
  41. package/dist/components/SummaryAIEmails/utils.d.ts +12 -0
  42. package/dist/components/SummaryAIEmails/utils.js +47 -0
  43. package/dist/components/index.d.ts +2 -4
  44. package/dist/hanbiro-react16-sdk.style.css +7 -2
  45. package/dist/hanbiro-react16-sdk.umd.js +2169 -1033
  46. package/dist/index.js +13 -14
  47. package/dist/lang/en.d.ts +3 -0
  48. package/dist/lang/en.js +66 -0
  49. package/dist/lang/index.d.ts +4 -0
  50. package/dist/lang/index.js +18 -0
  51. package/dist/lang/keyLang.d.ts +62 -0
  52. package/dist/lang/keyLang.js +66 -0
  53. package/dist/lang/ko.d.ts +3 -0
  54. package/dist/lang/ko.js +66 -0
  55. package/dist/lang/vi.d.ts +3 -0
  56. package/dist/lang/vi.js +66 -0
  57. package/dist/node_modules/react-feather/dist/icons/arrow-down.js +73 -0
  58. package/dist/node_modules/react-feather/dist/icons/chevron-left.js +68 -0
  59. package/dist/node_modules/react-feather/dist/icons/chevron-right.js +68 -0
  60. package/dist/node_modules/react-feather/dist/icons/globe.js +77 -0
  61. package/dist/node_modules/react-feather/dist/icons/x.js +76 -0
  62. package/dist/utils/index.d.ts +1 -1
  63. package/dist/utils/lang.d.ts +1 -0
  64. package/dist/utils/lang.js +30 -0
  65. package/dist/utils/storage.d.ts +8 -0
  66. package/dist/utils/storage.js +19 -0
  67. package/dist/utils/url.d.ts +2 -0
  68. package/dist/utils/url.js +8 -15
  69. package/package.json +1 -1
@@ -0,0 +1,35 @@
1
+ import { LabelValue } from '../../types';
2
+ import { MailType, MetaData, SummaryItemData } from './types';
3
+ import * as React from "react";
4
+ export interface SummaryAIEmailsProps {
5
+ targetEmail: string;
6
+ targetName?: string;
7
+ defaultLang?: string;
8
+ langList?: LabelValue[];
9
+ userLang?: string;
10
+ }
11
+ interface SummaryAIEmailsState {
12
+ lang: string;
13
+ mailtype: MailType;
14
+ page: number;
15
+ items: SummaryItemData[];
16
+ meta: MetaData;
17
+ isLoading: boolean;
18
+ langAnchor: HTMLElement | null;
19
+ }
20
+ declare class SummaryAIEmails extends React.Component<SummaryAIEmailsProps, SummaryAIEmailsState> {
21
+ private eventSource;
22
+ constructor(props: SummaryAIEmailsProps);
23
+ componentDidMount(): void;
24
+ componentDidUpdate(prevProps: SummaryAIEmailsProps, prevState: SummaryAIEmailsState): void;
25
+ componentWillUnmount(): void;
26
+ closeStream: () => void;
27
+ startStream: () => void;
28
+ handleChangeFilter: (val: MailType) => void;
29
+ handleChangeLang: (val: string) => void;
30
+ handleChangePage: (page: number) => void;
31
+ handleOpenLang: (anchor: HTMLElement) => void;
32
+ handleCloseLang: () => void;
33
+ render(): React.JSX.Element;
34
+ }
35
+ export default SummaryAIEmails;
@@ -0,0 +1,222 @@
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
+ import * as React from "react";
5
+ import { getBaseUrl, SDKConfig } from "../../utils/url.js";
6
+ import { t } from "../../lang/index.js";
7
+ import LoadingContainer from "../LoadingContainer/index.js";
8
+ import TargetInfoBar from "./TargetInfoBar.js";
9
+ import FilterTabs from "./FilterTabs.js";
10
+ import SummaryItem from "./SummaryItem.js";
11
+ import Pagination from "../Pagination/index.js";
12
+ import LanguagePopover from "./LanguagePopover.js";
13
+ import { PAGE_SIZE, parseDataLine, findLangLabel } from "./utils.js";
14
+ import { LangKey } from "../../lang/keyLang.js";
15
+ const INITIAL_META = {
16
+ total: 0,
17
+ receive: 0,
18
+ sent: 0,
19
+ totalPages: 1,
20
+ filterCount: 0
21
+ };
22
+ class SummaryAIEmails extends React.Component {
23
+ constructor(props) {
24
+ super(props);
25
+ __publicField(this, "eventSource", null);
26
+ __publicField(this, "closeStream", () => {
27
+ if (this.eventSource) {
28
+ this.eventSource.close();
29
+ this.eventSource = null;
30
+ }
31
+ });
32
+ __publicField(this, "startStream", () => {
33
+ const { targetEmail } = this.props;
34
+ const { lang, mailtype, page } = this.state;
35
+ if (!targetEmail) return;
36
+ this.closeStream();
37
+ this.setState({ items: [], isLoading: true });
38
+ const url = `${getBaseUrl()}/email/ai/fromsumstreaming/${encodeURIComponent(
39
+ targetEmail
40
+ )}/${lang}/${PAGE_SIZE}/${page}?mailtype=${mailtype}`;
41
+ const es = new EventSource(url);
42
+ this.eventSource = es;
43
+ es.addEventListener("meta", (ev) => {
44
+ var _a, _b, _c;
45
+ try {
46
+ const parsed = JSON.parse(ev.data || "{}");
47
+ this.setState({
48
+ meta: {
49
+ total: ((_a = parsed == null ? void 0 : parsed.counts) == null ? void 0 : _a.total) || 0,
50
+ receive: ((_b = parsed == null ? void 0 : parsed.counts) == null ? void 0 : _b.receive) || 0,
51
+ sent: ((_c = parsed == null ? void 0 : parsed.counts) == null ? void 0 : _c.sent) || 0,
52
+ totalPages: (parsed == null ? void 0 : parsed.total_pages) || 1,
53
+ filterCount: (parsed == null ? void 0 : parsed.filter_count) || 0
54
+ }
55
+ });
56
+ } catch (e) {
57
+ }
58
+ });
59
+ es.onmessage = (ev) => {
60
+ if (!(ev == null ? void 0 : ev.data)) return;
61
+ if (ev.data === "[DONE]") {
62
+ this.closeStream();
63
+ this.setState({ isLoading: false });
64
+ return;
65
+ }
66
+ const parsed = parseDataLine(ev.data);
67
+ if (parsed) {
68
+ this.setState((prev) => ({
69
+ items: [...prev.items, parsed],
70
+ isLoading: false
71
+ }));
72
+ }
73
+ };
74
+ es.onerror = () => {
75
+ this.closeStream();
76
+ this.setState({ isLoading: false });
77
+ };
78
+ });
79
+ __publicField(this, "handleChangeFilter", (val) => {
80
+ if (val === this.state.mailtype) return;
81
+ this.setState({ mailtype: val, page: 1 });
82
+ });
83
+ __publicField(this, "handleChangeLang", (val) => {
84
+ this.setState({ langAnchor: null });
85
+ if (val === this.state.lang) return;
86
+ this.setState({ lang: val, page: 1 });
87
+ });
88
+ __publicField(this, "handleChangePage", (page) => {
89
+ this.setState({ page });
90
+ });
91
+ __publicField(this, "handleOpenLang", (anchor) => {
92
+ this.setState({ langAnchor: anchor });
93
+ });
94
+ __publicField(this, "handleCloseLang", () => {
95
+ this.setState({ langAnchor: null });
96
+ });
97
+ this.state = {
98
+ lang: props.defaultLang || "ko",
99
+ mailtype: "all",
100
+ page: 1,
101
+ items: [],
102
+ meta: INITIAL_META,
103
+ isLoading: false,
104
+ langAnchor: null
105
+ };
106
+ if (props.userLang) {
107
+ SDKConfig.lang = props.userLang;
108
+ }
109
+ }
110
+ componentDidMount() {
111
+ this.startStream();
112
+ }
113
+ componentDidUpdate(prevProps, prevState) {
114
+ if (this.props.userLang !== prevProps.userLang && this.props.userLang) {
115
+ SDKConfig.lang = this.props.userLang;
116
+ this.forceUpdate();
117
+ }
118
+ const targetChanged = prevProps.targetEmail !== this.props.targetEmail;
119
+ const filterChanged = prevState.lang !== this.state.lang || prevState.mailtype !== this.state.mailtype || prevState.page !== this.state.page;
120
+ if (targetChanged || filterChanged) {
121
+ this.startStream();
122
+ }
123
+ }
124
+ componentWillUnmount() {
125
+ this.closeStream();
126
+ }
127
+ render() {
128
+ const { targetEmail, targetName, langList = [] } = this.props;
129
+ const { lang, mailtype, page, items, meta, isLoading, langAnchor } = this.state;
130
+ const currentLangLabel = findLangLabel(lang, langList);
131
+ const totalPages = Math.max(
132
+ 1,
133
+ meta.totalPages || Math.ceil((meta.filterCount || meta.total) / PAGE_SIZE)
134
+ );
135
+ const filterCount = meta.filterCount || meta.total || 0;
136
+ return /* @__PURE__ */ React.createElement(
137
+ "div",
138
+ {
139
+ style: {
140
+ display: "flex",
141
+ flexDirection: "column",
142
+ background: "var(--background-softGrey)",
143
+ padding: 16,
144
+ borderRadius: 8,
145
+ fontFamily: "inherit",
146
+ boxSizing: "border-box"
147
+ }
148
+ },
149
+ /* @__PURE__ */ React.createElement(
150
+ TargetInfoBar,
151
+ {
152
+ targetName,
153
+ targetEmail,
154
+ currentLangLabel,
155
+ onOpenLang: this.handleOpenLang
156
+ }
157
+ ),
158
+ /* @__PURE__ */ React.createElement(
159
+ FilterTabs,
160
+ {
161
+ mailtype,
162
+ onChangeFilter: this.handleChangeFilter
163
+ }
164
+ ),
165
+ /* @__PURE__ */ React.createElement(
166
+ "div",
167
+ {
168
+ style: {
169
+ display: "flex",
170
+ flexDirection: "column",
171
+ gap: 8,
172
+ minHeight: 120
173
+ }
174
+ },
175
+ isLoading && items.length === 0 && /* @__PURE__ */ React.createElement(
176
+ LoadingContainer,
177
+ {
178
+ style: { background: "#fff", borderRadius: 8, height: 160 },
179
+ size: "small"
180
+ }
181
+ ),
182
+ !isLoading && items.length === 0 && /* @__PURE__ */ React.createElement(
183
+ "div",
184
+ {
185
+ style: {
186
+ background: "#fff",
187
+ borderRadius: 8,
188
+ padding: 24,
189
+ textAlign: "center",
190
+ color: "var(--text-secondary)",
191
+ fontSize: 13
192
+ }
193
+ },
194
+ t(LangKey.NO_DATA)
195
+ ),
196
+ items.map((item, idx) => /* @__PURE__ */ React.createElement(SummaryItem, { key: idx, item }))
197
+ ),
198
+ filterCount > 0 && /* @__PURE__ */ React.createElement(
199
+ Pagination,
200
+ {
201
+ total: filterCount,
202
+ page,
203
+ totalPages,
204
+ onChangePage: this.handleChangePage
205
+ }
206
+ ),
207
+ /* @__PURE__ */ React.createElement(
208
+ LanguagePopover,
209
+ {
210
+ anchorEl: langAnchor,
211
+ langList,
212
+ currentLang: lang,
213
+ onSelect: this.handleChangeLang,
214
+ onClose: this.handleCloseLang
215
+ }
216
+ )
217
+ );
218
+ }
219
+ }
220
+ export {
221
+ SummaryAIEmails as default
222
+ };
@@ -0,0 +1,16 @@
1
+ export interface SummaryItemData {
2
+ date: string;
3
+ sig: string;
4
+ direction: "sent" | "receive";
5
+ direction_label: string;
6
+ subject: string;
7
+ messages: string;
8
+ }
9
+ export interface MetaData {
10
+ total: number;
11
+ receive: number;
12
+ sent: number;
13
+ totalPages: number;
14
+ filterCount: number;
15
+ }
16
+ export type MailType = "all" | "receive" | "sent";
@@ -0,0 +1,12 @@
1
+ import { LabelValue } from '../../types';
2
+ import { SummaryItemData, MailType } from './types';
3
+ import { LangKey } from '../../lang';
4
+
5
+ export declare const PAGE_SIZE = 5;
6
+ export declare const FILTERS: {
7
+ value: MailType;
8
+ label: LangKey;
9
+ }[];
10
+ export declare const formatDate: (raw: string) => string;
11
+ export declare const parseDataLine: (line: string) => SummaryItemData | null;
12
+ export declare const findLangLabel: (lang: string, langList: LabelValue[]) => string;
@@ -0,0 +1,47 @@
1
+ import { LangKey } from "../../lang/keyLang.js";
2
+ const PAGE_SIZE = 5;
3
+ const FILTERS = [
4
+ { value: "all", label: LangKey.ALL },
5
+ { value: "receive", label: LangKey.RECEIVED },
6
+ { value: "sent", label: LangKey.SENT }
7
+ ];
8
+ const formatDate = (raw) => {
9
+ if (!raw) return "";
10
+ return String(raw).replace(/\//g, "-");
11
+ };
12
+ const parseDataLine = (line) => {
13
+ if (!line) return null;
14
+ const trimmed = line.trim();
15
+ if (trimmed.startsWith("{")) {
16
+ try {
17
+ const parsed = JSON.parse(trimmed);
18
+ return parsed;
19
+ } catch (e) {
20
+ }
21
+ }
22
+ const parts = trimmed.split("|").map((p) => p.trim());
23
+ if (parts.length < 2) return null;
24
+ const [date, sig, subject = "", ...rest] = parts;
25
+ const messages = rest.join(" | ");
26
+ const direction = sig === "out" ? "sent" : "receive";
27
+ return {
28
+ date,
29
+ sig,
30
+ direction,
31
+ direction_label: direction === "sent" ? LangKey.SENT : LangKey.RECEIVED,
32
+ subject,
33
+ messages
34
+ };
35
+ };
36
+ const findLangLabel = (lang, langList) => {
37
+ const found = langList == null ? void 0 : langList.find((l) => l.value === lang);
38
+ if (found) return found.label;
39
+ return lang === "ko" ? "한국어" : lang;
40
+ };
41
+ export {
42
+ FILTERS,
43
+ PAGE_SIZE,
44
+ findLangLabel,
45
+ formatDate,
46
+ parseDataLine
47
+ };
@@ -1,7 +1,5 @@
1
1
  export { default as ChatAIDraft } from './ChatAIDraft';
2
2
  export { default as LoadingCircular } from './LoadingCircular';
3
3
  export { default as LoadingContainer } from './LoadingContainer';
4
- export { default as Tooltip } from './Tooltip';
5
- export type { TooltipProps, TooltipPlacement } from './Tooltip';
6
- export { default as CountryFlag } from './CountryFlag';
7
- export type { FlagCode } from './CountryFlag';
4
+ export { default as Pagination } from './Pagination';
5
+ export { default as SummaryAIEmails } from './SummaryAIEmails';
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * hanbiro-react16-sdk v1.0.27
3
- * Build Date: 2026-05-21
2
+ * hanbiro-react16-sdk v1.0.29
3
+ * Build Date: 2026-05-22
4
4
  */
5
5
  @charset "UTF-8";
6
6
  button.icon-button {
@@ -240,6 +240,11 @@ button.text-button.primary[disabled], button.text-button[color=primary][disabled
240
240
  opacity: 1;
241
241
  }
242
242
  }
243
+ input.pagination-input::-webkit-inner-spin-button, input.pagination-input::-webkit-outer-spin-button {
244
+ -webkit-appearance: none;
245
+ margin: 0;
246
+ }
247
+
243
248
  p {
244
249
  font-size: 13px;
245
250
  }