@moneykit/connect 0.3.20 → 0.3.22
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 +15 -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
|
|
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 c="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={}){c=e.__connectSDKUIHost??c,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}},c);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:`${c}/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:`${c}/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:`${c}/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!=c||!("moneykit"in n.data||"__moneykitDemo"in n.data)){console.warn("MoneyKit Connect received a message from an unexpected origin",n.origin);return}let p=n.data;switch(p.type){case"connect.started":s&&n.source?.postMessage({moneykit:!0,type:"connect.set_color_scheme",data:{colorScheme:s}},{targetOrigin:c}),a&&n.source?.postMessage({moneykit:!0,type:"connect.set_theme",data:{theme:a}},{targetOrigin:c});break;case"link.complete":t&&p.data.exchangeableToken&&t(p.data.exchangeableToken,p.data.institution),h(i),e.abort();break;case"relink.complete":t&&t(p.data.institution),h(i),e.abort();break;case"link.exit":h(i),o&&o(p.data.error),e.abort();break;case"link.close_oauth":window.close();break;case"link.event":r&&r(p.data);break;case"demo.link.event":l&&l(p.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 L=u;export{x as ThemeTypographyTextStyle,L as default,M as moneyui,v as themeTypographyStyleForTextStyle};
|
package/package.json
CHANGED
|
@@ -118,6 +118,9 @@ export type ThemeComponents = {
|
|
|
118
118
|
progressSpinner: ThemeComponentsProgressSpinner;
|
|
119
119
|
icon: ThemeComponentsIcon;
|
|
120
120
|
separator: ThemeComponentsSeparator;
|
|
121
|
+
checkbox?: ThemeComponentsCheckbox;
|
|
122
|
+
radio?: ThemeComponentsRadio;
|
|
123
|
+
connectedIcon?: ThemeComponentsConnectedIcon;
|
|
121
124
|
};
|
|
122
125
|
export type ThemeComponentsNavigationBar = {
|
|
123
126
|
height: string;
|
|
@@ -164,6 +167,7 @@ export type ThemeComponentsProgressSpinner = {
|
|
|
164
167
|
strokeWidth: number;
|
|
165
168
|
diameter: number;
|
|
166
169
|
lineCap: ThemeLineCap;
|
|
170
|
+
color?: ThemeDynamicColor;
|
|
167
171
|
};
|
|
168
172
|
export type ThemeComponentsIcon = {
|
|
169
173
|
strokeWidth: number;
|
|
@@ -172,6 +176,17 @@ export type ThemeComponentsIcon = {
|
|
|
172
176
|
export type ThemeComponentsSeparator = {
|
|
173
177
|
height: ThemeSize;
|
|
174
178
|
};
|
|
179
|
+
export type ThemeComponentsCheckbox = {
|
|
180
|
+
offColor?: ThemeDynamicColor;
|
|
181
|
+
onColor?: ThemeDynamicColor;
|
|
182
|
+
};
|
|
183
|
+
export type ThemeComponentsRadio = {
|
|
184
|
+
offColor?: ThemeDynamicColor;
|
|
185
|
+
onColor?: ThemeDynamicColor;
|
|
186
|
+
};
|
|
187
|
+
export type ThemeComponentsConnectedIcon = {
|
|
188
|
+
color?: ThemeDynamicColor;
|
|
189
|
+
};
|
|
175
190
|
export type ThemeScreens = {
|
|
176
191
|
finder: ThemeScreensFinder;
|
|
177
192
|
};
|