@planningcenter/chat-react-native 4.2.1-qa-staging.9 → 4.2.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.
Files changed (106) hide show
  1. package/build/components/conversation/message_form.d.ts +1 -2
  2. package/build/components/conversation/message_form.d.ts.map +1 -1
  3. package/build/components/conversation/message_form.js +370 -167
  4. package/build/components/conversation/message_form.js.map +1 -1
  5. package/build/components/conversation/message_list.d.ts +2 -5
  6. package/build/components/conversation/message_list.d.ts.map +1 -1
  7. package/build/components/conversation/message_list.js +67 -187
  8. package/build/components/conversation/message_list.js.map +1 -1
  9. package/build/hooks/groups/use_group_members_for_new_conversation.d.ts +3 -4
  10. package/build/hooks/groups/use_group_members_for_new_conversation.d.ts.map +1 -1
  11. package/build/hooks/index.d.ts +0 -1
  12. package/build/hooks/index.d.ts.map +1 -1
  13. package/build/hooks/index.js +0 -1
  14. package/build/hooks/index.js.map +1 -1
  15. package/build/hooks/use_conversation_messages.d.ts +5 -14
  16. package/build/hooks/use_conversation_messages.d.ts.map +1 -1
  17. package/build/hooks/use_conversation_messages.js +42 -218
  18. package/build/hooks/use_conversation_messages.js.map +1 -1
  19. package/build/hooks/use_conversation_messages_jolt_events.d.ts.map +1 -1
  20. package/build/hooks/use_conversation_messages_jolt_events.js +42 -58
  21. package/build/hooks/use_conversation_messages_jolt_events.js.map +1 -1
  22. package/build/hooks/use_features.d.ts +1 -2
  23. package/build/hooks/use_features.d.ts.map +1 -1
  24. package/build/hooks/use_features.js +1 -2
  25. package/build/hooks/use_features.js.map +1 -1
  26. package/build/hooks/use_mark_latest_message_read.d.ts +1 -2
  27. package/build/hooks/use_mark_latest_message_read.d.ts.map +1 -1
  28. package/build/hooks/use_mark_latest_message_read.js +3 -4
  29. package/build/hooks/use_mark_latest_message_read.js.map +1 -1
  30. package/build/hooks/use_read_receipts.d.ts +3 -4
  31. package/build/hooks/use_read_receipts.d.ts.map +1 -1
  32. package/build/hooks/use_suspense_api.d.ts +6 -10
  33. package/build/hooks/use_suspense_api.d.ts.map +1 -1
  34. package/build/hooks/use_suspense_api.js +63 -83
  35. package/build/hooks/use_suspense_api.js.map +1 -1
  36. package/build/screens/conversation_new/components/services_form.js +8 -9
  37. package/build/screens/conversation_new/components/services_form.js.map +1 -1
  38. package/build/screens/conversation_screen.d.ts +0 -1
  39. package/build/screens/conversation_screen.d.ts.map +1 -1
  40. package/build/screens/conversation_screen.js +203 -305
  41. package/build/screens/conversation_screen.js.map +1 -1
  42. package/build/screens/message_actions_screen.d.ts.map +1 -1
  43. package/build/screens/message_actions_screen.js +92 -103
  44. package/build/screens/message_actions_screen.js.map +1 -1
  45. package/build/screens/notification_settings/hooks/groups.d.ts +3 -4
  46. package/build/screens/notification_settings/hooks/groups.d.ts.map +1 -1
  47. package/build/types/api_primitives.d.ts +0 -1
  48. package/build/types/api_primitives.d.ts.map +1 -1
  49. package/build/types/api_primitives.js.map +1 -1
  50. package/build/types/resources/member.d.ts +0 -1
  51. package/build/types/resources/member.d.ts.map +1 -1
  52. package/build/types/resources/member.js.map +1 -1
  53. package/build/utils/cache/messages_cache.d.ts +0 -1
  54. package/build/utils/cache/messages_cache.d.ts.map +1 -1
  55. package/build/utils/cache/messages_cache.js +1 -37
  56. package/build/utils/cache/messages_cache.js.map +1 -1
  57. package/build/utils/client/types.d.ts +0 -1
  58. package/build/utils/client/types.d.ts.map +1 -1
  59. package/build/utils/client/types.js.map +1 -1
  60. package/build/utils/group_messages.js +1 -4
  61. package/build/utils/group_messages.js.map +1 -1
  62. package/package.json +3 -3
  63. package/src/__tests__/hooks/use_features.test.ts +2 -10
  64. package/src/__utils__/query_client.ts +0 -3
  65. package/src/components/conversation/message_form.tsx +3 -31
  66. package/src/components/conversation/message_list.tsx +4 -88
  67. package/src/hooks/__tests__/use_message_create_or_update.test.tsx +7 -2
  68. package/src/hooks/index.ts +0 -1
  69. package/src/hooks/use_conversation_messages.ts +17 -103
  70. package/src/hooks/use_conversation_messages_jolt_events.ts +2 -12
  71. package/src/hooks/use_features.ts +2 -3
  72. package/src/hooks/use_mark_latest_message_read.ts +3 -4
  73. package/src/hooks/use_suspense_api.ts +6 -14
  74. package/src/screens/conversation_new/components/services_form.tsx +5 -5
  75. package/src/screens/conversation_screen.tsx +13 -62
  76. package/src/screens/message_actions_screen.tsx +1 -12
  77. package/src/types/api_primitives.ts +0 -1
  78. package/src/types/resources/member.ts +0 -1
  79. package/src/utils/__tests__/group_messages.test.ts +0 -29
  80. package/src/utils/cache/__tests__/messages_cache.test.ts +1 -2
  81. package/src/utils/cache/__tests__/messages_cache_reply_roots.test.ts +2 -3
  82. package/src/utils/cache/messages_cache.ts +1 -45
  83. package/src/utils/client/types.ts +0 -1
  84. package/src/utils/group_messages.ts +1 -4
  85. package/build/components/conversation/missing_message.d.ts +0 -2
  86. package/build/components/conversation/missing_message.d.ts.map +0 -1
  87. package/build/components/conversation/missing_message.js +0 -139
  88. package/build/components/conversation/missing_message.js.map +0 -1
  89. package/build/hooks/use_direct_message_eligibility.d.ts +0 -14
  90. package/build/hooks/use_direct_message_eligibility.d.ts.map +0 -1
  91. package/build/hooks/use_direct_message_eligibility.js +0 -87
  92. package/build/hooks/use_direct_message_eligibility.js.map +0 -1
  93. package/build/utils/cache/messages_window.d.ts +0 -11
  94. package/build/utils/cache/messages_window.d.ts.map +0 -1
  95. package/build/utils/cache/messages_window.js +0 -51
  96. package/build/utils/cache/messages_window.js.map +0 -1
  97. package/src/__tests__/hooks/use_direct_message_eligibility.test.tsx +0 -83
  98. package/src/__tests__/screens/conversation_new/components/services_form.test.tsx +0 -91
  99. package/src/components/conversation/missing_message.tsx +0 -66
  100. package/src/hooks/__tests__/use_conversation_messages.test.tsx +0 -333
  101. package/src/hooks/__tests__/use_conversation_messages_jolt_events.test.tsx +0 -87
  102. package/src/hooks/__tests__/use_mark_latest_message_read.test.tsx +0 -33
  103. package/src/hooks/use_direct_message_eligibility.ts +0 -40
  104. package/src/utils/cache/__tests__/messages_cache_deletion.test.ts +0 -97
  105. package/src/utils/cache/__tests__/messages_window.test.ts +0 -78
  106. package/src/utils/cache/messages_window.ts +0 -55
@@ -13,9 +13,8 @@ interface MessagesFormRootProps extends ViewProps {
13
13
  replyRootId?: string | null;
14
14
  replyRootAuthorFirstName?: string | null;
15
15
  onFlaggedInMessageForm?: (id: string) => void;
16
- onBeforeSubmit?: () => void | Promise<void>;
17
16
  }
18
- declare function MessageFormRoot({ conversation, currentlyEditingMessage, children, replyRootId, replyRootAuthorFirstName, onFlaggedInMessageForm, onBeforeSubmit, }: MessagesFormRootProps): import("react/jsx-runtime").JSX.Element;
17
+ declare function MessageFormRoot({ conversation, currentlyEditingMessage, children, replyRootId, replyRootAuthorFirstName, onFlaggedInMessageForm, }: MessagesFormRootProps): import("react/jsx-runtime").JSX.Element;
19
18
  declare function MessageFormInput(): import("react/jsx-runtime").JSX.Element;
20
19
  declare function MessageFormSubmitBtn(): import("react/jsx-runtime").JSX.Element;
21
20
  declare function MessageFormAttachmentPicker(): import("react/jsx-runtime").JSX.Element | null;
@@ -1 +1 @@
1
- {"version":3,"file":"message_form.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/message_form.tsx"],"names":[],"mappings":"AAEA,OAAO,EAQL,SAAS,EAEV,MAAM,cAAc,CAAA;AAiBrB,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AA8BnE,eAAO,MAAM,WAAW;;;;;;CAOvB,CAAA;AAED,UAAU,qBAAsB,SAAQ,SAAS;IAC/C,YAAY,EAAE,oBAAoB,CAAA;IAClC,uBAAuB,CAAC,EAAE,eAAe,GAAG,IAAI,CAAA;IAChD,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,wBAAwB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxC,sBAAsB,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;IAC7C,cAAc,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAC5C;AAmCD,iBAAS,eAAe,CAAC,EACvB,YAAY,EACZ,uBAAuB,EACvB,QAAQ,EACR,WAAW,EACX,wBAAwB,EACxB,sBAAsB,EACtB,cAAc,GACf,EAAE,qBAAqB,2CAsMvB;AAyID,iBAAS,gBAAgB,4CAyDxB;AAcD,iBAAS,oBAAoB,4CAgD5B;AAED,iBAAS,2BAA2B,mDAuHnC;AAED,iBAAS,mBAAmB,mDAkC3B"}
1
+ {"version":3,"file":"message_form.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/message_form.tsx"],"names":[],"mappings":"AAEA,OAAO,EAQL,SAAS,EAEV,MAAM,cAAc,CAAA;AAiBrB,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AA6BnE,eAAO,MAAM,WAAW;;;;;;CAOvB,CAAA;AAED,UAAU,qBAAsB,SAAQ,SAAS;IAC/C,YAAY,EAAE,oBAAoB,CAAA;IAClC,uBAAuB,CAAC,EAAE,eAAe,GAAG,IAAI,CAAA;IAChD,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,wBAAwB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxC,sBAAsB,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;CAC9C;AAmCD,iBAAS,eAAe,CAAC,EACvB,YAAY,EACZ,uBAAuB,EACvB,QAAQ,EACR,WAAW,EACX,wBAAwB,EACxB,sBAAsB,GACvB,EAAE,qBAAqB,2CA6KvB;AAyID,iBAAS,gBAAgB,4CAyDxB;AAcD,iBAAS,oBAAoB,4CAgD5B;AAED,iBAAS,2BAA2B,mDAuHnC;AAED,iBAAS,mBAAmB,mDAkC3B"}
@@ -1,6 +1,6 @@
1
1
  import { c as _c } from "react/compiler-runtime";
2
2
  import { useNavigation, useTheme as useNavigationTheme, useRoute } from '@react-navigation/native';
3
- import React, { useCallback, useContext, useEffect, useRef, useState } from 'react';
3
+ import React, { useCallback, useContext, useEffect, useState } from 'react';
4
4
  import { Linking, Platform, Pressable, ScrollView, StyleSheet, TextInput, View, Keyboard } from 'react-native';
5
5
  import LinearGradient from 'react-native-linear-gradient';
6
6
  import { Heading, Icon, IconButton, Text, TextButton } from '../../components';
@@ -11,7 +11,7 @@ import { useBroadcastTypingStatus } from '../../hooks/use_broadcast_typing_statu
11
11
  import { useChatConfiguration } from '../../hooks/use_chat_configuration';
12
12
  import { useMessageCreateOrUpdate } from '../../hooks/use_message_create_or_update';
13
13
  import { useMessageDraft } from '../../hooks/use_message_draft';
14
- import { Log, MAX_FONT_SIZE_MULTIPLIER_LANDMARK, platformFontWeightMedium, platformPressedOpacityStyle } from '../../utils';
14
+ import { MAX_FONT_SIZE_MULTIPLIER_LANDMARK, platformFontWeightMedium, platformPressedOpacityStyle } from '../../utils';
15
15
  import { pickAttachmentPreviewKind } from '../../utils/attachment_kind';
16
16
  import { canSubmitMessage } from '../../utils/can_submit_message';
17
17
  import { isInputEditable } from '../../utils/is_input_editable';
@@ -48,15 +48,16 @@ const MessageFormContext = React.createContext({
48
48
  const GIPHY_MAX_LENGTH = 50;
49
49
  const MAX_MESSAGE_LENGTH = 5000;
50
50
  const PLACEHOLDER_FONT_SCALE_THRESHOLD = 1.7;
51
- function MessageFormRoot({
52
- conversation,
53
- currentlyEditingMessage,
54
- children,
55
- replyRootId,
56
- replyRootAuthorFirstName,
57
- onFlaggedInMessageForm,
58
- onBeforeSubmit
59
- }) {
51
+ function MessageFormRoot(t0) {
52
+ const $ = _c(88);
53
+ const {
54
+ conversation,
55
+ currentlyEditingMessage,
56
+ children,
57
+ replyRootId,
58
+ replyRootAuthorFirstName,
59
+ onFlaggedInMessageForm
60
+ } = t0;
60
61
  const {
61
62
  giphyApiKey
62
63
  } = useContext(ChatContext);
@@ -67,162 +68,295 @@ function MessageFormRoot({
67
68
  saveDraft,
68
69
  clearDraft
69
70
  } = useMessageDraft();
70
- const [text, setText] = React.useState(() => {
71
- // Initialize from draft only when not editing a message
72
- return currentlyEditingMessage ? '' : draft?.text || '';
73
- });
71
+ let t1;
72
+ if ($[0] !== currentlyEditingMessage || $[1] !== draft?.text) {
73
+ t1 = () => currentlyEditingMessage ? "" : draft?.text || "";
74
+ $[0] = currentlyEditingMessage;
75
+ $[1] = draft?.text;
76
+ $[2] = t1;
77
+ } else {
78
+ t1 = $[2];
79
+ }
80
+ const [text, setText] = React.useState(t1);
74
81
  const [usingGiphy, setUsingGiphy] = useState(false);
75
82
  const navigation = useNavigation();
76
83
  const route = useRoute();
84
+ const t2 = currentlyEditingMessage || undefined;
85
+ let t3;
86
+ if ($[3] !== conversation.id || $[4] !== replyRootId || $[5] !== t2) {
87
+ t3 = {
88
+ conversationId: conversation.id,
89
+ message: t2,
90
+ replyRootId
91
+ };
92
+ $[3] = conversation.id;
93
+ $[4] = replyRootId;
94
+ $[5] = t2;
95
+ $[6] = t3;
96
+ } else {
97
+ t3 = $[6];
98
+ }
77
99
  const {
78
100
  status,
79
101
  isPending,
80
102
  reset: resetMutation,
81
103
  mutateAsync
82
- } = useMessageCreateOrUpdate({
83
- conversationId: conversation.id,
84
- message: currentlyEditingMessage || undefined,
85
- replyRootId
86
- });
87
- const attachmentUploader = useAttachmentUploader({
88
- conversationId: conversation.id,
89
- draftAttachments: currentlyEditingMessage ? undefined : draft?.attachments,
90
- onFlaggedInMessageForm
91
- });
104
+ } = useMessageCreateOrUpdate(t3);
105
+ const t4 = currentlyEditingMessage ? undefined : draft?.attachments;
106
+ let t5;
107
+ if ($[7] !== conversation.id || $[8] !== onFlaggedInMessageForm || $[9] !== t4) {
108
+ t5 = {
109
+ conversationId: conversation.id,
110
+ draftAttachments: t4,
111
+ onFlaggedInMessageForm
112
+ };
113
+ $[7] = conversation.id;
114
+ $[8] = onFlaggedInMessageForm;
115
+ $[9] = t4;
116
+ $[10] = t5;
117
+ } else {
118
+ t5 = $[10];
119
+ }
120
+ const attachmentUploader = useAttachmentUploader(t5);
92
121
  const resetAttachmentUploader = attachmentUploader.reset;
93
- const reset = useCallback(() => {
94
- resetAttachmentUploader();
95
- resetMutation();
96
- setText('');
97
- setUsingGiphy(false);
98
- if (!currentlyEditingMessage) {
99
- clearDraft();
100
- }
101
- navigation.setParams({
102
- editing_message_id: null
103
- });
104
- }, [resetAttachmentUploader, resetMutation, navigation, currentlyEditingMessage, clearDraft]);
105
- useEffect(() => {
106
- if (canGiphy && !usingGiphy && text.startsWith('/giphy ')) {
107
- setUsingGiphy(true);
108
- setText('');
109
- }
110
- }, [canGiphy, text, usingGiphy]);
111
- useEffect(() => {
112
- switch (status) {
113
- case 'success':
114
- reset();
115
- break;
116
- }
117
- }, [reset, status]);
118
- useEffect(() => {
119
- if (route.params.clear_input) {
120
- reset();
122
+ let t6;
123
+ if ($[11] !== clearDraft || $[12] !== currentlyEditingMessage || $[13] !== navigation || $[14] !== resetAttachmentUploader || $[15] !== resetMutation) {
124
+ t6 = () => {
125
+ resetAttachmentUploader();
126
+ resetMutation();
127
+ setText("");
128
+ setUsingGiphy(false);
129
+ if (!currentlyEditingMessage) {
130
+ clearDraft();
131
+ }
121
132
  navigation.setParams({
122
- ...route.params,
123
- clear_input: false
133
+ editing_message_id: null
124
134
  });
125
- }
126
- }, [reset, navigation, route.params]);
127
-
128
- // Save draft when text or attachments change (debounced)
129
- useEffect(() => {
130
- // Don't save drafts when editing a message
131
- if (currentlyEditingMessage) return;
132
- const timeoutId = setTimeout(() => {
133
- saveDraft(text, attachmentUploader.attachments);
134
- }, 500);
135
- return () => clearTimeout(timeoutId);
136
- }, [text, attachmentUploader.attachments, saveDraft, currentlyEditingMessage]);
137
- const canSubmit = canSubmitMessage({
138
- isPending,
139
- conversationDisabled: conversation.disabled ?? false,
140
- pendingUploads: !!attachmentUploader?.pendingUploads,
141
- hasFlaggedAttachments: !!attachmentUploader?.flaggedAttachmentCount,
142
- hasText: hasMessageText(text),
143
- hasSendableAttachments: !!attachmentUploader?.attachmentIds?.length
144
- });
135
+ };
136
+ $[11] = clearDraft;
137
+ $[12] = currentlyEditingMessage;
138
+ $[13] = navigation;
139
+ $[14] = resetAttachmentUploader;
140
+ $[15] = resetMutation;
141
+ $[16] = t6;
142
+ } else {
143
+ t6 = $[16];
144
+ }
145
+ const reset = t6;
146
+ let t7;
147
+ let t8;
148
+ if ($[17] !== canGiphy || $[18] !== text || $[19] !== usingGiphy) {
149
+ t7 = () => {
150
+ if (canGiphy && !usingGiphy && text.startsWith("/giphy ")) {
151
+ setUsingGiphy(true);
152
+ setText("");
153
+ }
154
+ };
155
+ t8 = [canGiphy, text, usingGiphy];
156
+ $[17] = canGiphy;
157
+ $[18] = text;
158
+ $[19] = usingGiphy;
159
+ $[20] = t7;
160
+ $[21] = t8;
161
+ } else {
162
+ t7 = $[20];
163
+ t8 = $[21];
164
+ }
165
+ useEffect(t7, t8);
166
+ let t10;
167
+ let t9;
168
+ if ($[22] !== reset || $[23] !== status) {
169
+ t9 = () => {
170
+ switch (status) {
171
+ case "success":
172
+ {
173
+ reset();
174
+ }
175
+ }
176
+ };
177
+ t10 = [reset, status];
178
+ $[22] = reset;
179
+ $[23] = status;
180
+ $[24] = t10;
181
+ $[25] = t9;
182
+ } else {
183
+ t10 = $[24];
184
+ t9 = $[25];
185
+ }
186
+ useEffect(t9, t10);
187
+ let t11;
188
+ let t12;
189
+ if ($[26] !== navigation || $[27] !== reset || $[28] !== route.params) {
190
+ t11 = () => {
191
+ if (route.params.clear_input) {
192
+ reset();
193
+ navigation.setParams({
194
+ ...route.params,
195
+ clear_input: false
196
+ });
197
+ }
198
+ };
199
+ t12 = [reset, navigation, route.params];
200
+ $[26] = navigation;
201
+ $[27] = reset;
202
+ $[28] = route.params;
203
+ $[29] = t11;
204
+ $[30] = t12;
205
+ } else {
206
+ t11 = $[29];
207
+ t12 = $[30];
208
+ }
209
+ useEffect(t11, t12);
210
+ let t13;
211
+ let t14;
212
+ if ($[31] !== attachmentUploader.attachments || $[32] !== currentlyEditingMessage || $[33] !== saveDraft || $[34] !== text) {
213
+ t13 = () => {
214
+ if (currentlyEditingMessage) {
215
+ return;
216
+ }
217
+ const timeoutId = setTimeout(() => {
218
+ saveDraft(text, attachmentUploader.attachments);
219
+ }, 500);
220
+ return () => clearTimeout(timeoutId);
221
+ };
222
+ t14 = [text, attachmentUploader.attachments, saveDraft, currentlyEditingMessage];
223
+ $[31] = attachmentUploader.attachments;
224
+ $[32] = currentlyEditingMessage;
225
+ $[33] = saveDraft;
226
+ $[34] = text;
227
+ $[35] = t13;
228
+ $[36] = t14;
229
+ } else {
230
+ t13 = $[35];
231
+ t14 = $[36];
232
+ }
233
+ useEffect(t13, t14);
234
+ const t15 = conversation.disabled ?? false;
235
+ const t16 = !!attachmentUploader?.pendingUploads;
236
+ const t17 = !!attachmentUploader?.flaggedAttachmentCount;
237
+ let t18;
238
+ if ($[37] !== attachmentUploader.attachmentIds?.length || $[38] !== isPending || $[39] !== t15 || $[40] !== t16 || $[41] !== t17 || $[42] !== text) {
239
+ t18 = canSubmitMessage({
240
+ isPending,
241
+ conversationDisabled: t15,
242
+ pendingUploads: t16,
243
+ hasFlaggedAttachments: t17,
244
+ hasText: hasMessageText(text),
245
+ hasSendableAttachments: !!attachmentUploader?.attachmentIds?.length
246
+ });
247
+ $[37] = attachmentUploader.attachmentIds?.length;
248
+ $[38] = isPending;
249
+ $[39] = t15;
250
+ $[40] = t16;
251
+ $[41] = t17;
252
+ $[42] = text;
253
+ $[43] = t18;
254
+ } else {
255
+ t18 = $[43];
256
+ }
257
+ const canSubmit = t18;
145
258
  const disabled = !canSubmit;
146
- const inputEditable = isInputEditable({
147
- isPending,
148
- conversationDisabled: conversation.disabled ?? false
149
- });
150
-
151
- /*
152
- Opening a FormSheet on Android while the keyboard is visible breaks the FormSheet's height & position.
153
- This is a workaround to ensure we don't open the FormSheet while the keyboard is visible.
154
- */
155
- const navigateToSendGiphyAfterKeyboardHides = useCallback(() => {
156
- if (!Keyboard.isVisible() || Platform.OS === 'ios') {
157
- navigation.navigate('SendGiphy', {
158
- conversation_id: conversation.id,
159
- search_term: text
160
- });
161
- } else {
162
- const keyboardListener = Keyboard.addListener('keyboardDidHide', () => {
163
- navigation.navigate('SendGiphy', {
259
+ const t19 = conversation.disabled ?? false;
260
+ let t20;
261
+ if ($[44] !== isPending || $[45] !== t19) {
262
+ t20 = isInputEditable({
263
+ isPending,
264
+ conversationDisabled: t19
265
+ });
266
+ $[44] = isPending;
267
+ $[45] = t19;
268
+ $[46] = t20;
269
+ } else {
270
+ t20 = $[46];
271
+ }
272
+ const inputEditable = t20;
273
+ let t21;
274
+ if ($[47] !== conversation.id || $[48] !== navigation || $[49] !== text) {
275
+ t21 = () => {
276
+ if (!Keyboard.isVisible() || Platform.OS === "ios") {
277
+ navigation.navigate("SendGiphy", {
164
278
  conversation_id: conversation.id,
165
279
  search_term: text
166
280
  });
167
- keyboardListener?.remove();
168
- });
169
- }
170
- }, [conversation.id, navigation, text]);
171
- const catchingUp = useRef(false);
172
-
173
- // A send from a window behind the live edge would leave a gap above it, so a failed
174
- // catch-up stops the send and keeps what was typed.
175
- const catchUpBeforeSend = async () => {
176
- if (catchingUp.current) return false;
177
- catchingUp.current = true;
178
- try {
179
- await onBeforeSubmit?.();
180
- return true;
181
- } catch (error) {
182
- Log.error('send stopped: live window fetch failed', error);
183
- return false;
184
- } finally {
185
- catchingUp.current = false;
186
- }
187
- };
188
- const handleSubmit = async () => {
189
- if (!canSubmit) return;
190
- if (canGiphy && usingGiphy) {
191
- if (!(await catchUpBeforeSend())) return;
192
- TextInput.State.blurTextInput(TextInput.State.currentlyFocusedInput());
193
- Haptic.impactLight();
194
- navigateToSendGiphyAfterKeyboardHides();
195
- } else {
196
- let attachmentsForSubmit = attachmentUploader.attachments.filter(a => a.status === 'success' && a.id).map(attachment => ({
197
- type: 'MessageAttachment',
198
- id: attachment.id,
199
- file: attachment.file
200
- }));
201
- const messageText = stripEmptyTextCharacters(text);
202
- if (currentlyEditingMessage) {
203
- mutateAsync({
204
- text: messageText
205
- });
206
- reset();
207
281
  } else {
208
- // The live-window fetch replaces the cache, which would wipe an optimistic row
209
- // added earlier.
210
- if (!(await catchUpBeforeSend())) return;
211
- reset();
212
- mutateAsync({
213
- text: messageText,
214
- attachments: attachmentsForSubmit
282
+ const keyboardListener = Keyboard.addListener("keyboardDidHide", () => {
283
+ navigation.navigate("SendGiphy", {
284
+ conversation_id: conversation.id,
285
+ search_term: text
286
+ });
287
+ keyboardListener?.remove();
215
288
  });
216
289
  }
217
- }
218
- };
219
- useEffect(() => {
220
- if (currentlyEditingMessage) {
221
- setText(currentlyEditingMessage.text || '');
222
- }
223
- }, [currentlyEditingMessage]);
224
- return /*#__PURE__*/_jsx(MessageFormContext.Provider, {
225
- value: {
290
+ };
291
+ $[47] = conversation.id;
292
+ $[48] = navigation;
293
+ $[49] = text;
294
+ $[50] = t21;
295
+ } else {
296
+ t21 = $[50];
297
+ }
298
+ const navigateToSendGiphyAfterKeyboardHides = t21;
299
+ let t22;
300
+ if ($[51] !== attachmentUploader.attachments || $[52] !== canGiphy || $[53] !== canSubmit || $[54] !== currentlyEditingMessage || $[55] !== mutateAsync || $[56] !== navigateToSendGiphyAfterKeyboardHides || $[57] !== reset || $[58] !== text || $[59] !== usingGiphy) {
301
+ t22 = () => {
302
+ if (!canSubmit) {
303
+ return;
304
+ }
305
+ if (canGiphy && usingGiphy) {
306
+ TextInput.State.blurTextInput(TextInput.State.currentlyFocusedInput());
307
+ Haptic.impactLight();
308
+ navigateToSendGiphyAfterKeyboardHides();
309
+ } else {
310
+ const attachmentsForSubmit = attachmentUploader.attachments.filter(_temp).map(_temp2);
311
+ const messageText = stripEmptyTextCharacters(text);
312
+ if (currentlyEditingMessage) {
313
+ mutateAsync({
314
+ text: messageText
315
+ });
316
+ reset();
317
+ } else {
318
+ mutateAsync({
319
+ text: messageText,
320
+ attachments: attachmentsForSubmit
321
+ });
322
+ reset();
323
+ }
324
+ }
325
+ };
326
+ $[51] = attachmentUploader.attachments;
327
+ $[52] = canGiphy;
328
+ $[53] = canSubmit;
329
+ $[54] = currentlyEditingMessage;
330
+ $[55] = mutateAsync;
331
+ $[56] = navigateToSendGiphyAfterKeyboardHides;
332
+ $[57] = reset;
333
+ $[58] = text;
334
+ $[59] = usingGiphy;
335
+ $[60] = t22;
336
+ } else {
337
+ t22 = $[60];
338
+ }
339
+ const handleSubmit = t22;
340
+ let t23;
341
+ let t24;
342
+ if ($[61] !== currentlyEditingMessage) {
343
+ t23 = () => {
344
+ if (currentlyEditingMessage) {
345
+ setText(currentlyEditingMessage.text || "");
346
+ }
347
+ };
348
+ t24 = [currentlyEditingMessage];
349
+ $[61] = currentlyEditingMessage;
350
+ $[62] = t23;
351
+ $[63] = t24;
352
+ } else {
353
+ t23 = $[62];
354
+ t24 = $[63];
355
+ }
356
+ useEffect(t23, t24);
357
+ let t25;
358
+ if ($[64] !== attachmentUploader || $[65] !== canGiphy || $[66] !== currentlyEditingMessage || $[67] !== disabled || $[68] !== handleSubmit || $[69] !== inputEditable || $[70] !== replyRootAuthorFirstName || $[71] !== replyRootId || $[72] !== reset || $[73] !== text || $[74] !== usingGiphy) {
359
+ t25 = {
226
360
  text,
227
361
  setText,
228
362
  onSubmit: handleSubmit,
@@ -236,15 +370,84 @@ function MessageFormRoot({
236
370
  reset,
237
371
  replyRootId,
238
372
  replyRootAuthorFirstName
239
- },
240
- children: /*#__PURE__*/_jsxs(View, {
373
+ };
374
+ $[64] = attachmentUploader;
375
+ $[65] = canGiphy;
376
+ $[66] = currentlyEditingMessage;
377
+ $[67] = disabled;
378
+ $[68] = handleSubmit;
379
+ $[69] = inputEditable;
380
+ $[70] = replyRootAuthorFirstName;
381
+ $[71] = replyRootId;
382
+ $[72] = reset;
383
+ $[73] = text;
384
+ $[74] = usingGiphy;
385
+ $[75] = t25;
386
+ } else {
387
+ t25 = $[75];
388
+ }
389
+ let t26;
390
+ let t27;
391
+ let t28;
392
+ if ($[76] === Symbol.for("react.memo_cache_sentinel")) {
393
+ t26 = /*#__PURE__*/_jsx(EditingIndicator, {});
394
+ t27 = /*#__PURE__*/_jsx(ReplyIndicator, {});
395
+ t28 = /*#__PURE__*/_jsx(FlaggedContentBanner, {});
396
+ $[76] = t26;
397
+ $[77] = t27;
398
+ $[78] = t28;
399
+ } else {
400
+ t26 = $[76];
401
+ t27 = $[77];
402
+ t28 = $[78];
403
+ }
404
+ let t29;
405
+ if ($[79] !== children || $[80] !== styles.textInputContainer) {
406
+ t29 = /*#__PURE__*/_jsx(View, {
407
+ style: styles.textInputContainer,
408
+ children: children
409
+ });
410
+ $[79] = children;
411
+ $[80] = styles.textInputContainer;
412
+ $[81] = t29;
413
+ } else {
414
+ t29 = $[81];
415
+ }
416
+ let t30;
417
+ if ($[82] !== styles.container || $[83] !== t29) {
418
+ t30 = /*#__PURE__*/_jsxs(View, {
241
419
  style: styles.container,
242
- children: [/*#__PURE__*/_jsx(EditingIndicator, {}), /*#__PURE__*/_jsx(ReplyIndicator, {}), /*#__PURE__*/_jsx(FlaggedContentBanner, {}), /*#__PURE__*/_jsx(View, {
243
- style: styles.textInputContainer,
244
- children: children
245
- })]
246
- })
247
- });
420
+ children: [t26, t27, t28, t29]
421
+ });
422
+ $[82] = styles.container;
423
+ $[83] = t29;
424
+ $[84] = t30;
425
+ } else {
426
+ t30 = $[84];
427
+ }
428
+ let t31;
429
+ if ($[85] !== t25 || $[86] !== t30) {
430
+ t31 = /*#__PURE__*/_jsx(MessageFormContext.Provider, {
431
+ value: t25,
432
+ children: t30
433
+ });
434
+ $[85] = t25;
435
+ $[86] = t30;
436
+ $[87] = t31;
437
+ } else {
438
+ t31 = $[87];
439
+ }
440
+ return t31;
441
+ }
442
+ function _temp2(attachment) {
443
+ return {
444
+ type: "MessageAttachment",
445
+ id: attachment.id,
446
+ file: attachment.file
447
+ };
448
+ }
449
+ function _temp(a) {
450
+ return a.status === "success" && a.id;
248
451
  }
249
452
  function MessageFormAttachments() {
250
453
  const $ = _c(10);
@@ -347,7 +550,7 @@ function FlaggedContentBanner() {
347
550
  if ($[0] !== attachmentUploader?.attachments) {
348
551
  t1 = Symbol.for("react.early_return_sentinel");
349
552
  bb0: {
350
- const flaggedAttachments = attachmentUploader?.attachments.filter(_temp) ?? [];
553
+ const flaggedAttachments = attachmentUploader?.attachments.filter(_temp3) ?? [];
351
554
  const flaggedCount = flaggedAttachments.length;
352
555
  if (flaggedCount === 0) {
353
556
  t1 = null;
@@ -454,7 +657,7 @@ function FlaggedContentBanner() {
454
657
  }
455
658
  return t8;
456
659
  }
457
- function _temp(a) {
660
+ function _temp3(a) {
458
661
  return a.flagged;
459
662
  }
460
663
  function BannerMessage(t0) {
@@ -468,7 +671,7 @@ function BannerMessage(t0) {
468
671
  if ($[0] !== styles.flaggedBannerLink) {
469
672
  t1 = /*#__PURE__*/_jsx(Text, {
470
673
  style: styles.flaggedBannerLink,
471
- onPress: _temp2,
674
+ onPress: _temp4,
472
675
  accessibilityRole: "link",
473
676
  children: "content guidelines"
474
677
  });
@@ -497,7 +700,7 @@ function BannerMessage(t0) {
497
700
  }
498
701
  return t2;
499
702
  }
500
- function _temp2() {
703
+ function _temp4() {
501
704
  return Linking.openURL("https://www.planningcenter.com/terms#:~:text=4.%20Acceptable%20Use%20of%20Planning%20Center");
502
705
  }
503
706
  function MessageFormInput() {
@@ -841,7 +1044,7 @@ function MessageFormAttachmentPicker() {
841
1044
  if (result.canceled) {
842
1045
  return;
843
1046
  }
844
- const filteredAssets = result.assets.filter(_temp3).map(_temp4);
1047
+ const filteredAssets = result.assets.filter(_temp5).map(_temp6);
845
1048
  attachmentUploader?.handleFilesAttached(filteredAssets);
846
1049
  };
847
1050
  $[0] = attachmentUploader;
@@ -856,7 +1059,7 @@ function MessageFormAttachmentPicker() {
856
1059
  if (result_0.canceled) {
857
1060
  return;
858
1061
  }
859
- const filteredAssets_0 = result_0.assets.filter(_temp5).map(_temp6);
1062
+ const filteredAssets_0 = result_0.assets.filter(_temp7).map(_temp8);
860
1063
  attachmentUploader?.handleFilesAttached(filteredAssets_0);
861
1064
  };
862
1065
  $[2] = attachmentUploader;
@@ -996,7 +1199,7 @@ function MessageFormAttachmentPicker() {
996
1199
  }
997
1200
  return t8;
998
1201
  }
999
- function _temp6(asset_2) {
1202
+ function _temp8(asset_2) {
1000
1203
  return {
1001
1204
  uri: asset_2.uri,
1002
1205
  name: asset_2.name,
@@ -1004,10 +1207,10 @@ function _temp6(asset_2) {
1004
1207
  size: asset_2.size
1005
1208
  };
1006
1209
  }
1007
- function _temp5(asset_1) {
1210
+ function _temp7(asset_1) {
1008
1211
  return asset_1.size != null && asset_1.uri;
1009
1212
  }
1010
- function _temp4(asset_0) {
1213
+ function _temp6(asset_0) {
1011
1214
  return {
1012
1215
  uri: asset_0.uri,
1013
1216
  name: asset_0.fileName || asset_0.uri.split("/").pop() || "attachment",
@@ -1017,7 +1220,7 @@ function _temp4(asset_0) {
1017
1220
  width: asset_0.width
1018
1221
  };
1019
1222
  }
1020
- function _temp3(asset) {
1223
+ function _temp5(asset) {
1021
1224
  return asset.fileSize && asset.mimeType && asset.uri;
1022
1225
  }
1023
1226
  function MessageFormCommands() {