alexa-ability
Advanced tools
Comparing version 0.3.2 to 0.3.3
@@ -18,2 +18,4 @@ 'use strict'; | ||
var _alexaSsml = require('alexa-ssml'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -29,5 +31,11 @@ | ||
this.isNew = (0, _get2.default)(event, 'session.new', false); | ||
this.version = (0, _get2.default)(event, 'version', '1.0'); | ||
this.session = (0, _get2.default)(event, 'session', {}); | ||
this.session = (0, _get2.default)(event, 'session.session', {}); | ||
this.params = (0, _get2.default)(event, 'request.intent.slots', {}); | ||
this._speech = null; | ||
this._card = null; | ||
this._reprompt = null; | ||
this._end = false; | ||
} | ||
@@ -37,4 +45,4 @@ | ||
key: 'say', | ||
value: function say(text) { | ||
this._speech = text; | ||
value: function say(content) { | ||
this._speech = content; | ||
return this; | ||
@@ -44,4 +52,4 @@ } | ||
key: 'show', | ||
value: function show(text) { | ||
this._card = text; | ||
value: function show(content) { | ||
this._card = content; | ||
return this; | ||
@@ -51,4 +59,4 @@ } | ||
key: 'reprompt', | ||
value: function reprompt(text) { | ||
this._reprompt = text; | ||
value: function reprompt(content) { | ||
this._reprompt = content; | ||
return this; | ||
@@ -60,2 +68,3 @@ } | ||
this._end = true; | ||
return this; | ||
} | ||
@@ -67,10 +76,7 @@ }, { | ||
version: this.version, | ||
sessionAttributes: (0, _omit2.default)(this.session, []), | ||
sessionAttributes: this.session, | ||
response: { shouldEndSession: this._end } | ||
}; | ||
if (this._speech) data.response.outputSpeech = { | ||
type: "PlainText", | ||
text: this._speech | ||
}; | ||
if (this._speech) data.response.outputSpeech = toSpeechResponse(this._speech); | ||
@@ -84,6 +90,3 @@ if (this._card) data.response.card = { | ||
if (this._reprompt) data.response.reprompt = { | ||
outputSpeech: { | ||
type: "PlainText", | ||
text: this._reprompt | ||
} | ||
outputSpeech: toSpeechResponse(this._reprompt) | ||
}; | ||
@@ -96,2 +99,8 @@ | ||
return Request; | ||
}(); | ||
}(); | ||
function toSpeechResponse(content) { | ||
var isTag = (0, _get2.default)(content, 'tag'); | ||
return isTag ? { type: "SSML", text: (0, _alexaSsml.renderToString)(content) } : { type: "PlainText", text: content }; | ||
} |
{ | ||
"name": "alexa-ability", | ||
"version": "0.3.2", | ||
"version": "0.3.3", | ||
"description": "", | ||
@@ -21,2 +21,3 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"alexa-ssml": "^0.2.1", | ||
"bluebird": "^3.1.5", | ||
@@ -29,2 +30,3 @@ "debug": "^2.2.0", | ||
"babel-cli": "^6.4.5", | ||
"babel-plugin-transform-react-jsx": "^6.4.0", | ||
"babel-preset-es2015": "^6.3.13", | ||
@@ -31,0 +33,0 @@ "babel-preset-stage-1": "^6.3.13", |
{ | ||
"version": "1.0", | ||
"session": { | ||
"new": false, | ||
"new": true, | ||
"sessionId": "amzn1.echo-api.session.0000000-0000-0000-0000-00000000000", | ||
@@ -6,0 +6,0 @@ "application": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31044
23
738
4
11
+ Addedalexa-ssml@^0.2.1
+ Addedalexa-ssml@0.2.2(transitive)
+ Addedtv4@1.3.0(transitive)
+ Addedxmlbuilder@4.2.1(transitive)