@agiodigital/agio-workflow-sdk
Description
@agiodigital/agio-workflow-sdk
is a JavaScript SDK for integrating Agio workflows into your application via an iframe.
Installation
To install the package, you can use npm or yarn:
# Using npm
npm install @agiodigital/agio-workflow-sdk
# Using yarn
yarn add @agiodigital/agio-workflow-sdk
Usage
First, import the AgioWorkflowSdk
class and create a new instance with the required configuration options:
// Import the module
import { AgioWorkflowSdk } from '@agiodigital/agio-workflow-sdk';
// Initialize with configuration
const sdk = new AgioWorkflowSdk({
workflowId: "workflow-123",
externalUserId: "user-123",
apiToken: "your-api-token",
environment: "production"
});
Mounting the Widget
To embed the Agio workflow in your application, call the mountWidget
function with an options object:
sdk.mountWidget({
container: "#workflow-container",
on: {
stepChange: (step) => {
console.log("Step Changed:", step);
},
workflowComplete: () => {
console.log("Workflow Completed");
}
}
});
Unmounting the Widget
To remove the Agio workflow iframe from your application, call the unmountWidget
function:
sdk.unmountWidget();
License
This project is licensed under the MIT License. See the LICENSE
file for details.