CaptionedImage

Hierarchy

  • Card
    • CaptionedImage

Index

Constructors

constructor

  • new CaptionedImage(id?: undefined | string, viewed?: undefined | false | true, title?: undefined | string, imageUrl?: undefined | string, description?: undefined | string, created?: Date, updated?: Date, categories?: string[], expiresAt?: Date, url?: undefined | string, linkText?: undefined | string, aspectRatio?: undefined | number, extras?: Record<string, string>, pinned?: undefined | false | true, dismissible?: undefined | false | true, clicked?: undefined | false | true): CaptionedImage
  • A card with a large image and descriptive text, which can be passed to showFeed or handled manually. Subscribe to receive new cards via subscribeToFeedUpdates.

    Parameters

    • Optional id: undefined | string

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

    • Optional viewed: undefined | false | true

      Whether this card has been shown to the user.

    • Optional title: undefined | string

      The title text for this card.

    • Optional imageUrl: undefined | string

      The url for this card's image.

    • Optional description: undefined | string

      The body text for this card.

    • 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: undefined | string

      A url to open when this card is clicked.

    • Optional linkText: undefined | string

      The display text for the url.

    • Optional aspectRatio: undefined | number

      The aspect ratio for this card's image. This field is meant to serve as a hint before image loading completes. Note that the field may not be supplied in certain circumstances.

    • Optional extras: Record<string, string>

      Object of string/string key/value pairs.

    • Optional pinned: undefined | false | true

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

    • Optional dismissible: undefined | false | true

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

    • Optional clicked: undefined | false | true

      Whether this card has ever been clicked on this device.

    Returns CaptionedImage

Properties

aspectRatio

aspectRatio: number | null

The aspect ratio for this card's image. This field is meant to serve as a hint before image loading completes. Note that the field may not be supplied in certain circumstances.

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.

description

description: string

The body text for this card.

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.

extras

extras: Record<string, string>

Object of string/string key/value pairs. Defaults to empty object {}.

Optional id

id: undefined | string

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

Optional imageUrl

imageUrl: undefined | string

The url for this card's image.

isControl

isControl: boolean

Whether this card is a ControlCard.

Optional linkText

linkText: undefined | string

The display text for the url.

pinned

pinned: boolean

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

title

title: string

The title text for this card.

updated

updated: Date | null

When this card was last modified.

Optional url

url: undefined | 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, this method will have no effect. Instead, you should use logCardDismissal to log analytics and then remove the card from the DOM manually.

    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 | null
  • 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 | null

    The identifier of the subscription created. This can be passed to Card.removeSubscription to cancel the subscription. Returns null if the subscriber passed is not a function.

subscribeToDismissedEvent

  • subscribeToDismissedEvent(subscriber: () => void): string | null
  • 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 | null

    The identifier of the subscription created. This can be passed to Card.removeSubscription to cancel the subscription. Returns null if the subscriber passed is not a function.

Static fromContentCardsJson

  • fromContentCardsJson(jsonData: Record<string, unknown>): Card | undefined