Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public static *newChat(action: ChatAction>): Iterable {
const { documentId, resolver } = action.payload;
// Create a new webchat store for this documentId
yield put(webChatStoreUpdated(documentId, createWebChatStore()));
// Each time a new chat is open, retrieve the speech token
// if the endpoint is speech enabled and create a bound speech
// pony fill factory. This is consumed by WebChat...
yield put(webSpeechFactoryUpdated(documentId, undefined)); // remove the old factory
const conversationId = yield select(getConversationIdFromDocumentId, documentId);
// Try the bot file
let endpoint: IEndpointService = yield select(getEndpointServiceByDocumentId, documentId);
// Not there. Try the service
if (!endpoint) {
try {
const serverUrl = yield select((state: RootState) => state.clientAwareSettings.serverUrl);
const endpointResponse: Response = yield ConversationService.getConversationEndpoint(serverUrl, conversationId);
if (!endpointResponse.ok) {
const error = yield endpointResponse.json();
throw new Error(error.error.message);
}
const memoizedStore = useMemo(() => store || createStore(), [store]);