1.1.9 • Published 4 years ago

@ffn/partner-sdk v1.1.9

Weekly downloads
8
License
-
Repository
-
Last release
4 years ago

Sdk for partner-gateway

Installation

Use npm or yarn for usage in your project.

npm install --save @ffn/partner-sdk

or

yarn add @ffn/partner-sdk

For browser

<script src="https://unpkg.com/@ffn/partner-sdk@1.1.0/dist/index.min.js"></script>
<!-- This will add FFAMPartner as global -->

Usage

import {Widget} from '@ffn/partner-sdk'

let element = document.getElementById("iframe-wrapper");
let widget = await Widget.create(element, {
    partnerId: 'PARTNER_ID',
    env: "dev"
})

For Browser

let element = document.getElementById("iframe-wrapper");
let widget = await FFAMPartner.Widget.create(element, {
    partnerId: 'PARTNER_ID',
    env: 'dev',
    product: 'fdr'
})

Widget

Lead

{
    status: 'accepted' | 'rejected'
    reject_reason: string;
    recommendation?:'green'|'red'
    first_name: string;
    last_name: string;
    email: string;
    day_phone: string;
    mailing_address: {
        street: string;
        zip: string;
        city: string;
        state: string;
    };
    date_of_birth: string;
    loan_amount: number;
    annual_income: number;
    co_app_annual_income: number;
    loan_purpose: string;
    employment_status: string;
    credit_rating: string;
}

Widget Options

{
    partnerId: string
    env: 'local' | 'dev' | 'stg' | 'prd'
    showTransferButton?: boolean
    leadData?: Partial<Lead>
    helpText?: {
        [field: string]: string
    }
}

####Hooks

widget.onUpdateLead((lead) => {
    console.info("Iframe says: Lead changed ", lead)
})
widget.onDecision((lead) => {
    console.info("Iframe says: Lead decision ", lead)
})
widget.onRequestCreditAuth(async (lead) => {
    console.info('Iframe says: Request credit auth...', lead)
    //NOTE: this is async function, application will wait on this hook
})
widget.onClickTransfer(() => {
    console.info("Iframe says: Transfer click")
})
1.1.9

4 years ago

1.1.8

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.0

4 years ago