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
package/README.md
CHANGED
|
@@ -40,11 +40,12 @@ import "hanbiro-react16-sdk/style.css";
|
|
|
40
40
|
|
|
41
41
|
## Exported Utils
|
|
42
42
|
|
|
43
|
-
| Function | Description
|
|
44
|
-
| --------------------- |
|
|
45
|
-
| `initHanbiroReactSDK` | Initialize SDK (baseUrl, signer)
|
|
46
|
-
| `
|
|
47
|
-
| `
|
|
43
|
+
| Function | Description | Import path |
|
|
44
|
+
| --------------------- | ------------------------------------------- | --------------------------- |
|
|
45
|
+
| `initHanbiroReactSDK` | Initialize SDK (baseUrl, signer) | `hanbiro-react16-sdk/utils` |
|
|
46
|
+
| `setLibLang` | Set the active language for SDK components | `hanbiro-react16-sdk/utils` |
|
|
47
|
+
| `getBaseUrl` | Get the configured base URL | `hanbiro-react16-sdk/utils` |
|
|
48
|
+
| `getGroupwareUrl` | Get the groupware URL | `hanbiro-react16-sdk/utils` |
|
|
48
49
|
|
|
49
50
|
---
|
|
50
51
|
|
|
@@ -63,6 +64,58 @@ initHanbiroReactSDK({
|
|
|
63
64
|
|
|
64
65
|
---
|
|
65
66
|
|
|
67
|
+
## Language Configuration (`setLibLang`)
|
|
68
|
+
|
|
69
|
+
SDK components read their translations from a shared global config (`SDKConfig.lang`). Because some translation lookups happen at **module-load time** inside the bundled `.ts` files, the language **must be set before the SDK components are rendered** — passing it later (e.g. via a prop and `useEffect`) is too late for those module-level lookups.
|
|
70
|
+
|
|
71
|
+
Use `setLibLang` to configure the active language imperatively.
|
|
72
|
+
|
|
73
|
+
**Supported language codes:** `en`, `ko`, `vi` (defaults to `en`).
|
|
74
|
+
|
|
75
|
+
### ES Module (npm)
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
import { initHanbiroReactSDK, setLibLang } from "hanbiro-react16-sdk/utils";
|
|
79
|
+
|
|
80
|
+
// Call ONCE at app startup, before rendering any SDK component
|
|
81
|
+
initHanbiroReactSDK({
|
|
82
|
+
baseUrl: "https://vndev.hanbiro.com",
|
|
83
|
+
signer: null,
|
|
84
|
+
});
|
|
85
|
+
setLibLang("ko");
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Changing language at runtime
|
|
89
|
+
|
|
90
|
+
`setLibLang` only updates the global config — components already mounted will not re-translate module-level strings automatically. To apply a new language at runtime, set it **then** remount the SDK subtree (or reload the page):
|
|
91
|
+
|
|
92
|
+
```tsx
|
|
93
|
+
import { setLibLang } from "hanbiro-react16-sdk/utils";
|
|
94
|
+
|
|
95
|
+
function App() {
|
|
96
|
+
const [lang, setLangState] = useState("ko");
|
|
97
|
+
|
|
98
|
+
const handleLangChange = (next: string) => {
|
|
99
|
+
setLibLang(next); // update SDK config first
|
|
100
|
+
setLangState(next); // then trigger remount via `key`
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
return <ChatAIDraft key={lang} onApply={...} />;
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### UMD (script tag)
|
|
108
|
+
|
|
109
|
+
```js
|
|
110
|
+
HanbiroReact16SDK.initHanbiroReactSDK({
|
|
111
|
+
baseUrl: "https://vndev.hanbiro.com",
|
|
112
|
+
signer: null,
|
|
113
|
+
});
|
|
114
|
+
HanbiroReact16SDK.setLibLang("ko");
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
66
119
|
## Usage: ES Module (npm)
|
|
67
120
|
|
|
68
121
|
```tsx
|
|
@@ -5,6 +5,8 @@ import * as React from "react";
|
|
|
5
5
|
import { AI_LANG_FLAGS } from "../../constants/index.js";
|
|
6
6
|
import CountryFlag from "../CountryFlag/index.js";
|
|
7
7
|
import SettingPopper from "./SettingPopper/index.js";
|
|
8
|
+
import { t } from "../../lang/index.js";
|
|
9
|
+
import { LangKey } from "../../lang/keyLang.js";
|
|
8
10
|
import ArrowUp from "../../node_modules/react-feather/dist/icons/arrow-up.js";
|
|
9
11
|
class ChatInput extends React.Component {
|
|
10
12
|
constructor(props) {
|
|
@@ -73,7 +75,7 @@ class ChatInput extends React.Component {
|
|
|
73
75
|
ref: this.textareaRef,
|
|
74
76
|
value: message,
|
|
75
77
|
onChange: this.handleChange,
|
|
76
|
-
placeholder: placeholder ||
|
|
78
|
+
placeholder: placeholder || t(LangKey.CHAT_INPUT_PLACEHOLDER),
|
|
77
79
|
name: "ai-content",
|
|
78
80
|
onKeyDown: this.handleKeyDown,
|
|
79
81
|
disabled: isSending,
|
|
@@ -9,11 +9,12 @@ const LoadingDots = ({
|
|
|
9
9
|
alignItems: "center",
|
|
10
10
|
gap: 6,
|
|
11
11
|
background: "var(--background-softGrey)",
|
|
12
|
-
borderRadius:
|
|
13
|
-
borderTopLeftRadius:
|
|
12
|
+
borderRadius: 16,
|
|
13
|
+
borderTopLeftRadius: 4,
|
|
14
14
|
padding: "8px 12px",
|
|
15
15
|
fontSize: 13,
|
|
16
|
-
color: "var(--text-secondary)"
|
|
16
|
+
color: "var(--text-secondary)",
|
|
17
|
+
width: "fit-content"
|
|
17
18
|
}
|
|
18
19
|
},
|
|
19
20
|
/* @__PURE__ */ React.createElement("span", null, label),
|
|
@@ -24,6 +24,8 @@ import TypingText from "../TypingText.js";
|
|
|
24
24
|
import AIAvatar from "./AIAvatar.js";
|
|
25
25
|
import LoadingDots from "./LoadingDots.js";
|
|
26
26
|
import { buildApplyHtml } from "./helpers.js";
|
|
27
|
+
import { t } from "../../../lang/index.js";
|
|
28
|
+
import { LangKey } from "../../../lang/keyLang.js";
|
|
27
29
|
import Copy from "../../../node_modules/react-feather/dist/icons/copy.js";
|
|
28
30
|
const MessageItem = ({
|
|
29
31
|
item,
|
|
@@ -61,8 +63,8 @@ const MessageItem = ({
|
|
|
61
63
|
{
|
|
62
64
|
data: { question: item.question },
|
|
63
65
|
style: {
|
|
64
|
-
borderRadius:
|
|
65
|
-
borderTopRightRadius:
|
|
66
|
+
borderRadius: 12,
|
|
67
|
+
borderTopRightRadius: 4,
|
|
66
68
|
padding: "8px 12px",
|
|
67
69
|
background: "var(--primary-main)",
|
|
68
70
|
color: "var(--primary-contrasttext)"
|
|
@@ -100,12 +102,12 @@ const MessageItem = ({
|
|
|
100
102
|
data: { subject: item.subject, body: item.body },
|
|
101
103
|
style: {
|
|
102
104
|
background: "var(--background-softGrey)",
|
|
103
|
-
borderRadius:
|
|
104
|
-
borderTopLeftRadius:
|
|
105
|
+
borderRadius: 12,
|
|
106
|
+
borderTopLeftRadius: 4,
|
|
105
107
|
padding: "8px 12px"
|
|
106
108
|
}
|
|
107
109
|
}
|
|
108
|
-
), /* @__PURE__ */ React.createElement("div", { style: { marginTop: 4 } }, /* @__PURE__ */ React.createElement(Tooltip, { title:
|
|
110
|
+
), /* @__PURE__ */ React.createElement("div", { style: { marginTop: 4 } }, /* @__PURE__ */ React.createElement(Tooltip, { title: t(LangKey.APPLY_CONTENT) }, /* @__PURE__ */ React.createElement(
|
|
109
111
|
"button",
|
|
110
112
|
{
|
|
111
113
|
type: "button",
|
|
@@ -1,29 +1,31 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import CustomAiIcon from "../CustomAIIcon.js";
|
|
3
|
+
import { t } from "../../../lang/index.js";
|
|
4
|
+
import { LangKey } from "../../../lang/keyLang.js";
|
|
3
5
|
import MessageSquare from "../../../node_modules/react-feather/dist/icons/message-square.js";
|
|
4
6
|
import MessageCircle from "../../../node_modules/react-feather/dist/icons/message-circle.js";
|
|
5
7
|
import Check from "../../../node_modules/react-feather/dist/icons/check.js";
|
|
6
8
|
const FEATURES = [
|
|
7
9
|
{
|
|
8
10
|
icon: /* @__PURE__ */ React.createElement(MessageCircle, { size: 16 }),
|
|
9
|
-
title:
|
|
10
|
-
desc:
|
|
11
|
+
title: t(LangKey.CREATE_FEATURE_1_TITLE),
|
|
12
|
+
desc: t(LangKey.CREATE_FEATURE_1_DESC)
|
|
11
13
|
},
|
|
12
14
|
{
|
|
13
15
|
icon: /* @__PURE__ */ React.createElement(CustomAiIcon, { size: 16, stroke: 2 }),
|
|
14
|
-
title:
|
|
15
|
-
desc:
|
|
16
|
+
title: t(LangKey.CREATE_FEATURE_2_TITLE),
|
|
17
|
+
desc: t(LangKey.CREATE_FEATURE_2_DESC)
|
|
16
18
|
},
|
|
17
19
|
{
|
|
18
20
|
icon: /* @__PURE__ */ React.createElement(Check, { size: 16 }),
|
|
19
|
-
title:
|
|
20
|
-
desc:
|
|
21
|
+
title: t(LangKey.CREATE_FEATURE_3_TITLE),
|
|
22
|
+
desc: t(LangKey.CREATE_FEATURE_3_DESC)
|
|
21
23
|
}
|
|
22
24
|
];
|
|
23
25
|
const SUGGESTIONS = [
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
t(LangKey.CREATE_SUGGESTION_1),
|
|
27
|
+
t(LangKey.CREATE_SUGGESTION_2),
|
|
28
|
+
t(LangKey.CREATE_SUGGESTION_3)
|
|
27
29
|
];
|
|
28
30
|
const EmptyState = ({
|
|
29
31
|
onSelectPrompt
|
|
@@ -52,7 +54,7 @@ const EmptyState = ({
|
|
|
52
54
|
lineHeight: 1.5
|
|
53
55
|
}
|
|
54
56
|
},
|
|
55
|
-
|
|
57
|
+
t(LangKey.CREATE_EMPTY_TITLE)
|
|
56
58
|
), /* @__PURE__ */ React.createElement(
|
|
57
59
|
"div",
|
|
58
60
|
{
|
|
@@ -62,7 +64,7 @@ const EmptyState = ({
|
|
|
62
64
|
marginTop: 4
|
|
63
65
|
}
|
|
64
66
|
},
|
|
65
|
-
|
|
67
|
+
t(LangKey.CREATE_EMPTY_SUBTITLE)
|
|
66
68
|
)),
|
|
67
69
|
/* @__PURE__ */ React.createElement(
|
|
68
70
|
"div",
|
|
@@ -92,9 +94,7 @@ const EmptyState = ({
|
|
|
92
94
|
lineHeight: 1.6
|
|
93
95
|
}
|
|
94
96
|
},
|
|
95
|
-
"
|
|
96
|
-
/* @__PURE__ */ React.createElement("br", null),
|
|
97
|
-
"and AI will generate a polished draft."
|
|
97
|
+
t(LangKey.CREATE_EMPTY_GUIDE).split("\n").map((line, idx) => /* @__PURE__ */ React.createElement(React.Fragment, { key: idx }, line, /* @__PURE__ */ React.createElement("br", null)))
|
|
98
98
|
)),
|
|
99
99
|
/* @__PURE__ */ React.createElement(
|
|
100
100
|
"div",
|
|
@@ -178,7 +178,7 @@ const EmptyState = ({
|
|
|
178
178
|
marginBottom: 8
|
|
179
179
|
}
|
|
180
180
|
},
|
|
181
|
-
|
|
181
|
+
t(LangKey.CREATE_PROMPT_HINT)
|
|
182
182
|
),
|
|
183
183
|
/* @__PURE__ */ React.createElement("div", { style: { display: "flex", flexDirection: "column", gap: 8 } }, SUGGESTIONS.map((s, i) => /* @__PURE__ */ React.createElement(
|
|
184
184
|
"button",
|
|
@@ -43,7 +43,7 @@ import { callAI } from "../helper.js";
|
|
|
43
43
|
import ChatList from "../ChatList/index.js";
|
|
44
44
|
import ChatInput from "../ChatInput.js";
|
|
45
45
|
import EmptyState from "./EmptyState.js";
|
|
46
|
-
import {
|
|
46
|
+
import { getLengthOptions, getToneOptions } from "../constants.js";
|
|
47
47
|
import { AI_LANG_FLAGS } from "../../../constants/index.js";
|
|
48
48
|
import v4 from "../../../node_modules/uuid/dist/esm-browser/v4.js";
|
|
49
49
|
class CreatePanel extends React.Component {
|
|
@@ -114,8 +114,8 @@ class CreatePanel extends React.Component {
|
|
|
114
114
|
messages: [],
|
|
115
115
|
isSending: false,
|
|
116
116
|
lang,
|
|
117
|
-
tone:
|
|
118
|
-
length:
|
|
117
|
+
tone: getToneOptions()[2],
|
|
118
|
+
length: getLengthOptions()[2],
|
|
119
119
|
conversationId: ""
|
|
120
120
|
};
|
|
121
121
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
interface BaseModalProps {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
header?: React.ReactNode;
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
maxWidth?: number;
|
|
8
|
+
}
|
|
9
|
+
declare class BaseModal extends React.Component<BaseModalProps> {
|
|
10
|
+
componentDidMount(): void;
|
|
11
|
+
componentWillUnmount(): void;
|
|
12
|
+
handleKeyDown: (e: KeyboardEvent) => void;
|
|
13
|
+
render(): React.ReactPortal | null;
|
|
14
|
+
}
|
|
15
|
+
export default BaseModal;
|
|
@@ -0,0 +1,101 @@
|
|
|
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 X from "../../../node_modules/react-feather/dist/icons/x.js";
|
|
7
|
+
class BaseModal extends React.Component {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
__publicField(this, "handleKeyDown", (e) => {
|
|
11
|
+
if (e.key === "Escape" && this.props.isOpen) this.props.onClose();
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
componentDidMount() {
|
|
15
|
+
document.addEventListener("keydown", this.handleKeyDown);
|
|
16
|
+
}
|
|
17
|
+
componentWillUnmount() {
|
|
18
|
+
document.removeEventListener("keydown", this.handleKeyDown);
|
|
19
|
+
}
|
|
20
|
+
render() {
|
|
21
|
+
const { isOpen, onClose, header, children, maxWidth = 600 } = this.props;
|
|
22
|
+
if (!isOpen) return null;
|
|
23
|
+
return ReactDOM.createPortal(
|
|
24
|
+
/* @__PURE__ */ React.createElement(
|
|
25
|
+
"div",
|
|
26
|
+
{
|
|
27
|
+
onClick: onClose,
|
|
28
|
+
style: {
|
|
29
|
+
position: "fixed",
|
|
30
|
+
inset: 0,
|
|
31
|
+
background: "rgba(0, 0, 0, 0.1)",
|
|
32
|
+
display: "flex",
|
|
33
|
+
alignItems: "center",
|
|
34
|
+
justifyContent: "center",
|
|
35
|
+
zIndex: 1100,
|
|
36
|
+
padding: 16
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
/* @__PURE__ */ React.createElement(
|
|
40
|
+
"div",
|
|
41
|
+
{
|
|
42
|
+
onClick: (e) => e.stopPropagation(),
|
|
43
|
+
style: {
|
|
44
|
+
background: "#fff",
|
|
45
|
+
borderRadius: 12,
|
|
46
|
+
maxWidth,
|
|
47
|
+
width: "100%",
|
|
48
|
+
maxHeight: "80vh",
|
|
49
|
+
display: "flex",
|
|
50
|
+
flexDirection: "column",
|
|
51
|
+
boxShadow: "0 10px 40px rgba(0, 0, 0, 0.15)",
|
|
52
|
+
overflow: "hidden",
|
|
53
|
+
fontFamily: "inherit"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
/* @__PURE__ */ React.createElement(
|
|
57
|
+
"div",
|
|
58
|
+
{
|
|
59
|
+
style: {
|
|
60
|
+
display: "flex",
|
|
61
|
+
alignItems: "flex-start",
|
|
62
|
+
gap: 8,
|
|
63
|
+
padding: "16px 16px 12px",
|
|
64
|
+
borderBottom: "1px solid var(--border-light)"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
/* @__PURE__ */ React.createElement("div", { style: { flex: 1, minWidth: 0 } }, header),
|
|
68
|
+
/* @__PURE__ */ React.createElement(
|
|
69
|
+
"button",
|
|
70
|
+
{
|
|
71
|
+
type: "button",
|
|
72
|
+
onClick: onClose,
|
|
73
|
+
className: "icon-button small"
|
|
74
|
+
},
|
|
75
|
+
/* @__PURE__ */ React.createElement(X, { size: 16 })
|
|
76
|
+
)
|
|
77
|
+
),
|
|
78
|
+
/* @__PURE__ */ React.createElement(
|
|
79
|
+
"div",
|
|
80
|
+
{
|
|
81
|
+
style: {
|
|
82
|
+
flex: 1,
|
|
83
|
+
minHeight: 0,
|
|
84
|
+
overflowY: "auto",
|
|
85
|
+
padding: 16,
|
|
86
|
+
fontSize: 13,
|
|
87
|
+
lineHeight: 1.6,
|
|
88
|
+
color: "var(--text-primary)"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
children
|
|
92
|
+
)
|
|
93
|
+
)
|
|
94
|
+
),
|
|
95
|
+
document.body
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
export {
|
|
100
|
+
BaseModal as default
|
|
101
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ContextMail } from '../types';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export type PreviewMode = "ai" | "html";
|
|
4
|
+
export interface PreviewState {
|
|
5
|
+
mail: ContextMail;
|
|
6
|
+
mode: PreviewMode;
|
|
7
|
+
}
|
|
8
|
+
interface ContextPreviewModalProps {
|
|
9
|
+
preview: PreviewState | null;
|
|
10
|
+
onClose: () => void;
|
|
11
|
+
}
|
|
12
|
+
declare const ContextPreviewModal: React.FunctionComponent<ContextPreviewModalProps>;
|
|
13
|
+
export default ContextPreviewModal;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { marked } from "../../../node_modules/marked/lib/marked.esm.js";
|
|
3
|
+
import BaseModal from "./BaseModal.js";
|
|
4
|
+
import { t } from "../../../lang/index.js";
|
|
5
|
+
import { LangKey } from "../../../lang/keyLang.js";
|
|
6
|
+
const renderMarkdown = (md) => {
|
|
7
|
+
try {
|
|
8
|
+
return marked.parse(md, { async: false });
|
|
9
|
+
} catch (e) {
|
|
10
|
+
return md;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
const MailHeader = ({
|
|
14
|
+
mail
|
|
15
|
+
}) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
16
|
+
"div",
|
|
17
|
+
{
|
|
18
|
+
style: {
|
|
19
|
+
fontSize: 14,
|
|
20
|
+
fontWeight: 600,
|
|
21
|
+
color: "var(--text-primary)",
|
|
22
|
+
whiteSpace: "nowrap",
|
|
23
|
+
overflow: "hidden",
|
|
24
|
+
textOverflow: "ellipsis"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
mail.subject || t(LangKey.NO_SUBJECT)
|
|
28
|
+
), /* @__PURE__ */ React.createElement(
|
|
29
|
+
"div",
|
|
30
|
+
{
|
|
31
|
+
style: {
|
|
32
|
+
fontSize: 12,
|
|
33
|
+
color: "var(--text-secondary)",
|
|
34
|
+
marginTop: 2,
|
|
35
|
+
whiteSpace: "nowrap",
|
|
36
|
+
overflow: "hidden",
|
|
37
|
+
textOverflow: "ellipsis"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
mail.from_name,
|
|
41
|
+
mail.from_addr ? ` <${mail.from_addr}>` : "",
|
|
42
|
+
mail.date ? ` · ${mail.date}` : ""
|
|
43
|
+
));
|
|
44
|
+
const ContextPreviewModal = ({ preview, onClose }) => {
|
|
45
|
+
const html = preview ? preview.mode === "html" ? preview.mail.contents || "" : renderMarkdown(preview.mail.ai_contents || "") : "";
|
|
46
|
+
return /* @__PURE__ */ React.createElement(
|
|
47
|
+
BaseModal,
|
|
48
|
+
{
|
|
49
|
+
isOpen: !!preview,
|
|
50
|
+
onClose,
|
|
51
|
+
header: preview && /* @__PURE__ */ React.createElement(MailHeader, { mail: preview.mail }),
|
|
52
|
+
maxWidth: (preview == null ? void 0 : preview.mode) === "html" ? 900 : 600
|
|
53
|
+
},
|
|
54
|
+
preview && /* @__PURE__ */ React.createElement(
|
|
55
|
+
"div",
|
|
56
|
+
{
|
|
57
|
+
className: "chat-ai-context-preview",
|
|
58
|
+
dangerouslySetInnerHTML: { __html: html }
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
);
|
|
62
|
+
};
|
|
63
|
+
export {
|
|
64
|
+
ContextPreviewModal as default
|
|
65
|
+
};
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
import { ContextMail } from '../types';
|
|
2
1
|
import * as React from "react";
|
|
3
|
-
|
|
4
|
-
sourceMail: ContextMail | null;
|
|
5
|
-
selectedMails: ContextMail[];
|
|
6
|
-
onAddClick: () => void;
|
|
7
|
-
onRemoveSelected: (mid: string) => void;
|
|
8
|
-
}
|
|
9
|
-
declare const EmptyState: React.FunctionComponent<EmptyStateProps>;
|
|
2
|
+
declare const EmptyState: React.FunctionComponent;
|
|
10
3
|
export default EmptyState;
|