This JS API provides you access to announcements. Access methods on this object:

productFruits.api.announcements (current announcements)


productFruits.api.announcementsV2 (v2 announcements)


[V1]  getAnnouncementsByChannel(channelId)

Returns an array of announcements by a given channel ID. The announcement object contains id, publishedAt, titles and userState fields.

Possible userState values are not_seen (the user hasn't seen the announcement yet) or seen (the user skipped the tour).

The titles object contains an object with all titles in all given languages. The key of this object is the ISO language identifier (i.e. en for English).

[V1]  showAnnouncement(id)

Shows the content of the given announcement by its ID. Currently, only the modal-type announcements are supported by this API.

[V1]  showHistory(channelId)

Shows the history modal of the given channel ID.

[V2], [V1]  attachNewsWidgetToElement(htmlElementInstance)

Attaches the newsfeed widget to a custom element. The parameter must be an HTML element instance, do not pass a CSS selector.

[V2], [V1]  listen(event, callback)

Listens to an event that occurs related to announcements. See the next section to get event names.


[V1]  banner-spacing

Data Space in pixels

Fired when the banner-type announcement is showing or closing. The argument gives you space in pixels that you can use for moving the page down if you don't want to cover your content with the Product Fruits banner.

[V2]  newsfeed-unread-count-changed

- count
- listCheckedAt

Fired when newsfeed unread items count changed. Use this to show badge of unread items in your custom newsfeed launcher button.