@adobe/react-native-aepmessaging 7.3.0 → 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.
Files changed (289) hide show
  1. package/RCTAEPMessaging.podspec +1 -1
  2. package/README.md +145 -16
  3. package/android/src/main/java/com/adobe/marketing/mobile/reactnative/messaging/RCTAEPMessagingModule.java +82 -32
  4. package/babel.config.js +3 -0
  5. package/dist/module/Messaging.js +334 -0
  6. package/dist/module/Messaging.js.map +1 -0
  7. package/dist/module/index.js +30 -0
  8. package/dist/module/index.js.map +1 -0
  9. package/dist/module/models/ContentCard.js +24 -0
  10. package/dist/module/models/ContentCard.js.map +1 -0
  11. package/dist/{models → module/models}/HTMLProposition.js +8 -9
  12. package/dist/module/models/HTMLProposition.js.map +1 -0
  13. package/dist/module/models/InAppMessage.js +4 -0
  14. package/dist/module/models/InAppMessage.js.map +1 -0
  15. package/dist/module/models/JSONProposition.js +22 -0
  16. package/dist/module/models/JSONProposition.js.map +1 -0
  17. package/dist/module/models/Message.js +182 -0
  18. package/dist/module/models/Message.js.map +1 -0
  19. package/dist/module/models/MessagingDelegate.js +4 -0
  20. package/dist/module/models/MessagingDelegate.js.map +1 -0
  21. package/dist/module/models/MessagingEdgeEventType.js +24 -0
  22. package/dist/module/models/MessagingEdgeEventType.js.map +1 -0
  23. package/dist/module/models/MessagingProposition.js +57 -0
  24. package/dist/module/models/MessagingProposition.js.map +1 -0
  25. package/dist/module/models/MessagingPropositionItem.js +4 -0
  26. package/dist/module/models/MessagingPropositionItem.js.map +1 -0
  27. package/dist/module/models/PersonalizationSchema.js +26 -0
  28. package/dist/module/models/PersonalizationSchema.js.map +1 -0
  29. package/dist/module/models/PropositionItem.js +113 -0
  30. package/dist/module/models/PropositionItem.js.map +1 -0
  31. package/dist/module/models/ScopeDetails.js +2 -0
  32. package/dist/module/models/ScopeDetails.js.map +1 -0
  33. package/dist/{models/JSONProposition.js → module/models/index.js} +14 -12
  34. package/dist/module/models/index.js.map +1 -0
  35. package/dist/module/ui/components/Button/Button.js +57 -0
  36. package/dist/module/ui/components/Button/Button.js.map +1 -0
  37. package/dist/module/ui/components/Button/Button.spec.js +476 -0
  38. package/dist/module/ui/components/Button/Button.spec.js.map +1 -0
  39. package/dist/module/ui/components/ContentCardView/ContentCardView.js +257 -0
  40. package/dist/module/ui/components/ContentCardView/ContentCardView.js.map +1 -0
  41. package/dist/module/ui/components/ContentCardView/ContentCardView.spec.js +363 -0
  42. package/dist/module/ui/components/ContentCardView/ContentCardView.spec.js.map +1 -0
  43. package/dist/module/ui/components/DismissButton/DismissButton.js +70 -0
  44. package/dist/module/ui/components/DismissButton/DismissButton.js.map +1 -0
  45. package/dist/module/ui/components/DismissButton/DismissButton.spec.js +279 -0
  46. package/dist/module/ui/components/DismissButton/DismissButton.spec.js.map +1 -0
  47. package/dist/module/ui/components/FullScreenCenterView/FullScreenCenterView.js +34 -0
  48. package/dist/module/ui/components/FullScreenCenterView/FullScreenCenterView.js.map +1 -0
  49. package/dist/module/ui/components/Inbox/EmptyState.js +64 -0
  50. package/dist/module/ui/components/Inbox/EmptyState.js.map +1 -0
  51. package/dist/module/ui/components/Inbox/Inbox.js +235 -0
  52. package/dist/module/ui/components/Inbox/Inbox.js.map +1 -0
  53. package/dist/module/ui/components/Inbox/Inbox.spec.js +847 -0
  54. package/dist/module/ui/components/Inbox/Inbox.spec.js.map +1 -0
  55. package/dist/module/ui/components/Pagination/Pagination.js +176 -0
  56. package/dist/module/ui/components/Pagination/Pagination.js.map +1 -0
  57. package/dist/module/ui/components/Pagination/Pagination.spec.js +193 -0
  58. package/dist/module/ui/components/Pagination/Pagination.spec.js.map +1 -0
  59. package/dist/module/ui/components/UnreadIcon/UnreadIcon.js +184 -0
  60. package/dist/module/ui/components/UnreadIcon/UnreadIcon.js.map +1 -0
  61. package/dist/module/ui/components/UnreadIcon/UnreadIcon.spec.js +815 -0
  62. package/dist/module/ui/components/UnreadIcon/UnreadIcon.spec.js.map +1 -0
  63. package/dist/{models/ContentCard.js → module/ui/components/index.js} +12 -12
  64. package/dist/module/ui/components/index.js.map +1 -0
  65. package/dist/module/ui/hooks/index.js +18 -0
  66. package/dist/module/ui/hooks/index.js.map +1 -0
  67. package/dist/module/ui/hooks/useAspectRatio.js +33 -0
  68. package/dist/module/ui/hooks/useAspectRatio.js.map +1 -0
  69. package/dist/module/ui/hooks/useAspectRatio.spec.js +65 -0
  70. package/dist/module/ui/hooks/useAspectRatio.spec.js.map +1 -0
  71. package/dist/module/ui/hooks/useContentCardUI.js +51 -0
  72. package/dist/module/ui/hooks/useContentCardUI.js.map +1 -0
  73. package/dist/module/ui/hooks/useContentCardUI.spec.js +85 -0
  74. package/dist/module/ui/hooks/useContentCardUI.spec.js.map +1 -0
  75. package/dist/module/ui/hooks/useInbox.js +49 -0
  76. package/dist/module/ui/hooks/useInbox.js.map +1 -0
  77. package/dist/module/ui/hooks/useInbox.spec.js +93 -0
  78. package/dist/module/ui/hooks/useInbox.spec.js.map +1 -0
  79. package/dist/module/ui/hooks/useInboxSettings.js +26 -0
  80. package/dist/module/ui/hooks/useInboxSettings.js.map +1 -0
  81. package/dist/module/ui/hooks/useInboxSettings.spec.js +50 -0
  82. package/dist/module/ui/hooks/useInboxSettings.spec.js.map +1 -0
  83. package/dist/module/ui/index.js +10 -0
  84. package/dist/module/ui/index.js.map +1 -0
  85. package/dist/module/ui/providers/InboxProvider.js +27 -0
  86. package/dist/module/ui/providers/InboxProvider.js.map +1 -0
  87. package/dist/module/ui/theme/Theme.js +2 -0
  88. package/dist/module/ui/theme/Theme.js.map +1 -0
  89. package/dist/module/ui/theme/ThemeProvider.js +112 -0
  90. package/dist/module/ui/theme/ThemeProvider.js.map +1 -0
  91. package/dist/{models/InAppMessage.js → module/ui/theme/index.js} +6 -3
  92. package/dist/module/ui/theme/index.js.map +1 -0
  93. package/dist/module/ui/types/ContentViewEvent.js +2 -0
  94. package/dist/module/ui/types/ContentViewEvent.js.map +1 -0
  95. package/dist/module/ui/types/Templates.js +26 -0
  96. package/dist/module/ui/types/Templates.js.map +1 -0
  97. package/dist/{models/ScopeDetails.js → module/ui/types/index.js} +6 -3
  98. package/dist/module/ui/types/index.js.map +1 -0
  99. package/dist/module/ui/utils/generateCardHash.js +50 -0
  100. package/dist/module/ui/utils/generateCardHash.js.map +1 -0
  101. package/dist/module/ui/utils/generateCardHash.spec.js +103 -0
  102. package/dist/module/ui/utils/generateCardHash.spec.js.map +1 -0
  103. package/dist/module/ui/utils/inboxStorage.js +65 -0
  104. package/dist/module/ui/utils/inboxStorage.js.map +1 -0
  105. package/dist/module/ui/utils/inboxStorage.spec.js +123 -0
  106. package/dist/module/ui/utils/inboxStorage.spec.js.map +1 -0
  107. package/dist/module/ui/utils/index.js +5 -0
  108. package/dist/module/ui/utils/index.js.map +1 -0
  109. package/dist/{Messaging.d.ts → typescript/Messaging.d.ts} +23 -7
  110. package/dist/typescript/Messaging.d.ts.map +1 -0
  111. package/dist/{index.d.ts → typescript/index.d.ts} +4 -2
  112. package/dist/typescript/index.d.ts.map +1 -0
  113. package/dist/typescript/models/ContentCard.d.ts +57 -0
  114. package/dist/typescript/models/ContentCard.d.ts.map +1 -0
  115. package/dist/{models → typescript/models}/HTMLProposition.d.ts +1 -0
  116. package/dist/typescript/models/HTMLProposition.d.ts.map +1 -0
  117. package/dist/{models → typescript/models}/InAppMessage.d.ts +1 -0
  118. package/dist/typescript/models/InAppMessage.d.ts.map +1 -0
  119. package/dist/{models → typescript/models}/JSONProposition.d.ts +1 -0
  120. package/dist/typescript/models/JSONProposition.d.ts.map +1 -0
  121. package/dist/{models → typescript/models}/Message.d.ts +1 -0
  122. package/dist/typescript/models/Message.d.ts.map +1 -0
  123. package/dist/{models → typescript/models}/MessagingDelegate.d.ts +1 -0
  124. package/dist/typescript/models/MessagingDelegate.d.ts.map +1 -0
  125. package/dist/{models → typescript/models}/MessagingEdgeEventType.d.ts +1 -0
  126. package/dist/typescript/models/MessagingEdgeEventType.d.ts.map +1 -0
  127. package/dist/{models → typescript/models}/MessagingProposition.d.ts +1 -0
  128. package/dist/typescript/models/MessagingProposition.d.ts.map +1 -0
  129. package/dist/{models → typescript/models}/MessagingPropositionItem.d.ts +1 -0
  130. package/dist/typescript/models/MessagingPropositionItem.d.ts.map +1 -0
  131. package/dist/{models → typescript/models}/PersonalizationSchema.d.ts +2 -0
  132. package/dist/typescript/models/PersonalizationSchema.d.ts.map +1 -0
  133. package/dist/{models → typescript/models}/PropositionItem.d.ts +1 -0
  134. package/dist/typescript/models/PropositionItem.d.ts.map +1 -0
  135. package/dist/{models → typescript/models}/ScopeDetails.d.ts +1 -0
  136. package/dist/typescript/models/ScopeDetails.d.ts.map +1 -0
  137. package/dist/typescript/models/index.d.ts +11 -0
  138. package/dist/typescript/models/index.d.ts.map +1 -0
  139. package/dist/typescript/ui/components/Button/Button.d.ts +14 -0
  140. package/dist/typescript/ui/components/Button/Button.d.ts.map +1 -0
  141. package/dist/typescript/ui/components/Button/Button.spec.d.ts +2 -0
  142. package/dist/typescript/ui/components/Button/Button.spec.d.ts.map +1 -0
  143. package/dist/typescript/ui/components/ContentCardView/ContentCardView.d.ts +39 -0
  144. package/dist/typescript/ui/components/ContentCardView/ContentCardView.d.ts.map +1 -0
  145. package/dist/typescript/ui/components/ContentCardView/ContentCardView.spec.d.ts +2 -0
  146. package/dist/typescript/ui/components/ContentCardView/ContentCardView.spec.d.ts.map +1 -0
  147. package/dist/typescript/ui/components/DismissButton/DismissButton.d.ts +13 -0
  148. package/dist/typescript/ui/components/DismissButton/DismissButton.d.ts.map +1 -0
  149. package/dist/typescript/ui/components/DismissButton/DismissButton.spec.d.ts +2 -0
  150. package/dist/typescript/ui/components/DismissButton/DismissButton.spec.d.ts.map +1 -0
  151. package/dist/typescript/ui/components/FullScreenCenterView/FullScreenCenterView.d.ts +5 -0
  152. package/dist/typescript/ui/components/FullScreenCenterView/FullScreenCenterView.d.ts.map +1 -0
  153. package/dist/typescript/ui/components/Inbox/EmptyState.d.ts +19 -0
  154. package/dist/typescript/ui/components/Inbox/EmptyState.d.ts.map +1 -0
  155. package/dist/typescript/ui/components/Inbox/Inbox.d.ts +21 -0
  156. package/dist/typescript/ui/components/Inbox/Inbox.d.ts.map +1 -0
  157. package/dist/typescript/ui/components/Inbox/Inbox.spec.d.ts +2 -0
  158. package/dist/typescript/ui/components/Inbox/Inbox.spec.d.ts.map +1 -0
  159. package/dist/typescript/ui/components/Pagination/Pagination.d.ts +14 -0
  160. package/dist/typescript/ui/components/Pagination/Pagination.d.ts.map +1 -0
  161. package/dist/typescript/ui/components/Pagination/Pagination.spec.d.ts +2 -0
  162. package/dist/typescript/ui/components/Pagination/Pagination.spec.d.ts.map +1 -0
  163. package/dist/typescript/ui/components/UnreadIcon/UnreadIcon.d.ts +14 -0
  164. package/dist/typescript/ui/components/UnreadIcon/UnreadIcon.d.ts.map +1 -0
  165. package/dist/typescript/ui/components/UnreadIcon/UnreadIcon.spec.d.ts +2 -0
  166. package/dist/typescript/ui/components/UnreadIcon/UnreadIcon.spec.d.ts.map +1 -0
  167. package/dist/typescript/ui/components/index.d.ts +10 -0
  168. package/dist/typescript/ui/components/index.d.ts.map +1 -0
  169. package/dist/typescript/ui/hooks/index.d.ts +4 -0
  170. package/dist/typescript/ui/hooks/index.d.ts.map +1 -0
  171. package/dist/typescript/ui/hooks/useAspectRatio.d.ts +3 -0
  172. package/dist/typescript/ui/hooks/useAspectRatio.d.ts.map +1 -0
  173. package/dist/typescript/ui/hooks/useAspectRatio.spec.d.ts +2 -0
  174. package/dist/typescript/ui/hooks/useAspectRatio.spec.d.ts.map +1 -0
  175. package/dist/typescript/ui/hooks/useContentCardUI.d.ts +14 -0
  176. package/dist/typescript/ui/hooks/useContentCardUI.d.ts.map +1 -0
  177. package/dist/typescript/ui/hooks/useContentCardUI.spec.d.ts +2 -0
  178. package/dist/typescript/ui/hooks/useContentCardUI.spec.d.ts.map +1 -0
  179. package/dist/typescript/ui/hooks/useInbox.d.ts +12 -0
  180. package/dist/typescript/ui/hooks/useInbox.d.ts.map +1 -0
  181. package/dist/typescript/ui/hooks/useInbox.spec.d.ts +2 -0
  182. package/dist/typescript/ui/hooks/useInbox.spec.d.ts.map +1 -0
  183. package/dist/typescript/ui/hooks/useInboxSettings.d.ts +7 -0
  184. package/dist/typescript/ui/hooks/useInboxSettings.d.ts.map +1 -0
  185. package/dist/typescript/ui/hooks/useInboxSettings.spec.d.ts +2 -0
  186. package/dist/typescript/ui/hooks/useInboxSettings.spec.d.ts.map +1 -0
  187. package/dist/typescript/ui/index.d.ts +8 -0
  188. package/dist/typescript/ui/index.d.ts.map +1 -0
  189. package/dist/typescript/ui/providers/InboxProvider.d.ts +56 -0
  190. package/dist/typescript/ui/providers/InboxProvider.d.ts.map +1 -0
  191. package/dist/typescript/ui/theme/Theme.d.ts +44 -0
  192. package/dist/typescript/ui/theme/Theme.d.ts.map +1 -0
  193. package/dist/typescript/ui/theme/ThemeProvider.d.ts +21 -0
  194. package/dist/typescript/ui/theme/ThemeProvider.d.ts.map +1 -0
  195. package/dist/typescript/ui/theme/index.d.ts +3 -0
  196. package/dist/typescript/ui/theme/index.d.ts.map +1 -0
  197. package/dist/typescript/ui/types/ContentViewEvent.d.ts +9 -0
  198. package/dist/typescript/ui/types/ContentViewEvent.d.ts.map +1 -0
  199. package/dist/typescript/ui/types/Templates.d.ts +43 -0
  200. package/dist/typescript/ui/types/Templates.d.ts.map +1 -0
  201. package/dist/typescript/ui/types/index.d.ts +3 -0
  202. package/dist/typescript/ui/types/index.d.ts.map +1 -0
  203. package/dist/typescript/ui/utils/generateCardHash.d.ts +21 -0
  204. package/dist/typescript/ui/utils/generateCardHash.d.ts.map +1 -0
  205. package/dist/typescript/ui/utils/generateCardHash.spec.d.ts +2 -0
  206. package/dist/typescript/ui/utils/generateCardHash.spec.d.ts.map +1 -0
  207. package/dist/typescript/ui/utils/inboxStorage.d.ts +20 -0
  208. package/dist/typescript/ui/utils/inboxStorage.d.ts.map +1 -0
  209. package/dist/typescript/ui/utils/inboxStorage.spec.d.ts +2 -0
  210. package/dist/typescript/ui/utils/inboxStorage.spec.d.ts.map +1 -0
  211. package/dist/typescript/ui/utils/index.d.ts +3 -0
  212. package/dist/typescript/ui/utils/index.d.ts.map +1 -0
  213. package/ios/src/RCTAEPMessaging.mm +11 -0
  214. package/ios/src/RCTAEPMessaging.swift +30 -3
  215. package/jest.config.js +15 -0
  216. package/package.json +33 -5
  217. package/src/Messaging.ts +287 -32
  218. package/src/index.ts +3 -3
  219. package/src/models/ContentCard.ts +52 -27
  220. package/src/models/HTMLProposition.ts +1 -1
  221. package/src/models/JSONProposition.ts +1 -1
  222. package/src/models/PersonalizationSchema.ts +1 -0
  223. package/src/models/index.ts +22 -0
  224. package/src/ui/components/Button/Button.spec.tsx +496 -0
  225. package/src/ui/components/Button/Button.tsx +76 -0
  226. package/src/ui/components/ContentCardView/ContentCardView.spec.tsx +278 -0
  227. package/src/ui/components/ContentCardView/ContentCardView.tsx +400 -0
  228. package/src/ui/components/DismissButton/DismissButton.spec.tsx +314 -0
  229. package/src/ui/components/DismissButton/DismissButton.tsx +100 -0
  230. package/src/ui/components/FullScreenCenterView/FullScreenCenterView.tsx +32 -0
  231. package/src/ui/components/Inbox/EmptyState.tsx +89 -0
  232. package/src/ui/components/Inbox/Inbox.spec.tsx +478 -0
  233. package/src/ui/components/Inbox/Inbox.tsx +275 -0
  234. package/src/ui/components/Pagination/Pagination.spec.tsx +159 -0
  235. package/src/ui/components/Pagination/Pagination.tsx +222 -0
  236. package/src/ui/components/UnreadIcon/UnreadIcon.spec.tsx +878 -0
  237. package/src/ui/components/UnreadIcon/UnreadIcon.tsx +234 -0
  238. package/src/ui/components/index.ts +22 -0
  239. package/{dist/models/MessagingPropositionItem.js → src/ui/hooks/index.ts} +5 -4
  240. package/src/ui/hooks/useAspectRatio.spec.tsx +66 -0
  241. package/src/ui/hooks/useAspectRatio.tsx +39 -0
  242. package/src/ui/hooks/useContentCardUI.spec.tsx +82 -0
  243. package/src/ui/hooks/useContentCardUI.ts +48 -0
  244. package/src/ui/hooks/useInbox.spec.tsx +87 -0
  245. package/src/ui/hooks/useInbox.ts +46 -0
  246. package/src/ui/hooks/useInboxSettings.spec.tsx +41 -0
  247. package/src/ui/hooks/useInboxSettings.ts +24 -0
  248. package/src/ui/index.ts +7 -0
  249. package/src/ui/providers/InboxProvider.tsx +79 -0
  250. package/src/ui/theme/Theme.ts +57 -0
  251. package/src/ui/theme/ThemeProvider.tsx +120 -0
  252. package/src/ui/theme/index.ts +14 -0
  253. package/src/ui/types/ContentViewEvent.ts +20 -0
  254. package/src/ui/types/Templates.ts +77 -0
  255. package/src/ui/types/index.ts +14 -0
  256. package/src/ui/utils/generateCardHash.spec.tsx +86 -0
  257. package/src/ui/utils/generateCardHash.ts +59 -0
  258. package/src/ui/utils/inboxStorage.spec.tsx +136 -0
  259. package/src/ui/utils/inboxStorage.ts +64 -0
  260. package/src/ui/utils/index.ts +3 -0
  261. package/tutorials/ContentCardCustomizationGuide.md +661 -0
  262. package/tutorials/ContentCards.md +419 -0
  263. package/tutorials/Inbox.md +515 -0
  264. package/tutorials/resources/image-only-template.png +0 -0
  265. package/tutorials/resources/large-image-template.png +0 -0
  266. package/tutorials/resources/small-image-template.png +0 -0
  267. package/dist/Messaging.js +0 -152
  268. package/dist/Messaging.js.map +0 -1
  269. package/dist/index.js +0 -34
  270. package/dist/index.js.map +0 -1
  271. package/dist/models/ContentCard.d.ts +0 -51
  272. package/dist/models/ContentCard.js.map +0 -1
  273. package/dist/models/HTMLProposition.js.map +0 -1
  274. package/dist/models/InAppMessage.js.map +0 -1
  275. package/dist/models/JSONProposition.js.map +0 -1
  276. package/dist/models/Message.js +0 -156
  277. package/dist/models/Message.js.map +0 -1
  278. package/dist/models/MessagingDelegate.js +0 -14
  279. package/dist/models/MessagingDelegate.js.map +0 -1
  280. package/dist/models/MessagingEdgeEventType.js +0 -24
  281. package/dist/models/MessagingEdgeEventType.js.map +0 -1
  282. package/dist/models/MessagingProposition.js +0 -59
  283. package/dist/models/MessagingProposition.js.map +0 -1
  284. package/dist/models/MessagingPropositionItem.js.map +0 -1
  285. package/dist/models/PersonalizationSchema.js +0 -25
  286. package/dist/models/PersonalizationSchema.js.map +0 -1
  287. package/dist/models/PropositionItem.js +0 -78
  288. package/dist/models/PropositionItem.js.map +0 -1
  289. package/dist/models/ScopeDetails.js.map +0 -1
@@ -0,0 +1,419 @@
1
+ # Content Cards Tutorial
2
+
3
+ ## Overview
4
+
5
+ Content Cards are a powerful feature of Adobe Journey Optimizer that allows you to deliver personalized, contextual content directly within your mobile application. Unlike push notifications or in-app messages, content cards provide a persistent, non-intrusive way to present relevant information to users when they're actively engaged with your app. Content cards are ideal for showcasing promotions, product recommendations, onboarding tips, or any contextual information that enhances the user experience without interrupting their workflow.
6
+
7
+ ## Prerequisites
8
+
9
+ Before implementing content cards, ensure you have:
10
+
11
+ 1. **Planned and defined surface identifiers** for locations where content cards should appear in your app (see [Defining Surface Identifiers](#defining-surface-identifiers) section below)
12
+
13
+ 2. **Configured content card campaigns in Adobe Journey Optimizer** using your defined surface identifiers:
14
+
15
+ a. Create a [channel](https://experienceleague.adobe.com/en/docs/journey-optimizer/using/channels/content-card/configure/content-card-configuration). (Define appid and surface)
16
+
17
+ b. Create [content cards](https://experienceleague.adobe.com/en/docs/journey-optimizer/using/channels/content-card/create-content-card) - Follow "Add Content cards to a campaign".
18
+
19
+ c. Design content cards with [templates](https://experienceleague.adobe.com/en/docs/journey-optimizer/using/channels/content-card/design-content-card)
20
+
21
+ 3. **Integrated and registered the AEPMessaging extension** in your app (see [SDK Integration](#sdk-integration) section below)
22
+
23
+ ### Defining Surface Identifiers
24
+
25
+ Surface identifiers are string values that represent specific locations in your app where content cards will be displayed. These identifiers must match between your Adobe Journey Optimizer campaigns and your app code.
26
+
27
+ #### Surface Naming Conventions
28
+
29
+ Use descriptive, hierarchical naming patterns:
30
+
31
+ **Feature-based surfaces** <br>
32
+ const surfaces = [
33
+ 'homepage',
34
+ 'product-detail',
35
+ 'checkout',
36
+ 'profile',
37
+ 'search-results'
38
+ ];
39
+
40
+ **Context-specific surfaces** <br>
41
+ const surfaces = [ <br>
42
+ 'rn/cards', // For remote image content cards <br>
43
+ 'rn/android/local_promo', // For local promotional cards <br>
44
+ 'app/onboarding/step1' // For onboarding flow <br>
45
+ ];
46
+
47
+ #### Where to Configure Surface Identifiers
48
+
49
+ Surface identifiers must be coordinated between two locations:
50
+
51
+ 1. **Adobe Journey Optimizer**: When creating content card campaigns, specify the surface identifier in your campaign targeting configuration
52
+ 2. **Your Mobile App**: Use the same surface identifiers when calling the Messaging APIs to fetch and display content cards
53
+
54
+ **Important**: The surface identifiers in your Adobe Journey Optimizer campaigns must exactly match the surface identifiers used in your app code. Mismatched identifiers will result in no content cards being returned.
55
+
56
+ ## Template Types Overview
57
+
58
+ Content cards support three template types: SmallImage, LargeImage, and ImageOnly.
59
+
60
+ ### Template Layouts
61
+
62
+ #### SmallImage Template
63
+ - **Layout:** Horizontal layout (flexDirection: 'row') with image on the left and content on the right
64
+ - **Components:** Image, title text, body text, action buttons, dismiss button (all optional)
65
+ - **Container Height:** 120px minimum height
66
+
67
+ ![SmallImage Template Layout](./resources/small-image-template.png)
68
+
69
+ #### LargeImage Template
70
+ - **Layout:** Vertical layout with image at top and content below
71
+ - **Components:** Image, title text, body text, action buttons, dismiss button (all optional)
72
+ - **Image Width:** 100% of card width, maintains aspect ratio
73
+
74
+ ![LargeImage Template Layout](./resources/large-image-template.png)
75
+
76
+ #### ImageOnly Template
77
+ - **Layout:** Single image container
78
+ - **Components:** Image, optional dismiss button overlaid on the image
79
+ - **Image Size:** Full card size, maintains aspect ratio
80
+
81
+ ![ImageOnly Template Layout](./resources/image-only-template.png)
82
+
83
+ For detailed customization options, see the [Content Card Customization Guide](./ContentCardCustomizationGuide.md).
84
+
85
+ ## SDK Integration
86
+
87
+ Before you can fetch and display content cards, you need to install and configure the AEP React Native SDK. For detailed setup instructions, see the main [SDK Installation and Configuration Guide](https://github.com/adobe/aepsdk-react-native#requirements).
88
+
89
+ **Required packages:**
90
+ - [`@adobe/react-native-aepcore`](https://github.com/adobe/aepsdk-react-native/tree/main/packages/core)
91
+ - [`@adobe/react-native-aepedge`](https://github.com/adobe/aepsdk-react-native/tree/main/packages/edge)
92
+ - [`@adobe/react-native-aepedgeidentity`](https://github.com/adobe/aepsdk-react-native/tree/main/packages/edgeidentity)
93
+ - [`@adobe/react-native-aepmessaging`](https://github.com/adobe/aepsdk-react-native/tree/content-card-ui/packages/messaging)
94
+
95
+ ```shell
96
+ //Important: Use the development branch for Messaging content card testing
97
+
98
+ npm install "https://gitpkg.now.sh/adobe/aepsdk-react-native/packages/messaging?content-card-ui"
99
+ ```
100
+
101
+ **Optional packages:**
102
+ - [`@adobe/react-native-aepedgeconsent`](https://github.com/adobe/aepsdk-react-native/tree/main/packages/edgeconsent)
103
+
104
+ **Imports for content cards:**
105
+ ```typescript
106
+ import {
107
+ Messaging, // For manual API calls (advanced usage)
108
+ ContentTemplate, // Type definitions
109
+ ContentCardView, // Pre-built UI component
110
+ useContentCardUI // hook based approach for simplified state management
111
+ } from '@adobe/react-native-aepmessaging';
112
+ ```
113
+
114
+ ## Fetching Content Cards
115
+
116
+ For data fetching, you can use either the hook-based approach (recommended) or the manual implementation approach.
117
+
118
+ ### Hook based Approach: Using the useContentCardUI Hook (Recommended)
119
+
120
+ The `useContentCardUI` hook provides a simplified, modern way to fetch and manage content cards with built-in state management, loading states, and error handling.
121
+
122
+ ```typescript
123
+ import React from 'react';
124
+ import { View, FlatList, Text } from 'react-native';
125
+ import { useContentCardUI, ContentCardView } from '@adobe/react-native-aepmessaging';
126
+
127
+ const ContentCardsScreen = () => {
128
+ const { content, isLoading, error } = useContentCardUI('homepage');
129
+
130
+ if (isLoading) return <Text>Loading...</Text>;
131
+ if (error) return <Text>Error loading content cards</Text>;
132
+
133
+ return (
134
+ <View style={{ flex: 1 }}>
135
+ <FlatList
136
+ data={content}
137
+ keyExtractor={(item) => item.id}
138
+ renderItem={({ item: card }) => (
139
+ <ContentCardView
140
+ template={card}
141
+ />
142
+ )}
143
+ ListEmptyComponent={<Text>No content cards available</Text>}
144
+ />
145
+ </View>
146
+ );
147
+ };
148
+ ```
149
+
150
+ #### Benefits of the useContentCardUI Hook
151
+
152
+ - **Simplified Implementation**: No need to manually manage state, loading, or error handling
153
+ - **Automatic Lifecycle Management**: Automatically fetches content when surface changes
154
+ - **Built-in Performance**: Optimized with proper dependency management and memoization
155
+ - **Error Handling**: Includes built-in error states and retry functionality
156
+ - **Easy Refresh**: Simple `refetch()` function for manual content updates
157
+ - **Loading States**: Built-in loading indicators for better UX
158
+
159
+ #### useContentCardUI Hook API Reference
160
+
161
+ ```typescript
162
+ const { content, isLoading, error, refetch } = useContentCardUI(surface);
163
+ ```
164
+
165
+ | Property | Type | Description |
166
+ |----------|------|-------------|
167
+ | `content` | `ContentTemplate[]` | Array of content card templates ready for rendering |
168
+ | `isLoading` | `boolean` | Loading state indicator (optional) |
169
+ | `error` | `any \| null` | Error object if fetching fails (optional) |
170
+ | `refetch` | `() => Promise<void>` | Function to manually refresh content cards (optional) |
171
+
172
+ **Note**: While the basic example only uses `content`, the hook also provides `isLoading`, `error`, and `refetch` for enhanced functionality when needed.
173
+
174
+ ### Alternative Approach: Manual Implementation
175
+
176
+ For alternative use cases where you need more control over the fetching process, you can use the manual approach:
177
+
178
+ #### Step 1: Update Propositions for Surfaces
179
+
180
+ To fetch content cards for specific surfaces configured in Adobe Journey Optimizer campaigns, call the `updatePropositionsForSurfaces` API. This method retrieves the latest content cards from the server and caches them in-memory for the application's lifecycle.
181
+
182
+ **Best Practice**: Batch requests for multiple surfaces in a single API call when possible to optimize performance.
183
+
184
+ ```typescript
185
+ import { Messaging } from '@adobe/react-native-aepmessaging';
186
+
187
+ // Single surface example
188
+ const surface = 'homepage';
189
+
190
+ //Example 1 - Fetch content cards for a single surface
191
+ const updateContentCardsForSurface = async (): Promise<void> => {
192
+ try {
193
+ await Messaging.updatePropositionsForSurfaces([surface]);
194
+ console.log('Content cards updated successfully for surface:', surface);
195
+ } catch (error) {
196
+ console.error('Failed to update content cards:', error);
197
+ }
198
+ };
199
+
200
+ //Example 2 - Multiple surfaces example (for batching requests)
201
+ const surfaces: string[] = ['homepage', 'product-detail', 'checkout'];
202
+
203
+ const updateContentCardsForMultipleSurfaces = async (): Promise<void> => {
204
+ try {
205
+ await Messaging.updatePropositionsForSurfaces(surfaces);
206
+ console.log('Content cards updated successfully for all surfaces');
207
+ } catch (error) {
208
+ console.error('Failed to update content cards:', error);
209
+ }
210
+ };
211
+ ```
212
+
213
+ #### Step 2: Retrieve and Render Content Cards
214
+
215
+ After updating propositions, retrieve the content cards for a specific surface using the `getContentCardUI` API. This convenience method handles proposition filtering and returns ready-to-use content card templates.
216
+
217
+ **Important**: Only content cards for which the user has qualified are returned. User qualification is determined by the delivery rules configured in Adobe Journey Optimizer.
218
+
219
+ ```typescript
220
+ import { Messaging, ContentTemplate } from '@adobe/react-native-aepmessaging';
221
+
222
+ //Example 1 - Simple approach: Get content card UI templates for a single surface
223
+ const getContentCards = async (surface: string): Promise<ContentTemplate[]> => {
224
+ try {
225
+ const contentCards = await Messaging.getContentCardUI(surface);
226
+ console.log(`Found ${contentCards.length} content cards for surface: ${surface}`);
227
+ return contentCards;
228
+ } catch (error) {
229
+ console.error('Error retrieving content cards:', error);
230
+ return [];
231
+ }
232
+ };
233
+
234
+ //Example 2 - For multiple surfaces, call getContentCardUI for each surface
235
+ const getContentCardsForMultipleSurfaces = async (surfaces: string[]): Promise<ContentTemplate[]> => {
236
+ try {
237
+ const allContentCards: ContentTemplate[] = [];
238
+
239
+ for (const surface of surfaces) {
240
+ const contentCards = await Messaging.getContentCardUI(surface);
241
+ allContentCards.push(...contentCards);
242
+ }
243
+
244
+ console.log(`Found ${allContentCards.length} content cards across all surfaces`);
245
+ return allContentCards;
246
+ } catch (error) {
247
+ console.error('Error retrieving content cards:', error);
248
+ return [];
249
+ }
250
+ };
251
+ ```
252
+ f
253
+ ## Rendering Content Cards
254
+
255
+ Content cards can be rendered using the pre-built `ContentCardView` component provided by the SDK.
256
+
257
+ ### React Native Implementation
258
+
259
+ ```typescript
260
+ import React from 'react';
261
+ import { View, FlatList, Text } from 'react-native';
262
+ import { useContentCardUI, ContentCardView } from '@adobe/react-native-aepmessaging';
263
+
264
+ const ContentCardsScreen = () => {
265
+ const { content, isLoading, error } = useContentCardUI('homepage');
266
+
267
+ if (isLoading) return <Text>Loading...</Text>;
268
+ if (error) return <Text>Error loading content cards</Text>;
269
+
270
+ return (
271
+ <View style={{ flex: 1 }}>
272
+ <FlatList
273
+ data={content}
274
+ keyExtractor={(item) => item.id}
275
+ renderItem={({ item: card }) => (
276
+ <ContentCardView
277
+ template={card}
278
+ />
279
+ )}
280
+ ListEmptyComponent={<Text>No content cards available</Text>}
281
+ />
282
+ </View>
283
+ );
284
+ };
285
+ ```
286
+
287
+ ### Choosing the Right Approach
288
+
289
+ | Approach | Best For | Advantages | When to Use |
290
+ |----------|----------|------------|-------------|
291
+ | **useContentCardUI Hook** | Most applications | • Minimal boilerplate<br>• Built-in state management<br>• Automatic error handling<br>• Easy to implement | • Standard content card implementation<br>• Getting started quickly<br>• Most common use cases |
292
+ | **Manual Implementation** | Advanced use cases | • Full control over fetching<br>• Custom state management<br>• Complex business logic<br>• Multiple surface coordination | • Complex content card workflows<br>• Custom caching strategies<br>• Integration with existing state management |
293
+
294
+ ### Benefits of Using ContentCardView
295
+
296
+ The pre-built `ContentCardView` component provides several advantages regardless of which fetching approach you choose:
297
+
298
+ - **Automatic Layout**: Handles different card types (SmallImage, LargeImage, ImageOnly) automatically
299
+ - **Built-in Event Tracking**: Automatically tracks display and interaction events
300
+ - **Theme Support**: Works with `ThemeProvider` for consistent styling
301
+ - **Accessibility**: Includes proper accessibility features
302
+ - **Less Code**: No need to build custom UI components
303
+
304
+ ### Customizing ContentCardView
305
+
306
+ You can customize the appearance of content cards using the `styleOverrides` prop:
307
+
308
+ ```typescript
309
+ <ContentCardView
310
+ key={card.id}
311
+ template={card}
312
+ listener={handleContentCardEvent}
313
+ styleOverrides={{
314
+ smallImageStyle: {
315
+ title: {
316
+ fontSize: 18,
317
+ fontWeight: 'bold',
318
+ color: '#333',
319
+ numberOfLines: 2,
320
+ },
321
+ body: {
322
+ fontSize: 14,
323
+ color: '#666',
324
+ numberOfLines: 3,
325
+ },
326
+ image: {
327
+ borderRadius: 8,
328
+ },
329
+ button: {
330
+ backgroundColor: '#007AFF',
331
+ borderRadius: 6,
332
+ }
333
+ },
334
+ largeImageStyle: {
335
+ title: {
336
+ fontSize: 20,
337
+ fontWeight: '600',
338
+ numberOfLines: 1,
339
+ },
340
+ body: {
341
+ numberOfLines: 2,
342
+ }
343
+ },
344
+ imageOnlyStyle: {
345
+ image: {
346
+ aspectRatio: 1,
347
+ borderRadius: 12,
348
+ }
349
+ }
350
+ }}
351
+ />
352
+ ```
353
+
354
+ **Note**: Different card types support different style properties. Refer to the [Content Card Customization Guide](./ContentCardCustomizationGuide.md) for comprehensive styling options.
355
+
356
+
357
+ ## Automatic Event Tracking
358
+
359
+ When using `ContentCardView`, event tracking is handled automatically regardless of whether you use the `useContentCardUI` hook or manual implementation. The component tracks user interactions and sends events to Adobe Journey Optimizer for campaign measurement and optimization.
360
+
361
+ ### Events Automatically Tracked
362
+
363
+ The `ContentCardView` component automatically tracks and sends the following events to Adobe Journey Optimizer:
364
+
365
+ #### Display Events
366
+ - **Triggered when**: A content card becomes visible on screen
367
+ - **Event data sent**:
368
+ - Proposition ID
369
+ - Content card details
370
+ - Surface information
371
+ - Timestamp
372
+
373
+ #### Interaction Events
374
+ - **Triggered when**: User taps on the content card or its action buttons
375
+ - **Event data sent**:
376
+ - Proposition ID
377
+ - Content card details
378
+ - Interaction type (tap, button click)
379
+ - Action URL (if applicable)
380
+ - Timestamp
381
+
382
+ #### Dismiss Events
383
+ - **Triggered when**: User dismisses a content card (if dismiss button is shown)
384
+ - **Event data sent**:
385
+ - Proposition ID
386
+ - Content card details
387
+ - Dismiss action
388
+ - Timestamp
389
+
390
+ ### Event Listener (Optional)
391
+
392
+ While tracking is automatic, you can still listen to events using the `listener` prop if you need to perform additional actions:
393
+
394
+ ```typescript
395
+ const handleContentCardEvent = (event: string, card: ContentTemplate): void => {
396
+ console.log('Content card event:', event, card);
397
+
398
+ switch (event) {
399
+ case 'display':
400
+ console.log('Card displayed:', card.id);
401
+ // Optional: Add custom analytics or logging
402
+ break;
403
+ case 'interact':
404
+ console.log('Card interacted:', card.id);
405
+ // Optional: Handle custom navigation or actions
406
+ break;
407
+ case 'dismiss':
408
+ console.log('Card dismissed:', card.id);
409
+ // Optional: Update local state or preferences
410
+ break;
411
+ }
412
+ };
413
+
414
+ // Use the listener in your ContentCardView
415
+ <ContentCardView
416
+ template={card}
417
+ listener={handleContentCardEvent}
418
+ />
419
+ ```