Campaigns

SyneriseSource

Source of an action handled by the SDK (passed to IInjectorListener.onOpenUrl and IInjectorListener.onDeepLink).

Declared In:
lib/classes/models/Misc/SyneriseSource.js

Declaration:

enum SyneriseSource {
  NotSpecified = 'NOT_SPECIFIED',
  SimplePush = 'SIMPLE_PUSH',
  InAppMessage = 'IN_APP_MESSAGE',
  InlineInAppMessage = 'INLINE_IN_APP_MESSAGE'
}

Functions:

Converts from SyneriseSource to string.

function SyneriseSourceToString(source: SyneriseSource): string

Converts from string to SyneriseSource.

function SyneriseSourceFromString(string: string): SyneriseSource


InAppMessageData

Model representing an in-app message data.

WARNING: This is a read-only class and it is not meant to be instantiated directly.

Declared In:
lib/classes/models/Misc/InAppMessageData.js

Inherits From:
BaseModel

Declaration:

class InAppMessageData extends BaseModel

Properties:

Property Type Optional Description
campaignHash string no Identifier of the in-app message campaign.
variantIdentifier string no Identifier of the in-app message campaign variant.
additionalParameters Object yes Parameters additionally provided by the campaign.
isTest boolean no Specifies if the object is from a test campaign.


InlineInAppMessageData

Model representing inline in-app message data.

WARNING: This is a read-only class and it is not meant to be instantiated directly.

Declared In:
lib/classes/models/Misc/InlineInAppMessageData.js

Inherits From:
BaseModel

Declaration:

class InlineInAppMessageData extends BaseModel

Properties:

Property Type Optional Description
campaignHash string no Identifier of the inline in-app message campaign
variantIdentifier string no Identifier of the inline in-app message campaign variant
placementKey string no Placement key configured in the campaign
additionalParameters Object yes Additional parameters provided by the campaign
isTest boolean no Specifies whether the object is from a test campaign


InlineInAppSize

Model representing the component size requested by an inline in-app message through the SRInApp.setComponentSize(width, height) JS method. The same measurement is exposed in three units.

WARNING: This is a read-only class and it is not meant to be instantiated directly.

Declared In:
lib/classes/models/Misc/InlineInAppSize.js

Declaration:

class InlineInAppSize

Properties:

Property Type Optional Description
width number no Requested width in density-independent units (dp on Android, points on iOS)
height number no Requested height in density-independent units (dp on Android, points on iOS)
widthPx number no Requested width in physical pixels
heightPx number no Requested height in physical pixels
widthScreenRatio number no Requested width as a fraction of the screen width (0 to 1)
heightScreenRatio number no Requested height as a fraction of the screen height (0 to 1)


InlineInAppView

Component that places and renders an inline in-app message for a placement key. For campaigns with the automatic trigger, the SDK requests content as soon as the component is mounted. For on-demand campaigns, call render() on the component ref (see InlineInAppViewHandle). The component has no default size, so set its width and height through the style prop (or size its parent). Unmounting the component releases the native view automatically.

Declared In:
lib/main/modules/inapp/InlineInAppView.js

Related To:
InlineInAppViewHandle
InlineInAppMessageData
InlineInAppSize

Declaration:

interface InlineInAppViewProps {
  placementKey: string;
  identifier?: string;
  adoptViewId?: string;
  style?: ViewStyle;
  onProcessingStarted?: () => void;
  onLoaded?: (data: InlineInAppMessageData) => void;
  onUpdated?: (data: InlineInAppMessageData) => void;
  onFailed?: (data: InlineInAppMessageData, error: string) => void;
  onRemove?: (data: InlineInAppMessageData) => void;
  onSizeChanged?: (data: InlineInAppMessageData, size: InlineInAppSize) => void;
}
const InlineInAppView: React.ForwardRefExoticComponent<
  InlineInAppViewProps & React.RefAttributes<InlineInAppViewHandle>
>

Properties:

Property Type Optional Description
placementKey string no Placement key configured in the campaign
identifier string yes Application-defined tag of the component. Useful when several components share a placement key
adoptViewId string yes Set by the SDK on the element delivered through IInlineInAppMessageListener.onInlineInAppAvailable. Mounting an element with this value shows that already rendered view instead of rendering the placement again. Do not set it yourself
style ViewStyle yes Style of the component. The component has no default size, so set its width and height (or size its parent)
onProcessingStarted () => void yes Called when the SDK starts processing a campaign for this component
onLoaded (data: InlineInAppMessageData) => void yes Called when the inline in-app message content is loaded for the first time
onUpdated (data: InlineInAppMessageData) => void yes Called when the inline in-app message content is updated with a new campaign
onFailed (data: InlineInAppMessageData, error: string) => void yes Called when the inline in-app message content fails to load or render
onRemove (data: InlineInAppMessageData) => void yes Called when the content requests removal from the view hierarchy (SRInApp.close() or SRInApp.closeAndTrigger()). The application decides what to do with the component
onSizeChanged (data: InlineInAppMessageData, size: InlineInAppSize) => void yes Called when the content requests a size change (SRInApp.setComponentSize(width, height)). The application is responsible for updating the layout


InlineInAppViewHandle

Imperative handle of InlineInAppView, available through the component ref.

Declared In:
lib/main/modules/inapp/InlineInAppView.js

Related To:
InlineInAppView
InlineInAppMessageData

Declaration:

interface InlineInAppViewHandle {
  render(): void;
  release(): void;
  isRendered(): Promise<boolean>;
  getData(): Promise<InlineInAppMessageData | null>;
}

Functions:

Triggers rendering for the current placement. Use it for campaigns with the on-demand trigger.

render(): void

Tears down the inline in-app message (destroys the web view and clears the campaign data) while the component stays mounted.

release(): void

Resolves true when the component currently shows a rendered campaign. Resolves false when the component is not mounted or holds no rendered campaign.

isRendered(): Promise<boolean>

Resolves the data of the campaign currently shown in the component. Resolves null when the component is not mounted or holds no rendered campaign.

getData(): Promise<InlineInAppMessageData | null>


IInlineInAppMessageListener

Listener for inline in-app message campaigns. Set it with Synerise.Injector.setInlineInAppMessageListener(listener). It handles actions from inline in-app messages and delivers components created by the SDK for event-triggered campaigns. Setting a new listener replaces the previous one.

Declared In:
lib/main/modules/inapp/InAppManager.js

Related To:
InlineInAppView
InlineInAppMessageData
InAppCustomMethodCompletion

Declaration:

interface IInlineInAppMessageListener {
  onInlineInAppAvailable(view: React.ReactElement, data: InlineInAppMessageData): void;
  onOpenUrl?(data: InlineInAppMessageData, url: string): void;
  onDeepLink?(data: InlineInAppMessageData, deepLink: string): void;
  onCustomAction?(data: InlineInAppMessageData, name: string, parameters: object): void;
  onCustomMethod?(data: InlineInAppMessageData, name: string, parameters: object, completion: InAppCustomMethodCompletion): void;
}

Functions:

Called when the SDK creates a ready-to-display component after an event-based trigger for a placement with no mounted component. view is a ready-to-place InlineInAppView element for data.placementKey; the application must mount it. Required.

onInlineInAppAvailable(view: React.ReactElement, data: InlineInAppMessageData): void

Called when the SRInApp.openUrl(url) method is used in an inline in-app message. Optional.

onOpenUrl?(data: InlineInAppMessageData, url: string): void

Called when the SRInApp.openDeeplink(url) method is used in an inline in-app message. Optional.

onDeepLink?(data: InlineInAppMessageData, deepLink: string): void

Called when the SRInApp.handleCustomAction(name, params) method is used in an inline in-app message. Optional.

onCustomAction?(data: InlineInAppMessageData, name: string, parameters: object): void

Called when the SRInApp.customMethod(name, params) method is used in an inline in-app message. Resolve completion exactly once with success or failure. Optional.

onCustomMethod?(data: InlineInAppMessageData, name: string, parameters: object, completion: InAppCustomMethodCompletion): void


InAppCustomMethodCompletion

Completion handler used to resolve a custom method invoked from an in-app message (overlay and inline). Resolve it exactly once. The first resolution wins and later calls are ignored.

WARNING: This is a read-only class and it is not meant to be instantiated directly.

Declared In:
lib/classes/models/InApps/InAppCustomMethodCompletion.js

Declaration:

class InAppCustomMethodCompletion

Functions:

Resolves the pending in-app message JS Promise with a result. result is optional and may be of any type.

success(result?: any | null): void

Rejects the pending in-app message JS Promise with an error message.

failure(errorMessage: string): void


InAppContextKey

Well-known keys of Synerise.Injector.inAppContext.

Declared In:
lib/classes/models/InApps/InAppContextKey.js

Declaration:

enum InAppContextKey {
  JinjavaContext = 'jinjavaContext'
}

Values:

Value Raw value Description
JinjavaContext 'jinjavaContext' The only part of the context sent to the backend for server-side Jinja evaluation when a campaign with a dynamic variant is rendered. It may hold a nested object. Its size is validated server-side

Canonical URL: https://hub.synerise.com/developers/mobile-sdk/class-reference/react-native/campaigns