Skip to content

Conversation

@clabland
Copy link
Contributor

@clabland clabland commented Nov 26, 2025

Note

Introduces inbox messages across the SDK (APIs, events, queue integration) and example app (UI, settings), including mark-opened/unopened and delete actions.

  • SDK/Core:
    • Inbox APIs: Add getInboxUnopenedCount, getInboxMessages, updateInboxMessageOpenState, removeInboxMessage in src/gist.js backed by new inbox-message-manager (localStorage cache, expiry filtering, per-user keying, topic filtering, events messageInboxUpdated, inboxMessageAction).
    • Queue Integration: Update queue-manager to handle inbox messages from polling (/api/v4/users) and SSE (inbox_messages event) and update local store.
    • Events: Enhance EventEmitter with off.
    • Services: Add message-service.updateMessage(PATCH /api/v1/messages/:queueId); bump queue user endpoint to /api/v4/users in queue-service and keep SSE endpoint logic.
  • Examples:
    • Inbox UI: New badge/header, slide-out panel, and actions in examples/index.html, inbox.js, with styles in styles.css; listens to SDK inbox events and updates UI.
    • Config Override: New sticky configuration panel (settings.js, HTML/CSS) to persist and apply Gist.setup and setUserToken values via localStorage.

Written by Cursor Bugbot for commit 9988768. This will update automatically on new commits. Configure here.

@clabland clabland requested a review from a team as a code owner November 26, 2025 23:19
}

export async function markInboxMessageAsOpened(queueId) {
export async function markInboxMessageOpened(queueId) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should allow both marking and unmarking, what do you think? this could become updateInboxMessageOpenState(queueId, open);

Copy link
Collaborator

@BernardGatt BernardGatt left a comment

Choose a reason for hiding this comment

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

Left 1 comment, rest looks good.

}
});

sseSource.addEventListener("inbox_messages", async (event) => {
Copy link

Choose a reason for hiding this comment

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

Bug: SSE message handler may use inconsistent data format

The polling path now expects response.data to have nested inAppMessages and inboxMessages properties after the API upgrade to v4. However, the SSE messages event handler at line 173 still parses event.data and passes it directly to updateQueueLocalStore and updateBroadcastsLocalStore as a flat array. If the SSE endpoint also sends data in the nested format, the handler would pass the wrong structure (an object with inAppMessages property instead of an array of messages).

Additional Locations (1)

Fix in Cursor Fix in Web


if (!messages) {
messages = await window.Gist.getInboxMessages();
}
Copy link

Choose a reason for hiding this comment

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

Bug: Badge count and message list use different data sources

When refreshInboxMessages is called with a messages parameter (from the messageInboxUpdated event), the badge count is still fetched separately via getInboxUnopenedCount() which reads from localStorage. This causes the badge count and the rendered message list to potentially show inconsistent data - the badge reflects filtered/stored messages while the list renders the event's messages. The unopened count calculation needs to use the same messages array when it's provided.

Fix in Cursor Fix in Web

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.

3 participants