function run_chat_handler() {
  IOracleChatClient.getAgentSession()
    .then((session) => {
    console.log("Got the session");
      console.log(session.getConfig());
      return session.getConfig();
    })
    .then((config) => {
      //hides the transfer button on chats.
      return config.hideTransferButton();
    })
    .catch((ex) => {
      console.log("Failed to get session");
      console.log(ex);
    });
}

function main(){
  ORACLE_SERVICE_CLOUD.extension_loader.load("disableChatTransfer", "1")
    .then(function(extensionProvider) {
      extensionProvider.getGlobalContext().then(function(globalContext) {
        globalContext.getChatAPIInfo().then(function(chatAPIInfo) {

          ORACLE_SERVICE_CLOUD.scriptLoader.loadScript([chatAPIInfo.getChatAPIURL()]).then(() => {
            //have to let the scriptloader laod the script.
            setTimeout(() => {
              run_chat_handler()
               }, 5000);

            }
          )

        }).catch(function(err) {
          console.log(err)
        });
      });
    });
  }

main()
