@planningcenter/chat-react-native 4.0.1-qa-staging.0 → 4.0.1-qa-staging.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/conversation/message.d.ts +3 -2
- package/build/components/conversation/message.d.ts.map +1 -1
- package/build/components/conversation/message.js +23 -22
- package/build/components/conversation/message.js.map +1 -1
- package/build/components/conversation/message_list.d.ts +21 -0
- package/build/components/conversation/message_list.d.ts.map +1 -0
- package/build/components/conversation/message_list.js +273 -0
- package/build/components/conversation/message_list.js.map +1 -0
- package/build/components/conversation/message_read_receipts.d.ts +2 -4
- package/build/components/conversation/message_read_receipts.d.ts.map +1 -1
- package/build/components/conversation/message_read_receipts.js +2 -3
- package/build/components/conversation/message_read_receipts.js.map +1 -1
- package/build/components/conversation/reply_shadow_message.d.ts +2 -1
- package/build/components/conversation/reply_shadow_message.d.ts.map +1 -1
- package/build/components/conversation/reply_shadow_message.js +47 -46
- package/build/components/conversation/reply_shadow_message.js.map +1 -1
- package/build/components/primitive/form_sheet.d.ts +2 -1
- package/build/components/primitive/form_sheet.d.ts.map +1 -1
- package/build/components/primitive/form_sheet.js +68 -53
- package/build/components/primitive/form_sheet.js.map +1 -1
- package/build/hooks/use_conversation_messages.d.ts.map +1 -1
- package/build/hooks/use_conversation_messages.js +40 -28
- package/build/hooks/use_conversation_messages.js.map +1 -1
- package/build/hooks/use_conversation_messages_jolt_events.d.ts.map +1 -1
- package/build/hooks/use_conversation_messages_jolt_events.js +6 -1
- package/build/hooks/use_conversation_messages_jolt_events.js.map +1 -1
- package/build/hooks/use_message_create_or_update.d.ts +99 -4
- package/build/hooks/use_message_create_or_update.d.ts.map +1 -1
- package/build/hooks/use_message_create_or_update.js +47 -6
- package/build/hooks/use_message_create_or_update.js.map +1 -1
- package/build/screens/conversation_screen.d.ts.map +1 -1
- package/build/screens/conversation_screen.js +184 -365
- package/build/screens/conversation_screen.js.map +1 -1
- package/build/screens/conversation_select_type_screen.d.ts.map +1 -1
- package/build/screens/conversation_select_type_screen.js +82 -98
- package/build/screens/conversation_select_type_screen.js.map +1 -1
- package/build/types/resources/message.d.ts +2 -0
- package/build/types/resources/message.d.ts.map +1 -1
- package/build/types/resources/message.js.map +1 -1
- package/build/utils/cache/messages_cache.d.ts +1 -0
- package/build/utils/cache/messages_cache.d.ts.map +1 -1
- package/build/utils/cache/messages_cache.js +14 -7
- package/build/utils/cache/messages_cache.js.map +1 -1
- package/build/utils/cache/optimistically_create_message.d.ts +2 -1
- package/build/utils/cache/optimistically_create_message.d.ts.map +1 -1
- package/build/utils/cache/optimistically_create_message.js +4 -2
- package/build/utils/cache/optimistically_create_message.js.map +1 -1
- package/build/utils/client/transform_response.d.ts.map +1 -1
- package/build/utils/client/transform_response.js +9 -5
- package/build/utils/client/transform_response.js.map +1 -1
- package/build/utils/group_messages.d.ts +1 -0
- package/build/utils/group_messages.d.ts.map +1 -1
- package/build/utils/group_messages.js +10 -1
- package/build/utils/group_messages.js.map +1 -1
- package/build/utils/jolt/transform_message_event_data_to_message_resource.d.ts.map +1 -1
- package/build/utils/jolt/transform_message_event_data_to_message_resource.js +1 -0
- package/build/utils/jolt/transform_message_event_data_to_message_resource.js.map +1 -1
- package/build/utils/replace_equal_by_id.d.ts +6 -0
- package/build/utils/replace_equal_by_id.d.ts.map +1 -0
- package/build/utils/replace_equal_by_id.js +41 -0
- package/build/utils/replace_equal_by_id.js.map +1 -0
- package/build/utils/request/messages_data_options.d.ts.map +1 -1
- package/build/utils/request/messages_data_options.js +2 -2
- package/build/utils/request/messages_data_options.js.map +1 -1
- package/package.json +3 -3
- package/src/components/conversation/__tests__/message_list.test.tsx +271 -0
- package/src/components/conversation/__tests__/reply_shadow_message.test.tsx +119 -0
- package/src/components/conversation/message.tsx +15 -18
- package/src/components/conversation/message_list.tsx +157 -0
- package/src/components/conversation/message_read_receipts.tsx +3 -5
- package/src/components/conversation/reply_shadow_message.tsx +9 -7
- package/src/components/primitive/form_sheet.tsx +10 -3
- package/src/hooks/__tests__/use_message_create_or_update.test.tsx +110 -0
- package/src/hooks/use_conversation_messages.ts +5 -1
- package/src/hooks/use_conversation_messages_jolt_events.ts +7 -0
- package/src/hooks/use_message_create_or_update.ts +29 -16
- package/src/screens/conversation_screen.tsx +11 -104
- package/src/screens/conversation_select_type_screen.tsx +3 -9
- package/src/types/resources/message.ts +2 -0
- package/src/utils/__tests__/group_messages.test.ts +48 -0
- package/src/utils/__tests__/replace_equal_by_id.test.ts +73 -0
- package/src/utils/cache/__tests__/messages_cache.test.ts +89 -0
- package/src/utils/cache/__tests__/messages_cache_reply_roots.test.ts +70 -0
- package/src/utils/cache/messages_cache.ts +27 -11
- package/src/utils/cache/optimistically_create_message.ts +3 -0
- package/src/utils/client/__tests__/transform_response.test.ts +62 -0
- package/src/utils/client/transform_response.ts +7 -5
- package/src/utils/group_messages.ts +18 -1
- package/src/utils/jolt/transform_message_event_data_to_message_resource.ts +1 -0
- package/src/utils/replace_equal_by_id.ts +42 -0
- package/src/utils/request/messages_data_options.ts +2 -1
|
@@ -5,11 +5,106 @@ interface Props {
|
|
|
5
5
|
message?: MessageResource;
|
|
6
6
|
replyRootId?: string | null;
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
interface MessageMutationVariables {
|
|
9
9
|
text: string;
|
|
10
10
|
attachments?: DenormalizedAttachmentResourceForCreate[];
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
idempotentKey?: string;
|
|
12
|
+
}
|
|
13
|
+
type ResolvedMessageMutationVariables = MessageMutationVariables & {
|
|
14
|
+
idempotentKey: string;
|
|
15
|
+
};
|
|
16
|
+
export declare function useMessageCreateOrUpdate({ conversationId, message, replyRootId }: Props): {
|
|
17
|
+
mutate: (variables: MessageMutationVariables, options?: Parameters<import("@tanstack/react-query").UseMutateFunction<ApiResource<MessageResource>, Error, ResolvedMessageMutationVariables, {
|
|
18
|
+
message: MessageResource;
|
|
19
|
+
}>>[1]) => void;
|
|
20
|
+
mutateAsync: (variables: MessageMutationVariables, options?: Parameters<import("@tanstack/react-query").UseMutateAsyncFunction<ApiResource<MessageResource>, Error, ResolvedMessageMutationVariables, {
|
|
21
|
+
message: MessageResource;
|
|
22
|
+
}>>[1]) => Promise<ApiResource<MessageResource>>;
|
|
23
|
+
data: undefined;
|
|
24
|
+
variables: undefined;
|
|
25
|
+
error: null;
|
|
26
|
+
isError: false;
|
|
27
|
+
isIdle: true;
|
|
28
|
+
isPending: false;
|
|
29
|
+
isSuccess: false;
|
|
30
|
+
status: "idle";
|
|
31
|
+
reset: () => void;
|
|
32
|
+
context: {
|
|
33
|
+
message: MessageResource;
|
|
34
|
+
} | undefined;
|
|
35
|
+
failureCount: number;
|
|
36
|
+
failureReason: Error | null;
|
|
37
|
+
isPaused: boolean;
|
|
38
|
+
submittedAt: number;
|
|
39
|
+
} | {
|
|
40
|
+
mutate: (variables: MessageMutationVariables, options?: Parameters<import("@tanstack/react-query").UseMutateFunction<ApiResource<MessageResource>, Error, ResolvedMessageMutationVariables, {
|
|
41
|
+
message: MessageResource;
|
|
42
|
+
}>>[1]) => void;
|
|
43
|
+
mutateAsync: (variables: MessageMutationVariables, options?: Parameters<import("@tanstack/react-query").UseMutateAsyncFunction<ApiResource<MessageResource>, Error, ResolvedMessageMutationVariables, {
|
|
44
|
+
message: MessageResource;
|
|
45
|
+
}>>[1]) => Promise<ApiResource<MessageResource>>;
|
|
46
|
+
data: undefined;
|
|
47
|
+
variables: ResolvedMessageMutationVariables;
|
|
48
|
+
error: null;
|
|
49
|
+
isError: false;
|
|
50
|
+
isIdle: false;
|
|
51
|
+
isPending: true;
|
|
52
|
+
isSuccess: false;
|
|
53
|
+
status: "pending";
|
|
54
|
+
reset: () => void;
|
|
55
|
+
context: {
|
|
56
|
+
message: MessageResource;
|
|
57
|
+
} | undefined;
|
|
58
|
+
failureCount: number;
|
|
59
|
+
failureReason: Error | null;
|
|
60
|
+
isPaused: boolean;
|
|
61
|
+
submittedAt: number;
|
|
62
|
+
} | {
|
|
63
|
+
mutate: (variables: MessageMutationVariables, options?: Parameters<import("@tanstack/react-query").UseMutateFunction<ApiResource<MessageResource>, Error, ResolvedMessageMutationVariables, {
|
|
64
|
+
message: MessageResource;
|
|
65
|
+
}>>[1]) => void;
|
|
66
|
+
mutateAsync: (variables: MessageMutationVariables, options?: Parameters<import("@tanstack/react-query").UseMutateAsyncFunction<ApiResource<MessageResource>, Error, ResolvedMessageMutationVariables, {
|
|
67
|
+
message: MessageResource;
|
|
68
|
+
}>>[1]) => Promise<ApiResource<MessageResource>>;
|
|
69
|
+
data: undefined;
|
|
70
|
+
error: Error;
|
|
71
|
+
variables: ResolvedMessageMutationVariables;
|
|
72
|
+
isError: true;
|
|
73
|
+
isIdle: false;
|
|
74
|
+
isPending: false;
|
|
75
|
+
isSuccess: false;
|
|
76
|
+
status: "error";
|
|
77
|
+
reset: () => void;
|
|
78
|
+
context: {
|
|
79
|
+
message: MessageResource;
|
|
80
|
+
} | undefined;
|
|
81
|
+
failureCount: number;
|
|
82
|
+
failureReason: Error | null;
|
|
83
|
+
isPaused: boolean;
|
|
84
|
+
submittedAt: number;
|
|
85
|
+
} | {
|
|
86
|
+
mutate: (variables: MessageMutationVariables, options?: Parameters<import("@tanstack/react-query").UseMutateFunction<ApiResource<MessageResource>, Error, ResolvedMessageMutationVariables, {
|
|
87
|
+
message: MessageResource;
|
|
88
|
+
}>>[1]) => void;
|
|
89
|
+
mutateAsync: (variables: MessageMutationVariables, options?: Parameters<import("@tanstack/react-query").UseMutateAsyncFunction<ApiResource<MessageResource>, Error, ResolvedMessageMutationVariables, {
|
|
90
|
+
message: MessageResource;
|
|
91
|
+
}>>[1]) => Promise<ApiResource<MessageResource>>;
|
|
92
|
+
data: ApiResource<MessageResource>;
|
|
93
|
+
error: null;
|
|
94
|
+
variables: ResolvedMessageMutationVariables;
|
|
95
|
+
isError: false;
|
|
96
|
+
isIdle: false;
|
|
97
|
+
isPending: false;
|
|
98
|
+
isSuccess: true;
|
|
99
|
+
status: "success";
|
|
100
|
+
reset: () => void;
|
|
101
|
+
context: {
|
|
102
|
+
message: MessageResource;
|
|
103
|
+
} | undefined;
|
|
104
|
+
failureCount: number;
|
|
105
|
+
failureReason: Error | null;
|
|
106
|
+
isPaused: boolean;
|
|
107
|
+
submittedAt: number;
|
|
108
|
+
};
|
|
14
109
|
export {};
|
|
15
110
|
//# sourceMappingURL=use_message_create_or_update.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_message_create_or_update.d.ts","sourceRoot":"","sources":["../../src/hooks/use_message_create_or_update.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,WAAW,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AACtE,OAAO,EAAE,uCAAuC,EAAE,MAAM,gEAAgE,CAAA;AAexH,UAAU,KAAK;IACb,cAAc,EAAE,MAAM,CAAA;IACtB,OAAO,CAAC,EAAE,eAAe,CAAA;IACzB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC5B;AAED,wBAAgB,wBAAwB,CAAC,EAAE,cAAc,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,KAAK;
|
|
1
|
+
{"version":3,"file":"use_message_create_or_update.d.ts","sourceRoot":"","sources":["../../src/hooks/use_message_create_or_update.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,WAAW,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AACtE,OAAO,EAAE,uCAAuC,EAAE,MAAM,gEAAgE,CAAA;AAexH,UAAU,KAAK;IACb,cAAc,EAAE,MAAM,CAAA;IACtB,OAAO,CAAC,EAAE,eAAe,CAAA;IACzB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC5B;AAED,UAAU,wBAAwB;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,uCAAuC,EAAE,CAAA;IACvD,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,KAAK,gCAAgC,GAAG,wBAAwB,GAAG;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,CAAA;AAE5F,wBAAgB,wBAAwB,CAAC,EAAE,cAAc,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,KAAK;wBAiIzE,wBAAwB,YACzB,UAAU;;OAAwB,CAAC,CAAC,CAAC;6BAIpC,wBAAwB,YACzB,UAAU;;OAA6B,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;wBANzC,wBAAwB,YACzB,UAAU;;OAAwB,CAAC,CAAC,CAAC;6BAIpC,wBAAwB,YACzB,UAAU;;OAA6B,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;wBANzC,wBAAwB,YACzB,UAAU;;OAAwB,CAAC,CAAC,CAAC;6BAIpC,wBAAwB,YACzB,UAAU;;OAA6B,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;wBANzC,wBAAwB,YACzB,UAAU;;OAAwB,CAAC,CAAC,CAAC;6BAIpC,wBAAwB,YACzB,UAAU;;OAA6B,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;EAIvD"}
|
|
@@ -10,7 +10,7 @@ import { getMessagesQueryKey, getMessagesRequestArgs } from '../utils/request/ge
|
|
|
10
10
|
import { useApiClient } from './use_api_client';
|
|
11
11
|
import { useCurrentPerson } from './use_current_person';
|
|
12
12
|
export function useMessageCreateOrUpdate(t0) {
|
|
13
|
-
const $ = _c(
|
|
13
|
+
const $ = _c(33);
|
|
14
14
|
const {
|
|
15
15
|
conversationId,
|
|
16
16
|
message,
|
|
@@ -33,7 +33,8 @@ export function useMessageCreateOrUpdate(t0) {
|
|
|
33
33
|
t2 = t3 => {
|
|
34
34
|
const {
|
|
35
35
|
text,
|
|
36
|
-
attachments
|
|
36
|
+
attachments,
|
|
37
|
+
idempotentKey
|
|
37
38
|
} = t3;
|
|
38
39
|
const requestParams = getMessagesRequestArgs({
|
|
39
40
|
conversation_id: conversationId
|
|
@@ -51,7 +52,6 @@ export function useMessageCreateOrUpdate(t0) {
|
|
|
51
52
|
} : {})
|
|
52
53
|
};
|
|
53
54
|
if (!isEditing) {
|
|
54
|
-
const idempotentKey = insecureUUID();
|
|
55
55
|
attributes.idempotent_key = idempotentKey;
|
|
56
56
|
startMessageCreationTracking(idempotentKey);
|
|
57
57
|
}
|
|
@@ -89,7 +89,8 @@ export function useMessageCreateOrUpdate(t0) {
|
|
|
89
89
|
t3 = async t4 => {
|
|
90
90
|
const {
|
|
91
91
|
text: text_0,
|
|
92
|
-
attachments: attachments_0
|
|
92
|
+
attachments: attachments_0,
|
|
93
|
+
idempotentKey: idempotentKey_0
|
|
93
94
|
} = t4;
|
|
94
95
|
if (message && isEditing) {
|
|
95
96
|
const optimisticMessage = optimisticallyUpdateMessage({
|
|
@@ -108,7 +109,8 @@ export function useMessageCreateOrUpdate(t0) {
|
|
|
108
109
|
text: text_0,
|
|
109
110
|
attachments: attachments_0,
|
|
110
111
|
currentPerson,
|
|
111
|
-
replyRootId
|
|
112
|
+
replyRootId,
|
|
113
|
+
idempotentKey: idempotentKey_0
|
|
112
114
|
});
|
|
113
115
|
return {
|
|
114
116
|
message: optimisticMessage_0
|
|
@@ -193,7 +195,46 @@ export function useMessageCreateOrUpdate(t0) {
|
|
|
193
195
|
t6 = $[22];
|
|
194
196
|
}
|
|
195
197
|
const mutation = useMutation(t6);
|
|
196
|
-
|
|
198
|
+
let t7;
|
|
199
|
+
if ($[23] !== message?.idempotentKey) {
|
|
200
|
+
t7 = variables_1 => ({
|
|
201
|
+
...variables_1,
|
|
202
|
+
idempotentKey: variables_1.idempotentKey ?? message?.idempotentKey ?? insecureUUID()
|
|
203
|
+
});
|
|
204
|
+
$[23] = message?.idempotentKey;
|
|
205
|
+
$[24] = t7;
|
|
206
|
+
} else {
|
|
207
|
+
t7 = $[24];
|
|
208
|
+
}
|
|
209
|
+
const resolveVariables = t7;
|
|
210
|
+
let mutate;
|
|
211
|
+
let mutateAsync;
|
|
212
|
+
if ($[25] !== mutation || $[26] !== resolveVariables) {
|
|
213
|
+
mutate = (variables_2, options) => mutation.mutate(resolveVariables(variables_2), options);
|
|
214
|
+
mutateAsync = (variables_3, options_0) => mutation.mutateAsync(resolveVariables(variables_3), options_0);
|
|
215
|
+
$[25] = mutation;
|
|
216
|
+
$[26] = resolveVariables;
|
|
217
|
+
$[27] = mutate;
|
|
218
|
+
$[28] = mutateAsync;
|
|
219
|
+
} else {
|
|
220
|
+
mutate = $[27];
|
|
221
|
+
mutateAsync = $[28];
|
|
222
|
+
}
|
|
223
|
+
let t8;
|
|
224
|
+
if ($[29] !== mutate || $[30] !== mutateAsync || $[31] !== mutation) {
|
|
225
|
+
t8 = {
|
|
226
|
+
...mutation,
|
|
227
|
+
mutate,
|
|
228
|
+
mutateAsync
|
|
229
|
+
};
|
|
230
|
+
$[29] = mutate;
|
|
231
|
+
$[30] = mutateAsync;
|
|
232
|
+
$[31] = mutation;
|
|
233
|
+
$[32] = t8;
|
|
234
|
+
} else {
|
|
235
|
+
t8 = $[32];
|
|
236
|
+
}
|
|
237
|
+
return t8;
|
|
197
238
|
}
|
|
198
239
|
|
|
199
240
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_message_create_or_update.js","names":["useMutation","chatQueryClient","deleteRecordInPagesData","Haptic","updateOrCreateRecordInPagesData","updateRecordInPagesData","isNewMessage","mergeMessageUpdate","optimisticallyCreateMessage","optimisticallyUpdateMessage","startMessageCreationTracking","getMessagesQueryKey","getMessagesRequestArgs","useApiClient","useCurrentPerson","useMessageCreateOrUpdate","t0","$","_c","conversationId","message","replyRootId","messageId","id","t1","isEditing","apiClient","currentPerson","t2","t3","text","attachments","requestParams","conversation_id","fieldsWithValueJoined","Object","fromEntries","entries","data","fields","map","_temp","attributes","reply_root","idempotentKey","insecureUUID","idempotent_key","type","chat","patch","url","post","t4","text_0","attachments_0","optimisticMessage","optimisticMessage_0","t5","error","variables","context","optimisticMessage_1","notificationError","queryKey","reply_root_id","setQueryData","data_0","record","processRecord","_next","prev","pending","result","variables_0","context_0","optimisticMessage_2","updatedMessage","queryKey_0","data_1","data_2","_temp2","t6","mutationFn","onMutate","onError","onSuccess","mutation","current","k","v","join","replace","Math","floor","random","toString"],"sources":["../../src/hooks/use_message_create_or_update.ts"],"sourcesContent":["import { InfiniteData, useMutation } from '@tanstack/react-query'\nimport { chatQueryClient } from '../contexts/api_provider'\nimport { ApiCollection, ApiResource, MessageResource } from '../types'\nimport { DenormalizedAttachmentResourceForCreate } from '../types/resources/denormalized_attachment_resource_for_create'\nimport {\n deleteRecordInPagesData,\n Haptic,\n updateOrCreateRecordInPagesData,\n updateRecordInPagesData,\n} from '../utils'\nimport { isNewMessage, mergeMessageUpdate } from '../utils/cache/messages_cache'\nimport { optimisticallyCreateMessage } from '../utils/cache/optimistically_create_message'\nimport { optimisticallyUpdateMessage } from '../utils/cache/optimistically_update_message'\nimport { startMessageCreationTracking } from '../utils/performance_tracking'\nimport { getMessagesQueryKey, getMessagesRequestArgs } from '../utils/request/get_messages'\nimport { useApiClient } from './use_api_client'\nimport { useCurrentPerson } from './use_current_person'\n\ninterface Props {\n conversationId: number\n message?: MessageResource\n replyRootId?: string | null\n}\n\nexport function useMessageCreateOrUpdate({ conversationId, message, replyRootId }: Props) {\n const messageId = message?.id || null\n const isEditing = !isNewMessage(message)\n const apiClient = useApiClient()\n const currentPerson = useCurrentPerson()\n\n const mutation = useMutation({\n mutationFn: ({\n text,\n attachments,\n }: {\n text: string\n attachments?: DenormalizedAttachmentResourceForCreate[]\n }) => {\n const requestParams = getMessagesRequestArgs({ conversation_id: conversationId })\n const fieldsWithValueJoined = Object.fromEntries(\n Object.entries(requestParams.data.fields).map(([k, v]) => [k, v.join(',')])\n )\n let attributes: any = {\n text,\n ...(attachments ? { attachments } : {}),\n ...(!isEditing && replyRootId ? { reply_root: { id: replyRootId } } : {}),\n }\n if (!isEditing) {\n const idempotentKey = insecureUUID()\n attributes.idempotent_key = idempotentKey\n startMessageCreationTracking(idempotentKey)\n }\n const data = {\n ...requestParams.data,\n data: {\n type: 'Message',\n attributes,\n },\n fields: fieldsWithValueJoined,\n }\n\n if (isEditing) {\n return apiClient.chat.patch<ApiResource<MessageResource>>({\n url: `/me/conversations/${conversationId}/messages/${messageId}`,\n data,\n })\n } else {\n return apiClient.chat.post<ApiResource<MessageResource>>({\n url: `/me/conversations/${conversationId}/messages`,\n data,\n })\n }\n },\n onMutate: async ({\n text,\n attachments,\n }: {\n text: string\n attachments?: DenormalizedAttachmentResourceForCreate[]\n }) => {\n if (message && isEditing) {\n const optimisticMessage = optimisticallyUpdateMessage({\n conversationId,\n message,\n text,\n replyRootId,\n })\n\n return { message: optimisticMessage }\n }\n\n const optimisticMessage = optimisticallyCreateMessage({\n conversationId,\n message,\n text,\n attachments,\n currentPerson,\n replyRootId,\n })\n\n return { message: optimisticMessage }\n },\n onError: (error, variables, context) => {\n const { message: optimisticMessage } = context || {}\n Haptic.notificationError()\n\n // Add error to the optimistic message from the cache on error\n if (optimisticMessage) {\n const queryKey = getMessagesQueryKey({\n conversation_id: conversationId,\n reply_root_id: replyRootId,\n })\n chatQueryClient.setQueryData(\n queryKey,\n (data: InfiniteData<ApiCollection<MessageResource>> | undefined) =>\n updateRecordInPagesData({\n data,\n record: optimisticMessage,\n processRecord: (_next, prev) => ({\n ...prev,\n error: error.message || 'Failed to send message',\n pending: false, // Mark as no longer pending\n }),\n })\n )\n }\n },\n onSuccess: (result: ApiResource<MessageResource>, variables, context) => {\n const { message: optimisticMessage } = context || {}\n const updatedMessage = result.data\n type QueryData = InfiniteData<ApiCollection<MessageResource>>\n const queryKey = getMessagesQueryKey({\n conversation_id: conversationId,\n reply_root_id: replyRootId,\n })\n\n // First remove the optimistic message if it exists\n if (optimisticMessage) {\n chatQueryClient.setQueryData<QueryData>(queryKey, data =>\n deleteRecordInPagesData({\n data,\n record: optimisticMessage,\n })\n )\n }\n\n // Then add the real message\n chatQueryClient.setQueryData<QueryData>(queryKey, data =>\n updateOrCreateRecordInPagesData({\n data,\n record: updatedMessage,\n processRecord: (record, current) => mergeMessageUpdate(record, current),\n })\n )\n },\n })\n\n return mutation\n}\n\n/**\n * Generate a random UUID (v4) for idempotent keys.\n * Uses Math.random, which is not cryptographically secure.\n * An actual crypto library requires native dependencies.\n * This is OK for now since idempotent keys are not security-sensitive\n * or need to be guaranteed unique.\n * They are short lived and we use it in combination with the message's creator_id so\n * their impact is scoped only the current user.\n */\nfunction insecureUUID(): string {\n return 'xxxxxxxx-xxxx-4xxx-Nxxx-xxxxxxxxxxxx'\n .replace(/x/g, () => Math.floor(Math.random() * 16).toString(16))\n .replace(/N/g, () => (Math.floor(Math.random() * 4) + 8).toString(16))\n}\n"],"mappings":";AAAA,SAAuBA,WAAW,QAAQ,uBAAuB;AACjE,SAASC,eAAe,QAAQ,0BAA0B;AAG1D,SACEC,uBAAuB,EACvBC,MAAM,EACNC,+BAA+B,EAC/BC,uBAAuB,QAClB,UAAU;AACjB,SAASC,YAAY,EAAEC,kBAAkB,QAAQ,+BAA+B;AAChF,SAASC,2BAA2B,QAAQ,8CAA8C;AAC1F,SAASC,2BAA2B,QAAQ,8CAA8C;AAC1F,SAASC,4BAA4B,QAAQ,+BAA+B;AAC5E,SAASC,mBAAmB,EAAEC,sBAAsB,QAAQ,+BAA+B;AAC3F,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SAASC,gBAAgB,QAAQ,sBAAsB;AAQvD,OAAO,SAAAC,yBAAAC,EAAA;EAAA,MAAAC,CAAA,GAAAC,EAAA;EAAkC;IAAAC,cAAA;IAAAC,OAAA;IAAAC;EAAA,IAAAL,EAA+C;EACtF,MAAAM,SAAA,GAAkBF,OAAO,EAAAG,EAAY,IAAnB,IAAmB;EAAA,IAAAC,EAAA;EAAA,IAAAP,CAAA,QAAAG,OAAA;IAClBI,EAAA,GAAAlB,YAAY,CAACc,OAAO,CAAC;IAAAH,CAAA,MAAAG,OAAA;IAAAH,CAAA,MAAAO,EAAA;EAAA;IAAAA,EAAA,GAAAP,C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AM;EAAA,OAAK,CAACwE,CAAC,EAAEC,CAAC,CAAAC,IAAK,CAAC,GAAG,CAAC,CAAC;AAAA;AAiIlF,SAAS7C,YAAYA,CAAA,EAAW;EAC9B,OAAO,sCAAsC,CAC1C8C,OAAO,CAAC,IAAI,EAAE,MAAMC,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,CAACC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAChEJ,OAAO,CAAC,IAAI,EAAE,MAAM,CAACC,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAEC,QAAQ,CAAC,EAAE,CAAC,CAAC;AAC1E","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"use_message_create_or_update.js","names":["useMutation","chatQueryClient","deleteRecordInPagesData","Haptic","updateOrCreateRecordInPagesData","updateRecordInPagesData","isNewMessage","mergeMessageUpdate","optimisticallyCreateMessage","optimisticallyUpdateMessage","startMessageCreationTracking","getMessagesQueryKey","getMessagesRequestArgs","useApiClient","useCurrentPerson","useMessageCreateOrUpdate","t0","$","_c","conversationId","message","replyRootId","messageId","id","t1","isEditing","apiClient","currentPerson","t2","t3","text","attachments","idempotentKey","requestParams","conversation_id","fieldsWithValueJoined","Object","fromEntries","entries","data","fields","map","_temp","attributes","reply_root","idempotent_key","type","chat","patch","url","post","t4","text_0","attachments_0","idempotentKey_0","optimisticMessage","optimisticMessage_0","t5","error","variables","context","optimisticMessage_1","notificationError","queryKey","reply_root_id","setQueryData","data_0","record","processRecord","_next","prev","pending","result","variables_0","context_0","optimisticMessage_2","updatedMessage","queryKey_0","data_1","data_2","_temp2","t6","mutationFn","onMutate","onError","onSuccess","mutation","t7","variables_1","insecureUUID","resolveVariables","mutate","mutateAsync","variables_2","options","variables_3","options_0","t8","current","k","v","join","replace","Math","floor","random","toString"],"sources":["../../src/hooks/use_message_create_or_update.ts"],"sourcesContent":["import { InfiniteData, useMutation } from '@tanstack/react-query'\nimport { chatQueryClient } from '../contexts/api_provider'\nimport { ApiCollection, ApiResource, MessageResource } from '../types'\nimport { DenormalizedAttachmentResourceForCreate } from '../types/resources/denormalized_attachment_resource_for_create'\nimport {\n deleteRecordInPagesData,\n Haptic,\n updateOrCreateRecordInPagesData,\n updateRecordInPagesData,\n} from '../utils'\nimport { isNewMessage, mergeMessageUpdate } from '../utils/cache/messages_cache'\nimport { optimisticallyCreateMessage } from '../utils/cache/optimistically_create_message'\nimport { optimisticallyUpdateMessage } from '../utils/cache/optimistically_update_message'\nimport { startMessageCreationTracking } from '../utils/performance_tracking'\nimport { getMessagesQueryKey, getMessagesRequestArgs } from '../utils/request/get_messages'\nimport { useApiClient } from './use_api_client'\nimport { useCurrentPerson } from './use_current_person'\n\ninterface Props {\n conversationId: number\n message?: MessageResource\n replyRootId?: string | null\n}\n\ninterface MessageMutationVariables {\n text: string\n attachments?: DenormalizedAttachmentResourceForCreate[]\n idempotentKey?: string\n}\n\ntype ResolvedMessageMutationVariables = MessageMutationVariables & { idempotentKey: string }\n\nexport function useMessageCreateOrUpdate({ conversationId, message, replyRootId }: Props) {\n const messageId = message?.id || null\n const isEditing = !isNewMessage(message)\n const apiClient = useApiClient()\n const currentPerson = useCurrentPerson()\n\n const mutation = useMutation({\n mutationFn: ({ text, attachments, idempotentKey }: ResolvedMessageMutationVariables) => {\n const requestParams = getMessagesRequestArgs({ conversation_id: conversationId })\n const fieldsWithValueJoined = Object.fromEntries(\n Object.entries(requestParams.data.fields).map(([k, v]) => [k, v.join(',')])\n )\n let attributes: any = {\n text,\n ...(attachments ? { attachments } : {}),\n ...(!isEditing && replyRootId ? { reply_root: { id: replyRootId } } : {}),\n }\n if (!isEditing) {\n attributes.idempotent_key = idempotentKey\n startMessageCreationTracking(idempotentKey)\n }\n const data = {\n ...requestParams.data,\n data: {\n type: 'Message',\n attributes,\n },\n fields: fieldsWithValueJoined,\n }\n\n if (isEditing) {\n return apiClient.chat.patch<ApiResource<MessageResource>>({\n url: `/me/conversations/${conversationId}/messages/${messageId}`,\n data,\n })\n } else {\n return apiClient.chat.post<ApiResource<MessageResource>>({\n url: `/me/conversations/${conversationId}/messages`,\n data,\n })\n }\n },\n onMutate: async ({ text, attachments, idempotentKey }: ResolvedMessageMutationVariables) => {\n if (message && isEditing) {\n const optimisticMessage = optimisticallyUpdateMessage({\n conversationId,\n message,\n text,\n replyRootId,\n })\n\n return { message: optimisticMessage }\n }\n\n const optimisticMessage = optimisticallyCreateMessage({\n conversationId,\n message,\n text,\n attachments,\n currentPerson,\n replyRootId,\n idempotentKey,\n })\n\n return { message: optimisticMessage }\n },\n onError: (error, variables, context) => {\n const { message: optimisticMessage } = context || {}\n Haptic.notificationError()\n\n // Add error to the optimistic message from the cache on error\n if (optimisticMessage) {\n const queryKey = getMessagesQueryKey({\n conversation_id: conversationId,\n reply_root_id: replyRootId,\n })\n chatQueryClient.setQueryData(\n queryKey,\n (data: InfiniteData<ApiCollection<MessageResource>> | undefined) =>\n updateRecordInPagesData({\n data,\n record: optimisticMessage,\n processRecord: (_next, prev) => ({\n ...prev,\n error: error.message || 'Failed to send message',\n pending: false, // Mark as no longer pending\n }),\n })\n )\n }\n },\n onSuccess: (result: ApiResource<MessageResource>, variables, context) => {\n const { message: optimisticMessage } = context || {}\n const updatedMessage = result.data\n type QueryData = InfiniteData<ApiCollection<MessageResource>>\n const queryKey = getMessagesQueryKey({\n conversation_id: conversationId,\n reply_root_id: replyRootId,\n })\n\n // First remove the optimistic message if it exists\n if (optimisticMessage) {\n chatQueryClient.setQueryData<QueryData>(queryKey, data =>\n deleteRecordInPagesData({\n data,\n record: optimisticMessage,\n })\n )\n }\n\n // Then add the real message\n chatQueryClient.setQueryData<QueryData>(queryKey, data =>\n updateOrCreateRecordInPagesData({\n data,\n record: updatedMessage,\n processRecord: (record, current) => mergeMessageUpdate(record, current),\n })\n )\n },\n })\n\n const resolveVariables = (\n variables: MessageMutationVariables\n ): ResolvedMessageMutationVariables => ({\n ...variables,\n idempotentKey: variables.idempotentKey ?? message?.idempotentKey ?? insecureUUID(),\n })\n\n const mutate = (\n variables: MessageMutationVariables,\n options?: Parameters<typeof mutation.mutate>[1]\n ) => mutation.mutate(resolveVariables(variables), options)\n\n const mutateAsync = (\n variables: MessageMutationVariables,\n options?: Parameters<typeof mutation.mutateAsync>[1]\n ) => mutation.mutateAsync(resolveVariables(variables), options)\n\n return { ...mutation, mutate, mutateAsync }\n}\n\n/**\n * Generate a random UUID (v4) for idempotent keys.\n * Uses Math.random, which is not cryptographically secure.\n * An actual crypto library requires native dependencies.\n * This is OK for now since idempotent keys are not security-sensitive\n * or need to be guaranteed unique.\n * They are short lived and we use it in combination with the message's creator_id so\n * their impact is scoped only the current user.\n */\nfunction insecureUUID(): string {\n return 'xxxxxxxx-xxxx-4xxx-Nxxx-xxxxxxxxxxxx'\n .replace(/x/g, () => Math.floor(Math.random() * 16).toString(16))\n .replace(/N/g, () => (Math.floor(Math.random() * 4) + 8).toString(16))\n}\n"],"mappings":";AAAA,SAAuBA,WAAW,QAAQ,uBAAuB;AACjE,SAASC,eAAe,QAAQ,0BAA0B;AAG1D,SACEC,uBAAuB,EACvBC,MAAM,EACNC,+BAA+B,EAC/BC,uBAAuB,QAClB,UAAU;AACjB,SAASC,YAAY,EAAEC,kBAAkB,QAAQ,+BAA+B;AAChF,SAASC,2BAA2B,QAAQ,8CAA8C;AAC1F,SAASC,2BAA2B,QAAQ,8CAA8C;AAC1F,SAASC,4BAA4B,QAAQ,+BAA+B;AAC5E,SAASC,mBAAmB,EAAEC,sBAAsB,QAAQ,+BAA+B;AAC3F,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SAASC,gBAAgB,QAAQ,sBAAsB;AAgBvD,OAAO,SAAAC,yBAAAC,EAAA;EAAA,MAAAC,CAAA,GAAAC,EAAA;EAAkC;IAAAC,cAAA;IAAAC,OAAA;IAAAC;EAAA,IAAAL,EAA+C;EACtF,MAAAM,SAAA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CAAA;EAAA;EAAA,OAApCgF,EAAoC;AAAA;;AAG7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArJO,SAAAjB,OAAAb,MAAA,EAAA+B,OAAA;EAAA,OAmHuC3F,kBAAkB,CAAC4D,MAAM,EAAE+B,OAAO,CAAC;AAAA;AAnH1E,SAAAxD,MAAA1B,EAAA;EAUgD,OAAAmF,CAAA,EAAAC,CAAA,IAAApF,EAAM;EAAA,OAAK,CAACmF,CAAC,EAAEC,CAAC,CAAAC,IAAK,CAAC,GAAG,CAAC,CAAC;AAAA;AA4IlF,SAASZ,YAAYA,CAAA,EAAW;EAC9B,OAAO,sCAAsC,CAC1Ca,OAAO,CAAC,IAAI,EAAE,MAAMC,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,CAACC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAChEJ,OAAO,CAAC,IAAI,EAAE,MAAM,CAACC,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAEC,QAAQ,CAAC,EAAE,CAAC,CAAC;AAC1E","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation_screen.d.ts","sourceRoot":"","sources":["../../src/screens/conversation_screen.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"conversation_screen.d.ts","sourceRoot":"","sources":["../../src/screens/conversation_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,gBAAgB,EAAqB,MAAM,4BAA4B,CAAA;AAC7F,OAAO,EAGL,iBAAiB,EAIlB,MAAM,0BAA0B,CAAA;AAiCjC,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAA;AAGjF,MAAM,MAAM,sBAAsB,GAAG;IACnC,eAAe,EAAE,MAAM,CAAA;IACvB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,sBAAsB,CAAC,EAAE,MAAM,CAAA;IAC/B,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAClC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,yBAAyB,CAAA;IACjC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG,iBAAiB,CAAC,sBAAsB,CAAC,CAAA;AAE/E,wBAAgB,kBAAkB,CAAC,EAAE,KAAK,EAAE,EAAE,uBAAuB,2CAkBpE;AA2KD,UAAU,4BAA6B,SAAQ,gBAAgB;IAC7D,eAAe,EAAE,MAAM,CAAA;IACvB,KAAK,CAAC,EAAE,yBAAyB,CAAA;IACjC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED,eAAO,MAAM,uBAAuB,GAAI,8DAOrC,4BAA4B,4CAqC9B,CAAA"}
|