Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
initConversation(props: EmulatorProps, options: any): void {
const encodedOptions = encode(JSON.stringify(options));
// TODO: We need to use encoded token because we need to pass both endpoint ID and conversation ID
// We should think about a better model to pass conversation ID from Web Chat to emulator core
const directLine = createDirectLine({
secret: encodedOptions,
domain: `${this.props.url}/v3/directline`,
webSocket: false,
});
this.props.newConversation(props.documentId, {
conversationId: options.conversationId,
// webChatStore,
directLine,
userId: options.userId,
mode: options.mode,
});
}
getDirectLineToken().then(token => setDirectLine(createDirectLine({ token })));
}
this.setState(() => ({
directLine: createDirectLine({ token })
}));
}
this.setState(() => ({
directLine: createDirectLine({ token })
}));
}
this.setState(() => ({
directLine: createDirectLine({
token
}),
webSpeechPonyfillFactory
}));
}
),
ipcRenderer: new Proxy(
{},
{
get(): any {
return () => ({});
},
has() {
return true;
},
}
),
}));
const defaultDocument = {
directLine: createDirectLine({
secret: '1234',
domain: 'http://localhost/v3/directline',
webSocket: false,
}),
inspectorObjects: [],
botId: '456',
mode: 'livechat',
};
const mockStore = createStore(combineReducers({ bot, chat, clientAwareSettings, editor }), {
chat: {
chats: {
doc1: defaultDocument,
},
pendingSpeechTokenRetrieval: false,
webChatStores: {},