Banner

Hierarchy

Index

Constructors

constructor

  • new Banner(id?: string, viewed?: boolean, imageUrl?: string, created?: Date, updated?: Date, categories?: string[], expiresAt?: Date, url?: string, linkText?: string, aspectRatio?: number, extras?: Record<string, any>, pinned?: boolean, dismissible?: boolean, clicked?: boolean): Banner
  • A card with only an image, which can be passed to display.showFeed or handled manually. Subscribe to receive new cards via appboy.subscribeToFeedUpdates

    Parameters

    • Optional id: string

      The id of the card. This will be reported back to Braze with events for analytics purposes.

    • Optional viewed: boolean

      Whether this card has been shown to the user.

    • Optional imageUrl: string

      The url for this card's image.

    • Optional created: Date

      When this card was created.

    • Optional updated: Date

      When this card was last modified.

    • Optional categories: string[]

      Purely for organization in your custom implementation, these categories can be set in the dashboard composer.

    • Optional expiresAt: Date

      When this card expires and should stop being shown to the user.

    • Optional url: string

      A url to open when this card is clicked.

    • Optional linkText: string

      The display text for the url.

    • Optional aspectRatio: number

      The aspect ratio for this card's image.

    • Optional extras: Record<string, any>

      Object of string/string key/value pairs.

    • Optional pinned: boolean

      Whether to pin this card to the top of the view.

    • Optional dismissible: boolean

      Whether to allow the user to dismiss this card, removing it from the view.

    • Optional clicked: boolean

      Whether this card has ever been clicked on this device.

    Returns Banner

Properties

aspectRatio

aspectRatio: number | null

The aspect ratio for this card's image.

categories

categories: string[]

Purely for organization in your custom implementation, these categories can be set in the dashboard composer.

clicked

clicked: boolean

Whether this card has ever been clicked on this device.

created

created: Date | null

When this card was created.

dismissed

dismissed: boolean

Whether this card has been dismissed.

dismissible

dismissible: boolean

Whether to allow the user to dismiss this card, removing it from the view.

expiresAt

expiresAt: Date | null

When this card expires and should stop being shown to the user.

Optional extras

extras: Record<string, any>

Object of string/string key/value pairs.

Optional id

id: string

The id of the card. This will be reported back to Braze with events for analytics purposes.

Optional imageUrl

imageUrl: string

The url for this card's image.

Optional linkText

linkText: string

The display text for the url.

pinned

pinned: boolean

Whether to pin this card to the top of the view.

updated

updated: Date | null

When this card was last modified.

Optional url

url: string

A url to open when this card is clicked.

viewed

viewed: boolean

Whether this card has been shown to the user.

Methods

dismissCard

  • dismissCard(): void
  • Call this method if you wish to programmatically remove the card from the feed and log a dismissal. This method is meant to be used with the Braze UI. If you are using your own UI, you should use appboy.logCardDismissal to log analytics.

    Returns void

removeAllSubscriptions

  • removeAllSubscriptions(): void

removeSubscription

  • removeSubscription(subscriptionGuid: string): void
  • Remove an event subscription that you previously subscribed to.

    Parameters

    • subscriptionGuid: string

      The identifier of the subscription you wish to remove, returned by the method you initially used to create it.

    Returns void

subscribeToClickedEvent

  • subscribeToClickedEvent(subscriber: () => void): string
  • Subscribe to receive click events. The subscriber callback will be called whenever this card is clicked by the user.

    Parameters

    • subscriber: () => void

      The callback function to receive click events. This function will be invoked with no arguments when this card records a click.

        • (): void
        • Returns void

    Returns string

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

subscribeToDismissedEvent

  • subscribeToDismissedEvent(subscriber: () => void): string
  • Subscribe to receive dismissed events. The subscriber callback will be called whenever this card is dismissed by the user.

    Parameters

    • subscriber: () => void

      The callback function to receive dismissed events. This function will be invoked with no arguments when this card records a dismissal.

        • (): void
        • Returns void

    Returns string

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