Skip to content

feat(contact-center): add Granular Agent State V2 widget (WXCC-15791) - #761

Open
ashish-cisco wants to merge 5 commits into
webex:nextfrom
ashish-cisco:feature/WXCC-15791-Support-Granular-Agent-State
Open

ashish-cisco wants to merge 5 commits into
webex:nextfrom
ashish-cisco:feature/WXCC-15791-Support-Granular-Agent-State

Conversation

@ashish-cisco

Copy link
Copy Markdown

Summary

Adds the widget-side support for Granular Agent State V2, providing a
per-channel state management UI (telephony, chat, email, social) that
coexists with the existing V1 UserState widget. This is the companion
to the SDK-side PR in webex-js-sdk.

JIRA

WXCC-15791

Changes

New Package — @webex/cc-granular-agent-state

packages/contact-center/granular-agent-state/

  • r2wc web component (widget-cc-granular-agent-state) wrapping the React
    GranularAgentState component
  • helper.ts hooks: useGranularAgentState, useChannelStates,
    useAgentStateControl — subscribe to store V2 surface and dispatch
    channel-level state changes via the SDK
  • 13 unit tests (widget rendering + helper hooks), all passing

New UI Components — @webex/cc-components

packages/contact-center/cc-components/src/components/GranularAgentState/

Component Purpose
GranularAgentState Top-level container: renders channel state cards + menu
ManageChannelAvailability Per-channel availability toggles panel
GranularStateMenu Dropdown for selecting per-channel target states
ChannelStatePreview Compact channel state badge
ChannelAvatar Channel-type icon with state-colored indicator
  • Utility helpers: getChannelIcon, getStateColor, formatChannelLabel,
    buildChannelStatePayload
  • 62+ assertions across component and utils test files, all passing

Store V2 Surface — @webex/cc-store

Addition Type
isGranularAgentStateActive boolean getter
channelStatesMap Map<ChannelType, ChannelState>
agentStateControlStatus AgentStateControlStatus
refreshAgentStateControl() method — re-reads SDK control status
  • storeEventsWrapper.ts: wires AGENT_CHANNEL_STATE_CHANGED,
    AGENT_CHANNEL_STATE_CHANGE_FAILED, AGENT_CHANNEL_AVAILABILITY_CHANGED,
    and session relogin recovery into the store
  • 32 store unit tests + 129-line storeEventsWrapper test additions, all passing

V1 / V2 Coexistence — @webex/cc-user-state

  • Guard in helper.ts: when isGranularAgentStateActive is true, the V1
    UserState widget hides its state-change controls and defers to the V2
    widget

Widget Registration — @webex/cc-widgets

  • index.ts + wc.ts: register widget-cc-granular-agent-state web
    component alongside existing widgets
  • package.json: add @webex/cc-granular-agent-state workspace dependency

Sample App

  • samples-cc-react-app: conditionally renders the GranularAgentState
    widget when V2 session is active; Webpack alias added for the new package

AI Docs

  • Feature spec, design, contracts (widget API surface, store V2 surface),
    task breakdown (W1–W3), implementation plans, and test strategy
  • Updates to ARCHITECTURE.md, CONTRACTS.md, GLOSSARY.md,
    SERVICE_STATE.md, SPEC_INDEX.md

Testing

  • 13 tests — @webex/cc-granular-agent-state (widget + hooks)
  • 62 tests — @webex/cc-components GranularAgentState components & utils
  • 32 tests — @webex/cc-store (V2 store getters + mutations)
  • 129 lines — storeEventsWrapper V2 event wiring tests
  • 28 tests — @webex/cc-user-state (V1/V2 coexistence guard)
  • All packages pass individually; yarn.lock updated for the new workspace

Dependencies

  • SDK PR: webex-js-sdk commit d2ddc637b3 on the same branch
    (feature/WXCC-15791-Support-Granular-Agent-State)

Breaking Changes

None - V2 widget only renders when the SDK session is pinned to V2 via the
manageChannelAvailability profile flag. Existing V1 UserState widget
behavior is unchanged for V1 sessions.

COMPLETES #< INSERT LINK TO ISSUE >

This pull request addresses

< DESCRIBE THE CONTEXT OF THE ISSUE >

by making the following changes

< DESCRIBE YOUR CHANGES >

Change Type

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Tooling change
  • Internal code refactor

The following scenarios were tested

  • The testing is done with the amplify link
    < ENUMERATE TESTS PERFORMED, WHETHER MANUAL OR AUTOMATED >

The GAI Coding Policy And Copyright Annotation Best Practices

  • GAI was not used (or, no additional notation is required)
  • Code was generated entirely by GAI
  • GAI was used to create a draft that was subsequently customized or modified
  • Coder created a draft manually that was non-substantively modified by GAI (e.g., refactoring was performed by GAI on manually written code)
  • Tool used for AI assistance (GitHub Copilot / Other - specify)
    • Github Copilot
    • Cursor Claude Opus 4.6
    • Codex
  • This PR is related to
    • Feature
    • Defect fix
    • Tech Debt
    • Automation

Checklist before merging

  • I have not skipped any automated checks
  • All existing and new tests passed
  • I have updated the testing document
  • I have tested the functionality with amplify link

Make sure to have followed the contributing guidelines before submitting.

- Add new @webex/cc-granular-agent-state widget package with r2wc web component
- Add GranularAgentState component to cc-components (channel avatars, state menu,
  manage-channel-availability panel)
- Extend store with V2 surface: isGranularAgentStateActive, channelStatesMap,
  refreshAgentStateControl()
- Wire V2 events in storeEventsWrapper: handleChannelStateChange,
  handleChannelStateChangeFailed, bootstrapSession relogin recovery
- Register widget-cc-granular-agent-state in cc-widgets wc.ts
- Add V1/V2 coexistence guard in user-state helper
- Update sample app with V2 widget integration
- Add feature spec, design, contracts, tasks, implementation plans, and test strategy
- yarn.lock: updated for new workspace package
@ashish-cisco
ashish-cisco requested a review from a team as a code owner November 17, 2026 22:00
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T18:07:49.203212Z 43d30c3 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8c5015aac8

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread ai-docs/CONTRACTS.md Resolved
@aws-amplify-us-east-2

Copy link
Copy Markdown

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-761.d1b38q61t1z947.amplifyapp.com

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 68fe523caa

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread ai-docs/CONTRACTS.md Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 53f2eb7306

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

- Filter the platform ENGAGED code from selectable idle reasons and fallback selection
- Add coverage for selectable and fallback idle-code filtering
- Align WXCC-15791 AI docs with the profile-based SDK gate, sample integration, store types, and Manage Apply error behavior
- Correct stale test notes, implementation statuses, and broken documentation links
- Document the V1 response timestamp guard while clarifying that its UI flow remains unchanged

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: abdd72730e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

const manifest = readCandidates(candidateDirectory);
const candidates = manifest.filter((entry) => entry.name.startsWith('@webex/cc-'));
if (candidates.length !== 9) throw new Error('Expected all nine Contact Center package archives.');
if (candidates.length !== 10) throw new Error('Expected all ten Contact Center package archives.');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Update the consumer-build instructions for the tenth archive

The custom-candidate instructions in ai-docs/CONSUMER_BUILDS.md:81–82 still require nine Contact Center archives, but run() now rejects that documented package count before invoking its installation/build steps. The current release sequence at line 40 also still describes nine packages. Update the standing doc to include the new @webex/cc-granular-agent-state archive alongside this change, as required by the root AGENTS.md “Spec-currency” rule.

AGENTS.md reference: AGENTS.md:L68-L68

Useful? React with 👍 / 👎.

…indings

Widget:
- Add compact pill mode with ResizeObserver for label overflow
- Use capture-phase mousedown to close panel reliably
- Wrap onStateChange callback in try/catch

Fixes:
- Fix WC sample typo in lastIdleCodeChangeTimestamp property access
- Update WC sample CDN from webex@3.8.0 to webex@3.13.0
- Add missing onToggleMute to CallControl WC prop definitions
- Remove console.log from Store singleton

Cleanup:
- Remove completed WXCC-15791 feature planning docs

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 43d30c3fb2

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

onEnd: 'function',
onWrapUp: 'function',
onRecordingToggle: 'function',
onToggleMute: 'function',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Document the newly exposed Web Component mute callback

For Web Component consumers, this change exposes onToggleMute on both widget-cc-call-control and widget-cc-call-control-cad, but ai-docs/CONTRACTS.md:24–25 and the cc-widgets spec's public-surface table still enumerate only the previous four callbacks. Neither contract documents the new callback or its {isMuted: boolean, task: ITask} payload, leaving hosts without the integration signature for this newly supported property. Update those entries alongside the prop maps, as required by the root AGENTS.md Spec-currency rule.

AGENTS.md reference: AGENTS.md:L68-L68

Useful? React with 👍 / 👎.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant