Difference between revisions of "WID/Current/SDK/Overlay-combined"
m (Text replacement - "\|Platforms?=([^\|]*)PureEngage([\|]*)" to "|Platform=$1GenesysEngage-onpremises$2") |
(Published) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 3: | Line 3: | ||
|DisplayName=Overlay | |DisplayName=Overlay | ||
|TocName=Overlay | |TocName=Overlay | ||
− | | | + | |Context=Learn how to use an overlay window control that widgets can inject their UI into. |
|ComingSoon=No | |ComingSoon=No | ||
− | | | + | |Platform=GenesysEngage-cloud |
+ | |Role=Developer | ||
|Section={{Section | |Section={{Section | ||
|sectionHeading=Overview | |sectionHeading=Overview | ||
− | | | + | |anchor=overview |
− | |||
|alignment=Vertical | |alignment=Vertical | ||
|structuredtext=The Overlay plugin provides an overlay window control that widgets can inject their UI into, accepting the HTML UI, placing it inside an overlay control, and displaying the UI onscreen in a uniform overlay window fashion. This prevents individual widgets from managing the overlay themselves. It also means that each widget's UI can be moved between different container types. | |structuredtext=The Overlay plugin provides an overlay window control that widgets can inject their UI into, accepting the HTML UI, placing it inside an overlay control, and displaying the UI onscreen in a uniform overlay window fashion. This prevents individual widgets from managing the overlay themselves. It also means that each widget's UI can be moved between different container types. | ||
− | Overlay provides these benefits | + | Overlay provides these benefits: |
− | * Shows UI in center of window | + | |
− | * Open and close transition animations | + | *Shows the UI in the center of the window. |
− | * No overlapping overlays. Only one at a time. Automatically managed by the Overlay plugin | + | *Open and close transition animations. |
− | * Auto-recenter as browser window size is changed | + | *No overlapping overlays. Only one at a time. Automatically managed by the Overlay plugin. |
− | * Automatic application of mobile styles when running in mobile mode | + | *Auto-recenter as the browser window size is changed. |
+ | *Automatic application of mobile styles when running in mobile mode. | ||
===Usage=== | ===Usage=== | ||
− | Overlay is easy to use; you simply open and close it. When you call Overlay.open, you pass | + | Overlay is easy to use; you simply open and close it. When you call Overlay.open, you pass in the HTML content you want to show. If you call Overlay.open again while an overlay is already open, it will automatically close the previous overlay before showing yours (unless the previous overlay has reserved the overlay to prevent new overlays). |
− | {{NoteFormat|By default the overlay has no visible styles or content. You must pass in the HTML you want to show inside the Overlay area. Typically you should create an overlay-type container using Common.Generate.Container, put your content inside that, then send the whole thing into Overlay.open.}} | + | {{NoteFormat|By default, the overlay has no visible styles or content. You must pass in the HTML you want to show inside the Overlay area. Typically you should create an overlay-type container using Common.Generate.Container, put your content inside that, then send the whole thing into Overlay.open.|}} |
===Customization=== | ===Customization=== | ||
Overlay does not have customization options. | Overlay does not have customization options. | ||
===Mobile Support=== | ===Mobile Support=== | ||
Overlay automatically applies mobile CSS styles to its outer container to affect the content within the overlay view. It is up to the content inside the overlay view to dynamically change when the Genesys Widgets .cx-mobile CSS classname is applied to an outer container. | Overlay automatically applies mobile CSS styles to its outer container to affect the content within the overlay view. It is up to the content inside the overlay view to dynamically change when the Genesys Widgets .cx-mobile CSS classname is applied to an outer container. | ||
− | |||
|Status=No | |Status=No | ||
}}{{Section | }}{{Section | ||
|sectionHeading=Configuration | |sectionHeading=Configuration | ||
− | | | + | |anchor=config |
− | |||
|alignment=Vertical | |alignment=Vertical | ||
|structuredtext=Overlay does not have configuration options. | |structuredtext=Overlay does not have configuration options. | ||
− | |||
|Status=No | |Status=No | ||
}}{{Section | }}{{Section | ||
|sectionHeading=Localization | |sectionHeading=Localization | ||
− | | | + | |anchor=localize |
− | |||
|alignment=Vertical | |alignment=Vertical | ||
|structuredtext=Overlay does not have localization options. | |structuredtext=Overlay does not have localization options. | ||
− | |||
|Status=No | |Status=No | ||
}}{{Section | }}{{Section | ||
− | |sectionHeading=API | + | |sectionHeading=API commands |
− | | | + | |anchor=commands |
− | |||
|alignment=Vertical | |alignment=Vertical | ||
|structuredtext=Once you've registered your plugin on the bus, you can call commands on other registered plugins. Here's how to use the global bus object to register a new plugin on the bus. | |structuredtext=Once you've registered your plugin on the bus, you can call commands on other registered plugins. Here's how to use the global bus object to register a new plugin on the bus. | ||
− | {{NoteFormat|The global bus object is a debugging tool. When implementing Widgets on your own site, do not use the global bus object to register your custom plugins. Instead, see {{Link- | + | {{NoteFormat|The global bus object is a debugging tool. When implementing Widgets on your own site, do not use the global bus object to register your custom plugins. Instead, see {{Link-SomewhereInThisVersion|manual=SDK|topic=GWCBusExtensions|display text=Genesys Widgets Extensions}} for more information about extending Genesys Widgets.|1}} |
− | <source lang= | + | <source lang="javascript">var oMyPlugin = window._genesys.widgets.bus.registerPlugin('MyPlugin'); |
oMyPlugin.command('Overlay.close');</source> | oMyPlugin.command('Overlay.close');</source> | ||
Line 64: | Line 59: | ||
Opens the provided HTML in an Overlay View. When successful, it returns back the HTML and a custom close event for you to subscribe to. This alerts you when your overlay instance has been closed. You can also make your overlay immutable so that new overlay instances don't close yours. Only your widget can close its overlay when immutable is set to true. | Opens the provided HTML in an Overlay View. When successful, it returns back the HTML and a custom close event for you to subscribe to. This alerts you when your overlay instance has been closed. You can also make your overlay immutable so that new overlay instances don't close yours. Only your widget can close its overlay when immutable is set to true. | ||
====Example==== | ====Example==== | ||
− | <source lang= | + | <source lang="javascript"> |
oMyPlugin.command('Overlay.open', { | oMyPlugin.command('Overlay.open', { | ||
Line 122: | Line 117: | ||
====Example==== | ====Example==== | ||
</div> | </div> | ||
− | <span id="<source lang= | + | <span id="<source lang=""""javascript""""> |
oMyPlugin.command('Overlay.close').done(function(e){ | oMyPlugin.command('Overlay.close').done(function(e){ | ||
Line 131: | Line 126: | ||
// Overlay failed to close | // Overlay failed to close | ||
}); | }); | ||
− | </source>" class="mceNonEditable wikimagic mw-tag" title="<source lang= | + | </source>" class="mceNonEditable wikimagic mw-tag" title="<source lang=""""javascript"""">oMyPlugin.command('Overlay.close').done(function(e){ // Overlay closed successfully}).fail(function(e){ // Overlay failed to close});</source>" data-mw-type="tag" data-mw-id="166014" data-mw-name="source" data-mw-wikitext="%3Csource%20lang='javascript'%3E%0AoMyPlugin.command('Overlay.close').done(function(e)%7B%0A%0A%09//%20Overlay%20closed%20successfully%0A%0A%7D).fail(function(e)%7B%0A%0A%09//%20Overlay%20failed%20to%20close%0A%7D);%0A%3C/source%3E" contenteditable="false"></span> |
<div> | <div> | ||
Line 138: | Line 133: | ||
{{{!}} | {{{!}} | ||
{{!}}- | {{!}}- | ||
− | !{{!}} Status | + | !{{!}}Status |
− | !{{!}} When | + | !{{!}}When |
− | !{{!}} Returns | + | !{{!}}Returns |
{{!}}- | {{!}}- | ||
− | {{!}}{{!}} resolved | + | {{!}}{{!}}resolved |
− | {{!}}{{!}} When Overlay is successfully closed. | + | {{!}}{{!}}When Overlay is successfully closed. |
− | {{!}}{{!}} n/a | + | {{!}}{{!}}n/a |
{{!}}- | {{!}}- | ||
− | {{!}}{{!}} rejected | + | {{!}}{{!}}rejected |
− | {{!}}{{!}} When Overlay is already closed. | + | {{!}}{{!}}When Overlay is already closed. |
− | {{!}}{{!}} 'Overlay view is already closed' | + | {{!}}{{!}}'Overlay view is already closed' |
{{!}}- | {{!}}- | ||
− | {{!}}{{!}} rejected | + | {{!}}{{!}}rejected |
− | {{!}}{{!}} When Overlay view is immutable. | + | {{!}}{{!}}When Overlay view is immutable. |
− | {{!}}{{!}} 'Overlay view is currently reserved' | + | {{!}}{{!}}'Overlay view is currently reserved' |
{{!}}} | {{!}}} | ||
</div></object> | </div></object> | ||
{{!}}} | {{!}}} | ||
− | |||
|Status=No | |Status=No | ||
}}{{Section | }}{{Section | ||
− | |sectionHeading=API | + | |sectionHeading=API events |
− | | | + | |anchor=events |
− | |||
|alignment=Vertical | |alignment=Vertical | ||
|structuredtext=Once you've registered your plugin on the bus, you can subscribe to and listen for published events. Here's how to use the global bus object to register a new plugin on the bus. | |structuredtext=Once you've registered your plugin on the bus, you can subscribe to and listen for published events. Here's how to use the global bus object to register a new plugin on the bus. | ||
− | {{NoteFormat|The global bus object is a debugging tool. When implementing Widgets on your own site, do not use the global bus object to register your custom plugins. Instead, see {{Link- | + | {{NoteFormat|The global bus object is a debugging tool. When implementing Widgets on your own site, do not use the global bus object to register your custom plugins. Instead, see {{Link-SomewhereInThisVersion|manual=SDK|topic=GWCBusExtensions|display text=Genesys Widgets Extensions}} for more information about extending Genesys Widgets.|1}} |
− | |||
− | <source lang= | + | <source lang="javascript">var oMyPlugin = window._genesys.widgets.bus.registerPlugin('MyPlugin'); |
oMyPlugin.subscribe('Overlay.ready', function(e){});</source> | oMyPlugin.subscribe('Overlay.ready', function(e){});</source> | ||
Line 181: | Line 173: | ||
{{!}}{{!}}n/a | {{!}}{{!}}n/a | ||
{{!}}} | {{!}}} | ||
− | |||
|Status=No | |Status=No | ||
}} | }} | ||
}} | }} |
Latest revision as of 20:56, February 3, 2021
Contents
Learn how to use an overlay window control that widgets can inject their UI into.
Overview
The Overlay plugin provides an overlay window control that widgets can inject their UI into, accepting the HTML UI, placing it inside an overlay control, and displaying the UI onscreen in a uniform overlay window fashion. This prevents individual widgets from managing the overlay themselves. It also means that each widget's UI can be moved between different container types.
Overlay provides these benefits:
- Shows the UI in the center of the window.
- Open and close transition animations.
- No overlapping overlays. Only one at a time. Automatically managed by the Overlay plugin.
- Auto-recenter as the browser window size is changed.
- Automatic application of mobile styles when running in mobile mode.
Usage
Overlay is easy to use; you simply open and close it. When you call Overlay.open, you pass in the HTML content you want to show. If you call Overlay.open again while an overlay is already open, it will automatically close the previous overlay before showing yours (unless the previous overlay has reserved the overlay to prevent new overlays).
Customization
Overlay does not have customization options.
Mobile Support
Overlay automatically applies mobile CSS styles to its outer container to affect the content within the overlay view. It is up to the content inside the overlay view to dynamically change when the Genesys Widgets .cx-mobile CSS classname is applied to an outer container.
Configuration
Overlay does not have configuration options.
Localization
Overlay does not have localization options.
API commands
Once you've registered your plugin on the bus, you can call commands on other registered plugins. Here's how to use the global bus object to register a new plugin on the bus.
var oMyPlugin = window._genesys.widgets.bus.registerPlugin('MyPlugin');
oMyPlugin.command('Overlay.close');
open
Opens the provided HTML in an Overlay View. When successful, it returns back the HTML and a custom close event for you to subscribe to. This alerts you when your overlay instance has been closed. You can also make your overlay immutable so that new overlay instances don't close yours. Only your widget can close its overlay when immutable is set to true.
Example
oMyPlugin.command('Overlay.open', {
html: '<div>Template</div>',
immutable: false,
group: false
}).done(function(e){
// Overlay opens successfully
}).fail(function(e){
// Overlay failed to open
});
Options
Option | Type | Description |
---|---|---|
html | string | HTML String template for overlay window. |
immutable | boolean | When set to true, overlay cannot be closed by other plugins. |
group | string | The name of the overlay window group you want to add a new overlay view into. |
Resolutions
Status | When | Returns | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
resolved | When overlay is successfully opened | {html: , events: <object>, group: } rejected When no html template is passed 'No HTML content was provided. Overlay has ignored your command.' rejected When overlay is already opened 'Overlay view is currently reserved.'
closeExample
Resolutions
|
API events
Once you've registered your plugin on the bus, you can subscribe to and listen for published events. Here's how to use the global bus object to register a new plugin on the bus.
var oMyPlugin = window._genesys.widgets.bus.registerPlugin('MyPlugin');
oMyPlugin.subscribe('Overlay.ready', function(e){});
Name | Description | Data |
---|---|---|
ready | The Overlay plugin is initialized and ready to accept commands | n/a |