-
Notifications
You must be signed in to change notification settings - Fork 10
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
0 parents
commit 8b0b424
Showing
50 changed files
with
3,750 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,60 @@ | ||
{ | ||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json", | ||
"project": { | ||
"name": "ana-web-chat" | ||
}, | ||
"apps": [ | ||
{ | ||
"root": "src", | ||
"outDir": "dist", | ||
"assets": [ | ||
"assets", | ||
"favicon.ico" | ||
], | ||
"index": "index.html", | ||
"main": "main.ts", | ||
"polyfills": "polyfills.ts", | ||
"test": "test.ts", | ||
"tsconfig": "tsconfig.app.json", | ||
"testTsconfig": "tsconfig.spec.json", | ||
"prefix": "app", | ||
"styles": [ | ||
"styles.css" | ||
], | ||
"scripts": [], | ||
"environmentSource": "environments/environment.ts", | ||
"environments": { | ||
"dev": "environments/environment.ts", | ||
"prod": "environments/environment.prod.ts" | ||
} | ||
} | ||
], | ||
"e2e": { | ||
"protractor": { | ||
"config": "./protractor.conf.js" | ||
} | ||
}, | ||
"lint": [ | ||
{ | ||
"project": "src/tsconfig.app.json", | ||
"exclude": "**/node_modules/**" | ||
}, | ||
{ | ||
"project": "src/tsconfig.spec.json", | ||
"exclude": "**/node_modules/**" | ||
}, | ||
{ | ||
"project": "e2e/tsconfig.e2e.json", | ||
"exclude": "**/node_modules/**" | ||
} | ||
], | ||
"test": { | ||
"karma": { | ||
"config": "./karma.conf.js" | ||
} | ||
}, | ||
"defaults": { | ||
"styleExt": "css", | ||
"component": {} | ||
} | ||
} |
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,43 @@ | ||
# See http://help.github.com/ignore-files/ for more about ignoring files. | ||
|
||
# compiled output | ||
/dist | ||
/tmp | ||
/out-tsc | ||
|
||
# dependencies | ||
/node_modules | ||
|
||
# IDEs and editors | ||
/.idea | ||
.project | ||
.classpath | ||
.c9/ | ||
*.launch | ||
.settings/ | ||
*.sublime-workspace | ||
|
||
# IDE - VSCode | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json | ||
|
||
# misc | ||
/.sass-cache | ||
/connect.lock | ||
/coverage | ||
/libpeerconnection.log | ||
npm-debug.log | ||
testem.log | ||
/typings | ||
yarn-error.log | ||
|
||
# e2e | ||
/e2e/*.js | ||
/e2e/*.map | ||
|
||
# System Files | ||
.DS_Store | ||
Thumbs.db |
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,70 @@ | ||
# ANA Web Chat Plugin | ||
|
||
[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](http://www.gnu.org/licenses/gpl-3.0) | ||
|
||
Use ANA Web Chat Plugin to deploy your ANA chat bot onto your website. | ||
|
||
- Brand it as your website. | ||
- [![Simba - ANA Web Chat](https://github.com/Kitsune-tools/ana-web-chat-plugin/blob/master/assets/webchat-pc-simba.png)](https://github.com/Kitsune-tools/ana-web-chat-plugin/blob/master/assets/webchat-pc-simba.png) | ||
- Mobile friendly out of the box. | ||
- [![Mobile - ANA Web Chat](https://github.com/Kitsune-tools/ana-web-chat-plugin/blob/master/assets/webchat-mobile.jpg)](https://github.com/Kitsune-tools/ana-web-chat-plugin/blob/master/assets/webchat-mobile.jpg) | ||
- A small code snippet to integrate it on any page. | ||
|
||
## Integration | ||
|
||
**Step 1:** | ||
|
||
Setup ANA Chat Server and note down the server URL. Instructions will be available soon on how to do it yourself. Assuming you already have one, let's call it `ana-chat-server.com` | ||
|
||
**Step 2:** | ||
|
||
Download `ana-web-chat-plugin.zip` from [releases](https://github.com/Kitsune-tools/ana-web-chat-plugin/releases), extract and host it on any normal http server. Note the server URL. Let's call it `web-plugin.ana-chat-server.com` | ||
- If you want to host this at a path like `/web-plugin/` instead of the root of your server, you will also need to update `<base href="/">` inside `head` of `index.html` to `<base href="/web-plugin/">`. If you do it, ANA web chat plug-in server URL will now be `ana-chat-server.com/web-plugin/` | ||
|
||
**Step 3:** | ||
|
||
Using ANA Conversation Studio, design a chat bot, publish it and note down the chat project id. Let's call it `chat-bot-1` | ||
- Click [here](https://github.com/Kitsune-tools/ProjectANA) if you have not setup ANA Conversation Studio and created your chat bot yet! | ||
|
||
**Step 4:** | ||
|
||
You need few more things listed below | ||
- The color hex code you want your chat window to be in. For ANA it's `#8cc83c` | ||
- Logo URL for the chat bot. For ANA it's `http://ana.chat/favicon.ico` | ||
- Your chat bot name and a small description. | ||
- If your chat bot asks for locations to the users, you will need a google api key with google static maps and google maps javaScript SDK enabled. Head over to [Google API Console](https://console.developers.google.com) to get one. | ||
|
||
**Step 5:** | ||
|
||
Replace all the placeholders in the below code with the onces noted above, copy and paste it in your website's html file just above the </body> (body's closing tag) | ||
|
||
``` | ||
<script type="text/javascript" id="ana-web-chat-script" | ||
src="http://<web-plugin.ana-chat-server.com>/assets/embed/ana-web-chat-plugin.js" | ||
data-endpoint="http://<ana-chat-server.com>/wscustomers/chatcustomers-websocket" | ||
data-businessid="chat-bot-1" | ||
data-primary-bg="#8cc83c" | ||
data-logo-url="<Your chat bot logo url>" | ||
data-agent-name="<Chat bot name>" | ||
data-agent-desc="<A small description>" | ||
data-iframe-src="http://<web-plugin.ana-chat-server.com>/" | ||
data-file-upload-url="http://<ana-chat-server.com>/files" | ||
data-gmaps-key="<Your Google Maps API Key>" | ||
data-primary-fg="white" | ||
data-secondary-bg="black" | ||
data-frame-height="70vh" | ||
data-frame-width="360px" | ||
></script> | ||
``` | ||
|
||
**Note:** | ||
You also have other customisation options like chat window width (data-frame-width), height (data-frame-height), primary foreground color (data-primary-fg) etc. You can change them as per your needs. | ||
|
||
## License | ||
|
||
ANA Web Chat Plugin is available under the [GNU GPLv3 license](https://www.gnu.org/licenses/gpl-3.0.en.html). |
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,14 @@ | ||
import { AppPage } from './app.po'; | ||
|
||
describe('ana-web-chat App', () => { | ||
let page: AppPage; | ||
|
||
beforeEach(() => { | ||
page = new AppPage(); | ||
}); | ||
|
||
it('should display welcome message', () => { | ||
page.navigateTo(); | ||
expect(page.getParagraphText()).toEqual('Welcome to 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,11 @@ | ||
import { browser, by, element } from 'protractor'; | ||
|
||
export class AppPage { | ||
navigateTo() { | ||
return browser.get('/'); | ||
} | ||
|
||
getParagraphText() { | ||
return element(by.css('app-root h1')).getText(); | ||
} | ||
} |
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,14 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "../out-tsc/e2e", | ||
"baseUrl": "./", | ||
"module": "commonjs", | ||
"target": "es5", | ||
"types": [ | ||
"jasmine", | ||
"jasminewd2", | ||
"node" | ||
] | ||
} | ||
} |
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,33 @@ | ||
// Karma configuration file, see link for more information | ||
// https://karma-runner.github.io/1.0/config/configuration-file.html | ||
|
||
module.exports = function (config) { | ||
config.set({ | ||
basePath: '', | ||
frameworks: ['jasmine', '@angular/cli'], | ||
plugins: [ | ||
require('karma-jasmine'), | ||
require('karma-chrome-launcher'), | ||
require('karma-jasmine-html-reporter'), | ||
require('karma-coverage-istanbul-reporter'), | ||
require('@angular/cli/plugins/karma') | ||
], | ||
client:{ | ||
clearContext: false // leave Jasmine Spec Runner output visible in browser | ||
}, | ||
coverageIstanbulReporter: { | ||
reports: [ 'html', 'lcovonly' ], | ||
fixWebpackSourcePaths: true | ||
}, | ||
angularCli: { | ||
environment: 'dev' | ||
}, | ||
reporters: ['progress', 'kjhtml'], | ||
port: 9876, | ||
colors: true, | ||
logLevel: config.LOG_INFO, | ||
autoWatch: true, | ||
browsers: ['Chrome'], | ||
singleRun: false | ||
}); | ||
}; |
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,60 @@ | ||
{ | ||
"name": "ana-web-chat", | ||
"version": "1.0.0", | ||
"license": "MIT", | ||
"scripts": { | ||
"ng": "ng", | ||
"start": "ng serve", | ||
"build": "ng build", | ||
"test": "ng test", | ||
"lint": "ng lint", | ||
"e2e": "ng e2e" | ||
}, | ||
"private": true, | ||
"dependencies": { | ||
"@agm/core": "^1.0.0-beta.1", | ||
"@angular/animations": "^4.3.6", | ||
"@angular/cdk": "^2.0.0-beta.10", | ||
"@angular/common": "^4.3.6", | ||
"@angular/compiler": "^4.3.6", | ||
"@angular/core": "^4.3.6", | ||
"@angular/forms": "^4.3.6", | ||
"@angular/http": "^4.3.6", | ||
"@angular/material": "^2.0.0-beta.10", | ||
"@angular/platform-browser": "^4.3.6", | ||
"@angular/platform-browser-dynamic": "^4.3.6", | ||
"@angular/router": "^4.3.6", | ||
"@types/stompjs": "^2.3.0", | ||
"bootstrap": "^3.3.7", | ||
"core-js": "^2.4.1", | ||
"moment": "^2.18.1", | ||
"momentjs": "^2.0.0", | ||
"rxjs": "^5.4.2", | ||
"sockjs-client": "^1.1.4", | ||
"stompjs": "^2.3.3", | ||
"zone.js": "^0.8.14" | ||
}, | ||
"devDependencies": { | ||
"@angular/cli": "1.4.1", | ||
"@angular/compiler-cli": "^4.3.6", | ||
"@angular/language-service": "^4.3.6", | ||
"@types/jasmine": "~2.5.53", | ||
"@types/jasminewd2": "~2.0.2", | ||
"@types/node": "~6.0.60", | ||
"@types/sockjs-client": "^1.0.32", | ||
"@types/stompjs": "^2.3.0", | ||
"codelyzer": "~3.1.1", | ||
"jasmine-core": "~2.6.2", | ||
"jasmine-spec-reporter": "~4.1.0", | ||
"karma": "~1.7.0", | ||
"karma-chrome-launcher": "~2.1.1", | ||
"karma-cli": "~1.0.1", | ||
"karma-coverage-istanbul-reporter": "^1.2.1", | ||
"karma-jasmine": "~1.1.0", | ||
"karma-jasmine-html-reporter": "^0.2.2", | ||
"protractor": "~5.1.2", | ||
"ts-node": "~3.3.0", | ||
"tslint": "~5.7.0", | ||
"typescript": "~2.3.4" | ||
} | ||
} |
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 @@ | ||
// Protractor configuration file, see link for more information | ||
// https://github.com/angular/protractor/blob/master/lib/config.ts | ||
|
||
const { SpecReporter } = require('jasmine-spec-reporter'); | ||
|
||
exports.config = { | ||
allScriptsTimeout: 11000, | ||
specs: [ | ||
'./e2e/**/*.e2e-spec.ts' | ||
], | ||
capabilities: { | ||
'browserName': 'chrome' | ||
}, | ||
directConnect: true, | ||
baseUrl: 'http://localhost:4200/', | ||
framework: 'jasmine', | ||
jasmineNodeOpts: { | ||
showColors: true, | ||
defaultTimeoutInterval: 30000, | ||
print: function() {} | ||
}, | ||
onPrepare() { | ||
require('ts-node').register({ | ||
project: 'e2e/tsconfig.e2e.json' | ||
}); | ||
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); | ||
} | ||
}; |
Empty 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 @@ | ||
<router-outlet></router-outlet> |
Oops, something went wrong.