happychat-service
Advanced tools
Comparing version 0.10.8-5 to 0.10.8
@@ -47,3 +47,3 @@ 'use strict'; | ||
if (e) { | ||
return debug('failed to add agent role', role, e.description); | ||
return debug('failed to add agent role', role, e.message); | ||
} | ||
@@ -63,3 +63,3 @@ done(); | ||
}, function (e) { | ||
return debug('connection closed', e.description); | ||
return debug('connection closed', e.message); | ||
}); | ||
@@ -66,0 +66,0 @@ }); |
@@ -101,3 +101,3 @@ 'use strict'; | ||
join(io, action.socket).catch(function (e) { | ||
return debug('Failed to add user socket to broadcast', action.user.id, e.description); | ||
return debug('Failed to add user socket to broadcast', action.user.id, e.message); | ||
}); | ||
@@ -104,0 +104,0 @@ listen(action.socket); |
@@ -140,3 +140,3 @@ 'use strict'; | ||
}, function (e) { | ||
return debug('customer auth failed', e.description); | ||
return debug('customer auth failed', e.message); | ||
}); | ||
@@ -287,3 +287,3 @@ }); | ||
removeOperatorFromChat(operator, chat).catch(function (e) { | ||
return debug('failed to remove operator from chat', e.description); | ||
return debug('failed to remove operator from chat', e.message); | ||
}); | ||
@@ -330,3 +330,3 @@ }, function (chat_id) { | ||
removeOperatorsFromChat(chat).catch(function (e) { | ||
return debug('failed to remove operator sockets from chat', chat.id, e.description); | ||
return debug('failed to remove operator sockets from chat', chat.id, e.message); | ||
}); | ||
@@ -348,3 +348,3 @@ }; | ||
}, function (e) { | ||
return debug('failed to remove operator sockets from chat', chat_id, e.description); | ||
return debug('failed to remove operator sockets from chat', chat_id, e.message); | ||
}); | ||
@@ -376,3 +376,3 @@ }; | ||
}, function (e) { | ||
debug('failed to transfer chat', e.description); | ||
debug('failed to transfer chat', e.message); | ||
store.dispatch((0, _actions.setChatMissed)(chat.id, e)); | ||
@@ -420,3 +420,3 @@ }); | ||
}, function (e) { | ||
return debug('failed to reassign chats to operator', operator.id, e.description); | ||
return debug('failed to reassign chats to operator', operator.id, e.message); | ||
}); | ||
@@ -442,3 +442,3 @@ }; | ||
}, function (e) { | ||
return debug('Failed to recover chats for operator', operator.id, e.description); | ||
return debug('Failed to recover chats for operator', operator.id, e.message); | ||
}); | ||
@@ -445,0 +445,0 @@ }; |
@@ -162,3 +162,3 @@ 'use strict'; | ||
}).catch(function (e) { | ||
return debug(e.description); | ||
return debug(e.message); | ||
}); | ||
@@ -175,3 +175,2 @@ }); | ||
log.customer.findLog(chat.id).then(function (messages) { | ||
debug('emitting chat log to customer', user, messages.length, log.customer); | ||
socket.emit('log', messages); | ||
@@ -186,3 +185,2 @@ }); | ||
debug('emitting chat log to operator', operator.id); | ||
log.operator.findLog(chat.id).then(function (messages) { | ||
@@ -215,3 +213,2 @@ socket.emit('log', chat, messages); | ||
debug('customer message action', action, chat.id, message.id, message.text); | ||
var origin = 'customer'; | ||
@@ -227,3 +224,3 @@ runMiddleware({ origin: origin, destination: 'customer', chat: chat, message: message }).then(function (m) { | ||
}).catch(function (e) { | ||
return debug('middleware failed ', e.description); | ||
return debug('middleware failed ', e.message); | ||
}); | ||
@@ -234,3 +231,3 @@ | ||
}).catch(function (e) { | ||
return debug('middleware failed', e.description); | ||
return debug('middleware failed', e.message); | ||
}); | ||
@@ -247,3 +244,3 @@ | ||
}).catch(function (e) { | ||
return debug('middleware failed', e.description); | ||
return debug('middleware failed', e.message); | ||
}); | ||
@@ -250,0 +247,0 @@ }; |
@@ -6,3 +6,3 @@ 'use strict'; | ||
}); | ||
exports.operatorRoom = exports.customerRoom = exports.STATUS_AVAILABLE = undefined; | ||
exports.operatorRoom = exports.customerRoom = undefined; | ||
@@ -19,4 +19,2 @@ var _util = require('../../util'); | ||
var STATUS_AVAILABLE = exports.STATUS_AVAILABLE = 'available'; | ||
var identityForUser = function identityForUser(_ref) { | ||
@@ -62,3 +60,3 @@ var id = _ref.id, | ||
if (error) { | ||
debug('failed to query clients', error.description); | ||
debug('failed to query clients', error.message); | ||
return; | ||
@@ -119,3 +117,3 @@ } | ||
}, function (e) { | ||
return debug('operator auth failed', e.description); | ||
return debug('operator auth failed', e.message); | ||
}); | ||
@@ -122,0 +120,0 @@ }); |
@@ -6,3 +6,3 @@ 'use strict'; | ||
}); | ||
exports.isOperatorAcceptingChats = exports.isOperatorOnline = exports.isOperatorStatusAvailable = exports.getOperatorOnline = exports.getOperatorIdentity = exports.isSystemAcceptingCustomers = exports.getSystemAcceptsCustomers = exports.haveAvailableCapacity = exports.getAvailableCapacity = exports.selectTotalCapacity = exports.selectUser = exports.selectSocketIdentity = exports.selectIdentities = exports.getAvailableOperators = undefined; | ||
exports.isOperatorAcceptingChats = exports.isOperatorOnline = exports.isOperatorStatusAvailable = exports.getOperatorOnline = exports.getOperatorIdentity = exports.isSystemAcceptingCustomers = exports.getSystemAcceptsCustomers = exports.haveAvailableCapacity = exports.getAvailableCapacity = exports.selectTotalCapacity = exports.selectUser = exports.selectSocketIdentity = exports.selectIdentities = exports.getAvailableOperators = exports.STATUS_AVAILABLE = undefined; | ||
@@ -21,6 +21,6 @@ var _get = require('lodash/get'); | ||
var _socketIo = require('../middlewares/socket-io'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var STATUS_AVAILABLE = exports.STATUS_AVAILABLE = 'available'; | ||
var weight = function weight(_ref) { | ||
@@ -48,3 +48,3 @@ var load = _ref.load, | ||
if (!online || status !== _socketIo.STATUS_AVAILABLE) { | ||
if (!online || status !== STATUS_AVAILABLE) { | ||
return false; | ||
@@ -72,3 +72,3 @@ } | ||
var identities = _ref6.operators.identities; | ||
var matchingStatus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _socketIo.STATUS_AVAILABLE; | ||
var matchingStatus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : STATUS_AVAILABLE; | ||
return (0, _reduce2.default)(identities, function (_ref7, _ref8) { | ||
@@ -79,7 +79,12 @@ var totalLoad = _ref7.load, | ||
capacity = _ref8.capacity, | ||
status = _ref8.status; | ||
return { | ||
load: totalLoad + (status === matchingStatus ? parseInt(load) : 0), | ||
capacity: totalCapacity + (status === matchingStatus ? parseInt(capacity) : 0) | ||
}; | ||
status = _ref8.status, | ||
online = _ref8.online; | ||
return (0, _ramda.ifElse)((0, _ramda.whereEq)({ status: matchingStatus, online: true }), function () { | ||
return { | ||
load: totalLoad + parseInt(load), | ||
capacity: totalCapacity + parseInt(capacity) | ||
}; | ||
}, function () { | ||
return { load: totalLoad, capacity: totalCapacity }; | ||
})({ status: status, online: online }); | ||
}, { load: 0, capacity: 0 }); | ||
@@ -115,3 +120,3 @@ }; | ||
var isOperatorStatusAvailable = exports.isOperatorStatusAvailable = function isOperatorStatusAvailable(id, state) { | ||
return (0, _ramda.equals)((0, _ramda.view)((0, _ramda.lensPath)(['operators', 'identities', (0, _util.asString)(id), 'status']), state), _socketIo.STATUS_AVAILABLE); | ||
return (0, _ramda.equals)((0, _ramda.view)((0, _ramda.lensPath)(['operators', 'identities', (0, _util.asString)(id), 'status']), state), STATUS_AVAILABLE); | ||
}; | ||
@@ -118,0 +123,0 @@ var isOperatorOnline = exports.isOperatorOnline = getOperatorOnline; |
@@ -58,3 +58,3 @@ 'use strict'; | ||
} catch (e) { | ||
debug('ACTION_ERROR', action.type, e.descripton); | ||
debug('ACTION_ERROR', action.type, e.message); | ||
debug('ACTION', action); | ||
@@ -61,0 +61,0 @@ throw e; |
{ | ||
"name": "happychat-service", | ||
"version": "0.10.8-5", | ||
"version": "0.10.8", | ||
"description": "Socket.IO based chat server for happychat.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
2076
90932