Send 'ChannelId-lcw' tag (#53)
* Send 'ChannelId-lcw' tag * Update CHANGELOG.md * Organiza imports
This commit is contained in:
Родитель
f5ff4326d5
Коммит
366b0fa4dc
|
@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file.
|
|||
### Changed
|
||||
- Uptake [@microsoft/ocsdk@0.2.0](https://www.npmjs.com/package/@microsoft/ocsdk/v/0.2.0)
|
||||
- Add `getCallingToken`
|
||||
- Send `ChannelId-lcw` message tag
|
||||
|
||||
## [0.2.0] - 2021-04-30
|
||||
### Added
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
import {SDKProvider as OCSDKProvider, uuidv4 } from "@microsoft/ocsdk";
|
||||
import {SDKProvider as IC3SDKProvider} from '@microsoft/omnichannel-ic3core';
|
||||
import AriaTelemetry from "./telemetry/AriaTelemetry";
|
||||
import CallingOptionsOptionSetNumber from "./core/CallingOptionsOptionSetNumber";
|
||||
import ChatAdapterProtocols from "./core/ChatAdapterProtocols";
|
||||
import ConversationMode from "./core/ConversationMode";
|
||||
import { createIC3ClientLogger, createOCSDKLogger, IC3ClientLogger, OCSDKLogger } from "./utils/loggers";
|
||||
import createTelemetry from "./utils/createTelemetry";
|
||||
import createVoiceVideoCalling from "./api/createVoiceVideoCalling";
|
||||
import { defaultMessageTags } from "./core/MessageTags";
|
||||
import DeliveryMode from "@microsoft/omnichannel-ic3core/lib/model/DeliveryMode";
|
||||
import FileSharingProtocolType from "@microsoft/omnichannel-ic3core/lib/model/FileSharingProtocolType";
|
||||
import HostType from "@microsoft/omnichannel-ic3core/lib/interfaces/HostType";
|
||||
|
@ -13,11 +18,11 @@ import IChatSDKMessage from "./core/IChatSDKMessage";
|
|||
import IChatToken from "./external/IC3Adapter/IChatToken";
|
||||
import IChatTranscriptBody from "./core/IChatTranscriptBody";
|
||||
import IConversation from "@microsoft/omnichannel-ic3core/lib/model/IConversation";
|
||||
import IEmailTranscriptOptionalParams from "@microsoft/ocsdk/lib/Interfaces/IEmailTranscriptOptionalParams";
|
||||
import IFileInfo from "@microsoft/omnichannel-ic3core/lib/interfaces/IFileInfo";
|
||||
import IFileMetadata from "@microsoft/omnichannel-ic3core/lib/model/IFileMetadata";
|
||||
import IGetChatTokenOptionalParams from "@microsoft/ocsdk/lib/Interfaces/IGetChatTokenOptionalParams";
|
||||
import IGetChatTranscriptsOptionalParams from "@microsoft/ocsdk/lib/Interfaces/IGetChatTranscriptsOptionalParams";
|
||||
import IReconnectableChatsParams from "@microsoft/ocsdk/lib/Interfaces/IReconnectableChatsParams";
|
||||
import IIC3AdapterOptions from "./external/IC3Adapter/IIC3AdapterOptions";
|
||||
import ILiveChatContext from "./core/ILiveChatContext";
|
||||
import IMessage from "@microsoft/omnichannel-ic3core/lib/model/IMessage";
|
||||
|
@ -27,32 +32,28 @@ import IOmnichannelConfiguration from "@microsoft/ocsdk/lib/Interfaces/IOmnichan
|
|||
import IPerson from "@microsoft/omnichannel-ic3core/lib/model/IPerson";
|
||||
import IRawMessage from "@microsoft/omnichannel-ic3core/lib/model/IRawMessage";
|
||||
import IRawThread from "@microsoft/omnichannel-ic3core/lib/interfaces/IRawThread";
|
||||
import IReconnectableChatsParams from "@microsoft/ocsdk/lib/Interfaces/IReconnectableChatsParams";
|
||||
import {isCustomerMessage} from "./utils/utilities";
|
||||
import ISDKConfiguration from "@microsoft/ocsdk/lib/Interfaces/ISDKConfiguration";
|
||||
import ISessionInitOptionalParams from "@microsoft/ocsdk/lib/Interfaces/ISessionInitOptionalParams";
|
||||
import ISessionCloseOptionalParams from "@microsoft/ocsdk/lib/Interfaces/ISessionCloseOptionalParams";
|
||||
import IEmailTranscriptOptionalParams from "@microsoft/ocsdk/lib/Interfaces/IEmailTranscriptOptionalParams";
|
||||
import libraries from "./utils/libraries";
|
||||
import IStartChatOptionalParams from "./core/IStartChatOptionalParams";
|
||||
import LiveWorkItemDetails from "./core/LiveWorkItemDetails";
|
||||
import LiveWorkItemState from "./core/LiveWorkItemState";
|
||||
import { loadScript } from "./utils/WebUtils";
|
||||
import MessageContentType from "@microsoft/omnichannel-ic3core/lib/model/MessageContentType";
|
||||
import MessageType from "@microsoft/omnichannel-ic3core/lib/model/MessageType";
|
||||
import OnNewMessageOptionalParams from "./core/OnNewMessageOptionalParams";
|
||||
import PersonType from "@microsoft/omnichannel-ic3core/lib/model/PersonType";
|
||||
import platform from "./utils/platform";
|
||||
import ProtocolType from "@microsoft/omnichannel-ic3core/lib/interfaces/ProtocoleType";
|
||||
import libraries from "./utils/libraries";
|
||||
import {isCustomerMessage} from "./utils/utilities";
|
||||
import ScenarioMarker from "./telemetry/ScenarioMarker";
|
||||
import {SDKProvider as OCSDKProvider, uuidv4 } from "@microsoft/ocsdk";
|
||||
import {SDKProvider as IC3SDKProvider} from '@microsoft/omnichannel-ic3core';
|
||||
import TelemetryEvent from "./telemetry/TelemetryEvent";
|
||||
import validateOmnichannelConfig from "./validators/OmnichannelConfigValidator";
|
||||
import validateSDKConfig, {defaultChatSDKConfig} from "./validators/SDKConfigValidators";
|
||||
import ISDKConfiguration from "@microsoft/ocsdk/lib/Interfaces/ISDKConfiguration";
|
||||
import { loadScript } from "./utils/WebUtils";
|
||||
import createVoiceVideoCalling from "./api/createVoiceVideoCalling";
|
||||
import CallingOptionsOptionSetNumber from "./core/CallingOptionsOptionSetNumber";
|
||||
import createTelemetry from "./utils/createTelemetry";
|
||||
import AriaTelemetry from "./telemetry/AriaTelemetry";
|
||||
import TelemetryEvent from "./telemetry/TelemetryEvent";
|
||||
import ScenarioMarker from "./telemetry/ScenarioMarker";
|
||||
import { createIC3ClientLogger, createOCSDKLogger, IC3ClientLogger, OCSDKLogger } from "./utils/loggers";
|
||||
import LiveWorkItemDetails from "./core/LiveWorkItemDetails";
|
||||
import LiveWorkItemState from "./core/LiveWorkItemState";
|
||||
import ConversationMode from "./core/ConversationMode";
|
||||
|
||||
|
||||
class OmnichannelChatSDK {
|
||||
|
@ -164,9 +165,9 @@ class OmnichannelChatSDK {
|
|||
const reconnectableChatsParams: IReconnectableChatsParams = {
|
||||
authenticatedUserToken: this.authenticatedUserToken as string
|
||||
}
|
||||
|
||||
|
||||
const reconnectableChatsResponse = await this.OCClient.getReconnectableChats(reconnectableChatsParams);
|
||||
|
||||
|
||||
if (reconnectableChatsResponse && reconnectableChatsResponse.reconnectid) {
|
||||
this.reconnectId = reconnectableChatsResponse.reconnectid;
|
||||
}
|
||||
|
@ -177,8 +178,8 @@ class OmnichannelChatSDK {
|
|||
|
||||
throw Error(exceptionDetails.response);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (optionalParams.liveChatContext && !this.isPersistentChat) {
|
||||
this.chatToken = optionalParams.liveChatContext.chatToken || {};
|
||||
this.requestId = optionalParams.liveChatContext.requestId || uuidv4();
|
||||
|
@ -331,14 +332,14 @@ class OmnichannelChatSDK {
|
|||
});
|
||||
|
||||
const sessionCloseOptionalParams: ISessionCloseOptionalParams = {};
|
||||
|
||||
|
||||
if (this.isPersistentChat && !this.chatSDKConfig.persistentChat?.disable) {
|
||||
const isReconnectChat = this.reconnectId !== null? true: false;
|
||||
|
||||
|
||||
sessionCloseOptionalParams.isPersistentChat = this.isPersistentChat;
|
||||
sessionCloseOptionalParams.isReconnectChat = isReconnectChat;
|
||||
}
|
||||
|
||||
|
||||
if (this.authenticatedUserToken) {
|
||||
sessionCloseOptionalParams.authenticatedUserToken = this.authenticatedUserToken;
|
||||
}
|
||||
|
@ -460,7 +461,7 @@ class OmnichannelChatSDK {
|
|||
if (this.isPersistentChat && !this.chatSDKConfig.persistentChat?.disable) {
|
||||
getChatTokenOptionalParams.reconnectId = this.reconnectId as string;
|
||||
}
|
||||
|
||||
|
||||
const chatToken = await this.OCClient.getChatToken(this.requestId, getChatTokenOptionalParams);
|
||||
const {ChatId: chatId, Token: token, RegionGtms: regionGtms, ExpiresIn: expiresIn, VisitorId: visitorId, VoiceVideoCallToken: voiceVideoCallToken} = chatToken;
|
||||
this.chatToken = {
|
||||
|
@ -545,7 +546,7 @@ class OmnichannelChatSDK {
|
|||
deliveryMode: DeliveryMode.Bridged,
|
||||
messageType: MessageType.UserMessage,
|
||||
properties: undefined,
|
||||
tags: [], // OC tag (system)
|
||||
tags: [...defaultMessageTags],
|
||||
sender: {
|
||||
displayName : "Customer",
|
||||
id : "customer",
|
||||
|
@ -694,7 +695,7 @@ class OmnichannelChatSDK {
|
|||
contentType: MessageContentType.Text,
|
||||
deliveryMode: DeliveryMode.Bridged,
|
||||
messageType: MessageType.UserMessage,
|
||||
tags: [],
|
||||
tags: [...defaultMessageTags],
|
||||
sender: {
|
||||
displayName: "Customer",
|
||||
id: "customer",
|
||||
|
@ -1018,11 +1019,11 @@ class OmnichannelChatSDK {
|
|||
|
||||
const {PreChatSurvey: preChatSurvey, msdyn_prechatenabled, msdyn_callingoptions, msdyn_conversationmode} = liveWSAndLiveChatEngJoin;
|
||||
const isPreChatEnabled = msdyn_prechatenabled === true || msdyn_prechatenabled == "true";
|
||||
|
||||
|
||||
if (msdyn_conversationmode?.toString() === ConversationMode.PersistentChat.toString()) {
|
||||
this.isPersistentChat = true;
|
||||
}
|
||||
|
||||
|
||||
if (isPreChatEnabled && preChatSurvey && preChatSurvey.trim().length > 0) {
|
||||
this.preChatSurvey = preChatSurvey;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
export const defaultMessageTags = ['ChannelId-lcw'];
|
||||
|
Загрузка…
Ссылка в новой задаче