@planningcenter/chat-react-native 3.36.2-rc.3 → 3.37.0-rc.1
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/display/action_button.d.ts +3 -1
- package/build/components/display/action_button.d.ts.map +1 -1
- package/build/components/display/action_button.js +8 -1
- package/build/components/display/action_button.js.map +1 -1
- package/build/hooks/groups/use_group_chat_conversation_payload.d.ts +168 -0
- package/build/hooks/groups/use_group_chat_conversation_payload.d.ts.map +1 -0
- package/build/hooks/groups/use_group_chat_conversation_payload.js +23 -0
- package/build/hooks/groups/use_group_chat_conversation_payload.js.map +1 -0
- package/build/hooks/groups/use_group_members_for_new_conversation.d.ts +0 -4
- package/build/hooks/groups/use_group_members_for_new_conversation.d.ts.map +1 -1
- package/build/hooks/groups/use_group_members_for_new_conversation.js +6 -18
- package/build/hooks/groups/use_group_members_for_new_conversation.js.map +1 -1
- package/build/hooks/groups/use_groups_conversation_create.js +1 -1
- package/build/hooks/groups/use_groups_conversation_create.js.map +1 -1
- package/build/hooks/services/use_find_or_create_services_conversation.d.ts +11 -3
- package/build/hooks/services/use_find_or_create_services_conversation.d.ts.map +1 -1
- package/build/hooks/services/use_find_or_create_services_conversation.js +10 -14
- package/build/hooks/services/use_find_or_create_services_conversation.js.map +1 -1
- package/build/hooks/services/use_services_chat_conversation_payload.d.ts +164 -0
- package/build/hooks/services/use_services_chat_conversation_payload.d.ts.map +1 -0
- package/build/hooks/services/use_services_chat_conversation_payload.js +16 -0
- package/build/hooks/services/use_services_chat_conversation_payload.js.map +1 -0
- package/build/hooks/services/use_team_members_for_new_conversation.d.ts.map +1 -1
- package/build/hooks/services/use_team_members_for_new_conversation.js +11 -4
- package/build/hooks/services/use_team_members_for_new_conversation.js.map +1 -1
- package/build/hooks/use_conversation_validate.d.ts +12 -0
- package/build/hooks/use_conversation_validate.d.ts.map +1 -0
- package/build/hooks/use_conversation_validate.js +28 -0
- package/build/hooks/use_conversation_validate.js.map +1 -0
- package/build/hooks/use_enrich_people.d.ts +13 -0
- package/build/hooks/use_enrich_people.d.ts.map +1 -0
- package/build/hooks/use_enrich_people.js +25 -0
- package/build/hooks/use_enrich_people.js.map +1 -0
- package/build/hooks/use_features.d.ts +1 -0
- package/build/hooks/use_features.d.ts.map +1 -1
- package/build/hooks/use_features.js +1 -0
- package/build/hooks/use_features.js.map +1 -1
- package/build/screens/conversation_details_screen.js +1 -1
- package/build/screens/conversation_details_screen.js.map +1 -1
- package/build/screens/conversation_new/components/groups_form.d.ts.map +1 -1
- package/build/screens/conversation_new/components/groups_form.js +14 -1
- package/build/screens/conversation_new/components/groups_form.js.map +1 -1
- package/build/screens/conversation_new/components/services_form.d.ts.map +1 -1
- package/build/screens/conversation_new/components/services_form.js +20 -2
- package/build/screens/conversation_new/components/services_form.js.map +1 -1
- package/build/screens/team_conversation_screen.d.ts.map +1 -1
- package/build/screens/team_conversation_screen.js +6 -3
- package/build/screens/team_conversation_screen.js.map +1 -1
- package/build/types/resources/conversation_validate.d.ts +10 -0
- package/build/types/resources/conversation_validate.d.ts.map +1 -0
- package/build/types/resources/conversation_validate.js +2 -0
- package/build/types/resources/conversation_validate.js.map +1 -0
- package/build/types/resources/index.d.ts +1 -0
- package/build/types/resources/index.d.ts.map +1 -1
- package/build/types/resources/index.js +1 -0
- package/build/types/resources/index.js.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/hooks/use_conversation_validate.test.tsx +117 -0
- package/src/__tests__/hooks/use_enrich_people.test.tsx +95 -0
- package/src/components/display/action_button.tsx +18 -0
- package/src/hooks/groups/use_group_chat_conversation_payload.ts +38 -0
- package/src/hooks/groups/use_group_members_for_new_conversation.ts +9 -23
- package/src/hooks/groups/use_groups_conversation_create.ts +1 -1
- package/src/hooks/services/use_find_or_create_services_conversation.ts +27 -24
- package/src/hooks/services/use_services_chat_conversation_payload.ts +26 -0
- package/src/hooks/services/use_team_members_for_new_conversation.ts +18 -7
- package/src/hooks/use_conversation_validate.ts +45 -0
- package/src/hooks/use_enrich_people.ts +35 -0
- package/src/hooks/use_features.ts +1 -0
- package/src/screens/conversation_details_screen.tsx +1 -1
- package/src/screens/conversation_new/components/groups_form.tsx +17 -1
- package/src/screens/conversation_new/components/services_form.tsx +26 -2
- package/src/screens/team_conversation_screen.tsx +6 -6
- package/src/types/resources/conversation_validate.ts +11 -0
- package/src/types/resources/index.ts +1 -0
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
teamIds: number[];
|
|
3
|
+
planId?: number;
|
|
4
|
+
enabled?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function useServicesChatConversationPayload({ teamIds, planId, enabled }: Props): {
|
|
7
|
+
error: Error;
|
|
8
|
+
isError: true;
|
|
9
|
+
isPending: false;
|
|
10
|
+
isLoading: false;
|
|
11
|
+
isLoadingError: false;
|
|
12
|
+
isRefetchError: true;
|
|
13
|
+
isSuccess: false;
|
|
14
|
+
isPlaceholderData: false;
|
|
15
|
+
status: "error";
|
|
16
|
+
dataUpdatedAt: number;
|
|
17
|
+
errorUpdatedAt: number;
|
|
18
|
+
failureCount: number;
|
|
19
|
+
failureReason: Error | null;
|
|
20
|
+
errorUpdateCount: number;
|
|
21
|
+
isFetched: boolean;
|
|
22
|
+
isFetchedAfterMount: boolean;
|
|
23
|
+
isFetching: boolean;
|
|
24
|
+
isInitialLoading: boolean;
|
|
25
|
+
isPaused: boolean;
|
|
26
|
+
isRefetching: boolean;
|
|
27
|
+
isStale: boolean;
|
|
28
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<import("../..").ApiResource<import("../..").ServicesChatPayloadResource>, Error>>;
|
|
29
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
30
|
+
promise: Promise<import("../..").ApiResource<import("../..").ServicesChatPayloadResource>>;
|
|
31
|
+
payload: string | undefined;
|
|
32
|
+
} | {
|
|
33
|
+
error: null;
|
|
34
|
+
isError: false;
|
|
35
|
+
isPending: false;
|
|
36
|
+
isLoading: false;
|
|
37
|
+
isLoadingError: false;
|
|
38
|
+
isRefetchError: false;
|
|
39
|
+
isSuccess: true;
|
|
40
|
+
isPlaceholderData: false;
|
|
41
|
+
status: "success";
|
|
42
|
+
dataUpdatedAt: number;
|
|
43
|
+
errorUpdatedAt: number;
|
|
44
|
+
failureCount: number;
|
|
45
|
+
failureReason: Error | null;
|
|
46
|
+
errorUpdateCount: number;
|
|
47
|
+
isFetched: boolean;
|
|
48
|
+
isFetchedAfterMount: boolean;
|
|
49
|
+
isFetching: boolean;
|
|
50
|
+
isInitialLoading: boolean;
|
|
51
|
+
isPaused: boolean;
|
|
52
|
+
isRefetching: boolean;
|
|
53
|
+
isStale: boolean;
|
|
54
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<import("../..").ApiResource<import("../..").ServicesChatPayloadResource>, Error>>;
|
|
55
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
56
|
+
promise: Promise<import("../..").ApiResource<import("../..").ServicesChatPayloadResource>>;
|
|
57
|
+
payload: string | undefined;
|
|
58
|
+
} | {
|
|
59
|
+
error: Error;
|
|
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: Error | 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("../..").ApiResource<import("../..").ServicesChatPayloadResource>, Error>>;
|
|
81
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
82
|
+
promise: Promise<import("../..").ApiResource<import("../..").ServicesChatPayloadResource>>;
|
|
83
|
+
payload: string | undefined;
|
|
84
|
+
} | {
|
|
85
|
+
error: null;
|
|
86
|
+
isError: false;
|
|
87
|
+
isPending: true;
|
|
88
|
+
isLoading: true;
|
|
89
|
+
isLoadingError: false;
|
|
90
|
+
isRefetchError: false;
|
|
91
|
+
isSuccess: false;
|
|
92
|
+
isPlaceholderData: false;
|
|
93
|
+
status: "pending";
|
|
94
|
+
dataUpdatedAt: number;
|
|
95
|
+
errorUpdatedAt: number;
|
|
96
|
+
failureCount: number;
|
|
97
|
+
failureReason: Error | null;
|
|
98
|
+
errorUpdateCount: number;
|
|
99
|
+
isFetched: boolean;
|
|
100
|
+
isFetchedAfterMount: boolean;
|
|
101
|
+
isFetching: boolean;
|
|
102
|
+
isInitialLoading: boolean;
|
|
103
|
+
isPaused: boolean;
|
|
104
|
+
isRefetching: boolean;
|
|
105
|
+
isStale: boolean;
|
|
106
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<import("../..").ApiResource<import("../..").ServicesChatPayloadResource>, Error>>;
|
|
107
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
108
|
+
promise: Promise<import("../..").ApiResource<import("../..").ServicesChatPayloadResource>>;
|
|
109
|
+
payload: string | undefined;
|
|
110
|
+
} | {
|
|
111
|
+
error: null;
|
|
112
|
+
isError: false;
|
|
113
|
+
isPending: true;
|
|
114
|
+
isLoadingError: false;
|
|
115
|
+
isRefetchError: false;
|
|
116
|
+
isSuccess: false;
|
|
117
|
+
isPlaceholderData: false;
|
|
118
|
+
status: "pending";
|
|
119
|
+
dataUpdatedAt: number;
|
|
120
|
+
errorUpdatedAt: number;
|
|
121
|
+
failureCount: number;
|
|
122
|
+
failureReason: Error | null;
|
|
123
|
+
errorUpdateCount: number;
|
|
124
|
+
isFetched: boolean;
|
|
125
|
+
isFetchedAfterMount: boolean;
|
|
126
|
+
isFetching: boolean;
|
|
127
|
+
isLoading: boolean;
|
|
128
|
+
isInitialLoading: boolean;
|
|
129
|
+
isPaused: boolean;
|
|
130
|
+
isRefetching: boolean;
|
|
131
|
+
isStale: boolean;
|
|
132
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<import("../..").ApiResource<import("../..").ServicesChatPayloadResource>, Error>>;
|
|
133
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
134
|
+
promise: Promise<import("../..").ApiResource<import("../..").ServicesChatPayloadResource>>;
|
|
135
|
+
payload: string | undefined;
|
|
136
|
+
} | {
|
|
137
|
+
isError: false;
|
|
138
|
+
error: null;
|
|
139
|
+
isPending: false;
|
|
140
|
+
isLoading: false;
|
|
141
|
+
isLoadingError: false;
|
|
142
|
+
isRefetchError: false;
|
|
143
|
+
isSuccess: true;
|
|
144
|
+
isPlaceholderData: true;
|
|
145
|
+
status: "success";
|
|
146
|
+
dataUpdatedAt: number;
|
|
147
|
+
errorUpdatedAt: number;
|
|
148
|
+
failureCount: number;
|
|
149
|
+
failureReason: Error | null;
|
|
150
|
+
errorUpdateCount: number;
|
|
151
|
+
isFetched: boolean;
|
|
152
|
+
isFetchedAfterMount: boolean;
|
|
153
|
+
isFetching: boolean;
|
|
154
|
+
isInitialLoading: boolean;
|
|
155
|
+
isPaused: boolean;
|
|
156
|
+
isRefetching: boolean;
|
|
157
|
+
isStale: boolean;
|
|
158
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<import("../..").ApiResource<import("../..").ServicesChatPayloadResource>, Error>>;
|
|
159
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
160
|
+
promise: Promise<import("../..").ApiResource<import("../..").ServicesChatPayloadResource>>;
|
|
161
|
+
payload: string | undefined;
|
|
162
|
+
};
|
|
163
|
+
export {};
|
|
164
|
+
//# sourceMappingURL=use_services_chat_conversation_payload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use_services_chat_conversation_payload.d.ts","sourceRoot":"","sources":["../../../src/hooks/services/use_services_chat_conversation_payload.ts"],"names":[],"mappings":"AAMA,UAAU,KAAK;IACb,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,kCAAkC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,OAAc,EAAE,EAAE,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAa5F"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useQuery } from '@tanstack/react-query';
|
|
2
|
+
import { useApiClient } from '../use_api_client';
|
|
3
|
+
import { getServicesChatConversationPayload } from './use_find_or_create_services_conversation';
|
|
4
|
+
const STALE_TIME_MS = 55 * 60 * 1000; // under Services' 1-hour server-side expiry
|
|
5
|
+
export function useServicesChatConversationPayload({ teamIds, planId, enabled = true }) {
|
|
6
|
+
const apiClient = useApiClient();
|
|
7
|
+
const sortedTeamIds = [...teamIds].sort((a, b) => a - b);
|
|
8
|
+
const { data, ...rest } = useQuery({
|
|
9
|
+
queryKey: ['services', '/chat', { teamIds: sortedTeamIds, planId }],
|
|
10
|
+
queryFn: () => getServicesChatConversationPayload({ apiClient, teamIds: sortedTeamIds, planId }),
|
|
11
|
+
staleTime: STALE_TIME_MS,
|
|
12
|
+
enabled: enabled && sortedTeamIds.length > 0,
|
|
13
|
+
});
|
|
14
|
+
return { payload: data?.data.payload, ...rest };
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=use_services_chat_conversation_payload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use_services_chat_conversation_payload.js","sourceRoot":"","sources":["../../../src/hooks/services/use_services_chat_conversation_payload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,kCAAkC,EAAE,MAAM,4CAA4C,CAAA;AAE/F,MAAM,aAAa,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA,CAAC,4CAA4C;AAQjF,MAAM,UAAU,kCAAkC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,EAAS;IAC3F,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;IAChC,MAAM,aAAa,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;IAExD,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,QAAQ,CAAC;QACjC,QAAQ,EAAE,CAAC,UAAU,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,CAAC;QACnE,OAAO,EAAE,GAAG,EAAE,CACZ,kCAAkC,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,CAAC;QACnF,SAAS,EAAE,aAAa;QACxB,OAAO,EAAE,OAAO,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC;KAC7C,CAAC,CAAA;IAEF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,EAAE,CAAA;AACjD,CAAC","sourcesContent":["import { useQuery } from '@tanstack/react-query'\nimport { useApiClient } from '../use_api_client'\nimport { getServicesChatConversationPayload } from './use_find_or_create_services_conversation'\n\nconst STALE_TIME_MS = 55 * 60 * 1000 // under Services' 1-hour server-side expiry\n\ninterface Props {\n teamIds: number[]\n planId?: number\n enabled?: boolean\n}\n\nexport function useServicesChatConversationPayload({ teamIds, planId, enabled = true }: Props) {\n const apiClient = useApiClient()\n const sortedTeamIds = [...teamIds].sort((a, b) => a - b)\n\n const { data, ...rest } = useQuery({\n queryKey: ['services', '/chat', { teamIds: sortedTeamIds, planId }],\n queryFn: () =>\n getServicesChatConversationPayload({ apiClient, teamIds: sortedTeamIds, planId }),\n staleTime: STALE_TIME_MS,\n enabled: enabled && sortedTeamIds.length > 0,\n })\n\n return { payload: data?.data.payload, ...rest }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_team_members_for_new_conversation.d.ts","sourceRoot":"","sources":["../../../src/hooks/services/use_team_members_for_new_conversation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAA0B,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"use_team_members_for_new_conversation.d.ts","sourceRoot":"","sources":["../../../src/hooks/services/use_team_members_for_new_conversation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAA0B,MAAM,aAAa,CAAA;AAIxF,UAAU,KAAK;IACb,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,wBAAgB,gCAAgC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsC1E"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { isNil, omitBy } from 'lodash';
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
import { useApiGet } from '../use_api';
|
|
4
|
+
import { useEnrichPeople } from '../use_enrich_people';
|
|
4
5
|
export function useTeamMembersForNewConversation({ teamIds, planId }) {
|
|
5
6
|
const params = omitBy({ team_id: teamIds.join(','), plan_id: planId }, isNil);
|
|
6
7
|
const { data, ...rest } = useApiGet({
|
|
@@ -14,13 +15,19 @@ export function useTeamMembersForNewConversation({ teamIds, planId }) {
|
|
|
14
15
|
app: 'services',
|
|
15
16
|
});
|
|
16
17
|
const people = data?.people || stableEmptyPersonArray;
|
|
17
|
-
const
|
|
18
|
-
|
|
18
|
+
const personIds = useMemo(() => people.map(p => p.id), [people]);
|
|
19
|
+
const enrichmentMap = useEnrichPeople({ personIds });
|
|
20
|
+
const members = useMemo(() => people.map(person => {
|
|
21
|
+
const enrichedBadges = enrichmentMap.get(person.id)?.badges ?? [];
|
|
22
|
+
const existingTitles = new Set(person.badges.map(b => b.title));
|
|
23
|
+
const newBadges = enrichedBadges.filter(b => !existingTitles.has(b.title));
|
|
24
|
+
return {
|
|
19
25
|
...person,
|
|
20
26
|
type: 'Member',
|
|
21
27
|
gender: null,
|
|
22
|
-
|
|
23
|
-
|
|
28
|
+
badges: [...person.badges, ...newBadges],
|
|
29
|
+
};
|
|
30
|
+
}), [people, enrichmentMap]);
|
|
24
31
|
return {
|
|
25
32
|
members,
|
|
26
33
|
...rest,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_team_members_for_new_conversation.js","sourceRoot":"","sources":["../../../src/hooks/services/use_team_members_for_new_conversation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAE/B,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"use_team_members_for_new_conversation.js","sourceRoot":"","sources":["../../../src/hooks/services/use_team_members_for_new_conversation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAE/B,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAOtD,MAAM,UAAU,gCAAgC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAS;IACzE,MAAM,MAAM,GAAG,MAAM,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,KAAK,CAAC,CAAA;IAE7E,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,SAAS,CAAqB;QACtD,GAAG,EAAE,OAAO;QACZ,IAAI,EAAE;YACJ,GAAG,MAAM;YACT,MAAM,EAAE;gBACN,IAAI,EAAE,CAAC,QAAQ,CAAC;aACjB;SACF;QACD,GAAG,EAAE,UAAU;KAChB,CAAC,CAAA;IAEF,MAAM,MAAM,GAAG,IAAI,EAAE,MAAM,IAAI,sBAAsB,CAAA;IACrD,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAA;IAChE,MAAM,aAAa,GAAG,eAAe,CAAC,EAAE,SAAS,EAAE,CAAC,CAAA;IAEpD,MAAM,OAAO,GAAqB,OAAO,CACvC,GAAG,EAAE,CACH,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;QAClB,MAAM,cAAc,GAAG,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,MAAM,IAAI,EAAE,CAAA;QACjE,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAA;QAC/D,MAAM,SAAS,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAA;QAC1E,OAAO;YACL,GAAG,MAAM;YACT,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC;SACzC,CAAA;IACH,CAAC,CAAC,EACJ,CAAC,MAAM,EAAE,aAAa,CAAC,CACxB,CAAA;IAED,OAAO;QACL,OAAO;QACP,GAAG,IAAI;KACR,CAAA;AACH,CAAC;AAED,MAAM,sBAAsB,GAA6B,EAAE,CAAA","sourcesContent":["import { isNil, omitBy } from 'lodash'\nimport { useMemo } from 'react'\nimport { MemberResource, TeamPeopleResource, TeamPersonResponseItem } from '../../types'\nimport { useApiGet } from '../use_api'\nimport { useEnrichPeople } from '../use_enrich_people'\n\ninterface Props {\n teamIds: number[]\n planId?: number\n}\n\nexport function useTeamMembersForNewConversation({ teamIds, planId }: Props) {\n const params = omitBy({ team_id: teamIds.join(','), plan_id: planId }, isNil)\n\n const { data, ...rest } = useApiGet<TeamPeopleResource>({\n url: '/chat',\n data: {\n ...params,\n fields: {\n Chat: ['people'],\n },\n },\n app: 'services',\n })\n\n const people = data?.people || stableEmptyPersonArray\n const personIds = useMemo(() => people.map(p => p.id), [people])\n const enrichmentMap = useEnrichPeople({ personIds })\n\n const members: MemberResource[] = useMemo(\n () =>\n people.map(person => {\n const enrichedBadges = enrichmentMap.get(person.id)?.badges ?? []\n const existingTitles = new Set(person.badges.map(b => b.title))\n const newBadges = enrichedBadges.filter(b => !existingTitles.has(b.title))\n return {\n ...person,\n type: 'Member',\n gender: null,\n badges: [...person.badges, ...newBadges],\n }\n }),\n [people, enrichmentMap]\n )\n\n return {\n members,\n ...rest,\n }\n}\n\nconst stableEmptyPersonArray: TeamPersonResponseItem[] = []\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
payload: string | undefined;
|
|
3
|
+
isLoadingPayload?: boolean;
|
|
4
|
+
genderId?: string | null;
|
|
5
|
+
enabled?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function useConversationValidate({ payload, isLoadingPayload, genderId, enabled, }: Props): {
|
|
8
|
+
warnings: import("..").ConversationWarning[];
|
|
9
|
+
validationPending: boolean;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=use_conversation_validate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use_conversation_validate.d.ts","sourceRoot":"","sources":["../../src/hooks/use_conversation_validate.ts"],"names":[],"mappings":"AAIA,UAAU,KAAK;IACb,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,uBAAuB,CAAC,EACtC,OAAO,EACP,gBAAwB,EACxB,QAAQ,EACR,OAAc,GACf,EAAE,KAAK;;;EA4BP"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useQuery } from '@tanstack/react-query';
|
|
2
|
+
import { useApiClient } from './use_api_client';
|
|
3
|
+
export function useConversationValidate({ payload, isLoadingPayload = false, genderId, enabled = true, }) {
|
|
4
|
+
const apiClient = useApiClient();
|
|
5
|
+
const { data, isLoading } = useQuery({
|
|
6
|
+
queryKey: ['chat', '/me/conversation_validate', { payload, genderId }],
|
|
7
|
+
queryFn: () => apiClient.chat.post({
|
|
8
|
+
url: '/me/conversation_validate',
|
|
9
|
+
data: {
|
|
10
|
+
data: {
|
|
11
|
+
type: 'ConversationValidate',
|
|
12
|
+
attributes: {
|
|
13
|
+
payload: payload,
|
|
14
|
+
...(genderId ? { gender_id: genderId } : {}),
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
}),
|
|
19
|
+
enabled: enabled && payload != null,
|
|
20
|
+
retry: false,
|
|
21
|
+
});
|
|
22
|
+
const warnings = data?.data.warnings ?? [];
|
|
23
|
+
return {
|
|
24
|
+
warnings,
|
|
25
|
+
validationPending: enabled && (isLoadingPayload || isLoading),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=use_conversation_validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use_conversation_validate.js","sourceRoot":"","sources":["../../src/hooks/use_conversation_validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAEhD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAS/C,MAAM,UAAU,uBAAuB,CAAC,EACtC,OAAO,EACP,gBAAgB,GAAG,KAAK,EACxB,QAAQ,EACR,OAAO,GAAG,IAAI,GACR;IACN,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,OAAO,EAAE,QAAQ,EAAE,CAAC;QACtE,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;wBACV,OAAO,EAAE,OAAQ;wBACjB,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;qBAC7C;iBACF;aACF;SACF,CAAC;QACJ,OAAO,EAAE,OAAO,IAAI,OAAO,IAAI,IAAI;QACnC,KAAK,EAAE,KAAK;KACb,CAAC,CAAA;IAEF,MAAM,QAAQ,GAAG,IAAI,EAAE,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAA;IAE1C,OAAO;QACL,QAAQ;QACR,iBAAiB,EAAE,OAAO,IAAI,CAAC,gBAAgB,IAAI,SAAS,CAAC;KAC9D,CAAA;AACH,CAAC","sourcesContent":["import { useQuery } from '@tanstack/react-query'\nimport { ApiResource, ConversationValidateResource } from '../types'\nimport { useApiClient } from './use_api_client'\n\ninterface Props {\n payload: string | undefined\n isLoadingPayload?: boolean\n genderId?: string | null\n enabled?: boolean\n}\n\nexport function useConversationValidate({\n payload,\n isLoadingPayload = false,\n genderId,\n enabled = true,\n}: Props) {\n const apiClient = useApiClient()\n\n const { data, isLoading } = useQuery({\n queryKey: ['chat', '/me/conversation_validate', { payload, genderId }],\n queryFn: () =>\n apiClient.chat.post<ApiResource<ConversationValidateResource>>({\n url: '/me/conversation_validate',\n data: {\n data: {\n type: 'ConversationValidate',\n attributes: {\n payload: payload!,\n ...(genderId ? { gender_id: genderId } : {}),\n },\n },\n },\n }),\n enabled: enabled && payload != null,\n retry: false,\n })\n\n const warnings = data?.data.warnings ?? []\n\n return {\n warnings,\n validationPending: enabled && (isLoadingPayload || isLoading),\n }\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ResourceObject } from '../types';
|
|
2
|
+
export interface PersonEnrichmentResource extends ResourceObject {
|
|
3
|
+
type: 'PersonEnrichment';
|
|
4
|
+
id: string;
|
|
5
|
+
badges: {
|
|
6
|
+
title: string;
|
|
7
|
+
}[];
|
|
8
|
+
}
|
|
9
|
+
export declare function useEnrichPeople({ personIds, groupId }: {
|
|
10
|
+
personIds: number[];
|
|
11
|
+
groupId?: number;
|
|
12
|
+
}): Map<number, PersonEnrichmentResource>;
|
|
13
|
+
//# sourceMappingURL=use_enrich_people.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use_enrich_people.d.ts","sourceRoot":"","sources":["../../src/hooks/use_enrich_people.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,cAAc,EAAE,MAAM,UAAU,CAAA;AAGxD,MAAM,WAAW,wBAAyB,SAAQ,cAAc;IAC9D,IAAI,EAAE,kBAAkB,CAAA;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAC5B;AAED,wBAAgB,eAAe,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE;IAAE,SAAS,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,yCAuBhG"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { keepPreviousData, useQuery } from '@tanstack/react-query';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { useApiClient } from './use_api_client';
|
|
4
|
+
export function useEnrichPeople({ personIds, groupId }) {
|
|
5
|
+
const apiClient = useApiClient();
|
|
6
|
+
const { data } = useQuery({
|
|
7
|
+
queryKey: ['enrich_people', [...personIds].sort((a, b) => a - b), groupId],
|
|
8
|
+
queryFn: () => apiClient.chat.post({
|
|
9
|
+
url: '/enrich_people',
|
|
10
|
+
data: {
|
|
11
|
+
data: {
|
|
12
|
+
type: 'PersonEnrichment',
|
|
13
|
+
attributes: {
|
|
14
|
+
person_ids: personIds,
|
|
15
|
+
...(groupId !== undefined ? { group_id: groupId } : {}),
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
}),
|
|
20
|
+
enabled: personIds.length > 0,
|
|
21
|
+
placeholderData: keepPreviousData,
|
|
22
|
+
});
|
|
23
|
+
return useMemo(() => new Map(data?.data.map(e => [+e.id, e]) ?? []), [data]);
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=use_enrich_people.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use_enrich_people.js","sourceRoot":"","sources":["../../src/hooks/use_enrich_people.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAE/B,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAQ/C,MAAM,UAAU,eAAe,CAAC,EAAE,SAAS,EAAE,OAAO,EAA6C;IAC/F,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;IAEhC,MAAM,EAAE,IAAI,EAAE,GAAG,QAAQ,CAA0C;QACjE,QAAQ,EAAE,CAAC,eAAe,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC;QAC1E,OAAO,EAAE,GAAG,EAAE,CACZ,SAAS,CAAC,IAAI,CAAC,IAAI,CAA0C;YAC3D,GAAG,EAAE,gBAAgB;YACrB,IAAI,EAAE;gBACJ,IAAI,EAAE;oBACJ,IAAI,EAAE,kBAAkB;oBACxB,UAAU,EAAE;wBACV,UAAU,EAAE,SAAS;wBACrB,GAAG,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;qBACxD;iBACF;aACF;SACF,CAAC;QACJ,OAAO,EAAE,SAAS,CAAC,MAAM,GAAG,CAAC;QAC7B,eAAe,EAAE,gBAAgB;KAClC,CAAC,CAAA;IAEF,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;AAC9E,CAAC","sourcesContent":["import { keepPreviousData, useQuery } from '@tanstack/react-query'\nimport { useMemo } from 'react'\nimport { ApiCollection, ResourceObject } from '../types'\nimport { useApiClient } from './use_api_client'\n\nexport interface PersonEnrichmentResource extends ResourceObject {\n type: 'PersonEnrichment'\n id: string\n badges: { title: string }[]\n}\n\nexport function useEnrichPeople({ personIds, groupId }: { personIds: number[]; groupId?: number }) {\n const apiClient = useApiClient()\n\n const { data } = useQuery<ApiCollection<PersonEnrichmentResource>>({\n queryKey: ['enrich_people', [...personIds].sort((a, b) => a - b), groupId],\n queryFn: () =>\n apiClient.chat.post<ApiCollection<PersonEnrichmentResource>>({\n url: '/enrich_people',\n data: {\n data: {\n type: 'PersonEnrichment',\n attributes: {\n person_ids: personIds,\n ...(groupId !== undefined ? { group_id: groupId } : {}),\n },\n },\n },\n }),\n enabled: personIds.length > 0,\n placeholderData: keepPreviousData,\n })\n\n return useMemo(() => new Map(data?.data.map(e => [+e.id, e]) ?? []), [data])\n}\n"]}
|
|
@@ -10,6 +10,7 @@ export declare const availableFeatures: {
|
|
|
10
10
|
readonly granular_notifications_ui: "ROLLOUT_granular_notification_preferences_ui";
|
|
11
11
|
readonly custom_conversation_avatars: "ROLLOUT_custom_conversation_avatars";
|
|
12
12
|
readonly jump_to_unread: "ROLLOUT_jump_to_unread";
|
|
13
|
+
readonly conversation_safety_lock: "ROLLOUT_conversation_safety_lock";
|
|
13
14
|
};
|
|
14
15
|
export {};
|
|
15
16
|
//# sourceMappingURL=use_features.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_features.d.ts","sourceRoot":"","sources":["../../src/hooks/use_features.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAA;AAI1E,KAAK,WAAW,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAA;AAE7E,wBAAgB,WAAW;;kCAiBT,WAAW;EAS5B;AAED,eAAO,MAAM,iBAAiB
|
|
1
|
+
{"version":3,"file":"use_features.d.ts","sourceRoot":"","sources":["../../src/hooks/use_features.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAA;AAI1E,KAAK,WAAW,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAA;AAE7E,wBAAgB,WAAW;;kCAiBT,WAAW;EAS5B;AAED,eAAO,MAAM,iBAAiB;;;;;;;CAO0B,CAAA"}
|
|
@@ -27,6 +27,7 @@ export const availableFeatures = {
|
|
|
27
27
|
granular_notifications_ui: 'ROLLOUT_granular_notification_preferences_ui',
|
|
28
28
|
custom_conversation_avatars: 'ROLLOUT_custom_conversation_avatars',
|
|
29
29
|
jump_to_unread: 'ROLLOUT_jump_to_unread',
|
|
30
|
+
conversation_safety_lock: 'ROLLOUT_conversation_safety_lock',
|
|
30
31
|
};
|
|
31
32
|
const stableEmptyFeatures = {
|
|
32
33
|
data: [],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_features.js","sourceRoot":"","sources":["../../src/hooks/use_features.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAGnC,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAA;AAC3F,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAI/C,MAAM,UAAU,WAAW;IACzB,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;IAChC,MAAM,WAAW,GAAG,sBAAsB,EAAE,CAAA;IAE5C,MAAM,EAAE,IAAI,EAAE,GAAG,gBAAgB,CAAC;QAChC,QAAQ,EAAE,mBAAmB,EAAE;QAC/B,OAAO,EAAE,GAAG,EAAE;YACZ,OAAO,SAAS,CAAC,IAAI;iBAClB,GAAG,CAAiC,WAAW,CAAC;iBAChD,KAAK,CAAC,GAAG,EAAE,CAAC,mBAAmB,CAAC,CAAA;QACrC,CAAC;QACD,SAAS,EAAE,IAAI,GAAG,EAAE,GAAG,CAAC,EAAE,YAAY;KACvC,CAAC,CAAA;IAEF,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAA;IAE1B,MAAM,cAAc,GAAG,WAAW,CAChC,CAAC,WAAwB,EAAE,EAAE,CAC3B,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC,EAC3E,CAAC,QAAQ,CAAC,CACX,CAAA;IAED,OAAO;QACL,QAAQ;QACR,cAAc;KACf,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,6BAA6B,EAAE,uCAAuC;IACtE,iBAAiB,EAAE,kCAAkC;IACrD,yBAAyB,EAAE,8CAA8C;IACzE,2BAA2B,EAAE,qCAAqC;IAClE,cAAc,EAAE,wBAAwB;
|
|
1
|
+
{"version":3,"file":"use_features.js","sourceRoot":"","sources":["../../src/hooks/use_features.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAGnC,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAA;AAC3F,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAI/C,MAAM,UAAU,WAAW;IACzB,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;IAChC,MAAM,WAAW,GAAG,sBAAsB,EAAE,CAAA;IAE5C,MAAM,EAAE,IAAI,EAAE,GAAG,gBAAgB,CAAC;QAChC,QAAQ,EAAE,mBAAmB,EAAE;QAC/B,OAAO,EAAE,GAAG,EAAE;YACZ,OAAO,SAAS,CAAC,IAAI;iBAClB,GAAG,CAAiC,WAAW,CAAC;iBAChD,KAAK,CAAC,GAAG,EAAE,CAAC,mBAAmB,CAAC,CAAA;QACrC,CAAC;QACD,SAAS,EAAE,IAAI,GAAG,EAAE,GAAG,CAAC,EAAE,YAAY;KACvC,CAAC,CAAA;IAEF,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAA;IAE1B,MAAM,cAAc,GAAG,WAAW,CAChC,CAAC,WAAwB,EAAE,EAAE,CAC3B,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC,EAC3E,CAAC,QAAQ,CAAC,CACX,CAAA;IAED,OAAO;QACL,QAAQ;QACR,cAAc;KACf,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,6BAA6B,EAAE,uCAAuC;IACtE,iBAAiB,EAAE,kCAAkC;IACrD,yBAAyB,EAAE,8CAA8C;IACzE,2BAA2B,EAAE,qCAAqC;IAClE,cAAc,EAAE,wBAAwB;IACxC,wBAAwB,EAAE,kCAAkC;CACN,CAAA;AAExD,MAAM,mBAAmB,GAAmC;IAC1D,IAAI,EAAE,EAAE;IACR,KAAK,EAAE,EAAE;IACT,IAAI,EAAE;QACJ,KAAK,EAAE,CAAC;QACR,UAAU,EAAE,CAAC;KACd;CACF,CAAA","sourcesContent":["import { useSuspenseQuery } from '@tanstack/react-query'\nimport { useCallback } from 'react'\nimport { ApiCollection } from '../types'\nimport type { FeatureResource } from '../types/resources/feature_resource'\nimport { getFeaturesRequestArgs, getFeaturesQueryKey } from '../utils/request/get_features'\nimport { useApiClient } from './use_api_client'\n\ntype FeatureName = (typeof availableFeatures)[keyof typeof availableFeatures]\n\nexport function useFeatures() {\n const apiClient = useApiClient()\n const requestArgs = getFeaturesRequestArgs()\n\n const { data } = useSuspenseQuery({\n queryKey: getFeaturesQueryKey(),\n queryFn: () => {\n return apiClient.chat\n .get<ApiCollection<FeatureResource>>(requestArgs)\n .catch(() => stableEmptyFeatures)\n },\n staleTime: 1000 * 60 * 5, // 5 minutes\n })\n\n const features = data.data\n\n const featureEnabled = useCallback(\n (featureName: FeatureName) =>\n features.some(feature => feature.name === featureName && feature.enabled),\n [features]\n )\n\n return {\n features,\n featureEnabled,\n }\n}\n\nexport const availableFeatures = {\n gender_specific_conversations: 'ROLLOUT_gender_specific_conversations',\n message_reporting: 'ROLLOUT_MOBILE_message_reporting',\n granular_notifications_ui: 'ROLLOUT_granular_notification_preferences_ui',\n custom_conversation_avatars: 'ROLLOUT_custom_conversation_avatars',\n jump_to_unread: 'ROLLOUT_jump_to_unread',\n conversation_safety_lock: 'ROLLOUT_conversation_safety_lock',\n} as const satisfies Record<string, `ROLLOUT_${string}`>\n\nconst stableEmptyFeatures: ApiCollection<FeatureResource> = {\n data: [],\n links: {},\n meta: {\n count: 0,\n totalCount: 0,\n },\n}\n"]}
|
|
@@ -66,7 +66,7 @@ export function ConversationDetailsScreen({ route }) {
|
|
|
66
66
|
const memberPosition = isFirst ? 'first' : isLast ? 'last' : 'middle';
|
|
67
67
|
const memberSectionStyle = memberSectionStyleMap[memberPosition];
|
|
68
68
|
return {
|
|
69
|
-
type:
|
|
69
|
+
type: SectionTypes.members,
|
|
70
70
|
data,
|
|
71
71
|
sectionInnerStyle: memberSectionStyle,
|
|
72
72
|
};
|