If you are building your application using React, you must first add the Authologic library to your dependencies:
npm i @authologic/websdk-react
The next step is to import the library:
import {AuthologicWidget, Theme} from "@authologic/websdk-react";
and using the component in the page:
<AuthologicWidget
customerId="<customer ID>"
conversationId="<conversation ID>"
environment="sandbox"
/>
For testing you can use customerId: development_only . It will disable security, but will only work in a sandbox environment.
|
Possible parameters are described below.
Mandatory parameters
Name | Default value | Purpose |
---|---|---|
|
- |
A dedicated SDK key, associated with the page where the widget is installed |
|
- |
The ID of the conversation that should be started |
Optional parameters
Name | Default value | Purpose |
---|---|---|
|
production |
The environment that will be used for the connection. Available values: production, sandbox |
|
determined based on the browser |
The two-letter interface language code, for example: PL |
|
determined by account configuration |
Interface appearance. By default it is configured on the Authlogic account side (see below) |
|
{height: "650", width: "650"} |
The screen size that the widget should occupy |
Appearance configuration example:
theme: {
primary: '#00ffb2',
secondary: '#88ff00',
background: '#a6715e',
text: '#073d07',
menu: {
text: '#911111',
background: '#a6715e'
},
item: {
background: '#a6715e'
},
button: {
text: '#021772'
}
}
Below is an example of a full page definition using the composition API:
import {AuthologicWidget, Theme} from "@authologic/websdk-react";
const theme: Theme = {
button: {
text: "#e5cfe5"
},
menu: {
background: "#537743",
text: "#e5cfe5"
},
primary: "#537743",
background: "#242424",
secondary: "#c9afd2",
text: "#537743",
item: {
background: "#e5cfe5"
}
}
function App() {
return (
<>
<div>
<AuthologicWidget
customerId="development_only"
conversationId="3fccdba0-8ff7-407b-93a0-1f2f7ea4855b"
environment="sandbox"
theme={theme}
/>
</div>
</>
)
}
export default App