@moneykit/connect 0.3.18 → 0.3.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1 +1 @@
1
- import c from"query-string";var d={name:"@moneykit/connect",description:"MoneyKit Connect launcher for web.",version:"0.3.18",author:"MoneyKit",repository:{type:"git",url:"https://github.com/moneykit/connect-js.git"},types:"./types/index.d.ts",license:"MIT"};var p="https://connect.moneykit.com";function k(i,e){let t=document.createElement("iframe");t.id="moneykit-connect-frame",t.src=i,t.style.position=e?"absolute":"fixed",t.style.top="0",t.style.left="0",t.style.width=e?"100%":"100vw",t.style.height=e?"100%":"100svh",t.style.zIndex="999999";let n=e?document.getElementById(e):document.body;if(!n)throw new Error(`MoneyKit could not find container element with ID "${e}".`);return n.appendChild(t),t.addEventListener("load",function(){t.focus()}),t}function m(i){i.remove()}var g="moneykit.linkSessionToken",h=class{constructor(e={}){p=e.__connectSDKUIHost??p,this.options={...e}}link(e,t,n,r){this.startLink(e,t,n,r)}relink(e,t,n,r){this.startRelink(e,t,n,r)}continue(e,t,n,r){if(window.opener){window.opener.postMessage({moneykit:!0,type:"link.resume",eventData:{redirectURL:e}},p);return}this.continueLink(e,t,n,r)}__linkDirect(e,t,n,r){this.startLink(e,t,n,r,{viewMode:"direct"})}__relinkDirect(e,t,n,r){this.startRelink(e,t,n,r,{viewMode:"direct"})}__continueDirect(e,t,n,r){this.continueLink(e,t,n,r,{viewMode:"direct"})}startLink(e,t,n,r,s){let l={...this.linkParametersFromOptions(),linkSessionToken:e,origin:window.location.origin,...s},a=c.stringifyUrl({url:`${p}/start`,query:l});localStorage.setItem(g,e),this.launch(a,t,n,r)}startRelink(e,t,n,r,s){let l={...this.linkParametersFromOptions(),linkSessionToken:e,origin:window.location.origin,...s},a=c.stringifyUrl({url:`${p}/relink`,query:l});localStorage.setItem(g,e),this.launch(a,t,n,r)}continueLink(e,t,n,r,s){let l=localStorage.getItem(g);l||console.warn("Unable to get MoneyKit link session token from local storage.");let a={...this.linkParametersFromOptions(),linkSessionToken:l,redirectURL:e,origin:window.location.origin,...s},o=c.stringifyUrl({url:`${p}/continue`,query:a});this.launch(o,t,n,r)}linkParametersFromOptions(){let e=this.options.__applicationName??null,t=this.options.device??null,n=this.options.stepTimers??!1;return{applicationName:e,device:t,stepTimers:n,launcherVersion:d.version}}launch(e,t,n,r){let s=k(e,this.options.containerID),l=new AbortController,a=T(s,l,t,n,r,this.options.__onDemoEvent,this.options.theme);window.addEventListener("message",a,{signal:l.signal})}};function T(i,e,t,n,r,s,l){return a=>{if(a.origin!=p||!("moneykit"in a.data||"__moneykitDemo"in a.data))return;let o=a.data;switch(o.type){case"connect.started":l&&a.source?.postMessage({moneykit:!0,type:"connect.set_theme",data:{theme:l}},{targetOrigin:p});break;case"link.complete":t&&o.data.exchangeableToken&&t(o.data.exchangeableToken,o.data.institution),m(i),e.abort();break;case"relink.complete":t&&t(o.data.institution),m(i),e.abort();break;case"link.exit":m(i),n&&n(o.data.error),e.abort();break;case"link.close_oauth":window.close();break;case"link.event":r&&r(o.data);break;case"demo.link.event":s&&s(o.data);break}}}var y=h;var b=(o=>(o[o.largeTitle=0]="largeTitle",o[o.title1=1]="title1",o[o.title2=2]="title2",o[o.title3=3]="title3",o[o.body=4]="body",o[o.smallBody=5]="smallBody",o[o.button=6]="button",o[o.input=7]="input",o))(b||{}),v=(i,e)=>{switch(e){case 0:return i.typography.largeTitle;case 1:return i.typography.title1;case 2:return i.typography.title2;case 3:return i.typography.title3;case 5:return i.typography.smallBody;case 6:return i.typography.button;case 7:return i.typography.input;default:return i.typography.body}};var f={colors:{accent:"#0077ff",primaryBackground:{light:"#fff",dark:"#212124"},secondaryBackground:{light:"#f2f2f5",dark:"#212124"},primaryContent:{light:"#fff",dark:"#343438"},secondaryContent:{light:"#f5f5f5",dark:"#343438"},primaryForeground:{light:"#111",dark:"#fff"},secondaryForeground:{light:"rgba(67, 67, 76, 0.6)",dark:"rgba(235, 235, 245, 0.6)"},tertiaryForeground:{light:"rgba(67, 67, 76, 0.3)",dark:"rgba(235, 234, 244, 0.3)"},primaryFill:{light:"rgba(120, 120, 128, 0.2)",dark:"rgba(120, 120, 128, 0.36)"},secondaryFill:{light:"rgba(120, 120, 128, 0.16)",dark:"rgba(120, 120, 128, 0.32)"},tertiaryFill:{light:"rgba(118, 118, 128, 0.12)",dark:"rgba(118, 118, 128, 0.24)"},success:{light:"#00ca32",dark:"#35DE5F"},warning:{light:"#ff9500",dark:"#FF9400"},error:{light:"#dd2424",dark:"#FA4242"},separator:{light:"rgba(60, 60, 67, 0.06)",dark:"rgba(84, 84, 88, 0.4)"},selection:{light:"rgba(120, 120, 128, 0.28)",dark:"rgba(120, 120, 128, 0.48)"}},typography:{fontFamily:"Inter, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif",largeTitle:{size:"34px",lineHeight:"41px",letterSpacing:"-0.01em",weight:700},title1:{size:"28px",lineHeight:"34px",letterSpacing:"0",weight:700},title2:{size:"22px",lineHeight:"28px",letterSpacing:"0",weight:700},title3:{size:"20px",lineHeight:"24px",letterSpacing:"0",weight:700},body:{size:"17px",lineHeight:"24px",letterSpacing:"-0.01em",weight:500},smallBody:{size:"11px",lineHeight:"16px",letterSpacing:"-0.0225em",weight:400},button:{size:"18px",lineHeight:"24px",letterSpacing:"-1%",weight:700},input:{size:"18px",lineHeight:"24px",letterSpacing:"0",weight:500}},images:{close:"/images/close.svg",search:"/images/search.svg",spinner:"/images/spinner.png"},spacing:{contentHorizontalInset:"28px",buttonHorizontalInset:"28px"},components:{navigationBar:{height:"64px"},contentView:{borderRadius:"12px",boxShadow:{light:"none",dark:"inset 0 0 0 1px rgba(228, 227, 243, 0.04)"},border:null,separatorStyle:"all_except_last"},button:{height:"44px",borderRadius:"12px",inheritInstitutionColor:!0,continueTitle:"Continue",doneTitle:"Done"},searchInput:{backgroundColor:{light:"rgba(118, 118, 128, 0.12)",dark:"rgba(118, 118, 128, 0.24)"},height:"48px",borderRadius:"12px",border:null,alignment:"center",focus:{glow:!0,backgroundColor:null,border:null,boxShadow:null}},textField:{backgroundColor:null,height:"52px",borderRadius:"0px",boxShadow:null,focus:{glow:!0,backgroundColor:null,border:null,boxShadow:null}},progressSpinner:{strokeWidth:8,diameter:56,lineCap:"round"},icon:{strokeWidth:8,lineCap:"round"},separator:{height:"1px"}},screens:{finder:{title:"Connect Your Bank",subtitle:null,searchPlaceholder:"Search Banks",institutionCellBoxShadow:null,institutionCellBorderRadius:"12px",institutionCellBorder:{light:"1px solid rgba(60, 60, 67, 0.1)",dark:"1px solid rgba(84, 84, 88, 0.4)"},institutionCellSpacing:"16px",institutionCellBackgroundColor:{light:"#fff",dark:"#212124"}}},modal:{borderRadius:"20px",boxShadow:{light:"0px 2px 4px rgba(0, 0, 0, 0.1), 0 40px 80px rgba(0,0,0,.15)",dark:"inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 0 0 1px black, 0px 6px 18px rgba(0, 0, 0, 0.3)"},overlayBackgroundColor:{light:"rgba(0, 0, 0, 0.4)",dark:"rgba(0, 0, 0, 0.75)"},overlayBackdropFilter:null},popover:{borderRadius:"24px",boxShadow:{light:"0px 0px 80px rgba(0, 0, 0, 0.16)",dark:"inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 0 0 1px black, 0px 6px 18px rgba(0, 0, 0, 0.3)"}}};var I=y;export{b as ThemeTypographyTextStyle,I as default,f as moneyui,v as themeTypographyStyleForTextStyle};
1
+ import m from"query-string";var y={name:"@moneykit/connect",description:"MoneyKit Connect launcher for web.",version:"0.3.20",author:"MoneyKit",repository:{type:"git",url:"https://github.com/moneykit/connect-js.git"},types:"./types/index.d.ts",license:"MIT"};var p="https://connect.moneykit.com";function T(i,e){let t=document.createElement("iframe");t.id="moneykit-connect-frame",t.src=i,t.style.position=e?"absolute":"fixed",t.style.top="0",t.style.left="0",t.style.width=e?"100%":"100vw",t.style.height=e?"100%":"100svh",t.style.zIndex="999999";let n=e?document.getElementById(e):document.body;if(!n)throw new Error(`MoneyKit could not find container element with ID "${e}".`);return n.appendChild(t),t.addEventListener("load",function(){t.focus()}),t}function g(i){i.remove()}var h="moneykit.linkSessionToken",d=class{constructor(e={}){p=e.__connectSDKUIHost??p,this.options={...e}}link(e,t,n,r){this.startLink(e,t,n,r)}relink(e,t,n,r){this.startRelink(e,t,n,r)}continue(e,t,n,r){if(window.opener){window.opener.postMessage({moneykit:!0,type:"link.resume",eventData:{redirectURL:e}},p);return}this.continueLink(e,t,n,r)}__linkDirect(e,t,n,r){this.startLink(e,t,n,r,{viewMode:"direct"})}__relinkDirect(e,t,n,r){this.startRelink(e,t,n,r,{viewMode:"direct"})}__continueDirect(e,t,n,r){this.continueLink(e,t,n,r,{viewMode:"direct"})}startLink(e,t,n,r,l){let a={...this.linkParametersFromOptions(),linkSessionToken:e,origin:window.location.origin,...l},s=m.stringifyUrl({url:`${p}/start`,query:a});localStorage.setItem(h,e),this.launch(s,t,n,r)}startRelink(e,t,n,r,l){let a={...this.linkParametersFromOptions(),linkSessionToken:e,origin:window.location.origin,...l},s=m.stringifyUrl({url:`${p}/relink`,query:a});localStorage.setItem(h,e),this.launch(s,t,n,r)}continueLink(e,t,n,r,l){let a=localStorage.getItem(h);a||console.warn("Unable to get MoneyKit link session token from local storage.");let s={...this.linkParametersFromOptions(),linkSessionToken:a,redirectURL:e,origin:window.location.origin,...l},o=m.stringifyUrl({url:`${p}/continue`,query:s});this.launch(o,t,n,r)}linkParametersFromOptions(){let e=this.options.__applicationName??null,t=this.options.device??null,n=this.options.stepTimers??!1;return{applicationName:e,device:t,stepTimers:n,launcherVersion:y.version}}launch(e,t,n,r){let l=T(e,this.options.containerID),a=new AbortController,s=b(l,a,t,n,r,this.options.__onDemoEvent,this.options.theme,this.options.colorScheme);window.addEventListener("message",s,{signal:a.signal})}};function b(i,e,t,n,r,l,a,s){return o=>{if(o.origin!=p||!("moneykit"in o.data||"__moneykitDemo"in o.data)){console.warn("MoneyKit Connect received a message from an unexpected origin",o.origin);return}let c=o.data;switch(c.type){case"connect.started":s&&o.source?.postMessage({moneykit:!0,type:"connect.set_color_scheme",data:{colorScheme:s}},{targetOrigin:p}),a&&o.source?.postMessage({moneykit:!0,type:"connect.set_theme",data:{theme:a}},{targetOrigin:p});break;case"link.complete":t&&c.data.exchangeableToken&&t(c.data.exchangeableToken,c.data.institution),g(i),e.abort();break;case"relink.complete":t&&t(c.data.institution),g(i),e.abort();break;case"link.exit":g(i),n&&n(c.data.error),e.abort();break;case"link.close_oauth":window.close();break;case"link.event":r&&r(c.data);break;case"demo.link.event":l&&l(c.data);break}}}var u=d;var x=(o=>(o[o.largeTitle=0]="largeTitle",o[o.title1=1]="title1",o[o.title2=2]="title2",o[o.title3=3]="title3",o[o.body=4]="body",o[o.smallBody=5]="smallBody",o[o.button=6]="button",o[o.input=7]="input",o))(x||{}),w=(i,e)=>{switch(e){case 0:return i.typography.largeTitle;case 1:return i.typography.title1;case 2:return i.typography.title2;case 3:return i.typography.title3;case 5:return i.typography.smallBody;case 6:return i.typography.button;case 7:return i.typography.input;default:return i.typography.body}};var f={colors:{accent:"#0077ff",primaryBackground:{light:"#fff",dark:"#212124"},secondaryBackground:{light:"#f2f2f5",dark:"#212124"},primaryContent:{light:"#fff",dark:"#343438"},secondaryContent:{light:"#f5f5f5",dark:"#343438"},primaryForeground:{light:"#111",dark:"#fff"},secondaryForeground:{light:"rgba(67, 67, 76, 0.6)",dark:"rgba(235, 235, 245, 0.6)"},tertiaryForeground:{light:"rgba(67, 67, 76, 0.3)",dark:"rgba(235, 234, 244, 0.3)"},primaryFill:{light:"rgba(120, 120, 128, 0.2)",dark:"rgba(120, 120, 128, 0.36)"},secondaryFill:{light:"rgba(120, 120, 128, 0.16)",dark:"rgba(120, 120, 128, 0.32)"},tertiaryFill:{light:"rgba(118, 118, 128, 0.12)",dark:"rgba(118, 118, 128, 0.24)"},success:{light:"#00ca32",dark:"#35DE5F"},warning:{light:"#ff9500",dark:"#FF9400"},error:{light:"#dd2424",dark:"#FA4242"},separator:{light:"rgba(60, 60, 67, 0.06)",dark:"rgba(84, 84, 88, 0.4)"},selection:{light:"rgba(120, 120, 128, 0.28)",dark:"rgba(120, 120, 128, 0.48)"}},typography:{fontFamily:"Inter, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif",largeTitle:{size:"34px",lineHeight:"41px",letterSpacing:"-0.01em",weight:700},title1:{size:"28px",lineHeight:"34px",letterSpacing:"0",weight:700},title2:{size:"22px",lineHeight:"28px",letterSpacing:"0",weight:700},title3:{size:"20px",lineHeight:"24px",letterSpacing:"0",weight:700},body:{size:"17px",lineHeight:"24px",letterSpacing:"-0.01em",weight:500},smallBody:{size:"11px",lineHeight:"16px",letterSpacing:"-0.0225em",weight:400},button:{size:"18px",lineHeight:"24px",letterSpacing:"-1%",weight:700},input:{size:"18px",lineHeight:"24px",letterSpacing:"0",weight:500}},images:{close:"/images/close.svg",search:"/images/search.svg",spinner:"/images/spinner.png"},spacing:{contentHorizontalInset:"28px",buttonHorizontalInset:"28px"},components:{navigationBar:{height:"64px"},contentView:{borderRadius:"12px",boxShadow:{light:"none",dark:"inset 0 0 0 1px rgba(228, 227, 243, 0.04)"},border:null,separatorStyle:"all_except_last"},button:{height:"44px",borderRadius:"12px",inheritInstitutionColor:!0,continueTitle:"Continue",doneTitle:"Done"},searchInput:{backgroundColor:{light:"rgba(118, 118, 128, 0.12)",dark:"rgba(118, 118, 128, 0.24)"},height:"48px",borderRadius:"12px",border:null,alignment:"center",focus:{glow:!0,backgroundColor:null,border:null,boxShadow:null}},textField:{backgroundColor:null,height:"52px",borderRadius:"0px",boxShadow:null,focus:{glow:!0,backgroundColor:null,border:null,boxShadow:null}},progressSpinner:{strokeWidth:8,diameter:56,lineCap:"round"},icon:{strokeWidth:8,lineCap:"round"},separator:{height:"1px"}},screens:{finder:{title:"Connect Your Bank",subtitle:null,searchPlaceholder:"Search Banks",institutionCellBoxShadow:null,institutionCellBorderRadius:"12px",institutionCellBorder:{light:"1px solid rgba(60, 60, 67, 0.1)",dark:"1px solid rgba(84, 84, 88, 0.4)"},institutionCellSpacing:"16px",institutionCellBackgroundColor:{light:"#fff",dark:"#212124"}}},modal:{borderRadius:"20px",boxShadow:{light:"0px 2px 4px rgba(0, 0, 0, 0.1), 0 40px 80px rgba(0,0,0,.15)",dark:"inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 0 0 1px black, 0px 6px 18px rgba(0, 0, 0, 0.3)"},overlayBackgroundColor:{light:"rgba(0, 0, 0, 0.4)",dark:"rgba(0, 0, 0, 0.75)"},overlayBackdropFilter:null},popover:{borderRadius:"24px",boxShadow:{light:"0px 0px 80px rgba(0, 0, 0, 0.16)",dark:"inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 0 0 1px black, 0px 6px 18px rgba(0, 0, 0, 0.3)"}}};var D=u;export{x as ThemeTypographyTextStyle,D as default,f as moneyui,w as themeTypographyStyleForTextStyle};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@moneykit/connect",
3
3
  "description": "MoneyKit Connect launcher for web.",
4
- "version": "0.3.18",
4
+ "version": "0.3.20",
5
5
  "author": "MoneyKit",
6
6
  "repository": {
7
7
  "type": "git",
@@ -27,8 +27,10 @@ export type LinkedInstitution = Institution & {
27
27
  }[];
28
28
  };
29
29
  export type MoneyKitDevice = "mobile" | "desktop" | "mobile-playground";
30
+ export type MoneyKitColorScheme = "light" | "dark" | "auto";
30
31
  export type MoneyKitOptions = {
31
32
  theme?: Theme;
33
+ colorScheme?: MoneyKitColorScheme;
32
34
  device?: MoneyKitDevice;
33
35
  stepTimers?: boolean;
34
36
  containerID?: string;