@moneykit/connect 0.3.20 → 0.3.21
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 +1 -1
- package/package.json +1 -1
- package/types/lib/connect-theme.d.ts +11 -0
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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
|
|
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 o=e?document.getElementById(e):document.body;if(!o)throw new Error(`MoneyKit could not find container element with ID "${e}".`);return o.appendChild(t),t.addEventListener("load",function(){t.focus()}),t}function h(i){i.remove()}var g="moneykit.linkSessionToken",d=class{constructor(e={}){p=e.__connectSDKUIHost??p,this.options={...e}}link(e,t,o,r){this.startLink(e,t,o,r)}relink(e,t,o,r){this.startRelink(e,t,o,r)}continue(e,t,o,r){if(window.opener){window.opener.postMessage({moneykit:!0,type:"link.resume",eventData:{redirectURL:e}},p);return}this.continueLink(e,t,o,r)}__linkDirect(e,t,o,r){this.startLink(e,t,o,r,{viewMode:"direct"})}__relinkDirect(e,t,o,r){this.startRelink(e,t,o,r,{viewMode:"direct"})}__continueDirect(e,t,o,r){this.continueLink(e,t,o,r,{viewMode:"direct"})}startLink(e,t,o,r,l){let a={...this.linkParametersFromOptions(),linkSessionToken:e,origin:window.location.origin,...l},s=m.stringifyUrl({url:`${p}/start`,query:a});localStorage.setItem(g,e),this.launch(s,t,o,r)}startRelink(e,t,o,r,l){let a={...this.linkParametersFromOptions(),linkSessionToken:e,origin:window.location.origin,...l},s=m.stringifyUrl({url:`${p}/relink`,query:a});localStorage.setItem(g,e),this.launch(s,t,o,r)}continueLink(e,t,o,r,l){let a=localStorage.getItem(g);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},n=m.stringifyUrl({url:`${p}/continue`,query:s});this.launch(n,t,o,r)}linkParametersFromOptions(){let e=this.options.__applicationName??null,t=this.options.device??null,o=this.options.stepTimers??!1;return{applicationName:e,device:t,stepTimers:o,launcherVersion:y.version}}launch(e,t,o,r){let l=T(e,this.options.containerID),a=new AbortController,s=b(l,a,t,o,r,this.options.__onDemoEvent,this.options.theme,this.options.colorScheme);window.addEventListener("message",s,{signal:a.signal})}};function b(i,e,t,o,r,l,a,s){return n=>{if(n.origin!=p||!("moneykit"in n.data||"__moneykitDemo"in n.data)){console.warn("MoneyKit Connect received a message from an unexpected origin",n.origin);return}let c=n.data;switch(c.type){case"connect.started":s&&n.source?.postMessage({moneykit:!0,type:"connect.set_color_scheme",data:{colorScheme:s}},{targetOrigin:p}),a&&n.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),h(i),e.abort();break;case"relink.complete":t&&t(c.data.institution),h(i),e.abort();break;case"link.exit":h(i),o&&o(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=(n=>(n[n.largeTitle=0]="largeTitle",n[n.title1=1]="title1",n[n.title2=2]="title2",n[n.title3=3]="title3",n[n.body=4]="body",n[n.smallBody=5]="smallBody",n[n.button=6]="button",n[n.input=7]="input",n))(x||{}),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 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.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=u;export{x as ThemeTypographyTextStyle,I as default,M as moneyui,v as themeTypographyStyleForTextStyle};
|
package/package.json
CHANGED
|
@@ -118,6 +118,8 @@ export type ThemeComponents = {
|
|
|
118
118
|
progressSpinner: ThemeComponentsProgressSpinner;
|
|
119
119
|
icon: ThemeComponentsIcon;
|
|
120
120
|
separator: ThemeComponentsSeparator;
|
|
121
|
+
checkbox?: ThemeComponentsCheckbox;
|
|
122
|
+
radio?: ThemeComponentsRadio;
|
|
121
123
|
};
|
|
122
124
|
export type ThemeComponentsNavigationBar = {
|
|
123
125
|
height: string;
|
|
@@ -164,6 +166,7 @@ export type ThemeComponentsProgressSpinner = {
|
|
|
164
166
|
strokeWidth: number;
|
|
165
167
|
diameter: number;
|
|
166
168
|
lineCap: ThemeLineCap;
|
|
169
|
+
color?: ThemeDynamicColor;
|
|
167
170
|
};
|
|
168
171
|
export type ThemeComponentsIcon = {
|
|
169
172
|
strokeWidth: number;
|
|
@@ -172,6 +175,14 @@ export type ThemeComponentsIcon = {
|
|
|
172
175
|
export type ThemeComponentsSeparator = {
|
|
173
176
|
height: ThemeSize;
|
|
174
177
|
};
|
|
178
|
+
export type ThemeComponentsCheckbox = {
|
|
179
|
+
offColor?: ThemeDynamicColor;
|
|
180
|
+
onColor?: ThemeDynamicColor;
|
|
181
|
+
};
|
|
182
|
+
export type ThemeComponentsRadio = {
|
|
183
|
+
offColor?: ThemeDynamicColor;
|
|
184
|
+
onColor?: ThemeDynamicColor;
|
|
185
|
+
};
|
|
175
186
|
export type ThemeScreens = {
|
|
176
187
|
finder: ThemeScreensFinder;
|
|
177
188
|
};
|