File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2727 flex-flow : row wrap ;
2828 justify-content : space-between ;
2929 width : 100% ;
30- max-height : 180 px ;
30+ max-height : 11.25 rem ;
3131 overflow-y : auto ;
3232 margin-top : 0.75rem ;
3333
3737 box-sizing : border-box ;
3838 padding : 0.125rem 0 ;
3939 line-height : 1.75rem ;
40-
41- .global-variable-label {
42- display : block ;
43- font-size : 0.875rem ;
44- font-weight : bold ;
45- color : var (--mds-color-theme-text-secondary-normal );
46- overflow : hidden ;
47- white-space : nowrap ;
48- text-overflow : ellipsis ;
49- }
50-
51- .global-variable-value {
52- display : block ;
53- font-size : 0.875rem ;
54- font-weight : 250 ;
55- color : var (--mds-color-theme-text-primary-normal );
56- word-break : break-word ;
57- }
5840 }
5941}
6042
Original file line number Diff line number Diff line change @@ -10,8 +10,8 @@ import {
1010 CallControlComponentProps ,
1111 getCallerIdentifier ,
1212 CallAssociatedDataMap ,
13- getAgentViewableGlobalVariables ,
1413} from '../task.types' ;
14+ import { getAgentViewableGlobalVariables } from '../Task/task.utils' ;
1515
1616import { getMediaTypeInfo } from '../../../utils' ;
1717import {
@@ -293,8 +293,12 @@ const CallControlCADComponent: React.FC<CallControlComponentProps> = (props) =>
293293 className = "global-variable-item"
294294 data-testid = { `cc-cad:global-var-${ variable . name } ` }
295295 >
296- < span className = "global-variable-label" > { variable . displayName || variable . name } </ span >
297- < span className = "global-variable-value" > { variable . value || '' } </ span >
296+ < Text type = "body-secondary" tagName = { 'small' } >
297+ { variable . displayName || variable . name }
298+ </ Text >
299+ < Text type = "body-secondary" tagName = { 'small' } >
300+ { variable . value || '' }
301+ </ Text >
298302 </ div >
299303 ) ) }
300304 </ div >
Original file line number Diff line number Diff line change 1- import type { MEDIA_CHANNEL as MediaChannelType , TaskComponentData } from '../task.types' ;
1+ import type {
2+ MEDIA_CHANNEL as MediaChannelType ,
3+ TaskComponentData ,
4+ CADVariable ,
5+ CallAssociatedDataMap ,
6+ } from '../task.types' ;
27import { getMediaTypeInfo } from '../../../utils' ;
38
9+ /** System CAD variable keys that are already displayed elsewhere in the UI. */
10+ export const SYSTEM_CAD_KEYS = new Set ( [
11+ 'ani' ,
12+ 'dn' ,
13+ 'customerName' ,
14+ 'virtualTeamName' ,
15+ 'ronaTimeout' ,
16+ 'FC-DESKTOP-VIEW' ,
17+ ] ) ;
18+
19+ /**
20+ * Returns agent-viewable global variables from a callAssociatedData map,
21+ * excluding system variables that are already rendered elsewhere.
22+ */
23+ export const getAgentViewableGlobalVariables = (
24+ callAssociatedData : CallAssociatedDataMap | undefined
25+ ) : CADVariable [ ] => {
26+ if ( ! callAssociatedData || typeof callAssociatedData !== 'object' ) {
27+ return [ ] ;
28+ }
29+
30+ return Object . entries ( callAssociatedData )
31+ . filter ( ( [ key , cadVar ] ) => {
32+ if ( ! cadVar || ! cadVar . name ) return false ;
33+ if ( cadVar . agentViewable === false ) return false ;
34+ if ( ! cadVar . global ) return false ;
35+ if ( SYSTEM_CAD_KEYS . has ( key ) ) return false ;
36+ return true ;
37+ } )
38+ . map ( ( [ , cadVar ] ) => cadVar ) ;
39+ } ;
40+
441/**
542 * Capitalizes the first word of a string
643 * @param str - The string to capitalize
Original file line number Diff line number Diff line change @@ -39,38 +39,6 @@ export interface CADVariable {
3939 */
4040export type CallAssociatedDataMap = Record < string , CADVariable > ;
4141
42- /** System CAD variable keys that are already displayed elsewhere in the UI. */
43- export const SYSTEM_CAD_KEYS = new Set ( [
44- 'ani' ,
45- 'dn' ,
46- 'customerName' ,
47- 'virtualTeamName' ,
48- 'ronaTimeout' ,
49- 'FC-DESKTOP-VIEW' ,
50- ] ) ;
51-
52- /**
53- * Returns agent-viewable global variables from a callAssociatedData map,
54- * excluding system variables that are already rendered elsewhere.
55- */
56- export const getAgentViewableGlobalVariables = (
57- callAssociatedData : CallAssociatedDataMap | undefined
58- ) : CADVariable [ ] => {
59- if ( ! callAssociatedData || typeof callAssociatedData !== 'object' ) {
60- return [ ] ;
61- }
62-
63- return Object . entries ( callAssociatedData )
64- . filter ( ( [ key , cadVar ] ) => {
65- if ( ! cadVar || ! cadVar . name ) return false ;
66- if ( cadVar . agentViewable === false ) return false ;
67- if ( ! cadVar . global ) return false ;
68- if ( SYSTEM_CAD_KEYS . has ( key ) ) return false ;
69- return true ;
70- } )
71- . map ( ( [ , cadVar ] ) => cadVar ) ;
72- } ;
73-
7442/**
7543 * Target types for consult/transfer operations
7644 */
Original file line number Diff line number Diff line change 77 OUTBOUND_TYPE ,
88 CallAssociatedDataMap ,
99} from '../../../../src/components/task/task.types' ;
10- import { mockTask } from '@webex/test-fixtures' ;
10+ import { mockTask , mockCallAssociatedData } from '@webex/test-fixtures' ;
1111import { BuddyDetails } from '@webex/cc-store' ;
1212import '@testing-library/jest-dom' ;
1313
@@ -377,57 +377,6 @@ describe('CallControlCADComponent', () => {
377377 } ) ;
378378
379379 describe ( 'Global Variables' , ( ) => {
380- const mockCallAssociatedData : CallAssociatedDataMap = {
381- Global_Language : {
382- name : 'Global_Language' ,
383- displayName : 'Customer Language' ,
384- value : 'English' ,
385- type : 'STRING' ,
386- agentEditable : false ,
387- agentViewable : true ,
388- global : true ,
389- isSecure : false ,
390- secureKeyId : '' ,
391- secureKeyVersion : 0 ,
392- } ,
393- Global_FeedbackSurveyOptIn : {
394- name : 'Global_FeedbackSurveyOptIn' ,
395- displayName : 'Post Call Survey Opt-in' ,
396- value : 'true' ,
397- type : 'STRING' ,
398- agentEditable : false ,
399- agentViewable : true ,
400- global : true ,
401- isSecure : false ,
402- secureKeyId : '' ,
403- secureKeyVersion : 0 ,
404- } ,
405- ani : {
406- name : 'ani' ,
407- displayName : 'ani' ,
408- value : '555-123-4567' ,
409- type : 'STRING' ,
410- agentEditable : false ,
411- agentViewable : true ,
412- global : false ,
413- isSecure : false ,
414- secureKeyId : '' ,
415- secureKeyVersion : 0 ,
416- } ,
417- Global_Hidden : {
418- name : 'Global_Hidden' ,
419- displayName : 'Hidden Variable' ,
420- value : 'secret' ,
421- type : 'STRING' ,
422- agentEditable : false ,
423- agentViewable : false ,
424- global : true ,
425- isSecure : false ,
426- secureKeyId : '' ,
427- secureKeyVersion : 0 ,
428- } ,
429- } ;
430-
431380 const makePropsWithCallAssociatedData = ( callAssociatedData : CallAssociatedDataMap ) => ( {
432381 ...defaultProps ,
433382 currentTask : {
Original file line number Diff line number Diff line change 1- import {
2- getAgentViewableGlobalVariables ,
3- CallAssociatedDataMap ,
4- SYSTEM_CAD_KEYS ,
5- } from '../../../src/components/task/task.types' ;
1+ import { CallAssociatedDataMap } from '../../../src/components/task/task.types' ;
2+ import { getAgentViewableGlobalVariables , SYSTEM_CAD_KEYS } from '../../../src/components/task/Task/task.utils' ;
63
74describe ( 'getAgentViewableGlobalVariables' , ( ) => {
85 const makeGlobalVar = (
Original file line number Diff line number Diff line change @@ -514,6 +514,71 @@ const mockCC: IContactCenter = {
514514 getAccessToken : jest . fn ( ) . mockResolvedValue ( 'mock-access-token' ) ,
515515} ;
516516
517+ const mockCallAssociatedData : Record <
518+ string ,
519+ {
520+ name : string ;
521+ displayName : string ;
522+ value : string ;
523+ type : string ;
524+ agentEditable : boolean ;
525+ agentViewable : boolean ;
526+ global : boolean ;
527+ isSecure : boolean ;
528+ secureKeyId : string ;
529+ secureKeyVersion : number ;
530+ }
531+ > = {
532+ Global_Language : {
533+ name : 'Global_Language' ,
534+ displayName : 'Customer Language' ,
535+ value : 'English' ,
536+ type : 'STRING' ,
537+ agentEditable : false ,
538+ agentViewable : true ,
539+ global : true ,
540+ isSecure : false ,
541+ secureKeyId : '' ,
542+ secureKeyVersion : 0 ,
543+ } ,
544+ Global_FeedbackSurveyOptIn : {
545+ name : 'Global_FeedbackSurveyOptIn' ,
546+ displayName : 'Post Call Survey Opt-in' ,
547+ value : 'true' ,
548+ type : 'STRING' ,
549+ agentEditable : false ,
550+ agentViewable : true ,
551+ global : true ,
552+ isSecure : false ,
553+ secureKeyId : '' ,
554+ secureKeyVersion : 0 ,
555+ } ,
556+ ani : {
557+ name : 'ani' ,
558+ displayName : 'ani' ,
559+ value : '555-123-4567' ,
560+ type : 'STRING' ,
561+ agentEditable : false ,
562+ agentViewable : true ,
563+ global : false ,
564+ isSecure : false ,
565+ secureKeyId : '' ,
566+ secureKeyVersion : 0 ,
567+ } ,
568+ Global_Hidden : {
569+ name : 'Global_Hidden' ,
570+ displayName : 'Hidden Variable' ,
571+ value : 'secret' ,
572+ type : 'STRING' ,
573+ agentEditable : false ,
574+ agentViewable : false ,
575+ global : true ,
576+ isSecure : false ,
577+ secureKeyId : '' ,
578+ secureKeyVersion : 0 ,
579+ } ,
580+ } ;
581+
517582export {
518583 mockProfile ,
519584 mockCC ,
@@ -523,4 +588,5 @@ export {
523588 mockEntryPointsResponse ,
524589 mockAddressBookEntriesResponse ,
525590 makeMockAddressBook ,
591+ mockCallAssociatedData ,
526592} ;
You can’t perform that action at this time.
0 commit comments