Skip to content

Conversation

@adhmenon
Copy link
Contributor

COMPLETES #< CAI-7305 & CAI-7313 & CAI-7317 & CAI-7318 & CAI-7316 >

This pull request addresses

  • EPIC reported few bugs in the consult-transfer popover
  • Search was not working in the agents tab
  • The widget was showing different tabs from the agent desktop as widgets was not adhering to flags
  • For agents where consultToQueue was disabled, the button was coming as disabled rather than the tab being hidden
  • Manual consult-transfer to dial number and entrypoint was not working
  • Addressbook api was failing for users who did not have the id and hence error was seen.

by making the following changes

  • Code was added so the tabs adhere to all flags strictly.
  • Consistency with agent desktop was noted.
  • For address book, only if the id existed were we calling the SDK api.
  • Manual dialling validation was performed only for queue and for dial number and code was taken from agent desktop for validation.
  • Some CSS changes to fix glitches

Vidcast 1 (Showing agent without addressbook and queues) - https://app.vidcast.io/share/aac9473d-2c76-4445-9371-80e78ee15413

Vidcast 2 (Showing agent with all settings) - https://app.vidcast.io/share/f8346a94-a4a1-4248-8bcc-8b3015932723

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
  • Tested all consult-transfer cases for 2 types of sandboxes.
  • Tested with e2e tests.

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
  • 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

@adhmenon adhmenon added validated Indicates that the PR is ready for actions run_e2e Add this label to run E2E test for meeting and CC widgets labels Oct 31, 2025
@aws-amplify-us-east-2
Copy link

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

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

Copy link
Contributor Author

@adhmenon adhmenon left a comment

Choose a reason for hiding this comment

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

Another note.
I have not updated e2e tests as they covered most cases already.
They were passing locally and will ensure it passes on the build as well.

/**
* Filters buddy agents by a free-text query across name, dn and id.
*/
export const filterAgentsByQuery = (agents: BuddyDetails[], query: string): BuddyDetails[] => {
Copy link
Contributor Author

@adhmenon adhmenon Oct 31, 2025

Choose a reason for hiding this comment

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

I have added custom utils here so our presentational layer is not cluttered.
I've tried to optimise it as much as posisble with cursors's help.
Followed a similar logic to what I found in agent desktop.

/**
* Returns agents to display for current category, applying search only for Agents tab.
*/
export const getAgentsForDisplay = (
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The only reason these 2 methods exist separately is because for the other tabs we have paginated lists and hence search was done in SDK.
For buddy agents the list is provided via SDK and we simply need to perform a local search in our widgets.
This is needed as otherwise it was breaking. I don't feel comfortable moving this to SDK as it would mess up the flow of the other search as agents don't have pagination.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is alright for now but we can brainstorm and see how we can fit this in the SDK later.

onDialNumberSelect: ((dialNumber: string) => void) | undefined,
onEntryPointSelect: ((entryPointId: string, entryPointName: string) => void) | undefined
): {visible: boolean; onClick?: () => void; title?: string} => {
const DN_REGEX = new RegExp('^[+1][0-9]{3,18}$|^[*#:][+1][0-9*#:]{3,18}$|^[0-9*#:]{3,18}$');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The validation here follows the same logic we have in agent desktop.
It only is valid for dial number or entrypoint as of now.

import ConsultTransferListComponent from './consult-transfer-list-item';
import {ConsultTransferPopoverComponentProps} from '../../task.types';
import ConsultTransferEmptyState from './consult-transfer-empty-state';
import {isAgentsEmpty, handleAgentSelection, handleQueueSelection} from './call-control-custom.utils';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

No need for isAgentsEmpty we now handle each tab emptiness on their own.
I checked - it's the same behaviour with agent desktop, so I've updated so we have parity.

logger,
}) => {
const {showDialNumberTab = true, showEntryPointTab = true} = consultTransferOptions || {};
const isEntryPointTabVisible = (showEntryPointTab ?? true) && heading === 'Consult';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As with agent desktop, we only show entry points tab IF it is a Consult case AND the feature toggle is set to true. This FT will be supplied by EPIC or the external user, by default it is true for us.

pointer-events: auto;
}

.consult-search-row {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This style change is simply for adjusting the button and the search bar. Works well - cursor suggested.

it('should render the component with heading and category buttons', async () => {
let screen;
await act(async () => {
screen = render(<ConsultTransferPopoverComponent {...defaultProps} />);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tests also needed some updations - moslty heading related changes which were old.

});

it('disables queue selection when allowConsultToQueue is false', async () => {
it('hides queue tab when allowConsultToQueue is false', async () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Again we were not hiding the queue tab - which was not correct.
Now the test has been updated to make sure code works fine.

this.lastStateChangeTimestamp = response.lastStateChangeTimestamp;
this.lastIdleCodeChangeTimestamp = response.lastIdleCodeChangeTimestamp;
this.isEndConsultEnabled = response.isEndConsultEnabled;
this.isAddressBookEnabled = Boolean(response.addressBookId);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Need this flag to ensure we do not call the SDK addressbook API... agent desktop does the exact same thing.
I felt it is better it lies in widgets as otherwise adding it in SDK is unecessary.

Copy link
Contributor

Choose a reason for hiding this comment

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

Having it in the widgets is good. However, we'll have to update the SDK to read this flag and not send request. Let's add a TODO


getAddressBookEntries = async (params?: AddressBookEntrySearchParams): Promise<AddressBookEntriesResponse> => {
try {
if (!this.store.isAddressBookEnabled) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Simple logic, gate the API if the flag is not visible and return an empty list.
Agent desktop does a similar thing.

This is so that we get the Dial Number tab and that users can manually transfer or consult - that's it. Hence we have an empty list.

@adhmenon adhmenon changed the title ffix(widgets): fixed-consult-transfer-popover-epic-issues fix(widgets): fixed-consult-transfer-popover-epic-issues Oct 31, 2025
@adhmenon
Copy link
Contributor Author

Note:
I think this PR will not have any merge conflicts with the MPC PR, since this operates on different areas.
But just need to be sure.

@adhmenon adhmenon changed the title fix(widgets): fixed-consult-transfer-popover-epic-issues fix(widgets): fixed-consult-transfer-popover-epic-bugs Oct 31, 2025
Copy link
Contributor

@mkesavan13 mkesavan13 left a comment

Choose a reason for hiding this comment

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

Looks good to me. Just a few minor comments. Approving the PR.

/**
* Returns agents to display for current category, applying search only for Agents tab.
*/
export const getAgentsForDisplay = (
Copy link
Contributor

Choose a reason for hiding this comment

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

This is alright for now but we can brainstorm and see how we can fit this in the SDK later.

this.lastStateChangeTimestamp = response.lastStateChangeTimestamp;
this.lastIdleCodeChangeTimestamp = response.lastIdleCodeChangeTimestamp;
this.isEndConsultEnabled = response.isEndConsultEnabled;
this.isAddressBookEnabled = Boolean(response.addressBookId);
Copy link
Contributor

Choose a reason for hiding this comment

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

Having it in the widgets is good. However, we'll have to update the SDK to read this flag and not send request. Let's add a TODO

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

Labels

run_e2e Add this label to run E2E test for meeting and CC widgets validated Indicates that the PR is ready for actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants