@microsoft/omnichannel-chat-sdk
Advanced tools
Comparing version 1.0.1-main.90a4f94 to 1.0.1-main.91ec7fb
@@ -11,2 +11,11 @@ # Changelog | ||
- Update `ChatConfig` interface with `LiveChatVersion`, `allowedFileExtensions` & `maxUploadFileSize` properties | ||
- Add ability to automatically detect locale from chat config | ||
- Add `runtimeId` attribute in `OmnichannelChatSDK` & `ChatSDKRuntimeId` field in telemetry | ||
- Add ability to automatically pass locale from chat config on calling `ChatSDK.emailLiveChatTranscript()` | ||
- Bubble up `WidgetUseOutsideOperatingHour` exception | ||
- Add `acs_webchat-chat-adapter` middleware to add default `channelData.tags` & `channelData.metadata` | ||
- Update `ChatConfig` interface with `msdyn_enablemarkdown` property | ||
- Throw exception on `ChatSDK.getVoiceVideoCalling()` if feature is disabled or platform is not supported | ||
- Add `participantType` & `canRenderPostChat` as response of getConversationDetails() API | ||
- Add support for separate bot post chat survey feature | ||
@@ -16,2 +25,6 @@ ### Fix | ||
- Skip `session init` call on existing conversation | ||
- Fix `chat reconnect` not ending the conversation on calling `ChatSDK.endChat()` | ||
- Fix on messaging client not sending heartbeat on new conversations subsequent to the first conversation | ||
- Fix `ChatSDK.getConversationDetails()` not passing `authenticatedUserToken` | ||
- Fix `IC3Client.dispose()` called when `IC3Client` is `undefined` | ||
@@ -22,2 +35,3 @@ ### Changed | ||
- Uptake [acs_webchat-chat-adapter@0.0.35-beta.2](https://unpkg.com/acs_webchat-chat-adapter@0.0.35-beta.2/dist/chat-adapter.js) | ||
- Update `locale` property in `ChatTranscriptBody` interface to be optional | ||
@@ -24,0 +38,0 @@ ## [1.0.0] - 2021-10-08 |
@@ -114,3 +114,5 @@ "use strict"; | ||
if (!!this.proxyInstance._isLoaded) return [3 /*break*/, 2]; | ||
return [4 /*yield*/, this.proxyInstance.load(this.logger || {})]; | ||
return [4 /*yield*/, this.proxyInstance.load({ | ||
logger: this.logger || undefined | ||
})]; | ||
case 1: | ||
@@ -452,3 +454,5 @@ _j.sent(); | ||
proxy = VoiceVideoCallingProxy.getInstance(); | ||
return [4 /*yield*/, proxy.load(params.logger)]; | ||
return [4 /*yield*/, proxy.load({ | ||
logger: params.logger || undefined | ||
})]; | ||
case 1: | ||
@@ -455,0 +459,0 @@ _a.sent(); |
@@ -9,2 +9,3 @@ export default interface ChatConfig { | ||
maxUploadFileSize: string; | ||
msdyn_enablemarkdown?: string; | ||
} |
export default interface ChatTranscriptBody { | ||
emailAddress: string; | ||
attachmentMessage: string; | ||
locale: string; | ||
locale?: string; | ||
} |
@@ -6,2 +6,4 @@ import LiveWorkItemState from "./LiveWorkItemState"; | ||
conversationId: string; | ||
canRenderPostChat?: string; | ||
participantType?: string; | ||
} |
@@ -0,1 +1,3 @@ | ||
export declare const channelIdTag = "ChannelId-lcw"; | ||
export declare const customerMessageTag = "FromCustomer"; | ||
export declare const defaultMessageTags: string[]; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.defaultMessageTags = void 0; | ||
exports.defaultMessageTags = ['ChannelId-lcw', 'FromCustomer']; | ||
exports.defaultMessageTags = exports.customerMessageTag = exports.channelIdTag = void 0; | ||
exports.channelIdTag = 'ChannelId-lcw'; // Tag for PVA bot to return proper response for live chat channel | ||
exports.customerMessageTag = 'FromCustomer'; // Tag to support transcript analytics feature | ||
exports.defaultMessageTags = [exports.channelIdTag, exports.customerMessageTag]; | ||
//# sourceMappingURL=MessageTags.js.map |
export default interface PostChatContext { | ||
formsProLocale: string; | ||
participantJoined: boolean; | ||
participantType: string | undefined; | ||
surveyInviteLink: string; | ||
} |
@@ -0,3 +1,6 @@ | ||
import HostType from "@microsoft/omnichannel-ic3core/lib/interfaces/HostType"; | ||
import ProtocolType from "@microsoft/omnichannel-ic3core/lib/interfaces/ProtocoleType"; | ||
import IConversation from "@microsoft/omnichannel-ic3core/lib/model/IConversation"; | ||
import IChatToken from "./IChatToken"; | ||
import INotification from "./INotification"; | ||
export default interface IIC3AdapterOptions { | ||
@@ -10,2 +13,11 @@ userId: string; | ||
sdk?: any; | ||
visitor?: boolean; | ||
sendHeartBeat?: boolean; | ||
hostType?: HostType; | ||
protocolType?: ProtocolType; | ||
callbackOnNotification?: (notification: INotification) => void; | ||
callbackOnThreadNotFound?: () => void; | ||
featureConfig?: { | ||
ShouldEnableInlinePlaying: boolean; | ||
}; | ||
} |
import ACSClient from "./core/messaging/ACSClient"; | ||
import { ParticipantsRemovedEvent } from '@azure/communication-signaling'; | ||
import ChatAdapterOptionalParams from "./core/messaging/ChatAdapterOptionalParams"; | ||
import ChatConfig from "./core/ChatConfig"; | ||
@@ -26,2 +27,3 @@ import ChatReconnectContext from "./core/ChatReconnectContext"; | ||
private debug; | ||
runtimeId: string; | ||
OCSDKProvider: unknown; | ||
@@ -36,2 +38,3 @@ IC3SDKProvider: unknown; | ||
isInitialized: boolean; | ||
localeId: string; | ||
requestId: string; | ||
@@ -53,2 +56,3 @@ private chatToken; | ||
private acsAdapterLogger; | ||
private callingSdkLogger; | ||
private isPersistentChat; | ||
@@ -85,3 +89,3 @@ private isChatReconnect; | ||
getLiveChatTranscript(): Promise<any>; | ||
createChatAdapter(protocol?: string | null): Promise<unknown>; | ||
createChatAdapter(optionalParams?: ChatAdapterOptionalParams): Promise<unknown>; | ||
getVoiceVideoCalling(params?: any): Promise<any>; | ||
@@ -94,3 +98,4 @@ getPostChatSurveyContext(): Promise<any>; | ||
private updateChatToken; | ||
private setAuthTokenProvider; | ||
} | ||
export default OmnichannelChatSDK; |
@@ -32,3 +32,4 @@ import { AWTEventData } from '../external/aria/webjs/AriaSDK'; | ||
private static populateACSAdapterBaseProperties; | ||
private static populateCallingSDKBaseProperties; | ||
} | ||
export default AriaTelemetry; |
@@ -81,2 +81,9 @@ "use strict"; | ||
} | ||
if (scenarioType == ScenarioType_1.default.CALLINGSDK) { | ||
event = { | ||
name: ScenarioType_1.default.CALLINGSDK, | ||
properties: __assign(__assign(__assign({}, AriaTelemetry.populateCallingSDKBaseProperties()), properties), { LogLevel: LogLevel_1.default.INFO }), | ||
priority: Enums_1.AWTEventPriority.High | ||
}; | ||
} | ||
/* istanbul ignore next */ | ||
@@ -126,2 +133,9 @@ this._debug && console.log("[AriaTelemetry][info] " + scenarioType); | ||
} | ||
if (scenarioType == ScenarioType_1.default.CALLINGSDK) { | ||
event = { | ||
name: ScenarioType_1.default.CALLINGSDK, | ||
properties: __assign(__assign(__assign({}, AriaTelemetry.populateCallingSDKBaseProperties()), properties), { LogLevel: LogLevel_1.default.DEBUG }), | ||
priority: Enums_1.AWTEventPriority.High | ||
}; | ||
} | ||
/* istanbul ignore next */ | ||
@@ -171,2 +185,9 @@ this._debug && console.log("[AriaTelemetry][debug] " + scenarioType); | ||
} | ||
if (scenarioType == ScenarioType_1.default.CALLINGSDK) { | ||
event = { | ||
name: ScenarioType_1.default.CALLINGSDK, | ||
properties: __assign(__assign(__assign({}, AriaTelemetry.populateCallingSDKBaseProperties()), properties), { LogLevel: LogLevel_1.default.WARN }), | ||
priority: Enums_1.AWTEventPriority.High | ||
}; | ||
} | ||
/* istanbul ignore next */ | ||
@@ -216,2 +237,9 @@ this._debug && console.log("[AriaTelemetry][warn] " + scenarioType); | ||
} | ||
if (scenarioType == ScenarioType_1.default.CALLINGSDK) { | ||
event = { | ||
name: ScenarioType_1.default.CALLINGSDK, | ||
properties: __assign(__assign(__assign({}, AriaTelemetry.populateCallingSDKBaseProperties()), properties), { LogLevel: LogLevel_1.default.ERROR }), | ||
priority: Enums_1.AWTEventPriority.High | ||
}; | ||
} | ||
/* istanbul ignore next */ | ||
@@ -261,2 +289,9 @@ this._debug && console.log("[AriaTelemetry][error] " + scenarioType); | ||
} | ||
if (scenarioType == ScenarioType_1.default.CALLINGSDK) { | ||
event = { | ||
name: ScenarioType_1.default.CALLINGSDK, | ||
properties: __assign(__assign(__assign({}, AriaTelemetry.populateCallingSDKBaseProperties()), properties), { LogLevel: LogLevel_1.default.LOG }), | ||
priority: Enums_1.AWTEventPriority.High | ||
}; | ||
} | ||
/* istanbul ignore next */ | ||
@@ -291,2 +326,3 @@ this._debug && console.log("[AriaTelemetry][log]"); | ||
return { | ||
ChatSDKRuntimeId: '', | ||
OrgId: '', | ||
@@ -359,2 +395,3 @@ OrgUrl: '', | ||
return { | ||
ChatSDKRuntimeId: '', | ||
OrgId: '', | ||
@@ -378,2 +415,3 @@ OrgUrl: '', | ||
return { | ||
ChatSDKRuntimeId: '', | ||
OrgId: '', | ||
@@ -393,2 +431,3 @@ OrgUrl: '', | ||
return { | ||
ChatSDKRuntimeId: '', | ||
OrgId: '', | ||
@@ -407,2 +446,3 @@ OrgUrl: '', | ||
return { | ||
ChatSDKRuntimeId: '', | ||
OrgId: '', | ||
@@ -419,2 +459,17 @@ OrgUrl: '', | ||
}; | ||
AriaTelemetry.populateCallingSDKBaseProperties = function () { | ||
return { | ||
ChatSDKRuntimeId: '', | ||
OrgId: '', | ||
OrgUrl: '', | ||
WidgetId: '', | ||
RequestId: '', | ||
ChatId: '', | ||
CallId: '', | ||
Event: '', | ||
Description: '', | ||
ExceptionDetails: '', | ||
ElapsedTimeInMilliseconds: '' | ||
}; | ||
}; | ||
AriaTelemetry._debug = false; | ||
@@ -421,0 +476,0 @@ AriaTelemetry._disable = false; |
@@ -8,2 +8,3 @@ import AriaTelemetry from "./AriaTelemetry"; | ||
private debug; | ||
private runtimeId; | ||
private telemetryEvents; | ||
@@ -15,2 +16,3 @@ private telemetry; | ||
setScenarioType(scenarioType: ScenarioType): void; | ||
setRuntimeId(runtimeId: string): void; | ||
useTelemetry(telemetry: typeof AriaTelemetry): void; | ||
@@ -17,0 +19,0 @@ startScenario(event: string, additionalProperties?: AWTEventData["properties"]): void; |
@@ -20,2 +20,3 @@ "use strict"; | ||
this.omnichannelConfig = omnichannelConfig; | ||
this.runtimeId = ''; | ||
this.telemetry = null; | ||
@@ -35,2 +36,5 @@ this.debug = false; | ||
}; | ||
ScenarioMarker.prototype.setRuntimeId = function (runtimeId) { | ||
this.runtimeId = runtimeId; | ||
}; | ||
ScenarioMarker.prototype.useTelemetry = function (telemetry) { | ||
@@ -49,3 +53,3 @@ this.debug && console.log("[ScenarioMarker][useTelemetry]"); | ||
} | ||
var properties = __assign({ Event: EventMarker_1.startEvent(event), OrgId: this.omnichannelConfig.orgId, OrgUrl: this.omnichannelConfig.orgUrl, WidgetId: this.omnichannelConfig.widgetId }, additionalProperties); | ||
var properties = __assign({ ChatSDKRuntimeId: this.runtimeId, Event: EventMarker_1.startEvent(event), OrgId: this.omnichannelConfig.orgId, OrgUrl: this.omnichannelConfig.orgUrl, WidgetId: this.omnichannelConfig.widgetId }, additionalProperties); | ||
(_a = this.telemetry) === null || _a === void 0 ? void 0 : _a.info(properties, this.scenarioType); | ||
@@ -63,3 +67,3 @@ }; | ||
this.telemetryEvents.delete(event); | ||
var properties = __assign({ Event: EventMarker_1.failEvent(event), OrgId: this.omnichannelConfig.orgId, OrgUrl: this.omnichannelConfig.orgUrl, WidgetId: this.omnichannelConfig.widgetId, ElapsedTimeInMilliseconds: stopWatch.stop() }, additionalProperties); | ||
var properties = __assign({ ChatSDKRuntimeId: this.runtimeId, Event: EventMarker_1.failEvent(event), OrgId: this.omnichannelConfig.orgId, OrgUrl: this.omnichannelConfig.orgUrl, WidgetId: this.omnichannelConfig.widgetId, ElapsedTimeInMilliseconds: stopWatch.stop() }, additionalProperties); | ||
(_a = this.telemetry) === null || _a === void 0 ? void 0 : _a.error(properties, this.scenarioType); | ||
@@ -77,3 +81,3 @@ }; | ||
this.telemetryEvents.delete(event); | ||
var properties = __assign({ Event: EventMarker_1.completeEvent(event), OrgId: this.omnichannelConfig.orgId, OrgUrl: this.omnichannelConfig.orgUrl, WidgetId: this.omnichannelConfig.widgetId, ElapsedTimeInMilliseconds: stopWatch.stop() }, additionalProperties); | ||
var properties = __assign({ ChatSDKRuntimeId: this.runtimeId, Event: EventMarker_1.completeEvent(event), OrgId: this.omnichannelConfig.orgId, OrgUrl: this.omnichannelConfig.orgUrl, WidgetId: this.omnichannelConfig.widgetId, ElapsedTimeInMilliseconds: stopWatch.stop() }, additionalProperties); | ||
(_a = this.telemetry) === null || _a === void 0 ? void 0 : _a.info(properties, this.scenarioType); | ||
@@ -80,0 +84,0 @@ }; |
@@ -7,4 +7,5 @@ declare enum ScenarioType { | ||
ACSADAPTER = "occhatsdk_acsadapterevents", | ||
CALLINGSDK = "occhatsdk_callingsdkevents", | ||
UNDEFINED = "undefined" | ||
} | ||
export default ScenarioType; |
@@ -10,2 +10,3 @@ "use strict"; | ||
ScenarioType["ACSADAPTER"] = "occhatsdk_acsadapterevents"; | ||
ScenarioType["CALLINGSDK"] = "occhatsdk_callingsdkevents"; | ||
ScenarioType["UNDEFINED"] = "undefined"; | ||
@@ -12,0 +13,0 @@ })(ScenarioType || (ScenarioType = {})); |
export declare const getLocaleStringFromId: (id: string) => string; | ||
export declare const getLocaleIdFromString: (value: string) => string; | ||
export declare const defaultLocaleId: string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getLocaleIdFromString = exports.getLocaleStringFromId = void 0; | ||
exports.defaultLocaleId = exports.getLocaleIdFromString = exports.getLocaleStringFromId = void 0; | ||
var localeList = { | ||
@@ -59,2 +59,3 @@ "1025": "ar-sa", | ||
}; | ||
exports.defaultLocaleId = exports.getLocaleIdFromString("en-us"); | ||
//# sourceMappingURL=locale.js.map |
import LogLevel from "../telemetry/LogLevel"; | ||
import OmnichannelConfig from "../core/OmnichannelConfig"; | ||
import ICallingSDKLogData from "../external/CallingSDK/ICallingSDKLogData"; | ||
import IIC3SDKLogData from "../external/IC3Client/IIC3SDKLogData"; | ||
@@ -9,2 +10,3 @@ import IOCSDKLogData from "../external/OCSDK/IOCSDKLogData"; | ||
private debug; | ||
private runtimeId; | ||
private requestId; | ||
@@ -15,2 +17,3 @@ private chatId; | ||
setDebug(flag: boolean): void; | ||
setRuntimeId(runtimeId: string): void; | ||
setRequestId(requestId: string): void; | ||
@@ -24,2 +27,3 @@ setChatId(chatId: string): void; | ||
private debug; | ||
private runtimeId; | ||
private requestId; | ||
@@ -30,2 +34,3 @@ private chatId; | ||
setDebug(flag: boolean): void; | ||
setRuntimeId(runtimeId: string): void; | ||
setRequestId(requestId: string): void; | ||
@@ -39,2 +44,3 @@ setChatId(chatId: string): void; | ||
private debug; | ||
private runtimeId; | ||
private requestId; | ||
@@ -46,2 +52,3 @@ private chatId; | ||
setDebug(flag: boolean): void; | ||
setRuntimeId(runtimeId: string): void; | ||
setRequestId(requestId: string): void; | ||
@@ -58,2 +65,3 @@ setChatId(chatId: string): void; | ||
private debug; | ||
private runtimeId; | ||
private requestId; | ||
@@ -65,2 +73,3 @@ private chatId; | ||
setDebug(flag: boolean): void; | ||
setRuntimeId(runtimeId: string): void; | ||
setRequestId(requestId: string): void; | ||
@@ -74,2 +83,17 @@ setChatId(chatId: string): void; | ||
} | ||
export declare class CallingSDKLogger { | ||
private omnichannelConfig; | ||
private debug; | ||
private runtimeId; | ||
private requestId; | ||
private chatId; | ||
private telemetry; | ||
constructor(omnichannelConfig: OmnichannelConfig); | ||
setDebug(flag: boolean): void; | ||
setRuntimeId(runtimeId: string): void; | ||
setRequestId(requestId: string): void; | ||
setChatId(chatId: string): void; | ||
useTelemetry(telemetry: typeof AriaTelemetry): void; | ||
logCallingSdkTelemetryEvent(logLevel: LogLevel, event: ICallingSDKLogData): void; | ||
} | ||
export declare const createIC3ClientLogger: (omnichannelConfig: OmnichannelConfig, debug?: boolean) => IC3ClientLogger; | ||
@@ -79,1 +103,2 @@ export declare const createOCSDKLogger: (omnichannelConfig: OmnichannelConfig, debug?: boolean) => OCSDKLogger; | ||
export declare const createACSAdapterLogger: (omnichannelConfig: OmnichannelConfig, debug?: boolean) => ACSAdapterLogger; | ||
export declare const createCallingSDKLogger: (omnichannelConfig: OmnichannelConfig, debug?: boolean) => CallingSDKLogger; |
@@ -14,3 +14,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createACSAdapterLogger = exports.createACSClientLogger = exports.createOCSDKLogger = exports.createIC3ClientLogger = exports.ACSAdapterLogger = exports.ACSClientLogger = exports.OCSDKLogger = exports.IC3ClientLogger = void 0; | ||
exports.createCallingSDKLogger = exports.createACSAdapterLogger = exports.createACSClientLogger = exports.createOCSDKLogger = exports.createIC3ClientLogger = exports.CallingSDKLogger = exports.ACSAdapterLogger = exports.ACSClientLogger = exports.OCSDKLogger = exports.IC3ClientLogger = void 0; | ||
var LogLevel_1 = require("../telemetry/LogLevel"); | ||
@@ -23,2 +23,3 @@ var ScenarioType_1 = require("../telemetry/ScenarioType"); | ||
this.debug = false; | ||
this.runtimeId = ''; | ||
this.requestId = ''; | ||
@@ -33,2 +34,5 @@ this.chatId = ''; | ||
}; | ||
IC3ClientLogger.prototype.setRuntimeId = function (runtimeId) { | ||
this.runtimeId = runtimeId; | ||
}; | ||
IC3ClientLogger.prototype.setRequestId = function (requestId) { | ||
@@ -52,2 +56,3 @@ this.requestId = requestId; | ||
var baseProperties = { | ||
ChatSDKRuntimeId: this.runtimeId, | ||
OrgId: this.omnichannelConfig.orgId, | ||
@@ -83,2 +88,3 @@ OrgUrl: this.omnichannelConfig.orgUrl, | ||
this.debug = false; | ||
this.runtimeId = ''; | ||
this.requestId = ''; | ||
@@ -93,2 +99,5 @@ this.chatId = ''; | ||
}; | ||
OCSDKLogger.prototype.setRuntimeId = function (runtimeId) { | ||
this.runtimeId = runtimeId; | ||
}; | ||
OCSDKLogger.prototype.setRequestId = function (requestId) { | ||
@@ -112,2 +121,3 @@ this.requestId = requestId; | ||
var baseProperties = { | ||
ChatSDKRuntimeId: this.runtimeId, | ||
OrgId: this.omnichannelConfig.orgId, | ||
@@ -143,2 +153,3 @@ OrgUrl: this.omnichannelConfig.orgUrl, | ||
this.debug = false; | ||
this.runtimeId = ''; | ||
this.requestId = ''; | ||
@@ -158,2 +169,7 @@ this.chatId = ''; | ||
}; | ||
ACSClientLogger.prototype.setRuntimeId = function (runtimeId) { | ||
var _a; | ||
this.runtimeId = runtimeId; | ||
(_a = this.scenarioMarker) === null || _a === void 0 ? void 0 : _a.setRuntimeId(runtimeId); | ||
}; | ||
ACSClientLogger.prototype.setRequestId = function (requestId) { | ||
@@ -179,2 +195,3 @@ this.requestId = requestId; | ||
var baseProperties = { | ||
ChatSDKRuntimeId: this.runtimeId, | ||
OrgId: this.omnichannelConfig.orgId, | ||
@@ -237,2 +254,3 @@ OrgUrl: this.omnichannelConfig.orgUrl, | ||
this.debug = false; | ||
this.runtimeId = ''; | ||
this.requestId = ''; | ||
@@ -252,2 +270,7 @@ this.chatId = ''; | ||
}; | ||
ACSAdapterLogger.prototype.setRuntimeId = function (runtimeId) { | ||
var _a; | ||
this.runtimeId = runtimeId; | ||
(_a = this.scenarioMarker) === null || _a === void 0 ? void 0 : _a.setRuntimeId(this.runtimeId); | ||
}; | ||
ACSAdapterLogger.prototype.setRequestId = function (requestId) { | ||
@@ -273,2 +296,3 @@ this.requestId = requestId; | ||
var baseProperties = { | ||
ChatSDKRuntimeId: this.runtimeId, | ||
OrgId: this.omnichannelConfig.orgId, | ||
@@ -327,2 +351,64 @@ OrgUrl: this.omnichannelConfig.orgUrl, | ||
exports.ACSAdapterLogger = ACSAdapterLogger; | ||
var CallingSDKLogger = /** @class */ (function () { | ||
function CallingSDKLogger(omnichannelConfig) { | ||
this.omnichannelConfig = omnichannelConfig; | ||
this.debug = false; | ||
this.runtimeId = ''; | ||
this.requestId = ''; | ||
this.chatId = ''; | ||
this.telemetry = null; | ||
this.debug = false; | ||
} | ||
/* istanbul ignore next */ | ||
CallingSDKLogger.prototype.setDebug = function (flag) { | ||
this.debug = flag; | ||
}; | ||
CallingSDKLogger.prototype.setRuntimeId = function (runtimeId) { | ||
this.runtimeId = runtimeId; | ||
}; | ||
CallingSDKLogger.prototype.setRequestId = function (requestId) { | ||
this.requestId = requestId; | ||
}; | ||
CallingSDKLogger.prototype.setChatId = function (chatId) { | ||
this.chatId = chatId; | ||
}; | ||
CallingSDKLogger.prototype.useTelemetry = function (telemetry) { | ||
/* istanbul ignore next */ | ||
this.debug && console.log("[CallingSDKLogger][useTelemetry]"); | ||
this.telemetry = telemetry; | ||
}; | ||
CallingSDKLogger.prototype.logCallingSdkTelemetryEvent = function (logLevel, event) { | ||
var _a, _b, _c, _d; | ||
/* istanbul ignore next */ | ||
this.debug && console.log("[CallingSDKLogger][logClientSdkTelemetryEvent][" + logLevel + "]"); | ||
/* istanbul ignore next */ | ||
this.debug && console.log(event); | ||
var baseProperties = { | ||
ChatSDKRuntimeId: this.runtimeId, | ||
OrgId: this.omnichannelConfig.orgId, | ||
OrgUrl: this.omnichannelConfig.orgUrl, | ||
WidgetId: this.omnichannelConfig.widgetId, | ||
RequestId: this.requestId, | ||
ChatId: this.chatId | ||
}; | ||
var additionalProperties = __assign(__assign({}, event), { ExceptionDetails: event.ExceptionDetails ? JSON.stringify(event.ExceptionDetails) : '' }); | ||
switch (logLevel) { | ||
case LogLevel_1.default.DEBUG: | ||
(_a = this.telemetry) === null || _a === void 0 ? void 0 : _a.debug(__assign(__assign({}, baseProperties), additionalProperties), ScenarioType_1.default.CALLINGSDK); | ||
break; | ||
case LogLevel_1.default.WARN: | ||
(_b = this.telemetry) === null || _b === void 0 ? void 0 : _b.warn(__assign(__assign({}, baseProperties), additionalProperties), ScenarioType_1.default.CALLINGSDK); | ||
break; | ||
case LogLevel_1.default.ERROR: | ||
(_c = this.telemetry) === null || _c === void 0 ? void 0 : _c.error(__assign(__assign({}, baseProperties), additionalProperties), ScenarioType_1.default.CALLINGSDK); | ||
break; | ||
case LogLevel_1.default.INFO: | ||
default: | ||
(_d = this.telemetry) === null || _d === void 0 ? void 0 : _d.info(__assign(__assign({}, baseProperties), additionalProperties), ScenarioType_1.default.CALLINGSDK); | ||
break; | ||
} | ||
}; | ||
return CallingSDKLogger; | ||
}()); | ||
exports.CallingSDKLogger = CallingSDKLogger; | ||
exports.createIC3ClientLogger = function (omnichannelConfig, debug) { | ||
@@ -352,2 +438,8 @@ if (debug === void 0) { debug = false; } | ||
}; | ||
exports.createCallingSDKLogger = function (omnichannelConfig, debug) { | ||
if (debug === void 0) { debug = false; } | ||
var logger = new CallingSDKLogger(omnichannelConfig); | ||
logger.setDebug(debug); | ||
return logger; | ||
}; | ||
//# sourceMappingURL=loggers.js.map |
declare const loadScript: (scriptUrl: string, callbackOnload?: CallableFunction, callbackError?: CallableFunction) => Promise<void>; | ||
declare const removeElementById: (id: string) => void; | ||
declare const _default: { | ||
loadScript: (scriptUrl: string, callbackOnload?: CallableFunction, callbackError?: CallableFunction) => Promise<void>; | ||
removeElementById: (id: string) => void; | ||
}; | ||
export default _default; | ||
export { loadScript }; | ||
export { loadScript, removeElementById }; |
@@ -39,3 +39,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.loadScript = void 0; | ||
exports.removeElementById = exports.loadScript = void 0; | ||
var loadScript = function (scriptUrl, callbackOnload, callbackError) { | ||
@@ -93,5 +93,11 @@ if (callbackOnload === void 0) { callbackOnload = function () { return void (0); }; } | ||
exports.loadScript = loadScript; | ||
var removeElementById = function (id) { | ||
var _a; | ||
(_a = document.getElementById(id)) === null || _a === void 0 ? void 0 : _a.remove(); | ||
}; | ||
exports.removeElementById = removeElementById; | ||
exports.default = { | ||
loadScript: loadScript | ||
loadScript: loadScript, | ||
removeElementById: removeElementById | ||
}; | ||
//# sourceMappingURL=WebUtils.js.map |
{ | ||
"name": "@microsoft/omnichannel-chat-sdk", | ||
"version": "1.0.1-main.90a4f94", | ||
"version": "1.0.1-main.91ec7fb", | ||
"description": "Microsoft Omnichannel Chat SDK", | ||
@@ -5,0 +5,0 @@ "files": [ |
128
README.md
@@ -134,3 +134,3 @@ # Omnichannel Chat SDK | ||
| OmnichannelChatSDK.downloadFileAttachment() | Download file attachment | | | ||
| OmnichannelChatSDK.createChatAdapter() | Get IC3Adapter | **Web only** | | ||
| OmnichannelChatSDK.createChatAdapter() | Get Chat Adapter | **Web only** | | ||
| OmnichannelChatSDK.getVoiceVideoCalling() | Get VoiceVideoCall SDK for Escalation to Voice & Video | **Web only** | | ||
@@ -222,3 +222,3 @@ | OmnichannelChatSDK.getPostChatSurveyContext() | Get post chat survey link, survey locale, and whether an agent has joined the survey | | | ||
// If "&lang=" is not set on the url, the locale will be English. | ||
const linkToSend = context.surveyInviteLink + "&lang=" + context.formsProLocale; | ||
const linkToSend = context.surveyInviteLink + "&lang=" + context.formsProLocale; | ||
// This link is accessible and will redirect to the survey page. Use it as you see fit. | ||
@@ -340,4 +340,3 @@ } | ||
emailAddress: 'contoso@microsoft.com', | ||
attachmentMessage: 'Attachment Message', | ||
locale: 'en-us' | ||
attachmentMessage: 'Attachment Message' | ||
}; | ||
@@ -603,2 +602,10 @@ await chatSDK.emailLiveChatTranscript(body); | ||
console.log(`Failed to load VoiceVideoCalling: ${e}`); | ||
if (e.message === 'UnsupportedPlatform') { | ||
// Voice Video Calling feature is not supported on this platform | ||
} | ||
if (e.message === 'FeatureDisabled') { | ||
// Voice Video Calling feature is disabled on admin side | ||
} | ||
} | ||
@@ -610,72 +617,75 @@ | ||
try { | ||
await VoiceVideoCallingSDK.initialize({ | ||
chatToken, | ||
selfVideoHTMLElementId: 'selfVideo', // HTML element id where video stream of the agent will be rendered | ||
remoteVideoHTMLElementId: 'remoteVideo', // HTML element id where video stream of the customer will be rendered | ||
OCClient: chatSDK.OCClient | ||
// Initialize only if VoiceVideoCallingSDK is defined | ||
if (VoiceVideoCallingSDK) { | ||
try { | ||
await VoiceVideoCallingSDK.initialize({ | ||
chatToken, | ||
selfVideoHTMLElementId: 'selfVideo', // HTML element id where video stream of the agent will be rendered | ||
remoteVideoHTMLElementId: 'remoteVideo', // HTML element id where video stream of the customer will be rendered | ||
OCClient: chatSDK.OCClient | ||
}); | ||
} catch (e) { | ||
console.error("Failed to initialize VoiceVideoCalling!"); | ||
} | ||
// Triggered when there's an incoming call | ||
VoiceVideoCallingSDK.onCallAdded(() => { | ||
... | ||
}); | ||
} catch (e) { | ||
console.error("Failed to initialize VoiceVideoCalling!"); | ||
} | ||
// Triggered when there's an incoming call | ||
VoiceVideoCallingSDK.onCallAdded(() => { | ||
... | ||
}); | ||
// Triggered when local video stream is available (e.g.: Local video added succesfully in selfVideoHTMLElement) | ||
VoiceVideoCallingSDK.onLocalVideoStreamAdded(() => { | ||
... | ||
}); | ||
// Triggered when local video stream is available (e.g.: Local video added succesfully in selfVideoHTMLElement) | ||
VoiceVideoCallingSDK.onLocalVideoStreamAdded(() => { | ||
... | ||
}); | ||
// Triggered when local video stream is unavailable (e.g.: Customer turning off local video) | ||
VoiceVideoCallingSDK.onLocalVideoStreamRemoved(() => { | ||
... | ||
}); | ||
// Triggered when local video stream is unavailable (e.g.: Customer turning off local video) | ||
VoiceVideoCallingSDK.onLocalVideoStreamRemoved(() => { | ||
... | ||
}); | ||
// Triggered when remote video stream is available (e.g.: Remote video added succesfully in remoteVideoHTMLElement) | ||
VoiceVideoCallingSDK.onRemoteVideoStreamAdded(() => { | ||
... | ||
}); | ||
// Triggered when remote video stream is available (e.g.: Remote video added succesfully in remoteVideoHTMLElement) | ||
VoiceVideoCallingSDK.onRemoteVideoStreamAdded(() => { | ||
... | ||
}); | ||
// Triggered when remote video stream is unavailable (e.g.: Agent turning off remote video) | ||
VoiceVideoCallingSDK.onRemoteVideoStreamRemoved(() => { | ||
... | ||
}); | ||
// Triggered when remote video stream is unavailable (e.g.: Agent turning off remote video) | ||
VoiceVideoCallingSDK.onRemoteVideoStreamRemoved(() => { | ||
... | ||
}); | ||
// Triggered when current call has ended or disconnected regardless the party | ||
VoiceVideoCalling.onCallDisconnected(() => { | ||
... | ||
}); | ||
// Triggered when current call has ended or disconnected regardless the party | ||
VoiceVideoCalling.onCallDisconnected(() => { | ||
... | ||
}); | ||
// Check if microphone is muted | ||
const isMicrophoneMuted = VoiceVideoCallingSDK.isMicrophoneMuted(); | ||
// Check if microphone is muted | ||
const isMicrophoneMuted = VoiceVideoCallingSDK.isMicrophoneMuted(); | ||
// Check if remote video is available | ||
const isRemoteVideoEnabled = VoiceVideoCallingSDK.isRemoteVideoEnabled(); | ||
// Check if remote video is available | ||
const isRemoteVideoEnabled = VoiceVideoCallingSDK.isRemoteVideoEnabled(); | ||
// Check if local video is available | ||
const isLocalVideoEnabled = VoiceVideoCallingSDK.isLocalVideoEnabled(); | ||
// Check if local video is available | ||
const isLocalVideoEnabled = VoiceVideoCallingSDK.isLocalVideoEnabled(); | ||
// Accepts incoming call | ||
const acceptCallConfig = { | ||
withVideo: true // Accept call with/without video stream | ||
}; | ||
await VoiceVideoCallingSDK.acceptCall(acceptCallConfig); | ||
// Accepts incoming call | ||
const acceptCallConfig = { | ||
withVideo: true // Accept call with/without video stream | ||
}; | ||
await VoiceVideoCallingSDK.acceptCall(acceptCallConfig); | ||
// Rejects incoming call | ||
await VoiceVideoCallingSDK.rejectCall(); | ||
// Rejects incoming call | ||
await VoiceVideoCallingSDK.rejectCall(); | ||
// Ends/Stops current call | ||
await VoiceVideoCallingSDK.stopCall(); | ||
// Ends/Stops current call | ||
await VoiceVideoCallingSDK.stopCall(); | ||
// Mute/Unmute current call | ||
await VoiceVideoCallingSDK.toggleMute() | ||
// Mute/Unmute current call | ||
await VoiceVideoCallingSDK.toggleMute() | ||
// Display/Hide local video of current call | ||
await VoiceVideoCallingSDK.toggleLocalVideo() | ||
// Display/Hide local video of current call | ||
await VoiceVideoCallingSDK.toggleLocalVideo() | ||
// Clean up VoiceVideoCallingSDK (e.g.: Usually called when customer ends chat session) | ||
VoiceVideoCallingSDK.close(); | ||
// Clean up VoiceVideoCallingSDK (e.g.: Usually called when customer ends chat session) | ||
VoiceVideoCallingSDK.close(); | ||
} | ||
``` | ||
@@ -682,0 +692,0 @@ |
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 too big to display
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
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
1226670
255
11985
759