@robono/messaging-react-native 0.23.0 → 0.25.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 (132) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +157 -4
  3. package/RobonoMessagingRuntime.podspec +16 -0
  4. package/SBOM.spdx.json +2709 -813
  5. package/android/build.gradle +10 -0
  6. package/android/src/main/AndroidManifest.xml +1 -0
  7. package/android/src/main/java/com/robono/messaging/RobonoBackupCrypto.java +27 -0
  8. package/android/src/main/java/com/robono/messaging/RobonoBackupGoogle.java +76 -0
  9. package/android/src/main/java/com/robono/messaging/RobonoHistoryStore.java +173 -0
  10. package/android/src/main/java/com/robono/messaging/RobonoMessagingPackage.java +11 -0
  11. package/app.plugin.cjs +22 -3
  12. package/cloudkit/backup-schema.ckdb +13 -0
  13. package/dist/account-pages.d.ts +51 -0
  14. package/dist/account-pages.js +65 -0
  15. package/dist/account.d.ts +6 -2
  16. package/dist/account.js +37 -11
  17. package/dist/attachment-preview.d.ts +11 -10
  18. package/dist/attachment-preview.js +15 -12
  19. package/dist/backup-background.d.ts +25 -0
  20. package/dist/backup-background.js +71 -0
  21. package/dist/backup-base64.d.ts +3 -0
  22. package/dist/backup-base64.js +41 -0
  23. package/dist/backup-google-authorization.d.ts +23 -0
  24. package/dist/backup-google-authorization.js +95 -0
  25. package/dist/backup.d.ts +24 -0
  26. package/dist/backup.js +202 -0
  27. package/dist/brand.js +4 -4
  28. package/dist/bubble-design.d.ts +1 -1
  29. package/dist/bubble-design.js +5 -3
  30. package/dist/cloudkit-backup.d.ts +14 -0
  31. package/dist/cloudkit-backup.js +193 -0
  32. package/dist/contact-directory.d.ts +3 -1
  33. package/dist/contact-directory.js +3 -3
  34. package/dist/conversation-details.js +2 -2
  35. package/dist/customization.d.ts +1 -0
  36. package/dist/delivery-bar.d.ts +3 -2
  37. package/dist/delivery-bar.js +7 -4
  38. package/dist/delivery-notice.d.ts +9 -0
  39. package/dist/delivery-notice.js +15 -0
  40. package/dist/directory-navigation.d.ts +25 -0
  41. package/dist/directory-navigation.js +69 -0
  42. package/dist/expo-backup-background.d.ts +17 -0
  43. package/dist/expo-backup-background.js +57 -0
  44. package/dist/expo-backup-cloudkit.d.ts +6 -0
  45. package/dist/expo-backup-cloudkit.js +11 -0
  46. package/dist/expo-backup-crypto.d.ts +3 -0
  47. package/dist/expo-backup-crypto.js +17 -0
  48. package/dist/expo-backup-google.d.ts +7 -0
  49. package/dist/expo-backup-google.js +16 -0
  50. package/dist/expo-backup-network.d.ts +8 -0
  51. package/dist/expo-backup-network.js +18 -0
  52. package/dist/expo-backup-passkeys.d.ts +14 -0
  53. package/dist/expo-backup-passkeys.js +46 -0
  54. package/dist/expo-backup-settings.d.ts +4 -0
  55. package/dist/expo-backup-settings.js +59 -0
  56. package/dist/expo-backup.d.ts +14 -0
  57. package/dist/expo-backup.js +22 -0
  58. package/dist/expo-bridge.d.ts +2 -0
  59. package/dist/expo-bridge.js +3 -1
  60. package/dist/expo-cache.js +20 -1
  61. package/dist/expo-device-history.d.ts +24 -0
  62. package/dist/expo-device-history.js +88 -0
  63. package/dist/expo-durable-history.d.ts +26 -0
  64. package/dist/expo-durable-history.js +56 -0
  65. package/dist/expo-history-backup.d.ts +3 -0
  66. package/dist/expo-history-backup.js +79 -0
  67. package/dist/expo-history-maintenance.d.ts +4 -0
  68. package/dist/expo-history-maintenance.js +23 -0
  69. package/dist/expo-history-previews.d.ts +5 -0
  70. package/dist/expo-history-previews.js +57 -0
  71. package/dist/expo-history.d.ts +1 -1
  72. package/dist/expo-history.js +2 -2
  73. package/dist/expo-inbox-preferences.d.ts +3 -0
  74. package/dist/expo-inbox-preferences.js +9 -0
  75. package/dist/expo-media.d.ts +2 -0
  76. package/dist/expo-media.js +18 -24
  77. package/dist/expo-messenger.d.ts +8 -0
  78. package/dist/expo-messenger.js +27 -11
  79. package/dist/expo-notifications.d.ts +17 -1
  80. package/dist/expo-notifications.js +36 -16
  81. package/dist/expo-outbox.d.ts +2 -0
  82. package/dist/expo-outbox.js +1 -1
  83. package/dist/expo-oversight.d.ts +15 -0
  84. package/dist/expo-oversight.js +15 -0
  85. package/dist/expo-reviews.d.ts +6 -0
  86. package/dist/expo-reviews.js +145 -0
  87. package/dist/expo-screen.js +62 -28
  88. package/dist/expo-thumbnails.d.ts +6 -2
  89. package/dist/expo-thumbnails.js +73 -8
  90. package/dist/expo.d.ts +14 -0
  91. package/dist/expo.js +12 -0
  92. package/dist/forward.js +2 -2
  93. package/dist/header-calls.js +1 -1
  94. package/dist/header-colors.d.ts +5 -0
  95. package/dist/header-colors.js +7 -0
  96. package/dist/inbox-search.d.ts +1 -1
  97. package/dist/inbox-search.js +7 -3
  98. package/dist/inbox.d.ts +6 -2
  99. package/dist/inbox.js +27 -55
  100. package/dist/index.d.ts +14 -6
  101. package/dist/index.js +195 -78
  102. package/dist/linked-apps.d.ts +45 -0
  103. package/dist/linked-apps.js +40 -0
  104. package/dist/loading-messages.d.ts +5 -0
  105. package/dist/loading-messages.js +10 -0
  106. package/dist/media-access.d.ts +8 -0
  107. package/dist/media-access.js +6 -1
  108. package/dist/media-controller.d.ts +2 -0
  109. package/dist/native-history-authorization.d.ts +4 -0
  110. package/dist/native-history-authorization.js +69 -0
  111. package/dist/native-history-backup.d.ts +16 -0
  112. package/dist/native-history-backup.js +144 -0
  113. package/dist/native-history.d.ts +14 -0
  114. package/dist/native-history.js +186 -0
  115. package/dist/native-outbox.d.ts +2 -0
  116. package/dist/oversight-session.d.ts +4 -0
  117. package/dist/oversight-session.js +14 -0
  118. package/dist/popup.d.ts +6 -3
  119. package/dist/popup.js +6 -6
  120. package/dist/preview-layout.d.ts +12 -0
  121. package/dist/preview-layout.js +102 -0
  122. package/dist/recent-media.js +2 -1
  123. package/dist/reviews.d.ts +19 -0
  124. package/dist/reviews.js +231 -0
  125. package/dist/scheduled.js +6 -6
  126. package/dist/search.js +18 -8
  127. package/ios/RobonoBackupCloudKit.m +96 -0
  128. package/ios/RobonoBackupCrypto.m +30 -0
  129. package/ios/RobonoHistoryStore.m +170 -0
  130. package/package.json +34 -7
  131. package/plugin/backup-expiration.cjs +23 -0
  132. package/plugin/prepare-native.cjs +12 -0
package/dist/inbox.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useDirectoryNavigation, MessagingDirectoryConversation } from './directory-navigation.js';
2
3
  import { MessagingBrand } from './brand.js';
3
4
  import { messagingScreenAppearance, messagingContrastInk, messagingAvatarStyle, messagingFriendsColors, messagingMenuColors, messagingMenuLayout } from '@robono/messaging';
4
5
  import { directoryWithoutChats, MessagingDirectoryRow } from './contact-directory.js';
@@ -10,11 +11,11 @@ import { MessageMenuRow } from './message-menu.js';
10
11
  import { InboxMessageSearch } from './inbox-search.js';
11
12
  import { MessageIcon } from './icons.js';
12
13
  import { useEffect, useRef, useState, useSyncExternalStore } from 'react';
13
- import { AppState, FlatList, Image, Platform, Pressable, ScrollView, View } from 'react-native';
14
+ import { ActivityIndicator, AppState, FlatList, Image, Platform, Pressable, ScrollView, StyleSheet, View } from 'react-native';
14
15
  import { defaultMessagingSettings } from '@robono/messaging';
15
16
  import { MessagingPopup, MessagingMenuSurface, MessagingPopupHeaderBoundary, useMessagingPopupColors, messagingPopupBackdrop } from './popup.js';
16
17
  /** Compact Messenger chat rows: avatar, name, last message, time and unread badge. */
17
- export function MessagingInbox({ client, userId, contacts = {}, appearance, active = true, manageUpdates = true, onSelect, onDeleted, companyName, headerActions, searchText, selectedId, query: controlledQuery, onSearchChange, viewMemory, directory = [], onOpenDirectoryContact }) {
18
+ export function MessagingInbox({ client, userId, selfAvatarUrl, contacts = {}, appearance, active = true, manageUpdates = true, onSelect, onDeleted, companyName, headerActions, searchText, selectedId, query: controlledQuery, onSearchChange, viewMemory, directory = [], onOpenDirectoryContact, onDirectorySelect, onNewConversation }) {
18
19
  const { text: uiText, locale: uiLocale, number: uiNumber, count: uiCount } = useRobonoLocale();
19
20
  const state = useSyncExternalStore(client.subscribe, client.getSnapshot, client.getSnapshot), design = messagingScreenAppearance(appearance ?? state.appearance ?? defaultMessagingSettings().appearance), c = messagingFriendsColors(design), friends = design.screens?.friends;
20
21
  const messagingPopupColors = useMessagingPopupColors(design, 'alerts');
@@ -27,55 +28,24 @@ export function MessagingInbox({ client, userId, contacts = {}, appearance, acti
27
28
  const [localQuery, setLocalQuery] = useState(memory.query);
28
29
  const query = friends?.showSearch === false ? '' : controlledQuery ?? localQuery;
29
30
  const setQuery = (value) => { memory.query = value; (onSearchChange ?? setLocalQuery)(value); };
31
+ const [searchOpen, setSearchOpen] = useState(!!query), searchInput = useRef(null);
32
+ const closeSearch = () => { setQuery(''); setSearchOpen(false); };
33
+ useEffect(() => { if (query)
34
+ setSearchOpen(true); }, [query]);
35
+ useEffect(() => { if (searchOpen) {
36
+ const frame = requestAnimationFrame(() => searchInput.current?.focus());
37
+ return () => cancelAnimationFrame(frame);
38
+ } }, [searchOpen]);
30
39
  const scroll = useInboxScroll(memory, 'chats:' + query.trim(), state.conversations.length > 0 && !state.loading, !state.hasMore);
31
40
  const [selected, setSelected] = useState(null), [confirm, setConfirm] = useState(false), [busy, setBusy] = useState(false), [error, setError] = useState('');
32
- const avatar = messagingAvatarStyle(friends?.avatarSize ?? 40, friends?.avatarShape), rowPadding = friends?.rowSpacing === 'compact' ? 6 : friends?.rowSpacing === 'relaxed' ? 16 : 10;
33
- const title = (row) => row.contactId === userId ? uiText('Notes to self') : row.kind === 'group' ? row.name ?? 'Group' : contacts[row.contactId ?? '']?.name ?? row.contactId ?? 'Chat';
34
- const [directorySelection, setDirectorySelection] = useState(null), [directoryBusy, setDirectoryBusy] = useState(false), [directoryError, setDirectoryError] = useState('');
35
- const directoryRequest = useRef(null), directoryRef = useRef(directory);
36
- directoryRef.current = directory;
37
- const cancelDirectory = () => { directoryRequest.current?.abort(); directoryRequest.current = null; setDirectoryBusy(false); setDirectorySelection(null); setDirectoryError(''); };
38
- useEffect(() => { cancelDirectory(); return () => directoryRequest.current?.abort(); }, [client, userId]);
39
- useEffect(() => { const sub = AppState.addEventListener('change', state => { if (state !== 'active')
40
- cancelDirectory(); }); return () => sub.remove(); }, []);
41
- useEffect(() => { if (!active)
42
- cancelDirectory(); }, [active]);
43
- useEffect(() => { if (directorySelection) {
44
- const current = directory.find(c => c.id === directorySelection.id);
45
- if (!current || current.available !== directorySelection.available || current.contactId !== directorySelection.contactId)
46
- cancelDirectory();
47
- } }, [directory, directorySelection]);
48
- async function openDirectory(entry) {
49
- directoryRequest.current?.abort();
50
- setDirectorySelection(entry);
51
- setDirectoryError('');
52
- setDirectoryBusy(false);
53
- if (!entry.available || !onOpenDirectoryContact)
54
- return;
55
- const control = new AbortController();
56
- directoryRequest.current = control;
57
- setDirectoryBusy(true);
58
- try {
59
- const row = await onOpenDirectoryContact(entry, control.signal);
60
- const current = directoryRef.current.find(c => c.id === entry.id);
61
- if (control.signal.aborted || !current?.available || current.contactId !== entry.contactId)
62
- return;
63
- setDirectorySelection(null);
64
- onSelect(row);
65
- }
66
- catch (e) {
67
- if (!control.signal.aborted)
68
- setDirectoryError(e instanceof Error ? e.message : uiText('This conversation is unavailable.'));
69
- }
70
- finally {
71
- if (directoryRequest.current === control) {
72
- directoryRequest.current = null;
73
- setDirectoryBusy(false);
74
- }
75
- }
76
- }
77
- const directoryRows = directoryWithoutChats(directory, state.conversations, query);
78
- const inboxRows = [...state.conversations.filter(row => !query.trim() || [title(row), row.lastMessage?.text ?? '', searchText?.(row) ?? ''].join(' ').toLocaleLowerCase().includes(query.trim().toLocaleLowerCase())).map(chat => ({ kind: 'chat', chat })), ...directoryRows.map(entry => ({ kind: 'directory', entry }))];
41
+ const avatar = messagingAvatarStyle(friends?.avatarSize ?? 48, friends?.avatarShape), rowPadding = friends?.rowSpacing === 'compact' ? 6 : friends?.rowSpacing === 'relaxed' ? 16 : 12;
42
+ const title = (row) => row.contactId === userId ? uiText('Me') : row.kind === 'group' ? row.name ?? 'Group' : contacts[row.contactId ?? '']?.name ?? row.contactId ?? 'Chat';
43
+ const directoryNavigation = useDirectoryNavigation({ directory, onOpenDirectoryContact, scope: client, userId, active, onOpen: onSelect });
44
+ const openDirectory = (entry) => onDirectorySelect ? onDirectorySelect(entry) : directoryNavigation.open(entry);
45
+ const isSelf = (row) => row.kind === 'direct' && row.contactId === userId;
46
+ const visibleChats = state.conversations.filter(row => state.showSelf !== false || !isSelf(row)).sort((a, b) => Number(isSelf(b)) - Number(isSelf(a)));
47
+ const directoryRows = directoryWithoutChats(directory.filter(entry => entry.contactId !== userId), state.conversations, query);
48
+ const inboxRows = [...visibleChats.filter(row => !query.trim() || [title(row), row.lastMessage?.text ?? '', searchText?.(row) ?? ''].join(' ').toLocaleLowerCase().includes(query.trim().toLocaleLowerCase())).map(chat => ({ kind: 'chat', chat })), ...directoryRows.map(entry => ({ kind: 'directory', entry }))];
79
49
  const rows = useRef(new Map()), pending = useRef(null);
80
50
  const [menuVisible, setMenuVisible] = useState(false), [confirmVisible, setConfirmVisible] = useState(false), [anchor, setAnchor] = useState({ x: 12, y: 88 });
81
51
  const openOptions = (row) => { if (!state.inboxActionsAvailable)
@@ -111,19 +81,21 @@ export function MessagingInbox({ client, userId, contacts = {}, appearance, acti
111
81
  setBusy(false);
112
82
  } }
113
83
  const preview = (row) => { const m = row.lastMessage; if (!m)
114
- return 'No messages yet'; const text = m.kind === 'text' ? m.text ?? '' : ({ voice: 'Voice message', image: 'Photo', video: 'Video', document: 'Document', poll: 'Poll' }[m.kind] ?? 'Message'); return (m.senderId === userId ? 'You: ' : '') + text; };
115
- return _jsx(MessagingTypography, { appearance: design, children: _jsxs(View, { style: { flex: 1, minHeight: 0, backgroundColor: c.background }, children: [_jsx(MessagingPopupHeaderBoundary, { children: _jsxs(View, { testID: "messaging-inbox-header", style: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', backgroundColor: friends?.headerBackground ?? c.background, minHeight: friends?.headerSize === 'compact' ? 48 : friends?.headerSize === 'roomy' ? 80 : 64, paddingHorizontal: 16, paddingTop: 4, paddingBottom: 8, gap: 8 }, children: [_jsx(MessagingBrand, { appearance: design, companyName: companyName }), headerActions] }) }), friends?.showSearch !== false && _jsxs(View, { style: { margin: 12, marginTop: 8, flexDirection: 'row', alignItems: 'center', gap: 8, borderRadius: 10, paddingHorizontal: 10, backgroundColor: c.foreground + '0b' }, children: [_jsx(MessageIcon, { name: "search", size: 20, color: c.secondary }), _jsx(TextInput, { accessibilityLabel: uiText("Search chats"), placeholder: state.globalSearchAvailable ? uiText("Search chats and messages") : uiText("Search chats"), placeholderTextColor: c.secondary, value: query, onChangeText: setQuery, maxLength: 200, autoCapitalize: "none", autoCorrect: false, style: { flex: 1, minHeight: 44, color: c.foreground, fontSize: 16 } }), !!query && _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: uiText("Clear chat search"), onPress: () => setQuery(''), style: { width: 44, height: 44, alignItems: 'center', justifyContent: 'center' }, children: _jsx(MessageIcon, { name: "close", size: 20, color: c.secondary }) })] }), state.error && _jsxs(View, { style: { padding: 12 }, children: [_jsx(Text, { accessibilityRole: "alert", style: { color: c.foreground }, children: state.error }), _jsx(Pressable, { accessibilityRole: "button", onPress: () => void client.refresh().catch(() => { }), children: _jsx(Text, { style: { color: c.accent, paddingVertical: 8 }, children: uiText("Try again") }) })] }), query.trim() && state.globalSearchAvailable ? _jsx(InboxMessageSearch, { viewMemory: memory, client: client, query: query.trim(), appearance: { ...design, colors: c }, name: title, chats: state.conversations.filter(row => title(row).toLocaleLowerCase().includes(query.trim().toLocaleLowerCase())), onSelect: onSelect, directoryHeader: directoryRows.map(entry => _jsx(MessagingDirectoryRow, { contact: entry, appearance: design, onPress: () => void openDirectory(entry) }, entry.id)) }, userId) : _jsx(FlatList, { ...scroll, testID: "messaging-inbox-list", data: inboxRows, keyExtractor: row => row.kind === 'chat' ? 'chat:' + row.chat.id : 'directory:' + row.entry.id, contentContainerStyle: { flexGrow: 1 }, ItemSeparatorComponent: () => friends?.showDividers === false ? null : _jsx(View, { style: { height: 1, backgroundColor: c.foreground + '12', marginLeft: 64 } }), ListEmptyComponent: _jsx(Text, { style: { padding: 20, textAlign: 'center', color: c.secondary }, children: state.loading ? uiText("Loading chats…") : state.error ? '' : query ? uiText("No matching chats.") : uiText("No chats yet") }), ListFooterComponent: state.hasMore ? _jsx(Pressable, { accessibilityRole: "button", disabled: state.loading, onPress: () => void client.loadMore().catch(() => { }), children: _jsx(Text, { style: { padding: 12, textAlign: 'center', color: c.accent }, children: state.loading ? uiText("Loading…") : uiText("More chats") }) }) : null, renderItem: ({ item: row }) => {
84
+ return row.deviceHistoryLastMessage ? uiText('Restore your backup to see earlier messages') : uiText('No messages yet'); const text = m.kind === 'text' ? m.text ?? '' : ({ voice: 'Voice message', image: 'Photo', video: 'Video', document: 'Document', poll: 'Poll' }[m.kind] ?? 'Message'); return (m.senderId === userId ? 'You: ' : '') + text; };
85
+ if (directoryNavigation.selection)
86
+ return _jsx(MessagingDirectoryConversation, { entry: directoryNavigation.selection, busy: directoryNavigation.busy, error: directoryNavigation.error, appearance: design, onBack: directoryNavigation.cancel, onRetry: () => void directoryNavigation.open(directoryNavigation.selection) });
87
+ return _jsx(MessagingTypography, { appearance: design, children: _jsxs(View, { style: { flex: 1, minHeight: 0, backgroundColor: c.background }, children: [_jsx(MessagingPopupHeaderBoundary, { children: _jsxs(View, { testID: "messaging-inbox-header", style: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', backgroundColor: friends?.headerBackground ?? c.background, minHeight: friends?.headerSize === 'compact' ? 48 : friends?.headerSize === 'roomy' ? 80 : 64, paddingHorizontal: 16, paddingVertical: 8, gap: 8 }, children: [_jsx(MessagingBrand, { appearance: design, companyName: companyName }), _jsxs(View, { style: { flexDirection: 'row', alignItems: 'center', gap: 8 }, children: [friends?.showSearch !== false && _jsx(Pressable, { testID: "messaging-inbox-search-toggle", accessibilityRole: "button", accessibilityLabel: uiText('Search chats'), accessibilityState: { expanded: searchOpen }, onPress: () => searchOpen ? closeSearch() : setSearchOpen(true), style: { width: 44, height: 44, alignItems: 'center', justifyContent: 'center' }, children: _jsx(MessageIcon, { name: "search", size: 23, color: friends?.headerText ?? c.foreground }) }), headerActions] })] }) }), friends?.showSearch !== false && searchOpen && _jsxs(View, { testID: "messaging-inbox-search", style: { minHeight: 46, marginHorizontal: 12, marginTop: 2, marginBottom: 4, flexDirection: 'row', alignItems: 'center', gap: 8, borderRadius: 23, borderWidth: 1, borderColor: c.background, paddingHorizontal: 12, backgroundColor: c.foreground + '26' }, children: [_jsx(MessageIcon, { name: "search", size: 18, color: c.secondary }), _jsx(TextInput, { ref: searchInput, accessibilityLabel: uiText("Search chats"), placeholder: uiText("Search chats"), placeholderTextColor: c.secondary, value: query, onChangeText: setQuery, maxLength: 200, autoCapitalize: "none", autoCorrect: false, style: { flex: 1, minWidth: 0, minHeight: 44, paddingVertical: 8, color: c.foreground, fontSize: 15 } }), _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: uiText("Close chat search"), onPress: closeSearch, style: { width: 44, height: 44, alignItems: 'center', justifyContent: 'center' }, children: _jsx(MessageIcon, { name: "close", size: 14, color: c.secondary }) })] }), state.error && _jsxs(View, { style: { padding: 12 }, children: [_jsx(Text, { accessibilityRole: "alert", style: { color: c.foreground }, children: state.error }), _jsx(Pressable, { accessibilityRole: "button", onPress: () => void client.refresh().catch(() => { }), children: _jsx(Text, { style: { color: c.accent, paddingVertical: 8 }, children: uiText("Try again") }) })] }), query.trim() && state.globalSearchAvailable ? _jsx(InboxMessageSearch, { viewMemory: memory, client: client, query: query.trim(), appearance: { ...design, colors: c }, name: title, chats: visibleChats.filter(row => title(row).toLocaleLowerCase().includes(query.trim().toLocaleLowerCase())), onSelect: onSelect, directoryHeader: directoryRows.map(entry => _jsx(MessagingDirectoryRow, { contact: entry, appearance: design, onPress: () => void openDirectory(entry) }, entry.id)) }, userId) : _jsx(FlatList, { ...scroll, testID: "messaging-inbox-list", data: inboxRows, keyExtractor: row => row.kind === 'chat' ? 'chat:' + row.chat.id : 'directory:' + row.entry.id, contentContainerStyle: { flexGrow: 1, paddingBottom: onNewConversation ? 100 : 0 }, ItemSeparatorComponent: () => friends?.showDividers === false ? null : _jsx(View, { style: { height: StyleSheet.hairlineWidth, backgroundColor: c.foreground + '26', width: '88%', alignSelf: 'center' } }), ListEmptyComponent: _jsx(View, { style: { minHeight: 60, alignItems: 'center', justifyContent: 'center', paddingHorizontal: 20 }, children: state.loading ? _jsx(ActivityIndicator, { accessibilityLabel: uiText("Loading chats…"), color: c.secondary }) : _jsx(Text, { style: { textAlign: 'center', color: c.secondary }, children: state.error ? '' : query ? uiText("No matching chats.") : uiText("No chats yet") }) }), ListFooterComponent: state.hasMore ? _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: uiText("More chats"), accessibilityState: { busy: state.loading }, disabled: state.loading, onPress: () => void client.loadMore().catch(() => { }), style: { minHeight: 48, alignItems: 'center', justifyContent: 'center' }, children: state.loading ? _jsx(ActivityIndicator, { color: c.accent }) : _jsx(Text, { style: { padding: 12, textAlign: 'center', color: c.accent }, children: uiText("More chats") }) }) : null, renderItem: ({ item: row }) => {
116
88
  if (row.kind === 'directory')
117
89
  return _jsx(MessagingDirectoryRow, { contact: row.entry, appearance: design, onPress: () => void openDirectory(row.entry) });
118
90
  const item = row.chat;
119
- const person = item.contactId ? contacts[item.contactId] : undefined, title = item.contactId === userId ? uiText('Notes to self') : item.kind === 'group' ? item.name ?? 'Group' : person?.name ?? item.contactId ?? 'Chat';
120
- const date = item.lastMessage ? new Date(item.lastMessage.createdAt) : null;
91
+ const person = isSelf(item) ? { name: 'Me', avatarUrl: selfAvatarUrl ?? contacts[userId]?.avatarUrl } : item.contactId ? contacts[item.contactId] : undefined, title = item.contactId === userId ? uiText('Me') : item.kind === 'group' ? item.name ?? 'Group' : person?.name ?? item.contactId ?? 'Chat';
92
+ const dateValue = item.lastMessage?.createdAt ?? item.deviceHistoryLastMessage?.createdAt, date = dateValue ? new Date(dateValue) : null;
121
93
  return _jsxs(Pressable, { ref: node => { if (node)
122
94
  rows.current.set(item.id, node);
123
95
  else
124
96
  rows.current.delete(item.id); }, accessibilityRole: "button", accessibilityState: { selected: item.id === selectedId }, accessibilityLabel: item.unreadCount ? uiText('{name}, {count} unread', { name: title, count: uiNumber(item.unreadCount) }) : title, onPress: () => onSelect(item), onLongPress: () => openOptions(item), accessibilityActions: state.inboxActionsAvailable ? [{ name: 'showOptions', label: uiText("Chat options") }] : [], onAccessibilityAction: e => { if (e.nativeEvent.actionName === 'showOptions')
125
- openOptions(item); }, ...(Platform.OS === 'web' ? { onContextMenu: (e) => { e.preventDefault(); openOptions(item); } } : {}), style: { flexDirection: 'row', alignItems: 'center', gap: 12, paddingHorizontal: 12, paddingVertical: rowPadding, minHeight: Math.max(44, avatar.height + rowPadding * 2), backgroundColor: item.id === selectedId ? c.accent + '15' : undefined }, children: [friends?.showAvatars !== false && (person?.avatarUrl ? _jsx(Image, { source: { uri: person.avatarUrl }, style: { ...avatar } }) : _jsx(View, { style: { ...avatar, backgroundColor: c.accent + '20', alignItems: 'center', justifyContent: 'center' }, children: _jsx(Text, { style: { color: c.accent, fontSize: 18, fontWeight: '700' }, children: title.slice(0, 1).toUpperCase() }) })), _jsxs(View, { style: { flex: 1, minWidth: 0 }, children: [_jsxs(Text, { numberOfLines: 1, style: { color: c.foreground, fontSize: friends?.nameSize ?? 16, fontWeight: '700' }, children: [title, item.muted ? uiText(" · Muted") : ''] }), friends?.showPreview !== false && _jsx(Text, { numberOfLines: friends?.previewLines ?? 1, style: { color: c.secondary, marginTop: 3, fontSize: friends?.previewSize ?? 14 }, children: preview(item) })] }), _jsxs(View, { style: { alignItems: 'flex-end', gap: 4 }, children: [friends?.showTime !== false && _jsx(Text, { style: { color: item.unreadCount ? c.accent : c.secondary, fontSize: 12 }, children: date ? date.toDateString() === new Date().toDateString() ? date.toLocaleTimeString(uiLocale, { hour: 'numeric', minute: '2-digit' }) : date.toLocaleDateString(uiLocale, { month: 'short', day: 'numeric' }) : '' }), friends?.showUnread !== false && item.unreadCount > 0 && _jsx(View, { style: { minWidth: friends?.unreadStyle === 'dot' ? 10 : 20, height: friends?.unreadStyle === 'dot' ? 10 : 20, borderRadius: 10, borderWidth: 1.5, borderColor: c.accent, backgroundColor: friends?.unreadStyle === 'filled' || friends?.unreadStyle === 'dot' ? c.accent : undefined, alignItems: 'center', justifyContent: 'center', paddingHorizontal: friends?.unreadStyle === 'dot' ? 0 : 5 }, children: friends?.unreadStyle !== 'dot' && _jsx(Text, { style: { color: friends?.unreadStyle === 'filled' ? messagingContrastInk(c.accent) : c.accent, fontSize: 10, fontWeight: '900' }, children: item.unreadCount > 99 ? '99+' : item.unreadCount }) })] })] });
126
- } }), directorySelection && _jsxs(MessagingPopup, { screen: "profile", compact: true, title: directorySelection.name, background: c.background, foreground: c.foreground, onClose: cancelDirectory, children: [_jsx(Text, { accessibilityRole: directoryError ? 'alert' : undefined, style: { color: messagingPopupColors.foreground, fontSize: 16, lineHeight: 23, paddingVertical: 12 }, children: directoryBusy ? uiText('Opening chat…') : directoryError || directorySelection.detail }), !!directoryError && directorySelection.available && _jsx(Pressable, { accessibilityRole: "button", onPress: () => void openDirectory(directorySelection), style: { minHeight: 44, justifyContent: 'center' }, children: _jsx(Text, { style: { color: c.accent }, children: uiText('Try again') }) })] }), selected && _jsxs(_Fragment, { children: [_jsx(MessagingMenuSurface, { visible: menuVisible, onDismiss: dismissed, onClose: () => { if (!busy)
97
+ openOptions(item); }, ...(Platform.OS === 'web' ? { onContextMenu: (e) => { e.preventDefault(); openOptions(item); } } : {}), style: { flexDirection: 'row', alignItems: 'center', gap: 12, paddingHorizontal: 16, paddingVertical: rowPadding, minHeight: Math.max(44, avatar.height + rowPadding * 2), backgroundColor: item.id === selectedId ? c.accent + '15' : undefined }, children: [friends?.showAvatars !== false && (person?.avatarUrl ? _jsx(Image, { source: { uri: person.avatarUrl }, style: { ...avatar } }) : _jsx(View, { style: { ...avatar, backgroundColor: c.accent + '20', alignItems: 'center', justifyContent: 'center' }, children: _jsx(Text, { style: { color: c.accent, fontSize: 18, fontWeight: '700' }, children: title.slice(0, 1).toUpperCase() }) })), _jsxs(View, { style: { flex: 1, minWidth: 0, flexDirection: 'row', alignItems: 'flex-start', gap: 8 }, children: [_jsxs(View, { style: { flex: 1, minWidth: 0 }, children: [_jsx(Text, { numberOfLines: 1, style: { color: c.foreground, fontSize: friends?.nameSize ?? 16, fontWeight: '700' }, children: title }), friends?.showPreview !== false && _jsx(Text, { numberOfLines: friends?.previewLines ?? 1, style: { color: c.secondary, marginTop: 3, fontSize: friends?.previewSize ?? 14 }, children: preview(item) })] }), _jsxs(View, { testID: "messaging-inbox-row-meta", style: { flexShrink: 0, minWidth: 48, alignItems: 'flex-end', gap: 4, paddingTop: 1 }, children: [_jsxs(View, { style: { flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-end', gap: 4 }, children: [item.muted && _jsx(MessageIcon, { name: "notifications-off-outline", size: 13, color: c.secondary }), friends?.showTime !== false && _jsx(Text, { style: { color: item.unreadCount ? c.accent : c.secondary, fontSize: 12 }, children: date ? date.toLocaleTimeString(uiLocale, { hour: 'numeric', minute: '2-digit' }) : '' })] }), friends?.showUnread !== false && item.unreadCount > 0 && _jsx(View, { style: { minWidth: friends?.unreadStyle === 'dot' ? 10 : 20, height: friends?.unreadStyle === 'dot' ? 10 : 20, borderRadius: 10, borderWidth: 1.5, borderColor: c.accent, backgroundColor: friends?.unreadStyle === 'filled' || friends?.unreadStyle === 'dot' ? c.accent : undefined, alignItems: 'center', justifyContent: 'center', paddingHorizontal: friends?.unreadStyle === 'dot' ? 0 : 5 }, children: friends?.unreadStyle !== 'dot' && _jsx(Text, { style: { color: friends?.unreadStyle === 'filled' ? messagingContrastInk(c.accent) : c.accent, fontSize: 10, fontWeight: '900' }, children: item.unreadCount > 99 ? '99+' : item.unreadCount }) })] })] })] });
98
+ } }), onNewConversation && _jsxs(Pressable, { testID: "messaging-new-message", accessibilityRole: "button", accessibilityLabel: uiText('New message'), onPress: onNewConversation, style: { position: 'absolute', end: 16, bottom: 32, minWidth: 124, height: 52, paddingHorizontal: 18, flexDirection: 'row', gap: 9, borderRadius: 26, backgroundColor: c.accent, alignItems: 'center', justifyContent: 'center', boxShadow: '0 8px 12px #0005', elevation: 8 }, children: [_jsx(MessageIcon, { name: "chat", size: 24, color: messagingContrastInk(c.accent) }), _jsx(Text, { style: { color: messagingContrastInk(c.accent), fontSize: 16, fontWeight: '600' }, children: uiText('Message') })] }), selected && _jsxs(_Fragment, { children: [_jsx(MessagingMenuSurface, { visible: menuVisible, onDismiss: dismissed, onClose: () => { if (!busy)
127
99
  setSelected(null); }, children: rect => {
128
100
  const palette = messagingMenuColors(design, 'friends'), menuLayout = messagingMenuLayout(design.menus?.friends);
129
101
  const width = Math.min(218, rect.width - 24), top = Math.max(12, Math.min(anchor.y - rect.top, rect.height - 124));
package/dist/index.d.ts CHANGED
@@ -1,3 +1,10 @@
1
+ export { MessagingLinkedAppsScreen } from './linked-apps.js';
2
+ export type { MessagingLinkedApps, MessagingLinkedNetwork, MessagingLinkedContact } from './linked-apps.js';
3
+ export { messagingLanguages } from './account-pages.js';
4
+ export type { MessagingAccountPages, MessagingAccountPage } from './account-pages.js';
5
+ export { messagingHeaderColors } from './header-colors.js';
6
+ export { MessagingReviewInbox } from './reviews.js';
7
+ export type { MessagingReviewInboxProps } from './reviews.js';
1
8
  import { type ConversationActions } from './chat-options.js';
2
9
  export type { ConversationActions } from './chat-options.js';
3
10
  import { type MessagingHeaderOptions } from './conversation-selector.js';
@@ -117,7 +124,8 @@ export interface MessagingScreenProps {
117
124
  contact: {
118
125
  name: string;
119
126
  avatarUrl?: string;
120
- language?: string;
127
+ language?: string; /** Authenticated directory label for this contact’s network. */
128
+ networkName?: string;
121
129
  };
122
130
  /** Resolve group member names through your app's authorized contact directory. */
123
131
  participants?: Record<string, {
@@ -126,6 +134,8 @@ export interface MessagingScreenProps {
126
134
  language?: string;
127
135
  }>;
128
136
  appearance?: MessagingAppearance;
137
+ /** Appearance already loaded by the inbox, used until conversation settings arrive. */
138
+ initialAppearance?: MessagingAppearance;
129
139
  components?: MessagingComponents;
130
140
  style?: StyleProp<ViewStyle>;
131
141
  /** Set false when this conversation is covered by another route. */
@@ -195,10 +205,6 @@ export declare function GroupDiscussion({ threadRoot, onClose }: {
195
205
  threadRoot?: string;
196
206
  onClose: () => void;
197
207
  }): React.JSX.Element;
198
- export declare function messagingHeaderColors(design: MessagingAppearance, group: boolean): {
199
- background: string;
200
- foreground: string;
201
- };
202
208
  export declare function MessagingHeader({ children }?: {
203
209
  children?: ReactNode;
204
210
  }): React.JSX.Element;
@@ -216,7 +222,8 @@ export declare function MessageDeletion({ messages, onClose }: {
216
222
  export declare function MessagingList(): React.JSX.Element;
217
223
  export declare function MessagingComposer(): React.JSX.Element;
218
224
  /** Account navigation. Mount in the inbox/app toolbar, never in a contact menu. */
219
- export declare function MessagingAccountMenu({ onNewConversation, onNewGroup, onMaps, onPublicRooms }?: {
225
+ export declare function MessagingAccountMenu({ inbox, onNewGroup, onMaps, onPublicRooms }?: {
226
+ inbox?: import('@robono/messaging').MessagingInboxClient; /** @deprecated Use MessagingInbox.onNewConversation for the floating Message button. */
220
227
  onNewConversation?: () => void;
221
228
  onNewGroup?: () => void;
222
229
  onMaps?: () => void;
@@ -229,3 +236,4 @@ export { MessagingInbox, type MessagingInboxProps } from './inbox.js';
229
236
  export type { PlaybackProps } from './media-ui.js';
230
237
  export type { InboxViewMemory } from './inbox-view.js';
231
238
  export type { MessagingDirectoryContact, MessagingDirectoryOptions } from './contact-directory.js';
239
+ export { MessagingBackupScreen } from './backup.js';