Skip to content

@melio-eng/cfc-sdk


@melio-eng/cfc-sdk

TypeScript SDK for embedding and communicating with the CFC iframe. Zero runtime dependencies, supports ESM and CJS, fully typed with composable feature modules.

Installation

bash
npm install @melio-eng/cfc-sdk

Quick Start

typescript
import { CfcClient, Environment, IntegrationMode, NavigationTarget } from "@melio-eng/cfc-sdk";

const client = new CfcClient({
  container: document.getElementById("cfc-container")!,
  environment: Environment.STAGING,
  token: "<your-auth-token>",
  tenant: "your-tenant-id",
  mode: IntegrationMode.FULL_PAGE,
  target: NavigationTarget.VIEW_PAYMENTS,

  onSessionExpired: () => {
    window.location.href = "/login";
  },
  onExitRequested: (originator) => {
    client.destroy();
    window.location.href = "/dashboard";
  },
});

client.init();

The SDK automatically handles:

  • Creating the iframe inside your container
  • Constructing the auth URL
  • Dimension synchronization (resize, scroll, content size changes)
  • Navigation callbacks
  • Forwarding scroll position to CFC
  • All CFC message types

Integration Modes

  • Full Page — CFC owns the full vertical space. The host can still have a sidebar and header.
  • Partial — The host has its own content above or below the CFC iframe. The SDK handles scroll coordination and dynamic iframe resizing.

Documentation

Full documentation is available at the CFC SDK Docs.

License

Private — for authorized partners only.