fix(campaign-task): Add all global variables to campaign task#714
fix(campaign-task): Add all global variables to campaign task#714zachraymer wants to merge 6 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8dd0586cea
ℹ️ 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".
| } else if (latestGlobalVariables.length > 0) { | ||
| globalVariablesRef.current = latestGlobalVariables; | ||
| const existingMap = new Map(globalVariablesRef.current.map((v) => [v.name, v])); | ||
| latestGlobalVariables.forEach((v) => existingMap.set(v.name, v)); | ||
| globalVariablesRef.current = Array.from(existingMap.values()); |
There was a problem hiding this comment.
Reset cached CAD when campaign contact changes
When a preview campaign offer is skipped or removed, this component can receive a new contact on the same task/interaction; the component already detects that scenario below via campaignPreviewOfferTimeout. Because this accumulator only resets on interactionId changes and otherwise merges by variable name, any variable that was present only on the previous contact remains visible in the inline panel (and the mirrored popover accumulator has the same behavior) until unmount. For example, contact A's Global_Language will still display for contact B if B's payload contains only Global_Account, leaking stale customer data.
Useful? React with 👍 / 👎.
|
This pull request is automatically being deployed by Amplify Hosting (learn more). |
COMPLETES #https://jira-eng-sjc12.cisco.com/jira/browse/CAI-8143
This pull request addresses
Some global variables are missing from campaign task panel. Adding logic to display variables as we receive updates from the websocket, consistent with agent desktop
by making the following changes
Each websocket event triggers refreshTaskList() → setCurrentTask(), and the task snapshot's callAssociatedData may only contain variables from the latest payload, not the cumulative set. The existing code replaced the entire globalVariablesRef with whatever arrived, losing variables from earlier payloads.
Changes Made
@/.../CallControlCAD/call-control-cad.tsx:101-104 — merge new global variables into existing ref by name key using a Map, so all variables seen during the interaction are accumulated
@/.../CampaignTask/campaign-task.tsx:69-72 — same merge fix
@/.../CampaignTaskPopover/campaign-task-popover.tsx:57-60 — same merge fix
@/.../tests/CallControlCAD/call-control-cad.tsx — 3 new tests:
Variables from separate payloads are accumulated (merged)
Same variable's value is updated on re-render
Variables reset when interaction ID changes (new call)
Change Type
The following scenarios were tested
< ENUMERATE TESTS PERFORMED, WHETHER MANUAL OR AUTOMATED >
The GAI Coding Policy And Copyright Annotation Best Practices
Checklist before merging
Make sure to have followed the contributing guidelines before submitting.