11import React from 'react' ;
22import CallControlComponent from '../CallControl/call-control' ;
33import { Text } from '@momentum-ui/react-collaboration' ;
4- import { Brandvisual , Icon } from '@momentum-design/components/dist/react' ;
4+ import { Brandvisual , Icon , Tooltip } from '@momentum-design/components/dist/react' ;
55import './call-control-cad.styles.scss' ;
66import TaskTimer from '../TaskTimer/index' ;
77import CallControlConsultComponent from '../CallControl/CallControlCustom/call-control-consult' ;
@@ -60,6 +60,87 @@ const CallControlCADComponent: React.FC<CallControlComponentProps> = (props) =>
6060 const customerName = currentTask ?. data ?. interaction ?. callAssociatedDetails ?. customerName ;
6161 const ani = currentTask ?. data ?. interaction ?. callAssociatedDetails ?. ani ;
6262
63+ // Create unique IDs for tooltips
64+ const customerNameTriggerId = `customer-name-trigger-${ currentTask . data . interaction . interactionId } ` ;
65+ const customerNameTooltipId = `customer-name-tooltip-${ currentTask . data . interaction . interactionId } ` ;
66+ const phoneNumberTriggerId = `phone-number-trigger-${ currentTask . data . interaction . interactionId } ` ;
67+ const phoneNumberTooltipId = `phone-number-tooltip-${ currentTask . data . interaction . interactionId } ` ;
68+
69+ const renderCustomerName = ( ) => {
70+ const customerText = isSocial ? customerName || NO_CUSTOMER_NAME : ani || NO_CALLER_ID ;
71+
72+ const textComponent = (
73+ < Text
74+ className = { ! isTelephony ? 'digital-customer-name' : 'voice-customer-name' }
75+ type = "body-large-bold"
76+ tagName = { 'p' }
77+ id = { ! isTelephony ? customerNameTriggerId : undefined }
78+ >
79+ { customerText }
80+ </ Text >
81+ ) ;
82+
83+ if ( ! isTelephony ) {
84+ return (
85+ < >
86+ { textComponent }
87+ < Tooltip
88+ color = "contrast"
89+ delay = "0,0"
90+ id = { customerNameTooltipId }
91+ placement = "top-start"
92+ offset = { 4 }
93+ tooltip-type = "description"
94+ triggerID = { customerNameTriggerId }
95+ className = "call-control-task-tooltip"
96+ >
97+ < Text tagName = "small" > { customerText } </ Text >
98+ </ Tooltip >
99+ </ >
100+ ) ;
101+ }
102+
103+ return textComponent ;
104+ } ;
105+
106+ const renderPhoneNumber = ( ) => {
107+ const phoneText = isSocial ? customerName || NO_CUSTOMER_NAME : ani || NO_PHONE_NUMBER ;
108+ const labelText = isSocial ? CUSTOMER_NAME : PHONE_NUMBER ;
109+
110+ const textComponent = (
111+ < Text
112+ className = { ! isTelephony ? 'digital-phone-number' : 'voice-phone-number' }
113+ type = "body-secondary"
114+ tagName = { 'p' }
115+ id = { ! isTelephony ? phoneNumberTriggerId : undefined }
116+ >
117+ < strong > { labelText } </ strong > < span > { phoneText } </ span >
118+ </ Text >
119+ ) ;
120+
121+ if ( ! isTelephony ) {
122+ return (
123+ < >
124+ { textComponent }
125+ < Tooltip
126+ color = "contrast"
127+ delay = "0,0"
128+ id = { phoneNumberTooltipId }
129+ placement = "top-start"
130+ offset = { 4 }
131+ tooltip-type = "description"
132+ triggerID = { phoneNumberTriggerId }
133+ className = "call-control-task-tooltip"
134+ >
135+ < Text tagName = "small" > { phoneText } </ Text >
136+ </ Tooltip >
137+ </ >
138+ ) ;
139+ }
140+
141+ return textComponent ;
142+ } ;
143+
63144 if ( ! currentTask ) return null ;
64145
65146 return (
@@ -76,9 +157,7 @@ const CallControlCADComponent: React.FC<CallControlComponentProps> = (props) =>
76157 </ div >
77158
78159 < div className = "customer-info" >
79- < Text className = "customer-id" type = "body-large-bold" tagName = { 'small' } >
80- { isSocial ? customerName || NO_CUSTOMER_NAME : ani || NO_CALLER_ID }
81- </ Text >
160+ { renderCustomerName ( ) }
82161 < div className = "call-details" >
83162 < Text className = "call-timer" type = "body-secondary" tagName = { 'small' } >
84163 { currentMediaType . labelName } - < TaskTimer startTimeStamp = { startTimestamp } />
@@ -110,10 +189,7 @@ const CallControlCADComponent: React.FC<CallControlComponentProps> = (props) =>
110189 < strong > { QUEUE } </ strong > { ' ' }
111190 < span > { currentTask ?. data ?. interaction ?. callAssociatedDetails ?. virtualTeamName || NO_TEAM_NAME } </ span >
112191 </ Text >
113- < Text className = "phone-number" type = "body-secondary" tagName = { 'small' } >
114- < strong > { isSocial ? CUSTOMER_NAME : PHONE_NUMBER } </ strong > { ' ' }
115- < span > { isSocial ? customerName || NO_CUSTOMER_NAME : ani || NO_PHONE_NUMBER } </ span >
116- </ Text >
192+ { renderPhoneNumber ( ) }
117193 < Text className = "rona" type = "body-secondary" tagName = { 'small' } >
118194 < strong > { RONA } </ strong > { ' ' }
119195 < span > { currentTask ?. data ?. interaction ?. callAssociatedDetails ?. ronaTimeout || NO_RONA } </ span >
0 commit comments