Skip to content

Commit 80b0bff

Browse files
author
molker
committed
PR Comments
1 parent d4eafe6 commit 80b0bff

6 files changed

Lines changed: 24 additions & 21 deletions

File tree

packages/contact-center/cc-components/src/components/task/OutdialCall/outdial-call.style.scss

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
align-items: center;
55
border-radius: 0.625rem;
66
width: 15.625rem;
7+
78

89
mdc-input {
910
padding-bottom: 0; // default is 1 rem, 1.5 rem needed but provided by .keys
@@ -13,14 +14,9 @@
1314
margin-bottom: 1rem;
1415
}
1516

16-
.input {
17+
.outdial-input {
1718
width: 100%;
1819
}
19-
20-
.button {
21-
width: 2.5rem;
22-
height: 2.5rem;
23-
}
2420

2521
.keys {
2622
display: grid;

packages/contact-center/cc-components/src/components/task/OutdialCall/outdial-call.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ interface OutdialANIEntry {
4040
* @property startOutdial - Function to initiate the outdial call with the entered destination number.
4141
*/
4242
const OutdialCallComponent: React.FunctionComponent<OutdialCallComponentProps> = (props) => {
43-
const {startOutdial, getOutdialANIEntries} = props;
43+
const {logger, startOutdial, getOutdialANIEntries} = props;
4444

4545
// State Hooks
4646
const [destination, setDestination] = useState('');
@@ -62,7 +62,7 @@ const OutdialCallComponent: React.FunctionComponent<OutdialCallComponentProps> =
6262
const result = await getOutdialANIEntries();
6363
setOutdialANIList(result);
6464
} catch (error) {
65-
console.error('Error fetching outdial ANI entries:', error);
65+
logger?.error('Error fetching outdial ANI entries:', error);
6666
setOutdialANIList([]);
6767
}
6868
};
@@ -83,11 +83,11 @@ const OutdialCallComponent: React.FunctionComponent<OutdialCallComponentProps> =
8383
};
8484

8585
/**
86-
* handleKeyPress
86+
* handleOnClick
8787
* @param value The key value pressed
8888
* Appends the pressed key to the destination input field
8989
*/
90-
const handleKeyPress = (value: string) => {
90+
const handleOnClick = (value: string) => {
9191
setDestination(destination + value);
9292
validateOutboundNumber(destination + value);
9393
};
@@ -105,7 +105,7 @@ const OutdialCallComponent: React.FunctionComponent<OutdialCallComponentProps> =
105105
></Tab>
106106
</header>
107107
<Input
108-
className="input"
108+
className="outdial-input"
109109
id="outdial-number-input"
110110
name="outdial-number-input"
111111
data-testid="outdial-number-input"
@@ -122,14 +122,14 @@ const OutdialCallComponent: React.FunctionComponent<OutdialCallComponentProps> =
122122
<ul className="keys">
123123
{KEY_LIST.map((key) => (
124124
<li key={key}>
125-
<Button className="key button" onClick={() => handleKeyPress(key)}>
125+
<Button className="key button" onClick={() => handleOnClick(key)}>
126126
{key}
127127
</Button>
128128
</li>
129129
))}
130130
</ul>
131131
<Select
132-
className="input"
132+
className="outdial-input"
133133
label={OutdialStrings.ANI_SELECT_LABEL}
134134
id="outdial-ani-option"
135135
name="outdial-ani-option-select"
@@ -155,10 +155,10 @@ const OutdialCallComponent: React.FunctionComponent<OutdialCallComponentProps> =
155155
</Select>
156156
<Button
157157
data-testid="outdial-call-button"
158-
className="button"
159158
prefixIcon={'handset-regular'}
160159
onClick={() => startOutdial(destination, selectedANI)}
161160
disabled={!!isValidNumber || !destination}
161+
size={40}
162162
/>
163163
</article>
164164
);

packages/contact-center/cc-components/src/components/task/task.types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ export interface OutdialCallProps {
496496
logger: ILogger;
497497
}
498498

499-
export type OutdialCallComponentProps = Pick<OutdialCallProps, 'startOutdial' | 'getOutdialANIEntries'>;
499+
export type OutdialCallComponentProps = Pick<OutdialCallProps, 'logger' | 'startOutdial' | 'getOutdialANIEntries'>;
500500

501501
/**
502502
* Interface representing the properties for CallControlListItem component.

packages/contact-center/cc-components/tests/components/task/OutdialCall/out-dial-call.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,33 @@ import {render, fireEvent, screen, waitFor} from '@testing-library/react';
33
import '@testing-library/jest-dom';
44
import OutdialCallComponent from '../../../../src/components/task/OutdialCall/outdial-call';
55
import store from '@webex/cc-store';
6+
import type {ILogger} from '@webex/cc-store';
67

78
describe('OutdialCallComponent', () => {
89
const mockStartOutdial = jest.fn();
910
const mockGetOutdialANIEntries = jest.fn().mockReturnValue([
1011
{name: 'name 1', number: '1'},
1112
{name: 'name 2', number: '2'},
1213
]);
13-
const KEY_LIST = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '*', '0', '#'];
14-
let customEvent;
15-
16-
// Prevent warning 'CC-Widgets: UI Metrics: No logger found'
17-
store.store.logger = {
14+
const mockLogger: ILogger = {
1815
log: jest.fn(),
1916
info: jest.fn(),
2017
warn: jest.fn(),
2118
error: jest.fn(),
2219
trace: jest.fn(),
2320
};
21+
const KEY_LIST = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '*', '0', '#'];
22+
let customEvent;
23+
24+
// Prevent warning 'CC-Widgets: UI Metrics: No logger found'
25+
store.store.logger = mockLogger;
2426

2527
beforeEach(() => {
2628
jest.clearAllMocks();
2729
});
2830

2931
const props = {
32+
logger: mockLogger,
3033
startOutdial: mockStartOutdial,
3134
getOutdialANIEntries: mockGetOutdialANIEntries,
3235
};

packages/contact-center/task/src/OutdialCall/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const OutdialCallInternal: React.FunctionComponent = observer(() => {
1010

1111
const result = useOutdialCall({cc, logger});
1212
const props = {
13+
logger,
1314
...result,
1415
};
1516

packages/contact-center/task/src/helper.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,10 @@ export const useOutdialCall = (props: useOutdialCallProps) => {
874874
const getOutdialANIEntries = async () => {
875875
try {
876876
const agentProfile = cc.agentConfig;
877-
const outdialANIId = agentProfile?.outdialANIId || '';
877+
const outdialANIId = agentProfile?.outdialANIId;
878+
if (!outdialANIId) {
879+
throw Error('No OutdialANI Id received.');
880+
}
878881
const result = await cc.getOutdialAniEntries({outdialANI: outdialANIId});
879882
return result;
880883
} catch (error) {

0 commit comments

Comments
 (0)