Skip to content

Commit 24b94f3

Browse files
jamesnroktMansi-mParticle
authored andcommitted
Add all Rokt events
1 parent 88c73b8 commit 24b94f3

1 file changed

Lines changed: 111 additions & 0 deletions

File tree

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
package com.mparticle
2+
3+
// RoktEvent interface for handling events from the Rokt SDK.
4+
sealed interface RoktEvent {
5+
/**
6+
* ShowLoadingIndicator event will be triggered before SDK calls Rokt backend
7+
*/
8+
data object ShowLoadingIndicator : RoktEvent
9+
10+
/**
11+
* HideLoadingIndicator event will be triggered when SDK obtains a success or failure from
12+
* Rokt backend
13+
*/
14+
data object HideLoadingIndicator : RoktEvent
15+
16+
/**
17+
* OfferEngagement event will be triggered if User engaged with the offer
18+
* @param placementId - identifier for the placement emitting the event
19+
*/
20+
data class OfferEngagement(val placementId: String) : RoktEvent
21+
22+
/**
23+
* PositiveEngagement event will be triggered if User positively engaged with the offer
24+
* @param placementId - identifier for the placement emitting the event
25+
*/
26+
data class PositiveEngagement(val placementId: String) : RoktEvent
27+
28+
/**
29+
* FirstPositiveEngagement event will be triggered when the user positively engaged with the offer first time
30+
* @param placementId - identifier for the placement emitting the event
31+
* @param fulfillmentAttributes - an interface using which additional attributes can be sent from the SDK
32+
*/
33+
data class FirstPositiveEngagement(val placementId: String, val fulfillmentAttributes: FulfillmentAttributes) : RoktEvent
34+
35+
/**
36+
* PlacementInteractive event will be triggered when placement has been rendered and is interactable
37+
* @param placementId - identifier for the placement emitting the event
38+
*/
39+
data class PlacementInteractive(val placementId: String) : RoktEvent
40+
41+
/**
42+
* PlacementReady event will be triggered when placement is ready to display but has not rendered content yet
43+
* @param placementId - identifier for the placement emitting the event
44+
*/
45+
data class PlacementReady(val placementId: String) : RoktEvent
46+
47+
/**
48+
* PlacementClosed event will be triggered when placement closes by user
49+
* @param placementId - identifier for the placement emitting the event
50+
*/
51+
data class PlacementClosed(val placementId: String) : RoktEvent
52+
53+
/**
54+
* PlacementCompleted event will be triggered when the offer progression moves to the end and no more
55+
* offer to display
56+
* @param placementId - identifier for the placement emitting the event
57+
*/
58+
data class PlacementCompleted(val placementId: String) : RoktEvent
59+
60+
/**
61+
* PlacementFailure event will be triggered when placement could not be displayed due to some failure
62+
* @param placementId - optional identifier for the placement emitting the event
63+
*/
64+
data class PlacementFailure(val placementId: String? = null) : RoktEvent
65+
66+
/**
67+
* InitComplete event will be triggered when SDK has finished initialization
68+
* @param success - true if init was successful
69+
*/
70+
data class InitComplete(val success: Boolean) : RoktEvent
71+
72+
/**
73+
* OpenUrl event will be triggered when user clicks on a link and the link target is set to Passthrough
74+
* @param placementId - identifier for the placement emitting the event
75+
* @param url - url to open
76+
*/
77+
data class OpenUrl(val placementId: String, val url: String) : RoktEvent
78+
79+
/**
80+
* CartItemInstantPurchase event will be triggered when the catalog item purchase is initiated
81+
* by the user
82+
* @property placementId The layout identifier.
83+
* @property cartItemId The cart item identifier.
84+
* @property catalogItemId The catalog item identifier.
85+
* @property currency The currency used for the purchase.
86+
* @property description The description of the cart item.
87+
* @property linkedProductId The linked product identifier.
88+
* @property totalPrice The total price of the cart item.
89+
* @property quantity The quantity of the cart item.
90+
* @property unitPrice The unit price of the cart item.
91+
*/
92+
data class CartItemInstantPurchase(
93+
val placementId: String,
94+
val cartItemId: String,
95+
val catalogItemId: String,
96+
val currency: String,
97+
val description: String,
98+
val linkedProductId: String,
99+
val totalPrice: Double,
100+
val quantity: Int,
101+
val unitPrice: Double,
102+
) : RoktEvent
103+
}
104+
105+
interface FulfillmentAttributes {
106+
/**
107+
* Additional attributes emitted from the Rokt SDK.
108+
* @param attributes A map of key-value pairs containing additional attributes.
109+
*/
110+
fun sendAttributes(attributes: Map<String, String>)
111+
}

0 commit comments

Comments
 (0)