@magic-sdk/react-native-bare 29.4.1-canary.2dc4381.0 → 29.4.1-canary.3240508.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 Ie=Object.create;var M=Object.defineProperty,Ne=Object.defineProperties,Ae=Object.getOwnPropertyDescriptor,Ce=Object.getOwnPropertyDescriptors,Me=Object.getOwnPropertyNames,ue=Object.getOwnPropertySymbols,Ve=Object.getPrototypeOf,he=Object.prototype.hasOwnProperty,Ge=Object.prototype.propertyIsEnumerable;var le=(n,a,i)=>a in n?M(n,a,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[a]=i,te=(n,a)=>{for(var i in a||(a={}))he.call(a,i)&&le(n,i,a[i]);if(ue)for(var i of ue(a))Ge.call(a,i)&&le(n,i,a[i]);return n},re=(n,a)=>Ne(n,Ce(a));var Pe=(n,a)=>()=>(a||n((a={exports:{}}).exports,a),a.exports),De=(n,a)=>{for(var i in a)M(n,i,{get:a[i],enumerable:!0})},T=(n,a,i,h)=>{if(a&&typeof a=="object"||typeof a=="function")for(let c of Me(a))!he.call(n,c)&&c!==i&&M(n,c,{get:()=>a[c],enumerable:!(h=Ae(a,c))||h.enumerable});return n},l=(n,a,i)=>(T(n,a,"default"),i&&T(i,a,"default")),I=(n,a,i)=>(i=n!=null?Ie(Ve(n)):{},T(a||!n||!n.__esModule?M(i,"default",{value:n,enumerable:!0}):i,n)),ke=n=>T(M({},"__esModule",{value:!0}),n);var W=(n,a,i)=>new Promise((h,c)=>{var S=w=>{try{_(i.next(w))}catch(v){c(v)}},p=w=>{try{_(i.throw(w))}catch(v){c(v)}},_=w=>w.done?h(w.value):Promise.resolve(w.value).then(S,p);_((i=i.apply(n,a)).next())});var pe=Pe((Ye,oe)=>{var ne=function(n){"use strict";var a=Object.prototype,i=a.hasOwnProperty,h=Object.defineProperty||function(t,e,r){t[e]=r.value},c,S=typeof Symbol=="function"?Symbol:{},p=S.iterator||"@@iterator",_=S.asyncIterator||"@@asyncIterator",w=S.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 o=e&&e.prototype instanceof x?e:x,f=Object.create(o.prototype),m=new X(s||[]);return h(f,"_invoke",{value:Re(t,r,m)}),f}n.wrap=V;function A(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(s){return{type:"throw",arg:s}}}var E="suspendedStart",ae="suspendedYield",z="executing",G="completed",L={};function x(){}function P(){}function R(){}var J={};v(J,p,function(){return this});var H=Object.getPrototypeOf,D=H&&H(H(Z([])));D&&D!==a&&i.call(D,p)&&(J=D);var N=R.prototype=x.prototype=Object.create(J);P.prototype=R,h(N,"constructor",{value:R,configurable:!0}),h(R,"constructor",{value:P,configurable:!0}),P.displayName=v(R,w,"GeneratorFunction");function se(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===P||(e.displayName||e.name)==="GeneratorFunction":!1},n.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,R):(t.__proto__=R,v(t,w,"GeneratorFunction")),t.prototype=Object.create(N),t},n.awrap=function(t){return{__await:t}};function k(t,e){function r(f,m,y,b){var g=A(t[f],t,m);if(g.type==="throw")b(g.arg);else{var ee=g.arg,C=ee.value;return C&&typeof C=="object"&&i.call(C,"__await")?e.resolve(C.__await).then(function(O){r("next",O,y,b)},function(O){r("throw",O,y,b)}):e.resolve(C).then(function(O){ee.value=O,y(ee)},function(O){return r("throw",O,y,b)})}}var s;function o(f,m){function y(){return new e(function(b,g){r(f,m,b,g)})}return s=s?s.then(y,y):y()}h(this,"_invoke",{value:o})}se(k.prototype),v(k.prototype,_,function(){return this}),n.AsyncIterator=k,n.async=function(t,e,r,s,o){o===void 0&&(o=Promise);var f=new k(V(t,e,r,s),o);return n.isGeneratorFunction(e)?f:f.next().then(function(m){return m.done?m.value:f.next()})};function Re(t,e,r){var s=E;return function(f,m){if(s===z)throw new Error("Generator is already running");if(s===G){if(f==="throw")throw m;return fe()}for(r.method=f,r.arg=m;;){var y=r.delegate;if(y){var b=ce(y,r);if(b){if(b===L)continue;return b}}if(r.method==="next")r.sent=r._sent=r.arg;else if(r.method==="throw"){if(s===E)throw s=G,r.arg;r.dispatchException(r.arg)}else r.method==="return"&&r.abrupt("return",r.arg);s=z;var g=A(t,e,r);if(g.type==="normal"){if(s=r.done?G:ae,g.arg===L)continue;return{value:g.arg,done:r.done}}else g.type==="throw"&&(s=G,r.method="throw",r.arg=g.arg)}}}function ce(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,ce(t,e),e.method==="throw")||r!=="return"&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),L;var o=A(s,t.iterator,e.arg);if(o.type==="throw")return e.method="throw",e.arg=o.arg,e.delegate=null,L;var f=o.arg;if(!f)return e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,L;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,L}se(N),v(N,w,"Generator"),v(N,p,function(){return this}),v(N,"toString",function(){return"[object Generator]"});function Oe(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 Q(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function X(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(Oe,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 o(){for(;r.length;){var f=r.pop();if(f in e)return o.value=f,o.done=!1,o}return o.done=!0,o}};function Z(t){if(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 o(){for(;++r<t.length;)if(i.call(t,r))return o.value=t[r],o.done=!1,o;return o.value=c,o.done=!0,o};return s.next=s}}return{next:fe}}n.values=Z;function fe(){return{value:c,done:!0}}return X.prototype={constructor:X,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(Q),!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,g){return f.type="throw",f.arg=t,e.next=b,g&&(e.method="next",e.arg=c),!!g}for(var s=this.tryEntries.length-1;s>=0;--s){var o=this.tryEntries[s],f=o.completion;if(o.tryLoc==="root")return r("end");if(o.tryLoc<=this.prev){var m=i.call(o,"catchLoc"),y=i.call(o,"finallyLoc");if(m&&y){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(m){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else if(y){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 s=this.tryEntries[r];if(s.tryLoc<=this.prev&&i.call(s,"finallyLoc")&&this.prev<s.finallyLoc){var o=s;break}}o&&(t==="break"||t==="continue")&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var f=o?o.completion:{};return f.type=t,f.arg=e,o?(this.method="next",this.next=o.finallyLoc,L):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),L},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),Q(r),L}},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 o=s.arg;Q(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:Z(t),resultName:e,nextLoc:r},this.method==="next"&&(this.arg=c),L}},n}(typeof oe=="object"?oe.exports:{});try{regeneratorRuntime=ne}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=ne:Function("r","regeneratorRuntime = r")(ne)}});var u={};De(u,{Magic:()=>Ue,useInternetConnection:()=>B});module.exports=ke(u);var He=I(pe()),be=require("@magic-sdk/provider"),Be=I(require("process")),Se=I(require("localforage")),$=require("whatwg-url"),q=require("buffer"),Ee=I(require("lodash")),Le=require("react-native-device-info"),_e=require("@aveq-research/localforage-asyncstorage-driver"),ie=I(require("localforage-driver-memory"));var d=I(require("react")),F=require("react-native"),me=require("react-native-webview"),ye=require("react-native-safe-area-context"),Y=require("@magic-sdk/provider"),ge=require("lodash");var j=require("react"),ve=I(require("@react-native-community/netinfo")),B=()=>{let[n,a]=(0,j.useState)(!0);return(0,j.useEffect)(()=>{let i=h=>{a(!!h.isConnected)};return ve.default.addEventListener(i)},[]),n};var de="MAGIC_PAYLOAD_FLAG_TYPED_ARRAY",Te="open_in_device_browser",We="#FFFFFF";function je(){return F.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 U=class extends Y.ViewController{constructor(){super(...arguments);this.Relayer=i=>{let[h,c]=(0,d.useState)(!1),S=B();(0,d.useEffect)(()=>{this.isConnectedToInternet=S},[S]),(0,d.useEffect)(()=>()=>{this.isReadyForRequest=!1},[]);let p=(0,d.useCallback)(E=>{this.webView=E},[]),_=(0,d.useCallback)(E=>{this.container=re(te({},E),{showOverlay:w,hideOverlay:v})},[]),w=(0,d.useCallback)(()=>{c(!0)},[]),v=(0,d.useCallback)(()=>{c(!1)},[]),V=(0,d.useMemo)(()=>[this.styles["webview-container"],h?re(te({},this.styles.show),{backgroundColor:i!=null?i:We}):this.styles.hide],[h]),A=(0,d.useCallback)(E=>{this.handleReactNativeWebViewMessage(E)},[]);return d.default.createElement(ye.SafeAreaView,{ref:_,style:V},d.default.createElement(me.WebView,{ref:p,source:{uri:`${this.endpoint}/send/?params=${encodeURIComponent(this.parameters)}`},onMessage:A,style:this.styles["magic-webview"],webviewDebuggingEnabled:!0,autoManageStatusBarEnabled:!1,onShouldStartLoadWithRequest:E=>new URLSearchParams(E.url.split("?")[1]).get(Te)?(F.Linking.openURL(E.url),!1):!0}))}}init(){this.webView=null,this.container=null,this.styles=je()}handleReactNativeWebViewMessage(i){var h;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,(S,p)=>{try{if(p&&typeof p=="object"&&p.flag&&p.flag===de)return new global[p.constructor](p.data.split(","))}catch(_){}return p});if(c&&c.msgType&&this.messageHandlers.size){c.response=(h=c.response)!=null?h:{};let S={data:c};for(let p of this.messageHandlers.values())p(S)}}}hideOverlay(){this.container&&this.container.hideOverlay()}showOverlay(){this.container&&this.container.showOverlay()}_post(i){return W(this,null,function*(){if(this.webView&&this.webView.postMessage)this.webView.postMessage(JSON.stringify(i,(h,c)=>(0,ge.isTypedArray)(c)?{constructor:c.constructor.name,data:c.toString(),flag:de}:c),this.endpoint);else throw(0,Y.createModalNotReadyError)()})}};var we=require("@magic-sdk/provider"),K=class extends we.SDKBase{get Relayer(){return this.overlay.Relayer}};l(u,require("@magic-sdk/commons"),module.exports);global.process=Ee.merge(global.process,Be);global.process.browser=!1;global.Buffer=q.Buffer;global.URL=$.URL;global.URLSearchParams=$.URLSearchParams;global.btoa=n=>q.Buffer.from(n,"binary").toString("base64");global.atob=n=>q.Buffer.from(n,"base64").toString("binary");var Ue=(0,be.createSDK)(K,{platform:"react-native",sdkName:"@magic-sdk/react-native-bare",version:"29.4.0",bundleId:(0,Le.getBundleId)(),defaultEndpoint:"https://box.magic.link/",ViewController:U,configureStorage:()=>W(void 0,null,function*(){let n=Se.default.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"}),a=(0,_e.driverWithoutSerialization)();return yield Promise.all([n.defineDriver(a),n.defineDriver(ie)]),yield n.setDriver([a._driver,ie._driver]),n})});0&&(module.exports={Magic,useInternetConnection});
|
1
|
+
"use strict";var Ne=Object.create;var B=Object.defineProperty,Ce=Object.defineProperties,Me=Object.getOwnPropertyDescriptor,We=Object.getOwnPropertyDescriptors,Ge=Object.getOwnPropertyNames,ve=Object.getOwnPropertySymbols,ke=Object.getPrototypeOf,ye=Object.prototype.hasOwnProperty,je=Object.prototype.propertyIsEnumerable;var ge=(n,i,o)=>i in n?B(n,i,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[i]=o,se=(n,i)=>{for(var o in i||(i={}))ye.call(i,o)&&ge(n,o,i[o]);if(ve)for(var o of ve(i))je.call(i,o)&&ge(n,o,i[o]);return n},ce=(n,i)=>Ce(n,We(i));var Be=(n,i)=>()=>(i||n((i={exports:{}}).exports,i),i.exports),Fe=(n,i)=>{for(var o in i)B(n,o,{get:i[o],enumerable:!0})},K=(n,i,o,h)=>{if(i&&typeof i=="object"||typeof i=="function")for(let c of Ge(i))!ye.call(n,c)&&c!==o&&B(n,c,{get:()=>i[c],enumerable:!(h=Me(i,c))||h.enumerable});return n},u=(n,i,o)=>(K(n,i,"default"),o&&K(o,i,"default")),O=(n,i,o)=>(o=n!=null?Ne(ke(n)):{},K(i||!n||!n.__esModule?B(o,"default",{value:n,enumerable:!0}):o,n)),Ue=n=>K(B({},"__esModule",{value:!0}),n);var N=(n,i,o)=>new Promise((h,c)=>{var d=E=>{try{I(o.next(E))}catch(g){c(g)}},m=E=>{try{I(o.throw(E))}catch(g){c(g)}},I=E=>E.done?h(E.value):Promise.resolve(E.value).then(d,m);I((o=o.apply(n,i)).next())});var we=Be((He,fe)=>{var le=function(n){"use strict";var i=Object.prototype,o=i.hasOwnProperty,h=Object.defineProperty||function(t,e,r){t[e]=r.value},c,d=typeof Symbol=="function"?Symbol:{},m=d.iterator||"@@iterator",I=d.asyncIterator||"@@asyncIterator",E=d.toStringTag||"@@toStringTag";function g(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{g({},"")}catch{g=function(e,r,s){return e[r]=s}}function F(t,e,r,s){var a=e&&e.prototype instanceof k?e:k,l=Object.create(a.prototype),w=new oe(s||[]);return h(l,"_invoke",{value:Te(t,r,w)}),l}n.wrap=F;function W(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(s){return{type:"throw",arg:s}}}var p="suspendedStart",G="suspendedYield",V="executing",T="completed",L={};function k(){}function U(){}function P(){}var te={};g(te,m,function(){return this});var re=Object.getPrototypeOf,Y=re&&re(re(ae([])));Y&&Y!==i&&o.call(Y,m)&&(te=Y);var A=P.prototype=k.prototype=Object.create(te);U.prototype=P,h(A,"constructor",{value:P,configurable:!0}),h(P,"constructor",{value:U,configurable:!0}),U.displayName=g(P,E,"GeneratorFunction");function pe(t){["next","throw","return"].forEach(function(e){g(t,e,function(r){return this._invoke(e,r)})})}n.isGeneratorFunction=function(t){var e=typeof t=="function"&&t.constructor;return e?e===U||(e.displayName||e.name)==="GeneratorFunction":!1},n.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,P):(t.__proto__=P,g(t,E,"GeneratorFunction")),t.prototype=Object.create(A),t},n.awrap=function(t){return{__await:t}};function q(t,e){function r(l,w,b,R){var S=W(t[l],t,w);if(S.type==="throw")R(S.arg);else{var ie=S.arg,j=ie.value;return j&&typeof j=="object"&&o.call(j,"__await")?e.resolve(j.__await).then(function(_){r("next",_,b,R)},function(_){r("throw",_,b,R)}):e.resolve(j).then(function(_){ie.value=_,b(ie)},function(_){return r("throw",_,b,R)})}}var s;function a(l,w){function b(){return new e(function(R,S){r(l,w,R,S)})}return s=s?s.then(b,b):b()}h(this,"_invoke",{value:a})}pe(q.prototype),g(q.prototype,I,function(){return this}),n.AsyncIterator=q,n.async=function(t,e,r,s,a){a===void 0&&(a=Promise);var l=new q(F(t,e,r,s),a);return n.isGeneratorFunction(e)?l:l.next().then(function(w){return w.done?w.value:l.next()})};function Te(t,e,r){var s=p;return function(l,w){if(s===V)throw new Error("Generator is already running");if(s===T){if(l==="throw")throw w;return me()}for(r.method=l,r.arg=w;;){var b=r.delegate;if(b){var R=de(b,r);if(R){if(R===L)continue;return R}}if(r.method==="next")r.sent=r._sent=r.arg;else if(r.method==="throw"){if(s===p)throw s=T,r.arg;r.dispatchException(r.arg)}else r.method==="return"&&r.abrupt("return",r.arg);s=V;var S=W(t,e,r);if(S.type==="normal"){if(s=r.done?T:G,S.arg===L)continue;return{value:S.arg,done:r.done}}else S.type==="throw"&&(s=T,r.method="throw",r.arg=S.arg)}}}function de(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,de(t,e),e.method==="throw")||r!=="return"&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),L;var a=W(s,t.iterator,e.arg);if(a.type==="throw")return e.method="throw",e.arg=a.arg,e.delegate=null,L;var l=a.arg;if(!l)return e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,L;if(l.done)e[t.resultName]=l.value,e.next=t.nextLoc,e.method!=="return"&&(e.method="next",e.arg=c);else return l;return e.delegate=null,L}pe(A),g(A,E,"Generator"),g(A,m,function(){return this}),g(A,"toString",function(){return"[object Generator]"});function Ae(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 ne(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function oe(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(Ae,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 a(){for(;r.length;){var l=r.pop();if(l in e)return a.value=l,a.done=!1,a}return a.done=!0,a}};function ae(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,s=function a(){for(;++r<t.length;)if(o.call(t,r))return a.value=t[r],a.done=!1,a;return a.value=c,a.done=!0,a};return s.next=s}}return{next:me}}n.values=ae;function me(){return{value:c,done:!0}}return oe.prototype={constructor:oe,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(ne),!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(R,S){return l.type="throw",l.arg=t,e.next=R,S&&(e.method="next",e.arg=c),!!S}for(var s=this.tryEntries.length-1;s>=0;--s){var a=this.tryEntries[s],l=a.completion;if(a.tryLoc==="root")return r("end");if(a.tryLoc<=this.prev){var w=o.call(a,"catchLoc"),b=o.call(a,"finallyLoc");if(w&&b){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(w){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else if(b){if(this.prev<a.finallyLoc)return r(a.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 a=s;break}}a&&(t==="break"||t==="continue")&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=t,l.arg=e,a?(this.method="next",this.next=a.finallyLoc,L):this.complete(l)},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),L},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),ne(r),L}},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 a=s.arg;ne(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:ae(t),resultName:e,nextLoc:r},this.method==="next"&&(this.arg=c),L}},n}(typeof fe=="object"?fe.exports:{});try{regeneratorRuntime=le}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=le:Function("r","regeneratorRuntime = r")(le)}});var f={};Fe(f,{Magic:()=>xe,useInternetConnection:()=>x});module.exports=Ue(f);var ot=O(we()),Oe=require("@magic-sdk/provider"),$e=O(require("process")),Pe=O(require("localforage")),Z=require("whatwg-url"),ee=require("buffer"),_e=O(require("lodash")),De=require("react-native-device-info"),Ve=require("@aveq-research/localforage-asyncstorage-driver"),he=O(require("localforage-driver-memory"));var v=O(require("react")),M=require("react-native"),Ee=require("react-native-webview"),Le=require("react-native-safe-area-context"),H=require("@magic-sdk/provider"),Re=require("lodash"),J=require("@datadog/mobile-react-native");var $=require("react"),be=O(require("@react-native-community/netinfo")),x=()=>{let[n,i]=(0,$.useState)(!0);return(0,$.useEffect)(()=>{let o=h=>{i(!!h.isConnected)};return be.default.addEventListener(o)},[]),n};var ue=require("@datadog/mobile-react-native"),y=(n,i={})=>{ue.DdLogs.info(n,{data:i})},D=(n,i={})=>{ue.DdLogs.error(n,{data:i})};var C=O(require("@react-native-async-storage/async-storage"));var Se="MAGIC_PAYLOAD_FLAG_TYPED_ARRAY",Ye="open_in_device_browser",qe="#FFFFFF",Q=new J.DatadogProviderConfiguration("pub7091a72b7044b9398c00ce3f3243327f","nova-rn-prod","f2f99d17-00e4-46f2-b634-26559de9cb44",!0,!0,!0);Q.site="US1";Q.longTaskThresholdMs=100;Q.nativeCrashReportEnabled=!0;function Ke(){return M.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 z=class extends H.ViewController{constructor(){super(...arguments);this.Relayer=o=>{let[h,c]=(0,v.useState)(!1),d=x();(0,v.useEffect)(()=>{this.isConnectedToInternet=d,y("isConnectedToInternet changed",{isConnected:d})},[d]),(0,v.useEffect)(()=>(C.default.setItem("lastPost",""),()=>{y("Relayer unmounted"),this.isReadyForRequest=!1}),[]),(0,v.useEffect)(()=>{M.AppState.addEventListener("change",p=>N(this,null,function*(){var G;if(p==="active"){let V=yield C.default.getItem("lastPost");if(V){let T=new Date(V).getTime(),L=new Date().getTime(),k=10*60*1e3;L-T>k&&(this.isReadyForRequest=!1,(G=this.webView)==null||G.reload(),y("Webview reloaded"))}}y("AppState changed",{newAppState:p})}))},[]);let m=(0,v.useCallback)(p=>{this.webView=p},[]),I=(0,v.useCallback)(p=>{this.container=ce(se({},p),{showOverlay:E,hideOverlay:g})},[]),E=(0,v.useCallback)(()=>{y("showOverlay called"),c(!0)},[]),g=(0,v.useCallback)(()=>{y("hideOverlay called"),c(!1)},[]),F=(0,v.useMemo)(()=>[this.styles["webview-container"],h?ce(se({},this.styles.show),{backgroundColor:o!=null?o:qe}):this.styles.hide],[h]),W=(0,v.useCallback)(p=>{this.handleReactNativeWebViewMessage(p)},[]);return v.default.createElement(J.DatadogProvider,{configuration:Q},v.default.createElement(Le.SafeAreaView,{ref:I,style:F},v.default.createElement(Ee.WebView,{onHttpError:p=>{D("WebView HTTP error",{event:p})},onLoadEnd:()=>{y("WebView load ended")},onLoadProgress:p=>{y("WebView load progress",{event:p})},onLoadStart:()=>{y("WebView load started")},onLayout:()=>{y("WebView layout changed")},onContentProcessDidTerminate:()=>{D("WebView content process terminated")},onError:p=>{D("WebView error",{error:p})},ref:m,source:{uri:`${this.endpoint}/send/?params=${encodeURIComponent(this.parameters)}`},onMessage:W,style:this.styles["magic-webview"],webviewDebuggingEnabled:!0,autoManageStatusBarEnabled:!1,onShouldStartLoadWithRequest:p=>new URLSearchParams(p.url.split("?")[1]).get(Ye)?(M.Linking.openURL(p.url),!1):!0,limitsNavigationsToAppBoundDomains:!0})))}}init(){this.webView=null,this.container=null,this.styles=Ke()}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}`)){y("handleReactNativeWebViewMessage called",JSON.parse(o.nativeEvent.data));let c=JSON.parse(o.nativeEvent.data,(d,m)=>{try{if(m&&typeof m=="object"&&m.flag&&m.flag===Se)return new global[m.constructor](m.data.split(","))}catch(I){D("Error parsing TypedArray",{e:I})}return m});if(c&&c.msgType&&this.messageHandlers.size){c.response=(h=c.response)!=null?h:{};let d={data:c};for(let m of this.messageHandlers.values())m(d)}}}msgPostedAfterInactivity(){return N(this,null,function*(){let o=yield C.default.getItem("lastPost");if(o){let h=new Date(o).getTime(),c=new Date().getTime(),d=10*60*1e3;return c-h>d}return!1})}hideOverlay(){y("hideOverlay called"),this.container&&this.container.hideOverlay()}showOverlay(){y("showOverlay called"),this.container&&this.container.showOverlay()}_post(o){return N(this,null,function*(){var h;if(y("post called",{data:o}),this.webView&&this.webView.postMessage){if(yield this.msgPostedAfterInactivity()){this.isReadyForRequest=!1,(h=this.webView)==null||h.reload(),y("Webview reloaded"),yield C.default.setItem("lastPost",new Date().toDateString()),this._post(o);return}try{yield C.default.setItem("lastPost",new Date().toDateString()),this.webView.postMessage(JSON.stringify(o,(c,d)=>(0,Re.isTypedArray)(d)?{constructor:d.constructor.name,data:d.toString(),flag:Se}:d),this.endpoint)}catch(c){D("post failed",{e:c})}}else throw D("post failed, modal not ready",o),(0,H.createModalNotReadyError)()})}};var Ie=require("@magic-sdk/provider"),X=class extends Ie.SDKBase{get Relayer(){return this.overlay.Relayer}};u(f,require("@magic-sdk/commons"),module.exports);global.process=_e.merge(global.process,$e);global.process.browser=!1;global.Buffer=ee.Buffer;global.URL=Z.URL;global.URLSearchParams=Z.URLSearchParams;global.btoa=n=>ee.Buffer.from(n,"binary").toString("base64");global.atob=n=>ee.Buffer.from(n,"base64").toString("binary");var xe=(0,Oe.createSDK)(X,{platform:"react-native",sdkName:"@magic-sdk/react-native-bare",version:"29.4.0",bundleId:(0,De.getBundleId)(),defaultEndpoint:"https://box.magic.link/",ViewController:z,configureStorage:()=>N(void 0,null,function*(){let n=Pe.default.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"}),i=(0,Ve.driverWithoutSerialization)();return yield Promise.all([n.defineDriver(i),n.defineDriver(he)]),yield n.setDriver([i._driver,he._driver]),n})});0&&(module.exports={Magic,useInternetConnection});
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 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) {\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", "/*\n eslint-disable\n\n global-require,\n @typescript-eslint/no-var-requires\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 { getBundleId } from 'react-native-device-info';\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-bare',\n version: process.env.BARE_REACT_NATIVE_VERSION!,\n bundleId: getBundleId(),\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 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';\n\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 isConnected = useInternetConnection();\n\n useEffect(() => {\n this.isConnectedToInternet = isConnected;\n }, [isConnected]);\n\n useEffect(() => {\n return () => {\n this.isReadyForRequest = false;\n };\n }, []);\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 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 webviewDebuggingEnabled\n autoManageStatusBarEnabled={false}\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 /* eslint-disable-next-line no-param-reassign */\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 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 (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 } else {\n throw createModalNotReadyError();\n }\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 and cleanup on unmount\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,C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K,UAAUN,EAAM,CAACC,EAAKC,OAErB,iBAAaA,CAAK,EACb,CACL,YAAaA,EAAM,YAAY,KAC/B,KAAMA,EAAM,SAAS,EACrB,KAAMzB,EACR,EAEKyB,CACR,EACD,KAAK,QACP,MAEA,SAAM,4BAAyB,CAEnC,GACF,EE7OA,IAAAK,GAAwB,+BAGXC,EAAN,cAAiC,UAAQ,CAC9C,IAAW,SAAU,CACnB,OAAQ,KAAK,QAAyC,OACxD,CACF,EHqCAC,EAAAC,EAAc,8BA5Cd,gBA4BA,OAAO,QAAY,SAAM,OAAO,QAASC,EAAe,EAEvD,OAAO,QAAgB,QAAU,GAGlC,OAAO,OAAS,SAGhB,OAAO,IAAM,EAAAC,IACb,OAAO,gBAAkB,EAAAC,gBAGzB,OAAO,KAAQC,GAAQ,SAAO,KAAKA,EAAK,QAAQ,EAAE,SAAS,QAAQ,EAEnE,OAAO,KAAQC,GAAe,SAAO,KAAKA,EAAY,QAAQ,EAAE,SAAS,QAAQ,EAI1E,IAAMC,MAAQ,cAAUC,EAAoB,CACjD,SAAU,eACV,QAAS,+BACT,QAAS,SACT,YAAU,gBAAY,EACtB,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", "_", "import_react_native_device_info", "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_react", "import_netinfo", "useInternetConnection", "isConnected", "setIsConnected", "handleConnectionChange", "connectionInfo", "NetInfo", "MAGIC_PAYLOAD_FLAG_TYPED_ARRAY", "OPEN_IN_DEVICE_BROWSER", "DEFAULT_BACKGROUND_COLOR", "createWebViewStyles", "ReactNativeWebViewController", "backgroundColor", "show", "setShow", "isConnected", "useInternetConnection", "webViewRef", "webView", "containerRef", "view", "__spreadProps", "__spreadValues", "showOverlay", "hideOverlay", "containerStyles", "handleWebViewMessage", "event", "React", "
|
3
|
+
"sources": ["../../node_modules/regenerator-runtime/runtime.js", "../../src/index.ts", "../../src/react-native-webview-controller.tsx", "../../src/hooks.ts", "../../src/datadog.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) {\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", "/*\n eslint-disable\n\n global-require,\n @typescript-eslint/no-var-requires\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 { getBundleId } from 'react-native-device-info';\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-bare',\n version: process.env.BARE_REACT_NATIVE_VERSION!,\n bundleId: getBundleId(),\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 { AppState, 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 { DatadogProvider, DatadogProviderConfiguration } from '@datadog/mobile-react-native';\nimport Global = NodeJS.Global;\nimport { useInternetConnection } from './hooks';\nimport { logError, logInfo } from './datadog';\nimport AsyncStorage from \"@react-native-async-storage/async-storage\";\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';\n\nconst config = new DatadogProviderConfiguration(\n 'pub7091a72b7044b9398c00ce3f3243327f',\n 'nova-rn-prod',\n 'f2f99d17-00e4-46f2-b634-26559de9cb44',\n true, // track User interactions (e.g.: Tap on buttons. You can use 'accessibilityLabel' element property to give tap action the name, otherwise element type will be reported)\n true, // track XHR Resources\n true, // track Errors\n);\n// Optional: Select your Datadog website (one of \"US1\", \"EU1\", \"US3\", \"US5\", \"AP1\" or \"GOV\")\nconfig.site = 'US1';\n// Optional: Enable JavaScript long task collection\nconfig.longTaskThresholdMs = 100;\n// Optional: enable or disable native crash reports\nconfig.nativeCrashReportEnabled = true;\n\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 isConnected = useInternetConnection();\n\n useEffect(() => {\n this.isConnectedToInternet = isConnected;\n logInfo('isConnectedToInternet changed', { isConnected });\n }, [isConnected]);\n\n useEffect(() => {\n // reset lastPost when webview is first mounted\n AsyncStorage.setItem('lastPost', '')\n return () => {\n logInfo('Relayer unmounted');\n this.isReadyForRequest = false;\n };\n }, []);\n\n useEffect(() => {\n // log AppState\n AppState.addEventListener('change', async (newAppState) => {\n if (newAppState === 'active') {\n const lastPostTimestamp: string | null = await AsyncStorage.getItem('lastPost');\n if (lastPostTimestamp) {\n const lastPostDate = new Date(lastPostTimestamp).getTime();\n const now = new Date().getTime();\n const tenMinutes = 10 * 60 * 1000;\n\n // if last post was more than 10 minutes ago and app\n // is coming from background reload the webview.\n if (now - lastPostDate > tenMinutes) {\n this.isReadyForRequest = false;\n this.webView?.reload();\n logInfo('Webview reloaded');\n }\n }\n }\n logInfo('AppState changed', { newAppState });\n })\n }, []);\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 logInfo('showOverlay called');\n setShow(true);\n }, []);\n\n /**\n * Hide the Magic `<WebView>` overlay.\n */\n const hideOverlay = useCallback(() => {\n logInfo('hideOverlay called');\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 return (\n <DatadogProvider configuration={config}>\n <SafeAreaView ref={containerRef} style={containerStyles}>\n <WebView\n onHttpError={(event) => {\n logError('WebView HTTP error', { event });\n }}\n onLoadEnd={() => {\n logInfo('WebView load ended');\n }}\n onLoadProgress={(event) => {\n logInfo('WebView load progress', { event });\n }}\n onLoadStart={() => {\n logInfo('WebView load started');\n }}\n onLayout={() => {\n logInfo('WebView layout changed');\n }}\n onContentProcessDidTerminate={() => {\n logError('WebView content process terminated');\n }}\n onError={(error) => {\n logError('WebView error', { error });\n }}\n ref={webViewRef}\n source={{ uri: `${this.endpoint}/send/?params=${encodeURIComponent(this.parameters)}` }}\n onMessage={handleWebViewMessage}\n style={this.styles['magic-webview']}\n webviewDebuggingEnabled\n autoManageStatusBarEnabled={false}\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 limitsNavigationsToAppBoundDomains\n />\n </SafeAreaView>\n </DatadogProvider>\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\n logInfo('handleReactNativeWebViewMessage called', JSON.parse(event.nativeEvent.data));\n\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 logError('Error parsing TypedArray', { e });\n }\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 /* eslint-disable-next-line no-param-reassign */\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('lastPost');\n if (lastPostTimestamp) {\n const lastPostDate = new Date(lastPostTimestamp).getTime();\n const now = new Date().getTime();\n const tenMinutes = 10 * 60 * 1000;\n\n // if last post was more than 10 minutes ago, return true;\n return now - lastPostDate > tenMinutes;\n }\n return false;\n }\n\n protected hideOverlay() {\n logInfo('hideOverlay called');\n if (this.container) this.container.hideOverlay();\n }\n\n protected showOverlay() {\n logInfo('showOverlay called');\n if (this.container) this.container.showOverlay();\n }\n\n protected async _post(data: any) {\n logInfo('post called', { data });\n if (this.webView && (this.webView as any).postMessage) {\n // if last post was more than 10 minutes ago, reload the webview.\n if (await this.msgPostedAfterInactivity()) {\n this.isReadyForRequest = false;\n this.webView?.reload();\n logInfo('Webview reloaded');\n\n await AsyncStorage.setItem('lastPost', new Date().toDateString());\n\n this._post(data);\n return;\n }\n\n try {\n await AsyncStorage.setItem('lastPost', new Date().toDateString());\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 } catch (e) {\n logError('post failed', { e });\n }\n } else {\n logError('post failed, modal not ready', data);\n throw createModalNotReadyError();\n }\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 and cleanup on unmount\n return NetInfo.addEventListener(handleConnectionChange);\n }, []);\n\n return isConnected;\n};\n", "import { DdLogs } from '@datadog/mobile-react-native';\n\nexport const logInfo = (msg: string, data: any = {}) => {\n DdLogs.info(msg, { data });\n};\n\nexport const logError = (msg: string, data: any = {}) => {\n DdLogs.error(msg, { data });\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,EAAS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QAASC,EAAe,EAEvD,OAAO,QAAgB,QAAU,GAGlC,OAAO,OAAS,UAGhB,OAAO,IAAM,EAAAC,IACb,OAAO,gBAAkB,EAAAC,gBAGzB,OAAO,KAAQC,GAAQ,UAAO,KAAKA,EAAK,QAAQ,EAAE,SAAS,QAAQ,EAEnE,OAAO,KAAQC,GAAe,UAAO,KAAKA,EAAY,QAAQ,EAAE,SAAS,QAAQ,EAI1E,IAAMC,MAAQ,cAAUC,EAAoB,CACjD,SAAU,eACV,QAAS,+BACT,QAAS,SACT,YAAU,gBAAY,EACtB,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", "_", "import_react_native_device_info", "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_mobile_react_native", "import_react", "import_netinfo", "useInternetConnection", "isConnected", "setIsConnected", "handleConnectionChange", "connectionInfo", "NetInfo", "import_mobile_react_native", "logInfo", "msg", "data", "logError", "import_async_storage", "MAGIC_PAYLOAD_FLAG_TYPED_ARRAY", "OPEN_IN_DEVICE_BROWSER", "DEFAULT_BACKGROUND_COLOR", "config", "createWebViewStyles", "ReactNativeWebViewController", "backgroundColor", "show", "setShow", "isConnected", "useInternetConnection", "logInfo", "AsyncStorage", "newAppState", "__async", "_a", "lastPostTimestamp", "lastPostDate", "now", "tenMinutes", "webViewRef", "webView", "containerRef", "view", "__spreadProps", "__spreadValues", "showOverlay", "hideOverlay", "containerStyles", "handleWebViewMessage", "event", "React", "logError", "error", "data", "key", "value", "e", "magicEvent", "handler", "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 he=Object.create;var K=Object.defineProperty,pe=Object.defineProperties,ve=Object.getOwnPropertyDescriptor,de=Object.getOwnPropertyDescriptors,me=Object.getOwnPropertyNames,re=Object.getOwnPropertySymbols,ye=Object.getPrototypeOf,oe=Object.prototype.hasOwnProperty,ge=Object.prototype.propertyIsEnumerable;var ne=(o,s,i)=>s in o?K(o,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):o[s]=i,$=(o,s)=>{for(var i in s||(s={}))oe.call(s,i)&&ne(o,i,s[i]);if(re)for(var i of re(s))ge.call(s,i)&&ne(o,i,s[i]);return o},q=(o,s)=>pe(o,de(s));var we=(o,s)=>()=>(s||o((s={exports:{}}).exports,s),s.exports);var be=(o,s,i,u)=>{if(s&&typeof s=="object"||typeof s=="function")for(let c of me(s))!oe.call(o,c)&&c!==i&&K(o,c,{get:()=>s[c],enumerable:!(u=ve(s,c))||u.enumerable});return o};var Se=(o,s,i)=>(i=o!=null?he(ye(o)):{},be(s||!o||!o.__esModule?K(i,"default",{value:o,enumerable:!0}):i,o));var G=(o,s,i)=>new Promise((u,c)=>{var g=m=>{try{S(i.next(m))}catch(h){c(h)}},l=m=>{try{S(i.throw(m))}catch(h){c(h)}},S=m=>m.done?u(m.value):Promise.resolve(m.value).then(g,l);S((i=i.apply(o,s)).next())});var ie=we((qe,x)=>{var z=function(o){"use strict";var s=Object.prototype,i=s.hasOwnProperty,u=Object.defineProperty||function(t,e,r){t[e]=r.value},c,g=typeof Symbol=="function"?Symbol:{},l=g.iterator||"@@iterator",S=g.asyncIterator||"@@asyncIterator",m=g.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 N(t,e,r,a){var n=e&&e.prototype instanceof T?e:T,f=Object.create(n.prototype),p=new U(a||[]);return u(f,"_invoke",{value:ue(t,r,p)}),f}o.wrap=N;function R(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(a){return{type:"throw",arg:a}}}var w="suspendedStart",X="suspendedYield",k="executing",A="completed",b={};function T(){}function C(){}function E(){}var W={};h(W,l,function(){return this});var j=Object.getPrototypeOf,M=j&&j(j(F([])));M&&M!==s&&i.call(M,l)&&(W=M);var _=E.prototype=T.prototype=Object.create(W);C.prototype=E,u(_,"constructor",{value:E,configurable:!0}),u(E,"constructor",{value:C,configurable:!0}),C.displayName=h(E,m,"GeneratorFunction");function Z(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===C||(e.displayName||e.name)==="GeneratorFunction":!1},o.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,E):(t.__proto__=E,h(t,m,"GeneratorFunction")),t.prototype=Object.create(_),t},o.awrap=function(t){return{__await:t}};function V(t,e){function r(f,p,v,y){var d=R(t[f],t,p);if(d.type==="throw")y(d.arg);else{var Y=d.arg,O=Y.value;return O&&typeof O=="object"&&i.call(O,"__await")?e.resolve(O.__await).then(function(L){r("next",L,v,y)},function(L){r("throw",L,v,y)}):e.resolve(O).then(function(L){Y.value=L,v(Y)},function(L){return r("throw",L,v,y)})}}var a;function n(f,p){function v(){return new e(function(y,d){r(f,p,y,d)})}return a=a?a.then(v,v):v()}u(this,"_invoke",{value:n})}Z(V.prototype),h(V.prototype,S,function(){return this}),o.AsyncIterator=V,o.async=function(t,e,r,a,n){n===void 0&&(n=Promise);var f=new V(N(t,e,r,a),n);return o.isGeneratorFunction(e)?f:f.next().then(function(p){return p.done?p.value:f.next()})};function ue(t,e,r){var a=w;return function(f,p){if(a===k)throw new Error("Generator is already running");if(a===A){if(f==="throw")throw p;return te()}for(r.method=f,r.arg=p;;){var v=r.delegate;if(v){var y=ee(v,r);if(y){if(y===b)continue;return y}}if(r.method==="next")r.sent=r._sent=r.arg;else if(r.method==="throw"){if(a===w)throw a=A,r.arg;r.dispatchException(r.arg)}else r.method==="return"&&r.abrupt("return",r.arg);a=k;var d=R(t,e,r);if(d.type==="normal"){if(a=r.done?A:X,d.arg===b)continue;return{value:d.arg,done:r.done}}else d.type==="throw"&&(a=A,r.method="throw",r.arg=d.arg)}}}function ee(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,ee(t,e),e.method==="throw")||r!=="return"&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),b;var n=R(a,t.iterator,e.arg);if(n.type==="throw")return e.method="throw",e.arg=n.arg,e.delegate=null,b;var f=n.arg;if(!f)return e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,b;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,b}Z(_),h(_,m,"Generator"),h(_,l,function(){return this}),h(_,"toString",function(){return"[object Generator]"});function le(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 B(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function U(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(le,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 F(t){if(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}}return{next:te}}o.values=F;function te(){return{value:c,done:!0}}return U.prototype={constructor:U,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(B),!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(y,d){return f.type="throw",f.arg=t,e.next=y,d&&(e.method="next",e.arg=c),!!d}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 p=i.call(n,"catchLoc"),v=i.call(n,"finallyLoc");if(p&&v){if(this.prev<n.catchLoc)return r(n.catchLoc,!0);if(this.prev<n.finallyLoc)return r(n.finallyLoc)}else if(p){if(this.prev<n.catchLoc)return r(n.catchLoc,!0)}else if(v){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,b):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),b},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),B(r),b}},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;B(r)}return n}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:F(t),resultName:e,nextLoc:r},this.method==="next"&&(this.arg=c),b}},o}(typeof x=="object"?x.exports:{});try{regeneratorRuntime=z}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=z:Function("r","regeneratorRuntime = r")(z)}});var ct=Se(ie());import{createSDK as We}from"@magic-sdk/provider";import*as je from"process";import Be from"localforage";import{URL as Ue,URLSearchParams as Fe}from"whatwg-url";import{Buffer as H}from"buffer";import*as fe from"lodash";import{getBundleId as Ye}from"react-native-device-info";import{driverWithoutSerialization as Ke}from"@aveq-research/localforage-asyncstorage-driver";import*as Q from"localforage-driver-memory";import ae,{useState as Re,useCallback as I,useMemo as Oe,useEffect as se}from"react";import{Linking as Ie,StyleSheet as Ne}from"react-native";import{WebView as Ae}from"react-native-webview";import{SafeAreaView as Ce}from"react-native-safe-area-context";import{ViewController as Me,createModalNotReadyError as Ve}from"@magic-sdk/provider";import{isTypedArray as Ge}from"lodash";import{useEffect as Ee,useState as Le}from"react";import _e from"@react-native-community/netinfo";var J=()=>{let[o,s]=Le(!0);return Ee(()=>{let i=u=>{s(!!u.isConnected)};return _e.addEventListener(i)},[]),o};var ce="MAGIC_PAYLOAD_FLAG_TYPED_ARRAY",Pe="open_in_device_browser",De="#FFFFFF";function ke(){return Ne.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 P=class extends Me{constructor(){super(...arguments);this.Relayer=i=>{let[u,c]=Re(!1),g=J();se(()=>{this.isConnectedToInternet=g},[g]),se(()=>()=>{this.isReadyForRequest=!1},[]);let l=I(w=>{this.webView=w},[]),S=I(w=>{this.container=q($({},w),{showOverlay:m,hideOverlay:h})},[]),m=I(()=>{c(!0)},[]),h=I(()=>{c(!1)},[]),N=Oe(()=>[this.styles["webview-container"],u?q($({},this.styles.show),{backgroundColor:i!=null?i:De}):this.styles.hide],[u]),R=I(w=>{this.handleReactNativeWebViewMessage(w)},[]);return ae.createElement(Ce,{ref:S,style:N},ae.createElement(Ae,{ref:l,source:{uri:`${this.endpoint}/send/?params=${encodeURIComponent(this.parameters)}`},onMessage:R,style:this.styles["magic-webview"],webviewDebuggingEnabled:!0,autoManageStatusBarEnabled:!1,onShouldStartLoadWithRequest:w=>new URLSearchParams(w.url.split("?")[1]).get(Pe)?(Ie.openURL(w.url),!1):!0}))}}init(){this.webView=null,this.container=null,this.styles=ke()}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,(g,l)=>{try{if(l&&typeof l=="object"&&l.flag&&l.flag===ce)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 g={data:c};for(let l of this.messageHandlers.values())l(g)}}}hideOverlay(){this.container&&this.container.hideOverlay()}showOverlay(){this.container&&this.container.showOverlay()}_post(i){return G(this,null,function*(){if(this.webView&&this.webView.postMessage)this.webView.postMessage(JSON.stringify(i,(u,c)=>Ge(c)?{constructor:c.constructor.name,data:c.toString(),flag:ce}:c),this.endpoint);else throw Ve()})}};import{SDKBase as Te}from"@magic-sdk/provider";var D=class extends Te{get Relayer(){return this.overlay.Relayer}};export*from"@magic-sdk/commons";global.process=fe.merge(global.process,je);global.process.browser=!1;global.Buffer=H;global.URL=Ue;global.URLSearchParams=Fe;global.btoa=o=>H.from(o,"binary").toString("base64");global.atob=o=>H.from(o,"base64").toString("binary");var wt=We(D,{platform:"react-native",sdkName:"@magic-sdk/react-native-bare",version:"29.4.0",bundleId:Ye(),defaultEndpoint:"https://box.magic.link/",ViewController:P,configureStorage:()=>G(void 0,null,function*(){let o=Be.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"}),s=Ke();return yield Promise.all([o.defineDriver(s),o.defineDriver(Q)]),yield o.setDriver([s._driver,Q._driver]),o})});export{wt as Magic,J as useInternetConnection};
|
1
|
+
var ge=Object.create;var H=Object.defineProperty,ye=Object.defineProperties,we=Object.getOwnPropertyDescriptor,be=Object.getOwnPropertyDescriptors,Se=Object.getOwnPropertyNames,ce=Object.getOwnPropertySymbols,Ee=Object.getPrototypeOf,fe=Object.prototype.hasOwnProperty,Le=Object.prototype.propertyIsEnumerable;var le=(n,i,o)=>i in n?H(n,i,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[i]=o,J=(n,i)=>{for(var o in i||(i={}))fe.call(i,o)&&le(n,o,i[o]);if(ce)for(var o of ce(i))Le.call(i,o)&&le(n,o,i[o]);return n},Q=(n,i)=>ye(n,be(i));var Re=(n,i)=>()=>(i||n((i={exports:{}}).exports,i),i.exports);var Ie=(n,i,o,f)=>{if(i&&typeof i=="object"||typeof i=="function")for(let c of Se(i))!fe.call(n,c)&&c!==o&&H(n,c,{get:()=>i[c],enumerable:!(f=we(i,c))||f.enumerable});return n};var Oe=(n,i,o)=>(o=n!=null?ge(Ee(n)):{},Ie(i||!n||!n.__esModule?H(o,"default",{value:n,enumerable:!0}):o,n));var D=(n,i,o)=>new Promise((f,c)=>{var h=w=>{try{E(o.next(w))}catch(d){c(d)}},p=w=>{try{E(o.throw(w))}catch(d){c(d)}},E=w=>w.done?f(w.value):Promise.resolve(w.value).then(h,p);E((o=o.apply(n,i)).next())});var ue=Re((et,Z)=>{var X=function(n){"use strict";var i=Object.prototype,o=i.hasOwnProperty,f=Object.defineProperty||function(t,e,r){t[e]=r.value},c,h=typeof Symbol=="function"?Symbol:{},p=h.iterator||"@@iterator",E=h.asyncIterator||"@@asyncIterator",w=h.toStringTag||"@@toStringTag";function d(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{d({},"")}catch{d=function(e,r,s){return e[r]=s}}function W(t,e,r,s){var a=e&&e.prototype instanceof A?e:A,l=Object.create(a.prototype),v=new $(s||[]);return f(l,"_invoke",{value:me(t,r,v)}),l}n.wrap=W;function V(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(s){return{type:"throw",arg:s}}}var u="suspendedStart",T="suspendedYield",O="executing",P="completed",b={};function A(){}function G(){}function L(){}var Y={};d(Y,p,function(){return this});var q=Object.getPrototypeOf,k=q&&q(q(x([])));k&&k!==i&&o.call(k,p)&&(Y=k);var _=L.prototype=A.prototype=Object.create(Y);G.prototype=L,f(_,"constructor",{value:L,configurable:!0}),f(L,"constructor",{value:G,configurable:!0}),G.displayName=d(L,w,"GeneratorFunction");function ae(t){["next","throw","return"].forEach(function(e){d(t,e,function(r){return this._invoke(e,r)})})}n.isGeneratorFunction=function(t){var e=typeof t=="function"&&t.constructor;return e?e===G||(e.displayName||e.name)==="GeneratorFunction":!1},n.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,L):(t.__proto__=L,d(t,w,"GeneratorFunction")),t.prototype=Object.create(_),t},n.awrap=function(t){return{__await:t}};function j(t,e){function r(l,v,g,S){var y=V(t[l],t,v);if(y.type==="throw")S(y.arg);else{var z=y.arg,N=z.value;return N&&typeof N=="object"&&o.call(N,"__await")?e.resolve(N.__await).then(function(R){r("next",R,g,S)},function(R){r("throw",R,g,S)}):e.resolve(N).then(function(R){z.value=R,g(z)},function(R){return r("throw",R,g,S)})}}var s;function a(l,v){function g(){return new e(function(S,y){r(l,v,S,y)})}return s=s?s.then(g,g):g()}f(this,"_invoke",{value:a})}ae(j.prototype),d(j.prototype,E,function(){return this}),n.AsyncIterator=j,n.async=function(t,e,r,s,a){a===void 0&&(a=Promise);var l=new j(W(t,e,r,s),a);return n.isGeneratorFunction(e)?l:l.next().then(function(v){return v.done?v.value:l.next()})};function me(t,e,r){var s=u;return function(l,v){if(s===O)throw new Error("Generator is already running");if(s===P){if(l==="throw")throw v;return se()}for(r.method=l,r.arg=v;;){var g=r.delegate;if(g){var S=ie(g,r);if(S){if(S===b)continue;return S}}if(r.method==="next")r.sent=r._sent=r.arg;else if(r.method==="throw"){if(s===u)throw s=P,r.arg;r.dispatchException(r.arg)}else r.method==="return"&&r.abrupt("return",r.arg);s=O;var y=V(t,e,r);if(y.type==="normal"){if(s=r.done?P:T,y.arg===b)continue;return{value:y.arg,done:r.done}}else y.type==="throw"&&(s=P,r.method="throw",r.arg=y.arg)}}}function ie(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,ie(t,e),e.method==="throw")||r!=="return"&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),b;var a=V(s,t.iterator,e.arg);if(a.type==="throw")return e.method="throw",e.arg=a.arg,e.delegate=null,b;var l=a.arg;if(!l)return e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,b;if(l.done)e[t.resultName]=l.value,e.next=t.nextLoc,e.method!=="return"&&(e.method="next",e.arg=c);else return l;return e.delegate=null,b}ae(_),d(_,w,"Generator"),d(_,p,function(){return this}),d(_,"toString",function(){return"[object Generator]"});function ve(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(ve,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 a(){for(;r.length;){var l=r.pop();if(l in e)return a.value=l,a.done=!1,a}return a.done=!0,a}};function x(t){if(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 a(){for(;++r<t.length;)if(o.call(t,r))return a.value=t[r],a.done=!1,a;return a.value=c,a.done=!0,a};return s.next=s}}return{next:se}}n.values=x;function se(){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"&&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(S,y){return l.type="throw",l.arg=t,e.next=S,y&&(e.method="next",e.arg=c),!!y}for(var s=this.tryEntries.length-1;s>=0;--s){var a=this.tryEntries[s],l=a.completion;if(a.tryLoc==="root")return r("end");if(a.tryLoc<=this.prev){var v=o.call(a,"catchLoc"),g=o.call(a,"finallyLoc");if(v&&g){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(v){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else if(g){if(this.prev<a.finallyLoc)return r(a.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 a=s;break}}a&&(t==="break"||t==="continue")&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=t,l.arg=e,a?(this.method="next",this.next=a.finallyLoc,b):this.complete(l)},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),b},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),b}},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 a=s.arg;K(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:x(t),resultName:e,nextLoc:r},this.method==="next"&&(this.arg=c),b}},n}(typeof Z=="object"?Z.exports:{});try{regeneratorRuntime=X}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=X:Function("r","regeneratorRuntime = r")(X)}});var St=Oe(ue());import{createSDK as $e}from"@magic-sdk/provider";import*as xe from"process";import ze from"localforage";import{URL as He,URLSearchParams as Je}from"whatwg-url";import{Buffer as ne}from"buffer";import*as de from"lodash";import{getBundleId as Qe}from"react-native-device-info";import{driverWithoutSerialization as Xe}from"@aveq-research/localforage-asyncstorage-driver";import*as oe from"localforage-driver-memory";import te,{useState as Ve,useCallback as C,useMemo as Te,useEffect as re}from"react";import{AppState as Ae,Linking as Ne,StyleSheet as Ce}from"react-native";import{WebView as Me}from"react-native-webview";import{SafeAreaView as We}from"react-native-safe-area-context";import{ViewController as Ge,createModalNotReadyError as ke}from"@magic-sdk/provider";import{isTypedArray as je}from"lodash";import{DatadogProvider as Be,DatadogProviderConfiguration as Fe}from"@datadog/mobile-react-native";import{useEffect as Pe,useState as _e}from"react";import De from"@react-native-community/netinfo";var ee=()=>{let[n,i]=_e(!0);return Pe(()=>{let o=f=>{i(!!f.isConnected)};return De.addEventListener(o)},[]),n};import{DdLogs as he}from"@datadog/mobile-react-native";var m=(n,i={})=>{he.info(n,{data:i})},I=(n,i={})=>{he.error(n,{data:i})};import M from"@react-native-async-storage/async-storage";var pe="MAGIC_PAYLOAD_FLAG_TYPED_ARRAY",Ue="open_in_device_browser",Ye="#FFFFFF",F=new Fe("pub7091a72b7044b9398c00ce3f3243327f","nova-rn-prod","f2f99d17-00e4-46f2-b634-26559de9cb44",!0,!0,!0);F.site="US1";F.longTaskThresholdMs=100;F.nativeCrashReportEnabled=!0;function qe(){return Ce.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 B=class extends Ge{constructor(){super(...arguments);this.Relayer=o=>{let[f,c]=Ve(!1),h=ee();re(()=>{this.isConnectedToInternet=h,m("isConnectedToInternet changed",{isConnected:h})},[h]),re(()=>(M.setItem("lastPost",""),()=>{m("Relayer unmounted"),this.isReadyForRequest=!1}),[]),re(()=>{Ae.addEventListener("change",u=>D(this,null,function*(){var T;if(u==="active"){let O=yield M.getItem("lastPost");if(O){let P=new Date(O).getTime(),b=new Date().getTime(),A=10*60*1e3;b-P>A&&(this.isReadyForRequest=!1,(T=this.webView)==null||T.reload(),m("Webview reloaded"))}}m("AppState changed",{newAppState:u})}))},[]);let p=C(u=>{this.webView=u},[]),E=C(u=>{this.container=Q(J({},u),{showOverlay:w,hideOverlay:d})},[]),w=C(()=>{m("showOverlay called"),c(!0)},[]),d=C(()=>{m("hideOverlay called"),c(!1)},[]),W=Te(()=>[this.styles["webview-container"],f?Q(J({},this.styles.show),{backgroundColor:o!=null?o:Ye}):this.styles.hide],[f]),V=C(u=>{this.handleReactNativeWebViewMessage(u)},[]);return te.createElement(Be,{configuration:F},te.createElement(We,{ref:E,style:W},te.createElement(Me,{onHttpError:u=>{I("WebView HTTP error",{event:u})},onLoadEnd:()=>{m("WebView load ended")},onLoadProgress:u=>{m("WebView load progress",{event:u})},onLoadStart:()=>{m("WebView load started")},onLayout:()=>{m("WebView layout changed")},onContentProcessDidTerminate:()=>{I("WebView content process terminated")},onError:u=>{I("WebView error",{error:u})},ref:p,source:{uri:`${this.endpoint}/send/?params=${encodeURIComponent(this.parameters)}`},onMessage:V,style:this.styles["magic-webview"],webviewDebuggingEnabled:!0,autoManageStatusBarEnabled:!1,onShouldStartLoadWithRequest:u=>new URLSearchParams(u.url.split("?")[1]).get(Ue)?(Ne.openURL(u.url),!1):!0,limitsNavigationsToAppBoundDomains:!0})))}}init(){this.webView=null,this.container=null,this.styles=qe()}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}`)){m("handleReactNativeWebViewMessage called",JSON.parse(o.nativeEvent.data));let c=JSON.parse(o.nativeEvent.data,(h,p)=>{try{if(p&&typeof p=="object"&&p.flag&&p.flag===pe)return new global[p.constructor](p.data.split(","))}catch(E){I("Error parsing TypedArray",{e:E})}return p});if(c&&c.msgType&&this.messageHandlers.size){c.response=(f=c.response)!=null?f:{};let h={data:c};for(let p of this.messageHandlers.values())p(h)}}}msgPostedAfterInactivity(){return D(this,null,function*(){let o=yield M.getItem("lastPost");if(o){let f=new Date(o).getTime(),c=new Date().getTime(),h=10*60*1e3;return c-f>h}return!1})}hideOverlay(){m("hideOverlay called"),this.container&&this.container.hideOverlay()}showOverlay(){m("showOverlay called"),this.container&&this.container.showOverlay()}_post(o){return D(this,null,function*(){var f;if(m("post called",{data:o}),this.webView&&this.webView.postMessage){if(yield this.msgPostedAfterInactivity()){this.isReadyForRequest=!1,(f=this.webView)==null||f.reload(),m("Webview reloaded"),yield M.setItem("lastPost",new Date().toDateString()),this._post(o);return}try{yield M.setItem("lastPost",new Date().toDateString()),this.webView.postMessage(JSON.stringify(o,(c,h)=>je(h)?{constructor:h.constructor.name,data:h.toString(),flag:pe}:h),this.endpoint)}catch(c){I("post failed",{e:c})}}else throw I("post failed, modal not ready",o),ke()})}};import{SDKBase as Ke}from"@magic-sdk/provider";var U=class extends Ke{get Relayer(){return this.overlay.Relayer}};export*from"@magic-sdk/commons";global.process=de.merge(global.process,xe);global.process.browser=!1;global.Buffer=ne;global.URL=He;global.URLSearchParams=Je;global.btoa=n=>ne.from(n,"binary").toString("base64");global.atob=n=>ne.from(n,"base64").toString("binary");var At=$e(U,{platform:"react-native",sdkName:"@magic-sdk/react-native-bare",version:"29.4.0",bundleId:Qe(),defaultEndpoint:"https://box.magic.link/",ViewController:B,configureStorage:()=>D(void 0,null,function*(){let n=ze.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"}),i=Xe();return yield Promise.all([n.defineDriver(i),n.defineDriver(oe)]),yield n.setDriver([i._driver,oe._driver]),n})});export{At as Magic,ee as useInternetConnection};
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/es/index.js.map
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 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) {\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", "/*\n eslint-disable\n\n global-require,\n @typescript-eslint/no-var-requires\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 { getBundleId } from 'react-native-device-info';\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-bare',\n version: process.env.BARE_REACT_NATIVE_VERSION!,\n bundleId: getBundleId(),\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 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';\n\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 isConnected = useInternetConnection();\n\n useEffect(() => {\n this.isConnectedToInternet = isConnected;\n }, [isConnected]);\n\n useEffect(() => {\n return () => {\n this.isReadyForRequest = false;\n };\n }, []);\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 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 webviewDebuggingEnabled\n autoManageStatusBarEnabled={false}\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 /* eslint-disable-next-line no-param-reassign */\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 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 (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 } else {\n throw createModalNotReadyError();\n }\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 and cleanup on unmount\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,E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AAYC,EAAA,wBACvD,IAAMC,EAAKC,GAAY,eAAe,CACpC,KAAM,0BACN,UAAW,uBACb,CAAC,EAEKC,EAASC,GAA2B,EAC1C,aAAM,QAAQ,IAAI,CAACH,EAAG,aAAaE,CAAM,EAAGF,EAAG,aAAaI,CAAY,CAAC,CAAC,EAC1E,MAAMJ,EAAG,UAAU,CAACE,EAAO,QAAsB,SAAO,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", "_", "getBundleId", "driverWithoutSerialization", "memoryDriver", "React", "useState", "useCallback", "useMemo", "useEffect", "Linking", "StyleSheet", "WebView", "SafeAreaView", "ViewController", "createModalNotReadyError", "isTypedArray", "useEffect", "useState", "NetInfo", "useInternetConnection", "isConnected", "setIsConnected", "handleConnectionChange", "connectionInfo", "MAGIC_PAYLOAD_FLAG_TYPED_ARRAY", "OPEN_IN_DEVICE_BROWSER", "DEFAULT_BACKGROUND_COLOR", "createWebViewStyles", "StyleSheet", "ReactNativeWebViewController", "ViewController", "backgroundColor", "show", "setShow", "useState", "isConnected", "useInternetConnection", "useEffect", "webViewRef", "useCallback", "webView", "containerRef", "view", "__spreadProps", "__spreadValues", "showOverlay", "hideOverlay", "containerStyles", "useMemo", "handleWebViewMessage", "event", "React", "SafeAreaView", "WebView", "
|
3
|
+
"sources": ["../../node_modules/regenerator-runtime/runtime.js", "../../src/index.ts", "../../src/react-native-webview-controller.tsx", "../../src/hooks.ts", "../../src/datadog.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) {\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", "/*\n eslint-disable\n\n global-require,\n @typescript-eslint/no-var-requires\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 { getBundleId } from 'react-native-device-info';\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-bare',\n version: process.env.BARE_REACT_NATIVE_VERSION!,\n bundleId: getBundleId(),\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 { AppState, 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 { DatadogProvider, DatadogProviderConfiguration } from '@datadog/mobile-react-native';\nimport Global = NodeJS.Global;\nimport { useInternetConnection } from './hooks';\nimport { logError, logInfo } from './datadog';\nimport AsyncStorage from \"@react-native-async-storage/async-storage\";\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';\n\nconst config = new DatadogProviderConfiguration(\n 'pub7091a72b7044b9398c00ce3f3243327f',\n 'nova-rn-prod',\n 'f2f99d17-00e4-46f2-b634-26559de9cb44',\n true, // track User interactions (e.g.: Tap on buttons. You can use 'accessibilityLabel' element property to give tap action the name, otherwise element type will be reported)\n true, // track XHR Resources\n true, // track Errors\n);\n// Optional: Select your Datadog website (one of \"US1\", \"EU1\", \"US3\", \"US5\", \"AP1\" or \"GOV\")\nconfig.site = 'US1';\n// Optional: Enable JavaScript long task collection\nconfig.longTaskThresholdMs = 100;\n// Optional: enable or disable native crash reports\nconfig.nativeCrashReportEnabled = true;\n\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 isConnected = useInternetConnection();\n\n useEffect(() => {\n this.isConnectedToInternet = isConnected;\n logInfo('isConnectedToInternet changed', { isConnected });\n }, [isConnected]);\n\n useEffect(() => {\n // reset lastPost when webview is first mounted\n AsyncStorage.setItem('lastPost', '')\n return () => {\n logInfo('Relayer unmounted');\n this.isReadyForRequest = false;\n };\n }, []);\n\n useEffect(() => {\n // log AppState\n AppState.addEventListener('change', async (newAppState) => {\n if (newAppState === 'active') {\n const lastPostTimestamp: string | null = await AsyncStorage.getItem('lastPost');\n if (lastPostTimestamp) {\n const lastPostDate = new Date(lastPostTimestamp).getTime();\n const now = new Date().getTime();\n const tenMinutes = 10 * 60 * 1000;\n\n // if last post was more than 10 minutes ago and app\n // is coming from background reload the webview.\n if (now - lastPostDate > tenMinutes) {\n this.isReadyForRequest = false;\n this.webView?.reload();\n logInfo('Webview reloaded');\n }\n }\n }\n logInfo('AppState changed', { newAppState });\n })\n }, []);\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 logInfo('showOverlay called');\n setShow(true);\n }, []);\n\n /**\n * Hide the Magic `<WebView>` overlay.\n */\n const hideOverlay = useCallback(() => {\n logInfo('hideOverlay called');\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 return (\n <DatadogProvider configuration={config}>\n <SafeAreaView ref={containerRef} style={containerStyles}>\n <WebView\n onHttpError={(event) => {\n logError('WebView HTTP error', { event });\n }}\n onLoadEnd={() => {\n logInfo('WebView load ended');\n }}\n onLoadProgress={(event) => {\n logInfo('WebView load progress', { event });\n }}\n onLoadStart={() => {\n logInfo('WebView load started');\n }}\n onLayout={() => {\n logInfo('WebView layout changed');\n }}\n onContentProcessDidTerminate={() => {\n logError('WebView content process terminated');\n }}\n onError={(error) => {\n logError('WebView error', { error });\n }}\n ref={webViewRef}\n source={{ uri: `${this.endpoint}/send/?params=${encodeURIComponent(this.parameters)}` }}\n onMessage={handleWebViewMessage}\n style={this.styles['magic-webview']}\n webviewDebuggingEnabled\n autoManageStatusBarEnabled={false}\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 limitsNavigationsToAppBoundDomains\n />\n </SafeAreaView>\n </DatadogProvider>\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\n logInfo('handleReactNativeWebViewMessage called', JSON.parse(event.nativeEvent.data));\n\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 logError('Error parsing TypedArray', { e });\n }\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 /* eslint-disable-next-line no-param-reassign */\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('lastPost');\n if (lastPostTimestamp) {\n const lastPostDate = new Date(lastPostTimestamp).getTime();\n const now = new Date().getTime();\n const tenMinutes = 10 * 60 * 1000;\n\n // if last post was more than 10 minutes ago, return true;\n return now - lastPostDate > tenMinutes;\n }\n return false;\n }\n\n protected hideOverlay() {\n logInfo('hideOverlay called');\n if (this.container) this.container.hideOverlay();\n }\n\n protected showOverlay() {\n logInfo('showOverlay called');\n if (this.container) this.container.showOverlay();\n }\n\n protected async _post(data: any) {\n logInfo('post called', { data });\n if (this.webView && (this.webView as any).postMessage) {\n // if last post was more than 10 minutes ago, reload the webview.\n if (await this.msgPostedAfterInactivity()) {\n this.isReadyForRequest = false;\n this.webView?.reload();\n logInfo('Webview reloaded');\n\n await AsyncStorage.setItem('lastPost', new Date().toDateString());\n\n this._post(data);\n return;\n }\n\n try {\n await AsyncStorage.setItem('lastPost', new Date().toDateString());\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 } catch (e) {\n logError('post failed', { e });\n }\n } else {\n logError('post failed, modal not ready', data);\n throw createModalNotReadyError();\n }\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 and cleanup on unmount\n return NetInfo.addEventListener(handleConnectionChange);\n }, []);\n\n return isConnected;\n};\n", "import { DdLogs } from '@datadog/mobile-react-native';\n\nexport const logInfo = (msg: string, data: any = {}) => {\n DdLogs.info(msg, { data });\n};\n\nexport const logError = (msg: string, data: any = {}) => {\n DdLogs.error(msg, { data });\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,aAAe,gBAE/C,SAASI,EAAOR,EAAKC,EAAKQ,EAAO,CAC/B,cAAO,eAAeT,EAAKC,EAAK,CAC9B,MAAO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C1C,aAAM,QAAQ,IAAI,CAACH,EAAG,aAAaE,CAAM,EAAGF,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", "_", "getBundleId", "driverWithoutSerialization", "memoryDriver", "React", "useState", "useCallback", "useMemo", "useEffect", "AppState", "Linking", "StyleSheet", "WebView", "SafeAreaView", "ViewController", "createModalNotReadyError", "isTypedArray", "DatadogProvider", "DatadogProviderConfiguration", "useEffect", "useState", "NetInfo", "useInternetConnection", "isConnected", "setIsConnected", "handleConnectionChange", "connectionInfo", "DdLogs", "logInfo", "msg", "data", "logError", "AsyncStorage", "MAGIC_PAYLOAD_FLAG_TYPED_ARRAY", "OPEN_IN_DEVICE_BROWSER", "DEFAULT_BACKGROUND_COLOR", "config", "DatadogProviderConfiguration", "createWebViewStyles", "StyleSheet", "ReactNativeWebViewController", "ViewController", "backgroundColor", "show", "setShow", "useState", "isConnected", "useInternetConnection", "useEffect", "logInfo", "AsyncStorage", "AppState", "newAppState", "__async", "_a", "lastPostTimestamp", "lastPostDate", "now", "tenMinutes", "webViewRef", "useCallback", "webView", "containerRef", "view", "__spreadProps", "__spreadValues", "showOverlay", "hideOverlay", "containerStyles", "useMemo", "handleWebViewMessage", "event", "React", "DatadogProvider", "SafeAreaView", "WebView", "logError", "error", "Linking", "data", "key", "value", "e", "magicEvent", "handler", "isTypedArray", "createModalNotReadyError", "SDKBase", "SDKBaseReactNative", "processPolyfill", "Buffer", "URLPolyfill", "URLSearchParamsPolyfill", "str", "b64Encoded", "Magic", "createSDK", "SDKBaseReactNative", "getBundleId", "ReactNativeWebViewController", "__async", "lf", "localForage", "driver", "driverWithoutSerialization", "memoryDriver"]
|
7
7
|
}
|
@@ -19,6 +19,7 @@ export declare class ReactNativeWebViewController extends ViewController {
|
|
19
19
|
* Route incoming messages from a React Native `<WebView>`.
|
20
20
|
*/
|
21
21
|
private handleReactNativeWebViewMessage;
|
22
|
+
private msgPostedAfterInactivity;
|
22
23
|
protected hideOverlay(): void;
|
23
24
|
protected showOverlay(): void;
|
24
25
|
protected _post(data: any): Promise<void>;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@magic-sdk/react-native-bare",
|
3
|
-
"version": "29.4.1-canary.
|
3
|
+
"version": "29.4.1-canary.3240508.0",
|
4
4
|
"description": "Passwordless authentication for React Native (Bare).",
|
5
5
|
"author": "Magic Labs <team@magic.link> (https://magic.link/)",
|
6
6
|
"license": "MIT",
|
@@ -18,9 +18,10 @@
|
|
18
18
|
"types": "./dist/types/index.d.ts",
|
19
19
|
"dependencies": {
|
20
20
|
"@aveq-research/localforage-asyncstorage-driver": "^3.0.1",
|
21
|
-
"@
|
22
|
-
"@magic-sdk/
|
23
|
-
"@magic-sdk/
|
21
|
+
"@datadog/mobile-react-native": "^2.3.2",
|
22
|
+
"@magic-sdk/commons": "^23.0.0",
|
23
|
+
"@magic-sdk/provider": "^27.0.0",
|
24
|
+
"@magic-sdk/types": "^23.0.0",
|
24
25
|
"@react-native-async-storage/async-storage": "^1.15.5",
|
25
26
|
"@types/lodash": "^4.14.158",
|
26
27
|
"buffer": "~5.6.0",
|
@@ -36,6 +37,7 @@
|
|
36
37
|
"@babel/core": "^7.15.0",
|
37
38
|
"@babel/plugin-transform-flow-strip-types": "^7.14.5",
|
38
39
|
"@babel/runtime": "~7.10.4",
|
40
|
+
"@datadog/mobile-react-native": "^2.3.2",
|
39
41
|
"@react-native-async-storage/async-storage": "^1.15.5",
|
40
42
|
"@react-native-community/netinfo": ">11.0.0",
|
41
43
|
"@testing-library/react-native": "^12.4.0",
|
@@ -56,5 +58,5 @@
|
|
56
58
|
"react-native-safe-area-context": ">=4.4.1",
|
57
59
|
"react-native-webview": ">=12.4.0"
|
58
60
|
},
|
59
|
-
"gitHead": "
|
61
|
+
"gitHead": "32405081dc62bc9529d50ffd86ad4457c475459d"
|
60
62
|
}
|