mirror of
https://github.com/nomadic-labs/safesupport-chatbox
synced 2025-12-16 15:33:23 +00:00
Compare commits
3 Commits
dependabot
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8e6f80326b | ||
|
|
f95aef64d0 | ||
|
|
a91ca1a092 |
@@ -23,6 +23,7 @@ Built on:
|
||||
exitMessage: 'The chat is closed. You may close this window.',
|
||||
chatUnavailableMessage: 'The chat service is not available right now. Please try again later.',
|
||||
anonymousDisplayName: 'Anonymous',
|
||||
enableEncryption: 'yes',
|
||||
}
|
||||
|
||||
EmbeddableChatbox.mount(config);
|
||||
@@ -41,6 +42,7 @@ Options:
|
||||
| `exitMessage` (optional) | Text to show if the user rejects the Terms of Use. | `The chat is closed. You may close this window.` |
|
||||
| `anonymousDisplayName` (optional) | The display name for the chat user. | `Anonymous` |
|
||||
| `chatUnavailableMessage` (optional) | Text to show if no-one is available to respond | `The chat service is not available right now. Please try again later.` |
|
||||
| `enableEncryption` (optional) | if set to "yes" then the chat will be encrypted by default | `yes` |
|
||||
|
||||
## Feature list
|
||||
|
||||
@@ -80,7 +82,7 @@ You can try this out on the [live demo](https://nomadic-labs.github.io/safesuppo
|
||||
|
||||
Clone the project:
|
||||
```
|
||||
git clone https://github.com/nomadic-labs/safesupport-chatbox.git
|
||||
git clone https://git.umycode.com/dave/safesupport-chatbox.git
|
||||
```
|
||||
Install the dependencies:
|
||||
```
|
||||
|
||||
12
dist/bookmarklet.js
vendored
12
dist/bookmarklet.js
vendored
File diff suppressed because one or more lines are too long
12
dist/chatbox.js
vendored
12
dist/chatbox.js
vendored
File diff suppressed because one or more lines are too long
1
dist/index.html
vendored
1
dist/index.html
vendored
@@ -23,6 +23,7 @@
|
||||
exitMessage: 'The chat is closed. You may close this window.',
|
||||
chatUnavailableMessage: 'The chat service is not available right now. Please try again later.',
|
||||
anonymousDisplayName: 'Anonymous',
|
||||
enableEncryption: 'no',
|
||||
}
|
||||
|
||||
EmbeddableChatbox.mount(config);
|
||||
|
||||
@@ -108,7 +108,7 @@
|
||||
"jest": "24.9.0",
|
||||
"jest-cli": "24.9.0",
|
||||
"mini-css-extract-plugin": "0.9.0",
|
||||
"node-sass": "^7.0.0",
|
||||
"node-sass": "^4.13.1",
|
||||
"postcss-increase-specificity": "0.6.0",
|
||||
"postcss-loader": "3.0.0",
|
||||
"sass-loader": "8.0.0",
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
exitMessage: 'The chat is closed. You may close this window.',
|
||||
chatUnavailableMessage: 'The chat service is not available right now. Please try again later.',
|
||||
anonymousDisplayName: 'Anonymous',
|
||||
enableEncryption: 'no',
|
||||
}
|
||||
|
||||
EmbeddableChatbox.mount(config);
|
||||
|
||||
@@ -38,6 +38,7 @@ const DEFAULT_EXIT_MESSAGE = "The chat is closed. You may close this window."
|
||||
const DEFAULT_ANONYMOUS_DISPLAY_NAME="Anonymous"
|
||||
const DEFAULT_CHAT_UNAVAILABLE_MESSAGE = "The chat service is not available right now. Please try again later."
|
||||
const DEFAULT_WAIT_MESSAGE = "Please be patient, our online facilitators are currently responding to other support requests."
|
||||
const DEFAULT_ENCRYPTION = "yes"
|
||||
|
||||
|
||||
class ChatBox extends React.Component {
|
||||
@@ -229,9 +230,13 @@ class ChatBox extends React.Component {
|
||||
client.setDisplayName(this.props.anonymousDisplayName)
|
||||
this.setMatrixListeners(client)
|
||||
|
||||
try {
|
||||
await client.initCrypto()
|
||||
} catch(err) {
|
||||
if(this.props.enableEncryption == "yes"){
|
||||
try {
|
||||
await client.initCrypto()
|
||||
} catch(err) {
|
||||
return this.initializeUnencryptedChat()
|
||||
}
|
||||
}else{
|
||||
return this.initializeUnencryptedChat()
|
||||
}
|
||||
|
||||
@@ -257,7 +262,9 @@ class ChatBox extends React.Component {
|
||||
isCryptoEnabled: false,
|
||||
})
|
||||
|
||||
this.displayBotMessage({ body: RESTARTING_UNENCRYPTED_CHAT_MESSAGE })
|
||||
if(this.props.enableEncryption == "yes"){
|
||||
this.displayBotMessage({ body: RESTARTING_UNENCRYPTED_CHAT_MESSAGE })
|
||||
}
|
||||
|
||||
let opts = {
|
||||
baseUrl: this.props.matrixServerUrl,
|
||||
@@ -277,7 +284,9 @@ class ChatBox extends React.Component {
|
||||
client.setDisplayName(this.props.anonymousDisplayName)
|
||||
await this.createRoom(client)
|
||||
await client.startClient()
|
||||
this.displayBotMessage({ body: UNENCRYPTION_NOTICE })
|
||||
if(this.props.enableEncryption == "yes"){
|
||||
this.displayBotMessage({ body: UNENCRYPTION_NOTICE })
|
||||
}
|
||||
} catch(err) {
|
||||
console.log("error", err)
|
||||
this.handleInitError(err)
|
||||
@@ -715,6 +724,7 @@ ChatBox.propTypes = {
|
||||
chatUnavailableMessage: PropTypes.string,
|
||||
anonymousDisplayName: PropTypes.string,
|
||||
waitMessage: PropTypes.string,
|
||||
enableEncryption: PropTypes.string,
|
||||
}
|
||||
|
||||
ChatBox.defaultProps = {
|
||||
@@ -729,6 +739,7 @@ ChatBox.defaultProps = {
|
||||
anonymousDisplayName: DEFAULT_ANONYMOUS_DISPLAY_NAME,
|
||||
chatUnavailableMessage: DEFAULT_CHAT_UNAVAILABLE_MESSAGE,
|
||||
waitMessage: DEFAULT_WAIT_MESSAGE,
|
||||
enableEncryption: DEFAULT_ENCRYPTION,
|
||||
}
|
||||
|
||||
export default ChatBox;
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
import EmbeddableChatbox from './embeddable-chatbox';
|
||||
|
||||
const config = {
|
||||
matrixServerUrl: 'https://matrix.safesupport.chat',
|
||||
botId: '@help-bot:safesupport.chat',
|
||||
roomName: 'Support Chat',
|
||||
termsUrl: 'https://tosdr.org/',
|
||||
introMessage: "This chat application does not collect any of your personal data or any data from your use of this service.",
|
||||
agreementMessage: 'Do you want to continue?',
|
||||
confirmationMessage: 'Waiting for a facilitator to join the chat...',
|
||||
exitMessage: 'The chat is closed. You may close this window.',
|
||||
chatUnavailableMessage: 'The chat service is not available right now. Please try again later.',
|
||||
anonymousDisplayName: 'Anonymous',
|
||||
}
|
||||
matrixServerUrl: 'https://matrix.safesupport.chat',
|
||||
botId: '@help-bot:safesupport.chat',
|
||||
roomName: 'Support Chat',
|
||||
termsUrl: 'https://tosdr.org/',
|
||||
introMessage: 'This chat application does not collect any of your personal data or any data from your use of this service.',
|
||||
agreementMessage: 'Do you want to continue?',
|
||||
confirmationMessage: 'Waiting for a facilitator to join the chat...',
|
||||
exitMessage: 'The chat is closed. You may close this window.',
|
||||
chatUnavailableMessage: 'The chat service is not available right now. Please try again later.',
|
||||
anonymousDisplayName: 'Anonymous',
|
||||
enableEncryption: 'no',
|
||||
};
|
||||
|
||||
export default function bookmarklet() {
|
||||
if (window.EmbeddableChatbox) {
|
||||
|
||||
Reference in New Issue
Block a user