For the following javascript code snippet found at Health Bot Container Sample, the "store" object created from window.WebChat.createStore
, what does the "store" object do? What is the "store" object's purpose?
I am reading the web chat api documentation, but the description and explanation of the "store" object is not clear.
Thank you very much for your help on this matter.
const store = window.WebChat.createStore({}, function(store) { return function(next) { return function(action) {
if (action.type === 'DIRECT_LINE/CONNECT_FULFILLED') {
store.dispatch({
type: 'DIRECT_LINE/POST_ACTIVITY',
meta: {method: 'keyboard'},
payload: {
activity: {
type: "invoke",
name: "InitConversation",
locale: user.locale,
value: {
// must use for authenticated conversation.
jsonWebToken: jsonWebToken,
// Use the following activity to proactively invoke a bot scenario
/*
triggeredScenario: {
trigger: "{scenario_id}",
args: {
myVar1: "{custom_arg_1}",
myVar2: "{custom_arg_2}"
}
}
*/
}
}
}
});
}
return next(action);
}}});