@adobe/react-native-aepmessaging 7.2.1 → 7.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/RCTAEPMessaging.podspec +1 -1
- package/README.md +145 -16
- package/android/src/main/java/com/adobe/marketing/mobile/reactnative/messaging/RCTAEPMessagingConstants.java +3 -0
- package/android/src/main/java/com/adobe/marketing/mobile/reactnative/messaging/RCTAEPMessagingModule.java +103 -33
- package/babel.config.js +3 -0
- package/dist/module/Messaging.js +334 -0
- package/dist/module/Messaging.js.map +1 -0
- package/dist/module/index.js +30 -0
- package/dist/module/index.js.map +1 -0
- package/dist/module/models/ContentCard.js +24 -0
- package/dist/module/models/ContentCard.js.map +1 -0
- package/dist/{models → module/models}/HTMLProposition.js +8 -9
- package/dist/module/models/HTMLProposition.js.map +1 -0
- package/dist/module/models/InAppMessage.js +4 -0
- package/dist/module/models/InAppMessage.js.map +1 -0
- package/dist/module/models/JSONProposition.js +22 -0
- package/dist/module/models/JSONProposition.js.map +1 -0
- package/dist/module/models/Message.js +182 -0
- package/dist/module/models/Message.js.map +1 -0
- package/dist/module/models/MessagingDelegate.js +4 -0
- package/dist/module/models/MessagingDelegate.js.map +1 -0
- package/dist/module/models/MessagingEdgeEventType.js +24 -0
- package/dist/module/models/MessagingEdgeEventType.js.map +1 -0
- package/dist/module/models/MessagingProposition.js +57 -0
- package/dist/module/models/MessagingProposition.js.map +1 -0
- package/dist/module/models/MessagingPropositionItem.js +4 -0
- package/dist/module/models/MessagingPropositionItem.js.map +1 -0
- package/dist/module/models/PersonalizationSchema.js +26 -0
- package/dist/module/models/PersonalizationSchema.js.map +1 -0
- package/dist/module/models/PropositionItem.js +113 -0
- package/dist/module/models/PropositionItem.js.map +1 -0
- package/dist/module/models/ScopeDetails.js +2 -0
- package/dist/module/models/ScopeDetails.js.map +1 -0
- package/dist/{models/JSONProposition.js → module/models/index.js} +14 -12
- package/dist/module/models/index.js.map +1 -0
- package/dist/module/ui/components/Button/Button.js +57 -0
- package/dist/module/ui/components/Button/Button.js.map +1 -0
- package/dist/module/ui/components/Button/Button.spec.js +476 -0
- package/dist/module/ui/components/Button/Button.spec.js.map +1 -0
- package/dist/module/ui/components/ContentCardView/ContentCardView.js +257 -0
- package/dist/module/ui/components/ContentCardView/ContentCardView.js.map +1 -0
- package/dist/module/ui/components/ContentCardView/ContentCardView.spec.js +363 -0
- package/dist/module/ui/components/ContentCardView/ContentCardView.spec.js.map +1 -0
- package/dist/module/ui/components/DismissButton/DismissButton.js +70 -0
- package/dist/module/ui/components/DismissButton/DismissButton.js.map +1 -0
- package/dist/module/ui/components/DismissButton/DismissButton.spec.js +279 -0
- package/dist/module/ui/components/DismissButton/DismissButton.spec.js.map +1 -0
- package/dist/module/ui/components/FullScreenCenterView/FullScreenCenterView.js +34 -0
- package/dist/module/ui/components/FullScreenCenterView/FullScreenCenterView.js.map +1 -0
- package/dist/module/ui/components/Inbox/EmptyState.js +64 -0
- package/dist/module/ui/components/Inbox/EmptyState.js.map +1 -0
- package/dist/module/ui/components/Inbox/Inbox.js +235 -0
- package/dist/module/ui/components/Inbox/Inbox.js.map +1 -0
- package/dist/module/ui/components/Inbox/Inbox.spec.js +847 -0
- package/dist/module/ui/components/Inbox/Inbox.spec.js.map +1 -0
- package/dist/module/ui/components/Pagination/Pagination.js +176 -0
- package/dist/module/ui/components/Pagination/Pagination.js.map +1 -0
- package/dist/module/ui/components/Pagination/Pagination.spec.js +193 -0
- package/dist/module/ui/components/Pagination/Pagination.spec.js.map +1 -0
- package/dist/module/ui/components/UnreadIcon/UnreadIcon.js +184 -0
- package/dist/module/ui/components/UnreadIcon/UnreadIcon.js.map +1 -0
- package/dist/module/ui/components/UnreadIcon/UnreadIcon.spec.js +815 -0
- package/dist/module/ui/components/UnreadIcon/UnreadIcon.spec.js.map +1 -0
- package/dist/{models/ContentCard.js → module/ui/components/index.js} +12 -12
- package/dist/module/ui/components/index.js.map +1 -0
- package/dist/module/ui/hooks/index.js +18 -0
- package/dist/module/ui/hooks/index.js.map +1 -0
- package/dist/module/ui/hooks/useAspectRatio.js +33 -0
- package/dist/module/ui/hooks/useAspectRatio.js.map +1 -0
- package/dist/module/ui/hooks/useAspectRatio.spec.js +65 -0
- package/dist/module/ui/hooks/useAspectRatio.spec.js.map +1 -0
- package/dist/module/ui/hooks/useContentCardUI.js +51 -0
- package/dist/module/ui/hooks/useContentCardUI.js.map +1 -0
- package/dist/module/ui/hooks/useContentCardUI.spec.js +85 -0
- package/dist/module/ui/hooks/useContentCardUI.spec.js.map +1 -0
- package/dist/module/ui/hooks/useInbox.js +49 -0
- package/dist/module/ui/hooks/useInbox.js.map +1 -0
- package/dist/module/ui/hooks/useInbox.spec.js +93 -0
- package/dist/module/ui/hooks/useInbox.spec.js.map +1 -0
- package/dist/module/ui/hooks/useInboxSettings.js +26 -0
- package/dist/module/ui/hooks/useInboxSettings.js.map +1 -0
- package/dist/module/ui/hooks/useInboxSettings.spec.js +50 -0
- package/dist/module/ui/hooks/useInboxSettings.spec.js.map +1 -0
- package/dist/module/ui/index.js +10 -0
- package/dist/module/ui/index.js.map +1 -0
- package/dist/module/ui/providers/InboxProvider.js +27 -0
- package/dist/module/ui/providers/InboxProvider.js.map +1 -0
- package/dist/module/ui/theme/Theme.js +2 -0
- package/dist/module/ui/theme/Theme.js.map +1 -0
- package/dist/module/ui/theme/ThemeProvider.js +112 -0
- package/dist/module/ui/theme/ThemeProvider.js.map +1 -0
- package/dist/{models/InAppMessage.js → module/ui/theme/index.js} +6 -3
- package/dist/module/ui/theme/index.js.map +1 -0
- package/dist/module/ui/types/ContentViewEvent.js +2 -0
- package/dist/module/ui/types/ContentViewEvent.js.map +1 -0
- package/dist/module/ui/types/Templates.js +26 -0
- package/dist/module/ui/types/Templates.js.map +1 -0
- package/dist/{models/ScopeDetails.js → module/ui/types/index.js} +6 -3
- package/dist/module/ui/types/index.js.map +1 -0
- package/dist/module/ui/utils/generateCardHash.js +50 -0
- package/dist/module/ui/utils/generateCardHash.js.map +1 -0
- package/dist/module/ui/utils/generateCardHash.spec.js +103 -0
- package/dist/module/ui/utils/generateCardHash.spec.js.map +1 -0
- package/dist/module/ui/utils/inboxStorage.js +65 -0
- package/dist/module/ui/utils/inboxStorage.js.map +1 -0
- package/dist/module/ui/utils/inboxStorage.spec.js +123 -0
- package/dist/module/ui/utils/inboxStorage.spec.js.map +1 -0
- package/dist/module/ui/utils/index.js +5 -0
- package/dist/module/ui/utils/index.js.map +1 -0
- package/dist/{Messaging.d.ts → typescript/Messaging.d.ts} +23 -7
- package/dist/typescript/Messaging.d.ts.map +1 -0
- package/dist/{index.d.ts → typescript/index.d.ts} +4 -2
- package/dist/typescript/index.d.ts.map +1 -0
- package/dist/typescript/models/ContentCard.d.ts +57 -0
- package/dist/typescript/models/ContentCard.d.ts.map +1 -0
- package/dist/{models → typescript/models}/HTMLProposition.d.ts +1 -0
- package/dist/typescript/models/HTMLProposition.d.ts.map +1 -0
- package/dist/{models → typescript/models}/InAppMessage.d.ts +1 -0
- package/dist/typescript/models/InAppMessage.d.ts.map +1 -0
- package/dist/{models → typescript/models}/JSONProposition.d.ts +1 -0
- package/dist/typescript/models/JSONProposition.d.ts.map +1 -0
- package/dist/{models → typescript/models}/Message.d.ts +14 -0
- package/dist/typescript/models/Message.d.ts.map +1 -0
- package/dist/{models → typescript/models}/MessagingDelegate.d.ts +1 -0
- package/dist/typescript/models/MessagingDelegate.d.ts.map +1 -0
- package/dist/{models → typescript/models}/MessagingEdgeEventType.d.ts +1 -0
- package/dist/typescript/models/MessagingEdgeEventType.d.ts.map +1 -0
- package/dist/{models → typescript/models}/MessagingProposition.d.ts +1 -0
- package/dist/typescript/models/MessagingProposition.d.ts.map +1 -0
- package/dist/{models → typescript/models}/MessagingPropositionItem.d.ts +1 -0
- package/dist/typescript/models/MessagingPropositionItem.d.ts.map +1 -0
- package/dist/{models → typescript/models}/PersonalizationSchema.d.ts +2 -0
- package/dist/typescript/models/PersonalizationSchema.d.ts.map +1 -0
- package/dist/{models → typescript/models}/PropositionItem.d.ts +1 -0
- package/dist/typescript/models/PropositionItem.d.ts.map +1 -0
- package/dist/{models → typescript/models}/ScopeDetails.d.ts +1 -0
- package/dist/typescript/models/ScopeDetails.d.ts.map +1 -0
- package/dist/typescript/models/index.d.ts +11 -0
- package/dist/typescript/models/index.d.ts.map +1 -0
- package/dist/typescript/ui/components/Button/Button.d.ts +14 -0
- package/dist/typescript/ui/components/Button/Button.d.ts.map +1 -0
- package/dist/typescript/ui/components/Button/Button.spec.d.ts +2 -0
- package/dist/typescript/ui/components/Button/Button.spec.d.ts.map +1 -0
- package/dist/typescript/ui/components/ContentCardView/ContentCardView.d.ts +39 -0
- package/dist/typescript/ui/components/ContentCardView/ContentCardView.d.ts.map +1 -0
- package/dist/typescript/ui/components/ContentCardView/ContentCardView.spec.d.ts +2 -0
- package/dist/typescript/ui/components/ContentCardView/ContentCardView.spec.d.ts.map +1 -0
- package/dist/typescript/ui/components/DismissButton/DismissButton.d.ts +13 -0
- package/dist/typescript/ui/components/DismissButton/DismissButton.d.ts.map +1 -0
- package/dist/typescript/ui/components/DismissButton/DismissButton.spec.d.ts +2 -0
- package/dist/typescript/ui/components/DismissButton/DismissButton.spec.d.ts.map +1 -0
- package/dist/typescript/ui/components/FullScreenCenterView/FullScreenCenterView.d.ts +5 -0
- package/dist/typescript/ui/components/FullScreenCenterView/FullScreenCenterView.d.ts.map +1 -0
- package/dist/typescript/ui/components/Inbox/EmptyState.d.ts +19 -0
- package/dist/typescript/ui/components/Inbox/EmptyState.d.ts.map +1 -0
- package/dist/typescript/ui/components/Inbox/Inbox.d.ts +21 -0
- package/dist/typescript/ui/components/Inbox/Inbox.d.ts.map +1 -0
- package/dist/typescript/ui/components/Inbox/Inbox.spec.d.ts +2 -0
- package/dist/typescript/ui/components/Inbox/Inbox.spec.d.ts.map +1 -0
- package/dist/typescript/ui/components/Pagination/Pagination.d.ts +14 -0
- package/dist/typescript/ui/components/Pagination/Pagination.d.ts.map +1 -0
- package/dist/typescript/ui/components/Pagination/Pagination.spec.d.ts +2 -0
- package/dist/typescript/ui/components/Pagination/Pagination.spec.d.ts.map +1 -0
- package/dist/typescript/ui/components/UnreadIcon/UnreadIcon.d.ts +14 -0
- package/dist/typescript/ui/components/UnreadIcon/UnreadIcon.d.ts.map +1 -0
- package/dist/typescript/ui/components/UnreadIcon/UnreadIcon.spec.d.ts +2 -0
- package/dist/typescript/ui/components/UnreadIcon/UnreadIcon.spec.d.ts.map +1 -0
- package/dist/typescript/ui/components/index.d.ts +10 -0
- package/dist/typescript/ui/components/index.d.ts.map +1 -0
- package/dist/typescript/ui/hooks/index.d.ts +4 -0
- package/dist/typescript/ui/hooks/index.d.ts.map +1 -0
- package/dist/typescript/ui/hooks/useAspectRatio.d.ts +3 -0
- package/dist/typescript/ui/hooks/useAspectRatio.d.ts.map +1 -0
- package/dist/typescript/ui/hooks/useAspectRatio.spec.d.ts +2 -0
- package/dist/typescript/ui/hooks/useAspectRatio.spec.d.ts.map +1 -0
- package/dist/typescript/ui/hooks/useContentCardUI.d.ts +14 -0
- package/dist/typescript/ui/hooks/useContentCardUI.d.ts.map +1 -0
- package/dist/typescript/ui/hooks/useContentCardUI.spec.d.ts +2 -0
- package/dist/typescript/ui/hooks/useContentCardUI.spec.d.ts.map +1 -0
- package/dist/typescript/ui/hooks/useInbox.d.ts +12 -0
- package/dist/typescript/ui/hooks/useInbox.d.ts.map +1 -0
- package/dist/typescript/ui/hooks/useInbox.spec.d.ts +2 -0
- package/dist/typescript/ui/hooks/useInbox.spec.d.ts.map +1 -0
- package/dist/typescript/ui/hooks/useInboxSettings.d.ts +7 -0
- package/dist/typescript/ui/hooks/useInboxSettings.d.ts.map +1 -0
- package/dist/typescript/ui/hooks/useInboxSettings.spec.d.ts +2 -0
- package/dist/typescript/ui/hooks/useInboxSettings.spec.d.ts.map +1 -0
- package/dist/typescript/ui/index.d.ts +8 -0
- package/dist/typescript/ui/index.d.ts.map +1 -0
- package/dist/typescript/ui/providers/InboxProvider.d.ts +56 -0
- package/dist/typescript/ui/providers/InboxProvider.d.ts.map +1 -0
- package/dist/typescript/ui/theme/Theme.d.ts +44 -0
- package/dist/typescript/ui/theme/Theme.d.ts.map +1 -0
- package/dist/typescript/ui/theme/ThemeProvider.d.ts +21 -0
- package/dist/typescript/ui/theme/ThemeProvider.d.ts.map +1 -0
- package/dist/typescript/ui/theme/index.d.ts +3 -0
- package/dist/typescript/ui/theme/index.d.ts.map +1 -0
- package/dist/typescript/ui/types/ContentViewEvent.d.ts +9 -0
- package/dist/typescript/ui/types/ContentViewEvent.d.ts.map +1 -0
- package/dist/typescript/ui/types/Templates.d.ts +43 -0
- package/dist/typescript/ui/types/Templates.d.ts.map +1 -0
- package/dist/typescript/ui/types/index.d.ts +3 -0
- package/dist/typescript/ui/types/index.d.ts.map +1 -0
- package/dist/typescript/ui/utils/generateCardHash.d.ts +21 -0
- package/dist/typescript/ui/utils/generateCardHash.d.ts.map +1 -0
- package/dist/typescript/ui/utils/generateCardHash.spec.d.ts +2 -0
- package/dist/typescript/ui/utils/generateCardHash.spec.d.ts.map +1 -0
- package/dist/typescript/ui/utils/inboxStorage.d.ts +20 -0
- package/dist/typescript/ui/utils/inboxStorage.d.ts.map +1 -0
- package/dist/typescript/ui/utils/inboxStorage.spec.d.ts +2 -0
- package/dist/typescript/ui/utils/inboxStorage.spec.d.ts.map +1 -0
- package/dist/typescript/ui/utils/index.d.ts +3 -0
- package/dist/typescript/ui/utils/index.d.ts.map +1 -0
- package/ios/src/RCTAEPMessaging.mm +15 -0
- package/ios/src/RCTAEPMessaging.swift +61 -3
- package/ios/src/RCTAEPMessagingConstants.swift +4 -1
- package/jest.config.js +15 -0
- package/package.json +33 -5
- package/src/Messaging.ts +288 -32
- package/src/index.ts +3 -3
- package/src/models/ContentCard.ts +52 -27
- package/src/models/HTMLProposition.ts +1 -1
- package/src/models/JSONProposition.ts +1 -1
- package/src/models/Message.ts +50 -0
- package/src/models/PersonalizationSchema.ts +1 -0
- package/src/models/index.ts +22 -0
- package/src/ui/components/Button/Button.spec.tsx +496 -0
- package/src/ui/components/Button/Button.tsx +76 -0
- package/src/ui/components/ContentCardView/ContentCardView.spec.tsx +278 -0
- package/src/ui/components/ContentCardView/ContentCardView.tsx +400 -0
- package/src/ui/components/DismissButton/DismissButton.spec.tsx +314 -0
- package/src/ui/components/DismissButton/DismissButton.tsx +100 -0
- package/src/ui/components/FullScreenCenterView/FullScreenCenterView.tsx +32 -0
- package/src/ui/components/Inbox/EmptyState.tsx +89 -0
- package/src/ui/components/Inbox/Inbox.spec.tsx +478 -0
- package/src/ui/components/Inbox/Inbox.tsx +275 -0
- package/src/ui/components/Pagination/Pagination.spec.tsx +159 -0
- package/src/ui/components/Pagination/Pagination.tsx +222 -0
- package/src/ui/components/UnreadIcon/UnreadIcon.spec.tsx +878 -0
- package/src/ui/components/UnreadIcon/UnreadIcon.tsx +234 -0
- package/src/ui/components/index.ts +22 -0
- package/{dist/models/MessagingPropositionItem.js → src/ui/hooks/index.ts} +5 -4
- package/src/ui/hooks/useAspectRatio.spec.tsx +66 -0
- package/src/ui/hooks/useAspectRatio.tsx +39 -0
- package/src/ui/hooks/useContentCardUI.spec.tsx +82 -0
- package/src/ui/hooks/useContentCardUI.ts +48 -0
- package/src/ui/hooks/useInbox.spec.tsx +87 -0
- package/src/ui/hooks/useInbox.ts +46 -0
- package/src/ui/hooks/useInboxSettings.spec.tsx +41 -0
- package/src/ui/hooks/useInboxSettings.ts +24 -0
- package/src/ui/index.ts +7 -0
- package/src/ui/providers/InboxProvider.tsx +79 -0
- package/src/ui/theme/Theme.ts +57 -0
- package/src/ui/theme/ThemeProvider.tsx +120 -0
- package/src/ui/theme/index.ts +14 -0
- package/src/ui/types/ContentViewEvent.ts +20 -0
- package/src/ui/types/Templates.ts +77 -0
- package/src/ui/types/index.ts +14 -0
- package/src/ui/utils/generateCardHash.spec.tsx +86 -0
- package/src/ui/utils/generateCardHash.ts +59 -0
- package/src/ui/utils/inboxStorage.spec.tsx +136 -0
- package/src/ui/utils/inboxStorage.ts +64 -0
- package/src/ui/utils/index.ts +3 -0
- package/tutorials/ContentCardCustomizationGuide.md +661 -0
- package/tutorials/ContentCards.md +419 -0
- package/tutorials/In-App Messaging.md +31 -0
- package/tutorials/Inbox.md +515 -0
- package/tutorials/resources/image-only-template.png +0 -0
- package/tutorials/resources/large-image-template.png +0 -0
- package/tutorials/resources/small-image-template.png +0 -0
- package/dist/Messaging.js +0 -151
- package/dist/Messaging.js.map +0 -1
- package/dist/index.js +0 -34
- package/dist/index.js.map +0 -1
- package/dist/models/ContentCard.d.ts +0 -51
- package/dist/models/ContentCard.js.map +0 -1
- package/dist/models/HTMLProposition.js.map +0 -1
- package/dist/models/InAppMessage.js.map +0 -1
- package/dist/models/JSONProposition.js.map +0 -1
- package/dist/models/Message.js +0 -114
- package/dist/models/Message.js.map +0 -1
- package/dist/models/MessagingDelegate.js +0 -14
- package/dist/models/MessagingDelegate.js.map +0 -1
- package/dist/models/MessagingEdgeEventType.js +0 -24
- package/dist/models/MessagingEdgeEventType.js.map +0 -1
- package/dist/models/MessagingProposition.js +0 -59
- package/dist/models/MessagingProposition.js.map +0 -1
- package/dist/models/MessagingPropositionItem.js.map +0 -1
- package/dist/models/PersonalizationSchema.js +0 -25
- package/dist/models/PersonalizationSchema.js.map +0 -1
- package/dist/models/PropositionItem.js +0 -78
- package/dist/models/PropositionItem.js.map +0 -1
- package/dist/models/ScopeDetails.js.map +0 -1
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
Copyright 2023 Adobe. All rights reserved.
|
|
5
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
7
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
10
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
11
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
12
|
+
governing permissions and limitations under the License.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { NativeEventEmitter, NativeModules, Platform } from 'react-native';
|
|
16
|
+
const RCTAEPMessaging = NativeModules.AEPMessaging;
|
|
17
|
+
|
|
18
|
+
// Registery to store inAppMessage callbacks for each message in Message.handleJavascriptMessage
|
|
19
|
+
// Record - {messageId : {handlerName : callback}}
|
|
20
|
+
const jsMessageHandlers = {};
|
|
21
|
+
|
|
22
|
+
// Registery to store inAppMessage result callbacks for each message in Message.evaluateJavascript
|
|
23
|
+
// Record - {messageId : {javascriptString : callback}}
|
|
24
|
+
const jsResultHandlers = {};
|
|
25
|
+
const handleJSMessageEventEmitter = new NativeEventEmitter(RCTAEPMessaging);
|
|
26
|
+
|
|
27
|
+
// invokes the callback registered in Message.handleJavascriptMessage with the content received from the inAppMessage webview
|
|
28
|
+
handleJSMessageEventEmitter.addListener('onJavascriptMessage', event => {
|
|
29
|
+
const {
|
|
30
|
+
messageId,
|
|
31
|
+
handlerName,
|
|
32
|
+
content
|
|
33
|
+
} = event;
|
|
34
|
+
if (jsMessageHandlers[messageId] && jsMessageHandlers[messageId][handlerName]) {
|
|
35
|
+
jsMessageHandlers[messageId][handlerName](content);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
handleJSMessageEventEmitter.addListener('onJavascriptResult', event => {
|
|
39
|
+
const {
|
|
40
|
+
messageId,
|
|
41
|
+
javascriptString,
|
|
42
|
+
result
|
|
43
|
+
} = event;
|
|
44
|
+
if (jsResultHandlers[messageId] && jsResultHandlers[messageId][javascriptString]) {
|
|
45
|
+
// Convert result to string to maintain API parity
|
|
46
|
+
const resultString = result == null ? '' : String(result);
|
|
47
|
+
jsResultHandlers[messageId][javascriptString](resultString);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
class Message {
|
|
51
|
+
constructor({
|
|
52
|
+
id,
|
|
53
|
+
autoTrack = false
|
|
54
|
+
}) {
|
|
55
|
+
this.id = id;
|
|
56
|
+
this.autoTrack = autoTrack;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Update the value of property "autoTrack"
|
|
61
|
+
* This function works only for the Message objects that were saved by calling "Messaging.saveMessage"
|
|
62
|
+
* @param {boolean} autoTrack: New value of property autoTrack.
|
|
63
|
+
*/
|
|
64
|
+
setAutoTrack(autoTrack) {
|
|
65
|
+
this.autoTrack = autoTrack;
|
|
66
|
+
RCTAEPMessaging.setAutoTrack(this.id, autoTrack);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Signals to the UIServices that the message should be shown.
|
|
71
|
+
* If autoTrack is true, calling this method will result in an "inapp.display" Edge Event being dispatched.
|
|
72
|
+
*/
|
|
73
|
+
show() {
|
|
74
|
+
RCTAEPMessaging.show(this.id);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Signals to the UIServices that the message should be dismissed.
|
|
79
|
+
* If `autoTrack` is true, calling this method will result in an "inapp.dismiss" Edge Event being dispatched.
|
|
80
|
+
* @param {boolean?} suppressAutoTrack: if set to true, the inapp.dismiss Edge Event will not be sent regardless
|
|
81
|
+
* of the autoTrack setting.
|
|
82
|
+
*/
|
|
83
|
+
dismiss(suppressAutoTrack) {
|
|
84
|
+
// iOS message.dismiss() accepts a boolean parameter to suppress autoTrack
|
|
85
|
+
// but on android side, message.dismiss() does not accept any parameters
|
|
86
|
+
if (Platform.OS === 'android') {
|
|
87
|
+
RCTAEPMessaging.dismiss(this.id);
|
|
88
|
+
}
|
|
89
|
+
if (Platform.OS === 'ios') {
|
|
90
|
+
RCTAEPMessaging.dismiss(this.id, suppressAutoTrack ? true : false);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Generates an Edge Event for the provided interaction and eventType.
|
|
96
|
+
* @param {string?} interaction: a custom String value to be recorded in the interaction
|
|
97
|
+
* @param {MessagingEdgeEventType} eventType: the MessagingEdgeEventType to be used for the ensuing Edge Event
|
|
98
|
+
*/
|
|
99
|
+
track(interaction, eventType) {
|
|
100
|
+
RCTAEPMessaging.track(this.id, interaction, eventType);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Clears the cached reference to the Message object.
|
|
105
|
+
* This function must be called if Message was saved by calling "MessagingDelegate.shouldSaveMessage" but no longer needed.
|
|
106
|
+
* Failure to call this function leads to memory leaks.
|
|
107
|
+
*/
|
|
108
|
+
clear() {
|
|
109
|
+
RCTAEPMessaging.clear(this.id);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Adds a handler for named JavaScript messages sent from the message's WebView.
|
|
114
|
+
* The parameter passed to handler will contain the body of the message passed from the WebView's JavaScript.
|
|
115
|
+
* @param {string} handlerName: The name of the message that should be handled by the handler
|
|
116
|
+
* @param {function} handler: The method or closure to be called with the body of the message created in the Message's JavaScript
|
|
117
|
+
*/
|
|
118
|
+
handleJavascriptMessage(handlerName, handler) {
|
|
119
|
+
// Validate parameters
|
|
120
|
+
if (!handlerName) {
|
|
121
|
+
console.warn('[AEP Messaging] handleJavascriptMessage: handlerName is required');
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
if (typeof handler !== 'function') {
|
|
125
|
+
console.warn('[AEP Messaging] handleJavascriptMessage: handler must be a function');
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// cache the callback
|
|
130
|
+
if (!jsMessageHandlers[this.id]) {
|
|
131
|
+
jsMessageHandlers[this.id] = {};
|
|
132
|
+
}
|
|
133
|
+
jsMessageHandlers[this.id][handlerName] = handler;
|
|
134
|
+
RCTAEPMessaging.handleJavascriptMessage(this.id, handlerName);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Asynchronously evaluates the specified JavaScript string in the context of the message's WebView.
|
|
139
|
+
* @param {string} javascriptString: The JavaScript string to evaluate.
|
|
140
|
+
* @param {function} callback: A callback to be invoked when the script execution completes with the result of the execution.
|
|
141
|
+
*/
|
|
142
|
+
evaluateJavascript(javascriptString, callback) {
|
|
143
|
+
// validate parameters
|
|
144
|
+
if (!javascriptString) {
|
|
145
|
+
console.warn('[AEP Messaging] evaluateJavascript: javascriptString is required');
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
if (typeof callback !== 'function') {
|
|
149
|
+
console.warn('[AEP Messaging] evaluateJavascript: callback must be a function');
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// cache the callback
|
|
154
|
+
if (!jsResultHandlers[this.id]) {
|
|
155
|
+
jsResultHandlers[this.id] = {};
|
|
156
|
+
}
|
|
157
|
+
jsResultHandlers[this.id][javascriptString] = callback;
|
|
158
|
+
RCTAEPMessaging.evaluateJavascript(this.id, javascriptString);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* @internal - For internal use only.
|
|
163
|
+
* Clears all the javascript message handlers for the message.
|
|
164
|
+
* This function must be called if the callbacks registered in handleJavascriptMessage are no longer needed.
|
|
165
|
+
* Failure to call this function may lead to memory leaks.
|
|
166
|
+
*/
|
|
167
|
+
_clearJavascriptMessageHandlers() {
|
|
168
|
+
delete jsMessageHandlers[this.id];
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* @internal - For internal use only.
|
|
173
|
+
* Clears all the javascript result handlers for the message.
|
|
174
|
+
* This function must be called if the callbacks registered in evaluateJavascript are no longer needed.
|
|
175
|
+
* Failure to call this function may lead to memory leaks.
|
|
176
|
+
*/
|
|
177
|
+
_clearJavascriptResultHandlers() {
|
|
178
|
+
delete jsResultHandlers[this.id];
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
export default Message;
|
|
182
|
+
//# sourceMappingURL=Message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativeEventEmitter","NativeModules","Platform","RCTAEPMessaging","AEPMessaging","jsMessageHandlers","jsResultHandlers","handleJSMessageEventEmitter","addListener","event","messageId","handlerName","content","javascriptString","result","resultString","String","Message","constructor","id","autoTrack","setAutoTrack","show","dismiss","suppressAutoTrack","OS","track","interaction","eventType","clear","handleJavascriptMessage","handler","console","warn","evaluateJavascript","callback","_clearJavascriptMessageHandlers","_clearJavascriptResultHandlers"],"sourceRoot":"../../../src","sources":["models/Message.ts"],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["models/MessagingDelegate.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
Copyright 2023 Adobe. All rights reserved.
|
|
5
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
7
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
10
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
11
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
12
|
+
governing permissions and limitations under the License.
|
|
13
|
+
*/
|
|
14
|
+
var MessagingEdgeEventType = /*#__PURE__*/function (MessagingEdgeEventType) {
|
|
15
|
+
MessagingEdgeEventType[MessagingEdgeEventType["DISMISS"] = 0] = "DISMISS";
|
|
16
|
+
MessagingEdgeEventType[MessagingEdgeEventType["INTERACT"] = 1] = "INTERACT";
|
|
17
|
+
MessagingEdgeEventType[MessagingEdgeEventType["TRIGGER"] = 2] = "TRIGGER";
|
|
18
|
+
MessagingEdgeEventType[MessagingEdgeEventType["DISPLAY"] = 3] = "DISPLAY";
|
|
19
|
+
MessagingEdgeEventType[MessagingEdgeEventType["PUSH_APPLICATION_OPENED"] = 4] = "PUSH_APPLICATION_OPENED";
|
|
20
|
+
MessagingEdgeEventType[MessagingEdgeEventType["PUSH_CUSTOM_ACTION"] = 5] = "PUSH_CUSTOM_ACTION";
|
|
21
|
+
return MessagingEdgeEventType;
|
|
22
|
+
}(MessagingEdgeEventType || {});
|
|
23
|
+
export default MessagingEdgeEventType;
|
|
24
|
+
//# sourceMappingURL=MessagingEdgeEventType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MessagingEdgeEventType"],"sourceRoot":"../../../src","sources":["models/MessagingEdgeEventType.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAVA,IAYKA,sBAAsB,0BAAtBA,sBAAsB;EAAtBA,sBAAsB,CAAtBA,sBAAsB;EAAtBA,sBAAsB,CAAtBA,sBAAsB;EAAtBA,sBAAsB,CAAtBA,sBAAsB;EAAtBA,sBAAsB,CAAtBA,sBAAsB;EAAtBA,sBAAsB,CAAtBA,sBAAsB;EAAtBA,sBAAsB,CAAtBA,sBAAsB;EAAA,OAAtBA,sBAAsB;AAAA,EAAtBA,sBAAsB;AAS3B,eAAeA,sBAAsB","ignoreList":[]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
Copyright 2024 Adobe. All rights reserved.
|
|
5
|
+
This file is licensed to you under the Apache License, Version 2.0 (the
|
|
6
|
+
"License"); you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
|
|
9
|
+
or agreed to in writing, software distributed under the License is
|
|
10
|
+
distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF
|
|
11
|
+
ANY KIND, either express or implied. See the License for the specific
|
|
12
|
+
language governing permissions and limitations under the License.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { PersonalizationSchema } from "./PersonalizationSchema.js";
|
|
16
|
+
import { ContentCard } from "./ContentCard.js";
|
|
17
|
+
import { HTMLProposition } from "./HTMLProposition.js";
|
|
18
|
+
import { JSONPropositionItem } from "./JSONProposition.js";
|
|
19
|
+
import { PropositionItem } from "./PropositionItem.js";
|
|
20
|
+
export class MessageProposition {
|
|
21
|
+
constructor(raw) {
|
|
22
|
+
this.id = raw?.id ?? '';
|
|
23
|
+
this.scope = raw?.scope ?? '';
|
|
24
|
+
this.scopeDetails = raw?.scopeDetails ?? {};
|
|
25
|
+
|
|
26
|
+
// Mirror activity.id into activity.activityID for convenience
|
|
27
|
+
const activityIdFromScope = this.scopeDetails?.activity?.id ?? '';
|
|
28
|
+
if (this.scopeDetails?.activity) {
|
|
29
|
+
this.scopeDetails.activity.activityID = activityIdFromScope;
|
|
30
|
+
}
|
|
31
|
+
const rawItems = Array.isArray(raw?.items) ? raw.items : [];
|
|
32
|
+
this.items = rawItems.map(itemData => {
|
|
33
|
+
const activityId = this.scopeDetails?.activity?.id ?? '';
|
|
34
|
+
let instance;
|
|
35
|
+
switch (itemData?.schema) {
|
|
36
|
+
case PersonalizationSchema.CONTENT_CARD:
|
|
37
|
+
instance = new ContentCard(itemData);
|
|
38
|
+
instance.activityID = activityId;
|
|
39
|
+
return instance;
|
|
40
|
+
case PersonalizationSchema.HTML_CONTENT:
|
|
41
|
+
instance = new HTMLProposition(itemData);
|
|
42
|
+
instance.activityID = activityId;
|
|
43
|
+
return instance;
|
|
44
|
+
case PersonalizationSchema.JSON_CONTENT:
|
|
45
|
+
instance = new JSONPropositionItem(itemData);
|
|
46
|
+
instance.activityID = activityId;
|
|
47
|
+
return instance;
|
|
48
|
+
default:
|
|
49
|
+
instance = new PropositionItem(itemData);
|
|
50
|
+
instance.activityID = activityId;
|
|
51
|
+
return instance;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
export { MessageProposition as MessagingProposition };
|
|
57
|
+
//# sourceMappingURL=MessagingProposition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["PersonalizationSchema","ContentCard","HTMLProposition","JSONPropositionItem","PropositionItem","MessageProposition","constructor","raw","id","scope","scopeDetails","activityIdFromScope","activity","activityID","rawItems","Array","isArray","items","map","itemData","activityId","instance","schema","CONTENT_CARD","HTML_CONTENT","JSON_CONTENT","MessagingProposition"],"sourceRoot":"../../../src","sources":["models/MessagingProposition.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,qBAAqB,QAAQ,4BAAyB;AAC/D,SAASC,WAAW,QAAQ,kBAAe;AAC3C,SAASC,eAAe,QAAQ,sBAAmB;AACnD,SAASC,mBAAmB,QAAQ,sBAAmB;AACvD,SAASC,eAAe,QAAQ,sBAAmB;AAEnD,OAAO,MAAMC,kBAAkB,CAAC;EAM9BC,WAAWA,CAACC,GAA6E,EAAE;IACzF,IAAI,CAACC,EAAE,GAAGD,GAAG,EAAEC,EAAE,IAAI,EAAE;IACvB,IAAI,CAACC,KAAK,GAAGF,GAAG,EAAEE,KAAK,IAAI,EAAE;IAC7B,IAAI,CAACC,YAAY,GAAIH,GAAG,EAAEG,YAAY,IAAsB,CAAC,CAAkB;;IAE/E;IACA,MAAMC,mBAAmB,GAAG,IAAI,CAACD,YAAY,EAAEE,QAAQ,EAAEJ,EAAE,IAAI,EAAE;IACjE,IAAI,IAAI,CAACE,YAAY,EAAEE,QAAQ,EAAE;MAC9B,IAAI,CAACF,YAAY,CAACE,QAAQ,CAASC,UAAU,GAAGF,mBAAmB;IACtE;IAEA,MAAMG,QAAQ,GAAGC,KAAK,CAACC,OAAO,CAACT,GAAG,EAAEU,KAAK,CAAC,GAAGV,GAAG,CAACU,KAAK,GAAG,EAAE;IAC3D,IAAI,CAACA,KAAK,GAAGH,QAAQ,CAACI,GAAG,CAAEC,QAAa,IAAK;MAC3C,MAAMC,UAAU,GAAG,IAAI,CAACV,YAAY,EAAEE,QAAQ,EAAEJ,EAAE,IAAI,EAAE;MACxD,IAAIa,QAAa;MACjB,QAAQF,QAAQ,EAAEG,MAAM;QACtB,KAAKtB,qBAAqB,CAACuB,YAAY;UACrCF,QAAQ,GAAG,IAAIpB,WAAW,CAACkB,QAAe,CAAC;UAC1CE,QAAQ,CAASR,UAAU,GAAGO,UAAU;UACzC,OAAOC,QAAQ;QACjB,KAAKrB,qBAAqB,CAACwB,YAAY;UACrCH,QAAQ,GAAG,IAAInB,eAAe,CAACiB,QAAe,CAAC;UAC9CE,QAAQ,CAASR,UAAU,GAAGO,UAAU;UACzC,OAAOC,QAAQ;QACjB,KAAKrB,qBAAqB,CAACyB,YAAY;UACrCJ,QAAQ,GAAG,IAAIlB,mBAAmB,CAACgB,QAAe,CAAC;UAClDE,QAAQ,CAASR,UAAU,GAAGO,UAAU;UACzC,OAAOC,QAAQ;QACjB;UACEA,QAAQ,GAAG,IAAIjB,eAAe,CAACe,QAAe,CAAC;UAC9CE,QAAQ,CAASR,UAAU,GAAGO,UAAU;UACzC,OAAOC,QAAQ;MACnB;IACF,CAAC,CAAC;EACJ;AACF;AAEA,SAAShB,kBAAkB,IAAIqB,oBAAoB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["models/MessagingPropositionItem.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
Copyright 2024 Adobe. All rights reserved.
|
|
5
|
+
This file is licensed to you under the Apache License, Version 2.0 (the
|
|
6
|
+
"License"); you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
|
|
9
|
+
or agreed to in writing, software distributed under the License is
|
|
10
|
+
distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF
|
|
11
|
+
ANY KIND, either express or implied. See the License for the specific
|
|
12
|
+
language governing permissions and limitations under the License.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
export let PersonalizationSchema = /*#__PURE__*/function (PersonalizationSchema) {
|
|
16
|
+
PersonalizationSchema["CONTENT_CARD"] = "https://ns.adobe.com/personalization/message/content-card";
|
|
17
|
+
PersonalizationSchema["DEFAULT_CONTENT"] = "https://ns.adobe.com/personalization/default-content-item";
|
|
18
|
+
PersonalizationSchema["HTML_CONTENT"] = "https://ns.adobe.com/personalization/html-content-item";
|
|
19
|
+
PersonalizationSchema["IN_APP"] = "https://ns.adobe.com/personalization/message/in-app";
|
|
20
|
+
PersonalizationSchema["INBOX"] = "https://ns.adobe.com/personalization/message/inbox";
|
|
21
|
+
PersonalizationSchema["JSON_CONTENT"] = "https://ns.adobe.com/personalization/json-content-item";
|
|
22
|
+
PersonalizationSchema["NATIVE_ALERT"] = "https://ns.adobe.com/personalization/message/native-alert";
|
|
23
|
+
PersonalizationSchema["RULESET_ITEM"] = "https://ns.adobe.com/personalization/ruleset-item";
|
|
24
|
+
return PersonalizationSchema;
|
|
25
|
+
}({});
|
|
26
|
+
//# sourceMappingURL=PersonalizationSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["PersonalizationSchema"],"sourceRoot":"../../../src","sources":["models/PersonalizationSchema.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,WAAYA,qBAAqB,0BAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAAA,OAArBA,qBAAqB;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
Copyright 2025 Adobe. All rights reserved.
|
|
5
|
+
This file is licensed to you under the Apache License, Version 2.0 (the
|
|
6
|
+
"License"); you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
|
|
9
|
+
or agreed to in writing, software distributed under the License is
|
|
10
|
+
distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF
|
|
11
|
+
ANY KIND, either express or implied. See the License for the specific
|
|
12
|
+
language governing permissions and limitations under the License.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { NativeModules } from 'react-native';
|
|
16
|
+
const RCTAEPMessaging = NativeModules.AEPMessaging;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Base PropositionItem interface that all proposition items implement
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* A PropositionItem represents a personalization JSON object returned by Konductor.
|
|
24
|
+
* This is the base class that provides tracking functionality for all proposition items
|
|
25
|
+
* including ContentCards, InApp messages, and code-based experiences.
|
|
26
|
+
*
|
|
27
|
+
* This mirrors the native Android PropositionItem class functionality.
|
|
28
|
+
*/
|
|
29
|
+
export class PropositionItem {
|
|
30
|
+
constructor(propositionItemData) {
|
|
31
|
+
this.id = propositionItemData.id;
|
|
32
|
+
this.schema = propositionItemData.schema;
|
|
33
|
+
this.data = propositionItemData.data;
|
|
34
|
+
this.uuid = propositionItemData.uuid;
|
|
35
|
+
this.activityID = propositionItemData.activityID;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Gets the PropositionItem identifier.
|
|
40
|
+
*
|
|
41
|
+
* @returns {string} The PropositionItem identifier
|
|
42
|
+
*/
|
|
43
|
+
getItemId() {
|
|
44
|
+
return this.id;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Gets the PropositionItem content schema.
|
|
49
|
+
*
|
|
50
|
+
* @returns {PersonalizationSchema} The PropositionItem content schema
|
|
51
|
+
*/
|
|
52
|
+
getSchema() {
|
|
53
|
+
return this.schema;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Gets the PropositionItem data.
|
|
58
|
+
*
|
|
59
|
+
* @returns {object} The PropositionItem data
|
|
60
|
+
*/
|
|
61
|
+
getItemData() {
|
|
62
|
+
return this.data;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Tracks interaction with this proposition item.
|
|
67
|
+
* This is the core tracking method that all proposition items use.
|
|
68
|
+
*
|
|
69
|
+
* @param {MessagingEdgeEventType} eventType - The MessagingEdgeEventType specifying event type for the interaction
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* propositionItem.track(MessagingEdgeEventType.DISPLAY);
|
|
73
|
+
*/
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Tracks interaction with this proposition item.
|
|
77
|
+
*
|
|
78
|
+
* @param {string | null} interaction - String describing the interaction
|
|
79
|
+
* @param {MessagingEdgeEventType} eventType - The MessagingEdgeEventType specifying event type for the interaction
|
|
80
|
+
* @param {string[] | null} tokens - Array containing the sub-item tokens for recording interaction
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* // Track display
|
|
84
|
+
* propositionItem.track(null, MessagingEdgeEventType.DISPLAY, null);
|
|
85
|
+
*
|
|
86
|
+
* // Track interaction
|
|
87
|
+
* propositionItem.track("button_clicked", MessagingEdgeEventType.INTERACT, null);
|
|
88
|
+
*
|
|
89
|
+
* // Track with tokens
|
|
90
|
+
* propositionItem.track("click", MessagingEdgeEventType.INTERACT, ["token1", "token2"]);
|
|
91
|
+
*/
|
|
92
|
+
|
|
93
|
+
// Implementation
|
|
94
|
+
track(interactionOrEventType, eventType, tokens) {
|
|
95
|
+
// Handle overloaded method signatures
|
|
96
|
+
if (typeof interactionOrEventType === 'number' && eventType === undefined) {
|
|
97
|
+
// First overload: track(eventType)
|
|
98
|
+
this.trackWithDetails(null, interactionOrEventType, null);
|
|
99
|
+
} else if (typeof interactionOrEventType === 'string' || interactionOrEventType === null) {
|
|
100
|
+
// Second overload: track(interaction, eventType, tokens)
|
|
101
|
+
this.trackWithDetails(interactionOrEventType, eventType, tokens || null);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Internal method that performs the actual tracking
|
|
107
|
+
*/
|
|
108
|
+
trackWithDetails(interaction, eventType, tokens) {
|
|
109
|
+
const nativeIdentifier = this.activityID ?? null;
|
|
110
|
+
RCTAEPMessaging.trackPropositionItem(nativeIdentifier, interaction, eventType, tokens);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=PropositionItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativeModules","RCTAEPMessaging","AEPMessaging","PropositionItem","constructor","propositionItemData","id","schema","data","uuid","activityID","getItemId","getSchema","getItemData","track","interactionOrEventType","eventType","tokens","undefined","trackWithDetails","interaction","nativeIdentifier","trackPropositionItem"],"sourceRoot":"../../../src","sources":["models/PropositionItem.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,aAAa,QAAQ,cAAc;AAI5C,MAAMC,eAAe,GAAGD,aAAa,CAACE,YAAY;;AAElD;AACA;AACA;;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,eAAe,CAAC;EAO3BC,WAAWA,CAACC,mBAAwC,EAAE;IACpD,IAAI,CAACC,EAAE,GAAGD,mBAAmB,CAACC,EAAE;IAChC,IAAI,CAACC,MAAM,GAAGF,mBAAmB,CAACE,MAAM;IACxC,IAAI,CAACC,IAAI,GAAGH,mBAAmB,CAACG,IAAI;IACpC,IAAI,CAACC,IAAI,GAAGJ,mBAAmB,CAACI,IAAI;IACpC,IAAI,CAACC,UAAU,GAAGL,mBAAmB,CAACK,UAAU;EAClD;;EAEA;AACF;AACA;AACA;AACA;EACEC,SAASA,CAAA,EAAW;IAClB,OAAO,IAAI,CAACL,EAAE;EAChB;;EAEA;AACF;AACA;AACA;AACA;EACEM,SAASA,CAAA,EAA0B;IACjC,OAAO,IAAI,CAACL,MAAM;EACpB;;EAEA;AACF;AACA;AACA;AACA;EACEM,WAAWA,CAAA,EAA2B;IACpC,OAAO,IAAI,CAACL,IAAI;EAClB;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EAGE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EAGE;EACAM,KAAKA,CACHC,sBAA8D,EAC9DC,SAAkC,EAClCC,MAAwB,EAClB;IACN;IACA,IAAI,OAAOF,sBAAsB,KAAK,QAAQ,IAAIC,SAAS,KAAKE,SAAS,EAAE;MACzE;MACA,IAAI,CAACC,gBAAgB,CAAC,IAAI,EAAEJ,sBAAsB,EAAE,IAAI,CAAC;IAC3D,CAAC,MAAM,IAAI,OAAOA,sBAAsB,KAAK,QAAQ,IAAIA,sBAAsB,KAAK,IAAI,EAAE;MACxF;MACA,IAAI,CAACI,gBAAgB,CAACJ,sBAAsB,EAAEC,SAAS,EAAGC,MAAM,IAAI,IAAI,CAAC;IAC3E;EACF;;EAEA;AACF;AACA;EACUE,gBAAgBA,CAACC,WAA0B,EAAEJ,SAAiC,EAAEC,MAAuB,EAAQ;IACrH,MAAMI,gBAAgB,GAAG,IAAI,CAACX,UAAU,IAAI,IAAI;IAChDT,eAAe,CAACqB,oBAAoB,CAACD,gBAAgB,EAAED,WAAW,EAAEJ,SAAS,EAAEC,MAAM,CAAC;EACxF;AAEF","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["models/ScopeDetails.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
|
|
2
3
|
/*
|
|
3
|
-
Copyright
|
|
4
|
+
Copyright 2026 Adobe. All rights reserved.
|
|
4
5
|
This file is licensed to you under the Apache License, Version 2.0 (the
|
|
5
6
|
"License"); you may not use this file except in compliance with the License.
|
|
6
7
|
You may obtain a copy of the License at
|
|
@@ -10,14 +11,15 @@
|
|
|
10
11
|
ANY KIND, either express or implied. See the License for the specific
|
|
11
12
|
language governing permissions and limitations under the License.
|
|
12
13
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
|
|
15
|
+
export * from "./ContentCard.js";
|
|
16
|
+
export * from "./InAppMessage.js";
|
|
17
|
+
export * from "./JSONProposition.js";
|
|
18
|
+
export * from "./Message.js";
|
|
19
|
+
export * from "./MessagingDelegate.js";
|
|
20
|
+
export * from "./MessagingEdgeEventType.js";
|
|
21
|
+
export * from "./MessagingProposition.js";
|
|
22
|
+
export * from "./MessagingPropositionItem.js";
|
|
23
|
+
export * from "./PersonalizationSchema.js";
|
|
24
|
+
export * from "./ScopeDetails.js";
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["models/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc,kBAAe;AAC7B,cAAc,mBAAgB;AAC9B,cAAc,sBAAmB;AACjC,cAAc,cAAW;AACzB,cAAc,wBAAqB;AACnC,cAAc,6BAA0B;AACxC,cAAc,2BAAwB;AACtC,cAAc,+BAA4B;AAC1C,cAAc,4BAAyB;AACvC,cAAc,mBAAgB","ignoreList":[]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
4
|
+
/*
|
|
5
|
+
Copyright 2026 Adobe. All rights reserved.
|
|
6
|
+
This file is licensed to you under the Apache License, Version 2.0 (the
|
|
7
|
+
"License"); you may not use this file except in compliance with the License.
|
|
8
|
+
You may obtain a copy of the License at
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
|
|
10
|
+
or agreed to in writing, software distributed under the License is
|
|
11
|
+
distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF
|
|
12
|
+
ANY KIND, either express or implied. See the License for the specific
|
|
13
|
+
language governing permissions and limitations under the License.
|
|
14
|
+
*/
|
|
15
|
+
import React, { useCallback } from 'react';
|
|
16
|
+
import { Linking, Pressable, Text } from 'react-native';
|
|
17
|
+
import { useTheme } from "../../theme/ThemeProvider.js";
|
|
18
|
+
const Button = ({
|
|
19
|
+
actionUrl,
|
|
20
|
+
title,
|
|
21
|
+
onPress,
|
|
22
|
+
interactId,
|
|
23
|
+
textStyle,
|
|
24
|
+
style,
|
|
25
|
+
accessibilityRole = 'button',
|
|
26
|
+
...props
|
|
27
|
+
}) => {
|
|
28
|
+
const {
|
|
29
|
+
colors
|
|
30
|
+
} = useTheme();
|
|
31
|
+
const handlePress = useCallback(async event => {
|
|
32
|
+
onPress?.(interactId, event);
|
|
33
|
+
if (actionUrl) {
|
|
34
|
+
try {
|
|
35
|
+
const supported = await Linking.canOpenURL(actionUrl);
|
|
36
|
+
if (supported) {
|
|
37
|
+
await Linking.openURL(actionUrl);
|
|
38
|
+
} else {
|
|
39
|
+
console.warn(`Cannot open URL: ${actionUrl}`);
|
|
40
|
+
}
|
|
41
|
+
} catch (error) {
|
|
42
|
+
console.warn(`Failed to open URL: ${actionUrl}`, error);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}, [actionUrl, interactId, onPress]);
|
|
46
|
+
return /*#__PURE__*/React.createElement(Pressable, _extends({
|
|
47
|
+
accessibilityRole: accessibilityRole,
|
|
48
|
+
onPress: handlePress,
|
|
49
|
+
style: style
|
|
50
|
+
}, props), /*#__PURE__*/React.createElement(Text, {
|
|
51
|
+
style: [{
|
|
52
|
+
color: colors?.buttonTextColor
|
|
53
|
+
}, textStyle]
|
|
54
|
+
}, title));
|
|
55
|
+
};
|
|
56
|
+
export default Button;
|
|
57
|
+
//# sourceMappingURL=Button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useCallback","Linking","Pressable","Text","useTheme","Button","actionUrl","title","onPress","interactId","textStyle","style","accessibilityRole","props","colors","handlePress","event","supported","canOpenURL","openURL","console","warn","error","createElement","_extends","color","buttonTextColor"],"sourceRoot":"../../../../../src","sources":["ui/components/Button/Button.tsx"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,KAAK,IAAIC,WAAW,QAAQ,OAAO;AAC1C,SAGEC,OAAO,EACPC,SAAS,EAGTC,IAAI,QAEC,cAAc;AACrB,SAASC,QAAQ,QAAQ,8BAA2B;AAYpD,MAAMC,MAA6B,GAAGA,CAAC;EACrCC,SAAS;EACTC,KAAK;EACLC,OAAO;EACPC,UAAU;EACVC,SAAS;EACTC,KAAK;EACLC,iBAAiB,GAAG,QAAQ;EAC5B,GAAGC;AACL,CAAC,KAAK;EACJ,MAAM;IAAEC;EAAO,CAAC,GAAGV,QAAQ,CAAC,CAAC;EAC7B,MAAMW,WAAW,GAAGf,WAAW,CAAC,MAAOgB,KAA4B,IAAK;IACtER,OAAO,GAAGC,UAAU,EAAEO,KAAK,CAAC;IAC5B,IAAIV,SAAS,EAAE;MACb,IAAI;QACF,MAAMW,SAAS,GAAG,MAAMhB,OAAO,CAACiB,UAAU,CAACZ,SAAS,CAAC;QACrD,IAAIW,SAAS,EAAE;UACb,MAAMhB,OAAO,CAACkB,OAAO,CAACb,SAAS,CAAC;QAClC,CAAC,MAAM;UACLc,OAAO,CAACC,IAAI,CAAC,oBAAoBf,SAAS,EAAE,CAAC;QAC/C;MACF,CAAC,CAAC,OAAOgB,KAAK,EAAE;QACdF,OAAO,CAACC,IAAI,CAAC,uBAAuBf,SAAS,EAAE,EAAEgB,KAAK,CAAC;MACzD;IACF;EACF,CAAC,EAAE,CAAChB,SAAS,EAAEG,UAAU,EAAED,OAAO,CAAC,CAAC;EAEpC,oBACET,KAAA,CAAAwB,aAAA,CAACrB,SAAS,EAAAsB,QAAA;IACRZ,iBAAiB,EAAEA,iBAAkB;IACrCJ,OAAO,EAAEO,WAAY;IACrBJ,KAAK,EAAEA;EAAM,GACTE,KAAK,gBAETd,KAAA,CAAAwB,aAAA,CAACpB,IAAI;IAACQ,KAAK,EAAE,CAAC;MAAEc,KAAK,EAAEX,MAAM,EAAEY;IAAgB,CAAC,EAAEhB,SAAS;EAAE,GAC1DH,KACG,CACG,CAAC;AAEhB,CAAC;AAED,eAAeF,MAAM","ignoreList":[]}
|