@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,661 @@
1
+ # Content Card Customization Guide
2
+
3
+ ## Overview
4
+
5
+ The Adobe Experience Platform (AEP) React Native Messaging SDK provides a comprehensive and flexible content card system with multiple levels of customization. This guide explains how to customize content cards using the three-tier hierarchy: **Theme → Style Overrides → Props**.
6
+
7
+ ## Table of Contents
8
+
9
+ 1. [Customization Hierarchy](#customization-hierarchy)
10
+ 2. [Theme System](#theme-system)
11
+ 3. [Style Overrides](#style-overrides)
12
+ 4. [Component Props](#component-props)
13
+ 5. [Practical Example](#practical-example)
14
+ 6. [Best Practices](#best-practices)
15
+ 7. [Troubleshooting](#troubleshooting)
16
+
17
+ ## Customization Hierarchy
18
+
19
+ The content card customization follows a clear hierarchy where each level can override the previous one:
20
+
21
+ ```
22
+ Theme (Global) → Style Overrides (Component-specific) → Props (Element-specific)
23
+ ```
24
+
25
+ ### Priority Order (Highest to Lowest)
26
+ 1. **Props** - Most specific, overrides everything
27
+ 2. **Style Overrides** - Component-level customization
28
+ 3. **Theme** - Global application-wide styling
29
+ 4. **Default Styles** - Built-in component styles
30
+
31
+ ### How the Hierarchy Works
32
+
33
+ Each level in the hierarchy can override properties from levels below it:
34
+
35
+ ```typescript
36
+ // Example: Text color resolution
37
+ const finalTextColor =
38
+ titleProps?.style?.color || // 1. Props (highest priority)
39
+ styleOverrides?.title?.color || // 2. Style Overrides
40
+ theme.colors.textPrimary || // 3. Theme
41
+ defaultStyles.title.color; // 4. Default (lowest priority)
42
+ ```
43
+
44
+ This means you can set a global brand color in your theme, override it for specific components with style overrides, and further customize individual elements with props when needed.
45
+
46
+ ## Theme System
47
+
48
+ ### Basic Theme Setup
49
+
50
+ The theme system provides global styling for all content cards with automatic light/dark mode support.
51
+
52
+ ```typescript
53
+ import { ThemeProvider, Themes } from '@adobe/react-native-aepmessaging';
54
+
55
+ const customThemes: Themes = {
56
+ light: {
57
+ colors: {
58
+ primary: '#007AFF', // Brand primary color
59
+ secondary: '#5856D6', // Secondary accent color
60
+ background: '#FFFFFF', // Card background
61
+ textPrimary: '#000000', // Main text color
62
+ textSecondary: '#8E8E93', // Secondary text color
63
+ imagePlaceholder: '#C7C7CC', // Image loading placeholder
64
+ buttonTextColor: 'dodgerblue' // Button text color
65
+ }
66
+ },
67
+ dark: {
68
+ colors: {
69
+ primary: '#0A84FF',
70
+ secondary: '#5E5CE6',
71
+ background: '#262626',
72
+ textPrimary: '#FFFFFF',
73
+ textSecondary: '#8E8E93',
74
+ imagePlaceholder: '#48484A',
75
+ buttonTextColor: 'dodgerblue'
76
+ }
77
+ }
78
+ };
79
+
80
+ function App() {
81
+ return (
82
+ <ThemeProvider customThemes={customThemes}>
83
+ {/* Your app content */}
84
+ </ThemeProvider>
85
+ );
86
+ }
87
+ ```
88
+
89
+ ### Available Theme Colors
90
+
91
+ The following colors can be customized in your theme:
92
+
93
+ | Color Property | Description | Usage |
94
+ |----------------|-------------|--------|
95
+ | `background` | Card background color | All card templates |
96
+ | `textPrimary` | Main text content | Title and body text |
97
+ | `imagePlaceholder` | Image loading state | Placeholder while images load |
98
+ | `buttonTextColor` | Button text color | Action button text |
99
+
100
+ **Example:**
101
+ ```typescript
102
+ const myBrandTheme = {
103
+ light: {
104
+ colors: {
105
+ background: '#FFFFFF',
106
+ textPrimary: '#1A1A1A',
107
+ imagePlaceholder: '#E5E5E5',
108
+ buttonTextColor: '#007AFF'
109
+ }
110
+ }
111
+ };
112
+ ```
113
+
114
+ ## Style Overrides
115
+
116
+ Style overrides provide component-level customization for each template type. They follow React Native's `StyleSheet` patterns.
117
+
118
+ ### SmallImageCard Style Overrides
119
+
120
+ ```typescript
121
+ import { SmallImageContentStyle } from '@adobe/react-native-aepmessaging';
122
+
123
+ const smallImageStyleOverrides: SmallImageContentStyle = {
124
+ // Root card container
125
+ card: {
126
+ borderRadius: 16,
127
+ margin: 20,
128
+ backgroundColor: '#f8f9fa',
129
+ shadowColor: '#000',
130
+ shadowOffset: { width: 0, height: 2 },
131
+ shadowOpacity: 0.1,
132
+ shadowRadius: 4,
133
+ elevation: 3
134
+ },
135
+
136
+ // Inner container
137
+ container: {
138
+ padding: 16,
139
+ flexDirection: 'row'
140
+ },
141
+
142
+ // Image container
143
+ imageContainer: {
144
+ borderRadius: 12,
145
+ overflow: 'hidden',
146
+ marginRight: 12
147
+ },
148
+
149
+ // Image styling
150
+ image: {
151
+ width: 80,
152
+ height: 80
153
+ },
154
+
155
+ // Content area
156
+ contentContainer: {
157
+ flex: 1,
158
+ justifyContent: 'space-between'
159
+ },
160
+
161
+ // Text styling (applies to both title and body)
162
+ text: {
163
+ fontFamily: 'YourCustomFont-Regular'
164
+ },
165
+
166
+ // Title-specific styling
167
+ title: {
168
+ fontSize: 18,
169
+ fontWeight: '700',
170
+ color: '#1a1a1a',
171
+ marginBottom: 4
172
+ },
173
+
174
+ // Body text styling
175
+ body: {
176
+ fontSize: 14,
177
+ lineHeight: 20,
178
+ color: '#666666'
179
+ },
180
+
181
+ // Button container
182
+ buttonContainer: {
183
+ flexDirection: 'row',
184
+ marginTop: 12,
185
+ gap: 8
186
+ },
187
+
188
+ // Individual button styling
189
+ button: {
190
+ backgroundColor: '#007AFF',
191
+ paddingHorizontal: 16,
192
+ paddingVertical: 8,
193
+ borderRadius: 8
194
+ },
195
+
196
+ // Button text styling
197
+ buttonText: {
198
+ color: '#FFFFFF',
199
+ fontWeight: '600'
200
+ },
201
+
202
+ // Dismiss button styling
203
+ dismissButton: {
204
+ backgroundColor: 'rgba(0,0,0,0.1)',
205
+ width: 24,
206
+ height: 24,
207
+ borderRadius: 12
208
+ }
209
+ };
210
+ ```
211
+
212
+ ### LargeImageCard Style Overrides
213
+
214
+ ```typescript
215
+ import { LargeImageContentStyle } from '@adobe/react-native-aepmessaging';
216
+
217
+ const largeImageStyleOverrides: LargeImageContentStyle = {
218
+ // Root card container
219
+ card: {
220
+ borderRadius: 20,
221
+ margin: 16,
222
+ backgroundColor: '#ffffff',
223
+ overflow: 'hidden'
224
+ },
225
+
226
+ // Main container
227
+ container: {
228
+ flexDirection: 'column'
229
+ },
230
+
231
+ // Image container (top section)
232
+ imageContainer: {
233
+ height: 200,
234
+ position: 'relative'
235
+ },
236
+
237
+ // Image styling
238
+ image: {
239
+ width: '100%',
240
+ height: '100%',
241
+ resizeMode: 'cover'
242
+ },
243
+
244
+ // Content area (below image)
245
+ contentContainer: {
246
+ padding: 20
247
+ },
248
+
249
+ // Text content wrapper
250
+ textContent: {
251
+ marginBottom: 16
252
+ },
253
+
254
+ // Title styling
255
+ title: {
256
+ fontSize: 24,
257
+ fontWeight: '800',
258
+ color: '#1a1a1a',
259
+ marginBottom: 8
260
+ },
261
+
262
+ // Body text styling
263
+ body: {
264
+ fontSize: 16,
265
+ lineHeight: 24,
266
+ color: '#4a4a4a'
267
+ },
268
+
269
+ // Button container
270
+ buttonContainer: {
271
+ flexDirection: 'row',
272
+ justifyContent: 'space-between'
273
+ },
274
+
275
+ // Button styling
276
+ button: {
277
+ flex: 1,
278
+ backgroundColor: '#007AFF',
279
+ paddingVertical: 12,
280
+ borderRadius: 12,
281
+ marginHorizontal: 4
282
+ },
283
+
284
+ // Button text
285
+ buttonText: {
286
+ color: '#FFFFFF',
287
+ fontSize: 16,
288
+ fontWeight: '600',
289
+ textAlign: 'center'
290
+ }
291
+ };
292
+ ```
293
+
294
+ ### ImageOnlyCard Style Overrides
295
+
296
+ ```typescript
297
+ import { ImageOnlyContentStyle } from '@adobe/react-native-aepmessaging';
298
+
299
+ const imageOnlyStyleOverrides: ImageOnlyContentStyle = {
300
+ // Root card container
301
+ card: {
302
+ borderRadius: 16,
303
+ margin: 12,
304
+ overflow: 'hidden'
305
+ },
306
+
307
+ // Image container
308
+ imageContainer: {
309
+ backgroundColor: '#f0f0f0',
310
+ position: 'relative'
311
+ },
312
+
313
+ // Image styling
314
+ image: {
315
+ width: '100%',
316
+ height: 300,
317
+ resizeMode: 'cover'
318
+ },
319
+
320
+ // Dismiss button (overlaid on image)
321
+ dismissButton: {
322
+ position: 'absolute',
323
+ top: 8,
324
+ right: 8,
325
+ backgroundColor: 'rgba(0,0,0,0.5)',
326
+ width: 28,
327
+ height: 28,
328
+ borderRadius: 14
329
+ }
330
+ };
331
+ ```
332
+
333
+ ## Component Props
334
+
335
+ For advanced customization, some components accept additional props that provide element-level control.
336
+
337
+ ### SmallImageCard Props
338
+
339
+ The `SmallImageCard` component extends React Native's `PressableProps` and supports the following specific props:
340
+
341
+ ```typescript
342
+ import { SmallImageCard } from '@adobe/react-native-aepmessaging';
343
+
344
+ <SmallImageCard
345
+ content={contentData}
346
+ imageUri={imageUrl}
347
+ height={120} // Optional: Custom height for the card
348
+ styleOverrides={smallImageStyleOverrides}
349
+ onPress={handlePress}
350
+ onDismiss={handleDismiss}
351
+
352
+ // Standard PressableProps are also supported
353
+ accessibilityLabel="Product promotion card"
354
+ accessibilityRole="button"
355
+ accessibilityHint="Double tap to view product details"
356
+ disabled={false}
357
+ hitSlop={{ top: 10, bottom: 10, left: 10, right: 10 }}
358
+
359
+ // Custom style function for press states
360
+ style={({ pressed }) => [
361
+ baseCardStyle,
362
+ pressed && { opacity: 0.8 }
363
+ ]}
364
+ />
365
+ ```
366
+
367
+ **Note**: `SmallImageCard` supports granular component props (like `ImageProps`, `TextProps`, `ButtonProps`) via the `ComponentOverrideProps` interface, similar to `LargeImageCard` and `ImageOnlyCard`. You can use both these props and `styleOverrides` for comprehensive customization.
368
+
369
+ #### SmallImageCard Advanced Props Example
370
+
371
+ ```typescript
372
+ import { SmallImageCard } from '@adobe/react-native-aepmessaging';
373
+
374
+ <SmallImageCard
375
+ content={contentData}
376
+ imageUri={imageUrl}
377
+ height={120}
378
+ styleOverrides={smallImageStyleOverrides}
379
+ onPress={handlePress}
380
+ onDismiss={handleDismiss}
381
+
382
+ // Advanced component props
383
+ ContainerProps={{
384
+ accessibilityLabel: 'Product promotion card'
385
+ }}
386
+
387
+ ImageContainerProps={{
388
+ accessibilityRole: 'image'
389
+ }}
390
+
391
+ ImageProps={{
392
+ accessibilityLabel: 'Product image',
393
+ resizeMode: 'cover'
394
+ }}
395
+
396
+ TextProps={{
397
+ accessibilityRole: 'text',
398
+ maxFontSizeMultiplier: 1.2
399
+ }}
400
+
401
+ TitleProps={{
402
+ numberOfLines: 1,
403
+ ellipsizeMode: 'tail'
404
+ }}
405
+
406
+ BodyProps={{
407
+ numberOfLines: 2,
408
+ ellipsizeMode: 'tail'
409
+ }}
410
+
411
+ ButtonContainerProps={{
412
+ accessibilityRole: 'button'
413
+ }}
414
+
415
+ ButtonProps={{
416
+ accessibilityHint: 'Double tap to learn more'
417
+ }}
418
+
419
+ DismissButtonProps={{
420
+ accessibilityLabel: 'Dismiss this card',
421
+ accessibilityHint: 'Double tap to close'
422
+ }}
423
+
424
+ // Standard PressableProps are also supported
425
+ accessibilityLabel="Product promotion card"
426
+ accessibilityRole="button"
427
+ disabled={false}
428
+ hitSlop={{ top: 10, bottom: 10, left: 10, right: 10 }}
429
+
430
+ // Custom style function for press states
431
+ style={({ pressed }) => [
432
+ baseCardStyle,
433
+ pressed && { opacity: 0.8 }
434
+ ]}
435
+ />
436
+ ```
437
+
438
+ ### LargeImageCard Advanced Props
439
+
440
+ ```typescript
441
+ import { LargeImageCard } from '@adobe/react-native-aepmessaging';
442
+
443
+ <LargeImageCard
444
+ content={contentData}
445
+ imageUri={imageUrl}
446
+ styleOverrides={largeImageStyleOverrides}
447
+ onPress={handlePress}
448
+ onDismiss={handleDismiss}
449
+
450
+ // Advanced component props
451
+ ContainerProps={{
452
+ accessibilityLabel: 'Product promotion card'
453
+ }}
454
+
455
+ ImageContainerProps={{
456
+ accessibilityRole: 'image'
457
+ }}
458
+
459
+ ImageProps={{
460
+ accessibilityLabel: 'Product image',
461
+ resizeMode: 'cover'
462
+ }}
463
+
464
+ TextProps={{
465
+ accessibilityRole: 'text',
466
+ maxFontSizeMultiplier: 1.2
467
+ }}
468
+
469
+ TitleProps={{
470
+ numberOfLines: 2,
471
+ ellipsizeMode: 'tail'
472
+ }}
473
+
474
+ BodyProps={{
475
+ numberOfLines: 3,
476
+ ellipsizeMode: 'tail'
477
+ }}
478
+
479
+ ButtonContainerProps={{
480
+ accessibilityRole: 'button'
481
+ }}
482
+
483
+ ButtonProps={{
484
+ accessibilityHint: 'Double tap to learn more'
485
+ }}
486
+
487
+ DismissButtonProps={{
488
+ accessibilityLabel: 'Dismiss this card',
489
+ accessibilityHint: 'Double tap to close'
490
+ }}
491
+ />
492
+ ```
493
+
494
+ ### ImageOnlyCard Advanced Props
495
+
496
+ ```typescript
497
+ import { ImageOnlyCard } from '@adobe/react-native-aepmessaging';
498
+
499
+ <ImageOnlyCard
500
+ content={contentData}
501
+ imageUri={imageUrl}
502
+ styleOverrides={imageOnlyStyleOverrides}
503
+ onPress={handlePress}
504
+ onDismiss={handleDismiss}
505
+
506
+ // Advanced component props
507
+ ContainerProps={{
508
+ accessibilityLabel: 'Featured image card'
509
+ }}
510
+
511
+ ImageContainerProps={{
512
+ accessibilityRole: 'image'
513
+ }}
514
+
515
+ ImageProps={{
516
+ accessibilityLabel: 'Featured content image',
517
+ resizeMode: 'contain'
518
+ }}
519
+
520
+ DismissButtonProps={{
521
+ accessibilityLabel: 'Close image',
522
+ accessibilityHint: 'Double tap to dismiss'
523
+ }}
524
+ />
525
+ ```
526
+
527
+ ## Practical Example
528
+
529
+ ### E-commerce Product Card
530
+
531
+ ```typescript
532
+ import React from 'react';
533
+ import { ContentCardView, ThemeProvider } from '@adobe/react-native-aepmessaging';
534
+
535
+ // Custom theme for e-commerce
536
+ const ecommerceTheme = {
537
+ light: {
538
+ colors: {
539
+ primary: '#FF6B35',
540
+ secondary: '#004E89',
541
+ background: '#FFFFFF',
542
+ textPrimary: '#1A1A1A',
543
+ textSecondary: '#666666',
544
+ imagePlaceholder: '#E5E5E5',
545
+ buttonTextColor: '#FFFFFF'
546
+ }
547
+ },
548
+ dark: {
549
+ colors: {
550
+ primary: '#FF8A5B',
551
+ secondary: '#0066CC',
552
+ background: '#1A1A1A',
553
+ textPrimary: '#FFFFFF',
554
+ textSecondary: '#CCCCCC',
555
+ imagePlaceholder: '#333333',
556
+ buttonTextColor: 'dodgerblue'
557
+ }
558
+ }
559
+ };
560
+
561
+ // Product card style overrides
562
+ const productCardStyles = {
563
+ smallImageStyle: {
564
+ card: {
565
+ borderRadius: 12,
566
+ backgroundColor: '#FFFFFF',
567
+ borderWidth: 1,
568
+ borderColor: '#E0E0E0',
569
+ margin: 16,
570
+ shadowColor: '#000',
571
+ shadowOffset: { width: 0, height: 2 },
572
+ shadowOpacity: 0.1,
573
+ shadowRadius: 4,
574
+ elevation: 3
575
+ },
576
+ image: {
577
+ borderRadius: 8
578
+ },
579
+ title: {
580
+ fontSize: 16,
581
+ fontWeight: '600',
582
+ color: '#1A1A1A'
583
+ },
584
+ body: {
585
+ fontSize: 14,
586
+ color: '#666666',
587
+ marginTop: 4
588
+ },
589
+ button: {
590
+ backgroundColor: '#FF6B35',
591
+ paddingHorizontal: 20,
592
+ paddingVertical: 10,
593
+ borderRadius: 25
594
+ },
595
+ buttonText: {
596
+ color: '#FFFFFF',
597
+ fontWeight: '600',
598
+ fontSize: 14
599
+ }
600
+ }
601
+ };
602
+
603
+ function ProductCard({ template }) {
604
+ const handleInteraction = (event, data) => {
605
+ console.log('Product card interaction:', event, data);
606
+ };
607
+
608
+ return (
609
+ <ThemeProvider customThemes={ecommerceTheme}>
610
+ <ContentCardView
611
+ template={template}
612
+ styleOverrides={productCardStyles}
613
+ listener={handleInteraction}
614
+ />
615
+ </ThemeProvider>
616
+ );
617
+ }
618
+ ```
619
+
620
+ ## Best Practices
621
+
622
+ ### 1. Hierarchy Best Practices
623
+ ```typescript
624
+ // Good: Use hierarchy effectively
625
+ const styles = {
626
+ card: {
627
+ // Base card styling
628
+ backgroundColor: theme.colors.background, // Theme value
629
+ padding: 16, // Component-specific override
630
+ }
631
+ };
632
+
633
+ // Good: Specific overrides
634
+ <SmallImageCard
635
+ styleOverrides={{
636
+ title: { fontSize: 18 }, // Override specific element
637
+ button: { backgroundColor: '#FF6B35' } // Brand-specific button color
638
+ }}
639
+ />
640
+
641
+ // Avoid: Over-styling at theme level
642
+ const badTheme = {
643
+ colors: {
644
+ buttonSpecificBackgroundForProductCards: '#FF6B35' // Too specific for theme
645
+ }
646
+ };
647
+ ```
648
+
649
+ ### 2. Consistent Theming
650
+ - Use the theme system for colors that should be consistent across all content cards
651
+ - Always provide both light and dark theme variants
652
+ - Test your themes in both color schemes
653
+
654
+ ### 3. Responsive Design
655
+ - Use flexible layouts and relative sizing
656
+ - Test on different screen sizes and orientations
657
+ - Consider accessibility font scaling
658
+
659
+ ---
660
+
661
+ This guide provides a comprehensive overview of the Content Card customization system. With the three-tier customization hierarchy (Theme → Style Overrides → Props), you can create beautiful, branded content cards that fit seamlessly into your app's design system.