-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Updating for voxa3 * Adding generic * Moving to typescript * Updating tests * Updated dependencies * Changing cobertura for report and installing nyc. * Adding tslint-no-unused-expression-chai package for tslint to work. * Setting 3.0.0-alpha38 as minimum * Moving to yarn * Changing package version. * Updated dependencies * Support for facebook property * Added printErrors to config interface * Changed to v2.0.0-alpha4 * Removed facebook property * Changes to v2.0.0 * Updates dependencies * Updates run-ci.sh * Replaces nyc with istanbul * Changes to v2.0.1 * Removes ignored lib folder * Changes to v2.0.2
- Loading branch information
Showing
16 changed files
with
2,353 additions
and
1,488 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -1 +1 @@ | ||
v6.10 | ||
v8.10 |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,18 +1,19 @@ | ||
{ | ||
"name": "voxa-dashbot", | ||
"version": "0.1.8", | ||
"version": "2.0.2", | ||
"description": "Integrate Dashbot analytics into your Alexa apps using the voxa framework", | ||
"main": "index.js", | ||
"main": "lib/Voxa-Dashbot.js", | ||
"scripts": { | ||
"test": "istanbul cover _mocha -- --recursive tests", | ||
"test-ci": "JUNIT_REPORT_PATH=junit.xml istanbul cover _mocha -- --recursive --colors --reporter mocha-jenkins-reporter tests", | ||
"cobertura": "istanbul report cobertura --root coverage", | ||
"lint": "eslint lib/ tests/", | ||
"lint-fix": "eslint --fix lib/ tests/" | ||
"test": "istanbul cover _mocha -- --recursive test", | ||
"test-ci": "JUNIT_REPORT_PATH=junit.xml istanbul cover _mocha -- --recursive --colors --reporter mocha-jenkins-reporter test", | ||
"lint": "tslint --project tsconfig.json --config tslint.json", | ||
"clean": "rimraf lib/", | ||
"prepare": "npm run clean && tsc", | ||
"cobertura": "istanbul report cobertura --root coverage" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/mediarain/voxa-dashbot.git" | ||
"url": "git+https://github.com/VoxaAI/voxa-dashbot.git" | ||
}, | ||
"keywords": [ | ||
"alexa", | ||
|
@@ -27,28 +28,34 @@ | |
], | ||
"author": "Rain Agency <[email protected]> (http://rain.agency)", | ||
"engines": { | ||
"node": ">=4.3" | ||
"node": ">=8.10" | ||
}, | ||
"license": "MIT", | ||
"dependencies": { | ||
"dashbot": "^9.9.1", | ||
"lambda-log": "^1.4.0", | ||
"lodash": "^4.17.10" | ||
"@types/lodash": "^4.14.126", | ||
"dashbot": "^10.4.0", | ||
"lodash": "^4.17.11" | ||
}, | ||
"devDependencies": { | ||
"chai": "^3.5.0", | ||
"eslint": "3.15.0", | ||
"eslint-config-airbnb-base": "11.1.0", | ||
"eslint-plugin-import": "2.2.0", | ||
"chai": "^4.2.0", | ||
"istanbul": "^0.4.5", | ||
"mocha": "3.2.0", | ||
"mocha-jenkins-reporter": "0.3.7", | ||
"nock": "^9.2.3", | ||
"simple-mock": "^0.7.3", | ||
"voxa": "^2.2.1" | ||
"mocha": "6.1.4", | ||
"mocha-jenkins-reporter": "0.4.1", | ||
"nock": "^10.0.6", | ||
"rimraf": "^2.6.3", | ||
"simple-mock": "^0.8.0", | ||
"source-map-support": "^0.5.12", | ||
"ts-node": "^8.1.0", | ||
"tslint": "^5.16.0", | ||
"tslint-no-unused-expression-chai": "^0.1.4", | ||
"typescript": "^3.4.5", | ||
"voxa": "^3.1.0" | ||
}, | ||
"peerDependencies": { | ||
"voxa": "^3.1.0" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/mediarain/voxa-dashbot/issues" | ||
"url": "https://github.com/VoxaAI/voxa-dashbot/issues" | ||
}, | ||
"homepage": "https://github.com/mediarain/voxa-dashbot#readme" | ||
"homepage": "https://github.com/VoxaAI/voxa-dashbot#readme" | ||
} |
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
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,97 @@ | ||
/* | ||
* Copyright (c) 2018 Rain Agency <[email protected]> | ||
* Author: Rain Agency <[email protected]> | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
* this software and associated documentation files (the "Software"), to deal in | ||
* the Software without restriction, including without limitation the rights to | ||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
* the Software, and to permit persons to whom the Software is furnished to do so, | ||
* subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
*/ | ||
|
||
import * as _ from "lodash"; | ||
import { IVoxaEvent, IVoxaReply, VoxaApp } from "voxa"; | ||
/* tslint:disable-next-line */ | ||
const DashbotAnalytics = require("dashbot"); | ||
|
||
const defaultConfig = { | ||
ignoreUsers: [], | ||
}; | ||
|
||
const dashbotIntegrations: any = { | ||
alexa: "alexa", | ||
botframework: "generic", | ||
dialogflow: "google", // DEPRECATED | ||
google: "google", | ||
}; | ||
|
||
export interface IVoxaDashbotConfig { | ||
alexa?: string; | ||
api_key?: string; | ||
botframework?: string; | ||
debug?: boolean; | ||
dialogflow?: string; | ||
printErrors?: boolean; | ||
redact?: boolean; | ||
suppressSending?: boolean; | ||
timeout?: number; | ||
} | ||
|
||
export function register(skill: VoxaApp, config: IVoxaDashbotConfig) { | ||
const pluginConfig = _.merge({}, defaultConfig, config); | ||
|
||
const dashbotConfig = { | ||
debug: pluginConfig.debug, | ||
printErrors: pluginConfig.printErrors, | ||
redact: pluginConfig.redact, | ||
timeout: pluginConfig.timeout, | ||
}; | ||
|
||
skill.onRequestStarted(trackIncoming); | ||
skill.onBeforeReplySent(trackOutgoing); | ||
|
||
function trackIncoming(voxaEvent: IVoxaEvent) { | ||
if (_.includes(pluginConfig.ignoreUsers, voxaEvent.user.userId)) { | ||
return Promise.resolve(null); | ||
} | ||
if (pluginConfig.suppressSending) { | ||
return Promise.resolve(null); | ||
} | ||
const { rawEvent, platform } = voxaEvent; | ||
const apiKey = _.get(pluginConfig, platform.name) || pluginConfig.api_key; | ||
|
||
const Dashbot = DashbotAnalytics(apiKey, dashbotConfig)[ | ||
dashbotIntegrations[platform.name] | ||
]; | ||
// PROCESSING INCOMING RESPONSE | ||
return Dashbot.logIncoming(rawEvent); | ||
} | ||
|
||
function trackOutgoing(voxaEvent: IVoxaEvent, reply: IVoxaReply) { | ||
if (_.includes(pluginConfig.ignoreUsers, voxaEvent.user.userId)) { | ||
return Promise.resolve(null); | ||
} | ||
if (pluginConfig.suppressSending) { | ||
return Promise.resolve(null); | ||
} | ||
const { rawEvent, platform } = voxaEvent; | ||
const apiKey = _.get(pluginConfig, platform.name) || pluginConfig.api_key; | ||
|
||
const Dashbot = DashbotAnalytics(apiKey, dashbotConfig)[ | ||
dashbotIntegrations[platform.name] | ||
]; | ||
// PROCESSING INCOMING RESPONSE | ||
return Dashbot.logOutgoing(rawEvent, reply); | ||
} | ||
} |
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,4 @@ | ||
--require ts-node/register | ||
--watch-extensions ts | ||
--recursive | ||
|
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,31 @@ | ||
"use strict"; | ||
|
||
/** | ||
* Views for tests | ||
* | ||
* Copyright (c) 2016 Rain Agency. | ||
* Licensed under the MIT license. | ||
*/ | ||
|
||
const views = (function views() { | ||
return { | ||
en: { | ||
translation: { | ||
LaunchIntent: { | ||
OpenResponse: "Hello! How are you?" | ||
}, | ||
Question: { | ||
Ask: "What time is it?" | ||
}, | ||
ExitIntent: { | ||
GeneralExit: "Ok. Goodbye." | ||
}, | ||
BadInput: { | ||
RepeatLastAskReprompt: "I'm sorry. I didn't understand." | ||
} | ||
} | ||
} | ||
}; | ||
})(); | ||
|
||
module.exports = views; |
Oops, something went wrong.