@magic-sdk/react-native-expo 30.0.6-canary.877.14347606304.0 → 30.0.6-canary.877.14349807003.0

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/cjs/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var Te=Object.create;var D=Object.defineProperty,Ne=Object.defineProperties,De=Object.getOwnPropertyDescriptor,Ce=Object.getOwnPropertyDescriptors,Ve=Object.getOwnPropertyNames,he=Object.getOwnPropertySymbols,Ge=Object.getPrototypeOf,me=Object.prototype.hasOwnProperty,ke=Object.prototype.propertyIsEnumerable;var pe=(n,a,o)=>a in n?D(n,a,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[a]=o,oe=(n,a)=>{for(var o in a||(a={}))me.call(a,o)&&pe(n,o,a[o]);if(he)for(var o of he(a))ke.call(a,o)&&pe(n,o,a[o]);return n},ie=(n,a)=>Ne(n,Ce(a));var We=(n,a)=>()=>(a||n((a={exports:{}}).exports,a),a.exports),je=(n,a)=>{for(var o in a)D(n,o,{get:a[o],enumerable:!0})},F=(n,a,o,h)=>{if(a&&typeof a=="object"||typeof a=="function")for(let c of Ve(a))!me.call(n,c)&&c!==o&&D(n,c,{get:()=>a[c],enumerable:!(h=De(a,c))||h.enumerable});return n},l=(n,a,o)=>(F(n,a,"default"),o&&F(o,a,"default")),I=(n,a,o)=>(o=n!=null?Te(Ge(n)):{},F(a||!n||!n.__esModule?D(o,"default",{value:n,enumerable:!0}):o,n)),Fe=n=>F(D({},"__esModule",{value:!0}),n);var M=(n,a,o)=>new Promise((h,c)=>{var d=S=>{try{L(o.next(S))}catch(v){c(v)}},p=S=>{try{L(o.throw(S))}catch(v){c(v)}},L=S=>S.done?h(S.value):Promise.resolve(S.value).then(d,p);L((o=o.apply(n,a)).next())});var ve=We((xe,se)=>{var ae=function(n){"use strict";var a=Object.prototype,o=a.hasOwnProperty,h=Object.defineProperty||function(t,e,r){t[e]=r.value},c,d=typeof Symbol=="function"?Symbol:{},p=d.iterator||"@@iterator",L=d.asyncIterator||"@@asyncIterator",S=d.toStringTag||"@@toStringTag";function v(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{v({},"")}catch{v=function(e,r,s){return e[r]=s}}function V(t,e,r,s){var i=e&&e.prototype instanceof X?e:X,f=Object.create(i.prototype),g=new te(s||[]);return h(f,"_invoke",{value:Ae(t,r,g)}),f}n.wrap=V;function P(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(s){return{type:"throw",arg:s}}}var G="suspendedStart",H="suspendedYield",y="executing",T="completed",E={};function X(){}function k(){}function O(){}var Q={};v(Q,p,function(){return this});var Z=Object.getPrototypeOf,W=Z&&Z(Z(re([])));W&&W!==a&&o.call(W,p)&&(Q=W);var A=O.prototype=X.prototype=Object.create(Q);k.prototype=O,h(A,"constructor",{value:O,configurable:!0}),h(O,"constructor",{value:k,configurable:!0}),k.displayName=v(O,S,"GeneratorFunction");function ue(t){["next","throw","return"].forEach(function(e){v(t,e,function(r){return this._invoke(e,r)})})}n.isGeneratorFunction=function(t){var e=typeof t=="function"&&t.constructor;return e?e===k||(e.displayName||e.name)==="GeneratorFunction":!1},n.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,O):(t.__proto__=O,v(t,S,"GeneratorFunction")),t.prototype=Object.create(A),t},n.awrap=function(t){return{__await:t}};function j(t,e){function r(f,g,w,_){var b=P(t[f],t,g);if(b.type==="throw")_(b.arg);else{var ne=b.arg,N=ne.value;return N&&typeof N=="object"&&o.call(N,"__await")?e.resolve(N.__await).then(function(R){r("next",R,w,_)},function(R){r("throw",R,w,_)}):e.resolve(N).then(function(R){ne.value=R,w(ne)},function(R){return r("throw",R,w,_)})}}var s;function i(f,g){function w(){return new e(function(_,b){r(f,g,_,b)})}return s=s?s.then(w,w):w()}h(this,"_invoke",{value:i})}ue(j.prototype),v(j.prototype,L,function(){return this}),n.AsyncIterator=j,n.async=function(t,e,r,s,i){i===void 0&&(i=Promise);var f=new j(V(t,e,r,s),i);return n.isGeneratorFunction(e)?f:f.next().then(function(g){return g.done?g.value:f.next()})};function Ae(t,e,r){var s=G;return function(f,g){if(s===y)throw new Error("Generator is already running");if(s===T){if(f==="throw")throw g;return Pe()}for(r.method=f,r.arg=g;;){var w=r.delegate;if(w){var _=le(w,r);if(_){if(_===E)continue;return _}}if(r.method==="next")r.sent=r._sent=r.arg;else if(r.method==="throw"){if(s===G)throw s=T,r.arg;r.dispatchException(r.arg)}else r.method==="return"&&r.abrupt("return",r.arg);s=y;var b=P(t,e,r);if(b.type==="normal"){if(s=r.done?T:H,b.arg===E)continue;return{value:b.arg,done:r.done}}else b.type==="throw"&&(s=T,r.method="throw",r.arg=b.arg)}}}function le(t,e){var r=e.method,s=t.iterator[r];if(s===c)return e.delegate=null,r==="throw"&&t.iterator.return&&(e.method="return",e.arg=c,le(t,e),e.method==="throw")||r!=="return"&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),E;var i=P(s,t.iterator,e.arg);if(i.type==="throw")return e.method="throw",e.arg=i.arg,e.delegate=null,E;var f=i.arg;if(!f)return e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,E;if(f.done)e[t.resultName]=f.value,e.next=t.nextLoc,e.method!=="return"&&(e.method="next",e.arg=c);else return f;return e.delegate=null,E}ue(A),v(A,S,"Generator"),v(A,p,function(){return this}),v(A,"toString",function(){return"[object Generator]"});function Me(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function ee(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function te(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(Me,this),this.reset(!0)}n.keys=function(t){var e=Object(t),r=[];for(var s in e)r.push(s);return r.reverse(),function i(){for(;r.length;){var f=r.pop();if(f in e)return i.value=f,i.done=!1,i}return i.done=!0,i}};function re(t){if(t||t===""){var e=t[p];if(e)return e.call(t);if(typeof t.next=="function")return t;if(!isNaN(t.length)){var r=-1,s=function i(){for(;++r<t.length;)if(o.call(t,r))return i.value=t[r],i.done=!1,i;return i.value=c,i.done=!0,i};return s.next=s}}throw new TypeError(typeof t+" is not iterable")}n.values=re;function Pe(){return{value:c,done:!0}}return te.prototype={constructor:te,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=c,this.done=!1,this.delegate=null,this.method="next",this.arg=c,this.tryEntries.forEach(ee),!t)for(var e in this)e.charAt(0)==="t"&&o.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=c)},stop:function(){this.done=!0;var t=this.tryEntries[0],e=t.completion;if(e.type==="throw")throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(_,b){return f.type="throw",f.arg=t,e.next=_,b&&(e.method="next",e.arg=c),!!b}for(var s=this.tryEntries.length-1;s>=0;--s){var i=this.tryEntries[s],f=i.completion;if(i.tryLoc==="root")return r("end");if(i.tryLoc<=this.prev){var g=o.call(i,"catchLoc"),w=o.call(i,"finallyLoc");if(g&&w){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(g){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else if(w){if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var s=this.tryEntries[r];if(s.tryLoc<=this.prev&&o.call(s,"finallyLoc")&&this.prev<s.finallyLoc){var i=s;break}}i&&(t==="break"||t==="continue")&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var f=i?i.completion:{};return f.type=t,f.arg=e,i?(this.method="next",this.next=i.finallyLoc,E):this.complete(f)},complete:function(t,e){if(t.type==="throw")throw t.arg;return t.type==="break"||t.type==="continue"?this.next=t.arg:t.type==="return"?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):t.type==="normal"&&e&&(this.next=e),E},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),ee(r),E}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var s=r.completion;if(s.type==="throw"){var i=s.arg;ee(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:re(t),resultName:e,nextLoc:r},this.method==="next"&&(this.arg=c),E}},n}(typeof se=="object"?se.exports:{});try{regeneratorRuntime=ae}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=ae:Function("r","regeneratorRuntime = r")(ae)}});var u={};je(u,{Magic:()=>$e,useInternetConnection:()=>B});module.exports=Fe(u);var et=I(ve()),_e=require("@magic-sdk/provider"),Ke=I(require("process")),Le=I(require("localforage")),z=require("whatwg-url"),J=require("buffer"),Ie=I(require("lodash")),Oe=I(require("expo-application")),Re=require("@aveq-research/localforage-asyncstorage-driver"),fe=I(require("localforage-driver-memory"));var m=I(require("react")),$=require("react-native"),we=require("react-native-webview"),be=require("react-native-safe-area-context"),q=require("@magic-sdk/provider"),Se=require("lodash"),C=I(require("@react-native-async-storage/async-storage")),ce=require("react-native-event-listeners");var U=require("react"),de=I(require("@react-native-community/netinfo")),B=()=>{let[n,a]=(0,U.useState)(!0);return(0,U.useEffect)(()=>{let o=h=>{a(!!h.isConnected)};return de.default.addEventListener(o)},[]),n};var ye="MAGIC_PAYLOAD_FLAG_TYPED_ARRAY",Ue="open_in_device_browser",Be="#FFFFFF",ge="msg_posted_after_inactivity_event",Y="lastMessageTime";function Ye(){return $.StyleSheet.create({"magic-webview":{flex:1,backgroundColor:"transparent"},"webview-container":{flex:1,width:"100%",backgroundColor:"transparent",position:"absolute",top:0,left:0,right:0,bottom:0},show:{zIndex:1e4,elevation:1e4},hide:{zIndex:-1e4,elevation:0}})}var K=class extends q.ViewController{constructor(){super(...arguments);this.Relayer=o=>{let[h,c]=(0,m.useState)(!1),[d,p]=(0,m.useState)(!0),L=B();(0,m.useEffect)(()=>{this.isConnectedToInternet=L},[L]),(0,m.useEffect)(()=>(C.default.setItem(Y,""),()=>{this.isReadyForRequest=!1}),[]),(0,m.useEffect)(()=>{ce.EventRegister.addEventListener(ge,y=>M(this,null,function*(){this.isReadyForRequest=!1,p(!1),this.post(y.msgType,y.payload),yield C.default.setItem(Y,new Date().toISOString())}))},[]),(0,m.useEffect)(()=>{d||setTimeout(()=>p(!0),10)},[d]);let S=(0,m.useCallback)(y=>{this.webView=y},[]),v=(0,m.useCallback)(y=>{this.container=ie(oe({},y),{showOverlay:V,hideOverlay:P})},[]),V=(0,m.useCallback)(()=>{c(!0)},[]),P=(0,m.useCallback)(()=>{c(!1)},[]),G=(0,m.useMemo)(()=>[this.styles["webview-container"],h?ie(oe({},this.styles.show),{backgroundColor:o!=null?o:Be}):this.styles.hide],[h]),H=(0,m.useCallback)(y=>{this.handleReactNativeWebViewMessage(y)},[]);return d?m.default.createElement(be.SafeAreaView,{ref:v,style:G},m.default.createElement(we.WebView,{ref:S,source:{uri:`${this.endpoint}/send/?params=${encodeURIComponent(this.parameters)}`},onMessage:H,style:this.styles["magic-webview"],autoManageStatusBarEnabled:!1,webviewDebuggingEnabled:!0,onShouldStartLoadWithRequest:y=>new URLSearchParams(y.url.split("?")[1]).get(Ue)?($.Linking.openURL(y.url),!1):!0})):null}}init(){this.webView=null,this.container=null,this.styles=Ye()}handleReactNativeWebViewMessage(o){var h;if(o.nativeEvent&&typeof o.nativeEvent.data=="string"&&(o.nativeEvent.url===`${this.endpoint}/send/?params=${encodeURIComponent(this.parameters)}`||o.nativeEvent.url===`${this.endpoint}/send/?params=${this.parameters}`)){let c=JSON.parse(o.nativeEvent.data,(d,p)=>{try{if(p&&typeof p=="object"&&p.flag&&p.flag===ye)return new global[p.constructor](p.data.split(","))}catch(L){}return p});if(c&&c.msgType&&this.messageHandlers.size){c.response=(h=c.response)!=null?h:{};let d={data:c};for(let p of this.messageHandlers.values())p(d)}}}msgPostedAfterInactivity(){return M(this,null,function*(){let o=yield C.default.getItem(Y);if(o){let h=new Date(o).getTime(),c=new Date().getTime(),d=5*60*1e3;return c-h>d}return!1})}hideOverlay(){this.container&&this.container.hideOverlay()}showOverlay(){this.container&&this.container.showOverlay()}_post(o){return M(this,null,function*(){if(yield this.msgPostedAfterInactivity()){ce.EventRegister.emit(ge,o);return}if(this.webView&&this.webView.postMessage)this.webView.postMessage(JSON.stringify(o,(h,c)=>(0,Se.isTypedArray)(c)?{constructor:c.constructor.name,data:c.toString(),flag:ye}:c),this.endpoint),C.default.setItem(Y,new Date().toISOString());else throw(0,q.createModalNotReadyError)()})}checkRelayerExistsInDOM(){return Promise.resolve(!0)}reloadRelayer(){return Promise.resolve(void 0)}};var Ee=require("@magic-sdk/provider"),x=class extends Ee.SDKBase{get Relayer(){return this.overlay.Relayer}};l(u,require("@magic-sdk/commons"),module.exports);global.process=Ie.merge(global.process,Ke);global.process.browser=!1;global.Buffer=J.Buffer;global.URL=z.URL;global.URLSearchParams=z.URLSearchParams;global.btoa=n=>J.Buffer.from(n,"binary").toString("base64");global.atob=n=>J.Buffer.from(n,"base64").toString("binary");var $e=(0,_e.createSDK)(x,{platform:"react-native",sdkName:"@magic-sdk/react-native-expo",version:"30.0.5",bundleId:Oe.applicationId,defaultEndpoint:"https://box.magic.link/",ViewController:K,configureStorage:()=>M(void 0,null,function*(){let n=Le.default.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"}),a=(0,Re.driverWithoutSerialization)();return yield Promise.all([n.defineDriver(a),n.defineDriver(fe)]),yield n.setDriver([a._driver,fe._driver]),n})});0&&(module.exports={Magic,useInternetConnection});
1
+ "use strict";var Te=Object.create;var D=Object.defineProperty,Pe=Object.defineProperties,De=Object.getOwnPropertyDescriptor,Ne=Object.getOwnPropertyDescriptors,Ce=Object.getOwnPropertyNames,he=Object.getOwnPropertySymbols,Ve=Object.getPrototypeOf,me=Object.prototype.hasOwnProperty,Ge=Object.prototype.propertyIsEnumerable;var pe=(n,s,o)=>s in n?D(n,s,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[s]=o,ne=(n,s)=>{for(var o in s||(s={}))me.call(s,o)&&pe(n,o,s[o]);if(he)for(var o of he(s))Ge.call(s,o)&&pe(n,o,s[o]);return n},oe=(n,s)=>Pe(n,Ne(s));var ke=(n,s)=>()=>(s||n((s={exports:{}}).exports,s),s.exports),We=(n,s)=>{for(var o in s)D(n,o,{get:s[o],enumerable:!0})},U=(n,s,o,f)=>{if(s&&typeof s=="object"||typeof s=="function")for(let c of Ce(s))!me.call(n,c)&&c!==o&&D(n,c,{get:()=>s[c],enumerable:!(f=De(s,c))||f.enumerable});return n},u=(n,s,o)=>(U(n,s,"default"),o&&U(o,s,"default")),L=(n,s,o)=>(o=n!=null?Te(Ve(n)):{},U(s||!n||!n.__esModule?D(o,"default",{value:n,enumerable:!0}):o,n)),Fe=n=>U(D({},"__esModule",{value:!0}),n);var M=(n,s,o)=>new Promise((f,c)=>{var y=h=>{try{_(o.next(h))}catch(I){c(I)}},v=h=>{try{_(o.throw(h))}catch(I){c(I)}},_=h=>h.done?f(h.value):Promise.resolve(h.value).then(y,v);_((o=o.apply(n,s)).next())});var ve=ke((qe,ae)=>{var ie=function(n){"use strict";var s=Object.prototype,o=s.hasOwnProperty,f,c=typeof Symbol=="function"?Symbol:{},y=c.iterator||"@@iterator",v=c.asyncIterator||"@@asyncIterator",_=c.toStringTag||"@@toStringTag";function h(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{h({},"")}catch{h=function(e,r,a){return e[r]=a}}function I(t,e,r,a){var i=e&&e.prototype instanceof G?e:G,p=Object.create(i.prototype),g=new ee(a||[]);return p._invoke=Ae(t,r,g),p}n.wrap=I;function T(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(a){return{type:"throw",arg:a}}}var C="suspendedStart",H="suspendedYield",V="executing",d="completed",S={};function G(){}function k(){}function R(){}var X={};h(X,y,function(){return this});var Q=Object.getPrototypeOf,W=Q&&Q(Q(te([])));W&&W!==s&&o.call(W,y)&&(X=W);var A=R.prototype=G.prototype=Object.create(X);k.prototype=R,h(A,"constructor",R),h(R,"constructor",k),k.displayName=h(R,_,"GeneratorFunction");function fe(t){["next","throw","return"].forEach(function(e){h(t,e,function(r){return this._invoke(e,r)})})}n.isGeneratorFunction=function(t){var e=typeof t=="function"&&t.constructor;return e?e===k||(e.displayName||e.name)==="GeneratorFunction":!1},n.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,R):(t.__proto__=R,h(t,_,"GeneratorFunction")),t.prototype=Object.create(A),t},n.awrap=function(t){return{__await:t}};function F(t,e){function r(p,g,w,E){var b=T(t[p],t,g);if(b.type==="throw")E(b.arg);else{var re=b.arg,P=re.value;return P&&typeof P=="object"&&o.call(P,"__await")?e.resolve(P.__await).then(function(O){r("next",O,w,E)},function(O){r("throw",O,w,E)}):e.resolve(P).then(function(O){re.value=O,w(re)},function(O){return r("throw",O,w,E)})}}var a;function i(p,g){function w(){return new e(function(E,b){r(p,g,E,b)})}return a=a?a.then(w,w):w()}this._invoke=i}fe(F.prototype),h(F.prototype,v,function(){return this}),n.AsyncIterator=F,n.async=function(t,e,r,a,i){i===void 0&&(i=Promise);var p=new F(I(t,e,r,a),i);return n.isGeneratorFunction(e)?p:p.next().then(function(g){return g.done?g.value:p.next()})};function Ae(t,e,r){var a=C;return function(p,g){if(a===V)throw new Error("Generator is already running");if(a===d){if(p==="throw")throw g;return ue()}for(r.method=p,r.arg=g;;){var w=r.delegate;if(w){var E=le(w,r);if(E){if(E===S)continue;return E}}if(r.method==="next")r.sent=r._sent=r.arg;else if(r.method==="throw"){if(a===C)throw a=d,r.arg;r.dispatchException(r.arg)}else r.method==="return"&&r.abrupt("return",r.arg);a=V;var b=T(t,e,r);if(b.type==="normal"){if(a=r.done?d:H,b.arg===S)continue;return{value:b.arg,done:r.done}}else b.type==="throw"&&(a=d,r.method="throw",r.arg=b.arg)}}}function le(t,e){var r=t.iterator[e.method];if(r===f){if(e.delegate=null,e.method==="throw"){if(t.iterator.return&&(e.method="return",e.arg=f,le(t,e),e.method==="throw"))return S;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return S}var a=T(r,t.iterator,e.arg);if(a.type==="throw")return e.method="throw",e.arg=a.arg,e.delegate=null,S;var i=a.arg;if(!i)return e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,S;if(i.done)e[t.resultName]=i.value,e.next=t.nextLoc,e.method!=="return"&&(e.method="next",e.arg=f);else return i;return e.delegate=null,S}fe(A),h(A,_,"Generator"),h(A,y,function(){return this}),h(A,"toString",function(){return"[object Generator]"});function Me(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function Z(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function ee(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(Me,this),this.reset(!0)}n.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function a(){for(;e.length;){var i=e.pop();if(i in t)return a.value=i,a.done=!1,a}return a.done=!0,a}};function te(t){if(t){var e=t[y];if(e)return e.call(t);if(typeof t.next=="function")return t;if(!isNaN(t.length)){var r=-1,a=function i(){for(;++r<t.length;)if(o.call(t,r))return i.value=t[r],i.done=!1,i;return i.value=f,i.done=!0,i};return a.next=a}}return{next:ue}}n.values=te;function ue(){return{value:f,done:!0}}return ee.prototype={constructor:ee,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=f,this.done=!1,this.delegate=null,this.method="next",this.arg=f,this.tryEntries.forEach(Z),!t)for(var e in this)e.charAt(0)==="t"&&o.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=f)},stop:function(){this.done=!0;var t=this.tryEntries[0],e=t.completion;if(e.type==="throw")throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(E,b){return p.type="throw",p.arg=t,e.next=E,b&&(e.method="next",e.arg=f),!!b}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],p=i.completion;if(i.tryLoc==="root")return r("end");if(i.tryLoc<=this.prev){var g=o.call(i,"catchLoc"),w=o.call(i,"finallyLoc");if(g&&w){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(g){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else if(w){if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&o.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var i=a;break}}i&&(t==="break"||t==="continue")&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var p=i?i.completion:{};return p.type=t,p.arg=e,i?(this.method="next",this.next=i.finallyLoc,S):this.complete(p)},complete:function(t,e){if(t.type==="throw")throw t.arg;return t.type==="break"||t.type==="continue"?this.next=t.arg:t.type==="return"?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):t.type==="normal"&&e&&(this.next=e),S},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),Z(r),S}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var a=r.completion;if(a.type==="throw"){var i=a.arg;Z(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:te(t),resultName:e,nextLoc:r},this.method==="next"&&(this.arg=f),S}},n}(typeof ae=="object"?ae.exports:{});try{regeneratorRuntime=ie}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=ie:Function("r","regeneratorRuntime = r")(ie)}});var l={};We(l,{Magic:()=>Ke,useInternetConnection:()=>Y});module.exports=Fe(l);var Ze=L(ve()),_e=require("@magic-sdk/provider"),je=L(require("process")),Le=L(require("localforage")),z=require("whatwg-url"),J=require("buffer"),Ie=L(require("lodash")),Re=L(require("expo-application")),Oe=require("@aveq-research/localforage-asyncstorage-driver"),ce=L(require("localforage-driver-memory"));var m=L(require("react")),$=require("react-native"),we=require("react-native-webview"),be=require("react-native-safe-area-context"),q=require("@magic-sdk/provider"),Se=require("lodash"),N=L(require("@react-native-async-storage/async-storage")),se=require("react-native-event-listeners");var B=require("react"),de=L(require("@react-native-community/netinfo")),Y=()=>{let[n,s]=(0,B.useState)(!0);return(0,B.useEffect)(()=>{let o=f=>{s(!!f.isConnected)};return de.default.addEventListener(o)},[]),n};var ye="MAGIC_PAYLOAD_FLAG_TYPED_ARRAY",Ue="open_in_device_browser",Be="#FFFFFF",ge="msg_posted_after_inactivity_event",j="lastMessageTime";function Ye(){return $.StyleSheet.create({"magic-webview":{flex:1,backgroundColor:"transparent"},"webview-container":{flex:1,width:"100%",backgroundColor:"transparent",position:"absolute",top:0,left:0,right:0,bottom:0},show:{zIndex:1e4,elevation:1e4},hide:{zIndex:-1e4,elevation:0}})}var K=class extends q.ViewController{constructor(){super(...arguments);this.Relayer=o=>{let[f,c]=(0,m.useState)(!1),[y,v]=(0,m.useState)(!0),_=Y();(0,m.useEffect)(()=>{this.isConnectedToInternet=_},[_]),(0,m.useEffect)(()=>(N.default.setItem(j,""),()=>{this.isReadyForRequest=!1}),[]),(0,m.useEffect)(()=>{se.EventRegister.addEventListener(ge,d=>M(this,null,function*(){this.isReadyForRequest=!1,v(!1),this.post(d.msgType,d.payload),yield N.default.setItem(j,new Date().toISOString())}))},[]),(0,m.useEffect)(()=>{y||setTimeout(()=>v(!0),10)},[y]);let h=(0,m.useCallback)(d=>{this.webView=d},[]),I=(0,m.useCallback)(d=>{this.container=oe(ne({},d),{showOverlay:T,hideOverlay:C})},[]),T=(0,m.useCallback)(()=>{c(!0)},[]),C=(0,m.useCallback)(()=>{c(!1)},[]),H=(0,m.useMemo)(()=>[this.styles["webview-container"],f?oe(ne({},this.styles.show),{backgroundColor:o!=null?o:Be}):this.styles.hide],[f]),V=(0,m.useCallback)(d=>{this.handleReactNativeWebViewMessage(d)},[]);return y?m.default.createElement(be.SafeAreaView,{ref:I,style:H},m.default.createElement(we.WebView,{ref:h,source:{uri:`${this.endpoint}/send/?params=${encodeURIComponent(this.parameters)}`},onMessage:V,style:this.styles["magic-webview"],autoManageStatusBarEnabled:!1,webviewDebuggingEnabled:!0,onShouldStartLoadWithRequest:d=>new URLSearchParams(d.url.split("?")[1]).get(Ue)?($.Linking.openURL(d.url),!1):!0})):null}}init(){this.webView=null,this.container=null,this.styles=Ye()}handleReactNativeWebViewMessage(o){var f;if(o.nativeEvent&&typeof o.nativeEvent.data=="string"&&(o.nativeEvent.url===`${this.endpoint}/send/?params=${encodeURIComponent(this.parameters)}`||o.nativeEvent.url===`${this.endpoint}/send/?params=${this.parameters}`)){let c=JSON.parse(o.nativeEvent.data,(y,v)=>{try{if(v&&typeof v=="object"&&v.flag&&v.flag===ye)return new global[v.constructor](v.data.split(","))}catch(_){}return v});if(c&&c.msgType&&this.messageHandlers.size){c.response=(f=c.response)!=null?f:{};let y={data:c};for(let v of this.messageHandlers.values())v(y)}}}msgPostedAfterInactivity(){return M(this,null,function*(){let o=yield N.default.getItem(j);if(o){let f=new Date(o).getTime(),c=new Date().getTime(),y=5*60*1e3;return c-f>y}return!1})}hideOverlay(){this.container&&this.container.hideOverlay()}showOverlay(){this.container&&this.container.showOverlay()}_post(o){return M(this,null,function*(){if(yield this.msgPostedAfterInactivity()){se.EventRegister.emit(ge,o);return}if(this.webView&&this.webView.postMessage)this.webView.postMessage(JSON.stringify(o,(f,c)=>(0,Se.isTypedArray)(c)?{constructor:c.constructor.name,data:c.toString(),flag:ye}:c),this.endpoint),N.default.setItem(j,new Date().toISOString());else throw(0,q.createModalNotReadyError)()})}checkRelayerExistsInDOM(){return Promise.resolve(!0)}reloadRelayer(){return Promise.resolve(void 0)}};var Ee=require("@magic-sdk/provider"),x=class extends Ee.SDKBase{get Relayer(){return this.overlay.Relayer}};u(l,require("@magic-sdk/commons"),module.exports);global.process=Ie.merge(global.process,je);global.process.browser=!1;global.Buffer=J.Buffer;global.URL=z.URL;global.URLSearchParams=z.URLSearchParams;global.btoa=n=>J.Buffer.from(n,"binary").toString("base64");global.atob=n=>J.Buffer.from(n,"base64").toString("binary");var Ke=(0,_e.createSDK)(x,{platform:"react-native",sdkName:"@magic-sdk/react-native-expo",version:"30.0.5",bundleId:Re.applicationId,defaultEndpoint:"https://box.magic.link/",ViewController:K,configureStorage:()=>M(void 0,null,function*(){let n=Le.default.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"}),s=(0,Oe.driverWithoutSerialization)();return yield Promise.all([n.defineDriver(s),n.defineDriver(ce)]),yield n.setDriver([s._driver,ce._driver]),n})});0&&(module.exports={Magic,useInternetConnection});
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../node_modules/regenerator-runtime/runtime.js", "../../src/index.ts", "../../src/react-native-webview-controller.tsx", "../../src/hooks.ts", "../../src/react-native-sdk-base.ts"],
4
- "sourcesContent": ["/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; };\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function define(obj, key, value) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n return obj[key];\n }\n try {\n // IE 8 has a broken Object.defineProperty that only works on DOM objects.\n define({}, \"\");\n } catch (err) {\n define = function(obj, key, value) {\n return obj[key] = value;\n };\n }\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) });\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n define(IteratorPrototype, iteratorSymbol, function () {\n return this;\n });\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = GeneratorFunctionPrototype;\n defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: true });\n defineProperty(\n GeneratorFunctionPrototype,\n \"constructor\",\n { value: GeneratorFunction, configurable: true }\n );\n GeneratorFunction.displayName = define(\n GeneratorFunctionPrototype,\n toStringTagSymbol,\n \"GeneratorFunction\"\n );\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n define(prototype, method, function(arg) {\n return this._invoke(method, arg);\n });\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n define(genFun, toStringTagSymbol, \"GeneratorFunction\");\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n defineProperty(this, \"_invoke\", { value: enqueue });\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n define(AsyncIterator.prototype, asyncIteratorSymbol, function () {\n return this;\n });\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var methodName = context.method;\n var method = delegate.iterator[methodName];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method, or a missing .next mehtod, always terminate the\n // yield* loop.\n context.delegate = null;\n\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (methodName === \"throw\" && delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n if (methodName !== \"return\") {\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a '\" + methodName + \"' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n define(Gp, toStringTagSymbol, \"Generator\");\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n define(Gp, iteratorSymbol, function() {\n return this;\n });\n\n define(Gp, \"toString\", function() {\n return \"[object Generator]\";\n });\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(val) {\n var object = Object(val);\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable || iterable === \"\") {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n throw new TypeError(typeof iterable + \" is not iterable\");\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, in modern engines\n // we can explicitly access globalThis. In older engines we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n if (typeof globalThis === \"object\") {\n globalThis.regeneratorRuntime = runtime;\n } else {\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n }\n}\n", "/* istanbul ignore file */\n\nimport 'regenerator-runtime/runtime';\n\nimport { createSDK, InstanceWithExtensions, MagicSDKExtensionsOption } from '@magic-sdk/provider';\nimport * as processPolyfill from 'process';\nimport localForage from 'localforage';\nimport { URL as URLPolyfill, URLSearchParams as URLSearchParamsPolyfill } from 'whatwg-url';\nimport { Buffer } from 'buffer';\nimport * as _ from 'lodash';\nimport * as Application from 'expo-application';\nimport { driverWithoutSerialization } from '@aveq-research/localforage-asyncstorage-driver';\nimport * as memoryDriver from 'localforage-driver-memory';\nimport { ReactNativeWebViewController } from './react-native-webview-controller';\nimport { SDKBaseReactNative } from './react-native-sdk-base';\n\n// Web3 assumes a browser context, so we need\n// to provide `btoa` and `atob` shims.\n\n// We expect `global.process` to be a Node Process for web3.js usage\n// so we replace it here.\nglobal.process = _.merge(global.process, processPolyfill);\n\n(global.process as any).browser = false;\n\n// WHATWG URL requires global `Buffer` access.\nglobal.Buffer = Buffer;\n\n// Setup global WHATWG URL polyfills\nglobal.URL = URLPolyfill as any;\nglobal.URLSearchParams = URLSearchParamsPolyfill as any;\n\n/* istanbul ignore next */\nglobal.btoa = str => Buffer.from(str, 'binary').toString('base64');\n/* istanbul ignore next */\nglobal.atob = b64Encoded => Buffer.from(b64Encoded, 'base64').toString('binary');\n\nexport * from '@magic-sdk/commons';\n\nexport const Magic = createSDK(SDKBaseReactNative, {\n platform: 'react-native',\n sdkName: '@magic-sdk/react-native-expo',\n version: process.env.EXPO_REACT_NATIVE_VERSION!,\n bundleId: Application.applicationId,\n defaultEndpoint: 'https://box.magic.link/',\n ViewController: ReactNativeWebViewController,\n configureStorage: /* istanbul ignore next */ async () => {\n const lf = localForage.createInstance({\n name: 'MagicAuthLocalStorageDB',\n storeName: 'MagicAuthLocalStorage',\n });\n\n const driver = driverWithoutSerialization();\n await Promise.all([lf.defineDriver(driver), lf.defineDriver(memoryDriver)]);\n await lf.setDriver([driver._driver, memoryDriver._driver]);\n\n return lf;\n },\n});\n\nexport type Magic<T extends MagicSDKExtensionsOption<any> = MagicSDKExtensionsOption> = InstanceWithExtensions<\n SDKBaseReactNative,\n T\n>;\n\nexport { useInternetConnection } from './hooks';\n", "import React, { useState, useCallback, useMemo, useEffect } from 'react';\nimport { Linking, StyleSheet, View } from 'react-native';\nimport { WebView } from 'react-native-webview';\nimport { SafeAreaView } from 'react-native-safe-area-context';\nimport { ViewController, createModalNotReadyError } from '@magic-sdk/provider';\nimport { MagicMessageEvent } from '@magic-sdk/types';\nimport { isTypedArray } from 'lodash';\nimport AsyncStorage from '@react-native-async-storage/async-storage';\nimport { EventRegister } from 'react-native-event-listeners';\n/* global NodeJS */\nimport Global = NodeJS.Global;\nimport { useInternetConnection } from './hooks';\n\nconst MAGIC_PAYLOAD_FLAG_TYPED_ARRAY = 'MAGIC_PAYLOAD_FLAG_TYPED_ARRAY';\nconst OPEN_IN_DEVICE_BROWSER = 'open_in_device_browser';\nconst DEFAULT_BACKGROUND_COLOR = '#FFFFFF';\nconst MSG_POSTED_AFTER_INACTIVITY_EVENT = 'msg_posted_after_inactivity_event';\nconst LAST_MESSAGE_TIME = 'lastMessageTime';\n/**\n * Builds the Magic `<WebView>` overlay styles. These base styles enable\n * `<WebView>` UI to render above all other DOM content.\n */\nfunction createWebViewStyles() {\n return StyleSheet.create({\n 'magic-webview': {\n flex: 1,\n backgroundColor: 'transparent',\n },\n\n 'webview-container': {\n flex: 1,\n width: '100%',\n backgroundColor: 'transparent',\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n },\n\n show: {\n zIndex: 10000,\n elevation: 10000,\n },\n\n hide: {\n zIndex: -10000,\n elevation: 0,\n },\n });\n}\n\n/**\n * Overloads React Native's `<View>` with helper methods we require to hide/show\n * the rendered `<WebView>`.\n */\ninterface ViewWrapper extends View {\n showOverlay: () => void;\n hideOverlay: () => void;\n}\n\n/**\n * View controller for the Magic `<WebView>` overlay.\n */\nexport class ReactNativeWebViewController extends ViewController {\n private webView!: WebView | null;\n private container!: ViewWrapper | null;\n private styles: any;\n\n protected init() {\n this.webView = null;\n this.container = null;\n this.styles = createWebViewStyles();\n }\n\n /**\n * Renders a React Native `<WebView>` with built-in message handling to and\n * from the Magic `<iframe>` context.\n */\n // Validating this logic requires lots of React-specific boilerplate. We will\n // revisit this method for unit testing in the future. For now, manual testing\n // is sufficient (this logic is stable right now and not expected to change in\n // the forseeable future).\n /* istanbul ignore next */\n public Relayer: React.FC<{ backgroundColor?: string }> = backgroundColor => {\n const [show, setShow] = useState(false);\n const [mountOverlay, setMountOverlay] = useState(true);\n const isConnected = useInternetConnection();\n\n useEffect(() => {\n this.isConnectedToInternet = isConnected;\n }, [isConnected]);\n\n useEffect(() => {\n // reset lastMessage when webview is first mounted\n AsyncStorage.setItem(LAST_MESSAGE_TIME, '');\n return () => {\n this.isReadyForRequest = false;\n };\n }, []);\n\n useEffect(() => {\n EventRegister.addEventListener(MSG_POSTED_AFTER_INACTIVITY_EVENT, async message => {\n // If inactivity has been determined, the message is posted only after a brief\n // unmount and re-mount of the webview. This is to ensure the webview is accepting messages.\n // iOS kills webview processes after a certain period of inactivity, like when the app is\n // on background for long periods of time.\n this.isReadyForRequest = false;\n setMountOverlay(false);\n this.post(message.msgType, message.payload);\n await AsyncStorage.setItem(LAST_MESSAGE_TIME, new Date().toISOString());\n });\n }, []);\n\n useEffect(() => {\n if (!mountOverlay) {\n // Briefly unmount and re-mount the webview to ensure it's ready to accept messages.\n setTimeout(() => setMountOverlay(true), 10);\n }\n }, [mountOverlay]);\n\n /**\n * Saves a reference to the underlying `<WebView>` node so we can interact\n * with incoming messages.\n */\n const webViewRef = useCallback((webView: any): void => {\n this.webView = webView;\n }, []);\n\n /**\n * Saves a reference to the underlying `<View>` node so we can interact with\n * display styles.\n */\n const containerRef = useCallback((view: any): void => {\n this.container = {\n ...view,\n showOverlay,\n hideOverlay,\n };\n }, []);\n\n /**\n * Show the Magic `<WebView>` overlay.\n */\n const showOverlay = useCallback(() => {\n setShow(true);\n }, []);\n\n /**\n * Hide the Magic `<WebView>` overlay.\n */\n const hideOverlay = useCallback(() => {\n setShow(false);\n }, []);\n\n const containerStyles = useMemo(() => {\n return [\n this.styles['webview-container'],\n show\n ? {\n ...this.styles.show,\n backgroundColor: backgroundColor ?? DEFAULT_BACKGROUND_COLOR,\n }\n : this.styles.hide,\n ];\n }, [show]);\n\n const handleWebViewMessage = useCallback((event: any) => {\n this.handleReactNativeWebViewMessage(event);\n }, []);\n\n if (!mountOverlay) {\n return null;\n }\n\n return (\n <SafeAreaView ref={containerRef} style={containerStyles}>\n <WebView\n ref={webViewRef}\n source={{ uri: `${this.endpoint}/send/?params=${encodeURIComponent(this.parameters)}` }}\n onMessage={handleWebViewMessage}\n style={this.styles['magic-webview']}\n autoManageStatusBarEnabled={false}\n webviewDebuggingEnabled\n onShouldStartLoadWithRequest={event => {\n const queryParams = new URLSearchParams(event.url.split('?')[1]);\n const openInDeviceBrowser = queryParams.get(OPEN_IN_DEVICE_BROWSER);\n\n if (openInDeviceBrowser) {\n Linking.openURL(event.url);\n return false;\n }\n return true;\n }}\n />\n </SafeAreaView>\n );\n };\n\n /**\n * Route incoming messages from a React Native `<WebView>`.\n */\n private handleReactNativeWebViewMessage(event: any) {\n if (\n event.nativeEvent &&\n typeof event.nativeEvent.data === 'string' &&\n /* Backward comaptible */\n (event.nativeEvent.url === `${this.endpoint}/send/?params=${encodeURIComponent(this.parameters)}` ||\n event.nativeEvent.url === `${this.endpoint}/send/?params=${this.parameters}`)\n ) {\n // Special parsing logic when dealing with TypedArray in the payload\n // Such change is required as JSON.stringify will manipulate the object and cause exceptions during parsing\n // The typed Array is stringified in Mgbox with a flag as notation.\n const data: any = JSON.parse(event.nativeEvent.data, (key, value) => {\n try {\n if (value && typeof value === 'object' && value.flag && value.flag === MAGIC_PAYLOAD_FLAG_TYPED_ARRAY) {\n return new (global[value.constructor as keyof Global] as any)(value.data.split(','));\n }\n\n // silently handles exception and return the original copy\n // eslint-disable-next-line no-empty\n } catch (e) {}\n return value;\n });\n\n if (data && data.msgType && this.messageHandlers.size) {\n // If the response object is undefined, we ensure it's at least an\n // empty object before passing to the event listener.\n\n data.response = data.response ?? {};\n\n // Reconstruct event from RN event\n const magicEvent: MagicMessageEvent = { data } as MagicMessageEvent;\n for (const handler of this.messageHandlers.values()) {\n handler(magicEvent);\n }\n }\n }\n }\n\n private async msgPostedAfterInactivity() {\n const lastPostTimestamp: string | null = await AsyncStorage.getItem(LAST_MESSAGE_TIME);\n if (lastPostTimestamp) {\n const lastPostDate = new Date(lastPostTimestamp).getTime();\n const now = new Date().getTime();\n const fiveMinutes = 5 * 60 * 1000;\n\n // there's been inactivity if the new message is posted\n // 5 min or more after the last message.\n return now - lastPostDate > fiveMinutes;\n }\n return false;\n }\n\n protected hideOverlay() {\n if (this.container) this.container.hideOverlay();\n }\n\n protected showOverlay() {\n if (this.container) this.container.showOverlay();\n }\n\n protected async _post(data: any) {\n if (await this.msgPostedAfterInactivity()) {\n EventRegister.emit(MSG_POSTED_AFTER_INACTIVITY_EVENT, data);\n return;\n }\n if (this.webView && (this.webView as any).postMessage) {\n (this.webView as any).postMessage(\n JSON.stringify(data, (key, value) => {\n // parse Typed Array to Stringify object\n if (isTypedArray(value)) {\n return {\n constructor: value.constructor.name,\n data: value.toString(),\n flag: MAGIC_PAYLOAD_FLAG_TYPED_ARRAY,\n };\n }\n return value;\n }),\n this.endpoint,\n );\n AsyncStorage.setItem(LAST_MESSAGE_TIME, new Date().toISOString());\n } else {\n throw createModalNotReadyError();\n }\n }\n\n // Todo - implement these methods\n /* istanbul ignore next */\n protected checkRelayerExistsInDOM(): Promise<boolean> {\n return Promise.resolve(true);\n }\n\n /* istanbul ignore next */\n protected reloadRelayer(): Promise<void> {\n return Promise.resolve(undefined);\n }\n}\n", "import { useEffect, useState } from 'react';\nimport NetInfo, { NetInfoState } from '@react-native-community/netinfo';\n\nexport const useInternetConnection = () => {\n const [isConnected, setIsConnected] = useState(true);\n useEffect(() => {\n const handleConnectionChange = (connectionInfo: NetInfoState) => {\n setIsConnected(!!connectionInfo.isConnected);\n };\n\n // Subscribe to connection changes\n return NetInfo.addEventListener(handleConnectionChange);\n }, []);\n\n return isConnected;\n};\n", "import { SDKBase } from '@magic-sdk/provider';\nimport { ReactNativeWebViewController } from './react-native-webview-controller';\n\nexport class SDKBaseReactNative extends SDKBase {\n public get Relayer() {\n return (this.overlay as ReactNativeWebViewController).Relayer;\n }\n}\n"],
5
- "mappings": "kuCAAA,IAAAA,GAAAC,GAAA,CAAAC,GAAAC,KAAA,CAOA,IAAIC,GAAW,SAAUF,EAAS,CAChC,aAEA,IAAIG,EAAK,OAAO,UACZC,EAASD,EAAG,eACZE,EAAiB,OAAO,gBAAkB,SAAUC,EAAKC,EAAKC,EAAM,CAAEF,EAAIC,GAAOC,EAAK,KAAO,EAC7FC,EACAC,EAAU,OAAO,QAAW,WAAa,OAAS,CAAC,EACnDC,EAAiBD,EAAQ,UAAY,aACrCE,EAAsBF,EAAQ,eAAiB,kBAC/CG,EAAoBH,EAAQ,aAAe,gBAE/C,SAASI,EAAOR,EAAKC,EAAKQ,EAAO,CAC/B,cAAO,eAAeT,EAAKC,EAAK,CAC9B,MAAOQ,EACP,WAAY,GACZ,aAAc,GACd,SAAU,EACZ,CAAC,EACMT,EAAIC,EACb,CACA,GAAI,CAEFO,EAAO,CAAC,EAAG,EAAE,CACf,MAAE,CACAA,EAAS,SAASR,EAAKC,EAAKQ,EAAO,CACjC,OAAOT,EAAIC,GAAOQ,CACpB,CACF,CAEA,SAASC,EAAKC,EAASC,EAASC,EAAMC,EAAa,CAEjD,IAAIC,EAAiBH,GAAWA,EAAQ,qBAAqBI,EAAYJ,EAAUI,EAC/EC,EAAY,OAAO,OAAOF,EAAe,SAAS,EAClDG,EAAU,IAAIC,GAAQL,GAAe,CAAC,CAAC,EAI3C,OAAAf,EAAekB,EAAW,UAAW,CAAE,MAAOG,GAAiBT,EAASE,EAAMK,CAAO,CAAE,CAAC,EAEjFD,CACT,CACAvB,EAAQ,KAAOgB,EAYf,SAASW,EAASC,EAAItB,EAAKuB,EAAK,CAC9B,GAAI,CACF,MAAO,CAAE,KAAM,SAAU,IAAKD,EAAG,KAAKtB,EAAKuB,CAAG,CAAE,CAClD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EAAE,SAAS,QAAQ,EAIxE,IAAMC,MAAQ,cAAUC,EAAoB,CACjD,SAAU,eACV,QAAS,+BACT,QAAS,SACT,SAAsB,iBACtB,gBAAiB,0BACjB,eAAgBC,EAChB,iBAA6C,IAAYC,EAAA,wBACvD,IAAMC,EAAK,GAAAC,QAAY,eAAe,CACpC,KAAM,0BACN,UAAW,uBACb,CAAC,EAEKC,KAAS,+BAA2B,EAC1C,aAAM,QAAQ,IAAI,CAACF,EAAG,aAAaE,CAAM,EAAGF,EAAG,aAAaG,EAAY,CAAC,CAAC,EAC1E,MAAMH,EAAG,UAAU,CAACE,EAAO,QAAsB,UAAO,CAAC,EAElDF,CACT,EACF,CAAC",
6
- "names": ["require_runtime", "__commonJSMin", "exports", "module", "runtime", "Op", "hasOwn", "defineProperty", "obj", "key", "desc", "undefined", "$Symbol", "iteratorSymbol", "asyncIteratorSymbol", "toStringTagSymbol", "define", "value", "wrap", "innerFn", "outerFn", "self", "tryLocsList", "protoGenerator", "Generator", "generator", "context", "Context", "makeInvokeMethod", "tryCatch", "fn", "arg", "err", "GenStateSuspendedStart", "GenStateSuspendedYield", "GenStateExecuting", "GenStateCompleted", "ContinueSentinel", "GeneratorFunction", "GeneratorFunctionPrototype", "IteratorPrototype", "getProto", "NativeIteratorPrototype", "values", "Gp", "defineIteratorMethods", "prototype", "method", "genFun", "ctor", "AsyncIterator", "PromiseImpl", "invoke", "resolve", "reject", "record", "result", "unwrapped", "error", "previousPromise", "enqueue", "callInvokeWithMethodAndArg", "iter", "state", "doneResult", "delegate", "delegateResult", "maybeInvokeDelegate", "methodName", "info", "pushTryEntry", "locs", "entry", "resetTryEntry", "val", "object", "keys", "next", "iterable", "iteratorMethod", "i", "skipTempReset", "name", "rootEntry", "rootRecord", "exception", "handle", "loc", "caught", "hasCatch", "hasFinally", "type", "finallyEntry", "afterLoc", "finallyLoc", "tryLoc", "thrown", "resultName", "nextLoc", "src_exports", "__export", "Magic", "useInternetConnection", "__toCommonJS", "import_runtime", "import_provider", "processPolyfill", "import_localforage", "import_whatwg_url", "import_buffer", "_", "Application", "import_localforage_asyncstorage_driver", "memoryDriver", "import_react", "import_react_native", "import_react_native_webview", "import_react_native_safe_area_context", "import_provider", "import_lodash", "import_async_storage", "import_react_native_event_listeners", "import_react", "import_netinfo", "useInternetConnection", "isConnected", "setIsConnected", "handleConnectionChange", "connectionInfo", "NetInfo", "MAGIC_PAYLOAD_FLAG_TYPED_ARRAY", "OPEN_IN_DEVICE_BROWSER", "DEFAULT_BACKGROUND_COLOR", "MSG_POSTED_AFTER_INACTIVITY_EVENT", "LAST_MESSAGE_TIME", "createWebViewStyles", "ReactNativeWebViewController", "backgroundColor", "show", "setShow", "mountOverlay", "setMountOverlay", "isConnected", "useInternetConnection", "AsyncStorage", "message", "__async", "webViewRef", "webView", "containerRef", "view", "__spreadProps", "__spreadValues", "showOverlay", "hideOverlay", "containerStyles", "handleWebViewMessage", "event", "React", "_a", "data", "key", "value", "e", "magicEvent", "handler", "lastPostTimestamp", "lastPostDate", "now", "fiveMinutes", "import_provider", "SDKBaseReactNative", "__reExport", "src_exports", "processPolyfill", "URLPolyfill", "URLSearchParamsPolyfill", "str", "b64Encoded", "Magic", "SDKBaseReactNative", "ReactNativeWebViewController", "__async", "lf", "localForage", "driver", "memoryDriver"]
4
+ "sourcesContent": ["/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function define(obj, key, value) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n return obj[key];\n }\n try {\n // IE 8 has a broken Object.defineProperty that only works on DOM objects.\n define({}, \"\");\n } catch (err) {\n define = function(obj, key, value) {\n return obj[key] = value;\n };\n }\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n define(IteratorPrototype, iteratorSymbol, function () {\n return this;\n });\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = GeneratorFunctionPrototype;\n define(Gp, \"constructor\", GeneratorFunctionPrototype);\n define(GeneratorFunctionPrototype, \"constructor\", GeneratorFunction);\n GeneratorFunction.displayName = define(\n GeneratorFunctionPrototype,\n toStringTagSymbol,\n \"GeneratorFunction\"\n );\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n define(prototype, method, function(arg) {\n return this._invoke(method, arg);\n });\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n define(genFun, toStringTagSymbol, \"GeneratorFunction\");\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n define(AsyncIterator.prototype, asyncIteratorSymbol, function () {\n return this;\n });\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n define(Gp, toStringTagSymbol, \"Generator\");\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n define(Gp, iteratorSymbol, function() {\n return this;\n });\n\n define(Gp, \"toString\", function() {\n return \"[object Generator]\";\n });\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, in modern engines\n // we can explicitly access globalThis. In older engines we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n if (typeof globalThis === \"object\") {\n globalThis.regeneratorRuntime = runtime;\n } else {\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n }\n}\n", "/* istanbul ignore file */\n\nimport 'regenerator-runtime/runtime';\n\nimport { createSDK, InstanceWithExtensions, MagicSDKExtensionsOption } from '@magic-sdk/provider';\nimport * as processPolyfill from 'process';\nimport localForage from 'localforage';\nimport { URL as URLPolyfill, URLSearchParams as URLSearchParamsPolyfill } from 'whatwg-url';\nimport { Buffer } from 'buffer';\nimport * as _ from 'lodash';\nimport * as Application from 'expo-application';\nimport { driverWithoutSerialization } from '@aveq-research/localforage-asyncstorage-driver';\nimport * as memoryDriver from 'localforage-driver-memory';\nimport { ReactNativeWebViewController } from './react-native-webview-controller';\nimport { SDKBaseReactNative } from './react-native-sdk-base';\n\n// Web3 assumes a browser context, so we need\n// to provide `btoa` and `atob` shims.\n\n// We expect `global.process` to be a Node Process for web3.js usage\n// so we replace it here.\nglobal.process = _.merge(global.process, processPolyfill);\n\n(global.process as any).browser = false;\n\n// WHATWG URL requires global `Buffer` access.\nglobal.Buffer = Buffer;\n\n// Setup global WHATWG URL polyfills\nglobal.URL = URLPolyfill as any;\nglobal.URLSearchParams = URLSearchParamsPolyfill as any;\n\n/* istanbul ignore next */\nglobal.btoa = str => Buffer.from(str, 'binary').toString('base64');\n/* istanbul ignore next */\nglobal.atob = b64Encoded => Buffer.from(b64Encoded, 'base64').toString('binary');\n\nexport * from '@magic-sdk/commons';\n\nexport const Magic = createSDK(SDKBaseReactNative, {\n platform: 'react-native',\n sdkName: '@magic-sdk/react-native-expo',\n version: process.env.EXPO_REACT_NATIVE_VERSION!,\n bundleId: Application.applicationId,\n defaultEndpoint: 'https://box.magic.link/',\n ViewController: ReactNativeWebViewController,\n configureStorage: /* istanbul ignore next */ async () => {\n const lf = localForage.createInstance({\n name: 'MagicAuthLocalStorageDB',\n storeName: 'MagicAuthLocalStorage',\n });\n\n const driver = driverWithoutSerialization();\n await Promise.all([lf.defineDriver(driver), lf.defineDriver(memoryDriver)]);\n await lf.setDriver([driver._driver, memoryDriver._driver]);\n\n return lf;\n },\n});\n\nexport type Magic<T extends MagicSDKExtensionsOption<any> = MagicSDKExtensionsOption> = InstanceWithExtensions<\n SDKBaseReactNative,\n T\n>;\n\nexport { useInternetConnection } from './hooks';\n", "import React, { useState, useCallback, useMemo, useEffect } from 'react';\nimport { Linking, StyleSheet, View } from 'react-native';\nimport { WebView } from 'react-native-webview';\nimport { SafeAreaView } from 'react-native-safe-area-context';\nimport { ViewController, createModalNotReadyError } from '@magic-sdk/provider';\nimport { MagicMessageEvent } from '@magic-sdk/types';\nimport { isTypedArray } from 'lodash';\nimport AsyncStorage from '@react-native-async-storage/async-storage';\nimport { EventRegister } from 'react-native-event-listeners';\n/* global NodeJS */\nimport Global = NodeJS.Global;\nimport { useInternetConnection } from './hooks';\n\nconst MAGIC_PAYLOAD_FLAG_TYPED_ARRAY = 'MAGIC_PAYLOAD_FLAG_TYPED_ARRAY';\nconst OPEN_IN_DEVICE_BROWSER = 'open_in_device_browser';\nconst DEFAULT_BACKGROUND_COLOR = '#FFFFFF';\nconst MSG_POSTED_AFTER_INACTIVITY_EVENT = 'msg_posted_after_inactivity_event';\nconst LAST_MESSAGE_TIME = 'lastMessageTime';\n/**\n * Builds the Magic `<WebView>` overlay styles. These base styles enable\n * `<WebView>` UI to render above all other DOM content.\n */\nfunction createWebViewStyles() {\n return StyleSheet.create({\n 'magic-webview': {\n flex: 1,\n backgroundColor: 'transparent',\n },\n\n 'webview-container': {\n flex: 1,\n width: '100%',\n backgroundColor: 'transparent',\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n },\n\n show: {\n zIndex: 10000,\n elevation: 10000,\n },\n\n hide: {\n zIndex: -10000,\n elevation: 0,\n },\n });\n}\n\n/**\n * Overloads React Native's `<View>` with helper methods we require to hide/show\n * the rendered `<WebView>`.\n */\ninterface ViewWrapper extends View {\n showOverlay: () => void;\n hideOverlay: () => void;\n}\n\n/**\n * View controller for the Magic `<WebView>` overlay.\n */\nexport class ReactNativeWebViewController extends ViewController {\n private webView!: WebView | null;\n private container!: ViewWrapper | null;\n private styles: any;\n\n protected init() {\n this.webView = null;\n this.container = null;\n this.styles = createWebViewStyles();\n }\n\n /**\n * Renders a React Native `<WebView>` with built-in message handling to and\n * from the Magic `<iframe>` context.\n */\n // Validating this logic requires lots of React-specific boilerplate. We will\n // revisit this method for unit testing in the future. For now, manual testing\n // is sufficient (this logic is stable right now and not expected to change in\n // the forseeable future).\n /* istanbul ignore next */\n public Relayer: React.FC<{ backgroundColor?: string }> = backgroundColor => {\n const [show, setShow] = useState(false);\n const [mountOverlay, setMountOverlay] = useState(true);\n const isConnected = useInternetConnection();\n\n useEffect(() => {\n this.isConnectedToInternet = isConnected;\n }, [isConnected]);\n\n useEffect(() => {\n // reset lastMessage when webview is first mounted\n AsyncStorage.setItem(LAST_MESSAGE_TIME, '');\n return () => {\n this.isReadyForRequest = false;\n };\n }, []);\n\n useEffect(() => {\n EventRegister.addEventListener(MSG_POSTED_AFTER_INACTIVITY_EVENT, async message => {\n // If inactivity has been determined, the message is posted only after a brief\n // unmount and re-mount of the webview. This is to ensure the webview is accepting messages.\n // iOS kills webview processes after a certain period of inactivity, like when the app is\n // on background for long periods of time.\n this.isReadyForRequest = false;\n setMountOverlay(false);\n this.post(message.msgType, message.payload);\n await AsyncStorage.setItem(LAST_MESSAGE_TIME, new Date().toISOString());\n });\n }, []);\n\n useEffect(() => {\n if (!mountOverlay) {\n // Briefly unmount and re-mount the webview to ensure it's ready to accept messages.\n setTimeout(() => setMountOverlay(true), 10);\n }\n }, [mountOverlay]);\n\n /**\n * Saves a reference to the underlying `<WebView>` node so we can interact\n * with incoming messages.\n */\n const webViewRef = useCallback((webView: any): void => {\n this.webView = webView;\n }, []);\n\n /**\n * Saves a reference to the underlying `<View>` node so we can interact with\n * display styles.\n */\n const containerRef = useCallback((view: any): void => {\n this.container = {\n ...view,\n showOverlay,\n hideOverlay,\n };\n }, []);\n\n /**\n * Show the Magic `<WebView>` overlay.\n */\n const showOverlay = useCallback(() => {\n setShow(true);\n }, []);\n\n /**\n * Hide the Magic `<WebView>` overlay.\n */\n const hideOverlay = useCallback(() => {\n setShow(false);\n }, []);\n\n const containerStyles = useMemo(() => {\n return [\n this.styles['webview-container'],\n show\n ? {\n ...this.styles.show,\n backgroundColor: backgroundColor ?? DEFAULT_BACKGROUND_COLOR,\n }\n : this.styles.hide,\n ];\n }, [show]);\n\n const handleWebViewMessage = useCallback((event: any) => {\n this.handleReactNativeWebViewMessage(event);\n }, []);\n\n if (!mountOverlay) {\n return null;\n }\n\n return (\n <SafeAreaView ref={containerRef} style={containerStyles}>\n <WebView\n ref={webViewRef}\n source={{ uri: `${this.endpoint}/send/?params=${encodeURIComponent(this.parameters)}` }}\n onMessage={handleWebViewMessage}\n style={this.styles['magic-webview']}\n autoManageStatusBarEnabled={false}\n webviewDebuggingEnabled\n onShouldStartLoadWithRequest={event => {\n const queryParams = new URLSearchParams(event.url.split('?')[1]);\n const openInDeviceBrowser = queryParams.get(OPEN_IN_DEVICE_BROWSER);\n\n if (openInDeviceBrowser) {\n Linking.openURL(event.url);\n return false;\n }\n return true;\n }}\n />\n </SafeAreaView>\n );\n };\n\n /**\n * Route incoming messages from a React Native `<WebView>`.\n */\n private handleReactNativeWebViewMessage(event: any) {\n if (\n event.nativeEvent &&\n typeof event.nativeEvent.data === 'string' &&\n /* Backward comaptible */\n (event.nativeEvent.url === `${this.endpoint}/send/?params=${encodeURIComponent(this.parameters)}` ||\n event.nativeEvent.url === `${this.endpoint}/send/?params=${this.parameters}`)\n ) {\n // Special parsing logic when dealing with TypedArray in the payload\n // Such change is required as JSON.stringify will manipulate the object and cause exceptions during parsing\n // The typed Array is stringified in Mgbox with a flag as notation.\n const data: any = JSON.parse(event.nativeEvent.data, (key, value) => {\n try {\n if (value && typeof value === 'object' && value.flag && value.flag === MAGIC_PAYLOAD_FLAG_TYPED_ARRAY) {\n return new (global[value.constructor as keyof Global] as any)(value.data.split(','));\n }\n\n // silently handles exception and return the original copy\n // eslint-disable-next-line no-empty\n } catch (e) {}\n return value;\n });\n\n if (data && data.msgType && this.messageHandlers.size) {\n // If the response object is undefined, we ensure it's at least an\n // empty object before passing to the event listener.\n\n data.response = data.response ?? {};\n\n // Reconstruct event from RN event\n const magicEvent: MagicMessageEvent = { data } as MagicMessageEvent;\n for (const handler of this.messageHandlers.values()) {\n handler(magicEvent);\n }\n }\n }\n }\n\n private async msgPostedAfterInactivity() {\n const lastPostTimestamp: string | null = await AsyncStorage.getItem(LAST_MESSAGE_TIME);\n if (lastPostTimestamp) {\n const lastPostDate = new Date(lastPostTimestamp).getTime();\n const now = new Date().getTime();\n const fiveMinutes = 5 * 60 * 1000;\n\n // there's been inactivity if the new message is posted\n // 5 min or more after the last message.\n return now - lastPostDate > fiveMinutes;\n }\n return false;\n }\n\n protected hideOverlay() {\n if (this.container) this.container.hideOverlay();\n }\n\n protected showOverlay() {\n if (this.container) this.container.showOverlay();\n }\n\n protected async _post(data: any) {\n if (await this.msgPostedAfterInactivity()) {\n EventRegister.emit(MSG_POSTED_AFTER_INACTIVITY_EVENT, data);\n return;\n }\n if (this.webView && (this.webView as any).postMessage) {\n (this.webView as any).postMessage(\n JSON.stringify(data, (key, value) => {\n // parse Typed Array to Stringify object\n if (isTypedArray(value)) {\n return {\n constructor: value.constructor.name,\n data: value.toString(),\n flag: MAGIC_PAYLOAD_FLAG_TYPED_ARRAY,\n };\n }\n return value;\n }),\n this.endpoint,\n );\n AsyncStorage.setItem(LAST_MESSAGE_TIME, new Date().toISOString());\n } else {\n throw createModalNotReadyError();\n }\n }\n\n // Todo - implement these methods\n /* istanbul ignore next */\n protected checkRelayerExistsInDOM(): Promise<boolean> {\n return Promise.resolve(true);\n }\n\n /* istanbul ignore next */\n protected reloadRelayer(): Promise<void> {\n return Promise.resolve(undefined);\n }\n}\n", "import { useEffect, useState } from 'react';\nimport NetInfo, { NetInfoState } from '@react-native-community/netinfo';\n\nexport const useInternetConnection = () => {\n const [isConnected, setIsConnected] = useState(true);\n useEffect(() => {\n const handleConnectionChange = (connectionInfo: NetInfoState) => {\n setIsConnected(!!connectionInfo.isConnected);\n };\n\n // Subscribe to connection changes\n return NetInfo.addEventListener(handleConnectionChange);\n }, []);\n\n return isConnected;\n};\n", "import { SDKBase } from '@magic-sdk/provider';\nimport { ReactNativeWebViewController } from './react-native-webview-controller';\n\nexport class SDKBaseReactNative extends SDKBase {\n public get Relayer() {\n return (this.overlay as ReactNativeWebViewController).Relayer;\n }\n}\n"],
5
+ "mappings": "kuCAAA,IAAAA,GAAAC,GAAA,CAAAC,GAAAC,KAAA,CAOA,IAAIC,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"module", "runtime", "Op", "hasOwn", "undefined", "$Symbol", "iteratorSymbol", "asyncIteratorSymbol", "toStringTagSymbol", "define", "obj", "key", "value", "wrap", "innerFn", "outerFn", "self", "tryLocsList", "protoGenerator", "Generator", "generator", "context", "Context", "makeInvokeMethod", "tryCatch", "fn", "arg", "err", "GenStateSuspendedStart", "GenStateSuspendedYield", "GenStateExecuting", "GenStateCompleted", "ContinueSentinel", "GeneratorFunction", "GeneratorFunctionPrototype", "IteratorPrototype", "getProto", "NativeIteratorPrototype", "values", "Gp", "defineIteratorMethods", "prototype", "method", "genFun", "ctor", "AsyncIterator", "PromiseImpl", "invoke", "resolve", "reject", "record", "result", "unwrapped", "error", "previousPromise", "enqueue", "callInvokeWithMethodAndArg", "iter", "state", "doneResult", "delegate", "delegateResult", "maybeInvokeDelegate", "info", "pushTryEntry", "locs", "entry", "resetTryEntry", "object", "keys", "next", "iterable", "iteratorMethod", "i", "skipTempReset", "name", "rootEntry", "rootRecord", "exception", "handle", "loc", "caught", "hasCatch", "hasFinally", "type", "finallyEntry", "afterLoc", "finallyLoc", "tryLoc", "thrown", "resultName", "nextLoc", "src_exports", "__export", "Magic", "useInternetConnection", "__toCommonJS", "import_runtime", "import_provider", "processPolyfill", "import_localforage", "import_whatwg_url", "import_buffer", "_", "Application", "import_localforage_asyncstorage_driver", "memoryDriver", "import_react", "import_react_native", "import_react_native_webview", "import_react_native_safe_area_context", "import_provider", "import_lodash", "import_async_storage", "import_react_native_event_listeners", "import_react", "import_netinfo", "useInternetConnection", "isConnected", "setIsConnected", "handleConnectionChange", "connectionInfo", "NetInfo", "MAGIC_PAYLOAD_FLAG_TYPED_ARRAY", "OPEN_IN_DEVICE_BROWSER", "DEFAULT_BACKGROUND_COLOR", "MSG_POSTED_AFTER_INACTIVITY_EVENT", "LAST_MESSAGE_TIME", "createWebViewStyles", "ReactNativeWebViewController", "backgroundColor", "show", "setShow", "mountOverlay", "setMountOverlay", "isConnected", "useInternetConnection", "AsyncStorage", "message", "__async", "webViewRef", "webView", "containerRef", "view", "__spreadProps", "__spreadValues", "showOverlay", "hideOverlay", "containerStyles", "handleWebViewMessage", "event", "React", "_a", "data", "key", "value", "e", "magicEvent", "handler", "lastPostTimestamp", "lastPostDate", "now", "fiveMinutes", "import_provider", "SDKBaseReactNative", "__reExport", "src_exports", "processPolyfill", "URLPolyfill", "URLSearchParamsPolyfill", "str", "b64Encoded", "Magic", "SDKBaseReactNative", "ReactNativeWebViewController", "__async", "lf", "localForage", "driver", "memoryDriver"]
7
7
  }
package/dist/es/index.js CHANGED
@@ -1,2 +1,2 @@
1
- var ge=Object.create;var z=Object.defineProperty,we=Object.defineProperties,be=Object.getOwnPropertyDescriptor,Se=Object.getOwnPropertyDescriptors,Ee=Object.getOwnPropertyNames,oe=Object.getOwnPropertySymbols,_e=Object.getPrototypeOf,ae=Object.prototype.hasOwnProperty,Le=Object.prototype.propertyIsEnumerable;var ie=(o,s,i)=>s in o?z(o,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):o[s]=i,J=(o,s)=>{for(var i in s||(s={}))ae.call(s,i)&&ie(o,i,s[i]);if(oe)for(var i of oe(s))Le.call(s,i)&&ie(o,i,s[i]);return o},H=(o,s)=>we(o,Se(s));var Ie=(o,s)=>()=>(s||o((s={exports:{}}).exports,s),s.exports);var Oe=(o,s,i,u)=>{if(s&&typeof s=="object"||typeof s=="function")for(let c of Ee(s))!ae.call(o,c)&&c!==i&&z(o,c,{get:()=>s[c],enumerable:!(u=be(s,c))||u.enumerable});return o};var Re=(o,s,i)=>(i=o!=null?ge(_e(o)):{},Oe(s||!o||!o.__esModule?z(i,"default",{value:o,enumerable:!0}):i,o));var I=(o,s,i)=>new Promise((u,c)=>{var p=g=>{try{S(i.next(g))}catch(h){c(h)}},l=g=>{try{S(i.throw(g))}catch(h){c(h)}},S=g=>g.done?u(g.value):Promise.resolve(g.value).then(p,l);S((i=i.apply(o,s)).next())});var se=Ie((He,Q)=>{var X=function(o){"use strict";var s=Object.prototype,i=s.hasOwnProperty,u=Object.defineProperty||function(t,e,r){t[e]=r.value},c,p=typeof Symbol=="function"?Symbol:{},l=p.iterator||"@@iterator",S=p.asyncIterator||"@@asyncIterator",g=p.toStringTag||"@@toStringTag";function h(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{h({},"")}catch{h=function(e,r,a){return e[r]=a}}function P(t,e,r,a){var n=e&&e.prototype instanceof U?e:U,f=Object.create(n.prototype),v=new $(a||[]);return u(f,"_invoke",{value:ve(t,r,v)}),f}o.wrap=P;function O(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(a){return{type:"throw",arg:a}}}var T="suspendedStart",F="suspendedYield",m="executing",R="completed",w={};function U(){}function N(){}function E(){}var B={};h(B,l,function(){return this});var Y=Object.getPrototypeOf,D=Y&&Y(Y(q([])));D&&D!==s&&i.call(D,l)&&(B=D);var L=E.prototype=U.prototype=Object.create(B);N.prototype=E,u(L,"constructor",{value:E,configurable:!0}),u(E,"constructor",{value:N,configurable:!0}),N.displayName=h(E,g,"GeneratorFunction");function re(t){["next","throw","return"].forEach(function(e){h(t,e,function(r){return this._invoke(e,r)})})}o.isGeneratorFunction=function(t){var e=typeof t=="function"&&t.constructor;return e?e===N||(e.displayName||e.name)==="GeneratorFunction":!1},o.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,E):(t.__proto__=E,h(t,g,"GeneratorFunction")),t.prototype=Object.create(L),t},o.awrap=function(t){return{__await:t}};function C(t,e){function r(f,v,d,b){var y=O(t[f],t,v);if(y.type==="throw")b(y.arg);else{var x=y.arg,A=x.value;return A&&typeof A=="object"&&i.call(A,"__await")?e.resolve(A.__await).then(function(_){r("next",_,d,b)},function(_){r("throw",_,d,b)}):e.resolve(A).then(function(_){x.value=_,d(x)},function(_){return r("throw",_,d,b)})}}var a;function n(f,v){function d(){return new e(function(b,y){r(f,v,b,y)})}return a=a?a.then(d,d):d()}u(this,"_invoke",{value:n})}re(C.prototype),h(C.prototype,S,function(){return this}),o.AsyncIterator=C,o.async=function(t,e,r,a,n){n===void 0&&(n=Promise);var f=new C(P(t,e,r,a),n);return o.isGeneratorFunction(e)?f:f.next().then(function(v){return v.done?v.value:f.next()})};function ve(t,e,r){var a=T;return function(f,v){if(a===m)throw new Error("Generator is already running");if(a===R){if(f==="throw")throw v;return ye()}for(r.method=f,r.arg=v;;){var d=r.delegate;if(d){var b=ne(d,r);if(b){if(b===w)continue;return b}}if(r.method==="next")r.sent=r._sent=r.arg;else if(r.method==="throw"){if(a===T)throw a=R,r.arg;r.dispatchException(r.arg)}else r.method==="return"&&r.abrupt("return",r.arg);a=m;var y=O(t,e,r);if(y.type==="normal"){if(a=r.done?R:F,y.arg===w)continue;return{value:y.arg,done:r.done}}else y.type==="throw"&&(a=R,r.method="throw",r.arg=y.arg)}}}function ne(t,e){var r=e.method,a=t.iterator[r];if(a===c)return e.delegate=null,r==="throw"&&t.iterator.return&&(e.method="return",e.arg=c,ne(t,e),e.method==="throw")||r!=="return"&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),w;var n=O(a,t.iterator,e.arg);if(n.type==="throw")return e.method="throw",e.arg=n.arg,e.delegate=null,w;var f=n.arg;if(!f)return e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,w;if(f.done)e[t.resultName]=f.value,e.next=t.nextLoc,e.method!=="return"&&(e.method="next",e.arg=c);else return f;return e.delegate=null,w}re(L),h(L,g,"Generator"),h(L,l,function(){return this}),h(L,"toString",function(){return"[object Generator]"});function de(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function K(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function $(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(de,this),this.reset(!0)}o.keys=function(t){var e=Object(t),r=[];for(var a in e)r.push(a);return r.reverse(),function n(){for(;r.length;){var f=r.pop();if(f in e)return n.value=f,n.done=!1,n}return n.done=!0,n}};function q(t){if(t||t===""){var e=t[l];if(e)return e.call(t);if(typeof t.next=="function")return t;if(!isNaN(t.length)){var r=-1,a=function n(){for(;++r<t.length;)if(i.call(t,r))return n.value=t[r],n.done=!1,n;return n.value=c,n.done=!0,n};return a.next=a}}throw new TypeError(typeof t+" is not iterable")}o.values=q;function ye(){return{value:c,done:!0}}return $.prototype={constructor:$,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=c,this.done=!1,this.delegate=null,this.method="next",this.arg=c,this.tryEntries.forEach(K),!t)for(var e in this)e.charAt(0)==="t"&&i.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=c)},stop:function(){this.done=!0;var t=this.tryEntries[0],e=t.completion;if(e.type==="throw")throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(b,y){return f.type="throw",f.arg=t,e.next=b,y&&(e.method="next",e.arg=c),!!y}for(var a=this.tryEntries.length-1;a>=0;--a){var n=this.tryEntries[a],f=n.completion;if(n.tryLoc==="root")return r("end");if(n.tryLoc<=this.prev){var v=i.call(n,"catchLoc"),d=i.call(n,"finallyLoc");if(v&&d){if(this.prev<n.catchLoc)return r(n.catchLoc,!0);if(this.prev<n.finallyLoc)return r(n.finallyLoc)}else if(v){if(this.prev<n.catchLoc)return r(n.catchLoc,!0)}else if(d){if(this.prev<n.finallyLoc)return r(n.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&i.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var n=a;break}}n&&(t==="break"||t==="continue")&&n.tryLoc<=e&&e<=n.finallyLoc&&(n=null);var f=n?n.completion:{};return f.type=t,f.arg=e,n?(this.method="next",this.next=n.finallyLoc,w):this.complete(f)},complete:function(t,e){if(t.type==="throw")throw t.arg;return t.type==="break"||t.type==="continue"?this.next=t.arg:t.type==="return"?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):t.type==="normal"&&e&&(this.next=e),w},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),K(r),w}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var a=r.completion;if(a.type==="throw"){var n=a.arg;K(r)}return n}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:q(t),resultName:e,nextLoc:r},this.method==="next"&&(this.arg=c),w}},o}(typeof Q=="object"?Q.exports:{});try{regeneratorRuntime=X}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=X:Function("r","regeneratorRuntime = r")(X)}});var mt=Re(se());import{createSDK as Ye}from"@magic-sdk/provider";import*as Ke from"process";import $e from"localforage";import{URL as qe,URLSearchParams as xe}from"whatwg-url";import{Buffer as ee}from"buffer";import*as pe from"lodash";import*as me from"expo-application";import{driverWithoutSerialization as ze}from"@aveq-research/localforage-asyncstorage-driver";import*as te from"localforage-driver-memory";import ce,{useState as fe,useCallback as M,useMemo as Te,useEffect as V}from"react";import{Linking as Ne,StyleSheet as De}from"react-native";import{WebView as Ce}from"react-native-webview";import{SafeAreaView as Ve}from"react-native-safe-area-context";import{ViewController as Ge,createModalNotReadyError as ke}from"@magic-sdk/provider";import{isTypedArray as We}from"lodash";import G from"@react-native-async-storage/async-storage";import{EventRegister as ue}from"react-native-event-listeners";import{useEffect as Ae,useState as Me}from"react";import Pe from"@react-native-community/netinfo";var Z=()=>{let[o,s]=Me(!0);return Ae(()=>{let i=u=>{s(!!u.isConnected)};return Pe.addEventListener(i)},[]),o};var le="MAGIC_PAYLOAD_FLAG_TYPED_ARRAY",je="open_in_device_browser",Fe="#FFFFFF",he="msg_posted_after_inactivity_event",k="lastMessageTime";function Ue(){return De.create({"magic-webview":{flex:1,backgroundColor:"transparent"},"webview-container":{flex:1,width:"100%",backgroundColor:"transparent",position:"absolute",top:0,left:0,right:0,bottom:0},show:{zIndex:1e4,elevation:1e4},hide:{zIndex:-1e4,elevation:0}})}var W=class extends Ge{constructor(){super(...arguments);this.Relayer=i=>{let[u,c]=fe(!1),[p,l]=fe(!0),S=Z();V(()=>{this.isConnectedToInternet=S},[S]),V(()=>(G.setItem(k,""),()=>{this.isReadyForRequest=!1}),[]),V(()=>{ue.addEventListener(he,m=>I(this,null,function*(){this.isReadyForRequest=!1,l(!1),this.post(m.msgType,m.payload),yield G.setItem(k,new Date().toISOString())}))},[]),V(()=>{p||setTimeout(()=>l(!0),10)},[p]);let g=M(m=>{this.webView=m},[]),h=M(m=>{this.container=H(J({},m),{showOverlay:P,hideOverlay:O})},[]),P=M(()=>{c(!0)},[]),O=M(()=>{c(!1)},[]),T=Te(()=>[this.styles["webview-container"],u?H(J({},this.styles.show),{backgroundColor:i!=null?i:Fe}):this.styles.hide],[u]),F=M(m=>{this.handleReactNativeWebViewMessage(m)},[]);return p?ce.createElement(Ve,{ref:h,style:T},ce.createElement(Ce,{ref:g,source:{uri:`${this.endpoint}/send/?params=${encodeURIComponent(this.parameters)}`},onMessage:F,style:this.styles["magic-webview"],autoManageStatusBarEnabled:!1,webviewDebuggingEnabled:!0,onShouldStartLoadWithRequest:m=>new URLSearchParams(m.url.split("?")[1]).get(je)?(Ne.openURL(m.url),!1):!0})):null}}init(){this.webView=null,this.container=null,this.styles=Ue()}handleReactNativeWebViewMessage(i){var u;if(i.nativeEvent&&typeof i.nativeEvent.data=="string"&&(i.nativeEvent.url===`${this.endpoint}/send/?params=${encodeURIComponent(this.parameters)}`||i.nativeEvent.url===`${this.endpoint}/send/?params=${this.parameters}`)){let c=JSON.parse(i.nativeEvent.data,(p,l)=>{try{if(l&&typeof l=="object"&&l.flag&&l.flag===le)return new global[l.constructor](l.data.split(","))}catch(S){}return l});if(c&&c.msgType&&this.messageHandlers.size){c.response=(u=c.response)!=null?u:{};let p={data:c};for(let l of this.messageHandlers.values())l(p)}}}msgPostedAfterInactivity(){return I(this,null,function*(){let i=yield G.getItem(k);if(i){let u=new Date(i).getTime(),c=new Date().getTime(),p=5*60*1e3;return c-u>p}return!1})}hideOverlay(){this.container&&this.container.hideOverlay()}showOverlay(){this.container&&this.container.showOverlay()}_post(i){return I(this,null,function*(){if(yield this.msgPostedAfterInactivity()){ue.emit(he,i);return}if(this.webView&&this.webView.postMessage)this.webView.postMessage(JSON.stringify(i,(u,c)=>We(c)?{constructor:c.constructor.name,data:c.toString(),flag:le}:c),this.endpoint),G.setItem(k,new Date().toISOString());else throw ke()})}checkRelayerExistsInDOM(){return Promise.resolve(!0)}reloadRelayer(){return Promise.resolve(void 0)}};import{SDKBase as Be}from"@magic-sdk/provider";var j=class extends Be{get Relayer(){return this.overlay.Relayer}};export*from"@magic-sdk/commons";global.process=pe.merge(global.process,Ke);global.process.browser=!1;global.Buffer=ee;global.URL=qe;global.URLSearchParams=xe;global.btoa=o=>ee.from(o,"binary").toString("base64");global.atob=o=>ee.from(o,"base64").toString("binary");var Lt=Ye(j,{platform:"react-native",sdkName:"@magic-sdk/react-native-expo",version:"30.0.5",bundleId:me.applicationId,defaultEndpoint:"https://box.magic.link/",ViewController:W,configureStorage:()=>I(void 0,null,function*(){let o=$e.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"}),s=ze();return yield Promise.all([o.defineDriver(s),o.defineDriver(te)]),yield o.setDriver([s._driver,te._driver]),o})});export{Lt as Magic,Z as useInternetConnection};
1
+ var ye=Object.create;var x=Object.defineProperty,ge=Object.defineProperties,we=Object.getOwnPropertyDescriptor,be=Object.getOwnPropertyDescriptors,Se=Object.getOwnPropertyNames,oe=Object.getOwnPropertySymbols,Ee=Object.getPrototypeOf,ae=Object.prototype.hasOwnProperty,_e=Object.prototype.propertyIsEnumerable;var ie=(n,s,i)=>s in n?x(n,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[s]=i,z=(n,s)=>{for(var i in s||(s={}))ae.call(s,i)&&ie(n,i,s[i]);if(oe)for(var i of oe(s))_e.call(s,i)&&ie(n,i,s[i]);return n},J=(n,s)=>ge(n,be(s));var Le=(n,s)=>()=>(s||n((s={exports:{}}).exports,s),s.exports);var Ie=(n,s,i,f)=>{if(s&&typeof s=="object"||typeof s=="function")for(let c of Se(s))!ae.call(n,c)&&c!==i&&x(n,c,{get:()=>s[c],enumerable:!(f=we(s,c))||f.enumerable});return n};var Re=(n,s,i)=>(i=n!=null?ye(Ee(n)):{},Ie(s||!n||!n.__esModule?x(i,"default",{value:n,enumerable:!0}):i,n));var I=(n,s,i)=>new Promise((f,c)=>{var m=l=>{try{b(i.next(l))}catch(S){c(S)}},h=l=>{try{b(i.throw(l))}catch(S){c(S)}},b=l=>l.done?f(l.value):Promise.resolve(l.value).then(m,h);b((i=i.apply(n,s)).next())});var se=Le((Je,X)=>{var H=function(n){"use strict";var s=Object.prototype,i=s.hasOwnProperty,f,c=typeof Symbol=="function"?Symbol:{},m=c.iterator||"@@iterator",h=c.asyncIterator||"@@asyncIterator",b=c.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch{l=function(e,r,a){return e[r]=a}}function S(t,e,r,a){var o=e&&e.prototype instanceof P?e:P,u=Object.create(o.prototype),v=new K(a||[]);return u._invoke=ve(t,r,v),u}n.wrap=S;function R(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(a){return{type:"throw",arg:a}}}var M="suspendedStart",U="suspendedYield",T="executing",p="completed",g={};function P(){}function D(){}function E(){}var B={};l(B,m,function(){return this});var Y=Object.getPrototypeOf,N=Y&&Y(Y($([])));N&&N!==s&&i.call(N,m)&&(B=N);var L=E.prototype=P.prototype=Object.create(B);D.prototype=E,l(L,"constructor",E),l(E,"constructor",D),D.displayName=l(E,b,"GeneratorFunction");function te(t){["next","throw","return"].forEach(function(e){l(t,e,function(r){return this._invoke(e,r)})})}n.isGeneratorFunction=function(t){var e=typeof t=="function"&&t.constructor;return e?e===D||(e.displayName||e.name)==="GeneratorFunction":!1},n.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,E):(t.__proto__=E,l(t,b,"GeneratorFunction")),t.prototype=Object.create(L),t},n.awrap=function(t){return{__await:t}};function C(t,e){function r(u,v,d,w){var y=R(t[u],t,v);if(y.type==="throw")w(y.arg);else{var q=y.arg,O=q.value;return O&&typeof O=="object"&&i.call(O,"__await")?e.resolve(O.__await).then(function(_){r("next",_,d,w)},function(_){r("throw",_,d,w)}):e.resolve(O).then(function(_){q.value=_,d(q)},function(_){return r("throw",_,d,w)})}}var a;function o(u,v){function d(){return new e(function(w,y){r(u,v,w,y)})}return a=a?a.then(d,d):d()}this._invoke=o}te(C.prototype),l(C.prototype,h,function(){return this}),n.AsyncIterator=C,n.async=function(t,e,r,a,o){o===void 0&&(o=Promise);var u=new C(S(t,e,r,a),o);return n.isGeneratorFunction(e)?u:u.next().then(function(v){return v.done?v.value:u.next()})};function ve(t,e,r){var a=M;return function(u,v){if(a===T)throw new Error("Generator is already running");if(a===p){if(u==="throw")throw v;return ne()}for(r.method=u,r.arg=v;;){var d=r.delegate;if(d){var w=re(d,r);if(w){if(w===g)continue;return w}}if(r.method==="next")r.sent=r._sent=r.arg;else if(r.method==="throw"){if(a===M)throw a=p,r.arg;r.dispatchException(r.arg)}else r.method==="return"&&r.abrupt("return",r.arg);a=T;var y=R(t,e,r);if(y.type==="normal"){if(a=r.done?p:U,y.arg===g)continue;return{value:y.arg,done:r.done}}else y.type==="throw"&&(a=p,r.method="throw",r.arg=y.arg)}}}function re(t,e){var r=t.iterator[e.method];if(r===f){if(e.delegate=null,e.method==="throw"){if(t.iterator.return&&(e.method="return",e.arg=f,re(t,e),e.method==="throw"))return g;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return g}var a=R(r,t.iterator,e.arg);if(a.type==="throw")return e.method="throw",e.arg=a.arg,e.delegate=null,g;var o=a.arg;if(!o)return e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,g;if(o.done)e[t.resultName]=o.value,e.next=t.nextLoc,e.method!=="return"&&(e.method="next",e.arg=f);else return o;return e.delegate=null,g}te(L),l(L,b,"Generator"),l(L,m,function(){return this}),l(L,"toString",function(){return"[object Generator]"});function de(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function K(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(de,this),this.reset(!0)}n.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function a(){for(;e.length;){var o=e.pop();if(o in t)return a.value=o,a.done=!1,a}return a.done=!0,a}};function $(t){if(t){var e=t[m];if(e)return e.call(t);if(typeof t.next=="function")return t;if(!isNaN(t.length)){var r=-1,a=function o(){for(;++r<t.length;)if(i.call(t,r))return o.value=t[r],o.done=!1,o;return o.value=f,o.done=!0,o};return a.next=a}}return{next:ne}}n.values=$;function ne(){return{value:f,done:!0}}return K.prototype={constructor:K,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=f,this.done=!1,this.delegate=null,this.method="next",this.arg=f,this.tryEntries.forEach(j),!t)for(var e in this)e.charAt(0)==="t"&&i.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=f)},stop:function(){this.done=!0;var t=this.tryEntries[0],e=t.completion;if(e.type==="throw")throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(w,y){return u.type="throw",u.arg=t,e.next=w,y&&(e.method="next",e.arg=f),!!y}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],u=o.completion;if(o.tryLoc==="root")return r("end");if(o.tryLoc<=this.prev){var v=i.call(o,"catchLoc"),d=i.call(o,"finallyLoc");if(v&&d){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(v){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else if(d){if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&i.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&(t==="break"||t==="continue")&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var u=o?o.completion:{};return u.type=t,u.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(u)},complete:function(t,e){if(t.type==="throw")throw t.arg;return t.type==="break"||t.type==="continue"?this.next=t.arg:t.type==="return"?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):t.type==="normal"&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),j(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var a=r.completion;if(a.type==="throw"){var o=a.arg;j(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:$(t),resultName:e,nextLoc:r},this.method==="next"&&(this.arg=f),g}},n}(typeof X=="object"?X.exports:{});try{regeneratorRuntime=H}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=H:Function("r","regeneratorRuntime = r")(H)}});var pt=Re(se());import{createSDK as Ye}from"@magic-sdk/provider";import*as je from"process";import Ke from"localforage";import{URL as $e,URLSearchParams as qe}from"whatwg-url";import{Buffer as Z}from"buffer";import*as pe from"lodash";import*as me from"expo-application";import{driverWithoutSerialization as xe}from"@aveq-research/localforage-asyncstorage-driver";import*as ee from"localforage-driver-memory";import ce,{useState as fe,useCallback as A,useMemo as Te,useEffect as V}from"react";import{Linking as Pe,StyleSheet as De}from"react-native";import{WebView as Ne}from"react-native-webview";import{SafeAreaView as Ce}from"react-native-safe-area-context";import{ViewController as Ve,createModalNotReadyError as Ge}from"@magic-sdk/provider";import{isTypedArray as ke}from"lodash";import G from"@react-native-async-storage/async-storage";import{EventRegister as le}from"react-native-event-listeners";import{useEffect as Oe,useState as Ae}from"react";import Me from"@react-native-community/netinfo";var Q=()=>{let[n,s]=Ae(!0);return Oe(()=>{let i=f=>{s(!!f.isConnected)};return Me.addEventListener(i)},[]),n};var ue="MAGIC_PAYLOAD_FLAG_TYPED_ARRAY",We="open_in_device_browser",Fe="#FFFFFF",he="msg_posted_after_inactivity_event",k="lastMessageTime";function Ue(){return De.create({"magic-webview":{flex:1,backgroundColor:"transparent"},"webview-container":{flex:1,width:"100%",backgroundColor:"transparent",position:"absolute",top:0,left:0,right:0,bottom:0},show:{zIndex:1e4,elevation:1e4},hide:{zIndex:-1e4,elevation:0}})}var W=class extends Ve{constructor(){super(...arguments);this.Relayer=i=>{let[f,c]=fe(!1),[m,h]=fe(!0),b=Q();V(()=>{this.isConnectedToInternet=b},[b]),V(()=>(G.setItem(k,""),()=>{this.isReadyForRequest=!1}),[]),V(()=>{le.addEventListener(he,p=>I(this,null,function*(){this.isReadyForRequest=!1,h(!1),this.post(p.msgType,p.payload),yield G.setItem(k,new Date().toISOString())}))},[]),V(()=>{m||setTimeout(()=>h(!0),10)},[m]);let l=A(p=>{this.webView=p},[]),S=A(p=>{this.container=J(z({},p),{showOverlay:R,hideOverlay:M})},[]),R=A(()=>{c(!0)},[]),M=A(()=>{c(!1)},[]),U=Te(()=>[this.styles["webview-container"],f?J(z({},this.styles.show),{backgroundColor:i!=null?i:Fe}):this.styles.hide],[f]),T=A(p=>{this.handleReactNativeWebViewMessage(p)},[]);return m?ce.createElement(Ce,{ref:S,style:U},ce.createElement(Ne,{ref:l,source:{uri:`${this.endpoint}/send/?params=${encodeURIComponent(this.parameters)}`},onMessage:T,style:this.styles["magic-webview"],autoManageStatusBarEnabled:!1,webviewDebuggingEnabled:!0,onShouldStartLoadWithRequest:p=>new URLSearchParams(p.url.split("?")[1]).get(We)?(Pe.openURL(p.url),!1):!0})):null}}init(){this.webView=null,this.container=null,this.styles=Ue()}handleReactNativeWebViewMessage(i){var f;if(i.nativeEvent&&typeof i.nativeEvent.data=="string"&&(i.nativeEvent.url===`${this.endpoint}/send/?params=${encodeURIComponent(this.parameters)}`||i.nativeEvent.url===`${this.endpoint}/send/?params=${this.parameters}`)){let c=JSON.parse(i.nativeEvent.data,(m,h)=>{try{if(h&&typeof h=="object"&&h.flag&&h.flag===ue)return new global[h.constructor](h.data.split(","))}catch(b){}return h});if(c&&c.msgType&&this.messageHandlers.size){c.response=(f=c.response)!=null?f:{};let m={data:c};for(let h of this.messageHandlers.values())h(m)}}}msgPostedAfterInactivity(){return I(this,null,function*(){let i=yield G.getItem(k);if(i){let f=new Date(i).getTime(),c=new Date().getTime(),m=5*60*1e3;return c-f>m}return!1})}hideOverlay(){this.container&&this.container.hideOverlay()}showOverlay(){this.container&&this.container.showOverlay()}_post(i){return I(this,null,function*(){if(yield this.msgPostedAfterInactivity()){le.emit(he,i);return}if(this.webView&&this.webView.postMessage)this.webView.postMessage(JSON.stringify(i,(f,c)=>ke(c)?{constructor:c.constructor.name,data:c.toString(),flag:ue}:c),this.endpoint),G.setItem(k,new Date().toISOString());else throw Ge()})}checkRelayerExistsInDOM(){return Promise.resolve(!0)}reloadRelayer(){return Promise.resolve(void 0)}};import{SDKBase as Be}from"@magic-sdk/provider";var F=class extends Be{get Relayer(){return this.overlay.Relayer}};export*from"@magic-sdk/commons";global.process=pe.merge(global.process,je);global.process.browser=!1;global.Buffer=Z;global.URL=$e;global.URLSearchParams=qe;global.btoa=n=>Z.from(n,"binary").toString("base64");global.atob=n=>Z.from(n,"base64").toString("binary");var _t=Ye(F,{platform:"react-native",sdkName:"@magic-sdk/react-native-expo",version:"30.0.5",bundleId:me.applicationId,defaultEndpoint:"https://box.magic.link/",ViewController:W,configureStorage:()=>I(void 0,null,function*(){let n=Ke.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"}),s=xe();return yield Promise.all([n.defineDriver(s),n.defineDriver(ee)]),yield n.setDriver([s._driver,ee._driver]),n})});export{_t as Magic,Q as useInternetConnection};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../node_modules/regenerator-runtime/runtime.js", "../../src/index.ts", "../../src/react-native-webview-controller.tsx", "../../src/hooks.ts", "../../src/react-native-sdk-base.ts"],
4
- "sourcesContent": ["/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; };\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function define(obj, key, value) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n return obj[key];\n }\n try {\n // IE 8 has a broken Object.defineProperty that only works on DOM objects.\n define({}, \"\");\n } catch (err) {\n define = function(obj, key, value) {\n return obj[key] = value;\n };\n }\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) });\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n define(IteratorPrototype, iteratorSymbol, function () {\n return this;\n });\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = GeneratorFunctionPrototype;\n defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: true });\n defineProperty(\n GeneratorFunctionPrototype,\n \"constructor\",\n { value: GeneratorFunction, configurable: true }\n );\n GeneratorFunction.displayName = define(\n GeneratorFunctionPrototype,\n toStringTagSymbol,\n \"GeneratorFunction\"\n );\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n define(prototype, method, function(arg) {\n return this._invoke(method, arg);\n });\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n define(genFun, toStringTagSymbol, \"GeneratorFunction\");\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n defineProperty(this, \"_invoke\", { value: enqueue });\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n define(AsyncIterator.prototype, asyncIteratorSymbol, function () {\n return this;\n });\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var methodName = context.method;\n var method = delegate.iterator[methodName];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method, or a missing .next mehtod, always terminate the\n // yield* loop.\n context.delegate = null;\n\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (methodName === \"throw\" && delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n if (methodName !== \"return\") {\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a '\" + methodName + \"' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n define(Gp, toStringTagSymbol, \"Generator\");\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n define(Gp, iteratorSymbol, function() {\n return this;\n });\n\n define(Gp, \"toString\", function() {\n return \"[object Generator]\";\n });\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(val) {\n var object = Object(val);\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable || iterable === \"\") {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n throw new TypeError(typeof iterable + \" is not iterable\");\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, in modern engines\n // we can explicitly access globalThis. In older engines we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n if (typeof globalThis === \"object\") {\n globalThis.regeneratorRuntime = runtime;\n } else {\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n }\n}\n", "/* istanbul ignore file */\n\nimport 'regenerator-runtime/runtime';\n\nimport { createSDK, InstanceWithExtensions, MagicSDKExtensionsOption } from '@magic-sdk/provider';\nimport * as processPolyfill from 'process';\nimport localForage from 'localforage';\nimport { URL as URLPolyfill, URLSearchParams as URLSearchParamsPolyfill } from 'whatwg-url';\nimport { Buffer } from 'buffer';\nimport * as _ from 'lodash';\nimport * as Application from 'expo-application';\nimport { driverWithoutSerialization } from '@aveq-research/localforage-asyncstorage-driver';\nimport * as memoryDriver from 'localforage-driver-memory';\nimport { ReactNativeWebViewController } from './react-native-webview-controller';\nimport { SDKBaseReactNative } from './react-native-sdk-base';\n\n// Web3 assumes a browser context, so we need\n// to provide `btoa` and `atob` shims.\n\n// We expect `global.process` to be a Node Process for web3.js usage\n// so we replace it here.\nglobal.process = _.merge(global.process, processPolyfill);\n\n(global.process as any).browser = false;\n\n// WHATWG URL requires global `Buffer` access.\nglobal.Buffer = Buffer;\n\n// Setup global WHATWG URL polyfills\nglobal.URL = URLPolyfill as any;\nglobal.URLSearchParams = URLSearchParamsPolyfill as any;\n\n/* istanbul ignore next */\nglobal.btoa = str => Buffer.from(str, 'binary').toString('base64');\n/* istanbul ignore next */\nglobal.atob = b64Encoded => Buffer.from(b64Encoded, 'base64').toString('binary');\n\nexport * from '@magic-sdk/commons';\n\nexport const Magic = createSDK(SDKBaseReactNative, {\n platform: 'react-native',\n sdkName: '@magic-sdk/react-native-expo',\n version: process.env.EXPO_REACT_NATIVE_VERSION!,\n bundleId: Application.applicationId,\n defaultEndpoint: 'https://box.magic.link/',\n ViewController: ReactNativeWebViewController,\n configureStorage: /* istanbul ignore next */ async () => {\n const lf = localForage.createInstance({\n name: 'MagicAuthLocalStorageDB',\n storeName: 'MagicAuthLocalStorage',\n });\n\n const driver = driverWithoutSerialization();\n await Promise.all([lf.defineDriver(driver), lf.defineDriver(memoryDriver)]);\n await lf.setDriver([driver._driver, memoryDriver._driver]);\n\n return lf;\n },\n});\n\nexport type Magic<T extends MagicSDKExtensionsOption<any> = MagicSDKExtensionsOption> = InstanceWithExtensions<\n SDKBaseReactNative,\n T\n>;\n\nexport { useInternetConnection } from './hooks';\n", "import React, { useState, useCallback, useMemo, useEffect } from 'react';\nimport { Linking, StyleSheet, View } from 'react-native';\nimport { WebView } from 'react-native-webview';\nimport { SafeAreaView } from 'react-native-safe-area-context';\nimport { ViewController, createModalNotReadyError } from '@magic-sdk/provider';\nimport { MagicMessageEvent } from '@magic-sdk/types';\nimport { isTypedArray } from 'lodash';\nimport AsyncStorage from '@react-native-async-storage/async-storage';\nimport { EventRegister } from 'react-native-event-listeners';\n/* global NodeJS */\nimport Global = NodeJS.Global;\nimport { useInternetConnection } from './hooks';\n\nconst MAGIC_PAYLOAD_FLAG_TYPED_ARRAY = 'MAGIC_PAYLOAD_FLAG_TYPED_ARRAY';\nconst OPEN_IN_DEVICE_BROWSER = 'open_in_device_browser';\nconst DEFAULT_BACKGROUND_COLOR = '#FFFFFF';\nconst MSG_POSTED_AFTER_INACTIVITY_EVENT = 'msg_posted_after_inactivity_event';\nconst LAST_MESSAGE_TIME = 'lastMessageTime';\n/**\n * Builds the Magic `<WebView>` overlay styles. These base styles enable\n * `<WebView>` UI to render above all other DOM content.\n */\nfunction createWebViewStyles() {\n return StyleSheet.create({\n 'magic-webview': {\n flex: 1,\n backgroundColor: 'transparent',\n },\n\n 'webview-container': {\n flex: 1,\n width: '100%',\n backgroundColor: 'transparent',\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n },\n\n show: {\n zIndex: 10000,\n elevation: 10000,\n },\n\n hide: {\n zIndex: -10000,\n elevation: 0,\n },\n });\n}\n\n/**\n * Overloads React Native's `<View>` with helper methods we require to hide/show\n * the rendered `<WebView>`.\n */\ninterface ViewWrapper extends View {\n showOverlay: () => void;\n hideOverlay: () => void;\n}\n\n/**\n * View controller for the Magic `<WebView>` overlay.\n */\nexport class ReactNativeWebViewController extends ViewController {\n private webView!: WebView | null;\n private container!: ViewWrapper | null;\n private styles: any;\n\n protected init() {\n this.webView = null;\n this.container = null;\n this.styles = createWebViewStyles();\n }\n\n /**\n * Renders a React Native `<WebView>` with built-in message handling to and\n * from the Magic `<iframe>` context.\n */\n // Validating this logic requires lots of React-specific boilerplate. We will\n // revisit this method for unit testing in the future. For now, manual testing\n // is sufficient (this logic is stable right now and not expected to change in\n // the forseeable future).\n /* istanbul ignore next */\n public Relayer: React.FC<{ backgroundColor?: string }> = backgroundColor => {\n const [show, setShow] = useState(false);\n const [mountOverlay, setMountOverlay] = useState(true);\n const isConnected = useInternetConnection();\n\n useEffect(() => {\n this.isConnectedToInternet = isConnected;\n }, [isConnected]);\n\n useEffect(() => {\n // reset lastMessage when webview is first mounted\n AsyncStorage.setItem(LAST_MESSAGE_TIME, '');\n return () => {\n this.isReadyForRequest = false;\n };\n }, []);\n\n useEffect(() => {\n EventRegister.addEventListener(MSG_POSTED_AFTER_INACTIVITY_EVENT, async message => {\n // If inactivity has been determined, the message is posted only after a brief\n // unmount and re-mount of the webview. This is to ensure the webview is accepting messages.\n // iOS kills webview processes after a certain period of inactivity, like when the app is\n // on background for long periods of time.\n this.isReadyForRequest = false;\n setMountOverlay(false);\n this.post(message.msgType, message.payload);\n await AsyncStorage.setItem(LAST_MESSAGE_TIME, new Date().toISOString());\n });\n }, []);\n\n useEffect(() => {\n if (!mountOverlay) {\n // Briefly unmount and re-mount the webview to ensure it's ready to accept messages.\n setTimeout(() => setMountOverlay(true), 10);\n }\n }, [mountOverlay]);\n\n /**\n * Saves a reference to the underlying `<WebView>` node so we can interact\n * with incoming messages.\n */\n const webViewRef = useCallback((webView: any): void => {\n this.webView = webView;\n }, []);\n\n /**\n * Saves a reference to the underlying `<View>` node so we can interact with\n * display styles.\n */\n const containerRef = useCallback((view: any): void => {\n this.container = {\n ...view,\n showOverlay,\n hideOverlay,\n };\n }, []);\n\n /**\n * Show the Magic `<WebView>` overlay.\n */\n const showOverlay = useCallback(() => {\n setShow(true);\n }, []);\n\n /**\n * Hide the Magic `<WebView>` overlay.\n */\n const hideOverlay = useCallback(() => {\n setShow(false);\n }, []);\n\n const containerStyles = useMemo(() => {\n return [\n this.styles['webview-container'],\n show\n ? {\n ...this.styles.show,\n backgroundColor: backgroundColor ?? DEFAULT_BACKGROUND_COLOR,\n }\n : this.styles.hide,\n ];\n }, [show]);\n\n const handleWebViewMessage = useCallback((event: any) => {\n this.handleReactNativeWebViewMessage(event);\n }, []);\n\n if (!mountOverlay) {\n return null;\n }\n\n return (\n <SafeAreaView ref={containerRef} style={containerStyles}>\n <WebView\n ref={webViewRef}\n source={{ uri: `${this.endpoint}/send/?params=${encodeURIComponent(this.parameters)}` }}\n onMessage={handleWebViewMessage}\n style={this.styles['magic-webview']}\n autoManageStatusBarEnabled={false}\n webviewDebuggingEnabled\n onShouldStartLoadWithRequest={event => {\n const queryParams = new URLSearchParams(event.url.split('?')[1]);\n const openInDeviceBrowser = queryParams.get(OPEN_IN_DEVICE_BROWSER);\n\n if (openInDeviceBrowser) {\n Linking.openURL(event.url);\n return false;\n }\n return true;\n }}\n />\n </SafeAreaView>\n );\n };\n\n /**\n * Route incoming messages from a React Native `<WebView>`.\n */\n private handleReactNativeWebViewMessage(event: any) {\n if (\n event.nativeEvent &&\n typeof event.nativeEvent.data === 'string' &&\n /* Backward comaptible */\n (event.nativeEvent.url === `${this.endpoint}/send/?params=${encodeURIComponent(this.parameters)}` ||\n event.nativeEvent.url === `${this.endpoint}/send/?params=${this.parameters}`)\n ) {\n // Special parsing logic when dealing with TypedArray in the payload\n // Such change is required as JSON.stringify will manipulate the object and cause exceptions during parsing\n // The typed Array is stringified in Mgbox with a flag as notation.\n const data: any = JSON.parse(event.nativeEvent.data, (key, value) => {\n try {\n if (value && typeof value === 'object' && value.flag && value.flag === MAGIC_PAYLOAD_FLAG_TYPED_ARRAY) {\n return new (global[value.constructor as keyof Global] as any)(value.data.split(','));\n }\n\n // silently handles exception and return the original copy\n // eslint-disable-next-line no-empty\n } catch (e) {}\n return value;\n });\n\n if (data && data.msgType && this.messageHandlers.size) {\n // If the response object is undefined, we ensure it's at least an\n // empty object before passing to the event listener.\n\n data.response = data.response ?? {};\n\n // Reconstruct event from RN event\n const magicEvent: MagicMessageEvent = { data } as MagicMessageEvent;\n for (const handler of this.messageHandlers.values()) {\n handler(magicEvent);\n }\n }\n }\n }\n\n private async msgPostedAfterInactivity() {\n const lastPostTimestamp: string | null = await AsyncStorage.getItem(LAST_MESSAGE_TIME);\n if (lastPostTimestamp) {\n const lastPostDate = new Date(lastPostTimestamp).getTime();\n const now = new Date().getTime();\n const fiveMinutes = 5 * 60 * 1000;\n\n // there's been inactivity if the new message is posted\n // 5 min or more after the last message.\n return now - lastPostDate > fiveMinutes;\n }\n return false;\n }\n\n protected hideOverlay() {\n if (this.container) this.container.hideOverlay();\n }\n\n protected showOverlay() {\n if (this.container) this.container.showOverlay();\n }\n\n protected async _post(data: any) {\n if (await this.msgPostedAfterInactivity()) {\n EventRegister.emit(MSG_POSTED_AFTER_INACTIVITY_EVENT, data);\n return;\n }\n if (this.webView && (this.webView as any).postMessage) {\n (this.webView as any).postMessage(\n JSON.stringify(data, (key, value) => {\n // parse Typed Array to Stringify object\n if (isTypedArray(value)) {\n return {\n constructor: value.constructor.name,\n data: value.toString(),\n flag: MAGIC_PAYLOAD_FLAG_TYPED_ARRAY,\n };\n }\n return value;\n }),\n this.endpoint,\n );\n AsyncStorage.setItem(LAST_MESSAGE_TIME, new Date().toISOString());\n } else {\n throw createModalNotReadyError();\n }\n }\n\n // Todo - implement these methods\n /* istanbul ignore next */\n protected checkRelayerExistsInDOM(): Promise<boolean> {\n return Promise.resolve(true);\n }\n\n /* istanbul ignore next */\n protected reloadRelayer(): Promise<void> {\n return Promise.resolve(undefined);\n }\n}\n", "import { useEffect, useState } from 'react';\nimport NetInfo, { NetInfoState } from '@react-native-community/netinfo';\n\nexport const useInternetConnection = () => {\n const [isConnected, setIsConnected] = useState(true);\n useEffect(() => {\n const handleConnectionChange = (connectionInfo: NetInfoState) => {\n setIsConnected(!!connectionInfo.isConnected);\n };\n\n // Subscribe to connection changes\n return NetInfo.addEventListener(handleConnectionChange);\n }, []);\n\n return isConnected;\n};\n", "import { SDKBase } from '@magic-sdk/provider';\nimport { ReactNativeWebViewController } from './react-native-webview-controller';\n\nexport class SDKBaseReactNative extends SDKBase {\n public get Relayer() {\n return (this.overlay as ReactNativeWebViewController).Relayer;\n }\n}\n"],
5
- "mappings": "wkCAAA,IAAAA,GAAAC,GAAA,CAAAC,GAAAC,IAAA,CAOA,IAAIC,EAAW,SAAUF,EAAS,CAChC,aAEA,IAAIG,EAAK,OAAO,UACZC,EAASD,EAAG,eACZE,EAAiB,OAAO,gBAAkB,SAAUC,EAAKC,EAAKC,EAAM,CAAEF,EAAIC,GAAOC,EAAK,KAAO,EAC7FC,EACAC,EAAU,OAAO,QAAW,WAAa,OAAS,CAAC,EACnDC,EAAiBD,EAAQ,UAAY,aACrCE,EAAsBF,EAAQ,eAAiB,kBAC/CG,EAAoBH,EAAQ,aAA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GF,EAAG,aAAaI,EAAY,CAAC,CAAC,EAC1E,MAAMJ,EAAG,UAAU,CAACE,EAAO,QAAsB,UAAO,CAAC,EAElDF,CACT,EACF,CAAC",
6
- "names": ["require_runtime", "__commonJSMin", "exports", "module", "runtime", "Op", "hasOwn", "defineProperty", "obj", "key", "desc", "undefined", "$Symbol", "iteratorSymbol", "asyncIteratorSymbol", "toStringTagSymbol", "define", "value", "wrap", "innerFn", "outerFn", "self", "tryLocsList", "protoGenerator", "Generator", "generator", "context", "Context", "makeInvokeMethod", "tryCatch", "fn", "arg", "err", "GenStateSuspendedStart", "GenStateSuspendedYield", "GenStateExecuting", "GenStateCompleted", "ContinueSentinel", "GeneratorFunction", "GeneratorFunctionPrototype", "IteratorPrototype", "getProto", "NativeIteratorPrototype", "values", "Gp", "defineIteratorMethods", "prototype", "method", "genFun", "ctor", "AsyncIterator", "PromiseImpl", "invoke", "resolve", "reject", "record", "result", "unwrapped", "error", "previousPromise", "enqueue", "callInvokeWithMethodAndArg", "iter", "state", "doneResult", "delegate", "delegateResult", "maybeInvokeDelegate", "methodName", "info", "pushTryEntry", "locs", "entry", "resetTryEntry", "val", "object", "keys", "next", "iterable", "iteratorMethod", "i", "skipTempReset", "name", "rootEntry", "rootRecord", "exception", "handle", "loc", "caught", "hasCatch", "hasFinally", "type", "finallyEntry", "afterLoc", "finallyLoc", "tryLoc", "thrown", "resultName", "nextLoc", "import_runtime", "createSDK", "processPolyfill", "localForage", "URLPolyfill", "URLSearchParamsPolyfill", "Buffer", "_", "Application", "driverWithoutSerialization", "memoryDriver", "React", "useState", "useCallback", "useMemo", "useEffect", "Linking", "StyleSheet", "WebView", "SafeAreaView", "ViewController", "createModalNotReadyError", "isTypedArray", "AsyncStorage", "EventRegister", "useEffect", "useState", "NetInfo", "useInternetConnection", "isConnected", "setIsConnected", "handleConnectionChange", "connectionInfo", "MAGIC_PAYLOAD_FLAG_TYPED_ARRAY", "OPEN_IN_DEVICE_BROWSER", "DEFAULT_BACKGROUND_COLOR", "MSG_POSTED_AFTER_INACTIVITY_EVENT", "LAST_MESSAGE_TIME", "createWebViewStyles", "StyleSheet", "ReactNativeWebViewController", "ViewController", "backgroundColor", "show", "setShow", "useState", "mountOverlay", "setMountOverlay", "isConnected", "useInternetConnection", "useEffect", "AsyncStorage", "EventRegister", "message", "__async", "webViewRef", "useCallback", "webView", "containerRef", "view", "__spreadProps", "__spreadValues", "showOverlay", "hideOverlay", "containerStyles", "useMemo", "handleWebViewMessage", "event", "React", "SafeAreaView", "WebView", "Linking", "_a", "data", "key", "value", "e", "magicEvent", "handler", "lastPostTimestamp", "lastPostDate", "now", "fiveMinutes", "isTypedArray", "createModalNotReadyError", "SDKBase", "SDKBaseReactNative", "processPolyfill", "Buffer", "URLPolyfill", "URLSearchParamsPolyfill", "str", "b64Encoded", "Magic", "createSDK", "SDKBaseReactNative", "ReactNativeWebViewController", "__async", "lf", "localForage", "driver", "driverWithoutSerialization", "memoryDriver"]
4
+ "sourcesContent": ["/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function define(obj, key, value) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n return obj[key];\n }\n try {\n // IE 8 has a broken Object.defineProperty that only works on DOM objects.\n define({}, \"\");\n } catch (err) {\n define = function(obj, key, value) {\n return obj[key] = value;\n };\n }\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n define(IteratorPrototype, iteratorSymbol, function () {\n return this;\n });\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = GeneratorFunctionPrototype;\n define(Gp, \"constructor\", GeneratorFunctionPrototype);\n define(GeneratorFunctionPrototype, \"constructor\", GeneratorFunction);\n GeneratorFunction.displayName = define(\n GeneratorFunctionPrototype,\n toStringTagSymbol,\n \"GeneratorFunction\"\n );\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n define(prototype, method, function(arg) {\n return this._invoke(method, arg);\n });\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n define(genFun, toStringTagSymbol, \"GeneratorFunction\");\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n define(AsyncIterator.prototype, asyncIteratorSymbol, function () {\n return this;\n });\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n define(Gp, toStringTagSymbol, \"Generator\");\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n define(Gp, iteratorSymbol, function() {\n return this;\n });\n\n define(Gp, \"toString\", function() {\n return \"[object Generator]\";\n });\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, in modern engines\n // we can explicitly access globalThis. In older engines we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n if (typeof globalThis === \"object\") {\n globalThis.regeneratorRuntime = runtime;\n } else {\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n }\n}\n", "/* istanbul ignore file */\n\nimport 'regenerator-runtime/runtime';\n\nimport { createSDK, InstanceWithExtensions, MagicSDKExtensionsOption } from '@magic-sdk/provider';\nimport * as processPolyfill from 'process';\nimport localForage from 'localforage';\nimport { URL as URLPolyfill, URLSearchParams as URLSearchParamsPolyfill } from 'whatwg-url';\nimport { Buffer } from 'buffer';\nimport * as _ from 'lodash';\nimport * as Application from 'expo-application';\nimport { driverWithoutSerialization } from '@aveq-research/localforage-asyncstorage-driver';\nimport * as memoryDriver from 'localforage-driver-memory';\nimport { ReactNativeWebViewController } from './react-native-webview-controller';\nimport { SDKBaseReactNative } from './react-native-sdk-base';\n\n// Web3 assumes a browser context, so we need\n// to provide `btoa` and `atob` shims.\n\n// We expect `global.process` to be a Node Process for web3.js usage\n// so we replace it here.\nglobal.process = _.merge(global.process, processPolyfill);\n\n(global.process as any).browser = false;\n\n// WHATWG URL requires global `Buffer` access.\nglobal.Buffer = Buffer;\n\n// Setup global WHATWG URL polyfills\nglobal.URL = URLPolyfill as any;\nglobal.URLSearchParams = URLSearchParamsPolyfill as any;\n\n/* istanbul ignore next */\nglobal.btoa = str => Buffer.from(str, 'binary').toString('base64');\n/* istanbul ignore next */\nglobal.atob = b64Encoded => Buffer.from(b64Encoded, 'base64').toString('binary');\n\nexport * from '@magic-sdk/commons';\n\nexport const Magic = createSDK(SDKBaseReactNative, {\n platform: 'react-native',\n sdkName: '@magic-sdk/react-native-expo',\n version: process.env.EXPO_REACT_NATIVE_VERSION!,\n bundleId: Application.applicationId,\n defaultEndpoint: 'https://box.magic.link/',\n ViewController: ReactNativeWebViewController,\n configureStorage: /* istanbul ignore next */ async () => {\n const lf = localForage.createInstance({\n name: 'MagicAuthLocalStorageDB',\n storeName: 'MagicAuthLocalStorage',\n });\n\n const driver = driverWithoutSerialization();\n await Promise.all([lf.defineDriver(driver), lf.defineDriver(memoryDriver)]);\n await lf.setDriver([driver._driver, memoryDriver._driver]);\n\n return lf;\n },\n});\n\nexport type Magic<T extends MagicSDKExtensionsOption<any> = MagicSDKExtensionsOption> = InstanceWithExtensions<\n SDKBaseReactNative,\n T\n>;\n\nexport { useInternetConnection } from './hooks';\n", "import React, { useState, useCallback, useMemo, useEffect } from 'react';\nimport { Linking, StyleSheet, View } from 'react-native';\nimport { WebView } from 'react-native-webview';\nimport { SafeAreaView } from 'react-native-safe-area-context';\nimport { ViewController, createModalNotReadyError } from '@magic-sdk/provider';\nimport { MagicMessageEvent } from '@magic-sdk/types';\nimport { isTypedArray } from 'lodash';\nimport AsyncStorage from '@react-native-async-storage/async-storage';\nimport { EventRegister } from 'react-native-event-listeners';\n/* global NodeJS */\nimport Global = NodeJS.Global;\nimport { useInternetConnection } from './hooks';\n\nconst MAGIC_PAYLOAD_FLAG_TYPED_ARRAY = 'MAGIC_PAYLOAD_FLAG_TYPED_ARRAY';\nconst OPEN_IN_DEVICE_BROWSER = 'open_in_device_browser';\nconst DEFAULT_BACKGROUND_COLOR = '#FFFFFF';\nconst MSG_POSTED_AFTER_INACTIVITY_EVENT = 'msg_posted_after_inactivity_event';\nconst LAST_MESSAGE_TIME = 'lastMessageTime';\n/**\n * Builds the Magic `<WebView>` overlay styles. These base styles enable\n * `<WebView>` UI to render above all other DOM content.\n */\nfunction createWebViewStyles() {\n return StyleSheet.create({\n 'magic-webview': {\n flex: 1,\n backgroundColor: 'transparent',\n },\n\n 'webview-container': {\n flex: 1,\n width: '100%',\n backgroundColor: 'transparent',\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n },\n\n show: {\n zIndex: 10000,\n elevation: 10000,\n },\n\n hide: {\n zIndex: -10000,\n elevation: 0,\n },\n });\n}\n\n/**\n * Overloads React Native's `<View>` with helper methods we require to hide/show\n * the rendered `<WebView>`.\n */\ninterface ViewWrapper extends View {\n showOverlay: () => void;\n hideOverlay: () => void;\n}\n\n/**\n * View controller for the Magic `<WebView>` overlay.\n */\nexport class ReactNativeWebViewController extends ViewController {\n private webView!: WebView | null;\n private container!: ViewWrapper | null;\n private styles: any;\n\n protected init() {\n this.webView = null;\n this.container = null;\n this.styles = createWebViewStyles();\n }\n\n /**\n * Renders a React Native `<WebView>` with built-in message handling to and\n * from the Magic `<iframe>` context.\n */\n // Validating this logic requires lots of React-specific boilerplate. We will\n // revisit this method for unit testing in the future. For now, manual testing\n // is sufficient (this logic is stable right now and not expected to change in\n // the forseeable future).\n /* istanbul ignore next */\n public Relayer: React.FC<{ backgroundColor?: string }> = backgroundColor => {\n const [show, setShow] = useState(false);\n const [mountOverlay, setMountOverlay] = useState(true);\n const isConnected = useInternetConnection();\n\n useEffect(() => {\n this.isConnectedToInternet = isConnected;\n }, [isConnected]);\n\n useEffect(() => {\n // reset lastMessage when webview is first mounted\n AsyncStorage.setItem(LAST_MESSAGE_TIME, '');\n return () => {\n this.isReadyForRequest = false;\n };\n }, []);\n\n useEffect(() => {\n EventRegister.addEventListener(MSG_POSTED_AFTER_INACTIVITY_EVENT, async message => {\n // If inactivity has been determined, the message is posted only after a brief\n // unmount and re-mount of the webview. This is to ensure the webview is accepting messages.\n // iOS kills webview processes after a certain period of inactivity, like when the app is\n // on background for long periods of time.\n this.isReadyForRequest = false;\n setMountOverlay(false);\n this.post(message.msgType, message.payload);\n await AsyncStorage.setItem(LAST_MESSAGE_TIME, new Date().toISOString());\n });\n }, []);\n\n useEffect(() => {\n if (!mountOverlay) {\n // Briefly unmount and re-mount the webview to ensure it's ready to accept messages.\n setTimeout(() => setMountOverlay(true), 10);\n }\n }, [mountOverlay]);\n\n /**\n * Saves a reference to the underlying `<WebView>` node so we can interact\n * with incoming messages.\n */\n const webViewRef = useCallback((webView: any): void => {\n this.webView = webView;\n }, []);\n\n /**\n * Saves a reference to the underlying `<View>` node so we can interact with\n * display styles.\n */\n const containerRef = useCallback((view: any): void => {\n this.container = {\n ...view,\n showOverlay,\n hideOverlay,\n };\n }, []);\n\n /**\n * Show the Magic `<WebView>` overlay.\n */\n const showOverlay = useCallback(() => {\n setShow(true);\n }, []);\n\n /**\n * Hide the Magic `<WebView>` overlay.\n */\n const hideOverlay = useCallback(() => {\n setShow(false);\n }, []);\n\n const containerStyles = useMemo(() => {\n return [\n this.styles['webview-container'],\n show\n ? {\n ...this.styles.show,\n backgroundColor: backgroundColor ?? DEFAULT_BACKGROUND_COLOR,\n }\n : this.styles.hide,\n ];\n }, [show]);\n\n const handleWebViewMessage = useCallback((event: any) => {\n this.handleReactNativeWebViewMessage(event);\n }, []);\n\n if (!mountOverlay) {\n return null;\n }\n\n return (\n <SafeAreaView ref={containerRef} style={containerStyles}>\n <WebView\n ref={webViewRef}\n source={{ uri: `${this.endpoint}/send/?params=${encodeURIComponent(this.parameters)}` }}\n onMessage={handleWebViewMessage}\n style={this.styles['magic-webview']}\n autoManageStatusBarEnabled={false}\n webviewDebuggingEnabled\n onShouldStartLoadWithRequest={event => {\n const queryParams = new URLSearchParams(event.url.split('?')[1]);\n const openInDeviceBrowser = queryParams.get(OPEN_IN_DEVICE_BROWSER);\n\n if (openInDeviceBrowser) {\n Linking.openURL(event.url);\n return false;\n }\n return true;\n }}\n />\n </SafeAreaView>\n );\n };\n\n /**\n * Route incoming messages from a React Native `<WebView>`.\n */\n private handleReactNativeWebViewMessage(event: any) {\n if (\n event.nativeEvent &&\n typeof event.nativeEvent.data === 'string' &&\n /* Backward comaptible */\n (event.nativeEvent.url === `${this.endpoint}/send/?params=${encodeURIComponent(this.parameters)}` ||\n event.nativeEvent.url === `${this.endpoint}/send/?params=${this.parameters}`)\n ) {\n // Special parsing logic when dealing with TypedArray in the payload\n // Such change is required as JSON.stringify will manipulate the object and cause exceptions during parsing\n // The typed Array is stringified in Mgbox with a flag as notation.\n const data: any = JSON.parse(event.nativeEvent.data, (key, value) => {\n try {\n if (value && typeof value === 'object' && value.flag && value.flag === MAGIC_PAYLOAD_FLAG_TYPED_ARRAY) {\n return new (global[value.constructor as keyof Global] as any)(value.data.split(','));\n }\n\n // silently handles exception and return the original copy\n // eslint-disable-next-line no-empty\n } catch (e) {}\n return value;\n });\n\n if (data && data.msgType && this.messageHandlers.size) {\n // If the response object is undefined, we ensure it's at least an\n // empty object before passing to the event listener.\n\n data.response = data.response ?? {};\n\n // Reconstruct event from RN event\n const magicEvent: MagicMessageEvent = { data } as MagicMessageEvent;\n for (const handler of this.messageHandlers.values()) {\n handler(magicEvent);\n }\n }\n }\n }\n\n private async msgPostedAfterInactivity() {\n const lastPostTimestamp: string | null = await AsyncStorage.getItem(LAST_MESSAGE_TIME);\n if (lastPostTimestamp) {\n const lastPostDate = new Date(lastPostTimestamp).getTime();\n const now = new Date().getTime();\n const fiveMinutes = 5 * 60 * 1000;\n\n // there's been inactivity if the new message is posted\n // 5 min or more after the last message.\n return now - lastPostDate > fiveMinutes;\n }\n return false;\n }\n\n protected hideOverlay() {\n if (this.container) this.container.hideOverlay();\n }\n\n protected showOverlay() {\n if (this.container) this.container.showOverlay();\n }\n\n protected async _post(data: any) {\n if (await this.msgPostedAfterInactivity()) {\n EventRegister.emit(MSG_POSTED_AFTER_INACTIVITY_EVENT, data);\n return;\n }\n if (this.webView && (this.webView as any).postMessage) {\n (this.webView as any).postMessage(\n JSON.stringify(data, (key, value) => {\n // parse Typed Array to Stringify object\n if (isTypedArray(value)) {\n return {\n constructor: value.constructor.name,\n data: value.toString(),\n flag: MAGIC_PAYLOAD_FLAG_TYPED_ARRAY,\n };\n }\n return value;\n }),\n this.endpoint,\n );\n AsyncStorage.setItem(LAST_MESSAGE_TIME, new Date().toISOString());\n } else {\n throw createModalNotReadyError();\n }\n }\n\n // Todo - implement these methods\n /* istanbul ignore next */\n protected checkRelayerExistsInDOM(): Promise<boolean> {\n return Promise.resolve(true);\n }\n\n /* istanbul ignore next */\n protected reloadRelayer(): Promise<void> {\n return Promise.resolve(undefined);\n }\n}\n", "import { useEffect, useState } from 'react';\nimport NetInfo, { NetInfoState } from '@react-native-community/netinfo';\n\nexport const useInternetConnection = () => {\n const [isConnected, setIsConnected] = useState(true);\n useEffect(() => {\n const handleConnectionChange = (connectionInfo: NetInfoState) => {\n setIsConnected(!!connectionInfo.isConnected);\n };\n\n // Subscribe to connection changes\n return NetInfo.addEventListener(handleConnectionChange);\n }, []);\n\n return isConnected;\n};\n", "import { SDKBase } from '@magic-sdk/provider';\nimport { ReactNativeWebViewController } from './react-native-webview-controller';\n\nexport class SDKBaseReactNative extends SDKBase {\n public get Relayer() {\n return (this.overlay as ReactNativeWebViewController).Relayer;\n }\n}\n"],
5
+ "mappings": "wkCAAA,IAAAA,GAAAC,GAAA,CAAAC,GAAAC,IAAA,CAOA,IAAIC,EAAW,SAAUF,EAAS,CAChC,aAEA,IAAIG,EAAK,OAAO,UACZC,EAASD,EAAG,eACZE,EACAC,EAAU,OAAO,QAAW,WAAa,OAAS,CAAC,EACnDC,EAAiBD,EAAQ,UAAY,aACrCE,EAAsBF,EAAQ,eAAiB,kBAC/CG,EAAoBH,EAAQ,aAAe,g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undefined", "$Symbol", "iteratorSymbol", "asyncIteratorSymbol", "toStringTagSymbol", "define", "obj", "key", "value", "wrap", "innerFn", "outerFn", "self", "tryLocsList", "protoGenerator", "Generator", "generator", "context", "Context", "makeInvokeMethod", "tryCatch", "fn", "arg", "err", "GenStateSuspendedStart", "GenStateSuspendedYield", "GenStateExecuting", "GenStateCompleted", "ContinueSentinel", "GeneratorFunction", "GeneratorFunctionPrototype", "IteratorPrototype", "getProto", "NativeIteratorPrototype", "values", "Gp", "defineIteratorMethods", "prototype", "method", "genFun", "ctor", "AsyncIterator", "PromiseImpl", "invoke", "resolve", "reject", "record", "result", "unwrapped", "error", "previousPromise", "enqueue", "callInvokeWithMethodAndArg", "iter", "state", "doneResult", "delegate", "delegateResult", "maybeInvokeDelegate", "info", "pushTryEntry", "locs", "entry", "resetTryEntry", "object", "keys", "next", "iterable", "iteratorMethod", "i", "skipTempReset", "name", "rootEntry", "rootRecord", "exception", "handle", "loc", "caught", "hasCatch", "hasFinally", "type", "finallyEntry", "afterLoc", "finallyLoc", "tryLoc", "thrown", "resultName", "nextLoc", "import_runtime", "createSDK", "processPolyfill", "localForage", "URLPolyfill", "URLSearchParamsPolyfill", "Buffer", "_", "Application", "driverWithoutSerialization", "memoryDriver", "React", "useState", "useCallback", "useMemo", "useEffect", "Linking", "StyleSheet", "WebView", "SafeAreaView", "ViewController", "createModalNotReadyError", "isTypedArray", "AsyncStorage", "EventRegister", "useEffect", "useState", "NetInfo", "useInternetConnection", "isConnected", "setIsConnected", "handleConnectionChange", "connectionInfo", "MAGIC_PAYLOAD_FLAG_TYPED_ARRAY", "OPEN_IN_DEVICE_BROWSER", "DEFAULT_BACKGROUND_COLOR", "MSG_POSTED_AFTER_INACTIVITY_EVENT", "LAST_MESSAGE_TIME", "createWebViewStyles", "StyleSheet", "ReactNativeWebViewController", "ViewController", "backgroundColor", "show", "setShow", "useState", "mountOverlay", "setMountOverlay", "isConnected", "useInternetConnection", "useEffect", "AsyncStorage", "EventRegister", "message", "__async", "webViewRef", "useCallback", "webView", "containerRef", "view", "__spreadProps", "__spreadValues", "showOverlay", "hideOverlay", "containerStyles", "useMemo", "handleWebViewMessage", "event", "React", "SafeAreaView", "WebView", "Linking", "_a", "data", "key", "value", "e", "magicEvent", "handler", "lastPostTimestamp", "lastPostDate", "now", "fiveMinutes", "isTypedArray", "createModalNotReadyError", "SDKBase", "SDKBaseReactNative", "processPolyfill", "Buffer", "URLPolyfill", "URLSearchParamsPolyfill", "str", "b64Encoded", "Magic", "createSDK", "SDKBaseReactNative", "ReactNativeWebViewController", "__async", "lf", "localForage", "driver", "driverWithoutSerialization", "memoryDriver"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magic-sdk/react-native-expo",
3
- "version": "30.0.6-canary.877.14347606304.0",
3
+ "version": "30.0.6-canary.877.14349807003.0",
4
4
  "description": "Passwordless authentication for React Native (Expo).",
5
5
  "author": "Magic Labs <team@magic.link> (https://magic.link/)",
6
6
  "license": "MIT",
@@ -18,8 +18,8 @@
18
18
  "types": "./dist/types/index.d.ts",
19
19
  "dependencies": {
20
20
  "@aveq-research/localforage-asyncstorage-driver": "^3.0.1",
21
- "@magic-sdk/commons": "25.0.6-canary.877.14347606304.0",
22
- "@magic-sdk/provider": "29.0.6-canary.877.14347606304.0",
21
+ "@magic-sdk/commons": "25.0.6-canary.877.14349807003.0",
22
+ "@magic-sdk/provider": "29.0.6-canary.877.14349807003.0",
23
23
  "@magic-sdk/types": "^24.18.1",
24
24
  "@react-native-async-storage/async-storage": "^1.15.5",
25
25
  "@types/lodash": "^4.14.158",
@@ -48,7 +48,8 @@
48
48
  "react-native": "^0.78.2",
49
49
  "react-native-safe-area-context": "^5.3.0",
50
50
  "react-native-webview": "^13.13.5",
51
- "react-test-renderer": "^19.1.0"
51
+ "react-test-renderer": "^19.1.0",
52
+ "regenerator-runtime": "0.13.9"
52
53
  },
53
54
  "peerDependencies": {
54
55
  "@react-native-community/netinfo": ">=9.0.0",
@@ -58,5 +59,5 @@
58
59
  "react-native-safe-area-context": ">=4.4.1",
59
60
  "react-native-webview": ">=12.4.0"
60
61
  },
61
- "gitHead": "37c7009d738d3999d08c5def023d014ec8a222b4"
62
+ "gitHead": "8a3ce4676e59dc082800dcdc864c40c9875f5316"
62
63
  }