@runflow-ai/cli 0.2.10 → 0.2.12

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.
@@ -0,0 +1,16 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/avif" href="/assets/favico.avif" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Runflow Local Test</title>
8
+ <meta name="description" content="Runflow local agent testing and monitoring" />
9
+ <script type="module" crossorigin src="/assets/main-rM2NnEnW.js"></script>
10
+ <link rel="stylesheet" crossorigin href="/assets/main-ClrC9fUE.css">
11
+ </head>
12
+ <body>
13
+ <div id="root"></div>
14
+ </body>
15
+ </html>
16
+
@@ -0,0 +1,221 @@
1
+ (function() {
2
+ 'use strict';
3
+
4
+ // Namespace global
5
+ window.RunflowWidget = window.RunflowWidget || {};
6
+
7
+ // Configurações padrão
8
+ const defaultConfig = {
9
+ agentId: '',
10
+ endpoint: '',
11
+ agentName: 'Assistente AI',
12
+ theme: 'light',
13
+ primaryColor: '#1f2937',
14
+ accentColor: '#3b82f6',
15
+ position: 'bottom-right', // bottom-right, bottom-left, inline
16
+ size: 'medium', // small, medium, large
17
+ autoOpen: false,
18
+ welcomeMessage: 'Olá! Como posso ajudar você hoje?',
19
+ placeholder: 'Digite sua mensagem...',
20
+ buttonText: '💬',
21
+ width: '400px',
22
+ height: '600px',
23
+ };
24
+
25
+ let config = { ...defaultConfig };
26
+ let isOpen = false;
27
+ let widgetContainer = null;
28
+ let iframe = null;
29
+
30
+ // Mapear tamanhos
31
+ const sizeMap = {
32
+ small: { width: '350px', height: '500px' },
33
+ medium: { width: '400px', height: '600px' },
34
+ large: { width: '500px', height: '700px' },
35
+ };
36
+
37
+ // Inicializar widget
38
+ window.RunflowWidget.init = function(userConfig) {
39
+ config = { ...defaultConfig, ...userConfig };
40
+
41
+ // Validar configurações obrigatórias
42
+ if (!config.agentId || !config.endpoint) {
43
+ console.error('RunflowWidget: agentId e endpoint são obrigatórios');
44
+ return;
45
+ }
46
+
47
+ // Aplicar tamanho do preset
48
+ if (config.size && sizeMap[config.size]) {
49
+ config.width = sizeMap[config.size].width;
50
+ config.height = sizeMap[config.size].height;
51
+ }
52
+
53
+ // Criar widget baseado na posição
54
+ if (config.position === 'inline') {
55
+ createInlineWidget();
56
+ } else {
57
+ createFloatingWidget();
58
+ }
59
+
60
+ // Auto-abrir se configurado
61
+ if (config.autoOpen && config.position !== 'inline') {
62
+ setTimeout(() => openWidget(), 500);
63
+ }
64
+ };
65
+
66
+ // Criar widget inline (incorporado na página)
67
+ function createInlineWidget() {
68
+ const targetElement = document.getElementById('runflow-widget-container');
69
+ if (!targetElement) {
70
+ console.error('RunflowWidget: elemento #runflow-widget-container não encontrado');
71
+ return;
72
+ }
73
+
74
+ const widgetUrl = buildWidgetUrl();
75
+
76
+ targetElement.innerHTML = `
77
+ <iframe
78
+ src="${widgetUrl}"
79
+ style="width: 100%; height: ${config.height}; border: none; border-radius: 8px; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);"
80
+ frameborder="0"
81
+ title="${config.agentName} - Runflow AI"
82
+ ></iframe>
83
+ `;
84
+ }
85
+
86
+ // Criar widget flutuante (chat bubble)
87
+ function createFloatingWidget() {
88
+ // Criar container
89
+ widgetContainer = document.createElement('div');
90
+ widgetContainer.id = 'runflow-widget';
91
+ widgetContainer.style.cssText = `
92
+ position: fixed;
93
+ ${config.position === 'bottom-right' ? 'right: 20px;' : 'left: 20px;'}
94
+ bottom: 20px;
95
+ z-index: 999999;
96
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
97
+ `;
98
+
99
+ // Criar botão de abrir/fechar
100
+ const toggleButton = document.createElement('button');
101
+ toggleButton.id = 'runflow-widget-toggle';
102
+ toggleButton.innerHTML = config.buttonText;
103
+ toggleButton.style.cssText = `
104
+ width: 60px;
105
+ height: 60px;
106
+ border-radius: 50%;
107
+ background-color: ${config.accentColor};
108
+ color: white;
109
+ border: none;
110
+ cursor: pointer;
111
+ font-size: 24px;
112
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
113
+ transition: transform 0.2s, box-shadow 0.2s;
114
+ display: flex;
115
+ align-items: center;
116
+ justify-content: center;
117
+ `;
118
+
119
+ toggleButton.onmouseover = function() {
120
+ this.style.transform = 'scale(1.1)';
121
+ this.style.boxShadow = '0 6px 16px rgba(0, 0, 0, 0.2)';
122
+ };
123
+
124
+ toggleButton.onmouseout = function() {
125
+ this.style.transform = 'scale(1)';
126
+ this.style.boxShadow = '0 4px 12px rgba(0, 0, 0, 0.15)';
127
+ };
128
+
129
+ toggleButton.onclick = function() {
130
+ toggleWidget();
131
+ };
132
+
133
+ // Criar container do chat
134
+ const chatContainer = document.createElement('div');
135
+ chatContainer.id = 'runflow-widget-chat';
136
+ chatContainer.style.cssText = `
137
+ position: absolute;
138
+ bottom: 80px;
139
+ ${config.position === 'bottom-right' ? 'right: 0;' : 'left: 0;'}
140
+ width: ${config.width};
141
+ height: ${config.height};
142
+ background: white;
143
+ border-radius: 12px;
144
+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
145
+ display: none;
146
+ overflow: hidden;
147
+ `;
148
+
149
+ // Criar iframe
150
+ const widgetUrl = buildWidgetUrl();
151
+ iframe = document.createElement('iframe');
152
+ iframe.src = widgetUrl;
153
+ iframe.style.cssText = `
154
+ width: 100%;
155
+ height: 100%;
156
+ border: none;
157
+ `;
158
+ iframe.title = `${config.agentName} - Runflow AI`;
159
+
160
+ chatContainer.appendChild(iframe);
161
+ widgetContainer.appendChild(chatContainer);
162
+ widgetContainer.appendChild(toggleButton);
163
+ document.body.appendChild(widgetContainer);
164
+ }
165
+
166
+ // Construir URL do widget
167
+ function buildWidgetUrl() {
168
+ const baseUrl = 'https://platform.runflow.ai';
169
+ const params = new URLSearchParams({
170
+ agentId: config.agentId,
171
+ endpoint: config.endpoint,
172
+ agentName: config.agentName,
173
+ primaryColor: config.primaryColor,
174
+ accentColor: config.accentColor,
175
+ placeholder: config.placeholder,
176
+ welcomeMessage: config.welcomeMessage,
177
+ });
178
+
179
+ return `${baseUrl}/widget/chat?${params.toString()}`;
180
+ }
181
+
182
+ // Toggle widget
183
+ function toggleWidget() {
184
+ if (isOpen) {
185
+ closeWidget();
186
+ } else {
187
+ openWidget();
188
+ }
189
+ }
190
+
191
+ // Abrir widget
192
+ function openWidget() {
193
+ const chatContainer = document.getElementById('runflow-widget-chat');
194
+ const toggleButton = document.getElementById('runflow-widget-toggle');
195
+
196
+ if (chatContainer && toggleButton) {
197
+ chatContainer.style.display = 'block';
198
+ toggleButton.innerHTML = '✕';
199
+ isOpen = true;
200
+ }
201
+ }
202
+
203
+ // Fechar widget
204
+ function closeWidget() {
205
+ const chatContainer = document.getElementById('runflow-widget-chat');
206
+ const toggleButton = document.getElementById('runflow-widget-toggle');
207
+
208
+ if (chatContainer && toggleButton) {
209
+ chatContainer.style.display = 'none';
210
+ toggleButton.innerHTML = config.buttonText;
211
+ isOpen = false;
212
+ }
213
+ }
214
+
215
+ // API pública
216
+ window.RunflowWidget.open = openWidget;
217
+ window.RunflowWidget.close = closeWidget;
218
+ window.RunflowWidget.toggle = toggleWidget;
219
+
220
+ })();
221
+