@planningcenter/chat-react-native 4.7.0-rc.0 → 4.7.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/conversation/message_list.d.ts.map +1 -1
- package/build/components/conversation/message_list.js +7 -0
- package/build/components/conversation/message_list.js.map +1 -1
- package/build/components/conversation/unsupported_message.d.ts +15 -0
- package/build/components/conversation/unsupported_message.d.ts.map +1 -0
- package/build/components/conversation/unsupported_message.js +415 -0
- package/build/components/conversation/unsupported_message.js.map +1 -0
- package/build/types/jolt_events/message_events.d.ts +3 -0
- package/build/types/jolt_events/message_events.d.ts.map +1 -1
- package/build/types/jolt_events/message_events.js.map +1 -1
- package/build/types/resources/fallback_content.d.ts +20 -0
- package/build/types/resources/fallback_content.d.ts.map +1 -0
- package/build/types/resources/fallback_content.js +2 -0
- package/build/types/resources/fallback_content.js.map +1 -0
- package/build/types/resources/message.d.ts +3 -0
- package/build/types/resources/message.d.ts.map +1 -1
- package/build/types/resources/message.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 +2 -0
- package/build/utils/jolt/transform_message_event_data_to_message_resource.js.map +1 -1
- package/build/utils/message_types.d.ts +5 -0
- package/build/utils/message_types.d.ts.map +1 -0
- package/build/utils/message_types.js +10 -0
- package/build/utils/message_types.js.map +1 -0
- package/build/utils/request/messages_data_options.d.ts.map +1 -1
- package/build/utils/request/messages_data_options.js +1 -1
- package/build/utils/request/messages_data_options.js.map +1 -1
- package/package.json +2 -2
- package/src/components/conversation/__tests__/message_list.test.tsx +1 -1
- package/src/components/conversation/__tests__/unsupported_message.test.tsx +109 -0
- package/src/components/conversation/message_list.tsx +6 -0
- package/src/components/conversation/unsupported_message.tsx +202 -0
- package/src/types/jolt_events/message_events.ts +3 -0
- package/src/types/resources/fallback_content.ts +20 -0
- package/src/types/resources/message.ts +5 -0
- package/src/utils/__tests__/message_types.test.ts +22 -0
- package/src/utils/jolt/__tests__/transform_message_event_data_to_message_resource.test.ts +10 -0
- package/src/utils/jolt/transform_message_event_data_to_message_resource.ts +2 -0
- package/src/utils/message_types.ts +22 -0
- package/src/utils/request/messages_data_options.ts +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message_events.d.ts","sourceRoot":"","sources":["../../../src/types/jolt_events/message_events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uDAAuD,CAAA;AAC1F,OAAO,EAAE,8BAA8B,EAAE,MAAM,+CAA+C,CAAA;AAC9F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAE5D,UAAU,oBAAqB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC5D,IAAI,EAAE;QACJ,aAAa,EAAE,MAAM,CAAA;QACrB,SAAS,EAAE,MAAM,CAAA;QACjB,WAAW,EAAE,MAAM,CAAA;QACnB,eAAe,EAAE,MAAM,CAAA;QACvB,UAAU,EAAE,MAAM,CAAA;QAClB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;QACzB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;QAC9B,QAAQ,EAAE,MAAM,CAAA;QAChB,IAAI,EAAE,MAAM,CAAA;QACZ,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;QAC7B,IAAI,EAAE,MAAM,CAAA;QACZ,WAAW,EAAE,8BAA8B,EAAE,CAAA;QAC7C,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;QAC9B,WAAW,EAAE,MAAM,CAAA;QACnB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;QAC5B,YAAY,EAAE,MAAM,CAAA;QACpB,uBAAuB,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;QACxC,iBAAiB,EAAE;YAAE,KAAK,EAAE,MAAM,EAAE,CAAC;YAAC,cAAc,EAAE,MAAM,CAA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,WAAW,EAAE,8BAA8B,EAAE,CAAA;QAC7C,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;QAC9B,WAAW,EAAE,MAAM,CAAA;QACnB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;QAC5B,YAAY,EAAE,MAAM,CAAA;QACpB,wBAAwB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;QACxC,gBAAgB,CAAC,EAAE,eAAe,GAAG,IAAI,CAAA;QACzC,uBAAuB,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;QACxC,iBAAiB,EAAE;YAAE,KAAK,EAAE,MAAM,EAAE,CAAC;YAAC,cAAc,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,GAAG,IAAI,CAAA;QACrF,kBAAkB,EAAE,gBAAgB,GAAG,IAAI,CAAA;KAC5C,CAAA;CACF;AAED,MAAM,WAAW,mBAAoB,SAAQ,aAAa;IACxD,KAAK,EAAE,iBAAiB,CAAA;IACxB,IAAI,EAAE,oBAAoB,CAAA;CAC3B;AAED,MAAM,WAAW,mBAAoB,SAAQ,aAAa;IACxD,KAAK,EAAE,iBAAiB,CAAA;IACxB,IAAI,EAAE,oBAAoB,CAAA;CAC3B;AAED,MAAM,WAAW,mBAAoB,SAAQ,aAAa;IACxD,KAAK,EAAE,mBAAmB,CAAA;IAC1B,IAAI,EAAE,oBAAoB,CAAA;CAC3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message_events.js","names":[],"sources":["../../../src/types/jolt_events/message_events.ts"],"sourcesContent":["import type { CustomMessage } from '@planningcenter/jolt-client/dist/types/JoltConnection'\nimport { DenormalizedAttachmentResource } from '../resources/denormalized_attachment_resource'\nimport type { SystemTextFormat } from '../resources/message'\n\ninterface BaseMessageEventData extends Record<string, unknown> {\n data: {\n author_avatar: string\n author_id: number\n author_name: string\n conversation_id: number\n created_at: string\n deleted_at: string | null\n organization_id: number | null\n sort_key: string\n text: string\n text_edited_at: string | null\n html: string\n attachments: DenormalizedAttachmentResource[]\n idempotent_key?: string | null\n reply_count: number\n reply_root_id: string | null\n message_type: string\n system_event_person_ids: number[] | null\n system_text_parts: { names: string[]; overflow_count: number; action: string } | null\n system_text_format: SystemTextFormat | null\n }\n}\n\nexport interface MessageCreatedEvent extends CustomMessage {\n event: 'message.created'\n data: BaseMessageEventData\n}\n\nexport interface MessageUpdatedEvent extends CustomMessage {\n event: 'message.updated'\n data: BaseMessageEventData\n}\n\nexport interface MessageDeletedEvent extends CustomMessage {\n event: 'message.destroyed'\n data: BaseMessageEventData\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"message_events.js","names":[],"sources":["../../../src/types/jolt_events/message_events.ts"],"sourcesContent":["import type { CustomMessage } from '@planningcenter/jolt-client/dist/types/JoltConnection'\nimport { DenormalizedAttachmentResource } from '../resources/denormalized_attachment_resource'\nimport type { FallbackContent } from '../resources/fallback_content'\nimport type { SystemTextFormat } from '../resources/message'\n\ninterface BaseMessageEventData extends Record<string, unknown> {\n data: {\n author_avatar: string\n author_id: number\n author_name: string\n conversation_id: number\n created_at: string\n deleted_at: string | null\n organization_id: number | null\n sort_key: string\n text: string\n text_edited_at: string | null\n html: string\n attachments: DenormalizedAttachmentResource[]\n idempotent_key?: string | null\n reply_count: number\n reply_root_id: string | null\n message_type: string\n unsupported_message_type?: string | null\n fallback_content?: FallbackContent | null\n system_event_person_ids: number[] | null\n system_text_parts: { names: string[]; overflow_count: number; action: string } | null\n system_text_format: SystemTextFormat | null\n }\n}\n\nexport interface MessageCreatedEvent extends CustomMessage {\n event: 'message.created'\n data: BaseMessageEventData\n}\n\nexport interface MessageUpdatedEvent extends CustomMessage {\n event: 'message.updated'\n data: BaseMessageEventData\n}\n\nexport interface MessageDeletedEvent extends CustomMessage {\n event: 'message.destroyed'\n data: BaseMessageEventData\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** FallbackContent
|
|
2
|
+
* The read-only shape the server sends for a message type this build can't render: text and
|
|
3
|
+
* numbers only, nothing actionable, and only `title` is guaranteed. It is a contract with
|
|
4
|
+
* shipped builds, so it only ever gains optional fields.
|
|
5
|
+
*/
|
|
6
|
+
export interface FallbackContentItem {
|
|
7
|
+
label: string;
|
|
8
|
+
detail?: string | null;
|
|
9
|
+
fraction?: number | null;
|
|
10
|
+
selected?: boolean | null;
|
|
11
|
+
}
|
|
12
|
+
export interface FallbackContent {
|
|
13
|
+
kind: string;
|
|
14
|
+
title: string;
|
|
15
|
+
subtitle?: string | null;
|
|
16
|
+
items?: FallbackContentItem[] | null;
|
|
17
|
+
footer?: string | null;
|
|
18
|
+
hint?: string | null;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=fallback_content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fallback_content.d.ts","sourceRoot":"","sources":["../../../src/types/resources/fallback_content.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,QAAQ,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;CAC1B;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,KAAK,CAAC,EAAE,mBAAmB,EAAE,GAAG,IAAI,CAAA;IACpC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fallback_content.js","names":[],"sources":["../../../src/types/resources/fallback_content.ts"],"sourcesContent":["/** FallbackContent\n * The read-only shape the server sends for a message type this build can't render: text and\n * numbers only, nothing actionable, and only `title` is guaranteed. It is a contract with\n * shipped builds, so it only ever gains optional fields.\n */\nexport interface FallbackContentItem {\n label: string\n detail?: string | null\n fraction?: number | null\n selected?: boolean | null\n}\n\nexport interface FallbackContent {\n kind: string\n title: string\n subtitle?: string | null\n items?: FallbackContentItem[] | null\n footer?: string | null\n hint?: string | null\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DenormalizedAttachmentResource } from './denormalized_attachment_resource';
|
|
2
2
|
import { DenormalizedAttachmentResourceForCreate } from './denormalized_attachment_resource_for_create';
|
|
3
|
+
import type { FallbackContent } from './fallback_content';
|
|
3
4
|
import type { PersonResource } from './person';
|
|
4
5
|
import type { ReactionCountResource } from './reaction';
|
|
5
6
|
export type SystemTextFormat = 'people' | 'actor';
|
|
@@ -20,6 +21,8 @@ export interface MessageResource {
|
|
|
20
21
|
replyRoot?: MessageResource | null;
|
|
21
22
|
idempotentKey?: string | null;
|
|
22
23
|
messageType: string;
|
|
24
|
+
unsupportedMessageType?: string | null;
|
|
25
|
+
fallbackContent?: FallbackContent | null;
|
|
23
26
|
personIdsForSystemEvent?: number[] | null;
|
|
24
27
|
systemTextParts?: {
|
|
25
28
|
names: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/types/resources/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,oCAAoC,CAAA;AACnF,OAAO,EAAE,uCAAuC,EAAE,MAAM,+CAA+C,CAAA;AACvG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAC9C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAEvD,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,OAAO,CAAA;AAEjD,MAAM,WAAW,eAAe;I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,oBAAoB,CAAC,EAAE,uCAAuC,EAAE,CAAA;CACjE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.js","names":[],"sources":["../../../src/types/resources/message.ts"],"sourcesContent":["import { DenormalizedAttachmentResource } from './denormalized_attachment_resource'\nimport { DenormalizedAttachmentResourceForCreate } from './denormalized_attachment_resource_for_create'\nimport type { PersonResource } from './person'\nimport type { ReactionCountResource } from './reaction'\n\nexport type SystemTextFormat = 'people' | 'actor'\n\nexport interface MessageResource {\n type: 'Message'\n id: string\n text: string | null\n html: string\n createdAt: string\n deletedAt: string | null\n textEditedAt: string | null\n mine: boolean\n attachments: DenormalizedAttachmentResource[]\n author: PersonResource\n reactionCounts: ReactionCountResource[]\n replyCount: number\n replyRootId?: string | null\n replyRoot?: MessageResource | null\n idempotentKey?: string | null\n messageType: string\n personIdsForSystemEvent?: number[] | null\n systemTextParts?: { names: string[]; overflowCount: number; action: string } | null\n systemTextFormat?: SystemTextFormat | null\n\n // Custom Local Properties we set for rendering\n renderAuthor?: boolean\n renderTime?: boolean\n myLatestInConversation?: boolean\n lastInGroup?: boolean\n threadPosition?: 'first' | 'center' | 'last' | null\n prevIsMyReply?: boolean\n nextIsMyReply?: boolean\n nextRendersAuthor?: boolean\n isReplyShadowMessage?: boolean\n nextIsReplyShadowMessage?: boolean\n\n // Properties for mutation state\n pending?: boolean // Indicates if the message is optimistically created and pending server response\n error?: string // Error message if the message failed to send\n attachmentsForCreate?: DenormalizedAttachmentResourceForCreate[]\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"message.js","names":[],"sources":["../../../src/types/resources/message.ts"],"sourcesContent":["import { DenormalizedAttachmentResource } from './denormalized_attachment_resource'\nimport { DenormalizedAttachmentResourceForCreate } from './denormalized_attachment_resource_for_create'\nimport type { FallbackContent } from './fallback_content'\nimport type { PersonResource } from './person'\nimport type { ReactionCountResource } from './reaction'\n\nexport type SystemTextFormat = 'people' | 'actor'\n\nexport interface MessageResource {\n type: 'Message'\n id: string\n text: string | null\n html: string\n createdAt: string\n deletedAt: string | null\n textEditedAt: string | null\n mine: boolean\n attachments: DenormalizedAttachmentResource[]\n author: PersonResource\n reactionCounts: ReactionCountResource[]\n replyCount: number\n replyRootId?: string | null\n replyRoot?: MessageResource | null\n idempotentKey?: string | null\n messageType: string\n // Set when messageType is 'unsupported': the type the server would have sent a newer client.\n unsupportedMessageType?: string | null\n // Set when messageType is 'unsupported': what to show read-only in place of the type.\n fallbackContent?: FallbackContent | null\n personIdsForSystemEvent?: number[] | null\n systemTextParts?: { names: string[]; overflowCount: number; action: string } | null\n systemTextFormat?: SystemTextFormat | null\n\n // Custom Local Properties we set for rendering\n renderAuthor?: boolean\n renderTime?: boolean\n myLatestInConversation?: boolean\n lastInGroup?: boolean\n threadPosition?: 'first' | 'center' | 'last' | null\n prevIsMyReply?: boolean\n nextIsMyReply?: boolean\n nextRendersAuthor?: boolean\n isReplyShadowMessage?: boolean\n nextIsReplyShadowMessage?: boolean\n\n // Properties for mutation state\n pending?: boolean // Indicates if the message is optimistically created and pending server response\n error?: string // Error message if the message failed to send\n attachmentsForCreate?: DenormalizedAttachmentResourceForCreate[]\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform_message_event_data_to_message_resource.d.ts","sourceRoot":"","sources":["../../../src/utils/jolt/transform_message_event_data_to_message_resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAA;AAI5E,wBAAgB,0CAA0C,CAAC,EACzD,IAAI,EACJ,eAAe,GAChB,EAAE;IACD,IAAI,EAAE,mBAAmB,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAA;IACzC,eAAe,EAAE,MAAM,CAAA;CACxB,GAAG,eAAe,
|
|
1
|
+
{"version":3,"file":"transform_message_event_data_to_message_resource.d.ts","sourceRoot":"","sources":["../../../src/utils/jolt/transform_message_event_data_to_message_resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAA;AAI5E,wBAAgB,0CAA0C,CAAC,EACzD,IAAI,EACJ,eAAe,GAChB,EAAE;IACD,IAAI,EAAE,mBAAmB,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAA;IACzC,eAAe,EAAE,MAAM,CAAA;CACxB,GAAG,eAAe,CAkClB"}
|
|
@@ -24,6 +24,8 @@ export function transformMessageEventDataToMessageResource({
|
|
|
24
24
|
replyRootId: data.reply_root_id || null,
|
|
25
25
|
idempotentKey: data.idempotent_key ?? null,
|
|
26
26
|
messageType: data.message_type,
|
|
27
|
+
unsupportedMessageType: data.unsupported_message_type ?? null,
|
|
28
|
+
fallbackContent: data.fallback_content ?? null,
|
|
27
29
|
personIdsForSystemEvent: data.system_event_person_ids,
|
|
28
30
|
systemTextParts: data.system_text_parts ? {
|
|
29
31
|
names: data.system_text_parts.names,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform_message_event_data_to_message_resource.js","names":["deepCamelCaseKeys","transformMessageEventDataToMessageResource","data","currentPersonId","type","id","sort_key","text","html","createdAt","created_at","deletedAt","deleted_at","textEditedAt","text_edited_at","mine","author_id","attachments","author","name","author_name","avatar","author_avatar","reactionCounts","replyCount","reply_count","replyRootId","reply_root_id","idempotentKey","idempotent_key","messageType","message_type","personIdsForSystemEvent","system_event_person_ids","systemTextParts","system_text_parts","names","overflowCount","overflow_count","action","systemTextFormat","system_text_format"],"sources":["../../../src/utils/jolt/transform_message_event_data_to_message_resource.ts"],"sourcesContent":["import { MessageResource } from '../../types'\nimport { MessageCreatedEvent } from '../../types/jolt_events/message_events'\nimport { DenormalizedAttachmentResource } from '../../types/resources/denormalized_attachment_resource'\nimport { deepCamelCaseKeys } from '../deepCamelCaseKeys'\n\nexport function transformMessageEventDataToMessageResource({\n data,\n currentPersonId,\n}: {\n data: MessageCreatedEvent['data']['data']\n currentPersonId: number\n}): MessageResource {\n return {\n type: 'Message',\n id: data.sort_key,\n text: data.text,\n html: data.html,\n createdAt: data.created_at,\n deletedAt: data.deleted_at,\n textEditedAt: data.text_edited_at,\n mine: data.author_id === currentPersonId,\n attachments: deepCamelCaseKeys<DenormalizedAttachmentResource[]>(data.attachments) || [],\n author: {\n type: 'Person',\n id: data.author_id,\n name: data.author_name,\n avatar: data.author_avatar,\n },\n reactionCounts: [],\n replyCount: data.reply_count || 0,\n replyRootId: data.reply_root_id || null,\n idempotentKey: data.idempotent_key ?? null,\n messageType: data.message_type,\n personIdsForSystemEvent: data.system_event_person_ids,\n systemTextParts: data.system_text_parts\n ? {\n names: data.system_text_parts.names,\n overflowCount: data.system_text_parts.overflow_count,\n action: data.system_text_parts.action,\n }\n : null,\n systemTextFormat: data.system_text_format,\n }\n}\n"],"mappings":"AAGA,SAASA,iBAAiB,QAAQ,sBAAsB;AAExD,OAAO,SAASC,0CAA0CA,CAAC;EACzDC,IAAI;EACJC;AAIF,CAAC,EAAmB;EAClB,OAAO;IACLC,IAAI,EAAE,SAAS;IACfC,EAAE,EAAEH,IAAI,CAACI,QAAQ;IACjBC,IAAI,EAAEL,IAAI,CAACK,IAAI;IACfC,IAAI,EAAEN,IAAI,CAACM,IAAI;IACfC,SAAS,EAAEP,IAAI,CAACQ,UAAU;IAC1BC,SAAS,EAAET,IAAI,CAACU,UAAU;IAC1BC,YAAY,EAAEX,IAAI,CAACY,cAAc;IACjCC,IAAI,EAAEb,IAAI,CAACc,SAAS,KAAKb,eAAe;IACxCc,WAAW,EAAEjB,iBAAiB,CAAmCE,IAAI,CAACe,WAAW,CAAC,IAAI,EAAE;IACxFC,MAAM,EAAE;MACNd,IAAI,EAAE,QAAQ;MACdC,EAAE,EAAEH,IAAI,CAACc,SAAS;MAClBG,IAAI,EAAEjB,IAAI,CAACkB,WAAW;MACtBC,MAAM,EAAEnB,IAAI,CAACoB;IACf,CAAC;IACDC,cAAc,EAAE,EAAE;IAClBC,UAAU,EAAEtB,IAAI,CAACuB,WAAW,IAAI,CAAC;IACjCC,WAAW,EAAExB,IAAI,CAACyB,aAAa,IAAI,IAAI;IACvCC,aAAa,EAAE1B,IAAI,CAAC2B,cAAc,IAAI,IAAI;IAC1CC,WAAW,EAAE5B,IAAI,CAAC6B,YAAY;IAC9BC,
|
|
1
|
+
{"version":3,"file":"transform_message_event_data_to_message_resource.js","names":["deepCamelCaseKeys","transformMessageEventDataToMessageResource","data","currentPersonId","type","id","sort_key","text","html","createdAt","created_at","deletedAt","deleted_at","textEditedAt","text_edited_at","mine","author_id","attachments","author","name","author_name","avatar","author_avatar","reactionCounts","replyCount","reply_count","replyRootId","reply_root_id","idempotentKey","idempotent_key","messageType","message_type","unsupportedMessageType","unsupported_message_type","fallbackContent","fallback_content","personIdsForSystemEvent","system_event_person_ids","systemTextParts","system_text_parts","names","overflowCount","overflow_count","action","systemTextFormat","system_text_format"],"sources":["../../../src/utils/jolt/transform_message_event_data_to_message_resource.ts"],"sourcesContent":["import { MessageResource } from '../../types'\nimport { MessageCreatedEvent } from '../../types/jolt_events/message_events'\nimport { DenormalizedAttachmentResource } from '../../types/resources/denormalized_attachment_resource'\nimport { deepCamelCaseKeys } from '../deepCamelCaseKeys'\n\nexport function transformMessageEventDataToMessageResource({\n data,\n currentPersonId,\n}: {\n data: MessageCreatedEvent['data']['data']\n currentPersonId: number\n}): MessageResource {\n return {\n type: 'Message',\n id: data.sort_key,\n text: data.text,\n html: data.html,\n createdAt: data.created_at,\n deletedAt: data.deleted_at,\n textEditedAt: data.text_edited_at,\n mine: data.author_id === currentPersonId,\n attachments: deepCamelCaseKeys<DenormalizedAttachmentResource[]>(data.attachments) || [],\n author: {\n type: 'Person',\n id: data.author_id,\n name: data.author_name,\n avatar: data.author_avatar,\n },\n reactionCounts: [],\n replyCount: data.reply_count || 0,\n replyRootId: data.reply_root_id || null,\n idempotentKey: data.idempotent_key ?? null,\n messageType: data.message_type,\n unsupportedMessageType: data.unsupported_message_type ?? null,\n fallbackContent: data.fallback_content ?? null,\n personIdsForSystemEvent: data.system_event_person_ids,\n systemTextParts: data.system_text_parts\n ? {\n names: data.system_text_parts.names,\n overflowCount: data.system_text_parts.overflow_count,\n action: data.system_text_parts.action,\n }\n : null,\n systemTextFormat: data.system_text_format,\n }\n}\n"],"mappings":"AAGA,SAASA,iBAAiB,QAAQ,sBAAsB;AAExD,OAAO,SAASC,0CAA0CA,CAAC;EACzDC,IAAI;EACJC;AAIF,CAAC,EAAmB;EAClB,OAAO;IACLC,IAAI,EAAE,SAAS;IACfC,EAAE,EAAEH,IAAI,CAACI,QAAQ;IACjBC,IAAI,EAAEL,IAAI,CAACK,IAAI;IACfC,IAAI,EAAEN,IAAI,CAACM,IAAI;IACfC,SAAS,EAAEP,IAAI,CAACQ,UAAU;IAC1BC,SAAS,EAAET,IAAI,CAACU,UAAU;IAC1BC,YAAY,EAAEX,IAAI,CAACY,cAAc;IACjCC,IAAI,EAAEb,IAAI,CAACc,SAAS,KAAKb,eAAe;IACxCc,WAAW,EAAEjB,iBAAiB,CAAmCE,IAAI,CAACe,WAAW,CAAC,IAAI,EAAE;IACxFC,MAAM,EAAE;MACNd,IAAI,EAAE,QAAQ;MACdC,EAAE,EAAEH,IAAI,CAACc,SAAS;MAClBG,IAAI,EAAEjB,IAAI,CAACkB,WAAW;MACtBC,MAAM,EAAEnB,IAAI,CAACoB;IACf,CAAC;IACDC,cAAc,EAAE,EAAE;IAClBC,UAAU,EAAEtB,IAAI,CAACuB,WAAW,IAAI,CAAC;IACjCC,WAAW,EAAExB,IAAI,CAACyB,aAAa,IAAI,IAAI;IACvCC,aAAa,EAAE1B,IAAI,CAAC2B,cAAc,IAAI,IAAI;IAC1CC,WAAW,EAAE5B,IAAI,CAAC6B,YAAY;IAC9BC,sBAAsB,EAAE9B,IAAI,CAAC+B,wBAAwB,IAAI,IAAI;IAC7DC,eAAe,EAAEhC,IAAI,CAACiC,gBAAgB,IAAI,IAAI;IAC9CC,uBAAuB,EAAElC,IAAI,CAACmC,uBAAuB;IACrDC,eAAe,EAAEpC,IAAI,CAACqC,iBAAiB,GACnC;MACEC,KAAK,EAAEtC,IAAI,CAACqC,iBAAiB,CAACC,KAAK;MACnCC,aAAa,EAAEvC,IAAI,CAACqC,iBAAiB,CAACG,cAAc;MACpDC,MAAM,EAAEzC,IAAI,CAACqC,iBAAiB,CAACI;IACjC,CAAC,GACD,IAAI;IACRC,gBAAgB,EAAE1C,IAAI,CAAC2C;EACzB,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { MessageResource } from '../types/resources/message';
|
|
2
|
+
export declare const UNSUPPORTED_MESSAGE_TYPE = "unsupported";
|
|
3
|
+
export declare const SUPPORTED_MESSAGE_TYPES: readonly ["user", "user_joined", "conversation_archived", "conversation_unarchived"];
|
|
4
|
+
export declare function isUnsupportedMessage(message: Pick<MessageResource, 'messageType'>): boolean;
|
|
5
|
+
//# sourceMappingURL=message_types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message_types.d.ts","sourceRoot":"","sources":["../../src/utils/message_types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAKjE,eAAO,MAAM,wBAAwB,gBAAgB,CAAA;AAErD,eAAO,MAAM,uBAAuB,sFAK1B,CAAA;AAEV,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,IAAI,CAAC,eAAe,EAAE,aAAa,CAAC,GAAG,OAAO,CAO3F"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// The server reports a type newer than this build's API version as 'unsupported'. Jolt payloads
|
|
2
|
+
// are not versioned, so a type this build has no code for can still arrive under its real name
|
|
3
|
+
// and gets the same treatment.
|
|
4
|
+
export const UNSUPPORTED_MESSAGE_TYPE = 'unsupported';
|
|
5
|
+
export const SUPPORTED_MESSAGE_TYPES = ['user', 'user_joined', 'conversation_archived', 'conversation_unarchived'];
|
|
6
|
+
export function isUnsupportedMessage(message) {
|
|
7
|
+
if (!message.messageType) return false;
|
|
8
|
+
return message.messageType === UNSUPPORTED_MESSAGE_TYPE || !SUPPORTED_MESSAGE_TYPES.includes(message.messageType);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=message_types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message_types.js","names":["UNSUPPORTED_MESSAGE_TYPE","SUPPORTED_MESSAGE_TYPES","isUnsupportedMessage","message","messageType","includes"],"sources":["../../src/utils/message_types.ts"],"sourcesContent":["import type { MessageResource } from '../types/resources/message'\n\n// The server reports a type newer than this build's API version as 'unsupported'. Jolt payloads\n// are not versioned, so a type this build has no code for can still arrive under its real name\n// and gets the same treatment.\nexport const UNSUPPORTED_MESSAGE_TYPE = 'unsupported'\n\nexport const SUPPORTED_MESSAGE_TYPES = [\n 'user',\n 'user_joined',\n 'conversation_archived',\n 'conversation_unarchived',\n] as const\n\nexport function isUnsupportedMessage(message: Pick<MessageResource, 'messageType'>): boolean {\n if (!message.messageType) return false\n\n return (\n message.messageType === UNSUPPORTED_MESSAGE_TYPE ||\n !(SUPPORTED_MESSAGE_TYPES as readonly string[]).includes(message.messageType)\n )\n}\n"],"mappings":"AAEA;AACA;AACA;AACA,OAAO,MAAMA,wBAAwB,GAAG,aAAa;AAErD,OAAO,MAAMC,uBAAuB,GAAG,CACrC,MAAM,EACN,aAAa,EACb,uBAAuB,EACvB,yBAAyB,CACjB;AAEV,OAAO,SAASC,oBAAoBA,CAACC,OAA6C,EAAW;EAC3F,IAAI,CAACA,OAAO,CAACC,WAAW,EAAE,OAAO,KAAK;EAEtC,OACED,OAAO,CAACC,WAAW,KAAKJ,wBAAwB,IAChD,CAAEC,uBAAuB,CAAuBI,QAAQ,CAACF,OAAO,CAACC,WAAW,CAAC;AAEjF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages_data_options.d.ts","sourceRoot":"","sources":["../../../src/utils/request/messages_data_options.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB;;;;
|
|
1
|
+
{"version":3,"file":"messages_data_options.d.ts","sourceRoot":"","sources":["../../../src/utils/request/messages_data_options.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB;;;;CAqB5B,CAAA;AAED,eAAO,MAAM,kBAAkB,UAAmE,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const getMessageFields = {
|
|
2
|
-
Message: ['text', 'text_edited_at', 'mine', 'attachments', 'created_at', 'deleted_at', 'author', 'reaction_counts', 'reply_count', 'reply_root', 'idempotent_key', 'message_type', 'person_ids_for_system_event', 'system_text_parts', 'system_text_format'],
|
|
2
|
+
Message: ['text', 'text_edited_at', 'mine', 'attachments', 'created_at', 'deleted_at', 'author', 'reaction_counts', 'reply_count', 'reply_root', 'idempotent_key', 'message_type', 'fallback_content', 'person_ids_for_system_event', 'system_text_parts', 'system_text_format'],
|
|
3
3
|
Person: ['name', 'avatar'],
|
|
4
4
|
ReactionCount: ['value', 'count', 'mine', 'message_id', 'author_ids']
|
|
5
5
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages_data_options.js","names":["getMessageFields","Message","Person","ReactionCount","getMessagesInclude"],"sources":["../../../src/utils/request/messages_data_options.ts"],"sourcesContent":["export const getMessageFields = {\n Message: [\n 'text',\n 'text_edited_at',\n 'mine',\n 'attachments',\n 'created_at',\n 'deleted_at',\n 'author',\n 'reaction_counts',\n 'reply_count',\n 'reply_root',\n 'idempotent_key',\n 'message_type',\n 'person_ids_for_system_event',\n 'system_text_parts',\n 'system_text_format',\n ],\n Person: ['name', 'avatar'],\n ReactionCount: ['value', 'count', 'mine', 'message_id', 'author_ids'],\n}\n\nexport const getMessagesInclude = ['author', 'reaction_counts', 'reply_root', 'reply_root.author']\n"],"mappings":"AAAA,OAAO,MAAMA,gBAAgB,GAAG;EAC9BC,OAAO,EAAE,CACP,MAAM,EACN,gBAAgB,EAChB,MAAM,EACN,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,6BAA6B,EAC7B,mBAAmB,EACnB,oBAAoB,CACrB;EACDC,MAAM,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC;EAC1BC,aAAa,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY;AACtE,CAAC;AAED,OAAO,MAAMC,kBAAkB,GAAG,CAAC,QAAQ,EAAE,iBAAiB,EAAE,YAAY,EAAE,mBAAmB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"messages_data_options.js","names":["getMessageFields","Message","Person","ReactionCount","getMessagesInclude"],"sources":["../../../src/utils/request/messages_data_options.ts"],"sourcesContent":["export const getMessageFields = {\n Message: [\n 'text',\n 'text_edited_at',\n 'mine',\n 'attachments',\n 'created_at',\n 'deleted_at',\n 'author',\n 'reaction_counts',\n 'reply_count',\n 'reply_root',\n 'idempotent_key',\n 'message_type',\n 'fallback_content',\n 'person_ids_for_system_event',\n 'system_text_parts',\n 'system_text_format',\n ],\n Person: ['name', 'avatar'],\n ReactionCount: ['value', 'count', 'mine', 'message_id', 'author_ids'],\n}\n\nexport const getMessagesInclude = ['author', 'reaction_counts', 'reply_root', 'reply_root.author']\n"],"mappings":"AAAA,OAAO,MAAMA,gBAAgB,GAAG;EAC9BC,OAAO,EAAE,CACP,MAAM,EACN,gBAAgB,EAChB,MAAM,EACN,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAClB,6BAA6B,EAC7B,mBAAmB,EACnB,oBAAoB,CACrB;EACDC,MAAM,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC;EAC1BC,aAAa,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY;AACtE,CAAC;AAED,OAAO,MAAMC,kBAAkB,GAAG,CAAC,QAAQ,EAAE,iBAAiB,EAAE,YAAY,EAAE,mBAAmB,CAAC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planningcenter/chat-react-native",
|
|
3
|
-
"version": "4.7.0-rc.
|
|
3
|
+
"version": "4.7.0-rc.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"sf-symbols-typescript": "^2.2.0",
|
|
85
85
|
"typescript": "~6.0.3"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "84ac1257e5c11783165de5670a87ef984bdbd961"
|
|
88
88
|
}
|
|
@@ -90,7 +90,7 @@ const buildMessage = (n: number, overrides: Partial<MessageResource> = {}): Mess
|
|
|
90
90
|
reactionCounts: [],
|
|
91
91
|
replyCount: 0,
|
|
92
92
|
replyRootId: null,
|
|
93
|
-
messageType: '
|
|
93
|
+
messageType: 'user',
|
|
94
94
|
...overrides,
|
|
95
95
|
}
|
|
96
96
|
idByCreatedAt.set(message.createdAt, message.id)
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react-native'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import type { MessageResource } from '../../../types/resources/message'
|
|
4
|
+
import type { PersonResource } from '../../../types/resources/person'
|
|
5
|
+
import {
|
|
6
|
+
UNSUPPORTED_MESSAGE_FALLBACK,
|
|
7
|
+
UNSUPPORTED_MESSAGE_HINT,
|
|
8
|
+
UnsupportedMessage,
|
|
9
|
+
} from '../unsupported_message'
|
|
10
|
+
|
|
11
|
+
const author = { id: 1, type: 'Person', name: 'Wes', avatar: null } as unknown as PersonResource
|
|
12
|
+
|
|
13
|
+
const message = (overrides: Partial<MessageResource>): MessageResource => ({
|
|
14
|
+
type: 'Message',
|
|
15
|
+
id: '01',
|
|
16
|
+
text: null,
|
|
17
|
+
html: '',
|
|
18
|
+
createdAt: '2026-02-03T14:18:00',
|
|
19
|
+
deletedAt: null,
|
|
20
|
+
textEditedAt: null,
|
|
21
|
+
mine: false,
|
|
22
|
+
attachments: [],
|
|
23
|
+
author,
|
|
24
|
+
reactionCounts: [],
|
|
25
|
+
replyCount: 0,
|
|
26
|
+
replyRootId: null,
|
|
27
|
+
messageType: 'unsupported',
|
|
28
|
+
...overrides,
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
describe('UnsupportedMessage', () => {
|
|
32
|
+
it("shows the server's fallback text and the update hint", () => {
|
|
33
|
+
render(
|
|
34
|
+
<UnsupportedMessage
|
|
35
|
+
message={message({ text: '📊 Poll: Lunch? — Update your app to vote' })}
|
|
36
|
+
/>
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
expect(screen.getByText('📊 Poll: Lunch? — Update your app to vote')).toBeTruthy()
|
|
40
|
+
expect(screen.getByText(UNSUPPORTED_MESSAGE_HINT)).toBeTruthy()
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
it('falls back to a generic line when the server sent no text', () => {
|
|
44
|
+
render(<UnsupportedMessage message={message({ text: ' ' })} />)
|
|
45
|
+
|
|
46
|
+
expect(screen.getByText(UNSUPPORTED_MESSAGE_FALLBACK)).toBeTruthy()
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
it('names the author when grouping asks for it, so follow-ups stay attributed', () => {
|
|
50
|
+
render(<UnsupportedMessage message={message({ text: 'Poll', renderAuthor: true })} />)
|
|
51
|
+
|
|
52
|
+
expect(screen.getByText('Wes')).toBeTruthy()
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
it('omits the author inside a group and on my own messages', () => {
|
|
56
|
+
const { rerender } = render(
|
|
57
|
+
<UnsupportedMessage message={message({ text: 'Poll', renderAuthor: false })} />
|
|
58
|
+
)
|
|
59
|
+
expect(screen.queryByText('Wes')).toBeNull()
|
|
60
|
+
|
|
61
|
+
rerender(
|
|
62
|
+
<UnsupportedMessage message={message({ text: 'Poll', mine: true, renderAuthor: true })} />
|
|
63
|
+
)
|
|
64
|
+
expect(screen.queryByText('Wes')).toBeNull()
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
it('renders the fallback content read-only: title, items with totals, footer and hint', () => {
|
|
68
|
+
render(
|
|
69
|
+
<UnsupportedMessage
|
|
70
|
+
message={message({
|
|
71
|
+
text: '📊 Poll: Lunch? — Update your app to vote',
|
|
72
|
+
fallbackContent: {
|
|
73
|
+
kind: 'poll',
|
|
74
|
+
title: 'Lunch?',
|
|
75
|
+
subtitle: 'Select one · 3 votes',
|
|
76
|
+
items: [
|
|
77
|
+
{ label: 'Tacos', detail: '2', fraction: 0.67, selected: true },
|
|
78
|
+
{ label: 'Pizza', detail: '1', fraction: 0.33 },
|
|
79
|
+
],
|
|
80
|
+
footer: 'Ends Friday',
|
|
81
|
+
hint: 'Update your app to vote',
|
|
82
|
+
},
|
|
83
|
+
})}
|
|
84
|
+
/>
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
expect(screen.getByText('Lunch?')).toBeTruthy()
|
|
88
|
+
expect(screen.getByText('Select one · 3 votes')).toBeTruthy()
|
|
89
|
+
expect(screen.getByText('● Tacos')).toBeTruthy()
|
|
90
|
+
expect(screen.getByText('2')).toBeTruthy()
|
|
91
|
+
expect(screen.getByText('Pizza')).toBeTruthy()
|
|
92
|
+
expect(screen.getByText('Ends Friday')).toBeTruthy()
|
|
93
|
+
expect(screen.getByText('Update your app to vote')).toBeTruthy()
|
|
94
|
+
expect(screen.queryByText(/📊 Poll/)).toBeNull()
|
|
95
|
+
expect(screen.queryByRole('button')).toBeNull()
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
it('does not repeat the update hint when the server text already carries it', () => {
|
|
99
|
+
render(
|
|
100
|
+
<UnsupportedMessage
|
|
101
|
+
message={message({
|
|
102
|
+
text: "This message can't be shown here. Update your app to see it.",
|
|
103
|
+
})}
|
|
104
|
+
/>
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
expect(screen.getAllByText(/Update your app/)).toHaveLength(1)
|
|
108
|
+
})
|
|
109
|
+
})
|
|
@@ -9,6 +9,7 @@ import { MessageResource } from '../../types/resources/message'
|
|
|
9
9
|
import { getRelativeDateStatus } from '../../utils/date'
|
|
10
10
|
import { groupMessages, type DateSeparator, type EnrichedMessage } from '../../utils/group_messages'
|
|
11
11
|
import { isLiquidGlassEnabled } from '../../utils/liquid_glass'
|
|
12
|
+
import { isUnsupportedMessage } from '../../utils/message_types'
|
|
12
13
|
import { CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL } from '../../utils/styles'
|
|
13
14
|
import { isSystemMessage } from '../../utils/system_messages'
|
|
14
15
|
import { Text } from '../display'
|
|
@@ -17,6 +18,7 @@ import { Message } from './message'
|
|
|
17
18
|
import { MissingMessage } from './missing_message'
|
|
18
19
|
import { ReplyShadowMessage } from './reply_shadow_message'
|
|
19
20
|
import { SystemMessage } from './system_message'
|
|
21
|
+
import { UnsupportedMessage } from './unsupported_message'
|
|
20
22
|
|
|
21
23
|
// While behind, the bottom of the window isn't the live edge. Following there pulls
|
|
22
24
|
// each newly paged-in page into view and chains the next fetch.
|
|
@@ -199,6 +201,10 @@ export function MessageList({
|
|
|
199
201
|
)
|
|
200
202
|
}
|
|
201
203
|
|
|
204
|
+
if (isUnsupportedMessage(item)) {
|
|
205
|
+
return <UnsupportedMessage message={item} />
|
|
206
|
+
}
|
|
207
|
+
|
|
202
208
|
if (isSystemMessage(item)) {
|
|
203
209
|
return (
|
|
204
210
|
<SystemMessage
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { StyleSheet, View } from 'react-native'
|
|
3
|
+
import { useTheme } from '../../hooks'
|
|
4
|
+
import type { FallbackContent, FallbackContentItem } from '../../types/resources/fallback_content'
|
|
5
|
+
import type { MessageResource } from '../../types/resources/message'
|
|
6
|
+
import {
|
|
7
|
+
CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL,
|
|
8
|
+
MESSAGE_AUTHOR_AVATAR_COLUMN_WIDTH,
|
|
9
|
+
platformFontWeightMedium,
|
|
10
|
+
} from '../../utils/styles'
|
|
11
|
+
import { Avatar, Text } from '../display'
|
|
12
|
+
|
|
13
|
+
export const UNSUPPORTED_MESSAGE_FALLBACK = "This message can't be shown here."
|
|
14
|
+
export const UNSUPPORTED_MESSAGE_HINT = 'Update your app to see it.'
|
|
15
|
+
|
|
16
|
+
interface UnsupportedMessageProps {
|
|
17
|
+
message: MessageResource
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** UnsupportedMessage
|
|
21
|
+
* Read-only bubble for a message type this build can't render. With `fallbackContent` it shows
|
|
22
|
+
* the type's title, subtitle, items (label, detail, share) and footer; without it, the server's
|
|
23
|
+
* fallback text or a generic line. Always ends with a hint to update. No actions, no reactions.
|
|
24
|
+
* It keeps the regular message's author column so grouping stays attributed around it.
|
|
25
|
+
*/
|
|
26
|
+
export function UnsupportedMessage({ message }: UnsupportedMessageProps) {
|
|
27
|
+
const styles = useStyles(message.mine)
|
|
28
|
+
const content = message.fallbackContent ?? null
|
|
29
|
+
const text = message.text?.trim() || UNSUPPORTED_MESSAGE_FALLBACK
|
|
30
|
+
const hint =
|
|
31
|
+
content?.hint || (text.includes(UNSUPPORTED_MESSAGE_HINT) ? null : UNSUPPORTED_MESSAGE_HINT)
|
|
32
|
+
const renderAuthor = !message.mine && !!message.renderAuthor
|
|
33
|
+
const summary = content ? contentSummary(content) : text
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<View
|
|
37
|
+
style={styles.container}
|
|
38
|
+
accessibilityRole="text"
|
|
39
|
+
accessibilityLabel={`${message.author?.name || ''} ${summary} ${hint ?? ''}`}
|
|
40
|
+
testID={`unsupported-message-${message.id}`}
|
|
41
|
+
>
|
|
42
|
+
{!message.mine &&
|
|
43
|
+
(renderAuthor ? (
|
|
44
|
+
<Avatar
|
|
45
|
+
size="md"
|
|
46
|
+
sourceUri={message.author?.avatar}
|
|
47
|
+
maxFontSizeMultiplier={1}
|
|
48
|
+
minFontSizeMultiplier={1}
|
|
49
|
+
/>
|
|
50
|
+
) : (
|
|
51
|
+
<View style={styles.avatarPlaceholder} />
|
|
52
|
+
))}
|
|
53
|
+
<View style={styles.content}>
|
|
54
|
+
{renderAuthor && (
|
|
55
|
+
<Text variant="footnote" style={styles.authorName}>
|
|
56
|
+
{message.author?.name}
|
|
57
|
+
</Text>
|
|
58
|
+
)}
|
|
59
|
+
<View style={styles.bubble}>
|
|
60
|
+
{content ? (
|
|
61
|
+
<FallbackContentBody content={content} styles={styles} />
|
|
62
|
+
) : (
|
|
63
|
+
<Text style={styles.text}>{text}</Text>
|
|
64
|
+
)}
|
|
65
|
+
{!!hint && (
|
|
66
|
+
<Text variant="tertiary" style={styles.hint}>
|
|
67
|
+
{hint}
|
|
68
|
+
</Text>
|
|
69
|
+
)}
|
|
70
|
+
</View>
|
|
71
|
+
</View>
|
|
72
|
+
</View>
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function FallbackContentBody({
|
|
77
|
+
content,
|
|
78
|
+
styles,
|
|
79
|
+
}: {
|
|
80
|
+
content: FallbackContent
|
|
81
|
+
styles: ReturnType<typeof useStyles>
|
|
82
|
+
}) {
|
|
83
|
+
return (
|
|
84
|
+
<>
|
|
85
|
+
<Text style={styles.title}>{content.title}</Text>
|
|
86
|
+
{!!content.subtitle && <Text variant="tertiary">{content.subtitle}</Text>}
|
|
87
|
+
{(content.items ?? []).map((item, index) => (
|
|
88
|
+
<FallbackItem key={`${index}-${item.label}`} item={item} styles={styles} />
|
|
89
|
+
))}
|
|
90
|
+
{!!content.footer && (
|
|
91
|
+
<Text variant="tertiary" style={styles.footer}>
|
|
92
|
+
{content.footer}
|
|
93
|
+
</Text>
|
|
94
|
+
)}
|
|
95
|
+
</>
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function FallbackItem({
|
|
100
|
+
item,
|
|
101
|
+
styles,
|
|
102
|
+
}: {
|
|
103
|
+
item: FallbackContentItem
|
|
104
|
+
styles: ReturnType<typeof useStyles>
|
|
105
|
+
}) {
|
|
106
|
+
const fraction =
|
|
107
|
+
typeof item.fraction === 'number' ? Math.min(Math.max(item.fraction, 0), 1) : null
|
|
108
|
+
|
|
109
|
+
return (
|
|
110
|
+
<View style={styles.item}>
|
|
111
|
+
<View style={styles.itemRow}>
|
|
112
|
+
<Text style={[styles.itemLabel, item.selected ? styles.itemSelected : null]}>
|
|
113
|
+
{(item.selected ? '● ' : '') + item.label}
|
|
114
|
+
</Text>
|
|
115
|
+
{!!item.detail && <Text variant="tertiary">{item.detail}</Text>}
|
|
116
|
+
</View>
|
|
117
|
+
{fraction !== null && (
|
|
118
|
+
<View style={styles.track}>
|
|
119
|
+
<View style={[styles.fill, { width: `${Math.round(fraction * 100)}%` }]} />
|
|
120
|
+
</View>
|
|
121
|
+
)}
|
|
122
|
+
</View>
|
|
123
|
+
)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function contentSummary(content: FallbackContent): string {
|
|
127
|
+
const items = (content.items ?? [])
|
|
128
|
+
.map(item => (item.detail ? `${item.label} ${item.detail}` : item.label))
|
|
129
|
+
.join(', ')
|
|
130
|
+
return [content.title, content.subtitle, items, content.footer].filter(Boolean).join('. ')
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const useStyles = (mine: boolean) => {
|
|
134
|
+
const { colors } = useTheme()
|
|
135
|
+
return StyleSheet.create({
|
|
136
|
+
container: {
|
|
137
|
+
gap: 8,
|
|
138
|
+
flexDirection: mine ? 'row-reverse' : 'row',
|
|
139
|
+
paddingHorizontal: CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL,
|
|
140
|
+
paddingVertical: 4,
|
|
141
|
+
},
|
|
142
|
+
avatarPlaceholder: {
|
|
143
|
+
width: MESSAGE_AUTHOR_AVATAR_COLUMN_WIDTH,
|
|
144
|
+
},
|
|
145
|
+
content: {
|
|
146
|
+
flex: 1,
|
|
147
|
+
gap: 4,
|
|
148
|
+
},
|
|
149
|
+
authorName: {
|
|
150
|
+
fontWeight: platformFontWeightMedium,
|
|
151
|
+
},
|
|
152
|
+
bubble: {
|
|
153
|
+
maxWidth: '80%',
|
|
154
|
+
minWidth: '60%',
|
|
155
|
+
alignSelf: mine ? 'flex-end' : 'flex-start',
|
|
156
|
+
borderRadius: 8,
|
|
157
|
+
paddingVertical: 6,
|
|
158
|
+
paddingHorizontal: 8,
|
|
159
|
+
gap: 4,
|
|
160
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
161
|
+
borderColor: colors.textColorDefaultSecondary,
|
|
162
|
+
},
|
|
163
|
+
text: {
|
|
164
|
+
color: colors.textColorDefaultSecondary,
|
|
165
|
+
},
|
|
166
|
+
title: {
|
|
167
|
+
fontWeight: platformFontWeightMedium,
|
|
168
|
+
},
|
|
169
|
+
item: {
|
|
170
|
+
gap: 2,
|
|
171
|
+
marginTop: 2,
|
|
172
|
+
},
|
|
173
|
+
itemRow: {
|
|
174
|
+
flexDirection: 'row',
|
|
175
|
+
justifyContent: 'space-between',
|
|
176
|
+
alignItems: 'center',
|
|
177
|
+
gap: 8,
|
|
178
|
+
},
|
|
179
|
+
itemLabel: {
|
|
180
|
+
flexShrink: 1,
|
|
181
|
+
},
|
|
182
|
+
itemSelected: {
|
|
183
|
+
fontWeight: platformFontWeightMedium,
|
|
184
|
+
},
|
|
185
|
+
track: {
|
|
186
|
+
height: 4,
|
|
187
|
+
borderRadius: 2,
|
|
188
|
+
backgroundColor: colors.fillColorNeutral070,
|
|
189
|
+
overflow: 'hidden',
|
|
190
|
+
},
|
|
191
|
+
fill: {
|
|
192
|
+
height: 4,
|
|
193
|
+
backgroundColor: colors.textColorDefaultSecondary,
|
|
194
|
+
},
|
|
195
|
+
footer: {
|
|
196
|
+
marginTop: 2,
|
|
197
|
+
},
|
|
198
|
+
hint: {
|
|
199
|
+
marginTop: 2,
|
|
200
|
+
},
|
|
201
|
+
})
|
|
202
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { CustomMessage } from '@planningcenter/jolt-client/dist/types/JoltConnection'
|
|
2
2
|
import { DenormalizedAttachmentResource } from '../resources/denormalized_attachment_resource'
|
|
3
|
+
import type { FallbackContent } from '../resources/fallback_content'
|
|
3
4
|
import type { SystemTextFormat } from '../resources/message'
|
|
4
5
|
|
|
5
6
|
interface BaseMessageEventData extends Record<string, unknown> {
|
|
@@ -20,6 +21,8 @@ interface BaseMessageEventData extends Record<string, unknown> {
|
|
|
20
21
|
reply_count: number
|
|
21
22
|
reply_root_id: string | null
|
|
22
23
|
message_type: string
|
|
24
|
+
unsupported_message_type?: string | null
|
|
25
|
+
fallback_content?: FallbackContent | null
|
|
23
26
|
system_event_person_ids: number[] | null
|
|
24
27
|
system_text_parts: { names: string[]; overflow_count: number; action: string } | null
|
|
25
28
|
system_text_format: SystemTextFormat | null
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** FallbackContent
|
|
2
|
+
* The read-only shape the server sends for a message type this build can't render: text and
|
|
3
|
+
* numbers only, nothing actionable, and only `title` is guaranteed. It is a contract with
|
|
4
|
+
* shipped builds, so it only ever gains optional fields.
|
|
5
|
+
*/
|
|
6
|
+
export interface FallbackContentItem {
|
|
7
|
+
label: string
|
|
8
|
+
detail?: string | null
|
|
9
|
+
fraction?: number | null
|
|
10
|
+
selected?: boolean | null
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface FallbackContent {
|
|
14
|
+
kind: string
|
|
15
|
+
title: string
|
|
16
|
+
subtitle?: string | null
|
|
17
|
+
items?: FallbackContentItem[] | null
|
|
18
|
+
footer?: string | null
|
|
19
|
+
hint?: string | null
|
|
20
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DenormalizedAttachmentResource } from './denormalized_attachment_resource'
|
|
2
2
|
import { DenormalizedAttachmentResourceForCreate } from './denormalized_attachment_resource_for_create'
|
|
3
|
+
import type { FallbackContent } from './fallback_content'
|
|
3
4
|
import type { PersonResource } from './person'
|
|
4
5
|
import type { ReactionCountResource } from './reaction'
|
|
5
6
|
|
|
@@ -22,6 +23,10 @@ export interface MessageResource {
|
|
|
22
23
|
replyRoot?: MessageResource | null
|
|
23
24
|
idempotentKey?: string | null
|
|
24
25
|
messageType: string
|
|
26
|
+
// Set when messageType is 'unsupported': the type the server would have sent a newer client.
|
|
27
|
+
unsupportedMessageType?: string | null
|
|
28
|
+
// Set when messageType is 'unsupported': what to show read-only in place of the type.
|
|
29
|
+
fallbackContent?: FallbackContent | null
|
|
25
30
|
personIdsForSystemEvent?: number[] | null
|
|
26
31
|
systemTextParts?: { names: string[]; overflowCount: number; action: string } | null
|
|
27
32
|
systemTextFormat?: SystemTextFormat | null
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { isUnsupportedMessage } from '../message_types'
|
|
2
|
+
|
|
3
|
+
describe('isUnsupportedMessage', () => {
|
|
4
|
+
it('is false for every type this build renders', () => {
|
|
5
|
+
for (const messageType of [
|
|
6
|
+
'user',
|
|
7
|
+
'user_joined',
|
|
8
|
+
'conversation_archived',
|
|
9
|
+
'conversation_unarchived',
|
|
10
|
+
]) {
|
|
11
|
+
expect(isUnsupportedMessage({ messageType })).toBe(false)
|
|
12
|
+
}
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
it("is true for the server's unsupported placeholder", () => {
|
|
16
|
+
expect(isUnsupportedMessage({ messageType: 'unsupported' })).toBe(true)
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
it('is true for a type this build has no code for, as Jolt can deliver one', () => {
|
|
20
|
+
expect(isUnsupportedMessage({ messageType: 'poll' })).toBe(true)
|
|
21
|
+
})
|
|
22
|
+
})
|