This commit is contained in:
Erli-ms 2020-08-18 13:11:56 -07:00 коммит произвёл GitHub
Родитель 22393d02d1
Коммит df237cd7a0
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
8 изменённых файлов: 29 добавлений и 34 удалений

4
.github/workflows/ersuo_test_node.js.yml поставляемый
Просмотреть файл

@ -7,12 +7,14 @@ on:
push:
branches:
- main
- 'occlient_release_*'
tags:
- '*'
pull_request:
branches:
- main
- 'occlient_release_*'
jobs:
build:
@ -68,7 +70,7 @@ jobs:
- name: Run npm publish ${{ steps.read-package-json.outputs.name }}@${{ steps.read-package-json.outputs.version }}
run: |
npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
npm publish *.tgz --tag master --access public
npm publish *.tgz --tag main --access public
npm dist-tag add ${{ steps.read-package-json.outputs.name }}@${{ steps.read-package-json.outputs.version }} latest
- uses: actions/create-release@v1
id: create-release

Просмотреть файл

@ -7,12 +7,12 @@ import { HostType } from '../types/ic3/HostType';
import { IC3DirectLineActivity } from '../types/ic3/IC3DirectLineActivity';
import { IIC3AdapterOptions } from '../types/ic3/IIC3AdapterOptions';
import { ProtocolType } from '../types/ic3/ProtocolType';
import { TelemetryEvents } from '../types/ic3/TelemetryEvents';
import { compose } from 'redux';
import createEgressEnhancer from './enhancers/egress/index';
import createIngressEnhancer from './enhancers/ingress/index';
import getPlatformBotId from './utils/getPlatformBotId';
import initializeIC3SDK from './initializeIC3SDK';
import { TelemetryEvents } from '../types/ic3/TelemetryEvents';
export default function createIC3Enhancer({
chatToken,
@ -29,13 +29,6 @@ export default function createIC3Enhancer({
featureConfig
}: IIC3AdapterOptions & { sdkUrl?: string }): AdapterEnhancer<IC3DirectLineActivity, IC3AdapterState> {
if (!chatToken) {
logger?.logClientSdkTelemetryEvent(Microsoft.CRM.Omnichannel.IC3Client.Model.LogLevel.ERROR,
{ Event: TelemetryEvents.CHAT_TOKEN_NOT_FOUND,
Description: `Adapter: "chatToken" must be specified`
});
throw new Error('"chatToken" must be specified.');
}
if (sdkUrl && !sdkURL) {
console.warn(
@ -61,10 +54,6 @@ export default function createIC3Enhancer({
(async function () {
if(!conversation){
logger?.logClientSdkTelemetryEvent(Microsoft.CRM.Omnichannel.IC3Client.Model.LogLevel.DEBUG,
{ Event: TelemetryEvents.IC3_SDK_INITIALIZE_STARTED,
Description: `Adapter: No conversation found; initializing IC3 SDK`
});
const sdk = await initializeIC3SDK(
sdkURL,
{
@ -81,7 +70,7 @@ export default function createIC3Enhancer({
logger?.logClientSdkTelemetryEvent(Microsoft.CRM.Omnichannel.IC3Client.Model.LogLevel.DEBUG,
{ Event: TelemetryEvents.IC3_SDK_JOIN_CONVERSATION_STARTED,
Description: `Adapter: No conversation found; joinging conversation`
Description: `Adapter: No conversation found; joining conversation`
});
conversation = await sdk.joinConversation(chatToken.chatId, sendHeartBeat);
logger?.logClientSdkTelemetryEvent(Microsoft.CRM.Omnichannel.IC3Client.Model.LogLevel.DEBUG,

Просмотреть файл

@ -52,7 +52,7 @@ export default function createEgressMessageActivityMiddleware(): EgressMiddlewar
type: Microsoft.CRM.Omnichannel.IC3Client.Model.PersonType.User
},
timestamp: new Date(timestamp),
tags: channelData.tags,
tags: channelData.tags ?? [],
clientmessageid: uniqueClientMessageId
};

Просмотреть файл

@ -7,8 +7,8 @@ import { AsyncMapper } from '../../../../types/ic3/AsyncMapper';
import { GetStateFunction } from '../../../../types/AdapterTypes';
import { IC3DirectLineActivity } from '../../../../types/ic3/IC3DirectLineActivity';
import { IC3_CHANNEL_ID } from '../../../Constants';
import uniqueId from '../../../utils/uniqueId';
import { TelemetryEvents } from '../../../../types/ic3/TelemetryEvents';
import uniqueId from '../../../utils/uniqueId';
export default function createTypingMessageToDirectLineActivityMapper ({ getState }: { getState: GetStateFunction<IC3AdapterState>;}):
AsyncMapper<Microsoft.CRM.Omnichannel.IC3Client.Model.IThread, IC3DirectLineActivity>
@ -20,10 +20,10 @@ AsyncMapper<Microsoft.CRM.Omnichannel.IC3Client.Model.IThread, IC3DirectLineActi
getState(StateKey.Logger)?.logClientSdkTelemetryEvent(Microsoft.CRM.Omnichannel.IC3Client.Model.LogLevel.ERROR,
{
Event: TelemetryEvents.CONVERSATION_NOT_FOUND,
Description: `Adapter: Failed to ingress without an active conversation.`
Description: `Adapter: Failed to ingress thread update without an active conversation.`
}
);
throw new Error('IC3: Failed to ingress without an active conversation.');
throw new Error('IC3: Failed to ingress thread update without an active conversation.');
}
const { id, members, properties, type } = thread;

Просмотреть файл

@ -7,8 +7,8 @@ import { AsyncMapper } from '../../../../types/ic3/AsyncMapper';
import { GetStateFunction } from '../../../../types/AdapterTypes';
import { IC3DirectLineActivity } from '../../../../types/ic3/IC3DirectLineActivity';
import { IC3_CHANNEL_ID } from '../../../Constants';
import uniqueId from '../../../utils/uniqueId';
import { TelemetryEvents } from '../../../../types/ic3/TelemetryEvents';
import uniqueId from '../../../utils/uniqueId';
export default function createTypingMessageToDirectLineActivityMapper({
getState
@ -27,10 +27,10 @@ export default function createTypingMessageToDirectLineActivityMapper({
getState(StateKey.Logger)?.logClientSdkTelemetryEvent(Microsoft.CRM.Omnichannel.IC3Client.Model.LogLevel.ERROR,
{
Event: TelemetryEvents.CONVERSATION_NOT_FOUND,
Description: `Adapter: Failed to ingress without an active conversation.`
Description: `Adapter: Failed to ingress typing without an active conversation.`
}
);
throw new Error('IC3: Failed to ingress without an active conversation.');
throw new Error('IC3: Failed to ingress typing without an active conversation.');
}
const {

Просмотреть файл

@ -7,8 +7,8 @@ import { AsyncMapper } from '../../../../types/ic3/AsyncMapper';
import { GetStateFunction } from '../../../../types/AdapterTypes';
import { IC3DirectLineActivity } from '../../../../types/ic3/IC3DirectLineActivity';
import { IC3_CHANNEL_ID } from '../../../Constants';
import uniqueId from '../../../utils/uniqueId';
import { TelemetryEvents } from '../../../../types/ic3/TelemetryEvents';
import uniqueId from '../../../utils/uniqueId';
const IMAGE_CONTENT_TYPES: { [type: string]: string } = {
//image
@ -64,12 +64,6 @@ export default function createUserMessageToDirectLineActivityMapper({
return next => async (message: Microsoft.CRM.Omnichannel.IC3Client.Model.IMessage) => {
if (message.messageType !== Microsoft.CRM.Omnichannel.IC3Client.Model.MessageType.UserMessage) {
getState(StateKey.Logger)?.logClientSdkTelemetryEvent(Microsoft.CRM.Omnichannel.IC3Client.Model.LogLevel.ERROR,
{
Event: TelemetryEvents.CONVERSATION_NOT_FOUND,
Description: `Adapter: Failed to ingress without an active conversation.`
}
);
return next(message);
}
@ -79,10 +73,10 @@ export default function createUserMessageToDirectLineActivityMapper({
getState(StateKey.Logger)?.logClientSdkTelemetryEvent(Microsoft.CRM.Omnichannel.IC3Client.Model.LogLevel.ERROR,
{
Event: TelemetryEvents.CONVERSATION_NOT_FOUND,
Description: `Adapter: Failed to ingress without an active conversation.`
Description: `Adapter: Failed to ingress message without an active conversation.`
}
);
throw new Error('IC3: Failed to ingress without an active conversation.');
throw new Error('IC3: Failed to ingress message without an active conversation.');
}
const {

Просмотреть файл

@ -1,7 +1,6 @@
/// <reference path="../types/ic3/external/Model.d.ts" />
/// <reference path="../types/ic3/external/SDK.d.ts" />
import { IAdapterLogger } from "./telemetry/IAdapterLogger";
import { TelemetryEvents } from "../types/ic3/TelemetryEvents";
const DEFAULT_SDK_URL = 'https://comms.omnichannelengagementhub.com/release/2019.12.27.1/Scripts/SDK/SDK.min.js';

Просмотреть файл

@ -1,6 +1,5 @@
import getSDKFromURL from './getSDKFromURL';
import { IAdapterLogger } from './telemetry/IAdapterLogger';
import { TelemetryEvents } from '../types/ic3/TelemetryEvents';
import getSDKFromURL from './getSDKFromURL';
let _sdk: Microsoft.CRM.Omnichannel.IC3Client.Model.ISDK | null = null;
let _sdkInfo: any;
@ -18,12 +17,24 @@ export default async function initializeIC3SDK(
sessionInfo: sessionInfo
};
try{
if (!sessionInfo.token) {
options?.logger?.logClientSdkTelemetryEvent(Microsoft.CRM.Omnichannel.IC3Client.Model.LogLevel.ERROR,
{ Event: TelemetryEvents.CHAT_TOKEN_NOT_FOUND,
Description: `Adapter: chatToken must be specified`
});
throw new Error('chatToken must be specified.');
}
const sdk = await getSDKFromURL(sdkURL, options);
options?.logger?.logClientSdkTelemetryEvent(Microsoft.CRM.Omnichannel.IC3Client.Model.LogLevel.DEBUG,
{ Event: TelemetryEvents.IC3_SDK_INITIALIZE_STARTED,
Description: `Adapter: No conversation found; initializing IC3 SDK`
}
);
await sdk.initialize(sessionInfo);
options?.logger?.logClientSdkTelemetryEvent(Microsoft.CRM.Omnichannel.IC3Client.Model.LogLevel.DEBUG,
{
Event: TelemetryEvents.IC3_SDK_INITIALIZE_SUCCESS,
Description: `Adapter: IC3 SDK initialization success`
Description: `Adapter: IC3 SDK initialization success`
}
);
_sdk = sdk;