Initializer
Conductiv provides an Initializer script (JavaScript snippet) that is added to a page in the Lender's LOS. There are only a few required steps, but if you would like to further configure the experience, additional functionality is available.
Add the Initializer Script to your Page
You must add the appropriate script for the environment you are targeting (sandbox vs. production).
https://sandbox.conductiv.co/initializer.js
https://developer.conductiv.co/initializer.js
There are a handful of different ways one can do this. Here are a few suggestions:
- Add the script directly into your HTML page:
<script src="https://<environment>.conductiv.co/initializer.js"></script>
- Add the script dynamically using JS:
const initializerSource = document.createElement("script");
initializerSource.src = "https://<environment>.conductiv.co/initializer.js";
document.body.appendChild(initializerSource);
- Add the script to your page with a library like react-helmet
There are many different ways this can be done. If you are unsure which best fits your use case, please feel free to reach out at implementation@conductiv.co.
Call the Initializer
After the script has loaded, you may call the Initializer script whenever you like with the following command:
window.Initializer.init(initProps);
Required Properties
The initProps
object is composed of the following required properties:
jwtToken
type: string
This is the value returned to you by our Token API.
onEvent
data: ({
type: "CLOSE" | "SUCCESS" | "ERROR",
reason?: "USER_INTERACTION" | "SUCCESS" | "ERROR",
message?: string,
}) => null;
We allow you to pass us a callback so that you can reclaim the UX when appropriate.
There are three types:
CLOSE
Close will come with a reason
, one of the following:
- USER_INTERACTION
- SUCCESS
- ERROR
Basically, why has the flow ended. You will need to handle this scenario.
Some actions you may want to take here:
- Make an API call
- Trigger a redirect
- Render particular UI
SUCCESS
Success will come with a message
, corresponding to the datasource the applicant completed (ex: truv
, ocrolus
, plaid
, etc.)
By default, closeOnSuccess is set to false, so the user will still see the success page before exiting and triggering another event with the close reason
If you decide to pass closeOnSuccess as true, another event will not fire
ERROR
Error may also include a message
property with a short description for why the error occurred.
By default, closeOnError is set to false, so the user will still see the error page before exiting and triggering another event with the close reason
If you decide to pass closeOnError as true, another event will not fire
Optional Properties
The initProps object is composed of the following optional properties:
closeOnError
type: boolean
default: false
We provide with our flows an error screen. You may customize the copy on this screen for each flow via the platform.
If you would rather reclaim the experience without the user seeing our error screen, you can pass this as true
closeOnSuccess
type: boolean
default: false
Very similar to the property above. We provide with our flows a success screen. You may customize the copy on this screen for each flow via the platform.
If you would rather reclaim the experience without the user seeing our success screen, you can pass this as true
testing
type: boolean
default: false
If you would like to be able to render your flows without having to put them into the correct workflow state, you can pass testing
as true.
Though you should not pass this parameter in production, it will still ignore the inactive flows and only render live ones.
Result
To summarize, we believe your request should look something like the following:
const initProps = {
jwtToken, // token generated from API call
onEvent: ({ type, reason }) => {
if (type === 'CLOSE') {
...
}
...
},
};
window.Initializer.init(initProps);