I was able to get the example from Genesys working with a synchronous confirm box.? can I extend this using an asynchronous Bootstrap modal like the following
this is what we currently have
I'm not sure if I should be passing in parameters to command('CoBrowse.start') or even calling it again.
localWidgetPlugin = CXBus.registerPlugin('MyLocalCustomization');
localWidgetPlugin.before("CoBrowse.start", function (oData) {
//if (confirm('Continue?')) return oData; // This works (synchronous).
//return null;
if (!shareScreen) { // This is set to "false" by default.
var oModal = $('<div class="modal fade" tabindex="-1" role="dialog">' + // Instantiates a Bootstrap 3 modal (asynchronous).
'<div class="modal-dialog" role="document">' +
'<div class="modal-content">' +
'<div class="modal-body">' +
'<p>Do you want to continue?</p>' +
'</div>' +
'<div class="modal-footer">' +
'<button type="button" class="btn btn-default cancel" data-dismiss="modal">No</button>' +
'<button type="button" class="btn btn-primary ok">Yes</button>' +
'</div>' +
'</div>' +
'</div>' +
'</div>');
oModal.find('button.cancel').click(function () { }); // Customer clicks the "no" button.
oModal.find('button.ok').click(function () { // Customer clicks the "yes" button.
shareScreen = true;
oModal.modal('toggle'); // Hides the modal.
localWidgetPlugin.command('CoBrowse.start').done(function (e) { // Starts the co-browse again.
shareScreen = false; // Resets so customer is asked again the next time co-browse starts.
}).fail(function (e) { });
});
oModal.modal('show'); // Shows the asynchronous modal.
return null; // Cancels the co-browse start until customer confirms.
}
return oData; // Resumes the co-browse start.
});
#DigitalChannels------------------------------
Ali K
ENMAX Corp.
------------------------------