ReactJs integration
Generalities
Integrating Retorik Framework in a ReactJs application is done by importing the package @davi-ai/retorik-framework from NPM :
npm install @davi-ai/retorik-framework
Component instanciation
Depending on the needs, import a component from the ones below :
- RetorikAgent : fullscreen mode with responsive design
- RetorikWidget : widget mode with a button allowing to open Retorik Framework in a small-sized window
- RetorikNews : fullscreen mode with only the news page
import { RetorikAgent } from "@davi-ai/retorik-framework"
import { RetorikWidget } from "@davi-ai/retorik-framework"
import { RetorikNews } from "@davi-ai/retorik-framework"
Configuration
Launching the application requires only one parameter in normal / news modes, and 2 in widget mode (see the Configurations section in Framework documentation for the full list of configuration options)
Simple example
An example with more configuration options is available in the Examples section in Framework documentation
import React from 'react'
import type { AddressData } from '@davi-ai/retorik-framework'
import { RetorikAgent } from '@davi-ai/retorik-framework'
const addressData: AddressData: {
tenant: '<your_id_tenant>'
}
const App = () => {
return <RetorikAgent {{ addressData: addressData }} />
}
export default App