Skip to content

Commit c3d207d

Browse files
committed
docs: Update documentation for v2
1 parent 342271e commit c3d207d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1163
-738
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ React ChatBotify Docs offer the following notable features:
4040
- **Live Examples:** A slew of examples curated to fit common use cases are present, complete with live editors for experimentation.
4141
- **API Documentation:** API for the chatbot are clearly documented in tables for easy reference.
4242

43-
These features, **along with many others**, help provide a highly robust user guide to aid in the usage of [React ChatBotify](https://react-chatbotify.tjtanjin.com).
43+
These features, **along with many others**, help provide a highly robust user guide to aid in the usage of [React ChatBotify](https://react-chatbotify.com).
4444

4545
### Technologies
4646
Technologies used by React ChatBotify Docs are as below:

docs/api/_category_.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"label": "API",
3-
"position": 2
3+
"position": 3
44
}

docs/api/attributes.md

+16-15
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
2-
sidebar_position: 2
2+
sidebar_position: 1
33
title: Attributes
44
description: api documentation for attributes
55
keywords: [react, chat, chatbot, chatbotify]
66
---
77

88
# Attributes
99

10-
This page documents all the attributes that may be used in a conversation [**Block**](/docs/introduction/Conversations#block). Note that the 6 dynamic attributes `message`, `render`, `function`, `file`, `transition` and `path` are able to accept [**Params**](/docs/introduction/Conversations#params) as documented [**here**](/docs/api/params). For an example on how to use these attributes, you may refer to the sample flow in the dropdown below.
10+
This page documents all the attributes that may be used in a conversation [**Block**](/docs/introduction/Conversations#block). Take note that [**Attributes**](/docs/introduction/conversations#attributes) are divided into **pre-processing** and **post-processing** as listed in the tables below. For a brief example on the usage of attributes, you may refer to the **sample flow** in the dropdown which uses `message` and `path`.
1111

1212
<details>
1313
<summary>Click to view sample flow</summary>
@@ -29,24 +29,25 @@ const flow = {
2929

3030
Below is the list of available pre-processing attributes (processed upon entering a block and before user input).
3131

32-
| Name | Type | Dynamic | Description |
33-
|----------------|----------------------------------------------------|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
34-
| message | string \| function | Yes | Message sent by the bot to the user - if using function, it can be passed `params`. |
35-
| options | array | No | An array of options that the bot presents to the user to choose from. |
36-
| checkboxes | object | No | An object containing the following 3 properties: <ul><li>`items`:</li> (required) array of choices that the bot presents to the user to select from.<li>`max`:</li> (optional) maximum number of allowed selections, defaults to `all` if not specified<li>`min`:</li> (optional) minimum number of allowed selections, defaults to `1` if not specified</ul>
37-
| render | JSX.Element \| function | Yes | Custom component to render in the chat window to the user - if using function, it can be passed `params`. |
38-
| chatDisabled | boolean | No | Boolean indicating whether chat input is to be enabled or disabled in this block (overrides the `chatInput` section under [**Configurations**](/docs/api/bot_options#chatinput)). |
39-
| transition | object \| function | Yes | An object (or function returning an object) containing the following 2 properties: <ul><li>`duration`:</li> (required) duration in milliseconds before the post-process attributes of a block are ran (auto-transition)<li>`interruptable`:</li> (optional) boolean indicating if user input will halt this auto-transition, defaults to `false` if not specified</ul> If using function, it can be passed `params`. |
32+
| Name | Type | Description |
33+
|--------------|---------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
34+
| message | string \| function | Message sent by the bot to the user - if using function, it can be passed `params`. |
35+
| options | array | An array of options that the bot presents to the user to choose from. |
36+
| checkboxes | object | An object containing the following 3 properties: <ul><li>`items`:</li> (required) array of choices that the bot presents to the user to select from.<li>`max`:</li> (optional) maximum number of allowed selections, defaults to `all` if not specified<li>`min`:</li> (optional) minimum number of allowed selections, defaults to `1` if not specified</ul> |
37+
| component | JSX.Element \| function | Custom component to render in the chat window to the user - if using function, it can be passed `params`. |
38+
| isSensitive | boolean | Boolean indicating whether chat input is sensitive and needs to be masked. |
39+
| chatDisabled | boolean | Boolean indicating whether chat input is to be enabled or disabled in this block (overrides the `chatInput` section under [**Configurations**](/docs/api/settings#chatinput)). |
40+
| transition | object \| function | An object (or function returning an object) containing the following 2 properties: <ul><li>`duration`:</li> (required) duration in milliseconds before the post-process attributes of a block are ran (auto-transition)<li>`interruptable`:</li> (optional) boolean indicating if user input will halt this auto-transition, defaults to `false` if not specified</ul> If using function, it can be passed `params`. |
4041

4142
## Post-processing Attributes
4243

4344
Below is the list of available pre-processing attributes (processed upon user input and before exiting a block).
4445

45-
| Name | Type | Dynamic | Description |
46-
|----------------|---------------------------------------------|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
47-
| function | function | Yes | Function that runs after a user input (can be passed `params`) |
48-
| file | function | Yes | Function that runs after file upload (can be passed `params`). |
49-
| path | string \| function | Yes | Path to navigate to after processing this block - if using function, it can be passed `params`. |
46+
| Name | Type | Description |
47+
|----------|---------------------|----------------------------------------------------------------------------------------------------------|
48+
| function | function | Function that runs after a user input (can be passed `params`) |
49+
| file | function | Function that runs after file upload (can be passed `params`). |
50+
| path | string \| function | Path to navigate to after processing this block - if using function, it can be passed `params`. |
5051

5152
:::tip Tip
5253

docs/api/params.md

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
---
2-
sidebar_position: 3
2+
sidebar_position: 2
33
title: Params
44
description: api documentation for params
55
keywords: [react, chat, chatbot, chatbotify]
66
---
77

88
# Params
99

10-
This page documents all the attributes that may be used in a dynamic [**Attribute**](/docs/introduction/Conversations#attributes).
10+
This page documents all the attributes that may be used in an [**Attribute**](/docs/concepts/conversations#attributes).
1111

1212
## Parameters
1313

14-
The following table provides details about the parameters available for dynamic attributes.
14+
The following table provides details about the parameters available for attributes.
1515

1616
| Name | Type | Availability | Description |
1717
|---------------|---------------------------------------|--------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
18-
| userInput | string | All Dynamic Attributes | A string representing the user's input in the chat. |
19-
| prevPath | string | All Dynamic Attributes | A string representing the previous path in the chat (can be null if not found). |
20-
| injectMessage | async function | All Dynamic Attributes | A utility function used to inject a message into the chat which takes in 3 properties as represented by the [**Message**](/docs/introduction/conversations#message) type. | |
21-
| streamMessage | async function | All Dynamic Attributes | A utility function used to stream messages into the chat which takes in 3 properties as represented by the [**Message**](/docs/introduction/conversations#message) type and you may refer to [**this example**](/docs/examples/real_time_stream) for more details. | |
22-
| openChat | function | All Dynamic Attributes | A utility function used to control the visibility of the chat component. It takes one parameter: <ul><li>`isOpen`:</li> A boolean indicating whether the chat should be opened (`true`) or closed (`false`).</ul> |
18+
| userInput | string | All Attributes | A string representing the user's input in the chat. |
19+
| prevPath | string | All Attributes | A string representing the previous path in the chat (can be null if not found). |
20+
| goToPath | function | All Attributes | A utility function for immediately pathing to another block. |
21+
| injectMessage | async function | All Attributes | A utility function used to inject a message into the chat which takes in 3 properties as represented by the [**Message**](/docs/introduction/conversations#message) type. | |
22+
| streamMessage | async function | All Attributes | A utility function used to stream messages into the chat which takes in 3 properties as represented by the [**Message**](/docs/introduction/conversations#message) type and you may refer to [**this example**](/docs/examples/real_time_stream) for more details. | |
23+
| openChat | function | All Attributes | A utility function used to control the visibility of the chat component. It takes one parameter: <ul><li>`isOpen`:</li> A boolean indicating whether the chat should be opened (`true`) or closed (`false`).</ul> |
2324
| files | FileList | Only `file` Attribute | A list of file(s) uploaded by the user.
2425

2526
:::caution Caution

0 commit comments

Comments
 (0)