Skip to content

Commit 7859b91

Browse files
committed
docs: Update docs
1 parent 7633aae commit 7859b91

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

docs/api/hooks.md

+13-10
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ The `useMessages` hook allows you to track and manage the chatbot's messages.
270270
| endStreamMessage | `async function` | A utility function used to indicate the end of an existing message stream, identical to `params.endMessageStream` detailed [**here**](/docs/api/params#endstreammessage). |
271271
| removeMessage | `async function` | A utility function used to remove a message from the chat, identical to `params.removeMessage` detailed [**here**](/docs/api/params#removemessage). |
272272
| messages | `Array<Message>` | Array containing all messages currently shown in the chatbot. |
273-
| setMessages | `function` | Setter for manipulating messages array directly, **not recommended** to use this so proceed with caution. |
273+
| replaceMessages | `function` | Directly replaces the current messages with provided messages. |
274274

275275
#### Code Example
276276
```jsx
@@ -328,7 +328,7 @@ The `usePaths` hook allows you to track and manage the chatbot's paths.
328328
| getPrevPath | `function` | Retrieves the previous path of the user. |
329329
| goToPath | `function` | Sends the user to a specified path, identical to `params.goToPath` detailed [**here**](/docs/api/params#gotopath). |
330330
| paths | `Array<string>` | Array containing all paths the user has taken in order. |
331-
| setPaths | `function` | Setter for manipulating paths array directly, **not recommended** to use this so proceed with caution. |
331+
| replacePaths | `function` | Directly replaces the current paths with provided paths (hardly a reason to do this, think twice). |
332332

333333
#### Code Example
334334
```jsx
@@ -358,19 +358,21 @@ The `useSettings` hook allows you to track and manage the chatbot's settings.
358358
| Name | Type | Description |
359359
| ------------------- | ----------- | -------------------------------------------------------- |
360360
| settings | `Settings` | Represents the current settings of the chatbot. |
361-
| setSettings | `function` | Setter for manipulating bot settings. |
361+
| replaceSettings | `function` | Directly replaces the current settings with provided settings. |
362+
| updateSettings | `function` | Modifies and merges the provided settings with existing settings. |
362363

363364
#### Code Example
364365
```jsx
365366
import { useEffect } from "react";
366367
import { useSettings } from "react-chatbotify";
367368

368369
const MyNestedComponent = () => {
369-
const { settings } = useSettings();
370+
const { settings, updateSettings } = useSettings();
370371

371372
useEffect(() => {
372373
if (settings.general?.embedded) {
373-
// do something if chatbot is embedded
374+
// disable audio if chatbot is embedded
375+
updateSettings({audio: {disabled: false}})
374376
}
375377
}, [])
376378

@@ -389,19 +391,20 @@ The `useStyles` hook allows you to track and manage the chatbot's styles.
389391
| Name | Type | Description |
390392
| ------------------- | ----------- | -------------------------------------------------------- |
391393
| styles | `Styles` | Represents the current styles of the chatbot. |
392-
| setStyles | `function` | Setter for manipulating bot styles. |
394+
| replaceStyles | `function` | Directly replaces the current styles with provided styles. |
395+
| updateStyles | `function` | Modifies and merges the provided styles with existing styles. |
393396

394397
#### Code Example
395398
```jsx
396399
import { useEffect } from "react";
397400
import { useStyles } from "react-chatbotify";
398401

399402
const MyNestedComponent = () => {
400-
const { styles, setStyles } = useStyles();
403+
const { updateStyles } = useStyles();
401404

402405
useEffect(() => {
403-
// set header style
404-
setStyles({...styles, headerStyle: {background: "red"}})
406+
// update header style
407+
updateStyles({headerStyle: {background: "red"}})
405408
}, [])
406409

407410
return (
@@ -456,7 +459,7 @@ The `useToasts` hook allows you to track and manage the chatbot's toasts.
456459
| showToast | `function` | Shows a toast in chat, identical to `params.showToast` detailed [**here**](/docs/api/params#showtoast). |
457460
| dismissToast | `function` | Dismisses a toast from chat, identical to `params.dismissToast` detailed [**here**](/docs/api/params#dismisstoast). |
458461
| toasts | `Array<Toast>` | Array containing all toasts currently shown in the chatbot |
459-
| setToasts | `function` | Setter for manipulating toasts array directly, **not recommended** to use this so proceed with caution. |
462+
| replaceToasts | `function` | Directly replaces the current toasts with provided toasts. |
460463

461464
#### Code Example
462465
```jsx

docs/api/settings.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ const DefaultSettings: Settings = {
149149
background: "linear-gradient(to right, #42b0c5, #491d8d)",
150150
}}
151151
>
152-
<ChatIcon style={{ width: "80%", height: "80%" }} />
152+
<ChatIcon style={{ width: "80%", height: "80%", fill: "#fff" }} />
153153
</div>
154154
<span key={2} style={{fontWeight: "bold"}}> React ChatBotify</span>
155155
</div>

0 commit comments

Comments
 (0)