@melio-eng/melio-sdk
v2.1.0
Published
**Melio SDK** is a lightweight, framework agnostic Typescript library for embedding Melio in your web application. It handles rendering the application, and facilitates type safe message passing between the host and Melio.
Readme
Melio SDK
Melio SDK is a lightweight, framework agnostic Typescript library for embedding Melio in your web application. It handles rendering the application, and facilitates type safe message passing between the host and Melio.
Features / Use Cases
- URL Synchronization: Synchronize the URL between the Melio and the host application.
- Session Synchronization: Support for synchronizing the session state between the melio and host application.
- Error Handling: Attach specific event listeners for handling authentication and other errors.
- Sending Events: Send events into Melio.
Installing
The package is available for download on NPM.
npm install @melio-eng/melio-sdk
Demo
If you'd rather explore the SDK in a sandbox environment, checkout our interactive demo Here. If you're unable to access the link, please reach out to [email protected] for access.
Getting Started
This SDK exposes a single render, function which initializes Melio at the specified melioSelector and sets up the event listeners to begin sending and receiving messages.
import { render, Options } from "@melio/melio-sdk";
const options: Options = {
state: {
originUrl: "https://app.melio.com/partner",
entrypoint: "/billpay-click-pay",
},
initialHeight: "800px",
melioSelector: "#melioWrapper",
};
const eventManager = render(options);
eventManager.navigateToTarget("/view-payments")
eventManager.onUserActivePing(() => {
user.extendSession()
})For more details, consult the documentation on {@link render | render} and the {@link MelioEventManager | MelioEventManager} interface.
