chatSession.incomingItemDecorator = function()

in customer/src/customer/index.js [111:130]


  chatSession.incomingItemDecorator = function(item) {
    if (['SYSTEM_MESSAGE'].indexOf(item.displayName) !== -1) {
      item.displayName = 'System Message';
    }
    if (chatSession.transcript.length > 0) {
      var transcriptItem = chatSession.transcript[chatSession.transcript.length - 1];
      if (transcriptItem.transportDetails.direction === 'Incoming') {
        var chatDescription = 'This is a demo of a customer chat experience.';
        var name = transcriptItem.displayName;
        if (
          ['prod', '$LATEST', 'AI Assistant', 'SYSTEM_MESSAGE', 'System Message'].indexOf(name) ===
          -1
        ) {
          chatDescription = 'You are now chatting with ' + name;
        }
        document.getElementById('chatDescription').innerHTML = chatDescription;
      }
    }
    return item;
  };