{"_id":"@auroraai-bot-platform/rasa-webchat","_rev":"10-fa3c9a7d9ac4c8bf740f04d772d7876a","time":{"created":"2023-09-01T12:39:46.015Z","1.0.0":"2023-05-30T05:29:46.141Z","modified":"2023-10-23T05:48:31.261Z","0.6.0":"2023-06-05T06:08:03.254Z","0.6.1":"2023-06-08T05:34:10.081Z","0.6.2":"2023-06-09T05:27:11.222Z","0.6.3":"2023-06-28T10:28:51.176Z","0.6.4":"2023-09-01T10:23:50.740Z","0.6.5":"2023-09-01T12:39:46.464Z","0.6.6":"2023-10-23T05:48:31.039Z"},"name":"@auroraai-bot-platform/rasa-webchat","dist-tags":{"latest":"0.6.6"},"versions":{"0.6.5":{"name":"@auroraai-bot-platform/rasa-webchat","version":"0.6.5","description":"Chat web widget for React apps and Rasa Core chatbots","module":"module/index.js","main":"lib/index.js","repository":{"type":"git","url":"git+https://github.com/auroraai-bot-platform/rasa-webchat.git"},"author":"","license":"Apache-2.0","scripts":{"dev":"webpack-dev-server --config webpack.dev.js","build":"webpack --config webpack.prod.js --mode production","test":"jest","prepare":"npm run build","release":"standard-version"},"keywords":["react","chat","widget","javascript"],"dependencies":{"@popperjs/core":"2.11.4","@stomp/stompjs":"6.1.2","i18next":"^23.2.7","i18next-browser-languagedetector":"^7.1.0","immutable":"^4.0.0","object-hash":"^3.0.0","prop-types":"15.8.1","react-i18next":"^13.0.1","react-immutable-proptypes":"^2.2.0","react-inlinesvg":"^2.3.0","react-markdown":"^5.0.3","react-popper":"^2.2.5","react-redux":"^7.2.9","react-slick":"^0.29.0","react-textarea-autosize":"^8.5.0","redux":"^4.2.1","slick-carousel":"^1.8.1","socket.io-client":"^4.7.0","sockjs-client":"^1.6.1"},"devDependencies":{"@babel/cli":"7.22.5","@babel/core":"7.22.5","@babel/eslint-parser":"^7.22.5","@babel/plugin-proposal-object-rest-spread":"7.20.7","@babel/preset-env":"7.22.5","@babel/preset-react":"^7.22.5","@commitlint/cli":"17.6.5","@commitlint/config-conventional":"17.6.5","@wojtekmaj/enzyme-adapter-react-17":"^0.8.0","babel-jest":"29.5.0","babel-loader":"8.3.0","babel-plugin-module-resolver":"^5.0.0","babel-plugin-transform-class-properties":"^6.24.1","babel-preset-stage-0":"^6.24.1","clean-webpack-plugin":"4.0.0","css-loader":"^3.6.0","enzyme":"^3.11.0","eslint":"^8.43.0","eslint-config-airbnb":"^19.0.4","eslint-config-prettier":"^8.5.0","eslint-import-resolver-babel-module":"^5.3.2","eslint-plugin-flowtype":"^8.0.3","eslint-plugin-import":"^2.27.5","eslint-plugin-jsx-a11y":"^6.7.1","eslint-plugin-prettier":"^4.0.0","eslint-plugin-react":"^7.32.2","eslint-plugin-react-hooks":"^4.6.0","html-webpack-plugin":"^4.5.2","husky":"^7.0.4","jest":"^25.5.4","lodash-webpack-plugin":"^0.11.6","prettier":"2.6.0","prettier-eslint":"13.0.0","react":"^17.0.2","react-dom":"^17.0.2","redux-mock-store":"^1.5.4","sass":"^1.63.4","sass-loader":"10.4.1","standard-version":"^9.3.2","string-replace-loader":"^2.3.0","style-loader":"^0.18.2","url-loader":"^4.1.1","webpack":"^4.39.3","webpack-cli":"^3.3.7","webpack-dev-server":"^3.8.0"},"peerDependencies":{"react":"^16.8.3 || ^18.0.0","react-dom":"^16.8.3 || ^18.0.0"},"jest":{"verbose":true,"moduleNameMapper":{"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$":"<rootDir>/mocks/fileMock.js","\\.(css|scss)$":"<rootDir>/mocks/styleMock.js"},"setupTestFrameworkScriptFile":"<rootDir>/test-setup.js"},"husky":{"hooks":{"commit-msg":"commitlint -E HUSKY_GIT_PARAMS"}},"directories":{"lib":"lib"},"gitHead":"cce2bef864924bb3e5b13dc505c16f5ba02fcc87","bugs":{"url":"https://github.com/auroraai-bot-platform/rasa-webchat/issues"},"homepage":"https://github.com/auroraai-bot-platform/rasa-webchat#readme","_id":"@auroraai-bot-platform/rasa-webchat@0.6.5","_nodeVersion":"14.21.3","_npmVersion":"6.14.18","dist":{"integrity":"sha512-z0EFMT9HPRvejL6gW8nxoSF/UdcTnpwQSCIQFSEdd03ribOya69zKAilZ3tC66aMD7fAhQs7raBRXkMiLxPgog==","shasum":"61d5a1040cd34566b2c3f8587202e68a0e2f0dd6","tarball":"https://registry.npmjs.org/@auroraai-bot-platform/rasa-webchat/-/rasa-webchat-0.6.5.tgz","fileCount":61,"unpackedSize":10979386,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCerj4JZKkjxEWj/mWomWX3tblY2gWz4IcP+6O3xu7WSQIhAK+Cdcy+ITcTQdr8D9INTQATbsdgJdT3Uj9Wyv/vDxE4"}]},"_npmUser":{"name":"matiasleinonen","email":"matias.leinonen@gofore.com"},"maintainers":[{"name":"matiasleinonen","email":"matias.leinonen@gofore.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rasa-webchat_0.6.5_1693571986138_0.43046394686249556"},"_hasShrinkwrap":false},"0.6.6":{"name":"@auroraai-bot-platform/rasa-webchat","version":"0.6.6","description":"Chat web widget for React apps and Rasa Core chatbots","module":"module/index.js","main":"lib/index.js","repository":{"type":"git","url":"git+https://github.com/auroraai-bot-platform/rasa-webchat.git"},"author":"","license":"Apache-2.0","scripts":{"dev":"webpack-dev-server --config webpack.dev.js","build":"webpack --config webpack.prod.js --mode production","test":"jest","prepare":"npm run build","release":"standard-version"},"keywords":["react","chat","widget","javascript"],"dependencies":{"@popperjs/core":"2.11.4","@stomp/stompjs":"6.1.2","i18next":"^23.2.7","i18next-browser-languagedetector":"^7.1.0","immutable":"^4.0.0","object-hash":"^3.0.0","prop-types":"15.8.1","react-i18next":"^13.0.1","react-immutable-proptypes":"^2.2.0","react-inlinesvg":"^2.3.0","react-markdown":"^5.0.3","react-popper":"^2.2.5","react-redux":"^7.2.9","react-slick":"^0.29.0","react-textarea-autosize":"^8.5.0","redux":"^4.2.1","slick-carousel":"^1.8.1","socket.io-client":"^4.7.0","sockjs-client":"^1.6.1"},"devDependencies":{"@babel/cli":"7.22.5","@babel/core":"7.22.5","@babel/eslint-parser":"^7.22.5","@babel/plugin-proposal-object-rest-spread":"7.20.7","@babel/preset-env":"7.22.5","@babel/preset-react":"^7.22.5","@commitlint/cli":"17.6.5","@commitlint/config-conventional":"17.6.5","@wojtekmaj/enzyme-adapter-react-17":"^0.8.0","babel-jest":"29.5.0","babel-loader":"8.3.0","babel-plugin-module-resolver":"^5.0.0","babel-plugin-transform-class-properties":"^6.24.1","babel-preset-stage-0":"^6.24.1","clean-webpack-plugin":"4.0.0","css-loader":"^3.6.0","enzyme":"^3.11.0","eslint":"^8.43.0","eslint-config-airbnb":"^19.0.4","eslint-config-prettier":"^8.5.0","eslint-import-resolver-babel-module":"^5.3.2","eslint-plugin-flowtype":"^8.0.3","eslint-plugin-import":"^2.27.5","eslint-plugin-jsx-a11y":"^6.7.1","eslint-plugin-prettier":"^4.0.0","eslint-plugin-react":"^7.32.2","eslint-plugin-react-hooks":"^4.6.0","html-webpack-plugin":"^4.5.2","husky":"^7.0.4","jest":"^25.5.4","lodash-webpack-plugin":"^0.11.6","prettier":"2.6.0","prettier-eslint":"13.0.0","react":"^17.0.2","react-dom":"^17.0.2","redux-mock-store":"^1.5.4","sass":"^1.63.4","sass-loader":"10.4.1","standard-version":"^9.3.2","string-replace-loader":"^2.3.0","style-loader":"^0.18.2","url-loader":"^4.1.1","webpack":"^4.39.3","webpack-cli":"^3.3.7","webpack-dev-server":"^3.8.0"},"peerDependencies":{"react":"^16.8.3 || ^18.0.0","react-dom":"^16.8.3 || ^18.0.0"},"jest":{"verbose":true,"moduleNameMapper":{"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$":"<rootDir>/mocks/fileMock.js","\\.(css|scss)$":"<rootDir>/mocks/styleMock.js"},"setupTestFrameworkScriptFile":"<rootDir>/test-setup.js"},"husky":{"hooks":{"commit-msg":"commitlint -E HUSKY_GIT_PARAMS"}},"directories":{"lib":"lib"},"gitHead":"766321247f7731cde0cd81af76bcae0352ea32b5","bugs":{"url":"https://github.com/auroraai-bot-platform/rasa-webchat/issues"},"homepage":"https://github.com/auroraai-bot-platform/rasa-webchat#readme","_id":"@auroraai-bot-platform/rasa-webchat@0.6.6","_nodeVersion":"14.21.3","_npmVersion":"6.14.18","dist":{"integrity":"sha512-KRQd7Y+uRdXJ4ib8Xi8+mPipVckfYv69rjlOLWjlty4h9REIi7W23lwkbgi5oqjbieUWsE7YNAn48aNdHI8T5w==","shasum":"4efb027e621ebdc782e7340196ee32327bccae40","tarball":"https://registry.npmjs.org/@auroraai-bot-platform/rasa-webchat/-/rasa-webchat-0.6.6.tgz","fileCount":60,"unpackedSize":7405059,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEtVWkCJjx+nOMQcTsRaoLoyotSRG2wFqM7qnZdi+d/2AiBP0GaBvuKJ2hfwPevSP3HTKLGoT4TkkOV2jjybmh/IGQ=="}]},"_npmUser":{"name":"matiasleinonen","email":"matias.leinonen@gofore.com"},"maintainers":[{"name":"matiasleinonen","email":"matias.leinonen@gofore.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rasa-webchat_0.6.6_1698040110740_0.7736024490800479"},"_hasShrinkwrap":false}},"maintainers":[{"name":"matiasleinonen","email":"matias.leinonen@gofore.com"}],"description":"Chat web widget for React apps and Rasa Core chatbots","homepage":"https://github.com/auroraai-bot-platform/rasa-webchat#readme","keywords":["react","chat","widget","javascript"],"repository":{"type":"git","url":"git+https://github.com/auroraai-bot-platform/rasa-webchat.git"},"bugs":{"url":"https://github.com/auroraai-bot-platform/rasa-webchat/issues"},"license":"Apache-2.0","readme":"# AURORAAI-BOT-PLATFORM/RASA-WEBCHAT\r\n\r\n## Customization\r\n\r\n- Logo needs to be dimensioned 24px \\* 24px\r\n- The logo should be an SVG, which has the fill color not set or set to currentColor, to enable coloring via the font color of the parent element\r\n\r\n## Integration\r\n\r\nIntegration can be done via releasing an npm package or direct download of the index.js file\r\n\r\n## Install\r\n\r\n- install nodejs\r\n- clone this repository\r\n- run `npm ci` to install the dependencies\r\n\r\n## Run locally for testing or development\r\n\r\n- run `npm run dev`\r\n\r\n## Release\r\n\r\n- run `npm run build` to make a release build\r\n- the build is in `lib/index.js`\r\n\r\n## Official documentation\r\n\r\n<h1 align=\"center\">Auroraai-bot-platform Rasa Webchat 💬</h1>\r\n<h5 align=\"center\">\r\n A chat widget to deploy virtual assistants made with <a href=\"https://github.com/auroraai-bot-platform/rasa\">Rasa</a> or <a href=\"https://github.com/auroraai-bot-platform/botfront-aurora\">Botfront</a> on any website.\r\n</h5>\r\n<br />\r\n<br />\r\n\r\n<div align=\"center\">\r\n<img align=\"center\" src=\"./rasa_webchat.gif\" alt=\"demonstration\">\r\n</div>\r\n<br />\r\n\r\n<br />\r\n\r\n## Features\r\n\r\n- Text Messages\r\n- Quick Replies\r\n- Images\r\n- Carousels\r\n- Markdown support\r\n- Persistent sessions\r\n- Typing indications\r\n- Smart delay between messages\r\n- Easy to import in a script tag or as a React Component\r\n\r\n## 🔥 Promo: check out our other cool open source project\r\n\r\n<a href=\"https://github.com/botfront/botfront?utm_source=rasa_webchat\">\r\n<img align=\"center\" src=\"https://github.com/botfront/botfront/raw/master/botfront_animation.gif\" alt=\"demonstration\" width=\"100%\">\r\n</a>\r\n\r\n## Usage\r\n\r\n### In a `<script>` tag\r\n\r\nIn your `<body/>`:\r\n\r\n```html\r\n<script>\r\n  !(function () {\r\n    let e = document.createElement('script'),\r\n      t = document.head || document.getElementsByTagName('head')[0];\r\n    (e.src =\r\n      'https://cdn.jsdelivr.net/npm/@auroraai-bot-platform/rasa-webchat@latest/lib/index.js'),\r\n      // For specific version use 'https://cdn.jsdelivr.net/npm/@auroraai-bot-platform/rasa-webchat@x.x.x/lib/index.js' where replace the 'x.x.x' with the version that you want\r\n      (e.async = !0),\r\n      (e.onload = () => {\r\n        window.WebChat.default(\r\n          {\r\n            customData: { language: 'en' },\r\n            socketUrl: 'https://bf-botfront.development.agents.botfront.cloud',\r\n            profileAvatar: 'AVATARPATH',\r\n            accentColor: 'COLORCODE',\r\n            accentDarkColor: 'COLORCODE',\r\n            languageList: {},\r\n            // add other props here\r\n          },\r\n          null\r\n        );\r\n      }),\r\n      t.insertBefore(e, t.firstChild);\r\n  })();\r\n</script>\r\n```\r\n\r\n⚠️ Leave the version tag as 'latest' if you always want the latest version of the auroraai-bot-platform/rasa-webchat. But if you want to control when to update the widget, we recommend adding a version tag, e.g for version 1.0.0 'https://cdn.jsdelivr.net/npm/@auroraai-bot-platform/rasa-webchat@1.0.0/lib/index.js'\r\nThe available versions of the auroraai-bot-platform/rasa-webchat can be seen in https://www.npmjs.com/package/@auroraai-bot-platform/rasa-webchat?activeTab=versions.\r\n\r\nAbout images: `width` and `height` define the size in pixels that images in messages are crop-scaled to. If not present, the image will scale to the maximum width of the container and the image.\r\n\r\n### As a React component\r\n\r\nInstall the auroraai-bot-platform/rasa-webchat npm package\r\n\r\n```bash\r\nnpm install @auroraai-bot-platform/rasa-webchat\r\n```\r\n\r\nand to install a specific package version add '@' and version number to the end of the url\r\n\r\n```bash\r\nnpm install @auroraai-bot-platform/rasa-webchat@1.x.x\r\n```\r\n\r\nThen:\r\n\r\n```javascript\r\nimport Widget from '@auroraai-bot-platform/rasa-webchat';\r\n\r\nfunction CustomWidget = () => {\r\n  return (\r\n    <Widget\r\n      initPayload={\"/get_started\"}\r\n      socketUrl={\"http://localhost:5500\"}\r\n      socketPath={\"/socket.io/\"}\r\n      customData={{\"language\": \"en\"}} // arbitrary custom data. Stay minimal as this will be added to the socket\r\n      title={\"Title\"}\r\n      subtitle=\"\"\r\n      languageList={}\r\n    />\r\n  )\r\n}\r\n```\r\n\r\n## Parameters\r\n\r\n| Prop / Param              | Default value      | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |\r\n| ------------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\r\n| `initPayload`             | `null`             | Payload sent to Rasa when conversation starts                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |\r\n| `socketUrl`               | `null`             | Socket URL                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |\r\n| `socketPath`              | `null`             | Close the chat window                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |\r\n| `customData`              | `null`             | Arbitrary object sent with the socket. If using with Botfront, it must include the language (e.g. `{\"language\": \"en\"}`)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |\r\n| `docViewer`               | `false`            | If you add this prop to the component or to the init script, `docViewer=true` , this will treat links in received messages as links to a document ( `.pdf .doc .xlsx` etc. ) and will open them in a popup using `https://docs.google.com/viewer` service                                                                                                                                                                                                                                                                                                                                                                            |\r\n| `title`                   | `'Welcome\"`        | Title shown in the header of the widget                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |\r\n| `subtitle`                | `null`             | Subtitle shown under the title in the header of the widget                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |\r\n| `inputTextFieldHint`      | `\"Type a message\"` | User message input field placeholder                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |\r\n| `hideWhenNotConnected`    | `true`             | If `true` the widget will hide when the connection to the socket is lost                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |\r\n| `connectOn`               | `\"mount\"`          | This prop lets you choose when the widget will try connecting to the server. By default, it tries connecting as soon as it mounts. If you select `connectOn='open'` it will only attempt connection when the widget is opened. it can only take the values `mount` and `open`.                                                                                                                                                                                                                                                                                                                                                       |\r\n| `onSocketEvent`           | `null`             | call custom code on a specific socket event                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |\r\n| `embedded`                | `false`            | Set to `true` if you want to embed the in a web page. The widget will always be open and the `initPayload` will be triggered immediately                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |\r\n| `showFullScreenButton`    | `false`            | Show a full screen toggle                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |\r\n| `displayUnreadCount`      | `false`            | Path to an image displayed on the launcher when the widget is closed                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |\r\n| `showMessageDate`         | `false`            | Show message date. Can be overriden with a function: `(timestamp, message) => return 'my custom date'`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |\r\n| `customMessageDelay`      | See below          | This prop is a function, the function take a message string as an argument. The defined function will be called everytime a message is received and the returned value will be used as a milliseconds delay before displaying a new message.                                                                                                                                                                                                                                                                                                                                                                                         |\r\n| `params`                  | See below          | Essentially used to customize the image size, also used to change storage options.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |\r\n| `storage`                 | `\"local\"`          | ⚠️ This is not a prop, it has to be passed inside the params object above. <br> Specifies the storage location of the conversation state in the browser. `\"session\"` defines the state to be stored in the session storage. The session storage persists on reload of the page, and is cleared after the browser or tab is closed, or when `sessionStorage.clear()`is called. `\"local\"` defines the state to be stored in the local stoage. The local storage persists after the the browser is closed, and is cleared when the cookies of the browser are cleared, or when `localStorage.clear()`is called.                         |\r\n| `customComponent`         | `null`             | Custom component to be used with custom responses. E.g.: `customComponent={ (messageData) => (<div>Custom React component</div>)}`. Please note that this can only be used if you call the webchat from a React application as you can't write a component in pure Javscript.                                                                                                                                                                                                                                                                                                                                                        |\r\n| `onWidgetEvent`           | `{}`               | call custom code on a specific widget event ( `onChatOpen`, `onChatClose`, `onChatHidden`, are available for now ), add a function to the desired object property in the props to have it react to the event.                                                                                                                                                                                                                                                                                                                                                                                                                        |\r\n| `showMenuButton`          | `true`             | Show menu button in the header bar                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |\r\n| `languageList`            | `{}`               | Has the list of languages the webchat supports. The languages are shown in the menu view where the user can change them. The languageList needs to have the languages listed in a list, for example: '{ en: 'English', fi: 'Suomi', sv: 'Svensk' }'. The language needs to have the 2 letter ISO 639-1 standard country code and a name of the language, that will be shown in the webchat.                                                                                                                                                                                                                                          |\r\n| `automaticLanguageChange` | `true`             | Can be used to disable the automatic language change. By default this feature is on. When web page is refreshed, the webchats language is changed automatically to the web pages language (the language that is in the pages HTML element). The language is changed only if the page language exists in the languageList parameter. This makes sure that the webchat language is not changed to an unsupported language. Also the language is changed only if the user hasn't written anything to the chat, meaning that the conversation hasn't started. If the conversation is ongoing, the language is not changed automatically. |\r\n\r\n### Additional Examples\r\n\r\n##### `customMessageDelay`\r\n\r\n```javascript\r\n(message) => {\r\n  let delay = message.length * 30;\r\n  if (delay > 2 * 1000) delay = 3 * 1000;\r\n  if (delay < 400) delay = 1000;\r\n  return delay;\r\n};\r\n```\r\n\r\n##### `onSocketEvent`\r\n\r\n```jsx\r\nonSocketEvent={{\r\n  'bot_uttered': () => console.log('the bot said something'),\r\n  'connect': () => console.log('connection established'),\r\n  'disconnect': () => doSomeCleanup(),\r\n}}\r\n```\r\n\r\n##### `params`\r\n\r\nThe `params` props only allows to specify custom image dimensions:\r\n\r\n```jsx\r\nparams={{images: { dims: { width: 300, height: 200 }}}}\r\n```\r\n\r\n### Other features\r\n\r\n#### Setting of languages\r\n\r\nThe default language used in the webchat can be set with the CustomData parameter 'language' value.\r\n\r\n```jsx\r\ncustomData={{\"language\": \"en\"}}\r\n```\r\n\r\nor if the package is loaded using a script:\r\n\r\n```jsx\r\ncustomData = { language: 'en' };\r\n```\r\n\r\n- If the language is not set in CustomData parameter, the default language of the Botfront is then used.\r\n- If the Botfront doesn't have a default language, english ('en') will be used.\r\n\r\nThe language options that the webchat supports needs to be listed in the 'languageList' parameter. These languages will be listen in the webchat menu view that the chat user can open, and change the used language from there.\r\n\r\n```jsx\r\nlanguageList={{ en: \"English\", sv: \"Svensk\" }}\r\n```\r\n\r\nor if the package is loaded using a script\r\n\r\n```jsx\r\nlanguageList: { en: 'English', sv: 'Svensk' };\r\n```\r\n\r\nThe language translations of texts used in the webchat are added to the 'i18n/i18n.js' file.\r\n\r\nThe automatic language change feature is active by default. When web page is refreshed, the webchats language is changed automatically to the web pages language (the language that is in the pages HTML element). The language is changed only if:\r\n\r\n- The page language exists in the languageList parameter. This makes sure that the webchat language is not changed to an unsupported language.\r\n- The language is changed only if the user hasn't written anything to the chat, meaning that the conversation hasn't started. If the conversation is ongoing, the language is not changed automatically.\r\n\r\nThe automatic language change feature can be disabled by setting the parameter 'automaticLanguageChange' to false.\r\n\r\n#### Tooltips\r\n\r\nText messages received when the widget is closed will be shown as a tooltip.\r\n\r\n#### Sending a message on page load\r\n\r\nWhen reconnecting to an existing chat session, the bot will send a message contained in the localStorage key specified by the `NEXT_MESSAGE` constant. The message should be stringified JSON with a `message` property describing the message and an `expiry` property set to a UNIX timestamp in milliseconds after which this message should not be sent. This is useful if you would like your bot to be able to offer your user to navigate around the site.\r\n\r\n#### Sending a payload from your React app\r\n\r\n```jsx\r\nfunction myComponent() {\r\n  const webchatRef = useRef(null);\r\n\r\n  // triggered when something happens in your app\r\n  function callback() {\r\n    if (webchatRef.current && webchatRef.current.sendMessage) {\r\n      webchatRef.current.sendMessage('/myIntent{\"entityName\":\"value\"}');\r\n    }\r\n  }\r\n\r\n  return <RasaWebchat ref={webchatRef} />;\r\n}\r\n```\r\n\r\nThe payload can be any message that the user would normally send, but if you want to force an intent and maybe some entities, you can use that format\r\n`/myIntent{\"entity1\":\"value1\",\"entity2\":\"value2\"}`\r\n\r\n### Backends\r\n\r\nThe widget can be used with any backend but is primarily designed to be used with [Rasa](https://github.com/rasaHQ/rasa) or [Botfront](https://github.com/botfront/botfront).\r\n\r\n#### Rasa\r\n\r\nUse the `socketio` channel: See [instructions in the Rasa documentation](https://rasa.com/docs/core/connectors/#socketio-connector)\r\n\r\nIf you want to process `customData` in Rasa you have to [create a new channel](https://rasa.com/docs/core/connectors/#custom-channels). Use channel `rasa_core.channels.socketio` as a template for your new channel. In this channel, `customData` can be retrieved via `data['customData']`. Then you can modify `sender_id`, save `customData` to the database, fill slots or whatever you need to with your additional data.\r\n\r\n#### Botfront\r\n\r\nThe Rasa Webchat is developped by the [Botfront](https://botfront.io) team and it works with Botfront. If your bot is multilingual, make sure to specificy the current language in the `customData` prop. E.g. `customData={{language: 'en'}}`. See in [Botfront docs](https://botfront.io/docs/channels/webchat/) for more details.\r\n\r\n## Styles\r\n\r\nFrom version 0.8 we started prefixing all css classes, if you already had css styling for the widget, just prepend `rw-` to all the classes you changed.\r\n\r\nhierarchy:\r\n\r\n```\r\n.rw-conversation-container\r\n  |-- .rw-header\r\n        |-- .rw-title\r\n        |-- .rw-close-function\r\n        |-- .rw-loading\r\n  |-- .rw-messages-container\r\n        |-- .rw-message\r\n              |-- .rw-client\r\n              |-- .rw-response\r\n        |-- .rw-replies\r\n              |-- .rw-reply\r\n              |-- .rw-response\r\n        |-- .rw-snippet\r\n              |-- .rw-snippet-title\r\n              |-- .rw-snippet-details\r\n              |-- .rw-link\r\n        |-- .rw-imageFrame\r\n        |-- .rw-videoFrame\r\n  |-- .rw-sender\r\n        |-- .rw-new-message\r\n        |-- .rw-send\r\n```\r\n\r\n| Class                      | Description                                                        |\r\n| -------------------------- | ------------------------------------------------------------------ |\r\n| .rw-widget-container       | The div containing the chatbox of the default version              |\r\n| .rw-widget-embedded        | div of the embedded chatbox (using embedded prop)                  |\r\n| .rw-full-screen            | div of the fullscreen chatbox (using fullScreenMode prop)          |\r\n| .rw-conversation-container | the parent div containing the header, message-container and sender |\r\n| .rw-messages-container     | the central area where the messages appear                         |\r\n| .rw-sender                 | div of the bottom area which prompts user input                    |\r\n| .rw-new-message            | the text input element of sender                                   |\r\n| .rw-send                   | the send icon element of sender                                    |\r\n| .rw-header                 | div of the top area with the chatbox header                        |\r\n| .rw-title                  | the title element of the header                                    |\r\n| .rw-close-button           | the close icon of the header                                       |\r\n| .rw-loading                | the loading status element of the header                           |\r\n| .rw-message                | the boxes holding the messages of client and response              |\r\n| .rw-replies                | the area that gives quick reply options                            |\r\n| .rw-snippet                | a component for describing links                                   |\r\n| .rw-imageFrame             | a container for sending images                                     |\r\n| .rw-videoFrame             | a container for sending video                                      |\r\n\r\n## Original Rasa-webchat contributors\r\n\r\n[@PHLF](https://github.com/phlf)\r\n[@znat](https://github.com/znat)\r\n[@TheoTomalty](https://github.com/TheoTomalty)\r\n[@Hub4IT](https://github.com/Hub4IT)\r\n[@dliuproduction](https://github.com/dliuproduction)\r\n[@MatthieuJnon](https://github.com/MatthieuJnon)\r\n[@mofortin](https://github.com/mofortin)\r\n[@GuillaumeTech](https://github.com/GuillaumeTech)\r\n\r\n<br/>\r\n<h2 align=\"center\">License</h2>\r\n\r\nCopyright (C) 2021 Dialogue Technologies Inc.\r\n\r\nLicensed under the Apache License, Version 2.0 (the \"License\");\r\nyou may not use this file except in compliance with the License.\r\nYou may obtain a copy of the License at\r\n\r\n    http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nUnless required by applicable law or agreed to in writing, software\r\ndistributed under the License is distributed on an \"AS IS\" BASIS,\r\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\nSee the License for the specific language governing permissions and\r\nlimitations under the License.(C) 2021 Dialogue Technologies Inc. All rights reserved.\r\n","readmeFilename":"README.md"}