define(["js/api-impl/api-agent-chat-impl"], function(impl) {
var exports = impl.namespace("NM.api.chat.agent");
exports.chat = {
info : {
/** This function switches the chat info view to the
* tab with the specified name.
*
* @param tabname {string} name of the tab
* @function switchTab
*/
switchTab : function(tabname) {
return impl.chat.info.switchTab(tabname);
}
},
editor : {
/** This function inserts plain text at the current cursor position
* into the chat agent editor content area.
* Please note that insert operations of huge text content may cause
* browser freeze or crash depending on the client environment and
* browser type.
* If the select parameter is true, the inserted text will be selected
* automatically after the insert operation.
* @param text {string} Text to insert into the html
* @param select {boolean} if true, the inserted text will be selected automatically after the insert operation
* @function insertText
*/
insertText : function(text, select) {
return impl.chat.editor.insertText(text, select);
},
/** This function inserts html text at the current cursor position
* into the chat agent editor content area.
* The html code can contain the following tags and attributes:
* br, p, strong, b, u, i, em, span[id|style|class],
* a[title|href|target|class], img[src|alt|style]
* Please note that insert operations of huge html content may cause
* browser freeze or crash depending on the client environment and
* browser type.
* If the select parameter is true, the inserted text will be selected
* automatically after the insert operation.
* @param text {string} Text to insert into the html
* @param select {boolean} if true, the inserted text will be selected automatically after the insert operation
* @function insertHtml
*/
insertHtml : function(html, select) {
return impl.chat.editor.insertHtml(html, select);
}
}
};
exports.call = {
/** This function starts an outgoing call for an agent
* logged on with a phone device on the novomind iAGENT Desk.
* The outgoing call request can show up a confirm dialog
* which has to be confirmed by the agent manually.
*
* @param phoneNumber {number} the phone number
*
* @param options {object}
* object containing the following properties:
* <pre>
* chatId : the id of the related chat for the call (optional)
* tenantId : the id of the tenant of the call (optional)
* categoryId : the id of the category of the call (optional)
* skipDialog : if set to true the confirm dialog is skipped
* assignContact : if set to true the dialed number will be assigned to the contact of the related chat if provided
* </pre>
* @function startOutgoingCall
*/
startOutgoingCall : function(phoneNumber, options) {
return impl.call.startOutgoingCall(phoneNumber, options);
}
};
return exports;
});