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

2 lines 22.9 kB
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define("Onairos",["React","ReactDOM"],t):"object"==typeof exports?exports.Onairos=t(require("react"),require("react-dom")):e.Onairos=t(e.React,e.ReactDOM)}(this,((e,t)=>(()=>{"use strict";var o={745:(e,t,o)=>{var r=o(346);t.createRoot=r.createRoot,t.hydrateRoot=r.hydrateRoot},639:t=>{t.exports=e},346:e=>{e.exports=t}},r={};function n(e){var t=r[e];if(void 0!==t)return t.exports;var a=r[e]={exports:{}};return o[e](a,a.exports,n),a.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+"");var t=n.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var o=t.getElementsByTagName("script");if(o.length)for(var r=o.length-1;r>-1&&!e;)e=o[r--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})();var a={};return(()=>{n.r(a);var e=n(639),t=n.n(e),o=n(745);function r(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,r)}return o}function c(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?r(Object(o),!0).forEach((function(t){l(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):r(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function l(e,t,o){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var o=e[Symbol.toPrimitive];if(void 0!==o){var r=o.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}const s=[{name:"YouTube",icon:"📺",color:"bg-red-500",connector:"youtube"},{name:"LinkedIn",icon:"💼",color:"bg-blue-700",connector:"linkedin"},{name:"Reddit",icon:"🔥",color:"bg-orange-500",connector:"reddit"},{name:"Pinterest",icon:"📌",color:"bg-red-600",connector:"pinterest"},{name:"Instagram",icon:"📷",color:"bg-pink-500",connector:"instagram"},{name:"GitHub",icon:"⚡",color:"bg-gray-800",connector:"github"},{name:"Facebook",icon:"👥",color:"bg-blue-600",connector:"facebook"},{name:"Gmail",icon:"✉️",color:"bg-red-400",connector:"gmail"}],i={apiKey:process.env.REACT_APP_ONAIROS_API_KEY||"onairos_web_sdk_live_key_2024",baseUrl:process.env.REACT_APP_ONAIROS_BASE_URL||"https://api2.onairos.uk",sdkType:"web",enableHealthMonitoring:!0,enableAutoRefresh:!0,enableConnectionValidation:!0};function m(o){let{onComplete:r,appIcon:n,appName:a="App"}=o;const[l,m]=(0,e.useState)({}),[u,d]=(0,e.useState)(!1),[g,p]=(0,e.useState)(null),[f,b]=(0,e.useState)({}),[h,w]=(0,e.useState)({}),[v,y]=(0,e.useState)(0);(0,e.useEffect)((()=>{(()=>{const e=localStorage.getItem("onairos_oauth_platform");e&&(console.log("📱 OAuth return detected for: ".concat(e)),localStorage.removeItem("onairos_oauth_platform"),localStorage.removeItem("onairos_oauth_return"),m((t=>c(c({},t),{},{[e]:!0}))),b((t=>c(c({},t),{},{[e]:null}))),console.log("✅ ".concat(e," marked as connected from OAuth return")))})()}),[]);const x=async e=>{console.log("🚀 connectToPlatform called for: ".concat(e));const t=s.find((t=>t.name===e));if(null==t||!t.connector)return console.error("❌ No connector found for platform: ".concat(e)),!1;try{var o;d(!0),p(e),b((t=>c(c({},t),{},{[e]:null}))),console.log("🔗 Starting OAuth connection for ".concat(e,"..."));const r=localStorage.getItem("username")||(null===(o=localStorage.getItem("onairosUser"))||void 0===o?void 0:o.email)||"user@example.com",n="".concat(i.baseUrl,"/").concat(t.connector,"/authorize"),a=await fetch(n,{method:"POST",headers:{"x-api-key":i.apiKey,"Content-Type":"application/json"},body:JSON.stringify({session:{username:r}})});if(!a.ok)throw new Error("HTTP ".concat(a.status,": ").concat(a.statusText));const l=await a.json();console.log("📋 ".concat(e," OAuth response:"),l);const s={youtube:["youtubeURL","youtubeUrl","youtube_url"],linkedin:["linkedinURL","linkedinUrl","linkedin_url"],reddit:["redditURL","redditUrl","reddit_url"],pinterest:["pinterestURL","pinterestUrl","pinterest_url"],instagram:["instagramURL","instagramUrl","instagram_url"],github:["githubURL","githubUrl","github_url"],facebook:["facebookURL","facebookUrl","facebook_url"],gmail:["gmailURL","gmailUrl","gmail_url"]}[t.connector]||["".concat(t.connector,"URL"),"".concat(t.connector,"Url"),"".concat(t.connector,"_url"),"platformURL","authUrl","url"];let u=null,g=null;for(const e of s)if(l[e]){u=l[e],g=e;break}if(!u)throw console.error("❌ No OAuth URL found for ".concat(e,":")),console.error("Expected one of:",s),console.error("Response keys:",Object.keys(l)),console.error("Full response:",l),new Error("No OAuth URL found. Backend should return one of: ".concat(s.join(", ")));if(console.log("✅ Found OAuth URL for ".concat(e," using key: ").concat(g)),/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<=768)return localStorage.setItem("onairos_oauth_platform",e),localStorage.setItem("onairos_oauth_return",window.location.href),window.location.href=u,!0;{const o=window.open(u,"".concat(t.connector,"_oauth"),"width=500,height=600,scrollbars=yes,resizable=yes,status=no,location=no,toolbar=no,menubar=no");if(!o)throw new Error("Popup blocked. Please allow popups and try again.");let r=!1;const n=setInterval((()=>{try{if(o.location&&"onairos.uk"===o.location.hostname)return r=!0,console.log("🔄 ".concat(e," popup navigated to onairos.uk - treating as success")),void o.close()}catch(t){r||(r=!0,console.log("🔄 ".concat(e," popup navigated (cross-origin) - likely to onairos.uk")))}try{if(o.closed){clearInterval(n);const t=localStorage.getItem("onairos_".concat(e,"_success")),o=localStorage.getItem("onairos_".concat(e,"_error")),a=localStorage.getItem("onairos_".concat(e,"_timestamp")),l=a&&Date.now()-parseInt(a)<3e4;t&&l?(console.log("✅ ".concat(e," OAuth completed successfully (callback page)")),localStorage.removeItem("onairos_".concat(e,"_success")),localStorage.removeItem("onairos_".concat(e,"_timestamp")),m((t=>c(c({},t),{},{[e]:!0}))),b((t=>c(c({},t),{},{[e]:null})))):o&&l?(console.log("❌ ".concat(e," OAuth failed:"),o),localStorage.removeItem("onairos_".concat(e,"_error")),localStorage.removeItem("onairos_".concat(e,"_timestamp")),b((t=>c(c({},t),{},{[e]:o})))):r?(console.log("✅ ".concat(e," OAuth likely successful (navigated to onairos.uk)")),m((t=>c(c({},t),{},{[e]:!0}))),b((t=>c(c({},t),{},{[e]:null})))):(console.log("⚠️ ".concat(e," OAuth cancelled or no response")),b((t=>c(c({},t),{},{[e]:"Connection was cancelled"})))),d(!1),p(null)}}catch(e){}}),1e3);return setTimeout((()=>{try{!o.closed&&o.location&&"onairos.uk"===o.location.hostname&&(console.log("🚪 Auto-closing ".concat(e," popup showing onairos.uk (not found)")),o.close())}catch(t){!o.closed&&r&&(console.log("🚪 Auto-closing ".concat(e," popup (cross-origin, likely onairos.uk)")),o.close())}}),1e4),setTimeout((()=>{o.closed||(o.close(),clearInterval(n),b((t=>c(c({},t),{},{[e]:"Connection timeout"}))),d(!1),p(null))}),3e5),!0}}catch(t){return console.error("❌ Error connecting to ".concat(e,":"),t),b((o=>c(c({},o),{},{[e]:t.message}))),d(!1),p(null),!1}},E=Object.values(l).filter(Boolean).length;return t().createElement("div",{className:"max-w-sm mx-auto bg-white p-4 rounded-lg shadow-lg"},t().createElement("div",{className:"flex items-center justify-center mb-4"},t().createElement("div",{className:"flex items-center space-x-2"},t().createElement("img",{src:n||"https://onairos.sirv.com/Images/OnairosBlack.png",alt:a,className:"w-8 h-8 rounded-lg"}),t().createElement("div",{className:"flex items-center text-gray-400"},t().createElement("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},t().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17 8l4 4m0 0l-4 4m4-4H3"}))),t().createElement("img",{src:"https://onairos.sirv.com/Images/OnairosBlack.png",alt:"Onairos",className:"w-8 h-8 rounded-lg"}))),t().createElement("div",{className:"text-center mb-4"},t().createElement("h2",{className:"text-lg font-bold text-gray-900 mb-1"},"Connect Data"),t().createElement("p",{className:"text-gray-600 text-sm"},"Connect data here to enhance your ",a," experience")),t().createElement("div",{className:"grid grid-cols-2 gap-3 mb-4"},s.map((e=>{const o=l[e.name]||!1,r=g===e.name,n=f[e.name],a=u&&!r;return t().createElement("div",{key:e.name,className:"relative p-3 border-2 rounded-lg transition-all duration-200 cursor-pointer ".concat(a?"opacity-50 cursor-not-allowed":"hover:shadow-md"," ").concat(o?"border-green-400 bg-green-50":n?"border-red-400 bg-red-50":r?"border-blue-400 bg-blue-50":"border-gray-200 bg-white hover:border-gray-300"),onClick:()=>!a&&(async e=>{if(console.log("🔥 TOGGLE CLICKED: ".concat(e)),u&&g!==e)return void console.log("⚠️ Already connecting to ".concat(g,", ignoring click on ").concat(e));l[e]?(console.log("🔌 Disconnecting from ".concat(e,"...")),m((t=>c(c({},t),{},{[e]:!1}))),b((t=>c(c({},t),{},{[e]:null})))):await x(e)})(e.name)},t().createElement("div",{className:"w-8 h-8 rounded-lg ".concat(e.color," flex items-center justify-center text-white text-lg mb-2 mx-auto relative")},r?t().createElement("div",{className:"animate-spin h-4 w-4 border-2 border-white rounded-full border-t-transparent"}):e.icon,o&&!r&&t().createElement("div",{className:"absolute -top-1 -right-1 w-4 h-4 bg-green-500 rounded-full flex items-center justify-center"},t().createElement("svg",{className:"w-2.5 h-2.5 text-white",fill:"currentColor",viewBox:"0 0 20 20"},t().createElement("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"}))),n&&!r&&t().createElement("div",{className:"absolute -top-1 -right-1 w-4 h-4 bg-red-500 rounded-full flex items-center justify-center"},t().createElement("svg",{className:"w-2.5 h-2.5 text-white",fill:"currentColor",viewBox:"0 0 20 20"},t().createElement("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})))),t().createElement("div",{className:"text-center"},t().createElement("h3",{className:"font-medium text-gray-900 text-xs"},e.name),t().createElement("p",{className:"text-xs mt-1 ".concat(r?"text-blue-600":o?"text-green-600":n?"text-red-600":"text-gray-500")},r?"Connecting...":o?"Connected":n?"Failed":"Tap to connect"),n&&t().createElement("p",{className:"text-xs text-red-600 mt-1 break-words"},n)))}))),E>0&&t().createElement("div",{className:"mb-4 p-2 bg-green-50 border border-green-200 rounded-lg"},t().createElement("p",{className:"text-green-800 text-sm text-center"},"✅ ",E," connection",E>1?"s":""," active")),t().createElement("button",{onClick:()=>{const e=Object.entries(l).filter((e=>{let[t,o]=e;return o})).map((e=>{let[t]=e;return t}));r({connectedAccounts:e,totalConnections:e.length,healthScore:v,connectionHealth:h,sdkVersion:"2.1.7",enhancedFeatures:{healthMonitoring:i.enableHealthMonitoring,autoRefresh:i.enableAutoRefresh,connectionValidation:i.enableConnectionValidation}})},disabled:0===E,className:"w-full py-3 px-4 rounded-lg font-semibold transition-colors ".concat(E>0?"bg-blue-600 text-white hover:bg-blue-700":"bg-gray-300 text-gray-500 cursor-not-allowed")},E>0?"Continue with ".concat(E," connection").concat(E>1?"s":""):"Connect at least one platform"),t().createElement("button",{onClick:()=>r({connectedAccounts:[],totalConnections:0}),className:"w-full mt-2 py-2 text-gray-500 hover:text-gray-700 text-sm"},"Skip for now"))}const u=e=>t().createElement("div",{className:"relative inline-flex items-center"},t().createElement("input",{type:"checkbox",id:"request-".concat(e.number),disabled:!e.active,onChange:t=>{const o=t.target.checked;console.log("Checkbox ".concat(e.title," is now: ").concat(o?"checked":"unchecked")),o?(e.setSelected(!0),e.changeGranted(1)):(e.setSelected(!1),e.changeGranted(-1)),e.onSelectionChange(o)},className:"\n appearance-none w-5 h-5 border rounded\n ".concat(e.active?"border-blue-500 cursor-pointer":"border-gray-300 bg-gray-100 cursor-not-allowed","\n checked:bg-blue-600 checked:border-blue-600\n focus:outline-none focus:ring-2 focus:ring-blue-500/30\n transition-colors\n ")}),t().createElement("svg",{className:"absolute left-0.5 top-0.5 w-4 h-4 text-white pointer-events-none opacity-0 peer-checked:opacity-100",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},t().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"3",d:"M5 13l4 4L19 7"})),!e.active&&t().createElement("span",{className:"ml-2 text-xs text-red-500 font-medium"},"Not available"));const d=function(o){const[r,n]=(0,e.useState)(!1);return t().createElement("div",{className:"bg-white rounded-xl shadow-sm hover:shadow-md transition-all overflow-hidden"},t().createElement("div",{className:"p-5"},t().createElement("div",{className:"flex items-start space-x-4"},(()=>{switch(o.title){case"Profile":return t().createElement("div",{className:"w-8 h-8 rounded-full bg-blue-100 flex items-center justify-center"},t().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 text-blue-600",viewBox:"0 0 20 20",fill:"currentColor"},t().createElement("path",{fillRule:"evenodd",d:"M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z",clipRule:"evenodd"})));case"User Memories":return t().createElement("div",{className:"w-8 h-8 rounded-full bg-purple-100 flex items-center justify-center"},t().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 text-purple-600",viewBox:"0 0 20 20",fill:"currentColor"},t().createElement("path",{d:"M7 3a1 1 0 000 2h6a1 1 0 100-2H7zM4 7a1 1 0 011-1h10a1 1 0 110 2H5a1 1 0 01-1-1zM2 11a2 2 0 012-2h12a2 2 0 012 2v4a2 2 0 01-2 2H4a2 2 0 01-2-2v-4z"})));default:return t().createElement("div",{className:"w-8 h-8 rounded-full bg-gray-100 flex items-center justify-center"},t().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 text-gray-600",viewBox:"0 0 20 20",fill:"currentColor"},t().createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-3a1 1 0 00-.867.5 1 1 0 11-1.731-1A3 3 0 0113 8a3.001 3.001 0 01-2 2.83V11a1 1 0 11-2 0v-1a1 1 0 011-1 1 1 0 100-2zm0 8a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})))}})(),t().createElement("div",{className:"flex-1"},t().createElement("div",{className:"flex items-center justify-between"},t().createElement("h3",{className:"font-medium text-gray-800"},o.title),t().createElement(u,{active:o.active,onSelectionChange:e=>{n(e),o.onSelectionChange(e)},changeGranted:o.changeGranted,setSelected:n,number:o.number+1,type:"Test",title:o.title})),o.descriptions&&t().createElement("div",{className:"mt-2"},t().createElement("p",{className:"text-sm text-gray-600"},o.descriptions)))),o.rewards&&t().createElement("div",{className:"mt-3 pt-3 border-t border-gray-100"},t().createElement("div",{className:"flex items-center"},t().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 text-yellow-500 mr-2",viewBox:"0 0 20 20",fill:"currentColor"},t().createElement("path",{fillRule:"evenodd",d:"M5 2a1 1 0 011 1v1h1a1 1 0 010 2H6v1a1 1 0 01-2 0V6H3a1 1 0 010-2h1V3a1 1 0 011-1zm0 10a1 1 0 011 1v1h1a1 1 0 110 2H6v1a1 1 0 11-2 0v-1H3a1 1 0 110-2h1v-1a1 1 0 011-1zM12 2a1 1 0 01.967.744L14.146 7.2 17.5 9.134a1 1 0 010 1.732l-3.354 1.935-1.18 4.455a1 1 0 01-1.933 0L9.854 12.8 6.5 10.866a1 1 0 010-1.732l3.354-1.935 1.18-4.455A1 1 0 0112 2z",clipRule:"evenodd"})),t().createElement("span",{className:"text-xs text-gray-500"},"Benefit: ",t().createElement("span",{className:"text-gray-700"},o.rewards))))))},g=n.p+"static/ca60d8c79124e56d8c1c.png",p=o=>{let{requestData:r={},dataRequester:n="App",proofMode:a=!1,domain:c="",appIcon:l=""}=o;const[s,i]=(0,e.useState)(!0),[u,p]=(0,e.useState)([]),[f,b]=(0,e.useState)(0),[h,w]=(0,e.useState)(!1),[v,y]=(0,e.useState)(["instagram","youtube","email"]),[x,E]=(0,e.useState)({}),N=(0,e.useRef)([]),k=(0,e.useRef)(null),S=(0,e.useRef)(null);function O(e){b(f+e)}return(0,e.useEffect)((()=>{w(f>0)}),[f]),(0,e.useEffect)((()=>{(async()=>{try{await new Promise((e=>setTimeout(e,1e3))),p(["Profile","User Memories"]),i(!1)}catch(e){console.error("Error loading data:",e),i(!1)}})();const e=e=>{e.data&&"dataRequest"===e.data.type&&(e.data.requestData,e.data.activeModels&&p(e.data.activeModels),e.data.userSub&&(k.current=e.data.userSub),e.data.encryptedUserPin&&(S.current=e.data.encryptedUserPin))};return window.addEventListener("message",e),()=>{window.removeEventListener("message",e)}}),[]),t().createElement("div",{className:"min-h-screen bg-gray-100"},s?t().createElement("div",{className:"flex items-center justify-center min-h-screen"},t().createElement("div",{className:"animate-spin h-8 w-8 border-2 border-blue-600 rounded-full border-t-transparent"})):0===u.length?t().createElement(m,{appIcon:"https://onairos.sirv.com/Images/OnairosBlack.png",appName:n,username:localStorage.getItem("username")}):t().createElement("div",{className:"max-w-md mx-auto p-6 space-y-4"},t().createElement("header",{className:"bg-white p-6 rounded-xl shadow-md"},t().createElement("div",{className:"flex items-center justify-between mb-6"},t().createElement("div",{className:"flex items-center space-x-2"},t().createElement("img",{src:g,alt:"Onairos Logo",className:"w-8 h-8"}),t().createElement("div",{className:"text-gray-400 mx-2"},"→"),l?t().createElement("img",{src:l,alt:"".concat(n," Logo"),className:"w-8 h-8 rounded-full"}):t().createElement("div",{className:"w-8 h-8 bg-gray-200 rounded-full flex items-center justify-center"},t().createElement("span",{className:"text-gray-600 text-xs font-bold"},n.charAt(0)))),t().createElement("h2",{className:"text-lg font-bold text-gray-800"},n)),t().createElement("h1",{className:"text-xl font-bold text-gray-800 mb-4"},"Data Access Request"),t().createElement("p",{className:"text-gray-600 mb-6"},"Select the data you want to share with ",n),t().createElement("div",{className:"flex items-center justify-between gap-4"},t().createElement("button",{onClick:async function(){window.top.postMessage({type:"closeIframe"},"*"),window.postMessage({type:"closeIframe"},"*")},className:"border w-full border border-gray-300 hover:bg-gray-50 text-gray-700 font-medium py-3 px-4 rounded-lg transition-colors"},"Decline"),t().createElement("button",{disabled:!h,onClick:async function(){if(0!==f){const e={message:"Confirm "+n+" Data Access",confirmations:N.current};try{window.top.postMessage({type:"dataRequestComplete",approved:N.current,message:e},"*"),window.postMessage({type:"dataRequestComplete",approved:N.current,message:e},"*")}catch(e){console.error("Error sending data request:",e),window.close()}}else window.close()},className:"w-full bg-blue-600 hover:bg-blue-700 text-white font-medium py-3 px-4 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed"},"Approve ",f>0&&"(".concat(f,")")))),t().createElement("div",{className:"space-y-3"},["Profile","User Memories"].map(((e,o)=>{const r=e.toLowerCase().replace(" ","_"),a={type:e,descriptions:"Profile"===e?"Basic profile information and preferences":"Your personal context and memory data",reward:"Profile"===e?"Personalized experience":"Contextual understanding of your preferences"};return t().createElement(d,{key:r,active:!0,title:a.type,id:a,number:o,descriptions:a.descriptions,rewards:a.reward,size:r,changeGranted:O,onSelectionChange:e=>function(e,t,o,r,n,a){const c=new Date,l={requester:e,date:c.toISOString(),name:r,reward:n,data:t};a?(console.log("Adding connection: ".concat(JSON.stringify(l))),N.current.find((o=>o.requester===e&&o.data===t))||N.current.push(l)):(console.log("Removing connection for: ".concat(t)),N.current=N.current.filter((o=>!(o.requester===e&&o.data===t)))),console.log("Current selected connections:",N.current)}(n,r,0,a.type,a.reward,e)})})),t().createElement("div",{className:"bg-white p-4 rounded-xl shadow-sm mt-4"},t().createElement("h3",{className:"text-sm font-semibold text-gray-700 mb-3"},"Your Connected Services"),t().createElement("div",{className:"flex items-center space-x-3"},v.map(((e,o)=>t().createElement("div",{key:o,className:"flex flex-col items-center"},(e=>{switch(e){case"instagram":return t().createElement("div",{className:"w-10 h-10 rounded-full bg-gradient-to-tr from-purple-500 via-pink-500 to-yellow-500 flex items-center justify-center"},t().createElement("span",{className:"text-white text-xs"},"IG"));case"youtube":return t().createElement("div",{className:"w-10 h-10 rounded-full bg-red-600 flex items-center justify-center"},t().createElement("span",{className:"text-white text-xs"},"YT"));case"email":return t().createElement("div",{className:"w-10 h-10 rounded-full bg-blue-500 flex items-center justify-center"},t().createElement("span",{className:"text-white text-xs"},"@"));default:return t().createElement("div",{className:"w-10 h-10 rounded-full bg-gray-200 flex items-center justify-center"},t().createElement("span",{className:"text-gray-600 text-xs"},e.charAt(0).toUpperCase()))}})(e),t().createElement("span",{className:"text-xs text-gray-600 mt-1"},e)))))))))};let f=!1,b="",h=null,w=null;function v(){o.createRoot(document.getElementById("root")).render(t().createElement(p,{proofMode:f,domain:b,userSub:h,encryptedUserPin:w}))}window.addEventListener("message",(e=>{e.data&&"onairosButton"===e.data.source&&(f=e.data.proofMode||!1,b=e.data.domain||"",h=e.data.userSub||null,w=e.data.encryptedUserPin||null,v())})),window.parent.postMessage({source:"onairosIframe",action:"iframeReady"},"*"),v()})(),a})())); //# sourceMappingURL=iframe.bundle.js.map