Skip to content

[LINK-2174] Prepare Release #113

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 14 additions & 49 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,35 @@
## [3.0.0](https://github.com/moneytree/mt-link-javascript-sdk/compare/2.1.2...3.0.0) (2021-05-31)
# [3.1.0](https://github.com/moneytree/mt-link-javascript-sdk/compare/3.0.0...3.1.0) (2022-11-22)

### BREAKING CHANGES

* chore(magic-link): rename api to login-link ([2a4773d](https://github.com/moneytree/mt-link-javascript-sdk/commit/2a4773db317e669ba8c2485977adbb4a1c037cd3))
* chore(country): support only jp ([08ff6c3](https://github.com/moneytree/mt-link-javascript-sdk/commit/08ff6c3f3de70e8f433b64557997224cea419593))
* feat(open-service): rename myaccount-settings to myaccount ([69fedb4](https://github.com/moneytree/mt-link-javascript-sdk/commit/69fedb48931e3bebfc7aaddad33ff46d5967069d))

### Features

* feat(myaccount): able to open each page ([2a92055](https://github.com/moneytree/mt-link-javascript-sdk/commit/2a920556840fc28a4b7d99d264708ab3d861e40e))

### Chore
* **MyAccount:** Add support for authn_method ([b94ea4b](https://github.com/moneytree/mt-link-javascript-sdk/commit/b94ea4b186699d8af21885eb4150c2e96b605916))
* **MyAccount:** Add support for saml_subject_id ([de9af0f](https://github.com/moneytree/mt-link-javascript-sdk/commit/de9af0f4d20acc90c3a7fa59e1e571a656287975))

* chore(config): format with updated prettier settings ([066b0f2](https://github.com/moneytree/mt-link-javascript-sdk/commit/066b0f2688cd44bab571ac40bbf2a6edb32ec10a))

## [2.1.2](https://github.com/moneytree/mt-link-javascript-sdk/compare/2.1.1...2.1.2) (2020-12-18)

* fix add two private config value ([cd64d6a](https://github.com/moneytree/mt-link-javascript-sdk/commit/cd64d6a281fbe773dfea8bd236e2c8e74cda3563))
# [3.0.0](https://github.com/moneytree/mt-link-javascript-sdk/compare/2.1.2...3.0.0) (2021-06-01)

## [2.1.1](https://github.com/moneytree/mt-link-javascript-sdk/compare/2.1.0...2.1.1) (2020-12-15)

### Bug Fixes
* fix window.open didn't work on Safari 14 ([882c23c](https://github.com/moneytree/mt-link-javascript-sdk/commit/882c23c1abdc467a964b918ea7502f4f70e7da8d))
* fix forceLogout didn't work ([fa3055a](https://github.com/moneytree/mt-link-javascript-sdk/commit/fa3055a100f2bd4b7c5a4660b9dfeba45c601078))

# [2.1.0](https://github.com/moneytree/mt-link-javascript-sdk/compare/2.0.0...2.1.0) (2020-12-09)

### Bug Fixes

* add two private config value ([cd64d6a](https://github.com/moneytree/mt-link-javascript-sdk/commit/cd64d6a281fbe773dfea8bd236e2c8e74cda3563))
* **authorize-api:** fix for Safari 14 issue ([9fb69d0](https://github.com/moneytree/mt-link-javascript-sdk/commit/9fb69d014752698df1897527ff27d60ffd116843))
* update for lint error and test failed ([362f0b7](https://github.com/moneytree/mt-link-javascript-sdk/commit/362f0b749797a438ac8c0024616e7072dbc641ee))
* **logout:** add optional backTo parameter ([9b9da89](https://github.com/moneytree/mt-link-javascript-sdk/commit/9b9da8941ff58049ed200d6dd6324bc5918adca0))


### Features

* **headers:** set sdk info as additional headers parameter ([1a55579](https://github.com/moneytree/mt-link-javascript-sdk/commit/1a5557919ee9844409848154ba22ec863c4d1a58))
* **index:** new logout endpoint ([64156ca](https://github.com/moneytree/mt-link-javascript-sdk/commit/64156caba35f251f6a501edba60f736ab13da57c))
* **myaccount:** able to open each page ([72c1e71](https://github.com/moneytree/mt-link-javascript-sdk/commit/72c1e715f2028e8d9d95b8e109e763d776c87e57))
* **open-service:** rename myaccount-settings to myaccount ([71cdd6c](https://github.com/moneytree/mt-link-javascript-sdk/commit/71cdd6cd373d6564e47f971b95f3bd0c222715c0))
* **open-services:** deeplink support ([c179072](https://github.com/moneytree/mt-link-javascript-sdk/commit/c179072ba008e8f6be3f94bf4ced88e314485544))
* **sample-app:** add example ([89edfcf](https://github.com/moneytree/mt-link-javascript-sdk/commit/89edfcf2e6bc961842f9721345a074779e0549be))
* add del to storage ([c5f2bda](https://github.com/moneytree/mt-link-javascript-sdk/commit/c5f2bdaf597909f71a3ee551966daa0e47367baf))
* authorize & onboard accepts `pkce` & `codeChallenge` options ([bc6bfe5](https://github.com/moneytree/mt-link-javascript-sdk/commit/bc6bfe5da725493fb3046dabab57824fe09fa501))
* **open-services:** deeplink support ([c179072](https://github.com/moneytree/mt-link-javascript-sdk/commit/c179072ba008e8f6be3f94bf4ced88e314485544))
* **sample_app:** add a very basic sample app to test the SDK ([84a4d18](https://github.com/moneytree/mt-link-javascript-sdk/commit/84a4d187506960f44dffd102b62ce4732bec3301))


* refactor!: remove auto generate state logic ([c68d223](https://github.com/moneytree/mt-link-javascript-sdk/commit/c68d22331c1783a3c859af0b4cb3ddecfcfbf8b4))
Expand All @@ -54,35 +45,6 @@ one via the APIs' options parameter if you need one.
* change `tokenInfo` API response to standard format.
* `tokenInfo` API no longer accept options parameter as it provide no benefit.

# [2.0.0](https://github.com/moneytree/mt-link-javascript-sdk/compare/1.4.0...2.0.0) (2020-10-19)


### Features

- Support OAuth 2.0 Authorization Code with PKCE Flow.
- Enable to onboard a guest faster.
- Support Magic link(password-less login link).


# [1.4.0](https://github.com/moneytree/mt-link-javascript-sdk/compare/1.3.1...1.4.0) (2020-01-17)


# [1.3.1](https://github.com/moneytree/mt-link-javascript-sdk/compare/1.3.0...1.3.1) (2020-01-17)


### Bug Fixes

* **logout:** add optional backTo parameter ([9b9da89](https://github.com/moneytree/mt-link-javascript-sdk/commit/9b9da8941ff58049ed200d6dd6324bc5918adca0))


# [1.3.0](https://github.com/moneytree/mt-link-javascript-sdk/compare/1.2.3...1.3.0) (2019-12-11)


### Features

* **index:** new logout endpoint ([64156ca](https://github.com/moneytree/mt-link-javascript-sdk/commit/64156caba35f251f6a501edba60f736ab13da57c))
* **sample_app:** add a very basic sample app to test the SDK ([84a4d18](https://github.com/moneytree/mt-link-javascript-sdk/commit/84a4d187506960f44dffd102b62ce4732bec3301))



## [1.2.3](https://github.com/moneytree/mt-link-javascript-sdk/compare/1.2.2...1.2.3) (2019-05-23)
Expand Down Expand Up @@ -155,3 +117,6 @@ one via the APIs' options parameter if you need one.
### Features

* creating a JS SDK ([333cf8c](https://github.com/moneytree/mt-link-javascript-sdk/commit/333cf8c36f7a8299c2bccf441454b04d31e7d907))



1 change: 1 addition & 0 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export * from './typings';
export declare class MtLinkSdk {
storedOptions: StoredOptions;
init(clientId: string, options?: InitOptions): void;
setSamlSubjectId(value: string): void;
authorize(options?: AuthorizeOptions): void;
onboard(options?: OnboardOptions): void;
logout(options?: LogoutOptions): void;
Expand Down
10 changes: 5 additions & 5 deletions dist/index.js

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion dist/typings.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
export declare type AuthAction = 'login' | 'signup';
export declare const supportedAuthAction: readonly ["login", "signup"];
export declare type AuthAction = typeof supportedAuthAction[number];
export interface PrivateParams {
cobrandClientId?: string;
samlSubjectId?: string;
}
export interface PrivateConfigsOptions {
sdkPlatform?: 'ios' | 'android' | 'js';
sdkVersion?: string;
}
export declare const supportedAuthnMethod: readonly ["passwordless", "sso", "credentials"];
export declare type AuthnMethod = typeof supportedAuthnMethod[number];
export declare const supportedConfigsOptions: readonly ["email", "backTo", "authAction", "showAuthToggle", "showRememberMe", "isNewTab", "forceLogout", "authnMethod"];
export declare type SupportedConfigsOptions = typeof supportedConfigsOptions[number];
export interface ConfigsOptions extends PrivateConfigsOptions {
email?: string;
backTo?: string;
Expand All @@ -14,6 +20,7 @@ export interface ConfigsOptions extends PrivateConfigsOptions {
showRememberMe?: boolean;
isNewTab?: boolean;
forceLogout?: boolean;
authnMethod?: AuthnMethod;
}
export declare type ServicesListType = {
view?: 'services-list';
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ mtLinkSdk.init(clientId, options);

### setSamlSubjectId

The `setSamlSubjectId` method is used to set the value of the `saml_subject_id` parameter.
The `setSamlSubjectId` method is used to set the value of the `saml_subject_id` parameter. This parameter can be set during `init` or changed by this method. It can not be overriden.
The `setSamlSubjectId` parameter allows the client to pass a guest identifier to Moneytree so that Moneytree can forward it to the Identity Provider (IdP) via the SAMLRequest.
The `saml_subject_id` parameter will be forwarded to the `authorize`, `logout` and `open-service` methods when defined.

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@moneytree/mt-link-javascript-sdk",
"version": "3.0.0",
"version": "3.1.0",
"description": "Moneytree Link JavaScript SDK",
"main": "dist/index.js",
"files": [
Expand Down
41 changes: 21 additions & 20 deletions src/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,26 +113,6 @@ export function generateConfigs(configs: ConfigsOptions = {}): string {
});
}

function isAuthnMethod(x: unknown): x is AuthnMethod {
return supportedAuthnMethod.includes(x as AuthnMethod);
}

function parseAuthnMethod(x: unknown): AuthnMethod | undefined {
if (Array.isArray(x)) {
throw new TypeError('Array is not allowed for authnMethod');
}

return isAuthnMethod(x) ? x : undefined;
}

function isAuthAction(x: unknown): x is AuthAction {
return supportedAuthAction.includes(x as AuthAction);
}

function parseAuthAction(x: unknown): AuthAction | undefined {
return isAuthAction(x) ? x : undefined;
}

export function generateCodeChallenge(): string {
const codeVerifier = uuid();

Expand All @@ -154,3 +134,24 @@ export function generateSdkHeaderInfo(): {
export function openWindow(url: string, windowName: string): Window | null {
return window.open(url, windowName, 'noreferrer');
}

// Validators
function isAuthnMethod(x: unknown): x is AuthnMethod {
return supportedAuthnMethod.includes(x as AuthnMethod);
}

function parseAuthnMethod(x: unknown): AuthnMethod | undefined {
if (Array.isArray(x)) {
throw new TypeError('Array is not allowed for authnMethod');
}

return isAuthnMethod(x) ? x : undefined;
}

function isAuthAction(x: unknown): x is AuthAction {
return supportedAuthAction.includes(x as AuthAction);
}

function parseAuthAction(x: unknown): AuthAction | undefined {
return isAuthAction(x) ? x : undefined;
}