-
Notifications
You must be signed in to change notification settings - Fork 4
Support inbox messages #100
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: develop
Are you sure you want to change the base?
Conversation
| } | ||
|
|
||
| export async function markInboxMessageAsOpened(queueId) { | ||
| export async function markInboxMessageOpened(queueId) { |
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.
I think we should allow both marking and unmarking, what do you think? this could become updateInboxMessageOpenState(queueId, open);
BernardGatt
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.
Left 1 comment, rest looks good.
| } | ||
| }); | ||
|
|
||
| sseSource.addEventListener("inbox_messages", async (event) => { |
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.
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)
|
|
||
| if (!messages) { | ||
| messages = await window.Gist.getInboxMessages(); | ||
| } |
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.
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.
Note
Introduces inbox messages across the SDK (APIs, events, queue integration) and example app (UI, settings), including mark-opened/unopened and delete actions.
getInboxUnopenedCount,getInboxMessages,updateInboxMessageOpenState,removeInboxMessageinsrc/gist.jsbacked by newinbox-message-manager(localStorage cache, expiry filtering, per-user keying, topic filtering, eventsmessageInboxUpdated,inboxMessageAction).queue-managerto handle inbox messages from polling (/api/v4/users) and SSE (inbox_messagesevent) and update local store.EventEmitterwithoff.message-service.updateMessage(PATCH /api/v1/messages/:queueId); bump queue user endpoint to/api/v4/usersinqueue-serviceand keep SSE endpoint logic.examples/index.html,inbox.js, with styles instyles.css; listens to SDK inbox events and updates UI.settings.js, HTML/CSS) to persist and applyGist.setupandsetUserTokenvalues via localStorage.Written by Cursor Bugbot for commit 9988768. This will update automatically on new commits. Configure here.