UNPKG

onairos

Version:

The Onairos Library is a collection of functions that enable Applications to connect and communicate data with Onairos Identities via User Authorization. Integration for developers is seamless, simple and effective for all applications. LLM SDK capabiliti

63 lines (54 loc) 2.4 kB
<!DOCTYPE html> <html> <head> <title>Onairos Sync</title> <style> body { background: #111; color: #fff; font-family: system-ui, sans-serif; display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100vh; margin: 0; text-align: center; } .status { margin-top: 20px; font-size: 18px; } .spinner { border: 4px solid rgba(255,255,255,0.1); border-left-color: #fff; border-radius: 50%; width: 30px; height: 30px; animation: spin 1s linear infinite; margin-bottom: 15px; } @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } </style> </head> <body> <div id="spinner" class="spinner"></div> <h2 id="title">Connecting...</h2> <div id="message" class="status">Waiting for data...</div> <script> window.addEventListener('message', async (event) => { const { type, payload, token, apiUrl } = event.data; if (type === 'ONAIROS_INSTAGRAM_SYNC') { document.getElementById('title').innerText = 'Syncing...'; document.getElementById('message').innerText = 'Uploading to Onairos...'; try { const response = await fetch(apiUrl + '/platform-data/store', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + token }, body: JSON.stringify(payload) }); if (!response.ok) { throw new Error('HTTP ' + response.status); } const result = await response.json(); document.getElementById('spinner').style.display = 'none'; document.getElementById('title').innerText = '✅ Sync Complete!'; document.getElementById('message').innerText = 'You can close this window.'; document.body.style.background = '#064e3b'; setTimeout(() => window.close(), 2000); } catch (e) { document.getElementById('spinner').style.display = 'none'; document.getElementById('title').innerText = '❌ Sync Failed'; document.getElementById('message').innerText = e.message; document.body.style.background = '#7f1d1d'; } } }); // Signal ready if (window.opener) { window.opener.postMessage({ type: 'ONAIROS_HELPER_READY' }, '*'); } </script> </body> </html>