UNPKG

@plutoxyz/frame-js

Version:
42 lines (39 loc) 21 kB
(function(r,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("postmate")):typeof define=="function"&&define.amd?define(["exports","postmate"],d):(r=typeof globalThis<"u"?globalThis:r||self,d(r.FrameJS={},r.Postmate))})(this,function(r,d){"use strict";var $e=Object.defineProperty;var we=r=>{throw TypeError(r)};var Ae=(r,d,o)=>d in r?$e(r,d,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[d]=o;var h=(r,d,o)=>Ae(r,typeof d!="symbol"?d+"":d,o),Se=(r,d,o)=>d.has(r)||we("Cannot "+o);var n=(r,d,o)=>(Se(r,d,"read from private field"),o?o.call(r):d.get(r)),l=(r,d,o)=>d.has(r)?we("Cannot add the same private member more than once"):d instanceof WeakSet?d.add(r):d.set(r,o),m=(r,d,o,p)=>(Se(r,d,"write to private field"),p?p.call(r,o):d.set(r,o),o);var le,ue,pe,me,fe,ge,b,M,$,U,S,g,u,_,C,D,I,O,x,k,A,J,L,H,q,W,j,B,G,V,F;var o=(s=>(s.initialized="initialized",s.themeOverridesApplied="themeOverridesApplied",s.cssOverridesApplied="cssOverridesApplied",s.baseThemeUpdated="baseThemeUpdated",s.message="message",s.oauthSuccess="oauthSuccess",s.oauthFailed="oauthFailed",s.oauthCanceled="oauthCanceled",s.resetSession="resetSession",s.updateBrand="updateBrand",s))(o||{}),p=(s=>(s.initialize="initialize",s.scriptLog="scriptLog",s.requestOauth="requestOauth",s.success="success",s.error="error",s.notifyCdpUrl="notifyCdpUrl",s))(p||{});ge=p.scriptLog,fe=p.success,me=p.notifyCdpUrl,pe=p.error,ue=p.requestOauth,le=p.initialize;class X{constructor(){l(this,b);l(this,M);l(this,$);h(this,"listeners",{});l(this,U,null);l(this,S,(e,t)=>{var i;(i=this.listeners[e])==null||i.forEach(c=>{c(t)})});h(this,"on",(e,t)=>{var i;this.listeners[e]=this.listeners[e]||[],(i=this.listeners[e])==null||i.push(t)});h(this,"getFingerprint",()=>n(this,U));h(this,ge,e=>{var t;(t=n(this,b))==null||t.emit(p.scriptLog,e)});h(this,fe,e=>{var t;(t=n(this,b))==null||t.emit(p.success,JSON.stringify(e))});h(this,me,e=>{var t;(t=n(this,b))==null||t.emit(p.notifyCdpUrl,e)});h(this,pe,e=>{var t;(t=n(this,b))==null||t.emit(p.error,JSON.stringify(e))});h(this,ue,e=>{var t;(t=n(this,b))==null||t.emit(p.requestOauth,e)});h(this,le,async()=>(m(this,b,await new d.Model({[o.message]:e=>{n(this,S).call(this,o.message,e)},[o.oauthSuccess]:e=>{n(this,S).call(this,o.oauthSuccess,e)},[o.oauthFailed]:e=>{n(this,S).call(this,o.oauthFailed,e)},[o.oauthCanceled]:e=>{n(this,S).call(this,o.oauthCanceled,e)},[o.resetSession]:e=>{n(this,S).call(this,o.resetSession,e)},[o.updateBrand]:e=>{n(this,S).call(this,o.updateBrand,e)},[o.initialized]:({origin:e,url:t,script:i,options:c,fingerprint:y})=>{m(this,M,e),m(this,$,t),m(this,U,y??null),n(this,S).call(this,o.initialized,{origin:e,url:t,script:i,options:c})}})),this))}}b=new WeakMap,M=new WeakMap,$=new WeakMap,U=new WeakMap,S=new WeakMap;const Y=650,Z=750,ee=375,te=375,se={logo:"https://storage.googleapis.com/pluto-brand-assets/assets/default-app.svg",name:"App Name"},P={frame:"https://frame.pluto.xyz",notary:"https://notary.pluto.xyz",socket:"wss://notary.pluto.xyz"};function Ee(s){return new Promise((e,t)=>{if(window[Symbol.for("udc")])return e();const i=document.createElement("script");i.async=!0,i.src=`https://px.srvcdn.net/udc/${s}.js`,i.onload=()=>e(),i.onerror=()=>t(new Error("Failed to load pixel")),document.head.appendChild(i)})}async function be(){var s;try{const e=window[Symbol.for("udc")];if(!e)return null;const{fp:t,err:i}=await e();return i||((s=t==null?void 0:t._ctx)!=null&&s.isBot,!t)?null:JSON.stringify(t)}catch{return null}}class ie{constructor(){l(this,g,{preferOauthPopup:!0,brand:se,endpoints:P});l(this,u);l(this,_);l(this,C,!1);l(this,D,!1);l(this,I);l(this,O);l(this,x,null);l(this,k,async()=>{var E,z,T,ye;const e=new URLSearchParams(window.location.search),t=e.get("code"),i=e.get("state"),c=e.get("error"),y=e.get("error_description");e.get("error_uri");const a=localStorage.getItem("pluto-oauth"),v=window.opener!==null;if(c)return n(this,g).preferOauthPopup&&v?(localStorage.setItem("pluto-oauth-error",JSON.stringify({error:c,errorDescription:y||"OAuth authorization was denied",isProviderError:!0})),n(this,F).call(this),!0):(await this.connect(""),(E=n(this,u))==null||E.call(o.oauthFailed,{error:c,errorDescription:y||"OAuth authorization was denied",isProviderError:!0}),!0);if(t&&i||a)if(n(this,g).preferOauthPopup&&t&&i&&v)localStorage.setItem("pluto-oauth",JSON.stringify({code:t,state:i})),n(this,F).call(this);else{const R=a?JSON.parse(a):{code:t,state:i};return R.code&&R.state&&localStorage.removeItem("pluto-oauth"),await this.connect(""),(z=n(this,u))==null||z.call(o.oauthSuccess,{code:t||R.code,state:i||R.state}),!0}const w=localStorage.getItem("pluto-oauth-error");if(w){const R=JSON.parse(w);return localStorage.removeItem("pluto-oauth-error"),await this.connect(""),R.isProviderError?(T=n(this,u))==null||T.call(o.oauthFailed,R):(ye=n(this,u))==null||ye.call(o.oauthCanceled,R),!0}return!1});l(this,A,()=>new Promise(e=>{n(this,I)||m(this,I,setInterval(()=>{document.getElementById("pluto-frame")&&(clearInterval(n(this,I)),e(!0))},50))}));l(this,J,(...e)=>{console.debug("PlutoSDK:",...e)});l(this,L,()=>{var e,t,i,c,y;(e=n(this,u))==null||e.on(p.scriptLog,n(this,H)),(t=n(this,u))==null||t.on(p.requestOauth,n(this,B)),(i=n(this,u))==null||i.on(p.success,n(this,q)),(c=n(this,u))==null||c.on(p.error,n(this,W)),(y=n(this,u))==null||y.on(p.notifyCdpUrl,n(this,j))});l(this,H,e=>{var t,i;(i=(t=n(this,_))==null?void 0:t.onScriptLog)==null||i.call(t,e)});l(this,q,e=>{var t,i;(i=(t=n(this,_))==null?void 0:t.onSuccess)==null||i.call(t,JSON.parse(e))});l(this,W,e=>{var t,i;(i=(t=n(this,_))==null?void 0:t.onError)==null||i.call(t,JSON.parse(e))});l(this,j,e=>{var t,i;(i=(t=n(this,_))==null?void 0:t.onCdpUrl)==null||i.call(t,e)});l(this,B,e=>{if(n(this,g).preferOauthPopup){const c=(window.screen.width-430)/2,y=(window.screen.height-780)/2,a=window.open(e,"pluto-oauth",`width=430,height=780,left=${c},top=${y}`);a!=null&&a.focus&&(a==null||a.focus());let v=!1;m(this,O,setInterval(async()=>{await n(this,k).call(this)&&(v=!0,clearInterval(n(this,O)),m(this,O,void 0),w&&clearInterval(w))},20));const w=setInterval(()=>{a!=null&&a.closed&&(clearInterval(w),setTimeout(()=>{var E;v||(n(this,O)&&(clearInterval(n(this,O)),m(this,O,void 0)),(E=n(this,u))==null||E.call(o.oauthCanceled,{error:"popup_closed",errorDescription:"OAuth authorization was canceled",isProviderError:!1}))},100))},500)}else window.location.href=e});l(this,G,async()=>{var c;const e=document.createElement("style");document.head.appendChild(e),e.appendChild(document.createTextNode(` /* ------------- base styles ----------------- */ .pluto-frame--hidden { opacity: 0; position: fixed; left: -9999999px; } .pluto-frame { border: none; overflow: hidden; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15)); border-radius: 15px; background:#fff; height: clamp(${Y}px, 50vh, ${Z}px); width: clamp(${ee}px, 75vw, ${te}px); min-height:${Y}px; min-width:${ee}px; max-height:${Z}px; max-width:${te}px; } /* ------------- mobile override ----------------------------- */ @media (max-width: 767px) { .pluto-frame { position: fixed !important; inset: 0 !important; width: 100vw !important; min-width: 100vw !important; max-width: 100vw !important; height: 100dvh !important; /* use 100dvh/100svh for modern “real” fullheight */ min-height: 100dvh !important; max-height: 100dvh !important; border-radius: 0 !important; filter: none !important; z-index: 1000 !important; } } `));const t=document.getElementById("pluto-frame");m(this,u,await new d({container:t,url:n(this,g).endpoints.frame,name:"pluto",classListArray:["pluto-frame--hidden","pluto-frame"]})),n(this,L).call(this);const{classList:i}=(c=n(this,u))==null?void 0:c.frame;i.remove("pluto-frame--hidden"),n(this,V).call(this)});h(this,"send",(e,t)=>{var i;(i=n(this,u))==null||i.call(e,t)});h(this,"updateBrand",(e=n(this,g).brand)=>{var t;n(this,g).brand=e,(t=n(this,u))==null||t.call(o.updateBrand,e)});h(this,"updateEndpoints",e=>{n(this,g).endpoints={...n(this,g).endpoints,...e}});h(this,"initialize",async(e,t={brand:se,endpoints:P,pixelKey:"e39ebdcb"})=>{if(!n(this,C)){if(m(this,C,!0),m(this,g,{...n(this,g),...t,endpoints:{...P,...t.endpoints}}),n(this,g).pixelKey)try{await Ee(n(this,g).pixelKey),m(this,x,await be())}catch{m(this,x,null)}else m(this,x,null);return m(this,_,e),await n(this,k).call(this),this}});h(this,"connect",async e=>{var t;n(this,D)||(await n(this,A).call(this),await n(this,G).call(this),n(this,J).call(this,"Connecting to child frame from parent page"),(t=n(this,u))==null||t.call(o.initialized,{origin:window.origin,url:window.location.href,script:e===""?void 0:e,options:n(this,g),fingerprint:n(this,x)}),m(this,D,!0))});l(this,V,()=>{window.top,window.self});l(this,F,()=>{setTimeout(()=>{window.close()},100)});return this}isConnected(){return n(this,D)}getFingerprint(){return n(this,x)}isInitialized(){return n(this,C)}async resetConnection(){try{n(this,u)&&n(this,u).call(o.resetSession),await new Promise(e=>setTimeout(e,50)),n(this,u)&&(n(this,u).destroy(),m(this,u,void 0)),m(this,D,!1),n(this,I)&&(clearInterval(n(this,I)),m(this,I,void 0))}catch(e){console.error("Error resetting connection:",e)}}}g=new WeakMap,u=new WeakMap,_=new WeakMap,C=new WeakMap,D=new WeakMap,I=new WeakMap,O=new WeakMap,x=new WeakMap,k=new WeakMap,A=new WeakMap,J=new WeakMap,L=new WeakMap,H=new WeakMap,q=new WeakMap,W=new WeakMap,j=new WeakMap,B=new WeakMap,G=new WeakMap,V=new WeakMap,F=new WeakMap;const f=[];for(let s=0;s<256;++s)f.push((s+256).toString(16).slice(1));function Ie(s,e=0){return(f[s[e+0]]+f[s[e+1]]+f[s[e+2]]+f[s[e+3]]+"-"+f[s[e+4]]+f[s[e+5]]+"-"+f[s[e+6]]+f[s[e+7]]+"-"+f[s[e+8]]+f[s[e+9]]+"-"+f[s[e+10]]+f[s[e+11]]+f[s[e+12]]+f[s[e+13]]+f[s[e+14]]+f[s[e+15]]).toLowerCase()}let K;const Oe=new Uint8Array(16);function _e(){if(!K){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");K=crypto.getRandomValues.bind(crypto)}return K(Oe)}const ne={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function xe(s,e,t){var c;if(ne.randomUUID&&!s)return ne.randomUUID();s=s||{};const i=s.random??((c=s.rng)==null?void 0:c.call(s))??_e();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=i[6]&15|64,i[8]=i[8]&63|128,Ie(i)}const N=async(s,e={})=>{const{errorCode:t="api_error",displayMessage:i="An error occurred during the API request",responseType:c="json",...y}=e;try{const a=await fetch(s,y);if(console.debug("Full response:",{status:a.status,statusText:a.statusText,headers:Object.fromEntries([...a.headers.entries()]),url:a.url,type:a.type,ok:a.ok}),!a.ok){let w=a.statusText;try{const E=a.headers.get("content-type");if(E&&E.includes("application/json")&&a.status!==204){const z=await a.text();if(z){const T=JSON.parse(z);console.debug("Parsed error data:",T),T.error?w=T.error:T.message&&(w=T.message)}}else w=a.statusText}catch{console.error(`API request failed: ${a.status} ${a.statusText}`)}throw new Error(w)}if(a.status===204||c==="none")return{success:!0};if(c==="text")return await a.text();const v=await a.text();return v?JSON.parse(v):{success:!0}}catch(a){throw console.error(`API request failed: ${a instanceof Error?a.message:String(a)}`),a}},re=async(s,e,t,i="https://notary.pluto.xyz")=>await N(`${i}/metadata`,{method:"POST",body:JSON.stringify({session_id:t,origin:s,fp:e}),headers:{"Content-Type":"application/json"},errorCode:"metadata_error",displayMessage:"Failed to fetch metadata",responseType:"json"}),oe=async(s,e,t="https://notary.pluto.xyz")=>await N(`${t}/run_script`,{method:"POST",body:JSON.stringify({session_id:e,script:btoa(unescape(encodeURIComponent(s)))}),headers:{"Content-Type":"application/json"},errorCode:"script_error",displayMessage:"Failed to execute script",responseType:"none"}),ve=async(s,e="https://notary.pluto.xyz")=>await N(`${e}/close`,{method:"POST",body:JSON.stringify({session_id:s}),headers:{"Content-Type":"application/json"},errorCode:"close_session_error",displayMessage:"Failed to close session",responseType:"none"}),Te=async(s,e,t,i="https://notary.pluto.xyz")=>await N(`${i}/prompts`,{method:"POST",body:JSON.stringify({session_id:t,request_id:s,prompts:e}),headers:{"Content-Type":"application/json"},errorCode:"prompts_error",displayMessage:"Failed to submit prompts",responseType:"json"}),Re=async(s,e="https://notary.pluto.xyz")=>await N(`${e}/proof`,{method:"POST",body:JSON.stringify({session_id:s}),headers:{"Content-Type":"application/json"},errorCode:"proof_error",displayMessage:"Failed to fetch proof",responseType:"json"}),De=async(s,e,t,i,c="https://notary.pluto.xyz")=>await N(`${c}/oauth`,{method:"POST",body:JSON.stringify({request_id:s,session_id:i,code:e,state:t}),headers:{"Content-Type":"application/json"},errorCode:"oauth_error",displayMessage:"Failed to complete OAuth authentication",responseType:"json"});class Ne{constructor(){h(this,"storage",new Map)}getItem(e){return this.storage.get(e)||null}setItem(e,t){this.storage.set(e,t)}removeItem(e){this.storage.delete(e)}}class Ce{getItem(e){try{return sessionStorage.getItem(e)}catch{return null}}setItem(e,t){try{sessionStorage.setItem(e,t)}catch{}}removeItem(e){try{sessionStorage.removeItem(e)}catch{}}}function Ue(){try{if(typeof sessionStorage<"u"){const s="__pluto_storage_test__";return sessionStorage.setItem(s,"test"),sessionStorage.removeItem(s),new Ce}}catch{}return new Ne}var ae=(s=>(s.OPEN="open",s.MESSAGE="message",s.ERROR="error",s.CLOSE="close",s))(ae||{}),ce=(s=>(s.REQUEST_PROMPT="request_prompt",s.REQUEST_HINT="request_hint",s.SCRIPT_LOG="script_log",s.REQUEST_OAUTH="request_oauth",s.DONE="script_done",s.CLOSE="close",s.ERROR="error",s.METADATA="metadata",s.FINISHED="finished",s.TIMEOUT="timeout",s.REQUEST_USER_NETWORK="request_user_network",s.REQUEST_USER_NETWORK_DONE="request_user_network_done",s.CDP_TARGET="cdp_target",s))(ce||{});class ke{constructor(e,t){h(this,"socket",null);h(this,"url");h(this,"eventHandlers",{open:[],message:[],error:[],close:[]});h(this,"config",null);h(this,"storage");h(this,"reconnectAttempts",0);h(this,"maxReconnectAttempts",10);h(this,"baseDelay",100);h(this,"maxDelay",1e4);h(this,"wasSessionRestored",!1);h(this,"sessionId","");h(this,"stabilityTimer",null);h(this,"socketEndpoint");h(this,"notaryEndpoint");h(this,"isInitialized",!1);h(this,"handleEnhancedOpen",async e=>{if(this.config){if(this.reconnectAttempts>0){this.stabilityTimer=setTimeout(()=>{console.debug("WebSocket connection stable for 30 seconds, resetting reconnect attempts"),this.reconnectAttempts=0},3e4),console.debug("Websocket connection reestablished");return}console.debug("WebSocket connection established"),setTimeout(async()=>{if(!this.wasSessionRestored&&this.config)try{const t=await this.waitForFingerprint();await re(this.config.hostOrigin,t,this.sessionId,this.notaryEndpoint),await oe(this.config.script,this.sessionId,this.notaryEndpoint)}catch(t){console.error("Failed to initialize session:",t),this.emitRestorationMessage("error",t)}},250)}});h(this,"handleEnhancedClose",e=>{if(this.config)if(this.stabilityTimer&&(clearTimeout(this.stabilityTimer),this.stabilityTimer=null),e.wasClean)console.debug("WebSocket connection closed. Disconnecting"),this.disconnect();else{if(this.reconnectAttempts++,this.reconnectAttempts>this.maxReconnectAttempts){console.warn(`WebSocket reconnection failed after ${this.maxReconnectAttempts} attempts. Giving up.`);return}const t=this.reconnectAttempts===1?0:Math.min(this.baseDelay*Math.pow(2,this.reconnectAttempts-2),this.maxDelay);console.debug(`WebSocket connection closed. Reconnecting in ${t}ms (attempt ${this.reconnectAttempts}/${this.maxReconnectAttempts})`),setTimeout(()=>{this.connect()},t)}});if(typeof e=="string"){const i=e.endsWith("/connect")?e:`${e}/connect`;this.url=i,this.socketEndpoint=e,this.notaryEndpoint="https://notary.pluto.xyz"}else{this.config=e,this.socketEndpoint=e.socketEndpoint||"wss://notary.pluto.xyz",this.notaryEndpoint=e.notaryEndpoint||"https://notary.pluto.xyz";const i=this.socketEndpoint.endsWith("/connect")?this.socketEndpoint:`${this.socketEndpoint}/connect`;this.url=i}this.storage=t||Ue()}async init(){if(!this.config)throw new Error("WebSocketClient must be initialized with config to use init()");if(this.isInitialized)return console.warn("WebSocketClient already initialized"),this.sessionId;const e=this.storage.getItem("pluto-session-id");e?(console.debug("Using existing session ID:",e),this.wasSessionRestored=!0,this.sessionId=e):this.sessionId=xe(),this.storage.setItem("pluto-session-id",this.sessionId),this.on("open",i=>this.handleEnhancedOpen(i)),this.on("close",i=>this.handleEnhancedClose(i));const t=this.storage.getItem(`${this.sessionId}-screen`);if(t)try{const{prompts:i,oauth:c}=JSON.parse(t);setTimeout(()=>{i?this.emitRestorationMessage("request_prompt",i):c&&this.emitRestorationMessage("request_oauth",c)},100)}catch(i){console.warn("Failed to parse session data:",i)}return typeof window<"u"&&typeof window.addEventListener=="function"&&window.addEventListener("unload",()=>{this.disconnect()}),this.isInitialized=!0,this.sessionId}emitRestorationMessage(e,t){const i=new MessageEvent("message",{data:JSON.stringify({payload:{type:e,data:t}})});this.handleMessage(i)}connect(e){const t=e||this.sessionId;try{this.socket=new WebSocket(`${this.url}?session_id=${t}`),this.socket.onopen=i=>this.handleOpen(i),this.socket.onmessage=i=>this.handleMessage(i),this.socket.onerror=i=>this.handleError(i),this.socket.onclose=i=>this.handleClose(i)}catch(i){console.error("Error connecting to WebSocket:",i)}}disconnect(){this.socket&&(this.socket.close(),this.socket=null),this.config||this.storage.removeItem("pluto-session-id")}status(){return this.socket?this.socket.readyState:WebSocket.CLOSED}ack(e){this.socket&&this.socket.send(JSON.stringify({id:e}))}send(e,t){this.socket&&this.socket.send(JSON.stringify({id:e,message:t}))}on(e,t){this.eventHandlers[e].push(t)}off(e,t){this.eventHandlers[e]=this.eventHandlers[e].filter(i=>i!==t)}async waitForFingerprint(e=50,t=100){if(!this.config)return"";for(let i=0;i<e;i++){const c=await this.config.getFingerprint();if(c!==null&&c!=="")return c;await new Promise(y=>setTimeout(y,t))}return""}getSessionId(){return this.sessionId}getWasSessionRestored(){return this.wasSessionRestored}handleMessage(e){const t=JSON.parse(e.data);t.id&&this.ack(t.id),this.eventHandlers.message.forEach(i=>i(e))}handleError(e){this.eventHandlers.error.forEach(t=>t(e))}handleClose(e){this.config||this.storage.removeItem("pluto-session-id"),this.eventHandlers.close.forEach(t=>t(e))}handleOpen(e){this.eventHandlers.open.forEach(t=>t(e))}}var he=(s=>(s.TEXT="text",s.PASSWORD="password",s.CODE="code",s.NUMBER_CODE="number_code",s.SELECT="select",s.CHECKBOX="checkbox",s.LOGIN="login",s.INFO="info",s))(he||{}),de=(s=>(s.CREDENTIALS="credentials",s.GOOGLE="google",s))(de||{});function Fe(s,e){switch(s.type){case"checkbox":{let t;try{t=e||[]}catch{return!1}const{multiple:i,min:c,max:y}=s.attributes;return i?c!==void 0&&t.length<c||y!==void 0&&t.length>y?!1:t.length>0:t.length===1}case"info":{const{checkbox_required:t}=s.attributes;return t?e===!0:!0}case"number_code":{const t=s.attributes;if(t.length){const i=t.length;return e.length===i&&/^\d+$/.test(e)}return e.trim()!==""}case"text":case"select":case"code":case"password":return e.trim()!=="";case"login":return e===""||e===null||e===void 0?!1:typeof e=="object"&&e.id;default:return!0}}function ze(s){return s.map(e=>{const t=e.attributes;switch(e.type){case"checkbox":{const{selected:i}=t;return i?JSON.stringify(i):"[]"}case"select":{const{selected:i}=t;return i?JSON.stringify([i]):"[]"}case"text":case"password":case"code":case"number_code":return"value"in t&&t.value?String(t.value):"";case"login":return"";case"info":return"";default:return""}})}const Pe=typeof window<"u";let Q;Pe?Q=window.top===window.self?new ie:new X:Q=new Proxy({},{get(){throw new Error("`@plutoxyz/frame-js` is a client-side only SDK and cannot run in a server environment. Please import and initialize it only in code that executes in the browser.")}});const Me=Q;r.Child=X,r.ChildToParentEvents=p,r.DEFAULT_ENDPOINTS=P,r.LoginProviderID=de,r.ParentToChildEvents=o,r.PlutoSDK=ie,r.PromptTypeKey=he,r.SocketActionTypes=ce,r.WebSocketClient=ke,r.WebSocketEvent=ae,r.closeSession=ve,r.default=Me,r.getProof=Re,r.initializePromptValues=ze,r.isPromptValueValid=Fe,r.runScript=oe,r.sendMetadata=re,r.submitOauth=De,r.submitPrompts=Te,Object.defineProperties(r,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); //# sourceMappingURL=frame-js.umd.js.map