Monite Iframe App
Learn how to configure and customize the Monite Iframe App component to embed Monite’s functionality seamlessly into your application.
Overview
The Monite Iframe App component provides a simple way to integrate Monite features into your application, ensuring smooth communication between your platform and Monite’s services. This integration leverages iframe-based rendering for a secure and efficient experience.
Available components
The Monite Iframe App offers various components that can be seamlessly integrated into your application. Below is a list of the available components:
payables
: Manages payable invoices and bills.receivables
: Handles receivable invoices and payment collection.counterparts
: Manages information about customers, vendors, and other business partners.products
: Handles product catalog and inventory management.approval-policies
: Configures approval workflows for different processes.roles
: Manages user roles and permissions within the system.onboarding
`: Guides users through the initial setup process.
How to implement
To implement the Monite Iframe App, follow the steps below:
1. Embed the iframe
To embed the Monite Iframe App, include an <iframe>
element in your HTML code, specifying the desired
component in the src
attribute. For example, to embed the Receivables
component:
The parameters are explained below:
2. Establish communication
The Monite Iframe App uses a secure communication channel to interact with your host application. This channel facilitates the exchange of data, such as authentication tokens.
2.1. Initialize the communicator
To initiate the communication, use the MoniteIframeAppCommunicator
class:
2.2. Mount the slots
The mountSlot
method sets up a communication channel for specific functionalities.
2.2.1. Authentication token slot
The fetch-token
slot manages the retrieval of authentication tokens. You need to provide a function that fetches the token from your backend and returns it:
The function provided to the fetch-token
slot will be invoked by the Iframe App whenever it needs to obtain an authentication token. This approach ensures secure token handling.
2.2.2. Locale slot
The locale
slot allows you to customize the language and regional settings of the Iframe App. The interface for the
locale object is the same as for the Drop-In Component
or <MoniteProvider />
from the React SDK:
2.2.3. Theme slot
The theme
slot allows you to apply custom theming to the Iframe App to match your application’s look and feel. The
interface for the theme object is the same as for
the React SDK:
You can call iframeCommunicator.mountSlot(...)
multiple times to modify the theme dynamically, for example, to switch
between light and dark modes:
2.3. Establish connection
After mounting the necessary slots, establish a connection with the Iframe App:
To disconnect the iframe and stop communication with it you can call:
This method might be needed when the Monite Iframe App is removed from the host page.
Complete example
Here is a complete version of code for the implementation:
Choosing an environment
The Monite Iframe App offers both production and sandbox environments to support development and testing.
-
Production: Use the production environment for your live applications.
- Iframe App URL:
https://cdn.monite.com/monite-iframe-app/{component}
- Communicator URL:
https://cdn.monite.com/monite-iframe-app-communicator.js
- Iframe App URL:
-
Sandbox: The sandbox environment is designed for development and testing, allowing you to experiment without impacting live data.
- Iframe App URL:
https://cdn.sandbox.monite.com/monite-iframe-app/{component}
- Communicator URL:
https://cdn.sandbox.monite.com/monite-iframe-app-communicator.js
- Iframe App URL: