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

connectycube

Package Overview
Dependencies
Maintainers
2
Versions
104
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

connectycube - npm Package Compare versions

Comparing version 3.21.1 to 3.22.0

41

lib/messaging/cubeChat.js

@@ -672,2 +672,3 @@ const Config = require('../cubeConfig'),

replaceSubElement = ChatUtils.getElement(stanza, 'replace'),
reactionsSubElement = ChatUtils.getElement(stanza, 'reactions'),
removeSubElement = ChatUtils.getElement(stanza, 'remove'),

@@ -724,9 +725,11 @@ composing = ChatUtils.getElement(stanza, 'composing'),

if (typeof this.onMessageUpdateListener === 'function') {
Utils.safeCallbackCall(this.onMessageUpdateListener,
ChatUtils.getAttr(replaceSubElement, 'id'),
ChatUtils.getAttr(replaceSubElement, 'last') === "true",
bodyContent,
dialogId,
userId,
extraParamsParsed ? extraParamsParsed.extension : null);
Utils.safeCallbackCall(
this.onMessageUpdateListener,
ChatUtils.getAttr(replaceSubElement, 'id'),
ChatUtils.getAttr(replaceSubElement, 'last') === "true",
bodyContent,
dialogId,
userId,
extraParamsParsed ? extraParamsParsed.extension : null
);
}

@@ -736,2 +739,26 @@ return true;

// reactions
if (reactionsSubElement) {
if (isForwarded && type === 'groupchat') {
return true;
}
if (typeof this.onMessageReactionsListener === 'function') {
const messageId = ChatUtils.getAttr(reactionsSubElement, 'message_id')
const userId = +ChatUtils.getAttr(reactionsSubElement, 'user_id')
const {add, remove} = ChatUtils.parseReactions(reactionsSubElement)
const {dialogId} = extraParamsParsed
Utils.safeCallbackCall(
this.onMessageReactionsListener,
messageId,
userId,
dialogId,
add,
remove,
);
}
return true;
}
// delete message

@@ -738,0 +765,0 @@ if (removeSubElement) {

@@ -123,2 +123,6 @@ const Utils = require('../cubeInternalUtils'),

let subNode = objChildNodes[i];
if (typeof subNode === 'string') {
extension[title] = subNode;
continue
}
let subNodeChildNodes = subNode.childNodes || subNode.children;

@@ -128,3 +132,3 @@ let subNodeTagName = subNode.tagName || subNode.name;

if (subNodeChildNodes.length > 1) {
if (subNodeChildNodes.length >= 1) {
extension[title] = this._XMLtoJS(extension[title], subNodeTagName, subNode);

@@ -149,3 +153,3 @@ } else {

} else if (typeof extension[field] === 'object') {
this._JStoXML(field, extension[field], stanza);
this._JStoXML(field, extension[field], stanza.getChild('extraParams'));
} else {

@@ -198,6 +202,5 @@ stanza

if (extraParams.children[c].children.length === 1) {
if (extraParams.children[c].children.length) {
let child = extraParams.children[c];
extension[child.name] = child.children[0];
extension = this._XMLtoJS(extension, child.name, child)
}

@@ -239,4 +242,22 @@ }

}
static parseReactions(reactionsEl) {
let reactions = reactionsEl.children
reactions = reactions.map(reactionEl => ({
add: this.getAttr(reactionEl, 'add') === 'true',
remove: this.getAttr(reactionEl, 'remove') === 'true',
reaction: this.getAttr(reactionEl, 'type')
}))
return reactions.reduce((acc, parsedReaction) => {
if (parsedReaction.add) {
acc['add'] = parsedReaction.reaction
}
if (parsedReaction.remove) {
acc['remove'] = parsedReaction.reaction
}
return acc
}, {})
}
}
module.exports = ChatInternalUtils;

@@ -69,4 +69,41 @@ const Config = require('../cubeConfig')

}
listReactions(messageId) {
const ajaxParams = {
type: 'GET',
dataType: 'json',
url: Utils.getUrl(MESSAGES_API_URL, messageId, 'reactions'),
data: {}
}
return this.proxy.ajax(ajaxParams)
}
addReaction(messageId, reaction) {
return this.updateReaction(messageId, reaction)
}
removeReaction(messageId, reaction) {
return this.updateReaction(messageId, null, reaction)
}
updateReaction(messageId, addReaction, removeReaction) {
const params = { }
if (addReaction) {
params['add'] = addReaction
}
if (removeReaction) {
params['remove'] = removeReaction
}
const ajaxParams = {
type: 'PUT',
dataType: 'text',
url: Utils.getUrl(MESSAGES_API_URL, messageId, 'reactions'),
data: params
}
return this.proxy.ajax(ajaxParams)
}
}
module.exports = ChatMessagesService

4

package.json
{
"name": "connectycube",
"description": "ConnectyCube chat and video chat JavaScript SDK",
"version": "3.21.1",
"version": "3.22.0",
"homepage": "https://developers.connectycube.com/reactnative",

@@ -84,3 +84,3 @@ "main": "lib/cubeMain.js",

},
"gitHead": "a8343e3541a29e692d501cf78dc4adb8b7cfd309"
"gitHead": "ff28253df1873046474736446d31012f4e73d55d"
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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