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.7.8 to 0.7.9

3

lib/besida.js

@@ -501,4 +501,3 @@ 'use strict';

var msgId = (0, _uuid2.default)();
var body = '';
var sendingMessage = (0, _utils.prepareMessage)(baseStore, msgId, roomIdent, body, platform, source, device, isTemporaryMessage, contextItemId, contextItemType, contextItemPrice, contextItemCurrency, contextSource, contextDescription, contextMeta);
var sendingMessage = (0, _utils.prepareContextMessage)(baseStore, msgId, roomIdent, platform, source, device, isTemporaryMessage, contextItemId, contextItemType, contextItemPrice, contextItemCurrency, contextSource, contextDescription, contextMeta);
updReceiveRoom = (0, _utils.insertMessage)(updReceiveRoom, sendingMessage);

@@ -505,0 +504,0 @@ baseStore = baseStore.setIn(roomPath, updReceiveRoom);

@@ -45,3 +45,5 @@ 'use strict';

// context types
var CONTEXT_TYPE_COMPANY = exports.CONTEXT_TYPE_COMPANY = 0;
var CONTEXT_TYPE_PRODUCT = exports.CONTEXT_TYPE_PRODUCT = 1;
var CONTEXT_TYPE_OPINION = exports.CONTEXT_TYPE_OPINION = 2;
var CONTEXT_TYPE_ORDER = exports.CONTEXT_TYPE_ORDER = 3;

@@ -48,0 +50,0 @@

@@ -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_TYPING_DELAY = 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_OPINION = exports.CONTEXT_TYPE_PRODUCT = exports.CONTEXT_TYPE_COMPANY = 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;

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

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

@@ -54,2 +60,8 @@ enumerable: true,

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

@@ -56,0 +68,0 @@ enumerable: true,

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

exports.prepareMessage = prepareMessage;
exports.prepareContextMessage = prepareContextMessage;

@@ -243,6 +244,5 @@ var _immutable = require('immutable');

function getMessageById(receiveRoom, msgId) {
var message = receiveRoom.get('history').find(function (m) {
return receiveRoom.get('history').find(function (m) {
return m.get('id') === msgId;
});
return message;
}

@@ -274,21 +274,41 @@ function updateMessageById(receiveRoom, updMsgId, message) {

var isTemporaryMessage = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
var contextItemId = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : null;
var contextItemType = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : null;
var contextItemPrice = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : null;
var contextItemCurrency = arguments.length > 11 && arguments[11] !== undefined ? arguments[11] : null;
var contextSource = arguments.length > 12 && arguments[12] !== undefined ? arguments[12] : null;
var contextDescription = arguments.length > 13 && arguments[13] !== undefined ? arguments[13] : null;
var contextMeta = arguments.length > 14 && arguments[14] !== undefined ? arguments[14] : null;
var _getRoomData = getRoomData(baseStore, roomIdent),
receiveRoom = _getRoomData.room;
return _immutable2.default.fromJS({
id: msgId,
user_ident: getCurrentUserIdent(baseStore),
room_ident: roomIdent,
date_sent: new Date().getTime(),
type: c.MESSAGE_TYPE_MESSAGE,
isErrorOnSending: false,
isTemporaryMessage: isTemporaryMessage,
platform: platform,
source: source,
device: device,
body: body
});
}
var currentUserIdent = getCurrentUserIdent(baseStore);
function prepareContextMessage(baseStore, msgId, roomIdent, platform, source, device) {
var isTemporaryMessage = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
var contextItemId = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
var contextItemType = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : null;
var contextItemPrice = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : null;
var contextItemCurrency = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : null;
var contextSource = arguments.length > 11 && arguments[11] !== undefined ? arguments[11] : null;
var contextDescription = arguments.length > 12 && arguments[12] !== undefined ? arguments[12] : null;
var contextMeta = arguments.length > 13 && arguments[13] !== undefined ? arguments[13] : null;
var body = '';
// this kostil need when we render dialog view and check context type
var cntxType = void 0;
switch (contextItemType) {
case 'company':
cntxType = c.CONTEXT_TYPE_COMPANY;
break;
case 'product':
cntxType = c.CONTEXT_TYPE_PRODUCT;
break;
case 'opinion':
cntxType = c.CONTEXT_TYPE_OPINION;
break;
case 'order':

@@ -301,10 +321,5 @@ cntxType = c.CONTEXT_TYPE_ORDER;

}
return _immutable2.default.fromJS({
id: msgId,
user_ident: getCurrentUserIdent(baseStore),
room_ident: roomIdent,
role: getUserRoleInRoom(currentUserIdent, receiveRoom),
date_sent: new Date().getTime(),
type: contextItemId ? c.MESSAGE_TYPE_CONTEXT : c.MESSAGE_TYPE_MESSAGE,
isErrorOnSending: false,
var baseMessage = prepareMessage(baseStore, msgId, roomIdent, body, platform, source, device);
return baseMessage.merge(_immutable2.default.fromJS({
type: c.MESSAGE_TYPE_CONTEXT,
context_item_id: contextItemId,

@@ -317,8 +332,8 @@ context_item_type: cntxType,

context_meta: contextMeta,
body: body,
isTemporaryMessage: isTemporaryMessage,
platform: platform,
source: source,
device: device,
body: body
});
device: device
}));
}
{
"name": "@evo/chat-core",
"version": "0.7.8",
"version": "0.7.9",
"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