@adobe/react-native-aepmessaging 7.2.1 → 7.4.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/RCTAEPMessaging.podspec +1 -1
- package/README.md +145 -16
- package/android/src/main/java/com/adobe/marketing/mobile/reactnative/messaging/RCTAEPMessagingConstants.java +3 -0
- package/android/src/main/java/com/adobe/marketing/mobile/reactnative/messaging/RCTAEPMessagingModule.java +103 -33
- package/babel.config.js +3 -0
- package/dist/module/Messaging.js +334 -0
- package/dist/module/Messaging.js.map +1 -0
- package/dist/module/index.js +30 -0
- package/dist/module/index.js.map +1 -0
- package/dist/module/models/ContentCard.js +24 -0
- package/dist/module/models/ContentCard.js.map +1 -0
- package/dist/{models → module/models}/HTMLProposition.js +8 -9
- package/dist/module/models/HTMLProposition.js.map +1 -0
- package/dist/module/models/InAppMessage.js +4 -0
- package/dist/module/models/InAppMessage.js.map +1 -0
- package/dist/module/models/JSONProposition.js +22 -0
- package/dist/module/models/JSONProposition.js.map +1 -0
- package/dist/module/models/Message.js +182 -0
- package/dist/module/models/Message.js.map +1 -0
- package/dist/module/models/MessagingDelegate.js +4 -0
- package/dist/module/models/MessagingDelegate.js.map +1 -0
- package/dist/module/models/MessagingEdgeEventType.js +24 -0
- package/dist/module/models/MessagingEdgeEventType.js.map +1 -0
- package/dist/module/models/MessagingProposition.js +57 -0
- package/dist/module/models/MessagingProposition.js.map +1 -0
- package/dist/module/models/MessagingPropositionItem.js +4 -0
- package/dist/module/models/MessagingPropositionItem.js.map +1 -0
- package/dist/module/models/PersonalizationSchema.js +26 -0
- package/dist/module/models/PersonalizationSchema.js.map +1 -0
- package/dist/module/models/PropositionItem.js +113 -0
- package/dist/module/models/PropositionItem.js.map +1 -0
- package/dist/module/models/ScopeDetails.js +2 -0
- package/dist/module/models/ScopeDetails.js.map +1 -0
- package/dist/{models/JSONProposition.js → module/models/index.js} +14 -12
- package/dist/module/models/index.js.map +1 -0
- package/dist/module/ui/components/Button/Button.js +57 -0
- package/dist/module/ui/components/Button/Button.js.map +1 -0
- package/dist/module/ui/components/Button/Button.spec.js +476 -0
- package/dist/module/ui/components/Button/Button.spec.js.map +1 -0
- package/dist/module/ui/components/ContentCardView/ContentCardView.js +257 -0
- package/dist/module/ui/components/ContentCardView/ContentCardView.js.map +1 -0
- package/dist/module/ui/components/ContentCardView/ContentCardView.spec.js +363 -0
- package/dist/module/ui/components/ContentCardView/ContentCardView.spec.js.map +1 -0
- package/dist/module/ui/components/DismissButton/DismissButton.js +70 -0
- package/dist/module/ui/components/DismissButton/DismissButton.js.map +1 -0
- package/dist/module/ui/components/DismissButton/DismissButton.spec.js +279 -0
- package/dist/module/ui/components/DismissButton/DismissButton.spec.js.map +1 -0
- package/dist/module/ui/components/FullScreenCenterView/FullScreenCenterView.js +34 -0
- package/dist/module/ui/components/FullScreenCenterView/FullScreenCenterView.js.map +1 -0
- package/dist/module/ui/components/Inbox/EmptyState.js +64 -0
- package/dist/module/ui/components/Inbox/EmptyState.js.map +1 -0
- package/dist/module/ui/components/Inbox/Inbox.js +235 -0
- package/dist/module/ui/components/Inbox/Inbox.js.map +1 -0
- package/dist/module/ui/components/Inbox/Inbox.spec.js +847 -0
- package/dist/module/ui/components/Inbox/Inbox.spec.js.map +1 -0
- package/dist/module/ui/components/Pagination/Pagination.js +176 -0
- package/dist/module/ui/components/Pagination/Pagination.js.map +1 -0
- package/dist/module/ui/components/Pagination/Pagination.spec.js +193 -0
- package/dist/module/ui/components/Pagination/Pagination.spec.js.map +1 -0
- package/dist/module/ui/components/UnreadIcon/UnreadIcon.js +184 -0
- package/dist/module/ui/components/UnreadIcon/UnreadIcon.js.map +1 -0
- package/dist/module/ui/components/UnreadIcon/UnreadIcon.spec.js +815 -0
- package/dist/module/ui/components/UnreadIcon/UnreadIcon.spec.js.map +1 -0
- package/dist/{models/ContentCard.js → module/ui/components/index.js} +12 -12
- package/dist/module/ui/components/index.js.map +1 -0
- package/dist/module/ui/hooks/index.js +18 -0
- package/dist/module/ui/hooks/index.js.map +1 -0
- package/dist/module/ui/hooks/useAspectRatio.js +33 -0
- package/dist/module/ui/hooks/useAspectRatio.js.map +1 -0
- package/dist/module/ui/hooks/useAspectRatio.spec.js +65 -0
- package/dist/module/ui/hooks/useAspectRatio.spec.js.map +1 -0
- package/dist/module/ui/hooks/useContentCardUI.js +51 -0
- package/dist/module/ui/hooks/useContentCardUI.js.map +1 -0
- package/dist/module/ui/hooks/useContentCardUI.spec.js +85 -0
- package/dist/module/ui/hooks/useContentCardUI.spec.js.map +1 -0
- package/dist/module/ui/hooks/useInbox.js +49 -0
- package/dist/module/ui/hooks/useInbox.js.map +1 -0
- package/dist/module/ui/hooks/useInbox.spec.js +93 -0
- package/dist/module/ui/hooks/useInbox.spec.js.map +1 -0
- package/dist/module/ui/hooks/useInboxSettings.js +26 -0
- package/dist/module/ui/hooks/useInboxSettings.js.map +1 -0
- package/dist/module/ui/hooks/useInboxSettings.spec.js +50 -0
- package/dist/module/ui/hooks/useInboxSettings.spec.js.map +1 -0
- package/dist/module/ui/index.js +10 -0
- package/dist/module/ui/index.js.map +1 -0
- package/dist/module/ui/providers/InboxProvider.js +27 -0
- package/dist/module/ui/providers/InboxProvider.js.map +1 -0
- package/dist/module/ui/theme/Theme.js +2 -0
- package/dist/module/ui/theme/Theme.js.map +1 -0
- package/dist/module/ui/theme/ThemeProvider.js +112 -0
- package/dist/module/ui/theme/ThemeProvider.js.map +1 -0
- package/dist/{models/InAppMessage.js → module/ui/theme/index.js} +6 -3
- package/dist/module/ui/theme/index.js.map +1 -0
- package/dist/module/ui/types/ContentViewEvent.js +2 -0
- package/dist/module/ui/types/ContentViewEvent.js.map +1 -0
- package/dist/module/ui/types/Templates.js +26 -0
- package/dist/module/ui/types/Templates.js.map +1 -0
- package/dist/{models/ScopeDetails.js → module/ui/types/index.js} +6 -3
- package/dist/module/ui/types/index.js.map +1 -0
- package/dist/module/ui/utils/generateCardHash.js +50 -0
- package/dist/module/ui/utils/generateCardHash.js.map +1 -0
- package/dist/module/ui/utils/generateCardHash.spec.js +103 -0
- package/dist/module/ui/utils/generateCardHash.spec.js.map +1 -0
- package/dist/module/ui/utils/inboxStorage.js +65 -0
- package/dist/module/ui/utils/inboxStorage.js.map +1 -0
- package/dist/module/ui/utils/inboxStorage.spec.js +123 -0
- package/dist/module/ui/utils/inboxStorage.spec.js.map +1 -0
- package/dist/module/ui/utils/index.js +5 -0
- package/dist/module/ui/utils/index.js.map +1 -0
- package/dist/{Messaging.d.ts → typescript/Messaging.d.ts} +23 -7
- package/dist/typescript/Messaging.d.ts.map +1 -0
- package/dist/{index.d.ts → typescript/index.d.ts} +4 -2
- package/dist/typescript/index.d.ts.map +1 -0
- package/dist/typescript/models/ContentCard.d.ts +57 -0
- package/dist/typescript/models/ContentCard.d.ts.map +1 -0
- package/dist/{models → typescript/models}/HTMLProposition.d.ts +1 -0
- package/dist/typescript/models/HTMLProposition.d.ts.map +1 -0
- package/dist/{models → typescript/models}/InAppMessage.d.ts +1 -0
- package/dist/typescript/models/InAppMessage.d.ts.map +1 -0
- package/dist/{models → typescript/models}/JSONProposition.d.ts +1 -0
- package/dist/typescript/models/JSONProposition.d.ts.map +1 -0
- package/dist/{models → typescript/models}/Message.d.ts +14 -0
- package/dist/typescript/models/Message.d.ts.map +1 -0
- package/dist/{models → typescript/models}/MessagingDelegate.d.ts +1 -0
- package/dist/typescript/models/MessagingDelegate.d.ts.map +1 -0
- package/dist/{models → typescript/models}/MessagingEdgeEventType.d.ts +1 -0
- package/dist/typescript/models/MessagingEdgeEventType.d.ts.map +1 -0
- package/dist/{models → typescript/models}/MessagingProposition.d.ts +1 -0
- package/dist/typescript/models/MessagingProposition.d.ts.map +1 -0
- package/dist/{models → typescript/models}/MessagingPropositionItem.d.ts +1 -0
- package/dist/typescript/models/MessagingPropositionItem.d.ts.map +1 -0
- package/dist/{models → typescript/models}/PersonalizationSchema.d.ts +2 -0
- package/dist/typescript/models/PersonalizationSchema.d.ts.map +1 -0
- package/dist/{models → typescript/models}/PropositionItem.d.ts +1 -0
- package/dist/typescript/models/PropositionItem.d.ts.map +1 -0
- package/dist/{models → typescript/models}/ScopeDetails.d.ts +1 -0
- package/dist/typescript/models/ScopeDetails.d.ts.map +1 -0
- package/dist/typescript/models/index.d.ts +11 -0
- package/dist/typescript/models/index.d.ts.map +1 -0
- package/dist/typescript/ui/components/Button/Button.d.ts +14 -0
- package/dist/typescript/ui/components/Button/Button.d.ts.map +1 -0
- package/dist/typescript/ui/components/Button/Button.spec.d.ts +2 -0
- package/dist/typescript/ui/components/Button/Button.spec.d.ts.map +1 -0
- package/dist/typescript/ui/components/ContentCardView/ContentCardView.d.ts +39 -0
- package/dist/typescript/ui/components/ContentCardView/ContentCardView.d.ts.map +1 -0
- package/dist/typescript/ui/components/ContentCardView/ContentCardView.spec.d.ts +2 -0
- package/dist/typescript/ui/components/ContentCardView/ContentCardView.spec.d.ts.map +1 -0
- package/dist/typescript/ui/components/DismissButton/DismissButton.d.ts +13 -0
- package/dist/typescript/ui/components/DismissButton/DismissButton.d.ts.map +1 -0
- package/dist/typescript/ui/components/DismissButton/DismissButton.spec.d.ts +2 -0
- package/dist/typescript/ui/components/DismissButton/DismissButton.spec.d.ts.map +1 -0
- package/dist/typescript/ui/components/FullScreenCenterView/FullScreenCenterView.d.ts +5 -0
- package/dist/typescript/ui/components/FullScreenCenterView/FullScreenCenterView.d.ts.map +1 -0
- package/dist/typescript/ui/components/Inbox/EmptyState.d.ts +19 -0
- package/dist/typescript/ui/components/Inbox/EmptyState.d.ts.map +1 -0
- package/dist/typescript/ui/components/Inbox/Inbox.d.ts +21 -0
- package/dist/typescript/ui/components/Inbox/Inbox.d.ts.map +1 -0
- package/dist/typescript/ui/components/Inbox/Inbox.spec.d.ts +2 -0
- package/dist/typescript/ui/components/Inbox/Inbox.spec.d.ts.map +1 -0
- package/dist/typescript/ui/components/Pagination/Pagination.d.ts +14 -0
- package/dist/typescript/ui/components/Pagination/Pagination.d.ts.map +1 -0
- package/dist/typescript/ui/components/Pagination/Pagination.spec.d.ts +2 -0
- package/dist/typescript/ui/components/Pagination/Pagination.spec.d.ts.map +1 -0
- package/dist/typescript/ui/components/UnreadIcon/UnreadIcon.d.ts +14 -0
- package/dist/typescript/ui/components/UnreadIcon/UnreadIcon.d.ts.map +1 -0
- package/dist/typescript/ui/components/UnreadIcon/UnreadIcon.spec.d.ts +2 -0
- package/dist/typescript/ui/components/UnreadIcon/UnreadIcon.spec.d.ts.map +1 -0
- package/dist/typescript/ui/components/index.d.ts +10 -0
- package/dist/typescript/ui/components/index.d.ts.map +1 -0
- package/dist/typescript/ui/hooks/index.d.ts +4 -0
- package/dist/typescript/ui/hooks/index.d.ts.map +1 -0
- package/dist/typescript/ui/hooks/useAspectRatio.d.ts +3 -0
- package/dist/typescript/ui/hooks/useAspectRatio.d.ts.map +1 -0
- package/dist/typescript/ui/hooks/useAspectRatio.spec.d.ts +2 -0
- package/dist/typescript/ui/hooks/useAspectRatio.spec.d.ts.map +1 -0
- package/dist/typescript/ui/hooks/useContentCardUI.d.ts +14 -0
- package/dist/typescript/ui/hooks/useContentCardUI.d.ts.map +1 -0
- package/dist/typescript/ui/hooks/useContentCardUI.spec.d.ts +2 -0
- package/dist/typescript/ui/hooks/useContentCardUI.spec.d.ts.map +1 -0
- package/dist/typescript/ui/hooks/useInbox.d.ts +12 -0
- package/dist/typescript/ui/hooks/useInbox.d.ts.map +1 -0
- package/dist/typescript/ui/hooks/useInbox.spec.d.ts +2 -0
- package/dist/typescript/ui/hooks/useInbox.spec.d.ts.map +1 -0
- package/dist/typescript/ui/hooks/useInboxSettings.d.ts +7 -0
- package/dist/typescript/ui/hooks/useInboxSettings.d.ts.map +1 -0
- package/dist/typescript/ui/hooks/useInboxSettings.spec.d.ts +2 -0
- package/dist/typescript/ui/hooks/useInboxSettings.spec.d.ts.map +1 -0
- package/dist/typescript/ui/index.d.ts +8 -0
- package/dist/typescript/ui/index.d.ts.map +1 -0
- package/dist/typescript/ui/providers/InboxProvider.d.ts +56 -0
- package/dist/typescript/ui/providers/InboxProvider.d.ts.map +1 -0
- package/dist/typescript/ui/theme/Theme.d.ts +44 -0
- package/dist/typescript/ui/theme/Theme.d.ts.map +1 -0
- package/dist/typescript/ui/theme/ThemeProvider.d.ts +21 -0
- package/dist/typescript/ui/theme/ThemeProvider.d.ts.map +1 -0
- package/dist/typescript/ui/theme/index.d.ts +3 -0
- package/dist/typescript/ui/theme/index.d.ts.map +1 -0
- package/dist/typescript/ui/types/ContentViewEvent.d.ts +9 -0
- package/dist/typescript/ui/types/ContentViewEvent.d.ts.map +1 -0
- package/dist/typescript/ui/types/Templates.d.ts +43 -0
- package/dist/typescript/ui/types/Templates.d.ts.map +1 -0
- package/dist/typescript/ui/types/index.d.ts +3 -0
- package/dist/typescript/ui/types/index.d.ts.map +1 -0
- package/dist/typescript/ui/utils/generateCardHash.d.ts +21 -0
- package/dist/typescript/ui/utils/generateCardHash.d.ts.map +1 -0
- package/dist/typescript/ui/utils/generateCardHash.spec.d.ts +2 -0
- package/dist/typescript/ui/utils/generateCardHash.spec.d.ts.map +1 -0
- package/dist/typescript/ui/utils/inboxStorage.d.ts +20 -0
- package/dist/typescript/ui/utils/inboxStorage.d.ts.map +1 -0
- package/dist/typescript/ui/utils/inboxStorage.spec.d.ts +2 -0
- package/dist/typescript/ui/utils/inboxStorage.spec.d.ts.map +1 -0
- package/dist/typescript/ui/utils/index.d.ts +3 -0
- package/dist/typescript/ui/utils/index.d.ts.map +1 -0
- package/ios/src/RCTAEPMessaging.mm +15 -0
- package/ios/src/RCTAEPMessaging.swift +61 -3
- package/ios/src/RCTAEPMessagingConstants.swift +4 -1
- package/jest.config.js +15 -0
- package/package.json +33 -5
- package/src/Messaging.ts +288 -32
- package/src/index.ts +3 -3
- package/src/models/ContentCard.ts +52 -27
- package/src/models/HTMLProposition.ts +1 -1
- package/src/models/JSONProposition.ts +1 -1
- package/src/models/Message.ts +50 -0
- package/src/models/PersonalizationSchema.ts +1 -0
- package/src/models/index.ts +22 -0
- package/src/ui/components/Button/Button.spec.tsx +496 -0
- package/src/ui/components/Button/Button.tsx +76 -0
- package/src/ui/components/ContentCardView/ContentCardView.spec.tsx +278 -0
- package/src/ui/components/ContentCardView/ContentCardView.tsx +400 -0
- package/src/ui/components/DismissButton/DismissButton.spec.tsx +314 -0
- package/src/ui/components/DismissButton/DismissButton.tsx +100 -0
- package/src/ui/components/FullScreenCenterView/FullScreenCenterView.tsx +32 -0
- package/src/ui/components/Inbox/EmptyState.tsx +89 -0
- package/src/ui/components/Inbox/Inbox.spec.tsx +478 -0
- package/src/ui/components/Inbox/Inbox.tsx +275 -0
- package/src/ui/components/Pagination/Pagination.spec.tsx +159 -0
- package/src/ui/components/Pagination/Pagination.tsx +222 -0
- package/src/ui/components/UnreadIcon/UnreadIcon.spec.tsx +878 -0
- package/src/ui/components/UnreadIcon/UnreadIcon.tsx +234 -0
- package/src/ui/components/index.ts +22 -0
- package/{dist/models/MessagingPropositionItem.js → src/ui/hooks/index.ts} +5 -4
- package/src/ui/hooks/useAspectRatio.spec.tsx +66 -0
- package/src/ui/hooks/useAspectRatio.tsx +39 -0
- package/src/ui/hooks/useContentCardUI.spec.tsx +82 -0
- package/src/ui/hooks/useContentCardUI.ts +48 -0
- package/src/ui/hooks/useInbox.spec.tsx +87 -0
- package/src/ui/hooks/useInbox.ts +46 -0
- package/src/ui/hooks/useInboxSettings.spec.tsx +41 -0
- package/src/ui/hooks/useInboxSettings.ts +24 -0
- package/src/ui/index.ts +7 -0
- package/src/ui/providers/InboxProvider.tsx +79 -0
- package/src/ui/theme/Theme.ts +57 -0
- package/src/ui/theme/ThemeProvider.tsx +120 -0
- package/src/ui/theme/index.ts +14 -0
- package/src/ui/types/ContentViewEvent.ts +20 -0
- package/src/ui/types/Templates.ts +77 -0
- package/src/ui/types/index.ts +14 -0
- package/src/ui/utils/generateCardHash.spec.tsx +86 -0
- package/src/ui/utils/generateCardHash.ts +59 -0
- package/src/ui/utils/inboxStorage.spec.tsx +136 -0
- package/src/ui/utils/inboxStorage.ts +64 -0
- package/src/ui/utils/index.ts +3 -0
- package/tutorials/ContentCardCustomizationGuide.md +661 -0
- package/tutorials/ContentCards.md +419 -0
- package/tutorials/In-App Messaging.md +31 -0
- package/tutorials/Inbox.md +515 -0
- package/tutorials/resources/image-only-template.png +0 -0
- package/tutorials/resources/large-image-template.png +0 -0
- package/tutorials/resources/small-image-template.png +0 -0
- package/dist/Messaging.js +0 -151
- package/dist/Messaging.js.map +0 -1
- package/dist/index.js +0 -34
- package/dist/index.js.map +0 -1
- package/dist/models/ContentCard.d.ts +0 -51
- package/dist/models/ContentCard.js.map +0 -1
- package/dist/models/HTMLProposition.js.map +0 -1
- package/dist/models/InAppMessage.js.map +0 -1
- package/dist/models/JSONProposition.js.map +0 -1
- package/dist/models/Message.js +0 -114
- package/dist/models/Message.js.map +0 -1
- package/dist/models/MessagingDelegate.js +0 -14
- package/dist/models/MessagingDelegate.js.map +0 -1
- package/dist/models/MessagingEdgeEventType.js +0 -24
- package/dist/models/MessagingEdgeEventType.js.map +0 -1
- package/dist/models/MessagingProposition.js +0 -59
- package/dist/models/MessagingProposition.js.map +0 -1
- package/dist/models/MessagingPropositionItem.js.map +0 -1
- package/dist/models/PersonalizationSchema.js +0 -25
- package/dist/models/PersonalizationSchema.js.map +0 -1
- package/dist/models/PropositionItem.js +0 -78
- package/dist/models/PropositionItem.js.map +0 -1
- package/dist/models/ScopeDetails.js.map +0 -1
package/RCTAEPMessaging.podspec
CHANGED
package/README.md
CHANGED
|
@@ -36,6 +36,7 @@ yarn add @adobe/react-native-aepmessaging
|
|
|
36
36
|
### Initializing with SDK:
|
|
37
37
|
|
|
38
38
|
To initialize the SDK, use the following methods:
|
|
39
|
+
|
|
39
40
|
- [MobileCore.initializeWithAppId(appId)](https://github.com/adobe/aepsdk-react-native/tree/main/packages/core#initializewithappid)
|
|
40
41
|
- [MobileCore.initialize(initOptions)](https://github.com/adobe/aepsdk-react-native/tree/main/packages/core#initialize)
|
|
41
42
|
|
|
@@ -48,8 +49,8 @@ import {
|
|
|
48
49
|
Messaging,
|
|
49
50
|
MessagingDelegate,
|
|
50
51
|
MessagingEdgeEventType,
|
|
51
|
-
Message
|
|
52
|
-
} from
|
|
52
|
+
Message,
|
|
53
|
+
} from "@adobe/react-native-aepmessaging";
|
|
53
54
|
```
|
|
54
55
|
|
|
55
56
|
## API reference
|
|
@@ -68,7 +69,7 @@ extensionVersion(): Promise<string>
|
|
|
68
69
|
|
|
69
70
|
```javascript
|
|
70
71
|
Messaging.extensionVersion().then((version) =>
|
|
71
|
-
console.log(
|
|
72
|
+
console.log("AdobeExperienceSDK: Messaging version: " + version)
|
|
72
73
|
);
|
|
73
74
|
```
|
|
74
75
|
|
|
@@ -139,7 +140,7 @@ const messagingDelegate = {
|
|
|
139
140
|
|
|
140
141
|
urlLoaded(url: string, message: Message) {
|
|
141
142
|
// Action after message loads an URL
|
|
142
|
-
}
|
|
143
|
+
},
|
|
143
144
|
};
|
|
144
145
|
|
|
145
146
|
Messaging.setMessagingDelegate(messagingDelegate);
|
|
@@ -152,7 +153,7 @@ const messagingDelegate = {
|
|
|
152
153
|
shouldShowMessage(message: Message) {
|
|
153
154
|
Messaging.saveMessage(message);
|
|
154
155
|
return false;
|
|
155
|
-
}
|
|
156
|
+
},
|
|
156
157
|
};
|
|
157
158
|
```
|
|
158
159
|
|
|
@@ -169,7 +170,7 @@ updatePropositionsForSurfaces(surfaces: string[])
|
|
|
169
170
|
**Example**
|
|
170
171
|
|
|
171
172
|
```javascript
|
|
172
|
-
Messaging.updatePropositionsForSurfaces([
|
|
173
|
+
Messaging.updatePropositionsForSurfaces(["mobileapp://my-surface"]);
|
|
173
174
|
```
|
|
174
175
|
|
|
175
176
|
### getPropositionsForSurfaces
|
|
@@ -186,7 +187,7 @@ getPropositionsForSurfaces(surfaces: string[])
|
|
|
186
187
|
**Example**
|
|
187
188
|
|
|
188
189
|
```javascript
|
|
189
|
-
const propositions = Messaging.getPropositionsForSurfaces([
|
|
190
|
+
const propositions = Messaging.getPropositionsForSurfaces(["my-surface"]);
|
|
190
191
|
console.log(propositions);
|
|
191
192
|
```
|
|
192
193
|
|
|
@@ -345,7 +346,7 @@ track(interaction: ?string, eventType: MessagingEdgeEventType)
|
|
|
345
346
|
|
|
346
347
|
```javascript
|
|
347
348
|
var message: Message;
|
|
348
|
-
message.track(
|
|
349
|
+
message.track("sample text", MessagingEdgeEventType.IN_APP_DISMISS);
|
|
349
350
|
```
|
|
350
351
|
|
|
351
352
|
### setAutoTrack
|
|
@@ -412,7 +413,7 @@ type MessagingDelegate = {
|
|
|
412
413
|
|
|
413
414
|
urlLoaded(url: string, message: Message): void, // iOS Only
|
|
414
415
|
|
|
415
|
-
onContentLoaded(message: Message): void // Android Only
|
|
416
|
+
onContentLoaded(message: Message): void, // Android Only
|
|
416
417
|
};
|
|
417
418
|
```
|
|
418
419
|
|
|
@@ -438,7 +439,7 @@ const messagingDelegate = {
|
|
|
438
439
|
|
|
439
440
|
onContentLoaded(message: Message) {
|
|
440
441
|
// Action after message loads content
|
|
441
|
-
}
|
|
442
|
+
},
|
|
442
443
|
};
|
|
443
444
|
```
|
|
444
445
|
|
|
@@ -450,7 +451,7 @@ Below is an example of when the developer may choose to suppress an in-app messa
|
|
|
450
451
|
|
|
451
452
|
```javascript
|
|
452
453
|
function shouldShowMessage(message: Message): boolean {
|
|
453
|
-
if (someOtherWorkflowStatus ==
|
|
454
|
+
if (someOtherWorkflowStatus == "inProgress") {
|
|
454
455
|
return false;
|
|
455
456
|
}
|
|
456
457
|
|
|
@@ -465,12 +466,12 @@ Continuing with the above example, the developer has stored the message that was
|
|
|
465
466
|
var cachedMessage: Message;
|
|
466
467
|
|
|
467
468
|
function otherWorkflowFinished() {
|
|
468
|
-
anotherWorkflowStatus =
|
|
469
|
+
anotherWorkflowStatus = "complete";
|
|
469
470
|
cachedMessage.show();
|
|
470
471
|
}
|
|
471
472
|
|
|
472
473
|
function shouldShowMessage(message: Message): boolean {
|
|
473
|
-
if (anotherWorkflowStatus ===
|
|
474
|
+
if (anotherWorkflowStatus === "inProgress") {
|
|
474
475
|
// store the current message for later use
|
|
475
476
|
Messaging.saveMessage(message);
|
|
476
477
|
cachedMessage = message;
|
|
@@ -485,13 +486,12 @@ function shouldShowMessage(message: Message): boolean {
|
|
|
485
486
|
|
|
486
487
|
```javascript
|
|
487
488
|
function otherWorkflowFinished() {
|
|
488
|
-
anotherWorkflowStatus =
|
|
489
|
+
anotherWorkflowStatus = "complete";
|
|
489
490
|
currentMessage.show();
|
|
490
491
|
currentMessage.clearMessage();
|
|
491
492
|
}
|
|
492
493
|
```
|
|
493
494
|
|
|
494
|
-
|
|
495
495
|
## Tracking interactions with content cards
|
|
496
496
|
|
|
497
497
|
### trackContentCardDisplay
|
|
@@ -501,6 +501,7 @@ Deprecated in 7.2.0: Use `Proposition.track(...)` instead. This API will be remo
|
|
|
501
501
|
Tracks a Display interaction with the given ContentCard
|
|
502
502
|
|
|
503
503
|
**Syntax**
|
|
504
|
+
|
|
504
505
|
```javascript
|
|
505
506
|
Messaging.trackContentCardDisplay(proposition, contentCard);
|
|
506
507
|
```
|
|
@@ -512,10 +513,138 @@ Deprecated in 7.2.0: Use `Proposition.track(...)` instead. This API will be remo
|
|
|
512
513
|
Tracks a Click interaction with the given ContentCard
|
|
513
514
|
|
|
514
515
|
**Syntax**
|
|
516
|
+
|
|
515
517
|
```javascript
|
|
516
518
|
Messaging.trackContentCardInteraction(proposition, contentCard);
|
|
517
519
|
```
|
|
518
520
|
|
|
521
|
+
## Inbox & Content Cards
|
|
522
|
+
|
|
523
|
+
The messaging extension provides pre-built React Native UI components for displaying content cards and inbox views in your application.
|
|
524
|
+
|
|
525
|
+
### ContentCardView
|
|
526
|
+
|
|
527
|
+
The `ContentCardView` component renders individual content cards with automatic layout handling for different card types (SmallImage, LargeImage, ImageOnly).
|
|
528
|
+
|
|
529
|
+
**Import:**
|
|
530
|
+
|
|
531
|
+
```javascript
|
|
532
|
+
import { ContentCardView } from "@adobe/react-native-aepmessaging/ui";
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
**Basic Usage:**
|
|
536
|
+
|
|
537
|
+
```javascript
|
|
538
|
+
<ContentCardView
|
|
539
|
+
template={contentCard}
|
|
540
|
+
listener={(event, data) => {
|
|
541
|
+
console.log('Content card event:', event, data);
|
|
542
|
+
}}
|
|
543
|
+
/>
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
**Props:**
|
|
547
|
+
|
|
548
|
+
- `template` (required): The content card template object from `getPropositionsForSurfaces`
|
|
549
|
+
- `listener` (optional): Callback function for content card events (`onDisplay`, `onInteract`, `onDismiss`)
|
|
550
|
+
- `variant` (optional): Override card variant (`SmallImage`, `LargeImage`, `ImageOnly`)
|
|
551
|
+
- `styleOverrides` (optional): Custom style overrides for card components
|
|
552
|
+
|
|
553
|
+
### useContentCardUI Hook
|
|
554
|
+
|
|
555
|
+
A convenient hook that manages content card fetching, state, and error handling.
|
|
556
|
+
|
|
557
|
+
**Import:**
|
|
558
|
+
|
|
559
|
+
```javascript
|
|
560
|
+
import { useContentCardUI } from "@adobe/react-native-aepmessaging/ui";
|
|
561
|
+
```
|
|
562
|
+
|
|
563
|
+
**Usage:**
|
|
564
|
+
|
|
565
|
+
```javascript
|
|
566
|
+
const { content, isLoading, error } = useContentCardUI('homepage');
|
|
567
|
+
|
|
568
|
+
if (isLoading) return <Text>Loading...</Text>;
|
|
569
|
+
if (error) return <Text>Error: {error.message}</Text>;
|
|
570
|
+
|
|
571
|
+
return (
|
|
572
|
+
<FlatList
|
|
573
|
+
data={content}
|
|
574
|
+
renderItem={({ item }) => <ContentCardView template={item} />}
|
|
575
|
+
/>
|
|
576
|
+
);
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
### Inbox Component
|
|
580
|
+
|
|
581
|
+
The `Inbox` component provides a complete inbox view for content cards with built-in support for loading states, error handling, empty states, pagination, and card management (dismiss, interact).
|
|
582
|
+
|
|
583
|
+
**Import:**
|
|
584
|
+
|
|
585
|
+
```javascript
|
|
586
|
+
import { Inbox } from "@adobe/react-native-aepmessaging/ui";
|
|
587
|
+
```
|
|
588
|
+
|
|
589
|
+
**Basic Usage:**
|
|
590
|
+
|
|
591
|
+
```javascript
|
|
592
|
+
import { useInbox } from "@adobe/react-native-aepmessaging/ui";
|
|
593
|
+
|
|
594
|
+
function MyInboxScreen() {
|
|
595
|
+
const { settings, isLoading, error } = useInbox('homepage');
|
|
596
|
+
|
|
597
|
+
return (
|
|
598
|
+
<Inbox
|
|
599
|
+
surface="homepage"
|
|
600
|
+
settings={settings}
|
|
601
|
+
isLoading={isLoading}
|
|
602
|
+
error={!!error}
|
|
603
|
+
LoadingComponent={<ActivityIndicator />}
|
|
604
|
+
ErrorComponent={<Text>Error loading inbox</Text>}
|
|
605
|
+
/>
|
|
606
|
+
);
|
|
607
|
+
}
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
**Props:**
|
|
611
|
+
|
|
612
|
+
- `surface` (required): Surface identifier for the inbox
|
|
613
|
+
- `settings` (required): Inbox settings from `useInbox` hook or `Messaging.getInbox()`
|
|
614
|
+
- `isLoading` (optional): Loading state
|
|
615
|
+
- `error` (optional): Error state
|
|
616
|
+
- `LoadingComponent` (optional): Custom loading component (default: `<ActivityIndicator />`)
|
|
617
|
+
- `ErrorComponent` (optional): Custom error component
|
|
618
|
+
- `FallbackComponent` (optional): Component shown when settings are null
|
|
619
|
+
- `EmptyComponent` (optional): Custom empty state component
|
|
620
|
+
- `CardProps` (optional): Props passed to individual `ContentCardView` components
|
|
621
|
+
- All `FlatListProps` are supported for layout customization
|
|
622
|
+
|
|
623
|
+
### useInbox Hook
|
|
624
|
+
|
|
625
|
+
A hook that fetches inbox settings for a given surface.
|
|
626
|
+
|
|
627
|
+
**Import:**
|
|
628
|
+
|
|
629
|
+
```javascript
|
|
630
|
+
import { useInbox } from "@adobe/react-native-aepmessaging/ui";
|
|
631
|
+
```
|
|
632
|
+
|
|
633
|
+
**Usage:**
|
|
634
|
+
|
|
635
|
+
```javascript
|
|
636
|
+
const { settings, isLoading, error, refetch } = useInbox('homepage');
|
|
637
|
+
|
|
638
|
+
// settings contains inbox configuration (layout, capacity, heading, etc.)
|
|
639
|
+
// refetch can be called to reload settings
|
|
640
|
+
```
|
|
641
|
+
|
|
642
|
+
For detailed examples and customization options, see the [Content Cards Tutorial](./tutorials/ContentCards.md), [Content Card Customization Guide](./tutorials/ContentCardCustomizationGuide.md), and [Inbox Tutorial](./tutorials/Inbox.md).
|
|
519
643
|
|
|
520
644
|
## Tutorials
|
|
521
|
-
|
|
645
|
+
|
|
646
|
+
- [Content Cards Tutorial](./tutorials/ContentCards.md) - Complete guide to implementing content cards
|
|
647
|
+
- [Content Card Customization Guide](./tutorials/ContentCardCustomizationGuide.md) - Advanced styling and customization
|
|
648
|
+
- [Inbox Tutorial](./tutorials/Inbox.md) - Complete guide to implementing inbox views
|
|
649
|
+
- [Content Card UI API Reference](./tutorials/ContentCardUI_API_Reference.md) - Complete API reference for UI components
|
|
650
|
+
- [In-App Messaging Tutorial](./tutorials/In-App%20Messaging.md) - Native handling of JavaScript events
|
|
@@ -14,6 +14,9 @@ package com.adobe.marketing.mobile.reactnative.messaging;
|
|
|
14
14
|
class RCTAEPMessagingConstants {
|
|
15
15
|
static final String MESSAGE_ID_KEY = "messageId";
|
|
16
16
|
static final String HANDLER_NAME_KEY = "handlerName";
|
|
17
|
+
static final String JAVASCRIPT_STRING_KEY = "javascriptString";
|
|
17
18
|
static final String CONTENT_KEY = "content";
|
|
19
|
+
static final String RESULT_KEY = "result";
|
|
18
20
|
static final String ON_JAVASCRIPT_MESSAGE_EVENT = "onJavascriptMessage";
|
|
21
|
+
static final String ON_JAVASCRIPT_RESULT_EVENT = "onJavascriptResult";
|
|
19
22
|
}
|
|
@@ -14,6 +14,8 @@ package com.adobe.marketing.mobile.reactnative.messaging;
|
|
|
14
14
|
import static com.adobe.marketing.mobile.reactnative.messaging.RCTAEPMessagingUtil.convertMessageToMap;
|
|
15
15
|
|
|
16
16
|
import android.app.Activity;
|
|
17
|
+
import android.content.Context;
|
|
18
|
+
import android.content.SharedPreferences;
|
|
17
19
|
import android.util.Log;
|
|
18
20
|
|
|
19
21
|
import androidx.annotation.NonNull;
|
|
@@ -31,9 +33,9 @@ import com.adobe.marketing.mobile.messaging.PropositionItem;
|
|
|
31
33
|
import com.adobe.marketing.mobile.messaging.Surface;
|
|
32
34
|
import com.adobe.marketing.mobile.services.ServiceProvider;
|
|
33
35
|
import com.adobe.marketing.mobile.services.ui.InAppMessage;
|
|
34
|
-
import com.adobe.marketing.mobile.services.ui.message.InAppMessageEventHandler;
|
|
35
36
|
import com.adobe.marketing.mobile.services.ui.Presentable;
|
|
36
37
|
import com.adobe.marketing.mobile.services.ui.PresentationDelegate;
|
|
38
|
+
import com.adobe.marketing.mobile.services.ui.message.InAppMessageEventHandler;
|
|
37
39
|
import com.facebook.react.bridge.Arguments;
|
|
38
40
|
import com.facebook.react.bridge.Promise;
|
|
39
41
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
@@ -133,7 +135,8 @@ public final class RCTAEPMessagingModule
|
|
|
133
135
|
@ReactMethod
|
|
134
136
|
public void getLatestMessage(final Promise promise) {
|
|
135
137
|
if (this.latestMessage != null) {
|
|
136
|
-
promise.resolve(RCTAEPMessagingUtil.convertToReadableMap(
|
|
138
|
+
promise.resolve(RCTAEPMessagingUtil.convertToReadableMap(
|
|
139
|
+
convertMessageToMap(this.latestMessage)));
|
|
137
140
|
} else {
|
|
138
141
|
promise.resolve(null);
|
|
139
142
|
}
|
|
@@ -189,10 +192,9 @@ public final class RCTAEPMessagingModule
|
|
|
189
192
|
|
|
190
193
|
@ReactMethod
|
|
191
194
|
public void updatePropositionsForSurfaces(ReadableArray surfaces) {
|
|
192
|
-
|
|
195
|
+
Messaging.updatePropositionsForSurfaces(
|
|
193
196
|
RCTAEPMessagingUtil.convertSurfaces(surfaces));
|
|
194
197
|
propositionItemByUuid.clear();
|
|
195
|
-
|
|
196
198
|
}
|
|
197
199
|
|
|
198
200
|
// Message Methods
|
|
@@ -239,15 +241,18 @@ public final class RCTAEPMessagingModule
|
|
|
239
241
|
}
|
|
240
242
|
|
|
241
243
|
@ReactMethod
|
|
242
|
-
public void handleJavascriptMessage(final String messageId,
|
|
244
|
+
public void handleJavascriptMessage(final String messageId,
|
|
245
|
+
final String handlerName) {
|
|
243
246
|
Presentable<?> presentable = presentableCache.get(messageId);
|
|
244
247
|
if (presentable == null || !(presentable.getPresentation() instanceof InAppMessage)) {
|
|
245
248
|
Log.w(TAG, "handleJavascriptMessage: No presentable found for messageId: " + messageId);
|
|
246
249
|
return;
|
|
247
250
|
}
|
|
248
251
|
|
|
249
|
-
Presentable<InAppMessage> inAppMessagePresentable =
|
|
250
|
-
|
|
252
|
+
Presentable<InAppMessage> inAppMessagePresentable =
|
|
253
|
+
(Presentable<InAppMessage>)presentable;
|
|
254
|
+
InAppMessageEventHandler eventHandler =
|
|
255
|
+
inAppMessagePresentable.getPresentation().getEventHandler();
|
|
251
256
|
|
|
252
257
|
eventHandler.handleJavascriptMessage(handlerName, content -> {
|
|
253
258
|
Map<String, String> params = new HashMap<>();
|
|
@@ -258,51 +263,74 @@ public final class RCTAEPMessagingModule
|
|
|
258
263
|
});
|
|
259
264
|
}
|
|
260
265
|
|
|
266
|
+
@ReactMethod
|
|
267
|
+
public void evaluateJavascript(final String messageId, final String javascriptString) {
|
|
268
|
+
Presentable<?> presentable = presentableCache.get(messageId);
|
|
269
|
+
if (presentable == null || !(presentable.getPresentation() instanceof InAppMessage)) {
|
|
270
|
+
Log.w(TAG, "evaluateJavascript: No presentable found for messageId: " + messageId);
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
Presentable<InAppMessage> inAppMessagePresentable = (Presentable<InAppMessage>) presentable;
|
|
275
|
+
InAppMessageEventHandler eventHandler = inAppMessagePresentable.getPresentation().getEventHandler();
|
|
276
|
+
eventHandler.evaluateJavascript(javascriptString, result -> {
|
|
277
|
+
Map<String, String> params = new HashMap<>();
|
|
278
|
+
params.put(RCTAEPMessagingConstants.MESSAGE_ID_KEY, messageId);
|
|
279
|
+
params.put(RCTAEPMessagingConstants.JAVASCRIPT_STRING_KEY, javascriptString);
|
|
280
|
+
params.put(RCTAEPMessagingConstants.RESULT_KEY, result);
|
|
281
|
+
emitEvent(RCTAEPMessagingConstants.ON_JAVASCRIPT_RESULT_EVENT, params);
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
|
|
261
285
|
// Messaging Delegate functions
|
|
262
286
|
@Override
|
|
263
287
|
public void onShow(final Presentable<?> presentable) {
|
|
264
|
-
if (!(presentable.getPresentation() instanceof InAppMessage))
|
|
265
|
-
|
|
288
|
+
if (!(presentable.getPresentation() instanceof InAppMessage))
|
|
289
|
+
return;
|
|
290
|
+
Message message = MessagingUtils.getMessageForPresentable(
|
|
291
|
+
(Presentable<InAppMessage>)presentable);
|
|
266
292
|
presentableCache.put(message.getId(), presentable);
|
|
267
293
|
|
|
268
294
|
if (message != null) {
|
|
269
|
-
Map<String, String> data =
|
|
270
|
-
convertMessageToMap(message);
|
|
295
|
+
Map<String, String> data = convertMessageToMap(message);
|
|
271
296
|
emitEvent("onShow", data);
|
|
272
297
|
}
|
|
273
298
|
}
|
|
274
299
|
|
|
275
300
|
@Override
|
|
276
301
|
public void onDismiss(final Presentable<?> presentable) {
|
|
277
|
-
if (!(presentable.getPresentation() instanceof InAppMessage))
|
|
278
|
-
|
|
302
|
+
if (!(presentable.getPresentation() instanceof InAppMessage))
|
|
303
|
+
return;
|
|
304
|
+
Message message = MessagingUtils.getMessageForPresentable(
|
|
305
|
+
(Presentable<InAppMessage>)presentable);
|
|
279
306
|
presentableCache.remove(message.getId());
|
|
280
307
|
|
|
281
308
|
if (message != null) {
|
|
282
|
-
Map<String, String> data =
|
|
283
|
-
convertMessageToMap(message);
|
|
309
|
+
Map<String, String> data = convertMessageToMap(message);
|
|
284
310
|
emitEvent("onDismiss", data);
|
|
285
311
|
}
|
|
286
312
|
}
|
|
287
313
|
|
|
288
314
|
@Override
|
|
289
315
|
public void onHide(final Presentable<?> presentable) {
|
|
290
|
-
if (!(presentable.getPresentation() instanceof InAppMessage))
|
|
291
|
-
|
|
316
|
+
if (!(presentable.getPresentation() instanceof InAppMessage))
|
|
317
|
+
return;
|
|
318
|
+
Message message = MessagingUtils.getMessageForPresentable(
|
|
319
|
+
(Presentable<InAppMessage>)presentable);
|
|
292
320
|
if (message != null) {
|
|
293
|
-
Map<String, String> data =
|
|
294
|
-
convertMessageToMap(message);
|
|
321
|
+
Map<String, String> data = convertMessageToMap(message);
|
|
295
322
|
emitEvent("onHide", data);
|
|
296
323
|
}
|
|
297
324
|
}
|
|
298
325
|
|
|
299
326
|
@Override
|
|
300
327
|
public boolean canShow(final Presentable<?> presentable) {
|
|
301
|
-
if (!(presentable.getPresentation() instanceof InAppMessage))
|
|
302
|
-
|
|
328
|
+
if (!(presentable.getPresentation() instanceof InAppMessage))
|
|
329
|
+
return false;
|
|
330
|
+
Message message = MessagingUtils.getMessageForPresentable(
|
|
331
|
+
(Presentable<InAppMessage>)presentable);
|
|
303
332
|
if (message != null) {
|
|
304
|
-
Map<String, String> data =
|
|
305
|
-
convertMessageToMap(message);
|
|
333
|
+
Map<String, String> data = convertMessageToMap(message);
|
|
306
334
|
emitEvent("shouldShowMessage", data);
|
|
307
335
|
// Latch stops the thread until the shouldShowMessage value is received
|
|
308
336
|
// from the JS side on thread dedicated to run JS code. The function
|
|
@@ -323,23 +351,26 @@ public final class RCTAEPMessagingModule
|
|
|
323
351
|
return shouldShowMessage;
|
|
324
352
|
}
|
|
325
353
|
|
|
326
|
-
public void onContentLoaded(final Presentable<?> presentable,
|
|
327
|
-
|
|
328
|
-
|
|
354
|
+
public void onContentLoaded(final Presentable<?> presentable,
|
|
355
|
+
PresentationContent presentationContent) {
|
|
356
|
+
if (!(presentable.getPresentation() instanceof InAppMessage))
|
|
357
|
+
return;
|
|
358
|
+
Message message = MessagingUtils.getMessageForPresentable(
|
|
359
|
+
(Presentable<InAppMessage>)presentable);
|
|
329
360
|
if (message != null) {
|
|
330
|
-
Map<String, String> data =
|
|
331
|
-
convertMessageToMap(message);
|
|
361
|
+
Map<String, String> data = convertMessageToMap(message);
|
|
332
362
|
emitEvent("onContentLoaded", data);
|
|
333
363
|
}
|
|
334
364
|
}
|
|
335
365
|
|
|
336
366
|
// Messaging Delegate Callback
|
|
337
367
|
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
338
|
-
public
|
|
368
|
+
public boolean setMessageSettings(final boolean shouldShowMessage,
|
|
339
369
|
final boolean shouldSaveMessage) {
|
|
340
370
|
this.shouldShowMessage = shouldShowMessage;
|
|
341
371
|
this.shouldSaveMessage = shouldSaveMessage;
|
|
342
372
|
latch.countDown();
|
|
373
|
+
return true;
|
|
343
374
|
}
|
|
344
375
|
|
|
345
376
|
/**
|
|
@@ -359,8 +390,10 @@ public final class RCTAEPMessagingModule
|
|
|
359
390
|
}
|
|
360
391
|
|
|
361
392
|
@ReactMethod
|
|
362
|
-
public void trackContentCardDisplay(ReadableMap propositionMap,
|
|
363
|
-
|
|
393
|
+
public void trackContentCardDisplay(ReadableMap propositionMap,
|
|
394
|
+
ReadableMap contentCardMap) {
|
|
395
|
+
final Map<String, Object> eventData =
|
|
396
|
+
RCTAEPMessagingUtil.convertReadableMapToMap(propositionMap);
|
|
364
397
|
final Proposition proposition = Proposition.fromEventData(eventData);
|
|
365
398
|
for (PropositionItem item : proposition.getItems()) {
|
|
366
399
|
if (item.getItemId().equals(contentCardMap.getString("id"))) {
|
|
@@ -371,8 +404,10 @@ public final class RCTAEPMessagingModule
|
|
|
371
404
|
}
|
|
372
405
|
|
|
373
406
|
@ReactMethod
|
|
374
|
-
public void trackContentCardInteraction(ReadableMap propositionMap,
|
|
375
|
-
|
|
407
|
+
public void trackContentCardInteraction(ReadableMap propositionMap,
|
|
408
|
+
ReadableMap contentCardMap) {
|
|
409
|
+
final Map<String, Object> eventData =
|
|
410
|
+
RCTAEPMessagingUtil.convertReadableMapToMap(propositionMap);
|
|
376
411
|
final Proposition proposition = Proposition.fromEventData(eventData);
|
|
377
412
|
for (PropositionItem item : proposition.getItems()) {
|
|
378
413
|
if (item.getItemId().equals(contentCardMap.getString("id"))) {
|
|
@@ -429,4 +464,39 @@ public final class RCTAEPMessagingModule
|
|
|
429
464
|
}
|
|
430
465
|
}
|
|
431
466
|
|
|
467
|
+
private static final String INBOX_PREFS = "AEPMessagingInbox";
|
|
468
|
+
private static final String INBOX_KEY_PREFIX = "aep_messaging_inbox_";
|
|
469
|
+
|
|
470
|
+
@ReactMethod
|
|
471
|
+
public void getInboxState(String activityId, final Promise promise) {
|
|
472
|
+
try {
|
|
473
|
+
if (activityId == null || activityId.isEmpty()) {
|
|
474
|
+
promise.resolve(null);
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
SharedPreferences prefs = reactContext.getSharedPreferences(INBOX_PREFS, Context.MODE_PRIVATE);
|
|
478
|
+
String value = prefs.getString(INBOX_KEY_PREFIX + activityId, null);
|
|
479
|
+
promise.resolve(value);
|
|
480
|
+
} catch (Exception e) {
|
|
481
|
+
Log.e(TAG, "[MessagingBridge] getInboxState error: " + e.getMessage(), e);
|
|
482
|
+
promise.resolve(null);
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
@ReactMethod
|
|
487
|
+
public void setInboxState(String activityId, String stateJson, final Promise promise) {
|
|
488
|
+
try {
|
|
489
|
+
if (activityId == null || activityId.isEmpty()) {
|
|
490
|
+
promise.resolve(null);
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
493
|
+
SharedPreferences prefs = reactContext.getSharedPreferences(INBOX_PREFS, Context.MODE_PRIVATE);
|
|
494
|
+
prefs.edit().putString(INBOX_KEY_PREFIX + activityId, stateJson).apply();
|
|
495
|
+
promise.resolve(null);
|
|
496
|
+
} catch (Exception e) {
|
|
497
|
+
Log.e(TAG, "[MessagingBridge] setInboxState error: " + e.getMessage(), e);
|
|
498
|
+
promise.reject("setInboxState", e.getMessage(), e);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
|
|
432
502
|
}
|
package/babel.config.js
ADDED