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.
- package/README.md +58 -5
- package/dist/components/ChatAIDraft/ChatInput.js +3 -1
- package/dist/components/ChatAIDraft/ChatList/LoadingDots.js +4 -3
- package/dist/components/ChatAIDraft/ChatList/MessageItem.js +7 -5
- package/dist/components/ChatAIDraft/CreatePanel/EmptyState.js +15 -15
- package/dist/components/ChatAIDraft/CreatePanel/index.js +3 -3
- package/dist/components/ChatAIDraft/ReplyPanel/BaseModal.d.ts +15 -0
- package/dist/components/ChatAIDraft/ReplyPanel/BaseModal.js +101 -0
- package/dist/components/ChatAIDraft/ReplyPanel/ContextPreviewModal.d.ts +13 -0
- package/dist/components/ChatAIDraft/ReplyPanel/ContextPreviewModal.js +65 -0
- package/dist/components/ChatAIDraft/ReplyPanel/EmptyState.d.ts +1 -8
- package/dist/components/ChatAIDraft/ReplyPanel/EmptyState.js +11 -227
- package/dist/components/ChatAIDraft/ReplyPanel/Header/SelectedChip.d.ts +10 -0
- package/dist/components/ChatAIDraft/ReplyPanel/Header/SelectedChip.js +79 -0
- package/dist/components/ChatAIDraft/ReplyPanel/Header/SourceCard.d.ts +8 -0
- package/dist/components/ChatAIDraft/ReplyPanel/Header/SourceCard.js +52 -0
- package/dist/components/ChatAIDraft/ReplyPanel/Header/index.d.ts +12 -0
- package/dist/components/ChatAIDraft/ReplyPanel/Header/index.js +139 -0
- package/dist/components/ChatAIDraft/ReplyPanel/MailListSelect.d.ts +1 -0
- package/dist/components/ChatAIDraft/ReplyPanel/MailListSelect.js +71 -155
- package/dist/components/ChatAIDraft/ReplyPanel/index.d.ts +5 -1
- package/dist/components/ChatAIDraft/ReplyPanel/index.js +42 -201
- package/dist/components/ChatAIDraft/SettingPopper/index.js +8 -6
- package/dist/components/ChatAIDraft/constants.d.ts +2 -2
- package/dist/components/ChatAIDraft/constants.js +16 -14
- package/dist/components/ChatAIDraft/index.d.ts +1 -0
- package/dist/components/ChatAIDraft/index.js +7 -1
- package/dist/components/Pagination/index.d.ts +20 -0
- package/dist/components/Pagination/index.js +133 -0
- package/dist/components/SummaryAIEmails/FilterTabs.d.ts +8 -0
- package/dist/components/SummaryAIEmails/FilterTabs.js +59 -0
- package/dist/components/SummaryAIEmails/LanguagePopover.d.ts +24 -0
- package/dist/components/SummaryAIEmails/LanguagePopover.js +110 -0
- package/dist/components/SummaryAIEmails/SummaryItem.d.ts +7 -0
- package/dist/components/SummaryAIEmails/SummaryItem.js +76 -0
- package/dist/components/SummaryAIEmails/TargetInfoBar.d.ts +9 -0
- package/dist/components/SummaryAIEmails/TargetInfoBar.js +81 -0
- package/dist/components/SummaryAIEmails/index.d.ts +35 -0
- package/dist/components/SummaryAIEmails/index.js +222 -0
- package/dist/components/SummaryAIEmails/types.d.ts +16 -0
- package/dist/components/SummaryAIEmails/utils.d.ts +12 -0
- package/dist/components/SummaryAIEmails/utils.js +47 -0
- package/dist/components/index.d.ts +2 -4
- package/dist/hanbiro-react16-sdk.style.css +7 -2
- package/dist/hanbiro-react16-sdk.umd.js +2169 -1033
- package/dist/index.js +13 -14
- package/dist/lang/en.d.ts +3 -0
- package/dist/lang/en.js +66 -0
- package/dist/lang/index.d.ts +4 -0
- package/dist/lang/index.js +18 -0
- package/dist/lang/keyLang.d.ts +62 -0
- package/dist/lang/keyLang.js +66 -0
- package/dist/lang/ko.d.ts +3 -0
- package/dist/lang/ko.js +66 -0
- package/dist/lang/vi.d.ts +3 -0
- package/dist/lang/vi.js +66 -0
- package/dist/node_modules/react-feather/dist/icons/arrow-down.js +73 -0
- package/dist/node_modules/react-feather/dist/icons/chevron-left.js +68 -0
- package/dist/node_modules/react-feather/dist/icons/chevron-right.js +68 -0
- package/dist/node_modules/react-feather/dist/icons/globe.js +77 -0
- package/dist/node_modules/react-feather/dist/icons/x.js +76 -0
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/lang.d.ts +1 -0
- package/dist/utils/lang.js +30 -0
- package/dist/utils/storage.d.ts +8 -0
- package/dist/utils/storage.js +19 -0
- package/dist/utils/url.d.ts +2 -0
- package/dist/utils/url.js +8 -15
- package/package.json +1 -1
|
@@ -24,11 +24,13 @@ var __async = (__this, __arguments, generator) => {
|
|
|
24
24
|
import * as React from "react";
|
|
25
25
|
import * as ReactDOM from "react-dom";
|
|
26
26
|
import { apiGet } from "../../../utils/api.js";
|
|
27
|
-
import {
|
|
27
|
+
import { getToneOptions, getLengthOptions } from "../constants.js";
|
|
28
28
|
import LanguageSelect from "./LanguageSelect.js";
|
|
29
29
|
import ChipGroup from "./ChipGroup.js";
|
|
30
30
|
import { TONE_ICONS, LENGTH_ICONS } from "./icons.js";
|
|
31
|
+
import { t } from "../../../lang/index.js";
|
|
31
32
|
import Settings from "../../../node_modules/react-feather/dist/icons/settings.js";
|
|
33
|
+
import { LangKey } from "../../../lang/keyLang.js";
|
|
32
34
|
class SettingPopper extends React.Component {
|
|
33
35
|
constructor(props) {
|
|
34
36
|
super(props);
|
|
@@ -130,7 +132,7 @@ class SettingPopper extends React.Component {
|
|
|
130
132
|
{
|
|
131
133
|
style: { display: "flex", flexDirection: "column", gap: 6 }
|
|
132
134
|
},
|
|
133
|
-
/* @__PURE__ */ React.createElement("span", { style: { fontSize: 12, fontWeight: 600 } },
|
|
135
|
+
/* @__PURE__ */ React.createElement("span", { style: { fontSize: 12, fontWeight: 600 } }, t(LangKey.SETTING_LANGUAGE)),
|
|
134
136
|
/* @__PURE__ */ React.createElement(
|
|
135
137
|
LanguageSelect,
|
|
136
138
|
{
|
|
@@ -145,11 +147,11 @@ class SettingPopper extends React.Component {
|
|
|
145
147
|
{
|
|
146
148
|
style: { display: "flex", flexDirection: "column", gap: 6 }
|
|
147
149
|
},
|
|
148
|
-
/* @__PURE__ */ React.createElement("span", { style: { fontSize: 12, fontWeight: 600 } },
|
|
150
|
+
/* @__PURE__ */ React.createElement("span", { style: { fontSize: 12, fontWeight: 600 } }, t(LangKey.SETTING_TONE)),
|
|
149
151
|
/* @__PURE__ */ React.createElement(
|
|
150
152
|
ChipGroup,
|
|
151
153
|
{
|
|
152
|
-
options:
|
|
154
|
+
options: getToneOptions(),
|
|
153
155
|
selected: tone,
|
|
154
156
|
onSelect: (opt) => setTone(opt),
|
|
155
157
|
iconMap: TONE_ICONS
|
|
@@ -161,11 +163,11 @@ class SettingPopper extends React.Component {
|
|
|
161
163
|
{
|
|
162
164
|
style: { display: "flex", flexDirection: "column", gap: 6 }
|
|
163
165
|
},
|
|
164
|
-
/* @__PURE__ */ React.createElement("span", { style: { fontSize: 12, fontWeight: 600 } },
|
|
166
|
+
/* @__PURE__ */ React.createElement("span", { style: { fontSize: 12, fontWeight: 600 } }, t(LangKey.SETTING_LENGTH)),
|
|
165
167
|
/* @__PURE__ */ React.createElement(
|
|
166
168
|
ChipGroup,
|
|
167
169
|
{
|
|
168
|
-
options:
|
|
170
|
+
options: getLengthOptions(),
|
|
169
171
|
selected: length,
|
|
170
172
|
onSelect: (opt) => setLength(opt),
|
|
171
173
|
iconMap: LENGTH_ICONS,
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
{ label:
|
|
5
|
-
{ label:
|
|
6
|
-
{ label:
|
|
7
|
-
{ label:
|
|
1
|
+
import { t } from "../../lang/index.js";
|
|
2
|
+
import { LangKey } from "../../lang/keyLang.js";
|
|
3
|
+
const getToneOptions = () => [
|
|
4
|
+
{ label: t(LangKey.TONE_FORMAL), value: "formal" },
|
|
5
|
+
{ label: t(LangKey.TONE_POLITE), value: "polite" },
|
|
6
|
+
{ label: t(LangKey.TONE_NEUTRAL), value: "neutral" },
|
|
7
|
+
{ label: t(LangKey.TONE_FRIENDLY), value: "friendly" },
|
|
8
|
+
{ label: t(LangKey.TONE_FIRM), value: "firm" },
|
|
9
|
+
{ label: t(LangKey.TONE_APOLOGY), value: "apologetic" }
|
|
8
10
|
];
|
|
9
|
-
const
|
|
10
|
-
{ label:
|
|
11
|
-
{ label:
|
|
12
|
-
{ label:
|
|
13
|
-
{ label:
|
|
11
|
+
const getLengthOptions = () => [
|
|
12
|
+
{ label: t(LangKey.LENGTH_SHORT), value: "short" },
|
|
13
|
+
{ label: t(LangKey.LENGTH_MEDIUM), value: "medium" },
|
|
14
|
+
{ label: t(LangKey.LENGTH_LONG), value: "long" },
|
|
15
|
+
{ label: t(LangKey.LENGTH_ONE_LINER), value: "one_liner" }
|
|
14
16
|
];
|
|
15
17
|
export {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
getLengthOptions,
|
|
19
|
+
getToneOptions
|
|
18
20
|
};
|
|
@@ -29,8 +29,14 @@ var __objRest = (source, exclude) => {
|
|
|
29
29
|
import * as React from "react";
|
|
30
30
|
import CreatePanel from "./CreatePanel/index.js";
|
|
31
31
|
import ReplyPanel from "./ReplyPanel/index.js";
|
|
32
|
+
import { SDKConfig } from "../../utils/url.js";
|
|
32
33
|
const ChatAIDraft = (props) => {
|
|
33
|
-
const _a = props, { type = "new", sourceMid } = _a, rest = __objRest(_a, ["type", "sourceMid"]);
|
|
34
|
+
const _a = props, { type = "new", sourceMid, userLang } = _a, rest = __objRest(_a, ["type", "sourceMid", "userLang"]);
|
|
35
|
+
React.useEffect(() => {
|
|
36
|
+
if (userLang) {
|
|
37
|
+
SDKConfig.lang = userLang;
|
|
38
|
+
}
|
|
39
|
+
}, [userLang]);
|
|
34
40
|
if ((type === "reply" || type === "forward") && sourceMid) {
|
|
35
41
|
return /* @__PURE__ */ React.createElement(ReplyPanel, __spreadValues({ type, sourceMid }, rest));
|
|
36
42
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
interface PaginationProps {
|
|
3
|
+
total: number;
|
|
4
|
+
page: number;
|
|
5
|
+
totalPages: number;
|
|
6
|
+
onChangePage: (page: number) => void;
|
|
7
|
+
}
|
|
8
|
+
interface PaginationState {
|
|
9
|
+
inputValue: string;
|
|
10
|
+
}
|
|
11
|
+
declare class Pagination extends React.Component<PaginationProps, PaginationState> {
|
|
12
|
+
constructor(props: PaginationProps);
|
|
13
|
+
componentDidUpdate(prevProps: PaginationProps): void;
|
|
14
|
+
clamp: (value: number) => number;
|
|
15
|
+
handleInputChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
16
|
+
commit: () => void;
|
|
17
|
+
handleKeyDown: (e: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
18
|
+
render(): React.JSX.Element;
|
|
19
|
+
}
|
|
20
|
+
export default Pagination;
|
|
@@ -0,0 +1,133 @@
|
|
|
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 { t } from "../../lang/index.js";
|
|
6
|
+
import { LangKey } from "../../lang/keyLang.js";
|
|
7
|
+
import ChevronLeft from "../../node_modules/react-feather/dist/icons/chevron-left.js";
|
|
8
|
+
import ChevronRight from "../../node_modules/react-feather/dist/icons/chevron-right.js";
|
|
9
|
+
class Pagination extends React.Component {
|
|
10
|
+
constructor(props) {
|
|
11
|
+
super(props);
|
|
12
|
+
__publicField(this, "clamp", (value) => {
|
|
13
|
+
const { totalPages } = this.props;
|
|
14
|
+
if (Number.isNaN(value)) return this.props.page;
|
|
15
|
+
return Math.min(Math.max(1, Math.floor(value)), Math.max(1, totalPages));
|
|
16
|
+
});
|
|
17
|
+
__publicField(this, "handleInputChange", (e) => {
|
|
18
|
+
this.setState({ inputValue: e.target.value });
|
|
19
|
+
});
|
|
20
|
+
__publicField(this, "commit", () => {
|
|
21
|
+
const next = this.clamp(parseInt(this.state.inputValue, 10));
|
|
22
|
+
this.setState({ inputValue: String(next) });
|
|
23
|
+
if (next !== this.props.page) {
|
|
24
|
+
this.props.onChangePage(next);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
__publicField(this, "handleKeyDown", (e) => {
|
|
28
|
+
if (e.key === "Enter") {
|
|
29
|
+
e.preventDefault();
|
|
30
|
+
this.commit();
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
this.state = { inputValue: String(props.page) };
|
|
34
|
+
}
|
|
35
|
+
componentDidUpdate(prevProps) {
|
|
36
|
+
if (prevProps.page !== this.props.page) {
|
|
37
|
+
this.setState({ inputValue: String(this.props.page) });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
render() {
|
|
41
|
+
const { total, page, totalPages, onChangePage } = this.props;
|
|
42
|
+
const { inputValue } = this.state;
|
|
43
|
+
return /* @__PURE__ */ React.createElement(
|
|
44
|
+
"div",
|
|
45
|
+
{
|
|
46
|
+
style: {
|
|
47
|
+
display: "flex",
|
|
48
|
+
alignItems: "center",
|
|
49
|
+
justifyContent: "space-between",
|
|
50
|
+
gap: 8,
|
|
51
|
+
padding: "8px 0",
|
|
52
|
+
marginTop: 8,
|
|
53
|
+
borderTop: "1px solid var(--border-light)"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
/* @__PURE__ */ React.createElement("span", { style: { fontSize: 12, color: "var(--text-secondary)" } }, t(LangKey.PAGINATION_TOTAL), " ", total, " | ", t(LangKey.PAGINATION_PAGE_OF), " ", page, " / ", totalPages),
|
|
57
|
+
/* @__PURE__ */ React.createElement(
|
|
58
|
+
"div",
|
|
59
|
+
{
|
|
60
|
+
style: {
|
|
61
|
+
display: "inline-flex",
|
|
62
|
+
alignItems: "center",
|
|
63
|
+
gap: 4
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
/* @__PURE__ */ React.createElement(
|
|
67
|
+
"button",
|
|
68
|
+
{
|
|
69
|
+
type: "button",
|
|
70
|
+
onClick: () => page > 1 && onChangePage(page - 1),
|
|
71
|
+
disabled: page <= 1,
|
|
72
|
+
className: "icon-button small"
|
|
73
|
+
},
|
|
74
|
+
/* @__PURE__ */ React.createElement(ChevronLeft, { size: 14 })
|
|
75
|
+
),
|
|
76
|
+
/* @__PURE__ */ React.createElement(
|
|
77
|
+
"button",
|
|
78
|
+
{
|
|
79
|
+
type: "button",
|
|
80
|
+
onClick: () => page < totalPages && onChangePage(page + 1),
|
|
81
|
+
disabled: page >= totalPages,
|
|
82
|
+
className: "icon-button small"
|
|
83
|
+
},
|
|
84
|
+
/* @__PURE__ */ React.createElement(ChevronRight, { size: 14 })
|
|
85
|
+
),
|
|
86
|
+
/* @__PURE__ */ React.createElement(
|
|
87
|
+
"span",
|
|
88
|
+
{
|
|
89
|
+
style: {
|
|
90
|
+
fontSize: 12,
|
|
91
|
+
color: "var(--text-secondary)",
|
|
92
|
+
marginLeft: 4
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
t(LangKey.PAGINATION_PAGE)
|
|
96
|
+
),
|
|
97
|
+
/* @__PURE__ */ React.createElement(
|
|
98
|
+
"input",
|
|
99
|
+
{
|
|
100
|
+
type: "number",
|
|
101
|
+
min: 1,
|
|
102
|
+
max: Math.max(1, totalPages),
|
|
103
|
+
value: inputValue,
|
|
104
|
+
onChange: this.handleInputChange,
|
|
105
|
+
onBlur: this.commit,
|
|
106
|
+
onKeyDown: this.handleKeyDown,
|
|
107
|
+
className: "pagination-input",
|
|
108
|
+
style: {
|
|
109
|
+
width: `${Math.min(
|
|
110
|
+
4,
|
|
111
|
+
Math.max(1, inputValue.length || 1)
|
|
112
|
+
) * 10 + 14}px`,
|
|
113
|
+
height: 24,
|
|
114
|
+
padding: "0 6px 0 6px",
|
|
115
|
+
borderRadius: 4,
|
|
116
|
+
border: "1px solid var(--border-light)",
|
|
117
|
+
background: "#fff",
|
|
118
|
+
fontSize: 12,
|
|
119
|
+
color: "var(--text-primary)",
|
|
120
|
+
textAlign: "center",
|
|
121
|
+
fontFamily: "inherit",
|
|
122
|
+
outline: "none",
|
|
123
|
+
MozAppearance: "textfield"
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
)
|
|
127
|
+
)
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
export {
|
|
132
|
+
Pagination as default
|
|
133
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MailType } from './types';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
interface FilterTabsProps {
|
|
4
|
+
mailtype: MailType;
|
|
5
|
+
onChangeFilter: (val: MailType) => void;
|
|
6
|
+
}
|
|
7
|
+
declare const FilterTabs: React.FunctionComponent<FilterTabsProps>;
|
|
8
|
+
export default FilterTabs;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { FILTERS } from "./utils.js";
|
|
3
|
+
import { t } from "../../lang/index.js";
|
|
4
|
+
import { LangKey } from "../../lang/keyLang.js";
|
|
5
|
+
const FilterTabs = ({
|
|
6
|
+
mailtype,
|
|
7
|
+
onChangeFilter
|
|
8
|
+
}) => /* @__PURE__ */ React.createElement(
|
|
9
|
+
"div",
|
|
10
|
+
{
|
|
11
|
+
style: {
|
|
12
|
+
display: "flex",
|
|
13
|
+
justifyContent: "space-between",
|
|
14
|
+
alignItems: "center",
|
|
15
|
+
marginBottom: 12,
|
|
16
|
+
gap: 8
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
/* @__PURE__ */ React.createElement("span", { style: { fontSize: 13, color: "var(--text-secondary)" } }, t(LangKey.SUMMARY_WARNING)),
|
|
20
|
+
/* @__PURE__ */ React.createElement(
|
|
21
|
+
"div",
|
|
22
|
+
{
|
|
23
|
+
style: {
|
|
24
|
+
display: "inline-flex",
|
|
25
|
+
background: "var(--background-softGrey)",
|
|
26
|
+
borderRadius: 6,
|
|
27
|
+
padding: 2,
|
|
28
|
+
flexShrink: 0
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
FILTERS.map((f) => {
|
|
32
|
+
const isActive = mailtype === f.value;
|
|
33
|
+
return /* @__PURE__ */ React.createElement(
|
|
34
|
+
"button",
|
|
35
|
+
{
|
|
36
|
+
key: f.value,
|
|
37
|
+
type: "button",
|
|
38
|
+
onClick: () => onChangeFilter(f.value),
|
|
39
|
+
style: {
|
|
40
|
+
border: "none",
|
|
41
|
+
background: isActive ? "var(--primary-main)" : "transparent",
|
|
42
|
+
color: isActive ? "var(--primary-contrasttext)" : "var(--text-primary)",
|
|
43
|
+
fontSize: 12,
|
|
44
|
+
fontWeight: isActive ? 600 : 400,
|
|
45
|
+
padding: "4px 12px",
|
|
46
|
+
borderRadius: 4,
|
|
47
|
+
cursor: "pointer",
|
|
48
|
+
fontFamily: "inherit",
|
|
49
|
+
transition: "background 0.15s ease-in-out"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
t(f.label)
|
|
53
|
+
);
|
|
54
|
+
})
|
|
55
|
+
)
|
|
56
|
+
);
|
|
57
|
+
export {
|
|
58
|
+
FilterTabs as default
|
|
59
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { LabelValue } from '../../types';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
interface LanguagePopoverProps {
|
|
4
|
+
anchorEl: HTMLElement | null;
|
|
5
|
+
langList: LabelValue[];
|
|
6
|
+
currentLang: string;
|
|
7
|
+
onSelect: (val: string) => void;
|
|
8
|
+
onClose: () => void;
|
|
9
|
+
}
|
|
10
|
+
interface LanguagePopoverState {
|
|
11
|
+
top: number;
|
|
12
|
+
left: number;
|
|
13
|
+
}
|
|
14
|
+
declare class LanguagePopover extends React.Component<LanguagePopoverProps, LanguagePopoverState> {
|
|
15
|
+
private panelRef;
|
|
16
|
+
constructor(props: LanguagePopoverProps);
|
|
17
|
+
componentDidMount(): void;
|
|
18
|
+
componentDidUpdate(prevProps: LanguagePopoverProps): void;
|
|
19
|
+
componentWillUnmount(): void;
|
|
20
|
+
updatePosition: () => void;
|
|
21
|
+
handleClickOutside: (e: MouseEvent) => void;
|
|
22
|
+
render(): React.ReactPortal | null;
|
|
23
|
+
}
|
|
24
|
+
export default LanguagePopover;
|
|
@@ -0,0 +1,110 @@
|
|
|
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 * as ReactDOM from "react-dom";
|
|
6
|
+
import { AI_LANG_FLAGS } from "../../constants/index.js";
|
|
7
|
+
import CountryFlag from "../CountryFlag/index.js";
|
|
8
|
+
const getFlagCode = (value) => {
|
|
9
|
+
var _a;
|
|
10
|
+
return (_a = AI_LANG_FLAGS.find((l) => l.value === value)) == null ? void 0 : _a.flagCode;
|
|
11
|
+
};
|
|
12
|
+
class LanguagePopover extends React.Component {
|
|
13
|
+
constructor(props) {
|
|
14
|
+
super(props);
|
|
15
|
+
__publicField(this, "panelRef");
|
|
16
|
+
__publicField(this, "updatePosition", () => {
|
|
17
|
+
const { anchorEl } = this.props;
|
|
18
|
+
if (!anchorEl) return;
|
|
19
|
+
const rect = anchorEl.getBoundingClientRect();
|
|
20
|
+
const top = rect.bottom + (window.scrollY || document.documentElement.scrollTop) + 4;
|
|
21
|
+
const right = window.innerWidth - rect.right - (window.scrollX || document.documentElement.scrollLeft);
|
|
22
|
+
this.setState({ top, left: window.innerWidth - right - 180 });
|
|
23
|
+
});
|
|
24
|
+
__publicField(this, "handleClickOutside", (e) => {
|
|
25
|
+
const target = e.target;
|
|
26
|
+
if (this.panelRef.current && !this.panelRef.current.contains(target) && this.props.anchorEl && !this.props.anchorEl.contains(target)) {
|
|
27
|
+
this.props.onClose();
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
this.panelRef = React.createRef();
|
|
31
|
+
this.state = { top: 0, left: 0 };
|
|
32
|
+
}
|
|
33
|
+
componentDidMount() {
|
|
34
|
+
document.addEventListener("mousedown", this.handleClickOutside);
|
|
35
|
+
this.updatePosition();
|
|
36
|
+
}
|
|
37
|
+
componentDidUpdate(prevProps) {
|
|
38
|
+
if (prevProps.anchorEl !== this.props.anchorEl) {
|
|
39
|
+
this.updatePosition();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
componentWillUnmount() {
|
|
43
|
+
document.removeEventListener("mousedown", this.handleClickOutside);
|
|
44
|
+
}
|
|
45
|
+
render() {
|
|
46
|
+
const { anchorEl, langList, currentLang, onSelect } = this.props;
|
|
47
|
+
if (!anchorEl) return null;
|
|
48
|
+
const { top, left } = this.state;
|
|
49
|
+
return ReactDOM.createPortal(
|
|
50
|
+
/* @__PURE__ */ React.createElement(
|
|
51
|
+
"div",
|
|
52
|
+
{
|
|
53
|
+
ref: this.panelRef,
|
|
54
|
+
style: {
|
|
55
|
+
position: "absolute",
|
|
56
|
+
top,
|
|
57
|
+
left,
|
|
58
|
+
width: 180,
|
|
59
|
+
maxHeight: 280,
|
|
60
|
+
overflowY: "auto",
|
|
61
|
+
background: "#fff",
|
|
62
|
+
border: "1px solid var(--border-main)",
|
|
63
|
+
borderRadius: 6,
|
|
64
|
+
boxShadow: "0 4px 12px rgba(0, 0, 0, 0.08)",
|
|
65
|
+
zIndex: 1200,
|
|
66
|
+
padding: "4px 0"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
langList.map((l) => {
|
|
70
|
+
const isActive = l.value === currentLang;
|
|
71
|
+
const flag = getFlagCode(l.value);
|
|
72
|
+
return /* @__PURE__ */ React.createElement(
|
|
73
|
+
"button",
|
|
74
|
+
{
|
|
75
|
+
key: l.value,
|
|
76
|
+
type: "button",
|
|
77
|
+
onClick: () => onSelect(l.value),
|
|
78
|
+
style: {
|
|
79
|
+
width: "100%",
|
|
80
|
+
display: "flex",
|
|
81
|
+
alignItems: "center",
|
|
82
|
+
gap: 8,
|
|
83
|
+
padding: "8px 12px",
|
|
84
|
+
border: "none",
|
|
85
|
+
background: isActive ? "var(--primary-lighter)" : "transparent",
|
|
86
|
+
cursor: "pointer",
|
|
87
|
+
fontSize: 13,
|
|
88
|
+
fontFamily: "inherit",
|
|
89
|
+
textAlign: "left",
|
|
90
|
+
color: "var(--text-primary)"
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
flag && /* @__PURE__ */ React.createElement(
|
|
94
|
+
CountryFlag,
|
|
95
|
+
{
|
|
96
|
+
flagCode: flag,
|
|
97
|
+
style: { width: 18, height: 14, flexShrink: 0 }
|
|
98
|
+
}
|
|
99
|
+
),
|
|
100
|
+
/* @__PURE__ */ React.createElement("span", null, l.label)
|
|
101
|
+
);
|
|
102
|
+
})
|
|
103
|
+
),
|
|
104
|
+
document.body
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
export {
|
|
109
|
+
LanguagePopover as default
|
|
110
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { formatDate } from "./utils.js";
|
|
3
|
+
import { t } from "../../lang/index.js";
|
|
4
|
+
import ArrowUp from "../../node_modules/react-feather/dist/icons/arrow-up.js";
|
|
5
|
+
import ArrowDown from "../../node_modules/react-feather/dist/icons/arrow-down.js";
|
|
6
|
+
import { LangKey } from "../../lang/keyLang.js";
|
|
7
|
+
const SummaryItem = ({ item }) => {
|
|
8
|
+
const isSent = (item == null ? void 0 : item.direction) === "sent" || (item == null ? void 0 : item.sig) === "out";
|
|
9
|
+
return /* @__PURE__ */ React.createElement(
|
|
10
|
+
"div",
|
|
11
|
+
{
|
|
12
|
+
style: {
|
|
13
|
+
background: "#fff",
|
|
14
|
+
border: "1px solid var(--border-light)",
|
|
15
|
+
borderRadius: 8,
|
|
16
|
+
padding: 12
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
/* @__PURE__ */ React.createElement(
|
|
20
|
+
"div",
|
|
21
|
+
{
|
|
22
|
+
style: {
|
|
23
|
+
display: "flex",
|
|
24
|
+
alignItems: "center",
|
|
25
|
+
gap: 8,
|
|
26
|
+
marginBottom: 4
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
/* @__PURE__ */ React.createElement("span", { style: { color: "var(--text-secondary)", fontSize: 12 } }, formatDate(item == null ? void 0 : item.date)),
|
|
30
|
+
/* @__PURE__ */ React.createElement(
|
|
31
|
+
"span",
|
|
32
|
+
{
|
|
33
|
+
style: {
|
|
34
|
+
display: "inline-flex",
|
|
35
|
+
alignItems: "center",
|
|
36
|
+
gap: 2,
|
|
37
|
+
padding: "2px 6px",
|
|
38
|
+
borderRadius: 4,
|
|
39
|
+
fontSize: 11,
|
|
40
|
+
fontWeight: 500,
|
|
41
|
+
background: isSent ? "rgba(33, 150, 243, 0.1)" : "rgba(76, 175, 80, 0.1)",
|
|
42
|
+
color: isSent ? "#1976d2" : "#2e7d32"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
isSent ? /* @__PURE__ */ React.createElement(ArrowUp, { size: 11 }) : /* @__PURE__ */ React.createElement(ArrowDown, { size: 11 }),
|
|
46
|
+
t(isSent ? LangKey.SENT : LangKey.RECEIVED)
|
|
47
|
+
)
|
|
48
|
+
),
|
|
49
|
+
/* @__PURE__ */ React.createElement(
|
|
50
|
+
"div",
|
|
51
|
+
{
|
|
52
|
+
style: {
|
|
53
|
+
fontSize: 14,
|
|
54
|
+
fontWeight: 600,
|
|
55
|
+
color: "var(--text-primary)",
|
|
56
|
+
marginBottom: 4
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
(item == null ? void 0 : item.subject) || "-"
|
|
60
|
+
),
|
|
61
|
+
/* @__PURE__ */ React.createElement(
|
|
62
|
+
"div",
|
|
63
|
+
{
|
|
64
|
+
style: {
|
|
65
|
+
fontSize: 13,
|
|
66
|
+
color: "var(--text-secondary)",
|
|
67
|
+
lineHeight: 1.5
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
(item == null ? void 0 : item.messages) || ""
|
|
71
|
+
)
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
export {
|
|
75
|
+
SummaryItem as default
|
|
76
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
interface TargetInfoBarProps {
|
|
3
|
+
targetName?: string;
|
|
4
|
+
targetEmail: string;
|
|
5
|
+
currentLangLabel: string;
|
|
6
|
+
onOpenLang: (anchor: HTMLElement) => void;
|
|
7
|
+
}
|
|
8
|
+
declare const TargetInfoBar: React.FunctionComponent<TargetInfoBarProps>;
|
|
9
|
+
export default TargetInfoBar;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import Globe from "../../node_modules/react-feather/dist/icons/globe.js";
|
|
3
|
+
import ChevronDown from "../../node_modules/react-feather/dist/icons/chevron-down.js";
|
|
4
|
+
const TargetInfoBar = ({
|
|
5
|
+
targetName,
|
|
6
|
+
targetEmail,
|
|
7
|
+
currentLangLabel,
|
|
8
|
+
onOpenLang
|
|
9
|
+
}) => /* @__PURE__ */ React.createElement(
|
|
10
|
+
"div",
|
|
11
|
+
{
|
|
12
|
+
style: {
|
|
13
|
+
display: "flex",
|
|
14
|
+
justifyContent: "space-between",
|
|
15
|
+
alignItems: "center",
|
|
16
|
+
marginBottom: 12,
|
|
17
|
+
gap: 8
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
/* @__PURE__ */ React.createElement(
|
|
21
|
+
"span",
|
|
22
|
+
{
|
|
23
|
+
style: {
|
|
24
|
+
fontSize: 13,
|
|
25
|
+
display: "flex",
|
|
26
|
+
flexWrap: "wrap",
|
|
27
|
+
alignItems: "center",
|
|
28
|
+
gap: 6,
|
|
29
|
+
minWidth: 0
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
targetName && /* @__PURE__ */ React.createElement(
|
|
33
|
+
"span",
|
|
34
|
+
{
|
|
35
|
+
style: {
|
|
36
|
+
fontSize: 14,
|
|
37
|
+
fontWeight: 600,
|
|
38
|
+
color: "var(--text-primary)"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
targetName
|
|
42
|
+
),
|
|
43
|
+
targetEmail && /* @__PURE__ */ React.createElement(
|
|
44
|
+
"span",
|
|
45
|
+
{
|
|
46
|
+
style: {
|
|
47
|
+
color: "var(--text-secondary)",
|
|
48
|
+
whiteSpace: "nowrap",
|
|
49
|
+
overflow: "hidden",
|
|
50
|
+
textOverflow: "ellipsis"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
targetEmail
|
|
54
|
+
)
|
|
55
|
+
),
|
|
56
|
+
/* @__PURE__ */ React.createElement(
|
|
57
|
+
"span",
|
|
58
|
+
{
|
|
59
|
+
style: {
|
|
60
|
+
display: "inline-flex",
|
|
61
|
+
alignItems: "center",
|
|
62
|
+
gap: 6,
|
|
63
|
+
flexShrink: 0
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
/* @__PURE__ */ React.createElement("span", { style: { fontSize: 13, color: "var(--text-primary)" } }, currentLangLabel),
|
|
67
|
+
/* @__PURE__ */ React.createElement(
|
|
68
|
+
"button",
|
|
69
|
+
{
|
|
70
|
+
type: "button",
|
|
71
|
+
onClick: (e) => onOpenLang(e.currentTarget),
|
|
72
|
+
className: "icon-button small"
|
|
73
|
+
},
|
|
74
|
+
/* @__PURE__ */ React.createElement(Globe, { size: 14 }),
|
|
75
|
+
/* @__PURE__ */ React.createElement(ChevronDown, { size: 12, style: { marginLeft: 2 } })
|
|
76
|
+
)
|
|
77
|
+
)
|
|
78
|
+
);
|
|
79
|
+
export {
|
|
80
|
+
TargetInfoBar as default
|
|
81
|
+
};
|