Skip to content

Feature/#87361 delete all conversations in history #80

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 57 commits into from
Mar 27, 2025
Merged
Show file tree
Hide file tree
Changes from 46 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
408542f
feat: #87361 add modal component and previous conversations options U…
vj-venkatesan Mar 17, 2025
221d92d
feat: #87361 delete confirmation modal integration
vj-venkatesan Mar 17, 2025
987cb0d
refactor: improve code formatting and structure in various components
vj-venkatesan Mar 17, 2025
fdfafba
feat: add confirmation message for deleting all conversations
vj-venkatesan Mar 17, 2025
32c293b
fix: correct formatting in webchat-config and PreviousConversationsOp…
vj-venkatesan Mar 17, 2025
bc044be
feat: add fade transition and overlay for modal component
vj-venkatesan Mar 17, 2025
cd76268
refactor: remove unused Divider components from PreviousConversations…
vj-venkatesan Mar 17, 2025
71de938
refactor: simplify PreviousConversationsOptions component props and e…
vj-venkatesan Mar 17, 2025
94fc3c1
refactor: clean up imports and simplify DeleteButton styled component
vj-venkatesan Mar 18, 2025
f121a25
feat: add aria-labels for accessibility in PreviousConversationsOptio…
vj-venkatesan Mar 18, 2025
fb46be9
refactor: enhance type safety in mapDispatch for PreviousConversation…
vj-venkatesan Mar 18, 2025
9f7f0ce
refactor: remove unused AppDispatch import in PreviousConversationsOp…
vj-venkatesan Mar 18, 2025
d661b24
feat: add custom translations for conversation options in webchat set…
vj-venkatesan Mar 18, 2025
78f4d68
refactor: replace connect with hooks in PreviousConversationsOptions …
vj-venkatesan Mar 18, 2025
7109845
feat: update delete confirmation title with custom translations in Pr…
vj-venkatesan Mar 18, 2025
74485b0
fix: correct translation key from 'delete_anyways' to 'delete_anyway'…
vj-venkatesan Mar 18, 2025
a56f89f
feat: enhance chat options visibility logic by incorporating previous…
vj-venkatesan Mar 18, 2025
1924fa3
fix: improve accessibility by adding aria labels to modal close and d…
vj-venkatesan Mar 18, 2025
403f7f9
feat: add keyboard accessibility to modal and improve styling in Prev…
vj-venkatesan Mar 18, 2025
33522e7
fix: update webchat endpoint to use development environment
vj-venkatesan Mar 18, 2025
9c8ad01
fix: remove unused eslint-loader dependency from package.json
vj-venkatesan Mar 18, 2025
ef15492
Update docs/embedding.md
vj-venkatesan Mar 18, 2025
2219750
fix: remove unused import
vj-venkatesan Mar 18, 2025
8c44fdf
fix: incorrect spelling
vj-venkatesan Mar 18, 2025
5ffac93
fix: correct spelling in embedding documentation and clean up imports…
vj-venkatesan Mar 18, 2025
aa31aaf
fix: update confirmation message for deleting all conversations in do…
vj-venkatesan Mar 19, 2025
dc57143
fix: order or translation strings
vj-venkatesan Mar 19, 2025
a487364
feat: add delete conversation functionality and enhance conversation …
vj-venkatesan Mar 18, 2025
2e41858
fix: wording changes as per product requirement
vj-venkatesan Mar 19, 2025
9a9e551
fix: formatting
vj-venkatesan Mar 19, 2025
c2a166f
refactor: PR suggestions
vj-venkatesan Mar 20, 2025
78339ca
feat: update modal component and documentation for new CSS classes
vj-venkatesan Mar 20, 2025
fd5c859
fix: return keyboard focus to delete button
vj-venkatesan Mar 20, 2025
75987e2
feat: add custom color options for delete and cancel buttons in webch…
vj-venkatesan Mar 20, 2025
fcf2a6c
fix: accessibilit, css class names and color changes
vj-venkatesan Mar 21, 2025
de0d6de
feat: modify delete all conversations functionality with confirmation…
vj-venkatesan Mar 21, 2025
3f8892c
feat: update delete conversation functionality with improved state ma…
vj-venkatesan Mar 24, 2025
6bbb7bf
feat: enhance delete confirmation modal with customizable button colo…
vj-venkatesan Mar 24, 2025
8a7bcaa
feat: add detailed CSS customization options for modal and delete con…
vj-venkatesan Mar 24, 2025
909964b
feat: add force focus utility and integrate it with delete all conver…
vj-venkatesan Mar 24, 2025
0ef08fe
refactor: remove redundant comments in forceFocus utility for cleaner…
vj-venkatesan Mar 24, 2025
0ae2a82
Merge branch 'main' into feature/#87361-delete-previous-conversations
vj-venkatesan Mar 26, 2025
c3f8833
Fix typo in enableDeleteConversations property name in embedding docu…
vj-venkatesan Mar 26, 2025
e202f82
Update prettierignore to exclude JavaScript files and adjust modal ma…
vj-venkatesan Mar 26, 2025
06301e2
Fix indentation in webchat test HTML file
vj-venkatesan Mar 26, 2025
22fabfc
Update delete button description in documentation and modify CLEAR_ME…
vj-venkatesan Mar 26, 2025
7ffdbf0
Update src/webchat-ui/components/Modal/DeleteConfirmModal.tsx
vj-venkatesan Mar 26, 2025
74df7bc
Remove documentation for webchat delete conversation container
vj-venkatesan Mar 26, 2025
a30b81d
Update delete conversation modal and documentation for consistency
vj-venkatesan Mar 26, 2025
bbf87bb
Enhance HeaderIconButton styles to ensure consistent icon color appli…
vj-venkatesan Mar 26, 2025
de15bcf
Refactor DeleteAllConversationsModal rendering for improved state man…
vj-venkatesan Mar 26, 2025
80255ae
Refactor modal and delete conversation button styles for improved res…
vj-venkatesan Mar 26, 2025
75de376
Implement session management on conversation deletion by dispatching …
vj-venkatesan Mar 26, 2025
c8a6964
Refactor DeleteAllConversationsModal to handle focus management and c…
vj-venkatesan Mar 26, 2025
f4dd63a
Refactor DeleteConfirmModal and Modal components to improve focus man…
vj-venkatesan Mar 26, 2025
0d3e733
Refactor ConversationsList and ConversationsListItem components for i…
vj-venkatesan Mar 26, 2025
7449ab2
Refactor DeleteConversation and DeleteAllConversations components to …
vj-venkatesan Mar 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dist
dist/**/*.js
node_modules
coverage
alias
12 changes: 6 additions & 6 deletions dist/webchat.test.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<html>
<title>Webchat Test</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<body>
<script src="./webchat.js"></script>
<script src="./plugin.test.js"></script>
</body>
<title>Webchat Test</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<body>
<script src="./webchat.js"></script>
<script src="./plugin.test.js"></script>
</body>
</html>
195 changes: 195 additions & 0 deletions docs/css-customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,23 @@ There are several classes that you need to take in consideration if you want to
- _webchat-input-persistent-menu_
- _webchat-input-persistent-menu-item_
- _webchat-input-persistent-menu-item-container_
- _webchat-modal-root_
- _webchat-modal-header_
- _webchat-modal-title_
- _webchat-modal-close-button_
- _webchat-modal-close-icon_
- _webchat-modal-divider-wrapper_
- _webchat-modal-divider_
- _webchat-modal-body_
- _webchat-modal-footer_
- _webchat-delete-conversation-container_
- _webchat-delete-conversation-title_
- _webchat-delete-conversation-button_
- _webchat-delete-conversation-cancel-button_
- _webchat-delete-conversation-confirm-button_
- _webchat-delete-conversation-text_
- _webchat-delete-all-conversation-text_
- _webchat-header-delete-all-conversations-button_

If you want to be sure that the custom CSS that you apply will be shown, you will have to add some other selectors to those classes, for the Webchat we will use the attribute selectors:

Expand Down Expand Up @@ -1284,3 +1301,181 @@ The frame that adds the "card styles" such as background-color or box-shadow.
margin: 5px;
}
```

### Modal and Delete Conversation

- _webchat-modal-root_
The root container for modals. You can customize the overall appearance of modal windows.

```CSS
[data-cognigy-webchat-root] .webchat-modal-root {
background-color: rgba(0, 0, 0, 0.5);
padding: 20px;
border-radius: 8px;
}
```

- _webchat-modal-header_
The header section of modal windows.

```CSS
[data-cognigy-webchat-root] .webchat-modal-header {
background-color: #f5f5f5;
padding: 10px;
border-bottom: 1px solid #ddd;
}
```

- _webchat-modal-title_
The title text in modal headers.

```CSS
[data-cognigy-webchat-root] .webchat-modal-title {
font-size: 18px;
color: #333;
font-weight: bold;
}
```

- _webchat-modal-close-button_
The close button in modal headers.

```CSS
[data-cognigy-webchat-root] .webchat-modal-close-button {
background-color: transparent;
border: none;
color: #666;
}
```

- _webchat-modal-close-icon_
The icon within the modal close button.

```CSS
[data-cognigy-webchat-root] .webchat-modal-close-icon {
font-size: 20px;
color: #666;
}
```

- _webchat-modal-divider-wrapper_
The wrapper for modal dividers.

```CSS
[data-cognigy-webchat-root] .webchat-modal-divider-wrapper {
padding: 10px 0;
}
```

- _webchat-modal-divider_
The divider line in modals.

```CSS
[data-cognigy-webchat-root] .webchat-modal-divider {
border-top: 1px solid #ddd;
}
```

- _webchat-modal-body_
The main content area of modals.

```CSS
[data-cognigy-webchat-root] .webchat-modal-body {
padding: 15px;
background-color: white;
}
```

- _webchat-modal-footer_
The footer section of modals.

```CSS
[data-cognigy-webchat-root] .webchat-modal-footer {
padding: 10px;
background-color: #f5f5f5;
border-top: 1px solid #ddd;
}
```

- _webchat-delete-conversation-container_
The container for delete conversation confirmation dialog.

```CSS
[data-cognigy-webchat-root] .webchat-delete-conversation-container {
padding: 20px;
text-align: center;
}
```

- _webchat-delete-conversation-title_
The title in delete conversation dialog.

```CSS
[data-cognigy-webchat-root] .webchat-delete-conversation-title {
font-size: 16px;
font-weight: bold;
color: #333;
}
```

- _webchat-delete-conversation-button_
The delete button style inside the chat options screen.

```CSS
[data-cognigy-webchat-root] .webchat-delete-conversation-button {
padding: 8px 16px;
margin: 5px;
border-radius: 4px;
}
```

- _webchat-delete-conversation-cancel-button_
The cancel button in delete dialog.

```CSS
[data-cognigy-webchat-root] .webchat-delete-conversation-cancel-button {
background-color: #f5f5f5;
color: #333;
}
```

- _webchat-delete-conversation-confirm-button_
The confirm button in delete dialog.

```CSS
[data-cognigy-webchat-root] .webchat-delete-conversation-confirm-button {
background-color: #dc3545;
color: white;
}
```

- _webchat-delete-conversation-text_
The warning text in delete conversation dialog.

```CSS
[data-cognigy-webchat-root] .webchat-delete-conversation-text {
color: #666;
margin: 10px 0;
}
```

- _webchat-delete-all-conversation-text_
The warning text for deleting all conversations.

```CSS
[data-cognigy-webchat-root] .webchat-delete-all-conversation-text {
color: #dc3545;
font-weight: bold;
}
```

- _webchat-header-delete-all-conversations-button_
The button to delete all conversations in the header.

```CSS
[data-cognigy-webchat-root] .webchat-header-delete-all-conversations-button {
background-color: transparent;
color: #666;
border: none;
}
```
64 changes: 42 additions & 22 deletions docs/embedding.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,12 +230,13 @@ All business hours settings require the setting `embeddingConfiguration.awaitEnd

##### Previous Conversations

| Name | Type | Default | Description |
| ------------------------------ | ------- | -------------------------- | --------------------------------------------------------------------------- |
| enabled | boolean | `true` | If enabled, the "Previous Conversations" button is shown on the Home Screen |
| startNewConversationButtonText | string | `"Start new conversation"` | Configure the text shown on the "Start new conversation" button |
| buttonText | string | `"Previous conversations"` | Configure the "Previous Conversations" button |
| title | string | `""` | Configure the Header of the "Previous Conversations" page |
| Name | Type | Default | Description |
| ------------------------------ | ------- | -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| enabled | boolean | `true` | If enabled, the "Previous Conversations" button is shown on the Home Screen |
| startNewConversationButtonText | string | `"Start new conversation"` | Configure the text shown on the "Start new conversation" button |
| buttonText | string | `"Previous conversations"` | Configure the "Previous Conversations" button |
| title | string | `""` | Configure the Header of the "Previous Conversations" page |
| enableDeleteAllConversations | boolean | `false` | If enabled, a delete button is provided in previous conversations screen. This button can be used to delete all conversations. Confirmation is required before the delete operation |

##### Conversation Starters

Expand Down Expand Up @@ -264,16 +265,17 @@ All business hours settings require the setting `embeddingConfiguration.awaitEnd

#### Chat Options

| Name | Type | Default | Description |
| ----------------- | ------- | ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| enabled | boolean | `false` | Enable Chat Options Feature |
| title | string | `"Chat options"` | Chat Options header title |
| quickReplyOptions | object | [Quick Reply Options](#quick-reply-options) | Configure the Quick Reply section in the Chat Options |
| showTTSToggle | boolean | `false` | Enable to show the Text-to-Speech Toggle |
| activateTTSToggle | boolean | `true` | Activate Text-to-Speech Toggle by default. It also requires `behavior.enableTTS` setting to be `true` to make TTS active. |
| labelTTSToggle | string | `"Enable text-to-speech"` | Label for the Text-to-Speech toggle |
| rating | object | [Rating Section](#chat-options-rating-section) | Configure the Rating Section |
| footer | object | [Footer](#chat-options-footer) | Configure the Footer |
| Name | Type | Default | Description |
| ------------------------ | ------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| enabled | boolean | `false` | Enable Chat Options Feature |
| title | string | `"Chat options"` | Chat Options header title |
| quickReplyOptions | object | [Quick Reply Options](#quick-reply-options) | Configure the Quick Reply section in the Chat Options |
| showTTSToggle | boolean | `false` | Enable to show the Text-to-Speech Toggle |
| activateTTSToggle | boolean | `true` | Activate Text-to-Speech Toggle by default. It also requires `behavior.enableTTS` setting to be `true` to make TTS active. |
| labelTTSToggle | string | `"Enable text-to-speech"` | Label for the Text-to-Speech toggle |
| rating | object | [Rating Section](#chat-options-rating-section) | Configure the Rating Section |
| enableDeleteConversation | boolean | `false` | If enabled, a delete button is provided in chat options screen. This button can be used to delete current conversations. Confirmation is required before the delete operation |
| footer | object | [Footer](#chat-options-footer) | Configure the Footer |

##### Quick Reply Options

Expand Down Expand Up @@ -403,12 +405,20 @@ _These settings are NOT configurable via the Endpoint Editor in Cognigy.AI_

#### Custom Translations

| Name | Type | Default |
| ------------- | ------ | ----------------------- |
| Network error | string | "Connection Lost" |
| No network | string | "No network connection" |
| Reconnecting | string | "Reconnecting..." |
| Reconnect | string | "Reconnect" |
| Name | Type | Default |
| ------------------------------------- | ------ | ------------------------------------------------------------------------------------------- |
| Network error | string | "Connection Lost" |
| No network | string | "No network connection" |
| Reconnecting | string | "Reconnecting..." |
| Reconnect | string | "Reconnect" |
| coversations_options | string | "Conversations Options" |
| delete_all_conversations | string | "Delete all conversations" |
| delete_all_conversations_confirmation | string | "Are you sure you want to delete all previous conversations? This action cannot be undone." |
| delete_conversation | string | "Delete Conversation" |
| delete_conversation_confirmation | string | "Are you sure you want to delete this conversation? This action cannot be undone" |
| delete | string | "Delete" |
| delete_anyway | string | "Delete anyway" |
| cancel | string | "Cancel" |

#### Settings Interface

Expand Down Expand Up @@ -511,6 +521,7 @@ interface IWebchatSettings {
startConversationButtonText: string;
previousConversations: {
enabled: boolean;
enableDeleteAllConversations: boolean;
buttonText: string;
title: string;
};
Expand Down Expand Up @@ -561,6 +572,7 @@ interface IWebchatSettings {
submitButtonText: string;
eventBannerText: string;
};
enableDeleteConversation: boolean;
footer: {
enabled: boolean;
items: {
Expand Down Expand Up @@ -612,6 +624,14 @@ interface IWebchatSettings {
no_network: string;
reconnecting: string;
reconnect: string;
conversations_options: string;
delete_all_conversations: string;
delete_all_conversations_confirmation: string;
delete_conversation: string;
delete_conversation_confirmation: string;
delete: string;
delete_anyway: string;
cancel: string;
};

// Additional Settings to configure the webchat widget behavior
Expand Down
1 change: 1 addition & 0 deletions src/common/interfaces/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export interface IBaseMessage {

export interface IUserMessage extends IBaseMessage {
source: "user";
id: string;
}

export interface IBotMessage extends IBaseMessage {
Expand Down
14 changes: 14 additions & 0 deletions src/common/interfaces/webchat-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ export interface IWebchatSettings {
startConversationButtonText: string;
previousConversations: {
startNewConversationButtonText: string;
enableDeleteAllConversations?: boolean;
enabled: boolean;
buttonText: string;
title: string;
Expand Down Expand Up @@ -272,6 +273,7 @@ export interface IWebchatSettings {
submitButtonText: string;
eventBannerText: string;
};
enableDeleteConversation?: boolean;
footer: {
enabled: boolean;
items: {
Expand All @@ -295,11 +297,23 @@ export interface IWebchatSettings {
text: string;
title: string;
};
customColors: {
deleteButtonColor: string; // #E55050
cancelButtonColor: string; // #CCCCCC
deleteAllConversationIconColor: string; //#1A1A1A
};
customTranslations?: {
network_error: string;
no_network: string;
reconnect: string;
reconnecting: string;
delete_all_conversations: string;
delete_all_conversations_confirmation: string;
delete_conversation: string;
delete_conversation_confirmation: string;
delete: string;
delete_anyway: string;
cancel: string;
};
demoWebchat: {
enabled: boolean;
Expand Down
3 changes: 3 additions & 0 deletions src/webchat-ui/assets/bin-16px.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading