onairos 2.1.9 → 2.1.10
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.
- package/dist/iframe.bundle.js +1 -1
- package/dist/iframe.bundle.js.map +1 -1
- package/dist/onairos.bundle.js +1 -1
- package/dist/onairos.bundle.js.map +1 -1
- package/dist/onairos.esm.js +1 -1
- package/dist/onairos.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/UniversalOnboarding.jsx +46 -11
package/dist/iframe.bundle.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!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 a={745:(e,t,a)=>{var r=a(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 o=r[e]={exports:{}};return a[e](o,o.exports,n),o.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 a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},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 a=t.getElementsByTagName("script");if(a.length)for(var r=a.length-1;r>-1&&!e;)e=a[r--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})();var o={};return(()=>{n.r(o);var e=n(639),t=n.n(e),a=n(745);function r(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function c(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?r(Object(a),!0).forEach((function(t){l(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):r(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function l(e,t,a){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var a=e[Symbol.toPrimitive];if(void 0!==a){var r=a.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:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,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(a){let{onComplete:r,appIcon:n,appName:o="App"}=a;const[l,m]=(0,e.useState)({}),[d,u]=(0,e.useState)(!1),[p,g]=(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 a;u(!0),g(e),b((t=>c(c({},t),{},{[e]:null}))),console.log("🔗 Starting OAuth connection for ".concat(e,"..."));const r=localStorage.getItem("username")||(null===(a=localStorage.getItem("onairosUser"))||void 0===a?void 0:a.email)||"user@example.com",n="".concat(i.baseUrl,"/").concat(t.connector,"/authorize"),o=await fetch(n,{method:"POST",headers:{"x-api-key":i.apiKey,"Content-Type":"application/json"},body:JSON.stringify({session:{username:r,sdkType:i.sdkType,returnUrl:window.location.href,platform:e}})});if(!o.ok)throw new Error("HTTP ".concat(o.status,": ").concat(o.statusText));const l=await o.json(),s=l["".concat(t.connector,"Url")];if(!s)throw new Error("No OAuth URL received for ".concat(e));if(/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=s,!0;{const a=window.open(s,"".concat(t.connector,"_oauth"),"width=500,height=600,scrollbars=yes,resizable=yes,status=no,location=no,toolbar=no,menubar=no");if(!a)throw new Error("Popup blocked. Please allow popups and try again.");const r=setInterval((()=>{try{if(a.closed){clearInterval(r);const t=localStorage.getItem("onairos_".concat(e,"_success")),a=localStorage.getItem("onairos_".concat(e,"_error")),n=localStorage.getItem("onairos_".concat(e,"_timestamp")),o=n&&Date.now()-parseInt(n)<3e4;t&&o?(console.log("✅ ".concat(e," OAuth completed successfully")),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})))):a&&o?(console.log("❌ ".concat(e," OAuth failed:"),a),localStorage.removeItem("onairos_".concat(e,"_error")),localStorage.removeItem("onairos_".concat(e,"_timestamp")),b((t=>c(c({},t),{},{[e]:a})))):(console.log("⚠️ ".concat(e," OAuth cancelled or no response")),b((t=>c(c({},t),{},{[e]:"Connection was cancelled"})))),u(!1),g(null)}}catch(e){}}),1e3);return setTimeout((()=>{a.closed||(a.close(),clearInterval(r),b((t=>c(c({},t),{},{[e]:"Connection timeout"}))),u(!1),g(null))}),3e5),!0}}catch(t){return console.error("❌ Error connecting to ".concat(e,":"),t),b((a=>c(c({},a),{},{[e]:t.message}))),u(!1),g(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:o,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 ",o," experience")),t().createElement("div",{className:"grid grid-cols-2 gap-3 mb-4"},s.map((e=>{const a=l[e.name]||!1,r=p===e.name,n=f[e.name],o=d&&!r;return t().createElement("div",{key:e.name,className:"relative p-3 border-2 rounded-lg transition-all duration-200 cursor-pointer ".concat(o?"opacity-50 cursor-not-allowed":"hover:shadow-md"," ").concat(a?"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:()=>!o&&(async e=>{if(console.log("🔥 TOGGLE CLICKED: ".concat(e)),d&&p!==e)return void console.log("⚠️ Already connecting to ".concat(p,", 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,a&&!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":a?"text-green-600":n?"text-red-600":"text-gray-500")},r?"Connecting...":a?"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,a]=e;return a})).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 d=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 a=t.target.checked;console.log("Checkbox ".concat(e.title," is now: ").concat(a?"checked":"unchecked")),a?(e.setSelected(!0),e.changeGranted(1)):(e.setSelected(!1),e.changeGranted(-1)),e.onSelectionChange(a)},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 u=function(a){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(a.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"},a.title),t().createElement(d,{active:a.active,onSelectionChange:e=>{n(e),a.onSelectionChange(e)},changeGranted:a.changeGranted,setSelected:n,number:a.number+1,type:"Test",title:a.title})),a.descriptions&&t().createElement("div",{className:"mt-2"},t().createElement("p",{className:"text-sm text-gray-600"},a.descriptions)))),a.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"},a.rewards))))))},p=n.p+"static/ca60d8c79124e56d8c1c.png",g=a=>{let{requestData:r={},dataRequester:n="App",proofMode:o=!1,domain:c="",appIcon:l=""}=a;const[s,i]=(0,e.useState)(!0),[d,g]=(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)([]),S=(0,e.useRef)(null),O=(0,e.useRef)(null);function k(e){b(f+e)}return(0,e.useEffect)((()=>{w(f>0)}),[f]),(0,e.useEffect)((()=>{(async()=>{try{await new Promise((e=>setTimeout(e,1e3))),g(["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&&g(e.data.activeModels),e.data.userSub&&(S.current=e.data.userSub),e.data.encryptedUserPin&&(O.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===d.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:p,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,a)=>{const r=e.toLowerCase().replace(" ","_"),o={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(u,{key:r,active:!0,title:o.type,id:o,number:a,descriptions:o.descriptions,rewards:o.reward,size:r,changeGranted:k,onSelectionChange:e=>function(e,t,a,r,n,o){const c=new Date,l={requester:e,date:c.toISOString(),name:r,reward:n,data:t};o?(console.log("Adding connection: ".concat(JSON.stringify(l))),N.current.find((a=>a.requester===e&&a.data===t))||N.current.push(l)):(console.log("Removing connection for: ".concat(t)),N.current=N.current.filter((a=>!(a.requester===e&&a.data===t)))),console.log("Current selected connections:",N.current)}(n,r,0,o.type,o.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,a)=>t().createElement("div",{key:a,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(){a.createRoot(document.getElementById("root")).render(t().createElement(g,{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()})(),o})()));
|
|
1
|
+
!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 r={745:(e,t,r)=>{var n=r(346);t.createRoot=n.createRoot,t.hydrateRoot=n.hydrateRoot},639:t=>{t.exports=e},346:e=>{e.exports=t}},n={};function a(e){var t=n[e];if(void 0!==t)return t.exports;var o=n[e]={exports:{}};return r[e](o,o.exports,a),o.exports}a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;a.g.importScripts&&(e=a.g.location+"");var t=a.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var n=r.length-1;n>-1&&!e;)e=r[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=e})();var o={};return(()=>{a.r(o);var e=a(639),t=a.n(e),r=a(745);function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function c(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach((function(t){l(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;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:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,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(r){let{onComplete:n,appIcon:a,appName:o="App"}=r;const[l,m]=(0,e.useState)({}),[d,u]=(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 r;u(!0),p(e),b((t=>c(c({},t),{},{[e]:null}))),console.log("🔗 Starting OAuth connection for ".concat(e,"..."));const n=localStorage.getItem("username")||(null===(r=localStorage.getItem("onairosUser"))||void 0===r?void 0:r.email)||"user@example.com",a="".concat(i.baseUrl,"/").concat(t.connector,"/authorize"),o=await fetch(a,{method:"POST",headers:{"x-api-key":i.apiKey,"Content-Type":"application/json"},body:JSON.stringify({session:{username:n}})});if(!o.ok)throw new Error("HTTP ".concat(o.status,": ").concat(o.statusText));const l=await o.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 d=null,g=null;for(const e of s)if(l[e]){d=l[e],g=e;break}if(!d)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=d,!0;{const r=window.open(d,"".concat(t.connector,"_oauth"),"width=500,height=600,scrollbars=yes,resizable=yes,status=no,location=no,toolbar=no,menubar=no");if(!r)throw new Error("Popup blocked. Please allow popups and try again.");const n=setInterval((()=>{try{if(r.closed){clearInterval(n);const t=localStorage.getItem("onairos_".concat(e,"_success")),r=localStorage.getItem("onairos_".concat(e,"_error")),a=localStorage.getItem("onairos_".concat(e,"_timestamp")),o=a&&Date.now()-parseInt(a)<3e4;t&&o?(console.log("✅ ".concat(e," OAuth completed successfully")),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})))):r&&o?(console.log("❌ ".concat(e," OAuth failed:"),r),localStorage.removeItem("onairos_".concat(e,"_error")),localStorage.removeItem("onairos_".concat(e,"_timestamp")),b((t=>c(c({},t),{},{[e]:r})))):(console.log("⚠️ ".concat(e," OAuth cancelled or no response")),b((t=>c(c({},t),{},{[e]:"Connection was cancelled"})))),u(!1),p(null)}}catch(e){}}),1e3);return setTimeout((()=>{r.closed||(r.close(),clearInterval(n),b((t=>c(c({},t),{},{[e]:"Connection timeout"}))),u(!1),p(null))}),3e5),!0}}catch(t){return console.error("❌ Error connecting to ".concat(e,":"),t),b((r=>c(c({},r),{},{[e]:t.message}))),u(!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:a||"https://onairos.sirv.com/Images/OnairosBlack.png",alt:o,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 ",o," experience")),t().createElement("div",{className:"grid grid-cols-2 gap-3 mb-4"},s.map((e=>{const r=l[e.name]||!1,n=g===e.name,a=f[e.name],o=d&&!n;return t().createElement("div",{key:e.name,className:"relative p-3 border-2 rounded-lg transition-all duration-200 cursor-pointer ".concat(o?"opacity-50 cursor-not-allowed":"hover:shadow-md"," ").concat(r?"border-green-400 bg-green-50":a?"border-red-400 bg-red-50":n?"border-blue-400 bg-blue-50":"border-gray-200 bg-white hover:border-gray-300"),onClick:()=>!o&&(async e=>{if(console.log("🔥 TOGGLE CLICKED: ".concat(e)),d&&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")},n?t().createElement("div",{className:"animate-spin h-4 w-4 border-2 border-white rounded-full border-t-transparent"}):e.icon,r&&!n&&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"}))),a&&!n&&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(n?"text-blue-600":r?"text-green-600":a?"text-red-600":"text-gray-500")},n?"Connecting...":r?"Connected":a?"Failed":"Tap to connect"),a&&t().createElement("p",{className:"text-xs text-red-600 mt-1 break-words"},a)))}))),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,r]=e;return r})).map((e=>{let[t]=e;return t}));n({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:()=>n({connectedAccounts:[],totalConnections:0}),className:"w-full mt-2 py-2 text-gray-500 hover:text-gray-700 text-sm"},"Skip for now"))}const d=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 r=t.target.checked;console.log("Checkbox ".concat(e.title," is now: ").concat(r?"checked":"unchecked")),r?(e.setSelected(!0),e.changeGranted(1)):(e.setSelected(!1),e.changeGranted(-1)),e.onSelectionChange(r)},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 u=function(r){const[n,a]=(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(r.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"},r.title),t().createElement(d,{active:r.active,onSelectionChange:e=>{a(e),r.onSelectionChange(e)},changeGranted:r.changeGranted,setSelected:a,number:r.number+1,type:"Test",title:r.title})),r.descriptions&&t().createElement("div",{className:"mt-2"},t().createElement("p",{className:"text-sm text-gray-600"},r.descriptions)))),r.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"},r.rewards))))))},g=a.p+"static/ca60d8c79124e56d8c1c.png",p=r=>{let{requestData:n={},dataRequester:a="App",proofMode:o=!1,domain:c="",appIcon:l=""}=r;const[s,i]=(0,e.useState)(!0),[d,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)([]),S=(0,e.useRef)(null),k=(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&&(S.current=e.data.userSub),e.data.encryptedUserPin&&(k.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===d.length?t().createElement(m,{appIcon:"https://onairos.sirv.com/Images/OnairosBlack.png",appName:a,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(a," 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"},a.charAt(0)))),t().createElement("h2",{className:"text-lg font-bold text-gray-800"},a)),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 ",a),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 "+a+" 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,r)=>{const n=e.toLowerCase().replace(" ","_"),o={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(u,{key:n,active:!0,title:o.type,id:o,number:r,descriptions:o.descriptions,rewards:o.reward,size:n,changeGranted:O,onSelectionChange:e=>function(e,t,r,n,a,o){const c=new Date,l={requester:e,date:c.toISOString(),name:n,reward:a,data:t};o?(console.log("Adding connection: ".concat(JSON.stringify(l))),N.current.find((r=>r.requester===e&&r.data===t))||N.current.push(l)):(console.log("Removing connection for: ".concat(t)),N.current=N.current.filter((r=>!(r.requester===e&&r.data===t)))),console.log("Current selected connections:",N.current)}(a,n,0,o.type,o.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,r)=>t().createElement("div",{key:r,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(){r.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()})(),o})()));
|
|
2
2
|
//# sourceMappingURL=iframe.bundle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iframe.bundle.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,EAAQG,QAAQ,SAAUA,QAAQ,cAC1B,mBAAXC,QAAyBA,OAAOC,IAC9CD,OAAO,UAAW,CAAC,QAAS,YAAaJ,GACf,iBAAZC,QACdA,QAAiB,QAAID,EAAQG,QAAQ,SAAUA,QAAQ,cAEvDJ,EAAc,QAAIC,EAAQD,EAAY,MAAGA,EAAe,SACzD,CATD,CASGO,MAAM,CAACC,EAAkCC,I,wCCP5C,IAAIC,EAAI,EAAQ,KAEdR,EAAQS,WAAaD,EAAEC,WACvBT,EAAQU,YAAcF,EAAEE,W,UCL1BT,EAAOD,QAAUM,C,UCAjBL,EAAOD,QAAUO,C,GCCbI,EAA2B,CAAC,EAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAad,QAGrB,IAAIC,EAASU,EAAyBE,GAAY,CAGjDb,QAAS,CAAC,GAOX,OAHAgB,EAAoBH,GAAUZ,EAAQA,EAAOD,QAASY,GAG/CX,EAAO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U,sBAAqB,OAG3C,IAAK,UACH,OACED,IAAAA,cAAA,OAAKC,UAAU,sEACbD,IAAAA,cAAA,QAAMC,UAAU,sBAAqB,OAG3C,IAAK,QACH,OACED,IAAAA,cAAA,OAAKC,UAAU,uEACbD,IAAAA,cAAA,QAAMC,UAAU,sBAAqB,MAG3C,QACE,OACED,IAAAA,cAAA,OAAKC,UAAU,uEACbD,IAAAA,cAAA,QAAMC,UAAU,yBAAyB8B,EAAKiD,OAAO,GAAGsB,gBAGhE,EAKGC,CAAkBJ,GACnBnG,IAAAA,cAAA,QAAMC,UAAU,8BAA8BkG,UAS1D,ECnRV,IAAIhD,GAAY,EACZC,EAAS,GACTe,EAAU,KACVC,EAAmB,KAyBvB,SAASoC,IACMC,EAAAA,WAAoBlN,SAASmN,eAAe,SACpDC,OACH3G,IAAAA,cAAC4G,EAAe,CACdzD,UAAWA,EACXC,OAAQA,EACRe,QAASA,EACTC,iBAAkBA,IAGxB,CAhCA1L,OAAOmM,iBAAiB,WAAYH,IAI9BA,EAAMC,MAA8B,kBAAtBD,EAAMC,KAAKkC,SAC3B1D,EAAYuB,EAAMC,KAAKxB,YAAa,EACpCC,EAASsB,EAAMC,KAAKvB,QAAU,GAC9Be,EAAUO,EAAMC,KAAKR,SAAW,KAChCC,EAAmBM,EAAMC,KAAKP,kBAAoB,KAGlDoC,IACF,IAIF9N,OAAOoO,OAAO5B,YAAY,CACxB2B,OAAQ,gBACRE,OAAQ,eACP,KAgBHP,G","sources":["webpack://Onairos/webpack/universalModuleDefinition","webpack://Onairos/./node_modules/react-dom/client.js","webpack://Onairos/external umd {\"commonjs\":\"react\",\"commonjs2\":\"react\",\"amd\":\"React\",\"root\":\"React\"}","webpack://Onairos/external umd {\"commonjs\":\"react-dom\",\"commonjs2\":\"react-dom\",\"amd\":\"ReactDOM\",\"root\":\"ReactDOM\"}","webpack://Onairos/webpack/bootstrap","webpack://Onairos/webpack/runtime/compat get default export","webpack://Onairos/webpack/runtime/define property getters","webpack://Onairos/webpack/runtime/global","webpack://Onairos/webpack/runtime/hasOwnProperty shorthand","webpack://Onairos/webpack/runtime/make namespace object","webpack://Onairos/webpack/runtime/publicPath","webpack://Onairos/./src/components/UniversalOnboarding.jsx","webpack://Onairos/./src/iframe/components/Box.jsx","webpack://Onairos/./src/iframe/components/IndividualConnection.jsx","webpack://Onairos/./src/iframe/DataRequestPage.jsx","webpack://Onairos/./src/iframe/data_request_page.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"react\"), require(\"react-dom\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"Onairos\", [\"React\", \"ReactDOM\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Onairos\"] = factory(require(\"react\"), require(\"react-dom\"));\n\telse\n\t\troot[\"Onairos\"] = factory(root[\"React\"], root[\"ReactDOM\"]);\n})(this, (__WEBPACK_EXTERNAL_MODULE__639__, __WEBPACK_EXTERNAL_MODULE__346__) => {\nreturn ","'use strict';\n\nvar m = require('react-dom');\nif (process.env.NODE_ENV === 'production') {\n exports.createRoot = m.createRoot;\n exports.hydrateRoot = m.hydrateRoot;\n} else {\n var i = m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;\n exports.createRoot = function(c, o) {\n i.usingClientEntryPoint = true;\n try {\n return m.createRoot(c, o);\n } finally {\n i.usingClientEntryPoint = false;\n }\n };\n exports.hydrateRoot = function(c, h, o) {\n i.usingClientEntryPoint = true;\n try {\n return m.hydrateRoot(c, h, o);\n } finally {\n i.usingClientEntryPoint = false;\n }\n };\n}\n","module.exports = __WEBPACK_EXTERNAL_MODULE__639__;","module.exports = __WEBPACK_EXTERNAL_MODULE__346__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","var scriptUrl;\nif (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + \"\";\nvar document = __webpack_require__.g.document;\nif (!scriptUrl && document) {\n\tif (document.currentScript)\n\t\tscriptUrl = document.currentScript.src;\n\tif (!scriptUrl) {\n\t\tvar scripts = document.getElementsByTagName(\"script\");\n\t\tif(scripts.length) {\n\t\t\tvar i = scripts.length - 1;\n\t\t\twhile (i > -1 && !scriptUrl) scriptUrl = scripts[i--].src;\n\t\t}\n\t}\n}\n// When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration\n// or pass an empty string (\"\") and set the __webpack_public_path__ variable from your code to use your own logic.\nif (!scriptUrl) throw new Error(\"Automatic publicPath is not supported in this browser\");\nscriptUrl = scriptUrl.replace(/#.*$/, \"\").replace(/\\?.*$/, \"\").replace(/\\/[^\\/]+$/, \"/\");\n__webpack_require__.p = scriptUrl;","import React, { useState, useEffect } from 'react';\r\n\r\nconst platforms = [\r\n { name: 'YouTube', icon: '📺', color: 'bg-red-500', connector: 'youtube' },\r\n { name: 'LinkedIn', icon: '💼', color: 'bg-blue-700', connector: 'linkedin' },\r\n { name: 'Reddit', icon: '🔥', color: 'bg-orange-500', connector: 'reddit' },\r\n { name: 'Pinterest', icon: '📌', color: 'bg-red-600', connector: 'pinterest' },\r\n { name: 'Instagram', icon: '📷', color: 'bg-pink-500', connector: 'instagram' },\r\n { name: 'GitHub', icon: '⚡', color: 'bg-gray-800', connector: 'github' },\r\n { name: 'Facebook', icon: '👥', color: 'bg-blue-600', connector: 'facebook' },\r\n { name: 'Gmail', icon: '✉️', color: 'bg-red-400', connector: 'gmail' }\r\n];\r\n\r\n// Enhanced SDK configuration\r\nconst sdkConfig = {\r\n apiKey: process.env.REACT_APP_ONAIROS_API_KEY || 'onairos_web_sdk_live_key_2024',\r\n baseUrl: process.env.REACT_APP_ONAIROS_BASE_URL || 'https://api2.onairos.uk',\r\n sdkType: 'web', // web, mobile, desktop\r\n enableHealthMonitoring: true,\r\n enableAutoRefresh: true,\r\n enableConnectionValidation: true\r\n};\r\n\r\n/**\r\n * UniversalOnboarding Component - Compact & Enhanced\r\n * Displays a streamlined onboarding screen for data connections\r\n */\r\nexport default function UniversalOnboarding({ onComplete, appIcon, appName = 'App' }) {\r\n const [connectedAccounts, setConnectedAccounts] = useState({});\r\n const [isConnecting, setIsConnecting] = useState(false);\r\n const [connectingPlatform, setConnectingPlatform] = useState(null);\r\n const [connectionErrors, setConnectionErrors] = useState({});\r\n const [connectionHealth, setConnectionHealth] = useState({});\r\n const [healthScore, setHealthScore] = useState(0);\r\n\r\n // Mobile device detection\r\n const isMobileDevice = () => {\r\n return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ||\r\n (window.innerWidth <= 768);\r\n };\r\n\r\n // Handle mobile OAuth return\r\n useEffect(() => {\r\n const handleOAuthReturn = () => {\r\n const platform = localStorage.getItem('onairos_oauth_platform');\r\n if (platform) {\r\n console.log(`📱 OAuth return detected for: ${platform}`);\r\n \r\n // Clear OAuth state\r\n localStorage.removeItem('onairos_oauth_platform');\r\n localStorage.removeItem('onairos_oauth_return');\r\n \r\n // Mark as connected\r\n setConnectedAccounts(prev => ({\r\n ...prev,\r\n [platform]: true\r\n }));\r\n \r\n // Clear any errors\r\n setConnectionErrors(prev => ({\r\n ...prev,\r\n [platform]: null\r\n }));\r\n \r\n console.log(`✅ ${platform} marked as connected from OAuth return`);\r\n }\r\n };\r\n\r\n handleOAuthReturn();\r\n }, []);\r\n\r\n const connectToPlatform = async (platformName) => {\r\n console.log(`🚀 connectToPlatform called for: ${platformName}`);\r\n \r\n const platform = platforms.find(p => p.name === platformName);\r\n if (!platform?.connector) {\r\n console.error(`❌ No connector found for platform: ${platformName}`);\r\n return false;\r\n }\r\n\r\n try {\r\n setIsConnecting(true);\r\n setConnectingPlatform(platformName);\r\n \r\n // Clear any previous errors\r\n setConnectionErrors(prev => ({\r\n ...prev,\r\n [platformName]: null\r\n }));\r\n \r\n console.log(`🔗 Starting OAuth connection for ${platformName}...`);\r\n \r\n const username = localStorage.getItem('username') || localStorage.getItem('onairosUser')?.email || 'user@example.com';\r\n \r\n // Enhanced authorize endpoint with SDK type\r\n const authorizeUrl = `${sdkConfig.baseUrl}/${platform.connector}/authorize`;\r\n \r\n const response = await fetch(authorizeUrl, {\r\n method: 'POST',\r\n headers: {\r\n 'x-api-key': sdkConfig.apiKey,\r\n 'Content-Type': 'application/json'\r\n },\r\n body: JSON.stringify({\r\n session: {\r\n username: username,\r\n sdkType: sdkConfig.sdkType, // Pass SDK type to backend\r\n returnUrl: window.location.href, // For better redirect handling\r\n platform: platformName\r\n }\r\n })\r\n });\r\n\r\n if (!response.ok) {\r\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\r\n }\r\n\r\n const responseData = await response.json();\r\n const expectedUrlKey = `${platform.connector}Url`;\r\n const oauthUrl = responseData[expectedUrlKey];\r\n\r\n if (!oauthUrl) {\r\n throw new Error(`No OAuth URL received for ${platformName}`);\r\n }\r\n \r\n if (isMobileDevice()) {\r\n // Mobile: Use redirect flow\r\n localStorage.setItem('onairos_oauth_platform', platformName);\r\n localStorage.setItem('onairos_oauth_return', window.location.href);\r\n window.location.href = oauthUrl;\r\n return true;\r\n } else {\r\n // Desktop: Use popup flow with enhanced monitoring\r\n const popup = window.open(\r\n oauthUrl,\r\n `${platform.connector}_oauth`,\r\n 'width=500,height=600,scrollbars=yes,resizable=yes,status=no,location=no,toolbar=no,menubar=no'\r\n );\r\n \r\n if (!popup) {\r\n throw new Error('Popup blocked. Please allow popups and try again.');\r\n }\r\n\r\n // Enhanced popup monitoring with better success/error detection\r\n const checkInterval = setInterval(() => {\r\n try {\r\n // Check if popup is closed\r\n if (popup.closed) {\r\n clearInterval(checkInterval);\r\n \r\n // Check for success or error signals from callback page\r\n const successFlag = localStorage.getItem(`onairos_${platformName}_success`);\r\n const errorFlag = localStorage.getItem(`onairos_${platformName}_error`);\r\n const timestamp = localStorage.getItem(`onairos_${platformName}_timestamp`);\r\n \r\n // Only process recent signals (within 30 seconds)\r\n const isRecentSignal = timestamp && (Date.now() - parseInt(timestamp) < 30000);\r\n \r\n if (successFlag && isRecentSignal) {\r\n // Success flow\r\n console.log(`✅ ${platformName} OAuth completed successfully`);\r\n localStorage.removeItem(`onairos_${platformName}_success`);\r\n localStorage.removeItem(`onairos_${platformName}_timestamp`);\r\n \r\n setConnectedAccounts(prev => ({\r\n ...prev,\r\n [platformName]: true\r\n }));\r\n setConnectionErrors(prev => ({\r\n ...prev,\r\n [platformName]: null\r\n }));\r\n \r\n } else if (errorFlag && isRecentSignal) {\r\n // Error flow\r\n console.log(`❌ ${platformName} OAuth failed:`, errorFlag);\r\n localStorage.removeItem(`onairos_${platformName}_error`);\r\n localStorage.removeItem(`onairos_${platformName}_timestamp`);\r\n \r\n setConnectionErrors(prev => ({\r\n ...prev,\r\n [platformName]: errorFlag\r\n }));\r\n \r\n } else {\r\n // No signal or old signal - assume user cancelled\r\n console.log(`⚠️ ${platformName} OAuth cancelled or no response`);\r\n setConnectionErrors(prev => ({\r\n ...prev,\r\n [platformName]: 'Connection was cancelled'\r\n }));\r\n }\r\n \r\n setIsConnecting(false);\r\n setConnectingPlatform(null);\r\n }\r\n } catch (error) {\r\n // Cross-origin error when popup navigates away - this is normal\r\n // console.log(`🔄 Popup navigated away for ${platformName}`);\r\n }\r\n }, 1000);\r\n\r\n // Timeout after 5 minutes\r\n setTimeout(() => {\r\n if (!popup.closed) {\r\n popup.close();\r\n clearInterval(checkInterval);\r\n setConnectionErrors(prev => ({\r\n ...prev,\r\n [platformName]: 'Connection timeout'\r\n }));\r\n setIsConnecting(false);\r\n setConnectingPlatform(null);\r\n }\r\n }, 300000);\r\n\r\n return true;\r\n }\r\n } catch (error) {\r\n console.error(`❌ Error connecting to ${platformName}:`, error);\r\n setConnectionErrors(prev => ({\r\n ...prev,\r\n [platformName]: error.message\r\n }));\r\n setIsConnecting(false);\r\n setConnectingPlatform(null);\r\n return false;\r\n }\r\n };\r\n\r\n const handleToggle = async (platformName) => {\r\n console.log(`🔥 TOGGLE CLICKED: ${platformName}`);\r\n \r\n if (isConnecting && connectingPlatform !== platformName) {\r\n console.log(`⚠️ Already connecting to ${connectingPlatform}, ignoring click on ${platformName}`);\r\n return;\r\n }\r\n \r\n const isConnected = connectedAccounts[platformName];\r\n \r\n if (isConnected) {\r\n // Disconnect\r\n console.log(`🔌 Disconnecting from ${platformName}...`);\r\n setConnectedAccounts(prev => ({\r\n ...prev,\r\n [platformName]: false\r\n }));\r\n setConnectionErrors(prev => ({\r\n ...prev,\r\n [platformName]: null\r\n }));\r\n } else {\r\n // Connect\r\n await connectToPlatform(platformName);\r\n }\r\n };\r\n\r\n const handleContinue = () => {\r\n const connected = Object.entries(connectedAccounts)\r\n .filter(([platform, isConnected]) => isConnected)\r\n .map(([platform]) => platform);\r\n \r\n onComplete({\r\n connectedAccounts: connected,\r\n totalConnections: connected.length,\r\n healthScore: healthScore,\r\n connectionHealth: connectionHealth,\r\n sdkVersion: '2.1.7',\r\n enhancedFeatures: {\r\n healthMonitoring: sdkConfig.enableHealthMonitoring,\r\n autoRefresh: sdkConfig.enableAutoRefresh,\r\n connectionValidation: sdkConfig.enableConnectionValidation\r\n }\r\n });\r\n };\r\n\r\n const connectedCount = Object.values(connectedAccounts).filter(Boolean).length;\r\n\r\n return (\r\n <div className=\"max-w-sm mx-auto bg-white p-4 rounded-lg shadow-lg\">\r\n {/* Compact Header */}\r\n <div className=\"flex items-center justify-center mb-4\">\r\n <div className=\"flex items-center space-x-2\">\r\n <img \r\n src={appIcon || \"https://onairos.sirv.com/Images/OnairosBlack.png\"} \r\n alt={appName} \r\n className=\"w-8 h-8 rounded-lg\"\r\n />\r\n <div className=\"flex items-center text-gray-400\">\r\n <svg className=\"w-4 h-4\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\r\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M17 8l4 4m0 0l-4 4m4-4H3\" />\r\n </svg>\r\n </div>\r\n <img \r\n src=\"https://onairos.sirv.com/Images/OnairosBlack.png\" \r\n alt=\"Onairos\" \r\n className=\"w-8 h-8 rounded-lg\"\r\n />\r\n </div>\r\n </div>\r\n\r\n {/* Simple Clear Title */}\r\n <div className=\"text-center mb-4\">\r\n <h2 className=\"text-lg font-bold text-gray-900 mb-1\">Connect Data</h2>\r\n <p className=\"text-gray-600 text-sm\">\r\n Connect data here to enhance your {appName} experience\r\n </p>\r\n </div>\r\n\r\n {/* Compact Platform Grid */}\r\n <div className=\"grid grid-cols-2 gap-3 mb-4\">\r\n {platforms.map((platform) => {\r\n const isConnected = connectedAccounts[platform.name] || false;\r\n const isCurrentlyConnecting = connectingPlatform === platform.name;\r\n const hasError = connectionErrors[platform.name];\r\n const isDisabled = isConnecting && !isCurrentlyConnecting;\r\n \r\n return (\r\n <div \r\n key={platform.name}\r\n className={`relative p-3 border-2 rounded-lg transition-all duration-200 cursor-pointer ${\r\n isDisabled ? 'opacity-50 cursor-not-allowed' : 'hover:shadow-md'\r\n } ${\r\n isConnected ? 'border-green-400 bg-green-50' : \r\n hasError ? 'border-red-400 bg-red-50' :\r\n isCurrentlyConnecting ? 'border-blue-400 bg-blue-50' : \r\n 'border-gray-200 bg-white hover:border-gray-300'\r\n }`}\r\n onClick={() => !isDisabled && handleToggle(platform.name)}\r\n >\r\n {/* Platform Icon */}\r\n <div className={`w-8 h-8 rounded-lg ${platform.color} flex items-center justify-center text-white text-lg mb-2 mx-auto relative`}>\r\n {isCurrentlyConnecting ? (\r\n <div className=\"animate-spin h-4 w-4 border-2 border-white rounded-full border-t-transparent\"></div>\r\n ) : (\r\n platform.icon\r\n )}\r\n \r\n {/* Connection Status Indicator */}\r\n {isConnected && !isCurrentlyConnecting && (\r\n <div className=\"absolute -top-1 -right-1 w-4 h-4 bg-green-500 rounded-full flex items-center justify-center\">\r\n <svg className=\"w-2.5 h-2.5 text-white\" fill=\"currentColor\" viewBox=\"0 0 20 20\">\r\n <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\" />\r\n </svg>\r\n </div>\r\n )}\r\n \r\n {hasError && !isCurrentlyConnecting && (\r\n <div className=\"absolute -top-1 -right-1 w-4 h-4 bg-red-500 rounded-full flex items-center justify-center\">\r\n <svg className=\"w-2.5 h-2.5 text-white\" fill=\"currentColor\" viewBox=\"0 0 20 20\">\r\n <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\" />\r\n </svg>\r\n </div>\r\n )}\r\n </div>\r\n \r\n {/* Platform Name */}\r\n <div className=\"text-center\">\r\n <h3 className=\"font-medium text-gray-900 text-xs\">{platform.name}</h3>\r\n <p className={`text-xs mt-1 ${\r\n isCurrentlyConnecting ? 'text-blue-600' : \r\n isConnected ? 'text-green-600' : \r\n hasError ? 'text-red-600' :\r\n 'text-gray-500'\r\n }`}>\r\n {isCurrentlyConnecting ? 'Connecting...' : \r\n isConnected ? 'Connected' : \r\n hasError ? 'Failed' :\r\n 'Tap to connect'}\r\n </p>\r\n \r\n {/* Error Message */}\r\n {hasError && (\r\n <p className=\"text-xs text-red-600 mt-1 break-words\">\r\n {hasError}\r\n </p>\r\n )}\r\n </div>\r\n </div>\r\n );\r\n })}\r\n </div>\r\n\r\n {/* Connection Status Summary */}\r\n {connectedCount > 0 && (\r\n <div className=\"mb-4 p-2 bg-green-50 border border-green-200 rounded-lg\">\r\n <p className=\"text-green-800 text-sm text-center\">\r\n ✅ {connectedCount} connection{connectedCount > 1 ? 's' : ''} active\r\n </p>\r\n </div>\r\n )}\r\n\r\n {/* Continue Button */}\r\n <button\r\n onClick={handleContinue}\r\n disabled={connectedCount === 0}\r\n className={`w-full py-3 px-4 rounded-lg font-semibold transition-colors ${\r\n connectedCount > 0\r\n ? 'bg-blue-600 text-white hover:bg-blue-700'\r\n : 'bg-gray-300 text-gray-500 cursor-not-allowed'\r\n }`}\r\n >\r\n {connectedCount > 0 ? `Continue with ${connectedCount} connection${connectedCount > 1 ? 's' : ''}` : 'Connect at least one platform'}\r\n </button>\r\n\r\n {/* Skip Option */}\r\n <button\r\n onClick={() => onComplete({ connectedAccounts: [], totalConnections: 0 })}\r\n className=\"w-full mt-2 py-2 text-gray-500 hover:text-gray-700 text-sm\"\r\n >\r\n Skip for now\r\n </button>\r\n </div>\r\n );\r\n}\r\n","import React from 'react';\n\n/**\n * Box Component\n * Displays a checkbox item for data access requests\n */\nconst Box = (props) => {\n const handleChange = (e) => {\n const checked = e.target.checked;\n console.log(`Checkbox ${props.title} is now: ${checked ? 'checked' : 'unchecked'}`);\n if (checked) {\n props.setSelected(true);\n props.changeGranted(1);\n } else {\n props.setSelected(false);\n props.changeGranted(-1);\n }\n \n props.onSelectionChange(checked);\n };\n\n return (\n <div className=\"relative inline-flex items-center\">\n <input\n type=\"checkbox\"\n id={`request-${props.number}`}\n disabled={!props.active}\n onChange={handleChange}\n className={`\n appearance-none w-5 h-5 border rounded\n ${!props.active ? 'border-gray-300 bg-gray-100 cursor-not-allowed' : 'border-blue-500 cursor-pointer'}\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 `}\n />\n <svg \n className=\"absolute left-0.5 top-0.5 w-4 h-4 text-white pointer-events-none opacity-0 peer-checked:opacity-100\"\n fill=\"none\"\n stroke=\"currentColor\"\n viewBox=\"0 0 24 24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"3\" d=\"M5 13l4 4L19 7\"></path>\n </svg>\n \n {!props.active && (\n <span className=\"ml-2 text-xs text-red-500 font-medium\">\n Not available\n </span>\n )}\n </div>\n );\n};\n\nexport default Box;\n","import React, { useState } from 'react';\nimport Box from './Box';\n\n/**\n * IndividualConnection Component\n * Displays a card for each data connection request\n */\nfunction IndividualConnection(props) {\n const [selected, setSelected] = useState(false);\n\n const handleSelectionChange = (isSelected) => {\n setSelected(isSelected);\n props.onSelectionChange(isSelected);\n };\n\n // Get icon based on data type\n const getDataTypeIcon = () => {\n switch(props.title) {\n case \"Profile\":\n return (\n <div className=\"w-8 h-8 rounded-full bg-blue-100 flex items-center justify-center\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" className=\"h-4 w-4 text-blue-600\" viewBox=\"0 0 20 20\" fill=\"currentColor\">\n <path fillRule=\"evenodd\" d=\"M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z\" clipRule=\"evenodd\" />\n </svg>\n </div>\n );\n case \"User Memories\":\n return (\n <div className=\"w-8 h-8 rounded-full bg-purple-100 flex items-center justify-center\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" className=\"h-4 w-4 text-purple-600\" viewBox=\"0 0 20 20\" fill=\"currentColor\">\n <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\" />\n </svg>\n </div>\n );\n default:\n return (\n <div className=\"w-8 h-8 rounded-full bg-gray-100 flex items-center justify-center\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" className=\"h-4 w-4 text-gray-600\" viewBox=\"0 0 20 20\" fill=\"currentColor\">\n <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\" />\n </svg>\n </div>\n );\n }\n };\n\n return (\n <div className=\"bg-white rounded-xl shadow-sm hover:shadow-md transition-all overflow-hidden\">\n <div className=\"p-5\">\n <div className=\"flex items-start space-x-4\">\n {getDataTypeIcon()}\n <div className=\"flex-1\">\n <div className=\"flex items-center justify-between\">\n <h3 className=\"font-medium text-gray-800\">{props.title}</h3>\n <Box\n active={props.active}\n onSelectionChange={handleSelectionChange}\n changeGranted={props.changeGranted}\n setSelected={setSelected}\n number={props.number + 1}\n type={\"Test\"}\n title={props.title}\n />\n </div>\n \n {props.descriptions && (\n <div className=\"mt-2\">\n <p className=\"text-sm text-gray-600\">{props.descriptions}</p>\n </div>\n )}\n </div>\n </div>\n \n {props.rewards && (\n <div className=\"mt-3 pt-3 border-t border-gray-100\">\n <div className=\"flex items-center\">\n <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\">\n <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\" />\n </svg>\n <span className=\"text-xs text-gray-500\">Benefit: <span className=\"text-gray-700\">{props.rewards}</span></span>\n </div>\n </div>\n )}\n </div>\n </div>\n );\n}\n\nexport default IndividualConnection;\n","import React, { useState, useEffect, useRef } from 'react';\r\nimport UniversalOnboarding from '../components/UniversalOnboarding.jsx';\r\nimport IndividualConnection from './components/IndividualConnection';\r\nimport onairosLogo from './icons/onairos_logo.png';\r\n\r\n/**\r\n * DataRequestPage Component\r\n * Displays different data requests and handles user interactions\r\n */\r\nconst DataRequestPage = ({ requestData = {}, dataRequester = 'App', proofMode = false, domain = '', appIcon = '' }) => {\r\n const [loading, setLoading] = useState(true);\r\n const [activeModels, setActiveModels] = useState([]);\r\n const [granted, setGranted] = useState(0);\r\n const [allowSubmit, setAllowSubmit] = useState(false);\r\n const [userConnections, setUserConnections] = useState(['instagram', 'youtube', 'email']);\r\n const [selectedRequests, setSelectedRequests] = useState({});\r\n const selectedConnections = useRef([]);\r\n const userSub = useRef(null);\r\n const encryptedUserPin = useRef(null);\r\n\r\n // Update allowSubmit when granted changes\r\n useEffect(() => {\r\n if (granted > 0) {\r\n setAllowSubmit(true);\r\n } else {\r\n setAllowSubmit(false);\r\n }\r\n }, [granted]);\r\n\r\n // Simulate loading data\r\n useEffect(() => {\r\n // In a real implementation, this would fetch active models from a service\r\n const loadData = async () => {\r\n try {\r\n // Simulate API call\r\n await new Promise(resolve => setTimeout(resolve, 1000));\r\n \r\n // Sample active models - this would come from your backend\r\n setActiveModels(['Profile', 'User Memories']);\r\n setLoading(false);\r\n } catch (error) {\r\n console.error('Error loading data:', error);\r\n setLoading(false);\r\n }\r\n };\r\n \r\n loadData();\r\n\r\n // Message handler to receive data from parent window\r\n const handleMessage = (event) => {\r\n if (event.data && event.data.type === 'dataRequest') {\r\n // Process received data\r\n if (event.data.requestData) {\r\n // Update request data state\r\n }\r\n if (event.data.activeModels) {\r\n setActiveModels(event.data.activeModels);\r\n }\r\n if (event.data.userSub) {\r\n userSub.current = event.data.userSub;\r\n }\r\n if (event.data.encryptedUserPin) {\r\n encryptedUserPin.current = event.data.encryptedUserPin;\r\n }\r\n }\r\n };\r\n\r\n // Add message listener\r\n window.addEventListener('message', handleMessage);\r\n \r\n // Clean up listener\r\n return () => {\r\n window.removeEventListener('message', handleMessage);\r\n };\r\n }, []);\r\n\r\n /**\r\n * Reject all data requests\r\n */\r\n async function rejectDataRequest() {\r\n window.top.postMessage({type: 'closeIframe'}, '*');\r\n window.postMessage({type: 'closeIframe'}, '*');\r\n }\r\n\r\n /**\r\n * Send the selected data requests to the parent window\r\n */\r\n async function sendDataRequest() {\r\n if (granted === 0) {\r\n window.close();\r\n return;\r\n } else {\r\n const SignMessage = {\r\n message: 'Confirm ' + dataRequester + ' Data Access',\r\n confirmations: selectedConnections.current\r\n };\r\n \r\n // Send simplified response\r\n try {\r\n window.top.postMessage({\r\n type: 'dataRequestComplete',\r\n approved: selectedConnections.current,\r\n message: SignMessage\r\n }, '*');\r\n \r\n window.postMessage({\r\n type: 'dataRequestComplete',\r\n approved: selectedConnections.current,\r\n message: SignMessage\r\n }, '*');\r\n } catch (error) {\r\n console.error(\"Error sending data request:\", error);\r\n window.close();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Update the granted count\r\n */\r\n function changeGranted(plusMinus) {\r\n setGranted(granted + plusMinus);\r\n }\r\n\r\n /**\r\n * Handle selection of a connection/data request\r\n */\r\n function handleConnectionSelection(dataRequester, modelType, index, title, reward, isSelected) {\r\n const newDate = new Date();\r\n const newConnection = {\r\n requester: dataRequester,\r\n date: newDate.toISOString(),\r\n name: title,\r\n reward: reward,\r\n data: modelType\r\n };\r\n\r\n if (isSelected) {\r\n console.log(`Adding connection: ${JSON.stringify(newConnection)}`);\r\n if (!selectedConnections.current.find(connection => connection.requester === dataRequester && connection.data === modelType)) {\r\n selectedConnections.current.push(newConnection);\r\n }\r\n } else {\r\n console.log(`Removing connection for: ${modelType}`);\r\n selectedConnections.current = selectedConnections.current.filter(\r\n connection => !(connection.requester === dataRequester && connection.data === modelType)\r\n );\r\n }\r\n\r\n console.log('Current selected connections:', selectedConnections.current);\r\n }\r\n\r\n return (\r\n <div className=\"min-h-screen bg-gray-100\">\r\n {loading ? (\r\n <div className=\"flex items-center justify-center min-h-screen\">\r\n <div className=\"animate-spin h-8 w-8 border-2 border-blue-600 rounded-full border-t-transparent\"></div>\r\n </div>\r\n ) : activeModels.length === 0 ? (\r\n <UniversalOnboarding \r\n appIcon=\"https://onairos.sirv.com/Images/OnairosBlack.png\" \r\n appName={dataRequester}\r\n username={localStorage.getItem(\"username\")}\r\n />\r\n ) : (\r\n <div className=\"max-w-md mx-auto p-6 space-y-4\">\r\n <header className=\"bg-white p-6 rounded-xl shadow-md\">\r\n <div className=\"flex items-center justify-between mb-6\">\r\n <div className=\"flex items-center space-x-2\">\r\n <img src={onairosLogo} alt=\"Onairos Logo\" className=\"w-8 h-8\" />\r\n <div className=\"text-gray-400 mx-2\">→</div>\r\n {appIcon ? (\r\n <img src={appIcon} alt={`${dataRequester} Logo`} className=\"w-8 h-8 rounded-full\" />\r\n ) : (\r\n <div className=\"w-8 h-8 bg-gray-200 rounded-full flex items-center justify-center\">\r\n <span className=\"text-gray-600 text-xs font-bold\">{dataRequester.charAt(0)}</span>\r\n </div>\r\n )}\r\n </div>\r\n <h2 className=\"text-lg font-bold text-gray-800\">{dataRequester}</h2>\r\n </div>\r\n \r\n <h1 className=\"text-xl font-bold text-gray-800 mb-4\">Data Access Request</h1>\r\n <p className=\"text-gray-600 mb-6\">Select the data you want to share with {dataRequester}</p>\r\n \r\n <div className=\"flex items-center justify-between gap-4\">\r\n <button\r\n onClick={rejectDataRequest}\r\n 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\"\r\n >\r\n Decline\r\n </button>\r\n <button\r\n disabled={!allowSubmit}\r\n onClick={sendDataRequest}\r\n 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\"\r\n >\r\n Approve {granted > 0 && `(${granted})`}\r\n </button>\r\n </div>\r\n </header>\r\n\r\n <div className=\"space-y-3\">\r\n {/* Only show Profile and User Memories */}\r\n {['Profile', 'User Memories'].map((dataType, index) => {\r\n const key = dataType.toLowerCase().replace(' ', '_');\r\n const product = {\r\n type: dataType,\r\n descriptions: dataType === 'Profile' ? \r\n 'Basic profile information and preferences' : \r\n 'Your personal context and memory data',\r\n reward: dataType === 'Profile' ? \r\n 'Personalized experience' : \r\n 'Contextual understanding of your preferences'\r\n };\r\n \r\n return (\r\n <IndividualConnection\r\n key={key}\r\n active={true}\r\n title={product.type}\r\n id={product}\r\n number={index}\r\n descriptions={product.descriptions}\r\n rewards={product.reward}\r\n size={key}\r\n changeGranted={changeGranted}\r\n onSelectionChange={(isSelected) =>\r\n handleConnectionSelection(dataRequester, key, index, product.type, product.reward, isSelected)\r\n }\r\n />\r\n );\r\n })}\r\n \r\n {/* User Connections Section */}\r\n <div className=\"bg-white p-4 rounded-xl shadow-sm mt-4\">\r\n <h3 className=\"text-sm font-semibold text-gray-700 mb-3\">Your Connected Services</h3>\r\n <div className=\"flex items-center space-x-3\">\r\n {userConnections.map((connection, index) => {\r\n const getConnectionIcon = (type) => {\r\n switch(type) {\r\n case 'instagram':\r\n return (\r\n <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\">\r\n <span className=\"text-white text-xs\">IG</span>\r\n </div>\r\n );\r\n case 'youtube':\r\n return (\r\n <div className=\"w-10 h-10 rounded-full bg-red-600 flex items-center justify-center\">\r\n <span className=\"text-white text-xs\">YT</span>\r\n </div>\r\n );\r\n case 'email':\r\n return (\r\n <div className=\"w-10 h-10 rounded-full bg-blue-500 flex items-center justify-center\">\r\n <span className=\"text-white text-xs\">@</span>\r\n </div>\r\n );\r\n default:\r\n return (\r\n <div className=\"w-10 h-10 rounded-full bg-gray-200 flex items-center justify-center\">\r\n <span className=\"text-gray-600 text-xs\">{type.charAt(0).toUpperCase()}</span>\r\n </div>\r\n );\r\n }\r\n };\r\n \r\n return (\r\n <div key={index} className=\"flex flex-col items-center\">\r\n {getConnectionIcon(connection)}\r\n <span className=\"text-xs text-gray-600 mt-1\">{connection}</span>\r\n </div>\r\n );\r\n })}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n )}\r\n </div>\r\n );\r\n};\r\n\r\nexport default DataRequestPage;\r\n","import React from 'react';\nimport ReactDOM from 'react-dom/client';\nimport DataRequestPage from './DataRequestPage.jsx';\n\n// Global variables to store data from parent window\nlet proofMode = false;\nlet domain = '';\nlet userSub = null;\nlet encryptedUserPin = null;\n\n// Handle messages from the parent window\nwindow.addEventListener('message', (event) => {\n // Verify the sender origin if needed\n // if (event.origin !== 'expected-origin') return;\n \n if (event.data && event.data.source === 'onairosButton') {\n proofMode = event.data.proofMode || false;\n domain = event.data.domain || '';\n userSub = event.data.userSub || null;\n encryptedUserPin = event.data.encryptedUserPin || null;\n \n // Re-render with the new data\n renderApp();\n }\n});\n\n// Notify the parent window that the iframe is ready\nwindow.parent.postMessage({\n source: 'onairosIframe',\n action: 'iframeReady'\n}, '*');\n\n// Function to render the React app\nfunction renderApp() {\n const root = ReactDOM.createRoot(document.getElementById('root'));\n root.render(\n <DataRequestPage \n proofMode={proofMode}\n domain={domain}\n userSub={userSub}\n encryptedUserPin={encryptedUserPin}\n />\n );\n}\n\n// Initial render\nrenderApp();\n"],"names":["root","factory","exports","module","require","define","amd","this","__WEBPACK_EXTERNAL_MODULE__639__","__WEBPACK_EXTERNAL_MODULE__346__","m","createRoot","hydrateRoot","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","n","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","get","g","globalThis","Function","e","window","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","scriptUrl","importScripts","location","document","currentScript","src","scripts","getElementsByTagName","length","i","Error","replace","p","platforms","name","icon","color","connector","sdkConfig","apiKey","process","env","REACT_APP_ONAIROS_API_KEY","baseUrl","REACT_APP_ONAIROS_BASE_URL","sdkType","enableHealthMonitoring","enableAutoRefresh","enableConnectionValidation","UniversalOnboarding","_ref","onComplete","appIcon","appName","connectedAccounts","setConnectedAccounts","useState","isConnecting","setIsConnecting","connectingPlatform","setConnectingPlatform","connectionErrors","setConnectionErrors","connectionHealth","setConnectionHealth","healthScore","setHealthScore","useEffect","handleOAuthReturn","platform","localStorage","getItem","console","log","concat","removeItem","prev","_objectSpread","connectToPlatform","async","platformName","find","error","_localStorage$getItem","username","email","authorizeUrl","response","fetch","method","headers","body","JSON","stringify","session","returnUrl","href","ok","status","statusText","responseData","json","oauthUrl","test","navigator","userAgent","innerWidth","setItem","popup","open","checkInterval","setInterval","closed","clearInterval","successFlag","errorFlag","timestamp","isRecentSignal","Date","now","parseInt","setTimeout","close","message","connectedCount","values","filter","Boolean","React","className","alt","fill","stroke","viewBox","strokeLinecap","strokeLinejoin","strokeWidth","map","isConnected","isCurrentlyConnecting","hasError","isDisabled","onClick","handleToggle","fillRule","clipRule","handleContinue","connected","entries","_ref2","_ref3","totalConnections","sdkVersion","enhancedFeatures","healthMonitoring","autoRefresh","connectionValidation","disabled","props","type","id","number","active","onChange","checked","target","title","setSelected","changeGranted","onSelectionChange","xmlns","selected","getDataTypeIcon","Box","isSelected","descriptions","rewards","requestData","dataRequester","proofMode","domain","loading","setLoading","activeModels","setActiveModels","granted","setGranted","allowSubmit","setAllowSubmit","userConnections","setUserConnections","selectedRequests","setSelectedRequests","selectedConnections","useRef","userSub","encryptedUserPin","plusMinus","Promise","resolve","loadData","handleMessage","event","data","current","addEventListener","removeEventListener","onairosLogo","charAt","top","postMessage","SignMessage","confirmations","approved","dataType","index","toLowerCase","product","reward","IndividualConnection","size","modelType","newDate","newConnection","requester","date","toISOString","connection","push","handleConnectionSelection","toUpperCase","getConnectionIcon","renderApp","ReactDOM","getElementById","render","DataRequestPage","source","parent","action"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"iframe.bundle.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,EAAQG,QAAQ,SAAUA,QAAQ,cAC1B,mBAAXC,QAAyBA,OAAOC,IAC9CD,OAAO,UAAW,CAAC,QAAS,YAAaJ,GACf,iBAAZC,QACdA,QAAiB,QAAID,EAAQG,QAAQ,SAAUA,QAAQ,cAEvDJ,EAAc,QAAIC,EAAQD,EAAY,MAAGA,EAAe,SACzD,CATD,CASGO,MAAM,CAACC,EAAkCC,I,wCCP5C,IAAIC,EAAI,EAAQ,KAEdR,EAAQS,WAAaD,EAAEC,WACvBT,EAAQU,YAAcF,EAAEE,W,UCL1BT,EAAOD,QAAUM,C,UCAjBL,EAAOD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OAAO,GAAGsB,gBAGhE,EAKGC,CAAkBJ,GACnBnG,IAAAA,cAAA,QAAMC,UAAU,8BAA8BkG,UAS1D,ECnRV,IAAIhD,GAAY,EACZC,EAAS,GACTe,EAAU,KACVC,EAAmB,KAyBvB,SAASoC,IACMC,EAAAA,WAAoBrN,SAASsN,eAAe,SACpDC,OACH3G,IAAAA,cAAC4G,EAAe,CACdzD,UAAWA,EACXC,OAAQA,EACRe,QAASA,EACTC,iBAAkBA,IAGxB,CAhCA7L,OAAOsM,iBAAiB,WAAYH,IAI9BA,EAAMC,MAA8B,kBAAtBD,EAAMC,KAAKkC,SAC3B1D,EAAYuB,EAAMC,KAAKxB,YAAa,EACpCC,EAASsB,EAAMC,KAAKvB,QAAU,GAC9Be,EAAUO,EAAMC,KAAKR,SAAW,KAChCC,EAAmBM,EAAMC,KAAKP,kBAAoB,KAGlDoC,IACF,IAIFjO,OAAOuO,OAAO5B,YAAY,CACxB2B,OAAQ,gBACRE,OAAQ,eACP,KAgBHP,G","sources":["webpack://Onairos/webpack/universalModuleDefinition","webpack://Onairos/./node_modules/react-dom/client.js","webpack://Onairos/external umd {\"commonjs\":\"react\",\"commonjs2\":\"react\",\"amd\":\"React\",\"root\":\"React\"}","webpack://Onairos/external umd {\"commonjs\":\"react-dom\",\"commonjs2\":\"react-dom\",\"amd\":\"ReactDOM\",\"root\":\"ReactDOM\"}","webpack://Onairos/webpack/bootstrap","webpack://Onairos/webpack/runtime/compat get default export","webpack://Onairos/webpack/runtime/define property getters","webpack://Onairos/webpack/runtime/global","webpack://Onairos/webpack/runtime/hasOwnProperty shorthand","webpack://Onairos/webpack/runtime/make namespace object","webpack://Onairos/webpack/runtime/publicPath","webpack://Onairos/./src/components/UniversalOnboarding.jsx","webpack://Onairos/./src/iframe/components/Box.jsx","webpack://Onairos/./src/iframe/components/IndividualConnection.jsx","webpack://Onairos/./src/iframe/DataRequestPage.jsx","webpack://Onairos/./src/iframe/data_request_page.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"react\"), require(\"react-dom\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"Onairos\", [\"React\", \"ReactDOM\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Onairos\"] = factory(require(\"react\"), require(\"react-dom\"));\n\telse\n\t\troot[\"Onairos\"] = factory(root[\"React\"], root[\"ReactDOM\"]);\n})(this, (__WEBPACK_EXTERNAL_MODULE__639__, __WEBPACK_EXTERNAL_MODULE__346__) => {\nreturn ","'use strict';\n\nvar m = require('react-dom');\nif (process.env.NODE_ENV === 'production') {\n exports.createRoot = m.createRoot;\n exports.hydrateRoot = m.hydrateRoot;\n} else {\n var i = m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;\n exports.createRoot = function(c, o) {\n i.usingClientEntryPoint = true;\n try {\n return m.createRoot(c, o);\n } finally {\n i.usingClientEntryPoint = false;\n }\n };\n exports.hydrateRoot = function(c, h, o) {\n i.usingClientEntryPoint = true;\n try {\n return m.hydrateRoot(c, h, o);\n } finally {\n i.usingClientEntryPoint = false;\n }\n };\n}\n","module.exports = __WEBPACK_EXTERNAL_MODULE__639__;","module.exports = __WEBPACK_EXTERNAL_MODULE__346__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","var scriptUrl;\nif (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + \"\";\nvar document = __webpack_require__.g.document;\nif (!scriptUrl && document) {\n\tif (document.currentScript)\n\t\tscriptUrl = document.currentScript.src;\n\tif (!scriptUrl) {\n\t\tvar scripts = document.getElementsByTagName(\"script\");\n\t\tif(scripts.length) {\n\t\t\tvar i = scripts.length - 1;\n\t\t\twhile (i > -1 && !scriptUrl) scriptUrl = scripts[i--].src;\n\t\t}\n\t}\n}\n// When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration\n// or pass an empty string (\"\") and set the __webpack_public_path__ variable from your code to use your own logic.\nif (!scriptUrl) throw new Error(\"Automatic publicPath is not supported in this browser\");\nscriptUrl = scriptUrl.replace(/#.*$/, \"\").replace(/\\?.*$/, \"\").replace(/\\/[^\\/]+$/, \"/\");\n__webpack_require__.p = scriptUrl;","import React, { useState, useEffect } from 'react';\r\n\r\nconst platforms = [\r\n { name: 'YouTube', icon: '📺', color: 'bg-red-500', connector: 'youtube' },\r\n { name: 'LinkedIn', icon: '💼', color: 'bg-blue-700', connector: 'linkedin' },\r\n { name: 'Reddit', icon: '🔥', color: 'bg-orange-500', connector: 'reddit' },\r\n { name: 'Pinterest', icon: '📌', color: 'bg-red-600', connector: 'pinterest' },\r\n { name: 'Instagram', icon: '📷', color: 'bg-pink-500', connector: 'instagram' },\r\n { name: 'GitHub', icon: '⚡', color: 'bg-gray-800', connector: 'github' },\r\n { name: 'Facebook', icon: '👥', color: 'bg-blue-600', connector: 'facebook' },\r\n { name: 'Gmail', icon: '✉️', color: 'bg-red-400', connector: 'gmail' }\r\n];\r\n\r\n// Enhanced SDK configuration\r\nconst sdkConfig = {\r\n apiKey: process.env.REACT_APP_ONAIROS_API_KEY || 'onairos_web_sdk_live_key_2024',\r\n baseUrl: process.env.REACT_APP_ONAIROS_BASE_URL || 'https://api2.onairos.uk',\r\n sdkType: 'web', // web, mobile, desktop\r\n enableHealthMonitoring: true,\r\n enableAutoRefresh: true,\r\n enableConnectionValidation: true\r\n};\r\n\r\n/**\r\n * UniversalOnboarding Component - Compact & Enhanced\r\n * Displays a streamlined onboarding screen for data connections\r\n */\r\nexport default function UniversalOnboarding({ onComplete, appIcon, appName = 'App' }) {\r\n const [connectedAccounts, setConnectedAccounts] = useState({});\r\n const [isConnecting, setIsConnecting] = useState(false);\r\n const [connectingPlatform, setConnectingPlatform] = useState(null);\r\n const [connectionErrors, setConnectionErrors] = useState({});\r\n const [connectionHealth, setConnectionHealth] = useState({});\r\n const [healthScore, setHealthScore] = useState(0);\r\n\r\n // Mobile device detection\r\n const isMobileDevice = () => {\r\n return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ||\r\n (window.innerWidth <= 768);\r\n };\r\n\r\n // Handle mobile OAuth return\r\n useEffect(() => {\r\n const handleOAuthReturn = () => {\r\n const platform = localStorage.getItem('onairos_oauth_platform');\r\n if (platform) {\r\n console.log(`📱 OAuth return detected for: ${platform}`);\r\n \r\n // Clear OAuth state\r\n localStorage.removeItem('onairos_oauth_platform');\r\n localStorage.removeItem('onairos_oauth_return');\r\n \r\n // Mark as connected\r\n setConnectedAccounts(prev => ({\r\n ...prev,\r\n [platform]: true\r\n }));\r\n \r\n // Clear any errors\r\n setConnectionErrors(prev => ({\r\n ...prev,\r\n [platform]: null\r\n }));\r\n \r\n console.log(`✅ ${platform} marked as connected from OAuth return`);\r\n }\r\n };\r\n\r\n handleOAuthReturn();\r\n }, []);\r\n\r\n const connectToPlatform = async (platformName) => {\r\n console.log(`🚀 connectToPlatform called for: ${platformName}`);\r\n \r\n const platform = platforms.find(p => p.name === platformName);\r\n if (!platform?.connector) {\r\n console.error(`❌ No connector found for platform: ${platformName}`);\r\n return false;\r\n }\r\n\r\n try {\r\n setIsConnecting(true);\r\n setConnectingPlatform(platformName);\r\n \r\n // Clear any previous errors\r\n setConnectionErrors(prev => ({\r\n ...prev,\r\n [platformName]: null\r\n }));\r\n \r\n console.log(`🔗 Starting OAuth connection for ${platformName}...`);\r\n \r\n const username = localStorage.getItem('username') || localStorage.getItem('onairosUser')?.email || 'user@example.com';\r\n \r\n // Enhanced authorize endpoint with SDK type\r\n const authorizeUrl = `${sdkConfig.baseUrl}/${platform.connector}/authorize`;\r\n \r\n const response = await fetch(authorizeUrl, {\r\n method: 'POST',\r\n headers: {\r\n 'x-api-key': sdkConfig.apiKey,\r\n 'Content-Type': 'application/json'\r\n },\r\n body: JSON.stringify({\r\n session: {\r\n username: username\r\n }\r\n })\r\n });\r\n\r\n if (!response.ok) {\r\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\r\n }\r\n\r\n const responseData = await response.json();\r\n console.log(`📋 ${platformName} OAuth response:`, responseData);\r\n \r\n // Check for platform-specific URL keys with multiple fallbacks\r\n const platformUrlKeys = {\r\n 'youtube': ['youtubeURL', 'youtubeUrl', 'youtube_url'],\r\n 'linkedin': ['linkedinURL', 'linkedinUrl', 'linkedin_url'], \r\n 'reddit': ['redditURL', 'redditUrl', 'reddit_url'],\r\n 'pinterest': ['pinterestURL', 'pinterestUrl', 'pinterest_url'],\r\n 'instagram': ['instagramURL', 'instagramUrl', 'instagram_url'],\r\n 'github': ['githubURL', 'githubUrl', 'github_url'],\r\n 'facebook': ['facebookURL', 'facebookUrl', 'facebook_url'],\r\n 'gmail': ['gmailURL', 'gmailUrl', 'gmail_url']\r\n };\r\n \r\n const possibleKeys = platformUrlKeys[platform.connector] || [\r\n `${platform.connector}URL`,\r\n `${platform.connector}Url`, \r\n `${platform.connector}_url`,\r\n 'platformURL',\r\n 'authUrl', \r\n 'url'\r\n ];\r\n \r\n let oauthUrl = null;\r\n let usedKey = null;\r\n \r\n // Try each possible key\r\n for (const key of possibleKeys) {\r\n if (responseData[key]) {\r\n oauthUrl = responseData[key];\r\n usedKey = key;\r\n break;\r\n }\r\n }\r\n \r\n if (!oauthUrl) {\r\n console.error(`❌ No OAuth URL found for ${platformName}:`);\r\n console.error(`Expected one of:`, possibleKeys);\r\n console.error(`Response keys:`, Object.keys(responseData));\r\n console.error(`Full response:`, responseData);\r\n throw new Error(`No OAuth URL found. Backend should return one of: ${possibleKeys.join(', ')}`);\r\n }\r\n \r\n console.log(`✅ Found OAuth URL for ${platformName} using key: ${usedKey}`);\r\n \r\n if (isMobileDevice()) {\r\n // Mobile: Use redirect flow\r\n localStorage.setItem('onairos_oauth_platform', platformName);\r\n localStorage.setItem('onairos_oauth_return', window.location.href);\r\n window.location.href = oauthUrl;\r\n return true;\r\n } else {\r\n // Desktop: Use popup flow with enhanced monitoring\r\n const popup = window.open(\r\n oauthUrl,\r\n `${platform.connector}_oauth`,\r\n 'width=500,height=600,scrollbars=yes,resizable=yes,status=no,location=no,toolbar=no,menubar=no'\r\n );\r\n \r\n if (!popup) {\r\n throw new Error('Popup blocked. Please allow popups and try again.');\r\n }\r\n\r\n // Enhanced popup monitoring with better success/error detection\r\n const checkInterval = setInterval(() => {\r\n try {\r\n // Check if popup is closed\r\n if (popup.closed) {\r\n clearInterval(checkInterval);\r\n \r\n // Check for success or error signals from callback page\r\n const successFlag = localStorage.getItem(`onairos_${platformName}_success`);\r\n const errorFlag = localStorage.getItem(`onairos_${platformName}_error`);\r\n const timestamp = localStorage.getItem(`onairos_${platformName}_timestamp`);\r\n \r\n // Only process recent signals (within 30 seconds)\r\n const isRecentSignal = timestamp && (Date.now() - parseInt(timestamp) < 30000);\r\n \r\n if (successFlag && isRecentSignal) {\r\n // Success flow\r\n console.log(`✅ ${platformName} OAuth completed successfully`);\r\n localStorage.removeItem(`onairos_${platformName}_success`);\r\n localStorage.removeItem(`onairos_${platformName}_timestamp`);\r\n \r\n setConnectedAccounts(prev => ({\r\n ...prev,\r\n [platformName]: true\r\n }));\r\n setConnectionErrors(prev => ({\r\n ...prev,\r\n [platformName]: null\r\n }));\r\n \r\n } else if (errorFlag && isRecentSignal) {\r\n // Error flow\r\n console.log(`❌ ${platformName} OAuth failed:`, errorFlag);\r\n localStorage.removeItem(`onairos_${platformName}_error`);\r\n localStorage.removeItem(`onairos_${platformName}_timestamp`);\r\n \r\n setConnectionErrors(prev => ({\r\n ...prev,\r\n [platformName]: errorFlag\r\n }));\r\n \r\n } else {\r\n // No signal or old signal - assume user cancelled\r\n console.log(`⚠️ ${platformName} OAuth cancelled or no response`);\r\n setConnectionErrors(prev => ({\r\n ...prev,\r\n [platformName]: 'Connection was cancelled'\r\n }));\r\n }\r\n \r\n setIsConnecting(false);\r\n setConnectingPlatform(null);\r\n }\r\n } catch (error) {\r\n // Cross-origin error when popup navigates away - this is normal\r\n // console.log(`🔄 Popup navigated away for ${platformName}`);\r\n }\r\n }, 1000);\r\n\r\n // Timeout after 5 minutes\r\n setTimeout(() => {\r\n if (!popup.closed) {\r\n popup.close();\r\n clearInterval(checkInterval);\r\n setConnectionErrors(prev => ({\r\n ...prev,\r\n [platformName]: 'Connection timeout'\r\n }));\r\n setIsConnecting(false);\r\n setConnectingPlatform(null);\r\n }\r\n }, 300000);\r\n\r\n return true;\r\n }\r\n } catch (error) {\r\n console.error(`❌ Error connecting to ${platformName}:`, error);\r\n setConnectionErrors(prev => ({\r\n ...prev,\r\n [platformName]: error.message\r\n }));\r\n setIsConnecting(false);\r\n setConnectingPlatform(null);\r\n return false;\r\n }\r\n };\r\n\r\n const handleToggle = async (platformName) => {\r\n console.log(`🔥 TOGGLE CLICKED: ${platformName}`);\r\n \r\n if (isConnecting && connectingPlatform !== platformName) {\r\n console.log(`⚠️ Already connecting to ${connectingPlatform}, ignoring click on ${platformName}`);\r\n return;\r\n }\r\n \r\n const isConnected = connectedAccounts[platformName];\r\n \r\n if (isConnected) {\r\n // Disconnect\r\n console.log(`🔌 Disconnecting from ${platformName}...`);\r\n setConnectedAccounts(prev => ({\r\n ...prev,\r\n [platformName]: false\r\n }));\r\n setConnectionErrors(prev => ({\r\n ...prev,\r\n [platformName]: null\r\n }));\r\n } else {\r\n // Connect\r\n await connectToPlatform(platformName);\r\n }\r\n };\r\n\r\n const handleContinue = () => {\r\n const connected = Object.entries(connectedAccounts)\r\n .filter(([platform, isConnected]) => isConnected)\r\n .map(([platform]) => platform);\r\n \r\n onComplete({\r\n connectedAccounts: connected,\r\n totalConnections: connected.length,\r\n healthScore: healthScore,\r\n connectionHealth: connectionHealth,\r\n sdkVersion: '2.1.7',\r\n enhancedFeatures: {\r\n healthMonitoring: sdkConfig.enableHealthMonitoring,\r\n autoRefresh: sdkConfig.enableAutoRefresh,\r\n connectionValidation: sdkConfig.enableConnectionValidation\r\n }\r\n });\r\n };\r\n\r\n const connectedCount = Object.values(connectedAccounts).filter(Boolean).length;\r\n\r\n return (\r\n <div className=\"max-w-sm mx-auto bg-white p-4 rounded-lg shadow-lg\">\r\n {/* Compact Header */}\r\n <div className=\"flex items-center justify-center mb-4\">\r\n <div className=\"flex items-center space-x-2\">\r\n <img \r\n src={appIcon || \"https://onairos.sirv.com/Images/OnairosBlack.png\"} \r\n alt={appName} \r\n className=\"w-8 h-8 rounded-lg\"\r\n />\r\n <div className=\"flex items-center text-gray-400\">\r\n <svg className=\"w-4 h-4\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\r\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M17 8l4 4m0 0l-4 4m4-4H3\" />\r\n </svg>\r\n </div>\r\n <img \r\n src=\"https://onairos.sirv.com/Images/OnairosBlack.png\" \r\n alt=\"Onairos\" \r\n className=\"w-8 h-8 rounded-lg\"\r\n />\r\n </div>\r\n </div>\r\n\r\n {/* Simple Clear Title */}\r\n <div className=\"text-center mb-4\">\r\n <h2 className=\"text-lg font-bold text-gray-900 mb-1\">Connect Data</h2>\r\n <p className=\"text-gray-600 text-sm\">\r\n Connect data here to enhance your {appName} experience\r\n </p>\r\n </div>\r\n\r\n {/* Compact Platform Grid */}\r\n <div className=\"grid grid-cols-2 gap-3 mb-4\">\r\n {platforms.map((platform) => {\r\n const isConnected = connectedAccounts[platform.name] || false;\r\n const isCurrentlyConnecting = connectingPlatform === platform.name;\r\n const hasError = connectionErrors[platform.name];\r\n const isDisabled = isConnecting && !isCurrentlyConnecting;\r\n \r\n return (\r\n <div \r\n key={platform.name}\r\n className={`relative p-3 border-2 rounded-lg transition-all duration-200 cursor-pointer ${\r\n isDisabled ? 'opacity-50 cursor-not-allowed' : 'hover:shadow-md'\r\n } ${\r\n isConnected ? 'border-green-400 bg-green-50' : \r\n hasError ? 'border-red-400 bg-red-50' :\r\n isCurrentlyConnecting ? 'border-blue-400 bg-blue-50' : \r\n 'border-gray-200 bg-white hover:border-gray-300'\r\n }`}\r\n onClick={() => !isDisabled && handleToggle(platform.name)}\r\n >\r\n {/* Platform Icon */}\r\n <div className={`w-8 h-8 rounded-lg ${platform.color} flex items-center justify-center text-white text-lg mb-2 mx-auto relative`}>\r\n {isCurrentlyConnecting ? (\r\n <div className=\"animate-spin h-4 w-4 border-2 border-white rounded-full border-t-transparent\"></div>\r\n ) : (\r\n platform.icon\r\n )}\r\n \r\n {/* Connection Status Indicator */}\r\n {isConnected && !isCurrentlyConnecting && (\r\n <div className=\"absolute -top-1 -right-1 w-4 h-4 bg-green-500 rounded-full flex items-center justify-center\">\r\n <svg className=\"w-2.5 h-2.5 text-white\" fill=\"currentColor\" viewBox=\"0 0 20 20\">\r\n <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\" />\r\n </svg>\r\n </div>\r\n )}\r\n \r\n {hasError && !isCurrentlyConnecting && (\r\n <div className=\"absolute -top-1 -right-1 w-4 h-4 bg-red-500 rounded-full flex items-center justify-center\">\r\n <svg className=\"w-2.5 h-2.5 text-white\" fill=\"currentColor\" viewBox=\"0 0 20 20\">\r\n <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\" />\r\n </svg>\r\n </div>\r\n )}\r\n </div>\r\n \r\n {/* Platform Name */}\r\n <div className=\"text-center\">\r\n <h3 className=\"font-medium text-gray-900 text-xs\">{platform.name}</h3>\r\n <p className={`text-xs mt-1 ${\r\n isCurrentlyConnecting ? 'text-blue-600' : \r\n isConnected ? 'text-green-600' : \r\n hasError ? 'text-red-600' :\r\n 'text-gray-500'\r\n }`}>\r\n {isCurrentlyConnecting ? 'Connecting...' : \r\n isConnected ? 'Connected' : \r\n hasError ? 'Failed' :\r\n 'Tap to connect'}\r\n </p>\r\n \r\n {/* Error Message */}\r\n {hasError && (\r\n <p className=\"text-xs text-red-600 mt-1 break-words\">\r\n {hasError}\r\n </p>\r\n )}\r\n </div>\r\n </div>\r\n );\r\n })}\r\n </div>\r\n\r\n {/* Connection Status Summary */}\r\n {connectedCount > 0 && (\r\n <div className=\"mb-4 p-2 bg-green-50 border border-green-200 rounded-lg\">\r\n <p className=\"text-green-800 text-sm text-center\">\r\n ✅ {connectedCount} connection{connectedCount > 1 ? 's' : ''} active\r\n </p>\r\n </div>\r\n )}\r\n\r\n {/* Continue Button */}\r\n <button\r\n onClick={handleContinue}\r\n disabled={connectedCount === 0}\r\n className={`w-full py-3 px-4 rounded-lg font-semibold transition-colors ${\r\n connectedCount > 0\r\n ? 'bg-blue-600 text-white hover:bg-blue-700'\r\n : 'bg-gray-300 text-gray-500 cursor-not-allowed'\r\n }`}\r\n >\r\n {connectedCount > 0 ? `Continue with ${connectedCount} connection${connectedCount > 1 ? 's' : ''}` : 'Connect at least one platform'}\r\n </button>\r\n\r\n {/* Skip Option */}\r\n <button\r\n onClick={() => onComplete({ connectedAccounts: [], totalConnections: 0 })}\r\n className=\"w-full mt-2 py-2 text-gray-500 hover:text-gray-700 text-sm\"\r\n >\r\n Skip for now\r\n </button>\r\n </div>\r\n );\r\n}\r\n","import React from 'react';\n\n/**\n * Box Component\n * Displays a checkbox item for data access requests\n */\nconst Box = (props) => {\n const handleChange = (e) => {\n const checked = e.target.checked;\n console.log(`Checkbox ${props.title} is now: ${checked ? 'checked' : 'unchecked'}`);\n if (checked) {\n props.setSelected(true);\n props.changeGranted(1);\n } else {\n props.setSelected(false);\n props.changeGranted(-1);\n }\n \n props.onSelectionChange(checked);\n };\n\n return (\n <div className=\"relative inline-flex items-center\">\n <input\n type=\"checkbox\"\n id={`request-${props.number}`}\n disabled={!props.active}\n onChange={handleChange}\n className={`\n appearance-none w-5 h-5 border rounded\n ${!props.active ? 'border-gray-300 bg-gray-100 cursor-not-allowed' : 'border-blue-500 cursor-pointer'}\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 `}\n />\n <svg \n className=\"absolute left-0.5 top-0.5 w-4 h-4 text-white pointer-events-none opacity-0 peer-checked:opacity-100\"\n fill=\"none\"\n stroke=\"currentColor\"\n viewBox=\"0 0 24 24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"3\" d=\"M5 13l4 4L19 7\"></path>\n </svg>\n \n {!props.active && (\n <span className=\"ml-2 text-xs text-red-500 font-medium\">\n Not available\n </span>\n )}\n </div>\n );\n};\n\nexport default Box;\n","import React, { useState } from 'react';\nimport Box from './Box';\n\n/**\n * IndividualConnection Component\n * Displays a card for each data connection request\n */\nfunction IndividualConnection(props) {\n const [selected, setSelected] = useState(false);\n\n const handleSelectionChange = (isSelected) => {\n setSelected(isSelected);\n props.onSelectionChange(isSelected);\n };\n\n // Get icon based on data type\n const getDataTypeIcon = () => {\n switch(props.title) {\n case \"Profile\":\n return (\n <div className=\"w-8 h-8 rounded-full bg-blue-100 flex items-center justify-center\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" className=\"h-4 w-4 text-blue-600\" viewBox=\"0 0 20 20\" fill=\"currentColor\">\n <path fillRule=\"evenodd\" d=\"M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z\" clipRule=\"evenodd\" />\n </svg>\n </div>\n );\n case \"User Memories\":\n return (\n <div className=\"w-8 h-8 rounded-full bg-purple-100 flex items-center justify-center\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" className=\"h-4 w-4 text-purple-600\" viewBox=\"0 0 20 20\" fill=\"currentColor\">\n <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\" />\n </svg>\n </div>\n );\n default:\n return (\n <div className=\"w-8 h-8 rounded-full bg-gray-100 flex items-center justify-center\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" className=\"h-4 w-4 text-gray-600\" viewBox=\"0 0 20 20\" fill=\"currentColor\">\n <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\" />\n </svg>\n </div>\n );\n }\n };\n\n return (\n <div className=\"bg-white rounded-xl shadow-sm hover:shadow-md transition-all overflow-hidden\">\n <div className=\"p-5\">\n <div className=\"flex items-start space-x-4\">\n {getDataTypeIcon()}\n <div className=\"flex-1\">\n <div className=\"flex items-center justify-between\">\n <h3 className=\"font-medium text-gray-800\">{props.title}</h3>\n <Box\n active={props.active}\n onSelectionChange={handleSelectionChange}\n changeGranted={props.changeGranted}\n setSelected={setSelected}\n number={props.number + 1}\n type={\"Test\"}\n title={props.title}\n />\n </div>\n \n {props.descriptions && (\n <div className=\"mt-2\">\n <p className=\"text-sm text-gray-600\">{props.descriptions}</p>\n </div>\n )}\n </div>\n </div>\n \n {props.rewards && (\n <div className=\"mt-3 pt-3 border-t border-gray-100\">\n <div className=\"flex items-center\">\n <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\">\n <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\" />\n </svg>\n <span className=\"text-xs text-gray-500\">Benefit: <span className=\"text-gray-700\">{props.rewards}</span></span>\n </div>\n </div>\n )}\n </div>\n </div>\n );\n}\n\nexport default IndividualConnection;\n","import React, { useState, useEffect, useRef } from 'react';\r\nimport UniversalOnboarding from '../components/UniversalOnboarding.jsx';\r\nimport IndividualConnection from './components/IndividualConnection';\r\nimport onairosLogo from './icons/onairos_logo.png';\r\n\r\n/**\r\n * DataRequestPage Component\r\n * Displays different data requests and handles user interactions\r\n */\r\nconst DataRequestPage = ({ requestData = {}, dataRequester = 'App', proofMode = false, domain = '', appIcon = '' }) => {\r\n const [loading, setLoading] = useState(true);\r\n const [activeModels, setActiveModels] = useState([]);\r\n const [granted, setGranted] = useState(0);\r\n const [allowSubmit, setAllowSubmit] = useState(false);\r\n const [userConnections, setUserConnections] = useState(['instagram', 'youtube', 'email']);\r\n const [selectedRequests, setSelectedRequests] = useState({});\r\n const selectedConnections = useRef([]);\r\n const userSub = useRef(null);\r\n const encryptedUserPin = useRef(null);\r\n\r\n // Update allowSubmit when granted changes\r\n useEffect(() => {\r\n if (granted > 0) {\r\n setAllowSubmit(true);\r\n } else {\r\n setAllowSubmit(false);\r\n }\r\n }, [granted]);\r\n\r\n // Simulate loading data\r\n useEffect(() => {\r\n // In a real implementation, this would fetch active models from a service\r\n const loadData = async () => {\r\n try {\r\n // Simulate API call\r\n await new Promise(resolve => setTimeout(resolve, 1000));\r\n \r\n // Sample active models - this would come from your backend\r\n setActiveModels(['Profile', 'User Memories']);\r\n setLoading(false);\r\n } catch (error) {\r\n console.error('Error loading data:', error);\r\n setLoading(false);\r\n }\r\n };\r\n \r\n loadData();\r\n\r\n // Message handler to receive data from parent window\r\n const handleMessage = (event) => {\r\n if (event.data && event.data.type === 'dataRequest') {\r\n // Process received data\r\n if (event.data.requestData) {\r\n // Update request data state\r\n }\r\n if (event.data.activeModels) {\r\n setActiveModels(event.data.activeModels);\r\n }\r\n if (event.data.userSub) {\r\n userSub.current = event.data.userSub;\r\n }\r\n if (event.data.encryptedUserPin) {\r\n encryptedUserPin.current = event.data.encryptedUserPin;\r\n }\r\n }\r\n };\r\n\r\n // Add message listener\r\n window.addEventListener('message', handleMessage);\r\n \r\n // Clean up listener\r\n return () => {\r\n window.removeEventListener('message', handleMessage);\r\n };\r\n }, []);\r\n\r\n /**\r\n * Reject all data requests\r\n */\r\n async function rejectDataRequest() {\r\n window.top.postMessage({type: 'closeIframe'}, '*');\r\n window.postMessage({type: 'closeIframe'}, '*');\r\n }\r\n\r\n /**\r\n * Send the selected data requests to the parent window\r\n */\r\n async function sendDataRequest() {\r\n if (granted === 0) {\r\n window.close();\r\n return;\r\n } else {\r\n const SignMessage = {\r\n message: 'Confirm ' + dataRequester + ' Data Access',\r\n confirmations: selectedConnections.current\r\n };\r\n \r\n // Send simplified response\r\n try {\r\n window.top.postMessage({\r\n type: 'dataRequestComplete',\r\n approved: selectedConnections.current,\r\n message: SignMessage\r\n }, '*');\r\n \r\n window.postMessage({\r\n type: 'dataRequestComplete',\r\n approved: selectedConnections.current,\r\n message: SignMessage\r\n }, '*');\r\n } catch (error) {\r\n console.error(\"Error sending data request:\", error);\r\n window.close();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Update the granted count\r\n */\r\n function changeGranted(plusMinus) {\r\n setGranted(granted + plusMinus);\r\n }\r\n\r\n /**\r\n * Handle selection of a connection/data request\r\n */\r\n function handleConnectionSelection(dataRequester, modelType, index, title, reward, isSelected) {\r\n const newDate = new Date();\r\n const newConnection = {\r\n requester: dataRequester,\r\n date: newDate.toISOString(),\r\n name: title,\r\n reward: reward,\r\n data: modelType\r\n };\r\n\r\n if (isSelected) {\r\n console.log(`Adding connection: ${JSON.stringify(newConnection)}`);\r\n if (!selectedConnections.current.find(connection => connection.requester === dataRequester && connection.data === modelType)) {\r\n selectedConnections.current.push(newConnection);\r\n }\r\n } else {\r\n console.log(`Removing connection for: ${modelType}`);\r\n selectedConnections.current = selectedConnections.current.filter(\r\n connection => !(connection.requester === dataRequester && connection.data === modelType)\r\n );\r\n }\r\n\r\n console.log('Current selected connections:', selectedConnections.current);\r\n }\r\n\r\n return (\r\n <div className=\"min-h-screen bg-gray-100\">\r\n {loading ? (\r\n <div className=\"flex items-center justify-center min-h-screen\">\r\n <div className=\"animate-spin h-8 w-8 border-2 border-blue-600 rounded-full border-t-transparent\"></div>\r\n </div>\r\n ) : activeModels.length === 0 ? (\r\n <UniversalOnboarding \r\n appIcon=\"https://onairos.sirv.com/Images/OnairosBlack.png\" \r\n appName={dataRequester}\r\n username={localStorage.getItem(\"username\")}\r\n />\r\n ) : (\r\n <div className=\"max-w-md mx-auto p-6 space-y-4\">\r\n <header className=\"bg-white p-6 rounded-xl shadow-md\">\r\n <div className=\"flex items-center justify-between mb-6\">\r\n <div className=\"flex items-center space-x-2\">\r\n <img src={onairosLogo} alt=\"Onairos Logo\" className=\"w-8 h-8\" />\r\n <div className=\"text-gray-400 mx-2\">→</div>\r\n {appIcon ? (\r\n <img src={appIcon} alt={`${dataRequester} Logo`} className=\"w-8 h-8 rounded-full\" />\r\n ) : (\r\n <div className=\"w-8 h-8 bg-gray-200 rounded-full flex items-center justify-center\">\r\n <span className=\"text-gray-600 text-xs font-bold\">{dataRequester.charAt(0)}</span>\r\n </div>\r\n )}\r\n </div>\r\n <h2 className=\"text-lg font-bold text-gray-800\">{dataRequester}</h2>\r\n </div>\r\n \r\n <h1 className=\"text-xl font-bold text-gray-800 mb-4\">Data Access Request</h1>\r\n <p className=\"text-gray-600 mb-6\">Select the data you want to share with {dataRequester}</p>\r\n \r\n <div className=\"flex items-center justify-between gap-4\">\r\n <button\r\n onClick={rejectDataRequest}\r\n 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\"\r\n >\r\n Decline\r\n </button>\r\n <button\r\n disabled={!allowSubmit}\r\n onClick={sendDataRequest}\r\n 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\"\r\n >\r\n Approve {granted > 0 && `(${granted})`}\r\n </button>\r\n </div>\r\n </header>\r\n\r\n <div className=\"space-y-3\">\r\n {/* Only show Profile and User Memories */}\r\n {['Profile', 'User Memories'].map((dataType, index) => {\r\n const key = dataType.toLowerCase().replace(' ', '_');\r\n const product = {\r\n type: dataType,\r\n descriptions: dataType === 'Profile' ? \r\n 'Basic profile information and preferences' : \r\n 'Your personal context and memory data',\r\n reward: dataType === 'Profile' ? \r\n 'Personalized experience' : \r\n 'Contextual understanding of your preferences'\r\n };\r\n \r\n return (\r\n <IndividualConnection\r\n key={key}\r\n active={true}\r\n title={product.type}\r\n id={product}\r\n number={index}\r\n descriptions={product.descriptions}\r\n rewards={product.reward}\r\n size={key}\r\n changeGranted={changeGranted}\r\n onSelectionChange={(isSelected) =>\r\n handleConnectionSelection(dataRequester, key, index, product.type, product.reward, isSelected)\r\n }\r\n />\r\n );\r\n })}\r\n \r\n {/* User Connections Section */}\r\n <div className=\"bg-white p-4 rounded-xl shadow-sm mt-4\">\r\n <h3 className=\"text-sm font-semibold text-gray-700 mb-3\">Your Connected Services</h3>\r\n <div className=\"flex items-center space-x-3\">\r\n {userConnections.map((connection, index) => {\r\n const getConnectionIcon = (type) => {\r\n switch(type) {\r\n case 'instagram':\r\n return (\r\n <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\">\r\n <span className=\"text-white text-xs\">IG</span>\r\n </div>\r\n );\r\n case 'youtube':\r\n return (\r\n <div className=\"w-10 h-10 rounded-full bg-red-600 flex items-center justify-center\">\r\n <span className=\"text-white text-xs\">YT</span>\r\n </div>\r\n );\r\n case 'email':\r\n return (\r\n <div className=\"w-10 h-10 rounded-full bg-blue-500 flex items-center justify-center\">\r\n <span className=\"text-white text-xs\">@</span>\r\n </div>\r\n );\r\n default:\r\n return (\r\n <div className=\"w-10 h-10 rounded-full bg-gray-200 flex items-center justify-center\">\r\n <span className=\"text-gray-600 text-xs\">{type.charAt(0).toUpperCase()}</span>\r\n </div>\r\n );\r\n }\r\n };\r\n \r\n return (\r\n <div key={index} className=\"flex flex-col items-center\">\r\n {getConnectionIcon(connection)}\r\n <span className=\"text-xs text-gray-600 mt-1\">{connection}</span>\r\n </div>\r\n );\r\n })}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n )}\r\n </div>\r\n );\r\n};\r\n\r\nexport default DataRequestPage;\r\n","import React from 'react';\nimport ReactDOM from 'react-dom/client';\nimport DataRequestPage from './DataRequestPage.jsx';\n\n// Global variables to store data from parent window\nlet proofMode = false;\nlet domain = '';\nlet userSub = null;\nlet encryptedUserPin = null;\n\n// Handle messages from the parent window\nwindow.addEventListener('message', (event) => {\n // Verify the sender origin if needed\n // if (event.origin !== 'expected-origin') return;\n \n if (event.data && event.data.source === 'onairosButton') {\n proofMode = event.data.proofMode || false;\n domain = event.data.domain || '';\n userSub = event.data.userSub || null;\n encryptedUserPin = event.data.encryptedUserPin || null;\n \n // Re-render with the new data\n renderApp();\n }\n});\n\n// Notify the parent window that the iframe is ready\nwindow.parent.postMessage({\n source: 'onairosIframe',\n action: 'iframeReady'\n}, '*');\n\n// Function to render the React app\nfunction renderApp() {\n const root = ReactDOM.createRoot(document.getElementById('root'));\n root.render(\n <DataRequestPage \n proofMode={proofMode}\n domain={domain}\n userSub={userSub}\n encryptedUserPin={encryptedUserPin}\n />\n );\n}\n\n// Initial render\nrenderApp();\n"],"names":["root","factory","exports","module","require","define","amd","this","__WEBPACK_EXTERNAL_MODULE__639__","__WEBPACK_EXTERNAL_MODULE__346__","m","createRoot","hydrateRoot","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","n","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","get","g","globalThis","Function","e","window","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","scriptUrl","importScripts","location","document","currentScript","src","scripts","getElementsByTagName","length","i","Error","replace","p","platforms","name","icon","color","connector","sdkConfig","apiKey","process","env","REACT_APP_ONAIROS_API_KEY","baseUrl","REACT_APP_ONAIROS_BASE_URL","sdkType","enableHealthMonitoring","enableAutoRefresh","enableConnectionValidation","UniversalOnboarding","_ref","onComplete","appIcon","appName","connectedAccounts","setConnectedAccounts","useState","isConnecting","setIsConnecting","connectingPlatform","setConnectingPlatform","connectionErrors","setConnectionErrors","connectionHealth","setConnectionHealth","healthScore","setHealthScore","useEffect","handleOAuthReturn","platform","localStorage","getItem","console","log","concat","removeItem","prev","_objectSpread","connectToPlatform","async","platformName","find","error","_localStorage$getItem","username","email","authorizeUrl","response","fetch","method","headers","body","JSON","stringify","session","ok","status","statusText","responseData","json","possibleKeys","oauthUrl","usedKey","keys","join","test","navigator","userAgent","innerWidth","setItem","href","popup","open","checkInterval","setInterval","closed","clearInterval","successFlag","errorFlag","timestamp","isRecentSignal","Date","now","parseInt","setTimeout","close","message","connectedCount","values","filter","Boolean","React","className","alt","fill","stroke","viewBox","strokeLinecap","strokeLinejoin","strokeWidth","map","isConnected","isCurrentlyConnecting","hasError","isDisabled","onClick","handleToggle","fillRule","clipRule","handleContinue","connected","entries","_ref2","_ref3","totalConnections","sdkVersion","enhancedFeatures","healthMonitoring","autoRefresh","connectionValidation","disabled","props","type","id","number","active","onChange","checked","target","title","setSelected","changeGranted","onSelectionChange","xmlns","selected","getDataTypeIcon","Box","isSelected","descriptions","rewards","requestData","dataRequester","proofMode","domain","loading","setLoading","activeModels","setActiveModels","granted","setGranted","allowSubmit","setAllowSubmit","userConnections","setUserConnections","selectedRequests","setSelectedRequests","selectedConnections","useRef","userSub","encryptedUserPin","plusMinus","Promise","resolve","loadData","handleMessage","event","data","current","addEventListener","removeEventListener","onairosLogo","charAt","top","postMessage","SignMessage","confirmations","approved","dataType","index","toLowerCase","product","reward","IndividualConnection","size","modelType","newDate","newConnection","requester","date","toISOString","connection","push","handleConnectionSelection","toUpperCase","getConnectionIcon","renderApp","ReactDOM","getElementById","render","DataRequestPage","source","parent","action"],"sourceRoot":""}
|