fix(cc-task): delegate consult transfer list policy to SDK (CAI-8354) - #736
fix(cc-task): delegate consult transfer list policy to SDK (CAI-8354)#736rsarika wants to merge 11 commits into
Conversation
|
This pull request is automatically being deployed by Amplify Hosting (learn more). |
There was a problem hiding this comment.
💡 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 && ( |
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
💡 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, |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
💡 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".
| const agents = await store.getBuddyAgents(action); | ||
| logger.info(`Loaded ${agents.length} buddy agents`, {module: 'helper.ts', method: 'loadBuddyAgents'}); | ||
| setBuddyAgents(agents); |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
💡 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".
| ...(filter ? {filter} : {}), | ||
| ...(params ?? {}), |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
💡 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> => { |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
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".
| getBuddyAgents(action: 'Consult' | 'Transfer'): Promise<BuddyDetails[]>; | ||
| getBuddyAgents(mediaType?: string): Promise<BuddyDetails[]>; | ||
| getQueues(mediaType?: string, params?: ContactServiceQueueSearchParams): Promise<ContactServiceQueuesResponse>; | ||
| getQueues(params?: ContactServiceQueueSearchParams): Promise<ContactServiceQueuesResponse>; |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
💡 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".
| action: 'Consult' | 'Transfer'; | ||
| availableDestinations: TaskUIControls['consultTransferDestinations']['consult']; |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
💡 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".
| isAction | ||
| ? { | ||
| action: actionOrMediaType, | ||
| ...(mediaType ? {mediaType} : {}), |
There was a problem hiding this comment.
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 👍 / 👎.
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.