From 3b548a889b74af76575d29332f1fb16f9ae4c43a Mon Sep 17 00:00:00 2001 From: Calise Cheung Date: Thu, 2 Oct 2025 11:01:00 -0700 Subject: [PATCH 01/15] Add unread UI implementation Add unread UI implementation --- .../app/ContentCardsView.tsx | 149 ++++++++++++++--- packages/messaging/src/Messaging.ts | 10 +- .../ContentCardView/ContentCardView.tsx | 59 ++++++- .../ui/components/UnreadIcon/UnreadIcon.tsx | 154 +++++++++++++++++- packages/messaging/src/ui/index.ts | 4 +- yarn.lock | 2 +- 6 files changed, 339 insertions(+), 39 deletions(-) diff --git a/apps/AEPSampleAppNewArchEnabled/app/ContentCardsView.tsx b/apps/AEPSampleAppNewArchEnabled/app/ContentCardsView.tsx index 96d7308c..3aec7be1 100644 --- a/apps/AEPSampleAppNewArchEnabled/app/ContentCardsView.tsx +++ b/apps/AEPSampleAppNewArchEnabled/app/ContentCardsView.tsx @@ -14,9 +14,12 @@ import { MobileCore } from '@adobe/react-native-aepcore'; import { ContentCardView, ThemeProvider, - useContentCardUI + useContentCardUI, + Messaging, + ContentCardContainerProvider } from '@adobe/react-native-aepmessaging'; import React, { memo, useCallback, useEffect, useState } from 'react'; + import { Appearance, ColorSchemeName, @@ -255,6 +258,7 @@ const MemoHeader = memo(Header); const ContentCardsView = () => { const [selectedView, setSelectedView] = useState('Remote'); const [trackInput, setTrackInput] = useState(''); + const [containerSettings, setContainerSettings] = useState(null); const colorScheme = useColorScheme(); const surface = @@ -263,6 +267,25 @@ const ContentCardsView = () => { : 'rn/ios/remote_image'; const { content, isLoading, refetch } = useContentCardUI(surface); + // Load container settings for unread icon configuration + useEffect(() => { + const loadContainerSettings = async () => { + try { + const settings = await Messaging.getContentCardContainer(surface); + setContainerSettings(settings); + // Debug logging + // console.log('Container settings loaded:', JSON.stringify(settings, null, 2)); + // console.log('isUnreadEnabled:', settings?.content?.isUnreadEnabled); + // console.log('unread_indicator:', settings?.content?.unread_indicator); + // console.log('unread_icon image URL:', settings?.content?.unread_indicator?.unread_icon?.image?.url); + // console.log('unread_icon darkUrl:', settings?.content?.unread_indicator?.unread_icon?.image?.darkUrl); + } catch (error) { + console.error('Failed to load container settings:', error); + } + }; + loadContainerSettings(); + }, [surface]); + const items = ITEMS_BY_VIEW[selectedView]; const colors = colorScheme === 'dark' ? Colors.dark : Colors.light; @@ -271,36 +294,110 @@ const ContentCardsView = () => { MobileCore.trackAction('small_image'); }, []); - return ( + const renderContentCard = (item: any, isRemote: boolean) => { + const cardView = ; + + if (!isRemote) { + return ( + + + {item.customThemes ? ( + + {cardView} + + ) : ( + cardView + )} + + ); + } + return cardView; + }; + + // Debug logging + // console.log('Rendering with containerSettings:', !!containerSettings); + // console.log('Selected view:', selectedView); + // console.log('Items count:', selectedView !== 'Remote' ? (items?.length || 0) : (content?.length || 0)); + + const content_with_provider = containerSettings ? ( + + + selectedView !== 'Remote' ? item.key : item.id + } + renderItem={({ item }: any) => + renderContentCard(item, selectedView === 'Remote') + } + ListHeaderComponent={ + + } + ListEmptyComponent={() => + selectedView === 'Remote' && ( + + + No Content Cards Available + + + Content cards will appear here when they are configured in Adobe + Journey Optimizer for surface: "rn/ios/remote_image" + + + Try tracking an action above to refresh content cards. + + + ) + } + contentContainerStyle={styles.listContent} + /> + + ) : null; + + return content_with_provider || ( selectedView !== 'Remote' ? item.key : item.id } - renderItem={({ item }: any) => { - if (selectedView !== 'Remote') { - const node = ( - - ); - return ( - - - {item.customThemes ? ( - - {node} - - ) : ( - node - )} - - ); - } - return ; - }} + renderItem={({ item }: any) => + renderContentCard(item, selectedView === 'Remote') + } ListHeaderComponent={ = ({ }) => { const colorScheme = useColorScheme(); const [isVisible, setIsVisible] = useState(true); + const [isRead, setIsRead] = useState(false); const isDisplayedRef = useRef(false); const theme = useTheme(); + const containerSettings = useContext(ContentCardContainerContext); + + // Get unread background color based on theme + const getUnreadBackgroundColor = () => { + if (!containerSettings?.content?.isUnreadEnabled || isRead || !containerSettings.content.unread_indicator?.unread_bg) { + return undefined; + } + + const unreadBg = containerSettings.content.unread_indicator.unread_bg; + return colorScheme === 'dark' ? unreadBg.clr.dark : unreadBg.clr.light; + }; const cardVariant = useMemo( () => variant ?? template.type ?? 'SmallImage', @@ -104,6 +119,9 @@ export const ContentCardView: React.FC = ({ // Track interaction event using propositionItem template.track?.('content_clicked', MessagingEdgeEventType.INTERACT, null); + // Mark as read when interacted with + setIsRead(true); + if (template.data?.content?.actionUrl) { try { Linking.openURL(template.data.content.actionUrl); @@ -181,7 +199,8 @@ export const ContentCardView: React.FC = ({ cardVariant === 'SmallImage' ? smallImageStyles.container : styles.container, - styleOverrides?.container + styleOverrides?.container, + getUnreadBackgroundColor() && { backgroundColor: getUnreadBackgroundColor() } ]} {...ContainerProps} > @@ -272,6 +291,44 @@ export const ContentCardView: React.FC = ({ {...DismissButtonProps} /> )} + {containerSettings?.content?.isUnreadEnabled && !isRead && (() => { + const iconConfig = containerSettings.content.unread_indicator?.unread_icon; + const hasImageUrl = iconConfig?.image?.url; + const hasDarkUrl = iconConfig?.image?.darkUrl; + + // Determine icon type based on current color scheme + const relevantUrl = colorScheme === 'dark' ? hasDarkUrl : hasImageUrl; + const iconType = relevantUrl ? "image" : "dot"; + + console.log('ContentCardView UnreadIcon debug:', { + isUnreadEnabled: containerSettings?.content?.isUnreadEnabled, + isRead, + hasImageUrl: !!hasImageUrl, + hasDarkUrl: !!hasDarkUrl, + colorScheme, + relevantUrl: !!relevantUrl, + iconType, + placement: iconConfig?.placement + }); + + return ( + + ); + })()} ); diff --git a/packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.tsx b/packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.tsx index f24e902e..c58b19af 100644 --- a/packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.tsx +++ b/packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.tsx @@ -1,11 +1,155 @@ -import { Text, View } from "react-native"; +/* + Copyright 2025 Adobe. All rights reserved. + This file is licensed to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law + or agreed to in writing, software distributed under the License is + distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF + ANY KIND, either express or implied. See the License for the specific + language governing permissions and limitations under the License. +*/ +import { + Image, + ImageProps, + ImageStyle, + StyleSheet, + View, + ViewProps, + ViewStyle, + useColorScheme +} from 'react-native'; + +export interface UnreadIconProps extends ViewProps { + imageStyle?: ImageStyle; + containerStyle?: ViewStyle; + source?: ImageProps['source']; + darkSource?: ImageProps['source']; + size?: number; + position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'; + type?: 'dot' | 'image'; +} + +const UnreadIcon = ({ + imageStyle, + containerStyle, + source, + darkSource, + size = 20, + position = 'top-right', + type = 'dot', + style, + ...props +}: UnreadIconProps) => { + const colorScheme = useColorScheme(); + + // Debug logging + console.log('UnreadIcon rendering:', { + type, + position, + size, + colorScheme, + hasSource: !!source, + hasDarkSource: !!darkSource + }); + + const getPositionStyle = () => { + const baseStyle = { + position: 'absolute' as const, + zIndex: 1000, + }; + + switch (position) { + case 'top-left': + return { ...baseStyle, top: 6, left: 6 }; + case 'top-right': + return { ...baseStyle, top: 6, right: 6 }; + case 'bottom-left': + return { ...baseStyle, bottom: 6, left: 6 }; + case 'bottom-right': + return { ...baseStyle, bottom: 6, right: 6 }; + default: + return { ...baseStyle, top: 6, right: 6 }; + } + }; + + const getDotColor = () => { + return colorScheme === 'dark' ? '#FF6B6B' : '#FF4444'; + }; + + const renderContent = () => { + if (type === 'image' && (source || darkSource)) { + const imageSource = colorScheme === 'dark' && darkSource ? darkSource : source; + return ( + + ); + } + + // Default dot type + return ( + + ); + }; -function UnreadIcon() { return ( - - UnreadIcon + + {renderContent()} ); -} +}; export default UnreadIcon; + +const styles = StyleSheet.create({ + container: { + justifyContent: 'center', + alignItems: 'center', + }, + dot: { + shadowColor: '#000', + shadowOffset: { + width: 0, + height: 1, + }, + shadowOpacity: 0.22, + shadowRadius: 2.22, + elevation: 3, + }, + image: { + shadowColor: '#000', + shadowOffset: { + width: 0, + height: 1, + }, + shadowOpacity: 0.22, + shadowRadius: 2.22, + elevation: 3, + } +}); diff --git a/packages/messaging/src/ui/index.ts b/packages/messaging/src/ui/index.ts index 384e6142..3916bd8a 100644 --- a/packages/messaging/src/ui/index.ts +++ b/packages/messaging/src/ui/index.ts @@ -1,4 +1,6 @@ export * from './components'; export * from './hooks'; export * from './theme'; -export * from './types'; \ No newline at end of file +export * from './types'; +export * from './providers/ContentCardContainerProvider'; +export { default as ContentCardContainerProvider } from './providers/ContentCardContainerProvider'; \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 78bef3f4..112e6ab6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6097,7 +6097,7 @@ __metadata: "@react-navigation/core": "npm:7.9.1" "@react-navigation/drawer": "npm:7.3.11" "@react-navigation/native": "npm:7.1.17" - "@ret-navigation/native-stack": "npm:^7.3.1" + "@react-navigation/native-stack": "npm:^7.3.1" "@react-navigation/routers": "npm:7.3.7" "@react-navigation/stack": "npm:7.3.1" "@types/jest": "npm:^29.5.12" From a59794547e376a3b0073090e73b59b93d3c83cb4 Mon Sep 17 00:00:00 2001 From: Calise Cheung Date: Thu, 2 Oct 2025 11:11:12 -0700 Subject: [PATCH 02/15] update the unread icon mock example update the unread icon mock example --- packages/messaging/src/Messaging.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/messaging/src/Messaging.ts b/packages/messaging/src/Messaging.ts index 4a09256d..c9c7df07 100644 --- a/packages/messaging/src/Messaging.ts +++ b/packages/messaging/src/Messaging.ts @@ -303,8 +303,8 @@ class Messaging { unread_icon: { placement: "topright", image: { - url: "", // ← Empty URL = shows dot in light mode - darkUrl: "https://icons.veryicon.com/png/o/leisure/crisp-app-icon-library-v3/notification-5.png", // ← Image in dark mode + url: "https://icons.veryicon.com/png/o/leisure/crisp-app-icon-library-v3/notification-5.png", // Image in light mode + darkUrl: "", // Empty URL = shows dot in dark mode }, }, }, From d5949ba809a50dd0e7c452d442151d5cdd5361f3 Mon Sep 17 00:00:00 2001 From: Calise Cheung Date: Fri, 3 Oct 2025 07:32:58 -0700 Subject: [PATCH 03/15] Use useContainerSettigs hook Use useContainerSettigs hook and update the dist files --- packages/messaging/dist/Messaging.d.ts | 93 -- packages/messaging/dist/Messaging.js | 180 ---- packages/messaging/dist/Messaging.js.map | 1 - packages/messaging/dist/index.d.ts | 16 - packages/messaging/dist/index.js | 36 - packages/messaging/dist/index.js.map | 1 - .../messaging/dist/models/ContentCard.d.ts | 55 -- packages/messaging/dist/models/ContentCard.js | 23 - .../messaging/dist/models/ContentCard.js.map | 1 - .../dist/models/HTMLProposition.d.ts | 12 - .../messaging/dist/models/HTMLProposition.js | 23 - .../dist/models/HTMLProposition.js.map | 1 - .../messaging/dist/models/InAppMessage.d.ts | 15 - .../messaging/dist/models/InAppMessage.js | 14 - .../messaging/dist/models/InAppMessage.js.map | 1 - .../dist/models/JSONProposition.d.ts | 12 - .../messaging/dist/models/JSONProposition.js | 23 - .../dist/models/JSONProposition.js.map | 1 - packages/messaging/dist/models/Message.d.ts | 53 -- packages/messaging/dist/models/Message.js | 107 --- packages/messaging/dist/models/Message.js.map | 1 - .../dist/models/MessagingDelegate.d.ts | 35 - .../dist/models/MessagingDelegate.js | 14 - .../dist/models/MessagingDelegate.js.map | 1 - .../dist/models/MessagingEdgeEventType.d.ts | 9 - .../dist/models/MessagingEdgeEventType.js | 24 - .../dist/models/MessagingEdgeEventType.js.map | 1 - .../dist/models/MessagingProposition.d.ts | 15 - .../dist/models/MessagingProposition.js | 59 -- .../dist/models/MessagingProposition.js.map | 1 - .../dist/models/MessagingPropositionItem.d.ts | 6 - .../dist/models/MessagingPropositionItem.js | 14 - .../models/MessagingPropositionItem.js.map | 1 - .../dist/models/PersonalizationSchema.d.ts | 9 - .../dist/models/PersonalizationSchema.js | 25 - .../dist/models/PersonalizationSchema.js.map | 1 - .../dist/models/PropositionItem.d.ts | 83 -- .../messaging/dist/models/PropositionItem.js | 78 -- .../dist/models/PropositionItem.js.map | 1 - .../messaging/dist/models/ScopeDetails.d.ts | 13 - .../messaging/dist/models/ScopeDetails.js | 14 - .../messaging/dist/models/ScopeDetails.js.map | 1 - packages/messaging/dist/models/index.d.ts | 10 - packages/messaging/dist/models/index.js | 14 - packages/messaging/dist/models/index.js.map | 1 - packages/messaging/dist/module/Messaging.js | 12 +- .../messaging/dist/module/Messaging.js.map | 2 +- .../ContentCardView/ContentCardView.js | 25 +- .../ContentCardView/ContentCardView.js.map | 2 +- .../ui/components/UnreadIcon/UnreadIcon.js | 191 ++++- .../components/UnreadIcon/UnreadIcon.js.map | 2 +- .../components/UnreadIcon/UnreadIcon.test.js | 327 +++++++ .../UnreadIcon/UnreadIcon.test.js.map | 1 + packages/messaging/dist/module/ui/index.js | 2 + .../messaging/dist/module/ui/index.js.map | 2 +- .../dist/typescript/Messaging.d.ts.map | 3 +- .../ContentCardView/ContentCardView.d.ts.map | 2 +- .../ui/components/UnreadIcon/UnreadIcon.d.ts | 14 +- .../components/UnreadIcon/UnreadIcon.d.ts.map | 2 +- .../UnreadIcon/UnreadIcon.test.d.ts | 2 + .../UnreadIcon/UnreadIcon.test.d.ts.map | 1 + .../messaging/dist/typescript/ui/index.d.ts | 2 + .../dist/typescript/ui/index.d.ts.map | 2 +- .../dist/ui/components/Button/Button.d.ts | 12 - .../dist/ui/components/Button/Button.js | 40 - .../dist/ui/components/Button/Button.js.map | 1 - .../ui/components/Button/Button.spec.d.ts | 1 - .../dist/ui/components/Button/Button.spec.js | 3 - .../ui/components/Button/Button.spec.js.map | 1 - .../ContentCardView/ContentCardView.d.ts | 17 - .../ContentCardView/ContentCardView.js | 258 ------ .../ContentCardView/ContentCardView.js.map | 1 - .../DismissButton/DismissButton.d.ts | 9 - .../components/DismissButton/DismissButton.js | 71 -- .../DismissButton/DismissButton.js.map | 1 - .../DismissButton/DismissButton.spec.d.ts | 1 - .../DismissButton/DismissButton.spec.js | 306 ------- .../DismissButton/DismissButton.spec.js.map | 1 - .../ImageOnlyCard/ImageOnlyCard.d.ts | 26 - .../components/ImageOnlyCard/ImageOnlyCard.js | 53 -- .../ImageOnlyCard/ImageOnlyCard.js.map | 1 - .../ImageOnlyCard/ImageOnlyCard.spec.d.ts | 1 - .../ImageOnlyCard/ImageOnlyCard.spec.js | 623 -------------- .../ImageOnlyCard/ImageOnlyCard.spec.js.map | 1 - .../LargeImageCard/LargeImageCard.d.ts | 36 - .../LargeImageCard/LargeImageCard.js | 106 --- .../LargeImageCard/LargeImageCard.js.map | 1 - .../LargeImageCard/LargeImageCard.spec.d.ts | 1 - .../LargeImageCard/LargeImageCard.spec.js | 795 ------------------ .../LargeImageCard/LargeImageCard.spec.js.map | 1 - .../SmallImageCard/SmallImageCard.d.ts | 30 - .../SmallImageCard/SmallImageCard.js | 121 --- .../SmallImageCard/SmallImageCard.js.map | 1 - .../SmallImageCard/SmallImageCard.spec.d.ts | 1 - .../SmallImageCard/SmallImageCard.spec.js | 704 ---------------- .../SmallImageCard/SmallImageCard.spec.js.map | 1 - .../messaging/dist/ui/components/index.d.ts | 5 - .../messaging/dist/ui/components/index.js | 21 - .../messaging/dist/ui/components/index.js.map | 1 - packages/messaging/dist/ui/hooks/index.d.ts | 1 - packages/messaging/dist/ui/hooks/index.js | 5 - packages/messaging/dist/ui/hooks/index.js.map | 1 - .../dist/ui/hooks/useAspectRatio.d.ts | 2 - .../messaging/dist/ui/hooks/useAspectRatio.js | 21 - .../dist/ui/hooks/useAspectRatio.js.map | 1 - .../dist/ui/hooks/useContentCardUI.d.ts | 12 - .../dist/ui/hooks/useContentCardUI.js | 39 - .../dist/ui/hooks/useContentCardUI.js.map | 1 - packages/messaging/dist/ui/index.d.ts | 4 - packages/messaging/dist/ui/index.js | 8 - packages/messaging/dist/ui/index.js.map | 1 - packages/messaging/dist/ui/theme/Theme.d.ts | 38 - packages/messaging/dist/ui/theme/Theme.js | 14 - packages/messaging/dist/ui/theme/Theme.js.map | 1 - .../dist/ui/theme/ThemeProvider.d.ts | 20 - .../messaging/dist/ui/theme/ThemeProvider.js | 87 -- .../dist/ui/theme/ThemeProvider.js.map | 1 - packages/messaging/dist/ui/theme/index.d.ts | 2 - packages/messaging/dist/ui/theme/index.js | 6 - packages/messaging/dist/ui/theme/index.js.map | 1 - .../dist/ui/types/ContentViewEvent.d.ts | 8 - .../dist/ui/types/ContentViewEvent.js | 14 - .../dist/ui/types/ContentViewEvent.js.map | 1 - .../messaging/dist/ui/types/Templates.d.ts | 42 - packages/messaging/dist/ui/types/Templates.js | 12 - .../messaging/dist/ui/types/Templates.js.map | 1 - packages/messaging/dist/ui/types/index.d.ts | 2 - packages/messaging/dist/ui/types/index.js | 6 - packages/messaging/dist/ui/types/index.js.map | 1 - .../ContentCardView/ContentCardView.tsx | 41 +- .../components/UnreadIcon/UnreadIcon.test.tsx | 325 +++++++ .../ui/components/UnreadIcon/UnreadIcon.tsx | 105 ++- yarn.lock | 41 +- 133 files changed, 1024 insertions(+), 4787 deletions(-) delete mode 100644 packages/messaging/dist/Messaging.d.ts delete mode 100644 packages/messaging/dist/Messaging.js delete mode 100644 packages/messaging/dist/Messaging.js.map delete mode 100644 packages/messaging/dist/index.d.ts delete mode 100644 packages/messaging/dist/index.js delete mode 100644 packages/messaging/dist/index.js.map delete mode 100644 packages/messaging/dist/models/ContentCard.d.ts delete mode 100644 packages/messaging/dist/models/ContentCard.js delete mode 100644 packages/messaging/dist/models/ContentCard.js.map delete mode 100644 packages/messaging/dist/models/HTMLProposition.d.ts delete mode 100644 packages/messaging/dist/models/HTMLProposition.js delete mode 100644 packages/messaging/dist/models/HTMLProposition.js.map delete mode 100644 packages/messaging/dist/models/InAppMessage.d.ts delete mode 100644 packages/messaging/dist/models/InAppMessage.js delete mode 100644 packages/messaging/dist/models/InAppMessage.js.map delete mode 100644 packages/messaging/dist/models/JSONProposition.d.ts delete mode 100644 packages/messaging/dist/models/JSONProposition.js delete mode 100644 packages/messaging/dist/models/JSONProposition.js.map delete mode 100644 packages/messaging/dist/models/Message.d.ts delete mode 100644 packages/messaging/dist/models/Message.js delete mode 100644 packages/messaging/dist/models/Message.js.map delete mode 100644 packages/messaging/dist/models/MessagingDelegate.d.ts delete mode 100644 packages/messaging/dist/models/MessagingDelegate.js delete mode 100644 packages/messaging/dist/models/MessagingDelegate.js.map delete mode 100644 packages/messaging/dist/models/MessagingEdgeEventType.d.ts delete mode 100644 packages/messaging/dist/models/MessagingEdgeEventType.js delete mode 100644 packages/messaging/dist/models/MessagingEdgeEventType.js.map delete mode 100644 packages/messaging/dist/models/MessagingProposition.d.ts delete mode 100644 packages/messaging/dist/models/MessagingProposition.js delete mode 100644 packages/messaging/dist/models/MessagingProposition.js.map delete mode 100644 packages/messaging/dist/models/MessagingPropositionItem.d.ts delete mode 100644 packages/messaging/dist/models/MessagingPropositionItem.js delete mode 100644 packages/messaging/dist/models/MessagingPropositionItem.js.map delete mode 100644 packages/messaging/dist/models/PersonalizationSchema.d.ts delete mode 100644 packages/messaging/dist/models/PersonalizationSchema.js delete mode 100644 packages/messaging/dist/models/PersonalizationSchema.js.map delete mode 100644 packages/messaging/dist/models/PropositionItem.d.ts delete mode 100644 packages/messaging/dist/models/PropositionItem.js delete mode 100644 packages/messaging/dist/models/PropositionItem.js.map delete mode 100644 packages/messaging/dist/models/ScopeDetails.d.ts delete mode 100644 packages/messaging/dist/models/ScopeDetails.js delete mode 100644 packages/messaging/dist/models/ScopeDetails.js.map delete mode 100644 packages/messaging/dist/models/index.d.ts delete mode 100644 packages/messaging/dist/models/index.js delete mode 100644 packages/messaging/dist/models/index.js.map create mode 100644 packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.test.js create mode 100644 packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.test.js.map create mode 100644 packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.test.d.ts create mode 100644 packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.test.d.ts.map delete mode 100644 packages/messaging/dist/ui/components/Button/Button.d.ts delete mode 100644 packages/messaging/dist/ui/components/Button/Button.js delete mode 100644 packages/messaging/dist/ui/components/Button/Button.js.map delete mode 100644 packages/messaging/dist/ui/components/Button/Button.spec.d.ts delete mode 100644 packages/messaging/dist/ui/components/Button/Button.spec.js delete mode 100644 packages/messaging/dist/ui/components/Button/Button.spec.js.map delete mode 100644 packages/messaging/dist/ui/components/ContentCardView/ContentCardView.d.ts delete mode 100644 packages/messaging/dist/ui/components/ContentCardView/ContentCardView.js delete mode 100644 packages/messaging/dist/ui/components/ContentCardView/ContentCardView.js.map delete mode 100644 packages/messaging/dist/ui/components/DismissButton/DismissButton.d.ts delete mode 100644 packages/messaging/dist/ui/components/DismissButton/DismissButton.js delete mode 100644 packages/messaging/dist/ui/components/DismissButton/DismissButton.js.map delete mode 100644 packages/messaging/dist/ui/components/DismissButton/DismissButton.spec.d.ts delete mode 100644 packages/messaging/dist/ui/components/DismissButton/DismissButton.spec.js delete mode 100644 packages/messaging/dist/ui/components/DismissButton/DismissButton.spec.js.map delete mode 100644 packages/messaging/dist/ui/components/ImageOnlyCard/ImageOnlyCard.d.ts delete mode 100644 packages/messaging/dist/ui/components/ImageOnlyCard/ImageOnlyCard.js delete mode 100644 packages/messaging/dist/ui/components/ImageOnlyCard/ImageOnlyCard.js.map delete mode 100644 packages/messaging/dist/ui/components/ImageOnlyCard/ImageOnlyCard.spec.d.ts delete mode 100644 packages/messaging/dist/ui/components/ImageOnlyCard/ImageOnlyCard.spec.js delete mode 100644 packages/messaging/dist/ui/components/ImageOnlyCard/ImageOnlyCard.spec.js.map delete mode 100644 packages/messaging/dist/ui/components/LargeImageCard/LargeImageCard.d.ts delete mode 100644 packages/messaging/dist/ui/components/LargeImageCard/LargeImageCard.js delete mode 100644 packages/messaging/dist/ui/components/LargeImageCard/LargeImageCard.js.map delete mode 100644 packages/messaging/dist/ui/components/LargeImageCard/LargeImageCard.spec.d.ts delete mode 100644 packages/messaging/dist/ui/components/LargeImageCard/LargeImageCard.spec.js delete mode 100644 packages/messaging/dist/ui/components/LargeImageCard/LargeImageCard.spec.js.map delete mode 100644 packages/messaging/dist/ui/components/SmallImageCard/SmallImageCard.d.ts delete mode 100644 packages/messaging/dist/ui/components/SmallImageCard/SmallImageCard.js delete mode 100644 packages/messaging/dist/ui/components/SmallImageCard/SmallImageCard.js.map delete mode 100644 packages/messaging/dist/ui/components/SmallImageCard/SmallImageCard.spec.d.ts delete mode 100644 packages/messaging/dist/ui/components/SmallImageCard/SmallImageCard.spec.js delete mode 100644 packages/messaging/dist/ui/components/SmallImageCard/SmallImageCard.spec.js.map delete mode 100644 packages/messaging/dist/ui/components/index.d.ts delete mode 100644 packages/messaging/dist/ui/components/index.js delete mode 100644 packages/messaging/dist/ui/components/index.js.map delete mode 100644 packages/messaging/dist/ui/hooks/index.d.ts delete mode 100644 packages/messaging/dist/ui/hooks/index.js delete mode 100644 packages/messaging/dist/ui/hooks/index.js.map delete mode 100644 packages/messaging/dist/ui/hooks/useAspectRatio.d.ts delete mode 100644 packages/messaging/dist/ui/hooks/useAspectRatio.js delete mode 100644 packages/messaging/dist/ui/hooks/useAspectRatio.js.map delete mode 100644 packages/messaging/dist/ui/hooks/useContentCardUI.d.ts delete mode 100644 packages/messaging/dist/ui/hooks/useContentCardUI.js delete mode 100644 packages/messaging/dist/ui/hooks/useContentCardUI.js.map delete mode 100644 packages/messaging/dist/ui/index.d.ts delete mode 100644 packages/messaging/dist/ui/index.js delete mode 100644 packages/messaging/dist/ui/index.js.map delete mode 100644 packages/messaging/dist/ui/theme/Theme.d.ts delete mode 100644 packages/messaging/dist/ui/theme/Theme.js delete mode 100644 packages/messaging/dist/ui/theme/Theme.js.map delete mode 100644 packages/messaging/dist/ui/theme/ThemeProvider.d.ts delete mode 100644 packages/messaging/dist/ui/theme/ThemeProvider.js delete mode 100644 packages/messaging/dist/ui/theme/ThemeProvider.js.map delete mode 100644 packages/messaging/dist/ui/theme/index.d.ts delete mode 100644 packages/messaging/dist/ui/theme/index.js delete mode 100644 packages/messaging/dist/ui/theme/index.js.map delete mode 100644 packages/messaging/dist/ui/types/ContentViewEvent.d.ts delete mode 100644 packages/messaging/dist/ui/types/ContentViewEvent.js delete mode 100644 packages/messaging/dist/ui/types/ContentViewEvent.js.map delete mode 100644 packages/messaging/dist/ui/types/Templates.d.ts delete mode 100644 packages/messaging/dist/ui/types/Templates.js delete mode 100644 packages/messaging/dist/ui/types/Templates.js.map delete mode 100644 packages/messaging/dist/ui/types/index.d.ts delete mode 100644 packages/messaging/dist/ui/types/index.js delete mode 100644 packages/messaging/dist/ui/types/index.js.map create mode 100644 packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.test.tsx diff --git a/packages/messaging/dist/Messaging.d.ts b/packages/messaging/dist/Messaging.d.ts deleted file mode 100644 index eb04ba78..00000000 --- a/packages/messaging/dist/Messaging.d.ts +++ /dev/null @@ -1,93 +0,0 @@ -import Message from './models/Message'; -import { MessagingDelegate } from './models/MessagingDelegate'; -import { MessagingProposition } from './models/MessagingProposition'; -import { ContentCard } from './models/ContentCard'; -import { ContentTemplate } from './ui/types/Templates'; -export interface NativeMessagingModule { - extensionVersion: () => Promise; - getCachedMessages: () => Message[]; - getLatestMessage: () => Message; - getContentCardUI: (surface: string) => Promise; - getPropositionsForSurfaces: (surfaces: string[]) => Record; - refreshInAppMessages: () => void; - setMessagingDelegate: (delegate?: MessagingDelegate) => void; - setMessageSettings: (shouldShowMessage: boolean, shouldSaveMessage: boolean) => void; - updatePropositionsForSurfaces: (surfaces: string[]) => Promise; - trackContentCardDisplay: (proposition: MessagingProposition, contentCard: ContentCard) => void; - trackContentCardInteraction: (proposition: MessagingProposition, contentCard: ContentCard) => void; - trackPropositionItem: (itemId: string, interaction: string | null, eventType: number, tokens: string[] | null) => void; -} -declare class Messaging { - /** - * Returns the version of the AEPMessaging extension - * @returns {string} Promise a promise that resolves with the extension version - */ - static extensionVersion(): Promise; - /** - * Initiates a network call to retrieve remote In-App Message definitions. - */ - static refreshInAppMessages(): void; - /** - * Retrieves the list of messages which have been cached using the `shouldSaveMessage` - * method of the messaging delegate. - * Note: Messages should be cached before trying to use any of the methods on the message class - * @returns An array of messages that have been cached - */ - static getCachedMessages(): Promise; - /** - * Retrieves the last message that has been shown in the UI - * @returns The latest message to have been displayed - */ - static getLatestMessage(): Promise; - /** - * Retrieves the previously fetched (and cached) feeds content from the SDK for the provided surfaces. - * 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. - * @param surfaces A list of surfaces to fetch - * @returns A record of surface names with their corresponding propositions - */ - static getPropositionsForSurfaces(surfaces: string[]): Promise>; - /** - * @deprecated Use PropositionItem.track(...) instead. - */ - static trackContentCardDisplay(proposition: MessagingProposition, contentCard: ContentCard): void; - /** - * @deprecated Use PropositionItem.track(...) instead. - */ - static trackContentCardInteraction(proposition: MessagingProposition, contentCard: ContentCard): void; - /** - * Tracks interactions with a PropositionItem using the provided interaction and event type. - * This method is used internally by the PropositionItem.track() method. - * - * @param {string} itemId - The unique identifier of the PropositionItem - * @param {string | null} interaction - A custom string value to be recorded in the interaction - * @param {number} eventType - The MessagingEdgeEventType numeric value - * @param {string[] | null} tokens - Array containing the sub-item tokens for recording interaction - */ - static trackPropositionItem(itemId: string, interaction: string | null, eventType: number, tokens: string[] | null): void; - /** - * Function to set the UI Message delegate to listen the Message lifecycle events. - * @returns A function to unsubscribe from all event listeners - */ - static setMessagingDelegate(delegate: MessagingDelegate): () => void; - /** - * Sets global settings for messages being shown and cached - * Note: This method is also used by MessagingDelegate.shouldShowMessage, - * which allows finer-grained control over setting these settings - * @param shouldShowMessage Whether or not a message should be displayed - * @param shouldSaveMessage Whether or not a message should be cached - */ - static setMessageSettings(shouldShowMessage: boolean, shouldSaveMessage: boolean): void; - /** - * Dispatches an event to fetch propositions for the provided surfaces from remote. - * @param surfaces A list of surface names to update - */ - static updatePropositionsForSurfaces(surfaces: string[]): Promise; - /** - * @experimental - * Retrieves the content card UI data for a given surface. - * @param surface The surface to get the content card UI data for - * @returns The content card UI data for the given surface - */ - static getContentCardUI(surface: string): Promise; -} -export default Messaging; diff --git a/packages/messaging/dist/Messaging.js b/packages/messaging/dist/Messaging.js deleted file mode 100644 index e0c9bfc4..00000000 --- a/packages/messaging/dist/Messaging.js +++ /dev/null @@ -1,180 +0,0 @@ -"use strict"; -/* -Copyright 2024 Adobe. All rights reserved. -This file is licensed to you under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. You may obtain a copy -of the License at http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under -the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS -OF ANY KIND, either express or implied. See the License for the specific language -governing permissions and limitations under the License. -*/ -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -const react_native_1 = require("react-native"); -const Message_1 = tslib_1.__importDefault(require("./models/Message")); -const MessagingProposition_1 = require("./models/MessagingProposition"); -const PersonalizationSchema_1 = require("./models/PersonalizationSchema"); -const Templates_1 = require("./ui/types/Templates"); -const RCTAEPMessaging = react_native_1.NativeModules.AEPMessaging; -var messagingDelegate; -class Messaging { - /** - * Returns the version of the AEPMessaging extension - * @returns {string} Promise a promise that resolves with the extension version - */ - static extensionVersion() { - return Promise.resolve(RCTAEPMessaging.extensionVersion()); - } - /** - * Initiates a network call to retrieve remote In-App Message definitions. - */ - static refreshInAppMessages() { - RCTAEPMessaging.refreshInAppMessages(); - } - /** - * Retrieves the list of messages which have been cached using the `shouldSaveMessage` - * method of the messaging delegate. - * Note: Messages should be cached before trying to use any of the methods on the message class - * @returns An array of messages that have been cached - */ - static getCachedMessages() { - return tslib_1.__awaiter(this, void 0, void 0, function* () { - const messages = yield RCTAEPMessaging.getCachedMessages(); - return messages.map((msg) => new Message_1.default(msg)); - }); - } - /** - * Retrieves the last message that has been shown in the UI - * @returns The latest message to have been displayed - */ - static getLatestMessage() { - return tslib_1.__awaiter(this, void 0, void 0, function* () { - const message = yield RCTAEPMessaging.getLatestMessage(); - return message ? new Message_1.default(message) : undefined; - }); - } - /** - * Retrieves the previously fetched (and cached) feeds content from the SDK for the provided surfaces. - * 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. - * @param surfaces A list of surfaces to fetch - * @returns A record of surface names with their corresponding propositions - */ - static getPropositionsForSurfaces(surfaces) { - return tslib_1.__awaiter(this, void 0, void 0, function* () { - return yield RCTAEPMessaging.getPropositionsForSurfaces(surfaces); - }); - } - /** - * @deprecated Use PropositionItem.track(...) instead. - */ - static trackContentCardDisplay(proposition, contentCard) { - RCTAEPMessaging.trackContentCardDisplay(proposition, contentCard); - } - /** - * @deprecated Use PropositionItem.track(...) instead. - */ - static trackContentCardInteraction(proposition, contentCard) { - RCTAEPMessaging.trackContentCardInteraction(proposition, contentCard); - } - /** - * Tracks interactions with a PropositionItem using the provided interaction and event type. - * This method is used internally by the PropositionItem.track() method. - * - * @param {string} itemId - The unique identifier of the PropositionItem - * @param {string | null} interaction - A custom string value to be recorded in the interaction - * @param {number} eventType - The MessagingEdgeEventType numeric value - * @param {string[] | null} tokens - Array containing the sub-item tokens for recording interaction - */ - static trackPropositionItem(itemId, interaction, eventType, tokens) { - RCTAEPMessaging.trackPropositionItem(itemId, interaction, eventType, tokens); - } - /** - * Function to set the UI Message delegate to listen the Message lifecycle events. - * @returns A function to unsubscribe from all event listeners - */ - static setMessagingDelegate(delegate) { - messagingDelegate = delegate; - const eventEmitter = new react_native_1.NativeEventEmitter(RCTAEPMessaging); - 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)); }); - eventEmitter.addListener('onDismiss', (message) => { - var _a; - const messageInstance = new Message_1.default(message); - messageInstance._clearJavascriptMessageHandlers(); - (_a = messagingDelegate === null || messagingDelegate === void 0 ? void 0 : messagingDelegate.onDismiss) === null || _a === void 0 ? void 0 : _a.call(messagingDelegate, messageInstance); - }); - eventEmitter.addListener('shouldShowMessage', (message) => { - var _a, _b, _c, _d; - const messageInstance = new Message_1.default(message); - 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; - 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; - RCTAEPMessaging.setMessageSettings(shouldShowMessage, shouldSaveMessage); - }); - if (react_native_1.Platform.OS === 'ios') { - 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)); }); - } - if (react_native_1.Platform.OS === 'android') { - 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)); }); - } - RCTAEPMessaging.setMessagingDelegate(); - return () => { - eventEmitter.removeAllListeners('onDismiss'); - eventEmitter.removeAllListeners('onShow'); - eventEmitter.removeAllListeners('shouldShowMessage'); - if (react_native_1.Platform.OS === 'ios') { - eventEmitter.removeAllListeners('urlLoaded'); - } - if (react_native_1.Platform.OS === 'android') { - eventEmitter.removeAllListeners('onContentLoaded'); - } - }; - } - /** - * Sets global settings for messages being shown and cached - * Note: This method is also used by MessagingDelegate.shouldShowMessage, - * which allows finer-grained control over setting these settings - * @param shouldShowMessage Whether or not a message should be displayed - * @param shouldSaveMessage Whether or not a message should be cached - */ - static setMessageSettings(shouldShowMessage, shouldSaveMessage) { - RCTAEPMessaging.setMessageSettings(shouldShowMessage, shouldSaveMessage); - } - /** - * Dispatches an event to fetch propositions for the provided surfaces from remote. - * @param surfaces A list of surface names to update - */ - static updatePropositionsForSurfaces(surfaces) { - return tslib_1.__awaiter(this, void 0, void 0, function* () { - return yield RCTAEPMessaging.updatePropositionsForSurfaces(surfaces); - }); - } - /** - * @experimental - * Retrieves the content card UI data for a given surface. - * @param surface The surface to get the content card UI data for - * @returns The content card UI data for the given surface - */ - static getContentCardUI(surface) { - return tslib_1.__awaiter(this, void 0, void 0, function* () { - const messages = yield Messaging.getPropositionsForSurfaces([surface]); - const propositions = messages[surface]; - if (!(propositions === null || propositions === void 0 ? void 0 : propositions.length)) { - return []; - } - const contentCards = propositions - .map((proposition) => new MessagingProposition_1.MessagingProposition(proposition)) - .flatMap((proposition) => proposition.items.filter((item) => item.schema === PersonalizationSchema_1.PersonalizationSchema.CONTENT_CARD)); - if (!(contentCards === null || contentCards === void 0 ? void 0 : contentCards.length)) { - return []; - } - return contentCards.map((card) => { - var _a, _b, _c, _d; - const type = (_d = (_c = (_b = (_a = card.data) === null || _a === void 0 ? void 0 : _a.meta) === null || _b === void 0 ? void 0 : _b.adobe) === null || _c === void 0 ? void 0 : _c.template) !== null && _d !== void 0 ? _d : 'SmallImage'; - return new Templates_1.ContentTemplate(card, type); - }); - }); - } -} -exports.default = Messaging; -//# sourceMappingURL=Messaging.js.map \ No newline at end of file diff --git a/packages/messaging/dist/Messaging.js.map b/packages/messaging/dist/Messaging.js.map deleted file mode 100644 index 19a0e10c..00000000 --- a/packages/messaging/dist/Messaging.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Messaging.js","sourceRoot":"","sources":["../src/Messaging.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;EAUE;;;AAEF,+CAKsB;AACtB,uEAAuC;AAEvC,wEAAqE;A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a/packages/messaging/dist/index.d.ts b/packages/messaging/dist/index.d.ts deleted file mode 100644 index 2d707f13..00000000 --- a/packages/messaging/dist/index.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import Messaging from './Messaging'; -import { ContentCard, ContentCardData } from './models/ContentCard'; -import { InAppMessage } from './models/InAppMessage'; -import { HTMLProposition, HTMLPropositionData } from './models/HTMLProposition'; -import { JSONPropositionItem, JSONPropositionData } from './models/JSONProposition'; -import Message from './models/Message'; -import { MessagingDelegate } from './models/MessagingDelegate'; -import MessagingEdgeEventType from './models/MessagingEdgeEventType'; -import { MessagingProposition } from './models/MessagingProposition'; -import { MessagingPropositionItem } from './models/MessagingPropositionItem'; -import { PersonalizationSchema } from './models/PersonalizationSchema'; -import { PropositionItem, PropositionItemData } from './models/PropositionItem'; -import { Activity, Characteristics } from './models/ScopeDetails'; -export * from './models/ContentCard'; -export * from './ui'; -export { Activity, Characteristics, ContentCard, ContentCardData, InAppMessage, Messaging, Message, MessagingDelegate, MessagingEdgeEventType, MessagingProposition, MessagingPropositionItem, PersonalizationSchema, PropositionItem, PropositionItemData, HTMLProposition, HTMLPropositionData, JSONPropositionItem, JSONPropositionData, }; diff --git a/packages/messaging/dist/index.js b/packages/messaging/dist/index.js deleted file mode 100644 index 9650c064..00000000 --- a/packages/messaging/dist/index.js +++ /dev/null @@ -1,36 +0,0 @@ -"use strict"; -/* -Copyright 2023 Adobe. All rights reserved. -This file is licensed to you under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. You may obtain a copy -of the License at http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under -the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS -OF ANY KIND, either express or implied. See the License for the specific language -governing permissions and limitations under the License. -*/ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.JSONPropositionItem = exports.HTMLProposition = exports.PropositionItem = exports.PersonalizationSchema = exports.MessagingProposition = exports.MessagingEdgeEventType = exports.Message = exports.Messaging = exports.ContentCard = void 0; -const tslib_1 = require("tslib"); -const Messaging_1 = tslib_1.__importDefault(require("./Messaging")); -exports.Messaging = Messaging_1.default; -const ContentCard_1 = require("./models/ContentCard"); -Object.defineProperty(exports, "ContentCard", { enumerable: true, get: function () { return ContentCard_1.ContentCard; } }); -const HTMLProposition_1 = require("./models/HTMLProposition"); -Object.defineProperty(exports, "HTMLProposition", { enumerable: true, get: function () { return HTMLProposition_1.HTMLProposition; } }); -const JSONProposition_1 = require("./models/JSONProposition"); -Object.defineProperty(exports, "JSONPropositionItem", { enumerable: true, get: function () { return JSONProposition_1.JSONPropositionItem; } }); -const Message_1 = tslib_1.__importDefault(require("./models/Message")); -exports.Message = Message_1.default; -const MessagingEdgeEventType_1 = tslib_1.__importDefault(require("./models/MessagingEdgeEventType")); -exports.MessagingEdgeEventType = MessagingEdgeEventType_1.default; -const MessagingProposition_1 = require("./models/MessagingProposition"); -Object.defineProperty(exports, "MessagingProposition", { enumerable: true, get: function () { return MessagingProposition_1.MessagingProposition; } }); -const PersonalizationSchema_1 = require("./models/PersonalizationSchema"); -Object.defineProperty(exports, "PersonalizationSchema", { enumerable: true, get: function () { return PersonalizationSchema_1.PersonalizationSchema; } }); -const PropositionItem_1 = require("./models/PropositionItem"); -Object.defineProperty(exports, "PropositionItem", { enumerable: true, get: function () { return PropositionItem_1.PropositionItem; } }); -tslib_1.__exportStar(require("./models/ContentCard"), exports); -tslib_1.__exportStar(require("./ui"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/messaging/dist/index.js.map b/packages/messaging/dist/index.js.map deleted file mode 100644 index 4e44d82b..00000000 --- a/packages/messaging/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;EAUE;;;;AAEF,oEAAoC;AAyBlC,oBAzBK,mBAAS,CAyBL;AAxBX,sDAAoE;AAqBlE,4FArBO,yBAAW,OAqBP;AAlBb,8DAAgF;AA8B9E,gGA9BO,iCAAe,OA8BP;AA7BjB,8DAAoF;AA+BlF,oGA/BO,qCAAmB,OA+BP;AA7BrB,uEAAuC;AAmBrC,kBAnBK,iBAAO,CAmBL;AAjBT,qGAAqE;AAmBnE,iCAnBK,gCAAsB,CAmBL;AAlBxB,wEAAqE;AAmBnE,qGAnBO,2CAAoB,OAmBP;AAjBtB,0EAAuE;AAmBrE,sGAnBO,6CAAqB,OAmBP;AAlBvB,8DAAgF;AAmB9E,gGAnBO,iCAAe,OAmBP;AAhBjB,+DAAqC;AACrC,+CAAqB"} \ No newline at end of file diff --git a/packages/messaging/dist/models/ContentCard.d.ts b/packages/messaging/dist/models/ContentCard.d.ts deleted file mode 100644 index 41a53324..00000000 --- a/packages/messaging/dist/models/ContentCard.d.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { PersonalizationSchema } from './PersonalizationSchema'; -import { PropositionItem, PropositionItemData } from './PropositionItem'; -export type ContentCardTemplate = 'SmallImage' | 'LargeImage' | 'ImageOnly'; -export type DismissButtonStyle = 'circle' | 'none' | 'simple'; -export interface ContentCardButton { - readonly interactId: string; - readonly actionUrl?: string; - readonly id?: string; - readonly text: { - readonly content: string; - }; -} -export interface ContentCardContent { - readonly image?: { - readonly alt?: string; - readonly url: string; - readonly darkUrl?: string; - }; - readonly buttons?: readonly ContentCardButton[]; - readonly dismissBtn?: { - readonly style: DismissButtonStyle; - }; - readonly actionUrl?: string; - readonly body?: { - readonly content: string; - }; - readonly title: { - readonly content: string; - }; -} -export type ImageOnlyContent = Pick; -export type LargeImageContentData = ContentCardContent; -export type SmallImageContentData = ContentCardContent; -export interface ContentCardMeta { - [key: string]: any; - adobe: { - template: ContentCardTemplate; - }; - surface?: string; -} -export interface ContentCardData extends PropositionItemData { - id: string; - schema: PersonalizationSchema.CONTENT_CARD; - data: { - contentType: 'application/json'; - expiryDate: number; - publishedDate: number; - meta: ContentCardMeta; - content: SmallImageContentData | LargeImageContentData | ImageOnlyContent; - }; -} -export declare class ContentCard extends PropositionItem { - data: ContentCardData['data']; - constructor(contentCardData: ContentCardData); -} diff --git a/packages/messaging/dist/models/ContentCard.js b/packages/messaging/dist/models/ContentCard.js deleted file mode 100644 index b5fdccf7..00000000 --- a/packages/messaging/dist/models/ContentCard.js +++ /dev/null @@ -1,23 +0,0 @@ -"use strict"; -/* - Copyright 2024 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law - or agreed to in writing, software distributed under the License is - distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF - ANY KIND, either express or implied. See the License for the specific - language governing permissions and limitations under the License. -*/ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ContentCard = void 0; -const PropositionItem_1 = require("./PropositionItem"); -class ContentCard extends PropositionItem_1.PropositionItem { - constructor(contentCardData) { - super(contentCardData); - this.data = contentCardData.data; - } -} -exports.ContentCard = ContentCard; -//# sourceMappingURL=ContentCard.js.map \ No newline at end of file diff --git a/packages/messaging/dist/models/ContentCard.js.map b/packages/messaging/dist/models/ContentCard.js.map deleted file mode 100644 index 2694ee53..00000000 --- a/packages/messaging/dist/models/ContentCard.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ContentCard.js","sourceRoot":"","sources":["../../src/models/ContentCard.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;EAUE;;;AAGF,uDAAyE;AA2DzE,MAAa,WAAY,SAAQ,iCAAe;IAG9C,YAAY,eAAgC;QAC1C,KAAK,CAAC,eAAe,CAAC,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC,IAAI,CAAC;IACnC,CAAC;CACF;AAPD,kCAOC"} \ No newline at end of file diff --git a/packages/messaging/dist/models/HTMLProposition.d.ts b/packages/messaging/dist/models/HTMLProposition.d.ts deleted file mode 100644 index 47f594e4..00000000 --- a/packages/messaging/dist/models/HTMLProposition.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { PersonalizationSchema } from './PersonalizationSchema'; -import { PropositionItem, PropositionItemData } from './PropositionItem'; -export interface HTMLPropositionData extends PropositionItemData { - data: { - content: string; - }; - schema: PersonalizationSchema.HTML_CONTENT; -} -export declare class HTMLProposition extends PropositionItem { - data: HTMLPropositionData['data']; - constructor(htmlData: HTMLPropositionData); -} diff --git a/packages/messaging/dist/models/HTMLProposition.js b/packages/messaging/dist/models/HTMLProposition.js deleted file mode 100644 index 317915f1..00000000 --- a/packages/messaging/dist/models/HTMLProposition.js +++ /dev/null @@ -1,23 +0,0 @@ -"use strict"; -/* - Copyright 2024 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law - or agreed to in writing, software distributed under the License is - distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF - ANY KIND, either express or implied. See the License for the specific - language governing permissions and limitations under the License. -*/ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.HTMLProposition = void 0; -const PropositionItem_1 = require("./PropositionItem"); -class HTMLProposition extends PropositionItem_1.PropositionItem { - constructor(htmlData) { - super(htmlData); - this.data = htmlData.data; - } -} -exports.HTMLProposition = HTMLProposition; -//# sourceMappingURL=HTMLProposition.js.map \ No newline at end of file diff --git a/packages/messaging/dist/models/HTMLProposition.js.map b/packages/messaging/dist/models/HTMLProposition.js.map deleted file mode 100644 index 9e7e00fb..00000000 --- a/packages/messaging/dist/models/HTMLProposition.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"HTMLProposition.js","sourceRoot":"","sources":["../../src/models/HTMLProposition.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;EAUE;;;AAGF,uDAAyE;AASzE,MAAa,eAAgB,SAAQ,iCAAe;IAGnD,YAAY,QAA6B;QACxC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChB,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC;IAC3B,CAAC;CACD;AAPD,0CAOC"} \ No newline at end of file diff --git a/packages/messaging/dist/models/InAppMessage.d.ts b/packages/messaging/dist/models/InAppMessage.d.ts deleted file mode 100644 index dd820500..00000000 --- a/packages/messaging/dist/models/InAppMessage.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { PersonalizationSchema } from './PersonalizationSchema'; -export interface InAppMessage { - id: string; - schema: PersonalizationSchema.IN_APP; - data: { - content: string; - contentType: 'text/html'; - expiryDate: number; - publishedDate: number; - meta?: Record; - mobileParameters?: Record; - webParameters?: Record; - remoteAssets?: string[]; - }; -} diff --git a/packages/messaging/dist/models/InAppMessage.js b/packages/messaging/dist/models/InAppMessage.js deleted file mode 100644 index 5a1f9b58..00000000 --- a/packages/messaging/dist/models/InAppMessage.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; -/* - Copyright 2024 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law - or agreed to in writing, software distributed under the License is - distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF - ANY KIND, either express or implied. See the License for the specific - language governing permissions and limitations under the License. -*/ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=InAppMessage.js.map \ No newline at end of file diff --git a/packages/messaging/dist/models/InAppMessage.js.map b/packages/messaging/dist/models/InAppMessage.js.map deleted file mode 100644 index 69800a69..00000000 --- a/packages/messaging/dist/models/InAppMessage.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"InAppMessage.js","sourceRoot":"","sources":["../../src/models/InAppMessage.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;EAUE"} \ No newline at end of file diff --git a/packages/messaging/dist/models/JSONProposition.d.ts b/packages/messaging/dist/models/JSONProposition.d.ts deleted file mode 100644 index 5f0703bc..00000000 --- a/packages/messaging/dist/models/JSONProposition.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { PersonalizationSchema } from './PersonalizationSchema'; -import { PropositionItem, PropositionItemData } from './PropositionItem'; -export interface JSONPropositionData extends PropositionItemData { - data: { - content: any; - }; - schema: PersonalizationSchema.JSON_CONTENT; -} -export declare class JSONPropositionItem extends PropositionItem { - data: JSONPropositionData['data']; - constructor(jsonData: JSONPropositionData); -} diff --git a/packages/messaging/dist/models/JSONProposition.js b/packages/messaging/dist/models/JSONProposition.js deleted file mode 100644 index 24b20788..00000000 --- a/packages/messaging/dist/models/JSONProposition.js +++ /dev/null @@ -1,23 +0,0 @@ -"use strict"; -/* - Copyright 2024 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law - or agreed to in writing, software distributed under the License is - distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF - ANY KIND, either express or implied. See the License for the specific - language governing permissions and limitations under the License. -*/ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.JSONPropositionItem = void 0; -const PropositionItem_1 = require("./PropositionItem"); -class JSONPropositionItem extends PropositionItem_1.PropositionItem { - constructor(jsonData) { - super(jsonData); - this.data = jsonData.data; - } -} -exports.JSONPropositionItem = JSONPropositionItem; -//# sourceMappingURL=JSONProposition.js.map \ No newline at end of file diff --git a/packages/messaging/dist/models/JSONProposition.js.map b/packages/messaging/dist/models/JSONProposition.js.map deleted file mode 100644 index 2a39f0b0..00000000 --- a/packages/messaging/dist/models/JSONProposition.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"JSONProposition.js","sourceRoot":"","sources":["../../src/models/JSONProposition.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;EAUE;;;AAGF,uDAAyE;AASzE,MAAa,mBAAoB,SAAQ,iCAAe;IAGvD,YAAY,QAA6B;QACxC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChB,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC;IAC3B,CAAC;CACD;AAPD,kDAOC"} \ No newline at end of file diff --git a/packages/messaging/dist/models/Message.d.ts b/packages/messaging/dist/models/Message.d.ts deleted file mode 100644 index fa293a81..00000000 --- a/packages/messaging/dist/models/Message.d.ts +++ /dev/null @@ -1,53 +0,0 @@ -declare class Message { - id: string; - autoTrack: boolean; - constructor({ id, autoTrack }: { - id: string; - autoTrack: boolean; - }); - /** - * Update the value of property "autoTrack" - * This function works only for the Message objects that were saved by calling "Messaging.saveMessage" - * @param {boolean} autoTrack: New value of property autoTrack. - */ - setAutoTrack(autoTrack: boolean): void; - /** - * Signals to the UIServices that the message should be shown. - * If autoTrack is true, calling this method will result in an "inapp.display" Edge Event being dispatched. - */ - show(): void; - /** - * Signals to the UIServices that the message should be dismissed. - * If `autoTrack` is true, calling this method will result in an "inapp.dismiss" Edge Event being dispatched. - * @param {boolean?} suppressAutoTrack: if set to true, the inapp.dismiss Edge Event will not be sent regardless - * of the autoTrack setting. - */ - dismiss(suppressAutoTrack?: boolean): void; - /** - * Generates an Edge Event for the provided interaction and eventType. - * @param {string?} interaction: a custom String value to be recorded in the interaction - * @param {MessagingEdgeEventType} eventType: the MessagingEdgeEventType to be used for the ensuing Edge Event - */ - track(interaction: string, eventType: number): void; - /** - * Clears the cached reference to the Message object. - * This function must be called if Message was saved by calling "MessagingDelegate.shouldSaveMessage" but no longer needed. - * Failure to call this function leads to memory leaks. - */ - clear(): void; - /** - * Adds a handler for named JavaScript messages sent from the message's WebView. - * The parameter passed to handler will contain the body of the message passed from the WebView's JavaScript. - * @param {string} handlerName: The name of the message that should be handled by the handler - * @param {function} handler: The method or closure to be called with the body of the message created in the Message's JavaScript - */ - handleJavascriptMessage(handlerName: string, handler: (content: string) => void): void; - /** - * @internal - For internal use only. - * Clears all the javascript message handlers for the message. - * This function must be called if the callbacks registered in handleJavascriptMessage are no longer needed. - * Failure to call this function may lead to memory leaks. - */ - _clearJavascriptMessageHandlers(): void; -} -export default Message; diff --git a/packages/messaging/dist/models/Message.js b/packages/messaging/dist/models/Message.js deleted file mode 100644 index 0da6a47f..00000000 --- a/packages/messaging/dist/models/Message.js +++ /dev/null @@ -1,107 +0,0 @@ -"use strict"; -/* -Copyright 2023 Adobe. All rights reserved. -This file is licensed to you under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. You may obtain a copy -of the License at http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under -the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS -OF ANY KIND, either express or implied. See the License for the specific language -governing permissions and limitations under the License. -*/ -Object.defineProperty(exports, "__esModule", { value: true }); -const react_native_1 = require("react-native"); -const RCTAEPMessaging = react_native_1.NativeModules.AEPMessaging; -// Registery to store inAppMessage callbacks for each message in Message.handleJavascriptMessage -// Record - {messageId : {handlerName : callback}} -const jsMessageHandlers = {}; -const handleJSMessageEventEmitter = new react_native_1.NativeEventEmitter(RCTAEPMessaging); -// invokes the callback registered in Message.handleJavascriptMessage with the content received from the inAppMessage webview -handleJSMessageEventEmitter.addListener('onJavascriptMessage', (event) => { - const { messageId, handlerName, content } = event; - if (jsMessageHandlers[messageId] && jsMessageHandlers[messageId][handlerName]) { - jsMessageHandlers[messageId][handlerName](content); - } -}); -class Message { - constructor({ id, autoTrack = false }) { - this.id = id; - this.autoTrack = autoTrack; - } - /** - * Update the value of property "autoTrack" - * This function works only for the Message objects that were saved by calling "Messaging.saveMessage" - * @param {boolean} autoTrack: New value of property autoTrack. - */ - setAutoTrack(autoTrack) { - this.autoTrack = autoTrack; - RCTAEPMessaging.setAutoTrack(this.id, autoTrack); - } - /** - * Signals to the UIServices that the message should be shown. - * If autoTrack is true, calling this method will result in an "inapp.display" Edge Event being dispatched. - */ - show() { - RCTAEPMessaging.show(this.id); - } - /** - * Signals to the UIServices that the message should be dismissed. - * If `autoTrack` is true, calling this method will result in an "inapp.dismiss" Edge Event being dispatched. - * @param {boolean?} suppressAutoTrack: if set to true, the inapp.dismiss Edge Event will not be sent regardless - * of the autoTrack setting. - */ - dismiss(suppressAutoTrack) { - RCTAEPMessaging.dismiss(this.id, suppressAutoTrack ? true : false); - } - /** - * Generates an Edge Event for the provided interaction and eventType. - * @param {string?} interaction: a custom String value to be recorded in the interaction - * @param {MessagingEdgeEventType} eventType: the MessagingEdgeEventType to be used for the ensuing Edge Event - */ - track(interaction, eventType) { - RCTAEPMessaging.track(this.id, interaction, eventType); - } - /** - * Clears the cached reference to the Message object. - * This function must be called if Message was saved by calling "MessagingDelegate.shouldSaveMessage" but no longer needed. - * Failure to call this function leads to memory leaks. - */ - clear() { - RCTAEPMessaging.clear(this.id); - } - /** - * Adds a handler for named JavaScript messages sent from the message's WebView. - * The parameter passed to handler will contain the body of the message passed from the WebView's JavaScript. - * @param {string} handlerName: The name of the message that should be handled by the handler - * @param {function} handler: The method or closure to be called with the body of the message created in the Message's JavaScript - */ - handleJavascriptMessage(handlerName, handler) { - // Validate parameters - if (!handlerName) { - console.warn('[AEP Messaging] handleJavascriptMessage: handlerName is required'); - return; - } - if (typeof handler !== 'function') { - console.warn('[AEP Messaging] handleJavascriptMessage: handler must be a function'); - return; - } - // cache the callback - if (!jsMessageHandlers[this.id]) { - jsMessageHandlers[this.id] = {}; - } - jsMessageHandlers[this.id][handlerName] = handler; - RCTAEPMessaging.handleJavascriptMessage(this.id, handlerName); - } - /** - * @internal - For internal use only. - * Clears all the javascript message handlers for the message. - * This function must be called if the callbacks registered in handleJavascriptMessage are no longer needed. - * Failure to call this function may lead to memory leaks. - */ - _clearJavascriptMessageHandlers() { - delete jsMessageHandlers[this.id]; - } -} -exports.default = Message; -//# sourceMappingURL=Message.js.map \ No newline at end of file diff --git a/packages/messaging/dist/models/Message.js.map b/packages/messaging/dist/models/Message.js.map deleted file mode 100644 index 8eb99d7c..00000000 --- a/packages/messaging/dist/models/Message.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Message.js","sourceRoot":"","sources":["../../src/models/Message.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;EAUE;;AAEF,+CAAiE;AAEjE,MAAM,eAAe,GAAG,4BAAa,CAAC,YAAY,CAAC;AAEnD,gGAAgG;AAChG,kDAAkD;AAClD,MAAM,iBAAiB,GAA8D,EAAE,CAAC;AACxF,MAAM,2BAA2B,GAAG,IAAI,iCAAkB,CAAC,eAAe,CAAC,CAAC;AAE5E,6HAA6H;AAC7H,2BAA2B,CAAC,WAAW,CAAC,qBAAqB,EAAE,CAAC,KAAK,EAAE,EAAE;IACvE,MAAM,EAAC,SAAS,EAAE,WAAW,EAAE,OAAO,EAAC,GAAG,KAAK,CAAC;IAChD,IAAI,iBAAiB,CAAC,SAAS,CAAC,IAAI,iBAAiB,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,EAAE;QAC7E,iBAAiB,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC;KACpD;AACH,CAAC,CAAC,CAAC;AAEH,MAAM,OAAO;IAIX,YAAY,EAAE,EAAE,EAAE,SAAS,GAAG,KAAK,EAAsC;QACvE,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAED;;;;OAIG;IACH,YAAY,CAAC,SAAkB;QAC7B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,eAAe,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;IACnD,CAAC;IAED;;;OAGG;IACH,IAAI;QACF,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAChC,CAAC;IAED;;;;;OAKG;IACH,OAAO,CAAC,iBAA2B;QACjC,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACrE,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,WAAmB,EAAE,SAAiB;QAC1C,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;IACzD,CAAC;IAED;;;;OAIG;IACH,KAAK;QACH,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjC,CAAC;IAED;;;;;OAKG;IACH,uBAAuB,CAAC,WAAmB,EAAE,OAAkC;QAC7E,sBAAsB;QACtB,IAAI,CAAC,WAAW,EAAE;YAChB,OAAO,CAAC,IAAI,CAAC,kEAAkE,CAAC,CAAC;YACjF,OAAO;SACR;QAED,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE;YACjC,OAAO,CAAC,IAAI,CAAC,qEAAqE,CAAC,CAAC;YACpF,OAAO;SACR;QAED,qBAAqB;QACrB,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;YAC/B,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC;SACjC;QACD,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC;QAClD,eAAe,CAAC,uBAAuB,CAAC,IAAI,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC;IAChE,CAAC;IAED;;;;;OAKG;IACH,+BAA+B;QAC7B,OAAO,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpC,CAAC;CACF;AAED,kBAAe,OAAO,CAAC"} \ No newline at end of file diff --git a/packages/messaging/dist/models/MessagingDelegate.d.ts b/packages/messaging/dist/models/MessagingDelegate.d.ts deleted file mode 100644 index b43634cf..00000000 --- a/packages/messaging/dist/models/MessagingDelegate.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -import Message from './Message'; -export interface MessagingDelegate { - /** - * Invoked when the any message is displayed - * @param {Message} message: Message that is being displayed. - */ - onShow?(message: Message): void; - /** - * Invoked when any message is dismissed - * @param {Message} message: Message that is being dismissed - */ - onDismiss?(message: Message): void; - /** - * Used to determine whether a message should be cached, so it can be used later. Return true if the message should be cached. - * Note: Message must be cached in order to call any of the functions of the message object - */ - shouldSaveMessage?(message: Message): boolean; - /** - * Used to find whether messages should be shown or not - * @param {Message} message: Message that is about to get displayed - * @returns {boolean}: true if the message should be shown else false - */ - shouldShowMessage?(message: Message): boolean; - /** - * IOS Only - Called when message loads a URL - * @param {string} url: the URL being loaded by the message - * @param {Message} message: the Message loading a URL - */ - urlLoaded?(url: string, message: Message): void; - /** - * Android Only - Called when message loads - * @param {Message} message: the Message loaded - */ - onContentLoaded?(message: Message): void; -} diff --git a/packages/messaging/dist/models/MessagingDelegate.js b/packages/messaging/dist/models/MessagingDelegate.js deleted file mode 100644 index 3456c437..00000000 --- a/packages/messaging/dist/models/MessagingDelegate.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; -/* -Copyright 2023 Adobe. All rights reserved. -This file is licensed to you under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. You may obtain a copy -of the License at http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under -the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS -OF ANY KIND, either express or implied. See the License for the specific language -governing permissions and limitations under the License. -*/ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=MessagingDelegate.js.map \ No newline at end of file diff --git a/packages/messaging/dist/models/MessagingDelegate.js.map b/packages/messaging/dist/models/MessagingDelegate.js.map deleted file mode 100644 index 43824c87..00000000 --- a/packages/messaging/dist/models/MessagingDelegate.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"MessagingDelegate.js","sourceRoot":"","sources":["../../src/models/MessagingDelegate.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;EAUE"} \ No newline at end of file diff --git a/packages/messaging/dist/models/MessagingEdgeEventType.d.ts b/packages/messaging/dist/models/MessagingEdgeEventType.d.ts deleted file mode 100644 index ce609532..00000000 --- a/packages/messaging/dist/models/MessagingEdgeEventType.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -declare enum MessagingEdgeEventType { - DISMISS = 0, - INTERACT = 1, - TRIGGER = 2, - DISPLAY = 3, - PUSH_APPLICATION_OPENED = 4, - PUSH_CUSTOM_ACTION = 5 -} -export default MessagingEdgeEventType; diff --git a/packages/messaging/dist/models/MessagingEdgeEventType.js b/packages/messaging/dist/models/MessagingEdgeEventType.js deleted file mode 100644 index c62d50d5..00000000 --- a/packages/messaging/dist/models/MessagingEdgeEventType.js +++ /dev/null @@ -1,24 +0,0 @@ -"use strict"; -/* -Copyright 2023 Adobe. All rights reserved. -This file is licensed to you under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. You may obtain a copy -of the License at http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under -the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS -OF ANY KIND, either express or implied. See the License for the specific language -governing permissions and limitations under the License. -*/ -Object.defineProperty(exports, "__esModule", { value: true }); -var MessagingEdgeEventType; -(function (MessagingEdgeEventType) { - MessagingEdgeEventType[MessagingEdgeEventType["DISMISS"] = 0] = "DISMISS"; - MessagingEdgeEventType[MessagingEdgeEventType["INTERACT"] = 1] = "INTERACT"; - MessagingEdgeEventType[MessagingEdgeEventType["TRIGGER"] = 2] = "TRIGGER"; - MessagingEdgeEventType[MessagingEdgeEventType["DISPLAY"] = 3] = "DISPLAY"; - MessagingEdgeEventType[MessagingEdgeEventType["PUSH_APPLICATION_OPENED"] = 4] = "PUSH_APPLICATION_OPENED"; - MessagingEdgeEventType[MessagingEdgeEventType["PUSH_CUSTOM_ACTION"] = 5] = "PUSH_CUSTOM_ACTION"; -})(MessagingEdgeEventType || (MessagingEdgeEventType = {})); -exports.default = MessagingEdgeEventType; -//# sourceMappingURL=MessagingEdgeEventType.js.map \ No newline at end of file diff --git a/packages/messaging/dist/models/MessagingEdgeEventType.js.map b/packages/messaging/dist/models/MessagingEdgeEventType.js.map deleted file mode 100644 index 1fe365c4..00000000 --- a/packages/messaging/dist/models/MessagingEdgeEventType.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"MessagingEdgeEventType.js","sourceRoot":"","sources":["../../src/models/MessagingEdgeEventType.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;EAUE;;AAEF,IAAK,sBAOJ;AAPD,WAAK,sBAAsB;IACzB,yEAAW,CAAA;IACX,2EAAY,CAAA;IACZ,yEAAW,CAAA;IACX,yEAAW,CAAA;IACX,yGAA2B,CAAA;IAC3B,+FAAsB,CAAA;AACxB,CAAC,EAPI,sBAAsB,KAAtB,sBAAsB,QAO1B;AAED,kBAAe,sBAAsB,CAAC"} \ No newline at end of file diff --git a/packages/messaging/dist/models/MessagingProposition.d.ts b/packages/messaging/dist/models/MessagingProposition.d.ts deleted file mode 100644 index 4dd8e8d3..00000000 --- a/packages/messaging/dist/models/MessagingProposition.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { ScopeDetails } from './ScopeDetails'; -import { PropositionItem } from './PropositionItem'; -export declare class MessageProposition { - id: string; - scope: string; - scopeDetails: ScopeDetails; - items: PropositionItem[]; - constructor(raw: { - id: string; - scope: string; - scopeDetails: ScopeDetails; - items?: any[]; - }); -} -export { MessageProposition as MessagingProposition }; diff --git a/packages/messaging/dist/models/MessagingProposition.js b/packages/messaging/dist/models/MessagingProposition.js deleted file mode 100644 index ec015602..00000000 --- a/packages/messaging/dist/models/MessagingProposition.js +++ /dev/null @@ -1,59 +0,0 @@ -"use strict"; -/* - Copyright 2024 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law - or agreed to in writing, software distributed under the License is - distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF - ANY KIND, either express or implied. See the License for the specific - language governing permissions and limitations under the License. -*/ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.MessagingProposition = exports.MessageProposition = void 0; -const PersonalizationSchema_1 = require("./PersonalizationSchema"); -const ContentCard_1 = require("./ContentCard"); -const HTMLProposition_1 = require("./HTMLProposition"); -const JSONProposition_1 = require("./JSONProposition"); -const PropositionItem_1 = require("./PropositionItem"); -class MessageProposition { - constructor(raw) { - var _a, _b, _c, _d, _e, _f, _g; - this.id = (_a = raw === null || raw === void 0 ? void 0 : raw.id) !== null && _a !== void 0 ? _a : ''; - this.scope = (_b = raw === null || raw === void 0 ? void 0 : raw.scope) !== null && _b !== void 0 ? _b : ''; - this.scopeDetails = (_c = raw === null || raw === void 0 ? void 0 : raw.scopeDetails) !== null && _c !== void 0 ? _c : {}; - // Mirror activity.id into activity.activityID for convenience - const activityIdFromScope = (_f = (_e = (_d = this.scopeDetails) === null || _d === void 0 ? void 0 : _d.activity) === null || _e === void 0 ? void 0 : _e.id) !== null && _f !== void 0 ? _f : ''; - if ((_g = this.scopeDetails) === null || _g === void 0 ? void 0 : _g.activity) { - this.scopeDetails.activity.activityID = activityIdFromScope; - } - const rawItems = Array.isArray(raw === null || raw === void 0 ? void 0 : raw.items) ? raw.items : []; - this.items = rawItems.map((itemData) => { - var _a, _b, _c; - const activityId = (_c = (_b = (_a = this.scopeDetails) === null || _a === void 0 ? void 0 : _a.activity) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : ''; - let instance; - switch (itemData === null || itemData === void 0 ? void 0 : itemData.schema) { - case PersonalizationSchema_1.PersonalizationSchema.CONTENT_CARD: - instance = new ContentCard_1.ContentCard(itemData); - instance.activityID = activityId; - return instance; - case PersonalizationSchema_1.PersonalizationSchema.HTML_CONTENT: - instance = new HTMLProposition_1.HTMLProposition(itemData); - instance.activityID = activityId; - return instance; - case PersonalizationSchema_1.PersonalizationSchema.JSON_CONTENT: - instance = new JSONProposition_1.JSONPropositionItem(itemData); - instance.activityID = activityId; - return instance; - default: - instance = new PropositionItem_1.PropositionItem(itemData); - instance.activityID = activityId; - return instance; - } - }); - } -} -exports.MessageProposition = MessageProposition; -exports.MessagingProposition = MessageProposition; -//# sourceMappingURL=MessagingProposition.js.map \ No newline at end of file diff --git a/packages/messaging/dist/models/MessagingProposition.js.map b/packages/messaging/dist/models/MessagingProposition.js.map deleted file mode 100644 index 31e41b97..00000000 --- a/packages/messaging/dist/models/MessagingProposition.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"MessagingProposition.js","sourceRoot":"","sources":["../../src/models/MessagingProposition.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;EAUE;;;AAGF,mEAAgE;AAChE,+CAA4C;AAC5C,uDAAoD;AACpD,uDAAwD;AACxD,uDAAoD;AAEpD,MAAa,kBAAkB;IAM7B,YAAY,GAA6E;;QACvF,IAAI,CAAC,EAAE,GAAG,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,EAAE,mCAAI,EAAE,CAAC;QACxB,IAAI,CAAC,KAAK,GAAG,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,KAAK,mCAAI,EAAE,CAAC;QAC9B,IAAI,CAAC,YAAY,GAAG,MAAC,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,YAA6B,mCAAK,EAAmB,CAAC;QAEhF,8DAA8D;QAC9D,MAAM,mBAAmB,GAAG,MAAA,MAAA,MAAA,IAAI,CAAC,YAAY,0CAAE,QAAQ,0CAAE,EAAE,mCAAI,EAAE,CAAC;QAClE,IAAI,MAAA,IAAI,CAAC,YAAY,0CAAE,QAAQ,EAAE;YAC9B,IAAI,CAAC,YAAY,CAAC,QAAgB,CAAC,UAAU,GAAG,mBAAmB,CAAC;SACtE;QAED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ts deleted file mode 100644 index 99eacc4e..00000000 --- a/packages/messaging/dist/models/MessagingPropositionItem.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { ContentCard } from './ContentCard'; -import { HTMLProposition } from './HTMLProposition'; -import { JSONPropositionItem } from './JSONProposition'; -import { InAppMessage } from './InAppMessage'; -import { PropositionItem } from './PropositionItem'; -export type MessagingPropositionItem = ContentCard | HTMLProposition | InAppMessage | JSONPropositionItem | PropositionItem; diff --git a/packages/messaging/dist/models/MessagingPropositionItem.js b/packages/messaging/dist/models/MessagingPropositionItem.js deleted file mode 100644 index 4d3da402..00000000 --- a/packages/messaging/dist/models/MessagingPropositionItem.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; -/* - Copyright 2023 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law - or agreed to in writing, software distributed under the License is - distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF - ANY KIND, either express or implied. See the License for the specific - language governing permissions and limitations under the License. -*/ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=MessagingPropositionItem.js.map \ No newline at end of file diff --git a/packages/messaging/dist/models/MessagingPropositionItem.js.map b/packages/messaging/dist/models/MessagingPropositionItem.js.map deleted file mode 100644 index ca4c62a5..00000000 --- a/packages/messaging/dist/models/MessagingPropositionItem.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"MessagingPropositionItem.js","sourceRoot":"","sources":["../../src/models/MessagingPropositionItem.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;EAUE"} \ No newline at end of file diff --git a/packages/messaging/dist/models/PersonalizationSchema.d.ts b/packages/messaging/dist/models/PersonalizationSchema.d.ts deleted file mode 100644 index bb778d14..00000000 --- a/packages/messaging/dist/models/PersonalizationSchema.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export declare enum PersonalizationSchema { - CONTENT_CARD = "https://ns.adobe.com/personalization/message/content-card", - DEFAULT_CONTENT = "https://ns.adobe.com/personalization/default-content-item", - HTML_CONTENT = "https://ns.adobe.com/personalization/html-content-item", - IN_APP = "https://ns.adobe.com/personalization/message/in-app", - JSON_CONTENT = "https://ns.adobe.com/personalization/json-content-item", - NATIVE_ALERT = "https://ns.adobe.com/personalization/message/native-alert", - RULESET_ITEM = "https://ns.adobe.com/personalization/ruleset-item" -} diff --git a/packages/messaging/dist/models/PersonalizationSchema.js b/packages/messaging/dist/models/PersonalizationSchema.js deleted file mode 100644 index 46ca5c22..00000000 --- a/packages/messaging/dist/models/PersonalizationSchema.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -/* - Copyright 2024 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law - or agreed to in writing, software distributed under the License is - distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF - ANY KIND, either express or implied. See the License for the specific - language governing permissions and limitations under the License. -*/ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.PersonalizationSchema = void 0; -var PersonalizationSchema; -(function (PersonalizationSchema) { - PersonalizationSchema["CONTENT_CARD"] = "https://ns.adobe.com/personalization/message/content-card"; - PersonalizationSchema["DEFAULT_CONTENT"] = "https://ns.adobe.com/personalization/default-content-item"; - PersonalizationSchema["HTML_CONTENT"] = "https://ns.adobe.com/personalization/html-content-item"; - PersonalizationSchema["IN_APP"] = "https://ns.adobe.com/personalization/message/in-app"; - PersonalizationSchema["JSON_CONTENT"] = "https://ns.adobe.com/personalization/json-content-item"; - PersonalizationSchema["NATIVE_ALERT"] = "https://ns.adobe.com/personalization/message/native-alert"; - PersonalizationSchema["RULESET_ITEM"] = "https://ns.adobe.com/personalization/ruleset-item"; -})(PersonalizationSchema = exports.PersonalizationSchema || (exports.PersonalizationSchema = {})); -//# sourceMappingURL=PersonalizationSchema.js.map \ No newline at end of file diff --git a/packages/messaging/dist/models/PersonalizationSchema.js.map b/packages/messaging/dist/models/PersonalizationSchema.js.map deleted file mode 100644 index 895c6664..00000000 --- a/packages/messaging/dist/models/PersonalizationSchema.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"PersonalizationSchema.js","sourceRoot":"","sources":["../../src/models/PersonalizationSchema.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;EAUE;;;AAEF,IAAY,qBAQX;AARD,WAAY,qBAAqB;IAC/B,mGAA0E,CAAA;IAC1E,sGAA6E,CAAA;IAC7E,gGAAuE,CAAA;IACvE,uFAA8D,CAAA;IAC9D,gGAAuE,CAAA;IACvE,mGAA0E,CAAA;IAC1E,2FAAkE,CAAA;AACpE,CAAC,EARW,qBAAqB,GAArB,6BAAqB,KAArB,6BAAqB,QAQhC"} \ No newline at end of file diff --git a/packages/messaging/dist/models/PropositionItem.d.ts b/packages/messaging/dist/models/PropositionItem.d.ts deleted file mode 100644 index 9e395892..00000000 --- a/packages/messaging/dist/models/PropositionItem.d.ts +++ /dev/null @@ -1,83 +0,0 @@ -import { PersonalizationSchema } from './PersonalizationSchema'; -import MessagingEdgeEventType from './MessagingEdgeEventType'; -/** - * Base PropositionItem interface that all proposition items implement - */ -export interface PropositionItemData { - id: string; - uuid: string; - schema: PersonalizationSchema; - activityID: string; - data: { - [key: string]: any; - }; -} -/** - * A PropositionItem represents a personalization JSON object returned by Konductor. - * This is the base class that provides tracking functionality for all proposition items - * including ContentCards, InApp messages, and code-based experiences. - * - * This mirrors the native Android PropositionItem class functionality. - */ -export declare class PropositionItem { - id: string; - uuid: string; - activityID: string; - schema: PersonalizationSchema; - data: { - [key: string]: any; - }; - constructor(propositionItemData: PropositionItemData); - /** - * Gets the PropositionItem identifier. - * - * @returns {string} The PropositionItem identifier - */ - getItemId(): string; - /** - * Gets the PropositionItem content schema. - * - * @returns {PersonalizationSchema} The PropositionItem content schema - */ - getSchema(): PersonalizationSchema; - /** - * Gets the PropositionItem data. - * - * @returns {object} The PropositionItem data - */ - getItemData(): { - [key: string]: any; - }; - /** - * Tracks interaction with this proposition item. - * This is the core tracking method that all proposition items use. - * - * @param {MessagingEdgeEventType} eventType - The MessagingEdgeEventType specifying event type for the interaction - * - * @example - * propositionItem.track(MessagingEdgeEventType.DISPLAY); - */ - track(eventType: MessagingEdgeEventType): void; - /** - * Tracks interaction with this proposition item. - * - * @param {string | null} interaction - String describing the interaction - * @param {MessagingEdgeEventType} eventType - The MessagingEdgeEventType specifying event type for the interaction - * @param {string[] | null} tokens - Array containing the sub-item tokens for recording interaction - * - * @example - * // Track display - * propositionItem.track(null, MessagingEdgeEventType.DISPLAY, null); - * - * // Track interaction - * propositionItem.track("button_clicked", MessagingEdgeEventType.INTERACT, null); - * - * // Track with tokens - * propositionItem.track("click", MessagingEdgeEventType.INTERACT, ["token1", "token2"]); - */ - track(interaction: string | null, eventType: MessagingEdgeEventType, tokens: string[] | null): void; - /** - * Internal method that performs the actual tracking - */ - private trackWithDetails; -} diff --git a/packages/messaging/dist/models/PropositionItem.js b/packages/messaging/dist/models/PropositionItem.js deleted file mode 100644 index 0ef3f3f3..00000000 --- a/packages/messaging/dist/models/PropositionItem.js +++ /dev/null @@ -1,78 +0,0 @@ -"use strict"; -/* - Copyright 2025 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law - or agreed to in writing, software distributed under the License is - distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF - ANY KIND, either express or implied. See the License for the specific - language governing permissions and limitations under the License. -*/ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.PropositionItem = void 0; -const react_native_1 = require("react-native"); -const RCTAEPMessaging = react_native_1.NativeModules.AEPMessaging; -/** - * A PropositionItem represents a personalization JSON object returned by Konductor. - * This is the base class that provides tracking functionality for all proposition items - * including ContentCards, InApp messages, and code-based experiences. - * - * This mirrors the native Android PropositionItem class functionality. - */ -class PropositionItem { - constructor(propositionItemData) { - this.id = propositionItemData.id; - this.schema = propositionItemData.schema; - this.data = propositionItemData.data; - this.uuid = propositionItemData.uuid; - this.activityID = propositionItemData.activityID; - } - /** - * Gets the PropositionItem identifier. - * - * @returns {string} The PropositionItem identifier - */ - getItemId() { - return this.id; - } - /** - * Gets the PropositionItem content schema. - * - * @returns {PersonalizationSchema} The PropositionItem content schema - */ - getSchema() { - return this.schema; - } - /** - * Gets the PropositionItem data. - * - * @returns {object} The PropositionItem data - */ - getItemData() { - return this.data; - } - // Implementation - track(interactionOrEventType, eventType, tokens) { - // Handle overloaded method signatures - if (typeof interactionOrEventType === 'number' && eventType === undefined) { - // First overload: track(eventType) - this.trackWithDetails(null, interactionOrEventType, null); - } - else if (typeof interactionOrEventType === 'string' || interactionOrEventType === null) { - // Second overload: track(interaction, eventType, tokens) - this.trackWithDetails(interactionOrEventType, eventType, tokens || null); - } - } - /** - * Internal method that performs the actual tracking - */ - trackWithDetails(interaction, eventType, tokens) { - var _a; - const nativeIdentifier = (_a = this.activityID) !== null && _a !== void 0 ? _a : null; - RCTAEPMessaging.trackPropositionItem(nativeIdentifier, interaction, eventType, tokens); - } -} -exports.PropositionItem = PropositionItem; -//# sourceMappingURL=PropositionItem.js.map \ No newline at end of file diff --git a/packages/messaging/dist/models/PropositionItem.js.map b/packages/messaging/dist/models/PropositionItem.js.map deleted file mode 100644 index 72ee6193..00000000 --- a/packages/messaging/dist/models/PropositionItem.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"PropositionItem.js","sourceRoot":"","sources":["../../src/models/PropositionItem.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;EAUE;;;AAEF,+CAA6C;AAI7C,MAAM,eAAe,GAAG,4BAAa,CAAC,YAAY,CAAC;AAenD;;;;;;GAMG;AACH,MAAa,eAAe;IAO1B,YAA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newline at end of file diff --git a/packages/messaging/dist/models/ScopeDetails.d.ts b/packages/messaging/dist/models/ScopeDetails.d.ts deleted file mode 100644 index ee6689fa..00000000 --- a/packages/messaging/dist/models/ScopeDetails.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -export interface Activity { - matchedSurfaces: string[]; - id: string; -} -export interface Characteristics { - eventToken: string; -} -export interface ScopeDetails { - activity: Activity; - characteristics: Characteristics; - correlationID: string; - decisionProvider: string; -} diff --git a/packages/messaging/dist/models/ScopeDetails.js b/packages/messaging/dist/models/ScopeDetails.js deleted file mode 100644 index 2ffb4b02..00000000 --- a/packages/messaging/dist/models/ScopeDetails.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; -/* - Copyright 2024 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law - or agreed to in writing, software distributed under the License is - distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF - ANY KIND, either express or implied. See the License for the specific - language governing permissions and limitations under the License. -*/ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=ScopeDetails.js.map \ No newline at end of file diff --git a/packages/messaging/dist/models/ScopeDetails.js.map b/packages/messaging/dist/models/ScopeDetails.js.map deleted file mode 100644 index ce9662af..00000000 --- a/packages/messaging/dist/models/ScopeDetails.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ScopeDetails.js","sourceRoot":"","sources":["../../src/models/ScopeDetails.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;EAUE"} \ No newline at end of file diff --git a/packages/messaging/dist/models/index.d.ts b/packages/messaging/dist/models/index.d.ts deleted file mode 100644 index 2dfc8c71..00000000 --- a/packages/messaging/dist/models/index.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -export * from './ContentCard'; -export * from './InAppMessage'; -export * from './JSONProposition'; -export * from './Message'; -export * from './MessagingDelegate'; -export * from './MessagingEdgeEventType'; -export * from './MessagingProposition'; -export * from './MessagingPropositionItem'; -export * from './PersonalizationSchema'; -export * from './ScopeDetails'; diff --git a/packages/messaging/dist/models/index.js b/packages/messaging/dist/models/index.js deleted file mode 100644 index ea1d5340..00000000 --- a/packages/messaging/dist/models/index.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -tslib_1.__exportStar(require("./ContentCard"), exports); -tslib_1.__exportStar(require("./InAppMessage"), exports); -tslib_1.__exportStar(require("./JSONProposition"), exports); -tslib_1.__exportStar(require("./Message"), exports); -tslib_1.__exportStar(require("./MessagingDelegate"), exports); -tslib_1.__exportStar(require("./MessagingEdgeEventType"), exports); -tslib_1.__exportStar(require("./MessagingProposition"), exports); -tslib_1.__exportStar(require("./MessagingPropositionItem"), exports); -tslib_1.__exportStar(require("./PersonalizationSchema"), exports); -tslib_1.__exportStar(require("./ScopeDetails"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/messaging/dist/models/index.js.map b/packages/messaging/dist/models/index.js.map deleted file mode 100644 index 33916134..00000000 --- a/packages/messaging/dist/models/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":";;;AAAA,wDAA8B;AAC9B,yDAA+B;AAC/B,4DAAkC;AAClC,oDAA0B;AAC1B,8DAAoC;AACpC,mEAAyC;AACzC,iEAAuC;AACvC,qEAA2C;AAC3C,kEAAwC;AACxC,yDAA+B"} \ No newline at end of file diff --git a/packages/messaging/dist/module/Messaging.js b/packages/messaging/dist/module/Messaging.js index 5389598c..2e19e18d 100644 --- a/packages/messaging/dist/module/Messaging.js +++ b/packages/messaging/dist/module/Messaging.js @@ -196,19 +196,21 @@ class Messaging { unread_indicator: { unread_bg: { clr: { - light: "#000000", - dark: "#000000" + light: "#FFF3E0", + // Light orange background for unread cards + dark: "#2D1B0E" // Dark orange background for unread cards } }, unread_icon: { placement: "topright", image: { - url: "https://www.adobe.com", - darkUrl: "https://www.adobe.com" + url: "https://icons.veryicon.com/png/o/leisure/crisp-app-icon-library-v3/notification-5.png", + // Image in light mode + darkUrl: "" // Empty URL = shows dot in dark mode } } }, - isUnreadEnabled: false + isUnreadEnabled: true // Enable unread features! }, showPagination: false }; diff --git a/packages/messaging/dist/module/Messaging.js.map b/packages/messaging/dist/module/Messaging.js.map index f774fb6b..548852ca 100644 --- a/packages/messaging/dist/module/Messaging.js.map +++ b/packages/messaging/dist/module/Messaging.js.map @@ -1 +1 @@ -{"version":3,"names":["NativeModules","NativeEventEmitter","Platform","Message","MessagingProposition","PersonalizationSchema","ContentTemplate","RCTAEPMessaging","AEPMessaging","messagingDelegate","Messaging","extensionVersion","Promise","resolve","refreshInAppMessages","getCachedMessages","messages","map","msg","getLatestMessage","message","undefined","getPropositionsForSurfaces","surfaces","propositionsList","messagingPropositionsForSurfaces","surface","propositions","Object","entries","proposition","trackContentCardDisplay","contentCard","trackContentCardInteraction","trackPropositionItem","itemId","interaction","eventType","tokens","setMessagingDelegate","delegate","eventEmitter","addListener","onShow","messageInstance","_clearJavascriptMessageHandlers","onDismiss","shouldShowMessage","shouldSaveMessage","setMessageSettings","OS","event","urlLoaded","url","onContentLoaded","removeAllListeners","updatePropositionsForSurfaces","getContentCardUI","length","contentCards","flatMap","items","filter","item","schema","CONTENT_CARD","card","type","data","meta","adobe","template"],"sourceRoot":"../../src","sources":["Messaging.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SACEA,aAAa,EACbC,kBAAkB,EAElBC,QAAQ,QACH,cAAc;AACrB,OAAOC,OAAO,MAAM,qBAAkB;AAEtC,SAASC,oBAAoB,QAAQ,kCAA+B;AAEpE,SAASC,qBAAqB,QAAQ,mCAAgC;AACtE,SAASC,eAAe,QAAQ,yBAAsB;AAiCtD,MAAMC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CjC,QAAkB,EACH;IACf,OAAO,MAAMhB,eAAe,CAACiD,6BAA6B,CAACjC,QAAQ,CAAC;EACtE;;EAEA;AACF;AACA;AACA;AACA;AACA;EACE,aAAakC,gBAAgBA,CAAC/B,OAAe,EAA8B;IACzE,MAAMV,QAAQ,GAAG,MAAMN,SAAS,CAACY,0BAA0B,CAAC,CAACI,OAAO,CAAC,CAAC;IACtE,MAAMC,YAAY,GAAGX,QAAQ,CAACU,OAAO,CAAC;IACtC,IAAI,CAACC,YAAY,EAAE+B,MAAM,EAAE;MACzB,OAAO,EAAE;IACX;IACA,MAAMC,YAAY,GAAGhC,YAAY,CAC9BiC,OAAO,CAAE9B,WAAW,IACnBA,WAAW,CAAC+B,KAAK,CAACC,MAAM,CACrBC,IAAI,IAAKA,IAAI,CAACC,MAAM,KAAK3D,qBAAqB,CAAC4D,YAClD,CACF,CAAC;IAEH,IAAI,CAACN,YAAY,EAAED,MAAM,EAAE;MACzB,OAAO,EAAE;IACX;IAEA,OAAOC,YAAY,CAAC1C,GAAG,CAAEiD,IAAS,IAAK;MACrC,MAAMC,IAAI,GAAGD,IAAI,CAACE,IAAI,EAAEC,IAAI,EAAEC,KAAK,EAAEC,QAAQ,IAAI,YAAY;MAC7D,OAAO,IAAIjE,eAAe,CAAC4D,IAAI,EAAEC,IAAI,CAAC;IACxC,CAAC,CAAC;EACJ;AACF;AAEA,eAAezD,SAAS","ignoreList":[]} +{"version":3,"names":["NativeModules","NativeEventEmitter","Platform","Message","MessagingProposition","PersonalizationSchema","ContentTemplate","RCTAEPMessaging","AEPMessaging","messagingDelegate","Messaging","extensionVersion","Promise","resolve","refreshInAppMessages","getCachedMessages","messages","map","msg","getLatestMessage","message","undefined","getPropositionsForSurfaces","surfaces","propositionsList","messagingPropositionsForSurfaces","surface","propositions","Object","entries","proposition","trackContentCardDisplay","contentCard","trackContentCardInteraction","trackPropositionItem","itemId","interaction","eventType","tokens","setMessagingDelegate","delegate","eventEmitter","addListener","onShow","messageInstance","_clearJavascriptMessageHandlers","onDismiss","shouldShowMessage","shouldSaveMessage","setMessageSettings","OS","event","urlLoaded","url","onContentLoaded","removeAllListeners","updatePropositionsForSurfaces","getContentCardUI","length","contentCards","flatMap","items","filter","item","schema","CONTENT_CARD","card","type","data","meta","adobe","template","getContentCardContainer","console","log","templateType","content","heading","layout","orientation","capacity","emptyStateSettings","unread_indicator","unread_bg","clr","light","dark","unread_icon","placement","image","darkUrl","isUnreadEnabled","showPagination"],"sourceRoot":"../../src","sources":["Messaging.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SACEA,aAAa,EACbC,kBAAkB,EAElBC,QAAQ,QACH,cAAc;AACrB,OAAOC,OAAO,MAAM,qBAAkB;AAEtC,SAASC,oBAAoB,QAAQ,kCAA+B;AAEpE,SAASC,qBAAqB,QAAQ,mCAAgC;AACtE,SAASC,eAAe,QAAQ,yBAAsB;AAkCtD,MAAMC,eAAqD,GACzDP,aAAa,CAACQ,YAAY;AAG5B,IAAIC,iBAAoC;AAExC,MAAMC,SAAS,CAAC;EACd;AACF;AACA;AACA;EACE,OAAOC,gBAAgBA,CAAA,EAAoB;IACzC,OAAOC,OAAO,CAACC,OAAO,CAACN,eAAe,CAACI,gBAAgB,CAAC,CAAC,CAAC;EAC5D;;EAEA;AACF;AACA;EACE,OAAOG,oBAAoBA,CAAA,EAAG;IAC5BP,eAAe,CAACO,oBAAoB,CAAC,CAAC;EACxC;;EAEA;AACF;AACA;AACA;AACA;AACA;EACE,aAAaC,iBAAiBA,CAAA,EAAuB;IACnD,MAAMC,QAAQ,GAAG,MAAMT,eAAe,CAACQ,iBAAiB,CAAC,CAAC;IAC1D,OAAOC,QAAQ,CAACC,GAAG,CAAEC,GAAG,IAAK,IAAIf,OAAO,CAACe,GAAG,CAAC,CAAC;EAChD;;EAEA;AACF;AACA;AACA;EACE,aAAaC,gBAAgBA,CAAA,EAAwC;IACnE,MAAMC,OAAO,GAAG,M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AAC1C,GAAG,CAAEiD,IAAS,IAAK;MACrC,MAAMC,IAAI,GAAGD,IAAI,CAACE,IAAI,EAAEC,IAAI,EAAEC,KAAK,EAAEC,QAAQ,IAAI,YAAY;MAC7D,OAAO,IAAIjE,eAAe,CAAC4D,IAAI,EAAEC,IAAI,CAAC;IACxC,CAAC,CAAC;EACJ;EAEA,aAAaK,uBAAuBA,CAClC9C,OAAe,EACa;IAC5B+C,OAAO,CAACC,GAAG,CAAC,yBAAyB,EAAEhD,OAAO,CAAC;IAC/C,OAAO;MACLiD,YAAY,EAAE,OAAO;MACrBC,OAAO,EAAE;QACPC,OAAO,EAAE;UACPD,OAAO,EAAE;QACX,CAAC;QACDE,MAAM,EAAE;UACNC,WAAW,EAAE;QACf,CAAC;QACDC,QAAQ,EAAE,EAAE;QACZC,kBAAkB,EAAE;UAClB7D,OAAO,EAAE;YACPwD,OAAO,EAAE;UACX;QACF,CAAC;QACDM,gBAAgB,EAAE;UAChBC,SAAS,EAAE;YACTC,GAAG,EAAE;cACHC,KAAK,EAAE,SAAS;cAAG;cACnBC,IAAI,EAAE,SAAS,CAAI;YACrB;UACF,CAAC;UACDC,WAAW,EAAE;YACXC,SAAS,EAAE,UAAU;YACrBC,KAAK,EAAE;cACLpC,GAAG,EAAE,uFAAuF;cAAG;cAC/FqC,OAAO,EAAE,EAAE,CAAG;YAChB;UACF;QACF,CAAC;QACDC,eAAe,EAAE,IAAI,CAAG;MAC1B,CAAC;MACDC,cAAc,EAAE;IAClB,CAAC;EACH;AACF;AAEA,eAAelF,SAAS","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/components/ContentCardView/ContentCardView.js b/packages/messaging/dist/module/ui/components/ContentCardView/ContentCardView.js index fe74c0f4..ab15e6f4 100644 --- a/packages/messaging/dist/module/ui/components/ContentCardView/ContentCardView.js +++ b/packages/messaging/dist/module/ui/components/ContentCardView/ContentCardView.js @@ -17,9 +17,12 @@ import React, { useEffect, useCallback, useState, useRef, useMemo } from 'react' import { Image, Linking, Pressable, StyleSheet, Text, useColorScheme, View } from 'react-native'; import MessagingEdgeEventType from "../../../models/MessagingEdgeEventType.js"; import DismissButton from "../DismissButton/DismissButton.js"; +import UnreadIcon from "../UnreadIcon/UnreadIcon.js"; import { useTheme } from "../../theme/index.js"; import useAspectRatio from "../../hooks/useAspectRatio.js"; import Button from "../Button/Button.js"; +import { useContext } from 'react'; +import { ContentCardContainerContext } from "../../providers/ContentCardContainerProvider.js"; export const ContentCardView = ({ template, listener, @@ -40,8 +43,19 @@ export const ContentCardView = ({ }) => { const colorScheme = useColorScheme(); const [isVisible, setIsVisible] = useState(true); + const [isRead, setIsRead] = useState(false); const isDisplayedRef = useRef(false); const theme = useTheme(); + const containerSettings = useContext(ContentCardContainerContext); + + // Get unread background color based on theme + const getUnreadBackgroundColor = () => { + if (!containerSettings?.content?.isUnreadEnabled || isRead || !containerSettings.content.unread_indicator?.unread_bg) { + return undefined; + } + const unreadBg = containerSettings.content.unread_indicator.unread_bg; + return colorScheme === 'dark' ? unreadBg.clr.dark : unreadBg.clr.light; + }; const cardVariant = useMemo(() => variant ?? template.type ?? 'SmallImage', [variant, template.type]); const onDismiss = useCallback(() => { listener?.('onDismiss', template); @@ -55,6 +69,9 @@ export const ContentCardView = ({ // Track interaction event using propositionItem template.track?.('content_clicked', MessagingEdgeEventType.INTERACT, null); + + // Mark as read when interacted with + setIsRead(true); if (template.data?.content?.actionUrl) { try { Linking.openURL(template.data.content.actionUrl); @@ -70,8 +87,6 @@ export const ContentCardView = ({ return template.data.content.image?.url; }, [colorScheme, template.data?.content?.image?.darkUrl, template.data?.content?.image?.url]); const imageAspectRatio = useAspectRatio(imageUri); - - // Calculate styleOverrides before any early returns const styleOverrides = useMemo(() => { switch (cardVariant) { case 'SmallImage': @@ -106,7 +121,9 @@ export const ContentCardView = ({ onPress: onPress, style: state => [styles.card, styleOverrides?.card, typeof style === 'function' ? style(state) : style] }, props), /*#__PURE__*/React.createElement(View, _extends({ - style: [cardVariant === 'SmallImage' ? smallImageStyles.container : styles.container, styleOverrides?.container] + style: [cardVariant === 'SmallImage' ? smallImageStyles.container : styles.container, styleOverrides?.container, getUnreadBackgroundColor() && { + backgroundColor: getUnreadBackgroundColor() + }] }, ContainerProps), imageUri && /*#__PURE__*/React.createElement(View, _extends({ style: [cardVariant === 'SmallImage' ? smallImageStyles.imageContainer : styles.imageContainer, styleOverrides?.imageContainer] }, ImageContainerProps), /*#__PURE__*/React.createElement(Image, _extends({ @@ -139,7 +156,7 @@ export const ContentCardView = ({ }, ButtonProps))))), content?.dismissBtn && content.dismissBtn?.style !== 'none' && /*#__PURE__*/React.createElement(DismissButton, _extends({ onPress: onDismiss, type: content.dismissBtn.style - }, DismissButtonProps)))); + }, DismissButtonProps)), containerSettings?.content?.isUnreadEnabled && !isRead && /*#__PURE__*/React.createElement(UnreadIcon, null))); }; const styles = StyleSheet.create({ card: { diff --git a/packages/messaging/dist/module/ui/components/ContentCardView/ContentCardView.js.map b/packages/messaging/dist/module/ui/components/ContentCardView/ContentCardView.js.map index d0fd3c5c..85ce042c 100644 --- a/packages/messaging/dist/module/ui/components/ContentCardView/ContentCardView.js.map +++ b/packages/messaging/dist/module/ui/components/ContentCardView/ContentCardView.js.map @@ -1 +1 @@ -{"version":3,"names":["React","useEffect","useCallback","useState","useRef","useMemo","Image","Linking","Pressable","StyleSheet","Text","useColorScheme","View","MessagingEdgeEventType","DismissButton","useTheme","useAspectRatio","Button","ContentCardView","template","listener","variant","styleOverrides","_styleOverrides","style","ContainerProps","ImageContainerProps","ImageProps","ContentContainerProps","TextProps","TitleProps","BodyProps","ButtonContainerProps","ButtonProps","DismissButtonProps","props","colorScheme","isVisible","setIsVisible","isDisplayedRef","theme","cardVariant","type","onDismiss","track","DISMISS","onPress","INTERACT","data","content","actionUrl","openURL","error","console","warn","imageUri","image","darkUrl","url","imageAspectRatio","smallImageStyle","largeImageStyle","imageOnlyStyle","current","DISPLAY","createElement","_extends","state","styles","card","smallImageStyles","container","imageContainer","source","uri","aspectRatio","resizeMode","contentContainer","title","color","colors","textPrimary","text","body","buttonContainer","buttons","length","map","button","key","id","textStyle","buttonText","dismissBtn","create","margin","flex","flexDirection","alignItems","borderRadius","backgroundColor","width","paddingVertical","paddingHorizontal","justifyContent","textContent","marginBottom","fontSize","fontWeight","marginRight","lineHeight","flexWrap","paddingTop","gap","marginHorizontal","maxWidth","alignSelf"],"sourceRoot":"../../../../../src","sources":["ui/components/ContentCardView/ContentCardView.tsx"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,IACVC,SAAS,EACTC,WAAW,EACXC,QAAQ,EACRC,MAAM,EACNC,OAAO,QACF,OAAO;AASd,SACEC,KAAK,EACLC,OAAO,EACPC,SAAS,EAETC,UAAU,EACVC,IAAI,EACJC,cAAc,EACdC,IAAI,QACC,cAAc;AACrB,OAAOC,sBAAsB,MAAM,2CAAwC;AAC3E,OAAOC,aAAa,MAAM,mCAAgC;AAC1D,SAASC,QAAQ,QAAQ,sBAAa;AACtC,OAAOC,cAAc,MAAM,+BAA4B;AAEvD,OAAOC,MAAM,MAAM,qBAAkB;AAqBrC,OAAO,MAAMC,eAA2C,GAAGA,CAAC;EAC1DC,QAAQ;EACRC,QAAQ;EACRC,OAAO;EACPC,cAAc,EAAEC,eAAe;EAC/BC,KAAK;EACLC,cAAc;EACdC,mBAAmB;EACnBC,UAAU;EACVC,qBAAqB;EACrBC,SAAS;EACTC,UAAU;EACVC,SAAS;EACTC,oBAAoB;EACpBC,WAAW;EACXC,kBAAkB;EAClB,GAAGC;AACL,CAAC,KAAK;EACJ,MAAMC,WAAW,GAAGzB,cAAc,CAAC,CAAC;EACpC,MAAM,CAAC0B,SAAS,EAAEC,YAAY,CAAC,GAAGnC,QAAQ,CAAC,IAAI,CAAC;EAChD,MAAMoC,cAAc,GAAGnC,MAAM,CAAC,KAAK,CAAC;EACpC,MAAMoC,KAAK,GAAGzB,QAAQ,CAAC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ACbC,GAAG,EAAE;EACP,CAAC;EACDzB,MAAM,EAAE;IACN0B,gBAAgB,EAAE;EACpB;AACF,CAAC,CAAC;AAEF,MAAM5C,gBAAgB,GAAG7D,UAAU,CAACqF,MAAM,CAAC;EACzCzB,IAAI,EAAE;IACJ8B,YAAY,EAAE,EAAE;IAChBF,aAAa,EAAE,KAAK;IACpBgB,GAAG,EAAE,CAAC;IACNE,QAAQ,EAAE,MAAM;IAChBjB,UAAU,EAAE;EACd,CAAC;EACD3B,SAAS,EAAE;IACT0B,aAAa,EAAE;EACjB,CAAC;EACDzB,cAAc,EAAE;IACd2B,YAAY,EAAE,EAAE;IAChBgB,QAAQ,EAAE,KAAK;IACfC,SAAS,EAAE;EACb,CAAC;EACD5D,KAAK,EAAE;IACLoB,UAAU,EAAE,SAAS;IACrByB,KAAK,EAAE,MAAM;IACbc,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]} +{"version":3,"names":["React","useEffect","useCallback","useState","useRef","useMemo","Image","Linking","Pressable","StyleSheet","Text","useColorScheme","View","MessagingEdgeEventType","DismissButton","UnreadIcon","useTheme","useAspectRatio","Button","useContext","ContentCardContainerContext","ContentCardView","template","listener","variant","styleOverrides","_styleOverrides","style","ContainerProps","ImageContainerProps","ImageProps","ContentContainerProps","TextProps","TitleProps","BodyProps","ButtonContainerProps","ButtonProps","DismissButtonProps","props","colorScheme","isVisible","setIsVisible","isRead","setIsRead","isDisplayedRef","theme","containerSettings","getUnreadBackgroundColor","content","isUnreadEnabled","unread_indicator","unread_bg","undefined","unreadBg","clr","dark","light","cardVariant","type","onDismiss","track","DISMISS","onPress","INTERACT","data","actionUrl","openURL","error","console","warn","imageUri","image","darkUrl","url","imageAspectRatio","smallImageStyle","largeImageStyle","imageOnlyStyle","current","DISPLAY","createElement","_extends","state","styles","card","smallImageStyles","container","backgroundColor","imageContainer","source","uri","aspectRatio","resizeMode","contentContainer","title","color","colors","textPrimary","text","body","buttonContainer","buttons","length","map","button","key","id","textStyle","buttonText","dismissBtn","create","margin","flex","flexDirection","alignItems","borderRadius","width","paddingVertical","paddingHorizontal","justifyContent","textContent","marginBottom","fontSize","fontWeight","marginRight","lineHeight","flexWrap","paddingTop","gap","marginHorizontal","maxWidth","alignSelf"],"sourceRoot":"../../../../../src","sources":["ui/components/ContentCardView/ContentCardView.tsx"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,IACVC,SAAS,EACTC,WAAW,EACXC,QAAQ,EACRC,MAAM,EACNC,OAAO,QACF,OAAO;AASd,SACEC,KAAK,EACLC,OAAO,EACPC,SAAS,EAETC,UAAU,EACVC,IAAI,EACJC,cAAc,EACdC,IAAI,QACC,cAAc;AACrB,OAAOC,sBAAsB,MAAM,2CAAwC;AAC3E,OAAOC,aAAa,MAAM,mCAAgC;AAC1D,OAAOC,UAAU,MAAM,6BAA0B;AACjD,SAASC,QAAQ,QAAQ,sBAAa;AACtC,OAAOC,cAAc,MAAM,+BAA4B;AAEvD,OAAOC,MAAM,MAAM,qBAAkB;AACrC,SAASC,UAAU,QAAQ,OAAO;AAClC,SAASC,2BAA2B,QAAQ,iDAA8C;AAqB1F,OAAO,MAAMC,eAA2C,GAAGA,CAAC;EAC1DC,QAAQ;EACRC,QAAQ;EACRC,OAAO;EACPC,cAAc,EAAEC,eAAe;EAC/BC,KAAK;EACLC,cAAc;EACdC,mBAAmB;EACnBC,UAAU;EACVC,qBAAqB;EACrBC,SAAS;EACTC,UAAU;EACVC,SAAS;EACTC,oBAAoB;EACpBC,WAAW;EACXC,kBAAkB;EAClB,GAAGC;AACL,CAAC,KAAK;EACJ,MAAMC,WAAW,GAAG5B,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,EAAE,MAAM;IAChBhB,UAAU,EAAE;EACd,CAAC;EACD5B,SAAS,EAAE;IACT2B,aAAa,EAAE;EACjB,CAAC;EACDzB,cAAc,EAAE;IACd2B,YAAY,EAAE,EAAE;IAChBe,QAAQ,EAAE,KAAK;IACfC,SAAS,EAAE;EACb,CAAC;EACD5D,KAAK,EAAE;IACLqB,UAAU,EAAE,SAAS;IACrBwB,KAAK,EAAE,MAAM;IACbc,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.js b/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.js index d23becc6..dd9edbb4 100644 --- a/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.js +++ b/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.js @@ -1,8 +1,191 @@ "use strict"; -import { Text, View } from "react-native"; -function UnreadIcon() { - return /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(Text, null, "UnreadIcon")); -} +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); } +/* + Copyright 2025 Adobe. All rights reserved. + This file is licensed to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law + or agreed to in writing, software distributed under the License is + distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF + ANY KIND, either express or implied. See the License for the specific + language governing permissions and limitations under the License. +*/ +import React, { useState } from 'react'; +import { Image, StyleSheet, View, useColorScheme } from 'react-native'; +import useContainerSettings from "../../hooks/useContainerSettings.js"; +// Helper function to convert placement from settings to component position +const convertPlacement = placement => { + switch (placement) { + case 'topleft': + return 'top-left'; + case 'topright': + return 'top-right'; + case 'bottomleft': + return 'bottom-left'; + case 'bottomright': + return 'bottom-right'; + default: + return 'top-right'; + } +}; +const UnreadIcon = ({ + imageStyle, + containerStyle, + source, + darkSource, + size = 20, + position = 'top-right', + type = 'dot', + style, + ...props +}) => { + const colorScheme = useColorScheme(); + const settings = useContainerSettings(); + const [imageLoadError, setImageLoadError] = useState(false); + + // Get unread indicator settings from context + const unreadSettings = settings.content.unread_indicator; + + // Use settings from context with fallbacks to props + const displaySize = size; + const displayPosition = unreadSettings?.unread_icon?.placement ? convertPlacement(unreadSettings.unread_icon.placement) : position; + const renderType = unreadSettings?.unread_icon?.image ? 'image' : type; + const imageSource = unreadSettings?.unread_icon?.image?.url ? { + uri: unreadSettings.unread_icon.image.url + } : source; + const darkImageSource = unreadSettings?.unread_icon?.image?.darkUrl ? { + uri: unreadSettings.unread_icon.image.darkUrl + } : darkSource; + const getPositionStyle = () => { + const baseStyle = { + position: 'absolute', + zIndex: 1000 + }; + switch (displayPosition) { + case 'top-left': + return { + ...baseStyle, + top: 6, + left: 6 + }; + case 'top-right': + return { + ...baseStyle, + top: 6, + right: 6 + }; + case 'bottom-left': + return { + ...baseStyle, + bottom: 6, + left: 6 + }; + case 'bottom-right': + return { + ...baseStyle, + bottom: 6, + right: 6 + }; + default: + return { + ...baseStyle, + top: 6, + right: 6 + }; + } + }; + const getDotColor = () => { + // Use default contrasting colors for visibility + // Note: unread_bg.clr is for the card background, not the dot + return colorScheme === 'dark' ? '#FF6B6B' : '#FF4444'; + }; + const renderContent = () => { + // Check if we should show dot instead of image based on URL availability + const shouldShowDot = colorScheme === 'dark' && unreadSettings?.unread_icon?.image?.darkUrl === '' || colorScheme === 'light' && unreadSettings?.unread_icon?.image?.url === ''; + + // If URL is explicitly empty string for current mode, show dot + if (shouldShowDot && unreadSettings?.unread_icon?.image) { + return /*#__PURE__*/React.createElement(View, { + style: [styles.dot, { + width: displaySize, + height: displaySize, + borderRadius: displaySize / 2, + backgroundColor: getDotColor() + }] + }); + } + + // If image failed to load, fallback to dot + if (renderType === 'image' && imageLoadError) { + return /*#__PURE__*/React.createElement(View, { + style: [styles.dot, { + width: displaySize, + height: displaySize, + borderRadius: displaySize / 2, + backgroundColor: getDotColor() + }] + }); + } + if (renderType === 'image' && (imageSource || darkImageSource)) { + const finalImageSource = colorScheme === 'dark' && darkImageSource ? darkImageSource : imageSource; + return /*#__PURE__*/React.createElement(Image, { + source: finalImageSource, + style: [styles.image, { + width: displaySize, + height: displaySize + }, imageStyle], + resizeMode: "contain", + onError: error => { + console.warn('Failed to load unread icon image:', error.nativeEvent.error); + setImageLoadError(true); + } + }); + } + + // Default dot type + return /*#__PURE__*/React.createElement(View, { + style: [styles.dot, { + width: displaySize, + height: displaySize, + borderRadius: displaySize / 2, + backgroundColor: getDotColor() + }] + }); + }; + return /*#__PURE__*/React.createElement(View, _extends({ + style: [styles.container, getPositionStyle(), { + minWidth: displaySize, + minHeight: displaySize + }, containerStyle, typeof style === 'object' ? style : undefined] + }, props), renderContent()); +}; export default UnreadIcon; +const styles = StyleSheet.create({ + container: { + justifyContent: 'center', + alignItems: 'center' + }, + dot: { + shadowColor: '#000', + shadowOffset: { + width: 0, + height: 1 + }, + shadowOpacity: 0.22, + shadowRadius: 2.22, + elevation: 3 + }, + image: { + shadowColor: '#000', + shadowOffset: { + width: 0, + height: 1 + }, + shadowOpacity: 0.22, + shadowRadius: 2.22, + elevation: 3 + } +}); //# sourceMappingURL=UnreadIcon.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.js.map b/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.js.map index ec5d28d9..c9c5ad40 100644 --- a/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.js.map +++ b/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.js.map @@ -1 +1 @@ -{"version":3,"names":["Text","View","UnreadIcon","React","createElement"],"sourceRoot":"../../../../../src","sources":["ui/components/UnreadIcon/UnreadIcon.tsx"],"mappings":";;AAAA,SAASA,IAAI,EAAEC,IAAI,QAAQ,cAAc;AAEzC,SAASC,UAAUA,CAAA,EAAG;EACpB,oBACEC,KAAA,CAAAC,aAAA,CAACH,IAAI,qBACHE,KAAA,CAAAC,aAAA,CAACJ,IAAI,QAAC,YAAgB,CAClB,CAAC;AAEX;AAEA,eAAeE,UAAU","ignoreList":[]} +{"version":3,"names":["React","useState","Image","StyleSheet","View","useColorScheme","useContainerSettings","convertPlacement","placement","UnreadIcon","imageStyle","containerStyle","source","darkSource","size","position","type","style","props","colorScheme","settings","imageLoadError","setImageLoadError","unreadSettings","content","unread_indicator","displaySize","displayPosition","unread_icon","renderType","image","imageSource","url","uri","darkImageSource","darkUrl","getPositionStyle","baseStyle","zIndex","top","left","right","bottom","getDotColor","renderContent","shouldShowDot","createElement","styles","dot","width","height","borderRadius","backgroundColor","finalImageSource","resizeMode","onError","error","console","warn","nativeEvent","_extends","container","minWidth","minHeight","undefined","create","justifyContent","alignItems","shadowColor","shadowOffset","shadowOpacity","shadowRadius","elevation"],"sourceRoot":"../../../../../src","sources":["ui/components/UnreadIcon/UnreadIcon.tsx"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SACEC,KAAK,EAGLC,UAAU,EACVC,IAAI,EAGJC,cAAc,QACT,cAAc;AACrB,OAAOC,oBAAoB,MAAM,qCAAkC;AAYnE;AACA,MAAMC,gBAAgB,GAAIC,SAAgE,IAAgE;EACxJ,QAAQA,SAAS;IACf,KAAK,SAAS;MACZ,OAAO,UAAU;IACnB,KAAK,UAAU;MACb,OAAO,WAAW;I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CAAA8C,aAAA,CAAC1C,IAAI,EAAAwD,QAAA;IACH3C,KAAK,EAAE,CACL8B,MAAM,CAACc,SAAS,EAChBzB,gBAAgB,CAAC,CAAC,EAClB;MAAE0B,QAAQ,EAAEpC,WAAW;MAAEqC,SAAS,EAAErC;IAAY,CAAC,EACjDf,cAAc,EACd,OAAOM,KAAK,KAAK,QAAQ,GAAGA,KAAK,GAAG+C,SAAS;EAC7C,GACE9C,KAAK,GAER0B,aAAa,CAAC,CACX,CAAC;AAEX,CAAC;AAED,eAAenC,UAAU;AAEzB,MAAMsC,MAAM,GAAG5C,UAAU,CAAC8D,MAAM,CAAC;EAC/BJ,SAAS,EAAE;IACTK,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE;EACd,CAAC;EACDnB,GAAG,EAAE;IACHoB,WAAW,EAAE,MAAM;IACnBC,YAAY,EAAE;MACZpB,KAAK,EAAE,CAAC;MACRC,MAAM,EAAE;IACV,CAAC;IACDoB,aAAa,EAAE,IAAI;IACnBC,YAAY,EAAE,IAAI;IAClBC,SAAS,EAAE;EACb,CAAC;EACD1C,KAAK,EAAE;IACLsC,WAAW,EAAE,MAAM;IACnBC,YAAY,EAAE;MACZpB,KAAK,EAAE,CAAC;MACRC,MAAM,EAAE;IACV,CAAC;IACDoB,aAAa,EAAE,IAAI;IACnBC,YAAY,EAAE,IAAI;IAClBC,SAAS,EAAE;EACb;AACF,CAAC,CAAC","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.test.js b/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.test.js new file mode 100644 index 00000000..8a1f7390 --- /dev/null +++ b/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.test.js @@ -0,0 +1,327 @@ +// /* +// Copyright 2025 Adobe. All rights reserved. +// This file is licensed to you under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. You may obtain a copy +// of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under +// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS +// OF ANY KIND, either express or implied. See the License for the specific language +// governing permissions and limitations under the License. +// */ + +// import React from 'react'; +// import renderer from 'react-test-renderer'; +// import { useColorScheme } from 'react-native'; +// import UnreadIcon from './UnreadIcon'; +// import ContentCardContainerProvider from '../../providers/ContentCardContainerProvider'; + +// // Mock useColorScheme +// jest.mock('react-native/Libraries/Utilities/useColorScheme', () => ({ +// default: jest.fn(), +// })); + +// const mockUseColorScheme = useColorScheme as jest.MockedFunction; + +// describe('UnreadIcon', () => { +// const mockContainerSettings = { +// templateType: 'inbox' as const, +// content: { +// heading: { content: 'Test' }, +// layout: { orientation: 'vertical' as const }, +// capacity: 10, +// emptyStateSettings: { message: { content: 'Empty' } }, +// unread_indicator: { +// unread_bg: { +// clr: { +// light: '#FFF3E0', +// dark: '#2D1B0E', +// }, +// }, +// unread_icon: { +// placement: 'topright' as const, +// image: { +// url: 'https://example.com/icon.png', +// darkUrl: '', +// }, +// }, +// }, +// isUnreadEnabled: true, +// }, +// showPagination: false, +// }; + +// beforeEach(() => { +// jest.clearAllMocks(); +// mockUseColorScheme.mockReturnValue('light'); +// }); + +// describe('Rendering', () => { +// it('should render successfully with container settings', () => { +// const component = renderer.create( +// +// +// +// ); + +// const tree = component.toJSON(); +// expect(tree).toBeTruthy(); +// }); + +// it('should render with custom size', () => { +// const component = renderer.create( +// +// +// +// ); + +// const tree = component.toJSON(); +// expect(tree).toBeTruthy(); +// }); +// }); + +// describe('Placement', () => { +// it('should render with topright placement', () => { +// const component = renderer.create( +// +// +// +// ); + +// const tree = component.toJSON(); +// expect(tree).toBeTruthy(); +// }); + +// it('should render with topleft placement', () => { +// const settings = { +// ...mockContainerSettings, +// content: { +// ...mockContainerSettings.content, +// unread_indicator: { +// ...mockContainerSettings.content.unread_indicator, +// unread_icon: { +// ...mockContainerSettings.content.unread_indicator.unread_icon, +// placement: 'topleft' as const, +// }, +// }, +// }, +// }; + +// const component = renderer.create( +// +// +// +// ); + +// const tree = component.toJSON(); +// expect(tree).toBeTruthy(); +// }); + +// it('should render with bottomright placement', () => { +// const settings = { +// ...mockContainerSettings, +// content: { +// ...mockContainerSettings.content, +// unread_indicator: { +// ...mockContainerSettings.content.unread_indicator, +// unread_icon: { +// ...mockContainerSettings.content.unread_indicator.unread_icon, +// placement: 'bottomright' as const, +// }, +// }, +// }, +// }; + +// const component = renderer.create( +// +// +// +// ); + +// const tree = component.toJSON(); +// expect(tree).toBeTruthy(); +// }); + +// it('should render with bottomleft placement', () => { +// const settings = { +// ...mockContainerSettings, +// content: { +// ...mockContainerSettings.content, +// unread_indicator: { +// ...mockContainerSettings.content.unread_indicator, +// unread_icon: { +// ...mockContainerSettings.content.unread_indicator.unread_icon, +// placement: 'bottomleft' as const, +// }, +// }, +// }, +// }; + +// const component = renderer.create( +// +// +// +// ); + +// const tree = component.toJSON(); +// expect(tree).toBeTruthy(); +// }); +// }); + +// describe('Light Mode', () => { +// beforeEach(() => { +// mockUseColorScheme.mockReturnValue('light'); +// }); + +// it('should render in light mode with image URL', () => { +// const component = renderer.create( +// +// +// +// ); + +// const tree = component.toJSON(); +// expect(tree).toBeTruthy(); +// }); + +// it('should render dot when URL is empty string in light mode', () => { +// const settings = { +// ...mockContainerSettings, +// content: { +// ...mockContainerSettings.content, +// unread_indicator: { +// ...mockContainerSettings.content.unread_indicator, +// unread_icon: { +// ...mockContainerSettings.content.unread_indicator.unread_icon, +// image: { +// url: '', +// darkUrl: '', +// }, +// }, +// }, +// }, +// }; + +// const component = renderer.create( +// +// +// +// ); + +// const tree = component.toJSON(); +// expect(tree).toBeTruthy(); +// }); +// }); + +// describe('Dark Mode', () => { +// beforeEach(() => { +// mockUseColorScheme.mockReturnValue('dark'); +// }); + +// it('should render in dark mode with darkUrl provided', () => { +// const settings = { +// ...mockContainerSettings, +// content: { +// ...mockContainerSettings.content, +// unread_indicator: { +// ...mockContainerSettings.content.unread_indicator, +// unread_icon: { +// ...mockContainerSettings.content.unread_indicator.unread_icon, +// image: { +// url: 'https://example.com/light.png', +// darkUrl: 'https://example.com/dark.png', +// }, +// }, +// }, +// }, +// }; + +// const component = renderer.create( +// +// +// +// ); + +// const tree = component.toJSON(); +// expect(tree).toBeTruthy(); +// }); + +// it('should render dot when darkUrl is empty string in dark mode', () => { +// const component = renderer.create( +// +// +// +// ); + +// const tree = component.toJSON(); +// expect(tree).toBeTruthy(); +// }); + +// it('should fallback to light mode image when no darkUrl provided', () => { +// const settings = { +// ...mockContainerSettings, +// content: { +// ...mockContainerSettings.content, +// unread_indicator: { +// ...mockContainerSettings.content.unread_indicator, +// unread_icon: { +// placement: 'topright' as const, +// image: { +// url: 'https://example.com/icon.png', +// }, +// }, +// }, +// }, +// }; + +// const component = renderer.create( +// +// +// +// ); + +// const tree = component.toJSON(); +// expect(tree).toBeTruthy(); +// }); +// }); + +// describe('Error Handling', () => { +// it('should throw error when used outside ContentCardContainerProvider', () => { +// // Suppress console.error for this test +// const consoleError = jest.spyOn(console, 'error').mockImplementation(() => {}); + +// expect(() => { +// renderer.create(); +// }).toThrow('useContainerSettings must be used within a ContentCardContainerProvider'); + +// consoleError.mockRestore(); +// }); +// }); + +// describe('Snapshot Tests', () => { +// it('should match snapshot for topright placement', () => { +// const component = renderer.create( +// +// +// +// ); + +// const tree = component.toJSON(); +// expect(tree).toMatchSnapshot(); +// }); + +// it('should match snapshot for dot in dark mode', () => { +// mockUseColorScheme.mockReturnValue('dark'); + +// const component = renderer.create( +// +// +// +// ); + +// const tree = component.toJSON(); +// expect(tree).toMatchSnapshot(); +// }); +// }); +// }); +"use strict"; +//# sourceMappingURL=UnreadIcon.test.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.test.js.map b/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.test.js.map new file mode 100644 index 00000000..45df9eb6 --- /dev/null +++ b/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.test.js.map @@ -0,0 +1 @@ +{"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["ui/components/UnreadIcon/UnreadIcon.test.tsx"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AAAA","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/index.js b/packages/messaging/dist/module/ui/index.js index 53de06d5..c1d9e839 100644 --- a/packages/messaging/dist/module/ui/index.js +++ b/packages/messaging/dist/module/ui/index.js @@ -4,4 +4,6 @@ export * from "./components/index.js"; export * from "./hooks/index.js"; export * from "./theme/index.js"; export * from "./types/index.js"; +export * from "./providers/ContentCardContainerProvider.js"; +export { default as ContentCardContainerProvider } from "./providers/ContentCardContainerProvider.js"; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/index.js.map b/packages/messaging/dist/module/ui/index.js.map index 94e1d14d..aaf9aa85 100644 --- a/packages/messaging/dist/module/ui/index.js.map +++ b/packages/messaging/dist/module/ui/index.js.map @@ -1 +1 @@ -{"version":3,"names":[],"sourceRoot":"../../../src","sources":["ui/index.ts"],"mappings":";;AAAA,cAAc,uBAAc;AAC5B,cAAc,kBAAS;AACvB,cAAc,kBAAS;AACvB,cAAc,kBAAS","ignoreList":[]} +{"version":3,"names":["default","ContentCardContainerProvider"],"sourceRoot":"../../../src","sources":["ui/index.ts"],"mappings":";;AAAA,cAAc,uBAAc;AAC5B,cAAc,kBAAS;AACvB,cAAc,kBAAS;AACvB,cAAc,kBAAS;AACvB,cAAc,6CAA0C;AACxD,SAASA,OAAO,IAAIC,4BAA4B,QAAQ,6CAA0C","ignoreList":[]} diff --git a/packages/messaging/dist/typescript/Messaging.d.ts.map b/packages/messaging/dist/typescript/Messaging.d.ts.map index 8b2fe60a..29e7ec63 100644 --- a/packages/messaging/dist/typescript/Messaging.d.ts.map +++ b/packages/messaging/dist/typescript/Messaging.d.ts.map @@ -1,2 +1 @@ -{"version":3,"file":"Messaging.d.ts","sourceRoot":"","sources":["../../src/Messaging.ts"],"names":[],"mappings":"AAkBA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,WAAW,qBAAqB;IACpC,gBAAgB,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IACxC,iBAAiB,EAAE,MAAM,OAAO,EAAE,CAAC;IACnC,gBAAgB,EAAE,MAAM,OAAO,CAAC;IAChC,gBAAgB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;IAClE,0BAA0B,EAAE,CAC1B,QAAQ,EAAE,MAAM,EAAE,KACf,MAAM,CAAC,MAAM,EAAE,oBAAoB,EAAE,CAAC,CAAC;IAC5C,oBAAoB,EAAE,MAAM,IAAI,CAAC;IACjC,oBAAoB,EAAE,CAAC,QAAQ,CAAC,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC7D,kBAAkB,EAAE,CAClB,iBAAiB,EAAE,OAAO,EAC1B,iBAAiB,EAAE,OAAO,KACvB,IAAI,CAAC;IACV,6BAA6B,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACrE,uBAAuB,EAAE,CACvB,WAAW,EAAE,oBAAoB,EACjC,WAAW,EAAE,WAAW,KACrB,IAAI,CAAC;IACV,2BAA2B,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pE;;;;;;OAMG;IACH,MAAM,CAAC,kBAAkB,CACvB,iBAAiB,EAAE,OAAO,EAC1B,iBAAiB,EAAE,OAAO;IAK5B;;;OAGG;WACU,6BAA6B,CACxC,QAAQ,EAAE,MAAM,EAAE,GACjB,OAAO,CAAC,IAAI,CAAC;IAIhB;;;;;OAKG;WACU,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;WAuB7D,uBAAuB,CAClC,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,iBAAiB,CAAC;CAqC9B;AAED,eAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/packages/messaging/dist/typescript/ui/components/ContentCardView/ContentCardView.d.ts.map b/packages/messaging/dist/typescript/ui/components/ContentCardView/ContentCardView.d.ts.map index aefaba73..8204857e 100644 --- a/packages/messaging/dist/typescript/ui/components/ContentCardView/ContentCardView.d.ts.map +++ b/packages/messaging/dist/typescript/ui/components/ContentCardView/ContentCardView.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"ContentCardView.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/ContentCardView/ContentCardView.tsx"],"names":[],"mappings":"AAYA,OAAO,KAMN,MAAM,OAAO,CAAC;AACf,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAIL,cAAc,EAKf,MAAM,cAAc,CAAC;AAKtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAGtD,MAAM,MAAM,wBAAwB,GAAG,CACrC,KAAK,EAAE,gBAAgB,EACvB,IAAI,CAAC,EAAE,eAAe,EACtB,WAAW,CAAC,EAAE,GAAG,KACd,IAAI,CAAC;AAEV,MAAM,WAAW,gBACf,SAAQ,cAAc,EACpB,sBAAsB;IACxB,QAAQ,EAAE,eAAe,CAAC;IAC1B,cAAc,CAAC,EAAE;QACf,eAAe,CAAC,EAAE,sBAAsB,CAAC;QACzC,eAAe,CAAC,EAAE,sBAAsB,CAAC;QACzC,cAAc,CAAC,EAAE,qBAAqB,CAAC;KACxC,CAAC;IACF,QAAQ,CAAC,EAAE,wBAAwB,CAAC;IACpC,OAAO,CAAC,EAAE,mBAAmB,CAAC;CAC/B;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAuNtD,CAAC"} \ No newline at end of file +{"version":3,"file":"ContentCardView.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/ContentCardView/ContentCardView.tsx"],"names":[],"mappings":"AAYA,OAAO,KAMN,MAAM,OAAO,CAAC;AACf,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAIL,cAAc,EAKf,MAAM,cAAc,CAAC;AAMtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAKtD,MAAM,MAAM,wBAAwB,GAAG,CACrC,KAAK,EAAE,gBAAgB,EACvB,IAAI,CAAC,EAAE,eAAe,EACtB,WAAW,CAAC,EAAE,GAAG,KACd,IAAI,CAAC;AAEV,MAAM,WAAW,gBACf,SAAQ,cAAc,EACpB,sBAAsB;IACxB,QAAQ,EAAE,eAAe,CAAC;IAC1B,cAAc,CAAC,EAAE;QACf,eAAe,CAAC,EAAE,sBAAsB,CAAC;QACzC,eAAe,CAAC,EAAE,sBAAsB,CAAC;QACzC,cAAc,CAAC,EAAE,qBAAqB,CAAC;KACxC,CAAC;IACF,QAAQ,CAAC,EAAE,wBAAwB,CAAC;IACpC,OAAO,CAAC,EAAE,mBAAmB,CAAC;CAC/B;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAyOtD,CAAC"} \ No newline at end of file diff --git a/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.d.ts b/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.d.ts index dd07c8cf..c9437f42 100644 --- a/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.d.ts +++ b/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.d.ts @@ -1,4 +1,14 @@ -/// -declare function UnreadIcon(): import("react").JSX.Element; +import React from 'react'; +import { ImageProps, ImageStyle, ViewProps, ViewStyle } from 'react-native'; +export interface UnreadIconProps extends ViewProps { + imageStyle?: ImageStyle; + containerStyle?: ViewStyle; + source?: ImageProps['source']; + darkSource?: ImageProps['source']; + size?: number; + position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'; + type?: 'dot' | 'image'; +} +declare const UnreadIcon: ({ imageStyle, containerStyle, source, darkSource, size, position, type, style, ...props }: UnreadIconProps) => React.JSX.Element; export default UnreadIcon; //# sourceMappingURL=UnreadIcon.d.ts.map \ No newline at end of file diff --git a/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.d.ts.map b/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.d.ts.map index 60ee85a0..00c89c5f 100644 --- a/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.d.ts.map +++ b/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"UnreadIcon.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/UnreadIcon/UnreadIcon.tsx"],"names":[],"mappings":";AAEA,iBAAS,UAAU,gCAMlB;AAED,eAAe,UAAU,CAAC"} \ No newline at end of file +{"version":3,"file":"UnreadIcon.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/UnreadIcon/UnreadIcon.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EAEL,UAAU,EACV,UAAU,EAGV,SAAS,EACT,SAAS,EAEV,MAAM,cAAc,CAAC;AAGtB,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAChD,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,MAAM,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC9B,UAAU,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,UAAU,GAAG,WAAW,GAAG,aAAa,GAAG,cAAc,CAAC;IACrE,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC;CACxB;AAkBD,QAAA,MAAM,UAAU,8FAUb,eAAe,sBAqIjB,CAAC;AAEF,eAAe,UAAU,CAAC"} \ No newline at end of file diff --git a/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.test.d.ts b/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.test.d.ts new file mode 100644 index 00000000..fb811c8c --- /dev/null +++ b/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.test.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=UnreadIcon.test.d.ts.map \ No newline at end of file diff --git a/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.test.d.ts.map b/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.test.d.ts.map new file mode 100644 index 00000000..f09c28ce --- /dev/null +++ b/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.test.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"UnreadIcon.test.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/UnreadIcon/UnreadIcon.test.tsx"],"names":[],"mappings":""} \ No newline at end of file diff --git a/packages/messaging/dist/typescript/ui/index.d.ts b/packages/messaging/dist/typescript/ui/index.d.ts index 185bb314..876dbafa 100644 --- a/packages/messaging/dist/typescript/ui/index.d.ts +++ b/packages/messaging/dist/typescript/ui/index.d.ts @@ -2,4 +2,6 @@ export * from './components'; export * from './hooks'; export * from './theme'; export * from './types'; +export * from './providers/ContentCardContainerProvider'; +export { default as ContentCardContainerProvider } from './providers/ContentCardContainerProvider'; //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/packages/messaging/dist/typescript/ui/index.d.ts.map b/packages/messaging/dist/typescript/ui/index.d.ts.map index 3fc268cf..7a6c6519 100644 --- a/packages/messaging/dist/typescript/ui/index.d.ts.map +++ b/packages/messaging/dist/typescript/ui/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"} \ No newline at end of file +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,0CAA0C,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,4BAA4B,EAAE,MAAM,0CAA0C,CAAC"} \ No newline at end of file diff --git a/packages/messaging/dist/ui/components/Button/Button.d.ts b/packages/messaging/dist/ui/components/Button/Button.d.ts deleted file mode 100644 index 57b00871..00000000 --- a/packages/messaging/dist/ui/components/Button/Button.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import React from 'react'; -import { GestureResponderEvent, PressableProps, TextStyle } from 'react-native'; -export interface ButtonProps extends Omit { - actionUrl?: string; - id?: string; - title: string; - onPress?: (interactId?: string, event?: GestureResponderEvent) => void; - interactId?: string; - textStyle?: (TextStyle | undefined) | (TextStyle | undefined)[]; -} -declare const Button: React.FC; -export default Button; diff --git a/packages/messaging/dist/ui/components/Button/Button.js b/packages/messaging/dist/ui/components/Button/Button.js deleted file mode 100644 index e2943b0d..00000000 --- a/packages/messaging/dist/ui/components/Button/Button.js +++ /dev/null @@ -1,40 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -/* - Copyright 2025 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law - or agreed to in writing, software distributed under the License is - distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF - ANY KIND, either express or implied. See the License for the specific - language governing permissions and limitations under the License. -*/ -const react_1 = tslib_1.__importStar(require("react")); -const react_native_1 = require("react-native"); -const ThemeProvider_1 = require("../../theme/ThemeProvider"); -const Button = (_a) => { - var _b; - var { actionUrl, id, title, onPress, interactId, textStyle, style } = _a, props = tslib_1.__rest(_a, ["actionUrl", "id", "title", "onPress", "interactId", "textStyle", "style"]); - const theme = (0, ThemeProvider_1.useTheme)(); - const handlePress = (0, react_1.useCallback)(() => { - onPress === null || onPress === void 0 ? void 0 : onPress(interactId); - if (actionUrl) { - try { - react_native_1.Linking.openURL(actionUrl); - } - catch (error) { - console.warn(`Failed to open URL: ${actionUrl}`, error); - } - } - }, [actionUrl, interactId, onPress]); - return ( - - {title} - - ); -}; -exports.default = Button; -//# sourceMappingURL=Button.js.map \ No newline at end of file diff --git a/packages/messaging/dist/ui/components/Button/Button.js.map b/packages/messaging/dist/ui/components/Button/Button.js.map deleted file mode 100644 index cc9f58a1..00000000 --- a/packages/messaging/dist/ui/components/Button/Button.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../../src/ui/components/Button/Button.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;EAUE;AACF,uDAA2C;AAC3C,+CAOsB;AACtB,6DAAqD;AAWrD,MAAM,MAAM,GAA0B,CAAC,EAStC,EAAE,EAAE;;QATkC,EACrC,SAAS,EACT,EAAE,EACF,KAAK,EACL,OAAO,EACP,UAAU,EACV,SAAS,EACT,KAAK,OAEN,EADI,KAAK,sBAR6B,2EAStC,CADS;IAER,MAAM,KAAK,GAAG,IAAA,wBAAQ,GAAE,CAAC;IACzB,MAAM,WAAW,GAAG,IAAA,mBAAW,EAAC,GAAG,EAAE;QACnC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,UAAU,CAAC,CAAC;QACtB,IAAI,SAAS,EAAE;YACb,IAAI;gBACF,sBAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;aAC5B;YAAC,OAAO,KAAK,EAAE;gBACd,OAAO,CAAC,IAAI,CAAC,uBAAuB,SAAS,EAAE,EAAE,KAAK,CAAC,CAAC;aACzD;SACF;IACH,CAAC,EAAE,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC;IAErC,OAAO,CACL,CAAC,wBAAS,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,CACvD;MAAA,CAAC,mBAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,MAAM,0CAAE,eAAe,EAAE,EAAE,SAAS,CAAC,CAAC,CAClE;QAAA,CAAC,KAAK,CACR;MAAA,EAAE,mBAAI,CACR;IAAA,EAAE,wBAAS,CAAC,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,MAAM,CAAC"} \ No newline at end of file diff --git a/packages/messaging/dist/ui/components/Button/Button.spec.d.ts b/packages/messaging/dist/ui/components/Button/Button.spec.d.ts deleted file mode 100644 index cb0ff5c3..00000000 --- a/packages/messaging/dist/ui/components/Button/Button.spec.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/packages/messaging/dist/ui/components/Button/Button.spec.js b/packages/messaging/dist/ui/components/Button/Button.spec.js deleted file mode 100644 index 866b255f..00000000 --- a/packages/messaging/dist/ui/components/Button/Button.spec.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=Button.spec.js.map \ No newline at end of file diff --git a/packages/messaging/dist/ui/components/Button/Button.spec.js.map b/packages/messaging/dist/ui/components/Button/Button.spec.js.map deleted file mode 100644 index 31e1bd5b..00000000 --- a/packages/messaging/dist/ui/components/Button/Button.spec.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Button.spec.js","sourceRoot":"","sources":["../../../../src/ui/components/Button/Button.spec.tsx"],"names":[],"mappings":""} \ No newline at end of file diff --git a/packages/messaging/dist/ui/components/ContentCardView/ContentCardView.d.ts b/packages/messaging/dist/ui/components/ContentCardView/ContentCardView.d.ts deleted file mode 100644 index c355f228..00000000 --- a/packages/messaging/dist/ui/components/ContentCardView/ContentCardView.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -import React from 'react'; -import { ComponentOverrideProps, ContentTemplate, ImageOnlyContentStyle, LargeImageContentStyle, SmallImageContentStyle } from '../../types/Templates'; -import { ContentViewEvent } from '../../types/ContentViewEvent'; -import { PressableProps } from 'react-native'; -import { ContentCardTemplate } from '../../../models'; -export type ContentCardEventListener = (event: ContentViewEvent, data?: ContentTemplate, nativeEvent?: any) => void; -export interface ContentViewProps extends PressableProps, ComponentOverrideProps { - template: ContentTemplate; - styleOverrides?: { - smallImageStyle?: SmallImageContentStyle; - largeImageStyle?: LargeImageContentStyle; - imageOnlyStyle?: ImageOnlyContentStyle; - }; - listener?: ContentCardEventListener; - variant?: ContentCardTemplate; -} -export declare const ContentCardView: React.FC; diff --git a/packages/messaging/dist/ui/components/ContentCardView/ContentCardView.js b/packages/messaging/dist/ui/components/ContentCardView/ContentCardView.js deleted file mode 100644 index ed0f3264..00000000 --- a/packages/messaging/dist/ui/components/ContentCardView/ContentCardView.js +++ /dev/null @@ -1,258 +0,0 @@ -"use strict"; -/* - Copyright 2025 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law - or agreed to in writing, software distributed under the License is - distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF - ANY KIND, either express or implied. See the License for the specific - language governing permissions and limitations under the License. -*/ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ContentCardView = void 0; -const tslib_1 = require("tslib"); -const react_1 = tslib_1.__importStar(require("react")); -const react_native_1 = require("react-native"); -const MessagingEdgeEventType_1 = tslib_1.__importDefault(require("../../../models/MessagingEdgeEventType")); -const DismissButton_1 = tslib_1.__importDefault(require("../DismissButton/DismissButton")); -const theme_1 = require("../../theme"); -const useAspectRatio_1 = tslib_1.__importDefault(require("../../hooks/useAspectRatio")); -const Button_1 = tslib_1.__importDefault(require("../Button/Button")); -const ContentCardView = (_a) => { - var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o; - var { template, listener, variant, styleOverrides: _styleOverrides, style, ContainerProps, ImageContainerProps, ImageProps, ContentContainerProps, TextProps, TitleProps, BodyProps, ButtonContainerProps, ButtonProps, DismissButtonProps } = _a, props = tslib_1.__rest(_a, ["template", "listener", "variant", "styleOverrides", "style", "ContainerProps", "ImageContainerProps", "ImageProps", "ContentContainerProps", "TextProps", "TitleProps", "BodyProps", "ButtonContainerProps", "ButtonProps", "DismissButtonProps"]); - console.log('ContentCardView', template); - const colorScheme = (0, react_native_1.useColorScheme)(); - const [isVisible, setIsVisible] = (0, react_1.useState)(true); - const isDisplayedRef = (0, react_1.useRef)(false); - const theme = (0, theme_1.useTheme)(); - const cardVariant = (0, react_1.useMemo)(() => { var _a; return (_a = variant !== null && variant !== void 0 ? variant : template.type) !== null && _a !== void 0 ? _a : 'SmallImage'; }, [variant, template.type]); - const onDismiss = (0, react_1.useCallback)(() => { - var _a; - listener === null || listener === void 0 ? void 0 : listener('onDismiss', template); - // Track dismiss event using propositionItem - (_a = template.track) === null || _a === void 0 ? void 0 : _a.call(template, MessagingEdgeEventType_1.default.DISMISS); - setIsVisible(false); - }, [listener, template]); - const onPress = (0, react_1.useCallback)(() => { - var _a, _b, _c; - listener === null || listener === void 0 ? void 0 : listener('onInteract', template); - // Track interaction event using propositionItem - (_a = template.track) === null || _a === void 0 ? void 0 : _a.call(template, 'content_clicked', MessagingEdgeEventType_1.default.INTERACT, null); - if ((_c = (_b = template.data) === null || _b === void 0 ? void 0 : _b.content) === null || _c === void 0 ? void 0 : _c.actionUrl) { - try { - react_native_1.Linking.openURL(template.data.content.actionUrl); - } - catch (error) { - console.warn(`Failed to open URL: ${template.data.content.actionUrl}`, error); - } - } - }, [template]); - // Call listener on mount to signal view display (only once to prevent duplicates) - (0, react_1.useEffect)(() => { - var _a; - if (!isDisplayedRef.current) { - listener === null || listener === void 0 ? void 0 : listener('onDisplay', template); - // Track display event using propositionItem - (_a = template.track) === null || _a === void 0 ? void 0 : _a.call(template, MessagingEdgeEventType_1.default.DISPLAY); - isDisplayedRef.current = true; - } - }, [listener, template]); - const imageUri = (0, react_1.useMemo)(() => { - var _a, _b, _c, _d; - if (colorScheme === 'dark' && ((_c = (_b = (_a = template.data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.image) === null || _c === void 0 ? void 0 : _c.darkUrl)) { - return template.data.content.image.darkUrl; - } - return (_d = template.data.content.image) === null || _d === void 0 ? void 0 : _d.url; - }, [ - colorScheme, - (_d = (_c = (_b = template.data) === null || _b === void 0 ? void 0 : _b.content) === null || _c === void 0 ? void 0 : _c.image) === null || _d === void 0 ? void 0 : _d.darkUrl, - (_g = (_f = (_e = template.data) === null || _e === void 0 ? void 0 : _e.content) === null || _f === void 0 ? void 0 : _f.image) === null || _g === void 0 ? void 0 : _g.url - ]); - const imageAspectRatio = (0, useAspectRatio_1.default)(imageUri); - // If not visible, return null to hide the entire view - if (!isVisible) { - return null; - } - if (!template.data) - return null; - const content = (_h = template === null || template === void 0 ? void 0 : template.data) === null || _h === void 0 ? void 0 : _h.content; - if (!content) - return null; - const styleOverrides = (0, react_1.useMemo)(() => { - switch (cardVariant) { - case 'SmallImage': - return _styleOverrides === null || _styleOverrides === void 0 ? void 0 : _styleOverrides.smallImageStyle; - case 'LargeImage': - return _styleOverrides === null || _styleOverrides === void 0 ? void 0 : _styleOverrides.largeImageStyle; - case 'ImageOnly': - return _styleOverrides === null || _styleOverrides === void 0 ? void 0 : _styleOverrides.imageOnlyStyle; - default: - return null; - } - }, [_styleOverrides, cardVariant]); - return ( [ - styles.card, - styleOverrides === null || styleOverrides === void 0 ? void 0 : styleOverrides.card, - typeof style === 'function' ? style(state) : style - ]} {...props}> - - {imageUri && ( - - )} - {cardVariant !== 'ImageOnly' && ( - {((_j = content === null || content === void 0 ? void 0 : content.title) === null || _j === void 0 ? void 0 : _j.content) && ( - {content.title.content} - )} - {((_k = content === null || content === void 0 ? void 0 : content.body) === null || _k === void 0 ? void 0 : _k.content) && ( - {content.body.content} - )} - - {((_l = content === null || content === void 0 ? void 0 : content.buttons) === null || _l === void 0 ? void 0 : _l.length) && - ((_m = content === null || content === void 0 ? void 0 : content.buttons) === null || _m === void 0 ? void 0 : _m.length) > 0 && - content.buttons.map((button) => ())} - - )} - {(content === null || content === void 0 ? void 0 : content.dismissBtn) && ((_o = content.dismissBtn) === null || _o === void 0 ? void 0 : _o.style) !== 'none' && ()} - - ); -}; -exports.ContentCardView = ContentCardView; -const styles = react_native_1.StyleSheet.create({ - card: { - margin: 15, - flex: 1 - }, - container: { - flexDirection: 'column' - }, - imageContainer: { - alignItems: 'center', - borderRadius: 12, - backgroundColor: '#f0f0f0' - }, - image: { - width: '100%', - resizeMode: 'contain' - }, - contentContainer: { - flex: 1, - paddingVertical: 16, - paddingHorizontal: 16, - justifyContent: 'flex-start' - }, - textContent: { - flex: 1, - justifyContent: 'flex-start', - marginBottom: 16 - }, - title: { - fontSize: 16, - fontWeight: '600', - marginBottom: 8, - marginRight: 16 - }, - body: { - fontSize: 14, - lineHeight: 18 - }, - buttonContainer: { - flexDirection: 'row', - justifyContent: 'flex-start', - flexWrap: 'wrap', - paddingTop: 8, - gap: 8 - }, - button: { - marginHorizontal: 8 - } -}); -const smallImageStyles = react_native_1.StyleSheet.create({ - card: { - borderRadius: 12, - flexDirection: 'row', - gap: 8, - maxWidth: '100%', - alignItems: 'center' - }, - container: { - flexDirection: 'row' - }, - imageContainer: { - borderRadius: 12, - maxWidth: '35%', - alignSelf: 'center' - }, - image: { - resizeMode: 'contain', - width: '100%', - maxWidth: '100%' - } -}); -// const largeImageStyles = StyleSheet.create({ -// card: { -// ...styles.card, -// borderRadius: 12, -// gap: 8 -// }, -// container: { -// flexDirection: 'row' -// }, -// imageContainer: { -// alignItems: 'center', -// borderRadius: 12, -// backgroundColor: '#f0f0f0' -// }, -// image: { -// width: '100%', -// resizeMode: 'contain' -// }, -// contentContainer: styles.contentContainer, -// textContent: styles.textContent, -// title: styles.title, -// body: styles.body, -// buttonContainer: styles.buttonContainer, -// button: styles.button -// }); -// const imageOnlyStyles = StyleSheet.create({ -// card: styles.card, -// imageContainer: { -// backgroundColor: '#f0f0f0' -// }, -// image: { -// width: '100%', -// resizeMode: 'contain' -// } -// }); -//# sourceMappingURL=ContentCardView.js.map \ No newline at end of file diff --git a/packages/messaging/dist/ui/components/ContentCardView/ContentCardView.js.map b/packages/messaging/dist/ui/components/ContentCardView/ContentCardView.js.map deleted file mode 100644 index 35890a2e..00000000 --- a/packages/messaging/dist/ui/components/ContentCardView/ContentCardView.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ContentCardView.js","sourceRoot":"","sources":["../../../../src/ui/components/ContentCardView/ContentCardView.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;EAUE;;;;AAEF,uDAMe;AASf,+CASsB;AACtB,4GAA4E;AAC5E,2FAA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Z,sBAAsB;AACtB,wBAAwB;AACxB,aAAa;AACb,OAAO;AACP,iBAAiB;AACjB,2BAA2B;AAC3B,OAAO;AACP,sBAAsB;AACtB,4BAA4B;AAC5B,wBAAwB;AACxB,iCAAiC;AACjC,OAAO;AACP,aAAa;AACb,qBAAqB;AACrB,4BAA4B;AAC5B,OAAO;AACP,+CAA+C;AAC/C,qCAAqC;AACrC,yBAAyB;AACzB,uBAAuB;AACvB,6CAA6C;AAC7C,0BAA0B;AAC1B,MAAM;AAEN,8CAA8C;AAC9C,uBAAuB;AACvB,sBAAsB;AACtB,iCAAiC;AACjC,OAAO;AACP,aAAa;AACb,qBAAqB;AACrB,4BAA4B;AAC5B,MAAM;AACN,MAAM"} \ No newline at end of file diff --git a/packages/messaging/dist/ui/components/DismissButton/DismissButton.d.ts b/packages/messaging/dist/ui/components/DismissButton/DismissButton.d.ts deleted file mode 100644 index 402db70d..00000000 --- a/packages/messaging/dist/ui/components/DismissButton/DismissButton.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/// -import { PressableProps, TextStyle } from 'react-native'; -export interface DismissButtonProps extends PressableProps { - textStyle?: TextStyle; - onPress?: () => void; - type: 'simple' | 'circle'; -} -declare const DismissButton: ({ onPress, type, textStyle, style, ...props }: DismissButtonProps) => import("react").JSX.Element; -export default DismissButton; diff --git a/packages/messaging/dist/ui/components/DismissButton/DismissButton.js b/packages/messaging/dist/ui/components/DismissButton/DismissButton.js deleted file mode 100644 index 7405e267..00000000 --- a/packages/messaging/dist/ui/components/DismissButton/DismissButton.js +++ /dev/null @@ -1,71 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -/* - Copyright 2025 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law - or agreed to in writing, software distributed under the License is - distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF - ANY KIND, either express or implied. See the License for the specific - language governing permissions and limitations under the License. -*/ -const react_native_1 = require("react-native"); -const DismissButton = (_a) => { - var { onPress, type, textStyle, style } = _a, props = tslib_1.__rest(_a, ["onPress", "type", "textStyle", "style"]); - const colorScheme = (0, react_native_1.useColorScheme)(); - return ( [ - styles.container, - type === 'simple' && styles.simple, - type === 'circle' && [ - styles.circle, - { - backgroundColor: colorScheme === 'dark' - ? 'rgba(255,255,255,0.1)' - : 'rgba(0,0,0,0.1)' - } - ], - state.pressed && styles.pressed, - typeof style === 'function' ? style(state) : style - ]} {...props}> - - x - - ); -}; -exports.default = DismissButton; -const styles = react_native_1.StyleSheet.create({ - container: { - position: 'absolute', - top: 6, - right: 6, - zIndex: 1000, - justifyContent: 'center', - alignItems: 'center', - minWidth: 18, - minHeight: 18, - }, - pressed: { - opacity: 0.7 - }, - simple: { - backgroundColor: 'transparent' - }, - circle: { - borderRadius: 10, - width: 18, - height: 18 - }, - text: { - fontSize: 14, - fontWeight: 'bold', - textAlign: 'center' - } -}); -//# sourceMappingURL=DismissButton.js.map \ No newline at end of file diff --git a/packages/messaging/dist/ui/components/DismissButton/DismissButton.js.map b/packages/messaging/dist/ui/components/DismissButton/DismissButton.js.map deleted file mode 100644 index 9eea470c..00000000 --- a/packages/messaging/dist/ui/components/DismissButton/DismissButton.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"DismissButton.js","sourceRoot":"","sources":["../../../../src/ui/components/DismissButton/DismissButton.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;EAUE;AACF,+CAOsB;AAQtB,MAAM,aAAa,GAAG,CAAC,EAMF,EAAE,EAAE;QANF,EACrB,OAAO,EACP,IAAI,EACJ,SAAS,EACT,KAAK,OAEc,EADhB,KAAK,sBALa,yCAMtB,CADS;IAER,MAAM,WAAW,GAAG,IAAA,6BAAc,GAAE,CAAC;IAErC,OAAO,CACL,CAAC,wBAAS,CACR,OAAO,CAAC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AE;KACX;IACD,IAAI,EAAE;QACJ,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,MAAM;QAClB,SAAS,EAAE,QAAQ;KACpB;CACF,CAAC,CAAC"} \ No newline at end of file diff --git a/packages/messaging/dist/ui/components/DismissButton/DismissButton.spec.d.ts b/packages/messaging/dist/ui/components/DismissButton/DismissButton.spec.d.ts deleted file mode 100644 index cb0ff5c3..00000000 --- a/packages/messaging/dist/ui/components/DismissButton/DismissButton.spec.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/packages/messaging/dist/ui/components/DismissButton/DismissButton.spec.js b/packages/messaging/dist/ui/components/DismissButton/DismissButton.spec.js deleted file mode 100644 index 47c2d415..00000000 --- a/packages/messaging/dist/ui/components/DismissButton/DismissButton.spec.js +++ /dev/null @@ -1,306 +0,0 @@ -"use strict"; -// /* -// Copyright 2025 Adobe. All rights reserved. -// This file is licensed to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law -// or agreed to in writing, software distributed under the License is -// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF -// ANY KIND, either express or implied. See the License for the specific -// language governing permissions and limitations under the License. -// */ -// import React from 'react'; -// import { render, screen, fireEvent } from '@testing-library/react-native'; -// import { useColorScheme } from 'react-native'; -// import DismissButton from './DismissButton'; -Object.defineProperty(exports, "__esModule", { value: true }); -// // Mock useColorScheme -// jest.mock('react-native', () => { -// const RN = jest.requireActual('react-native'); -// return { -// ...RN, -// useColorScheme: jest.fn() -// }; -// }); -// const mockUseColorScheme = useColorScheme as jest.MockedFunction< -// typeof useColorScheme -// >; -// describe('DismissButton', () => { -// const mockOnPress = jest.fn(); -// beforeEach(() => { -// jest.clearAllMocks(); -// mockUseColorScheme.mockReturnValue('light'); -// }); -// describe('Basic rendering', () => { -// it('should render a dismiss button with type "simple"', () => { -// render(); -// const button = screen.getByText('x'); -// expect(button).toBeTruthy(); -// }); -// it('should render a dismiss button with type "circle"', () => { -// render(); -// const button = screen.getByText('x'); -// expect(button).toBeTruthy(); -// }); -// it('should display "x" as the button text', () => { -// render(); -// expect(screen.getByText('x')).toBeTruthy(); -// }); -// }); -// describe('Press handling', () => { -// it('should call onPress when the button is pressed', () => { -// render(); -// const button = screen.getByText('x'); -// fireEvent.press(button); -// expect(mockOnPress).toHaveBeenCalledTimes(1); -// }); -// it('should call onPress multiple times when pressed multiple times', () => { -// render(); -// const button = screen.getByText('x'); -// fireEvent.press(button); -// fireEvent.press(button); -// fireEvent.press(button); -// expect(mockOnPress).toHaveBeenCalledTimes(3); -// }); -// }); -// describe('Color scheme handling', () => { -// it('should apply light color scheme styles', () => { -// mockUseColorScheme.mockReturnValue('light'); -// render(); -// const text = screen.getByText('x'); -// expect(text.props.style).toEqual( -// expect.arrayContaining([ -// expect.objectContaining({ -// color: 'black' -// }) -// ]) -// ); -// }); -// it('should apply dark color scheme styles', () => { -// mockUseColorScheme.mockReturnValue('dark'); -// render(); -// const text = screen.getByText('x'); -// expect(text.props.style).toEqual( -// expect.arrayContaining([ -// expect.objectContaining({ -// color: 'white' -// }) -// ]) -// ); -// }); -// it('should apply correct background color for circle type in light mode', () => { -// mockUseColorScheme.mockReturnValue('light'); -// const { getByTestId } = render( -// -// ); -// const button = getByTestId('dismiss-button'); -// expect(button.props.style).toEqual( -// expect.arrayContaining([ -// expect.objectContaining({ -// backgroundColor: 'rgba(0,0,0,0.1)' -// }) -// ]) -// ); -// }); -// it('should apply correct background color for circle type in dark mode', () => { -// mockUseColorScheme.mockReturnValue('dark'); -// const { getByTestId } = render( -// -// ); -// const button = getByTestId('dismiss-button'); -// expect(button.props.style).toEqual( -// expect.arrayContaining([ -// expect.objectContaining({ -// backgroundColor: 'rgba(255,255,255,0.1)' -// }) -// ]) -// ); -// }); -// }); -// describe('Type variations', () => { -// it('should apply simple type styles', () => { -// const { getByTestId } = render( -// -// ); -// const button = getByTestId('dismiss-button'); -// expect(button.props.style).toEqual( -// expect.arrayContaining([ -// expect.objectContaining({ -// backgroundColor: 'transparent' -// }) -// ]) -// ); -// }); -// it('should apply circle type styles', () => { -// const { getByTestId } = render( -// -// ); -// const button = getByTestId('dismiss-button'); -// expect(button.props.style).toEqual( -// expect.arrayContaining([ -// expect.objectContaining({ -// borderRadius: 10, -// width: 18, -// height: 18 -// }) -// ]) -// ); -// }); -// }); -// describe('Custom props and styles', () => { -// it('should accept and apply custom style props', () => { -// const customStyle = { opacity: 0.5 }; -// const { getByTestId } = render( -// -// ); -// const button = getByTestId('dismiss-button'); -// expect(button.props.style).toEqual( -// expect.arrayContaining([ -// expect.objectContaining({ -// opacity: 0.5 -// }) -// ]) -// ); -// }); -// it('should accept function-based style props', () => { -// const styleFn = jest.fn().mockReturnValue({ opacity: 0.8 }); -// const { getByTestId } = render( -// -// ); -// expect(styleFn).toHaveBeenCalled(); -// const button = getByTestId('dismiss-button'); -// expect(button.props.style).toEqual( -// expect.arrayContaining([ -// expect.objectContaining({ -// opacity: 0.8 -// }) -// ]) -// ); -// }); -// it('should accept additional Pressable props', () => { -// const { getByTestId } = render( -// -// ); -// const button = getByTestId('dismiss-button'); -// expect(button.props.disabled).toBe(true); -// expect(button.props.accessibilityLabel).toBe('Close button'); -// }); -// }); -// describe('Accessibility', () => { -// it('should be accessible by default', () => { -// const { getByTestId } = render( -// -// ); -// const button = getByTestId('dismiss-button'); -// expect(button).toBeTruthy(); -// }); -// it('should accept custom accessibility props', () => { -// const { getByTestId } = render( -// -// ); -// const button = getByTestId('dismiss-button'); -// expect(button.props.accessibilityLabel).toBe('Dismiss notification'); -// expect(button.props.accessibilityHint).toBe( -// 'Double tap to close this notification' -// ); -// }); -// }); -// describe('Positioning and layout', () => { -// it('should have absolute positioning styles', () => { -// const { getByTestId } = render( -// -// ); -// const button = getByTestId('dismiss-button'); -// expect(button.props.style).toEqual( -// expect.arrayContaining([ -// expect.objectContaining({ -// position: 'absolute', -// top: 6, -// right: 6, -// zIndex: 1000 -// }) -// ]) -// ); -// }); -// it('should have minimum dimensions', () => { -// const { getByTestId } = render( -// -// ); -// const button = getByTestId('dismiss-button'); -// expect(button.props.style).toEqual( -// expect.arrayContaining([ -// expect.objectContaining({ -// minWidth: 18, -// minHeight: 18 -// }) -// ]) -// ); -// }); -// }); -// describe('Edge cases', () => { -// it('should handle undefined color scheme gracefully', () => { -// mockUseColorScheme.mockReturnValue(undefined as any); -// expect(() => { -// render(); -// }).not.toThrow(); -// }); -// it('should handle null color scheme gracefully', () => { -// mockUseColorScheme.mockReturnValue(null as any); -// expect(() => { -// render(); -// }).not.toThrow(); -// }); -// }); -// }); -//# sourceMappingURL=DismissButton.spec.js.map \ No newline at end of file diff --git a/packages/messaging/dist/ui/components/DismissButton/DismissButton.spec.js.map b/packages/messaging/dist/ui/components/DismissButton/DismissButton.spec.js.map deleted file mode 100644 index 4c1447f9..00000000 --- a/packages/messaging/dist/ui/components/DismissButton/DismissButton.spec.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"DismissButton.spec.js","sourceRoot":"","sources":["../../../../src/ui/components/DismissButton/DismissButton.spec.tsx"],"names":[],"mappings":";AAAA,KAAK;AACL,iDAAiD;AACjD,8EAA8E;AAC9E,mFAAmF;AACnF,8CAA8C;AAC9C,mFAAmF;AACnF,yEAAyE;AACzE,gFAAgF;AAChF,4EAA4E;AAC5E,wEAAwE;AACxE,KAAK;AACL,6BAA6B;AAC7B,6EAA6E;AAC7E,iDAAiD;AACjD,+CAA+C;;AAE/C,yBAAyB;AACzB,oCAAoC;AACpC,mDAAmD;AACnD,aAAa;AACb,aAAa;AACb,gCAAgC;AAChC,OAAO;AACP,MAAM;AAEN,oEAAoE;AACpE,0BAA0B;AAC1B,KAAK;AAEL,oCAAoC;AACpC,mCAAmC;AAEnC,uBAAuB;AACvB,4BAA4B;AAC5B,mDAAmD;AACnD,QAAQ;AAER,wCAAwC;AACxC,sEAAsE;AACtE,uEAAuE;AAEvE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diff --git a/packages/messaging/dist/ui/components/ImageOnlyCard/ImageOnlyCard.d.ts b/packages/messaging/dist/ui/components/ImageOnlyCard/ImageOnlyCard.d.ts deleted file mode 100644 index 03e7f733..00000000 --- a/packages/messaging/dist/ui/components/ImageOnlyCard/ImageOnlyCard.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import React from 'react'; -import { ImageStyle, PressableProps, ViewStyle } from 'react-native'; -import { ImageOnlyContent } from '../../../models/ContentCard'; -import { ComponentOverrideProps } from '../../types'; -export type ImageOnlyContentProps = Pick & { - content: ImageOnlyContent; - height?: number; - imageUri?: string; - styleOverrides?: ImageOnlyContentStyle; - onDismiss?: () => void; - onPress?: () => void; -}; -export interface ImageOnlyContentStyle { - card?: Partial; - imageContainer?: Partial; - image?: Partial; - dismissButton?: PressableProps['style']; -} -/** - * Renders an image only card component. - * - * @param props - an object of type [ImageOnlyContentProps], which contains the properties for the image only card component. - * @returns The rendered image only card component. - */ -declare const ImageOnlyCard: React.FC; -export default ImageOnlyCard; diff --git a/packages/messaging/dist/ui/components/ImageOnlyCard/ImageOnlyCard.js b/packages/messaging/dist/ui/components/ImageOnlyCard/ImageOnlyCard.js deleted file mode 100644 index d91bafe7..00000000 --- a/packages/messaging/dist/ui/components/ImageOnlyCard/ImageOnlyCard.js +++ /dev/null @@ -1,53 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -/* - Copyright 2025 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law - or agreed to in writing, software distributed under the License is - distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF - ANY KIND, either express or implied. See the License for the specific - language governing permissions and limitations under the License. -*/ -const react_1 = tslib_1.__importDefault(require("react")); -const react_native_1 = require("react-native"); -const DismissButton_1 = tslib_1.__importDefault(require("../DismissButton/DismissButton")); -const useAspectRatio_1 = tslib_1.__importDefault(require("../../hooks/useAspectRatio")); -/** - * Renders an image only card component. - * - * @param props - an object of type [ImageOnlyContentProps], which contains the properties for the image only card component. - * @returns The rendered image only card component. - */ -const ImageOnlyCard = ({ content, imageUri, onDismiss, onPress, styleOverrides, ContainerProps, ImageContainerProps, ImageProps, DismissButtonProps }) => { - var _a; - const imageAspectRatio = (0, useAspectRatio_1.default)(imageUri); - return ( - - - {((_a = content.dismissBtn) === null || _a === void 0 ? void 0 : _a.style) && content.dismissBtn.style !== 'none' && ()} - - ); -}; -exports.default = ImageOnlyCard; -const styles = react_native_1.StyleSheet.create({ - card: { - margin: 15, - flex: 1 - }, - imageContainer: { - backgroundColor: '#f0f0f0' - }, - image: { - width: '100%', - flex: 1 - } -}); -//# sourceMappingURL=ImageOnlyCard.js.map \ No newline at end of file diff --git a/packages/messaging/dist/ui/components/ImageOnlyCard/ImageOnlyCard.js.map b/packages/messaging/dist/ui/components/ImageOnlyCard/ImageOnlyCard.js.map deleted file mode 100644 index 68a4e1f5..00000000 --- a/packages/messaging/dist/ui/components/ImageOnlyCard/ImageOnlyCard.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ImageOnlyCard.js","sourceRoot":"","sources":["../../../../src/ui/components/ImageOnlyCard/ImageOnlyCard.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;EAUE;AACF,0DAA0B;AAC1B,+CAQsB;AACtB,2FAA2D;AAE3D,wFAAwD;AAqBxD;;;;;GAKG;AACH,MAAM,aAAa,GAAoC,CAAC,EACtD,OAAO,EACP,QAAQ,EACR,SAAS,EACT,OAAO,EACP,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,UAAU,EACV,kBAAkB,EACnB,EAAE,EAAE;;IACH,MAAM,gBAAgB,GAAG,IAAA,wBAAc,EAAC,QAAQ,CAAC,CAAC;IAElD,OAAO,CACL,CAAC,wBAAS,CACR,OAAO,CAAC,CAAC,OAAO,CAAC,CACj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AM;QACb,IAAI,EAAE,CAAC;KACR;CACF,CAAC,CAAC"} \ No newline at end of file diff --git a/packages/messaging/dist/ui/components/ImageOnlyCard/ImageOnlyCard.spec.d.ts b/packages/messaging/dist/ui/components/ImageOnlyCard/ImageOnlyCard.spec.d.ts deleted file mode 100644 index cb0ff5c3..00000000 --- a/packages/messaging/dist/ui/components/ImageOnlyCard/ImageOnlyCard.spec.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/packages/messaging/dist/ui/components/ImageOnlyCard/ImageOnlyCard.spec.js b/packages/messaging/dist/ui/components/ImageOnlyCard/ImageOnlyCard.spec.js deleted file mode 100644 index 6a0240bd..00000000 --- a/packages/messaging/dist/ui/components/ImageOnlyCard/ImageOnlyCard.spec.js +++ /dev/null @@ -1,623 +0,0 @@ -"use strict"; -// /* -// Copyright 2025 Adobe. All rights reserved. -// This file is licensed to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law -// or agreed to in writing, software distributed under the License is -// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF -// ANY KIND, either express or implied. See the License for the specific -// language governing permissions and limitations under the License. -// */ -Object.defineProperty(exports, "__esModule", { value: true }); -// import React from 'react'; -// import { render, screen, fireEvent } from '@testing-library/react-native'; -// import { Image } from 'react-native'; -// import ImageOnlyCard from './ImageOnlyCard'; -// import { ImageOnlyContent } from '../../../models/ContentCard'; -// // Mock dependencies -// jest.mock('react-native', () => { -// const RN = jest.requireActual('react-native'); -// return { -// ...RN, -// Image: { -// ...RN.Image, -// getSize: jest.fn() -// } -// }; -// }); -// jest.mock('../../hooks/useAspectRatio', () => { -// return jest.fn(() => 1.5); -// }); -// const mockImageGetSize = Image.getSize as jest.MockedFunction; -// describe('ImageOnlyCard', () => { -// const mockOnPress = jest.fn(); -// const mockOnDismiss = jest.fn(); -// const baseContent: ImageOnlyContent = { -// image: { -// url: 'https://example.com/image.jpg', -// alt: 'Test image' -// }, -// dismissBtn: { -// style: 'circle' -// }, -// actionUrl: 'https://example.com/action' -// }; -// beforeEach(() => { -// jest.clearAllMocks(); -// mockImageGetSize.mockImplementation((uri, success) => { -// success(400, 300); -// }); -// }); -// describe('Basic rendering', () => { -// it('should render the component with image', () => { -// const { UNSAFE_getByType } = render( -// -// ); -// const image = UNSAFE_getByType(Image); -// expect(image).toBeTruthy(); -// }); -// it('should render dismiss button when dismissBtn style is provided', () => { -// render( -// -// ); -// expect(screen.getByText('x')).toBeTruthy(); -// }); -// it('should not render dismiss button when dismissBtn style is "none"', () => { -// const contentWithNoDismiss = { -// ...baseContent, -// dismissBtn: { style: 'none' as const } -// }; -// render( -// -// ); -// expect(screen.queryByText('x')).toBeNull(); -// }); -// it('should not render dismiss button when dismissBtn is not provided', () => { -// const contentWithoutDismiss = { -// ...baseContent, -// dismissBtn: undefined -// }; -// render( -// -// ); -// expect(screen.queryByText('x')).toBeNull(); -// }); -// it('should render with default image placeholder background', () => { -// render( -// -// ); -// // Component renders successfully with default styling -// const { UNSAFE_getByType } = render( -// -// ); -// expect(UNSAFE_getByType(Image)).toBeTruthy(); -// }); -// }); -// describe('Content variations', () => { -// it('should handle content with only image', () => { -// const imageOnlyContent = { -// image: { -// url: 'https://example.com/image.jpg' -// } -// }; -// const { UNSAFE_getByType } = render( -// -// ); -// expect(UNSAFE_getByType(Image)).toBeTruthy(); -// expect(screen.queryByText('x')).toBeNull(); -// }); -// it('should handle content with image and action URL', () => { -// const contentWithAction = { -// ...baseContent, -// actionUrl: 'https://example.com/action' -// }; -// const { UNSAFE_getByType } = render( -// -// ); -// expect(UNSAFE_getByType(Image)).toBeTruthy(); -// }); -// it('should handle different dismiss button styles', () => { -// const contentWithSimpleDismiss = { -// ...baseContent, -// dismissBtn: { style: 'simple' as const } -// }; -// render( -// -// ); -// expect(screen.getByText('x')).toBeTruthy(); -// }); -// }); -// describe('Interaction handling', () => { -// it('should call onPress when the card is pressed', () => { -// const { getByTestId } = render( -// -// ); -// const card = getByTestId('image-only-card'); -// fireEvent.press(card); -// expect(mockOnPress).toHaveBeenCalledTimes(1); -// }); -// it('should call onDismiss when dismiss button is pressed', () => { -// render( -// -// ); -// const dismissButton = screen.getByText('x'); -// fireEvent.press(dismissButton); -// expect(mockOnDismiss).toHaveBeenCalledTimes(1); -// }); -// it('should handle missing onPress callback gracefully', () => { -// expect(() => { -// render( -// -// ); -// }).not.toThrow(); -// }); -// it('should handle missing onDismiss callback gracefully', () => { -// expect(() => { -// render( -// -// ); -// }).not.toThrow(); -// }); -// }); -// describe('Style overrides', () => { -// it('should apply custom card styles', () => { -// const customStyles = { -// card: { backgroundColor: 'green', margin: 30 } -// }; -// const { getByTestId } = render( -// -// ); -// const card = getByTestId('image-only-card'); -// expect(card.props.style).toEqual( -// expect.arrayContaining([ -// expect.objectContaining({ -// backgroundColor: 'green', -// margin: 30 -// }) -// ]) -// ); -// }); -// it('should apply custom image container styles', () => { -// const customStyles = { -// imageContainer: { backgroundColor: 'blue', borderRadius: 15 } -// }; -// render( -// -// ); -// // Image container styles are applied but harder to test directly -// // This ensures no errors are thrown when applying custom styles -// const { UNSAFE_getByType } = render( -// -// ); -// expect(UNSAFE_getByType(Image)).toBeTruthy(); -// }); -// it('should apply custom image styles', () => { -// const customStyles = { -// image: { opacity: 0.7, borderRadius: 10 } -// }; -// render( -// -// ); -// // Image styles are applied but harder to test directly -// // This ensures no errors are thrown when applying custom styles -// const { UNSAFE_getByType } = render( -// -// ); -// expect(UNSAFE_getByType(Image)).toBeTruthy(); -// }); -// it('should apply custom dismiss button styles', () => { -// const customStyles = { -// dismissButton: { backgroundColor: 'red', opacity: 0.8 } -// }; -// render( -// -// ); -// expect(screen.getByText('x')).toBeTruthy(); -// }); -// }); -// describe('Component props forwarding', () => { -// it('should forward ContainerProps', () => { -// const containerProps = { -// testID: 'custom-container', -// accessibilityLabel: 'Image only card container' -// }; -// const { getByTestId } = render( -// -// ); -// const container = getByTestId('custom-container'); -// expect(container.props.accessibilityLabel).toBe('Image only card container'); -// }); -// it('should forward ImageContainerProps', () => { -// const imageContainerProps = { -// testID: 'custom-image-container', -// accessibilityLabel: 'Image container' -// }; -// render( -// -// ); -// // Component renders without errors when props are forwarded -// const { UNSAFE_getByType } = render( -// -// ); -// expect(UNSAFE_getByType(Image)).toBeTruthy(); -// }); -// it('should forward ImageProps', () => { -// const imageProps = { -// testID: 'custom-image', -// accessibilityLabel: 'Custom image' -// }; -// render( -// -// ); -// // Component renders without errors when props are forwarded -// const { UNSAFE_getByType } = render( -// -// ); -// expect(UNSAFE_getByType(Image)).toBeTruthy(); -// }); -// it('should forward DismissButtonProps', () => { -// const dismissButtonProps = { -// testID: 'custom-dismiss-button', -// accessibilityLabel: 'Close image' -// }; -// render( -// -// ); -// expect(screen.getByText('x')).toBeTruthy(); -// }); -// }); -// describe('Accessibility', () => { -// it('should accept custom accessibility props through ContainerProps', () => { -// const containerProps = { -// testID: 'image-only-card', -// accessibilityLabel: 'Image only content card', -// accessibilityHint: 'Double tap to view full image' -// }; -// const { getByTestId } = render( -// -// ); -// const card = getByTestId('image-only-card'); -// expect(card.props.accessibilityLabel).toBe('Image only content card'); -// expect(card.props.accessibilityHint).toBe('Double tap to view full image'); -// }); -// it('should support disabled state through ContainerProps', () => { -// const containerProps = { -// testID: 'image-only-card', -// disabled: true -// }; -// const { getByTestId } = render( -// -// ); -// const card = getByTestId('image-only-card'); -// expect(card.props.disabled).toBe(true); -// }); -// }); -// describe('Props forwarding', () => { -// it('should forward additional Pressable props through ContainerProps', () => { -// const containerProps = { -// testID: 'image-only-card', -// hitSlop: 20, -// delayLongPress: 700 -// }; -// const { getByTestId } = render( -// -// ); -// const card = getByTestId('image-only-card'); -// expect(card.props.hitSlop).toBe(20); -// expect(card.props.delayLongPress).toBe(700); -// }); -// }); -// describe('Edge cases', () => { -// it('should handle undefined content gracefully', () => { -// expect(() => { -// render( -// -// ); -// }).not.toThrow(); -// }); -// it('should handle empty content object', () => { -// expect(() => { -// render( -// -// ); -// }).not.toThrow(); -// }); -// it('should handle missing imageUri gracefully', () => { -// expect(() => { -// render( -// -// ); -// }).not.toThrow(); -// }); -// it('should handle image loading errors gracefully', () => { -// mockImageGetSize.mockImplementation((uri, success, error) => { -// error(new Error('Image load failed')); -// }); -// expect(() => { -// render( -// -// ); -// }).not.toThrow(); -// }); -// it('should handle content with null dismissBtn', () => { -// const contentWithNullDismiss = { -// ...baseContent, -// dismissBtn: null as any -// }; -// expect(() => { -// render( -// -// ); -// }).not.toThrow(); -// }); -// }); -// describe('Layout and styling', () => { -// it('should apply aspect ratio to image when provided', () => { -// render( -// -// ); -// // useAspectRatio hook is mocked to return 1.5 -// // This ensures the component uses the hook correctly -// const { UNSAFE_getByType } = render( -// -// ); -// expect(UNSAFE_getByType(Image)).toBeTruthy(); -// }); -// it('should handle height prop', () => { -// expect(() => { -// render( -// -// ); -// }).not.toThrow(); -// }); -// it('should render image with contain resize mode', () => { -// const { UNSAFE_getByType } = render( -// -// ); -// const image = UNSAFE_getByType(Image); -// expect(image.props.resizeMode).toBe('contain'); -// }); -// it('should position dismiss button within image container', () => { -// render( -// -// ); -// // Dismiss button should be rendered within the image container -// expect(screen.getByText('x')).toBeTruthy(); -// }); -// }); -// describe('Image source handling', () => { -// it('should use provided imageUri as image source', () => { -// const testImageUri = 'https://example.com/test-image.jpg'; -// const { UNSAFE_getByType } = render( -// -// ); -// const image = UNSAFE_getByType(Image); -// expect(image.props.source).toEqual({ uri: testImageUri }); -// }); -// it('should handle undefined imageUri', () => { -// const { UNSAFE_getByType } = render( -// -// ); -// const image = UNSAFE_getByType(Image); -// expect(image.props.source).toEqual({ uri: undefined }); -// }); -// }); -// }); -//# sourceMappingURL=ImageOnlyCard.spec.js.map \ No newline at end of file diff --git a/packages/messaging/dist/ui/components/ImageOnlyCard/ImageOnlyCard.spec.js.map b/packages/messaging/dist/ui/components/ImageOnlyCard/ImageOnlyCard.spec.js.map deleted file mode 100644 index d56a74d7..00000000 --- a/packages/messaging/dist/ui/components/ImageOnlyCard/ImageOnlyCard.spec.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ImageOnlyCard.spec.js","sourceRoot":"","sources":["../../../../src/ui/components/ImageOnlyCard/ImageOnlyCard.spec.tsx"],"names":[],"mappings":";AAAA,KAAK;AACL,iDAAiD;AACjD,8EAA8E;AAC9E,mFAAmF;AACnF,8CAA8C;AAC9C,mFAAmF;AACnF,yEAAyE;AACzE,gFAAgF;AAChF,4EAA4E;AAC5E,wEAAwE;AACxE,KAAK;;AAEL,6BAA6B;AAC7B,6EAA6E;AAC7E,wCAAwC;AACxC,+CAA+C;AAC/C,kEAAkE;AAElE,uBAAuB;AACvB,oCAAoC;AACpC,mDAAmD;AACnD,aAAa;AACb,aAAa;AACb,eAAe;AACf,qBAAqB;AACrB,2BAA2B;AAC3B,QAAQ;AACR,OAAO;AACP,MAAM;AAEN,kDAAkD;AAClD,+BAA+B;AAC/B,MAAM;AAEN,uFAAuF;AAEvF,oCAAoC;AACpC,mCAAmC;AACnC,qCAAqC;AAErC,4CAA4C;AAC5C,eAAe;AACf,8CAA8C;AAC9C,0BAA0B;AAC1B,SAAS;AACT,oBAAoB;AACpB,wBAAwB;AACxB,SAAS;AACT,8CAA8C;AAC9C,OAAO;AAEP,uBAAuB;AACvB,4BAA4B;AAC5B,8DAA8D;AAC9D,2BAA2B;AAC3B,UAAU;AACV,QAAQ;AAER,wCAAwC;AACxC,2DAA2D;AAC3D,6CAA6C;AAC7C,yBAAyB;AACzB,kCAAkC;AAClC,qDAAqD;AACrD,kCAAkC;AAClC,sCAAsC;AACtC,aAAa;AACb,WAAW;AAEX,+CAA+C;AAC/C,oCAAoC;AACpC,UAAU;AAEV,mFAAmF;AACnF,gBAAgB;AAChB,yBAAyB;AACzB,kCAAkC;AAClC,qDAAqD;AACrD,kCAAkC;AAClC,sCAAsC;AACtC,aAAa;AACb,WAAW;AAEX,oDAAoD;AACpD,UAAU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AAEV,qDAAqD;AACrD,6CAA6C;AAC7C,yBAAyB;AACzB,kCAAkC;AAClC,iCAAiC;AACjC,kCAAkC;AAClC,sCAAsC;AACtC,aAAa;AACb,WAAW;AAEX,+CAA+C;AAC/C,gEAAgE;AAChE,UAAU;AACV,QAAQ;AACR,MAAM"} \ No newline at end of file diff --git a/packages/messaging/dist/ui/components/LargeImageCard/LargeImageCard.d.ts b/packages/messaging/dist/ui/components/LargeImageCard/LargeImageCard.d.ts deleted file mode 100644 index dc6e9369..00000000 --- a/packages/messaging/dist/ui/components/LargeImageCard/LargeImageCard.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -import React from 'react'; -import { ButtonProps, ImageProps, ImageStyle, PressableProps, TextProps, TextStyle, ViewProps, ViewStyle } from 'react-native'; -import { LargeImageContentData } from '../../../models/ContentCard'; -import { DismissButtonProps } from '../DismissButton/DismissButton'; -export interface LargeImageContentStyle { - card?: ViewStyle; - container?: ViewStyle; - imageContainer?: ViewStyle; - image?: ImageStyle; - contentContainer?: ViewStyle; - textContent?: ViewStyle; - title?: TextStyle; - body?: TextStyle; - buttonContainer?: ViewStyle; - button?: PressableProps['style']; - buttonText?: TextStyle; - dismissButton?: PressableProps['style']; -} -export interface LargeImageCardProps extends PressableProps { - content: LargeImageContentData; - imageUri?: string; - styleOverrides?: LargeImageContentStyle; - onDismiss?: () => void; - onPress?: () => void; - ContainerProps?: ViewProps; - ImageContainerProps?: ViewProps; - ImageProps?: ImageProps; - TextProps?: TextProps; - TitleProps?: TextProps; - BodyProps?: TextProps; - ButtonContainerProps?: ViewProps; - ButtonProps?: ButtonProps; - DismissButtonProps?: DismissButtonProps; -} -declare const LargeImageCard: React.FC; -export default LargeImageCard; diff --git a/packages/messaging/dist/ui/components/LargeImageCard/LargeImageCard.js b/packages/messaging/dist/ui/components/LargeImageCard/LargeImageCard.js deleted file mode 100644 index 7d76795f..00000000 --- a/packages/messaging/dist/ui/components/LargeImageCard/LargeImageCard.js +++ /dev/null @@ -1,106 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -/* - Copyright 2025 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law - or agreed to in writing, software distributed under the License is - distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF - ANY KIND, either express or implied. See the License for the specific - language governing permissions and limitations under the License. -*/ -const react_1 = tslib_1.__importDefault(require("react")); -const react_native_1 = require("react-native"); -const Button_1 = tslib_1.__importDefault(require("../Button/Button")); -const DismissButton_1 = tslib_1.__importDefault(require("../DismissButton/DismissButton")); -const useAspectRatio_1 = tslib_1.__importDefault(require("../../hooks/useAspectRatio")); -const ThemeProvider_1 = require("../../theme/ThemeProvider"); -const LargeImageCard = (_a) => { - var _b, _c, _d, _e, _f; - var { BodyProps, ButtonContainerProps, ButtonProps, ContainerProps, DismissButtonProps, ImageContainerProps, ImageProps, TextProps, TitleProps, content, imageUri, styleOverrides, onDismiss, onPress } = _a, props = tslib_1.__rest(_a, ["BodyProps", "ButtonContainerProps", "ButtonProps", "ContainerProps", "DismissButtonProps", "ImageContainerProps", "ImageProps", "TextProps", "TitleProps", "content", "imageUri", "styleOverrides", "onDismiss", "onPress"]); - const theme = (0, ThemeProvider_1.useTheme)(); - const imageAspectRatio = (0, useAspectRatio_1.default)(imageUri); - return ( - {imageUri && ( - - )} - {((_b = content === null || content === void 0 ? void 0 : content.title) === null || _b === void 0 ? void 0 : _b.content) && ( - {content.title.content} - )} - {((_c = content === null || content === void 0 ? void 0 : content.body) === null || _c === void 0 ? void 0 : _c.content) && ( - {content.body.content} - )} - - {((_d = content === null || content === void 0 ? void 0 : content.buttons) === null || _d === void 0 ? void 0 : _d.length) && - ((_e = content === null || content === void 0 ? void 0 : content.buttons) === null || _e === void 0 ? void 0 : _e.length) > 0 && - content.buttons.map((button) => ())} - - {(content === null || content === void 0 ? void 0 : content.dismissBtn) && ((_f = content.dismissBtn) === null || _f === void 0 ? void 0 : _f.style) !== 'none' && ()} - ); -}; -exports.default = LargeImageCard; -const styles = react_native_1.StyleSheet.create({ - card: { - borderRadius: 12, - margin: 15, - flex: 1, - gap: 8 - }, - container: { - flexDirection: 'row' - }, - imageContainer: { - borderRadius: 12, - alignItems: 'center' - }, - image: { - width: '100%', - resizeMode: 'contain' - }, - contentContainer: { - flex: 1, - paddingVertical: 16, - paddingHorizontal: 16, - justifyContent: 'flex-start' - }, - textContent: { - flex: 1, - justifyContent: 'flex-start', - marginBottom: 16 - }, - title: { - fontSize: 16, - fontWeight: '600', - marginBottom: 8, - marginRight: 16 - }, - body: { - fontSize: 14, - lineHeight: 18 - }, - buttonContainer: { - flexDirection: 'row', - justifyContent: 'flex-start', - paddingTop: 8, - gap: 8 - }, - button: { - marginHorizontal: 8 - } -}); -//# sourceMappingURL=LargeImageCard.js.map \ No newline at end of file diff --git a/packages/messaging/dist/ui/components/LargeImageCard/LargeImageCard.js.map b/packages/messaging/dist/ui/components/LargeImageCard/LargeImageCard.js.map deleted file mode 100644 index 758f2367..00000000 --- a/packages/messaging/dist/ui/components/LargeImageCard/LargeImageCard.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"LargeImageCard.js","sourceRoot":"","sources":["../../../../src/ui/components/LargeImageCard/LargeImageCard.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;EAUE;AACF,0DAA0B;AAC1B,+CAcsB;AAEtB,sEAAsC;AACtC,2FAEwC;AACxC,wFAAwD;AACxD,6DAAqD;AAkCrD,MAAM,cAAc,GAAkC,CAAC,EAgBtD,EAAE,EAAE;;QAhBkD,EACrD,SAAS,EACT,oBAAoB,EACpB,WAAW,EACX,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,UAAU,EACV,SAAS,EACT,UAAU,EACV,OAAO,EACP,QAAQ,EACR,cAAc,EACd,SAAS,EACT,OA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5B,UAAU,EAAE,CAAC;QACb,GAAG,EAAE,CAAC;KACP;IACD,MAAM,EAAE;QACN,gBAAgB,EAAE,CAAC;KACpB;CACF,CAAC,CAAC"} \ No newline at end of file diff --git a/packages/messaging/dist/ui/components/LargeImageCard/LargeImageCard.spec.d.ts b/packages/messaging/dist/ui/components/LargeImageCard/LargeImageCard.spec.d.ts deleted file mode 100644 index cb0ff5c3..00000000 --- a/packages/messaging/dist/ui/components/LargeImageCard/LargeImageCard.spec.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/packages/messaging/dist/ui/components/LargeImageCard/LargeImageCard.spec.js b/packages/messaging/dist/ui/components/LargeImageCard/LargeImageCard.spec.js deleted file mode 100644 index 747b4308..00000000 --- a/packages/messaging/dist/ui/components/LargeImageCard/LargeImageCard.spec.js +++ /dev/null @@ -1,795 +0,0 @@ -"use strict"; -// /* -// Copyright 2025 Adobe. All rights reserved. -// This file is licensed to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law -// or agreed to in writing, software distributed under the License is -// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF -// ANY KIND, either express or implied. See the License for the specific -// language governing permissions and limitations under the License. -// */ -Object.defineProperty(exports, "__esModule", { value: true }); -// import React from 'react'; -// import { render, screen, fireEvent } from '@testing-library/react-native'; -// import { Image, useColorScheme } from 'react-native'; -// import LargeImageCard from './LargeImageCard'; -// import { LargeImageContentData } from '../../../models/ContentCard'; -// import { ThemeProvider } from '../../theme/ThemeProvider'; -// // Mock dependencies -// jest.mock('react-native', () => { -// const RN = jest.requireActual('react-native'); -// return { -// ...RN, -// useColorScheme: jest.fn(), -// Image: { -// ...RN.Image, -// getSize: jest.fn() -// } -// }; -// }); -// jest.mock('../../hooks/useAspectRatio', () => { -// return jest.fn(() => 1.5); -// }); -// const mockUseColorScheme = useColorScheme as jest.MockedFunction; -// const mockImageGetSize = Image.getSize as jest.MockedFunction; -// // Test wrapper component with theme provider -// const TestWrapper: React.FC<{ children: React.ReactNode }> = ({ children }) => ( -// {children} -// ); -// describe('LargeImageCard', () => { -// const mockOnPress = jest.fn(); -// const mockOnDismiss = jest.fn(); -// const baseContent: LargeImageContentData = { -// title: { -// content: 'Large Image Title' -// }, -// body: { -// content: 'Large image card body content' -// }, -// buttons: [ -// { -// id: 'button1', -// interactId: 'interact1', -// actionUrl: 'https://example.com', -// text: { -// content: 'Action Button' -// } -// } -// ], -// dismissBtn: { -// style: 'circle' -// } -// }; -// beforeEach(() => { -// jest.clearAllMocks(); -// mockUseColorScheme.mockReturnValue('light'); -// mockImageGetSize.mockImplementation((uri, success) => { -// success(400, 300); -// }); -// }); -// describe('Basic rendering', () => { -// it('should render the component with basic content', () => { -// render( -// -// -// -// ); -// expect(screen.getByText('Large Image Title')).toBeTruthy(); -// expect(screen.getByText('Large image card body content')).toBeTruthy(); -// expect(screen.getByText('Action Button')).toBeTruthy(); -// }); -// it('should render with image when imageUri is provided', () => { -// const { UNSAFE_getByType } = render( -// -// -// -// ); -// const images = UNSAFE_getByType(Image); -// expect(images).toBeTruthy(); -// }); -// it('should not render image container when imageUri is not provided', () => { -// const { UNSAFE_queryByType } = render( -// -// -// -// ); -// const images = UNSAFE_queryByType(Image); -// expect(images).toBeNull(); -// }); -// it('should render dismiss button when dismissBtn style is not "none"', () => { -// render( -// -// -// -// ); -// expect(screen.getByText('x')).toBeTruthy(); -// }); -// it('should not render dismiss button when dismissBtn style is "none"', () => { -// const contentWithNoDismiss = { -// ...baseContent, -// dismissBtn: { style: 'none' as const } -// }; -// render( -// -// -// -// ); -// expect(screen.queryByText('x')).toBeNull(); -// }); -// it('should not render dismiss button when dismissBtn is not provided', () => { -// const contentWithoutDismiss = { -// ...baseContent, -// dismissBtn: undefined -// }; -// render( -// -// -// -// ); -// expect(screen.queryByText('x')).toBeNull(); -// }); -// }); -// describe('Content variations', () => { -// it('should handle content with only title', () => { -// const titleOnlyContent = { -// title: { -// content: 'Title Only' -// } -// }; -// render( -// -// -// -// ); -// expect(screen.getByText('Title Only')).toBeTruthy(); -// expect(screen.queryByText('Large image card body content')).toBeNull(); -// }); -// it('should handle content with only body', () => { -// const bodyOnlyContent = { -// body: { -// content: 'Body Only' -// } -// }; -// render( -// -// -// -// ); -// expect(screen.getByText('Body Only')).toBeTruthy(); -// expect(screen.queryByText('Large Image Title')).toBeNull(); -// }); -// it('should handle content with no buttons', () => { -// const noButtonsContent = { -// ...baseContent, -// buttons: undefined -// }; -// render( -// -// -// -// ); -// expect(screen.getByText('Large Image Title')).toBeTruthy(); -// expect(screen.queryByText('Action Button')).toBeNull(); -// }); -// it('should handle content with empty buttons array', () => { -// const emptyButtonsContent = { -// ...baseContent, -// buttons: [] -// }; -// render( -// -// -// -// ); -// expect(screen.getByText('Large Image Title')).toBeTruthy(); -// expect(screen.queryByText('Action Button')).toBeNull(); -// }); -// it('should render multiple buttons', () => { -// const multiButtonContent = { -// ...baseContent, -// buttons: [ -// { -// id: 'button1', -// interactId: 'interact1', -// actionUrl: 'https://example.com', -// text: { content: 'Primary Action' } -// }, -// { -// id: 'button2', -// interactId: 'interact2', -// actionUrl: 'https://example2.com', -// text: { content: 'Secondary Action' } -// } -// ] -// }; -// render( -// -// -// -// ); -// expect(screen.getByText('Primary Action')).toBeTruthy(); -// expect(screen.getByText('Secondary Action')).toBeTruthy(); -// }); -// }); -// describe('Interaction handling', () => { -// it('should call onPress when the card is pressed', () => { -// const { getByTestId } = render( -// -// -// -// ); -// const card = getByTestId('large-image-card'); -// fireEvent.press(card); -// expect(mockOnPress).toHaveBeenCalledTimes(1); -// }); -// it('should call onDismiss when dismiss button is pressed', () => { -// render( -// -// -// -// ); -// const dismissButton = screen.getByText('x'); -// fireEvent.press(dismissButton); -// expect(mockOnDismiss).toHaveBeenCalledTimes(1); -// }); -// it('should call onPress when a button is pressed', () => { -// render( -// -// -// -// ); -// const button = screen.getByText('Action Button'); -// fireEvent.press(button); -// expect(mockOnPress).toHaveBeenCalledTimes(1); -// }); -// it('should handle missing onPress callback gracefully', () => { -// expect(() => { -// render( -// -// -// -// ); -// }).not.toThrow(); -// }); -// it('should handle missing onDismiss callback gracefully', () => { -// expect(() => { -// render( -// -// -// -// ); -// }).not.toThrow(); -// }); -// }); -// describe('Style overrides', () => { -// it('should apply custom card styles', () => { -// const customStyles = { -// card: { backgroundColor: 'blue', margin: 25 } -// }; -// const { getByTestId } = render( -// -// -// -// ); -// const card = getByTestId('large-image-card'); -// expect(card.props.style).toEqual( -// expect.arrayContaining([ -// expect.objectContaining({ -// backgroundColor: 'blue', -// margin: 25 -// }) -// ]) -// ); -// }); -// it('should apply custom text styles', () => { -// const customStyles = { -// title: { fontSize: 24, fontWeight: 'bold' as const }, -// body: { fontSize: 16, fontStyle: 'italic' as const } -// }; -// render( -// -// -// -// ); -// const title = screen.getByText('Large Image Title'); -// const body = screen.getByText('Large image card body content'); -// expect(title.props.style).toEqual( -// expect.arrayContaining([ -// expect.objectContaining({ -// fontSize: 24, -// fontWeight: 'bold' -// }) -// ]) -// ); -// expect(body.props.style).toEqual( -// expect.arrayContaining([ -// expect.objectContaining({ -// fontSize: 16, -// fontStyle: 'italic' -// }) -// ]) -// ); -// }); -// it('should apply custom image styles', () => { -// const customStyles = { -// imageContainer: { borderRadius: 25 }, -// image: { opacity: 0.9 } -// }; -// render( -// -// -// -// ); -// // Image styles are applied but harder to test directly -// // This ensures no errors are thrown when applying custom styles -// expect(screen.getByText('Large Image Title')).toBeTruthy(); -// }); -// }); -// describe('Component props forwarding', () => { -// it('should forward ContainerProps', () => { -// const containerProps = { -// testID: 'custom-container', -// accessibilityLabel: 'Custom container' -// }; -// render( -// -// -// -// ); -// // Component renders without errors when props are forwarded -// expect(screen.getByText('Large Image Title')).toBeTruthy(); -// }); -// it('should forward ImageContainerProps when image is present', () => { -// const imageContainerProps = { -// testID: 'custom-image-container', -// accessibilityLabel: 'Image container' -// }; -// render( -// -// -// -// ); -// expect(screen.getByText('Large Image Title')).toBeTruthy(); -// }); -// it('should forward ImageProps when image is present', () => { -// const imageProps = { -// testID: 'custom-image', -// accessibilityLabel: 'Large image' -// }; -// render( -// -// -// -// ); -// expect(screen.getByText('Large Image Title')).toBeTruthy(); -// }); -// it('should forward TextProps to title and body', () => { -// const textProps = { -// numberOfLines: 2, -// ellipsizeMode: 'tail' as const -// }; -// render( -// -// -// -// ); -// const title = screen.getByText('Large Image Title'); -// const body = screen.getByText('Large image card body content'); -// expect(title.props.numberOfLines).toBe(2); -// expect(body.props.numberOfLines).toBe(2); -// }); -// it('should forward TitleProps specifically to title', () => { -// const titleProps = { -// numberOfLines: 1, -// testID: 'custom-title' -// }; -// render( -// -// -// -// ); -// const title = screen.getByText('Large Image Title'); -// expect(title.props.numberOfLines).toBe(1); -// expect(title.props.testID).toBe('custom-title'); -// }); -// it('should forward BodyProps specifically to body', () => { -// const bodyProps = { -// numberOfLines: 3, -// testID: 'custom-body' -// }; -// render( -// -// -// -// ); -// const body = screen.getByText('Large image card body content'); -// expect(body.props.numberOfLines).toBe(3); -// expect(body.props.testID).toBe('custom-body'); -// }); -// it('should forward ButtonContainerProps', () => { -// const buttonContainerProps = { -// testID: 'custom-button-container' -// }; -// render( -// -// -// -// ); -// expect(screen.getByText('Action Button')).toBeTruthy(); -// }); -// it('should forward ButtonProps to buttons', () => { -// const buttonProps = { -// testID: 'custom-button' -// }; -// render( -// -// -// -// ); -// expect(screen.getByText('Action Button')).toBeTruthy(); -// }); -// it('should forward DismissButtonProps', () => { -// const dismissButtonProps = { -// testID: 'custom-dismiss-button' -// }; -// render( -// -// -// -// ); -// expect(screen.getByText('x')).toBeTruthy(); -// }); -// }); -// describe('Theme integration', () => { -// it('should apply light theme colors', () => { -// mockUseColorScheme.mockReturnValue('light'); -// render( -// -// -// -// ); -// const title = screen.getByText('Large Image Title'); -// const body = screen.getByText('Large image card body content'); -// expect(title.props.style).toEqual( -// expect.arrayContaining([ -// expect.objectContaining({ -// color: '#000000' // Default light theme primary text color -// }) -// ]) -// ); -// expect(body.props.style).toEqual( -// expect.arrayContaining([ -// expect.objectContaining({ -// color: '#000000' // Default light theme primary text color -// }) -// ]) -// ); -// }); -// it('should apply dark theme colors', () => { -// mockUseColorScheme.mockReturnValue('dark'); -// render( -// -// -// -// ); -// const title = screen.getByText('Large Image Title'); -// const body = screen.getByText('Large image card body content'); -// expect(title.props.style).toEqual( -// expect.arrayContaining([ -// expect.objectContaining({ -// color: '#FFFFFF' // Default dark theme primary text color -// }) -// ]) -// ); -// expect(body.props.style).toEqual( -// expect.arrayContaining([ -// expect.objectContaining({ -// color: '#FFFFFF' // Default dark theme primary text color -// }) -// ]) -// ); -// }); -// }); -// describe('Accessibility', () => { -// it('should accept custom accessibility props', () => { -// const { getByTestId } = render( -// -// -// -// ); -// const card = getByTestId('large-image-card'); -// expect(card.props.accessibilityLabel).toBe('Large content card'); -// expect(card.props.accessibilityHint).toBe('Double tap to interact'); -// }); -// it('should support disabled state', () => { -// const { getByTestId } = render( -// -// -// -// ); -// const card = getByTestId('large-image-card'); -// expect(card.props.disabled).toBe(true); -// }); -// }); -// describe('Props forwarding', () => { -// it('should forward additional Pressable props', () => { -// const { getByTestId } = render( -// -// -// -// ); -// const card = getByTestId('large-image-card'); -// expect(card.props.hitSlop).toBe(15); -// expect(card.props.delayLongPress).toBe(600); -// }); -// }); -// describe('Edge cases', () => { -// it('should handle undefined content gracefully', () => { -// expect(() => { -// render( -// -// -// -// ); -// }).not.toThrow(); -// }); -// it('should handle empty content object', () => { -// expect(() => { -// render( -// -// -// -// ); -// }).not.toThrow(); -// }); -// it('should handle content with empty strings', () => { -// const emptyStringContent = { -// title: { content: '' }, -// body: { content: '' } -// }; -// render( -// -// -// -// ); -// // Empty strings should not render the text components -// expect(screen.queryByText('')).toBeNull(); -// }); -// it('should handle image loading errors gracefully', () => { -// mockImageGetSize.mockImplementation((uri, success, error) => { -// error(new Error('Image load failed')); -// }); -// expect(() => { -// render( -// -// -// -// ); -// }).not.toThrow(); -// }); -// it('should handle undefined color scheme gracefully', () => { -// mockUseColorScheme.mockReturnValue(undefined as any); -// expect(() => { -// render( -// -// -// -// ); -// }).not.toThrow(); -// }); -// }); -// describe('Layout and styling', () => { -// it('should render button container even when no buttons are present', () => { -// const noButtonsContent = { -// ...baseContent, -// buttons: [] -// }; -// render( -// -// -// -// ); -// // Button container should still be rendered (but empty) -// expect(screen.getByText('Large Image Title')).toBeTruthy(); -// }); -// it('should apply aspect ratio to image when provided', () => { -// render( -// -// -// -// ); -// // useAspectRatio hook is mocked to return 1.5 -// // This ensures the component uses the hook correctly -// expect(screen.getByText('Large Image Title')).toBeTruthy(); -// }); -// }); -// }); -//# sourceMappingURL=LargeImageCard.spec.js.map \ No newline at end of file diff --git a/packages/messaging/dist/ui/components/LargeImageCard/LargeImageCard.spec.js.map b/packages/messaging/dist/ui/components/LargeImageCard/LargeImageCard.spec.js.map deleted file mode 100644 index e8dbc3b0..00000000 --- a/packages/messaging/dist/ui/components/LargeImageCard/LargeImageCard.spec.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"LargeImageCard.spec.js","sourceRoot":"","sources":["../../../../src/ui/components/LargeImageCard/LargeImageCard.spec.tsx"],"names":[],"mappings":";AAAA,KAAK;AACL,iDAAiD;AACjD,8EAA8E;AAC9E,mFAAmF;AACnF,8CAA8C;AAC9C,mFAAmF;AACnF,yEAAyE;AACzE,gFAAgF;AAChF,4EAA4E;AAC5E,wEAAwE;AACxE,KAAK;;AAEL,6BAA6B;AAC7B,6EAA6E;AAC7E,wDAAwD;AACxD,iDAAiD;AACjD,uEAAuE;AACvE,6DAA6D;AAE7D,uBAAuB;AACvB,oCAAoC;AACpC,mDAAmD;AACnD,aAAa;AACb,aAAa;AACb,iCAAiC;AACjC,eAAe;AACf,qBAAqB;AACrB,2BAA2B;AAC3B,QAAQ;AACR,OAAO;AACP,MAAM;AAEN,kDAAkD;AAClD,+BAA+B;AAC/B,MAAM;A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BAA2B;AAC3B,aAAa;AACb,0BAA0B;AAC1B,UAAU;AAEV,oEAAoE;AACpE,8DAA8D;AAE9D,uBAAuB;AACvB,kBAAkB;AAClB,0BAA0B;AAC1B,8BAA8B;AAC9B,sCAAsC;AACtC,sCAAsC;AACtC,0CAA0C;AAC1C,iBAAiB;AACjB,2BAA2B;AAC3B,aAAa;AACb,0BAA0B;AAC1B,UAAU;AACV,QAAQ;AAER,2CAA2C;AAC3C,oFAAoF;AACpF,mCAAmC;AACnC,0BAA0B;AAC1B,sBAAsB;AACtB,WAAW;AAEX,gBAAgB;AAChB,wBAAwB;AACxB,4BAA4B;AAC5B,yCAAyC;AACzC,oCAAoC;AACpC,wCAAwC;AACxC,eAAe;AACf,yBAAyB;AACzB,WAAW;AAEX,iEAAiE;AACjE,oEAAoE;AACpE,UAAU;AAEV,qEAAqE;AACrE,gBAAgB;AAChB,wBAAwB;AACxB,4BAA4B;AAC5B,oCAAoC;AACpC,uDAAuD;AACvD,oCAAoC;AACpC,wCAAwC;AACxC,eAAe;AACf,yBAAyB;AACzB,WAAW;AAEX,uDAAuD;AACvD,8DAA8D;AAC9D,oEAAoE;AACpE,UAAU;AACV,QAAQ;AACR,MAAM"} \ No newline at end of file diff --git a/packages/messaging/dist/ui/components/SmallImageCard/SmallImageCard.d.ts b/packages/messaging/dist/ui/components/SmallImageCard/SmallImageCard.d.ts deleted file mode 100644 index d7db53af..00000000 --- a/packages/messaging/dist/ui/components/SmallImageCard/SmallImageCard.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { ImageStyle, PressableProps, TextStyle, ViewStyle } from 'react-native'; -import { SmallImageContentData } from '../../../models/ContentCard'; -import { ComponentOverrideProps } from '../../types'; -export interface SmallImageContentStyle { - /** Applies to the root of the content card */ - card?: ViewStyle; - /** Applies to the container inside the content card, applied inside the card Pressable */ - container?: ViewStyle; - imageContainer?: ViewStyle; - image?: ImageStyle; - contentContainer?: ViewStyle; - /** Applies to title and body properties, will be overridden by title and body styles */ - text?: TextStyle; - title?: TextStyle; - body?: TextStyle; - buttonContainer?: ViewStyle; - button?: PressableProps['style']; - buttonText?: TextStyle; - dismissButton?: PressableProps['style']; -} -export type SmallImageCardProps = PressableProps & ComponentOverrideProps & { - content: SmallImageContentData; - imageUri?: string; - height?: number; - styleOverrides?: SmallImageContentStyle; - onDismiss?: () => void; - onPress?: () => void; -}; -declare const SmallImageCard: React.FC; -export default SmallImageCard; diff --git a/packages/messaging/dist/ui/components/SmallImageCard/SmallImageCard.js b/packages/messaging/dist/ui/components/SmallImageCard/SmallImageCard.js deleted file mode 100644 index 799d289f..00000000 --- a/packages/messaging/dist/ui/components/SmallImageCard/SmallImageCard.js +++ /dev/null @@ -1,121 +0,0 @@ -"use strict"; -/* - Copyright 2025 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law - or agreed to in writing, software distributed under the License is - distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF - ANY KIND, either express or implied. See the License for the specific - language governing permissions and limitations under the License. -*/ -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -const react_native_1 = require("react-native"); -const Button_1 = tslib_1.__importDefault(require("../Button/Button")); -const DismissButton_1 = tslib_1.__importDefault(require("../DismissButton/DismissButton")); -const ThemeProvider_1 = require("../../theme/ThemeProvider"); -const useAspectRatio_1 = tslib_1.__importDefault(require("../../hooks/useAspectRatio")); -const SmallImageCard = (_a) => { - var _b, _c, _d, _e, _f; - var { content, height, imageUri, styleOverrides, style, onDismiss, onPress, ContainerProps, ImageProps, ContentContainerProps, TextProps, TitleProps, BodyProps, ButtonContainerProps, ButtonProps, DismissButtonProps, ImageContainerProps } = _a, props = tslib_1.__rest(_a, ["content", "height", "imageUri", "styleOverrides", "style", "onDismiss", "onPress", "ContainerProps", "ImageProps", "ContentContainerProps", "TextProps", "TitleProps", "BodyProps", "ButtonContainerProps", "ButtonProps", "DismissButtonProps", "ImageContainerProps"]); - const theme = (0, ThemeProvider_1.useTheme)(); - const imageAspectRatio = (0, useAspectRatio_1.default)(imageUri); - return ( [ - styles.card, - styleOverrides === null || styleOverrides === void 0 ? void 0 : styleOverrides.card, - typeof style === 'function' ? style(state) : style - ]} {...props}> - - {imageUri && ( - - )} - - - {((_b = content === null || content === void 0 ? void 0 : content.title) === null || _b === void 0 ? void 0 : _b.content) && ( - {content.title.content} - )} - {((_c = content === null || content === void 0 ? void 0 : content.body) === null || _c === void 0 ? void 0 : _c.content) && ( - {content.body.content} - )} - - {((_d = content === null || content === void 0 ? void 0 : content.buttons) === null || _d === void 0 ? void 0 : _d.length) && - ((_e = content === null || content === void 0 ? void 0 : content.buttons) === null || _e === void 0 ? void 0 : _e.length) > 0 && - content.buttons.map((button) => ())} - - {(content === null || content === void 0 ? void 0 : content.dismissBtn) && ((_f = content.dismissBtn) === null || _f === void 0 ? void 0 : _f.style) !== 'none' && ()} - - - ); -}; -exports.default = SmallImageCard; -const styles = react_native_1.StyleSheet.create({ - card: { - borderRadius: 12, - margin: 15, - flex: 1, - flexDirection: 'row', - gap: 8, - maxWidth: '100%', - alignItems: 'center' - }, - container: { - flexDirection: 'row', - minHeight: 120 - }, - imageContainer: { - borderRadius: 12, - width: 'auto', - height: '100%' - }, - image: { - height: '100%', - resizeMode: 'contain' - }, - contentContainer: { - flex: 1, - paddingVertical: 16, - paddingHorizontal: 16, - justifyContent: 'flex-start' - }, - textContent: { - flex: 1, - justifyContent: 'flex-start', - marginBottom: 16 - }, - title: { - fontSize: 16, - fontWeight: '600', - marginBottom: 8, - marginRight: 16 - }, - body: { - fontSize: 14, - lineHeight: 18 - }, - buttonContainer: { - flexDirection: 'row', - justifyContent: 'flex-start', - paddingTop: 8, - gap: 8 - }, - button: { - marginHorizontal: 8 - } -}); -//# sourceMappingURL=SmallImageCard.js.map \ No newline at end of file diff --git a/packages/messaging/dist/ui/components/SmallImageCard/SmallImageCard.js.map b/packages/messaging/dist/ui/components/SmallImageCard/SmallImageCard.js.map deleted file mode 100644 index 82e83aed..00000000 --- a/packages/messaging/dist/ui/components/SmallImageCard/SmallImageCard.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"SmallImageCard.js","sourceRoot":"","sources":["../../../../src/ui/components/SmallImageCard/SmallImageCard.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;EAUE;;;AAEF,+CAUsB;AACtB,sEAAsC;AAEtC,2FAA2D;AAC3D,6DAAqD;AACrD,wFAAwD;AAgCxD,MAAM,cAAc,GAAkC,CAAC,EAmBtD,EAAE,EAAE;;QAnBkD,EACrD,OAAO,EACP,MAAM,EACN,QAAQ,EACR,cAAc,EACd,KAAK,EACL,SAAS,EACT,OAAO,EACP,cAAc,EACd,UAAU,EACV,qBAAqB,EACrB,SAAS,EACT,UAAU,EACV,SAAS,EACT,oBAAoB,EACpB,WAAW,EACX,kBAAkB,EAClB,mBAAmB,OAEpB,EADI,KAAK,sBAlB6C,yQAmBtD,CADS;IAER,MAAM,KAAK,GAAG,IAAA,wBAAQ,GAAE,CAAC;IACzB,MAAM,gBAAgB,GAAG,IAAA,wBAAc,EAAC,QAAQ,CAAC,CAAC;IAElD,OAAO,CACL,CAAC,wBAAS,CACR,OAAO,CAAC,CAAC,OAAO,CAAC,CACjB,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC;YAChB,MAAM,CAAC,IAAI;YACX,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,IAAI;YACpB,OAAO,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK;SACnD,CAAC,CACF,IAAI,KAAK,CAAC,CAEV;MAAA,CAAC,mBAAI,CACH,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,EAAE,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,SAAS,CAAC,CAAC,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ACf,WAAW,EAAE,EAAE;KAChB;IACD,IAAI,EAAE;QACJ,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,EAAE;KACf;IACD,eAAe,EAAE;QACf,aAAa,EAAE,KAAK;QACpB,cAAc,EAAE,YAAY;QAC5B,UAAU,EAAE,CAAC;QACb,GAAG,EAAE,CAAC;KACP;IACD,MAAM,EAAE;QACN,gBAAgB,EAAE,CAAC;KACpB;CACF,CAAC,CAAC"} \ No newline at end of file diff --git a/packages/messaging/dist/ui/components/SmallImageCard/SmallImageCard.spec.d.ts b/packages/messaging/dist/ui/components/SmallImageCard/SmallImageCard.spec.d.ts deleted file mode 100644 index cb0ff5c3..00000000 --- a/packages/messaging/dist/ui/components/SmallImageCard/SmallImageCard.spec.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/packages/messaging/dist/ui/components/SmallImageCard/SmallImageCard.spec.js b/packages/messaging/dist/ui/components/SmallImageCard/SmallImageCard.spec.js deleted file mode 100644 index 256fa22c..00000000 --- a/packages/messaging/dist/ui/components/SmallImageCard/SmallImageCard.spec.js +++ /dev/null @@ -1,704 +0,0 @@ -"use strict"; -// /* -// Copyright 2025 Adobe. All rights reserved. -// This file is licensed to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law -// or agreed to in writing, software distributed under the License is -// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF -// ANY KIND, either express or implied. See the License for the specific -// language governing permissions and limitations under the License. -// */ -Object.defineProperty(exports, "__esModule", { value: true }); -// import React from 'react'; -// import { render, screen, fireEvent } from '@testing-library/react-native'; -// import { Image, useColorScheme } from 'react-native'; -// import SmallImageCard from './SmallImageCard'; -// import { SmallImageContentData } from '../../../models/ContentCard'; -// import { ThemeProvider } from '../../theme/ThemeProvider'; -// // Mock dependencies -// jest.mock('react-native', () => { -// const RN = jest.requireActual('react-native'); -// return { -// ...RN, -// useColorScheme: jest.fn(), -// Image: { -// ...RN.Image, -// getSize: jest.fn() -// } -// }; -// }); -// jest.mock('../../hooks/useAspectRatio', () => { -// return jest.fn(() => 1.5); -// }); -// const mockUseColorScheme = useColorScheme as jest.MockedFunction; -// const mockImageGetSize = Image.getSize as jest.MockedFunction; -// // Test wrapper component with theme provider -// const TestWrapper: React.FC<{ children: React.ReactNode }> = ({ children }) => ( -// {children} -// ); -// describe('SmallImageCard', () => { -// const mockOnPress = jest.fn(); -// const mockOnDismiss = jest.fn(); -// const baseContent: SmallImageContentData = { -// title: { -// content: 'Test Title' -// }, -// body: { -// content: 'Test body content' -// }, -// buttons: [ -// { -// id: 'button1', -// interactId: 'interact1', -// actionUrl: 'https://example.com', -// text: { -// content: 'Click Me' -// } -// } -// ], -// dismissBtn: { -// style: 'simple' -// } -// }; -// beforeEach(() => { -// jest.clearAllMocks(); -// mockUseColorScheme.mockReturnValue('light'); -// mockImageGetSize.mockImplementation((uri, success) => { -// success(300, 200); -// }); -// }); -// describe('Basic rendering', () => { -// it('should render the component with basic content', () => { -// render( -// -// -// -// ); -// expect(screen.getByText('Test Title')).toBeTruthy(); -// expect(screen.getByText('Test body content')).toBeTruthy(); -// expect(screen.getByText('Click Me')).toBeTruthy(); -// }); -// it('should render with image when imageUri is provided', () => { -// const { UNSAFE_getByType } = render( -// -// -// -// ); -// const images = UNSAFE_getByType(Image); -// expect(images).toBeTruthy(); -// }); -// it('should not render image container when imageUri is not provided', () => { -// const { UNSAFE_queryByType } = render( -// -// -// -// ); -// const images = UNSAFE_queryByType(Image); -// expect(images).toBeNull(); -// }); -// it('should render dismiss button when dismissBtn style is not "none"', () => { -// render( -// -// -// -// ); -// expect(screen.getByText('x')).toBeTruthy(); -// }); -// it('should not render dismiss button when dismissBtn style is "none"', () => { -// const contentWithNoDismiss = { -// ...baseContent, -// dismissBtn: { style: 'none' as const } -// }; -// render( -// -// -// -// ); -// expect(screen.queryByText('x')).toBeNull(); -// }); -// it('should not render dismiss button when dismissBtn is not provided', () => { -// const contentWithoutDismiss = { -// ...baseContent, -// dismissBtn: undefined -// }; -// render( -// -// -// -// ); -// expect(screen.queryByText('x')).toBeNull(); -// }); -// }); -// describe('Content variations', () => { -// it('should handle content with only title', () => { -// const titleOnlyContent = { -// title: { -// content: 'Title Only' -// } -// }; -// render( -// -// -// -// ); -// expect(screen.getByText('Title Only')).toBeTruthy(); -// expect(screen.queryByText('Test body content')).toBeNull(); -// }); -// it('should handle content with only body', () => { -// const bodyOnlyContent = { -// body: { -// content: 'Body Only' -// } -// }; -// render( -// -// -// -// ); -// expect(screen.getByText('Body Only')).toBeTruthy(); -// expect(screen.queryByText('Test Title')).toBeNull(); -// }); -// it('should handle content with no buttons', () => { -// const noButtonsContent = { -// ...baseContent, -// buttons: undefined -// }; -// render( -// -// -// -// ); -// expect(screen.getByText('Test Title')).toBeTruthy(); -// expect(screen.queryByText('Click Me')).toBeNull(); -// }); -// it('should handle content with empty buttons array', () => { -// const emptyButtonsContent = { -// ...baseContent, -// buttons: [] -// }; -// render( -// -// -// -// ); -// expect(screen.getByText('Test Title')).toBeTruthy(); -// expect(screen.queryByText('Click Me')).toBeNull(); -// }); -// it('should render multiple buttons', () => { -// const multiButtonContent = { -// ...baseContent, -// buttons: [ -// { -// id: 'button1', -// interactId: 'interact1', -// actionUrl: 'https://example.com', -// text: { content: 'Button 1' } -// }, -// { -// id: 'button2', -// interactId: 'interact2', -// actionUrl: 'https://example2.com', -// text: { content: 'Button 2' } -// } -// ] -// }; -// render( -// -// -// -// ); -// expect(screen.getByText('Button 1')).toBeTruthy(); -// expect(screen.getByText('Button 2')).toBeTruthy(); -// }); -// }); -// describe('Interaction handling', () => { -// it('should call onPress when the card is pressed', () => { -// const { getByTestId } = render( -// -// -// -// ); -// const card = getByTestId('small-image-card'); -// fireEvent.press(card); -// expect(mockOnPress).toHaveBeenCalledTimes(1); -// }); -// it('should call onDismiss when dismiss button is pressed', () => { -// render( -// -// -// -// ); -// const dismissButton = screen.getByText('x'); -// fireEvent.press(dismissButton); -// expect(mockOnDismiss).toHaveBeenCalledTimes(1); -// }); -// it('should call onPress when a button is pressed', () => { -// render( -// -// -// -// ); -// const button = screen.getByText('Click Me'); -// fireEvent.press(button); -// expect(mockOnPress).toHaveBeenCalledTimes(1); -// }); -// it('should handle missing onPress callback gracefully', () => { -// expect(() => { -// render( -// -// -// -// ); -// }).not.toThrow(); -// }); -// it('should handle missing onDismiss callback gracefully', () => { -// expect(() => { -// render( -// -// -// -// ); -// }).not.toThrow(); -// }); -// }); -// describe('Style overrides', () => { -// it('should apply custom card styles', () => { -// const customStyles = { -// card: { backgroundColor: 'red', margin: 20 } -// }; -// const { getByTestId } = render( -// -// -// -// ); -// const card = getByTestId('small-image-card'); -// expect(card.props.style).toEqual( -// expect.arrayContaining([ -// expect.objectContaining({ -// backgroundColor: 'red', -// margin: 20 -// }) -// ]) -// ); -// }); -// it('should apply custom container styles', () => { -// const customStyles = { -// container: { padding: 20 } -// }; -// render( -// -// -// -// ); -// // Container styles are applied but harder to test directly -// // This ensures no errors are thrown when applying custom styles -// expect(screen.getByText('Test Title')).toBeTruthy(); -// }); -// it('should apply custom text styles', () => { -// const customStyles = { -// text: { fontSize: 20 }, -// title: { fontWeight: 'bold' as const }, -// body: { fontStyle: 'italic' as const } -// }; -// render( -// -// -// -// ); -// const title = screen.getByText('Test Title'); -// const body = screen.getByText('Test body content'); -// expect(title.props.style).toEqual( -// expect.arrayContaining([ -// expect.objectContaining({ -// fontSize: 20, -// fontWeight: 'bold' -// }) -// ]) -// ); -// expect(body.props.style).toEqual( -// expect.arrayContaining([ -// expect.objectContaining({ -// fontSize: 20, -// fontStyle: 'italic' -// }) -// ]) -// ); -// }); -// it('should apply custom image styles', () => { -// const customStyles = { -// imageContainer: { borderRadius: 20 }, -// image: { opacity: 0.8 } -// }; -// render( -// -// -// -// ); -// // Image styles are applied but harder to test directly -// // This ensures no errors are thrown when applying custom styles -// expect(screen.getByText('Test Title')).toBeTruthy(); -// }); -// it('should handle function-based style prop', () => { -// const styleFn = jest.fn().mockReturnValue({ opacity: 0.9 }); -// const { getByTestId } = render( -// -// -// -// ); -// expect(styleFn).toHaveBeenCalled(); -// const card = getByTestId('small-image-card'); -// expect(card.props.style).toEqual( -// expect.arrayContaining([ -// expect.objectContaining({ -// opacity: 0.9 -// }) -// ]) -// ); -// }); -// }); -// describe('Theme integration', () => { -// it('should apply light theme colors', () => { -// mockUseColorScheme.mockReturnValue('light'); -// render( -// -// -// -// ); -// const title = screen.getByText('Test Title'); -// const body = screen.getByText('Test body content'); -// expect(title.props.style).toEqual( -// expect.arrayContaining([ -// expect.objectContaining({ -// color: '#000000' // Default light theme primary text color -// }) -// ]) -// ); -// expect(body.props.style).toEqual( -// expect.arrayContaining([ -// expect.objectContaining({ -// color: '#000000' // Default light theme primary text color -// }) -// ]) -// ); -// }); -// it('should apply dark theme colors', () => { -// mockUseColorScheme.mockReturnValue('dark'); -// render( -// -// -// -// ); -// const title = screen.getByText('Test Title'); -// const body = screen.getByText('Test body content'); -// expect(title.props.style).toEqual( -// expect.arrayContaining([ -// expect.objectContaining({ -// color: '#FFFFFF' // Default dark theme primary text color -// }) -// ]) -// ); -// expect(body.props.style).toEqual( -// expect.arrayContaining([ -// expect.objectContaining({ -// color: '#FFFFFF' // Default dark theme primary text color -// }) -// ]) -// ); -// }); -// it('should work with custom theme colors', () => { -// const customThemes = { -// light: { -// colors: { -// primary: '#007AFF', -// secondary: '#5856D6', -// background: '#FFFFFF', -// textPrimary: '#FF0000', // Custom red text -// textSecondary: '#8E8E93', -// imagePlaceholder: '#C7C7CC', -// buttonTextColor: 'dodgerblue' -// } -// }, -// dark: { -// colors: { -// primary: '#0A84FF', -// secondary: '#5E5CE6', -// background: '#262626', -// textPrimary: '#00FF00', // Custom green text -// textSecondary: '#8E8E93', -// imagePlaceholder: '#48484A', -// buttonTextColor: 'dodgerblue' -// } -// } -// }; -// const CustomThemeWrapper: React.FC<{ children: React.ReactNode }> = ({ children }) => ( -// {children} -// ); -// mockUseColorScheme.mockReturnValue('light'); -// render( -// -// -// -// ); -// const title = screen.getByText('Test Title'); -// expect(title.props.style).toEqual( -// expect.arrayContaining([ -// expect.objectContaining({ -// color: '#FF0000' // Custom red text color -// }) -// ]) -// ); -// }); -// }); -// describe('Accessibility', () => { -// it('should accept custom accessibility props', () => { -// const { getByTestId } = render( -// -// -// -// ); -// const card = getByTestId('small-image-card'); -// expect(card.props.accessibilityLabel).toBe('Content card'); -// expect(card.props.accessibilityHint).toBe('Double tap to open'); -// }); -// it('should support disabled state', () => { -// const { getByTestId } = render( -// -// -// -// ); -// const card = getByTestId('small-image-card'); -// expect(card.props.disabled).toBe(true); -// }); -// }); -// describe('Props forwarding', () => { -// it('should forward additional Pressable props', () => { -// const { getByTestId } = render( -// -// -// -// ); -// const card = getByTestId('small-image-card'); -// expect(card.props.hitSlop).toBe(10); -// expect(card.props.delayLongPress).toBe(500); -// }); -// }); -// describe('Edge cases', () => { -// it('should handle undefined content gracefully', () => { -// expect(() => { -// render( -// -// -// -// ); -// }).not.toThrow(); -// }); -// it('should handle empty content object', () => { -// expect(() => { -// render( -// -// -// -// ); -// }).not.toThrow(); -// }); -// it('should handle content with empty strings', () => { -// const emptyStringContent = { -// title: { content: '' }, -// body: { content: '' } -// }; -// render( -// -// -// -// ); -// // Empty strings should not render the text components -// expect(screen.queryByText('')).toBeNull(); -// }); -// it('should handle image loading errors gracefully', () => { -// mockImageGetSize.mockImplementation((uri, success, error) => { -// error(new Error('Image load failed')); -// }); -// expect(() => { -// render( -// -// -// -// ); -// }).not.toThrow(); -// }); -// it('should handle undefined color scheme gracefully', () => { -// mockUseColorScheme.mockReturnValue(undefined as any); -// expect(() => { -// render( -// -// -// -// ); -// }).not.toThrow(); -// }); -// }); -// describe('Height prop', () => { -// it('should accept height prop', () => { -// expect(() => { -// render( -// -// -// -// ); -// }).not.toThrow(); -// }); -// }); -// }); -//# sourceMappingURL=SmallImageCard.spec.js.map \ No newline at end of file diff --git a/packages/messaging/dist/ui/components/SmallImageCard/SmallImageCard.spec.js.map b/packages/messaging/dist/ui/components/SmallImageCard/SmallImageCard.spec.js.map deleted file mode 100644 index cf1d7db1..00000000 --- a/packages/messaging/dist/ui/components/SmallImageCard/SmallImageCard.spec.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"SmallImageCard.spec.js","sourceRoot":"","sources":["../../../../src/ui/components/SmallImageCard/SmallImageCard.spec.tsx"],"names":[],"mappings":";AAAA,KAAK;AACL,iDAAiD;AACjD,8EAA8E;AAC9E,mFAAmF;AACnF,8CAA8C;AAC9C,mFAAmF;AACnF,yEAAyE;AACzE,gFAAgF;AAChF,4EAA4E;AAC5E,wEAAwE;AACxE,KAAK;;AAEL,6BAA6B;AAC7B,6EAA6E;AAC7E,wDAAwD;AACxD,iDAAiD;AACjD,uEAAuE;AACvE,6DAA6D;AAE7D,uBAAuB;AACvB,oCAAoC;AACpC,mDAAmD;AACnD,aAAa;AACb,aAAa;AACb,iCAAiC;AACjC,eAAe;AACf,qBAAqB;AACrB,2BAA2B;AAC3B,QAAQ;AACR,OAAO;AACP,MAAM;AAEN,kDAAkD;AAClD,+BAA+B;AAC/B,MAAM;AAEN,2FAA2F;AAC3F,uFAAuF;AAEvF,gDAAgD;AAChD,mFAAmF;AACnF,gEAAgE;AAChE,KAAK;AAEL,qCAAqC;AACrC,mCAAmC;AACnC,qCAAqC;AAErC,iDAAiD;AACjD,eAAe;AACf,8BAA8B;AAC9B,SAAS;AACT,cAAc;AACd,qCAAqC;AACrC,SAAS;AACT,iBAAiB;AACjB,UAAU;AACV,yBAAyB;AACzB,mCAAmC;AACnC,4CAA4C;AAC5C,kBAAkB;AAClB,gCAAgC;AAChC,YAAY;AACZ,UAAU;AACV,SAAS;AACT,oBAAoB;AACpB,wBAAwB;AACxB,QAAQ;AACR,OAAO;AAEP,uBAAuB;AACvB,4BAA4B;AAC5B,mDAAmD;AACnD,8DAA8D;AAC9D,2BAA2B;A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oCAAoC;AACpC,8CAA8C;AAC9C,uBAAuB;AACvB,kBAAkB;AAClB,0BAA0B;AAC1B,8BAA8B;AAC9B,sCAAsC;AACtC,6BAA6B;AAC7B,sCAAsC;AACtC,0CAA0C;AAC1C,iBAAiB;AACjB,2BAA2B;AAC3B,aAAa;AACb,0BAA0B;AAC1B,UAAU;AACV,QAAQ;AACR,MAAM"} \ No newline at end of file diff --git a/packages/messaging/dist/ui/components/index.d.ts b/packages/messaging/dist/ui/components/index.d.ts deleted file mode 100644 index 984ede58..00000000 --- a/packages/messaging/dist/ui/components/index.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export * from './Button/Button'; -export * from './ContentCardView/ContentCardView'; -export * from '../types/ContentViewEvent'; -export { ThemeProvider } from '../theme/ThemeProvider'; -export type { Themes } from '../theme/Theme'; diff --git a/packages/messaging/dist/ui/components/index.js b/packages/messaging/dist/ui/components/index.js deleted file mode 100644 index cba0942c..00000000 --- a/packages/messaging/dist/ui/components/index.js +++ /dev/null @@ -1,21 +0,0 @@ -"use strict"; -/* - Copyright 2025 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law - or agreed to in writing, software distributed under the License is - distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF - ANY KIND, either express or implied. See the License for the specific - language governing permissions and limitations under the License. -*/ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ThemeProvider = void 0; -const tslib_1 = require("tslib"); -tslib_1.__exportStar(require("./Button/Button"), exports); -tslib_1.__exportStar(require("./ContentCardView/ContentCardView"), exports); -tslib_1.__exportStar(require("../types/ContentViewEvent"), exports); -var ThemeProvider_1 = require("../theme/ThemeProvider"); -Object.defineProperty(exports, "ThemeProvider", { enumerable: true, get: function () { return ThemeProvider_1.ThemeProvider; } }); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/messaging/dist/ui/components/index.js.map b/packages/messaging/dist/ui/components/index.js.map deleted file mode 100644 index 4806fc57..00000000 --- a/packages/messaging/dist/ui/components/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/components/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;EAUE;;;;AAEF,0DAAgC;AAChC,4EAAkD;AAClD,oEAA0C;AAC1C,wDAAuD;AAA9C,8GAAA,aAAa,OAAA"} \ No newline at end of file diff --git a/packages/messaging/dist/ui/hooks/index.d.ts b/packages/messaging/dist/ui/hooks/index.d.ts deleted file mode 100644 index 68761ab2..00000000 --- a/packages/messaging/dist/ui/hooks/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './useContentCardUI'; diff --git a/packages/messaging/dist/ui/hooks/index.js b/packages/messaging/dist/ui/hooks/index.js deleted file mode 100644 index aab45b56..00000000 --- a/packages/messaging/dist/ui/hooks/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -tslib_1.__exportStar(require("./useContentCardUI"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/messaging/dist/ui/hooks/index.js.map b/packages/messaging/dist/ui/hooks/index.js.map deleted file mode 100644 index 45b3b96a..00000000 --- a/packages/messaging/dist/ui/hooks/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/hooks/index.ts"],"names":[],"mappings":";;;AAAA,6DAAmC"} \ No newline at end of file diff --git a/packages/messaging/dist/ui/hooks/useAspectRatio.d.ts b/packages/messaging/dist/ui/hooks/useAspectRatio.d.ts deleted file mode 100644 index 04661f27..00000000 --- a/packages/messaging/dist/ui/hooks/useAspectRatio.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare function useAspectRatio(uri?: string): number; -export default useAspectRatio; diff --git a/packages/messaging/dist/ui/hooks/useAspectRatio.js b/packages/messaging/dist/ui/hooks/useAspectRatio.js deleted file mode 100644 index 54ceec8d..00000000 --- a/packages/messaging/dist/ui/hooks/useAspectRatio.js +++ /dev/null @@ -1,21 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const react_1 = require("react"); -const react_native_1 = require("react-native"); -function useAspectRatio(uri) { - const [imageAspectRatio, setImageAspectRatio] = (0, react_1.useState)(1); - (0, react_1.useEffect)(() => { - if (!uri) { - return; - } - react_native_1.Image.getSize(uri, (width, height) => { - setImageAspectRatio(width / height); - }, (error) => { - console.log('Error getting image size:', error); - setImageAspectRatio(1); - }); - }, [uri]); - return imageAspectRatio; -} -exports.default = useAspectRatio; -//# sourceMappingURL=useAspectRatio.js.map \ No newline at end of file diff --git a/packages/messaging/dist/ui/hooks/useAspectRatio.js.map b/packages/messaging/dist/ui/hooks/useAspectRatio.js.map deleted file mode 100644 index 2c478e51..00000000 --- a/packages/messaging/dist/ui/hooks/useAspectRatio.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"useAspectRatio.js","sourceRoot":"","sources":["../../../src/ui/hooks/useAspectRatio.tsx"],"names":[],"mappings":";;AAAA,iCAA4C;AAC5C,+CAAqC;AAErC,SAAS,cAAc,CAAC,GAAY;IAClC,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,IAAA,gBAAQ,EAAS,CAAC,CAAC,CAAC;IAEpE,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,CAAC,GAAG,EAAE;YACR,OAAO;SACR;QAED,oBAAK,CAAC,OAAO,CACX,GAAG,EACH,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;YAChB,mBAAmB,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC;QACtC,CAAC,EACD,CAAC,KAAK,EAAE,EAAE;YACR,OAAO,CAAC,GAAG,CAAC,2BAA2B,EAAE,KAAK,CAAC,CAAC;YAChD,mBAAmB,CAAC,CAAC,CAAC,CAAC;QACzB,CAAC,CACF,CAAC;IACJ,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAEV,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED,kBAAe,cAAc,CAAC"} \ No newline at end of file diff --git a/packages/messaging/dist/ui/hooks/useContentCardUI.d.ts b/packages/messaging/dist/ui/hooks/useContentCardUI.d.ts deleted file mode 100644 index 01ff2f3a..00000000 --- a/packages/messaging/dist/ui/hooks/useContentCardUI.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { ContentTemplate } from '../types/Templates'; -/** - * Hook to fetch the content card UI for a given surface. - * @param surface - The surface to fetch the content card UI for. - * @returns An object containing the content card UI, error, loading state, and a refetch function. - */ -export declare const useContentCardUI: (surface: string) => { - content: ContentTemplate[]; - error: any; - isLoading: boolean; - refetch: () => Promise; -}; diff --git a/packages/messaging/dist/ui/hooks/useContentCardUI.js b/packages/messaging/dist/ui/hooks/useContentCardUI.js deleted file mode 100644 index 38f15110..00000000 --- a/packages/messaging/dist/ui/hooks/useContentCardUI.js +++ /dev/null @@ -1,39 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.useContentCardUI = void 0; -const tslib_1 = require("tslib"); -const react_1 = require("react"); -const Messaging_1 = tslib_1.__importDefault(require("../../Messaging")); -/** - * Hook to fetch the content card UI for a given surface. - * @param surface - The surface to fetch the content card UI for. - * @returns An object containing the content card UI, error, loading state, and a refetch function. - */ -const useContentCardUI = (surface) => { - const [content, setContent] = (0, react_1.useState)([]); - const [error, setError] = (0, react_1.useState)(null); - const [isLoading, setIsLoading] = (0, react_1.useState)(false); - const fetchContent = (0, react_1.useCallback)(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () { - try { - setIsLoading(true); - yield Messaging_1.default.updatePropositionsForSurfaces([surface]); - const content = yield Messaging_1.default.getContentCardUI(surface); - setContent(content); - setIsLoading(false); - } - catch (error) { - console.error(error); - setContent([]); - setError(error); - } - finally { - setIsLoading(false); - } - }), [surface]); - (0, react_1.useEffect)(() => { - fetchContent(); - }, [surface, fetchContent]); - return { content, error, isLoading, refetch: fetchContent }; -}; -exports.useContentCardUI = useContentCardUI; -//# sourceMappingURL=useContentCardUI.js.map \ No newline at end of file diff --git a/packages/messaging/dist/ui/hooks/useContentCardUI.js.map b/packages/messaging/dist/ui/hooks/useContentCardUI.js.map deleted file mode 100644 index b52ed7ad..00000000 --- a/packages/messaging/dist/ui/hooks/useContentCardUI.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"useContentCardUI.js","sourceRoot":"","sources":["../../../src/ui/hooks/useContentCardUI.ts"],"names":[],"mappings":";;;;AAAA,iCAAyD;AACzD,wEAAwC;AAGxC;;;;GAIG;AACI,MAAM,gBAAgB,GAAG,CAAC,OAAe,EAAE,EAAE;IAClD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,IAAA,gBAAQ,EAAoB,EAAE,CAAC,CAAC;IAC9D,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAAM,IAAI,CAAC,CAAC;IAC9C,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAElD,MAAM,YAAY,GAAG,IAAA,mBAAW,EAAC,GAAS,EAAE;QAC1C,IAAI;YACF,YAAY,CAAC,IAAI,CAAC,CAAC;YACnB,MAAM,mBAAS,CAAC,6BAA6B,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;YACzD,MAAM,OAAO,GAAG,MAAM,mBAAS,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;YAC1D,UAAU,CAAC,OAAO,CAAC,CAAC;YACpB,YAAY,CAAC,KAAK,CAAC,CAAC;SACrB;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACrB,UAAU,CAAC,EAAE,CAAC,CAAC;YACf,QAAQ,CAAC,KAAK,CAAC,CAAC;SACjB;gBAAS;YACR,YAAY,CAAC,KAAK,CAAC,CAAC;SACrB;IACH,CAAC,CAAA,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,YAAY,EAAE,CAAC;IACjB,CAAC,EAAE,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC;IAE5B,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC;AAC9D,CAAC,CAAC;AA1BW,QAAA,gBAAgB,oBA0B3B"} \ No newline at end of file diff --git a/packages/messaging/dist/ui/index.d.ts b/packages/messaging/dist/ui/index.d.ts deleted file mode 100644 index e246a6c0..00000000 --- a/packages/messaging/dist/ui/index.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './components'; -export * from './hooks'; -export * from './theme'; -export * from './types'; diff --git a/packages/messaging/dist/ui/index.js b/packages/messaging/dist/ui/index.js deleted file mode 100644 index 68646891..00000000 --- a/packages/messaging/dist/ui/index.js +++ /dev/null @@ -1,8 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -tslib_1.__exportStar(require("./components"), exports); -tslib_1.__exportStar(require("./hooks"), exports); -tslib_1.__exportStar(require("./theme"), exports); -tslib_1.__exportStar(require("./types"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/messaging/dist/ui/index.js.map b/packages/messaging/dist/ui/index.js.map deleted file mode 100644 index 77f7563a..00000000 --- a/packages/messaging/dist/ui/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":";;;AAAA,uDAA6B;AAC7B,kDAAwB;AACxB,kDAAwB;AACxB,kDAAwB"} \ No newline at end of file diff --git a/packages/messaging/dist/ui/theme/Theme.d.ts b/packages/messaging/dist/ui/theme/Theme.d.ts deleted file mode 100644 index e2c1d685..00000000 --- a/packages/messaging/dist/ui/theme/Theme.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Represents the themes for the messaging UI. - * @interface Themes - * @property {Theme} light - The light theme. - * @property {Theme} dark - The dark theme. - */ -export interface Themes { - light: Theme; - dark: Theme; -} -/** - * Represents the theme for the messaging UI. - * @interface Theme - * @property {Colors} colors - The colors for the theme. - */ -export interface Theme { - colors: Colors; -} -/** - * Represents the colors for the theme. - * @interface Colors - * @property {string} primary - The primary color. - * @property {string} secondary - The secondary color. - * @property {string} background - The background color. - * @property {string} textPrimary - The primary text color. - * @property {string} textSecondary - The secondary text color. - * @property {string} imagePlaceholder - The image placeholder color. - * @property {string} buttonTextColor - The button text color. - */ -export interface Colors { - primary?: string; - secondary?: string; - background?: string; - textPrimary?: string; - textSecondary?: string; - imagePlaceholder?: string; - buttonTextColor?: string; -} diff --git a/packages/messaging/dist/ui/theme/Theme.js b/packages/messaging/dist/ui/theme/Theme.js deleted file mode 100644 index 19469521..00000000 --- a/packages/messaging/dist/ui/theme/Theme.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; -/* - Copyright 2025 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law - or agreed to in writing, software distributed under the License is - distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF - ANY KIND, either express or implied. See the License for the specific - language governing permissions and limitations under the License. -*/ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=Theme.js.map \ No newline at end of file diff --git a/packages/messaging/dist/ui/theme/Theme.js.map b/packages/messaging/dist/ui/theme/Theme.js.map deleted file mode 100644 index 80d36446..00000000 --- a/packages/messaging/dist/ui/theme/Theme.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Theme.js","sourceRoot":"","sources":["../../../src/ui/theme/Theme.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;EAUE"} \ No newline at end of file diff --git a/packages/messaging/dist/ui/theme/ThemeProvider.d.ts b/packages/messaging/dist/ui/theme/ThemeProvider.d.ts deleted file mode 100644 index 79762086..00000000 --- a/packages/messaging/dist/ui/theme/ThemeProvider.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import React, { ReactNode } from 'react'; -import { Theme, Themes } from './Theme'; -interface ThemeProviderProps { - children: ReactNode; - customThemes: Themes; -} -/** - * ThemeProvider component that provides the theme to the children components. - * - * @param children - The children components. - * @param customThemes - The custom themes to override the default themes. - * @returns The ThemeProvider component. - */ -export declare const ThemeProvider: ({ children, customThemes }: ThemeProviderProps) => React.JSX.Element; -/** - * useTheme hook that returns the theme context. - * @returns The theme context. - */ -export declare const useTheme: () => Theme; -export {}; diff --git a/packages/messaging/dist/ui/theme/ThemeProvider.js b/packages/messaging/dist/ui/theme/ThemeProvider.js deleted file mode 100644 index 541daf96..00000000 --- a/packages/messaging/dist/ui/theme/ThemeProvider.js +++ /dev/null @@ -1,87 +0,0 @@ -"use strict"; -/* - Copyright 2025 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law - or agreed to in writing, software distributed under the License is - distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF - ANY KIND, either express or implied. See the License for the specific - language governing permissions and limitations under the License. -*/ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.useTheme = exports.ThemeProvider = void 0; -const tslib_1 = require("tslib"); -const react_1 = tslib_1.__importStar(require("react")); -const react_native_1 = require("react-native"); -const defaultTheme = { - light: { - colors: { - primary: '#007AFF', - secondary: '#5856D6', - background: '#FFFFFF', - textPrimary: '#000000', - textSecondary: '#8E8E93', - imagePlaceholder: '#C7C7CC', - buttonTextColor: 'dodgerblue' - } - }, - dark: { - colors: { - primary: '#0A84FF', - secondary: '#5E5CE6', - background: '#262626', - textPrimary: '#FFFFFF', - textSecondary: '#8E8E93', - imagePlaceholder: '#48484A', - buttonTextColor: 'dodgerblue' - } - } -}; -const ThemeContext = (0, react_1.createContext)(undefined); -/** - * ThemeProvider component that provides the theme to the children components. - * - * @param children - The children components. - * @param customThemes - The custom themes to override the default themes. - * @returns The ThemeProvider component. - */ -const ThemeProvider = ({ children, customThemes }) => { - const systemColorScheme = (0, react_native_1.useColorScheme)(); - // Memoize the merged themes to avoid recreation on every render - const mergedThemes = (0, react_1.useMemo)(() => { - var _a, _b; - return ({ - light: { - colors: Object.assign(Object.assign({}, defaultTheme.light.colors), (((_a = customThemes === null || customThemes === void 0 ? void 0 : customThemes.light) === null || _a === void 0 ? void 0 : _a.colors) || {})) - }, - dark: { - colors: Object.assign(Object.assign({}, defaultTheme.dark.colors), (((_b = customThemes === null || customThemes === void 0 ? void 0 : customThemes.dark) === null || _b === void 0 ? void 0 : _b.colors) || {})) - } - }); - }, [customThemes]); - // Memoize the active theme - const activeTheme = (0, react_1.useMemo)(() => mergedThemes[systemColorScheme !== null && systemColorScheme !== void 0 ? systemColorScheme : 'light'], [mergedThemes, systemColorScheme]); - // Memoize the context value to prevent unnecessary re-renders - const contextValue = (0, react_1.useMemo)(() => activeTheme, [activeTheme]); - return ( - {children} - ); -}; -exports.ThemeProvider = ThemeProvider; -/** - * useTheme hook that returns the theme context. - * @returns The theme context. - */ -const useTheme = () => { - const context = (0, react_1.useContext)(ThemeContext); - const systemColorScheme = (0, react_native_1.useColorScheme)(); - if (context === undefined) { - return defaultTheme[systemColorScheme !== null && systemColorScheme !== void 0 ? systemColorScheme : 'light']; - } - return context; -}; -exports.useTheme = useTheme; -//# sourceMappingURL=ThemeProvider.js.map \ No newline at end of file diff --git a/packages/messaging/dist/ui/theme/ThemeProvider.js.map b/packages/messaging/dist/ui/theme/ThemeProvider.js.map deleted file mode 100644 index 6a46b2d6..00000000 --- a/packages/messaging/dist/ui/theme/ThemeProvider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ThemeProvider.js","sourceRoot":"","sources":["../../../src/ui/theme/ThemeProvider.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;EAWE;;;;AAEF,uDAA6E;AAC7E,+CAA8C;AAQ9C,MAAM,YAAY,GAAW;IAC3B,KAAK,EAAE;QACL,MAAM,EAAE;YACN,OAAO,EAAE,SAAS;YAClB,SAAS,EAAE,SAAS;YACpB,UAAU,EAAE,SAAS;YACrB,WAAW,EAAE,SAAS;YACtB,aAAa,EAAE,SAAS;YACxB,gBAAgB,EAAE,SAAS;YAC3B,eAAe,EAAE,YAAY;SAC9B;KACF;IACD,IAAI,EAAE;QACJ,MAAM,EAAE;YACN,OAAO,EAAE,SAAS;YAClB,SAAS,EAAE,SAAS;YACpB,UAAU,EAAE,SAAS;YACrB,WAAW,EAAE,SAAS;YACtB,aAAa,EAAE,SAAS;YACxB,gBAAgB,EAAE,SAAS;YAC3B,eAAe,EAAE,YAAY;SAC9B;KACF;CACF,CAAC;AAEF,MAAM,YAAY,GAAG,IAAA,qBAAa,EAAoB,SAAS,CAAC,CAAC;AAEjE;;;;;;GAMG;AACI,MAAM,aAAa,GAAG,CAAC,EAC5B,QAAQ,EACR,YAAY,EACO,EAAE,EAAE;IACvB,MAAM,iBAAiB,GAAG,IAAA,6BAAc,GAAE,CAAC;IAE3C,gEAAgE;IAChE,MAAM,YAAY,GAAW,IAAA,eAAO,EAClC,GAAG,EAAE;;QAAC,OAAA,CAAC;YACL,KAAK,EAAE;gBACL,MAAM,kCACD,YAAY,CAAC,KAAK,CAAC,MAAM,GACzB,CAAC,CAAA,MAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,KAAK,0CAAE,MAAM,KAAI,EAAE,CAAC,CACvC;aACF;YACD,IAAI,EAAE;gBACJ,MAAM,kCACD,YAAY,CAAC,IAAI,CAAC,MAAM,GACxB,CAAC,CAAA,MAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,IAAI,0CAAE,MAAM,KAAI,EAAE,CAAC,CACtC;aACF;SACF,CAAC,CAAA;KAAA,EACF,CAAC,YAAY,CAAC,CACf,CAAC;IAEF,2BAA2B;IAC3B,MAAM,WAAW,GAAG,IAAA,eAAO,EACzB,GAAG,EAAE,CAAC,YAAY,CAAC,iBAAiB,aAAjB,iBAAiB,cAAjB,iBAAiB,GAAI,OAAO,CAAC,EAChD,CAAC,YAAY,EAAE,iBAAiB,CAAC,CAClC,CAAC;IAEF,8DAA8D;IAC9D,MAAM,YAAY,GAAU,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAEtE,OAAO,CACL,CAAC,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CACzC;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,YAAY,CAAC,QAAQ,CAAC,CACzB,CAAC;AACJ,CAAC,CAAC;AAvCW,QAAA,aAAa,iBAuCxB;AAEF;;;GAGG;AACI,MAAM,QAAQ,GAAG,GAAU,EAAE;IAClC,MAAM,OAAO,GAAG,IAAA,kBAAU,EAAC,YAAY,CAAC,CAAC;IACzC,MAAM,iBAAiB,GAAG,IAAA,6BAAc,GAAE,CAAC;IAC3C,IAAI,OAAO,KAAK,SAAS,EAAE;QACzB,OAAO,YAAY,CAAC,iBAAiB,aAAjB,iBAAiB,cAAjB,iBAAiB,GAAI,OAAO,CAAC,CAAC;KACnD;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAPW,QAAA,QAAQ,YAOnB"} \ No newline at end of file diff --git a/packages/messaging/dist/ui/theme/index.d.ts b/packages/messaging/dist/ui/theme/index.d.ts deleted file mode 100644 index e306dfb6..00000000 --- a/packages/messaging/dist/ui/theme/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './Theme'; -export * from './ThemeProvider'; diff --git a/packages/messaging/dist/ui/theme/index.js b/packages/messaging/dist/ui/theme/index.js deleted file mode 100644 index d0aaba6a..00000000 --- a/packages/messaging/dist/ui/theme/index.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -tslib_1.__exportStar(require("./Theme"), exports); -tslib_1.__exportStar(require("./ThemeProvider"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/messaging/dist/ui/theme/index.js.map b/packages/messaging/dist/ui/theme/index.js.map deleted file mode 100644 index db561502..00000000 --- a/packages/messaging/dist/ui/theme/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/theme/index.ts"],"names":[],"mappings":";;;AAAA,kDAAwB;AACxB,0DAAgC"} \ No newline at end of file diff --git a/packages/messaging/dist/ui/types/ContentViewEvent.d.ts b/packages/messaging/dist/ui/types/ContentViewEvent.d.ts deleted file mode 100644 index 987bb9ef..00000000 --- a/packages/messaging/dist/ui/types/ContentViewEvent.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * The event types for the ContentView component. - * - * @property {string} onDismiss - The event type for the onDismiss event when the dismiss button is pressed. - * @property {string} onDisplay - The event type for the onDisplay event when the content card is displayed. - * @property {string} onInteract - The event type for the interact event when the content is pressed. - */ -export type ContentViewEvent = 'onDismiss' | 'onDisplay' | 'onInteract'; diff --git a/packages/messaging/dist/ui/types/ContentViewEvent.js b/packages/messaging/dist/ui/types/ContentViewEvent.js deleted file mode 100644 index 81560eb1..00000000 --- a/packages/messaging/dist/ui/types/ContentViewEvent.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; -/* - Copyright 2025 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law - or agreed to in writing, software distributed under the License is - distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF - ANY KIND, either express or implied. See the License for the specific - language governing permissions and limitations under the License. -*/ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=ContentViewEvent.js.map \ No newline at end of file diff --git a/packages/messaging/dist/ui/types/ContentViewEvent.js.map b/packages/messaging/dist/ui/types/ContentViewEvent.js.map deleted file mode 100644 index b379414b..00000000 --- a/packages/messaging/dist/ui/types/ContentViewEvent.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ContentViewEvent.js","sourceRoot":"","sources":["../../../src/ui/types/ContentViewEvent.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;EAUE"} \ No newline at end of file diff --git a/packages/messaging/dist/ui/types/Templates.d.ts b/packages/messaging/dist/ui/types/Templates.d.ts deleted file mode 100644 index 05a3d8af..00000000 --- a/packages/messaging/dist/ui/types/Templates.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { ButtonProps, ImageProps, ImageStyle, PressableProps, TextProps, TextStyle, ViewStyle } from 'react-native'; -import { ViewProps } from 'react-native'; -import { ContentCard, ContentCardData, ContentCardTemplate } from '../../models/ContentCard'; -import { DismissButtonProps } from '../components/DismissButton/DismissButton'; -export declare class ContentTemplate extends ContentCard { - readonly type: ContentCardTemplate; - constructor(data: ContentCardData, type: ContentCardTemplate); -} -/** Overrides for the structural pieces of the content card */ -export interface ComponentOverrideProps { - BodyProps?: Partial; - ButtonContainerProps?: Partial; - ButtonProps?: Partial>; - ContainerProps?: Partial; - ContentContainerProps?: Partial; - DismissButtonProps?: DismissButtonProps; - ImageContainerProps?: Partial; - ImageProps?: Partial; - TextProps?: Partial; - TitleProps?: Partial; -} -/** The base style overrides available for content cards */ -export interface ContentCardStyles { - /** Applies to the root of the content card */ - card?: ViewStyle; - /** Applies to the container inside the content card, applied inside the card Pressable */ - container?: ViewStyle; - imageContainer?: ViewStyle; - image?: ImageStyle; - contentContainer?: ViewStyle; - /** Applies to title and body properties, will be overridden by title and body styles */ - text?: TextStyle; - title?: TextStyle; - body?: TextStyle; - buttonContainer?: ViewStyle; - button?: PressableProps['style']; - buttonText?: TextStyle; - dismissButton?: PressableProps['style']; -} -export type SmallImageContentStyle = ContentCardStyles; -export type LargeImageContentStyle = ContentCardStyles; -export type ImageOnlyContentStyle = Pick; diff --git a/packages/messaging/dist/ui/types/Templates.js b/packages/messaging/dist/ui/types/Templates.js deleted file mode 100644 index 2c07db77..00000000 --- a/packages/messaging/dist/ui/types/Templates.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ContentTemplate = void 0; -const ContentCard_1 = require("../../models/ContentCard"); -class ContentTemplate extends ContentCard_1.ContentCard { - constructor(data, type) { - super(data); - this.type = type; - } -} -exports.ContentTemplate = ContentTemplate; -//# sourceMappingURL=Templates.js.map \ No newline at end of file diff --git a/packages/messaging/dist/ui/types/Templates.js.map b/packages/messaging/dist/ui/types/Templates.js.map deleted file mode 100644 index feef442d..00000000 --- a/packages/messaging/dist/ui/types/Templates.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Templates.js","sourceRoot":"","sources":["../../../src/ui/types/Templates.ts"],"names":[],"mappings":";;;AAUA,0DAIkC;AAGlC,MAAa,eAAgB,SAAQ,yBAAW;IAG9C,YAAY,IAAqB,EAAE,IAAyB;QAC1D,KAAK,CAAC,IAAI,CAAC,CAAC;QACZ,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAPD,0CAOC"} \ No newline at end of file diff --git a/packages/messaging/dist/ui/types/index.d.ts b/packages/messaging/dist/ui/types/index.d.ts deleted file mode 100644 index f10eddb6..00000000 --- a/packages/messaging/dist/ui/types/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './ContentViewEvent'; -export * from './Templates'; diff --git a/packages/messaging/dist/ui/types/index.js b/packages/messaging/dist/ui/types/index.js deleted file mode 100644 index 2af0517b..00000000 --- a/packages/messaging/dist/ui/types/index.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -tslib_1.__exportStar(require("./ContentViewEvent"), exports); -tslib_1.__exportStar(require("./Templates"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/messaging/dist/ui/types/index.js.map b/packages/messaging/dist/ui/types/index.js.map deleted file mode 100644 index d54676d0..00000000 --- a/packages/messaging/dist/ui/types/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/types/index.ts"],"names":[],"mappings":";;;AAAA,6DAAmC;AACnC,sDAA4B"} \ No newline at end of file diff --git a/packages/messaging/src/ui/components/ContentCardView/ContentCardView.tsx b/packages/messaging/src/ui/components/ContentCardView/ContentCardView.tsx index f1468b95..ece9db70 100644 --- a/packages/messaging/src/ui/components/ContentCardView/ContentCardView.tsx +++ b/packages/messaging/src/ui/components/ContentCardView/ContentCardView.tsx @@ -291,44 +291,9 @@ export const ContentCardView: React.FC = ({ {...DismissButtonProps} /> )} - {containerSettings?.content?.isUnreadEnabled && !isRead && (() => { - const iconConfig = containerSettings.content.unread_indicator?.unread_icon; - const hasImageUrl = iconConfig?.image?.url; - const hasDarkUrl = iconConfig?.image?.darkUrl; - - // Determine icon type based on current color scheme - const relevantUrl = colorScheme === 'dark' ? hasDarkUrl : hasImageUrl; - const iconType = relevantUrl ? "image" : "dot"; - - console.log('ContentCardView UnreadIcon debug:', { - isUnreadEnabled: containerSettings?.content?.isUnreadEnabled, - isRead, - hasImageUrl: !!hasImageUrl, - hasDarkUrl: !!hasDarkUrl, - colorScheme, - relevantUrl: !!relevantUrl, - iconType, - placement: iconConfig?.placement - }); - - return ( - - ); - })()} + {containerSettings?.content?.isUnreadEnabled && !isRead && ( + + )} ); diff --git a/packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.test.tsx b/packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.test.tsx new file mode 100644 index 00000000..60263bae --- /dev/null +++ b/packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.test.tsx @@ -0,0 +1,325 @@ +// /* +// Copyright 2025 Adobe. All rights reserved. +// This file is licensed to you under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. You may obtain a copy +// of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under +// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS +// OF ANY KIND, either express or implied. See the License for the specific language +// governing permissions and limitations under the License. +// */ + +// import React from 'react'; +// import renderer from 'react-test-renderer'; +// import { useColorScheme } from 'react-native'; +// import UnreadIcon from './UnreadIcon'; +// import ContentCardContainerProvider from '../../providers/ContentCardContainerProvider'; + +// // Mock useColorScheme +// jest.mock('react-native/Libraries/Utilities/useColorScheme', () => ({ +// default: jest.fn(), +// })); + +// const mockUseColorScheme = useColorScheme as jest.MockedFunction; + +// describe('UnreadIcon', () => { +// const mockContainerSettings = { +// templateType: 'inbox' as const, +// content: { +// heading: { content: 'Test' }, +// layout: { orientation: 'vertical' as const }, +// capacity: 10, +// emptyStateSettings: { message: { content: 'Empty' } }, +// unread_indicator: { +// unread_bg: { +// clr: { +// light: '#FFF3E0', +// dark: '#2D1B0E', +// }, +// }, +// unread_icon: { +// placement: 'topright' as const, +// image: { +// url: 'https://example.com/icon.png', +// darkUrl: '', +// }, +// }, +// }, +// isUnreadEnabled: true, +// }, +// showPagination: false, +// }; + +// beforeEach(() => { +// jest.clearAllMocks(); +// mockUseColorScheme.mockReturnValue('light'); +// }); + +// describe('Rendering', () => { +// it('should render successfully with container settings', () => { +// const component = renderer.create( +// +// +// +// ); + +// const tree = component.toJSON(); +// expect(tree).toBeTruthy(); +// }); + +// it('should render with custom size', () => { +// const component = renderer.create( +// +// +// +// ); + +// const tree = component.toJSON(); +// expect(tree).toBeTruthy(); +// }); +// }); + +// describe('Placement', () => { +// it('should render with topright placement', () => { +// const component = renderer.create( +// +// +// +// ); + +// const tree = component.toJSON(); +// expect(tree).toBeTruthy(); +// }); + +// it('should render with topleft placement', () => { +// const settings = { +// ...mockContainerSettings, +// content: { +// ...mockContainerSettings.content, +// unread_indicator: { +// ...mockContainerSettings.content.unread_indicator, +// unread_icon: { +// ...mockContainerSettings.content.unread_indicator.unread_icon, +// placement: 'topleft' as const, +// }, +// }, +// }, +// }; + +// const component = renderer.create( +// +// +// +// ); + +// const tree = component.toJSON(); +// expect(tree).toBeTruthy(); +// }); + +// it('should render with bottomright placement', () => { +// const settings = { +// ...mockContainerSettings, +// content: { +// ...mockContainerSettings.content, +// unread_indicator: { +// ...mockContainerSettings.content.unread_indicator, +// unread_icon: { +// ...mockContainerSettings.content.unread_indicator.unread_icon, +// placement: 'bottomright' as const, +// }, +// }, +// }, +// }; + +// const component = renderer.create( +// +// +// +// ); + +// const tree = component.toJSON(); +// expect(tree).toBeTruthy(); +// }); + +// it('should render with bottomleft placement', () => { +// const settings = { +// ...mockContainerSettings, +// content: { +// ...mockContainerSettings.content, +// unread_indicator: { +// ...mockContainerSettings.content.unread_indicator, +// unread_icon: { +// ...mockContainerSettings.content.unread_indicator.unread_icon, +// placement: 'bottomleft' as const, +// }, +// }, +// }, +// }; + +// const component = renderer.create( +// +// +// +// ); + +// const tree = component.toJSON(); +// expect(tree).toBeTruthy(); +// }); +// }); + +// describe('Light Mode', () => { +// beforeEach(() => { +// mockUseColorScheme.mockReturnValue('light'); +// }); + +// it('should render in light mode with image URL', () => { +// const component = renderer.create( +// +// +// +// ); + +// const tree = component.toJSON(); +// expect(tree).toBeTruthy(); +// }); + +// it('should render dot when URL is empty string in light mode', () => { +// const settings = { +// ...mockContainerSettings, +// content: { +// ...mockContainerSettings.content, +// unread_indicator: { +// ...mockContainerSettings.content.unread_indicator, +// unread_icon: { +// ...mockContainerSettings.content.unread_indicator.unread_icon, +// image: { +// url: '', +// darkUrl: '', +// }, +// }, +// }, +// }, +// }; + +// const component = renderer.create( +// +// +// +// ); + +// const tree = component.toJSON(); +// expect(tree).toBeTruthy(); +// }); +// }); + +// describe('Dark Mode', () => { +// beforeEach(() => { +// mockUseColorScheme.mockReturnValue('dark'); +// }); + +// it('should render in dark mode with darkUrl provided', () => { +// const settings = { +// ...mockContainerSettings, +// content: { +// ...mockContainerSettings.content, +// unread_indicator: { +// ...mockContainerSettings.content.unread_indicator, +// unread_icon: { +// ...mockContainerSettings.content.unread_indicator.unread_icon, +// image: { +// url: 'https://example.com/light.png', +// darkUrl: 'https://example.com/dark.png', +// }, +// }, +// }, +// }, +// }; + +// const component = renderer.create( +// +// +// +// ); + +// const tree = component.toJSON(); +// expect(tree).toBeTruthy(); +// }); + +// it('should render dot when darkUrl is empty string in dark mode', () => { +// const component = renderer.create( +// +// +// +// ); + +// const tree = component.toJSON(); +// expect(tree).toBeTruthy(); +// }); + +// it('should fallback to light mode image when no darkUrl provided', () => { +// const settings = { +// ...mockContainerSettings, +// content: { +// ...mockContainerSettings.content, +// unread_indicator: { +// ...mockContainerSettings.content.unread_indicator, +// unread_icon: { +// placement: 'topright' as const, +// image: { +// url: 'https://example.com/icon.png', +// }, +// }, +// }, +// }, +// }; + +// const component = renderer.create( +// +// +// +// ); + +// const tree = component.toJSON(); +// expect(tree).toBeTruthy(); +// }); +// }); + +// describe('Error Handling', () => { +// it('should throw error when used outside ContentCardContainerProvider', () => { +// // Suppress console.error for this test +// const consoleError = jest.spyOn(console, 'error').mockImplementation(() => {}); + +// expect(() => { +// renderer.create(); +// }).toThrow('useContainerSettings must be used within a ContentCardContainerProvider'); + +// consoleError.mockRestore(); +// }); +// }); + +// describe('Snapshot Tests', () => { +// it('should match snapshot for topright placement', () => { +// const component = renderer.create( +// +// +// +// ); + +// const tree = component.toJSON(); +// expect(tree).toMatchSnapshot(); +// }); + +// it('should match snapshot for dot in dark mode', () => { +// mockUseColorScheme.mockReturnValue('dark'); + +// const component = renderer.create( +// +// +// +// ); + +// const tree = component.toJSON(); +// expect(tree).toMatchSnapshot(); +// }); +// }); +// }); \ No newline at end of file diff --git a/packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.tsx b/packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.tsx index c58b19af..f675aea3 100644 --- a/packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.tsx +++ b/packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.tsx @@ -9,6 +9,7 @@ ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ +import React, { useState } from 'react'; import { Image, ImageProps, @@ -19,6 +20,7 @@ import { ViewStyle, useColorScheme } from 'react-native'; +import useContainerSettings from '../../hooks/useContainerSettings'; export interface UnreadIconProps extends ViewProps { imageStyle?: ImageStyle; @@ -30,6 +32,22 @@ export interface UnreadIconProps extends ViewProps { type?: 'dot' | 'image'; } +// Helper function to convert placement from settings to component position +const convertPlacement = (placement: 'topleft' | 'topright' | 'bottomleft' | 'bottomright'): 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' => { + switch (placement) { + case 'topleft': + return 'top-left'; + case 'topright': + return 'top-right'; + case 'bottomleft': + return 'bottom-left'; + case 'bottomright': + return 'bottom-right'; + default: + return 'top-right'; + } +}; + const UnreadIcon = ({ imageStyle, containerStyle, @@ -42,24 +60,28 @@ const UnreadIcon = ({ ...props }: UnreadIconProps) => { const colorScheme = useColorScheme(); + const settings = useContainerSettings(); + + // Get unread indicator settings from context + const unreadSettings = settings.content.unread_indicator; + + // Use settings from context with fallbacks to props + const displaySize = size; + const displayPosition = unreadSettings?.unread_icon?.placement ? + convertPlacement(unreadSettings.unread_icon.placement) : position; + const renderType = unreadSettings?.unread_icon?.image ? 'image' : type; + const imageSource = unreadSettings?.unread_icon?.image?.url ? + { uri: unreadSettings.unread_icon.image.url } : source; + const darkImageSource = unreadSettings?.unread_icon?.image?.darkUrl ? + { uri: unreadSettings.unread_icon.image.darkUrl } : darkSource; - // Debug logging - console.log('UnreadIcon rendering:', { - type, - position, - size, - colorScheme, - hasSource: !!source, - hasDarkSource: !!darkSource - }); - const getPositionStyle = () => { const baseStyle = { position: 'absolute' as const, zIndex: 1000, }; - switch (position) { + switch (displayPosition) { case 'top-left': return { ...baseStyle, top: 6, left: 6 }; case 'top-right': @@ -74,21 +96,66 @@ const UnreadIcon = ({ }; const getDotColor = () => { + // Use default contrasting colors for visibility + // Note: unread_bg.clr is for the card background, not the dot return colorScheme === 'dark' ? '#FF6B6B' : '#FF4444'; }; const renderContent = () => { - if (type === 'image' && (source || darkSource)) { - const imageSource = colorScheme === 'dark' && darkSource ? darkSource : source; + // Check if we should show dot instead of image based on URL availability + const shouldShowDot = + (colorScheme === 'dark' && unreadSettings?.unread_icon?.image?.darkUrl === '') || + (colorScheme === 'light' && unreadSettings?.unread_icon?.image?.url === ''); + + // If URL is explicitly empty string for current mode, show dot + if (shouldShowDot && unreadSettings?.unread_icon?.image) { + return ( + + ); + } + + // If image failed to load, fallback to dot + if (renderType === 'image' && imageLoadError) { + return ( + + ); + } + + if (renderType === 'image' && (imageSource || darkImageSource)) { + const finalImageSource = colorScheme === 'dark' && darkImageSource ? darkImageSource : imageSource; return ( { + console.warn('Failed to load unread icon image:', error.nativeEvent.error); + setImageLoadError(true); + }} /> ); } @@ -99,9 +166,9 @@ const UnreadIcon = ({ style={[ styles.dot, { - width: size, - height: size, - borderRadius: size / 2, + width: displaySize, + height: displaySize, + borderRadius: displaySize / 2, backgroundColor: getDotColor() } ]} @@ -114,7 +181,7 @@ const UnreadIcon = ({ style={[ styles.container, getPositionStyle(), - { minWidth: size, minHeight: size }, + { minWidth: displaySize, minHeight: displaySize }, containerStyle, typeof style === 'object' ? style : undefined ]} diff --git a/yarn.lock b/yarn.lock index 112e6ab6..42687fa2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5671,6 +5671,24 @@ __metadata: languageName: node linkType: hard +"@types/react-test-renderer@npm:^19": + version: 19.1.0 + resolution: "@types/react-test-renderer@npm:19.1.0" + dependencies: + "@types/react": "npm:*" + checksum: 10c0/799654e430df10aeaf267d71507fb64ec151359ead7e3774111bfd4abce7e0911dba461811195c06c22a6d17496ea92537d3185320ff4112fe29954cad1b9152 + languageName: node + linkType: hard + +"@types/react@npm:*": + version: 19.2.0 + resolution: "@types/react@npm:19.2.0" + dependencies: + csstype: "npm:^3.0.2" + checksum: 10c0/a280e146df2abd3b06eaa2f5332dade9f7ebe916334a40699ee11139c5f22aeb49b5b78b6de8c55b53ef2fa94285e1bc2feaf4fbce6fe259a7de92dc1bf67b17 + languageName: node + linkType: hard + "@types/react@npm:^18, @types/react@npm:^18.0.5, @types/react@npm:^18.2.6, @types/react@npm:~18.3.12": version: 18.3.24 resolution: "@types/react@npm:18.3.24" @@ -6141,6 +6159,7 @@ __metadata: "@types/jest": "npm:^27.5.2" "@types/node": "npm:^22.9.0" "@types/react": "npm:^18.0.5" + "@types/react-test-renderer": "npm:^19" babel-jest: "npm:^29.7.0" babel-plugin-module-resolver: "npm:^4.1.0" babel-preset-react-native: "npm:5.0.2" @@ -6148,6 +6167,7 @@ __metadata: jest-environment-jsdom: "npm:^29.7.0" lerna: "npm:^8.2.2" metro-react-native-babel-preset: "npm:^0.70.1" + react-test-renderer: "npm:19.1.1" ts-jest: "npm:^29.1.1" tslib: "npm:^2.3.1" typescript: "npm:^4.5.5" @@ -15592,6 +15612,13 @@ __metadata: languageName: node linkType: hard +"react-is@npm:^19.1.1": + version: 19.2.0 + resolution: "react-is@npm:19.2.0" + checksum: 10c0/a63cb346aeced8ac0e671b0f9b33720d2906de02a066ca067075d871a5d4c64cdb328f495baf9b5842d5868c0d5edd1ce18465a7358b52f4b6aa983479c9bfa2 + languageName: node + linkType: hard + "react-native-builder-bob@npm:0.33.1": version: 0.33.1 resolution: "react-native-builder-bob@npm:0.33.1" @@ -16058,6 +16085,18 @@ __metadata: languageName: node linkType: hard +"react-test-renderer@npm:19.1.1": + version: 19.1.1 + resolution: "react-test-renderer@npm:19.1.1" + dependencies: + react-is: "npm:^19.1.1" + scheduler: "npm:^0.26.0" + peerDependencies: + react: ^19.1.1 + checksum: 10c0/430636d63cff6b79a15fe876d16601891fcdf1c58236471063f4cfe50de2c9fae935c6894eebe6ca5be0bf7245cb572c14ff69e1aada7761b41c73c842e2879c + languageName: node + linkType: hard + "react@npm:18.2.0": version: 18.2.0 resolution: "react@npm:18.2.0" @@ -16696,7 +16735,7 @@ __metadata: languageName: node linkType: hard -"scheduler@npm:0.26.0": +"scheduler@npm:0.26.0, scheduler@npm:^0.26.0": version: 0.26.0 resolution: "scheduler@npm:0.26.0" checksum: 10c0/5b8d5bfddaae3513410eda54f2268e98a376a429931921a81b5c3a2873aab7ca4d775a8caac5498f8cbc7d0daeab947cf923dbd8e215d61671f9f4e392d34356 From 40d88fde8582f8d653fe261d602e403e1c6f0f82 Mon Sep 17 00:00:00 2001 From: Calise Cheung Date: Fri, 3 Oct 2025 07:34:10 -0700 Subject: [PATCH 04/15] update unreadIcon for error handling update unreadIcon for error handling --- packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.tsx b/packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.tsx index f675aea3..0e8529fa 100644 --- a/packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.tsx +++ b/packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.tsx @@ -61,6 +61,7 @@ const UnreadIcon = ({ }: UnreadIconProps) => { const colorScheme = useColorScheme(); const settings = useContainerSettings(); + const [imageLoadError, setImageLoadError] = useState(false); // Get unread indicator settings from context const unreadSettings = settings.content.unread_indicator; From 870204f8afd1c4036672fb1b9229e9b81d3a575f Mon Sep 17 00:00:00 2001 From: Calise Cheung Date: Sat, 4 Oct 2025 15:40:50 -0700 Subject: [PATCH 05/15] Update with review comments Update with review comments --- .../ContentCardView/ContentCardView.js | 22 ++- .../ContentCardView/ContentCardView.js.map | 2 +- .../ui/components/UnreadIcon/UnreadIcon.js | 142 +++++++---------- .../components/UnreadIcon/UnreadIcon.js.map | 2 +- .../ContentCardContainerProvider.js.map | 2 +- .../ContentCardView/ContentCardView.d.ts | 1 + .../ContentCardView/ContentCardView.d.ts.map | 2 +- .../ui/components/UnreadIcon/UnreadIcon.d.ts | 3 +- .../components/UnreadIcon/UnreadIcon.d.ts.map | 2 +- .../ContentCardContainerProvider.d.ts | 3 +- .../ContentCardContainerProvider.d.ts.map | 2 +- .../ContentCardView/ContentCardView.tsx | 21 ++- .../ui/components/UnreadIcon/UnreadIcon.tsx | 144 ++++++++---------- .../ContentCardContainerProvider.tsx | 3 +- yarn.lock | 41 +---- 15 files changed, 163 insertions(+), 229 deletions(-) diff --git a/packages/messaging/dist/module/ui/components/ContentCardView/ContentCardView.js b/packages/messaging/dist/module/ui/components/ContentCardView/ContentCardView.js index ab15e6f4..96d456d0 100644 --- a/packages/messaging/dist/module/ui/components/ContentCardView/ContentCardView.js +++ b/packages/messaging/dist/module/ui/components/ContentCardView/ContentCardView.js @@ -39,23 +39,27 @@ export const ContentCardView = ({ ButtonContainerProps, ButtonProps, DismissButtonProps, + isRead: isReadProp, ...props }) => { const colorScheme = useColorScheme(); const [isVisible, setIsVisible] = useState(true); - const [isRead, setIsRead] = useState(false); + const [internalIsRead, setInternalIsRead] = useState(false); const isDisplayedRef = useRef(false); const theme = useTheme(); const containerSettings = useContext(ContentCardContainerContext); + // Support both controlled and uncontrolled modes + const isRead = isReadProp !== undefined ? isReadProp : internalIsRead; + // Get unread background color based on theme - const getUnreadBackgroundColor = () => { + const unreadBackgroundColor = useMemo(() => { if (!containerSettings?.content?.isUnreadEnabled || isRead || !containerSettings.content.unread_indicator?.unread_bg) { return undefined; } const unreadBg = containerSettings.content.unread_indicator.unread_bg; return colorScheme === 'dark' ? unreadBg.clr.dark : unreadBg.clr.light; - }; + }, [containerSettings, isRead, colorScheme]); const cardVariant = useMemo(() => variant ?? template.type ?? 'SmallImage', [variant, template.type]); const onDismiss = useCallback(() => { listener?.('onDismiss', template); @@ -70,8 +74,10 @@ export const ContentCardView = ({ // Track interaction event using propositionItem template.track?.('content_clicked', MessagingEdgeEventType.INTERACT, null); - // Mark as read when interacted with - setIsRead(true); + // Mark as read (only if uncontrolled mode) + if (isReadProp === undefined) { + setInternalIsRead(true); + } if (template.data?.content?.actionUrl) { try { Linking.openURL(template.data.content.actionUrl); @@ -79,7 +85,7 @@ export const ContentCardView = ({ console.warn(`Failed to open URL: ${template.data.content.actionUrl}`, error); } } - }, [template]); + }, [template, listener, isReadProp]); const imageUri = useMemo(() => { if (colorScheme === 'dark' && template.data?.content?.image?.darkUrl) { return template.data.content.image.darkUrl; @@ -121,8 +127,8 @@ export const ContentCardView = ({ onPress: onPress, style: state => [styles.card, styleOverrides?.card, typeof style === 'function' ? style(state) : style] }, props), /*#__PURE__*/React.createElement(View, _extends({ - style: [cardVariant === 'SmallImage' ? smallImageStyles.container : styles.container, styleOverrides?.container, getUnreadBackgroundColor() && { - backgroundColor: getUnreadBackgroundColor() + style: [cardVariant === 'SmallImage' ? smallImageStyles.container : styles.container, styleOverrides?.container, unreadBackgroundColor && { + backgroundColor: unreadBackgroundColor }] }, ContainerProps), imageUri && /*#__PURE__*/React.createElement(View, _extends({ style: [cardVariant === 'SmallImage' ? smallImageStyles.imageContainer : styles.imageContainer, styleOverrides?.imageContainer] diff --git a/packages/messaging/dist/module/ui/components/ContentCardView/ContentCardView.js.map b/packages/messaging/dist/module/ui/components/ContentCardView/ContentCardView.js.map index 85ce042c..8ef9ef45 100644 --- a/packages/messaging/dist/module/ui/components/ContentCardView/ContentCardView.js.map +++ b/packages/messaging/dist/module/ui/components/ContentCardView/ContentCardView.js.map @@ -1 +1 @@ -{"version":3,"names":["React","useEffect","useCallback","useState","useRef","useMemo","Image","Linking","Pressable","StyleSheet","Text","useColorScheme","View","MessagingEdgeEventType","DismissButton","UnreadIcon","useTheme","useAspectRatio","Button","useContext","ContentCardContainerContext","ContentCardView","template","listener","variant","styleOverrides","_styleOverrides","style","ContainerProps","ImageContainerProps","ImageProps","ContentContainerProps","TextProps","TitleProps","BodyProps","ButtonContainerProps","ButtonProps","DismissButtonProps","props","colorScheme","isVisible","setIsVisible","isRead","setIsRead","isDisplayedRef","theme","containerSettings","getUnreadBackgroundColor","content","isUnreadEnabled","unread_indicator","unread_bg","undefined","unreadBg","clr","dark","light","cardVariant","type","onDismiss","track","DISMISS","onPress","INTERACT","data","actionUrl","openURL","error","console","warn","imageUri","image","darkUrl","url","imageAspectRatio","smallImageStyle","largeImageStyle","imageOnlyStyle","current","DISPLAY","createElement","_extends","state","styles","card","smallImageStyles","container","backgroundColor","imageContainer","source","uri","aspectRatio","resizeMode","contentContainer","title","color","colors","textPrimary","text","body","buttonContainer","buttons","length","map","button","key","id","textStyle","buttonText","dismissBtn","create","margin","flex","flexDirection","alignItems","borderRadius","width","paddingVertical","paddingHorizontal","justifyContent","textContent","marginBottom","fontSize","fontWeight","marginRight","lineHeight","flexWrap","paddingTop","gap","marginHorizontal","maxWidth","alignSelf"],"sourceRoot":"../../../../../src","sources":["ui/components/ContentCardView/ContentCardView.tsx"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,IACVC,SAAS,EACTC,WAAW,EACXC,QAAQ,EACRC,MAAM,EACNC,OAAO,QACF,OAAO;AASd,SACEC,KAAK,EACLC,OAAO,EACPC,SAAS,EAETC,UAAU,EACVC,IAAI,EACJC,cAAc,EACdC,IAAI,QACC,cAAc;AACrB,OAAOC,sBAAsB,MAAM,2CAAwC;AAC3E,OAAOC,aAAa,MAAM,mCAAgC;AAC1D,OAAOC,UAAU,MAAM,6BAA0B;AACjD,SAASC,QAAQ,QAAQ,sBAAa;AACtC,OAAOC,cAAc,MAAM,+BAA4B;AAEvD,OAAOC,MAAM,MAAM,qBAAkB;AACrC,SAASC,UAAU,QAAQ,OAAO;AAClC,SAASC,2BAA2B,QAAQ,iDAA8C;AAqB1F,OAAO,MAAMC,eAA2C,GAAGA,CAAC;EA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EAAE,CAAC;IACbC,GAAG,EAAE;EACP,CAAC;EACDxB,MAAM,EAAE;IACNyB,gBAAgB,EAAE;EACpB;AACF,CAAC,CAAC;AAEF,MAAM5C,gBAAgB,GAAG5E,UAAU,CAACqG,MAAM,CAAC;EACzC1B,IAAI,EAAE;IACJ+B,YAAY,EAAE,EAAE;IAChBF,aAAa,EAAE,KAAK;IACpBe,GAAG,EAAE,CAAC;IACNE,QAAQ,EAAE,MAAM;IAChBhB,UAAU,EAAE;EACd,CAAC;EACD5B,SAAS,EAAE;IACT2B,aAAa,EAAE;EACjB,CAAC;EACDzB,cAAc,EAAE;IACd2B,YAAY,EAAE,EAAE;IAChBe,QAAQ,EAAE,KAAK;IACfC,SAAS,EAAE;EACb,CAAC;EACD5D,KAAK,EAAE;IACLqB,UAAU,EAAE,SAAS;IACrBwB,KAAK,EAAE,MAAM;IACbc,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]} +{"version":3,"names":["React","useEffect","useCallback","useState","useRef","useMemo","Image","Linking","Pressable","StyleSheet","Text","useColorScheme","View","MessagingEdgeEventType","DismissButton","UnreadIcon","useTheme","useAspectRatio","Button","useContext","ContentCardContainerContext","ContentCardView","template","listener","variant","styleOverrides","_styleOverrides","style","ContainerProps","ImageContainerProps","ImageProps","ContentContainerProps","TextProps","TitleProps","BodyProps","ButtonContainerProps","ButtonProps","DismissButtonProps","isRead","isReadProp","props","colorScheme","isVisible","setIsVisible","internalIsRead","setInternalIsRead","isDisplayedRef","theme","containerSettings","undefined","unreadBackgroundColor","content","isUnreadEnabled","unread_indicator","unread_bg","unreadBg","clr","dark","light","cardVariant","type","onDismiss","track","DISMISS","onPress","INTERACT","data","actionUrl","openURL","error","console","warn","imageUri","image","darkUrl","url","imageAspectRatio","smallImageStyle","largeImageStyle","imageOnlyStyle","current","DISPLAY","createElement","_extends","state","styles","card","smallImageStyles","container","backgroundColor","imageContainer","source","uri","aspectRatio","resizeMode","contentContainer","title","color","colors","textPrimary","text","body","buttonContainer","buttons","length","map","button","key","id","textStyle","buttonText","dismissBtn","create","margin","flex","flexDirection","alignItems","borderRadius","width","paddingVertical","paddingHorizontal","justifyContent","textContent","marginBottom","fontSize","fontWeight","marginRight","lineHeight","flexWrap","paddingTop","gap","marginHorizontal","maxWidth","alignSelf"],"sourceRoot":"../../../../../src","sources":["ui/components/ContentCardView/ContentCardView.tsx"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,IACVC,SAAS,EACTC,WAAW,EACXC,QAAQ,EACRC,MAAM,EACNC,OAAO,QACF,OAAO;AASd,SACEC,KAAK,EACLC,OAAO,EACPC,SAAS,EAETC,UAAU,EACVC,IAAI,EACJC,cAAc,EACdC,IAAI,QACC,cAAc;AACrB,OAAOC,sBAAsB,MAAM,2CAAwC;AAC3E,OAAOC,aAAa,MAAM,mCAAgC;AAC1D,OAAOC,UAAU,MAAM,6BAA0B;AACjD,SAASC,QAAQ,QAAQ,sBAAa;AACtC,OAAOC,cAAc,MAAM,+BAA4B;AAEvD,OAAOC,MAAM,MAAM,qBAAkB;AACrC,SAASC,UAAU,QAAQ,OAAO;AAClC,SAASC,2BAA2B,QAAQ,iDAA8C;AAsB1F,OAAO,MAAMC,eAA2C,GAAGA,CAAC;EAC1DC,QAAQ;EACRC,QAAQ;EACRC,OAAO;EACPC,cAAc,EAAEC,eAAe;EAC/BC,KAAK;EACLC,cAAc;EACdC,mBAAmB;EACnBC,UAAU;EACVC,qBAAqB;EACrBC,SAAS;EACTC,UAAU;EACVC,SAAS;EACTC,oBAAoB;EACpBC,WAAW;EACXC,kBAAkB;EAClBC,MAAM,EAAEC,UAAU;EA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bC,GAAG,EAAE;EACP,CAAC;EACDxB,MAAM,EAAE;IACNyB,gBAAgB,EAAE;EACpB;AACF,CAAC,CAAC;AAEF,MAAM5C,gBAAgB,GAAG9E,UAAU,CAACuG,MAAM,CAAC;EACzC1B,IAAI,EAAE;IACJ+B,YAAY,EAAE,EAAE;IAChBF,aAAa,EAAE,KAAK;IACpBe,GAAG,EAAE,CAAC;IACNE,QAAQ,EAAE,MAAM;IAChBhB,UAAU,EAAE;EACd,CAAC;EACD5B,SAAS,EAAE;IACT2B,aAAa,EAAE;EACjB,CAAC;EACDzB,cAAc,EAAE;IACd2B,YAAY,EAAE,EAAE;IAChBe,QAAQ,EAAE,KAAK;IACfC,SAAS,EAAE;EACb,CAAC;EACD5D,KAAK,EAAE;IACLqB,UAAU,EAAE,SAAS;IACrBwB,KAAK,EAAE,MAAM;IACbc,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.js b/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.js index dd9edbb4..f8404aff 100644 --- a/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.js +++ b/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.js @@ -12,31 +12,27 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -import React, { useState } from 'react'; +import React, { useState, useMemo } from 'react'; import { Image, StyleSheet, View, useColorScheme } from 'react-native'; import useContainerSettings from "../../hooks/useContainerSettings.js"; -// Helper function to convert placement from settings to component position -const convertPlacement = placement => { - switch (placement) { - case 'topleft': - return 'top-left'; - case 'topright': - return 'top-right'; - case 'bottomleft': - return 'bottom-left'; - case 'bottomright': - return 'bottom-right'; - default: - return 'top-right'; - } -}; +const Dot = ({ + size, + backgroundColor +}) => /*#__PURE__*/React.createElement(View, { + style: [styles.dot, { + width: size, + height: size, + borderRadius: size / 2, + backgroundColor + }] +}); const UnreadIcon = ({ imageStyle, containerStyle, source, darkSource, size = 20, - position = 'top-right', + position = 'topright', type = 'dot', style, ...props @@ -49,8 +45,7 @@ const UnreadIcon = ({ const unreadSettings = settings.content.unread_indicator; // Use settings from context with fallbacks to props - const displaySize = size; - const displayPosition = unreadSettings?.unread_icon?.placement ? convertPlacement(unreadSettings.unread_icon.placement) : position; + const displayPosition = unreadSettings?.unread_icon?.placement ?? position; const renderType = unreadSettings?.unread_icon?.image ? 'image' : type; const imageSource = unreadSettings?.unread_icon?.image?.url ? { uri: unreadSettings.unread_icon.image.url @@ -59,82 +54,49 @@ const UnreadIcon = ({ uri: unreadSettings.unread_icon.image.darkUrl } : darkSource; const getPositionStyle = () => { - const baseStyle = { - position: 'absolute', - zIndex: 1000 - }; switch (displayPosition) { - case 'top-left': - return { - ...baseStyle, - top: 6, - left: 6 - }; - case 'top-right': - return { - ...baseStyle, - top: 6, - right: 6 - }; - case 'bottom-left': - return { - ...baseStyle, - bottom: 6, - left: 6 - }; - case 'bottom-right': - return { - ...baseStyle, - bottom: 6, - right: 6 - }; + case 'topleft': + return styles.positionTopLeft; + case 'topright': + return styles.positionTopRight; + case 'bottomleft': + return styles.positionBottomLeft; + case 'bottomright': + return styles.positionBottomRight; default: - return { - ...baseStyle, - top: 6, - right: 6 - }; + return styles.positionTopRight; } }; - const getDotColor = () => { - // Use default contrasting colors for visibility - // Note: unread_bg.clr is for the card background, not the dot - return colorScheme === 'dark' ? '#FF6B6B' : '#FF4444'; - }; + + // Use default contrasting colors for visibility + // Note: unread_bg.clr is for the card background, not the dot + const dotColor = useMemo(() => colorScheme === 'dark' ? '#FF6B6B' : '#FF4444', [colorScheme]); + const finalImageSource = useMemo(() => colorScheme === 'dark' && darkImageSource ? darkImageSource : imageSource, [colorScheme, darkImageSource, imageSource]); const renderContent = () => { // Check if we should show dot instead of image based on URL availability const shouldShowDot = colorScheme === 'dark' && unreadSettings?.unread_icon?.image?.darkUrl === '' || colorScheme === 'light' && unreadSettings?.unread_icon?.image?.url === ''; // If URL is explicitly empty string for current mode, show dot if (shouldShowDot && unreadSettings?.unread_icon?.image) { - return /*#__PURE__*/React.createElement(View, { - style: [styles.dot, { - width: displaySize, - height: displaySize, - borderRadius: displaySize / 2, - backgroundColor: getDotColor() - }] + return /*#__PURE__*/React.createElement(Dot, { + size: size, + backgroundColor: dotColor }); } // If image failed to load, fallback to dot if (renderType === 'image' && imageLoadError) { - return /*#__PURE__*/React.createElement(View, { - style: [styles.dot, { - width: displaySize, - height: displaySize, - borderRadius: displaySize / 2, - backgroundColor: getDotColor() - }] + return /*#__PURE__*/React.createElement(Dot, { + size: size, + backgroundColor: dotColor }); } if (renderType === 'image' && (imageSource || darkImageSource)) { - const finalImageSource = colorScheme === 'dark' && darkImageSource ? darkImageSource : imageSource; return /*#__PURE__*/React.createElement(Image, { source: finalImageSource, style: [styles.image, { - width: displaySize, - height: displaySize + width: size, + height: size }, imageStyle], resizeMode: "contain", onError: error => { @@ -145,28 +107,42 @@ const UnreadIcon = ({ } // Default dot type - return /*#__PURE__*/React.createElement(View, { - style: [styles.dot, { - width: displaySize, - height: displaySize, - borderRadius: displaySize / 2, - backgroundColor: getDotColor() - }] + return /*#__PURE__*/React.createElement(Dot, { + size: size, + backgroundColor: dotColor }); }; return /*#__PURE__*/React.createElement(View, _extends({ style: [styles.container, getPositionStyle(), { - minWidth: displaySize, - minHeight: displaySize + minWidth: size, + minHeight: size }, containerStyle, typeof style === 'object' ? style : undefined] }, props), renderContent()); }; export default UnreadIcon; const styles = StyleSheet.create({ container: { + position: 'absolute', + zIndex: 1000, justifyContent: 'center', alignItems: 'center' }, + positionTopLeft: { + top: 6, + left: 6 + }, + positionTopRight: { + top: 6, + right: 6 + }, + positionBottomLeft: { + bottom: 6, + left: 6 + }, + positionBottomRight: { + bottom: 6, + right: 6 + }, dot: { shadowColor: '#000', shadowOffset: { diff --git a/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.js.map b/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.js.map index c9c5ad40..b99e1ba6 100644 --- a/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.js.map +++ b/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.js.map @@ -1 +1 @@ -{"version":3,"names":["React","useState","Image","StyleSheet","View","useColorScheme","useContainerSettings","convertPlacement","placement","UnreadIcon","imageStyle","containerStyle","source","darkSource","size","position","type","style","props","colorScheme","settings","imageLoadError","setImageLoadError","unreadSettings","content","unread_indicator","displaySize","displayPosition","unread_icon","renderType","image","imageSource","url","uri","darkImageSource","darkUrl","getPositionStyle","baseStyle","zIndex","top","left","right","bottom","getDotColor","renderContent","shouldShowDot","createElement","styles","dot","width","height","borderRadius","backgroundColor","finalImageSource","resizeMode","onError","error","console","warn","nativeEvent","_extends","container","minWidth","minHeight","undefined","create","justifyContent","alignItems","shadowColor","shadowOffset","shadowOpacity","shadowRadius","elevation"],"sourceRoot":"../../../../../src","sources":["ui/components/UnreadIcon/UnreadIcon.tsx"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SACEC,KAAK,EAGLC,UAAU,EACVC,IAAI,EAGJC,cAAc,QACT,cAAc;AACrB,OAAOC,oBAAoB,MAAM,qCAAkC;AAYnE;AACA,MAAMC,gBAAgB,GAAIC,SAAgE,IAAgE;EACxJ,QAAQA,SAAS;IACf,KAAK,SAAS;MACZ,OAAO,UAAU;IACnB,KAAK,UAAU;MACb,OAAO,WAAW;IACpB,KAAK,YAAY;MACf,OAAO,aAAa;IACtB,KAAK,aAAa;MAChB,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AAE,CACL8B,MAAM,CAACc,SAAS,EAChBzB,gBAAgB,CAAC,CAAC,EAClB;MAAE0B,QAAQ,EAAEpC,WAAW;MAAEqC,SAAS,EAAErC;IAAY,CAAC,EACjDf,cAAc,EACd,OAAOM,KAAK,KAAK,QAAQ,GAAGA,KAAK,GAAG+C,SAAS;EAC7C,GACE9C,KAAK,GAER0B,aAAa,CAAC,CACX,CAAC;AAEX,CAAC;AAED,eAAenC,UAAU;AAEzB,MAAMsC,MAAM,GAAG5C,UAAU,CAAC8D,MAAM,CAAC;EAC/BJ,SAAS,EAAE;IACTK,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE;EACd,CAAC;EACDnB,GAAG,EAAE;IACHoB,WAAW,EAAE,MAAM;IACnBC,YAAY,EAAE;MACZpB,KAAK,EAAE,CAAC;MACRC,MAAM,EAAE;IACV,CAAC;IACDoB,aAAa,EAAE,IAAI;IACnBC,YAAY,EAAE,IAAI;IAClBC,SAAS,EAAE;EACb,CAAC;EACD1C,KAAK,EAAE;IACLsC,WAAW,EAAE,MAAM;IACnBC,YAAY,EAAE;MACZpB,KAAK,EAAE,CAAC;MACRC,MAAM,EAAE;IACV,CAAC;IACDoB,aAAa,EAAE,IAAI;IACnBC,YAAY,EAAE,IAAI;IAClBC,SAAS,EAAE;EACb;AACF,CAAC,CAAC","ignoreList":[]} +{"version":3,"names":["React","useState","useMemo","Image","StyleSheet","View","useColorScheme","useContainerSettings","Dot","size","backgroundColor","createElement","style","styles","dot","width","height","borderRadius","UnreadIcon","imageStyle","containerStyle","source","darkSource","position","type","props","colorScheme","settings","imageLoadError","setImageLoadError","unreadSettings","content","unread_indicator","displayPosition","unread_icon","placement","renderType","image","imageSource","url","uri","darkImageSource","darkUrl","getPositionStyle","positionTopLeft","positionTopRight","positionBottomLeft","positionBottomRight","dotColor","finalImageSource","renderContent","shouldShowDot","resizeMode","onError","error","console","warn","nativeEvent","_extends","container","minWidth","minHeight","undefined","create","zIndex","justifyContent","alignItems","top","left","right","bottom","shadowColor","shadowOffset","shadowOpacity","shadowRadius","elevation"],"sourceRoot":"../../../../../src","sources":["ui/components/UnreadIcon/UnreadIcon.tsx"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,OAAO,QAAQ,OAAO;AAChD,SACEC,KAAK,EAGLC,UAAU,EACVC,IAAI,EAGJC,cAAc,QACT,cAAc;AACrB,OAAOC,oBAAoB,MAAM,qCAAkC;AAcnE,MAAMC,GAAG,GAAGA,CAAC;EAAEC,IAAI;EAAEC;AAA2D,CAAC,kBAC/EV,KAAA,CAAAW,aAAA,CAACN,IAAI;EACHO,KAAK,EAAE,CACLC,MAAM,CAACC,GAAG,EACV;IACEC,KAAK,EAAEN,IAAI;IACXO,MAAM,EAAEP,IAAI;IACZQ,YAAY,EAAER,IAAI,GAAG,CAAC;IACtBC;EACF,CAAC;AACD,CACH,CACF;AAED,MAAMQ,UAAU,GAAGA,CAAC;EAClBC,UAAU;EACVC,cAAc;EACdC,MAAM;EACNC,UAAU;EACVb,IAAI,GAAG,EAAE;EACTc,QAAQ,GAAG,UAAU;EACrBC,IAAI,GAAG,KAAK;EACZZ,KAAK;EACL,GAAGa;AACY,CAAC,KAAK;EACrB,MAAMC,WAAW,GAAGpB,cAAc,CAAC,CAAC;EACpC,MAAMqB,QAAQ,GAAGpB,oBAAoB,CAAC,CAAC;EACvC,MAAM,CAACqB,cAAc,EAAEC,iBAAiB,CAAC,GAAG5B,QAAQ,CAAC,KAAK,CAAC;;EAE3D;EACA,MAAM6B,cAAc,GAAGH,QAAQ,CAACI,OAAO,CAACC,gBAAgB;;EAExD;EACA,MAAMC,eAAe,GAAGH,cAAc,EAAEI,WAAW,EAAEC,SAAS,IAAIZ,QAAQ;EAC1E,MAAMa,UAAU,GAAGN,cAAc,EAAEI,WAAW,EAAEG,KAAK,GAAG,OAAO,GAAGb,IAAI;EACtE,MAAMc,WAAW,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yB,aAAa,CAAC,CACX,CAAC;AAEX,CAAC;AAED,eAAehC,UAAU;AAEzB,MAAML,MAAM,GAAGT,UAAU,CAAC2D,MAAM,CAAC;EAC/BJ,SAAS,EAAE;IACTpC,QAAQ,EAAE,UAAU;IACpByC,MAAM,EAAE,IAAI;IACZC,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE;EACd,CAAC;EACDtB,eAAe,EAAE;IACfuB,GAAG,EAAE,CAAC;IACNC,IAAI,EAAE;EACR,CAAC;EACDvB,gBAAgB,EAAE;IAChBsB,GAAG,EAAE,CAAC;IACNE,KAAK,EAAE;EACT,CAAC;EACDvB,kBAAkB,EAAE;IAClBwB,MAAM,EAAE,CAAC;IACTF,IAAI,EAAE;EACR,CAAC;EACDrB,mBAAmB,EAAE;IACnBuB,MAAM,EAAE,CAAC;IACTD,KAAK,EAAE;EACT,CAAC;EACDvD,GAAG,EAAE;IACHyD,WAAW,EAAE,MAAM;IACnBC,YAAY,EAAE;MACZzD,KAAK,EAAE,CAAC;MACRC,MAAM,EAAE;IACV,CAAC;IACDyD,aAAa,EAAE,IAAI;IACnBC,YAAY,EAAE,IAAI;IAClBC,SAAS,EAAE;EACb,CAAC;EACDtC,KAAK,EAAE;IACLkC,WAAW,EAAE,MAAM;IACnBC,YAAY,EAAE;MACZzD,KAAK,EAAE,CAAC;MACRC,MAAM,EAAE;IACV,CAAC;IACDyD,aAAa,EAAE,IAAI;IACnBC,YAAY,EAAE,IAAI;IAClBC,SAAS,EAAE;EACb;AACF,CAAC,CAAC","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/providers/ContentCardContainerProvider.js.map b/packages/messaging/dist/module/ui/providers/ContentCardContainerProvider.js.map index d74069ec..ff07b1df 100644 --- a/packages/messaging/dist/module/ui/providers/ContentCardContainerProvider.js.map +++ b/packages/messaging/dist/module/ui/providers/ContentCardContainerProvider.js.map @@ -1 +1 @@ -{"version":3,"names":["React","createContext","ContentCardContainerContext","ContentCardContainerProvider","children","settings","createElement","Provider","value"],"sourceRoot":"../../../../src","sources":["ui/providers/ContentCardContainerProvider.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,aAAa,QAAQ,OAAO;AAyC5C,OAAO,MAAMC,2BAA2B,gBACtCD,aAAa,CAA2B,IAAI,CAAC;AAO/C,SAASE,4BAA4BA,CAAC;EACpCC,QAAQ;EACRC;AACiC,CAAC,EAAE;EACpC,oBACEL,KAAA,CAAAM,aAAA,CAACJ,2BAA2B,CAACK,QAAQ;IAACC,KAAK,EAAEH;EAAS,GACnDD,QACmC,CAAC;AAE3C;AAEA,eAAeD,4BAA4B","ignoreList":[]} +{"version":3,"names":["React","createContext","ContentCardContainerContext","ContentCardContainerProvider","children","settings","createElement","Provider","value"],"sourceRoot":"../../../../src","sources":["ui/providers/ContentCardContainerProvider.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,aAAa,QAAQ,OAAO;AA0C5C,OAAO,MAAMC,2BAA2B,gBACtCD,aAAa,CAA2B,IAAI,CAAC;AAO/C,SAASE,4BAA4BA,CAAC;EACpCC,QAAQ;EACRC;AACiC,CAAC,EAAE;EACpC,oBACEL,KAAA,CAAAM,aAAA,CAACJ,2BAA2B,CAACK,QAAQ;IAACC,KAAK,EAAEH;EAAS,GACnDD,QACmC,CAAC;AAE3C;AAEA,eAAeD,4BAA4B","ignoreList":[]} diff --git a/packages/messaging/dist/typescript/ui/components/ContentCardView/ContentCardView.d.ts b/packages/messaging/dist/typescript/ui/components/ContentCardView/ContentCardView.d.ts index 1fd75bbb..161f8b6c 100644 --- a/packages/messaging/dist/typescript/ui/components/ContentCardView/ContentCardView.d.ts +++ b/packages/messaging/dist/typescript/ui/components/ContentCardView/ContentCardView.d.ts @@ -13,6 +13,7 @@ export interface ContentViewProps extends PressableProps, ComponentOverrideProps }; listener?: ContentCardEventListener; variant?: ContentCardTemplate; + isRead?: boolean; } export declare const ContentCardView: React.FC; //# sourceMappingURL=ContentCardView.d.ts.map \ No newline at end of file diff --git a/packages/messaging/dist/typescript/ui/components/ContentCardView/ContentCardView.d.ts.map b/packages/messaging/dist/typescript/ui/components/ContentCardView/ContentCardView.d.ts.map index 8204857e..0b9d7f0a 100644 --- a/packages/messaging/dist/typescript/ui/components/ContentCardView/ContentCardView.d.ts.map +++ b/packages/messaging/dist/typescript/ui/components/ContentCardView/ContentCardView.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"ContentCardView.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/ContentCardView/ContentCardView.tsx"],"names":[],"mappings":"AAYA,OAAO,KAMN,MAAM,OAAO,CAAC;AACf,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAIL,cAAc,EAKf,MAAM,cAAc,CAAC;AAMtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAKtD,MAAM,MAAM,wBAAwB,GAAG,CACrC,KAAK,EAAE,gBAAgB,EACvB,IAAI,CAAC,EAAE,eAAe,EACtB,WAAW,CAAC,EAAE,GAAG,KACd,IAAI,CAAC;AAEV,MAAM,WAAW,gBACf,SAAQ,cAAc,EACpB,sBAAsB;IACxB,QAAQ,EAAE,eAAe,CAAC;IAC1B,cAAc,CAAC,EAAE;QACf,eAAe,CAAC,EAAE,sBAAsB,CAAC;QACzC,eAAe,CAAC,EAAE,sBAAsB,CAAC;QACzC,cAAc,CAAC,EAAE,qBAAqB,CAAC;KACxC,CAAC;IACF,QAAQ,CAAC,EAAE,wBAAwB,CAAC;IACpC,OAAO,CAAC,EAAE,mBAAmB,CAAC;CAC/B;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAyOtD,CAAC"} \ No newline at end of file +{"version":3,"file":"ContentCardView.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/ContentCardView/ContentCardView.tsx"],"names":[],"mappings":"AAYA,OAAO,KAMN,MAAM,OAAO,CAAC;AACf,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAIL,cAAc,EAKf,MAAM,cAAc,CAAC;AAMtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAKtD,MAAM,MAAM,wBAAwB,GAAG,CACrC,KAAK,EAAE,gBAAgB,EACvB,IAAI,CAAC,EAAE,eAAe,EACtB,WAAW,CAAC,EAAE,GAAG,KACd,IAAI,CAAC;AAEV,MAAM,WAAW,gBACf,SAAQ,cAAc,EACpB,sBAAsB;IACxB,QAAQ,EAAE,eAAe,CAAC;IAC1B,cAAc,CAAC,EAAE;QACf,eAAe,CAAC,EAAE,sBAAsB,CAAC;QACzC,eAAe,CAAC,EAAE,sBAAsB,CAAC;QACzC,cAAc,CAAC,EAAE,qBAAqB,CAAC;KACxC,CAAC;IACF,QAAQ,CAAC,EAAE,wBAAwB,CAAC;IACpC,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA+OtD,CAAC"} \ No newline at end of file diff --git a/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.d.ts b/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.d.ts index c9437f42..e5a16d02 100644 --- a/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.d.ts +++ b/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.d.ts @@ -1,12 +1,13 @@ import React from 'react'; import { ImageProps, ImageStyle, ViewProps, ViewStyle } from 'react-native'; +export type SettingsPlacement = 'topleft' | 'topright' | 'bottomleft' | 'bottomright'; export interface UnreadIconProps extends ViewProps { imageStyle?: ImageStyle; containerStyle?: ViewStyle; source?: ImageProps['source']; darkSource?: ImageProps['source']; size?: number; - position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'; + position?: SettingsPlacement; type?: 'dot' | 'image'; } declare const UnreadIcon: ({ imageStyle, containerStyle, source, darkSource, size, position, type, style, ...props }: UnreadIconProps) => React.JSX.Element; diff --git a/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.d.ts.map b/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.d.ts.map index 00c89c5f..7fe52439 100644 --- a/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.d.ts.map +++ b/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"UnreadIcon.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/UnreadIcon/UnreadIcon.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EAEL,UAAU,EACV,UAAU,EAGV,SAAS,EACT,SAAS,EAEV,MAAM,cAAc,CAAC;AAGtB,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAChD,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,MAAM,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC9B,UAAU,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,UAAU,GAAG,WAAW,GAAG,aAAa,GAAG,cAAc,CAAC;IACrE,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC;CACxB;AAkBD,QAAA,MAAM,UAAU,8FAUb,eAAe,sBAqIjB,CAAC;AAEF,eAAe,UAAU,CAAC"} \ No newline at end of file +{"version":3,"file":"UnreadIcon.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/UnreadIcon/UnreadIcon.tsx"],"names":[],"mappings":"AAWA,OAAO,KAA4B,MAAM,OAAO,CAAC;AACjD,OAAO,EAEL,UAAU,EACV,UAAU,EAGV,SAAS,EACT,SAAS,EAEV,MAAM,cAAc,CAAC;AAGtB,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,UAAU,GAAG,YAAY,GAAG,aAAa,CAAC;AAEtF,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAChD,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,MAAM,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC9B,UAAU,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC;CACxB;AAgBD,QAAA,MAAM,UAAU,8FAUb,eAAe,sBA+FjB,CAAC;AAEF,eAAe,UAAU,CAAC"} \ No newline at end of file diff --git a/packages/messaging/dist/typescript/ui/providers/ContentCardContainerProvider.d.ts b/packages/messaging/dist/typescript/ui/providers/ContentCardContainerProvider.d.ts index 378e15a6..57326e24 100644 --- a/packages/messaging/dist/typescript/ui/providers/ContentCardContainerProvider.d.ts +++ b/packages/messaging/dist/typescript/ui/providers/ContentCardContainerProvider.d.ts @@ -1,4 +1,5 @@ import React from "react"; +import { SettingsPlacement } from "../components/UnreadIcon/UnreadIcon"; export interface ContainerSettings { templateType: 'inbox' | 'banner' | 'custom'; content: { @@ -26,7 +27,7 @@ export interface ContainerSettings { }; }; unread_icon: { - placement: 'topleft' | 'topright' | 'bottomleft' | 'bottomright'; + placement: SettingsPlacement; image: { url: string; darkUrl?: string; diff --git a/packages/messaging/dist/typescript/ui/providers/ContentCardContainerProvider.d.ts.map b/packages/messaging/dist/typescript/ui/providers/ContentCardContainerProvider.d.ts.map index 1f1e67c3..d2c47638 100644 --- a/packages/messaging/dist/typescript/ui/providers/ContentCardContainerProvider.d.ts.map +++ b/packages/messaging/dist/typescript/ui/providers/ContentCardContainerProvider.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"ContentCardContainerProvider.d.ts","sourceRoot":"","sources":["../../../../src/ui/providers/ContentCardContainerProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAE7C,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC5C,OAAO,EAAE;QACP,OAAO,EAAE;YACP,OAAO,EAAE,MAAM,CAAC;SACjB,CAAC;QACF,MAAM,EAAE;YACN,WAAW,EAAE,YAAY,GAAG,UAAU,CAAC;SACxC,CAAC;QACF,QAAQ,EAAE,MAAM,CAAC;QACjB,kBAAkB,EAAE;YAClB,OAAO,EAAE;gBACP,OAAO,EAAE,MAAM,CAAC;aACjB,CAAC;YACF,KAAK,CAAC,EAAE;gBACN,GAAG,EAAE,MAAM,CAAC;gBACZ,OAAO,CAAC,EAAE,MAAM,CAAC;aAClB,CAAC;SACH,CAAC;QACF,gBAAgB,CAAC,EAAE;YACjB,SAAS,EAAE;gBACT,GAAG,EAAE;oBACH,KAAK,EAAE,MAAM,CAAC;oBACd,IAAI,EAAE,MAAM,CAAC;iBACd,CAAC;aACH,CAAC;YACF,WAAW,EAAE;gBACX,SAAS,EAAE,SAAS,GAAG,UAAU,GAAG,YAAY,GAAG,aAAa,CAAC;gBACjE,KAAK,EAAE;oBACL,GAAG,EAAE,MAAM,CAAC;oBACZ,OAAO,CAAC,EAAE,MAAM,CAAC;iBAClB,CAAC;aACH,CAAC;SACH,CAAC;QACF,eAAe,EAAE,OAAO,CAAC;KAC1B,CAAC;IACF,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,eAAO,MAAM,2BAA2B,yCACO,CAAC;AAEhD,MAAM,WAAW,iCAAiC;IAChD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,EAAE,iBAAiB,CAAC;CAC7B;AAED,iBAAS,4BAA4B,CAAC,EACpC,QAAQ,EACR,QAAQ,GACT,EAAE,iCAAiC,qBAMnC;AAED,eAAe,4BAA4B,CAAC"} \ No newline at end of file +{"version":3,"file":"ContentCardContainerProvider.d.ts","sourceRoot":"","sources":["../../../../src/ui/providers/ContentCardContainerProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAExE,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC5C,OAAO,EAAE;QACP,OAAO,EAAE;YACP,OAAO,EAAE,MAAM,CAAC;SACjB,CAAC;QACF,MAAM,EAAE;YACN,WAAW,EAAE,YAAY,GAAG,UAAU,CAAC;SACxC,CAAC;QACF,QAAQ,EAAE,MAAM,CAAC;QACjB,kBAAkB,EAAE;YAClB,OAAO,EAAE;gBACP,OAAO,EAAE,MAAM,CAAC;aACjB,CAAC;YACF,KAAK,CAAC,EAAE;gBACN,GAAG,EAAE,MAAM,CAAC;gBACZ,OAAO,CAAC,EAAE,MAAM,CAAC;aAClB,CAAC;SACH,CAAC;QACF,gBAAgB,CAAC,EAAE;YACjB,SAAS,EAAE;gBACT,GAAG,EAAE;oBACH,KAAK,EAAE,MAAM,CAAC;oBACd,IAAI,EAAE,MAAM,CAAC;iBACd,CAAC;aACH,CAAC;YACF,WAAW,EAAE;gBACX,SAAS,EAAE,iBAAiB,CAAC;gBAC7B,KAAK,EAAE;oBACL,GAAG,EAAE,MAAM,CAAC;oBACZ,OAAO,CAAC,EAAE,MAAM,CAAC;iBAClB,CAAC;aACH,CAAC;SACH,CAAC;QACF,eAAe,EAAE,OAAO,CAAC;KAC1B,CAAC;IACF,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,eAAO,MAAM,2BAA2B,yCACO,CAAC;AAEhD,MAAM,WAAW,iCAAiC;IAChD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,EAAE,iBAAiB,CAAC;CAC7B;AAED,iBAAS,4BAA4B,CAAC,EACpC,QAAQ,EACR,QAAQ,GACT,EAAE,iCAAiC,qBAMnC;AAED,eAAe,4BAA4B,CAAC"} \ No newline at end of file diff --git a/packages/messaging/src/ui/components/ContentCardView/ContentCardView.tsx b/packages/messaging/src/ui/components/ContentCardView/ContentCardView.tsx index ece9db70..a21e4ad8 100644 --- a/packages/messaging/src/ui/components/ContentCardView/ContentCardView.tsx +++ b/packages/messaging/src/ui/components/ContentCardView/ContentCardView.tsx @@ -62,6 +62,7 @@ export interface ContentViewProps }; listener?: ContentCardEventListener; variant?: ContentCardTemplate; + isRead?: boolean; } export const ContentCardView: React.FC = ({ @@ -80,24 +81,28 @@ export const ContentCardView: React.FC = ({ ButtonContainerProps, ButtonProps, DismissButtonProps, + isRead: isReadProp, ...props }) => { const colorScheme = useColorScheme(); const [isVisible, setIsVisible] = useState(true); - const [isRead, setIsRead] = useState(false); + const [internalIsRead, setInternalIsRead] = useState(false); const isDisplayedRef = useRef(false); const theme = useTheme(); const containerSettings = useContext(ContentCardContainerContext); + // Support both controlled and uncontrolled modes + const isRead = isReadProp !== undefined ? isReadProp : internalIsRead; + // Get unread background color based on theme - const getUnreadBackgroundColor = () => { + const unreadBackgroundColor = useMemo(() => { if (!containerSettings?.content?.isUnreadEnabled || isRead || !containerSettings.content.unread_indicator?.unread_bg) { return undefined; } const unreadBg = containerSettings.content.unread_indicator.unread_bg; return colorScheme === 'dark' ? unreadBg.clr.dark : unreadBg.clr.light; - }; + }, [containerSettings, isRead, colorScheme]); const cardVariant = useMemo( () => variant ?? template.type ?? 'SmallImage', @@ -119,8 +124,10 @@ export const ContentCardView: React.FC = ({ // Track interaction event using propositionItem template.track?.('content_clicked', MessagingEdgeEventType.INTERACT, null); - // Mark as read when interacted with - setIsRead(true); + // Mark as read (only if uncontrolled mode) + if (isReadProp === undefined) { + setInternalIsRead(true); + } if (template.data?.content?.actionUrl) { try { @@ -132,7 +139,7 @@ export const ContentCardView: React.FC = ({ ); } } - }, [template]); + }, [template, listener, isReadProp]); const imageUri = useMemo(() => { if (colorScheme === 'dark' && template.data?.content?.image?.darkUrl) { @@ -200,7 +207,7 @@ export const ContentCardView: React.FC = ({ ? smallImageStyles.container : styles.container, styleOverrides?.container, - getUnreadBackgroundColor() && { backgroundColor: getUnreadBackgroundColor() } + unreadBackgroundColor && { backgroundColor: unreadBackgroundColor } ]} {...ContainerProps} > diff --git a/packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.tsx b/packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.tsx index 0e8529fa..7e59ac36 100644 --- a/packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.tsx +++ b/packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.tsx @@ -9,7 +9,7 @@ ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -import React, { useState } from 'react'; +import React, { useState, useMemo } from 'react'; import { Image, ImageProps, @@ -22,31 +22,31 @@ import { } from 'react-native'; import useContainerSettings from '../../hooks/useContainerSettings'; +export type SettingsPlacement = 'topleft' | 'topright' | 'bottomleft' | 'bottomright'; + export interface UnreadIconProps extends ViewProps { imageStyle?: ImageStyle; containerStyle?: ViewStyle; source?: ImageProps['source']; darkSource?: ImageProps['source']; size?: number; - position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'; + position?: SettingsPlacement; type?: 'dot' | 'image'; } -// Helper function to convert placement from settings to component position -const convertPlacement = (placement: 'topleft' | 'topright' | 'bottomleft' | 'bottomright'): 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' => { - switch (placement) { - case 'topleft': - return 'top-left'; - case 'topright': - return 'top-right'; - case 'bottomleft': - return 'bottom-left'; - case 'bottomright': - return 'bottom-right'; - default: - return 'top-right'; - } -}; +const Dot = ({ size, backgroundColor }: { size: number; backgroundColor: string }) => ( + +); const UnreadIcon = ({ imageStyle, @@ -54,7 +54,7 @@ const UnreadIcon = ({ source, darkSource, size = 20, - position = 'top-right', + position = 'topright', type = 'dot', style, ...props @@ -67,9 +67,7 @@ const UnreadIcon = ({ const unreadSettings = settings.content.unread_indicator; // Use settings from context with fallbacks to props - const displaySize = size; - const displayPosition = unreadSettings?.unread_icon?.placement ? - convertPlacement(unreadSettings.unread_icon.placement) : position; + const displayPosition = unreadSettings?.unread_icon?.placement ?? position; const renderType = unreadSettings?.unread_icon?.image ? 'image' : type; const imageSource = unreadSettings?.unread_icon?.image?.url ? { uri: unreadSettings.unread_icon.image.url } : source; @@ -77,30 +75,31 @@ const UnreadIcon = ({ { uri: unreadSettings.unread_icon.image.darkUrl } : darkSource; const getPositionStyle = () => { - const baseStyle = { - position: 'absolute' as const, - zIndex: 1000, - }; - switch (displayPosition) { - case 'top-left': - return { ...baseStyle, top: 6, left: 6 }; - case 'top-right': - return { ...baseStyle, top: 6, right: 6 }; - case 'bottom-left': - return { ...baseStyle, bottom: 6, left: 6 }; - case 'bottom-right': - return { ...baseStyle, bottom: 6, right: 6 }; + case 'topleft': + return styles.positionTopLeft; + case 'topright': + return styles.positionTopRight; + case 'bottomleft': + return styles.positionBottomLeft; + case 'bottomright': + return styles.positionBottomRight; default: - return { ...baseStyle, top: 6, right: 6 }; + return styles.positionTopRight; } }; - const getDotColor = () => { - // Use default contrasting colors for visibility - // Note: unread_bg.clr is for the card background, not the dot - return colorScheme === 'dark' ? '#FF6B6B' : '#FF4444'; - }; + // Use default contrasting colors for visibility + // Note: unread_bg.clr is for the card background, not the dot + const dotColor = useMemo(() => + colorScheme === 'dark' ? '#FF6B6B' : '#FF4444', + [colorScheme] + ); + + const finalImageSource = useMemo(() => + colorScheme === 'dark' && darkImageSource ? darkImageSource : imageSource, + [colorScheme, darkImageSource, imageSource] + ); const renderContent = () => { // Check if we should show dot instead of image based on URL availability @@ -110,46 +109,21 @@ const UnreadIcon = ({ // If URL is explicitly empty string for current mode, show dot if (shouldShowDot && unreadSettings?.unread_icon?.image) { - return ( - - ); + return ; } // If image failed to load, fallback to dot if (renderType === 'image' && imageLoadError) { - return ( - - ); + return ; } if (renderType === 'image' && (imageSource || darkImageSource)) { - const finalImageSource = colorScheme === 'dark' && darkImageSource ? darkImageSource : imageSource; return ( - ); + return ; }; return ( @@ -182,7 +144,7 @@ const UnreadIcon = ({ style={[ styles.container, getPositionStyle(), - { minWidth: displaySize, minHeight: displaySize }, + { minWidth: size, minHeight: size }, containerStyle, typeof style === 'object' ? style : undefined ]} @@ -197,9 +159,27 @@ export default UnreadIcon; const styles = StyleSheet.create({ container: { + position: 'absolute', + zIndex: 1000, justifyContent: 'center', alignItems: 'center', }, + positionTopLeft: { + top: 6, + left: 6, + }, + positionTopRight: { + top: 6, + right: 6, + }, + positionBottomLeft: { + bottom: 6, + left: 6, + }, + positionBottomRight: { + bottom: 6, + right: 6, + }, dot: { shadowColor: '#000', shadowOffset: { diff --git a/packages/messaging/src/ui/providers/ContentCardContainerProvider.tsx b/packages/messaging/src/ui/providers/ContentCardContainerProvider.tsx index eb5027e9..40762733 100644 --- a/packages/messaging/src/ui/providers/ContentCardContainerProvider.tsx +++ b/packages/messaging/src/ui/providers/ContentCardContainerProvider.tsx @@ -1,4 +1,5 @@ import React, { createContext } from "react"; +import { SettingsPlacement } from "../components/UnreadIcon/UnreadIcon"; export interface ContainerSettings { templateType: 'inbox' | 'banner' | 'custom'; @@ -27,7 +28,7 @@ export interface ContainerSettings { }; }; unread_icon: { - placement: 'topleft' | 'topright' | 'bottomleft' | 'bottomright'; + placement: SettingsPlacement; image: { url: string; darkUrl?: string; diff --git a/yarn.lock b/yarn.lock index 42687fa2..112e6ab6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5671,24 +5671,6 @@ __metadata: languageName: node linkType: hard -"@types/react-test-renderer@npm:^19": - version: 19.1.0 - resolution: "@types/react-test-renderer@npm:19.1.0" - dependencies: - "@types/react": "npm:*" - checksum: 10c0/799654e430df10aeaf267d71507fb64ec151359ead7e3774111bfd4abce7e0911dba461811195c06c22a6d17496ea92537d3185320ff4112fe29954cad1b9152 - languageName: node - linkType: hard - -"@types/react@npm:*": - version: 19.2.0 - resolution: "@types/react@npm:19.2.0" - dependencies: - csstype: "npm:^3.0.2" - checksum: 10c0/a280e146df2abd3b06eaa2f5332dade9f7ebe916334a40699ee11139c5f22aeb49b5b78b6de8c55b53ef2fa94285e1bc2feaf4fbce6fe259a7de92dc1bf67b17 - languageName: node - linkType: hard - "@types/react@npm:^18, @types/react@npm:^18.0.5, @types/react@npm:^18.2.6, @types/react@npm:~18.3.12": version: 18.3.24 resolution: "@types/react@npm:18.3.24" @@ -6159,7 +6141,6 @@ __metadata: "@types/jest": "npm:^27.5.2" "@types/node": "npm:^22.9.0" "@types/react": "npm:^18.0.5" - "@types/react-test-renderer": "npm:^19" babel-jest: "npm:^29.7.0" babel-plugin-module-resolver: "npm:^4.1.0" babel-preset-react-native: "npm:5.0.2" @@ -6167,7 +6148,6 @@ __metadata: jest-environment-jsdom: "npm:^29.7.0" lerna: "npm:^8.2.2" metro-react-native-babel-preset: "npm:^0.70.1" - react-test-renderer: "npm:19.1.1" ts-jest: "npm:^29.1.1" tslib: "npm:^2.3.1" typescript: "npm:^4.5.5" @@ -15612,13 +15592,6 @@ __metadata: languageName: node linkType: hard -"react-is@npm:^19.1.1": - version: 19.2.0 - resolution: "react-is@npm:19.2.0" - checksum: 10c0/a63cb346aeced8ac0e671b0f9b33720d2906de02a066ca067075d871a5d4c64cdb328f495baf9b5842d5868c0d5edd1ce18465a7358b52f4b6aa983479c9bfa2 - languageName: node - linkType: hard - "react-native-builder-bob@npm:0.33.1": version: 0.33.1 resolution: "react-native-builder-bob@npm:0.33.1" @@ -16085,18 +16058,6 @@ __metadata: languageName: node linkType: hard -"react-test-renderer@npm:19.1.1": - version: 19.1.1 - resolution: "react-test-renderer@npm:19.1.1" - dependencies: - react-is: "npm:^19.1.1" - scheduler: "npm:^0.26.0" - peerDependencies: - react: ^19.1.1 - checksum: 10c0/430636d63cff6b79a15fe876d16601891fcdf1c58236471063f4cfe50de2c9fae935c6894eebe6ca5be0bf7245cb572c14ff69e1aada7761b41c73c842e2879c - languageName: node - linkType: hard - "react@npm:18.2.0": version: 18.2.0 resolution: "react@npm:18.2.0" @@ -16735,7 +16696,7 @@ __metadata: languageName: node linkType: hard -"scheduler@npm:0.26.0, scheduler@npm:^0.26.0": +"scheduler@npm:0.26.0": version: 0.26.0 resolution: "scheduler@npm:0.26.0" checksum: 10c0/5b8d5bfddaae3513410eda54f2268e98a376a429931921a81b5c3a2873aab7ca4d775a8caac5498f8cbc7d0daeab947cf923dbd8e215d61671f9f4e392d34356 From 801fc00063f03749fe0a92a915f38d95bb008500 Mon Sep 17 00:00:00 2001 From: Calise Cheung Date: Tue, 7 Oct 2025 13:00:17 -0700 Subject: [PATCH 06/15] fix the building errors for sample app and update the sample app fix the building errors for sample app and update the sample app --- .../app/ContentCardsView.tsx | 88 ++++- .../babel.config.js | 7 + .../metro.config.js | 14 +- packages/messaging/dist/module/Messaging.js | 220 ------------ .../messaging/dist/module/Messaging.js.map | 1 - packages/messaging/dist/module/index.js | 31 -- packages/messaging/dist/module/index.js.map | 1 - .../dist/module/models/ContentCard.js | 22 -- .../dist/module/models/ContentCard.js.map | 1 - .../dist/module/models/HTMLProposition.js | 22 -- .../dist/module/models/HTMLProposition.js.map | 1 - .../dist/module/models/InAppMessage.js | 4 - .../dist/module/models/InAppMessage.js.map | 1 - .../dist/module/models/JSONProposition.js | 22 -- .../dist/module/models/JSONProposition.js.map | 1 - .../messaging/dist/module/models/Message.js | 125 ------- .../dist/module/models/Message.js.map | 1 - .../dist/module/models/MessagingDelegate.js | 4 - .../module/models/MessagingDelegate.js.map | 1 - .../module/models/MessagingEdgeEventType.js | 24 -- .../models/MessagingEdgeEventType.js.map | 1 - .../module/models/MessagingProposition.js | 57 --- .../module/models/MessagingProposition.js.map | 1 - .../module/models/MessagingPropositionItem.js | 4 - .../models/MessagingPropositionItem.js.map | 1 - .../module/models/PersonalizationSchema.js | 25 -- .../models/PersonalizationSchema.js.map | 1 - .../dist/module/models/PropositionItem.js | 113 ------ .../dist/module/models/PropositionItem.js.map | 1 - .../dist/module/models/ScopeDetails.js | 2 - .../dist/module/models/ScopeDetails.js.map | 1 - .../messaging/dist/module/models/index.js | 13 - .../messaging/dist/module/models/index.js.map | 1 - .../module/ui/components/Button/Button.js | 49 --- .../module/ui/components/Button/Button.js.map | 1 - .../ui/components/Button/Button.spec.js | 2 - .../ui/components/Button/Button.spec.js.map | 1 - .../components/CenteredView/CenteredView.js | 17 - .../CenteredView/CenteredView.js.map | 1 - .../ContentCardContainer.js | 96 ----- .../ContentCardContainer.js.map | 1 - .../ContentCardContainer/EmptyState.js | 16 - .../ContentCardContainer/EmptyState.js.map | 1 - .../ContentCardView/ContentCardView.js | 275 --------------- .../ContentCardView/ContentCardView.js.map | 1 - .../components/DismissButton/DismissButton.js | 64 ---- .../DismissButton/DismissButton.js.map | 1 - .../DismissButton/DismissButton.spec.js | 294 ---------------- .../DismissButton/DismissButton.spec.js.map | 1 - .../ui/components/Pagination/Pagination.js | 152 -------- .../components/Pagination/Pagination.js.map | 1 - .../ui/components/UnreadIcon/UnreadIcon.js | 167 --------- .../components/UnreadIcon/UnreadIcon.js.map | 1 - .../components/UnreadIcon/UnreadIcon.test.js | 327 ------------------ .../UnreadIcon/UnreadIcon.test.js.map | 1 - .../dist/module/ui/components/index.js | 22 -- .../dist/module/ui/components/index.js.map | 1 - .../messaging/dist/module/ui/hooks/index.js | 6 - .../dist/module/ui/hooks/index.js.map | 1 - .../dist/module/ui/hooks/useAspectRatio.js | 21 -- .../module/ui/hooks/useAspectRatio.js.map | 1 - .../module/ui/hooks/useContainerSettings.js | 13 - .../ui/hooks/useContainerSettings.js.map | 1 - .../dist/module/ui/hooks/useContentCardUI.js | 39 --- .../module/ui/hooks/useContentCardUI.js.map | 1 - .../module/ui/hooks/useContentContainer.js | 31 -- .../ui/hooks/useContentContainer.js.map | 1 - packages/messaging/dist/module/ui/index.js | 9 - .../messaging/dist/module/ui/index.js.map | 1 - .../providers/ContentCardContainerProvider.js | 14 - .../ContentCardContainerProvider.js.map | 1 - .../messaging/dist/module/ui/theme/Theme.js | 2 - .../dist/module/ui/theme/Theme.js.map | 1 - .../dist/module/ui/theme/ThemeProvider.js | 95 ----- .../dist/module/ui/theme/ThemeProvider.js.map | 1 - .../messaging/dist/module/ui/theme/index.js | 5 - .../dist/module/ui/theme/index.js.map | 1 - .../dist/module/ui/types/ContentViewEvent.js | 2 - .../module/ui/types/ContentViewEvent.js.map | 1 - .../dist/module/ui/types/Templates.js | 14 - .../dist/module/ui/types/Templates.js.map | 1 - .../messaging/dist/module/ui/types/index.js | 5 - .../dist/module/ui/types/index.js.map | 1 - .../ContentCardView/ContentCardView.d.ts | 28 +- .../ContentCardView/ContentCardView.d.ts.map | 2 +- .../DismissButton/DismissButton.d.ts | 8 +- .../DismissButton/DismissButton.d.ts.map | 2 +- .../ui/components/UnreadIcon/UnreadIcon.d.ts | 3 +- .../components/UnreadIcon/UnreadIcon.d.ts.map | 2 +- .../ui/hooks/useContainerSettings.d.ts | 3 +- .../ui/hooks/useContainerSettings.d.ts.map | 2 +- .../typescript/ui/theme/ThemeProvider.d.ts | 4 +- .../ui/theme/ThemeProvider.d.ts.map | 2 +- .../ContentCardView/ContentCardView.tsx | 5 +- .../ui/components/UnreadIcon/UnreadIcon.tsx | 2 +- .../src/ui/hooks/useContainerSettings.ts | 7 +- 96 files changed, 152 insertions(+), 2492 deletions(-) create mode 100644 apps/AEPSampleAppNewArchEnabled/babel.config.js delete mode 100644 packages/messaging/dist/module/Messaging.js delete mode 100644 packages/messaging/dist/module/Messaging.js.map delete mode 100644 packages/messaging/dist/module/index.js delete mode 100644 packages/messaging/dist/module/index.js.map delete mode 100644 packages/messaging/dist/module/models/ContentCard.js delete mode 100644 packages/messaging/dist/module/models/ContentCard.js.map delete mode 100644 packages/messaging/dist/module/models/HTMLProposition.js delete mode 100644 packages/messaging/dist/module/models/HTMLProposition.js.map delete mode 100644 packages/messaging/dist/module/models/InAppMessage.js delete mode 100644 packages/messaging/dist/module/models/InAppMessage.js.map delete mode 100644 packages/messaging/dist/module/models/JSONProposition.js delete mode 100644 packages/messaging/dist/module/models/JSONProposition.js.map delete mode 100644 packages/messaging/dist/module/models/Message.js delete mode 100644 packages/messaging/dist/module/models/Message.js.map delete mode 100644 packages/messaging/dist/module/models/MessagingDelegate.js delete mode 100644 packages/messaging/dist/module/models/MessagingDelegate.js.map delete mode 100644 packages/messaging/dist/module/models/MessagingEdgeEventType.js delete mode 100644 packages/messaging/dist/module/models/MessagingEdgeEventType.js.map delete mode 100644 packages/messaging/dist/module/models/MessagingProposition.js delete mode 100644 packages/messaging/dist/module/models/MessagingProposition.js.map delete mode 100644 packages/messaging/dist/module/models/MessagingPropositionItem.js delete mode 100644 packages/messaging/dist/module/models/MessagingPropositionItem.js.map delete mode 100644 packages/messaging/dist/module/models/PersonalizationSchema.js delete mode 100644 packages/messaging/dist/module/models/PersonalizationSchema.js.map delete mode 100644 packages/messaging/dist/module/models/PropositionItem.js delete mode 100644 packages/messaging/dist/module/models/PropositionItem.js.map delete mode 100644 packages/messaging/dist/module/models/ScopeDetails.js delete mode 100644 packages/messaging/dist/module/models/ScopeDetails.js.map delete mode 100644 packages/messaging/dist/module/models/index.js delete mode 100644 packages/messaging/dist/module/models/index.js.map delete mode 100644 packages/messaging/dist/module/ui/components/Button/Button.js delete mode 100644 packages/messaging/dist/module/ui/components/Button/Button.js.map delete mode 100644 packages/messaging/dist/module/ui/components/Button/Button.spec.js delete mode 100644 packages/messaging/dist/module/ui/components/Button/Button.spec.js.map delete mode 100644 packages/messaging/dist/module/ui/components/CenteredView/CenteredView.js delete mode 100644 packages/messaging/dist/module/ui/components/CenteredView/CenteredView.js.map delete mode 100644 packages/messaging/dist/module/ui/components/ContentCardContainer/ContentCardContainer.js delete mode 100644 packages/messaging/dist/module/ui/components/ContentCardContainer/ContentCardContainer.js.map delete mode 100644 packages/messaging/dist/module/ui/components/ContentCardContainer/EmptyState.js delete mode 100644 packages/messaging/dist/module/ui/components/ContentCardContainer/EmptyState.js.map delete mode 100644 packages/messaging/dist/module/ui/components/ContentCardView/ContentCardView.js delete mode 100644 packages/messaging/dist/module/ui/components/ContentCardView/ContentCardView.js.map delete mode 100644 packages/messaging/dist/module/ui/components/DismissButton/DismissButton.js delete mode 100644 packages/messaging/dist/module/ui/components/DismissButton/DismissButton.js.map delete mode 100644 packages/messaging/dist/module/ui/components/DismissButton/DismissButton.spec.js delete mode 100644 packages/messaging/dist/module/ui/components/DismissButton/DismissButton.spec.js.map delete mode 100644 packages/messaging/dist/module/ui/components/Pagination/Pagination.js delete mode 100644 packages/messaging/dist/module/ui/components/Pagination/Pagination.js.map delete mode 100644 packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.js delete mode 100644 packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.js.map delete mode 100644 packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.test.js delete mode 100644 packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.test.js.map delete mode 100644 packages/messaging/dist/module/ui/components/index.js delete mode 100644 packages/messaging/dist/module/ui/components/index.js.map delete mode 100644 packages/messaging/dist/module/ui/hooks/index.js delete mode 100644 packages/messaging/dist/module/ui/hooks/index.js.map delete mode 100644 packages/messaging/dist/module/ui/hooks/useAspectRatio.js delete mode 100644 packages/messaging/dist/module/ui/hooks/useAspectRatio.js.map delete mode 100644 packages/messaging/dist/module/ui/hooks/useContainerSettings.js delete mode 100644 packages/messaging/dist/module/ui/hooks/useContainerSettings.js.map delete mode 100644 packages/messaging/dist/module/ui/hooks/useContentCardUI.js delete mode 100644 packages/messaging/dist/module/ui/hooks/useContentCardUI.js.map delete mode 100644 packages/messaging/dist/module/ui/hooks/useContentContainer.js delete mode 100644 packages/messaging/dist/module/ui/hooks/useContentContainer.js.map delete mode 100644 packages/messaging/dist/module/ui/index.js delete mode 100644 packages/messaging/dist/module/ui/index.js.map delete mode 100644 packages/messaging/dist/module/ui/providers/ContentCardContainerProvider.js delete mode 100644 packages/messaging/dist/module/ui/providers/ContentCardContainerProvider.js.map delete mode 100644 packages/messaging/dist/module/ui/theme/Theme.js delete mode 100644 packages/messaging/dist/module/ui/theme/Theme.js.map delete mode 100644 packages/messaging/dist/module/ui/theme/ThemeProvider.js delete mode 100644 packages/messaging/dist/module/ui/theme/ThemeProvider.js.map delete mode 100644 packages/messaging/dist/module/ui/theme/index.js delete mode 100644 packages/messaging/dist/module/ui/theme/index.js.map delete mode 100644 packages/messaging/dist/module/ui/types/ContentViewEvent.js delete mode 100644 packages/messaging/dist/module/ui/types/ContentViewEvent.js.map delete mode 100644 packages/messaging/dist/module/ui/types/Templates.js delete mode 100644 packages/messaging/dist/module/ui/types/Templates.js.map delete mode 100644 packages/messaging/dist/module/ui/types/index.js delete mode 100644 packages/messaging/dist/module/ui/types/index.js.map diff --git a/apps/AEPSampleAppNewArchEnabled/app/ContentCardsView.tsx b/apps/AEPSampleAppNewArchEnabled/app/ContentCardsView.tsx index 11ea95d8..c6082729 100644 --- a/apps/AEPSampleAppNewArchEnabled/app/ContentCardsView.tsx +++ b/apps/AEPSampleAppNewArchEnabled/app/ContentCardsView.tsx @@ -16,6 +16,8 @@ import { ThemeProvider, useContentCardUI, Pagination, + Messaging, + ContentCardContainerProvider, } from "@adobe/react-native-aepmessaging"; import React, { memo, useCallback, useEffect, useState } from "react"; import { @@ -102,7 +104,89 @@ const Header = ({ const colors = colorScheme === "dark" ? Colors.dark : Colors.light; - return {}} />; + return ( + + {/* View Picker */} + + Select View Type + setShowPicker(true)} + > + {selectedView} + + + + {/* Track Action Input */} + + Track Action + + + + + {isLoading ? 'Loading...' : 'Track'} + + + + + + {/* Theme Switcher */} + + Theme + + {THEME_OPTIONS.map(({ label, value }) => ( + handleThemeChange(label, value)} + > + + {label} + + + ))} + + + + {/* View Picker Modal */} + + setShowPicker(false)}> + + {VIEW_OPTIONS.map((option) => ( + { + setSelectedView(option); + setShowPicker(false); + }} + > + {option} + + ))} + setShowPicker(false)}> + Cancel + + + + + + ); }; const MemoHeader = memo(Header); @@ -450,4 +534,4 @@ const styles = StyleSheet.create({ listContent: { paddingBottom: SPACING.l, }, -}); +}); \ No newline at end of file diff --git a/apps/AEPSampleAppNewArchEnabled/babel.config.js b/apps/AEPSampleAppNewArchEnabled/babel.config.js new file mode 100644 index 00000000..100ad3df --- /dev/null +++ b/apps/AEPSampleAppNewArchEnabled/babel.config.js @@ -0,0 +1,7 @@ +module.exports = function(api) { + api.cache(true); + return { + presets: ['babel-preset-expo'], + plugins: [], + }; +}; diff --git a/apps/AEPSampleAppNewArchEnabled/metro.config.js b/apps/AEPSampleAppNewArchEnabled/metro.config.js index 3b7e18a3..bc0609f4 100644 --- a/apps/AEPSampleAppNewArchEnabled/metro.config.js +++ b/apps/AEPSampleAppNewArchEnabled/metro.config.js @@ -16,6 +16,12 @@ config.resolver.nodeModulesPaths = [ path.resolve(monorepoRoot, 'node_modules'), ]; +// Force React and React Native to resolve from app's node_modules +config.resolver.extraNodeModules = { + 'react': path.resolve(projectRoot, 'node_modules/react'), + 'react-native': path.resolve(projectRoot, 'node_modules/react-native'), +}; + // Exclude problematic nested node_modules to prevent the bundling error config.resolver.blockList = [ // Block nested node_modules inside packages @@ -24,6 +30,9 @@ config.resolver.blockList = [ /.*\/node_modules\/.*\/node_modules\/.*/, ]; +// Don't try to transpile react-native's internal source files +config.resolver.disableHierarchicalLookup = false; + // Use a separate cache for the monorepo to avoid conflicts config.cacheStores = [ new FileStore({ @@ -31,7 +40,7 @@ config.cacheStores = [ }), ]; -// Explicitly map workspace packages to their built versions +// Explicitly map workspace packages - Metro will use their package.json "react-native" field config.resolver.alias = { '@adobe/react-native-aepassurance': path.resolve(monorepoRoot, 'packages/assurance'), '@adobe/react-native-aepcampaignclassic': path.resolve(monorepoRoot, 'packages/campaignclassic'), @@ -45,6 +54,9 @@ config.resolver.alias = { '@adobe/react-native-aepplaces': path.resolve(monorepoRoot, 'packages/places'), '@adobe/react-native-aeptarget': path.resolve(monorepoRoot, 'packages/target'), '@adobe/react-native-aepuserprofile': path.resolve(monorepoRoot, 'packages/userprofile'), + // Ensure React is resolved from app's node_modules to avoid multiple instances + 'react': path.resolve(projectRoot, 'node_modules/react'), + 'react-native': path.resolve(projectRoot, 'node_modules/react-native'), }; module.exports = config; diff --git a/packages/messaging/dist/module/Messaging.js b/packages/messaging/dist/module/Messaging.js deleted file mode 100644 index 2e19e18d..00000000 --- a/packages/messaging/dist/module/Messaging.js +++ /dev/null @@ -1,220 +0,0 @@ -"use strict"; - -/* -Copyright 2024 Adobe. All rights reserved. -This file is licensed to you under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. You may obtain a copy -of the License at http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under -the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS -OF ANY KIND, either express or implied. See the License for the specific language -governing permissions and limitations under the License. -*/ - -import { NativeModules, NativeEventEmitter, Platform } from "react-native"; -import Message from "./models/Message.js"; -import { MessagingProposition } from "./models/MessagingProposition.js"; -import { PersonalizationSchema } from "./models/PersonalizationSchema.js"; -import { ContentTemplate } from "./ui/types/Templates.js"; -const RCTAEPMessaging = NativeModules.AEPMessaging; -var messagingDelegate; -class Messaging { - /** - * Returns the version of the AEPMessaging extension - * @returns {string} Promise a promise that resolves with the extension version - */ - static extensionVersion() { - return Promise.resolve(RCTAEPMessaging.extensionVersion()); - } - - /** - * Initiates a network call to retrieve remote In-App Message definitions. - */ - static refreshInAppMessages() { - RCTAEPMessaging.refreshInAppMessages(); - } - - /** - * Retrieves the list of messages which have been cached using the `shouldSaveMessage` - * method of the messaging delegate. - * Note: Messages should be cached before trying to use any of the methods on the message class - * @returns An array of messages that have been cached - */ - static async getCachedMessages() { - const messages = await RCTAEPMessaging.getCachedMessages(); - return messages.map(msg => new Message(msg)); - } - - /** - * Retrieves the last message that has been shown in the UI - * @returns The latest message to have been displayed - */ - static async getLatestMessage() { - const message = await RCTAEPMessaging.getLatestMessage(); - return message ? new Message(message) : undefined; - } - - /** - * Retrieves the previously fetched (and cached) feeds content from the SDK for the provided surfaces. - * 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. - * @param surfaces A list of surfaces to fetch - * @returns A record of surface names with their corresponding propositions - */ - static async getPropositionsForSurfaces(surfaces) { - const propositionsList = await RCTAEPMessaging.getPropositionsForSurfaces(surfaces); - let messagingPropositionsForSurfaces = {}; - for (const [surface, propositions] of Object.entries(propositionsList)) { - messagingPropositionsForSurfaces[surface] = propositions.map(proposition => new MessagingProposition(proposition)); - } - return messagingPropositionsForSurfaces; - } - - /** - * @deprecated Use PropositionItem.track(...) instead. - */ - static trackContentCardDisplay(proposition, contentCard) { - RCTAEPMessaging.trackContentCardDisplay(proposition, contentCard); - } - - /** - * @deprecated Use PropositionItem.track(...) instead. - */ - static trackContentCardInteraction(proposition, contentCard) { - RCTAEPMessaging.trackContentCardInteraction(proposition, contentCard); - } - - /** - * Tracks interactions with a PropositionItem using the provided interaction and event type. - * This method is used internally by the PropositionItem.track() method. - * - * @param {string} itemId - The unique identifier of the PropositionItem - * @param {string | null} interaction - A custom string value to be recorded in the interaction - * @param {number} eventType - The MessagingEdgeEventType numeric value - * @param {string[] | null} tokens - Array containing the sub-item tokens for recording interaction - */ - static trackPropositionItem(itemId, interaction, eventType, tokens) { - RCTAEPMessaging.trackPropositionItem(itemId, interaction, eventType, tokens); - } - - /** - * Function to set the UI Message delegate to listen the Message lifecycle events. - * @returns A function to unsubscribe from all event listeners - */ - static setMessagingDelegate(delegate) { - messagingDelegate = delegate; - const eventEmitter = new NativeEventEmitter(RCTAEPMessaging); - eventEmitter.addListener("onShow", message => messagingDelegate?.onShow?.(new Message(message))); - eventEmitter.addListener("onDismiss", message => { - const messageInstance = new Message(message); - messageInstance._clearJavascriptMessageHandlers(); - messagingDelegate?.onDismiss?.(messageInstance); - }); - eventEmitter.addListener("shouldShowMessage", message => { - const messageInstance = new Message(message); - const shouldShowMessage = messagingDelegate?.shouldShowMessage?.(messageInstance) ?? true; - const shouldSaveMessage = messagingDelegate?.shouldSaveMessage?.(messageInstance) ?? false; - RCTAEPMessaging.setMessageSettings(shouldShowMessage, shouldSaveMessage); - }); - if (Platform.OS === "ios") { - eventEmitter.addListener("urlLoaded", event => messagingDelegate?.urlLoaded?.(event.url, new Message(event.message))); - } - if (Platform.OS === "android") { - eventEmitter.addListener("onContentLoaded", event => messagingDelegate?.onContentLoaded?.(new Message(event.message))); - } - RCTAEPMessaging.setMessagingDelegate(); - return () => { - eventEmitter.removeAllListeners("onDismiss"); - eventEmitter.removeAllListeners("onShow"); - eventEmitter.removeAllListeners("shouldShowMessage"); - if (Platform.OS === "ios") { - eventEmitter.removeAllListeners("urlLoaded"); - } - if (Platform.OS === "android") { - eventEmitter.removeAllListeners("onContentLoaded"); - } - }; - } - - /** - * Sets global settings for messages being shown and cached - * Note: This method is also used by MessagingDelegate.shouldShowMessage, - * which allows finer-grained control over setting these settings - * @param shouldShowMessage Whether or not a message should be displayed - * @param shouldSaveMessage Whether or not a message should be cached - */ - static setMessageSettings(shouldShowMessage, shouldSaveMessage) { - RCTAEPMessaging.setMessageSettings(shouldShowMessage, shouldSaveMessage); - } - - /** - * Dispatches an event to fetch propositions for the provided surfaces from remote. - * @param surfaces A list of surface names to update - */ - static async updatePropositionsForSurfaces(surfaces) { - return await RCTAEPMessaging.updatePropositionsForSurfaces(surfaces); - } - - /** - * @experimental - * Retrieves the content card UI data for a given surface. - * @param surface The surface to get the content card UI data for - * @returns The content card UI data for the given surface - */ - static async getContentCardUI(surface) { - const messages = await Messaging.getPropositionsForSurfaces([surface]); - const propositions = messages[surface]; - if (!propositions?.length) { - return []; - } - const contentCards = propositions.flatMap(proposition => proposition.items.filter(item => item.schema === PersonalizationSchema.CONTENT_CARD)); - if (!contentCards?.length) { - return []; - } - return contentCards.map(card => { - const type = card.data?.meta?.adobe?.template ?? "SmallImage"; - return new ContentTemplate(card, type); - }); - } - static async getContentCardContainer(surface) { - console.log("getContentCardContainer", surface); - return { - templateType: "inbox", - content: { - heading: { - content: "Heading" - }, - layout: { - orientation: "horizontal" - }, - capacity: 10, - emptyStateSettings: { - message: { - content: "Empty State" - } - }, - unread_indicator: { - unread_bg: { - clr: { - light: "#FFF3E0", - // Light orange background for unread cards - dark: "#2D1B0E" // Dark orange background for unread cards - } - }, - unread_icon: { - placement: "topright", - image: { - url: "https://icons.veryicon.com/png/o/leisure/crisp-app-icon-library-v3/notification-5.png", - // Image in light mode - darkUrl: "" // Empty URL = shows dot in dark mode - } - } - }, - isUnreadEnabled: true // Enable unread features! - }, - showPagination: false - }; - } -} -export default Messaging; -//# sourceMappingURL=Messaging.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/Messaging.js.map b/packages/messaging/dist/module/Messaging.js.map deleted file mode 100644 index 7c639e71..00000000 --- a/packages/messaging/dist/module/Messaging.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["NativeModules","NativeEventEmitter","Platform","Message","MessagingProposition","PersonalizationSchema","ContentTemplate","RCTAEPMessaging","AEPMessaging","messagingDelegate","Messaging","extensionVersion","Promise","resolve","refreshInAppMessages","getCachedMessages","messages","map","msg","getLatestMessage","message","undefined","getPropositionsForSurfaces","surfaces","propositionsList","messagingPropositionsForSurfaces","surface","propositions","Object","entries","proposition","trackContentCardDisplay","contentCard","trackContentCardInteraction","trackPropositionItem","itemId","interaction","eventType","tokens","setMessagingDelegate","delegate","eventEmitter","addListener","onShow","messageInstance","_clearJavascriptMessageHandlers","onDismiss","shouldShowMessage","shouldSaveMessage","setMessageSettings","OS","event","urlLoaded","url","onContentLoaded","removeAllListeners","updatePropositionsForSurfaces","getContentCardUI","length","contentCards","flatMap","items","filter","item","schema","CONTENT_CARD","card","type","data","meta","adobe","template","getContentCardContainer","console","log","templateType","content","heading","layout","orientation","capacity","emptyStateSettings","unread_indicator","unread_bg","clr","light","dark","unread_icon","placement","image","darkUrl","isUnreadEnabled","showPagination"],"sourceRoot":"../../src","sources":["Messaging.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SACEA,aAAa,EACbC,kBAAkB,EAElBC,QAAQ,QACH,cAAc;AACrB,OAAOC,OAAO,MAAM,qBAAkB;AAEtC,SAASC,oBAAoB,QAAQ,kCAA+B;AAEpE,SAASC,qBAAqB,QAAQ,mCAAgC;AACtE,SAASC,eAAe,QAAQ,yBAAsB;AAkCtD,MAAMC,eAAqD,GACzDP,aAAa,CAACQ,YAAY;AAG5B,IAAIC,iBAAoC;AAExC,MAAMC,SAAS,CAAC;EACd;AACF;AACA;AACA;EACE,OAAOC,gBAAgBA,CAAA,EAAoB;IACzC,OAAOC,OAAO,CAACC,OAAO,CAACN,eAAe,CAACI,gBAAgB,CAAC,CAAC,CAAC;EAC5D;;EAEA;AACF;AACA;EACE,OAAOG,oBAAoBA,CAAA,EAAG;IAC5BP,eAAe,CAACO,oBAAoB,CAAC,CAAC;EACxC;;EAEA;AACF;AACA;AACA;AACA;AACA;EACE,aAAaC,iBAAiBA,CAAA,EAAuB;IACnD,MAAMC,QAAQ,GAAG,MAAMT,eAAe,CAACQ,iBAAiB,CAAC,CAAC;IAC1D,OAAOC,QAAQ,CAACC,GAAG,CAAEC,GAAG,IAAK,IAAIf,OAAO,CAACe,GAAG,CAAC,CAAC;EAChD;;EAEA;AACF;AACA;AACA;EACE,aAAaC,gBAAgBA,CAAA,EAAwC;IACnE,MAAMC,OAAO,GAAG,MAAMb,eAAe,CAACY,gBAAgB,CAAC,CAAC;IACxD,O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,IAAI,GAAGD,IAAI,CAACE,IAAI,EAAEC,IAAI,EAAEC,KAAK,EAAEC,QAAQ,IAAI,YAAY;MAC7D,OAAO,IAAIjE,eAAe,CAAC4D,IAAI,EAAEC,IAAI,CAAC;IACxC,CAAC,CAAC;EACJ;EAEA,aAAaK,uBAAuBA,CAClC9C,OAAe,EACa;IAC5B+C,OAAO,CAACC,GAAG,CAAC,yBAAyB,EAAEhD,OAAO,CAAC;IAC/C,OAAO;MACLiD,YAAY,EAAE,OAAO;MACrBC,OAAO,EAAE;QACPC,OAAO,EAAE;UACPD,OAAO,EAAE;QACX,CAAC;QACDE,MAAM,EAAE;UACNC,WAAW,EAAE;QACf,CAAC;QACDC,QAAQ,EAAE,EAAE;QACZC,kBAAkB,EAAE;UAClB7D,OAAO,EAAE;YACPwD,OAAO,EAAE;UACX;QACF,CAAC;QACDM,gBAAgB,EAAE;UAChBC,SAAS,EAAE;YACTC,GAAG,EAAE;cACHC,KAAK,EAAE,SAAS;cAChBC,IAAI,EAAE;YACR;UACF,CAAC;UACDC,WAAW,EAAE;YACXC,SAAS,EAAE,UAAU;YACrBC,KAAK,EAAE;cACLpC,GAAG,EAAE,uBAAuB;cAC5BqC,OAAO,EAAE;YACX;UACF;QACF,CAAC;QACDC,eAAe,EAAE;MACnB,CAAC;MACDC,cAAc,EAAE;IAClB,CAAC;EACH;AACF;AAEA,eAAelF,SAAS","ignoreList":[]} diff --git a/packages/messaging/dist/module/index.js b/packages/messaging/dist/module/index.js deleted file mode 100644 index d8a01be2..00000000 --- a/packages/messaging/dist/module/index.js +++ /dev/null @@ -1,31 +0,0 @@ -"use strict"; - -/* -Copyright 2023 Adobe. All rights reserved. -This file is licensed to you under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. You may obtain a copy -of the License at http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under -the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS -OF ANY KIND, either express or implied. See the License for the specific language -governing permissions and limitations under the License. -*/ - -import Messaging from "./Messaging.js"; -import { ContentCard, ContentCardData } from "./models/ContentCard.js"; -import { InAppMessage } from "./models/InAppMessage.js"; -import { HTMLProposition, HTMLPropositionData } from "./models/HTMLProposition.js"; -import { JSONPropositionItem, JSONPropositionData } from "./models/JSONProposition.js"; -import Message from "./models/Message.js"; -import { MessagingDelegate } from "./models/MessagingDelegate.js"; -import MessagingEdgeEventType from "./models/MessagingEdgeEventType.js"; -import { MessagingProposition } from "./models/MessagingProposition.js"; -import { MessagingPropositionItem } from "./models/MessagingPropositionItem.js"; -import { PersonalizationSchema } from "./models/PersonalizationSchema.js"; -import { PropositionItem, PropositionItemData } from "./models/PropositionItem.js"; -import { Activity, Characteristics } from "./models/ScopeDetails.js"; -export * from "./models/ContentCard.js"; -export * from "./ui/index.js"; -export { Activity, Characteristics, ContentCard, ContentCardData, InAppMessage, Messaging, Message, MessagingDelegate, MessagingEdgeEventType, MessagingProposition, MessagingPropositionItem, PersonalizationSchema, PropositionItem, PropositionItemData, HTMLProposition, HTMLPropositionData, JSONPropositionItem, JSONPropositionData }; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/index.js.map b/packages/messaging/dist/module/index.js.map deleted file mode 100644 index 324835aa..00000000 --- a/packages/messaging/dist/module/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["Messaging","ContentCard","ContentCardData","InAppMessage","HTMLProposition","HTMLPropositionData","JSONPropositionItem","JSONPropositionData","Message","MessagingDelegate","MessagingEdgeEventType","MessagingProposition","MessagingPropositionItem","PersonalizationSchema","PropositionItem","PropositionItemData","Activity","Characteristics"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,SAAS,MAAM,gBAAa;AACnC,SAASC,WAAW,EAAEC,eAAe,QAAQ,yBAAsB;AAEnE,SAASC,YAAY,QAAQ,0BAAuB;AACpD,SAASC,eAAe,EAAEC,mBAAmB,QAAQ,6BAA0B;AAC/E,SAASC,mBAAmB,EAAEC,mBAAmB,QAAQ,6BAA0B;AAEnF,OAAOC,OAAO,MAAM,qBAAkB;AACtC,SAASC,iBAAiB,QAAQ,+BAA4B;AAC9D,OAAOC,sBAAsB,MAAM,oCAAiC;AACpE,SAASC,oBAAoB,QAAQ,kCAA+B;AACpE,SAASC,wBAAwB,QAAQ,sCAAmC;AAC5E,SAASC,qBAAqB,QAAQ,mCAAgC;AACtE,SAASC,eAAe,EAAEC,mBAAmB,QAAQ,6BAA0B;AAC/E,SAASC,QAAQ,EAAEC,eAAe,QAAQ,0BAAuB;AAEjE,cAAc,yBAAsB;AACpC,cAAc,eAAM;AAEpB,SACED,QAAQ,EACRC,eAAe,EACfhB,WAAW,EACXC,eAAe,EACfC,YAAY,EACZH,SAAS,EACTQ,OAAO,EACPC,iBAAiB,EACjBC,sBAAsB,EACtBC,oBAAoB,EACpBC,wBAAwB,EACxBC,qBAAqB,EACrBC,eAAe,EACfC,mBAAmB,EACnBX,eAAe,EACfC,mBAAmB,EACnBC,mBAAmB,EACnBC,mBAAmB","ignoreList":[]} diff --git a/packages/messaging/dist/module/models/ContentCard.js b/packages/messaging/dist/module/models/ContentCard.js deleted file mode 100644 index b7d9da60..00000000 --- a/packages/messaging/dist/module/models/ContentCard.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; - -/* - Copyright 2024 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law - or agreed to in writing, software distributed under the License is - distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF - ANY KIND, either express or implied. See the License for the specific - language governing permissions and limitations under the License. -*/ - -import { PropositionItem } from "./PropositionItem.js"; -export class ContentCard extends PropositionItem { - constructor(contentCardData) { - super(contentCardData); - this.data = contentCardData.data; - } -} -//# sourceMappingURL=ContentCard.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/models/ContentCard.js.map b/packages/messaging/dist/module/models/ContentCard.js.map deleted file mode 100644 index d7a9cdd7..00000000 --- a/packages/messaging/dist/module/models/ContentCard.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["PropositionItem","ContentCard","constructor","contentCardData","data"],"sourceRoot":"../../../src","sources":["models/ContentCard.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,eAAe,QAA6B,sBAAmB;AA2DxE,OAAO,MAAMC,WAAW,SAASD,eAAe,CAAC;EAG/CE,WAAWA,CAACC,eAAgC,EAAE;IAC5C,KAAK,CAACA,eAAe,CAAC;IACtB,IAAI,CAACC,IAAI,GAAGD,eAAe,CAACC,IAAI;EAClC;AACF","ignoreList":[]} diff --git a/packages/messaging/dist/module/models/HTMLProposition.js b/packages/messaging/dist/module/models/HTMLProposition.js deleted file mode 100644 index db412f58..00000000 --- a/packages/messaging/dist/module/models/HTMLProposition.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; - -/* - Copyright 2024 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law - or agreed to in writing, software distributed under the License is - distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF - ANY KIND, either express or implied. See the License for the specific - language governing permissions and limitations under the License. -*/ - -import { PropositionItem } from "./PropositionItem.js"; -export class HTMLProposition extends PropositionItem { - constructor(htmlData) { - super(htmlData); - this.data = htmlData.data; - } -} -//# sourceMappingURL=HTMLProposition.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/models/HTMLProposition.js.map b/packages/messaging/dist/module/models/HTMLProposition.js.map deleted file mode 100644 index 07b4cdc3..00000000 --- a/packages/messaging/dist/module/models/HTMLProposition.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["PropositionItem","HTMLProposition","constructor","htmlData","data"],"sourceRoot":"../../../src","sources":["models/HTMLProposition.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,eAAe,QAA6B,sBAAmB;AASxE,OAAO,MAAMC,eAAe,SAASD,eAAe,CAAC;EAGpDE,WAAWA,CAACC,QAA6B,EAAE;IAC1C,KAAK,CAACA,QAAQ,CAAC;IACf,IAAI,CAACC,IAAI,GAAGD,QAAQ,CAACC,IAAI;EAC1B;AACD","ignoreList":[]} diff --git a/packages/messaging/dist/module/models/InAppMessage.js b/packages/messaging/dist/module/models/InAppMessage.js deleted file mode 100644 index 76b49777..00000000 --- a/packages/messaging/dist/module/models/InAppMessage.js +++ /dev/null @@ -1,4 +0,0 @@ -"use strict"; - -export {}; -//# sourceMappingURL=InAppMessage.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/models/InAppMessage.js.map b/packages/messaging/dist/module/models/InAppMessage.js.map deleted file mode 100644 index dd6a2851..00000000 --- a/packages/messaging/dist/module/models/InAppMessage.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":[],"sourceRoot":"../../../src","sources":["models/InAppMessage.ts"],"mappings":"","ignoreList":[]} diff --git a/packages/messaging/dist/module/models/JSONProposition.js b/packages/messaging/dist/module/models/JSONProposition.js deleted file mode 100644 index 2c6c8e6b..00000000 --- a/packages/messaging/dist/module/models/JSONProposition.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; - -/* - Copyright 2024 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law - or agreed to in writing, software distributed under the License is - distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF - ANY KIND, either express or implied. See the License for the specific - language governing permissions and limitations under the License. -*/ - -import { PropositionItem } from "./PropositionItem.js"; -export class JSONPropositionItem extends PropositionItem { - constructor(jsonData) { - super(jsonData); - this.data = jsonData.data; - } -} -//# sourceMappingURL=JSONProposition.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/models/JSONProposition.js.map b/packages/messaging/dist/module/models/JSONProposition.js.map deleted file mode 100644 index 2e0456f3..00000000 --- a/packages/messaging/dist/module/models/JSONProposition.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["PropositionItem","JSONPropositionItem","constructor","jsonData","data"],"sourceRoot":"../../../src","sources":["models/JSONProposition.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,eAAe,QAA6B,sBAAmB;AASxE,OAAO,MAAMC,mBAAmB,SAASD,eAAe,CAAC;EAGxDE,WAAWA,CAACC,QAA6B,EAAE;IAC1C,KAAK,CAACA,QAAQ,CAAC;IACf,IAAI,CAACC,IAAI,GAAGD,QAAQ,CAACC,IAAI;EAC1B;AACD","ignoreList":[]} diff --git a/packages/messaging/dist/module/models/Message.js b/packages/messaging/dist/module/models/Message.js deleted file mode 100644 index 2c31f6b1..00000000 --- a/packages/messaging/dist/module/models/Message.js +++ /dev/null @@ -1,125 +0,0 @@ -"use strict"; - -/* -Copyright 2023 Adobe. All rights reserved. -This file is licensed to you under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. You may obtain a copy -of the License at http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under -the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS -OF ANY KIND, either express or implied. See the License for the specific language -governing permissions and limitations under the License. -*/ - -import { NativeEventEmitter, NativeModules } from 'react-native'; -const RCTAEPMessaging = NativeModules.AEPMessaging; - -// Registery to store inAppMessage callbacks for each message in Message.handleJavascriptMessage -// Record - {messageId : {handlerName : callback}} -const jsMessageHandlers = {}; -const handleJSMessageEventEmitter = new NativeEventEmitter(RCTAEPMessaging); - -// invokes the callback registered in Message.handleJavascriptMessage with the content received from the inAppMessage webview -handleJSMessageEventEmitter.addListener('onJavascriptMessage', event => { - const { - messageId, - handlerName, - content - } = event; - if (jsMessageHandlers[messageId] && jsMessageHandlers[messageId][handlerName]) { - jsMessageHandlers[messageId][handlerName](content); - } -}); -class Message { - constructor({ - id, - autoTrack = false - }) { - this.id = id; - this.autoTrack = autoTrack; - } - - /** - * Update the value of property "autoTrack" - * This function works only for the Message objects that were saved by calling "Messaging.saveMessage" - * @param {boolean} autoTrack: New value of property autoTrack. - */ - setAutoTrack(autoTrack) { - this.autoTrack = autoTrack; - RCTAEPMessaging.setAutoTrack(this.id, autoTrack); - } - - /** - * Signals to the UIServices that the message should be shown. - * If autoTrack is true, calling this method will result in an "inapp.display" Edge Event being dispatched. - */ - show() { - RCTAEPMessaging.show(this.id); - } - - /** - * Signals to the UIServices that the message should be dismissed. - * If `autoTrack` is true, calling this method will result in an "inapp.dismiss" Edge Event being dispatched. - * @param {boolean?} suppressAutoTrack: if set to true, the inapp.dismiss Edge Event will not be sent regardless - * of the autoTrack setting. - */ - dismiss(suppressAutoTrack) { - RCTAEPMessaging.dismiss(this.id, suppressAutoTrack ? true : false); - } - - /** - * Generates an Edge Event for the provided interaction and eventType. - * @param {string?} interaction: a custom String value to be recorded in the interaction - * @param {MessagingEdgeEventType} eventType: the MessagingEdgeEventType to be used for the ensuing Edge Event - */ - track(interaction, eventType) { - RCTAEPMessaging.track(this.id, interaction, eventType); - } - - /** - * Clears the cached reference to the Message object. - * This function must be called if Message was saved by calling "MessagingDelegate.shouldSaveMessage" but no longer needed. - * Failure to call this function leads to memory leaks. - */ - clear() { - RCTAEPMessaging.clear(this.id); - } - - /** - * Adds a handler for named JavaScript messages sent from the message's WebView. - * The parameter passed to handler will contain the body of the message passed from the WebView's JavaScript. - * @param {string} handlerName: The name of the message that should be handled by the handler - * @param {function} handler: The method or closure to be called with the body of the message created in the Message's JavaScript - */ - handleJavascriptMessage(handlerName, handler) { - // Validate parameters - if (!handlerName) { - console.warn('[AEP Messaging] handleJavascriptMessage: handlerName is required'); - return; - } - if (typeof handler !== 'function') { - console.warn('[AEP Messaging] handleJavascriptMessage: handler must be a function'); - return; - } - - // cache the callback - if (!jsMessageHandlers[this.id]) { - jsMessageHandlers[this.id] = {}; - } - jsMessageHandlers[this.id][handlerName] = handler; - RCTAEPMessaging.handleJavascriptMessage(this.id, handlerName); - } - - /** - * @internal - For internal use only. - * Clears all the javascript message handlers for the message. - * This function must be called if the callbacks registered in handleJavascriptMessage are no longer needed. - * Failure to call this function may lead to memory leaks. - */ - _clearJavascriptMessageHandlers() { - delete jsMessageHandlers[this.id]; - } -} -export default Message; -//# sourceMappingURL=Message.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/models/Message.js.map b/packages/messaging/dist/module/models/Message.js.map deleted file mode 100644 index 7b62a404..00000000 --- a/packages/messaging/dist/module/models/Message.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["NativeEventEmitter","NativeModules","RCTAEPMessaging","AEPMessaging","jsMessageHandlers","handleJSMessageEventEmitter","addListener","event","messageId","handlerName","content","Message","constructor","id","autoTrack","setAutoTrack","show","dismiss","suppressAutoTrack","track","interaction","eventType","clear","handleJavascriptMessage","handler","console","warn","_clearJavascriptMessageHandlers"],"sourceRoot":"../../../src","sources":["models/Message.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,kBAAkB,EAAEC,aAAa,QAAQ,cAAc;AAEhE,MAAMC,eAAe,GAAGD,aAAa,CAACE,YAAY;;AAElD;AACA;AACA,MAAMC,iBAA4E,GAAG,CAAC,CAAC;AACvF,MAAMC,2BAA2B,GAAG,IAAIL,kBAAkB,CAACE,eAAe,CAAC;;AAE3E;AACAG,2BAA2B,CAACC,WAAW,CAAC,qBAAqB,EAAGC,K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ACd,WAAmB,EAAEe,OAAkC,EAAE;IAC/E;IACA,IAAI,CAACf,WAAW,EAAE;MAChBgB,OAAO,CAACC,IAAI,CAAC,kEAAkE,CAAC;MAChF;IACF;IAEA,IAAI,OAAOF,OAAO,KAAK,UAAU,EAAE;MACjCC,OAAO,CAACC,IAAI,CAAC,qEAAqE,CAAC;MACnF;IACF;;IAEA;IACA,IAAI,CAACtB,iBAAiB,CAAC,IAAI,CAACS,EAAE,CAAC,EAAE;MAC/BT,iBAAiB,CAAC,IAAI,CAACS,EAAE,CAAC,GAAG,CAAC,CAAC;IACjC;IACAT,iBAAiB,CAAC,IAAI,CAACS,EAAE,CAAC,CAACJ,WAAW,CAAC,GAAGe,OAAO;IACjDtB,eAAe,CAACqB,uBAAuB,CAAC,IAAI,CAACV,EAAE,EAAEJ,WAAW,CAAC;EAC/D;;EAEA;AACF;AACA;AACA;AACA;AACA;EACEkB,+BAA+BA,CAAA,EAAG;IAChC,OAAOvB,iBAAiB,CAAC,IAAI,CAACS,EAAE,CAAC;EACnC;AACF;AAEA,eAAeF,OAAO","ignoreList":[]} diff --git a/packages/messaging/dist/module/models/MessagingDelegate.js b/packages/messaging/dist/module/models/MessagingDelegate.js deleted file mode 100644 index 2e44b334..00000000 --- a/packages/messaging/dist/module/models/MessagingDelegate.js +++ /dev/null @@ -1,4 +0,0 @@ -"use strict"; - -export {}; -//# sourceMappingURL=MessagingDelegate.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/models/MessagingDelegate.js.map b/packages/messaging/dist/module/models/MessagingDelegate.js.map deleted file mode 100644 index 97d960ae..00000000 --- a/packages/messaging/dist/module/models/MessagingDelegate.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":[],"sourceRoot":"../../../src","sources":["models/MessagingDelegate.ts"],"mappings":"","ignoreList":[]} diff --git a/packages/messaging/dist/module/models/MessagingEdgeEventType.js b/packages/messaging/dist/module/models/MessagingEdgeEventType.js deleted file mode 100644 index 86da25c6..00000000 --- a/packages/messaging/dist/module/models/MessagingEdgeEventType.js +++ /dev/null @@ -1,24 +0,0 @@ -"use strict"; - -/* -Copyright 2023 Adobe. All rights reserved. -This file is licensed to you under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. You may obtain a copy -of the License at http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under -the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS -OF ANY KIND, either express or implied. See the License for the specific language -governing permissions and limitations under the License. -*/ -var MessagingEdgeEventType = /*#__PURE__*/function (MessagingEdgeEventType) { - MessagingEdgeEventType[MessagingEdgeEventType["DISMISS"] = 0] = "DISMISS"; - MessagingEdgeEventType[MessagingEdgeEventType["INTERACT"] = 1] = "INTERACT"; - MessagingEdgeEventType[MessagingEdgeEventType["TRIGGER"] = 2] = "TRIGGER"; - MessagingEdgeEventType[MessagingEdgeEventType["DISPLAY"] = 3] = "DISPLAY"; - MessagingEdgeEventType[MessagingEdgeEventType["PUSH_APPLICATION_OPENED"] = 4] = "PUSH_APPLICATION_OPENED"; - MessagingEdgeEventType[MessagingEdgeEventType["PUSH_CUSTOM_ACTION"] = 5] = "PUSH_CUSTOM_ACTION"; - return MessagingEdgeEventType; -}(MessagingEdgeEventType || {}); -export default MessagingEdgeEventType; -//# sourceMappingURL=MessagingEdgeEventType.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/models/MessagingEdgeEventType.js.map b/packages/messaging/dist/module/models/MessagingEdgeEventType.js.map deleted file mode 100644 index 4bc87988..00000000 --- a/packages/messaging/dist/module/models/MessagingEdgeEventType.js.map +++ /dev/null @@ -1 +0,0 @@ -{"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":[]} diff --git a/packages/messaging/dist/module/models/MessagingProposition.js b/packages/messaging/dist/module/models/MessagingProposition.js deleted file mode 100644 index 4ce3ac77..00000000 --- a/packages/messaging/dist/module/models/MessagingProposition.js +++ /dev/null @@ -1,57 +0,0 @@ -"use strict"; - -/* - Copyright 2024 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law - or agreed to in writing, software distributed under the License is - distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF - ANY KIND, either express or implied. See the License for the specific - language governing permissions and limitations under the License. -*/ - -import { PersonalizationSchema } from "./PersonalizationSchema.js"; -import { ContentCard } from "./ContentCard.js"; -import { HTMLProposition } from "./HTMLProposition.js"; -import { JSONPropositionItem } from "./JSONProposition.js"; -import { PropositionItem } from "./PropositionItem.js"; -export class MessageProposition { - constructor(raw) { - this.id = raw?.id ?? ''; - this.scope = raw?.scope ?? ''; - this.scopeDetails = raw?.scopeDetails ?? {}; - - // Mirror activity.id into activity.activityID for convenience - const activityIdFromScope = this.scopeDetails?.activity?.id ?? ''; - if (this.scopeDetails?.activity) { - this.scopeDetails.activity.activityID = activityIdFromScope; - } - const rawItems = Array.isArray(raw?.items) ? raw.items : []; - this.items = rawItems.map(itemData => { - const activityId = this.scopeDetails?.activity?.id ?? ''; - let instance; - switch (itemData?.schema) { - case PersonalizationSchema.CONTENT_CARD: - instance = new ContentCard(itemData); - instance.activityID = activityId; - return instance; - case PersonalizationSchema.HTML_CONTENT: - instance = new HTMLProposition(itemData); - instance.activityID = activityId; - return instance; - case PersonalizationSchema.JSON_CONTENT: - instance = new JSONPropositionItem(itemData); - instance.activityID = activityId; - return instance; - default: - instance = new PropositionItem(itemData); - instance.activityID = activityId; - return instance; - } - }); - } -} -export { MessageProposition as MessagingProposition }; -//# sourceMappingURL=MessagingProposition.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/models/MessagingProposition.js.map b/packages/messaging/dist/module/models/MessagingProposition.js.map deleted file mode 100644 index 4682df43..00000000 --- a/packages/messaging/dist/module/models/MessagingProposition.js.map +++ /dev/null @@ -1 +0,0 @@ -{"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":[]} diff --git a/packages/messaging/dist/module/models/MessagingPropositionItem.js b/packages/messaging/dist/module/models/MessagingPropositionItem.js deleted file mode 100644 index 8960d7e2..00000000 --- a/packages/messaging/dist/module/models/MessagingPropositionItem.js +++ /dev/null @@ -1,4 +0,0 @@ -"use strict"; - -export {}; -//# sourceMappingURL=MessagingPropositionItem.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/models/MessagingPropositionItem.js.map b/packages/messaging/dist/module/models/MessagingPropositionItem.js.map deleted file mode 100644 index 13a70d5a..00000000 --- a/packages/messaging/dist/module/models/MessagingPropositionItem.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":[],"sourceRoot":"../../../src","sources":["models/MessagingPropositionItem.ts"],"mappings":"","ignoreList":[]} diff --git a/packages/messaging/dist/module/models/PersonalizationSchema.js b/packages/messaging/dist/module/models/PersonalizationSchema.js deleted file mode 100644 index 22705639..00000000 --- a/packages/messaging/dist/module/models/PersonalizationSchema.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; - -/* - Copyright 2024 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law - or agreed to in writing, software distributed under the License is - distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF - ANY KIND, either express or implied. See the License for the specific - language governing permissions and limitations under the License. -*/ - -export let PersonalizationSchema = /*#__PURE__*/function (PersonalizationSchema) { - PersonalizationSchema["CONTENT_CARD"] = "https://ns.adobe.com/personalization/message/content-card"; - PersonalizationSchema["DEFAULT_CONTENT"] = "https://ns.adobe.com/personalization/default-content-item"; - PersonalizationSchema["HTML_CONTENT"] = "https://ns.adobe.com/personalization/html-content-item"; - PersonalizationSchema["IN_APP"] = "https://ns.adobe.com/personalization/message/in-app"; - PersonalizationSchema["JSON_CONTENT"] = "https://ns.adobe.com/personalization/json-content-item"; - PersonalizationSchema["NATIVE_ALERT"] = "https://ns.adobe.com/personalization/message/native-alert"; - PersonalizationSchema["RULESET_ITEM"] = "https://ns.adobe.com/personalization/ruleset-item"; - return PersonalizationSchema; -}({}); -//# sourceMappingURL=PersonalizationSchema.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/models/PersonalizationSchema.js.map b/packages/messaging/dist/module/models/PersonalizationSchema.js.map deleted file mode 100644 index 685db7b9..00000000 --- a/packages/messaging/dist/module/models/PersonalizationSchema.js.map +++ /dev/null @@ -1 +0,0 @@ -{"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;EAAA,OAArBA,qBAAqB;AAAA","ignoreList":[]} diff --git a/packages/messaging/dist/module/models/PropositionItem.js b/packages/messaging/dist/module/models/PropositionItem.js deleted file mode 100644 index 7128a893..00000000 --- a/packages/messaging/dist/module/models/PropositionItem.js +++ /dev/null @@ -1,113 +0,0 @@ -"use strict"; - -/* - Copyright 2025 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law - or agreed to in writing, software distributed under the License is - distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF - ANY KIND, either express or implied. See the License for the specific - language governing permissions and limitations under the License. -*/ - -import { NativeModules } from 'react-native'; -const RCTAEPMessaging = NativeModules.AEPMessaging; - -/** - * Base PropositionItem interface that all proposition items implement - */ - -/** - * A PropositionItem represents a personalization JSON object returned by Konductor. - * This is the base class that provides tracking functionality for all proposition items - * including ContentCards, InApp messages, and code-based experiences. - * - * This mirrors the native Android PropositionItem class functionality. - */ -export class PropositionItem { - constructor(propositionItemData) { - this.id = propositionItemData.id; - this.schema = propositionItemData.schema; - this.data = propositionItemData.data; - this.uuid = propositionItemData.uuid; - this.activityID = propositionItemData.activityID; - } - - /** - * Gets the PropositionItem identifier. - * - * @returns {string} The PropositionItem identifier - */ - getItemId() { - return this.id; - } - - /** - * Gets the PropositionItem content schema. - * - * @returns {PersonalizationSchema} The PropositionItem content schema - */ - getSchema() { - return this.schema; - } - - /** - * Gets the PropositionItem data. - * - * @returns {object} The PropositionItem data - */ - getItemData() { - return this.data; - } - - /** - * Tracks interaction with this proposition item. - * This is the core tracking method that all proposition items use. - * - * @param {MessagingEdgeEventType} eventType - The MessagingEdgeEventType specifying event type for the interaction - * - * @example - * propositionItem.track(MessagingEdgeEventType.DISPLAY); - */ - - /** - * Tracks interaction with this proposition item. - * - * @param {string | null} interaction - String describing the interaction - * @param {MessagingEdgeEventType} eventType - The MessagingEdgeEventType specifying event type for the interaction - * @param {string[] | null} tokens - Array containing the sub-item tokens for recording interaction - * - * @example - * // Track display - * propositionItem.track(null, MessagingEdgeEventType.DISPLAY, null); - * - * // Track interaction - * propositionItem.track("button_clicked", MessagingEdgeEventType.INTERACT, null); - * - * // Track with tokens - * propositionItem.track("click", MessagingEdgeEventType.INTERACT, ["token1", "token2"]); - */ - - // Implementation - track(interactionOrEventType, eventType, tokens) { - // Handle overloaded method signatures - if (typeof interactionOrEventType === 'number' && eventType === undefined) { - // First overload: track(eventType) - this.trackWithDetails(null, interactionOrEventType, null); - } else if (typeof interactionOrEventType === 'string' || interactionOrEventType === null) { - // Second overload: track(interaction, eventType, tokens) - this.trackWithDetails(interactionOrEventType, eventType, tokens || null); - } - } - - /** - * Internal method that performs the actual tracking - */ - trackWithDetails(interaction, eventType, tokens) { - const nativeIdentifier = this.activityID ?? null; - RCTAEPMessaging.trackPropositionItem(nativeIdentifier, interaction, eventType, tokens); - } -} -//# sourceMappingURL=PropositionItem.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/models/PropositionItem.js.map b/packages/messaging/dist/module/models/PropositionItem.js.map deleted file mode 100644 index 4a2e6219..00000000 --- a/packages/messaging/dist/module/models/PropositionItem.js.map +++ /dev/null @@ -1 +0,0 @@ -{"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":[]} diff --git a/packages/messaging/dist/module/models/ScopeDetails.js b/packages/messaging/dist/module/models/ScopeDetails.js deleted file mode 100644 index d8bd4463..00000000 --- a/packages/messaging/dist/module/models/ScopeDetails.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict"; -//# sourceMappingURL=ScopeDetails.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/models/ScopeDetails.js.map b/packages/messaging/dist/module/models/ScopeDetails.js.map deleted file mode 100644 index 4c449b2f..00000000 --- a/packages/messaging/dist/module/models/ScopeDetails.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":[],"sourceRoot":"../../../src","sources":["models/ScopeDetails.ts"],"mappings":"","ignoreList":[]} diff --git a/packages/messaging/dist/module/models/index.js b/packages/messaging/dist/module/models/index.js deleted file mode 100644 index e0d0447d..00000000 --- a/packages/messaging/dist/module/models/index.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; - -export * from "./ContentCard.js"; -export * from "./InAppMessage.js"; -export * from "./JSONProposition.js"; -export * from "./Message.js"; -export * from "./MessagingDelegate.js"; -export * from "./MessagingEdgeEventType.js"; -export * from "./MessagingProposition.js"; -export * from "./MessagingPropositionItem.js"; -export * from "./PersonalizationSchema.js"; -export * from "./ScopeDetails.js"; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/models/index.js.map b/packages/messaging/dist/module/models/index.js.map deleted file mode 100644 index e50a518a..00000000 --- a/packages/messaging/dist/module/models/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":[],"sourceRoot":"../../../src","sources":["models/index.ts"],"mappings":";;AAAA,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":[]} diff --git a/packages/messaging/dist/module/ui/components/Button/Button.js b/packages/messaging/dist/module/ui/components/Button/Button.js deleted file mode 100644 index 5e1827d5..00000000 --- a/packages/messaging/dist/module/ui/components/Button/Button.js +++ /dev/null @@ -1,49 +0,0 @@ -"use strict"; - -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); } -/* - Copyright 2025 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law - or agreed to in writing, software distributed under the License is - distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF - ANY KIND, either express or implied. See the License for the specific - language governing permissions and limitations under the License. -*/ -import React, { useCallback } from 'react'; -import { Linking, Pressable, Text } from 'react-native'; -import { useTheme } from "../../theme/ThemeProvider.js"; -const Button = ({ - actionUrl, - id, - title, - onPress, - interactId, - textStyle, - style, - ...props -}) => { - const theme = useTheme(); - const handlePress = useCallback(() => { - onPress?.(interactId); - if (actionUrl) { - try { - Linking.openURL(actionUrl); - } catch (error) { - console.warn(`Failed to open URL: ${actionUrl}`, error); - } - } - }, [actionUrl, interactId, onPress]); - return /*#__PURE__*/React.createElement(Pressable, _extends({ - onPress: handlePress, - style: style - }, props), /*#__PURE__*/React.createElement(Text, { - style: [{ - color: theme?.colors?.buttonTextColor - }, textStyle] - }, title)); -}; -export default Button; -//# sourceMappingURL=Button.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/components/Button/Button.js.map b/packages/messaging/dist/module/ui/components/Button/Button.js.map deleted file mode 100644 index 72262aca..00000000 --- a/packages/messaging/dist/module/ui/components/Button/Button.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["React","useCallback","Linking","Pressable","Text","useTheme","Button","actionUrl","id","title","onPress","interactId","textStyle","style","props","theme","handlePress","openURL","error","console","warn","createElement","_extends","color","colors","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,SAEEC,OAAO,EACPC,SAAS,EAETC,IAAI,QAEC,cAAc;AACrB,SAASC,QAAQ,QAAQ,8BAA2B;AAWpD,MAAMC,MAA6B,GAAGA,CAAC;EACrCC,SAAS;EACTC,EAAE;EACFC,KAAK;EACLC,OAAO;EACPC,UAAU;EACVC,SAAS;EACTC,KAAK;EACL,GAAGC;AACL,CAAC,KAAK;EACJ,MAAMC,KAAK,GAAGV,QAAQ,CAAC,CAAC;EACxB,MAAMW,WAAW,GAAGf,WAAW,CAAC,MAAM;IACpCS,OAAO,GAAGC,UAAU,CAAC;IACrB,IAAIJ,SAAS,EAAE;MACb,IAAI;QACFL,OAAO,CAACe,OAAO,CAACV,SAAS,CAAC;MAC5B,CAAC,CAAC,OAAOW,KAAK,EAAE;QACdC,OAAO,CAACC,IAAI,CAAC,uBAAuBb,SAAS,EAAE,EAAEW,KAAK,CAAC;MACzD;IACF;EACF,CAAC,EAAE,CAACX,SAAS,EAAEI,UAAU,EAAED,OAAO,CAAC,CAAC;EAEpC,oBACEV,KAAA,CAAAqB,aAAA,CAAClB,SAAS,EAAAmB,QAAA;IAACZ,OAAO,EAAEM,WAAY;IAACH,KAAK,EAAEA;EAAM,GAAKC,KAAK,gBACtDd,KAAA,CAAAqB,aAAA,CAACjB,IAAI;IAACS,KAAK,EAAE,CAAC;MAAEU,KAAK,EAAER,KAAK,EAAES,MAAM,EAAEC;IAAgB,CAAC,EAAEb,SAAS;EAAE,GACjEH,KACG,CACG,CAAC;AAEhB,CAAC;AAED,eAAeH,MAAM","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/components/Button/Button.spec.js b/packages/messaging/dist/module/ui/components/Button/Button.spec.js deleted file mode 100644 index 49cd5c16..00000000 --- a/packages/messaging/dist/module/ui/components/Button/Button.spec.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict"; -//# sourceMappingURL=Button.spec.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/components/Button/Button.spec.js.map b/packages/messaging/dist/module/ui/components/Button/Button.spec.js.map deleted file mode 100644 index 26a9ce45..00000000 --- a/packages/messaging/dist/module/ui/components/Button/Button.spec.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["ui/components/Button/Button.spec.tsx"],"mappings":"","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/components/CenteredView/CenteredView.js b/packages/messaging/dist/module/ui/components/CenteredView/CenteredView.js deleted file mode 100644 index 005b1cd0..00000000 --- a/packages/messaging/dist/module/ui/components/CenteredView/CenteredView.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; - -import { StyleSheet, View } from "react-native"; -const CenteredView = ({ - children -}) => /*#__PURE__*/React.createElement(View, { - style: styles.container -}, children); -export default CenteredView; -const styles = StyleSheet.create({ - container: { - flex: 1, - justifyContent: "center", - alignItems: "center" - } -}); -//# sourceMappingURL=CenteredView.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/components/CenteredView/CenteredView.js.map b/packages/messaging/dist/module/ui/components/CenteredView/CenteredView.js.map deleted file mode 100644 index 9c35bdef..00000000 --- a/packages/messaging/dist/module/ui/components/CenteredView/CenteredView.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["StyleSheet","View","CenteredView","children","React","createElement","style","styles","container","create","flex","justifyContent","alignItems"],"sourceRoot":"../../../../../src","sources":["ui/components/CenteredView/CenteredView.tsx"],"mappings":";;AACA,SAASA,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAE/C,MAAMC,YAAY,GAAGA,CAAC;EAAEC;AAA4B,CAAC,kBACnDC,KAAA,CAAAC,aAAA,CAACJ,IAAI;EAACK,KAAK,EAAEC,MAAM,CAACC;AAAU,GAAEL,QAAe,CAChD;AAED,eAAeD,YAAY;AAE3B,MAAMK,MAAM,GAAGP,UAAU,CAACS,MAAM,CAAC;EAC/BD,SAAS,EAAE;IACTE,IAAI,EAAE,CAAC;IACPC,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE;EACd;AACF,CAAC,CAAC","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/components/ContentCardContainer/ContentCardContainer.js b/packages/messaging/dist/module/ui/components/ContentCardContainer/ContentCardContainer.js deleted file mode 100644 index 383b94d7..00000000 --- a/packages/messaging/dist/module/ui/components/ContentCardContainer/ContentCardContainer.js +++ /dev/null @@ -1,96 +0,0 @@ -"use strict"; - -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); } -import { ActivityIndicator, FlatList, StyleSheet, useColorScheme } from "react-native"; -import ContentCardContainerProvider from "../../providers/ContentCardContainerProvider.js"; -import { ContentCardView } from "../ContentCardView/ContentCardView.js"; -import { cloneElement, useCallback } from "react"; -import { useContentCardUI, useContentContainer } from "../../hooks/index.js"; -import EmptyState from "./EmptyState.js"; -function ContentCardContainerInner({ - contentContainerStyle, - LoadingComponent = /*#__PURE__*/React.createElement(ActivityIndicator, null), - ErrorComponent = null, - FallbackComponent = null, - EmptyComponent, - settings, - surface, - style, - ...props -}) { - const colorScheme = useColorScheme(); - const { - content, - error, - isLoading - } = useContentCardUI(surface); - const renderItem = useCallback(({ - item - }) => { - return /*#__PURE__*/React.createElement(ContentCardView, { - template: item - }); - }, []); - if (isLoading) { - return LoadingComponent; - } - if (error) { - return ErrorComponent; - } - if (!content) { - return FallbackComponent; - } - if (content.length === 0) { - const emptyProps = settings?.content?.emptyStateSettings; - if (EmptyComponent) { - return /*#__PURE__*/cloneElement(EmptyComponent, { - ...emptyProps - }); - } - return /*#__PURE__*/React.createElement(EmptyState, { - image: emptyProps?.image?.[colorScheme ?? "light"]?.url, - text: settings?.content?.emptyStateSettings?.message?.content || "No Content Available" - }); - } - return /*#__PURE__*/React.createElement(ContentCardContainerProvider, { - settings: settings - }, /*#__PURE__*/React.createElement(FlatList, _extends({}, props, { - data: content, - contentContainerStyle: [styles.contentContainer, contentContainerStyle], - horizontal: settings?.content?.layout?.orientation === "horizontal", - renderItem: renderItem - }))); -} -export function ContentCardContainer({ - LoadingComponent = /*#__PURE__*/React.createElement(ActivityIndicator, null), - ErrorComponent = null, - FallbackComponent = null, - surface, - ...props -}) { - const { - settings, - error, - isLoading - } = useContentContainer(surface); - if (isLoading) { - return LoadingComponent; - } - if (error) { - return ErrorComponent; - } - if (!settings) { - return FallbackComponent; - } - return /*#__PURE__*/React.createElement(ContentCardContainerInner, _extends({ - settings: settings, - surface: surface, - LoadingComponent: LoadingComponent - }, props)); -} -const styles = StyleSheet.create({ - contentContainer: { - flex: 1 - } -}); -//# sourceMappingURL=ContentCardContainer.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/components/ContentCardContainer/ContentCardContainer.js.map b/packages/messaging/dist/module/ui/components/ContentCardContainer/ContentCardContainer.js.map deleted file mode 100644 index 02180e26..00000000 --- a/packages/messaging/dist/module/ui/components/ContentCardContainer/ContentCardContainer.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["ActivityIndicator","FlatList","StyleSheet","useColorScheme","ContentCardContainerProvider","ContentCardView","cloneElement","useCallback","useContentCardUI","useContentContainer","EmptyState","ContentCardContainerInner","contentContainerStyle","LoadingComponent","React","createElement","ErrorComponent","FallbackComponent","EmptyComponent","settings","surface","style","props","colorScheme","content","error","isLoading","renderItem","item","template","length","emptyProps","emptyStateSettings","image","url","text","message","_extends","data","styles","contentContainer","horizontal","layout","orientation","ContentCardContainer","create","flex"],"sourceRoot":"../../../../../src","sources":["ui/components/ContentCardContainer/ContentCardContainer.tsx"],"mappings":";;;AAAA,SACEA,iBAAiB,EACjBC,QAAQ,EAGRC,UAAU,EACVC,cAAc,QACT,cAAc;AACrB,OAAOC,4BAA4B,MAE5B,iDAA8C;AACrD,SAASC,eAAe,QAAQ,uCAAoC;AAEpE,SAASC,YAAY,EAAgBC,WAAW,QAAQ,OAAO;AAC/D,SAASC,gBAAgB,EAAEC,mBAAmB,QAAQ,sBAAa;AACnE,OAAOC,UAAU,MAAM,iBAAc;AAUrC,SAASC,yBAAyBA,CAAI;EACpCC,qBAAqB;EACrBC,gBAAgB,gBAAGC,KAAA,CAAAC,aAAA,CAACf,iBAAiB,MAAE,CAAC;EACxCgB,cAAc,GAAG,IAAI;EACrBC,iBAAiB,GAAG,IAAI;EACxBC,cAAc;EACdC,QAAQ;EACRC,OAAO;EACPC,KAAK;EACL,GAAGC;AAGL,CAAC,EAAE;EACD,MAAMC,WAAW,GAAGpB,cAAc,CAAC,CAAC;EACpC,MAAM;IAAEqB,OAAO;IAAEC,KAA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B,CAAC;AAEnC;AAEA,OAAO,SAASiB,oBAAoBA,CAAI;EACtC/B,gBAAgB,gBAAGC,KAAA,CAAAC,aAAA,CAACf,iBAAiB,MAAE,CAAC;EACxCgB,cAAc,GAAG,IAAI;EACrBC,iBAAiB,GAAG,IAAI;EACxBG,OAAO;EACP,GAAGE;AACyB,CAAC,EAAsB;EACnD,MAAM;IAAEH,QAAQ;IAAEM,KAAK;IAAEC;EAAU,CAAC,GAAGjB,mBAAmB,CAACW,OAAO,CAAC;EAEnE,IAAIM,SAAS,EAAE;IACb,OAAOb,gBAAgB;EACzB;EAEA,IAAIY,KAAK,EAAE;IACT,OAAOT,cAAc;EACvB;EAEA,IAAI,CAACG,QAAQ,EAAE;IACb,OAAOF,iBAAiB;EAC1B;EAEA,oBACEH,KAAA,CAAAC,aAAA,CAACJ,yBAAyB,EAAA0B,QAAA;IACxBlB,QAAQ,EAAEA,QAAS;IACnBC,OAAO,EAAEA,OAAQ;IACjBP,gBAAgB,EAAEA;EAAiB,GAC/BS,KAAK,CACV,CAAC;AAEN;AAEA,MAAMiB,MAAM,GAAGrC,UAAU,CAAC2C,MAAM,CAAC;EAC/BL,gBAAgB,EAAE;IAChBM,IAAI,EAAE;EACR;AACF,CAAC,CAAC","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/components/ContentCardContainer/EmptyState.js b/packages/messaging/dist/module/ui/components/ContentCardContainer/EmptyState.js deleted file mode 100644 index 91a147a0..00000000 --- a/packages/messaging/dist/module/ui/components/ContentCardContainer/EmptyState.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; - -import { Image, Text } from "react-native"; -import CenteredView from "../CenteredView/CenteredView.js"; -const EmptyState = ({ - image, - text -}) => { - return /*#__PURE__*/React.createElement(CenteredView, null, /*#__PURE__*/React.createElement(Image, { - source: { - uri: image - } - }), /*#__PURE__*/React.createElement(Text, null, text)); -}; -export default EmptyState; -//# sourceMappingURL=EmptyState.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/components/ContentCardContainer/EmptyState.js.map b/packages/messaging/dist/module/ui/components/ContentCardContainer/EmptyState.js.map deleted file mode 100644 index 15128da6..00000000 --- a/packages/messaging/dist/module/ui/components/ContentCardContainer/EmptyState.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["Image","Text","CenteredView","EmptyState","image","text","React","createElement","source","uri"],"sourceRoot":"../../../../../src","sources":["ui/components/ContentCardContainer/EmptyState.tsx"],"mappings":";;AAAA,SAASA,KAAK,EAAEC,IAAI,QAAQ,cAAc;AAC1C,OAAOC,YAAY,MAAM,iCAA8B;AAOvD,MAAMC,UAAqC,GAAGA,CAAC;EAAEC,KAAK;EAAEC;AAAK,CAAC,KAAK;EACjE,oBACEC,KAAA,CAAAC,aAAA,CAACL,YAAY,qBACXI,KAAA,CAAAC,aAAA,CAACP,KAAK;IAACQ,MAAM,EAAE;MAAEC,GAAG,EAAEL;IAAM;EAAE,CAAE,CAAC,eACjCE,KAAA,CAAAC,aAAA,CAACN,IAAI,QAAEI,IAAW,CACN,CAAC;AAEnB,CAAC;AAED,eAAeF,UAAU","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/components/ContentCardView/ContentCardView.js b/packages/messaging/dist/module/ui/components/ContentCardView/ContentCardView.js deleted file mode 100644 index f7e61293..00000000 --- a/packages/messaging/dist/module/ui/components/ContentCardView/ContentCardView.js +++ /dev/null @@ -1,275 +0,0 @@ -"use strict"; - -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); } -/* - Copyright 2025 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law - or agreed to in writing, software distributed under the License is - distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF - ANY KIND, either express or implied. See the License for the specific - language governing permissions and limitations under the License. -*/ - -import React, { useEffect, useCallback, useState, useRef, useMemo } from 'react'; -import { Image, Linking, Pressable, StyleSheet, Text, useColorScheme, View } from 'react-native'; -import MessagingEdgeEventType from "../../../models/MessagingEdgeEventType.js"; -import DismissButton from "../DismissButton/DismissButton.js"; -import UnreadIcon from "../UnreadIcon/UnreadIcon.js"; -import { useTheme } from "../../theme/index.js"; -import useAspectRatio from "../../hooks/useAspectRatio.js"; -import Button from "../Button/Button.js"; -import { useContext } from 'react'; -import { ContentCardContainerContext } from "../../providers/ContentCardContainerProvider.js"; -export const ContentCardView = ({ - template, - listener, - variant, - styleOverrides: _styleOverrides, - style, - ContainerProps, - ImageContainerProps, - ImageProps, - ContentContainerProps, - TextProps, - TitleProps, - BodyProps, - ButtonContainerProps, - ButtonProps, - DismissButtonProps, - isRead: isReadProp, - ...props -}) => { - const colorScheme = useColorScheme(); - const [isVisible, setIsVisible] = useState(true); - const [internalIsRead, setInternalIsRead] = useState(false); - const isDisplayedRef = useRef(false); - const theme = useTheme(); - const containerSettings = useContext(ContentCardContainerContext); - - // Support both controlled and uncontrolled modes - const isRead = isReadProp !== undefined ? isReadProp : internalIsRead; - - // Get unread background color based on theme - const unreadBackgroundColor = useMemo(() => { - if (!containerSettings?.content?.isUnreadEnabled || isRead || !containerSettings.content.unread_indicator?.unread_bg) { - return undefined; - } - const unreadBg = containerSettings.content.unread_indicator.unread_bg; - return colorScheme === 'dark' ? unreadBg.clr.dark : unreadBg.clr.light; - }, [containerSettings, isRead, colorScheme]); - const cardVariant = useMemo(() => variant ?? template.type ?? 'SmallImage', [variant, template.type]); - const onDismiss = useCallback(() => { - listener?.('onDismiss', template); - - // Track dismiss event using propositionItem - template.track?.(MessagingEdgeEventType.DISMISS); - setIsVisible(false); - }, [listener, template]); - const onPress = useCallback(() => { - listener?.('onInteract', template); - - // Track interaction event using propositionItem - template.track?.('content_clicked', MessagingEdgeEventType.INTERACT, null); - - // Mark as read (only if uncontrolled mode) - if (isReadProp === undefined) { - setInternalIsRead(true); - } - if (template.data?.content?.actionUrl) { - try { - Linking.openURL(template.data.content.actionUrl); - } catch (error) { - console.warn(`Failed to open URL: ${template.data.content.actionUrl}`, error); - } - } - }, [template, listener, isReadProp]); - const imageUri = useMemo(() => { - if (colorScheme === 'dark' && template.data?.content?.image?.darkUrl) { - return template.data.content.image.darkUrl; - } - return template.data.content.image?.url; - }, [colorScheme, template.data?.content?.image?.darkUrl, template.data?.content?.image?.url]); - const imageAspectRatio = useAspectRatio(imageUri); - const styleOverrides = useMemo(() => { - switch (cardVariant) { - case 'SmallImage': - return _styleOverrides?.smallImageStyle; - case 'LargeImage': - return _styleOverrides?.largeImageStyle; - case 'ImageOnly': - return _styleOverrides?.imageOnlyStyle; - default: - return null; - } - }, [_styleOverrides, cardVariant]); - - // Call listener on mount to signal view display (only once to prevent duplicates) - useEffect(() => { - if (!isDisplayedRef.current) { - listener?.('onDisplay', template); - // Track display event using propositionItem - template.track?.(MessagingEdgeEventType.DISPLAY); - isDisplayedRef.current = true; - } - }, [listener, template]); - - // If not visible, return null to hide the entire view - if (!isVisible) { - return null; - } - if (!template.data) return null; - const content = template?.data?.content; - if (!content) return null; - return /*#__PURE__*/React.createElement(Pressable, _extends({ - onPress: onPress, - style: state => [styles.card, styleOverrides?.card, typeof style === 'function' ? style(state) : style] - }, props), /*#__PURE__*/React.createElement(View, _extends({ - style: [cardVariant === 'SmallImage' ? smallImageStyles.container : styles.container, styleOverrides?.container, unreadBackgroundColor && { - backgroundColor: unreadBackgroundColor - }] - }, ContainerProps), imageUri && /*#__PURE__*/React.createElement(View, _extends({ - style: [cardVariant === 'SmallImage' ? smallImageStyles.imageContainer : styles.imageContainer, styleOverrides?.imageContainer] - }, ImageContainerProps), /*#__PURE__*/React.createElement(Image, _extends({ - source: { - uri: imageUri - }, - style: [cardVariant === 'SmallImage' ? smallImageStyles.image : styles.image, { - aspectRatio: imageAspectRatio - }, styleOverrides?.image], - resizeMode: "contain" - }, ImageProps))), cardVariant !== 'ImageOnly' && /*#__PURE__*/React.createElement(View, _extends({ - style: [styles.contentContainer, styleOverrides?.contentContainer] - }, ContentContainerProps), content?.title?.content && /*#__PURE__*/React.createElement(Text, _extends({ - style: [styles.title, { - color: theme.colors.textPrimary - }, styleOverrides?.text, styleOverrides?.title] - }, TextProps, TitleProps), content.title.content), content?.body?.content && /*#__PURE__*/React.createElement(Text, _extends({ - style: [styles.body, { - color: theme.colors.textPrimary - }, styleOverrides?.text, styleOverrides?.body] - }, TextProps, BodyProps), content.body.content), /*#__PURE__*/React.createElement(View, _extends({ - style: [styles.buttonContainer, styleOverrides?.buttonContainer] - }, ButtonContainerProps), content?.buttons?.length && content?.buttons?.length > 0 && content.buttons.map(button => /*#__PURE__*/React.createElement(Button, _extends({ - key: button.id, - actionUrl: button.actionUrl, - title: button.text.content, - onPress: onPress, - style: styleOverrides?.button, - textStyle: [styleOverrides?.text, styleOverrides?.buttonText] - }, ButtonProps))))), content?.dismissBtn && content.dismissBtn?.style !== 'none' && /*#__PURE__*/React.createElement(DismissButton, _extends({ - onPress: onDismiss, - type: content.dismissBtn.style - }, DismissButtonProps)), containerSettings?.content?.isUnreadEnabled && !isRead && /*#__PURE__*/React.createElement(UnreadIcon, null))); -}; -const styles = StyleSheet.create({ - card: { - margin: 15, - flex: 1 - }, - container: { - flexDirection: 'column' - }, - imageContainer: { - alignItems: 'center', - borderRadius: 12, - backgroundColor: '#f0f0f0' - }, - image: { - width: '100%', - resizeMode: 'contain' - }, - contentContainer: { - flex: 1, - paddingVertical: 16, - paddingHorizontal: 16, - justifyContent: 'flex-start' - }, - textContent: { - flex: 1, - justifyContent: 'flex-start', - marginBottom: 16 - }, - title: { - fontSize: 16, - fontWeight: '600', - marginBottom: 8, - marginRight: 16 - }, - body: { - fontSize: 14, - lineHeight: 18 - }, - buttonContainer: { - flexDirection: 'row', - justifyContent: 'flex-start', - flexWrap: 'wrap', - paddingTop: 8, - gap: 8 - }, - button: { - marginHorizontal: 8 - } -}); -const smallImageStyles = StyleSheet.create({ - card: { - borderRadius: 12, - flexDirection: 'row', - gap: 8, - maxWidth: '100%', - alignItems: 'center' - }, - container: { - flexDirection: 'row' - }, - imageContainer: { - borderRadius: 12, - maxWidth: '35%', - alignSelf: 'center' - }, - image: { - resizeMode: 'contain', - width: '100%', - maxWidth: '100%' - } -}); - -// const largeImageStyles = StyleSheet.create({ -// card: { -// ...styles.card, -// borderRadius: 12, -// gap: 8 -// }, -// container: { -// flexDirection: 'row' -// }, -// imageContainer: { -// alignItems: 'center', -// borderRadius: 12, -// backgroundColor: '#f0f0f0' -// }, -// image: { -// width: '100%', -// resizeMode: 'contain' -// }, -// contentContainer: styles.contentContainer, -// textContent: styles.textContent, -// title: styles.title, -// body: styles.body, -// buttonContainer: styles.buttonContainer, -// button: styles.button -// }); - -// const imageOnlyStyles = StyleSheet.create({ -// card: styles.card, -// imageContainer: { -// backgroundColor: '#f0f0f0' -// }, -// image: { -// width: '100%', -// resizeMode: 'contain' -// } -// }); -//# sourceMappingURL=ContentCardView.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/components/ContentCardView/ContentCardView.js.map b/packages/messaging/dist/module/ui/components/ContentCardView/ContentCardView.js.map deleted file mode 100644 index 9fb1d0c5..00000000 --- a/packages/messaging/dist/module/ui/components/ContentCardView/ContentCardView.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["React","useEffect","useCallback","useState","useRef","useMemo","Image","Linking","Pressable","StyleSheet","Text","useColorScheme","View","MessagingEdgeEventType","DismissButton","useTheme","useAspectRatio","Button","ContentCardView","template","listener","variant","styleOverrides","_styleOverrides","style","ContainerProps","ImageContainerProps","ImageProps","ContentContainerProps","TextProps","TitleProps","BodyProps","ButtonContainerProps","ButtonProps","DismissButtonProps","props","colorScheme","isVisible","setIsVisible","isDisplayedRef","theme","cardVariant","type","onDismiss","track","DISMISS","onPress","INTERACT","data","content","actionUrl","openURL","error","console","warn","imageUri","image","darkUrl","url","imageAspectRatio","smallImageStyle","largeImageStyle","imageOnlyStyle","current","DISPLAY","createElement","_extends","state","styles","card","smallImageStyles","container","imageContainer","source","uri","aspectRatio","resizeMode","contentContainer","title","color","colors","textPrimary","text","body","buttonContainer","buttons","length","map","button","key","id","textStyle","buttonText","dismissBtn","create","margin","flex","flexDirection","alignItems","borderRadius","backgroundColor","width","paddingVertical","paddingHorizontal","justifyContent","textContent","marginBottom","fontSize","fontWeight","marginRight","lineHeight","flexWrap","paddingTop","gap","marginHorizontal","maxWidth","alignSelf"],"sourceRoot":"../../../../../src","sources":["ui/components/ContentCardView/ContentCardView.tsx"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,IACVC,SAAS,EACTC,WAAW,EACXC,QAAQ,EACRC,MAAM,EACNC,OAAO,QACF,OAAO;AASd,SACEC,KAAK,EACLC,OAAO,EACPC,SAAS,EAETC,UAAU,EACVC,IAAI,EACJC,cAAc,EACdC,IAAI,QACC,cAAc;AACrB,OAAOC,sBAAsB,MAAM,2CAAwC;AAC3E,OAAOC,aAAa,MAAM,mCAAgC;AAC1D,SAASC,QAAQ,QAAQ,sBAAa;AACtC,OAAOC,cAAc,MAAM,+BAA4B;AAEvD,OAAOC,MAAM,MAAM,qBAAkB;AAqBrC,OAAO,MAAMC,eAA2C,GAAGA,CAAC;EAC1DC,QAAQ;EACRC,QAAQ;EACRC,OAAO;EACPC,cAAc,EAAEC,eAAe;EAC/BC,KAAK;EACLC,cAAc;EACdC,mBAAmB;EACnBC,UAAU;EACVC,qBAAqB;EACrBC,SAAS;EACTC,UAAU;EACVC,SAAS;EACTC,oBAAoB;EACpBC,WAAW;EACXC,kBAAkB;EAClB,GAAGC;AACL,CAAC,KAAK;EACJ,MAAMC,WAAW,GAAGzB,cAAc,CAAC,CAAC;EACpC,MAAM,CAAC0B,SAAS,EAAEC,YAAY,CAAC,GAAGnC,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Ae,EAAE;IACfa,aAAa,EAAE,KAAK;IACpBO,cAAc,EAAE,YAAY;IAC5BO,QAAQ,EAAE,MAAM;IAChBC,UAAU,EAAE,CAAC;IACbC,GAAG,EAAE;EACP,CAAC;EACDzB,MAAM,EAAE;IACN0B,gBAAgB,EAAE;EACpB;AACF,CAAC,CAAC;AAEF,MAAM5C,gBAAgB,GAAG7D,UAAU,CAACqF,MAAM,CAAC;EACzCzB,IAAI,EAAE;IACJ8B,YAAY,EAAE,EAAE;IAChBF,aAAa,EAAE,KAAK;IACpBgB,GAAG,EAAE,CAAC;IACNE,QAAQ,EAAE,MAAM;IAChBjB,UAAU,EAAE;EACd,CAAC;EACD3B,SAAS,EAAE;IACT0B,aAAa,EAAE;EACjB,CAAC;EACDzB,cAAc,EAAE;IACd2B,YAAY,EAAE,EAAE;IAChBgB,QAAQ,EAAE,KAAK;IACfC,SAAS,EAAE;EACb,CAAC;EACD5D,KAAK,EAAE;IACLoB,UAAU,EAAE,SAAS;IACrByB,KAAK,EAAE,MAAM;IACbc,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/components/DismissButton/DismissButton.js b/packages/messaging/dist/module/ui/components/DismissButton/DismissButton.js deleted file mode 100644 index 213c49e0..00000000 --- a/packages/messaging/dist/module/ui/components/DismissButton/DismissButton.js +++ /dev/null @@ -1,64 +0,0 @@ -"use strict"; - -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); } -/* - Copyright 2025 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law - or agreed to in writing, software distributed under the License is - distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF - ANY KIND, either express or implied. See the License for the specific - language governing permissions and limitations under the License. -*/ -import { Pressable, StyleSheet, Text, useColorScheme } from 'react-native'; -const DismissButton = ({ - onPress, - type, - textStyle, - style, - ...props -}) => { - const colorScheme = useColorScheme(); - return /*#__PURE__*/React.createElement(Pressable, _extends({ - onPress: onPress, - style: state => [styles.container, type === 'simple' && styles.simple, type === 'circle' && [styles.circle, { - backgroundColor: colorScheme === 'dark' ? 'rgba(255,255,255,0.1)' : 'rgba(0,0,0,0.1)' - }], state.pressed && styles.pressed, typeof style === 'function' ? style(state) : style] - }, props), /*#__PURE__*/React.createElement(Text, { - style: [styles.text, { - color: colorScheme === 'dark' ? 'white' : 'black' - }, textStyle] - }, "x")); -}; -export default DismissButton; -const styles = StyleSheet.create({ - container: { - position: 'absolute', - top: 6, - right: 6, - zIndex: 1000, - justifyContent: 'center', - alignItems: 'center', - minWidth: 18, - minHeight: 18 - }, - pressed: { - opacity: 0.7 - }, - simple: { - backgroundColor: 'transparent' - }, - circle: { - borderRadius: 10, - width: 18, - height: 18 - }, - text: { - fontSize: 14, - fontWeight: 'bold', - textAlign: 'center' - } -}); -//# sourceMappingURL=DismissButton.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/components/DismissButton/DismissButton.js.map b/packages/messaging/dist/module/ui/components/DismissButton/DismissButton.js.map deleted file mode 100644 index c9ad4493..00000000 --- a/packages/messaging/dist/module/ui/components/DismissButton/DismissButton.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["Pressable","StyleSheet","Text","useColorScheme","DismissButton","onPress","type","textStyle","style","props","colorScheme","React","createElement","_extends","state","styles","container","simple","circle","backgroundColor","pressed","text","color","create","position","top","right","zIndex","justifyContent","alignItems","minWidth","minHeight","opacity","borderRadius","width","height","fontSize","fontWeight","textAlign"],"sourceRoot":"../../../../../src","sources":["ui/components/DismissButton/DismissButton.tsx"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SACEA,SAAS,EAETC,UAAU,EACVC,IAAI,EAEJC,cAAc,QACT,cAAc;AAQrB,MAAMC,aAAa,GAAGA,CAAC;EACrBC,OAAO;EACPC,IAAI;EACJC,SAAS;EACTC,KAAK;EACL,GAAGC;AACe,CAAC,KAAK;EACxB,MAAMC,WAAW,GAAGP,cAAc,CAAC,CAAC;EAEpC,oBACEQ,KAAA,CAAAC,aAAA,CAACZ,SAAS,EAAAa,QAAA;IACRR,OAAO,EAAEA,OAAQ;IACjBG,KAAK,EAAGM,KAAK,IAAK,CAChBC,MAAM,CAACC,SAAS,EAChBV,IAAI,KAAK,QAAQ,IAAIS,MAAM,CAACE,MAAM,EAClCX,IAAI,KAAK,QAAQ,IAAI,CACnBS,MAAM,CAACG,MAAM,EACb;MACEC,eAAe,EACbT,WAAW,KAAK,MAAM,GAClB,uBAAuB,GACvB;IACR,CAAC,CACF,EACDI,KAAK,CAACM,OAAO,IAAIL,MAAM,CAACK,OAAO,EAC/B,OAAOZ,KAAK,KAAK,UAAU,GAAGA,KAAK,CAACM,KAAK,CAAC,GAAGN,KAAK;EAClD,GACEC,KAAK,gBAETE,KAAA,CAAAC,aAAA,CAACV,IAAI;IACHM,KAAK,EAAE,CACLO,MAAM,CAACM,IAAI,EACX;MAAEC,KAAK,EAAEZ,WAAW,KAAK,MAAM,GAAG,OAAO,GAAG;IAAQ,CAAC,EACrDH,SAAS;EACT,GACH,GAEK,CACG,CAAC;AAEhB,CAAC;AAED,eAAeH,aAAa;AAE5B,MAAMW,MAAM,GAAGd,UAAU,CAACsB,MAAM,CAAC;EAC/BP,SAAS,EAAE;IACTQ,QAAQ,EAAE,UAAU;IACpBC,GAAG,EAAE,CAAC;IACNC,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE,IAAI;IACZC,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE,QAAQ;IACpBC,QAAQ,EAAE,EAAE;IACZC,SAAS,EAAE;EACb,CAAC;EACDX,OAAO,EAAE;IACPY,OAAO,EAAE;EACX,CAAC;EACDf,MAAM,EAAE;IACNE,eAAe,EAAE;EACnB,CAAC;EACDD,MAAM,EAAE;IACNe,YAAY,EAAE,EAAE;IAChBC,KAAK,EAAE,EAAE;IACTC,MAAM,EAAE;EACV,CAAC;EACDd,IAAI,EAAE;IACJe,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE,MAAM;IAClBC,SAAS,EAAE;EACb;AACF,CAAC,CAAC","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/components/DismissButton/DismissButton.spec.js b/packages/messaging/dist/module/ui/components/DismissButton/DismissButton.spec.js deleted file mode 100644 index 1756df37..00000000 --- a/packages/messaging/dist/module/ui/components/DismissButton/DismissButton.spec.js +++ /dev/null @@ -1,294 +0,0 @@ -"use strict"; - -/* - Copyright 2025 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law - or agreed to in writing, software distributed under the License is - distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF - ANY KIND, either express or implied. See the License for the specific - language governing permissions and limitations under the License. -*/ -import React from 'react'; -import { render, screen, fireEvent } from '@testing-library/react-native'; -import { useColorScheme } from 'react-native'; -import DismissButton from "./DismissButton.js"; - -// Mock useColorScheme -jest.mock('react-native', () => { - const RN = jest.requireActual('react-native'); - return { - ...RN, - useColorScheme: jest.fn() - }; -}); -const mockUseColorScheme = useColorScheme; -describe('DismissButton', () => { - const mockOnPress = jest.fn(); - beforeEach(() => { - jest.clearAllMocks(); - mockUseColorScheme.mockReturnValue('light'); - }); - describe('Basic rendering', () => { - it('should render a dismiss button with type "simple"', () => { - render(/*#__PURE__*/React.createElement(DismissButton, { - onPress: mockOnPress, - type: "simple" - })); - const button = screen.getByText('x'); - expect(button).toBeTruthy(); - }); - it('should render a dismiss button with type "circle"', () => { - render(/*#__PURE__*/React.createElement(DismissButton, { - onPress: mockOnPress, - type: "circle" - })); - const button = screen.getByText('x'); - expect(button).toBeTruthy(); - }); - it('should display "x" as the button text', () => { - render(/*#__PURE__*/React.createElement(DismissButton, { - onPress: mockOnPress, - type: "simple" - })); - expect(screen.getByText('x')).toBeTruthy(); - }); - }); - describe('Press handling', () => { - it('should call onPress when the button is pressed', () => { - render(/*#__PURE__*/React.createElement(DismissButton, { - onPress: mockOnPress, - type: "simple" - })); - const button = screen.getByText('x'); - fireEvent.press(button); - expect(mockOnPress).toHaveBeenCalledTimes(1); - }); - it('should call onPress multiple times when pressed multiple times', () => { - render(/*#__PURE__*/React.createElement(DismissButton, { - onPress: mockOnPress, - type: "circle" - })); - const button = screen.getByText('x'); - fireEvent.press(button); - fireEvent.press(button); - fireEvent.press(button); - expect(mockOnPress).toHaveBeenCalledTimes(3); - }); - }); - describe('Color scheme handling', () => { - it('should apply light color scheme styles', () => { - mockUseColorScheme.mockReturnValue('light'); - render(/*#__PURE__*/React.createElement(DismissButton, { - onPress: mockOnPress, - type: "simple" - })); - const text = screen.getByText('x'); - expect(text.props.style).toEqual(expect.arrayContaining([expect.objectContaining({ - color: 'black' - })])); - }); - it('should apply dark color scheme styles', () => { - mockUseColorScheme.mockReturnValue('dark'); - render(/*#__PURE__*/React.createElement(DismissButton, { - onPress: mockOnPress, - type: "simple" - })); - const text = screen.getByText('x'); - expect(text.props.style).toEqual(expect.arrayContaining([expect.objectContaining({ - color: 'white' - })])); - }); - it('should apply correct background color for circle type in light mode', () => { - mockUseColorScheme.mockReturnValue('light'); - const { - getByTestId - } = render(/*#__PURE__*/React.createElement(DismissButton, { - onPress: mockOnPress, - type: "circle", - testID: "dismiss-button" - })); - const button = getByTestId('dismiss-button'); - expect(button.props.style).toEqual(expect.arrayContaining([expect.objectContaining({ - backgroundColor: 'rgba(0,0,0,0.1)' - })])); - }); - it('should apply correct background color for circle type in dark mode', () => { - mockUseColorScheme.mockReturnValue('dark'); - const { - getByTestId - } = render(/*#__PURE__*/React.createElement(DismissButton, { - onPress: mockOnPress, - type: "circle", - testID: "dismiss-button" - })); - const button = getByTestId('dismiss-button'); - expect(button.props.style).toEqual(expect.arrayContaining([expect.objectContaining({ - backgroundColor: 'rgba(255,255,255,0.1)' - })])); - }); - }); - describe('Type variations', () => { - it('should apply simple type styles', () => { - const { - getByTestId - } = render(/*#__PURE__*/React.createElement(DismissButton, { - onPress: mockOnPress, - type: "simple", - testID: "dismiss-button" - })); - const button = getByTestId('dismiss-button'); - expect(button.props.style).toEqual(expect.arrayContaining([expect.objectContaining({ - backgroundColor: 'transparent' - })])); - }); - it('should apply circle type styles', () => { - const { - getByTestId - } = render(/*#__PURE__*/React.createElement(DismissButton, { - onPress: mockOnPress, - type: "circle", - testID: "dismiss-button" - })); - const button = getByTestId('dismiss-button'); - expect(button.props.style).toEqual(expect.arrayContaining([expect.objectContaining({ - borderRadius: 10, - width: 18, - height: 18 - })])); - }); - }); - describe('Custom props and styles', () => { - it('should accept and apply custom style props', () => { - const customStyle = { - opacity: 0.5 - }; - const { - getByTestId - } = render(/*#__PURE__*/React.createElement(DismissButton, { - onPress: mockOnPress, - type: "simple", - style: customStyle, - testID: "dismiss-button" - })); - const button = getByTestId('dismiss-button'); - expect(button.props.style).toEqual(expect.arrayContaining([expect.objectContaining({ - opacity: 0.5 - })])); - }); - it('should accept function-based style props', () => { - const styleFn = jest.fn().mockReturnValue({ - opacity: 0.8 - }); - const { - getByTestId - } = render(/*#__PURE__*/React.createElement(DismissButton, { - onPress: mockOnPress, - type: "simple", - style: styleFn, - testID: "dismiss-button" - })); - expect(styleFn).toHaveBeenCalled(); - const button = getByTestId('dismiss-button'); - expect(button.props.style).toEqual(expect.arrayContaining([expect.objectContaining({ - opacity: 0.8 - })])); - }); - it('should accept additional Pressable props', () => { - const { - getByTestId - } = render(/*#__PURE__*/React.createElement(DismissButton, { - onPress: mockOnPress, - type: "simple", - testID: "dismiss-button", - disabled: true, - accessibilityLabel: "Close button" - })); - const button = getByTestId('dismiss-button'); - expect(button.props.disabled).toBe(true); - expect(button.props.accessibilityLabel).toBe('Close button'); - }); - }); - describe('Accessibility', () => { - it('should be accessible by default', () => { - const { - getByTestId - } = render(/*#__PURE__*/React.createElement(DismissButton, { - onPress: mockOnPress, - type: "simple", - testID: "dismiss-button" - })); - const button = getByTestId('dismiss-button'); - expect(button).toBeTruthy(); - }); - it('should accept custom accessibility props', () => { - const { - getByTestId - } = render(/*#__PURE__*/React.createElement(DismissButton, { - onPress: mockOnPress, - type: "simple", - testID: "dismiss-button", - accessibilityLabel: "Dismiss notification", - accessibilityHint: "Double tap to close this notification" - })); - const button = getByTestId('dismiss-button'); - expect(button.props.accessibilityLabel).toBe('Dismiss notification'); - expect(button.props.accessibilityHint).toBe('Double tap to close this notification'); - }); - }); - describe('Positioning and layout', () => { - it('should have absolute positioning styles', () => { - const { - getByTestId - } = render(/*#__PURE__*/React.createElement(DismissButton, { - onPress: mockOnPress, - type: "simple", - testID: "dismiss-button" - })); - const button = getByTestId('dismiss-button'); - expect(button.props.style).toEqual(expect.arrayContaining([expect.objectContaining({ - position: 'absolute', - top: 6, - right: 6, - zIndex: 1000 - })])); - }); - it('should have minimum dimensions', () => { - const { - getByTestId - } = render(/*#__PURE__*/React.createElement(DismissButton, { - onPress: mockOnPress, - type: "simple", - testID: "dismiss-button" - })); - const button = getByTestId('dismiss-button'); - expect(button.props.style).toEqual(expect.arrayContaining([expect.objectContaining({ - minWidth: 18, - minHeight: 18 - })])); - }); - }); - describe('Edge cases', () => { - it('should handle undefined color scheme gracefully', () => { - mockUseColorScheme.mockReturnValue(undefined); - expect(() => { - render(/*#__PURE__*/React.createElement(DismissButton, { - onPress: mockOnPress, - type: "simple" - })); - }).not.toThrow(); - }); - it('should handle null color scheme gracefully', () => { - mockUseColorScheme.mockReturnValue(null); - expect(() => { - render(/*#__PURE__*/React.createElement(DismissButton, { - onPress: mockOnPress, - type: "simple" - })); - }).not.toThrow(); - }); - }); -}); -//# sourceMappingURL=DismissButton.spec.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/components/DismissButton/DismissButton.spec.js.map b/packages/messaging/dist/module/ui/components/DismissButton/DismissButton.spec.js.map deleted file mode 100644 index 2092f3f6..00000000 --- a/packages/messaging/dist/module/ui/components/DismissButton/DismissButton.spec.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["React","render","screen","fireEvent","useColorScheme","DismissButton","jest","mock","RN","requireActual","fn","mockUseColorScheme","describe","mockOnPress","beforeEach","clearAllMocks","mockReturnValue","it","createElement","onPress","type","button","getByText","expect","toBeTruthy","press","toHaveBeenCalledTimes","text","props","style","toEqual","arrayContaining","objectContaining","color","getByTestId","testID","backgroundColor","borderRadius","width","height","customStyle","opacity","styleFn","toHaveBeenCalled","disabled","accessibilityLabel","toBe","accessibilityHint","position","top","right","zIndex","minWidth","minHeight","undefined","not","toThrow"],"sourceRoot":"../../../../../src","sources":["ui/components/DismissButton/DismissButton.spec.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,MAAM,EAAEC,MAAM,EAAEC,SAAS,QAAQ,+BAA+B;AACzE,SAASC,cAAc,QAAQ,cAAc;AAC7C,OAAOC,aAAa,MAAM,oBAAiB;;AAE3C;AACAC,IAAI,CAACC,IAAI,CAAC,cAAc,EAAE,MAAM;EAC9B,MAAMC,EAAE,GAAGF,IAAI,CAACG,aAAa,CAAC,cAAc,CAAC;EAC7C,OAAO;IACL,GAAGD,EAAE;IACLJ,cAAc,EAAEE,IAAI,CAACI,EAAE,CAAC;EAC1B,CAAC;AACH,CAAC,CAAC;AAEF,MAAMC,kBAAk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CAAC,GAAGjC,MAAM,cAC5BD,KAAA,CAAAkB,aAAA,CAACb,aAAa;QACZc,OAAO,EAAEN,WAAY;QACrBO,IAAI,EAAC,QAAQ;QACbe,MAAM,EAAC;MAAgB,CACxB,CACH,CAAC;MAED,MAAMd,MAAM,GAAGa,WAAW,CAAC,gBAAgB,CAAC;MAC5CX,MAAM,CAACF,MAAM,CAACO,KAAK,CAACC,KAAK,CAAC,CAACC,OAAO,CAChCP,MAAM,CAACQ,eAAe,CAAC,CACrBR,MAAM,CAACS,gBAAgB,CAAC;QACtBoB,QAAQ,EAAE,EAAE;QACZC,SAAS,EAAE;MACb,CAAC,CAAC,CACH,CACH,CAAC;IACH,CAAC,CAAC;EACJ,CAAC,CAAC;EAEFzC,QAAQ,CAAC,YAAY,EAAE,MAAM;IAC3BK,EAAE,CAAC,iDAAiD,EAAE,MAAM;MAC1DN,kBAAkB,CAACK,eAAe,CAACsC,SAAgB,CAAC;MAEpD/B,MAAM,CAAC,MAAM;QACXtB,MAAM,cAACD,KAAA,CAAAkB,aAAA,CAACb,aAAa;UAACc,OAAO,EAAEN,WAAY;UAACO,IAAI,EAAC;QAAQ,CAAE,CAAC,CAAC;MAC/D,CAAC,CAAC,CAACmC,GAAG,CAACC,OAAO,CAAC,CAAC;IAClB,CAAC,CAAC;IAEFvC,EAAE,CAAC,4CAA4C,EAAE,MAAM;MACrDN,kBAAkB,CAACK,eAAe,CAAC,IAAW,CAAC;MAE/CO,MAAM,CAAC,MAAM;QACXtB,MAAM,cAACD,KAAA,CAAAkB,aAAA,CAACb,aAAa;UAACc,OAAO,EAAEN,WAAY;UAACO,IAAI,EAAC;QAAQ,CAAE,CAAC,CAAC;MAC/D,CAAC,CAAC,CAACmC,GAAG,CAACC,OAAO,CAAC,CAAC;IAClB,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/components/Pagination/Pagination.js b/packages/messaging/dist/module/ui/components/Pagination/Pagination.js deleted file mode 100644 index 6ea955ab..00000000 --- a/packages/messaging/dist/module/ui/components/Pagination/Pagination.js +++ /dev/null @@ -1,152 +0,0 @@ -"use strict"; - -import React, { useEffect, useRef } from "react"; -import { View, StyleSheet, useColorScheme, TouchableOpacity, Animated } from "react-native"; -const PaginationDot = ({ - page, - isActive, - finalInactiveColor, - finalActiveColor, - dotSize, - onPageChange -}) => { - const scaleAnim = useRef(new Animated.Value(isActive ? 1.2 : 1)).current; - const opacityAnim = useRef(new Animated.Value(isActive ? 1 : 0.6)).current; - useEffect(() => { - Animated.parallel([Animated.spring(scaleAnim, { - toValue: isActive ? 1.2 : 1, - useNativeDriver: true, - tension: 100, - friction: 8 - }), Animated.timing(opacityAnim, { - toValue: isActive ? 1 : 0.6, - duration: 200, - useNativeDriver: true - })]).start(); - }, [isActive, scaleAnim, opacityAnim]); - return /*#__PURE__*/React.createElement(TouchableOpacity, { - onPress: () => onPageChange(page), - style: styles.dotContainer, - activeOpacity: 0.7 - }, /*#__PURE__*/React.createElement(Animated.View, { - style: [styles.dot, { - width: dotSize, - height: dotSize, - backgroundColor: isActive ? finalActiveColor : finalInactiveColor, - opacity: opacityAnim, - transform: [{ - scale: scaleAnim - }] - }] - })); -}; -export const Pagination = ({ - currentPage, - totalPages, - onPageChange, - maxVisibleDots = 5, - activeColor, - inactiveColor, - dotSize = 8, - spacing = 8 -}) => { - const colorScheme = useColorScheme(); - const isDark = colorScheme === "dark"; - const slideAnim = useRef(new Animated.Value(0)).current; - const prevVisiblePagesRef = useRef([]); - - // Default colors based on theme - const defaultActiveColor = isDark ? "#fff" : "#0a7ea4"; - const defaultInactiveColor = isDark ? "#9BA1A6" : "#687076"; - const finalActiveColor = activeColor || defaultActiveColor; - const finalInactiveColor = inactiveColor || defaultInactiveColor; - - // Calculate which dots to show - const getVisiblePages = () => { - if (totalPages <= maxVisibleDots) { - return Array.from({ - length: totalPages - }, (_, i) => i); - } - const halfVisible = Math.floor(maxVisibleDots / 2); - let startPage = Math.max(0, currentPage - halfVisible); - let endPage = Math.min(totalPages - 1, startPage + maxVisibleDots - 1); - - // Adjust start if we're near the end - if (endPage === totalPages - 1) { - startPage = Math.max(0, endPage - maxVisibleDots + 1); - } - return Array.from({ - length: endPage - startPage + 1 - }, (_, i) => startPage + i); - }; - const visiblePages = getVisiblePages(); - - // Animate sliding when visible pages change - useEffect(() => { - const prevVisiblePages = prevVisiblePagesRef.current; - if (prevVisiblePages.length > 0 && totalPages > maxVisibleDots) { - const prevStartPage = prevVisiblePages[0]; - const currentStartPage = visiblePages[0]; - if (prevStartPage !== currentStartPage) { - const direction = currentStartPage > prevStartPage ? 1 : -1; - const dotWidth = dotSize + spacing; - - // Start from offset position - slideAnim.setValue(direction * dotWidth); - - // Animate back to center - Animated.timing(slideAnim, { - toValue: 0, - duration: 300, - useNativeDriver: true - }).start(); - } - } - prevVisiblePagesRef.current = visiblePages; - }, [visiblePages, slideAnim, dotSize, spacing, maxVisibleDots, totalPages]); - if (totalPages <= 1) { - return null; - } - return /*#__PURE__*/React.createElement(View, { - style: styles.container - }, /*#__PURE__*/React.createElement(Animated.View, { - style: [styles.dotsContainer, { - gap: spacing, - transform: [{ - translateX: slideAnim - }] - }] - }, visiblePages.map(page => /*#__PURE__*/React.createElement(PaginationDot, { - key: page, - page: page, - isActive: page === currentPage, - finalInactiveColor: finalInactiveColor, - finalActiveColor: finalActiveColor, - dotSize: dotSize, - onPageChange: onPageChange - })))); -}; -const styles = StyleSheet.create({ - container: { - alignItems: "center", - justifyContent: "center", - overflow: "hidden", - backgroundColor: 'blue', - flex: 1 - }, - dotsContainer: { - flexDirection: "row", - alignItems: "center", - justifyContent: "center" - }, - dotContainer: { - alignItems: "center", - justifyContent: "center" - }, - dot: { - borderRadius: 50 - } -}); -export default Pagination; -//# sourceMappingURL=Pagination.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/components/Pagination/Pagination.js.map b/packages/messaging/dist/module/ui/components/Pagination/Pagination.js.map deleted file mode 100644 index bb869a30..00000000 --- a/packages/messaging/dist/module/ui/components/Pagination/Pagination.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["React","useEffect","useRef","View","StyleSheet","useColorScheme","TouchableOpacity","Animated","PaginationDot","page","isActive","finalInactiveColor","finalActiveColor","dotSize","onPageChange","scaleAnim","Value","current","opacityAnim","parallel","spring","toValue","useNativeDriver","tension","friction","timing","duration","start","createElement","onPress","style","styles","dotContainer","activeOpacity","dot","width","height","backgroundColor","opacity","transform","scale","Pagination","currentPage","totalPages","maxVisibleDots","activeColor","inactiveColor","spacing","colorScheme","isDark","slideAnim","prevVisiblePagesRef","defaultActiveColor","defaultInactiveColor","getVisiblePages","Array","from","length","_","i","halfVisible","Math","floor","startPage","max","endPage","min","visiblePages","prevVisiblePages","prevStartPage","currentStartPage","direction","dotWidth","setValue","container","dotsContainer","gap","translateX","map","key","create","alignItems","justifyContent","overflow","flex","flexDirection","borderRadius"],"sourceRoot":"../../../../../src","sources":["ui/components/Pagination/Pagination.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAChD,SACEC,IAAI,EACJC,UAAU,EACVC,cAAc,EACdC,gBAAgB,EAChBC,QAAQ,QACH,cAAc;AAErB,MAAMC,aAAa,GAAGA,CAAC;EACrBC,IAAI;EACJC,QAAQ;EACRC,kBAAkB;EAClBC,gBAAgB;EAChBC,OAAO;EACPC;AAQF,CAAC,KAAK;EACJ,MAAMC,SAAS,GAAGb,MAAM,CAAC,IAAIK,QAAQ,CAACS,KAAK,CAACN,QAAQ,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,CAACO,OAAO;EACxE,MAAMC,WAAW,GAAGhB,MAAM,CAAC,IAAIK,QAAQ,CAACS,KAAK,CAACN,QAAQ,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAACO,OAAO;EAE1EhB,SAAS,CAAC,MAAM;IACdM,QAAQ,CAACY,QAAQ,CAAC,CAChBZ,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AAU,EAAE3B;MAAU,CAAC;IACvC,CAAC;EACD,GAEDiB,YAAY,CAACW,GAAG,CAAErE,IAAI,iBACrBT,KAAA,CAAA4B,aAAA,CAACpB,aAAa;IACZuE,GAAG,EAAEtE,IAAK;IACVA,IAAI,EAAEA,IAAK;IACXC,QAAQ,EAAED,IAAI,KAAKiC,WAAY;IAC/B/B,kBAAkB,EAAEA,kBAAmB;IACvCC,gBAAgB,EAAEA,gBAAiB;IACnCC,OAAO,EAAEA,OAAQ;IACjBC,YAAY,EAAEA;EAAa,CAC5B,CACF,CACY,CACX,CAAC;AAEX,CAAC;AAED,MAAMiB,MAAM,GAAG3B,UAAU,CAAC4E,MAAM,CAAC;EAC/BN,SAAS,EAAE;IACTO,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE,QAAQ;IACxBC,QAAQ,EAAE,QAAQ;IAClB9C,eAAe,EAAE,MAAM;IACvB+C,IAAI,EAAE;EACR,CAAC;EACDT,aAAa,EAAE;IACbU,aAAa,EAAE,KAAK;IACpBJ,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE;EAClB,CAAC;EACDlD,YAAY,EAAE;IACZiD,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE;EAClB,CAAC;EACDhD,GAAG,EAAE;IACHoD,YAAY,EAAE;EAChB;AACF,CAAC,CAAC;AAEF,eAAe7C,UAAU","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.js b/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.js deleted file mode 100644 index f8404aff..00000000 --- a/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.js +++ /dev/null @@ -1,167 +0,0 @@ -"use strict"; - -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); } -/* - Copyright 2025 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law - or agreed to in writing, software distributed under the License is - distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF - ANY KIND, either express or implied. See the License for the specific - language governing permissions and limitations under the License. -*/ -import React, { useState, useMemo } from 'react'; -import { Image, StyleSheet, View, useColorScheme } from 'react-native'; -import useContainerSettings from "../../hooks/useContainerSettings.js"; -const Dot = ({ - size, - backgroundColor -}) => /*#__PURE__*/React.createElement(View, { - style: [styles.dot, { - width: size, - height: size, - borderRadius: size / 2, - backgroundColor - }] -}); -const UnreadIcon = ({ - imageStyle, - containerStyle, - source, - darkSource, - size = 20, - position = 'topright', - type = 'dot', - style, - ...props -}) => { - const colorScheme = useColorScheme(); - const settings = useContainerSettings(); - const [imageLoadError, setImageLoadError] = useState(false); - - // Get unread indicator settings from context - const unreadSettings = settings.content.unread_indicator; - - // Use settings from context with fallbacks to props - const displayPosition = unreadSettings?.unread_icon?.placement ?? position; - const renderType = unreadSettings?.unread_icon?.image ? 'image' : type; - const imageSource = unreadSettings?.unread_icon?.image?.url ? { - uri: unreadSettings.unread_icon.image.url - } : source; - const darkImageSource = unreadSettings?.unread_icon?.image?.darkUrl ? { - uri: unreadSettings.unread_icon.image.darkUrl - } : darkSource; - const getPositionStyle = () => { - switch (displayPosition) { - case 'topleft': - return styles.positionTopLeft; - case 'topright': - return styles.positionTopRight; - case 'bottomleft': - return styles.positionBottomLeft; - case 'bottomright': - return styles.positionBottomRight; - default: - return styles.positionTopRight; - } - }; - - // Use default contrasting colors for visibility - // Note: unread_bg.clr is for the card background, not the dot - const dotColor = useMemo(() => colorScheme === 'dark' ? '#FF6B6B' : '#FF4444', [colorScheme]); - const finalImageSource = useMemo(() => colorScheme === 'dark' && darkImageSource ? darkImageSource : imageSource, [colorScheme, darkImageSource, imageSource]); - const renderContent = () => { - // Check if we should show dot instead of image based on URL availability - const shouldShowDot = colorScheme === 'dark' && unreadSettings?.unread_icon?.image?.darkUrl === '' || colorScheme === 'light' && unreadSettings?.unread_icon?.image?.url === ''; - - // If URL is explicitly empty string for current mode, show dot - if (shouldShowDot && unreadSettings?.unread_icon?.image) { - return /*#__PURE__*/React.createElement(Dot, { - size: size, - backgroundColor: dotColor - }); - } - - // If image failed to load, fallback to dot - if (renderType === 'image' && imageLoadError) { - return /*#__PURE__*/React.createElement(Dot, { - size: size, - backgroundColor: dotColor - }); - } - if (renderType === 'image' && (imageSource || darkImageSource)) { - return /*#__PURE__*/React.createElement(Image, { - source: finalImageSource, - style: [styles.image, { - width: size, - height: size - }, imageStyle], - resizeMode: "contain", - onError: error => { - console.warn('Failed to load unread icon image:', error.nativeEvent.error); - setImageLoadError(true); - } - }); - } - - // Default dot type - return /*#__PURE__*/React.createElement(Dot, { - size: size, - backgroundColor: dotColor - }); - }; - return /*#__PURE__*/React.createElement(View, _extends({ - style: [styles.container, getPositionStyle(), { - minWidth: size, - minHeight: size - }, containerStyle, typeof style === 'object' ? style : undefined] - }, props), renderContent()); -}; -export default UnreadIcon; -const styles = StyleSheet.create({ - container: { - position: 'absolute', - zIndex: 1000, - justifyContent: 'center', - alignItems: 'center' - }, - positionTopLeft: { - top: 6, - left: 6 - }, - positionTopRight: { - top: 6, - right: 6 - }, - positionBottomLeft: { - bottom: 6, - left: 6 - }, - positionBottomRight: { - bottom: 6, - right: 6 - }, - dot: { - shadowColor: '#000', - shadowOffset: { - width: 0, - height: 1 - }, - shadowOpacity: 0.22, - shadowRadius: 2.22, - elevation: 3 - }, - image: { - shadowColor: '#000', - shadowOffset: { - width: 0, - height: 1 - }, - shadowOpacity: 0.22, - shadowRadius: 2.22, - elevation: 3 - } -}); -//# sourceMappingURL=UnreadIcon.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.js.map b/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.js.map deleted file mode 100644 index b99e1ba6..00000000 --- a/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["React","useState","useMemo","Image","StyleSheet","View","useColorScheme","useContainerSettings","Dot","size","backgroundColor","createElement","style","styles","dot","width","height","borderRadius","UnreadIcon","imageStyle","containerStyle","source","darkSource","position","type","props","colorScheme","settings","imageLoadError","setImageLoadError","unreadSettings","content","unread_indicator","displayPosition","unread_icon","placement","renderType","image","imageSource","url","uri","darkImageSource","darkUrl","getPositionStyle","positionTopLeft","positionTopRight","positionBottomLeft","positionBottomRight","dotColor","finalImageSource","renderContent","shouldShowDot","resizeMode","onError","error","console","warn","nativeEvent","_extends","container","minWidth","minHeight","undefined","create","zIndex","justifyContent","alignItems","top","left","right","bottom","shadowColor","shadowOffset","shadowOpacity","shadowRadius","elevation"],"sourceRoot":"../../../../../src","sources":["ui/components/UnreadIcon/UnreadIcon.tsx"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,OAAO,QAAQ,OAAO;AAChD,SACEC,KAAK,EAGLC,UAAU,EACVC,IAAI,EAGJC,cAAc,QACT,cAAc;AACrB,OAAOC,oBAAoB,MAAM,qCAAkC;AAcnE,MAAMC,GAAG,GAAGA,CAAC;EAAEC,IAAI;EAAEC;AAA2D,CAAC,kBAC/EV,KAAA,CAAAW,aAAA,CAACN,IAAI;EACHO,KAAK,EAAE,CACLC,MAAM,CAACC,GAAG,EACV;IACEC,KAAK,EAAEN,IAAI;IACXO,MAAM,EAAEP,IAAI;IACZQ,YAAY,EAAER,IAAI,GAAG,CAAC;IACtBC;EACF,CAAC;AACD,CACH,CACF;AAED,MAAMQ,UAAU,GAAGA,CAAC;EAClBC,UAAU;EACVC,cAAc;EACdC,MAAM;EACNC,UAAU;EACVb,IAAI,GAAG,EAAE;EACTc,QAAQ,GAAG,UAA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ACb,CAAC;EACDtC,KAAK,EAAE;IACLkC,WAAW,EAAE,MAAM;IACnBC,YAAY,EAAE;MACZzD,KAAK,EAAE,CAAC;MACRC,MAAM,EAAE;IACV,CAAC;IACDyD,aAAa,EAAE,IAAI;IACnBC,YAAY,EAAE,IAAI;IAClBC,SAAS,EAAE;EACb;AACF,CAAC,CAAC","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.test.js b/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.test.js deleted file mode 100644 index 8a1f7390..00000000 --- a/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.test.js +++ /dev/null @@ -1,327 +0,0 @@ -// /* -// Copyright 2025 Adobe. All rights reserved. -// This file is licensed to you under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. You may obtain a copy -// of the License at http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software distributed under -// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS -// OF ANY KIND, either express or implied. See the License for the specific language -// governing permissions and limitations under the License. -// */ - -// import React from 'react'; -// import renderer from 'react-test-renderer'; -// import { useColorScheme } from 'react-native'; -// import UnreadIcon from './UnreadIcon'; -// import ContentCardContainerProvider from '../../providers/ContentCardContainerProvider'; - -// // Mock useColorScheme -// jest.mock('react-native/Libraries/Utilities/useColorScheme', () => ({ -// default: jest.fn(), -// })); - -// const mockUseColorScheme = useColorScheme as jest.MockedFunction; - -// describe('UnreadIcon', () => { -// const mockContainerSettings = { -// templateType: 'inbox' as const, -// content: { -// heading: { content: 'Test' }, -// layout: { orientation: 'vertical' as const }, -// capacity: 10, -// emptyStateSettings: { message: { content: 'Empty' } }, -// unread_indicator: { -// unread_bg: { -// clr: { -// light: '#FFF3E0', -// dark: '#2D1B0E', -// }, -// }, -// unread_icon: { -// placement: 'topright' as const, -// image: { -// url: 'https://example.com/icon.png', -// darkUrl: '', -// }, -// }, -// }, -// isUnreadEnabled: true, -// }, -// showPagination: false, -// }; - -// beforeEach(() => { -// jest.clearAllMocks(); -// mockUseColorScheme.mockReturnValue('light'); -// }); - -// describe('Rendering', () => { -// it('should render successfully with container settings', () => { -// const component = renderer.create( -// -// -// -// ); - -// const tree = component.toJSON(); -// expect(tree).toBeTruthy(); -// }); - -// it('should render with custom size', () => { -// const component = renderer.create( -// -// -// -// ); - -// const tree = component.toJSON(); -// expect(tree).toBeTruthy(); -// }); -// }); - -// describe('Placement', () => { -// it('should render with topright placement', () => { -// const component = renderer.create( -// -// -// -// ); - -// const tree = component.toJSON(); -// expect(tree).toBeTruthy(); -// }); - -// it('should render with topleft placement', () => { -// const settings = { -// ...mockContainerSettings, -// content: { -// ...mockContainerSettings.content, -// unread_indicator: { -// ...mockContainerSettings.content.unread_indicator, -// unread_icon: { -// ...mockContainerSettings.content.unread_indicator.unread_icon, -// placement: 'topleft' as const, -// }, -// }, -// }, -// }; - -// const component = renderer.create( -// -// -// -// ); - -// const tree = component.toJSON(); -// expect(tree).toBeTruthy(); -// }); - -// it('should render with bottomright placement', () => { -// const settings = { -// ...mockContainerSettings, -// content: { -// ...mockContainerSettings.content, -// unread_indicator: { -// ...mockContainerSettings.content.unread_indicator, -// unread_icon: { -// ...mockContainerSettings.content.unread_indicator.unread_icon, -// placement: 'bottomright' as const, -// }, -// }, -// }, -// }; - -// const component = renderer.create( -// -// -// -// ); - -// const tree = component.toJSON(); -// expect(tree).toBeTruthy(); -// }); - -// it('should render with bottomleft placement', () => { -// const settings = { -// ...mockContainerSettings, -// content: { -// ...mockContainerSettings.content, -// unread_indicator: { -// ...mockContainerSettings.content.unread_indicator, -// unread_icon: { -// ...mockContainerSettings.content.unread_indicator.unread_icon, -// placement: 'bottomleft' as const, -// }, -// }, -// }, -// }; - -// const component = renderer.create( -// -// -// -// ); - -// const tree = component.toJSON(); -// expect(tree).toBeTruthy(); -// }); -// }); - -// describe('Light Mode', () => { -// beforeEach(() => { -// mockUseColorScheme.mockReturnValue('light'); -// }); - -// it('should render in light mode with image URL', () => { -// const component = renderer.create( -// -// -// -// ); - -// const tree = component.toJSON(); -// expect(tree).toBeTruthy(); -// }); - -// it('should render dot when URL is empty string in light mode', () => { -// const settings = { -// ...mockContainerSettings, -// content: { -// ...mockContainerSettings.content, -// unread_indicator: { -// ...mockContainerSettings.content.unread_indicator, -// unread_icon: { -// ...mockContainerSettings.content.unread_indicator.unread_icon, -// image: { -// url: '', -// darkUrl: '', -// }, -// }, -// }, -// }, -// }; - -// const component = renderer.create( -// -// -// -// ); - -// const tree = component.toJSON(); -// expect(tree).toBeTruthy(); -// }); -// }); - -// describe('Dark Mode', () => { -// beforeEach(() => { -// mockUseColorScheme.mockReturnValue('dark'); -// }); - -// it('should render in dark mode with darkUrl provided', () => { -// const settings = { -// ...mockContainerSettings, -// content: { -// ...mockContainerSettings.content, -// unread_indicator: { -// ...mockContainerSettings.content.unread_indicator, -// unread_icon: { -// ...mockContainerSettings.content.unread_indicator.unread_icon, -// image: { -// url: 'https://example.com/light.png', -// darkUrl: 'https://example.com/dark.png', -// }, -// }, -// }, -// }, -// }; - -// const component = renderer.create( -// -// -// -// ); - -// const tree = component.toJSON(); -// expect(tree).toBeTruthy(); -// }); - -// it('should render dot when darkUrl is empty string in dark mode', () => { -// const component = renderer.create( -// -// -// -// ); - -// const tree = component.toJSON(); -// expect(tree).toBeTruthy(); -// }); - -// it('should fallback to light mode image when no darkUrl provided', () => { -// const settings = { -// ...mockContainerSettings, -// content: { -// ...mockContainerSettings.content, -// unread_indicator: { -// ...mockContainerSettings.content.unread_indicator, -// unread_icon: { -// placement: 'topright' as const, -// image: { -// url: 'https://example.com/icon.png', -// }, -// }, -// }, -// }, -// }; - -// const component = renderer.create( -// -// -// -// ); - -// const tree = component.toJSON(); -// expect(tree).toBeTruthy(); -// }); -// }); - -// describe('Error Handling', () => { -// it('should throw error when used outside ContentCardContainerProvider', () => { -// // Suppress console.error for this test -// const consoleError = jest.spyOn(console, 'error').mockImplementation(() => {}); - -// expect(() => { -// renderer.create(); -// }).toThrow('useContainerSettings must be used within a ContentCardContainerProvider'); - -// consoleError.mockRestore(); -// }); -// }); - -// describe('Snapshot Tests', () => { -// it('should match snapshot for topright placement', () => { -// const component = renderer.create( -// -// -// -// ); - -// const tree = component.toJSON(); -// expect(tree).toMatchSnapshot(); -// }); - -// it('should match snapshot for dot in dark mode', () => { -// mockUseColorScheme.mockReturnValue('dark'); - -// const component = renderer.create( -// -// -// -// ); - -// const tree = component.toJSON(); -// expect(tree).toMatchSnapshot(); -// }); -// }); -// }); -"use strict"; -//# sourceMappingURL=UnreadIcon.test.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.test.js.map b/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.test.js.map deleted file mode 100644 index 45df9eb6..00000000 --- a/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["ui/components/UnreadIcon/UnreadIcon.test.tsx"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AAAA","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/components/index.js b/packages/messaging/dist/module/ui/components/index.js deleted file mode 100644 index bc99e29d..00000000 --- a/packages/messaging/dist/module/ui/components/index.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; - -/* - Copyright 2025 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law - or agreed to in writing, software distributed under the License is - distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF - ANY KIND, either express or implied. See the License for the specific - language governing permissions and limitations under the License. -*/ - -export * from "./Button/Button.js"; -export * from "./ContentCardContainer/ContentCardContainer.js"; -export * from "./ContentCardView/ContentCardView.js"; -export * from "../types/ContentViewEvent.js"; -export * from "./Pagination/Pagination.js"; -export * from "./UnreadIcon/UnreadIcon.js"; -export { ThemeProvider } from "../theme/ThemeProvider.js"; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/components/index.js.map b/packages/messaging/dist/module/ui/components/index.js.map deleted file mode 100644 index cee18f2f..00000000 --- a/packages/messaging/dist/module/ui/components/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["ThemeProvider"],"sourceRoot":"../../../../src","sources":["ui/components/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc,oBAAiB;AAC/B,cAAc,gDAA6C;AAC3D,cAAc,sCAAmC;AACjD,cAAc,8BAA2B;AACzC,cAAc,4BAAyB;AACvC,cAAc,4BAAyB;AAEvC,SAASA,aAAa,QAAQ,2BAAwB","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/hooks/index.js b/packages/messaging/dist/module/ui/hooks/index.js deleted file mode 100644 index 176d7b75..00000000 --- a/packages/messaging/dist/module/ui/hooks/index.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; - -export * from "./useContentCardUI.js"; -export * from "./useContentContainer.js"; -export * from "./useContainerSettings.js"; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/hooks/index.js.map b/packages/messaging/dist/module/ui/hooks/index.js.map deleted file mode 100644 index ee5bcfea..00000000 --- a/packages/messaging/dist/module/ui/hooks/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["ui/hooks/index.ts"],"mappings":";;AAAA,cAAc,uBAAoB;AAClC,cAAc,0BAAuB;AACrC,cAAc,2BAAwB","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/hooks/useAspectRatio.js b/packages/messaging/dist/module/ui/hooks/useAspectRatio.js deleted file mode 100644 index ed480183..00000000 --- a/packages/messaging/dist/module/ui/hooks/useAspectRatio.js +++ /dev/null @@ -1,21 +0,0 @@ -"use strict"; - -import { useEffect, useState } from 'react'; -import { Image } from 'react-native'; -function useAspectRatio(uri) { - const [imageAspectRatio, setImageAspectRatio] = useState(1); - useEffect(() => { - if (!uri) { - return; - } - Image.getSize(uri, (width, height) => { - setImageAspectRatio(width / height); - }, error => { - console.log('Error getting image size:', error); - setImageAspectRatio(1); - }); - }, [uri]); - return imageAspectRatio; -} -export default useAspectRatio; -//# sourceMappingURL=useAspectRatio.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/hooks/useAspectRatio.js.map b/packages/messaging/dist/module/ui/hooks/useAspectRatio.js.map deleted file mode 100644 index 3424f20c..00000000 --- a/packages/messaging/dist/module/ui/hooks/useAspectRatio.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["useEffect","useState","Image","useAspectRatio","uri","imageAspectRatio","setImageAspectRatio","getSize","width","height","error","console","log"],"sourceRoot":"../../../../src","sources":["ui/hooks/useAspectRatio.tsx"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3C,SAASC,KAAK,QAAQ,cAAc;AAEpC,SAASC,cAAcA,CAACC,GAAY,EAAE;EACpC,MAAM,CAACC,gBAAgB,EAAEC,mBAAmB,CAAC,GAAGL,QAAQ,CAAS,CAAC,CAAC;EAEnED,SAAS,CAAC,MAAM;IACd,IAAI,CAACI,GAAG,EAAE;MACR;IACF;IAEAF,KAAK,CAACK,OAAO,CACXH,GAAG,EACH,CAACI,KAAK,EAAEC,MAAM,KAAK;MACjBH,mBAAmB,CAACE,KAAK,GAAGC,MAAM,CAAC;IACrC,CAAC,EACAC,KAAK,IAAK;MACTC,OAAO,CAACC,GAAG,CAAC,2BAA2B,EAAEF,KAAK,CAAC;MAC/CJ,mBAAmB,CAAC,CAAC,CAAC;IACxB,CACF,CAAC;EACH,CAAC,EAAE,CAACF,GAAG,CAAC,CAAC;EAET,OAAOC,gBAAgB;AACzB;AAEA,eAAeF,cAAc","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/hooks/useContainerSettings.js b/packages/messaging/dist/module/ui/hooks/useContainerSettings.js deleted file mode 100644 index aa65d83d..00000000 --- a/packages/messaging/dist/module/ui/hooks/useContainerSettings.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; - -import { useContext } from "react"; -import { ContentCardContainerContext } from "../providers/ContentCardContainerProvider.js"; -function useContainerSettings() { - const settings = useContext(ContentCardContainerContext); - if (!settings) { - throw new Error("useContainerSettings must be used within a ContentCardContainerProvider"); - } - return settings; -} -export default useContainerSettings; -//# sourceMappingURL=useContainerSettings.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/hooks/useContainerSettings.js.map b/packages/messaging/dist/module/ui/hooks/useContainerSettings.js.map deleted file mode 100644 index 0a8bf785..00000000 --- a/packages/messaging/dist/module/ui/hooks/useContainerSettings.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["useContext","ContentCardContainerContext","useContainerSettings","settings","Error"],"sourceRoot":"../../../../src","sources":["ui/hooks/useContainerSettings.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,OAAO;AAClC,SAASC,2BAA2B,QAAQ,8CAA2C;AAEvF,SAASC,oBAAoBA,CAAA,EAAG;EAC9B,MAAMC,QAAQ,GAAGH,UAAU,CAACC,2BAA2B,CAAC;EACxD,IAAI,CAACE,QAAQ,EAAE;IACb,MAAM,IAAIC,KAAK,CAAC,yEAAyE,CAAC;EAC5F;EACA,OAAOD,QAAQ;AACjB;AAEA,eAAeD,oBAAoB","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/hooks/useContentCardUI.js b/packages/messaging/dist/module/ui/hooks/useContentCardUI.js deleted file mode 100644 index 09287580..00000000 --- a/packages/messaging/dist/module/ui/hooks/useContentCardUI.js +++ /dev/null @@ -1,39 +0,0 @@ -"use strict"; - -import { useCallback, useEffect, useState } from 'react'; -import Messaging from "../../Messaging.js"; -/** - * Hook to fetch the content card UI for a given surface. - * @param surface - The surface to fetch the content card UI for. - * @returns An object containing the content card UI, error, loading state, and a refetch function. - */ -export const useContentCardUI = surface => { - const [content, setContent] = useState([]); - const [error, setError] = useState(null); - const [isLoading, setIsLoading] = useState(false); - const fetchContent = useCallback(async () => { - try { - setIsLoading(true); - await Messaging.updatePropositionsForSurfaces([surface]); - const content = await Messaging.getContentCardUI(surface); - setContent(content); - setIsLoading(false); - } catch (error) { - console.error(error); - setContent([]); - setError(error); - } finally { - setIsLoading(false); - } - }, [surface]); - useEffect(() => { - fetchContent(); - }, [surface, fetchContent]); - return { - content, - error, - isLoading, - refetch: fetchContent - }; -}; -//# sourceMappingURL=useContentCardUI.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/hooks/useContentCardUI.js.map b/packages/messaging/dist/module/ui/hooks/useContentCardUI.js.map deleted file mode 100644 index de9be797..00000000 --- a/packages/messaging/dist/module/ui/hooks/useContentCardUI.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["useCallback","useEffect","useState","Messaging","useContentCardUI","surface","content","setContent","error","setError","isLoading","setIsLoading","fetchContent","updatePropositionsForSurfaces","getContentCardUI","console","refetch"],"sourceRoot":"../../../../src","sources":["ui/hooks/useContentCardUI.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AACxD,OAAOC,SAAS,MAAM,oBAAiB;AAGvC;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,GAAIC,OAAe,IAAK;EACnD,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGL,QAAQ,CAAoB,EAAE,CAAC;EAC7D,MAAM,CAACM,KAAK,EAAEC,QAAQ,CAAC,GAAGP,QAAQ,CAAM,IAAI,CAAC;EAC7C,MAAM,CAACQ,SAAS,EAAEC,YAAY,CAAC,GAAGT,QAAQ,CAAC,KAAK,CAAC;EAEjD,MAAMU,YAAY,GAAGZ,WAAW,CAAC,YAAY;IAC3C,IAAI;MACFW,YAAY,CAAC,IAAI,CAAC;MAClB,MAAMR,SAAS,CAACU,6BAA6B,CAAC,CAACR,OAAO,CAAC,CAAC;MACxD,MAAMC,OAAO,GAAG,MAAMH,SAAS,CAACW,gBAAgB,CAACT,OAAO,CAAC;MACzDE,UAAU,CAACD,OAAO,CAAC;MACnBK,YAAY,CAAC,KAAK,CAAC;IACrB,CAAC,CAAC,OAAOH,KAAK,EAAE;MACdO,OAAO,CAACP,KAAK,CAACA,KAAK,CAAC;MACpBD,UAAU,CAAC,EAAE,CAAC;MACdE,QAAQ,CAACD,KAAK,CAAC;IACjB,CAAC,SAAS;MACRG,YAAY,CAAC,KAAK,CAAC;IACrB;EACF,CAAC,EAAE,CAACN,OAAO,CAAC,CAAC;EAEbJ,SAAS,CAAC,MAAM;IACdW,YAAY,CAAC,CAAC;EAChB,CAAC,EAAE,CAACP,OAAO,EAAEO,YAAY,CAAC,CAAC;EAE3B,OAAO;IAAEN,OAAO;IAAEE,KAAK;IAAEE,SAAS;IAAEM,OAAO,EAAEJ;EAAa,CAAC;AAC7D,CAAC","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/hooks/useContentContainer.js b/packages/messaging/dist/module/ui/hooks/useContentContainer.js deleted file mode 100644 index b78c92cf..00000000 --- a/packages/messaging/dist/module/ui/hooks/useContentContainer.js +++ /dev/null @@ -1,31 +0,0 @@ -"use strict"; - -import { useCallback, useEffect, useState } from "react"; -import Messaging from "../../Messaging.js"; -export function useContentContainer(surface) { - const [settings, setSettings] = useState(null); - const [error, setError] = useState(null); - const [isLoading, setIsLoading] = useState(false); - const fetchContainer = useCallback(async () => { - try { - setIsLoading(true); - const settings = await Messaging.getContentCardContainer(surface); - setSettings(settings); - setIsLoading(false); - } catch (error) { - setError(error); - } finally { - setIsLoading(false); - } - }, [surface]); - useEffect(() => { - fetchContainer(); - }, [surface]); - return { - settings, - error, - isLoading, - refetch: fetchContainer - }; -} -//# sourceMappingURL=useContentContainer.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/hooks/useContentContainer.js.map b/packages/messaging/dist/module/ui/hooks/useContentContainer.js.map deleted file mode 100644 index f17f9bc6..00000000 --- a/packages/messaging/dist/module/ui/hooks/useContentContainer.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["useCallback","useEffect","useState","Messaging","useContentContainer","surface","settings","setSettings","error","setError","isLoading","setIsLoading","fetchContainer","getContentCardContainer","refetch"],"sourceRoot":"../../../../src","sources":["ui/hooks/useContentContainer.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AACxD,OAAOC,SAAS,MAAM,oBAAiB;AAGvC,OAAO,SAASC,mBAAmBA,CAACC,OAAe,EAAE;EACnD,MAAM,CAACC,QAAQ,EAAEC,WAAW,CAAC,GAAGL,QAAQ,CAA2B,IAAI,CAAC;EACxE,MAAM,CAACM,KAAK,EAAEC,QAAQ,CAAC,GAAGP,QAAQ,CAAM,IAAI,CAAC;EAC7C,MAAM,CAACQ,SAAS,EAAEC,YAAY,CAAC,GAAGT,QAAQ,CAAC,KAAK,CAAC;EAEjD,MAAMU,cAAc,GAAGZ,WAAW,CAAC,YAAY;IAC7C,IAAI;MACFW,YAAY,CAAC,IAAI,CAAC;MAClB,MAAML,QAAQ,GAAG,MAAMH,SAAS,CAACU,uBAAuB,CAACR,OAAO,CAAC;MACjEE,WAAW,CAACD,QAAQ,CAAC;MACrBK,YAAY,CAAC,KAAK,CAAC;IACrB,CAAC,CAAC,OAAOH,KAAK,EAAE;MACdC,QAAQ,CAACD,KAAK,CAAC;IACjB,CAAC,SAAS;MACRG,YAAY,CAAC,KAAK,CAAC;IACrB;EACF,CAAC,EAAE,CAACN,OAAO,CAAC,CAAC;EAEbJ,SAAS,CAAC,MAAM;IACdW,cAAc,CAAC,CAAC;EAClB,CAAC,EAAE,CAACP,OAAO,CAAC,CAAC;EAEb,OAAO;IAAEC,QAAQ;IAAEE,KAAK;IAAEE,SAAS;IAAEI,OAAO,EAAEF;EAAe,CAAC;AAChE","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/index.js b/packages/messaging/dist/module/ui/index.js deleted file mode 100644 index c1d9e839..00000000 --- a/packages/messaging/dist/module/ui/index.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -export * from "./components/index.js"; -export * from "./hooks/index.js"; -export * from "./theme/index.js"; -export * from "./types/index.js"; -export * from "./providers/ContentCardContainerProvider.js"; -export { default as ContentCardContainerProvider } from "./providers/ContentCardContainerProvider.js"; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/index.js.map b/packages/messaging/dist/module/ui/index.js.map deleted file mode 100644 index aaf9aa85..00000000 --- a/packages/messaging/dist/module/ui/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["default","ContentCardContainerProvider"],"sourceRoot":"../../../src","sources":["ui/index.ts"],"mappings":";;AAAA,cAAc,uBAAc;AAC5B,cAAc,kBAAS;AACvB,cAAc,kBAAS;AACvB,cAAc,kBAAS;AACvB,cAAc,6CAA0C;AACxD,SAASA,OAAO,IAAIC,4BAA4B,QAAQ,6CAA0C","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/providers/ContentCardContainerProvider.js b/packages/messaging/dist/module/ui/providers/ContentCardContainerProvider.js deleted file mode 100644 index d0057d7a..00000000 --- a/packages/messaging/dist/module/ui/providers/ContentCardContainerProvider.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; - -import React, { createContext } from "react"; -export const ContentCardContainerContext = /*#__PURE__*/createContext(null); -function ContentCardContainerProvider({ - children, - settings -}) { - return /*#__PURE__*/React.createElement(ContentCardContainerContext.Provider, { - value: settings - }, children); -} -export default ContentCardContainerProvider; -//# sourceMappingURL=ContentCardContainerProvider.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/providers/ContentCardContainerProvider.js.map b/packages/messaging/dist/module/ui/providers/ContentCardContainerProvider.js.map deleted file mode 100644 index ff07b1df..00000000 --- a/packages/messaging/dist/module/ui/providers/ContentCardContainerProvider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["React","createContext","ContentCardContainerContext","ContentCardContainerProvider","children","settings","createElement","Provider","value"],"sourceRoot":"../../../../src","sources":["ui/providers/ContentCardContainerProvider.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,aAAa,QAAQ,OAAO;AA0C5C,OAAO,MAAMC,2BAA2B,gBACtCD,aAAa,CAA2B,IAAI,CAAC;AAO/C,SAASE,4BAA4BA,CAAC;EACpCC,QAAQ;EACRC;AACiC,CAAC,EAAE;EACpC,oBACEL,KAAA,CAAAM,aAAA,CAACJ,2BAA2B,CAACK,QAAQ;IAACC,KAAK,EAAEH;EAAS,GACnDD,QACmC,CAAC;AAE3C;AAEA,eAAeD,4BAA4B","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/theme/Theme.js b/packages/messaging/dist/module/ui/theme/Theme.js deleted file mode 100644 index e8bb4ce3..00000000 --- a/packages/messaging/dist/module/ui/theme/Theme.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict"; -//# sourceMappingURL=Theme.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/theme/Theme.js.map b/packages/messaging/dist/module/ui/theme/Theme.js.map deleted file mode 100644 index 25752faa..00000000 --- a/packages/messaging/dist/module/ui/theme/Theme.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["ui/theme/Theme.ts"],"mappings":"","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/theme/ThemeProvider.js b/packages/messaging/dist/module/ui/theme/ThemeProvider.js deleted file mode 100644 index 4aa1fb4d..00000000 --- a/packages/messaging/dist/module/ui/theme/ThemeProvider.js +++ /dev/null @@ -1,95 +0,0 @@ -"use strict"; - -/* - Copyright 2025 Adobe. All rights reserved. - This file is licensed to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law - or agreed to in writing, software distributed under the License is - distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF - ANY KIND, either express or implied. See the License for the specific - language governing permissions and limitations under the License. -*/ - -import React, { createContext, useContext, useMemo } from 'react'; -import { useColorScheme } from 'react-native'; -const defaultTheme = { - light: { - colors: { - primary: '#007AFF', - secondary: '#5856D6', - background: '#FFFFFF', - textPrimary: '#000000', - textSecondary: '#8E8E93', - imagePlaceholder: '#C7C7CC', - buttonTextColor: 'dodgerblue' - } - }, - dark: { - colors: { - primary: '#0A84FF', - secondary: '#5E5CE6', - background: '#262626', - textPrimary: '#FFFFFF', - textSecondary: '#8E8E93', - imagePlaceholder: '#48484A', - buttonTextColor: 'dodgerblue' - } - } -}; -const ThemeContext = /*#__PURE__*/createContext(undefined); - -/** - * ThemeProvider component that provides the theme to the children components. - * - * @param children - The children components. - * @param customThemes - The custom themes to override the default themes. - * @returns The ThemeProvider component. - */ -export const ThemeProvider = ({ - children, - customThemes -}) => { - const systemColorScheme = useColorScheme(); - - // Memoize the merged themes to avoid recreation on every render - const mergedThemes = useMemo(() => ({ - light: { - colors: { - ...defaultTheme.light.colors, - ...(customThemes?.light?.colors || {}) - } - }, - dark: { - colors: { - ...defaultTheme.dark.colors, - ...(customThemes?.dark?.colors || {}) - } - } - }), [customThemes]); - - // Memoize the active theme - const activeTheme = useMemo(() => mergedThemes[systemColorScheme ?? 'light'], [mergedThemes, systemColorScheme]); - - // Memoize the context value to prevent unnecessary re-renders - const contextValue = useMemo(() => activeTheme, [activeTheme]); - return /*#__PURE__*/React.createElement(ThemeContext.Provider, { - value: contextValue - }, children); -}; - -/** - * useTheme hook that returns the theme context. - * @returns The theme context. - */ -export const useTheme = () => { - const context = useContext(ThemeContext); - const systemColorScheme = useColorScheme(); - if (context === undefined) { - return defaultTheme[systemColorScheme ?? 'light']; - } - return context; -}; -//# sourceMappingURL=ThemeProvider.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/theme/ThemeProvider.js.map b/packages/messaging/dist/module/ui/theme/ThemeProvider.js.map deleted file mode 100644 index a5166d9e..00000000 --- a/packages/messaging/dist/module/ui/theme/ThemeProvider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["React","createContext","useContext","useMemo","useColorScheme","defaultTheme","light","colors","primary","secondary","background","textPrimary","textSecondary","imagePlaceholder","buttonTextColor","dark","ThemeContext","undefined","ThemeProvider","children","customThemes","systemColorScheme","mergedThemes","activeTheme","contextValue","createElement","Provider","value","useTheme","context"],"sourceRoot":"../../../../src","sources":["ui/theme/ThemeProvider.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,IAAIC,aAAa,EAAEC,UAAU,EAAaC,OAAO,QAAQ,OAAO;AAC5E,SAASC,cAAc,QAAQ,cAAc;AAQ7C,MAAMC,YAAoB,GAAG;EAC3BC,KAAK,EAAE;IACLC,MAAM,EAAE;MACNC,OAAO,EAAE,SAAS;MAClBC,SAAS,EAAE,SAAS;MACpBC,UAAU,EAAE,SAAS;MACrBC,WAAW,EAAE,SAAS;MACtBC,aAAa,EAAE,SAAS;MACxBC,gBAAgB,EAAE,SAAS;MAC3BC,eAAe,EAAE;IACnB;EACF,CAAC;EACDC,IAAI,EAAE;IACJR,MAAM,EAAE;MACNC,OAAO,EAAE,SAAS;MAClBC,SAAS,EAAE,SAAS;MACpBC,UAAU,EAAE,SAAS;MACrBC,WAAW,EAAE,SAAS;MACtBC,aAAa,EAAE,SAAS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AAKZ,SAAS,EAAE;IACzB,OAAOZ,YAAY,CAACgB,iBAAiB,IAAI,OAAO,CAAC;EACnD;EACA,OAAOQ,OAAO;AAChB,CAAC","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/theme/index.js b/packages/messaging/dist/module/ui/theme/index.js deleted file mode 100644 index 94014bbe..00000000 --- a/packages/messaging/dist/module/ui/theme/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -export * from "./Theme.js"; -export * from "./ThemeProvider.js"; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/theme/index.js.map b/packages/messaging/dist/module/ui/theme/index.js.map deleted file mode 100644 index f902b680..00000000 --- a/packages/messaging/dist/module/ui/theme/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["ui/theme/index.ts"],"mappings":";;AAAA,cAAc,YAAS;AACvB,cAAc,oBAAiB","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/types/ContentViewEvent.js b/packages/messaging/dist/module/ui/types/ContentViewEvent.js deleted file mode 100644 index 83f55db4..00000000 --- a/packages/messaging/dist/module/ui/types/ContentViewEvent.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict"; -//# sourceMappingURL=ContentViewEvent.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/types/ContentViewEvent.js.map b/packages/messaging/dist/module/ui/types/ContentViewEvent.js.map deleted file mode 100644 index 90246703..00000000 --- a/packages/messaging/dist/module/ui/types/ContentViewEvent.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["ui/types/ContentViewEvent.ts"],"mappings":"","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/types/Templates.js b/packages/messaging/dist/module/ui/types/Templates.js deleted file mode 100644 index 1d1f0e3c..00000000 --- a/packages/messaging/dist/module/ui/types/Templates.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; - -import { ContentCard } from "../../models/ContentCard.js"; -export class ContentTemplate extends ContentCard { - constructor(data, type) { - super(data); - this.type = type; - } -} - -/** Overrides for the structural pieces of the content card */ - -/** The base style overrides available for content cards */ -//# sourceMappingURL=Templates.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/types/Templates.js.map b/packages/messaging/dist/module/ui/types/Templates.js.map deleted file mode 100644 index 4488889b..00000000 --- a/packages/messaging/dist/module/ui/types/Templates.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["ContentCard","ContentTemplate","constructor","data","type"],"sourceRoot":"../../../../src","sources":["ui/types/Templates.ts"],"mappings":";;AAUA,SACEA,WAAW,QAGN,6BAA0B;AAGjC,OAAO,MAAMC,eAAe,SAASD,WAAW,CAAC;EAG/CE,WAAWA,CAACC,IAAqB,EAAEC,IAAyB,EAAE;IAC5D,KAAK,CAACD,IAAI,CAAC;IACX,IAAI,CAACC,IAAI,GAAGA,IAAI;EAClB;AACF;;AAEA;;AAcA","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/types/index.js b/packages/messaging/dist/module/ui/types/index.js deleted file mode 100644 index dd947405..00000000 --- a/packages/messaging/dist/module/ui/types/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -export * from "./ContentViewEvent.js"; -export * from "./Templates.js"; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/types/index.js.map b/packages/messaging/dist/module/ui/types/index.js.map deleted file mode 100644 index bf13e9a6..00000000 --- a/packages/messaging/dist/module/ui/types/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["ui/types/index.ts"],"mappings":";;AAAA,cAAc,uBAAoB;AAClC,cAAc,gBAAa","ignoreList":[]} diff --git a/packages/messaging/dist/typescript/ui/components/ContentCardView/ContentCardView.d.ts b/packages/messaging/dist/typescript/ui/components/ContentCardView/ContentCardView.d.ts index 161f8b6c..14ecda60 100644 --- a/packages/messaging/dist/typescript/ui/components/ContentCardView/ContentCardView.d.ts +++ b/packages/messaging/dist/typescript/ui/components/ContentCardView/ContentCardView.d.ts @@ -1,19 +1,39 @@ -import React from 'react'; -import { ComponentOverrideProps, ContentTemplate, ImageOnlyContentStyle, LargeImageContentStyle, SmallImageContentStyle } from '../../types/Templates'; -import { ContentViewEvent } from '../../types/ContentViewEvent'; +import React from "react"; +import { ComponentOverrideProps, ContentTemplate, ImageOnlyContentStyle, LargeImageContentStyle, SmallImageContentStyle } from "../../types/Templates"; +import { ContentViewEvent } from "../../types/ContentViewEvent"; import { PressableProps } from 'react-native'; import { ContentCardTemplate } from '../../../models'; -export type ContentCardEventListener = (event: ContentViewEvent, data?: ContentTemplate, nativeEvent?: any) => void; +/** + * Callback function that is called when a content card event occurs. + */ +export type ContentCardEventListener = ( +/** The event that occurred, one of "onDismiss", "onDisplay", "onInteract" */ +event?: ContentViewEvent, +/** The full content card data associated with the event */ +data?: ContentTemplate, +/** Any additional native event data that accompanies the event */ +nativeEvent?: any) => void; +/** Props for the ContentCardView component */ export interface ContentViewProps extends PressableProps, ComponentOverrideProps { + /** The content card data to display */ template: ContentTemplate; + /** Style overrides per template type for the content card */ styleOverrides?: { + /** Style overrides for the small image content card */ smallImageStyle?: SmallImageContentStyle; + /** Style overrides for the large image content card */ largeImageStyle?: LargeImageContentStyle; + /** Style overrides for the image only content card */ imageOnlyStyle?: ImageOnlyContentStyle; }; + /** The function to call when a content card event occurs */ listener?: ContentCardEventListener; + /** The variant of the content card to display */ variant?: ContentCardTemplate; isRead?: boolean; } +/** Renders a content card view + * @param {ContentViewProps} props - The props for the ContentCardView component + */ export declare const ContentCardView: React.FC; //# sourceMappingURL=ContentCardView.d.ts.map \ No newline at end of file diff --git a/packages/messaging/dist/typescript/ui/components/ContentCardView/ContentCardView.d.ts.map b/packages/messaging/dist/typescript/ui/components/ContentCardView/ContentCardView.d.ts.map index 1d6c1c44..035fe110 100644 --- a/packages/messaging/dist/typescript/ui/components/ContentCardView/ContentCardView.d.ts.map +++ b/packages/messaging/dist/typescript/ui/components/ContentCardView/ContentCardView.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"ContentCardView.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/ContentCardView/ContentCardView.tsx"],"names":[],"mappings":"AAYA,OAAO,KAMN,MAAM,OAAO,CAAC;AACf,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAIL,cAAc,EAKf,MAAM,cAAc,CAAC;AAKtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAGtD,MAAM,MAAM,wBAAwB,GAAG,CACrC,KAAK,EAAE,gBAAgB,EACvB,IAAI,CAAC,EAAE,eAAe,EACtB,WAAW,CAAC,EAAE,GAAG,KACd,IAAI,CAAC;AAEV,MAAM,WAAW,gBACf,SAAQ,cAAc,EACpB,sBAAsB;IACxB,QAAQ,EAAE,eAAe,CAAC;IAC1B,cAAc,CAAC,EAAE;QACf,eAAe,CAAC,EAAE,sBAAsB,CAAC;QACzC,eAAe,CAAC,EAAE,sBAAsB,CAAC;QACzC,cAAc,CAAC,EAAE,qBAAqB,CAAC;KACxC,CAAC;IACF,QAAQ,CAAC,EAAE,wBAAwB,CAAC;IACpC,OAAO,CAAC,EAAE,mBAAmB,CAAC;CAC/B;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAsNtD,CAAC"} +{"version":3,"file":"ContentCardView.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/ContentCardView/ContentCardView.tsx"],"names":[],"mappings":"AAYA,OAAO,KAMN,MAAM,OAAO,CAAC;AACf,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAIL,cAAc,EAKf,MAAM,cAAc,CAAC;AAMtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAItD;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG;AACrC,6EAA6E;AAC7E,KAAK,CAAC,EAAE,gBAAgB;AACxB,2DAA2D;AAC3D,IAAI,CAAC,EAAE,eAAe;AACtB,kEAAkE;AAClE,WAAW,CAAC,EAAE,GAAG,KACd,IAAI,CAAC;AAEV,8CAA8C;AAC9C,MAAM,WAAW,gBACf,SAAQ,cAAc,EACpB,sBAAsB;IACxB,uCAAuC;IACvC,QAAQ,EAAE,eAAe,CAAC;IAC1B,6DAA6D;IAC7D,cAAc,CAAC,EAAE;QACf,uDAAuD;QACvD,eAAe,CAAC,EAAE,sBAAsB,CAAC;QACzC,uDAAuD;QACvD,eAAe,CAAC,EAAE,sBAAsB,CAAC;QACzC,sDAAsD;QACtD,cAAc,CAAC,EAAE,qBAAqB,CAAC;KACxC,CAAC;IACF,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,wBAAwB,CAAC;IACpC,iDAAiD;IACjD,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA+OtD,CAAC"} \ No newline at end of file diff --git a/packages/messaging/dist/typescript/ui/components/DismissButton/DismissButton.d.ts b/packages/messaging/dist/typescript/ui/components/DismissButton/DismissButton.d.ts index 99a1c032..ea762abe 100644 --- a/packages/messaging/dist/typescript/ui/components/DismissButton/DismissButton.d.ts +++ b/packages/messaging/dist/typescript/ui/components/DismissButton/DismissButton.d.ts @@ -1,8 +1,12 @@ -import { PressableProps, TextStyle } from 'react-native'; +import { PressableProps, TextStyle } from "react-native"; +/** Props for the DismissButton component. Extends the PressableProps from react-native. */ export interface DismissButtonProps extends PressableProps { + /** The style of the text for the dismiss button */ textStyle?: TextStyle; + /** The function to call when the dismiss button is pressed */ onPress?: () => void; - type: 'simple' | 'circle'; + /** The style of the dismiss button */ + type: "simple" | "circle"; } declare const DismissButton: ({ onPress, type, textStyle, style, ...props }: DismissButtonProps) => import("react").JSX.Element; export default DismissButton; diff --git a/packages/messaging/dist/typescript/ui/components/DismissButton/DismissButton.d.ts.map b/packages/messaging/dist/typescript/ui/components/DismissButton/DismissButton.d.ts.map index df906c4b..8fc9452d 100644 --- a/packages/messaging/dist/typescript/ui/components/DismissButton/DismissButton.d.ts.map +++ b/packages/messaging/dist/typescript/ui/components/DismissButton/DismissButton.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"DismissButton.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/DismissButton/DismissButton.tsx"],"names":[],"mappings":"AAWA,OAAO,EAEL,cAAc,EAGd,SAAS,EAEV,MAAM,cAAc,CAAC;AAEtB,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IACxD,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAC;CAC3B;AAED,QAAA,MAAM,aAAa,GAAI,+CAMpB,kBAAkB,gCAkCpB,CAAC;AAEF,eAAe,aAAa,CAAC"} \ No newline at end of file +{"version":3,"file":"DismissButton.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/DismissButton/DismissButton.tsx"],"names":[],"mappings":"AAWA,OAAO,EAEL,cAAc,EAGd,SAAS,EAEV,MAAM,cAAc,CAAC;AAEtB,2FAA2F;AAC3F,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IACxD,mDAAmD;IACnD,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,8DAA8D;IAC9D,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,sCAAsC;IACtC,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAC;CAC3B;AAED,QAAA,MAAM,aAAa,GAAI,+CAMpB,kBAAkB,gCAkCpB,CAAC;AAEF,eAAe,aAAa,CAAC"} \ No newline at end of file diff --git a/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.d.ts b/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.d.ts index bfbae46b..e5a16d02 100644 --- a/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.d.ts +++ b/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.d.ts @@ -11,4 +11,5 @@ export interface UnreadIconProps extends ViewProps { type?: 'dot' | 'image'; } declare const UnreadIcon: ({ imageStyle, containerStyle, source, darkSource, size, position, type, style, ...props }: UnreadIconProps) => React.JSX.Element; -export default UnreadIcon; \ No newline at end of file +export default UnreadIcon; +//# sourceMappingURL=UnreadIcon.d.ts.map \ No newline at end of file diff --git a/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.d.ts.map b/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.d.ts.map index 83d1de15..a669e772 100644 --- a/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.d.ts.map +++ b/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"UnreadIcon.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/UnreadIcon/UnreadIcon.tsx"],"names":[],"mappings":"AAWA,OAAO,KAA4B,MAAM,OAAO,CAAC;AACjD,OAAO,EAEL,UAAU,EACV,UAAU,EAGV,SAAS,EACT,SAAS,EAEV,MAAM,cAAc,CAAC;AAGtB,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,UAAU,GAAG,YAAY,GAAG,aAAa,CAAC;AAEtF,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAChD,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,MAAM,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC9B,UAAU,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC;CACxB;AAgBD,QAAA,MAAM,UAAU,8FAUb,eAAe,sBA+FjB,CAAC;AAEF,eAAe,UAAU,CAAC"} +{"version":3,"file":"UnreadIcon.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/UnreadIcon/UnreadIcon.tsx"],"names":[],"mappings":"AAWA,OAAO,KAA4B,MAAM,OAAO,CAAC;AACjD,OAAO,EAEL,UAAU,EACV,UAAU,EAGV,SAAS,EACT,SAAS,EAEV,MAAM,cAAc,CAAC;AAGtB,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,UAAU,GAAG,YAAY,GAAG,aAAa,CAAC;AAEtF,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAChD,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,MAAM,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC9B,UAAU,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC;CACxB;AAgBD,QAAA,MAAM,UAAU,GAAI,2FAUjB,eAAe,sBA+FjB,CAAC;AAEF,eAAe,UAAU,CAAC"} \ No newline at end of file diff --git a/packages/messaging/dist/typescript/ui/hooks/useContainerSettings.d.ts b/packages/messaging/dist/typescript/ui/hooks/useContainerSettings.d.ts index fec6fb9b..ac8aeffe 100644 --- a/packages/messaging/dist/typescript/ui/hooks/useContainerSettings.d.ts +++ b/packages/messaging/dist/typescript/ui/hooks/useContainerSettings.d.ts @@ -1,3 +1,4 @@ -declare function useContainerSettings(): import("../providers/ContentCardContainerProvider").ContainerSettings; +import { ContainerSettings } from "../providers/ContentCardContainerProvider"; +declare function useContainerSettings(): ContainerSettings | null; export default useContainerSettings; //# sourceMappingURL=useContainerSettings.d.ts.map \ No newline at end of file diff --git a/packages/messaging/dist/typescript/ui/hooks/useContainerSettings.d.ts.map b/packages/messaging/dist/typescript/ui/hooks/useContainerSettings.d.ts.map index da56306d..a1b49e5c 100644 --- a/packages/messaging/dist/typescript/ui/hooks/useContainerSettings.d.ts.map +++ b/packages/messaging/dist/typescript/ui/hooks/useContainerSettings.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"useContainerSettings.d.ts","sourceRoot":"","sources":["../../../../src/ui/hooks/useContainerSettings.ts"],"names":[],"mappings":"AAGA,iBAAS,oBAAoB,0EAM5B;AAED,eAAe,oBAAoB,CAAC"} \ No newline at end of file +{"version":3,"file":"useContainerSettings.d.ts","sourceRoot":"","sources":["../../../../src/ui/hooks/useContainerSettings.ts"],"names":[],"mappings":"AACA,OAAO,EAA+B,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAE3G,iBAAS,oBAAoB,IAAI,iBAAiB,GAAG,IAAI,CAGxD;AAED,eAAe,oBAAoB,CAAC"} \ No newline at end of file diff --git a/packages/messaging/dist/typescript/ui/theme/ThemeProvider.d.ts b/packages/messaging/dist/typescript/ui/theme/ThemeProvider.d.ts index e8c13086..c773ceb8 100644 --- a/packages/messaging/dist/typescript/ui/theme/ThemeProvider.d.ts +++ b/packages/messaging/dist/typescript/ui/theme/ThemeProvider.d.ts @@ -1,4 +1,4 @@ -import React, { ReactNode } from 'react'; +import { ReactNode } from 'react'; import { Theme, Themes } from './Theme'; interface ThemeProviderProps { children: ReactNode; @@ -11,7 +11,7 @@ interface ThemeProviderProps { * @param customThemes - The custom themes to override the default themes. * @returns The ThemeProvider component. */ -export declare const ThemeProvider: ({ children, customThemes }: ThemeProviderProps) => React.JSX.Element; +export declare const ThemeProvider: ({ children, customThemes }: ThemeProviderProps) => import("react").JSX.Element; /** * useTheme hook that returns the theme context. * @returns The theme context. diff --git a/packages/messaging/dist/typescript/ui/theme/ThemeProvider.d.ts.map b/packages/messaging/dist/typescript/ui/theme/ThemeProvider.d.ts.map index e09e64bd..2a4a27ec 100644 --- a/packages/messaging/dist/typescript/ui/theme/ThemeProvider.d.ts.map +++ b/packages/messaging/dist/typescript/ui/theme/ThemeProvider.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../../../src/ui/theme/ThemeProvider.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,EAA6B,SAAS,EAAW,MAAM,OAAO,CAAC;AAE7E,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAExC,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,SAAS,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB;AA6BD;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,GAAI,4BAG3B,kBAAkB,sBAoCpB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,QAAQ,QAAO,KAO3B,CAAC"} \ No newline at end of file +{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../../../src/ui/theme/ThemeProvider.tsx"],"names":[],"mappings":"AAaA,OAAO,EAA6B,SAAS,EAAW,MAAM,OAAO,CAAC;AAEtE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAExC,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,SAAS,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB;AA6BD;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,GAAI,4BAG3B,kBAAkB,gCAoCpB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,QAAQ,QAAO,KAO3B,CAAC"} \ No newline at end of file diff --git a/packages/messaging/src/ui/components/ContentCardView/ContentCardView.tsx b/packages/messaging/src/ui/components/ContentCardView/ContentCardView.tsx index 43264bf4..b0d785c2 100644 --- a/packages/messaging/src/ui/components/ContentCardView/ContentCardView.tsx +++ b/packages/messaging/src/ui/components/ContentCardView/ContentCardView.tsx @@ -42,8 +42,7 @@ import { useTheme } from '../../theme'; import useAspectRatio from '../../hooks/useAspectRatio'; import { ContentCardTemplate } from '../../../models'; import Button from '../Button/Button'; -import { useContext } from 'react'; -import { ContentCardContainerContext } from '../../providers/ContentCardContainerProvider'; +import useContainerSettings from '../../hooks/useContainerSettings'; /** * Callback function that is called when a content card event occurs. @@ -106,7 +105,7 @@ export const ContentCardView: React.FC = ({ const [internalIsRead, setInternalIsRead] = useState(false); const isDisplayedRef = useRef(false); const theme = useTheme(); - const containerSettings = useContext(ContentCardContainerContext); + const containerSettings = useContainerSettings(); // Support both controlled and uncontrolled modes const isRead = isReadProp !== undefined ? isReadProp : internalIsRead; diff --git a/packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.tsx b/packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.tsx index 7e59ac36..5d23f8b4 100644 --- a/packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.tsx +++ b/packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.tsx @@ -64,7 +64,7 @@ const UnreadIcon = ({ const [imageLoadError, setImageLoadError] = useState(false); // Get unread indicator settings from context - const unreadSettings = settings.content.unread_indicator; + const unreadSettings = settings?.content.unread_indicator; // Use settings from context with fallbacks to props const displayPosition = unreadSettings?.unread_icon?.placement ?? position; diff --git a/packages/messaging/src/ui/hooks/useContainerSettings.ts b/packages/messaging/src/ui/hooks/useContainerSettings.ts index bc9cabc5..6a3dc4a3 100644 --- a/packages/messaging/src/ui/hooks/useContainerSettings.ts +++ b/packages/messaging/src/ui/hooks/useContainerSettings.ts @@ -1,11 +1,8 @@ import { useContext } from "react"; -import { ContentCardContainerContext } from "../providers/ContentCardContainerProvider"; +import { ContentCardContainerContext, ContainerSettings } from "../providers/ContentCardContainerProvider"; -function useContainerSettings() { +function useContainerSettings(): ContainerSettings | null { const settings = useContext(ContentCardContainerContext); - if (!settings) { - throw new Error("useContainerSettings must be used within a ContentCardContainerProvider"); - } return settings; } From 31d68ade8e21362a06c0ac2bcd836aa11bbed27d Mon Sep 17 00:00:00 2001 From: Calise Cheung Date: Wed, 8 Oct 2025 08:15:32 -0700 Subject: [PATCH 07/15] update with review comments update with review comments --- .../app/ContentCardsView.tsx | 1 + packages/messaging/src/models/ContentCard.ts | 1 + .../ContentCardView/ContentCardView.tsx | 26 +- .../components/UnreadIcon/UnreadIcon.spec.tsx | 625 ++++++++++++++++++ .../components/UnreadIcon/UnreadIcon.test.tsx | 325 --------- .../ui/components/UnreadIcon/UnreadIcon.tsx | 36 +- .../ContentCardContainerProvider.tsx | 3 +- 7 files changed, 670 insertions(+), 347 deletions(-) create mode 100644 packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.spec.tsx delete mode 100644 packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.test.tsx diff --git a/apps/AEPSampleAppNewArchEnabled/app/ContentCardsView.tsx b/apps/AEPSampleAppNewArchEnabled/app/ContentCardsView.tsx index c6082729..b6daa962 100644 --- a/apps/AEPSampleAppNewArchEnabled/app/ContentCardsView.tsx +++ b/apps/AEPSampleAppNewArchEnabled/app/ContentCardsView.tsx @@ -127,6 +127,7 @@ const Header = ({ onChangeText={setTrackInput} placeholder="Enter action name" placeholderTextColor={colors.mutedText} + autoCapitalize="none" /> = ({ ButtonContainerProps, ButtonProps, DismissButtonProps, - isRead: isReadProp, ...props }) => { const colorScheme = useColorScheme(); const [isVisible, setIsVisible] = useState(true); - const [internalIsRead, setInternalIsRead] = useState(false); const isDisplayedRef = useRef(false); const theme = useTheme(); const containerSettings = useContainerSettings(); + // Force re-render when read state changes + const [, forceUpdate] = useState({}); - // Support both controlled and uncontrolled modes - const isRead = isReadProp !== undefined ? isReadProp : internalIsRead; + // Get read state from template + const isRead = template.read; // Get unread background color based on theme const unreadBackgroundColor = useMemo(() => { - if (!containerSettings?.content?.isUnreadEnabled || isRead || !containerSettings.content.unread_indicator?.unread_bg) { + // Default to true if not specified + const isUnreadEnabled = containerSettings?.content?.isUnreadEnabled ?? true; + + if (!isUnreadEnabled || isRead || !containerSettings?.content?.unread_indicator?.unread_bg) { return undefined; } @@ -140,10 +142,10 @@ export const ContentCardView: React.FC = ({ // Track interaction event using propositionItem template.track?.("content_clicked", MessagingEdgeEventType.INTERACT, null); - // Mark as read (only if uncontrolled mode) - if (isReadProp === undefined) { - setInternalIsRead(true); - } + // Mark as read when interacted with (matches Android behavior) + template.read = true; + // Trigger re-render to update unread indicator + forceUpdate({}); if (template.data?.content?.actionUrl) { try { @@ -155,7 +157,7 @@ export const ContentCardView: React.FC = ({ ); } } - }, [template, listener, isReadProp]); + }, [template, listener]); const imageUri = useMemo(() => { if (colorScheme === "dark" && template.data?.content?.image?.darkUrl) { @@ -314,7 +316,7 @@ export const ContentCardView: React.FC = ({ {...DismissButtonProps} /> )} - {containerSettings?.content?.isUnreadEnabled && !isRead && ( + {(containerSettings?.content?.isUnreadEnabled ?? true) && !isRead && ( )} diff --git a/packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.spec.tsx b/packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.spec.tsx new file mode 100644 index 00000000..920f8c4d --- /dev/null +++ b/packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.spec.tsx @@ -0,0 +1,625 @@ +/* + Copyright 2025 Adobe. All rights reserved. + This file is licensed to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law + or agreed to in writing, software distributed under the License is + distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF + ANY KIND, either express or implied. See the License for the specific + language governing permissions and limitations under the License. +*/ +import React from 'react'; +import { render } from '@testing-library/react-native'; +import { useColorScheme } from 'react-native'; +import UnreadIcon from './UnreadIcon'; +import ContentCardContainerProvider from '../../providers/ContentCardContainerProvider'; + +// Mock useColorScheme +jest.mock('react-native/Libraries/Utilities/useColorScheme'); +const mockUseColorScheme = useColorScheme as jest.MockedFunction< + typeof useColorScheme +>; + +describe('UnreadIcon', () => { + const mockContainerSettings = { + templateType: 'inbox' as const, + content: { + heading: { content: 'Test' }, + layout: { orientation: 'vertical' as const }, + capacity: 10, + emptyStateSettings: { message: { content: 'Empty' } }, + unread_indicator: { + unread_bg: { + clr: { + light: '#FFF3E0', + dark: '#2D1B0E', + }, + }, + unread_icon: { + placement: 'topright' as const, + image: { + url: 'https://example.com/icon.png', + darkUrl: '', + }, + }, + }, + isUnreadEnabled: true, + }, + showPagination: false, + }; + + beforeEach(() => { + jest.clearAllMocks(); + mockUseColorScheme.mockReturnValue('light'); + }); + + afterEach(() => { + jest.clearAllMocks(); + }); + + describe('Basic rendering', () => { + it('should render successfully with container settings', () => { + expect(() => { + render( + + + + ); + }).not.toThrow(); + }); + + it('should render with custom size', () => { + expect(() => { + render( + + + + ); + }).not.toThrow(); + }); + + it('should render without crashing when settings provide null', () => { + expect(() => { + render( + + + + ); + }).not.toThrow(); + }); + }); + + describe('Placement positions', () => { + it('should render with topright placement', () => { + expect(() => { + render( + + + + ); + }).not.toThrow(); + }); + + it('should render with topleft placement', () => { + const settings = { + ...mockContainerSettings, + content: { + ...mockContainerSettings.content, + unread_indicator: { + ...mockContainerSettings.content.unread_indicator, + unread_icon: { + ...mockContainerSettings.content.unread_indicator.unread_icon, + placement: 'topleft' as const, + }, + }, + }, + }; + + expect(() => { + render( + + + + ); + }).not.toThrow(); + }); + + it('should render with bottomright placement', () => { + const settings = { + ...mockContainerSettings, + content: { + ...mockContainerSettings.content, + unread_indicator: { + ...mockContainerSettings.content.unread_indicator, + unread_icon: { + ...mockContainerSettings.content.unread_indicator.unread_icon, + placement: 'bottomright' as const, + }, + }, + }, + }; + + expect(() => { + render( + + + + ); + }).not.toThrow(); + }); + + it('should render with bottomleft placement', () => { + const settings = { + ...mockContainerSettings, + content: { + ...mockContainerSettings.content, + unread_indicator: { + ...mockContainerSettings.content.unread_indicator, + unread_icon: { + ...mockContainerSettings.content.unread_indicator.unread_icon, + placement: 'bottomleft' as const, + }, + }, + }, + }; + + expect(() => { + render( + + + + ); + }).not.toThrow(); + }); + }); + + describe('Light mode rendering', () => { + beforeEach(() => { + mockUseColorScheme.mockReturnValue('light'); + }); + + it('should render in light mode with image URL', () => { + expect(() => { + render( + + + + ); + }).not.toThrow(); + }); + + it('should render dot when URL is empty string in light mode', () => { + const settings = { + ...mockContainerSettings, + content: { + ...mockContainerSettings.content, + unread_indicator: { + ...mockContainerSettings.content.unread_indicator, + unread_icon: { + ...mockContainerSettings.content.unread_indicator.unread_icon, + image: { + url: '', + darkUrl: '', + }, + }, + }, + }, + }; + + expect(() => { + render( + + + + ); + }).not.toThrow(); + }); + }); + + describe('Dark mode rendering', () => { + beforeEach(() => { + mockUseColorScheme.mockReturnValue('dark'); + }); + + it('should render in dark mode with darkUrl provided', () => { + const settings = { + ...mockContainerSettings, + content: { + ...mockContainerSettings.content, + unread_indicator: { + ...mockContainerSettings.content.unread_indicator, + unread_icon: { + ...mockContainerSettings.content.unread_indicator.unread_icon, + image: { + url: 'https://example.com/light.png', + darkUrl: 'https://example.com/dark.png', + }, + }, + }, + }, + }; + + expect(() => { + render( + + + + ); + }).not.toThrow(); + }); + + it('should render dot when darkUrl is empty string in dark mode', () => { + expect(() => { + render( + + + + ); + }).not.toThrow(); + }); + + it('should fallback to light mode image when no darkUrl provided', () => { + const settings = { + ...mockContainerSettings, + content: { + ...mockContainerSettings.content, + unread_indicator: { + ...mockContainerSettings.content.unread_indicator, + unread_icon: { + placement: 'topright' as const, + image: { + url: 'https://example.com/icon.png', + }, + }, + }, + }, + }; + + expect(() => { + render( + + + + ); + }).not.toThrow(); + }); + }); + + describe('Props-based rendering', () => { + it('should render with custom source prop when no settings provided', () => { + const settingsWithoutImage = { + ...mockContainerSettings, + content: { + ...mockContainerSettings.content, + unread_indicator: undefined, + }, + }; + + expect(() => { + render( + + + + ); + }).not.toThrow(); + }); + + it('should render with custom darkSource prop', () => { + mockUseColorScheme.mockReturnValue('dark'); + + const settingsWithoutImage = { + ...mockContainerSettings, + content: { + ...mockContainerSettings.content, + unread_indicator: undefined, + }, + }; + + expect(() => { + render( + + + + ); + }).not.toThrow(); + }); + + it('should render with custom position prop', () => { + const settingsWithoutImage = { + ...mockContainerSettings, + content: { + ...mockContainerSettings.content, + unread_indicator: undefined, + }, + }; + + expect(() => { + render( + + + + ); + }).not.toThrow(); + }); + + it('should render as dot when type prop is "dot"', () => { + const settingsWithoutImage = { + ...mockContainerSettings, + content: { + ...mockContainerSettings.content, + unread_indicator: undefined, + }, + }; + + expect(() => { + render( + + + + ); + }).not.toThrow(); + }); + + it('should render as image when type prop is "image"', () => { + const settingsWithoutImage = { + ...mockContainerSettings, + content: { + ...mockContainerSettings.content, + unread_indicator: undefined, + }, + }; + + expect(() => { + render( + + + + ); + }).not.toThrow(); + }); + }); + + describe('Custom styles', () => { + it('should accept and apply custom imageStyle', () => { + const customImageStyle = { opacity: 0.8 }; + + expect(() => { + render( + + + + ); + }).not.toThrow(); + }); + + it('should accept and apply custom containerStyle', () => { + const customContainerStyle = { padding: 5 }; + + expect(() => { + render( + + + + ); + }).not.toThrow(); + }); + + it('should handle both imageStyle and containerStyle together', () => { + expect(() => { + render( + + + + ); + }).not.toThrow(); + }); + }); + + describe('Size variations', () => { + it('should render with default size of 20', () => { + expect(() => { + render( + + + + ); + }).not.toThrow(); + }); + + it('should render with custom size of 30', () => { + expect(() => { + render( + + + + ); + }).not.toThrow(); + }); + + it('should render with custom size of 15', () => { + expect(() => { + render( + + + + ); + }).not.toThrow(); + }); + + it('should handle very large size', () => { + expect(() => { + render( + + + + ); + }).not.toThrow(); + }); + + it('should handle very small size', () => { + expect(() => { + render( + + + + ); + }).not.toThrow(); + }); + }); + + describe('Context settings priority', () => { + it('should prioritize context settings over props', () => { + expect(() => { + render( + + + + ); + }).not.toThrow(); + }); + + it('should use props when context settings are not available', () => { + const settingsWithoutImage = { + ...mockContainerSettings, + content: { + ...mockContainerSettings.content, + unread_indicator: undefined, + }, + }; + + expect(() => { + render( + + + + ); + }).not.toThrow(); + }); + }); + + describe('Image error handling', () => { + it('should render without crashing when image URL is invalid', () => { + const settings = { + ...mockContainerSettings, + content: { + ...mockContainerSettings.content, + unread_indicator: { + ...mockContainerSettings.content.unread_indicator, + unread_icon: { + ...mockContainerSettings.content.unread_indicator.unread_icon, + image: { + url: 'invalid-url', + darkUrl: '', + }, + }, + }, + }, + }; + + expect(() => { + render( + + + + ); + }).not.toThrow(); + }); + }); + + describe('Edge cases', () => { + it('should handle undefined image URLs', () => { + const settings = { + ...mockContainerSettings, + content: { + ...mockContainerSettings.content, + unread_indicator: { + ...mockContainerSettings.content.unread_indicator, + unread_icon: { + placement: 'topright' as const, + image: { + url: undefined as any, + darkUrl: undefined, + }, + }, + }, + }, + }; + + expect(() => { + render( + + + + ); + }).not.toThrow(); + }); + + it('should handle zero size', () => { + expect(() => { + render( + + + + ); + }).not.toThrow(); + }); + + it('should handle negative size', () => { + expect(() => { + render( + + + + ); + }).not.toThrow(); + }); + }); + + describe('Color scheme switching', () => { + it('should adapt to color scheme changes from light to dark', () => { + mockUseColorScheme.mockReturnValue('light'); + + const { rerender } = render( + + + + ); + + // Switch to dark mode + mockUseColorScheme.mockReturnValue('dark'); + + expect(() => { + rerender( + + + + ); + }).not.toThrow(); + }); + + it('should handle null color scheme', () => { + mockUseColorScheme.mockReturnValue(null); + + expect(() => { + render( + + + + ); + }).not.toThrow(); + }); + }); +}); \ No newline at end of file diff --git a/packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.test.tsx b/packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.test.tsx deleted file mode 100644 index 60263bae..00000000 --- a/packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.test.tsx +++ /dev/null @@ -1,325 +0,0 @@ -// /* -// Copyright 2025 Adobe. All rights reserved. -// This file is licensed to you under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. You may obtain a copy -// of the License at http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software distributed under -// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS -// OF ANY KIND, either express or implied. See the License for the specific language -// governing permissions and limitations under the License. -// */ - -// import React from 'react'; -// import renderer from 'react-test-renderer'; -// import { useColorScheme } from 'react-native'; -// import UnreadIcon from './UnreadIcon'; -// import ContentCardContainerProvider from '../../providers/ContentCardContainerProvider'; - -// // Mock useColorScheme -// jest.mock('react-native/Libraries/Utilities/useColorScheme', () => ({ -// default: jest.fn(), -// })); - -// const mockUseColorScheme = useColorScheme as jest.MockedFunction; - -// describe('UnreadIcon', () => { -// const mockContainerSettings = { -// templateType: 'inbox' as const, -// content: { -// heading: { content: 'Test' }, -// layout: { orientation: 'vertical' as const }, -// capacity: 10, -// emptyStateSettings: { message: { content: 'Empty' } }, -// unread_indicator: { -// unread_bg: { -// clr: { -// light: '#FFF3E0', -// dark: '#2D1B0E', -// }, -// }, -// unread_icon: { -// placement: 'topright' as const, -// image: { -// url: 'https://example.com/icon.png', -// darkUrl: '', -// }, -// }, -// }, -// isUnreadEnabled: true, -// }, -// showPagination: false, -// }; - -// beforeEach(() => { -// jest.clearAllMocks(); -// mockUseColorScheme.mockReturnValue('light'); -// }); - -// describe('Rendering', () => { -// it('should render successfully with container settings', () => { -// const component = renderer.create( -// -// -// -// ); - -// const tree = component.toJSON(); -// expect(tree).toBeTruthy(); -// }); - -// it('should render with custom size', () => { -// const component = renderer.create( -// -// -// -// ); - -// const tree = component.toJSON(); -// expect(tree).toBeTruthy(); -// }); -// }); - -// describe('Placement', () => { -// it('should render with topright placement', () => { -// const component = renderer.create( -// -// -// -// ); - -// const tree = component.toJSON(); -// expect(tree).toBeTruthy(); -// }); - -// it('should render with topleft placement', () => { -// const settings = { -// ...mockContainerSettings, -// content: { -// ...mockContainerSettings.content, -// unread_indicator: { -// ...mockContainerSettings.content.unread_indicator, -// unread_icon: { -// ...mockContainerSettings.content.unread_indicator.unread_icon, -// placement: 'topleft' as const, -// }, -// }, -// }, -// }; - -// const component = renderer.create( -// -// -// -// ); - -// const tree = component.toJSON(); -// expect(tree).toBeTruthy(); -// }); - -// it('should render with bottomright placement', () => { -// const settings = { -// ...mockContainerSettings, -// content: { -// ...mockContainerSettings.content, -// unread_indicator: { -// ...mockContainerSettings.content.unread_indicator, -// unread_icon: { -// ...mockContainerSettings.content.unread_indicator.unread_icon, -// placement: 'bottomright' as const, -// }, -// }, -// }, -// }; - -// const component = renderer.create( -// -// -// -// ); - -// const tree = component.toJSON(); -// expect(tree).toBeTruthy(); -// }); - -// it('should render with bottomleft placement', () => { -// const settings = { -// ...mockContainerSettings, -// content: { -// ...mockContainerSettings.content, -// unread_indicator: { -// ...mockContainerSettings.content.unread_indicator, -// unread_icon: { -// ...mockContainerSettings.content.unread_indicator.unread_icon, -// placement: 'bottomleft' as const, -// }, -// }, -// }, -// }; - -// const component = renderer.create( -// -// -// -// ); - -// const tree = component.toJSON(); -// expect(tree).toBeTruthy(); -// }); -// }); - -// describe('Light Mode', () => { -// beforeEach(() => { -// mockUseColorScheme.mockReturnValue('light'); -// }); - -// it('should render in light mode with image URL', () => { -// const component = renderer.create( -// -// -// -// ); - -// const tree = component.toJSON(); -// expect(tree).toBeTruthy(); -// }); - -// it('should render dot when URL is empty string in light mode', () => { -// const settings = { -// ...mockContainerSettings, -// content: { -// ...mockContainerSettings.content, -// unread_indicator: { -// ...mockContainerSettings.content.unread_indicator, -// unread_icon: { -// ...mockContainerSettings.content.unread_indicator.unread_icon, -// image: { -// url: '', -// darkUrl: '', -// }, -// }, -// }, -// }, -// }; - -// const component = renderer.create( -// -// -// -// ); - -// const tree = component.toJSON(); -// expect(tree).toBeTruthy(); -// }); -// }); - -// describe('Dark Mode', () => { -// beforeEach(() => { -// mockUseColorScheme.mockReturnValue('dark'); -// }); - -// it('should render in dark mode with darkUrl provided', () => { -// const settings = { -// ...mockContainerSettings, -// content: { -// ...mockContainerSettings.content, -// unread_indicator: { -// ...mockContainerSettings.content.unread_indicator, -// unread_icon: { -// ...mockContainerSettings.content.unread_indicator.unread_icon, -// image: { -// url: 'https://example.com/light.png', -// darkUrl: 'https://example.com/dark.png', -// }, -// }, -// }, -// }, -// }; - -// const component = renderer.create( -// -// -// -// ); - -// const tree = component.toJSON(); -// expect(tree).toBeTruthy(); -// }); - -// it('should render dot when darkUrl is empty string in dark mode', () => { -// const component = renderer.create( -// -// -// -// ); - -// const tree = component.toJSON(); -// expect(tree).toBeTruthy(); -// }); - -// it('should fallback to light mode image when no darkUrl provided', () => { -// const settings = { -// ...mockContainerSettings, -// content: { -// ...mockContainerSettings.content, -// unread_indicator: { -// ...mockContainerSettings.content.unread_indicator, -// unread_icon: { -// placement: 'topright' as const, -// image: { -// url: 'https://example.com/icon.png', -// }, -// }, -// }, -// }, -// }; - -// const component = renderer.create( -// -// -// -// ); - -// const tree = component.toJSON(); -// expect(tree).toBeTruthy(); -// }); -// }); - -// describe('Error Handling', () => { -// it('should throw error when used outside ContentCardContainerProvider', () => { -// // Suppress console.error for this test -// const consoleError = jest.spyOn(console, 'error').mockImplementation(() => {}); - -// expect(() => { -// renderer.create(); -// }).toThrow('useContainerSettings must be used within a ContentCardContainerProvider'); - -// consoleError.mockRestore(); -// }); -// }); - -// describe('Snapshot Tests', () => { -// it('should match snapshot for topright placement', () => { -// const component = renderer.create( -// -// -// -// ); - -// const tree = component.toJSON(); -// expect(tree).toMatchSnapshot(); -// }); - -// it('should match snapshot for dot in dark mode', () => { -// mockUseColorScheme.mockReturnValue('dark'); - -// const component = renderer.create( -// -// -// -// ); - -// const tree = component.toJSON(); -// expect(tree).toMatchSnapshot(); -// }); -// }); -// }); \ No newline at end of file diff --git a/packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.tsx b/packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.tsx index 5d23f8b4..fe2ef3b0 100644 --- a/packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.tsx +++ b/packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.tsx @@ -34,7 +34,12 @@ export interface UnreadIconProps extends ViewProps { type?: 'dot' | 'image'; } -const Dot = ({ size, backgroundColor }: { size: number; backgroundColor: string }) => ( +interface DotProps { + size: number; + backgroundColor: string; +} + +const Dot = ({ size, backgroundColor }: DotProps) => ( { + const positionStyle = useMemo(() => { switch (displayPosition) { case 'topleft': return styles.positionTopLeft; @@ -87,7 +92,7 @@ const UnreadIcon = ({ default: return styles.positionTopRight; } - }; + }, [displayPosition]); // Use default contrasting colors for visibility // Note: unread_bg.clr is for the card background, not the dot @@ -101,10 +106,12 @@ const UnreadIcon = ({ [colorScheme, darkImageSource, imageSource] ); - const renderContent = () => { + const content = useMemo(() => { // Check if we should show dot instead of image based on URL availability const shouldShowDot = - (colorScheme === 'dark' && unreadSettings?.unread_icon?.image?.darkUrl === '') || + (colorScheme === 'dark' && + (unreadSettings?.unread_icon?.image?.darkUrl === '' || + (!unreadSettings?.unread_icon?.image?.darkUrl && unreadSettings?.unread_icon?.image?.url === ''))) || (colorScheme === 'light' && unreadSettings?.unread_icon?.image?.url === ''); // If URL is explicitly empty string for current mode, show dot @@ -137,20 +144,31 @@ const UnreadIcon = ({ // Default dot type return ; - }; + }, [ + colorScheme, + unreadSettings?.unread_icon?.image, + size, + dotColor, + renderType, + imageLoadError, + imageSource, + darkImageSource, + finalImageSource, + imageStyle + ]); return ( - {renderContent()} + {content} ); }; diff --git a/packages/messaging/src/ui/providers/ContentCardContainerProvider.tsx b/packages/messaging/src/ui/providers/ContentCardContainerProvider.tsx index 40762733..d05e81e6 100644 --- a/packages/messaging/src/ui/providers/ContentCardContainerProvider.tsx +++ b/packages/messaging/src/ui/providers/ContentCardContainerProvider.tsx @@ -35,7 +35,8 @@ export interface ContainerSettings { }; }; }; - isUnreadEnabled: boolean; + /** Whether the unread feature is enabled. Defaults to true. */ + isUnreadEnabled?: boolean; }; showPagination?: boolean; } From 80d6595a9da713537b408ea101cfbf60ef59ae4e Mon Sep 17 00:00:00 2001 From: Calise Cheung Date: Wed, 8 Oct 2025 10:17:43 -0700 Subject: [PATCH 08/15] update for new comments update for the new comments --- packages/messaging/src/models/ContentCard.ts | 2 +- .../ContentCardView/ContentCardView.tsx | 27 ++++++------ .../ui/components/UnreadIcon/UnreadIcon.tsx | 41 ++++++++++++++----- .../ContentCardContainerProvider.tsx | 3 +- 4 files changed, 48 insertions(+), 25 deletions(-) diff --git a/packages/messaging/src/models/ContentCard.ts b/packages/messaging/src/models/ContentCard.ts index 595c4844..64732f88 100644 --- a/packages/messaging/src/models/ContentCard.ts +++ b/packages/messaging/src/models/ContentCard.ts @@ -72,7 +72,7 @@ export interface ContentCardData extends PropositionItemData { } export class ContentCard extends PropositionItem { data: ContentCardData['data']; - read: boolean = false; + isRead: boolean = false; constructor(contentCardData: ContentCardData) { super(contentCardData); diff --git a/packages/messaging/src/ui/components/ContentCardView/ContentCardView.tsx b/packages/messaging/src/ui/components/ContentCardView/ContentCardView.tsx index 7885905d..4b309cf6 100644 --- a/packages/messaging/src/ui/components/ContentCardView/ContentCardView.tsx +++ b/packages/messaging/src/ui/components/ContentCardView/ContentCardView.tsx @@ -103,24 +103,26 @@ export const ContentCardView: React.FC = ({ const isDisplayedRef = useRef(false); const theme = useTheme(); const containerSettings = useContainerSettings(); - // Force re-render when read state changes - const [, forceUpdate] = useState({}); + // Track read state in component state + const [isRead, setIsRead] = useState(template.isRead); - // Get read state from template - const isRead = template.read; + // Sync state when template changes + useEffect(() => { + setIsRead(template.isRead); + }, [template.isRead]); + + // Default to true if not specified + const isUnreadEnabled = containerSettings?.content?.isUnreadEnabled ?? true; // Get unread background color based on theme const unreadBackgroundColor = useMemo(() => { - // Default to true if not specified - const isUnreadEnabled = containerSettings?.content?.isUnreadEnabled ?? true; - if (!isUnreadEnabled || isRead || !containerSettings?.content?.unread_indicator?.unread_bg) { return undefined; } const unreadBg = containerSettings.content.unread_indicator.unread_bg; return colorScheme === 'dark' ? unreadBg.clr.dark : unreadBg.clr.light; - }, [containerSettings, isRead, colorScheme]); + }, [isUnreadEnabled, isRead, containerSettings, colorScheme]); const cardVariant = useMemo( () => variant ?? template.type ?? "SmallImage", @@ -142,10 +144,9 @@ export const ContentCardView: React.FC = ({ // Track interaction event using propositionItem template.track?.("content_clicked", MessagingEdgeEventType.INTERACT, null); - // Mark as read when interacted with (matches Android behavior) - template.read = true; - // Trigger re-render to update unread indicator - forceUpdate({}); + // Mark as read when interacted with + template.isRead = true; + setIsRead(true); if (template.data?.content?.actionUrl) { try { @@ -316,7 +317,7 @@ export const ContentCardView: React.FC = ({ {...DismissButtonProps} /> )} - {(containerSettings?.content?.isUnreadEnabled ?? true) && !isRead && ( + {isUnreadEnabled && !isRead && ( )} diff --git a/packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.tsx b/packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.tsx index fe2ef3b0..79805184 100644 --- a/packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.tsx +++ b/packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.tsx @@ -9,7 +9,7 @@ ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -import React, { useState, useMemo } from 'react'; +import React, { useState, useMemo, useEffect } from 'react'; import { Image, ImageProps, @@ -21,8 +21,7 @@ import { useColorScheme } from 'react-native'; import useContainerSettings from '../../hooks/useContainerSettings'; - -export type SettingsPlacement = 'topleft' | 'topright' | 'bottomleft' | 'bottomright'; +import { SettingsPlacement } from '../../providers/ContentCardContainerProvider'; export interface UnreadIconProps extends ViewProps { imageStyle?: ImageStyle; @@ -73,12 +72,26 @@ const UnreadIcon = ({ // Use settings from context with fallbacks to props const displayPosition = unreadSettings?.unread_icon?.placement ?? position; - const renderType = unreadSettings?.unread_icon?.image ? 'image' : type; + const imageSource = unreadSettings?.unread_icon?.image?.url ? { uri: unreadSettings.unread_icon.image.url } : source; const darkImageSource = unreadSettings?.unread_icon?.image?.darkUrl ? { uri: unreadSettings.unread_icon.image.darkUrl } : darkSource; + // Determine if we should render as image type (only if we have valid URLs) + const hasImageUrl = Boolean( + unreadSettings?.unread_icon?.image?.url || + unreadSettings?.unread_icon?.image?.darkUrl || + imageSource || + darkImageSource + ); + const renderType = hasImageUrl ? 'image' : type; + + // Reset error state when image source changes + useEffect(() => { + setImageLoadError(false); + }, [imageSource, darkImageSource]); + const positionStyle = useMemo(() => { switch (displayPosition) { case 'topleft': @@ -108,14 +121,22 @@ const UnreadIcon = ({ const content = useMemo(() => { // Check if we should show dot instead of image based on URL availability - const shouldShowDot = - (colorScheme === 'dark' && - (unreadSettings?.unread_icon?.image?.darkUrl === '' || - (!unreadSettings?.unread_icon?.image?.darkUrl && unreadSettings?.unread_icon?.image?.url === ''))) || - (colorScheme === 'light' && unreadSettings?.unread_icon?.image?.url === ''); + const isEmptyUrlForCurrentMode = () => { + const imageSettings = unreadSettings?.unread_icon?.image; + if (!imageSettings) return false; + + if (colorScheme === 'dark') { + // In dark mode, show dot if darkUrl is empty string or if both darkUrl doesn't exist and url is empty + return imageSettings.darkUrl === '' || + (!imageSettings.darkUrl && imageSettings.url === ''); + } + + // In light mode, show dot if url is empty string + return imageSettings.url === ''; + }; // If URL is explicitly empty string for current mode, show dot - if (shouldShowDot && unreadSettings?.unread_icon?.image) { + if (isEmptyUrlForCurrentMode()) { return ; } diff --git a/packages/messaging/src/ui/providers/ContentCardContainerProvider.tsx b/packages/messaging/src/ui/providers/ContentCardContainerProvider.tsx index d05e81e6..ebb83be5 100644 --- a/packages/messaging/src/ui/providers/ContentCardContainerProvider.tsx +++ b/packages/messaging/src/ui/providers/ContentCardContainerProvider.tsx @@ -1,5 +1,6 @@ import React, { createContext } from "react"; -import { SettingsPlacement } from "../components/UnreadIcon/UnreadIcon"; + +export type SettingsPlacement = 'topleft' | 'topright' | 'bottomleft' | 'bottomright'; export interface ContainerSettings { templateType: 'inbox' | 'banner' | 'custom'; From cdd17d7ff411d463cf4afd33d78af46d95c9a2a3 Mon Sep 17 00:00:00 2001 From: Calise Cheung Date: Wed, 8 Oct 2025 11:00:05 -0700 Subject: [PATCH 09/15] Update test Update test --- .../components/UnreadIcon/UnreadIcon.spec.tsx | 161 ++++++++++++++++-- 1 file changed, 146 insertions(+), 15 deletions(-) diff --git a/packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.spec.tsx b/packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.spec.tsx index 920f8c4d..64089a0c 100644 --- a/packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.spec.tsx +++ b/packages/messaging/src/ui/components/UnreadIcon/UnreadIcon.spec.tsx @@ -11,7 +11,7 @@ */ import React from 'react'; import { render } from '@testing-library/react-native'; -import { useColorScheme } from 'react-native'; +import { useColorScheme, Image } from 'react-native'; import UnreadIcon from './UnreadIcon'; import ContentCardContainerProvider from '../../providers/ContentCardContainerProvider'; @@ -60,23 +60,21 @@ describe('UnreadIcon', () => { describe('Basic rendering', () => { it('should render successfully with container settings', () => { - expect(() => { - render( - - - - ); - }).not.toThrow(); + const { getByTestId } = render( + + + + ); + expect(getByTestId('unread-icon')).toBeTruthy(); }); it('should render with custom size', () => { - expect(() => { - render( - - - - ); - }).not.toThrow(); + const { getByTestId } = render( + + + + ); + expect(getByTestId('unread-icon')).toBeTruthy(); }); it('should render without crashing when settings provide null', () => { @@ -622,4 +620,137 @@ describe('UnreadIcon', () => { }).not.toThrow(); }); }); + + describe('Behavioral verification', () => { + it('should render an Image when valid URL is provided', () => { + const { UNSAFE_getByType } = render( + + + + ); + + // Should render an Image component when URL is provided + expect(() => UNSAFE_getByType(Image)).not.toThrow(); + }); + + it('should render dot when image URLs are empty', () => { + const settings = { + ...mockContainerSettings, + content: { + ...mockContainerSettings.content, + unread_indicator: { + ...mockContainerSettings.content.unread_indicator, + unread_icon: { + ...mockContainerSettings.content.unread_indicator.unread_icon, + image: { + url: '', + darkUrl: '', + }, + }, + }, + }, + }; + + const { UNSAFE_queryByType } = render( + + + + ); + + // Should not render Image when URLs are empty + expect(UNSAFE_queryByType(Image)).toBeNull(); + }); + + it('should render image when source is provided even with type="dot"', () => { + const settingsWithoutImage = { + ...mockContainerSettings, + content: { + ...mockContainerSettings.content, + unread_indicator: undefined, + }, + }; + + const { UNSAFE_getByType } = render( + + + + ); + + // Should render Image when source is provided, even if type is "dot" + // The presence of source overrides the type prop + expect(() => UNSAFE_getByType(Image)).not.toThrow(); + }); + + it('should use darkUrl in dark mode when provided', () => { + mockUseColorScheme.mockReturnValue('dark'); + + const settings = { + ...mockContainerSettings, + content: { + ...mockContainerSettings.content, + unread_indicator: { + ...mockContainerSettings.content.unread_indicator, + unread_icon: { + placement: 'topright' as const, + image: { + url: 'https://example.com/light.png', + darkUrl: 'https://example.com/dark.png', + }, + }, + }, + }, + }; + + const { UNSAFE_getByType } = render( + + + + ); + + const imageComponent = UNSAFE_getByType(Image); + expect(imageComponent.props.source).toEqual({ uri: 'https://example.com/dark.png' }); + }); + + it('should fallback to light URL when no darkUrl in dark mode', () => { + mockUseColorScheme.mockReturnValue('dark'); + + const settings = { + ...mockContainerSettings, + content: { + ...mockContainerSettings.content, + unread_indicator: { + ...mockContainerSettings.content.unread_indicator, + unread_icon: { + placement: 'topright' as const, + image: { + url: 'https://example.com/light.png', + }, + }, + }, + }, + }; + + const { UNSAFE_getByType } = render( + + + + ); + + const imageComponent = UNSAFE_getByType(Image); + expect(imageComponent.props.source).toEqual({ uri: 'https://example.com/light.png' }); + }); + + it('should use light URL in light mode', () => { + mockUseColorScheme.mockReturnValue('light'); + + const { UNSAFE_getByType } = render( + + + + ); + + const imageComponent = UNSAFE_getByType(Image); + expect(imageComponent.props.source).toEqual({ uri: 'https://example.com/icon.png' }); + }); + }); }); \ No newline at end of file From 2fada50c68eb40bda2a983f20180366688c259d6 Mon Sep 17 00:00:00 2001 From: Calise Cheung Date: Wed, 8 Oct 2025 11:39:47 -0700 Subject: [PATCH 10/15] Update metro.config and dist files Update metro.config and dist files --- .../metro.config.js | 16 +- packages/messaging/dist/module/Messaging.js | 220 ++++++ .../messaging/dist/module/Messaging.js.map | 1 + packages/messaging/dist/module/index.js | 31 + packages/messaging/dist/module/index.js.map | 1 + .../dist/module/models/ContentCard.js | 23 + .../dist/module/models/ContentCard.js.map | 1 + .../dist/module/models/HTMLProposition.js | 22 + .../dist/module/models/HTMLProposition.js.map | 1 + .../dist/module/models/InAppMessage.js | 4 + .../dist/module/models/InAppMessage.js.map | 1 + .../dist/module/models/JSONProposition.js | 22 + .../dist/module/models/JSONProposition.js.map | 1 + .../messaging/dist/module/models/Message.js | 125 ++++ .../dist/module/models/Message.js.map | 1 + .../dist/module/models/MessagingDelegate.js | 4 + .../module/models/MessagingDelegate.js.map | 1 + .../module/models/MessagingEdgeEventType.js | 24 + .../models/MessagingEdgeEventType.js.map | 1 + .../module/models/MessagingProposition.js | 57 ++ .../module/models/MessagingProposition.js.map | 1 + .../module/models/MessagingPropositionItem.js | 4 + .../models/MessagingPropositionItem.js.map | 1 + .../module/models/PersonalizationSchema.js | 25 + .../models/PersonalizationSchema.js.map | 1 + .../dist/module/models/PropositionItem.js | 113 +++ .../dist/module/models/PropositionItem.js.map | 1 + .../dist/module/models/ScopeDetails.js | 2 + .../dist/module/models/ScopeDetails.js.map | 1 + .../messaging/dist/module/models/index.js | 13 + .../messaging/dist/module/models/index.js.map | 1 + .../module/ui/components/Button/Button.js | 49 ++ .../module/ui/components/Button/Button.js.map | 1 + .../ui/components/Button/Button.spec.js | 442 +++++++++++ .../ui/components/Button/Button.spec.js.map | 1 + .../components/CenteredView/CenteredView.js | 17 + .../CenteredView/CenteredView.js.map | 1 + .../ContentCardContainer.js | 96 +++ .../ContentCardContainer.js.map | 1 + .../ContentCardContainer/EmptyState.js | 16 + .../ContentCardContainer/EmptyState.js.map | 1 + .../ContentCardView/ContentCardView.js | 251 +++++++ .../ContentCardView/ContentCardView.js.map | 1 + .../components/DismissButton/DismissButton.js | 67 ++ .../DismissButton/DismissButton.js.map | 1 + .../DismissButton/DismissButton.spec.js | 284 ++++++++ .../DismissButton/DismissButton.spec.js.map | 1 + .../ui/components/Pagination/Pagination.js | 152 ++++ .../components/Pagination/Pagination.js.map | 1 + .../ui/components/UnreadIcon/UnreadIcon.js | 185 +++++ .../components/UnreadIcon/UnreadIcon.js.map | 1 + .../components/UnreadIcon/UnreadIcon.spec.js | 689 ++++++++++++++++++ .../UnreadIcon/UnreadIcon.spec.js.map | 1 + .../dist/module/ui/components/index.js | 22 + .../dist/module/ui/components/index.js.map | 1 + .../messaging/dist/module/ui/hooks/index.js | 6 + .../dist/module/ui/hooks/index.js.map | 1 + .../dist/module/ui/hooks/useAspectRatio.js | 21 + .../module/ui/hooks/useAspectRatio.js.map | 1 + .../module/ui/hooks/useContainerSettings.js | 10 + .../ui/hooks/useContainerSettings.js.map | 1 + .../dist/module/ui/hooks/useContentCardUI.js | 39 + .../module/ui/hooks/useContentCardUI.js.map | 1 + .../module/ui/hooks/useContentContainer.js | 31 + .../ui/hooks/useContentContainer.js.map | 1 + packages/messaging/dist/module/ui/index.js | 9 + .../messaging/dist/module/ui/index.js.map | 1 + .../providers/ContentCardContainerProvider.js | 14 + .../ContentCardContainerProvider.js.map | 1 + .../messaging/dist/module/ui/theme/Theme.js | 2 + .../dist/module/ui/theme/Theme.js.map | 1 + .../dist/module/ui/theme/ThemeProvider.js | 95 +++ .../dist/module/ui/theme/ThemeProvider.js.map | 1 + .../messaging/dist/module/ui/theme/index.js | 5 + .../dist/module/ui/theme/index.js.map | 1 + .../dist/module/ui/types/ContentViewEvent.js | 2 + .../module/ui/types/ContentViewEvent.js.map | 1 + .../dist/module/ui/types/Templates.js | 14 + .../dist/module/ui/types/Templates.js.map | 1 + .../messaging/dist/module/ui/types/index.js | 5 + .../dist/module/ui/types/index.js.map | 1 + .../dist/typescript/models/ContentCard.d.ts | 1 + .../typescript/models/ContentCard.d.ts.map | 2 +- .../ContentCardView/ContentCardView.d.ts | 1 - .../ContentCardView/ContentCardView.d.ts.map | 2 +- .../ui/components/UnreadIcon/UnreadIcon.d.ts | 2 +- .../components/UnreadIcon/UnreadIcon.d.ts.map | 2 +- .../UnreadIcon/UnreadIcon.spec.d.ts | 2 + .../UnreadIcon/UnreadIcon.spec.d.ts.map | 1 + .../UnreadIcon/UnreadIcon.test.d.ts | 2 - .../UnreadIcon/UnreadIcon.test.d.ts.map | 1 - .../ContentCardContainerProvider.d.ts | 5 +- .../ContentCardContainerProvider.d.ts.map | 2 +- 93 files changed, 3267 insertions(+), 24 deletions(-) create mode 100644 packages/messaging/dist/module/Messaging.js create mode 100644 packages/messaging/dist/module/Messaging.js.map create mode 100644 packages/messaging/dist/module/index.js create mode 100644 packages/messaging/dist/module/index.js.map create mode 100644 packages/messaging/dist/module/models/ContentCard.js create mode 100644 packages/messaging/dist/module/models/ContentCard.js.map create mode 100644 packages/messaging/dist/module/models/HTMLProposition.js create mode 100644 packages/messaging/dist/module/models/HTMLProposition.js.map create mode 100644 packages/messaging/dist/module/models/InAppMessage.js create mode 100644 packages/messaging/dist/module/models/InAppMessage.js.map create mode 100644 packages/messaging/dist/module/models/JSONProposition.js create mode 100644 packages/messaging/dist/module/models/JSONProposition.js.map create mode 100644 packages/messaging/dist/module/models/Message.js create mode 100644 packages/messaging/dist/module/models/Message.js.map create mode 100644 packages/messaging/dist/module/models/MessagingDelegate.js create mode 100644 packages/messaging/dist/module/models/MessagingDelegate.js.map create mode 100644 packages/messaging/dist/module/models/MessagingEdgeEventType.js create mode 100644 packages/messaging/dist/module/models/MessagingEdgeEventType.js.map create mode 100644 packages/messaging/dist/module/models/MessagingProposition.js create mode 100644 packages/messaging/dist/module/models/MessagingProposition.js.map create mode 100644 packages/messaging/dist/module/models/MessagingPropositionItem.js create mode 100644 packages/messaging/dist/module/models/MessagingPropositionItem.js.map create mode 100644 packages/messaging/dist/module/models/PersonalizationSchema.js create mode 100644 packages/messaging/dist/module/models/PersonalizationSchema.js.map create mode 100644 packages/messaging/dist/module/models/PropositionItem.js create mode 100644 packages/messaging/dist/module/models/PropositionItem.js.map create mode 100644 packages/messaging/dist/module/models/ScopeDetails.js create mode 100644 packages/messaging/dist/module/models/ScopeDetails.js.map create mode 100644 packages/messaging/dist/module/models/index.js create mode 100644 packages/messaging/dist/module/models/index.js.map create mode 100644 packages/messaging/dist/module/ui/components/Button/Button.js create mode 100644 packages/messaging/dist/module/ui/components/Button/Button.js.map create mode 100644 packages/messaging/dist/module/ui/components/Button/Button.spec.js create mode 100644 packages/messaging/dist/module/ui/components/Button/Button.spec.js.map create mode 100644 packages/messaging/dist/module/ui/components/CenteredView/CenteredView.js create mode 100644 packages/messaging/dist/module/ui/components/CenteredView/CenteredView.js.map create mode 100644 packages/messaging/dist/module/ui/components/ContentCardContainer/ContentCardContainer.js create mode 100644 packages/messaging/dist/module/ui/components/ContentCardContainer/ContentCardContainer.js.map create mode 100644 packages/messaging/dist/module/ui/components/ContentCardContainer/EmptyState.js create mode 100644 packages/messaging/dist/module/ui/components/ContentCardContainer/EmptyState.js.map create mode 100644 packages/messaging/dist/module/ui/components/ContentCardView/ContentCardView.js create mode 100644 packages/messaging/dist/module/ui/components/ContentCardView/ContentCardView.js.map create mode 100644 packages/messaging/dist/module/ui/components/DismissButton/DismissButton.js create mode 100644 packages/messaging/dist/module/ui/components/DismissButton/DismissButton.js.map create mode 100644 packages/messaging/dist/module/ui/components/DismissButton/DismissButton.spec.js create mode 100644 packages/messaging/dist/module/ui/components/DismissButton/DismissButton.spec.js.map create mode 100644 packages/messaging/dist/module/ui/components/Pagination/Pagination.js create mode 100644 packages/messaging/dist/module/ui/components/Pagination/Pagination.js.map create mode 100644 packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.js create mode 100644 packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.js.map create mode 100644 packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.spec.js create mode 100644 packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.spec.js.map create mode 100644 packages/messaging/dist/module/ui/components/index.js create mode 100644 packages/messaging/dist/module/ui/components/index.js.map create mode 100644 packages/messaging/dist/module/ui/hooks/index.js create mode 100644 packages/messaging/dist/module/ui/hooks/index.js.map create mode 100644 packages/messaging/dist/module/ui/hooks/useAspectRatio.js create mode 100644 packages/messaging/dist/module/ui/hooks/useAspectRatio.js.map create mode 100644 packages/messaging/dist/module/ui/hooks/useContainerSettings.js create mode 100644 packages/messaging/dist/module/ui/hooks/useContainerSettings.js.map create mode 100644 packages/messaging/dist/module/ui/hooks/useContentCardUI.js create mode 100644 packages/messaging/dist/module/ui/hooks/useContentCardUI.js.map create mode 100644 packages/messaging/dist/module/ui/hooks/useContentContainer.js create mode 100644 packages/messaging/dist/module/ui/hooks/useContentContainer.js.map create mode 100644 packages/messaging/dist/module/ui/index.js create mode 100644 packages/messaging/dist/module/ui/index.js.map create mode 100644 packages/messaging/dist/module/ui/providers/ContentCardContainerProvider.js create mode 100644 packages/messaging/dist/module/ui/providers/ContentCardContainerProvider.js.map create mode 100644 packages/messaging/dist/module/ui/theme/Theme.js create mode 100644 packages/messaging/dist/module/ui/theme/Theme.js.map create mode 100644 packages/messaging/dist/module/ui/theme/ThemeProvider.js create mode 100644 packages/messaging/dist/module/ui/theme/ThemeProvider.js.map create mode 100644 packages/messaging/dist/module/ui/theme/index.js create mode 100644 packages/messaging/dist/module/ui/theme/index.js.map create mode 100644 packages/messaging/dist/module/ui/types/ContentViewEvent.js create mode 100644 packages/messaging/dist/module/ui/types/ContentViewEvent.js.map create mode 100644 packages/messaging/dist/module/ui/types/Templates.js create mode 100644 packages/messaging/dist/module/ui/types/Templates.js.map create mode 100644 packages/messaging/dist/module/ui/types/index.js create mode 100644 packages/messaging/dist/module/ui/types/index.js.map create mode 100644 packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.spec.d.ts create mode 100644 packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.spec.d.ts.map delete mode 100644 packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.test.d.ts delete mode 100644 packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.test.d.ts.map diff --git a/apps/AEPSampleAppNewArchEnabled/metro.config.js b/apps/AEPSampleAppNewArchEnabled/metro.config.js index bc0609f4..bcc3133b 100644 --- a/apps/AEPSampleAppNewArchEnabled/metro.config.js +++ b/apps/AEPSampleAppNewArchEnabled/metro.config.js @@ -16,12 +16,6 @@ config.resolver.nodeModulesPaths = [ path.resolve(monorepoRoot, 'node_modules'), ]; -// Force React and React Native to resolve from app's node_modules -config.resolver.extraNodeModules = { - 'react': path.resolve(projectRoot, 'node_modules/react'), - 'react-native': path.resolve(projectRoot, 'node_modules/react-native'), -}; - // Exclude problematic nested node_modules to prevent the bundling error config.resolver.blockList = [ // Block nested node_modules inside packages @@ -31,8 +25,7 @@ config.resolver.blockList = [ ]; // Don't try to transpile react-native's internal source files -config.resolver.disableHierarchicalLookup = false; - +config.resolver.disableHierarchicalLookup = true; // Use a separate cache for the monorepo to avoid conflicts config.cacheStores = [ new FileStore({ @@ -40,7 +33,7 @@ config.cacheStores = [ }), ]; -// Explicitly map workspace packages - Metro will use their package.json "react-native" field +// Explicitly map workspace packages to their built versions config.resolver.alias = { '@adobe/react-native-aepassurance': path.resolve(monorepoRoot, 'packages/assurance'), '@adobe/react-native-aepcampaignclassic': path.resolve(monorepoRoot, 'packages/campaignclassic'), @@ -54,9 +47,6 @@ config.resolver.alias = { '@adobe/react-native-aepplaces': path.resolve(monorepoRoot, 'packages/places'), '@adobe/react-native-aeptarget': path.resolve(monorepoRoot, 'packages/target'), '@adobe/react-native-aepuserprofile': path.resolve(monorepoRoot, 'packages/userprofile'), - // Ensure React is resolved from app's node_modules to avoid multiple instances - 'react': path.resolve(projectRoot, 'node_modules/react'), - 'react-native': path.resolve(projectRoot, 'node_modules/react-native'), }; -module.exports = config; +module.exports = config; \ No newline at end of file diff --git a/packages/messaging/dist/module/Messaging.js b/packages/messaging/dist/module/Messaging.js new file mode 100644 index 00000000..2e19e18d --- /dev/null +++ b/packages/messaging/dist/module/Messaging.js @@ -0,0 +1,220 @@ +"use strict"; + +/* +Copyright 2024 Adobe. All rights reserved. +This file is licensed to you under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. You may obtain a copy +of the License at http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software distributed under +the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS +OF ANY KIND, either express or implied. See the License for the specific language +governing permissions and limitations under the License. +*/ + +import { NativeModules, NativeEventEmitter, Platform } from "react-native"; +import Message from "./models/Message.js"; +import { MessagingProposition } from "./models/MessagingProposition.js"; +import { PersonalizationSchema } from "./models/PersonalizationSchema.js"; +import { ContentTemplate } from "./ui/types/Templates.js"; +const RCTAEPMessaging = NativeModules.AEPMessaging; +var messagingDelegate; +class Messaging { + /** + * Returns the version of the AEPMessaging extension + * @returns {string} Promise a promise that resolves with the extension version + */ + static extensionVersion() { + return Promise.resolve(RCTAEPMessaging.extensionVersion()); + } + + /** + * Initiates a network call to retrieve remote In-App Message definitions. + */ + static refreshInAppMessages() { + RCTAEPMessaging.refreshInAppMessages(); + } + + /** + * Retrieves the list of messages which have been cached using the `shouldSaveMessage` + * method of the messaging delegate. + * Note: Messages should be cached before trying to use any of the methods on the message class + * @returns An array of messages that have been cached + */ + static async getCachedMessages() { + const messages = await RCTAEPMessaging.getCachedMessages(); + return messages.map(msg => new Message(msg)); + } + + /** + * Retrieves the last message that has been shown in the UI + * @returns The latest message to have been displayed + */ + static async getLatestMessage() { + const message = await RCTAEPMessaging.getLatestMessage(); + return message ? new Message(message) : undefined; + } + + /** + * Retrieves the previously fetched (and cached) feeds content from the SDK for the provided surfaces. + * 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. + * @param surfaces A list of surfaces to fetch + * @returns A record of surface names with their corresponding propositions + */ + static async getPropositionsForSurfaces(surfaces) { + const propositionsList = await RCTAEPMessaging.getPropositionsForSurfaces(surfaces); + let messagingPropositionsForSurfaces = {}; + for (const [surface, propositions] of Object.entries(propositionsList)) { + messagingPropositionsForSurfaces[surface] = propositions.map(proposition => new MessagingProposition(proposition)); + } + return messagingPropositionsForSurfaces; + } + + /** + * @deprecated Use PropositionItem.track(...) instead. + */ + static trackContentCardDisplay(proposition, contentCard) { + RCTAEPMessaging.trackContentCardDisplay(proposition, contentCard); + } + + /** + * @deprecated Use PropositionItem.track(...) instead. + */ + static trackContentCardInteraction(proposition, contentCard) { + RCTAEPMessaging.trackContentCardInteraction(proposition, contentCard); + } + + /** + * Tracks interactions with a PropositionItem using the provided interaction and event type. + * This method is used internally by the PropositionItem.track() method. + * + * @param {string} itemId - The unique identifier of the PropositionItem + * @param {string | null} interaction - A custom string value to be recorded in the interaction + * @param {number} eventType - The MessagingEdgeEventType numeric value + * @param {string[] | null} tokens - Array containing the sub-item tokens for recording interaction + */ + static trackPropositionItem(itemId, interaction, eventType, tokens) { + RCTAEPMessaging.trackPropositionItem(itemId, interaction, eventType, tokens); + } + + /** + * Function to set the UI Message delegate to listen the Message lifecycle events. + * @returns A function to unsubscribe from all event listeners + */ + static setMessagingDelegate(delegate) { + messagingDelegate = delegate; + const eventEmitter = new NativeEventEmitter(RCTAEPMessaging); + eventEmitter.addListener("onShow", message => messagingDelegate?.onShow?.(new Message(message))); + eventEmitter.addListener("onDismiss", message => { + const messageInstance = new Message(message); + messageInstance._clearJavascriptMessageHandlers(); + messagingDelegate?.onDismiss?.(messageInstance); + }); + eventEmitter.addListener("shouldShowMessage", message => { + const messageInstance = new Message(message); + const shouldShowMessage = messagingDelegate?.shouldShowMessage?.(messageInstance) ?? true; + const shouldSaveMessage = messagingDelegate?.shouldSaveMessage?.(messageInstance) ?? false; + RCTAEPMessaging.setMessageSettings(shouldShowMessage, shouldSaveMessage); + }); + if (Platform.OS === "ios") { + eventEmitter.addListener("urlLoaded", event => messagingDelegate?.urlLoaded?.(event.url, new Message(event.message))); + } + if (Platform.OS === "android") { + eventEmitter.addListener("onContentLoaded", event => messagingDelegate?.onContentLoaded?.(new Message(event.message))); + } + RCTAEPMessaging.setMessagingDelegate(); + return () => { + eventEmitter.removeAllListeners("onDismiss"); + eventEmitter.removeAllListeners("onShow"); + eventEmitter.removeAllListeners("shouldShowMessage"); + if (Platform.OS === "ios") { + eventEmitter.removeAllListeners("urlLoaded"); + } + if (Platform.OS === "android") { + eventEmitter.removeAllListeners("onContentLoaded"); + } + }; + } + + /** + * Sets global settings for messages being shown and cached + * Note: This method is also used by MessagingDelegate.shouldShowMessage, + * which allows finer-grained control over setting these settings + * @param shouldShowMessage Whether or not a message should be displayed + * @param shouldSaveMessage Whether or not a message should be cached + */ + static setMessageSettings(shouldShowMessage, shouldSaveMessage) { + RCTAEPMessaging.setMessageSettings(shouldShowMessage, shouldSaveMessage); + } + + /** + * Dispatches an event to fetch propositions for the provided surfaces from remote. + * @param surfaces A list of surface names to update + */ + static async updatePropositionsForSurfaces(surfaces) { + return await RCTAEPMessaging.updatePropositionsForSurfaces(surfaces); + } + + /** + * @experimental + * Retrieves the content card UI data for a given surface. + * @param surface The surface to get the content card UI data for + * @returns The content card UI data for the given surface + */ + static async getContentCardUI(surface) { + const messages = await Messaging.getPropositionsForSurfaces([surface]); + const propositions = messages[surface]; + if (!propositions?.length) { + return []; + } + const contentCards = propositions.flatMap(proposition => proposition.items.filter(item => item.schema === PersonalizationSchema.CONTENT_CARD)); + if (!contentCards?.length) { + return []; + } + return contentCards.map(card => { + const type = card.data?.meta?.adobe?.template ?? "SmallImage"; + return new ContentTemplate(card, type); + }); + } + static async getContentCardContainer(surface) { + console.log("getContentCardContainer", surface); + return { + templateType: "inbox", + content: { + heading: { + content: "Heading" + }, + layout: { + orientation: "horizontal" + }, + capacity: 10, + emptyStateSettings: { + message: { + content: "Empty State" + } + }, + unread_indicator: { + unread_bg: { + clr: { + light: "#FFF3E0", + // Light orange background for unread cards + dark: "#2D1B0E" // Dark orange background for unread cards + } + }, + unread_icon: { + placement: "topright", + image: { + url: "https://icons.veryicon.com/png/o/leisure/crisp-app-icon-library-v3/notification-5.png", + // Image in light mode + darkUrl: "" // Empty URL = shows dot in dark mode + } + } + }, + isUnreadEnabled: true // Enable unread features! + }, + showPagination: false + }; + } +} +export default Messaging; +//# sourceMappingURL=Messaging.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/Messaging.js.map b/packages/messaging/dist/module/Messaging.js.map new file mode 100644 index 00000000..548852ca --- /dev/null +++ b/packages/messaging/dist/module/Messaging.js.map @@ -0,0 +1 @@ +{"version":3,"names":["NativeModules","NativeEventEmitter","Platform","Message","MessagingProposition","PersonalizationSchema","ContentTemplate","RCTAEPMessaging","AEPMessaging","messagingDelegate","Messaging","extensionVersion","Promise","resolve","refreshInAppMessages","getCachedMessages","messages","map","msg","getLatestMessage","message","undefined","getPropositionsForSurfaces","surfaces","propositionsList","messagingPropositionsForSurfaces","surface","propositions","Object","entries","proposition","trackContentCardDisplay","contentCard","trackContentCardInteraction","trackPropositionItem","itemId","interaction","eventType","tokens","setMessagingDelegate","delegate","eventEmitter","addListener","onShow","messageInstance","_clearJavascriptMessageHandlers","onDismiss","shouldShowMessage","shouldSaveMessage","setMessageSettings","OS","event","urlLoaded","url","onContentLoaded","removeAllListeners","updatePropositionsForSurfaces","getContentCardUI","length","contentCards","flatMap","items","filter","item","schema","CONTENT_CARD","card","type","data","meta","adobe","template","getContentCardContainer","console","log","templateType","content","heading","layout","orientation","capacity","emptyStateSettings","unread_indicator","unread_bg","clr","light","dark","unread_icon","placement","image","darkUrl","isUnreadEnabled","showPagination"],"sourceRoot":"../../src","sources":["Messaging.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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C,OAAO,EAAE;UACPD,OAAO,EAAE;QACX,CAAC;QACDE,MAAM,EAAE;UACNC,WAAW,EAAE;QACf,CAAC;QACDC,QAAQ,EAAE,EAAE;QACZC,kBAAkB,EAAE;UAClB7D,OAAO,EAAE;YACPwD,OAAO,EAAE;UACX;QACF,CAAC;QACDM,gBAAgB,EAAE;UAChBC,SAAS,EAAE;YACTC,GAAG,EAAE;cACHC,KAAK,EAAE,SAAS;cAAG;cACnBC,IAAI,EAAE,SAAS,CAAI;YACrB;UACF,CAAC;UACDC,WAAW,EAAE;YACXC,SAAS,EAAE,UAAU;YACrBC,KAAK,EAAE;cACLpC,GAAG,EAAE,uFAAuF;cAAG;cAC/FqC,OAAO,EAAE,EAAE,CAAG;YAChB;UACF;QACF,CAAC;QACDC,eAAe,EAAE,IAAI,CAAG;MAC1B,CAAC;MACDC,cAAc,EAAE;IAClB,CAAC;EACH;AACF;AAEA,eAAelF,SAAS","ignoreList":[]} diff --git a/packages/messaging/dist/module/index.js b/packages/messaging/dist/module/index.js new file mode 100644 index 00000000..d8a01be2 --- /dev/null +++ b/packages/messaging/dist/module/index.js @@ -0,0 +1,31 @@ +"use strict"; + +/* +Copyright 2023 Adobe. All rights reserved. +This file is licensed to you under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. You may obtain a copy +of the License at http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software distributed under +the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS +OF ANY KIND, either express or implied. See the License for the specific language +governing permissions and limitations under the License. +*/ + +import Messaging from "./Messaging.js"; +import { ContentCard, ContentCardData } from "./models/ContentCard.js"; +import { InAppMessage } from "./models/InAppMessage.js"; +import { HTMLProposition, HTMLPropositionData } from "./models/HTMLProposition.js"; +import { JSONPropositionItem, JSONPropositionData } from "./models/JSONProposition.js"; +import Message from "./models/Message.js"; +import { MessagingDelegate } from "./models/MessagingDelegate.js"; +import MessagingEdgeEventType from "./models/MessagingEdgeEventType.js"; +import { MessagingProposition } from "./models/MessagingProposition.js"; +import { MessagingPropositionItem } from "./models/MessagingPropositionItem.js"; +import { PersonalizationSchema } from "./models/PersonalizationSchema.js"; +import { PropositionItem, PropositionItemData } from "./models/PropositionItem.js"; +import { Activity, Characteristics } from "./models/ScopeDetails.js"; +export * from "./models/ContentCard.js"; +export * from "./ui/index.js"; +export { Activity, Characteristics, ContentCard, ContentCardData, InAppMessage, Messaging, Message, MessagingDelegate, MessagingEdgeEventType, MessagingProposition, MessagingPropositionItem, PersonalizationSchema, PropositionItem, PropositionItemData, HTMLProposition, HTMLPropositionData, JSONPropositionItem, JSONPropositionData }; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/index.js.map b/packages/messaging/dist/module/index.js.map new file mode 100644 index 00000000..324835aa --- /dev/null +++ b/packages/messaging/dist/module/index.js.map @@ -0,0 +1 @@ +{"version":3,"names":["Messaging","ContentCard","ContentCardData","InAppMessage","HTMLProposition","HTMLPropositionData","JSONPropositionItem","JSONPropositionData","Message","MessagingDelegate","MessagingEdgeEventType","MessagingProposition","MessagingPropositionItem","PersonalizationSchema","PropositionItem","PropositionItemData","Activity","Characteristics"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,SAAS,MAAM,gBAAa;AACnC,SAASC,WAAW,EAAEC,eAAe,QAAQ,yBAAsB;AAEnE,SAASC,YAAY,QAAQ,0BAAuB;AACpD,SAASC,eAAe,EAAEC,mBAAmB,QAAQ,6BAA0B;AAC/E,SAASC,mBAAmB,EAAEC,mBAAmB,QAAQ,6BAA0B;AAEnF,OAAOC,OAAO,MAAM,qBAAkB;AACtC,SAASC,iBAAiB,QAAQ,+BAA4B;AAC9D,OAAOC,sBAAsB,MAAM,oCAAiC;AACpE,SAASC,oBAAoB,QAAQ,kCAA+B;AACpE,SAASC,wBAAwB,QAAQ,sCAAmC;AAC5E,SAASC,qBAAqB,QAAQ,mCAAgC;AACtE,SAASC,eAAe,EAAEC,mBAAmB,QAAQ,6BAA0B;AAC/E,SAASC,QAAQ,EAAEC,eAAe,QAAQ,0BAAuB;AAEjE,cAAc,yBAAsB;AACpC,cAAc,eAAM;AAEpB,SACED,QAAQ,EACRC,eAAe,EACfhB,WAAW,EACXC,eAAe,EACfC,YAAY,EACZH,SAAS,EACTQ,OAAO,EACPC,iBAAiB,EACjBC,sBAAsB,EACtBC,oBAAoB,EACpBC,wBAAwB,EACxBC,qBAAqB,EACrBC,eAAe,EACfC,mBAAmB,EACnBX,eAAe,EACfC,mBAAmB,EACnBC,mBAAmB,EACnBC,mBAAmB","ignoreList":[]} diff --git a/packages/messaging/dist/module/models/ContentCard.js b/packages/messaging/dist/module/models/ContentCard.js new file mode 100644 index 00000000..05de6c70 --- /dev/null +++ b/packages/messaging/dist/module/models/ContentCard.js @@ -0,0 +1,23 @@ +"use strict"; + +/* + Copyright 2024 Adobe. All rights reserved. + This file is licensed to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law + or agreed to in writing, software distributed under the License is + distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF + ANY KIND, either express or implied. See the License for the specific + language governing permissions and limitations under the License. +*/ + +import { PropositionItem } from "./PropositionItem.js"; +export class ContentCard extends PropositionItem { + isRead = false; + constructor(contentCardData) { + super(contentCardData); + this.data = contentCardData.data; + } +} +//# sourceMappingURL=ContentCard.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/models/ContentCard.js.map b/packages/messaging/dist/module/models/ContentCard.js.map new file mode 100644 index 00000000..812ac2af --- /dev/null +++ b/packages/messaging/dist/module/models/ContentCard.js.map @@ -0,0 +1 @@ +{"version":3,"names":["PropositionItem","ContentCard","isRead","constructor","contentCardData","data"],"sourceRoot":"../../../src","sources":["models/ContentCard.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,eAAe,QAA6B,sBAAmB;AA2DxE,OAAO,MAAMC,WAAW,SAASD,eAAe,CAAC;EAE/CE,MAAM,GAAY,KAAK;EAEvBC,WAAWA,CAACC,eAAgC,EAAE;IAC5C,KAAK,CAACA,eAAe,CAAC;IACtB,IAAI,CAACC,IAAI,GAAGD,eAAe,CAACC,IAAI;EAClC;AACF","ignoreList":[]} diff --git a/packages/messaging/dist/module/models/HTMLProposition.js b/packages/messaging/dist/module/models/HTMLProposition.js new file mode 100644 index 00000000..db412f58 --- /dev/null +++ b/packages/messaging/dist/module/models/HTMLProposition.js @@ -0,0 +1,22 @@ +"use strict"; + +/* + Copyright 2024 Adobe. All rights reserved. + This file is licensed to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law + or agreed to in writing, software distributed under the License is + distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF + ANY KIND, either express or implied. See the License for the specific + language governing permissions and limitations under the License. +*/ + +import { PropositionItem } from "./PropositionItem.js"; +export class HTMLProposition extends PropositionItem { + constructor(htmlData) { + super(htmlData); + this.data = htmlData.data; + } +} +//# sourceMappingURL=HTMLProposition.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/models/HTMLProposition.js.map b/packages/messaging/dist/module/models/HTMLProposition.js.map new file mode 100644 index 00000000..07b4cdc3 --- /dev/null +++ b/packages/messaging/dist/module/models/HTMLProposition.js.map @@ -0,0 +1 @@ +{"version":3,"names":["PropositionItem","HTMLProposition","constructor","htmlData","data"],"sourceRoot":"../../../src","sources":["models/HTMLProposition.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,eAAe,QAA6B,sBAAmB;AASxE,OAAO,MAAMC,eAAe,SAASD,eAAe,CAAC;EAGpDE,WAAWA,CAACC,QAA6B,EAAE;IAC1C,KAAK,CAACA,QAAQ,CAAC;IACf,IAAI,CAACC,IAAI,GAAGD,QAAQ,CAACC,IAAI;EAC1B;AACD","ignoreList":[]} diff --git a/packages/messaging/dist/module/models/InAppMessage.js b/packages/messaging/dist/module/models/InAppMessage.js new file mode 100644 index 00000000..76b49777 --- /dev/null +++ b/packages/messaging/dist/module/models/InAppMessage.js @@ -0,0 +1,4 @@ +"use strict"; + +export {}; +//# sourceMappingURL=InAppMessage.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/models/InAppMessage.js.map b/packages/messaging/dist/module/models/InAppMessage.js.map new file mode 100644 index 00000000..dd6a2851 --- /dev/null +++ b/packages/messaging/dist/module/models/InAppMessage.js.map @@ -0,0 +1 @@ +{"version":3,"names":[],"sourceRoot":"../../../src","sources":["models/InAppMessage.ts"],"mappings":"","ignoreList":[]} diff --git a/packages/messaging/dist/module/models/JSONProposition.js b/packages/messaging/dist/module/models/JSONProposition.js new file mode 100644 index 00000000..2c6c8e6b --- /dev/null +++ b/packages/messaging/dist/module/models/JSONProposition.js @@ -0,0 +1,22 @@ +"use strict"; + +/* + Copyright 2024 Adobe. All rights reserved. + This file is licensed to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law + or agreed to in writing, software distributed under the License is + distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF + ANY KIND, either express or implied. See the License for the specific + language governing permissions and limitations under the License. +*/ + +import { PropositionItem } from "./PropositionItem.js"; +export class JSONPropositionItem extends PropositionItem { + constructor(jsonData) { + super(jsonData); + this.data = jsonData.data; + } +} +//# sourceMappingURL=JSONProposition.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/models/JSONProposition.js.map b/packages/messaging/dist/module/models/JSONProposition.js.map new file mode 100644 index 00000000..2e0456f3 --- /dev/null +++ b/packages/messaging/dist/module/models/JSONProposition.js.map @@ -0,0 +1 @@ +{"version":3,"names":["PropositionItem","JSONPropositionItem","constructor","jsonData","data"],"sourceRoot":"../../../src","sources":["models/JSONProposition.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,eAAe,QAA6B,sBAAmB;AASxE,OAAO,MAAMC,mBAAmB,SAASD,eAAe,CAAC;EAGxDE,WAAWA,CAACC,QAA6B,EAAE;IAC1C,KAAK,CAACA,QAAQ,CAAC;IACf,IAAI,CAACC,IAAI,GAAGD,QAAQ,CAACC,IAAI;EAC1B;AACD","ignoreList":[]} diff --git a/packages/messaging/dist/module/models/Message.js b/packages/messaging/dist/module/models/Message.js new file mode 100644 index 00000000..2c31f6b1 --- /dev/null +++ b/packages/messaging/dist/module/models/Message.js @@ -0,0 +1,125 @@ +"use strict"; + +/* +Copyright 2023 Adobe. All rights reserved. +This file is licensed to you under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. You may obtain a copy +of the License at http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software distributed under +the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS +OF ANY KIND, either express or implied. See the License for the specific language +governing permissions and limitations under the License. +*/ + +import { NativeEventEmitter, NativeModules } from 'react-native'; +const RCTAEPMessaging = NativeModules.AEPMessaging; + +// Registery to store inAppMessage callbacks for each message in Message.handleJavascriptMessage +// Record - {messageId : {handlerName : callback}} +const jsMessageHandlers = {}; +const handleJSMessageEventEmitter = new NativeEventEmitter(RCTAEPMessaging); + +// invokes the callback registered in Message.handleJavascriptMessage with the content received from the inAppMessage webview +handleJSMessageEventEmitter.addListener('onJavascriptMessage', event => { + const { + messageId, + handlerName, + content + } = event; + if (jsMessageHandlers[messageId] && jsMessageHandlers[messageId][handlerName]) { + jsMessageHandlers[messageId][handlerName](content); + } +}); +class Message { + constructor({ + id, + autoTrack = false + }) { + this.id = id; + this.autoTrack = autoTrack; + } + + /** + * Update the value of property "autoTrack" + * This function works only for the Message objects that were saved by calling "Messaging.saveMessage" + * @param {boolean} autoTrack: New value of property autoTrack. + */ + setAutoTrack(autoTrack) { + this.autoTrack = autoTrack; + RCTAEPMessaging.setAutoTrack(this.id, autoTrack); + } + + /** + * Signals to the UIServices that the message should be shown. + * If autoTrack is true, calling this method will result in an "inapp.display" Edge Event being dispatched. + */ + show() { + RCTAEPMessaging.show(this.id); + } + + /** + * Signals to the UIServices that the message should be dismissed. + * If `autoTrack` is true, calling this method will result in an "inapp.dismiss" Edge Event being dispatched. + * @param {boolean?} suppressAutoTrack: if set to true, the inapp.dismiss Edge Event will not be sent regardless + * of the autoTrack setting. + */ + dismiss(suppressAutoTrack) { + RCTAEPMessaging.dismiss(this.id, suppressAutoTrack ? true : false); + } + + /** + * Generates an Edge Event for the provided interaction and eventType. + * @param {string?} interaction: a custom String value to be recorded in the interaction + * @param {MessagingEdgeEventType} eventType: the MessagingEdgeEventType to be used for the ensuing Edge Event + */ + track(interaction, eventType) { + RCTAEPMessaging.track(this.id, interaction, eventType); + } + + /** + * Clears the cached reference to the Message object. + * This function must be called if Message was saved by calling "MessagingDelegate.shouldSaveMessage" but no longer needed. + * Failure to call this function leads to memory leaks. + */ + clear() { + RCTAEPMessaging.clear(this.id); + } + + /** + * Adds a handler for named JavaScript messages sent from the message's WebView. + * The parameter passed to handler will contain the body of the message passed from the WebView's JavaScript. + * @param {string} handlerName: The name of the message that should be handled by the handler + * @param {function} handler: The method or closure to be called with the body of the message created in the Message's JavaScript + */ + handleJavascriptMessage(handlerName, handler) { + // Validate parameters + if (!handlerName) { + console.warn('[AEP Messaging] handleJavascriptMessage: handlerName is required'); + return; + } + if (typeof handler !== 'function') { + console.warn('[AEP Messaging] handleJavascriptMessage: handler must be a function'); + return; + } + + // cache the callback + if (!jsMessageHandlers[this.id]) { + jsMessageHandlers[this.id] = {}; + } + jsMessageHandlers[this.id][handlerName] = handler; + RCTAEPMessaging.handleJavascriptMessage(this.id, handlerName); + } + + /** + * @internal - For internal use only. + * Clears all the javascript message handlers for the message. + * This function must be called if the callbacks registered in handleJavascriptMessage are no longer needed. + * Failure to call this function may lead to memory leaks. + */ + _clearJavascriptMessageHandlers() { + delete jsMessageHandlers[this.id]; + } +} +export default Message; +//# sourceMappingURL=Message.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/models/Message.js.map b/packages/messaging/dist/module/models/Message.js.map new file mode 100644 index 00000000..7b62a404 --- /dev/null +++ b/packages/messaging/dist/module/models/Message.js.map @@ -0,0 +1 @@ +{"version":3,"names":["NativeEventEmitter","NativeModules","RCTAEPMessaging","AEPMessaging","jsMessageHandlers","handleJSMessageEventEmitter","addListener","event","messageId","handlerName","content","Message","constructor","id","autoTrack","setAutoTrack","show","dismiss","suppressAutoTrack","track","interaction","eventType","clear","handleJavascriptMessage","handler","console","warn","_clearJavascriptMessageHandlers"],"sourceRoot":"../../../src","sources":["models/Message.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,kBAAkB,EAAEC,aAAa,QAAQ,cAAc;AAEhE,MAAMC,eAAe,GAAGD,aAAa,CAACE,YAAY;;AAElD;AACA;AACA,MAAMC,iBAA4E,GAAG,CAAC,CAAC;AACvF,MAAMC,2BAA2B,GAAG,IAAIL,kBAAkB,CAACE,eAAe,CAAC;;AAE3E;AACAG,2BAA2B,CAACC,WAAW,CAAC,qBAAqB,EAAGC,KAAK,IAAK;EACxE,MAAM;IAACC,SAAS;IAAEC,WAAW;IAAEC;EAAO,CAAC,GAAGH,KAAK;EAC/C,IAAIH,iBAAiB,CAACI,SAAS,CAAC,IAAIJ,iBAAiB,CAACI,SAAS,CAAC,CAACC,WAAW,CAAC,EAAE;IAC7EL,iBAAiB,CAACI,SAAS,CAAC,CAACC,WAAW,CAAC,CAACC,OAAO,CAAC;EACpD;AACF,CAAC,CAAC;AA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EAAE,CAAC,EAAE;MAC/BT,iBAAiB,CAAC,IAAI,CAACS,EAAE,CAAC,GAAG,CAAC,CAAC;IACjC;IACAT,iBAAiB,CAAC,IAAI,CAACS,EAAE,CAAC,CAACJ,WAAW,CAAC,GAAGe,OAAO;IACjDtB,eAAe,CAACqB,uBAAuB,CAAC,IAAI,CAACV,EAAE,EAAEJ,WAAW,CAAC;EAC/D;;EAEA;AACF;AACA;AACA;AACA;AACA;EACEkB,+BAA+BA,CAAA,EAAG;IAChC,OAAOvB,iBAAiB,CAAC,IAAI,CAACS,EAAE,CAAC;EACnC;AACF;AAEA,eAAeF,OAAO","ignoreList":[]} diff --git a/packages/messaging/dist/module/models/MessagingDelegate.js b/packages/messaging/dist/module/models/MessagingDelegate.js new file mode 100644 index 00000000..2e44b334 --- /dev/null +++ b/packages/messaging/dist/module/models/MessagingDelegate.js @@ -0,0 +1,4 @@ +"use strict"; + +export {}; +//# sourceMappingURL=MessagingDelegate.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/models/MessagingDelegate.js.map b/packages/messaging/dist/module/models/MessagingDelegate.js.map new file mode 100644 index 00000000..97d960ae --- /dev/null +++ b/packages/messaging/dist/module/models/MessagingDelegate.js.map @@ -0,0 +1 @@ +{"version":3,"names":[],"sourceRoot":"../../../src","sources":["models/MessagingDelegate.ts"],"mappings":"","ignoreList":[]} diff --git a/packages/messaging/dist/module/models/MessagingEdgeEventType.js b/packages/messaging/dist/module/models/MessagingEdgeEventType.js new file mode 100644 index 00000000..86da25c6 --- /dev/null +++ b/packages/messaging/dist/module/models/MessagingEdgeEventType.js @@ -0,0 +1,24 @@ +"use strict"; + +/* +Copyright 2023 Adobe. All rights reserved. +This file is licensed to you under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. You may obtain a copy +of the License at http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software distributed under +the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS +OF ANY KIND, either express or implied. See the License for the specific language +governing permissions and limitations under the License. +*/ +var MessagingEdgeEventType = /*#__PURE__*/function (MessagingEdgeEventType) { + MessagingEdgeEventType[MessagingEdgeEventType["DISMISS"] = 0] = "DISMISS"; + MessagingEdgeEventType[MessagingEdgeEventType["INTERACT"] = 1] = "INTERACT"; + MessagingEdgeEventType[MessagingEdgeEventType["TRIGGER"] = 2] = "TRIGGER"; + MessagingEdgeEventType[MessagingEdgeEventType["DISPLAY"] = 3] = "DISPLAY"; + MessagingEdgeEventType[MessagingEdgeEventType["PUSH_APPLICATION_OPENED"] = 4] = "PUSH_APPLICATION_OPENED"; + MessagingEdgeEventType[MessagingEdgeEventType["PUSH_CUSTOM_ACTION"] = 5] = "PUSH_CUSTOM_ACTION"; + return MessagingEdgeEventType; +}(MessagingEdgeEventType || {}); +export default MessagingEdgeEventType; +//# sourceMappingURL=MessagingEdgeEventType.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/models/MessagingEdgeEventType.js.map b/packages/messaging/dist/module/models/MessagingEdgeEventType.js.map new file mode 100644 index 00000000..4bc87988 --- /dev/null +++ b/packages/messaging/dist/module/models/MessagingEdgeEventType.js.map @@ -0,0 +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":[]} diff --git a/packages/messaging/dist/module/models/MessagingProposition.js b/packages/messaging/dist/module/models/MessagingProposition.js new file mode 100644 index 00000000..4ce3ac77 --- /dev/null +++ b/packages/messaging/dist/module/models/MessagingProposition.js @@ -0,0 +1,57 @@ +"use strict"; + +/* + Copyright 2024 Adobe. All rights reserved. + This file is licensed to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law + or agreed to in writing, software distributed under the License is + distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF + ANY KIND, either express or implied. See the License for the specific + language governing permissions and limitations under the License. +*/ + +import { PersonalizationSchema } from "./PersonalizationSchema.js"; +import { ContentCard } from "./ContentCard.js"; +import { HTMLProposition } from "./HTMLProposition.js"; +import { JSONPropositionItem } from "./JSONProposition.js"; +import { PropositionItem } from "./PropositionItem.js"; +export class MessageProposition { + constructor(raw) { + this.id = raw?.id ?? ''; + this.scope = raw?.scope ?? ''; + this.scopeDetails = raw?.scopeDetails ?? {}; + + // Mirror activity.id into activity.activityID for convenience + const activityIdFromScope = this.scopeDetails?.activity?.id ?? ''; + if (this.scopeDetails?.activity) { + this.scopeDetails.activity.activityID = activityIdFromScope; + } + const rawItems = Array.isArray(raw?.items) ? raw.items : []; + this.items = rawItems.map(itemData => { + const activityId = this.scopeDetails?.activity?.id ?? ''; + let instance; + switch (itemData?.schema) { + case PersonalizationSchema.CONTENT_CARD: + instance = new ContentCard(itemData); + instance.activityID = activityId; + return instance; + case PersonalizationSchema.HTML_CONTENT: + instance = new HTMLProposition(itemData); + instance.activityID = activityId; + return instance; + case PersonalizationSchema.JSON_CONTENT: + instance = new JSONPropositionItem(itemData); + instance.activityID = activityId; + return instance; + default: + instance = new PropositionItem(itemData); + instance.activityID = activityId; + return instance; + } + }); + } +} +export { MessageProposition as MessagingProposition }; +//# sourceMappingURL=MessagingProposition.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/models/MessagingProposition.js.map b/packages/messaging/dist/module/models/MessagingProposition.js.map new file mode 100644 index 00000000..4682df43 --- /dev/null +++ b/packages/messaging/dist/module/models/MessagingProposition.js.map @@ -0,0 +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":[]} diff --git a/packages/messaging/dist/module/models/MessagingPropositionItem.js b/packages/messaging/dist/module/models/MessagingPropositionItem.js new file mode 100644 index 00000000..8960d7e2 --- /dev/null +++ b/packages/messaging/dist/module/models/MessagingPropositionItem.js @@ -0,0 +1,4 @@ +"use strict"; + +export {}; +//# sourceMappingURL=MessagingPropositionItem.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/models/MessagingPropositionItem.js.map b/packages/messaging/dist/module/models/MessagingPropositionItem.js.map new file mode 100644 index 00000000..13a70d5a --- /dev/null +++ b/packages/messaging/dist/module/models/MessagingPropositionItem.js.map @@ -0,0 +1 @@ +{"version":3,"names":[],"sourceRoot":"../../../src","sources":["models/MessagingPropositionItem.ts"],"mappings":"","ignoreList":[]} diff --git a/packages/messaging/dist/module/models/PersonalizationSchema.js b/packages/messaging/dist/module/models/PersonalizationSchema.js new file mode 100644 index 00000000..22705639 --- /dev/null +++ b/packages/messaging/dist/module/models/PersonalizationSchema.js @@ -0,0 +1,25 @@ +"use strict"; + +/* + Copyright 2024 Adobe. All rights reserved. + This file is licensed to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law + or agreed to in writing, software distributed under the License is + distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF + ANY KIND, either express or implied. See the License for the specific + language governing permissions and limitations under the License. +*/ + +export let PersonalizationSchema = /*#__PURE__*/function (PersonalizationSchema) { + PersonalizationSchema["CONTENT_CARD"] = "https://ns.adobe.com/personalization/message/content-card"; + PersonalizationSchema["DEFAULT_CONTENT"] = "https://ns.adobe.com/personalization/default-content-item"; + PersonalizationSchema["HTML_CONTENT"] = "https://ns.adobe.com/personalization/html-content-item"; + PersonalizationSchema["IN_APP"] = "https://ns.adobe.com/personalization/message/in-app"; + PersonalizationSchema["JSON_CONTENT"] = "https://ns.adobe.com/personalization/json-content-item"; + PersonalizationSchema["NATIVE_ALERT"] = "https://ns.adobe.com/personalization/message/native-alert"; + PersonalizationSchema["RULESET_ITEM"] = "https://ns.adobe.com/personalization/ruleset-item"; + return PersonalizationSchema; +}({}); +//# sourceMappingURL=PersonalizationSchema.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/models/PersonalizationSchema.js.map b/packages/messaging/dist/module/models/PersonalizationSchema.js.map new file mode 100644 index 00000000..685db7b9 --- /dev/null +++ b/packages/messaging/dist/module/models/PersonalizationSchema.js.map @@ -0,0 +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;EAAA,OAArBA,qBAAqB;AAAA","ignoreList":[]} diff --git a/packages/messaging/dist/module/models/PropositionItem.js b/packages/messaging/dist/module/models/PropositionItem.js new file mode 100644 index 00000000..7128a893 --- /dev/null +++ b/packages/messaging/dist/module/models/PropositionItem.js @@ -0,0 +1,113 @@ +"use strict"; + +/* + Copyright 2025 Adobe. All rights reserved. + This file is licensed to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law + or agreed to in writing, software distributed under the License is + distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF + ANY KIND, either express or implied. See the License for the specific + language governing permissions and limitations under the License. +*/ + +import { NativeModules } from 'react-native'; +const RCTAEPMessaging = NativeModules.AEPMessaging; + +/** + * Base PropositionItem interface that all proposition items implement + */ + +/** + * A PropositionItem represents a personalization JSON object returned by Konductor. + * This is the base class that provides tracking functionality for all proposition items + * including ContentCards, InApp messages, and code-based experiences. + * + * This mirrors the native Android PropositionItem class functionality. + */ +export class PropositionItem { + constructor(propositionItemData) { + this.id = propositionItemData.id; + this.schema = propositionItemData.schema; + this.data = propositionItemData.data; + this.uuid = propositionItemData.uuid; + this.activityID = propositionItemData.activityID; + } + + /** + * Gets the PropositionItem identifier. + * + * @returns {string} The PropositionItem identifier + */ + getItemId() { + return this.id; + } + + /** + * Gets the PropositionItem content schema. + * + * @returns {PersonalizationSchema} The PropositionItem content schema + */ + getSchema() { + return this.schema; + } + + /** + * Gets the PropositionItem data. + * + * @returns {object} The PropositionItem data + */ + getItemData() { + return this.data; + } + + /** + * Tracks interaction with this proposition item. + * This is the core tracking method that all proposition items use. + * + * @param {MessagingEdgeEventType} eventType - The MessagingEdgeEventType specifying event type for the interaction + * + * @example + * propositionItem.track(MessagingEdgeEventType.DISPLAY); + */ + + /** + * Tracks interaction with this proposition item. + * + * @param {string | null} interaction - String describing the interaction + * @param {MessagingEdgeEventType} eventType - The MessagingEdgeEventType specifying event type for the interaction + * @param {string[] | null} tokens - Array containing the sub-item tokens for recording interaction + * + * @example + * // Track display + * propositionItem.track(null, MessagingEdgeEventType.DISPLAY, null); + * + * // Track interaction + * propositionItem.track("button_clicked", MessagingEdgeEventType.INTERACT, null); + * + * // Track with tokens + * propositionItem.track("click", MessagingEdgeEventType.INTERACT, ["token1", "token2"]); + */ + + // Implementation + track(interactionOrEventType, eventType, tokens) { + // Handle overloaded method signatures + if (typeof interactionOrEventType === 'number' && eventType === undefined) { + // First overload: track(eventType) + this.trackWithDetails(null, interactionOrEventType, null); + } else if (typeof interactionOrEventType === 'string' || interactionOrEventType === null) { + // Second overload: track(interaction, eventType, tokens) + this.trackWithDetails(interactionOrEventType, eventType, tokens || null); + } + } + + /** + * Internal method that performs the actual tracking + */ + trackWithDetails(interaction, eventType, tokens) { + const nativeIdentifier = this.activityID ?? null; + RCTAEPMessaging.trackPropositionItem(nativeIdentifier, interaction, eventType, tokens); + } +} +//# sourceMappingURL=PropositionItem.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/models/PropositionItem.js.map b/packages/messaging/dist/module/models/PropositionItem.js.map new file mode 100644 index 00000000..4a2e6219 --- /dev/null +++ b/packages/messaging/dist/module/models/PropositionItem.js.map @@ -0,0 +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;A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S,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":[]} diff --git a/packages/messaging/dist/module/models/ScopeDetails.js b/packages/messaging/dist/module/models/ScopeDetails.js new file mode 100644 index 00000000..d8bd4463 --- /dev/null +++ b/packages/messaging/dist/module/models/ScopeDetails.js @@ -0,0 +1,2 @@ +"use strict"; +//# sourceMappingURL=ScopeDetails.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/models/ScopeDetails.js.map b/packages/messaging/dist/module/models/ScopeDetails.js.map new file mode 100644 index 00000000..4c449b2f --- /dev/null +++ b/packages/messaging/dist/module/models/ScopeDetails.js.map @@ -0,0 +1 @@ +{"version":3,"names":[],"sourceRoot":"../../../src","sources":["models/ScopeDetails.ts"],"mappings":"","ignoreList":[]} diff --git a/packages/messaging/dist/module/models/index.js b/packages/messaging/dist/module/models/index.js new file mode 100644 index 00000000..e0d0447d --- /dev/null +++ b/packages/messaging/dist/module/models/index.js @@ -0,0 +1,13 @@ +"use strict"; + +export * from "./ContentCard.js"; +export * from "./InAppMessage.js"; +export * from "./JSONProposition.js"; +export * from "./Message.js"; +export * from "./MessagingDelegate.js"; +export * from "./MessagingEdgeEventType.js"; +export * from "./MessagingProposition.js"; +export * from "./MessagingPropositionItem.js"; +export * from "./PersonalizationSchema.js"; +export * from "./ScopeDetails.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/models/index.js.map b/packages/messaging/dist/module/models/index.js.map new file mode 100644 index 00000000..e50a518a --- /dev/null +++ b/packages/messaging/dist/module/models/index.js.map @@ -0,0 +1 @@ +{"version":3,"names":[],"sourceRoot":"../../../src","sources":["models/index.ts"],"mappings":";;AAAA,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":[]} diff --git a/packages/messaging/dist/module/ui/components/Button/Button.js b/packages/messaging/dist/module/ui/components/Button/Button.js new file mode 100644 index 00000000..5e1827d5 --- /dev/null +++ b/packages/messaging/dist/module/ui/components/Button/Button.js @@ -0,0 +1,49 @@ +"use strict"; + +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); } +/* + Copyright 2025 Adobe. All rights reserved. + This file is licensed to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law + or agreed to in writing, software distributed under the License is + distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF + ANY KIND, either express or implied. See the License for the specific + language governing permissions and limitations under the License. +*/ +import React, { useCallback } from 'react'; +import { Linking, Pressable, Text } from 'react-native'; +import { useTheme } from "../../theme/ThemeProvider.js"; +const Button = ({ + actionUrl, + id, + title, + onPress, + interactId, + textStyle, + style, + ...props +}) => { + const theme = useTheme(); + const handlePress = useCallback(() => { + onPress?.(interactId); + if (actionUrl) { + try { + Linking.openURL(actionUrl); + } catch (error) { + console.warn(`Failed to open URL: ${actionUrl}`, error); + } + } + }, [actionUrl, interactId, onPress]); + return /*#__PURE__*/React.createElement(Pressable, _extends({ + onPress: handlePress, + style: style + }, props), /*#__PURE__*/React.createElement(Text, { + style: [{ + color: theme?.colors?.buttonTextColor + }, textStyle] + }, title)); +}; +export default Button; +//# sourceMappingURL=Button.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/components/Button/Button.js.map b/packages/messaging/dist/module/ui/components/Button/Button.js.map new file mode 100644 index 00000000..72262aca --- /dev/null +++ b/packages/messaging/dist/module/ui/components/Button/Button.js.map @@ -0,0 +1 @@ +{"version":3,"names":["React","useCallback","Linking","Pressable","Text","useTheme","Button","actionUrl","id","title","onPress","interactId","textStyle","style","props","theme","handlePress","openURL","error","console","warn","createElement","_extends","color","colors","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,SAEEC,OAAO,EACPC,SAAS,EAETC,IAAI,QAEC,cAAc;AACrB,SAASC,QAAQ,QAAQ,8BAA2B;AAWpD,MAAMC,MAA6B,GAAGA,CAAC;EACrCC,SAAS;EACTC,EAAE;EACFC,KAAK;EACLC,OAAO;EACPC,UAAU;EACVC,SAAS;EACTC,KAAK;EACL,GAAGC;AACL,CAAC,KAAK;EACJ,MAAMC,KAAK,GAAGV,QAAQ,CAAC,CAAC;EACxB,MAAMW,WAAW,GAAGf,WAAW,CAAC,MAAM;IACpCS,OAAO,GAAGC,UAAU,CAAC;IACrB,IAAIJ,SAAS,EAAE;MACb,IAAI;QACFL,OAAO,CAACe,OAAO,CAACV,SAAS,CAAC;MAC5B,CAAC,CAAC,OAAOW,KAAK,EAAE;QACdC,OAAO,CAACC,IAAI,CAAC,uBAAuBb,SAAS,EAAE,EAAEW,KAAK,CAAC;MACzD;IACF;EACF,CAAC,EAAE,CAACX,SAAS,EAAEI,UAAU,EAAED,OAAO,CAAC,CAAC;EAEpC,oBACEV,KAAA,CAAAqB,aAAA,CAAClB,SAAS,EAAAmB,QAAA;IAACZ,OAAO,EAAEM,WAAY;IAACH,KAAK,EAAEA;EAAM,GAAKC,KAAK,gBACtDd,KAAA,CAAAqB,aAAA,CAACjB,IAAI;IAACS,KAAK,EAAE,CAAC;MAAEU,KAAK,EAAER,KAAK,EAAES,MAAM,EAAEC;IAAgB,CAAC,EAAEb,SAAS;EAAE,GACjEH,KACG,CACG,CAAC;AAEhB,CAAC;AAED,eAAeH,MAAM","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/components/Button/Button.spec.js b/packages/messaging/dist/module/ui/components/Button/Button.spec.js new file mode 100644 index 00000000..df2c7061 --- /dev/null +++ b/packages/messaging/dist/module/ui/components/Button/Button.spec.js @@ -0,0 +1,442 @@ +"use strict"; + +/* + Copyright 2025 Adobe. All rights reserved. + This file is licensed to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law + or agreed to in writing, software distributed under the License is + distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF + ANY KIND, either express or implied. See the License for the specific + language governing permissions and limitations under the License. +*/ +import React from 'react'; +import { render, screen, fireEvent } from '@testing-library/react-native'; +import { Linking } from 'react-native'; +import Button from "./Button.js"; +import { ThemeProvider } from "../../theme/ThemeProvider.js"; + +// Mock Linking.openURL +jest.spyOn(Linking, 'openURL'); + +// Helper to render with theme +const renderWithTheme = (component, customThemes) => { + return render(/*#__PURE__*/React.createElement(ThemeProvider, { + customThemes: customThemes + }, component)); +}; +describe('Button', () => { + const mockOnPress = jest.fn(); + beforeEach(() => { + jest.clearAllMocks(); + }); + afterEach(() => { + jest.clearAllMocks(); + }); + describe('Basic rendering', () => { + it('should render a button with the provided title', () => { + render(/*#__PURE__*/React.createElement(Button, { + title: "Click Me" + })); + const button = screen.getByText('Click Me'); + expect(button).toBeTruthy(); + }); + it('should render with different title text', () => { + render(/*#__PURE__*/React.createElement(Button, { + title: "Submit" + })); + expect(screen.getByText('Submit')).toBeTruthy(); + }); + it('should render button as Pressable component', () => { + const { + getByTestId + } = render(/*#__PURE__*/React.createElement(Button, { + title: "Test", + testID: "test-button" + })); + const button = getByTestId('test-button'); + expect(button.type).toBe('View'); // Pressable renders as View + }); + }); + describe('Press handling', () => { + it('should call onPress when the button is pressed', () => { + render(/*#__PURE__*/React.createElement(Button, { + title: "Press Me", + onPress: mockOnPress + })); + const button = screen.getByText('Press Me'); + fireEvent.press(button); + expect(mockOnPress).toHaveBeenCalledTimes(1); + }); + it('should call onPress with interactId when provided', () => { + render(/*#__PURE__*/React.createElement(Button, { + title: "Press Me", + onPress: mockOnPress, + interactId: "test-interact-id" + })); + const button = screen.getByText('Press Me'); + fireEvent.press(button); + expect(mockOnPress).toHaveBeenCalledWith('test-interact-id'); + }); + it('should call onPress multiple times when pressed multiple times', () => { + render(/*#__PURE__*/React.createElement(Button, { + title: "Press Me", + onPress: mockOnPress + })); + const button = screen.getByText('Press Me'); + fireEvent.press(button); + fireEvent.press(button); + fireEvent.press(button); + expect(mockOnPress).toHaveBeenCalledTimes(3); + }); + it('should not throw error when onPress is not provided', () => { + render(/*#__PURE__*/React.createElement(Button, { + title: "Press Me" + })); + const button = screen.getByText('Press Me'); + expect(() => fireEvent.press(button)).not.toThrow(); + }); + }); + describe('actionUrl handling', () => { + it('should open URL when actionUrl is provided and button is pressed', () => { + const testUrl = 'https://example.com'; + render(/*#__PURE__*/React.createElement(Button, { + title: "Link", + actionUrl: testUrl + })); + const button = screen.getByText('Link'); + fireEvent.press(button); + expect(Linking.openURL).toHaveBeenCalledWith(testUrl); + }); + it('should call both onPress and open URL when both are provided', () => { + const testUrl = 'https://example.com'; + render(/*#__PURE__*/React.createElement(Button, { + title: "Link", + actionUrl: testUrl, + onPress: mockOnPress + })); + const button = screen.getByText('Link'); + fireEvent.press(button); + expect(mockOnPress).toHaveBeenCalledTimes(1); + expect(Linking.openURL).toHaveBeenCalledWith(testUrl); + }); + it('should call onPress with interactId and open URL', () => { + const testUrl = 'https://example.com'; + render(/*#__PURE__*/React.createElement(Button, { + title: "Link", + actionUrl: testUrl, + onPress: mockOnPress, + interactId: "link-interact-id" + })); + const button = screen.getByText('Link'); + fireEvent.press(button); + expect(mockOnPress).toHaveBeenCalledWith('link-interact-id'); + expect(Linking.openURL).toHaveBeenCalledWith(testUrl); + }); + it('should call openURL even if it might fail', () => { + const testUrl = 'https://example.com'; + render(/*#__PURE__*/React.createElement(Button, { + title: "Link", + actionUrl: testUrl + })); + const button = screen.getByText('Link'); + fireEvent.press(button); + + // Verify the URL opening was attempted + expect(Linking.openURL).toHaveBeenCalledWith(testUrl); + }); + it('should not try to open URL when actionUrl is not provided', () => { + render(/*#__PURE__*/React.createElement(Button, { + title: "No Link", + onPress: mockOnPress + })); + const button = screen.getByText('No Link'); + fireEvent.press(button); + expect(Linking.openURL).not.toHaveBeenCalled(); + }); + }); + describe('Theme support', () => { + it('should apply theme button text color when theme is provided', () => { + const customThemes = { + light: { + colors: { + buttonTextColor: '#FF5733' + } + }, + dark: { + colors: { + buttonTextColor: '#FF5733' + } + } + }; + renderWithTheme(/*#__PURE__*/React.createElement(Button, { + title: "Themed" + }), customThemes); + const text = screen.getByText('Themed'); + expect(text.props.style).toEqual(expect.arrayContaining([expect.objectContaining({ + color: '#FF5733' + })])); + }); + it('should handle theme with undefined buttonTextColor', () => { + const customThemes = { + light: { + colors: {} + }, + dark: { + colors: {} + } + }; + renderWithTheme(/*#__PURE__*/React.createElement(Button, { + title: "Default" + }), customThemes); + const text = screen.getByText('Default'); + expect(text).toBeTruthy(); + }); + it('should render without theme provider', () => { + expect(() => { + render(/*#__PURE__*/React.createElement(Button, { + title: "No Theme" + })); + }).not.toThrow(); + }); + }); + describe('Custom styles', () => { + it('should accept and apply custom textStyle', () => { + const customTextStyle = { + fontSize: 20, + fontWeight: 'bold' + }; + render(/*#__PURE__*/React.createElement(Button, { + title: "Styled", + textStyle: customTextStyle + })); + const text = screen.getByText('Styled'); + expect(text.props.style).toEqual(expect.arrayContaining([expect.objectContaining({ + fontSize: 20, + fontWeight: 'bold' + })])); + }); + it('should accept and apply array of textStyles', () => { + const textStyles = [{ + fontSize: 16 + }, { + fontWeight: 'bold' + }, { + color: 'blue' + }]; + render(/*#__PURE__*/React.createElement(Button, { + title: "Multi Style", + textStyle: textStyles + })); + const text = screen.getByText('Multi Style'); + const styles = JSON.stringify(text.props.style); + expect(styles).toContain('"fontSize":16'); + expect(styles).toContain('"fontWeight":"bold"'); + expect(styles).toContain('"color":"blue"'); + }); + it('should accept and apply custom Pressable style', () => { + const customStyle = { + padding: 10, + backgroundColor: 'red' + }; + const { + getByTestId + } = render(/*#__PURE__*/React.createElement(Button, { + title: "Styled Button", + style: customStyle, + testID: "button" + })); + const button = getByTestId('button'); + expect(button.props.style).toEqual(customStyle); + }); + it('should merge theme color with custom textStyle', () => { + const customThemes = { + light: { + colors: { + buttonTextColor: '#FF5733' + } + }, + dark: { + colors: { + buttonTextColor: '#FF5733' + } + } + }; + const customTextStyle = { + fontSize: 18 + }; + renderWithTheme(/*#__PURE__*/React.createElement(Button, { + title: "Merged", + textStyle: customTextStyle + }), customThemes); + const text = screen.getByText('Merged'); + expect(text.props.style).toEqual(expect.arrayContaining([expect.objectContaining({ + color: '#FF5733' + }), expect.objectContaining({ + fontSize: 18 + })])); + }); + }); + describe('Additional Pressable props', () => { + it('should accept disabled prop', () => { + const { + getByTestId + } = render(/*#__PURE__*/React.createElement(Button, { + title: "Disabled", + disabled: true, + testID: "button" + })); + const button = getByTestId('button'); + expect(button.props.accessibilityState.disabled).toBe(true); + }); + it('should accept accessibility props', () => { + const { + getByTestId + } = render(/*#__PURE__*/React.createElement(Button, { + title: "Accessible", + testID: "button", + accessibilityLabel: "Submit form", + accessibilityHint: "Double tap to submit the form" + })); + const button = getByTestId('button'); + expect(button.props.accessibilityLabel).toBe('Submit form'); + expect(button.props.accessibilityHint).toBe('Double tap to submit the form'); + }); + it('should accept testID prop', () => { + const { + getByTestId + } = render(/*#__PURE__*/React.createElement(Button, { + title: "Test ID", + testID: "my-button" + })); + const button = getByTestId('my-button'); + expect(button).toBeTruthy(); + }); + it('should spread additional Pressable props', () => { + const { + getByTestId + } = render(/*#__PURE__*/React.createElement(Button, { + title: "Extended", + testID: "button", + hitSlop: 10, + accessibilityRole: "button" + })); + const button = getByTestId('button'); + expect(button.props.hitSlop).toBe(10); + expect(button.props.accessibilityRole).toBe('button'); + }); + }); + describe('ID prop', () => { + it('should accept id prop without error', () => { + expect(() => { + render(/*#__PURE__*/React.createElement(Button, { + title: "With ID", + id: "button-123" + })); + }).not.toThrow(); + }); + it('should render correctly with id prop', () => { + render(/*#__PURE__*/React.createElement(Button, { + title: "ID Button", + id: "unique-id" + })); + const button = screen.getByText('ID Button'); + expect(button).toBeTruthy(); + }); + }); + describe('Edge cases', () => { + it('should handle empty title string', () => { + render(/*#__PURE__*/React.createElement(Button, { + title: "" + })); + + // Should not throw, but may not be visible + expect(() => screen.getByText('')).not.toThrow(); + }); + it('should handle very long title text', () => { + const longTitle = 'A'.repeat(1000); + render(/*#__PURE__*/React.createElement(Button, { + title: longTitle + })); + const button = screen.getByText(longTitle); + expect(button).toBeTruthy(); + }); + it('should handle special characters in title', () => { + const specialTitle = '!@#$%^&*()_+-={}[]|:;<>?,./~`'; + render(/*#__PURE__*/React.createElement(Button, { + title: specialTitle + })); + const button = screen.getByText(specialTitle); + expect(button).toBeTruthy(); + }); + it('should handle undefined interactId', () => { + render(/*#__PURE__*/React.createElement(Button, { + title: "Test", + onPress: mockOnPress, + interactId: undefined + })); + const button = screen.getByText('Test'); + fireEvent.press(button); + expect(mockOnPress).toHaveBeenCalledWith(undefined); + }); + it('should handle empty string as actionUrl', () => { + render(/*#__PURE__*/React.createElement(Button, { + title: "Empty URL", + actionUrl: "" + })); + const button = screen.getByText('Empty URL'); + fireEvent.press(button); + + // Empty string is falsy, so openURL should not be called + expect(Linking.openURL).not.toHaveBeenCalled(); + }); + }); + describe('Callback stability', () => { + it('should maintain stable callback reference', () => { + const { + rerender + } = render(/*#__PURE__*/React.createElement(Button, { + title: "Stable", + onPress: mockOnPress, + actionUrl: "https://example.com" + })); + const button = screen.getByText('Stable'); + fireEvent.press(button); + expect(mockOnPress).toHaveBeenCalledTimes(1); + expect(Linking.openURL).toHaveBeenCalledTimes(1); + + // Rerender with same props + rerender(/*#__PURE__*/React.createElement(Button, { + title: "Stable", + onPress: mockOnPress, + actionUrl: "https://example.com" + })); + fireEvent.press(button); + expect(mockOnPress).toHaveBeenCalledTimes(2); + expect(Linking.openURL).toHaveBeenCalledTimes(2); + }); + it('should update callback when dependencies change', () => { + const { + rerender + } = render(/*#__PURE__*/React.createElement(Button, { + title: "Dynamic", + onPress: mockOnPress, + interactId: "id-1" + })); + const button = screen.getByText('Dynamic'); + fireEvent.press(button); + expect(mockOnPress).toHaveBeenCalledWith('id-1'); + + // Rerender with different interactId + rerender(/*#__PURE__*/React.createElement(Button, { + title: "Dynamic", + onPress: mockOnPress, + interactId: "id-2" + })); + fireEvent.press(button); + expect(mockOnPress).toHaveBeenCalledWith('id-2'); + }); + }); +}); +//# sourceMappingURL=Button.spec.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/components/Button/Button.spec.js.map b/packages/messaging/dist/module/ui/components/Button/Button.spec.js.map new file mode 100644 index 00000000..de79bdd5 --- /dev/null +++ b/packages/messaging/dist/module/ui/components/Button/Button.spec.js.map @@ -0,0 +1 @@ +{"version":3,"names":["React","render","screen","fireEvent","Linking","Button","ThemeProvider","jest","spyOn","renderWithTheme","component","customThemes","createElement","describe","mockOnPress","fn","beforeEach","clearAllMocks","afterEach","it","title","button","getByText","expect","toBeTruthy","getByTestId","testID","type","toBe","onPress","press","toHaveBeenCalledTimes","interactId","toHaveBeenCalledWith","not","toThrow","testUrl","actionUrl","openURL","toHaveBeenCalled","light","colors","buttonTextColor","dark","text","props","style","toEqual","arrayContaining","objectContaining","color","customTextStyle","fontSize","fontWeight","textStyle","textStyles","styles","JSON","stringify","toContain","customStyle","padding","backgroundColor","disabled","accessibilityState","accessibilityLabel","accessibilityHint","hitSlop","accessibilityRole","id","longTitle","repeat","specialTitle","undefined","rerender"],"sourceRoot":"../../../../../src","sources":["ui/components/Button/Button.spec.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,MAAM,EAAEC,MAAM,EAAEC,SAAS,QAAQ,+BAA+B;AACzE,SAASC,OAAO,QAAQ,cAAc;AACtC,OAAOC,MAAM,MAAM,aAAU;AAC7B,SAASC,aAAa,QAAQ,8BAA2B;;AAEzD;AACAC,IAAI,CAACC,KAAK,CAACJ,OAAO,EAAE,SAAS,CAAC;;AAE9B;AACA,MAAMK,eAAe,GAAGA,CAACC,SAA6B,EAAEC,YAAkB,KAAK;EAC7E,OAAOV,MAAM,cACXD,KAAA,CAAAY,aAAA,CAACN,aAAa;IAACK,YAAY,EAAEA;EAAa,GAAED,SAAyB,CACvE,CAAC;AACH,CAAC;AAEDG,QAAQ,CAAC,QAAQ,EAAE,MAAM;EACvB,MAAMC,WAAW,GAAGP,IAAI,CAACQ,EAAE,CAAC,CAAC;EAE7BC,UAAU,CAAC,MAAM;IACfT,IAAI,CAACU,aAAa,CAAC,CAAC;EACtB,CAAC,CAAC;EAEFC,SAAS,CAAC,MAAM;IACdX,IAAI,CAACU,aAAa,CAAC,CAAC;EACtB,CAAC,CAAC;EAEFJ,QAAQ,CAAC,iBAAiB,EAAE,MAAM;IAChCM,EAAE,CAAC,gDAAgD,EAAE,MAAM;MACzDlB,MAAM,cAACD,KAAA,CAAAY,aAAA,CAACP,MAAM;QAACe,KAAK,EAAC;MAAU,CAAE,CAAC,CAAC;MAEnC,MAAMC,MAAM,GAAGnB,MAAM,CAACoB,SAAS,CAAC,UAAU,CAAC;MAC3CC,MAAM,CAACF,MAAM,CAAC,CAACG,UAAU,CAAC,CAAC;IAC7B,CAAC,CAAC;IAEFL,EAAE,CAAC,yCAAyC,EAAE,MAAM;MAClDlB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oB,SAAS,CAAC,SAAS,CAAC;MAC1CnB,SAAS,CAAC2B,KAAK,CAACT,MAAM,CAAC;MAEvBE,MAAM,CAACT,WAAW,CAAC,CAACmB,oBAAoB,CAAC,MAAM,CAAC;;MAEhD;MACAyC,QAAQ,cACN1E,KAAA,CAAAY,aAAA,CAACP,MAAM;QAACe,KAAK,EAAC,SAAS;QAACS,OAAO,EAAEf,WAAY;QAACkB,UAAU,EAAC;MAAM,CAAE,CACnE,CAAC;MAED7B,SAAS,CAAC2B,KAAK,CAACT,MAAM,CAAC;MAEvBE,MAAM,CAACT,WAAW,CAAC,CAACmB,oBAAoB,CAAC,MAAM,CAAC;IAClD,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/components/CenteredView/CenteredView.js b/packages/messaging/dist/module/ui/components/CenteredView/CenteredView.js new file mode 100644 index 00000000..005b1cd0 --- /dev/null +++ b/packages/messaging/dist/module/ui/components/CenteredView/CenteredView.js @@ -0,0 +1,17 @@ +"use strict"; + +import { StyleSheet, View } from "react-native"; +const CenteredView = ({ + children +}) => /*#__PURE__*/React.createElement(View, { + style: styles.container +}, children); +export default CenteredView; +const styles = StyleSheet.create({ + container: { + flex: 1, + justifyContent: "center", + alignItems: "center" + } +}); +//# sourceMappingURL=CenteredView.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/components/CenteredView/CenteredView.js.map b/packages/messaging/dist/module/ui/components/CenteredView/CenteredView.js.map new file mode 100644 index 00000000..9c35bdef --- /dev/null +++ b/packages/messaging/dist/module/ui/components/CenteredView/CenteredView.js.map @@ -0,0 +1 @@ +{"version":3,"names":["StyleSheet","View","CenteredView","children","React","createElement","style","styles","container","create","flex","justifyContent","alignItems"],"sourceRoot":"../../../../../src","sources":["ui/components/CenteredView/CenteredView.tsx"],"mappings":";;AACA,SAASA,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAE/C,MAAMC,YAAY,GAAGA,CAAC;EAAEC;AAA4B,CAAC,kBACnDC,KAAA,CAAAC,aAAA,CAACJ,IAAI;EAACK,KAAK,EAAEC,MAAM,CAACC;AAAU,GAAEL,QAAe,CAChD;AAED,eAAeD,YAAY;AAE3B,MAAMK,MAAM,GAAGP,UAAU,CAACS,MAAM,CAAC;EAC/BD,SAAS,EAAE;IACTE,IAAI,EAAE,CAAC;IACPC,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE;EACd;AACF,CAAC,CAAC","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/components/ContentCardContainer/ContentCardContainer.js b/packages/messaging/dist/module/ui/components/ContentCardContainer/ContentCardContainer.js new file mode 100644 index 00000000..383b94d7 --- /dev/null +++ b/packages/messaging/dist/module/ui/components/ContentCardContainer/ContentCardContainer.js @@ -0,0 +1,96 @@ +"use strict"; + +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); } +import { ActivityIndicator, FlatList, StyleSheet, useColorScheme } from "react-native"; +import ContentCardContainerProvider from "../../providers/ContentCardContainerProvider.js"; +import { ContentCardView } from "../ContentCardView/ContentCardView.js"; +import { cloneElement, useCallback } from "react"; +import { useContentCardUI, useContentContainer } from "../../hooks/index.js"; +import EmptyState from "./EmptyState.js"; +function ContentCardContainerInner({ + contentContainerStyle, + LoadingComponent = /*#__PURE__*/React.createElement(ActivityIndicator, null), + ErrorComponent = null, + FallbackComponent = null, + EmptyComponent, + settings, + surface, + style, + ...props +}) { + const colorScheme = useColorScheme(); + const { + content, + error, + isLoading + } = useContentCardUI(surface); + const renderItem = useCallback(({ + item + }) => { + return /*#__PURE__*/React.createElement(ContentCardView, { + template: item + }); + }, []); + if (isLoading) { + return LoadingComponent; + } + if (error) { + return ErrorComponent; + } + if (!content) { + return FallbackComponent; + } + if (content.length === 0) { + const emptyProps = settings?.content?.emptyStateSettings; + if (EmptyComponent) { + return /*#__PURE__*/cloneElement(EmptyComponent, { + ...emptyProps + }); + } + return /*#__PURE__*/React.createElement(EmptyState, { + image: emptyProps?.image?.[colorScheme ?? "light"]?.url, + text: settings?.content?.emptyStateSettings?.message?.content || "No Content Available" + }); + } + return /*#__PURE__*/React.createElement(ContentCardContainerProvider, { + settings: settings + }, /*#__PURE__*/React.createElement(FlatList, _extends({}, props, { + data: content, + contentContainerStyle: [styles.contentContainer, contentContainerStyle], + horizontal: settings?.content?.layout?.orientation === "horizontal", + renderItem: renderItem + }))); +} +export function ContentCardContainer({ + LoadingComponent = /*#__PURE__*/React.createElement(ActivityIndicator, null), + ErrorComponent = null, + FallbackComponent = null, + surface, + ...props +}) { + const { + settings, + error, + isLoading + } = useContentContainer(surface); + if (isLoading) { + return LoadingComponent; + } + if (error) { + return ErrorComponent; + } + if (!settings) { + return FallbackComponent; + } + return /*#__PURE__*/React.createElement(ContentCardContainerInner, _extends({ + settings: settings, + surface: surface, + LoadingComponent: LoadingComponent + }, props)); +} +const styles = StyleSheet.create({ + contentContainer: { + flex: 1 + } +}); +//# sourceMappingURL=ContentCardContainer.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/components/ContentCardContainer/ContentCardContainer.js.map b/packages/messaging/dist/module/ui/components/ContentCardContainer/ContentCardContainer.js.map new file mode 100644 index 00000000..02180e26 --- /dev/null +++ b/packages/messaging/dist/module/ui/components/ContentCardContainer/ContentCardContainer.js.map @@ -0,0 +1 @@ +{"version":3,"names":["ActivityIndicator","FlatList","StyleSheet","useColorScheme","ContentCardContainerProvider","ContentCardView","cloneElement","useCallback","useContentCardUI","useContentContainer","EmptyState","ContentCardContainerInner","contentContainerStyle","LoadingComponent","React","createElement","ErrorComponent","FallbackComponent","EmptyComponent","settings","surface","style","props","colorScheme","content","error","isLoading","renderItem","item","template","length","emptyProps","emptyStateSettings","image","url","text","message","_extends","data","styles","contentContainer","horizontal","layout","orientation","ContentCardContainer","create","flex"],"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AAS;IACnBC,OAAO,EAAEA,OAAQ;IACjBP,gBAAgB,EAAEA;EAAiB,GAC/BS,KAAK,CACV,CAAC;AAEN;AAEA,MAAMiB,MAAM,GAAGrC,UAAU,CAAC2C,MAAM,CAAC;EAC/BL,gBAAgB,EAAE;IAChBM,IAAI,EAAE;EACR;AACF,CAAC,CAAC","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/components/ContentCardContainer/EmptyState.js b/packages/messaging/dist/module/ui/components/ContentCardContainer/EmptyState.js new file mode 100644 index 00000000..91a147a0 --- /dev/null +++ b/packages/messaging/dist/module/ui/components/ContentCardContainer/EmptyState.js @@ -0,0 +1,16 @@ +"use strict"; + +import { Image, Text } from "react-native"; +import CenteredView from "../CenteredView/CenteredView.js"; +const EmptyState = ({ + image, + text +}) => { + return /*#__PURE__*/React.createElement(CenteredView, null, /*#__PURE__*/React.createElement(Image, { + source: { + uri: image + } + }), /*#__PURE__*/React.createElement(Text, null, text)); +}; +export default EmptyState; +//# sourceMappingURL=EmptyState.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/components/ContentCardContainer/EmptyState.js.map b/packages/messaging/dist/module/ui/components/ContentCardContainer/EmptyState.js.map new file mode 100644 index 00000000..15128da6 --- /dev/null +++ b/packages/messaging/dist/module/ui/components/ContentCardContainer/EmptyState.js.map @@ -0,0 +1 @@ +{"version":3,"names":["Image","Text","CenteredView","EmptyState","image","text","React","createElement","source","uri"],"sourceRoot":"../../../../../src","sources":["ui/components/ContentCardContainer/EmptyState.tsx"],"mappings":";;AAAA,SAASA,KAAK,EAAEC,IAAI,QAAQ,cAAc;AAC1C,OAAOC,YAAY,MAAM,iCAA8B;AAOvD,MAAMC,UAAqC,GAAGA,CAAC;EAAEC,KAAK;EAAEC;AAAK,CAAC,KAAK;EACjE,oBACEC,KAAA,CAAAC,aAAA,CAACL,YAAY,qBACXI,KAAA,CAAAC,aAAA,CAACP,KAAK;IAACQ,MAAM,EAAE;MAAEC,GAAG,EAAEL;IAAM;EAAE,CAAE,CAAC,eACjCE,KAAA,CAAAC,aAAA,CAACN,IAAI,QAAEI,IAAW,CACN,CAAC;AAEnB,CAAC;AAED,eAAeF,UAAU","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/components/ContentCardView/ContentCardView.js b/packages/messaging/dist/module/ui/components/ContentCardView/ContentCardView.js new file mode 100644 index 00000000..179d93a0 --- /dev/null +++ b/packages/messaging/dist/module/ui/components/ContentCardView/ContentCardView.js @@ -0,0 +1,251 @@ +"use strict"; + +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); } +/* + Copyright 2025 Adobe. All rights reserved. + This file is licensed to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law + or agreed to in writing, software distributed under the License is + distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF + ANY KIND, either express or implied. See the License for the specific + language governing permissions and limitations under the License. +*/ + +import React, { useEffect, useCallback, useState, useRef, useMemo } from "react"; +import { Image, Linking, Pressable, StyleSheet, Text, useColorScheme, View } from 'react-native'; +import MessagingEdgeEventType from "../../../models/MessagingEdgeEventType.js"; +import DismissButton from "../DismissButton/DismissButton.js"; +import UnreadIcon from "../UnreadIcon/UnreadIcon.js"; +import { useTheme } from "../../theme/index.js"; +import useAspectRatio from "../../hooks/useAspectRatio.js"; +import Button from "../Button/Button.js"; +import useContainerSettings from "../../hooks/useContainerSettings.js"; + +/** + * Callback function that is called when a content card event occurs. + */ + +/** Props for the ContentCardView component */ + +/** Renders a content card view + * @param {ContentViewProps} props - The props for the ContentCardView component + */ +export const ContentCardView = ({ + template, + listener, + variant, + styleOverrides: _styleOverrides, + style, + ContainerProps, + ImageContainerProps, + ImageProps, + ContentContainerProps, + TextProps, + TitleProps, + BodyProps, + ButtonContainerProps, + ButtonProps, + DismissButtonProps, + ...props +}) => { + const colorScheme = useColorScheme(); + const [isVisible, setIsVisible] = useState(true); + const isDisplayedRef = useRef(false); + const theme = useTheme(); + const containerSettings = useContainerSettings(); + // Track read state in component state + const [isRead, setIsRead] = useState(template.isRead); + + // Sync state when template changes + useEffect(() => { + setIsRead(template.isRead); + }, [template.isRead]); + + // Default to true if not specified + const isUnreadEnabled = containerSettings?.content?.isUnreadEnabled ?? true; + + // Get unread background color based on theme + const unreadBackgroundColor = useMemo(() => { + if (!isUnreadEnabled || isRead || !containerSettings?.content?.unread_indicator?.unread_bg) { + return undefined; + } + const unreadBg = containerSettings.content.unread_indicator.unread_bg; + return colorScheme === 'dark' ? unreadBg.clr.dark : unreadBg.clr.light; + }, [isUnreadEnabled, isRead, containerSettings, colorScheme]); + const cardVariant = useMemo(() => variant ?? template.type ?? "SmallImage", [variant, template.type]); + const onDismiss = useCallback(() => { + listener?.("onDismiss", template); + + // Track dismiss event using propositionItem + template.track?.(MessagingEdgeEventType.DISMISS); + setIsVisible(false); + }, [listener, template]); + const onPress = useCallback(() => { + listener?.("onInteract", template); + + // Track interaction event using propositionItem + template.track?.("content_clicked", MessagingEdgeEventType.INTERACT, null); + + // Mark as read when interacted with + template.isRead = true; + setIsRead(true); + if (template.data?.content?.actionUrl) { + try { + Linking.openURL(template.data.content.actionUrl); + } catch (error) { + console.warn(`Failed to open URL: ${template.data.content.actionUrl}`, error); + } + } + }, [template, listener]); + const imageUri = useMemo(() => { + if (colorScheme === "dark" && template.data?.content?.image?.darkUrl) { + return template.data.content.image.darkUrl; + } + return template.data.content.image?.url; + }, [colorScheme, template.data?.content?.image?.darkUrl, template.data?.content?.image?.url]); + const imageAspectRatio = useAspectRatio(imageUri); + const styleOverrides = useMemo(() => { + switch (cardVariant) { + case "SmallImage": + return _styleOverrides?.smallImageStyle; + case "LargeImage": + return _styleOverrides?.largeImageStyle; + case "ImageOnly": + return _styleOverrides?.imageOnlyStyle; + default: + return null; + } + }, [_styleOverrides, cardVariant]); + + // Call listener on mount to signal view display (only once to prevent duplicates) + useEffect(() => { + if (!isDisplayedRef.current) { + listener?.("onDisplay", template); + // Track display event using propositionItem + template.track?.(MessagingEdgeEventType.DISPLAY); + isDisplayedRef.current = true; + } + }, [listener, template]); + + // If not visible, return null to hide the entire view + if (!isVisible) { + return null; + } + if (!template.data) return null; + const content = template?.data?.content; + if (!content) return null; + return /*#__PURE__*/React.createElement(Pressable, _extends({ + onPress: onPress, + style: state => [styles.card, styleOverrides?.card, typeof style === "function" ? style(state) : style] + }, props), /*#__PURE__*/React.createElement(View, _extends({ + style: [cardVariant === "SmallImage" ? smallImageStyles.container : styles.container, styleOverrides?.container, unreadBackgroundColor && { + backgroundColor: unreadBackgroundColor + }] + }, ContainerProps), imageUri && /*#__PURE__*/React.createElement(View, _extends({ + style: [cardVariant === "SmallImage" ? smallImageStyles.imageContainer : styles.imageContainer, styleOverrides?.imageContainer] + }, ImageContainerProps), /*#__PURE__*/React.createElement(Image, _extends({ + source: { + uri: imageUri + }, + style: [cardVariant === "SmallImage" ? smallImageStyles.image : styles.image, { + aspectRatio: imageAspectRatio + }, styleOverrides?.image], + resizeMode: "contain" + }, ImageProps))), cardVariant !== "ImageOnly" && /*#__PURE__*/React.createElement(View, _extends({ + style: [styles.contentContainer, styleOverrides?.contentContainer] + }, ContentContainerProps), content?.title?.content && /*#__PURE__*/React.createElement(Text, _extends({ + style: [styles.title, { + color: theme.colors.textPrimary + }, styleOverrides?.text, styleOverrides?.title] + }, TextProps, TitleProps), content.title.content), content?.body?.content && /*#__PURE__*/React.createElement(Text, _extends({ + style: [styles.body, { + color: theme.colors.textPrimary + }, styleOverrides?.text, styleOverrides?.body] + }, TextProps, BodyProps), content.body.content), /*#__PURE__*/React.createElement(View, _extends({ + style: [styles.buttonContainer, styleOverrides?.buttonContainer] + }, ButtonContainerProps), content?.buttons?.length && content?.buttons?.length > 0 && content.buttons.map(button => /*#__PURE__*/React.createElement(Button, _extends({ + key: button.id, + actionUrl: button.actionUrl, + title: button.text.content, + onPress: onPress, + style: styleOverrides?.button, + textStyle: [styleOverrides?.text, styleOverrides?.buttonText] + }, ButtonProps))))), content?.dismissBtn && content.dismissBtn?.style !== "none" && /*#__PURE__*/React.createElement(DismissButton, _extends({ + onPress: onDismiss, + type: content.dismissBtn.style + }, DismissButtonProps)), isUnreadEnabled && !isRead && /*#__PURE__*/React.createElement(UnreadIcon, null))); +}; +const styles = StyleSheet.create({ + card: { + margin: 15, + flex: 1 + }, + container: { + flexDirection: "column" + }, + imageContainer: { + alignItems: "center", + borderRadius: 12, + backgroundColor: "#f0f0f0" + }, + image: { + width: "100%", + resizeMode: "contain" + }, + contentContainer: { + flex: 1, + paddingVertical: 16, + paddingHorizontal: 16, + justifyContent: "flex-start" + }, + textContent: { + flex: 1, + justifyContent: "flex-start", + marginBottom: 16 + }, + title: { + fontSize: 16, + fontWeight: "600", + marginBottom: 8, + marginRight: 16 + }, + body: { + fontSize: 14, + lineHeight: 18 + }, + buttonContainer: { + flexDirection: "row", + justifyContent: "flex-start", + flexWrap: "wrap", + paddingTop: 8, + gap: 8 + }, + button: { + marginHorizontal: 8 + } +}); +const smallImageStyles = StyleSheet.create({ + card: { + borderRadius: 12, + flexDirection: "row", + gap: 8, + maxWidth: "100%", + alignItems: "center" + }, + container: { + flexDirection: "row" + }, + imageContainer: { + borderRadius: 12, + maxWidth: "35%", + alignSelf: "center" + }, + image: { + resizeMode: "contain", + width: "100%", + maxWidth: "100%" + } +}); +//# sourceMappingURL=ContentCardView.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/components/ContentCardView/ContentCardView.js.map b/packages/messaging/dist/module/ui/components/ContentCardView/ContentCardView.js.map new file mode 100644 index 00000000..b55daaaa --- /dev/null +++ b/packages/messaging/dist/module/ui/components/ContentCardView/ContentCardView.js.map @@ -0,0 +1 @@ +{"version":3,"names":["React","useEffect","useCallback","useState","useRef","useMemo","Image","Linking","Pressable","StyleSheet","Text","useColorScheme","View","MessagingEdgeEventType","DismissButton","UnreadIcon","useTheme","useAspectRatio","Button","useContainerSettings","ContentCardView","template","listener","variant","styleOverrides","_styleOverrides","style","ContainerProps","ImageContainerProps","ImageProps","ContentContainerProps","TextProps","TitleProps","BodyProps","ButtonContainerProps","ButtonProps","DismissButtonProps","props","colorScheme","isVisible","setIsVisible","isDisplayedRef","theme","containerSettings","isRead","setIsRead","isUnreadEnabled","content","unreadBackgroundColor","unread_indicator","unread_bg","undefined","unreadBg","clr","dark","light","cardVariant","type","onDismiss","track","DISMISS","onPress","INTERACT","data","actionUrl","openURL","error","console","warn","imageUri","image","darkUrl","url","imageAspectRatio","smallImageStyle","largeImageStyle","imageOnlyStyle","current","DISPLAY","createElement","_extends","state","styles","card","smallImageStyles","container","backgroundColor","imageContainer","source","uri","aspectRatio","resizeMode","contentContainer","title","color","colors","textPrimary","text","body","buttonContainer","buttons","length","map","button","key","id","textStyle","buttonText","dismissBtn","create","margin","flex","flexDirection","alignItems","borderRadius","width","paddingVertical","paddingHorizontal","justifyContent","textContent","marginBottom","fontSize","fontWeight","marginRight","lineHeight","flexWrap","paddingTop","gap","marginHorizontal","maxWidth","alignSelf"],"sourceRoot":"../../../../../src","sources":["ui/components/ContentCardView/ContentCardView.tsx"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,IACVC,SAAS,EACTC,WAAW,EACXC,QAAQ,EACRC,MAAM,EACNC,OAAO,QACF,OAAO;AASd,SACEC,KAAK,EACLC,OAAO,EACPC,SAAS,EAETC,UAAU,EACVC,IAAI,EACJC,cAAc,EACdC,IAAI,QACC,cAAc;AACrB,OAAOC,sBAAsB,MAAM,2CAAwC;AAC3E,OAAOC,aAAa,MAAM,mCAAgC;AAC1D,OAAOC,UAAU,MAAM,6BAA0B;AACjD,SAASC,QAAQ,QAAQ,sBAAa;AACtC,OAAOC,cAAc,MAAM,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EAAE,EAAE;IACrBC,cAAc,EAAE;EAClB,CAAC;EACDC,WAAW,EAAE;IACXR,IAAI,EAAE,CAAC;IACPO,cAAc,EAAE,YAAY;IAC5BE,YAAY,EAAE;EAChB,CAAC;EACD3B,KAAK,EAAE;IACL4B,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE,KAAK;IACjBF,YAAY,EAAE,CAAC;IACfG,WAAW,EAAE;EACf,CAAC;EACDzB,IAAI,EAAE;IACJuB,QAAQ,EAAE,EAAE;IACZG,UAAU,EAAE;EACd,CAAC;EACDzB,eAAe,EAAE;IACfa,aAAa,EAAE,KAAK;IACpBM,cAAc,EAAE,YAAY;IAC5BO,QAAQ,EAAE,MAAM;IAChBC,UAAU,EAAE,CAAC;IACbC,GAAG,EAAE;EACP,CAAC;EACDxB,MAAM,EAAE;IACNyB,gBAAgB,EAAE;EACpB;AACF,CAAC,CAAC;AAEF,MAAM5C,gBAAgB,GAAG3E,UAAU,CAACoG,MAAM,CAAC;EACzC1B,IAAI,EAAE;IACJ+B,YAAY,EAAE,EAAE;IAChBF,aAAa,EAAE,KAAK;IACpBe,GAAG,EAAE,CAAC;IACNE,QAAQ,EAAE,MAAM;IAChBhB,UAAU,EAAE;EACd,CAAC;EACD5B,SAAS,EAAE;IACT2B,aAAa,EAAE;EACjB,CAAC;EACDzB,cAAc,EAAE;IACd2B,YAAY,EAAE,EAAE;IAChBe,QAAQ,EAAE,KAAK;IACfC,SAAS,EAAE;EACb,CAAC;EACD5D,KAAK,EAAE;IACLqB,UAAU,EAAE,SAAS;IACrBwB,KAAK,EAAE,MAAM;IACbc,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/components/DismissButton/DismissButton.js b/packages/messaging/dist/module/ui/components/DismissButton/DismissButton.js new file mode 100644 index 00000000..47fe26ed --- /dev/null +++ b/packages/messaging/dist/module/ui/components/DismissButton/DismissButton.js @@ -0,0 +1,67 @@ +"use strict"; + +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); } +/* + Copyright 2025 Adobe. All rights reserved. + This file is licensed to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law + or agreed to in writing, software distributed under the License is + distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF + ANY KIND, either express or implied. See the License for the specific + language governing permissions and limitations under the License. +*/ +import { Pressable, StyleSheet, Text, useColorScheme } from "react-native"; + +/** Props for the DismissButton component. Extends the PressableProps from react-native. */ + +const DismissButton = ({ + onPress, + type, + textStyle, + style, + ...props +}) => { + const colorScheme = useColorScheme(); + return /*#__PURE__*/React.createElement(Pressable, _extends({ + onPress: onPress, + style: state => [styles.container, type === "simple" && styles.simple, type === "circle" && [styles.circle, { + backgroundColor: colorScheme === "dark" ? "rgba(255,255,255,0.1)" : "rgba(0,0,0,0.1)" + }], state.pressed && styles.pressed, typeof style === "function" ? style(state) : style] + }, props), /*#__PURE__*/React.createElement(Text, { + style: [styles.text, { + color: colorScheme === "dark" ? "white" : "black" + }, textStyle] + }, "x")); +}; +export default DismissButton; +const styles = StyleSheet.create({ + container: { + position: "absolute", + top: 6, + right: 6, + zIndex: 1000, + justifyContent: "center", + alignItems: "center", + minWidth: 18, + minHeight: 18 + }, + pressed: { + opacity: 0.7 + }, + simple: { + backgroundColor: "transparent" + }, + circle: { + borderRadius: 10, + width: 18, + height: 18 + }, + text: { + fontSize: 14, + fontWeight: "bold", + textAlign: "center" + } +}); +//# sourceMappingURL=DismissButton.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/components/DismissButton/DismissButton.js.map b/packages/messaging/dist/module/ui/components/DismissButton/DismissButton.js.map new file mode 100644 index 00000000..f9c755b3 --- /dev/null +++ b/packages/messaging/dist/module/ui/components/DismissButton/DismissButton.js.map @@ -0,0 +1 @@ +{"version":3,"names":["Pressable","StyleSheet","Text","useColorScheme","DismissButton","onPress","type","textStyle","style","props","colorScheme","React","createElement","_extends","state","styles","container","simple","circle","backgroundColor","pressed","text","color","create","position","top","right","zIndex","justifyContent","alignItems","minWidth","minHeight","opacity","borderRadius","width","height","fontSize","fontWeight","textAlign"],"sourceRoot":"../../../../../src","sources":["ui/components/DismissButton/DismissButton.tsx"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SACEA,SAAS,EAETC,UAAU,EACVC,IAAI,EAEJC,cAAc,QACT,cAAc;;AAErB;;AAUA,MAAMC,aAAa,GAAGA,CAAC;EACrBC,OAAO;EACPC,IAAI;EACJC,SAAS;EACTC,KAAK;EACL,GAAGC;AACe,CAAC,KAAK;EACxB,MAAMC,WAAW,GAAGP,cAAc,CAAC,CAAC;EAEpC,oBACEQ,KAAA,CAAAC,aAAA,CAACZ,SAAS,EAAAa,QAAA;IACRR,OAAO,EAAEA,OAAQ;IACjBG,KAAK,EAAGM,KAAK,IAAK,CAChBC,MAAM,CAACC,SAAS,EAChBV,IAAI,KAAK,QAAQ,IAAIS,MAAM,CAACE,MAAM,EAClCX,IAAI,KAAK,QAAQ,IAAI,CACnBS,MAAM,CAACG,MAAM,EACb;MACEC,eAAe,EACbT,WAAW,KAAK,MAAM,GAClB,uBAAuB,GACvB;IACR,CAAC,CACF,EACDI,KAAK,CAACM,OAAO,IAAIL,MAAM,CAACK,OAAO,EAC/B,OAAOZ,KAAK,KAAK,UAAU,GAAGA,KAAK,CAACM,KAAK,CAAC,GAAGN,KAAK;EAClD,GACEC,KAAK,gBAETE,KAAA,CAAAC,aAAA,CAACV,IAAI;IACHM,KAAK,EAAE,CACLO,MAAM,CAACM,IAAI,EACX;MAAEC,KAAK,EAAEZ,WAAW,KAAK,MAAM,GAAG,OAAO,GAAG;IAAQ,CAAC,EACrDH,SAAS;EACT,GACH,GAEK,CACG,CAAC;AAEhB,CAAC;AAED,eAAeH,aAAa;AAE5B,MAAMW,MAAM,GAAGd,UAAU,CAACsB,MAAM,CAAC;EAC/BP,SAAS,EAAE;IACTQ,QAAQ,EAAE,UAAU;IACpBC,GAAG,EAAE,CAAC;IACNC,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE,IAAI;IACZC,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE,QAAQ;IACpBC,QAAQ,EAAE,EAAE;IACZC,SAAS,EAAE;EACb,CAAC;EACDX,OAAO,EAAE;IACPY,OAAO,EAAE;EACX,CAAC;EACDf,MAAM,EAAE;IACNE,eAAe,EAAE;EACnB,CAAC;EACDD,MAAM,EAAE;IACNe,YAAY,EAAE,EAAE;IAChBC,KAAK,EAAE,EAAE;IACTC,MAAM,EAAE;EACV,CAAC;EACDd,IAAI,EAAE;IACJe,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE,MAAM;IAClBC,SAAS,EAAE;EACb;AACF,CAAC,CAAC","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/components/DismissButton/DismissButton.spec.js b/packages/messaging/dist/module/ui/components/DismissButton/DismissButton.spec.js new file mode 100644 index 00000000..575bfda5 --- /dev/null +++ b/packages/messaging/dist/module/ui/components/DismissButton/DismissButton.spec.js @@ -0,0 +1,284 @@ +"use strict"; + +/* + Copyright 2025 Adobe. All rights reserved. + This file is licensed to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law + or agreed to in writing, software distributed under the License is + distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF + ANY KIND, either express or implied. See the License for the specific + language governing permissions and limitations under the License. +*/ +import { render, screen, fireEvent } from '@testing-library/react-native'; +import { useColorScheme } from 'react-native'; +import DismissButton from "./DismissButton.js"; + +// Mock useColorScheme +jest.mock('react-native/Libraries/Utilities/useColorScheme'); +const mockUseColorScheme = useColorScheme; +describe('DismissButton', () => { + const mockOnPress = jest.fn(); + beforeEach(() => { + jest.clearAllMocks(); + mockUseColorScheme.mockReturnValue('light'); + }); + describe('Basic rendering', () => { + it('should render a dismiss button with type "simple"', () => { + render(/*#__PURE__*/React.createElement(DismissButton, { + onPress: mockOnPress, + type: "simple" + })); + const button = screen.getByText('x'); + expect(button).toBeTruthy(); + }); + it('should render a dismiss button with type "circle"', () => { + render(/*#__PURE__*/React.createElement(DismissButton, { + onPress: mockOnPress, + type: "circle" + })); + const button = screen.getByText('x'); + expect(button).toBeTruthy(); + }); + it('should display "x" as the button text', () => { + render(/*#__PURE__*/React.createElement(DismissButton, { + onPress: mockOnPress, + type: "simple" + })); + expect(screen.getByText('x')).toBeTruthy(); + }); + }); + describe('Press handling', () => { + it('should call onPress when the button is pressed', () => { + render(/*#__PURE__*/React.createElement(DismissButton, { + onPress: mockOnPress, + type: "simple" + })); + const button = screen.getByText('x'); + fireEvent.press(button); + expect(mockOnPress).toHaveBeenCalledTimes(1); + }); + it('should call onPress multiple times when pressed multiple times', () => { + render(/*#__PURE__*/React.createElement(DismissButton, { + onPress: mockOnPress, + type: "circle" + })); + const button = screen.getByText('x'); + fireEvent.press(button); + fireEvent.press(button); + fireEvent.press(button); + expect(mockOnPress).toHaveBeenCalledTimes(3); + }); + }); + describe('Color scheme handling', () => { + it('should apply light color scheme styles', () => { + mockUseColorScheme.mockReturnValue('light'); + render(/*#__PURE__*/React.createElement(DismissButton, { + onPress: mockOnPress, + type: "simple" + })); + const text = screen.getByText('x'); + expect(text.props.style).toEqual(expect.arrayContaining([expect.objectContaining({ + color: 'black' + })])); + }); + it('should apply dark color scheme styles', () => { + mockUseColorScheme.mockReturnValue('dark'); + render(/*#__PURE__*/React.createElement(DismissButton, { + onPress: mockOnPress, + type: "simple" + })); + const text = screen.getByText('x'); + expect(text.props.style).toEqual(expect.arrayContaining([expect.objectContaining({ + color: 'white' + })])); + }); + it('should apply correct background color for circle type in light mode', () => { + mockUseColorScheme.mockReturnValue('light'); + const { + getByTestId + } = render(/*#__PURE__*/React.createElement(DismissButton, { + onPress: mockOnPress, + type: "circle", + testID: "dismiss-button" + })); + const button = getByTestId('dismiss-button'); + const styles = JSON.stringify(button.props.style); + expect(styles).toContain('rgba(0,0,0,0.1)'); + }); + it('should apply correct background color for circle type in dark mode', () => { + mockUseColorScheme.mockReturnValue('dark'); + const { + getByTestId + } = render(/*#__PURE__*/React.createElement(DismissButton, { + onPress: mockOnPress, + type: "circle", + testID: "dismiss-button" + })); + const button = getByTestId('dismiss-button'); + const styles = JSON.stringify(button.props.style); + expect(styles).toContain('rgba(255,255,255,0.1)'); + }); + }); + describe('Type variations', () => { + it('should apply simple type styles', () => { + const { + getByTestId + } = render(/*#__PURE__*/React.createElement(DismissButton, { + onPress: mockOnPress, + type: "simple", + testID: "dismiss-button" + })); + const button = getByTestId('dismiss-button'); + expect(button.props.style).toEqual(expect.arrayContaining([expect.objectContaining({ + backgroundColor: 'transparent' + })])); + }); + it('should apply circle type styles', () => { + const { + getByTestId + } = render(/*#__PURE__*/React.createElement(DismissButton, { + onPress: mockOnPress, + type: "circle", + testID: "dismiss-button" + })); + const button = getByTestId('dismiss-button'); + const styles = JSON.stringify(button.props.style); + expect(styles).toContain('"borderRadius":10'); + expect(styles).toContain('"width":18'); + expect(styles).toContain('"height":18'); + }); + }); + describe('Custom props and styles', () => { + it('should accept and apply custom style props', () => { + const customStyle = { + opacity: 0.5 + }; + const { + getByTestId + } = render(/*#__PURE__*/React.createElement(DismissButton, { + onPress: mockOnPress, + type: "simple", + style: customStyle, + testID: "dismiss-button" + })); + const button = getByTestId('dismiss-button'); + expect(button.props.style).toEqual(expect.arrayContaining([expect.objectContaining({ + opacity: 0.5 + })])); + }); + it('should accept function-based style props', () => { + const styleFn = jest.fn().mockReturnValue({ + opacity: 0.8 + }); + const { + getByTestId + } = render(/*#__PURE__*/React.createElement(DismissButton, { + onPress: mockOnPress, + type: "simple", + style: styleFn, + testID: "dismiss-button" + })); + expect(styleFn).toHaveBeenCalled(); + const button = getByTestId('dismiss-button'); + expect(button.props.style).toEqual(expect.arrayContaining([expect.objectContaining({ + opacity: 0.8 + })])); + }); + it('should accept additional Pressable props', () => { + const { + getByTestId + } = render(/*#__PURE__*/React.createElement(DismissButton, { + onPress: mockOnPress, + type: "simple", + testID: "dismiss-button", + disabled: true, + accessibilityLabel: "Close button" + })); + const button = getByTestId('dismiss-button'); + expect(button.props.accessibilityState?.disabled).toBe(true); + expect(button.props.accessibilityLabel).toBe('Close button'); + }); + }); + describe('Accessibility', () => { + it('should be accessible by default', () => { + const { + getByTestId + } = render(/*#__PURE__*/React.createElement(DismissButton, { + onPress: mockOnPress, + type: "simple", + testID: "dismiss-button" + })); + const button = getByTestId('dismiss-button'); + expect(button).toBeTruthy(); + }); + it('should accept custom accessibility props', () => { + const { + getByTestId + } = render(/*#__PURE__*/React.createElement(DismissButton, { + onPress: mockOnPress, + type: "simple", + testID: "dismiss-button", + accessibilityLabel: "Dismiss notification", + accessibilityHint: "Double tap to close this notification" + })); + const button = getByTestId('dismiss-button'); + expect(button.props.accessibilityLabel).toBe('Dismiss notification'); + expect(button.props.accessibilityHint).toBe('Double tap to close this notification'); + }); + }); + describe('Positioning and layout', () => { + it('should have absolute positioning styles', () => { + const { + getByTestId + } = render(/*#__PURE__*/React.createElement(DismissButton, { + onPress: mockOnPress, + type: "simple", + testID: "dismiss-button" + })); + const button = getByTestId('dismiss-button'); + expect(button.props.style).toEqual(expect.arrayContaining([expect.objectContaining({ + position: 'absolute', + top: 6, + right: 6, + zIndex: 1000 + })])); + }); + it('should have minimum dimensions', () => { + const { + getByTestId + } = render(/*#__PURE__*/React.createElement(DismissButton, { + onPress: mockOnPress, + type: "simple", + testID: "dismiss-button" + })); + const button = getByTestId('dismiss-button'); + expect(button.props.style).toEqual(expect.arrayContaining([expect.objectContaining({ + minWidth: 18, + minHeight: 18 + })])); + }); + }); + describe('Edge cases', () => { + it('should handle undefined color scheme gracefully', () => { + mockUseColorScheme.mockReturnValue(undefined); + expect(() => { + render(/*#__PURE__*/React.createElement(DismissButton, { + onPress: mockOnPress, + type: "simple" + })); + }).not.toThrow(); + }); + it('should handle null color scheme gracefully', () => { + mockUseColorScheme.mockReturnValue(null); + expect(() => { + render(/*#__PURE__*/React.createElement(DismissButton, { + onPress: mockOnPress, + type: "simple" + })); + }).not.toThrow(); + }); + }); +}); +//# sourceMappingURL=DismissButton.spec.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/components/DismissButton/DismissButton.spec.js.map b/packages/messaging/dist/module/ui/components/DismissButton/DismissButton.spec.js.map new file mode 100644 index 00000000..1978892c --- /dev/null +++ b/packages/messaging/dist/module/ui/components/DismissButton/DismissButton.spec.js.map @@ -0,0 +1 @@ +{"version":3,"names":["render","screen","fireEvent","useColorScheme","DismissButton","jest","mock","mockUseColorScheme","describe","mockOnPress","fn","beforeEach","clearAllMocks","mockReturnValue","it","React","createElement","onPress","type","button","getByText","expect","toBeTruthy","press","toHaveBeenCalledTimes","text","props","style","toEqual","arrayContaining","objectContaining","color","getByTestId","testID","styles","JSON","stringify","toContain","backgroundColor","customStyle","opacity","styleFn","toHaveBeenCalled","disabled","accessibilityLabel","accessibilityState","toBe","accessibilityHint","position","top","right","zIndex","minWidth","minHeight","undefined","not","toThrow"],"sourceRoot":"../../../../../src","sources":["ui/components/DismissButton/DismissButton.spec.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,MAAM,EAAEC,MAAM,EAAEC,SAAS,QAAQ,+BAA+B;AACzE,SAASC,cAAc,QAAQ,cAAc;AAC7C,OAAOC,aAAa,MAAM,oBAAiB;;AAE3C;AACAC,IAAI,CAACC,IAAI,CAAC,iDAAiD,CAAC;AAC5D,MAAMC,kBAAkB,GAAGJ,cAE1B;AAEDK,QAAQ,CAAC,eAAe,EAAE,MAAM;EAC9B,MAAMC,WAA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;QACbe,MAAM,EAAC;MAAgB,CACxB,CACH,CAAC;MAED,MAAMd,MAAM,GAAGa,WAAW,CAAC,gBAAgB,CAAC;MAC5CX,MAAM,CAACF,MAAM,CAACO,KAAK,CAACC,KAAK,CAAC,CAACC,OAAO,CAChCP,MAAM,CAACQ,eAAe,CAAC,CACrBR,MAAM,CAACS,gBAAgB,CAAC;QACtBsB,QAAQ,EAAE,EAAE;QACZC,SAAS,EAAE;MACb,CAAC,CAAC,CACH,CACH,CAAC;IACH,CAAC,CAAC;EACJ,CAAC,CAAC;EAEF7C,QAAQ,CAAC,YAAY,EAAE,MAAM;IAC3BM,EAAE,CAAC,iDAAiD,EAAE,MAAM;MAC1DP,kBAAkB,CAACM,eAAe,CAACyC,SAAgB,CAAC;MAEpDjC,MAAM,CAAC,MAAM;QACXrB,MAAM,cAACe,KAAA,CAAAC,aAAA,CAACZ,aAAa;UAACa,OAAO,EAAER,WAAY;UAACS,IAAI,EAAC;QAAQ,CAAE,CAAC,CAAC;MAC/D,CAAC,CAAC,CAACqC,GAAG,CAACC,OAAO,CAAC,CAAC;IAClB,CAAC,CAAC;IAEF1C,EAAE,CAAC,4CAA4C,EAAE,MAAM;MACrDP,kBAAkB,CAACM,eAAe,CAAC,IAAW,CAAC;MAE/CQ,MAAM,CAAC,MAAM;QACXrB,MAAM,cAACe,KAAA,CAAAC,aAAA,CAACZ,aAAa;UAACa,OAAO,EAAER,WAAY;UAACS,IAAI,EAAC;QAAQ,CAAE,CAAC,CAAC;MAC/D,CAAC,CAAC,CAACqC,GAAG,CAACC,OAAO,CAAC,CAAC;IAClB,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/components/Pagination/Pagination.js b/packages/messaging/dist/module/ui/components/Pagination/Pagination.js new file mode 100644 index 00000000..6ea955ab --- /dev/null +++ b/packages/messaging/dist/module/ui/components/Pagination/Pagination.js @@ -0,0 +1,152 @@ +"use strict"; + +import React, { useEffect, useRef } from "react"; +import { View, StyleSheet, useColorScheme, TouchableOpacity, Animated } from "react-native"; +const PaginationDot = ({ + page, + isActive, + finalInactiveColor, + finalActiveColor, + dotSize, + onPageChange +}) => { + const scaleAnim = useRef(new Animated.Value(isActive ? 1.2 : 1)).current; + const opacityAnim = useRef(new Animated.Value(isActive ? 1 : 0.6)).current; + useEffect(() => { + Animated.parallel([Animated.spring(scaleAnim, { + toValue: isActive ? 1.2 : 1, + useNativeDriver: true, + tension: 100, + friction: 8 + }), Animated.timing(opacityAnim, { + toValue: isActive ? 1 : 0.6, + duration: 200, + useNativeDriver: true + })]).start(); + }, [isActive, scaleAnim, opacityAnim]); + return /*#__PURE__*/React.createElement(TouchableOpacity, { + onPress: () => onPageChange(page), + style: styles.dotContainer, + activeOpacity: 0.7 + }, /*#__PURE__*/React.createElement(Animated.View, { + style: [styles.dot, { + width: dotSize, + height: dotSize, + backgroundColor: isActive ? finalActiveColor : finalInactiveColor, + opacity: opacityAnim, + transform: [{ + scale: scaleAnim + }] + }] + })); +}; +export const Pagination = ({ + currentPage, + totalPages, + onPageChange, + maxVisibleDots = 5, + activeColor, + inactiveColor, + dotSize = 8, + spacing = 8 +}) => { + const colorScheme = useColorScheme(); + const isDark = colorScheme === "dark"; + const slideAnim = useRef(new Animated.Value(0)).current; + const prevVisiblePagesRef = useRef([]); + + // Default colors based on theme + const defaultActiveColor = isDark ? "#fff" : "#0a7ea4"; + const defaultInactiveColor = isDark ? "#9BA1A6" : "#687076"; + const finalActiveColor = activeColor || defaultActiveColor; + const finalInactiveColor = inactiveColor || defaultInactiveColor; + + // Calculate which dots to show + const getVisiblePages = () => { + if (totalPages <= maxVisibleDots) { + return Array.from({ + length: totalPages + }, (_, i) => i); + } + const halfVisible = Math.floor(maxVisibleDots / 2); + let startPage = Math.max(0, currentPage - halfVisible); + let endPage = Math.min(totalPages - 1, startPage + maxVisibleDots - 1); + + // Adjust start if we're near the end + if (endPage === totalPages - 1) { + startPage = Math.max(0, endPage - maxVisibleDots + 1); + } + return Array.from({ + length: endPage - startPage + 1 + }, (_, i) => startPage + i); + }; + const visiblePages = getVisiblePages(); + + // Animate sliding when visible pages change + useEffect(() => { + const prevVisiblePages = prevVisiblePagesRef.current; + if (prevVisiblePages.length > 0 && totalPages > maxVisibleDots) { + const prevStartPage = prevVisiblePages[0]; + const currentStartPage = visiblePages[0]; + if (prevStartPage !== currentStartPage) { + const direction = currentStartPage > prevStartPage ? 1 : -1; + const dotWidth = dotSize + spacing; + + // Start from offset position + slideAnim.setValue(direction * dotWidth); + + // Animate back to center + Animated.timing(slideAnim, { + toValue: 0, + duration: 300, + useNativeDriver: true + }).start(); + } + } + prevVisiblePagesRef.current = visiblePages; + }, [visiblePages, slideAnim, dotSize, spacing, maxVisibleDots, totalPages]); + if (totalPages <= 1) { + return null; + } + return /*#__PURE__*/React.createElement(View, { + style: styles.container + }, /*#__PURE__*/React.createElement(Animated.View, { + style: [styles.dotsContainer, { + gap: spacing, + transform: [{ + translateX: slideAnim + }] + }] + }, visiblePages.map(page => /*#__PURE__*/React.createElement(PaginationDot, { + key: page, + page: page, + isActive: page === currentPage, + finalInactiveColor: finalInactiveColor, + finalActiveColor: finalActiveColor, + dotSize: dotSize, + onPageChange: onPageChange + })))); +}; +const styles = StyleSheet.create({ + container: { + alignItems: "center", + justifyContent: "center", + overflow: "hidden", + backgroundColor: 'blue', + flex: 1 + }, + dotsContainer: { + flexDirection: "row", + alignItems: "center", + justifyContent: "center" + }, + dotContainer: { + alignItems: "center", + justifyContent: "center" + }, + dot: { + borderRadius: 50 + } +}); +export default Pagination; +//# sourceMappingURL=Pagination.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/components/Pagination/Pagination.js.map b/packages/messaging/dist/module/ui/components/Pagination/Pagination.js.map new file mode 100644 index 00000000..bb869a30 --- /dev/null +++ b/packages/messaging/dist/module/ui/components/Pagination/Pagination.js.map @@ -0,0 +1 @@ +{"version":3,"names":["React","useEffect","useRef","View","StyleSheet","useColorScheme","TouchableOpacity","Animated","PaginationDot","page","isActive","finalInactiveColor","finalActiveColor","dotSize","onPageChange","scaleAnim","Value","current","opacityAnim","parallel","spring","toValue","useNativeDriver","tension","friction","timing","duration","start","createElement","onPress","style","styles","dotContainer","activeOpacity","dot","width","height","backgroundColor","opacity","transform","scale","Pagination","currentPage","totalPages","maxVisibleDots","activeColor","inactiveColor","spacing","colorScheme","isDark","slideAnim","prevVisiblePagesRef","defaultActiveColor","defaultInactiveColor","getVisiblePages","Array","from","length","_","i","halfVisible","Math","floor","startPage","max","endPage","min","visiblePages","prevVisiblePages","prevStartPage","currentStartPage","direction","dotWidth","setValue","container","dotsContainer","gap","translateX","map","key","create","alignItems","justifyContent","overflow","flex","flexDirection","borderRadius"],"sourceRoot":"../../../../../src","sources":["ui/components/Pagination/Pagination.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAChD,SACEC,IAAI,EACJC,UAAU,EACVC,cAAc,EACdC,gBAAgB,EAChBC,QAAQ,QACH,cAAc;AAErB,MAAMC,aAAa,GAAGA,CAAC;EACrBC,IAAI;EACJC,QAAQ;EACRC,kBAAkB;EAClBC,gBAAgB;EAChBC,OAAO;EACPC;AAQF,CAAC,KAAK;EACJ,MAAMC,SAAS,GAAGb,MAAM,CAAC,IAAIK,QAAQ,CAACS,KAAK,CAACN,QAAQ,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,CAACO,OAAO;EACxE,MAAMC,WAAW,GAAGhB,MAAM,CAAC,IAAIK,QAAQ,CAACS,KAAK,CAACN,QAAQ,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAACO,OAAO;EAE1EhB,SAAS,CAAC,MAAM;IACdM,QAAQ,CAACY,QAAQ,CAAC,CAChBZ,QAAQ,CAACa,MAAM,CAACL,SAAS,EAAE;MACzBM,OAAO,EAAEX,QAAQ,GAAG,GAAG,GAAG,CAAC;MAC3BY,eAAe,EAAE,IAAI;MAC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aAAa;IACZuE,GAAG,EAAEtE,IAAK;IACVA,IAAI,EAAEA,IAAK;IACXC,QAAQ,EAAED,IAAI,KAAKiC,WAAY;IAC/B/B,kBAAkB,EAAEA,kBAAmB;IACvCC,gBAAgB,EAAEA,gBAAiB;IACnCC,OAAO,EAAEA,OAAQ;IACjBC,YAAY,EAAEA;EAAa,CAC5B,CACF,CACY,CACX,CAAC;AAEX,CAAC;AAED,MAAMiB,MAAM,GAAG3B,UAAU,CAAC4E,MAAM,CAAC;EAC/BN,SAAS,EAAE;IACTO,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE,QAAQ;IACxBC,QAAQ,EAAE,QAAQ;IAClB9C,eAAe,EAAE,MAAM;IACvB+C,IAAI,EAAE;EACR,CAAC;EACDT,aAAa,EAAE;IACbU,aAAa,EAAE,KAAK;IACpBJ,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE;EAClB,CAAC;EACDlD,YAAY,EAAE;IACZiD,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE;EAClB,CAAC;EACDhD,GAAG,EAAE;IACHoD,YAAY,EAAE;EAChB;AACF,CAAC,CAAC;AAEF,eAAe7C,UAAU","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.js b/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.js new file mode 100644 index 00000000..a590ba83 --- /dev/null +++ b/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.js @@ -0,0 +1,185 @@ +"use strict"; + +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); } +/* + Copyright 2025 Adobe. All rights reserved. + This file is licensed to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law + or agreed to in writing, software distributed under the License is + distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF + ANY KIND, either express or implied. See the License for the specific + language governing permissions and limitations under the License. +*/ +import React, { useState, useMemo, useEffect } from 'react'; +import { Image, StyleSheet, View, useColorScheme } from 'react-native'; +import useContainerSettings from "../../hooks/useContainerSettings.js"; +const Dot = ({ + size, + backgroundColor +}) => /*#__PURE__*/React.createElement(View, { + style: [styles.dot, { + width: size, + height: size, + borderRadius: size / 2, + backgroundColor + }] +}); +const UnreadIcon = ({ + imageStyle, + containerStyle, + source, + darkSource, + size = 20, + position = 'topright', + type = 'dot', + style, + ...props +}) => { + const colorScheme = useColorScheme(); + const settings = useContainerSettings(); + const [imageLoadError, setImageLoadError] = useState(false); + + // Get unread indicator settings from context + const unreadSettings = settings?.content.unread_indicator; + + // Use settings from context with fallbacks to props + const displayPosition = unreadSettings?.unread_icon?.placement ?? position; + const imageSource = unreadSettings?.unread_icon?.image?.url ? { + uri: unreadSettings.unread_icon.image.url + } : source; + const darkImageSource = unreadSettings?.unread_icon?.image?.darkUrl ? { + uri: unreadSettings.unread_icon.image.darkUrl + } : darkSource; + + // Determine if we should render as image type (only if we have valid URLs) + const hasImageUrl = Boolean(unreadSettings?.unread_icon?.image?.url || unreadSettings?.unread_icon?.image?.darkUrl || imageSource || darkImageSource); + const renderType = hasImageUrl ? 'image' : type; + + // Reset error state when image source changes + useEffect(() => { + setImageLoadError(false); + }, [imageSource, darkImageSource]); + const positionStyle = useMemo(() => { + switch (displayPosition) { + case 'topleft': + return styles.positionTopLeft; + case 'topright': + return styles.positionTopRight; + case 'bottomleft': + return styles.positionBottomLeft; + case 'bottomright': + return styles.positionBottomRight; + default: + return styles.positionTopRight; + } + }, [displayPosition]); + + // Use default contrasting colors for visibility + // Note: unread_bg.clr is for the card background, not the dot + const dotColor = useMemo(() => colorScheme === 'dark' ? '#FF6B6B' : '#FF4444', [colorScheme]); + const finalImageSource = useMemo(() => colorScheme === 'dark' && darkImageSource ? darkImageSource : imageSource, [colorScheme, darkImageSource, imageSource]); + const content = useMemo(() => { + // Check if we should show dot instead of image based on URL availability + const isEmptyUrlForCurrentMode = () => { + const imageSettings = unreadSettings?.unread_icon?.image; + if (!imageSettings) return false; + if (colorScheme === 'dark') { + // In dark mode, show dot if darkUrl is empty string or if both darkUrl doesn't exist and url is empty + return imageSettings.darkUrl === '' || !imageSettings.darkUrl && imageSettings.url === ''; + } + + // In light mode, show dot if url is empty string + return imageSettings.url === ''; + }; + + // If URL is explicitly empty string for current mode, show dot + if (isEmptyUrlForCurrentMode()) { + return /*#__PURE__*/React.createElement(Dot, { + size: size, + backgroundColor: dotColor + }); + } + + // If image failed to load, fallback to dot + if (renderType === 'image' && imageLoadError) { + return /*#__PURE__*/React.createElement(Dot, { + size: size, + backgroundColor: dotColor + }); + } + if (renderType === 'image' && (imageSource || darkImageSource)) { + return /*#__PURE__*/React.createElement(Image, { + source: finalImageSource, + style: [styles.image, { + width: size, + height: size + }, imageStyle], + resizeMode: "contain", + onError: error => { + console.warn('Failed to load unread icon image:', error.nativeEvent.error); + setImageLoadError(true); + } + }); + } + + // Default dot type + return /*#__PURE__*/React.createElement(Dot, { + size: size, + backgroundColor: dotColor + }); + }, [colorScheme, unreadSettings?.unread_icon?.image, size, dotColor, renderType, imageLoadError, imageSource, darkImageSource, finalImageSource, imageStyle]); + return /*#__PURE__*/React.createElement(View, _extends({ + style: [styles.container, positionStyle, { + minWidth: size, + minHeight: size + }, containerStyle, style] + }, props), content); +}; +export default UnreadIcon; +const styles = StyleSheet.create({ + container: { + position: 'absolute', + zIndex: 1000, + justifyContent: 'center', + alignItems: 'center' + }, + positionTopLeft: { + top: 6, + left: 6 + }, + positionTopRight: { + top: 6, + right: 6 + }, + positionBottomLeft: { + bottom: 6, + left: 6 + }, + positionBottomRight: { + bottom: 6, + right: 6 + }, + dot: { + shadowColor: '#000', + shadowOffset: { + width: 0, + height: 1 + }, + shadowOpacity: 0.22, + shadowRadius: 2.22, + elevation: 3 + }, + image: { + shadowColor: '#000', + shadowOffset: { + width: 0, + height: 1 + }, + shadowOpacity: 0.22, + shadowRadius: 2.22, + elevation: 3 + } +}); +//# sourceMappingURL=UnreadIcon.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.js.map b/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.js.map new file mode 100644 index 00000000..aabacc9b --- /dev/null +++ b/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.js.map @@ -0,0 +1 @@ +{"version":3,"names":["React","useState","useMemo","useEffect","Image","StyleSheet","View","useColorScheme","useContainerSettings","Dot","size","backgroundColor","createElement","style","styles","dot","width","height","borderRadius","UnreadIcon","imageStyle","containerStyle","source","darkSource","position","type","props","colorScheme","settings","imageLoadError","setImageLoadError","unreadSettings","content","unread_indicator","displayPosition","unread_icon","placement","imageSource","image","url","uri","darkImageSource","darkUrl","hasImageUrl","Boolean","renderType","positionStyle","positionTopLeft","positionTopRight","positionBottomLeft","positionBottomRight","dotColor","finalImageSource","isEmptyUrlForCurrentMode","imageSettings","resizeMode","onError","error","console","warn","nativeEvent","_extends","container","minWidth","minHeight","create","zIndex","justifyContent","alignItems","top","left","right","bottom","shadowColor","shadowOffset","shadowOpacity","shadowRadius","elevation"],"sourceRoot":"../../../../../src","sources":["ui/components/UnreadIcon/UnreadIcon.tsx"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,OAAO,EAAEC,SAAS,QAAQ,OAAO;AAC3D,SACEC,KAAK,EAGLC,UAAU,EACVC,IAAI,EAGJC,cAAc,QACT,cAAc;AACrB,OAAOC,oBAAoB,MAAM,qCAAkC;AAkBnE,MAAMC,GAAG,GAAGA,CAAC;EAAEC,IAAI;EAAEC;AAA0B,CAAC,kBAC9CX,KAAA,CAAAY,aAAA,CAACN,IAAI;EACHO,KAAK,EAAE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Aa,EACb;MAAEiB,QAAQ,EAAErD,IAAI;MAAEsD,SAAS,EAAEtD;IAAK,CAAC,EACnCW,cAAc,EACdR,KAAK;EACL,GACEa,KAAK,GAERM,OACG,CAAC;AAEX,CAAC;AAED,eAAeb,UAAU;AAEzB,MAAML,MAAM,GAAGT,UAAU,CAAC4D,MAAM,CAAC;EAC/BH,SAAS,EAAE;IACTtC,QAAQ,EAAE,UAAU;IACpB0C,MAAM,EAAE,IAAI;IACZC,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE;EACd,CAAC;EACDrB,eAAe,EAAE;IACfsB,GAAG,EAAE,CAAC;IACNC,IAAI,EAAE;EACR,CAAC;EACDtB,gBAAgB,EAAE;IAChBqB,GAAG,EAAE,CAAC;IACNE,KAAK,EAAE;EACT,CAAC;EACDtB,kBAAkB,EAAE;IAClBuB,MAAM,EAAE,CAAC;IACTF,IAAI,EAAE;EACR,CAAC;EACDpB,mBAAmB,EAAE;IACnBsB,MAAM,EAAE,CAAC;IACTD,KAAK,EAAE;EACT,CAAC;EACDxD,GAAG,EAAE;IACH0D,WAAW,EAAE,MAAM;IACnBC,YAAY,EAAE;MACZ1D,KAAK,EAAE,CAAC;MACRC,MAAM,EAAE;IACV,CAAC;IACD0D,aAAa,EAAE,IAAI;IACnBC,YAAY,EAAE,IAAI;IAClBC,SAAS,EAAE;EACb,CAAC;EACDvC,KAAK,EAAE;IACLmC,WAAW,EAAE,MAAM;IACnBC,YAAY,EAAE;MACZ1D,KAAK,EAAE,CAAC;MACRC,MAAM,EAAE;IACV,CAAC;IACD0D,aAAa,EAAE,IAAI;IACnBC,YAAY,EAAE,IAAI;IAClBC,SAAS,EAAE;EACb;AACF,CAAC,CAAC","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.spec.js b/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.spec.js new file mode 100644 index 00000000..af672f79 --- /dev/null +++ b/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.spec.js @@ -0,0 +1,689 @@ +"use strict"; + +/* + Copyright 2025 Adobe. All rights reserved. + This file is licensed to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law + or agreed to in writing, software distributed under the License is + distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF + ANY KIND, either express or implied. See the License for the specific + language governing permissions and limitations under the License. +*/ +import React from 'react'; +import { render } from '@testing-library/react-native'; +import { useColorScheme, Image } from 'react-native'; +import UnreadIcon from "./UnreadIcon.js"; +import ContentCardContainerProvider from "../../providers/ContentCardContainerProvider.js"; + +// Mock useColorScheme +jest.mock('react-native/Libraries/Utilities/useColorScheme'); +const mockUseColorScheme = useColorScheme; +describe('UnreadIcon', () => { + const mockContainerSettings = { + templateType: 'inbox', + content: { + heading: { + content: 'Test' + }, + layout: { + orientation: 'vertical' + }, + capacity: 10, + emptyStateSettings: { + message: { + content: 'Empty' + } + }, + unread_indicator: { + unread_bg: { + clr: { + light: '#FFF3E0', + dark: '#2D1B0E' + } + }, + unread_icon: { + placement: 'topright', + image: { + url: 'https://example.com/icon.png', + darkUrl: '' + } + } + }, + isUnreadEnabled: true + }, + showPagination: false + }; + beforeEach(() => { + jest.clearAllMocks(); + mockUseColorScheme.mockReturnValue('light'); + }); + afterEach(() => { + jest.clearAllMocks(); + }); + describe('Basic rendering', () => { + it('should render successfully with container settings', () => { + const { + getByTestId + } = render(/*#__PURE__*/React.createElement(ContentCardContainerProvider, { + settings: mockContainerSettings + }, /*#__PURE__*/React.createElement(UnreadIcon, { + testID: "unread-icon" + }))); + expect(getByTestId('unread-icon')).toBeTruthy(); + }); + it('should render with custom size', () => { + const { + getByTestId + } = render(/*#__PURE__*/React.createElement(ContentCardContainerProvider, { + settings: mockContainerSettings + }, /*#__PURE__*/React.createElement(UnreadIcon, { + testID: "unread-icon", + size: 30 + }))); + expect(getByTestId('unread-icon')).toBeTruthy(); + }); + it('should render without crashing when settings provide null', () => { + expect(() => { + render(/*#__PURE__*/React.createElement(ContentCardContainerProvider, { + settings: null + }, /*#__PURE__*/React.createElement(UnreadIcon, { + type: "dot" + }))); + }).not.toThrow(); + }); + }); + describe('Placement positions', () => { + it('should render with topright placement', () => { + expect(() => { + render(/*#__PURE__*/React.createElement(ContentCardContainerProvider, { + settings: mockContainerSettings + }, /*#__PURE__*/React.createElement(UnreadIcon, null))); + }).not.toThrow(); + }); + it('should render with topleft placement', () => { + const settings = { + ...mockContainerSettings, + content: { + ...mockContainerSettings.content, + unread_indicator: { + ...mockContainerSettings.content.unread_indicator, + unread_icon: { + ...mockContainerSettings.content.unread_indicator.unread_icon, + placement: 'topleft' + } + } + } + }; + expect(() => { + render(/*#__PURE__*/React.createElement(ContentCardContainerProvider, { + settings: settings + }, /*#__PURE__*/React.createElement(UnreadIcon, null))); + }).not.toThrow(); + }); + it('should render with bottomright placement', () => { + const settings = { + ...mockContainerSettings, + content: { + ...mockContainerSettings.content, + unread_indicator: { + ...mockContainerSettings.content.unread_indicator, + unread_icon: { + ...mockContainerSettings.content.unread_indicator.unread_icon, + placement: 'bottomright' + } + } + } + }; + expect(() => { + render(/*#__PURE__*/React.createElement(ContentCardContainerProvider, { + settings: settings + }, /*#__PURE__*/React.createElement(UnreadIcon, null))); + }).not.toThrow(); + }); + it('should render with bottomleft placement', () => { + const settings = { + ...mockContainerSettings, + content: { + ...mockContainerSettings.content, + unread_indicator: { + ...mockContainerSettings.content.unread_indicator, + unread_icon: { + ...mockContainerSettings.content.unread_indicator.unread_icon, + placement: 'bottomleft' + } + } + } + }; + expect(() => { + render(/*#__PURE__*/React.createElement(ContentCardContainerProvider, { + settings: settings + }, /*#__PURE__*/React.createElement(UnreadIcon, null))); + }).not.toThrow(); + }); + }); + describe('Light mode rendering', () => { + beforeEach(() => { + mockUseColorScheme.mockReturnValue('light'); + }); + it('should render in light mode with image URL', () => { + expect(() => { + render(/*#__PURE__*/React.createElement(ContentCardContainerProvider, { + settings: mockContainerSettings + }, /*#__PURE__*/React.createElement(UnreadIcon, null))); + }).not.toThrow(); + }); + it('should render dot when URL is empty string in light mode', () => { + const settings = { + ...mockContainerSettings, + content: { + ...mockContainerSettings.content, + unread_indicator: { + ...mockContainerSettings.content.unread_indicator, + unread_icon: { + ...mockContainerSettings.content.unread_indicator.unread_icon, + image: { + url: '', + darkUrl: '' + } + } + } + } + }; + expect(() => { + render(/*#__PURE__*/React.createElement(ContentCardContainerProvider, { + settings: settings + }, /*#__PURE__*/React.createElement(UnreadIcon, null))); + }).not.toThrow(); + }); + }); + describe('Dark mode rendering', () => { + beforeEach(() => { + mockUseColorScheme.mockReturnValue('dark'); + }); + it('should render in dark mode with darkUrl provided', () => { + const settings = { + ...mockContainerSettings, + content: { + ...mockContainerSettings.content, + unread_indicator: { + ...mockContainerSettings.content.unread_indicator, + unread_icon: { + ...mockContainerSettings.content.unread_indicator.unread_icon, + image: { + url: 'https://example.com/light.png', + darkUrl: 'https://example.com/dark.png' + } + } + } + } + }; + expect(() => { + render(/*#__PURE__*/React.createElement(ContentCardContainerProvider, { + settings: settings + }, /*#__PURE__*/React.createElement(UnreadIcon, null))); + }).not.toThrow(); + }); + it('should render dot when darkUrl is empty string in dark mode', () => { + expect(() => { + render(/*#__PURE__*/React.createElement(ContentCardContainerProvider, { + settings: mockContainerSettings + }, /*#__PURE__*/React.createElement(UnreadIcon, null))); + }).not.toThrow(); + }); + it('should fallback to light mode image when no darkUrl provided', () => { + const settings = { + ...mockContainerSettings, + content: { + ...mockContainerSettings.content, + unread_indicator: { + ...mockContainerSettings.content.unread_indicator, + unread_icon: { + placement: 'topright', + image: { + url: 'https://example.com/icon.png' + } + } + } + } + }; + expect(() => { + render(/*#__PURE__*/React.createElement(ContentCardContainerProvider, { + settings: settings + }, /*#__PURE__*/React.createElement(UnreadIcon, null))); + }).not.toThrow(); + }); + }); + describe('Props-based rendering', () => { + it('should render with custom source prop when no settings provided', () => { + const settingsWithoutImage = { + ...mockContainerSettings, + content: { + ...mockContainerSettings.content, + unread_indicator: undefined + } + }; + expect(() => { + render(/*#__PURE__*/React.createElement(ContentCardContainerProvider, { + settings: settingsWithoutImage + }, /*#__PURE__*/React.createElement(UnreadIcon, { + source: { + uri: 'https://custom.com/icon.png' + } + }))); + }).not.toThrow(); + }); + it('should render with custom darkSource prop', () => { + mockUseColorScheme.mockReturnValue('dark'); + const settingsWithoutImage = { + ...mockContainerSettings, + content: { + ...mockContainerSettings.content, + unread_indicator: undefined + } + }; + expect(() => { + render(/*#__PURE__*/React.createElement(ContentCardContainerProvider, { + settings: settingsWithoutImage + }, /*#__PURE__*/React.createElement(UnreadIcon, { + source: { + uri: 'https://custom.com/light.png' + }, + darkSource: { + uri: 'https://custom.com/dark.png' + } + }))); + }).not.toThrow(); + }); + it('should render with custom position prop', () => { + const settingsWithoutImage = { + ...mockContainerSettings, + content: { + ...mockContainerSettings.content, + unread_indicator: undefined + } + }; + expect(() => { + render(/*#__PURE__*/React.createElement(ContentCardContainerProvider, { + settings: settingsWithoutImage + }, /*#__PURE__*/React.createElement(UnreadIcon, { + position: "bottomleft" + }))); + }).not.toThrow(); + }); + it('should render as dot when type prop is "dot"', () => { + const settingsWithoutImage = { + ...mockContainerSettings, + content: { + ...mockContainerSettings.content, + unread_indicator: undefined + } + }; + expect(() => { + render(/*#__PURE__*/React.createElement(ContentCardContainerProvider, { + settings: settingsWithoutImage + }, /*#__PURE__*/React.createElement(UnreadIcon, { + type: "dot" + }))); + }).not.toThrow(); + }); + it('should render as image when type prop is "image"', () => { + const settingsWithoutImage = { + ...mockContainerSettings, + content: { + ...mockContainerSettings.content, + unread_indicator: undefined + } + }; + expect(() => { + render(/*#__PURE__*/React.createElement(ContentCardContainerProvider, { + settings: settingsWithoutImage + }, /*#__PURE__*/React.createElement(UnreadIcon, { + type: "image", + source: { + uri: 'https://custom.com/icon.png' + } + }))); + }).not.toThrow(); + }); + }); + describe('Custom styles', () => { + it('should accept and apply custom imageStyle', () => { + const customImageStyle = { + opacity: 0.8 + }; + expect(() => { + render(/*#__PURE__*/React.createElement(ContentCardContainerProvider, { + settings: mockContainerSettings + }, /*#__PURE__*/React.createElement(UnreadIcon, { + imageStyle: customImageStyle + }))); + }).not.toThrow(); + }); + it('should accept and apply custom containerStyle', () => { + const customContainerStyle = { + padding: 5 + }; + expect(() => { + render(/*#__PURE__*/React.createElement(ContentCardContainerProvider, { + settings: mockContainerSettings + }, /*#__PURE__*/React.createElement(UnreadIcon, { + containerStyle: customContainerStyle + }))); + }).not.toThrow(); + }); + it('should handle both imageStyle and containerStyle together', () => { + expect(() => { + render(/*#__PURE__*/React.createElement(ContentCardContainerProvider, { + settings: mockContainerSettings + }, /*#__PURE__*/React.createElement(UnreadIcon, { + imageStyle: { + opacity: 0.8 + }, + containerStyle: { + padding: 5 + } + }))); + }).not.toThrow(); + }); + }); + describe('Size variations', () => { + it('should render with default size of 20', () => { + expect(() => { + render(/*#__PURE__*/React.createElement(ContentCardContainerProvider, { + settings: mockContainerSettings + }, /*#__PURE__*/React.createElement(UnreadIcon, null))); + }).not.toThrow(); + }); + it('should render with custom size of 30', () => { + expect(() => { + render(/*#__PURE__*/React.createElement(ContentCardContainerProvider, { + settings: mockContainerSettings + }, /*#__PURE__*/React.createElement(UnreadIcon, { + size: 30 + }))); + }).not.toThrow(); + }); + it('should render with custom size of 15', () => { + expect(() => { + render(/*#__PURE__*/React.createElement(ContentCardContainerProvider, { + settings: mockContainerSettings + }, /*#__PURE__*/React.createElement(UnreadIcon, { + size: 15 + }))); + }).not.toThrow(); + }); + it('should handle very large size', () => { + expect(() => { + render(/*#__PURE__*/React.createElement(ContentCardContainerProvider, { + settings: mockContainerSettings + }, /*#__PURE__*/React.createElement(UnreadIcon, { + size: 100 + }))); + }).not.toThrow(); + }); + it('should handle very small size', () => { + expect(() => { + render(/*#__PURE__*/React.createElement(ContentCardContainerProvider, { + settings: mockContainerSettings + }, /*#__PURE__*/React.createElement(UnreadIcon, { + size: 5 + }))); + }).not.toThrow(); + }); + }); + describe('Context settings priority', () => { + it('should prioritize context settings over props', () => { + expect(() => { + render(/*#__PURE__*/React.createElement(ContentCardContainerProvider, { + settings: mockContainerSettings + }, /*#__PURE__*/React.createElement(UnreadIcon, { + position: "bottomleft" + }))); + }).not.toThrow(); + }); + it('should use props when context settings are not available', () => { + const settingsWithoutImage = { + ...mockContainerSettings, + content: { + ...mockContainerSettings.content, + unread_indicator: undefined + } + }; + expect(() => { + render(/*#__PURE__*/React.createElement(ContentCardContainerProvider, { + settings: settingsWithoutImage + }, /*#__PURE__*/React.createElement(UnreadIcon, { + position: "bottomleft", + source: { + uri: 'https://custom.com/icon.png' + } + }))); + }).not.toThrow(); + }); + }); + describe('Image error handling', () => { + it('should render without crashing when image URL is invalid', () => { + const settings = { + ...mockContainerSettings, + content: { + ...mockContainerSettings.content, + unread_indicator: { + ...mockContainerSettings.content.unread_indicator, + unread_icon: { + ...mockContainerSettings.content.unread_indicator.unread_icon, + image: { + url: 'invalid-url', + darkUrl: '' + } + } + } + } + }; + expect(() => { + render(/*#__PURE__*/React.createElement(ContentCardContainerProvider, { + settings: settings + }, /*#__PURE__*/React.createElement(UnreadIcon, null))); + }).not.toThrow(); + }); + }); + describe('Edge cases', () => { + it('should handle undefined image URLs', () => { + const settings = { + ...mockContainerSettings, + content: { + ...mockContainerSettings.content, + unread_indicator: { + ...mockContainerSettings.content.unread_indicator, + unread_icon: { + placement: 'topright', + image: { + url: undefined, + darkUrl: undefined + } + } + } + } + }; + expect(() => { + render(/*#__PURE__*/React.createElement(ContentCardContainerProvider, { + settings: settings + }, /*#__PURE__*/React.createElement(UnreadIcon, null))); + }).not.toThrow(); + }); + it('should handle zero size', () => { + expect(() => { + render(/*#__PURE__*/React.createElement(ContentCardContainerProvider, { + settings: mockContainerSettings + }, /*#__PURE__*/React.createElement(UnreadIcon, { + size: 0 + }))); + }).not.toThrow(); + }); + it('should handle negative size', () => { + expect(() => { + render(/*#__PURE__*/React.createElement(ContentCardContainerProvider, { + settings: mockContainerSettings + }, /*#__PURE__*/React.createElement(UnreadIcon, { + size: -10 + }))); + }).not.toThrow(); + }); + }); + describe('Color scheme switching', () => { + it('should adapt to color scheme changes from light to dark', () => { + mockUseColorScheme.mockReturnValue('light'); + const { + rerender + } = render(/*#__PURE__*/React.createElement(ContentCardContainerProvider, { + settings: mockContainerSettings + }, /*#__PURE__*/React.createElement(UnreadIcon, null))); + + // Switch to dark mode + mockUseColorScheme.mockReturnValue('dark'); + expect(() => { + rerender(/*#__PURE__*/React.createElement(ContentCardContainerProvider, { + settings: mockContainerSettings + }, /*#__PURE__*/React.createElement(UnreadIcon, null))); + }).not.toThrow(); + }); + it('should handle null color scheme', () => { + mockUseColorScheme.mockReturnValue(null); + expect(() => { + render(/*#__PURE__*/React.createElement(ContentCardContainerProvider, { + settings: mockContainerSettings + }, /*#__PURE__*/React.createElement(UnreadIcon, null))); + }).not.toThrow(); + }); + }); + describe('Behavioral verification', () => { + it('should render an Image when valid URL is provided', () => { + const { + UNSAFE_getByType + } = render(/*#__PURE__*/React.createElement(ContentCardContainerProvider, { + settings: mockContainerSettings + }, /*#__PURE__*/React.createElement(UnreadIcon, null))); + + // Should render an Image component when URL is provided + expect(() => UNSAFE_getByType(Image)).not.toThrow(); + }); + it('should render dot when image URLs are empty', () => { + const settings = { + ...mockContainerSettings, + content: { + ...mockContainerSettings.content, + unread_indicator: { + ...mockContainerSettings.content.unread_indicator, + unread_icon: { + ...mockContainerSettings.content.unread_indicator.unread_icon, + image: { + url: '', + darkUrl: '' + } + } + } + } + }; + const { + UNSAFE_queryByType + } = render(/*#__PURE__*/React.createElement(ContentCardContainerProvider, { + settings: settings + }, /*#__PURE__*/React.createElement(UnreadIcon, null))); + + // Should not render Image when URLs are empty + expect(UNSAFE_queryByType(Image)).toBeNull(); + }); + it('should render image when source is provided even with type="dot"', () => { + const settingsWithoutImage = { + ...mockContainerSettings, + content: { + ...mockContainerSettings.content, + unread_indicator: undefined + } + }; + const { + UNSAFE_getByType + } = render(/*#__PURE__*/React.createElement(ContentCardContainerProvider, { + settings: settingsWithoutImage + }, /*#__PURE__*/React.createElement(UnreadIcon, { + type: "dot", + source: { + uri: 'https://example.com/icon.png' + } + }))); + + // Should render Image when source is provided, even if type is "dot" + // The presence of source overrides the type prop + expect(() => UNSAFE_getByType(Image)).not.toThrow(); + }); + it('should use darkUrl in dark mode when provided', () => { + mockUseColorScheme.mockReturnValue('dark'); + const settings = { + ...mockContainerSettings, + content: { + ...mockContainerSettings.content, + unread_indicator: { + ...mockContainerSettings.content.unread_indicator, + unread_icon: { + placement: 'topright', + image: { + url: 'https://example.com/light.png', + darkUrl: 'https://example.com/dark.png' + } + } + } + } + }; + const { + UNSAFE_getByType + } = render(/*#__PURE__*/React.createElement(ContentCardContainerProvider, { + settings: settings + }, /*#__PURE__*/React.createElement(UnreadIcon, null))); + const imageComponent = UNSAFE_getByType(Image); + expect(imageComponent.props.source).toEqual({ + uri: 'https://example.com/dark.png' + }); + }); + it('should fallback to light URL when no darkUrl in dark mode', () => { + mockUseColorScheme.mockReturnValue('dark'); + const settings = { + ...mockContainerSettings, + content: { + ...mockContainerSettings.content, + unread_indicator: { + ...mockContainerSettings.content.unread_indicator, + unread_icon: { + placement: 'topright', + image: { + url: 'https://example.com/light.png' + } + } + } + } + }; + const { + UNSAFE_getByType + } = render(/*#__PURE__*/React.createElement(ContentCardContainerProvider, { + settings: settings + }, /*#__PURE__*/React.createElement(UnreadIcon, null))); + const imageComponent = UNSAFE_getByType(Image); + expect(imageComponent.props.source).toEqual({ + uri: 'https://example.com/light.png' + }); + }); + it('should use light URL in light mode', () => { + mockUseColorScheme.mockReturnValue('light'); + const { + UNSAFE_getByType + } = render(/*#__PURE__*/React.createElement(ContentCardContainerProvider, { + settings: mockContainerSettings + }, /*#__PURE__*/React.createElement(UnreadIcon, null))); + const imageComponent = UNSAFE_getByType(Image); + expect(imageComponent.props.source).toEqual({ + uri: 'https://example.com/icon.png' + }); + }); + }); +}); +//# sourceMappingURL=UnreadIcon.spec.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.spec.js.map b/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.spec.js.map new file mode 100644 index 00000000..7414b1d0 --- /dev/null +++ b/packages/messaging/dist/module/ui/components/UnreadIcon/UnreadIcon.spec.js.map @@ -0,0 +1 @@ +{"version":3,"names":["React","render","useColorScheme","Image","UnreadIcon","ContentCardContainerProvider","jest","mock","mockUseColorScheme","describe","mockContainerSettings","templateType","content","heading","layout","orientation","capacity","emptyStateSettings","message","unread_indicator","unread_bg","clr","light","dark","unread_icon","placement","image","url","darkUrl","isUnreadEnabled","showPagination","beforeEach","clearAllMocks","mockReturnValue","afterEach","it","getByTestId","createElement","settings","testID","expect","toBeTruthy","size","type","not","toThrow","settingsWithoutImage","undefined","source","uri","darkSource","position","customImageStyle","opacity","imageStyle","customContainerStyle","padding","containerStyle","rerender","UNSAFE_getByType","UNSAFE_queryByType","toBeNull","imageComponent","props","toEqual"],"sourceRoot":"../../../../../src","sources":["ui/components/UnreadIcon/UnreadIcon.spec.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,MAAM,QAAQ,+BAA+B;AACtD,SAASC,cAAc,EAAEC,KAAK,QAAQ,cAAc;AACpD,OAAOC,UAAU,MAAM,iBAAc;AACrC,OAAOC,4BAA4B,MAAM,iDAA8C;;AAEvF;AACAC,IAAI,CAACC,IAAI,CAAC,iDAAiD,CAAC;AAC5D,MAAMC,kBAAkB,GAAGN,cAE1B;AAEDO,QAAQ,CAAC,YAAY,EAAE,MAAM;EAC3B,MAAMC,qBAAqB,GAAG;IAC5BC,YAAY,EAAE,OAAgB;IAC9BC,OAAO,EAAE;MACPC,OAAO,EAAE;QAAED,OAAO,EAAE;MAAO,CAAC;MAC5BE,MAAM,EAAE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gB;YACjDK,WAAW,EAAE;cACXC,SAAS,EAAE,UAAmB;cAC9BC,KAAK,EAAE;gBACLC,GAAG,EAAE;cACP;YACF;UACF;QACF;MACF,CAAC;MAED,MAAM;QAAEgC;MAAiB,CAAC,GAAG1D,MAAM,cACjCD,KAAA,CAAAqC,aAAA,CAAChC,4BAA4B;QAACiC,QAAQ,EAAEA;MAAS,gBAC/CtC,KAAA,CAAAqC,aAAA,CAACjC,UAAU,MAAE,CACe,CAChC,CAAC;MAED,MAAM0D,cAAc,GAAGH,gBAAgB,CAACxD,KAAK,CAAC;MAC9CqC,MAAM,CAACsB,cAAc,CAACC,KAAK,CAACf,MAAM,CAAC,CAACgB,OAAO,CAAC;QAAEf,GAAG,EAAE;MAAgC,CAAC,CAAC;IACvF,CAAC,CAAC;IAEFd,EAAE,CAAC,oCAAoC,EAAE,MAAM;MAC7C3B,kBAAkB,CAACyB,eAAe,CAAC,OAAO,CAAC;MAE3C,MAAM;QAAE0B;MAAiB,CAAC,GAAG1D,MAAM,cACjCD,KAAA,CAAAqC,aAAA,CAAChC,4BAA4B;QAACiC,QAAQ,EAAE5B;MAAsB,gBAC5DV,KAAA,CAAAqC,aAAA,CAACjC,UAAU,MAAE,CACe,CAChC,CAAC;MAED,MAAM0D,cAAc,GAAGH,gBAAgB,CAACxD,KAAK,CAAC;MAC9CqC,MAAM,CAACsB,cAAc,CAACC,KAAK,CAACf,MAAM,CAAC,CAACgB,OAAO,CAAC;QAAEf,GAAG,EAAE;MAA+B,CAAC,CAAC;IACtF,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/components/index.js b/packages/messaging/dist/module/ui/components/index.js new file mode 100644 index 00000000..bc99e29d --- /dev/null +++ b/packages/messaging/dist/module/ui/components/index.js @@ -0,0 +1,22 @@ +"use strict"; + +/* + Copyright 2025 Adobe. All rights reserved. + This file is licensed to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law + or agreed to in writing, software distributed under the License is + distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF + ANY KIND, either express or implied. See the License for the specific + language governing permissions and limitations under the License. +*/ + +export * from "./Button/Button.js"; +export * from "./ContentCardContainer/ContentCardContainer.js"; +export * from "./ContentCardView/ContentCardView.js"; +export * from "../types/ContentViewEvent.js"; +export * from "./Pagination/Pagination.js"; +export * from "./UnreadIcon/UnreadIcon.js"; +export { ThemeProvider } from "../theme/ThemeProvider.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/components/index.js.map b/packages/messaging/dist/module/ui/components/index.js.map new file mode 100644 index 00000000..cee18f2f --- /dev/null +++ b/packages/messaging/dist/module/ui/components/index.js.map @@ -0,0 +1 @@ +{"version":3,"names":["ThemeProvider"],"sourceRoot":"../../../../src","sources":["ui/components/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc,oBAAiB;AAC/B,cAAc,gDAA6C;AAC3D,cAAc,sCAAmC;AACjD,cAAc,8BAA2B;AACzC,cAAc,4BAAyB;AACvC,cAAc,4BAAyB;AAEvC,SAASA,aAAa,QAAQ,2BAAwB","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/hooks/index.js b/packages/messaging/dist/module/ui/hooks/index.js new file mode 100644 index 00000000..176d7b75 --- /dev/null +++ b/packages/messaging/dist/module/ui/hooks/index.js @@ -0,0 +1,6 @@ +"use strict"; + +export * from "./useContentCardUI.js"; +export * from "./useContentContainer.js"; +export * from "./useContainerSettings.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/hooks/index.js.map b/packages/messaging/dist/module/ui/hooks/index.js.map new file mode 100644 index 00000000..ee5bcfea --- /dev/null +++ b/packages/messaging/dist/module/ui/hooks/index.js.map @@ -0,0 +1 @@ +{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["ui/hooks/index.ts"],"mappings":";;AAAA,cAAc,uBAAoB;AAClC,cAAc,0BAAuB;AACrC,cAAc,2BAAwB","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/hooks/useAspectRatio.js b/packages/messaging/dist/module/ui/hooks/useAspectRatio.js new file mode 100644 index 00000000..ed480183 --- /dev/null +++ b/packages/messaging/dist/module/ui/hooks/useAspectRatio.js @@ -0,0 +1,21 @@ +"use strict"; + +import { useEffect, useState } from 'react'; +import { Image } from 'react-native'; +function useAspectRatio(uri) { + const [imageAspectRatio, setImageAspectRatio] = useState(1); + useEffect(() => { + if (!uri) { + return; + } + Image.getSize(uri, (width, height) => { + setImageAspectRatio(width / height); + }, error => { + console.log('Error getting image size:', error); + setImageAspectRatio(1); + }); + }, [uri]); + return imageAspectRatio; +} +export default useAspectRatio; +//# sourceMappingURL=useAspectRatio.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/hooks/useAspectRatio.js.map b/packages/messaging/dist/module/ui/hooks/useAspectRatio.js.map new file mode 100644 index 00000000..3424f20c --- /dev/null +++ b/packages/messaging/dist/module/ui/hooks/useAspectRatio.js.map @@ -0,0 +1 @@ +{"version":3,"names":["useEffect","useState","Image","useAspectRatio","uri","imageAspectRatio","setImageAspectRatio","getSize","width","height","error","console","log"],"sourceRoot":"../../../../src","sources":["ui/hooks/useAspectRatio.tsx"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3C,SAASC,KAAK,QAAQ,cAAc;AAEpC,SAASC,cAAcA,CAACC,GAAY,EAAE;EACpC,MAAM,CAACC,gBAAgB,EAAEC,mBAAmB,CAAC,GAAGL,QAAQ,CAAS,CAAC,CAAC;EAEnED,SAAS,CAAC,MAAM;IACd,IAAI,CAACI,GAAG,EAAE;MACR;IACF;IAEAF,KAAK,CAACK,OAAO,CACXH,GAAG,EACH,CAACI,KAAK,EAAEC,MAAM,KAAK;MACjBH,mBAAmB,CAACE,KAAK,GAAGC,MAAM,CAAC;IACrC,CAAC,EACAC,KAAK,IAAK;MACTC,OAAO,CAACC,GAAG,CAAC,2BAA2B,EAAEF,KAAK,CAAC;MAC/CJ,mBAAmB,CAAC,CAAC,CAAC;IACxB,CACF,CAAC;EACH,CAAC,EAAE,CAACF,GAAG,CAAC,CAAC;EAET,OAAOC,gBAAgB;AACzB;AAEA,eAAeF,cAAc","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/hooks/useContainerSettings.js b/packages/messaging/dist/module/ui/hooks/useContainerSettings.js new file mode 100644 index 00000000..0a01fc1c --- /dev/null +++ b/packages/messaging/dist/module/ui/hooks/useContainerSettings.js @@ -0,0 +1,10 @@ +"use strict"; + +import { useContext } from "react"; +import { ContentCardContainerContext } from "../providers/ContentCardContainerProvider.js"; +function useContainerSettings() { + const settings = useContext(ContentCardContainerContext); + return settings; +} +export default useContainerSettings; +//# sourceMappingURL=useContainerSettings.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/hooks/useContainerSettings.js.map b/packages/messaging/dist/module/ui/hooks/useContainerSettings.js.map new file mode 100644 index 00000000..83901b78 --- /dev/null +++ b/packages/messaging/dist/module/ui/hooks/useContainerSettings.js.map @@ -0,0 +1 @@ +{"version":3,"names":["useContext","ContentCardContainerContext","useContainerSettings","settings"],"sourceRoot":"../../../../src","sources":["ui/hooks/useContainerSettings.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,OAAO;AAClC,SAASC,2BAA2B,QAA2B,8CAA2C;AAE1G,SAASC,oBAAoBA,CAAA,EAA6B;EACxD,MAAMC,QAAQ,GAAGH,UAAU,CAACC,2BAA2B,CAAC;EACxD,OAAOE,QAAQ;AACjB;AAEA,eAAeD,oBAAoB","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/hooks/useContentCardUI.js b/packages/messaging/dist/module/ui/hooks/useContentCardUI.js new file mode 100644 index 00000000..09287580 --- /dev/null +++ b/packages/messaging/dist/module/ui/hooks/useContentCardUI.js @@ -0,0 +1,39 @@ +"use strict"; + +import { useCallback, useEffect, useState } from 'react'; +import Messaging from "../../Messaging.js"; +/** + * Hook to fetch the content card UI for a given surface. + * @param surface - The surface to fetch the content card UI for. + * @returns An object containing the content card UI, error, loading state, and a refetch function. + */ +export const useContentCardUI = surface => { + const [content, setContent] = useState([]); + const [error, setError] = useState(null); + const [isLoading, setIsLoading] = useState(false); + const fetchContent = useCallback(async () => { + try { + setIsLoading(true); + await Messaging.updatePropositionsForSurfaces([surface]); + const content = await Messaging.getContentCardUI(surface); + setContent(content); + setIsLoading(false); + } catch (error) { + console.error(error); + setContent([]); + setError(error); + } finally { + setIsLoading(false); + } + }, [surface]); + useEffect(() => { + fetchContent(); + }, [surface, fetchContent]); + return { + content, + error, + isLoading, + refetch: fetchContent + }; +}; +//# sourceMappingURL=useContentCardUI.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/hooks/useContentCardUI.js.map b/packages/messaging/dist/module/ui/hooks/useContentCardUI.js.map new file mode 100644 index 00000000..de9be797 --- /dev/null +++ b/packages/messaging/dist/module/ui/hooks/useContentCardUI.js.map @@ -0,0 +1 @@ +{"version":3,"names":["useCallback","useEffect","useState","Messaging","useContentCardUI","surface","content","setContent","error","setError","isLoading","setIsLoading","fetchContent","updatePropositionsForSurfaces","getContentCardUI","console","refetch"],"sourceRoot":"../../../../src","sources":["ui/hooks/useContentCardUI.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AACxD,OAAOC,SAAS,MAAM,oBAAiB;AAGvC;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,GAAIC,OAAe,IAAK;EACnD,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGL,QAAQ,CAAoB,EAAE,CAAC;EAC7D,MAAM,CAACM,KAAK,EAAEC,QAAQ,CAAC,GAAGP,QAAQ,CAAM,IAAI,CAAC;EAC7C,MAAM,CAACQ,SAAS,EAAEC,YAAY,CAAC,GAAGT,QAAQ,CAAC,KAAK,CAAC;EAEjD,MAAMU,YAAY,GAAGZ,WAAW,CAAC,YAAY;IAC3C,IAAI;MACFW,YAAY,CAAC,IAAI,CAAC;MAClB,MAAMR,SAAS,CAACU,6BAA6B,CAAC,CAACR,OAAO,CAAC,CAAC;MACxD,MAAMC,OAAO,GAAG,MAAMH,SAAS,CAACW,gBAAgB,CAACT,OAAO,CAAC;MACzDE,UAAU,CAACD,OAAO,CAAC;MACnBK,YAAY,CAAC,KAAK,CAAC;IACrB,CAAC,CAAC,OAAOH,KAAK,EAAE;MACdO,OAAO,CAACP,KAAK,CAACA,KAAK,CAAC;MACpBD,UAAU,CAAC,EAAE,CAAC;MACdE,QAAQ,CAACD,KAAK,CAAC;IACjB,CAAC,SAAS;MACRG,YAAY,CAAC,KAAK,CAAC;IACrB;EACF,CAAC,EAAE,CAACN,OAAO,CAAC,CAAC;EAEbJ,SAAS,CAAC,MAAM;IACdW,YAAY,CAAC,CAAC;EAChB,CAAC,EAAE,CAACP,OAAO,EAAEO,YAAY,CAAC,CAAC;EAE3B,OAAO;IAAEN,OAAO;IAAEE,KAAK;IAAEE,SAAS;IAAEM,OAAO,EAAEJ;EAAa,CAAC;AAC7D,CAAC","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/hooks/useContentContainer.js b/packages/messaging/dist/module/ui/hooks/useContentContainer.js new file mode 100644 index 00000000..b78c92cf --- /dev/null +++ b/packages/messaging/dist/module/ui/hooks/useContentContainer.js @@ -0,0 +1,31 @@ +"use strict"; + +import { useCallback, useEffect, useState } from "react"; +import Messaging from "../../Messaging.js"; +export function useContentContainer(surface) { + const [settings, setSettings] = useState(null); + const [error, setError] = useState(null); + const [isLoading, setIsLoading] = useState(false); + const fetchContainer = useCallback(async () => { + try { + setIsLoading(true); + const settings = await Messaging.getContentCardContainer(surface); + setSettings(settings); + setIsLoading(false); + } catch (error) { + setError(error); + } finally { + setIsLoading(false); + } + }, [surface]); + useEffect(() => { + fetchContainer(); + }, [surface]); + return { + settings, + error, + isLoading, + refetch: fetchContainer + }; +} +//# sourceMappingURL=useContentContainer.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/hooks/useContentContainer.js.map b/packages/messaging/dist/module/ui/hooks/useContentContainer.js.map new file mode 100644 index 00000000..f17f9bc6 --- /dev/null +++ b/packages/messaging/dist/module/ui/hooks/useContentContainer.js.map @@ -0,0 +1 @@ +{"version":3,"names":["useCallback","useEffect","useState","Messaging","useContentContainer","surface","settings","setSettings","error","setError","isLoading","setIsLoading","fetchContainer","getContentCardContainer","refetch"],"sourceRoot":"../../../../src","sources":["ui/hooks/useContentContainer.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AACxD,OAAOC,SAAS,MAAM,oBAAiB;AAGvC,OAAO,SAASC,mBAAmBA,CAACC,OAAe,EAAE;EACnD,MAAM,CAACC,QAAQ,EAAEC,WAAW,CAAC,GAAGL,QAAQ,CAA2B,IAAI,CAAC;EACxE,MAAM,CAACM,KAAK,EAAEC,QAAQ,CAAC,GAAGP,QAAQ,CAAM,IAAI,CAAC;EAC7C,MAAM,CAACQ,SAAS,EAAEC,YAAY,CAAC,GAAGT,QAAQ,CAAC,KAAK,CAAC;EAEjD,MAAMU,cAAc,GAAGZ,WAAW,CAAC,YAAY;IAC7C,IAAI;MACFW,YAAY,CAAC,IAAI,CAAC;MAClB,MAAML,QAAQ,GAAG,MAAMH,SAAS,CAACU,uBAAuB,CAACR,OAAO,CAAC;MACjEE,WAAW,CAACD,QAAQ,CAAC;MACrBK,YAAY,CAAC,KAAK,CAAC;IACrB,CAAC,CAAC,OAAOH,KAAK,EAAE;MACdC,QAAQ,CAACD,KAAK,CAAC;IACjB,CAAC,SAAS;MACRG,YAAY,CAAC,KAAK,CAAC;IACrB;EACF,CAAC,EAAE,CAACN,OAAO,CAAC,CAAC;EAEbJ,SAAS,CAAC,MAAM;IACdW,cAAc,CAAC,CAAC;EAClB,CAAC,EAAE,CAACP,OAAO,CAAC,CAAC;EAEb,OAAO;IAAEC,QAAQ;IAAEE,KAAK;IAAEE,SAAS;IAAEI,OAAO,EAAEF;EAAe,CAAC;AAChE","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/index.js b/packages/messaging/dist/module/ui/index.js new file mode 100644 index 00000000..c1d9e839 --- /dev/null +++ b/packages/messaging/dist/module/ui/index.js @@ -0,0 +1,9 @@ +"use strict"; + +export * from "./components/index.js"; +export * from "./hooks/index.js"; +export * from "./theme/index.js"; +export * from "./types/index.js"; +export * from "./providers/ContentCardContainerProvider.js"; +export { default as ContentCardContainerProvider } from "./providers/ContentCardContainerProvider.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/index.js.map b/packages/messaging/dist/module/ui/index.js.map new file mode 100644 index 00000000..aaf9aa85 --- /dev/null +++ b/packages/messaging/dist/module/ui/index.js.map @@ -0,0 +1 @@ +{"version":3,"names":["default","ContentCardContainerProvider"],"sourceRoot":"../../../src","sources":["ui/index.ts"],"mappings":";;AAAA,cAAc,uBAAc;AAC5B,cAAc,kBAAS;AACvB,cAAc,kBAAS;AACvB,cAAc,kBAAS;AACvB,cAAc,6CAA0C;AACxD,SAASA,OAAO,IAAIC,4BAA4B,QAAQ,6CAA0C","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/providers/ContentCardContainerProvider.js b/packages/messaging/dist/module/ui/providers/ContentCardContainerProvider.js new file mode 100644 index 00000000..d0057d7a --- /dev/null +++ b/packages/messaging/dist/module/ui/providers/ContentCardContainerProvider.js @@ -0,0 +1,14 @@ +"use strict"; + +import React, { createContext } from "react"; +export const ContentCardContainerContext = /*#__PURE__*/createContext(null); +function ContentCardContainerProvider({ + children, + settings +}) { + return /*#__PURE__*/React.createElement(ContentCardContainerContext.Provider, { + value: settings + }, children); +} +export default ContentCardContainerProvider; +//# sourceMappingURL=ContentCardContainerProvider.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/providers/ContentCardContainerProvider.js.map b/packages/messaging/dist/module/ui/providers/ContentCardContainerProvider.js.map new file mode 100644 index 00000000..4664017e --- /dev/null +++ b/packages/messaging/dist/module/ui/providers/ContentCardContainerProvider.js.map @@ -0,0 +1 @@ +{"version":3,"names":["React","createContext","ContentCardContainerContext","ContentCardContainerProvider","children","settings","createElement","Provider","value"],"sourceRoot":"../../../../src","sources":["ui/providers/ContentCardContainerProvider.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,aAAa,QAAQ,OAAO;AA4C5C,OAAO,MAAMC,2BAA2B,gBACtCD,aAAa,CAA2B,IAAI,CAAC;AAO/C,SAASE,4BAA4BA,CAAC;EACpCC,QAAQ;EACRC;AACiC,CAAC,EAAE;EACpC,oBACEL,KAAA,CAAAM,aAAA,CAACJ,2BAA2B,CAACK,QAAQ;IAACC,KAAK,EAAEH;EAAS,GACnDD,QACmC,CAAC;AAE3C;AAEA,eAAeD,4BAA4B","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/theme/Theme.js b/packages/messaging/dist/module/ui/theme/Theme.js new file mode 100644 index 00000000..e8bb4ce3 --- /dev/null +++ b/packages/messaging/dist/module/ui/theme/Theme.js @@ -0,0 +1,2 @@ +"use strict"; +//# sourceMappingURL=Theme.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/theme/Theme.js.map b/packages/messaging/dist/module/ui/theme/Theme.js.map new file mode 100644 index 00000000..25752faa --- /dev/null +++ b/packages/messaging/dist/module/ui/theme/Theme.js.map @@ -0,0 +1 @@ +{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["ui/theme/Theme.ts"],"mappings":"","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/theme/ThemeProvider.js b/packages/messaging/dist/module/ui/theme/ThemeProvider.js new file mode 100644 index 00000000..33143220 --- /dev/null +++ b/packages/messaging/dist/module/ui/theme/ThemeProvider.js @@ -0,0 +1,95 @@ +"use strict"; + +/* + Copyright 2025 Adobe. All rights reserved. + This file is licensed to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law + or agreed to in writing, software distributed under the License is + distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF + ANY KIND, either express or implied. See the License for the specific + language governing permissions and limitations under the License. +*/ + +import { createContext, useContext, useMemo } from 'react'; +import { useColorScheme } from 'react-native'; +const defaultTheme = { + light: { + colors: { + primary: '#007AFF', + secondary: '#5856D6', + background: '#FFFFFF', + textPrimary: '#000000', + textSecondary: '#8E8E93', + imagePlaceholder: '#C7C7CC', + buttonTextColor: 'dodgerblue' + } + }, + dark: { + colors: { + primary: '#0A84FF', + secondary: '#5E5CE6', + background: '#262626', + textPrimary: '#FFFFFF', + textSecondary: '#8E8E93', + imagePlaceholder: '#48484A', + buttonTextColor: 'dodgerblue' + } + } +}; +const ThemeContext = /*#__PURE__*/createContext(undefined); + +/** + * ThemeProvider component that provides the theme to the children components. + * + * @param children - The children components. + * @param customThemes - The custom themes to override the default themes. + * @returns The ThemeProvider component. + */ +export const ThemeProvider = ({ + children, + customThemes +}) => { + const systemColorScheme = useColorScheme(); + + // Memoize the merged themes to avoid recreation on every render + const mergedThemes = useMemo(() => ({ + light: { + colors: { + ...defaultTheme.light.colors, + ...(customThemes?.light?.colors || {}) + } + }, + dark: { + colors: { + ...defaultTheme.dark.colors, + ...(customThemes?.dark?.colors || {}) + } + } + }), [customThemes]); + + // Memoize the active theme + const activeTheme = useMemo(() => mergedThemes[systemColorScheme ?? 'light'], [mergedThemes, systemColorScheme]); + + // Memoize the context value to prevent unnecessary re-renders + const contextValue = useMemo(() => activeTheme, [activeTheme]); + return /*#__PURE__*/React.createElement(ThemeContext.Provider, { + value: contextValue + }, children); +}; + +/** + * useTheme hook that returns the theme context. + * @returns The theme context. + */ +export const useTheme = () => { + const context = useContext(ThemeContext); + const systemColorScheme = useColorScheme(); + if (context === undefined) { + return defaultTheme[systemColorScheme ?? 'light']; + } + return context; +}; +//# sourceMappingURL=ThemeProvider.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/theme/ThemeProvider.js.map b/packages/messaging/dist/module/ui/theme/ThemeProvider.js.map new file mode 100644 index 00000000..202edc25 --- /dev/null +++ b/packages/messaging/dist/module/ui/theme/ThemeProvider.js.map @@ -0,0 +1 @@ +{"version":3,"names":["createContext","useContext","useMemo","useColorScheme","defaultTheme","light","colors","primary","secondary","background","textPrimary","textSecondary","imagePlaceholder","buttonTextColor","dark","ThemeContext","undefined","ThemeProvider","children","customThemes","systemColorScheme","mergedThemes","activeTheme","contextValue","React","createElement","Provider","value","useTheme","context"],"sourceRoot":"../../../../src","sources":["ui/theme/ThemeProvider.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,aAAa,EAAEC,UAAU,EAAaC,OAAO,QAAQ,OAAO;AACrE,SAASC,cAAc,QAAQ,cAAc;AAQ7C,MAAMC,YAAoB,GAAG;EAC3BC,KAAK,EAAE;IACLC,MAAM,EAAE;MACNC,OAAO,EAAE,SAAS;MAClBC,SAAS,EAAE,SAAS;MACpBC,UAAU,EAAE,SAAS;MACrBC,WAAW,EAAE,SAAS;MACtBC,aAAa,EAAE,SAAS;MACxBC,gBAAgB,EAAE,SAAS;MAC3BC,eAAe,EAAE;IACnB;EACF,CAAC;EACDC,IAAI,EAAE;IACJR,MAAM,EAAE;MACNC,OAAO,EAAE,SAAS;MAClBC,SAAS,EAAE,SAAS;MACpBC,UAAU,EAAE,SAAS;MACrBC,WAAW,EAAE,SAAS;MACtBC,aAAa,EAAE,SAAS;MACxBC,gBAAgB,EAAE,SAAS;MAC3BC,eAAe,EAAE;IACnB;EACF;AACF,CAAC;AAED,MAAME,YAAY,gBAAGf,aAAa,CAAoBgB,SAAS,CAAC;;AAEhE;AACA;AAC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ui/theme/index.js b/packages/messaging/dist/module/ui/theme/index.js new file mode 100644 index 00000000..94014bbe --- /dev/null +++ b/packages/messaging/dist/module/ui/theme/index.js @@ -0,0 +1,5 @@ +"use strict"; + +export * from "./Theme.js"; +export * from "./ThemeProvider.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/theme/index.js.map b/packages/messaging/dist/module/ui/theme/index.js.map new file mode 100644 index 00000000..f902b680 --- /dev/null +++ b/packages/messaging/dist/module/ui/theme/index.js.map @@ -0,0 +1 @@ +{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["ui/theme/index.ts"],"mappings":";;AAAA,cAAc,YAAS;AACvB,cAAc,oBAAiB","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/types/ContentViewEvent.js b/packages/messaging/dist/module/ui/types/ContentViewEvent.js new file mode 100644 index 00000000..83f55db4 --- /dev/null +++ b/packages/messaging/dist/module/ui/types/ContentViewEvent.js @@ -0,0 +1,2 @@ +"use strict"; +//# sourceMappingURL=ContentViewEvent.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/types/ContentViewEvent.js.map b/packages/messaging/dist/module/ui/types/ContentViewEvent.js.map new file mode 100644 index 00000000..90246703 --- /dev/null +++ b/packages/messaging/dist/module/ui/types/ContentViewEvent.js.map @@ -0,0 +1 @@ +{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["ui/types/ContentViewEvent.ts"],"mappings":"","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/types/Templates.js b/packages/messaging/dist/module/ui/types/Templates.js new file mode 100644 index 00000000..1d1f0e3c --- /dev/null +++ b/packages/messaging/dist/module/ui/types/Templates.js @@ -0,0 +1,14 @@ +"use strict"; + +import { ContentCard } from "../../models/ContentCard.js"; +export class ContentTemplate extends ContentCard { + constructor(data, type) { + super(data); + this.type = type; + } +} + +/** Overrides for the structural pieces of the content card */ + +/** The base style overrides available for content cards */ +//# sourceMappingURL=Templates.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/types/Templates.js.map b/packages/messaging/dist/module/ui/types/Templates.js.map new file mode 100644 index 00000000..4488889b --- /dev/null +++ b/packages/messaging/dist/module/ui/types/Templates.js.map @@ -0,0 +1 @@ +{"version":3,"names":["ContentCard","ContentTemplate","constructor","data","type"],"sourceRoot":"../../../../src","sources":["ui/types/Templates.ts"],"mappings":";;AAUA,SACEA,WAAW,QAGN,6BAA0B;AAGjC,OAAO,MAAMC,eAAe,SAASD,WAAW,CAAC;EAG/CE,WAAWA,CAACC,IAAqB,EAAEC,IAAyB,EAAE;IAC5D,KAAK,CAACD,IAAI,CAAC;IACX,IAAI,CAACC,IAAI,GAAGA,IAAI;EAClB;AACF;;AAEA;;AAcA","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/types/index.js b/packages/messaging/dist/module/ui/types/index.js new file mode 100644 index 00000000..dd947405 --- /dev/null +++ b/packages/messaging/dist/module/ui/types/index.js @@ -0,0 +1,5 @@ +"use strict"; + +export * from "./ContentViewEvent.js"; +export * from "./Templates.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/ui/types/index.js.map b/packages/messaging/dist/module/ui/types/index.js.map new file mode 100644 index 00000000..bf13e9a6 --- /dev/null +++ b/packages/messaging/dist/module/ui/types/index.js.map @@ -0,0 +1 @@ +{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["ui/types/index.ts"],"mappings":";;AAAA,cAAc,uBAAoB;AAClC,cAAc,gBAAa","ignoreList":[]} diff --git a/packages/messaging/dist/typescript/models/ContentCard.d.ts b/packages/messaging/dist/typescript/models/ContentCard.d.ts index 7f67b41f..9839806d 100644 --- a/packages/messaging/dist/typescript/models/ContentCard.d.ts +++ b/packages/messaging/dist/typescript/models/ContentCard.d.ts @@ -51,6 +51,7 @@ export interface ContentCardData extends PropositionItemData { } export declare class ContentCard extends PropositionItem { data: ContentCardData['data']; + isRead: boolean; constructor(contentCardData: ContentCardData); } //# sourceMappingURL=ContentCard.d.ts.map \ No newline at end of file diff --git a/packages/messaging/dist/typescript/models/ContentCard.d.ts.map b/packages/messaging/dist/typescript/models/ContentCard.d.ts.map index 58c63be4..e259d85e 100644 --- a/packages/messaging/dist/typescript/models/ContentCard.d.ts.map +++ b/packages/messaging/dist/typescript/models/ContentCard.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"ContentCard.d.ts","sourceRoot":"","sources":["../../../src/models/ContentCard.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAEzE,MAAM,MAAM,mBAAmB,GAAG,YAAY,GAAG,YAAY,GAAG,WAAW,CAAC;AAC5E,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE9D,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE;QACb,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;KAC1B,CAAC;CACH;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,KAAK,CAAC,EAAE;QACf,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;QACrB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;KAC3B,CAAC;IACF,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAChD,QAAQ,CAAC,UAAU,CAAC,EAAE;QACpB,QAAQ,CAAC,KAAK,EAAE,kBAAkB,CAAC;KACpC,CAAC;IACF,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CA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AAG,EAAE,MAAM,GAAG,GAAG,CAAC;IACnB,KAAK,EAAE;QAAE,QAAQ,EAAE,mBAAmB,CAAA;KAAE,CAAC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,eAAgB,SAAQ,mBAAmB;IAC1D,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,qBAAqB,CAAC,YAAY,CAAC;IAC3C,IAAI,EAAE;QACJ,WAAW,EAAE,kBAAkB,CAAC;QAChC,UAAU,EAAE,MAAM,CAAC;QACnB,aAAa,EAAE,MAAM,CAAC;QACtB,IAAI,EAAE,eAAe,CAAC;QACtB,OAAO,EAAE,qBAAqB,GAAG,qBAAqB,GAAG,gBAAgB,CAAC;KAC3E,CAAC;CACH;AACD,qBAAa,WAAY,SAAQ,eAAe;IAC9C,IAAI,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IAC9B,MAAM,EAAE,OAAO,CAAS;gBAEZ,eAAe,EAAE,eAAe;CAI7C"} \ No newline at end of file diff --git a/packages/messaging/dist/typescript/ui/components/ContentCardView/ContentCardView.d.ts b/packages/messaging/dist/typescript/ui/components/ContentCardView/ContentCardView.d.ts index 14ecda60..7d2a2cdb 100644 --- a/packages/messaging/dist/typescript/ui/components/ContentCardView/ContentCardView.d.ts +++ b/packages/messaging/dist/typescript/ui/components/ContentCardView/ContentCardView.d.ts @@ -30,7 +30,6 @@ export interface ContentViewProps extends PressableProps, ComponentOverrideProps listener?: ContentCardEventListener; /** The variant of the content card to display */ variant?: ContentCardTemplate; - isRead?: boolean; } /** Renders a content card view * @param {ContentViewProps} props - The props for the ContentCardView component diff --git a/packages/messaging/dist/typescript/ui/components/ContentCardView/ContentCardView.d.ts.map b/packages/messaging/dist/typescript/ui/components/ContentCardView/ContentCardView.d.ts.map index 035fe110..67c483b2 100644 --- a/packages/messaging/dist/typescript/ui/components/ContentCardView/ContentCardView.d.ts.map +++ b/packages/messaging/dist/typescript/ui/components/ContentCardView/ContentCardView.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"ContentCardView.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/ContentCardView/ContentCardView.tsx"],"names":[],"mappings":"AAYA,OAAO,KAMN,MAAM,OAAO,CAAC;AACf,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAIL,cAAc,EAKf,MAAM,cAAc,CAAC;AAMtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAItD;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG;AACrC,6EAA6E;AAC7E,KAAK,CAAC,EAAE,gBAAgB;AACxB,2DAA2D;AAC3D,IAAI,CAAC,EAAE,eAAe;AACtB,kEAAkE;AAClE,WAAW,CAAC,EAAE,GAAG,KACd,IAAI,CAAC;AAEV,8CAA8C;AAC9C,MAAM,WAAW,gBACf,SAAQ,cAAc,EACpB,sBAAsB;IACxB,uCAAuC;IACvC,QAAQ,EAAE,eAAe,CAAC;IAC1B,6DAA6D;IAC7D,cAAc,CAAC,EAAE;QACf,uDAAuD;QACvD,eAAe,CAAC,EAAE,sBAAsB,CAAC;QACzC,uDAAuD;QACvD,eAAe,CAAC,EAAE,sBAAsB,CAAC;QACzC,sDAAsD;QACtD,cAAc,CAAC,EAAE,qBAAqB,CAAC;KACxC,CAAC;IACF,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,wBAAwB,CAAC;IACpC,iDAAiD;IACjD,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA+OtD,CAAC"} \ No newline at end of file +{"version":3,"file":"ContentCardView.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/ContentCardView/ContentCardView.tsx"],"names":[],"mappings":"AAYA,OAAO,KAMN,MAAM,OAAO,CAAC;AACf,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAIL,cAAc,EAKf,MAAM,cAAc,CAAC;AAMtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAItD;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG;AACrC,6EAA6E;AAC7E,KAAK,CAAC,EAAE,gBAAgB;AACxB,2DAA2D;AAC3D,IAAI,CAAC,EAAE,eAAe;AACtB,kEAAkE;AAClE,WAAW,CAAC,EAAE,GAAG,KACd,IAAI,CAAC;AAEV,8CAA8C;AAC9C,MAAM,WAAW,gBACf,SAAQ,cAAc,EACpB,sBAAsB;IACxB,uCAAuC;IACvC,QAAQ,EAAE,eAAe,CAAC;IAC1B,6DAA6D;IAC7D,cAAc,CAAC,EAAE;QACf,uDAAuD;QACvD,eAAe,CAAC,EAAE,sBAAsB,CAAC;QACzC,uDAAuD;QACvD,eAAe,CAAC,EAAE,sBAAsB,CAAC;QACzC,sDAAsD;QACtD,cAAc,CAAC,EAAE,qBAAqB,CAAC;KACxC,CAAC;IACF,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,wBAAwB,CAAC;IACpC,iDAAiD;IACjD,OAAO,CAAC,EAAE,mBAAmB,CAAC;CAC/B;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAmPtD,CAAC"} \ No newline at end of file diff --git a/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.d.ts b/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.d.ts index e5a16d02..b7caf123 100644 --- a/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.d.ts +++ b/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.d.ts @@ -1,6 +1,6 @@ import React from 'react'; import { ImageProps, ImageStyle, ViewProps, ViewStyle } from 'react-native'; -export type SettingsPlacement = 'topleft' | 'topright' | 'bottomleft' | 'bottomright'; +import { SettingsPlacement } from '../../providers/ContentCardContainerProvider'; export interface UnreadIconProps extends ViewProps { imageStyle?: ImageStyle; containerStyle?: ViewStyle; diff --git a/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.d.ts.map b/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.d.ts.map index a669e772..d6f4f33c 100644 --- a/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.d.ts.map +++ b/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"UnreadIcon.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/UnreadIcon/UnreadIcon.tsx"],"names":[],"mappings":"AAWA,OAAO,KAA4B,MAAM,OAAO,CAAC;AACjD,OAAO,EAEL,UAAU,EACV,UAAU,EAGV,SAAS,EACT,SAAS,EAEV,MAAM,cAAc,CAAC;AAGtB,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,UAAU,GAAG,YAAY,GAAG,aAAa,CAAC;AAEtF,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAChD,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,MAAM,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC9B,UAAU,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC;CACxB;AAgBD,QAAA,MAAM,UAAU,GAAI,2FAUjB,eAAe,sBA+FjB,CAAC;AAEF,eAAe,UAAU,CAAC"} \ No newline at end of file +{"version":3,"file":"UnreadIcon.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/UnreadIcon/UnreadIcon.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAC5D,OAAO,EAEL,UAAU,EACV,UAAU,EAGV,SAAS,EACT,SAAS,EAEV,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AAEjF,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAChD,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,MAAM,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC9B,UAAU,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC;CACxB;AAqBD,QAAA,MAAM,UAAU,GAAI,2FAUjB,eAAe,sBAkIjB,CAAC;AAEF,eAAe,UAAU,CAAC"} \ No newline at end of file diff --git a/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.spec.d.ts b/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.spec.d.ts new file mode 100644 index 00000000..5f377db0 --- /dev/null +++ b/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=UnreadIcon.spec.d.ts.map \ No newline at end of file diff --git a/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.spec.d.ts.map b/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.spec.d.ts.map new file mode 100644 index 00000000..41631610 --- /dev/null +++ b/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"UnreadIcon.spec.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/UnreadIcon/UnreadIcon.spec.tsx"],"names":[],"mappings":""} \ No newline at end of file diff --git a/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.test.d.ts b/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.test.d.ts deleted file mode 100644 index fb811c8c..00000000 --- a/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.test.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=UnreadIcon.test.d.ts.map \ No newline at end of file diff --git a/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.test.d.ts.map b/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.test.d.ts.map deleted file mode 100644 index f09c28ce..00000000 --- a/packages/messaging/dist/typescript/ui/components/UnreadIcon/UnreadIcon.test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"UnreadIcon.test.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/UnreadIcon/UnreadIcon.test.tsx"],"names":[],"mappings":""} \ No newline at end of file diff --git a/packages/messaging/dist/typescript/ui/providers/ContentCardContainerProvider.d.ts b/packages/messaging/dist/typescript/ui/providers/ContentCardContainerProvider.d.ts index 57326e24..171dcdae 100644 --- a/packages/messaging/dist/typescript/ui/providers/ContentCardContainerProvider.d.ts +++ b/packages/messaging/dist/typescript/ui/providers/ContentCardContainerProvider.d.ts @@ -1,5 +1,5 @@ import React from "react"; -import { SettingsPlacement } from "../components/UnreadIcon/UnreadIcon"; +export type SettingsPlacement = 'topleft' | 'topright' | 'bottomleft' | 'bottomright'; export interface ContainerSettings { templateType: 'inbox' | 'banner' | 'custom'; content: { @@ -34,7 +34,8 @@ export interface ContainerSettings { }; }; }; - isUnreadEnabled: boolean; + /** Whether the unread feature is enabled. Defaults to true. */ + isUnreadEnabled?: boolean; }; showPagination?: boolean; } diff --git a/packages/messaging/dist/typescript/ui/providers/ContentCardContainerProvider.d.ts.map b/packages/messaging/dist/typescript/ui/providers/ContentCardContainerProvider.d.ts.map index d2c47638..6c738977 100644 --- a/packages/messaging/dist/typescript/ui/providers/ContentCardContainerProvider.d.ts.map +++ b/packages/messaging/dist/typescript/ui/providers/ContentCardContainerProvider.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"ContentCardContainerProvider.d.ts","sourceRoot":"","sources":["../../../../src/ui/providers/ContentCardContainerProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAExE,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC5C,OAAO,EAAE;QACP,OAAO,EAAE;YACP,OAAO,EAAE,MAAM,CAAC;SACjB,CAAC;QACF,MAAM,EAAE;YACN,WAAW,EAAE,YAAY,GAAG,UAAU,CAAC;SACxC,CAAC;QACF,QAAQ,EAAE,MAAM,CAAC;QACjB,kBAAkB,EAAE;YAClB,OAAO,EAAE;gBACP,OAAO,EAAE,MAAM,CAAC;aACjB,CAAC;YACF,KAAK,CAAC,EAAE;gBACN,GAAG,EAAE,MAAM,CAAC;gBACZ,OAAO,CAAC,EAAE,MAAM,CAAC;aAClB,CAAC;SACH,CAAC;QACF,gBAAgB,CAAC,EAAE;YACjB,SAAS,EAAE;gBACT,GAAG,EAAE;oBACH,KAAK,EAAE,MAAM,CAAC;oBACd,IAAI,EAAE,MAAM,CAAC;iBACd,CAAC;aACH,CAAC;YACF,WAAW,EAAE;gBACX,SAAS,EAAE,iBAAiB,CAAC;gBAC7B,KAAK,EAAE;oBACL,GAAG,EAAE,MAAM,CAAC;oBACZ,OAAO,CAAC,EAAE,MAAM,CAAC;iBAClB,CAAC;aACH,CAAC;SACH,CAAC;QACF,eAAe,EAAE,OAAO,CAAC;KAC1B,CAAC;IACF,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,eAAO,MAAM,2BAA2B,yCACO,CAAC;AAEhD,MAAM,WAAW,iCAAiC;IAChD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,EAAE,iBAAiB,CAAC;CAC7B;AAED,iBAAS,4BAA4B,CAAC,EACpC,QAAQ,EACR,QAAQ,GACT,EAAE,iCAAiC,qBAMnC;AAED,eAAe,4BAA4B,CAAC"} \ No newline at end of file +{"version":3,"file":"ContentCardContainerProvider.d.ts","sourceRoot":"","sources":["../../../../src/ui/providers/ContentCardContainerProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAE7C,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,UAAU,GAAG,YAAY,GAAG,aAAa,CAAC;AAEtF,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC5C,OAAO,EAAE;QACP,OAAO,EAAE;YACP,OAAO,EAAE,MAAM,CAAC;SACjB,CAAC;QACF,MAAM,EAAE;YACN,WAAW,EAAE,YAAY,GAAG,UAAU,CAAC;SACxC,CAAC;QACF,QAAQ,EAAE,MAAM,CAAC;QACjB,kBAAkB,EAAE;YAClB,OAAO,EAAE;gBACP,OAAO,EAAE,MAAM,CAAC;aACjB,CAAC;YACF,KAAK,CAAC,EAAE;gBACN,GAAG,EAAE,MAAM,CAAC;gBACZ,OAAO,CAAC,EAAE,MAAM,CAAC;aAClB,CAAC;SACH,CAAC;QACF,gBAAgB,CAAC,EAAE;YACjB,SAAS,EAAE;gBACT,GAAG,EAAE;oBACH,KAAK,EAAE,MAAM,CAAC;oBACd,IAAI,EAAE,MAAM,CAAC;iBACd,CAAC;aACH,CAAC;YACF,WAAW,EAAE;gBACX,SAAS,EAAE,iBAAiB,CAAC;gBAC7B,KAAK,EAAE;oBACL,GAAG,EAAE,MAAM,CAAC;oBACZ,OAAO,CAAC,EAAE,MAAM,CAAC;iBAClB,CAAC;aACH,CAAC;SACH,CAAC;QACF,+DAA+D;QAC/D,eAAe,CAAC,EAAE,OAAO,CAAC;KAC3B,CAAC;IACF,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,eAAO,MAAM,2BAA2B,yCACO,CAAC;AAEhD,MAAM,WAAW,iCAAiC;IAChD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,EAAE,iBAAiB,CAAC;CAC7B;AAED,iBAAS,4BAA4B,CAAC,EACpC,QAAQ,EACR,QAAQ,GACT,EAAE,iCAAiC,qBAMnC;AAED,eAAe,4BAA4B,CAAC"} \ No newline at end of file From 4fc5efc3653598ac23d2b1e74d21e28af521ee5a Mon Sep 17 00:00:00 2001 From: Calise Cheung Date: Wed, 8 Oct 2025 11:47:50 -0700 Subject: [PATCH 11/15] Update few UI color in the sample app Update few UI color in the sample app --- .../app/ContentCardsView.tsx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/apps/AEPSampleAppNewArchEnabled/app/ContentCardsView.tsx b/apps/AEPSampleAppNewArchEnabled/app/ContentCardsView.tsx index b6daa962..725afb89 100644 --- a/apps/AEPSampleAppNewArchEnabled/app/ContentCardsView.tsx +++ b/apps/AEPSampleAppNewArchEnabled/app/ContentCardsView.tsx @@ -110,7 +110,7 @@ const Header = ({ Select View Type setShowPicker(true)} > {selectedView} @@ -130,11 +130,11 @@ const Header = ({ autoCapitalize="none" /> - + {isLoading ? 'Loading...' : 'Track'} @@ -144,7 +144,7 @@ const Header = ({ {/* Theme Switcher */} Theme - + {THEME_OPTIONS.map(({ label, value }) => ( handleThemeChange(label, value)} > - + {label} @@ -408,7 +408,7 @@ const styles = StyleSheet.create({ alignItems: "center", }, themeSwitcher: { - width: "65%", + width: "80%", borderRadius: 12, padding: 4, flexDirection: "row", @@ -459,11 +459,9 @@ const styles = StyleSheet.create({ buttonNeutral: { height: 50, borderWidth: 1, - borderColor: "#ccc", borderRadius: 5, justifyContent: "center", paddingHorizontal: SPACING.s, - backgroundColor: "#fff", }, buttonPrimary: { backgroundColor: "#007AFF", From f8e1f1a206ac67feed21ceb0d7071462b26ded18 Mon Sep 17 00:00:00 2001 From: Calise Cheung Date: Wed, 8 Oct 2025 18:27:37 -0700 Subject: [PATCH 12/15] update the code to automatically refetch the content card update the code to automatically refetch the content card --- apps/AEPSampleAppNewArchEnabled/app/ContentCardsView.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/apps/AEPSampleAppNewArchEnabled/app/ContentCardsView.tsx b/apps/AEPSampleAppNewArchEnabled/app/ContentCardsView.tsx index 725afb89..d4de8ceb 100644 --- a/apps/AEPSampleAppNewArchEnabled/app/ContentCardsView.tsx +++ b/apps/AEPSampleAppNewArchEnabled/app/ContentCardsView.tsx @@ -19,6 +19,7 @@ import { Messaging, ContentCardContainerProvider, } from "@adobe/react-native-aepmessaging"; +import { useFocusEffect } from "@react-navigation/native"; import React, { memo, useCallback, useEffect, useState } from "react"; import { Appearance, @@ -205,6 +206,13 @@ const ContentCardsView = () => { : "rn/ios/remote_image"; const { content, isLoading, refetch } = useContentCardUI(surface); + // Automatically refetch content cards when screen comes into focus + useFocusEffect( + useCallback(() => { + refetch(); + }, [refetch]) + ); + // Load container settings for unread icon configuration useEffect(() => { const loadContainerSettings = async () => { From 06f5a5f756c861ffd114846c2acb015d8ebfcb9f Mon Sep 17 00:00:00 2001 From: Calise Cheung Date: Wed, 8 Oct 2025 18:28:00 -0700 Subject: [PATCH 13/15] Revert "update the code to automatically refetch the content card" This reverts commit f8e1f1a206ac67feed21ceb0d7071462b26ded18. --- apps/AEPSampleAppNewArchEnabled/app/ContentCardsView.tsx | 8 -------- 1 file changed, 8 deletions(-) diff --git a/apps/AEPSampleAppNewArchEnabled/app/ContentCardsView.tsx b/apps/AEPSampleAppNewArchEnabled/app/ContentCardsView.tsx index d4de8ceb..725afb89 100644 --- a/apps/AEPSampleAppNewArchEnabled/app/ContentCardsView.tsx +++ b/apps/AEPSampleAppNewArchEnabled/app/ContentCardsView.tsx @@ -19,7 +19,6 @@ import { Messaging, ContentCardContainerProvider, } from "@adobe/react-native-aepmessaging"; -import { useFocusEffect } from "@react-navigation/native"; import React, { memo, useCallback, useEffect, useState } from "react"; import { Appearance, @@ -206,13 +205,6 @@ const ContentCardsView = () => { : "rn/ios/remote_image"; const { content, isLoading, refetch } = useContentCardUI(surface); - // Automatically refetch content cards when screen comes into focus - useFocusEffect( - useCallback(() => { - refetch(); - }, [refetch]) - ); - // Load container settings for unread icon configuration useEffect(() => { const loadContainerSettings = async () => { From 52314bb6a0f5adba9d0cfa7e19e477296ce70c65 Mon Sep 17 00:00:00 2001 From: Calise Cheung Date: Thu, 9 Oct 2025 11:14:37 -0700 Subject: [PATCH 14/15] update read status from native update read status from native --- packages/messaging/dist/module/Messaging.js | 9 ++++++++- packages/messaging/dist/module/Messaging.js.map | 2 +- packages/messaging/dist/typescript/Messaging.d.ts.map | 2 +- packages/messaging/src/Messaging.ts | 9 ++++++++- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/packages/messaging/dist/module/Messaging.js b/packages/messaging/dist/module/Messaging.js index 2e19e18d..d087f4c6 100644 --- a/packages/messaging/dist/module/Messaging.js +++ b/packages/messaging/dist/module/Messaging.js @@ -172,8 +172,15 @@ class Messaging { return []; } return contentCards.map(card => { + //TODO Clean up mock for Testing: mark first card as already read + //return contentCards.map((card: any, index: number) => { const type = card.data?.meta?.adobe?.template ?? "SmallImage"; - return new ContentTemplate(card, type); + const read = card.data?.read; + const contentTemplate = new ContentTemplate(card, type); + contentTemplate.isRead = read ?? false; + // Test: Uncomment line above (with index) and line below to mark first 2 cards as read + // contentTemplate.isRead = read ?? (index < 2); + return contentTemplate; }); } static async getContentCardContainer(surface) { diff --git a/packages/messaging/dist/module/Messaging.js.map b/packages/messaging/dist/module/Messaging.js.map index 548852ca..9e87ab2e 100644 --- a/packages/messaging/dist/module/Messaging.js.map +++ b/packages/messaging/dist/module/Messaging.js.map @@ -1 +1 @@ -{"version":3,"names":["NativeModules","NativeEventEmitter","Platform","Message","MessagingProposition","PersonalizationSchema","ContentTemplate","RCTAEPMessaging","AEPMessaging","messagingDelegate","Messaging","extensionVersion","Promise","resolve","refreshInAppMessages","getCachedMessages","messages","map","msg","getLatestMessage","message","undefined","getPropositionsForSurfaces","surfaces","propositionsList","messagingPropositionsForSurfaces","surface","propositions","Object","entries","proposition","trackContentCardDisplay","contentCard","trackContentCardInteraction","trackPropositionItem","itemId","interaction","eventType","tokens","setMessagingDelegate","delegate","eventEmitter","addListener","onShow","messageInstance","_clearJavascriptMessageHandlers","onDismiss","shouldShowMessage","shouldSaveMessage","setMessageSettings","OS","event","urlLoaded","url","onContentLoaded","removeAllListeners","updatePropositionsForSurfaces","getContentCardUI","length","contentCards","flatMap","items","filter","item","schema","CONTENT_CARD","card","type","data","meta","adobe","template","getContentCardContainer","console","log","templateType","content","heading","layout","orientation","capacity","emptyStateSettings","unread_indicator","unread_bg","clr","light","dark","unread_icon","placement","image","darkUrl","isUnreadEnabled","showPagination"],"sourceRoot":"../../src","sources":["Messaging.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SACEA,aAAa,EACbC,kBAAkB,EAElBC,QAAQ,QACH,cAAc;AACrB,OAAOC,OAAO,MAAM,qBAAkB;AAEtC,SAASC,oBAAoB,QAAQ,kCAA+B;AAEpE,SAASC,qBAAqB,QAAQ,mCAAgC;AACtE,SAASC,eAAe,QAAQ,yBAAsB;AAkCtD,MAAMC,eAAqD,GACzDP,aAAa,CAACQ,YAAY;AAG5B,IAAIC,iBAAoC;AAExC,MAAMC,SAAS,CAAC;EACd;AACF;AACA;AACA;EACE,OAAOC,gBAAgBA,CAAA,EAAoB;IACzC,OAAOC,OAAO,CAACC,OAAO,CAACN,eAAe,CA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EAAE,uFAAuF;cAAG;cAC/FqC,OAAO,EAAE,EAAE,CAAG;YAChB;UACF;QACF,CAAC;QACDC,eAAe,EAAE,IAAI,CAAG;MAC1B,CAAC;MACDC,cAAc,EAAE;IAClB,CAAC;EACH;AACF;AAEA,eAAelF,SAAS","ignoreList":[]} +{"version":3,"names":["NativeModules","NativeEventEmitter","Platform","Message","MessagingProposition","PersonalizationSchema","ContentTemplate","RCTAEPMessaging","AEPMessaging","messagingDelegate","Messaging","extensionVersion","Promise","resolve","refreshInAppMessages","getCachedMessages","messages","map","msg","getLatestMessage","message","undefined","getPropositionsForSurfaces","surfaces","propositionsList","messagingPropositionsForSurfaces","surface","propositions","Object","entries","proposition","trackContentCardDisplay","contentCard","trackContentCardInteraction","trackPropositionItem","itemId","interaction","eventType","tokens","setMessagingDelegate","delegate","eventEmitter","addListener","onShow","messageInstance","_clearJavascriptMessageHandlers","onDismiss","shouldShowMessage","shouldSaveMessage","setMessageSettings","OS","event","urlLoaded","url","onContentLoaded","removeAllListeners","updatePropositionsForSurfaces","getContentCardUI","length","contentCards","flatMap","items","filter","item","schema","CONTENT_CARD","card","type","data","meta","adobe","template","read","contentTemplate","isRead","getContentCardContainer","console","log","templateType","content","heading","layout","orientation","capacity","emptyStateSettings","unread_indicator","unread_bg","clr","light","dark","unread_icon","placement","image","darkUrl","isUnreadEnabled","showPagination"],"sourceRoot":"../../src","sources":["Messaging.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SACEA,aAAa,EACbC,kBAAkB,EAElBC,QAAQ,QACH,cAAc;AACrB,OAAOC,OAAO,MAAM,qBAAkB;AAEtC,SAASC,oBAAoB,QAAQ,kCAA+B;AAEpE,SAASC,qBAAqB,QAAQ,mCAAgC;AACtE,SAASC,eAAe,QAAQ,yBAAsB;AAkCtD,MAAMC,eAAqD,GACzDP,aAAa,CAACQ,YAAY;AAG5B,IAAIC,iBAAoC;AAExC,MAAMC,SAAS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;UAClBhE,OAAO,EAAE;YACP2D,OAAO,EAAE;UACX;QACF,CAAC;QACDM,gBAAgB,EAAE;UAChBC,SAAS,EAAE;YACTC,GAAG,EAAE;cACHC,KAAK,EAAE,SAAS;cAAG;cACnBC,IAAI,EAAE,SAAS,CAAI;YACrB;UACF,CAAC;UACDC,WAAW,EAAE;YACXC,SAAS,EAAE,UAAU;YACrBC,KAAK,EAAE;cACLvC,GAAG,EAAE,uFAAuF;cAAG;cAC/FwC,OAAO,EAAE,EAAE,CAAG;YAChB;UACF;QACF,CAAC;QACDC,eAAe,EAAE,IAAI,CAAG;MAC1B,CAAC;MACDC,cAAc,EAAE;IAClB,CAAC;EACH;AACF;AAEA,eAAerF,SAAS","ignoreList":[]} diff --git a/packages/messaging/dist/typescript/Messaging.d.ts.map b/packages/messaging/dist/typescript/Messaging.d.ts.map index 29e7ec63..754ce4e3 100644 --- a/packages/messaging/dist/typescript/Messaging.d.ts.map +++ b/packages/messaging/dist/typescript/Messaging.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"Messaging.d.ts","sourceRoot":"","sources":["../../src/Messaging.ts"],"names":[],"mappings":"AAkBA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AAEhF,MAAM,WAAW,qBAAqB;IACpC,gBAAgB,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IACxC,iBAAiB,EAAE,MAAM,OAAO,EAAE,CAAC;IACnC,gBAAgB,EAAE,MAAM,OAAO,CAAC;IAChC,gBAAgB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CA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AAC;IAKpE;;;;;OAKG;WACU,0BAA0B,CACrC,QAAQ,EAAE,MAAM,EAAE,GACjB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,oBAAoB,EAAE,CAAC,CAAC;IAclD;;OAEG;IACH,MAAM,CAAC,uBAAuB,CAC5B,WAAW,EAAE,oBAAoB,EACjC,WAAW,EAAE,WAAW,GACvB,IAAI;IAIP;;OAEG;IACH,MAAM,CAAC,2BAA2B,CAChC,WAAW,EAAE,oBAAoB,EACjC,WAAW,EAAE,WAAW,GACvB,IAAI;IAIP;;;;;;;;OAQG;IACH,MAAM,CAAC,oBAAoB,CACzB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,GAAG,IAAI,EAC1B,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,GACtB,IAAI;IASP;;;OAGG;IACH,MAAM,CAAC,oBAAoB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,MAAM,IAAI;IAuDpE;;;;;;OAMG;IACH,MAAM,CAAC,kBAAkB,CACvB,iBAAiB,EAAE,OAAO,EAC1B,iBAAiB,EAAE,OAAO;IAK5B;;;OAGG;WACU,6BAA6B,CACxC,QAAQ,EAAE,MAAM,EAAE,GACjB,OAAO,CAAC,IAAI,CAAC;IAIhB;;;;;OAKG;WACU,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;WA8B7D,uBAAuB,CAClC,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,iBAAiB,CAAC;CAqC9B;AAED,eAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/packages/messaging/src/Messaging.ts b/packages/messaging/src/Messaging.ts index c9c7df07..d4977eea 100644 --- a/packages/messaging/src/Messaging.ts +++ b/packages/messaging/src/Messaging.ts @@ -269,8 +269,15 @@ class Messaging { } return contentCards.map((card: any) => { + //TODO Clean up mock for Testing: mark first card as already read + //return contentCards.map((card: any, index: number) => { const type = card.data?.meta?.adobe?.template ?? "SmallImage"; - return new ContentTemplate(card, type); + const read = card.data?.read; + const contentTemplate = new ContentTemplate(card, type); + contentTemplate.isRead = read ?? false; + // Test: Uncomment line above (with index) and line below to mark first 2 cards as read + // contentTemplate.isRead = read ?? (index < 2); + return contentTemplate; }); } From 91cb1d7f8f7702955b55f4feacc6d734bdc481c3 Mon Sep 17 00:00:00 2001 From: Calise Cheung Date: Thu, 9 Oct 2025 14:40:01 -0700 Subject: [PATCH 15/15] Add isRead to contentTemplate constructor Add isRead to contentTemplate constructor --- packages/messaging/dist/module/Messaging.js | 10 ++++------ packages/messaging/dist/module/Messaging.js.map | 2 +- .../messaging/dist/module/models/ContentCard.js | 3 ++- .../messaging/dist/module/models/ContentCard.js.map | 2 +- .../messaging/dist/module/ui/types/Templates.js | 4 ++-- .../messaging/dist/module/ui/types/Templates.js.map | 2 +- .../messaging/dist/typescript/Messaging.d.ts.map | 2 +- .../dist/typescript/models/ContentCard.d.ts | 2 +- .../dist/typescript/models/ContentCard.d.ts.map | 2 +- .../dist/typescript/ui/types/Templates.d.ts | 2 +- .../dist/typescript/ui/types/Templates.d.ts.map | 2 +- packages/messaging/src/Messaging.ts | 13 +++++-------- packages/messaging/src/models/ContentCard.ts | 3 ++- packages/messaging/src/ui/types/Templates.ts | 4 ++-- 14 files changed, 25 insertions(+), 28 deletions(-) diff --git a/packages/messaging/dist/module/Messaging.js b/packages/messaging/dist/module/Messaging.js index d087f4c6..7122c260 100644 --- a/packages/messaging/dist/module/Messaging.js +++ b/packages/messaging/dist/module/Messaging.js @@ -175,12 +175,10 @@ class Messaging { //TODO Clean up mock for Testing: mark first card as already read //return contentCards.map((card: any, index: number) => { const type = card.data?.meta?.adobe?.template ?? "SmallImage"; - const read = card.data?.read; - const contentTemplate = new ContentTemplate(card, type); - contentTemplate.isRead = read ?? false; - // Test: Uncomment line above (with index) and line below to mark first 2 cards as read - // contentTemplate.isRead = read ?? (index < 2); - return contentTemplate; + const isRead = card.data?.read ?? false; + // Test: To mark first 2 cards as read, uncomment line above (with index) and change isRead to: + // const isRead = card.data?.read ?? (index < 2); + return new ContentTemplate(card, type, isRead); }); } static async getContentCardContainer(surface) { diff --git a/packages/messaging/dist/module/Messaging.js.map b/packages/messaging/dist/module/Messaging.js.map index 9e87ab2e..37f7dc17 100644 --- a/packages/messaging/dist/module/Messaging.js.map +++ b/packages/messaging/dist/module/Messaging.js.map @@ -1 +1 @@ -{"version":3,"names":["NativeModules","NativeEventEmitter","Platform","Message","MessagingProposition","PersonalizationSchema","ContentTemplate","RCTAEPMessaging","AEPMessaging","messagingDelegate","Messaging","extensionVersion","Promise","resolve","refreshInAppMessages","getCachedMessages","messages","map","msg","getLatestMessage","message","undefined","getPropositionsForSurfaces","surfaces","propositionsList","messagingPropositionsForSurfaces","surface","propositions","Object","entries","proposition","trackContentCardDisplay","contentCard","trackContentCardInteraction","trackPropositionItem","itemId","interaction","eventType","tokens","setMessagingDelegate","delegate","eventEmitter","addListener","onShow","messageInstance","_clearJavascriptMessageHandlers","onDismiss","shouldShowMessage","shouldSaveMessage","setMessageSettings","OS","event","urlLoaded","url","onContentLoaded","removeAllListeners","updatePropositionsForSurfaces","getContentCardUI","length","contentCards","flatMap","items","filter","item","schema","CONTENT_CARD","card","type","data","meta","adobe","template","read","contentTemplate","isRead","getContentCardContainer","console","log","templateType","content","heading","layout","orientation","capacity","emptyStateSettings","unread_indicator","unread_bg","clr","light","dark","unread_icon","placement","image","darkUrl","isUnreadEnabled","showPagination"],"sourceRoot":"../../src","sources":["Messaging.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SACEA,aAAa,EACbC,kBAAkB,EAElBC,QAAQ,QACH,cAAc;AACrB,OAAOC,OAAO,MAAM,qBAAkB;AAEtC,SAASC,oBAAoB,QAAQ,kCAA+B;AAEpE,SAASC,qBAAqB,QAAQ,mCAAgC;AACtE,SAASC,eAAe,QAAQ,yBAAsB;AAkCtD,MAAMC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E;UACNC,WAAW,EAAE;QACf,CAAC;QACDC,QAAQ,EAAE,EAAE;QACZC,kBAAkB,EAAE;UAClBhE,OAAO,EAAE;YACP2D,OAAO,EAAE;UACX;QACF,CAAC;QACDM,gBAAgB,EAAE;UAChBC,SAAS,EAAE;YACTC,GAAG,EAAE;cACHC,KAAK,EAAE,SAAS;cAAG;cACnBC,IAAI,EAAE,SAAS,CAAI;YACrB;UACF,CAAC;UACDC,WAAW,EAAE;YACXC,SAAS,EAAE,UAAU;YACrBC,KAAK,EAAE;cACLvC,GAAG,EAAE,uFAAuF;cAAG;cAC/FwC,OAAO,EAAE,EAAE,CAAG;YAChB;UACF;QACF,CAAC;QACDC,eAAe,EAAE,IAAI,CAAG;MAC1B,CAAC;MACDC,cAAc,EAAE;IAClB,CAAC;EACH;AACF;AAEA,eAAerF,SAAS","ignoreList":[]} +{"version":3,"names":["NativeModules","NativeEventEmitter","Platform","Message","MessagingProposition","PersonalizationSchema","ContentTemplate","RCTAEPMessaging","AEPMessaging","messagingDelegate","Messaging","extensionVersion","Promise","resolve","refreshInAppMessages","getCachedMessages","messages","map","msg","getLatestMessage","message","undefined","getPropositionsForSurfaces","surfaces","propositionsList","messagingPropositionsForSurfaces","surface","propositions","Object","entries","proposition","trackContentCardDisplay","contentCard","trackContentCardInteraction","trackPropositionItem","itemId","interaction","eventType","tokens","setMessagingDelegate","delegate","eventEmitter","addListener","onShow","messageInstance","_clearJavascriptMessageHandlers","onDismiss","shouldShowMessage","shouldSaveMessage","setMessageSettings","OS","event","urlLoaded","url","onContentLoaded","removeAllListeners","updatePropositionsForSurfaces","getContentCardUI","length","contentCards","flatMap","items","filter","item","schema","CONTENT_CARD","card","type","data","meta","adobe","template","isRead","read","getContentCardContainer","console","log","templateType","content","heading","layout","orientation","capacity","emptyStateSettings","unread_indicator","unread_bg","clr","light","dark","unread_icon","placement","image","darkUrl","isUnreadEnabled","showPagination"],"sourceRoot":"../../src","sources":["Messaging.ts"],"mappings":";;AAAA;AACA;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ClChD,OAAe,EACa;IAC5BiD,OAAO,CAACC,GAAG,CAAC,yBAAyB,EAAElD,OAAO,CAAC;IAC/C,OAAO;MACLmD,YAAY,EAAE,OAAO;MACrBC,OAAO,EAAE;QACPC,OAAO,EAAE;UACPD,OAAO,EAAE;QACX,CAAC;QACDE,MAAM,EAAE;UACNC,WAAW,EAAE;QACf,CAAC;QACDC,QAAQ,EAAE,EAAE;QACZC,kBAAkB,EAAE;UAClB/D,OAAO,EAAE;YACP0D,OAAO,EAAE;UACX;QACF,CAAC;QACDM,gBAAgB,EAAE;UAChBC,SAAS,EAAE;YACTC,GAAG,EAAE;cACHC,KAAK,EAAE,SAAS;cAAG;cACnBC,IAAI,EAAE,SAAS,CAAI;YACrB;UACF,CAAC;UACDC,WAAW,EAAE;YACXC,SAAS,EAAE,UAAU;YACrBC,KAAK,EAAE;cACLtC,GAAG,EAAE,uFAAuF;cAAG;cAC/FuC,OAAO,EAAE,EAAE,CAAG;YAChB;UACF;QACF,CAAC;QACDC,eAAe,EAAE,IAAI,CAAG;MAC1B,CAAC;MACDC,cAAc,EAAE;IAClB,CAAC;EACH;AACF;AAEA,eAAepF,SAAS","ignoreList":[]} diff --git a/packages/messaging/dist/module/models/ContentCard.js b/packages/messaging/dist/module/models/ContentCard.js index 05de6c70..645f3905 100644 --- a/packages/messaging/dist/module/models/ContentCard.js +++ b/packages/messaging/dist/module/models/ContentCard.js @@ -15,9 +15,10 @@ import { PropositionItem } from "./PropositionItem.js"; export class ContentCard extends PropositionItem { isRead = false; - constructor(contentCardData) { + constructor(contentCardData, isRead = false) { super(contentCardData); this.data = contentCardData.data; + this.isRead = isRead; } } //# sourceMappingURL=ContentCard.js.map \ No newline at end of file diff --git a/packages/messaging/dist/module/models/ContentCard.js.map b/packages/messaging/dist/module/models/ContentCard.js.map index 812ac2af..4373b992 100644 --- a/packages/messaging/dist/module/models/ContentCard.js.map +++ b/packages/messaging/dist/module/models/ContentCard.js.map @@ -1 +1 @@ -{"version":3,"names":["PropositionItem","ContentCard","isRead","constructor","contentCardData","data"],"sourceRoot":"../../../src","sources":["models/ContentCard.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,eAAe,QAA6B,sBAAmB;AA2DxE,OAAO,MAAMC,WAAW,SAASD,eAAe,CAAC;EAE/CE,MAAM,GAAY,KAAK;EAEvBC,WAAWA,CAACC,eAAgC,EAAE;IAC5C,KAAK,CAACA,eAAe,CAAC;IACtB,IAAI,CAACC,IAAI,GAAGD,eAAe,CAACC,IAAI;EAClC;AACF","ignoreList":[]} +{"version":3,"names":["PropositionItem","ContentCard","isRead","constructor","contentCardData","data"],"sourceRoot":"../../../src","sources":["models/ContentCard.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,eAAe,QAA6B,sBAAmB;AA2DxE,OAAO,MAAMC,WAAW,SAASD,eAAe,CAAC;EAE/CE,MAAM,GAAY,KAAK;EAEvBC,WAAWA,CAACC,eAAgC,EAAEF,MAAe,GAAG,KAAK,EAAE;IACrE,KAAK,CAACE,eAAe,CAAC;IACtB,IAAI,CAACC,IAAI,GAAGD,eAAe,CAACC,IAAI;IAChC,IAAI,CAACH,MAAM,GAAGA,MAAM;EACtB;AACF","ignoreList":[]} diff --git a/packages/messaging/dist/module/ui/types/Templates.js b/packages/messaging/dist/module/ui/types/Templates.js index 1d1f0e3c..4f3371d2 100644 --- a/packages/messaging/dist/module/ui/types/Templates.js +++ b/packages/messaging/dist/module/ui/types/Templates.js @@ -2,8 +2,8 @@ import { ContentCard } from "../../models/ContentCard.js"; export class ContentTemplate extends ContentCard { - constructor(data, type) { - super(data); + constructor(data, type, isRead = false) { + super(data, isRead); this.type = type; } } diff --git a/packages/messaging/dist/module/ui/types/Templates.js.map b/packages/messaging/dist/module/ui/types/Templates.js.map index 4488889b..433b4dda 100644 --- a/packages/messaging/dist/module/ui/types/Templates.js.map +++ b/packages/messaging/dist/module/ui/types/Templates.js.map @@ -1 +1 @@ -{"version":3,"names":["ContentCard","ContentTemplate","constructor","data","type"],"sourceRoot":"../../../../src","sources":["ui/types/Templates.ts"],"mappings":";;AAUA,SACEA,WAAW,QAGN,6BAA0B;AAGjC,OAAO,MAAMC,eAAe,SAASD,WAAW,CAAC;EAG/CE,WAAWA,CAACC,IAAqB,EAAEC,IAAyB,EAAE;IAC5D,KAAK,CAACD,IAAI,CAAC;IACX,IAAI,CAACC,IAAI,GAAGA,IAAI;EAClB;AACF;;AAEA;;AAcA","ignoreList":[]} +{"version":3,"names":["ContentCard","ContentTemplate","constructor","data","type","isRead"],"sourceRoot":"../../../../src","sources":["ui/types/Templates.ts"],"mappings":";;AAUA,SACEA,WAAW,QAGN,6BAA0B;AAGjC,OAAO,MAAMC,eAAe,SAASD,WAAW,CAAC;EAG/CE,WAAWA,CAACC,IAAqB,EAAEC,IAAyB,EAAEC,MAAe,GAAG,KAAK,EAAE;IACrF,KAAK,CAACF,IAAI,EAAEE,MAAM,CAAC;IACnB,IAAI,CAACD,IAAI,GAAGA,IAAI;EAClB;AACF;;AAEA;;AAcA","ignoreList":[]} diff --git a/packages/messaging/dist/typescript/Messaging.d.ts.map b/packages/messaging/dist/typescript/Messaging.d.ts.map index 754ce4e3..05e8e676 100644 --- a/packages/messaging/dist/typescript/Messaging.d.ts.map +++ b/packages/messaging/dist/typescript/Messaging.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"Messaging.d.ts","sourceRoot":"","sources":["../../src/Messaging.ts"],"names":[],"mappings":"AAkBA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,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C9B;AAED,eAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/packages/messaging/dist/typescript/models/ContentCard.d.ts b/packages/messaging/dist/typescript/models/ContentCard.d.ts index 9839806d..877f9080 100644 --- a/packages/messaging/dist/typescript/models/ContentCard.d.ts +++ b/packages/messaging/dist/typescript/models/ContentCard.d.ts @@ -52,6 +52,6 @@ export interface ContentCardData extends PropositionItemData { export declare class ContentCard extends PropositionItem { data: ContentCardData['data']; isRead: boolean; - constructor(contentCardData: ContentCardData); + constructor(contentCardData: ContentCardData, isRead?: boolean); } //# sourceMappingURL=ContentCard.d.ts.map \ No newline at end of file diff --git a/packages/messaging/dist/typescript/models/ContentCard.d.ts.map b/packages/messaging/dist/typescript/models/ContentCard.d.ts.map index e259d85e..dd39ef1d 100644 --- a/packages/messaging/dist/typescript/models/ContentCard.d.ts.map +++ b/packages/messaging/dist/typescript/models/ContentCard.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"ContentCard.d.ts","sourceRoot":"","sources":["../../../src/models/ContentCard.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAEzE,MAAM,MAAM,mBAAmB,GAAG,YAAY,GAAG,YAAY,GAAG,WAAW,CAAC;AAC5E,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE9D,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE;QACb,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;KAC1B,CAAC;CACH;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,KAAK,CAAC,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I,CAAC,EAAE;QACd,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;KAC1B,CAAC;IACF,QAAQ,CAAC,KAAK,EAAE;QACd,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;KAC1B,CAAC;CACH;AAED,MAAM,MAAM,gBAAgB,GAAG,IAAI,CACjC,kBAAkB,EAClB,OAAO,GAAG,YAAY,GAAG,WAAW,CACrC,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,kBAAkB,CAAC;AAEvD,MAAM,MAAM,qBAAqB,GAAG,kBAAkB,CAAC;AAEvD,MAAM,WAAW,eAAe;IAC9B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IACnB,KAAK,EAAE;QAAE,QAAQ,EAAE,mBAAmB,CAAA;KAAE,CAAC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,eAAgB,SAAQ,mBAAmB;IAC1D,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,qBAAqB,CAAC,YAAY,CAAC;IAC3C,IAAI,EAAE;QACJ,WAAW,EAAE,kBAAkB,CAAC;QAChC,UAAU,EAAE,MAAM,CAAC;QACnB,aAAa,EAAE,MAAM,CAAC;QACtB,IAAI,EAAE,eAAe,CAAC;QACtB,OAAO,EAAE,qBAAqB,GAAG,qBAAqB,GAAG,gBAAgB,CAAC;KAC3E,CAAC;CACH;AACD,qBAAa,WAAY,SAAQ,eAAe;IAC9C,IAAI,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IAC9B,MAAM,EAAE,OAAO,CAAS;gBAEZ,eAAe,EAAE,eAAe,EAAE,MAAM,GAAE,OAAe;CAKtE"} \ No newline at end of file diff --git a/packages/messaging/dist/typescript/ui/types/Templates.d.ts b/packages/messaging/dist/typescript/ui/types/Templates.d.ts index 4ce77785..cc7b98b7 100644 --- a/packages/messaging/dist/typescript/ui/types/Templates.d.ts +++ b/packages/messaging/dist/typescript/ui/types/Templates.d.ts @@ -4,7 +4,7 @@ import { ContentCard, ContentCardData, ContentCardTemplate } from '../../models/ import { DismissButtonProps } from '../components/DismissButton/DismissButton'; export declare class ContentTemplate extends ContentCard { readonly type: ContentCardTemplate; - constructor(data: ContentCardData, type: ContentCardTemplate); + constructor(data: ContentCardData, type: ContentCardTemplate, isRead?: boolean); } /** Overrides for the structural pieces of the content card */ export interface ComponentOverrideProps { diff --git a/packages/messaging/dist/typescript/ui/types/Templates.d.ts.map b/packages/messaging/dist/typescript/ui/types/Templates.d.ts.map index d4d41272..6c60475e 100644 --- a/packages/messaging/dist/typescript/ui/types/Templates.d.ts.map +++ b/packages/messaging/dist/typescript/ui/types/Templates.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"Templates.d.ts","sourceRoot":"","sources":["../../../../src/ui/types/Templates.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,UAAU,EACV,UAAU,EACV,cAAc,EACd,SAAS,EACT,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EACL,WAAW,EACX,eAAe,EACf,mBAAmB,EACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAE/E,qBAAa,eAAgB,SAAQ,WAAW;IAC9C,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;gBAEvB,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,mBAAmB;CAI7D;AAED,8DAA8D;AAC9D,MAAM,WAAW,sBAAsB;IACrC,SAAS,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC/B,oBAAoB,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC1C,WAAW,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC;IACpD,cAAc,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IACpC,qBAAqB,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC3C,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,mBAAmB,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IACzC,UAAU,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IACjC,SAAS,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC/B,UAAU,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;CACjC;AAED,2DAA2D;AAC3D,MAAM,WAAW,iBAAiB;IAChC,8CAA8C;IAC9C,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,0FAA0F;IAC1F,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,gBAAgB,CAAC,EAAE,SAAS,CAAC;IAC7B,wFAAwF;IACxF,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,eAAe,CAAC,EAAE,SAAS,CAAC;IAC5B,MAAM,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;IACjC,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,aAAa,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;CACzC;AAED,MAAM,MAAM,sBAAsB,GAAG,iBAAiB,CAAC;AACvD,MAAM,MAAM,sBAAsB,GAAG,iBAAiB,CAAC;AACvD,MAAM,MAAM,qBAAqB,GAAG,IAAI,CACtC,iBAAiB,EACjB,MAAM,GAAG,gBAAgB,GAAG,OAAO,GAAG,eAAe,CACtD,CAAC"} \ No newline at end of file +{"version":3,"file":"Templates.d.ts","sourceRoot":"","sources":["../../../../src/ui/types/Templates.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,UAAU,EACV,UAAU,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U,CAAC;IACnB,gBAAgB,CAAC,EAAE,SAAS,CAAC;IAC7B,wFAAwF;IACxF,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,eAAe,CAAC,EAAE,SAAS,CAAC;IAC5B,MAAM,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;IACjC,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,aAAa,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;CACzC;AAED,MAAM,MAAM,sBAAsB,GAAG,iBAAiB,CAAC;AACvD,MAAM,MAAM,sBAAsB,GAAG,iBAAiB,CAAC;AACvD,MAAM,MAAM,qBAAqB,GAAG,IAAI,CACtC,iBAAiB,EACjB,MAAM,GAAG,gBAAgB,GAAG,OAAO,GAAG,eAAe,CACtD,CAAC"} \ No newline at end of file diff --git a/packages/messaging/src/Messaging.ts b/packages/messaging/src/Messaging.ts index d4977eea..95b8b332 100644 --- a/packages/messaging/src/Messaging.ts +++ b/packages/messaging/src/Messaging.ts @@ -269,15 +269,12 @@ class Messaging { } return contentCards.map((card: any) => { - //TODO Clean up mock for Testing: mark first card as already read - //return contentCards.map((card: any, index: number) => { + // Test: To mark first 2 cards as read, swap the two map lines above to add index, then replace isRead with: + // return contentCards.map((card: any, index: number) => { const type = card.data?.meta?.adobe?.template ?? "SmallImage"; - const read = card.data?.read; - const contentTemplate = new ContentTemplate(card, type); - contentTemplate.isRead = read ?? false; - // Test: Uncomment line above (with index) and line below to mark first 2 cards as read - // contentTemplate.isRead = read ?? (index < 2); - return contentTemplate; + const isRead = card.data?.read ?? false; + // const isRead = card.data?.read ?? (index < 2); + return new ContentTemplate(card, type, isRead); }); } diff --git a/packages/messaging/src/models/ContentCard.ts b/packages/messaging/src/models/ContentCard.ts index 64732f88..6b9bfc98 100644 --- a/packages/messaging/src/models/ContentCard.ts +++ b/packages/messaging/src/models/ContentCard.ts @@ -74,8 +74,9 @@ export class ContentCard extends PropositionItem { data: ContentCardData['data']; isRead: boolean = false; - constructor(contentCardData: ContentCardData) { + constructor(contentCardData: ContentCardData, isRead: boolean = false) { super(contentCardData); this.data = contentCardData.data; + this.isRead = isRead; } } diff --git a/packages/messaging/src/ui/types/Templates.ts b/packages/messaging/src/ui/types/Templates.ts index 84b62730..2760c79a 100644 --- a/packages/messaging/src/ui/types/Templates.ts +++ b/packages/messaging/src/ui/types/Templates.ts @@ -18,8 +18,8 @@ import { DismissButtonProps } from '../components/DismissButton/DismissButton'; export class ContentTemplate extends ContentCard { readonly type: ContentCardTemplate; - constructor(data: ContentCardData, type: ContentCardTemplate) { - super(data); + constructor(data: ContentCardData, type: ContentCardTemplate, isRead: boolean = false) { + super(data, isRead); this.type = type; } }