2017-11-23 21:13:02 +00:00
if ( ! window . zammadChatTemplates ) {
window . zammadChatTemplates = { } ;
}
window . zammadChatTemplates [ "agent" ] = function ( _ _obj ) {
if ( ! _ _obj ) _ _obj = { } ;
var _ _out = [ ] , _ _capture = function ( callback ) {
var out = _ _out , result ;
_ _out = [ ] ;
callback . call ( this ) ;
result = _ _out . join ( '' ) ;
_ _out = out ;
return _ _safe ( result ) ;
} , _ _sanitize = function ( value ) {
if ( value && value . ecoSafe ) {
return value ;
} else if ( typeof value !== 'undefined' && value != null ) {
return _ _escape ( value ) ;
} else {
return '' ;
}
} , _ _safe , _ _objSafe = _ _obj . safe , _ _escape = _ _obj . escape ;
_ _safe = _ _obj . safe = function ( value ) {
if ( value && value . ecoSafe ) {
return value ;
} else {
if ( ! ( typeof value !== 'undefined' && value != null ) ) value = '' ;
var result = new String ( value ) ;
result . ecoSafe = true ;
return result ;
}
} ;
if ( ! _ _escape ) {
_ _escape = _ _obj . escape = function ( value ) {
return ( '' + value )
. replace ( /&/g , '&' )
. replace ( /</g , '<' )
. replace ( />/g , '>' )
. replace ( /"/g , '"' ) ;
} ;
}
( function ( ) {
( function ( ) {
if ( this . agent . avatar ) {
_ _out . push ( '\n<img class="zammad-chat-agent-avatar" src="' ) ;
_ _out . push ( _ _sanitize ( this . agent . avatar ) ) ;
_ _out . push ( '">\n' ) ;
}
_ _out . push ( '\n<span class="zammad-chat-agent-sentence">\n <span class="zammad-chat-agent-name">' ) ;
_ _out . push ( _ _sanitize ( this . agent . name ) ) ;
_ _out . push ( '</span>\n</span>' ) ;
} ) . call ( this ) ;
} ) . call ( _ _obj ) ;
_ _obj . safe = _ _objSafe , _ _obj . escape = _ _escape ;
return _ _out . join ( '' ) ;
} ;
2015-11-11 20:44:54 +00:00
var bind = function ( fn , me ) { return function ( ) { return fn . apply ( me , arguments ) ; } ; } ,
2015-12-05 19:41:14 +00:00
slice = [ ] . slice ,
extend = function ( child , parent ) { for ( var key in parent ) { if ( hasProp . call ( parent , key ) ) child [ key ] = parent [ key ] ; } function ctor ( ) { this . constructor = child ; } ctor . prototype = parent . prototype ; child . prototype = new ctor ( ) ; child . _ _super _ _ = parent . prototype ; return child ; } ,
hasProp = { } . hasOwnProperty ;
2015-10-15 09:26:56 +00:00
( function ( $ , window ) {
2017-02-10 15:29:44 +00:00
var Base , Io , Log , Timeout , ZammadChat , myScript , scriptHost , scriptProtocol , scripts ;
2015-11-13 12:59:15 +00:00
scripts = document . getElementsByTagName ( 'script' ) ;
myScript = scripts [ scripts . length - 1 ] ;
2015-11-25 10:06:26 +00:00
scriptHost = myScript . src . match ( '.*://([^:/]*).*' ) [ 1 ] ;
2017-02-10 15:29:44 +00:00
scriptProtocol = myScript . src . match ( '(.*)://[^:/]*.*' ) [ 1 ] ;
2015-12-05 19:41:14 +00:00
Base = ( function ( ) {
Base . prototype . defaults = {
debug : false
} ;
function Base ( options ) {
this . options = $ . extend ( { } , this . defaults , options ) ;
this . log = new Log ( {
debug : this . options . debug ,
logPrefix : this . options . logPrefix || this . logPrefix
} ) ;
}
return Base ;
} ) ( ) ;
Log = ( function ( ) {
Log . prototype . defaults = {
debug : false
} ;
function Log ( options ) {
this . log = bind ( this . log , this ) ;
this . error = bind ( this . error , this ) ;
this . notice = bind ( this . notice , this ) ;
this . debug = bind ( this . debug , this ) ;
this . options = $ . extend ( { } , this . defaults , options ) ;
}
Log . prototype . debug = function ( ) {
var items ;
items = 1 <= arguments . length ? slice . call ( arguments , 0 ) : [ ] ;
2015-12-06 15:40:47 +00:00
if ( ! this . options . debug ) {
2015-12-05 19:41:14 +00:00
return ;
}
return this . log ( 'debug' , items ) ;
} ;
Log . prototype . notice = function ( ) {
var items ;
items = 1 <= arguments . length ? slice . call ( arguments , 0 ) : [ ] ;
return this . log ( 'notice' , items ) ;
} ;
Log . prototype . error = function ( ) {
var items ;
items = 1 <= arguments . length ? slice . call ( arguments , 0 ) : [ ] ;
2015-12-06 15:40:47 +00:00
return this . log ( 'error' , items ) ;
2015-12-05 19:41:14 +00:00
} ;
Log . prototype . log = function ( level , items ) {
2017-07-18 13:43:04 +00:00
var item , j , len , logString ;
2015-12-05 19:41:14 +00:00
items . unshift ( '||' ) ;
items . unshift ( level ) ;
items . unshift ( this . options . logPrefix ) ;
console . log . apply ( console , items ) ;
if ( ! this . options . debug ) {
return ;
}
logString = '' ;
2017-07-18 13:43:04 +00:00
for ( j = 0 , len = items . length ; j < len ; j ++ ) {
item = items [ j ] ;
2015-12-05 19:41:14 +00:00
logString += ' ' ;
if ( typeof item === 'object' ) {
logString += JSON . stringify ( item ) ;
} else if ( item && item . toString ) {
logString += item . toString ( ) ;
} else {
logString += item ;
}
}
return $ ( '.js-chatLogDisplay' ) . prepend ( '<div>' + logString + '</div>' ) ;
} ;
return Log ;
} ) ( ) ;
Timeout = ( function ( superClass ) {
extend ( Timeout , superClass ) ;
Timeout . prototype . timeoutStartedAt = null ;
Timeout . prototype . logPrefix = 'timeout' ;
Timeout . prototype . defaults = {
debug : false ,
timeout : 4 ,
timeoutIntervallCheck : 0.5
} ;
function Timeout ( options ) {
this . stop = bind ( this . stop , this ) ;
this . start = bind ( this . start , this ) ;
Timeout . _ _super _ _ . constructor . call ( this , options ) ;
}
Timeout . prototype . start = function ( ) {
var check , timeoutStartedAt ;
this . stop ( ) ;
timeoutStartedAt = new Date ;
check = ( function ( _this ) {
return function ( ) {
var timeLeft ;
timeLeft = new Date - new Date ( timeoutStartedAt . getTime ( ) + _this . options . timeout * 1000 * 60 ) ;
_this . log . debug ( "Timeout check for " + _this . options . timeout + " minutes (left " + ( timeLeft / 1000 ) + " sec.)" ) ;
if ( timeLeft < 0 ) {
return ;
}
_this . stop ( ) ;
return _this . options . callback ( ) ;
} ;
} ) ( this ) ;
this . log . debug ( "Start timeout in " + this . options . timeout + " minutes" ) ;
return this . intervallId = setInterval ( check , this . options . timeoutIntervallCheck * 1000 * 60 ) ;
} ;
Timeout . prototype . stop = function ( ) {
if ( ! this . intervallId ) {
return ;
}
2015-12-08 11:32:19 +00:00
this . log . debug ( "Stop timeout of " + this . options . timeout + " minutes" ) ;
2015-12-05 19:41:14 +00:00
return clearInterval ( this . intervallId ) ;
} ;
return Timeout ;
} ) ( Base ) ;
Io = ( function ( superClass ) {
extend ( Io , superClass ) ;
Io . prototype . logPrefix = 'io' ;
function Io ( options ) {
2015-12-09 14:11:29 +00:00
this . ping = bind ( this . ping , this ) ;
2015-12-05 19:41:14 +00:00
this . send = bind ( this . send , this ) ;
this . reconnect = bind ( this . reconnect , this ) ;
this . close = bind ( this . close , this ) ;
this . connect = bind ( this . connect , this ) ;
this . set = bind ( this . set , this ) ;
Io . _ _super _ _ . constructor . call ( this , options ) ;
}
Io . prototype . set = function ( params ) {
var key , results , value ;
results = [ ] ;
for ( key in params ) {
value = params [ key ] ;
results . push ( this . options [ key ] = value ) ;
}
return results ;
} ;
Io . prototype . connect = function ( ) {
this . log . debug ( "Connecting to " + this . options . host ) ;
this . ws = new window . WebSocket ( "" + this . options . host ) ;
this . ws . onopen = ( function ( _this ) {
return function ( e ) {
2015-12-08 11:32:19 +00:00
_this . log . debug ( 'onOpen' , e ) ;
2015-12-09 14:11:29 +00:00
_this . options . onOpen ( e ) ;
return _this . ping ( ) ;
2015-12-05 19:41:14 +00:00
} ;
} ) ( this ) ;
this . ws . onmessage = ( function ( _this ) {
return function ( e ) {
2017-07-18 13:43:04 +00:00
var j , len , pipe , pipes ;
2015-12-05 19:41:14 +00:00
pipes = JSON . parse ( e . data ) ;
2015-12-08 11:32:19 +00:00
_this . log . debug ( 'onMessage' , e . data ) ;
2017-07-18 13:43:04 +00:00
for ( j = 0 , len = pipes . length ; j < len ; j ++ ) {
pipe = pipes [ j ] ;
2015-12-09 14:11:29 +00:00
if ( pipe . event === 'pong' ) {
_this . ping ( ) ;
}
}
2015-12-05 19:41:14 +00:00
if ( _this . options . onMessage ) {
return _this . options . onMessage ( pipes ) ;
}
} ;
} ) ( this ) ;
this . ws . onclose = ( function ( _this ) {
return function ( e ) {
2015-12-08 11:32:19 +00:00
_this . log . debug ( 'close websocket connection' , e ) ;
2015-12-09 14:11:29 +00:00
if ( _this . pingDelayId ) {
clearTimeout ( _this . pingDelayId ) ;
}
2015-12-08 11:32:19 +00:00
if ( _this . manualClose ) {
_this . log . debug ( 'manual close, onClose callback' ) ;
_this . manualClose = false ;
if ( _this . options . onClose ) {
return _this . options . onClose ( e ) ;
}
} else {
_this . log . debug ( 'error close, onError callback' ) ;
if ( _this . options . onError ) {
return _this . options . onError ( 'Connection lost...' ) ;
}
2015-12-05 19:41:14 +00:00
}
} ;
} ) ( this ) ;
return this . ws . onerror = ( function ( _this ) {
return function ( e ) {
2015-12-08 11:32:19 +00:00
_this . log . debug ( 'onError' , e ) ;
2015-12-05 19:41:14 +00:00
if ( _this . options . onError ) {
return _this . options . onError ( e ) ;
}
} ;
} ) ( this ) ;
} ;
Io . prototype . close = function ( ) {
2015-12-08 11:32:19 +00:00
this . log . debug ( 'close websocket manually' ) ;
this . manualClose = true ;
2015-12-05 19:41:14 +00:00
return this . ws . close ( ) ;
} ;
Io . prototype . reconnect = function ( ) {
2015-12-08 11:32:19 +00:00
this . log . debug ( 'reconnect' ) ;
this . close ( ) ;
2015-12-05 19:41:14 +00:00
return this . connect ( ) ;
} ;
Io . prototype . send = function ( event , data ) {
var msg ;
if ( data == null ) {
data = { } ;
}
this . log . debug ( 'send' , event , data ) ;
msg = JSON . stringify ( {
event : event ,
data : data
} ) ;
return this . ws . send ( msg ) ;
} ;
2015-12-09 14:11:29 +00:00
Io . prototype . ping = function ( ) {
var localPing ;
localPing = ( function ( _this ) {
return function ( ) {
return _this . send ( 'ping' ) ;
} ;
} ) ( this ) ;
return this . pingDelayId = setTimeout ( localPing , 29000 ) ;
} ;
2015-12-05 19:41:14 +00:00
return Io ;
} ) ( Base ) ;
ZammadChat = ( function ( superClass ) {
extend ( ZammadChat , superClass ) ;
2015-10-15 09:26:56 +00:00
ZammadChat . prototype . defaults = {
2015-11-25 11:44:26 +00:00
chatId : void 0 ,
2015-11-13 14:58:44 +00:00
show : true ,
2015-11-13 09:45:40 +00:00
target : $ ( 'body' ) ,
2015-11-13 12:59:15 +00:00
host : '' ,
2015-11-13 14:58:44 +00:00
debug : false ,
2015-11-24 14:20:38 +00:00
flat : false ,
2015-11-25 16:36:06 +00:00
lang : void 0 ,
cssAutoload : true ,
cssUrl : void 0 ,
2015-11-16 10:46:42 +00:00
fontSize : void 0 ,
2015-11-24 14:20:38 +00:00
buttonClass : 'open-zammad-chat' ,
inactiveClass : 'is-inactive' ,
2015-11-25 23:40:52 +00:00
title : '<strong>Chat</strong> with us!' ,
2017-07-28 12:04:12 +00:00
scrollHint : 'Scroll down to see new messages' ,
2015-12-08 11:32:19 +00:00
idleTimeout : 6 ,
2015-12-05 19:41:14 +00:00
idleTimeoutIntervallCheck : 0.5 ,
inactiveTimeout : 8 ,
inactiveTimeoutIntervallCheck : 0.5 ,
waitingListTimeout : 4 ,
waitingListTimeoutIntervallCheck : 0.5
2015-10-15 09:26:56 +00:00
} ;
2015-12-05 19:41:14 +00:00
ZammadChat . prototype . logPrefix = 'chat' ;
2015-11-02 15:48:16 +00:00
ZammadChat . prototype . _messageCount = 0 ;
2015-12-08 11:32:19 +00:00
ZammadChat . prototype . isOpen = false ;
2015-10-15 09:26:56 +00:00
ZammadChat . prototype . blinkOnlineInterval = null ;
ZammadChat . prototype . stopBlinOnlineStateTimeout = null ;
2016-01-05 12:46:43 +00:00
ZammadChat . prototype . showTimeEveryXMinutes = 2 ;
2015-10-15 09:26:56 +00:00
ZammadChat . prototype . lastTimestamp = null ;
ZammadChat . prototype . lastAddedType = null ;
ZammadChat . prototype . inputTimeout = null ;
ZammadChat . prototype . isTyping = false ;
2015-11-13 14:58:44 +00:00
ZammadChat . prototype . state = 'offline' ;
2015-10-15 09:26:56 +00:00
2015-11-12 14:05:43 +00:00
ZammadChat . prototype . initialQueueDelay = 10000 ;
2015-11-25 16:36:06 +00:00
ZammadChat . prototype . translations = {
2017-01-09 13:02:10 +00:00
'de' : {
2016-01-20 18:09:53 +00:00
'<strong>Chat</strong> with us!' : '<strong>Chatte</strong> mit uns!' ,
2016-07-05 11:00:49 +00:00
'Scroll down to see new messages' : 'Scrolle nach unten um neue Nachrichten zu sehen' ,
2015-11-25 16:36:06 +00:00
'Online' : 'Online' ,
'Offline' : 'Offline' ,
'Connecting' : 'Verbinden' ,
'Connection re-established' : 'Verbindung wiederhergestellt' ,
'Today' : 'Heute' ,
'Send' : 'Senden' ,
2017-11-23 21:13:02 +00:00
'Chat closed by %s' : 'Chat beendet von %s' ,
2015-11-25 16:36:06 +00:00
'Compose your message...' : 'Ihre Nachricht...' ,
2016-01-05 12:46:43 +00:00
'All colleagues are busy.' : 'Alle Kollegen sind belegt.' ,
2015-11-25 16:36:06 +00:00
'You are on waiting list position <strong>%s</strong>.' : 'Sie sind in der Warteliste an der Position <strong>%s</strong>.' ,
'Start new conversation' : 'Neue Konversation starten' ,
2015-11-25 23:40:52 +00:00
'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> got closed.' : 'Da Sie in den letzten %s Minuten nichts geschrieben haben wurde Ihre Konversation mit <strong>%s</strong> geschlossen.' ,
2017-01-05 09:20:29 +00:00
'Since you didn\'t respond in the last %s minutes your conversation got closed.' : 'Da Sie in den letzten %s Minuten nichts geschrieben haben wurde Ihre Konversation geschlossen.' ,
'We are sorry, it takes longer as expected to get an empty slot. Please try again later or send us an email. Thank you!' : 'Es tut uns leid, es dauert länger als erwartet, um einen freien Platz zu erhalten. Bitte versuchen Sie es zu einem späteren Zeitpunkt noch einmal oder schicken Sie uns eine E-Mail. Vielen Dank!'
} ,
2017-07-27 14:22:50 +00:00
'es' : {
'<strong>Chat</strong> with us!' : '<strong>Chatee</strong> con nosotros!' ,
'Scroll down to see new messages' : 'Haga scroll hacia abajo para ver nuevos mensajes' ,
'Online' : 'En linea' ,
'Offline' : 'Desconectado' ,
'Connecting' : 'Conectando' ,
'Connection re-established' : 'Conexión restablecida' ,
'Today' : 'Hoy' ,
'Send' : 'Enviar' ,
2017-11-23 21:13:02 +00:00
'Chat closed by %s' : 'Chat cerrado por %s' ,
2017-07-27 14:22:50 +00:00
'Compose your message...' : 'Escriba su mensaje...' ,
'All colleagues are busy.' : 'Todos los agentes están ocupados.' ,
'You are on waiting list position <strong>%s</strong>.' : 'Usted está en la posición <strong>%s</strong> de la lista de espera.' ,
'Start new conversation' : 'Iniciar nueva conversación' ,
'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> got closed.' : 'Puesto que usted no respondió en los últimos %s minutos su conversación con <strong>%s</strong> se ha cerrado.' ,
'Since you didn\'t respond in the last %s minutes your conversation got closed.' : 'Puesto que usted no respondió en los últimos %s minutos su conversación se ha cerrado.' ,
'We are sorry, it takes longer as expected to get an empty slot. Please try again later or send us an email. Thank you!' : 'Lo sentimos, se tarda más tiempo de lo esperado para ser atendido por un agente. Inténtelo de nuevo más tarde o envíenos un correo electrónico. ¡Gracias!'
} ,
2017-01-09 13:02:10 +00:00
'fr' : {
2017-01-05 09:20:29 +00:00
'<strong>Chat</strong> with us!' : '<strong>Chattez</strong> avec nous!' ,
'Scroll down to see new messages' : 'Faites défiler pour lire les nouveaux messages' ,
'Online' : 'En-ligne' ,
'Offline' : 'Hors-ligne' ,
'Connecting' : 'Connexion en cours' ,
'Connection re-established' : 'Connexion rétablie' ,
'Today' : 'Aujourdhui' ,
'Send' : 'Envoyer' ,
2017-11-23 21:13:02 +00:00
'Chat closed by %s' : 'Chat fermé par %s' ,
2017-01-05 09:20:29 +00:00
'Compose your message...' : 'Composez votre message...' ,
'All colleagues are busy.' : 'Tous les collègues sont actuellement occupés.' ,
'You are on waiting list position <strong>%s</strong>.' : 'Vous êtes actuellement en <strong>%s</strong> position dans la file d\'attente.' ,
'Start new conversation' : 'Démarrer une nouvelle conversation' ,
'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> got closed.' : 'Si vous ne répondez pas dans les <strong>%s</strong> minutes, votre conversation avec %s va être fermée.' ,
'Since you didn\'t respond in the last %s minutes your conversation got closed.' : 'Si vous ne répondez pas dans les %s minutes, votre conversation va être fermée.' ,
2017-01-05 15:42:11 +00:00
'We are sorry, it takes longer as expected to get an empty slot. Please try again later or send us an email. Thank you!' : 'Nous sommes désolés, il faut plus de temps que prévu pour obtenir un emplacement vide. Veuillez réessayer ultérieurement ou nous envoyer un courriel. Je vous remercie!'
2017-01-09 13:02:10 +00:00
} ,
2017-11-07 13:42:51 +00:00
'nl' : {
'<strong>Chat</strong> with us!' : '<strong>Chat</strong> met ons!' ,
'Scroll down to see new messages' : 'Scrol naar beneden om nieuwe berichten te zien' ,
'Online' : 'Online' ,
'Offline' : 'Offline' ,
'Connecting' : 'Verbinden' ,
'Connection re-established' : 'Verbinding herstelt' ,
'Today' : 'Vandaag' ,
'Send' : 'Verzenden' ,
2017-11-23 21:13:02 +00:00
'Chat closed by %s' : 'Chat gesloten door %s' ,
2017-11-07 13:42:51 +00:00
'Compose your message...' : 'Typ uw bericht...' ,
'All colleagues are busy.' : 'Alle medewerkers zijn bezet.' ,
'You are on waiting list position <strong>%s</strong>.' : 'U bent <strong>%s</strong> in de wachtrij.' ,
'Start new conversation' : 'Nieuwe conversatie starten' ,
'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> got closed.' : 'Omdat u in de laatste %s minuten niets geschreven heeft wordt de conversatie met <strong>%s</strong> gesloten.' ,
'Since you didn\'t respond in the last %s minutes your conversation got closed.' : 'Omdat u in de laatste %s minuten niets geschreven heeft is de conversatie gesloten.' ,
'We are sorry, it takes longer as expected to get an empty slot. Please try again later or send us an email. Thank you!' : 'Het spijt ons, het duurt langer dan verwacht om te antwoorden. Alstublieft probeer het later nogmaals of stuur ons een email. Hartelijk dank!'
} ,
2017-11-23 21:13:02 +00:00
'it' : {
'<strong>Chat</strong> with us!' : '<strong>Chatta</strong> con noi!' ,
'Scroll down to see new messages' : 'Scorrere verso il basso per vedere i nuovi messaggi' ,
'Online' : 'Online' ,
'Offline' : 'Offline' ,
'Connecting' : 'Collegamento' ,
'Connection re-established' : 'Collegamento ristabilito' ,
'Today' : 'Oggi' ,
'Send' : 'Invio' ,
'Chat closed by %s' : 'Conversazione chiusa da %s' ,
'Compose your message...' : 'Comporre il tuo messaggio...' ,
'All colleagues are busy.' : 'Tutti i colleghi sono occupati.' ,
'You are on waiting list position <strong>%s</strong>.' : 'Siete in posizione lista d\' attesa <strong>%s</strong>.' ,
'Start new conversation' : 'Avviare una nuova conversazione' ,
'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> got closed.' : 'Dal momento che non hai risposto negli ultimi %s minuti la tua conversazione con <strong>%s</strong> si è chiusa.' ,
'Since you didn\'t respond in the last %s minutes your conversation got closed.' : 'Dal momento che non hai risposto negli ultimi %s minuti la tua conversazione si è chiusa.' ,
'We are sorry, it takes longer as expected to get an empty slot. Please try again later or send us an email. Thank you!' : 'Ci dispiace, ci vuole più tempo come previsto per ottenere uno slot vuoto. Per favore riprova più tardi o inviaci un\' e-mail. Grazie!'
} ,
'pl' : {
'<strong>Chat</strong> with us!' : '<strong>Czatuj</strong> z nami!' ,
'Scroll down to see new messages' : 'Przewiń w dół, aby wyświetlić nowe wiadomości' ,
'Online' : 'Online' ,
'Offline' : 'Offline' ,
'Connecting' : 'Łączenie' ,
'Connection re-established' : 'Ponowne nawiązanie połączenia' ,
'Today' : 'dzisiejszy' ,
'Send' : 'Wyślij' ,
'Chat closed by %s' : 'Czat zamknięty przez %s' ,
'Compose your message...' : 'Utwórz swoją wiadomość...' ,
'All colleagues are busy.' : 'Wszyscy koledzy są zajęci.' ,
'You are on waiting list position <strong>%s</strong>.' : 'Na liście oczekujących znajduje się pozycja <strong>%s</strong>.' ,
'Start new conversation' : 'Rozpoczęcie nowej konwersacji' ,
'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> got closed.' : 'Ponieważ w ciągu ostatnich %s minut nie odpowiedziałeś, Twoja rozmowa z <strong>%s</strong> została zamknięta.' ,
'Since you didn\'t respond in the last %s minutes your conversation got closed.' : 'Ponieważ nie odpowiedziałeś w ciągu ostatnich %s minut, Twoja rozmowa została zamknięta.' ,
'We are sorry, it takes longer as expected to get an empty slot. Please try again later or send us an email. Thank you!' : 'Przykro nam, ale to trwa dłużej niż się spodziewamy. Spróbuj ponownie później lub wyślij nam wiadomość e-mail. Dziękuję!'
} ,
2017-01-09 13:02:10 +00:00
'zh-cn' : {
'<strong>Chat</strong> with us!' : '发起<strong>即时对话</strong>!' ,
'Scroll down to see new messages' : '向下滚动以查看新消息' ,
'Online' : '在线' ,
'Offline' : '离线' ,
'Connecting' : '连接中' ,
'Connection re-established' : '正在重新建立连接' ,
'Today' : '今天' ,
'Send' : '发送' ,
2017-11-23 21:13:02 +00:00
'Chat closed by %s' : 'Chat closed by %s' ,
2017-01-09 13:02:10 +00:00
'Compose your message...' : '正在输入信息...' ,
'All colleagues are busy.' : '所有工作人员都在忙碌中.' ,
'You are on waiting list position <strong>%s</strong>.' : '您目前的等候位置是第 <strong>%s</strong> 位.' ,
'Start new conversation' : '开始新的会话' ,
'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> got closed.' : '由于您超过 %s 分钟没有回复, 您与 <strong>%s</strong> 的会话已被关闭.' ,
'Since you didn\'t respond in the last %s minutes your conversation got closed.' : '由于您超过 %s 分钟没有任何回复, 该对话已被关闭.' ,
'We are sorry, it takes longer as expected to get an empty slot. Please try again later or send us an email. Thank you!' : '非常抱歉, 目前需要等候更长的时间才能接入对话, 请稍后重试或向我们发送电子邮件. 谢谢!'
} ,
'zh-tw' : {
'<strong>Chat</strong> with us!' : '開始<strong>即時對话</strong>!' ,
'Scroll down to see new messages' : '向下滑動以查看新訊息' ,
'Online' : '線上' ,
'Offline' : '离线' ,
'Connecting' : '連線中' ,
'Connection re-established' : '正在重新建立連線中' ,
'Today' : '今天' ,
'Send' : '發送' ,
2017-11-23 21:13:02 +00:00
'Chat closed by %s' : 'Chat closed by %s' ,
2017-01-09 13:02:10 +00:00
'Compose your message...' : '正在輸入訊息...' ,
'All colleagues are busy.' : '所有服務人員都在忙碌中.' ,
'You are on waiting list position <strong>%s</strong>.' : '你目前的等候位置是第 <strong>%s</strong> 順位.' ,
'Start new conversation' : '開始新的對話' ,
'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> got closed.' : '由於你超過 %s 分鐘沒有回應, 你與 <strong>%s</strong> 的對話已被關閉.' ,
'Since you didn\'t respond in the last %s minutes your conversation got closed.' : '由於你超過 %s 分鐘沒有任何回應, 該對話已被關閉.' ,
'We are sorry, it takes longer as expected to get an empty slot. Please try again later or send us an email. Thank you!' : '非常抱歉, 當前需要等候更長的時間方可排入對話程序, 請稍後重試或向我們寄送電子郵件. 謝謝!'
2015-11-25 16:36:06 +00:00
}
2015-11-11 20:44:54 +00:00
} ;
2015-11-12 10:44:37 +00:00
ZammadChat . prototype . sessionId = void 0 ;
2016-07-05 11:00:49 +00:00
ZammadChat . prototype . scrolledToBottom = true ;
ZammadChat . prototype . scrollSnapTolerance = 10 ;
2017-07-18 13:43:04 +00:00
ZammadChat . prototype . richTextFormatKey = {
66 : true ,
73 : true ,
85 : true ,
83 : true
} ;
2015-11-11 20:44:54 +00:00
ZammadChat . prototype . T = function ( ) {
2017-07-18 13:43:04 +00:00
var item , items , j , len , string , translations ;
2015-11-11 20:44:54 +00:00
string = arguments [ 0 ] , items = 2 <= arguments . length ? slice . call ( arguments , 1 ) : [ ] ;
2015-11-25 16:36:06 +00:00
if ( this . options . lang && this . options . lang !== 'en' ) {
if ( ! this . translations [ this . options . lang ] ) {
2015-12-05 19:41:14 +00:00
this . log . notice ( "Translation '" + this . options . lang + "' needed!" ) ;
2015-11-25 16:36:06 +00:00
} else {
translations = this . translations [ this . options . lang ] ;
if ( ! translations [ string ] ) {
2015-12-05 19:41:14 +00:00
this . log . notice ( "Translation needed for '" + string + "'" ) ;
2015-11-25 16:36:06 +00:00
}
string = translations [ string ] || string ;
}
2015-11-11 20:44:54 +00:00
}
if ( items ) {
2017-07-18 13:43:04 +00:00
for ( j = 0 , len = items . length ; j < len ; j ++ ) {
item = items [ j ] ;
2015-11-25 16:36:06 +00:00
string = string . replace ( /%s/ , item ) ;
2015-11-11 20:44:54 +00:00
}
}
2015-11-25 16:36:06 +00:00
return string ;
2015-10-15 09:26:56 +00:00
} ;
ZammadChat . prototype . view = function ( name ) {
2015-11-02 15:48:16 +00:00
return ( function ( _this ) {
return function ( options ) {
if ( ! options ) {
options = { } ;
}
options . T = _this . T ;
2015-11-13 14:58:44 +00:00
options . background = _this . options . background ;
options . flat = _this . options . flat ;
2015-11-16 10:46:42 +00:00
options . fontSize = _this . options . fontSize ;
2015-11-02 15:48:16 +00:00
return window . zammadChatTemplates [ name ] ( options ) ;
} ;
} ) ( this ) ;
2015-10-15 09:26:56 +00:00
} ;
2015-11-13 12:59:15 +00:00
function ZammadChat ( options ) {
2017-07-18 13:43:04 +00:00
this . removeAttributes = bind ( this . removeAttributes , this ) ;
2015-12-05 19:41:14 +00:00
this . startTimeoutObservers = bind ( this . startTimeoutObservers , this ) ;
2016-03-03 14:12:53 +00:00
this . onCssLoaded = bind ( this . onCssLoaded , this ) ;
2015-10-15 09:26:56 +00:00
this . setAgentOnlineState = bind ( this . setAgentOnlineState , this ) ;
this . onConnectionEstablished = bind ( this . onConnectionEstablished , this ) ;
2015-11-12 14:05:43 +00:00
this . setSessionId = bind ( this . setSessionId , this ) ;
2015-10-15 09:26:56 +00:00
this . onConnectionReestablished = bind ( this . onConnectionReestablished , this ) ;
this . reconnect = bind ( this . reconnect , this ) ;
2015-12-05 19:41:14 +00:00
this . destroy = bind ( this . destroy , this ) ;
2016-07-05 11:00:49 +00:00
this . onScrollHintClick = bind ( this . onScrollHintClick , this ) ;
this . detectScrolledtoBottom = bind ( this . detectScrolledtoBottom , this ) ;
2015-12-05 19:41:14 +00:00
this . onLeaveTemporary = bind ( this . onLeaveTemporary , this ) ;
2015-10-15 09:26:56 +00:00
this . onAgentTypingEnd = bind ( this . onAgentTypingEnd , this ) ;
this . onAgentTypingStart = bind ( this . onAgentTypingStart , this ) ;
2015-11-02 15:48:16 +00:00
this . onQueue = bind ( this . onQueue , this ) ;
2015-11-12 14:05:43 +00:00
this . onQueueScreen = bind ( this . onQueueScreen , this ) ;
2015-12-08 11:32:19 +00:00
this . onWebSocketClose = bind ( this . onWebSocketClose , this ) ;
2015-10-15 09:26:56 +00:00
this . onCloseAnimationEnd = bind ( this . onCloseAnimationEnd , this ) ;
2015-11-11 10:44:10 +00:00
this . close = bind ( this . close , this ) ;
2016-02-08 15:06:56 +00:00
this . toggle = bind ( this . toggle , this ) ;
2015-12-08 11:32:19 +00:00
this . sessionClose = bind ( this . sessionClose , this ) ;
2015-11-25 23:40:52 +00:00
this . onOpenAnimationEnd = bind ( this . onOpenAnimationEnd , this ) ;
2015-11-11 10:44:10 +00:00
this . open = bind ( this . open , this ) ;
2015-11-12 14:05:43 +00:00
this . renderMessage = bind ( this . renderMessage , this ) ;
2015-10-15 09:26:56 +00:00
this . receiveMessage = bind ( this . receiveMessage , this ) ;
this . onSubmit = bind ( this . onSubmit , this ) ;
2016-02-08 15:06:56 +00:00
this . onFocus = bind ( this . onFocus , this ) ;
2015-10-15 09:26:56 +00:00
this . onInput = bind ( this . onInput , this ) ;
2015-12-08 11:32:19 +00:00
this . onReopenSession = bind ( this . onReopenSession , this ) ;
2015-11-13 14:58:44 +00:00
this . onError = bind ( this . onError , this ) ;
2015-11-02 15:48:16 +00:00
this . onWebSocketMessage = bind ( this . onWebSocketMessage , this ) ;
this . send = bind ( this . send , this ) ;
2015-10-15 09:26:56 +00:00
this . checkForEnter = bind ( this . checkForEnter , this ) ;
2015-12-05 19:41:14 +00:00
this . render = bind ( this . render , this ) ;
2015-11-02 15:48:16 +00:00
this . view = bind ( this . view , this ) ;
this . T = bind ( this . T , this ) ;
2015-11-25 11:55:02 +00:00
this . options = $ . extend ( { } , this . defaults , options ) ;
2015-12-05 19:41:14 +00:00
ZammadChat . _ _super _ _ . constructor . call ( this , this . options ) ;
2016-02-08 15:06:56 +00:00
this . isFullscreen = window . matchMedia && window . matchMedia ( '(max-width: 768px)' ) . matches ;
this . scrollRoot = $ ( this . getScrollRoot ( ) ) ;
2015-11-25 23:40:52 +00:00
if ( ! $ ) {
this . state = 'unsupported' ;
2015-12-05 19:41:14 +00:00
this . log . notice ( 'Chat: no jquery found!' ) ;
2015-11-25 23:40:52 +00:00
return ;
}
2015-11-13 14:58:44 +00:00
if ( ! window . WebSocket || ! sessionStorage ) {
2015-11-16 12:08:32 +00:00
this . state = 'unsupported' ;
2015-12-05 19:41:14 +00:00
this . log . notice ( 'Chat: Browser not supported!' ) ;
2015-11-13 14:58:44 +00:00
return ;
}
2015-11-25 11:55:02 +00:00
if ( ! this . options . chatId ) {
2015-11-25 10:06:26 +00:00
this . state = 'unsupported' ;
2015-12-05 19:41:14 +00:00
this . log . error ( 'Chat: need chatId as option!' ) ;
2015-11-25 10:06:26 +00:00
return ;
}
2015-11-25 16:36:06 +00:00
if ( ! this . options . lang ) {
this . options . lang = $ ( 'html' ) . attr ( 'lang' ) ;
}
if ( this . options . lang ) {
2017-01-09 13:02:10 +00:00
if ( ! this . translations [ this . options . lang ] ) {
this . log . debug ( "lang: No " + this . options . lang + " found, try first two letters" ) ;
this . options . lang = this . options . lang . replace ( /-.+?$/ , '' ) ;
}
2015-12-05 19:41:14 +00:00
this . log . debug ( "lang: " + this . options . lang ) ;
2015-11-25 16:36:06 +00:00
}
2015-12-07 10:41:12 +00:00
if ( ! this . options . host ) {
this . detectHost ( ) ;
}
2015-12-05 19:41:14 +00:00
this . loadCss ( ) ;
this . io = new Io ( this . options ) ;
this . io . set ( {
onOpen : this . render ,
2015-12-08 11:32:19 +00:00
onClose : this . onWebSocketClose ,
onMessage : this . onWebSocketMessage ,
onError : this . onError
2015-12-05 19:41:14 +00:00
} ) ;
this . io . connect ( ) ;
}
2016-02-08 15:06:56 +00:00
ZammadChat . prototype . getScrollRoot = function ( ) {
var end , html , start ;
2016-02-08 20:49:00 +00:00
if ( 'scrollingElement' in document ) {
2016-02-08 15:06:56 +00:00
return document . scrollingElement ;
}
html = document . documentElement ;
start = html . scrollTop ;
html . scrollTop = start + 1 ;
end = html . scrollTop ;
html . scrollTop = start ;
if ( end > start ) {
return html ;
} else {
return document . body ;
}
} ;
2015-12-05 19:41:14 +00:00
ZammadChat . prototype . render = function ( ) {
2015-12-08 11:32:19 +00:00
if ( ! this . el || ! $ ( '.zammad-chat' ) . get ( 0 ) ) {
2016-02-08 15:06:56 +00:00
this . renderBase ( ) ;
2015-12-08 11:32:19 +00:00
}
2015-11-24 14:20:38 +00:00
$ ( "." + this . options . buttonClass ) . addClass ( this . inactiveClass ) ;
2015-12-05 19:41:14 +00:00
this . setAgentOnlineState ( 'online' ) ;
this . log . debug ( 'widget rendered' ) ;
this . startTimeoutObservers ( ) ;
this . idleTimeout . start ( ) ;
this . sessionId = sessionStorage . getItem ( 'sessionId' ) ;
return this . send ( 'chat_status_customer' , {
2016-03-25 07:45:21 +00:00
session _id : this . sessionId ,
url : window . location . href
2015-12-05 19:41:14 +00:00
} ) ;
} ;
2015-10-15 09:26:56 +00:00
2016-02-08 15:06:56 +00:00
ZammadChat . prototype . renderBase = function ( ) {
this . el = $ ( this . view ( 'chat' ) ( {
2016-07-05 11:00:49 +00:00
title : this . options . title ,
scrollHint : this . options . scrollHint
2016-02-08 15:06:56 +00:00
} ) ) ;
this . options . target . append ( this . el ) ;
this . input = this . el . find ( '.zammad-chat-input' ) ;
this . el . find ( '.js-chat-open' ) . click ( this . open ) ;
this . el . find ( '.js-chat-toggle' ) . click ( this . toggle ) ;
this . el . find ( '.zammad-chat-controls' ) . on ( 'submit' , this . onSubmit ) ;
2016-07-05 11:00:49 +00:00
this . el . find ( '.zammad-chat-body' ) . on ( 'scroll' , this . detectScrolledtoBottom ) ;
this . el . find ( '.zammad-scroll-hint' ) . click ( this . onScrollHintClick ) ;
2016-02-08 15:06:56 +00:00
this . input . on ( {
keydown : this . checkForEnter ,
input : this . onInput
} ) ;
2017-07-18 13:43:04 +00:00
this . input . on ( 'keydown' , ( function ( _this ) {
return function ( e ) {
var richtTextControl ;
richtTextControl = false ;
if ( ! e . altKey && ! e . ctrlKey && e . metaKey ) {
richtTextControl = true ;
} else if ( ! e . altKey && e . ctrlKey && ! e . metaKey ) {
richtTextControl = true ;
}
if ( richtTextControl && _this . richTextFormatKey [ e . keyCode ] ) {
e . preventDefault ( ) ;
if ( e . keyCode === 66 ) {
document . execCommand ( 'bold' ) ;
return true ;
}
if ( e . keyCode === 73 ) {
document . execCommand ( 'italic' ) ;
return true ;
}
if ( e . keyCode === 85 ) {
document . execCommand ( 'underline' ) ;
return true ;
}
if ( e . keyCode === 83 ) {
document . execCommand ( 'strikeThrough' ) ;
return true ;
}
}
} ;
} ) ( this ) ) ;
this . input . on ( 'paste' , ( function ( _this ) {
return function ( e ) {
2017-11-23 21:13:02 +00:00
var clipboardData , docType , html , htmlTmp , imageFile , imageInserted , item , match , reader , regex , replacementTag , text ;
2017-07-18 13:43:04 +00:00
e . stopPropagation ( ) ;
e . preventDefault ( ) ;
clipboardData ;
if ( e . clipboardData ) {
clipboardData = e . clipboardData ;
} else if ( window . clipboardData ) {
clipboardData = window . clipboardData ;
} else if ( e . originalEvent . clipboardData ) {
clipboardData = e . originalEvent . clipboardData ;
} else {
throw 'No clipboardData support' ;
}
imageInserted = false ;
if ( clipboardData && clipboardData . items && clipboardData . items [ 0 ] ) {
item = clipboardData . items [ 0 ] ;
if ( item . kind === 'file' && ( item . type === 'image/png' || item . type === 'image/jpeg' ) ) {
imageFile = item . getAsFile ( ) ;
reader = new FileReader ( ) ;
reader . onload = function ( e ) {
var img , insert , result ;
result = e . target . result ;
img = document . createElement ( 'img' ) ;
img . src = result ;
insert = function ( dataUrl , width , height , isRetina ) {
if ( _this . isRetina ( ) ) {
width = width / 2 ;
height = height / 2 ;
}
result = dataUrl ;
img = "<img style=\"width: 100%; max-width: " + width + "px;\" src=\"" + result + "\">" ;
return document . execCommand ( 'insertHTML' , false , img ) ;
} ;
return _this . resizeImage ( img . src , 460 , 'auto' , 2 , 'image/jpeg' , 'auto' , insert ) ;
} ;
reader . readAsDataURL ( imageFile ) ;
imageInserted = true ;
}
}
if ( imageInserted ) {
return ;
}
text = void 0 ;
docType = void 0 ;
try {
text = clipboardData . getData ( 'text/html' ) ;
docType = 'html' ;
if ( ! text || text . length === 0 ) {
docType = 'text' ;
text = clipboardData . getData ( 'text/plain' ) ;
}
if ( ! text || text . length === 0 ) {
docType = 'text2' ;
text = clipboardData . getData ( 'text' ) ;
}
} catch ( error ) {
e = error ;
console . log ( 'Sorry, can\'t insert markup because browser is not supporting it.' ) ;
docType = 'text3' ;
text = clipboardData . getData ( 'text' ) ;
}
if ( docType === 'text' || docType === 'text2' || docType === 'text3' ) {
text = '<div>' + text . replace ( /\n/g , '</div><div>' ) + '</div>' ;
text = text . replace ( /<div><\/div>/g , '<div><br></div>' ) ;
}
console . log ( 'p' , docType , text ) ;
if ( docType === 'html' ) {
html = $ ( "<div>" + text + "</div>" ) ;
match = false ;
htmlTmp = text ;
regex = new RegExp ( '<(/w|w)\:[A-Za-z]' ) ;
if ( htmlTmp . match ( regex ) ) {
match = true ;
htmlTmp = htmlTmp . replace ( regex , '' ) ;
}
regex = new RegExp ( '<(/o|o)\:[A-Za-z]' ) ;
if ( htmlTmp . match ( regex ) ) {
match = true ;
htmlTmp = htmlTmp . replace ( regex , '' ) ;
}
if ( match ) {
html = _this . wordFilter ( html ) ;
}
html = $ ( html ) ;
html . contents ( ) . each ( function ( ) {
if ( this . nodeType === 8 ) {
return $ ( this ) . remove ( ) ;
}
} ) ;
html . find ( 'a, font, small, time, form, label' ) . replaceWith ( function ( ) {
return $ ( this ) . contents ( ) ;
} ) ;
replacementTag = 'div' ;
html . find ( 'textarea' ) . each ( function ( ) {
var newTag , outer ;
outer = this . outerHTML ;
regex = new RegExp ( '<' + this . tagName , 'i' ) ;
newTag = outer . replace ( regex , '<' + replacementTag ) ;
regex = new RegExp ( '</' + this . tagName , 'i' ) ;
newTag = newTag . replace ( regex , '</' + replacementTag ) ;
return $ ( this ) . replaceWith ( newTag ) ;
} ) ;
html . find ( 'font, img, svg, input, select, button, style, applet, embed, noframes, canvas, script, frame, iframe, meta, link, title, head, fieldset' ) . remove ( ) ;
_this . removeAttributes ( html ) ;
text = html . html ( ) ;
}
if ( docType === 'text3' ) {
_this . pasteHtmlAtCaret ( text ) ;
} else {
document . execCommand ( 'insertHTML' , false , text ) ;
}
return true ;
} ;
} ) ( this ) ) ;
this . input . on ( 'drop' , ( function ( _this ) {
return function ( e ) {
var dataTransfer , file , reader , x , y ;
e . stopPropagation ( ) ;
e . preventDefault ( ) ;
dataTransfer ;
if ( window . dataTransfer ) {
dataTransfer = window . dataTransfer ;
} else if ( e . originalEvent . dataTransfer ) {
dataTransfer = e . originalEvent . dataTransfer ;
} else {
throw 'No clipboardData support' ;
}
x = e . clientX ;
y = e . clientY ;
file = dataTransfer . files [ 0 ] ;
if ( file . type . match ( 'image.*' ) ) {
reader = new FileReader ( ) ;
reader . onload = function ( e ) {
var img , insert , result ;
result = e . target . result ;
img = document . createElement ( 'img' ) ;
img . src = result ;
insert = function ( dataUrl , width , height , isRetina ) {
var pos , range ;
if ( _this . isRetina ( ) ) {
width = width / 2 ;
height = height / 2 ;
}
result = dataUrl ;
img = $ ( "<img style=\"width: 100%; max-width: " + width + "px;\" src=\"" + result + "\">" ) ;
img = img . get ( 0 ) ;
if ( document . caretPositionFromPoint ) {
pos = document . caretPositionFromPoint ( x , y ) ;
range = document . createRange ( ) ;
range . setStart ( pos . offsetNode , pos . offset ) ;
range . collapse ( ) ;
return range . insertNode ( img ) ;
} else if ( document . caretRangeFromPoint ) {
range = document . caretRangeFromPoint ( x , y ) ;
return range . insertNode ( img ) ;
} else {
return console . log ( 'could not find carat' ) ;
}
} ;
return _this . resizeImage ( img . src , 460 , 'auto' , 2 , 'image/jpeg' , 'auto' , insert ) ;
} ;
return reader . readAsDataURL ( file ) ;
}
} ;
} ) ( this ) ) ;
2016-02-08 15:06:56 +00:00
$ ( window ) . on ( 'beforeunload' , ( function ( _this ) {
return function ( ) {
return _this . onLeaveTemporary ( ) ;
} ;
} ) ( this ) ) ;
$ ( window ) . bind ( 'hashchange' , ( function ( _this ) {
return function ( ) {
if ( _this . isOpen ) {
2016-03-25 07:45:21 +00:00
if ( _this . sessionId ) {
_this . send ( 'chat_session_notice' , {
session _id : _this . sessionId ,
message : window . location . href
} ) ;
}
2016-02-08 15:06:56 +00:00
return ;
}
return _this . idleTimeout . start ( ) ;
} ;
} ) ( this ) ) ;
if ( this . isFullscreen ) {
return this . input . on ( {
focus : this . onFocus ,
focusout : this . onFocusOut
} ) ;
}
} ;
2015-10-15 09:26:56 +00:00
ZammadChat . prototype . checkForEnter = function ( event ) {
if ( ! event . shiftKey && event . keyCode === 13 ) {
event . preventDefault ( ) ;
return this . sendMessage ( ) ;
}
} ;
2015-11-10 14:01:04 +00:00
ZammadChat . prototype . send = function ( event , data ) {
2015-11-25 10:06:26 +00:00
if ( data == null ) {
data = { } ;
}
2015-11-25 11:44:26 +00:00
data . chat _id = this . options . chatId ;
2015-12-05 19:41:14 +00:00
return this . io . send ( event , data ) ;
2015-11-02 15:48:16 +00:00
} ;
2015-12-05 19:41:14 +00:00
ZammadChat . prototype . onWebSocketMessage = function ( pipes ) {
2017-07-18 13:43:04 +00:00
var j , len , pipe ;
for ( j = 0 , len = pipes . length ; j < len ; j ++ ) {
pipe = pipes [ j ] ;
2015-12-05 19:41:14 +00:00
this . log . debug ( 'ws:onmessage' , pipe ) ;
2015-11-10 14:01:04 +00:00
switch ( pipe . event ) {
2015-11-25 10:06:26 +00:00
case 'chat_error' :
2015-12-05 19:41:14 +00:00
this . log . notice ( pipe . data ) ;
2015-11-25 23:40:52 +00:00
if ( pipe . data && pipe . data . state === 'chat_disabled' ) {
2015-12-05 19:41:14 +00:00
this . destroy ( {
2015-12-08 11:32:19 +00:00
remove : true
2015-12-05 19:41:14 +00:00
} ) ;
2015-11-25 23:40:52 +00:00
}
2015-11-25 10:06:26 +00:00
break ;
2015-11-10 14:01:04 +00:00
case 'chat_session_message' :
if ( pipe . data . self _written ) {
return ;
}
this . receiveMessage ( pipe . data ) ;
break ;
case 'chat_session_typing' :
if ( pipe . data . self _written ) {
return ;
}
this . onAgentTypingStart ( ) ;
break ;
case 'chat_session_start' :
2015-11-12 14:05:43 +00:00
this . onConnectionEstablished ( pipe . data ) ;
2015-11-10 14:01:04 +00:00
break ;
2015-11-12 10:44:37 +00:00
case 'chat_session_queue' :
2015-11-12 16:32:11 +00:00
this . onQueueScreen ( pipe . data ) ;
2015-11-10 14:01:04 +00:00
break ;
2015-11-11 20:44:54 +00:00
case 'chat_session_closed' :
this . onSessionClosed ( pipe . data ) ;
break ;
case 'chat_session_left' :
this . onSessionClosed ( pipe . data ) ;
break ;
2015-11-11 13:10:26 +00:00
case 'chat_status_customer' :
2015-11-10 14:01:04 +00:00
switch ( pipe . data . state ) {
case 'online' :
2015-11-13 09:45:40 +00:00
this . sessionId = void 0 ;
2016-03-03 14:12:53 +00:00
if ( ! this . options . cssAutoload || this . cssLoaded ) {
this . onReady ( ) ;
} else {
this . socketReady = true ;
}
2015-11-10 14:01:04 +00:00
break ;
case 'offline' :
2015-11-13 14:58:44 +00:00
this . onError ( 'Zammad Chat: No agent online' ) ;
2015-11-10 14:01:04 +00:00
break ;
case 'chat_disabled' :
2015-11-13 14:58:44 +00:00
this . onError ( 'Zammad Chat: Chat is disabled' ) ;
2015-11-10 14:01:04 +00:00
break ;
case 'no_seats_available' :
2015-11-25 10:06:26 +00:00
this . onError ( "Zammad Chat: Too many clients in queue. Clients in queue: " + pipe . data . queue ) ;
2015-11-12 09:39:14 +00:00
break ;
case 'reconnect' :
2015-12-08 11:32:19 +00:00
this . onReopenSession ( pipe . data ) ;
2015-11-10 14:01:04 +00:00
}
}
2015-11-02 15:48:16 +00:00
}
} ;
ZammadChat . prototype . onReady = function ( ) {
2015-12-05 19:41:14 +00:00
this . log . debug ( 'widget ready for use' ) ;
2015-11-24 14:20:38 +00:00
$ ( "." + this . options . buttonClass ) . click ( this . open ) . removeClass ( this . inactiveClass ) ;
2015-11-02 15:48:16 +00:00
if ( this . options . show ) {
2015-11-12 14:05:43 +00:00
return this . show ( ) ;
}
} ;
2015-11-13 14:58:44 +00:00
ZammadChat . prototype . onError = function ( message ) {
2015-12-05 19:41:14 +00:00
this . log . debug ( message ) ;
2015-12-08 11:32:19 +00:00
this . addStatus ( message ) ;
$ ( "." + this . options . buttonClass ) . hide ( ) ;
if ( this . isOpen ) {
this . disableInput ( ) ;
return this . destroy ( {
remove : false
} ) ;
} else {
return this . destroy ( {
remove : true
} ) ;
}
2015-11-13 14:58:44 +00:00
} ;
2015-12-08 11:32:19 +00:00
ZammadChat . prototype . onReopenSession = function ( data ) {
2017-07-18 13:43:04 +00:00
var j , len , message , ref , unfinishedMessage ;
2015-12-08 11:32:19 +00:00
this . log . debug ( 'old messages' , data . session ) ;
2015-12-05 19:41:14 +00:00
this . inactiveTimeout . start ( ) ;
2015-11-12 14:05:43 +00:00
unfinishedMessage = sessionStorage . getItem ( 'unfinished_message' ) ;
2015-11-13 14:58:44 +00:00
if ( data . agent ) {
this . onConnectionEstablished ( data ) ;
ref = data . session ;
2017-07-18 13:43:04 +00:00
for ( j = 0 , len = ref . length ; j < len ; j ++ ) {
message = ref [ j ] ;
2015-11-13 14:58:44 +00:00
this . renderMessage ( {
message : message . content ,
id : message . id ,
from : message . created _by _id ? 'agent' : 'customer'
} ) ;
}
if ( unfinishedMessage ) {
2017-07-14 13:49:16 +00:00
this . input . html ( unfinishedMessage ) ;
2015-11-13 14:58:44 +00:00
}
2015-11-02 15:48:16 +00:00
}
2015-11-13 14:58:44 +00:00
if ( data . position ) {
this . onQueue ( data ) ;
2015-11-12 14:05:43 +00:00
}
this . show ( ) ;
2015-11-12 15:19:47 +00:00
this . open ( ) ;
2015-11-12 16:32:11 +00:00
this . scrollToBottom ( ) ;
2015-11-12 14:05:43 +00:00
if ( unfinishedMessage ) {
return this . input . focus ( ) ;
}
2015-11-02 15:48:16 +00:00
} ;
2015-10-15 09:26:56 +00:00
ZammadChat . prototype . onInput = function ( ) {
this . el . find ( '.zammad-chat-message--unread' ) . removeClass ( 'zammad-chat-message--unread' ) ;
2017-07-14 13:49:16 +00:00
sessionStorage . setItem ( 'unfinished_message' , this . input . html ( ) ) ;
2015-11-25 15:15:59 +00:00
return this . onTyping ( ) ;
2015-10-15 09:26:56 +00:00
} ;
2016-02-08 15:06:56 +00:00
ZammadChat . prototype . onFocus = function ( ) {
var keyboardShown ;
$ ( window ) . scrollTop ( 10 ) ;
keyboardShown = $ ( window ) . scrollTop ( ) > 0 ;
$ ( window ) . scrollTop ( 0 ) ;
if ( keyboardShown ) {
2016-02-08 20:49:00 +00:00
return this . log . notice ( 'virtual keyboard shown' ) ;
2016-02-08 15:06:56 +00:00
}
} ;
ZammadChat . prototype . onFocusOut = function ( ) { } ;
2015-11-25 15:15:59 +00:00
ZammadChat . prototype . onTyping = function ( ) {
if ( this . isTyping && this . isTyping > new Date ( new Date ( ) . getTime ( ) - 1500 ) ) {
return ;
2015-11-10 14:01:04 +00:00
}
2015-11-25 15:15:59 +00:00
this . isTyping = new Date ( ) ;
2015-11-25 23:40:52 +00:00
this . send ( 'chat_session_typing' , {
2015-11-25 15:15:59 +00:00
session _id : this . sessionId
} ) ;
2015-12-05 19:41:14 +00:00
return this . inactiveTimeout . start ( ) ;
2015-10-15 09:26:56 +00:00
} ;
ZammadChat . prototype . onSubmit = function ( event ) {
event . preventDefault ( ) ;
return this . sendMessage ( ) ;
} ;
ZammadChat . prototype . sendMessage = function ( ) {
var message , messageElement ;
2017-07-14 13:49:16 +00:00
message = this . input . html ( ) ;
2015-11-02 15:48:16 +00:00
if ( ! message ) {
return ;
}
2015-12-05 19:41:14 +00:00
this . inactiveTimeout . start ( ) ;
2015-11-12 14:05:43 +00:00
sessionStorage . removeItem ( 'unfinished_message' ) ;
2015-11-02 15:48:16 +00:00
messageElement = this . view ( 'message' ) ( {
message : message ,
from : 'customer' ,
2015-11-26 09:52:10 +00:00
id : this . _messageCount ++ ,
unreadClass : ''
2015-11-02 15:48:16 +00:00
} ) ;
this . maybeAddTimestamp ( ) ;
2017-07-03 12:12:42 +00:00
if ( this . el . find ( '.zammad-chat-message--typing' ) . get ( 0 ) ) {
2015-11-02 15:48:16 +00:00
this . lastAddedType = 'typing-placeholder' ;
this . el . find ( '.zammad-chat-message--typing' ) . before ( messageElement ) ;
} else {
this . lastAddedType = 'message--customer' ;
this . el . find ( '.zammad-chat-body' ) . append ( messageElement ) ;
2015-10-15 09:26:56 +00:00
}
2017-07-14 13:49:16 +00:00
this . input . html ( '' ) ;
2015-11-02 15:48:16 +00:00
this . scrollToBottom ( ) ;
2015-11-10 14:01:04 +00:00
return this . send ( 'chat_session_message' , {
content : message ,
id : this . _messageCount ,
2015-11-12 10:44:37 +00:00
session _id : this . sessionId
2015-11-02 15:48:16 +00:00
} ) ;
2015-10-15 09:26:56 +00:00
} ;
2015-11-02 15:48:16 +00:00
ZammadChat . prototype . receiveMessage = function ( data ) {
2015-12-05 19:41:14 +00:00
this . inactiveTimeout . start ( ) ;
2015-10-15 09:26:56 +00:00
this . onAgentTypingEnd ( ) ;
this . maybeAddTimestamp ( ) ;
2016-07-05 11:00:49 +00:00
this . renderMessage ( {
2015-11-10 14:01:04 +00:00
message : data . message . content ,
2015-11-02 15:48:16 +00:00
id : data . id ,
2015-10-15 09:26:56 +00:00
from : 'agent'
2015-11-12 14:05:43 +00:00
} ) ;
2016-07-05 11:00:49 +00:00
return this . scrollToBottom ( {
showHint : true
} ) ;
2015-11-12 14:05:43 +00:00
} ;
ZammadChat . prototype . renderMessage = function ( data ) {
this . lastAddedType = "message--" + data . from ;
2015-11-26 09:52:10 +00:00
data . unreadClass = document . hidden ? ' zammad-chat-message--unread' : '' ;
2016-07-05 11:00:49 +00:00
return this . el . find ( '.zammad-chat-body' ) . append ( this . view ( 'message' ) ( data ) ) ;
2015-10-15 09:26:56 +00:00
} ;
2015-11-12 15:19:47 +00:00
ZammadChat . prototype . open = function ( ) {
2016-03-24 10:03:20 +00:00
var remainerHeight ;
2015-10-15 09:26:56 +00:00
if ( this . isOpen ) {
2015-12-08 11:32:19 +00:00
this . log . debug ( 'widget already open, block' ) ;
return ;
2015-10-15 09:26:56 +00:00
}
2015-12-08 11:32:19 +00:00
this . isOpen = true ;
this . log . debug ( 'open widget' ) ;
2015-11-12 15:19:47 +00:00
if ( ! this . sessionId ) {
2015-11-12 14:05:43 +00:00
this . showLoader ( ) ;
}
2015-11-25 13:47:02 +00:00
this . el . addClass ( 'zammad-chat-is-open' ) ;
2016-03-24 10:03:20 +00:00
remainerHeight = this . el . height ( ) - this . el . find ( '.zammad-chat-header' ) . outerHeight ( ) ;
this . el . css ( 'bottom' , - remainerHeight ) ;
2015-11-12 15:19:47 +00:00
if ( ! this . sessionId ) {
2015-11-12 14:05:43 +00:00
this . el . animate ( {
bottom : 0
} , 500 , this . onOpenAnimationEnd ) ;
2016-03-25 07:45:21 +00:00
return this . send ( 'chat_session_init' , {
url : window . location . href
} ) ;
2015-11-12 14:05:43 +00:00
} else {
this . el . css ( 'bottom' , 0 ) ;
2015-12-08 11:32:19 +00:00
return this . onOpenAnimationEnd ( ) ;
2015-11-12 15:19:47 +00:00
}
2015-10-15 09:26:56 +00:00
} ;
2015-11-25 23:40:52 +00:00
ZammadChat . prototype . onOpenAnimationEnd = function ( ) {
2016-02-08 15:06:56 +00:00
this . idleTimeout . stop ( ) ;
if ( this . isFullscreen ) {
return this . disableScrollOnRoot ( ) ;
}
2015-11-25 23:40:52 +00:00
} ;
2015-11-13 09:45:40 +00:00
2015-12-08 11:32:19 +00:00
ZammadChat . prototype . sessionClose = function ( ) {
2015-11-25 23:40:52 +00:00
this . send ( 'chat_session_close' , {
session _id : this . sessionId
} ) ;
2015-12-05 19:41:14 +00:00
this . inactiveTimeout . stop ( ) ;
this . waitingListTimeout . stop ( ) ;
2015-11-25 23:40:52 +00:00
sessionStorage . removeItem ( 'unfinished_message' ) ;
2015-11-13 09:45:40 +00:00
if ( this . onInitialQueueDelayId ) {
clearTimeout ( this . onInitialQueueDelayId ) ;
}
2015-11-25 23:40:52 +00:00
return this . setSessionId ( void 0 ) ;
2015-11-12 14:05:43 +00:00
} ;
2016-02-08 15:06:56 +00:00
ZammadChat . prototype . toggle = function ( event ) {
if ( this . isOpen ) {
return this . close ( event ) ;
} else {
return this . open ( event ) ;
}
} ;
2015-12-08 11:32:19 +00:00
ZammadChat . prototype . close = function ( event ) {
2015-11-12 14:05:43 +00:00
var remainerHeight ;
2015-12-08 11:32:19 +00:00
if ( ! this . isOpen ) {
this . log . debug ( 'can\'t close widget, it\'s not open' ) ;
return ;
}
2016-02-08 20:49:00 +00:00
if ( this . initDelayId ) {
clearTimeout ( this . initDelayId ) ;
}
2015-12-08 11:32:19 +00:00
if ( ! this . sessionId ) {
this . log . debug ( 'can\'t close widget without sessionId' ) ;
return ;
}
this . log . debug ( 'close widget' ) ;
if ( event ) {
event . stopPropagation ( ) ;
}
this . sessionClose ( ) ;
2016-02-08 15:06:56 +00:00
if ( this . isFullscreen ) {
this . enableScrollOnRoot ( ) ;
}
2015-10-15 09:26:56 +00:00
remainerHeight = this . el . height ( ) - this . el . find ( '.zammad-chat-header' ) . outerHeight ( ) ;
return this . el . animate ( {
bottom : - remainerHeight
2015-10-15 13:28:30 +00:00
} , 500 , this . onCloseAnimationEnd ) ;
2015-10-15 09:26:56 +00:00
} ;
ZammadChat . prototype . onCloseAnimationEnd = function ( ) {
2016-03-24 10:03:20 +00:00
this . el . css ( 'bottom' , '' ) ;
this . el . removeClass ( 'zammad-chat-is-open' ) ;
2015-12-05 19:41:14 +00:00
this . showLoader ( ) ;
this . el . find ( '.zammad-chat-welcome' ) . removeClass ( 'zammad-chat-is-hidden' ) ;
this . el . find ( '.zammad-chat-agent' ) . addClass ( 'zammad-chat-is-hidden' ) ;
this . el . find ( '.zammad-chat-agent-status' ) . addClass ( 'zammad-chat-is-hidden' ) ;
2015-11-11 20:44:54 +00:00
this . isOpen = false ;
2015-12-05 19:41:14 +00:00
return this . io . reconnect ( ) ;
2015-10-15 09:26:56 +00:00
} ;
2015-12-08 11:32:19 +00:00
ZammadChat . prototype . onWebSocketClose = function ( ) {
if ( this . isOpen ) {
return ;
}
2015-12-05 19:41:14 +00:00
if ( this . el ) {
2016-03-03 14:12:53 +00:00
this . el . removeClass ( 'zammad-chat-is-shown' ) ;
return this . el . removeClass ( 'zammad-chat-is-loaded' ) ;
2015-12-05 19:41:14 +00:00
}
2015-10-15 09:26:56 +00:00
} ;
ZammadChat . prototype . show = function ( ) {
2015-12-08 11:32:19 +00:00
if ( this . state === 'offline' ) {
return ;
2015-11-16 12:08:32 +00:00
}
2016-03-03 14:12:53 +00:00
this . el . addClass ( 'zammad-chat-is-loaded' ) ;
return this . el . addClass ( 'zammad-chat-is-shown' ) ;
2015-10-15 09:26:56 +00:00
} ;
2015-11-11 20:44:54 +00:00
ZammadChat . prototype . disableInput = function ( ) {
2015-11-12 14:05:43 +00:00
this . input . prop ( 'disabled' , true ) ;
2015-11-11 20:44:54 +00:00
return this . el . find ( '.zammad-chat-send' ) . prop ( 'disabled' , true ) ;
} ;
ZammadChat . prototype . enableInput = function ( ) {
2015-11-12 14:05:43 +00:00
this . input . prop ( 'disabled' , false ) ;
2015-11-11 20:44:54 +00:00
return this . el . find ( '.zammad-chat-send' ) . prop ( 'disabled' , false ) ;
} ;
2016-02-08 15:06:56 +00:00
ZammadChat . prototype . hideModal = function ( ) {
return this . el . find ( '.zammad-chat-modal' ) . html ( '' ) ;
} ;
2015-11-12 14:05:43 +00:00
ZammadChat . prototype . onQueueScreen = function ( data ) {
var show ;
2015-11-13 09:45:40 +00:00
this . setSessionId ( data . session _id ) ;
2015-11-12 14:05:43 +00:00
show = ( function ( _this ) {
return function ( ) {
2015-12-05 19:41:14 +00:00
_this . onQueue ( data ) ;
return _this . waitingListTimeout . start ( ) ;
2015-11-12 14:05:43 +00:00
} ;
} ) ( this ) ;
if ( this . initialQueueDelay && ! this . onInitialQueueDelayId ) {
this . onInitialQueueDelayId = setTimeout ( show , this . initialQueueDelay ) ;
return ;
}
if ( this . onInitialQueueDelayId ) {
clearTimeout ( this . onInitialQueueDelayId ) ;
}
return show ( ) ;
} ;
2015-11-12 15:19:47 +00:00
ZammadChat . prototype . onQueue = function ( data ) {
2015-12-05 19:41:14 +00:00
this . log . notice ( 'onQueue' , data . position ) ;
2015-11-02 15:48:16 +00:00
this . inQueue = true ;
2016-02-08 15:06:56 +00:00
return this . el . find ( '.zammad-chat-modal' ) . html ( this . view ( 'waiting' ) ( {
2015-11-12 14:05:43 +00:00
position : data . position
2015-11-02 15:48:16 +00:00
} ) ) ;
} ;
2015-10-15 09:26:56 +00:00
ZammadChat . prototype . onAgentTypingStart = function ( ) {
2015-11-11 13:10:26 +00:00
if ( this . stopTypingId ) {
clearTimeout ( this . stopTypingId ) ;
}
this . stopTypingId = setTimeout ( this . onAgentTypingEnd , 3000 ) ;
2017-07-03 12:12:42 +00:00
if ( this . el . find ( '.zammad-chat-message--typing' ) . get ( 0 ) ) {
2015-10-15 09:26:56 +00:00
return ;
}
this . maybeAddTimestamp ( ) ;
this . el . find ( '.zammad-chat-body' ) . append ( this . view ( 'typingIndicator' ) ( ) ) ;
2016-06-28 09:34:57 +00:00
if ( ! this . isVisible ( this . el . find ( '.zammad-chat-message--typing' ) , true ) ) {
return ;
}
2015-10-15 09:26:56 +00:00
return this . scrollToBottom ( ) ;
} ;
ZammadChat . prototype . onAgentTypingEnd = function ( ) {
return this . el . find ( '.zammad-chat-message--typing' ) . remove ( ) ;
} ;
2015-12-05 19:41:14 +00:00
ZammadChat . prototype . onLeaveTemporary = function ( ) {
if ( ! this . sessionId ) {
return ;
}
return this . send ( 'chat_session_leave_temporary' , {
session _id : this . sessionId
} ) ;
} ;
2015-10-15 09:26:56 +00:00
ZammadChat . prototype . maybeAddTimestamp = function ( ) {
var label , time , timestamp ;
timestamp = Date . now ( ) ;
if ( ! this . lastTimestamp || ( timestamp - this . lastTimestamp ) > this . showTimeEveryXMinutes * 60000 ) {
label = this . T ( 'Today' ) ;
time = new Date ( ) . toTimeString ( ) . substr ( 0 , 5 ) ;
if ( this . lastAddedType === 'timestamp' ) {
this . updateLastTimestamp ( label , time ) ;
return this . lastTimestamp = timestamp ;
} else {
2015-11-12 15:19:47 +00:00
this . el . find ( '.zammad-chat-body' ) . append ( this . view ( 'timestamp' ) ( {
label : label ,
time : time
} ) ) ;
2015-10-15 09:26:56 +00:00
this . lastTimestamp = timestamp ;
2015-11-12 15:19:47 +00:00
this . lastAddedType = 'timestamp' ;
return this . scrollToBottom ( ) ;
2015-10-15 09:26:56 +00:00
}
}
} ;
ZammadChat . prototype . updateLastTimestamp = function ( label , time ) {
2015-12-08 11:32:19 +00:00
if ( ! this . el ) {
return ;
}
2015-11-12 15:19:47 +00:00
return this . el . find ( '.zammad-chat-body' ) . find ( '.zammad-chat-timestamp' ) . last ( ) . replaceWith ( this . view ( 'timestamp' ) ( {
2015-10-15 09:26:56 +00:00
label : label ,
time : time
} ) ) ;
} ;
2015-11-12 15:19:47 +00:00
ZammadChat . prototype . addStatus = function ( status ) {
2015-12-08 11:32:19 +00:00
if ( ! this . el ) {
return ;
}
2015-11-12 16:32:11 +00:00
this . maybeAddTimestamp ( ) ;
2015-11-12 15:19:47 +00:00
this . el . find ( '.zammad-chat-body' ) . append ( this . view ( 'status' ) ( {
status : status
2015-10-15 09:26:56 +00:00
} ) ) ;
2015-11-12 15:19:47 +00:00
return this . scrollToBottom ( ) ;
2015-10-15 09:26:56 +00:00
} ;
2016-07-05 11:00:49 +00:00
ZammadChat . prototype . detectScrolledtoBottom = function ( ) {
var scrollBottom ;
scrollBottom = this . el . find ( '.zammad-chat-body' ) . scrollTop ( ) + this . el . find ( '.zammad-chat-body' ) . outerHeight ( ) ;
this . scrolledToBottom = Math . abs ( scrollBottom - this . el . find ( '.zammad-chat-body' ) . prop ( 'scrollHeight' ) ) <= this . scrollSnapTolerance ;
if ( this . scrolledToBottom ) {
return this . el . find ( '.zammad-scroll-hint' ) . addClass ( 'is-hidden' ) ;
}
} ;
ZammadChat . prototype . showScrollHint = function ( ) {
this . el . find ( '.zammad-scroll-hint' ) . removeClass ( 'is-hidden' ) ;
return this . el . find ( '.zammad-chat-body' ) . scrollTop ( this . el . find ( '.zammad-chat-body' ) . scrollTop ( ) + this . el . find ( '.zammad-scroll-hint' ) . outerHeight ( ) ) ;
} ;
ZammadChat . prototype . onScrollHintClick = function ( ) {
return this . el . find ( '.zammad-chat-body' ) . animate ( {
scrollTop : this . el . find ( '.zammad-chat-body' ) . prop ( 'scrollHeight' )
} , 300 ) ;
} ;
ZammadChat . prototype . scrollToBottom = function ( arg ) {
var showHint ;
showHint = ( arg != null ? arg : {
showHint : false
} ) . showHint ;
if ( this . scrolledToBottom ) {
return this . el . find ( '.zammad-chat-body' ) . scrollTop ( $ ( '.zammad-chat-body' ) . prop ( 'scrollHeight' ) ) ;
} else if ( showHint ) {
return this . showScrollHint ( ) ;
}
2015-10-15 09:26:56 +00:00
} ;
2015-12-05 19:41:14 +00:00
ZammadChat . prototype . destroy = function ( params ) {
if ( params == null ) {
params = { } ;
2015-11-13 12:59:15 +00:00
}
2015-12-08 11:32:19 +00:00
this . log . debug ( 'destroy widget' , params ) ;
this . setAgentOnlineState ( 'offline' ) ;
if ( params . remove && this . el ) {
this . el . remove ( ) ;
2015-12-05 19:41:14 +00:00
}
2015-12-08 11:32:19 +00:00
if ( this . waitingListTimeout ) {
this . waitingListTimeout . stop ( ) ;
2015-11-13 09:45:40 +00:00
}
2015-12-08 11:32:19 +00:00
if ( this . inactiveTimeout ) {
this . inactiveTimeout . stop ( ) ;
2015-12-05 19:41:14 +00:00
}
2015-12-08 11:32:19 +00:00
if ( this . idleTimeout ) {
this . idleTimeout . stop ( ) ;
}
return this . io . close ( ) ;
2015-11-12 14:05:43 +00:00
} ;
2015-10-15 09:26:56 +00:00
ZammadChat . prototype . reconnect = function ( ) {
2015-12-05 19:41:14 +00:00
this . log . notice ( 'reconnecting' ) ;
2015-11-11 20:44:54 +00:00
this . disableInput ( ) ;
2015-10-15 09:26:56 +00:00
this . lastAddedType = 'status' ;
2015-11-13 14:58:44 +00:00
this . setAgentOnlineState ( 'connecting' ) ;
2015-12-05 19:41:14 +00:00
return this . addStatus ( this . T ( 'Connection lost' ) ) ;
2015-10-15 09:26:56 +00:00
} ;
ZammadChat . prototype . onConnectionReestablished = function ( ) {
this . lastAddedType = 'status' ;
2015-11-13 14:58:44 +00:00
this . setAgentOnlineState ( 'online' ) ;
2015-10-15 09:26:56 +00:00
return this . addStatus ( this . T ( 'Connection re-established' ) ) ;
} ;
2015-11-11 20:44:54 +00:00
ZammadChat . prototype . onSessionClosed = function ( data ) {
this . addStatus ( this . T ( 'Chat closed by %s' , data . realname ) ) ;
2015-11-25 10:06:26 +00:00
this . disableInput ( ) ;
2015-11-25 23:40:52 +00:00
this . setAgentOnlineState ( 'offline' ) ;
2015-12-05 19:41:14 +00:00
return this . inactiveTimeout . stop ( ) ;
2015-10-15 09:26:56 +00:00
} ;
2015-11-12 14:05:43 +00:00
ZammadChat . prototype . setSessionId = function ( id ) {
this . sessionId = id ;
2015-11-12 16:32:11 +00:00
if ( id === void 0 ) {
return sessionStorage . removeItem ( 'sessionId' ) ;
} else {
return sessionStorage . setItem ( 'sessionId' , id ) ;
}
2015-11-12 14:05:43 +00:00
} ;
ZammadChat . prototype . onConnectionEstablished = function ( data ) {
if ( this . onInitialQueueDelayId ) {
clearTimeout ( this . onInitialQueueDelayId ) ;
}
2015-11-02 15:48:16 +00:00
this . inQueue = false ;
2015-11-12 16:32:11 +00:00
if ( data . agent ) {
this . agent = data . agent ;
}
if ( data . session _id ) {
this . setSessionId ( data . session _id ) ;
}
2016-03-25 15:15:37 +00:00
this . el . find ( '.zammad-chat-body' ) . html ( '' ) ;
2015-11-02 15:48:16 +00:00
this . el . find ( '.zammad-chat-agent' ) . html ( this . view ( 'agent' ) ( {
2015-11-12 14:05:43 +00:00
agent : this . agent
2015-11-02 15:48:16 +00:00
} ) ) ;
2015-11-11 20:44:54 +00:00
this . enableInput ( ) ;
2016-02-08 15:06:56 +00:00
this . hideModal ( ) ;
2015-10-15 09:26:56 +00:00
this . el . find ( '.zammad-chat-welcome' ) . addClass ( 'zammad-chat-is-hidden' ) ;
this . el . find ( '.zammad-chat-agent' ) . removeClass ( 'zammad-chat-is-hidden' ) ;
this . el . find ( '.zammad-chat-agent-status' ) . removeClass ( 'zammad-chat-is-hidden' ) ;
2016-02-08 15:06:56 +00:00
if ( ! this . isFullscreen ) {
this . input . focus ( ) ;
}
2015-12-05 19:41:14 +00:00
this . setAgentOnlineState ( 'online' ) ;
this . waitingListTimeout . stop ( ) ;
this . idleTimeout . stop ( ) ;
return this . inactiveTimeout . start ( ) ;
2015-10-15 09:26:56 +00:00
} ;
2015-12-05 19:41:14 +00:00
ZammadChat . prototype . showCustomerTimeout = function ( ) {
2015-11-25 23:40:52 +00:00
var reload ;
2016-02-08 15:06:56 +00:00
this . el . find ( '.zammad-chat-modal' ) . html ( this . view ( 'customer_timeout' ) ( {
2015-11-12 16:32:11 +00:00
agent : this . agent . name ,
2015-11-25 23:40:52 +00:00
delay : this . options . inactiveTimeout
2015-11-12 16:32:11 +00:00
} ) ) ;
2015-11-25 23:40:52 +00:00
reload = function ( ) {
return location . reload ( ) ;
} ;
2015-12-08 11:32:19 +00:00
this . el . find ( '.js-restart' ) . click ( reload ) ;
return this . sessionClose ( ) ;
2015-11-12 16:32:11 +00:00
} ;
2015-12-05 19:41:14 +00:00
ZammadChat . prototype . showWaitingListTimeout = function ( ) {
var reload ;
2016-02-08 15:06:56 +00:00
this . el . find ( '.zammad-chat-modal' ) . html ( this . view ( 'waiting_list_timeout' ) ( {
2015-12-05 19:41:14 +00:00
delay : this . options . watingListTimeout
} ) ) ;
reload = function ( ) {
return location . reload ( ) ;
} ;
2015-12-08 11:32:19 +00:00
this . el . find ( '.js-restart' ) . click ( reload ) ;
return this . sessionClose ( ) ;
2015-12-05 19:41:14 +00:00
} ;
2015-11-02 15:48:16 +00:00
ZammadChat . prototype . showLoader = function ( ) {
2016-02-08 15:06:56 +00:00
return this . el . find ( '.zammad-chat-modal' ) . html ( this . view ( 'loader' ) ( ) ) ;
2015-11-02 15:48:16 +00:00
} ;
2015-10-15 09:26:56 +00:00
ZammadChat . prototype . setAgentOnlineState = function ( state ) {
2015-11-13 14:58:44 +00:00
var capitalizedState ;
this . state = state ;
2015-12-08 11:32:19 +00:00
if ( ! this . el ) {
return ;
}
2015-11-13 14:58:44 +00:00
capitalizedState = state . charAt ( 0 ) . toUpperCase ( ) + state . slice ( 1 ) ;
return this . el . find ( '.zammad-chat-agent-status' ) . attr ( 'data-status' , state ) . text ( this . T ( capitalizedState ) ) ;
2015-10-15 09:26:56 +00:00
} ;
2015-12-07 10:41:12 +00:00
ZammadChat . prototype . detectHost = function ( ) {
var protocol ;
protocol = 'ws://' ;
2017-02-10 15:29:44 +00:00
if ( scriptProtocol === 'https' ) {
2015-12-07 10:41:12 +00:00
protocol = 'wss://' ;
}
return this . options . host = "" + protocol + scriptHost + "/ws" ;
} ;
2015-11-25 16:36:06 +00:00
ZammadChat . prototype . loadCss = function ( ) {
var newSS , styles , url ;
if ( ! this . options . cssAutoload ) {
return ;
}
url = this . options . cssUrl ;
if ( ! url ) {
url = this . options . host . replace ( /^wss/i , 'https' ) . replace ( /^ws/i , 'http' ) . replace ( /\/ws/i , '' ) ;
url += '/assets/chat/chat.css' ;
}
2015-12-05 19:41:14 +00:00
this . log . debug ( "load css from '" + url + "'" ) ;
2015-11-25 16:36:06 +00:00
styles = "@import url('" + url + "');" ;
newSS = document . createElement ( 'link' ) ;
2016-03-03 14:12:53 +00:00
newSS . onload = this . onCssLoaded ;
2015-11-25 16:36:06 +00:00
newSS . rel = 'stylesheet' ;
newSS . href = 'data:text/css,' + escape ( styles ) ;
return document . getElementsByTagName ( 'head' ) [ 0 ] . appendChild ( newSS ) ;
} ;
2016-03-03 14:12:53 +00:00
ZammadChat . prototype . onCssLoaded = function ( ) {
if ( this . socketReady ) {
return this . onReady ( ) ;
} else {
return this . cssLoaded = true ;
}
} ;
2015-12-05 19:41:14 +00:00
ZammadChat . prototype . startTimeoutObservers = function ( ) {
this . idleTimeout = new Timeout ( {
logPrefix : 'idleTimeout' ,
debug : this . options . debug ,
timeout : this . options . idleTimeout ,
timeoutIntervallCheck : this . options . idleTimeoutIntervallCheck ,
callback : ( function ( _this ) {
return function ( ) {
_this . log . debug ( 'Idle timeout reached, hide widget' , new Date ) ;
return _this . destroy ( {
2015-12-08 11:32:19 +00:00
remove : true
2015-12-05 19:41:14 +00:00
} ) ;
} ;
} ) ( this )
} ) ;
this . inactiveTimeout = new Timeout ( {
logPrefix : 'inactiveTimeout' ,
debug : this . options . debug ,
timeout : this . options . inactiveTimeout ,
timeoutIntervallCheck : this . options . inactiveTimeoutIntervallCheck ,
callback : ( function ( _this ) {
return function ( ) {
_this . log . debug ( 'Inactive timeout reached, show timeout screen.' , new Date ) ;
_this . showCustomerTimeout ( ) ;
return _this . destroy ( {
2015-12-08 11:32:19 +00:00
remove : false
2015-12-05 19:41:14 +00:00
} ) ;
} ;
} ) ( this )
} ) ;
return this . waitingListTimeout = new Timeout ( {
logPrefix : 'waitingListTimeout' ,
debug : this . options . debug ,
timeout : this . options . waitingListTimeout ,
timeoutIntervallCheck : this . options . waitingListTimeoutIntervallCheck ,
callback : ( function ( _this ) {
return function ( ) {
_this . log . debug ( 'Waiting list timeout reached, show timeout screen.' , new Date ) ;
_this . showWaitingListTimeout ( ) ;
return _this . destroy ( {
2015-12-08 11:32:19 +00:00
remove : false
2015-12-05 19:41:14 +00:00
} ) ;
} ;
} ) ( this )
} ) ;
2015-11-25 23:40:52 +00:00
} ;
2016-02-08 15:06:56 +00:00
ZammadChat . prototype . disableScrollOnRoot = function ( ) {
this . rootScrollOffset = this . scrollRoot . scrollTop ( ) ;
return this . scrollRoot . css ( {
overflow : 'hidden' ,
position : 'fixed'
} ) ;
} ;
ZammadChat . prototype . enableScrollOnRoot = function ( ) {
this . scrollRoot . scrollTop ( this . rootScrollOffset ) ;
return this . scrollRoot . css ( {
overflow : '' ,
position : ''
} ) ;
} ;
2016-06-28 09:34:57 +00:00
ZammadChat . prototype . isVisible = function ( el , partial , hidden , direction ) {
var $t , $w , _bottom , _left , _right , _top , bViz , clientSize , compareBottom , compareLeft , compareRight , compareTop , hVisible , lViz , offset , rViz , rec , t , tViz , vVisible , viewBottom , viewLeft , viewRight , viewTop , vpHeight , vpWidth ;
if ( el . length < 1 ) {
return ;
}
$w = $ ( window ) ;
$t = el . length > 1 ? el . eq ( 0 ) : el ;
t = $t . get ( 0 ) ;
vpWidth = $w . width ( ) ;
vpHeight = $w . height ( ) ;
direction = direction ? direction : 'both' ;
clientSize = hidden === true ? t . offsetWidth * t . offsetHeight : true ;
if ( typeof t . getBoundingClientRect === 'function' ) {
rec = t . getBoundingClientRect ( ) ;
tViz = rec . top >= 0 && rec . top < vpHeight ;
bViz = rec . bottom > 0 && rec . bottom <= vpHeight ;
lViz = rec . left >= 0 && rec . left < vpWidth ;
rViz = rec . right > 0 && rec . right <= vpWidth ;
vVisible = partial ? tViz || bViz : tViz && bViz ;
hVisible = partial ? lViz || rViz : lViz && rViz ;
if ( direction === 'both' ) {
return clientSize && vVisible && hVisible ;
} else if ( direction === 'vertical' ) {
return clientSize && vVisible ;
} else if ( direction === 'horizontal' ) {
return clientSize && hVisible ;
}
} else {
viewTop = $w . scrollTop ( ) ;
viewBottom = viewTop + vpHeight ;
viewLeft = $w . scrollLeft ( ) ;
viewRight = viewLeft + vpWidth ;
offset = $t . offset ( ) ;
_top = offset . top ;
_bottom = _top + $t . height ( ) ;
_left = offset . left ;
_right = _left + $t . width ( ) ;
compareTop = partial === true ? _bottom : _top ;
compareBottom = partial === true ? _top : _bottom ;
compareLeft = partial === true ? _right : _left ;
compareRight = partial === true ? _left : _right ;
if ( direction === 'both' ) {
return ! ! clientSize && ( ( compareBottom <= viewBottom ) && ( compareTop >= viewTop ) ) && ( ( compareRight <= viewRight ) && ( compareLeft >= viewLeft ) ) ;
} else if ( direction === 'vertical' ) {
return ! ! clientSize && ( ( compareBottom <= viewBottom ) && ( compareTop >= viewTop ) ) ;
} else if ( direction === 'horizontal' ) {
return ! ! clientSize && ( ( compareRight <= viewRight ) && ( compareLeft >= viewLeft ) ) ;
}
}
} ;
2017-07-18 13:43:04 +00:00
ZammadChat . prototype . isRetina = function ( ) {
var mq ;
if ( window . matchMedia ) {
mq = window . matchMedia ( 'only screen and (min--moz-device-pixel-ratio: 1.3), only screen and (-o-min-device-pixel-ratio: 2.6/2), only screen and (-webkit-min-device-pixel-ratio: 1.3), only screen and (min-device-pixel-ratio: 1.3), only screen and (min-resolution: 1.3dppx)' ) ;
return mq && mq . matches || ( window . devicePixelRatio > 1 ) ;
}
return false ;
} ;
ZammadChat . prototype . resizeImage = function ( dataURL , x , y , sizeFactor , type , quallity , callback , force ) {
var imageObject ;
if ( x == null ) {
x = 'auto' ;
}
if ( y == null ) {
y = 'auto' ;
}
if ( sizeFactor == null ) {
sizeFactor = 1 ;
}
if ( force == null ) {
force = true ;
}
imageObject = new Image ( ) ;
imageObject . onload = function ( ) {
var canvas , context , factor , imageHeight , imageWidth , newDataUrl , resize ;
imageWidth = imageObject . width ;
imageHeight = imageObject . height ;
console . log ( 'ImageService' , 'current size' , imageWidth , imageHeight ) ;
if ( y === 'auto' && x === 'auto' ) {
x = imageWidth ;
y = imageHeight ;
}
if ( y === 'auto' ) {
factor = imageWidth / x ;
y = imageHeight / factor ;
}
if ( x === 'auto' ) {
factor = imageWidth / y ;
x = imageHeight / factor ;
}
resize = false ;
if ( x < imageWidth || y < imageHeight ) {
resize = true ;
x = x * sizeFactor ;
y = y * sizeFactor ;
} else {
x = imageWidth ;
y = imageHeight ;
}
canvas = document . createElement ( 'canvas' ) ;
canvas . width = x ;
canvas . height = y ;
context = canvas . getContext ( '2d' ) ;
context . drawImage ( imageObject , 0 , 0 , x , y ) ;
if ( quallity === 'auto' ) {
if ( x < 200 && y < 200 ) {
quallity = 1 ;
} else if ( x < 400 && y < 400 ) {
quallity = 0.9 ;
} else if ( x < 600 && y < 600 ) {
quallity = 0.8 ;
} else if ( x < 900 && y < 900 ) {
quallity = 0.7 ;
} else {
quallity = 0.6 ;
}
}
newDataUrl = canvas . toDataURL ( type , quallity ) ;
if ( resize ) {
console . log ( 'ImageService' , 'resize' , x / sizeFactor , y / sizeFactor , quallity , ( newDataUrl . length * 0.75 ) / 1024 / 1024 , 'in mb' ) ;
callback ( newDataUrl , x / sizeFactor , y / sizeFactor , true ) ;
return ;
}
console . log ( 'ImageService' , 'no resize' , x , y , quallity , ( newDataUrl . length * 0.75 ) / 1024 / 1024 , 'in mb' ) ;
return callback ( newDataUrl , x , y , false ) ;
} ;
return imageObject . src = dataURL ;
} ;
ZammadChat . prototype . pasteHtmlAtCaret = function ( html ) {
var el , frag , lastNode , node , range , sel ;
sel = void 0 ;
range = void 0 ;
if ( window . getSelection ) {
sel = window . getSelection ( ) ;
if ( sel . getRangeAt && sel . rangeCount ) {
range = sel . getRangeAt ( 0 ) ;
range . deleteContents ( ) ;
el = document . createElement ( 'div' ) ;
el . innerHTML = html ;
frag = document . createDocumentFragment ( node , lastNode ) ;
while ( node = el . firstChild ) {
lastNode = frag . appendChild ( node ) ;
}
range . insertNode ( frag ) ;
if ( lastNode ) {
range = range . cloneRange ( ) ;
range . setStartAfter ( lastNode ) ;
range . collapse ( true ) ;
sel . removeAllRanges ( ) ;
return sel . addRange ( range ) ;
}
}
} else if ( document . selection && document . selection . type !== 'Control' ) {
return document . selection . createRange ( ) . pasteHTML ( html ) ;
}
} ;
ZammadChat . prototype . wordFilter = function ( editor ) {
var content , last _level , pnt ;
content = editor . html ( ) ;
content = content . replace ( /<!--[\s\S]+?-->/gi , '' ) ;
content = content . replace ( /<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi , '' ) ;
content = content . replace ( /<(\/?)s>/gi , '<$1strike>' ) ;
content = content . replace ( / /gi , ' ' ) ;
editor . html ( content ) ;
$ ( 'p' , editor ) . each ( function ( ) {
var matches , str ;
str = $ ( this ) . attr ( 'style' ) ;
matches = /mso-list:\w+ \w+([0-9]+)/ . exec ( str ) ;
if ( matches ) {
return $ ( this ) . data ( '_listLevel' , parseInt ( matches [ 1 ] , 10 ) ) ;
}
} ) ;
last _level = 0 ;
pnt = null ;
$ ( 'p' , editor ) . each ( function ( ) {
var cur _level , i , j , list _tag , matches , ref , ref1 , ref2 , start , txt ;
cur _level = $ ( this ) . data ( '_listLevel' ) ;
if ( cur _level !== void 0 ) {
txt = $ ( this ) . text ( ) ;
list _tag = '<ul></ul>' ;
if ( /^\s*\w+\./ . test ( txt ) ) {
matches = /([0-9])\./ . exec ( txt ) ;
if ( matches ) {
start = parseInt ( matches [ 1 ] , 10 ) ;
list _tag = ( ref = start > 1 ) != null ? ref : '<ol start="' + start + {
'"></ol>' : '<ol></ol>'
} ;
} else {
list _tag = '<ol></ol>' ;
}
}
if ( cur _level > last _level ) {
if ( last _level === 0 ) {
$ ( this ) . before ( list _tag ) ;
pnt = $ ( this ) . prev ( ) ;
} else {
pnt = $ ( list _tag ) . appendTo ( pnt ) ;
}
}
if ( cur _level < last _level ) {
for ( i = j = ref1 = i , ref2 = last _level - cur _level ; ref1 <= ref2 ? j <= ref2 : j >= ref2 ; i = ref1 <= ref2 ? ++ j : -- j ) {
pnt = pnt . parent ( ) ;
}
}
$ ( 'span:first' , this ) . remove ( ) ;
pnt . append ( '<li>' + $ ( this ) . html ( ) + '</li>' ) ;
$ ( this ) . remove ( ) ;
return last _level = cur _level ;
} else {
return last _level = 0 ;
}
} ) ;
$ ( '[style]' , editor ) . removeAttr ( 'style' ) ;
$ ( '[align]' , editor ) . removeAttr ( 'align' ) ;
$ ( 'span' , editor ) . replaceWith ( function ( ) {
return $ ( this ) . contents ( ) ;
} ) ;
$ ( 'span:empty' , editor ) . remove ( ) ;
$ ( "[class^='Mso']" , editor ) . removeAttr ( 'class' ) ;
$ ( 'p:empty' , editor ) . remove ( ) ;
return editor ;
} ;
ZammadChat . prototype . removeAttribute = function ( element ) {
var $element , att , j , len , ref ;
if ( ! element ) {
return ;
}
$element = $ ( element ) ;
ref = element . attributes ;
for ( j = 0 , len = ref . length ; j < len ; j ++ ) {
att = ref [ j ] ;
if ( att && att . name ) {
element . removeAttribute ( att . name ) ;
}
}
return $element . removeAttr ( 'style' ) . removeAttr ( 'class' ) . removeAttr ( 'lang' ) . removeAttr ( 'type' ) . removeAttr ( 'align' ) . removeAttr ( 'id' ) . removeAttr ( 'wrap' ) . removeAttr ( 'title' ) ;
} ;
ZammadChat . prototype . removeAttributes = function ( html , parent ) {
if ( parent == null ) {
parent = true ;
}
if ( parent ) {
html . each ( ( function ( _this ) {
return function ( index , element ) {
return _this . removeAttribute ( element ) ;
} ;
} ) ( this ) ) ;
}
html . find ( '*' ) . each ( ( function ( _this ) {
return function ( index , element ) {
return _this . removeAttribute ( element ) ;
} ;
} ) ( this ) ) ;
return html ;
} ;
2015-10-15 09:26:56 +00:00
return ZammadChat ;
2015-12-05 19:41:14 +00:00
} ) ( Base ) ;
2015-11-13 12:59:15 +00:00
return window . ZammadChat = ZammadChat ;
2015-10-15 09:26:56 +00:00
} ) ( window . jQuery , window ) ;
2015-11-12 15:19:47 +00:00
if ( ! window . zammadChatTemplates ) {
window . zammadChatTemplates = { } ;
}
2015-11-12 16:32:11 +00:00
window . zammadChatTemplates [ "chat" ] = function ( _ _obj ) {
2015-11-12 15:19:47 +00:00
if ( ! _ _obj ) _ _obj = { } ;
var _ _out = [ ] , _ _capture = function ( callback ) {
var out = _ _out , result ;
_ _out = [ ] ;
callback . call ( this ) ;
result = _ _out . join ( '' ) ;
_ _out = out ;
return _ _safe ( result ) ;
} , _ _sanitize = function ( value ) {
if ( value && value . ecoSafe ) {
return value ;
} else if ( typeof value !== 'undefined' && value != null ) {
return _ _escape ( value ) ;
} else {
return '' ;
}
} , _ _safe , _ _objSafe = _ _obj . safe , _ _escape = _ _obj . escape ;
_ _safe = _ _obj . safe = function ( value ) {
if ( value && value . ecoSafe ) {
return value ;
} else {
if ( ! ( typeof value !== 'undefined' && value != null ) ) value = '' ;
var result = new String ( value ) ;
result . ecoSafe = true ;
return result ;
}
} ;
if ( ! _ _escape ) {
_ _escape = _ _obj . escape = function ( value ) {
return ( '' + value )
. replace ( /&/g , '&' )
. replace ( /</g , '<' )
. replace ( />/g , '>' )
. replace ( /"/g , '"' ) ;
} ;
}
( function ( ) {
( function ( ) {
2015-11-13 14:58:44 +00:00
_ _out . push ( '<div class="zammad-chat' ) ;
2016-01-20 19:38:38 +00:00
2015-11-13 14:58:44 +00:00
if ( this . flat ) {
_ _out . push ( _ _sanitize ( ' zammad-chat--flat' ) ) ;
}
2016-01-20 19:38:38 +00:00
2015-11-16 10:46:42 +00:00
_ _out . push ( '"' ) ;
2016-01-20 19:38:38 +00:00
2015-11-16 10:46:42 +00:00
if ( this . fontSize ) {
2015-11-16 13:39:39 +00:00
_ _out . push ( _ _sanitize ( " style='font-size: " + this . fontSize + "'" ) ) ;
2015-11-16 10:46:42 +00:00
}
2016-01-20 19:38:38 +00:00
2015-11-16 10:46:42 +00:00
_ _out . push ( '>\n <div class="zammad-chat-header js-chat-open"' ) ;
2016-01-20 19:38:38 +00:00
2015-11-13 14:58:44 +00:00
if ( this . background ) {
_ _out . push ( _ _sanitize ( " style='background: " + this . background + "'" ) ) ;
}
2016-01-20 19:38:38 +00:00
2016-03-03 14:12:53 +00:00
_ _out . push ( '>\n <div class="zammad-chat-header-controls js-chat-toggle">\n <span class="zammad-chat-agent-status zammad-chat-is-hidden" data-status="online"></span>\n <span class="zammad-chat-header-icon">\n <svg class="zammad-chat-header-icon-open" width="13" height="7" viewBox="0 0 13 7"><path d="M10.807 7l1.4-1.428-5-4.9L6.5-.02l-.7.7-4.9 4.9 1.414 1.413L6.5 2.886 10.807 7z" fill-rule="evenodd"/></svg>\n <svg class="zammad-chat-header-icon-close" width="13" height="13" viewBox="0 0 13 13"><path d="m2.241.12l-2.121 2.121 4.243 4.243-4.243 4.243 2.121 2.121 4.243-4.243 4.243 4.243 2.121-2.121-4.243-4.243 4.243-4.243-2.121-2.121-4.243 4.243-4.243-4.243" fill-rule="evenodd"/></svg>\n </span>\n </div>\n <div class="zammad-chat-agent zammad-chat-is-hidden">\n </div>\n <div class="zammad-chat-welcome">\n <svg class="zammad-chat-icon" viewBox="0 0 24 24" width="24" height="24"><path d="M2 5C2 4 3 3 4 3h16c1 0 2 1 2 2v10C22 16 21 17 20 17H4C3 17 2 16 2 15V5zM12 17l6 4v-4h-6z"/></svg>\n <span class="zammad-chat-welcome-text">' ) ;
2016-01-20 19:38:38 +00:00
2015-11-25 16:36:06 +00:00
_ _out . push ( this . T ( this . title ) ) ;
2016-01-20 19:38:38 +00:00
2016-07-05 11:00:49 +00:00
_ _out . push ( '</span>\n </div>\n </div>\n <div class="zammad-chat-modal"></div>\n <div class="zammad-scroll-hint is-hidden">\n <svg class="zammad-scroll-hint-icon" width="20" height="18" viewBox="0 0 20 18"><path d="M0,2.00585866 C0,0.898053512 0.898212381,0 1.99079514,0 L18.0092049,0 C19.1086907,0 20,0.897060126 20,2.00585866 L20,11.9941413 C20,13.1019465 19.1017876,14 18.0092049,14 L1.99079514,14 C0.891309342,14 0,13.1029399 0,11.9941413 L0,2.00585866 Z M10,14 L16,18 L16,14 L10,14 Z" fill-rule="evenodd"/></svg>\n ' ) ;
_ _out . push ( this . T ( this . scrollHint ) ) ;
2017-07-14 13:49:16 +00:00
_ _out . push ( '\n </div>\n <div class="zammad-chat-body"></div>\n <form class="zammad-chat-controls">\n <div class="zammad-chat-input" rows="1" placeholder="' ) ;
2016-01-20 19:38:38 +00:00
2015-11-12 16:32:11 +00:00
_ _out . push ( this . T ( 'Compose your message...' ) ) ;
2016-01-20 19:38:38 +00:00
2017-07-14 13:49:16 +00:00
_ _out . push ( '" contenteditable="true"></div>\n <button type="submit" class="zammad-chat-button zammad-chat-send"' ) ;
2016-01-20 19:38:38 +00:00
2015-11-13 14:58:44 +00:00
if ( this . background ) {
_ _out . push ( _ _sanitize ( " style='background: " + this . background + "'" ) ) ;
}
2016-01-20 19:38:38 +00:00
2015-11-13 14:58:44 +00:00
_ _out . push ( '>' ) ;
2016-01-20 19:38:38 +00:00
2015-11-12 16:32:11 +00:00
_ _out . push ( this . T ( 'Send' ) ) ;
2016-01-20 19:38:38 +00:00
2015-11-12 16:32:11 +00:00
_ _out . push ( '</button>\n </form>\n</div>' ) ;
2016-01-20 19:38:38 +00:00
2015-11-12 15:19:47 +00:00
} ) . call ( this ) ;
2016-01-20 19:38:38 +00:00
2015-11-12 15:19:47 +00:00
} ) . call ( _ _obj ) ;
_ _obj . safe = _ _objSafe , _ _obj . escape = _ _escape ;
return _ _out . join ( '' ) ;
} ;
2015-12-05 19:41:14 +00:00
if ( ! window . zammadChatTemplates ) {
window . zammadChatTemplates = { } ;
}
window . zammadChatTemplates [ "customer_timeout" ] = function ( _ _obj ) {
if ( ! _ _obj ) _ _obj = { } ;
var _ _out = [ ] , _ _capture = function ( callback ) {
var out = _ _out , result ;
_ _out = [ ] ;
callback . call ( this ) ;
result = _ _out . join ( '' ) ;
_ _out = out ;
return _ _safe ( result ) ;
} , _ _sanitize = function ( value ) {
if ( value && value . ecoSafe ) {
return value ;
} else if ( typeof value !== 'undefined' && value != null ) {
return _ _escape ( value ) ;
} else {
return '' ;
}
} , _ _safe , _ _objSafe = _ _obj . safe , _ _escape = _ _obj . escape ;
_ _safe = _ _obj . safe = function ( value ) {
if ( value && value . ecoSafe ) {
return value ;
} else {
if ( ! ( typeof value !== 'undefined' && value != null ) ) value = '' ;
var result = new String ( value ) ;
result . ecoSafe = true ;
return result ;
}
} ;
if ( ! _ _escape ) {
_ _escape = _ _obj . escape = function ( value ) {
return ( '' + value )
. replace ( /&/g , '&' )
. replace ( /</g , '<' )
. replace ( />/g , '>' )
. replace ( /"/g , '"' ) ;
} ;
}
( function ( ) {
( function ( ) {
2016-02-08 15:06:56 +00:00
_ _out . push ( '<div class="zammad-chat-modal-text">\n ' ) ;
2016-01-20 19:38:38 +00:00
2015-12-05 19:41:14 +00:00
if ( this . agent ) {
_ _out . push ( '\n ' ) ;
2016-02-08 15:06:56 +00:00
_ _out . push ( this . T ( 'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> got closed.' , this . delay , this . agent ) ) ;
_ _out . push ( '\n ' ) ;
2015-12-05 19:41:14 +00:00
} else {
_ _out . push ( '\n ' ) ;
2016-02-08 15:06:56 +00:00
_ _out . push ( this . T ( 'Since you didn\'t respond in the last %s minutes your conversation got closed.' , this . delay ) ) ;
_ _out . push ( '\n ' ) ;
2015-12-05 19:41:14 +00:00
}
2016-01-20 19:38:38 +00:00
2016-02-08 15:06:56 +00:00
_ _out . push ( '\n <br>\n <div class="zammad-chat-button js-restart"' ) ;
2016-01-20 19:38:38 +00:00
2015-12-05 19:41:14 +00:00
if ( this . background ) {
_ _out . push ( _ _sanitize ( " style='background: " + this . background + "'" ) ) ;
}
2016-01-20 19:38:38 +00:00
2015-12-05 19:41:14 +00:00
_ _out . push ( '>' ) ;
2016-01-20 19:38:38 +00:00
2015-12-05 19:41:14 +00:00
_ _out . push ( this . T ( 'Start new conversation' ) ) ;
2016-01-20 19:38:38 +00:00
2016-02-08 15:06:56 +00:00
_ _out . push ( '</div>\n</div>' ) ;
2016-01-20 19:38:38 +00:00
2015-12-05 19:41:14 +00:00
} ) . call ( this ) ;
2016-01-20 19:38:38 +00:00
2015-12-05 19:41:14 +00:00
} ) . call ( _ _obj ) ;
_ _obj . safe = _ _objSafe , _ _obj . escape = _ _escape ;
return _ _out . join ( '' ) ;
} ;
2015-11-11 10:44:10 +00:00
if ( ! window . zammadChatTemplates ) {
window . zammadChatTemplates = { } ;
}
2015-11-12 16:32:11 +00:00
window . zammadChatTemplates [ "loader" ] = function ( _ _obj ) {
2015-11-11 10:44:10 +00:00
if ( ! _ _obj ) _ _obj = { } ;
var _ _out = [ ] , _ _capture = function ( callback ) {
var out = _ _out , result ;
_ _out = [ ] ;
callback . call ( this ) ;
result = _ _out . join ( '' ) ;
_ _out = out ;
return _ _safe ( result ) ;
} , _ _sanitize = function ( value ) {
if ( value && value . ecoSafe ) {
return value ;
} else if ( typeof value !== 'undefined' && value != null ) {
return _ _escape ( value ) ;
} else {
return '' ;
}
} , _ _safe , _ _objSafe = _ _obj . safe , _ _escape = _ _obj . escape ;
_ _safe = _ _obj . safe = function ( value ) {
if ( value && value . ecoSafe ) {
return value ;
} else {
if ( ! ( typeof value !== 'undefined' && value != null ) ) value = '' ;
var result = new String ( value ) ;
result . ecoSafe = true ;
return result ;
}
} ;
if ( ! _ _escape ) {
_ _escape = _ _obj . escape = function ( value ) {
return ( '' + value )
. replace ( /&/g , '&' )
. replace ( /</g , '<' )
. replace ( />/g , '>' )
. replace ( /"/g , '"' ) ;
} ;
}
( function ( ) {
( function ( ) {
2016-02-08 15:06:56 +00:00
_ _out . push ( '<span class="zammad-chat-loading-animation">\n <span class="zammad-chat-loading-circle"></span>\n <span class="zammad-chat-loading-circle"></span>\n <span class="zammad-chat-loading-circle"></span>\n</span>\n<span class="zammad-chat-modal-text">' ) ;
2016-01-20 19:38:38 +00:00
2015-11-24 14:20:38 +00:00
_ _out . push ( this . T ( 'Connecting' ) ) ;
2016-01-20 19:38:38 +00:00
2016-02-08 15:06:56 +00:00
_ _out . push ( '</span>' ) ;
2016-01-20 19:38:38 +00:00
2015-11-02 15:48:16 +00:00
} ) . call ( this ) ;
2016-01-20 19:38:38 +00:00
2015-11-02 15:48:16 +00:00
} ) . call ( _ _obj ) ;
_ _obj . safe = _ _objSafe , _ _obj . escape = _ _escape ;
return _ _out . join ( '' ) ;
} ;
if ( ! window . zammadChatTemplates ) {
window . zammadChatTemplates = { } ;
}
2015-11-12 16:32:11 +00:00
window . zammadChatTemplates [ "message" ] = function ( _ _obj ) {
2015-11-02 15:48:16 +00:00
if ( ! _ _obj ) _ _obj = { } ;
var _ _out = [ ] , _ _capture = function ( callback ) {
var out = _ _out , result ;
_ _out = [ ] ;
callback . call ( this ) ;
result = _ _out . join ( '' ) ;
_ _out = out ;
return _ _safe ( result ) ;
} , _ _sanitize = function ( value ) {
if ( value && value . ecoSafe ) {
return value ;
} else if ( typeof value !== 'undefined' && value != null ) {
return _ _escape ( value ) ;
} else {
return '' ;
}
} , _ _safe , _ _objSafe = _ _obj . safe , _ _escape = _ _obj . escape ;
_ _safe = _ _obj . safe = function ( value ) {
if ( value && value . ecoSafe ) {
return value ;
} else {
if ( ! ( typeof value !== 'undefined' && value != null ) ) value = '' ;
var result = new String ( value ) ;
result . ecoSafe = true ;
return result ;
}
} ;
if ( ! _ _escape ) {
_ _escape = _ _obj . escape = function ( value ) {
return ( '' + value )
. replace ( /&/g , '&' )
. replace ( /</g , '<' )
. replace ( />/g , '>' )
. replace ( /"/g , '"' ) ;
} ;
}
( function ( ) {
( function ( ) {
2015-11-12 16:32:11 +00:00
_ _out . push ( '<div class="zammad-chat-message zammad-chat-message--' ) ;
2016-01-20 19:38:38 +00:00
2015-11-12 16:32:11 +00:00
_ _out . push ( _ _sanitize ( this . from ) ) ;
2016-01-20 19:38:38 +00:00
2015-11-26 09:52:10 +00:00
_ _out . push ( _ _sanitize ( this . unreadClass ) ) ;
2016-01-20 19:38:38 +00:00
2015-11-13 14:58:44 +00:00
_ _out . push ( '">\n <span class="zammad-chat-message-body"' ) ;
2016-01-20 19:38:38 +00:00
2015-11-13 14:58:44 +00:00
if ( this . background && this . from === 'customer' ) {
_ _out . push ( _ _sanitize ( " style='background: " + this . background + "'" ) ) ;
}
2016-01-20 19:38:38 +00:00
2015-11-13 14:58:44 +00:00
_ _out . push ( '>' ) ;
2016-01-20 19:38:38 +00:00
2015-11-12 16:32:11 +00:00
_ _out . push ( this . message ) ;
2016-01-20 19:38:38 +00:00
2015-11-02 15:48:16 +00:00
_ _out . push ( '</span>\n</div>' ) ;
2016-01-20 19:38:38 +00:00
2015-11-02 15:48:16 +00:00
} ) . call ( this ) ;
2016-01-20 19:38:38 +00:00
2015-11-02 15:48:16 +00:00
} ) . call ( _ _obj ) ;
_ _obj . safe = _ _objSafe , _ _obj . escape = _ _escape ;
return _ _out . join ( '' ) ;
} ;
2015-10-15 09:14:19 +00:00
if ( ! window . zammadChatTemplates ) {
window . zammadChatTemplates = { } ;
}
2015-11-12 16:32:11 +00:00
window . zammadChatTemplates [ "status" ] = function ( _ _obj ) {
2015-10-15 09:14:19 +00:00
if ( ! _ _obj ) _ _obj = { } ;
var _ _out = [ ] , _ _capture = function ( callback ) {
var out = _ _out , result ;
_ _out = [ ] ;
callback . call ( this ) ;
result = _ _out . join ( '' ) ;
_ _out = out ;
return _ _safe ( result ) ;
} , _ _sanitize = function ( value ) {
if ( value && value . ecoSafe ) {
return value ;
} else if ( typeof value !== 'undefined' && value != null ) {
return _ _escape ( value ) ;
} else {
return '' ;
}
} , _ _safe , _ _objSafe = _ _obj . safe , _ _escape = _ _obj . escape ;
_ _safe = _ _obj . safe = function ( value ) {
if ( value && value . ecoSafe ) {
return value ;
} else {
if ( ! ( typeof value !== 'undefined' && value != null ) ) value = '' ;
var result = new String ( value ) ;
result . ecoSafe = true ;
return result ;
}
} ;
if ( ! _ _escape ) {
_ _escape = _ _obj . escape = function ( value ) {
return ( '' + value )
. replace ( /&/g , '&' )
. replace ( /</g , '<' )
. replace ( />/g , '>' )
. replace ( /"/g , '"' ) ;
} ;
}
( function ( ) {
( function ( ) {
2016-01-12 10:57:38 +00:00
_ _out . push ( '<div class="zammad-chat-status">\n <div class="zammad-chat-status-inner">\n ' ) ;
2016-01-20 19:38:38 +00:00
2015-11-12 16:32:11 +00:00
_ _out . push ( this . status ) ;
2016-01-20 19:38:38 +00:00
2016-01-12 10:57:38 +00:00
_ _out . push ( '\n </div>\n</div>' ) ;
2016-01-20 19:38:38 +00:00
2015-10-15 09:14:19 +00:00
} ) . call ( this ) ;
2016-01-20 19:38:38 +00:00
2015-10-15 09:14:19 +00:00
} ) . call ( _ _obj ) ;
_ _obj . safe = _ _objSafe , _ _obj . escape = _ _escape ;
return _ _out . join ( '' ) ;
} ;
if ( ! window . zammadChatTemplates ) {
window . zammadChatTemplates = { } ;
}
2015-12-05 19:41:14 +00:00
window . zammadChatTemplates [ "timestamp" ] = function ( _ _obj ) {
2015-10-15 09:14:19 +00:00
if ( ! _ _obj ) _ _obj = { } ;
var _ _out = [ ] , _ _capture = function ( callback ) {
var out = _ _out , result ;
_ _out = [ ] ;
callback . call ( this ) ;
result = _ _out . join ( '' ) ;
_ _out = out ;
return _ _safe ( result ) ;
} , _ _sanitize = function ( value ) {
if ( value && value . ecoSafe ) {
return value ;
} else if ( typeof value !== 'undefined' && value != null ) {
return _ _escape ( value ) ;
} else {
return '' ;
}
} , _ _safe , _ _objSafe = _ _obj . safe , _ _escape = _ _obj . escape ;
_ _safe = _ _obj . safe = function ( value ) {
if ( value && value . ecoSafe ) {
return value ;
} else {
if ( ! ( typeof value !== 'undefined' && value != null ) ) value = '' ;
var result = new String ( value ) ;
result . ecoSafe = true ;
return result ;
}
} ;
if ( ! _ _escape ) {
_ _escape = _ _obj . escape = function ( value ) {
return ( '' + value )
. replace ( /&/g , '&' )
. replace ( /</g , '<' )
. replace ( />/g , '>' )
. replace ( /"/g , '"' ) ;
} ;
}
( function ( ) {
( function ( ) {
2015-12-05 19:41:14 +00:00
_ _out . push ( '<div class="zammad-chat-timestamp"><strong>' ) ;
2016-01-20 19:38:38 +00:00
2015-12-05 19:41:14 +00:00
_ _out . push ( _ _sanitize ( this . label ) ) ;
2016-01-20 19:38:38 +00:00
2015-12-05 19:41:14 +00:00
_ _out . push ( '</strong> ' ) ;
2016-01-20 19:38:38 +00:00
2015-12-05 19:41:14 +00:00
_ _out . push ( _ _sanitize ( this . time ) ) ;
2016-01-20 19:38:38 +00:00
2015-12-05 19:41:14 +00:00
_ _out . push ( '</div>' ) ;
2016-01-20 19:38:38 +00:00
2015-11-12 15:19:47 +00:00
} ) . call ( this ) ;
2016-01-20 19:38:38 +00:00
2015-11-12 15:19:47 +00:00
} ) . call ( _ _obj ) ;
_ _obj . safe = _ _objSafe , _ _obj . escape = _ _escape ;
return _ _out . join ( '' ) ;
} ;
if ( ! window . zammadChatTemplates ) {
window . zammadChatTemplates = { } ;
}
2015-12-05 19:41:14 +00:00
window . zammadChatTemplates [ "typingIndicator" ] = function ( _ _obj ) {
2015-11-12 15:19:47 +00:00
if ( ! _ _obj ) _ _obj = { } ;
var _ _out = [ ] , _ _capture = function ( callback ) {
var out = _ _out , result ;
_ _out = [ ] ;
callback . call ( this ) ;
result = _ _out . join ( '' ) ;
_ _out = out ;
return _ _safe ( result ) ;
} , _ _sanitize = function ( value ) {
if ( value && value . ecoSafe ) {
return value ;
} else if ( typeof value !== 'undefined' && value != null ) {
return _ _escape ( value ) ;
} else {
return '' ;
}
} , _ _safe , _ _objSafe = _ _obj . safe , _ _escape = _ _obj . escape ;
_ _safe = _ _obj . safe = function ( value ) {
if ( value && value . ecoSafe ) {
return value ;
} else {
if ( ! ( typeof value !== 'undefined' && value != null ) ) value = '' ;
var result = new String ( value ) ;
result . ecoSafe = true ;
return result ;
}
} ;
if ( ! _ _escape ) {
_ _escape = _ _obj . escape = function ( value ) {
return ( '' + value )
. replace ( /&/g , '&' )
. replace ( /</g , '<' )
. replace ( />/g , '>' )
. replace ( /"/g , '"' ) ;
} ;
}
( function ( ) {
( function ( ) {
2015-12-05 19:41:14 +00:00
_ _out . push ( '<div class="zammad-chat-message zammad-chat-message--typing zammad-chat-message--agent">\n <span class="zammad-chat-message-body">\n <span class="zammad-chat-loading-animation">\n <span class="zammad-chat-loading-circle"></span>\n <span class="zammad-chat-loading-circle"></span>\n <span class="zammad-chat-loading-circle"></span>\n </span>\n </span>\n</div>' ) ;
2016-01-20 19:38:38 +00:00
2015-10-15 09:14:19 +00:00
} ) . call ( this ) ;
2016-01-20 19:38:38 +00:00
2015-10-15 09:14:19 +00:00
} ) . call ( _ _obj ) ;
_ _obj . safe = _ _objSafe , _ _obj . escape = _ _escape ;
return _ _out . join ( '' ) ;
} ;
if ( ! window . zammadChatTemplates ) {
window . zammadChatTemplates = { } ;
}
2015-12-05 19:41:14 +00:00
window . zammadChatTemplates [ "waiting" ] = function ( _ _obj ) {
2015-10-15 09:14:19 +00:00
if ( ! _ _obj ) _ _obj = { } ;
var _ _out = [ ] , _ _capture = function ( callback ) {
var out = _ _out , result ;
_ _out = [ ] ;
callback . call ( this ) ;
result = _ _out . join ( '' ) ;
_ _out = out ;
return _ _safe ( result ) ;
} , _ _sanitize = function ( value ) {
if ( value && value . ecoSafe ) {
return value ;
} else if ( typeof value !== 'undefined' && value != null ) {
return _ _escape ( value ) ;
} else {
return '' ;
}
} , _ _safe , _ _objSafe = _ _obj . safe , _ _escape = _ _obj . escape ;
_ _safe = _ _obj . safe = function ( value ) {
if ( value && value . ecoSafe ) {
return value ;
} else {
if ( ! ( typeof value !== 'undefined' && value != null ) ) value = '' ;
var result = new String ( value ) ;
result . ecoSafe = true ;
return result ;
}
} ;
if ( ! _ _escape ) {
_ _escape = _ _obj . escape = function ( value ) {
return ( '' + value )
. replace ( /&/g , '&' )
. replace ( /</g , '<' )
. replace ( />/g , '>' )
. replace ( /"/g , '"' ) ;
} ;
}
( function ( ) {
( function ( ) {
2016-02-08 15:06:56 +00:00
_ _out . push ( '<div class="zammad-chat-modal-text">\n <span class="zammad-chat-loading-animation">\n <span class="zammad-chat-loading-circle"></span>\n <span class="zammad-chat-loading-circle"></span>\n <span class="zammad-chat-loading-circle"></span>\n </span>\n ' ) ;
2016-01-20 19:38:38 +00:00
2016-01-05 12:46:43 +00:00
_ _out . push ( this . T ( 'All colleagues are busy.' ) ) ;
2016-01-20 19:38:38 +00:00
2016-02-08 15:06:56 +00:00
_ _out . push ( '<br>\n ' ) ;
2016-01-20 19:38:38 +00:00
2015-12-05 19:41:14 +00:00
_ _out . push ( this . T ( 'You are on waiting list position <strong>%s</strong>.' , this . position ) ) ;
2016-01-20 19:38:38 +00:00
2016-02-08 15:06:56 +00:00
_ _out . push ( '\n</div>' ) ;
2016-01-20 19:38:38 +00:00
2015-10-15 09:14:19 +00:00
} ) . call ( this ) ;
2016-01-20 19:38:38 +00:00
2015-10-15 09:14:19 +00:00
} ) . call ( _ _obj ) ;
_ _obj . safe = _ _objSafe , _ _obj . escape = _ _escape ;
return _ _out . join ( '' ) ;
} ;
2015-11-02 15:48:16 +00:00
if ( ! window . zammadChatTemplates ) {
window . zammadChatTemplates = { } ;
}
2015-12-05 19:41:14 +00:00
window . zammadChatTemplates [ "waiting_list_timeout" ] = function ( _ _obj ) {
2015-11-02 15:48:16 +00:00
if ( ! _ _obj ) _ _obj = { } ;
var _ _out = [ ] , _ _capture = function ( callback ) {
var out = _ _out , result ;
_ _out = [ ] ;
callback . call ( this ) ;
result = _ _out . join ( '' ) ;
_ _out = out ;
return _ _safe ( result ) ;
} , _ _sanitize = function ( value ) {
if ( value && value . ecoSafe ) {
return value ;
} else if ( typeof value !== 'undefined' && value != null ) {
return _ _escape ( value ) ;
} else {
return '' ;
}
} , _ _safe , _ _objSafe = _ _obj . safe , _ _escape = _ _obj . escape ;
_ _safe = _ _obj . safe = function ( value ) {
if ( value && value . ecoSafe ) {
return value ;
} else {
if ( ! ( typeof value !== 'undefined' && value != null ) ) value = '' ;
var result = new String ( value ) ;
result . ecoSafe = true ;
return result ;
}
} ;
if ( ! _ _escape ) {
_ _escape = _ _obj . escape = function ( value ) {
return ( '' + value )
. replace ( /&/g , '&' )
. replace ( /</g , '<' )
. replace ( />/g , '>' )
. replace ( /"/g , '"' ) ;
} ;
}
( function ( ) {
( function ( ) {
2016-02-08 15:06:56 +00:00
_ _out . push ( '<div class="zammad-chat-modal-text">\n ' ) ;
2016-01-20 19:38:38 +00:00
2015-12-05 19:41:14 +00:00
_ _out . push ( this . T ( 'We are sorry, it takes longer as expected to get an empty slot. Please try again later or send us an email. Thank you!' ) ) ;
2016-01-20 19:38:38 +00:00
2016-02-08 15:06:56 +00:00
_ _out . push ( '\n <br>\n <div class="zammad-chat-button js-restart"' ) ;
2016-01-20 19:38:38 +00:00
2015-12-05 19:41:14 +00:00
if ( this . background ) {
_ _out . push ( _ _sanitize ( " style='background: " + this . background + "'" ) ) ;
}
2016-01-20 19:38:38 +00:00
2015-12-05 19:41:14 +00:00
_ _out . push ( '>' ) ;
2016-01-20 19:38:38 +00:00
2015-12-05 19:41:14 +00:00
_ _out . push ( this . T ( 'Start new conversation' ) ) ;
2016-01-20 19:38:38 +00:00
2016-02-08 15:06:56 +00:00
_ _out . push ( '</div>\n</div>' ) ;
2016-01-20 19:38:38 +00:00
2015-11-02 15:48:16 +00:00
} ) . call ( this ) ;
2016-01-20 19:38:38 +00:00
2015-11-02 15:48:16 +00:00
} ) . call ( _ _obj ) ;
_ _obj . safe = _ _objSafe , _ _obj . escape = _ _escape ;
return _ _out . join ( '' ) ;
} ;