@messenger-box/platform-mobile 0.0.1-alpha.362 → 0.0.1-alpha.363
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/CHANGELOG.md +4 -0
- package/lib/index.js +2085 -527
- package/lib/index.js.map +1 -1
- package/lib/screens/inbox/DialogThreadMessages.d.ts +7 -0
- package/lib/screens/inbox/DialogThreads.d.ts +6 -0
- package/lib/screens/inbox/components/SupportServiceDialogsListItem.d.ts +21 -0
- package/lib/screens/inbox/components/ThreadsViewItem.d.ts +18 -0
- package/lib/screens/inbox/config/config.d.ts +2 -0
- package/lib/screens/inbox/containers/Dialogs.d.ts +1 -0
- package/lib/screens/inbox/containers/SupportServiceDialogs.d.ts +6 -0
- package/lib/screens/inbox/containers/ThreadConversationView.d.ts +11 -0
- package/lib/screens/inbox/containers/ThreadsView.d.ts +8 -0
- package/lib/screens/index.d.ts +2 -0
- package/package.json +4 -4
- package/src/navigation/InboxNavigation.tsx +63 -0
- package/src/screens/inbox/DialogThreadMessages.tsx +28 -0
- package/src/screens/inbox/DialogThreads.tsx +107 -0
- package/src/screens/inbox/Inbox.tsx +5 -3
- package/src/screens/inbox/components/DialogsListItem.tsx +7 -3
- package/src/screens/inbox/components/SupportServiceDialogsListItem.tsx +295 -0
- package/src/screens/inbox/components/ThreadsViewItem.tsx +229 -0
- package/src/screens/inbox/config/config.ts +4 -0
- package/src/screens/inbox/containers/ConversationView.tsx +288 -95
- package/src/screens/inbox/containers/Dialogs.tsx +2 -1
- package/src/screens/inbox/containers/SupportServiceDialogs.tsx +119 -0
- package/src/screens/inbox/containers/ThreadConversationView.tsx +700 -0
- package/src/screens/inbox/containers/ThreadsView.tsx +186 -0
- package/src/screens/index.ts +3 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IChannel, IUserAccount } from '@messenger-box/platform-client';
|
|
3
|
+
export interface IDialogListChannel extends IChannel {
|
|
4
|
+
users: IUserAccount[];
|
|
5
|
+
}
|
|
6
|
+
export interface IDialogListItemProps {
|
|
7
|
+
currentUser?: any;
|
|
8
|
+
users?: any;
|
|
9
|
+
selectedChannelId?: any;
|
|
10
|
+
channel?: any;
|
|
11
|
+
onOpen: (id: any, title: any, postParentId?: any) => void;
|
|
12
|
+
refreshing: boolean;
|
|
13
|
+
role: any;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* TODO:
|
|
17
|
+
* - Get Reservation info: reservation date, status
|
|
18
|
+
* - Add ability to get property information: name, logo
|
|
19
|
+
*/
|
|
20
|
+
export declare const SupportServiceDialogsListItemComponent: React.FC<IDialogListItemProps>;
|
|
21
|
+
export declare const SupportServiceDialogsListItem: React.NamedExoticComponent<IDialogListItemProps>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IChannel, IUserAccount } from '@messenger-box/platform-client';
|
|
3
|
+
export interface IDialogListChannel extends IChannel {
|
|
4
|
+
users: IUserAccount[];
|
|
5
|
+
}
|
|
6
|
+
export interface IDialogListItemProps {
|
|
7
|
+
currentUser?: any;
|
|
8
|
+
users?: any;
|
|
9
|
+
thread?: any;
|
|
10
|
+
onOpen: (id: any, title: any, postParentId?: any) => void;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* TODO:
|
|
14
|
+
* - Get Reservation info: reservation date, status
|
|
15
|
+
* - Add ability to get property information: name, logo
|
|
16
|
+
*/
|
|
17
|
+
export declare const ThreadViewItemComponent: React.FC<IDialogListItemProps>;
|
|
18
|
+
export declare const ThreadViewItem: React.NamedExoticComponent<IDialogListItemProps>;
|
|
@@ -2,6 +2,8 @@ export declare const config: Readonly<{
|
|
|
2
2
|
MESSAGES_PER_PAGE: number;
|
|
3
3
|
FILES_PER_MESSAGE: number;
|
|
4
4
|
INBOX_MESSEGE_PATH: string;
|
|
5
|
+
THREAD_MESSEGE_PATH: string;
|
|
6
|
+
THREADS_PATH: string;
|
|
5
7
|
CALL_TO_ACTION_PATH: string;
|
|
6
8
|
CALL_TO_ACTION_BOX_BGCOLOR: string;
|
|
7
9
|
CALL_TO_ACTION_BUTTON_BORDERCOLOR: string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface AlertMessageAttachmentsInterface {
|
|
3
|
+
title: string;
|
|
4
|
+
isTitleHtml: boolean;
|
|
5
|
+
icon: string;
|
|
6
|
+
callToAction: {
|
|
7
|
+
title: string;
|
|
8
|
+
link: string;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export declare const ThreadConversationView: React.MemoExoticComponent<({ channelId, postParentId, isPostParentIdThread, role }: any) => JSX.Element>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface ThreadsViewProps {
|
|
3
|
+
channelId?: string;
|
|
4
|
+
role?: string;
|
|
5
|
+
channelsDetail?: any;
|
|
6
|
+
refetchChannelDetail: (id: any) => Promise<any>;
|
|
7
|
+
}
|
|
8
|
+
export declare const ThreadsView: React.MemoExoticComponent<({ channelId, role, channelsDetail, refetchChannelDetail }: ThreadsViewProps) => JSX.Element>;
|
package/lib/screens/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@messenger-box/platform-mobile",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.363",
|
|
4
4
|
"description": "Sample core for higher packages to depend on",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "CDMBase LLC",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"watch": "yarn build:lib:watch"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@messenger-box/core": "0.0.1-alpha.
|
|
23
|
-
"@messenger-box/platform-client": "0.0.1-alpha.
|
|
22
|
+
"@messenger-box/core": "0.0.1-alpha.363",
|
|
23
|
+
"@messenger-box/platform-client": "0.0.1-alpha.363",
|
|
24
24
|
"base-64": "1.0.0",
|
|
25
25
|
"react-native-gifted-chat": "1.0.4"
|
|
26
26
|
},
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"typescript": {
|
|
41
41
|
"definition": "lib/index.d.ts"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "c119a5af8a4f0f6daa0080e62a1e9d6c7eb22ab8"
|
|
44
44
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Feature } from '@common-stack/client-react';
|
|
3
3
|
import { DialogMessages } from '../screens/inbox/DialogMessages';
|
|
4
|
+
import { DialogThreads } from '../screens/inbox/DialogThreads';
|
|
5
|
+
import { DialogThreadMessages } from '../screens/inbox/DialogThreadMessages';
|
|
4
6
|
import { IconButton, Icon } from 'native-base';
|
|
5
7
|
import { MaterialIcons } from '@expo/vector-icons';
|
|
6
8
|
|
|
@@ -28,6 +30,67 @@ const inboxConfig = {
|
|
|
28
30
|
},
|
|
29
31
|
},
|
|
30
32
|
},
|
|
33
|
+
['//thread']: {
|
|
34
|
+
exact: true,
|
|
35
|
+
name: 'Thread',
|
|
36
|
+
props: {
|
|
37
|
+
initialParams: { channelId: null, postParentId: null,role:null },
|
|
38
|
+
component: (props: any) => (
|
|
39
|
+
<DialogThreads
|
|
40
|
+
{...props}
|
|
41
|
+
channelId={props?.route?.params?.channelId}
|
|
42
|
+
postParentId={props?.route?.params?.postParentId}
|
|
43
|
+
role={props?.route?.params?.role}
|
|
44
|
+
/>
|
|
45
|
+
),
|
|
46
|
+
options: ({ navigation }: any) => {
|
|
47
|
+
return {
|
|
48
|
+
headerShown: true,
|
|
49
|
+
title: 'Thread',
|
|
50
|
+
headerBackTitleVisible: false,
|
|
51
|
+
gestureEnabled: false,
|
|
52
|
+
swipeEnabled: false,
|
|
53
|
+
headerLeft: (props: any) => (
|
|
54
|
+
<IconButton
|
|
55
|
+
onPress={() => navigation.goBack()}
|
|
56
|
+
icon={<Icon size={'lg'} as={MaterialIcons} name="arrow-back-ios" color={'black'} />}
|
|
57
|
+
/>
|
|
58
|
+
),
|
|
59
|
+
};
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
['//threadmessage']: {
|
|
64
|
+
exact: true,
|
|
65
|
+
name: 'ThreadMessage',
|
|
66
|
+
props: {
|
|
67
|
+
initialParams: { channelId: null, postParentId: null, isPostParentIdThread: null,role:null },
|
|
68
|
+
component: (props: any) => (
|
|
69
|
+
<DialogThreadMessages
|
|
70
|
+
{...props}
|
|
71
|
+
channelId={props?.route?.params?.channelId}
|
|
72
|
+
postParentId={props?.route?.params?.postParentId}
|
|
73
|
+
isPostParentIdThread={props?.route?.params?.isPostParentIdThread}
|
|
74
|
+
role={props?.route?.params?.role}
|
|
75
|
+
/>
|
|
76
|
+
),
|
|
77
|
+
options: ({ navigation }: any) => {
|
|
78
|
+
return {
|
|
79
|
+
headerShown: true,
|
|
80
|
+
title: 'Inbox',
|
|
81
|
+
headerBackTitleVisible: false,
|
|
82
|
+
gestureEnabled: false,
|
|
83
|
+
swipeEnabled: false,
|
|
84
|
+
headerLeft: (props: any) => (
|
|
85
|
+
<IconButton
|
|
86
|
+
onPress={() => navigation.goBack()}
|
|
87
|
+
icon={<Icon size={'lg'} as={MaterialIcons} name="arrow-back-ios" color={'black'} />}
|
|
88
|
+
/>
|
|
89
|
+
),
|
|
90
|
+
};
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
},
|
|
31
94
|
};
|
|
32
95
|
|
|
33
96
|
export const inboxFeature = new Feature({
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Box, Spinner, Text } from 'native-base';
|
|
3
|
+
import { ThreadConversationView } from './containers/ThreadConversationView';
|
|
4
|
+
import { ThreadsView } from './containers/ThreadsView';
|
|
5
|
+
import { useViewChannelDetailQuery } from '@messenger-box/platform-client';
|
|
6
|
+
import { useFocusEffect } from '@react-navigation/native';
|
|
7
|
+
import { useSelector } from 'react-redux';
|
|
8
|
+
|
|
9
|
+
export function DialogThreadMessages({ channelId, postParentId, isPostParentIdThread ,role}) {
|
|
10
|
+
useFocusEffect(
|
|
11
|
+
React.useCallback(() => {
|
|
12
|
+
// Do something when the screen is focused
|
|
13
|
+
|
|
14
|
+
return () => {};
|
|
15
|
+
}, []),
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<Box bg={'white'} flex={1}>
|
|
20
|
+
<ThreadConversationView
|
|
21
|
+
channelId={channelId}
|
|
22
|
+
postParentId={postParentId}
|
|
23
|
+
isPostParentIdThread={isPostParentIdThread}
|
|
24
|
+
role={role}
|
|
25
|
+
/>
|
|
26
|
+
</Box>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Box, Spinner, Text } from 'native-base';
|
|
3
|
+
import { ThreadConversationView } from './containers/ThreadConversationView';
|
|
4
|
+
import { ThreadsView } from './containers/ThreadsView';
|
|
5
|
+
import { useViewChannelDetailQuery } from '@messenger-box/platform-client';
|
|
6
|
+
import { useFocusEffect } from '@react-navigation/native';
|
|
7
|
+
import { useSelector } from 'react-redux';
|
|
8
|
+
|
|
9
|
+
export function DialogThreads({ channelId, postParentId,role }) {
|
|
10
|
+
const {
|
|
11
|
+
data,
|
|
12
|
+
loading: channelLoading,
|
|
13
|
+
refetch,
|
|
14
|
+
} = useViewChannelDetailQuery({
|
|
15
|
+
variables: {
|
|
16
|
+
id: channelId?.toString(),
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const channelsDetail = React.useMemo(() => {
|
|
21
|
+
if (!data?.viewChannelDetail) return null;
|
|
22
|
+
return data?.viewChannelDetail;
|
|
23
|
+
}, [data]);
|
|
24
|
+
|
|
25
|
+
const refetchChannelDetail = React.useCallback(
|
|
26
|
+
(id: string) => {
|
|
27
|
+
return refetch({ id: id?.toString() });
|
|
28
|
+
},
|
|
29
|
+
[channelId],
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
useFocusEffect(
|
|
33
|
+
React.useCallback(() => {
|
|
34
|
+
// Do something when the screen is focused
|
|
35
|
+
refetchChannelDetail(channelId);
|
|
36
|
+
return () => {};
|
|
37
|
+
}, []),
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
// <Box bg={'white'} flex={1} pt={5}>
|
|
42
|
+
<>
|
|
43
|
+
{channelLoading ? (
|
|
44
|
+
<Spinner />
|
|
45
|
+
) : (
|
|
46
|
+
<>
|
|
47
|
+
<Box
|
|
48
|
+
flex={1}
|
|
49
|
+
_dark={{
|
|
50
|
+
borderColor: 'coolGray.600',
|
|
51
|
+
backgroundColor: 'gray.700',
|
|
52
|
+
}}
|
|
53
|
+
_light={{
|
|
54
|
+
backgroundColor: 'gray.50',
|
|
55
|
+
}}
|
|
56
|
+
>
|
|
57
|
+
<ThreadsView
|
|
58
|
+
channelId={channelId}
|
|
59
|
+
role={role}
|
|
60
|
+
channelsDetail={channelsDetail}
|
|
61
|
+
refetchChannelDetail={refetchChannelDetail}
|
|
62
|
+
/>
|
|
63
|
+
</Box>
|
|
64
|
+
</>
|
|
65
|
+
)}
|
|
66
|
+
</>
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
// return (
|
|
70
|
+
// // <Box bg={'white'} flex={1} pt={5}>
|
|
71
|
+
// <>
|
|
72
|
+
// {channelLoading ? (
|
|
73
|
+
// <Spinner />
|
|
74
|
+
// ) : (
|
|
75
|
+
// <>
|
|
76
|
+
// {postParentId || postParentId == 0 ? (
|
|
77
|
+
// <Box bg={'white'} flex={1}>
|
|
78
|
+
// <ThreadConversationView
|
|
79
|
+
// channelId={channelId}
|
|
80
|
+
// postParentId={postParentId}
|
|
81
|
+
// channelsDetail={channelsDetail}
|
|
82
|
+
// refetchChannelDetail={refetchChannelDetail}
|
|
83
|
+
// />
|
|
84
|
+
// </Box>
|
|
85
|
+
// ) : (
|
|
86
|
+
// <Box
|
|
87
|
+
// flex={1}
|
|
88
|
+
// _dark={{
|
|
89
|
+
// borderColor: 'coolGray.600',
|
|
90
|
+
// backgroundColor: 'gray.700',
|
|
91
|
+
// }}
|
|
92
|
+
// _light={{
|
|
93
|
+
// backgroundColor: 'gray.50',
|
|
94
|
+
// }}
|
|
95
|
+
// >
|
|
96
|
+
// <ThreadsView
|
|
97
|
+
// channelId={channelId}
|
|
98
|
+
// channelsDetail={channelsDetail}
|
|
99
|
+
// refetchChannelDetail={refetchChannelDetail}
|
|
100
|
+
// />
|
|
101
|
+
// </Box>
|
|
102
|
+
// )}
|
|
103
|
+
// </>
|
|
104
|
+
// )}
|
|
105
|
+
// </>
|
|
106
|
+
// );
|
|
107
|
+
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { Box } from 'native-base';
|
|
2
|
+
import { Box, Text } from 'native-base';
|
|
3
3
|
|
|
4
4
|
import { Dialogs } from './containers/Dialogs';
|
|
5
|
+
import { SupportServiceDialogs } from './containers/SupportServiceDialogs';
|
|
5
6
|
|
|
6
|
-
export const Inbox = (props:any) => {
|
|
7
|
-
const { channelFilters, channelRole } = props;
|
|
7
|
+
export const Inbox = (props: any) => {
|
|
8
|
+
const { channelFilters, channelRole, supportServices } = props;
|
|
8
9
|
return (
|
|
9
10
|
<Box bg={'white'} flex={1}>
|
|
11
|
+
{supportServices && <SupportServiceDialogs channelFilters={channelFilters} channelRole={channelRole} {...props} />}
|
|
10
12
|
<Dialogs channelFilters={channelFilters} channelRole={channelRole} {...props} />
|
|
11
13
|
</Box>
|
|
12
14
|
);
|
|
@@ -37,6 +37,7 @@ export const DialogsListItemComponent: React.FC<IDialogListItemProps> = function
|
|
|
37
37
|
channel,
|
|
38
38
|
onOpen,
|
|
39
39
|
}) {
|
|
40
|
+
const parentId:any = null;
|
|
40
41
|
const {
|
|
41
42
|
data: messagesQuery,
|
|
42
43
|
loading: messageLoading,
|
|
@@ -44,7 +45,8 @@ export const DialogsListItemComponent: React.FC<IDialogListItemProps> = function
|
|
|
44
45
|
} = useMessagesQuery({
|
|
45
46
|
variables: {
|
|
46
47
|
channelId: channel?.id?.toString(),
|
|
47
|
-
|
|
48
|
+
parentId: parentId,
|
|
49
|
+
limit: 25,
|
|
48
50
|
},
|
|
49
51
|
fetchPolicy: 'cache-and-network',
|
|
50
52
|
});
|
|
@@ -52,7 +54,7 @@ export const DialogsListItemComponent: React.FC<IDialogListItemProps> = function
|
|
|
52
54
|
useFocusEffect(
|
|
53
55
|
React.useCallback(() => {
|
|
54
56
|
// Do something when the screen is focused
|
|
55
|
-
refetchMessages({ channelId: channel?.id?.toString(), limit:
|
|
57
|
+
refetchMessages({ channelId: channel?.id?.toString(),parentId:parentId, limit: 25 });
|
|
56
58
|
|
|
57
59
|
return () => {
|
|
58
60
|
// Do something when the screen is unfocused
|
|
@@ -66,7 +68,9 @@ export const DialogsListItemComponent: React.FC<IDialogListItemProps> = function
|
|
|
66
68
|
return null;
|
|
67
69
|
}
|
|
68
70
|
const { data } = messagesQuery.messages;
|
|
69
|
-
|
|
71
|
+
const filteredData = data?.filter((p: any) => p?.message !== '');
|
|
72
|
+
return filteredData[0];
|
|
73
|
+
//return data[data.length - 1];
|
|
70
74
|
}, [messagesQuery]);
|
|
71
75
|
|
|
72
76
|
const channelMembers = useMemo(
|