1.1.6 • Published 9 months ago

@agiodigital/agio-workflow-sdk v1.1.6

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

Alright, I understand your requirements now. Let's revise the provided documentation.


@agiodigital/agio-workflow-sdk

Latest version Latest Beta Version License

Description

@agiodigital/agio-workflow-sdk is a JavaScript SDK designed for the seamless integration of Agio workflows into your application using an iframe. The SDK also provides a Management SDK for server-side interactions, ensuring that sensitive information like apiToken remains secured.

Installation

Use npm or yarn to install the package:

# Using npm
npm install @agiodigital/agio-workflow-sdk

# Using yarn
yarn add @agiodigital/agio-workflow-sdk

Usage

Server-side: AgioWorkflowManagementSdk

ā›” 🚫 Always fetch the SDK initialization token securely from the backend. NEVER expose your apiToken on the client-side.

The token is valid for 10 minutes and a new token can be fetched at any time.

Using the AgioWorkflowManagementSdk, you can securely manage sensitive tasks, such as fetching the SDK initialization token:

// Import the module
import { AgioWorkflowManagementSdk } from '@agiodigital/agio-workflow-sdk';

// Initialize with configuration
const sdkManagement = new AgioWorkflowManagementSdk({
  apiToken: "YOUR_SECURE_API_TOKEN", // required
  externalUserId: "user-123", // required
  externalUserEmail: "user@example.com",
  externalUserName: "John Doe"
});

// Fetch the SDK initialization token
const token = await sdkManagement.getToken();

Fetching SDK Initialization Token with CURL:

Alternatively, you can fetch the SDK initialization token directly using a CURL command:

curl -X POST \
  -H "Content-Type: application/json" \
  -d '{
    "externalUserId": "exampleUserId",
    "externalUserEmail": "user@example.com",
    "externalUserName": "Example Name",
    "apiToken": "YOUR_SECURE_API_TOKEN"
  }' \
  https://api.agiodigital.com/auth/workflow-sdk/init-token 

Replace placeholders with your actual data.

Client-side: AgioWorkflowSdk

After fetching the SDK initialization token securely from the backend, you can then utilize it on the client side:

// Import the module
import { AgioWorkflowSdk } from '@agiodigital/agio-workflow-sdk';

// Initialize with configuration
const sdk = new AgioWorkflowSdk({
  token: "YOUR_SDK_INIT_TOKEN",  // obtained securely from your server
  workflowId: "company-setup", // required
  environment: "development" // optional (default: "production")
});

// Mount the widget
sdk.mountWidget({
  container: "#workflow-container", // query selector or DOM element
  on: {
    stepChange: (step) => {
      console.log("Step Changed:", step);
    },
    workflowComplete: () => {
      console.log("Workflow Completed");
    }
  }
});

// Optionally, unmount the widget
sdk.unmountWidget();

License

This project is licensed under the MIT License. See the LICENSE file for full details.

1.1.6

9 months ago

1.1.6-beta.17

9 months ago

1.1.5-beta.16

9 months ago

1.1.5-beta.15

12 months ago

1.1.5-beta.14

1 year ago

1.1.5-beta.12

1 year ago

1.1.5-beta.13

1 year ago

1.1.5-beta.11

1 year ago

1.1.5-beta.10

2 years ago

1.1.5-beta.9

2 years ago

1.1.5-beta.8

2 years ago

1.1.5-beta.7

2 years ago

1.1.5-beta.6

2 years ago

1.1.5-0

2 years ago

1.1.5-6

2 years ago

1.1.5

2 years ago

1.1.6-beta.0

2 years ago

1.1.5-beta.0

2 years ago

1.1.4-beta.0

2 years ago

1.1.3-beta.0

2 years ago

1.1.2-beta.0

2 years ago

1.0.1

2 years ago

1.0.2-beta.0

2 years ago

1.0.1-beta.0

2 years ago

1.0.0

2 years ago