@messenger-box/platform-mobile 10.0.3-alpha.40 → 10.0.3-alpha.46
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 +8 -0
- package/lib/compute.js +2 -3
- package/lib/index.js.map +1 -1
- package/lib/queries/inboxQueries.js +77 -0
- package/lib/queries/inboxQueries.js.map +1 -0
- package/lib/routes.json +2 -3
- package/lib/screens/inbox/DialogThreadMessages.js +3 -7
- package/lib/screens/inbox/DialogThreadMessages.js.map +1 -1
- package/lib/screens/inbox/DialogThreads.js +3 -7
- package/lib/screens/inbox/DialogThreads.js.map +1 -1
- package/lib/screens/inbox/components/DialogsListItem.js +47 -46
- package/lib/screens/inbox/components/DialogsListItem.js.map +1 -1
- package/lib/screens/inbox/components/GiftedChatInboxComponent.js +313 -0
- package/lib/screens/inbox/components/GiftedChatInboxComponent.js.map +1 -0
- package/lib/screens/inbox/components/ServiceDialogsListItem.js +72 -57
- package/lib/screens/inbox/components/ServiceDialogsListItem.js.map +1 -1
- package/lib/screens/inbox/components/SlackMessageContainer/SlackBubble.js +115 -14
- package/lib/screens/inbox/components/SlackMessageContainer/SlackBubble.js.map +1 -1
- package/lib/screens/inbox/components/SubscriptionHandler.js +24 -0
- package/lib/screens/inbox/components/SubscriptionHandler.js.map +1 -0
- package/lib/screens/inbox/containers/ConversationView.js +640 -493
- package/lib/screens/inbox/containers/ConversationView.js.map +1 -1
- package/lib/screens/inbox/containers/Dialogs.js +100 -181
- package/lib/screens/inbox/containers/Dialogs.js.map +1 -1
- package/lib/screens/inbox/containers/ThreadConversationView.js +659 -245
- package/lib/screens/inbox/containers/ThreadConversationView.js.map +1 -1
- package/lib/screens/inbox/containers/ThreadsView.js +3 -3
- package/lib/screens/inbox/containers/ThreadsView.js.map +1 -1
- package/lib/screens/inbox/hooks/useInboxMessages.js +31 -0
- package/lib/screens/inbox/hooks/useInboxMessages.js.map +1 -0
- package/package.json +4 -4
- package/src/index.ts +2 -0
- package/src/queries/inboxQueries.ts +298 -0
- package/src/queries/index.d.ts +2 -0
- package/src/queries/index.ts +1 -0
- package/src/screens/inbox/DialogThreadMessages.tsx +3 -11
- package/src/screens/inbox/DialogThreads.tsx +3 -7
- package/src/screens/inbox/components/Actionsheet.tsx +30 -0
- package/src/screens/inbox/components/DialogsListItem.tsx +89 -148
- package/src/screens/inbox/components/ExpandableInput.tsx +460 -0
- package/src/screens/inbox/components/ExpandableInputActionSheet.tsx +518 -0
- package/src/screens/inbox/components/GiftedChatInboxComponent.tsx +411 -0
- package/src/screens/inbox/components/ServiceDialogsListItem.tsx +202 -221
- package/src/screens/inbox/components/SlackInput.tsx +23 -0
- package/src/screens/inbox/components/SlackMessageContainer/SlackBubble.tsx +216 -30
- package/src/screens/inbox/components/SubscriptionHandler.tsx +41 -0
- package/src/screens/inbox/components/SupportServiceDialogsListItem.tsx +6 -7
- package/src/screens/inbox/containers/ConversationView.tsx +1109 -669
- package/src/screens/inbox/containers/Dialogs.tsx +198 -342
- package/src/screens/inbox/containers/SupportServiceDialogs.tsx +2 -2
- package/src/screens/inbox/containers/ThreadConversationView.tsx +1141 -402
- package/src/screens/inbox/containers/ThreadsView.tsx +5 -5
- package/src/screens/inbox/hooks/useInboxMessages.ts +34 -0
- package/src/screens/inbox/machines/threadsMachine.ts +2 -2
|
@@ -6,9 +6,9 @@ import { useNavigation, useRoute, useIsFocused, useFocusEffect } from '@react-na
|
|
|
6
6
|
import { orderBy, uniqBy, startCase } from 'lodash-es';
|
|
7
7
|
import {
|
|
8
8
|
useThreadMessagesQuery,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} from '
|
|
9
|
+
THREAD_CREATED_UPDATED,
|
|
10
|
+
useThreadCreatedUpdatedSubscription,
|
|
11
|
+
} from '../../../queries/inboxQueries';
|
|
12
12
|
import { userSelector } from '@adminide-stack/user-auth0-client';
|
|
13
13
|
import { CHANGE_SETTINGS_ACTION } from '@admin-layout/client';
|
|
14
14
|
import { ThreadViewItem } from '../components/ThreadsViewItem';
|
|
@@ -52,14 +52,14 @@ const ThreadsViewComponent = ({
|
|
|
52
52
|
const [refreshing, setRefresh] = useState<boolean>(false);
|
|
53
53
|
|
|
54
54
|
// Use thread subscription for real-time updates
|
|
55
|
-
const { data: threadCreatedUpdated } =
|
|
55
|
+
const { data: threadCreatedUpdated } = useThreadCreatedUpdatedSubscription({
|
|
56
56
|
variables: { channelId: channelId?.toString() },
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
// Subscribe to thread updates
|
|
60
60
|
const subscribeToNewMessages = useCallback(() => {
|
|
61
61
|
return subscribeToMore({
|
|
62
|
-
document:
|
|
62
|
+
document: THREAD_CREATED_UPDATED,
|
|
63
63
|
variables: { channelId: channelId?.toString() },
|
|
64
64
|
updateQuery: (prev: any, { subscriptionData }: any) => {
|
|
65
65
|
if (!subscriptionData.data) return prev;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* useInboxMessages - a generic hook for fetching and subscribing to messages
|
|
5
|
+
*
|
|
6
|
+
* @param useQueryHook - Apollo query hook (e.g., useChannelMessagesQuery)
|
|
7
|
+
* @param queryVariables - variables for the query
|
|
8
|
+
* @param subscriptionDocument - GraphQL subscription document
|
|
9
|
+
* @param subscriptionVariables - variables for the subscription
|
|
10
|
+
* @param updateQuery - Apollo updateQuery function (optional)
|
|
11
|
+
* @param onError - error handler (optional)
|
|
12
|
+
* @returns { data, loading, error, refetch, subscribe }
|
|
13
|
+
*/
|
|
14
|
+
export function useInboxMessages({
|
|
15
|
+
useQueryHook,
|
|
16
|
+
queryVariables,
|
|
17
|
+
subscriptionDocument,
|
|
18
|
+
subscriptionVariables,
|
|
19
|
+
updateQuery,
|
|
20
|
+
onError,
|
|
21
|
+
}) {
|
|
22
|
+
const { data, loading, error, refetch, subscribeToMore } = useQueryHook(queryVariables);
|
|
23
|
+
|
|
24
|
+
const subscribe = useCallback(() => {
|
|
25
|
+
return subscribeToMore({
|
|
26
|
+
document: subscriptionDocument,
|
|
27
|
+
variables: subscriptionVariables,
|
|
28
|
+
updateQuery,
|
|
29
|
+
onError,
|
|
30
|
+
});
|
|
31
|
+
}, [subscribeToMore, subscriptionDocument, subscriptionVariables, updateQuery, onError]);
|
|
32
|
+
|
|
33
|
+
return { data, loading, error, refetch, subscribe };
|
|
34
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { orderBy, uniqBy } from 'lodash-es';
|
|
2
2
|
import { config } from '../config';
|
|
3
|
-
import {
|
|
3
|
+
import { THREAD_CREATED_UPDATED } from '../../../queries/inboxQueries';
|
|
4
4
|
|
|
5
5
|
const { MESSAGES_PER_PAGE } = config;
|
|
6
6
|
|
|
@@ -126,7 +126,7 @@ export const setupThreadSubscription = (
|
|
|
126
126
|
if (!subscribeToMore || !channelId) return undefined;
|
|
127
127
|
|
|
128
128
|
return subscribeToMore({
|
|
129
|
-
document:
|
|
129
|
+
document: THREAD_CREATED_UPDATED,
|
|
130
130
|
variables: { channelId: channelId?.toString() },
|
|
131
131
|
updateQuery: (prev, { subscriptionData }) => {
|
|
132
132
|
if (!subscriptionData?.data) return prev;
|