Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@integrationos/authkit

Package Overview
Dependencies
Maintainers
5
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@integrationos/authkit - npm Package Compare versions

Comparing version
1.0.0
to
1.0.1
+1
-1
dist/index.esm.js

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

function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function t(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function n(e,n){for(var i=0;i<n.length;i++){var o=n[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,t(o.key),o)}}function i(e,n,i){return(n=t(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}var o=function(){return e=function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),i(this,"linkTokenEndpoint",void 0),i(this,"linkHeaders",void 0),i(this,"baseUrl",void 0),i(this,"onClose",void 0),i(this,"title",void 0),i(this,"selectedConnection",void 0),i(this,"showNameInput",void 0),i(this,"appTheme",void 0),this.linkTokenEndpoint=t.token.url,this.linkHeaders=t.token.headers,this.baseUrl=t.baseUrl,this.onClose=t.onClose,this.title=t.title,this.selectedConnection=t.selectedConnection,this.showNameInput=t.showNameInput,this.appTheme=t.appTheme},(t=[{key:"_getBaseUrl",value:function(){return this.baseUrl?this.baseUrl:"https://authkit.integrationos.com"}},{key:"openLink",value:function(){var e=this,t=document.createElement("iframe"),n=JSON.stringify({linkTokenEndpoint:this.linkTokenEndpoint,linkHeaders:this.linkHeaders,title:this.title,selectedConnection:this.selectedConnection,showNameInput:this.showNameInput,appTheme:this.appTheme}),i=btoa(n),o=new URLSearchParams({data:i}).toString(),r="".concat(this._getBaseUrl(),"?").concat(o);document.body.appendChild(t),t.style.height="100%",t.style.width="100%",t.style.position="fixed",t.style.display="block",t.style.zIndex="9999",t.style.backgroundColor="transparent",t.style.inset="0px",t.style.borderWidth="0px",t.id="event-link",t.src=r,t.style.overflow="hidden auto",t.onload=function(){var n;null===(n=t.contentWindow)||void 0===n||n.postMessage({linkTokenEndpoint:e.linkTokenEndpoint,linkHeaders:e.linkHeaders,title:e.title,selectedConnection:e.selectedConnection,showNameInput:e.showNameInput,appTheme:e.appTheme},r)}}},{key:"closeLink",value:function(){var e,t=document.getElementById("event-link");t&&t.remove(),null===(e=this.onClose)||void 0===e||e.call(this)}}])&&n(e.prototype,t),o&&n(e,o),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,o}(),r=function(t){var n=function(e){return new o(e)}(function(t){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?e(Object(o),!0).forEach((function(e){i(t,e,o[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):e(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}({},t));window.addEventListener("message",(function(e){var i,o,r,s,l,a,c=document.getElementById("event-link");if("block"===(null==c||null===(i=c.style)||void 0===i?void 0:i.display))switch(null===(a=e.data)||void 0===a?void 0:a.messageType){case"EXIT_EVENT_LINK":n.closeLink();break;case"LINK_SUCCESS":null===(o=t.onSuccess)||void 0===o||o.call(t,null===(r=e.data)||void 0===r?void 0:r.message);break;case"LINK_ERROR":null===(s=t.onError)||void 0===s||s.call(t,null===(l=e.data)||void 0===l?void 0:l.message)}}));return{open:function(){n.openLink()},close:function(){n.closeLink()}}};export{r as useAuthKit};
function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function t(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function n(e,n){for(var i=0;i<n.length;i++){var o=n[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,t(o.key),o)}}function i(e,n,i){return(n=t(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}var o=function(){return e=function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),i(this,"linkTokenEndpoint",void 0),i(this,"linkHeaders",void 0),i(this,"baseUrl",void 0),i(this,"onClose",void 0),i(this,"title",void 0),i(this,"selectedConnection",void 0),i(this,"showNameInput",void 0),i(this,"appTheme",void 0),this.linkTokenEndpoint=t.token.url,this.linkHeaders=t.token.headers,this.baseUrl=t.baseUrl,this.onClose=t.onClose,this.title=t.title,this.selectedConnection=t.selectedConnection,this.showNameInput=t.showNameInput,this.appTheme=t.appTheme},(t=[{key:"_getBaseUrl",value:function(){return this.baseUrl?this.baseUrl:"https://authkit.integrationos.com"}},{key:"openLink",value:function(){var e=this,t=document.createElement("iframe"),n=JSON.stringify({linkTokenEndpoint:this.linkTokenEndpoint,linkHeaders:this.linkHeaders,title:this.title,selectedConnection:this.selectedConnection,showNameInput:this.showNameInput,appTheme:this.appTheme}),i=btoa(n),o=new URLSearchParams({data:i}).toString(),r="".concat(this._getBaseUrl(),"?").concat(o);document.body.appendChild(t),t.style.height="100%",t.style.width="100%",t.style.position="fixed",t.style.display="block",t.style.zIndex="9999",t.style.backgroundColor="transparent",t.style.inset="0px",t.style.borderWidth="0px",t.id="event-link",t.src=r,t.style.overflow="hidden auto",t.onload=function(){var n;null===(n=t.contentWindow)||void 0===n||n.postMessage({linkTokenEndpoint:e.linkTokenEndpoint,linkHeaders:e.linkHeaders,title:e.title,selectedConnection:e.selectedConnection,showNameInput:e.showNameInput,appTheme:e.appTheme},r)}}},{key:"closeLink",value:function(){var e,t=document.getElementById("event-link");t&&t.remove(),null===(e=this.onClose)||void 0===e||e.call(this)}}])&&n(e.prototype,t),o&&n(e,o),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,o}(),r=function(t){var n=function(e){return new o(e)}(function(t){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?e(Object(o),!0).forEach((function(e){i(t,e,o[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):e(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}({},t));"undefined"!=typeof window&&window.addEventListener("message",(function(e){var i,o,r,s;if("undefined"!=typeof window){var l,a,c=document.getElementById("event-link");if("block"===(null==c||null===(l=c.style)||void 0===l?void 0:l.display))switch(null===(a=e.data)||void 0===a?void 0:a.messageType){case"EXIT_EVENT_LINK":n.closeLink();break;case"LINK_SUCCESS":null===(i=t.onSuccess)||void 0===i||i.call(t,null===(o=e.data)||void 0===o?void 0:o.message);break;case"LINK_ERROR":null===(r=t.onError)||void 0===r||r.call(t,null===(s=e.data)||void 0===s?void 0:s.message)}}}));return{open:function(){n.openLink()},close:function(){n.closeLink()}}};export{r as useAuthKit};

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

"use strict";function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function t(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function n(e,n){for(var i=0;i<n.length;i++){var o=n[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,t(o.key),o)}}function i(e,n,i){return(n=t(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}Object.defineProperty(exports,"__esModule",{value:!0});var o=function(){return e=function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),i(this,"linkTokenEndpoint",void 0),i(this,"linkHeaders",void 0),i(this,"baseUrl",void 0),i(this,"onClose",void 0),i(this,"title",void 0),i(this,"selectedConnection",void 0),i(this,"showNameInput",void 0),i(this,"appTheme",void 0),this.linkTokenEndpoint=t.token.url,this.linkHeaders=t.token.headers,this.baseUrl=t.baseUrl,this.onClose=t.onClose,this.title=t.title,this.selectedConnection=t.selectedConnection,this.showNameInput=t.showNameInput,this.appTheme=t.appTheme},(t=[{key:"_getBaseUrl",value:function(){return this.baseUrl?this.baseUrl:"https://authkit.integrationos.com"}},{key:"openLink",value:function(){var e=this,t=document.createElement("iframe"),n=JSON.stringify({linkTokenEndpoint:this.linkTokenEndpoint,linkHeaders:this.linkHeaders,title:this.title,selectedConnection:this.selectedConnection,showNameInput:this.showNameInput,appTheme:this.appTheme}),i=btoa(n),o=new URLSearchParams({data:i}).toString(),r="".concat(this._getBaseUrl(),"?").concat(o);document.body.appendChild(t),t.style.height="100%",t.style.width="100%",t.style.position="fixed",t.style.display="block",t.style.zIndex="9999",t.style.backgroundColor="transparent",t.style.inset="0px",t.style.borderWidth="0px",t.id="event-link",t.src=r,t.style.overflow="hidden auto",t.onload=function(){var n;null===(n=t.contentWindow)||void 0===n||n.postMessage({linkTokenEndpoint:e.linkTokenEndpoint,linkHeaders:e.linkHeaders,title:e.title,selectedConnection:e.selectedConnection,showNameInput:e.showNameInput,appTheme:e.appTheme},r)}}},{key:"closeLink",value:function(){var e,t=document.getElementById("event-link");t&&t.remove(),null===(e=this.onClose)||void 0===e||e.call(this)}}])&&n(e.prototype,t),o&&n(e,o),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,o}();exports.useAuthKit=function(t){var n=function(e){return new o(e)}(function(t){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?e(Object(o),!0).forEach((function(e){i(t,e,o[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):e(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}({},t));window.addEventListener("message",(function(e){var i,o,r,s,l,a,c=document.getElementById("event-link");if("block"===(null==c||null===(i=c.style)||void 0===i?void 0:i.display))switch(null===(a=e.data)||void 0===a?void 0:a.messageType){case"EXIT_EVENT_LINK":n.closeLink();break;case"LINK_SUCCESS":null===(o=t.onSuccess)||void 0===o||o.call(t,null===(r=e.data)||void 0===r?void 0:r.message);break;case"LINK_ERROR":null===(s=t.onError)||void 0===s||s.call(t,null===(l=e.data)||void 0===l?void 0:l.message)}}));return{open:function(){n.openLink()},close:function(){n.closeLink()}}};
"use strict";function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function t(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function n(e,n){for(var i=0;i<n.length;i++){var o=n[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,t(o.key),o)}}function i(e,n,i){return(n=t(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}Object.defineProperty(exports,"__esModule",{value:!0});var o=function(){return e=function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),i(this,"linkTokenEndpoint",void 0),i(this,"linkHeaders",void 0),i(this,"baseUrl",void 0),i(this,"onClose",void 0),i(this,"title",void 0),i(this,"selectedConnection",void 0),i(this,"showNameInput",void 0),i(this,"appTheme",void 0),this.linkTokenEndpoint=t.token.url,this.linkHeaders=t.token.headers,this.baseUrl=t.baseUrl,this.onClose=t.onClose,this.title=t.title,this.selectedConnection=t.selectedConnection,this.showNameInput=t.showNameInput,this.appTheme=t.appTheme},(t=[{key:"_getBaseUrl",value:function(){return this.baseUrl?this.baseUrl:"https://authkit.integrationos.com"}},{key:"openLink",value:function(){var e=this,t=document.createElement("iframe"),n=JSON.stringify({linkTokenEndpoint:this.linkTokenEndpoint,linkHeaders:this.linkHeaders,title:this.title,selectedConnection:this.selectedConnection,showNameInput:this.showNameInput,appTheme:this.appTheme}),i=btoa(n),o=new URLSearchParams({data:i}).toString(),r="".concat(this._getBaseUrl(),"?").concat(o);document.body.appendChild(t),t.style.height="100%",t.style.width="100%",t.style.position="fixed",t.style.display="block",t.style.zIndex="9999",t.style.backgroundColor="transparent",t.style.inset="0px",t.style.borderWidth="0px",t.id="event-link",t.src=r,t.style.overflow="hidden auto",t.onload=function(){var n;null===(n=t.contentWindow)||void 0===n||n.postMessage({linkTokenEndpoint:e.linkTokenEndpoint,linkHeaders:e.linkHeaders,title:e.title,selectedConnection:e.selectedConnection,showNameInput:e.showNameInput,appTheme:e.appTheme},r)}}},{key:"closeLink",value:function(){var e,t=document.getElementById("event-link");t&&t.remove(),null===(e=this.onClose)||void 0===e||e.call(this)}}])&&n(e.prototype,t),o&&n(e,o),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,o}();exports.useAuthKit=function(t){var n=function(e){return new o(e)}(function(t){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?e(Object(o),!0).forEach((function(e){i(t,e,o[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):e(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}({},t));"undefined"!=typeof window&&window.addEventListener("message",(function(e){var i,o,r,s;if("undefined"!=typeof window){var l,a,c=document.getElementById("event-link");if("block"===(null==c||null===(l=c.style)||void 0===l?void 0:l.display))switch(null===(a=e.data)||void 0===a?void 0:a.messageType){case"EXIT_EVENT_LINK":n.closeLink();break;case"LINK_SUCCESS":null===(i=t.onSuccess)||void 0===i||i.call(t,null===(o=e.data)||void 0===o?void 0:o.message);break;case"LINK_ERROR":null===(r=t.onError)||void 0===r||r.call(t,null===(s=e.data)||void 0===s?void 0:s.message)}}}));return{open:function(){n.openLink()},close:function(){n.closeLink()}}};
{
"name": "@integrationos/authkit",
"version": "1.0.0",
"version": "1.0.1",
"description": "Frontend bindings for IntegrationOS AuthKit",

@@ -5,0 +5,0 @@ "files": [

@@ -8,14 +8,18 @@ import { ConnectionRecord, EventLinkProps, EventProps } from "./types";

const handleMessage = (event: EventProps) => {
const iFrameWindow = document.getElementById(`event-link`) as HTMLIFrameElement;
if (iFrameWindow?.style?.display === "block") {
switch (event.data?.messageType) {
case "EXIT_EVENT_LINK":
linkWindow.closeLink();
break;
case "LINK_SUCCESS":
props.onSuccess?.(event.data?.message as ConnectionRecord);
break;
case "LINK_ERROR":
props.onError?.(event.data?.message as string);
break;
if (typeof window !== "undefined") {
const iFrameWindow = document.getElementById(
`event-link`
) as HTMLIFrameElement;
if (iFrameWindow?.style?.display === "block") {
switch (event.data?.messageType) {
case "EXIT_EVENT_LINK":
linkWindow.closeLink();
break;
case "LINK_SUCCESS":
props.onSuccess?.(event.data?.message as ConnectionRecord);
break;
case "LINK_ERROR":
props.onError?.(event.data?.message as string);
break;
}
}

@@ -25,3 +29,5 @@ }

window.addEventListener("message", handleMessage);
if (typeof window !== "undefined") {
window.addEventListener("message", handleMessage);
}

@@ -28,0 +34,0 @@ const open = () => {