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

@microsoft/omnichannel-chat-sdk

Package Overview
Dependencies
Maintainers
5
Versions
351
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@microsoft/omnichannel-chat-sdk - npm Package Compare versions

Comparing version 1.6.1-main.39569af to 1.6.1-main.51c087a

7

CHANGELOG.md
# Changelog
All notable changes to this project will be documented in this file.
## Unreleased
## [Unreleased]
### Fixed
- Subscribe to `chatMessageEdited` events within `onNewMessage()` for queue position message updates
### Changed
- Uptake [@microsoft/ocsdk@0.4.2](https://www.npmjs.com/package/@microsoft/ocsdk/v/0.4.2)
## [1.6.0] - 2023-12-04

@@ -6,0 +11,0 @@ ### Changed

23

lib/core/messaging/ACSClient.js

@@ -233,8 +233,8 @@ "use strict";

ACSConversation.prototype.registerOnNewMessage = function (onNewMessageCallback) {
var _a, _b, _c, _d, _e;
var _a, _b, _c, _d, _e, _f;
return __awaiter(this, void 0, void 0, function () {
var isReceivingNotifications, postedMessageIds, pollForMessages_1, listener, error_5, exceptionDetails;
var _this = this;
return __generator(this, function (_f) {
switch (_f.label) {
return __generator(this, function (_g) {
switch (_g.label) {
case 0:

@@ -244,5 +244,5 @@ (_a = this.logger) === null || _a === void 0 ? void 0 : _a.startScenario(ACSClientEvent.RegisterOnNewMessage);

postedMessageIds = new Set();
_f.label = 1;
_g.label = 1;
case 1:
_f.trys.push([1, 3, , 4]);
_g.trys.push([1, 3, , 4]);
pollForMessages_1 = function (delay) { return __awaiter(_this, void 0, void 0, function () {

@@ -292,3 +292,3 @@ var messages, _i, _a, message, id, sender, customerMessageCondition, _b;

// Poll messages until WS established connection
_f.sent();
_g.sent();
listener = function (event) {

@@ -299,2 +299,3 @@ var _a;

var customerMessageCondition = (sender.communicationUserId === ((_a = _this.sessionInfo) === null || _a === void 0 ? void 0 : _a.id));
var isChatMessageEditedEvent = Object.keys(event).includes("editedOn");
// Filter out customer messages

@@ -305,3 +306,3 @@ if (customerMessageCondition) {

// Filter out duplicate messages
if (postedMessageIds.has(id)) {
if (postedMessageIds.has(id) && !isChatMessageEditedEvent) {
return;

@@ -316,11 +317,13 @@ }

(_c = this.chatClient) === null || _c === void 0 ? void 0 : _c.on("chatMessageReceived", listener);
(_d = this.chatClient) === null || _d === void 0 ? void 0 : _d.on("chatMessageEdited", listener);
this.trackListener("chatMessageReceived", listener);
(_d = this.logger) === null || _d === void 0 ? void 0 : _d.completeScenario(ACSClientEvent.RegisterOnNewMessage);
this.trackListener("chatMessageEdited", listener);
(_e = this.logger) === null || _e === void 0 ? void 0 : _e.completeScenario(ACSClientEvent.RegisterOnNewMessage);
return [3 /*break*/, 4];
case 3:
error_5 = _f.sent();
error_5 = _g.sent();
exceptionDetails = {
errorObject: "" + error_5
};
(_e = this.logger) === null || _e === void 0 ? void 0 : _e.failScenario(ACSClientEvent.RegisterOnNewMessage, {
(_f = this.logger) === null || _f === void 0 ? void 0 : _f.failScenario(ACSClientEvent.RegisterOnNewMessage, {
ExceptionDetails: JSON.stringify(exceptionDetails)

@@ -327,0 +330,0 @@ });

import { ChatMessage } from "@azure/communication-chat";
import { ChatMessageReceivedEvent } from '@azure/communication-signaling';
import { ChatMessageReceivedEvent, ChatMessageEditedEvent } from '@azure/communication-signaling';
import IRawMessage from "@microsoft/omnichannel-ic3core/lib/model/IRawMessage";

@@ -10,3 +10,3 @@ import LiveChatVersion from '../core/LiveChatVersion';

}
declare const createOmnichannelMessage: (message: IRawMessage | ChatMessageReceivedEvent | ChatMessage, optionalParams: CreateOmnichannelMessageOptionalParams) => OmnichannelMessage;
declare const createOmnichannelMessage: (message: IRawMessage | ChatMessageReceivedEvent | ChatMessageEditedEvent | ChatMessage, optionalParams: CreateOmnichannelMessageOptionalParams) => OmnichannelMessage;
export default createOmnichannelMessage;

@@ -21,3 +21,3 @@ "use strict";

if (optionalParams.liveChatVersion === LiveChatVersion_1.default.V2) {
var _a = message, id = _a.id, content = _a.content, metadata = _a.metadata, sender = _a.sender, senderDisplayName = _a.senderDisplayName, createdOn = _a.createdOn; // eslint-disable-line @typescript-eslint/no-explicit-any
var _a = message, id = _a.id, content = _a.content, metadata = _a.metadata, sender = _a.sender, senderDisplayName = _a.senderDisplayName, createdOn = _a.createdOn, editedOn = _a.editedOn; // eslint-disable-line @typescript-eslint/no-explicit-any
omnichannelMessage.id = id;

@@ -31,3 +31,3 @@ omnichannelMessage.messageid = undefined;

omnichannelMessage.tags = metadata && metadata.tags ? metadata.tags.replace(/\"/g, "").split(",").filter(function (tag) { return tag.length > 0; }) : []; // eslint-disable-line no-useless-escape
omnichannelMessage.timestamp = createdOn;
omnichannelMessage.timestamp = editedOn !== null && editedOn !== void 0 ? editedOn : createdOn;
omnichannelMessage.messageType = OmnichannelMessage_1.MessageType.UserMessage; // Backward compatibility

@@ -34,0 +34,0 @@ omnichannelMessage.sender = {

{
"name": "@microsoft/omnichannel-chat-sdk",
"version": "1.6.1-main.39569af",
"version": "1.6.1-main.51c087a",
"description": "Microsoft Omnichannel Chat SDK",

@@ -44,3 +44,3 @@ "files": [

"@azure/communication-common": "1.1.0",
"@microsoft/ocsdk": "^0.4.1",
"@microsoft/ocsdk": "^0.4.2",
"@microsoft/omnichannel-amsclient": "^0.1.6",

@@ -47,0 +47,0 @@ "@microsoft/omnichannel-ic3core": "^0.1.3"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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