-
Notifications
You must be signed in to change notification settings - Fork 64
docs(station-login): add AI documentation - AGENTS.md and ARCHITECTURE.md #575
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?
Conversation
|
This pull request is automatically being deployed by Amplify Hosting (learn more). |
rarajes2
left a comment
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.
Have reviewed AGENTS.md only. Will do a 2nd round of review for ARCHITECTURE.md file
|
|
||
| ## Overview | ||
|
|
||
| The Station Login widget provides a user interface for contact center agents to log in and out of their station. It handles device type selection (Extension, Mobile, Browser), team selection, and agent profile management. The widget integrates with the Webex Contact Center SDK and follows the standard three-layer architecture pattern (Widget → Hook → Component → Store). |
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.
Text could be improved and some fixes are required on the type of station login. Please refer this.
Also let's use StationLogin as a single word everywhere in this file.
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.
Updated
| The Station Login widget enables contact center agents to: | ||
| - **Login to their station** with appropriate device settings | ||
| - **Select their team** from available teams | ||
| - **Choose device type** (Extension, Agent DN, Browser-based) |
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.
Same here. For device type we use Desktop instead of Browser
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.
Updated
| - **Login to their station** with appropriate device settings | ||
| - **Select their team** from available teams | ||
| - **Choose device type** (Extension, Agent DN, Browser-based) | ||
| - **Logout from their station** when ending their shift |
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.
when ending their shift can be removed or improved with more info such as "to login to another voice mode"
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.
Sure, we can improve this
| - **Choose device type** (Extension, Agent DN, Browser-based) | ||
| - **Logout from their station** when ending their shift | ||
| - **Update their profile settings** while logged in (profile mode) | ||
| - **Handle multiple login scenarios** with continuation prompts |
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.
Don't think this is possible
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.
Removed
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.
Removed
| - **Select their team** from available teams | ||
| - **Choose device type** (Extension, Agent DN, Browser-based) | ||
| - **Logout from their station** when ending their shift | ||
| - **Update their profile settings** while logged in (profile mode) |
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.
Update their profile settings --> change station login mode.
This handles logout and login to another mode implicitly.
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.
Updated
| import { StationLogin } from '@webex/cc-station-login'; | ||
| import { observer } from 'mobx-react-lite'; | ||
| import store from '@webex/cc-store'; |
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.
Same here
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.
Updated
| const { isAgentLoggedIn, teams, deviceType } = store; | ||
|
|
||
| if (isAgentLoggedIn) { | ||
| return <AgentDesktop />; |
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.
What is <AgentDesktop /> ?
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 is incorrect, will fix this
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.
Updated sample code
| | Prop | Type | Required | Default | Description | | ||
| |------|------|----------|---------|-------------| | ||
| | `profileMode` | `boolean` | Yes | - | Shows save button (true) or login/logout (false) | | ||
| | `onLogin` | `() => void` | No | - | Callback when login succeeds | | ||
| | `onLogout` | `() => void` | No | - | Callback when logout succeeds | | ||
| | `onCCSignOut` | `() => void` | No | - | Callback when CC sign out is triggered | | ||
| | `onSaveStart` | `() => void` | No | - | Callback when profile save starts | | ||
| | `onSaveEnd` | `(success: boolean) => void` | No | - | Callback when profile save ends | | ||
| | `teamId` | `string` | No | - | Default team ID | | ||
| | `doStationLogout` | `boolean` | No | `true` | Perform station logout on CC sign out | |
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.
Please fix the default values where required
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.
Updated only profileMode was missing
|
|
||
| ```bash | ||
| # Install as part of contact center widgets | ||
| yarn add @webex/cc-station-login |
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.
Don't think we are allowing individual widgets to be installed
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.
We can do this. Yes there are pre-requisite to this, but this is possible.
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, but will we ever use it this way ? if we document it like this Agent will write code referencing this so, please see if want to keep it like this.
| yarn add @webex/cc-station-login | ||
|
|
||
| # Or install the entire widgets bundle | ||
| yarn add @webex/cc-widgets |
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.
We should also mention npm
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.
Updated
|
|
||
| ```typescript | ||
| // Check if store has CC instance | ||
| import store from '@webex/cc-store'; |
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 should be import from @webex/cc-widgets
| const cc = await ContactCenter.init({ token, region }); | ||
| store.setCC(cc); |
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 needs to be fixed
| console.log('Logger:', store.logger); // Should be defined | ||
|
|
||
| // Enable detailed logging | ||
| store.logger.setLevel('debug'); |
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.
Store doesnt have this
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.
Missing logger is not a possible cause
| │ └── station-login/ | ||
| │ └── index.tsx # Widget tests | ||
| ├── ai-docs/ | ||
| │ ├── agent.md # Overview, examples, usage |
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.
it should be agents.md
|
|
||
| ## Component Overview | ||
|
|
||
| The Station Login widget follows the three-layer architecture pattern: **Widget → Hook → Component → Store → SDK**. This architecture separates concerns between state management, business logic, and presentation. |
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.
"Station Login" --> "StationLogin"
Applicable everywhere in this file
|
|
||
| ## Component Overview | ||
|
|
||
| The Station Login widget follows the three-layer architecture pattern: **Widget → Hook → Component → Store → SDK**. This architecture separates concerns between state management, business logic, and presentation. |
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.
three-layer architecture pattern: Widget → Hook → Component → Store → SDK.
This sentence is bit confusing. We should improve and make it easy to understand.
|
|
||
| | Layer | Component | File | Config/Props | State | Callbacks | Events | Tests | | ||
| |-------|-----------|------|--------------|-------|-----------|--------|-------| | ||
| | **Widget** | `StationLogin` | `src/station-login/index.tsx` | `StationLoginProps` | N/A (passes through) | `onLogin`, `onLogout`, `onCCSignOut`, `onSaveStart`, `onSaveEnd` | SDK events (via store) | `tests/station-login/index.tsx` | |
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.
Values for the config/props are case sensitive. I think the values are populated with the types instead of the actual props names. Please check all the values once
|
|
||
| | Component | SDK Methods Used | SDK Events Subscribed | Store Methods Used | | ||
| |-----------|------------------|----------------------|-------------------| | ||
| | **useStationLogin Hook** | `stationLogin()`, `stationLogout()`, `updateAgentProfile()`, `deregister()` | `AGENT_STATION_LOGIN_SUCCESS`, `AGENT_LOGOUT_SUCCESS` | `setCCCallback()`, `removeCCCallback()`, `setShowMultipleLoginAlert()`, `registerCC()` | |
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.
"Hook" can be changed to "hook" and moved out of bold marker
| | Component | SDK Methods Used | SDK Events Subscribed | Store Methods Used | | ||
| |-----------|------------------|----------------------|-------------------| | ||
| | **useStationLogin Hook** | `stationLogin()`, `stationLogout()`, `updateAgentProfile()`, `deregister()` | `AGENT_STATION_LOGIN_SUCCESS`, `AGENT_LOGOUT_SUCCESS` | `setCCCallback()`, `removeCCCallback()`, `setShowMultipleLoginAlert()`, `registerCC()` | | ||
| | **Store** | All SDK methods | All SDK events | N/A | |
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.
Can we update with more specific details ?
| ├── package.json # Dependencies and scripts | ||
| ├── tsconfig.json # TypeScript config | ||
| ├── webpack.config.js # Webpack build config | ||
| ├── jest.config.js # Jest test config | ||
| └── eslint.config.mjs # ESLint config |
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.
We also have babel.config.js file
| ```mermaid | ||
| graph TB | ||
| subgraph "Presentation Layer" | ||
| Widget[StationLogin Widget] | ||
| Component[StationLoginComponent] | ||
| end | ||
|
|
||
| subgraph "Business Logic Layer" | ||
| Hook[useStationLogin Hook<br/>helper.ts] | ||
| end | ||
|
|
||
| subgraph "State Management Layer" | ||
| Store[Store Singleton] | ||
| end | ||
|
|
||
| subgraph "SDK Layer" |
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.
Let's add a screenshot of this flow in the PR description
| ```mermaid | ||
| sequenceDiagram | ||
| actor User | ||
| participant Widget as StationLogin Widget | ||
| participant Hook as useStationLogin Hook | ||
| participant Component as StationLoginComponent | ||
| participant Store | ||
| participant SDK | ||
|
|
||
| User->>Widget: Load widget | ||
| activate Widget | ||
| Widget->>Hook: useStationLogin() |
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.
Same here, we can add the screenshot in the PR description.
Applicable for all the mermaid sequence diagrams
|
|
||
| --- | ||
|
|
||
| ## Troubleshooting Guide |
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.
Do we want to keep this inside the architecture file ?
COMPLETES N/A - Documentation Enhancement
This pull request addresses
Adding AI-optimized documentation for the station-login widget to help AI assistants understand the agent login workflow with team and device selection.
by making the following changes
packages/contact-center/station-login/ai-docs/AGENTS.md- Usage documentation, props, and examplespackages/contact-center/station-login/ai-docs/ARCHITECTURE.md- Technical implementation and component flowChange Type
The following scenarios were tested
The GAI Coding Policy And Copyright Annotation Best Practices
Checklist before merging
Make sure to have followed the contributing guidelines before submitting.