Drop Button Implementation in widgets - #735
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 13b15ed84f
ℹ️ 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".
| if (pendingRequest && (pendingRequest.taskId !== participantDropTaskId || pendingRequest.task !== currentTask)) { | ||
| pendingParticipantDropRef.current = null; | ||
| } | ||
| }, [currentTask, controls]); | ||
|
|
||
| setPendingParticipantDropId(null); | ||
| setParticipantDropAnnouncement(null); | ||
| }, [currentTask, participantDropTaskId]); |
There was a problem hiding this comment.
Preserve pending drops across same-interaction refreshes
Reset the pending request only when the interaction actually changes, not whenever currentTask gets a new object identity. StoreWrapper.refreshTaskList() calls setCurrentTask(), which clones the task even when its interaction ID is unchanged, and participant-left/UI-control events invoke that refresh during the event-correlated SDK request. This effect therefore clears the global lock and announcement before the promise continuation runs, allowing a second Drop and suppressing the normal success or failure feedback for the first request.
Useful? React with 👍 / 👎.
|
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: 8f10ce0e50
ℹ️ 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".
|
|
||
| // Prefer the observable task data when it already contains the current leg; | ||
| // fall back to the state-machine snapshot during the brief hydration gap. | ||
| const taskDataCandidates = [task.data, snapshotTaskData].filter((taskData): taskData is RosterTaskData => |
There was a problem hiding this comment.
Prefer the newest consult snapshot over stale task data
When a completed consult leg remains in task.data and a subsequent EP-DN consult is present only in state.context.taskData, this ordering returns the old leg immediately, so the newer snapshot is never examined. This is a supported transition in this repository—other consult logic explicitly accounts for retained old media and fresher initiator snapshots—and can make the Drop roster show the prior destination or omit the current ringing/answering participant until hydration catches up. Compare leg recency/current media IDs across both candidates rather than accepting the first consult entry.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 053e6f46f7
ℹ️ 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 consultIsActive = | ||
| hasVisibleControls(task?.uiControls?.consult) || ['consult', 'consulting'].includes(interactionState); |
There was a problem hiding this comment.
Recognize consults exposed on the main controls
When a nested or EP-DN consult keeps interaction.state at conference and the SDK exposes only uiControls.main.endConsult—a supported shape already handled in task/src/helper.ts and its tests—this predicate incorrectly treats the consult as inactive because it inspects only uiControls.consult. Consequently getCurrentConsultMediaEntry omits the ringing or answering destination, while the identical predicate in hasActiveNonHeldConsult leaves Drop enabled for established participants during the active non-held consult; include the main-leg end-consult signal in both derivations.
Useful? React with 👍 / 👎.
Kesari3008
left a comment
There was a problem hiding this comment.
Only few files I have reviewed. Have added comments for those. Please address these comments before merge. Approving the PR, keeping the deadline in mind. But PR needs to be revisited for thorough review
| "path": "packages/contact-center/store", | ||
| "spec": "packages/contact-center/store/ai-docs/store-spec.md", | ||
| "responsibility": "MobX singleton holding global CC state; proxies SDK events; sole SDK access point.", | ||
| "responsibility": "MobX singleton holding global CC state; proxies SDK events; sole SDK access point; owns pure conference Drop roster derivation.", |
There was a problem hiding this comment.
These changes may not be needed. This feature is just an addition among serveral other features and explicitly adding it in manifest is not required
| } | ||
| }, [customerDropTarget, latestCustomerDropTarget]); | ||
|
|
||
| const handleParticipantDrop = (target: ConferenceParticipantDropTarget, trigger: HTMLElement) => { |
There was a problem hiding this comment.
These methods belong in helper file, not in the presentational component. Any method that is performing an action or business logic should be in helper files and passed down here via props to be invoked here.
| </h4> | ||
| <ul className="participant-roster-list"> | ||
| {targets.map((target) => { | ||
| const isSelectedPending = pendingParticipantDropId === target.dropTargetId; |
There was a problem hiding this comment.
Avoid this where we have constants defined inside UI logic. This ideally should be outside
| const PARTICIPANT_DROP_SUCCESS_MESSAGE = 'Participant removed from the conference.'; | ||
| const PARTICIPANT_DROP_FAILURE_MESSAGE = 'Unable to drop participant from the call. Try again.'; | ||
|
|
||
| type PendingParticipantDropRequest = { |
There was a problem hiding this comment.
This should be in types files
| // pause/resume, etc.) exactly as production does. | ||
| store.handleIncomingTask(task); | ||
| store.setCurrentTask(task); | ||
| store.handleIncomingTask(task as unknown as Parameters<typeof store.handleIncomingTask>[0]); |
There was a problem hiding this comment.
This change is not needed
| }); | ||
| }; | ||
|
|
||
| private scheduleTaskListRefresh = (): void => { |
There was a problem hiding this comment.
Is this change needed for drop feature ?
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
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.