rio-assist-widget 0.1.18 → 0.1.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -3
- package/dist/rio-assist.js +201 -65
- package/index.html +1 -2
- package/package.json +1 -1
- package/src/components/conversations-panel/conversations-panel.template.ts +12 -8
- package/src/components/mini-panel/mini-panel.styles.ts +66 -13
- package/src/components/mini-panel/mini-panel.template.ts +4 -1
- package/src/components/rio-assist/rio-assist.styles.ts +30 -1
- package/src/components/rio-assist/rio-assist.template.ts +65 -0
- package/src/components/rio-assist/rio-assist.ts +1433 -1008
- package/src/main.ts +15 -9
- package/src/playground.ts +9 -3
- package/src/services/rioWebsocket.ts +23 -0
package/index.html
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
data-title="Rio Insight"
|
|
29
29
|
data-button-label="Rio Insight"
|
|
30
30
|
data-placeholder="Pergunte alguma coisa"
|
|
31
|
-
data-suggestions="
|
|
31
|
+
data-suggestions="Resumo da Frota|Frota Disponível|Chamados Abertos|Parados + Causas|Aguardando Peças|Principais Gargalos|Tempo por Concessionária|Tempo de Ciclo|Preventiva x Corretiva"
|
|
32
32
|
data-accent-color="#c02267"
|
|
33
33
|
></rio-assist-widget>
|
|
34
34
|
|
|
@@ -36,4 +36,3 @@
|
|
|
36
36
|
<script type="module" src="/src/playground.ts"></script>
|
|
37
37
|
</body>
|
|
38
38
|
</html>
|
|
39
|
-
</body>
|
package/package.json
CHANGED
|
@@ -119,14 +119,18 @@ const renderConversationSurface = (
|
|
|
119
119
|
})}
|
|
120
120
|
@click=${(event: Event) => event.stopPropagation()}
|
|
121
121
|
>
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
122
|
+
${/* Renomear ocultado enquanto backend nao suporta */ false
|
|
123
|
+
? html`
|
|
124
|
+
<button
|
|
125
|
+
type="button"
|
|
126
|
+
@click=${() =>
|
|
127
|
+
component.handleConversationAction('rename', conversation.id)}
|
|
128
|
+
>
|
|
129
|
+
<img src=${editIconUrl} alt="" aria-hidden="true" />
|
|
130
|
+
Renomear
|
|
131
|
+
</button>
|
|
132
|
+
`
|
|
133
|
+
: null}
|
|
130
134
|
<button
|
|
131
135
|
type="button"
|
|
132
136
|
@click=${() =>
|
|
@@ -235,6 +235,58 @@ export const miniPanelStyles = css`
|
|
|
235
235
|
.typing {
|
|
236
236
|
font-style: italic;
|
|
237
237
|
opacity: 0.75;
|
|
238
|
+
display: flex;
|
|
239
|
+
align-items: center;
|
|
240
|
+
gap: 8px;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.typing::before {
|
|
244
|
+
content: '';
|
|
245
|
+
display: inline-block;
|
|
246
|
+
width: 16px;
|
|
247
|
+
height: 16px;
|
|
248
|
+
border: 2px solid var(--accent-color, #008B9A);
|
|
249
|
+
border-radius: 50%;
|
|
250
|
+
border-top-color: transparent;
|
|
251
|
+
animation: typing-spin 0.8s linear infinite;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
@keyframes typing-spin {
|
|
255
|
+
to {
|
|
256
|
+
transform: rotate(360deg);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.typing__dots {
|
|
261
|
+
display: inline-flex;
|
|
262
|
+
gap: 2px;
|
|
263
|
+
margin-left: 4px;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.typing__dots span {
|
|
267
|
+
display: inline-block;
|
|
268
|
+
animation: typing-bounce 1.2s infinite;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
.typing__dots span:nth-child(2) {
|
|
272
|
+
animation-delay: 0.2s;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.typing__dots span:nth-child(3) {
|
|
276
|
+
animation-delay: 0.4s;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
@keyframes typing-bounce {
|
|
280
|
+
0%,
|
|
281
|
+
80%,
|
|
282
|
+
100% {
|
|
283
|
+
transform: translateY(0);
|
|
284
|
+
opacity: 0.25;
|
|
285
|
+
}
|
|
286
|
+
40% {
|
|
287
|
+
transform: translateY(-4px);
|
|
288
|
+
opacity: 1;
|
|
289
|
+
}
|
|
238
290
|
}
|
|
239
291
|
|
|
240
292
|
.message--user time {
|
|
@@ -252,7 +304,8 @@ export const miniPanelStyles = css`
|
|
|
252
304
|
}
|
|
253
305
|
|
|
254
306
|
.suggestions {
|
|
255
|
-
display:
|
|
307
|
+
display: flex;
|
|
308
|
+
flex-wrap: wrap;
|
|
256
309
|
gap: 12px;
|
|
257
310
|
justify-content: center;
|
|
258
311
|
}
|
|
@@ -287,18 +340,18 @@ export const miniPanelStyles = css`
|
|
|
287
340
|
white-space: nowrap;
|
|
288
341
|
}
|
|
289
342
|
|
|
290
|
-
form {
|
|
291
|
-
display: flex;
|
|
292
|
-
align-items: center;
|
|
293
|
-
gap: 12px;
|
|
294
|
-
border: 1px solid #a4afbb;
|
|
295
|
-
border-radius: 80px;
|
|
296
|
-
padding: 8px 12px 8px 16px;
|
|
297
|
-
background: #fff;
|
|
298
|
-
width: 100%;
|
|
299
|
-
max-width: 520px;
|
|
300
|
-
margin-bottom: 0;
|
|
301
|
-
height: 56px;
|
|
343
|
+
form {
|
|
344
|
+
display: flex;
|
|
345
|
+
align-items: center;
|
|
346
|
+
gap: 12px;
|
|
347
|
+
border: 1px solid #a4afbb;
|
|
348
|
+
border-radius: 80px;
|
|
349
|
+
padding: 8px 12px 8px 16px;
|
|
350
|
+
background: #fff;
|
|
351
|
+
width: 100%;
|
|
352
|
+
max-width: 520px;
|
|
353
|
+
margin-bottom: 0;
|
|
354
|
+
height: 56px;
|
|
302
355
|
box-sizing: border-box;
|
|
303
356
|
}
|
|
304
357
|
|
|
@@ -47,7 +47,10 @@ export const renderChatSurface = (component: RioAssistWidget) => {
|
|
|
47
47
|
${component.isLoading
|
|
48
48
|
? html`
|
|
49
49
|
<div class="message message--assistant typing">
|
|
50
|
-
<span
|
|
50
|
+
<span>${component.loadingLabel}</span>
|
|
51
|
+
<span class="typing__dots" aria-hidden="true">
|
|
52
|
+
<span>.</span><span>.</span><span>.</span>
|
|
53
|
+
</span>
|
|
51
54
|
</div>
|
|
52
55
|
`
|
|
53
56
|
: null}
|
|
@@ -50,6 +50,30 @@ const baseStyles = css`
|
|
|
50
50
|
color: #1f2f36;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
.dialog__message--title {
|
|
54
|
+
font-weight: 700;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.dialog__message--error {
|
|
58
|
+
color: #d9534f;
|
|
59
|
+
white-space: pre-wrap;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.dialog__input {
|
|
63
|
+
width: 100%;
|
|
64
|
+
box-sizing: border-box;
|
|
65
|
+
padding: 10px 12px;
|
|
66
|
+
border-radius: 8px;
|
|
67
|
+
border: 1px solid #c7d0d9;
|
|
68
|
+
font: inherit;
|
|
69
|
+
outline: none;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.dialog__input:focus {
|
|
73
|
+
border-color: var(--accent-color, #008b9a);
|
|
74
|
+
box-shadow: 0 0 0 2px rgba(0, 139, 154, 0.2);
|
|
75
|
+
}
|
|
76
|
+
|
|
53
77
|
.dialog__actions {
|
|
54
78
|
display: flex;
|
|
55
79
|
justify-content: flex-end;
|
|
@@ -73,7 +97,12 @@ const baseStyles = css`
|
|
|
73
97
|
}
|
|
74
98
|
|
|
75
99
|
.dialog__button--danger {
|
|
76
|
-
background: #
|
|
100
|
+
background: #d9534f;
|
|
101
|
+
color: #fff;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.dialog__button--primary {
|
|
105
|
+
background: var(--accent-color, #008b9a);
|
|
77
106
|
color: #fff;
|
|
78
107
|
}
|
|
79
108
|
`;
|
|
@@ -16,6 +16,35 @@ export const renderRioAssist = (component: RioAssistWidget) => {
|
|
|
16
16
|
${renderFloatingButton(component)}
|
|
17
17
|
${renderMiniPanel(component)}
|
|
18
18
|
${component.isFullscreen ? renderFullscreen(component) : null}
|
|
19
|
+
${component.renameConversationTarget
|
|
20
|
+
? html`
|
|
21
|
+
<div class="dialog-overlay" role="dialog" aria-modal="true">
|
|
22
|
+
<div class="dialog">
|
|
23
|
+
<p class="dialog__message">Digite o novo título para a conversa:</p>
|
|
24
|
+
<input
|
|
25
|
+
class="dialog__input"
|
|
26
|
+
type="text"
|
|
27
|
+
.value=${component.renameConversationTarget.draft}
|
|
28
|
+
@input=${(event: InputEvent) => component.handleRenameDraft(event)}
|
|
29
|
+
aria-label="Novo titulo da conversa"
|
|
30
|
+
/>
|
|
31
|
+
<div class="dialog__actions">
|
|
32
|
+
<button type="button" class="dialog__button dialog__button--ghost" @click=${() =>
|
|
33
|
+
component.cancelRenameConversation()}>
|
|
34
|
+
Cancelar
|
|
35
|
+
</button>
|
|
36
|
+
<button
|
|
37
|
+
type="button"
|
|
38
|
+
class="dialog__button dialog__button--primary"
|
|
39
|
+
@click=${() => component.confirmRenameConversation()}
|
|
40
|
+
>
|
|
41
|
+
Renomear
|
|
42
|
+
</button>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
`
|
|
47
|
+
: null}
|
|
19
48
|
${component.deleteConversationTarget
|
|
20
49
|
? html`
|
|
21
50
|
<div class="dialog-overlay" role="dialog" aria-modal="true">
|
|
@@ -35,6 +64,42 @@ export const renderRioAssist = (component: RioAssistWidget) => {
|
|
|
35
64
|
</div>
|
|
36
65
|
`
|
|
37
66
|
: null}
|
|
67
|
+
${component.conversationActionError
|
|
68
|
+
? html`
|
|
69
|
+
<div class="dialog-overlay" role="dialog" aria-modal="true">
|
|
70
|
+
<div class="dialog">
|
|
71
|
+
<p class="dialog__message dialog__message--title">
|
|
72
|
+
Erro ao
|
|
73
|
+
${component.conversationActionError.action === 'delete'
|
|
74
|
+
? 'excluir'
|
|
75
|
+
: 'renomear'}
|
|
76
|
+
conversa:
|
|
77
|
+
</p>
|
|
78
|
+
<p class="dialog__message">
|
|
79
|
+
O agente retornou o seguinte erro ao tentar
|
|
80
|
+
${component.conversationActionError.action === 'delete' ? 'excluir' : 'renomear'}
|
|
81
|
+
a conversa:
|
|
82
|
+
</p>
|
|
83
|
+
<p class="dialog__message dialog__message--error">
|
|
84
|
+
${component.conversationActionError.message}
|
|
85
|
+
</p>
|
|
86
|
+
<div class="dialog__actions">
|
|
87
|
+
<button type="button" class="dialog__button dialog__button--ghost" @click=${() =>
|
|
88
|
+
component.cancelConversationActionError()}>
|
|
89
|
+
Cancelar ação
|
|
90
|
+
</button>
|
|
91
|
+
<button
|
|
92
|
+
type="button"
|
|
93
|
+
class="dialog__button dialog__button--primary"
|
|
94
|
+
@click=${() => component.retryConversationAction()}
|
|
95
|
+
>
|
|
96
|
+
Tentar novamente
|
|
97
|
+
</button>
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
`
|
|
102
|
+
: null}
|
|
38
103
|
</div>
|
|
39
104
|
`;
|
|
40
105
|
};
|