@planningcenter/chat-react-native 3.36.0-rc.0 → 3.36.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/hooks/use_conversation_jolt_events.d.ts.map +1 -1
- package/build/hooks/use_conversation_jolt_events.js +6 -1
- package/build/hooks/use_conversation_jolt_events.js.map +1 -1
- package/build/types/jolt_events/conversation_events.d.ts +1 -0
- package/build/types/jolt_events/conversation_events.d.ts.map +1 -1
- package/build/types/jolt_events/conversation_events.js.map +1 -1
- package/package.json +2 -2
- package/src/hooks/use_conversation_jolt_events.ts +7 -1
- package/src/types/jolt_events/conversation_events.ts +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_conversation_jolt_events.d.ts","sourceRoot":"","sources":["../../src/hooks/use_conversation_jolt_events.ts"],"names":[],"mappings":"AAWA,UAAU,KAAK;IACb,cAAc,EAAE,MAAM,CAAA;CACvB;AAED,wBAAgB,yBAAyB,CAAC,EAAE,cAAc,EAAE,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"use_conversation_jolt_events.d.ts","sourceRoot":"","sources":["../../src/hooks/use_conversation_jolt_events.ts"],"names":[],"mappings":"AAWA,UAAU,KAAK;IACb,cAAc,EAAE,MAAM,CAAA;CACvB;AAED,wBAAgB,yBAAyB,CAAC,EAAE,cAAc,EAAE,EAAE,KAAK,QAoGlE"}
|
|
@@ -14,13 +14,18 @@ export function useConversationJoltEvents({ conversationId }) {
|
|
|
14
14
|
const apiClient = useApiClient();
|
|
15
15
|
const queryKey = useMemo(() => getRequestQueryKey(getConversationRequestArgs({ conversation_id: conversationId })), [conversationId]);
|
|
16
16
|
const handleUpdatedConversation = useCallback((e) => {
|
|
17
|
-
const { last_message_idempotent_key, last_message_author_id } = e.data.data;
|
|
17
|
+
const { last_message_idempotent_key, last_message_author_id, disabled } = e.data.data;
|
|
18
18
|
if (last_message_idempotent_key && last_message_author_id === currentPersonId) {
|
|
19
19
|
completeMessageCreationConversationTracking({
|
|
20
20
|
apiClient,
|
|
21
21
|
idempotentKey: last_message_idempotent_key,
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
+
queryClient.setQueryData(queryKey, prev => {
|
|
25
|
+
if (!prev?.data)
|
|
26
|
+
return prev;
|
|
27
|
+
return { ...prev, data: { ...prev.data, disabled } };
|
|
28
|
+
});
|
|
24
29
|
queryClient.invalidateQueries({ queryKey });
|
|
25
30
|
}, [queryClient, queryKey, currentPersonId, apiClient]);
|
|
26
31
|
const handleConversationRead = useCallback((e) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_conversation_jolt_events.js","sourceRoot":"","sources":["../../src/hooks/use_conversation_jolt_events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAG5C,OAAO,EAAE,2CAA2C,EAAE,MAAM,+BAA+B,CAAA;AAC3F,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAA;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAMvD,MAAM,UAAU,yBAAyB,CAAC,EAAE,cAAc,EAAS;IACjE,MAAM,WAAW,GAAG,cAAc,CAAC,sBAAsB,cAAc,EAAE,CAAC,CAAA;IAC1E,MAAM,WAAW,GAAG,cAAc,EAAE,CAAA;IACpC,MAAM,aAAa,GAAG,gBAAgB,EAAE,CAAA;IACxC,MAAM,eAAe,GAAG,aAAa,EAAE,EAAE,CAAA;IACzC,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;IAChC,MAAM,QAAQ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WAAW,EAAE,QAAQ,EAAE,eAAe,CAAC,CACzC,CAAA;IAED,YAAY,CAAC,WAAW,EAAE,sBAAsB,EAAE,yBAAyB,CAAC,CAAA;IAC5E,YAAY,CAAC,WAAW,EAAE,mBAAmB,EAAE,sBAAsB,CAAC,CAAA;IACtE,YAAY,CAAC,WAAW,EAAE,wBAAwB,EAAE,2BAA2B,CAAC,CAAA;IAChF,YAAY,CAAC,WAAW,EAAE,YAAY,EAAE,uBAAuB,CAAC,CAAA;AAClE,CAAC","sourcesContent":["import { useQueryClient } from '@tanstack/react-query'\nimport { useCallback, useMemo } from 'react'\nimport { ApiResource, ConversationResource } from '../types'\nimport { JoltConversationEvent, JoltReactionEvent } from '../types/jolt_events'\nimport { completeMessageCreationConversationTracking } from '../utils/performance_tracking'\nimport { useApiClient } from './use_api_client'\nimport { getConversationRequestArgs } from './use_conversation'\nimport { useCurrentPerson } from './use_current_person'\nimport { useJoltChannel, useJoltEvent } from './use_jolt'\nimport { getRequestQueryKey } from './use_suspense_api'\n\ninterface Props {\n conversationId: number\n}\n\nexport function useConversationJoltEvents({ conversationId }: Props) {\n const joltChannel = useJoltChannel(`chat.conversations.${conversationId}`)\n const queryClient = useQueryClient()\n const currentPerson = useCurrentPerson()\n const currentPersonId = currentPerson?.id\n const apiClient = useApiClient()\n const queryKey = useMemo(\n () => getRequestQueryKey(getConversationRequestArgs({ conversation_id: conversationId })),\n [conversationId]\n )\n\n const handleUpdatedConversation = useCallback(\n (e: JoltConversationEvent) => {\n const { last_message_idempotent_key, last_message_author_id, disabled } = e.data.data\n\n if (last_message_idempotent_key && last_message_author_id === currentPersonId) {\n completeMessageCreationConversationTracking({\n apiClient,\n idempotentKey: last_message_idempotent_key,\n })\n }\n\n queryClient.setQueryData<ApiResource<ConversationResource>>(queryKey, prev => {\n if (!prev?.data) return prev\n return { ...prev, data: { ...prev.data, disabled } }\n })\n\n queryClient.invalidateQueries({ queryKey })\n },\n [queryClient, queryKey, currentPersonId, apiClient]\n )\n\n const handleConversationRead = useCallback(\n (e: JoltConversationEvent) => {\n const { latest_read_message_sort_key } = e.data.data\n queryClient.setQueryData<ApiResource<ConversationResource>>(queryKey, prev => {\n if (!prev?.data || !latest_read_message_sort_key) return prev\n if (\n prev.data.latestReadMessageSortKey &&\n prev.data.latestReadMessageSortKey >= latest_read_message_sort_key\n ) {\n return prev\n }\n\n return {\n ...prev,\n data: {\n ...prev.data,\n latestReadMessageSortKey: latest_read_message_sort_key,\n unreadReactionCount: 0,\n },\n }\n })\n },\n [queryClient, queryKey]\n )\n\n const handleConversationDestroyed = useCallback(() => {\n queryClient.setQueryData<ApiResource<ConversationResource>>(queryKey, prev => {\n if (!prev?.data) return prev\n\n return {\n ...prev,\n data: {\n ...prev.data,\n deleted: true,\n },\n }\n })\n }, [queryClient, queryKey])\n\n const handleReactionJoltEvent = useCallback(\n (event: JoltReactionEvent) => {\n queryClient.setQueryData<ApiResource<ConversationResource>>(queryKey, prev => {\n if (!prev?.data) return prev\n\n if (event.data.data.author_id === currentPersonId) {\n return prev\n }\n\n return {\n ...prev,\n data: {\n ...prev.data,\n // Not a real count, just a derived value from Jolt events so we can\n // determine if we should mark the conversation as read\n unreadReactionCount: prev.data.unreadReactionCount\n ? prev.data.unreadReactionCount + 1\n : 1,\n },\n }\n })\n },\n [queryClient, queryKey, currentPersonId]\n )\n\n useJoltEvent(joltChannel, 'conversation.updated', handleUpdatedConversation)\n useJoltEvent(joltChannel, 'conversation.read', handleConversationRead)\n useJoltEvent(joltChannel, 'conversation.destroyed', handleConversationDestroyed)\n useJoltEvent(joltChannel, 'reaction.*', handleReactionJoltEvent)\n}\n"]}
|
|
@@ -13,6 +13,7 @@ interface BaseConversationEventData extends Record<string, unknown> {
|
|
|
13
13
|
last_message_text_preview?: string;
|
|
14
14
|
latest_read_message_sort_key?: string;
|
|
15
15
|
organization_id: number;
|
|
16
|
+
disabled: boolean;
|
|
16
17
|
replies_disabled: boolean;
|
|
17
18
|
subtitle?: string;
|
|
18
19
|
title: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation_events.d.ts","sourceRoot":"","sources":["../../../src/types/jolt_events/conversation_events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uDAAuD,CAAA;AAE1F,KAAK,UAAU,GAAG,MAAM,CAAA;AACxB,UAAU,yBAA0B,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACjE,IAAI,EAAE;QACJ,EAAE,EAAE,MAAM,CAAA;QACV,WAAW,EAAE,UAAU,CAAA;QACvB,UAAU,EAAE,UAAU,CAAA;QACtB,sBAAsB,CAAC,EAAE,MAAM,CAAA;QAC/B,wBAAwB,CAAC,EAAE,MAAM,CAAA;QACjC,uBAAuB,CAAC,EAAE,UAAU,CAAA;QACpC,qBAAqB,CAAC,EAAE,MAAM,CAAA;QAC9B,2BAA2B,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;QAC3C,yBAAyB,CAAC,EAAE,MAAM,CAAA;QAClC,4BAA4B,CAAC,EAAE,MAAM,CAAA;QACrC,eAAe,EAAE,MAAM,CAAA;QACvB,gBAAgB,EAAE,OAAO,CAAA;QACzB,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,KAAK,EAAE,MAAM,CAAA;QACb,UAAU,EAAE,UAAU,CAAA;KACvB,CAAA;CACF;AAED,MAAM,WAAW,wBAAyB,SAAQ,aAAa;IAC7D,KAAK,EAAE,sBAAsB,CAAA;IAC7B,IAAI,EAAE,yBAAyB,CAAA;CAChC;AAED,MAAM,WAAW,wBAAyB,SAAQ,aAAa;IAC7D,KAAK,EAAE,sBAAsB,CAAA;IAC7B,IAAI,EAAE,yBAAyB,CAAA;CAChC;AAED,MAAM,WAAW,wBAAyB,SAAQ,aAAa;IAC7D,KAAK,EAAE,wBAAwB,CAAA;IAC/B,IAAI,EAAE,yBAAyB,CAAA;CAChC;AAED,MAAM,WAAW,qBAAsB,SAAQ,aAAa;IAC1D,K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,yBAAyB,CAAA;CAChC;AAED,MAAM,WAAW,qBAAsB,SAAQ,aAAa;IAC1D,KAAK,EAAE,mBAAmB,CAAA;IAC1B,IAAI,EAAE,yBAAyB,CAAA;CAChC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation_events.js","sourceRoot":"","sources":["../../../src/types/jolt_events/conversation_events.ts"],"names":[],"mappings":"","sourcesContent":["import type { CustomMessage } from '@planningcenter/jolt-client/dist/types/JoltConnection'\n\ntype DateString = string\ninterface BaseConversationEventData extends Record<string, unknown> {\n data: {\n id: number\n archived_at: DateString\n created_at: DateString\n last_message_author_id?: number\n last_message_author_name?: string\n last_message_created_at?: DateString\n last_message_sort_key?: string\n last_message_idempotent_key?: string | null\n last_message_text_preview?: string\n latest_read_message_sort_key?: string\n organization_id: number\n replies_disabled: boolean\n subtitle?: string\n title: string\n updated_at: DateString\n }\n}\n\nexport interface ConversationCreatedEvent extends CustomMessage {\n event: 'conversation.created'\n data: BaseConversationEventData\n}\n\nexport interface ConversationUpdatedEvent extends CustomMessage {\n event: 'conversation.updated'\n data: BaseConversationEventData\n}\n\nexport interface ConversationDeletedEvent extends CustomMessage {\n event: 'conversation.destroyed'\n data: BaseConversationEventData\n}\n\nexport interface ConversationReadEvent extends CustomMessage {\n event: 'conversation.read'\n data: BaseConversationEventData\n}\n"]}
|
|
1
|
+
{"version":3,"file":"conversation_events.js","sourceRoot":"","sources":["../../../src/types/jolt_events/conversation_events.ts"],"names":[],"mappings":"","sourcesContent":["import type { CustomMessage } from '@planningcenter/jolt-client/dist/types/JoltConnection'\n\ntype DateString = string\ninterface BaseConversationEventData extends Record<string, unknown> {\n data: {\n id: number\n archived_at: DateString\n created_at: DateString\n last_message_author_id?: number\n last_message_author_name?: string\n last_message_created_at?: DateString\n last_message_sort_key?: string\n last_message_idempotent_key?: string | null\n last_message_text_preview?: string\n latest_read_message_sort_key?: string\n organization_id: number\n disabled: boolean\n replies_disabled: boolean\n subtitle?: string\n title: string\n updated_at: DateString\n }\n}\n\nexport interface ConversationCreatedEvent extends CustomMessage {\n event: 'conversation.created'\n data: BaseConversationEventData\n}\n\nexport interface ConversationUpdatedEvent extends CustomMessage {\n event: 'conversation.updated'\n data: BaseConversationEventData\n}\n\nexport interface ConversationDeletedEvent extends CustomMessage {\n event: 'conversation.destroyed'\n data: BaseConversationEventData\n}\n\nexport interface ConversationReadEvent extends CustomMessage {\n event: 'conversation.read'\n data: BaseConversationEventData\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planningcenter/chat-react-native",
|
|
3
|
-
"version": "3.36.0-rc.
|
|
3
|
+
"version": "3.36.0-rc.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"react-native-url-polyfill": "^2.0.0",
|
|
72
72
|
"typescript": "~5.9.2"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "6c4ed353c50f339f4e428b76df230b4cdf4d26a3"
|
|
75
75
|
}
|
|
@@ -26,7 +26,7 @@ export function useConversationJoltEvents({ conversationId }: Props) {
|
|
|
26
26
|
|
|
27
27
|
const handleUpdatedConversation = useCallback(
|
|
28
28
|
(e: JoltConversationEvent) => {
|
|
29
|
-
const { last_message_idempotent_key, last_message_author_id } = e.data.data
|
|
29
|
+
const { last_message_idempotent_key, last_message_author_id, disabled } = e.data.data
|
|
30
30
|
|
|
31
31
|
if (last_message_idempotent_key && last_message_author_id === currentPersonId) {
|
|
32
32
|
completeMessageCreationConversationTracking({
|
|
@@ -34,6 +34,12 @@ export function useConversationJoltEvents({ conversationId }: Props) {
|
|
|
34
34
|
idempotentKey: last_message_idempotent_key,
|
|
35
35
|
})
|
|
36
36
|
}
|
|
37
|
+
|
|
38
|
+
queryClient.setQueryData<ApiResource<ConversationResource>>(queryKey, prev => {
|
|
39
|
+
if (!prev?.data) return prev
|
|
40
|
+
return { ...prev, data: { ...prev.data, disabled } }
|
|
41
|
+
})
|
|
42
|
+
|
|
37
43
|
queryClient.invalidateQueries({ queryKey })
|
|
38
44
|
},
|
|
39
45
|
[queryClient, queryKey, currentPersonId, apiClient]
|
|
@@ -14,6 +14,7 @@ interface BaseConversationEventData extends Record<string, unknown> {
|
|
|
14
14
|
last_message_text_preview?: string
|
|
15
15
|
latest_read_message_sort_key?: string
|
|
16
16
|
organization_id: number
|
|
17
|
+
disabled: boolean
|
|
17
18
|
replies_disabled: boolean
|
|
18
19
|
subtitle?: string
|
|
19
20
|
title: string
|