Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
aaadc2c
fix(tooling): fix non-strict types in ccwidgets
Shreyas281299 Jun 25, 2025
93b8b19
fix(user-state): setup proper types
Shreyas281299 Jun 27, 2025
95c6c9f
fix(cc-widgets): update package json test command to test types in te…
Shreyas281299 Jul 1, 2025
22cd406
fix(cc-components): fix types in test files
Shreyas281299 Jul 1, 2025
3a23ad7
fix(st-cc) fix and check types in cc-components and station login
Shreyas281299 Jul 1, 2025
ec89fa3
feat(contact-center): add complete typing in widgets
Shreyas281299 Jul 4, 2025
e66a7ce
Merge remote-tracking branch 'upstream/ccwidgets' into fix-types
Shreyas281299 Jul 4, 2025
e60dc5c
fix(station-login): fix station login success response type
Shreyas281299 Jul 4, 2025
bb2940f
fix(cc-widgets): fix types in ccwidgets pacakge
Shreyas281299 Jul 8, 2025
f76d557
fix(cc-widgets): review comments
Shreyas281299 Jul 8, 2025
13b133d
fix(test-fixrtures) create new test fixtures package
Shreyas281299 Jul 8, 2025
ceb69da
fix(tooling): add test for deny list in publish
Shreyas281299 Jul 8, 2025
58feae4
Merge remote-tracking branch 'upstream/ccwidgets' into fix-types
Shreyas281299 Jul 15, 2025
139f307
fix(tooling): working types without HMR
Shreyas281299 Jul 15, 2025
60a8c3b
fix(tooling): fix type errors due to moduleResolution
Shreyas281299 Jul 15, 2025
5d6c359
fix(cc-widgets): review comments
Shreyas281299 Jul 15, 2025
fb6b254
Merge remote-tracking branch 'upstream/ccwidgets' into fix-types
Shreyas281299 Jul 16, 2025
f15b833
fix(store): fix incoming task becoming current task issue
Shreyas281299 Jul 16, 2025
c752335
Merge branch 'ccwidgets' into fix-types
Shreyas281299 Jul 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ reports/
!package.json
!package-lock.json
!tsconfig.json
!tsconfig.test.json

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not ignoring tsconfig.test.json. Will explain why this has been added in this file.

node_modules/
.yarn/*
!.yarn/releases
Expand Down
5 changes: 3 additions & 2 deletions packages/contact-center/cc-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"description": "Webex Contact Center UI Components Library for your custom contact center solutions",
"version": "1.28.0-ccwidgets.85",
"main": "dist/index.js",
"types": "dist/types/index.d.ts",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this to point to types, so that when this is consumed it is consumed with proper types

"publishConfig": {
"access": "public"
},
Expand All @@ -20,7 +21,7 @@
"build": "yarn run -T tsc",
"build:src": "yarn run clean:dist && webpack",
"build:watch": "webpack --watch",
"test:unit": "jest --coverage",
"test:unit": "tsc --project tsconfig.test.json && jest --coverage",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While building - build:src uses webpack and webpack confirms that the types are correct
While testing - running tsc with a tsconfig.test.json to check types (will explain the tsconfig.test.ts in the actual file)

"test:styles": "eslint"
},
"dependencies": {
Expand Down Expand Up @@ -65,4 +66,4 @@
"react": ">=18.3.1",
"react-dom": ">=18.3.1"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,3 @@ export const StationLoginLabels = {
export const SignInErrors = {
['DUPLICATE_LOCATION']: 'This extension is already in use.',
};

// Utility consts
const DIALNUMBER: string = 'AGENT_DN';
const EXTENSION: string = 'EXTENSION';
const DESKTOP: string = 'BROWSER';

const LoginOptions: {[key: string]: string} = {
[DIALNUMBER]: 'Dial Number',
[EXTENSION]: 'Extension',
[DESKTOP]: 'Desktop',
};

export {DIALNUMBER, EXTENSION, DESKTOP, LoginOptions};
Comment on lines -30 to -42

@Shreyas281299 Shreyas281299 Jul 7, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to cc-store, this is defined in cc-station-login and being used in cc-components creating a dependency and cc-component is a dependency in cc-station-login for the StationLoginComponenet hence we hade created a circular dependency

Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React, {useEffect, useState} from 'react';
import {StationLoginComponentProps} from './station-login.types';
import './station-login.style.scss';
import {DESKTOP, LoginOptions, SignInErrors, StationLoginLabels} from './constants';
import {SignInErrors, StationLoginLabels} from './constants';
import {LoginOptions, DESKTOP} from '@webex/cc-store';
Comment on lines +4 to +5

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to cc-store

import {Button, Icon, Select, Option, Text, Tooltip, Input} from '@momentum-design/components/dist/react';
import {
ccCancelButtonClicked,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {IContactCenter, StationLoginSuccess, StationLogoutSuccess, Team} from '@webex/plugin-cc';
import {ILogger} from '@webex/cc-store';
import {StationLoginSuccessResponse, LogoutSuccess} from '@webex/plugin-cc';
import {IContactCenter, ILogger} from '@webex/cc-store';
import {Team} from '@webex/plugin-cc/dist/types/types';
/**
* Interface representing the properties for the Station Login component.
*/
Expand Down Expand Up @@ -34,7 +35,7 @@ export interface IStationLoginProps {
/**
* Response data received on agent login success
*/
loginSuccess?: StationLoginSuccess;
loginSuccess?: StationLoginSuccessResponse;

@Shreyas281299 Shreyas281299 Jul 7, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the response of stationLogin method in the SDK


/**
* Error received on agent login failure
Expand All @@ -44,7 +45,7 @@ export interface IStationLoginProps {
/**
* Response data received on agent login success
*/
logoutSuccess?: StationLogoutSuccess;
logoutSuccess?: LogoutSuccess;

@Shreyas281299 Shreyas281299 Jul 7, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This type is response type of stationLogout in the SDK


/**
* Flag to indicate if the agent is logged in
Expand Down Expand Up @@ -199,11 +200,6 @@ export interface IStationLoginProps {
* The selected team ID for login
*/
selectedTeamId: string;

/**
* The selected option for login type (e.g., 'Extension', 'Agent DN', etc.)
*/
selectedOption: string;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not being used

}

export interface LoginOptionsState {
Expand Down Expand Up @@ -245,5 +241,4 @@ export type StationLoginComponentProps = Pick<
| 'setDialNumberValue'
| 'setSelectedTeamId'
| 'selectedTeamId'
| 'selectedOption'
>;
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {useRef} from 'react';
import {DESKTOP, DIALNUMBER, LoginOptions, StationLoginLabels} from './constants';
import {StationLoginLabels} from './constants';
import {LoginOptions, DESKTOP, DIALNUMBER} from '@webex/cc-store';

const handleModals = (
modalRef,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, {useMemo} from 'react';

import {IUserState, AgentUserState} from './user-state.types';
import {AgentUserState, UserStateComponentsProps} from './user-state.types';

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IUserState is the base type with all props (for hooks and presentational), UserStateComponentsPrps is a subset of IUserState

import {formatTime} from '../../utils';

import './user-state.scss';
Expand All @@ -9,7 +9,7 @@ import {Item} from '@react-stately/collections';
import {Icon, Tooltip} from '@momentum-design/components/dist/react';
import {userStateLabels} from './constant';

const UserStateComponent: React.FunctionComponent<IUserState> = (props) => {
const UserStateComponent: React.FunctionComponent<UserStateComponentsProps> = (props) => {
const {
idleCodes,
setAgentStatus,
Expand All @@ -26,15 +26,16 @@ const UserStateComponent: React.FunctionComponent<IUserState> = (props) => {
}, [idleCodes]);

let selectedKey;
if (customState) {
if (customState && 'developerName' in customState) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

customState is ICustomState| IdleCodes.

Typescript is unable to identify if we are using type IdleCode or type ICustomeState, so to help typescript we add this 'developerName' in customState to help typescript know the type is ICustomeState

Have done this alot in this file.

selectedKey = `hide-${customState.developerName}`;
} else {
selectedKey = currentState;
}

const items = customState
? [{name: customState.name, id: `hide-${customState.developerName}`, developerName: customState.developerName}]
: [];
const items =
customState && 'developerName' in customState
? [{name: customState.name, id: `hide-${customState.developerName}`, developerName: customState.developerName}]
: [];

for (const item of idleCodes) {
if (item.name === AgentUserState.RONA && item.id === currentState) {
Expand All @@ -43,6 +44,8 @@ const UserStateComponent: React.FunctionComponent<IUserState> = (props) => {
if (item.name === AgentUserState.RONA && item.id !== currentState) {
continue; // Skip RONA unless it matches the current state
}

//@ts-expect-error: To be fixed in SDK - https://jira-eng-sjc12.cisco.com/jira/browse/CAI-6762

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have created this ticket to fix types in SDK, we should get this items type from SDK. it is the type for custom state and idle code.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to revist this @mkesavan13

items.push({
...item,
id: item.name === AgentUserState.RONA ? `hide-${item.id}` : item.id,
Expand Down Expand Up @@ -79,7 +82,7 @@ const UserStateComponent: React.FunctionComponent<IUserState> = (props) => {
};

const getTooltipText = () => {
if (customState && customState.developerName === 'ENGAGED') {
if (customState && 'developerName' in customState && customState.developerName === 'ENGAGED') {
const currentStateObj = idleCodes.find((item) => item.id === currentState);

if (currentStateObj.name === AgentUserState.Available) {
Expand Down Expand Up @@ -123,6 +126,7 @@ const UserStateComponent: React.FunctionComponent<IUserState> = (props) => {
>
{(item) => {
const isRonaOrEngaged = [AgentUserState.RONA, AgentUserState.Engaged].includes(
//@ts-expect-error To be fixed in SDK - https://jira-eng-sjc12.cisco.com/jira/browse/CAI-6762
idleCodes.find((code) => code.id === currentState)?.name || ''
);
const shouldHighlight = currentState === item.id || (isRonaOrEngaged && item.id === previousSelectableState);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {IdleCode, ICustomState, ILogger} from '@webex/cc-store';
import {IdleCode, ICustomState, ILogger, IContactCenter} from '@webex/cc-store';

/**
* Interface representing the state of a user.
Expand All @@ -24,11 +24,6 @@ export interface IUserState {
*/
isSettingAgentStatus: boolean;

/**
* The error message to display
*/
errorMessage: string;

/**
* The duration of the current user state
*/
Expand All @@ -55,18 +50,49 @@ export interface IUserState {
currentTheme: string;

/**
* Function to handle state change
* @param state The state to change to

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix the other borken types in user-state

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed all types in user-state

* @returns void
* Logger instance
*/
onStateChange: (state: string) => void;
logger: ILogger;

/**
* Logger instance
* Callback function to be called when the state changes.
* @param state The new state.
*/
logger: ILogger;
onStateChange?: (arg: IdleCode | ICustomState) => void;

/**
* The agent ID.
*/
agentId: string;

/**
* CC SDK Instance.
*/
cc: IContactCenter;

/**
* The timestamp of the last state change.
*/
lastStateChangeTimestamp?: number;

/**
* The timestamp of the last idle code change.
*/
lastIdleCodeChangeTimestamp?: number;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These all were missing

}

export type UserStateComponentsProps = Pick<
IUserState,
| 'idleCodes'
| 'setAgentStatus'
| 'isSettingAgentStatus'
| 'elapsedTime'
| 'lastIdleStateChangeElapsedTime'
| 'currentState'
| 'customState'
| 'logger'
>;

export enum AgentUserState {
Available = 'Available',
RONA = 'RONA',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import React, {useEffect, useState} from 'react';

import {CallControlComponentProps, DestinationType, CallControlMenuType} from '../task.types';
import {CallControlComponentProps, CallControlMenuType} from '../task.types';
import './call-control.styles.scss';
import {PopoverNext, TooltipNext, Text, ButtonCircle} from '@momentum-ui/react-collaboration';
import {Icon, Button, Select, Option} from '@momentum-design/components/dist/react';
import ConsultTransferPopoverComponent from './CallControlCustom/consult-transfer-popover';
import AutoWrapupTimer from '../AutoWrapupTimer/AutoWrapupTimer';
import type {MEDIA_CHANNEL as MediaChannelType} from '../task.types';
import {getMediaTypeInfo} from '../../../utils';
import {DestinationType} from '@webex/cc-store';
import {
RESUME_CALL,
HOLD_CALL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ const CallControlCADComponent: React.FC<CallControlComponentProps> = (props) =>
const mediaChannel = currentTask.data.interaction.mediaType as MediaChannelType;
const isSocial = mediaChannel === MediaChannelType.SOCIAL;
const isTelephony = mediaChannel === MediaChannelType.TELEPHONY;

//@ts-expect-error To be fixed in SDK - https://jira-eng-sjc12.cisco.com/jira/browse/CAI-6762
const customerName = currentTask?.data?.interaction?.callAssociatedDetails?.customerName;

//@ts-expect-error To be fixed in SDK - https://jira-eng-sjc12.cisco.com/jira/browse/CAI-6762

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

callAssociatedDetails is not present in the type of ITask in the SDK

const ani = currentTask?.data?.interaction?.callAssociatedDetails?.ani;

// Create unique IDs for tooltips
Expand Down Expand Up @@ -187,12 +191,24 @@ const CallControlCADComponent: React.FC<CallControlComponentProps> = (props) =>
<div className="cad-variables">
<Text className="queue" type="body-secondary" tagName={'small'}>
<strong>{QUEUE}</strong>{' '}
<span>{currentTask?.data?.interaction?.callAssociatedDetails?.virtualTeamName || NO_TEAM_NAME}</span>
<span>
{
//@ts-expect-error To be fixed in SDK - https://jira-eng-sjc12.cisco.com/jira/browse/CAI-6762

currentTask?.data?.interaction?.callAssociatedDetails?.virtualTeamName || NO_TEAM_NAME
}
</span>
</Text>
{renderPhoneNumber()}
<Text className="rona" type="body-secondary" tagName={'small'}>
<strong>{RONA}</strong>{' '}
<span>{currentTask?.data?.interaction?.callAssociatedDetails?.ronaTimeout || NO_RONA}</span>
<span>
{
//@ts-expect-error To be fixed in SDK - https://jira-eng-sjc12.cisco.com/jira/browse/CAI-6762

currentTask?.data?.interaction?.callAssociatedDetails?.ronaTimeout || NO_RONA
}
</span>
</Text>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const IncomingTaskComponent: React.FunctionComponent<IncomingTaskComponentProps>
return <></>; // hidden component
}

//@ts-expect-error To be fixed in SDK - https://jira-eng-sjc12.cisco.com/jira/browse/CAI-6762

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

callAssociatedDetails is not present in ITask

const callAssociationDetails = incomingTask?.data?.interaction?.callAssociatedDetails;
const ani = callAssociationDetails?.ani;
const customerName = callAssociationDetails?.customerName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const TaskListComponent: React.FunctionComponent<TaskListComponentProps> = (prop
return (
<ul className="task-list" data-testid="task-list">
{Object.values(taskList)?.map((task, index) => {
//@ts-expect-error To be fixed in SDK - https://jira-eng-sjc12.cisco.com/jira/browse/CAI-6762IT

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

callAssociatedDetails not in ITask

const callAssociationDetails = task?.data?.interaction?.callAssociatedDetails;
const ani = callAssociationDetails?.ani;
const customerName = callAssociationDetails?.customerName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
ILogger,
ITask,
IContactCenter,
WrapupCodes,
IWrapupCode,
BuddyDetails,
DestinationType,
ContactServiceQueue,
Expand Down Expand Up @@ -173,7 +173,7 @@ export interface ControlProps {
* Array of wrap-up codes.
* TODO: Expose this type from SDK.
*/
wrapupCodes: WrapupCodes[];
wrapupCodes: IWrapupCode[];

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect type was assigned


/**
* Indicates if wrap-up is required.
Expand Down Expand Up @@ -503,8 +503,6 @@ export interface CallControlConsultComponentsProps {
*/
export type CallControlMenuType = 'Consult' | 'Transfer';

export {DestinationType};

export const MEDIA_CHANNEL = {
EMAIL: 'email',
CHAT: 'chat',
Expand Down
3 changes: 0 additions & 3 deletions packages/contact-center/cc-components/src/wc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,10 @@ const WebUserState = r2wc(UserStateComponent, {
idleCodes: 'json',
setAgentStatus: 'function',
isSettingAgentStatus: 'boolean',
errorMessage: 'string',
elapsedTime: 'number',
lastIdleStateChangeElapsedTime: 'number',
currentState: 'string',
customState: 'json',
currentTheme: 'string',
onStateChange: 'function',
logger: 'function',
},
});
Expand Down
Loading
Loading