onairos 1.0.3 → 1.0.5

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 (111) hide show
  1. package/SDK-README.md +345 -0
  2. package/debug-overlay.html +226 -0
  3. package/dist/data_request_iframe.html +12 -0
  4. package/dist/iframe.bundle.js +2 -0
  5. package/dist/iframe.bundle.js.map +1 -0
  6. package/dist/onairos.bundle.js +1 -1
  7. package/dist/onairos.bundle.js.map +1 -1
  8. package/dist/onairos.cjs.js +16698 -0
  9. package/dist/onairos.cjs.js.map +1 -0
  10. package/dist/onairos.esm.js +16685 -8
  11. package/dist/onairos.esm.js.map +1 -0
  12. package/dist/onairos.umd.js +47 -31794
  13. package/dist/onairos.umd.js.map +1 -1
  14. package/dist/static/bda86be94804562cc74d.png +0 -0
  15. package/example-usage.js +58 -0
  16. package/onairos.d.ts +171 -0
  17. package/package.json +32 -16
  18. package/rollup.config.js +83 -39
  19. package/simple-overlay-demo.html +253 -0
  20. package/src/components/LoadingPage.jsx +19 -0
  21. package/src/components/OthentButton.jsx +1 -5
  22. package/src/components/SecuritySetup.js +12 -29
  23. package/src/components/UniversalOnboarding.js +32 -74
  24. package/src/components/ui/button.jsx +49 -0
  25. package/src/components/ui/card.jsx +61 -0
  26. package/src/components/ui/checkbox.jsx +33 -0
  27. package/src/components/ui/label.jsx +29 -0
  28. package/src/icons/OnairosBlack.png +0 -0
  29. package/src/icons/OnairosWhite.png +0 -0
  30. package/src/iframe/DataRequestPage.jsx +34 -28
  31. package/src/iframe/dataRequestHandler.js +7 -19
  32. package/src/index.js +29 -1
  33. package/src/mobile/MobileDataRequestPage.jsx +1 -1
  34. package/src/onairosButton.jsx +40 -59
  35. package/src/sdk/LLMWrapper.js +221 -0
  36. package/src/sdk/MemoryManager.js +290 -0
  37. package/src/sdk/OnairosClient.js +152 -0
  38. package/src/sdk/SessionManager.js +257 -0
  39. package/src/utils/extractMemory.js +277 -0
  40. package/test-button.html +83 -0
  41. package/test-component.jsx +77 -0
  42. package/test-overlay-fixed.html +246 -0
  43. package/test-overlay.html +99 -0
  44. package/test-sdk.js +373 -0
  45. package/webpack.config.js +128 -69
  46. package/({status +0 -0
  47. package/console.error(error)) +0 -0
  48. package/dist/423.onairos.bundle.js +0 -2
  49. package/dist/423.onairos.bundle.js.map +0 -1
  50. package/dist/423.onairos.native.js +0 -1
  51. package/dist/874.onairos.bundle.js +0 -2
  52. package/dist/874.onairos.bundle.js.LICENSE.txt +0 -22
  53. package/dist/RSA.js +0 -52
  54. package/dist/backButton.js +0 -24
  55. package/dist/components/AuthButtons.js +0 -48
  56. package/dist/components/GoogleButton.js +0 -111
  57. package/dist/components/Notification.js +0 -32
  58. package/dist/components/OnairosAppButton.js +0 -84
  59. package/dist/components/OthentButton.js +0 -91
  60. package/dist/components/SecuritySetup.js +0 -150
  61. package/dist/components/SignUp.js +0 -125
  62. package/dist/components/TestTelegramButton.js +0 -60
  63. package/dist/components/UniversalOnboarding.js +0 -444
  64. package/dist/components/utils/oauthHelper.js +0 -102
  65. package/dist/deepLink.js +0 -49
  66. package/dist/getPin.js +0 -25
  67. package/dist/hooks/useAccountInfo.js +0 -87
  68. package/dist/icons/Avatar.png +0 -0
  69. package/dist/icons/Sentiment.png +0 -0
  70. package/dist/icons/Trait.png +0 -0
  71. package/dist/iframe/DataRequestPage.js +0 -273
  72. package/dist/iframe/OnairosButtonIntegration.md +0 -148
  73. package/dist/iframe/components/Box.js +0 -86
  74. package/dist/iframe/components/IndividualConnection.js +0 -66
  75. package/dist/iframe/dataRequestHandler.js +0 -147
  76. package/dist/iframe/data_request_iframe.html +0 -27
  77. package/dist/iframe/data_request_page.js +0 -55
  78. package/dist/iframe/icons/Avatar2.png +0 -1
  79. package/dist/iframe/icons/Sentiment.png +0 -1
  80. package/dist/iframe/icons/Trait.png +0 -1
  81. package/dist/iframe/utils/api.js +0 -81
  82. package/dist/index.js +0 -12
  83. package/dist/mobile/MobileDataRequestPage.js +0 -178
  84. package/dist/mobile/components/MobileBox.js +0 -71
  85. package/dist/mobile/components/MobileIndividualConnection.js +0 -54
  86. package/dist/mobile/shims/browser-apis.js +0 -84
  87. package/dist/mobile/shims/lucide-shim.js +0 -93
  88. package/dist/onairos.bundle.js.LICENSE.txt +0 -9
  89. package/dist/onairos.js +0 -21
  90. package/dist/onairos.native.js +0 -1
  91. package/dist/onairosButton.js +0 -1066
  92. package/dist/onairosOld.js +0 -208
  93. package/dist/othent-kms.js +0 -2
  94. package/dist/othent-kms.js.map +0 -1
  95. package/dist/overlay/CheckBox.js +0 -58
  96. package/dist/overlay/IndividualConnection copy.js +0 -80
  97. package/dist/overlay/IndividualConnection.js +0 -62
  98. package/dist/overlay/IndividualConnectionNew.js +0 -68
  99. package/dist/overlay/box.js +0 -78
  100. package/dist/overlay/boxNew.js +0 -33
  101. package/dist/overlay/overlay.js +0 -399
  102. package/dist/sha256.js +0 -2
  103. package/dist/sha256.js.map +0 -1
  104. package/dist/utils/biometrics.js +0 -31
  105. package/dist/utils/deepLinking.js +0 -36
  106. package/onairosOLD.jsx +0 -150
  107. package/src/components/Notification.jsx +0 -21
  108. package/src/overlay/IndividualConnection copy.js +0 -86
  109. package/src/overlay/IndividualConnectionNew.jsx +0 -78
  110. package/{ +0 -0
  111. /package/dist/{iframe/icons/Avatar.png → static/8c5b220bf6f482881a90.png} +0 -0
package/SDK-README.md ADDED
@@ -0,0 +1,345 @@
1
+ # Onairos SDK
2
+
3
+ A unified SDK that wraps OpenAI, Anthropic Claude, and Google Gemini APIs with built-in RAG (Retrieval-Augmented Generation) capabilities for personalized AI interactions.
4
+
5
+ ## 🚀 Features
6
+
7
+ - **Unified API**: Single interface for OpenAI, Anthropic, and Google Gemini
8
+ - **RAG Enhancement**: Automatic memory storage and retrieval for personalized responses
9
+ - **Drop-in Replacement**: Minimal code changes from existing OpenAI implementations
10
+ - **Session Management**: JWT-based user authentication and isolation
11
+ - **Privacy-Focused**: Stores selected memory data, not raw conversations
12
+ - **Multi-Provider Support**: Seamlessly switch between different LLM providers
13
+ - **Memory Management**: Built-in vector storage with Pinecone integration
14
+
15
+ ## 📦 Installation
16
+
17
+ ```bash
18
+ npm install onairos
19
+ ```
20
+
21
+ ## 🔧 Setup
22
+
23
+ ### Environment Variables
24
+
25
+ Create a `.env` file with your API keys:
26
+
27
+ ```env
28
+ OPENAI_API_KEY=your-openai-api-key
29
+ ANTHROPIC_API_KEY=your-anthropic-api-key
30
+ GOOGLE_API_KEY=your-google-api-key
31
+ PINECONE_API_KEY=your-pinecone-api-key
32
+ PINECONE_ENVIRONMENT=your-pinecone-environment
33
+ JWT_SECRET=your-super-secret-jwt-key
34
+ ```
35
+
36
+ ### Basic Setup
37
+
38
+ ```javascript
39
+ import { OnairosClient } from 'onairos';
40
+
41
+ const onairos = new OnairosClient({
42
+ openaiApiKey: process.env.OPENAI_API_KEY,
43
+ anthropicApiKey: process.env.ANTHROPIC_API_KEY, // Optional
44
+ googleApiKey: process.env.GOOGLE_API_KEY, // Optional
45
+ pineconeApiKey: process.env.PINECONE_API_KEY,
46
+ pineconeEnvironment: process.env.PINECONE_ENVIRONMENT,
47
+ jwtSecret: process.env.JWT_SECRET
48
+ });
49
+
50
+ // Initialize the SDK
51
+ await onairos.initialize();
52
+ ```
53
+
54
+ ## 🔄 Migration from OpenAI
55
+
56
+ ### Before (OpenAI)
57
+ ```javascript
58
+ import OpenAI from 'openai';
59
+ const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
60
+
61
+ const response = await openai.chat.completions.create({
62
+ model: 'gpt-4',
63
+ messages: [
64
+ { role: 'user', content: 'What is artificial intelligence?' }
65
+ ]
66
+ });
67
+ ```
68
+
69
+ ### After (Onairos)
70
+ ```javascript
71
+ import { OnairosClient } from 'onairos';
72
+ const onairos = new OnairosClient(config);
73
+
74
+ const userId = 'user-123';
75
+ const sessionToken = onairos.generateSessionToken(userId);
76
+
77
+ const response = await onairos.completions({
78
+ model: 'gpt-4', // or 'claude-3-sonnet-20240229' or 'gemini-pro'
79
+ messages: [
80
+ { role: 'user', content: 'What is artificial intelligence?' }
81
+ ],
82
+ userId,
83
+ sessionToken
84
+ });
85
+ ```
86
+
87
+ ## 🎯 Usage Examples
88
+
89
+ ### Basic Completion
90
+
91
+ ```javascript
92
+ const response = await onairos.completions({
93
+ model: 'gpt-4',
94
+ messages: [
95
+ { role: 'user', content: 'Hello, how are you?' }
96
+ ],
97
+ userId: 'user-123',
98
+ sessionToken: sessionToken,
99
+ options: {
100
+ temperature: 0.7,
101
+ max_tokens: 150
102
+ }
103
+ });
104
+
105
+ console.log(response.choices[0].message.content);
106
+ ```
107
+
108
+ ### Multi-Provider Usage
109
+
110
+ ```javascript
111
+ // OpenAI GPT-4
112
+ const gptResponse = await onairos.completions({
113
+ model: 'gpt-4',
114
+ messages: [{ role: 'user', content: 'Explain quantum computing' }],
115
+ userId, sessionToken
116
+ });
117
+
118
+ // Anthropic Claude
119
+ const claudeResponse = await onairos.completions({
120
+ model: 'claude-3-sonnet-20240229',
121
+ messages: [{ role: 'user', content: 'Explain quantum computing' }],
122
+ userId, sessionToken
123
+ });
124
+
125
+ // Google Gemini
126
+ const geminiResponse = await onairos.completions({
127
+ model: 'gemini-pro',
128
+ messages: [{ role: 'user', content: 'Explain quantum computing' }],
129
+ userId, sessionToken
130
+ });
131
+ ```
132
+
133
+ ### RAG Memory Enhancement
134
+
135
+ The SDK automatically stores and retrieves relevant user context:
136
+
137
+ ```javascript
138
+ // First interaction - stores user preference
139
+ await onairos.completions({
140
+ model: 'gpt-4',
141
+ messages: [{ role: 'user', content: 'My favorite programming language is Python' }],
142
+ userId, sessionToken
143
+ });
144
+
145
+ // Later interaction - automatically uses stored context
146
+ const response = await onairos.completions({
147
+ model: 'gpt-4',
148
+ messages: [{ role: 'user', content: 'What language should I use for my next project?' }],
149
+ userId, sessionToken
150
+ });
151
+ // Response will consider the user's Python preference
152
+ ```
153
+
154
+ ### Memory Management
155
+
156
+ ```javascript
157
+ // Get user's stored memories
158
+ const memories = await onairos.getUserMemory(userId);
159
+ console.log(`User has ${memories.length} stored memories`);
160
+
161
+ // Clear user's memory
162
+ await onairos.clearUserMemory(userId);
163
+
164
+ // Store custom memory
165
+ await onairos.memoryManager.storeCustomMemory(
166
+ userId,
167
+ "User prefers concise explanations",
168
+ "preference"
169
+ );
170
+ ```
171
+
172
+ ### Session Management
173
+
174
+ ```javascript
175
+ // Generate session token
176
+ const sessionToken = onairos.generateSessionToken(userId, {
177
+ expiresIn: '24h',
178
+ additionalClaims: { role: 'premium' }
179
+ });
180
+
181
+ // Validate session
182
+ try {
183
+ const decoded = await onairos.sessionManager.validateSession(sessionToken);
184
+ console.log('Valid session for user:', decoded.userId);
185
+ } catch (error) {
186
+ console.log('Invalid session:', error.message);
187
+ }
188
+
189
+ // Generate guest token
190
+ const guestToken = onairos.sessionManager.generateGuestToken();
191
+ ```
192
+
193
+ ## 🤖 Supported Models
194
+
195
+ ### OpenAI
196
+ - `gpt-4`
197
+ - `gpt-4-turbo`
198
+ - `gpt-3.5-turbo`
199
+ - `o1-preview`
200
+ - `o1-mini`
201
+
202
+ ### Anthropic
203
+ - `claude-3-opus-20240229`
204
+ - `claude-3-sonnet-20240229`
205
+ - `claude-3-haiku-20240307`
206
+ - `claude-3-5-sonnet-20241022`
207
+
208
+ ### Google
209
+ - `gemini-pro`
210
+ - `gemini-pro-vision`
211
+ - `gemini-1.5-pro`
212
+ - `gemini-1.5-flash`
213
+
214
+ ## 🧠 How RAG Works
215
+
216
+ 1. **Memory Extraction**: After each interaction, the SDK extracts meaningful information (preferences, goals, context) rather than storing raw conversations
217
+ 2. **Vector Storage**: Extracted memories are embedded and stored in Pinecone vector database
218
+ 3. **Context Retrieval**: Before each new query, relevant memories are retrieved using semantic search
219
+ 4. **Prompt Enhancement**: Retrieved context is automatically injected into the prompt
220
+ 5. **Privacy Protection**: Only selected, meaningful data is stored, ensuring user privacy
221
+
222
+ ## 🔒 Security Features
223
+
224
+ - **JWT Authentication**: Secure session management with configurable expiration
225
+ - **User Isolation**: Each user's memory is completely isolated
226
+ - **Privacy-First**: Only meaningful insights are stored, not raw conversations
227
+ - **Session Validation**: All requests require valid session tokens
228
+ - **API Key Management**: Secure handling of multiple provider API keys
229
+
230
+ ## 📊 Response Format
231
+
232
+ The SDK returns responses in OpenAI-compatible format:
233
+
234
+ ```javascript
235
+ {
236
+ "id": "onairos-1234567890",
237
+ "object": "chat.completion",
238
+ "created": 1234567890,
239
+ "model": "gpt-4",
240
+ "choices": [{
241
+ "index": 0,
242
+ "message": {
243
+ "role": "assistant",
244
+ "content": "Response content here..."
245
+ },
246
+ "finish_reason": "stop"
247
+ }],
248
+ "usage": {
249
+ "prompt_tokens": 10,
250
+ "completion_tokens": 20,
251
+ "total_tokens": 30
252
+ }
253
+ }
254
+ ```
255
+
256
+ ## 🛠️ Advanced Configuration
257
+
258
+ ### Custom Memory Extraction
259
+
260
+ ```javascript
261
+ import { extractMemory } from 'onairos';
262
+
263
+ // Custom memory extraction logic
264
+ const customMemory = extractMemory({
265
+ query: "I love hiking in the mountains",
266
+ response: "That's great! Mountain hiking is excellent exercise..."
267
+ });
268
+ ```
269
+
270
+ ### Direct Component Access
271
+
272
+ ```javascript
273
+ import { LLMWrapper, MemoryManager, SessionManager } from 'onairos';
274
+
275
+ // Use components independently
276
+ const llm = new LLMWrapper({ openaiApiKey: 'your-key' });
277
+ const memory = new MemoryManager({ pineconeApiKey: 'your-key' });
278
+ const session = new SessionManager({ jwtSecret: 'your-secret' });
279
+ ```
280
+
281
+ ## 🧪 Testing
282
+
283
+ Run the test suite:
284
+
285
+ ```bash
286
+ node test-sdk.js
287
+ ```
288
+
289
+ Or run the simple example:
290
+
291
+ ```bash
292
+ node example-usage.js
293
+ ```
294
+
295
+ ## 📝 TypeScript Support
296
+
297
+ The SDK includes full TypeScript definitions:
298
+
299
+ ```typescript
300
+ import { OnairosClient, CompletionParams, CompletionResponse } from 'onairos';
301
+
302
+ const client: OnairosClient = new OnairosClient(config);
303
+
304
+ const params: CompletionParams = {
305
+ model: 'gpt-4',
306
+ messages: [{ role: 'user', content: 'Hello' }],
307
+ userId: 'user-123',
308
+ sessionToken: 'token'
309
+ };
310
+
311
+ const response: CompletionResponse = await client.completions(params);
312
+ ```
313
+
314
+ ## 🤝 Contributing
315
+
316
+ 1. Fork the repository
317
+ 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
318
+ 3. Commit your changes (`git commit -m 'Add some amazing feature'`)
319
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
320
+ 5. Open a Pull Request
321
+
322
+ ## 📄 License
323
+
324
+ This project is licensed under the Apache-2.0 License - see the [LICENSE](LICENSE) file for details.
325
+
326
+ ## 🆘 Support
327
+
328
+ - 📧 Email: support@onairos.uk
329
+ - 🌐 Website: https://onairos.uk
330
+ - 📚 Documentation: https://docs.onairos.uk
331
+ - 🐛 Issues: https://github.com/zd819/onairos-npm/issues
332
+
333
+ ## 🎉 Benefits
334
+
335
+ ✅ **Unified API** - One interface for all major LLM providers
336
+ ✅ **RAG Enhancement** - Automatic personalization with memory
337
+ ✅ **Drop-in Replacement** - Minimal migration effort
338
+ ✅ **Privacy-Focused** - Selective memory storage
339
+ ✅ **Session Security** - JWT-based authentication
340
+ ✅ **Multi-Provider** - Switch between models seamlessly
341
+ ✅ **Production Ready** - Built for scale and reliability
342
+
343
+ ---
344
+
345
+ Made with ❤️ by the Onairos team
@@ -0,0 +1,226 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Debug Onairos Overlay</title>
7
+ <script src="https://unpkg.com/react@18/umd/react.development.js"></script>
8
+ <script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script>
9
+ <script src="https://unpkg.com/framer-motion@10/dist/framer-motion.umd.js"></script>
10
+ <script src="https://cdn.tailwindcss.com"></script>
11
+ <style>
12
+ body {
13
+ margin: 0;
14
+ padding: 20px;
15
+ font-family: Arial, sans-serif;
16
+ background-color: #f0f0f0;
17
+ }
18
+ .debug-container {
19
+ max-width: 800px;
20
+ margin: 0 auto;
21
+ background: white;
22
+ padding: 20px;
23
+ border-radius: 8px;
24
+ box-shadow: 0 2px 10px rgba(0,0,0,0.1);
25
+ }
26
+ .debug-log {
27
+ background: #f8f9fa;
28
+ border: 1px solid #dee2e6;
29
+ border-radius: 4px;
30
+ padding: 10px;
31
+ margin: 10px 0;
32
+ font-family: monospace;
33
+ font-size: 12px;
34
+ max-height: 300px;
35
+ overflow-y: auto;
36
+ }
37
+ </style>
38
+ </head>
39
+ <body>
40
+ <div class="debug-container">
41
+ <h1>Debug Onairos Overlay</h1>
42
+
43
+ <div>
44
+ <h3>Step 1: Check if bundle loads</h3>
45
+ <div id="bundle-status">Loading...</div>
46
+ </div>
47
+
48
+ <div>
49
+ <h3>Step 2: Check Onairos object</h3>
50
+ <div id="onairos-status">Checking...</div>
51
+ </div>
52
+
53
+ <div>
54
+ <h3>Step 3: Create button</h3>
55
+ <div id="button-container"></div>
56
+ <div id="button-status">Waiting...</div>
57
+ </div>
58
+
59
+ <div>
60
+ <h3>Step 4: Test overlay</h3>
61
+ <button id="test-overlay-btn" onclick="testOverlay()" style="padding: 10px 20px; background: #007bff; color: white; border: none; border-radius: 4px; cursor: pointer;">
62
+ Test Overlay Manually
63
+ </button>
64
+ <div id="overlay-status">Ready to test</div>
65
+ </div>
66
+
67
+ <div>
68
+ <h3>Debug Log:</h3>
69
+ <div id="debug-log" class="debug-log"></div>
70
+ </div>
71
+ </div>
72
+
73
+ <script src="./dist/onairos.bundle.js"></script>
74
+ <script>
75
+ let onairosComponent = null;
76
+ let root = null;
77
+
78
+ function log(message) {
79
+ const logDiv = document.getElementById('debug-log');
80
+ const timestamp = new Date().toLocaleTimeString();
81
+ logDiv.innerHTML += `<div>[${timestamp}] ${message}</div>`;
82
+ logDiv.scrollTop = logDiv.scrollHeight;
83
+ console.log(`[DEBUG] ${message}`);
84
+ }
85
+
86
+ function updateStatus(elementId, message, isError = false) {
87
+ const element = document.getElementById(elementId);
88
+ element.textContent = message;
89
+ element.style.color = isError ? 'red' : 'green';
90
+ }
91
+
92
+ // Step 1: Check bundle
93
+ log('Checking if bundle loaded...');
94
+ if (typeof window.Onairos !== 'undefined') {
95
+ updateStatus('bundle-status', '✓ Bundle loaded successfully');
96
+ log('Bundle loaded successfully');
97
+ } else {
98
+ updateStatus('bundle-status', '✗ Bundle failed to load', true);
99
+ log('ERROR: Bundle failed to load');
100
+ }
101
+
102
+ // Check if framer-motion is available
103
+ log('Checking framer-motion availability...');
104
+ if (typeof window.FramerMotion !== 'undefined') {
105
+ log('✓ Framer Motion loaded successfully');
106
+ window['framer-motion'] = window.FramerMotion;
107
+ } else {
108
+ log('⚠️ Framer Motion not found - animations may not work');
109
+ }
110
+
111
+ // Step 2: Check Onairos object
112
+ setTimeout(() => {
113
+ log('Checking Onairos object...');
114
+ if (window.Onairos && window.Onairos.Onairos) {
115
+ updateStatus('onairos-status', '✓ Onairos component found');
116
+ log('Onairos component found');
117
+ log('Available properties: ' + Object.keys(window.Onairos).join(', '));
118
+
119
+ // Step 3: Create button
120
+ createButton();
121
+ } else {
122
+ updateStatus('onairos-status', '✗ Onairos component not found', true);
123
+ log('ERROR: Onairos component not found');
124
+ if (window.Onairos) {
125
+ log('Available properties: ' + Object.keys(window.Onairos).join(', '));
126
+ }
127
+ }
128
+ }, 100);
129
+
130
+ function createButton() {
131
+ log('Creating Onairos button...');
132
+ try {
133
+ const buttonContainer = document.getElementById('button-container');
134
+
135
+ // Use React 18's createRoot instead of ReactDOM.render
136
+ if (ReactDOM.createRoot) {
137
+ root = ReactDOM.createRoot(buttonContainer);
138
+
139
+ onairosComponent = React.createElement(window.Onairos.Onairos, {
140
+ requestData: {
141
+ personality: {
142
+ type: 'Personality',
143
+ descriptions: ['Basic personality traits'],
144
+ reward: 10
145
+ }
146
+ },
147
+ webpageName: 'Debug Test Page',
148
+ onComplete: (result) => {
149
+ log('Onboarding completed: ' + JSON.stringify(result));
150
+ updateStatus('overlay-status', '✓ Onboarding completed');
151
+ },
152
+ visualType: 'full',
153
+ buttonType: 'pill',
154
+ textColor: 'black'
155
+ });
156
+
157
+ root.render(onairosComponent);
158
+ updateStatus('button-status', '✓ Button created successfully');
159
+ log('Button created and rendered with React 18 createRoot');
160
+ } else {
161
+ // Fallback to legacy ReactDOM.render
162
+ onairosComponent = React.createElement(window.Onairos.Onairos, {
163
+ requestData: {
164
+ personality: {
165
+ type: 'Personality',
166
+ descriptions: ['Basic personality traits'],
167
+ reward: 10
168
+ }
169
+ },
170
+ webpageName: 'Debug Test Page',
171
+ onComplete: (result) => {
172
+ log('Onboarding completed: ' + JSON.stringify(result));
173
+ updateStatus('overlay-status', '✓ Onboarding completed');
174
+ },
175
+ visualType: 'full',
176
+ buttonType: 'pill',
177
+ textColor: 'black'
178
+ });
179
+
180
+ ReactDOM.render(onairosComponent, buttonContainer);
181
+ updateStatus('button-status', '✓ Button created successfully (legacy)');
182
+ log('Button created and rendered with legacy ReactDOM.render');
183
+ }
184
+ } catch (error) {
185
+ updateStatus('button-status', '✗ Failed to create button: ' + error.message, true);
186
+ log('ERROR creating button: ' + error.message);
187
+ console.error('Full error:', error);
188
+ }
189
+ }
190
+
191
+ function testOverlay() {
192
+ log('Testing overlay manually...');
193
+ updateStatus('overlay-status', 'Testing overlay...');
194
+
195
+ // Try to trigger the overlay directly
196
+ const button = document.querySelector('.OnairosConnect');
197
+ if (button) {
198
+ log('Found Onairos button, clicking...');
199
+ button.click();
200
+ updateStatus('overlay-status', 'Button clicked');
201
+ } else {
202
+ log('ERROR: Could not find Onairos button');
203
+ updateStatus('overlay-status', '✗ Button not found', true);
204
+ }
205
+ }
206
+
207
+ // Capture all console logs
208
+ const originalLog = console.log;
209
+ const originalError = console.error;
210
+
211
+ console.log = function(...args) {
212
+ if (args[0] && args[0].includes && args[0].includes('🔥')) {
213
+ log('CONSOLE: ' + args.join(' '));
214
+ }
215
+ originalLog.apply(console, args);
216
+ };
217
+
218
+ console.error = function(...args) {
219
+ log('ERROR: ' + args.join(' '));
220
+ originalError.apply(console, args);
221
+ };
222
+
223
+ log('Debug page initialized');
224
+ </script>
225
+ </body>
226
+ </html>
@@ -0,0 +1,12 @@
1
+ <!doctype html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Onairos Terminal</title><style>body {
2
+ margin: 0;
3
+ padding: 0;
4
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
5
+ background-color: transparent;
6
+ overflow: hidden;
7
+ }
8
+
9
+ #root {
10
+ width: 100%;
11
+ height: 100vh;
12
+ }</style><script defer="defer" src="iframe.bundle.js"></script></head><body><div id="root"></div><script src="data_request_page.js"></script></body></html>