downloadMedia(media)
Downloads a media resource via an Api (AJAX) request and creates the blob in client-side
media Object
url
String: The URL of the mediatype
String: The content-type of the medianame
String: The name the media file will havecontrolInvitationTTL(inboxElement, ttlElement, invitationExpiration, callback)
Update the element with the TTL provided every second. If the countdown gets to 0, remove the element.
inboxElement
HTMLElement: HTMLElement that will be removed when the countdown gets to 0ttlElement
HTMLElement: HTMLElement where the TTL will be printed and updatedinvitationExpiration
Integer: UNIX time when the invitation expirescallback
Function: function to execute after the counter has reached 0getBrowserExpirationTime(serverExpirationTime, timeDifferenceWithServer, ping)
Returns a recalculated expiration time considering the browser time, the server time and the ping between them
serverExpirationTime
Date: A unix timestamptimeDifferenceWithServer
Date: The difference in seconds between the local time and the server timeping
Integer: ping in milisecondscontrolChatActiveTime
Update the chat active timer element every second until the chat gets closed
chat
Chat: Chat objectchatTimerElement
HTMLElement: element where the timer will be printed and updatedacceptedTime
Integer: UNIX timestamp when the chat was acceptedmonitorUserActivity(input, chat, intervalTime, noChangeMax, errorHandler = null)
Watches an input element for changes and manages and captures activity events
input
HTMLElement: HTMLElement instance of the chat inputchat
Chat: Chat instanceintervalTime
Integer: Interval time to look for input changesnoChangeMax
Integer: Maximum number of intervals passed to consider that the user is not writing anymoreerrorHandler
Function: Callback that will be executed if an error happens when sending the user activity to the servergetUnixTime()
Get the current time as a UNIX timestamp
addScript(src)
Add a script to the page
src
: String: The URL of the scriptdownloadConversation(chatId, props, requestData)
Download a chat conversation as a PDF file
chatId
String: ID of the chat its conversation will be downloadedprops Object optional
template
String: Contains an alternative to the default template. The string must be an HTML fulfilling the Vue Template Syntax. labels
Object: An object in the vue-i18n format for template labels in different languages.dateTimeFormats
Object: An object in the vue-i18n DateTime localization format for date and time formats in different languages.ticketId
String: Ticket id that will be shown in the PDF.methods
Object: It contains functions that will be available in the custom template.requestData
Object optional: An object to pass additional parameters to the /chats/{chatId}/history request necessary to download the conversation PDF.
isInWorktimeNow(roomId)
Returns a Promise
roomId
Integer: Identifier of the room/queue.getWorktimeTable(roomId, timezone)
Returns a Promise
roomId
Integer: Identifier of the room/queue.timezone
String: Valid timezone (for example, Europe/Madrid)timetable
Array: The defined working hours per day. The key 0 is for Monday, 6 for Sunday. Example:
"0": [
{
"from": "08:00",
"to": "20:00"
}
],
"1": [
{
"from": "08:00",
"to": "12:00"
},
{
"from": "15:00",
"to": "20:00"
}
],
"6": [
{
"from": "00:00",
"to": "12:00"
}
]
holidays
Array: The value of the days as integers in the yyyymmdd format:
"holidays": [
20230210,
20230211,
],