Module: display

appboy.display is the public interface for the UI portions of Appboy's Web SDK. It is only available in
https://js.appboycdn.com/web-sdk/1.5/appboy.min.js and is stripped from the more minimal
https://js.appboycdn.com/web-sdk/1.5/appboy.core.min.js.

Methods

<static> automaticallyShowNewInAppMessages() → {string}

Automatically display new in-app messages when they come in from the server.

Returns:

The identifier of the subscription created. This can be passed to
removeSubscription to cancel the subscription.

Type
string

<static> destroyFeed()

Destroy any Appboy news feed currently showing. This method will appropriately clean up any retained resources
and also display the hiding animation, and so should be used instead of manually removing feed html from the
DOM.

<static> showFeed(parentNode, cards, allowedCategories)

Display the user's news feed.

Parameters:
Name Type Argument Description
parentNode Element <optional>

The HTML node to render the news feed into. If null/undefined, the feed will be
rendered in fixed position over the right-hand side of the page and appended to the <body> node. If the
parent node already has an Appboy news feed as a direct descendant, the existing feed will be replaced.

cards Array <optional>

A static set of cards to display. Each item in this Array should be a ab.Card
descendant. If this parameter is null/undefined, all unexpired cards from the last news feed refresh will be
used automatically, a feed refresh will be kicked off automatically if the cached cards are more than 1 minute
old, and the feed will automatically update when new cards are received while it is still showing. If you
provide an explicit set of cards by using this parameter, no action will be taken when new cards are received,
and you must subscribe to feed updates yourself with
appboy.subscribeToFeedUpdates and request updates with
appboy.requestFeedRefresh if you want to update this feed
with new cards.

allowedCategories Array <optional>

A set of categories to filter cards to. Each item in this Array should be a
ab.Card.CardCategory. If omitted, all cards will be displayed.

<static> showInAppMessage(inAppMessage) → {boolean}

Display a given in-app message. If another message is already being displayed, the message will be returned
to the queue until the next time message subscribers (which are created with appboy.subscribeToNewInAppMessages)
are invoked.

Parameters:
Name Type Description
inAppMessage ab.InAppMessage | ab.ControlMessage

The message to display.

Returns:

Whether or not the message was displayed (or, in the case of control messages, logged to
Appboy servers).

Type
boolean

<static> toggleFeed(parentNode, cards, allowedCategories)

Toggle the Appboy news feed, creating it if it does not exist, and destroying it if it does.

Parameters:
Name Type Argument Description
parentNode Element <optional>

The HTML node to render the news feed into. If null/undefined, the feed will be
rendered in fixed position over the right-hand side of the page and appended to the <body> node. If the
parent node already has an Appboy news feed as a direct descendant, the existing feed will be replaced.

cards Array <optional>

A static set of cards to display. Each item in this Array should be a ab.Card
descendant. If this parameter is null/undefined, all unexpired cards from the last news feed refresh will be
used automatically, a feed refresh will be kicked off automatically if the cached cards are more than 1 minute
old, and the feed will automatically update when new cards are received while it is still showing. If you
provide an explicit set of cards by using this parameter, no action will be taken when new cards are received,
and you must subscribe to feed updates yourself with
appboy.subscribeToFeedUpdates and request updates with
appboy.requestFeedRefresh if you want to update this feed
with new cards.

allowedCategories Array <optional>

A set of categories to filter cards to. Each item in this Array should be a
ab.Card.CardCategory. If omitted, all cards will be displayed.