@messenger-box/platform-mobile 0.0.1-alpha.362 → 0.0.1-alpha.365

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 (29) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/lib/index.js +2281 -553
  3. package/lib/index.js.map +1 -1
  4. package/lib/screens/inbox/DialogThreadMessages.d.ts +7 -0
  5. package/lib/screens/inbox/DialogThreads.d.ts +6 -0
  6. package/lib/screens/inbox/components/SupportServiceDialogsListItem.d.ts +21 -0
  7. package/lib/screens/inbox/components/ThreadsViewItem.d.ts +18 -0
  8. package/lib/screens/inbox/config/config.d.ts +2 -0
  9. package/lib/screens/inbox/containers/Dialogs.d.ts +1 -0
  10. package/lib/screens/inbox/containers/SupportServiceDialogs.d.ts +6 -0
  11. package/lib/screens/inbox/containers/ThreadConversationView.d.ts +11 -0
  12. package/lib/screens/inbox/containers/ThreadsView.d.ts +8 -0
  13. package/lib/screens/index.d.ts +2 -0
  14. package/package.json +4 -4
  15. package/src/navigation/InboxNavigation.tsx +63 -0
  16. package/src/screens/inbox/DialogThreadMessages.tsx +90 -0
  17. package/src/screens/inbox/DialogThreads.tsx +107 -0
  18. package/src/screens/inbox/Inbox.tsx +5 -3
  19. package/src/screens/inbox/components/DialogsListItem.tsx +7 -3
  20. package/src/screens/inbox/components/SlackMessageContainer/SlackBubble.tsx +5 -5
  21. package/src/screens/inbox/components/SupportServiceDialogsListItem.tsx +295 -0
  22. package/src/screens/inbox/components/ThreadsViewItem.tsx +236 -0
  23. package/src/screens/inbox/config/config.ts +4 -0
  24. package/src/screens/inbox/containers/ConversationView.tsx +440 -156
  25. package/src/screens/inbox/containers/Dialogs.tsx +2 -1
  26. package/src/screens/inbox/containers/SupportServiceDialogs.tsx +119 -0
  27. package/src/screens/inbox/containers/ThreadConversationView.tsx +764 -0
  28. package/src/screens/inbox/containers/ThreadsView.tsx +205 -0
  29. package/src/screens/index.ts +3 -1
@@ -13,6 +13,7 @@ import { config } from '../config';
13
13
  export interface InboxProps {
14
14
  channelFilters?: Record<string, unknown>;
15
15
  channelRole?: string;
16
+ supportServices:boolean;
16
17
  }
17
18
 
18
19
  const DialogsComponent = (props: InboxProps) => {
@@ -119,7 +120,7 @@ const DialogsComponent = (props: InboxProps) => {
119
120
  },[])
120
121
 
121
122
  return (
122
- <Box p={2}>
123
+ <Box p={2} pt={props?.supportServices ? 0 : 2}>
123
124
  <FlatList
124
125
  data={channels && channels?.length > 0 ? channels : []}
125
126
  onRefresh={handleRefresh}
@@ -0,0 +1,119 @@
1
+ import React, { useCallback, useMemo, useEffect, useState } from 'react';
2
+ import { FlatList, Box, Heading, Input, Text, Icon, Center, Spinner } from 'native-base';
3
+ import { Ionicons } from '@expo/vector-icons';
4
+ import { useSelector, useDispatch } from 'react-redux';
5
+ import { useNavigation, useRoute, useIsFocused, useFocusEffect } from '@react-navigation/native';
6
+
7
+ import { SupportServiceDialogsListItem } from '../components/SupportServiceDialogsListItem';
8
+ import { useSupportServiceChannelsQuery } from '@messenger-box/platform-client';
9
+ import { userSelector } from '@adminide-stack/user-auth0-client';
10
+ import { CHANGE_SETTINGS_ACTION } from '@admin-layout/client';
11
+ import { config } from '../config';
12
+
13
+ export interface SupportServiceInboxProps {
14
+ channelFilters?: Record<string, unknown>;
15
+ channelRole?: string;
16
+ }
17
+
18
+ const SupportServiceDialogsComponent = (props: SupportServiceInboxProps) => {
19
+ const { channelFilters, channelRole } = props;
20
+ const { params } = useRoute<any>();
21
+ const auth = useSelector(userSelector);
22
+ const dispatch = useDispatch();
23
+ const navigation = useNavigation<any>();
24
+ const isFocused = useIsFocused();
25
+ const [refreshing, setRefresh] = useState<boolean>(false);
26
+ // const [userDirectChannel, setUserDirectChannel] = useState<any>([]);
27
+
28
+ const {
29
+ data: serviceChannels,
30
+ loading: serviceChannelsLoading,
31
+ refetch: getServiceChannelsRefetch,
32
+ } = useSupportServiceChannelsQuery({
33
+ variables: {
34
+ criteria: { type: 'SERVICE' },
35
+ },
36
+ onCompleted: (data: any) => {
37
+ //setRefresh(false);
38
+ },
39
+ });
40
+
41
+ useFocusEffect(
42
+ React.useCallback(() => {
43
+ // Do something when the screen is focused
44
+ setRefresh(false);
45
+ getServiceChannelsRefetch({ criteria: { type: 'SERVICE' } });
46
+
47
+ return () => {
48
+ // Do something when the screen is unfocused
49
+ // Useful for cleanup functions
50
+ };
51
+ }, []),
52
+ );
53
+
54
+ const channels = React.useMemo(() => {
55
+ if (!serviceChannels?.supportServiceChannels?.length) return null;
56
+ let uChannels: any =
57
+ serviceChannels?.supportServiceChannels?.filter((c: any) =>
58
+ c.members.some((u: any) => u.user.__typename == 'UserAccount'),
59
+ ) ?? [];
60
+ return uChannels || [];
61
+ }, [serviceChannels]);
62
+
63
+ const handleSelectChannel = useCallback((id: any, title: any, postParentId: any) => {
64
+ if (params?.channelId) {
65
+ navigation.navigate(
66
+ params?.postParentId || params?.postParentId == 0 ? config.THREAD_MESSEGE_PATH : (config.THREADS_PATH as any),
67
+ {
68
+ channelId: params?.channelId,
69
+ role:params?.role,
70
+ title: params?.title ?? null,
71
+ postParentId: params?.postParentId,
72
+ hideTabBar: true,
73
+ },
74
+ );
75
+ } else {
76
+ navigation.navigate(
77
+ postParentId || postParentId == 0 ? config.THREAD_MESSEGE_PATH : (config.THREADS_PATH as any),
78
+ {
79
+ channelId: id,
80
+ role:channelRole,
81
+ title: title,
82
+ postParentId: postParentId,
83
+ hideTabBar: true,
84
+ },
85
+ );
86
+ }
87
+ }, []);
88
+
89
+ const handleRefresh = useCallback(() => {
90
+ //if(userChannels?.channelsByUser?.length != channels?.length)setRefresh(true);
91
+ setRefresh(true)
92
+ getServiceChannelsRefetch({ criteria: { type: 'SERVICE' } })?.then((res:any)=>setRefresh(false));
93
+ }, []);
94
+
95
+ return (
96
+ <Box p={2} pb={0}>
97
+ <FlatList
98
+ data={channels && channels?.length > 0 ? channels : []}
99
+ onRefresh={handleRefresh}
100
+ refreshing={serviceChannelsLoading}
101
+ contentContainerStyle={{}}
102
+ ItemSeparatorComponent={() => <Box height="0.5" backgroundColor="gray.200" />}
103
+ renderItem={({ item: channel }) => (
104
+ <SupportServiceDialogsListItem
105
+ onOpen={handleSelectChannel}
106
+ currentUser={auth}
107
+ channel={channel}
108
+ refreshing={refreshing}
109
+ selectedChannelId={params?.channelId}
110
+ role={channelRole}
111
+ />
112
+ )}
113
+ keyExtractor={(item, index) => 'support-service-key' + index}
114
+ />
115
+ </Box>
116
+ );
117
+ };
118
+
119
+ export const SupportServiceDialogs = React.memo(SupportServiceDialogsComponent);