Skip to content

Conversation

@Shreyas281299
Copy link
Contributor

COMPLETES N/A - Documentation Enhancement

This pull request addresses

Adding AI-optimized documentation for the MobX store package to help AI assistants understand the centralized state management patterns.

by making the following changes

  • Added packages/contact-center/store/ai-docs/AGENTS.md - Usage documentation and API reference
  • Added packages/contact-center/store/ai-docs/ARCHITECTURE.md - Technical implementation details and data flows

Change Type

  • Bug fix (non-breaking change which fixes an issue)
  • 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

The GAI Coding Policy And Copyright Annotation Best Practices

  • 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: Cursor AI
  • This PR is related to
    • Feature
    • Defect fix
    • Tech Debt
    • Automation

Checklist before merging

  • I have not skipped any automated checks
  • All existing and new tests passed
  • I have updated the testing document
  • I have tested the functionality with amplify link

Make sure to have followed the contributing guidelines before submitting.

@aws-amplify-us-east-2
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-592.d1b38q61t1z947.amplifyapp.com


## Overview

`@webex/cc-store` is the shared, singleton MobX store for all Contact Center widgets. It holds global agent,session and task state, proxies SDK events, and exposes convenience APIs for fetching lists (queues, entry points, address book), task lifecycle handling, and common mutations.
Copy link
Contributor

Choose a reason for hiding this comment

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

How does it understand what SDK here is and how SDK is consumed in the Contact Center widgets ? We should add that as well before directly mentioning that it proxies SDK events.

With this text: exposes convenience APIs for fetching lists (queues, entry points, address book), are we talking about what APIs we expose from widgtes or the APIs we are using from SDK ?


// Option B: Let the store initialize Webex for you, best for new apps
await store.init({
webexConfig: {/* sdk config */},
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of saying sdk config here in bracket, can we not provide reference to dev portal documentation where it talks about what webex config looks like ? Can it read from the links attached ? And if not that then maybe we should add that information locally either here or in separate .md file


// Option A: If you already have a Webex instance, best for existing webex enabled apps
await store.init({
webex: someWebexInstance, // must include cc
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment here, how will it understand what 'must include cc' means ? There should be a reference for what webex instance looks like


## Overview

`@webex/cc-store` is the shared, singleton MobX store for all Contact Center widgets. It holds global agent,session and task state, proxies SDK events, and exposes convenience APIs for fetching lists (queues, entry points, address book), task lifecycle handling, and common mutations.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
`@webex/cc-store` is the shared, singleton MobX store for all Contact Center widgets. It holds global agent,session and task state, proxies SDK events, and exposes convenience APIs for fetching lists (queues, entry points, address book), task lifecycle handling, and common mutations.
`agent, session

- **Singleton** state via MobX observables
- **Event wiring** to SDK (TASK_EVENTS and CC_EVENTS)
- **Task list management** and current task tracking
- **Helpers** for buddy agents, queues, entry points, address book
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we have helper functions only for these 4: buddy agents, queues, entry points, address book ? What is different between these helper functions and other functions in storeEventsWrapper file. We should add more clear description to say what these helper functions are for and in e.g we can talk about like buddy agents, queues etc

### Fetching Lists

```typescript
// Buddy agents for current task media type
Copy link
Contributor

Choose a reason for hiding this comment

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

Adding a statement to help it link and understand where these helper methods are required would be clearer. With this, I don't get the answer of why these helper methods are needed in store file


---

## Key API (Selected)
Copy link
Contributor

Choose a reason for hiding this comment

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

This heading is not very accurate as properties are not APIs and wht do we have Selected in bracket

end
Store->>SDK: register()
SDK-->>Store: Profile
Store->>Store: populate observables, feature flags
Copy link
Contributor

Choose a reason for hiding this comment

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

What do we mean by populate observable here ? I have seen the same text even in above tables. What observables are these from SDK ?

Store->>SDK: Webex.init()
SDK-->>Store: ready
Store->>Store: setupEventListeners(webex.cc)
Store->>Store: registerCC(webex)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are there multiple invocations of registerCC and register in initialization flow ?

store.refreshTaskList();
```

### Address Book Empty
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this put as an example for one of the errors or if we are putting specific errors then complete list should be given else general guidelines for troubleshooting would be better

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants