Skip to content

Agents Manager: Add more custom events#108558

Draft
wellyshen wants to merge 6 commits intotrunkfrom
add/agents-manager-more-custom-events
Draft

Agents Manager: Add more custom events#108558
wellyshen wants to merge 6 commits intotrunkfrom
add/agents-manager-more-custom-events

Conversation

@wellyshen
Copy link
Contributor

@wellyshen wellyshen commented Feb 6, 2026

Part of BSKY-1480.

For controlling the Unified Chat UI, we are now using the global custom events. However, I feel that implementing (and consuming) a get method using JavaScript’s CustomEvent() is somewhat roundabout. A more suitable approach would be to use a global variable, as shown below, for both get and set methods.

That said, during this transition period, I plan to implement these methods using the existing custom events. If you prefer the global variable approach, please feel free to let me know. The conversion should be quick with the help of AI 🤖.

// Setup: Agents Manager
window.__agentsManagerData = {
  getChatState: () => { ... }
  setIsChatOpen: ( isOpen ) => { ... }
};

// Consume: Big Sky
const { isOpen } = window.__agentsManagerData.getChatState();

Proposed Changes

  • Add set chat enabled/rendered event handler
  • Add set chat compact mode event handler
  • Add get chat state event handler
  • Update the doc

Why are these changes being made?

Testing Instructions

  • TBD

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you tested accessibility for your changes? Ensure the feature remains usable with various user agents (e.g., browsers), interfaces (e.g., keyboard navigation), and assistive technologies (e.g., screen readers) (PCYsg-S3g-p2).
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
    • For UI changes, have we tested the change in various languages (for example, ES, PT, FR, or DE)? The length of text and words vary significantly between languages.
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-aUh-p2)?

@wellyshen wellyshen self-assigned this Feb 6, 2026
@matticbot
Copy link
Contributor

matticbot commented Feb 6, 2026

This PR modifies the release build for the following Calypso Apps:

For info about this notification, see here: PCYsg-OT6-p2

  • agents-manager
  • blaze-dashboard
  • help-center
  • notifications
  • odyssey-stats

To test WordPress.com changes, run install-plugin.sh $pluginSlug add/agents-manager-more-custom-events on your sandbox.

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