@planningcenter/chat-react-native 2.2.2-rc.1 → 2.3.0-rc.0
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/components/conversations.d.ts.map +1 -1
- package/build/components/conversations.js +4 -0
- package/build/components/conversations.js.map +1 -1
- package/build/components/display/action_button.d.ts +8 -0
- package/build/components/display/action_button.d.ts.map +1 -0
- package/build/components/display/action_button.js +44 -0
- package/build/components/display/action_button.js.map +1 -0
- package/build/contexts/api_provider.js +2 -2
- package/build/contexts/api_provider.js.map +1 -1
- package/build/hooks/index.d.ts +2 -0
- package/build/hooks/index.d.ts.map +1 -1
- package/build/hooks/index.js +2 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/use_api.d.ts +383 -0
- package/build/hooks/use_api.d.ts.map +1 -0
- package/build/hooks/use_api.js +40 -0
- package/build/hooks/use_api.js.map +1 -0
- package/build/hooks/use_api_client.d.ts +5 -3
- package/build/hooks/use_api_client.d.ts.map +1 -1
- package/build/hooks/use_api_client.js +1 -1
- package/build/hooks/use_api_client.js.map +1 -1
- package/build/hooks/use_chat_permissions.d.ts +172 -0
- package/build/hooks/use_chat_permissions.d.ts.map +1 -0
- package/build/hooks/use_chat_permissions.js +17 -0
- package/build/hooks/use_chat_permissions.js.map +1 -0
- package/build/hooks/use_conversation.d.ts.map +1 -1
- package/build/hooks/use_conversation.js +6 -5
- package/build/hooks/use_conversation.js.map +1 -1
- package/build/hooks/use_suspense_api.d.ts +13 -4
- package/build/hooks/use_suspense_api.d.ts.map +1 -1
- package/build/hooks/use_suspense_api.js +1 -0
- package/build/hooks/use_suspense_api.js.map +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/build/navigation/index.d.ts +123 -2
- package/build/navigation/index.d.ts.map +1 -1
- package/build/navigation/index.js +40 -4
- package/build/navigation/index.js.map +1 -1
- package/build/navigation/screenLayout.js +1 -1
- package/build/navigation/screenLayout.js.map +1 -1
- package/build/screens/create/conversation_create_screen.d.ts +9 -0
- package/build/screens/create/conversation_create_screen.d.ts.map +1 -0
- package/build/screens/create/conversation_create_screen.js +123 -0
- package/build/screens/create/conversation_create_screen.js.map +1 -0
- package/build/screens/create/conversation_filter_recipients_screen.d.ts +8 -0
- package/build/screens/create/conversation_filter_recipients_screen.d.ts.map +1 -0
- package/build/screens/create/conversation_filter_recipients_screen.js +52 -0
- package/build/screens/create/conversation_filter_recipients_screen.js.map +1 -0
- package/build/screens/create/conversation_select_recipients_screen.d.ts +8 -0
- package/build/screens/create/conversation_select_recipients_screen.d.ts.map +1 -0
- package/build/screens/create/conversation_select_recipients_screen.js +105 -0
- package/build/screens/create/conversation_select_recipients_screen.js.map +1 -0
- package/build/types/resources/app_grant.d.ts +6 -0
- package/build/types/resources/app_grant.d.ts.map +1 -0
- package/build/types/resources/app_grant.js +2 -0
- package/build/types/resources/app_grant.js.map +1 -0
- package/build/types/resources/groups/groups_group_resource.d.ts +12 -0
- package/build/types/resources/groups/groups_group_resource.d.ts.map +1 -0
- package/build/types/resources/groups/groups_group_resource.js +2 -0
- package/build/types/resources/groups/groups_group_resource.js.map +1 -0
- package/build/types/resources/groups/index.d.ts +2 -0
- package/build/types/resources/groups/index.d.ts.map +1 -0
- package/build/types/resources/groups/index.js +2 -0
- package/build/types/resources/groups/index.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/components/conversations.tsx +8 -0
- package/src/components/display/action_button.tsx +62 -0
- package/src/contexts/api_provider.tsx +2 -2
- package/src/hooks/index.ts +2 -0
- package/src/hooks/use_api.ts +80 -0
- package/src/hooks/use_api_client.ts +13 -15
- package/src/hooks/use_chat_permissions.ts +20 -0
- package/src/hooks/use_conversation.ts +6 -5
- package/src/hooks/use_suspense_api.ts +16 -4
- package/src/index.tsx +1 -1
- package/src/navigation/index.tsx +46 -7
- package/src/navigation/screenLayout.tsx +1 -1
- package/src/screens/create/conversation_create_screen.tsx +148 -0
- package/src/screens/create/conversation_filter_recipients_screen.tsx +79 -0
- package/src/screens/create/conversation_select_recipients_screen.tsx +136 -0
- package/src/types/resources/app_grant.ts +6 -0
- package/src/types/resources/groups/groups_group_resource.ts +12 -0
- package/src/types/resources/groups/index.ts +1 -0
- package/src/types/resources/index.ts +2 -0
- package/build/contexts/index.d.ts +0 -3
- package/build/contexts/index.d.ts.map +0 -1
- package/build/contexts/index.js +0 -3
- package/build/contexts/index.js.map +0 -1
- package/src/contexts/index.ts +0 -2
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Client } from '../utils/client';
|
|
2
|
-
type App = 'chat' | 'groups';
|
|
3
|
-
export type ApiClient =
|
|
4
|
-
|
|
2
|
+
type App = 'chat' | 'groups' | 'services';
|
|
3
|
+
export type ApiClient = {
|
|
4
|
+
[_K in App]: Client;
|
|
5
|
+
};
|
|
6
|
+
export declare const useApiClient: () => ApiClient;
|
|
5
7
|
export {};
|
|
6
8
|
//# sourceMappingURL=use_api_client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_api_client.d.ts","sourceRoot":"","sources":["../../src/hooks/use_api_client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAExC,KAAK,GAAG,GAAG,MAAM,GAAG,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"use_api_client.d.ts","sourceRoot":"","sources":["../../src/hooks/use_api_client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAExC,KAAK,GAAG,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,CAAA;AAGzC,MAAM,MAAM,SAAS,GAAG;KAAG,EAAE,IAAI,GAAG,GAAG,MAAM;CAAE,CAAA;AAE/C,eAAO,MAAM,YAAY,iBAiBxB,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useContext, useMemo } from 'react';
|
|
2
2
|
import { ChatContext } from '../contexts/chat_context';
|
|
3
3
|
import { Client } from '../utils/client';
|
|
4
|
-
const apps = ['chat', 'groups'];
|
|
4
|
+
const apps = ['chat', 'groups', 'services'];
|
|
5
5
|
export const useApiClient = () => {
|
|
6
6
|
const { session, onTokenExpired } = useContext(ChatContext);
|
|
7
7
|
const api = useMemo(() => apps.reduce((acc, app) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_api_client.js","sourceRoot":"","sources":["../../src/hooks/use_api_client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAGxC,MAAM,IAAI,GAAU,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"use_api_client.js","sourceRoot":"","sources":["../../src/hooks/use_api_client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAGxC,MAAM,IAAI,GAAU,CAAC,MAAM,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAA;AAIlD,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,EAAE;IAC/B,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,UAAU,CAAC,WAAW,CAAC,CAAA;IAC3D,MAAM,GAAG,GAAG,OAAO,CACjB,GAAG,EAAE,CACH,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QACvB,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,MAAM,CAAC;YACpB,GAAG;YACH,OAAO;YACP,OAAO,EAAE,YAAY;YACrB,cAAc;SACf,CAAC,CAAA;QACF,OAAO,GAAG,CAAA;IACZ,CAAC,EAAE,EAAe,CAAC,EACrB,CAAC,OAAO,EAAE,cAAc,CAAC,CAC1B,CAAA;IAED,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA","sourcesContent":["import { useContext, useMemo } from 'react'\nimport { ChatContext } from '../contexts/chat_context'\nimport { Client } from '../utils/client'\n\ntype App = 'chat' | 'groups' | 'services'\nconst apps: App[] = ['chat', 'groups', 'services']\n\nexport type ApiClient = { [_K in App]: Client }\n\nexport const useApiClient = () => {\n const { session, onTokenExpired } = useContext(ChatContext)\n const api = useMemo(\n () =>\n apps.reduce((acc, app) => {\n acc[app] = new Client({\n app,\n session,\n version: '2018-11-01',\n onTokenExpired,\n })\n return acc\n }, {} as ApiClient),\n [session, onTokenExpired]\n )\n\n return api\n}\n"]}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { AppGrantsResource } from '../types';
|
|
2
|
+
export declare function useAppGrants(): {
|
|
3
|
+
error: Response;
|
|
4
|
+
isError: true;
|
|
5
|
+
isPending: false;
|
|
6
|
+
isLoading: false;
|
|
7
|
+
isLoadingError: false;
|
|
8
|
+
isRefetchError: true;
|
|
9
|
+
isSuccess: false;
|
|
10
|
+
isPlaceholderData: false;
|
|
11
|
+
status: "error";
|
|
12
|
+
dataUpdatedAt: number;
|
|
13
|
+
errorUpdatedAt: number;
|
|
14
|
+
failureCount: number;
|
|
15
|
+
failureReason: Response | null;
|
|
16
|
+
errorUpdateCount: number;
|
|
17
|
+
isFetched: boolean;
|
|
18
|
+
isFetchedAfterMount: boolean;
|
|
19
|
+
isFetching: boolean;
|
|
20
|
+
isInitialLoading: boolean;
|
|
21
|
+
isPaused: boolean;
|
|
22
|
+
isRefetching: boolean;
|
|
23
|
+
isStale: boolean;
|
|
24
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<import("../types").ApiResource<AppGrantsResource[]>, Response>>;
|
|
25
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
26
|
+
promise: Promise<import("../types").ApiResource<AppGrantsResource[]>>;
|
|
27
|
+
data?: AppGrantsResource[] | undefined;
|
|
28
|
+
links?: Record<string, string> | undefined;
|
|
29
|
+
meta?: Record<string, unknown> | undefined;
|
|
30
|
+
} | {
|
|
31
|
+
error: null;
|
|
32
|
+
isError: false;
|
|
33
|
+
isPending: false;
|
|
34
|
+
isLoading: false;
|
|
35
|
+
isLoadingError: false;
|
|
36
|
+
isRefetchError: false;
|
|
37
|
+
isSuccess: true;
|
|
38
|
+
isPlaceholderData: false;
|
|
39
|
+
status: "success";
|
|
40
|
+
dataUpdatedAt: number;
|
|
41
|
+
errorUpdatedAt: number;
|
|
42
|
+
failureCount: number;
|
|
43
|
+
failureReason: Response | null;
|
|
44
|
+
errorUpdateCount: number;
|
|
45
|
+
isFetched: boolean;
|
|
46
|
+
isFetchedAfterMount: boolean;
|
|
47
|
+
isFetching: boolean;
|
|
48
|
+
isInitialLoading: boolean;
|
|
49
|
+
isPaused: boolean;
|
|
50
|
+
isRefetching: boolean;
|
|
51
|
+
isStale: boolean;
|
|
52
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<import("../types").ApiResource<AppGrantsResource[]>, Response>>;
|
|
53
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
54
|
+
promise: Promise<import("../types").ApiResource<AppGrantsResource[]>>;
|
|
55
|
+
data?: AppGrantsResource[] | undefined;
|
|
56
|
+
links?: Record<string, string> | undefined;
|
|
57
|
+
meta?: Record<string, unknown> | undefined;
|
|
58
|
+
} | {
|
|
59
|
+
error: Response;
|
|
60
|
+
isError: true;
|
|
61
|
+
isPending: false;
|
|
62
|
+
isLoading: false;
|
|
63
|
+
isLoadingError: true;
|
|
64
|
+
isRefetchError: false;
|
|
65
|
+
isSuccess: false;
|
|
66
|
+
isPlaceholderData: false;
|
|
67
|
+
status: "error";
|
|
68
|
+
dataUpdatedAt: number;
|
|
69
|
+
errorUpdatedAt: number;
|
|
70
|
+
failureCount: number;
|
|
71
|
+
failureReason: Response | null;
|
|
72
|
+
errorUpdateCount: number;
|
|
73
|
+
isFetched: boolean;
|
|
74
|
+
isFetchedAfterMount: boolean;
|
|
75
|
+
isFetching: boolean;
|
|
76
|
+
isInitialLoading: boolean;
|
|
77
|
+
isPaused: boolean;
|
|
78
|
+
isRefetching: boolean;
|
|
79
|
+
isStale: boolean;
|
|
80
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<import("../types").ApiResource<AppGrantsResource[]>, Response>>;
|
|
81
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
82
|
+
promise: Promise<import("../types").ApiResource<AppGrantsResource[]>>;
|
|
83
|
+
data?: AppGrantsResource[] | undefined;
|
|
84
|
+
links?: Record<string, string> | undefined;
|
|
85
|
+
meta?: Record<string, unknown> | undefined;
|
|
86
|
+
} | {
|
|
87
|
+
error: null;
|
|
88
|
+
isError: false;
|
|
89
|
+
isPending: true;
|
|
90
|
+
isLoading: true;
|
|
91
|
+
isLoadingError: false;
|
|
92
|
+
isRefetchError: false;
|
|
93
|
+
isSuccess: false;
|
|
94
|
+
isPlaceholderData: false;
|
|
95
|
+
status: "pending";
|
|
96
|
+
dataUpdatedAt: number;
|
|
97
|
+
errorUpdatedAt: number;
|
|
98
|
+
failureCount: number;
|
|
99
|
+
failureReason: Response | null;
|
|
100
|
+
errorUpdateCount: number;
|
|
101
|
+
isFetched: boolean;
|
|
102
|
+
isFetchedAfterMount: boolean;
|
|
103
|
+
isFetching: boolean;
|
|
104
|
+
isInitialLoading: boolean;
|
|
105
|
+
isPaused: boolean;
|
|
106
|
+
isRefetching: boolean;
|
|
107
|
+
isStale: boolean;
|
|
108
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<import("../types").ApiResource<AppGrantsResource[]>, Response>>;
|
|
109
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
110
|
+
promise: Promise<import("../types").ApiResource<AppGrantsResource[]>>;
|
|
111
|
+
data?: AppGrantsResource[] | undefined;
|
|
112
|
+
links?: Record<string, string> | undefined;
|
|
113
|
+
meta?: Record<string, unknown> | undefined;
|
|
114
|
+
} | {
|
|
115
|
+
error: null;
|
|
116
|
+
isError: false;
|
|
117
|
+
isPending: true;
|
|
118
|
+
isLoadingError: false;
|
|
119
|
+
isRefetchError: false;
|
|
120
|
+
isSuccess: false;
|
|
121
|
+
isPlaceholderData: false;
|
|
122
|
+
status: "pending";
|
|
123
|
+
dataUpdatedAt: number;
|
|
124
|
+
errorUpdatedAt: number;
|
|
125
|
+
failureCount: number;
|
|
126
|
+
failureReason: Response | null;
|
|
127
|
+
errorUpdateCount: number;
|
|
128
|
+
isFetched: boolean;
|
|
129
|
+
isFetchedAfterMount: boolean;
|
|
130
|
+
isFetching: boolean;
|
|
131
|
+
isLoading: boolean;
|
|
132
|
+
isInitialLoading: boolean;
|
|
133
|
+
isPaused: boolean;
|
|
134
|
+
isRefetching: boolean;
|
|
135
|
+
isStale: boolean;
|
|
136
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<import("../types").ApiResource<AppGrantsResource[]>, Response>>;
|
|
137
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
138
|
+
promise: Promise<import("../types").ApiResource<AppGrantsResource[]>>;
|
|
139
|
+
data?: AppGrantsResource[] | undefined;
|
|
140
|
+
links?: Record<string, string> | undefined;
|
|
141
|
+
meta?: Record<string, unknown> | undefined;
|
|
142
|
+
} | {
|
|
143
|
+
isError: false;
|
|
144
|
+
error: null;
|
|
145
|
+
isPending: false;
|
|
146
|
+
isLoading: false;
|
|
147
|
+
isLoadingError: false;
|
|
148
|
+
isRefetchError: false;
|
|
149
|
+
isSuccess: true;
|
|
150
|
+
isPlaceholderData: true;
|
|
151
|
+
status: "success";
|
|
152
|
+
dataUpdatedAt: number;
|
|
153
|
+
errorUpdatedAt: number;
|
|
154
|
+
failureCount: number;
|
|
155
|
+
failureReason: Response | null;
|
|
156
|
+
errorUpdateCount: number;
|
|
157
|
+
isFetched: boolean;
|
|
158
|
+
isFetchedAfterMount: boolean;
|
|
159
|
+
isFetching: boolean;
|
|
160
|
+
isInitialLoading: boolean;
|
|
161
|
+
isPaused: boolean;
|
|
162
|
+
isRefetching: boolean;
|
|
163
|
+
isStale: boolean;
|
|
164
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<import("../types").ApiResource<AppGrantsResource[]>, Response>>;
|
|
165
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
166
|
+
promise: Promise<import("../types").ApiResource<AppGrantsResource[]>>;
|
|
167
|
+
data?: AppGrantsResource[] | undefined;
|
|
168
|
+
links?: Record<string, string> | undefined;
|
|
169
|
+
meta?: Record<string, unknown> | undefined;
|
|
170
|
+
};
|
|
171
|
+
export declare function useCanCreateConversations(): boolean;
|
|
172
|
+
//# sourceMappingURL=use_chat_permissions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use_chat_permissions.d.ts","sourceRoot":"","sources":["../../src/hooks/use_chat_permissions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAG5C,wBAAgB,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAU3B;AAED,wBAAgB,yBAAyB,IAAI,OAAO,CAInD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useApiGet } from './use_api';
|
|
2
|
+
export function useAppGrants() {
|
|
3
|
+
return useApiGet({
|
|
4
|
+
url: '/me/app_grants',
|
|
5
|
+
data: {
|
|
6
|
+
fields: {
|
|
7
|
+
AppGrant: ['create_conversations', 'app_name'],
|
|
8
|
+
},
|
|
9
|
+
},
|
|
10
|
+
app: 'chat',
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
export function useCanCreateConversations() {
|
|
14
|
+
const { data: appGrants = [] } = useAppGrants();
|
|
15
|
+
return appGrants.some(appGrant => appGrant.createConversations);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=use_chat_permissions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use_chat_permissions.js","sourceRoot":"","sources":["../../src/hooks/use_chat_permissions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAErC,MAAM,UAAU,YAAY;IAC1B,OAAO,SAAS,CAAsB;QACpC,GAAG,EAAE,gBAAgB;QACrB,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,QAAQ,EAAE,CAAC,sBAAsB,EAAE,UAAU,CAAC;aAC/C;SACF;QACD,GAAG,EAAE,MAAM;KACZ,CAAC,CAAA;AACJ,CAAC;AAED,MAAM,UAAU,yBAAyB;IACvC,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,EAAE,EAAE,GAAG,YAAY,EAAE,CAAA;IAE/C,OAAO,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAA;AACjE,CAAC","sourcesContent":["import { AppGrantsResource } from '../types'\nimport { useApiGet } from './use_api'\n\nexport function useAppGrants() {\n return useApiGet<AppGrantsResource[]>({\n url: '/me/app_grants',\n data: {\n fields: {\n AppGrant: ['create_conversations', 'app_name'],\n },\n },\n app: 'chat',\n })\n}\n\nexport function useCanCreateConversations(): boolean {\n const { data: appGrants = [] } = useAppGrants()\n\n return appGrants.some(appGrant => appGrant.createConversations)\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_conversation.d.ts","sourceRoot":"","sources":["../../src/hooks/use_conversation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use_conversation.d.ts","sourceRoot":"","sources":["../../src/hooks/use_conversation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAK5D,eAAO,MAAM,0BAA0B,wBAAyB;IAAE,eAAe,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;CAyBzF,CAAA;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAE3B,CAAA;AAED,eAAO,MAAM,mBAAmB,wBAAyB;IAAE,eAAe,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0CnF,CAAA;AAED,eAAO,MAAM,qBAAqB,wBAAyB;IAAE,eAAe,EAAE,MAAM,CAAA;CAAE,qIA+BrF,CAAA"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { useMutation } from '@tanstack/react-query';
|
|
2
|
-
import { getRequestQueryKey, useSuspenseGet } from './use_suspense_api';
|
|
3
|
-
import { queryClient } from '../contexts';
|
|
4
|
-
import { useApiClient } from './use_api_client';
|
|
5
|
-
import { transformGetToPost } from '../utils/client/request_helpers';
|
|
1
|
+
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
|
6
2
|
import { useState } from 'react';
|
|
3
|
+
import { transformGetToPost } from '../utils/client/request_helpers';
|
|
4
|
+
import { useApiClient } from './use_api_client';
|
|
5
|
+
import { getRequestQueryKey, useSuspenseGet } from './use_suspense_api';
|
|
7
6
|
export const getConversationRequestArgs = ({ conversation_id }) => ({
|
|
8
7
|
url: `/me/conversations/${conversation_id}`,
|
|
9
8
|
data: {
|
|
@@ -35,6 +34,7 @@ export const useConversation = ({ conversation_id }) => {
|
|
|
35
34
|
};
|
|
36
35
|
export const useConversationMute = ({ conversation_id }) => {
|
|
37
36
|
const apiClient = useApiClient();
|
|
37
|
+
const queryClient = useQueryClient();
|
|
38
38
|
const requestArgs = getConversationRequestArgs({ conversation_id });
|
|
39
39
|
const queryKey = getRequestQueryKey(requestArgs);
|
|
40
40
|
const { data: conversation } = useConversation({ conversation_id });
|
|
@@ -73,6 +73,7 @@ export const useConversationMute = ({ conversation_id }) => {
|
|
|
73
73
|
};
|
|
74
74
|
export const useConversationUpdate = ({ conversation_id }) => {
|
|
75
75
|
const apiClient = useApiClient();
|
|
76
|
+
const queryClient = useQueryClient();
|
|
76
77
|
const requestArgs = getConversationRequestArgs({ conversation_id });
|
|
77
78
|
const queryKey = getRequestQueryKey(requestArgs);
|
|
78
79
|
return useMutation({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_conversation.js","sourceRoot":"","sources":["../../src/hooks/use_conversation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"use_conversation.js","sourceRoot":"","sources":["../../src/hooks/use_conversation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEhC,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAA;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAEvE,MAAM,CAAC,MAAM,0BAA0B,GAAG,C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AAQ,CAAC,CAAA;QACvF,CAAC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { useMutation, useQueryClient } from '@tanstack/react-query'\nimport { useState } from 'react'\nimport { ApiResource, ConversationResource } from '../types'\nimport { transformGetToPost } from '../utils/client/request_helpers'\nimport { useApiClient } from './use_api_client'\nimport { getRequestQueryKey, useSuspenseGet } from './use_suspense_api'\n\nexport const getConversationRequestArgs = ({ conversation_id }: { conversation_id: string }) => ({\n url: `/me/conversations/${conversation_id}`,\n data: {\n fields: {\n Conversation: [\n 'created_at',\n 'badges',\n 'groups',\n 'last_message_author_id',\n 'last_message_author_name',\n 'last_message_created_at',\n 'last_message_text_preview',\n 'preview_avatar_urls',\n 'member_ability',\n 'muted',\n 'replies_disabled',\n 'title',\n 'unread_count',\n 'updated_at',\n ],\n MemberAbility: ['can_update', 'can_delete'],\n ConversationBadge: ['app_name', 'pco_resource_type', 'text'],\n },\n include: ['badges', 'member_ability'],\n },\n})\n\nexport const useConversation = ({ conversation_id }) => {\n return useSuspenseGet<ConversationResource>(getConversationRequestArgs({ conversation_id }))\n}\n\nexport const useConversationMute = ({ conversation_id }: { conversation_id: string }) => {\n const apiClient = useApiClient()\n const queryClient = useQueryClient()\n const requestArgs = getConversationRequestArgs({ conversation_id })\n const queryKey = getRequestQueryKey(requestArgs)\n const { data: conversation } = useConversation({ conversation_id })\n const [value, setValue] = useState<boolean>(conversation.muted)\n\n const { mutate: setMuted, ...mutation } = useMutation({\n onMutate: async (muted: boolean) => {\n return queryClient.setQueryData<ApiResource<ConversationResource>>(queryKey, prev => {\n if (!prev?.data) return prev\n setValue(muted)\n prev.data.muted = muted\n\n return prev\n })\n },\n mutationKey: ['muteConversation'],\n mutationFn: async (muted: boolean) => {\n const action = muted ? 'mute' : 'unmute'\n\n return apiClient.chat.post({\n url: `/me/conversations/${conversation_id}/${action}`,\n data: { data: { type: '', attributes: {} }, fields: { Conversation: 'muted' } },\n })\n },\n onSuccess: (response: ApiResource<ConversationResource>) => {\n queryClient.setQueryData<ApiResource<ConversationResource>>(queryKey, prev => {\n if (!prev?.data) return prev\n\n // Posting to the mute action endpoint can't return all the fields\n // so we need to set only the fields we require\n prev.data.muted = response.data.muted\n setValue(response.data.muted)\n\n return prev\n })\n },\n })\n\n return { muted: value, setMuted, ...mutation }\n}\n\nexport const useConversationUpdate = ({ conversation_id }: { conversation_id: string }) => {\n const apiClient = useApiClient()\n const queryClient = useQueryClient()\n const requestArgs = getConversationRequestArgs({ conversation_id })\n const queryKey = getRequestQueryKey(requestArgs)\n\n return useMutation({\n onMutate: async (update: Partial<ConversationResource>) => {\n queryClient.setQueryData<ApiResource<ConversationResource>>(queryKey, prev => {\n if (prev?.data) {\n prev.data = {\n ...prev.data,\n ...update,\n }\n }\n\n return prev\n })\n },\n mutationKey: ['mutateConversation'],\n mutationFn: async (update: Partial<ConversationResource>) => {\n const postArgs = transformGetToPost(requestArgs).data\n return apiClient.chat.patch({\n url: `/me/conversations/${conversation_id}/`,\n data: { data: { type: '', attributes: update }, ...postArgs },\n })\n },\n onSuccess: (response: ApiResource<ConversationResource>) => {\n queryClient.setQueryData<ApiResource<ConversationResource>>(queryKey, () => response)\n },\n })\n}\n"]}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { AnyUseSuspenseInfiniteQueryOptions, InfiniteData } from '@tanstack/react-query';
|
|
2
2
|
import { ApiCollection, ApiResource, ResourceObject } from '../types';
|
|
3
3
|
import { GetRequest } from '../utils/client/types';
|
|
4
|
-
|
|
4
|
+
interface SuspenseGetOptions extends GetRequest {
|
|
5
|
+
app?: 'chat' | 'groups';
|
|
6
|
+
}
|
|
7
|
+
export declare const useSuspenseGet: <T extends ResourceObject | ResourceObject[]>(args: SuspenseGetOptions) => {
|
|
5
8
|
error: Response | null;
|
|
6
9
|
isError: boolean;
|
|
7
10
|
isPending: false;
|
|
@@ -29,7 +32,7 @@ export declare const useSuspenseGet: <T extends ResourceObject | ResourceObject[
|
|
|
29
32
|
meta: Record<string, unknown>;
|
|
30
33
|
};
|
|
31
34
|
export type SuspensePaginatorOptions = Omit<AnyUseSuspenseInfiniteQueryOptions, 'getNextPageParam' | 'initialPageParam' | 'queryFn' | 'queryKey'>;
|
|
32
|
-
export declare const useSuspensePaginator: <T extends ResourceObject>(args:
|
|
35
|
+
export declare const useSuspensePaginator: <T extends ResourceObject>(args: SuspenseGetOptions, opts?: SuspensePaginatorOptions) => {
|
|
33
36
|
data: T[];
|
|
34
37
|
error: Response | null;
|
|
35
38
|
isError: boolean;
|
|
@@ -62,6 +65,12 @@ export declare const useSuspensePaginator: <T extends ResourceObject>(args: GetR
|
|
|
62
65
|
isFetchPreviousPageError: boolean;
|
|
63
66
|
isFetchingPreviousPage: boolean;
|
|
64
67
|
};
|
|
65
|
-
export type RequestQueryKey = [
|
|
66
|
-
|
|
68
|
+
export type RequestQueryKey = [
|
|
69
|
+
SuspenseGetOptions['url'],
|
|
70
|
+
SuspenseGetOptions['data'],
|
|
71
|
+
SuspenseGetOptions['headers'],
|
|
72
|
+
SuspenseGetOptions['app']
|
|
73
|
+
];
|
|
74
|
+
export declare const getRequestQueryKey: (args: SuspenseGetOptions) => RequestQueryKey;
|
|
75
|
+
export {};
|
|
67
76
|
//# sourceMappingURL=use_suspense_api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_suspense_api.d.ts","sourceRoot":"","sources":["../../src/hooks/use_suspense_api.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kCAAkC,EAClC,YAAY,EAGb,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AACrE,OAAO,EAAE,UAAU,EAAe,MAAM,uBAAuB,CAAA;AAG/D,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,cAAc,GAAG,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"use_suspense_api.d.ts","sourceRoot":"","sources":["../../src/hooks/use_suspense_api.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kCAAkC,EAClC,YAAY,EAGb,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AACrE,OAAO,EAAE,UAAU,EAAe,MAAM,uBAAuB,CAAA;AAG/D,UAAU,kBAAmB,SAAQ,UAAU;IAC7C,GAAG,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAA;CACxB;AAED,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,cAAc,GAAG,cAAc,EAAE,QAClE,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;CASzB,CAAA;AAOD,MAAM,MAAM,wBAAwB,GAAG,IAAI,CACzC,kCAAkC,EAClC,kBAAkB,GAAG,kBAAkB,GAAG,SAAS,GAAG,UAAU,CACjE,CAAA;AAED,eAAO,MAAM,oBAAoB,GAAI,CAAC,SAAS,cAAc,QACrD,kBAAkB,SACjB,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwChC,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,kBAAkB,CAAC,KAAK,CAAC;IACzB,kBAAkB,CAAC,MAAM,CAAC;IAC1B,kBAAkB,CAAC,SAAS,CAAC;IAC7B,kBAAkB,CAAC,KAAK,CAAC;CAC1B,CAAA;AACD,eAAO,MAAM,kBAAkB,SAAU,kBAAkB,KAAG,eAK7D,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_suspense_api.js","sourceRoot":"","sources":["../../src/hooks/use_suspense_api.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,wBAAwB,EACxB,gBAAgB,GACjB,MAAM,uBAAuB,CAAA;AAG9B,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"use_suspense_api.js","sourceRoot":"","sources":["../../src/hooks/use_suspense_api.ts"],"names":[],"mappings":"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AC3B,MAAM,IAAI,GAAa,QAAQ,CAAC,IAAI,EAAE,IAAI,IAAI,EAAE,CAAA;YAChD,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAA;YAE7B,IAAI,IAAI;gBAAE,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAA;YAC3C,IAAI,MAAM;gBAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAA;YAE7C,OAAO,SAAS,CAAA;QAClB,CAAC;QACD,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC;KAChB,CAAC,CAAA;IAEF,MAAM,IAAI,GAAQ,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAA;IAEpE,OAAO,EAAE,GAAG,KAAK,EAAE,IAAI,EAAE,CAAA;AAC3B,CAAC,CAAA;AAQD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,IAAwB,EAAmB,EAAE,CAAC;IAC/E,IAAI,CAAC,GAAG;IACR,IAAI,CAAC,IAAI;IACT,IAAI,CAAC,OAAO;IACZ,IAAI,CAAC,GAAG,IAAI,MAAM;CACnB,CAAA","sourcesContent":["import {\n AnyUseSuspenseInfiniteQueryOptions,\n InfiniteData,\n useSuspenseInfiniteQuery,\n useSuspenseQuery,\n} from '@tanstack/react-query'\nimport { ApiCollection, ApiResource, ResourceObject } from '../types'\nimport { GetRequest, RequestData } from '../utils/client/types'\nimport { useApiClient } from './use_api_client'\n\ninterface SuspenseGetOptions extends GetRequest {\n app?: 'chat' | 'groups'\n}\n\nexport const useSuspenseGet = <T extends ResourceObject | ResourceObject[]>(\n args: SuspenseGetOptions\n) => {\n type Resource = ApiResource<T>\n\n const { data, ...query } = useSuspenseQuery<Resource, Response>({\n queryKey: getRequestQueryKey(args),\n })\n\n return { ...data, ...query }\n}\n\ntype NextMeta = Partial<{\n offset: string\n idLt: string\n}>\n\nexport type SuspensePaginatorOptions = Omit<\n AnyUseSuspenseInfiniteQueryOptions,\n 'getNextPageParam' | 'initialPageParam' | 'queryFn' | 'queryKey'\n>\n\nexport const useSuspensePaginator = <T extends ResourceObject>(\n args: SuspenseGetOptions,\n opts?: SuspensePaginatorOptions\n) => {\n const apiClient = useApiClient()\n const query = useSuspenseInfiniteQuery<\n ApiCollection<T>,\n Response,\n InfiniteData<ApiCollection<T>>,\n any,\n Partial<RequestData> | undefined\n >({\n queryKey: getRequestQueryKey(args),\n queryFn: ({ pageParam }) => {\n const pageParmWhere = pageParam?.where || {}\n const argsWhere = args.data.where || {}\n const where = { ...argsWhere, ...pageParmWhere }\n\n const offset = pageParam?.offset || args.data.offset\n const data = { ...args.data, where, offset }\n\n return apiClient.chat.get({\n url: args.url,\n data,\n })\n },\n initialPageParam: {} as Partial<RequestData>,\n getNextPageParam: lastPage => {\n const next: NextMeta = lastPage.meta?.next || {}\n const { offset, idLt } = next\n\n if (idLt) return { where: { id_lt: idLt } }\n if (offset) return { offset: Number(offset) }\n\n return undefined\n },\n ...(opts || {}),\n })\n\n const data: T[] = query.data?.pages.flatMap(page => page.data) || []\n\n return { ...query, data }\n}\n\nexport type RequestQueryKey = [\n SuspenseGetOptions['url'],\n SuspenseGetOptions['data'],\n SuspenseGetOptions['headers'],\n SuspenseGetOptions['app'],\n]\nexport const getRequestQueryKey = (args: SuspenseGetOptions): RequestQueryKey => [\n args.url,\n args.data,\n args.headers,\n args.app || 'chat',\n]\n"]}
|
package/build/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { ChatProvider, ChatContext, CreateChatThemeProps } from './contexts';
|
|
1
|
+
export { ChatProvider, ChatContext, CreateChatThemeProps } from './contexts/chat_context';
|
|
2
2
|
export { DesignSystemScreen } from './screens';
|
|
3
3
|
export { ChatStack } from './navigation';
|
|
4
4
|
export { TemporaryDefaultColorsType, ChatAdapters, ClipboardAdapter, Session, Client, } from './utils';
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AACzF,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EACL,0BAA0B,EAC1B,YAAY,EACZ,gBAAgB,EAChB,OAAO,EACP,MAAM,GACP,MAAM,SAAS,CAAA"}
|
package/build/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { ChatProvider, ChatContext } from './contexts';
|
|
1
|
+
export { ChatProvider, ChatContext } from './contexts/chat_context';
|
|
2
2
|
export { DesignSystemScreen } from './screens';
|
|
3
3
|
export { ChatStack } from './navigation';
|
|
4
4
|
export { ChatAdapters, ClipboardAdapter, Session, Client, } from './utils';
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAwB,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAwB,MAAM,yBAAyB,CAAA;AACzF,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAEL,YAAY,EACZ,gBAAgB,EAChB,OAAO,EACP,MAAM,GACP,MAAM,SAAS,CAAA","sourcesContent":["export { ChatProvider, ChatContext, CreateChatThemeProps } from './contexts/chat_context'\nexport { DesignSystemScreen } from './screens'\nexport { ChatStack } from './navigation'\nexport {\n TemporaryDefaultColorsType,\n ChatAdapters,\n ClipboardAdapter,\n Session,\n Client,\n} from './utils'\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StaticParamList } from '@react-navigation/native';
|
|
2
|
-
import {
|
|
2
|
+
import { NativeStackHeaderRightProps } from '@react-navigation/native-stack';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { ConversationDetailsScreen } from '../screens/conversation_details_screen';
|
|
5
5
|
import { ConversationScreen } from '../screens/conversation_screen';
|
|
@@ -8,6 +8,64 @@ import { MessageActionsScreen } from '../screens/message_actions_screen';
|
|
|
8
8
|
import { NotFound } from '../screens/not_found';
|
|
9
9
|
import { ReactionsScreen } from '../screens/reactions_screen';
|
|
10
10
|
import { ScreenLayout } from './screenLayout';
|
|
11
|
+
export declare const CreateConversationStack: import("@react-navigation/native").TypedNavigator<{
|
|
12
|
+
ParamList: import("@react-navigation/native").ParamListBase;
|
|
13
|
+
NavigatorID: undefined;
|
|
14
|
+
State: import("@react-navigation/native").StackNavigationState<import("@react-navigation/native").ParamListBase>;
|
|
15
|
+
ScreenOptions: import("@react-navigation/native-stack").NativeStackNavigationOptions;
|
|
16
|
+
EventMap: import("@react-navigation/native-stack").NativeStackNavigationEventMap;
|
|
17
|
+
NavigationList: {
|
|
18
|
+
[x: string]: import("@react-navigation/native-stack").NativeStackNavigationProp<import("@react-navigation/native").ParamListBase, string, undefined>;
|
|
19
|
+
};
|
|
20
|
+
Navigator: ({ id, initialRouteName, children, layout, screenListeners, screenOptions, screenLayout, UNSTABLE_getStateForRouteNamesChange, ...rest }: import("@react-navigation/native-stack").NativeStackNavigatorProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
}, {
|
|
22
|
+
readonly initialRouteName: "ConversationSelectRecipients";
|
|
23
|
+
readonly screenOptions: {
|
|
24
|
+
readonly headerBackButtonDisplayMode: "minimal";
|
|
25
|
+
};
|
|
26
|
+
readonly screenLayout: typeof ScreenLayout;
|
|
27
|
+
readonly screens: {
|
|
28
|
+
readonly ConversationSelectRecipients: {
|
|
29
|
+
readonly screen: ({}: {
|
|
30
|
+
route: {
|
|
31
|
+
params: {
|
|
32
|
+
chat_group_graph_id?: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
}) => React.JSX.Element;
|
|
36
|
+
readonly options: ({ navigation }: {
|
|
37
|
+
route: import("@react-navigation/native").RouteProp<import("@react-navigation/native").ParamListBase, string>;
|
|
38
|
+
navigation: import("@react-navigation/native-stack").NativeStackNavigationProp<import("@react-navigation/native").ParamListBase, string, undefined>;
|
|
39
|
+
theme: ReactNavigation.Theme;
|
|
40
|
+
}) => {
|
|
41
|
+
title: string;
|
|
42
|
+
headerRight: (props: NativeStackHeaderRightProps) => React.JSX.Element;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
readonly ConversationFilterRecipients: {
|
|
46
|
+
readonly screen: ({}: {
|
|
47
|
+
route: {
|
|
48
|
+
params: {};
|
|
49
|
+
};
|
|
50
|
+
}) => React.JSX.Element;
|
|
51
|
+
readonly options: import("@react-navigation/native-stack").NativeStackNavigationOptions;
|
|
52
|
+
};
|
|
53
|
+
readonly ConversationCreate: {
|
|
54
|
+
readonly screen: ({ route }: {
|
|
55
|
+
route: {
|
|
56
|
+
params: {
|
|
57
|
+
group_id?: string;
|
|
58
|
+
team_ids?: string[];
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
}) => React.JSX.Element;
|
|
62
|
+
readonly options: {
|
|
63
|
+
readonly title: "New conversation";
|
|
64
|
+
readonly headerLeft: () => null;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
}>;
|
|
11
69
|
export declare const ChatStack: import("@react-navigation/native").TypedNavigator<{
|
|
12
70
|
ParamList: import("@react-navigation/native").ParamListBase;
|
|
13
71
|
NavigatorID: undefined;
|
|
@@ -32,7 +90,6 @@ export declare const ChatStack: import("@react-navigation/native").TypedNavigato
|
|
|
32
90
|
theme: ReactNavigation.Theme;
|
|
33
91
|
}) => {
|
|
34
92
|
headerTitle: string;
|
|
35
|
-
headerLeft: ({ tintColor }: NativeStackHeaderLeftProps) => React.JSX.Element;
|
|
36
93
|
headerRight: (props: NativeStackHeaderRightProps) => React.JSX.Element;
|
|
37
94
|
};
|
|
38
95
|
};
|
|
@@ -51,6 +108,70 @@ export declare const ChatStack: import("@react-navigation/native").TypedNavigato
|
|
|
51
108
|
headerRight: (props: NativeStackHeaderRightProps) => React.JSX.Element;
|
|
52
109
|
};
|
|
53
110
|
};
|
|
111
|
+
readonly Create: {
|
|
112
|
+
readonly screen: import("@react-navigation/native").TypedNavigator<{
|
|
113
|
+
ParamList: import("@react-navigation/native").ParamListBase;
|
|
114
|
+
NavigatorID: undefined;
|
|
115
|
+
State: import("@react-navigation/native").StackNavigationState<import("@react-navigation/native").ParamListBase>;
|
|
116
|
+
ScreenOptions: import("@react-navigation/native-stack").NativeStackNavigationOptions;
|
|
117
|
+
EventMap: import("@react-navigation/native-stack").NativeStackNavigationEventMap;
|
|
118
|
+
NavigationList: {
|
|
119
|
+
[x: string]: import("@react-navigation/native-stack").NativeStackNavigationProp<import("@react-navigation/native").ParamListBase, string, undefined>;
|
|
120
|
+
};
|
|
121
|
+
Navigator: ({ id, initialRouteName, children, layout, screenListeners, screenOptions, screenLayout, UNSTABLE_getStateForRouteNamesChange, ...rest }: import("@react-navigation/native-stack").NativeStackNavigatorProps) => import("react/jsx-runtime").JSX.Element;
|
|
122
|
+
}, {
|
|
123
|
+
readonly initialRouteName: "ConversationSelectRecipients";
|
|
124
|
+
readonly screenOptions: {
|
|
125
|
+
readonly headerBackButtonDisplayMode: "minimal";
|
|
126
|
+
};
|
|
127
|
+
readonly screenLayout: typeof ScreenLayout;
|
|
128
|
+
readonly screens: {
|
|
129
|
+
readonly ConversationSelectRecipients: {
|
|
130
|
+
readonly screen: ({}: {
|
|
131
|
+
route: {
|
|
132
|
+
params: {
|
|
133
|
+
chat_group_graph_id?: string;
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
}) => React.JSX.Element;
|
|
137
|
+
readonly options: ({ navigation }: {
|
|
138
|
+
route: import("@react-navigation/native").RouteProp<import("@react-navigation/native").ParamListBase, string>;
|
|
139
|
+
navigation: import("@react-navigation/native-stack").NativeStackNavigationProp<import("@react-navigation/native").ParamListBase, string, undefined>;
|
|
140
|
+
theme: ReactNavigation.Theme;
|
|
141
|
+
}) => {
|
|
142
|
+
title: string;
|
|
143
|
+
headerRight: (props: NativeStackHeaderRightProps) => React.JSX.Element;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
readonly ConversationFilterRecipients: {
|
|
147
|
+
readonly screen: ({}: {
|
|
148
|
+
route: {
|
|
149
|
+
params: {};
|
|
150
|
+
};
|
|
151
|
+
}) => React.JSX.Element;
|
|
152
|
+
readonly options: import("@react-navigation/native-stack").NativeStackNavigationOptions;
|
|
153
|
+
};
|
|
154
|
+
readonly ConversationCreate: {
|
|
155
|
+
readonly screen: ({ route }: {
|
|
156
|
+
route: {
|
|
157
|
+
params: {
|
|
158
|
+
group_id?: string;
|
|
159
|
+
team_ids?: string[];
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
}) => React.JSX.Element;
|
|
163
|
+
readonly options: {
|
|
164
|
+
readonly title: "New conversation";
|
|
165
|
+
readonly headerLeft: () => null;
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
}>;
|
|
170
|
+
readonly options: {
|
|
171
|
+
readonly headerShown: false;
|
|
172
|
+
readonly presentation: "modal";
|
|
173
|
+
};
|
|
174
|
+
};
|
|
54
175
|
readonly MessageActions: {
|
|
55
176
|
readonly screen: typeof MessageActionsScreen;
|
|
56
177
|
readonly options: import("@react-navigation/native-stack").NativeStackNavigationOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/navigation/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,EAEL,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/navigation/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,EAEL,2BAA2B,EAC5B,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAA;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAA;AAOrE,OAAO,EACL,oBAAoB,EAErB,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,eAAe,EAA0B,MAAM,6BAA6B,CAAA;AAErF,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,eAAO,MAAM,uBAAuB;;;;;;;;;uOAfpC,mBAAkB;;;;;;;;;;;;;;;;;;;uBAoH+kd,gBAAiB,KAAK;;;qCA1F1ld,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;EAmBtD,CAAA;AAEF,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;uBAqE2kd,gBAAiB,KAAK;;;qCA3D1ld,2BAA2B;;;;;;;;;;;uBA2Dyid,gBAAiB,KAAK;;;;qCA1C1ld,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mDA0C0jd,KAAK;;;iDA1F1ld,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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