Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@evo/chat-core

Package Overview
Dependencies
Maintainers
11
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@evo/chat-core - npm Package Compare versions

Comparing version 0.6.0 to 0.7.0

56

lib/besida.js

@@ -599,2 +599,10 @@ 'use strict';

}, {
key: 'sendTyping',
value: function sendTyping(roomIdent) {
return this.oSwindon.call('chat.topic_publish', [], {
room_ident: roomIdent,
subject: c.BESIDA_SWINDON_TYPING_SUBJECT
}).catch(this.handleRequestErrors);
}
}, {
key: 'doMessage',

@@ -621,4 +629,4 @@ value: function doMessage(topic, data) {

}
baseStore = baseStore.setIn([setInEntity, setInIndex], updReceiveRoom);
this.clearTypingByUserIdent(topic, data.user_ident);

@@ -670,3 +678,3 @@ this.message && this.message(topic, this.dataFormatter(_immutable2.default.fromJS(data)));

baseStore = baseStore.setIn(lastReadImmPath, baseStore.getIn(lastReadImmPath).merge(_immutable2.default.fromJS(_defineProperty({}, data['user_ident'], data))));
baseStore = baseStore.setIn(lastReadImmPath, baseStore.getIn(lastReadImmPath).merge(_immutable2.default.fromJS(_defineProperty({}, data.user_ident, data))));

@@ -685,6 +693,50 @@ baseStore = (0, _utils.postProcessChatsForStore)(baseStore);

}, {
key: 'clearTypingById',
value: function clearTypingById(topic, typingId) {
var _getRoomData10 = (0, _utils.getRoomData)(baseStore, topic),
setInEntity = _getRoomData10.setInEntity,
setInIndex = _getRoomData10.setInIndex;
var typingImmPath = [setInEntity, setInIndex, 'typing'];
baseStore = baseStore.setIn(typingImmPath, baseStore.getIn(typingImmPath).filter(function (t) {
return t.get('typingId') !== typingId;
}));
this.typing && this.typing(topic, this.dataFormatter());
}
}, {
key: 'clearTypingByUserIdent',
value: function clearTypingByUserIdent(topic, userIdent) {
var _getRoomData11 = (0, _utils.getRoomData)(baseStore, topic),
setInEntity = _getRoomData11.setInEntity,
setInIndex = _getRoomData11.setInIndex;
var typingImmPath = [setInEntity, setInIndex, 'typing'];
baseStore = baseStore.setIn(typingImmPath, baseStore.getIn(typingImmPath).filter(function (t) {
return t.get('user_ident') !== userIdent;
}));
this.typing && this.typing(topic, this.dataFormatter());
}
}, {
key: 'doTyping',
value: function doTyping(topic, data) {
var _this14 = this;
if (this.debug) console.log('Swindon typing', topic, data);
var _getRoomData12 = (0, _utils.getRoomData)(baseStore, topic),
setInEntity = _getRoomData12.setInEntity,
setInIndex = _getRoomData12.setInIndex;
var typingImmPath = [setInEntity, setInIndex, 'typing'];
!baseStore.getIn(typingImmPath) && (baseStore = baseStore.setIn(typingImmPath, _immutable2.default.List()));
var typingId = (0, _uuid2.default)();
baseStore = baseStore.setIn(typingImmPath, baseStore.getIn(typingImmPath).push(_immutable2.default.fromJS(Object.assign({ typingId: typingId }, data))));
setTimeout(function () {
return _this14.clearTypingById(topic, typingId);
}, c.BESIDA_TYPING_DELAY);
this.typing && this.typing(topic, this.dataFormatter(_immutable2.default.fromJS(data)));

@@ -691,0 +743,0 @@ }

@@ -16,2 +16,3 @@ 'use strict';

var BESIDA_SWINDON_LEAVE_ROOM_SUBJECT = exports.BESIDA_SWINDON_LEAVE_ROOM_SUBJECT = 'leave_room';
var BESIDA_TYPING_DELAY = exports.BESIDA_TYPING_DELAY = 5000;

@@ -18,0 +19,0 @@ // registry statuses

@@ -6,3 +6,3 @@ 'use strict';

});
exports.MESSAGE_TYPE_NOTIFICATION = exports.MESSAGE_TYPE_CONTEXT = exports.MESSAGE_TYPE_MESSAGE = exports.MESSAGE_STATUS_READ = exports.MESSAGE_STATUS_SENDING = exports.MESSAGE_STATUS_NOT_DELIVERED = exports.MESSAGE_STATUS_DELIVERED = exports.ERROR_UNIQUE_USERS = exports.ERROR_TYPE_CAPS_LOCK = exports.ERROR_TYPE_STOP_WORD = exports.REGISTRY_STATUS_OFFLINE = exports.REGISTRY_STATUS_INACTIVE = exports.REGISTRY_STATUS_ACTIVE = exports.CONTEXT_TYPE_ORDER = exports.CONTEXT_TYPE_PRODUCT = exports.CHAT_STATUS_ARCHIVE = exports.CHAT_STATUS_BANNED = exports.CHAT_STATUS_ACTIVE = exports.BESIDA_ROLE_BUYER = exports.BESIDA_ROLE_COMPANY = exports.getUserRoleInRoom = exports.getCurrentUserIdent = exports.getRoom = exports.getAllChats = exports.Besida = undefined;
exports.MESSAGE_TYPE_NOTIFICATION = exports.MESSAGE_TYPE_CONTEXT = exports.MESSAGE_TYPE_MESSAGE = exports.MESSAGE_STATUS_READ = exports.MESSAGE_STATUS_SENDING = exports.MESSAGE_STATUS_NOT_DELIVERED = exports.MESSAGE_STATUS_DELIVERED = exports.ERROR_UNIQUE_USERS = exports.ERROR_TYPE_CAPS_LOCK = exports.ERROR_TYPE_STOP_WORD = exports.REGISTRY_STATUS_OFFLINE = exports.REGISTRY_STATUS_INACTIVE = exports.REGISTRY_STATUS_ACTIVE = exports.CONTEXT_TYPE_ORDER = exports.CONTEXT_TYPE_PRODUCT = exports.CHAT_STATUS_ARCHIVE = exports.CHAT_STATUS_BANNED = exports.CHAT_STATUS_ACTIVE = exports.BESIDA_TYPING_DELAY = exports.BESIDA_ROLE_BUYER = exports.BESIDA_ROLE_COMPANY = exports.getUserRoleInRoom = exports.getCurrentUserIdent = exports.getRoom = exports.getAllChats = exports.Besida = undefined;

@@ -23,2 +23,8 @@ var _constants = require('./constants');

});
Object.defineProperty(exports, 'BESIDA_TYPING_DELAY', {
enumerable: true,
get: function get() {
return _constants.BESIDA_TYPING_DELAY;
}
});
Object.defineProperty(exports, 'CHAT_STATUS_ACTIVE', {

@@ -25,0 +31,0 @@ enumerable: true,

2

lib/utils.js

@@ -266,3 +266,3 @@ 'use strict';

function getUserRoleInRoom(userIdent, receiveRoom) {
var user = receiveRoom.get('users').find(function (u) {
var user = receiveRoom.get('users') && receiveRoom.get('users').find(function (u) {
return u.get('ident') === userIdent;

@@ -269,0 +269,0 @@ });

{
"name": "@evo/chat-core",
"version": "0.6.0",
"version": "0.7.0",
"description": "core Besida module with base functional set for chat",

@@ -5,0 +5,0 @@ "author": "d.medvinskiy",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc