-
Notifications
You must be signed in to change notification settings - Fork 70
feat(contact-center): wxcc-6026 wxapp answer, mute sync, dtmf keypad #734
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: next
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| import React from 'react'; | ||
| import {Button} from '@momentum-design/components/dist/react'; | ||
| import {KEY_LIST} from '../OutdialCall/constants'; | ||
| import type {ILogger} from '@webex/cc-store'; | ||
|
|
||
| export type CallControlDtmfKeypadProps = { | ||
| onDigitPress: (digit: string) => void; | ||
| logger?: ILogger; | ||
| }; | ||
|
|
||
| /** | ||
| * In-call DTMF keypad for wxApp telephony sessions (Extension login). | ||
| * Each key press sends a single tone via SDK transmitDtmfOnWebex(). | ||
| */ | ||
| const CallControlDtmfKeypad: React.FunctionComponent<CallControlDtmfKeypadProps> = ({onDigitPress, logger}) => { | ||
| const handleDigitPress = (digit: string) => { | ||
| logger?.info(`CC-Widgets: CallControl: DTMF digit pressed`, { | ||
| module: 'call-control-dtmf-keypad.tsx', | ||
| method: 'handleDigitPress', | ||
| }); | ||
| onDigitPress(digit); | ||
| }; | ||
|
|
||
| return ( | ||
| <ul className="call-control-dtmf-keys" data-testid="call-control-keypad-keys"> | ||
| {KEY_LIST.map((key) => ( | ||
| <li key={key}> | ||
| <Button className="call-control-dtmf-key" onClick={() => handleDigitPress(key)} aria-label={`DTMF ${key}`}> | ||
| {key} | ||
| </Button> | ||
| </li> | ||
| ))} | ||
| </ul> | ||
| ); | ||
| }; | ||
|
|
||
| export default CallControlDtmfKeypad; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -288,6 +288,11 @@ export interface ControlProps { | |
| */ | ||
| toggleMute: () => void; | ||
|
|
||
| /** | ||
| * Sends a DTMF tone on wxApp engaged telephony calls. | ||
| */ | ||
| sendDtmf: (digit: string) => void; | ||
|
|
||
| /** | ||
| * Function to handle ending the call. | ||
| */ | ||
|
|
@@ -525,6 +530,7 @@ export type CallControlComponentProps = Pick< | |
| | 'toggleHold' | ||
| | 'toggleRecording' | ||
| | 'toggleMute' | ||
| | 'sendDtmf' | ||
|
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.
Any external consumer that directly renders the published Useful? React with 👍 / 👎. |
||
| | 'isMuted' | ||
| | 'endCall' | ||
| | 'wrapupCall' | ||
|
|
@@ -709,7 +715,7 @@ export interface CallControlConsultComponentsProps { | |
| /** | ||
| * Type representing the possible menu types in call control. | ||
| */ | ||
| export type CallControlMenuType = 'Consult' | 'Transfer' | 'ExitConference'; | ||
| export type CallControlMenuType = 'Consult' | 'Transfer' | 'ExitConference' | 'Keypad'; | ||
|
|
||
| export const MEDIA_CHANNEL = { | ||
| EMAIL: 'email', | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| import React from 'react'; | ||
| import {fireEvent, render, screen, waitFor, within} from '@testing-library/react'; | ||
| import '@testing-library/jest-dom'; | ||
| import CallControlDtmfKeypad from '../../../../src/components/task/CallControl/call-control-dtmf-keypad'; | ||
| import {KEY_LIST} from '../../../../src/components/task/OutdialCall/constants'; | ||
| import {mockCC} from '@webex/test-fixtures'; | ||
|
|
||
| describe('CallControlDtmfKeypad', () => { | ||
| const onDigitPress = jest.fn(); | ||
| const logger = mockCC.LoggerProxy; | ||
|
|
||
| beforeEach(() => { | ||
| jest.clearAllMocks(); | ||
| }); | ||
|
|
||
| it('renders all DTMF keys', async () => { | ||
| render(<CallControlDtmfKeypad onDigitPress={onDigitPress} logger={logger} />); | ||
|
|
||
| const keypad = await screen.findByTestId('call-control-keypad-keys'); | ||
| await waitFor(() => { | ||
| expect(keypad.querySelectorAll('.call-control-dtmf-key')).toHaveLength(KEY_LIST.length); | ||
| }); | ||
|
|
||
| KEY_LIST.forEach((key) => { | ||
| expect(within(keypad).getByText(key)).toBeInTheDocument(); | ||
| }); | ||
| }); | ||
|
|
||
| it('calls onDigitPress and logs when a digit is pressed', async () => { | ||
| render(<CallControlDtmfKeypad onDigitPress={onDigitPress} logger={logger} />); | ||
|
|
||
| const keypad = await screen.findByTestId('call-control-keypad-keys'); | ||
| fireEvent.click(within(keypad).getByText('5')); | ||
|
|
||
| expect(onDigitPress).toHaveBeenCalledWith('5'); | ||
| expect(logger.info).toHaveBeenCalledWith('CC-Widgets: CallControl: DTMF digit pressed', { | ||
| module: 'call-control-dtmf-keypad.tsx', | ||
| method: 'handleDigitPress', | ||
| }); | ||
| }); | ||
| }); |
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 change adds a new cc-components keypad and changes the exported CallControl prop surface, but only the task and store module specs were updated;
packages/contact-center/cc-components/ai-docs/cc-components-spec.mdremains unchanged. Update the owning module spec and public-contract documentation in this change so consumers and validators do not retain the old CallControl contract.AGENTS.md reference: AGENTS.md:L68-L68
Useful? React with 👍 / 👎.