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.
- package/LICENSE +21 -0
- package/README.md +401 -2
- package/android/build.gradle +39 -0
- package/android/src/main/AndroidManifest.xml +1 -0
- package/android/src/main/java/dev/feeddo/reactnative/FeeddoReactNativeModule.java +380 -0
- package/android/src/main/java/dev/feeddo/reactnative/FeeddoReactNativePackage.java +25 -0
- package/dist/Feeddo.d.ts +131 -0
- package/dist/Feeddo.d.ts.map +1 -0
- package/dist/Feeddo.js +176 -0
- package/dist/Feeddo.js.map +1 -0
- package/dist/FeeddoClient.d.ts +151 -0
- package/dist/FeeddoClient.d.ts.map +1 -0
- package/dist/FeeddoClient.js +690 -0
- package/dist/FeeddoClient.js.map +1 -0
- package/dist/FeeddoProvider.d.ts +23 -0
- package/dist/FeeddoProvider.d.ts.map +1 -0
- package/dist/FeeddoProvider.js +76 -0
- package/dist/FeeddoProvider.js.map +1 -0
- package/dist/config/FeeddoConfig.d.ts +10 -0
- package/dist/config/FeeddoConfig.d.ts.map +1 -0
- package/dist/config/FeeddoConfig.js +10 -0
- package/dist/config/FeeddoConfig.js.map +1 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -0
- package/dist/models/Conversation.d.ts +27 -0
- package/dist/models/Conversation.d.ts.map +1 -0
- package/dist/models/Conversation.js +24 -0
- package/dist/models/Conversation.js.map +1 -0
- package/dist/models/EndUser.d.ts +49 -0
- package/dist/models/EndUser.d.ts.map +1 -0
- package/dist/models/EndUser.js +2 -0
- package/dist/models/EndUser.js.map +1 -0
- package/dist/models/FeeddoNotification.d.ts +15 -0
- package/dist/models/FeeddoNotification.d.ts.map +1 -0
- package/dist/models/FeeddoNotification.js +15 -0
- package/dist/models/FeeddoNotification.js.map +1 -0
- package/dist/models/HomeData.d.ts +16 -0
- package/dist/models/HomeData.d.ts.map +1 -0
- package/dist/models/HomeData.js +19 -0
- package/dist/models/HomeData.js.map +1 -0
- package/dist/models/Message.d.ts +12 -0
- package/dist/models/Message.d.ts.map +1 -0
- package/dist/models/Message.js +25 -0
- package/dist/models/Message.js.map +1 -0
- package/dist/models/PushProvider.d.ts +14 -0
- package/dist/models/PushProvider.d.ts.map +1 -0
- package/dist/models/PushProvider.js +9 -0
- package/dist/models/PushProvider.js.map +1 -0
- package/dist/models/Task.d.ts +17 -0
- package/dist/models/Task.d.ts.map +1 -0
- package/dist/models/Task.js +22 -0
- package/dist/models/Task.js.map +1 -0
- package/dist/models/TaskComment.d.ts +11 -0
- package/dist/models/TaskComment.d.ts.map +1 -0
- package/dist/models/TaskComment.js +27 -0
- package/dist/models/TaskComment.js.map +1 -0
- package/dist/models/Ticket.d.ts +13 -0
- package/dist/models/Ticket.d.ts.map +1 -0
- package/dist/models/Ticket.js +14 -0
- package/dist/models/Ticket.js.map +1 -0
- package/dist/native/FeeddoNative.d.ts +58 -0
- package/dist/native/FeeddoNative.d.ts.map +1 -0
- package/dist/native/FeeddoNative.js +22 -0
- package/dist/native/FeeddoNative.js.map +1 -0
- package/dist/push/FeeddoPushNotificationApns.d.ts +73 -0
- package/dist/push/FeeddoPushNotificationApns.d.ts.map +1 -0
- package/dist/push/FeeddoPushNotificationApns.js +301 -0
- package/dist/push/FeeddoPushNotificationApns.js.map +1 -0
- package/dist/services/ApiService.d.ts +64 -0
- package/dist/services/ApiService.d.ts.map +1 -0
- package/dist/services/ApiService.js +406 -0
- package/dist/services/ApiService.js.map +1 -0
- package/dist/services/ConversationService.d.ts +45 -0
- package/dist/services/ConversationService.d.ts.map +1 -0
- package/dist/services/ConversationService.js +259 -0
- package/dist/services/ConversationService.js.map +1 -0
- package/dist/services/WebSocketService.d.ts +26 -0
- package/dist/services/WebSocketService.d.ts.map +1 -0
- package/dist/services/WebSocketService.js +157 -0
- package/dist/services/WebSocketService.js.map +1 -0
- package/dist/theme/FeeddoTheme.d.ts +31 -0
- package/dist/theme/FeeddoTheme.d.ts.map +1 -0
- package/dist/theme/FeeddoTheme.js +60 -0
- package/dist/theme/FeeddoTheme.js.map +1 -0
- package/dist/ui/FeeddoFeedbackCard.d.ts +15 -0
- package/dist/ui/FeeddoFeedbackCard.d.ts.map +1 -0
- package/dist/ui/FeeddoFeedbackCard.js +188 -0
- package/dist/ui/FeeddoFeedbackCard.js.map +1 -0
- package/dist/ui/FeeddoModal.d.ts +20 -0
- package/dist/ui/FeeddoModal.d.ts.map +1 -0
- package/dist/ui/FeeddoModal.js +180 -0
- package/dist/ui/FeeddoModal.js.map +1 -0
- package/dist/ui/components/AttachmentPreview.d.ts +10 -0
- package/dist/ui/components/AttachmentPreview.d.ts.map +1 -0
- package/dist/ui/components/AttachmentPreview.js +143 -0
- package/dist/ui/components/AttachmentPreview.js.map +1 -0
- package/dist/ui/components/ChatInputArea.d.ts +16 -0
- package/dist/ui/components/ChatInputArea.d.ts.map +1 -0
- package/dist/ui/components/ChatInputArea.js +85 -0
- package/dist/ui/components/ChatInputArea.js.map +1 -0
- package/dist/ui/components/FeeddoIcon.d.ts +10 -0
- package/dist/ui/components/FeeddoIcon.d.ts.map +1 -0
- package/dist/ui/components/FeeddoIcon.js +690 -0
- package/dist/ui/components/FeeddoIcon.js.map +1 -0
- package/dist/ui/components/FeeddoNotificationBadge.d.ts +14 -0
- package/dist/ui/components/FeeddoNotificationBadge.d.ts.map +1 -0
- package/dist/ui/components/FeeddoNotificationBadge.js +171 -0
- package/dist/ui/components/FeeddoNotificationBadge.js.map +1 -0
- package/dist/ui/components/MessageBubble.d.ts +13 -0
- package/dist/ui/components/MessageBubble.d.ts.map +1 -0
- package/dist/ui/components/MessageBubble.js +163 -0
- package/dist/ui/components/MessageBubble.js.map +1 -0
- package/dist/ui/components/NotificationsSheet.d.ts +10 -0
- package/dist/ui/components/NotificationsSheet.d.ts.map +1 -0
- package/dist/ui/components/NotificationsSheet.js +252 -0
- package/dist/ui/components/NotificationsSheet.js.map +1 -0
- package/dist/ui/components/RatingWidget.d.ts +11 -0
- package/dist/ui/components/RatingWidget.d.ts.map +1 -0
- package/dist/ui/components/RatingWidget.js +34 -0
- package/dist/ui/components/RatingWidget.js.map +1 -0
- package/dist/ui/components/TaskCard.d.ts +12 -0
- package/dist/ui/components/TaskCard.d.ts.map +1 -0
- package/dist/ui/components/TaskCard.js +210 -0
- package/dist/ui/components/TaskCard.js.map +1 -0
- package/dist/ui/components/TaskDetailsSheet.d.ts +15 -0
- package/dist/ui/components/TaskDetailsSheet.d.ts.map +1 -0
- package/dist/ui/components/TaskDetailsSheet.js +577 -0
- package/dist/ui/components/TaskDetailsSheet.js.map +1 -0
- package/dist/ui/components/TicketCard.d.ts +11 -0
- package/dist/ui/components/TicketCard.d.ts.map +1 -0
- package/dist/ui/components/TicketCard.js +100 -0
- package/dist/ui/components/TicketCard.js.map +1 -0
- package/dist/ui/components/TicketDetailsSheet.d.ts +14 -0
- package/dist/ui/components/TicketDetailsSheet.d.ts.map +1 -0
- package/dist/ui/components/TicketDetailsSheet.js +254 -0
- package/dist/ui/components/TicketDetailsSheet.js.map +1 -0
- package/dist/ui/components/TypingIndicator.d.ts +10 -0
- package/dist/ui/components/TypingIndicator.d.ts.map +1 -0
- package/dist/ui/components/TypingIndicator.js +77 -0
- package/dist/ui/components/TypingIndicator.js.map +1 -0
- package/dist/ui/screens/FeeddoChatScreen.d.ts +13 -0
- package/dist/ui/screens/FeeddoChatScreen.d.ts.map +1 -0
- package/dist/ui/screens/FeeddoChatScreen.js +681 -0
- package/dist/ui/screens/FeeddoChatScreen.js.map +1 -0
- package/dist/ui/screens/FeeddoHomeScreen.d.ts +15 -0
- package/dist/ui/screens/FeeddoHomeScreen.d.ts.map +1 -0
- package/dist/ui/screens/FeeddoHomeScreen.js +653 -0
- package/dist/ui/screens/FeeddoHomeScreen.js.map +1 -0
- package/dist/ui/screens/FeeddoMessagesScreen.d.ts +12 -0
- package/dist/ui/screens/FeeddoMessagesScreen.d.ts.map +1 -0
- package/dist/ui/screens/FeeddoMessagesScreen.js +326 -0
- package/dist/ui/screens/FeeddoMessagesScreen.js.map +1 -0
- package/dist/ui/screens/FeeddoTasksScreen.d.ts +13 -0
- package/dist/ui/screens/FeeddoTasksScreen.d.ts.map +1 -0
- package/dist/ui/screens/FeeddoTasksScreen.js +517 -0
- package/dist/ui/screens/FeeddoTasksScreen.js.map +1 -0
- package/dist/ui/screens/FeeddoTicketsScreen.d.ts +10 -0
- package/dist/ui/screens/FeeddoTicketsScreen.d.ts.map +1 -0
- package/dist/ui/screens/FeeddoTicketsScreen.js +112 -0
- package/dist/ui/screens/FeeddoTicketsScreen.js.map +1 -0
- package/dist/utils/DeviceInfoHelper.d.ts +29 -0
- package/dist/utils/DeviceInfoHelper.d.ts.map +1 -0
- package/dist/utils/DeviceInfoHelper.js +190 -0
- package/dist/utils/DeviceInfoHelper.js.map +1 -0
- package/dist/utils/MediaHelper.d.ts +20 -0
- package/dist/utils/MediaHelper.d.ts.map +1 -0
- package/dist/utils/MediaHelper.js +92 -0
- package/dist/utils/MediaHelper.js.map +1 -0
- package/dist/utils/NotificationSupport.d.ts +22 -0
- package/dist/utils/NotificationSupport.d.ts.map +1 -0
- package/dist/utils/NotificationSupport.js +211 -0
- package/dist/utils/NotificationSupport.js.map +1 -0
- package/dist/utils/StorageHelper.d.ts +65 -0
- package/dist/utils/StorageHelper.d.ts.map +1 -0
- package/dist/utils/StorageHelper.js +273 -0
- package/dist/utils/StorageHelper.js.map +1 -0
- package/feeddo-react-native.podspec +26 -0
- package/ios/FeeddoReactNativeModule.h +8 -0
- package/ios/FeeddoReactNativeModule.m +831 -0
- package/package.json +56 -4
- package/src/Feeddo.ts +247 -0
- package/src/FeeddoClient.ts +895 -0
- package/src/FeeddoProvider.tsx +139 -0
- package/src/config/FeeddoConfig.ts +9 -0
- package/src/index.ts +67 -0
- package/src/models/Conversation.ts +50 -0
- package/src/models/EndUser.ts +65 -0
- package/src/models/FeeddoNotification.ts +29 -0
- package/src/models/HomeData.ts +33 -0
- package/src/models/Message.ts +36 -0
- package/src/models/PushProvider.ts +15 -0
- package/src/models/Task.ts +40 -0
- package/src/models/TaskComment.ts +36 -0
- package/src/models/Ticket.ts +25 -0
- package/src/native/FeeddoNative.ts +80 -0
- package/src/push/FeeddoPushNotificationApns.ts +362 -0
- package/src/services/ApiService.ts +456 -0
- package/src/services/ConversationService.ts +305 -0
- package/src/services/WebSocketService.ts +185 -0
- package/src/theme/FeeddoTheme.ts +85 -0
- package/src/ui/FeeddoFeedbackCard.tsx +245 -0
- package/src/ui/FeeddoModal.tsx +309 -0
- package/src/ui/components/AttachmentPreview.tsx +192 -0
- package/src/ui/components/ChatInputArea.tsx +154 -0
- package/src/ui/components/FeeddoIcon.tsx +903 -0
- package/src/ui/components/FeeddoNotificationBadge.tsx +234 -0
- package/src/ui/components/MessageBubble.tsx +223 -0
- package/src/ui/components/NotificationsSheet.tsx +324 -0
- package/src/ui/components/RatingWidget.tsx +64 -0
- package/src/ui/components/TaskCard.tsx +259 -0
- package/src/ui/components/TaskDetailsSheet.tsx +747 -0
- package/src/ui/components/TicketCard.tsx +128 -0
- package/src/ui/components/TicketDetailsSheet.tsx +324 -0
- package/src/ui/components/TypingIndicator.tsx +104 -0
- package/src/ui/screens/FeeddoChatScreen.tsx +877 -0
- package/src/ui/screens/FeeddoHomeScreen.tsx +824 -0
- package/src/ui/screens/FeeddoMessagesScreen.tsx +414 -0
- package/src/ui/screens/FeeddoTasksScreen.tsx +671 -0
- package/src/ui/screens/FeeddoTicketsScreen.tsx +164 -0
- package/src/utils/DeviceInfoHelper.ts +209 -0
- package/src/utils/MediaHelper.ts +105 -0
- package/src/utils/NotificationSupport.ts +233 -0
- package/src/utils/StorageHelper.ts +305 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, Text, StyleSheet, TouchableOpacity } from 'react-native';
|
|
3
|
+
import { Ticket } from '../../models/Ticket';
|
|
4
|
+
import { FeeddoTheme } from '../../theme/FeeddoTheme';
|
|
5
|
+
import { FeeddoIcon } from './FeeddoIcon';
|
|
6
|
+
|
|
7
|
+
interface TicketCardProps {
|
|
8
|
+
ticket: Ticket;
|
|
9
|
+
onTap?: () => void;
|
|
10
|
+
theme: FeeddoTheme;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const TicketCard: React.FC<TicketCardProps> = ({
|
|
14
|
+
ticket,
|
|
15
|
+
onTap,
|
|
16
|
+
theme,
|
|
17
|
+
}) => {
|
|
18
|
+
return (
|
|
19
|
+
<TouchableOpacity
|
|
20
|
+
activeOpacity={0.8}
|
|
21
|
+
onPress={onTap}
|
|
22
|
+
style={[
|
|
23
|
+
styles.cardContainer,
|
|
24
|
+
{
|
|
25
|
+
backgroundColor: theme.colors.cardBackground,
|
|
26
|
+
borderColor: theme.colors.border,
|
|
27
|
+
},
|
|
28
|
+
]}
|
|
29
|
+
>
|
|
30
|
+
{/* Top row */}
|
|
31
|
+
<View style={styles.topRow}>
|
|
32
|
+
<View style={styles.ticketLabelRow}>
|
|
33
|
+
<FeeddoIcon name="ticket" size={15} color="#3B82F6" />
|
|
34
|
+
<Text style={[styles.ticketLabel, { color: theme.colors.textSecondary }]}>
|
|
35
|
+
TICKET
|
|
36
|
+
</Text>
|
|
37
|
+
</View>
|
|
38
|
+
|
|
39
|
+
<View
|
|
40
|
+
style={[
|
|
41
|
+
styles.statusPill,
|
|
42
|
+
{
|
|
43
|
+
backgroundColor: ticket.isResolved
|
|
44
|
+
? 'rgba(34, 197, 94, 0.12)'
|
|
45
|
+
: 'rgba(245, 158, 11, 0.12)',
|
|
46
|
+
borderColor: ticket.isResolved
|
|
47
|
+
? 'rgba(34, 197, 94, 0.25)'
|
|
48
|
+
: 'rgba(245, 158, 11, 0.25)',
|
|
49
|
+
},
|
|
50
|
+
]}
|
|
51
|
+
>
|
|
52
|
+
<Text
|
|
53
|
+
style={[
|
|
54
|
+
styles.statusText,
|
|
55
|
+
{ color: ticket.isResolved ? theme.colors.success : '#F59E0B' },
|
|
56
|
+
]}
|
|
57
|
+
>
|
|
58
|
+
{ticket.isResolved ? 'RESOLVED' : 'OPEN'}
|
|
59
|
+
</Text>
|
|
60
|
+
</View>
|
|
61
|
+
</View>
|
|
62
|
+
|
|
63
|
+
{/* Title */}
|
|
64
|
+
<Text style={[styles.title, { color: theme.colors.cardText }]} numberOfLines={1}>
|
|
65
|
+
{ticket.title}
|
|
66
|
+
</Text>
|
|
67
|
+
|
|
68
|
+
{/* Description */}
|
|
69
|
+
{Boolean(ticket.description) && (
|
|
70
|
+
<Text
|
|
71
|
+
style={[styles.description, { color: theme.colors.textSecondary }]}
|
|
72
|
+
numberOfLines={2}
|
|
73
|
+
>
|
|
74
|
+
{ticket.description}
|
|
75
|
+
</Text>
|
|
76
|
+
)}
|
|
77
|
+
</TouchableOpacity>
|
|
78
|
+
);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const styles = StyleSheet.create({
|
|
82
|
+
cardContainer: {
|
|
83
|
+
borderRadius: 12,
|
|
84
|
+
borderWidth: 1,
|
|
85
|
+
padding: 12,
|
|
86
|
+
marginTop: 8,
|
|
87
|
+
shadowColor: '#000',
|
|
88
|
+
shadowOffset: { width: 0, height: 2 },
|
|
89
|
+
shadowOpacity: 0.04,
|
|
90
|
+
shadowRadius: 4,
|
|
91
|
+
elevation: 1,
|
|
92
|
+
},
|
|
93
|
+
topRow: {
|
|
94
|
+
flexDirection: 'row',
|
|
95
|
+
alignItems: 'center',
|
|
96
|
+
justifyContent: 'space-between',
|
|
97
|
+
},
|
|
98
|
+
ticketLabelRow: {
|
|
99
|
+
flexDirection: 'row',
|
|
100
|
+
alignItems: 'center',
|
|
101
|
+
},
|
|
102
|
+
ticketLabel: {
|
|
103
|
+
fontSize: 10,
|
|
104
|
+
fontWeight: '700',
|
|
105
|
+
marginLeft: 6,
|
|
106
|
+
letterSpacing: 0.5,
|
|
107
|
+
},
|
|
108
|
+
statusPill: {
|
|
109
|
+
paddingHorizontal: 8,
|
|
110
|
+
paddingVertical: 2,
|
|
111
|
+
borderRadius: 4,
|
|
112
|
+
borderWidth: 1,
|
|
113
|
+
},
|
|
114
|
+
statusText: {
|
|
115
|
+
fontSize: 10,
|
|
116
|
+
fontWeight: '600',
|
|
117
|
+
},
|
|
118
|
+
title: {
|
|
119
|
+
fontSize: 14,
|
|
120
|
+
fontWeight: '700',
|
|
121
|
+
marginTop: 8,
|
|
122
|
+
},
|
|
123
|
+
description: {
|
|
124
|
+
fontSize: 12,
|
|
125
|
+
marginTop: 4,
|
|
126
|
+
lineHeight: 17,
|
|
127
|
+
},
|
|
128
|
+
});
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
Text,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
TouchableOpacity,
|
|
7
|
+
ScrollView,
|
|
8
|
+
ActivityIndicator,
|
|
9
|
+
Modal,
|
|
10
|
+
SafeAreaView,
|
|
11
|
+
} from 'react-native';
|
|
12
|
+
import { Ticket } from '../../models/Ticket';
|
|
13
|
+
import { FeeddoTheme } from '../../theme/FeeddoTheme';
|
|
14
|
+
import { FeeddoIcon } from './FeeddoIcon';
|
|
15
|
+
import { FeeddoInternal } from '../../FeeddoClient';
|
|
16
|
+
|
|
17
|
+
interface TicketDetailsSheetProps {
|
|
18
|
+
visible: boolean;
|
|
19
|
+
ticketId?: string;
|
|
20
|
+
ticket?: Ticket;
|
|
21
|
+
onClose: () => void;
|
|
22
|
+
onOpenConversation?: (conversationId: string) => void;
|
|
23
|
+
theme: FeeddoTheme;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const TicketDetailsSheet: React.FC<TicketDetailsSheetProps> = ({
|
|
27
|
+
visible,
|
|
28
|
+
ticketId,
|
|
29
|
+
ticket: initialTicket,
|
|
30
|
+
onClose,
|
|
31
|
+
onOpenConversation,
|
|
32
|
+
theme,
|
|
33
|
+
}) => {
|
|
34
|
+
const [ticket, setTicket] = useState<Ticket | null>(initialTicket ?? null);
|
|
35
|
+
const [isLoading, setIsLoading] = useState<boolean>(!initialTicket);
|
|
36
|
+
const [error, setError] = useState<string | null>(null);
|
|
37
|
+
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (!visible) return;
|
|
40
|
+
setError(null);
|
|
41
|
+
|
|
42
|
+
if (initialTicket) {
|
|
43
|
+
setTicket(initialTicket);
|
|
44
|
+
setIsLoading(false);
|
|
45
|
+
} else {
|
|
46
|
+
setTicket(null);
|
|
47
|
+
setIsLoading(true);
|
|
48
|
+
if (ticketId) {
|
|
49
|
+
loadTicket(ticketId);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}, [visible, ticketId, initialTicket?.id]);
|
|
53
|
+
|
|
54
|
+
const loadTicket = async (targetId?: string) => {
|
|
55
|
+
const id = targetId || ticketId || initialTicket?.id || ticket?.id;
|
|
56
|
+
if (!id) return;
|
|
57
|
+
|
|
58
|
+
try {
|
|
59
|
+
setIsLoading(true);
|
|
60
|
+
setError(null);
|
|
61
|
+
await FeeddoInternal.instance.ensureUserInitialized();
|
|
62
|
+
const loaded = await FeeddoInternal.instance.getTicket(id);
|
|
63
|
+
setTicket(loaded);
|
|
64
|
+
} catch (e: any) {
|
|
65
|
+
setError(e?.message || 'Failed to load ticket');
|
|
66
|
+
} finally {
|
|
67
|
+
setIsLoading(false);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<Modal
|
|
73
|
+
visible={visible}
|
|
74
|
+
transparent
|
|
75
|
+
animationType="slide"
|
|
76
|
+
onRequestClose={onClose}
|
|
77
|
+
>
|
|
78
|
+
<View style={styles.backdrop}>
|
|
79
|
+
<TouchableOpacity activeOpacity={1} onPress={onClose} style={styles.backdropTouch} />
|
|
80
|
+
|
|
81
|
+
<SafeAreaView
|
|
82
|
+
style={[
|
|
83
|
+
styles.sheetContainer,
|
|
84
|
+
{ backgroundColor: theme.colors.surface },
|
|
85
|
+
]}
|
|
86
|
+
>
|
|
87
|
+
{/* Drag Handle */}
|
|
88
|
+
<View style={styles.handleContainer}>
|
|
89
|
+
<View style={[styles.handleBar, { backgroundColor: theme.colors.divider }]} />
|
|
90
|
+
</View>
|
|
91
|
+
|
|
92
|
+
{isLoading ? (
|
|
93
|
+
<View style={styles.centerContainer}>
|
|
94
|
+
<ActivityIndicator size="large" color={theme.colors.primary} />
|
|
95
|
+
</View>
|
|
96
|
+
) : error && !ticket ? (
|
|
97
|
+
<View style={styles.centerContainer}>
|
|
98
|
+
<Text style={[styles.errorText, { color: theme.colors.error }]}>
|
|
99
|
+
Failed to load ticket
|
|
100
|
+
</Text>
|
|
101
|
+
<TouchableOpacity
|
|
102
|
+
onPress={() => loadTicket(ticketId || initialTicket?.id)}
|
|
103
|
+
style={styles.retryButton}
|
|
104
|
+
>
|
|
105
|
+
<Text style={[styles.retryText, { color: theme.colors.primary }]}>Retry</Text>
|
|
106
|
+
</TouchableOpacity>
|
|
107
|
+
</View>
|
|
108
|
+
) : !ticket ? (
|
|
109
|
+
<View style={styles.centerContainer}>
|
|
110
|
+
<Text style={{ color: theme.colors.textPrimary }}>Ticket not found</Text>
|
|
111
|
+
</View>
|
|
112
|
+
) : (
|
|
113
|
+
<ScrollView style={styles.scrollContent} contentContainerStyle={styles.scrollInner}>
|
|
114
|
+
{/* Header */}
|
|
115
|
+
<View style={styles.headerRow}>
|
|
116
|
+
<View style={styles.ticketBadgeRow}>
|
|
117
|
+
<FeeddoIcon name="ticket" size={20} color="#3B82F6" />
|
|
118
|
+
<Text style={[styles.ticketBadgeText, { color: theme.colors.textSecondary }]}>
|
|
119
|
+
SUPPORT TICKET
|
|
120
|
+
</Text>
|
|
121
|
+
</View>
|
|
122
|
+
|
|
123
|
+
<View
|
|
124
|
+
style={[
|
|
125
|
+
styles.statusPill,
|
|
126
|
+
{
|
|
127
|
+
backgroundColor: ticket.isResolved
|
|
128
|
+
? 'rgba(34, 197, 94, 0.1)'
|
|
129
|
+
: 'rgba(245, 158, 11, 0.1)',
|
|
130
|
+
borderColor: ticket.isResolved
|
|
131
|
+
? 'rgba(34, 197, 94, 0.2)'
|
|
132
|
+
: 'rgba(245, 158, 11, 0.2)',
|
|
133
|
+
},
|
|
134
|
+
]}
|
|
135
|
+
>
|
|
136
|
+
<FeeddoIcon
|
|
137
|
+
name={ticket.isResolved ? 'check_circle' : 'pending'}
|
|
138
|
+
size={14}
|
|
139
|
+
color={ticket.isResolved ? theme.colors.success : '#F59E0B'}
|
|
140
|
+
/>
|
|
141
|
+
<Text
|
|
142
|
+
style={[
|
|
143
|
+
styles.statusPillText,
|
|
144
|
+
{ color: ticket.isResolved ? theme.colors.success : '#F59E0B' },
|
|
145
|
+
]}
|
|
146
|
+
>
|
|
147
|
+
{ticket.isResolved ? 'RESOLVED' : 'OPEN'}
|
|
148
|
+
</Text>
|
|
149
|
+
</View>
|
|
150
|
+
</View>
|
|
151
|
+
|
|
152
|
+
{/* Title */}
|
|
153
|
+
<Text style={[styles.title, { color: theme.colors.textPrimary }]}>
|
|
154
|
+
{ticket.title}
|
|
155
|
+
</Text>
|
|
156
|
+
|
|
157
|
+
{/* Description */}
|
|
158
|
+
<Text style={[styles.description, { color: theme.colors.textSecondary }]}>
|
|
159
|
+
{ticket.description}
|
|
160
|
+
</Text>
|
|
161
|
+
|
|
162
|
+
{/* Support team notice banner */}
|
|
163
|
+
{!ticket.isResolved && (
|
|
164
|
+
<View style={styles.infoBanner}>
|
|
165
|
+
<FeeddoIcon name="info" size={20} color="#3B82F6" />
|
|
166
|
+
<Text style={[styles.infoBannerText, { color: theme.colors.textPrimary }]}>
|
|
167
|
+
Our support team is working on your ticket and will respond soon.
|
|
168
|
+
</Text>
|
|
169
|
+
</View>
|
|
170
|
+
)}
|
|
171
|
+
|
|
172
|
+
{/* View Conversation button (only for ticket owner, matching Flutter) */}
|
|
173
|
+
{ticket.isOwner && Boolean(ticket.conversationId) && (
|
|
174
|
+
<TouchableOpacity
|
|
175
|
+
activeOpacity={0.8}
|
|
176
|
+
onPress={() => {
|
|
177
|
+
onClose();
|
|
178
|
+
if (ticket.conversationId) {
|
|
179
|
+
onOpenConversation?.(ticket.conversationId);
|
|
180
|
+
}
|
|
181
|
+
}}
|
|
182
|
+
style={[
|
|
183
|
+
styles.viewConvButton,
|
|
184
|
+
{ backgroundColor: theme.colors.primary },
|
|
185
|
+
]}
|
|
186
|
+
>
|
|
187
|
+
<FeeddoIcon
|
|
188
|
+
name="chat"
|
|
189
|
+
size={18}
|
|
190
|
+
color={theme.isDark ? '#000000' : '#FFFFFF'}
|
|
191
|
+
/>
|
|
192
|
+
<Text
|
|
193
|
+
style={[
|
|
194
|
+
styles.viewConvText,
|
|
195
|
+
{ color: theme.isDark ? '#000000' : '#FFFFFF' },
|
|
196
|
+
]}
|
|
197
|
+
>
|
|
198
|
+
View Conversation
|
|
199
|
+
</Text>
|
|
200
|
+
</TouchableOpacity>
|
|
201
|
+
)}
|
|
202
|
+
</ScrollView>
|
|
203
|
+
)}
|
|
204
|
+
</SafeAreaView>
|
|
205
|
+
</View>
|
|
206
|
+
</Modal>
|
|
207
|
+
);
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
const styles = StyleSheet.create({
|
|
211
|
+
backdrop: {
|
|
212
|
+
flex: 1,
|
|
213
|
+
backgroundColor: 'rgba(0,0,0,0.5)',
|
|
214
|
+
justifyContent: 'flex-end',
|
|
215
|
+
},
|
|
216
|
+
backdropTouch: {
|
|
217
|
+
flex: 1,
|
|
218
|
+
},
|
|
219
|
+
sheetContainer: {
|
|
220
|
+
height: '85%',
|
|
221
|
+
borderTopLeftRadius: 20,
|
|
222
|
+
borderTopRightRadius: 20,
|
|
223
|
+
overflow: 'hidden',
|
|
224
|
+
},
|
|
225
|
+
handleContainer: {
|
|
226
|
+
alignItems: 'center',
|
|
227
|
+
paddingVertical: 12,
|
|
228
|
+
},
|
|
229
|
+
handleBar: {
|
|
230
|
+
width: 40,
|
|
231
|
+
height: 4,
|
|
232
|
+
borderRadius: 2,
|
|
233
|
+
},
|
|
234
|
+
centerContainer: {
|
|
235
|
+
flex: 1,
|
|
236
|
+
alignItems: 'center',
|
|
237
|
+
justifyContent: 'center',
|
|
238
|
+
padding: 20,
|
|
239
|
+
},
|
|
240
|
+
errorText: {
|
|
241
|
+
fontSize: 15,
|
|
242
|
+
fontWeight: '600',
|
|
243
|
+
},
|
|
244
|
+
retryButton: {
|
|
245
|
+
marginTop: 10,
|
|
246
|
+
paddingHorizontal: 16,
|
|
247
|
+
paddingVertical: 8,
|
|
248
|
+
},
|
|
249
|
+
retryText: {
|
|
250
|
+
fontSize: 15,
|
|
251
|
+
fontWeight: '600',
|
|
252
|
+
},
|
|
253
|
+
scrollContent: {
|
|
254
|
+
flex: 1,
|
|
255
|
+
},
|
|
256
|
+
scrollInner: {
|
|
257
|
+
padding: 20,
|
|
258
|
+
},
|
|
259
|
+
headerRow: {
|
|
260
|
+
flexDirection: 'row',
|
|
261
|
+
alignItems: 'center',
|
|
262
|
+
justifyContent: 'space-between',
|
|
263
|
+
},
|
|
264
|
+
ticketBadgeRow: {
|
|
265
|
+
flexDirection: 'row',
|
|
266
|
+
alignItems: 'center',
|
|
267
|
+
},
|
|
268
|
+
ticketBadgeText: {
|
|
269
|
+
fontSize: 14,
|
|
270
|
+
fontWeight: '700',
|
|
271
|
+
marginLeft: 8,
|
|
272
|
+
},
|
|
273
|
+
statusPill: {
|
|
274
|
+
flexDirection: 'row',
|
|
275
|
+
alignItems: 'center',
|
|
276
|
+
paddingHorizontal: 12,
|
|
277
|
+
paddingVertical: 6,
|
|
278
|
+
borderRadius: 20,
|
|
279
|
+
borderWidth: 1,
|
|
280
|
+
},
|
|
281
|
+
statusPillText: {
|
|
282
|
+
fontSize: 12,
|
|
283
|
+
fontWeight: '600',
|
|
284
|
+
marginLeft: 4,
|
|
285
|
+
},
|
|
286
|
+
title: {
|
|
287
|
+
fontSize: 22,
|
|
288
|
+
fontWeight: '700',
|
|
289
|
+
marginTop: 24,
|
|
290
|
+
lineHeight: 28,
|
|
291
|
+
},
|
|
292
|
+
description: {
|
|
293
|
+
fontSize: 16,
|
|
294
|
+
marginTop: 16,
|
|
295
|
+
lineHeight: 25,
|
|
296
|
+
},
|
|
297
|
+
infoBanner: {
|
|
298
|
+
flexDirection: 'row',
|
|
299
|
+
alignItems: 'center',
|
|
300
|
+
backgroundColor: 'rgba(59, 130, 246, 0.1)',
|
|
301
|
+
padding: 16,
|
|
302
|
+
borderRadius: 12,
|
|
303
|
+
marginTop: 24,
|
|
304
|
+
},
|
|
305
|
+
infoBannerText: {
|
|
306
|
+
fontSize: 14,
|
|
307
|
+
marginLeft: 12,
|
|
308
|
+
flex: 1,
|
|
309
|
+
lineHeight: 20,
|
|
310
|
+
},
|
|
311
|
+
viewConvButton: {
|
|
312
|
+
flexDirection: 'row',
|
|
313
|
+
alignItems: 'center',
|
|
314
|
+
justifyContent: 'center',
|
|
315
|
+
paddingVertical: 12,
|
|
316
|
+
borderRadius: 8,
|
|
317
|
+
marginTop: 16,
|
|
318
|
+
},
|
|
319
|
+
viewConvText: {
|
|
320
|
+
fontSize: 14,
|
|
321
|
+
fontWeight: '600',
|
|
322
|
+
marginLeft: 8,
|
|
323
|
+
},
|
|
324
|
+
});
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from 'react';
|
|
2
|
+
import { View, Animated, StyleSheet } from 'react-native';
|
|
3
|
+
import { FeeddoTheme } from '../../theme/FeeddoTheme';
|
|
4
|
+
|
|
5
|
+
interface TypingIndicatorProps {
|
|
6
|
+
color?: string;
|
|
7
|
+
size?: number;
|
|
8
|
+
theme?: FeeddoTheme;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const TypingIndicator: React.FC<TypingIndicatorProps> = ({
|
|
12
|
+
color,
|
|
13
|
+
size = 6,
|
|
14
|
+
theme,
|
|
15
|
+
}) => {
|
|
16
|
+
const effectiveTheme = theme ?? FeeddoTheme.light();
|
|
17
|
+
const dotColor = color ?? effectiveTheme.colors.textSecondary;
|
|
18
|
+
|
|
19
|
+
const anim1 = useRef(new Animated.Value(0)).current;
|
|
20
|
+
const anim2 = useRef(new Animated.Value(0)).current;
|
|
21
|
+
const anim3 = useRef(new Animated.Value(0)).current;
|
|
22
|
+
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
const createBouncingAnimation = (anim: Animated.Value, delay: number) => {
|
|
25
|
+
return Animated.loop(
|
|
26
|
+
Animated.sequence([
|
|
27
|
+
Animated.delay(delay),
|
|
28
|
+
Animated.timing(anim, {
|
|
29
|
+
toValue: 1,
|
|
30
|
+
duration: 300,
|
|
31
|
+
useNativeDriver: true,
|
|
32
|
+
}),
|
|
33
|
+
Animated.timing(anim, {
|
|
34
|
+
toValue: 0,
|
|
35
|
+
duration: 300,
|
|
36
|
+
useNativeDriver: true,
|
|
37
|
+
}),
|
|
38
|
+
])
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const a1 = createBouncingAnimation(anim1, 0);
|
|
43
|
+
const a2 = createBouncingAnimation(anim2, 200);
|
|
44
|
+
const a3 = createBouncingAnimation(anim3, 400);
|
|
45
|
+
|
|
46
|
+
a1.start();
|
|
47
|
+
a2.start();
|
|
48
|
+
a3.start();
|
|
49
|
+
|
|
50
|
+
return () => {
|
|
51
|
+
a1.stop();
|
|
52
|
+
a2.stop();
|
|
53
|
+
a3.stop();
|
|
54
|
+
};
|
|
55
|
+
}, [anim1, anim2, anim3]);
|
|
56
|
+
|
|
57
|
+
const renderDot = (anim: Animated.Value) => {
|
|
58
|
+
const translateY = anim.interpolate({
|
|
59
|
+
inputRange: [0, 1],
|
|
60
|
+
outputRange: [0, -4],
|
|
61
|
+
});
|
|
62
|
+
const opacity = anim.interpolate({
|
|
63
|
+
inputRange: [0, 1],
|
|
64
|
+
outputRange: [0.4, 1.0],
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<Animated.View
|
|
69
|
+
style={[
|
|
70
|
+
styles.dot,
|
|
71
|
+
{
|
|
72
|
+
width: size,
|
|
73
|
+
height: size,
|
|
74
|
+
borderRadius: size / 2,
|
|
75
|
+
backgroundColor: dotColor,
|
|
76
|
+
opacity,
|
|
77
|
+
transform: [{ translateY }],
|
|
78
|
+
},
|
|
79
|
+
]}
|
|
80
|
+
/>
|
|
81
|
+
);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<View style={styles.container}>
|
|
86
|
+
{renderDot(anim1)}
|
|
87
|
+
{renderDot(anim2)}
|
|
88
|
+
{renderDot(anim3)}
|
|
89
|
+
</View>
|
|
90
|
+
);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const styles = StyleSheet.create({
|
|
94
|
+
container: {
|
|
95
|
+
flexDirection: 'row',
|
|
96
|
+
alignItems: 'center',
|
|
97
|
+
justifyContent: 'center',
|
|
98
|
+
paddingHorizontal: 4,
|
|
99
|
+
paddingVertical: 2,
|
|
100
|
+
},
|
|
101
|
+
dot: {
|
|
102
|
+
marginHorizontal: 2,
|
|
103
|
+
},
|
|
104
|
+
});
|