@webex/cc-task 1.28.0-task-refactor.1 → 1.28.0-task-refactor.2
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,20 @@
|
|
|
1
|
+
import { ITask } from '@webex/cc-store';
|
|
2
|
+
import { Interaction, TaskUIControls } from '@webex/contact-center';
|
|
3
|
+
export type MainCadHoldInputs = {
|
|
4
|
+
currentTask: ITask | null;
|
|
5
|
+
controls: TaskUIControls;
|
|
6
|
+
agentId?: string;
|
|
7
|
+
holdDataVersion?: number;
|
|
8
|
+
};
|
|
9
|
+
export type MainCadHoldResult = {
|
|
10
|
+
isHeld: boolean;
|
|
11
|
+
interaction: Interaction | undefined;
|
|
12
|
+
holdTimestampMs: number | null;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Single source of truth for main CAD "On Hold" chip + timer inputs.
|
|
16
|
+
*
|
|
17
|
+
* Covers: simple consult (Agent 2), EP/DN consult, conference nested consult,
|
|
18
|
+
* plain conference hold, and refresh timer continuity (via resolveMainCadHoldTimestampMs).
|
|
19
|
+
*/
|
|
20
|
+
export declare function deriveMainCadHoldState({ currentTask, controls, agentId, holdDataVersion, }: MainCadHoldInputs): MainCadHoldResult;
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
import { Interaction } from '@webex/contact-center';
|
|
2
|
+
type ConsultMediaEntry = {
|
|
3
|
+
holdTimestamp?: number | null;
|
|
4
|
+
};
|
|
5
|
+
export declare const getHoldAnchorStorageKey: (interactionId: string) => string;
|
|
6
|
+
export declare const getConsultHoldAnchorStorageKey: (interactionId: string) => string;
|
|
7
|
+
export declare const normalizeHoldTimestampMs: (raw: number) => number;
|
|
8
|
+
export declare const readHoldAnchor: (interactionId: string | undefined) => number | null;
|
|
9
|
+
export declare const writeHoldAnchor: (interactionId: string | undefined, timestampMs: number) => void;
|
|
10
|
+
export declare const clearHoldAnchor: (interactionId: string | undefined) => void;
|
|
11
|
+
export declare const readConsultHoldAnchor: (interactionId: string | undefined) => number | null;
|
|
12
|
+
export declare const writeConsultHoldAnchor: (interactionId: string | undefined, timestampMs: number) => void;
|
|
13
|
+
export declare const clearConsultHoldAnchor: (interactionId: string | undefined) => void;
|
|
2
14
|
/**
|
|
3
15
|
* Finds the hold timestamp for a specific media type from an interaction.
|
|
4
16
|
* Used by useHoldTimer for hold duration display.
|
|
@@ -7,3 +19,13 @@ import { Interaction } from '@webex/contact-center';
|
|
|
7
19
|
* This one takes Interaction directly.
|
|
8
20
|
*/
|
|
9
21
|
export declare function findHoldTimestamp(interaction: Interaction, mType?: string): number | null;
|
|
22
|
+
/**
|
|
23
|
+
* Resolve main CAD hold timer anchor in milliseconds.
|
|
24
|
+
* Prefers interaction media; falls back to session anchor for refresh continuity.
|
|
25
|
+
*/
|
|
26
|
+
export declare function resolveMainCadHoldTimestampMs(interaction: Interaction | undefined, isHeld: boolean, interactionId?: string): number | null;
|
|
27
|
+
/**
|
|
28
|
+
* Resolve consult-leg hold timer anchor in milliseconds (Agent 1 initiator CAD).
|
|
29
|
+
*/
|
|
30
|
+
export declare function resolveConsultHoldTimestampMs(consultMedia: ConsultMediaEntry | null | undefined, interactionId?: string): number;
|
|
31
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ITask, TaskUIControls } from '@webex/cc-store';
|
|
2
|
+
import { Interaction } from '@webex/contact-center';
|
|
2
3
|
/**
|
|
3
4
|
* Timer data structure containing label and timestamp
|
|
4
5
|
*/
|
|
@@ -6,14 +7,39 @@ export interface TimerData {
|
|
|
6
7
|
label: string | null;
|
|
7
8
|
timestamp: number;
|
|
8
9
|
}
|
|
10
|
+
type MediaEntry = {
|
|
11
|
+
mType?: string;
|
|
12
|
+
isHold?: boolean;
|
|
13
|
+
holdTimestamp?: number | null;
|
|
14
|
+
lastUpdated?: number;
|
|
15
|
+
joinTimestamp?: number;
|
|
16
|
+
eventTime?: number;
|
|
17
|
+
createdAt?: number;
|
|
18
|
+
mediaResourceId?: string;
|
|
19
|
+
participants?: string[];
|
|
20
|
+
};
|
|
21
|
+
type InteractionParticipant = {
|
|
22
|
+
consultTimestamp?: number;
|
|
23
|
+
lastUpdated?: number;
|
|
24
|
+
consultState?: string;
|
|
25
|
+
isConsulted?: boolean;
|
|
26
|
+
isWrapUp?: boolean;
|
|
27
|
+
wrapUpTimestamp?: number | null;
|
|
28
|
+
currentState?: string | null;
|
|
29
|
+
currentStateTimestamp?: number | null;
|
|
30
|
+
};
|
|
31
|
+
type InteractionWithMedia = Interaction & {
|
|
32
|
+
media?: Record<string, MediaEntry>;
|
|
33
|
+
participants?: Record<string, InteractionParticipant>;
|
|
34
|
+
};
|
|
9
35
|
/**
|
|
10
36
|
* Find the latest (most recently added) consult media from the interaction.
|
|
11
37
|
*
|
|
12
38
|
* After transfer → re-consult the backend may leave the OLD consult media
|
|
13
|
-
* in the interaction alongside the NEW one.
|
|
14
|
-
*
|
|
39
|
+
* in the interaction alongside the NEW one. Prefer held consult entries when
|
|
40
|
+
* present (switch-to-main), otherwise pick the most recent consult leg.
|
|
15
41
|
*/
|
|
16
|
-
export declare function findLatestConsultMedia(interaction:
|
|
42
|
+
export declare function findLatestConsultMedia(interaction: InteractionWithMedia | undefined): MediaEntry | null;
|
|
17
43
|
/**
|
|
18
44
|
* Calculate state timer label and timestamp based on task state.
|
|
19
45
|
* Priority: Wrap Up > Post Call
|
|
@@ -23,10 +49,8 @@ export declare function calculateStateTimerData(currentTask: ITask | null, contr
|
|
|
23
49
|
* Calculate consult timer label and timestamp based on consult state.
|
|
24
50
|
* Handles consult on hold vs active consulting states.
|
|
25
51
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* properties like activeLeg or switch button visibility. Those UI properties
|
|
29
|
-
* have different lifecycle timing and broader semantics that cause false
|
|
30
|
-
* positives (e.g., switch.isVisible is true during CONSULT_INITIATING).
|
|
52
|
+
* Derives consult on hold from consult media isHold (not uiControls alone).
|
|
53
|
+
* EP/DN and agent-name: isHold may be true before holdTimestamp arrives — still show Consult on Hold.
|
|
31
54
|
*/
|
|
32
55
|
export declare function calculateConsultTimerData(currentTask: ITask | null, controls: TaskUIControls | null, agentId: string): TimerData;
|
|
56
|
+
export {};
|
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
import { ITask } from '@webex/cc-store';
|
|
2
|
-
import { TaskUIControls } from '@webex/contact-center';
|
|
3
1
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* Derives two stable primitives from props — a boolean hold flag and a
|
|
7
|
-
* numeric timestamp — and uses them as the sole effect dependencies.
|
|
8
|
-
* This prevents the worker from being killed/recreated on every
|
|
9
|
-
* currentTask or controls reference change.
|
|
10
|
-
*
|
|
11
|
-
* @param currentTask - The current task object
|
|
12
|
-
* @param controls - SDK-computed UI controls with activeLeg
|
|
13
|
-
* @returns holdTime - The elapsed time in seconds since the call was put on hold
|
|
2
|
+
* Hold timer only — main CAD on-hold boolean is computed in useCallControl (helper.ts).
|
|
14
3
|
*/
|
|
15
|
-
export declare const useHoldTimer: (
|
|
4
|
+
export declare const useHoldTimer: (mainCallOnHold: boolean, holdTimestampMs: number | null, holdDataVersion?: number, interactionId?: string) => number;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@webex/cc-task",
|
|
3
3
|
"description": "Webex Contact Center Widgets: Task",
|
|
4
4
|
"license": "Cisco's General Terms (https://www.cisco.com/site/us/en/about/legal/contract-experience/index.html)",
|
|
5
|
-
"version": "1.28.0-task-refactor.
|
|
5
|
+
"version": "1.28.0-task-refactor.2",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/types/index.d.ts",
|
|
8
8
|
"publishConfig": {
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"deploy:npm": "yarn npm publish"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@webex/cc-components": "1.28.0-task-refactor.
|
|
27
|
-
"@webex/cc-store": "1.28.0-
|
|
26
|
+
"@webex/cc-components": "1.28.0-task-refactor.2",
|
|
27
|
+
"@webex/cc-store": "1.28.0-task-refactor.2",
|
|
28
28
|
"mobx-react-lite": "^4.1.0",
|
|
29
29
|
"react-error-boundary": "^6.0.0"
|
|
30
30
|
},
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@testing-library/react": "16.0.1",
|
|
40
40
|
"@types/jest": "29.5.14",
|
|
41
41
|
"@types/react-test-renderer": "18",
|
|
42
|
-
"@webex/test-fixtures": "0.0.0",
|
|
42
|
+
"@webex/test-fixtures": "0.0.0-task-refactor.1",
|
|
43
43
|
"babel-jest": "29.7.0",
|
|
44
44
|
"babel-loader": "9.2.1",
|
|
45
45
|
"eslint": "^9.20.1",
|