@adobe/react-native-aepmessaging 7.0.0 → 7.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -0
- package/android/src/main/java/com/adobe/marketing/mobile/reactnative/messaging/RCTAEPMessagingModule.java +27 -1
- package/android/src/main/java/com/adobe/marketing/mobile/reactnative/messaging/RCTAEPMessagingUtil.java +65 -1
- package/dist/Messaging.d.ts +5 -0
- package/dist/Messaging.js +6 -0
- package/dist/Messaging.js.map +1 -1
- package/ios/src/RCTAEPMessaging.mm +8 -0
- package/ios/src/RCTAEPMessaging.swift +68 -8
- package/package.json +2 -2
- package/src/Messaging.ts +11 -0
package/README.md
CHANGED
|
@@ -434,3 +434,29 @@ function otherWorkflowFinished() {
|
|
|
434
434
|
currentMessage.clearMessage();
|
|
435
435
|
}
|
|
436
436
|
```
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
## Tracking interactions with content cards
|
|
440
|
+
|
|
441
|
+
### trackContentCardDisplay
|
|
442
|
+
|
|
443
|
+
Tracks a Display interaction with the given ContentCard
|
|
444
|
+
|
|
445
|
+
**Syntax**
|
|
446
|
+
```javascript
|
|
447
|
+
Messaging.trackContentCardDisplay(proposition, contentCard);
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
### trackContentCardInteraction
|
|
451
|
+
|
|
452
|
+
Tracks a Click interaction with the given ContentCard
|
|
453
|
+
|
|
454
|
+
**Syntax**
|
|
455
|
+
```javascript
|
|
456
|
+
Messaging.trackContentCardInteraction(proposition, contentCard);
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
## Tutorials
|
|
461
|
+
[Content Cards](./tutorials/ContentCards.md)
|
|
462
|
+
|
|
@@ -27,6 +27,7 @@ import com.adobe.marketing.mobile.MessagingEdgeEventType;
|
|
|
27
27
|
import com.adobe.marketing.mobile.MobileCore;
|
|
28
28
|
import com.adobe.marketing.mobile.messaging.MessagingUtils;
|
|
29
29
|
import com.adobe.marketing.mobile.messaging.Proposition;
|
|
30
|
+
import com.adobe.marketing.mobile.messaging.PropositionItem;
|
|
30
31
|
import com.adobe.marketing.mobile.messaging.Surface;
|
|
31
32
|
import com.adobe.marketing.mobile.services.ServiceProvider;
|
|
32
33
|
import com.adobe.marketing.mobile.services.ui.InAppMessage;
|
|
@@ -38,6 +39,7 @@ import com.facebook.react.bridge.ReactApplicationContext;
|
|
|
38
39
|
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
39
40
|
import com.facebook.react.bridge.ReactMethod;
|
|
40
41
|
import com.facebook.react.bridge.ReadableArray;
|
|
42
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
41
43
|
import com.facebook.react.bridge.WritableMap;
|
|
42
44
|
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
|
43
45
|
import java.util.HashMap;
|
|
@@ -269,4 +271,28 @@ public final class RCTAEPMessagingModule
|
|
|
269
271
|
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
|
|
270
272
|
.emit(name, eventData);
|
|
271
273
|
}
|
|
272
|
-
|
|
274
|
+
|
|
275
|
+
@ReactMethod
|
|
276
|
+
public void trackContentCardDisplay(ReadableMap propositionMap, ReadableMap contentCardMap) {
|
|
277
|
+
final Map<String, Object> eventData = RCTAEPMessagingUtil.convertReadableMapToMap(propositionMap);
|
|
278
|
+
final Proposition proposition = Proposition.fromEventData(eventData);
|
|
279
|
+
for (PropositionItem item : proposition.getItems()) {
|
|
280
|
+
if (item.getItemId().equals(contentCardMap.getString("id"))) {
|
|
281
|
+
item.track(MessagingEdgeEventType.DISPLAY);
|
|
282
|
+
break;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
@ReactMethod
|
|
288
|
+
public void trackContentCardInteraction(ReadableMap propositionMap, ReadableMap contentCardMap) {
|
|
289
|
+
final Map<String, Object> eventData = RCTAEPMessagingUtil.convertReadableMapToMap(propositionMap);
|
|
290
|
+
final Proposition proposition = Proposition.fromEventData(eventData);
|
|
291
|
+
for (PropositionItem item : proposition.getItems()) {
|
|
292
|
+
if (item.getItemId().equals(contentCardMap.getString("id"))) {
|
|
293
|
+
item.track("click", MessagingEdgeEventType.INTERACT, null);
|
|
294
|
+
break;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
@@ -19,6 +19,8 @@
|
|
|
19
19
|
import com.facebook.react.bridge.Arguments;
|
|
20
20
|
import com.facebook.react.bridge.ReadableArray;
|
|
21
21
|
import com.facebook.react.bridge.ReadableMap;
|
|
22
|
+
import com.facebook.react.bridge.ReadableMapKeySetIterator;
|
|
23
|
+
import com.facebook.react.bridge.ReadableType;
|
|
22
24
|
import com.facebook.react.bridge.WritableArray;
|
|
23
25
|
import com.facebook.react.bridge.WritableMap;
|
|
24
26
|
import com.facebook.react.bridge.WritableNativeArray;
|
|
@@ -216,4 +218,66 @@
|
|
|
216
218
|
}
|
|
217
219
|
return writableMap;
|
|
218
220
|
}
|
|
219
|
-
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Converts {@link ReadableMap} Map to {@link Map}
|
|
224
|
+
*
|
|
225
|
+
* @param readableMap instance of {@code ReadableMap}
|
|
226
|
+
* @return instance of {@code Map}
|
|
227
|
+
*/
|
|
228
|
+
static Map<String, Object> convertReadableMapToMap(final ReadableMap readableMap) {
|
|
229
|
+
ReadableMapKeySetIterator iterator = readableMap.keySetIterator();
|
|
230
|
+
Map<String, Object> map = new HashMap<>();
|
|
231
|
+
while (iterator.hasNextKey()) {
|
|
232
|
+
String key = iterator.nextKey();
|
|
233
|
+
ReadableType type = readableMap.getType(key);
|
|
234
|
+
switch (type) {
|
|
235
|
+
case Boolean:
|
|
236
|
+
map.put(key, readableMap.getBoolean(key));
|
|
237
|
+
break;
|
|
238
|
+
case Number:
|
|
239
|
+
map.put(key, readableMap.getDouble(key));
|
|
240
|
+
break;
|
|
241
|
+
case String:
|
|
242
|
+
map.put(key, readableMap.getString(key));
|
|
243
|
+
break;
|
|
244
|
+
case Map:
|
|
245
|
+
map.put(key, convertReadableMapToMap(readableMap.getMap(key)));
|
|
246
|
+
break;
|
|
247
|
+
case Array:
|
|
248
|
+
map.put(key, convertReadableArrayToList(readableMap.getArray(key)));
|
|
249
|
+
break;
|
|
250
|
+
default:
|
|
251
|
+
break;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
return map;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
static List<Object> convertReadableArrayToList(final ReadableArray readableArray) {
|
|
258
|
+
final List<Object> list = new ArrayList<>(readableArray.size());
|
|
259
|
+
for (int i = 0; i < readableArray.size(); i++) {
|
|
260
|
+
ReadableType indexType = readableArray.getType(i);
|
|
261
|
+
switch(indexType) {
|
|
262
|
+
case Boolean:
|
|
263
|
+
list.add(i, readableArray.getBoolean(i));
|
|
264
|
+
break;
|
|
265
|
+
case Number:
|
|
266
|
+
list.add(i, readableArray.getDouble(i));
|
|
267
|
+
break;
|
|
268
|
+
case String:
|
|
269
|
+
list.add(i, readableArray.getString(i));
|
|
270
|
+
break;
|
|
271
|
+
case Map:
|
|
272
|
+
list.add(i, convertReadableMapToMap(readableArray.getMap(i)));
|
|
273
|
+
break;
|
|
274
|
+
case Array:
|
|
275
|
+
list.add(i, convertReadableArrayToList(readableArray.getArray(i)));
|
|
276
|
+
break;
|
|
277
|
+
default:
|
|
278
|
+
break;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
return list;
|
|
282
|
+
}
|
|
283
|
+
}
|
package/dist/Messaging.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import Message from './models/Message';
|
|
2
2
|
import { MessagingDelegate } from './models/MessagingDelegate';
|
|
3
3
|
import { MessagingProposition } from './models/MessagingProposition';
|
|
4
|
+
import { ContentCard } from './models/ContentCard';
|
|
4
5
|
export interface NativeMessagingModule {
|
|
5
6
|
extensionVersion: () => Promise<string>;
|
|
6
7
|
getCachedMessages: () => Message[];
|
|
@@ -10,6 +11,8 @@ export interface NativeMessagingModule {
|
|
|
10
11
|
setMessagingDelegate: (delegate?: MessagingDelegate) => void;
|
|
11
12
|
setMessageSettings: (shouldShowMessage: boolean, shouldSaveMessage: boolean) => void;
|
|
12
13
|
updatePropositionsForSurfaces: (surfaces: string[]) => void;
|
|
14
|
+
trackContentCardDisplay: (proposition: MessagingProposition, contentCard: ContentCard) => void;
|
|
15
|
+
trackContentCardInteraction: (proposition: MessagingProposition, contentCard: ContentCard) => void;
|
|
13
16
|
}
|
|
14
17
|
declare class Messaging {
|
|
15
18
|
/**
|
|
@@ -40,6 +43,8 @@ declare class Messaging {
|
|
|
40
43
|
* @returns A record of surface names with their corresponding propositions
|
|
41
44
|
*/
|
|
42
45
|
static getPropositionsForSurfaces(surfaces: string[]): Promise<Record<string, MessagingProposition[]>>;
|
|
46
|
+
static trackContentCardDisplay(proposition: MessagingProposition, contentCard: ContentCard): void;
|
|
47
|
+
static trackContentCardInteraction(proposition: MessagingProposition, contentCard: ContentCard): void;
|
|
43
48
|
/**
|
|
44
49
|
* Function to set the UI Message delegate to listen the Message lifecycle events.
|
|
45
50
|
* @returns A function to unsubscribe from all event listeners
|
package/dist/Messaging.js
CHANGED
|
@@ -63,6 +63,12 @@ class Messaging {
|
|
|
63
63
|
return yield RCTAEPMessaging.getPropositionsForSurfaces(surfaces);
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
|
+
static trackContentCardDisplay(proposition, contentCard) {
|
|
67
|
+
RCTAEPMessaging.trackContentCardDisplay(proposition, contentCard);
|
|
68
|
+
}
|
|
69
|
+
static trackContentCardInteraction(proposition, contentCard) {
|
|
70
|
+
RCTAEPMessaging.trackContentCardInteraction(proposition, contentCard);
|
|
71
|
+
}
|
|
66
72
|
/**
|
|
67
73
|
* Function to set the UI Message delegate to listen the Message lifecycle events.
|
|
68
74
|
* @returns A function to unsubscribe from all event listeners
|
package/dist/Messaging.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Messaging.js","sourceRoot":"","sources":["../src/Messaging.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;EAUE;;;AAEF,+CAKsB;AACtB,uEAAuC;
|
|
1
|
+
{"version":3,"file":"Messaging.js","sourceRoot":"","sources":["../src/Messaging.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;EAUE;;;AAEF,+CAKsB;AACtB,uEAAuC;AAuBvC,MAAM,eAAe,GACnB,4BAAa,CAAC,YAAY,CAAC;AAG7B,IAAI,iBAAoC,CAAC;AAEzC,MAAM,SAAS;IACb;;;OAGG;IACH,MAAM,CAAC,gBAAgB;QACrB,OAAO,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAC7D,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,oBAAoB;QACzB,eAAe,CAAC,oBAAoB,EAAE,CAAC;IACzC,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAO,iBAAiB;;YAC5B,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,iBAAiB,EAAE,CAAC;YAC3D,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,iBAAO,CAAC,GAAG,CAAC,CAAC,CAAC;QACjD,CAAC;KAAA;IAED;;;OAGG;IACH,MAAM,CAAO,gBAAgB;;YAC3B,MAAM,OAAO,GAAG,MAAM,eAAe,CAAC,gBAAgB,EAAE,CAAC;YACzD,OAAO,OAAO,CAAC,CAAC,CAAC,IAAI,iBAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACpD,CAAC;KAAA;IAED;;;;;OAKG;IACH,MAAM,CAAO,0BAA0B,CACrC,QAAkB;;YAElB,OAAO,MAAM,eAAe,CAAC,0BAA0B,CAAC,QAAQ,CAAC,CAAC;QACpE,CAAC;KAAA;IAED,MAAM,CAAC,uBAAuB,CAAC,WAAiC,EAAE,W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lock)reject);
|
|
49
49
|
|
|
50
|
+
RCT_EXTERN_METHOD(trackContentCardDisplay
|
|
51
|
+
: (NSDictionary *)propositionMap contentCardMap
|
|
52
|
+
: (NSDictionary *)contentCardMap);
|
|
53
|
+
|
|
54
|
+
RCT_EXTERN_METHOD(trackContentCardInteraction
|
|
55
|
+
: (NSDictionary *)propositionMap contentCardMap
|
|
56
|
+
: (NSDictionary *)contentCardMap);
|
|
57
|
+
|
|
50
58
|
@end
|
|
@@ -201,6 +201,54 @@ public class RCTAEPMessaging: RCTEventEmitter, MessagingDelegate {
|
|
|
201
201
|
reject(Constants.CACHE_MISS, nil, nil)
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
+
@objc
|
|
205
|
+
func trackContentCardDisplay(
|
|
206
|
+
_ propositionMap: [String: Any],
|
|
207
|
+
contentCardMap: [String: Any]
|
|
208
|
+
) {
|
|
209
|
+
guard let contentCardId = contentCardMap["id"] as? String else {
|
|
210
|
+
print("Error: Content card ID is missing or invalid")
|
|
211
|
+
return
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
do {
|
|
215
|
+
let jsonData = try JSONSerialization.data(withJSONObject: propositionMap)
|
|
216
|
+
let proposition = try JSONDecoder().decode(Proposition.self, from: jsonData)
|
|
217
|
+
|
|
218
|
+
if let matchingItem = proposition.items.first(where: { $0.itemId == contentCardId }) {
|
|
219
|
+
matchingItem.track(withEdgeEventType: MessagingEdgeEventType.display)
|
|
220
|
+
} else {
|
|
221
|
+
print("Error: No matching proposition item found for content card ID: \(contentCardId)")
|
|
222
|
+
}
|
|
223
|
+
} catch {
|
|
224
|
+
print("Error decoding proposition: \(error.localizedDescription)")
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
@objc
|
|
229
|
+
func trackContentCardInteraction(
|
|
230
|
+
_ propositionMap: [String: Any],
|
|
231
|
+
contentCardMap: [String: Any]
|
|
232
|
+
) {
|
|
233
|
+
guard let contentCardId = contentCardMap["id"] as? String else {
|
|
234
|
+
print("Error: Content card ID is missing or invalid")
|
|
235
|
+
return
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
do {
|
|
239
|
+
let jsonData = try JSONSerialization.data(withJSONObject: propositionMap)
|
|
240
|
+
let proposition = try JSONDecoder().decode(Proposition.self, from: jsonData)
|
|
241
|
+
|
|
242
|
+
if let matchingItem = proposition.items.first(where: { $0.itemId == contentCardId }) {
|
|
243
|
+
matchingItem.track("click", withEdgeEventType: MessagingEdgeEventType.interact)
|
|
244
|
+
} else {
|
|
245
|
+
print("Error: No matching proposition item found for content card ID: \(contentCardId)")
|
|
246
|
+
}
|
|
247
|
+
} catch {
|
|
248
|
+
print("Error decoding proposition: \(error.localizedDescription)")
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
204
252
|
// Messaging Delegate Methods
|
|
205
253
|
public func onDismiss(message: Showable) {
|
|
206
254
|
if let fullscreenMessage = message as? FullscreenMessage,
|
|
@@ -227,14 +275,28 @@ public class RCTAEPMessaging: RCTEventEmitter, MessagingDelegate {
|
|
|
227
275
|
}
|
|
228
276
|
|
|
229
277
|
public func shouldShowMessage(message: Showable) -> Bool {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
278
|
+
let fullscreenMessage = message as? FullscreenMessage
|
|
279
|
+
let parentMessage = fullscreenMessage?.parent
|
|
280
|
+
|
|
281
|
+
// If parent message exists, emit it
|
|
282
|
+
if let parentMessage = parentMessage {
|
|
233
283
|
emitNativeEvent(
|
|
234
284
|
name: Constants.SHOULD_SHOW_MESSAGE_EVENT,
|
|
235
|
-
body: RCTAEPMessagingDataBridge.transformToMessage(message:
|
|
285
|
+
body: RCTAEPMessagingDataBridge.transformToMessage(message: parentMessage)
|
|
236
286
|
)
|
|
237
|
-
|
|
287
|
+
} else if let fullscreenMessage = fullscreenMessage {
|
|
288
|
+
// Parent is nil but fullscreen message exists - emit empty body for now
|
|
289
|
+
emitNativeEvent(
|
|
290
|
+
name: Constants.SHOULD_SHOW_MESSAGE_EVENT,
|
|
291
|
+
body: [:]
|
|
292
|
+
)
|
|
293
|
+
} else {
|
|
294
|
+
// Both are nil, don't emit anything and return false
|
|
295
|
+
return false
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
semaphore.wait()
|
|
299
|
+
if let message = parentMessage {
|
|
238
300
|
if self.shouldSaveMessage {
|
|
239
301
|
self.messageCache[message.id] = message
|
|
240
302
|
}
|
|
@@ -242,10 +304,8 @@ public class RCTAEPMessaging: RCTEventEmitter, MessagingDelegate {
|
|
|
242
304
|
if self.shouldShowMessage {
|
|
243
305
|
latestMessage = message
|
|
244
306
|
}
|
|
245
|
-
|
|
246
|
-
return self.shouldShowMessage
|
|
247
307
|
}
|
|
248
|
-
return
|
|
308
|
+
return self.shouldShowMessage
|
|
249
309
|
}
|
|
250
310
|
|
|
251
311
|
public func urlLoaded(_ url: URL, byMessage message: Showable) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/react-native-aepmessaging",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.1.1",
|
|
4
4
|
"description": "Adobe Experience Platform support for React Native apps.",
|
|
5
5
|
"homepage": "https://developer.adobe.com/client-sdks/documentation/",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"installConfig": {
|
|
40
40
|
"hoistingLimits": "dependencies"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "2e43601ac53a6982a643ff43d5af8276c675bf29"
|
|
43
43
|
}
|
package/src/Messaging.ts
CHANGED
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
import Message from './models/Message';
|
|
20
20
|
import { MessagingDelegate } from './models/MessagingDelegate';
|
|
21
21
|
import { MessagingProposition } from './models/MessagingProposition';
|
|
22
|
+
import { ContentCard } from './models/ContentCard';
|
|
22
23
|
|
|
23
24
|
export interface NativeMessagingModule {
|
|
24
25
|
extensionVersion: () => Promise<string>;
|
|
@@ -34,6 +35,8 @@ export interface NativeMessagingModule {
|
|
|
34
35
|
shouldSaveMessage: boolean
|
|
35
36
|
) => void;
|
|
36
37
|
updatePropositionsForSurfaces: (surfaces: string[]) => void;
|
|
38
|
+
trackContentCardDisplay: (proposition: MessagingProposition, contentCard: ContentCard) => void;
|
|
39
|
+
trackContentCardInteraction: (proposition: MessagingProposition, contentCard: ContentCard) => void;
|
|
37
40
|
}
|
|
38
41
|
|
|
39
42
|
const RCTAEPMessaging: NativeModule & NativeMessagingModule =
|
|
@@ -90,6 +93,14 @@ class Messaging {
|
|
|
90
93
|
return await RCTAEPMessaging.getPropositionsForSurfaces(surfaces);
|
|
91
94
|
}
|
|
92
95
|
|
|
96
|
+
static trackContentCardDisplay(proposition: MessagingProposition, contentCard: ContentCard): void {
|
|
97
|
+
RCTAEPMessaging.trackContentCardDisplay(proposition, contentCard);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
static trackContentCardInteraction(proposition: MessagingProposition, contentCard: ContentCard): void {
|
|
101
|
+
RCTAEPMessaging.trackContentCardInteraction(proposition, contentCard);
|
|
102
|
+
}
|
|
103
|
+
|
|
93
104
|
/**
|
|
94
105
|
* Function to set the UI Message delegate to listen the Message lifecycle events.
|
|
95
106
|
* @returns A function to unsubscribe from all event listeners
|