@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.
- package/RCTAEPMessaging.podspec +1 -1
- package/README.md +145 -16
- package/android/src/main/java/com/adobe/marketing/mobile/reactnative/messaging/RCTAEPMessagingModule.java +82 -32
- 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 +1 -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 +11 -0
- package/ios/src/RCTAEPMessaging.swift +30 -3
- package/jest.config.js +15 -0
- package/package.json +33 -5
- package/src/Messaging.ts +287 -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/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/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 -152
- 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 -156
- 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
|
@@ -0,0 +1,515 @@
|
|
|
1
|
+
# Inbox Tutorial
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
The Inbox component provides a complete, ready-to-use inbox view for displaying content cards in your mobile application. Unlike manually rendering individual content cards, the Inbox component handles layout, loading states, error handling, empty states, card interaction, and unread indicators out of the box. The Inbox component is ideal for creating dedicated inbox screens, notification centers, or any centralized content card display area.
|
|
6
|
+
|
|
7
|
+
## Prerequisites
|
|
8
|
+
|
|
9
|
+
Before implementing the Inbox component, 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
|
+
- Create a [channel](https://experienceleague.adobe.com/en/docs/journey-optimizer/using/channels/content-card/configure/content-card-configuration) (Define appid and surface)
|
|
15
|
+
- 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"
|
|
16
|
+
- Design content cards with [templates](https://experienceleague.adobe.com/en/docs/journey-optimizer/using/channels/content-card/design-content-card)
|
|
17
|
+
|
|
18
|
+
3. **Integrated and registered the AEPMessaging extension** in your app (see [SDK Integration](#sdk-integration) section below)
|
|
19
|
+
|
|
20
|
+
### Defining Surface Identifiers
|
|
21
|
+
|
|
22
|
+
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.
|
|
23
|
+
|
|
24
|
+
#### Surface Naming Conventions
|
|
25
|
+
|
|
26
|
+
Use descriptive, hierarchical naming patterns:
|
|
27
|
+
|
|
28
|
+
**Feature-based surfaces**
|
|
29
|
+
```typescript
|
|
30
|
+
const surfaces = [
|
|
31
|
+
'homepage',
|
|
32
|
+
'product-detail',
|
|
33
|
+
'checkout',
|
|
34
|
+
'profile',
|
|
35
|
+
'inbox'
|
|
36
|
+
];
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**Context-specific surfaces**
|
|
40
|
+
```typescript
|
|
41
|
+
const surfaces = [
|
|
42
|
+
'rn/ios/remote_image', // For remote image content cards
|
|
43
|
+
'rn/android/local_promo', // For local promotional cards
|
|
44
|
+
'app/inbox/notifications' // For inbox notifications
|
|
45
|
+
];
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
#### Where to Configure Surface Identifiers
|
|
49
|
+
|
|
50
|
+
Surface identifiers must be coordinated between two locations:
|
|
51
|
+
|
|
52
|
+
1. **Adobe Journey Optimizer**: When creating content card campaigns, specify the surface identifier in your campaign targeting configuration
|
|
53
|
+
2. **Your Mobile App**: Use the same surface identifiers when calling the Messaging APIs to fetch and display content cards
|
|
54
|
+
|
|
55
|
+
**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.
|
|
56
|
+
|
|
57
|
+
## SDK Integration
|
|
58
|
+
|
|
59
|
+
Before you can use the Inbox component, 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).
|
|
60
|
+
|
|
61
|
+
**Required packages:**
|
|
62
|
+
- [`@adobe/react-native-aepcore`](https://github.com/adobe/aepsdk-react-native/tree/main/packages/core)
|
|
63
|
+
- [`@adobe/react-native-aepedge`](https://github.com/adobe/aepsdk-react-native/tree/main/packages/edge)
|
|
64
|
+
- [`@adobe/react-native-aepedgeidentity`](https://github.com/adobe/aepsdk-react-native/tree/main/packages/edgeidentity)
|
|
65
|
+
- [`@adobe/react-native-aepmessaging`](https://github.com/adobe/aepsdk-react-native/tree/main/packages/messaging)
|
|
66
|
+
|
|
67
|
+
**Imports for Inbox:**
|
|
68
|
+
```typescript
|
|
69
|
+
import {
|
|
70
|
+
Inbox, // Pre-built Inbox component
|
|
71
|
+
useInbox, // Hook for fetching inbox settings
|
|
72
|
+
InboxSettings, // Type definitions
|
|
73
|
+
ThemeProvider // Optional: For theme customization
|
|
74
|
+
} from '@adobe/react-native-aepmessaging/ui';
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Using the Inbox Component
|
|
78
|
+
|
|
79
|
+
The Inbox component provides a complete inbox implementation with minimal setup required. It handles content card fetching, layout, loading states, error handling, empty states, and card management automatically.
|
|
80
|
+
|
|
81
|
+
### Basic Implementation
|
|
82
|
+
|
|
83
|
+
The simplest way to use the Inbox component is with the `useInbox` hook:
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
import React from 'react';
|
|
87
|
+
import { ActivityIndicator, Text } from 'react-native';
|
|
88
|
+
import { Inbox, useInbox } from '@adobe/react-native-aepmessaging/ui';
|
|
89
|
+
|
|
90
|
+
const InboxScreen = () => {
|
|
91
|
+
const { settings, isLoading, error } = useInbox('inbox');
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<Inbox
|
|
95
|
+
surface="inbox"
|
|
96
|
+
settings={settings}
|
|
97
|
+
isLoading={isLoading}
|
|
98
|
+
error={!!error}
|
|
99
|
+
LoadingComponent={<ActivityIndicator />}
|
|
100
|
+
ErrorComponent={<Text>Error loading inbox</Text>}
|
|
101
|
+
/>
|
|
102
|
+
);
|
|
103
|
+
};
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Using useInbox Hook
|
|
107
|
+
|
|
108
|
+
The `useInbox` hook fetches inbox settings for a given surface and provides loading and error states.
|
|
109
|
+
|
|
110
|
+
```typescript
|
|
111
|
+
const { settings, isLoading, error, refetch } = useInbox(surface);
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
#### useInbox Hook API Reference
|
|
115
|
+
|
|
116
|
+
| Property | Type | Description |
|
|
117
|
+
|----------|------|-------------|
|
|
118
|
+
| `settings` | `InboxSettings \| null` | Inbox configuration settings (layout, capacity, heading, etc.) |
|
|
119
|
+
| `isLoading` | `boolean` | Loading state indicator |
|
|
120
|
+
| `error` | `any \| null` | Error object if fetching fails |
|
|
121
|
+
| `refetch` | `() => Promise<void>` | Function to manually refresh inbox settings |
|
|
122
|
+
|
|
123
|
+
**Example with refetch:**
|
|
124
|
+
|
|
125
|
+
```typescript
|
|
126
|
+
import React from 'react';
|
|
127
|
+
import { Button, View } from 'react-native';
|
|
128
|
+
import { Inbox, useInbox } from '@adobe/react-native-aepmessaging/ui';
|
|
129
|
+
|
|
130
|
+
const InboxScreen = () => {
|
|
131
|
+
const { settings, isLoading, error, refetch } = useInbox('inbox');
|
|
132
|
+
|
|
133
|
+
return (
|
|
134
|
+
<View style={{ flex: 1 }}>
|
|
135
|
+
<Button title="Refresh" onPress={refetch} />
|
|
136
|
+
<Inbox
|
|
137
|
+
surface="inbox"
|
|
138
|
+
settings={settings}
|
|
139
|
+
isLoading={isLoading}
|
|
140
|
+
error={!!error}
|
|
141
|
+
/>
|
|
142
|
+
</View>
|
|
143
|
+
);
|
|
144
|
+
};
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Inbox Component Props
|
|
148
|
+
|
|
149
|
+
The `Inbox` component accepts the following props:
|
|
150
|
+
|
|
151
|
+
| Prop | Type | Required | Description |
|
|
152
|
+
|------|------|----------|-------------|
|
|
153
|
+
| `surface` | `string` | Yes | Surface identifier for the inbox |
|
|
154
|
+
| `settings` | `InboxSettings \| null` | Yes | Inbox settings from `useInbox` hook or `Messaging.getInbox()` |
|
|
155
|
+
| `isLoading` | `boolean` | No | Loading state |
|
|
156
|
+
| `error` | `boolean` | No | Error state |
|
|
157
|
+
| `LoadingComponent` | `ReactElement \| null` | No | Custom loading component (default: `<ActivityIndicator />`) |
|
|
158
|
+
| `ErrorComponent` | `ReactElement \| null` | No | Custom error component |
|
|
159
|
+
| `FallbackComponent` | `ReactElement \| null` | No | Component shown when settings are null |
|
|
160
|
+
| `EmptyComponent` | `ReactElement \| null` | No | Custom empty state component |
|
|
161
|
+
| `CardProps` | `Partial<ContentViewProps>` | No | Props passed to individual `ContentCardView` components |
|
|
162
|
+
| All `FlatListProps` | - | No | All `FlatList` props are supported for layout customization |
|
|
163
|
+
|
|
164
|
+
## Inbox Settings Configuration
|
|
165
|
+
|
|
166
|
+
The `InboxSettings` object controls the appearance and behavior of the inbox. Settings are typically fetched from Adobe Journey Optimizer, but you can also provide them manually for testing or fallback scenarios.
|
|
167
|
+
|
|
168
|
+
### InboxSettings Structure
|
|
169
|
+
|
|
170
|
+
```typescript
|
|
171
|
+
interface InboxSettings {
|
|
172
|
+
content: {
|
|
173
|
+
heading: {
|
|
174
|
+
content: string; // Heading text displayed above inbox
|
|
175
|
+
};
|
|
176
|
+
layout: {
|
|
177
|
+
orientation: 'horizontal' | 'vertical'; // Layout direction
|
|
178
|
+
};
|
|
179
|
+
capacity: number; // Maximum number of cards to display
|
|
180
|
+
emptyStateSettings?: {
|
|
181
|
+
message: {
|
|
182
|
+
content: string; // Message shown when inbox is empty
|
|
183
|
+
};
|
|
184
|
+
image?: {
|
|
185
|
+
url?: string; // Empty state image (light mode)
|
|
186
|
+
darkUrl?: string; // Empty state image (dark mode)
|
|
187
|
+
};
|
|
188
|
+
};
|
|
189
|
+
unread_indicator?: {
|
|
190
|
+
unread_bg: {
|
|
191
|
+
clr: {
|
|
192
|
+
light: string; // Background color for unread cards (light mode)
|
|
193
|
+
dark: string; // Background color for unread cards (dark mode)
|
|
194
|
+
};
|
|
195
|
+
};
|
|
196
|
+
unread_icon: {
|
|
197
|
+
placement: 'topleft' | 'topright' | 'bottomleft' | 'bottomright';
|
|
198
|
+
image: {
|
|
199
|
+
url: string; // Unread indicator icon URL
|
|
200
|
+
darkUrl?: string; // Unread indicator icon URL (dark mode)
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
isUnreadEnabled?: boolean; // Enable/disable unread features (default: true)
|
|
205
|
+
};
|
|
206
|
+
showPagination?: boolean; // Show pagination controls (default: false)
|
|
207
|
+
}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Example Settings
|
|
211
|
+
|
|
212
|
+
```typescript
|
|
213
|
+
const exampleSettings: InboxSettings = {
|
|
214
|
+
content: {
|
|
215
|
+
heading: {
|
|
216
|
+
content: 'My Inbox'
|
|
217
|
+
},
|
|
218
|
+
layout: {
|
|
219
|
+
orientation: 'vertical'
|
|
220
|
+
},
|
|
221
|
+
capacity: 20,
|
|
222
|
+
emptyStateSettings: {
|
|
223
|
+
message: {
|
|
224
|
+
content: 'No new messages'
|
|
225
|
+
},
|
|
226
|
+
image: {
|
|
227
|
+
url: 'https://example.com/empty-state-light.png',
|
|
228
|
+
darkUrl: 'https://example.com/empty-state-dark.png'
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
unread_indicator: {
|
|
232
|
+
unread_bg: {
|
|
233
|
+
clr: {
|
|
234
|
+
light: '#FFF3E0',
|
|
235
|
+
dark: '#2D1B0E'
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
unread_icon: {
|
|
239
|
+
placement: 'topleft',
|
|
240
|
+
image: {
|
|
241
|
+
url: 'https://example.com/unread-icon.png'
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
isUnreadEnabled: true
|
|
246
|
+
},
|
|
247
|
+
showPagination: false
|
|
248
|
+
};
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
## Layout Options
|
|
252
|
+
|
|
253
|
+
The Inbox component supports two layout orientations:
|
|
254
|
+
|
|
255
|
+
### Vertical Layout
|
|
256
|
+
|
|
257
|
+
Vertical layout displays cards in a vertical list, ideal for inbox screens and notification centers.
|
|
258
|
+
|
|
259
|
+
```typescript
|
|
260
|
+
<Inbox
|
|
261
|
+
surface="inbox"
|
|
262
|
+
settings={{
|
|
263
|
+
content: {
|
|
264
|
+
heading: { content: 'Notifications' },
|
|
265
|
+
layout: { orientation: 'vertical' },
|
|
266
|
+
capacity: 20
|
|
267
|
+
}
|
|
268
|
+
}}
|
|
269
|
+
/>
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### Horizontal Layout
|
|
273
|
+
|
|
274
|
+
Horizontal layout displays cards in a horizontal carousel, ideal for featured content or promotional banners.
|
|
275
|
+
|
|
276
|
+
```typescript
|
|
277
|
+
<Inbox
|
|
278
|
+
surface="inbox"
|
|
279
|
+
settings={{
|
|
280
|
+
content: {
|
|
281
|
+
heading: { content: 'Featured Deals' },
|
|
282
|
+
layout: { orientation: 'horizontal' },
|
|
283
|
+
capacity: 10
|
|
284
|
+
}
|
|
285
|
+
}}
|
|
286
|
+
/>
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
## Customization
|
|
290
|
+
|
|
291
|
+
### Custom Loading Component
|
|
292
|
+
|
|
293
|
+
```typescript
|
|
294
|
+
<Inbox
|
|
295
|
+
surface="inbox"
|
|
296
|
+
settings={settings}
|
|
297
|
+
isLoading={isLoading}
|
|
298
|
+
LoadingComponent={
|
|
299
|
+
<View style={{ padding: 20 }}>
|
|
300
|
+
<ActivityIndicator size="large" />
|
|
301
|
+
<Text>Loading your inbox...</Text>
|
|
302
|
+
</View>
|
|
303
|
+
}
|
|
304
|
+
/>
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
### Custom Error Component
|
|
308
|
+
|
|
309
|
+
```typescript
|
|
310
|
+
<Inbox
|
|
311
|
+
surface="inbox"
|
|
312
|
+
settings={settings}
|
|
313
|
+
error={!!error}
|
|
314
|
+
ErrorComponent={
|
|
315
|
+
<View style={{ padding: 20 }}>
|
|
316
|
+
<Text>Failed to load inbox</Text>
|
|
317
|
+
<Button title="Retry" onPress={refetch} />
|
|
318
|
+
</View>
|
|
319
|
+
}
|
|
320
|
+
/>
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
### Custom Empty State
|
|
324
|
+
|
|
325
|
+
```typescript
|
|
326
|
+
<Inbox
|
|
327
|
+
surface="inbox"
|
|
328
|
+
settings={settings}
|
|
329
|
+
EmptyComponent={
|
|
330
|
+
<View style={{ padding: 40, alignItems: 'center' }}>
|
|
331
|
+
<Text style={{ fontSize: 24, marginBottom: 10 }}>📭</Text>
|
|
332
|
+
<Text style={{ fontSize: 18 }}>Your inbox is empty</Text>
|
|
333
|
+
<Text style={{ color: 'gray', marginTop: 5 }}>
|
|
334
|
+
Check back later for new messages
|
|
335
|
+
</Text>
|
|
336
|
+
</View>
|
|
337
|
+
}
|
|
338
|
+
/>
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
### Customizing Individual Cards
|
|
342
|
+
|
|
343
|
+
You can customize individual content cards using the `CardProps` prop:
|
|
344
|
+
|
|
345
|
+
```typescript
|
|
346
|
+
<Inbox
|
|
347
|
+
surface="inbox"
|
|
348
|
+
settings={settings}
|
|
349
|
+
CardProps={{
|
|
350
|
+
styleOverrides: {
|
|
351
|
+
smallImageStyle: {
|
|
352
|
+
container: {
|
|
353
|
+
backgroundColor: '#f5f5f5',
|
|
354
|
+
borderRadius: 12,
|
|
355
|
+
marginVertical: 8
|
|
356
|
+
},
|
|
357
|
+
title: {
|
|
358
|
+
fontSize: 18,
|
|
359
|
+
fontWeight: 'bold'
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
},
|
|
363
|
+
listener: (event, data) => {
|
|
364
|
+
console.log('Card event:', event, data);
|
|
365
|
+
}
|
|
366
|
+
}}
|
|
367
|
+
/>
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
### Custom Container Styles
|
|
371
|
+
|
|
372
|
+
You can customize the inbox container using `FlatList` props:
|
|
373
|
+
|
|
374
|
+
```typescript
|
|
375
|
+
<Inbox
|
|
376
|
+
surface="inbox"
|
|
377
|
+
settings={settings}
|
|
378
|
+
contentContainerStyle={{
|
|
379
|
+
padding: 16,
|
|
380
|
+
backgroundColor: '#f9f9f9'
|
|
381
|
+
}}
|
|
382
|
+
style={{
|
|
383
|
+
backgroundColor: '#ffffff'
|
|
384
|
+
}}
|
|
385
|
+
/>
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
## Unread Indicators
|
|
389
|
+
|
|
390
|
+
The Inbox component supports unread indicators to highlight cards that haven't been interacted with yet.
|
|
391
|
+
|
|
392
|
+
### Enabling Unread Indicators
|
|
393
|
+
|
|
394
|
+
```typescript
|
|
395
|
+
const settings: InboxSettings = {
|
|
396
|
+
content: {
|
|
397
|
+
// ... other settings
|
|
398
|
+
isUnreadEnabled: true,
|
|
399
|
+
unread_indicator: {
|
|
400
|
+
unread_bg: {
|
|
401
|
+
clr: {
|
|
402
|
+
light: '#FFF3E0', // Light orange background
|
|
403
|
+
dark: '#2D1B0E' // Dark orange background
|
|
404
|
+
}
|
|
405
|
+
},
|
|
406
|
+
unread_icon: {
|
|
407
|
+
placement: 'topleft',
|
|
408
|
+
image: {
|
|
409
|
+
url: 'https://example.com/unread-icon.png'
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
};
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
### Unread Behavior
|
|
418
|
+
|
|
419
|
+
- Cards are marked as "read" when the user interacts with them (taps the card or buttons)
|
|
420
|
+
- Unread cards display with the configured background color
|
|
421
|
+
- Unread indicator icon appears at the specified placement
|
|
422
|
+
- The `isRead` property on content cards is automatically managed
|
|
423
|
+
|
|
424
|
+
## Card Management
|
|
425
|
+
|
|
426
|
+
The Inbox component automatically handles:
|
|
427
|
+
|
|
428
|
+
### Dismissed Cards
|
|
429
|
+
|
|
430
|
+
- Cards dismissed by the user are automatically filtered out
|
|
431
|
+
- Dismiss state persists for the app session
|
|
432
|
+
- Dismissed cards won't reappear until the app is restarted
|
|
433
|
+
|
|
434
|
+
### Interacted Cards
|
|
435
|
+
|
|
436
|
+
- Cards that have been interacted with are marked as read (if `isUnreadEnabled` is true)
|
|
437
|
+
- Interaction state persists for the app session
|
|
438
|
+
- Interacted cards maintain their read state
|
|
439
|
+
|
|
440
|
+
### Capacity Limits
|
|
441
|
+
|
|
442
|
+
- The `capacity` setting limits the maximum number of cards displayed
|
|
443
|
+
- Cards beyond the capacity limit are not shown
|
|
444
|
+
- Cards are displayed in the order returned from the server
|
|
445
|
+
|
|
446
|
+
## Complete Example
|
|
447
|
+
|
|
448
|
+
Here's a complete example combining all features:
|
|
449
|
+
|
|
450
|
+
```typescript
|
|
451
|
+
import React from 'react';
|
|
452
|
+
import { ActivityIndicator, Button, Text, View } from 'react-native';
|
|
453
|
+
import { Inbox, useInbox } from '@adobe/react-native-aepmessaging/ui';
|
|
454
|
+
|
|
455
|
+
const InboxScreen = () => {
|
|
456
|
+
const { settings, isLoading, error, refetch } = useInbox('inbox');
|
|
457
|
+
|
|
458
|
+
if (isLoading) {
|
|
459
|
+
return (
|
|
460
|
+
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
|
|
461
|
+
<ActivityIndicator size="large" />
|
|
462
|
+
<Text style={{ marginTop: 10 }}>Loading inbox...</Text>
|
|
463
|
+
</View>
|
|
464
|
+
);
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
if (error) {
|
|
468
|
+
return (
|
|
469
|
+
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center', padding: 20 }}>
|
|
470
|
+
<Text style={{ fontSize: 18, marginBottom: 10 }}>Failed to load inbox</Text>
|
|
471
|
+
<Button title="Retry" onPress={refetch} />
|
|
472
|
+
</View>
|
|
473
|
+
);
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
return (
|
|
477
|
+
<View style={{ flex: 1 }}>
|
|
478
|
+
<Inbox
|
|
479
|
+
surface="inbox"
|
|
480
|
+
settings={settings}
|
|
481
|
+
isLoading={false}
|
|
482
|
+
error={false}
|
|
483
|
+
CardProps={{
|
|
484
|
+
listener: (event, data) => {
|
|
485
|
+
console.log('Card event:', event, data);
|
|
486
|
+
}
|
|
487
|
+
}}
|
|
488
|
+
contentContainerStyle={{
|
|
489
|
+
padding: 16
|
|
490
|
+
}}
|
|
491
|
+
/>
|
|
492
|
+
</View>
|
|
493
|
+
);
|
|
494
|
+
};
|
|
495
|
+
|
|
496
|
+
export default InboxScreen;
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
## Benefits of Using the Inbox Component
|
|
500
|
+
|
|
501
|
+
The Inbox component provides several advantages over manually rendering content cards:
|
|
502
|
+
|
|
503
|
+
- **Complete Solution**: Handles layout, loading, errors, and empty states automatically
|
|
504
|
+
- **Card Management**: Built-in support for dismissed and interacted cards
|
|
505
|
+
- **Unread Indicators**: Automatic unread state management
|
|
506
|
+
- **Flexible Layout**: Supports both vertical and horizontal layouts
|
|
507
|
+
- **Customizable**: Extensive customization options for all states and components
|
|
508
|
+
- **Performance**: Optimized rendering with proper memoization and state management
|
|
509
|
+
- **Less Code**: Minimal setup required compared to manual implementation
|
|
510
|
+
|
|
511
|
+
## Related Documentation
|
|
512
|
+
|
|
513
|
+
- [Content Cards Tutorial](./ContentCards.md) - Learn about content cards and the `ContentCardView` component
|
|
514
|
+
- [Content Card Customization Guide](./ContentCardCustomizationGuide.md) - Advanced styling and customization options
|
|
515
|
+
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/Messaging.js
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
Copyright 2024 Adobe. All rights reserved.
|
|
4
|
-
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
you may not use this file except in compliance with the License. You may obtain a copy
|
|
6
|
-
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
|
|
8
|
-
Unless required by applicable law or agreed to in writing, software distributed under
|
|
9
|
-
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
10
|
-
OF ANY KIND, either express or implied. See the License for the specific language
|
|
11
|
-
governing permissions and limitations under the License.
|
|
12
|
-
*/
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
const tslib_1 = require("tslib");
|
|
15
|
-
const react_native_1 = require("react-native");
|
|
16
|
-
const Message_1 = tslib_1.__importDefault(require("./models/Message"));
|
|
17
|
-
const MessagingProposition_1 = require("./models/MessagingProposition");
|
|
18
|
-
const RCTAEPMessaging = react_native_1.NativeModules.AEPMessaging;
|
|
19
|
-
var messagingDelegate;
|
|
20
|
-
class Messaging {
|
|
21
|
-
/**
|
|
22
|
-
* Returns the version of the AEPMessaging extension
|
|
23
|
-
* @returns {string} Promise a promise that resolves with the extension version
|
|
24
|
-
*/
|
|
25
|
-
static extensionVersion() {
|
|
26
|
-
return Promise.resolve(RCTAEPMessaging.extensionVersion());
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Initiates a network call to retrieve remote In-App Message definitions.
|
|
30
|
-
*/
|
|
31
|
-
static refreshInAppMessages() {
|
|
32
|
-
RCTAEPMessaging.refreshInAppMessages();
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Retrieves the list of messages which have been cached using the `shouldSaveMessage`
|
|
36
|
-
* method of the messaging delegate.
|
|
37
|
-
* Note: Messages should be cached before trying to use any of the methods on the message class
|
|
38
|
-
* @returns An array of messages that have been cached
|
|
39
|
-
*/
|
|
40
|
-
static getCachedMessages() {
|
|
41
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
42
|
-
const messages = yield RCTAEPMessaging.getCachedMessages();
|
|
43
|
-
return messages.map((msg) => new Message_1.default(msg));
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Retrieves the last message that has been shown in the UI
|
|
48
|
-
* @returns The latest message to have been displayed
|
|
49
|
-
*/
|
|
50
|
-
static getLatestMessage() {
|
|
51
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
52
|
-
const message = yield RCTAEPMessaging.getLatestMessage();
|
|
53
|
-
return message ? new Message_1.default(message) : undefined;
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Retrieves the previously fetched (and cached) feeds content from the SDK for the provided surfaces.
|
|
58
|
-
* If the feeds content for one or more surfaces isn't previously cached in the SDK, it will not be retrieved from Adobe Journey Optimizer via the Experience Edge network.
|
|
59
|
-
* @param surfaces A list of surfaces to fetch
|
|
60
|
-
* @returns A record of surface names with their corresponding propositions
|
|
61
|
-
*/
|
|
62
|
-
static getPropositionsForSurfaces(surfaces) {
|
|
63
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
const propositionsList = yield RCTAEPMessaging.getPropositionsForSurfaces(surfaces);
|
|
65
|
-
let messagingPropositionsForSurfaces = {};
|
|
66
|
-
for (const [surface, propositions] of Object.entries(propositionsList)) {
|
|
67
|
-
messagingPropositionsForSurfaces[surface] = propositions.map((proposition) => new MessagingProposition_1.MessagingProposition(proposition));
|
|
68
|
-
}
|
|
69
|
-
return messagingPropositionsForSurfaces;
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* @deprecated Use PropositionItem.track(...) instead.
|
|
74
|
-
*/
|
|
75
|
-
static trackContentCardDisplay(proposition, contentCard) {
|
|
76
|
-
RCTAEPMessaging.trackContentCardDisplay(proposition, contentCard);
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* @deprecated Use PropositionItem.track(...) instead.
|
|
80
|
-
*/
|
|
81
|
-
static trackContentCardInteraction(proposition, contentCard) {
|
|
82
|
-
RCTAEPMessaging.trackContentCardInteraction(proposition, contentCard);
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Tracks interactions with a PropositionItem using the provided interaction and event type.
|
|
86
|
-
* This method is used internally by the PropositionItem.track() method.
|
|
87
|
-
*
|
|
88
|
-
* @param {string} itemId - The unique identifier of the PropositionItem
|
|
89
|
-
* @param {string | null} interaction - A custom string value to be recorded in the interaction
|
|
90
|
-
* @param {number} eventType - The MessagingEdgeEventType numeric value
|
|
91
|
-
* @param {string[] | null} tokens - Array containing the sub-item tokens for recording interaction
|
|
92
|
-
*/
|
|
93
|
-
static trackPropositionItem(itemId, interaction, eventType, tokens) {
|
|
94
|
-
RCTAEPMessaging.trackPropositionItem(itemId, interaction, eventType, tokens);
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Function to set the UI Message delegate to listen the Message lifecycle events.
|
|
98
|
-
* @returns A function to unsubscribe from all event listeners
|
|
99
|
-
*/
|
|
100
|
-
static setMessagingDelegate(delegate) {
|
|
101
|
-
messagingDelegate = delegate;
|
|
102
|
-
const eventEmitter = new react_native_1.NativeEventEmitter(RCTAEPMessaging);
|
|
103
|
-
eventEmitter.addListener('onShow', (message) => { var _a; return (_a = messagingDelegate === null || messagingDelegate === void 0 ? void 0 : messagingDelegate.onShow) === null || _a === void 0 ? void 0 : _a.call(messagingDelegate, new Message_1.default(message)); });
|
|
104
|
-
eventEmitter.addListener('onDismiss', (message) => {
|
|
105
|
-
var _a;
|
|
106
|
-
const messageInstance = new Message_1.default(message);
|
|
107
|
-
messageInstance._clearJavascriptMessageHandlers();
|
|
108
|
-
messageInstance._clearJavascriptResultHandlers();
|
|
109
|
-
(_a = messagingDelegate === null || messagingDelegate === void 0 ? void 0 : messagingDelegate.onDismiss) === null || _a === void 0 ? void 0 : _a.call(messagingDelegate, messageInstance);
|
|
110
|
-
});
|
|
111
|
-
eventEmitter.addListener('shouldShowMessage', (message) => {
|
|
112
|
-
var _a, _b, _c, _d;
|
|
113
|
-
const messageInstance = new Message_1.default(message);
|
|
114
|
-
const shouldShowMessage = (_b = (_a = messagingDelegate === null || messagingDelegate === void 0 ? void 0 : messagingDelegate.shouldShowMessage) === null || _a === void 0 ? void 0 : _a.call(messagingDelegate, messageInstance)) !== null && _b !== void 0 ? _b : true;
|
|
115
|
-
const shouldSaveMessage = (_d = (_c = messagingDelegate === null || messagingDelegate === void 0 ? void 0 : messagingDelegate.shouldSaveMessage) === null || _c === void 0 ? void 0 : _c.call(messagingDelegate, messageInstance)) !== null && _d !== void 0 ? _d : false;
|
|
116
|
-
RCTAEPMessaging.setMessageSettings(shouldShowMessage, shouldSaveMessage);
|
|
117
|
-
});
|
|
118
|
-
if (react_native_1.Platform.OS === 'ios') {
|
|
119
|
-
eventEmitter.addListener('urlLoaded', (event) => { var _a; return (_a = messagingDelegate === null || messagingDelegate === void 0 ? void 0 : messagingDelegate.urlLoaded) === null || _a === void 0 ? void 0 : _a.call(messagingDelegate, event.url, new Message_1.default(event.message)); });
|
|
120
|
-
}
|
|
121
|
-
if (react_native_1.Platform.OS === 'android') {
|
|
122
|
-
eventEmitter.addListener('onContentLoaded', (event) => { var _a; return (_a = messagingDelegate === null || messagingDelegate === void 0 ? void 0 : messagingDelegate.onContentLoaded) === null || _a === void 0 ? void 0 : _a.call(messagingDelegate, new Message_1.default(event.message)); });
|
|
123
|
-
}
|
|
124
|
-
RCTAEPMessaging.setMessagingDelegate();
|
|
125
|
-
return () => {
|
|
126
|
-
eventEmitter.removeAllListeners('onDismiss');
|
|
127
|
-
eventEmitter.removeAllListeners('onShow');
|
|
128
|
-
eventEmitter.removeAllListeners('shouldShowMessage');
|
|
129
|
-
eventEmitter.removeAllListeners('urlLoaded');
|
|
130
|
-
eventEmitter.removeAllListeners('onContentLoaded');
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Sets global settings for messages being shown and cached
|
|
135
|
-
* Note: This method is also used by MessagingDelegate.shouldShowMessage,
|
|
136
|
-
* which allows finer-grained control over setting these settings
|
|
137
|
-
* @param shouldShowMessage Whether or not a message should be displayed
|
|
138
|
-
* @param shouldSaveMessage Whether or not a message should be cached
|
|
139
|
-
*/
|
|
140
|
-
static setMessageSettings(shouldShowMessage, shouldSaveMessage) {
|
|
141
|
-
RCTAEPMessaging.setMessageSettings(shouldShowMessage, shouldSaveMessage);
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Dispatches an event to fetch propositions for the provided surfaces from remote.
|
|
145
|
-
* @param surfaces A list of surface names to update
|
|
146
|
-
*/
|
|
147
|
-
static updatePropositionsForSurfaces(surfaces) {
|
|
148
|
-
RCTAEPMessaging.updatePropositionsForSurfaces(surfaces);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
exports.default = Messaging;
|
|
152
|
-
//# sourceMappingURL=Messaging.js.map
|
package/dist/Messaging.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Messaging.js","sourceRoot":"","sources":["../src/Messaging.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;EAUE;;;AAEF,+CAKsB;AACtB,uEAAuC;AAEvC,wEAAqE;AAsBrE,MAAM,eAAe,GACnB,4BAAa,CAAC,YAAY,CAAC;AAG7B,IAAI,iBAAoC,CAAC;AAEzC,MAAM,SAAS;IACb;;;OAGG;IACH,MAAM,CAAC,gBAAgB;QACr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