hanbiro-react16-sdk 1.0.18 → 1.0.19

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 (106) hide show
  1. package/README.md +2 -19
  2. package/dist/_virtual/_commonjsHelpers.js +6 -0
  3. package/dist/_virtual/index.js +4 -0
  4. package/dist/components/ChatAIDraft/CustomAIIcon.js +63 -0
  5. package/dist/components/ChatAIDraft/List.js +151 -0
  6. package/dist/components/ChatAIDraft/SettingPopper.js +225 -0
  7. package/dist/components/ChatAIDraft/TypingText.js +39 -0
  8. package/dist/components/ChatAIDraft/helper.js +121 -0
  9. package/dist/components/ChatAIDraft/index.js +281 -0
  10. package/dist/components/CountryFlag/flags/CNFlag.js +27 -0
  11. package/dist/components/CountryFlag/flags/DEFlag.js +21 -0
  12. package/dist/components/CountryFlag/flags/ESFlag.js +457 -0
  13. package/dist/components/CountryFlag/flags/FRFlag.js +21 -0
  14. package/dist/components/CountryFlag/flags/IDFlag.js +21 -0
  15. package/dist/components/CountryFlag/flags/ITFlag.js +21 -0
  16. package/dist/components/CountryFlag/flags/JPFlag.js +21 -0
  17. package/dist/components/CountryFlag/flags/KRFlag.js +39 -0
  18. package/dist/components/CountryFlag/flags/NLFlag.js +21 -0
  19. package/dist/components/CountryFlag/flags/PTFlag.js +139 -0
  20. package/dist/components/CountryFlag/flags/RUFlag.js +21 -0
  21. package/dist/components/CountryFlag/flags/SAFlag.js +24 -0
  22. package/dist/components/CountryFlag/flags/THFlag.js +21 -0
  23. package/dist/components/CountryFlag/flags/TWFlag.js +28 -0
  24. package/dist/components/CountryFlag/flags/USFlag.js +34 -0
  25. package/dist/components/CountryFlag/flags/VNFlag.js +29 -0
  26. package/dist/components/CountryFlag/index.js +73 -0
  27. package/dist/components/LoadingCircular/index.js +37 -0
  28. package/dist/components/LoadingContainer/index.js +53 -0
  29. package/dist/components/TinyMceEditor/index.js +181 -0
  30. package/dist/components/TinyMceEditor/scrollStyle.js +40 -0
  31. package/dist/components/TinyMceEditor/useEditor.js +120 -0
  32. package/dist/components/Tooltip/index.js +172 -0
  33. package/dist/constants/index.js +85 -0
  34. package/dist/hanbiro-react16-sdk.style.css +1 -1
  35. package/dist/hanbiro-react16-sdk.umd.js +2 -9680
  36. package/dist/index.js +23 -0
  37. package/dist/node_modules/@tinymce/tinymce-react/lib/es2015/main/ts/ScriptLoader2.js +148 -0
  38. package/dist/node_modules/@tinymce/tinymce-react/lib/es2015/main/ts/TinyMCE.js +7 -0
  39. package/dist/node_modules/@tinymce/tinymce-react/lib/es2015/main/ts/Utils.js +103 -0
  40. package/dist/node_modules/@tinymce/tinymce-react/lib/es2015/main/ts/components/Editor.js +353 -0
  41. package/dist/node_modules/@tinymce/tinymce-react/lib/es2015/main/ts/components/EditorPropTypes.js +102 -0
  42. package/dist/node_modules/axios/index.js +38 -0
  43. package/dist/node_modules/axios/lib/adapters/adapters.js +71 -0
  44. package/dist/node_modules/axios/lib/adapters/fetch.js +272 -0
  45. package/dist/node_modules/axios/lib/adapters/xhr.js +153 -0
  46. package/dist/node_modules/axios/lib/axios.js +50 -0
  47. package/dist/node_modules/axios/lib/cancel/CancelToken.js +99 -0
  48. package/dist/node_modules/axios/lib/cancel/CanceledError.js +20 -0
  49. package/dist/node_modules/axios/lib/cancel/isCancel.js +6 -0
  50. package/dist/node_modules/axios/lib/core/Axios.js +220 -0
  51. package/dist/node_modules/axios/lib/core/AxiosError.js +76 -0
  52. package/dist/node_modules/axios/lib/core/AxiosHeaders.js +238 -0
  53. package/dist/node_modules/axios/lib/core/InterceptorManager.js +66 -0
  54. package/dist/node_modules/axios/lib/core/buildFullPath.js +12 -0
  55. package/dist/node_modules/axios/lib/core/dispatchRequest.js +48 -0
  56. package/dist/node_modules/axios/lib/core/mergeConfig.js +100 -0
  57. package/dist/node_modules/axios/lib/core/settle.js +20 -0
  58. package/dist/node_modules/axios/lib/core/transformData.js +17 -0
  59. package/dist/node_modules/axios/lib/defaults/index.js +120 -0
  60. package/dist/node_modules/axios/lib/defaults/transitional.js +9 -0
  61. package/dist/node_modules/axios/lib/env/data.js +4 -0
  62. package/dist/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +34 -0
  63. package/dist/node_modules/axios/lib/helpers/HttpStatusCode.js +77 -0
  64. package/dist/node_modules/axios/lib/helpers/bind.js +8 -0
  65. package/dist/node_modules/axios/lib/helpers/buildURL.js +32 -0
  66. package/dist/node_modules/axios/lib/helpers/combineURLs.js +6 -0
  67. package/dist/node_modules/axios/lib/helpers/composeSignals.js +41 -0
  68. package/dist/node_modules/axios/lib/helpers/cookies.js +49 -0
  69. package/dist/node_modules/axios/lib/helpers/formDataToJSON.js +54 -0
  70. package/dist/node_modules/axios/lib/helpers/isAbsoluteURL.js +9 -0
  71. package/dist/node_modules/axios/lib/helpers/isAxiosError.js +7 -0
  72. package/dist/node_modules/axios/lib/helpers/isURLSameOrigin.js +11 -0
  73. package/dist/node_modules/axios/lib/helpers/null.js +4 -0
  74. package/dist/node_modules/axios/lib/helpers/parseHeaders.js +47 -0
  75. package/dist/node_modules/axios/lib/helpers/parseProtocol.js +7 -0
  76. package/dist/node_modules/axios/lib/helpers/progressEventReducer.js +44 -0
  77. package/dist/node_modules/axios/lib/helpers/resolveConfig.js +52 -0
  78. package/dist/node_modules/axios/lib/helpers/speedometer.js +36 -0
  79. package/dist/node_modules/axios/lib/helpers/spread.js +8 -0
  80. package/dist/node_modules/axios/lib/helpers/throttle.js +35 -0
  81. package/dist/node_modules/axios/lib/helpers/toFormData.js +120 -0
  82. package/dist/node_modules/axios/lib/helpers/toURLEncodedForm.js +33 -0
  83. package/dist/node_modules/axios/lib/helpers/trackStream.js +169 -0
  84. package/dist/node_modules/axios/lib/helpers/validator.js +70 -0
  85. package/dist/node_modules/axios/lib/platform/browser/classes/Blob.js +4 -0
  86. package/dist/node_modules/axios/lib/platform/browser/classes/FormData.js +4 -0
  87. package/dist/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +5 -0
  88. package/dist/node_modules/axios/lib/platform/browser/index.js +15 -0
  89. package/dist/node_modules/axios/lib/platform/common/utils.js +15 -0
  90. package/dist/node_modules/axios/lib/platform/index.js +22 -0
  91. package/dist/node_modules/axios/lib/utils.js +429 -0
  92. package/dist/node_modules/marked/lib/marked.esm.js +2169 -0
  93. package/dist/node_modules/prop-types/factoryWithThrowingShims.js +51 -0
  94. package/dist/node_modules/prop-types/index.js +12 -0
  95. package/dist/node_modules/prop-types/lib/ReactPropTypesSecret.js +5 -0
  96. package/dist/node_modules/react-feather/dist/icons/copy.js +75 -0
  97. package/dist/node_modules/react-feather/dist/icons/send.js +73 -0
  98. package/dist/node_modules/react-feather/dist/icons/settings.js +72 -0
  99. package/dist/node_modules/uuid/dist/esm-browser/native.js +7 -0
  100. package/dist/node_modules/uuid/dist/esm-browser/rng.js +14 -0
  101. package/dist/node_modules/uuid/dist/esm-browser/stringify.js +10 -0
  102. package/dist/node_modules/uuid/dist/esm-browser/v4.js +16 -0
  103. package/dist/utils/axiosAPI.js +89 -0
  104. package/dist/utils/url.js +54 -0
  105. package/package.json +2 -1
  106. package/dist/hanbiro-react16-sdk.es.js +0 -7911
@@ -0,0 +1,281 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
21
+ var __async = (__this, __arguments, generator) => {
22
+ return new Promise((resolve, reject) => {
23
+ var fulfilled = (value) => {
24
+ try {
25
+ step(generator.next(value));
26
+ } catch (e) {
27
+ reject(e);
28
+ }
29
+ };
30
+ var rejected = (value) => {
31
+ try {
32
+ step(generator.throw(value));
33
+ } catch (e) {
34
+ reject(e);
35
+ }
36
+ };
37
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
38
+ step((generator = generator.apply(__this, __arguments)).next());
39
+ });
40
+ };
41
+ import * as React from "react";
42
+ import CustomAiIcon from "./CustomAIIcon.js";
43
+ import { callAI } from "./helper.js";
44
+ import List from "./List.js";
45
+ import SettingPopper from "./SettingPopper.js";
46
+ import { AI_LANG_FLAGS } from "../../constants/index.js";
47
+ import CountryFlag from "../CountryFlag/index.js";
48
+ import v4 from "../../node_modules/uuid/dist/esm-browser/v4.js";
49
+ import Send from "../../node_modules/react-feather/dist/icons/send.js";
50
+ class ChatAIDraft extends React.Component {
51
+ constructor(props) {
52
+ var _a;
53
+ super(props);
54
+ __publicField(this, "rootRef");
55
+ __publicField(this, "setAIContext", (html) => {
56
+ this.setState({ originalEmail: html });
57
+ });
58
+ __publicField(this, "handleMessageChange", (e) => {
59
+ this.setState({ message: e.target.value });
60
+ });
61
+ __publicField(this, "handleSubmit", () => __async(this, null, function* () {
62
+ const { message, messages, lang, originalEmail, conversationId } = this.state;
63
+ if (!message.trim()) return;
64
+ const newId = v4();
65
+ let newMessage = {
66
+ id: newId,
67
+ question: message,
68
+ subject: "",
69
+ body: "",
70
+ created_at: (/* @__PURE__ */ new Date()).getTime(),
71
+ isLoading: true
72
+ };
73
+ const currentItems = [...messages, newMessage];
74
+ this.setState({
75
+ messages: currentItems,
76
+ message: "",
77
+ isSending: true
78
+ });
79
+ const params = {
80
+ query: message,
81
+ default_language: lang ? lang.value : "KR",
82
+ original_email: originalEmail,
83
+ debug_grpc: true
84
+ };
85
+ if (conversationId) {
86
+ params.conversation_id = conversationId;
87
+ }
88
+ const setContent = (nContent) => {
89
+ this.setState((prevState) => {
90
+ const updatedMessages = prevState.messages.map(
91
+ (m) => m.id === newId ? __spreadProps(__spreadValues({}, m), {
92
+ subject: "Some thing not used",
93
+ body: nContent,
94
+ isLoading: false,
95
+ created_at: (/* @__PURE__ */ new Date()).getTime()
96
+ }) : m
97
+ );
98
+ return { messages: updatedMessages };
99
+ });
100
+ };
101
+ const setIsLoading = (loading) => {
102
+ this.setState((prevState) => {
103
+ const updatedMessages = prevState.messages.map(
104
+ (m) => m.id === newId ? __spreadProps(__spreadValues({}, m), { isLoading: loading }) : m
105
+ );
106
+ return { messages: updatedMessages };
107
+ });
108
+ };
109
+ const setConversationId = (id) => {
110
+ this.setState({ conversationId: id });
111
+ };
112
+ yield callAI(params, {
113
+ setContent,
114
+ setIsLoading,
115
+ setConversationId
116
+ });
117
+ this.setState({ isSending: false });
118
+ }));
119
+ __publicField(this, "handleKeyDown", (event) => {
120
+ if (!event.shiftKey && event.key === "Enter" && !this.state.isSending) {
121
+ event.preventDefault();
122
+ this.handleSubmit();
123
+ }
124
+ });
125
+ __publicField(this, "setLang", (lang) => {
126
+ this.setState({ lang });
127
+ });
128
+ __publicField(this, "setOriginalEmail", (email) => {
129
+ this.setState({ originalEmail: email });
130
+ });
131
+ this.rootRef = React.createRef();
132
+ const lang = ((_a = AI_LANG_FLAGS) == null ? void 0 : _a.find((_item) => (_item == null ? void 0 : _item.value) === (props == null ? void 0 : props.defaultLang))) || AI_LANG_FLAGS[0];
133
+ this.state = {
134
+ message: "",
135
+ messages: [],
136
+ isSending: false,
137
+ lang,
138
+ conversationId: "",
139
+ originalEmail: ""
140
+ };
141
+ }
142
+ render() {
143
+ var _a, _b;
144
+ const { onApply, getEditorContent } = this.props;
145
+ const { message, messages, isSending, lang, originalEmail } = this.state;
146
+ const flagCode = (_b = (_a = AI_LANG_FLAGS) == null ? void 0 : _a.find(
147
+ (_item) => (_item == null ? void 0 : _item.value) === (lang == null ? void 0 : lang.value)
148
+ )) == null ? void 0 : _b.flagCode;
149
+ return /* @__PURE__ */ React.createElement(
150
+ "div",
151
+ {
152
+ ref: this.rootRef,
153
+ style: {
154
+ display: "flex",
155
+ height: "100%",
156
+ padding: 16,
157
+ flexDirection: "column",
158
+ background: "#fff",
159
+ fontFamily: "inherit",
160
+ boxSizing: "border-box"
161
+ }
162
+ },
163
+ messages.length > 0 ? /* @__PURE__ */ React.createElement(
164
+ List,
165
+ {
166
+ items: messages,
167
+ onApply,
168
+ getEditorContent
169
+ }
170
+ ) : /* @__PURE__ */ React.createElement(
171
+ "div",
172
+ {
173
+ style: {
174
+ flex: 1,
175
+ minHeight: 0,
176
+ display: "flex",
177
+ flexDirection: "column",
178
+ alignItems: "center",
179
+ justifyContent: "center",
180
+ color: "var(--grey-light)"
181
+ }
182
+ },
183
+ /* @__PURE__ */ React.createElement(CustomAiIcon, { size: 46 }),
184
+ /* @__PURE__ */ React.createElement(
185
+ "h2",
186
+ {
187
+ style: {
188
+ marginTop: 16,
189
+ fontWeight: 600,
190
+ color: "inherit",
191
+ fontSize: 18
192
+ }
193
+ },
194
+ "Build with Agent"
195
+ )
196
+ ),
197
+ /* @__PURE__ */ React.createElement(
198
+ "div",
199
+ {
200
+ style: {
201
+ width: "100%",
202
+ border: "1px solid var(--border-main)",
203
+ borderRadius: 4,
204
+ overflow: "hidden",
205
+ background: "#fff",
206
+ display: "flex",
207
+ flexDirection: "column"
208
+ }
209
+ },
210
+ /* @__PURE__ */ React.createElement(
211
+ "textarea",
212
+ {
213
+ value: message,
214
+ onChange: this.handleMessageChange,
215
+ placeholder: "Describe your email",
216
+ name: "ai-content",
217
+ onKeyDown: this.handleKeyDown,
218
+ disabled: isSending,
219
+ style: {
220
+ flex: 1,
221
+ minWidth: 0,
222
+ borderRadius: 4,
223
+ padding: 12,
224
+ fontSize: 13,
225
+ border: "none",
226
+ resize: "none",
227
+ outline: "none",
228
+ minHeight: 60,
229
+ fontFamily: "inherit"
230
+ }
231
+ }
232
+ ),
233
+ /* @__PURE__ */ React.createElement(
234
+ "div",
235
+ {
236
+ style: {
237
+ display: "flex",
238
+ flexDirection: "row",
239
+ alignItems: "center",
240
+ width: "100%",
241
+ padding: "8px",
242
+ boxSizing: "border-box"
243
+ }
244
+ },
245
+ /* @__PURE__ */ React.createElement(
246
+ SettingPopper,
247
+ {
248
+ lang,
249
+ setLang: this.setLang,
250
+ originalEmail,
251
+ setOriginalEmail: this.setOriginalEmail,
252
+ getEditorContent,
253
+ parentRef: this.rootRef
254
+ }
255
+ ),
256
+ /* @__PURE__ */ React.createElement(
257
+ CountryFlag,
258
+ {
259
+ flagCode,
260
+ style: { marginLeft: 4, height: 14 }
261
+ }
262
+ ),
263
+ /* @__PURE__ */ React.createElement(
264
+ "button",
265
+ {
266
+ disabled: !message.trim() || isSending,
267
+ onClick: this.handleSubmit,
268
+ className: "icon-button",
269
+ color: "primary",
270
+ style: { marginLeft: "auto" }
271
+ },
272
+ /* @__PURE__ */ React.createElement(Send, null)
273
+ )
274
+ )
275
+ )
276
+ );
277
+ }
278
+ }
279
+ export {
280
+ ChatAIDraft as default
281
+ };
@@ -0,0 +1,27 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __spreadValues = (a, b) => {
7
+ for (var prop in b || (b = {}))
8
+ if (__hasOwnProp.call(b, prop))
9
+ __defNormalProp(a, prop, b[prop]);
10
+ if (__getOwnPropSymbols)
11
+ for (var prop of __getOwnPropSymbols(b)) {
12
+ if (__propIsEnum.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ }
15
+ return a;
16
+ };
17
+ import * as React from "react";
18
+ const CNFlag = (props) => /* @__PURE__ */ React.createElement("svg", __spreadValues({ viewBox: "0 0 30 20" }, props), /* @__PURE__ */ React.createElement("rect", { fill: "#de2110", width: "30", height: "20" }), /* @__PURE__ */ React.createElement(
19
+ "path",
20
+ {
21
+ fill: "#ffde00",
22
+ d: "m6 2-1 3.2h3.2l-2.6-2 1 3.2-1.6-1.2-1.6 1.2 1-3.2-2.6 2h3.2l-1-3.2zm4-1 0.4 1.3 1.3 0.1-1.1 0.8 0.4 1.3L10 3.7l-1 0.8 0.4-1.3-1.1-0.8 1.3-0.1 0.4-1.3zm2.5 2.1 0.7 1.2 1.3-0.3-0.7 1.2 0.7 1.2-1.3-0.3-0.7 1.2v-1.4l-1.3-0.3 1.3-0.3v-1.4zm0 4.1-1.3 0.3 1.3 0.3v1.4l0.7-1.2 1.3 0.3-0.7-1.2 0.7-1.2-1.3 0.3-0.7-1.2v1.4zm-2.5 1.7-0.4 1.3-1.3 0.1 1.1 0.8-0.4 1.3 1.1-0.8 1.1 0.8-0.4-1.3 1.1-0.8-1.3-0.1-0.4-1.3z"
23
+ }
24
+ ));
25
+ export {
26
+ CNFlag as default
27
+ };
@@ -0,0 +1,21 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __spreadValues = (a, b) => {
7
+ for (var prop in b || (b = {}))
8
+ if (__hasOwnProp.call(b, prop))
9
+ __defNormalProp(a, prop, b[prop]);
10
+ if (__getOwnPropSymbols)
11
+ for (var prop of __getOwnPropSymbols(b)) {
12
+ if (__propIsEnum.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ }
15
+ return a;
16
+ };
17
+ import * as React from "react";
18
+ const DEFlag = (props) => /* @__PURE__ */ React.createElement("svg", __spreadValues({ viewBox: "0 0 5 3" }, props), /* @__PURE__ */ React.createElement("desc", null, "Flag of Germany"), /* @__PURE__ */ React.createElement("rect", { id: "black_stripe", width: "5", height: "3", y: "0", x: "0", fill: "#000" }), /* @__PURE__ */ React.createElement("rect", { id: "red_stripe", width: "5", height: "2", y: "1", x: "0", fill: "#D00" }), /* @__PURE__ */ React.createElement("rect", { id: "gold_stripe", width: "5", height: "1", y: "2", x: "0", fill: "#FFCE00" }));
19
+ export {
20
+ DEFlag as default
21
+ };