rio-assist-widget 0.1.23 → 0.1.27
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/rio-assist.js +229 -75
- package/package.json +1 -1
- package/src/components/conversations-panel/conversations-panel.template.ts +12 -8
- package/src/components/fullscreen/fullscreen.styles.ts +20 -10
- package/src/components/mini-panel/mini-panel.styles.ts +142 -65
- package/src/components/mini-panel/mini-panel.template.ts +41 -0
- package/src/components/rio-assist/rio-assist.styles.ts +9 -0
- package/src/components/rio-assist/rio-assist.template.ts +36 -0
- package/src/components/rio-assist/rio-assist.ts +1751 -1541
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=${() =>
|
|
@@ -192,27 +192,37 @@ export const fullscreenStyles = css`
|
|
|
192
192
|
display: flex;
|
|
193
193
|
flex-direction: column;
|
|
194
194
|
align-items: center;
|
|
195
|
-
padding: 36px
|
|
195
|
+
padding: 36px clamp(24px, 4vw, 56px) 18px;
|
|
196
196
|
width: 100%;
|
|
197
197
|
flex: 1;
|
|
198
198
|
min-height: 0;
|
|
199
199
|
overflow: hidden;
|
|
200
200
|
max-width: 1400px;
|
|
201
201
|
margin: 0 auto;
|
|
202
|
+
box-sizing: border-box;
|
|
202
203
|
}
|
|
203
204
|
|
|
204
205
|
.fullscreen-chat .panel-body {
|
|
205
206
|
max-width: 920px;
|
|
206
207
|
width: 100%;
|
|
207
|
-
padding: 12px
|
|
208
|
+
padding: 12px clamp(20px, 3vw, 44px) 12px;
|
|
208
209
|
margin: 0 auto;
|
|
210
|
+
box-sizing: border-box;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.fullscreen-chat .panel-footer {
|
|
214
|
+
max-width: 640px;
|
|
215
|
+
width: 100%;
|
|
216
|
+
padding: 0 clamp(16px, 3vw, 32px);
|
|
217
|
+
box-sizing: border-box;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.fullscreen-chat form {
|
|
221
|
+
max-width: none;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.fullscreen-chat .panel-content {
|
|
225
|
+
padding-right: clamp(12px, 2vw, 24px);
|
|
226
|
+
box-sizing: border-box;
|
|
209
227
|
}
|
|
210
|
-
|
|
211
|
-
.fullscreen-chat .panel-footer {
|
|
212
|
-
max-width: 640px;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
.fullscreen-chat form {
|
|
216
|
-
max-width: none;
|
|
217
|
-
}
|
|
218
228
|
`;
|
|
@@ -105,11 +105,11 @@ export const miniPanelStyles = css`
|
|
|
105
105
|
height: 28px;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
.panel-body {
|
|
109
|
-
flex: 1;
|
|
110
|
-
padding: 48px 32px 12px;
|
|
111
|
-
display: flex;
|
|
112
|
-
flex-direction: column;
|
|
108
|
+
.panel-body {
|
|
109
|
+
flex: 1;
|
|
110
|
+
padding: 48px 32px 12px;
|
|
111
|
+
display: flex;
|
|
112
|
+
flex-direction: column;
|
|
113
113
|
align-items: center;
|
|
114
114
|
gap: 16px;
|
|
115
115
|
max-width: 520px;
|
|
@@ -232,69 +232,146 @@ export const miniPanelStyles = css`
|
|
|
232
232
|
text-align: right;
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
-
.typing {
|
|
236
|
-
font-style: italic;
|
|
237
|
-
opacity: 0.75;
|
|
235
|
+
.typing {
|
|
236
|
+
font-style: italic;
|
|
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
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
.message--user time {
|
|
293
|
+
margin-top: 3px;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.panel-footer {
|
|
297
|
+
width: 100%;
|
|
298
|
+
display: flex;
|
|
299
|
+
flex-direction: column;
|
|
300
|
+
align-items: center;
|
|
301
|
+
gap: 12px;
|
|
302
|
+
padding-top: 8px;
|
|
303
|
+
margin-top: auto;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
.suggestions {
|
|
307
|
+
display: flex;
|
|
308
|
+
flex-wrap: wrap;
|
|
309
|
+
gap: 12px;
|
|
310
|
+
justify-content: center;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.suggestions-wrapper {
|
|
314
|
+
width: 100%;
|
|
315
|
+
text-align: center;
|
|
316
|
+
margin-bottom: 6px;
|
|
238
317
|
}
|
|
239
318
|
|
|
240
|
-
.
|
|
319
|
+
.short-answer-toggle {
|
|
241
320
|
display: inline-flex;
|
|
242
|
-
|
|
243
|
-
|
|
321
|
+
align-items: center;
|
|
322
|
+
gap: 12px;
|
|
323
|
+
border: 1px solid #d6dde3;
|
|
324
|
+
background: #f7fafc;
|
|
325
|
+
color: #1f2f36;
|
|
326
|
+
border-radius: 999px;
|
|
327
|
+
padding: 8px 12px 8px 10px;
|
|
328
|
+
font-weight: 600;
|
|
329
|
+
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
|
|
330
|
+
transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
|
|
244
331
|
}
|
|
245
332
|
|
|
246
|
-
.
|
|
247
|
-
|
|
248
|
-
|
|
333
|
+
.short-answer-toggle:focus-visible {
|
|
334
|
+
outline: 2px solid var(--accent-color, #008b9a);
|
|
335
|
+
outline-offset: 2px;
|
|
249
336
|
}
|
|
250
337
|
|
|
251
|
-
.
|
|
252
|
-
|
|
338
|
+
.short-answer-toggle__track {
|
|
339
|
+
width: 44px;
|
|
340
|
+
height: 24px;
|
|
341
|
+
border-radius: 999px;
|
|
342
|
+
background: #c7d0d9;
|
|
343
|
+
position: relative;
|
|
344
|
+
transition: background-color 0.2s ease;
|
|
253
345
|
}
|
|
254
346
|
|
|
255
|
-
.
|
|
256
|
-
|
|
347
|
+
.short-answer-toggle__track--on {
|
|
348
|
+
background: #008b9a;
|
|
257
349
|
}
|
|
258
350
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
}
|
|
351
|
+
.short-answer-toggle__thumb {
|
|
352
|
+
position: absolute;
|
|
353
|
+
top: 3px;
|
|
354
|
+
left: 4px;
|
|
355
|
+
width: 18px;
|
|
356
|
+
height: 18px;
|
|
357
|
+
border-radius: 50%;
|
|
358
|
+
background: #fff;
|
|
359
|
+
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
|
|
360
|
+
transition: transform 0.2s ease;
|
|
270
361
|
}
|
|
271
362
|
|
|
272
|
-
.
|
|
273
|
-
|
|
363
|
+
.short-answer-toggle__track--on .short-answer-toggle__thumb {
|
|
364
|
+
transform: translateX(18px);
|
|
274
365
|
}
|
|
275
|
-
|
|
276
|
-
.
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
margin-top: auto;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
.suggestions {
|
|
287
|
-
display: flex;
|
|
288
|
-
flex-wrap: wrap;
|
|
289
|
-
gap: 12px;
|
|
290
|
-
justify-content: center;
|
|
366
|
+
|
|
367
|
+
.short-answer-toggle__label {
|
|
368
|
+
font-size: 14px;
|
|
369
|
+
white-space: nowrap;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
.short-answer-toggle--hero {
|
|
373
|
+
margin-top: 8px;
|
|
291
374
|
}
|
|
292
|
-
|
|
293
|
-
.suggestions-wrapper {
|
|
294
|
-
width: 100%;
|
|
295
|
-
text-align: center;
|
|
296
|
-
margin-bottom: 6px;
|
|
297
|
-
}
|
|
298
375
|
|
|
299
376
|
.suggestions-label {
|
|
300
377
|
text-align: center;
|
|
@@ -320,18 +397,18 @@ export const miniPanelStyles = css`
|
|
|
320
397
|
white-space: nowrap;
|
|
321
398
|
}
|
|
322
399
|
|
|
323
|
-
form {
|
|
324
|
-
display: flex;
|
|
325
|
-
align-items: center;
|
|
326
|
-
gap: 12px;
|
|
327
|
-
border: 1px solid #a4afbb;
|
|
328
|
-
border-radius: 80px;
|
|
329
|
-
padding: 8px 12px 8px 16px;
|
|
330
|
-
background: #fff;
|
|
331
|
-
width: 100%;
|
|
332
|
-
max-width: 520px;
|
|
333
|
-
margin-bottom: 0;
|
|
334
|
-
height: 56px;
|
|
400
|
+
form {
|
|
401
|
+
display: flex;
|
|
402
|
+
align-items: center;
|
|
403
|
+
gap: 12px;
|
|
404
|
+
border: 1px solid #a4afbb;
|
|
405
|
+
border-radius: 80px;
|
|
406
|
+
padding: 8px 12px 8px 16px;
|
|
407
|
+
background: #fff;
|
|
408
|
+
width: 100%;
|
|
409
|
+
max-width: 520px;
|
|
410
|
+
margin-bottom: 0;
|
|
411
|
+
height: 56px;
|
|
335
412
|
box-sizing: border-box;
|
|
336
413
|
}
|
|
337
414
|
|
|
@@ -18,6 +18,24 @@ export const renderChatSurface = (component: RioAssistWidget) => {
|
|
|
18
18
|
<div class="hero-card">
|
|
19
19
|
<img src=${iaCentralIconUrl} alt="IA assistente" class="hero-card__icon" />
|
|
20
20
|
<h3>Como posso te ajudar hoje?</h3>
|
|
21
|
+
<button
|
|
22
|
+
type="button"
|
|
23
|
+
class="short-answer-toggle short-answer-toggle--hero"
|
|
24
|
+
role="switch"
|
|
25
|
+
aria-checked=${component.shortAnswerEnabled}
|
|
26
|
+
@click=${() => component.toggleShortAnswers()}
|
|
27
|
+
>
|
|
28
|
+
<span
|
|
29
|
+
class=${classMap({
|
|
30
|
+
'short-answer-toggle__track': true,
|
|
31
|
+
'short-answer-toggle__track--on': component.shortAnswerEnabled,
|
|
32
|
+
})}
|
|
33
|
+
aria-hidden="true"
|
|
34
|
+
>
|
|
35
|
+
<span class="short-answer-toggle__thumb"></span>
|
|
36
|
+
</span>
|
|
37
|
+
<span class="short-answer-toggle__label">Ativar respostas curtas</span>
|
|
38
|
+
</button>
|
|
21
39
|
</div>
|
|
22
40
|
`;
|
|
23
41
|
|
|
@@ -73,6 +91,29 @@ export const renderChatSurface = (component: RioAssistWidget) => {
|
|
|
73
91
|
: null}
|
|
74
92
|
|
|
75
93
|
<div class="panel-footer">
|
|
94
|
+
${hasMessages
|
|
95
|
+
? html`
|
|
96
|
+
<button
|
|
97
|
+
type="button"
|
|
98
|
+
class="short-answer-toggle"
|
|
99
|
+
role="switch"
|
|
100
|
+
aria-checked=${component.shortAnswerEnabled}
|
|
101
|
+
@click=${() => component.toggleShortAnswers()}
|
|
102
|
+
>
|
|
103
|
+
<span
|
|
104
|
+
class=${classMap({
|
|
105
|
+
'short-answer-toggle__track': true,
|
|
106
|
+
'short-answer-toggle__track--on': component.shortAnswerEnabled,
|
|
107
|
+
})}
|
|
108
|
+
aria-hidden="true"
|
|
109
|
+
>
|
|
110
|
+
<span class="short-answer-toggle__thumb"></span>
|
|
111
|
+
</span>
|
|
112
|
+
<span class="short-answer-toggle__label">Ativar respostas curtas</span>
|
|
113
|
+
</button>
|
|
114
|
+
`
|
|
115
|
+
: null}
|
|
116
|
+
|
|
76
117
|
${component.suggestions.length > 0
|
|
77
118
|
? html`
|
|
78
119
|
<div class="suggestions-wrapper">
|
|
@@ -50,6 +50,15 @@ 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
|
+
|
|
53
62
|
.dialog__input {
|
|
54
63
|
width: 100%;
|
|
55
64
|
box-sizing: border-box;
|
|
@@ -64,6 +64,42 @@ export const renderRioAssist = (component: RioAssistWidget) => {
|
|
|
64
64
|
</div>
|
|
65
65
|
`
|
|
66
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}
|
|
67
103
|
</div>
|
|
68
104
|
`;
|
|
69
105
|
};
|