- 
                Notifications
    
You must be signed in to change notification settings  - Fork 60
 
fix(widgets): fixed-consult-transfer-popover-epic-bugs #548
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: ccwidgets
Are you sure you want to change the base?
Conversation
| 
           This pull request is automatically being deployed by Amplify Hosting (learn more).  | 
    
There was a problem hiding this 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[] => { | 
There was a problem hiding this comment.
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 = ( | 
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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}$'); | 
There was a problem hiding this comment.
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'; | 
There was a problem hiding this comment.
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'; | 
There was a problem hiding this comment.
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 { | 
There was a problem hiding this comment.
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} />); | 
There was a problem hiding this comment.
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 () => { | 
There was a problem hiding this comment.
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); | 
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) { | 
There was a problem hiding this comment.
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.
| 
           Note:  | 
    
There was a problem hiding this 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 = ( | 
There was a problem hiding this comment.
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.
        
          
                ...cc-components/src/components/task/CallControl/CallControlCustom/consult-transfer-popover.tsx
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                ...cc-components/src/components/task/CallControl/CallControlCustom/consult-transfer-popover.tsx
          
            Show resolved
            Hide resolved
        
              
          
                ...cc-components/src/components/task/CallControl/CallControlCustom/consult-transfer-popover.tsx
              
                Outdated
          
            Show resolved
            Hide resolved
        
      | this.lastStateChangeTimestamp = response.lastStateChangeTimestamp; | ||
| this.lastIdleCodeChangeTimestamp = response.lastIdleCodeChangeTimestamp; | ||
| this.isEndConsultEnabled = response.isEndConsultEnabled; | ||
| this.isAddressBookEnabled = Boolean(response.addressBookId); | 
There was a problem hiding this comment.
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
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