24 Commits

Author SHA1 Message Date
GotPPay
3214a2bea4 fixed delete bug, code refactoring, improved UI 2018-01-10 13:27:09 +01:00
Bilal
84c11f1b2f Keep session open 2018-01-08 21:13:23 +00:00
GotPPay
1a9227e76d refactoring 2018-01-08 21:50:24 +01:00
GotPPay
cd48599f39 Update readme 2018-01-08 13:53:50 +01:00
GotPPay
61bd6862aa removed unnecessary function 2018-01-08 13:49:24 +01:00
Bilal
994670ce54 from server ; working with amazon test service, not working with real device 2018-01-08 12:44:38 +00:00
Bilal
51ff7f255c from server ; intents working - launch request not working 2018-01-08 12:06:25 +00:00
Bilal
8a59d452f5 from server 2018-01-08 10:33:15 +00:00
Bilal
7fbc105433 .. 2018-01-07 17:51:07 +00:00
Bilal
675861d2cd almost there 2018-01-07 16:39:21 +00:00
Bilal
9ba9209aa3 working frontend ; backend not working 2018-01-07 13:54:15 +00:00
Bilal
64ff4357d1 Merge branch 'bilal-step-3-token-refresh' of https://github.com/GotPPay/tellall into bilal-step-3-token-refresh 2018-01-05 23:00:00 +00:00
GotPPay
3fe9ebde9d new scss file 2018-01-05 23:59:26 +01:00
Bilal
f1e4010950 from server 2018-01-05 22:28:55 +00:00
GotPPay
b7a778691f install ejs 2018-01-05 23:06:37 +01:00
GotPPay
beb575ef7f remove view engine 2018-01-05 22:53:53 +01:00
Bilal
db5bd107a0 add view engine 2018-01-05 19:40:05 +00:00
Bilal
214e6dff71 Merge branch 'bilal-step-3-token-refresh' of https://github.com/GotPPay/tellall into bilal-step-3-token-refresh 2018-01-05 19:33:48 +00:00
GotPPay
c3bba7ffa7 express routes reorder 2018-01-05 20:32:55 +01:00
Bilal
1f05d227b2 Changes from server 2018-01-05 19:20:30 +00:00
GotPPay
2990fad6cf package update 2018-01-05 20:15:56 +01:00
GotPPay
03c346f5d2 popup info ; token update 2018-01-05 17:56:24 +01:00
GotPPay
b55dd56859 readme update 2018-01-05 01:00:10 +01:00
GotPPay
32e0f4d6d7 automatic token refresh, initial stage 2018-01-05 00:51:49 +01:00
19 changed files with 11347 additions and 2457 deletions

17
backend/config.js Normal file
View File

@@ -0,0 +1,17 @@
var config = {};
config.dbURL = 'mongodb://localhost:27017/tellall';
config.PORT = 5000;
config.TOKEN = 'Atza|IwEBIBe6gDqrrowEEav6N-_6s4NztYeP3oG8PGWmu8ZiZw6lbOh3wNla3TK6pY-VEpT1d8an-dVf_n3kXJzVFsNo_4xBfZyFHGoCTDTFjs3yBRul4PVdBOhwwiH3-sgRLcUofZbe2oE06GmTcbfYtaStfXpQI5dfpldfnsJg_CvhSA6AHb_snJT3F6lyXzbV076d_3cYUMJxFldJGnYcviNHHxjjmuQTD06hhGzCbAxxe9eBmkuopRsNfyedLT2UlKP_ublah9CUGA3AdIX_3Iuke82jMwGnNl9gv7pbaDNEjAbj7IQSl3B08uuREtJq-oTBOjALNXRvFxTJmQjZwXNf9eHC7fSHJDdEPdZQU0AcffRQObAyAkUuL6Jv39OHzhb3Q64-zzoyODqnJyLP5SQZ2JVF53Kc_cTBqjIc9pXljqe7yEVk6JDs7q1zKbBibx_AQm57TO79IzWyLBzBMlYL5HdTsqEfRzLeDw2tws-hGMgkx2HWfdbYnmf5Qb4SyIhzvmmdfPLg3MVKTxjIBu1rx0xf3n0PLZP1EO6jsJPoMRPg77Gm4oit5Zp6s37ek3A3Vxh-ntoASpkrkxGTG9kVtRNt';
config.REFRESH_TOKEN = 'Atzr|IwEBICA3kDhfSJxlwvnQp9AD1o115AC_KBbFd5GBg8oN_QHWn2or5xFQ09BruuK6a07tGHtTt_9q2Y21mnOMH4RDtYXTVG9ADgLE6mHWKZFxYVwt3kHMiUJdY5lJcsOtWLoblrS-bJ0BEXXK5nVDt_bSI5IB7NUf-9QVZxhovRH_ANSxdTjJT0_rMIAZY3WEj68FEap49q_pg72BhnxHVZD2TC3zvX96_DN65HE5SoSgT7OiMAeiJewB_SyemW_HxBwaB-_X-G1ifOtnrzZ4gXTpOrEUlHI2YPuvRMBMtmz1h-nXDZYv3vwU3RA57Qj_ZNVcScj8_RXf2xq8w48v0PzZFXYBSalfnqPq6eUvSSbAJUp6bB8y596JlvR5dFQe_Z--X0Gkfo85IcyrI9D44vK9sJhrGhCVi2FDDa8pHczmNSen99JYZvDif-zpYzgbcymAkOV0gC7JvYMxlZfETT3NTBy7eVA7fJI1SZaeA_qW49xRcBkZBu5gkqTpeGWUU1cGr2aXRVVmXGM22NfV5E7KzvEBsCeHml_tCfxZeKY8Msd8hJb0Cd59u-_hsuc8oNjsOpIdFF976dY3uTmAgHWpG2PH';
config.TOKEN_EXPIRES_IN = 1515100500;
config.SKILL_ID = 'amzn1.ask.skill.efbf0564-a732-4ba9-958f-57939138adae';
//config.SKILL_DB_ID = '5a5016e775becaef2015da10'; //for server
config.SKILL_DB_ID = '5a232fb86ce046c749739455'; //for local
config.CLIENT_ID = 'amzn1.application-oa2-client.c748ca56ded04a95b236979898585ff7';
config.CLIENT_SECRET = '6dea8125cecd049d3c4cff7bb5bdfd3ff17bc6fed246c4c8f6b519d9ed08d0b3';
module.exports = config;

View File

@@ -1,105 +1,21 @@
var amazonHelper = require('./helpers/amazon');
require('isomorphic-fetch');
var express = require('express');
var alexa = require('alexa-app');
var bodyParser = require('body-parser');
const dbURL = 'mongodb://localhost:27017/tellall';
const PORT = 5000;
const TOKEN = 'Atza|IwEBIMv0spn-eZhjP8-R2Jjkb4VUi-EY4V3MX-wlJyr2P6YBUmIChl7VKgRberEdQ-Wolp53SqfwHbxlSo4-rdUgFYFAxImB622boeqUBBCtwybP0OTBJBT1CVm_FBr48Li5LkwR9DxPciCnc052ddohpjGuGZxsCqIJo2c-7LPEhH0Lx63VOFgfPIfBsrVqjDbPNrr5ApPUijKYZWurktb6ytTks8eFUSTyv3FDbE5HEng0qpE4mgSjdgBkEc8BgUfpm2QGvctINH9SioUJOJonxgTPYhbD4BEd-jdQHsltKFzkb3-Rm3lFhEu3_CQFxCeQ6yGe1the_qID3vnPfpSY6hyblgF5L_5d7bE7BWg8fm6rSwXv67L2sMwBOji6cuR0wVVvXfYxmgGIMGkVQrq-SPSdtCpx2BvBz2SqqN6a_98svP8ukvhwc_oJsN6VwEmTDFgutNf-XuGkuVii-k9-DncwuwD00LvJG1FhBvbvSyuv-a3LAJSqTmroemTDG0xzLn7ULFY5p-93sM0_ZNGFeW-lL_r1ldqM_5lFRKDta1Tkg7lT9-rHftgnpGs4zv7vGLIPzHpNiXjsKyCk-wMQrihhWlR15kiz7oKDeTf6wCIETg';
const USER_ID = 'amzn1.ask.account.AGE34MG3VIQ75D4Q5CXFK25GUOXHZ2MIVSII3QUCOT3CP44IPE25PLD3DWW7HLWO2KVC7PC7VUXSZZEFPVHJ6PTDYVYYESJE35CE6VEXCE3BI3AK24TGO4CJXFF3SZ7IA4QVJRZC6EN4MUF2WUP4IB4CGDLRZZMYQENOFNBYWFXZHMZ5PA6S6ERK7NGEPUSDHXWKH26UGMIATMI';
var amazonHelper = require ('./helpers/amazon');
var databaseHelper = require ('./helpers/database');
const config = require ('./config');
require ('isomorphic-fetch');
var express = require ('express');
var alexa = require ('alexa-app');
var bodyParser = require ('body-parser');
var MongoClient = require ('mongodb').MongoClient;
var ObjectID = require ('mongodb').ObjectID;
const router = express.Router ();
router.get ('/getSkill/:id', async (req, res, next) => {
try {
const id = req.params.id;
if (id.length !== 24){
res.json([]);
throw("error");
}
db.collection ('skill_list').find({_id: ObjectID(id)}).toArray((err,result)=>{
if (err){
throw err;
res.json([]);
}else{
res.json(result);
}
});
} catch (e) {
console.log ('error:', e);
next (e);
}
});
router.get ('/deleteSkill/:skillID', async (req, res, next) => {
try {
let id = req.params.id;
let result = db.collection('skill_list').remove({_id: ObjectID(id)},(err,result)=>{
if (err) throw err;
res.json(result);
});
} catch (e) {
console.log ('error:', e);
next (e);
}
});
router.post ('/updateSkill/:id', async (req, res, next) => {
try {
let id = req.params.id;
let skill = req.body;
delete skill._id;
if (id !== '-1'){
let completeResult = {databaseUpdate:false, amazonUpdate:false, amazonMessage:''};
let result = db.collection('skill_list').update({_id: ObjectID(id)}, skill,{upsert:true}, (err, result)=>{
if (err) throw(err);
completeResult.databaseUpdate = (JSON.parse(result).nModified===1);
let generatedInteractionModel = amazonHelper.generateInteractionModel(skill);
fetch(`https://api.amazonalexa.com/v0/skills/${skill.skillID}/interactionModel/locales/en-US`, {
method: 'POST',
headers: {
Authorization: TOKEN
},
body: generatedInteractionModel
}).then(l=>l.text()).then(result=>{
completeResult.amazonUpdate = (JSON.stringify(result)===JSON.stringify({}));
completeResult.amazonMessage = JSON.stringify(result);
res.json(completeResult);
});
});
}else{
//no new skills for now
}
} catch (e) {
console.log ('error:', e);
next (e);
}
});
var skillID = 'amzn1.ask.skill.7115bfc9-313e-4728-830b-ebd19ce96cb3';
var skillDbID = '5a232fb86ce046c749739455'; //_id in database
var app = express();
var app = express ();
// ALWAYS setup the alexa app and attach it to express before anything else.
var alexaApp = new alexa.app('step3'); // this means we still work with one skill
var alexaApp = new alexa.app ('step3'); // this means we still work with one skill
alexaApp.express({
alexaApp.express ({
expressApp: app,
// verifies requests come from amazon alexa. Must be enabled for production.
@@ -109,56 +25,108 @@ alexaApp.express({
// sets up a GET route when set to true. This is handy for testing in
// development, but not recommended for production. disabled by default
debug: true
debug: true,
});
// now POST calls to /test in express will be handled by the app.request() function
// from here on you can setup any other express routes or middlewares as normal
// from here on you can setup any other express routes or middlewares as nor
alexaApp.launch(function(request, response) {
const skill = db.collection('skill_list').findOne({_id: ObjectID(skillDbID)}, (err,result)=>{
if (err){
response.say("I could not find desired skill")
}else{
response.say(skill.invocationAnswer);
}
});
app.set ('view engine', 'ejs');
var updateIntentsJSON = function () {
databaseHelper
.loadSkill (config.SKILL_DB_ID)
.then (skill => {
skill.intents.map (intent => {
alexaApp.intent (
intent.intentName,
{
slots: [],
utterances: intent.questions,
},
function (request, response) {
return response.say (intent.answer).shouldEndSession(false);
}
);
});
alexaApp.launch ((request, response) => {
return response.say (skill.invocationAnswer).shouldEndSession(false);
});
})
.catch (err => {
console.log (err);
alexaApp.launch ((request, response) => {
return response.say ('Sorry, there was no skill with that name');
});
});
};
router.get ('/getSkill/:id', async (req, res, next) => {
const id = req.params.id;
if (id.length !== 24) {
res.json ([]);
} else {
databaseHelper
.getSkill (id)
.then (result => {
res.json (result);
})
.catch (err => {
res.json ([]);
});
}
});
var findElementByAttr = function (data, attr, val){
for(var i = 0; i < data.length; i ++) {
if(data[i][attr] === val) {
return i;
}
}
return -1;
}
alexaApp.request = (jsonRequest) => {
const alexaRequest = new alexa.request(jsonRequest);
if (alexaRequest.type() === "IntentRequest") {
const skill = db.collection('skill_list').findOne({
_id: skillDbID
router.get ('/deleteSkill/:skillID', async (req, res, next) => {
databaseHelper
.deleteSkill (req.params.id)
.then (result => {
res.json (result);
})
.catch (err => {
res.json (err);
});
if (skill) {
let intentId = findElementByAttr(skill.intents, 'intentName', alexaRequest.data.request.intent.name);
const response = new alexa.response(alexaRequest.getSession());
if (intentId !== -1){
return response.say(skill.intents[intentId].answer);
}else{
return response.say('Sorry, I could not find desired intent');
}
}
});
router.post ('/updateSkill/:id', async (req, res, next) => {
let id = req.params.id;
let skill = req.body;
delete skill._id;
console.log('id = ' + id);
if (id !== '-1') {
amazonHelper
.updateSkill (skill)
.then (amazonResult => {
console.log('amazon result : ' + amazonResult);
if (amazonResult === 200 || amazonResult === 202) {
//Skill uploaded, it's ok to update databaseI
databaseHelper
.updateSkill (id, skill)
.then (result => {
res.json ({result: 0, message: 'ok'});
updateIntentsJSON ();
})
.catch (e => {
res.json ({result: -1, message: 'ok'});
});
} else {
res.json ({result: -1, message: 'Amazon result ' + amazonResult});
}
})
.catch (e => {
//skill upload went wrong, don't update database, send error
res.json ({result: -1, message: e});
});
} else {
//no new skills for now
}
};
});
app.use (function (req, res, next) {
res.header ('Access-Control-Allow-Origin', '*');
res.header (
'Access-Control-Allow-Headers',
'Origin, Content-Type'
);
res.header ('Access-Control-Allow-Headers', 'Origin, Content-Type');
res.header ('Access-Control-Allow-Methods', 'GET, POST, OPTIONS');
res.header ('Access-Control-Allow-Credentials', 'true');
next ();
@@ -167,11 +135,16 @@ app.use (function (req, res, next) {
app.use (bodyParser.json ());
app.use ('/', router);
MongoClient.connect (config.dbURL)
.then (database => {
databaseHelper.initModule (database);
MongoClient.connect (dbURL).then (database => {
db = database;
db.collection ('intent_list');
app.listen (PORT, () =>
console.log ('Express server running on port ' + PORT)
);
});
app.listen (config.PORT, () => {
console.log ('Express server running on port ' + config.PORT);
updateIntentsJSON ();
databaseHelper.loadTokens ();
});
})
.catch (e => {
console.log ('error : ' + e);
});

View File

@@ -1,62 +1,131 @@
require('isomorphic-fetch');
require ('isomorphic-fetch');
const config = require ('../config');
var request = require ('request');
var databaseHelper = require ('./database');
var ObjectID = require ('mongodb').ObjectID;
var getBuildStatus = function (skillID) {
try {
fetch (
`https://api.amazonalexa.com/v0/skills/${skillID}/interactionModel/locales/en-US/status`,
{
method: 'GET',
headers: {
Authorization: config.TOKEN,
},
}
)
.then (l => l.text ())
.then (result => {
return result;
});
} catch (e) {
console.log ('err : ' + e);
}
};
var refreshTokens = function () {
return new Promise ((resolve, reject) => {
var options = {
method: 'POST',
url: 'https://api.amazon.com/auth/o2/token',
headers: {
'cache-control': 'no-cache',
'content-type': 'application/x-www-form-urlencoded',
},
form: {
grant_type: 'refresh_token',
refresh_token: config.REFRESH_TOKEN,
client_id: config.CLIENT_ID,
client_secret: config.CLIENT_SECRET,
},
};
var getBuildStatus = function(skillID){
try{
fetch(`https://api.amazonalexa.com/v0/skills/${skillID}/interactionModel/locales/en-US/status`, {
method: 'GET',
headers: {
Authorization: TOKEN
},
}).then(l=>l.text()).then(result=>{
return result;
});
}catch(e){
console.log("err : " + e);
request (options, function (error, response, body) {
if (error) reject (error);
parsedResponse = JSON.parse (body);
if (parsedResponse.refresh_token)
return databaseHelper.updateTokens (
parsedResponse.refresh_token,
parsedResponse.access_token,
parsedResponse.expires_in
);
});
});
};
var generateInteractionModel = function (skill) {
let result = {};
let allIntents = [];
let defaultIntents = [
{
name: 'AMAZON.CancelIntent',
samples: [],
},
{
name: 'AMAZON.HelpIntent',
samples: [],
},
{
name: 'AMAZON.StopIntent',
samples: [],
},
];
/*
defaultIntents.map(intent=>{
allIntents.push(intent);
});
*/
skill.intents.map (intent => {
allIntents.push ({name: intent.intentName, samples: intent.questions});
});
result.interactionModel = {};
result.interactionModel.languageModel = {
invocationName: skill.invocationName,
intents: allIntents,
};
return JSON.stringify (result);
};
var uploadSkill = function (skill) {
return fetch (
`https://api.amazonalexa.com/v0/skills/${skill.skillID}/interactionModel/locales/en-US`,
{
method: 'POST',
headers: {
Authorization: config.TOKEN,
},
body: generateInteractionModel (skill),
}
}
);
};
module.exports = {
generateInteractionModel: function(skill){
try{
let result = {};
let allIntents = [];
let defaultIntents = [{
name: "AMAZON.CancelIntent",
samples: []
},
{
name: "AMAZON.HelpIntent",
samples: []
},
{
name: "AMAZON.StopIntent",
samples: []
}];
/*
defaultIntents.map(intent=>{
allIntents.push(intent);
updateSkill: function (skill) {
return new Promise ((resolve, reject) => {
if (new Date () / 1000 > config.TOKEN_EXPIRES_IN) {
refreshTokens ()
.then (() => {
uploadSkill (skill).then (response => {
resolve (response.status);
});
*/
skill.intents.map(intent=>{
allIntents.push({name: intent.intentName, samples: intent.questions});
});
result.interactionModel = {};
result.interactionModel.languageModel = {
invocationName: skill.invocationName,
intents: allIntents
};
return JSON.stringify(result);
}catch(e){
console.log("error generate : " + e);
}
}
};
})
.catch (e => {
reject (e);
});
} else {
uploadSkill (skill)
.then (response => {
resolve (response.status);
})
.catch (e => {
reject (e);
});
}
});
},
};

106
backend/helpers/database.js Normal file
View File

@@ -0,0 +1,106 @@
const config = require ('../config');
var ObjectID = require ('mongodb').ObjectID;
var db = null;
module.exports = {
initModule: function (databaseObject) {
db = databaseObject;
db.collection ('intent_list');
},
loadTokens: function () {
db
.collection ('token_list')
.findOne ()
.then (tokens => {
if (tokens !== null) {
config.TOKEN = tokens.access_token;
config.REFRESH_TOKEN = tokens.refresh_token;
config.TOKEN_EXPIRES_IN = tokens.expires_in;
} else {
//Cannot continue without tokens
console.log ('Cannot continue without tokens in database');
process.exit (-1);
}
})
.catch (e => {
console.log (
'Error loading tokens ! Cannot continue without tokens in database'
);
process.exit (-1);
});
},
updateTokens: function (refresh_token, access_token, expires_in) {
return new Promise ((resolve, reject) => {
let newTokenDocument = {
id: 1,
refresh_token: refresh_token,
access_token: access_token,
expires_in: new Date () / 1000 + expires_in,
};
db
.collection ('token_list')
.update ({id: 1}, newTokenDocument, {upsert: true}, (err, result) => {
if (err) reject (err);
config.REFRESH_TOKEN = refresh_token;
config.TOKEN = access_token;
config.TOKEN_EXPIRES_IN = newTokenDocument.expires_in;
resolve ();
});
});
},
loadSkill: function (skillDbID) {
return new Promise ((resolve, reject) => {
db
.collection ('skill_list')
.findOne ({_id: ObjectID (skillDbID)}, (err, skill) => {
if (skill) {
resolve (skill);
} else {
reject (err);
}
});
});
},
updateSkill: function (id, skill) {
return new Promise ((resolve, reject) => {
db
.collection ('skill_list')
.update ({_id: ObjectID (id)}, skill, {upsert: true}, (err, result) => {
if (JSON.parse (result).nModified === 1) {
//database update ok
resolve ();
} else {
reject ();
}
});
});
},
deleteSkill: function (id) {
return new Promise ((resolve, reject) => {
db
.collection ('skill_list')
.remove ({_id: ObjectID (id)}, (err, result) => {
if (err) reject (err);
resolve (result);
});
});
},
getSkill: function (id) {
return new Promise ((resolve, reject) => {
db
.collection ('skill_list')
.find ({_id: ObjectID (id)})
.toArray ((err, result) => {
if (err) reject (err);
resolve (result);
});
});
},
};

View File

@@ -211,6 +211,16 @@
"concat-map": "0.0.1"
}
},
"bson": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/bson/-/bson-1.0.4.tgz",
"integrity": "sha1-k8ENOeqltYQVy8QFLz5T5WKwtyw="
},
"buffer-shims": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/buffer-shims/-/buffer-shims-1.0.0.tgz",
"integrity": "sha1-mXjOMXOIxkmth5MCjDR37wRKi1E="
},
"builtin-modules": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz",
@@ -428,6 +438,19 @@
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.1.tgz",
"integrity": "sha1-eePVhlU0aQn+bw9Fpd5oEDspTSA="
},
"encoding": {
"version": "0.1.12",
"resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz",
"integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=",
"requires": {
"iconv-lite": "0.4.19"
}
},
"es6-promise": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.2.1.tgz",
"integrity": "sha1-7FYjOGgDKQkgcXDDlEjiREndH8Q="
},
"escape-html": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
@@ -711,11 +734,30 @@
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.5.2.tgz",
"integrity": "sha1-1LUFvemUaYfM8PxY2QEP+WB+P6A="
},
"is-stream": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
"integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ="
},
"is-typedarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
"integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo="
},
"isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
},
"isomorphic-fetch": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz",
"integrity": "sha1-YRrhrPFPXoH3KVB0coGf6XM1WKk=",
"requires": {
"node-fetch": "1.7.3",
"whatwg-fetch": "2.0.3"
}
},
"isstream": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
@@ -819,6 +861,25 @@
"brace-expansion": "1.1.8"
}
},
"mongodb": {
"version": "2.2.33",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-2.2.33.tgz",
"integrity": "sha1-tTfEcdNKZlG0jzb9vyl1A0Dgi1A=",
"requires": {
"es6-promise": "3.2.1",
"mongodb-core": "2.1.17",
"readable-stream": "2.2.7"
}
},
"mongodb-core": {
"version": "2.1.17",
"resolved": "https://registry.npmjs.org/mongodb-core/-/mongodb-core-2.1.17.tgz",
"integrity": "sha1-pBizN6FKFJkPtRC5I97mqBMXPfg=",
"requires": {
"bson": "1.0.4",
"require_optional": "1.0.1"
}
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
@@ -840,6 +901,15 @@
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz",
"integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk="
},
"node-fetch": {
"version": "1.7.3",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz",
"integrity": "sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ==",
"requires": {
"encoding": "0.1.12",
"is-stream": "1.1.0"
}
},
"node-forge": {
"version": "0.7.1",
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.7.1.tgz",
@@ -910,6 +980,11 @@
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns="
},
"process-nextick-args": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz",
"integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M="
},
"proxy-addr": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.2.tgz",
@@ -945,6 +1020,20 @@
"unpipe": "1.0.0"
}
},
"readable-stream": {
"version": "2.2.7",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.2.7.tgz",
"integrity": "sha1-BwV6y+JGeyIELTb5jFrVBwVOlbE=",
"requires": {
"buffer-shims": "1.0.0",
"core-util-is": "1.0.2",
"inherits": "2.0.3",
"isarray": "1.0.0",
"process-nextick-args": "1.0.7",
"string_decoder": "1.0.3",
"util-deprecate": "1.0.2"
}
},
"request": {
"version": "2.83.0",
"resolved": "https://registry.npmjs.org/request/-/request-2.83.0.tgz",
@@ -974,6 +1063,15 @@
"uuid": "3.1.0"
}
},
"require_optional": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/require_optional/-/require_optional-1.0.1.tgz",
"integrity": "sha512-qhM/y57enGWHAe3v/NcwML6a3/vfESLe/sGM2dII+gEO0BpKRUkWZow/tyloNqJyN6kXSl3RyyM8Ll5D/sJP8g==",
"requires": {
"resolve-from": "2.0.0",
"semver": "5.4.1"
}
},
"resolve": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.5.0.tgz",
@@ -983,6 +1081,11 @@
"path-parse": "1.0.5"
}
},
"resolve-from": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-2.0.0.tgz",
"integrity": "sha1-lICrIOlP+h2egKgEx+oUdhGWa1c="
},
"safe-buffer": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz",
@@ -991,8 +1094,7 @@
"semver": {
"version": "5.4.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz",
"integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==",
"optional": true
"integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg=="
},
"send": {
"version": "0.16.1",
@@ -1065,6 +1167,14 @@
"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz",
"integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew=="
},
"string_decoder": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
"integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
"requires": {
"safe-buffer": "5.1.1"
}
},
"stringstream": {
"version": "0.0.5",
"resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz",
@@ -1182,6 +1292,11 @@
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
"integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw="
},
"util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
},
"utils-merge": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
@@ -1212,6 +1327,11 @@
"extsprintf": "1.3.0"
}
},
"whatwg-fetch": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.3.tgz",
"integrity": "sha1-nITsLc9oGH/wC8ZOEnS0QhduHIQ="
},
"wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",

View File

@@ -6,9 +6,11 @@
"dependencies": {
"alexa-app": "4.2.0",
"body-parser": "^1.13.1",
"ejs": "^2.3.1",
"ejs": "^2.5.7",
"express": "^4.13.0",
"isomorphic-fetch": "^2.2.1"
"isomorphic-fetch": "^2.2.1",
"mongodb": "^2.2.33",
"request": "^2.83.0"
},
"author": "Matt Kruse <github@mattkruse.com> (http://mattkruse.com/)",
"license": "MIT"

10
backend/views/test.ejs Normal file
View File

@@ -0,0 +1,10 @@
<div style="white-space:pre;border:1px solid black;margin:5px;padding:5px;font-family:monospace;">
Schema:
<%=schema%>
Utterances:
<%=utterances%>
</div>

File diff suppressed because it is too large Load Diff

10539
web/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -3,9 +3,11 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"keymaster": "^1.6.2",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-md": "^1.2.8",
"react-popup": "^0.9.1",
"react-scripts": "1.0.17",
"webfontloader": "^1.6.28"
},

View File

@@ -1,8 +1,10 @@
import React, { Component } from 'react';
import './css/App.css';
import './css/popup.css';
import IntentList from './components/IntentList';
import IntentDetails from './components/IntentDetails';
import LaunchRequest from './components/LaunchRequest';
import Popup from 'react-popup';
import {getSkill, updateSkill} from './lib/api'
@@ -19,7 +21,9 @@ class App extends Component {
allIntents:[],
selectedIntent: {intentName:'',questions:[''],answer:''},
selectedIndex:-1,
launchRequest:false};
launchRequest:false,
waiting: false
};
getSkill(this.state._id).then(l=> l.text()).then(result=>{
let jResult = JSON.parse(result)[0];
@@ -36,12 +40,15 @@ class App extends Component {
this.handleAddIntentClick = this.handleAddIntentClick.bind(this);
this.handleSaveLaunchRequestClick = this.handleSaveLaunchRequestClick.bind(this);
this.createSkill = this.createSkill.bind(this);
this.sendSkill = this.sendSkill.bind(this);
}
render() {
if(this.state.launchRequest){
return (
<div className="App">
<Popup/>
<div className="App-header">
<h1> Tell All </h1>
</div>
@@ -49,16 +56,20 @@ class App extends Component {
onLaunchRequestClick={this.handleLaunchRequestClick}
onIntentClick={this.handleIntentClick}
onAddIntentClick={this.handleAddIntentClick}
selectedIndex={this.state.selectedIndex}>
selectedIndex={this.state.selectedIndex}
waiting={this.state.waiting}>
</IntentList>
<LaunchRequest invocationName={this.state.invocationName}
invocationAnswer={this.state.invocationAnswer}
onSaveClick={this.handleSaveLaunchRequestClick}> </LaunchRequest>
onSaveClick={this.handleSaveLaunchRequestClick}
waiting={this.state.waiting}>
</LaunchRequest>
</div>
);
}else{
return (
<div className="App">
<Popup/>
<div className="App-header">
<h1> Tell All </h1>
</div>
@@ -66,11 +77,13 @@ class App extends Component {
onLaunchRequestClick={this.handleLaunchRequestClick}
onIntentClick={this.handleIntentClick}
onAddIntentClick={this.handleAddIntentClick}
selectedIndex={this.state.selectedIndex}>
selectedIndex={this.state.selectedIndex}
waiting={this.state.waiting}>
</IntentList>
<IntentDetails selectedIntent={this.state.selectedIntent}
onDeleteIntentClick={this.handleDeleteIntentClick}
onSaveIntentClick={this.handleSaveIntentClick}>
onSaveIntentClick={this.handleSaveIntentClick}
waiting={this.state.waiting}>
</IntentDetails>
</div>
);
@@ -96,66 +109,75 @@ class App extends Component {
}
handleSaveLaunchRequestClick(name, answer){
this.setState({invocationName: name, invocationAnswer: answer});
try{
updateSkill(this.createSkill(this.state.allIntents,name,answer)).then(l=>l.text()).then(result=>{
let jResult = JSON.parse(result);
if (!(jResult.databaseUpdate && jResult.amazonUpdate)){
alert('Database update : ' + jResult.databaseUpdate + '\r\nAmazon update : ' + jResult.amazonUpdate + '\r\nMessage : ' + jResult.amazonMessage);
}
});
}catch(e){
alert("exception");
}
this.setState({waiting:true, invocationName:name, invocationAnswer: answer});
this.sendSkill(this.state.allIntents,true,{waiting:false},{waiting:false},name,answer);
}
handleDeleteIntentClick(selectedIntent){
let id = this.state.allIntents.indexOf(selectedIntent);
let id = -1;
this.state.allIntents.map((intent,index)=>{
if ((id===-1) && (JSON.stringify(selectedIntent)===JSON.stringify(intent)))
id = index;
});
if (id!==-1){
try{
//I don't like this, state in database is different than component state, for some time
//TODO : move database operation in componentWillUpdate or componentDidUpdate
let newAllIntents = this.state.allIntents;
let newAllIntentsJSON = JSON.stringify(this.state.allIntents);
let newAllIntents = JSON.parse(newAllIntentsJSON);
newAllIntents.splice(id,1);
this.setState({allIntents: newAllIntents, selectedIntent: {intentName:'', questions:[''],answer:''}});
updateSkill(this.createSkill(newAllIntents)).then(l=>l.text()).then(result=>{
let jResult = JSON.parse(result);
if (!(jResult.databaseUpdate && jResult.amazonUpdate)){
alert('Database update : ' + jResult.databaseUpdate + '\r\nAmazon update : ' + jResult.amazonUpdate + '\r\nMessage : ' + jResult.amazonMessage);
}
});
this.setState({waiting:true});
let newState = {allIntents: newAllIntents, selectedIntent: {intentName:'', questions:[''],answer:''}, waiting:false};
this.sendSkill(newAllIntents,true,newState,{waiting:false});
}catch(e){
alert("exception");
console.log("error : " + e);
}
}
}
handleSaveIntentClick(selectedIntent){
let newAllIntents = this.state.allIntents;
let newAllIntentsJSON = JSON.stringify(this.state.allIntents);
let newAllIntents = JSON.parse(newAllIntentsJSON);
let newState = null;
if (this.state.selectedIndex === -1){
//new intent
newAllIntents.push(selectedIntent);
this.setState({allIntents: newAllIntents, selectedIntent: selectedIntent, selectedIndex: newAllIntents.length-1});
newState = {allIntents: newAllIntents, selectedIntent: selectedIntent, selectedIndex: newAllIntents.length-1, waiting:false};
}else{
newAllIntents[this.state.selectedIndex] = selectedIntent;
this.setState({allIntents: newAllIntents, selectedIntent: selectedIntent});
}
try{
updateSkill(this.createSkill(newAllIntents)).then(l=>l.text()).then(result=>{
let jResult = JSON.parse(result);
if (!(jResult.databaseUpdate && jResult.amazonUpdate)){
alert('Database update : ' + jResult.databaseUpdate + '\r\nAmazon update : ' + jResult.amazonUpdate + '\r\nMessage : ' + jResult.amazonMessage);
}
});
}catch(e){
alert("exception");
newState = {allIntents: newAllIntents, selectedIntent: selectedIntent, waiting: false};
}
this.setState({waiting:true});
this.sendSkill(newAllIntents, true, newState, {waiting:false});
}
handleAddIntentClick(){
this.setState({allIntents: this.state.allIntents, selectedIndex: -1,launchRequest:false,selectedIntent: {intentName:'',questions:[''], answer:''}});
}
sendSkill(newAllIntents, showPopUp, resolveState, rejectState, newName, newAnswer){
return new Promise((resolve,reject)=>{
updateSkill(this.createSkill(newAllIntents,newName,newAnswer)).then(l=>l.text()).then(result=>{
let jResult = JSON.parse(result);
if (jResult.result !== 0){
if (showPopUp) Popup.alert('Model was not saved. Please try again');
this.setState(rejectState);
//reject('Error code : ' + jResult.result);
}else{
if (showPopUp) Popup.alert('Saved');
this.setState(resolveState);
resolve();
}
}).catch(e=>{
if (showPopUp) Popup.alert('Model was not saved. Please try again');
this.setState(rejectState);
//reject(e);
});
});
}
}
export default App;

View File

@@ -71,9 +71,10 @@ class IntentDetails extends Component {
}
<br></br>
<br></br>
<Button style={{float:'left', marginLeft: '25px'}} flat primary onClick={()=>{this.props.onDeleteIntentClick(this.state.intent)}}>Delete intent</Button>
<Button style={{float:'left', marginLeft: '22%'}} flat primary swapTheming onClick={this.addQuestion}>Add question</Button>
<Button style={{float:'left', marginLeft: '20px'}} flat primary swapTheming onClick={()=>{this.props.onSaveIntentClick(this.state.intent)}}>Save</Button>
<Button style={{float:'left', marginLeft: '25px'}} flat primary onClick={()=>{this.props.onDeleteIntentClick(this.state.intent)}} disabled={this.props.waiting}>Delete intent</Button>
<Button style={{float:'left', marginLeft: '22%'}} flat primary swapTheming onClick={this.addQuestion} disabled={this.props.waiting}>Add question</Button>
<Button style={{float:'left', marginLeft: '20px'}} flat primary swapTheming onClick={()=>{this.props.onSaveIntentClick(this.state.intent)}} disabled={this.props.waiting}>Save</Button>
</div>
);
}

View File

@@ -21,9 +21,10 @@ class IntentItem extends Component {
<Button className={this.props.selectedIndex===this.state.index ? 'IntentItem-selected' : 'IntentItem'}
onClick={()=>{this.state.onClick(this.state.intent,this.state.index)}}
flat
disabled={this.props.waiting}
tooltipDelay={INTENT_TITLE_TOOLTIP_DELAY}
tooltipLabel={this.state.intent.intentName.length>INTENT_TITLE_MAX_LENGTH ? this.state.intent.questions[0] : ''}>
{this.state.index+1}. {buttonTitle}
{buttonTitle}
</Button>
<br></br>
</div>

View File

@@ -18,21 +18,25 @@ class IntentList extends Component {
return (
<div className="IntentList">
<Button className={this.props.selectedIndex===-2 ? "LaunchRequest-selected" : "LaunchRequest"} flat primary
onClick={this.props.onLaunchRequestClick}>Launch request</Button>
onClick={this.props.onLaunchRequestClick}
disabled={this.props.waiting} >Launch request</Button>
<div className="IntentList-title">
<h3>Intents</h3>
</div>
{
this.state.intents.map((intent,index)=>{
return <IntentItem
key={index} intent={intent} index={index}
key={intent.intentName} intent={intent} index={index}
selectedIndex={this.props.selectedIndex}
onClick={this.state.onIntentClick}>
onClick={this.state.onIntentClick}
waiting={this.props.waiting}>
</IntentItem>
})
}
<br></br>
<Button className={"AddIntent"} flat primary swapTheming onClick={this.props.onAddIntentClick}>Add intent</Button>
<Button className={"AddIntent"} flat primary swapTheming
onClick={this.props.onAddIntentClick}
disabled={this.props.waiting}>Add intent</Button>
</div>
);
}

View File

@@ -45,7 +45,9 @@ class LaunchRequest extends Component {
value={this.state.invocationAnswer}/>
<br></br>
<br></br>
<Button style={{float:'right', marginRight: '20px'}} flat primary swapTheming onClick={()=>{this.props.onSaveClick(this.state.invocationName, this.state.invocationAnswer)}}>Save</Button>
<Button style={{float:'right', marginRight: '20px'}} flat primary swapTheming
onClick={()=>{this.props.onSaveClick(this.state.invocationName, this.state.invocationAnswer)}}
disabled={this.props.waiting}>Save</Button>
</div>
);
}

View File

@@ -1,8 +1,7 @@
/*IntentList and IntentItem CSS*/
.IntentList {
width: 30%;
min-height: 9999px;
height: 9999px;
min-height: calc(100vh - 80px);
float: left;
background-color: #eff0f0; }
@@ -49,8 +48,7 @@
.IntentDetails {
float: left;
width: 70%;
min-height: 9999px;
height: 9999px;
min-height: calc(100vh - 80px);
background-color: #f5f5f5; }
.QuestionBox {
@@ -60,8 +58,7 @@
.LaunchRequestBox {
float: left;
width: 70%;
min-height: 9999px;
height: 9999px;
min-height: calc(100vh - 80px);
background-color: #f5f5f5; }
.ExplanationText {

View File

@@ -1,9 +1,10 @@
$minHeight : calc(100vh - 80px);
/*IntentList and IntentItem CSS*/
.IntentList{
width: 30%;
min-height:9999px;
height:9999px;
min-height:$minHeight;
float:left;
background-color: #eff0f0;
}
@@ -59,8 +60,7 @@
.IntentDetails{
float: left;
width: 70%;
min-height:9999px;
height:9999px;
min-height:$minHeight;
background-color: #f5f5f5;
}
@@ -73,8 +73,7 @@
.LaunchRequestBox{
float: left;
width:70%;
min-height: 9999px;
height: 9999px;
min-height:$minHeight;
background-color: #f5f5f5;
}

View File

@@ -2,7 +2,6 @@
@include react-md-everything;
body {
margin: 0;
padding: 0;

174
web/src/css/popup.scss Normal file
View File

@@ -0,0 +1,174 @@
.mm-popup {
display: none; }
.mm-popup--visible {
display: block; }
.mm-popup__overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1000;
overflow: auto;
background: rgba(0, 0, 0, 0.1); }
.mm-popup__close {
position: absolute;
top: 15px;
right: 20px;
padding: 0;
width: 20px;
height: 20px;
cursor: pointer;
outline: none;
text-align: center;
border-radius: 10px;
border: none;
text-indent: -9999px;
background: transparent url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAABGdBTUEAALGPC/xhBQAAB8BJREFUWAnFWAtsU1UY/s+5XTcYYxgfvERQeQXxNeYLjVFxLVvb2xasKIgSVNQoREVI1GhmfC6ioijiNDo1vBxb19uVtRWUzAQ1+EowOkSQzTBAUJio27r2Hr9TLJTaa7vK4yTtvec///+f7/znf5xzGf2PZnVMKRHUczEJNpgYDSEdPzTB6GdG1EbE2sxk+qqxsW5rrtNAT+/aZLtrkiDdLYhUIcSwQ9KsA7DaAbKdEWOCQBckxwrkOGP0Lf7rTAqrW+vzbT4kk91/1gAB7BqdYlVC0KUAsQuANOKKjwYUNYfff//PdNNZ3O4zqEe/FguZykhUYFGFQKspnBYGNW1LOplUWkaANtvUc3pY5FUAKwewb4jzR0KaN8ikoXr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YgSAXRBPuoI+JS5WDzn11DdramqwyOxarwAmq7Ta3RfqIqZCwWhYZjicHbdDGhoHLeTXfmrHUWwngDaTWWkMe72/JMtn+/43YTIL+pAwwhkAAAAASUVORK5CYII=") no-repeat center center;
background-size: 100%;
margin: 0; }
.mm-popup__input {
display: block;
width: 100%;
height: 30px;
border-radius: 3px;
background: #f5f5f5;
border: 1px solid #e9ebec;
outline: none;
-moz-box-sizing: border-box !important;
-webkit-box-sizing: border-box !important;
box-sizing: border-box !important;
font-size: 14px;
padding: 0 12px;
color: #808080; }
.mm-popup__btn {
border-radius: 3px;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
padding: 0 10px;
margin: 0;
line-height: 32px;
height: 32px;
border: 1px solid #666;
text-align: center;
display: inline-block;
font-size: 12px;
font-weight: 400;
color: #333;
background: transparent;
outline: none;
text-decoration: none;
cursor: pointer;
font-family: "Open Sans", sans-serif; }
.mm-popup__btn--success {
background-color: #27ae60;
border-color: #27ae60;
color: #fff; }
.mm-popup__btn--danger {
background-color: #c5545c;
border-color: #c5545c;
color: #fff; }
.mm-popup__box {
width: 350px;
position: fixed;
top: 10%;
left: 50%;
margin-left: -175px;
background: #fff;
box-shadow: 0px 5px 20px 0px rgba(126, 137, 140, 0.2);
border-radius: 5px;
border: 1px solid #B8C8CC;
overflow: hidden;
z-index: 1001; }
.mm-popup__box__header {
padding: 15px 20px;
background: #EDF5F7;
color: #454B4D; }
.mm-popup__box__header__title {
margin: 0;
font-size: 16px;
text-align: left;
font-weight: 600; }
.mm-popup__box__body {
padding: 20px;
line-height: 1.4;
font-size: 14px;
color: #454B4D;
background: #fff;
position: relative;
z-index: 2; }
.mm-popup__box__body p {
margin: 0 0 5px; }
.mm-popup__box__footer {
overflow: hidden;
padding: 40px 20px 20px; }
.mm-popup__box__footer__right-space {
float: right; }
.mm-popup__box__footer__right-space .mm-popup__btn {
margin-left: 5px; }
.mm-popup__box__footer__left-space {
float: left; }
.mm-popup__box__footer__left-space .mm-popup__btn {
margin-right: 5px; }
.mm-popup__box--popover {
width: 300px;
margin-left: -150px; }
.mm-popup__box--popover .mm-popup__close {
position: absolute;
top: 5px;
right: 5px;
padding: 0;
width: 20px;
height: 20px;
cursor: pointer;
outline: none;
text-align: center;
border-radius: 10px;
border: none;
text-indent: -9999px;
background: transparent url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAABGdBTUEAALGPC/xhBQAAB8BJREFUWAnFWAtsU1UY/s+5XTcYYxgfvERQeQXxNeYLjVFxLVvb2xasKIgSVNQoREVI1GhmfC6ioijiNDo1vBxb19uVtRWUzAQ1+EowOkSQzTBAUJio27r2Hr9TLJTaa7vK4yTtvec///+f7/znf5xzGf2PZnVMKRHUczEJNpgYDSEdPzTB6GdG1EbE2sxk+qqxsW5rrtNAT+/aZLtrkiDdLYhUIcSwQ9KsA7DaAbKdEWOCQBckxwrkOGP0Lf7rTAqrW+vzbT4kk91/1gAB7BqdYlVC0KUAsQuANOKKjwYUNYfff//PdNNZ3O4zqEe/FguZykhUYFGFQKspnBYGNW1LOplUWkaANtvUc3pY5FUAKwewb4jzR0KaN8ikoXrRZs2aVbBr3/6bddKfhHUHAugys+j3eCCwYv9/qflPgFab83ps52ookxZ6OOT3regtsNTJHY45fSO05yGh6wsFsZ1cIVtI035M5Uv0DQFabY77BWOLsNrmQrPi8Xq9vyaEjsXT4pg6VuiRABZfzAVzhwK+T9Lp5emIFru6QCd6CXv4+sRLSizHGpycM+yvayng/S6Do7QIJtZZVXVyOiz/sqDV4XAKweoxsDjUqM1PJ3QsaeVz5+bHtrc2IjWVmky8tKmhYVuy/qMsWOZyXSR0Wo4IDVxRWrIgmfF4vTctWdINF7oJljwQ7dG9lpkzC5PnOgywsrKSU1R/Gz6xo7hPwXT0scsnpkkXEnncjTw6kvZ3vJI8q5Lo5BUV3YaAuFthyjStof6HBP1EPbe3tOweNWpMF0AuGHveuNqtLS375NxxC8rQB7inkOd8wc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KGwFJ+WasL+hwZjryEjY5/vZTObrYJFmznHJzNA+2/S1dI2BsLysUBBDw8qGdOr0Ixz75XCj/2FJOxlNpiyrQ/0CuZmF/b4Jhy2I2ie/qywFqHkAO/BkgJNzWu3OW7GTJZzT/EQV+meL5Veewudg0FhnjJacDIAul2sATlZPw3gavjR8nMBwGCDOofuA+m74o0de3BMMJ+KJwDD9GY2twdGtH+7GDybPeZTTbvthy+aRo8cUYxWPjhw1duO2rVu2JzMfr3dzYZF0LzdTmCvk832RPM9hCyaIEy+ZsBBpoRnlqyGXy1FCTzbPeKm0q1WoGnch1c0La9qHqXLxKE4lyqrS0YlKQVTBhJifKGOpfP+nXz5jRv9Yx8HliFwbXOtR1PFn0+lLC1Ayylrb0dn1IqJqHmr1alL4ApnT0inpLa1MVa9kungLQYk7B90SDGiakQ5DgAkBi02djeiqgrJC3A8WiQHFVUZfVBMyRs9yp3McrpPPIhHjXs02m0zspiafT54jDVtGgFJSpoDOqP4YfOU+KO+Cco1xsYaPGBHMdFOTRaBbl9+zyYlcWwZ17Vjw41dOmPAefDDj95+sACaWV+5ynQsLzMZ104NAGoVo/0Oe/eDgrVDUhtl2gl7IOA2Of/FnYgSAXRBPuoI+JS5WDzn11DdramqwyOxarwAmq7Ta3RfqIqZCwWhYZjicHbdDGhoHLeTXfmrHUWwngDaTWWkMe72/JMtn+/43YTIL+pAwwhkAAAAASUVORK5CYII=") no-repeat center center;
background-size: 100%;
margin: 0;
z-index: 3; }
.mm-popup__box--popover .mm-popup__box__body {
padding: 20px; }
@media (max-width: 420px) {
.mm-popup__box {
width: auto;
left: 10px;
right: 10px;
top: 10px;
margin-left: 0; }
.mm-popup__box__footer__left-space {
float: none; }
.mm-popup__box__footer__right-space {
float: none; }
.mm-popup__box__footer {
padding-top: 30px; }
.mm-popup__box__footer .mm-popup__btn {
display: block;
width: 100%;
text-align: center;
margin-top: 10px; } }