rio-assist-widget 0.1.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.
Files changed (38) hide show
  1. package/README.md +57 -0
  2. package/dist/rio-assist.js +1087 -0
  3. package/index.html +46 -0
  4. package/package.json +27 -0
  5. package/playground-preview.png +0 -0
  6. package/src/assets/icons/checkFrame.png +0 -0
  7. package/src/assets/icons/edit.png +0 -0
  8. package/src/assets/icons/expandScreen.png +0 -0
  9. package/src/assets/icons/hamburgerMenuIcon.png +0 -0
  10. package/src/assets/icons/homeIcon.png +0 -0
  11. package/src/assets/icons/iaButtonIcon.png +0 -0
  12. package/src/assets/icons/iaCentralIcon.png +0 -0
  13. package/src/assets/icons/infoFrame.png +0 -0
  14. package/src/assets/icons/plusFileSelection.png +0 -0
  15. package/src/assets/icons/profileFrame.png +0 -0
  16. package/src/assets/icons/searchIcon.png +0 -0
  17. package/src/assets/icons/threePoints.png +0 -0
  18. package/src/assets/icons/trash.png +0 -0
  19. package/src/assets/icons/voiceRecoverIcon.png +0 -0
  20. package/src/components/conversations-panel/conversations-panel.styles.ts +243 -0
  21. package/src/components/conversations-panel/conversations-panel.template.ts +150 -0
  22. package/src/components/floating-button/floating-button.styles.ts +48 -0
  23. package/src/components/floating-button/floating-button.template.ts +16 -0
  24. package/src/components/fullscreen/fullscreen.styles.ts +159 -0
  25. package/src/components/fullscreen/fullscreen.template.ts +71 -0
  26. package/src/components/mini-panel/mini-panel.styles.ts +331 -0
  27. package/src/components/mini-panel/mini-panel.template.ts +167 -0
  28. package/src/components/rio-assist/index.ts +1 -0
  29. package/src/components/rio-assist/rio-assist.styles.ts +33 -0
  30. package/src/components/rio-assist/rio-assist.template.ts +21 -0
  31. package/src/components/rio-assist/rio-assist.ts +478 -0
  32. package/src/main.ts +72 -0
  33. package/src/playground.ts +23 -0
  34. package/src/services/rioWebsocket.ts +167 -0
  35. package/tsconfig.json +26 -0
  36. package/tsconfig.node.json +11 -0
  37. package/vite.config.ts +19 -0
  38. package/widget.png +0 -0
@@ -0,0 +1,159 @@
1
+ import { css } from 'lit';
2
+
3
+ export const fullscreenStyles = css`
4
+ .fullscreen-shell {
5
+ position: fixed;
6
+ inset: 0;
7
+ background: #f5f7fa;
8
+ display: flex;
9
+ flex-direction: row;
10
+ pointer-events: auto;
11
+ z-index: 3;
12
+ height: 100vh;
13
+ }
14
+
15
+ .fullscreen-shell__rail {
16
+ width: 50px;
17
+ background: #0d1117;
18
+ display: flex;
19
+ flex-direction: column;
20
+ justify-content: space-between;
21
+ align-items: center;
22
+ padding: 6px 0 12px;
23
+ }
24
+
25
+ .fullscreen-shell__content {
26
+ flex: 1;
27
+ display: flex;
28
+ flex-direction: column;
29
+ overflow: hidden;
30
+ }
31
+
32
+ .rail-button {
33
+ width: 38px;
34
+ height: 38px;
35
+ border: none;
36
+ background: transparent;
37
+ display: grid;
38
+ place-items: center;
39
+ cursor: pointer;
40
+ color: #fff;
41
+ padding: 0;
42
+ }
43
+
44
+ .rail-button img {
45
+ width: 22px;
46
+ height: 22px;
47
+ }
48
+
49
+ .rail-button svg {
50
+ width: 18px;
51
+ height: 18px;
52
+ }
53
+
54
+ .fullscreen-header {
55
+ padding: 0 12px 0 4px;
56
+ display: grid;
57
+ grid-template-columns: 300px 1fr 138px;
58
+ align-items: center;
59
+ background: #fff;
60
+ border-bottom: 1px solid #e0e6eb;
61
+ height: 50px;
62
+ column-gap: 8px;
63
+ }
64
+
65
+ .fullscreen-header__title {
66
+ display: flex;
67
+ flex-direction: column;
68
+ gap: 2px;
69
+ padding-left: 16px;
70
+ align-self: stretch;
71
+ justify-content: center;
72
+ }
73
+
74
+ .fullscreen-header__tabs {
75
+ display: flex;
76
+ align-items: stretch;
77
+ height: 100%;
78
+ position: relative;
79
+ padding-left: 8px;
80
+ }
81
+
82
+ .fullscreen-header__brand {
83
+ font-family: 'Source Sans Pro', 'Inter', sans-serif;
84
+ font-weight: 600;
85
+ font-size: 18px;
86
+ letter-spacing: 0;
87
+ }
88
+
89
+ .fullscreen-header__tab {
90
+ font-size: 13px;
91
+ font-weight: 600;
92
+ letter-spacing: 1px;
93
+ color: #1f2f36;
94
+ text-transform: uppercase;
95
+ border-bottom: 3px solid #000;
96
+ padding: 0 0 0px;
97
+ display: inline-flex;
98
+ align-items: center;
99
+ height: 100%;
100
+ box-sizing: border-box;
101
+ line-height: 1;
102
+ }
103
+
104
+ .fullscreen-header__actions {
105
+ display: inline-flex;
106
+ align-items: center;
107
+ gap: 12px;
108
+ justify-self: end;
109
+ height: 100%;
110
+ justify-content: flex-end;
111
+ padding-right: 4px;
112
+ }
113
+
114
+ .fullscreen-header__icon {
115
+ width: 24px;
116
+ height: 24px;
117
+ border: none;
118
+ background: transparent;
119
+ display: flex;
120
+ align-items: center;
121
+ justify-content: center;
122
+ padding: 0;
123
+ }
124
+
125
+ .fullscreen-header__icon img {
126
+ width: 24px;
127
+ height: 24px;
128
+ }
129
+
130
+ .fullscreen-grid {
131
+ flex: 1;
132
+ display: grid;
133
+ grid-template-columns: 300px minmax(0, 1fr);
134
+ min-height: 0;
135
+ background: linear-gradient(180deg, #eef3f6 0%, #fff 100%);
136
+ }
137
+
138
+ .fullscreen-chat {
139
+ background: #fff;
140
+ display: flex;
141
+ flex-direction: column;
142
+ align-items: center;
143
+ padding: 36px 64px 18px;
144
+ }
145
+
146
+ .fullscreen-chat .panel-body {
147
+ max-width: 920px;
148
+ width: 100%;
149
+ padding: 12px 48px 12px;
150
+ }
151
+
152
+ .fullscreen-chat .panel-footer {
153
+ max-width: 640px;
154
+ }
155
+
156
+ .fullscreen-chat form {
157
+ max-width: none;
158
+ }
159
+ `;
@@ -0,0 +1,71 @@
1
+ import { html } from 'lit';
2
+ import type { RioAssistWidget } from '../rio-assist/rio-assist';
3
+ import { renderConversationsPanel } from '../conversations-panel/conversations-panel.template';
4
+ import { renderChatSurface } from '../mini-panel/mini-panel.template';
5
+
6
+ const homeIconUrl = new URL('../../assets/icons/homeIcon.png', import.meta.url).href;
7
+ const checkFrameIconUrl = new URL('../../assets/icons/checkFrame.png', import.meta.url).href;
8
+ const infoFrameIconUrl = new URL('../../assets/icons/infoFrame.png', import.meta.url).href;
9
+ const profileFrameIconUrl = new URL('../../assets/icons/profileFrame.png', import.meta.url).href;
10
+
11
+ export const renderFullscreen = (component: RioAssistWidget) => {
12
+ const chatSurface = renderChatSurface(component);
13
+
14
+ return html`
15
+ <section class="fullscreen-shell" role="dialog" aria-modal="true">
16
+ <div class="fullscreen-shell__rail">
17
+ <button type="button" class="rail-button" aria-label="Ir para home">
18
+ <img src=${homeIconUrl} alt="" aria-hidden="true" />
19
+ </button>
20
+ <button
21
+ type="button"
22
+ class="rail-button rail-button--close"
23
+ aria-label="Fechar tela cheia"
24
+ @click=${() => component.exitFullscreen(true)}
25
+ >
26
+ <svg viewBox="0 0 16 16" aria-hidden="true">
27
+ <path
28
+ d="M10.5 3l-5 5 5 5"
29
+ fill="none"
30
+ stroke="currentColor"
31
+ stroke-width="2"
32
+ stroke-linecap="round"
33
+ stroke-linejoin="round"
34
+ />
35
+ </svg>
36
+ </button>
37
+ </div>
38
+
39
+ <div class="fullscreen-shell__content">
40
+ <header class="fullscreen-header">
41
+ <div class="fullscreen-header__title">
42
+ <span class="fullscreen-header__brand">RIO ASSIST</span>
43
+ </div>
44
+
45
+ <div class="fullscreen-header__tabs">
46
+ <span class="fullscreen-header__tab">CONVERSA</span>
47
+ </div>
48
+
49
+ <div class="fullscreen-header__actions">
50
+ <button type="button" class="fullscreen-header__icon" aria-label="Status">
51
+ <img src=${checkFrameIconUrl} alt="" aria-hidden="true" />
52
+ </button>
53
+ <button type="button" class="fullscreen-header__icon" aria-label="Informacoes">
54
+ <img src=${infoFrameIconUrl} alt="" aria-hidden="true" />
55
+ </button>
56
+ <button type="button" class="fullscreen-header__icon" aria-label="Perfil de usuario">
57
+ <img src=${profileFrameIconUrl} alt="" aria-hidden="true" />
58
+ </button>
59
+ </div>
60
+ </header>
61
+
62
+ <div class="fullscreen-grid">
63
+ ${renderConversationsPanel(component, { variant: 'sidebar' })}
64
+ <div class="fullscreen-chat">
65
+ ${chatSurface}
66
+ </div>
67
+ </div>
68
+ </div>
69
+ </section>
70
+ `;
71
+ };
@@ -0,0 +1,331 @@
1
+ import { css } from 'lit';
2
+
3
+ export const miniPanelStyles = css`
4
+ .canvas {
5
+ position: absolute;
6
+ inset: 0;
7
+ pointer-events: none;
8
+ }
9
+
10
+ .panel {
11
+ --header-height: 120px;
12
+ pointer-events: auto;
13
+ position: fixed;
14
+ top: 0;
15
+ right: 0;
16
+ height: 100vh;
17
+ width: min(600px, 100vw);
18
+ max-width: 90vw;
19
+ background: #fff;
20
+ box-shadow: -24px 0 48px rgba(0, 0, 0, 0.15);
21
+ transform: translateX(100%);
22
+ transition: transform 0.35s ease;
23
+ display: flex;
24
+ flex-direction: column;
25
+ overflow: hidden;
26
+ }
27
+
28
+ .panel.open {
29
+ transform: translateX(0);
30
+ }
31
+
32
+ .panel-header {
33
+ display: flex;
34
+ flex-direction: column;
35
+ gap: 16px;
36
+ padding: 20px 8px 15px 28px;
37
+ border-bottom: 1px solid #e4eaee;
38
+ }
39
+
40
+ .panel-header__top {
41
+ display: flex;
42
+ justify-content: space-between;
43
+ align-items: center;
44
+ width: 100%;
45
+ }
46
+
47
+ .panel-title {
48
+ font-family: 'Source Sans Pro', 'Inter', sans-serif;
49
+ font-size: 16px;
50
+ font-weight: 600;
51
+ letter-spacing: 0;
52
+ color: #1c2a33;
53
+ padding-left: 0px;
54
+ }
55
+
56
+ .panel-header__actions {
57
+ display: flex;
58
+ justify-content: space-between;
59
+ align-items: center;
60
+ width: 100%;
61
+ }
62
+
63
+ .conversations-button {
64
+ display: inline-flex;
65
+ align-items: center;
66
+ gap: 12px;
67
+ padding: 8px 0;
68
+ padding-left: 0px;
69
+ border: none;
70
+ background: transparent;
71
+ color: #008b9a;
72
+ font-family: 'Source Sans Pro', 'Inter', sans-serif;
73
+ font-weight: 600;
74
+ font-size: 16px;
75
+ }
76
+
77
+ .conversations-button img {
78
+ width: 24px;
79
+ height: 24px;
80
+ }
81
+
82
+ .panel-header__icons {
83
+ display: inline-flex;
84
+ gap: 16px;
85
+ align-items: center;
86
+ padding-right: 12px;
87
+ }
88
+
89
+ .panel-header__icon-button {
90
+ width: 32px;
91
+ height: 32px;
92
+ border-radius: 50%;
93
+ border: none;
94
+ background: transparent;
95
+ display: grid;
96
+ place-items: center;
97
+ }
98
+
99
+ .conversations-plus-button {
100
+ margin-right: 4px;
101
+ }
102
+
103
+ .panel-header__icon-button img {
104
+ width: 28px;
105
+ height: 28px;
106
+ }
107
+
108
+ .panel-body {
109
+ flex: 1;
110
+ padding: 48px 32px 12px;
111
+ display: flex;
112
+ flex-direction: column;
113
+ align-items: center;
114
+ gap: 16px;
115
+ max-width: 520px;
116
+ margin: 0 auto;
117
+ width: 100%;
118
+ min-height: 0;
119
+ overflow: hidden;
120
+ }
121
+
122
+ .panel-content {
123
+ flex: 1;
124
+ width: 100%;
125
+ overflow-y: auto;
126
+ }
127
+
128
+ .panel-content--empty {
129
+ display: flex;
130
+ align-items: center;
131
+ justify-content: center;
132
+ }
133
+
134
+ .hero-card {
135
+ flex: 1;
136
+ display: flex;
137
+ align-items: center;
138
+ justify-content: center;
139
+ flex-direction: column;
140
+ gap: 24px;
141
+ color: #25323d;
142
+ text-align: center;
143
+ width: 100%;
144
+ max-width: 360px;
145
+ min-height: 280px;
146
+ }
147
+
148
+ .hero-card__icon {
149
+ width: 120px;
150
+ height: 120px;
151
+ display: block;
152
+ margin-bottom: 8px;
153
+ }
154
+
155
+ .hero-card h3 {
156
+ font-family: 'Source Sans Pro', 'Inter', sans-serif;
157
+ font-weight: 400;
158
+ font-size: 32px;
159
+ line-height: 1;
160
+ white-space: nowrap;
161
+ color: #2a3740;
162
+ margin: 0;
163
+ }
164
+
165
+ .conversation {
166
+ width: 100%;
167
+ display: flex;
168
+ flex-direction: column;
169
+ gap: 16px;
170
+ }
171
+
172
+ .message {
173
+ border-radius: 16px;
174
+ border: 1px solid #e4eaee;
175
+ padding: 12px 16px;
176
+ max-width: 90%;
177
+ background: #fff;
178
+ color: #1f2f36;
179
+ font-size: 15px;
180
+ }
181
+
182
+ .message--user {
183
+ align-self: flex-end;
184
+ background: #e3f3f6;
185
+ border-color: #cde6ea;
186
+ color: #00596b;
187
+ }
188
+
189
+ .message time {
190
+ display: block;
191
+ font-size: 11px;
192
+ margin-top: 6px;
193
+ color: #8a98a4;
194
+ text-align: right;
195
+ }
196
+
197
+ .typing {
198
+ font-style: italic;
199
+ opacity: 0.75;
200
+ }
201
+
202
+ .panel-footer {
203
+ width: 100%;
204
+ display: flex;
205
+ flex-direction: column;
206
+ align-items: center;
207
+ gap: 12px;
208
+ padding-top: 8px;
209
+ margin-top: auto;
210
+ }
211
+
212
+ .suggestions {
213
+ display: inline-flex;
214
+ gap: 12px;
215
+ justify-content: center;
216
+ }
217
+
218
+ .suggestions-wrapper {
219
+ width: 100%;
220
+ text-align: center;
221
+ margin-bottom: 6px;
222
+ }
223
+
224
+ .suggestions-label {
225
+ text-align: center;
226
+ font-size: 14px;
227
+ color: #a7afbb;
228
+ margin-bottom: 12px;
229
+ font-family: 'Source Sans Pro', 'Inter', sans-serif;
230
+ font-weight: 500;
231
+ letter-spacing: 0;
232
+ }
233
+
234
+ .suggestion {
235
+ border-radius: 999px;
236
+ border: 1px solid #d6e2e6;
237
+ padding: 0 16px;
238
+ background: #fff;
239
+ font-size: 14px;
240
+ line-height: 24px;
241
+ min-height: 24px;
242
+ color: #a7afbb;
243
+ font-family: 'Source Sans Pro', 'Inter', sans-serif;
244
+ font-weight: 500;
245
+ white-space: nowrap;
246
+ }
247
+
248
+ form {
249
+ display: flex;
250
+ align-items: center;
251
+ gap: 12px;
252
+ border: 1px solid #a4afbb;
253
+ border-radius: 80px;
254
+ padding: 10px 20px;
255
+ background: #fff;
256
+ width: 100%;
257
+ max-width: 520px;
258
+ margin-bottom: 0;
259
+ max-height: 56px;
260
+ }
261
+
262
+ form input {
263
+ border: none;
264
+ flex: 1;
265
+ font: inherit;
266
+ outline: none;
267
+ font-size: 16px;
268
+ font-style: normal;
269
+ font-family: 'Source Sans Pro', 'Inter', sans-serif;
270
+ font-weight: 400;
271
+ }
272
+
273
+ form input::placeholder {
274
+ font-style: italic;
275
+ font-size: 16px;
276
+ color: #a7afbb;
277
+ }
278
+
279
+ .input-button {
280
+ width: 32px;
281
+ height: 32px;
282
+ border-radius: 50%;
283
+ border: none;
284
+ background: transparent;
285
+ display: flex;
286
+ align-items: center;
287
+ justify-content: center;
288
+ }
289
+
290
+ .input-button img {
291
+ width: 32px;
292
+ height: 32px;
293
+ }
294
+
295
+ .input-button:disabled {
296
+ opacity: 0.5;
297
+ cursor: not-allowed;
298
+ }
299
+
300
+ .footnote {
301
+ margin-top: 0;
302
+ padding-top: 0;
303
+ padding-bottom: 0;
304
+ font-size: 12px;
305
+ color: #8a98a4;
306
+ text-align: center;
307
+ max-width: 520px;
308
+ margin-left: auto;
309
+ margin-right: auto;
310
+ }
311
+
312
+ .error-banner {
313
+ width: 100%;
314
+ padding: 10px 14px;
315
+ border-radius: 12px;
316
+ background: #fff4f2;
317
+ color: #a33c3c;
318
+ font-size: 13px;
319
+ text-align: center;
320
+ }
321
+
322
+ .close-button {
323
+ background: transparent;
324
+ display: grid;
325
+ place-items: center;
326
+ color: #9ba5b2;
327
+ font-size: 28px;
328
+ font-weight: 600;
329
+ line-height: 1;
330
+ }
331
+ `;