diff --git a/.github/workflows/bump-version.yaml b/.github/workflows/bump-version.yaml index 4db902b..7bbc02c 100644 --- a/.github/workflows/bump-version.yaml +++ b/.github/workflows/bump-version.yaml @@ -23,7 +23,7 @@ jobs: - name: Setup node uses: actions/setup-node@v3 with: - node-version: "16" + node-version: "18" - name: Bump version run: | @@ -52,4 +52,4 @@ jobs: git config user.email "actions@github.com" git add package.json dist/ git commit -m "Bump version to ${{ steps.get_version.outputs.version }}" - git push origin HEAD:v2 \ No newline at end of file + git push origin HEAD:v2 diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..a9d0873 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +18.19.0 diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/.prettierrc @@ -0,0 +1 @@ +{} diff --git a/README.md b/README.md index 22d71e8..8c898c7 100644 --- a/README.md +++ b/README.md @@ -2,15 +2,20 @@ Tarka Chat UI is a plug and play javascript library to integrate a chat assistant to your website in one line - ## Usage 1. Incude the following script (hosted in CDN) in your html - ``` - - ``` +``` + +``` +Include highcharts library to generate charts by highcharts + +``` + + +``` 2. Initialise the global `TarkaChat` component with options in any script tag @@ -22,6 +27,7 @@ TarkaChat.init({ themeColor: "#F0DAFB", selectorId: "chatbot", expand: true, + enableUpload: true, preChatRenderer: function (onClose) { // Return a DOM Node that can be attached to the chatbot UI // Use the onClose callback to close the pre-chat screen @@ -43,20 +49,92 @@ where, - [Optional] **title** is the title of the chatbot window - [Optional] **botName** will be displayed below each bot message - [Optional] **expand** opens the chat window in expanded mode on init when set to true, otherwise opens in collapse mode. Defaults to false. +- [Optional] **enableUpload** will show the option to upload a file when set to true. False by default - **greeting** will be the first message displayed on the chatbot when opened for the first time - **themeColor** will set the color scheme of the chat window - **selectorId** the DOM element selector (id) inside which the bot will be rendered - **submitHandler** this function will be called whenever a user types a message in the bot and submits - + Returned response from submitHandler should be one the below types: + + 1. _String_ + 2. One of the below objects: + + - _Text type:_ + + ``` + { + "type": "text", + "message": "MESSAGE" + } + ``` + + - _File type:_ + + ``` + { + "type": "file", + "link": "LINK_TO_FILE", + "name": "FILE_NAME", + } + ``` + + - _Image type:_ + + ``` + { + "type": "image", + "link": "LINK_TO_IMAGE", + "name": "IMAGE_NAME", + } + ``` + + - _HighCharts config type:_ + + ``` + { + "type": "highchart-config", + "high_chart_config": { highcharts_config_obj } + } + ``` + + - _Table type:_ + + ``` + { + "type": "table", + "table_data": { "header":[],"rows":[{}] } + } + ``` + + 3. _Array containing one/multiple of above mentioned types:_ + E.g. + + ``` + [ + { + "type": "text", + "message": "MESSAGE" + }, + { + "type": "file", + "link": "LINK_TO_FILE", + "name": "FILE_NAME", + } + ] + ``` ## Demo Demo is deployed from the application code in `demo/` folder. Link: https://tarkalabs.github.io/tarka-chat/demo/ +## Dev notes + +If you wanted to run this code in your local for development purposes, Run the following command from project root folder `yarn dev` and open `dev/index.html` in your browser to see the chat window. Your local changes will be hot reloaded + ## Old versions -* v1.1 : https://d1fmfone96g0x2.cloudfront.net/tarka-chat-1.1.umd.js -* v1.0 : https://d1fmfone96g0x2.cloudfront.net/tarka-chat-1.1.umd.js +- v1.1 : https://d1fmfone96g0x2.cloudfront.net/tarka-chat-1.1.umd.js +- v1.0 : https://d1fmfone96g0x2.cloudfront.net/tarka-chat-1.1.umd.js Check [release notes](RELEASE.md) for details diff --git a/RELEASE.md b/RELEASE.md deleted file mode 100644 index 69c6576..0000000 --- a/RELEASE.md +++ /dev/null @@ -1,5 +0,0 @@ -# v1.1 -- Fixed the issue #18 where the chat window does not render correctly in mobile view - -# v1.0 -Initial version diff --git a/demo/index.html b/demo/index.html index 96f126c..2527c18 100644 --- a/demo/index.html +++ b/demo/index.html @@ -12,8 +12,10 @@ } + + - +