@ibti-tech/chatbot 0.1.3 → 0.2.0
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 +43 -62
- package/dist/index.mjs +295 -184
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -8,12 +8,15 @@ declare module '@ibti-tech/chatbot/components/BotIcon/index.d.ts' {
|
|
|
8
8
|
}
|
|
9
9
|
declare module '@ibti-tech/chatbot/components/ChatUserFeedbackRating/index' {
|
|
10
10
|
import React from 'react';
|
|
11
|
-
|
|
12
|
-
export
|
|
11
|
+
import { useChatFeedbackBox } from 'contexts/Chatbot/useChatFeedbackBox';
|
|
12
|
+
export type ChatUserFeedbackRatingProps = {
|
|
13
|
+
chatFeedbackBox: ReturnType<typeof useChatFeedbackBox>;
|
|
14
|
+
};
|
|
15
|
+
export const ChatUserFeedbackRating: ({ chatFeedbackBox, }: ChatUserFeedbackRatingProps) => React.JSX.Element;
|
|
13
16
|
//# sourceMappingURL=index.d.ts.map
|
|
14
17
|
}
|
|
15
18
|
declare module '@ibti-tech/chatbot/components/ChatUserFeedbackRating/index.d.ts' {
|
|
16
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../home/juan/projetos/ibti/chatbot/ibti-chatbot/src/components/ChatUserFeedbackRating/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqC,MAAM,OAAO,CAAA;
|
|
19
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../home/juan/projetos/ibti/chatbot/ibti-chatbot/src/components/ChatUserFeedbackRating/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqC,MAAM,OAAO,CAAA;AAIzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAA;AAGxE,MAAM,MAAM,2BAA2B,GAAG;IACxC,eAAe,EAAE,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAA;CACvD,CAAA;AAED,eAAO,MAAM,sBAAsB,yBAEhC,2BAA2B,sBAmD7B,CAAA"}
|
|
17
20
|
}
|
|
18
21
|
declare module '@ibti-tech/chatbot/components/ChatUserFeedbackRating/styles' {
|
|
19
22
|
/// <reference types="react" />
|
|
@@ -25,7 +28,7 @@ declare module '@ibti-tech/chatbot/components/ChatUserFeedbackRating/styles' {
|
|
|
25
28
|
layer?: import("@ibti-tech/ui").ThemeLayerIndex | undefined;
|
|
26
29
|
hoverable?: boolean | undefined;
|
|
27
30
|
children?: import("react").ReactNode;
|
|
28
|
-
roundedCorners?: "
|
|
31
|
+
roundedCorners?: "small" | "none" | "medium" | "large" | undefined;
|
|
29
32
|
tag?: keyof HTMLElementTagNameMap | undefined;
|
|
30
33
|
boxShadow?: boolean | undefined;
|
|
31
34
|
} & import("react").HTMLAttributes<HTMLDivElement>, never>> & string & Omit<({ layer, hoverable, children, roundedCorners, tag, boxShadow, ...props }: import("@ibti-tech/ui").CardBaseProps) => import("react/jsx-runtime").JSX.Element, keyof import("react").Component<any, {}, any>>;
|
|
@@ -67,13 +70,6 @@ declare module '@ibti-tech/chatbot/components/ChatbotBody/index' {
|
|
|
67
70
|
declare module '@ibti-tech/chatbot/components/ChatbotBody/index.d.ts' {
|
|
68
71
|
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../home/juan/projetos/ibti/chatbot/ibti-chatbot/src/components/ChatbotBody/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAA;AAShD,MAAM,MAAM,gBAAgB,GAAG,EAAE,CAAA;AAEjC,eAAO,MAAM,WAAW,+BAoCvB,CAAA;AAED,eAAe,WAAW,CAAA"}
|
|
69
72
|
}
|
|
70
|
-
declare module '@ibti-tech/chatbot/components/ChatbotBody/index.spec' {
|
|
71
|
-
export {};
|
|
72
|
-
//# sourceMappingURL=index.spec.d.ts.map
|
|
73
|
-
}
|
|
74
|
-
declare module '@ibti-tech/chatbot/components/ChatbotBody/index.spec.d.ts' {
|
|
75
|
-
{"version":3,"file":"index.spec.d.ts","sourceRoot":"","sources":["../../../../../home/juan/projetos/ibti/chatbot/ibti-chatbot/src/components/ChatbotBody/index.spec.tsx"],"names":[],"mappings":""}
|
|
76
|
-
}
|
|
77
73
|
declare module '@ibti-tech/chatbot/components/ChatbotBody/styles' {
|
|
78
74
|
/// <reference types="react" />
|
|
79
75
|
export const ChatbotInput: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -92,7 +88,7 @@ declare module '@ibti-tech/chatbot/components/ChatbotDevice/index' {
|
|
|
92
88
|
//# sourceMappingURL=index.d.ts.map
|
|
93
89
|
}
|
|
94
90
|
declare module '@ibti-tech/chatbot/components/ChatbotDevice/index.d.ts' {
|
|
95
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../home/juan/projetos/ibti/chatbot/ibti-chatbot/src/components/ChatbotDevice/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
91
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../home/juan/projetos/ibti/chatbot/ibti-chatbot/src/components/ChatbotDevice/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAUzB,MAAM,MAAM,kBAAkB,GAAG,EAAE,CAAA;AAEnC,eAAO,MAAM,aAAa,OAAQ,kBAAkB,sBAanD,CAAA;AAED,eAAe,aAAa,CAAA"}
|
|
96
92
|
}
|
|
97
93
|
declare module '@ibti-tech/chatbot/components/ChatbotDevice/styles' {
|
|
98
94
|
/// <reference types="react" />
|
|
@@ -102,7 +98,7 @@ declare module '@ibti-tech/chatbot/components/ChatbotDevice/styles' {
|
|
|
102
98
|
//# sourceMappingURL=styles.d.ts.map
|
|
103
99
|
}
|
|
104
100
|
declare module '@ibti-tech/chatbot/components/ChatbotDevice/styles.d.ts' {
|
|
105
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../home/juan/projetos/ibti/chatbot/ibti-chatbot/src/components/ChatbotDevice/styles.ts"],"names":[],"mappings":";
|
|
101
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../home/juan/projetos/ibti/chatbot/ibti-chatbot/src/components/ChatbotDevice/styles.ts"],"names":[],"mappings":";AAGA,eAAO,MAAM,OAAO;aAAyB,OAAO;YA0BnD,CAAA"}
|
|
106
102
|
}
|
|
107
103
|
declare module '@ibti-tech/chatbot/components/ChatbotFooter/index' {
|
|
108
104
|
import React from 'react';
|
|
@@ -112,14 +108,7 @@ declare module '@ibti-tech/chatbot/components/ChatbotFooter/index' {
|
|
|
112
108
|
//# sourceMappingURL=index.d.ts.map
|
|
113
109
|
}
|
|
114
110
|
declare module '@ibti-tech/chatbot/components/ChatbotFooter/index.d.ts' {
|
|
115
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../home/juan/projetos/ibti/chatbot/ibti-chatbot/src/components/ChatbotFooter/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAA;
|
|
116
|
-
}
|
|
117
|
-
declare module '@ibti-tech/chatbot/components/ChatbotFooter/index.spec' {
|
|
118
|
-
export {};
|
|
119
|
-
//# sourceMappingURL=index.spec.d.ts.map
|
|
120
|
-
}
|
|
121
|
-
declare module '@ibti-tech/chatbot/components/ChatbotFooter/index.spec.d.ts' {
|
|
122
|
-
{"version":3,"file":"index.spec.d.ts","sourceRoot":"","sources":["../../../../../home/juan/projetos/ibti/chatbot/ibti-chatbot/src/components/ChatbotFooter/index.spec.tsx"],"names":[],"mappings":""}
|
|
111
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../home/juan/projetos/ibti/chatbot/ibti-chatbot/src/components/ChatbotFooter/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAcvC,MAAM,MAAM,kBAAkB,GAAG,EAAE,CAAA;AAEnC,eAAO,MAAM,aAAa,OAAQ,kBAAkB,sBAwCnD,CAAA;AAED,eAAe,aAAa,CAAA"}
|
|
123
112
|
}
|
|
124
113
|
declare module '@ibti-tech/chatbot/components/ChatbotFooter/styles' {
|
|
125
114
|
/// <reference types="react" />
|
|
@@ -133,20 +122,16 @@ declare module '@ibti-tech/chatbot/components/ChatbotFooter/styles.d.ts' {
|
|
|
133
122
|
}
|
|
134
123
|
declare module '@ibti-tech/chatbot/components/ChatbotHeader/index' {
|
|
135
124
|
import React from 'react';
|
|
136
|
-
|
|
137
|
-
export
|
|
125
|
+
import { useChatFeedbackBox } from 'contexts/Chatbot/useChatFeedbackBox';
|
|
126
|
+
export type ChatbotHeaderProps = {
|
|
127
|
+
chatFeedbackBox: ReturnType<typeof useChatFeedbackBox>;
|
|
128
|
+
};
|
|
129
|
+
export const ChatbotHeader: ({ chatFeedbackBox }: ChatbotHeaderProps) => React.JSX.Element;
|
|
138
130
|
export default ChatbotHeader;
|
|
139
131
|
//# sourceMappingURL=index.d.ts.map
|
|
140
132
|
}
|
|
141
133
|
declare module '@ibti-tech/chatbot/components/ChatbotHeader/index.d.ts' {
|
|
142
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../home/juan/projetos/ibti/chatbot/ibti-chatbot/src/components/ChatbotHeader/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,MAAM,MAAM,kBAAkB,GAAG,EAAE,CAAA;
|
|
143
|
-
}
|
|
144
|
-
declare module '@ibti-tech/chatbot/components/ChatbotHeader/index.spec' {
|
|
145
|
-
export {};
|
|
146
|
-
//# sourceMappingURL=index.spec.d.ts.map
|
|
147
|
-
}
|
|
148
|
-
declare module '@ibti-tech/chatbot/components/ChatbotHeader/index.spec.d.ts' {
|
|
149
|
-
{"version":3,"file":"index.spec.d.ts","sourceRoot":"","sources":["../../../../../home/juan/projetos/ibti/chatbot/ibti-chatbot/src/components/ChatbotHeader/index.spec.tsx"],"names":[],"mappings":""}
|
|
134
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../home/juan/projetos/ibti/chatbot/ibti-chatbot/src/components/ChatbotHeader/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAA;AAExE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,eAAe,EAAE,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAA;CACvD,CAAA;AAED,eAAO,MAAM,aAAa,wBAAyB,kBAAkB,sBAqBpE,CAAA;AAED,eAAe,aAAa,CAAA"}
|
|
150
135
|
}
|
|
151
136
|
declare module '@ibti-tech/chatbot/components/ChatbotHeader/styles' {
|
|
152
137
|
/// <reference types="react" />
|
|
@@ -157,7 +142,7 @@ declare module '@ibti-tech/chatbot/components/ChatbotHeader/styles' {
|
|
|
157
142
|
//# sourceMappingURL=styles.d.ts.map
|
|
158
143
|
}
|
|
159
144
|
declare module '@ibti-tech/chatbot/components/ChatbotHeader/styles.d.ts' {
|
|
160
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../home/juan/projetos/ibti/chatbot/ibti-chatbot/src/components/ChatbotHeader/styles.ts"],"names":[],"mappings":";AAEA,eAAO,MAAM,IAAI,+NAGhB,CAAA;AAED,eAAO,MAAM,WAAW,
|
|
145
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../home/juan/projetos/ibti/chatbot/ibti-chatbot/src/components/ChatbotHeader/styles.ts"],"names":[],"mappings":";AAEA,eAAO,MAAM,IAAI,+NAGhB,CAAA;AAED,eAAO,MAAM,WAAW,6NAIvB,CAAA;AAED,eAAO,MAAM,YAAY,+NAaxB,CAAA;AAED,eAAO,MAAM,OAAO,6NAMnB,CAAA"}
|
|
161
146
|
}
|
|
162
147
|
declare module '@ibti-tech/chatbot/components/ChatbotStatusLabel/index' {
|
|
163
148
|
import React from 'react';
|
|
@@ -209,20 +194,14 @@ declare module '@ibti-tech/chatbot/components/MessageBalloon/index' {
|
|
|
209
194
|
//# sourceMappingURL=index.d.ts.map
|
|
210
195
|
}
|
|
211
196
|
declare module '@ibti-tech/chatbot/components/MessageBalloon/index.d.ts' {
|
|
212
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../home/juan/projetos/ibti/chatbot/ibti-chatbot/src/components/MessageBalloon/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;
|
|
213
|
-
}
|
|
214
|
-
declare module '@ibti-tech/chatbot/components/MessageBalloon/index.spec' {
|
|
215
|
-
export {};
|
|
216
|
-
//# sourceMappingURL=index.spec.d.ts.map
|
|
217
|
-
}
|
|
218
|
-
declare module '@ibti-tech/chatbot/components/MessageBalloon/index.spec.d.ts' {
|
|
219
|
-
{"version":3,"file":"index.spec.d.ts","sourceRoot":"","sources":["../../../../../home/juan/projetos/ibti/chatbot/ibti-chatbot/src/components/MessageBalloon/index.spec.tsx"],"names":[],"mappings":""}
|
|
197
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../home/juan/projetos/ibti/chatbot/ibti-chatbot/src/components/MessageBalloon/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAOpC,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,YAAY,CAAC,WAAW,CAAA;IAC9B,cAAc,EAAE,MAAM,CAAA;CACvB,CAAA;AAOD,eAAO,MAAM,cAAc,8BAGxB,mBAAmB,sBAiBrB,CAAA;AAED,eAAe,cAAc,CAAA"}
|
|
220
198
|
}
|
|
221
199
|
declare module '@ibti-tech/chatbot/components/MessageBalloon/styles' {
|
|
222
200
|
/// <reference types="react" />
|
|
223
201
|
export const Time: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
|
|
224
202
|
export const Balloon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
225
203
|
$type: 'received' | 'sent';
|
|
204
|
+
$error?: boolean | undefined;
|
|
226
205
|
}>> & string;
|
|
227
206
|
export const Label: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
|
|
228
207
|
export const Wrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
@@ -231,7 +210,7 @@ declare module '@ibti-tech/chatbot/components/MessageBalloon/styles' {
|
|
|
231
210
|
//# sourceMappingURL=styles.d.ts.map
|
|
232
211
|
}
|
|
233
212
|
declare module '@ibti-tech/chatbot/components/MessageBalloon/styles.d.ts' {
|
|
234
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../home/juan/projetos/ibti/chatbot/ibti-chatbot/src/components/MessageBalloon/styles.ts"],"names":[],"mappings":";AAGA,eAAO,MAAM,IAAI,+NAEhB,CAAA;AAED,eAAO,MAAM,OAAO;
|
|
213
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../home/juan/projetos/ibti/chatbot/ibti-chatbot/src/components/MessageBalloon/styles.ts"],"names":[],"mappings":";AAGA,eAAO,MAAM,IAAI,+NAEhB,CAAA;AAED,eAAO,MAAM,OAAO;WACX,UAAU,GAAG,MAAM;;YA0E3B,CAAA;AAED,eAAO,MAAM,KAAK,+NAEjB,CAAA;AAED,eAAO,MAAM,OAAO;WAAuB,UAAU,GAAG,MAAM;YAiB7D,CAAA"}
|
|
235
214
|
}
|
|
236
215
|
declare module '@ibti-tech/chatbot/components/SuggestedQuestions/index' {
|
|
237
216
|
import React from 'react';
|
|
@@ -243,13 +222,6 @@ declare module '@ibti-tech/chatbot/components/SuggestedQuestions/index' {
|
|
|
243
222
|
declare module '@ibti-tech/chatbot/components/SuggestedQuestions/index.d.ts' {
|
|
244
223
|
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../home/juan/projetos/ibti/chatbot/ibti-chatbot/src/components/SuggestedQuestions/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,MAAM,MAAM,uBAAuB,GAAG,EAAE,CAAA;AAExC,eAAO,MAAM,kBAAkB,OAAQ,uBAAuB,kCA4B7D,CAAA;AAED,eAAe,kBAAkB,CAAA"}
|
|
245
224
|
}
|
|
246
|
-
declare module '@ibti-tech/chatbot/components/SuggestedQuestions/index.spec' {
|
|
247
|
-
export {};
|
|
248
|
-
//# sourceMappingURL=index.spec.d.ts.map
|
|
249
|
-
}
|
|
250
|
-
declare module '@ibti-tech/chatbot/components/SuggestedQuestions/index.spec.d.ts' {
|
|
251
|
-
{"version":3,"file":"index.spec.d.ts","sourceRoot":"","sources":["../../../../../home/juan/projetos/ibti/chatbot/ibti-chatbot/src/components/SuggestedQuestions/index.spec.tsx"],"names":[],"mappings":""}
|
|
252
|
-
}
|
|
253
225
|
declare module '@ibti-tech/chatbot/components/SuggestedQuestions/styles' {
|
|
254
226
|
/// <reference types="react" />
|
|
255
227
|
export const QuestionButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("@ibti-tech/ui").ButtonProps & import("styled-components/dist/types").BaseObject, import("styled-components/dist/types").BaseObject>> & string & Omit<({ size, suffix, prefix, fillWidth, ...props }: import("@ibti-tech/ui").ButtonProps) => import("react/jsx-runtime").JSX.Element, keyof import("react").Component<any, {}, any>>;
|
|
@@ -307,6 +279,7 @@ declare module '@ibti-tech/chatbot/contexts/Chatbot/useChatFeedbackBox' {
|
|
|
307
279
|
};
|
|
308
280
|
export const useChatFeedbackBox: () => {
|
|
309
281
|
opened: boolean;
|
|
282
|
+
open: () => void;
|
|
310
283
|
close: () => void;
|
|
311
284
|
sendUserRating: ({ ratingScore, description, }: SendUserRatingProps) => Promise<void>;
|
|
312
285
|
loading: boolean;
|
|
@@ -315,7 +288,7 @@ declare module '@ibti-tech/chatbot/contexts/Chatbot/useChatFeedbackBox' {
|
|
|
315
288
|
//# sourceMappingURL=useChatFeedbackBox.d.ts.map
|
|
316
289
|
}
|
|
317
290
|
declare module '@ibti-tech/chatbot/contexts/Chatbot/useChatFeedbackBox.d.ts' {
|
|
318
|
-
{"version":3,"file":"useChatFeedbackBox.d.ts","sourceRoot":"","sources":["../../../../../home/juan/projetos/ibti/chatbot/ibti-chatbot/src/contexts/Chatbot/useChatFeedbackBox.ts"],"names":[],"mappings":"AAIA,KAAK,mBAAmB,GAAG;IACzB,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,kBAAkB
|
|
291
|
+
{"version":3,"file":"useChatFeedbackBox.d.ts","sourceRoot":"","sources":["../../../../../home/juan/projetos/ibti/chatbot/ibti-chatbot/src/contexts/Chatbot/useChatFeedbackBox.ts"],"names":[],"mappings":"AAIA,KAAK,mBAAmB,GAAG;IACzB,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,kBAAkB;;;;oDAsB1B,mBAAmB;;CA2BvB,CAAA"}
|
|
319
292
|
}
|
|
320
293
|
declare module '@ibti-tech/chatbot/contexts/Chatbot/useChatbot' {
|
|
321
294
|
export const useChatbot: () => import("@ibti-tech/chatbot/contexts/Chatbot/context").ChatbotContextProps;
|
|
@@ -348,7 +321,7 @@ declare module '@ibti-tech/chatbot/contexts/Chatbot/useChatbotMessages' {
|
|
|
348
321
|
//# sourceMappingURL=useChatbotMessages.d.ts.map
|
|
349
322
|
}
|
|
350
323
|
declare module '@ibti-tech/chatbot/contexts/Chatbot/useChatbotMessages.d.ts' {
|
|
351
|
-
{"version":3,"file":"useChatbotMessages.d.ts","sourceRoot":"","sources":["../../../../../home/juan/projetos/ibti/chatbot/ibti-chatbot/src/contexts/Chatbot/useChatbotMessages.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;
|
|
324
|
+
{"version":3,"file":"useChatbotMessages.d.ts","sourceRoot":"","sources":["../../../../../home/juan/projetos/ibti/chatbot/ibti-chatbot/src/contexts/Chatbot/useChatbotMessages.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAQpC,MAAM,MAAM,yBAAyB,GAAG;IACtC,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,YAAY,CAAC,MAAM,CAAA;CAC5B,CAAA;AAED,eAAO,MAAM,kBAAkB,wBAG5B,yBAAyB;;iCA4EgB,MAAM;;;;;;;;;;CAqFjD,CAAA;AAED,eAAe,kBAAkB,CAAA"}
|
|
352
325
|
}
|
|
353
326
|
declare module '@ibti-tech/chatbot/contexts/Chatbot/useChatbotSuggestedQuestions' {
|
|
354
327
|
import { ChatbotTypes } from 'types';
|
|
@@ -368,6 +341,19 @@ declare module '@ibti-tech/chatbot/contexts/Chatbot/useChatbotSuggestedQuestions
|
|
|
368
341
|
declare module '@ibti-tech/chatbot/contexts/Chatbot/useChatbotSuggestedQuestions.d.ts' {
|
|
369
342
|
{"version":3,"file":"useChatbotSuggestedQuestions.d.ts","sourceRoot":"","sources":["../../../../../home/juan/projetos/ibti/chatbot/ibti-chatbot/src/contexts/Chatbot/useChatbotSuggestedQuestions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAEpC,MAAM,MAAM,mCAAmC,GAAG;IAChD,WAAW,EAAE,YAAY,CAAC,eAAe,EAAE,CAAA;IAC3C,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,YAAY,CAAC,MAAM,CAAA;CAC5B,CAAA;AAED,eAAO,MAAM,4BAA4B,qCAItC,mCAAmC;;;;;CA2BrC,CAAA"}
|
|
370
343
|
}
|
|
344
|
+
declare module '@ibti-tech/chatbot/cookies/chat' {
|
|
345
|
+
import { ChatbotTypes } from 'types';
|
|
346
|
+
export class ChatCookieManager {
|
|
347
|
+
cookieKey: string;
|
|
348
|
+
checkValidJSONData(data: any): void;
|
|
349
|
+
getData(): ChatbotTypes.ChatMessage[];
|
|
350
|
+
saveData(data: ChatbotTypes.ChatMessage[]): void;
|
|
351
|
+
}
|
|
352
|
+
//# sourceMappingURL=chat.d.ts.map
|
|
353
|
+
}
|
|
354
|
+
declare module '@ibti-tech/chatbot/cookies/chat.d.ts' {
|
|
355
|
+
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../../../home/juan/projetos/ibti/chatbot/ibti-chatbot/src/cookies/chat.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAEpC,qBAAa,iBAAiB;IAC5B,SAAS,SAAqB;IAE9B,kBAAkB,CAAC,IAAI,EAAE,GAAG;IAQ5B,OAAO,IAAI,YAAY,CAAC,WAAW,EAAE;IAiBrC,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC,WAAW,EAAE;CAW1C"}
|
|
356
|
+
}
|
|
371
357
|
declare module '@ibti-tech/chatbot/events/assistant-answer' {
|
|
372
358
|
export const dispatchAssitantAnswer: () => void;
|
|
373
359
|
//# sourceMappingURL=assistant-answer.d.ts.map
|
|
@@ -443,12 +429,13 @@ declare module '@ibti-tech/chatbot/i18n/LocaleTerms' {
|
|
|
443
429
|
MESSAGE_FIELD: string;
|
|
444
430
|
SUBMIT_BUTTON: string;
|
|
445
431
|
CLOSE_BUTTON: string;
|
|
432
|
+
RATE: string;
|
|
446
433
|
};
|
|
447
434
|
}
|
|
448
435
|
//# sourceMappingURL=LocaleTerms.d.ts.map
|
|
449
436
|
}
|
|
450
437
|
declare module '@ibti-tech/chatbot/i18n/LocaleTerms.d.ts' {
|
|
451
|
-
{"version":3,"file":"LocaleTerms.d.ts","sourceRoot":"","sources":["../../../../home/juan/projetos/ibti/chatbot/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;
|
|
438
|
+
{"version":3,"file":"LocaleTerms.d.ts","sourceRoot":"","sources":["../../../../home/juan/projetos/ibti/chatbot/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;QACpB,IAAI,EAAE,MAAM,CAAA;KACb,CAAA;CACF"}
|
|
452
439
|
}
|
|
453
440
|
declare module '@ibti-tech/chatbot/i18n/index' {
|
|
454
441
|
import { ChatbotTypes } from 'types';
|
|
@@ -472,13 +459,6 @@ declare module '@ibti-tech/chatbot/index' {
|
|
|
472
459
|
declare module '@ibti-tech/chatbot/index.d.ts' {
|
|
473
460
|
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../home/juan/projetos/ibti/chatbot/ibti-chatbot/src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA"}
|
|
474
461
|
}
|
|
475
|
-
declare module '@ibti-tech/chatbot/index.spec' {
|
|
476
|
-
export {};
|
|
477
|
-
//# sourceMappingURL=index.spec.d.ts.map
|
|
478
|
-
}
|
|
479
|
-
declare module '@ibti-tech/chatbot/index.spec.d.ts' {
|
|
480
|
-
{"version":3,"file":"index.spec.d.ts","sourceRoot":"","sources":["../../../home/juan/projetos/ibti/chatbot/ibti-chatbot/src/index.spec.tsx"],"names":[],"mappings":""}
|
|
481
|
-
}
|
|
482
462
|
declare module '@ibti-tech/chatbot/mocks/chatHistory' {
|
|
483
463
|
export const chatHistoryMocked: readonly [{
|
|
484
464
|
readonly timestamp: "2024-05-23T10:15:00Z";
|
|
@@ -551,7 +531,6 @@ declare module '@ibti-tech/chatbot/services/chatbot-api' {
|
|
|
551
531
|
apiURL: string;
|
|
552
532
|
onReceiving: (receivedMessage: string, receivedPart: string) => void;
|
|
553
533
|
onDone: () => void;
|
|
554
|
-
onError: (err: unknown) => void;
|
|
555
534
|
};
|
|
556
535
|
export type GetSuggestedQuestions = {
|
|
557
536
|
chatContext: Pick<ChatbotTypes.ChatMessage, 'content' | 'role'>[];
|
|
@@ -566,12 +545,13 @@ declare module '@ibti-tech/chatbot/services/chatbot-api' {
|
|
|
566
545
|
ratingScore: number;
|
|
567
546
|
description?: string;
|
|
568
547
|
};
|
|
569
|
-
export const sendChatContext: ({ chatContext, locale, onReceiving, onDone, apiURL,
|
|
548
|
+
export const sendChatContext: ({ chatContext, locale, onReceiving, onDone, apiURL, }: SendNewQuestionOptions) => Promise<void>;
|
|
570
549
|
export const sendUserChatFeedback: ({ apiURL, chatContext, locale, ratingScore, description, }: SendUserChatFeedbackParams) => Promise<Response>;
|
|
550
|
+
export const getWelcomeMessage: (apiUrl: string, locale?: ChatbotTypes.Locale) => Promise<string>;
|
|
571
551
|
//# sourceMappingURL=chatbot-api.d.ts.map
|
|
572
552
|
}
|
|
573
553
|
declare module '@ibti-tech/chatbot/services/chatbot-api.d.ts' {
|
|
574
|
-
{"version":3,"file":"chatbot-api.d.ts","sourceRoot":"","sources":["../../../../home/juan/projetos/ibti/chatbot/ibti-chatbot/src/services/chatbot-api.ts"],"names":[],"mappings":"
|
|
554
|
+
{"version":3,"file":"chatbot-api.d.ts","sourceRoot":"","sources":["../../../../home/juan/projetos/ibti/chatbot/ibti-chatbot/src/services/chatbot-api.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAEpC,MAAM,MAAM,sBAAsB,GAAG;IACnC,WAAW,EAAE,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,SAAS,GAAG,MAAM,CAAC,EAAE,CAAA;IACjE,MAAM,EAAE,YAAY,CAAC,MAAM,CAAA;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,CAAC,eAAe,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,KAAK,IAAI,CAAA;IACpE,MAAM,EAAE,MAAM,IAAI,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,WAAW,EAAE,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,SAAS,GAAG,MAAM,CAAC,EAAE,CAAA;IACjE,MAAM,EAAE,YAAY,CAAC,MAAM,CAAA;IAC3B,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAA;AAEzC,MAAM,MAAM,0BAA0B,GAAG;IACvC,MAAM,EAAE,YAAY,CAAC,MAAM,CAAA;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,SAAS,GAAG,MAAM,CAAC,EAAE,CAAA;IACjE,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,eAAO,MAAM,eAAe,0DAMzB,sBAAsB,kBAuCrB,CAAA;AAyBJ,eAAO,MAAM,oBAAoB,+DAM9B,0BAA0B,sBAYzB,CAAA;AAEJ,eAAO,MAAM,iBAAiB,WACpB,MAAM,WACN,aAAa,MAAM,oBAS5B,CAAA"}
|
|
575
555
|
}
|
|
576
556
|
declare module '@ibti-tech/chatbot/themes/index' {
|
|
577
557
|
export const themes: {
|
|
@@ -672,6 +652,7 @@ declare module '@ibti-tech/chatbot/types/index' {
|
|
|
672
652
|
timestamp: string;
|
|
673
653
|
role: 'user' | 'assistant';
|
|
674
654
|
content: string;
|
|
655
|
+
error?: boolean;
|
|
675
656
|
};
|
|
676
657
|
type ChatContextItem = {
|
|
677
658
|
role: 'user' | 'assistant';
|
|
@@ -686,7 +667,7 @@ declare module '@ibti-tech/chatbot/types/index' {
|
|
|
686
667
|
//# sourceMappingURL=index.d.ts.map
|
|
687
668
|
}
|
|
688
669
|
declare module '@ibti-tech/chatbot/types/index.d.ts' {
|
|
689
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../home/juan/projetos/ibti/chatbot/ibti-chatbot/src/types/index.ts"],"names":[],"mappings":"AAAA,yBAAiB,YAAY,CAAC;IAC5B,KAAY,KAAK,GAAG,OAAO,GAAG,MAAM,CAAA;IAEpC,KAAY,MAAM,GAAG,OAAO,GAAG,IAAI,CAAA;IAEnC,KAAY,WAAW,GAAG;QACxB,EAAE,EAAE,MAAM,CAAA;QACV,SAAS,EAAE,MAAM,CAAA;QACjB,IAAI,EAAE,MAAM,GAAG,WAAW,CAAA;QAC1B,OAAO,EAAE,MAAM,CAAA;KAChB,CAAA;IAED,KAAY,eAAe,GAAG;QAC5B,IAAI,EAAE,MAAM,GAAG,WAAW,CAAA;QAC1B,OAAO,EAAE,MAAM,CAAA;KAChB,CAAA;IAED,KAAY,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,aAAa,CAAA;IAErE,UAAiB,MAAM;QACrB,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,sBAAsB,CAAC,EAAE,MAAM,CAAA;KAChC;CACF"}
|
|
670
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../home/juan/projetos/ibti/chatbot/ibti-chatbot/src/types/index.ts"],"names":[],"mappings":"AAAA,yBAAiB,YAAY,CAAC;IAC5B,KAAY,KAAK,GAAG,OAAO,GAAG,MAAM,CAAA;IAEpC,KAAY,MAAM,GAAG,OAAO,GAAG,IAAI,CAAA;IAEnC,KAAY,WAAW,GAAG;QACxB,EAAE,EAAE,MAAM,CAAA;QACV,SAAS,EAAE,MAAM,CAAA;QACjB,IAAI,EAAE,MAAM,GAAG,WAAW,CAAA;QAC1B,OAAO,EAAE,MAAM,CAAA;QACf,KAAK,CAAC,EAAE,OAAO,CAAA;KAChB,CAAA;IAED,KAAY,eAAe,GAAG;QAC5B,IAAI,EAAE,MAAM,GAAG,WAAW,CAAA;QAC1B,OAAO,EAAE,MAAM,CAAA;KAChB,CAAA;IAED,KAAY,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,aAAa,CAAA;IAErE,UAAiB,MAAM;QACrB,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,sBAAsB,CAAC,EAAE,MAAM,CAAA;KAChC;CACF"}
|
|
690
671
|
}
|
|
691
672
|
declare module '@ibti-tech/chatbot/utils/formatMessageTime' {
|
|
692
673
|
import { ChatbotTypes } from 'types';
|
package/dist/index.mjs
CHANGED
|
@@ -59,14 +59,81 @@ var dispatchAssitantAnswer = /* @__PURE__ */ __name(() => {
|
|
|
59
59
|
document.dispatchEvent(evt);
|
|
60
60
|
}, "dispatchAssitantAnswer");
|
|
61
61
|
|
|
62
|
+
// src/i18n/en.json
|
|
63
|
+
var en_default = {
|
|
64
|
+
CHATBOT_NAME: "IBTI Chatbot (Beta)",
|
|
65
|
+
STATUS: {
|
|
66
|
+
ONLINE: "Now online",
|
|
67
|
+
LOADING: "Loading...",
|
|
68
|
+
WRITING: "Writing answer...",
|
|
69
|
+
UNAVAILABLE: "Unavailable"
|
|
70
|
+
},
|
|
71
|
+
ERRORS: {
|
|
72
|
+
UNKNOWN: "Sorry. We couldn't provide a response."
|
|
73
|
+
},
|
|
74
|
+
INPUT_PLACEHOLDER: "Ask something",
|
|
75
|
+
CHATBOT_BAR: {
|
|
76
|
+
OPEN: "Open {{CHATBOT_NAME}}",
|
|
77
|
+
CLOSE: "Close {{CHATBOT_NAME}}"
|
|
78
|
+
},
|
|
79
|
+
SUGGESTED_QUESTIONS: {
|
|
80
|
+
TITLE: "You may like to ask:",
|
|
81
|
+
LOADING: "Loading suggested questions..."
|
|
82
|
+
},
|
|
83
|
+
CHAT_FEEDBACK: {
|
|
84
|
+
TITLE: "Rate the Chatbot",
|
|
85
|
+
DESCRIPTION: "Give us a feedback about our bot assistant.",
|
|
86
|
+
MESSAGE_FIELD: "Description",
|
|
87
|
+
SUBMIT_BUTTON: "Send",
|
|
88
|
+
CLOSE_BUTTON: "Close",
|
|
89
|
+
RATE: "Rate assistant"
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
// src/i18n/pt_BR.json
|
|
94
|
+
var pt_BR_default = {
|
|
95
|
+
CHATBOT_NAME: "Assistente da IBTI (Beta)",
|
|
96
|
+
STATUS: {
|
|
97
|
+
ONLINE: "Ativo agora",
|
|
98
|
+
LOADING: "Carregando...",
|
|
99
|
+
WRITING: "Escrevendo resposta...",
|
|
100
|
+
UNAVAILABLE: "Indispon\xEDvel"
|
|
101
|
+
},
|
|
102
|
+
ERRORS: {
|
|
103
|
+
UNKNOWN: "Desculpe. N\xE3o conseguimos fornecer uma resposta."
|
|
104
|
+
},
|
|
105
|
+
INPUT_PLACEHOLDER: "Pergunte alguma coisa",
|
|
106
|
+
CHATBOT_BAR: {
|
|
107
|
+
OPEN: "Abrir Assistente da IBTI",
|
|
108
|
+
CLOSE: "Fechar Assistente da IBTI"
|
|
109
|
+
},
|
|
110
|
+
SUGGESTED_QUESTIONS: {
|
|
111
|
+
TITLE: "Voc\xEA pode querer perguntar:",
|
|
112
|
+
LOADING: "Carregando perguntas sugeridas..."
|
|
113
|
+
},
|
|
114
|
+
CHAT_FEEDBACK: {
|
|
115
|
+
TITLE: "Avalie nosso Assistente",
|
|
116
|
+
DESCRIPTION: "D\xEA-nos um feedback sobre o nosso assistente virtual.",
|
|
117
|
+
MESSAGE_FIELD: "Descri\xE7\xE3o",
|
|
118
|
+
SUBMIT_BUTTON: "Enviar",
|
|
119
|
+
CLOSE_BUTTON: "Fechar",
|
|
120
|
+
RATE: "Avaliar assistente"
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
// src/i18n/index.ts
|
|
125
|
+
var i18n = {
|
|
126
|
+
en: en_default,
|
|
127
|
+
"pt-BR": pt_BR_default
|
|
128
|
+
};
|
|
129
|
+
|
|
62
130
|
// src/services/chatbot-api.ts
|
|
63
131
|
var sendChatContext = /* @__PURE__ */ __name(async ({
|
|
64
132
|
chatContext,
|
|
65
133
|
locale = "en",
|
|
66
134
|
onReceiving,
|
|
67
135
|
onDone,
|
|
68
|
-
apiURL
|
|
69
|
-
onError
|
|
136
|
+
apiURL
|
|
70
137
|
}) => fetch(`${apiURL}/chat/completion?locale=${locale}`, {
|
|
71
138
|
method: "POST",
|
|
72
139
|
headers: {
|
|
@@ -76,6 +143,10 @@ var sendChatContext = /* @__PURE__ */ __name(async ({
|
|
|
76
143
|
context: chatContext
|
|
77
144
|
})
|
|
78
145
|
}).then((response) => {
|
|
146
|
+
if (!response.ok)
|
|
147
|
+
throw new Error(
|
|
148
|
+
i18n[locale].ERRORS.UNKNOWN + ` (status: ${response.status})`
|
|
149
|
+
);
|
|
79
150
|
if (!response.body) return;
|
|
80
151
|
const reader = response.body.getReader();
|
|
81
152
|
const decoder = new TextDecoder();
|
|
@@ -94,8 +165,6 @@ var sendChatContext = /* @__PURE__ */ __name(async ({
|
|
|
94
165
|
}
|
|
95
166
|
__name(read, "read");
|
|
96
167
|
read();
|
|
97
|
-
}).catch((err) => {
|
|
98
|
-
onError(err);
|
|
99
168
|
}), "sendChatContext");
|
|
100
169
|
var sendUserChatFeedback = /* @__PURE__ */ __name(async ({
|
|
101
170
|
apiURL,
|
|
@@ -115,16 +184,73 @@ var sendUserChatFeedback = /* @__PURE__ */ __name(async ({
|
|
|
115
184
|
message: description
|
|
116
185
|
})
|
|
117
186
|
}), "sendUserChatFeedback");
|
|
187
|
+
var getWelcomeMessage = /* @__PURE__ */ __name(async (apiUrl, locale = "en") => {
|
|
188
|
+
const req = await fetch(`${apiUrl}/chat/welcome?locale=${locale}`, {
|
|
189
|
+
method: "GET"
|
|
190
|
+
});
|
|
191
|
+
const data = await req.json();
|
|
192
|
+
return data.welcomeMessage;
|
|
193
|
+
}, "getWelcomeMessage");
|
|
194
|
+
|
|
195
|
+
// src/cookies/chat.tsx
|
|
196
|
+
import { parseCookies, setCookie } from "nookies";
|
|
197
|
+
var ChatCookieManager = class {
|
|
198
|
+
constructor() {
|
|
199
|
+
this.cookieKey = "ibtiChatbot@chat";
|
|
200
|
+
}
|
|
201
|
+
static {
|
|
202
|
+
__name(this, "ChatCookieManager");
|
|
203
|
+
}
|
|
204
|
+
checkValidJSONData(data) {
|
|
205
|
+
try {
|
|
206
|
+
JSON.parse(JSON.stringify(data));
|
|
207
|
+
} catch (err) {
|
|
208
|
+
throw new Error("Invalid chat context data.");
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
getData() {
|
|
212
|
+
const cookies = parseCookies();
|
|
213
|
+
if (!cookies[this.cookieKey]) {
|
|
214
|
+
this.saveData([]);
|
|
215
|
+
return [];
|
|
216
|
+
}
|
|
217
|
+
try {
|
|
218
|
+
const data = JSON.parse(cookies[this.cookieKey]);
|
|
219
|
+
return data;
|
|
220
|
+
} catch (err) {
|
|
221
|
+
this.saveData([]);
|
|
222
|
+
return [];
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
saveData(data) {
|
|
226
|
+
try {
|
|
227
|
+
this.checkValidJSONData(data);
|
|
228
|
+
setCookie(null, this.cookieKey, JSON.stringify(data), {
|
|
229
|
+
expiresIn: 60 * 60 * 24
|
|
230
|
+
});
|
|
231
|
+
} catch (err) {
|
|
232
|
+
throw new Error("Fail to save chat context data");
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
// src/hooks/useI18n.ts
|
|
238
|
+
var useI18n = /* @__PURE__ */ __name(() => {
|
|
239
|
+
const { locale } = useChatbot();
|
|
240
|
+
return i18n[locale];
|
|
241
|
+
}, "useI18n");
|
|
118
242
|
|
|
119
243
|
// src/contexts/Chatbot/useChatbotMessages.ts
|
|
120
244
|
var useChatbotMessages = /* @__PURE__ */ __name(({
|
|
121
245
|
apiURL,
|
|
122
246
|
locale
|
|
123
247
|
}) => {
|
|
248
|
+
const i18n2 = useI18n();
|
|
249
|
+
const chatCookie = new ChatCookieManager();
|
|
124
250
|
const [chatMessages, setChatMessages] = useState2(
|
|
125
251
|
[]
|
|
126
252
|
);
|
|
127
|
-
const [
|
|
253
|
+
const [initialized, setInitialized] = useState2(false);
|
|
128
254
|
const [loading, setLoading] = useState2(false);
|
|
129
255
|
const [writing, setWriting] = useState2(false);
|
|
130
256
|
const [error, setError] = useState2();
|
|
@@ -151,13 +277,14 @@ var useChatbotMessages = /* @__PURE__ */ __name(({
|
|
|
151
277
|
setChatMessages(newHistory);
|
|
152
278
|
return messageData;
|
|
153
279
|
}, "createQuestionMessageIntoHistory");
|
|
154
|
-
const createOrUpdateAnswerMessageIntoHistory = /* @__PURE__ */ __name((answer, id) => {
|
|
280
|
+
const createOrUpdateAnswerMessageIntoHistory = /* @__PURE__ */ __name((answer, id, error2 = false) => {
|
|
155
281
|
const timestamp = (/* @__PURE__ */ new Date()).toUTCString();
|
|
156
282
|
const messageData = {
|
|
157
283
|
id,
|
|
158
284
|
timestamp,
|
|
159
285
|
role: "assistant",
|
|
160
|
-
content: answer
|
|
286
|
+
content: answer,
|
|
287
|
+
error: error2
|
|
161
288
|
};
|
|
162
289
|
setChatMessages((prev) => {
|
|
163
290
|
const itemAlreadyExists = prev.some((item) => item.id == id);
|
|
@@ -184,42 +311,64 @@ var useChatbotMessages = /* @__PURE__ */ __name(({
|
|
|
184
311
|
userQuestion,
|
|
185
312
|
questionId
|
|
186
313
|
);
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
314
|
+
try {
|
|
315
|
+
await sendChatContext({
|
|
316
|
+
apiURL,
|
|
317
|
+
locale,
|
|
318
|
+
chatContext: [
|
|
319
|
+
...chatMessages.map((item) => ({
|
|
320
|
+
role: item.role,
|
|
321
|
+
content: item.content
|
|
322
|
+
})),
|
|
323
|
+
{ role: chatContext.role, content: chatContext.content }
|
|
324
|
+
],
|
|
325
|
+
onReceiving(receivedMessage) {
|
|
326
|
+
setLoading(false);
|
|
327
|
+
setWriting(true);
|
|
328
|
+
createOrUpdateAnswerMessageIntoHistory(receivedMessage, answerId);
|
|
329
|
+
},
|
|
330
|
+
onDone: /* @__PURE__ */ __name(() => {
|
|
331
|
+
setWriting(false);
|
|
332
|
+
suggestedQuestions.fetchData();
|
|
333
|
+
}, "onDone")
|
|
334
|
+
});
|
|
335
|
+
} catch (err) {
|
|
336
|
+
if (err instanceof Error) {
|
|
337
|
+
createOrUpdateAnswerMessageIntoHistory(err.message, answerId, true);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
chatCookie.saveData([
|
|
341
|
+
...chatMessages,
|
|
342
|
+
{
|
|
343
|
+
id: uuidv4(),
|
|
344
|
+
timestamp: (/* @__PURE__ */ new Date()).toUTCString(),
|
|
345
|
+
role: chatContext.role,
|
|
346
|
+
content: chatContext.content
|
|
347
|
+
}
|
|
348
|
+
]);
|
|
208
349
|
dispatchAssitantAnswer();
|
|
209
350
|
}, "makeQuestion");
|
|
210
|
-
const
|
|
211
|
-
const
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
351
|
+
const init = /* @__PURE__ */ __name(async () => {
|
|
352
|
+
const savedData = chatCookie.getData();
|
|
353
|
+
if (savedData && savedData.length > 0) {
|
|
354
|
+
setChatMessages(savedData);
|
|
355
|
+
} else {
|
|
356
|
+
const firstMessage = await getWelcomeMessage(apiURL, locale);
|
|
357
|
+
setChatMessages([
|
|
358
|
+
{
|
|
359
|
+
id: uuidv4(),
|
|
360
|
+
timestamp: (/* @__PURE__ */ new Date()).toUTCString(),
|
|
361
|
+
role: "assistant",
|
|
362
|
+
content: firstMessage
|
|
363
|
+
}
|
|
364
|
+
]);
|
|
365
|
+
}
|
|
366
|
+
setInitialized(true);
|
|
367
|
+
}, "init");
|
|
219
368
|
useEffect(() => {
|
|
220
|
-
if (
|
|
221
|
-
|
|
222
|
-
}, [
|
|
369
|
+
if (initialized) return;
|
|
370
|
+
init();
|
|
371
|
+
}, [initialized]);
|
|
223
372
|
return {
|
|
224
373
|
chatMessages,
|
|
225
374
|
makeQuestion,
|
|
@@ -307,7 +456,8 @@ var Wrapper = styled.div`
|
|
|
307
456
|
overflow: hidden;
|
|
308
457
|
pointer-events: all;
|
|
309
458
|
height: 100vh;
|
|
310
|
-
max-height:
|
|
459
|
+
max-height: calc(100vh - 45px);
|
|
460
|
+
box-sizing: border-box;
|
|
311
461
|
position: relative;
|
|
312
462
|
|
|
313
463
|
${screens.tablet} {
|
|
@@ -332,6 +482,7 @@ var Name = styled2.span`
|
|
|
332
482
|
var ProfileInfo = styled2.div`
|
|
333
483
|
display: flex;
|
|
334
484
|
flex-direction: column;
|
|
485
|
+
margin-right: auto;
|
|
335
486
|
`;
|
|
336
487
|
var ProfileImage = styled2.span`
|
|
337
488
|
height: 2.5rem;
|
|
@@ -367,78 +518,6 @@ var BotIcon = /* @__PURE__ */ __name(() => {
|
|
|
367
518
|
));
|
|
368
519
|
}, "BotIcon");
|
|
369
520
|
|
|
370
|
-
// src/i18n/en.json
|
|
371
|
-
var en_default = {
|
|
372
|
-
CHATBOT_NAME: "IBTI Chatbot (Beta)",
|
|
373
|
-
STATUS: {
|
|
374
|
-
ONLINE: "Now online",
|
|
375
|
-
LOADING: "Loading...",
|
|
376
|
-
WRITING: "Writing answer...",
|
|
377
|
-
UNAVAILABLE: "Unavailable"
|
|
378
|
-
},
|
|
379
|
-
ERRORS: {
|
|
380
|
-
UNKNOWN: "Sorry. We couldn't provide a response."
|
|
381
|
-
},
|
|
382
|
-
INPUT_PLACEHOLDER: "Ask something",
|
|
383
|
-
CHATBOT_BAR: {
|
|
384
|
-
OPEN: "Open {{CHATBOT_NAME}}",
|
|
385
|
-
CLOSE: "Close {{CHATBOT_NAME}}"
|
|
386
|
-
},
|
|
387
|
-
SUGGESTED_QUESTIONS: {
|
|
388
|
-
TITLE: "You may like to ask:",
|
|
389
|
-
LOADING: "Loading suggested questions..."
|
|
390
|
-
},
|
|
391
|
-
CHAT_FEEDBACK: {
|
|
392
|
-
TITLE: "Rate the Chatbot",
|
|
393
|
-
DESCRIPTION: "Give us a feedback about our bot assistant.",
|
|
394
|
-
MESSAGE_FIELD: "Description",
|
|
395
|
-
SUBMIT_BUTTON: "Send",
|
|
396
|
-
CLOSE_BUTTON: "Close"
|
|
397
|
-
}
|
|
398
|
-
};
|
|
399
|
-
|
|
400
|
-
// src/i18n/pt_BR.json
|
|
401
|
-
var pt_BR_default = {
|
|
402
|
-
CHATBOT_NAME: "Assistente da IBTI (Beta)",
|
|
403
|
-
STATUS: {
|
|
404
|
-
ONLINE: "Ativo agora",
|
|
405
|
-
LOADING: "Carregando...",
|
|
406
|
-
WRITING: "Escrevendo resposta...",
|
|
407
|
-
UNAVAILABLE: "Indispon\xEDvel"
|
|
408
|
-
},
|
|
409
|
-
ERRORS: {
|
|
410
|
-
UNKNOWN: "Desculpe. N\xE3o conseguimos fornecer uma resposta."
|
|
411
|
-
},
|
|
412
|
-
INPUT_PLACEHOLDER: "Pergunte alguma coisa",
|
|
413
|
-
CHATBOT_BAR: {
|
|
414
|
-
OPEN: "Abrir Assistente da IBTI",
|
|
415
|
-
CLOSE: "Fechar Assistente da IBTI"
|
|
416
|
-
},
|
|
417
|
-
SUGGESTED_QUESTIONS: {
|
|
418
|
-
TITLE: "Voc\xEA pode querer perguntar:",
|
|
419
|
-
LOADING: "Carregando perguntas sugeridas..."
|
|
420
|
-
},
|
|
421
|
-
CHAT_FEEDBACK: {
|
|
422
|
-
TITLE: "Avalie nosso Assistente",
|
|
423
|
-
DESCRIPTION: "D\xEA-nos um feedback sobre o nosso assistente virtual.",
|
|
424
|
-
MESSAGE_FIELD: "Descri\xE7\xE3o",
|
|
425
|
-
SUBMIT_BUTTON: "Enviar",
|
|
426
|
-
CLOSE_BUTTON: "Fechar"
|
|
427
|
-
}
|
|
428
|
-
};
|
|
429
|
-
|
|
430
|
-
// src/i18n/index.ts
|
|
431
|
-
var i18n = {
|
|
432
|
-
en: en_default,
|
|
433
|
-
"pt-BR": pt_BR_default
|
|
434
|
-
};
|
|
435
|
-
|
|
436
|
-
// src/hooks/useI18n.ts
|
|
437
|
-
var useI18n = /* @__PURE__ */ __name(() => {
|
|
438
|
-
const { locale } = useChatbot();
|
|
439
|
-
return i18n[locale];
|
|
440
|
-
}, "useI18n");
|
|
441
|
-
|
|
442
521
|
// src/components/ChatbotStatusLabel/index.tsx
|
|
443
522
|
import React5 from "react";
|
|
444
523
|
|
|
@@ -482,9 +561,19 @@ var ChatbotStatusLabel = /* @__PURE__ */ __name(({}) => {
|
|
|
482
561
|
var ChatbotStatusLabel_default = ChatbotStatusLabel;
|
|
483
562
|
|
|
484
563
|
// src/components/ChatbotHeader/index.tsx
|
|
485
|
-
|
|
564
|
+
import { Button } from "@ibti-tech/ui";
|
|
565
|
+
var ChatbotHeader = /* @__PURE__ */ __name(({ chatFeedbackBox }) => {
|
|
486
566
|
const i18n2 = useI18n();
|
|
487
|
-
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))
|
|
567
|
+
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)), /* @__PURE__ */ React6.createElement(
|
|
568
|
+
Button,
|
|
569
|
+
{
|
|
570
|
+
label: i18n2.CHAT_FEEDBACK.RATE,
|
|
571
|
+
onClick: chatFeedbackBox.open,
|
|
572
|
+
size: "small",
|
|
573
|
+
layer: 2,
|
|
574
|
+
variant: "layerBased"
|
|
575
|
+
}
|
|
576
|
+
));
|
|
488
577
|
}, "ChatbotHeader");
|
|
489
578
|
var ChatbotHeader_default = ChatbotHeader;
|
|
490
579
|
|
|
@@ -522,6 +611,8 @@ var Balloon = styled5.div`
|
|
|
522
611
|
border-radius: ${(props) => props.theme.borderRadius.medium};
|
|
523
612
|
position: relative;
|
|
524
613
|
line-height: 1.5em;
|
|
614
|
+
display: flex;
|
|
615
|
+
gap: ${(props) => props.theme.spacing.components.small};
|
|
525
616
|
|
|
526
617
|
&::after {
|
|
527
618
|
position: absolute;
|
|
@@ -531,13 +622,17 @@ var Balloon = styled5.div`
|
|
|
531
622
|
border-style: solid;
|
|
532
623
|
}
|
|
533
624
|
|
|
534
|
-
${({ $type }) => {
|
|
625
|
+
${({ $type, $error }) => {
|
|
535
626
|
switch ($type) {
|
|
536
627
|
case "received":
|
|
537
628
|
return css2`
|
|
538
629
|
background: ${(props) => props.theme.colors.layers[2].background};
|
|
539
630
|
border-top-left-radius: 0;
|
|
540
631
|
|
|
632
|
+
${$error && css2`
|
|
633
|
+
color: ${(props) => props.theme.colors.palette.error.normal};
|
|
634
|
+
`}
|
|
635
|
+
|
|
541
636
|
&::after {
|
|
542
637
|
border-width: 0px 10px 10px 0;
|
|
543
638
|
border-color: transparent
|
|
@@ -563,7 +658,6 @@ var Balloon = styled5.div`
|
|
|
563
658
|
`;
|
|
564
659
|
}
|
|
565
660
|
}}
|
|
566
|
-
|
|
567
661
|
// Markdown styles
|
|
568
662
|
|
|
569
663
|
display: flex;
|
|
@@ -612,6 +706,7 @@ var formatMessageTime = /* @__PURE__ */ __name((dateUTC, currentDateUTC, locale)
|
|
|
612
706
|
|
|
613
707
|
// src/components/MessageBalloon/index.tsx
|
|
614
708
|
import Markdown from "react-markdown";
|
|
709
|
+
import { CircleExclamationIcon } from "@ibti-tech/ui";
|
|
615
710
|
var messageTypes = {
|
|
616
711
|
assistant: "received",
|
|
617
712
|
user: "sent"
|
|
@@ -623,7 +718,7 @@ var MessageBalloon = /* @__PURE__ */ __name(({
|
|
|
623
718
|
const messageType = messageTypes[data.role];
|
|
624
719
|
const i18n2 = useI18n();
|
|
625
720
|
const { locale } = useChatbot_default();
|
|
626
|
-
return /* @__PURE__ */ React7.createElement(Wrapper5, { $type: messageType }, data.role == "assistant" && /* @__PURE__ */ React7.createElement(Label, null, i18n2.CHATBOT_NAME), /* @__PURE__ */ React7.createElement(Balloon, { $type: messageType }, /* @__PURE__ */ React7.createElement(Markdown, null, data.content)), /* @__PURE__ */ React7.createElement(Time, null, formatMessageTime(data.timestamp, currentDateUTC, locale)));
|
|
721
|
+
return /* @__PURE__ */ React7.createElement(Wrapper5, { $type: messageType }, data.role == "assistant" && /* @__PURE__ */ React7.createElement(Label, null, i18n2.CHATBOT_NAME), /* @__PURE__ */ React7.createElement(Balloon, { $type: messageType, $error: data.error }, data.error && /* @__PURE__ */ React7.createElement(CircleExclamationIcon, null), /* @__PURE__ */ React7.createElement(Markdown, null, data.content)), /* @__PURE__ */ React7.createElement(Time, null, formatMessageTime(data.timestamp, currentDateUTC, locale)));
|
|
627
722
|
}, "MessageBalloon");
|
|
628
723
|
var MessageBalloon_default = MessageBalloon;
|
|
629
724
|
|
|
@@ -699,9 +794,9 @@ var useUpdatedTime = /* @__PURE__ */ __name(({
|
|
|
699
794
|
import React8 from "react";
|
|
700
795
|
|
|
701
796
|
// src/components/SuggestedQuestions/styles.ts
|
|
702
|
-
import { Button } from "@ibti-tech/ui";
|
|
797
|
+
import { Button as Button2 } from "@ibti-tech/ui";
|
|
703
798
|
import { styled as styled6 } from "styled-components";
|
|
704
|
-
var QuestionButton = styled6(
|
|
799
|
+
var QuestionButton = styled6(Button2)`
|
|
705
800
|
text-align: left;
|
|
706
801
|
justify-content: flex-start;
|
|
707
802
|
height: auto;
|
|
@@ -798,7 +893,12 @@ var Wrapper7 = styled7.div`
|
|
|
798
893
|
`;
|
|
799
894
|
|
|
800
895
|
// src/components/ChatbotFooter/index.tsx
|
|
801
|
-
import {
|
|
896
|
+
import {
|
|
897
|
+
ArrowUpIcon,
|
|
898
|
+
IconButton,
|
|
899
|
+
Spinner,
|
|
900
|
+
TextArea
|
|
901
|
+
} from "@ibti-tech/ui";
|
|
802
902
|
var ChatbotFooter = /* @__PURE__ */ __name(({}) => {
|
|
803
903
|
const { makeQuestion, loading, writing, suggestedQuestions } = useChatbot_default();
|
|
804
904
|
const [questionInput, setQuestionInput] = useState6("");
|
|
@@ -809,20 +909,24 @@ var ChatbotFooter = /* @__PURE__ */ __name(({}) => {
|
|
|
809
909
|
await makeQuestion(questionInput);
|
|
810
910
|
}, "handleSubmit");
|
|
811
911
|
return /* @__PURE__ */ React10.createElement(Wrapper7, { "data-testid": "chatbot-footer" }, suggestedQuestions.loading && /* @__PURE__ */ React10.createElement(LoadingSuggestedQuestions, null, /* @__PURE__ */ React10.createElement(Spinner, { size: "extra-small" }), i18nTerms.SUGGESTED_QUESTIONS.LOADING), /* @__PURE__ */ React10.createElement(Form, { onSubmit: handleSubmit }, /* @__PURE__ */ React10.createElement(
|
|
812
|
-
|
|
912
|
+
TextArea,
|
|
813
913
|
{
|
|
814
914
|
fillWidth: true,
|
|
815
|
-
shape: "pill",
|
|
816
915
|
disabled: loading || writing,
|
|
817
916
|
value: questionInput,
|
|
818
917
|
onChange: (e) => setQuestionInput(e.target.value),
|
|
819
918
|
placeholder: i18nTerms.INPUT_PLACEHOLDER,
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
919
|
+
className: "textareaField",
|
|
920
|
+
rows: 1,
|
|
921
|
+
layer: 2
|
|
922
|
+
}
|
|
923
|
+
), /* @__PURE__ */ React10.createElement(
|
|
924
|
+
IconButton,
|
|
925
|
+
{
|
|
926
|
+
icon: ArrowUpIcon,
|
|
927
|
+
loading,
|
|
928
|
+
disabled: loading || writing || !questionInput,
|
|
929
|
+
type: "submit"
|
|
826
930
|
}
|
|
827
931
|
)));
|
|
828
932
|
}, "ChatbotFooter");
|
|
@@ -870,8 +974,8 @@ var ChatbotToggle = /* @__PURE__ */ __name(() => {
|
|
|
870
974
|
var ChatbotToggle_default = ChatbotToggle;
|
|
871
975
|
|
|
872
976
|
// src/components/ChatUserFeedbackRating/index.tsx
|
|
873
|
-
import React12, { useState as
|
|
874
|
-
import { Button as
|
|
977
|
+
import React12, { useState as useState7 } from "react";
|
|
978
|
+
import { Button as Button4, RatingStars, TextArea as TextArea2 } from "@ibti-tech/ui";
|
|
875
979
|
|
|
876
980
|
// src/components/ChatUserFeedbackRating/styles.ts
|
|
877
981
|
import { CardBase } from "@ibti-tech/ui";
|
|
@@ -928,55 +1032,13 @@ var Wrapper8 = styled9.div`
|
|
|
928
1032
|
`}
|
|
929
1033
|
`;
|
|
930
1034
|
|
|
931
|
-
// src/contexts/Chatbot/useChatFeedbackBox.ts
|
|
932
|
-
import { useEffect as useEffect6, useState as useState7 } from "react";
|
|
933
|
-
var useChatFeedbackBox = /* @__PURE__ */ __name(() => {
|
|
934
|
-
const { chatMessages, apiURL, locale } = useChatbot_default();
|
|
935
|
-
const [rated, setRated] = useState7(false);
|
|
936
|
-
const [opened, setOpened] = useState7(false);
|
|
937
|
-
const [loading, setLoading] = useState7(false);
|
|
938
|
-
useEffect6(() => {
|
|
939
|
-
if (chatMessages.length > 6 && !rated) setOpened(true);
|
|
940
|
-
}, [chatMessages]);
|
|
941
|
-
const close = /* @__PURE__ */ __name(() => {
|
|
942
|
-
setOpened(false);
|
|
943
|
-
setRated(true);
|
|
944
|
-
}, "close");
|
|
945
|
-
const sendUserRating = /* @__PURE__ */ __name(async ({
|
|
946
|
-
ratingScore,
|
|
947
|
-
description
|
|
948
|
-
}) => {
|
|
949
|
-
try {
|
|
950
|
-
setLoading(true);
|
|
951
|
-
await sendUserChatFeedback({
|
|
952
|
-
apiURL,
|
|
953
|
-
chatContext: chatMessages.map((item) => ({
|
|
954
|
-
role: item.role,
|
|
955
|
-
content: item.content
|
|
956
|
-
})),
|
|
957
|
-
locale,
|
|
958
|
-
ratingScore,
|
|
959
|
-
description
|
|
960
|
-
});
|
|
961
|
-
} finally {
|
|
962
|
-
setLoading(false);
|
|
963
|
-
setRated(true);
|
|
964
|
-
setOpened(false);
|
|
965
|
-
}
|
|
966
|
-
}, "sendUserRating");
|
|
967
|
-
return {
|
|
968
|
-
opened,
|
|
969
|
-
close,
|
|
970
|
-
sendUserRating,
|
|
971
|
-
loading
|
|
972
|
-
};
|
|
973
|
-
}, "useChatFeedbackBox");
|
|
974
|
-
|
|
975
1035
|
// src/components/ChatUserFeedbackRating/index.tsx
|
|
976
|
-
var ChatUserFeedbackRating = /* @__PURE__ */ __name(({
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
const
|
|
1036
|
+
var ChatUserFeedbackRating = /* @__PURE__ */ __name(({
|
|
1037
|
+
chatFeedbackBox
|
|
1038
|
+
}) => {
|
|
1039
|
+
const chatbot = useChatbot_default();
|
|
1040
|
+
const [ratingValue, setRatingValue] = useState7(5);
|
|
1041
|
+
const [descriptionValue, setDescriptionValue] = useState7("");
|
|
980
1042
|
const i18nTerms = useI18n();
|
|
981
1043
|
const handleSubmit = /* @__PURE__ */ __name((e) => {
|
|
982
1044
|
e.preventDefault();
|
|
@@ -985,7 +1047,7 @@ var ChatUserFeedbackRating = /* @__PURE__ */ __name(({}) => {
|
|
|
985
1047
|
ratingScore: ratingValue
|
|
986
1048
|
});
|
|
987
1049
|
}, "handleSubmit");
|
|
988
|
-
return /* @__PURE__ */ React12.createElement(Wrapper8, { $opened: chatFeedbackBox.opened }, /* @__PURE__ */ React12.createElement(Box, null, /* @__PURE__ */ React12.createElement(Title2, null, i18nTerms.CHAT_FEEDBACK.TITLE), /* @__PURE__ */ React12.createElement(Description, null, i18nTerms.CHAT_FEEDBACK.DESCRIPTION), /* @__PURE__ */ React12.createElement(Form2, { onSubmit: handleSubmit }, /* @__PURE__ */ React12.createElement(
|
|
1050
|
+
return /* @__PURE__ */ React12.createElement(Wrapper8, { $opened: chatFeedbackBox.opened && chatbot.opened }, /* @__PURE__ */ React12.createElement(Box, null, /* @__PURE__ */ React12.createElement(Title2, null, i18nTerms.CHAT_FEEDBACK.TITLE), /* @__PURE__ */ React12.createElement(Description, null, i18nTerms.CHAT_FEEDBACK.DESCRIPTION), /* @__PURE__ */ React12.createElement(Form2, { onSubmit: handleSubmit }, /* @__PURE__ */ React12.createElement(
|
|
989
1051
|
RatingStars,
|
|
990
1052
|
{
|
|
991
1053
|
value: ratingValue,
|
|
@@ -993,7 +1055,7 @@ var ChatUserFeedbackRating = /* @__PURE__ */ __name(({}) => {
|
|
|
993
1055
|
layer: 2
|
|
994
1056
|
}
|
|
995
1057
|
), /* @__PURE__ */ React12.createElement(
|
|
996
|
-
|
|
1058
|
+
TextArea2,
|
|
997
1059
|
{
|
|
998
1060
|
layer: 2,
|
|
999
1061
|
placeholder: i18nTerms.CHAT_FEEDBACK.MESSAGE_FIELD,
|
|
@@ -1002,7 +1064,7 @@ var ChatUserFeedbackRating = /* @__PURE__ */ __name(({}) => {
|
|
|
1002
1064
|
onChange: (e) => setDescriptionValue(e.target.value)
|
|
1003
1065
|
}
|
|
1004
1066
|
), /* @__PURE__ */ React12.createElement(ActionButtons, null, /* @__PURE__ */ React12.createElement(
|
|
1005
|
-
|
|
1067
|
+
Button4,
|
|
1006
1068
|
{
|
|
1007
1069
|
onClick: chatFeedbackBox.close,
|
|
1008
1070
|
label: i18nTerms.CHAT_FEEDBACK.CLOSE_BUTTON,
|
|
@@ -1010,7 +1072,7 @@ var ChatUserFeedbackRating = /* @__PURE__ */ __name(({}) => {
|
|
|
1010
1072
|
variant: "layerBased"
|
|
1011
1073
|
}
|
|
1012
1074
|
), /* @__PURE__ */ React12.createElement(
|
|
1013
|
-
|
|
1075
|
+
Button4,
|
|
1014
1076
|
{
|
|
1015
1077
|
type: "submit",
|
|
1016
1078
|
label: i18nTerms.CHAT_FEEDBACK.SUBMIT_BUTTON,
|
|
@@ -1020,10 +1082,59 @@ var ChatUserFeedbackRating = /* @__PURE__ */ __name(({}) => {
|
|
|
1020
1082
|
)))));
|
|
1021
1083
|
}, "ChatUserFeedbackRating");
|
|
1022
1084
|
|
|
1085
|
+
// src/contexts/Chatbot/useChatFeedbackBox.ts
|
|
1086
|
+
import { useEffect as useEffect6, useState as useState8 } from "react";
|
|
1087
|
+
var useChatFeedbackBox = /* @__PURE__ */ __name(() => {
|
|
1088
|
+
const { chatMessages, apiURL, locale } = useChatbot_default();
|
|
1089
|
+
const [rated, setRated] = useState8(false);
|
|
1090
|
+
const [opened, setOpened] = useState8(false);
|
|
1091
|
+
const [loading, setLoading] = useState8(false);
|
|
1092
|
+
useEffect6(() => {
|
|
1093
|
+
if (chatMessages.length > 6 && !rated) setOpened(true);
|
|
1094
|
+
}, [chatMessages]);
|
|
1095
|
+
const open = /* @__PURE__ */ __name(() => {
|
|
1096
|
+
setOpened(true);
|
|
1097
|
+
}, "open");
|
|
1098
|
+
const close = /* @__PURE__ */ __name(() => {
|
|
1099
|
+
setOpened(false);
|
|
1100
|
+
setRated(true);
|
|
1101
|
+
}, "close");
|
|
1102
|
+
const sendUserRating = /* @__PURE__ */ __name(async ({
|
|
1103
|
+
ratingScore,
|
|
1104
|
+
description
|
|
1105
|
+
}) => {
|
|
1106
|
+
try {
|
|
1107
|
+
setLoading(true);
|
|
1108
|
+
await sendUserChatFeedback({
|
|
1109
|
+
apiURL,
|
|
1110
|
+
chatContext: chatMessages.map((item) => ({
|
|
1111
|
+
role: item.role,
|
|
1112
|
+
content: item.content
|
|
1113
|
+
})),
|
|
1114
|
+
locale,
|
|
1115
|
+
ratingScore,
|
|
1116
|
+
description
|
|
1117
|
+
});
|
|
1118
|
+
} finally {
|
|
1119
|
+
setLoading(false);
|
|
1120
|
+
setRated(true);
|
|
1121
|
+
setOpened(false);
|
|
1122
|
+
}
|
|
1123
|
+
}, "sendUserRating");
|
|
1124
|
+
return {
|
|
1125
|
+
opened,
|
|
1126
|
+
open,
|
|
1127
|
+
close,
|
|
1128
|
+
sendUserRating,
|
|
1129
|
+
loading
|
|
1130
|
+
};
|
|
1131
|
+
}, "useChatFeedbackBox");
|
|
1132
|
+
|
|
1023
1133
|
// src/components/ChatbotDevice/index.tsx
|
|
1024
1134
|
var ChatbotDevice = /* @__PURE__ */ __name(({}) => {
|
|
1025
1135
|
const { opened } = useChatbot_default();
|
|
1026
|
-
|
|
1136
|
+
const chatFeedbackBox = useChatFeedbackBox();
|
|
1137
|
+
return /* @__PURE__ */ React13.createElement(Wrapper, { $opened: opened }, /* @__PURE__ */ React13.createElement(ChatUserFeedbackRating, { chatFeedbackBox }), /* @__PURE__ */ React13.createElement(ChatbotHeader_default, { chatFeedbackBox }), /* @__PURE__ */ React13.createElement(ChatbotBody_default, null), /* @__PURE__ */ React13.createElement(ChatbotFooter_default, null), /* @__PURE__ */ React13.createElement(ChatbotToggle_default, null));
|
|
1027
1138
|
}, "ChatbotDevice");
|
|
1028
1139
|
var ChatbotDevice_default = ChatbotDevice;
|
|
1029
1140
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ibti-tech/chatbot",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Chatbot developed for ibti products",
|
|
5
5
|
"main": "./dist/index.mjs",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@ibti-tech/prettier-config": "^0.1.6",
|
|
44
44
|
"@ibti-tech/tsconfig": "^0.0.3",
|
|
45
|
-
"@ibti-tech/ui": "^0.16.
|
|
45
|
+
"@ibti-tech/ui": "^0.16.4",
|
|
46
46
|
"@testing-library/react": "^15.0.7",
|
|
47
47
|
"@types/react": "^18.3.2",
|
|
48
48
|
"@types/uuid": "^9.0.8",
|