leadconduit-integration-ui
v1.1.5
Published
LeadConduit Integration UI Helper
Downloads
561
Maintainers
Keywords
Readme
leadconduit-integration-ui
LeadConduit Integration UI Helpers
Usage
The function ui.init()
is called with a function that is given data from the LeadConduit client app pertaining to the particular user/account and integration. When this function is called, it waits until the document is fully loaded, then extracts styles from the parent frame and injects them into the current iframe, then sends a signal to the client that the integration is ready to be rendered.
var ui = require('leadconduit-integration-ui');
ui.init(/* optional */data, function(config) {
// the config argument contains data like entity, mappings and creds
// (this is where angular bootstrapping should happen)
// if you need to navigate to a relative path, this method provides
// a safe way to get where you need to go
var myResourcePath = ui.getBasePath('/path/to/resource');
// the following methods help with interacting with the parent:
// cancel whatever the user was doing and close the modal
ui.cancel();
// create something and add it to the flow, then close
ui.create({
flow: {
steps: [/* step data goes here */]
}
});
});
If the optional data
object is provided, the data will be passed directly to the client for use during initial setup. The url
parameter will be sent automatically containing the current window's location href. Currently, this object is only used for the url
parameter.
config
object
The config
object is provided to the function passed to ui.init()
. It can contain a varying number of parameters:
| Parameter | Description | Availability |
| -- | -- | -- |
| entity
| Information about the particular entity that this integration is from, including { name, id }
. | Always |
| accountInfo
| Object with { id, name, ssoId }
referring to the current account using the app | Always |
| integration
| An ID referencing the particular integration being used from the selected integration package | Sometimes |
| credential
| A credential object that contains { token }
if available and selected | Sometimes |
| flow
| Limited information about the flow this integration is used in, if available. It may contain only { id }
, or it may additionally contain { fields }
if the package is a LeadConduit integration. | Sometimes |
| router
| If the integration has a specific router, that information is provided here | Sometimes |
ui
actions
The client will respond to certain "actions" that the integration fires.
ui.create
This creates a new step in the user's flow. The structure of the data object provided as a first argument should look like this:
{
flow: {
fields: ['fields', 'to', 'add'],
steps: [ /* steps to add */ ]
},
credential: {
token: 'string'
},
entities: [{
/* full entity object needs to be provided, see https://docs.activeprospect.com/leadconduit/reference.html#entity */
}],
router: {
/* full router object needs to be provided, see https://github.com/activeprospect/leadconduit-schema/blob/master/schema.json#L865 */
}
}
ui.cancel
This closes the UI, behaving similarly to ui.create
in that anything provided will be used to set up the flow.
ui.close
This closes the integration, updating the credential if provided. This is considered legacy and shouldn't be used anymore.