API Reference
API Reference for the OkHi JavaScript browser library
OkHi(configuration)
Creates a new OkHi class instance.
Arguments
configuration (object) -- A configuration object that the new class instance will be initiated with.
Returns
A new OkHi class instance with methods and values publicly accessible.
Usage
LocationCard(options)
Creates and renders an OkHi location card on the DOM. Upon success the onSuccess callback function will be called with a SuccessObject and upon failure the onError will be called with a ErrorObject.
Arguments
options (object) -- A configuration object that the LocationCard class will use to render the card on the DOM.
Returns
A location card class instance with the properties below.
user
This property allows you to change the user by supplying a new user object to the card. Only phone number is required to change the user. If you provide only a new phone number without changing firstName and lastName properties the previous values will be used.
Usage
LocationManager(options)
Enables launching and closing of the OkHi location manager.
Arguments
options (object) -- A configuration object that the LocationManager class will use to to launch.
Returns
A location manager class instance with the methods below
launch(launchConfiguration)
Arguments
launchConfiguration (object) -- A configuration object that will enable the location manager to launch in different modes.
mode - string values
select_location: This launches the location manager prompting the user to select one of their existing locations if available
location - object
id - An OkHi location id.
Launch Possibilities
Usage
UserObject
The UserObject consists of information about a single user.
LocationObject
A LocationObject consists of information about a single OkHi location.
*IMPORTANT* When a user is creating / selecting a location you can always expect to receive a latitude and a longitude all other information listed below are optional.
SuccessObject
The SuccessObject is the UserObject and LocationObject nested into one object.
Example
ErrorObject
An ErrorObject contains information of any error that occurred during the launch of the LocationManager.
Error Codes
StyleObject
The StyleObject provides you with a way to customise both the LocationCard and LocationManager to better match your brand requirements.
StyleBaseObject
StyleClassObject
Example
CopyObject
This object allows you to change different pieces of copy in the LocatinCard
Example
ConfigurationObject
AppBarConfigurationObject
Example
Last updated