@webex/cc-components 1.28.0-ccwidgets.97 → 1.28.0-ccwidgets.99

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,140 @@
1
+ import { BuddyDetails, ContactServiceQueue, ILogger } from '@webex/cc-store';
2
+ /**
3
+ * Interface for button configuration
4
+ */
5
+ export interface ButtonConfig {
6
+ key: string;
7
+ icon: string;
8
+ onClick: () => void;
9
+ tooltip: string;
10
+ className: string;
11
+ disabled?: boolean;
12
+ shouldShow: boolean;
13
+ }
14
+ /**
15
+ * Interface for list item data
16
+ */
17
+ export interface ListItemData {
18
+ id: string;
19
+ name: string;
20
+ }
21
+ /**
22
+ * Creates the consult button configuration array
23
+ */
24
+ export declare const createConsultButtons: (isMuted: boolean, isMuteDisabled: boolean, consultCompleted: boolean, isAgentBeingConsulted: boolean, isEndConsultEnabled: boolean, muteUnmute: boolean, onTransfer?: () => void, handleConsultMuteToggle?: () => void, handleEndConsult?: () => void) => ButtonConfig[];
25
+ /**
26
+ * Filters buttons that should be visible
27
+ */
28
+ export declare const getVisibleButtons: (buttons: ButtonConfig[]) => ButtonConfig[];
29
+ /**
30
+ * Creates initials from a name string
31
+ */
32
+ export declare const createInitials: (name: string) => string;
33
+ /**
34
+ * Handles transfer button press with logging
35
+ */
36
+ export declare const handleTransferPress: (onTransfer: (() => void) | undefined, logger: ILogger) => void;
37
+ /**
38
+ * Handles end consult button press with logging
39
+ */
40
+ export declare const handleEndConsultPress: (endConsultCall: (() => void) | undefined, logger: ILogger) => void;
41
+ /**
42
+ * Handles mute toggle with disabled state management
43
+ */
44
+ export declare const handleMuteToggle: (onToggleConsultMute: (() => void) | undefined, setIsMuteDisabled: (disabled: boolean) => void, logger: ILogger) => void;
45
+ /**
46
+ * Gets the consult status text based on completion state
47
+ */
48
+ export declare const getConsultStatusText: (consultCompleted: boolean) => string;
49
+ /**
50
+ * Handles list item button press with logging
51
+ */
52
+ export declare const handleListItemPress: (title: string, onButtonPress: () => void, logger: ILogger) => void;
53
+ /**
54
+ * Determines if tabs should be shown based on available data
55
+ */
56
+ export declare const shouldShowTabs: (buddyAgents: BuddyDetails[], queues: ContactServiceQueue[]) => boolean;
57
+ /**
58
+ * Checks if agents list is empty
59
+ */
60
+ export declare const isAgentsEmpty: (buddyAgents: BuddyDetails[]) => boolean;
61
+ /**
62
+ * Checks if queues list is empty
63
+ */
64
+ export declare const isQueuesEmpty: (queues: ContactServiceQueue[]) => boolean;
65
+ /**
66
+ * Handles tab selection with logging
67
+ */
68
+ export declare const handleTabSelection: (key: string, setSelectedTab: (tab: string) => void, logger: ILogger) => void;
69
+ /**
70
+ * Handles agent selection with logging
71
+ */
72
+ export declare const handleAgentSelection: (agentId: string, agentName: string, onAgentSelect: ((agentId: string, agentName: string) => void) | undefined, logger: ILogger) => void;
73
+ /**
74
+ * Handles queue selection with logging
75
+ */
76
+ export declare const handleQueueSelection: (queueId: string, queueName: string, onQueueSelect: ((queueId: string, queueName: string) => void) | undefined, logger: ILogger) => void;
77
+ /**
78
+ * Gets the appropriate empty state message based on context
79
+ */
80
+ export declare const getEmptyStateMessage: (selectedTab: string, showTabs: boolean) => string;
81
+ /**
82
+ * Creates list item data from buddy agents
83
+ */
84
+ export declare const createAgentListData: (buddyAgents: BuddyDetails[]) => ListItemData[];
85
+ /**
86
+ * Creates list item data from queues
87
+ */
88
+ export declare const createQueueListData: (queues: ContactServiceQueue[]) => ListItemData[];
89
+ /**
90
+ * Creates a timer key based on timestamp
91
+ */
92
+ export declare const createTimerKey: (startTimeStamp: number) => string;
93
+ /**
94
+ * Handles popover open with logging
95
+ */
96
+ export declare const handlePopoverOpen: (menuType: string, setActiveMenu: (menu: string) => void, logger: ILogger) => void;
97
+ /**
98
+ * Handles popover close with logging
99
+ */
100
+ export declare const handlePopoverClose: (setActiveMenu: (menu: string | null) => void, logger: ILogger) => void;
101
+ /**
102
+ * Handles hold toggle with logging
103
+ */
104
+ export declare const handleHoldToggle: (toggleHold: (() => void) | undefined, logger: ILogger) => void;
105
+ /**
106
+ * Handles wrapup call with logging
107
+ */
108
+ export declare const handleWrapupCall: (onWrapupCall: (() => void) | undefined, logger: ILogger) => void;
109
+ /**
110
+ * Validates if a menu type is supported
111
+ */
112
+ export declare const isValidMenuType: (menuType: string) => boolean;
113
+ /**
114
+ * Gets button style class based on state
115
+ */
116
+ export declare const getButtonStyleClass: (isActive: boolean, isDisabled: boolean, baseClass?: string) => string;
117
+ /**
118
+ * Formats elapsed time for display
119
+ */
120
+ export declare const formatElapsedTime: (startTime: number) => string;
121
+ /**
122
+ * Checks if an agent is available for selection
123
+ */
124
+ export declare const isAgentAvailable: (agent: BuddyDetails) => boolean;
125
+ /**
126
+ * Checks if a queue is available for selection
127
+ */
128
+ export declare const isQueueAvailable: (queue: ContactServiceQueue) => boolean;
129
+ /**
130
+ * Filters available agents
131
+ */
132
+ export declare const filterAvailableAgents: (agents: BuddyDetails[]) => BuddyDetails[];
133
+ /**
134
+ * Filters available queues
135
+ */
136
+ export declare const filterAvailableQueues: (queues: ContactServiceQueue[]) => ContactServiceQueue[];
137
+ /**
138
+ * Debounces a function call
139
+ */
140
+ export declare const debounce: <T extends (...args: unknown[]) => unknown>(func: T, wait: number) => ((...args: Parameters<T>) => void);
@@ -0,0 +1,58 @@
1
+ import { CallControlMenuType } from '../task.types';
2
+ import type { CallControlButton, ControlVisibility, MEDIA_CHANNEL as MediaChannelType, MediaTypeInfo } from '../task.types';
3
+ import { DestinationType, ILogger, ITask } from '@webex/cc-store';
4
+ /**
5
+ * Handles toggle hold functionality
6
+ */
7
+ export declare const handleToggleHold: (isHeld: boolean, toggleHold: (hold: boolean) => void, setIsHeld: (held: boolean) => void, logger: ILogger) => void;
8
+ /**
9
+ * Handles mute toggle functionality with disabled state management
10
+ */
11
+ export declare const handleMuteToggle: (toggleMute: () => void, setIsMuteButtonDisabled: (disabled: boolean) => void, logger: ILogger) => void;
12
+ /**
13
+ * Handles wrapup call submission
14
+ */
15
+ export declare const handleWrapupCall: (selectedWrapupReason: string | null, selectedWrapupId: string | null, wrapupCall: (reason: string, id: string) => void, setSelectedWrapupReason: (reason: string | null) => void, setSelectedWrapupId: (id: string | null) => void, logger: ILogger) => void;
16
+ /**
17
+ * Handles wrapup reason change
18
+ */
19
+ export declare const handleWrapupChange: (text: string, value: string, setSelectedWrapupReason: (reason: string) => void, setSelectedWrapupId: (id: string) => void) => void;
20
+ /**
21
+ * Handles target selection for consult/transfer
22
+ */
23
+ export declare const handleTargetSelect: (id: string, name: string, type: DestinationType, agentMenuType: CallControlMenuType | null, consultCall: (id: string, type: DestinationType) => void, transferCall: (id: string, type: DestinationType) => void, setConsultAgentId: (id: string) => void, setConsultAgentName: (name: string) => void, setLastTargetType: (type: DestinationType) => void, logger: ILogger) => void;
24
+ /**
25
+ * Gets the media type information
26
+ */
27
+ export declare const getMediaType: (mediaType: MediaChannelType, mediaChannel: MediaChannelType) => MediaTypeInfo;
28
+ /**
29
+ * Checks if the media type is telephony
30
+ */
31
+ export declare const isTelephonyMediaType: (mediaType: MediaChannelType) => boolean;
32
+ /**
33
+ * Builds the call control buttons configuration
34
+ */
35
+ export declare const buildCallControlButtons: (isMuted: boolean, isHeld: boolean, isRecording: boolean, isMuteButtonDisabled: boolean, currentMediaType: MediaTypeInfo, controlVisibility: ControlVisibility, handleMuteToggleFunc: () => void, handleToggleHoldFunc: () => void, toggleRecording: () => void, endCall: () => void) => CallControlButton[];
36
+ /**
37
+ * Filters buttons based on consultation state
38
+ */
39
+ export declare const filterButtonsForConsultation: (buttons: CallControlButton[], consultInitiated: boolean, isTelephony: boolean) => CallControlButton[];
40
+ /**
41
+ * Updates call state from current task data
42
+ */
43
+ export declare const updateCallStateFromTask: (currentTask: ITask, setIsHeld: (held: boolean) => void, setIsRecording: (recording: boolean) => void) => void;
44
+ /**
45
+ * Handles close button press for popover components
46
+ */
47
+ export declare const handleCloseButtonPress: (setShowAgentMenu: (show: boolean) => void, setAgentMenuType: (type: CallControlMenuType | null) => void) => void;
48
+ /**
49
+ * Handles wrapup reason selection change event
50
+ */
51
+ export declare const handleWrapupReasonChange: (event: CustomEvent, wrapupCodes: Array<{
52
+ id: string;
53
+ name: string;
54
+ }> | undefined, handleWrapupChange: (text: string, value: string) => void) => void;
55
+ /**
56
+ * Handles audio element ref assignment
57
+ */
58
+ export declare const handleAudioRef: (audioElement: HTMLAudioElement | null, callControlAudio: MediaStream | null) => void;
@@ -0,0 +1,23 @@
1
+ import { ITask } from '@webex/cc-store';
2
+ export interface IncomingTaskData {
3
+ ani: string;
4
+ customerName: string;
5
+ virtualTeamName: string;
6
+ ronaTimeout: number | null;
7
+ startTimeStamp: number;
8
+ mediaType: string;
9
+ mediaChannel: string;
10
+ isTelephony: boolean;
11
+ isSocial: boolean;
12
+ acceptText: string | undefined;
13
+ declineText: string | undefined;
14
+ title: string;
15
+ disableAccept: boolean;
16
+ }
17
+ /**
18
+ * Extracts and processes all data needed for rendering an incoming task
19
+ * @param incomingTask - The incoming task object
20
+ * @param isBrowser - Whether the device type is browser
21
+ * @returns Processed task data with computed values
22
+ */
23
+ export declare const extractIncomingTaskData: (incomingTask: ITask, isBrowser: boolean) => IncomingTaskData;
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { PressEvent } from '@react-types/shared';
3
3
  import type { MEDIA_CHANNEL as MediaChannelType } from '../task.types';
4
4
  import './styles.scss';
5
- interface TaskProps {
5
+ export interface TaskProps {
6
6
  interactionId?: string;
7
7
  title?: string;
8
8
  state?: string;
@@ -0,0 +1,76 @@
1
+ import type { MEDIA_CHANNEL as MediaChannelType, TaskComponentData } from '../task.types';
2
+ /**
3
+ * Capitalizes the first word of a string
4
+ * @param str - The string to capitalize
5
+ * @returns The string with the first word capitalized
6
+ */
7
+ export declare const capitalizeFirstWord: (str: string) => string;
8
+ /**
9
+ * Gets the correct CSS class name for the task title
10
+ * @param isNonVoiceMedia - Whether the media type is non-voice
11
+ * @param isIncomingTask - Whether this is an incoming task
12
+ * @returns The appropriate CSS class name
13
+ */
14
+ export declare const getTitleClassName: (isNonVoiceMedia: boolean, isIncomingTask: boolean) => string;
15
+ /**
16
+ * Creates unique IDs for tooltip elements
17
+ * @param interactionId - The interaction ID
18
+ * @returns Object with tooltip trigger and tooltip IDs
19
+ */
20
+ export declare const createTooltipIds: (interactionId?: string) => {
21
+ tooltipTriggerId: string;
22
+ tooltipId: string;
23
+ };
24
+ /**
25
+ * Determines if the state should be shown
26
+ * @param state - The task state
27
+ * @param isIncomingTask - Whether this is an incoming task
28
+ * @returns Whether to show the state
29
+ */
30
+ export declare const shouldShowState: (state?: string, isIncomingTask?: boolean) => boolean;
31
+ /**
32
+ * Determines if the queue should be shown
33
+ * @param queue - The queue name
34
+ * @param isIncomingTask - Whether this is an incoming task
35
+ * @returns Whether to show the queue
36
+ */
37
+ export declare const shouldShowQueue: (queue?: string, isIncomingTask?: boolean) => boolean;
38
+ /**
39
+ * Determines if handle time should be shown
40
+ * @param isIncomingTask - Whether this is an incoming task
41
+ * @param ronaTimeout - The RONA timeout value
42
+ * @param startTimeStamp - The start timestamp
43
+ * @returns Whether to show handle time
44
+ */
45
+ export declare const shouldShowHandleTime: (isIncomingTask?: boolean, ronaTimeout?: number, startTimeStamp?: number) => boolean;
46
+ /**
47
+ * Determines if time left should be shown
48
+ * @param isIncomingTask - Whether this is an incoming task
49
+ * @param ronaTimeout - The RONA timeout value
50
+ * @returns Whether to show time left
51
+ */
52
+ export declare const shouldShowTimeLeft: (isIncomingTask?: boolean, ronaTimeout?: number) => boolean;
53
+ /**
54
+ * Gets the task list item CSS classes
55
+ * @param selected - Whether the task is selected
56
+ * @param styles - Additional styles
57
+ * @returns The combined CSS class string
58
+ */
59
+ export declare const getTaskListItemClasses: (selected?: boolean, styles?: string) => string;
60
+ /**
61
+ * Extracts and processes all data needed for rendering the Task component
62
+ * @param props - The Task component props
63
+ * @returns Processed task data with computed values
64
+ */
65
+ export declare const extractTaskComponentData: ({ mediaType, mediaChannel, isIncomingTask, interactionId, state, queue, ronaTimeout, startTimeStamp, }: {
66
+ mediaType?: MediaChannelType;
67
+ mediaChannel?: MediaChannelType;
68
+ isIncomingTask?: boolean;
69
+ interactionId?: string;
70
+ state?: string;
71
+ queue?: string;
72
+ ronaTimeout?: number;
73
+ startTimeStamp?: number;
74
+ acceptText?: string;
75
+ declineText?: string;
76
+ }) => TaskComponentData;
@@ -0,0 +1,45 @@
1
+ import { TaskListItemData } from '../task.types';
2
+ import { ITask } from '@webex/cc-store';
3
+ /**
4
+ * Extracts and processes data from a task for rendering in the task list
5
+ * @param task - The task object
6
+ * @param isBrowser - Whether the device type is browser
7
+ * @returns Processed task data with computed values
8
+ */
9
+ export declare const extractTaskListItemData: (task: ITask, isBrowser: boolean) => TaskListItemData;
10
+ /**
11
+ * Determines if a task should be selectable
12
+ * @param task - The task object
13
+ * @param currentTask - The currently selected task
14
+ * @param taskData - Processed task data
15
+ * @returns Whether the task should be selectable
16
+ */
17
+ export declare const isTaskSelectable: (task: ITask, currentTask: ITask | null, taskData: TaskListItemData) => boolean;
18
+ /**
19
+ * Determines if the current task is selected
20
+ * @param task - The task object
21
+ * @param currentTask - The currently selected task
22
+ * @returns Whether this task is currently selected
23
+ */
24
+ export declare const isCurrentTaskSelected: (task: ITask, currentTask: ITask | null) => boolean;
25
+ /**
26
+ * Validates if a task list is empty or invalid
27
+ * @param taskList - The task list object
28
+ * @returns Whether the task list is empty or invalid
29
+ */
30
+ export declare const isTaskListEmpty: (taskList: Record<string, ITask> | null | undefined) => boolean;
31
+ /**
32
+ * Gets tasks as an array from the task list object
33
+ * @param taskList - The task list object
34
+ * @returns Array of tasks
35
+ */
36
+ export declare const getTasksArray: (taskList: Record<string, ITask> | null | undefined) => ITask[];
37
+ /**
38
+ * Creates task select handler with logging
39
+ * @param task - The task to select
40
+ * @param currentTask - The currently selected task
41
+ * @param onTaskSelect - The task select function
42
+ * @param logger - The logger instance
43
+ * @returns Task select handler function
44
+ */
45
+ export declare const createTaskSelectHandler: (task: ITask, currentTask: ITask | null, onTaskSelect: (task: ITask) => void) => () => void;
@@ -96,8 +96,8 @@ export interface TaskProps {
96
96
  */
97
97
  logger: ILogger;
98
98
  }
99
- export type IncomingTaskComponentProps = Pick<TaskProps, 'incomingTask' | 'isBrowser' | 'accept' | 'reject' | 'logger'>;
100
- export type TaskListComponentProps = Pick<TaskProps, 'currentTask' | 'taskList' | 'isBrowser' | 'acceptTask' | 'declineTask' | 'onTaskSelect' | 'logger'>;
99
+ export type IncomingTaskComponentProps = Pick<TaskProps, 'isBrowser' | 'accept' | 'reject'> & Partial<Pick<TaskProps, 'incomingTask'>>;
100
+ export type TaskListComponentProps = Pick<TaskProps, 'isBrowser' | 'acceptTask' | 'declineTask' | 'onTaskSelect' | 'logger'> & Partial<Pick<TaskProps, 'currentTask' | 'taskList'>>;
101
101
  /**
102
102
  * Interface representing the properties for control actions on a task.
103
103
  */
@@ -437,4 +437,89 @@ export interface AutoWrapupTimerProps {
437
437
  allowCancelAutoWrapup?: boolean;
438
438
  handleCancelWrapup: () => void;
439
439
  }
440
+ export interface CallControlButton {
441
+ id: string;
442
+ icon: string;
443
+ onClick?: () => void;
444
+ tooltip: string;
445
+ className: string;
446
+ disabled: boolean;
447
+ isVisible: boolean;
448
+ menuType?: CallControlMenuType;
449
+ dataTestId?: string;
450
+ }
451
+ export interface ControlVisibility {
452
+ accept: boolean;
453
+ decline: boolean;
454
+ end: boolean;
455
+ muteUnmute: boolean;
456
+ holdResume: boolean;
457
+ consult: boolean;
458
+ transfer: boolean;
459
+ conference: boolean;
460
+ wrapup: boolean;
461
+ pauseResumeRecording: boolean;
462
+ endConsult: boolean;
463
+ recordingIndicator: boolean;
464
+ }
465
+ export interface MediaTypeInfo {
466
+ labelName: string;
467
+ }
468
+ export interface TaskComponentData {
469
+ currentMediaType: {
470
+ labelName: string;
471
+ iconName: string;
472
+ className: string;
473
+ isBrandVisual: boolean;
474
+ };
475
+ isNonVoiceMedia: boolean;
476
+ tooltipTriggerId: string;
477
+ tooltipId: string;
478
+ titleClassName: string;
479
+ shouldShowState: boolean;
480
+ shouldShowQueue: boolean;
481
+ shouldShowHandleTime: boolean;
482
+ shouldShowTimeLeft: boolean;
483
+ capitalizedState: string;
484
+ capitalizedQueue: string;
485
+ }
486
+ export interface TaskListItemData {
487
+ ani: string;
488
+ customerName: string;
489
+ virtualTeamName: string;
490
+ ronaTimeout: number | null;
491
+ taskState: string;
492
+ startTimeStamp: number;
493
+ isIncomingTask: boolean;
494
+ mediaType: string;
495
+ mediaChannel: string;
496
+ isTelephony: boolean;
497
+ isSocial: boolean;
498
+ acceptText: string | undefined;
499
+ declineText: string | undefined;
500
+ title: string;
501
+ disableAccept: boolean;
502
+ displayState: string;
503
+ }
504
+ export declare enum TaskState {
505
+ NEW = "new",
506
+ ACTIVE = "active",
507
+ CONNECTED = "connected",
508
+ HOLD = "hold",
509
+ CONSULT = "consult",
510
+ CONFERENCE = "conference",
511
+ WRAP_UP = "wrap_up",
512
+ ENDED = "ended",
513
+ TRANSFERRED = "transferred",
514
+ DECLINED = "declined"
515
+ }
516
+ export declare enum TaskQueue {
517
+ SUPPORT = "support",
518
+ SALES = "sales",
519
+ TECHNICAL = "technical",
520
+ BILLING = "billing",
521
+ GENERAL = "general",
522
+ VIP = "vip",
523
+ ESCALATION = "escalation"
524
+ }
440
525
  export {};