@planningcenter/chat-react-native 4.2.1-qa-staging.15 → 4.2.1-qa-staging.14
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/use_search_results.d.ts.map +1 -1
- package/build/hooks/use_search_results.js +59 -67
- package/build/hooks/use_search_results.js.map +1 -1
- 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 +158 -142
- package/build/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.js.map +1 -1
- package/build/screens/search/components/results_section.d.ts +1 -1
- package/build/screens/search/components/results_section.d.ts.map +1 -1
- package/build/screens/search/components/results_section.js.map +1 -1
- package/build/screens/search/search_screen.d.ts.map +1 -1
- package/build/screens/search/search_screen.js +9 -18
- package/build/screens/search/search_screen.js.map +1 -1
- package/package.json +3 -3
- package/src/hooks/__tests__/use_search_results.test.tsx +2 -14
- package/src/hooks/use_search_results.ts +3 -4
- package/src/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.tsx +8 -3
- package/src/screens/search/components/results_section.tsx +1 -1
- package/src/screens/search/search_screen.tsx +1 -9
- package/build/hooks/use_debounced_search_term.d.ts +0 -2
- package/build/hooks/use_debounced_search_term.d.ts.map +0 -1
- package/build/hooks/use_debounced_search_term.js +0 -40
- package/build/hooks/use_debounced_search_term.js.map +0 -1
- package/build/screens/search/components/search_results_list.d.ts +0 -8
- package/build/screens/search/components/search_results_list.d.ts.map +0 -1
- package/build/screens/search/components/search_results_list.js +0 -314
- package/build/screens/search/components/search_results_list.js.map +0 -1
- package/src/hooks/__tests__/use_debounced_search_term.test.tsx +0 -38
- package/src/hooks/use_debounced_search_term.ts +0 -20
- package/src/screens/search/__tests__/search_screen.test.tsx +0 -64
- package/src/screens/search/components/__tests__/search_results_list.test.tsx +0 -135
- package/src/screens/search/components/search_results_list.tsx +0 -147
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { c as _c } from "react/compiler-runtime";
|
|
2
2
|
import { PlatformPressable } from '@react-navigation/elements';
|
|
3
3
|
import { StackActions, useNavigation } from '@react-navigation/native';
|
|
4
|
-
import { useRef, useState } from 'react';
|
|
4
|
+
import { useEffect, useRef, useState } from 'react';
|
|
5
5
|
import { FlatList, Pressable, StyleSheet, View } from 'react-native';
|
|
6
6
|
import { Avatar, Badge, Banner, Icon, KeyboardView, Spinner, Text } from '../../components';
|
|
7
7
|
import { ActionButton } from '../../components/display/action_button';
|
|
@@ -12,13 +12,12 @@ import { useDirectMessageAffiliations } from '../../hooks/direct_messages/use_di
|
|
|
12
12
|
import { useDirectMessageCandidates } from '../../hooks/direct_messages/use_direct_message_candidates';
|
|
13
13
|
import { useDirectMessageConversationValidate } from '../../hooks/direct_messages/use_direct_message_conversation_validate';
|
|
14
14
|
import { useFindOrCreateDirectMessageConversation } from '../../hooks/direct_messages/use_find_or_create_direct_message_conversation';
|
|
15
|
-
import { useDebouncedSearchTerm } from '../../hooks/use_debounced_search_term';
|
|
16
15
|
import { availableFeatures, useFeatures } from '../../hooks/use_features';
|
|
17
16
|
import { ResultsHeading } from './components/results_heading';
|
|
18
17
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
19
18
|
const MAX_RECIPIENTS = 9;
|
|
20
19
|
export function ConversationSelectDirectMessageRecipientsScreen(t0) {
|
|
21
|
-
const $ = _c(
|
|
20
|
+
const $ = _c(58);
|
|
22
21
|
const {
|
|
23
22
|
route
|
|
24
23
|
} = t0;
|
|
@@ -48,7 +47,7 @@ export function ConversationSelectDirectMessageRecipientsScreen(t0) {
|
|
|
48
47
|
featureEnabled
|
|
49
48
|
} = useFeatures();
|
|
50
49
|
const [searchTerm, setSearchTerm] = useState("");
|
|
51
|
-
const debouncedTerm =
|
|
50
|
+
const [debouncedTerm, setDebouncedTerm] = useState("");
|
|
52
51
|
let t4;
|
|
53
52
|
if ($[4] !== preselected_people) {
|
|
54
53
|
t4 = () => new Map(preselected_people.map(_temp));
|
|
@@ -60,244 +59,261 @@ export function ConversationSelectDirectMessageRecipientsScreen(t0) {
|
|
|
60
59
|
const [selectedPeople, setSelectedPeople] = useState(t4);
|
|
61
60
|
const searchInputRef = useRef(null);
|
|
62
61
|
let t5;
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
let t6;
|
|
63
|
+
if ($[6] !== searchTerm) {
|
|
64
|
+
t5 = () => {
|
|
65
|
+
const timer = setTimeout(() => setDebouncedTerm(searchTerm), 200);
|
|
66
|
+
return () => clearTimeout(timer);
|
|
67
|
+
};
|
|
68
|
+
t6 = [searchTerm];
|
|
69
|
+
$[6] = searchTerm;
|
|
70
|
+
$[7] = t5;
|
|
71
|
+
$[8] = t6;
|
|
72
|
+
} else {
|
|
73
|
+
t5 = $[7];
|
|
74
|
+
t6 = $[8];
|
|
75
|
+
}
|
|
76
|
+
useEffect(t5, t6);
|
|
77
|
+
let t7;
|
|
78
|
+
if ($[9] !== featureEnabled || $[10] !== selectedPeople.size) {
|
|
79
|
+
t7 = person_0 => {
|
|
65
80
|
if (selectedPeople.size >= MAX_RECIPIENTS) {
|
|
66
81
|
return;
|
|
67
82
|
}
|
|
68
83
|
setSelectedPeople(prev => new Map(prev).set(person_0.id, person_0));
|
|
69
84
|
setSearchTerm("");
|
|
85
|
+
setDebouncedTerm("");
|
|
70
86
|
if (featureEnabled(availableFeatures.dm_search_clear_fix)) {
|
|
71
87
|
searchInputRef.current?.clear();
|
|
72
88
|
}
|
|
73
89
|
};
|
|
74
|
-
$[
|
|
75
|
-
$[
|
|
76
|
-
$[
|
|
90
|
+
$[9] = featureEnabled;
|
|
91
|
+
$[10] = selectedPeople.size;
|
|
92
|
+
$[11] = t7;
|
|
77
93
|
} else {
|
|
78
|
-
|
|
94
|
+
t7 = $[11];
|
|
79
95
|
}
|
|
80
|
-
const selectPerson =
|
|
81
|
-
let
|
|
82
|
-
if ($[
|
|
83
|
-
|
|
96
|
+
const selectPerson = t7;
|
|
97
|
+
let t8;
|
|
98
|
+
if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
|
|
99
|
+
t8 = id => {
|
|
84
100
|
setSelectedPeople(prev_0 => {
|
|
85
101
|
const next = new Map(prev_0);
|
|
86
102
|
next.delete(id);
|
|
87
103
|
return next;
|
|
88
104
|
});
|
|
89
105
|
};
|
|
90
|
-
$[
|
|
106
|
+
$[12] = t8;
|
|
91
107
|
} else {
|
|
92
|
-
|
|
108
|
+
t8 = $[12];
|
|
93
109
|
}
|
|
94
|
-
const removePerson =
|
|
95
|
-
let
|
|
96
|
-
if ($[
|
|
97
|
-
|
|
98
|
-
$[
|
|
99
|
-
$[
|
|
110
|
+
const removePerson = t8;
|
|
111
|
+
let t9;
|
|
112
|
+
if ($[13] !== selectedPeople) {
|
|
113
|
+
t9 = [...selectedPeople.keys()];
|
|
114
|
+
$[13] = selectedPeople;
|
|
115
|
+
$[14] = t9;
|
|
100
116
|
} else {
|
|
101
|
-
|
|
117
|
+
t9 = $[14];
|
|
102
118
|
}
|
|
103
|
-
const recipientIds =
|
|
104
|
-
let
|
|
105
|
-
if ($[
|
|
106
|
-
|
|
119
|
+
const recipientIds = t9;
|
|
120
|
+
let t10;
|
|
121
|
+
if ($[15] !== recipientIds) {
|
|
122
|
+
t10 = {
|
|
107
123
|
recipientIds
|
|
108
124
|
};
|
|
109
|
-
$[
|
|
110
|
-
$[
|
|
125
|
+
$[15] = recipientIds;
|
|
126
|
+
$[16] = t10;
|
|
111
127
|
} else {
|
|
112
|
-
|
|
128
|
+
t10 = $[16];
|
|
113
129
|
}
|
|
114
130
|
const {
|
|
115
131
|
warnings,
|
|
116
132
|
validationPending
|
|
117
|
-
} = useDirectMessageConversationValidate(
|
|
118
|
-
let
|
|
119
|
-
if ($[
|
|
120
|
-
|
|
133
|
+
} = useDirectMessageConversationValidate(t10);
|
|
134
|
+
let t11;
|
|
135
|
+
if ($[17] !== navigation) {
|
|
136
|
+
t11 = conversationId => {
|
|
121
137
|
navigation.getParent()?.dispatch(StackActions.replace("Conversation", {
|
|
122
138
|
conversation_id: conversationId
|
|
123
139
|
}));
|
|
124
140
|
};
|
|
125
|
-
$[
|
|
126
|
-
$[
|
|
141
|
+
$[17] = navigation;
|
|
142
|
+
$[18] = t11;
|
|
127
143
|
} else {
|
|
128
|
-
|
|
144
|
+
t11 = $[18];
|
|
129
145
|
}
|
|
130
|
-
const handleSuccess =
|
|
131
|
-
let
|
|
132
|
-
if ($[
|
|
133
|
-
|
|
146
|
+
const handleSuccess = t11;
|
|
147
|
+
let t12;
|
|
148
|
+
if ($[19] !== handleSuccess || $[20] !== recipientIds) {
|
|
149
|
+
t12 = {
|
|
134
150
|
recipientIds,
|
|
135
151
|
onSuccess: handleSuccess
|
|
136
152
|
};
|
|
137
|
-
$[
|
|
138
|
-
$[
|
|
139
|
-
$[
|
|
153
|
+
$[19] = handleSuccess;
|
|
154
|
+
$[20] = recipientIds;
|
|
155
|
+
$[21] = t12;
|
|
140
156
|
} else {
|
|
141
|
-
|
|
157
|
+
t12 = $[21];
|
|
142
158
|
}
|
|
143
159
|
const {
|
|
144
160
|
findOrCreateConversation,
|
|
145
161
|
directMessageExists,
|
|
146
162
|
isFinding,
|
|
147
163
|
isError
|
|
148
|
-
} = useFindOrCreateDirectMessageConversation(
|
|
149
|
-
let
|
|
164
|
+
} = useFindOrCreateDirectMessageConversation(t12);
|
|
165
|
+
let t13;
|
|
150
166
|
bb0: {
|
|
151
167
|
if (selectedPeople.size === 0) {
|
|
152
|
-
|
|
168
|
+
t13 = "Start conversation";
|
|
153
169
|
break bb0;
|
|
154
170
|
}
|
|
155
171
|
if (selectedPeople.size === 1) {
|
|
156
|
-
let
|
|
157
|
-
if ($[
|
|
158
|
-
|
|
159
|
-
$[
|
|
160
|
-
$[
|
|
172
|
+
let t14;
|
|
173
|
+
if ($[22] !== selectedPeople) {
|
|
174
|
+
t14 = selectedPeople.values().next().value.name.split(" ");
|
|
175
|
+
$[22] = selectedPeople;
|
|
176
|
+
$[23] = t14;
|
|
161
177
|
} else {
|
|
162
|
-
|
|
178
|
+
t14 = $[23];
|
|
163
179
|
}
|
|
164
|
-
const firstName =
|
|
165
|
-
|
|
180
|
+
const firstName = t14[0];
|
|
181
|
+
t13 = directMessageExists ? `Open message with ${firstName}` : `Message ${firstName}`;
|
|
166
182
|
break bb0;
|
|
167
183
|
}
|
|
168
|
-
|
|
184
|
+
t13 = directMessageExists ? `Open direct message (${selectedPeople.size})` : `Start direct message (${selectedPeople.size})`;
|
|
169
185
|
}
|
|
170
|
-
const buttonText =
|
|
171
|
-
let
|
|
172
|
-
if ($[
|
|
173
|
-
|
|
186
|
+
const buttonText = t13;
|
|
187
|
+
let t14;
|
|
188
|
+
if ($[24] !== isError || $[25] !== styles.errorBanner) {
|
|
189
|
+
t14 = isError && /*#__PURE__*/_jsx(Banner, {
|
|
174
190
|
appearance: "error",
|
|
175
191
|
description: "There was an issue starting the conversation. Please try again.",
|
|
176
192
|
style: styles.errorBanner
|
|
177
193
|
});
|
|
178
|
-
$[
|
|
179
|
-
$[
|
|
180
|
-
$[
|
|
194
|
+
$[24] = isError;
|
|
195
|
+
$[25] = styles.errorBanner;
|
|
196
|
+
$[26] = t14;
|
|
181
197
|
} else {
|
|
182
|
-
|
|
198
|
+
t14 = $[26];
|
|
183
199
|
}
|
|
184
|
-
let
|
|
185
|
-
if ($[
|
|
186
|
-
|
|
187
|
-
$[
|
|
200
|
+
let t15;
|
|
201
|
+
if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
|
|
202
|
+
t15 = () => setSelectedPeople(new Map());
|
|
203
|
+
$[27] = t15;
|
|
188
204
|
} else {
|
|
189
|
-
|
|
205
|
+
t15 = $[27];
|
|
190
206
|
}
|
|
191
|
-
let
|
|
192
|
-
if ($[
|
|
193
|
-
|
|
207
|
+
let t16;
|
|
208
|
+
if ($[28] !== searchTerm || $[29] !== selectedPeople) {
|
|
209
|
+
t16 = /*#__PURE__*/_jsx(ToField, {
|
|
194
210
|
selectedPeople: selectedPeople,
|
|
195
211
|
searchTerm: searchTerm,
|
|
196
212
|
onSearchChange: setSearchTerm,
|
|
197
213
|
onRemove: removePerson,
|
|
198
|
-
onClear:
|
|
214
|
+
onClear: t15,
|
|
199
215
|
searchInputRef: searchInputRef
|
|
200
216
|
});
|
|
201
|
-
$[
|
|
202
|
-
$[
|
|
203
|
-
$[
|
|
217
|
+
$[28] = searchTerm;
|
|
218
|
+
$[29] = selectedPeople;
|
|
219
|
+
$[30] = t16;
|
|
204
220
|
} else {
|
|
205
|
-
|
|
221
|
+
t16 = $[30];
|
|
206
222
|
}
|
|
207
|
-
let
|
|
208
|
-
if ($[
|
|
209
|
-
|
|
223
|
+
let t17;
|
|
224
|
+
if ($[31] !== styles.errorBanner) {
|
|
225
|
+
t17 = /*#__PURE__*/_jsx(Banner, {
|
|
210
226
|
appearance: "error",
|
|
211
227
|
description: "Couldn't load people right now. Try again.",
|
|
212
228
|
style: styles.errorBanner
|
|
213
229
|
});
|
|
214
|
-
$[
|
|
215
|
-
$[
|
|
230
|
+
$[31] = styles.errorBanner;
|
|
231
|
+
$[32] = t17;
|
|
216
232
|
} else {
|
|
217
|
-
|
|
233
|
+
t17 = $[32];
|
|
218
234
|
}
|
|
219
|
-
let
|
|
220
|
-
if ($[
|
|
221
|
-
|
|
235
|
+
let t18;
|
|
236
|
+
if ($[33] !== debouncedTerm || $[34] !== selectPerson || $[35] !== selectedPeople) {
|
|
237
|
+
t18 = /*#__PURE__*/_jsx(CandidateResults, {
|
|
222
238
|
term: debouncedTerm,
|
|
223
239
|
selectedPeople: selectedPeople,
|
|
224
240
|
onSelect: selectPerson
|
|
225
241
|
});
|
|
226
|
-
$[
|
|
227
|
-
$[
|
|
228
|
-
$[
|
|
229
|
-
$[
|
|
242
|
+
$[33] = debouncedTerm;
|
|
243
|
+
$[34] = selectPerson;
|
|
244
|
+
$[35] = selectedPeople;
|
|
245
|
+
$[36] = t18;
|
|
230
246
|
} else {
|
|
231
|
-
|
|
247
|
+
t18 = $[36];
|
|
232
248
|
}
|
|
233
|
-
let
|
|
234
|
-
if ($[
|
|
235
|
-
|
|
236
|
-
fallback:
|
|
237
|
-
children:
|
|
249
|
+
let t19;
|
|
250
|
+
if ($[37] !== debouncedTerm || $[38] !== t17 || $[39] !== t18) {
|
|
251
|
+
t19 = /*#__PURE__*/_jsx(ComponentErrorBoundary, {
|
|
252
|
+
fallback: t17,
|
|
253
|
+
children: t18
|
|
238
254
|
}, debouncedTerm);
|
|
239
|
-
$[
|
|
240
|
-
$[
|
|
241
|
-
$[
|
|
242
|
-
$[
|
|
255
|
+
$[37] = debouncedTerm;
|
|
256
|
+
$[38] = t17;
|
|
257
|
+
$[39] = t18;
|
|
258
|
+
$[40] = t19;
|
|
243
259
|
} else {
|
|
244
|
-
|
|
260
|
+
t19 = $[40];
|
|
245
261
|
}
|
|
246
|
-
let
|
|
247
|
-
if ($[
|
|
248
|
-
|
|
262
|
+
let t20;
|
|
263
|
+
if ($[41] !== styles.candidateResultsContainer || $[42] !== t19) {
|
|
264
|
+
t20 = /*#__PURE__*/_jsx(View, {
|
|
249
265
|
style: styles.candidateResultsContainer,
|
|
250
|
-
children:
|
|
266
|
+
children: t19
|
|
251
267
|
});
|
|
252
|
-
$[
|
|
253
|
-
$[
|
|
254
|
-
$[
|
|
268
|
+
$[41] = styles.candidateResultsContainer;
|
|
269
|
+
$[42] = t19;
|
|
270
|
+
$[43] = t20;
|
|
255
271
|
} else {
|
|
256
|
-
|
|
272
|
+
t20 = $[43];
|
|
257
273
|
}
|
|
258
|
-
const
|
|
259
|
-
const
|
|
260
|
-
let
|
|
261
|
-
if ($[
|
|
262
|
-
|
|
263
|
-
$[
|
|
264
|
-
$[
|
|
265
|
-
$[
|
|
274
|
+
const t21 = selectedPeople.size === 0 || validationPending || warnings.length > 0 || isFinding;
|
|
275
|
+
const t22 = validationPending || isFinding;
|
|
276
|
+
let t23;
|
|
277
|
+
if ($[44] !== findOrCreateConversation || $[45] !== recipientIds) {
|
|
278
|
+
t23 = () => findOrCreateConversation(recipientIds);
|
|
279
|
+
$[44] = findOrCreateConversation;
|
|
280
|
+
$[45] = recipientIds;
|
|
281
|
+
$[46] = t23;
|
|
266
282
|
} else {
|
|
267
|
-
|
|
283
|
+
t23 = $[46];
|
|
268
284
|
}
|
|
269
|
-
let
|
|
270
|
-
if ($[
|
|
271
|
-
|
|
285
|
+
let t24;
|
|
286
|
+
if ($[47] !== buttonText || $[48] !== t21 || $[49] !== t22 || $[50] !== t23 || $[51] !== warnings) {
|
|
287
|
+
t24 = /*#__PURE__*/_jsx(ActionButton, {
|
|
272
288
|
title: buttonText,
|
|
273
|
-
disabled:
|
|
274
|
-
loading:
|
|
275
|
-
onPress:
|
|
289
|
+
disabled: t21,
|
|
290
|
+
loading: t22,
|
|
291
|
+
onPress: t23,
|
|
276
292
|
warnings: warnings
|
|
277
293
|
});
|
|
278
|
-
$[
|
|
279
|
-
$[
|
|
280
|
-
$[46] = t20;
|
|
281
|
-
$[47] = t21;
|
|
282
|
-
$[48] = warnings;
|
|
294
|
+
$[47] = buttonText;
|
|
295
|
+
$[48] = t21;
|
|
283
296
|
$[49] = t22;
|
|
297
|
+
$[50] = t23;
|
|
298
|
+
$[51] = warnings;
|
|
299
|
+
$[52] = t24;
|
|
284
300
|
} else {
|
|
285
|
-
|
|
301
|
+
t24 = $[52];
|
|
286
302
|
}
|
|
287
|
-
let
|
|
288
|
-
if ($[
|
|
289
|
-
|
|
290
|
-
children: [
|
|
303
|
+
let t25;
|
|
304
|
+
if ($[53] !== t14 || $[54] !== t16 || $[55] !== t20 || $[56] !== t24) {
|
|
305
|
+
t25 = /*#__PURE__*/_jsxs(KeyboardView, {
|
|
306
|
+
children: [t14, t16, t20, t24]
|
|
291
307
|
});
|
|
292
|
-
$[
|
|
293
|
-
$[
|
|
294
|
-
$[
|
|
295
|
-
$[
|
|
296
|
-
$[
|
|
308
|
+
$[53] = t14;
|
|
309
|
+
$[54] = t16;
|
|
310
|
+
$[55] = t20;
|
|
311
|
+
$[56] = t24;
|
|
312
|
+
$[57] = t25;
|
|
297
313
|
} else {
|
|
298
|
-
|
|
314
|
+
t25 = $[57];
|
|
299
315
|
}
|
|
300
|
-
return
|
|
316
|
+
return t25;
|
|
301
317
|
}
|
|
302
318
|
function _temp(person) {
|
|
303
319
|
return [person.id, {
|