Skip to main content

SyncCompleteData

/**
 * Data on API sync complete.
 */
class SyncCompleteData {

    /**
     * Indicating if there were any updates in the cards post sync. true if there are any new
     * updates present else false. This value is true even if card(s) are deleted.
     */
    hasUpdates: boolean;

    /**
     * Condition under which sync was triggered. Refer to {@link SyncType}
     */
    syncType: SyncType;
}

CardInfo

/**
 * All data for cards.
 */
 class CardInfo {

    /**
     * True if showing ALL tabs is enabled else false.
     */
    shouldShowAllTab: boolean;

    /**
     * All configured categories for cards.
     */
    categories: Array<string>;

    /**
     * All cards which are eligible for display currently.
     */
    cards: Array<Card>;

    /**
     * Accessibility data for static images used in cards.
     * 
     * @since 6.0.0
     */ 
    staticImageAccessibilityData:  { [key in StaticImageType]: MoEAccessibilityData } | null;
}

Card

/**
 * Card data
 */
class Card {

    /**
     * Internal SDK identifier.
     */
    id: number;

    /**
     * Unique identifier for the campaign
     */
    cardId: string;

    /**
     * Category to which the campaign belongs.
     */
    category: string;

    /**
     * Template payload for the campaign.
     */
    template: Template;

    /**
     * Meta data related to the campaign like status, delivery control etc.
     */
    metaData: MetaData;
}

Template

/**
 * Card Template data
 */
 class Template {

    /**
     * Type of Template.
     */
    templateType: TemplateType;

    /**
     * Containers in the template.
     */
    containers: Array<Container>;

    /**
     * Additional data associated to the template
     */
    kvPairs: { [k: string]: any };
}

TemplateType

/**
 * Supported template types.
 */
 enum TemplateType {

    /**
     * Basic Template
     */
    BASIC,

    /**
     * Illustration Template
     */
    ILLUSTRATION
}

Container

/**
 * Container to hold UI widget
 */
 class Container {

    /**
     * Unique identifier for a template
     */
    id: number;

    /**
     * Type of container.
     */
    templateType: TemplateType;

    /**
     * Style associated to the Container
     */
    style: ContainerStyle | undefined;

    /**
     * Widget list associated to the Container
     */
    widgets: Array<Widget>;

    /**
     * Actions to be performed on widget click
     */
    actionList: Array<Action>;
}

Widget

/**
 * UI element in a card.
 */
 class Widget {

    /**
     * Identifier for the widget.
     */
    id: number;

    /**
     * Type of widget
     */
    widgetType: WidgetType;

    /**
     * Content to be loaded in the widget.
     */
    content: string;

    /**
     * Style associated with the widget
     */
    style: WidgetStyle | undefined;

    /**
     * Actions to be performed on widget click
     */
    actionList: Array<Action>;

    /**
     * Accessibility data for the widget
     * @since 6.0.0
     */
    accessibilityData: MoEAccessibilityData | null;

}

WidgetType

/**
 * Types of UI widgets supported.
 */
enum WidgetType {

    /**
     * Widget that loads an image or gif
     */
    IMAGE,

    /**
     * Widget that loads text content.
     */
    TEXT,

    /**
     * Widget that loads button content.
     */
    BUTTON
}

MetaData

/**
 * Meta data related to a campaign.
 */
class MetaData {

    /**
     * True if the campaign should be pinned to the top else false.
     */
    isPinned: boolean;

    /**
     * True if the campaign hasn't been delivered to the inbox, else false.
     */
    isNewCard: boolean;

    /**
     * Current state of the campaign.
     */
    campaignState: CampaignState;

    /**
     * Time at which the campaign would be deleted from local store    
     */
    deletionTime: number;

    /**
     * Delivery Controls defined during campaign creation.
     */
    displayControl: DisplayControl;

    /**
     * Additional meta data regarding campaign used for tracking purposes.
     */
    metaData: { [k: string]: any };

    /**
     * Creation time for the campaign.
     * Notes: Available in iOS, default value is -1
     */
    createdAt: number;

    /**
     * Last time the campaign was updated.
     */
    updatedTime: number;

    /**
     * Complete Campaign payload.
     */
    campaignPayload: { [k: string]: any };
}

CardsData

/**
 * Data for cards
 */
class CardsData {

    /**
     * Category for the cards
     */
    category: string;

    /**
     * [List] of [Card]
     */
    cards: Array<Card>;

    /**
     * Accessibility data for static images used in cards.
     * 
     * @since 6.0.0
     */
    staticImageAccessibilityData:  { [key in StaticImageType]: MoEAccessibilityData } | null;
}

SyncType

/**
 * Condition/Situation when sync
 */
enum SyncType {

    /**
     * Sync when application comes to foreground
     */
    APP_OPEN,

    /**
     * Sync when inbox screen opened.
     */
    INBOX_OPEN,

    /**
     * Sync when SwipeToRefresh widget is pulled.
     */
    PULL_TO_REFRESH
      
    /**
     * Sync when user logs in 
     * @since 5.0.0
     */
    IMMEDIATE
  
}

StaticImageType

/**
 * Enum representing different types of static images used in the cards.
 * 
 * @since 6.0.0
 */
enum StaticImageType {
    /**
     * Image for No cards/Empty State
     */
    EMPTY_STATE
    
    /**
     * Pin Card image
     */
    PIN_CARD
   
    /**
     * Place Holder image for card loading
     */
    LOADING_PLACE_HOLDER
}

AccessibilityData

/// @since 12.0.0 of react-native-moengage package
class MoEAccessibilityData {
  /// The accessibility text
  text: string | null;
  
  /// The accessibility hint
  hint: string | null;
}