fix(task-refactor): add explicit on/off methods to ITask interface#4812
Open
akulakum wants to merge 4 commits intowebex:task-refactorfrom
Open
fix(task-refactor): add explicit on/off methods to ITask interface#4812akulakum wants to merge 4 commits intowebex:task-refactorfrom
akulakum wants to merge 4 commits intowebex:task-refactorfrom
Conversation
Kesari3008
reviewed
Mar 27, 2026
| * Extends EventEmitter to support event-driven task updates | ||
| */ | ||
| export interface ITask extends EventEmitter { | ||
| /** |
Contributor
There was a problem hiding this comment.
Why do we need this change ? If this was a problem then how did we have widgets working till now ?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
COMPLETES #https://jira-eng-sjc12.cisco.com/jira/browse/CAI-7779
This pull request addresses
As part of the task-refactor, the SDK's ITask interface extends Node's EventEmitter for on()/off() methods, but consumers like CC Widgets whose tsconfig.json restricts type resolution to "types": ["jest"] cannot resolve @types/node — resulting in TS2339: Property 'on'/'off' does not exist on type 'ITask' errors on every task.on() / task.off() call.
The SDK's package.json maps "main" and "exports" to dist/webex.js, which only exported the Webex class as default. All named exports (TASK_EVENTS, getDefaultUIControls, AGENT_EVENTS, ContactCenter, etc.) were properly defined in dist/index.js but unreachable at runtime for consumers using import { TASK_EVENTS } from '@webex/contact-center'.
TypeScript compilation passed because types resolved from dist/types/index.d.ts, masking the fact that the runtime values were undefined. This caused the CC Widgets' addEventListeners() to crash silently on agent:dnRegistered, meaning no task event listeners (task:incoming, agent:stateChange, etc.) were ever registered — breaking incoming task rendering, modal popups, and RONA state updates.
by making the following changes
Fix 1: Self-contained ITask event methods
Fix 2: Re-export named exports from webex.js
Change Type
The following scenarios were tested
< ENUMERATE TESTS PERFORMED, WHETHER MANUAL OR AUTOMATED >
The GAI Coding Policy And Copyright Annotation Best Practices
I certified that
Make sure to have followed the contributing guidelines before submitting.