1.1.2 • Published 3 years ago

@akordacorp/assembly v1.1.2

Weekly downloads
-
License
SEE LICENSE IN LI...
Repository
-
Last release
3 years ago

Akorda - Developer Integration - Contract Assembly

This package contains two files:

  • akorda-assembly.js
  • akorda-assembly.css

These two resources are used to integrate Akorda's Contract Assembly feature into third-party environments.

Installation

yarn add @akordacorp/assembly

or

npm install @akordacorp/assembly

Usage

Once the browser has loaded the two resources (akorda-assembly.js and akorda-assembly.css), you can load Akorda's contract assembly feature using the js function AkordaAssembly(). For example:

// reference the id of your contract playbook template that you'd like to use.
// Assembly Questions should be configured for this playbook.
const akordaPlaybookId = 892;

// the "config" argument is an object that includes various
// properties (some required) for talking to the Akorda
// application. More information about the config option
// properties can be found in the documentation below.
const config = {
  // the Akorda application URL (omitted if using a proxy)
  appUrl: "https://app.akorda.com",
  // the jwt token obtained via your client credentials (omitted if using a proxy)
  accessToken: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJsb2dnZWRJbkFzIjoiYWRtaW4iLCJpYXQiOjE0MjI3Nzk2Mzh9.gzSraSYS8EXBxLN_oWnFSRgCzcmJmMjLiuyu5CSpyHI",
  // the id of the DOM element in which to load the assembly feature.
  targetElementId: "akorda-assembly",
  // required information about the user
  userInfo: {
    firstName: "Jane",
    lastName: "Doe",
    email: "jane.doe@akorda.com"
  },
};

// Call the AkordaAssembly() function with the required arguments
AkordaAssembly(akordaPlaybookId, config);

Config Properties

config.appUrl In a standard production environment, this url will be same url as the production Akorda application: https://app.akorda.com. If you are using an Akorda development or staging environment, this url may be different. Ask your Akorda representative for more information.

Important: If you are proxing the calls to Akorda on the server, you must omit this property from the config.


config.targetElementId In your web page, this is the ID of the DOM element in which you want the Akorda Contract Assembly feature to appear. The default is akorda-assembly, and might appear in the html of your web page as:

<div id="akorda-assembly"></div>

config.accessToken The JWT token that will be used for authentication and authorization in the Akorda application. You can acquire a token via the Akorda application by sending an HTTP POST request to {appUrl}/api/login/authorize, and include the form values: client_id and client_secret. Please contact your Akorda representative for these details.


config.userInfo An object with the following structure:

 {
    firstName: "Jane",
    lastName: "Doe",
    email: "jane.doe@akorda.com"
  }

This information allows Akorda to properly send emails on behalf of the user.

Use a Proxy

The best way to integrate Akorda Assembly is to use a server-side proxy that will avoid the challenges associated with cross-origin requests from the browser and keep your accessToken away from your client-side code.

For example, when the user loads your web page, your server could obtain a JWT access token using the Akorda provided client credentials (client_id and client_secret), and then return the page with a cookie (named Authorization) that has the JWT access token as the value.

Then, when your client code calls AkordaAssembly(playbookId, config), omit the appUrl and the accessToken from the config object. By omitting these, all data requests will be sent to your server instead of Akorda's application.

Next, proxy the Akorda API calls (they all start with "/api") along with the authorization cookie to the Akorda application url (e.g., https://app.akorda.com).

An example/reference implementation (built using a simple NodeJS Express web app) is available here: https://github.com/akordacorp/assembly-reference-implementation.

And if you need help, don't hesitate to contact your Akorda representative.

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.0

3 years ago