magic-sdk
Advanced tools
Comparing version 0.1.0-beta.11 to 0.1.0-beta.12
@@ -1,1 +0,1 @@ | ||
module.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=5)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}(r(10))},function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),a=r(3),s=function(e){function t(r,n){var o=e.call(this,"Magic SDK Error: ["+r+"] "+n)||this;return o.code=r,o.__proto__=Error,Object.setPrototypeOf(o,t.prototype),o}return o(t,e),t}(Error);t.MagicSDKError=s;var u=function(){function e(e,t){this.code=e,this.message="Magic SDK Warning: ["+e+"] "+t}return e.prototype.log=function(){console.warn(this.message)},e}();t.MagicSDKWarning=u;var c=function(e){function t(r){var n=e.call(this)||this;n.__proto__=Error;var o=Number(null==r?void 0:r.code),s=(null==r?void 0:r.message)||"Internal error";return n.code=a.isJsonRpcErrorCode(o)?o:i.RPCErrorCode.InternalError,n.message="Magic RPC Error: ["+n.code+"] "+s,Object.setPrototypeOf(n,t.prototype),n}return o(t,e),t}(Error);t.MagicRPCError=c,t.createMissingApiKeyError=function(){return new s(i.SDKErrorCode.MissingApiKey,"Please provide an API key that you acquired from the Magic developer dashboard.")},t.createModalNotReadyError=function(){return new s(i.SDKErrorCode.ModalNotReady,"Modal is not ready.")},t.createMalformedResponseError=function(){return new s(i.SDKErrorCode.MalformedResponse,"Response from the Magic iframe is malformed.")},t.createDuplicateIframeWarning=function(){return new u(i.SDKWarningCode.DuplicateIframe,"Duplicate iframes found.")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(3),o=r(16);t.createJsonRpcRequestPayload=function(e,t){return void 0===t&&(t=[]),{params:t,method:e,jsonrpc:"2.0",id:o.getPayloadId()}};var i=function(){function e(t){t instanceof e?(this._jsonrpc=t.payload.jsonrpc,this._id=t.payload.id,this._result=t.payload.result,this._error=t.payload.error):n.isJsonRpcResponsePayload(t)?(this._jsonrpc=t.jsonrpc,this._id=t.id,this._result=t.result,this._error=t.error):(this._jsonrpc=t.jsonrpc,this._id=t.id,this._result=null,this._error=null)}return e.prototype.applyError=function(e){return this._error=e,this},e.prototype.applyResult=function(e){return this._result=e,this},Object.defineProperty(e.prototype,"hasError",{get:function(){return void 0!==this._error&&null!==this._error},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasResult",{get:function(){return void 0!==this._result&&null!==this._result},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"payload",{get:function(){return{jsonrpc:this._jsonrpc,id:this._id,result:this._result,error:this._error}},enumerable:!0,configurable:!0}),e}();t.JsonRpcResponse=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0);function o(e){return void 0===e}function i(e){return function(e){return null===e}(e)||o(e)}t.isJsonRpcRequestPayload=function(e){return!i(e)&&!(o(e.jsonrpc)||o(e.id)||o(e.method)||o(e.params))},t.isJsonRpcResponsePayload=function(e){return!i(e)&&!(o(e.jsonrpc)||o(e.id)||o(e.result)&&o(e.error))},t.isMagicPayloadMethod=function(e){return!i(e)&&("string"==typeof e&&Object.values(n.MagicPayloadMethod).includes(e))},t.isJsonRpcErrorCode=function(e){return!i(e)&&("number"==typeof e&&Object.values(n.RPCErrorCode).includes(e))}},function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),a=r(1),s=function(){function e(e,t){this.getTransport=e,this.getOverlay=t}return Object.defineProperty(e.prototype,"transport",{get:function(){return this.getTransport()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"overlay",{get:function(){return this.getOverlay()},enumerable:!0,configurable:!0}),e.prototype.request=function(e){return n(this,void 0,void 0,(function(){var t;return o(this,(function(r){switch(r.label){case 0:return[4,this.transport.post(this.overlay,i.MagicOutgoingWindowMessage.MAGIC_HANDLE_REQUEST,e)];case 1:if((t=r.sent()).hasError)throw new a.MagicRPCError(t.payload.error);if(t.hasResult)return[2,t.payload.result];throw a.createMalformedResponseError()}}))}))},e}();t.BaseModule=s},function(e,t,r){e.exports=r(6)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7);t.Magic=n.MagicSDK;var o=r(1);t.SDKError=o.MagicSDKError,t.SDKWarning=o.MagicSDKWarning,t.RPCError=o.MagicRPCError,function(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}(r(0))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(8),o=r(9),i=r(1),a=r(14),s=r(15),u=r(17),c=r(18),l=r(19),d=function(){function e(e,t){var r,a=this;if(this.apiKey=e,!e)throw i.createMissingApiKeyError();this.endpoint=new URL(null!==(r=null==t?void 0:t.endpoint)&&void 0!==r?r:l.MAGIC_URL).origin,this.encodedQueryParams=n.encodeQueryParameters({API_KEY:this.apiKey,DOMAIN_ORIGIN:window.location?window.location.origin:"",host:new URL(this.endpoint).host,sdk:o.name,version:o.version});var s=function(){return a.transport},d=function(){return a.overlay};this.auth=new u.AuthModule(s,d),this.user=new c.UserModule(s,d)}return Object.defineProperty(e.prototype,"transport",{get:function(){return e.__transports__.has(this.encodedQueryParams)||e.__transports__.set(this.encodedQueryParams,new s.PayloadTransport(this.endpoint,this.encodedQueryParams)),e.__transports__.get(this.encodedQueryParams)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"overlay",{get:function(){return e.__overlays__.has(this.encodedQueryParams)||e.__overlays__.set(this.encodedQueryParams,new a.IframeController(this.transport,this.endpoint,this.encodedQueryParams)),e.__overlays__.get(this.encodedQueryParams)},enumerable:!0,configurable:!0}),e.__transports__=new Map,e.__overlays__=new Map,e}();t.MagicSDK=d},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.encodeQueryParameters=function(e){return btoa(JSON.stringify(e))},t.decodeQueryParameters=function(e){return JSON.parse(atob(e))}},function(e){e.exports=JSON.parse('{"name":"magic-sdk","version":"0.1.0-beta.11","description":"","author":"Fortmatic <team@fortmatic.com> (https://fortmatic.com/)","license":"MIT","repository":{"type":"git","url":"https://github.com/fortmatic/magic-js"},"homepage":"https://www.fortmatic.com","main":"dist/cjs/magic.js","types":"dist/cjs/src/index.d.ts","scripts":{"start":"yarn run clean:build && ./scripts/start.sh","build":"yarn run clean:build && ./scripts/build.sh","test":"yarn run clean:test-artifacts && ./scripts/test.sh","lint":"eslint --fix src/**/*.ts","clean":"npm-run-all -s clean:*","clean:test-artifacts":"rimraf coverage && rimraf .nyc_output","clean:build":"rimraf dist","clean_node_modules":"rimraf node_modules"},"dependencies":{},"devDependencies":{"@ikscodes/browser-env":"~0.3.1","@ikscodes/eslint-config":"~6.2.0","@ikscodes/prettier-config":"^0.1.0","@istanbuljs/nyc-config-typescript":"~0.1.3","@types/jsdom":"~12.2.4","@types/sinon":"~7.5.0","@types/webpack":"~4.41.0","@typescript-eslint/eslint-plugin":"~2.17.0","ava":"2.2.0","cli-glob":"^0.1.0","eslint":"~6.8.0","eslint-import-resolver-typescript":"~2.0.0","eslint-plugin-import":"~2.20.0","eslint-plugin-jsx-a11y":"~6.2.3","eslint-plugin-prettier":"~3.1.2","eslint-plugin-react":"~7.18.0","eslint-plugin-react-hooks":"~1.7.0","husky":"^4.2.3","lint-staged":"^10.0.7","npm-run-all":"~4.1.5","nyc":"13.1.0","prettier":"~1.19.1","rimraf":"~3.0.0","sinon":"7.1.1","ts-loader":"~6.2.1","ts-node":"~8.5.2","typescript":"~3.8.3","webpack":"~4.41.2","webpack-chain":"~6.2.0","webpack-cli":"~3.3.10"},"husky":{"hooks":{"pre-commit":"lint-staged"}},"lint-staged":{"*.{ts,tsx}":"eslint --fix"},"ava":{"require":["ts-node/register"],"files":["test/**/*.spec.ts"],"extensions":["ts"],"compileEnhancements":false,"verbose":true},"nyc":{"extends":"@istanbuljs/nyc-config-typescript","all":false,"check-coverage":true,"per-file":true,"lines":99,"statements":99,"functions":99,"branches":99,"reporter":["html","lcov"]}}')},function(e,t,r){"use strict";function n(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}Object.defineProperty(t,"__esModule",{value:!0}),n(r(11)),n(r(12)),n(r(13))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.LoginWithMagicLink="magic_auth_login_with_magic_link",e.GetIdToken="magic_auth_get_id_token",e.GetMetadata="magic_auth_get_metadata",e.IsLoggedIn="magic_auth_is_logged_in",e.Logout="magic_auth_logout"}(t.MagicPayloadMethod||(t.MagicPayloadMethod={}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.MAGIC_HANDLE_RESPONSE="MAGIC_HANDLE_RESPONSE",e.MAGIC_OVERLAY_READY="MAGIC_OVERLAY_READY",e.MAGIC_SHOW_OVERLAY="MAGIC_SHOW_OVERLAY",e.MAGIC_HIDE_OVERLAY="MAGIC_HIDE_OVERLAY"}(t.MagicIncomingWindowMessage||(t.MagicIncomingWindowMessage={})),function(e){e.MAGIC_HANDLE_REQUEST="MAGIC_HANDLE_REQUEST"}(t.MagicOutgoingWindowMessage||(t.MagicOutgoingWindowMessage={}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.MissingApiKey="MISSING_API_KEY",e.ModalNotReady="MODAL_NOT_READY",e.MalformedResponse="MALFORMED_RESPONSE"}(t.SDKErrorCode||(t.SDKErrorCode={})),function(e){e.DuplicateIframe="DUPLICATE_IFRAME"}(t.SDKWarningCode||(t.SDKWarningCode={})),function(e){e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.MagicLinkFailedVerification=-1e4]="MagicLinkFailedVerification",e[e.MagicLinkExpired=-10001]="MagicLinkExpired",e[e.MagicLinkRateLimited=-10002]="MagicLinkRateLimited",e[e.UserAlreadyLoggedIn=-10003]="UserAlreadyLoggedIn"}(t.RPCErrorCode||(t.RPCErrorCode={}))},function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var s=r(0),u=r(1),c={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"};var l=function(){function e(e,t,r){this.transport=e,this.endpoint=t,this.encodedQueryParams=r,this.iframe=this.init(),this.ready=this.waitForReady(),this.listen()}return e.prototype.init=function(){var e=this;return new Promise((function(t){var r=function(){if(o=e.encodedQueryParams,s=[].slice.call(document.querySelectorAll(".magic-iframe")),Boolean(s.find((function(e){return e.src.includes(o)}))))u.createDuplicateIframeWarning().log();else{var r=document.createElement("iframe");r.classList.add("magic-iframe"),r.dataset.magicIframeLabel=new URL(e.endpoint).host,r.src=new URL("/send?params="+e.encodedQueryParams,e.endpoint).href,function(e){var t,r;try{for(var n=i(Object.entries(c)),o=n.next();!o.done;o=n.next()){var s=a(o.value,2),u=s[0],l=s[1];e.style[u]=l}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}}(r),document.body.appendChild(r);var n=document.createElement("img");n.src="https://static.fortmatic.com/assets/trans.gif",n.style.position="fixed",document.body.appendChild(n),t(r)}var o,s};["loaded","interactive","complete"].includes(document.readyState)?r():window.addEventListener("load",r,!1)}))},e.prototype.showOverlay=function(){return n(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,this.iframe];case 1:return e.sent().style.display="block",[2]}}))}))},e.prototype.hideOverlay=function(){return n(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,this.iframe];case 1:return e.sent().style.display="none",[2]}}))}))},e.prototype.waitForReady=function(){var e=this;return new Promise((function(t){e.transport.on(s.MagicIncomingWindowMessage.MAGIC_OVERLAY_READY,(function(){return t()}))}))},e.prototype.listen=function(){var e=this;this.transport.on(s.MagicIncomingWindowMessage.MAGIC_HIDE_OVERLAY,(function(){e.hideOverlay()})),this.transport.on(s.MagicIncomingWindowMessage.MAGIC_SHOW_OVERLAY,(function(){e.showOverlay()}))},e}();t.IframeController=l},function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=r(0),s=r(2),u=r(1);var c=function(){function e(e,t){this.endpoint=e,this.encodedQueryParams=t,this.messageHandlers=new Set,this.initMessageListener()}return e.prototype.post=function(e,t,r){return n(this,void 0,void 0,(function(){var n,i=this;return o(this,(function(o){switch(o.label){case 0:return[4,e.ready];case 1:return o.sent(),[4,e.iframe];case 2:return n=o.sent(),[2,new Promise((function(e,o){if(n.contentWindow){n.contentWindow.postMessage({msgType:t+"-"+i.encodedQueryParams,payload:r},"*");var c=i.on(a.MagicIncomingWindowMessage.MAGIC_HANDLE_RESPONSE,(l=function(){return c()},function(t){var n=function(e,t){var r,n,o,i,a=new s.JsonRpcResponse(e).applyResult(null===(r=t.data.response)||void 0===r?void 0:r.result).applyError(null===(n=t.data.response)||void 0===n?void 0:n.error);return{id:null!==(i=null===(o=t.data.response)||void 0===o?void 0:o.id)&&void 0!==i?i:void 0,response:a}}(r,t),o=n.id,i=n.response;o&&o===r.id&&(l(),e(i))}))}else o(u.createModalNotReadyError());var l}))]}}))}))},e.prototype.on=function(e,t){var r=this,n=t.bind(window),o=function(t){t.data.msgType===e+"-"+r.encodedQueryParams&&n(t)};return this.messageHandlers.add(o),function(){return r.messageHandlers.delete(o)}},e.prototype.initMessageListener=function(){var e=this;window.addEventListener("message",(function(t){var r,n,o;if(t.origin===e.endpoint&&t.data&&t.data.msgType&&e.messageHandlers.size){t.data.response=null!==(o=t.data.response)&&void 0!==o?o:{};try{for(var a=i(e.messageHandlers.values()),s=a.next();!s.done;s=a.next()){(0,s.value)(t)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}}}))},e}();t.PayloadTransport=c},function(e,t,r){"use strict";var n=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var o=function(){var e;return n(this,(function(t){switch(t.label){case 0:e=0,t.label=1;case 1:return e<Number.MAX_SAFE_INTEGER?[4,++e]:[3,3];case 2:return t.sent(),[3,4];case 3:e=0,t.label=4;case 4:return[3,1];case 5:return[2]}}))}();t.getPayloadId=function(){return o.next().value}},function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}u((n=n.apply(e,t||[])).next())}))},a=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var s=r(4),u=r(0),c=r(2),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.loginWithMagicLink=function(e){return i(this,void 0,void 0,(function(){var t,r,n,o;return a(this,(function(i){return t=e.email,r=e.showUI,n=void 0===r||r,o=c.createJsonRpcRequestPayload(u.MagicPayloadMethod.LoginWithMagicLink,[{email:t,showUI:n}]),[2,this.request(o)]}))}))},t}(s.BaseModule);t.AuthModule=l},function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var i=r(4),a=r(0),s=r(2),u=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.getIdToken=function(e){var t=s.createJsonRpcRequestPayload(a.MagicPayloadMethod.GetIdToken,[e]);return this.request(t)},t.prototype.getMetadata=function(){var e=s.createJsonRpcRequestPayload(a.MagicPayloadMethod.GetMetadata);return this.request(e)},t.prototype.isLoggedIn=function(){var e=s.createJsonRpcRequestPayload(a.MagicPayloadMethod.IsLoggedIn);return this.request(e)},t.prototype.logout=function(){var e=s.createJsonRpcRequestPayload(a.MagicPayloadMethod.Logout);return this.request(e)},t}(i.BaseModule);t.UserModule=u},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MAGIC_URL="https://auth.magic.link"}]); | ||
module.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=5)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}(r(10))},function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),a=r(3),s=function(e){function t(r,n){var o=e.call(this,"Magic SDK Error: ["+r+"] "+n)||this;return o.code=r,o.__proto__=Error,Object.setPrototypeOf(o,t.prototype),o}return o(t,e),t}(Error);t.MagicSDKError=s;var u=function(){function e(e,t){this.code=e,this.message="Magic SDK Warning: ["+e+"] "+t}return e.prototype.log=function(){console.warn(this.message)},e}();t.MagicSDKWarning=u;var c=function(e){function t(r){var n=e.call(this)||this;n.__proto__=Error;var o=Number(null==r?void 0:r.code),s=(null==r?void 0:r.message)||"Internal error";return n.code=a.isJsonRpcErrorCode(o)?o:i.RPCErrorCode.InternalError,n.message="Magic RPC Error: ["+n.code+"] "+s,Object.setPrototypeOf(n,t.prototype),n}return o(t,e),t}(Error);t.MagicRPCError=c,t.createMissingApiKeyError=function(){return new s(i.SDKErrorCode.MissingApiKey,"Please provide an API key that you acquired from the Magic developer dashboard.")},t.createModalNotReadyError=function(){return new s(i.SDKErrorCode.ModalNotReady,"Modal is not ready.")},t.createMalformedResponseError=function(){return new s(i.SDKErrorCode.MalformedResponse,"Response from the Magic iframe is malformed.")},t.createDuplicateIframeWarning=function(){return new u(i.SDKWarningCode.DuplicateIframe,"Duplicate iframes found.")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(3),o=r(16);t.createJsonRpcRequestPayload=function(e,t){return void 0===t&&(t=[]),{params:t,method:e,jsonrpc:"2.0",id:o.getPayloadId()}};var i=function(){function e(t){t instanceof e?(this._jsonrpc=t.payload.jsonrpc,this._id=t.payload.id,this._result=t.payload.result,this._error=t.payload.error):n.isJsonRpcResponsePayload(t)?(this._jsonrpc=t.jsonrpc,this._id=t.id,this._result=t.result,this._error=t.error):(this._jsonrpc=t.jsonrpc,this._id=t.id,this._result=null,this._error=null)}return e.prototype.applyError=function(e){return this._error=e,this},e.prototype.applyResult=function(e){return this._result=e,this},Object.defineProperty(e.prototype,"hasError",{get:function(){return void 0!==this._error&&null!==this._error},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasResult",{get:function(){return void 0!==this._result&&null!==this._result},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"payload",{get:function(){return{jsonrpc:this._jsonrpc,id:this._id,result:this._result,error:this._error}},enumerable:!0,configurable:!0}),e}();t.JsonRpcResponse=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0);function o(e){return void 0===e}function i(e){return function(e){return null===e}(e)||o(e)}t.isJsonRpcRequestPayload=function(e){return!i(e)&&!(o(e.jsonrpc)||o(e.id)||o(e.method)||o(e.params))},t.isJsonRpcResponsePayload=function(e){return!i(e)&&!(o(e.jsonrpc)||o(e.id)||o(e.result)&&o(e.error))},t.isMagicPayloadMethod=function(e){return!i(e)&&("string"==typeof e&&Object.values(n.MagicPayloadMethod).includes(e))},t.isJsonRpcErrorCode=function(e){return!i(e)&&("number"==typeof e&&Object.values(n.RPCErrorCode).includes(e))}},function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),a=r(1),s=function(){function e(e,t){this.getTransport=e,this.getOverlay=t}return Object.defineProperty(e.prototype,"transport",{get:function(){return this.getTransport()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"overlay",{get:function(){return this.getOverlay()},enumerable:!0,configurable:!0}),e.prototype.request=function(e){return n(this,void 0,void 0,(function(){var t;return o(this,(function(r){switch(r.label){case 0:return[4,this.transport.post(this.overlay,i.MagicOutgoingWindowMessage.MAGIC_HANDLE_REQUEST,e)];case 1:if((t=r.sent()).hasError)throw new a.MagicRPCError(t.payload.error);if(t.hasResult)return[2,t.payload.result];throw a.createMalformedResponseError()}}))}))},e}();t.BaseModule=s},function(e,t,r){e.exports=r(6)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7);t.Magic=n.MagicSDK;var o=r(1);t.SDKError=o.MagicSDKError,t.SDKWarning=o.MagicSDKWarning,t.RPCError=o.MagicRPCError,function(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}(r(0))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(8),o=r(9),i=r(1),a=r(14),s=r(15),u=r(17),c=r(18),l=r(19),d=function(){function e(e,t){var r,a=this;if(this.apiKey=e,!e)throw i.createMissingApiKeyError();this.endpoint=new URL(null!==(r=null==t?void 0:t.endpoint)&&void 0!==r?r:l.MAGIC_URL).origin,this.encodedQueryParams=n.encodeQueryParameters({API_KEY:this.apiKey,DOMAIN_ORIGIN:window.location?window.location.origin:"",host:new URL(this.endpoint).host,sdk:o.name,version:o.version});var s=function(){return a.transport},d=function(){return a.overlay};this.auth=new u.AuthModule(s,d),this.user=new c.UserModule(s,d)}return Object.defineProperty(e.prototype,"transport",{get:function(){return e.__transports__.has(this.encodedQueryParams)||e.__transports__.set(this.encodedQueryParams,new s.PayloadTransport(this.endpoint,this.encodedQueryParams)),e.__transports__.get(this.encodedQueryParams)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"overlay",{get:function(){return e.__overlays__.has(this.encodedQueryParams)||e.__overlays__.set(this.encodedQueryParams,new a.IframeController(this.transport,this.endpoint,this.encodedQueryParams)),e.__overlays__.get(this.encodedQueryParams)},enumerable:!0,configurable:!0}),e.__transports__=new Map,e.__overlays__=new Map,e}();t.MagicSDK=d},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.encodeQueryParameters=function(e){return btoa(JSON.stringify(e))},t.decodeQueryParameters=function(e){return JSON.parse(atob(e))}},function(e){e.exports=JSON.parse('{"name":"magic-sdk","version":"0.1.0-beta.12","description":"","author":"Fortmatic <team@fortmatic.com> (https://fortmatic.com/)","license":"MIT","repository":{"type":"git","url":"https://github.com/fortmatic/magic-js"},"homepage":"https://www.fortmatic.com","main":"dist/cjs/magic.js","types":"dist/cjs/src/index.d.ts","scripts":{"start":"yarn run clean:build && ./scripts/start.sh","build":"yarn run clean:build && ./scripts/build.sh","test":"yarn run clean:test-artifacts && ./scripts/test.sh","lint":"eslint --fix src/**/*.ts","clean":"npm-run-all -s clean:*","clean:test-artifacts":"rimraf coverage && rimraf .nyc_output","clean:build":"rimraf dist","clean_node_modules":"rimraf node_modules"},"dependencies":{},"devDependencies":{"@ikscodes/browser-env":"~0.3.1","@ikscodes/eslint-config":"~6.2.0","@ikscodes/prettier-config":"^0.1.0","@istanbuljs/nyc-config-typescript":"~0.1.3","@types/jsdom":"~12.2.4","@types/sinon":"~7.5.0","@types/webpack":"~4.41.0","@typescript-eslint/eslint-plugin":"~2.17.0","ava":"2.2.0","cli-glob":"^0.1.0","eslint":"~6.8.0","eslint-import-resolver-typescript":"~2.0.0","eslint-plugin-import":"~2.20.0","eslint-plugin-jsx-a11y":"~6.2.3","eslint-plugin-prettier":"~3.1.2","eslint-plugin-react":"~7.18.0","eslint-plugin-react-hooks":"~1.7.0","husky":"^4.2.3","lint-staged":"^10.0.7","npm-run-all":"~4.1.5","nyc":"13.1.0","prettier":"~1.19.1","rimraf":"~3.0.0","sinon":"7.1.1","ts-loader":"~6.2.1","ts-node":"~8.5.2","typescript":"~3.8.3","webpack":"~4.41.2","webpack-chain":"~6.2.0","webpack-cli":"~3.3.10"},"husky":{"hooks":{"pre-commit":"lint-staged"}},"lint-staged":{"*.{ts,tsx}":"eslint --fix"},"ava":{"require":["ts-node/register"],"files":["test/**/*.spec.ts"],"extensions":["ts"],"compileEnhancements":false,"verbose":true},"nyc":{"extends":"@istanbuljs/nyc-config-typescript","all":false,"check-coverage":true,"per-file":true,"lines":99,"statements":99,"functions":99,"branches":99,"reporter":["html","lcov"]}}')},function(e,t,r){"use strict";function n(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}Object.defineProperty(t,"__esModule",{value:!0}),n(r(11)),n(r(12)),n(r(13))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.LoginWithMagicLink="magic_auth_login_with_magic_link",e.GetIdToken="magic_auth_get_id_token",e.GetMetadata="magic_auth_get_metadata",e.IsLoggedIn="magic_auth_is_logged_in",e.Logout="magic_auth_logout"}(t.MagicPayloadMethod||(t.MagicPayloadMethod={}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.MAGIC_HANDLE_RESPONSE="MAGIC_HANDLE_RESPONSE",e.MAGIC_OVERLAY_READY="MAGIC_OVERLAY_READY",e.MAGIC_SHOW_OVERLAY="MAGIC_SHOW_OVERLAY",e.MAGIC_HIDE_OVERLAY="MAGIC_HIDE_OVERLAY"}(t.MagicIncomingWindowMessage||(t.MagicIncomingWindowMessage={})),function(e){e.MAGIC_HANDLE_REQUEST="MAGIC_HANDLE_REQUEST"}(t.MagicOutgoingWindowMessage||(t.MagicOutgoingWindowMessage={}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.MissingApiKey="MISSING_API_KEY",e.ModalNotReady="MODAL_NOT_READY",e.MalformedResponse="MALFORMED_RESPONSE"}(t.SDKErrorCode||(t.SDKErrorCode={})),function(e){e.DuplicateIframe="DUPLICATE_IFRAME"}(t.SDKWarningCode||(t.SDKWarningCode={})),function(e){e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.MagicLinkFailedVerification=-1e4]="MagicLinkFailedVerification",e[e.MagicLinkExpired=-10001]="MagicLinkExpired",e[e.MagicLinkRateLimited=-10002]="MagicLinkRateLimited",e[e.UserAlreadyLoggedIn=-10003]="UserAlreadyLoggedIn"}(t.RPCErrorCode||(t.RPCErrorCode={}))},function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var s=r(0),u=r(1),c={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"};var l=function(){function e(e,t,r){this.transport=e,this.endpoint=t,this.encodedQueryParams=r,this.iframe=this.init(),this.ready=this.waitForReady(),this.listen()}return e.prototype.init=function(){var e=this;return new Promise((function(t){var r=function(){if(n=e.encodedQueryParams,o=[].slice.call(document.querySelectorAll(".magic-iframe")),Boolean(o.find((function(e){return e.src.includes(n)}))))u.createDuplicateIframeWarning().log();else{var r=document.createElement("iframe");r.classList.add("magic-iframe"),r.dataset.magicIframeLabel=new URL(e.endpoint).host,r.src=new URL("/send?params="+e.encodedQueryParams,e.endpoint).href,function(e){var t,r;try{for(var n=i(Object.entries(c)),o=n.next();!o.done;o=n.next()){var s=a(o.value,2),u=s[0],l=s[1];e.style[u]=l}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}}(r),document.body.appendChild(r),t(r)}var n,o};["loaded","interactive","complete"].includes(document.readyState)?r():window.addEventListener("load",r,!1)}))},e.prototype.showOverlay=function(){return n(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,this.iframe];case 1:return e.sent().style.display="block",[2]}}))}))},e.prototype.hideOverlay=function(){return n(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,this.iframe];case 1:return e.sent().style.display="none",[2]}}))}))},e.prototype.waitForReady=function(){var e=this;return new Promise((function(t){e.transport.on(s.MagicIncomingWindowMessage.MAGIC_OVERLAY_READY,(function(){return t()}))}))},e.prototype.listen=function(){var e=this;this.transport.on(s.MagicIncomingWindowMessage.MAGIC_HIDE_OVERLAY,(function(){e.hideOverlay()})),this.transport.on(s.MagicIncomingWindowMessage.MAGIC_SHOW_OVERLAY,(function(){e.showOverlay()}))},e}();t.IframeController=l},function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=r(0),s=r(2),u=r(1);var c=function(){function e(e,t){this.endpoint=e,this.encodedQueryParams=t,this.messageHandlers=new Set,this.initMessageListener()}return e.prototype.post=function(e,t,r){return n(this,void 0,void 0,(function(){var n,i=this;return o(this,(function(o){switch(o.label){case 0:return[4,e.ready];case 1:return o.sent(),[4,e.iframe];case 2:return n=o.sent(),[2,new Promise((function(e,o){if(n.contentWindow){n.contentWindow.postMessage({msgType:t+"-"+i.encodedQueryParams,payload:r},"*");var c=i.on(a.MagicIncomingWindowMessage.MAGIC_HANDLE_RESPONSE,(l=function(){return c()},function(t){var n=function(e,t){var r,n,o,i,a=new s.JsonRpcResponse(e).applyResult(null===(r=t.data.response)||void 0===r?void 0:r.result).applyError(null===(n=t.data.response)||void 0===n?void 0:n.error);return{id:null!==(i=null===(o=t.data.response)||void 0===o?void 0:o.id)&&void 0!==i?i:void 0,response:a}}(r,t),o=n.id,i=n.response;o&&o===r.id&&(l(),e(i))}))}else o(u.createModalNotReadyError());var l}))]}}))}))},e.prototype.on=function(e,t){var r=this,n=t.bind(window),o=function(t){t.data.msgType===e+"-"+r.encodedQueryParams&&n(t)};return this.messageHandlers.add(o),function(){return r.messageHandlers.delete(o)}},e.prototype.initMessageListener=function(){var e=this;window.addEventListener("message",(function(t){var r,n,o;if(t.origin===e.endpoint&&t.data&&t.data.msgType&&e.messageHandlers.size){t.data.response=null!==(o=t.data.response)&&void 0!==o?o:{};try{for(var a=i(e.messageHandlers.values()),s=a.next();!s.done;s=a.next()){(0,s.value)(t)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}}}))},e}();t.PayloadTransport=c},function(e,t,r){"use strict";var n=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var o=function(){var e;return n(this,(function(t){switch(t.label){case 0:e=0,t.label=1;case 1:return e<Number.MAX_SAFE_INTEGER?[4,++e]:[3,3];case 2:return t.sent(),[3,4];case 3:e=0,t.label=4;case 4:return[3,1];case 5:return[2]}}))}();t.getPayloadId=function(){return o.next().value}},function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}u((n=n.apply(e,t||[])).next())}))},a=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var s=r(4),u=r(0),c=r(2),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.loginWithMagicLink=function(e){return i(this,void 0,void 0,(function(){var t,r,n,o;return a(this,(function(i){return t=e.email,r=e.showUI,n=void 0===r||r,o=c.createJsonRpcRequestPayload(u.MagicPayloadMethod.LoginWithMagicLink,[{email:t,showUI:n}]),[2,this.request(o)]}))}))},t}(s.BaseModule);t.AuthModule=l},function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var i=r(4),a=r(0),s=r(2),u=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.getIdToken=function(e){var t=s.createJsonRpcRequestPayload(a.MagicPayloadMethod.GetIdToken,[e]);return this.request(t)},t.prototype.getMetadata=function(){var e=s.createJsonRpcRequestPayload(a.MagicPayloadMethod.GetMetadata);return this.request(e)},t.prototype.isLoggedIn=function(){var e=s.createJsonRpcRequestPayload(a.MagicPayloadMethod.IsLoggedIn);return this.request(e)},t.prototype.logout=function(){var e=s.createJsonRpcRequestPayload(a.MagicPayloadMethod.Logout);return this.request(e)},t}(i.BaseModule);t.UserModule=u},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MAGIC_URL="https://auth.magic.link"}]); |
@@ -1,1 +0,1 @@ | ||
window.Magic=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=5)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}(r(10))},function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),a=r(3),s=function(e){function t(r,n){var o=e.call(this,"Magic SDK Error: ["+r+"] "+n)||this;return o.code=r,o.__proto__=Error,Object.setPrototypeOf(o,t.prototype),o}return o(t,e),t}(Error);t.MagicSDKError=s;var u=function(){function e(e,t){this.code=e,this.message="Magic SDK Warning: ["+e+"] "+t}return e.prototype.log=function(){console.warn(this.message)},e}();t.MagicSDKWarning=u;var c=function(e){function t(r){var n=e.call(this)||this;n.__proto__=Error;var o=Number(null==r?void 0:r.code),s=(null==r?void 0:r.message)||"Internal error";return n.code=a.isJsonRpcErrorCode(o)?o:i.RPCErrorCode.InternalError,n.message="Magic RPC Error: ["+n.code+"] "+s,Object.setPrototypeOf(n,t.prototype),n}return o(t,e),t}(Error);t.MagicRPCError=c,t.createMissingApiKeyError=function(){return new s(i.SDKErrorCode.MissingApiKey,"Please provide an API key that you acquired from the Magic developer dashboard.")},t.createModalNotReadyError=function(){return new s(i.SDKErrorCode.ModalNotReady,"Modal is not ready.")},t.createMalformedResponseError=function(){return new s(i.SDKErrorCode.MalformedResponse,"Response from the Magic iframe is malformed.")},t.createDuplicateIframeWarning=function(){return new u(i.SDKWarningCode.DuplicateIframe,"Duplicate iframes found.")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(3),o=r(16);t.createJsonRpcRequestPayload=function(e,t){return void 0===t&&(t=[]),{params:t,method:e,jsonrpc:"2.0",id:o.getPayloadId()}};var i=function(){function e(t){t instanceof e?(this._jsonrpc=t.payload.jsonrpc,this._id=t.payload.id,this._result=t.payload.result,this._error=t.payload.error):n.isJsonRpcResponsePayload(t)?(this._jsonrpc=t.jsonrpc,this._id=t.id,this._result=t.result,this._error=t.error):(this._jsonrpc=t.jsonrpc,this._id=t.id,this._result=null,this._error=null)}return e.prototype.applyError=function(e){return this._error=e,this},e.prototype.applyResult=function(e){return this._result=e,this},Object.defineProperty(e.prototype,"hasError",{get:function(){return void 0!==this._error&&null!==this._error},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasResult",{get:function(){return void 0!==this._result&&null!==this._result},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"payload",{get:function(){return{jsonrpc:this._jsonrpc,id:this._id,result:this._result,error:this._error}},enumerable:!0,configurable:!0}),e}();t.JsonRpcResponse=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0);function o(e){return void 0===e}function i(e){return function(e){return null===e}(e)||o(e)}t.isJsonRpcRequestPayload=function(e){return!i(e)&&!(o(e.jsonrpc)||o(e.id)||o(e.method)||o(e.params))},t.isJsonRpcResponsePayload=function(e){return!i(e)&&!(o(e.jsonrpc)||o(e.id)||o(e.result)&&o(e.error))},t.isMagicPayloadMethod=function(e){return!i(e)&&("string"==typeof e&&Object.values(n.MagicPayloadMethod).includes(e))},t.isJsonRpcErrorCode=function(e){return!i(e)&&("number"==typeof e&&Object.values(n.RPCErrorCode).includes(e))}},function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),a=r(1),s=function(){function e(e,t){this.getTransport=e,this.getOverlay=t}return Object.defineProperty(e.prototype,"transport",{get:function(){return this.getTransport()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"overlay",{get:function(){return this.getOverlay()},enumerable:!0,configurable:!0}),e.prototype.request=function(e){return n(this,void 0,void 0,(function(){var t;return o(this,(function(r){switch(r.label){case 0:return[4,this.transport.post(this.overlay,i.MagicOutgoingWindowMessage.MAGIC_HANDLE_REQUEST,e)];case 1:if((t=r.sent()).hasError)throw new a.MagicRPCError(t.payload.error);if(t.hasResult)return[2,t.payload.result];throw a.createMalformedResponseError()}}))}))},e}();t.BaseModule=s},function(e,t,r){e.exports=r(6)},function(e,t,r){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var i=r(7);t.default=i.MagicSDK;var a=r(1),s=o(r(0));Object.assign(i.MagicSDK,n(n({},s),{SDKError:a.MagicSDKError,SDKWarning:a.MagicSDKWarning,RPCError:a.MagicRPCError}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(8),o=r(9),i=r(1),a=r(14),s=r(15),u=r(17),c=r(18),l=r(19),d=function(){function e(e,t){var r,a=this;if(this.apiKey=e,!e)throw i.createMissingApiKeyError();this.endpoint=new URL(null!==(r=null==t?void 0:t.endpoint)&&void 0!==r?r:l.MAGIC_URL).origin,this.encodedQueryParams=n.encodeQueryParameters({API_KEY:this.apiKey,DOMAIN_ORIGIN:window.location?window.location.origin:"",host:new URL(this.endpoint).host,sdk:o.name,version:o.version});var s=function(){return a.transport},d=function(){return a.overlay};this.auth=new u.AuthModule(s,d),this.user=new c.UserModule(s,d)}return Object.defineProperty(e.prototype,"transport",{get:function(){return e.__transports__.has(this.encodedQueryParams)||e.__transports__.set(this.encodedQueryParams,new s.PayloadTransport(this.endpoint,this.encodedQueryParams)),e.__transports__.get(this.encodedQueryParams)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"overlay",{get:function(){return e.__overlays__.has(this.encodedQueryParams)||e.__overlays__.set(this.encodedQueryParams,new a.IframeController(this.transport,this.endpoint,this.encodedQueryParams)),e.__overlays__.get(this.encodedQueryParams)},enumerable:!0,configurable:!0}),e.__transports__=new Map,e.__overlays__=new Map,e}();t.MagicSDK=d},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.encodeQueryParameters=function(e){return btoa(JSON.stringify(e))},t.decodeQueryParameters=function(e){return JSON.parse(atob(e))}},function(e){e.exports=JSON.parse('{"name":"magic-sdk","version":"0.1.0-beta.11","description":"","author":"Fortmatic <team@fortmatic.com> (https://fortmatic.com/)","license":"MIT","repository":{"type":"git","url":"https://github.com/fortmatic/magic-js"},"homepage":"https://www.fortmatic.com","main":"dist/cjs/magic.js","types":"dist/cjs/src/index.d.ts","scripts":{"start":"yarn run clean:build && ./scripts/start.sh","build":"yarn run clean:build && ./scripts/build.sh","test":"yarn run clean:test-artifacts && ./scripts/test.sh","lint":"eslint --fix src/**/*.ts","clean":"npm-run-all -s clean:*","clean:test-artifacts":"rimraf coverage && rimraf .nyc_output","clean:build":"rimraf dist","clean_node_modules":"rimraf node_modules"},"dependencies":{},"devDependencies":{"@ikscodes/browser-env":"~0.3.1","@ikscodes/eslint-config":"~6.2.0","@ikscodes/prettier-config":"^0.1.0","@istanbuljs/nyc-config-typescript":"~0.1.3","@types/jsdom":"~12.2.4","@types/sinon":"~7.5.0","@types/webpack":"~4.41.0","@typescript-eslint/eslint-plugin":"~2.17.0","ava":"2.2.0","cli-glob":"^0.1.0","eslint":"~6.8.0","eslint-import-resolver-typescript":"~2.0.0","eslint-plugin-import":"~2.20.0","eslint-plugin-jsx-a11y":"~6.2.3","eslint-plugin-prettier":"~3.1.2","eslint-plugin-react":"~7.18.0","eslint-plugin-react-hooks":"~1.7.0","husky":"^4.2.3","lint-staged":"^10.0.7","npm-run-all":"~4.1.5","nyc":"13.1.0","prettier":"~1.19.1","rimraf":"~3.0.0","sinon":"7.1.1","ts-loader":"~6.2.1","ts-node":"~8.5.2","typescript":"~3.8.3","webpack":"~4.41.2","webpack-chain":"~6.2.0","webpack-cli":"~3.3.10"},"husky":{"hooks":{"pre-commit":"lint-staged"}},"lint-staged":{"*.{ts,tsx}":"eslint --fix"},"ava":{"require":["ts-node/register"],"files":["test/**/*.spec.ts"],"extensions":["ts"],"compileEnhancements":false,"verbose":true},"nyc":{"extends":"@istanbuljs/nyc-config-typescript","all":false,"check-coverage":true,"per-file":true,"lines":99,"statements":99,"functions":99,"branches":99,"reporter":["html","lcov"]}}')},function(e,t,r){"use strict";function n(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}Object.defineProperty(t,"__esModule",{value:!0}),n(r(11)),n(r(12)),n(r(13))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.LoginWithMagicLink="magic_auth_login_with_magic_link",e.GetIdToken="magic_auth_get_id_token",e.GetMetadata="magic_auth_get_metadata",e.IsLoggedIn="magic_auth_is_logged_in",e.Logout="magic_auth_logout"}(t.MagicPayloadMethod||(t.MagicPayloadMethod={}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.MAGIC_HANDLE_RESPONSE="MAGIC_HANDLE_RESPONSE",e.MAGIC_OVERLAY_READY="MAGIC_OVERLAY_READY",e.MAGIC_SHOW_OVERLAY="MAGIC_SHOW_OVERLAY",e.MAGIC_HIDE_OVERLAY="MAGIC_HIDE_OVERLAY"}(t.MagicIncomingWindowMessage||(t.MagicIncomingWindowMessage={})),function(e){e.MAGIC_HANDLE_REQUEST="MAGIC_HANDLE_REQUEST"}(t.MagicOutgoingWindowMessage||(t.MagicOutgoingWindowMessage={}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.MissingApiKey="MISSING_API_KEY",e.ModalNotReady="MODAL_NOT_READY",e.MalformedResponse="MALFORMED_RESPONSE"}(t.SDKErrorCode||(t.SDKErrorCode={})),function(e){e.DuplicateIframe="DUPLICATE_IFRAME"}(t.SDKWarningCode||(t.SDKWarningCode={})),function(e){e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.MagicLinkFailedVerification=-1e4]="MagicLinkFailedVerification",e[e.MagicLinkExpired=-10001]="MagicLinkExpired",e[e.MagicLinkRateLimited=-10002]="MagicLinkRateLimited",e[e.UserAlreadyLoggedIn=-10003]="UserAlreadyLoggedIn"}(t.RPCErrorCode||(t.RPCErrorCode={}))},function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var s=r(0),u=r(1),c={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"};var l=function(){function e(e,t,r){this.transport=e,this.endpoint=t,this.encodedQueryParams=r,this.iframe=this.init(),this.ready=this.waitForReady(),this.listen()}return e.prototype.init=function(){var e=this;return new Promise((function(t){var r=function(){if(o=e.encodedQueryParams,s=[].slice.call(document.querySelectorAll(".magic-iframe")),Boolean(s.find((function(e){return e.src.includes(o)}))))u.createDuplicateIframeWarning().log();else{var r=document.createElement("iframe");r.classList.add("magic-iframe"),r.dataset.magicIframeLabel=new URL(e.endpoint).host,r.src=new URL("/send?params="+e.encodedQueryParams,e.endpoint).href,function(e){var t,r;try{for(var n=i(Object.entries(c)),o=n.next();!o.done;o=n.next()){var s=a(o.value,2),u=s[0],l=s[1];e.style[u]=l}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}}(r),document.body.appendChild(r);var n=document.createElement("img");n.src="https://static.fortmatic.com/assets/trans.gif",n.style.position="fixed",document.body.appendChild(n),t(r)}var o,s};["loaded","interactive","complete"].includes(document.readyState)?r():window.addEventListener("load",r,!1)}))},e.prototype.showOverlay=function(){return n(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,this.iframe];case 1:return e.sent().style.display="block",[2]}}))}))},e.prototype.hideOverlay=function(){return n(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,this.iframe];case 1:return e.sent().style.display="none",[2]}}))}))},e.prototype.waitForReady=function(){var e=this;return new Promise((function(t){e.transport.on(s.MagicIncomingWindowMessage.MAGIC_OVERLAY_READY,(function(){return t()}))}))},e.prototype.listen=function(){var e=this;this.transport.on(s.MagicIncomingWindowMessage.MAGIC_HIDE_OVERLAY,(function(){e.hideOverlay()})),this.transport.on(s.MagicIncomingWindowMessage.MAGIC_SHOW_OVERLAY,(function(){e.showOverlay()}))},e}();t.IframeController=l},function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=r(0),s=r(2),u=r(1);var c=function(){function e(e,t){this.endpoint=e,this.encodedQueryParams=t,this.messageHandlers=new Set,this.initMessageListener()}return e.prototype.post=function(e,t,r){return n(this,void 0,void 0,(function(){var n,i=this;return o(this,(function(o){switch(o.label){case 0:return[4,e.ready];case 1:return o.sent(),[4,e.iframe];case 2:return n=o.sent(),[2,new Promise((function(e,o){if(n.contentWindow){n.contentWindow.postMessage({msgType:t+"-"+i.encodedQueryParams,payload:r},"*");var c=i.on(a.MagicIncomingWindowMessage.MAGIC_HANDLE_RESPONSE,(l=function(){return c()},function(t){var n=function(e,t){var r,n,o,i,a=new s.JsonRpcResponse(e).applyResult(null===(r=t.data.response)||void 0===r?void 0:r.result).applyError(null===(n=t.data.response)||void 0===n?void 0:n.error);return{id:null!==(i=null===(o=t.data.response)||void 0===o?void 0:o.id)&&void 0!==i?i:void 0,response:a}}(r,t),o=n.id,i=n.response;o&&o===r.id&&(l(),e(i))}))}else o(u.createModalNotReadyError());var l}))]}}))}))},e.prototype.on=function(e,t){var r=this,n=t.bind(window),o=function(t){t.data.msgType===e+"-"+r.encodedQueryParams&&n(t)};return this.messageHandlers.add(o),function(){return r.messageHandlers.delete(o)}},e.prototype.initMessageListener=function(){var e=this;window.addEventListener("message",(function(t){var r,n,o;if(t.origin===e.endpoint&&t.data&&t.data.msgType&&e.messageHandlers.size){t.data.response=null!==(o=t.data.response)&&void 0!==o?o:{};try{for(var a=i(e.messageHandlers.values()),s=a.next();!s.done;s=a.next()){(0,s.value)(t)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}}}))},e}();t.PayloadTransport=c},function(e,t,r){"use strict";var n=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var o=function(){var e;return n(this,(function(t){switch(t.label){case 0:e=0,t.label=1;case 1:return e<Number.MAX_SAFE_INTEGER?[4,++e]:[3,3];case 2:return t.sent(),[3,4];case 3:e=0,t.label=4;case 4:return[3,1];case 5:return[2]}}))}();t.getPayloadId=function(){return o.next().value}},function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}u((n=n.apply(e,t||[])).next())}))},a=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var s=r(4),u=r(0),c=r(2),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.loginWithMagicLink=function(e){return i(this,void 0,void 0,(function(){var t,r,n,o;return a(this,(function(i){return t=e.email,r=e.showUI,n=void 0===r||r,o=c.createJsonRpcRequestPayload(u.MagicPayloadMethod.LoginWithMagicLink,[{email:t,showUI:n}]),[2,this.request(o)]}))}))},t}(s.BaseModule);t.AuthModule=l},function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var i=r(4),a=r(0),s=r(2),u=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.getIdToken=function(e){var t=s.createJsonRpcRequestPayload(a.MagicPayloadMethod.GetIdToken,[e]);return this.request(t)},t.prototype.getMetadata=function(){var e=s.createJsonRpcRequestPayload(a.MagicPayloadMethod.GetMetadata);return this.request(e)},t.prototype.isLoggedIn=function(){var e=s.createJsonRpcRequestPayload(a.MagicPayloadMethod.IsLoggedIn);return this.request(e)},t.prototype.logout=function(){var e=s.createJsonRpcRequestPayload(a.MagicPayloadMethod.Logout);return this.request(e)},t}(i.BaseModule);t.UserModule=u},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MAGIC_URL="https://auth.magic.link"}]).default; | ||
window.Magic=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=5)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}(r(10))},function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),a=r(3),s=function(e){function t(r,n){var o=e.call(this,"Magic SDK Error: ["+r+"] "+n)||this;return o.code=r,o.__proto__=Error,Object.setPrototypeOf(o,t.prototype),o}return o(t,e),t}(Error);t.MagicSDKError=s;var u=function(){function e(e,t){this.code=e,this.message="Magic SDK Warning: ["+e+"] "+t}return e.prototype.log=function(){console.warn(this.message)},e}();t.MagicSDKWarning=u;var c=function(e){function t(r){var n=e.call(this)||this;n.__proto__=Error;var o=Number(null==r?void 0:r.code),s=(null==r?void 0:r.message)||"Internal error";return n.code=a.isJsonRpcErrorCode(o)?o:i.RPCErrorCode.InternalError,n.message="Magic RPC Error: ["+n.code+"] "+s,Object.setPrototypeOf(n,t.prototype),n}return o(t,e),t}(Error);t.MagicRPCError=c,t.createMissingApiKeyError=function(){return new s(i.SDKErrorCode.MissingApiKey,"Please provide an API key that you acquired from the Magic developer dashboard.")},t.createModalNotReadyError=function(){return new s(i.SDKErrorCode.ModalNotReady,"Modal is not ready.")},t.createMalformedResponseError=function(){return new s(i.SDKErrorCode.MalformedResponse,"Response from the Magic iframe is malformed.")},t.createDuplicateIframeWarning=function(){return new u(i.SDKWarningCode.DuplicateIframe,"Duplicate iframes found.")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(3),o=r(16);t.createJsonRpcRequestPayload=function(e,t){return void 0===t&&(t=[]),{params:t,method:e,jsonrpc:"2.0",id:o.getPayloadId()}};var i=function(){function e(t){t instanceof e?(this._jsonrpc=t.payload.jsonrpc,this._id=t.payload.id,this._result=t.payload.result,this._error=t.payload.error):n.isJsonRpcResponsePayload(t)?(this._jsonrpc=t.jsonrpc,this._id=t.id,this._result=t.result,this._error=t.error):(this._jsonrpc=t.jsonrpc,this._id=t.id,this._result=null,this._error=null)}return e.prototype.applyError=function(e){return this._error=e,this},e.prototype.applyResult=function(e){return this._result=e,this},Object.defineProperty(e.prototype,"hasError",{get:function(){return void 0!==this._error&&null!==this._error},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasResult",{get:function(){return void 0!==this._result&&null!==this._result},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"payload",{get:function(){return{jsonrpc:this._jsonrpc,id:this._id,result:this._result,error:this._error}},enumerable:!0,configurable:!0}),e}();t.JsonRpcResponse=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0);function o(e){return void 0===e}function i(e){return function(e){return null===e}(e)||o(e)}t.isJsonRpcRequestPayload=function(e){return!i(e)&&!(o(e.jsonrpc)||o(e.id)||o(e.method)||o(e.params))},t.isJsonRpcResponsePayload=function(e){return!i(e)&&!(o(e.jsonrpc)||o(e.id)||o(e.result)&&o(e.error))},t.isMagicPayloadMethod=function(e){return!i(e)&&("string"==typeof e&&Object.values(n.MagicPayloadMethod).includes(e))},t.isJsonRpcErrorCode=function(e){return!i(e)&&("number"==typeof e&&Object.values(n.RPCErrorCode).includes(e))}},function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),a=r(1),s=function(){function e(e,t){this.getTransport=e,this.getOverlay=t}return Object.defineProperty(e.prototype,"transport",{get:function(){return this.getTransport()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"overlay",{get:function(){return this.getOverlay()},enumerable:!0,configurable:!0}),e.prototype.request=function(e){return n(this,void 0,void 0,(function(){var t;return o(this,(function(r){switch(r.label){case 0:return[4,this.transport.post(this.overlay,i.MagicOutgoingWindowMessage.MAGIC_HANDLE_REQUEST,e)];case 1:if((t=r.sent()).hasError)throw new a.MagicRPCError(t.payload.error);if(t.hasResult)return[2,t.payload.result];throw a.createMalformedResponseError()}}))}))},e}();t.BaseModule=s},function(e,t,r){e.exports=r(6)},function(e,t,r){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var i=r(7);t.default=i.MagicSDK;var a=r(1),s=o(r(0));Object.assign(i.MagicSDK,n(n({},s),{SDKError:a.MagicSDKError,SDKWarning:a.MagicSDKWarning,RPCError:a.MagicRPCError}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(8),o=r(9),i=r(1),a=r(14),s=r(15),u=r(17),c=r(18),l=r(19),d=function(){function e(e,t){var r,a=this;if(this.apiKey=e,!e)throw i.createMissingApiKeyError();this.endpoint=new URL(null!==(r=null==t?void 0:t.endpoint)&&void 0!==r?r:l.MAGIC_URL).origin,this.encodedQueryParams=n.encodeQueryParameters({API_KEY:this.apiKey,DOMAIN_ORIGIN:window.location?window.location.origin:"",host:new URL(this.endpoint).host,sdk:o.name,version:o.version});var s=function(){return a.transport},d=function(){return a.overlay};this.auth=new u.AuthModule(s,d),this.user=new c.UserModule(s,d)}return Object.defineProperty(e.prototype,"transport",{get:function(){return e.__transports__.has(this.encodedQueryParams)||e.__transports__.set(this.encodedQueryParams,new s.PayloadTransport(this.endpoint,this.encodedQueryParams)),e.__transports__.get(this.encodedQueryParams)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"overlay",{get:function(){return e.__overlays__.has(this.encodedQueryParams)||e.__overlays__.set(this.encodedQueryParams,new a.IframeController(this.transport,this.endpoint,this.encodedQueryParams)),e.__overlays__.get(this.encodedQueryParams)},enumerable:!0,configurable:!0}),e.__transports__=new Map,e.__overlays__=new Map,e}();t.MagicSDK=d},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.encodeQueryParameters=function(e){return btoa(JSON.stringify(e))},t.decodeQueryParameters=function(e){return JSON.parse(atob(e))}},function(e){e.exports=JSON.parse('{"name":"magic-sdk","version":"0.1.0-beta.12","description":"","author":"Fortmatic <team@fortmatic.com> (https://fortmatic.com/)","license":"MIT","repository":{"type":"git","url":"https://github.com/fortmatic/magic-js"},"homepage":"https://www.fortmatic.com","main":"dist/cjs/magic.js","types":"dist/cjs/src/index.d.ts","scripts":{"start":"yarn run clean:build && ./scripts/start.sh","build":"yarn run clean:build && ./scripts/build.sh","test":"yarn run clean:test-artifacts && ./scripts/test.sh","lint":"eslint --fix src/**/*.ts","clean":"npm-run-all -s clean:*","clean:test-artifacts":"rimraf coverage && rimraf .nyc_output","clean:build":"rimraf dist","clean_node_modules":"rimraf node_modules"},"dependencies":{},"devDependencies":{"@ikscodes/browser-env":"~0.3.1","@ikscodes/eslint-config":"~6.2.0","@ikscodes/prettier-config":"^0.1.0","@istanbuljs/nyc-config-typescript":"~0.1.3","@types/jsdom":"~12.2.4","@types/sinon":"~7.5.0","@types/webpack":"~4.41.0","@typescript-eslint/eslint-plugin":"~2.17.0","ava":"2.2.0","cli-glob":"^0.1.0","eslint":"~6.8.0","eslint-import-resolver-typescript":"~2.0.0","eslint-plugin-import":"~2.20.0","eslint-plugin-jsx-a11y":"~6.2.3","eslint-plugin-prettier":"~3.1.2","eslint-plugin-react":"~7.18.0","eslint-plugin-react-hooks":"~1.7.0","husky":"^4.2.3","lint-staged":"^10.0.7","npm-run-all":"~4.1.5","nyc":"13.1.0","prettier":"~1.19.1","rimraf":"~3.0.0","sinon":"7.1.1","ts-loader":"~6.2.1","ts-node":"~8.5.2","typescript":"~3.8.3","webpack":"~4.41.2","webpack-chain":"~6.2.0","webpack-cli":"~3.3.10"},"husky":{"hooks":{"pre-commit":"lint-staged"}},"lint-staged":{"*.{ts,tsx}":"eslint --fix"},"ava":{"require":["ts-node/register"],"files":["test/**/*.spec.ts"],"extensions":["ts"],"compileEnhancements":false,"verbose":true},"nyc":{"extends":"@istanbuljs/nyc-config-typescript","all":false,"check-coverage":true,"per-file":true,"lines":99,"statements":99,"functions":99,"branches":99,"reporter":["html","lcov"]}}')},function(e,t,r){"use strict";function n(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}Object.defineProperty(t,"__esModule",{value:!0}),n(r(11)),n(r(12)),n(r(13))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.LoginWithMagicLink="magic_auth_login_with_magic_link",e.GetIdToken="magic_auth_get_id_token",e.GetMetadata="magic_auth_get_metadata",e.IsLoggedIn="magic_auth_is_logged_in",e.Logout="magic_auth_logout"}(t.MagicPayloadMethod||(t.MagicPayloadMethod={}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.MAGIC_HANDLE_RESPONSE="MAGIC_HANDLE_RESPONSE",e.MAGIC_OVERLAY_READY="MAGIC_OVERLAY_READY",e.MAGIC_SHOW_OVERLAY="MAGIC_SHOW_OVERLAY",e.MAGIC_HIDE_OVERLAY="MAGIC_HIDE_OVERLAY"}(t.MagicIncomingWindowMessage||(t.MagicIncomingWindowMessage={})),function(e){e.MAGIC_HANDLE_REQUEST="MAGIC_HANDLE_REQUEST"}(t.MagicOutgoingWindowMessage||(t.MagicOutgoingWindowMessage={}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.MissingApiKey="MISSING_API_KEY",e.ModalNotReady="MODAL_NOT_READY",e.MalformedResponse="MALFORMED_RESPONSE"}(t.SDKErrorCode||(t.SDKErrorCode={})),function(e){e.DuplicateIframe="DUPLICATE_IFRAME"}(t.SDKWarningCode||(t.SDKWarningCode={})),function(e){e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.MagicLinkFailedVerification=-1e4]="MagicLinkFailedVerification",e[e.MagicLinkExpired=-10001]="MagicLinkExpired",e[e.MagicLinkRateLimited=-10002]="MagicLinkRateLimited",e[e.UserAlreadyLoggedIn=-10003]="UserAlreadyLoggedIn"}(t.RPCErrorCode||(t.RPCErrorCode={}))},function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var s=r(0),u=r(1),c={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"};var l=function(){function e(e,t,r){this.transport=e,this.endpoint=t,this.encodedQueryParams=r,this.iframe=this.init(),this.ready=this.waitForReady(),this.listen()}return e.prototype.init=function(){var e=this;return new Promise((function(t){var r=function(){if(n=e.encodedQueryParams,o=[].slice.call(document.querySelectorAll(".magic-iframe")),Boolean(o.find((function(e){return e.src.includes(n)}))))u.createDuplicateIframeWarning().log();else{var r=document.createElement("iframe");r.classList.add("magic-iframe"),r.dataset.magicIframeLabel=new URL(e.endpoint).host,r.src=new URL("/send?params="+e.encodedQueryParams,e.endpoint).href,function(e){var t,r;try{for(var n=i(Object.entries(c)),o=n.next();!o.done;o=n.next()){var s=a(o.value,2),u=s[0],l=s[1];e.style[u]=l}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}}(r),document.body.appendChild(r),t(r)}var n,o};["loaded","interactive","complete"].includes(document.readyState)?r():window.addEventListener("load",r,!1)}))},e.prototype.showOverlay=function(){return n(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,this.iframe];case 1:return e.sent().style.display="block",[2]}}))}))},e.prototype.hideOverlay=function(){return n(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,this.iframe];case 1:return e.sent().style.display="none",[2]}}))}))},e.prototype.waitForReady=function(){var e=this;return new Promise((function(t){e.transport.on(s.MagicIncomingWindowMessage.MAGIC_OVERLAY_READY,(function(){return t()}))}))},e.prototype.listen=function(){var e=this;this.transport.on(s.MagicIncomingWindowMessage.MAGIC_HIDE_OVERLAY,(function(){e.hideOverlay()})),this.transport.on(s.MagicIncomingWindowMessage.MAGIC_SHOW_OVERLAY,(function(){e.showOverlay()}))},e}();t.IframeController=l},function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=r(0),s=r(2),u=r(1);var c=function(){function e(e,t){this.endpoint=e,this.encodedQueryParams=t,this.messageHandlers=new Set,this.initMessageListener()}return e.prototype.post=function(e,t,r){return n(this,void 0,void 0,(function(){var n,i=this;return o(this,(function(o){switch(o.label){case 0:return[4,e.ready];case 1:return o.sent(),[4,e.iframe];case 2:return n=o.sent(),[2,new Promise((function(e,o){if(n.contentWindow){n.contentWindow.postMessage({msgType:t+"-"+i.encodedQueryParams,payload:r},"*");var c=i.on(a.MagicIncomingWindowMessage.MAGIC_HANDLE_RESPONSE,(l=function(){return c()},function(t){var n=function(e,t){var r,n,o,i,a=new s.JsonRpcResponse(e).applyResult(null===(r=t.data.response)||void 0===r?void 0:r.result).applyError(null===(n=t.data.response)||void 0===n?void 0:n.error);return{id:null!==(i=null===(o=t.data.response)||void 0===o?void 0:o.id)&&void 0!==i?i:void 0,response:a}}(r,t),o=n.id,i=n.response;o&&o===r.id&&(l(),e(i))}))}else o(u.createModalNotReadyError());var l}))]}}))}))},e.prototype.on=function(e,t){var r=this,n=t.bind(window),o=function(t){t.data.msgType===e+"-"+r.encodedQueryParams&&n(t)};return this.messageHandlers.add(o),function(){return r.messageHandlers.delete(o)}},e.prototype.initMessageListener=function(){var e=this;window.addEventListener("message",(function(t){var r,n,o;if(t.origin===e.endpoint&&t.data&&t.data.msgType&&e.messageHandlers.size){t.data.response=null!==(o=t.data.response)&&void 0!==o?o:{};try{for(var a=i(e.messageHandlers.values()),s=a.next();!s.done;s=a.next()){(0,s.value)(t)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}}}))},e}();t.PayloadTransport=c},function(e,t,r){"use strict";var n=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var o=function(){var e;return n(this,(function(t){switch(t.label){case 0:e=0,t.label=1;case 1:return e<Number.MAX_SAFE_INTEGER?[4,++e]:[3,3];case 2:return t.sent(),[3,4];case 3:e=0,t.label=4;case 4:return[3,1];case 5:return[2]}}))}();t.getPayloadId=function(){return o.next().value}},function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}u((n=n.apply(e,t||[])).next())}))},a=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var s=r(4),u=r(0),c=r(2),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.loginWithMagicLink=function(e){return i(this,void 0,void 0,(function(){var t,r,n,o;return a(this,(function(i){return t=e.email,r=e.showUI,n=void 0===r||r,o=c.createJsonRpcRequestPayload(u.MagicPayloadMethod.LoginWithMagicLink,[{email:t,showUI:n}]),[2,this.request(o)]}))}))},t}(s.BaseModule);t.AuthModule=l},function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var i=r(4),a=r(0),s=r(2),u=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.getIdToken=function(e){var t=s.createJsonRpcRequestPayload(a.MagicPayloadMethod.GetIdToken,[e]);return this.request(t)},t.prototype.getMetadata=function(){var e=s.createJsonRpcRequestPayload(a.MagicPayloadMethod.GetMetadata);return this.request(e)},t.prototype.isLoggedIn=function(){var e=s.createJsonRpcRequestPayload(a.MagicPayloadMethod.IsLoggedIn);return this.request(e)},t.prototype.logout=function(){var e=s.createJsonRpcRequestPayload(a.MagicPayloadMethod.Logout);return this.request(e)},t}(i.BaseModule);t.UserModule=u},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MAGIC_URL="https://auth.magic.link"}]).default; |
{ | ||
"name": "magic-sdk", | ||
"version": "0.1.0-beta.11", | ||
"version": "0.1.0-beta.12", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "author": "Fortmatic <team@fortmatic.com> (https://fortmatic.com/)", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
67539