2.1.26 • Published 5 months ago

@levelcredit/js-react-levelcredit v2.1.26

Weekly downloads
-
License
-
Repository
github
Last release
5 months ago

LevelCredit ReactJS Component Library

This ReactJS component library will allow a partner to display the TransUnion Vantage 2.0 Credit Score from LevelCredit with the user's browser while maintaining security and compliance with TransUnion's policies. Example of what this will return:

GitHub Repositories

Getting Started

Install as dependency using npm install command

npm install --save @levelcredit/js-react-levelcredit

To start using either the components like <ScoreChart /> or react hook like useScore(), you will need to wrap around the part that is being used with a provider (<LevelCreditProvider />). The LevelCredit provider will help expose which api endpoint the react library will use.

Example

export default function App() {
    const credit_display_token = ...; // Backend to get the display token from CreditAPI

    return (
        <LevelCreditProvider env="production">
            <ScoreDisplay display_token={credit_display_token} />
            <ScoreChart display_token={credit_display_token} />
            <CustomHookComponent />
        </LevelCreditProvider>
    );
}

function CustomHookComponent() {
    const credit_display_token = ...; // Backend to get the display token from CreditAPI
    const [scores] = useScore(credit_display_token);
}

Dependencies

To use this component, there are some required dependencies. The following dependencies are required with their minimum supported versions written next to it:
react@16.8.0, react-dom@16.8.0, recharts@2.0.9

API

Provider

<LevelCreditProvider />

import { LevelCreditProvider } from "@levelcredit/js-react-levelcredit";
PropsTypeDefault
env (REQUIRED)"development" \| "staging" \| "production"NULL
base_urlstringNULL
auth_tokenstringNULL
auth_typeAPIAuthTypenone

When setting APIAuthType, please note that we have 2 ways to authenticate through the header. Setting "header" defaults to using "header-authorization"

# header-authorization
Authorization: Bearer <access_token>

# header-sid
SID: <jwt>

CreditAPI


ObligationAPI

useObligationTradeline(): FetchObligationTradeline

import { useObligationTradeline } from "@levelcredit/js-react-levelcredit";
type FetchObligationTradeline = (
  obligation: ObligationType, // ObligationType: "contracts" | "leases" | "utilities"
  obligation_id: number
) => Promise<ObligationTradelineObject>;

type ObligationTradelineObject = {
  [key: string]: TradelineStatusObject; // ["YYYY-DD"]: TradelineStatusObject,
};

type TradelineStatusObject = { status: TradelineStatus };

TradelineStatus types

<TradelineHistory />

import { TradelineHistory } from "@levelcredit/js-react-levelcredit";
PropsTypeDefault
obligation"contracts" \| "leases" \| "utilities"NULL
obligation_idnumberNULL
classesJSS Classes{}

JSS Classes TradelineHistory, TableHead, TableColumnHead, TableBody, TableColumnYear, TableColumn, POSITIVE_REPORT, POSITIVE_LOOKBACK_REPORT, POSITIVE_LOOKBACK_AVAILABLE, PENDING_REPORT_HOLD, PENDING_REPORT, NEGATIVE_LATE_30, NEGATIVE_LATE_60, NEGATIVE_LATE_90, NEGATIVE_LATE_120, NEGATIVE_LATE_150, NEGATIVE_LATE_180, NO_PAYMENT


ProtectionAPI

useMonitoring(): [null | MonitoringObject, FetchMonitoring]

import { useMonitoring } from "@levelcredit/js-react-levelcredit";
interface MonitoringObject {
  enabled: boolean;
  status: string;
  new_alerts_count: number;
}

type FetchMonitoring = () => Promise<null | MonitoringObject>;

useMonitoringAlerts(): [null | AlertSimple[], FetchMonitoringAlerts, DismissMonitoringAlert]

import { useMonitoringAlerts } from "@levelcredit/js-react-levelcredit";
interface AlertSimple {
  id: number;
  url: string;
  alert_type: string;
  bureau: string;
  created_at: string;
  dismissed_at: string;
}

interface AlertDetailed extends AlertSimple {
  product_display_id: string;
}

type FetchMonitoringAlerts = () => Promise<AlertSimple[]> | (alert_id: number) => Promise<AlertDetailed>;

type DismissMonitoringAlert = (alert_id: number) => Promise<void>;

<MonitoringAlert />

import { MonitoringAlert } from "@levelcredit/js-react-levelcredit";
PropsTypeDefault
allow_dismissed_alertsbooleantrue
show_dismissed_alertsbooleanfalse
show_view_history_buttonbooleantrue
classesJSS Classes{}

JSS Classes MonitoringAlert, MonitoringAlertList, AlertMonitoringDismissed, MonitoringAlertButton, Alert, AlertInfo, AlertInfoDetails, AlertInfoType, AlertInfoDate, AlertInfoDismiss, AlertInfoOpen, AlertInfoOpenIcon, AlertInfoOpenIconOpened, AlertDetails, AlertDetailsEnter, AlertDetailsEnterActive, AlertDetailsExit, AlertDetailsExitActive, AlertData, AlertDataHasChildren, AlertDataTitle, AlertDataDescription, AlertDataChildren, AlertLoading

2.1.26

5 months ago

2.1.25

10 months ago

2.1.23

10 months ago

2.1.24

10 months ago

2.1.21

10 months ago

2.1.22

10 months ago

2.1.20

10 months ago

2.1.18

1 year ago

2.1.17

1 year ago

2.1.16

2 years ago

2.1.14

2 years ago

2.1.15

2 years ago

2.1.12

2 years ago

2.1.13

2 years ago

2.1.10

2 years ago

2.1.11

2 years ago

2.1.9

2 years ago

2.1.4

2 years ago

2.1.5

2 years ago

2.1.8

2 years ago

2.1.7

2 years ago

2.1.4-alpha.0

3 years ago

2.1.3

3 years ago

2.1.3-alpha.5

3 years ago

2.1.3-alpha.4

3 years ago

2.1.3-alpha.2

3 years ago

2.1.3-alpha.1

3 years ago

2.1.3-alpha.0

3 years ago

2.1.2

3 years ago

2.1.1

3 years ago

2.1.0

3 years ago

2.1.0-alpha.3

3 years ago

2.1.0-alpha.2

3 years ago