Terminal plugin
This plugin is a wrapper of the terminals helper exposed by the framework and adds some extra functionality.
How does it work
Expose one component (the wrapper of terminals helper) and some dispatchers to manage the expandable sections functionality and one core method to get the host response.
Components
POSTerminal
Adds a terminal with their entity with a default host connection in adaptive mode
Props
-
terminalId String [REQUIRED]
The id of the terminal to be created. This id is required.
Example
<POSComponent componentName="POSTerminal" terminalId="terminal-1" />
Expandable sections
This plugin also has built-in support to manage the two different type of expandable sections within interactive terminal screens build with TAST. Across this documentation, we will make a clear distinction between two types of inlines: the trigger inline (the piece of text or hyperlink that will open and close an expandable section) and the target inline, the expandable section itself. When you hit a trigger inline, two things may occur depending on the target inline it is referencing:
-
If the target inline referenced by the trigger is already visible with the trigger’s content, it gets hidden.
-
If the target inline referenced by the trigger is already visible with another trigger’s content that’s also referencing the same target inline, content gets changed with the latest trigger’s content.
-
If the target inline referenced by the trigger is hidden, it is made visible with the trigger’s content.
Custom content
By using the setExpandableSectionContent action you can create an expandable section with TAST content or just plain text.
Example
[
{
"type": "Scope",
"children": [
{
"type": "Inline",
"inlineType": "infoLink",
"action": {
"type": "pos-web-plugin-terminal/SET_EXPANDABLE_SECTION_CONTENT_FROM_HOST",
"toggleRef": "inline-ref",
"content": "CUSTOM CONTENT"
},
"children": ["TRIGGER INLINE"]
},
{
"type": "Inline",
"inlineType": "stripedTable",
"ref": "inline-ref",
"isVisible": false,
"children": ["\b"]
}
]
}
]
Host response
By using the setExpandableSectionContentFromHost action, the content shown within the referenced expandable section will be a terminal response resulting from the given entry. In case the response has pagination, “Move Up” and “Move Down” links will be automatically added, and their standard functionality is already built-in.
Example
[
{
"type": "Scope",
"children": [
{
"type": "Inline",
"inlineType": "infoLink",
"action": {
"type": "pos-web-plugin-terminal/SET_EXPANDABLE_SECTION_CONTENT_FROM_HOST",
"toggleRef": "inline-ref",
"entry": "HELP"
},
"children": ["TRIGGER INLINE"]
},
{
"type": "Inline",
"inlineType": "stripedTable",
"ref": "inline-ref",
"isVisible": false,
"children": ["\b"]
}
]
}
]
Get host response
This is exposed as a method. This function returns the host entry response once it's received.
const response = await methodsHelper.invoke('getHostResponse', {
terminalId: 'terminal-1',
entry: 'HELP',
});