UNPKG

calamarcopollo

Version:
20 lines (14 loc) 1.63 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _replies = require('../../replies'); var _actionCreators = require('../actionCreators'); var _calamars = require('calamars'); const { getEntityValue } = _calamars.WitDriver; const routes = [[outcomes => getEntityValue(outcomes, 'interaction') === 'close', (outcomes, { store, chat, date }) => { store.dispatch((0, _actionCreators.updateChatSession)({ date, chat: _extends({}, chat, { session: {} }) })); return _replies.replies.close(); }], [outcomes => getEntityValue(outcomes, 'interaction') === 'laugh' || getEntityValue(outcomes, 'interaction') === 'laught', _replies.replies.laugh], [outcomes => getEntityValue(outcomes, 'interaction') === 'compliment', _replies.replies.compliment], [outcomes => getEntityValue(outcomes, 'interaction') === 'thanks', _replies.replies.thanks], [outcomes => getEntityValue(outcomes, 'interaction') === 'nameOrigin', _replies.replies.nameOrigin], [outcomes => getEntityValue(outcomes, 'interaction') === 'how are you', _replies.replies.howAreYou], [outcomes => getEntityValue(outcomes, 'interaction') === 'greeting', (outcomes, { from } = { from: null }) => from && (from.first_name || from.username) ? _replies.replies.greeting.username(from.first_name || from.username) : _replies.replies.greeting.noUsername()]]; exports.default = routes;