quiq-chat
Advanced tools
Comparing version 1.5.1 to 1.6.1
@@ -258,3 +258,3 @@ 'use strict'; | ||
var version = "1.5.1"; | ||
var version = "1.6.1"; | ||
@@ -905,8 +905,2 @@ // | ||
var sortedNewMessages = sortByTimestamp(newMessages); | ||
if (newMessages.length && _this2.callbacks.onNewMessages && sendNewMessageCallback) { | ||
_this2.callbacks.onNewMessages(sortedNewMessages); | ||
} | ||
var sortedMessages = sortByTimestamp(_this2.textMessages.concat(newMessages)); | ||
@@ -918,2 +912,6 @@ var sortedEvents = sortByTimestamp(_this2.textMessages.concat(newEvents)); | ||
if (newMessages.length && _this2.callbacks.onNewMessages && sendNewMessageCallback) { | ||
_this2.callbacks.onNewMessages(_this2.textMessages); | ||
} | ||
// Update user registration status | ||
@@ -920,0 +918,0 @@ _this2.userIsRegistered = _this2.events.some(function (e) { |
{ | ||
"name": "quiq-chat", | ||
"version": "1.5.1", | ||
"version": "1.6.1", | ||
"description": "Library to help with network requests to create a webchat client for Quiq Messaging", | ||
@@ -5,0 +5,0 @@ "main": "build/quiq-chat.js", |
@@ -77,3 +77,3 @@ # quiq-chat [![Build Status](https://travis-ci.org/Quiq/quiq-chat.svg?branch=master)](https://travis-ci.org/Quiq/quiq-chat) [![npm version](https://badge.fury.io/js/quiq-chat.svg)](https://badge.fury.io/js/quiq-chat) [![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier) | ||
#### onNewMessages(messages: Array<[Message](#message)>) => [QuiqChatClient](#quiqchatclient) | ||
Called whenever new messages are received. `messages` is an array containing the new messages in the current chat | ||
Called whenever new messages are received. `messages` is an array containing full transcript of the current chat | ||
@@ -80,0 +80,0 @@ #### onAgentTyping(typing: boolean) => [QuiqChatClient](#quiqchatclient) |
@@ -168,3 +168,3 @@ // @flow | ||
it('calls onNewMessages', () => { | ||
expect(onNewMessages).toBeCalledWith([newMessage]); | ||
expect(onNewMessages).lastCalledWith(initialConvo.messages.concat(newMessage)); | ||
}); | ||
@@ -171,0 +171,0 @@ }); |
@@ -277,8 +277,2 @@ // @flow | ||
const sortedNewMessages = sortByTimestamp(newMessages); | ||
if (newMessages.length && this.callbacks.onNewMessages && sendNewMessageCallback) { | ||
this.callbacks.onNewMessages(sortedNewMessages); | ||
} | ||
const sortedMessages = sortByTimestamp(this.textMessages.concat(newMessages)); | ||
@@ -290,2 +284,6 @@ const sortedEvents = sortByTimestamp(this.textMessages.concat(newEvents)); | ||
if (newMessages.length && this.callbacks.onNewMessages && sendNewMessageCallback) { | ||
this.callbacks.onNewMessages(this.textMessages); | ||
} | ||
// Update user registration status | ||
@@ -292,0 +290,0 @@ this.userIsRegistered = this.events.some(e => e.type === MessageTypes.REGISTER); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
554905
8095