All files / temba-components/src/webchat index.ts

75% Statements 21/28
66.66% Branches 2/3
100% Functions 1/1
75% Lines 21/28

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 2957x 57x 57x 57x 57x 57x 57x 57x 57x 57x 57x 57x 57x 57x 57x 57x 1x 1x 1x 1x               1x  
import { User } from '../interfaces';
 
export const SVG_FINGERPRINT = 'febafb41c2fd60efa2bdaead993c7087';
 
// webchat spritesheet
export enum WebChatIcon {
  send = 'send-03',
  attachment = 'paperclip',
  attachment_audio = 'volume-min',
  attachment_document = 'file-06',
  attachment_image = 'image-01',
  attachment_location = 'marker-pin-01',
  attachment_video = 'video-recorder'
}
 
export const getUserDisplay = (user: User) => {
  if (user) {
    if (user.first_name && user.last_name) {
      return `${user.first_name} ${user.last_name}`;
    }

    if (user.first_name) {
      return user.first_name;
    }

    return user.email;
  }
};