@microsoft/omnichannel-chat-sdk
Advanced tools
Comparing version 1.10.7 to 1.10.8-main.36f9c65
import { AzureCommunicationTokenCredential } from "@azure/communication-common"; | ||
import { ChatClient, ChatParticipant } from "@azure/communication-chat"; | ||
import { ChatClient, ChatMessage, ChatParticipant } from "@azure/communication-chat"; | ||
import ACSClientConfig from "./ACSClientConfig"; | ||
@@ -8,2 +8,3 @@ import { ACSClientLogger } from "../../utils/loggers"; | ||
import OmnichannelMessage from "./OmnichannelMessage"; | ||
import ACSGetMessagesOptionalParams from "./ACSClientGetMessagesOptionParams"; | ||
export interface ParticipantMapping { | ||
@@ -22,3 +23,3 @@ [key: string]: ChatParticipant; | ||
initialize(sessionInfo: ACSSessionInfo): Promise<void>; | ||
getMessages(): Promise<OmnichannelMessage[]>; | ||
getMessages(optionsParams?: ACSGetMessagesOptionalParams): Promise<OmnichannelMessage[] | ChatMessage[]>; | ||
getParticipants(): Promise<ChatParticipant[]>; | ||
@@ -25,0 +26,0 @@ registerOnNewMessage(onNewMessageCallback: CallableFunction): Promise<void>; |
@@ -132,5 +132,6 @@ "use strict"; | ||
ACSConversation.prototype.getMessages = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var messages, pagedAsyncIterableIterator, nextMessage, chatMessage, omnichannelMessage, error_3, exceptionDetails; | ||
return __awaiter(this, arguments, void 0, function (optionsParams) { | ||
var messages, pagedAsyncIterableIterator, nextMessage, chatMessage, error_3, exceptionDetails; | ||
var _a, _b, _c; | ||
if (optionsParams === void 0) { optionsParams = {}; } | ||
return __generator(this, function (_d) { | ||
@@ -160,6 +161,10 @@ switch (_d.label) { | ||
case 6: | ||
omnichannelMessage = (0, createOmnichannelMessage_1.default)(chatMessage, { | ||
liveChatVersion: LiveChatVersion_1.default.V2 | ||
}); | ||
messages.push(omnichannelMessage); | ||
if ((optionsParams === null || optionsParams === void 0 ? void 0 : optionsParams.skipConversion) === true) { | ||
messages.push(chatMessage); | ||
} | ||
else { | ||
messages.push((0, createOmnichannelMessage_1.default)(chatMessage, { | ||
liveChatVersion: LiveChatVersion_1.default.V2 | ||
})); | ||
} | ||
return [4 /*yield*/, pagedAsyncIterableIterator.next()]; | ||
@@ -181,3 +186,3 @@ case 7: | ||
throw new Error(ACSClientEvent.GetMessages); | ||
case 10: return [2 /*return*/, messages]; | ||
case 10: return [2 /*return*/, ((optionsParams === null || optionsParams === void 0 ? void 0 : optionsParams.skipConversion) === true) ? messages : messages]; | ||
} | ||
@@ -246,5 +251,5 @@ }); | ||
pollForMessages_1 = function (delay) { return __awaiter(_this, void 0, void 0, function () { | ||
var messages, _i, _a, message, id, sender, customerMessageCondition, _b; | ||
return __generator(this, function (_c) { | ||
switch (_c.label) { | ||
var messages, _i, _a, message, _b, id, senderDisplayName, customerMessageCondition, _c; | ||
return __generator(this, function (_d) { | ||
switch (_d.label) { | ||
case 0: | ||
@@ -254,13 +259,13 @@ if (isReceivingNotifications) { | ||
} | ||
_c.label = 1; | ||
_d.label = 1; | ||
case 1: | ||
_c.trys.push([1, 3, , 4]); | ||
return [4 /*yield*/, this.getMessages()]; | ||
_d.trys.push([1, 3, , 4]); | ||
return [4 /*yield*/, this.getMessages({ skipConversion: true })]; | ||
case 2: | ||
messages = _c.sent(); | ||
messages = _d.sent(); | ||
for (_i = 0, _a = messages.reverse(); _i < _a.length; _i++) { | ||
message = _a[_i]; | ||
try { | ||
id = message.id, sender = message.sender; | ||
customerMessageCondition = sender.displayName === ACSParticipantDisplayName_1.default.Customer; | ||
_b = message, id = _b.id, senderDisplayName = _b.senderDisplayName; | ||
customerMessageCondition = senderDisplayName === ACSParticipantDisplayName_1.default.Customer; | ||
// Filter out customer messages | ||
@@ -276,3 +281,3 @@ if (customerMessageCondition) { | ||
} | ||
catch (_d) { | ||
catch (_e) { | ||
console.warn('[ACSClient][registerOnNewMessage] Error occurred while processing messages'); | ||
@@ -283,3 +288,3 @@ } | ||
case 3: | ||
_b = _c.sent(); | ||
_c = _d.sent(); | ||
return [3 /*break*/, 4]; | ||
@@ -286,0 +291,0 @@ case 4: |
{ | ||
"name": "@microsoft/omnichannel-chat-sdk", | ||
"version": "1.10.7", | ||
"version": "1.10.8-main.36f9c65", | ||
"description": "Microsoft Omnichannel Chat SDK", | ||
@@ -5,0 +5,0 @@ "files": [ |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1088801
356
15202
1