Wrapper to access juniper labs api features
Using npm: Not supported yet.
Using cdn:
<script src="https://unpkg.com/juniper-labs-io/dist/index.var.js"></script>
Adding css for styling the auto complete component:
<link rel="stylesheet" type="text/css" href="https://unpkg.com/juniper-labs-io/dist/index.css" />
// Create new client
new JuniperLabs.BusinessPrefill.AutoCompleteComponent(
YOUR_API_KEY,
BASE_API_URL, // Optional: defaults to https://prefill.juniperlabs-services.com/v0.1
).initializeComponent(
document.getElementById("business_name"), // required: input element to be connected with autocomplete
{
onSelect: (details) => { console.log(details) }, // optional: callback, invoked with business details when a user select a item from the autocomplete dropdown
registry_state: "CO" // optional
}
)
You can find a working example code as gist here replace YOUR_API_KEY with your actual api key and then open the html file in your browser
https://codepen.io/puneet-sutar/pen/abNNVeY?editors=1111
// Create new client
new JuniperLabs.BusinessPrefill.ApiClient(
YOUR_API_KEY,
BASE_API_URL, // Optional: defaults to https://prefill.juniperlabs-services.com/v0.1
).typeahead(
search_string, // required
registry_state, // optional
)
// Create new client
new JuniperLabs.BusinessPrefill.ApiClient(
YOUR_API_KEY,
BASE_API_URL, // Optional: defaults to https://prefill.juniperlabs-services.com/v0.1
).id(
id, // required: string
)