@ibti-tech/chatbot 0.1.0 → 0.1.1
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/dist/index.d.ts +1 -2
- package/dist/index.js +1132 -0
- package/dist/index.mjs +1 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -419,7 +419,6 @@ declare module '@ibti-tech/chatbot/hooks/useUpdatedTime.d.ts' {
|
|
|
419
419
|
declare module '@ibti-tech/chatbot/i18n/LocaleTerms' {
|
|
420
420
|
export interface LocaleTerms {
|
|
421
421
|
CHATBOT_NAME: string;
|
|
422
|
-
ORGANIZATION_NAME: string;
|
|
423
422
|
INPUT_PLACEHOLDER: string;
|
|
424
423
|
ERRORS: {
|
|
425
424
|
UNKNOWN: string;
|
|
@@ -449,7 +448,7 @@ declare module '@ibti-tech/chatbot/i18n/LocaleTerms' {
|
|
|
449
448
|
//# sourceMappingURL=LocaleTerms.d.ts.map
|
|
450
449
|
}
|
|
451
450
|
declare module '@ibti-tech/chatbot/i18n/LocaleTerms.d.ts' {
|
|
452
|
-
{"version":3,"file":"LocaleTerms.d.ts","sourceRoot":"","sources":["../../../../home/juan/projetos/ibti/ibti-chatbot/src/i18n/LocaleTerms.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,YAAY,EAAE,MAAM,CAAA;IACpB,iBAAiB,EAAE,MAAM,CAAA;IACzB,
|
|
451
|
+
{"version":3,"file":"LocaleTerms.d.ts","sourceRoot":"","sources":["../../../../home/juan/projetos/ibti/ibti-chatbot/src/i18n/LocaleTerms.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,YAAY,EAAE,MAAM,CAAA;IACpB,iBAAiB,EAAE,MAAM,CAAA;IACzB,MAAM,EAAE;QACN,OAAO,EAAE,MAAM,CAAA;KAChB,CAAA;IACD,MAAM,EAAE;QACN,MAAM,EAAE,MAAM,CAAA;QACd,OAAO,EAAE,MAAM,CAAA;QACf,OAAO,EAAE,MAAM,CAAA;QACf,WAAW,EAAE,MAAM,CAAA;KACpB,CAAA;IACD,WAAW,EAAE;QACX,IAAI,EAAE,MAAM,CAAA;QACZ,KAAK,EAAE,MAAM,CAAA;KACd,CAAA;IACD,mBAAmB,EAAE;QACnB,KAAK,EAAE,MAAM,CAAA;QACb,OAAO,EAAE,MAAM,CAAA;KAChB,CAAA;IACD,aAAa,EAAE;QACb,KAAK,EAAE,MAAM,CAAA;QACb,WAAW,EAAE,MAAM,CAAA;QACnB,aAAa,EAAE,MAAM,CAAA;QACrB,aAAa,EAAE,MAAM,CAAA;QACrB,YAAY,EAAE,MAAM,CAAA;KACrB,CAAA;CACF"}
|
|
453
452
|
}
|
|
454
453
|
declare module '@ibti-tech/chatbot/i18n/index' {
|
|
455
454
|
import { ChatbotTypes } from 'types';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,1132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
|
|
31
|
+
// src/index.tsx
|
|
32
|
+
var src_exports = {};
|
|
33
|
+
__export(src_exports, {
|
|
34
|
+
ChatbotBar: () => ChatbotBar,
|
|
35
|
+
ChatbotContext: () => ChatbotContext,
|
|
36
|
+
ChatbotDevice: () => ChatbotDevice,
|
|
37
|
+
ChatbotProvider: () => ChatbotProvider,
|
|
38
|
+
useChatbot: () => useChatbot
|
|
39
|
+
});
|
|
40
|
+
module.exports = __toCommonJS(src_exports);
|
|
41
|
+
|
|
42
|
+
// src/contexts/Chatbot/useChatbot.ts
|
|
43
|
+
var import_react = require("react");
|
|
44
|
+
|
|
45
|
+
// src/contexts/Chatbot/context.ts
|
|
46
|
+
var React = __toESM(require("react"));
|
|
47
|
+
var ChatbotContext = React.createContext({});
|
|
48
|
+
|
|
49
|
+
// src/contexts/Chatbot/useChatbot.ts
|
|
50
|
+
var useChatbot = /* @__PURE__ */ __name(() => {
|
|
51
|
+
const context = (0, import_react.useContext)(ChatbotContext);
|
|
52
|
+
if (!context) throw new Error("ChatbotContext was not found to be consumed.");
|
|
53
|
+
return context;
|
|
54
|
+
}, "useChatbot");
|
|
55
|
+
var useChatbot_default = useChatbot;
|
|
56
|
+
|
|
57
|
+
// src/contexts/Chatbot/provider.tsx
|
|
58
|
+
var import_react4 = __toESM(require("react"));
|
|
59
|
+
|
|
60
|
+
// src/contexts/Chatbot/useChatbotMessages.ts
|
|
61
|
+
var import_react3 = require("react");
|
|
62
|
+
var import_uuid = require("uuid");
|
|
63
|
+
|
|
64
|
+
// src/contexts/Chatbot/useChatbotSuggestedQuestions.ts
|
|
65
|
+
var import_react2 = require("react");
|
|
66
|
+
|
|
67
|
+
// src/services/chatbot-api.ts
|
|
68
|
+
var sendChatContext = /* @__PURE__ */ __name(async ({
|
|
69
|
+
chatContext,
|
|
70
|
+
locale = "en",
|
|
71
|
+
onReceiving,
|
|
72
|
+
onDone,
|
|
73
|
+
apiURL,
|
|
74
|
+
onError
|
|
75
|
+
}) => fetch(`${apiURL}/chat/completion?locale=${locale}`, {
|
|
76
|
+
method: "POST",
|
|
77
|
+
headers: {
|
|
78
|
+
"Content-type": "application/json"
|
|
79
|
+
},
|
|
80
|
+
body: JSON.stringify({
|
|
81
|
+
context: chatContext
|
|
82
|
+
})
|
|
83
|
+
}).then((response) => {
|
|
84
|
+
if (!response.body) return;
|
|
85
|
+
const reader = response.body.getReader();
|
|
86
|
+
const decoder = new TextDecoder();
|
|
87
|
+
let message = "";
|
|
88
|
+
function read() {
|
|
89
|
+
reader.read().then(({ done, value }) => {
|
|
90
|
+
if (done) {
|
|
91
|
+
onDone && onDone();
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const decodifiedChunk = decoder.decode(value, { stream: true });
|
|
95
|
+
message += decodifiedChunk;
|
|
96
|
+
onReceiving(message, decodifiedChunk);
|
|
97
|
+
read();
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
__name(read, "read");
|
|
101
|
+
read();
|
|
102
|
+
}).catch((err) => {
|
|
103
|
+
onError(err);
|
|
104
|
+
}), "sendChatContext");
|
|
105
|
+
var getSuggestedQuestions = /* @__PURE__ */ __name(async ({
|
|
106
|
+
chatContext,
|
|
107
|
+
apiURL,
|
|
108
|
+
locale = "en"
|
|
109
|
+
}) => {
|
|
110
|
+
const res = await fetch(
|
|
111
|
+
`${apiURL}/chat/suggested_questions?locale=${locale}`,
|
|
112
|
+
{
|
|
113
|
+
method: "POST",
|
|
114
|
+
headers: {
|
|
115
|
+
"Content-type": "application/json"
|
|
116
|
+
},
|
|
117
|
+
body: JSON.stringify({
|
|
118
|
+
context: chatContext
|
|
119
|
+
})
|
|
120
|
+
}
|
|
121
|
+
);
|
|
122
|
+
const data = await res.json();
|
|
123
|
+
return data.suggestedQuestions;
|
|
124
|
+
}, "getSuggestedQuestions");
|
|
125
|
+
var sendUserChatFeedback = /* @__PURE__ */ __name(async ({
|
|
126
|
+
apiURL,
|
|
127
|
+
chatContext,
|
|
128
|
+
locale = "en",
|
|
129
|
+
ratingScore,
|
|
130
|
+
description
|
|
131
|
+
}) => fetch(`${apiURL}/chat/feedback`, {
|
|
132
|
+
method: "POST",
|
|
133
|
+
headers: {
|
|
134
|
+
"Content-type": "application/json"
|
|
135
|
+
},
|
|
136
|
+
body: JSON.stringify({
|
|
137
|
+
locale,
|
|
138
|
+
rating_score: ratingScore,
|
|
139
|
+
chat_context: chatContext,
|
|
140
|
+
message: description
|
|
141
|
+
})
|
|
142
|
+
}), "sendUserChatFeedback");
|
|
143
|
+
|
|
144
|
+
// src/contexts/Chatbot/useChatbotSuggestedQuestions.ts
|
|
145
|
+
var useChatbotSuggestedQuestions = /* @__PURE__ */ __name(({
|
|
146
|
+
chatContext,
|
|
147
|
+
locale = "en",
|
|
148
|
+
apiURL
|
|
149
|
+
}) => {
|
|
150
|
+
const [loading, setLoading] = (0, import_react2.useState)(false);
|
|
151
|
+
const [data, setData] = (0, import_react2.useState)([]);
|
|
152
|
+
const fetchData = /* @__PURE__ */ __name(async () => {
|
|
153
|
+
if (chatContext.length === 0) return;
|
|
154
|
+
setLoading(true);
|
|
155
|
+
const suggestedData = await getSuggestedQuestions({
|
|
156
|
+
chatContext,
|
|
157
|
+
locale,
|
|
158
|
+
apiURL
|
|
159
|
+
});
|
|
160
|
+
setData(suggestedData);
|
|
161
|
+
setLoading(false);
|
|
162
|
+
}, "fetchData");
|
|
163
|
+
const resetData = /* @__PURE__ */ __name(() => {
|
|
164
|
+
setData([]);
|
|
165
|
+
}, "resetData");
|
|
166
|
+
return {
|
|
167
|
+
loading,
|
|
168
|
+
data,
|
|
169
|
+
fetchData,
|
|
170
|
+
resetData
|
|
171
|
+
};
|
|
172
|
+
}, "useChatbotSuggestedQuestions");
|
|
173
|
+
|
|
174
|
+
// src/events/eventNames.ts
|
|
175
|
+
var CUSTOM_EVENT_NAMES = {
|
|
176
|
+
ASSISTANT_ANSWER_FINISHED: "ASSISTANT_ANSWER_FINISHED"
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
// src/events/assistant-answer.ts
|
|
180
|
+
var dispatchAssitantAnswer = /* @__PURE__ */ __name(() => {
|
|
181
|
+
const evt = new CustomEvent(CUSTOM_EVENT_NAMES.ASSISTANT_ANSWER_FINISHED);
|
|
182
|
+
document.dispatchEvent(evt);
|
|
183
|
+
}, "dispatchAssitantAnswer");
|
|
184
|
+
|
|
185
|
+
// src/contexts/Chatbot/useChatbotMessages.ts
|
|
186
|
+
var useChatbotMessages = /* @__PURE__ */ __name(({
|
|
187
|
+
apiURL,
|
|
188
|
+
locale
|
|
189
|
+
}) => {
|
|
190
|
+
const [chatMessages, setChatMessages] = (0, import_react3.useState)(
|
|
191
|
+
[]
|
|
192
|
+
);
|
|
193
|
+
const [assistantIntroduced, setAssistantIntroduced] = (0, import_react3.useState)(false);
|
|
194
|
+
const [loading, setLoading] = (0, import_react3.useState)(false);
|
|
195
|
+
const [writing, setWriting] = (0, import_react3.useState)(false);
|
|
196
|
+
const [error, setError] = (0, import_react3.useState)();
|
|
197
|
+
const suggestedQuestions = useChatbotSuggestedQuestions({
|
|
198
|
+
chatContext: chatMessages.map((item) => ({
|
|
199
|
+
role: item.role,
|
|
200
|
+
content: item.content
|
|
201
|
+
})),
|
|
202
|
+
apiURL,
|
|
203
|
+
locale
|
|
204
|
+
});
|
|
205
|
+
const createQuestionMessageIntoHistory = /* @__PURE__ */ __name((question, id) => {
|
|
206
|
+
const timestamp = (/* @__PURE__ */ new Date()).toUTCString();
|
|
207
|
+
const messageData = {
|
|
208
|
+
id,
|
|
209
|
+
timestamp,
|
|
210
|
+
role: "user",
|
|
211
|
+
content: question
|
|
212
|
+
};
|
|
213
|
+
const newHistory = [
|
|
214
|
+
...chatMessages,
|
|
215
|
+
messageData
|
|
216
|
+
];
|
|
217
|
+
setChatMessages(newHistory);
|
|
218
|
+
return messageData;
|
|
219
|
+
}, "createQuestionMessageIntoHistory");
|
|
220
|
+
const createOrUpdateAnswerMessageIntoHistory = /* @__PURE__ */ __name((answer, id) => {
|
|
221
|
+
const timestamp = (/* @__PURE__ */ new Date()).toUTCString();
|
|
222
|
+
const messageData = {
|
|
223
|
+
id,
|
|
224
|
+
timestamp,
|
|
225
|
+
role: "assistant",
|
|
226
|
+
content: answer
|
|
227
|
+
};
|
|
228
|
+
setChatMessages((prev) => {
|
|
229
|
+
const itemAlreadyExists = prev.some((item) => item.id == id);
|
|
230
|
+
if (itemAlreadyExists) {
|
|
231
|
+
return prev.map((item) => {
|
|
232
|
+
if (item.id == id)
|
|
233
|
+
return {
|
|
234
|
+
...item,
|
|
235
|
+
content: messageData.content
|
|
236
|
+
};
|
|
237
|
+
return item;
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
return [...prev, messageData];
|
|
241
|
+
});
|
|
242
|
+
return messageData;
|
|
243
|
+
}, "createOrUpdateAnswerMessageIntoHistory");
|
|
244
|
+
const makeQuestion = /* @__PURE__ */ __name(async (userQuestion) => {
|
|
245
|
+
setLoading(true);
|
|
246
|
+
suggestedQuestions.resetData();
|
|
247
|
+
const answerId = (0, import_uuid.v4)();
|
|
248
|
+
const questionId = (0, import_uuid.v4)();
|
|
249
|
+
const chatContext = createQuestionMessageIntoHistory(
|
|
250
|
+
userQuestion,
|
|
251
|
+
questionId
|
|
252
|
+
);
|
|
253
|
+
await sendChatContext({
|
|
254
|
+
apiURL,
|
|
255
|
+
locale,
|
|
256
|
+
chatContext: [
|
|
257
|
+
...chatMessages.map((item) => ({
|
|
258
|
+
role: item.role,
|
|
259
|
+
content: item.content
|
|
260
|
+
})),
|
|
261
|
+
{ role: chatContext.role, content: chatContext.content }
|
|
262
|
+
],
|
|
263
|
+
onReceiving(receivedMessage) {
|
|
264
|
+
setLoading(false);
|
|
265
|
+
setWriting(true);
|
|
266
|
+
createOrUpdateAnswerMessageIntoHistory(receivedMessage, answerId);
|
|
267
|
+
},
|
|
268
|
+
onDone: /* @__PURE__ */ __name(() => {
|
|
269
|
+
setWriting(false);
|
|
270
|
+
suggestedQuestions.fetchData();
|
|
271
|
+
}, "onDone"),
|
|
272
|
+
onError: setError
|
|
273
|
+
});
|
|
274
|
+
dispatchAssitantAnswer();
|
|
275
|
+
}, "makeQuestion");
|
|
276
|
+
const introduceAssistant = /* @__PURE__ */ __name(() => {
|
|
277
|
+
const firstMessage = {
|
|
278
|
+
"pt-BR": "Ol\xE1!",
|
|
279
|
+
en: "Hello!"
|
|
280
|
+
}[locale];
|
|
281
|
+
makeQuestion(firstMessage);
|
|
282
|
+
setAssistantIntroduced(true);
|
|
283
|
+
setChatMessages((prev) => prev.slice(1));
|
|
284
|
+
}, "introduceAssistant");
|
|
285
|
+
(0, import_react3.useEffect)(() => {
|
|
286
|
+
if (assistantIntroduced) return;
|
|
287
|
+
introduceAssistant();
|
|
288
|
+
}, [assistantIntroduced]);
|
|
289
|
+
return {
|
|
290
|
+
chatMessages,
|
|
291
|
+
makeQuestion,
|
|
292
|
+
loading,
|
|
293
|
+
writing,
|
|
294
|
+
error,
|
|
295
|
+
suggestedQuestions
|
|
296
|
+
};
|
|
297
|
+
}, "useChatbotMessages");
|
|
298
|
+
var useChatbotMessages_default = useChatbotMessages;
|
|
299
|
+
|
|
300
|
+
// src/themes/index.ts
|
|
301
|
+
var import_ui = require("@ibti-tech/ui");
|
|
302
|
+
var themes = {
|
|
303
|
+
light: import_ui.defaultLightTheme,
|
|
304
|
+
dark: import_ui.defaultDarkTheme
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
// src/contexts/Chatbot/provider.tsx
|
|
308
|
+
var import_styled_components = require("styled-components");
|
|
309
|
+
var ChatbotProvider = /* @__PURE__ */ __name(({
|
|
310
|
+
locale,
|
|
311
|
+
children,
|
|
312
|
+
apiURL,
|
|
313
|
+
theme
|
|
314
|
+
}) => {
|
|
315
|
+
const {
|
|
316
|
+
makeQuestion,
|
|
317
|
+
chatMessages,
|
|
318
|
+
loading,
|
|
319
|
+
writing,
|
|
320
|
+
error,
|
|
321
|
+
suggestedQuestions
|
|
322
|
+
} = useChatbotMessages_default({
|
|
323
|
+
apiURL,
|
|
324
|
+
locale
|
|
325
|
+
});
|
|
326
|
+
const [opened, setOpened] = (0, import_react4.useState)(false);
|
|
327
|
+
const scrollRef = (0, import_react4.useRef)(null);
|
|
328
|
+
const openedToggle = /* @__PURE__ */ __name(() => {
|
|
329
|
+
setOpened((state) => !state);
|
|
330
|
+
}, "openedToggle");
|
|
331
|
+
const status = (0, import_react4.useMemo)(() => {
|
|
332
|
+
if (writing) return "writing";
|
|
333
|
+
if (error) return "unavailable";
|
|
334
|
+
if (loading) return "loading";
|
|
335
|
+
return "online";
|
|
336
|
+
}, [writing, loading, error]);
|
|
337
|
+
return /* @__PURE__ */ import_react4.default.createElement(
|
|
338
|
+
ChatbotContext.Provider,
|
|
339
|
+
{
|
|
340
|
+
value: {
|
|
341
|
+
chatMessages,
|
|
342
|
+
makeQuestion,
|
|
343
|
+
loading,
|
|
344
|
+
writing,
|
|
345
|
+
locale,
|
|
346
|
+
scrollRef,
|
|
347
|
+
opened,
|
|
348
|
+
openedToggle,
|
|
349
|
+
status,
|
|
350
|
+
suggestedQuestions,
|
|
351
|
+
apiURL
|
|
352
|
+
}
|
|
353
|
+
},
|
|
354
|
+
/* @__PURE__ */ import_react4.default.createElement(import_styled_components.ThemeProvider, { theme: themes[theme] }, children)
|
|
355
|
+
);
|
|
356
|
+
}, "ChatbotProvider");
|
|
357
|
+
|
|
358
|
+
// src/components/ChatbotDevice/index.tsx
|
|
359
|
+
var import_react17 = __toESM(require("react"));
|
|
360
|
+
|
|
361
|
+
// src/components/ChatbotDevice/styles.ts
|
|
362
|
+
var import_ui2 = require("@ibti-tech/ui");
|
|
363
|
+
var import_polished = require("polished");
|
|
364
|
+
var import_styled_components2 = require("styled-components");
|
|
365
|
+
var Wrapper = import_styled_components2.styled.div`
|
|
366
|
+
width: 100%;
|
|
367
|
+
/* background-color: ${(props) => (0, import_polished.mix)(
|
|
368
|
+
0.05,
|
|
369
|
+
props.theme.colors.palette.primary.normal,
|
|
370
|
+
props.theme.colors.layers[0].background
|
|
371
|
+
)}; */
|
|
372
|
+
background-color: ${(props) => props.theme.colors.layers[1].background};
|
|
373
|
+
border: 1px solid ${(props) => props.theme.colors.layers[1].border};
|
|
374
|
+
display: flex;
|
|
375
|
+
flex-direction: column;
|
|
376
|
+
transition: ${(props) => props.theme.transitionDurations.fast};
|
|
377
|
+
border-end-end-radius: ${(props) => props.theme.borderRadius.medium};
|
|
378
|
+
border-end-start-radius: ${(props) => props.theme.borderRadius.medium};
|
|
379
|
+
overflow: hidden;
|
|
380
|
+
pointer-events: all;
|
|
381
|
+
height: 100vh;
|
|
382
|
+
position: relative;
|
|
383
|
+
|
|
384
|
+
${import_ui2.screens.tablet} {
|
|
385
|
+
height: 500px;
|
|
386
|
+
max-width: ${import_ui2.breakpoints.mobileL}px;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
${(props) => !props.$opened && import_styled_components2.css`
|
|
390
|
+
transform: translateY(calc(-100% + 32px));
|
|
391
|
+
`}
|
|
392
|
+
`;
|
|
393
|
+
|
|
394
|
+
// src/components/ChatbotHeader/index.tsx
|
|
395
|
+
var import_react7 = __toESM(require("react"));
|
|
396
|
+
|
|
397
|
+
// src/components/ChatbotHeader/styles.ts
|
|
398
|
+
var import_styled_components3 = require("styled-components");
|
|
399
|
+
var Name = import_styled_components3.styled.span`
|
|
400
|
+
color: ${(props) => props.theme.colors.content.title};
|
|
401
|
+
font-weight: ${(props) => props.theme.fontFamily.montserrat.weights.bold};
|
|
402
|
+
`;
|
|
403
|
+
var ProfileInfo = import_styled_components3.styled.div`
|
|
404
|
+
display: flex;
|
|
405
|
+
flex-direction: column;
|
|
406
|
+
`;
|
|
407
|
+
var ProfileImage = import_styled_components3.styled.span`
|
|
408
|
+
height: 2.5rem;
|
|
409
|
+
width: 2.5rem;
|
|
410
|
+
display: flex;
|
|
411
|
+
align-items: center;
|
|
412
|
+
justify-content: center;
|
|
413
|
+
background-color: ${(props) => props.theme.colors.palette.primary.normal};
|
|
414
|
+
font-size: 1.5rem;
|
|
415
|
+
border-radius: ${(props) => props.theme.borderRadius.circle};
|
|
416
|
+
|
|
417
|
+
svg {
|
|
418
|
+
color: white;
|
|
419
|
+
}
|
|
420
|
+
`;
|
|
421
|
+
var Wrapper2 = import_styled_components3.styled.div`
|
|
422
|
+
background: ${(props) => props.theme.colors.layers[2].background};
|
|
423
|
+
border: 1px solid ${(props) => props.theme.colors.layers[2].border};
|
|
424
|
+
display: flex;
|
|
425
|
+
padding: ${(props) => props.theme.spacing.components.small};
|
|
426
|
+
gap: ${(props) => props.theme.spacing.components.small};
|
|
427
|
+
`;
|
|
428
|
+
|
|
429
|
+
// src/components/BotIcon/index.tsx
|
|
430
|
+
var import_react5 = __toESM(require("react"));
|
|
431
|
+
var BotIcon = /* @__PURE__ */ __name(() => {
|
|
432
|
+
return /* @__PURE__ */ import_react5.default.createElement("svg", { viewBox: "0 0 24 24", width: "1em", height: "1em" }, /* @__PURE__ */ import_react5.default.createElement(
|
|
433
|
+
"path",
|
|
434
|
+
{
|
|
435
|
+
d: "M17.7530511,13.999921 C18.9956918,13.999921 20.0030511,15.0072804 20.0030511,16.249921 L20.0030511,17.1550008 C20.0030511,18.2486786 19.5255957,19.2878579 18.6957793,20.0002733 C17.1303315,21.344244 14.8899962,22.0010712 12,22.0010712 C9.11050247,22.0010712 6.87168436,21.3444691 5.30881727,20.0007885 C4.48019625,19.2883988 4.00354153,18.2500002 4.00354153,17.1572408 L4.00354153,16.249921 C4.00354153,15.0072804 5.01090084,13.999921 6.25354153,13.999921 L17.7530511,13.999921 Z M11.8985607,2.00734093 L12.0003312,2.00049432 C12.380027,2.00049432 12.6938222,2.2826482 12.7434846,2.64872376 L12.7503312,2.75049432 L12.7495415,3.49949432 L16.25,3.5 C17.4926407,3.5 18.5,4.50735931 18.5,5.75 L18.5,10.254591 C18.5,11.4972317 17.4926407,12.504591 16.25,12.504591 L7.75,12.504591 C6.50735931,12.504591 5.5,11.4972317 5.5,10.254591 L5.5,5.75 C5.5,4.50735931 6.50735931,3.5 7.75,3.5 L11.2495415,3.49949432 L11.2503312,2.75049432 C11.2503312,2.37079855 11.5324851,2.05700336 11.8985607,2.00734093 L12.0003312,2.00049432 L11.8985607,2.00734093 Z M9.74928905,6.5 C9.05932576,6.5 8.5,7.05932576 8.5,7.74928905 C8.5,8.43925235 9.05932576,8.99857811 9.74928905,8.99857811 C10.4392523,8.99857811 10.9985781,8.43925235 10.9985781,7.74928905 C10.9985781,7.05932576 10.4392523,6.5 9.74928905,6.5 Z M14.2420255,6.5 C13.5520622,6.5 12.9927364,7.05932576 12.9927364,7.74928905 C12.9927364,8.43925235 13.5520622,8.99857811 14.2420255,8.99857811 C14.9319888,8.99857811 15.4913145,8.43925235 15.4913145,7.74928905 C15.4913145,7.05932576 14.9319888,6.5 14.2420255,6.5 Z",
|
|
436
|
+
fill: "currentColor"
|
|
437
|
+
}
|
|
438
|
+
));
|
|
439
|
+
}, "BotIcon");
|
|
440
|
+
|
|
441
|
+
// src/i18n/en.json
|
|
442
|
+
var en_default = {
|
|
443
|
+
CHATBOT_NAME: "IBTI Chatbot (Beta)",
|
|
444
|
+
ORGANIZATION_NAME: "IBTI IT Solutions",
|
|
445
|
+
STATUS: {
|
|
446
|
+
ONLINE: "Now online",
|
|
447
|
+
LOADING: "Loading...",
|
|
448
|
+
WRITING: "Writing answer...",
|
|
449
|
+
UNAVAILABLE: "Unavailable"
|
|
450
|
+
},
|
|
451
|
+
ERRORS: {
|
|
452
|
+
UNKNOWN: "Sorry. We couldn't provide a response."
|
|
453
|
+
},
|
|
454
|
+
INPUT_PLACEHOLDER: "Ask something",
|
|
455
|
+
CHATBOT_BAR: {
|
|
456
|
+
OPEN: "Open {{CHATBOT_NAME}}",
|
|
457
|
+
CLOSE: "Close {{CHATBOT_NAME}}"
|
|
458
|
+
},
|
|
459
|
+
SUGGESTED_QUESTIONS: {
|
|
460
|
+
TITLE: "You may like to ask:",
|
|
461
|
+
LOADING: "Loading suggested questions..."
|
|
462
|
+
},
|
|
463
|
+
CHAT_FEEDBACK: {
|
|
464
|
+
TITLE: "Rate the Chatbot",
|
|
465
|
+
DESCRIPTION: "Give us a feedback about our bot assistant.",
|
|
466
|
+
MESSAGE_FIELD: "Description",
|
|
467
|
+
SUBMIT_BUTTON: "Send",
|
|
468
|
+
CLOSE_BUTTON: "Close"
|
|
469
|
+
}
|
|
470
|
+
};
|
|
471
|
+
|
|
472
|
+
// src/i18n/pt_BR.json
|
|
473
|
+
var pt_BR_default = {
|
|
474
|
+
CHATBOT_NAME: "Assistente do IBTI (Beta)",
|
|
475
|
+
ORGANIZATION_NAME: "IBTI Solu\xE7\xF5es em TI",
|
|
476
|
+
STATUS: {
|
|
477
|
+
ONLINE: "Ativo agora",
|
|
478
|
+
LOADING: "Carregando...",
|
|
479
|
+
WRITING: "Escrevendo resposta...",
|
|
480
|
+
UNAVAILABLE: "Indispon\xEDvel"
|
|
481
|
+
},
|
|
482
|
+
ERRORS: {
|
|
483
|
+
UNKNOWN: "Desculpe. N\xE3o conseguimos fornecer uma resposta."
|
|
484
|
+
},
|
|
485
|
+
INPUT_PLACEHOLDER: "Pergunte alguma coisa",
|
|
486
|
+
CHATBOT_BAR: {
|
|
487
|
+
OPEN: "Abrir IBTI ChatBot",
|
|
488
|
+
CLOSE: "Fechar IBTI ChatBot"
|
|
489
|
+
},
|
|
490
|
+
SUGGESTED_QUESTIONS: {
|
|
491
|
+
TITLE: "Voc\xEA pode querer perguntar:",
|
|
492
|
+
LOADING: "Carregando perguntas sugeridas..."
|
|
493
|
+
},
|
|
494
|
+
CHAT_FEEDBACK: {
|
|
495
|
+
TITLE: "Avalie o Chatbot",
|
|
496
|
+
DESCRIPTION: "D\xEA-nos um feedback sobre o nosso assistente virtual.",
|
|
497
|
+
MESSAGE_FIELD: "Descri\xE7\xE3o",
|
|
498
|
+
SUBMIT_BUTTON: "Enviar",
|
|
499
|
+
CLOSE_BUTTON: "Fechar"
|
|
500
|
+
}
|
|
501
|
+
};
|
|
502
|
+
|
|
503
|
+
// src/i18n/index.ts
|
|
504
|
+
var i18n = {
|
|
505
|
+
en: en_default,
|
|
506
|
+
"pt-BR": pt_BR_default
|
|
507
|
+
};
|
|
508
|
+
|
|
509
|
+
// src/hooks/useI18n.ts
|
|
510
|
+
var useI18n = /* @__PURE__ */ __name(() => {
|
|
511
|
+
const { locale } = useChatbot();
|
|
512
|
+
return i18n[locale];
|
|
513
|
+
}, "useI18n");
|
|
514
|
+
|
|
515
|
+
// src/components/ChatbotStatusLabel/index.tsx
|
|
516
|
+
var import_react6 = __toESM(require("react"));
|
|
517
|
+
|
|
518
|
+
// src/components/ChatbotStatusLabel/styles.ts
|
|
519
|
+
var import_styled_components4 = require("styled-components");
|
|
520
|
+
var Wrapper3 = import_styled_components4.styled.span`
|
|
521
|
+
color: ${(props) => props.theme.colors.content.detail};
|
|
522
|
+
font-size: ${(props) => props.theme.fontSizes.small};
|
|
523
|
+
|
|
524
|
+
&::before {
|
|
525
|
+
content: '';
|
|
526
|
+
display: inline-block;
|
|
527
|
+
height: 8px;
|
|
528
|
+
width: 8px;
|
|
529
|
+
border-radius: 4px;
|
|
530
|
+
background: ${(props) => props.$signalColor};
|
|
531
|
+
margin-right: 4px;
|
|
532
|
+
}
|
|
533
|
+
`;
|
|
534
|
+
|
|
535
|
+
// src/components/ChatbotStatusLabel/index.tsx
|
|
536
|
+
var import_styled_components5 = require("styled-components");
|
|
537
|
+
var ChatbotStatusLabel = /* @__PURE__ */ __name(({}) => {
|
|
538
|
+
const { status } = useChatbot_default();
|
|
539
|
+
const i18nTerms = useI18n();
|
|
540
|
+
const theme = (0, import_styled_components5.useTheme)();
|
|
541
|
+
const statusLabel = {
|
|
542
|
+
online: i18nTerms.STATUS.ONLINE,
|
|
543
|
+
loading: i18nTerms.STATUS.LOADING,
|
|
544
|
+
writing: i18nTerms.STATUS.WRITING,
|
|
545
|
+
unavailable: i18nTerms.STATUS.UNAVAILABLE
|
|
546
|
+
};
|
|
547
|
+
const statusColor = {
|
|
548
|
+
online: theme.colors.palette.success.normal,
|
|
549
|
+
loading: theme.colors.palette.warning.normal,
|
|
550
|
+
writing: theme.colors.palette.warning.normal,
|
|
551
|
+
unavailable: theme.colors.palette.error.normal
|
|
552
|
+
};
|
|
553
|
+
return /* @__PURE__ */ import_react6.default.createElement(Wrapper3, { $signalColor: statusColor[status] }, statusLabel[status]);
|
|
554
|
+
}, "ChatbotStatusLabel");
|
|
555
|
+
var ChatbotStatusLabel_default = ChatbotStatusLabel;
|
|
556
|
+
|
|
557
|
+
// src/components/ChatbotHeader/index.tsx
|
|
558
|
+
var ChatbotHeader = /* @__PURE__ */ __name(({}) => {
|
|
559
|
+
const i18n2 = useI18n();
|
|
560
|
+
return /* @__PURE__ */ import_react7.default.createElement(Wrapper2, null, /* @__PURE__ */ import_react7.default.createElement(ProfileImage, null, /* @__PURE__ */ import_react7.default.createElement(BotIcon, null)), /* @__PURE__ */ import_react7.default.createElement(ProfileInfo, null, /* @__PURE__ */ import_react7.default.createElement(Name, null, i18n2.ORGANIZATION_NAME), /* @__PURE__ */ import_react7.default.createElement(ChatbotStatusLabel_default, null)));
|
|
561
|
+
}, "ChatbotHeader");
|
|
562
|
+
var ChatbotHeader_default = ChatbotHeader;
|
|
563
|
+
|
|
564
|
+
// src/components/ChatbotBody/index.tsx
|
|
565
|
+
var import_react12 = __toESM(require("react"));
|
|
566
|
+
|
|
567
|
+
// src/components/ChatbotBody/styles.ts
|
|
568
|
+
var import_styled_components6 = require("styled-components");
|
|
569
|
+
var ChatbotInput = import_styled_components6.styled.div``;
|
|
570
|
+
var MessagesList = import_styled_components6.styled.ul`
|
|
571
|
+
padding: ${(props) => props.theme.spacing.components.medium};
|
|
572
|
+
display: flex;
|
|
573
|
+
flex-direction: column;
|
|
574
|
+
gap: ${(props) => props.theme.spacing.components.small};
|
|
575
|
+
`;
|
|
576
|
+
var Wrapper4 = import_styled_components6.styled.div`
|
|
577
|
+
overflow: hidden;
|
|
578
|
+
overflow-y: auto;
|
|
579
|
+
flex: 1;
|
|
580
|
+
height: 100%;
|
|
581
|
+
`;
|
|
582
|
+
|
|
583
|
+
// src/components/MessageBalloon/index.tsx
|
|
584
|
+
var import_react8 = __toESM(require("react"));
|
|
585
|
+
|
|
586
|
+
// src/components/MessageBalloon/styles.ts
|
|
587
|
+
var import_styled_components7 = require("styled-components");
|
|
588
|
+
var Time = import_styled_components7.styled.span`
|
|
589
|
+
font-size: ${(props) => props.theme.fontSizes.small};
|
|
590
|
+
`;
|
|
591
|
+
var Balloon = import_styled_components7.styled.div`
|
|
592
|
+
padding: ${(props) => props.theme.spacing.components.small};
|
|
593
|
+
width: max-content;
|
|
594
|
+
max-width: 100%;
|
|
595
|
+
border-radius: ${(props) => props.theme.borderRadius.medium};
|
|
596
|
+
position: relative;
|
|
597
|
+
line-height: 1.5em;
|
|
598
|
+
|
|
599
|
+
&::after {
|
|
600
|
+
position: absolute;
|
|
601
|
+
content: '';
|
|
602
|
+
width: 0;
|
|
603
|
+
height: 0;
|
|
604
|
+
border-style: solid;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
${({ $type }) => {
|
|
608
|
+
switch ($type) {
|
|
609
|
+
case "received":
|
|
610
|
+
return import_styled_components7.css`
|
|
611
|
+
background: ${(props) => props.theme.colors.layers[2].background};
|
|
612
|
+
border-top-left-radius: 0;
|
|
613
|
+
|
|
614
|
+
&::after {
|
|
615
|
+
border-width: 0px 10px 10px 0;
|
|
616
|
+
border-color: transparent
|
|
617
|
+
${(props) => props.theme.colors.layers[2].background} transparent
|
|
618
|
+
transparent;
|
|
619
|
+
top: 0;
|
|
620
|
+
left: -10px;
|
|
621
|
+
}
|
|
622
|
+
`;
|
|
623
|
+
case "sent":
|
|
624
|
+
return import_styled_components7.css`
|
|
625
|
+
background: ${(props) => props.theme.colors.palette.primary.normal};
|
|
626
|
+
border-top-right-radius: 0;
|
|
627
|
+
margin-left: auto;
|
|
628
|
+
|
|
629
|
+
&::after {
|
|
630
|
+
border-width: 0px 0px 10px 10px;
|
|
631
|
+
border-color: transparent transparent transparent
|
|
632
|
+
${(props) => props.theme.colors.palette.primary.normal};
|
|
633
|
+
top: 0;
|
|
634
|
+
right: -10px;
|
|
635
|
+
}
|
|
636
|
+
`;
|
|
637
|
+
}
|
|
638
|
+
}}
|
|
639
|
+
|
|
640
|
+
// Markdown styles
|
|
641
|
+
|
|
642
|
+
display: flex;
|
|
643
|
+
flex-direction: column;
|
|
644
|
+
gap: 1.3em;
|
|
645
|
+
|
|
646
|
+
a {
|
|
647
|
+
color: ${(props) => props.theme.colors.palette.primary.normal};
|
|
648
|
+
font-weight: semibold;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
ol,
|
|
652
|
+
ul {
|
|
653
|
+
display: flex;
|
|
654
|
+
flex-direction: column;
|
|
655
|
+
gap: 1.3em;
|
|
656
|
+
}
|
|
657
|
+
`;
|
|
658
|
+
var Label = import_styled_components7.styled.span`
|
|
659
|
+
font-size: ${(props) => props.theme.fontSizes.small};
|
|
660
|
+
`;
|
|
661
|
+
var Wrapper5 = import_styled_components7.styled.div`
|
|
662
|
+
font-size: ${(props) => props.theme.fontSizes.small};
|
|
663
|
+
display: flex;
|
|
664
|
+
flex-direction: column;
|
|
665
|
+
gap: ${(props) => props.theme.spacing.components.xsmall};
|
|
666
|
+
|
|
667
|
+
${(props) => {
|
|
668
|
+
switch (props.$type) {
|
|
669
|
+
case "received":
|
|
670
|
+
return import_styled_components7.css``;
|
|
671
|
+
default:
|
|
672
|
+
case "sent":
|
|
673
|
+
return import_styled_components7.css`
|
|
674
|
+
text-align: right;
|
|
675
|
+
`;
|
|
676
|
+
}
|
|
677
|
+
}};
|
|
678
|
+
`;
|
|
679
|
+
|
|
680
|
+
// src/utils/formatMessageTime.ts
|
|
681
|
+
var import_date_fns = require("date-fns");
|
|
682
|
+
var formatMessageTime = /* @__PURE__ */ __name((dateUTC, currentDateUTC, locale) => {
|
|
683
|
+
return (0, import_date_fns.intlFormatDistance)(dateUTC, currentDateUTC, { locale });
|
|
684
|
+
}, "formatMessageTime");
|
|
685
|
+
|
|
686
|
+
// src/components/MessageBalloon/index.tsx
|
|
687
|
+
var import_react_markdown = __toESM(require("react-markdown"));
|
|
688
|
+
var messageTypes = {
|
|
689
|
+
assistant: "received",
|
|
690
|
+
user: "sent"
|
|
691
|
+
};
|
|
692
|
+
var MessageBalloon = /* @__PURE__ */ __name(({
|
|
693
|
+
data,
|
|
694
|
+
currentDateUTC
|
|
695
|
+
}) => {
|
|
696
|
+
const messageType = messageTypes[data.role];
|
|
697
|
+
const i18n2 = useI18n();
|
|
698
|
+
const { locale } = useChatbot_default();
|
|
699
|
+
return /* @__PURE__ */ import_react8.default.createElement(Wrapper5, { $type: messageType }, data.role == "assistant" && /* @__PURE__ */ import_react8.default.createElement(Label, null, i18n2.CHATBOT_NAME), /* @__PURE__ */ import_react8.default.createElement(Balloon, { $type: messageType }, /* @__PURE__ */ import_react8.default.createElement(import_react_markdown.default, null, data.content)), /* @__PURE__ */ import_react8.default.createElement(Time, null, formatMessageTime(data.timestamp, currentDateUTC, locale)));
|
|
700
|
+
}, "MessageBalloon");
|
|
701
|
+
var MessageBalloon_default = MessageBalloon;
|
|
702
|
+
|
|
703
|
+
// src/hooks/useElementScroll.ts
|
|
704
|
+
var import_react9 = require("react");
|
|
705
|
+
var useElementScroll = /* @__PURE__ */ __name((elementRef) => {
|
|
706
|
+
const [scrollProgress, setScrollProgress] = (0, import_react9.useState)(0);
|
|
707
|
+
const calculateScrollPercentage = /* @__PURE__ */ __name(() => {
|
|
708
|
+
if (!elementRef.current) return;
|
|
709
|
+
const element = elementRef.current;
|
|
710
|
+
const elementHeight = element.clientHeight;
|
|
711
|
+
const elementScrollHeight = element.scrollHeight;
|
|
712
|
+
const scrollTop = element.scrollTop;
|
|
713
|
+
const scrollableHeight = elementScrollHeight - elementHeight;
|
|
714
|
+
const scrolled = scrollTop / scrollableHeight * 100;
|
|
715
|
+
const progressValue = Math.min(100, Math.max(0, scrolled));
|
|
716
|
+
setScrollProgress(isNaN(progressValue) ? 100 : progressValue);
|
|
717
|
+
}, "calculateScrollPercentage");
|
|
718
|
+
(0, import_react9.useEffect)(() => {
|
|
719
|
+
if (!elementRef.current) return;
|
|
720
|
+
const handleIntersection = /* @__PURE__ */ __name(() => {
|
|
721
|
+
calculateScrollPercentage();
|
|
722
|
+
}, "handleIntersection");
|
|
723
|
+
const handleScroll = /* @__PURE__ */ __name(() => {
|
|
724
|
+
calculateScrollPercentage();
|
|
725
|
+
}, "handleScroll");
|
|
726
|
+
const element = elementRef.current;
|
|
727
|
+
element.addEventListener("scroll", handleScroll);
|
|
728
|
+
const intersectionObserver = new IntersectionObserver(() => {
|
|
729
|
+
handleIntersection();
|
|
730
|
+
});
|
|
731
|
+
intersectionObserver.observe(element);
|
|
732
|
+
calculateScrollPercentage();
|
|
733
|
+
return () => {
|
|
734
|
+
if (!elementRef.current) return;
|
|
735
|
+
elementRef.current.removeEventListener("scroll", handleScroll);
|
|
736
|
+
intersectionObserver.disconnect();
|
|
737
|
+
};
|
|
738
|
+
}, [elementRef]);
|
|
739
|
+
const scrollToTop = /* @__PURE__ */ __name(() => {
|
|
740
|
+
elementRef.current?.scrollTo({ top: elementRef.current.scrollHeight });
|
|
741
|
+
}, "scrollToTop");
|
|
742
|
+
const scrollToEnd = /* @__PURE__ */ __name(() => {
|
|
743
|
+
elementRef.current?.scrollTo(0, elementRef.current.scrollHeight);
|
|
744
|
+
}, "scrollToEnd");
|
|
745
|
+
return {
|
|
746
|
+
scrollProgress,
|
|
747
|
+
scrollToTop,
|
|
748
|
+
scrollToEnd
|
|
749
|
+
};
|
|
750
|
+
}, "useElementScroll");
|
|
751
|
+
|
|
752
|
+
// src/hooks/useUpdatedTime.ts
|
|
753
|
+
var import_react10 = require("react");
|
|
754
|
+
var useUpdatedTime = /* @__PURE__ */ __name(({
|
|
755
|
+
intervalInSeconds
|
|
756
|
+
}) => {
|
|
757
|
+
const [date, setDate] = (0, import_react10.useState)(/* @__PURE__ */ new Date());
|
|
758
|
+
(0, import_react10.useEffect)(() => {
|
|
759
|
+
const time = 1e3 * intervalInSeconds;
|
|
760
|
+
const interval = setInterval(() => {
|
|
761
|
+
const now = /* @__PURE__ */ new Date();
|
|
762
|
+
setDate(now);
|
|
763
|
+
}, time);
|
|
764
|
+
return () => clearInterval(interval);
|
|
765
|
+
}, []);
|
|
766
|
+
return {
|
|
767
|
+
dateUTC: date.toUTCString()
|
|
768
|
+
};
|
|
769
|
+
}, "useUpdatedTime");
|
|
770
|
+
|
|
771
|
+
// src/components/SuggestedQuestions/index.tsx
|
|
772
|
+
var import_react11 = __toESM(require("react"));
|
|
773
|
+
|
|
774
|
+
// src/components/SuggestedQuestions/styles.ts
|
|
775
|
+
var import_ui3 = require("@ibti-tech/ui");
|
|
776
|
+
var import_styled_components8 = require("styled-components");
|
|
777
|
+
var QuestionButton = (0, import_styled_components8.styled)(import_ui3.Button)`
|
|
778
|
+
text-align: left;
|
|
779
|
+
justify-content: flex-start;
|
|
780
|
+
height: auto;
|
|
781
|
+
padding: ${(props) => props.theme.spacing.components.small};
|
|
782
|
+
`;
|
|
783
|
+
var QuestionListItem = import_styled_components8.styled.li``;
|
|
784
|
+
var QuestionList = import_styled_components8.styled.ul`
|
|
785
|
+
display: flex;
|
|
786
|
+
flex-direction: column;
|
|
787
|
+
gap: ${(props) => props.theme.spacing.components.small};
|
|
788
|
+
`;
|
|
789
|
+
var Title = import_styled_components8.styled.span`
|
|
790
|
+
display: block;
|
|
791
|
+
font-size: ${(props) => props.theme.fontSizes.small};
|
|
792
|
+
font-weight: ${(props) => props.theme.fontFamily.montserrat.weights.bold};
|
|
793
|
+
margin-bottom: ${(props) => props.theme.spacing.components.medium};
|
|
794
|
+
/* text-align: center; */
|
|
795
|
+
`;
|
|
796
|
+
var Wrapper6 = import_styled_components8.styled.div`
|
|
797
|
+
padding: ${(props) => props.theme.spacing.components.medium};
|
|
798
|
+
`;
|
|
799
|
+
|
|
800
|
+
// src/components/SuggestedQuestions/index.tsx
|
|
801
|
+
var SuggestedQuestions = /* @__PURE__ */ __name(({}) => {
|
|
802
|
+
const i18n2 = useI18n();
|
|
803
|
+
const { suggestedQuestions, makeQuestion } = useChatbot_default();
|
|
804
|
+
if (suggestedQuestions.data.length === 0) return;
|
|
805
|
+
return /* @__PURE__ */ import_react11.default.createElement(Wrapper6, null, /* @__PURE__ */ import_react11.default.createElement(Title, null, i18n2.SUGGESTED_QUESTIONS.TITLE), /* @__PURE__ */ import_react11.default.createElement(QuestionList, null, suggestedQuestions.data.map((question) => /* @__PURE__ */ import_react11.default.createElement(QuestionListItem, { key: question }, /* @__PURE__ */ import_react11.default.createElement(
|
|
806
|
+
QuestionButton,
|
|
807
|
+
{
|
|
808
|
+
label: question,
|
|
809
|
+
size: "small",
|
|
810
|
+
variant: "layerBased",
|
|
811
|
+
layer: 2,
|
|
812
|
+
onClick: () => {
|
|
813
|
+
makeQuestion(question);
|
|
814
|
+
},
|
|
815
|
+
fillWidth: true,
|
|
816
|
+
shape: "rounded"
|
|
817
|
+
}
|
|
818
|
+
)))));
|
|
819
|
+
}, "SuggestedQuestions");
|
|
820
|
+
var SuggestedQuestions_default = SuggestedQuestions;
|
|
821
|
+
|
|
822
|
+
// src/components/ChatbotBody/index.tsx
|
|
823
|
+
var ChatbotBody = /* @__PURE__ */ __name(({}) => {
|
|
824
|
+
const { chatMessages, suggestedQuestions } = useChatbot();
|
|
825
|
+
const scrollableElementRef = (0, import_react12.useRef)(null);
|
|
826
|
+
const { scrollProgress, scrollToEnd } = useElementScroll(scrollableElementRef);
|
|
827
|
+
const { dateUTC } = useUpdatedTime({ intervalInSeconds: 15 });
|
|
828
|
+
(0, import_react12.useEffect)(() => {
|
|
829
|
+
if (scrollProgress > 85) scrollToEnd();
|
|
830
|
+
document.addEventListener(
|
|
831
|
+
CUSTOM_EVENT_NAMES.ASSISTANT_ANSWER_FINISHED,
|
|
832
|
+
scrollToEnd
|
|
833
|
+
);
|
|
834
|
+
return () => {
|
|
835
|
+
document.removeEventListener(
|
|
836
|
+
CUSTOM_EVENT_NAMES.ASSISTANT_ANSWER_FINISHED,
|
|
837
|
+
scrollToEnd
|
|
838
|
+
);
|
|
839
|
+
};
|
|
840
|
+
}, [chatMessages, suggestedQuestions]);
|
|
841
|
+
return /* @__PURE__ */ import_react12.default.createElement(Wrapper4, { ref: scrollableElementRef }, /* @__PURE__ */ import_react12.default.createElement(MessagesList, null, chatMessages.map((msgData) => /* @__PURE__ */ import_react12.default.createElement(
|
|
842
|
+
MessageBalloon_default,
|
|
843
|
+
{
|
|
844
|
+
key: msgData.id,
|
|
845
|
+
data: msgData,
|
|
846
|
+
currentDateUTC: dateUTC
|
|
847
|
+
}
|
|
848
|
+
))), /* @__PURE__ */ import_react12.default.createElement(SuggestedQuestions_default, null));
|
|
849
|
+
}, "ChatbotBody");
|
|
850
|
+
var ChatbotBody_default = ChatbotBody;
|
|
851
|
+
|
|
852
|
+
// src/components/ChatbotFooter/index.tsx
|
|
853
|
+
var import_react13 = __toESM(require("react"));
|
|
854
|
+
|
|
855
|
+
// src/components/ChatbotFooter/styles.ts
|
|
856
|
+
var import_styled_components9 = require("styled-components");
|
|
857
|
+
var LoadingSuggestedQuestions = import_styled_components9.styled.span`
|
|
858
|
+
display: flex;
|
|
859
|
+
align-items: center;
|
|
860
|
+
gap: ${(props) => props.theme.spacing.components.small};
|
|
861
|
+
font-size: ${(props) => props.theme.fontSizes.small};
|
|
862
|
+
padding: ${(props) => props.theme.spacing.components.small}
|
|
863
|
+
${(props) => props.theme.spacing.components.medium};
|
|
864
|
+
`;
|
|
865
|
+
var Form = import_styled_components9.styled.form`
|
|
866
|
+
display: flex;
|
|
867
|
+
gap: ${(props) => props.theme.spacing.components.small};
|
|
868
|
+
`;
|
|
869
|
+
var Wrapper7 = import_styled_components9.styled.div`
|
|
870
|
+
padding: ${(props) => props.theme.spacing.components.small};
|
|
871
|
+
`;
|
|
872
|
+
|
|
873
|
+
// src/components/ChatbotFooter/index.tsx
|
|
874
|
+
var import_ui4 = require("@ibti-tech/ui");
|
|
875
|
+
var ChatbotFooter = /* @__PURE__ */ __name(({}) => {
|
|
876
|
+
const { makeQuestion, loading, writing, suggestedQuestions } = useChatbot_default();
|
|
877
|
+
const [questionInput, setQuestionInput] = (0, import_react13.useState)("");
|
|
878
|
+
const i18nTerms = useI18n();
|
|
879
|
+
const handleSubmit = /* @__PURE__ */ __name(async (e) => {
|
|
880
|
+
e.preventDefault();
|
|
881
|
+
setQuestionInput("");
|
|
882
|
+
await makeQuestion(questionInput);
|
|
883
|
+
}, "handleSubmit");
|
|
884
|
+
return /* @__PURE__ */ import_react13.default.createElement(Wrapper7, { "data-testid": "chatbot-footer" }, suggestedQuestions.loading && /* @__PURE__ */ import_react13.default.createElement(LoadingSuggestedQuestions, null, /* @__PURE__ */ import_react13.default.createElement(import_ui4.Spinner, { size: "extra-small" }), i18nTerms.SUGGESTED_QUESTIONS.LOADING), /* @__PURE__ */ import_react13.default.createElement(Form, { onSubmit: handleSubmit }, /* @__PURE__ */ import_react13.default.createElement(
|
|
885
|
+
import_ui4.TextInput,
|
|
886
|
+
{
|
|
887
|
+
fillWidth: true,
|
|
888
|
+
shape: "pill",
|
|
889
|
+
disabled: loading || writing,
|
|
890
|
+
value: questionInput,
|
|
891
|
+
onChange: (e) => setQuestionInput(e.target.value),
|
|
892
|
+
placeholder: i18nTerms.INPUT_PLACEHOLDER,
|
|
893
|
+
button: {
|
|
894
|
+
icon: loading || writing ? void 0 : import_ui4.ArrowRightIcon,
|
|
895
|
+
loading,
|
|
896
|
+
disabled: loading || writing || !questionInput,
|
|
897
|
+
type: "submit"
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
)));
|
|
901
|
+
}, "ChatbotFooter");
|
|
902
|
+
var ChatbotFooter_default = ChatbotFooter;
|
|
903
|
+
|
|
904
|
+
// src/components/ChatbotToggle/styles.ts
|
|
905
|
+
var import_ui5 = require("@ibti-tech/ui");
|
|
906
|
+
var import_styled_components10 = require("styled-components");
|
|
907
|
+
var ButtonWrapper = import_styled_components10.styled.button`
|
|
908
|
+
height: 32px;
|
|
909
|
+
width: 100%;
|
|
910
|
+
background: transparent;
|
|
911
|
+
/* background-color: ${(props) => props.theme.colors.layers[1].background};
|
|
912
|
+
border: 1px solid ${(props) => props.theme.colors.layers[1].border}; */
|
|
913
|
+
color: ${(props) => props.theme.colors.palette.primary.normal};
|
|
914
|
+
padding: ${(props) => props.theme.spacing.components.small};
|
|
915
|
+
font-size: ${(props) => props.theme.fontSizes.small};
|
|
916
|
+
font-weight: ${(props) => props.theme.fontFamily.montserrat.weights.semibold};
|
|
917
|
+
display: flex;
|
|
918
|
+
align-items: center;
|
|
919
|
+
justify-content: center;
|
|
920
|
+
gap: ${(props) => props.theme.spacing.components.small};
|
|
921
|
+
border-radius: ${(props) => props.theme.borderRadius.medium};
|
|
922
|
+
|
|
923
|
+
${import_ui5.screens.tablet} {
|
|
924
|
+
transition: ${(props) => props.theme.transitionDurations.default};
|
|
925
|
+
|
|
926
|
+
&:hover {
|
|
927
|
+
background-color: ${(props) => props.theme.colors.layers[1].hoveredBackground};
|
|
928
|
+
cursor: pointer;
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
`;
|
|
932
|
+
|
|
933
|
+
// src/components/ChatbotToggle/index.tsx
|
|
934
|
+
var import_react14 = __toESM(require("react"));
|
|
935
|
+
var import_icons = require("@ibti-tech/ui/dist/icons");
|
|
936
|
+
var ChatbotToggle = /* @__PURE__ */ __name(() => {
|
|
937
|
+
const { opened, openedToggle } = useChatbot_default();
|
|
938
|
+
const i18nTerms = useI18n();
|
|
939
|
+
const toggleText = (opened ? i18nTerms.CHATBOT_BAR.CLOSE : i18nTerms.CHATBOT_BAR.OPEN).replace("{{CHATBOT_NAME}}", i18nTerms.CHATBOT_NAME);
|
|
940
|
+
const Chevron = opened ? import_icons.ChevronUpIcon : import_icons.ChevronDownIcon;
|
|
941
|
+
return /* @__PURE__ */ import_react14.default.createElement(ButtonWrapper, { onClick: openedToggle }, /* @__PURE__ */ import_react14.default.createElement(BotIcon, null), /* @__PURE__ */ import_react14.default.createElement("span", null, toggleText), /* @__PURE__ */ import_react14.default.createElement(Chevron, null));
|
|
942
|
+
}, "ChatbotToggle");
|
|
943
|
+
var ChatbotToggle_default = ChatbotToggle;
|
|
944
|
+
|
|
945
|
+
// src/components/ChatUserFeedbackRating/index.tsx
|
|
946
|
+
var import_react16 = __toESM(require("react"));
|
|
947
|
+
var import_ui7 = require("@ibti-tech/ui");
|
|
948
|
+
|
|
949
|
+
// src/components/ChatUserFeedbackRating/styles.ts
|
|
950
|
+
var import_ui6 = require("@ibti-tech/ui");
|
|
951
|
+
var import_styled_components11 = require("styled-components");
|
|
952
|
+
var ActionButtons = import_styled_components11.styled.div`
|
|
953
|
+
display: flex;
|
|
954
|
+
justify-content: flex-end;
|
|
955
|
+
gap: ${(props) => props.theme.spacing.components.small};
|
|
956
|
+
`;
|
|
957
|
+
var Form2 = import_styled_components11.styled.form`
|
|
958
|
+
display: flex;
|
|
959
|
+
flex-direction: column;
|
|
960
|
+
gap: ${(props) => props.theme.spacing.components.medium};
|
|
961
|
+
`;
|
|
962
|
+
var Description = import_styled_components11.styled.div`
|
|
963
|
+
font-size: ${(props) => props.theme.fontSizes.small};
|
|
964
|
+
margin-bottom: ${(props) => props.theme.spacing.components.medium};
|
|
965
|
+
`;
|
|
966
|
+
var Title2 = import_styled_components11.styled.span`
|
|
967
|
+
display: block;
|
|
968
|
+
font-weight: ${(props) => props.theme.fontFamily.montserrat.weights.bold};
|
|
969
|
+
margin-bottom: ${(props) => props.theme.spacing.components.small};
|
|
970
|
+
`;
|
|
971
|
+
var Box = (0, import_styled_components11.styled)(import_ui6.CardBase)`
|
|
972
|
+
width: 100%;
|
|
973
|
+
height: max-content;
|
|
974
|
+
padding: ${(props) => props.theme.spacing.components.medium};
|
|
975
|
+
transition: ${(props) => props.theme.transitionDurations.default};
|
|
976
|
+
`;
|
|
977
|
+
var Wrapper8 = import_styled_components11.styled.div`
|
|
978
|
+
position: absolute;
|
|
979
|
+
z-index: 1;
|
|
980
|
+
left: 0;
|
|
981
|
+
top: 0;
|
|
982
|
+
height: 100%;
|
|
983
|
+
width: 100%;
|
|
984
|
+
display: flex;
|
|
985
|
+
align-items: center;
|
|
986
|
+
justify-content: center;
|
|
987
|
+
padding: ${(props) => props.theme.spacing.components.medium};
|
|
988
|
+
transition: ${(props) => props.theme.transitionDurations.default};
|
|
989
|
+
|
|
990
|
+
${(props) => props.$opened ? import_styled_components11.css`
|
|
991
|
+
background-color: rgba(0, 0, 0, 0.15);
|
|
992
|
+
backdrop-filter: blur(3px);
|
|
993
|
+
opacity: 1;
|
|
994
|
+
` : import_styled_components11.css`
|
|
995
|
+
pointer-events: none;
|
|
996
|
+
opacity: 0;
|
|
997
|
+
|
|
998
|
+
${Box} {
|
|
999
|
+
transform: scale(0.9);
|
|
1000
|
+
}
|
|
1001
|
+
`}
|
|
1002
|
+
`;
|
|
1003
|
+
|
|
1004
|
+
// src/contexts/Chatbot/useChatFeedbackBox.ts
|
|
1005
|
+
var import_react15 = require("react");
|
|
1006
|
+
var useChatFeedbackBox = /* @__PURE__ */ __name(() => {
|
|
1007
|
+
const { chatMessages, apiURL, locale } = useChatbot_default();
|
|
1008
|
+
const [rated, setRated] = (0, import_react15.useState)(false);
|
|
1009
|
+
const [opened, setOpened] = (0, import_react15.useState)(false);
|
|
1010
|
+
const [loading, setLoading] = (0, import_react15.useState)(false);
|
|
1011
|
+
(0, import_react15.useEffect)(() => {
|
|
1012
|
+
if (chatMessages.length > 6 && !rated) setOpened(true);
|
|
1013
|
+
}, [chatMessages]);
|
|
1014
|
+
const close = /* @__PURE__ */ __name(() => {
|
|
1015
|
+
setOpened(false);
|
|
1016
|
+
setRated(true);
|
|
1017
|
+
}, "close");
|
|
1018
|
+
const sendUserRating = /* @__PURE__ */ __name(async ({
|
|
1019
|
+
ratingScore,
|
|
1020
|
+
description
|
|
1021
|
+
}) => {
|
|
1022
|
+
try {
|
|
1023
|
+
setLoading(true);
|
|
1024
|
+
await sendUserChatFeedback({
|
|
1025
|
+
apiURL,
|
|
1026
|
+
chatContext: chatMessages.map((item) => ({
|
|
1027
|
+
role: item.role,
|
|
1028
|
+
content: item.content
|
|
1029
|
+
})),
|
|
1030
|
+
locale,
|
|
1031
|
+
ratingScore,
|
|
1032
|
+
description
|
|
1033
|
+
});
|
|
1034
|
+
} finally {
|
|
1035
|
+
setLoading(false);
|
|
1036
|
+
setRated(true);
|
|
1037
|
+
setOpened(false);
|
|
1038
|
+
}
|
|
1039
|
+
}, "sendUserRating");
|
|
1040
|
+
return {
|
|
1041
|
+
opened,
|
|
1042
|
+
close,
|
|
1043
|
+
sendUserRating,
|
|
1044
|
+
loading
|
|
1045
|
+
};
|
|
1046
|
+
}, "useChatFeedbackBox");
|
|
1047
|
+
|
|
1048
|
+
// src/components/ChatUserFeedbackRating/index.tsx
|
|
1049
|
+
var ChatUserFeedbackRating = /* @__PURE__ */ __name(({}) => {
|
|
1050
|
+
const chatFeedbackBox = useChatFeedbackBox();
|
|
1051
|
+
const [ratingValue, setRatingValue] = (0, import_react16.useState)(5);
|
|
1052
|
+
const [descriptionValue, setDescriptionValue] = (0, import_react16.useState)("");
|
|
1053
|
+
const i18nTerms = useI18n();
|
|
1054
|
+
const handleSubmit = /* @__PURE__ */ __name((e) => {
|
|
1055
|
+
e.preventDefault();
|
|
1056
|
+
chatFeedbackBox.sendUserRating({
|
|
1057
|
+
description: descriptionValue,
|
|
1058
|
+
ratingScore: ratingValue
|
|
1059
|
+
});
|
|
1060
|
+
}, "handleSubmit");
|
|
1061
|
+
return /* @__PURE__ */ import_react16.default.createElement(Wrapper8, { $opened: chatFeedbackBox.opened }, /* @__PURE__ */ import_react16.default.createElement(Box, null, /* @__PURE__ */ import_react16.default.createElement(Title2, null, i18nTerms.CHAT_FEEDBACK.TITLE), /* @__PURE__ */ import_react16.default.createElement(Description, null, i18nTerms.CHAT_FEEDBACK.DESCRIPTION), /* @__PURE__ */ import_react16.default.createElement(Form2, { onSubmit: handleSubmit }, /* @__PURE__ */ import_react16.default.createElement(
|
|
1062
|
+
import_ui7.RatingStars,
|
|
1063
|
+
{
|
|
1064
|
+
value: ratingValue,
|
|
1065
|
+
setValue: setRatingValue,
|
|
1066
|
+
layer: 2
|
|
1067
|
+
}
|
|
1068
|
+
), /* @__PURE__ */ import_react16.default.createElement(
|
|
1069
|
+
import_ui7.TextArea,
|
|
1070
|
+
{
|
|
1071
|
+
layer: 2,
|
|
1072
|
+
placeholder: i18nTerms.CHAT_FEEDBACK.MESSAGE_FIELD,
|
|
1073
|
+
fillWidth: true,
|
|
1074
|
+
value: descriptionValue,
|
|
1075
|
+
onChange: (e) => setDescriptionValue(e.target.value)
|
|
1076
|
+
}
|
|
1077
|
+
), /* @__PURE__ */ import_react16.default.createElement(ActionButtons, null, /* @__PURE__ */ import_react16.default.createElement(
|
|
1078
|
+
import_ui7.Button,
|
|
1079
|
+
{
|
|
1080
|
+
onClick: chatFeedbackBox.close,
|
|
1081
|
+
label: i18nTerms.CHAT_FEEDBACK.CLOSE_BUTTON,
|
|
1082
|
+
size: "small",
|
|
1083
|
+
variant: "layerBased"
|
|
1084
|
+
}
|
|
1085
|
+
), /* @__PURE__ */ import_react16.default.createElement(
|
|
1086
|
+
import_ui7.Button,
|
|
1087
|
+
{
|
|
1088
|
+
type: "submit",
|
|
1089
|
+
label: i18nTerms.CHAT_FEEDBACK.SUBMIT_BUTTON,
|
|
1090
|
+
size: "small",
|
|
1091
|
+
loading: chatFeedbackBox.loading
|
|
1092
|
+
}
|
|
1093
|
+
)))));
|
|
1094
|
+
}, "ChatUserFeedbackRating");
|
|
1095
|
+
|
|
1096
|
+
// src/components/ChatbotDevice/index.tsx
|
|
1097
|
+
var ChatbotDevice = /* @__PURE__ */ __name(({}) => {
|
|
1098
|
+
const { opened } = useChatbot_default();
|
|
1099
|
+
return /* @__PURE__ */ import_react17.default.createElement(Wrapper, { $opened: opened }, /* @__PURE__ */ import_react17.default.createElement(ChatUserFeedbackRating, null), /* @__PURE__ */ import_react17.default.createElement(ChatbotHeader_default, null), /* @__PURE__ */ import_react17.default.createElement(ChatbotBody_default, null), /* @__PURE__ */ import_react17.default.createElement(ChatbotFooter_default, null), /* @__PURE__ */ import_react17.default.createElement(ChatbotToggle_default, null));
|
|
1100
|
+
}, "ChatbotDevice");
|
|
1101
|
+
var ChatbotDevice_default = ChatbotDevice;
|
|
1102
|
+
|
|
1103
|
+
// src/components/ChatbotBar/styles.ts
|
|
1104
|
+
var import_ui8 = require("@ibti-tech/ui");
|
|
1105
|
+
var import_Container = require("@ibti-tech/ui/dist/components/Container");
|
|
1106
|
+
var import_styled_components12 = require("styled-components");
|
|
1107
|
+
var BarContainer = (0, import_styled_components12.styled)(import_Container.Container)`
|
|
1108
|
+
@media screen and (max-width: ${import_ui8.breakpoints.tablet}px) {
|
|
1109
|
+
padding: 0;
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
${import_ui8.screens.tablet} {
|
|
1113
|
+
display: flex;
|
|
1114
|
+
justify-content: flex-end;
|
|
1115
|
+
}
|
|
1116
|
+
`;
|
|
1117
|
+
var Wrapper9 = import_styled_components12.styled.div`
|
|
1118
|
+
width: 100%;
|
|
1119
|
+
padding-bottom: ${(props) => props.theme.spacing.components.xsmall};
|
|
1120
|
+
background-color: ${(props) => props.theme.colors.layers[0].background};
|
|
1121
|
+
border-bottom: 1px solid ${(props) => props.theme.colors.layers[0].border};
|
|
1122
|
+
height: 40px;
|
|
1123
|
+
z-index: 2;
|
|
1124
|
+
pointer-events: none;
|
|
1125
|
+
z-index: ${(props) => props.theme.zIndex.modals};
|
|
1126
|
+
`;
|
|
1127
|
+
|
|
1128
|
+
// src/components/ChatbotBar/index.tsx
|
|
1129
|
+
var import_react18 = __toESM(require("react"));
|
|
1130
|
+
var ChatbotBar = /* @__PURE__ */ __name(() => {
|
|
1131
|
+
return /* @__PURE__ */ import_react18.default.createElement(Wrapper9, null, /* @__PURE__ */ import_react18.default.createElement(BarContainer, null, /* @__PURE__ */ import_react18.default.createElement(ChatbotDevice_default, null)));
|
|
1132
|
+
}, "ChatbotBar");
|
package/dist/index.mjs
CHANGED
|
@@ -403,7 +403,6 @@ var BotIcon = /* @__PURE__ */ __name(() => {
|
|
|
403
403
|
// src/i18n/en.json
|
|
404
404
|
var en_default = {
|
|
405
405
|
CHATBOT_NAME: "IBTI Chatbot (Beta)",
|
|
406
|
-
ORGANIZATION_NAME: "IBTI IT Solutions",
|
|
407
406
|
STATUS: {
|
|
408
407
|
ONLINE: "Now online",
|
|
409
408
|
LOADING: "Loading...",
|
|
@@ -434,7 +433,6 @@ var en_default = {
|
|
|
434
433
|
// src/i18n/pt_BR.json
|
|
435
434
|
var pt_BR_default = {
|
|
436
435
|
CHATBOT_NAME: "Assistente do IBTI (Beta)",
|
|
437
|
-
ORGANIZATION_NAME: "IBTI Solu\xE7\xF5es em TI",
|
|
438
436
|
STATUS: {
|
|
439
437
|
ONLINE: "Ativo agora",
|
|
440
438
|
LOADING: "Carregando...",
|
|
@@ -519,7 +517,7 @@ var ChatbotStatusLabel_default = ChatbotStatusLabel;
|
|
|
519
517
|
// src/components/ChatbotHeader/index.tsx
|
|
520
518
|
var ChatbotHeader = /* @__PURE__ */ __name(({}) => {
|
|
521
519
|
const i18n2 = useI18n();
|
|
522
|
-
return /* @__PURE__ */ React6.createElement(Wrapper2, null, /* @__PURE__ */ React6.createElement(ProfileImage, null, /* @__PURE__ */ React6.createElement(BotIcon, null)), /* @__PURE__ */ React6.createElement(ProfileInfo, null, /* @__PURE__ */ React6.createElement(Name, null, i18n2.
|
|
520
|
+
return /* @__PURE__ */ React6.createElement(Wrapper2, null, /* @__PURE__ */ React6.createElement(ProfileImage, null, /* @__PURE__ */ React6.createElement(BotIcon, null)), /* @__PURE__ */ React6.createElement(ProfileInfo, null, /* @__PURE__ */ React6.createElement(Name, null, i18n2.CHATBOT_NAME), /* @__PURE__ */ React6.createElement(ChatbotStatusLabel_default, null)));
|
|
523
521
|
}, "ChatbotHeader");
|
|
524
522
|
var ChatbotHeader_default = ChatbotHeader;
|
|
525
523
|
|