SyneriseSource
Source of an action handled by the SDK (passed to InjectorListener.onOpenUrl and InjectorListener.onDeepLink).
Declared In:
lib/enums/injector/synerise_source.dart
Declaration:
enum SyneriseSource {
notSpecified('NOT_SPECIFIED'),
simplePush('SIMPLE_PUSH'),
inAppMessage('IN_APP_MESSAGE'),
inlineInAppMessage('INLINE_IN_APP_MESSAGE');
}
Properties:
| Property | Type | Optional | Description |
|---|---|---|---|
| syneriseSource | String | no | Raw string value of the source |
Functions:
Converts from String to SyneriseSource. Returns SyneriseSource.notSpecified for unknown values.
static SyneriseSource fromString(String string)
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/model/in_app/in_app_message_data.dart
Declaration:
class InAppMessageData
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 | Map<String, String> | yes | Parameters additionally provided by the campaign. |
| isTest | bool | 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/model/in_app/inline_in_app_message_data.dart
Declaration:
class InlineInAppMessageData
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 | Map<String, dynamic> | no | Additional parameters provided by the campaign. Empty map when the campaign provides none |
| isTest | bool | 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/model/in_app/inline_in_app_size.dart
Declaration:
class InlineInAppSize
Properties:
| Property | Type | Optional | Description |
|---|---|---|---|
| width | double | no | Requested width in density-independent units (dp on Android, points on iOS) |
| height | double | no | Requested height in density-independent units (dp on Android, points on iOS) |
| widthPx | int | no | Requested width in physical pixels |
| heightPx | int | no | Requested height in physical pixels |
| widthScreenRatio | double | no | Requested width as a fraction of the screen width (0 to 1) |
| heightScreenRatio | double | no | Requested height as a fraction of the screen height (0 to 1) |
InlineInAppView
Widget 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 widget is mounted. For on-demand campaigns, call render() on the attached InlineInAppViewController. The widget fills the constraints given by its parent and has no intrinsic size. Give it bounded constraints (for example a SizedBox with a height). Removing the widget from the tree releases the native view automatically.
Declared In:
lib/modules/injector/inapp/inline_in_app_view.dart
Related To:
InlineInAppViewController
InlineInAppMessageData
InlineInAppSize
Declaration:
typedef InlineInAppViewLoadedCallback = void Function(InlineInAppMessageData data);
typedef InlineInAppViewFailedCallback = void Function(InlineInAppMessageData data, String error);
typedef InlineInAppViewSizeChangedCallback = void Function(InlineInAppMessageData data, InlineInAppSize size);
class InlineInAppView extends StatefulWidget
Properties:
| Property | Type | Optional | Description |
|---|---|---|---|
| placementKey | String | no | Placement key configured in the campaign |
| identifier | String | yes | Application-defined tag of the widget. Useful when several widgets share a placement key |
| adoptViewId | String | yes | Set by the SDK on the widget delivered through InjectorInlineInAppMessageListener.onInlineInAppAvailable. Mounting a widget with this value shows that already rendered view instead of rendering the placement again. Do not set it yourself |
| controller | InlineInAppViewController | yes | Controller for imperative commands (render(), release(), isRendered(), getData()) |
| onProcessingStarted | void Function() | yes | Called when the SDK starts processing a campaign for this widget |
| onLoaded | InlineInAppViewLoadedCallback | yes | Called when the inline in-app message content is loaded for the first time |
| onUpdated | InlineInAppViewLoadedCallback | yes | Called when the inline in-app message content is updated with a new campaign |
| onFailed | InlineInAppViewFailedCallback | yes | Called when the inline in-app message content fails to load or render |
| onRemove | InlineInAppViewLoadedCallback | yes | Called when the content requests removal from the view hierarchy (SRInApp.close() or SRInApp.closeAndTrigger()). The application decides what to do with the widget |
| onSizeChanged | InlineInAppViewSizeChangedCallback | yes | Called when the content requests a size change (SRInApp.setComponentSize(width, height)). The application is responsible for updating the layout |
Initializers:
const InlineInAppView({
super.key,
required String placementKey,
String? identifier,
String? adoptViewId,
InlineInAppViewController? controller,
void Function()? onProcessingStarted,
InlineInAppViewLoadedCallback? onLoaded,
InlineInAppViewLoadedCallback? onUpdated,
InlineInAppViewFailedCallback? onFailed,
InlineInAppViewLoadedCallback? onRemove,
InlineInAppViewSizeChangedCallback? onSizeChanged,
})
InlineInAppViewController
Controller that drives a mounted InlineInAppView. Pass it as the controller parameter of the widget.
Declared In:
lib/modules/injector/inapp/inline_in_app_view.dart
Related To:
InlineInAppView
InlineInAppMessageData
Declaration:
class InlineInAppViewController
Initializers:
InlineInAppViewController()
Functions:
Triggers rendering for the current placement. Use it for campaigns with the on-demand trigger. If the native view is not attached yet, the render is deferred and applied as soon as the view becomes ready.
Future<void> render()
Tears down the inline in-app message (destroys the web view and clears the campaign data) while the widget stays mounted.
Future<void> release()
Resolves true when the widget currently shows a rendered campaign. Resolves false when the widget is not mounted or holds no rendered campaign.
Future<bool> isRendered()
Resolves the data of the campaign currently shown in the widget. Resolves null when the widget is not mounted or holds no rendered campaign.
Future<InlineInAppMessageData?> getData()
InjectorInlineInAppMessageListener
Listener for inline in-app message campaigns. Configure it with Synerise.injector.inlineInAppMessageListener(listenerFunction), which also enables the native global listener. Remove it with Synerise.injector.removeInlineInAppListener(). It handles actions from inline in-app messages and delivers widgets created by the SDK for event-triggered campaigns.
Declared In:
lib/modules/injector/inapp/in_app_impl.dart
Related To:
InlineInAppView
InlineInAppMessageData
InAppCustomMethodCompletion
Declaration:
typedef InjectorInlineInAppMessageListenerFunction = void Function(InjectorInlineInAppMessageListener listener);
class InjectorInlineInAppMessageListener
Properties:
| Property | Type | Optional | Description |
|---|---|---|---|
| onInlineInAppAvailable | void Function(InlineInAppView view, InlineInAppMessageData data) | yes | Called when the SDK creates a ready-to-display widget after an event-based trigger for a placement with no mounted widget. view is a ready-to-place InlineInAppView for data.placementKey; the application must mount it |
| onOpenUrl | void Function(InlineInAppMessageData data, String url) | yes | Called when the SRInApp.openUrl(url) method is used in an inline in-app message |
| onDeepLink | void Function(InlineInAppMessageData data, String deepLink) | yes | Called when the SRInApp.openDeeplink(url) method is used in an inline in-app message |
| onCustomAction | void Function(InlineInAppMessageData data, String name, Map<String, dynamic> parameters) | yes | Called when the SRInApp.handleCustomAction(name, params) method is used in an inline in-app message |
| onCustomMethod | void Function(InlineInAppMessageData data, String name, Map<String, dynamic> parameters, InAppCustomMethodCompletion completion) | yes | Called when the SRInApp.customMethod(name, params) method is used in an inline in-app message. Resolve completion exactly once with success or failure |
Initializers:
InjectorInlineInAppMessageListener()
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/model/in_app/in_app_custom_method_completion.dart
Declaration:
class InAppCustomMethodCompletion
Functions:
Resolves the pending in-app message JS Promise with a result. result is optional. Its accepted type depends on the message type:
- overlay in-app messages: any JSON-serializable value
- inline in-app messages:
Map<String, dynamic>. Any other value reaches the JS Promise asnull
void success(Object? result)
Rejects the pending in-app message JS Promise with an error message.
void failure(String errorMessage)
InAppContextKey
Well-known keys of Synerise.injector.inAppContext. Use them as map keys, for example Synerise.injector.inAppContext[InAppContextKey.jinjavaContext] = {'tier': 'gold'};
Declared In:
lib/enums/injector/in_app_context_key.dart
Declaration:
class InAppContextKey
Properties:
| Property | Type | Optional | Description |
|---|---|---|---|
| jinjavaContext | static const String | no | Key ('jinjavaContext') of 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 map. Its size is validated server-side |
NOTE: The class has a private constructor and cannot be instantiated.