microsoft / BotFramework-WebChat

A highly-customizable web-based client for Azure Bot Services.
https://www.botframework.com/
MIT License
1.59k stars 1.54k forks source link

Expose dispatch action type constants #2372

Open abishekreddy opened 5 years ago

abishekreddy commented 5 years ago

Feature Request

Describe the suggestion or request in detail

In webchat customization scenarios, to set dispatch events or to intercept events using a middleware, the type has to be set to a string like WEB_CHAT/SET_TEXT. It would be great if you could expose the list of supported events as part of a constant so that we don't have strings sprayed across the project and devs can check which events are supported. Also, If the text associated with a particular event is changed here for some reason, devs wouldn't have to update it in their projects too.

[Enhancement]

corinagum commented 5 years ago

Thank you for the submission! We will discuss this as a team and get back to you. :)

@compulim, this seems like a good idea to me. Thoughts?

tdurnford commented 5 years ago

It might also be nice to expose some of the action functions as well.

import { sendEvent, sendMessage, sendMessageBack } from 'botframework-webchat-core'

...

store.dispatch(sendMessage('Hello, World!')); 

However, we probably don't want to expose some of the action functions such as the connection and speech related actions.

compulim commented 5 years ago

Yap, I was using DIRECT_LINE/* (internal) and WEB_CHAT/* (external), but probably need to revisit again to see if they are still appropriate.

compulim commented 5 years ago

FYI, I am working on redesigning the Web Chat API for the React side, didn't touch Redux yet.

After that work #2364 is completed, we can look at Redux store. I need to play around to understand more. Before hitting too deep, I have some bias, but not well thought out:

This work won't fit in 4.6 (release in late October or early November). Not sure about 4.7.

cwhitten commented 3 years ago

Loading this up for discussion and prioritization for an upcoming release.