@planningcenter/chat-react-native 3.39.0-rc.0 → 3.39.0-rc.2
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/build/hooks/direct_messages/use_direct_message_affiliations.d.ts +5 -0
- package/build/hooks/direct_messages/use_direct_message_affiliations.d.ts.map +1 -0
- package/build/hooks/direct_messages/use_direct_message_affiliations.js +20 -0
- package/build/hooks/direct_messages/use_direct_message_affiliations.js.map +1 -0
- package/build/hooks/direct_messages/use_direct_message_candidates.d.ts +4 -0
- package/build/hooks/direct_messages/use_direct_message_candidates.d.ts.map +1 -0
- package/build/hooks/direct_messages/use_direct_message_candidates.js +28 -0
- package/build/hooks/direct_messages/use_direct_message_candidates.js.map +1 -0
- package/build/hooks/direct_messages/use_direct_message_conversation_validate.d.ts +11 -0
- package/build/hooks/direct_messages/use_direct_message_conversation_validate.d.ts.map +1 -0
- package/build/hooks/direct_messages/use_direct_message_conversation_validate.js +25 -0
- package/build/hooks/direct_messages/use_direct_message_conversation_validate.js.map +1 -0
- package/build/hooks/direct_messages/use_find_or_create_direct_message_conversation.d.ts +13 -0
- package/build/hooks/direct_messages/use_find_or_create_direct_message_conversation.d.ts.map +1 -0
- package/build/hooks/direct_messages/use_find_or_create_direct_message_conversation.js +51 -0
- package/build/hooks/direct_messages/use_find_or_create_direct_message_conversation.js.map +1 -0
- package/build/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.d.ts +1 -2
- package/build/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.d.ts.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.js +244 -8
- package/build/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.js.map +1 -1
- package/build/types/resources/direct_message_affiliations.d.ts +8 -0
- package/build/types/resources/direct_message_affiliations.d.ts.map +1 -0
- package/build/types/resources/direct_message_affiliations.js +2 -0
- package/build/types/resources/direct_message_affiliations.js.map +1 -0
- package/build/types/resources/direct_message_candidate.d.ts +12 -0
- package/build/types/resources/direct_message_candidate.d.ts.map +1 -0
- package/build/types/resources/direct_message_candidate.js +2 -0
- package/build/types/resources/direct_message_candidate.js.map +1 -0
- package/build/types/resources/index.d.ts +2 -0
- package/build/types/resources/index.d.ts.map +1 -1
- package/build/types/resources/index.js +2 -0
- package/build/types/resources/index.js.map +1 -1
- package/package.json +2 -2
- package/src/hooks/direct_messages/use_direct_message_affiliations.ts +39 -0
- package/src/hooks/direct_messages/use_direct_message_candidates.ts +31 -0
- package/src/hooks/direct_messages/use_direct_message_conversation_validate.ts +35 -0
- package/src/hooks/direct_messages/use_find_or_create_direct_message_conversation.ts +66 -0
- package/src/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.tsx +386 -8
- package/src/types/resources/direct_message_affiliations.ts +8 -0
- package/src/types/resources/direct_message_candidate.ts +12 -0
- package/src/types/resources/index.ts +2 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use_direct_message_affiliations.d.ts","sourceRoot":"","sources":["../../../src/hooks/direct_messages/use_direct_message_affiliations.ts"],"names":[],"mappings":"AAMA,wBAAgB,4BAA4B;;;EAgC3C"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useQuery } from '@tanstack/react-query';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { useApiClient } from '../use_api_client';
|
|
4
|
+
export function useDirectMessageAffiliations() {
|
|
5
|
+
const apiClient = useApiClient();
|
|
6
|
+
const { data } = useQuery({
|
|
7
|
+
queryKey: ['chat', '/me/direct_message_affiliations'],
|
|
8
|
+
queryFn: () => apiClient.chat.get({
|
|
9
|
+
url: '/me/direct_message_affiliations',
|
|
10
|
+
data: {
|
|
11
|
+
fields: { DirectMessageAffiliations: ['groups', 'teams'] },
|
|
12
|
+
},
|
|
13
|
+
}),
|
|
14
|
+
staleTime: 5 * 60 * 1000,
|
|
15
|
+
});
|
|
16
|
+
const groups = useMemo(() => new Map(Object.entries(data?.data?.groups ?? {}).map(([id, name]) => [+id, name])), [data]);
|
|
17
|
+
const teams = useMemo(() => new Map(Object.entries(data?.data?.teams ?? {}).map(([id, name]) => [+id, name])), [data]);
|
|
18
|
+
return { groups, teams };
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=use_direct_message_affiliations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use_direct_message_affiliations.js","sourceRoot":"","sources":["../../../src/hooks/direct_messages/use_direct_message_affiliations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAG/B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD,MAAM,UAAU,4BAA4B;IAC1C,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;IAEhC,MAAM,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAC;QACxB,QAAQ,EAAE,CAAC,MAAM,EAAE,iCAAiC,CAAC;QACrD,OAAO,EAAE,GAAG,EAAE,CACZ,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC;YACjB,GAAG,EAAE,iCAAiC;YACtC,IAAI,EAAE;gBACJ,MAAM,EAAE,EAAE,yBAAyB,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE;aAC3D;SACF,CAA4D;QAC/D,SAAS,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI;KACzB,CAAC,CAAA;IAEF,MAAM,MAAM,GAAG,OAAO,CACpB,GAAG,EAAE,CACH,IAAI,GAAG,CACL,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,CAC1E,EACH,CAAC,IAAI,CAAC,CACP,CAAA;IAED,MAAM,KAAK,GAAG,OAAO,CACnB,GAAG,EAAE,CACH,IAAI,GAAG,CACL,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,CACzE,EACH,CAAC,IAAI,CAAC,CACP,CAAA;IAED,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAA;AAC1B,CAAC","sourcesContent":["import { useQuery } from '@tanstack/react-query'\nimport { useMemo } from 'react'\nimport { ApiResource } from '../../types'\nimport { DirectMessageAffiliationsResource } from '../../types/resources/direct_message_affiliations'\nimport { useApiClient } from '../use_api_client'\n\nexport function useDirectMessageAffiliations() {\n const apiClient = useApiClient()\n\n const { data } = useQuery({\n queryKey: ['chat', '/me/direct_message_affiliations'],\n queryFn: () =>\n apiClient.chat.get({\n url: '/me/direct_message_affiliations',\n data: {\n fields: { DirectMessageAffiliations: ['groups', 'teams'] },\n },\n }) as Promise<ApiResource<DirectMessageAffiliationsResource>>,\n staleTime: 5 * 60 * 1000,\n })\n\n const groups = useMemo(\n () =>\n new Map<number, string>(\n Object.entries(data?.data?.groups ?? {}).map(([id, name]) => [+id, name])\n ),\n [data]\n )\n\n const teams = useMemo(\n () =>\n new Map<number, string>(\n Object.entries(data?.data?.teams ?? {}).map(([id, name]) => [+id, name])\n ),\n [data]\n )\n\n return { groups, teams }\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ApiCollection } from '../../types';
|
|
2
|
+
import { DirectMessageCandidateResource } from '../../types/resources/direct_message_candidate';
|
|
3
|
+
export declare function useDirectMessageCandidates(term: string): import("@tanstack/react-query").UseQueryResult<ApiCollection<DirectMessageCandidateResource>, Error>;
|
|
4
|
+
//# sourceMappingURL=use_direct_message_candidates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use_direct_message_candidates.d.ts","sourceRoot":"","sources":["../../../src/hooks/direct_messages/use_direct_message_candidates.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,8BAA8B,EAAE,MAAM,gDAAgD,CAAA;AAG/F,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,wGAyBtD"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useQuery } from '@tanstack/react-query';
|
|
2
|
+
import { useApiClient } from '../use_api_client';
|
|
3
|
+
export function useDirectMessageCandidates(term) {
|
|
4
|
+
const apiClient = useApiClient();
|
|
5
|
+
return useQuery({
|
|
6
|
+
queryKey: ['chat', '/me/direct_message_candidates', term],
|
|
7
|
+
queryFn: () => apiClient.chat.get({
|
|
8
|
+
url: '/me/direct_message_candidates',
|
|
9
|
+
data: {
|
|
10
|
+
q: term,
|
|
11
|
+
fields: {
|
|
12
|
+
DirectMessageCandidate: [
|
|
13
|
+
'name',
|
|
14
|
+
'avatar',
|
|
15
|
+
'groups',
|
|
16
|
+
'teams',
|
|
17
|
+
'under_18',
|
|
18
|
+
'direct_messages_disabled',
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
}),
|
|
23
|
+
enabled: term.length >= 1,
|
|
24
|
+
staleTime: 1000 * 60,
|
|
25
|
+
throwOnError: true,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=use_direct_message_candidates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use_direct_message_candidates.js","sourceRoot":"","sources":["../../../src/hooks/direct_messages/use_direct_message_candidates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAGhD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD,MAAM,UAAU,0BAA0B,CAAC,IAAY;IACrD,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;IAChC,OAAO,QAAQ,CAAC;QACd,QAAQ,EAAE,CAAC,MAAM,EAAE,+BAA+B,EAAE,IAAI,CAAC;QACzD,OAAO,EAAE,GAAG,EAAE,CACZ,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC;YACjB,GAAG,EAAE,+BAA+B;YACpC,IAAI,EAAE;gBACJ,CAAC,EAAE,IAAI;gBACP,MAAM,EAAE;oBACN,sBAAsB,EAAE;wBACtB,MAAM;wBACN,QAAQ;wBACR,QAAQ;wBACR,OAAO;wBACP,UAAU;wBACV,0BAA0B;qBAC3B;iBACF;aACF;SACF,CAA2D;QAC9D,OAAO,EAAE,IAAI,CAAC,MAAM,IAAI,CAAC;QACzB,SAAS,EAAE,IAAI,GAAG,EAAE;QACpB,YAAY,EAAE,IAAI;KACnB,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import { useQuery } from '@tanstack/react-query'\nimport { ApiCollection } from '../../types'\nimport { DirectMessageCandidateResource } from '../../types/resources/direct_message_candidate'\nimport { useApiClient } from '../use_api_client'\n\nexport function useDirectMessageCandidates(term: string) {\n const apiClient = useApiClient()\n return useQuery({\n queryKey: ['chat', '/me/direct_message_candidates', term],\n queryFn: () =>\n apiClient.chat.get({\n url: '/me/direct_message_candidates',\n data: {\n q: term,\n fields: {\n DirectMessageCandidate: [\n 'name',\n 'avatar',\n 'groups',\n 'teams',\n 'under_18',\n 'direct_messages_disabled',\n ],\n },\n },\n }) as Promise<ApiCollection<DirectMessageCandidateResource>>,\n enabled: term.length >= 1,\n staleTime: 1000 * 60,\n throwOnError: true,\n })\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ConversationWarning } from '../../types';
|
|
2
|
+
interface Props {
|
|
3
|
+
recipientIds: string[];
|
|
4
|
+
enabled?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function useDirectMessageConversationValidate({ recipientIds, enabled }: Props): {
|
|
7
|
+
warnings: ConversationWarning[];
|
|
8
|
+
validationPending: boolean;
|
|
9
|
+
};
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=use_direct_message_conversation_validate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use_direct_message_conversation_validate.d.ts","sourceRoot":"","sources":["../../../src/hooks/direct_messages/use_direct_message_conversation_validate.ts"],"names":[],"mappings":"AACA,OAAO,EAA6C,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAG5F,UAAU,KAAK;IACb,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,oCAAoC,CAAC,EAAE,YAAY,EAAE,OAAc,EAAE,EAAE,KAAK;;;EAyB3F"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useQuery } from '@tanstack/react-query';
|
|
2
|
+
import { useApiClient } from '../use_api_client';
|
|
3
|
+
export function useDirectMessageConversationValidate({ recipientIds, enabled = true }) {
|
|
4
|
+
const apiClient = useApiClient();
|
|
5
|
+
const { data, isLoading } = useQuery({
|
|
6
|
+
queryKey: ['chat', '/me/conversation_validate', { recipient_ids: recipientIds }],
|
|
7
|
+
queryFn: () => apiClient.chat.post({
|
|
8
|
+
url: '/me/conversation_validate',
|
|
9
|
+
data: {
|
|
10
|
+
data: {
|
|
11
|
+
type: 'ConversationValidate',
|
|
12
|
+
attributes: { recipient_ids: recipientIds },
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
}),
|
|
16
|
+
enabled: enabled && recipientIds.length > 0,
|
|
17
|
+
retry: false,
|
|
18
|
+
});
|
|
19
|
+
const warnings = data?.data.warnings ?? [];
|
|
20
|
+
return {
|
|
21
|
+
warnings,
|
|
22
|
+
validationPending: enabled && recipientIds.length > 0 && isLoading,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=use_direct_message_conversation_validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use_direct_message_conversation_validate.js","sourceRoot":"","sources":["../../../src/hooks/direct_messages/use_direct_message_conversation_validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAEhD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAOhD,MAAM,UAAU,oCAAoC,CAAC,EAAE,YAAY,EAAE,OAAO,GAAG,IAAI,EAAS;IAC1F,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;IAEhC,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,QAAQ,CAAC;QACnC,QAAQ,EAAE,CAAC,MAAM,EAAE,2BAA2B,EAAE,EAAE,aAAa,EAAE,YAAY,EAAE,CAAC;QAChF,OAAO,EAAE,GAAG,EAAE,CACZ,SAAS,CAAC,IAAI,CAAC,IAAI,CAA4C;YAC7D,GAAG,EAAE,2BAA2B;YAChC,IAAI,EAAE;gBACJ,IAAI,EAAE;oBACJ,IAAI,EAAE,sBAAsB;oBAC5B,UAAU,EAAE,EAAE,aAAa,EAAE,YAAY,EAAE;iBAC5C;aACF;SACF,CAAC;QACJ,OAAO,EAAE,OAAO,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC;QAC3C,KAAK,EAAE,KAAK;KACb,CAAC,CAAA;IAEF,MAAM,QAAQ,GAA0B,IAAI,EAAE,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAA;IAEjE,OAAO;QACL,QAAQ;QACR,iBAAiB,EAAE,OAAO,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,IAAI,SAAS;KACnE,CAAA;AACH,CAAC","sourcesContent":["import { useQuery } from '@tanstack/react-query'\nimport { ApiResource, ConversationValidateResource, ConversationWarning } from '../../types'\nimport { useApiClient } from '../use_api_client'\n\ninterface Props {\n recipientIds: string[]\n enabled?: boolean\n}\n\nexport function useDirectMessageConversationValidate({ recipientIds, enabled = true }: Props) {\n const apiClient = useApiClient()\n\n const { data, isLoading } = useQuery({\n queryKey: ['chat', '/me/conversation_validate', { recipient_ids: recipientIds }],\n queryFn: () =>\n apiClient.chat.post<ApiResource<ConversationValidateResource>>({\n url: '/me/conversation_validate',\n data: {\n data: {\n type: 'ConversationValidate',\n attributes: { recipient_ids: recipientIds },\n },\n },\n }),\n enabled: enabled && recipientIds.length > 0,\n retry: false,\n })\n\n const warnings: ConversationWarning[] = data?.data.warnings ?? []\n\n return {\n warnings,\n validationPending: enabled && recipientIds.length > 0 && isLoading,\n }\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ConversationResource } from '../../types';
|
|
2
|
+
interface Props {
|
|
3
|
+
recipientIds: string[];
|
|
4
|
+
onSuccess: (conversationId: ConversationResource['id']) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function useFindOrCreateDirectMessageConversation({ recipientIds, onSuccess }: Props): {
|
|
7
|
+
findOrCreateConversation: (participantIds: string[]) => Promise<void>;
|
|
8
|
+
directMessageExists: boolean;
|
|
9
|
+
isFinding: boolean;
|
|
10
|
+
isError: boolean;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=use_find_or_create_direct_message_conversation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use_find_or_create_direct_message_conversation.d.ts","sourceRoot":"","sources":["../../../src/hooks/direct_messages/use_find_or_create_direct_message_conversation.ts"],"names":[],"mappings":"AAEA,OAAO,EAA8B,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAwB9E,UAAU,KAAK;IACb,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,SAAS,EAAE,CAAC,cAAc,EAAE,oBAAoB,CAAC,IAAI,CAAC,KAAK,IAAI,CAAA;CAChE;AAED,wBAAgB,wCAAwC,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE,KAAK;+CAchE,MAAM,EAAE;;;;EAoBlC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { useQuery } from '@tanstack/react-query';
|
|
2
|
+
import { useState, useCallback } from 'react';
|
|
3
|
+
import { useApiClient } from '../use_api_client';
|
|
4
|
+
const findDirectMessageConversation = (apiClient, participantIds) => apiClient.chat.get({
|
|
5
|
+
url: '/me/conversations',
|
|
6
|
+
data: {
|
|
7
|
+
fields: { Conversation: ['title'] },
|
|
8
|
+
filter: 'with_exact_direct_message_participants',
|
|
9
|
+
participant_ids: participantIds.join(','),
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
const createDirectMessageConversation = (apiClient, ids) => apiClient.chat.post({
|
|
13
|
+
url: '/me/direct_messages',
|
|
14
|
+
data: {
|
|
15
|
+
data: {
|
|
16
|
+
type: 'DirectMessage',
|
|
17
|
+
attributes: { recipients: ids },
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
export function useFindOrCreateDirectMessageConversation({ recipientIds, onSuccess }) {
|
|
22
|
+
const apiClient = useApiClient();
|
|
23
|
+
const [isFinding, setIsFinding] = useState(false);
|
|
24
|
+
const [isError, setIsError] = useState(false);
|
|
25
|
+
const { data } = useQuery({
|
|
26
|
+
queryKey: ['chat', '/me/conversations', 'with_exact_direct_message_participants', recipientIds],
|
|
27
|
+
queryFn: () => findDirectMessageConversation(apiClient, recipientIds),
|
|
28
|
+
enabled: recipientIds.length > 0,
|
|
29
|
+
});
|
|
30
|
+
const directMessageExists = (data?.data.length ?? 0) > 0;
|
|
31
|
+
const findOrCreateConversation = useCallback(async (participantIds) => {
|
|
32
|
+
setIsFinding(true);
|
|
33
|
+
setIsError(false);
|
|
34
|
+
try {
|
|
35
|
+
const findResponse = await findDirectMessageConversation(apiClient, participantIds);
|
|
36
|
+
if (findResponse.data.length > 0) {
|
|
37
|
+
onSuccess(findResponse.data[0].id);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
const createResponse = await createDirectMessageConversation(apiClient, participantIds);
|
|
41
|
+
onSuccess(createResponse.data.id);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
setIsError(true);
|
|
46
|
+
setIsFinding(false);
|
|
47
|
+
}
|
|
48
|
+
}, [apiClient, onSuccess]);
|
|
49
|
+
return { findOrCreateConversation, directMessageExists, isFinding, isError };
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=use_find_or_create_direct_message_conversation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use_find_or_create_direct_message_conversation.js","sourceRoot":"","sources":["../../../src/hooks/direct_messages/use_find_or_create_direct_message_conversation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAE7C,OAAO,EAAa,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAE3D,MAAM,6BAA6B,GAAG,CAAC,SAAoB,EAAE,cAAwB,EAAE,EAAE,CACvF,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC;IACjB,GAAG,EAAE,mBAAmB;IACxB,IAAI,EAAE;QACJ,MAAM,EAAE,EAAE,YAAY,EAAE,CAAC,OAAO,CAAC,EAAE;QACnC,MAAM,EAAE,wCAAwC;QAChD,eAAe,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC;KAC1C;CACF,CAAiD,CAAA;AAEpD,MAAM,+BAA+B,GAAG,CAAC,SAAoB,EAAE,GAAa,EAAE,EAAE,CAC9E,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;IAClB,GAAG,EAAE,qBAAqB;IAC1B,IAAI,EAAE;QACJ,IAAI,EAAE;YACJ,IAAI,EAAE,eAAe;YACrB,UAAU,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE;SAChC;KACF;CACF,CAA+C,CAAA;AAOlD,MAAM,UAAU,wCAAwC,CAAC,EAAE,YAAY,EAAE,SAAS,EAAS;IACzF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ACH,CAAC,EACD,CAAC,SAAS,EAAE,SAAS,CAAC,CACvB,CAAA;IAED,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,SAAS,EAAE,OAAO,EAAE,CAAA;AAC9E,CAAC","sourcesContent":["import { useQuery } from '@tanstack/react-query'\nimport { useState, useCallback } from 'react'\nimport { ApiCollection, ApiResource, ConversationResource } from '../../types'\nimport { ApiClient, useApiClient } from '../use_api_client'\n\nconst findDirectMessageConversation = (apiClient: ApiClient, participantIds: string[]) =>\n apiClient.chat.get({\n url: '/me/conversations',\n data: {\n fields: { Conversation: ['title'] },\n filter: 'with_exact_direct_message_participants',\n participant_ids: participantIds.join(','),\n },\n }) as Promise<ApiCollection<ConversationResource>>\n\nconst createDirectMessageConversation = (apiClient: ApiClient, ids: string[]) =>\n apiClient.chat.post({\n url: '/me/direct_messages',\n data: {\n data: {\n type: 'DirectMessage',\n attributes: { recipients: ids },\n },\n },\n }) as Promise<ApiResource<ConversationResource>>\n\ninterface Props {\n recipientIds: string[]\n onSuccess: (conversationId: ConversationResource['id']) => void\n}\n\nexport function useFindOrCreateDirectMessageConversation({ recipientIds, onSuccess }: Props) {\n const apiClient = useApiClient()\n const [isFinding, setIsFinding] = useState(false)\n const [isError, setIsError] = useState(false)\n\n const { data } = useQuery({\n queryKey: ['chat', '/me/conversations', 'with_exact_direct_message_participants', recipientIds],\n queryFn: () => findDirectMessageConversation(apiClient, recipientIds),\n enabled: recipientIds.length > 0,\n })\n\n const directMessageExists = (data?.data.length ?? 0) > 0\n\n const findOrCreateConversation = useCallback(\n async (participantIds: string[]) => {\n setIsFinding(true)\n setIsError(false)\n try {\n const findResponse = await findDirectMessageConversation(apiClient, participantIds)\n if (findResponse.data.length > 0) {\n onSuccess(findResponse.data[0].id)\n } else {\n const createResponse = await createDirectMessageConversation(apiClient, participantIds)\n onSuccess(createResponse.data.id)\n }\n } catch {\n setIsError(true)\n setIsFinding(false)\n }\n },\n [apiClient, onSuccess]\n )\n\n return { findOrCreateConversation, directMessageExists, isFinding, isError }\n}\n"]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { ConversationSelectRecipientsScreenProps } from './types/screen_props';
|
|
3
|
-
export declare function ConversationSelectDirectMessageRecipientsScreen(_props: ConversationSelectRecipientsScreenProps):
|
|
2
|
+
export declare function ConversationSelectDirectMessageRecipientsScreen(_props: ConversationSelectRecipientsScreenProps): import("react").JSX.Element;
|
|
4
3
|
//# sourceMappingURL=conversation_select_direct_message_recipients_screen.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation_select_direct_message_recipients_screen.d.ts","sourceRoot":"","sources":["../../../src/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"conversation_select_direct_message_recipients_screen.d.ts","sourceRoot":"","sources":["../../../src/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,uCAAuC,EAAE,MAAM,sBAAsB,CAAA;AAI9E,wBAAgB,+CAA+C,CAC7D,MAAM,EAAE,uCAAuC,+BAwDhD"}
|
|
@@ -1,25 +1,261 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { PlatformPressable } from '@react-navigation/elements';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { FlatList, Pressable, StyleSheet, TextInput, View } from 'react-native';
|
|
3
4
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
4
|
-
import {
|
|
5
|
+
import { Avatar, Banner, Icon, Spinner, Text } from '../../components';
|
|
6
|
+
import { ComponentErrorBoundary } from '../../components/page/component_error_boundary';
|
|
7
|
+
import { useTheme } from '../../hooks';
|
|
8
|
+
import { useDirectMessageCandidates } from '../../hooks/direct_messages/use_direct_message_candidates';
|
|
9
|
+
const MAX_RECIPIENTS = 9;
|
|
5
10
|
export function ConversationSelectDirectMessageRecipientsScreen(_props) {
|
|
6
11
|
const styles = useStyles();
|
|
12
|
+
const [searchTerm, setSearchTerm] = useState('');
|
|
13
|
+
const [debouncedTerm, setDebouncedTerm] = useState('');
|
|
14
|
+
const [selectedPeople, setSelectedPeople] = useState(new Map());
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
const timer = setTimeout(() => setDebouncedTerm(searchTerm), 200);
|
|
17
|
+
return () => clearTimeout(timer);
|
|
18
|
+
}, [searchTerm]);
|
|
19
|
+
const selectPerson = (person) => {
|
|
20
|
+
if (selectedPeople.size >= MAX_RECIPIENTS)
|
|
21
|
+
return;
|
|
22
|
+
setSelectedPeople(prev => new Map(prev).set(person.id, person));
|
|
23
|
+
setSearchTerm('');
|
|
24
|
+
setDebouncedTerm('');
|
|
25
|
+
};
|
|
26
|
+
const removePerson = (id) => {
|
|
27
|
+
setSelectedPeople(prev => {
|
|
28
|
+
const next = new Map(prev);
|
|
29
|
+
next.delete(id);
|
|
30
|
+
return next;
|
|
31
|
+
});
|
|
32
|
+
};
|
|
7
33
|
return (<View style={styles.container}>
|
|
8
|
-
<
|
|
9
|
-
<
|
|
34
|
+
<ToField selectedPeople={selectedPeople} searchTerm={searchTerm} onSearchChange={setSearchTerm} onRemove={removePerson} onClear={() => setSelectedPeople(new Map())}/>
|
|
35
|
+
<ComponentErrorBoundary key={debouncedTerm} fallback={<Banner appearance="error" description="Couldn't load people right now. Try again." style={styles.errorBanner}/>}>
|
|
36
|
+
<CandidateResults term={debouncedTerm} selectedPeople={selectedPeople} onSelect={selectPerson}/>
|
|
37
|
+
</ComponentErrorBoundary>
|
|
10
38
|
</View>);
|
|
11
39
|
}
|
|
40
|
+
function ToField({ selectedPeople, searchTerm, onSearchChange, onRemove, onClear, }) {
|
|
41
|
+
const styles = useStyles();
|
|
42
|
+
const { colors } = useTheme();
|
|
43
|
+
const hasSelections = selectedPeople.size > 0;
|
|
44
|
+
return (<View style={styles.toField}>
|
|
45
|
+
<View style={styles.toFieldHeader}>
|
|
46
|
+
<Text style={styles.toLabel}>To</Text>
|
|
47
|
+
{hasSelections && (<Pressable onPress={onClear} hitSlop={8}>
|
|
48
|
+
<Text style={styles.clearButton}>Clear</Text>
|
|
49
|
+
</Pressable>)}
|
|
50
|
+
</View>
|
|
51
|
+
<View style={styles.toInputArea}>
|
|
52
|
+
{[...selectedPeople.values()].map(person => (<PersonChip key={person.id} person={person} onRemove={onRemove}/>))}
|
|
53
|
+
<TextInput autoFocus placeholder="Search" placeholderTextColor={colors.textColorDefaultPlaceholder} value={searchTerm} onChangeText={onSearchChange} style={styles.toTextInput} returnKeyType="search"/>
|
|
54
|
+
</View>
|
|
55
|
+
</View>);
|
|
56
|
+
}
|
|
57
|
+
function PersonChip({ person, onRemove, }) {
|
|
58
|
+
const styles = useStyles();
|
|
59
|
+
return (<View style={styles.chip}>
|
|
60
|
+
<Avatar sourceUri={person.avatar} size="sm" showFallback/>
|
|
61
|
+
<Text style={styles.chipName}>{person.name}</Text>
|
|
62
|
+
<Pressable onPress={() => onRemove(person.id)} hitSlop={8} accessibilityLabel={`Remove ${person.name}`}>
|
|
63
|
+
<Icon name="general.x" size={12} style={styles.chipRemoveIcon}/>
|
|
64
|
+
</Pressable>
|
|
65
|
+
</View>);
|
|
66
|
+
}
|
|
67
|
+
function CandidateResults({ term, selectedPeople, onSelect, }) {
|
|
68
|
+
const styles = useStyles();
|
|
69
|
+
const { data, isFetching } = useDirectMessageCandidates(term);
|
|
70
|
+
if (term.length < 1) {
|
|
71
|
+
if (selectedPeople.size > 0)
|
|
72
|
+
return null;
|
|
73
|
+
return (<View style={styles.emptyState}>
|
|
74
|
+
<Icon name="churchCenter.people" size={40} style={styles.emptyStateIcon}/>
|
|
75
|
+
<Text style={styles.emptyStateTitle}>Search for people to direct message</Text>
|
|
76
|
+
<Text variant="secondary" style={styles.emptyStateSubtitle}>
|
|
77
|
+
Start a conversation with people in your groups and teams.
|
|
78
|
+
</Text>
|
|
79
|
+
</View>);
|
|
80
|
+
}
|
|
81
|
+
if (selectedPeople.size >= MAX_RECIPIENTS) {
|
|
82
|
+
return (<View style={styles.emptyState}>
|
|
83
|
+
<Text variant="secondary" style={styles.emptyStateSubtitle}>
|
|
84
|
+
You can add up to {MAX_RECIPIENTS} people to a direct message.
|
|
85
|
+
</Text>
|
|
86
|
+
</View>);
|
|
87
|
+
}
|
|
88
|
+
const unselectedCandidates = (data?.data ?? []).filter(c => !selectedPeople.has(c.id));
|
|
89
|
+
if (isFetching && unselectedCandidates.length === 0) {
|
|
90
|
+
return (<View style={styles.emptyState}>
|
|
91
|
+
<Spinner />
|
|
92
|
+
</View>);
|
|
93
|
+
}
|
|
94
|
+
if (!isFetching && unselectedCandidates.length === 0) {
|
|
95
|
+
return (<View style={styles.emptyState}>
|
|
96
|
+
<Icon name="general.search" size={32} style={styles.emptyStateIcon}/>
|
|
97
|
+
<Text style={styles.emptyStateTitle}>No matches for "{term}"</Text>
|
|
98
|
+
<Text variant="secondary" style={styles.emptyStateSubtitle}>
|
|
99
|
+
Try a different name, or check that you share a group or team with them.
|
|
100
|
+
</Text>
|
|
101
|
+
</View>);
|
|
102
|
+
}
|
|
103
|
+
const hasTruncated = (data?.meta.totalCount ?? 0) > (data?.data.length ?? 0);
|
|
104
|
+
return (<CandidateList candidates={unselectedCandidates} hasTruncated={hasTruncated} onSelect={onSelect}/>);
|
|
105
|
+
}
|
|
106
|
+
function CandidateList({ candidates, hasTruncated, onSelect, }) {
|
|
107
|
+
const styles = useStyles();
|
|
108
|
+
const available = candidates.filter(c => !c.directMessagesDisabled);
|
|
109
|
+
const dmDisabled = candidates.filter(c => c.directMessagesDisabled);
|
|
110
|
+
return (<FlatList data={available} keyExtractor={item => item.id} renderItem={({ item }) => <CandidateItem candidate={item} onPress={() => onSelect(item)}/>} ListHeaderComponent={<View style={styles.resultsHeader}>
|
|
111
|
+
<Text style={styles.resultsHeading}>Results</Text>
|
|
112
|
+
</View>} ListFooterComponent={<>
|
|
113
|
+
{dmDisabled.length > 0 && (<>
|
|
114
|
+
<View style={styles.unavailableHeader}>
|
|
115
|
+
<Text variant="secondary" style={styles.unavailableLabel}>
|
|
116
|
+
Unavailable for direct messages
|
|
117
|
+
</Text>
|
|
118
|
+
</View>
|
|
119
|
+
{dmDisabled.map(candidate => (<CandidateItem key={candidate.id} candidate={candidate} disabled/>))}
|
|
120
|
+
</>)}
|
|
121
|
+
{hasTruncated && (<View style={styles.truncatedFooter}>
|
|
122
|
+
<Text variant="secondary" style={styles.truncatedText}>
|
|
123
|
+
Keep typing to narrow your results.
|
|
124
|
+
</Text>
|
|
125
|
+
</View>)}
|
|
126
|
+
</>}/>);
|
|
127
|
+
}
|
|
128
|
+
function CandidateItem({ candidate, onPress, disabled = false, }) {
|
|
129
|
+
const styles = useStyles();
|
|
130
|
+
return (<PlatformPressable onPress={disabled ? undefined : onPress} accessibilityRole="button" accessibilityLabel={`Select ${candidate.name}`} accessibilityState={{ disabled }}>
|
|
131
|
+
<View style={[styles.row, disabled && styles.candidateDisabled]}>
|
|
132
|
+
<Avatar sourceUri={candidate.avatar} size="lg" showFallback/>
|
|
133
|
+
<Text style={styles.rowName}>{candidate.name}</Text>
|
|
134
|
+
</View>
|
|
135
|
+
</PlatformPressable>);
|
|
136
|
+
}
|
|
12
137
|
const useStyles = () => {
|
|
13
138
|
const { bottom } = useSafeAreaInsets();
|
|
139
|
+
const { colors } = useTheme();
|
|
14
140
|
return StyleSheet.create({
|
|
15
141
|
container: {
|
|
16
142
|
flex: 1,
|
|
17
|
-
|
|
18
|
-
|
|
143
|
+
paddingBottom: bottom,
|
|
144
|
+
},
|
|
145
|
+
toField: {
|
|
146
|
+
paddingHorizontal: 16,
|
|
147
|
+
paddingTop: 16,
|
|
148
|
+
paddingBottom: 8,
|
|
149
|
+
},
|
|
150
|
+
toFieldHeader: {
|
|
151
|
+
flexDirection: 'row',
|
|
152
|
+
justifyContent: 'space-between',
|
|
153
|
+
alignItems: 'center',
|
|
154
|
+
marginBottom: 8,
|
|
155
|
+
},
|
|
156
|
+
toLabel: {
|
|
157
|
+
fontWeight: '600',
|
|
158
|
+
color: colors.textColorDefaultSecondary,
|
|
159
|
+
},
|
|
160
|
+
clearButton: {
|
|
161
|
+
color: colors.interaction,
|
|
162
|
+
},
|
|
163
|
+
toInputArea: {
|
|
164
|
+
flexDirection: 'row',
|
|
165
|
+
flexWrap: 'wrap',
|
|
19
166
|
alignItems: 'center',
|
|
20
|
-
|
|
167
|
+
gap: 6,
|
|
168
|
+
borderWidth: 1,
|
|
169
|
+
borderColor: colors.borderColorDefaultBase,
|
|
170
|
+
borderRadius: 8,
|
|
171
|
+
paddingHorizontal: 10,
|
|
172
|
+
paddingVertical: 8,
|
|
173
|
+
},
|
|
174
|
+
toTextInput: {
|
|
175
|
+
flex: 1,
|
|
176
|
+
minWidth: 80,
|
|
177
|
+
color: colors.textColorDefaultPrimary,
|
|
178
|
+
fontSize: 16,
|
|
179
|
+
paddingVertical: 2,
|
|
180
|
+
},
|
|
181
|
+
chip: {
|
|
182
|
+
flexDirection: 'row',
|
|
183
|
+
alignItems: 'center',
|
|
184
|
+
gap: 4,
|
|
185
|
+
borderWidth: 1,
|
|
186
|
+
borderColor: colors.borderColorDefaultBase,
|
|
187
|
+
borderRadius: 100,
|
|
188
|
+
paddingLeft: 4,
|
|
189
|
+
paddingRight: 6,
|
|
190
|
+
paddingVertical: 3,
|
|
191
|
+
},
|
|
192
|
+
chipName: {
|
|
193
|
+
fontSize: 14,
|
|
194
|
+
},
|
|
195
|
+
chipRemoveIcon: {
|
|
196
|
+
color: colors.iconColorDefaultSecondary,
|
|
197
|
+
},
|
|
198
|
+
errorBanner: {
|
|
199
|
+
margin: 16,
|
|
200
|
+
},
|
|
201
|
+
emptyState: {
|
|
202
|
+
alignItems: 'center',
|
|
203
|
+
paddingTop: 32,
|
|
204
|
+
paddingHorizontal: 32,
|
|
21
205
|
gap: 8,
|
|
22
206
|
},
|
|
207
|
+
emptyStateIcon: {
|
|
208
|
+
color: colors.iconColorDefaultSecondary,
|
|
209
|
+
marginBottom: 4,
|
|
210
|
+
},
|
|
211
|
+
emptyStateTitle: {
|
|
212
|
+
fontWeight: '600',
|
|
213
|
+
textAlign: 'center',
|
|
214
|
+
},
|
|
215
|
+
emptyStateSubtitle: {
|
|
216
|
+
textAlign: 'center',
|
|
217
|
+
fontSize: 14,
|
|
218
|
+
},
|
|
219
|
+
row: {
|
|
220
|
+
flexDirection: 'row',
|
|
221
|
+
alignItems: 'center',
|
|
222
|
+
gap: 12,
|
|
223
|
+
paddingHorizontal: 16,
|
|
224
|
+
paddingVertical: 12,
|
|
225
|
+
borderBottomWidth: 1,
|
|
226
|
+
borderColor: colors.fillColorNeutral050Base,
|
|
227
|
+
},
|
|
228
|
+
rowName: {
|
|
229
|
+
flex: 1,
|
|
230
|
+
},
|
|
231
|
+
candidateDisabled: {
|
|
232
|
+
opacity: 0.5,
|
|
233
|
+
},
|
|
234
|
+
resultsHeader: {
|
|
235
|
+
paddingHorizontal: 16,
|
|
236
|
+
paddingTop: 16,
|
|
237
|
+
paddingBottom: 8,
|
|
238
|
+
},
|
|
239
|
+
resultsHeading: {
|
|
240
|
+
fontWeight: '600',
|
|
241
|
+
},
|
|
242
|
+
unavailableHeader: {
|
|
243
|
+
paddingHorizontal: 16,
|
|
244
|
+
paddingTop: 16,
|
|
245
|
+
paddingBottom: 8,
|
|
246
|
+
},
|
|
247
|
+
unavailableLabel: {
|
|
248
|
+
fontSize: 13,
|
|
249
|
+
},
|
|
250
|
+
truncatedFooter: {
|
|
251
|
+
paddingHorizontal: 16,
|
|
252
|
+
paddingTop: 12,
|
|
253
|
+
paddingBottom: 8,
|
|
254
|
+
},
|
|
255
|
+
truncatedText: {
|
|
256
|
+
fontSize: 13,
|
|
257
|
+
textAlign: 'center',
|
|
258
|
+
},
|
|
23
259
|
});
|
|
24
260
|
};
|
|
25
261
|
//# sourceMappingURL=conversation_select_direct_message_recipients_screen.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation_select_direct_message_recipients_screen.js","sourceRoot":"","sources":["../../../src/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAGhD,MAAM,UAAU,+CAA+C,CAC7D,MAA+C;IAE/C,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAE1B,OAAO,CACL,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAC5B;MAAA,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE,OAAO,CACjD;MAAA,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,WAAW,EAAE,IAAI,CAC7C;IAAA,EAAE,IAAI,CAAC,CACR,CAAA;AACH,CAAC;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,EAAE,MAAM,EAAE,GAAG,iBAAiB,EAAE,CAAA;IAEtC,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,SAAS,EAAE;YACT,IAAI,EAAE,CAAC;YACP,OAAO,EAAE,EAAE;YACX,aAAa,EAAE,EAAE,GAAG,MAAM;YAC1B,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,QAAQ;YACxB,GAAG,EAAE,CAAC;SACP;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React from 'react'\nimport { StyleSheet, View } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { Heading, Text } from '../../components'\nimport { ConversationSelectRecipientsScreenProps } from './types/screen_props'\n\nexport function ConversationSelectDirectMessageRecipientsScreen(\n _props: ConversationSelectRecipientsScreenProps\n) {\n const styles = useStyles()\n\n return (\n <View style={styles.container}>\n <Heading variant=\"h2\">New direct message</Heading>\n <Text variant=\"secondary\">Coming soon</Text>\n </View>\n )\n}\n\nconst useStyles = () => {\n const { bottom } = useSafeAreaInsets()\n\n return StyleSheet.create({\n container: {\n flex: 1,\n padding: 16,\n paddingBottom: 16 + bottom,\n alignItems: 'center',\n justifyContent: 'center',\n gap: 8,\n },\n })\n}\n"]}
|
|
1
|
+
{"version":3,"file":"conversation_select_direct_message_recipients_screen.js","sourceRoot":"","sources":["../../../src/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAA;AACvF,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,0BAA0B,EAAE,MAAM,2DAA2D,CAAA;AAItG,MAAM,cAAc,GAAG,CAAC,CAAA;AAExB,MAAM,UAAU,+CAA+C,CAC7D,MAA+C;IAE/C,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAA;IAChD,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAA;IACtD,MAAM,CAAC,cAAc,EAAE,iBAAiB,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,iBAAiB,EAAE;YACjB,iBAAiB,EAAE,EAAE;YACrB,UAAU,EAAE,EAAE;YACd,aAAa,EAAE,CAAC;SACjB;QACD,gBAAgB,EAAE;YAChB,QAAQ,EAAE,EAAE;SACb;QACD,eAAe,EAAE;YACf,iBAAiB,EAAE,EAAE;YACrB,UAAU,EAAE,EAAE;YACd,aAAa,EAAE,CAAC;SACjB;QACD,aAAa,EAAE;YACb,QAAQ,EAAE,EAAE;YACZ,SAAS,EAAE,QAAQ;SACpB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { PlatformPressable } from '@react-navigation/elements'\nimport { useEffect, useState } from 'react'\nimport { FlatList, Pressable, StyleSheet, TextInput, View } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { Avatar, Banner, Icon, Spinner, Text } from '../../components'\nimport { ComponentErrorBoundary } from '../../components/page/component_error_boundary'\nimport { useTheme } from '../../hooks'\nimport { useDirectMessageCandidates } from '../../hooks/direct_messages/use_direct_message_candidates'\nimport { DirectMessageCandidateResource } from '../../types/resources/direct_message_candidate'\nimport { ConversationSelectRecipientsScreenProps } from './types/screen_props'\n\nconst MAX_RECIPIENTS = 9\n\nexport function ConversationSelectDirectMessageRecipientsScreen(\n _props: ConversationSelectRecipientsScreenProps\n) {\n const styles = useStyles()\n const [searchTerm, setSearchTerm] = useState('')\n const [debouncedTerm, setDebouncedTerm] = useState('')\n const [selectedPeople, setSelectedPeople] = useState<Map<string, DirectMessageCandidateResource>>(\n new Map()\n )\n\n useEffect(() => {\n const timer = setTimeout(() => setDebouncedTerm(searchTerm), 200)\n return () => clearTimeout(timer)\n }, [searchTerm])\n\n const selectPerson = (person: DirectMessageCandidateResource) => {\n if (selectedPeople.size >= MAX_RECIPIENTS) return\n setSelectedPeople(prev => new Map(prev).set(person.id, person))\n setSearchTerm('')\n setDebouncedTerm('')\n }\n\n const removePerson = (id: string) => {\n setSelectedPeople(prev => {\n const next = new Map(prev)\n next.delete(id)\n return next\n })\n }\n\n return (\n <View style={styles.container}>\n <ToField\n selectedPeople={selectedPeople}\n searchTerm={searchTerm}\n onSearchChange={setSearchTerm}\n onRemove={removePerson}\n onClear={() => setSelectedPeople(new Map())}\n />\n <ComponentErrorBoundary\n key={debouncedTerm}\n fallback={\n <Banner\n appearance=\"error\"\n description=\"Couldn't load people right now. Try again.\"\n style={styles.errorBanner}\n />\n }\n >\n <CandidateResults\n term={debouncedTerm}\n selectedPeople={selectedPeople}\n onSelect={selectPerson}\n />\n </ComponentErrorBoundary>\n </View>\n )\n}\n\nfunction ToField({\n selectedPeople,\n searchTerm,\n onSearchChange,\n onRemove,\n onClear,\n}: {\n selectedPeople: Map<string, DirectMessageCandidateResource>\n searchTerm: string\n onSearchChange: (term: string) => void\n onRemove: (id: string) => void\n onClear: () => void\n}) {\n const styles = useStyles()\n const { colors } = useTheme()\n const hasSelections = selectedPeople.size > 0\n\n return (\n <View style={styles.toField}>\n <View style={styles.toFieldHeader}>\n <Text style={styles.toLabel}>To</Text>\n {hasSelections && (\n <Pressable onPress={onClear} hitSlop={8}>\n <Text style={styles.clearButton}>Clear</Text>\n </Pressable>\n )}\n </View>\n <View style={styles.toInputArea}>\n {[...selectedPeople.values()].map(person => (\n <PersonChip key={person.id} person={person} onRemove={onRemove} />\n ))}\n <TextInput\n autoFocus\n placeholder=\"Search\"\n placeholderTextColor={colors.textColorDefaultPlaceholder}\n value={searchTerm}\n onChangeText={onSearchChange}\n style={styles.toTextInput}\n returnKeyType=\"search\"\n />\n </View>\n </View>\n )\n}\n\nfunction PersonChip({\n person,\n onRemove,\n}: {\n person: DirectMessageCandidateResource\n onRemove: (id: string) => void\n}) {\n const styles = useStyles()\n\n return (\n <View style={styles.chip}>\n <Avatar sourceUri={person.avatar} size=\"sm\" showFallback />\n <Text style={styles.chipName}>{person.name}</Text>\n <Pressable\n onPress={() => onRemove(person.id)}\n hitSlop={8}\n accessibilityLabel={`Remove ${person.name}`}\n >\n <Icon name=\"general.x\" size={12} style={styles.chipRemoveIcon} />\n </Pressable>\n </View>\n )\n}\n\nfunction CandidateResults({\n term,\n selectedPeople,\n onSelect,\n}: {\n term: string\n selectedPeople: Map<string, DirectMessageCandidateResource>\n onSelect: (candidate: DirectMessageCandidateResource) => void\n}) {\n const styles = useStyles()\n const { data, isFetching } = useDirectMessageCandidates(term)\n\n if (term.length < 1) {\n if (selectedPeople.size > 0) return null\n\n return (\n <View style={styles.emptyState}>\n <Icon name=\"churchCenter.people\" size={40} style={styles.emptyStateIcon} />\n <Text style={styles.emptyStateTitle}>Search for people to direct message</Text>\n <Text variant=\"secondary\" style={styles.emptyStateSubtitle}>\n Start a conversation with people in your groups and teams.\n </Text>\n </View>\n )\n }\n\n if (selectedPeople.size >= MAX_RECIPIENTS) {\n return (\n <View style={styles.emptyState}>\n <Text variant=\"secondary\" style={styles.emptyStateSubtitle}>\n You can add up to {MAX_RECIPIENTS} people to a direct message.\n </Text>\n </View>\n )\n }\n\n const unselectedCandidates = (data?.data ?? []).filter(c => !selectedPeople.has(c.id))\n\n if (isFetching && unselectedCandidates.length === 0) {\n return (\n <View style={styles.emptyState}>\n <Spinner />\n </View>\n )\n }\n\n if (!isFetching && unselectedCandidates.length === 0) {\n return (\n <View style={styles.emptyState}>\n <Icon name=\"general.search\" size={32} style={styles.emptyStateIcon} />\n <Text style={styles.emptyStateTitle}>No matches for \"{term}\"</Text>\n <Text variant=\"secondary\" style={styles.emptyStateSubtitle}>\n Try a different name, or check that you share a group or team with them.\n </Text>\n </View>\n )\n }\n\n const hasTruncated = (data?.meta.totalCount ?? 0) > (data?.data.length ?? 0)\n\n return (\n <CandidateList\n candidates={unselectedCandidates}\n hasTruncated={hasTruncated}\n onSelect={onSelect}\n />\n )\n}\n\nfunction CandidateList({\n candidates,\n hasTruncated,\n onSelect,\n}: {\n candidates: DirectMessageCandidateResource[]\n hasTruncated: boolean\n onSelect: (candidate: DirectMessageCandidateResource) => void\n}) {\n const styles = useStyles()\n const available = candidates.filter(c => !c.directMessagesDisabled)\n const dmDisabled = candidates.filter(c => c.directMessagesDisabled)\n\n return (\n <FlatList<DirectMessageCandidateResource>\n data={available}\n keyExtractor={item => item.id}\n renderItem={({ item }) => <CandidateItem candidate={item} onPress={() => onSelect(item)} />}\n ListHeaderComponent={\n <View style={styles.resultsHeader}>\n <Text style={styles.resultsHeading}>Results</Text>\n </View>\n }\n ListFooterComponent={\n <>\n {dmDisabled.length > 0 && (\n <>\n <View style={styles.unavailableHeader}>\n <Text variant=\"secondary\" style={styles.unavailableLabel}>\n Unavailable for direct messages\n </Text>\n </View>\n {dmDisabled.map(candidate => (\n <CandidateItem key={candidate.id} candidate={candidate} disabled />\n ))}\n </>\n )}\n {hasTruncated && (\n <View style={styles.truncatedFooter}>\n <Text variant=\"secondary\" style={styles.truncatedText}>\n Keep typing to narrow your results.\n </Text>\n </View>\n )}\n </>\n }\n />\n )\n}\n\nfunction CandidateItem({\n candidate,\n onPress,\n disabled = false,\n}: {\n candidate: DirectMessageCandidateResource\n onPress?: () => void\n disabled?: boolean\n}) {\n const styles = useStyles()\n\n return (\n <PlatformPressable\n onPress={disabled ? undefined : onPress}\n accessibilityRole=\"button\"\n accessibilityLabel={`Select ${candidate.name}`}\n accessibilityState={{ disabled }}\n >\n <View style={[styles.row, disabled && styles.candidateDisabled]}>\n <Avatar sourceUri={candidate.avatar} size=\"lg\" showFallback />\n <Text style={styles.rowName}>{candidate.name}</Text>\n </View>\n </PlatformPressable>\n )\n}\n\nconst useStyles = () => {\n const { bottom } = useSafeAreaInsets()\n const { colors } = useTheme()\n\n return StyleSheet.create({\n container: {\n flex: 1,\n paddingBottom: bottom,\n },\n toField: {\n paddingHorizontal: 16,\n paddingTop: 16,\n paddingBottom: 8,\n },\n toFieldHeader: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n alignItems: 'center',\n marginBottom: 8,\n },\n toLabel: {\n fontWeight: '600',\n color: colors.textColorDefaultSecondary,\n },\n clearButton: {\n color: colors.interaction,\n },\n toInputArea: {\n flexDirection: 'row',\n flexWrap: 'wrap',\n alignItems: 'center',\n gap: 6,\n borderWidth: 1,\n borderColor: colors.borderColorDefaultBase,\n borderRadius: 8,\n paddingHorizontal: 10,\n paddingVertical: 8,\n },\n toTextInput: {\n flex: 1,\n minWidth: 80,\n color: colors.textColorDefaultPrimary,\n fontSize: 16,\n paddingVertical: 2,\n },\n chip: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 4,\n borderWidth: 1,\n borderColor: colors.borderColorDefaultBase,\n borderRadius: 100,\n paddingLeft: 4,\n paddingRight: 6,\n paddingVertical: 3,\n },\n chipName: {\n fontSize: 14,\n },\n chipRemoveIcon: {\n color: colors.iconColorDefaultSecondary,\n },\n errorBanner: {\n margin: 16,\n },\n emptyState: {\n alignItems: 'center',\n paddingTop: 32,\n paddingHorizontal: 32,\n gap: 8,\n },\n emptyStateIcon: {\n color: colors.iconColorDefaultSecondary,\n marginBottom: 4,\n },\n emptyStateTitle: {\n fontWeight: '600',\n textAlign: 'center',\n },\n emptyStateSubtitle: {\n textAlign: 'center',\n fontSize: 14,\n },\n row: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 12,\n paddingHorizontal: 16,\n paddingVertical: 12,\n borderBottomWidth: 1,\n borderColor: colors.fillColorNeutral050Base,\n },\n rowName: {\n flex: 1,\n },\n candidateDisabled: {\n opacity: 0.5,\n },\n resultsHeader: {\n paddingHorizontal: 16,\n paddingTop: 16,\n paddingBottom: 8,\n },\n resultsHeading: {\n fontWeight: '600',\n },\n unavailableHeader: {\n paddingHorizontal: 16,\n paddingTop: 16,\n paddingBottom: 8,\n },\n unavailableLabel: {\n fontSize: 13,\n },\n truncatedFooter: {\n paddingHorizontal: 16,\n paddingTop: 12,\n paddingBottom: 8,\n },\n truncatedText: {\n fontSize: 13,\n textAlign: 'center',\n },\n })\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ResourceObject } from '../api_primitives';
|
|
2
|
+
export interface DirectMessageAffiliationsResource extends ResourceObject {
|
|
3
|
+
type: 'DirectMessageAffiliations';
|
|
4
|
+
id: string;
|
|
5
|
+
groups: Record<string, string>;
|
|
6
|
+
teams: Record<string, string>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=direct_message_affiliations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"direct_message_affiliations.d.ts","sourceRoot":"","sources":["../../../src/types/resources/direct_message_affiliations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAElD,MAAM,WAAW,iCAAkC,SAAQ,cAAc;IACvE,IAAI,EAAE,2BAA2B,CAAA;IACjC,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC9B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"direct_message_affiliations.js","sourceRoot":"","sources":["../../../src/types/resources/direct_message_affiliations.ts"],"names":[],"mappings":"","sourcesContent":["import { ResourceObject } from '../api_primitives'\n\nexport interface DirectMessageAffiliationsResource extends ResourceObject {\n type: 'DirectMessageAffiliations'\n id: string\n groups: Record<string, string>\n teams: Record<string, string>\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ResourceObject } from '../api_primitives';
|
|
2
|
+
export interface DirectMessageCandidateResource extends ResourceObject {
|
|
3
|
+
type: 'DirectMessageCandidate';
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
avatar: string;
|
|
7
|
+
groups: number[];
|
|
8
|
+
teams: number[];
|
|
9
|
+
under_18: boolean;
|
|
10
|
+
directMessagesDisabled: boolean;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=direct_message_candidate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"direct_message_candidate.d.ts","sourceRoot":"","sources":["../../../src/types/resources/direct_message_candidate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAElD,MAAM,WAAW,8BAA+B,SAAQ,cAAc;IACpE,IAAI,EAAE,wBAAwB,CAAA;IAC9B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,QAAQ,EAAE,OAAO,CAAA;IACjB,sBAAsB,EAAE,OAAO,CAAA;CAChC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"direct_message_candidate.js","sourceRoot":"","sources":["../../../src/types/resources/direct_message_candidate.ts"],"names":[],"mappings":"","sourcesContent":["import { ResourceObject } from '../api_primitives'\n\nexport interface DirectMessageCandidateResource extends ResourceObject {\n type: 'DirectMessageCandidate'\n id: string\n name: string\n avatar: string\n groups: number[]\n teams: number[]\n under_18: boolean\n directMessagesDisabled: boolean\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/resources/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,2BAA2B,CAAA;AACzC,cAAc,yBAAyB,CAAA;AACvC,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/resources/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,gBAAgB,CAAA;AAC9B,cAAc,2BAA2B,CAAA;AACzC,cAAc,yBAAyB,CAAA;AACvC,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA"}
|