New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

magic-sdk

Package Overview
Dependencies
Maintainers
8
Versions
853
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

magic-sdk - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0-alpha.0

2

dist/npm/index.js

@@ -1,2 +0,2 @@

require("regenerator-runtime/runtime");var e=require("@magic-sdk/provider"),r=require("@magic-sdk/types");function t(e,r){e.prototype=Object.create(r.prototype),e.prototype.constructor=e,e.__proto__=r}function n(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}var o={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"},i=function(r){function n(){return r.apply(this,arguments)||this}t(n,r);var i=n.prototype;return i.init=function(){this.iframe=this.createIframe()},i.createIframe=function(){var r=this;return new Promise(function(t){var n=function(){if(i=encodeURIComponent(r.encodedQueryParams),a=[].slice.call(document.querySelectorAll(".magic-iframe")),Boolean(a.find(function(e){return e.src.includes(i)})))e.createDuplicateIframeWarning().log();else{var n=document.createElement("iframe");n.classList.add("magic-iframe"),n.dataset.magicIframeLabel=e.createURL(r.endpoint).host,n.src=e.createURL("/send?params="+encodeURIComponent(r.encodedQueryParams),r.endpoint).href,function(e){for(var r=0,t=Object.entries(o);r<t.length;r++){var n=t[r];e.style[n[0]]=n[1]}}(n),document.body.appendChild(n),t(n)}var i,a};["loaded","interactive","complete"].includes(document.readyState)?n():window.addEventListener("load",n,!1)})},i.showOverlay=function(){try{return Promise.resolve(this.iframe).then(function(e){e.style.display="block"})}catch(e){return Promise.reject(e)}},i.hideOverlay=function(){try{return Promise.resolve(this.iframe).then(function(e){e.style.display="none"})}catch(e){return Promise.reject(e)}},i.postMessage=function(r){try{return Promise.resolve(this.iframe).then(function(t){if(!t||!t.contentWindow)throw e.createModalNotReadyError();t.contentWindow.postMessage(r,"*")})}catch(e){return Promise.reject(e)}},n}(e.ViewController),a=e.createSDK(e.SDKBase,{target:"web",sdkName:"magic-sdk",version:"2.1.0",defaultEndpoint:"https://auth.magic.link/",ViewController:i,PayloadTransport:function(e){function r(){return e.apply(this,arguments)||this}return t(r,e),r.prototype.init=function(){var e=this;window.addEventListener("message",function(r){if(r.origin===e.endpoint&&r.data&&r.data.msgType&&e.messageHandlers.size){var t;r.data.response=null!=(t=r.data.response)?t:{};for(var o,i=function(e,r){var t;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(t=function(e,r){if(e){if("string"==typeof e)return n(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?n(e,void 0):void 0}}(e))){t&&(e=t);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(t=e[Symbol.iterator]()).next.bind(t)}(e.messageHandlers.values());!(o=i()).done;)(0,o.value)(r)}})},r}(e.PayloadTransport)});Object.keys(r).forEach(function(e){"default"!==e&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return r[e]}})}),Object.defineProperty(exports,"Extension",{enumerable:!0,get:function(){return e.Extension}}),Object.defineProperty(exports,"ExtensionError",{enumerable:!0,get:function(){return e.MagicExtensionError}}),Object.defineProperty(exports,"ExtensionWarning",{enumerable:!0,get:function(){return e.MagicExtensionWarning}}),Object.defineProperty(exports,"RPCError",{enumerable:!0,get:function(){return e.MagicRPCError}}),Object.defineProperty(exports,"SDKError",{enumerable:!0,get:function(){return e.MagicSDKError}}),Object.defineProperty(exports,"SDKWarning",{enumerable:!0,get:function(){return e.MagicSDKWarning}}),exports.Magic=a;
var t=require("@magic-sdk/provider"),e=require("@magic-sdk/types");function r(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}!function(t){var e=function(t){var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function c(t,e,r,n){var o=Object.create((e&&e.prototype instanceof l?e:l).prototype),i=new E(n||[]);return o._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=w(a,r);if(c){if(c===s)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var l=u(t,e,r);if("normal"===l.type){if(n=r.done?"completed":"suspendedYield",l.arg===s)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(n="completed",r.method="throw",r.arg=l.arg)}}}(t,r,i),o}function u(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var s={};function l(){}function f(){}function h(){}var d={};d[o]=function(){return this};var p=Object.getPrototypeOf,y=p&&p(p(L([])));y&&y!==e&&r.call(y,o)&&(d=y);var v=h.prototype=l.prototype=Object.create(d);function m(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function g(t,e){var n;this._invoke=function(o,i){function a(){return new e(function(n,a){!function n(o,i,a,c){var s=u(t[o],t,i);if("throw"!==s.type){var l=s.arg,f=l.value;return f&&"object"==typeof f&&r.call(f,"__await")?e.resolve(f.__await).then(function(t){n("next",t,a,c)},function(t){n("throw",t,a,c)}):e.resolve(f).then(function(t){l.value=t,a(l)},function(t){return n("throw",t,a,c)})}c(s.arg)}(o,i,n,a)})}return n=n?n.then(a,a):a()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return s;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return s}var n=u(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,s;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,s):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,s)}function b(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function x(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function E(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function L(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:j}}function j(){return{value:void 0,done:!0}}return f.prototype=v.constructor=h,h.constructor=f,h[a]=f.displayName="GeneratorFunction",t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,a in t||(t[a]="GeneratorFunction")),t.prototype=Object.create(v),t},t.awrap=function(t){return{__await:t}},m(g.prototype),g.prototype[i]=function(){return this},t.AsyncIterator=g,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new g(c(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then(function(t){return t.done?t.value:a.next()})},m(v),v[a]="Generator",v[o]=function(){return this},v.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=L,E.prototype={constructor:E,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,s):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),s},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),x(r),s}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;x(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:L(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),s}},t}({});try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}}();var o={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"},i=function(e){function n(){return e.apply(this,arguments)||this}r(n,e);var i=n.prototype;return i.init=function(){this.iframe=this.createIframe()},i.createIframe=function(){var e=this;return new Promise(function(r){var n=function(){if(i=encodeURIComponent(e.encodedQueryParams),a=[].slice.call(document.querySelectorAll(".magic-iframe")),Boolean(a.find(function(t){return t.src.includes(i)})))t.createDuplicateIframeWarning().log();else{var n=document.createElement("iframe");n.classList.add("magic-iframe"),n.dataset.magicIframeLabel=t.createURL(e.endpoint).host,n.src=t.createURL("/send?params="+encodeURIComponent(e.encodedQueryParams),e.endpoint).href,function(t){for(var e=0,r=Object.entries(o);e<r.length;e++){var n=r[e];t.style[n[0]]=n[1]}}(n),document.body.appendChild(n),r(n)}var i,a};["loaded","interactive","complete"].includes(document.readyState)?n():window.addEventListener("load",n,!1)})},i.showOverlay=function(){try{return Promise.resolve(this.iframe).then(function(t){t.style.display="block"})}catch(t){return Promise.reject(t)}},i.hideOverlay=function(){try{return Promise.resolve(this.iframe).then(function(t){t.style.display="none"})}catch(t){return Promise.reject(t)}},i.postMessage=function(e){try{return Promise.resolve(this.iframe).then(function(r){if(!r||!r.contentWindow)throw t.createModalNotReadyError();r.contentWindow.postMessage(e,"*")})}catch(t){return Promise.reject(t)}},n}(t.ViewController),a=t.createSDK(t.SDKBase,{target:"web",sdkName:"magic-sdk",version:"2.1.0",defaultEndpoint:"https://auth.magic.link/",ViewController:i,PayloadTransport:function(t){function e(){return t.apply(this,arguments)||this}return r(e,t),e.prototype.init=function(){var t=this;window.addEventListener("message",function(e){if(e.origin===t.endpoint&&e.data&&e.data.msgType&&t.messageHandlers.size){var r;e.data.response=null!=(r=e.data.response)?r:{};for(var o,i=function(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return n(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,void 0):void 0}}(t))){r&&(t=r);var o=0;return function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(r=t[Symbol.iterator]()).next.bind(r)}(t.messageHandlers.values());!(o=i()).done;)(0,o.value)(e)}})},e}(t.PayloadTransport)});Object.keys(e).forEach(function(t){"default"!==t&&Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})}),Object.defineProperty(exports,"Extension",{enumerable:!0,get:function(){return t.Extension}}),Object.defineProperty(exports,"ExtensionError",{enumerable:!0,get:function(){return t.MagicExtensionError}}),Object.defineProperty(exports,"ExtensionWarning",{enumerable:!0,get:function(){return t.MagicExtensionWarning}}),Object.defineProperty(exports,"RPCError",{enumerable:!0,get:function(){return t.MagicRPCError}}),Object.defineProperty(exports,"SDKError",{enumerable:!0,get:function(){return t.MagicSDKError}}),Object.defineProperty(exports,"SDKWarning",{enumerable:!0,get:function(){return t.MagicSDKWarning}}),exports.Magic=a;
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

import"regenerator-runtime/runtime";import{createModalNotReadyError as e,createURL as r,createDuplicateIframeWarning as t,ViewController as n,PayloadTransport as o,createSDK as i,SDKBase as a}from"@magic-sdk/provider";export{Extension,MagicExtensionError as ExtensionError,MagicExtensionWarning as ExtensionWarning,MagicRPCError as RPCError,MagicSDKError as SDKError,MagicSDKWarning as SDKWarning}from"@magic-sdk/provider";export*from"@magic-sdk/types";function s(e,r){e.prototype=Object.create(r.prototype),e.prototype.constructor=e,e.__proto__=r}function c(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}var d={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"},u=i(a,{target:"web",sdkName:"magic-sdk",version:"2.1.0",defaultEndpoint:"https://auth.magic.link/",ViewController:function(n){function o(){return n.apply(this,arguments)||this}s(o,n);var i=o.prototype;return i.init=function(){this.iframe=this.createIframe()},i.createIframe=function(){var e=this;return new Promise(function(n){var o=function(){if(i=encodeURIComponent(e.encodedQueryParams),a=[].slice.call(document.querySelectorAll(".magic-iframe")),Boolean(a.find(function(e){return e.src.includes(i)})))t().log();else{var o=document.createElement("iframe");o.classList.add("magic-iframe"),o.dataset.magicIframeLabel=r(e.endpoint).host,o.src=r("/send?params="+encodeURIComponent(e.encodedQueryParams),e.endpoint).href,function(e){for(var r=0,t=Object.entries(d);r<t.length;r++){var n=t[r];e.style[n[0]]=n[1]}}(o),document.body.appendChild(o),n(o)}var i,a};["loaded","interactive","complete"].includes(document.readyState)?o():window.addEventListener("load",o,!1)})},i.showOverlay=function(){try{return Promise.resolve(this.iframe).then(function(e){e.style.display="block"})}catch(e){return Promise.reject(e)}},i.hideOverlay=function(){try{return Promise.resolve(this.iframe).then(function(e){e.style.display="none"})}catch(e){return Promise.reject(e)}},i.postMessage=function(r){try{return Promise.resolve(this.iframe).then(function(t){if(!t||!t.contentWindow)throw e();t.contentWindow.postMessage(r,"*")})}catch(e){return Promise.reject(e)}},o}(n),PayloadTransport:function(e){function r(){return e.apply(this,arguments)||this}return s(r,e),r.prototype.init=function(){var e=this;window.addEventListener("message",function(r){if(r.origin===e.endpoint&&r.data&&r.data.msgType&&e.messageHandlers.size){var t;r.data.response=null!=(t=r.data.response)?t:{};for(var n,o=function(e,r){var t;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(t=function(e,r){if(e){if("string"==typeof e)return c(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?c(e,void 0):void 0}}(e))){t&&(e=t);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(t=e[Symbol.iterator]()).next.bind(t)}(e.messageHandlers.values());!(n=o()).done;)(0,n.value)(r)}})},r}(o)});export{u as Magic};
import{createModalNotReadyError as t,createURL as r,createDuplicateIframeWarning as e,ViewController as n,PayloadTransport as o,createSDK as i,SDKBase as a}from"@magic-sdk/provider";export{Extension,MagicExtensionError as ExtensionError,MagicExtensionWarning as ExtensionWarning,MagicRPCError as RPCError,MagicSDKError as SDKError,MagicSDKWarning as SDKWarning}from"@magic-sdk/provider";export*from"@magic-sdk/types";function c(t,r){t.prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r}function s(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}!function(t){var r=function(t){var r=Object.prototype,e=r.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function c(t,r,e,n){var o=Object.create((r&&r.prototype instanceof l?r:l).prototype),i=new b(n||[]);return o._invoke=function(t,r,e){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var c=w(a,e);if(c){if(c===u)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if("suspendedStart"===n)throw n="completed",e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n="executing";var l=s(t,r,e);if("normal"===l.type){if(n=e.done?"completed":"suspendedYield",l.arg===u)continue;return{value:l.arg,done:e.done}}"throw"===l.type&&(n="completed",e.method="throw",e.arg=l.arg)}}}(t,e,i),o}function s(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var u={};function l(){}function f(){}function h(){}var d={};d[o]=function(){return this};var p=Object.getPrototypeOf,y=p&&p(p(L([])));y&&y!==r&&e.call(y,o)&&(d=y);var v=h.prototype=l.prototype=Object.create(d);function m(t){["next","throw","return"].forEach(function(r){t[r]=function(t){return this._invoke(r,t)}})}function g(t,r){var n;this._invoke=function(o,i){function a(){return new r(function(n,a){!function n(o,i,a,c){var u=s(t[o],t,i);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==typeof f&&e.call(f,"__await")?r.resolve(f.__await).then(function(t){n("next",t,a,c)},function(t){n("throw",t,a,c)}):r.resolve(f).then(function(t){l.value=t,a(l)},function(t){return n("throw",t,a,c)})}c(u.arg)}(o,i,n,a)})}return n=n?n.then(a,a):a()}}function w(t,r){var e=t.iterator[r.method];if(void 0===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,w(t,r),"throw"===r.method))return u;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var n=s(e,t.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,u;var o=n.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,u):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,u)}function E(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function x(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function b(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function L(t){if(t){var r=t[o];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function r(){for(;++n<t.length;)if(e.call(t,n))return r.value=t[n],r.done=!1,r;return r.value=void 0,r.done=!0,r};return i.next=i}}return{next:S}}function S(){return{value:void 0,done:!0}}return f.prototype=v.constructor=h,h.constructor=f,h[a]=f.displayName="GeneratorFunction",t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===f||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,a in t||(t[a]="GeneratorFunction")),t.prototype=Object.create(v),t},t.awrap=function(t){return{__await:t}},m(g.prototype),g.prototype[i]=function(){return this},t.AsyncIterator=g,t.async=function(r,e,n,o,i){void 0===i&&(i=Promise);var a=new g(c(r,e,n,o),i);return t.isGeneratorFunction(e)?a:a.next().then(function(t){return t.done?t.value:a.next()})},m(v),v[a]="Generator",v[o]=function(){return this},v.toString=function(){return"[object Generator]"},t.keys=function(t){var r=[];for(var e in t)r.push(e);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=L,b.prototype={constructor:b,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!t)for(var r in this)"t"===r.charAt(0)&&e.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(e,n){return a.type="throw",a.arg=t,r.next=e,n&&(r.method="next",r.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=e.call(i,"catchLoc"),s=e.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,r){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&e.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,u):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),u},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),x(e),u}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;x(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,e){return this.delegate={iterator:L(t),resultName:r,nextLoc:e},"next"===this.method&&(this.arg=void 0),u}},t}({});try{regeneratorRuntime=r}catch(t){Function("r","regeneratorRuntime = r")(r)}}();var u={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"},l=i(a,{target:"web",sdkName:"magic-sdk",version:"2.1.0",defaultEndpoint:"https://auth.magic.link/",ViewController:function(n){function o(){return n.apply(this,arguments)||this}c(o,n);var i=o.prototype;return i.init=function(){this.iframe=this.createIframe()},i.createIframe=function(){var t=this;return new Promise(function(n){var o=function(){if(i=encodeURIComponent(t.encodedQueryParams),a=[].slice.call(document.querySelectorAll(".magic-iframe")),Boolean(a.find(function(t){return t.src.includes(i)})))e().log();else{var o=document.createElement("iframe");o.classList.add("magic-iframe"),o.dataset.magicIframeLabel=r(t.endpoint).host,o.src=r("/send?params="+encodeURIComponent(t.encodedQueryParams),t.endpoint).href,function(t){for(var r=0,e=Object.entries(u);r<e.length;r++){var n=e[r];t.style[n[0]]=n[1]}}(o),document.body.appendChild(o),n(o)}var i,a};["loaded","interactive","complete"].includes(document.readyState)?o():window.addEventListener("load",o,!1)})},i.showOverlay=function(){try{return Promise.resolve(this.iframe).then(function(t){t.style.display="block"})}catch(t){return Promise.reject(t)}},i.hideOverlay=function(){try{return Promise.resolve(this.iframe).then(function(t){t.style.display="none"})}catch(t){return Promise.reject(t)}},i.postMessage=function(r){try{return Promise.resolve(this.iframe).then(function(e){if(!e||!e.contentWindow)throw t();e.contentWindow.postMessage(r,"*")})}catch(t){return Promise.reject(t)}},o}(n),PayloadTransport:function(t){function r(){return t.apply(this,arguments)||this}return c(r,t),r.prototype.init=function(){var t=this;window.addEventListener("message",function(r){if(r.origin===t.endpoint&&r.data&&r.data.msgType&&t.messageHandlers.size){var e;r.data.response=null!=(e=r.data.response)?e:{};for(var n,o=function(t,r){var e;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(e=function(t,r){if(t){if("string"==typeof t)return s(t,void 0);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?s(t,void 0):void 0}}(t))){e&&(t=e);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(e=t[Symbol.iterator]()).next.bind(e)}(t.messageHandlers.values());!(n=o()).done;)(0,n.value)(r)}})},r}(o)});export{l as Magic};
//# sourceMappingURL=index.m.js.map

@@ -1,2 +0,2 @@

import"regenerator-runtime/runtime";import{ViewController as e,createModalNotReadyError as t,createURL as n,createDuplicateIframeWarning as a,PayloadTransport as i,createSDK as s,SDKBase as r}from"@magic-sdk/provider";export{Extension,MagicExtensionError as ExtensionError,MagicExtensionWarning as ExtensionWarning,MagicRPCError as RPCError,MagicSDKError as SDKError,MagicSDKWarning as SDKWarning}from"@magic-sdk/provider";export*from"@magic-sdk/types";const o={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"},d=s(r,{target:"web",sdkName:"magic-sdk",version:"2.1.0",defaultEndpoint:"https://auth.magic.link/",ViewController:class extends e{init(){this.iframe=this.createIframe()}createIframe(){return new Promise(e=>{const t=()=>{if(function(e){const t=[].slice.call(document.querySelectorAll(".magic-iframe"));return Boolean(t.find(t=>t.src.includes(e)))}(encodeURIComponent(this.encodedQueryParams)))a().log();else{const t=document.createElement("iframe");t.classList.add("magic-iframe"),t.dataset.magicIframeLabel=n(this.endpoint).host,t.src=n("/send?params="+encodeURIComponent(this.encodedQueryParams),this.endpoint).href,function(e){for(const[t,n]of Object.entries(o))e.style[t]=n}(t),document.body.appendChild(t),e(t)}};["loaded","interactive","complete"].includes(document.readyState)?t():window.addEventListener("load",t,!1)})}async showOverlay(){(await this.iframe).style.display="block"}async hideOverlay(){(await this.iframe).style.display="none"}async postMessage(e){const n=await this.iframe;if(!n||!n.contentWindow)throw t();n.contentWindow.postMessage(e,"*")}},PayloadTransport:class extends i{init(){window.addEventListener("message",e=>{if(e.origin===this.endpoint&&e.data&&e.data.msgType&&this.messageHandlers.size){e.data.response=e.data.response??{};for(const t of this.messageHandlers.values())t(e)}})}}});export{d as Magic};
import{ViewController as t,createModalNotReadyError as e,createURL as r,createDuplicateIframeWarning as n,PayloadTransport as o,createSDK as i,SDKBase as a}from"@magic-sdk/provider";export{Extension,MagicExtensionError as ExtensionError,MagicExtensionWarning as ExtensionWarning,MagicRPCError as RPCError,MagicSDKError as SDKError,MagicSDKWarning as SDKWarning}from"@magic-sdk/provider";export*from"@magic-sdk/types";!function(t){var e=function(t){var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function c(t,e,r,n){var o=Object.create((e&&e.prototype instanceof h?e:h).prototype),i=new L(n||[]);return o._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=w(a,r);if(c){if(c===u)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var h=s(t,e,r);if("normal"===h.type){if(n=r.done?"completed":"suspendedYield",h.arg===u)continue;return{value:h.arg,done:r.done}}"throw"===h.type&&(n="completed",r.method="throw",r.arg=h.arg)}}}(t,r,i),o}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var u={};function h(){}function l(){}function f(){}var d={};d[o]=function(){return this};var p=Object.getPrototypeOf,y=p&&p(p(b([])));y&&y!==e&&r.call(y,o)&&(d=y);var v=f.prototype=h.prototype=Object.create(d);function m(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function g(t,e){var n;this._invoke=function(o,i){function a(){return new e(function(n,a){!function n(o,i,a,c){var u=s(t[o],t,i);if("throw"!==u.type){var h=u.arg,l=h.value;return l&&"object"==typeof l&&r.call(l,"__await")?e.resolve(l.__await).then(function(t){n("next",t,a,c)},function(t){n("throw",t,a,c)}):e.resolve(l).then(function(t){h.value=t,a(h)},function(t){return n("throw",t,a,c)})}c(u.arg)}(o,i,n,a)})}return n=n?n.then(a,a):a()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return u;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,u;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,u):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,u)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function b(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:k}}function k(){return{value:void 0,done:!0}}return l.prototype=v.constructor=f,f.constructor=l,f[a]=l.displayName="GeneratorFunction",t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===l||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,f):(t.__proto__=f,a in t||(t[a]="GeneratorFunction")),t.prototype=Object.create(v),t},t.awrap=function(t){return{__await:t}},m(g.prototype),g.prototype[i]=function(){return this},t.AsyncIterator=g,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new g(c(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then(function(t){return t.done?t.value:a.next()})},m(v),v[a]="Generator",v[o]=function(){return this},v.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=b,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,u):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),u},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),u}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:b(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),u}},t}({});try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}}();const c={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"},s=i(a,{target:"web",sdkName:"magic-sdk",version:"2.1.0",defaultEndpoint:"https://auth.magic.link/",ViewController:class extends t{init(){this.iframe=this.createIframe()}createIframe(){return new Promise(t=>{const e=()=>{if(function(t){const e=[].slice.call(document.querySelectorAll(".magic-iframe"));return Boolean(e.find(e=>e.src.includes(t)))}(encodeURIComponent(this.encodedQueryParams)))n().log();else{const e=document.createElement("iframe");e.classList.add("magic-iframe"),e.dataset.magicIframeLabel=r(this.endpoint).host,e.src=r("/send?params="+encodeURIComponent(this.encodedQueryParams),this.endpoint).href,function(t){for(const[e,r]of Object.entries(c))t.style[e]=r}(e),document.body.appendChild(e),t(e)}};["loaded","interactive","complete"].includes(document.readyState)?e():window.addEventListener("load",e,!1)})}async showOverlay(){(await this.iframe).style.display="block"}async hideOverlay(){(await this.iframe).style.display="none"}async postMessage(t){const r=await this.iframe;if(!r||!r.contentWindow)throw e();r.contentWindow.postMessage(t,"*")}},PayloadTransport:class extends o{init(){window.addEventListener("message",t=>{if(t.origin===this.endpoint&&t.data&&t.data.msgType&&this.messageHandlers.size){t.data.response=t.data.response??{};for(const e of this.messageHandlers.values())e(t)}})}}});export{s as Magic};
//# sourceMappingURL=index.modern.js.map
{
"name": "magic-sdk",
"version": "2.1.0",
"version": "2.2.0-alpha.0",
"description": "Passwordless authentication for the web.",

@@ -23,3 +23,3 @@ "author": "Fortmatic <team@fortmatic.com> (https://fortmatic.com/)",

"build": "yarn run build:npm && yarn run build:cdn",
"build:npm": "microbundle build src/index.ts --define $ENV --target web --format modern,es,cjs",
"build:npm": "microbundle build src/index.ts --define $ENV --target web --format modern,es,cjs --external @magic-sdk/provider,@magic-sdk/types",
"build:cdn": "microbundle build src/index.cdn.ts --define $ENV --tsconfig tsconfig.cdn.json --output dist/magic.js --target web --name Magic --format umd --sourcemap false --external none",

@@ -31,4 +31,4 @@ "precommit": "lint-staged"

"@babel/runtime": "^7.9.6",
"@magic-sdk/provider": "^2.2.0",
"@magic-sdk/types": "^1.1.0",
"@magic-sdk/provider": "^2.3.0-alpha.0",
"@magic-sdk/types": "^1.2.0-alpha.0",
"regenerator-runtime": "0.13.5"

@@ -63,3 +63,3 @@ },

},
"gitHead": "1ef062ea699d48d5e9a9375a93b7c147632b05ca"
"gitHead": "60dfc87d2b809ce0f806820a8c9d08fd756daf1b"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc