feeddo-react-native 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (225) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +401 -2
  3. package/android/build.gradle +39 -0
  4. package/android/src/main/AndroidManifest.xml +1 -0
  5. package/android/src/main/java/dev/feeddo/reactnative/FeeddoReactNativeModule.java +380 -0
  6. package/android/src/main/java/dev/feeddo/reactnative/FeeddoReactNativePackage.java +25 -0
  7. package/dist/Feeddo.d.ts +131 -0
  8. package/dist/Feeddo.d.ts.map +1 -0
  9. package/dist/Feeddo.js +176 -0
  10. package/dist/Feeddo.js.map +1 -0
  11. package/dist/FeeddoClient.d.ts +151 -0
  12. package/dist/FeeddoClient.d.ts.map +1 -0
  13. package/dist/FeeddoClient.js +690 -0
  14. package/dist/FeeddoClient.js.map +1 -0
  15. package/dist/FeeddoProvider.d.ts +23 -0
  16. package/dist/FeeddoProvider.d.ts.map +1 -0
  17. package/dist/FeeddoProvider.js +76 -0
  18. package/dist/FeeddoProvider.js.map +1 -0
  19. package/dist/config/FeeddoConfig.d.ts +10 -0
  20. package/dist/config/FeeddoConfig.d.ts.map +1 -0
  21. package/dist/config/FeeddoConfig.js +10 -0
  22. package/dist/config/FeeddoConfig.js.map +1 -0
  23. package/dist/index.d.ts +36 -0
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +38 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/models/Conversation.d.ts +27 -0
  28. package/dist/models/Conversation.d.ts.map +1 -0
  29. package/dist/models/Conversation.js +24 -0
  30. package/dist/models/Conversation.js.map +1 -0
  31. package/dist/models/EndUser.d.ts +49 -0
  32. package/dist/models/EndUser.d.ts.map +1 -0
  33. package/dist/models/EndUser.js +2 -0
  34. package/dist/models/EndUser.js.map +1 -0
  35. package/dist/models/FeeddoNotification.d.ts +15 -0
  36. package/dist/models/FeeddoNotification.d.ts.map +1 -0
  37. package/dist/models/FeeddoNotification.js +15 -0
  38. package/dist/models/FeeddoNotification.js.map +1 -0
  39. package/dist/models/HomeData.d.ts +16 -0
  40. package/dist/models/HomeData.d.ts.map +1 -0
  41. package/dist/models/HomeData.js +19 -0
  42. package/dist/models/HomeData.js.map +1 -0
  43. package/dist/models/Message.d.ts +12 -0
  44. package/dist/models/Message.d.ts.map +1 -0
  45. package/dist/models/Message.js +25 -0
  46. package/dist/models/Message.js.map +1 -0
  47. package/dist/models/PushProvider.d.ts +14 -0
  48. package/dist/models/PushProvider.d.ts.map +1 -0
  49. package/dist/models/PushProvider.js +9 -0
  50. package/dist/models/PushProvider.js.map +1 -0
  51. package/dist/models/Task.d.ts +17 -0
  52. package/dist/models/Task.d.ts.map +1 -0
  53. package/dist/models/Task.js +22 -0
  54. package/dist/models/Task.js.map +1 -0
  55. package/dist/models/TaskComment.d.ts +11 -0
  56. package/dist/models/TaskComment.d.ts.map +1 -0
  57. package/dist/models/TaskComment.js +27 -0
  58. package/dist/models/TaskComment.js.map +1 -0
  59. package/dist/models/Ticket.d.ts +13 -0
  60. package/dist/models/Ticket.d.ts.map +1 -0
  61. package/dist/models/Ticket.js +14 -0
  62. package/dist/models/Ticket.js.map +1 -0
  63. package/dist/native/FeeddoNative.d.ts +58 -0
  64. package/dist/native/FeeddoNative.d.ts.map +1 -0
  65. package/dist/native/FeeddoNative.js +22 -0
  66. package/dist/native/FeeddoNative.js.map +1 -0
  67. package/dist/push/FeeddoPushNotificationApns.d.ts +73 -0
  68. package/dist/push/FeeddoPushNotificationApns.d.ts.map +1 -0
  69. package/dist/push/FeeddoPushNotificationApns.js +301 -0
  70. package/dist/push/FeeddoPushNotificationApns.js.map +1 -0
  71. package/dist/services/ApiService.d.ts +64 -0
  72. package/dist/services/ApiService.d.ts.map +1 -0
  73. package/dist/services/ApiService.js +406 -0
  74. package/dist/services/ApiService.js.map +1 -0
  75. package/dist/services/ConversationService.d.ts +45 -0
  76. package/dist/services/ConversationService.d.ts.map +1 -0
  77. package/dist/services/ConversationService.js +259 -0
  78. package/dist/services/ConversationService.js.map +1 -0
  79. package/dist/services/WebSocketService.d.ts +26 -0
  80. package/dist/services/WebSocketService.d.ts.map +1 -0
  81. package/dist/services/WebSocketService.js +157 -0
  82. package/dist/services/WebSocketService.js.map +1 -0
  83. package/dist/theme/FeeddoTheme.d.ts +31 -0
  84. package/dist/theme/FeeddoTheme.d.ts.map +1 -0
  85. package/dist/theme/FeeddoTheme.js +60 -0
  86. package/dist/theme/FeeddoTheme.js.map +1 -0
  87. package/dist/ui/FeeddoFeedbackCard.d.ts +15 -0
  88. package/dist/ui/FeeddoFeedbackCard.d.ts.map +1 -0
  89. package/dist/ui/FeeddoFeedbackCard.js +188 -0
  90. package/dist/ui/FeeddoFeedbackCard.js.map +1 -0
  91. package/dist/ui/FeeddoModal.d.ts +20 -0
  92. package/dist/ui/FeeddoModal.d.ts.map +1 -0
  93. package/dist/ui/FeeddoModal.js +180 -0
  94. package/dist/ui/FeeddoModal.js.map +1 -0
  95. package/dist/ui/components/AttachmentPreview.d.ts +10 -0
  96. package/dist/ui/components/AttachmentPreview.d.ts.map +1 -0
  97. package/dist/ui/components/AttachmentPreview.js +143 -0
  98. package/dist/ui/components/AttachmentPreview.js.map +1 -0
  99. package/dist/ui/components/ChatInputArea.d.ts +16 -0
  100. package/dist/ui/components/ChatInputArea.d.ts.map +1 -0
  101. package/dist/ui/components/ChatInputArea.js +85 -0
  102. package/dist/ui/components/ChatInputArea.js.map +1 -0
  103. package/dist/ui/components/FeeddoIcon.d.ts +10 -0
  104. package/dist/ui/components/FeeddoIcon.d.ts.map +1 -0
  105. package/dist/ui/components/FeeddoIcon.js +690 -0
  106. package/dist/ui/components/FeeddoIcon.js.map +1 -0
  107. package/dist/ui/components/FeeddoNotificationBadge.d.ts +14 -0
  108. package/dist/ui/components/FeeddoNotificationBadge.d.ts.map +1 -0
  109. package/dist/ui/components/FeeddoNotificationBadge.js +171 -0
  110. package/dist/ui/components/FeeddoNotificationBadge.js.map +1 -0
  111. package/dist/ui/components/MessageBubble.d.ts +13 -0
  112. package/dist/ui/components/MessageBubble.d.ts.map +1 -0
  113. package/dist/ui/components/MessageBubble.js +163 -0
  114. package/dist/ui/components/MessageBubble.js.map +1 -0
  115. package/dist/ui/components/NotificationsSheet.d.ts +10 -0
  116. package/dist/ui/components/NotificationsSheet.d.ts.map +1 -0
  117. package/dist/ui/components/NotificationsSheet.js +252 -0
  118. package/dist/ui/components/NotificationsSheet.js.map +1 -0
  119. package/dist/ui/components/RatingWidget.d.ts +11 -0
  120. package/dist/ui/components/RatingWidget.d.ts.map +1 -0
  121. package/dist/ui/components/RatingWidget.js +34 -0
  122. package/dist/ui/components/RatingWidget.js.map +1 -0
  123. package/dist/ui/components/TaskCard.d.ts +12 -0
  124. package/dist/ui/components/TaskCard.d.ts.map +1 -0
  125. package/dist/ui/components/TaskCard.js +210 -0
  126. package/dist/ui/components/TaskCard.js.map +1 -0
  127. package/dist/ui/components/TaskDetailsSheet.d.ts +15 -0
  128. package/dist/ui/components/TaskDetailsSheet.d.ts.map +1 -0
  129. package/dist/ui/components/TaskDetailsSheet.js +577 -0
  130. package/dist/ui/components/TaskDetailsSheet.js.map +1 -0
  131. package/dist/ui/components/TicketCard.d.ts +11 -0
  132. package/dist/ui/components/TicketCard.d.ts.map +1 -0
  133. package/dist/ui/components/TicketCard.js +100 -0
  134. package/dist/ui/components/TicketCard.js.map +1 -0
  135. package/dist/ui/components/TicketDetailsSheet.d.ts +14 -0
  136. package/dist/ui/components/TicketDetailsSheet.d.ts.map +1 -0
  137. package/dist/ui/components/TicketDetailsSheet.js +254 -0
  138. package/dist/ui/components/TicketDetailsSheet.js.map +1 -0
  139. package/dist/ui/components/TypingIndicator.d.ts +10 -0
  140. package/dist/ui/components/TypingIndicator.d.ts.map +1 -0
  141. package/dist/ui/components/TypingIndicator.js +77 -0
  142. package/dist/ui/components/TypingIndicator.js.map +1 -0
  143. package/dist/ui/screens/FeeddoChatScreen.d.ts +13 -0
  144. package/dist/ui/screens/FeeddoChatScreen.d.ts.map +1 -0
  145. package/dist/ui/screens/FeeddoChatScreen.js +681 -0
  146. package/dist/ui/screens/FeeddoChatScreen.js.map +1 -0
  147. package/dist/ui/screens/FeeddoHomeScreen.d.ts +15 -0
  148. package/dist/ui/screens/FeeddoHomeScreen.d.ts.map +1 -0
  149. package/dist/ui/screens/FeeddoHomeScreen.js +653 -0
  150. package/dist/ui/screens/FeeddoHomeScreen.js.map +1 -0
  151. package/dist/ui/screens/FeeddoMessagesScreen.d.ts +12 -0
  152. package/dist/ui/screens/FeeddoMessagesScreen.d.ts.map +1 -0
  153. package/dist/ui/screens/FeeddoMessagesScreen.js +326 -0
  154. package/dist/ui/screens/FeeddoMessagesScreen.js.map +1 -0
  155. package/dist/ui/screens/FeeddoTasksScreen.d.ts +13 -0
  156. package/dist/ui/screens/FeeddoTasksScreen.d.ts.map +1 -0
  157. package/dist/ui/screens/FeeddoTasksScreen.js +517 -0
  158. package/dist/ui/screens/FeeddoTasksScreen.js.map +1 -0
  159. package/dist/ui/screens/FeeddoTicketsScreen.d.ts +10 -0
  160. package/dist/ui/screens/FeeddoTicketsScreen.d.ts.map +1 -0
  161. package/dist/ui/screens/FeeddoTicketsScreen.js +112 -0
  162. package/dist/ui/screens/FeeddoTicketsScreen.js.map +1 -0
  163. package/dist/utils/DeviceInfoHelper.d.ts +29 -0
  164. package/dist/utils/DeviceInfoHelper.d.ts.map +1 -0
  165. package/dist/utils/DeviceInfoHelper.js +190 -0
  166. package/dist/utils/DeviceInfoHelper.js.map +1 -0
  167. package/dist/utils/MediaHelper.d.ts +20 -0
  168. package/dist/utils/MediaHelper.d.ts.map +1 -0
  169. package/dist/utils/MediaHelper.js +92 -0
  170. package/dist/utils/MediaHelper.js.map +1 -0
  171. package/dist/utils/NotificationSupport.d.ts +22 -0
  172. package/dist/utils/NotificationSupport.d.ts.map +1 -0
  173. package/dist/utils/NotificationSupport.js +211 -0
  174. package/dist/utils/NotificationSupport.js.map +1 -0
  175. package/dist/utils/StorageHelper.d.ts +65 -0
  176. package/dist/utils/StorageHelper.d.ts.map +1 -0
  177. package/dist/utils/StorageHelper.js +273 -0
  178. package/dist/utils/StorageHelper.js.map +1 -0
  179. package/feeddo-react-native.podspec +26 -0
  180. package/ios/FeeddoReactNativeModule.h +8 -0
  181. package/ios/FeeddoReactNativeModule.m +831 -0
  182. package/package.json +56 -4
  183. package/src/Feeddo.ts +247 -0
  184. package/src/FeeddoClient.ts +895 -0
  185. package/src/FeeddoProvider.tsx +139 -0
  186. package/src/config/FeeddoConfig.ts +9 -0
  187. package/src/index.ts +67 -0
  188. package/src/models/Conversation.ts +50 -0
  189. package/src/models/EndUser.ts +65 -0
  190. package/src/models/FeeddoNotification.ts +29 -0
  191. package/src/models/HomeData.ts +33 -0
  192. package/src/models/Message.ts +36 -0
  193. package/src/models/PushProvider.ts +15 -0
  194. package/src/models/Task.ts +40 -0
  195. package/src/models/TaskComment.ts +36 -0
  196. package/src/models/Ticket.ts +25 -0
  197. package/src/native/FeeddoNative.ts +80 -0
  198. package/src/push/FeeddoPushNotificationApns.ts +362 -0
  199. package/src/services/ApiService.ts +456 -0
  200. package/src/services/ConversationService.ts +305 -0
  201. package/src/services/WebSocketService.ts +185 -0
  202. package/src/theme/FeeddoTheme.ts +85 -0
  203. package/src/ui/FeeddoFeedbackCard.tsx +245 -0
  204. package/src/ui/FeeddoModal.tsx +309 -0
  205. package/src/ui/components/AttachmentPreview.tsx +192 -0
  206. package/src/ui/components/ChatInputArea.tsx +154 -0
  207. package/src/ui/components/FeeddoIcon.tsx +903 -0
  208. package/src/ui/components/FeeddoNotificationBadge.tsx +234 -0
  209. package/src/ui/components/MessageBubble.tsx +223 -0
  210. package/src/ui/components/NotificationsSheet.tsx +324 -0
  211. package/src/ui/components/RatingWidget.tsx +64 -0
  212. package/src/ui/components/TaskCard.tsx +259 -0
  213. package/src/ui/components/TaskDetailsSheet.tsx +747 -0
  214. package/src/ui/components/TicketCard.tsx +128 -0
  215. package/src/ui/components/TicketDetailsSheet.tsx +324 -0
  216. package/src/ui/components/TypingIndicator.tsx +104 -0
  217. package/src/ui/screens/FeeddoChatScreen.tsx +877 -0
  218. package/src/ui/screens/FeeddoHomeScreen.tsx +824 -0
  219. package/src/ui/screens/FeeddoMessagesScreen.tsx +414 -0
  220. package/src/ui/screens/FeeddoTasksScreen.tsx +671 -0
  221. package/src/ui/screens/FeeddoTicketsScreen.tsx +164 -0
  222. package/src/utils/DeviceInfoHelper.ts +209 -0
  223. package/src/utils/MediaHelper.ts +105 -0
  224. package/src/utils/NotificationSupport.ts +233 -0
  225. package/src/utils/StorageHelper.ts +305 -0
@@ -0,0 +1,653 @@
1
+ import React, { useState, useEffect, useRef } from 'react';
2
+ import { View, Text, StyleSheet, TouchableOpacity, ScrollView, Modal, TextInput, SafeAreaView, Platform, Alert, } from 'react-native';
3
+ import { FeeddoIcon } from '../components/FeeddoIcon';
4
+ import { TaskCard } from '../components/TaskCard';
5
+ import { TicketCard } from '../components/TicketCard';
6
+ import { TaskDetailsSheet } from '../components/TaskDetailsSheet';
7
+ import { TicketDetailsSheet } from '../components/TicketDetailsSheet';
8
+ import { NotificationsSheet } from '../components/NotificationsSheet';
9
+ import { StorageHelper } from '../../utils/StorageHelper';
10
+ import { FeeddoInternal } from '../../FeeddoClient';
11
+ export const FeeddoHomeScreen = ({ theme, isActive = true, onClose, onNavigateToMessages, onNavigateToTickets, onNavigateToTasks, onNavigateToChat, }) => {
12
+ const [homeData, setHomeData] = useState(null);
13
+ const [showNotificationsSheet, setShowNotificationsSheet] = useState(false);
14
+ const [selectedTask, setSelectedTask] = useState(null);
15
+ const [selectedTicket, setSelectedTicket] = useState(null);
16
+ const [showUsernameModal, setShowUsernameModal] = useState(false);
17
+ const [userNameInput, setUserNameInput] = useState('');
18
+ const [, setRerender] = useState({});
19
+ const wasActive = useRef(isActive);
20
+ useEffect(() => {
21
+ checkUsernamePrompt();
22
+ loadHomeData();
23
+ const unsubscribeConv = FeeddoInternal.instance.conversationService.addListener(() => {
24
+ setRerender({});
25
+ });
26
+ const unsubscribeNotif = FeeddoInternal.instance.subscribeNotifications(() => {
27
+ loadHomeData();
28
+ });
29
+ return () => {
30
+ unsubscribeConv();
31
+ unsubscribeNotif();
32
+ };
33
+ }, []);
34
+ useEffect(() => {
35
+ if (isActive && !wasActive.current) {
36
+ loadHomeData();
37
+ }
38
+ wasActive.current = isActive;
39
+ }, [isActive]);
40
+ const checkUsernamePrompt = async () => {
41
+ const name = await StorageHelper.getUserName();
42
+ if (!name || name.trim().length === 0) {
43
+ setShowUsernameModal(true);
44
+ }
45
+ };
46
+ const loadHomeData = async () => {
47
+ try {
48
+ const data = await FeeddoInternal.instance.getHomeData();
49
+ if (data.recentConversation) {
50
+ FeeddoInternal.instance.conversationService.updateConversation(data.recentConversation);
51
+ }
52
+ setHomeData(data);
53
+ }
54
+ catch (e) {
55
+ console.warn('Feeddo: Failed to load home data:', e);
56
+ }
57
+ };
58
+ const handleSaveUsername = async () => {
59
+ const trimmed = userNameInput.trim();
60
+ if (trimmed.length === 0)
61
+ return;
62
+ setShowUsernameModal(false);
63
+ try {
64
+ await FeeddoInternal.instance.updateUser({ userName: trimmed });
65
+ }
66
+ catch (e) {
67
+ console.warn('Feeddo: Failed to save username:', e);
68
+ }
69
+ };
70
+ const handleOpenConversationById = async (convId) => {
71
+ try {
72
+ const cached = FeeddoInternal.instance.conversationService.conversations.find((c) => c.id === convId);
73
+ const conv = cached ?? (await FeeddoInternal.instance.apiService.getConversation(convId));
74
+ onNavigateToChat(conv);
75
+ }
76
+ catch (e) {
77
+ Alert.alert('Error', `Failed to open conversation: ${e?.message || e}`);
78
+ }
79
+ };
80
+ const formatTimeAgo = (timestamp) => {
81
+ const diff = Math.floor((Date.now() - timestamp) / 1000);
82
+ if (diff < 60)
83
+ return 'Just now';
84
+ if (diff < 3600) {
85
+ const mins = Math.floor(diff / 60);
86
+ return `${mins} ${mins === 1 ? 'minute' : 'minutes'} ago`;
87
+ }
88
+ if (diff < 86400) {
89
+ const hrs = Math.floor(diff / 3600);
90
+ return `${hrs} ${hrs === 1 ? 'hour' : 'hours'} ago`;
91
+ }
92
+ if (diff < 7 * 86400) {
93
+ const days = Math.floor(diff / 86400);
94
+ return `${days} ${days === 1 ? 'day' : 'days'} ago`;
95
+ }
96
+ const weeks = Math.floor(diff / (7 * 86400));
97
+ return `${weeks} ${weeks === 1 ? 'week' : 'weeks'} ago`;
98
+ };
99
+ // Find active conversation to display
100
+ const activeServiceConv = FeeddoInternal.instance.conversationService.conversations.find((c) => c.status !== 'resolved');
101
+ let displayConversation = activeServiceConv;
102
+ if (!displayConversation && homeData?.recentConversation) {
103
+ if (homeData.recentConversation.status !== 'resolved') {
104
+ displayConversation = homeData.recentConversation;
105
+ }
106
+ }
107
+ const hasRecentActivity = Boolean(homeData?.recentTask || homeData?.recentTicket || displayConversation);
108
+ const onPrimaryColor = theme.isDark ? '#000000' : '#FFFFFF';
109
+ const unreadMsgCount = FeeddoInternal.instance.conversationService.unreadMessageCount;
110
+ return (<SafeAreaView style={[styles.container, { backgroundColor: theme.colors.background }]}>
111
+ <View style={styles.bodyWrapper}>
112
+ <ScrollView style={styles.scrollArea} contentContainerStyle={styles.scrollContent} showsVerticalScrollIndicator={false}>
113
+ {/* Greetings Section */}
114
+ <View style={styles.greetingSection}>
115
+ <Text style={[styles.greetingTitle, { color: theme.colors.textPrimary }]}>
116
+ Hi there 👋
117
+ </Text>
118
+ <Text style={[styles.greetingSubtitle, { color: theme.colors.textSecondary }]}>
119
+ How can we help you today?
120
+ </Text>
121
+ </View>
122
+
123
+ {/* Primary Action Card (When no recent activity) */}
124
+ {!hasRecentActivity && (<TouchableOpacity activeOpacity={0.85} onPress={() => onNavigateToChat(null)} style={[
125
+ styles.primaryActionCard,
126
+ { backgroundColor: theme.colors.primary },
127
+ ]}>
128
+ <View style={[
129
+ styles.primaryIconBox,
130
+ { backgroundColor: `${onPrimaryColor}26` },
131
+ ]}>
132
+ <FeeddoIcon name="send" size={20} color={onPrimaryColor}/>
133
+ </View>
134
+
135
+ <View style={styles.primaryTextContainer}>
136
+ <Text style={[styles.primaryTitle, { color: onPrimaryColor }]}>
137
+ Send us a message
138
+ </Text>
139
+ <Text style={[styles.primarySubtitle, { color: `${onPrimaryColor}CC` }]}>
140
+ We're here to help
141
+ </Text>
142
+ </View>
143
+
144
+ <FeeddoIcon name="arrow_forward" size={20} color={onPrimaryColor}/>
145
+ </TouchableOpacity>)}
146
+
147
+ {/* Quick Actions Section */}
148
+ <Text style={[styles.sectionHeading, { color: theme.colors.textPrimary }]}>
149
+ Quick Actions
150
+ </Text>
151
+
152
+ {/* Messages Card */}
153
+ <TouchableOpacity activeOpacity={0.85} onPress={onNavigateToMessages} style={[
154
+ styles.menuCard,
155
+ {
156
+ backgroundColor: theme.colors.cardBackground,
157
+ borderColor: `${theme.colors.divider}4D`,
158
+ },
159
+ ]}>
160
+ <View style={[styles.menuIconContainer, { backgroundColor: 'rgba(59, 130, 246, 0.12)' }]}>
161
+ <FeeddoIcon name="chat" size={20} color="#3B82F6"/>
162
+ </View>
163
+
164
+ <View style={styles.menuTextContainer}>
165
+ <View style={styles.menuTitleRow}>
166
+ <Text style={[styles.menuTitle, { color: theme.colors.cardText }]}>
167
+ Messages
168
+ </Text>
169
+ {unreadMsgCount > 0 && (<View style={styles.countBadge}>
170
+ <Text style={styles.countBadgeText}>
171
+ {unreadMsgCount > 99 ? '99+' : unreadMsgCount}
172
+ </Text>
173
+ </View>)}
174
+ </View>
175
+ <Text style={[styles.menuSubtitle, { color: theme.colors.textSecondary }]}>
176
+ View your conversations
177
+ </Text>
178
+ </View>
179
+
180
+ <FeeddoIcon name="chevron_right" size={22} color={`${theme.colors.textSecondary}4D`}/>
181
+ </TouchableOpacity>
182
+
183
+ {/* Community Board Card */}
184
+ <TouchableOpacity activeOpacity={0.85} onPress={onNavigateToTasks} style={[
185
+ styles.menuCard,
186
+ {
187
+ backgroundColor: theme.colors.cardBackground,
188
+ borderColor: `${theme.colors.divider}4D`,
189
+ },
190
+ ]}>
191
+ <View style={[styles.menuIconContainer, { backgroundColor: 'rgba(245, 158, 11, 0.12)' }]}>
192
+ <FeeddoIcon name="lightbulb" size={20} color="#F59E0B"/>
193
+ </View>
194
+
195
+ <View style={styles.menuTextContainer}>
196
+ <Text style={[styles.menuTitle, { color: theme.colors.cardText }]}>
197
+ Community Board
198
+ </Text>
199
+ <Text style={[styles.menuSubtitle, { color: theme.colors.textSecondary }]}>
200
+ Suggest features or report bugs
201
+ </Text>
202
+ </View>
203
+
204
+ <FeeddoIcon name="chevron_right" size={22} color={`${theme.colors.textSecondary}4D`}/>
205
+ </TouchableOpacity>
206
+
207
+ {/* Tickets Card */}
208
+ <TouchableOpacity activeOpacity={0.85} onPress={onNavigateToTickets} style={[
209
+ styles.menuCard,
210
+ {
211
+ backgroundColor: theme.colors.cardBackground,
212
+ borderColor: `${theme.colors.divider}4D`,
213
+ },
214
+ ]}>
215
+ <View style={[styles.menuIconContainer, { backgroundColor: 'rgba(168, 85, 247, 0.12)' }]}>
216
+ <FeeddoIcon name="ticket" size={20} color="#A855F7"/>
217
+ </View>
218
+
219
+ <View style={styles.menuTextContainer}>
220
+ <Text style={[styles.menuTitle, { color: theme.colors.cardText }]}>
221
+ Tickets
222
+ </Text>
223
+ <Text style={[styles.menuSubtitle, { color: theme.colors.textSecondary }]}>
224
+ Track your support tickets
225
+ </Text>
226
+ </View>
227
+
228
+ <FeeddoIcon name="chevron_right" size={22} color={`${theme.colors.textSecondary}4D`}/>
229
+ </TouchableOpacity>
230
+
231
+ {/* Recent Activity Section */}
232
+ {hasRecentActivity && (<View style={styles.recentActivitySection}>
233
+ <Text style={[styles.sectionHeading, { color: theme.colors.textPrimary }]}>
234
+ Recent Activity
235
+ </Text>
236
+
237
+ {/* Recent Conversation */}
238
+ {Boolean(displayConversation) && (<TouchableOpacity activeOpacity={0.85} onPress={() => onNavigateToChat(displayConversation)} style={[
239
+ styles.recentConversationCard,
240
+ {
241
+ backgroundColor: theme.colors.cardBackground,
242
+ borderColor: `${theme.colors.divider}4D`,
243
+ },
244
+ ]}>
245
+ <View style={styles.recentConvTop}>
246
+ <View style={[styles.menuIconContainer, { backgroundColor: 'rgba(59, 130, 246, 0.12)' }]}>
247
+ <FeeddoIcon name="chat" size={20} color="#3B82F6"/>
248
+ </View>
249
+
250
+ <View style={styles.recentConvTitleContainer}>
251
+ <View style={styles.recentConvTitleRow}>
252
+ <Text style={[styles.recentConvTitle, { color: theme.colors.cardText }]} numberOfLines={1}>
253
+ {displayConversation.displayName ||
254
+ displayConversation.title ||
255
+ 'Conversation'}
256
+ </Text>
257
+ {displayConversation.unreadMessages > 0 && (<View style={styles.countBadge}>
258
+ <Text style={styles.countBadgeText}>
259
+ {displayConversation.unreadMessages > 99
260
+ ? '99+'
261
+ : displayConversation.unreadMessages}
262
+ </Text>
263
+ </View>)}
264
+ </View>
265
+ <Text style={[styles.recentConvTime, { color: theme.colors.textSecondary }]}>
266
+ {formatTimeAgo(displayConversation.lastMessageAt)}
267
+ </Text>
268
+ </View>
269
+
270
+ <FeeddoIcon name="chevron_right" size={22} color={`${theme.colors.textSecondary}4D`}/>
271
+ </View>
272
+
273
+ {Boolean(displayConversation.lastMessagePreview) && (<Text style={[styles.recentConvPreview, { color: theme.colors.textSecondary }]} numberOfLines={2}>
274
+ {displayConversation.lastMessagePreview}
275
+ </Text>)}
276
+ </TouchableOpacity>)}
277
+
278
+ {/* Recent Ticket */}
279
+ {Boolean(homeData?.recentTicket) && (<View style={{ marginBottom: 14 }}>
280
+ <TicketCard ticket={homeData.recentTicket} theme={theme} onTap={() => setSelectedTicket(homeData.recentTicket)}/>
281
+ </View>)}
282
+
283
+ {/* Recent Task */}
284
+ {Boolean(homeData?.recentTask) && (<View style={{ marginBottom: 14 }}>
285
+ <TaskCard task={homeData.recentTask} theme={theme} onTap={() => setSelectedTask(homeData.recentTask)}/>
286
+ </View>)}
287
+ </View>)}
288
+
289
+ {/* Footer */}
290
+ <View style={styles.footerContainer}>
291
+ <Text style={[styles.footerText, { color: `${theme.colors.textSecondary}66` }]}>
292
+ Powered by{' '}
293
+ <Text style={{ fontWeight: '600', color: `${theme.colors.textSecondary}99` }}>
294
+ {FeeddoInternal.instance.chatBotName}
295
+ </Text>
296
+ </Text>
297
+ </View>
298
+ </ScrollView>
299
+
300
+ {/* Top-Right Floating Controls (matching Flutter Positioned buttons) */}
301
+ <View style={styles.floatingControls}>
302
+ <View style={styles.notifButtonWrapper}>
303
+ <TouchableOpacity activeOpacity={0.8} onPress={() => setShowNotificationsSheet(true)} style={[
304
+ styles.iconCardButton,
305
+ {
306
+ backgroundColor: theme.colors.cardBackground,
307
+ borderColor: `${theme.colors.divider}33`,
308
+ },
309
+ ]}>
310
+ <FeeddoIcon name="notifications" size={20} color={theme.colors.textPrimary}/>
311
+ </TouchableOpacity>
312
+ {homeData && homeData.unreadNotificationCount > 0 && (<View style={styles.notifBadge} pointerEvents="none">
313
+ <Text style={styles.notifBadgeText}>
314
+ {homeData.unreadNotificationCount > 99
315
+ ? '99+'
316
+ : homeData.unreadNotificationCount}
317
+ </Text>
318
+ </View>)}
319
+ </View>
320
+
321
+ <TouchableOpacity activeOpacity={0.8} onPress={onClose} style={[
322
+ styles.iconCardButton,
323
+ {
324
+ backgroundColor: theme.colors.cardBackground,
325
+ borderColor: `${theme.colors.divider}33`,
326
+ marginLeft: 14,
327
+ },
328
+ ]}>
329
+ <FeeddoIcon name="close" size={20} color={theme.colors.closeButtonColor}/>
330
+ </TouchableOpacity>
331
+ </View>
332
+
333
+ {/* Floating Action Button (when recent activity exists) */}
334
+ {hasRecentActivity && (<TouchableOpacity activeOpacity={0.85} onPress={() => onNavigateToChat(null)} style={[
335
+ styles.fab,
336
+ {
337
+ backgroundColor: theme.colors.primary,
338
+ shadowColor: theme.colors.primary,
339
+ },
340
+ ]}>
341
+ <FeeddoIcon name="edit" size={22} color={onPrimaryColor}/>
342
+ </TouchableOpacity>)}
343
+ </View>
344
+
345
+ {/* Sheets / Modals */}
346
+ <NotificationsSheet visible={showNotificationsSheet} onClose={() => {
347
+ setShowNotificationsSheet(false);
348
+ loadHomeData();
349
+ }} theme={theme}/>
350
+
351
+ <TaskDetailsSheet visible={Boolean(selectedTask)} task={selectedTask ?? undefined} onClose={() => setSelectedTask(null)} onOpenConversation={(convId) => {
352
+ setSelectedTask(null);
353
+ handleOpenConversationById(convId);
354
+ }} onTaskUpdated={() => {
355
+ loadHomeData();
356
+ }} theme={theme}/>
357
+
358
+ <TicketDetailsSheet visible={Boolean(selectedTicket)} ticket={selectedTicket ?? undefined} onClose={() => setSelectedTicket(null)} onOpenConversation={(convId) => {
359
+ setSelectedTicket(null);
360
+ handleOpenConversationById(convId);
361
+ }} theme={theme}/>
362
+
363
+ {/* Username Modal */}
364
+ <Modal visible={showUsernameModal} transparent animationType="fade">
365
+ <View style={styles.modalBackdrop}>
366
+ <View style={[styles.modalContent, { backgroundColor: theme.colors.surface }]}>
367
+ <Text style={[styles.modalTitle, { color: theme.colors.textPrimary }]}>
368
+ Welcome!
369
+ </Text>
370
+ <Text style={[styles.modalSubtitle, { color: theme.colors.textSecondary }]}>
371
+ Please enter your name to get started
372
+ </Text>
373
+
374
+ <TextInput value={userNameInput} onChangeText={setUserNameInput} placeholder="Your name" placeholderTextColor={theme.colors.textSecondary} style={[
375
+ styles.modalInput,
376
+ {
377
+ backgroundColor: theme.colors.background,
378
+ borderColor: theme.colors.border,
379
+ color: theme.colors.textPrimary,
380
+ },
381
+ ]} autoFocus onSubmitEditing={handleSaveUsername}/>
382
+
383
+ <TouchableOpacity activeOpacity={0.8} onPress={handleSaveUsername} style={[styles.modalButton, { backgroundColor: theme.colors.primary }]}>
384
+ <Text style={[styles.modalButtonText, { color: onPrimaryColor }]}>
385
+ Continue
386
+ </Text>
387
+ </TouchableOpacity>
388
+ </View>
389
+ </View>
390
+ </Modal>
391
+ </SafeAreaView>);
392
+ };
393
+ const styles = StyleSheet.create({
394
+ container: {
395
+ flex: 1,
396
+ },
397
+ bodyWrapper: {
398
+ flex: 1,
399
+ position: 'relative',
400
+ },
401
+ floatingControls: {
402
+ position: 'absolute',
403
+ top: Platform.OS === 'android' ? 14 : 12,
404
+ right: 12,
405
+ flexDirection: 'row',
406
+ alignItems: 'center',
407
+ zIndex: 10,
408
+ },
409
+ notifButtonWrapper: {
410
+ position: 'relative',
411
+ },
412
+ iconCardButton: {
413
+ width: 44,
414
+ height: 44,
415
+ borderRadius: 12,
416
+ borderWidth: 1,
417
+ alignItems: 'center',
418
+ justifyContent: 'center',
419
+ shadowColor: '#000',
420
+ shadowOffset: { width: 0, height: 2 },
421
+ shadowOpacity: 0.08,
422
+ shadowRadius: 8,
423
+ elevation: 2,
424
+ },
425
+ notifBadge: {
426
+ position: 'absolute',
427
+ top: 2,
428
+ right: 2,
429
+ backgroundColor: '#EF4444',
430
+ borderRadius: 9,
431
+ minWidth: 18,
432
+ height: 18,
433
+ alignItems: 'center',
434
+ justifyContent: 'center',
435
+ paddingHorizontal: 4,
436
+ },
437
+ notifBadgeText: {
438
+ color: '#FFFFFF',
439
+ fontSize: 10,
440
+ fontWeight: '700',
441
+ },
442
+ scrollArea: {
443
+ flex: 1,
444
+ },
445
+ scrollContent: {
446
+ paddingHorizontal: 20,
447
+ paddingTop: Platform.OS === 'android' ? 14 : 8,
448
+ paddingBottom: 80,
449
+ },
450
+ greetingSection: {
451
+ marginTop: 32,
452
+ marginBottom: 36,
453
+ },
454
+ greetingTitle: {
455
+ fontSize: 32,
456
+ fontWeight: '800',
457
+ letterSpacing: -1.0,
458
+ },
459
+ greetingSubtitle: {
460
+ fontSize: 17,
461
+ marginTop: 12,
462
+ letterSpacing: -0.2,
463
+ },
464
+ primaryActionCard: {
465
+ flexDirection: 'row',
466
+ alignItems: 'center',
467
+ padding: 20,
468
+ borderRadius: 16,
469
+ marginBottom: 32,
470
+ },
471
+ primaryIconBox: {
472
+ width: 48,
473
+ height: 48,
474
+ borderRadius: 12,
475
+ alignItems: 'center',
476
+ justifyContent: 'center',
477
+ },
478
+ primaryTextContainer: {
479
+ flex: 1,
480
+ marginLeft: 16,
481
+ },
482
+ primaryTitle: {
483
+ fontSize: 17,
484
+ fontWeight: '700',
485
+ letterSpacing: -0.3,
486
+ },
487
+ primarySubtitle: {
488
+ fontSize: 14,
489
+ marginTop: 2,
490
+ letterSpacing: -0.1,
491
+ },
492
+ sectionHeading: {
493
+ fontSize: 20,
494
+ fontWeight: '700',
495
+ letterSpacing: -0.5,
496
+ marginBottom: 20,
497
+ },
498
+ menuCard: {
499
+ flexDirection: 'row',
500
+ alignItems: 'center',
501
+ padding: 18,
502
+ borderRadius: 16,
503
+ borderWidth: 1,
504
+ marginBottom: 14,
505
+ shadowColor: '#000',
506
+ shadowOffset: { width: 0, height: 4 },
507
+ shadowOpacity: 0.06,
508
+ shadowRadius: 12,
509
+ elevation: 2,
510
+ },
511
+ menuIconContainer: {
512
+ width: 42,
513
+ height: 42,
514
+ borderRadius: 12,
515
+ alignItems: 'center',
516
+ justifyContent: 'center',
517
+ },
518
+ menuTextContainer: {
519
+ flex: 1,
520
+ marginLeft: 16,
521
+ },
522
+ menuTitleRow: {
523
+ flexDirection: 'row',
524
+ alignItems: 'center',
525
+ },
526
+ menuTitle: {
527
+ fontSize: 16,
528
+ fontWeight: '700',
529
+ letterSpacing: -0.3,
530
+ },
531
+ menuSubtitle: {
532
+ fontSize: 14,
533
+ marginTop: 4,
534
+ letterSpacing: -0.1,
535
+ },
536
+ countBadge: {
537
+ backgroundColor: '#EF4444',
538
+ borderRadius: 10,
539
+ paddingHorizontal: 8,
540
+ paddingVertical: 3,
541
+ marginLeft: 8,
542
+ },
543
+ countBadgeText: {
544
+ color: '#FFFFFF',
545
+ fontSize: 11,
546
+ fontWeight: '700',
547
+ },
548
+ recentActivitySection: {
549
+ marginTop: 22,
550
+ },
551
+ recentConversationCard: {
552
+ padding: 18,
553
+ borderRadius: 16,
554
+ borderWidth: 1,
555
+ marginBottom: 14,
556
+ shadowColor: '#000',
557
+ shadowOffset: { width: 0, height: 4 },
558
+ shadowOpacity: 0.06,
559
+ shadowRadius: 12,
560
+ elevation: 2,
561
+ },
562
+ recentConvTop: {
563
+ flexDirection: 'row',
564
+ alignItems: 'center',
565
+ },
566
+ recentConvTitleContainer: {
567
+ flex: 1,
568
+ marginLeft: 14,
569
+ },
570
+ recentConvTitleRow: {
571
+ flexDirection: 'row',
572
+ alignItems: 'center',
573
+ },
574
+ recentConvTitle: {
575
+ fontSize: 16,
576
+ fontWeight: '700',
577
+ letterSpacing: -0.3,
578
+ flexShrink: 1,
579
+ },
580
+ recentConvTime: {
581
+ fontSize: 13,
582
+ marginTop: 4,
583
+ },
584
+ recentConvPreview: {
585
+ fontSize: 14,
586
+ marginTop: 14,
587
+ lineHeight: 20,
588
+ letterSpacing: -0.1,
589
+ },
590
+ footerContainer: {
591
+ alignItems: 'center',
592
+ marginTop: 48,
593
+ marginBottom: 24,
594
+ },
595
+ footerText: {
596
+ fontSize: 13,
597
+ letterSpacing: -0.1,
598
+ },
599
+ fab: {
600
+ position: 'absolute',
601
+ right: 20,
602
+ bottom: 24,
603
+ width: 56,
604
+ height: 56,
605
+ borderRadius: 16,
606
+ alignItems: 'center',
607
+ justifyContent: 'center',
608
+ shadowOffset: { width: 0, height: 6 },
609
+ shadowOpacity: 0.3,
610
+ shadowRadius: 16,
611
+ elevation: 6,
612
+ },
613
+ modalBackdrop: {
614
+ flex: 1,
615
+ backgroundColor: 'rgba(0,0,0,0.6)',
616
+ alignItems: 'center',
617
+ justifyContent: 'center',
618
+ padding: 24,
619
+ },
620
+ modalContent: {
621
+ width: '100%',
622
+ maxWidth: 360,
623
+ borderRadius: 16,
624
+ padding: 24,
625
+ },
626
+ modalTitle: {
627
+ fontSize: 20,
628
+ fontWeight: '800',
629
+ },
630
+ modalSubtitle: {
631
+ fontSize: 14,
632
+ marginTop: 6,
633
+ marginBottom: 18,
634
+ },
635
+ modalInput: {
636
+ borderWidth: 1,
637
+ borderRadius: 10,
638
+ paddingHorizontal: 14,
639
+ paddingVertical: 10,
640
+ fontSize: 15,
641
+ },
642
+ modalButton: {
643
+ borderRadius: 10,
644
+ paddingVertical: 12,
645
+ alignItems: 'center',
646
+ marginTop: 18,
647
+ },
648
+ modalButtonText: {
649
+ fontSize: 15,
650
+ fontWeight: '700',
651
+ },
652
+ });
653
+ //# sourceMappingURL=FeeddoHomeScreen.js.map