 kd                     = require 'kd'
 whoami                 = require 'app/util/whoami'
 getFullnameFromAccount = require 'app/util/getFullnameFromAccount'
-globals                = require 'globals'
+getChatlioKey          = require 'app/util/getChatlioKey'
 
-KODING_CHATLIO_KEY     = 'ae02da65-1664-4e7b-49c8-31abedbb80ed'
+shouldTalkToKodingSupport = no
 
 bootChatlio = (id, team) ->
 


    c.parentNode.insertBefore n, c

    shouldTalkToKoding = id is KODING_CHATLIO_KEY

    # configure the client so it doesn't look shitty
    _chatlio.configure
      titleColor                : '#01AF5B'
      titleFontColor            : '#fff'
      onlineTitle               : 'How can we help you?'
      offlineTitle              : 'Contact Us'
      agentLabel                : if shouldTalkToKoding then 'Koding Support' else "#{team.title} Support"
      browserSideAuthorLabel    : 'You'
      onlineMessagePlaceholder  : 'Type message here...'
      offlineGreeting           : 'Sorry we are away, but we would love to hear from you and chat soon!'


module.exports = setupChatlio = ->

  getChatlioKey (chatlioId, isAdmin) ->

    team = kd.singletons.groupsController.getCurrentGroup()
    shouldTalkToKodingSupport = isAdmin

    return  unless chatlioId

