@marktiderman/genesis-chat 0.11.4 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +116 -3
  2. package/dist/{chunk-ZQFREERR.js → chunk-2HNQWDLF.js} +3 -3
  3. package/dist/{chunk-ZQFREERR.js.map → chunk-2HNQWDLF.js.map} +1 -1
  4. package/dist/{chunk-O2QSBRSH.js → chunk-3HQN2FZ5.js} +3 -3
  5. package/dist/{chunk-O2QSBRSH.js.map → chunk-3HQN2FZ5.js.map} +1 -1
  6. package/dist/{chunk-D4RPOYB7.js → chunk-K5GYNHNE.js} +61 -11
  7. package/dist/chunk-K5GYNHNE.js.map +1 -0
  8. package/dist/{chunk-5XYDVUPS.js → chunk-VBIYDXL2.js} +9 -3
  9. package/dist/chunk-VBIYDXL2.js.map +1 -0
  10. package/dist/{client-DP7rhJ1U.d.ts → client-DJs3ltZc.d.ts} +15 -0
  11. package/dist/index.d.ts +4 -4
  12. package/dist/index.js +3 -3
  13. package/dist/native.d.ts +339 -137
  14. package/dist/native.js +668 -192
  15. package/dist/native.js.map +1 -1
  16. package/dist/{outbox-C4LnqpKT.d.ts → outbox-YFTbGIAl.d.ts} +1 -1
  17. package/dist/push.d.ts +2 -2
  18. package/dist/react.d.ts +13 -5
  19. package/dist/react.js +3 -3
  20. package/dist/server.d.ts +1 -1
  21. package/dist/server.js +1 -1
  22. package/dist/{thread-CSzdqNR_.d.ts → thread-CgHP00Jw.d.ts} +1 -1
  23. package/dist/web.d.ts +3 -3
  24. package/dist/web.js +5 -5
  25. package/migrations/0006_genesis_chat_read_receipts.sql +110 -0
  26. package/migrations/tests/0006_genesis_chat_read_receipts.test.sql +131 -0
  27. package/package.json +7 -3
  28. package/src/core/client.ts +9 -0
  29. package/src/core/types.ts +7 -0
  30. package/src/native/__tests__/bubble-native-feel.test.tsx +153 -0
  31. package/src/native/__tests__/composer-attach-menu.test.tsx +47 -0
  32. package/src/native/__tests__/media-cache-key.test.tsx +21 -0
  33. package/src/native/__tests__/organise-screens.test.tsx +2 -0
  34. package/src/native/__tests__/receipts.test.ts +95 -0
  35. package/src/native/__tests__/review-lows.test.tsx +80 -0
  36. package/src/native/__tests__/sheets-fit.test.tsx +45 -0
  37. package/src/native/__tests__/stable-hooks.test.tsx +68 -0
  38. package/src/native/__tests__/thread-screen-audit.test.tsx +248 -0
  39. package/src/native/__tests__/thread-screen.test.tsx +111 -0
  40. package/src/native/__tests__/thread-title.test.tsx +59 -0
  41. package/src/native/composer.tsx +61 -26
  42. package/src/native/copy.ts +40 -0
  43. package/src/native/emoji-picker.tsx +1 -1
  44. package/src/native/index.ts +6 -1
  45. package/src/native/media.tsx +7 -1
  46. package/src/native/message-actions-sheet.tsx +1 -1
  47. package/src/native/message-bubble.tsx +171 -19
  48. package/src/native/modules.ts +3 -1
  49. package/src/native/receipts.ts +102 -0
  50. package/src/native/schedule-sheet.tsx +8 -3
  51. package/src/native/stack-options.ts +35 -3
  52. package/src/native/thread-screen.tsx +243 -17
  53. package/src/native/thread-times.tsx +89 -0
  54. package/src/native/thread-title.tsx +111 -0
  55. package/src/native/typing-bubble.tsx +85 -0
  56. package/src/react/index.tsx +74 -7
  57. package/dist/chunk-5XYDVUPS.js.map +0 -1
  58. package/dist/chunk-D4RPOYB7.js.map +0 -1
package/dist/native.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import * as react from 'react';
2
2
  import { ComponentType, ReactNode, ReactElement } from 'react';
3
3
  import { InboxPageProps, InboxItem, ScreenHeaderProps } from '@marktiderman/genesis-ui-native/layouts';
4
- import { m as ChatInboxItem, h as ChatAttachment, q as ChatMessage, k as ChatConversation, t as ChatRole, P as PendingFile, o as ChatLinkPreview, F as SendInput, x as ChatTopic, T as TopicInput, S as ScheduleInput, W as Weekday, C as ChatAvailability, d as AvailabilityInput, p as ChatMember, a as WorkingHours, u as ChatSearchHit } from './client-DP7rhJ1U.js';
4
+ import { m as ChatInboxItem, h as ChatAttachment, q as ChatMessage, p as ChatMember, k as ChatConversation, t as ChatRole, P as PendingFile, o as ChatLinkPreview, F as SendInput, x as ChatTopic, T as TopicInput, S as ScheduleInput, W as Weekday, C as ChatAvailability, d as AvailabilityInput, a as WorkingHours, u as ChatSearchHit } from './client-DJs3ltZc.js';
5
5
  import { ChatAttachmentKind, ChatCardContext, ChatVideoUpload } from './react.js';
6
- import { T as ThreadItem } from './thread-CSzdqNR_.js';
6
+ import { T as ThreadItem } from './thread-CgHP00Jw.js';
7
+ import { L as LocalFile } from './outbox-YFTbGIAl.js';
7
8
  import { ColorValue } from 'react-native';
8
- import { L as LocalFile } from './outbox-C4LnqpKT.js';
9
9
  import { lightboxPanLimit, lightboxPinchScale, lightboxShouldDismiss, NativeIconName } from '@marktiderman/genesis-ui-native/components';
10
10
  export { CHAT_MARK_READ_ACTION, CHAT_PUSH_CATEGORY, CHAT_REPLY_ACTION, ChatPushCopy, ChatPushData, ChatPushOutboxDeps, ChatPushOutcome, ChatPushPayload, ChatPushPayloadInput, ChatPushResponseLike, NotificationCategoriesLike, PUSH_REPLY_WAIT_MS, chatNotificationActions, chatPath, chatPushCategory, chatPushCopy, chatPushPayload, chatThreadMatch, conversationIdFromData, failedReply, handleChatPushResponse, registerChatNotificationActions, replyClientId, replyClientIdFor } from './push.js';
11
11
  import '@supabase/supabase-js';
@@ -138,6 +138,18 @@ interface ChatNativeCopy extends ChatOrganiseCopy {
138
138
  archive: string;
139
139
  threadEmptyTitle: string;
140
140
  threadEmptyBody: string;
141
+ /** The conversation or its first page couldn't be read, and there's nothing to show. */
142
+ threadErrorTitle: string;
143
+ threadErrorBody: string;
144
+ /** The phone is offline (NetInfo), in the thread's status line. */
145
+ waitingForNetwork: string;
146
+ /** Online, but the live channel hasn't joined (yet, or again). */
147
+ connecting: string;
148
+ /** The pill over the composer when new messages came in below where you are. */
149
+ newMessagesPillOne: string;
150
+ newMessagesPill: string;
151
+ /** VoiceOver's hint on the pill. */
152
+ newMessagesPillHint: string;
141
153
  loadEarlier: string;
142
154
  newMessages: string;
143
155
  placeholder: string;
@@ -237,6 +249,18 @@ interface ChatNativeCopy extends ChatOrganiseCopy {
237
249
  viewerHint: string;
238
250
  sending: string;
239
251
  notSent: string;
252
+ /** Message status under the last message you sent (`ChatThreadScreen receipts`). */
253
+ receiptSending: string;
254
+ receiptSent: string;
255
+ receiptDelivered: string;
256
+ /** Read, when the server has no read time (a database before chat 0006). */
257
+ receiptRead: string;
258
+ receiptReadAt: string;
259
+ receiptReadBy: string;
260
+ receiptReadByEveryone: string;
261
+ /** The hint on "Read by N", and the title of the sheet it opens. */
262
+ receiptReadersHint: string;
263
+ receiptReadersTitle: string;
240
264
  retry: string;
241
265
  /** On a message whose file didn't survive a relaunch: pick it again. */
242
266
  attachAgain: string;
@@ -560,7 +584,7 @@ interface ChatNativeModules {
560
584
  /** Reads a recording a chunk at a time for a hosted upload; without it the file is read whole. */
561
585
  openFile?: (uri: string) => Promise<ChunkFileLike> | ChunkFileLike;
562
586
  }
563
- type HapticEvent = "send" | "record-start" | "record-lock" | "record-cancel" | "select" | "error";
587
+ type HapticEvent = "send" | "record-start" | "record-lock" | "record-cancel" | "select" | "long-press" | "error";
564
588
  /** Plays a haptic when the app gave expo-haptics; never throws. */
565
589
  declare function haptic(haptics: HapticsLike | undefined, event: HapticEvent): void;
566
590
 
@@ -841,128 +865,59 @@ declare function useJumpToMessage({ target, rows, loading, has, loadUntil, scrol
841
865
  jumping: boolean;
842
866
  };
843
867
 
844
- interface ChatThreadScreenProps {
845
- conversationId: string;
846
- /** One thread's replies instead of the main timeline. */
847
- threadRootId?: string | null;
848
- /**
849
- * Points from the top of the screen to the top of this view, for keeping the composer above the
850
- * keyboard. Measured from the screen's own position when left out (under an opaque header it is
851
- * the header's bottom).
852
- */
853
- keyboardVerticalOffset?: number;
854
- /** Open at this message (a search result's `messageId` and `seq`): earlier pages load until it is held. */
855
- jumpTo?: JumpTarget | null;
856
- /** Only this topic's messages, with no topic bar. */
857
- topic?: string;
858
- /** Show the topic bar before the first topic exists, so an owner or admin can add one. */
859
- showTopics?: boolean;
860
- /** Scheduled send (touch and hold Send) and the scheduled list. Default true. */
861
- scheduling?: boolean;
862
- /** The away line under the header. Default true. */
863
- availability?: boolean;
864
- /** An app attachment card's button (a form, a check-in), when its kind gives no `onPress`. */
865
- onOpenAttachment?: OpenAttachment;
866
- /**
867
- * Swap parts, as the web `ChatThread` does. `attachment` draws the app's own attachment kinds
868
- * (a task with a checkbox): every kind the package doesn't draw, with `fallback` for the card it
869
- * would have been; `null` hides kinds that aren't registered. Define it at module scope.
870
- */
871
- slots?: ChatThreadScreenSlots;
872
- /** How long an app card's action may run before it reads as failed; 30 s by default, 0 for never. */
873
- cardActionTimeoutMs?: number;
874
- /**
875
- * Whether the screen is the one shown (the navigator's `useIsFocused()`). When it turns false a
876
- * video or voice note of this thread that is playing pauses: switching tab keeps the screen
877
- * mounted. Default true.
878
- */
879
- focused?: boolean;
880
- testID?: string;
881
- }
882
- interface ChatThreadScreenSlots {
883
- /** Draws the app's own attachment kinds; the card by default. */
884
- attachment?: ChatAttachmentSlot | null;
885
- }
886
- /**
887
- * Points from the bottom that still count as "at the bottom" (FlatList, which follows by hand).
888
- * @deprecated Use genesis-ui-native's `THREAD_AT_BOTTOM_POINTS`. ChatThreadScreen is on NativeThreadList; this copy is removed in a later minor.
889
- */
890
- declare const AT_BOTTOM_POINTS = 120;
891
- /**
892
- * How the thread's list is set up, oldest first and not inverted. FlashList:
893
- * its chat mode (opens at the bottom, follows new rows while within a fifth of
894
- * a screen of it, keeps the first visible row in place when earlier ones load
895
- * at the top). FlatList: keeps its place when earlier rows load at the top;
896
- * the screen follows new rows itself (`followsByHand`).
897
- * @deprecated Use genesis-ui-native's `threadListMode` (which anchors FlatList past the header, `minIndexForVisible: 1`). ChatThreadScreen is on NativeThreadList; this copy is removed in a later minor.
898
- */
899
- declare function threadListMode(flash: boolean, reducedMotion: boolean): {
900
- followsByHand: boolean;
901
- maintainVisibleContentPosition: Record<string, unknown>;
902
- };
903
- /**
904
- * Whether a scroll position is at (or near) the bottom of its content.
905
- * @deprecated Use genesis-ui-native's `threadNearBottom`. ChatThreadScreen is on NativeThreadList; this copy is removed in a later minor.
906
- */
907
- declare function nearBottom(m: {
908
- contentOffset: {
909
- y: number;
910
- };
911
- contentSize: {
912
- height: number;
913
- };
914
- layoutMeasurement: {
915
- height: number;
916
- };
917
- }, slack?: number): boolean;
918
- declare function ChatThreadScreen(props: ChatThreadScreenProps): react.JSX.Element;
919
-
920
868
  /**
921
869
  * @feat:chat
922
- * `<Stack.Screen options>` for a screen that renders `ChatThreadScreen`.
870
+ * Message status, the way iMessage shows it: under the last message you sent, "Sending…",
871
+ * "Sent", "Delivered", then "Read 9:41" in a direct conversation or "Read by 2" / "Read by
872
+ * everyone" in a group. A send that failed shows nothing here: its bubble keeps the failure,
873
+ * Retry and Delete.
923
874
  *
924
- * The bar is opaque. It was made so while the thread was an inverted list
925
- * (`transform: scaleY(-1)` on the scroll view), which it no longer is; it
926
- * stays opaque until a see-through bar is checked over the upright list. On
927
- * iOS 26 and later the navigation bar is see-through and draws a scroll
928
- * edge effect over the content scroll view under it; UIKit lays that effect
929
- * out in the flipped scroll view's own coordinates, so once the thread is
930
- * long enough to reach the bar the whole list renders blurred. An opaque bar
931
- * keeps the screen's content below it: nothing scrolls under the bar, and no
932
- * edge effect is drawn over the flipped list. Seen on iOS 27 with FlashList
933
- * and with FlatList.
875
+ * - Sending: still in the outbox, not yet posted.
876
+ * - Sent: posted, but the outbox still holds it (a video's bytes are still going up).
877
+ * - Delivered: the server has it (it has a seq) and nobody else has read that far.
878
+ * - Read: the other member's `lastReadSeq` has reached its seq, with their `lastReadAt` (chat
879
+ * migration 0006) as the time; without it, "Read" with no time.
880
+ * - Read by N: in a group, the other members whose `lastReadSeq` has reached it.
934
881
  */
935
882
 
936
- type ChatThreadStackOptionsProps = ScreenHeaderProps & {
937
- headerTitle?: string;
883
+ /** Whether the thread shows message status (`ChatThreadScreen receipts`). */
884
+ type ChatReceiptsMode = "show" | "hide";
885
+ type MessageReceipt = {
886
+ state: "sending";
887
+ } | {
888
+ state: "sent";
889
+ } | {
890
+ state: "delivered";
891
+ } | {
892
+ state: "read";
893
+ at: string | null;
894
+ } | {
895
+ state: "read-by";
896
+ readers: string[];
897
+ everyone: boolean;
938
898
  };
939
- /** The thread's header options with an opaque bar in `background` (the thread's own background). */
940
- declare function chatThreadStackOptions(props: ChatThreadStackOptionsProps, background: ColorValue): Record<string, unknown>;
941
- /** `chatThreadStackOptions` in the theme's grouped background, the color `ChatThreadScreen` draws. */
942
- declare function useChatThreadStackOptions(props: ChatThreadStackOptionsProps): Record<string, unknown>;
943
-
944
- interface ChatStartPerson {
945
- userId: string;
946
- name: string;
947
- avatarUrl?: string | null;
948
- /** A second line ("Coach", "Team"). */
949
- subtitle?: string;
950
- }
951
- interface ChatStartSheetProps {
952
- open: boolean;
953
- onClose: () => void;
954
- people: ChatStartPerson[];
955
- /** Default `direct`. */
956
- kind?: string;
957
- onStarted: (conversationId: string) => void;
958
- testID?: string;
899
+ interface MessageReceiptFor {
900
+ /** The row it goes under (`rowKey`). */
901
+ key: string;
902
+ receipt: MessageReceipt;
959
903
  }
960
- declare function ChatStartSheet({ open, onClose, people, kind, onStarted, testID }: ChatStartSheetProps): react.JSX.Element;
961
- /** A 44pt compose button for the inbox's header (`headerRight`). */
962
- declare function ChatStartButton({ onPress, testID }: {
963
- onPress: () => void;
964
- testID?: string;
965
- }): react.JSX.Element;
904
+ interface ReceiptOptions {
905
+ me: string;
906
+ /** The conversation's members (observers aren't counted). */
907
+ members: readonly ChatMember[];
908
+ /** More than two people: "Read by N" instead of "Read". */
909
+ group: boolean;
910
+ /** Client ids the outbox still holds. */
911
+ queued?: ReadonlySet<string>;
912
+ receipts?: ChatReceiptsMode;
913
+ }
914
+ /** The status of the last message you sent, and the row it goes under; null when there is none to show. */
915
+ declare function lastSentReceipt(items: readonly ThreadItem[], options: ReceiptOptions): MessageReceiptFor | null;
916
+ /** When it was read: the time today, else the day ("Yesterday", "Monday", "12 Mar"). */
917
+ declare function readWhen(at: string, now?: Date, locale?: string): string;
918
+ type ReceiptCopy = Pick<ChatNativeCopy, "receiptSending" | "receiptSent" | "receiptDelivered" | "receiptRead" | "receiptReadAt" | "receiptReadBy" | "receiptReadByEveryone">;
919
+ /** What the line under the message says. */
920
+ declare function receiptText(receipt: MessageReceipt, copy: ReceiptCopy, now?: Date, locale?: string): string;
966
921
 
967
922
  /** A file in the composer, shown as a thumbnail until it is sent. */
968
923
  interface ComposerAttachment {
@@ -1095,27 +1050,145 @@ declare function useChatComposer(conversationId: string, threadRootId: string |
1095
1050
  };
1096
1051
  type ChatComposerHandle = ReturnType<typeof useChatComposer>;
1097
1052
 
1098
- interface ChatComposerProps {
1053
+ interface ChatThreadScreenProps {
1054
+ conversationId: string;
1055
+ /** One thread's replies instead of the main timeline. */
1056
+ threadRootId?: string | null;
1057
+ /**
1058
+ * Points from the top of the screen to the top of this view, for keeping the composer above the
1059
+ * keyboard. Measured from the screen's own position when left out (under an opaque header it is
1060
+ * the header's bottom).
1061
+ */
1062
+ keyboardVerticalOffset?: number;
1063
+ /** Open at this message (a search result's `messageId` and `seq`): earlier pages load until it is held. */
1064
+ jumpTo?: JumpTarget | null;
1065
+ /** Only this topic's messages, with no topic bar. */
1066
+ topic?: string;
1067
+ /** Show the topic bar before the first topic exists, so an owner or admin can add one. */
1068
+ showTopics?: boolean;
1069
+ /** Scheduled send (touch and hold Send) and the scheduled list. Default true. */
1070
+ scheduling?: boolean;
1071
+ /** The away line under the header. Default true. */
1072
+ availability?: boolean;
1073
+ /** An app attachment card's button (a form, a check-in), when its kind gives no `onPress`. */
1074
+ onOpenAttachment?: OpenAttachment;
1075
+ /**
1076
+ * Swap parts, as the web `ChatThread` does. `attachment` draws the app's own attachment kinds
1077
+ * (a task with a checkbox): every kind the package doesn't draw, with `fallback` for the card it
1078
+ * would have been; `null` hides kinds that aren't registered. Define it at module scope.
1079
+ */
1080
+ slots?: ChatThreadScreenSlots;
1081
+ /** How long an app card's action may run before it reads as failed; 30 s by default, 0 for never. */
1082
+ cardActionTimeoutMs?: number;
1083
+ /**
1084
+ * Whether the screen is the one shown (the navigator's `useIsFocused()`). When it turns false a
1085
+ * video or voice note of this thread that is playing pauses: switching tab keeps the screen
1086
+ * mounted. Default true.
1087
+ */
1088
+ focused?: boolean;
1089
+ /**
1090
+ * Message status under the last message you sent: "Sending…", "Sent", "Delivered", then "Read
1091
+ * 9:41" in a direct conversation or "Read by 2" (a button: who has read it) in a group. "hide"
1092
+ * leaves it out. Default "show".
1093
+ */
1094
+ receipts?: ChatReceiptsMode;
1095
+ /**
1096
+ * Whether this thread is the one being read. False keeps it mounted (a tab, a split view's other
1097
+ * pane) without marking it read, and pauses what it plays, as `focused` does; turning true marks
1098
+ * it read again. Default true.
1099
+ */
1100
+ active?: boolean;
1101
+ /** Above the messages, under the topic bar and away line: an app's own context strip. */
1102
+ header?: ReactNode;
1103
+ /**
1104
+ * Over the composer: an app's own tools for this thread (quick replies, a template picker).
1105
+ * Given the composer, so a tool can write into the draft, and whether you can post.
1106
+ */
1107
+ accessory?: (context: ChatThreadAccessoryContext) => ReactNode;
1108
+ /** The longest video message, in ms. Default: your role's recording limit (`recordingLimitMs`). */
1109
+ videoLimitMs?: number;
1110
+ testID?: string;
1111
+ }
1112
+ /** What `ChatThreadScreen`'s `accessory` is given. */
1113
+ interface ChatThreadAccessoryContext {
1114
+ conversationId: string;
1115
+ /** The composer's draft and reply (`dispatch({ type: "text", text })` writes into it). */
1099
1116
  composer: ChatComposerHandle;
1100
- /** null while it loads. */
1117
+ /** null while your role loads. */
1101
1118
  canPost: boolean | null;
1102
- /** Why not, when `canPost` is false (`composerDisabledReason`). */
1103
- disabledReason: string | null;
1104
- role: ChatRole | null;
1105
- onSend: (payload: ReturnType<typeof toSend>) => void;
1106
- signalTyping?: () => void;
1107
- signalRecording?: () => void;
1108
- /** The signed-in person (`useChat().userId`), whose recent emoji the picker keeps. */
1109
- userId?: string | null;
1110
- /** Touch and hold Send (or VoiceOver's action on it) to schedule what's written (`ChatScheduleSheet`). */
1111
- onSchedule?: () => void;
1112
- /** The field's placeholder ("Message #Week 1" in a topic). */
1113
- placeholder?: string;
1114
- /** Opens the video recorder (`ChatVideoRecorder`); with it, a camera button sits beside attach. */
1115
- onRecordVideo?: () => void;
1119
+ }
1120
+ /** What the thread's status line says: nothing, offline (NetInfo), or the live channel dropped. */
1121
+ type ChatConnectionState = "online" | "offline" | "connecting";
1122
+ /** Offline wins; then a live channel that dropped; a channel not yet heard from is online. */
1123
+ declare function connectionState(online: boolean | null, live: boolean | null): ChatConnectionState;
1124
+ /** Whether the phone is online, from the app's NetInfo (`modules.netInfo`); null without it or until it says. */
1125
+ declare function useOnline(netInfo: NetInfoLike | undefined): boolean | null;
1126
+ /** How many messages from others came in after `afterSeq` (the newest when you scrolled up). */
1127
+ declare function countUnseenBelow(messages: readonly {
1128
+ seq: number;
1129
+ senderId: string | null;
1130
+ }[], afterSeq: number | null, me: string): number;
1131
+ interface ChatThreadScreenSlots {
1132
+ /** Draws the app's own attachment kinds; the card by default. */
1133
+ attachment?: ChatAttachmentSlot | null;
1134
+ }
1135
+ /**
1136
+ * Points from the bottom that still count as "at the bottom" (FlatList, which follows by hand).
1137
+ * @deprecated Use genesis-ui-native's `THREAD_AT_BOTTOM_POINTS`. ChatThreadScreen is on NativeThreadList; this copy is removed in a later minor.
1138
+ */
1139
+ declare const AT_BOTTOM_POINTS = 120;
1140
+ /**
1141
+ * How the thread's list is set up, oldest first and not inverted. FlashList:
1142
+ * its chat mode (opens at the bottom, follows new rows while within a fifth of
1143
+ * a screen of it, keeps the first visible row in place when earlier ones load
1144
+ * at the top). FlatList: keeps its place when earlier rows load at the top;
1145
+ * the screen follows new rows itself (`followsByHand`).
1146
+ * @deprecated Use genesis-ui-native's `threadListMode` (which anchors FlatList past the header, `minIndexForVisible: 1`). ChatThreadScreen is on NativeThreadList; this copy is removed in a later minor.
1147
+ */
1148
+ declare function threadListMode(flash: boolean, reducedMotion: boolean): {
1149
+ followsByHand: boolean;
1150
+ maintainVisibleContentPosition: Record<string, unknown>;
1151
+ };
1152
+ /**
1153
+ * Whether a scroll position is at (or near) the bottom of its content.
1154
+ * @deprecated Use genesis-ui-native's `threadNearBottom`. ChatThreadScreen is on NativeThreadList; this copy is removed in a later minor.
1155
+ */
1156
+ declare function nearBottom(m: {
1157
+ contentOffset: {
1158
+ y: number;
1159
+ };
1160
+ contentSize: {
1161
+ height: number;
1162
+ };
1163
+ layoutMeasurement: {
1164
+ height: number;
1165
+ };
1166
+ }, slack?: number): boolean;
1167
+ declare function ChatThreadScreen(props: ChatThreadScreenProps): react.JSX.Element;
1168
+
1169
+ /** Who the conversation is with, for the title's avatar. */
1170
+ interface ChatThreadTitleAvatar {
1171
+ src?: string | null;
1172
+ name?: string | null;
1173
+ /** Keeps the picture when the bar redraws (expo-image's `recyclingKey`). */
1174
+ id?: string;
1175
+ }
1176
+ interface ChatThreadTitleProps {
1177
+ title: string;
1178
+ /** Under the title. `undefined`: the away line, from `conversationId`. `null`: none. */
1179
+ subtitle?: string | null;
1180
+ /** A picture beside the title: who it is, or your own element. */
1181
+ avatar?: ChatThreadTitleAvatar | ReactNode;
1182
+ /** Makes the title a button (to the conversation's details). */
1183
+ onPress?: () => void;
1184
+ /** VoiceOver's hint when it is a button. */
1185
+ pressHint?: string;
1186
+ /** For the default subtitle (the away line). */
1187
+ conversationId?: string;
1188
+ tintColor?: string;
1116
1189
  testID?: string;
1117
1190
  }
1118
- declare function ChatComposer(props: ChatComposerProps): react.JSX.Element;
1191
+ declare function ChatThreadTitle({ title, subtitle, avatar, onPress, pressHint, conversationId, tintColor, testID }: ChatThreadTitleProps): react.JSX.Element;
1119
1192
 
1120
1193
  type MessageRow = Extract<ThreadRow, {
1121
1194
  type: "message";
@@ -1160,14 +1233,138 @@ interface MessageBubbleProps {
1160
1233
  attachmentSlot?: ChatAttachmentSlot | null;
1161
1234
  /** How long an app card's action may run before it reads as failed; 30 s by default, 0 for never. */
1162
1235
  cardActionTimeoutMs?: number;
1236
+ /** Its status under the bubble, on the last message you sent: "Delivered", "Read 9:41" (`receiptText`). */
1237
+ receipt?: string | null;
1238
+ /** Makes the status a button ("Read by 2" opens who has read it). */
1239
+ onReceiptPress?: () => void;
1240
+ /** What is drawn behind the bubble, which the tail is cut from. The theme's grouped background by default (what ChatThreadScreen draws). */
1241
+ backdrop?: string;
1163
1242
  testID: string;
1164
1243
  }
1244
+ /** Where a bubble sits in its run of one sender's messages. */
1245
+ type BubblePosition = "single" | "first" | "middle" | "last";
1246
+ declare function bubblePosition(row: {
1247
+ groupStart: boolean;
1248
+ groupEnd: boolean;
1249
+ }): BubblePosition;
1250
+ /**
1251
+ * A bubble's corners: round, except where it meets the next or the one before in its run, on the
1252
+ * sender's side (the trailing side for yours). The last and the only one also get a tail.
1253
+ */
1254
+ declare function bubbleCorners(position: BubblePosition, mine: boolean): {
1255
+ borderTopLeftRadius: number;
1256
+ borderBottomLeftRadius: number;
1257
+ borderTopRightRadius: number;
1258
+ borderBottomRightRadius: number;
1259
+ tail: boolean;
1260
+ };
1165
1261
  declare function formatClock(iso: string): string;
1166
1262
  /** Mentions written `@[Name](user:<id>)` read as `@Name`. */
1167
1263
  declare function displayBody(body: string): string;
1168
1264
  declare function MessageBubbleImpl(props: MessageBubbleProps): react.JSX.Element;
1169
1265
  declare const MessageBubble: react.MemoExoticComponent<typeof MessageBubbleImpl>;
1170
1266
 
1267
+ /** How far the bubbles slide to show the times, in points. */
1268
+ declare const TIME_REVEAL_WIDTH = 64;
1269
+ /** A horizontal move counts as the reveal once it is this far left and mostly sideways. */
1270
+ declare function startsTimeReveal(dx: number, dy: number): boolean;
1271
+ /** How far the thread is pulled for a drag of `dx` (negative is left). */
1272
+ declare function timeRevealFor(dx: number): number;
1273
+
1274
+ interface ChatTypingBubbleProps {
1275
+ /** Read out: "Sam is typing…". */
1276
+ label: string;
1277
+ /** Who is typing (the first, in a group): their avatar shows beside the bubble. */
1278
+ userId?: string | null;
1279
+ group: boolean;
1280
+ reducedMotion: boolean;
1281
+ testID: string;
1282
+ }
1283
+ declare function ChatTypingBubble({ label, userId, group, reducedMotion, testID }: ChatTypingBubbleProps): react.JSX.Element;
1284
+
1285
+ /**
1286
+ * @feat:chat
1287
+ * `<Stack.Screen options>` for a screen that renders `ChatThreadScreen`.
1288
+ *
1289
+ * The bar is opaque. It was made so while the thread was an inverted list
1290
+ * (`transform: scaleY(-1)` on the scroll view), which it no longer is; it
1291
+ * stays opaque until a see-through bar is checked over the upright list. On
1292
+ * iOS 26 and later the navigation bar is see-through and draws a scroll
1293
+ * edge effect over the content scroll view under it; UIKit lays that effect
1294
+ * out in the flipped scroll view's own coordinates, so once the thread is
1295
+ * long enough to reach the bar the whole list renders blurred. An opaque bar
1296
+ * keeps the screen's content below it: nothing scrolls under the bar, and no
1297
+ * edge effect is drawn over the flipped list. Seen on iOS 27 with FlashList
1298
+ * and with FlatList.
1299
+ */
1300
+
1301
+ type ChatThreadStackOptionsProps = ScreenHeaderProps & {
1302
+ headerTitle?: string;
1303
+ /** Beside the title: who it is (`{ src, name, id }`), or your own element. */
1304
+ avatar?: ChatThreadTitleAvatar | ReactNode;
1305
+ /**
1306
+ * Under the title. Left out with `conversationId`: the away line ("Sam is away until Monday"),
1307
+ * which needs `ChatProvider` above the navigator. `null`: none. Show it here, and pass
1308
+ * `availability={false}` to `ChatThreadScreen` so it isn't said twice.
1309
+ */
1310
+ subtitle?: string | null;
1311
+ /** Makes the title a button (to the conversation's details). */
1312
+ onPressTitle?: () => void;
1313
+ /** VoiceOver's hint on that button. */
1314
+ titleHint?: string;
1315
+ /** For the default subtitle. */
1316
+ conversationId?: string;
1317
+ };
1318
+ /** The thread's header options with an opaque bar in `background` (the thread's own background). */
1319
+ declare function chatThreadStackOptions(props: ChatThreadStackOptionsProps, background: ColorValue): Record<string, unknown>;
1320
+ /** `chatThreadStackOptions` in the theme's grouped background, the color `ChatThreadScreen` draws. */
1321
+ declare function useChatThreadStackOptions(props: ChatThreadStackOptionsProps): Record<string, unknown>;
1322
+
1323
+ interface ChatStartPerson {
1324
+ userId: string;
1325
+ name: string;
1326
+ avatarUrl?: string | null;
1327
+ /** A second line ("Coach", "Team"). */
1328
+ subtitle?: string;
1329
+ }
1330
+ interface ChatStartSheetProps {
1331
+ open: boolean;
1332
+ onClose: () => void;
1333
+ people: ChatStartPerson[];
1334
+ /** Default `direct`. */
1335
+ kind?: string;
1336
+ onStarted: (conversationId: string) => void;
1337
+ testID?: string;
1338
+ }
1339
+ declare function ChatStartSheet({ open, onClose, people, kind, onStarted, testID }: ChatStartSheetProps): react.JSX.Element;
1340
+ /** A 44pt compose button for the inbox's header (`headerRight`). */
1341
+ declare function ChatStartButton({ onPress, testID }: {
1342
+ onPress: () => void;
1343
+ testID?: string;
1344
+ }): react.JSX.Element;
1345
+
1346
+ interface ChatComposerProps {
1347
+ composer: ChatComposerHandle;
1348
+ /** null while it loads. */
1349
+ canPost: boolean | null;
1350
+ /** Why not, when `canPost` is false (`composerDisabledReason`). */
1351
+ disabledReason: string | null;
1352
+ role: ChatRole | null;
1353
+ onSend: (payload: ReturnType<typeof toSend>) => void;
1354
+ signalTyping?: () => void;
1355
+ signalRecording?: () => void;
1356
+ /** The signed-in person (`useChat().userId`), whose recent emoji the picker keeps. */
1357
+ userId?: string | null;
1358
+ /** Touch and hold Send (or VoiceOver's action on it) to schedule what's written (`ChatScheduleSheet`). */
1359
+ onSchedule?: () => void;
1360
+ /** The field's placeholder ("Message #Week 1" in a topic). */
1361
+ placeholder?: string;
1362
+ /** Opens the video recorder (`ChatVideoRecorder`); with it, a camera button sits beside attach. */
1363
+ onRecordVideo?: () => void;
1364
+ testID?: string;
1365
+ }
1366
+ declare function ChatComposer(props: ChatComposerProps): react.JSX.Element;
1367
+
1171
1368
  /**
1172
1369
  * @feat:chat
1173
1370
  * Which actions a message offers this person, from the same rules migration
@@ -1249,6 +1446,11 @@ interface BubbleAttachment {
1249
1446
  kind: string;
1250
1447
  /** What to show now: a signed URL, or the local preview. */
1251
1448
  uri: string | null;
1449
+ /**
1450
+ * What expo-image caches it under: the storage path, which stays the same when the signed URL
1451
+ * is re-signed (a new expiry would otherwise miss the disk cache and download it again).
1452
+ */
1453
+ cacheKey?: string | null;
1252
1454
  name: string | null;
1253
1455
  width: number | null;
1254
1456
  height: number | null;
@@ -2149,4 +2351,4 @@ declare function ModerationMarker({ note, mine, testID }: {
2149
2351
  testID?: string;
2150
2352
  }): react.JSX.Element;
2151
2353
 
2152
- export { AT_BOTTOM_POINTS, AppAttachment, type AppAttachmentProps, type AppStateLike, type AudioPlayerLike, type AudioRecorderLike, type AudioStatusLike, type AvailabilityForm, BUILT_IN_KINDS, type BubbleAttachment, type BuildRowsOptions, type ByteSource, CARD_ACTION_TIMEOUT_MS, type CameraViewHandleLike, CardError, type CardRunOptions, type CardRunState, ChatAccessError, type ChatAccessErrorProps, ChatAttachmentCard, type ChatAttachmentCardProps, type ChatAttachmentSlot, type ChatAttachmentSlotProps, ChatAutoRetry, type ChatAutoRetryOptions, ChatAvailabilityScreen, type ChatAvailabilityScreenProps, ChatAwayLine, type ChatAwayLineProps, ChatBroadcastSheet, type ChatBroadcastSheetProps, ChatCardContext, ChatComposer, type ChatComposerHandle, type ChatComposerProps, ChatEmojiPicker, type ChatEmojiPickerProps, ChatEmojiPickerSheet, type ChatEmojiPickerSheetProps, ChatIconButton, type ChatIconButtonProps, ChatInboxScreen, type ChatInboxScreenProps, ChatLinkPreviewCard, type ChatLinkPreviewCardProps, ChatMediaViewer, type ChatMediaViewerProps, type ChatNativeContextValue, type ChatNativeCopy, type ChatNativeCopyOverrides, type ChatNativeModules, ChatNativeProvider, type ChatNativeProviderProps, type ChatOrganiseCopy, type ChatPerson, type ChatPhoto, ChatPhotoViewer, type ChatPhotoViewerProps, ChatScheduleSheet, type ChatScheduleSheetProps, ChatScheduledBar, type ChatScheduledBarProps, ChatScheduledList, type ChatScheduledListProps, ChatSearchScreen, type ChatSearchScreenProps, ChatStartButton, type ChatStartPerson, ChatStartSheet, type ChatStartSheetProps, ChatThreadScreen, type ChatThreadScreenProps, type ChatThreadScreenSlots, type ChatThreadStackOptionsProps, ChatTopicBar, type ChatTopicBarProps, ChatVideoPlayer, type ChatVideoPlayerProps, ChatVideoRecorder, type ChatVideoRecorderProps, type ChatVideoState, type ChunkFileLike, type ChunkedPutOptions, type ClipboardLike, type ComposerAction, type ComposerAttachment, type ComposerDraft, type ComposerState, DISMISS_DISTANCE, DISMISS_VELOCITY, type DayHours, type DraftStorageLike, EMOJI_CATEGORIES, type EmojiCategoryId, type EmojiEntry, type ExpoAudioLike, type ExpoCameraLike, type ExpoVideoLike, type HapticEvent, type HapticsLike, type ImagePickerLike, type JumpTarget, type KeyboardAvoidingLike, MAX_ZOOM, type MediaLibraryLike, type MessageActionContext, type MessageActionId, MessageActionsSheet, type MessageActionsSheetProps, MessageAttachments, MessageBubble, type MessageBubbleProps, type MintedUpload, ModerationMarker, type ModerationNote, type NetInfoLike, type OpenAttachment, type OutboxSend, type PermissionLike, type PickedAssetLike, type PickerResultLike, QUICK_REACTIONS, RECENT_EMOJI_MAX, type RecordedVideo, type RecorderConfig, type RecorderEffect, type RecorderEvent, type RecorderNotice, type RecorderPhase, type RecorderState, type RecorderStateLike, type ReplyTarget, SearchSnippet, type SharingLike, type StartVideoInput, TRANSCRIPT_LINES, TUS_CHUNK_BYTES, type ThreadRow, type TopicMenuAction, type TusSendInfo, type TusTransport, type TusUploadOptions, type TusUploadRecord, type TusUploadSource, type UseJumpOptions, type UseVoiceRecorderOptions, VIDEO_CHUNK_BYTES, VIDEO_HOLD_MS, VIDEO_MIN_MS, type VideoPlayerLike, type VideoRecorderEffect, type VideoRecorderEvent, type VideoRecorderPhase, type VideoRecorderState, type VideoUploadError, type VideoUploadTask, VideoUploadTray, type VideoUploadTrayProps, type VideoUploads, type VideoViewHandleLike, VoiceNotePlayer, type VoiceNotePlayerProps, VoiceTranscript, type VoiceTranscriptProps, type WebBrowserLike, type WeekHours, activePlaybackId, attachmentKindOf, attachmentPaths, attachmentPreview, availabilityInput, awayLineFor, barsThatFit, base64ToBytes, base64Utf8, broadcastOutcome, broadcastRows, buildThreadRows, canManageTopics, canReactTo, canSend, cardAction, cardTitle, chatNativeCopy, chatOrganiseCopy, chatThreadStackOptions, checkTopicName, chunkedPut, claimPlayback, clearDrafts, clockToDate, composerDisabledReason, composerReducer, createDraftSaver, createTusUpload, createVideoUploads, cycleVideoRate, cycleVoiceNoteRate, dateToClock, defaultScheduleAt, defaultWeek, deviceTimeZone, displayBody, draftKey, emojiEntry, emojiInCategory, emptyComposer, fileFromDataUri, fileSource, filesFromAssets, fill, forgetRecentEmoji, formFrom, formatClock, fullScreenVideo, galleryFor, haptic, hoursFromWeek, idleRecorder, inboxRow, initialVideoRecorder, initials, insertAtSelection, invertedRows, isLocalUri, isOnline, isOpenableHref, isVideoPlaying, linkHost, linkPreviewIds, liveBars, loadDraft, loadRecentEmoji, memoryDraftStorage, messageActionsFor, messagePreview, moderationNote, moderationText, muxPosterUrl, muxStreamUrl, nearBottom, nextOffset, openChatLink, panLimit, pauseChatPlayback, pinchScale, previewToShow, pushRecentEmoji, recentEmojiKey, recordedVideoFile, recorderStep, recordingType, releasePlayback, replyTargetFor, resolveChatCopy, rowIndexOf, rowKey, sameTimeDays, saveRecentEmoji, scheduleInputFrom, scrubSeconds, searchEmoji, shouldDismiss, slotUrl, snippetText, splitCardAttachments, threadListMode, timeZones, toSend, toggleVideo, toggleVideoMute, toggleVoiceNote, topicClosedFor, topicMenuFor, transcriptIsLong, useAwayLine, useCardRuns, useChatAutoRetry, useChatComposer, useChatNative, useChatThreadStackOptions, useJumpToMessage, usePlayingVideo, usePlayingVoiceNote, useScheduleSend, useVideoUploads, useVoiceRecorder, videoRecorderStep, videoSource, videoState, videoUploads, voiceNoteFile, waveformBars, weekFromHours, withDay, withTime };
2354
+ export { AT_BOTTOM_POINTS, AppAttachment, type AppAttachmentProps, type AppStateLike, type AudioPlayerLike, type AudioRecorderLike, type AudioStatusLike, type AvailabilityForm, BUILT_IN_KINDS, type BubbleAttachment, type BubblePosition, type BuildRowsOptions, type ByteSource, CARD_ACTION_TIMEOUT_MS, type CameraViewHandleLike, CardError, type CardRunOptions, type CardRunState, ChatAccessError, type ChatAccessErrorProps, ChatAttachmentCard, type ChatAttachmentCardProps, type ChatAttachmentSlot, type ChatAttachmentSlotProps, ChatAutoRetry, type ChatAutoRetryOptions, ChatAvailabilityScreen, type ChatAvailabilityScreenProps, ChatAwayLine, type ChatAwayLineProps, ChatBroadcastSheet, type ChatBroadcastSheetProps, ChatCardContext, ChatComposer, type ChatComposerHandle, type ChatComposerProps, type ChatConnectionState, ChatEmojiPicker, type ChatEmojiPickerProps, ChatEmojiPickerSheet, type ChatEmojiPickerSheetProps, ChatIconButton, type ChatIconButtonProps, ChatInboxScreen, type ChatInboxScreenProps, ChatLinkPreviewCard, type ChatLinkPreviewCardProps, ChatMediaViewer, type ChatMediaViewerProps, type ChatNativeContextValue, type ChatNativeCopy, type ChatNativeCopyOverrides, type ChatNativeModules, ChatNativeProvider, type ChatNativeProviderProps, type ChatOrganiseCopy, type ChatPerson, type ChatPhoto, ChatPhotoViewer, type ChatPhotoViewerProps, type ChatReceiptsMode, ChatScheduleSheet, type ChatScheduleSheetProps, ChatScheduledBar, type ChatScheduledBarProps, ChatScheduledList, type ChatScheduledListProps, ChatSearchScreen, type ChatSearchScreenProps, ChatStartButton, type ChatStartPerson, ChatStartSheet, type ChatStartSheetProps, type ChatThreadAccessoryContext, ChatThreadScreen, type ChatThreadScreenProps, type ChatThreadScreenSlots, type ChatThreadStackOptionsProps, ChatThreadTitle, type ChatThreadTitleAvatar, type ChatThreadTitleProps, ChatTopicBar, type ChatTopicBarProps, ChatTypingBubble, type ChatTypingBubbleProps, ChatVideoPlayer, type ChatVideoPlayerProps, ChatVideoRecorder, type ChatVideoRecorderProps, type ChatVideoState, type ChunkFileLike, type ChunkedPutOptions, type ClipboardLike, type ComposerAction, type ComposerAttachment, type ComposerDraft, type ComposerState, DISMISS_DISTANCE, DISMISS_VELOCITY, type DayHours, type DraftStorageLike, EMOJI_CATEGORIES, type EmojiCategoryId, type EmojiEntry, type ExpoAudioLike, type ExpoCameraLike, type ExpoVideoLike, type HapticEvent, type HapticsLike, type ImagePickerLike, type JumpTarget, type KeyboardAvoidingLike, MAX_ZOOM, type MediaLibraryLike, type MessageActionContext, type MessageActionId, MessageActionsSheet, type MessageActionsSheetProps, MessageAttachments, MessageBubble, type MessageBubbleProps, type MessageReceipt, type MessageReceiptFor, type MintedUpload, ModerationMarker, type ModerationNote, type NetInfoLike, type OpenAttachment, type OutboxSend, type PermissionLike, type PickedAssetLike, type PickerResultLike, QUICK_REACTIONS, RECENT_EMOJI_MAX, type ReceiptCopy, type ReceiptOptions, type RecordedVideo, type RecorderConfig, type RecorderEffect, type RecorderEvent, type RecorderNotice, type RecorderPhase, type RecorderState, type RecorderStateLike, type ReplyTarget, SearchSnippet, type SharingLike, type StartVideoInput, TIME_REVEAL_WIDTH, TRANSCRIPT_LINES, TUS_CHUNK_BYTES, type ThreadRow, type TopicMenuAction, type TusSendInfo, type TusTransport, type TusUploadOptions, type TusUploadRecord, type TusUploadSource, type UseJumpOptions, type UseVoiceRecorderOptions, VIDEO_CHUNK_BYTES, VIDEO_HOLD_MS, VIDEO_MIN_MS, type VideoPlayerLike, type VideoRecorderEffect, type VideoRecorderEvent, type VideoRecorderPhase, type VideoRecorderState, type VideoUploadError, type VideoUploadTask, VideoUploadTray, type VideoUploadTrayProps, type VideoUploads, type VideoViewHandleLike, VoiceNotePlayer, type VoiceNotePlayerProps, VoiceTranscript, type VoiceTranscriptProps, type WebBrowserLike, type WeekHours, activePlaybackId, attachmentKindOf, attachmentPaths, attachmentPreview, availabilityInput, awayLineFor, barsThatFit, base64ToBytes, base64Utf8, broadcastOutcome, broadcastRows, bubbleCorners, bubblePosition, buildThreadRows, canManageTopics, canReactTo, canSend, cardAction, cardTitle, chatNativeCopy, chatOrganiseCopy, chatThreadStackOptions, checkTopicName, chunkedPut, claimPlayback, clearDrafts, clockToDate, composerDisabledReason, composerReducer, connectionState, countUnseenBelow, createDraftSaver, createTusUpload, createVideoUploads, cycleVideoRate, cycleVoiceNoteRate, dateToClock, defaultScheduleAt, defaultWeek, deviceTimeZone, displayBody, draftKey, emojiEntry, emojiInCategory, emptyComposer, fileFromDataUri, fileSource, filesFromAssets, fill, forgetRecentEmoji, formFrom, formatClock, fullScreenVideo, galleryFor, haptic, hoursFromWeek, idleRecorder, inboxRow, initialVideoRecorder, initials, insertAtSelection, invertedRows, isLocalUri, isOnline, isOpenableHref, isVideoPlaying, lastSentReceipt, linkHost, linkPreviewIds, liveBars, loadDraft, loadRecentEmoji, memoryDraftStorage, messageActionsFor, messagePreview, moderationNote, moderationText, muxPosterUrl, muxStreamUrl, nearBottom, nextOffset, openChatLink, panLimit, pauseChatPlayback, pinchScale, previewToShow, pushRecentEmoji, readWhen, receiptText, recentEmojiKey, recordedVideoFile, recorderStep, recordingType, releasePlayback, replyTargetFor, resolveChatCopy, rowIndexOf, rowKey, sameTimeDays, saveRecentEmoji, scheduleInputFrom, scrubSeconds, searchEmoji, shouldDismiss, slotUrl, snippetText, splitCardAttachments, startsTimeReveal, threadListMode, timeRevealFor, timeZones, toSend, toggleVideo, toggleVideoMute, toggleVoiceNote, topicClosedFor, topicMenuFor, transcriptIsLong, useAwayLine, useCardRuns, useChatAutoRetry, useChatComposer, useChatNative, useChatThreadStackOptions, useJumpToMessage, useOnline, usePlayingVideo, usePlayingVoiceNote, useScheduleSend, useVideoUploads, useVoiceRecorder, videoRecorderStep, videoSource, videoState, videoUploads, voiceNoteFile, waveformBars, weekFromHours, withDay, withTime };