npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@myfci/borrower-sdk

v1.0.4

Published

Embeddable borrower widgets (Unified Borrower SDK) — JWT-authorized, lender-branded modal.

Readme

Borrower SDK

Embed a widget from borrower app in your site or app. You open the modal, the borrower completes the payment flow inside a secure iframe, and you get a confirmation object back — your code never touches payment data or PII.

  • Framework-agnostic core (create()), plus a React hook (useBorrowerPayment).
  • No dependencies. React is an optional peer dependency, only needed for the /react entry.
  • Isolated by design. The whole flow (identity verification, loan review, ACH payment) runs inside an iframe served by the lender's deployment, with the lender's approved branding (or the default FCI branding if the lender hasn't configured one). No CSS or payment logic leaks into your page.

Installation

npm install @myfci/borrower-sdk
# or: pnpm add @myfci/borrower-sdk
# or: yarn add @myfci/borrower-sdk

Or load it from the lender's CDN with no build step — this exposes a global UnifiedBorrower:

<script src="https://YOUR-LENDER-HOST/sdk/v1/borrower-sdk.js"></script>

Prerequisites

You need a JWT issued for a specific borrower + loan. Your backend obtains it through a token exchange with the identity service and hands it to your frontend — you never mint it yourself. The token carries the loan and the target environment, so there is nothing else to configure: no host URLs, no API keys.

Quick start (vanilla / any framework)

import { create } from '@myfci/borrower-sdk';

const handler = create({
  widget: 'payment',
  jwt: 'YOUR_JWT', // issued by the identity service for the borrower + loan
  onSuccess(result) {
    console.log('Payment confirmed', result.confirmationNumber, result.amount);
  },
  onExit(error) {
    if (error) console.warn('Closed with error', error.code);
  },
});

document.getElementById('pay').addEventListener('click', () => handler.open());

create() mounts a hidden iframe immediately, so open() shows the modal instantly. Call handler.destroy() when you no longer need it.

With the CDN build, replace the import with the global: UnifiedBorrower.create({ ... }).

React

import { useBorrowerPayment } from '@myfci/borrower-sdk/react';
import type { BorrowerPaymentResult } from '@myfci/borrower-sdk/react';

function PayButton({ jwt }: { jwt: string }) {
  const { open, ready, error, exit } = useBorrowerPayment({
    jwt,
    onSuccess: (result: BorrowerPaymentResult) => saveConfirmation(result),
    onExit: (err) => {
      if (err) console.warn(err.code);
    },
  });

  if (error) return <p role="alert">{error.message}</p>;

  return (
    <button onClick={() => open()} disabled={!ready}>
      Pay now
    </button>
  );
}

The hook recreates its handler when jwt or widget change; changing the callbacks alone does not tear down the iframe. Works with React 17, 18, and 19 — the modal runs isolated inside the iframe, so there is no version conflict with your app.

Options

| Option | Required | Description | | --- | --- | --- | | widget | — | Widget to open. Currently 'payment' (default). | | jwt | ✅ | Signed JWT that authorizes the session and identifies the borrower + loan. | | onSuccess(result) | — | Called with a BorrowerPaymentResult when a payment completes. | | onExit(error?) | — | Called when the borrower closes without completing, or on a terminal error (error.code set). | | onEvent(name, meta) | — | Optional analytics hook. |

A missing or malformed jwt fails loud: create() throws UnifiedBorrowerError, and the React hook sets error and logs to the console (prefixed [UnifiedBorrower]) — a misconfiguration is never silent.

Handler / hook return

| Member | Type | Description | | --- | --- | --- | | open | () => void | Shows the modal. | | exit | () => void | Closes the modal programmatically. | | destroy | () => void | Removes the iframe and listeners (vanilla only — the hook cleans up on unmount). | | ready | boolean | React only — true once the widget is initialized and can be opened. | | error | UnifiedBorrowerError \| null | React only — set when the input was rejected. |

Result object

interface BorrowerPaymentResult {
  confirmationNumber: string;
  amount: number;
  paymentDate: string; // as shown on the ACH confirmation
  paymentMethod: 'ach';
  loanNumberMasked: string; // e.g. "••••3456"
}

No raw PII is returned — just confirmation data you can store or display.

Environments

The JWT's env claim selects the environment (sandbox or prod) and the SDK resolves the right host automatically. Switching from sandbox to production means changing the JWT you pass in — nothing else. With the CDN build, the host is inferred from the <script> origin instead.

Versioning

The npm package follows semver. The CDN path (/sdk/v1) pins the major version of the message protocol — a breaking protocol change ships under /sdk/v2, and your integration keeps working on v1 until you migrate.

Browser support

Modern evergreen browsers (ES2019). The package ships as ESM.