Repository: webex/widgets
Pull request #449: feat(station-login): Add Validation to Station Login to Match Diverging Figma
Author: login: brain-frog
Labels: name: released on @ccwidgets
name: validated
description: Indicates that the PR is ready for actions
Created: 2025-05-08T13:32:30Z | Merged: 2025-05-09T13:50:35Z

<!--
Hey there,\
Thank you for taking the time to improve our code! 🙂\
Please let us know why this change is necessary and what testing you have performed. \
This ensures our reviewers understand the impact of your change. \

**IMPORTANT**
FAILING TO FILL OUT THIS TEMPLATE WILL RESULT IN REJECTION OF YOUR PULL REQUEST
This is for compliance purposes with FedRAMP program.
-->

# COMPLETES CAI-6176
https://jira-eng-sjc12.cisco.com/jira/browse/CAI-6176

## This pull request addresses

Dial Number and Extension not being validated prior to logging into Station Login, and errors with logging in not being displayed for troubleshooting

## by making the following changes

Adding validation consistent with Agent Desktop to Station Login and temporarily displaying API errors with Save & Continue until more specific validation messages can be shown. 

<!-- You may include screenshots -->

### Change Type

<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->

- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Documentation update
- [ ] Tooling change
- [ ] Internal code refactor

## The following scenarios were tested

- [ ] The testing is done with the amplify link
< ENUMERATE TESTS PERFORMED, WHETHER MANUAL OR AUTOMATED >

## The GAI Coding Policy And Copyright Annotation Best Practices ##
 
<!-- **MANDATORY** If Yes, Mention the GAI Coding Policy Copyright Annotation Best Practices followed separated by a comma below the yes checkbox -->
 
- [x] GAI was not used (or, no additional notation is required)
- [ ] Code was generated entirely by GAI
- [ ] GAI was used to create a draft that was subsequently customized or modified
- [ ] Coder created a draft manually that was non-substantively modified by GAI (e.g., refactoring was performed by GAI on manually written code)
- [ ] Tool used for AI assistance (GitHub Copilot / Other - specify)
  - [ ] Github Copilot
  - [ ] Other - Please Specify
- [ ] This PR is related to
  - [x] Feature
  - [ ] Defect fix
  - [ ] Tech Debt
  - [ ] Automation

### Checklist before merging

- [x] I have not skipped any automated checks
- [x] All existing and new tests passed
- [x] I have updated the testing document

---


Diff:
diff --git a/packages/contact-center/cc-components/package.json b/packages/contact-center/cc-components/package.json
index fc748b478..76bba484c 100644
--- a/packages/contact-center/cc-components/package.json
+++ b/packages/contact-center/cc-components/package.json
@@ -75,4 +75,4 @@
     "react": ">=18.3.1",
     "react-dom": ">=18.3.1"
   }
-}
\ No newline at end of file
+}
diff --git a/packages/contact-center/cc-components/src/components/StationLogin/constants.ts b/packages/contact-center/cc-components/src/components/StationLogin/constants.ts
index aaef6050e..8a3dbe6b8 100644
--- a/packages/contact-center/cc-components/src/components/StationLogin/constants.ts
+++ b/packages/contact-center/cc-components/src/components/StationLogin/constants.ts
@@ -5,7 +5,7 @@ export const StationLoginLabels = {
   MULTIPLE_SIGN_IN_ALERT_TITLE: 'Multiple Sign In Alert',
   CONTINUE: 'Continue',
   CANCEL: 'Cancel',
-  SIGN_OUT: 'Sign out',
+  SIGN_OUT: 'Sign Out',
   LOGOUT: 'Logout',
   SAVE_AND_CONTINUE: 'Save & Continue',
   CC_SIGN_OUT: 'Sign out of Contact Center',
@@ -14,6 +14,14 @@ export const StationLoginLabels = {
   HANDLE_CALLS: 'Handle calls using',
   HANDLE_CALLS_TOOLTIP:
     'This is your preferred method for receiving and making calls. Choose between your phone number, extension (if available), or your web browser.',
+  YOUR_TEAM: 'Your Team',
+  IS_REQUIRED: ' is required',
+  DN_FORMAT_ERROR: 'Enter a valid US dial number. For help, reach out to your administrator or support team.',
+  DEFAULT_ERROR: 'Error logging in: ',
+};
+
+export const SignInErrors = {
+  ['DUPLICATE_LOCATION']: 'This extension is already in use.',
 };
 
 // Utility consts
diff --git a/packages/contact-center/cc-components/src/components/StationLogin/station-login.style.scss b/packages/contact-center/cc-components/src/components/StationLogin/station-login.style.scss
index cb0dd86da..b59aaedab 100644
--- a/packages/contact-center/cc-components/src/components/StationLogin/station-login.style.scss
+++ b/packages/contact-center/cc-components/src/components/StationLogin/station-login.style.scss
@@ -127,4 +127,8 @@ mdc-select, mdc-input {
   display: flex;
   justify-content: flex-end; // Aligns the button to the right
   gap: 0.5rem;
+}
+
+.error-text-color {
+  color: var(--color-theme-text-error-normal, #AB0A15);
 }
\ No newline at end of file
diff --git a/packages/contact-center/cc-components/src/components/StationLogin/station-login.tsx b/packages/contact-center/cc-components/src/components/StationLogin/station-login.tsx
index 2cbdeb837..c76503e3e 100644
--- a/packages/contact-center/cc-components/src/components/StationLogin/station-login.tsx
+++ b/packages/contact-center/cc-components/src/components/StationLogin/station-login.tsx
@@ -1,7 +1,7 @@
 import React, {useEffect, useState, useRef, useCallback} from 'react';
 import {StationLoginComponentProps} from './station-login.types';
 import './station-login.style.scss';
-import {DESKTOP, LoginOptions, StationLoginLabels} from './constants';
+import {DESKTOP, DIALNUMBER, LoginOptions, SignInErrors, StationLoginLabels} from './constants';
 import {Button, Icon, Select, Option, Text, Tooltip, Input} from '@momentum-design/components/dist/react';
 
 const StationLoginComponent: React.FunctionComponent<StationLoginComponentProps> = (props) => {
@@ -10,12 +10,14 @@ const StationLoginComponent: React.FunctionComponent<StationLoginComponentProps>
     loginOptions,
     login,
     logout,
+    loginFailure,
     setDeviceType,
     setDialNumber,
     setTeam,
     isAgentLoggedIn,
     deviceType,
     dialNumber,
+    dialNumberRegex,
     showMultipleLoginAlert,
     handleContinue,
     onCCSignOut,
@@ -28,6 +30,8 @@ const StationLoginComponent: React.FunctionComponent<StationLoginComponentProps>
   const [dialNumberValue, setDialNumberValue] = useState<string>(dialNumber || '');
   const [showCCSignOutModal, setShowCCSignOutModal] = useState<boolean>(false);
   const [selectedDeviceType, setSelectedDeviceType] = useState<string>(deviceType || '');
+  const [showDNError, setShowDNError] = useState<boolean>(false);
+  const [dnErrorText, setDNErrorText] = useState<string>('');
 
   // useEffect to be called on mount
   useEffect(() => {
@@ -80,6 +84,20 @@ const StationLoginComponent: React.FunctionComponent<StationLoginComponentProps>
     }
   };
 
+  /**
+   * Runs validation tests on a string given as a Dial Number
+   * @param {string} input
+   * @returns {boolean} whether or not to show a validation error
+   */
+  const validateDialNumber = (input: string): boolean => {
+    const regexForDn = new RegExp(dialNumberRegex ?? '1[0-9]{3}[2-9][0-9]{6}([,]{1,10}[0-9]+){0,1}');
+    if (regexForDn.test(input)) {
+      return false;
+    }
+    setDNErrorText(StationLoginLabels.DN_FORMAT_ERROR);
+    return true;
+  };
+
   return (
     <>
       {/* TODO: Replace dialog with momentum-design modal component once available */}
@@ -134,13 +152,14 @@ const StationLoginComponent: React.FunctionComponent<StationLoginComponentProps>
                 onChange={(event: CustomEvent) => {
                   const selectedOption = event.detail.value;
                   // TODO: Select component is calling onChange with first label on load
-                  // TODO: add bug issue link once created
+                  // bug ticket: https://jira-eng-gpk2.cisco.com/jira/browse/MOMENTUM-668
                   if (Object.keys(LoginOptions).includes(selectedOption)) {
                     setDeviceType(selectedOption);
                     setSelectedDeviceType(selectedOption);
                     updateDialNumberLabel(selectedOption);
                     // clear dial number when switching between DN and Extension
                     setDialNumber('');
+                    setShowDNError(false);
                   }
                 }}
                 value={selectedDeviceType}
@@ -167,25 +186,36 @@ const StationLoginComponent: React.FunctionComponent<StationLoginComponentProps>
               placeholder={dialNumberPlaceholder}
               value={dialNumberValue}
               onChange={(event) => {
-                const newDialNumber = (event.target as HTMLInputElement).value;
-                setDialNumberValue(newDialNumber);
-                setDialNumber(newDialNumber);
+                const input = (event.target as HTMLInputElement).value.trim();
+                setDialNumberValue(input);
+                setDialNumber(input);
+
+                // validation
+                if (input.length === 0) {
+                  // show error for empty string
+                  setDNErrorText(`${LoginOptions[selectedDeviceType]} ${StationLoginLabels.IS_REQUIRED}`);
+                  setShowDNError(true);
+                } else if (selectedDeviceType === DIALNUMBER) {
+                  setShowDNError(validateDialNumber(input));
+                } else {
+                  setShowDNError(false);
+                }
               }}
-              helpText={dialNumberValue.length === 0 ? `${dialNumberLabel} is required` : undefined}
-              helpTextType={dialNumberValue.length === 0 ? 'error' : undefined}
+              helpText={showDNError ? dnErrorText : undefined}
+              helpTextType={showDNError ? 'error' : undefined}
             />
           )}
 
           <div className="select-container">
             <Select
-              label="Your Team"
+              label={StationLoginLabels.YOUR_TEAM}
               id="teams-dropdown"
               name="teams-dropdown"
               onChange={(event: CustomEvent) => {
                 setTeam(event.detail.value);
               }}
               className="station-login-select"
-              placeholder="Your Team"
+              placeholder={StationLoginLabels.YOUR_TEAM}
             >
               {teams.map((team: {id: string; name: string}, index: number) => {
                 return (
@@ -197,13 +227,20 @@ const StationLoginComponent: React.FunctionComponent<StationLoginComponentProps>
             </Select>
           </div>
 
+          {loginFailure && (
+            <Text className="error-text-color" type={'body-midsize-regular'}>
+              {SignInErrors[loginFailure.message] ?? StationLoginLabels.DEFAULT_ERROR}
+            </Text>
+          )}
           <div className="btn-container">
             {isAgentLoggedIn ? (
               <Button id="logoutAgent" onClick={logout} color="positive">
                 {StationLoginLabels.SIGN_OUT}
               </Button>
             ) : (
-              <Button onClick={login}>{StationLoginLabels.SAVE_AND_CONTINUE}</Button>
+              <Button onClick={login} disabled={showDNError}>
+                {StationLoginLabels.SAVE_AND_CONTINUE}
+              </Button>
             )}
             {onCCSignOut && (
               <Button onClick={() => setShowCCSignOutModal(true)} variant="secondary" className="white-button">
diff --git a/packages/contact-center/cc-components/src/components/StationLogin/station-login.types.ts b/packages/contact-center/cc-components/src/components/StationLogin/station-login.types.ts
index 9866e387e..cd3eab0a2 100644
--- a/packages/contact-center/cc-components/src/components/StationLogin/station-login.types.ts
+++ b/packages/contact-center/cc-components/src/components/StationLogin/station-login.types.ts
@@ -61,6 +61,11 @@ export interface IStationLoginProps {
    */
   dialNumber: string;
 
+  /**
+   * The regex provided by the API for validating Dial Number
+   */
+  dialNumberRegex?: RegExp | string;
+
   /**
    * Callback function to be invoked once the agent login is successful
    */
@@ -123,6 +128,7 @@ export type StationLoginComponentProps = Pick<
   | 'handleContinue'
   | 'deviceType'
   | 'dialNumber'
+  | 'dialNumberRegex'
   | 'showMultipleLoginAlert'
   | 'onCCSignOut'
 >;
diff --git a/packages/contact-center/cc-components/tests/components/StationLogin/station-login.tsx b/packages/contact-center/cc-components/tests/components/StationLogin/station-login.tsx
index ec5856a3d..5f374262e 100644
--- a/packages/contact-center/cc-components/tests/components/StationLogin/station-login.tsx
+++ b/packages/contact-center/cc-components/tests/components/StationLogin/station-login.tsx
@@ -29,6 +29,7 @@ describe('StationLoginComponent', () => {
     isAgentLoggedIn: false,
     deviceType: '',
     dialNumber: '',
+    dialNumberRegex: '',
     showMultipleLoginAlert: false,
     handleContinue: jest.fn(),
     modalRef: React.createRef<HTMLDialogElement>(),
diff --git a/packages/contact-center/station-login/package.json b/packages/contact-center/station-login/package.json
index 453d77007..c2f02391e 100644
--- a/packages/contact-center/station-login/package.json
+++ b/packages/contact-center/station-login/package.json
@@ -73,4 +73,4 @@
       "^.+\\.(css|less|scss)$": "babel-jest"
     }
   }
-}
\ No newline at end of file
+}
diff --git a/packages/contact-center/station-login/src/helper.ts b/packages/contact-center/station-login/src/helper.ts
index 7949e5fc2..aad82ce2c 100644
--- a/packages/contact-center/station-login/src/helper.ts
+++ b/packages/contact-center/station-login/src/helper.ts
@@ -72,12 +72,14 @@ export const useStationLogin = (props: UseStationLoginProps) => {
     cc.stationLogin({teamId: team, loginOption: deviceType, dialNumber: dialNumber})
       .then((res: StationLoginSuccess) => {
         setLoginSuccess(res);
+        setLoginFailure(undefined);
       })
       .catch((error: Error) => {
         logger.error(`Error logging in: ${error}`, {
           module: 'widget-station-login#helper.ts',
           method: 'login',
         });
+        setLoginSuccess(undefined);
         setLoginFailure(error);
       });
   };
diff --git a/packages/contact-center/station-login/src/station-login/index.tsx b/packages/contact-center/station-login/src/station-login/index.tsx
index 942eae490..4f89bdbb3 100644
--- a/packages/contact-center/station-login/src/station-login/index.tsx
+++ b/packages/contact-center/station-login/src/station-login/index.tsx
@@ -28,6 +28,7 @@ const StationLogin: React.FunctionComponent<StationLoginProps> = observer(({onLo
     dialNumber,
   });
 
+  const dialNumberRegex = cc?.agentConfig?.regexUS;
   const props = {
     ...result,
     setDeviceType,
@@ -36,6 +37,7 @@ const StationLogin: React.FunctionComponent<StationLoginProps> = observer(({onLo
     loginOptions,
     deviceType,
     dialNumber,
+    dialNumberRegex,
     isAgentLoggedIn,
     showMultipleLoginAlert,
     onCCSignOut,
diff --git a/packages/contact-center/station-login/tests/helper.ts b/packages/contact-center/station-login/tests/helper.ts
index 8740422df..745bf65ae 100644
--- a/packages/contact-center/station-login/tests/helper.ts
+++ b/packages/contact-center/station-login/tests/helper.ts
@@ -61,7 +61,7 @@ describe('useStationLogin Hook', () => {
     logger.error.mockClear();
   });
 
-  it('should set loginSuccess on successful login', async () => {
+  it('should set loginSuccess on successful login and set loginFailure to undefined', async () => {
     const successResponse = {
       data: {
         agentId: '6b310dff-569e-4ac7-b064-70f834ea56d8',
diff --git a/packages/contact-center/station-login/tests/station-login/index.tsx b/packages/contact-center/station-login/tests/station-login/index.tsx
index e485aae9d..8151eaa75 100644
--- a/packages/contact-center/station-login/tests/station-login/index.tsx
+++ b/packages/contact-center/station-login/tests/station-login/index.tsx
@@ -12,6 +12,7 @@ const ccMock = {
 const loginOptionsMock = ['EXTENSION', 'AGENT_DN', 'BROWSER'];
 const deviceTypeMock = 'BROWSER';
 const dialNumberMock = '12345';
+const dialNumberRegexMock = '1[0-9]{3}[2-9][0-9]{6}([,]{1,10}[0-9]+){0,1}';
 const loggerMock = {};
 const isAgentLoggedInMock = false;
 
@@ -26,6 +27,7 @@ jest.mock('@webex/cc-store', () => {
     loginOptions: loginOptionsMock,
     deviceType: deviceTypeMock,
     dialNumber: dialNumberMock,
+    dialNumberRegex: dialNumberRegexMock,
     logger: loggerMock,
     isAgentLoggedIn: isAgentLoggedInMock,
     setCCCallback: jest.fn(),


Reviews:
user: login: coderabbitai[bot]
body: **Actionable comments posted: 2**

<details>
<summary>🧹 Nitpick comments (1)</summary><blockquote>

<details>
<summary>packages/contact-center/station-login/src/station-login/index.tsx (1)</summary><blockquote>

`31-31`: **Consider adding a fallback regex pattern.**

The code retrieves the regex pattern from `cc?.agentConfig?.regexUS`, but there's no fallback if this value is undefined. This could lead to validation not working properly if the configuration is missing.

```diff
-  const dialNumberRegex = cc?.agentConfig?.regexUS;
+  const dialNumberRegex = cc?.agentConfig?.regexUS || /^\+?1?\d{10}$/; // Fallback to basic 10-digit US number format
```

</blockquote></details>

</blockquote></details>

<details>
<summary>📜 Review details</summary>

**Configuration used: .coderabbit.yaml**
**Review profile: CHILL**
**Plan: Pro**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 8cb7bcefc44c7b1592edb76b7ea1c22a55567281 and 63e5e5c6b425f4bddd23cb2903631891784b9e2b.

</details>

<details>
<summary>📒 Files selected for processing (8)</summary>

* `packages/contact-center/cc-components/package.json` (1 hunks)
* `packages/contact-center/cc-components/src/components/StationLogin/constants.ts` (2 hunks)
* `packages/contact-center/cc-components/src/components/StationLogin/station-login.style.scss` (1 hunks)
* `packages/contact-center/cc-components/src/components/StationLogin/station-login.tsx` (7 hunks)
* `packages/contact-center/cc-components/src/components/StationLogin/station-login.types.ts` (2 hunks)
* `packages/contact-center/station-login/package.json` (1 hunks)
* `packages/contact-center/station-login/src/helper.ts` (1 hunks)
* `packages/contact-center/station-login/src/station-login/index.tsx` (2 hunks)

</details>

<details>
<summary>🧰 Additional context used</summary>

<details>
<summary>🧠 Learnings (1)</summary>

<details>
<summary>packages/contact-center/cc-components/src/components/StationLogin/station-login.style.scss (1)</summary>

```
Learnt from: Kesari3008
PR: webex/widgets#239
File: packages/contact-center/station-login/src/station-login/styles.module.scss:0-0
Timestamp: 2024-11-19T13:35:53.226Z
Learning: The code in 'packages/contact-center/station-login/src/station-login/styles.module.scss' is temporary and is going to be removed.
```

</details>

</details><details>
<summary>🧬 Code Graph Analysis (2)</summary>

<details>
<summary>packages/contact-center/station-login/src/station-login/index.tsx (1)</summary><blockquote>

<details>
<summary>packages/contact-center/store/src/storeEventsWrapper.ts (1)</summary>

* `cc` (43-45)

</details>

</blockquote></details>
<details>
<summary>packages/contact-center/cc-components/src/components/StationLogin/station-login.tsx (1)</summary><blockquote>

<details>
<summary>packages/contact-center/cc-components/src/components/StationLogin/constants.ts (4)</summary>

* `StationLoginLabels` (2-21)
* `LoginOptions` (38-38)
* `DIALNUMBER` (38-38)
* `SignInErrors` (23-25)

</details>

</blockquote></details>

</details>

</details>

<details>
<summary>🔇 Additional comments (18)</summary><blockquote>

<details>
<summary>packages/contact-center/station-login/package.json (1)</summary>

`76-76`: **Add trailing newline for consistency.**

A newline was added at EOF to align with formatting of other `package.json` files. No functional changes introduced.

</details>
<details>
<summary>packages/contact-center/cc-components/package.json (1)</summary>

`78-78`: **Add trailing newline for consistency.**

A newline was added at EOF to align with formatting of sibling `package.json` files. No dependency or script changes.

</details>
<details>
<summary>packages/contact-center/cc-components/src/components/StationLogin/constants.ts (3)</summary>

`8-8`: **Improved text capitalization consistency.**

The capitalization change from "Sign out" to "Sign Out" improves consistency in UI button text styling.

---

`17-21`: **Good addition of new string constants for validation.**

These new constants properly support the dial number validation feature and provide clear error messages for users. The implementation follows good localization practices by centralizing all text strings.

---

`23-25`: **Well-structured error handling code for specific error scenarios.**

The new `SignInErrors` object is a good approach for mapping error codes to user-friendly messages. This implementation will allow for easy expansion with additional error types in the future.

</details>
<details>
<summary>packages/contact-center/station-login/src/station-login/index.tsx (1)</summary>

`40-40`: **LGTM - Good implementation of prop passing.**

Passing the regex pattern to the `StationLoginComponent` is a clean approach, allowing for flexible validation rules defined at the configuration level.

</details>
<details>
<summary>packages/contact-center/cc-components/src/components/StationLogin/station-login.style.scss (2)</summary>

`130-130`: **Fixed missing closing brace.**

This fixes a CSS syntax error that could have affected styling throughout the application.

---

`132-134`: **Well-implemented error text styling.**

The new `.error-text-color` class properly uses the theme variable with a fallback color, which is good practice for maintaining visual consistency across the application.

</details>
<details>
<summary>packages/contact-center/station-login/src/helper.ts (1)</summary>

`75-75`: **Improved state management for login success/failure.**

These changes ensure that success and failure states are mutually exclusive, which is important for consistent UI behavior. Setting the opposite state to `undefined` when one state is set prevents potential race conditions or conflicting states.



Also applies to: 82-83

</details>
<details>
<summary>packages/contact-center/cc-components/src/components/StationLogin/station-login.types.ts (2)</summary>

`64-67`: **Props interface addition looks good.**

The addition of the optional `dialNumberRegex` property is well-documented and correctly typed as `RegExp | string` to support different ways of providing the validation pattern.

---

`131-131`: **Properly included in the component props type.**

The `dialNumberRegex` property is correctly added to the `StationLoginComponentProps` type, ensuring type safety when this prop is used in the component.

</details>
<details>
<summary>packages/contact-center/cc-components/src/components/StationLogin/station-login.tsx (7)</summary>

`4-4`: **Import of new constants is appropriate.**

Adding `DIALNUMBER` and `SignInErrors` to the imports supports the new validation and error display functionality.

---

`13-13`: **Props destructuring correctly includes new properties.**

The component now properly accepts and uses the `loginFailure` and `dialNumberRegex` props needed for validation and error handling.



Also applies to: 20-20

---

`33-34`: **Good state management for validation errors.**

The addition of these state variables provides a clean way to track and display validation errors to the user.

---

`162-162`: **Good error state clearing when changing device type.**

Clearing the error state when switching device types prevents confusing the user with stale error messages.

---

`202-203`: **Appropriate error display implementation.**

Using the Input component's built-in help text functionality with error styling provides a clean and accessible way to show validation errors.

---

`228-232`: **Well-implemented login failure message display.**

The implementation correctly:
1. Shows errors only when `loginFailure` exists
2. Uses the `SignInErrors` mapping for user-friendly messages
3. Falls back to a default error message with the original error if no mapping exists

This aligns with the PR objective of displaying API errors to help with troubleshooting.

---

`239-239`: **Good UX: Login button disabled when validation fails.**

Disabling the login button when there are validation errors prevents submission of invalid data and improves user experience.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->
state: COMMENTED
author_association: NONE
submitted_at: 2025-05-09T11:11:48Z
user: login: mkesavan13
body: Changes mostly look good to me. I just have one comment below about updating tests and some more here:
* Please add the Vidcast that you created in the PR description. 
* Address any valid comments that came from Code Rabbit
* Update the branch before merging

Approving
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-05-09T11:14:25Z
user: login: Shreyas281299
body: Most look good. Just a few comments
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-05-09T12:44:07Z
user: login: brain-frog
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-09T13:39:06Z
user: login: Shreyas281299
body: Looks good 
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-09T13:48:26Z

Review comments:
diff_hunk: @@ -72,12 +72,14 @@ export const useStationLogin = (props: UseStationLoginProps) => {
     cc.stationLogin({teamId: team, loginOption: deviceType, dialNumber: dialNumber})
       .then((res: StationLoginSuccess) => {
         setLoginSuccess(res);
+        setLoginFailure(undefined);
       })
       .catch((error: Error) => {
         logger.error(`Error logging in: ${error}`, {
           module: 'widget-station-login#helper.ts',
           method: 'login',
         });
+        setLoginSuccess(undefined);
path: packages/contact-center/station-login/src/helper.ts
user: login: mkesavan13
body: Could you please update the tests for this? Just to ensure we clear loginFailure on success and loginSuccess on failure?
created_at: 2025-05-09T11:08:35Z
author_association: CONTRIBUTOR
diff_hunk: @@ -167,25 +186,34 @@ const StationLoginComponent: React.FunctionComponent<StationLoginComponentProps>
               placeholder={dialNumberPlaceholder}
               value={dialNumberValue}
               onChange={(event) => {
-                const newDialNumber = (event.target as HTMLInputElement).value;
-                setDialNumberValue(newDialNumber);
-                setDialNumber(newDialNumber);
+                const input = (event.target as HTMLInputElement).value.trim();
+                setDialNumberValue(input);
+                setDialNumber(input);
+
+                // validation
+                if (input.length === 0) {
+                  // show error for empty string
+                  setDNErrorText(`${LoginOptions[selectedDeviceType]} ${StationLoginLabels.IS_REQUIRED}`);
+                  setShowDNError(true);
+                } else if (selectedDeviceType === DIALNUMBER) {
+                  setShowDNError(validateDialNumber(input));
+                }
path: packages/contact-center/cc-components/src/components/StationLogin/station-login.tsx
user: login: coderabbitai[bot]
body: _🛠️ Refactor suggestion_

**Thorough validation in onChange handler.**

The validation logic correctly handles:
1. Trimming input
2. Checking for empty values
3. Specific validation for dial numbers using the regex pattern

However, you should clear the error state when validation passes:


```diff
 // validation
 if (input.length === 0) {
   // show error for empty string
   setDNErrorText(`${LoginOptions[selectedDeviceType]} ${StationLoginLabels.IS_REQUIRED}`);
   setShowDNError(true);
 } else if (selectedDeviceType === DIALNUMBER) {
   setShowDNError(validateDialNumber(input));
+} else {
+  setShowDNError(false); // Clear error state for valid input
 }
```


<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion
                const input = (event.target as HTMLInputElement).value.trim();
                setDialNumberValue(input);
                setDialNumber(input);

                // validation
                if (input.length === 0) {
                  // show error for empty string
                  setDNErrorText(`${LoginOptions[selectedDeviceType]} ${StationLoginLabels.IS_REQUIRED}`);
                  setShowDNError(true);
                } else if (selectedDeviceType === DIALNUMBER) {
                  setShowDNError(validateDialNumber(input));
                } else {
                  setShowDNError(false); // Clear error state for valid input
                }
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-05-09T11:11:47Z
author_association: NONE
diff_hunk: @@ -80,6 +84,20 @@ const StationLoginComponent: React.FunctionComponent<StationLoginComponentProps>
     }
   };
 
+  /**
+   * Runs validation tests on a string given as a Dial Number
+   * @param {string} input
+   * @returns {boolean} whether or not to show a validation error
+   */
+  const validateDialNumber = (input: string): boolean => {
+    const regexForDn = new RegExp(dialNumberRegex);
+    if (regexForDn.test(input)) {
+      return false;
+    }
+    setDNErrorText(StationLoginLabels.DN_FORMAT_ERROR);
+    return true;
+  };
path: packages/contact-center/cc-components/src/components/StationLogin/station-login.tsx
user: login: coderabbitai[bot]
body: _⚠️ Potential issue_

**Add null check for dialNumberRegex.**

The function creates a new RegExp without checking if `dialNumberRegex` is defined. Since this prop is optional, this could cause a runtime error if it's not provided.


```diff
 const validateDialNumber = (input: string): boolean => {
+  if (!dialNumberRegex) {
+    return false; // No validation if regex not provided
+  }
   const regexForDn = new RegExp(dialNumberRegex);
   if (regexForDn.test(input)) {
     return false;
   }
   setDNErrorText(StationLoginLabels.DN_FORMAT_ERROR);
   return true;
 };
```


<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion
  /**
   * Runs validation tests on a string given as a Dial Number
   * @param {string} input
   * @returns {boolean} whether or not to show a validation error
   */
  const validateDialNumber = (input: string): boolean => {
    if (!dialNumberRegex) {
      return false; // No validation if regex not provided
    }
    const regexForDn = new RegExp(dialNumberRegex);
    if (regexForDn.test(input)) {
      return false;
    }
    setDNErrorText(StationLoginLabels.DN_FORMAT_ERROR);
    return true;
  };
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-05-09T11:11:48Z
author_association: NONE
diff_hunk: @@ -80,6 +84,20 @@ const StationLoginComponent: React.FunctionComponent<StationLoginComponentProps>
     }
   };
 
+  /**
+   * Runs validation tests on a string given as a Dial Number
+   * @param {string} input
+   * @returns {boolean} whether or not to show a validation error
+   */
+  const validateDialNumber = (input: string): boolean => {
+    const regexForDn = new RegExp(dialNumberRegex);
path: packages/contact-center/cc-components/src/components/StationLogin/station-login.tsx
user: login: Shreyas281299
body: since dialNumberRegex is optional we should do a null check here. Or make DNregex required
created_at: 2025-05-09T12:39:35Z
author_association: CONTRIBUTOR
diff_hunk: @@ -36,6 +37,7 @@ const StationLogin: React.FunctionComponent<StationLoginProps> = observer(({onLo
     loginOptions,
     deviceType,
     dialNumber,
+    dialNumberRegex,
path: packages/contact-center/station-login/src/station-login/index.tsx
user: login: Shreyas281299
body: Can we add a test to check that this regex is being passes properly. You would need to update the existing test to incorporate this.
created_at: 2025-05-09T12:43:23Z
author_association: CONTRIBUTOR
diff_hunk: @@ -80,6 +84,20 @@ const StationLoginComponent: React.FunctionComponent<StationLoginComponentProps>
     }
   };
 
+  /**
+   * Runs validation tests on a string given as a Dial Number
+   * @param {string} input
+   * @returns {boolean} whether or not to show a validation error
+   */
+  const validateDialNumber = (input: string): boolean => {
+    const regexForDn = new RegExp(dialNumberRegex);
path: packages/contact-center/cc-components/src/components/StationLogin/station-login.tsx
user: login: Shreyas281299
body: I see that regex is coming from agentProfile and can be optional so a null check here would be really important
created_at: 2025-05-09T12:43:53Z
author_association: CONTRIBUTOR
diff_hunk: @@ -72,12 +72,14 @@ export const useStationLogin = (props: UseStationLoginProps) => {
     cc.stationLogin({teamId: team, loginOption: deviceType, dialNumber: dialNumber})
       .then((res: StationLoginSuccess) => {
         setLoginSuccess(res);
+        setLoginFailure(undefined);
       })
       .catch((error: Error) => {
         logger.error(`Error logging in: ${error}`, {
           module: 'widget-station-login#helper.ts',
           method: 'login',
         });
+        setLoginSuccess(undefined);
path: packages/contact-center/station-login/src/helper.ts
user: login: brain-frog
body: the tests currently look for the result to have loginFailure be undefined when loginSuccess is defined and vice versa
created_at: 2025-05-09T13:39:05Z
author_association: CONTRIBUTOR

PR comments:
user: login: coderabbitai[bot]
created_at: 2025-05-08T13:32:36Z
body: <!-- This is an auto-generated comment: summarize by coderabbit.ai -->
<!-- This is an auto-generated comment: skip review by coderabbit.ai -->

> [!IMPORTANT]
> ## Review skipped
> 
> Auto reviews are disabled on base/target branches other than the default branch.
> 
> 
> 
> Please check the settings in the CodeRabbit UI or the `.coderabbit.yaml` file in this repository. To trigger a single review, invoke the `@coderabbitai review` command.
> 
> You can disable this status message by setting the `reviews.review_status` to `false` in the CodeRabbit configuration file.

<!-- end of auto-generated comment: skip review by coderabbit.ai -->
<!-- walkthrough_start -->

<details>
<summary>📝 Walkthrough</summary>

## Walkthrough

The changes introduce enhanced dial number validation and error handling in the StationLogin component. New string constants and error messages are added for improved localization and user feedback. The dial number input now validates against a regex pattern provided via props, with error messages shown for invalid or empty input. The login button is disabled if validation fails. Login failure messages are displayed to the user, and state management is updated to ensure mutual exclusivity between success and failure states. Minor formatting corrections and new CSS for error text are also included, along with the addition of newlines to two package.json files.

</details>

<!-- walkthrough_end -->
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrKNwSPbABsvkCiQBHbGlcSHFcLzpIACIAMxJqAApEXGp4fAwwL3wieAwASi4AQVp6ADU0L3haNIyw/EgAZVTxOoAZHLz6yABZagZYSAARSUpcjCJIADF4ImY0aMhE20gzABY1gE58yDlIbERKXao8sFiKHPRS/0RD5CQHDwBhIoBJMAA2AEYAdg+wqgMADWUS6uFgHgAUvAqPZZCkSMwNDAIZB5l1BCIxKN+LEwghkCtUARIGRYJgGB5wR5mrUsB1xpB4tRsP5dvI0KU8pMJJVqnSmfg+CNKpAAHKOARHTD0ACiAA8aBhEOksLF4CQvLREAAaSAAdwQAwNlA8vBIEnSBy88gw+FCvKqNRo9ClsSFHmyjOoNGY3FwiGRJVo6lVlRteup1js8D9FykyEoFz45IwtCqE3ZYUR3CFzngNsgIcQ3C8aFk3MgRSsr1JFGTyForMrUcaaCkkAAZJAnhlxBhgjwLpTbt1tPRcBdsAJIohYPh7ZXsBhxL5mB77NxRPB1QxII7+a0sGxbmhSMgGJhdh5Y6XEew6Bo3KiBphz+gqkQsK2WqrIAyugPZ0/ylclLSFA11EGcFqFxfEPCKUgV2GaQgQIbg9TIBwKErJhlSQJUGA5BgLlHKMDiOPIaAoWI0EpZE4FQbBuGdG8L2oEgiCFeAAC8ojQZA0Egch9SZBJcFZDwZSLfBpGE+0UBXC4m0pY4EiBXDU3PBjUTQPB5z4PD1QoZhkBg0I7UgABxMhlHEDs3nqfAvGQfVTX2Q56C6EjxJbAkFCUdA03xWDwxwAh5hdRgIWBZAwLNATPJ0qkQkrWh8AYRx2AFclBJchopTIfYWI4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Nda0HcrLayHHEyNKKChOHIk1i+hKAa1L7EazEqu0QlUL8FkG4OCXE3a+uwklipNIMlhEMi65KgKlca6rSu6vIYnKRee5RCGYhIUl63Mt6wxD6znL6teXnUsjFHNaxFZRyg4gSxU2Q5rFSUECm09KKvID+BM3AD5KWL8KIBClZALQSrQJCXAXsDAdUIgH++c+UO5L3fyCpDlPQ2yjvAc03SlAlMQRc24fsx+Ly8YL0tUtCvq21LCh1WWZrF1Jo1AMJZa9BUu4Hduza7EzFaHRi/a+HYko6luhoNuuG2u/Exhxu9QCAmhiHMenRNHQwAweOBNN2cKQgQzHFEmKDPwNAXOUqguPYIuC6UuGOOOZ2BQVgdQRxaoRARxeGJ6OgRxWpDGDRiuKAD4BaEgc7WxhgD4AQNYAAJnO1iDWAEFKFoGcYWgYAEGcc2GOwWmsa+AAA5NhfhQmPHNgSBnGBALHRGtHfZdH9HDGBpjHaBHE759AgA -->

<!-- internal state end -->
<!-- tips_start -->

---

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

<details>
<summary>❤️ Share</summary>

- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)
- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)
- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)
- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

</details>

<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=webex/widgets&utm_content=449):

- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
  - `I pushed a fix in commit <commit_id>, please review it.`
  - `Generate unit testing code for this file.`
  - `Open a follow-up GitHub issue for this discussion.`
- Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:
  - `@coderabbitai generate unit testing code for this file.`
  -	`@coderabbitai modularize this function.`
- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
  - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.`
  - `@coderabbitai read src/utils.ts and generate unit testing code.`
  - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`
  - `@coderabbitai help me debug CodeRabbit configuration file.`

### Support

Need help? Create a ticket on our [support page](https://www.coderabbit.ai/contact-us/support) for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

### CodeRabbit Commands (Invoked using PR comments)

- `@coderabbitai pause` to pause the reviews on a PR.
- `@coderabbitai resume` to resume the paused reviews.
- `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
- `@coderabbitai full review` to do a full review from scratch and review all the files again.
- `@coderabbitai summary` to regenerate the summary of the PR.
- `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR.
- `@coderabbitai generate sequence diagram` to generate a sequence diagram of the changes in this PR.
- `@coderabbitai resolve` resolve all the CodeRabbit review comments.
- `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository.
- `@coderabbitai help` to get help.

### Other keywords and placeholders

- Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.
- Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description.
- Add `@coderabbitai` anywhere in the PR title to generate the title automatically.

### Documentation and Community

- Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->
author_association: NONE
user: login: aws-amplify-us-east-2[bot]
created_at: 2025-05-08T13:37:36Z
body: This pull request is automatically being deployed by Amplify Hosting ([learn more](https://aws.amazon.com/amplify/hosting/)).<br/><br/>Access this pull request here: https://pr-449.d1b38q61t1z947.amplifyapp.com
author_association: NONE
user: login: mkesavan13
created_at: 2025-05-09T11:09:44Z
body: @coderabbitai review
author_association: CONTRIBUTOR
user: login: coderabbitai[bot]
created_at: 2025-05-09T11:09:49Z
body: <!-- This is an auto-generated reply by CodeRabbit -->
<details>
<summary>✅ Actions performed</summary>

Review triggered.

> Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

</details>
author_association: NONE
user: login: Shreyas281299
created_at: 2025-05-09T12:37:07Z
body: https://app.vidcast.io/share/0d96078c-1703-4236-9db7-b98bbb14b8a3 - Vidcast link

author_association: CONTRIBUTOR
user: login: sreenara
created_at: 2025-05-09T13:56:39Z
body: :tada: This PR is included in version 1.28.0-ccwidgets.54 :tada:

The release is available on [GitHub release](https://github.com/webex/widgets/releases/tag/v1.28.0-ccwidgets.54)

Your **[semantic-release](https://github.com/semantic-release/semantic-release)** bot :package::rocket:
author_association: CONTRIBUTOR