@moneykit/connect 0.3.28 → 0.3.29

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 h from"query-string";var y={name:"@moneykit/connect",description:"MoneyKit Connect launcher for web.",version:"0.3.26",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",t.style.border="none";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 m="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=h.stringifyUrl({url:`${p}/start`,query:a});localStorage.setItem(m,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=h.stringifyUrl({url:`${p}/relink`,query:a});localStorage.setItem(m,e),this.launch(s,t,n,r)}continueLink(e,t,n,r,l){let a=localStorage.getItem(m);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=h.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,c.data.link_id||""),setTimeout(()=>{g(i),e.abort()},300);break;case"relink.complete":t&&t(c.data.institution,c.data.link_id||""),setTimeout(()=>{g(i),e.abort()},300);break;case"link.exit":localStorage.removeItem(m),setTimeout(()=>{g(i),n&&n(c.data.error),e.abort()},300);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||{}),f=(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 M={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.125)",dark:"1px solid rgba(84, 84, 88, 0.5)"},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 L=u;export{x as ThemeTypographyTextStyle,L as default,M as moneyui,f as themeTypographyStyleForTextStyle};
1
+ import g from"query-string";var y={name:"@moneykit/connect",description:"MoneyKit Connect launcher for web.",version:"0.3.29",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",t.style.border="none";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 h(i){i.remove()}var m="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,s){let l={...this.linkParametersFromOptions(),linkSessionToken:e,origin:window.location.origin,...s},c=g.stringifyUrl({url:`${p}/start`,query:l});localStorage.setItem(m,e),this.launch(c,t,n,r)}startRelink(e,t,n,r,s){let l={...this.linkParametersFromOptions(),linkSessionToken:e,origin:window.location.origin,...s},c=g.stringifyUrl({url:`${p}/relink`,query:l});localStorage.setItem(m,e),this.launch(c,t,n,r)}continueLink(e,t,n,r,s){let l=localStorage.getItem(m);l||console.warn("Unable to get MoneyKit link session token from local storage.");let c={...this.linkParametersFromOptions(),linkSessionToken:l,redirectURL:e,origin:window.location.origin,...s},o=g.stringifyUrl({url:`${p}/continue`,query:c});this.launch(o,t,n,r)}linkParametersFromOptions(){let e=this.options.__applicationName??null,t=this.options.device??null,n=this.options.stepTimers??!1,r=this.options.mockBanks===!1?"false":void 0;return{applicationName:e,device:t,stepTimers:n,mockBanks:r,launcherVersion:y.version}}launch(e,t,n,r){let s=T(e,this.options.containerID),l=new AbortController,c=b(s,l,t,n,r,this.options.__onDemoEvent,this.options.theme,this.options.colorScheme);window.addEventListener("message",c,{signal:l.signal})}};function b(i,e,t,n,r,s,l,c){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 a=o.data;switch(a.type){case"connect.started":c&&o.source?.postMessage({moneykit:!0,type:"connect.set_color_scheme",data:{colorScheme:c}},{targetOrigin:p}),l&&o.source?.postMessage({moneykit:!0,type:"connect.set_theme",data:{theme:l}},{targetOrigin:p});break;case"link.complete":t&&a.data.exchangeableToken&&t(a.data.exchangeableToken,a.data.institution,a.data.link_id||""),setTimeout(()=>{h(i),e.abort()},300);break;case"relink.complete":t&&t(a.data.institution,a.data.link_id||""),setTimeout(()=>{h(i),e.abort()},300);break;case"link.exit":localStorage.removeItem(m),setTimeout(()=>{h(i),n&&n(a.data.error),e.abort()},300);break;case"link.close_oauth":window.close();break;case"link.navigate_handoff":a.data?.url&&typeof a.data.url=="string"&&a.data.url.startsWith(p+"/")&&(window.location.href=a.data.url);break;case"link.event":r&&r(a.data);break;case"demo.link.event":s&&s(a.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||{}),B=(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 w={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.125)",dark:"1px solid rgba(84, 84, 88, 0.5)"},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 L=u;export{x as ThemeTypographyTextStyle,L as default,w as moneyui,B 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.28",
4
+ "version": "0.3.29",
5
5
  "author": "MoneyKit",
6
6
  "repository": {
7
7
  "type": "git",
@@ -13,6 +13,22 @@
13
13
  "query-string": "^8.1.0"
14
14
  },
15
15
  "packageManager": "pnpm@10.7.1",
16
+ "pnpm": {
17
+ "overrides": {
18
+ "node-forge": ">=1.3.2",
19
+ "@clerk/backend": ">=1.15.6",
20
+ "@sentry/browser": ">=8.0.0",
21
+ "@babel/traverse": ">=7.23.2",
22
+ "validator": ">=13.12.0",
23
+ "micromatch": ">=4.0.8",
24
+ "js-yaml": ">=4.1.0",
25
+ "koa": ">=2.16.1",
26
+ "dompurify": ">=3.1.7",
27
+ "on-headers": ">=1.0.2",
28
+ "tmp": ">=0.2.3",
29
+ "brace-expansion": ">=2.0.1 <3.0.0"
30
+ }
31
+ },
16
32
  "module": "./index.js",
17
33
  "type": "module",
18
34
  "main": "./index.js"
@@ -35,6 +35,13 @@ export type MoneyKitOptions = {
35
35
  colorScheme?: MoneyKitColorScheme;
36
36
  device?: MoneyKitDevice;
37
37
  stepTimers?: boolean;
38
+ /**
39
+ * Starting position of the sandbox "Mock Banks" switch. `false` opens on
40
+ * OAuth Bank, Instant Bank, and Credentials Bank and hides the sandbox
41
+ * toolbar. Omitted leaves Connect's default, and flipping the switch during
42
+ * a session does not hide the toolbar.
43
+ */
44
+ mockBanks?: boolean;
38
45
  containerID?: string;
39
46
  __onDemoEvent?: LinkEventCallback;
40
47
  __connectSDKUIHost?: string;