-
Notifications
You must be signed in to change notification settings - Fork 70
fix(spillover-of-outdial): fix-pending-oudial-items #563
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
db8e8dd
fix(spillover-of-outdial): fix-pending-oudial-items
akulakum f4b4f44
fix(spillover-of-outdial): cosmetic-fixes
akulakum 17bbc71
fix(spillover-of-outdial): address-review-comments
akulakum b568606
fix(spillover-of-outdial): address-review-comments
akulakum File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,12 @@ import React, {useEffect, useMemo, useState} from 'react'; | |
| import {OutdialAniEntry, OutdialCallComponentProps} from '../task.types'; | ||
| import './outdial-call.style.scss'; | ||
| import {withMetrics} from '@webex/cc-ui-logging'; | ||
| import {Input, Button, Option, Select} from '@momentum-design/components/dist/react'; | ||
| import {Input, Button, Icon} from '@momentum-design/components/dist/react'; | ||
| // Migrate from @momentum-ui/react-collaboration to @momentum-design/components | ||
| // Currently using SelectNext for controlled selection behavior with proper onSelectionChange and onOpenChange support | ||
| // bug ticket: https://jira-eng-sjc12.cisco.com/jira/browse/CAI-6990 | ||
| import {SelectNext} from '@momentum-ui/react-collaboration'; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://jira-eng-sjc12.cisco.com/jira/browse/CAI-6990
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
| import {Item} from '@react-stately/collections'; | ||
| import {OutdialStrings, KEY_LIST} from './constants'; | ||
|
|
||
| /** | ||
|
|
@@ -14,15 +19,17 @@ import {OutdialStrings, KEY_LIST} from './constants'; | |
| * | ||
| * @param props - Properties for the OutdialCallComponent. | ||
| * @property startOutdial - Function to initiate the outdial call with the entered destination number. | ||
| * @property isTelephonyTaskActive - Boolean indicating if there's an active telephony task. | ||
| */ | ||
| const OutdialCallComponent: React.FunctionComponent<OutdialCallComponentProps> = (props) => { | ||
| const {logger, startOutdial, getOutdialANIEntries} = props; | ||
| const {logger, startOutdial, getOutdialANIEntries, isTelephonyTaskActive} = props; | ||
|
|
||
| // State Hooks | ||
| const [destination, setDestination] = useState(''); | ||
| const [isValidNumber, setIsValidNumber] = useState(''); | ||
| const [selectedANI, setSelectedANI] = useState(undefined); | ||
| const [selectedANI, setSelectedANI] = useState<string | undefined>(undefined); | ||
| const [outdialANIList, setOutdialANIList] = useState<OutdialAniEntry[]>([]); | ||
| const [isSelectOpen, setIsSelectOpen] = useState(false); | ||
|
|
||
| // Validate the input format using regex from agent desktop | ||
| const regExForDnSpecialChars = useMemo( | ||
|
|
@@ -82,7 +89,7 @@ const OutdialCallComponent: React.FunctionComponent<OutdialCallComponentProps> = | |
| helpTextType={isValidNumber ? 'error' : 'default'} | ||
| placeholder={OutdialStrings.DN_PLACEHOLDER} | ||
| value={destination} | ||
| onChange={(e: unknown) => { | ||
| onInput={(e: unknown) => { | ||
| const inputValue = (e as React.ChangeEvent<HTMLInputElement>).target.value; | ||
| setDestination(inputValue); | ||
| validateOutboundNumber(inputValue); | ||
|
|
@@ -97,36 +104,53 @@ const OutdialCallComponent: React.FunctionComponent<OutdialCallComponentProps> = | |
| </li> | ||
| ))} | ||
| </ul> | ||
| <Select | ||
| className="outdial-input" | ||
| label={OutdialStrings.ANI_SELECT_LABEL} | ||
| id="outdial-ani-option-select" | ||
| name="outdial-ani-option-select" | ||
| data-testid="outdial-ani-option-select" | ||
| placeholder={OutdialStrings.ANI_SELECT_PLACEHOLDER} | ||
| onChange={(event: CustomEvent) => { | ||
| setSelectedANI(event.detail.value); | ||
| }} | ||
| > | ||
| {outdialANIList.map((option: OutdialAniEntry, index: number) => { | ||
| return ( | ||
| <Option | ||
| selected={option.number === selectedANI} | ||
| key={index} | ||
| value={option.number} | ||
| name={`outdial-ani-option-${index}`} | ||
| data-testid={`outdial-ani-option-${index}`} | ||
| > | ||
| {option.name} | ||
| </Option> | ||
| ); | ||
| })} | ||
| </Select> | ||
| <div className="outdial-ani-select-container"> | ||
| <Icon | ||
| className="outdial-select-arrow-icon" | ||
| name={isSelectOpen ? 'arrow-up-bold' : 'arrow-down-bold'} | ||
| title="" | ||
| data-testid="select-arrow-icon" | ||
| /> | ||
|
|
||
| <SelectNext | ||
| className="outdial-input" | ||
| label={OutdialStrings.ANI_SELECT_LABEL} | ||
| id="outdial-ani-option-select" | ||
| data-testid="outdial-ani-option-select" | ||
| placeholder={OutdialStrings.ANI_SELECT_PLACEHOLDER} | ||
| selectedKey={selectedANI || null} | ||
| onSelectionChange={(key: React.Key) => { | ||
| const value = key as string; | ||
| // Set to undefined if key is 'none' or null | ||
| const newANI = !value || value === 'none' ? undefined : value; | ||
| setSelectedANI(newANI); | ||
| }} | ||
| onOpenChange={(isOpen: boolean) => setIsSelectOpen(isOpen)} | ||
| items={[ | ||
| {id: 'none', name: OutdialStrings.ANI_SELECT_PLACEHOLDER}, | ||
| ...outdialANIList.map((ani) => ({id: ani.number, name: ani.name})), | ||
| ]} | ||
| direction="bottom" | ||
| showBorder | ||
| > | ||
| {(item: {id: string; name: string}) => ( | ||
| <Item key={item.id} textValue={item.name} data-testid={`outdial-ani-option-${item.id}`}> | ||
| <div className="outdial-ani-option-name">{item.name}</div> | ||
| </Item> | ||
| )} | ||
| </SelectNext> | ||
| </div> | ||
| <Button | ||
| data-testid="outdial-call-button" | ||
| prefixIcon={'handset-regular'} | ||
| onClick={() => startOutdial(destination, selectedANI)} | ||
| disabled={!!isValidNumber || !destination} | ||
| className="outDialCallButton" | ||
| onClick={() => { | ||
| startOutdial(destination, selectedANI); | ||
| // Clear input field after initiating the call | ||
| setDestination(''); | ||
| setIsValidNumber(''); | ||
| }} | ||
| disabled={!!isValidNumber || !destination || !!isTelephonyTaskActive} | ||
| size={40} | ||
| /> | ||
| </article> | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
did u test with digital task? I feel it will show. just cross check
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.
Yes, I have tested the digital task scenarios. When we receive a digital task, only the Accept button is displayed. For digital tasks, we do not show the Decline button, so the behavior is correct.