@adobe/react-native-aepmessaging 7.1.1 → 7.2.0
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 +66 -2
- package/android/src/main/java/com/adobe/marketing/mobile/reactnative/messaging/RCTAEPMessagingConstants.java +19 -0
- package/android/src/main/java/com/adobe/marketing/mobile/reactnative/messaging/RCTAEPMessagingModule.java +151 -18
- package/android/src/main/java/com/adobe/marketing/mobile/reactnative/messaging/RCTAEPMessagingUtil.java +1 -1
- package/dist/Messaging.d.ts +17 -0
- package/dist/Messaging.js +27 -6
- package/dist/Messaging.js.map +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/dist/models/ContentCard.d.ts +6 -1
- package/dist/models/ContentCard.js +9 -0
- package/dist/models/ContentCard.js.map +1 -1
- package/dist/models/HTMLProposition.d.ts +6 -2
- package/dist/models/HTMLProposition.js +9 -0
- package/dist/models/HTMLProposition.js.map +1 -1
- package/dist/models/JSONProposition.d.ts +12 -0
- package/dist/models/{JSONPropositionItem.js → JSONProposition.js} +10 -1
- package/dist/models/JSONProposition.js.map +1 -0
- package/dist/models/Message.d.ts +14 -0
- package/dist/models/Message.js +43 -0
- package/dist/models/Message.js.map +1 -1
- package/dist/models/MessagingProposition.d.ts +10 -3
- package/dist/models/MessagingProposition.js +45 -0
- package/dist/models/MessagingProposition.js.map +1 -1
- package/dist/models/MessagingPropositionItem.d.ts +3 -2
- package/dist/models/PropositionItem.d.ts +83 -0
- package/dist/models/PropositionItem.js +78 -0
- package/dist/models/PropositionItem.js.map +1 -0
- package/ios/src/RCTAEPMessaging.mm +13 -0
- package/ios/src/RCTAEPMessaging.swift +123 -6
- package/ios/src/RCTAEPMessagingConstants.swift +5 -1
- package/ios/src/RCTAEPMessagingDataBridge.swift +19 -0
- package/package.json +2 -2
- package/src/Messaging.ts +34 -12
- package/src/index.ts +13 -5
- package/src/models/ContentCard.ts +12 -1
- package/src/models/HTMLProposition.ts +15 -6
- package/src/models/{JSONPropositionItem.ts → JSONProposition.ts} +15 -6
- package/src/models/Message.ts +51 -1
- package/src/models/MessagingProposition.ts +45 -3
- package/src/models/MessagingPropositionItem.ts +6 -2
- package/src/models/PropositionItem.ts +135 -0
- package/tutorials/In-App Messaging.md +67 -0
- package/dist/models/JSONPropositionItem.d.ts +0 -8
- package/dist/models/JSONPropositionItem.js.map +0 -1
|
@@ -11,4 +11,13 @@
|
|
|
11
11
|
language governing permissions and limitations under the License.
|
|
12
12
|
*/
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
|
|
14
|
+
exports.JSONPropositionItem = void 0;
|
|
15
|
+
const PropositionItem_1 = require("./PropositionItem");
|
|
16
|
+
class JSONPropositionItem extends PropositionItem_1.PropositionItem {
|
|
17
|
+
constructor(jsonData) {
|
|
18
|
+
super(jsonData);
|
|
19
|
+
this.data = jsonData.data;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.JSONPropositionItem = JSONPropositionItem;
|
|
23
|
+
//# sourceMappingURL=JSONProposition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JSONProposition.js","sourceRoot":"","sources":["../../src/models/JSONProposition.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;EAUE;;;AAGF,uDAAyE;AASzE,MAAa,mBAAoB,SAAQ,iCAAe;IAGvD,YAAY,QAA6B;QACxC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChB,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC;IAC3B,CAAC;CACD;AAPD,kDAOC"}
|
package/dist/models/Message.d.ts
CHANGED
|
@@ -35,5 +35,19 @@ declare class Message {
|
|
|
35
35
|
* Failure to call this function leads to memory leaks.
|
|
36
36
|
*/
|
|
37
37
|
clear(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Adds a handler for named JavaScript messages sent from the message's WebView.
|
|
40
|
+
* The parameter passed to handler will contain the body of the message passed from the WebView's JavaScript.
|
|
41
|
+
* @param {string} handlerName: The name of the message that should be handled by the handler
|
|
42
|
+
* @param {function} handler: The method or closure to be called with the body of the message created in the Message's JavaScript
|
|
43
|
+
*/
|
|
44
|
+
handleJavascriptMessage(handlerName: string, handler: (content: string) => void): void;
|
|
45
|
+
/**
|
|
46
|
+
* @internal - For internal use only.
|
|
47
|
+
* Clears all the javascript message handlers for the message.
|
|
48
|
+
* This function must be called if the callbacks registered in handleJavascriptMessage are no longer needed.
|
|
49
|
+
* Failure to call this function may lead to memory leaks.
|
|
50
|
+
*/
|
|
51
|
+
_clearJavascriptMessageHandlers(): void;
|
|
38
52
|
}
|
|
39
53
|
export default Message;
|
package/dist/models/Message.js
CHANGED
|
@@ -13,6 +13,17 @@ governing permissions and limitations under the License.
|
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
const react_native_1 = require("react-native");
|
|
15
15
|
const RCTAEPMessaging = react_native_1.NativeModules.AEPMessaging;
|
|
16
|
+
// Registery to store inAppMessage callbacks for each message in Message.handleJavascriptMessage
|
|
17
|
+
// Record - {messageId : {handlerName : callback}}
|
|
18
|
+
const jsMessageHandlers = {};
|
|
19
|
+
const handleJSMessageEventEmitter = new react_native_1.NativeEventEmitter(RCTAEPMessaging);
|
|
20
|
+
// invokes the callback registered in Message.handleJavascriptMessage with the content received from the inAppMessage webview
|
|
21
|
+
handleJSMessageEventEmitter.addListener('onJavascriptMessage', (event) => {
|
|
22
|
+
const { messageId, handlerName, content } = event;
|
|
23
|
+
if (jsMessageHandlers[messageId] && jsMessageHandlers[messageId][handlerName]) {
|
|
24
|
+
jsMessageHandlers[messageId][handlerName](content);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
16
27
|
class Message {
|
|
17
28
|
constructor({ id, autoTrack = false }) {
|
|
18
29
|
this.id = id;
|
|
@@ -59,6 +70,38 @@ class Message {
|
|
|
59
70
|
clear() {
|
|
60
71
|
RCTAEPMessaging.clear(this.id);
|
|
61
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Adds a handler for named JavaScript messages sent from the message's WebView.
|
|
75
|
+
* The parameter passed to handler will contain the body of the message passed from the WebView's JavaScript.
|
|
76
|
+
* @param {string} handlerName: The name of the message that should be handled by the handler
|
|
77
|
+
* @param {function} handler: The method or closure to be called with the body of the message created in the Message's JavaScript
|
|
78
|
+
*/
|
|
79
|
+
handleJavascriptMessage(handlerName, handler) {
|
|
80
|
+
// Validate parameters
|
|
81
|
+
if (!handlerName) {
|
|
82
|
+
console.warn('[AEP Messaging] handleJavascriptMessage: handlerName is required');
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (typeof handler !== 'function') {
|
|
86
|
+
console.warn('[AEP Messaging] handleJavascriptMessage: handler must be a function');
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
// cache the callback
|
|
90
|
+
if (!jsMessageHandlers[this.id]) {
|
|
91
|
+
jsMessageHandlers[this.id] = {};
|
|
92
|
+
}
|
|
93
|
+
jsMessageHandlers[this.id][handlerName] = handler;
|
|
94
|
+
RCTAEPMessaging.handleJavascriptMessage(this.id, handlerName);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* @internal - For internal use only.
|
|
98
|
+
* Clears all the javascript message handlers for the message.
|
|
99
|
+
* This function must be called if the callbacks registered in handleJavascriptMessage are no longer needed.
|
|
100
|
+
* Failure to call this function may lead to memory leaks.
|
|
101
|
+
*/
|
|
102
|
+
_clearJavascriptMessageHandlers() {
|
|
103
|
+
delete jsMessageHandlers[this.id];
|
|
104
|
+
}
|
|
62
105
|
}
|
|
63
106
|
exports.default = Message;
|
|
64
107
|
//# sourceMappingURL=Message.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Message.js","sourceRoot":"","sources":["../../src/models/Message.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;EAUE;;AAEF,+
|
|
1
|
+
{"version":3,"file":"Message.js","sourceRoot":"","sources":["../../src/models/Message.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;EAUE;;AAEF,+CAAiE;AAEjE,MAAM,eAAe,GAAG,4BAAa,CAAC,YAAY,CAAC;AAEnD,gGAAgG;AAChG,kDAAkD;AAClD,MAAM,iBAAiB,GAA8D,EAAE,CAAC;AACxF,MAAM,2BAA2B,GAAG,IAAI,iCAAkB,CAAC,eAAe,CAAC,CAAC;AAE5E,6HAA6H;AAC7H,2BAA2B,CAAC,WAAW,CAAC,qBAAqB,EAAE,CAAC,KAAK,EAAE,EAAE;IACvE,MAAM,EAAC,SAAS,EAAE,WAAW,EAAE,OAAO,EAAC,GAAG,KAAK,CAAC;IAChD,IAAI,iBAAiB,CAAC,SAAS,CAAC,IAAI,iBAAiB,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,EAAE;QAC7E,iBAAiB,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC;KACpD;AACH,CAAC,CAAC,CAAC;AAEH,MAAM,OAAO;IAIX,YAAY,EAAE,EAAE,EAAE,SAAS,GAAG,KAAK,EAAsC;QACvE,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAED;;;;OAIG;IACH,YAAY,CAAC,SAAkB;QAC7B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,eAAe,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;IACnD,CAAC;IAED;;;OAGG;IACH,IAAI;QACF,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAChC,CAAC;IAED;;;;;OAKG;IACH,OAAO,CAAC,iBAA2B;QACjC,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACrE,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,WAAmB,EAAE,SAAiB;QAC1C,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;IACzD,CAAC;IAED;;;;OAIG;IACH,KAAK;QACH,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjC,CAAC;IAED;;;;;OAKG;IACH,uBAAuB,CAAC,WAAmB,EAAE,OAAkC;QAC7E,sBAAsB;QACtB,IAAI,CAAC,WAAW,EAAE;YAChB,OAAO,CAAC,IAAI,CAAC,kEAAkE,CAAC,CAAC;YACjF,OAAO;SACR;QAED,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE;YACjC,OAAO,CAAC,IAAI,CAAC,qEAAqE,CAAC,CAAC;YACpF,OAAO;SACR;QAED,qBAAqB;QACrB,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;YAC/B,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC;SACjC;QACD,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC;QAClD,eAAe,CAAC,uBAAuB,CAAC,IAAI,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC;IAChE,CAAC;IAED;;;;;OAKG;IACH,+BAA+B;QAC7B,OAAO,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpC,CAAC;CACF;AAED,kBAAe,OAAO,CAAC"}
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import { MessagingPropositionItem } from './MessagingPropositionItem';
|
|
2
1
|
import { ScopeDetails } from './ScopeDetails';
|
|
3
|
-
|
|
2
|
+
import { PropositionItem } from './PropositionItem';
|
|
3
|
+
export declare class MessageProposition {
|
|
4
4
|
id: string;
|
|
5
5
|
scope: string;
|
|
6
6
|
scopeDetails: ScopeDetails;
|
|
7
|
-
items:
|
|
7
|
+
items: PropositionItem[];
|
|
8
|
+
constructor(raw: {
|
|
9
|
+
id: string;
|
|
10
|
+
scope: string;
|
|
11
|
+
scopeDetails: ScopeDetails;
|
|
12
|
+
items?: any[];
|
|
13
|
+
});
|
|
8
14
|
}
|
|
15
|
+
export { MessageProposition as MessagingProposition };
|
|
@@ -11,4 +11,49 @@
|
|
|
11
11
|
language governing permissions and limitations under the License.
|
|
12
12
|
*/
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.MessagingProposition = exports.MessageProposition = void 0;
|
|
15
|
+
const PersonalizationSchema_1 = require("./PersonalizationSchema");
|
|
16
|
+
const ContentCard_1 = require("./ContentCard");
|
|
17
|
+
const HTMLProposition_1 = require("./HTMLProposition");
|
|
18
|
+
const JSONProposition_1 = require("./JSONProposition");
|
|
19
|
+
const PropositionItem_1 = require("./PropositionItem");
|
|
20
|
+
class MessageProposition {
|
|
21
|
+
constructor(raw) {
|
|
22
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
23
|
+
this.id = (_a = raw === null || raw === void 0 ? void 0 : raw.id) !== null && _a !== void 0 ? _a : '';
|
|
24
|
+
this.scope = (_b = raw === null || raw === void 0 ? void 0 : raw.scope) !== null && _b !== void 0 ? _b : '';
|
|
25
|
+
this.scopeDetails = (_c = raw === null || raw === void 0 ? void 0 : raw.scopeDetails) !== null && _c !== void 0 ? _c : {};
|
|
26
|
+
// Mirror activity.id into activity.activityID for convenience
|
|
27
|
+
const activityIdFromScope = (_f = (_e = (_d = this.scopeDetails) === null || _d === void 0 ? void 0 : _d.activity) === null || _e === void 0 ? void 0 : _e.id) !== null && _f !== void 0 ? _f : '';
|
|
28
|
+
if ((_g = this.scopeDetails) === null || _g === void 0 ? void 0 : _g.activity) {
|
|
29
|
+
this.scopeDetails.activity.activityID = activityIdFromScope;
|
|
30
|
+
}
|
|
31
|
+
const rawItems = Array.isArray(raw === null || raw === void 0 ? void 0 : raw.items) ? raw.items : [];
|
|
32
|
+
this.items = rawItems.map((itemData) => {
|
|
33
|
+
var _a, _b, _c;
|
|
34
|
+
const activityId = (_c = (_b = (_a = this.scopeDetails) === null || _a === void 0 ? void 0 : _a.activity) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : '';
|
|
35
|
+
let instance;
|
|
36
|
+
switch (itemData === null || itemData === void 0 ? void 0 : itemData.schema) {
|
|
37
|
+
case PersonalizationSchema_1.PersonalizationSchema.CONTENT_CARD:
|
|
38
|
+
instance = new ContentCard_1.ContentCard(itemData);
|
|
39
|
+
instance.activityID = activityId;
|
|
40
|
+
return instance;
|
|
41
|
+
case PersonalizationSchema_1.PersonalizationSchema.HTML_CONTENT:
|
|
42
|
+
instance = new HTMLProposition_1.HTMLProposition(itemData);
|
|
43
|
+
instance.activityID = activityId;
|
|
44
|
+
return instance;
|
|
45
|
+
case PersonalizationSchema_1.PersonalizationSchema.JSON_CONTENT:
|
|
46
|
+
instance = new JSONProposition_1.JSONPropositionItem(itemData);
|
|
47
|
+
instance.activityID = activityId;
|
|
48
|
+
return instance;
|
|
49
|
+
default:
|
|
50
|
+
instance = new PropositionItem_1.PropositionItem(itemData);
|
|
51
|
+
instance.activityID = activityId;
|
|
52
|
+
return instance;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.MessageProposition = MessageProposition;
|
|
58
|
+
exports.MessagingProposition = MessageProposition;
|
|
14
59
|
//# sourceMappingURL=MessagingProposition.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessagingProposition.js","sourceRoot":"","sources":["../../src/models/MessagingProposition.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;EAUE"}
|
|
1
|
+
{"version":3,"file":"MessagingProposition.js","sourceRoot":"","sources":["../../src/models/MessagingProposition.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;EAUE;;;AAGF,mEAAgE;AAChE,+CAA4C;AAC5C,uDAAoD;AACpD,uDAAwD;AACxD,uDAAoD;AAEpD,MAAa,kBAAkB;IAM7B,YAAY,GAA6E;;QACvF,IAAI,CAAC,EAAE,GAAG,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,EAAE,mCAAI,EAAE,CAAC;QACxB,IAAI,CAAC,KAAK,GAAG,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,KAAK,mCAAI,EAAE,CAAC;QAC9B,IAAI,CAAC,YAAY,GAAG,MAAC,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,YAA6B,mCAAK,EAAmB,CAAC;QAEhF,8DAA8D;QAC9D,MAAM,mBAAmB,GAAG,MAAA,MAAA,MAAA,IAAI,CAAC,YAAY,0CAAE,QAAQ,0CAAE,EAAE,mCAAI,EAAE,CAAC;QAClE,IAAI,MAAA,IAAI,CAAC,YAAY,0CAAE,QAAQ,EAAE;YAC9B,IAAI,CAAC,YAAY,CAAC,QAAgB,CAAC,UAAU,GAAG,mBAAmB,CAAC;SACtE;QAED,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5D,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,QAAa,EAAE,EAAE;;YAC1C,MAAM,UAAU,GAAG,MAAA,MAAA,MAAA,IAAI,CAAC,YAAY,0CAAE,QAAQ,0CAAE,EAAE,mCAAI,EAAE,CAAC;YACzD,IAAI,QAAa,CAAC;YAClB,QAAQ,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,EAAE;gBACxB,KAAK,6CAAqB,CAAC,YAAY;oBACrC,QAAQ,GAAG,IAAI,yBAAW,CAAC,QAAe,CAAC,CAAC;oBAC3C,QAAgB,CAAC,UAAU,GAAG,UAAU,CAAC;oBAC1C,OAAO,QAAQ,CAAC;gBAClB,KAAK,6CAAqB,CAAC,YAAY;oBACrC,QAAQ,GAAG,IAAI,iCAAe,CAAC,QAAe,CAAC,CAAC;oBAC/C,QAAgB,CAAC,UAAU,GAAG,UAAU,CAAC;oBAC1C,OAAO,QAAQ,CAAC;gBAClB,KAAK,6CAAqB,CAAC,YAAY;oBACrC,QAAQ,GAAG,IAAI,qCAAmB,CAAC,QAAe,CAAC,CAAC;oBACnD,QAAgB,CAAC,UAAU,GAAG,UAAU,CAAC;oBAC1C,OAAO,QAAQ,CAAC;gBAClB;oBACE,QAAQ,GAAG,IAAI,iCAAe,CAAC,QAAe,CAAC,CAAC;oBAC/C,QAAgB,CAAC,UAAU,GAAG,UAAU,CAAC;oBAC1C,OAAO,QAAQ,CAAC;aACnB;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAzCD,gDAyCC;AAE8B,kDAAoB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ContentCard } from './ContentCard';
|
|
2
2
|
import { HTMLProposition } from './HTMLProposition';
|
|
3
|
-
import { JSONPropositionItem } from './
|
|
3
|
+
import { JSONPropositionItem } from './JSONProposition';
|
|
4
4
|
import { InAppMessage } from './InAppMessage';
|
|
5
|
-
|
|
5
|
+
import { PropositionItem } from './PropositionItem';
|
|
6
|
+
export type MessagingPropositionItem = ContentCard | HTMLProposition | InAppMessage | JSONPropositionItem | PropositionItem;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { PersonalizationSchema } from './PersonalizationSchema';
|
|
2
|
+
import MessagingEdgeEventType from './MessagingEdgeEventType';
|
|
3
|
+
/**
|
|
4
|
+
* Base PropositionItem interface that all proposition items implement
|
|
5
|
+
*/
|
|
6
|
+
export interface PropositionItemData {
|
|
7
|
+
id: string;
|
|
8
|
+
uuid: string;
|
|
9
|
+
schema: PersonalizationSchema;
|
|
10
|
+
activityID: string;
|
|
11
|
+
data: {
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A PropositionItem represents a personalization JSON object returned by Konductor.
|
|
17
|
+
* This is the base class that provides tracking functionality for all proposition items
|
|
18
|
+
* including ContentCards, InApp messages, and code-based experiences.
|
|
19
|
+
*
|
|
20
|
+
* This mirrors the native Android PropositionItem class functionality.
|
|
21
|
+
*/
|
|
22
|
+
export declare class PropositionItem {
|
|
23
|
+
id: string;
|
|
24
|
+
uuid: string;
|
|
25
|
+
activityID: string;
|
|
26
|
+
schema: PersonalizationSchema;
|
|
27
|
+
data: {
|
|
28
|
+
[key: string]: any;
|
|
29
|
+
};
|
|
30
|
+
constructor(propositionItemData: PropositionItemData);
|
|
31
|
+
/**
|
|
32
|
+
* Gets the PropositionItem identifier.
|
|
33
|
+
*
|
|
34
|
+
* @returns {string} The PropositionItem identifier
|
|
35
|
+
*/
|
|
36
|
+
getItemId(): string;
|
|
37
|
+
/**
|
|
38
|
+
* Gets the PropositionItem content schema.
|
|
39
|
+
*
|
|
40
|
+
* @returns {PersonalizationSchema} The PropositionItem content schema
|
|
41
|
+
*/
|
|
42
|
+
getSchema(): PersonalizationSchema;
|
|
43
|
+
/**
|
|
44
|
+
* Gets the PropositionItem data.
|
|
45
|
+
*
|
|
46
|
+
* @returns {object} The PropositionItem data
|
|
47
|
+
*/
|
|
48
|
+
getItemData(): {
|
|
49
|
+
[key: string]: any;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Tracks interaction with this proposition item.
|
|
53
|
+
* This is the core tracking method that all proposition items use.
|
|
54
|
+
*
|
|
55
|
+
* @param {MessagingEdgeEventType} eventType - The MessagingEdgeEventType specifying event type for the interaction
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* propositionItem.track(MessagingEdgeEventType.DISPLAY);
|
|
59
|
+
*/
|
|
60
|
+
track(eventType: MessagingEdgeEventType): void;
|
|
61
|
+
/**
|
|
62
|
+
* Tracks interaction with this proposition item.
|
|
63
|
+
*
|
|
64
|
+
* @param {string | null} interaction - String describing the interaction
|
|
65
|
+
* @param {MessagingEdgeEventType} eventType - The MessagingEdgeEventType specifying event type for the interaction
|
|
66
|
+
* @param {string[] | null} tokens - Array containing the sub-item tokens for recording interaction
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* // Track display
|
|
70
|
+
* propositionItem.track(null, MessagingEdgeEventType.DISPLAY, null);
|
|
71
|
+
*
|
|
72
|
+
* // Track interaction
|
|
73
|
+
* propositionItem.track("button_clicked", MessagingEdgeEventType.INTERACT, null);
|
|
74
|
+
*
|
|
75
|
+
* // Track with tokens
|
|
76
|
+
* propositionItem.track("click", MessagingEdgeEventType.INTERACT, ["token1", "token2"]);
|
|
77
|
+
*/
|
|
78
|
+
track(interaction: string | null, eventType: MessagingEdgeEventType, tokens: string[] | null): void;
|
|
79
|
+
/**
|
|
80
|
+
* Internal method that performs the actual tracking
|
|
81
|
+
*/
|
|
82
|
+
private trackWithDetails;
|
|
83
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright 2025 Adobe. All rights reserved.
|
|
4
|
+
This file is licensed to you under the Apache License, Version 2.0 (the
|
|
5
|
+
"License"); you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
|
|
8
|
+
or agreed to in writing, software distributed under the License is
|
|
9
|
+
distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF
|
|
10
|
+
ANY KIND, either express or implied. See the License for the specific
|
|
11
|
+
language governing permissions and limitations under the License.
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.PropositionItem = void 0;
|
|
15
|
+
const react_native_1 = require("react-native");
|
|
16
|
+
const RCTAEPMessaging = react_native_1.NativeModules.AEPMessaging;
|
|
17
|
+
/**
|
|
18
|
+
* A PropositionItem represents a personalization JSON object returned by Konductor.
|
|
19
|
+
* This is the base class that provides tracking functionality for all proposition items
|
|
20
|
+
* including ContentCards, InApp messages, and code-based experiences.
|
|
21
|
+
*
|
|
22
|
+
* This mirrors the native Android PropositionItem class functionality.
|
|
23
|
+
*/
|
|
24
|
+
class PropositionItem {
|
|
25
|
+
constructor(propositionItemData) {
|
|
26
|
+
this.id = propositionItemData.id;
|
|
27
|
+
this.schema = propositionItemData.schema;
|
|
28
|
+
this.data = propositionItemData.data;
|
|
29
|
+
this.uuid = propositionItemData.uuid;
|
|
30
|
+
this.activityID = propositionItemData.activityID;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Gets the PropositionItem identifier.
|
|
34
|
+
*
|
|
35
|
+
* @returns {string} The PropositionItem identifier
|
|
36
|
+
*/
|
|
37
|
+
getItemId() {
|
|
38
|
+
return this.id;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Gets the PropositionItem content schema.
|
|
42
|
+
*
|
|
43
|
+
* @returns {PersonalizationSchema} The PropositionItem content schema
|
|
44
|
+
*/
|
|
45
|
+
getSchema() {
|
|
46
|
+
return this.schema;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Gets the PropositionItem data.
|
|
50
|
+
*
|
|
51
|
+
* @returns {object} The PropositionItem data
|
|
52
|
+
*/
|
|
53
|
+
getItemData() {
|
|
54
|
+
return this.data;
|
|
55
|
+
}
|
|
56
|
+
// Implementation
|
|
57
|
+
track(interactionOrEventType, eventType, tokens) {
|
|
58
|
+
// Handle overloaded method signatures
|
|
59
|
+
if (typeof interactionOrEventType === 'number' && eventType === undefined) {
|
|
60
|
+
// First overload: track(eventType)
|
|
61
|
+
this.trackWithDetails(null, interactionOrEventType, null);
|
|
62
|
+
}
|
|
63
|
+
else if (typeof interactionOrEventType === 'string' || interactionOrEventType === null) {
|
|
64
|
+
// Second overload: track(interaction, eventType, tokens)
|
|
65
|
+
this.trackWithDetails(interactionOrEventType, eventType, tokens || null);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Internal method that performs the actual tracking
|
|
70
|
+
*/
|
|
71
|
+
trackWithDetails(interaction, eventType, tokens) {
|
|
72
|
+
var _a;
|
|
73
|
+
const nativeIdentifier = (_a = this.activityID) !== null && _a !== void 0 ? _a : null;
|
|
74
|
+
RCTAEPMessaging.trackPropositionItem(nativeIdentifier, interaction, eventType, tokens);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.PropositionItem = PropositionItem;
|
|
78
|
+
//# sourceMappingURL=PropositionItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PropositionItem.js","sourceRoot":"","sources":["../../src/models/PropositionItem.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;EAUE;;;AAEF,+CAA6C;AAI7C,MAAM,eAAe,GAAG,4BAAa,CAAC,YAAY,CAAC;AAenD;;;;;;GAMG;AACH,MAAa,eAAe;IAO1B,YAAY,mBAAwC;QAClD,IAAI,CAAC,EAAE,GAAG,mBAAmB,CAAC,EAAE,CAAC;QACjC,IAAI,CAAC,MAAM,GAAG,mBAAmB,CAAC,MAAM,CAAC;QACzC,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC,IAAI,CAAC;QACrC,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC,IAAI,CAAC;QACrC,IAAI,CAAC,UAAU,GAAG,mBAAmB,CAAC,UAAU,CAAC;IACnD,CAAC;IAED;;;;OAIG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,EAAE,CAAC;IACjB,CAAC;IAED;;;;OAIG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED;;;;OAIG;IACH,WAAW;QACT,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAgCD,iBAAiB;IACjB,KAAK,CACH,sBAA8D,EAC9D,SAAkC,EAClC,MAAwB;QAExB,sCAAsC;QACtC,IAAI,OAAO,sBAAsB,KAAK,QAAQ,IAAI,SAAS,KAAK,SAAS,EAAE;YACzE,mCAAmC;YACnC,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,sBAAsB,EAAE,IAAI,CAAC,CAAC;SAC3D;aAAM,IAAI,OAAO,sBAAsB,KAAK,QAAQ,IAAI,sBAAsB,KAAK,IAAI,EAAE;YACxF,yDAAyD;YACzD,IAAI,CAAC,gBAAgB,CAAC,sBAAsB,EAAE,SAAU,EAAE,MAAM,IAAI,IAAI,CAAC,CAAC;SAC3E;IACH,CAAC;IAED;;OAEG;IACK,gBAAgB,CAAC,WAA0B,EAAE,SAAiC,EAAE,MAAuB;;QAC7G,MAAM,gBAAgB,GAAG,MAAA,IAAI,CAAC,UAAU,mCAAI,IAAI,CAAC;QACjD,eAAe,CAAC,oBAAoB,CAAC,gBAAgB,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IACzF,CAAC;CAEF;AAhGD,0CAgGC"}
|
|
@@ -55,4 +55,17 @@ RCT_EXTERN_METHOD(trackContentCardInteraction
|
|
|
55
55
|
: (NSDictionary *)propositionMap contentCardMap
|
|
56
56
|
: (NSDictionary *)contentCardMap);
|
|
57
57
|
|
|
58
|
+
|
|
59
|
+
RCT_EXTERN_METHOD(handleJavascriptMessage
|
|
60
|
+
: (NSString *)messageId handlerName
|
|
61
|
+
: (NSString *)handlerName)
|
|
62
|
+
|
|
63
|
+
RCT_EXTERN_METHOD(trackPropositionItem
|
|
64
|
+
: (NSString *)uuid interaction
|
|
65
|
+
: (NSString * _Nullable)interaction eventType
|
|
66
|
+
: (NSInteger)eventType tokens
|
|
67
|
+
: (NSArray<NSString *> * _Nullable)tokens withResolver
|
|
68
|
+
: (RCTPromiseResolveBlock)resolve withRejecter
|
|
69
|
+
: (RCTPromiseRejectBlock)reject);
|
|
70
|
+
|
|
58
71
|
@end
|
|
@@ -21,6 +21,7 @@ import WebKit
|
|
|
21
21
|
@objc(RCTAEPMessaging)
|
|
22
22
|
public class RCTAEPMessaging: RCTEventEmitter, MessagingDelegate {
|
|
23
23
|
private var messageCache = [String: Message]()
|
|
24
|
+
private var jsHandlerMessageCache = [String: Message]()
|
|
24
25
|
private var latestMessage: Message? = nil
|
|
25
26
|
private let semaphore = DispatchSemaphore(value: 0)
|
|
26
27
|
private var shouldSaveMessage = false
|
|
@@ -64,7 +65,7 @@ public class RCTAEPMessaging: RCTEventEmitter, MessagingDelegate {
|
|
|
64
65
|
) {
|
|
65
66
|
resolve(self.latestMessage != nil ? RCTAEPMessagingDataBridge.transformToMessage(message: self.latestMessage!) : nil)
|
|
66
67
|
}
|
|
67
|
-
|
|
68
|
+
|
|
68
69
|
@objc
|
|
69
70
|
func getPropositionsForSurfaces(
|
|
70
71
|
_ surfaces: [String],
|
|
@@ -72,16 +73,29 @@ public class RCTAEPMessaging: RCTEventEmitter, MessagingDelegate {
|
|
|
72
73
|
withRejecter reject: @escaping RCTPromiseRejectBlock
|
|
73
74
|
) {
|
|
74
75
|
let surfacePaths = surfaces.map { $0.isEmpty ? Surface() : Surface(path: $0) }
|
|
75
|
-
Messaging.getPropositionsForSurfaces(surfacePaths) { propositions, error in
|
|
76
|
+
Messaging.getPropositionsForSurfaces(surfacePaths) { [weak self] propositions, error in
|
|
77
|
+
guard let self = self else { return }
|
|
76
78
|
guard error == nil else {
|
|
77
79
|
reject("Unable to Retrieve Propositions", nil, nil)
|
|
78
80
|
return
|
|
79
81
|
}
|
|
80
|
-
|
|
81
|
-
resolve([String: Any]())
|
|
82
|
-
return
|
|
82
|
+
guard let propositions = propositions, !propositions.isEmpty else {
|
|
83
|
+
resolve([String: Any]())
|
|
84
|
+
return
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Populate uuid->Proposition map using scopeDetails.activity.id
|
|
88
|
+
for (_, list) in propositions {
|
|
89
|
+
for proposition in list {
|
|
90
|
+
if let pMap = proposition.asDictionary() {
|
|
91
|
+
if let key = RCTAEPMessagingDataBridge.extractActivityId(from: pMap) {
|
|
92
|
+
self.propositionByUuid[key] = proposition
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
83
96
|
}
|
|
84
|
-
|
|
97
|
+
|
|
98
|
+
resolve(RCTAEPMessagingDataBridge.transformPropositionDict(dict: propositions))
|
|
85
99
|
}
|
|
86
100
|
}
|
|
87
101
|
|
|
@@ -113,6 +127,7 @@ public class RCTAEPMessaging: RCTEventEmitter, MessagingDelegate {
|
|
|
113
127
|
) {
|
|
114
128
|
let mapped = surfaces.map { Surface(path: $0) }
|
|
115
129
|
Messaging.updatePropositionsForSurfaces(mapped)
|
|
130
|
+
propositionByUuid.removeAll()
|
|
116
131
|
resolve(nil)
|
|
117
132
|
}
|
|
118
133
|
|
|
@@ -249,11 +264,95 @@ public class RCTAEPMessaging: RCTEventEmitter, MessagingDelegate {
|
|
|
249
264
|
}
|
|
250
265
|
}
|
|
251
266
|
|
|
267
|
+
@objc
|
|
268
|
+
func handleJavascriptMessage(
|
|
269
|
+
_ messageId: String,
|
|
270
|
+
handlerName: String
|
|
271
|
+
) {
|
|
272
|
+
guard let message = jsHandlerMessageCache[messageId] else {
|
|
273
|
+
print("[RCTAEPMessaging] handleJavascriptMessage: No message found in cache for messageId: \(messageId)")
|
|
274
|
+
return
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
message.handleJavascriptMessage(handlerName) { [weak self] content in
|
|
278
|
+
self?.emitNativeEvent(
|
|
279
|
+
name: Constants.ON_JAVASCRIPT_MESSAGE_EVENT,
|
|
280
|
+
body: [
|
|
281
|
+
Constants.MESSAGE_ID_KEY: messageId,
|
|
282
|
+
Constants.HANDLER_NAME_KEY: handlerName,
|
|
283
|
+
Constants.CONTENT_KEY: content ?? ""
|
|
284
|
+
]
|
|
285
|
+
)
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/// MARK: - Unified PropositionItem Tracking Methods
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Tracks interactions with a PropositionItem using the provided interaction and event type.
|
|
293
|
+
* This method is used by the React Native PropositionItem.track() method.
|
|
294
|
+
*
|
|
295
|
+
* - Parameters:
|
|
296
|
+
* - uuid: The UUID mapped to the PropositionItem (derived from activityId)
|
|
297
|
+
* - interaction: A custom string value to be recorded in the interaction (optional)
|
|
298
|
+
* - eventType: The MessagingEdgeEventType numeric value
|
|
299
|
+
* - tokens: Array containing the sub-item tokens for recording interaction (optional)
|
|
300
|
+
*/
|
|
301
|
+
|
|
302
|
+
@objc
|
|
303
|
+
func trackPropositionItem(
|
|
304
|
+
_ uuid: String,
|
|
305
|
+
interaction: String?,
|
|
306
|
+
eventType: Int,
|
|
307
|
+
tokens: [String]?,
|
|
308
|
+
withResolver resolve: @escaping RCTPromiseResolveBlock,
|
|
309
|
+
withRejecter reject: @escaping RCTPromiseRejectBlock
|
|
310
|
+
) {
|
|
311
|
+
NSLog("[MessagingBridge] trackPropositionItem called with eventType=\(eventType), uuid=\(uuid), interaction=\(String(describing: interaction)), tokens=\(String(describing: tokens))")
|
|
312
|
+
|
|
313
|
+
guard !uuid.isEmpty else {
|
|
314
|
+
NSLog("[MessagingBridge] Empty uuid provided; no-op.")
|
|
315
|
+
resolve(nil)
|
|
316
|
+
return
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
guard let proposition = propositionByUuid[uuid] else {
|
|
320
|
+
NSLog("[MessagingBridge] No cached proposition for uuid=\(uuid); no-op.")
|
|
321
|
+
resolve(nil)
|
|
322
|
+
return
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
NSLog("[MessagingBridge] Found proposition for uuid=\(uuid). scope=\(proposition.scope), items=\(proposition.items.count)")
|
|
326
|
+
|
|
327
|
+
// Event type mapping (Android parity)
|
|
328
|
+
let edgeEventType = mapEdgeEventType(eventType) ?? .display
|
|
329
|
+
|
|
330
|
+
// Track on the first item under this proposition
|
|
331
|
+
guard let item = proposition.items.first else {
|
|
332
|
+
NSLog("[MessagingBridge] Proposition for uuid=\(uuid) has no items; no-op.")
|
|
333
|
+
resolve(nil)
|
|
334
|
+
return
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
// Direct call without normalization (expecting valid inputs)
|
|
338
|
+
NSLog("[MessagingBridge] Tracking (direct) uuid=\(uuid), interaction=\(String(describing: interaction)), tokens=\(String(describing: tokens)), eventType=\(edgeEventType.rawValue)")
|
|
339
|
+
item.track(interaction, withEdgeEventType: edgeEventType, forTokens: tokens)
|
|
340
|
+
|
|
341
|
+
NSLog("[MessagingBridge] Tracking complete for uuid=\(uuid)")
|
|
342
|
+
resolve(nil)
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
// Map uuid (scopeDetails.activity.id) -> parent Proposition
|
|
348
|
+
private var propositionByUuid = [String: Proposition]()
|
|
349
|
+
|
|
252
350
|
// Messaging Delegate Methods
|
|
253
351
|
public func onDismiss(message: Showable) {
|
|
254
352
|
if let fullscreenMessage = message as? FullscreenMessage,
|
|
255
353
|
let parentMessage = fullscreenMessage.parent
|
|
256
354
|
{
|
|
355
|
+
jsHandlerMessageCache.removeValue(forKey: parentMessage.id)
|
|
257
356
|
emitNativeEvent(
|
|
258
357
|
name: Constants.ON_DISMISS_EVENT,
|
|
259
358
|
body: RCTAEPMessagingDataBridge.transformToMessage(
|
|
@@ -267,6 +366,7 @@ public class RCTAEPMessaging: RCTEventEmitter, MessagingDelegate {
|
|
|
267
366
|
if let fullscreenMessage = message as? FullscreenMessage,
|
|
268
367
|
let message = fullscreenMessage.parent
|
|
269
368
|
{
|
|
369
|
+
jsHandlerMessageCache[message.id] = message
|
|
270
370
|
emitNativeEvent(
|
|
271
371
|
name: Constants.ON_SHOW_EVENT,
|
|
272
372
|
body: RCTAEPMessagingDataBridge.transformToMessage(message: message)
|
|
@@ -328,3 +428,20 @@ public class RCTAEPMessaging: RCTEventEmitter, MessagingDelegate {
|
|
|
328
428
|
RCTAEPMessaging.emitter.sendEvent(withName: name, body: body)
|
|
329
429
|
}
|
|
330
430
|
}
|
|
431
|
+
|
|
432
|
+
// MARK: - Private helpers
|
|
433
|
+
private extension RCTAEPMessaging {
|
|
434
|
+
/// Maps JS MessagingEdgeEventType integer values to AEPMessaging.MessagingEdgeEventType cases
|
|
435
|
+
/// JS enum values: DISMISS=0, INTERACT=1, TRIGGER=2, DISPLAY=3, PUSH_APPLICATION_OPENED=4, PUSH_CUSTOM_ACTION=5
|
|
436
|
+
func mapEdgeEventType(_ value: Int) -> MessagingEdgeEventType? {
|
|
437
|
+
switch value {
|
|
438
|
+
case 0: return .dismiss
|
|
439
|
+
case 1: return .interact
|
|
440
|
+
case 2: return .trigger
|
|
441
|
+
case 3: return .display
|
|
442
|
+
case 4: return .pushApplicationOpened
|
|
443
|
+
case 5: return .pushCustomAction
|
|
444
|
+
default: return nil
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}
|
|
@@ -16,7 +16,11 @@ class Constants {
|
|
|
16
16
|
static let ON_SHOW_EVENT = "onShow"
|
|
17
17
|
static let SHOULD_SHOW_MESSAGE_EVENT = "shouldShowMessage"
|
|
18
18
|
static let URL_LOADED_EVENT = "urlLoaded"
|
|
19
|
+
static let ON_JAVASCRIPT_MESSAGE_EVENT = "onJavascriptMessage"
|
|
19
20
|
static let SUPPORTED_EVENTS = [
|
|
20
|
-
ON_DISMISS_EVENT, ON_SHOW_EVENT, SHOULD_SHOW_MESSAGE_EVENT, URL_LOADED_EVENT,
|
|
21
|
+
ON_DISMISS_EVENT, ON_SHOW_EVENT, SHOULD_SHOW_MESSAGE_EVENT, URL_LOADED_EVENT, ON_JAVASCRIPT_MESSAGE_EVENT
|
|
21
22
|
]
|
|
23
|
+
static let MESSAGE_ID_KEY = "messageId"
|
|
24
|
+
static let HANDLER_NAME_KEY = "handlerName"
|
|
25
|
+
static let CONTENT_KEY = "content"
|
|
22
26
|
}
|
|
@@ -27,4 +27,23 @@ public class RCTAEPMessagingDataBridge: NSObject {
|
|
|
27
27
|
.map({ $0.asDictionary() })
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
+
|
|
31
|
+
/// Extracts the activity identifier from a proposition dictionary at scopeDetails.activity.id
|
|
32
|
+
static func extractActivityId(from propositionDict: [String: Any]) -> String? {
|
|
33
|
+
guard let scopeDetails = propositionDict["scopeDetails"] as? [String: Any] else {
|
|
34
|
+
NSLog("[MessagingBridge] Missing scopeDetails on proposition; cannot extract activity.id")
|
|
35
|
+
return nil
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
guard let activity = scopeDetails["activity"] as? [String: Any] else {
|
|
39
|
+
NSLog("[MessagingBridge] Missing activity under scopeDetails; cannot extract activity.id")
|
|
40
|
+
return nil
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
guard let id = activity["id"] as? String, !id.isEmpty else {
|
|
44
|
+
NSLog("[MessagingBridge] Missing or empty activity.id; skipping uuid cache mapping")
|
|
45
|
+
return nil
|
|
46
|
+
}
|
|
47
|
+
return id
|
|
48
|
+
}
|
|
30
49
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/react-native-aepmessaging",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.2.0",
|
|
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": "1784c9a89b5938021ab0f1f42bd7fa1a6caf1d54"
|
|
43
43
|
}
|