-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Madis Abel
committed
Oct 17, 2018
0 parents
commit 3d1d8a4
Showing
15 changed files
with
410 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
PORT=8081 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# See https://help.github.com/ignore-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
|
||
# testing | ||
/coverage | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
appConfig.js | ||
yarn.lock | ||
package-lock.json | ||
webchat-appConfig.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Changelog | ||
All notable changes to this project will be documented in this file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Twilio Flex Web Chat UI Sample | ||
|
||
This project was bootstrapped with [Create React App](https://github.com/facebookincubator/create-react-app). | ||
|
||
You can find the most recent version of the guide on how to perform common tasks [here](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md). | ||
|
||
This package can only be consumed together with Twilio Flex. Visit http://twilio.com/flex to find out more. | ||
|
||
## Instructions | ||
|
||
1. Install all dependencies by running: | ||
``` | ||
npm install | ||
``` | ||
2. Copy webchat-appConfig.sample.js in public/assets folder and configure accordingly to use your Twilio account | ||
``` | ||
cp public/assets/webchat-appConfig.sample.js public/assets/webchat-appConfig.js | ||
``` | ||
3. Start Flex UI by running: | ||
``` | ||
npm start | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"name": "@twilio/flex-webchat-ui-sample", | ||
"version": "1.0.0", | ||
"private": true, | ||
"dependencies": { | ||
"@twilio/flex-webchat-ui": "^1.0.0", | ||
"react": "^16.5.2", | ||
"react-dom": "^16.5.2", | ||
"react-scripts": "2.0.5" | ||
}, | ||
"scripts": { | ||
"start": "react-scripts start", | ||
"build": "react-scripts build", | ||
"test": "react-scripts test", | ||
"eject": "react-scripts eject" | ||
}, | ||
"eslintConfig": { | ||
"extends": "react-app" | ||
}, | ||
"browserslist": [ | ||
">0.2%", | ||
"not dead", | ||
"not ie <= 11", | ||
"not op_mini all" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
var appConfig = { | ||
// change the your AccountSid | ||
accountSid: "AC...", | ||
// change to your Flex Flow SID | ||
flexFlowSid: "FO...", | ||
colorTheme: { | ||
overrides: brandedColors | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
const brandColor1 = "#1976d2"; | ||
const brandColor2 = "#233659"; | ||
const brandTextColor = "#ffffff"; | ||
|
||
const personalizedColors = { | ||
darkBlueBackground: "#3C425C", | ||
whiteText: "#FFFFFF", | ||
entryPointBackground: "#3C425C", | ||
lighterBackground: "#ecedf1", | ||
primaryButtonBackground: "#1976d2", | ||
primaryButtonColor: "#FFFFFF", | ||
secondaryButtonBackground: "#6e7180", | ||
secondaryButtonColor: "#FFFFFF" | ||
}; | ||
|
||
const brandMessageBubbleColors = (bgColor) => ({ | ||
Bubble: { | ||
background: bgColor, | ||
color: brandTextColor | ||
}, | ||
Avatar: { | ||
background: bgColor, | ||
color: brandTextColor | ||
}, | ||
Header: { | ||
color: brandTextColor | ||
} | ||
}); | ||
|
||
const brandedColors = { | ||
Chat: { | ||
MessageListItem: { | ||
FromOthers: brandMessageBubbleColors(brandColor2), | ||
FromMe: brandMessageBubbleColors(brandColor1), | ||
}, | ||
MessageInput: { | ||
Button: { | ||
background: brandColor1, | ||
color: brandTextColor | ||
} | ||
}, | ||
MessageCanvasTray: { | ||
Container: { | ||
background: personalizedColors.darkBlueBackground, | ||
color: personalizedColors.whiteText | ||
} | ||
}, | ||
}, | ||
|
||
MainHeader: { | ||
Container: { | ||
background: personalizedColors.darkBlueBackground, | ||
color: personalizedColors.whiteText | ||
}, | ||
Logo: { | ||
fill: brandTextColor | ||
} | ||
}, | ||
|
||
EntryPoint: { | ||
Container: { | ||
background: personalizedColors.entryPointBackground, | ||
color: personalizedColors.whiteText | ||
} | ||
}, | ||
|
||
PreEngagementCanvas: { | ||
Container: { | ||
background: personalizedColors.lighterBackground | ||
}, | ||
|
||
Form: { | ||
SubmitButton: { | ||
background: personalizedColors.primaryButtonBackground, | ||
color: personalizedColors.whiteText | ||
} | ||
} | ||
} | ||
}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
<title>Twilio Flex Web Chat</title> | ||
<script src="/assets/webchat-branding.js"></script> | ||
<script src="/assets/webchat-appConfig.js"></script> | ||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700"> | ||
</head> | ||
<body> | ||
<noscript> | ||
You need to enable JavaScript to run this app. | ||
</noscript> | ||
<div id="root"></div> | ||
<!-- | ||
This HTML file is a template. | ||
If you open it directly in the browser, you will see an empty page. | ||
You can add webfonts, meta tags, or analytics to this file. | ||
The build step will place the bundled scripts into the <body> tag. | ||
To begin the development, run `npm start` or `yarn start`. | ||
To create a production bundle, use `npm run build` or `yarn build`. | ||
--> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React from 'react'; | ||
import * as FlexWebChat from "@twilio/flex-webchat-ui"; | ||
|
||
class App extends React.Component { | ||
|
||
state = {}; | ||
|
||
constructor(props) { | ||
super(props); | ||
|
||
const { configuration } = props; | ||
FlexWebChat.Manager.create(configuration) | ||
.then(manager => this.setState({ manager })) | ||
.catch(error => this.setState({ error })); | ||
} | ||
|
||
render() { | ||
const { manager, error } = this.state; | ||
if (manager) { | ||
return ( | ||
<FlexWebChat.ContextProvider manager={manager}> | ||
<FlexWebChat.RootContainer /> | ||
</FlexWebChat.ContextProvider> | ||
); | ||
} | ||
|
||
if (error) { | ||
console.error("Failed to initialize Flex Web Chat", error); | ||
} | ||
|
||
return null; | ||
} | ||
} | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import App from './App'; | ||
|
||
it('renders without crashing', () => { | ||
const div = document.createElement('div'); | ||
ReactDOM.render(<App config={{}} />, div); | ||
ReactDOM.unmountComponentAtNode(div); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
body, #root { | ||
margin: 0; | ||
padding: 0; | ||
width: 100vw; | ||
height: 100vh; | ||
display: flex; | ||
font-family: 'Open Sans', sans-serif; | ||
} | ||
|
||
body { | ||
position: relative; | ||
background-size: cover; | ||
background-image: url("/img/background.png"); | ||
background-color: #6D7697; | ||
} | ||
|
||
body:after { | ||
content: ""; | ||
position: absolute; | ||
top: 50%; | ||
left: 50%; | ||
width: 174px; | ||
height: 182px; | ||
margin-left: -87px; | ||
margin-top: -91px; | ||
opacity: 0.2; | ||
background: url("/img/logo.svg"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import 'regenerator-runtime/runtime'; | ||
import './index.css'; | ||
import App from './App'; | ||
import registerServiceWorker from './registerServiceWorker'; | ||
|
||
ReactDOM.render( | ||
<App configuration={window.appConfig} />, | ||
document.getElementById("root") | ||
); | ||
|
||
registerServiceWorker(); |
Oops, something went wrong.