Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6070926b89 | ||
|
|
8427e82c9d | ||
|
|
f262c9df0f | ||
|
|
b9f822d308 | ||
|
|
0cb939ff7d | ||
|
|
057789e741 |
@@ -1,48 +0,0 @@
|
|||||||
version: 2
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
docker:
|
|
||||||
- image: node:10
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
- run:
|
|
||||||
name: dep install
|
|
||||||
command: npm install
|
|
||||||
- run:
|
|
||||||
name: install codecov
|
|
||||||
command: npm install -g codecov
|
|
||||||
- run:
|
|
||||||
name: test
|
|
||||||
command: npm test && codecov
|
|
||||||
- run:
|
|
||||||
name: build
|
|
||||||
command: |
|
|
||||||
npm run build
|
|
||||||
[ -f ./dist/index.html ] || exit 1
|
|
||||||
[ -f ./dist/blank.html ] || exit 1
|
|
||||||
[ -f ./dist/widget.js ] || exit 1
|
|
||||||
[ -f ./dist/bookmarklet.js ] || exit 1
|
|
||||||
- run:
|
|
||||||
name: npm start works
|
|
||||||
command: |
|
|
||||||
npm run start &
|
|
||||||
pid=$!
|
|
||||||
sleep 10s
|
|
||||||
ps $pid
|
|
||||||
- run:
|
|
||||||
name: deploy
|
|
||||||
command: |
|
|
||||||
if [ "$CIRCLE_BRANCH" = "master" ]; then
|
|
||||||
git config --global user.email $GH_EMAIL
|
|
||||||
git config --global user.name $GH_NAME
|
|
||||||
npm run deploy
|
|
||||||
fi
|
|
||||||
|
|
||||||
workflows:
|
|
||||||
version: 2
|
|
||||||
build-deploy:
|
|
||||||
jobs:
|
|
||||||
- build:
|
|
||||||
filters:
|
|
||||||
branches:
|
|
||||||
ignore: gh-pages
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
import '@storybook/addon-actions/register';
|
|
||||||
import '@storybook/addon-links/register';
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
import { configure } from '@storybook/react';
|
|
||||||
|
|
||||||
// automatically import all files ending in *.stories.js
|
|
||||||
const req = require.context('../stories', true, /\.stories\.js$/);
|
|
||||||
function loadStories() {
|
|
||||||
req.keys().forEach(filename => req(filename));
|
|
||||||
}
|
|
||||||
|
|
||||||
configure(loadStories, module);
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
const path = require('path');
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
module: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
test: /\.scss$/,
|
|
||||||
use: ['style-loader', 'css-loader', 'sass-loader'],
|
|
||||||
include: path.resolve(__dirname, '../'),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
}
|
|
||||||
10
README.md
@@ -10,11 +10,11 @@ Built on:
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
```
|
```
|
||||||
<script src="https://unpkg.com/safesupport-chatbox" type="text/javascript"></script>
|
<script src="https://unpkg.com/private-safesupport-chatbox" type="text/javascript"></script>
|
||||||
<script>
|
<script>
|
||||||
var config = {
|
var config = {
|
||||||
matrixServerUrl: 'https://matrix.rhok.space',
|
matrixServerUrl: 'https://matrix-client.matrix.org',
|
||||||
botId: '@help-bot:rhok.space',
|
botId: '@your-help-bot:matrix.org',
|
||||||
roomName: 'Support Chat',
|
roomName: 'Support Chat',
|
||||||
termsUrl: 'https://tosdr.org/',
|
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.',
|
introMessage: 'This chat application does not collect any of your personal data or any data from your use of this service.',
|
||||||
@@ -31,8 +31,8 @@ Built on:
|
|||||||
Options:
|
Options:
|
||||||
| Name | Description | Default
|
| Name | Description | Default
|
||||||
| ----------- | ----------- | --------- |
|
| ----------- | ----------- | --------- |
|
||||||
| `matrixServerUrl` (required) | URL for the Matrix homeserver you want to connect to | `https://matrix.rhok.space` |
|
| `matrixServerUrl` (required) | URL for the Matrix homeserver you want to connect to | `https://matrix-client.matrix.org` |
|
||||||
| `botId` (required) | User ID for the bot account that handles invites | `@help-bot:rhok.space` |
|
| `botId` (required) | User ID for the bot account that handles invites | null |
|
||||||
| `introMessage` (optional) | First message the user sees before agreeing to the Terms of Use | `This chat application does not collect any of your personal data or any data from your use of this service.` |
|
| `introMessage` (optional) | First message the user sees before agreeing to the Terms of Use | `This chat application does not collect any of your personal data or any data from your use of this service.` |
|
||||||
| `termsUrl` (optional) | URL for the Terms of Use for the chat service | `https://tosdr.org/` |
|
| `termsUrl` (optional) | URL for the Terms of Use for the chat service | `https://tosdr.org/` |
|
||||||
| `roomName` (optional) | Name of the chatroom generated in Riot | 'Support Chat' |
|
| `roomName` (optional) | Name of the chatroom generated in Riot | 'Support Chat' |
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 2.3 MiB |
BIN
dist/olm.wasm
vendored
|
Before Width: | Height: | Size: 63 KiB |
|
Before Width: | Height: | Size: 106 KiB |
|
Before Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 126 KiB |
|
Before Width: | Height: | Size: 176 KiB |
BIN
docs/confirm.png
|
Before Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 101 KiB |
|
Before Width: | Height: | Size: 230 KiB |
|
Before Width: | Height: | Size: 112 KiB |
|
Before Width: | Height: | Size: 68 KiB |
|
Before Width: | Height: | Size: 59 KiB |
|
Before Width: | Height: | Size: 135 KiB |
|
Before Width: | Height: | Size: 65 KiB |
|
Before Width: | Height: | Size: 296 KiB |
|
Before Width: | Height: | Size: 166 KiB |
|
Before Width: | Height: | Size: 111 KiB |
|
Before Width: | Height: | Size: 92 KiB |
|
Before Width: | Height: | Size: 65 KiB |
|
Before Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 111 KiB |
|
Before Width: | Height: | Size: 98 KiB |
|
Before Width: | Height: | Size: 105 KiB |
|
Before Width: | Height: | Size: 42 KiB |
BIN
docs/verify.png
|
Before Width: | Height: | Size: 143 KiB |
|
Before Width: | Height: | Size: 97 KiB |
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "safesupport-chatbox",
|
"name": "private-safesupport-chatbox",
|
||||||
"version": "1.1.3",
|
"version": "1.0.1",
|
||||||
"description": "A secure and private embeddable chatbox that connects to Riot",
|
"description": "A secure and private embeddable chatbox that connects to Riot",
|
||||||
"main": "dist/chatbox.js",
|
"main": "dist/chatbox.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -89,10 +89,6 @@
|
|||||||
"@babel/plugin-transform-runtime": "^7.9.0",
|
"@babel/plugin-transform-runtime": "^7.9.0",
|
||||||
"@babel/preset-env": "^7.9.0",
|
"@babel/preset-env": "^7.9.0",
|
||||||
"@babel/preset-react": "^7.9.4",
|
"@babel/preset-react": "^7.9.4",
|
||||||
"@storybook/addon-actions": "5.2.8",
|
|
||||||
"@storybook/addon-links": "5.2.8",
|
|
||||||
"@storybook/addons": "5.2.8",
|
|
||||||
"@storybook/react": "5.2.8",
|
|
||||||
"autoprefixer": "^9.7.5",
|
"autoprefixer": "^9.7.5",
|
||||||
"babel-core": "7.0.0-bridge.0",
|
"babel-core": "7.0.0-bridge.0",
|
||||||
"babel-eslint": "10.0.3",
|
"babel-eslint": "10.0.3",
|
||||||
@@ -125,6 +121,7 @@
|
|||||||
"style-loader": "1.1.2",
|
"style-loader": "1.1.2",
|
||||||
"wait-for-expect": "^3.0.2",
|
"wait-for-expect": "^3.0.2",
|
||||||
"webpack": "4.41.5",
|
"webpack": "4.41.5",
|
||||||
|
"webpack-bundle-analyzer": "^3.7.0",
|
||||||
"webpack-cli": "3.3.10",
|
"webpack-cli": "3.3.10",
|
||||||
"webpack-dev-server": "3.10.1",
|
"webpack-dev-server": "3.10.1",
|
||||||
"webpack-obfuscator": "0.22.0",
|
"webpack-obfuscator": "0.22.0",
|
||||||
|
|||||||
BIN
public/olm.wasm
@@ -99,6 +99,7 @@
|
|||||||
width: 400px;
|
width: 400px;
|
||||||
max-width: calc(100vw - 10px);
|
max-width: calc(100vw - 10px);
|
||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
|
margin: 0;
|
||||||
animation-duration: 0.2s;
|
animation-duration: 0.2s;
|
||||||
animation-fill-mode: forwards;
|
animation-fill-mode: forwards;
|
||||||
|
|
||||||
|
|||||||
@@ -599,103 +599,105 @@ class ChatBox extends React.Component {
|
|||||||
const inputLabel = 'Send a message...'
|
const inputLabel = 'Send a message...'
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="docked-widget" role="complementary">
|
<div id="safesupport">
|
||||||
<Transition in={opened} timeout={250} onExited={this.handleWidgetExit} onEntered={this.handleWidgetEnter}>
|
<div className="docked-widget" role="complementary">
|
||||||
{(status) => {
|
<Transition in={opened} timeout={250} onExited={this.handleWidgetExit} onEntered={this.handleWidgetEnter}>
|
||||||
return (
|
{(status) => {
|
||||||
<div className={`widget widget-${status}`} aria-hidden={!opened}>
|
return (
|
||||||
<div id="safesupport-chatbox" aria-haspopup="dialog">
|
<div className={`widget widget-${status}`} aria-hidden={!opened}>
|
||||||
<Header handleToggleOpen={this.handleToggleOpen} opened={opened} handleExitChat={this.handleExitChat} />
|
<div id="safesupport-chatbox" aria-haspopup="dialog">
|
||||||
|
<Header handleToggleOpen={this.handleToggleOpen} opened={opened} handleExitChat={this.handleExitChat} />
|
||||||
|
|
||||||
<div className="message-window" ref={this.messageWindow}>
|
<div className="message-window" ref={this.messageWindow}>
|
||||||
<div className="messages">
|
<div className="messages">
|
||||||
<div className={`message from-bot`}>
|
<div className={`message from-bot`}>
|
||||||
<div className="text">{ this.props.introMessage }</div>
|
<div className="text">{ this.props.introMessage }</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className={`message from-bot`}>
|
|
||||||
<div className="text">Please read the full <a href={this.props.termsUrl} ref={this.termsUrl} target='_blank' rel='noopener noreferrer'>terms and conditions</a>. By using this chat, you agree to these terms.</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className={`message from-bot`}>
|
|
||||||
<div className="text">{ this.props.agreementMessage }</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className={`message from-bot`}>
|
|
||||||
<div className="text buttons">
|
|
||||||
{`👉`}
|
|
||||||
<button className="btn" id="accept" onClick={this.handleAcceptTerms}>YES</button>
|
|
||||||
<button className="btn" id="reject" onClick={this.handleRejectTerms}>NO</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
{
|
<div className={`message from-bot`}>
|
||||||
messages.map((message, index) => {
|
<div className="text">Please read the full <a href={this.props.termsUrl} ref={this.termsUrl} target='_blank' rel='noopener noreferrer'>terms and conditions</a>. By using this chat, you agree to these terms.</div>
|
||||||
return(
|
</div>
|
||||||
<Message key={message.id} message={message} userId={userId} botId={this.props.botId} client={this.state.client} />
|
|
||||||
)
|
<div className={`message from-bot`}>
|
||||||
})
|
<div className="text">{ this.props.agreementMessage }</div>
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
messagesInFlight.map((message, index) => {
|
|
||||||
return(
|
|
||||||
<Message key={`message-inflight-${index}`} message={{ content: { body: message }}} placeholder={true} />
|
|
||||||
)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
{ typingStatus &&
|
|
||||||
<div className="notices">
|
|
||||||
<div role="status">{typingStatus}</div>
|
|
||||||
</div>
|
</div>
|
||||||
}
|
|
||||||
|
|
||||||
{ Boolean(Object.keys(decryptionErrors).length) &&
|
|
||||||
<div className={`message from-bot`}>
|
<div className={`message from-bot`}>
|
||||||
<div className="text buttons">
|
<div className="text buttons">
|
||||||
{`Restart chat without encryption?`}
|
{`👉`}
|
||||||
<button className="btn" id="accept" onClick={this.initializeUnencryptedChat}>RESTART</button>
|
<button className="btn" id="accept" onClick={this.handleAcceptTerms}>YES</button>
|
||||||
|
<button className="btn" id="reject" onClick={this.handleRejectTerms}>NO</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
|
||||||
|
|
||||||
{ !ready && <div className={`loader`}>loading...</div> }
|
{
|
||||||
|
messages.map((message, index) => {
|
||||||
|
return(
|
||||||
|
<Message key={message.id} message={message} userId={userId} botId={this.props.botId} client={this.state.client} />
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
messagesInFlight.map((message, index) => {
|
||||||
|
return(
|
||||||
|
<Message key={`message-inflight-${index}`} message={{ content: { body: message }}} placeholder={true} />
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
{ typingStatus &&
|
||||||
|
<div className="notices">
|
||||||
|
<div role="status">{typingStatus}</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
{ Boolean(Object.keys(decryptionErrors).length) &&
|
||||||
|
<div className={`message from-bot`}>
|
||||||
|
<div className="text buttons">
|
||||||
|
{`Restart chat without encryption?`}
|
||||||
|
<button className="btn" id="accept" onClick={this.initializeUnencryptedChat}>RESTART</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
{ !ready && <div className={`loader`}>loading...</div> }
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="input-window">
|
||||||
|
<form onSubmit={this.handleSubmit}>
|
||||||
|
<div className="message-input-container">
|
||||||
|
<input
|
||||||
|
id="message-input"
|
||||||
|
type="text"
|
||||||
|
onChange={this.handleInputChange}
|
||||||
|
value={inputValue}
|
||||||
|
aria-label={inputLabel}
|
||||||
|
placeholder={inputLabel}
|
||||||
|
autoFocus={true}
|
||||||
|
ref={this.chatboxInput}
|
||||||
|
/>
|
||||||
|
{
|
||||||
|
(status === "entered") && !isMobile &&
|
||||||
|
<EmojiSelector
|
||||||
|
onEmojiClick={this.onEmojiClick}
|
||||||
|
emojiSelectorOpen={emojiSelectorOpen}
|
||||||
|
toggleEmojiSelector={this.toggleEmojiSelector}
|
||||||
|
closeEmojiSelector={this.closeEmojiSelector}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
<input type="submit" value="Send" id="submit" onClick={this.handleSubmit} />
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="input-window">
|
|
||||||
<form onSubmit={this.handleSubmit}>
|
|
||||||
<div className="message-input-container">
|
|
||||||
<input
|
|
||||||
id="message-input"
|
|
||||||
type="text"
|
|
||||||
onChange={this.handleInputChange}
|
|
||||||
value={inputValue}
|
|
||||||
aria-label={inputLabel}
|
|
||||||
placeholder={inputLabel}
|
|
||||||
autoFocus={true}
|
|
||||||
ref={this.chatboxInput}
|
|
||||||
/>
|
|
||||||
{
|
|
||||||
(status === "entered") && !isMobile &&
|
|
||||||
<EmojiSelector
|
|
||||||
onEmojiClick={this.onEmojiClick}
|
|
||||||
emojiSelectorOpen={emojiSelectorOpen}
|
|
||||||
toggleEmojiSelector={this.toggleEmojiSelector}
|
|
||||||
closeEmojiSelector={this.closeEmojiSelector}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
<input type="submit" value="Send" id="submit" onClick={this.handleSubmit} />
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
)}
|
||||||
)}
|
}
|
||||||
}
|
</Transition>
|
||||||
</Transition>
|
{showDock && !roomId && <Dock handleToggleOpen={this.handleToggleOpen} />}
|
||||||
{showDock && !roomId && <Dock handleToggleOpen={this.handleToggleOpen} />}
|
{showDock && roomId && <Header handleToggleOpen={this.handleToggleOpen} opened={opened} handleExitChat={this.handleExitChat} />}
|
||||||
{showDock && roomId && <Header handleToggleOpen={this.handleToggleOpen} opened={opened} handleExitChat={this.handleExitChat} />}
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
@import "variables";
|
#safesupport {
|
||||||
@import "loader";
|
@import "variables";
|
||||||
@import "chat";
|
@import "loader";
|
||||||
@import "dark_mode";
|
@import "chat";
|
||||||
|
@import "dark_mode";
|
||||||
|
}
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
import React from 'react'
|
|
||||||
import { storiesOf } from '@storybook/react'
|
|
||||||
import Widget from '../src/components/widget'
|
|
||||||
|
|
||||||
storiesOf(`Widget`)
|
|
||||||
.add(`default`, () => <Widget />)
|
|
||||||