Skip to content

fix(cc-task): delegate consult transfer list policy to SDK (CAI-8354) - #736

Open
rsarika wants to merge 11 commits into
webex:nextfrom
rsarika:fix/cai-8354-missing-queue-transfer-epic-cti
Open

fix(cc-task): delegate consult transfer list policy to SDK (CAI-8354)#736
rsarika wants to merge 11 commits into
webex:nextfrom
rsarika:fix/cai-8354-missing-queue-transfer-epic-cti

Conversation

@rsarika

@rsarika rsarika commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

COMPLETES CAI-8354\n\n## This pull request addresses\n\nThe embedded Contact Center widgets duplicated consult and transfer destination policy and did not consistently preserve the SDK-provided category and row order.\n\nDepends on SDK: webex/webex-js-sdk#5179.\n\n## Changes\n\n- Read ordered Consult and Transfer destination categories from the current Task UI controls.\n- Load agents, queues, entry points, and dial numbers through the existing store and SDK methods.\n- Forward the selected Consult or Transfer action and retain the existing queue media compatibility path.\n- Preserve SDK response rows, pagination metadata, and backend order without widget-side list policy.\n- Render Momentum Avatar active or away presence from buddy-agent state.\n- Show SDK-provided dial-number and entry-point numbers as secondary row text.\n- Update focused store, task, component, fixture, and feature-spec coverage.\n\n## Impact\n\nWidgets now consume the Task visibility decision and existing SDK lists directly. Host options can still hide supported Dial Number or Entry Point categories, but cannot enable a category omitted by the Task.\n\n## Validation\n\n- Full widgets pre-commit test suite passed.\n- Focused Consult/Transfer popover suite: 27 tests passed.\n- Style checks completed with 0 errors; 6 existing sample-app warnings remain.\n- Diff-scoped specification drift check passed.\n\n## Change Type\n\n- [x] Bug fix\n- [x] Internal policy delegation\n- [x] Documentation update\n\n## GAI Coding Policy\n\n- [x] GAI was used to create a draft that was subsequently customized or modified.

@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-736.d1b38q61t1z947.amplifyapp.com

@rsarika
rsarika marked this pull request as ready for review August 19, 2026 14:42
@rsarika
rsarika requested a review from a team as a code owner August 19, 2026 14:42

@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: 6ae5a6c414

ℹ️ 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".

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

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

{CATEGORY_AGENTS}
</Button>
{allowConsultToQueue && (
{isAgentsTabVisibleFlag && (

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 Stop rendering a hidden Agents category

When accessBuddyTeam is NONE, this condition hides only the Agents button; selectedCategory still initializes to Agents, and the list body still renders buddyAgents whenever that category is selected. Consequently, opening the popover can display and allow selection of agents that the desktop profile explicitly hides. Initialize the selection to the first visible category or also gate agent loading and rendering on isAgentsTabVisibleFlag.

Useful? React with 👍 / 👎.

import {CallControlProps} from '../task.types';
import {CallControlComponent} from '@webex/cc-components';
import {isUnacceptedCampaignPreview} from '../Utils/task-util';
import {ITask} from '@webex/contact-center';

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 Import task types through the store boundary

Import ITask from @webex/cc-store rather than directly from @webex/contact-center in this widget shell and the matching CallControlCAD shell. The store already re-exports this type, and these new imports bypass the repository's required store-only SDK boundary, coupling a widget package that does not declare the SDK dependency directly to the SDK.

AGENTS.md reference: AGENTS.md:L59-L62

Useful? React with 👍 / 👎.

@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: 7395d5788d

ℹ️ 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".

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

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

consultTransferDestinations: {
consult:
overrides?.consultTransferDestinations?.consult ??
base.consultTransferDestinations.consult,

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 Add destination arrays to the Jest SDK defaults

In the @webex/cc-task and @webex/cc-store unit suites, tests/setupContactCenterMock.js mocks getDefaultUIControls() with only activeLeg, main, and consult. Consequently, the many tests that call createMockTaskUIControls() reach this dereference with base.consultTransferDestinations undefined and throw before their assertions run. Update both SDK mocks to include the consult/transfer destination arrays, or make this fixture provide a safe fallback.

Useful? React with 👍 / 👎.

@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: 3cc7a18f13

ℹ️ 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".

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

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +582 to +584
const agents = await store.getBuddyAgents(action);
logger.info(`Loaded ${agents.length} buddy agents`, {module: 'helper.ts', method: 'loadBuddyAgents'});
setBuddyAgents(agents);

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 Prevent stale agent loads after action switches

When an agent opens Consult and then opens Transfer before the Consult request finishes, both requests update the same buddyAgents state without checking which action is still active. If the Consult response resolves last, the Transfer popover displays the Consult-eligible population and allows selecting an agent the SDK excluded from transfers; an earlier request failure can similarly erase the current result. Track the latest action/request and ignore stale completions, or cancel the previous request.

Useful? React with 👍 / 👎.

@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: 9e9b5ccbb0

ℹ️ 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".

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

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1113 to +1114
...(filter ? {filter} : {}),
...(params ?? {}),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve the task channel filter when merging parameters

When a non-telephony task is active and a direct @webex/cc-store caller supplies params.filter, spreading params after the generated filter overwrites the complete queueType/channelType/active predicate. The SDK request can therefore return queues for the wrong task channel; the same merge ordering is repeated in getEntryPoints. Combine the predicates or otherwise ensure the task-scoping filter cannot be replaced.

Useful? React with 👍 / 👎.

…g-queue-transfer-epic-cti

# Conflicts:
#	packages/contact-center/cc-components/ai-docs/cc-components-spec.md
#	packages/contact-center/store/tests/util.ts

@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: b457fa243a

ℹ️ 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".

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

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

data: ContactServiceQueue[];
meta: {page: number; pageSize: number; total: number; totalPages: number};
}> => {
getQueues = async (params?: ContactServiceQueueSearchParams): Promise<ContactServiceQueuesResponse> => {

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 Preserve the existing getQueues call signature

When an existing @webex/cc-store consumer calls the established getQueues(mediaType, params) API, this one-argument replacement treats the media string as params, ignores the actual second argument, and spreads the string into the SDK request as numeric properties. This breaks pagination/search and task-channel selection for existing callers; retain a compatible overload/adapter or ship the signature removal as a breaking migration.

Useful? React with 👍 / 👎.

@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


P2 Badge Cancel pending searches when resetting categories

If a user types a two-character query and switches categories within the 500 ms debounce window, these resets run before any request has started and therefore cannot invalidate it. The queued callback subsequently starts with a newer request ID and repopulates the old category with filtered data; returning to that category shows a blank search field with the stale filtered results because the initial-load effect sees a nonempty array. Cancel the pending debounce or invalidate it with a category/search generation when changing categories.

ℹ️ 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".

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

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +218 to +220
getBuddyAgents(action: 'Consult' | 'Transfer'): Promise<BuddyDetails[]>;
getBuddyAgents(mediaType?: string): Promise<BuddyDetails[]>;
getQueues(mediaType?: string, params?: ContactServiceQueueSearchParams): Promise<ContactServiceQueuesResponse>;
getQueues(params?: ContactServiceQueueSearchParams): Promise<ContactServiceQueuesResponse>;

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 Preserve the public queue-consult flag for patch consumers

While adding these compatibility overloads, also retain the established allowConsultToQueue member on IStoreWrapper and its runtime getter. This package and the aggregator publicly expose the store, so a downstream host that reads store.allowConsultToQueue will receive undefined after this patch, while TypeScript consumers will stop compiling. Removing the member without a deprecation period or major release makes the policy refactor an unintended breaking API change.

Useful? React with 👍 / 👎.

@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: f99fb634bf

ℹ️ 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".

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

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +685 to +686
action: 'Consult' | 'Transfer';
availableDestinations: TaskUIControls['consultTransferDestinations']['consult'];

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 Keep exported popover props backward compatible

ConsultTransferPopoverComponentProps is publicly re-exported through @webex/cc-components/src/index.ts, so making action and availableDestinations required breaks existing consumers that construct or extend this type; object literals using the former required allowConsultToQueue prop will also fail excess-property checks. Since this is a patch release without a migration path, retain a compatible deprecated shape with defaults or defer the required-prop change to a major release.

Useful? React with 👍 / 👎.

@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: ea628be4d5

ℹ️ 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".

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

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1277 to +1280
isAction
? {
action: actionOrMediaType,
...(mediaType ? {mediaType} : {}),

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 Ship the paired SDK version with this delegation

For consumers installing the published packages normally, @webex/cc-store remains pinned to @webex/contact-center 3.12.0-next.96 (packages/contact-center/store/package.json:26), while the feature spec explicitly says the new eligibility/ordering behavior is owned by a paired SDK delta and was verified through a local SDK link (ai-docs/features/consult-transfer-list-policy/spec/feature-spec.md:49,71). Consequently this new action request and the task-owned destination policy will run against the old SDK in production, so the intended Consult-versus-Transfer filtering cannot be relied on; update the declared SDK dependency and lockfile to the release containing the paired delta.

Useful? React with 👍 / 👎.

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.

2 participants