@moneykit/connect 0.3.0 → 0.3.4
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/README.md
CHANGED
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import c from"query-string";var
|
|
1
|
+
import c from"query-string";var d={name:"@moneykit/connect",description:"MoneyKit Connect launcher for web.",version:"0.3.3",author:"MoneyKit",repository:{type:"git",url:"https://github.com/moneykit/connect-js.git"},types:"./types/index.d.ts",license:"MIT"};var k=(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))(k||{}),x=(r,t)=>{switch(t){case 0:return r.typography.largeTitle;case 1:return r.typography.title1;case 2:return r.typography.title2;case 3:return r.typography.title3;case 5:return r.typography.smallBody;case 6:return r.typography.button;case 7:return r.typography.input;default:return r.typography.body}};var m="http://localhost:3002";function T(r,t){let e=document.createElement("iframe");e.id="moneykit-connect-frame",e.src=r,e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.width="100%",e.style.height="100%",e.style.zIndex="999999";let n=t?document.getElementById(t):document.body;if(!n)throw new Error(`MoneyKit could not find container element with ID "${t}".`);return n.appendChild(e),e.addEventListener("load",function(){e.focus()}),e}function p(r){r.remove()}var y="moneykit.linkSessionToken",h=class{constructor(t={}){this.options={...t}}link(t,e,n,i){this.startLink(t,e,n,i)}relink(t,e,n,i){this.startRelink(t,e,n,i)}continue(t,e,n,i){if(window.opener){window.opener.postMessage({moneykit:!0,type:"link.resume",eventData:{redirectURL:t}},m);return}this.continueLink(t,e,n,i)}__linkDirect(t,e,n,i){this.startLink(t,e,n,i,{viewMode:"direct"})}__relinkDirect(t,e,n,i){this.startRelink(t,e,n,i,{viewMode:"direct"})}__continueDirect(t,e,n,i){this.continueLink(t,e,n,i,{viewMode:"direct"})}startLink(t,e,n,i,l){let s={...this.linkParametersFromOptions(),linkSessionToken:t,origin:window.location.origin,...l},a=c.stringifyUrl({url:`${m}/start`,query:s});localStorage.setItem(y,t),this.launch(a,e,n,i)}startRelink(t,e,n,i,l){let s={...this.linkParametersFromOptions(),linkSessionToken:t,origin:window.location.origin,...l},a=c.stringifyUrl({url:`${m}/relink`,query:s});localStorage.setItem(y,t),this.launch(a,e,n,i)}continueLink(t,e,n,i,l){let s=localStorage.getItem(y);s||console.warn("Unable to get MoneyKit link session token from local storage.");let a={...this.linkParametersFromOptions(),linkSessionToken:s,redirectURL:t,origin:window.location.origin,...l},o=c.stringifyUrl({url:`${m}/continue`,query:a});this.launch(o,e,n,i)}linkParametersFromOptions(){let t=this.options.applicationName??"",e=this.options.device??null,n=this.options.stepTimers??!0;return{applicationName:t,device:e,stepTimers:n,launcherVersion:d.version}}launch(t,e,n,i){let l=T(t,this.options.containerID),s=new AbortController,a=C(l,s,e,n,i,this.options.__onDemoEvent,this.options.theme);window.addEventListener("message",a,{signal:s.signal})}};function C(r,t,e,n,i,l,s){return a=>{if(a.origin!=m||!("moneykit"in a.data||"__moneykitDemo"in a.data))return;let o=a.data;switch(o.type){case"connect.started":s&&a.source?.postMessage({moneykit:!0,type:"connect.set_theme",data:{theme:s}},{targetOrigin:m});break;case"link.complete":e&&o.data.exchangeableToken&&e(o.data.exchangeableToken,o.data.institution),p(r),t.abort();break;case"relink.complete":e&&e(o.data.institution),p(r),t.abort();break;case"link.exit":p(r),n&&n(o.data.error),t.abort();break;case"link.close_oauth":window.close();break;case"link.event":i&&i(o.data);break;case"demo.link.event":l&&l(o.data);break}}}var g=h;var E=g;export{k as ThemeTypographyTextStyle,E as default,x 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.
|
|
4
|
+
"version": "0.3.4",
|
|
5
5
|
"author": "MoneyKit",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -15,4 +15,4 @@
|
|
|
15
15
|
"module": "./index.js",
|
|
16
16
|
"type": "module",
|
|
17
17
|
"main": "./index.js"
|
|
18
|
-
}
|
|
18
|
+
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type Theme
|
|
1
|
+
import { type Theme } from "./connect-theme";
|
|
2
|
+
export * from "./connect-theme";
|
|
2
3
|
export type Institution = {
|
|
3
4
|
avatar: string | null;
|
|
4
5
|
avatar_dark: string | null;
|
|
@@ -26,7 +27,7 @@ export type LinkedInstitution = Institution & {
|
|
|
26
27
|
duration: number;
|
|
27
28
|
}[];
|
|
28
29
|
};
|
|
29
|
-
export type MoneyKitDevice = "mobile" | "desktop";
|
|
30
|
+
export type MoneyKitDevice = "mobile" | "desktop" | "mobile-playground";
|
|
30
31
|
export type MoneyKitOptions = {
|
|
31
32
|
applicationName?: string;
|
|
32
33
|
theme?: Theme;
|
|
@@ -51,11 +52,12 @@ declare class MoneyKit {
|
|
|
51
52
|
relink(linkSessionToken: string, onRelinkSuccess?: RelinkSuccessCallback, onRelinkExit?: LinkExitCallback, onRelinkEvent?: LinkEventCallback): void;
|
|
52
53
|
continue(redirectURL: string, onLinkSuccess?: LinkSuccessCallback, onLinkExit?: LinkExitCallback, onLinkEvent?: LinkEventCallback): void;
|
|
53
54
|
__linkDirect(linkSessionToken: string, onLinkSuccess?: LinkSuccessCallback, onLinkExit?: LinkExitCallback, onLinkEvent?: LinkEventCallback): void;
|
|
55
|
+
__relinkDirect(linkSessionToken: string, onLinkSuccess?: RelinkSuccessCallback, onLinkExit?: LinkExitCallback, onLinkEvent?: LinkEventCallback): void;
|
|
54
56
|
__continueDirect(redirectURL: string, onLinkSuccess?: LinkSuccessCallback, onLinkExit?: LinkExitCallback, onLinkEvent?: LinkEventCallback): void;
|
|
55
57
|
private startLink;
|
|
58
|
+
private startRelink;
|
|
56
59
|
private continueLink;
|
|
57
60
|
private linkParametersFromOptions;
|
|
58
61
|
private launch;
|
|
59
62
|
}
|
|
60
63
|
export default MoneyKit;
|
|
61
|
-
export declare const themeTypographyStyleForTextStyle: (theme: Theme, textStyle: ThemeTypographyTextStyle) => ThemeTypographyStyle;
|
|
@@ -182,3 +182,4 @@ export type ThemeScreensFinder = {
|
|
|
182
182
|
institutionCellSpacing: string;
|
|
183
183
|
institutionCellBackgroundColor: ThemeDynamicColor | null;
|
|
184
184
|
};
|
|
185
|
+
export declare const themeTypographyStyleForTextStyle: (theme: Theme, textStyle: ThemeTypographyTextStyle) => ThemeTypographyStyle;
|