fix(widgets): fixed-consult-transfer-popover-epic-bugs - #548
Conversation
|
This pull request is automatically being deployed by Amplify Hosting (learn more). |
adhmenon
left a comment
There was a problem hiding this comment.
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[] => { |
There was a problem hiding this comment.
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 = ( |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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}$'); |
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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} />); |
There was a problem hiding this comment.
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 () => { |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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.
|
Note: |
mkesavan13
left a comment
There was a problem hiding this comment.
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 = ( |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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
# [1.28.0-ccwidgets.121](v1.28.0-ccwidgets.120...v1.28.0-ccwidgets.121) (2025-11-04) ### Bug Fixes * **widgets:** fixed-consult-transfer-popover-epic-bugs ([#548](#548)) ([4edf83f](4edf83f))
|
🎉 This PR is included in version 1.28.0-ccwidgets.121 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
COMPLETES #< CAI-7305 & CAI-7313 & CAI-7317 & CAI-7318 & CAI-7316 >
This pull request addresses
consultToQueuewas disabled, the button was coming as disabled rather than the tab being hiddenby making the following changes
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
The following scenarios were tested
The GAI Coding Policy And Copyright Annotation Best Practices
Checklist before merging