What's a context?
Context is an entity which encapsulates the operations and events related a specific area.
For example, all the APIs related to an object are encapsulated in the recordContext. Once the framework is initialized and the context is obtained, you can perform record level operations such as set an input field value of a record, get a value loaded into a text area, or if the agent updates the value of a field, an event can be fired on the record level. There are other contexts for specific use cases.
- GlobalContext: This context encapsulates the events and operations related on a global level. An example would be, opening an SR in a new MSI tab or browser tab is an event which is happening on a global level. So a tab open event is something that you can use to listen to on a GlobalContext. The type details are available in IGlobalContext.
- TabContext: At this context level you can focus or close a specific tab. Or you can subscribe to an event context open, meaning the content loaded into the specific tab can be accessed when this event is fired. The type details are available in ITabContext.
- Record Context:: Encapsulates field related operations an events. For instance, setting a field value, read a value from an input field, or listening to a field value change. The type details are available inIRecordContext
- SidePaneContext: With this context, we can expand or collapse a specific side pane, we can update the content of a side pane. We can subscribe to side pane open and close events. The type details are available in ISidePaneContext
- Modal Window Context: : At this context level, we can open/close Modal/Popup(s).
- NotificationContext: At this context level, we can open/close Show and close notifications and listen to the close action and action trigger event of the notifications.
- MultiChannelAdapterContext: This object encapsulates the events and actions on different channels when there's a telephonic or chat interaction happening.
- PhoneContext: This object can be derived from
MultiChannelAdaptorContext object by calling
getCommunicationChannelContext
by passing channel type asPHONE
. - InsightsContext: At this context level, we can open/dismiss insights and listen to the close action and action trigger event of the insights.
Think of it like this: a TabOpen event is triggered at GlobalContext level. The RecordOpen event is triggered at the Tab Context level, and a FieldValueChange event is triggered at a RecordContext level.
Here's more details:
Context Type | Supported Events | Supported Operations | API to get the context |
---|---|---|---|
GlobalContext | TabOpen, TabClose, TabChange, CustomEvent | PopOperation (open a tab/record pop a page), InvokeServiceConnection, GetAgentInfo, CustomEvent | getGlobalContext(): Promise<IGlobalContext>; |
TabContext | ContextOpen, ContextClose, CustomEvent | FocusTab, CloseTab, PopOperation, GetAgentInfo, CustomEvent, OpenModal, CloseModal, OpenPopup, ClosePopup | getTabContext(browserTabId?: string): Promise<ITabContext>; |
RecordContext | FieldValueChange, OnBeforeSave(Controllable Event), OnAfterSave, OnDataLoad, CustomEvent | GetFieldValue, SaveRecord, SetFieldValue, CustomEvent | getAvailableRecords(tabId?: string): Promise<IRecordContext[]>; |
SidePaneContext | SidePaneOpen, SidePaneClose | Expand Side pane, Collapse Side pane, Update Side pane | getSidePaneContext(sidePaneId: string): Promise<ISidePaneContext>; |
ModalWindowContext | NA | Open Modal, Close Modal, Open Popup, Close Popup | getModalWindowContext(): Promise<IModalWindowContext>; |
MultiChannelAdaptorContext | NA | NA | getMultiChannelAdaptorContext(): Promise<IMultiChannelAdaptorContext>; |
PhoneContext | OnToolbarAgentCommand, OnToolbarInteractionCommand, OnDataUpdated, OnOutgoingEvent | NewCommEvent, StartCommEvent, CloseCommEvent, OutboundCommError, GetConfiguration, DisableFeature, ReadyForOperation, AgentStateEvent | getCommunicationChannelContext(channelType: McaChannels): Promise<ICommunicationChannelContext>; |
NotificationContext | OnNotificationAction, OnNotificationCloseAction | ShowNotification, CloseNotification | getNotificationContext(): Promise<INotificationContext>; |
InsightsContext | OnInsightsAction, OnInsightsDismissAction | ShowInsights, DismissInsights | getInsightsContext(): Promise<IInsightsContext>; |