plaid-link: Update config params (#36992)

Signed-off-by: Prateek Malhotra <someoen1@gmail.com>
This commit is contained in:
Prateek Malhotra 2019-07-24 16:10:27 -04:00 committed by Wesley Wigham
parent d4a4c4472d
commit d376c1624e
2 changed files with 42 additions and 42 deletions

View File

@ -8,10 +8,8 @@ declare global {
interface Window {
Plaid: {
create(params: Plaid.CreateConfig): Plaid.LinkHandler;
open(): void;
exit(force?: boolean): void;
version: string;
};
linkHandler: Plaid.LinkHandler;
}
}
@ -26,44 +24,49 @@ export namespace Plaid {
onEvent?: OnEvent;
onLoad?: OnLoad;
language?: Language;
user?: User;
countryCodes?: Country[];
userLegalName?: string;
userEmailAddress?: string;
token?: string;
isWebView?: boolean;
}
type OnSuccess = (
public_token: string,
metadata: OnSuccessMetaData
) => void;
type OnSuccess = (public_token: string, metadata: OnSuccessMetaData) => void;
type OnExit = (error: Error | null, metadata: OnExitMetaData) => void;
type OnEvent = (eventName: EventName, metadata: OnEventMetaData) => void;
type OnLoad = () => void;
interface LinkHandler {
open: () => void;
exit: (options: ExitOptions) => void;
exit: (options?: ExitOptions) => void;
institutions: Institution[];
}
type Product = "transactions" | "auth" | "identity" | "income" | "assets";
type Environment = "development" | "sandbox" | "production";
type Language = "en" | "fr";
type VerificationStatus =
| "pending_automatic_verification"
| "pending_manual_verification"
| "manually_verified";
type Product = 'transactions' | 'auth' | 'identity' | 'income' | 'assets' | 'investments' | 'liabilities';
type Environment = 'development' | 'sandbox' | 'production';
type Language = 'en' | 'fr' | 'es';
type Country = 'US' | 'CA' | 'GB';
type VerificationStatus = 'pending_automatic_verification' | 'pending_manual_verification' | 'manually_verified';
type EventName =
| "ERROR"
| "EXIT"
| "HANDOFF"
| "OPEN"
| "OPEN_MY_PLAID"
| "SEARCH_INSTITUTION"
| "SELECT_INSTITUTION"
| "TRANSITION_VIEW";
interface User {
legalName: string;
emailAddress: string;
}
| 'ERROR'
| 'EXIT'
| 'HANDOFF'
| 'OPEN'
| 'OPEN_MY_PLAID'
| 'SEARCH_INSTITUTION'
| 'SELECT_INSTITUTION'
| 'SUBMIT_CREDENTIALS'
| 'SUBMIT_MFA'
| 'TRANSITION_VIEW';
type ExitStatus =
| 'requires_questions'
| 'requires_selections'
| 'requires_code'
| 'choose_device'
| 'requires_credentials'
| 'institution_not_found';
interface Institution {
name: string;
institution_id: string;
@ -96,13 +99,13 @@ export namespace Plaid {
link_session_id: string;
request_id: string;
institution: Institution;
status: string;
status: ExitStatus;
}
interface OnEventMetaData {
error_code: string;
error_message: string;
error_type: string;
exit_status: string;
exit_status: ExitStatus;
institution_id: string;
institution_name: string;
institution_search_query: string;

View File

@ -1,19 +1,16 @@
import { Plaid } from "plaid-link";
import { Plaid } from 'plaid-link';
const product: Plaid.Product = "auth";
const env: Plaid.Environment = "sandbox";
const language: Plaid.Language = "en";
const user: Plaid.User = {
legalName: "Test Name",
emailAddress: "test@test.com"
};
const product: Plaid.Product = 'auth';
const env: Plaid.Environment = 'sandbox';
const language: Plaid.Language = 'en';
const countryCodes: Plaid.Country[] = ['US'];
const config: Plaid.CreateConfig = {
clientName: "Test Client Name",
clientName: 'Test Client Name',
product: [product],
key: "API_KEY",
key: 'API_KEY',
env,
language,
user,
onSuccess: () => {}
countryCodes,
onSuccess: () => {},
};