| 
									
										
										
										
											2023-01-03 11:55:46 -08:00
										 |  |  | // Copyright 2019 Signal Messenger, LLC
 | 
					
						
							| 
									
										
										
										
											2020-10-30 15:34:04 -05:00
										 |  |  | // SPDX-License-Identifier: AGPL-3.0-only
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-26 17:05:26 -06:00
										 |  |  | import type { ReactChild, RefObject } from 'react'; | 
					
						
							| 
									
										
										
										
											2021-10-26 14:15:33 -05:00
										 |  |  | import React from 'react'; | 
					
						
							| 
									
										
										
										
											2021-08-11 09:23:21 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-26 14:15:33 -05:00
										 |  |  | import type { LocalizerType, ThemeType } from '../../types/Util'; | 
					
						
							| 
									
										
										
										
											2019-03-20 10:42:28 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-26 14:15:33 -05:00
										 |  |  | import type { InteractionModeType } from '../../state/ducks/conversations'; | 
					
						
							| 
									
										
										
										
											2022-01-26 17:05:26 -06:00
										 |  |  | import { TimelineDateHeader } from './TimelineDateHeader'; | 
					
						
							| 
									
										
										
										
											2021-10-26 14:15:33 -05:00
										 |  |  | import type { | 
					
						
							| 
									
										
										
										
											2020-05-05 15:49:34 -04:00
										 |  |  |   Props as AllMessageProps, | 
					
						
							| 
									
										
										
										
											2022-11-04 07:22:07 -06:00
										 |  |  |   PropsData as TimelineMessageProps, | 
					
						
							| 
									
										
										
										
											2019-03-20 10:42:28 -07:00
										 |  |  |   PropsActions as MessageActionsType, | 
					
						
							| 
									
										
										
										
											2022-11-04 07:22:07 -06:00
										 |  |  | } from './TimelineMessage'; | 
					
						
							| 
									
										
										
										
											2021-10-26 14:15:33 -05:00
										 |  |  | import type { PropsActionsType as CallingNotificationActionsType } from './CallingNotification'; | 
					
						
							|  |  |  | import { CallingNotification } from './CallingNotification'; | 
					
						
							|  |  |  | import { ChatSessionRefreshedNotification } from './ChatSessionRefreshedNotification'; | 
					
						
							| 
									
										
										
										
											2022-12-20 19:25:10 -08:00
										 |  |  | import type { PropsDataType as DeliveryIssueProps } from './DeliveryIssueNotification'; | 
					
						
							| 
									
										
										
										
											2021-10-26 14:15:33 -05:00
										 |  |  | import { DeliveryIssueNotification } from './DeliveryIssueNotification'; | 
					
						
							|  |  |  | import type { PropsData as ChangeNumberNotificationProps } from './ChangeNumberNotification'; | 
					
						
							|  |  |  | import { ChangeNumberNotification } from './ChangeNumberNotification'; | 
					
						
							|  |  |  | import type { CallingNotificationType } from '../../util/callingNotification'; | 
					
						
							| 
									
										
										
										
											2019-11-07 13:36:16 -08:00
										 |  |  | import { InlineNotificationWrapper } from './InlineNotificationWrapper'; | 
					
						
							| 
									
										
										
										
											2022-12-19 17:04:47 -08:00
										 |  |  | import type { PropsData as UnsupportedMessageProps } from './UnsupportedMessage'; | 
					
						
							| 
									
										
										
										
											2021-10-26 14:15:33 -05:00
										 |  |  | import { UnsupportedMessage } from './UnsupportedMessage'; | 
					
						
							|  |  |  | import type { PropsData as TimerNotificationProps } from './TimerNotification'; | 
					
						
							|  |  |  | import { TimerNotification } from './TimerNotification'; | 
					
						
							|  |  |  | import type { | 
					
						
							| 
									
										
										
										
											2019-03-20 10:42:28 -07:00
										 |  |  |   PropsActions as SafetyNumberActionsType, | 
					
						
							|  |  |  |   PropsData as SafetyNumberNotificationProps, | 
					
						
							|  |  |  | } from './SafetyNumberNotification'; | 
					
						
							| 
									
										
										
										
											2021-10-26 14:15:33 -05:00
										 |  |  | import { SafetyNumberNotification } from './SafetyNumberNotification'; | 
					
						
							|  |  |  | import type { PropsData as VerificationNotificationProps } from './VerificationNotification'; | 
					
						
							|  |  |  | import { VerificationNotification } from './VerificationNotification'; | 
					
						
							|  |  |  | import type { PropsData as GroupNotificationProps } from './GroupNotification'; | 
					
						
							|  |  |  | import { GroupNotification } from './GroupNotification'; | 
					
						
							| 
									
										
										
										
											2022-03-15 17:11:28 -07:00
										 |  |  | import type { | 
					
						
							|  |  |  |   PropsDataType as GroupV2ChangeProps, | 
					
						
							|  |  |  |   PropsActionsType as GroupV2ChangeActionsType, | 
					
						
							|  |  |  | } from './GroupV2Change'; | 
					
						
							| 
									
										
										
										
											2021-10-26 14:15:33 -05:00
										 |  |  | import { GroupV2Change } from './GroupV2Change'; | 
					
						
							|  |  |  | import type { PropsDataType as GroupV1MigrationProps } from './GroupV1Migration'; | 
					
						
							|  |  |  | import { GroupV1Migration } from './GroupV1Migration'; | 
					
						
							|  |  |  | import type { SmartContactRendererType } from '../../groupChange'; | 
					
						
							| 
									
										
										
										
											2019-03-20 10:42:28 -07:00
										 |  |  | import { ResetSessionNotification } from './ResetSessionNotification'; | 
					
						
							| 
									
										
										
										
											2021-10-26 14:15:33 -05:00
										 |  |  | import type { PropsType as ProfileChangeNotificationPropsType } from './ProfileChangeNotification'; | 
					
						
							|  |  |  | import { ProfileChangeNotification } from './ProfileChangeNotification'; | 
					
						
							| 
									
										
										
										
											2022-11-30 13:47:54 -08:00
										 |  |  | import type { PropsType as PaymentEventNotificationPropsType } from './PaymentEventNotification'; | 
					
						
							|  |  |  | import { PaymentEventNotification } from './PaymentEventNotification'; | 
					
						
							| 
									
										
										
										
											2022-12-05 14:46:54 -08:00
										 |  |  | import type { PropsDataType as ConversationMergeNotificationPropsType } from './ConversationMergeNotification'; | 
					
						
							|  |  |  | import { ConversationMergeNotification } from './ConversationMergeNotification'; | 
					
						
							| 
									
										
										
										
											2021-12-16 09:44:54 -08:00
										 |  |  | import type { FullJSXType } from '../Intl'; | 
					
						
							| 
									
										
										
										
											2022-11-04 07:22:07 -06:00
										 |  |  | import { TimelineMessage } from './TimelineMessage'; | 
					
						
							| 
									
										
										
										
											2019-03-20 10:42:28 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-04 11:16:19 -07:00
										 |  |  | type CallHistoryType = { | 
					
						
							|  |  |  |   type: 'callHistory'; | 
					
						
							| 
									
										
										
										
											2020-12-07 14:43:19 -06:00
										 |  |  |   data: CallingNotificationType; | 
					
						
							| 
									
										
										
										
											2020-06-04 11:16:19 -07:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2021-02-18 08:40:26 -08:00
										 |  |  | type ChatSessionRefreshedType = { | 
					
						
							|  |  |  |   type: 'chatSessionRefreshed'; | 
					
						
							|  |  |  |   data: null; | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2021-05-28 12:11:19 -07:00
										 |  |  | type DeliveryIssueType = { | 
					
						
							|  |  |  |   type: 'deliveryIssue'; | 
					
						
							|  |  |  |   data: DeliveryIssueProps; | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2019-03-20 10:42:28 -07:00
										 |  |  | type MessageType = { | 
					
						
							|  |  |  |   type: 'message'; | 
					
						
							| 
									
										
										
										
											2022-11-04 07:22:07 -06:00
										 |  |  |   data: TimelineMessageProps; | 
					
						
							| 
									
										
										
										
											2019-03-20 10:42:28 -07:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2019-05-31 15:42:01 -07:00
										 |  |  | type UnsupportedMessageType = { | 
					
						
							|  |  |  |   type: 'unsupportedMessage'; | 
					
						
							|  |  |  |   data: UnsupportedMessageProps; | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2019-03-20 10:42:28 -07:00
										 |  |  | type TimerNotificationType = { | 
					
						
							|  |  |  |   type: 'timerNotification'; | 
					
						
							|  |  |  |   data: TimerNotificationProps; | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2021-06-01 13:45:43 -07:00
										 |  |  | type UniversalTimerNotificationType = { | 
					
						
							|  |  |  |   type: 'universalTimerNotification'; | 
					
						
							|  |  |  |   data: null; | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2021-08-05 16:34:49 -07:00
										 |  |  | type ChangeNumberNotificationType = { | 
					
						
							|  |  |  |   type: 'changeNumberNotification'; | 
					
						
							|  |  |  |   data: ChangeNumberNotificationProps; | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2019-03-20 10:42:28 -07:00
										 |  |  | type SafetyNumberNotificationType = { | 
					
						
							|  |  |  |   type: 'safetyNumberNotification'; | 
					
						
							|  |  |  |   data: SafetyNumberNotificationProps; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | type VerificationNotificationType = { | 
					
						
							|  |  |  |   type: 'verificationNotification'; | 
					
						
							|  |  |  |   data: VerificationNotificationProps; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | type GroupNotificationType = { | 
					
						
							|  |  |  |   type: 'groupNotification'; | 
					
						
							|  |  |  |   data: GroupNotificationProps; | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2020-09-08 19:25:05 -07:00
										 |  |  | type GroupV2ChangeType = { | 
					
						
							|  |  |  |   type: 'groupV2Change'; | 
					
						
							|  |  |  |   data: GroupV2ChangeProps; | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2020-11-20 09:30:45 -08:00
										 |  |  | type GroupV1MigrationType = { | 
					
						
							|  |  |  |   type: 'groupV1Migration'; | 
					
						
							|  |  |  |   data: GroupV1MigrationProps; | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2019-03-20 10:42:28 -07:00
										 |  |  | type ResetSessionNotificationType = { | 
					
						
							|  |  |  |   type: 'resetSessionNotification'; | 
					
						
							|  |  |  |   data: null; | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2020-07-29 16:20:05 -07:00
										 |  |  | type ProfileChangeNotificationType = { | 
					
						
							|  |  |  |   type: 'profileChange'; | 
					
						
							|  |  |  |   data: ProfileChangeNotificationPropsType; | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2022-12-05 14:46:54 -08:00
										 |  |  | type ConversationMergeNotificationType = { | 
					
						
							|  |  |  |   type: 'conversationMerge'; | 
					
						
							|  |  |  |   data: ConversationMergeNotificationPropsType; | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2022-11-30 13:47:54 -08:00
										 |  |  | type PaymentEventType = { | 
					
						
							|  |  |  |   type: 'paymentEvent'; | 
					
						
							|  |  |  |   data: Omit<PaymentEventNotificationPropsType, 'i18n'>; | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2020-07-29 16:20:05 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-26 17:05:26 -06:00
										 |  |  | export type TimelineItemType = ( | 
					
						
							| 
									
										
										
										
											2020-06-04 11:16:19 -07:00
										 |  |  |   | CallHistoryType | 
					
						
							| 
									
										
										
										
											2022-12-05 14:46:54 -08:00
										 |  |  |   | ChangeNumberNotificationType | 
					
						
							| 
									
										
										
										
											2021-02-18 08:40:26 -08:00
										 |  |  |   | ChatSessionRefreshedType | 
					
						
							| 
									
										
										
										
											2022-12-05 14:46:54 -08:00
										 |  |  |   | ConversationMergeNotificationType | 
					
						
							| 
									
										
										
										
											2021-05-28 12:11:19 -07:00
										 |  |  |   | DeliveryIssueType | 
					
						
							| 
									
										
										
										
											2020-07-29 16:20:05 -07:00
										 |  |  |   | GroupNotificationType | 
					
						
							| 
									
										
										
										
											2020-11-20 09:30:45 -08:00
										 |  |  |   | GroupV1MigrationType | 
					
						
							| 
									
										
										
										
											2020-09-08 19:25:05 -07:00
										 |  |  |   | GroupV2ChangeType | 
					
						
							| 
									
										
										
										
											2019-05-31 15:42:01 -07:00
										 |  |  |   | MessageType | 
					
						
							| 
									
										
										
										
											2020-07-29 16:20:05 -07:00
										 |  |  |   | ProfileChangeNotificationType | 
					
						
							| 
									
										
										
										
											2020-03-09 17:43:09 -07:00
										 |  |  |   | ResetSessionNotificationType | 
					
						
							| 
									
										
										
										
											2019-05-31 15:42:01 -07:00
										 |  |  |   | SafetyNumberNotificationType | 
					
						
							| 
									
										
										
										
											2020-03-09 17:43:09 -07:00
										 |  |  |   | TimerNotificationType | 
					
						
							| 
									
										
										
										
											2021-06-01 13:45:43 -07:00
										 |  |  |   | UniversalTimerNotificationType | 
					
						
							| 
									
										
										
										
											2020-03-09 17:43:09 -07:00
										 |  |  |   | UnsupportedMessageType | 
					
						
							| 
									
										
										
										
											2022-01-26 17:05:26 -06:00
										 |  |  |   | VerificationNotificationType | 
					
						
							| 
									
										
										
										
											2022-11-30 13:47:54 -08:00
										 |  |  |   | PaymentEventType | 
					
						
							| 
									
										
										
										
											2022-01-26 17:05:26 -06:00
										 |  |  | ) & { timestamp: number }; | 
					
						
							| 
									
										
										
										
											2019-03-20 10:42:28 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-07 13:36:16 -08:00
										 |  |  | type PropsLocalType = { | 
					
						
							| 
									
										
										
										
											2021-08-20 14:36:27 -05:00
										 |  |  |   containerElementRef: RefObject<HTMLElement>; | 
					
						
							| 
									
										
										
										
											2019-11-07 13:36:16 -08:00
										 |  |  |   conversationId: string; | 
					
						
							| 
									
										
										
										
											2019-05-31 15:42:01 -07:00
										 |  |  |   item?: TimelineItemType; | 
					
						
							| 
									
										
										
										
											2019-11-07 13:36:16 -08:00
										 |  |  |   id: string; | 
					
						
							| 
									
										
										
										
											2022-03-28 15:55:12 -07:00
										 |  |  |   isNextItemCallingNotification: boolean; | 
					
						
							| 
									
										
										
										
											2019-11-07 13:36:16 -08:00
										 |  |  |   isSelected: boolean; | 
					
						
							|  |  |  |   selectMessage: (messageId: string, conversationId: string) => unknown; | 
					
						
							| 
									
										
										
										
											2022-03-28 15:55:12 -07:00
										 |  |  |   shouldRenderDateHeader: boolean; | 
					
						
							| 
									
										
										
										
											2021-12-16 09:44:54 -08:00
										 |  |  |   renderContact: SmartContactRendererType<FullJSXType>; | 
					
						
							| 
									
										
										
										
											2021-06-01 13:45:43 -07:00
										 |  |  |   renderUniversalTimerNotification: () => JSX.Element; | 
					
						
							| 
									
										
										
										
											2019-03-20 10:42:28 -07:00
										 |  |  |   i18n: LocalizerType; | 
					
						
							| 
									
										
										
										
											2021-03-24 17:06:12 -05:00
										 |  |  |   interactionMode: InteractionModeType; | 
					
						
							| 
									
										
										
										
											2021-11-15 16:53:42 -06:00
										 |  |  |   theme: ThemeType; | 
					
						
							| 
									
										
										
										
											2019-03-20 10:42:28 -07:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-07 13:36:16 -08:00
										 |  |  | type PropsActionsType = MessageActionsType & | 
					
						
							| 
									
										
										
										
											2020-12-07 14:43:19 -06:00
										 |  |  |   CallingNotificationActionsType & | 
					
						
							| 
									
										
										
										
											2022-03-15 17:11:28 -07:00
										 |  |  |   GroupV2ChangeActionsType & | 
					
						
							| 
									
										
										
										
											2019-05-31 15:42:01 -07:00
										 |  |  |   SafetyNumberActionsType; | 
					
						
							| 
									
										
										
										
											2019-03-20 10:42:28 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-05 15:49:34 -04:00
										 |  |  | export type PropsType = PropsLocalType & | 
					
						
							|  |  |  |   PropsActionsType & | 
					
						
							| 
									
										
										
										
											2021-09-10 13:00:31 -05:00
										 |  |  |   Pick< | 
					
						
							|  |  |  |     AllMessageProps, | 
					
						
							| 
									
										
										
										
											2021-10-12 18:59:08 -05:00
										 |  |  |     | 'containerWidthBreakpoint' | 
					
						
							| 
									
										
										
										
											2021-11-17 15:11:46 -06:00
										 |  |  |     | 'getPreferredBadge' | 
					
						
							| 
									
										
										
										
											2021-10-12 18:59:08 -05:00
										 |  |  |     | 'renderEmojiPicker' | 
					
						
							|  |  |  |     | 'renderAudioAttachment' | 
					
						
							|  |  |  |     | 'renderReactionPicker' | 
					
						
							| 
									
										
										
										
											2022-03-28 15:55:12 -07:00
										 |  |  |     | 'shouldCollapseAbove' | 
					
						
							|  |  |  |     | 'shouldCollapseBelow' | 
					
						
							|  |  |  |     | 'shouldHideMetadata' | 
					
						
							| 
									
										
										
										
											2021-09-10 13:00:31 -05:00
										 |  |  |   >; | 
					
						
							| 
									
										
										
										
											2019-03-20 10:42:28 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-07 13:36:16 -08:00
										 |  |  | export class TimelineItem extends React.PureComponent<PropsType> { | 
					
						
							| 
									
										
										
										
											2021-11-12 17:44:20 -06:00
										 |  |  |   public override render(): JSX.Element | null { | 
					
						
							| 
									
										
										
										
											2019-11-07 13:36:16 -08:00
										 |  |  |     const { | 
					
						
							| 
									
										
										
										
											2021-08-20 14:36:27 -05:00
										 |  |  |       containerElementRef, | 
					
						
							| 
									
										
										
										
											2019-11-07 13:36:16 -08:00
										 |  |  |       conversationId, | 
					
						
							| 
									
										
										
										
											2021-11-17 15:11:46 -06:00
										 |  |  |       getPreferredBadge, | 
					
						
							| 
									
										
										
										
											2022-03-28 15:55:12 -07:00
										 |  |  |       i18n, | 
					
						
							| 
									
										
										
										
											2019-11-07 13:36:16 -08:00
										 |  |  |       id, | 
					
						
							| 
									
										
										
										
											2022-03-28 15:55:12 -07:00
										 |  |  |       isNextItemCallingNotification, | 
					
						
							| 
									
										
										
										
											2019-11-07 13:36:16 -08:00
										 |  |  |       isSelected, | 
					
						
							|  |  |  |       item, | 
					
						
							| 
									
										
										
										
											2021-06-01 13:45:43 -07:00
										 |  |  |       renderUniversalTimerNotification, | 
					
						
							| 
									
										
										
										
											2020-12-07 14:43:19 -06:00
										 |  |  |       returnToActiveCall, | 
					
						
							| 
									
										
										
										
											2019-11-07 13:36:16 -08:00
										 |  |  |       selectMessage, | 
					
						
							| 
									
										
										
										
											2022-03-28 15:55:12 -07:00
										 |  |  |       shouldCollapseAbove, | 
					
						
							|  |  |  |       shouldCollapseBelow, | 
					
						
							|  |  |  |       shouldHideMetadata, | 
					
						
							|  |  |  |       shouldRenderDateHeader, | 
					
						
							| 
									
										
										
										
											2020-12-07 14:43:19 -06:00
										 |  |  |       startCallingLobby, | 
					
						
							| 
									
										
										
										
											2022-03-28 15:55:12 -07:00
										 |  |  |       theme, | 
					
						
							| 
									
										
										
										
											2022-12-19 14:33:55 -08:00
										 |  |  |       ...reducedProps | 
					
						
							| 
									
										
										
										
											2019-11-07 13:36:16 -08:00
										 |  |  |     } = this.props; | 
					
						
							| 
									
										
										
										
											2019-03-20 10:42:28 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |     if (!item) { | 
					
						
							| 
									
										
										
										
											2022-03-03 14:23:10 -06:00
										 |  |  |       // This can happen under normal conditions.
 | 
					
						
							|  |  |  |       //
 | 
					
						
							|  |  |  |       // `<Timeline>` and `<TimelineItem>` are connected to Redux separately. If a
 | 
					
						
							|  |  |  |       //   timeline item is removed from Redux, `<TimelineItem>` might re-render before
 | 
					
						
							|  |  |  |       //   `<Timeline>` does, which means we'll try to render nothing. This should resolve
 | 
					
						
							|  |  |  |       //   itself quickly, as soon as `<Timeline>` re-renders.
 | 
					
						
							| 
									
										
										
										
											2019-05-31 15:42:01 -07:00
										 |  |  |       return null; | 
					
						
							| 
									
										
										
										
											2019-03-20 10:42:28 -07:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-26 17:05:26 -06:00
										 |  |  |     let itemContents: ReactChild; | 
					
						
							| 
									
										
										
										
											2019-03-20 10:42:28 -07:00
										 |  |  |     if (item.type === 'message') { | 
					
						
							| 
									
										
										
										
											2022-01-26 17:05:26 -06:00
										 |  |  |       itemContents = ( | 
					
						
							| 
									
										
										
										
											2022-11-04 07:22:07 -06:00
										 |  |  |         <TimelineMessage | 
					
						
							| 
									
										
										
										
											2022-12-19 14:33:55 -08:00
										 |  |  |           {...reducedProps} | 
					
						
							| 
									
										
										
										
											2021-06-29 12:58:29 -07:00
										 |  |  |           {...item.data} | 
					
						
							| 
									
										
										
										
											2022-12-02 19:40:33 -05:00
										 |  |  |           isSelected={isSelected} | 
					
						
							| 
									
										
										
										
											2023-01-19 17:59:58 -05:00
										 |  |  |           selectMessage={selectMessage} | 
					
						
							| 
									
										
										
										
											2022-03-28 15:55:12 -07:00
										 |  |  |           shouldCollapseAbove={shouldCollapseAbove} | 
					
						
							|  |  |  |           shouldCollapseBelow={shouldCollapseBelow} | 
					
						
							|  |  |  |           shouldHideMetadata={shouldHideMetadata} | 
					
						
							| 
									
										
										
										
											2021-08-20 14:36:27 -05:00
										 |  |  |           containerElementRef={containerElementRef} | 
					
						
							| 
									
										
										
										
											2021-11-17 15:11:46 -06:00
										 |  |  |           getPreferredBadge={getPreferredBadge} | 
					
						
							| 
									
										
										
										
											2021-06-29 12:58:29 -07:00
										 |  |  |           i18n={i18n} | 
					
						
							|  |  |  |           theme={theme} | 
					
						
							|  |  |  |         /> | 
					
						
							| 
									
										
										
										
											2021-02-11 20:50:11 -05:00
										 |  |  |       ); | 
					
						
							| 
									
										
										
										
											2022-01-26 17:05:26 -06:00
										 |  |  |     } else { | 
					
						
							|  |  |  |       let notification; | 
					
						
							| 
									
										
										
										
											2019-11-07 13:36:16 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-26 17:05:26 -06:00
										 |  |  |       if (item.type === 'unsupportedMessage') { | 
					
						
							|  |  |  |         notification = ( | 
					
						
							| 
									
										
										
										
											2022-12-19 14:33:55 -08:00
										 |  |  |           <UnsupportedMessage {...reducedProps} {...item.data} i18n={i18n} /> | 
					
						
							| 
									
										
										
										
											2022-01-26 17:05:26 -06:00
										 |  |  |         ); | 
					
						
							|  |  |  |       } else if (item.type === 'callHistory') { | 
					
						
							|  |  |  |         notification = ( | 
					
						
							|  |  |  |           <CallingNotification | 
					
						
							|  |  |  |             conversationId={conversationId} | 
					
						
							|  |  |  |             i18n={i18n} | 
					
						
							| 
									
										
										
										
											2022-03-28 15:55:12 -07:00
										 |  |  |             isNextItemCallingNotification={isNextItemCallingNotification} | 
					
						
							| 
									
										
										
										
											2022-01-26 17:05:26 -06:00
										 |  |  |             returnToActiveCall={returnToActiveCall} | 
					
						
							|  |  |  |             startCallingLobby={startCallingLobby} | 
					
						
							|  |  |  |             {...item.data} | 
					
						
							|  |  |  |           /> | 
					
						
							|  |  |  |         ); | 
					
						
							|  |  |  |       } else if (item.type === 'chatSessionRefreshed') { | 
					
						
							|  |  |  |         notification = ( | 
					
						
							| 
									
										
										
										
											2022-12-19 14:33:55 -08:00
										 |  |  |           <ChatSessionRefreshedNotification {...reducedProps} i18n={i18n} /> | 
					
						
							| 
									
										
										
										
											2022-01-26 17:05:26 -06:00
										 |  |  |         ); | 
					
						
							|  |  |  |       } else if (item.type === 'deliveryIssue') { | 
					
						
							|  |  |  |         notification = ( | 
					
						
							|  |  |  |           <DeliveryIssueNotification | 
					
						
							|  |  |  |             {...item.data} | 
					
						
							| 
									
										
										
										
											2022-12-19 14:33:55 -08:00
										 |  |  |             {...reducedProps} | 
					
						
							| 
									
										
										
										
											2022-01-26 17:05:26 -06:00
										 |  |  |             i18n={i18n} | 
					
						
							|  |  |  |           /> | 
					
						
							|  |  |  |         ); | 
					
						
							|  |  |  |       } else if (item.type === 'timerNotification') { | 
					
						
							|  |  |  |         notification = ( | 
					
						
							| 
									
										
										
										
											2022-12-19 14:33:55 -08:00
										 |  |  |           <TimerNotification {...reducedProps} {...item.data} i18n={i18n} /> | 
					
						
							| 
									
										
										
										
											2022-01-26 17:05:26 -06:00
										 |  |  |         ); | 
					
						
							|  |  |  |       } else if (item.type === 'universalTimerNotification') { | 
					
						
							|  |  |  |         notification = renderUniversalTimerNotification(); | 
					
						
							|  |  |  |       } else if (item.type === 'changeNumberNotification') { | 
					
						
							|  |  |  |         notification = ( | 
					
						
							|  |  |  |           <ChangeNumberNotification | 
					
						
							| 
									
										
										
										
											2022-12-19 14:33:55 -08:00
										 |  |  |             {...reducedProps} | 
					
						
							| 
									
										
										
										
											2022-01-26 17:05:26 -06:00
										 |  |  |             {...item.data} | 
					
						
							|  |  |  |             i18n={i18n} | 
					
						
							|  |  |  |           /> | 
					
						
							|  |  |  |         ); | 
					
						
							|  |  |  |       } else if (item.type === 'safetyNumberNotification') { | 
					
						
							|  |  |  |         notification = ( | 
					
						
							|  |  |  |           <SafetyNumberNotification | 
					
						
							| 
									
										
										
										
											2022-12-19 14:33:55 -08:00
										 |  |  |             {...reducedProps} | 
					
						
							| 
									
										
										
										
											2022-01-26 17:05:26 -06:00
										 |  |  |             {...item.data} | 
					
						
							|  |  |  |             i18n={i18n} | 
					
						
							|  |  |  |           /> | 
					
						
							|  |  |  |         ); | 
					
						
							|  |  |  |       } else if (item.type === 'verificationNotification') { | 
					
						
							|  |  |  |         notification = ( | 
					
						
							|  |  |  |           <VerificationNotification | 
					
						
							| 
									
										
										
										
											2022-12-19 14:33:55 -08:00
										 |  |  |             {...reducedProps} | 
					
						
							| 
									
										
										
										
											2022-01-26 17:05:26 -06:00
										 |  |  |             {...item.data} | 
					
						
							|  |  |  |             i18n={i18n} | 
					
						
							|  |  |  |           /> | 
					
						
							|  |  |  |         ); | 
					
						
							|  |  |  |       } else if (item.type === 'groupNotification') { | 
					
						
							|  |  |  |         notification = ( | 
					
						
							| 
									
										
										
										
											2022-12-19 14:33:55 -08:00
										 |  |  |           <GroupNotification {...reducedProps} {...item.data} i18n={i18n} /> | 
					
						
							| 
									
										
										
										
											2022-01-26 17:05:26 -06:00
										 |  |  |         ); | 
					
						
							|  |  |  |       } else if (item.type === 'groupV2Change') { | 
					
						
							|  |  |  |         notification = ( | 
					
						
							| 
									
										
										
										
											2022-12-19 14:33:55 -08:00
										 |  |  |           <GroupV2Change {...reducedProps} {...item.data} i18n={i18n} /> | 
					
						
							| 
									
										
										
										
											2022-01-26 17:05:26 -06:00
										 |  |  |         ); | 
					
						
							|  |  |  |       } else if (item.type === 'groupV1Migration') { | 
					
						
							|  |  |  |         notification = ( | 
					
						
							| 
									
										
										
										
											2022-12-19 14:33:55 -08:00
										 |  |  |           <GroupV1Migration | 
					
						
							|  |  |  |             {...reducedProps} | 
					
						
							|  |  |  |             {...item.data} | 
					
						
							|  |  |  |             i18n={i18n} | 
					
						
							|  |  |  |             getPreferredBadge={getPreferredBadge} | 
					
						
							|  |  |  |             theme={theme} | 
					
						
							|  |  |  |           /> | 
					
						
							| 
									
										
										
										
											2022-01-26 17:05:26 -06:00
										 |  |  |         ); | 
					
						
							| 
									
										
										
										
											2022-12-05 14:46:54 -08:00
										 |  |  |       } else if (item.type === 'conversationMerge') { | 
					
						
							|  |  |  |         notification = ( | 
					
						
							|  |  |  |           <ConversationMergeNotification | 
					
						
							| 
									
										
										
										
											2022-12-19 14:33:55 -08:00
										 |  |  |             {...reducedProps} | 
					
						
							| 
									
										
										
										
											2022-12-05 14:46:54 -08:00
										 |  |  |             {...item.data} | 
					
						
							|  |  |  |             i18n={i18n} | 
					
						
							|  |  |  |           /> | 
					
						
							|  |  |  |         ); | 
					
						
							| 
									
										
										
										
											2022-01-26 17:05:26 -06:00
										 |  |  |       } else if (item.type === 'resetSessionNotification') { | 
					
						
							| 
									
										
										
										
											2022-12-19 14:33:55 -08:00
										 |  |  |         notification = ( | 
					
						
							|  |  |  |           <ResetSessionNotification {...reducedProps} i18n={i18n} /> | 
					
						
							|  |  |  |         ); | 
					
						
							| 
									
										
										
										
											2022-01-26 17:05:26 -06:00
										 |  |  |       } else if (item.type === 'profileChange') { | 
					
						
							|  |  |  |         notification = ( | 
					
						
							|  |  |  |           <ProfileChangeNotification | 
					
						
							| 
									
										
										
										
											2022-12-19 14:33:55 -08:00
										 |  |  |             {...reducedProps} | 
					
						
							| 
									
										
										
										
											2022-11-30 13:47:54 -08:00
										 |  |  |             {...item.data} | 
					
						
							|  |  |  |             i18n={i18n} | 
					
						
							|  |  |  |           /> | 
					
						
							|  |  |  |         ); | 
					
						
							|  |  |  |       } else if (item.type === 'paymentEvent') { | 
					
						
							|  |  |  |         notification = ( | 
					
						
							|  |  |  |           <PaymentEventNotification | 
					
						
							| 
									
										
										
										
											2022-12-19 14:33:55 -08:00
										 |  |  |             {...reducedProps} | 
					
						
							| 
									
										
										
										
											2022-01-26 17:05:26 -06:00
										 |  |  |             {...item.data} | 
					
						
							|  |  |  |             i18n={i18n} | 
					
						
							|  |  |  |           /> | 
					
						
							|  |  |  |         ); | 
					
						
							|  |  |  |       } else { | 
					
						
							|  |  |  |         // Weird, yes, but the idea is to get a compile error when we aren't comprehensive
 | 
					
						
							|  |  |  |         //   with our if/else checks above, but also log out the type we don't understand
 | 
					
						
							|  |  |  |         //   if we encounter it at runtime.
 | 
					
						
							|  |  |  |         const unknownItem: never = item; | 
					
						
							|  |  |  |         const asItem = unknownItem as TimelineItemType; | 
					
						
							|  |  |  |         throw new Error(`TimelineItem: Unknown type: ${asItem.type}`); | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2019-11-07 13:36:16 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-26 17:05:26 -06:00
										 |  |  |       itemContents = ( | 
					
						
							|  |  |  |         <InlineNotificationWrapper | 
					
						
							|  |  |  |           id={id} | 
					
						
							| 
									
										
										
										
											2020-12-07 14:43:19 -06:00
										 |  |  |           conversationId={conversationId} | 
					
						
							| 
									
										
										
										
											2022-01-26 17:05:26 -06:00
										 |  |  |           isSelected={isSelected} | 
					
						
							|  |  |  |           selectMessage={selectMessage} | 
					
						
							|  |  |  |         > | 
					
						
							|  |  |  |           {notification} | 
					
						
							|  |  |  |         </InlineNotificationWrapper> | 
					
						
							| 
									
										
										
										
											2021-08-05 16:34:49 -07:00
										 |  |  |       ); | 
					
						
							| 
									
										
										
										
											2022-01-26 17:05:26 -06:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (shouldRenderDateHeader) { | 
					
						
							|  |  |  |       return ( | 
					
						
							|  |  |  |         <> | 
					
						
							|  |  |  |           <TimelineDateHeader i18n={i18n} timestamp={item.timestamp} /> | 
					
						
							|  |  |  |           {itemContents} | 
					
						
							|  |  |  |         </> | 
					
						
							| 
									
										
										
										
											2020-07-29 16:20:05 -07:00
										 |  |  |       ); | 
					
						
							| 
									
										
										
										
											2019-03-20 10:42:28 -07:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-01-26 17:05:26 -06:00
										 |  |  |     return itemContents; | 
					
						
							| 
									
										
										
										
											2019-03-20 10:42:28 -07:00
										 |  |  |   } | 
					
						
							|  |  |  | } |