Skip to content

Commit 691f64c

Browse files
authored
Merge pull request #35 from moneytree/2.0.0-beta
SDK version 2.0.0-beta
2 parents 686b68e + 86df489 commit 691f64c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+5872
-8888
lines changed

README.md

Lines changed: 2 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -1,119 +1,5 @@
11
# Moneytree Link JavaScript SDK
22

3-
This is a library for browser client to help you integrate Moneytree tools such as My Account and the Vault without having to do it yourself.
3+
This is a library for browser client to help you integrate Moneytree tools such as My Account and the Vault without having to do worry about the complex configurations.
44

5-
## Installation
6-
7-
### Browser based
8-
9-
Include the script tag
10-
11-
```html
12-
<script
13-
type="text/javascript"
14-
src="https://cdn.jsdelivr.net/npm/@moneytree/mt-link-javascript-sdk@<version>/dist/index.js"
15-
></script>
16-
```
17-
18-
Change the `<version>` by the one you need (most likely the latest available).
19-
You can also replace `<version>` by `latest` to always get the latest published, at your own risk.
20-
21-
You will find the library under `window.mtLinkSdk`.
22-
23-
### CommonJS
24-
25-
Using NPM simply install the library
26-
27-
```shell
28-
npm install @moneytree/mt-link-javascript-sdk
29-
```
30-
31-
Then you can use it directly in your code:
32-
33-
```js
34-
var mtLinkSdk = require('@moneytree/mt-link-javascript-sdk'); // es5
35-
// or
36-
import mtLinkSdk from '@moneytree/mt-link-javascript-sdk'; // es-next
37-
```
38-
39-
The source also include a Typescript definition.
40-
41-
## API
42-
43-
### Inititalising the API
44-
45-
Call the following method with your desired configuration.
46-
`init(<config>)`
47-
48-
Config properties:
49-
50-
```js
51-
{
52-
clientId, // string; // The id of the application that asks for authorization.
53-
responseType, // string; // Tells the authorization server which grant to execute (e.g.: code).
54-
scope, // string[]; // A list of permissions that the application requires.
55-
redirectUri, // string; // URI to return the user to after authorization is complete.
56-
continueTo, // string; // [optional] Parameter appended as `continue` to the `redirectUri`.
57-
locale, // string; // [optional] To force the display to a specific language (e.g.: en-AU).
58-
state, // string; // [optional] An opaque value, used for security purposes. If this request parameter is set in the request, then it is returned to the application as part of the redirect_uri.
59-
isTestEnvironment // boolean; // [optional] If you wanna use the staging or production environment
60-
}
61-
```
62-
63-
### Open the page for the user to authorize your application
64-
65-
`mtLinkSdk.authorize(options);`
66-
You can pass the following options:
67-
68-
- `newTab`: Open in a new browser tab
69-
- Values: `true` or `false`
70-
- Default: `false`
71-
- `authPage`: Page to display during unauthenticated redirection
72-
- Values: `'login'` or `'signup'`.
73-
- Default: `'login'`
74-
- `email`: To prefill the email field for signup and login
75-
- Values: A string
76-
- Default: `undefined`
77-
- `backTo`: Redirect URL for some actions (back, revoke, logout, delete)
78-
- Values: A string representing a URL
79-
- Default: Current URL
80-
- `showAuthToggle`: Option to hide the button to toggle between login and signup pages
81-
- Values: `false`
82-
- Default: `undefined`
83-
84-
### Logout from current session
85-
86-
`mtLinkSdk.logout(options);`
87-
You can pass the following options:
88-
89-
- `newTab`: Open in a new browser tab
90-
- Values: `true` or `false`
91-
- Default: `false`
92-
93-
- `backTo`: Redirect back to this url after logout, url must be whitelisted (contact support)
94-
- Values: A string representing a URL
95-
- Default: `undefined`
96-
97-
### Open the setting page of the user account
98-
99-
`mtLinkSdk.openSettings(options);`
100-
You can pass the following options:
101-
102-
- `newTab`: Open in a new browser tab
103-
- Values: `true` or `false`
104-
- Default: `false`
105-
- `backTo`: Redirect URL for some actions (back, revoke, logout, delete)
106-
- Values: A string representing a URL
107-
- Default: Current URL
108-
109-
### Open the vault to let the user add credentials
110-
111-
`mtLinkSdk.openVault(options);`
112-
You can pass the following options:
113-
114-
- `newTab`: Open in a new browser tab
115-
- Values: `true` or `false`
116-
- Default: `false`
117-
- `backTo`: Redirect URL for some actions (back, revoke, logout, delete)
118-
- Values: A string representing a URL
119-
- Default: Current URL
5+
Read the [documentation](docs/README.md) for more information.

dist/api/authorize.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import { StoredOptions, AuthorizeOptions } from '../typings';
2+
export default function authorize(storedOptions: StoredOptions, options?: AuthorizeOptions): void;

dist/api/exchange-token.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import { StoredOptions, ExchangeTokenOptions } from '../typings';
2+
export default function exchangeToken(storedOptions: StoredOptions, options?: ExchangeTokenOptions): Promise<string>;

dist/api/logout.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import { StoredOptions, LogoutOptions } from '../typings';
2+
export default function logout(storedOptions: StoredOptions, options?: LogoutOptions): void;

dist/api/onboard.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import { StoredOptions, OnboardOptions } from '../typings';
2+
export default function onboard(storedOptions: StoredOptions, options?: OnboardOptions): void;

dist/api/open-service.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import { StoredOptions, ServiceId, ConfigsOptions } from '../typings';
2+
export default function openService(storedOptions: StoredOptions, serviceId: ServiceId, options?: ConfigsOptions): void;

dist/api/request-magic-link.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import { StoredOptions, RequestMagicLinkOptions } from '../typings';
2+
export default function requestMagicLink(storedOptions: StoredOptions, options?: RequestMagicLinkOptions): Promise<void>;

dist/api/token-info.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import { StoredOptions, TokenInfoOptions, TokenInfo } from '../typings';
2+
export default function tokenInfo(storedOptions: StoredOptions, token: string, options?: TokenInfoOptions): Promise<TokenInfo>;

dist/endpoints.d.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

dist/helper.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { Scopes, InitOptions, ConfigsOptions } from './typings';
2+
export declare function constructScopes(scopes?: Scopes): string | undefined;
3+
export declare function getIsTabValue(isNewTab?: boolean): '' | '_self';
4+
export declare function mergeConfigs(initValues: InitOptions, newValues: ConfigsOptions, ignoreKeys?: string[]): ConfigsOptions;
5+
export declare function generateConfigs(configs?: ConfigsOptions): string;

0 commit comments

Comments
 (0)