@robono/messaging-react-native 0.17.0 → 0.18.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 (63) hide show
  1. package/BRIDGE-MESSENGER.md +66 -0
  2. package/CHANGELOG.md +13 -0
  3. package/README.md +21 -1
  4. package/SBOM.spdx.json +567 -279
  5. package/dist/account.js +5 -3
  6. package/dist/appearance-context.d.ts +11 -0
  7. package/dist/appearance-context.js +5 -0
  8. package/dist/attachment-menu.js +9 -6
  9. package/dist/brand.js +5 -4
  10. package/dist/calling.js +3 -2
  11. package/dist/chat-options.d.ts +12 -0
  12. package/dist/chat-options.js +25 -0
  13. package/dist/contact-directory.js +3 -3
  14. package/dist/conversation-details.d.ts +2 -0
  15. package/dist/conversation-details.js +7 -5
  16. package/dist/expo-bridge.d.ts +22 -0
  17. package/dist/expo-bridge.js +29 -0
  18. package/dist/expo-history.js +1 -1
  19. package/dist/expo-media.js +2 -2
  20. package/dist/expo-messenger.js +14 -4
  21. package/dist/expo-outbox.js +1 -1
  22. package/dist/expo-screen.js +15 -11
  23. package/dist/expo-storage-digest.d.ts +1 -0
  24. package/dist/expo-storage-digest.js +5 -0
  25. package/dist/expo.d.ts +1 -0
  26. package/dist/expo.js +1 -0
  27. package/dist/extras.d.ts +3 -1
  28. package/dist/extras.js +5 -3
  29. package/dist/forward.js +4 -3
  30. package/dist/group-editor.js +6 -3
  31. package/dist/header-calls.js +4 -3
  32. package/dist/inbox-search.js +4 -3
  33. package/dist/inbox.js +12 -9
  34. package/dist/index.d.ts +16 -2
  35. package/dist/index.js +156 -69
  36. package/dist/media-ui.js +15 -7
  37. package/dist/message-menu.d.ts +2 -1
  38. package/dist/message-menu.js +9 -4
  39. package/dist/native-outbox.d.ts +2 -1
  40. package/dist/native-outbox.js +20 -3
  41. package/dist/polls.js +10 -6
  42. package/dist/popup.d.ts +5 -2
  43. package/dist/popup.js +13 -7
  44. package/dist/public-rooms.js +4 -2
  45. package/dist/quick-send.js +2 -2
  46. package/dist/room-moderation.js +9 -4
  47. package/dist/safety.d.ts +5 -2
  48. package/dist/safety.js +16 -10
  49. package/dist/saved.js +3 -2
  50. package/dist/scheduled.js +11 -6
  51. package/dist/search.js +4 -2
  52. package/dist/sign-in.js +9 -7
  53. package/dist/social.d.ts +5 -0
  54. package/dist/social.js +4 -3
  55. package/dist/storage-digest-cache.d.ts +2 -0
  56. package/dist/storage-digest-cache.js +19 -0
  57. package/dist/translation-settings.js +5 -3
  58. package/dist/typography.d.ts +8 -3
  59. package/dist/typography.js +22 -9
  60. package/dist/use-quote-gesture.js +7 -3
  61. package/examples/existing-bridge-chat.tsx +44 -0
  62. package/package.json +11 -5
  63. package/setup.plugin.cjs +1 -0
package/dist/safety.js CHANGED
@@ -1,17 +1,19 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { messagingMenuColors } from '@robono/messaging';
2
+ import { messagingMenuLayout, messagingMenuColors } from '@robono/messaging';
3
3
  import { Text, TextInput } from './typography.js';
4
4
  import { useRobonoLocale } from './localization.js';
5
5
  import { MessagingMenuSurface } from './popup.js';
6
- import { messagingPopupColors } from './popup.js';
6
+ import { useMessagingPopupColors } from './popup.js';
7
7
  import { useEffect, useRef, useState } from 'react';
8
8
  import { MessagingPopup } from './popup.js';
9
9
  import { MessageIcon } from './icons.js';
10
10
  import { Platform, Pressable, ScrollView, View, useWindowDimensions } from 'react-native';
11
11
  /** Uses the authenticated messaging client's durable safety operations, or the host can keep its own UI. */
12
- export function MessagingSafety({ client, state, appearance, name, messageId, onClose, onSearch, onDetails, onPins, onScheduled, onSaved, children, menuAnchor }) {
12
+ export function MessagingSafety({ client, state, appearance, name, messageId, onClose, onSearch, onDetails, onMedia, onOptions, onPins, onScheduled, onSaved, children, menuAnchor, initialMode }) {
13
13
  const { text: uiText, locale: uiLocale, number: uiNumber, count: uiCount } = useRobonoLocale();
14
- const [mode, setMode] = useState(messageId ? 'report' : 'menu');
14
+ const [mode, setMode] = useState(initialMode ?? (messageId ? 'report' : 'menu'));
15
+ const styleScreen = mode === 'translation' ? 'translation' : mode === 'block' ? 'block' : 'report';
16
+ const messagingPopupColors = useMessagingPopupColors(appearance, styleScreen);
15
17
  const [category, setCategory] = useState(''), [details, setDetails] = useState(''), [busy, setBusy] = useState(false), [error, setError] = useState('');
16
18
  const reportRequest = useRef(null), reportContent = useRef('');
17
19
  const [visible, setVisible] = useState(true), afterClose = useRef(null);
@@ -25,11 +27,15 @@ export function MessagingSafety({ client, state, appearance, name, messageId, on
25
27
  event.stopPropagation();
26
28
  onClose();
27
29
  } }; document.addEventListener('keydown', close, true); return () => document.removeEventListener('keydown', close, true); }, [visible, mode, menuAnchor, onClose]);
28
- const menu = messagingMenuColors(appearance, 'chat'), items = appearance.menus?.chat?.items;
30
+ const menu = messagingMenuColors(appearance, 'chat'), items = appearance.menus?.chat?.items, layout = messagingMenuLayout(appearance.menus?.chat);
29
31
  if (items?.search === false)
30
32
  onSearch = undefined;
31
33
  if (items?.details === false)
32
34
  onDetails = undefined;
35
+ if (items?.media === false)
36
+ onMedia = undefined;
37
+ if (items?.options === false)
38
+ onOptions = undefined;
33
39
  if (items?.pins === false)
34
40
  onPins = undefined;
35
41
  if (items?.scheduled === false)
@@ -40,7 +46,7 @@ export function MessagingSafety({ client, state, appearance, name, messageId, on
40
46
  const c = { ...appearance.colors, ...messagingPopupColors }, safety = state.conversation?.safety, blocked = safety?.blockedByMe;
41
47
  const primaryInk = (() => { const hex = c.accent.replace('#', ''); const expanded = hex.length === 3 ? hex.split('').map(x => x + x).join('') : hex; const value = parseInt(expanded, 16); return Number.isFinite(value) && ((value >> 16) * .299 + ((value >> 8) & 255) * .587 + (value & 255) * .114) > 155 ? '#111111' : '#ffffff'; })();
42
48
  const button = (label, press, disabled = false, kind = 'plain') => _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: uiText(label), accessibilityState: { disabled: busy || disabled }, disabled: busy || disabled, onPress: press, style: ({ pressed }) => ({ minHeight: 44, paddingHorizontal: 12, paddingVertical: 10, justifyContent: 'center', alignItems: kind === 'plain' ? 'flex-start' : 'center', borderRadius: 12, flex: kind === 'plain' ? undefined : 1, backgroundColor: kind === 'primary' ? c.accent : kind === 'danger' ? '#b72d34' : kind === 'cancel' ? c.incoming : 'transparent', opacity: (busy || disabled) ? 0.5 : pressed ? 0.7 : 1 }), children: _jsx(Text, { style: { color: kind === 'primary' ? primaryInk : kind === 'danger' ? '#fff' : c.foreground, fontSize: 16, fontWeight: kind === 'plain' ? '400' : '600' }, children: uiText(label) }) });
43
- const menuRow = (label, icon, press, accessibilityLabel = label) => _jsxs(Pressable, { accessibilityRole: "button", accessibilityLabel: uiText(accessibilityLabel), onPress: press, style: ({ pressed }) => ({ minHeight: 44, paddingHorizontal: 12, flexDirection: 'row', alignItems: 'center', gap: 12, backgroundColor: pressed ? menu.foreground + '0c' : 'transparent' }), children: [_jsx(MessageIcon, { name: icon, color: menu.icons, size: 22 }), _jsx(Text, { style: { flex: 1, color: menu.foreground, fontSize: 15, fontWeight: '600' }, children: uiText(label) })] });
49
+ const menuRow = (label, icon, press, accessibilityLabel = label) => _jsxs(Pressable, { accessibilityRole: "button", accessibilityLabel: uiText(accessibilityLabel), onPress: press, style: ({ pressed }) => ({ minHeight: layout.rowHeight, paddingHorizontal: 12, flexDirection: 'row', alignItems: 'center', gap: 12, backgroundColor: pressed ? menu.foreground + '0c' : 'transparent' }), children: [layout.showIcons && _jsx(MessageIcon, { name: icon, color: menu.icons, size: 22 }), _jsx(Text, { style: { flex: 1, color: menu.foreground, fontSize: layout.textSize, fontWeight: '600' }, children: uiText(label) })] });
44
50
  async function block() { setBusy(true); setError(''); try {
45
51
  await client.setBlocked(!blocked);
46
52
  onClose();
@@ -76,9 +82,9 @@ export function MessagingSafety({ client, state, appearance, name, messageId, on
76
82
  }
77
83
  const choose = (next) => { afterClose.current = () => { setMode(next); setVisible(true); }; setVisible(false); };
78
84
  if (mode === 'menu' && menuAnchor) {
79
- const count = Number(!!onSearch) + Number(!!onDetails) + Number(!!onPins) + Number(!!onScheduled) + Number(!!children) + Number(!!safety?.canBlock) + Number(!!safety?.canReport), height = count * 44 + 8;
80
- return _jsx(MessagingMenuSurface, { visible: visible, onDismiss: dismissed, onClose: onClose, children: rect => _jsxs(View, { accessibilityViewIsModal: true, style: { flex: 1 }, children: [_jsx(Pressable, { accessibilityLabel: uiText("Close contact options"), onPress: onClose, style: { position: 'absolute', inset: 0 } }), _jsx(View, { testID: "messaging-contact-dropdown", style: { position: 'absolute', left: Math.max(12, Math.min(menuAnchor.x - rect.left, rect.width - Math.min(240, rect.width - 24) - 12)), top: Math.max(12, Math.min(menuAnchor.y - rect.top, rect.height - height - 12)), width: Math.min(240, rect.width - 24), maxHeight: rect.height - 24, borderRadius: 16, borderWidth: .5, borderColor: '#ffffff22', backgroundColor: menu.background, paddingVertical: 4, overflow: 'hidden', boxShadow: '0 8px 18px #0006' }, children: _jsxs(ScrollView, { bounces: false, keyboardShouldPersistTaps: "handled", children: [onDetails && menuRow(state.conversation?.kind === 'group' ? 'Group details' : 'Contact details', 'person', () => { afterClose.current = onDetails; setVisible(false); }), onPins && menuRow('Pinned messages', 'bookmark', () => { afterClose.current = onPins; setVisible(false); }), onScheduled && menuRow('Scheduled messages', 'send', () => { afterClose.current = onScheduled; setVisible(false); }), onSearch && menuRow('Search this chat', 'search', search), children && menuRow('Translation', 'translate', () => choose('translation')), safety?.canBlock && menuRow(blocked ? 'Unblock contact' : 'Block contact', 'shield', () => choose('block')), safety?.canReport && menuRow('Report', 'flag-outline', () => choose('report'))] }) })] }) });
85
+ const count = Number(!!onSearch) + Number(!!onDetails) + Number(!!onMedia) + Number(!!onOptions) + Number(!!onPins) + Number(!!onScheduled) + Number(!!children) + Number(!!safety?.canBlock) + Number(!!safety?.canReport), height = count * layout.rowHeight + 8;
86
+ return _jsx(MessagingMenuSurface, { visible: visible, onDismiss: dismissed, onClose: onClose, children: rect => _jsxs(View, { accessibilityViewIsModal: true, style: { flex: 1 }, children: [_jsx(Pressable, { accessibilityLabel: uiText("Close contact options"), onPress: onClose, style: { position: 'absolute', inset: 0 } }), _jsx(View, { testID: "messaging-contact-dropdown", style: { position: 'absolute', left: Math.max(12, Math.min(menuAnchor.x - rect.left, rect.width - Math.min(240, rect.width - 24) - 12)), top: Math.max(12, Math.min(menuAnchor.y - rect.top, rect.height - height - 12)), width: Math.min(240, rect.width - 24), maxHeight: Math.max(0, rect.height - Math.max(12, Math.min(menuAnchor.y - rect.top, rect.height - height - 12)) - 12), borderRadius: layout.radius, borderWidth: .5, borderColor: c.foreground + '22', backgroundColor: menu.background, paddingVertical: 4, overflow: 'hidden', boxShadow: '0 8px 18px #0006' }, children: _jsxs(ScrollView, { bounces: false, keyboardShouldPersistTaps: "handled", children: [onDetails && menuRow(state.conversation?.kind === 'group' ? 'Group details' : 'Profile', 'person', () => { afterClose.current = onDetails; setVisible(false); }), onMedia && menuRow('Shared media', 'image', () => { afterClose.current = onMedia; setVisible(false); }), onOptions && menuRow('Chat options', 'settings', () => { afterClose.current = onOptions; setVisible(false); }), onPins && menuRow('Pinned messages', 'bookmark', () => { afterClose.current = onPins; setVisible(false); }), onScheduled && menuRow('Scheduled messages', 'send', () => { afterClose.current = onScheduled; setVisible(false); }), onSearch && menuRow('Search this chat', 'search', search), children && menuRow('Translation', 'translate', () => choose('translation')), safety?.canBlock && menuRow(blocked ? 'Unblock contact' : 'Block contact', 'shield', () => choose('block')), safety?.canReport && menuRow('Report', 'flag-outline', () => choose('report'))] }) })] }) });
81
87
  }
82
- return _jsx(MessagingPopup, { compact: mode === 'block' || mode === 'sent', withinChat: mode === 'translation', contentWidth: 640, visible: visible, onDismiss: dismissed, background: c.background, foreground: c.foreground, closeLabel: uiText("Close contact options"), closeDisabled: busy, title: mode === 'menu' ? name : mode === 'translation' ? uiText("Translation") : mode === 'block' ? blocked ? uiText('Unblock {name}?', { name }) : uiText('Block {name}?', { name }) : mode === 'sent' ? uiText("Report sent") : messageId ? uiText("Report message") : uiText("Report conversation"), onClose: () => { if (!busy)
83
- onClose(); }, children: _jsxs(ScrollView, { keyboardShouldPersistTaps: "handled", style: { ...(mode === 'block' || mode === 'sent' ? { flexGrow: 0, flexShrink: 1 } : { flex: 1 }), minHeight: 0 }, contentContainerStyle: { gap: 20, paddingBottom: 12 }, children: [mode === 'menu' && _jsxs(_Fragment, { children: [onSearch && _jsx(View, { style: { backgroundColor: '#111111', borderRadius: 12, borderWidth: 1, borderColor: '#ffffff14', overflow: 'hidden' }, children: menuRow('Search this chat', 'search', search) }), children, (safety?.canBlock || safety?.canReport) && _jsxs(View, { style: { backgroundColor: '#111111', borderRadius: 12, borderWidth: 1, borderColor: '#ffffff14', overflow: 'hidden' }, children: [safety?.canBlock && menuRow(blocked ? 'Unblock contact' : 'Block contact', 'shield', () => setMode('block')), safety?.canReport && menuRow('Report', 'flag-outline', () => setMode('report'))] })] }), mode === 'translation' && children, mode === 'block' && _jsx(_Fragment, { children: _jsx(Text, { style: { fontSize: 14, lineHeight: 21, color: c.secondary }, children: blocked ? uiText("You will be able to message and call each other again. Messages attempted while blocked will not be delivered.") : uiText("This stops direct messages and calls between you. Your existing chat stays. They will not receive a notification that you blocked them. Shared group messages are not hidden.") }) }), mode === 'report' && _jsxs(_Fragment, { children: [_jsxs(Text, { style: { fontSize: 14, lineHeight: 21, color: c.secondary }, children: [messageId ? uiText("This message and your reason will be shared with this app’s moderation team.") : uiText("Up to five recent messages from other people in this conversation and your reason will be shared with this app’s moderation team."), uiText("Report details are kept for up to 30 days. Reporting does not block this contact.")] }), ['Spam', 'Harassment', 'Inappropriate content', 'Other'].map(value => _jsxs(Pressable, { accessibilityRole: "radio", accessibilityLabel: uiText(value), accessibilityState: { checked: category === value }, disabled: busy, onPress: () => setCategory(value), style: { minHeight: 40, flexDirection: 'row', alignItems: 'center', gap: 10 }, children: [_jsx(View, { style: { width: 18, height: 18, borderRadius: 9, borderWidth: 2, borderColor: c.accent, backgroundColor: category === value ? c.accent : 'transparent' } }), _jsx(Text, { style: { color: c.foreground, fontSize: 15 }, children: uiText(value) })] }, value)), _jsx(TextInput, { accessibilityLabel: uiText("Report details"), placeholder: uiText("Tell us what happened (optional)"), placeholderTextColor: c.secondary, value: details, onChangeText: setDetails, multiline: true, maxLength: 1800, editable: !busy, style: { color: c.foreground, minHeight: 80, borderWidth: 1, borderColor: c.secondary + '60', borderRadius: 10, padding: 12, fontSize: 15 } })] }), mode === 'sent' && _jsx(Text, { style: { color: c.secondary, fontSize: 15, lineHeight: 21 }, children: uiText("Your report was saved for review. The other person is not notified.") }), !!error && _jsx(Text, { accessibilityRole: "alert", style: { color: c.foreground }, children: error }), mode !== 'menu' && mode !== 'translation' && _jsxs(View, { style: { flexDirection: 'row', gap: 8, marginTop: 8 }, children: [(mode === 'block' || mode === 'report') && button('Cancel', onClose, false, 'cancel'), mode === 'block' && button(blocked ? 'Unblock' : 'Block', () => void block(), false, blocked ? 'primary' : 'danger'), mode === 'report' && button(busy ? 'Sending…' : 'Send report', () => void report(), !category && !details.trim(), 'primary'), mode === 'sent' && button('Done', onClose, false, 'primary')] })] }) });
88
+ return _jsx(MessagingPopup, { screen: styleScreen, compact: mode === 'block' || mode === 'sent', withinChat: mode === 'translation', contentWidth: 640, visible: visible, onDismiss: dismissed, background: c.background, foreground: c.foreground, closeLabel: uiText("Close contact options"), closeDisabled: busy, title: mode === 'menu' ? name : mode === 'translation' ? uiText("Translation") : mode === 'block' ? blocked ? uiText('Unblock {name}?', { name }) : uiText('Block {name}?', { name }) : mode === 'sent' ? uiText("Report sent") : messageId ? uiText("Report message") : uiText("Report conversation"), onClose: () => { if (!busy)
89
+ onClose(); }, children: _jsxs(ScrollView, { keyboardShouldPersistTaps: "handled", style: { ...(mode === 'block' || mode === 'sent' ? { flexGrow: 0, flexShrink: 1 } : { flex: 1 }), minHeight: 0 }, contentContainerStyle: { gap: 20, paddingBottom: 12 }, children: [mode === 'menu' && _jsxs(_Fragment, { children: [onSearch && _jsx(View, { style: { backgroundColor: c.incoming, borderRadius: 12, borderWidth: 1, borderColor: c.foreground + '14', overflow: 'hidden' }, children: menuRow('Search this chat', 'search', search) }), onDetails && menuRow(state.conversation?.kind === 'group' ? 'Group details' : 'Profile', 'person-circle-outline', () => { afterClose.current = onDetails; setVisible(false); }), onMedia && menuRow('Shared media', 'image', () => { afterClose.current = onMedia; setVisible(false); }), onOptions && menuRow('Chat options', 'settings', () => { afterClose.current = onOptions; setVisible(false); }), onPins && menuRow('Pinned messages', 'pin', () => { afterClose.current = onPins; setVisible(false); }), onScheduled && menuRow('Scheduled messages', 'time-outline', () => { afterClose.current = onScheduled; setVisible(false); }), children, (safety?.canBlock || safety?.canReport) && _jsxs(View, { style: { backgroundColor: c.incoming, borderRadius: 12, borderWidth: 1, borderColor: c.foreground + '14', overflow: 'hidden' }, children: [safety?.canBlock && menuRow(blocked ? 'Unblock contact' : 'Block contact', 'shield', () => setMode('block')), safety?.canReport && menuRow('Report', 'flag-outline', () => setMode('report'))] })] }), mode === 'translation' && children, mode === 'block' && _jsx(_Fragment, { children: _jsx(Text, { style: { fontSize: 14, lineHeight: 21, color: c.secondary }, children: blocked ? uiText("You will be able to message and call each other again. Messages attempted while blocked will not be delivered.") : uiText("This stops direct messages and calls between you. Your existing chat stays. They will not receive a notification that you blocked them. Shared group messages are not hidden.") }) }), mode === 'report' && _jsxs(_Fragment, { children: [_jsxs(Text, { style: { fontSize: 14, lineHeight: 21, color: c.secondary }, children: [messageId ? uiText("This message and your reason will be shared with this app’s moderation team.") : uiText("Up to five recent messages from other people in this conversation and your reason will be shared with this app’s moderation team."), uiText("Report details are kept for up to 30 days. Reporting does not block this contact.")] }), ['Spam', 'Harassment', 'Inappropriate content', 'Other'].map(value => _jsxs(Pressable, { accessibilityRole: "radio", accessibilityLabel: uiText(value), accessibilityState: { checked: category === value }, disabled: busy, onPress: () => setCategory(value), style: { minHeight: 40, flexDirection: 'row', alignItems: 'center', gap: 10 }, children: [_jsx(View, { style: { width: 18, height: 18, borderRadius: 9, borderWidth: 2, borderColor: c.accent, backgroundColor: category === value ? c.accent : 'transparent' } }), _jsx(Text, { style: { color: c.foreground, fontSize: 15 }, children: uiText(value) })] }, value)), _jsx(TextInput, { accessibilityLabel: uiText("Report details"), placeholder: uiText("Tell us what happened (optional)"), placeholderTextColor: c.secondary, value: details, onChangeText: setDetails, multiline: true, maxLength: 1800, editable: !busy, style: { backgroundColor: c.incoming, color: c.foreground, minHeight: 80, borderWidth: 1, borderColor: c.secondary + '60', borderRadius: 10, padding: 12, fontSize: 15 } })] }), mode === 'sent' && _jsx(Text, { style: { color: c.secondary, fontSize: 15, lineHeight: 21 }, children: uiText("Your report was saved for review. The other person is not notified.") }), !!error && _jsx(Text, { accessibilityRole: "alert", style: { color: c.foreground }, children: error }), mode !== 'menu' && mode !== 'translation' && _jsxs(View, { style: { flexDirection: 'row', gap: 8, marginTop: 8 }, children: [(mode === 'block' || mode === 'report') && button('Cancel', onClose, false, 'cancel'), mode === 'block' && button(blocked ? 'Unblock' : 'Block', () => void block(), false, blocked ? 'primary' : 'danger'), mode === 'report' && button(busy ? 'Sending…' : 'Send report', () => void report(), !category && !details.trim(), 'primary'), mode === 'sent' && button('Done', onClose, false, 'primary')] })] }) });
84
90
  }
package/dist/saved.js CHANGED
@@ -1,13 +1,14 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { Text } from './typography.js';
3
3
  import { useRobonoLocale } from './localization.js';
4
- import { messagingPopupColors } from './popup.js';
4
+ import { useMessagingPopupColors } from './popup.js';
5
5
  import { useEffect, useRef, useState } from 'react';
6
6
  import { Platform, Pressable, ScrollView, View } from 'react-native';
7
7
  import { MessagingPopup } from './popup.js';
8
8
  import { MessageIcon } from './icons.js';
9
9
  /** Same app-sized popup and media viewer as the conversation; no server-history copy. */
10
10
  export function SavedMessagesPopup({ records, appearance, onClose, onOpen, onRemove }) {
11
+ const messagingPopupColors = useMessagingPopupColors(appearance, 'saved');
11
12
  const { text: uiText, locale: uiLocale, number: uiNumber, count: uiCount } = useRobonoLocale();
12
13
  const c = { ...appearance.colors, ...messagingPopupColors }, [limit, setLimit] = useState(30), [error, setError] = useState(''), [busy, setBusy] = useState(false), [detail, setDetail] = useState(null);
13
14
  const [visible, setVisible] = useState(true), pending = useRef(null), alive = useRef(true);
@@ -45,7 +46,7 @@ export function SavedMessagesPopup({ records, appearance, onClose, onOpen, onRem
45
46
  return;
46
47
  } if (busy)
47
48
  return; setBusy(true); setError(''); pending.current = record; setVisible(false); }
48
- return _jsxs(MessagingPopup, { contentWidth: 640, visible: visible, onDismiss: () => void dismissed(), background: c.background, title: detail ? uiText("Saved message") : uiText("Saved"), foreground: c.foreground, closeLabel: detail ? uiText("Back to Saved") : uiText("Close Saved"), closeDisabled: busy, headerBack: !!detail, onClose: () => { if (!busy) {
49
+ return _jsxs(MessagingPopup, { screen: "saved", contentWidth: 640, visible: visible, onDismiss: () => void dismissed(), background: c.background, title: detail ? uiText("Saved message") : uiText("Saved"), foreground: c.foreground, closeLabel: detail ? uiText("Back to Saved") : uiText("Close Saved"), closeDisabled: busy, headerBack: !!detail, onClose: () => { if (!busy) {
49
50
  if (detail)
50
51
  setDetail(null);
51
52
  else
package/dist/scheduled.js CHANGED
@@ -1,12 +1,15 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { messagingContrastInk } from '@robono/messaging';
2
3
  import { Text, TextInput } from './typography.js';
3
4
  import { useRobonoLocale } from './localization.js';
4
5
  import { useEffect, useRef, useState } from 'react';
5
6
  import { Pressable, ScrollView, View } from 'react-native';
6
- import { MessagingPopup, messagingPopupColors as colors } from './popup.js';
7
+ import { MessagingPopup, useMessagingPopupColors } from './popup.js';
7
8
  const pad = (n) => String(n).padStart(2, '0');
8
9
  /** Same bounded popup as the other Messenger tools; all dates are shown locally. */
9
10
  export function ScheduleTimePicker({ initial, retryAt, onSave, onClose, accent, busy = false, error = '', title }) {
11
+ const colors = useMessagingPopupColors(undefined, 'schedule');
12
+ accent = colors.accent;
10
13
  const { text: uiText, locale: uiLocale, number: uiNumber, count: uiCount } = useRobonoLocale();
11
14
  title ??= uiText('Send later');
12
15
  const twelveHour = Intl.DateTimeFormat(uiLocale, { hour: 'numeric' }).resolvedOptions().hour12 === true;
@@ -35,12 +38,14 @@ export function ScheduleTimePicker({ initial, retryAt, onSave, onClose, accent,
35
38
  onSave(value.toISOString());
36
39
  };
37
40
  if (retryAt)
38
- return _jsx(MessagingPopup, { title: uiText("Confirm scheduled message"), onClose: () => { if (!busy)
39
- onClose(); }, closeDisabled: busy, background: colors.background, contentWidth: 420, children: _jsxs(View, { style: { padding: 12, gap: 16 }, children: [_jsx(Text, { style: { color: colors.foreground, fontSize: 17 }, children: uiText("The last attempt could not be confirmed. Retry to check it without creating another message.") }), _jsx(Text, { style: { color: colors.secondary, fontSize: 16 }, children: new Date(retryAt).toLocaleString(uiLocale) }), !!error && _jsx(Text, { accessibilityRole: "alert", style: { color: colors.foreground }, children: error }), _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: uiText("Retry scheduling"), disabled: busy, onPress: () => onSave(retryAt), style: { minHeight: 46, borderRadius: 12, justifyContent: 'center', alignItems: 'center', backgroundColor: accent, opacity: busy ? .5 : 1 }, children: _jsx(Text, { style: { fontSize: 16, color: '#111', fontWeight: '600' }, children: busy ? uiText("Checking…") : uiText("Retry scheduling") }) })] }) });
40
- return _jsxs(MessagingPopup, { title: title, onClose: () => { if (!busy)
41
- onClose(); }, closeDisabled: busy, background: colors.background, contentWidth: 420, children: [_jsxs(ScrollView, { keyboardShouldPersistTaps: "handled", contentContainerStyle: { padding: 12, gap: 12 }, children: [_jsx(Text, { style: { color: colors.foreground, fontSize: 17 }, children: uiText("Choose when this message should be sent.") }), _jsxs(View, { style: { flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center' }, children: [_jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: uiText("Previous month"), disabled: busy || first <= today, onPress: () => setMonth(new Date(month.getFullYear(), month.getMonth() - 1, 1)), style: { padding: 12 }, children: _jsx(Text, { style: { color: accent, fontSize: 24 }, children: "\u2039" }) }), _jsx(Text, { style: { color: colors.foreground, fontSize: 18, fontWeight: '600' }, children: month.toLocaleDateString(uiLocale, { month: 'long', year: 'numeric' }) }), _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: uiText("Next month"), disabled: busy || new Date(month.getFullYear(), month.getMonth() + 1, 1) > end, onPress: () => setMonth(new Date(month.getFullYear(), month.getMonth() + 1, 1)), style: { padding: 12 }, children: _jsx(Text, { style: { color: accent, fontSize: 24 }, children: "\u203A" }) })] }), _jsxs(View, { style: { flexDirection: 'row', flexWrap: 'wrap' }, children: [Array.from({ length: 7 }, (_, i) => new Intl.DateTimeFormat(uiLocale, { weekday: 'narrow' }).format(new Date(2026, 0, 4 + i))).map((day, i) => _jsx(Text, { style: { width: '14.285%', textAlign: 'center', color: colors.secondary, paddingBottom: 8 }, children: day }, 'week' + i)), Array.from({ length: first.getDay() }, (_, i) => _jsx(View, { style: { width: '14.285%' } }, 'blank' + i)), Array.from({ length: days }, (_, i) => { const d = new Date(month.getFullYear(), month.getMonth(), i + 1), selected = d.toDateString() === date.toDateString(), disabled = busy || d < today || d > end; return _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: d.toLocaleDateString(uiLocale, { weekday: 'long', month: 'long', day: 'numeric' }), accessibilityState: { selected, disabled }, disabled: disabled, onPress: () => choose(d), style: { width: '14.285%', height: 44, alignItems: 'center', justifyContent: 'center', borderRadius: 22, backgroundColor: selected ? accent + '30' : 'transparent', opacity: disabled ? .3 : 1 }, children: _jsx(Text, { style: { fontSize: 17, color: selected ? accent : colors.foreground, fontWeight: selected ? '700' : '400' }, children: i + 1 }) }, i); })] }), _jsxs(View, { style: { flexDirection: 'row', gap: 12, alignItems: 'center' }, children: [_jsx(Text, { style: { color: colors.foreground, fontSize: 16 }, children: twelveHour ? uiText("Time") : uiText("Time (24-hour)") }), [[hour, setHour, 'Hour'], [minute, setMinute, 'Minute']].map(([value, set, label]) => _jsx(TextInput, { accessibilityLabel: uiText(label), value: value, onChangeText: (text) => { set(text.replace(/\D/g, '').slice(0, 2)); setError(''); }, editable: !busy, keyboardType: "number-pad", maxLength: 2, selectTextOnFocus: true, style: { borderWidth: 1, borderColor: colors.secondary, borderRadius: 10, width: 56, padding: 10, color: colors.foreground, fontSize: 20, textAlign: 'center' } }, label)), twelveHour && _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: period + ', switch to ' + (period === 'AM' ? 'PM' : 'AM'), onPress: () => setPeriod(period === 'AM' ? 'PM' : 'AM'), disabled: busy, style: { minHeight: 44, justifyContent: 'center', padding: 4 }, children: _jsx(Text, { style: { color: accent, fontSize: 17, fontWeight: '600' }, children: period }) })] }), _jsx(Text, { style: { color: colors.secondary, fontSize: 14 }, children: uiText('{zone}. The app can be closed when it is time to send.', { zone }) }), !!(error || localError) && _jsx(Text, { accessibilityRole: "alert", style: { color: colors.foreground }, children: error || localError })] }), _jsx(View, { style: { paddingHorizontal: 12, paddingTop: 8, paddingBottom: 8, gap: 8 }, children: _jsx(Pressable, { accessibilityRole: "button", disabled: busy, onPress: submit, style: { minHeight: 46, borderRadius: 12, justifyContent: 'center', alignItems: 'center', backgroundColor: accent, opacity: busy ? .5 : 1 }, children: _jsx(Text, { style: { fontSize: 16, color: '#111', fontWeight: '600' }, children: busy ? uiText("Saving…") : uiText("Schedule message") }) }) })] });
41
+ return _jsx(MessagingPopup, { screen: "schedule", title: uiText("Confirm scheduled message"), onClose: () => { if (!busy)
42
+ onClose(); }, closeDisabled: busy, background: colors.background, contentWidth: 420, children: _jsxs(View, { style: { padding: 12, gap: 16 }, children: [_jsx(Text, { style: { color: colors.foreground, fontSize: 17 }, children: uiText("The last attempt could not be confirmed. Retry to check it without creating another message.") }), _jsx(Text, { style: { color: colors.secondary, fontSize: 16 }, children: new Date(retryAt).toLocaleString(uiLocale) }), !!error && _jsx(Text, { accessibilityRole: "alert", style: { color: colors.foreground }, children: error }), _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: uiText("Retry scheduling"), disabled: busy, onPress: () => onSave(retryAt), style: { minHeight: 46, borderRadius: 12, justifyContent: 'center', alignItems: 'center', backgroundColor: accent, opacity: busy ? .5 : 1 }, children: _jsx(Text, { style: { fontSize: 16, color: messagingContrastInk(accent), fontWeight: '600' }, children: busy ? uiText("Checking…") : uiText("Retry scheduling") }) })] }) });
43
+ return _jsxs(MessagingPopup, { screen: "schedule", title: title, onClose: () => { if (!busy)
44
+ onClose(); }, closeDisabled: busy, background: colors.background, contentWidth: 420, children: [_jsxs(ScrollView, { keyboardShouldPersistTaps: "handled", contentContainerStyle: { padding: 12, gap: 12 }, children: [_jsx(Text, { style: { color: colors.foreground, fontSize: 17 }, children: uiText("Choose when this message should be sent.") }), _jsxs(View, { style: { flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center' }, children: [_jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: uiText("Previous month"), disabled: busy || first <= today, onPress: () => setMonth(new Date(month.getFullYear(), month.getMonth() - 1, 1)), style: { padding: 12 }, children: _jsx(Text, { style: { color: accent, fontSize: 24 }, children: "\u2039" }) }), _jsx(Text, { style: { color: colors.foreground, fontSize: 18, fontWeight: '600' }, children: month.toLocaleDateString(uiLocale, { month: 'long', year: 'numeric' }) }), _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: uiText("Next month"), disabled: busy || new Date(month.getFullYear(), month.getMonth() + 1, 1) > end, onPress: () => setMonth(new Date(month.getFullYear(), month.getMonth() + 1, 1)), style: { padding: 12 }, children: _jsx(Text, { style: { color: accent, fontSize: 24 }, children: "\u203A" }) })] }), _jsxs(View, { style: { flexDirection: 'row', flexWrap: 'wrap' }, children: [Array.from({ length: 7 }, (_, i) => new Intl.DateTimeFormat(uiLocale, { weekday: 'narrow' }).format(new Date(2026, 0, 4 + i))).map((day, i) => _jsx(Text, { style: { width: '14.285%', textAlign: 'center', color: colors.secondary, paddingBottom: 8 }, children: day }, 'week' + i)), Array.from({ length: first.getDay() }, (_, i) => _jsx(View, { style: { width: '14.285%' } }, 'blank' + i)), Array.from({ length: days }, (_, i) => { const d = new Date(month.getFullYear(), month.getMonth(), i + 1), selected = d.toDateString() === date.toDateString(), disabled = busy || d < today || d > end; return _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: d.toLocaleDateString(uiLocale, { weekday: 'long', month: 'long', day: 'numeric' }), accessibilityState: { selected, disabled }, disabled: disabled, onPress: () => choose(d), style: { width: '14.285%', height: 44, alignItems: 'center', justifyContent: 'center', borderRadius: 22, backgroundColor: selected ? accent + '30' : 'transparent', opacity: disabled ? .3 : 1 }, children: _jsx(Text, { style: { fontSize: 17, color: selected ? accent : colors.foreground, fontWeight: selected ? '700' : '400' }, children: i + 1 }) }, i); })] }), _jsxs(View, { style: { flexDirection: 'row', gap: 12, alignItems: 'center' }, children: [_jsx(Text, { style: { color: colors.foreground, fontSize: 16 }, children: twelveHour ? uiText("Time") : uiText("Time (24-hour)") }), [[hour, setHour, 'Hour'], [minute, setMinute, 'Minute']].map(([value, set, label]) => _jsx(TextInput, { accessibilityLabel: uiText(label), value: value, onChangeText: (text) => { set(text.replace(/\D/g, '').slice(0, 2)); setError(''); }, editable: !busy, keyboardType: "number-pad", maxLength: 2, selectTextOnFocus: true, style: { backgroundColor: colors.incoming, borderWidth: 1, borderColor: colors.secondary, borderRadius: 10, width: 56, padding: 10, color: colors.foreground, fontSize: 20, textAlign: 'center' } }, label)), twelveHour && _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: period + ', switch to ' + (period === 'AM' ? 'PM' : 'AM'), onPress: () => setPeriod(period === 'AM' ? 'PM' : 'AM'), disabled: busy, style: { minHeight: 44, justifyContent: 'center', padding: 4 }, children: _jsx(Text, { style: { color: accent, fontSize: 17, fontWeight: '600' }, children: period }) })] }), _jsx(Text, { style: { color: colors.secondary, fontSize: 14 }, children: uiText('{zone}. The app can be closed when it is time to send.', { zone }) }), !!(error || localError) && _jsx(Text, { accessibilityRole: "alert", style: { color: colors.foreground }, children: error || localError })] }), _jsx(View, { style: { paddingHorizontal: 12, paddingTop: 8, paddingBottom: 8, gap: 8 }, children: _jsx(Pressable, { accessibilityRole: "button", disabled: busy, onPress: submit, style: { minHeight: 46, borderRadius: 12, justifyContent: 'center', alignItems: 'center', backgroundColor: accent, opacity: busy ? .5 : 1 }, children: _jsx(Text, { style: { fontSize: 16, color: messagingContrastInk(accent), fontWeight: '600' }, children: busy ? uiText("Saving…") : uiText("Schedule message") }) }) })] });
42
45
  }
43
46
  export function ScheduledMessages({ client, accent, onClose }) {
47
+ const colors = useMessagingPopupColors(undefined, 'scheduled');
48
+ accent = colors.accent;
44
49
  const { text: uiText, locale: uiLocale, number: uiNumber, count: uiCount } = useRobonoLocale();
45
50
  const [items, setItems] = useState([]), [loading, setLoading] = useState(true), [busy, setBusy] = useState(false), [error, setError] = useState(''), [editing, setEditing] = useState(null);
46
51
  const active = useRef(true);
@@ -76,5 +81,5 @@ export function ScheduledMessages({ client, accent, onClose }) {
76
81
  } };
77
82
  if (editing)
78
83
  return _jsx(ScheduleTimePicker, { initial: editing.sendAt, title: uiText("Reschedule message"), accent: accent, busy: busy, error: error, onSave: time => void change(editing, time), onClose: () => setEditing(null) });
79
- return _jsx(MessagingPopup, { title: uiText("Scheduled messages"), background: colors.background, onClose: onClose, contentWidth: 640, children: _jsxs(ScrollView, { contentContainerStyle: { padding: 12, gap: 12 }, children: [_jsx(Text, { style: { color: colors.secondary, fontSize: 15 }, children: uiText("Only you can see these until they are sent.") }), loading && _jsx(Text, { style: { color: colors.foreground }, children: uiText("Loading…") }), !loading && !items.length && !error && _jsx(Text, { style: { color: colors.foreground, fontSize: 17 }, children: uiText("No scheduled messages. Hold Send after writing a message to choose a time.") }), !!error && _jsx(Pressable, { onPress: () => void load(), accessibilityRole: "button", accessibilityLabel: uiText("Retry scheduled messages"), children: _jsxs(Text, { accessibilityRole: "alert", style: { color: colors.foreground }, children: [error, ' ', uiText("Tap to refresh.")] }) }), items.map(item => _jsxs(View, { style: { borderRadius: 12, backgroundColor: '#202020', padding: 12, gap: 8 }, children: [_jsxs(Text, { style: { color: colors.foreground, fontWeight: '600', fontSize: 16 }, children: [new Date(item.sendAt).toLocaleString(uiLocale, { month: 'short', day: 'numeric', hour: 'numeric', minute: '2-digit' }), " \u00B7 ", item.state === 'pending' ? uiText("Scheduled") : item.state === 'failed' ? uiText("Not sent") : item.state === 'sent' ? uiText("Sent") : uiText("Cancelled")] }), item.content && _jsx(Text, { numberOfLines: 4, style: { color: colors.foreground, fontSize: 16 }, children: item.content.text || item.content.media?.fileName || item.content.poll?.question || item.content.kind }), item.state === 'failed' && _jsxs(Text, { style: { color: colors.secondary }, children: [uiText("Not sent."), ' ', item.errorCode === 'schedule_expired' ? uiText("The sending window passed.") : item.errorCode?.includes('screening') ? uiText("The app’s safety check did not allow delivery.") : item.errorCode?.includes('billing') || item.errorCode?.includes('spending') ? uiText("The app’s spending limit or billing stopped delivery.") : uiText("Access, message rules or service availability changed.")] }), item.state === 'pending' && _jsxs(View, { style: { flexDirection: 'row', gap: 12 }, children: [_jsx(Pressable, { disabled: busy, onPress: () => setEditing(item), style: { minHeight: 44, justifyContent: 'center' }, children: _jsx(Text, { style: { color: accent, fontSize: 16 }, children: uiText("Reschedule") }) }), _jsx(Pressable, { disabled: busy, onPress: () => void change(item), style: { minHeight: 44, justifyContent: 'center' }, children: _jsx(Text, { style: { color: accent, fontSize: 16 }, children: uiText("Cancel message") }) })] })] }, item.id))] }) });
84
+ return _jsx(MessagingPopup, { screen: "scheduled", title: uiText("Scheduled messages"), background: colors.background, onClose: onClose, contentWidth: 640, children: _jsxs(ScrollView, { contentContainerStyle: { padding: 12, gap: 12 }, children: [_jsx(Text, { style: { color: colors.secondary, fontSize: 15 }, children: uiText("Only you can see these until they are sent.") }), loading && _jsx(Text, { style: { color: colors.foreground }, children: uiText("Loading…") }), !loading && !items.length && !error && _jsx(Text, { style: { color: colors.foreground, fontSize: 17 }, children: uiText("No scheduled messages. Hold Send after writing a message to choose a time.") }), !!error && _jsx(Pressable, { onPress: () => void load(), accessibilityRole: "button", accessibilityLabel: uiText("Retry scheduled messages"), children: _jsxs(Text, { accessibilityRole: "alert", style: { color: colors.foreground }, children: [error, ' ', uiText("Tap to refresh.")] }) }), items.map(item => _jsxs(View, { style: { borderRadius: 12, backgroundColor: colors.incoming, padding: 12, gap: 8 }, children: [_jsxs(Text, { style: { color: colors.foreground, fontWeight: '600', fontSize: 16 }, children: [new Date(item.sendAt).toLocaleString(uiLocale, { month: 'short', day: 'numeric', hour: 'numeric', minute: '2-digit' }), " \u00B7 ", item.state === 'pending' ? uiText("Scheduled") : item.state === 'failed' ? uiText("Not sent") : item.state === 'sent' ? uiText("Sent") : uiText("Cancelled")] }), item.content && _jsx(Text, { numberOfLines: 4, style: { color: colors.foreground, fontSize: 16 }, children: item.content.text || item.content.media?.fileName || item.content.poll?.question || item.content.kind }), item.state === 'failed' && _jsxs(Text, { style: { color: colors.secondary }, children: [uiText("Not sent."), ' ', item.errorCode === 'schedule_expired' ? uiText("The sending window passed.") : item.errorCode?.includes('screening') ? uiText("The app’s safety check did not allow delivery.") : item.errorCode?.includes('billing') || item.errorCode?.includes('spending') ? uiText("The app’s spending limit or billing stopped delivery.") : uiText("Access, message rules or service availability changed.")] }), item.state === 'pending' && _jsxs(View, { style: { flexDirection: 'row', gap: 12 }, children: [_jsx(Pressable, { disabled: busy, onPress: () => setEditing(item), style: { minHeight: 44, justifyContent: 'center' }, children: _jsx(Text, { style: { color: accent, fontSize: 16 }, children: uiText("Reschedule") }) }), _jsx(Pressable, { disabled: busy, onPress: () => void change(item), style: { minHeight: 44, justifyContent: 'center' }, children: _jsx(Text, { style: { color: accent, fontSize: 16 }, children: uiText("Cancel message") }) })] })] }, item.id))] }) });
80
85
  }
package/dist/search.js CHANGED
@@ -1,4 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { messagingScreenAppearance } from '@robono/messaging';
3
+ import { MessagingTypography } from './typography.js';
2
4
  import { Text, TextInput } from './typography.js';
3
5
  import { useRobonoLocale } from './localization.js';
4
6
  import { useEffect, useRef, useState } from 'react';
@@ -7,7 +9,7 @@ import { MessageIcon } from './icons.js';
7
9
  /** Messenger's in-conversation search: keep the chat visible and move between matches. */
8
10
  export function MessagingSearch({ client, appearance, onClose }) {
9
11
  const { text: uiText, locale: uiLocale, number: uiNumber, count: uiCount } = useRobonoLocale();
10
- const c = appearance.colors, [query, setQuery] = useState(''), [messages, setMessages] = useState([]), [index, setIndex] = useState(0), [next, setNext] = useState(null), [busy, setBusy] = useState(false), [error, setError] = useState('');
12
+ const c = messagingScreenAppearance(appearance, 'search').colors, [query, setQuery] = useState(''), [messages, setMessages] = useState([]), [index, setIndex] = useState(0), [next, setNext] = useState(null), [busy, setBusy] = useState(false), [error, setError] = useState('');
11
13
  const request = useRef(null), generation = useRef(0), timer = useRef(undefined);
12
14
  useEffect(() => () => { generation.current++; request.current?.abort(); clearTimeout(timer.current); }, []);
13
15
  async function focus(message, id) { try {
@@ -58,5 +60,5 @@ export function MessagingSearch({ client, appearance, onClose }) {
58
60
  return;
59
61
  } const target = (index + direction + messages.length) % messages.length; setIndex(target); await focus(messages[target], generation.current); }
60
62
  const nav = (label, icon, direction) => _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: label, disabled: busy || !messages.length, onPress: () => void move(direction), style: { width: 36, height: 44, alignItems: 'center', justifyContent: 'center', opacity: (busy || !messages.length) ? 0.4 : 1 }, children: _jsx(MessageIcon, { name: icon, size: 20, color: c.foreground }) });
61
- return _jsxs(View, { testID: "conversation-search", style: { backgroundColor: c.background, borderBottomWidth: 1, borderBottomColor: c.foreground + '20' }, children: [_jsxs(View, { style: { flexDirection: 'row', alignItems: 'center', paddingLeft: 10, gap: 4 }, children: [_jsx(MessageIcon, { name: "search", size: 18, color: c.secondary }), _jsx(TextInput, { accessibilityLabel: uiText("Search this chat"), placeholder: uiText("Search this chat"), value: query, onChangeText: change, onSubmitEditing: () => void search(), autoFocus: true, autoCapitalize: "none", autoCorrect: false, maxLength: 200, returnKeyType: "search", placeholderTextColor: c.secondary, style: { flex: 1, minWidth: 0, minHeight: 44, color: c.foreground, fontSize: 15 } }), busy ? _jsx(ActivityIndicator, { accessibilityLabel: uiText("Searching messages"), color: c.accent }) : !!query.trim() && _jsx(Text, { accessibilityLiveRegion: "polite", style: { color: c.secondary, fontSize: 12 }, children: messages.length ? `${index + 1}/${messages.length}${next ? '+' : ''}` : '0' }), nav('Previous search result', 'chevron-up', -1), nav('Next search result', 'chevron-down', 1), _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: uiText("Close search"), onPress: onClose, style: { width: 44, height: 44, alignItems: 'center', justifyContent: 'center' }, children: _jsx(MessageIcon, { name: "close", size: 20, color: c.foreground }) })] }), !!error && _jsx(Text, { accessibilityRole: "alert", style: { color: c.foreground, paddingHorizontal: 12, paddingBottom: 8, fontSize: 13 }, children: error })] });
63
+ return _jsx(MessagingTypography, { appearance: appearance, screen: "search", children: _jsxs(View, { testID: "conversation-search", style: { backgroundColor: c.background, borderBottomWidth: 1, borderBottomColor: c.foreground + '20' }, children: [_jsxs(View, { style: { flexDirection: 'row', alignItems: 'center', paddingLeft: 10, gap: 4 }, children: [_jsx(MessageIcon, { name: "search", size: 18, color: c.secondary }), _jsx(TextInput, { accessibilityLabel: uiText("Search this chat"), placeholder: uiText("Search this chat"), value: query, onChangeText: change, onSubmitEditing: () => void search(), autoFocus: true, autoCapitalize: "none", autoCorrect: false, maxLength: 200, returnKeyType: "search", placeholderTextColor: c.secondary, style: { flex: 1, minWidth: 0, minHeight: 44, color: c.foreground, fontSize: 15 } }), busy ? _jsx(ActivityIndicator, { accessibilityLabel: uiText("Searching messages"), color: c.accent }) : !!query.trim() && _jsx(Text, { accessibilityLiveRegion: "polite", style: { color: c.secondary, fontSize: 12 }, children: messages.length ? `${index + 1}/${messages.length}${next ? '+' : ''}` : '0' }), nav('Previous search result', 'chevron-up', -1), nav('Next search result', 'chevron-down', 1), _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: uiText("Close search"), onPress: onClose, style: { width: 44, height: 44, alignItems: 'center', justifyContent: 'center' }, children: _jsx(MessageIcon, { name: "close", size: 20, color: c.foreground }) })] }), !!error && _jsx(Text, { accessibilityRole: "alert", style: { color: c.foreground, paddingHorizontal: 12, paddingBottom: 8, fontSize: 13 }, children: error })] }) });
62
64
  }
package/dist/sign-in.js CHANGED
@@ -1,6 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Text, TextInput, MessagingTypography } from './typography.js';
3
+ import { messagingScreenAppearance } from '@robono/messaging';
2
4
  import { useRef, useState } from 'react';
3
- import { ActivityIndicator, FlatList, Image, Keyboard, KeyboardAvoidingView, Platform, Pressable, ScrollView, StyleSheet, Text, TextInput, View } from 'react-native';
5
+ import { ActivityIndicator, FlatList, Image, Keyboard, KeyboardAvoidingView, Platform, Pressable, ScrollView, StyleSheet, View } from 'react-native';
4
6
  import { defaultMessagingSettings } from '@robono/messaging';
5
7
  import { RobonoIcon } from './visual/RobonoIcon.js';
6
8
  import { MessagingMenuSurface, MessagingPopupHost } from './popup.js';
@@ -13,20 +15,20 @@ function surfaces(background) {
13
15
  }
14
16
  /** Original Messenger's card, typography, consent row and code cells, shared by web and native. */
15
17
  export function MessagingSignIn(p) {
16
- const a = p.appearance ?? defaultMessagingSettings().appearance, c = a.colors, surface = surfaces(c.background);
18
+ const styleScreen = p.stage === 'phone' ? 'signIn' : p.stage === 'code' ? 'verifyCode' : 'setupProfile', a = messagingScreenAppearance(p.appearance ?? defaultMessagingSettings().appearance, styleScreen), c = a.colors, surface = surfaces(c.background);
17
19
  const labels = { phoneSubtitle: 'Enter your mobile number to continue.', codeSubtitle: 'Enter the 6-digit code.', profileSubtitle: 'Finish setting up your account.', phone: 'Mobile number', name: 'Name', namePlaceholder: 'Your name', continue: 'Continue', verify: 'Verify', sendAgain: 'Send a new code', busy: 'Checking...', changePhone: 'Use a different number', code: 'Verification code', expired: 'Code expired', ...p.labels };
18
20
  const input = useRef(null), [focused, setFocused] = useState(false);
19
21
  const expired = p.secondsRemaining !== undefined && p.secondsRemaining <= 0;
20
22
  const disabled = !!p.busy || !!p.disabled || (p.stage === 'phone' && !p.consent.checked) || (p.stage === 'code' && !expired && p.code.length !== 6) || (p.stage === 'profile' && !p.name.trim());
21
23
  const label = p.busy ? labels.busy : p.stage === 'code' ? (expired ? labels.sendAgain : labels.verify) : labels.continue;
22
- return _jsx(MessagingPopupHost, { children: _jsx(KeyboardAvoidingView, { behavior: Platform.OS === 'ios' ? 'padding' : undefined, style: { flex: 1, minHeight: 0, backgroundColor: c.background }, children: _jsx(ScrollView, { keyboardShouldPersistTaps: "handled", contentContainerStyle: s.page, children: _jsxs(Pressable, { accessible: false, onPress: Keyboard.dismiss, style: [s.card, { backgroundColor: surface.card, borderColor: surface.border }], children: [p.logo ? _jsx(View, { style: s.logo, children: p.logo }) : a.logoUrl ? _jsx(Image, { accessibilityLabel: a.name, source: { uri: a.logoUrl }, style: s.logo, resizeMode: "contain" }) : _jsx(Text, { style: [s.brand, { color: c.foreground }], children: a.name }), _jsx(Text, { style: { color: c.secondary, fontSize: 16 }, children: p.stage === 'phone' ? labels.phoneSubtitle : p.stage === 'code' ? labels.codeSubtitle : labels.profileSubtitle }), p.stage === 'phone' ? _jsxs(_Fragment, { children: [_jsx(Text, { style: [s.label, { color: c.foreground }], children: labels.phone }), p.phoneField, _jsxs(View, { style: s.consentRow, children: [_jsx(Pressable, { accessibilityRole: "checkbox", accessibilityLabel: p.consent.title, accessibilityState: { checked: p.consent.checked, disabled: !!p.busy }, disabled: p.busy, hitSlop: 8, onPress: () => { Keyboard.dismiss(); p.consent.onChange(!p.consent.checked); }, style: [s.checkbox, { borderColor: c.accent, backgroundColor: p.consent.checked ? c.accent : 'transparent' }], children: p.consent.checked && _jsx(RobonoIcon, { name: "checkmark", size: 17, color: c.background }) }), _jsxs(View, { style: { flex: 1, minWidth: 0, gap: 4 }, children: [_jsx(Text, { style: [s.consentTitle, { color: c.foreground }], children: p.consent.title }), _jsx(Text, { style: [s.consentDetails, { color: c.secondary }], children: p.consent.details })] })] })] }) : p.stage === 'profile' ? _jsxs(_Fragment, { children: [_jsx(Text, { style: [s.label, { color: c.foreground }], children: labels.name }), _jsx(TextInput, { accessibilityLabel: labels.name, value: p.name, onChangeText: p.onNameChange, editable: !p.busy, maxLength: 80, autoCapitalize: "words", textContentType: "name", placeholder: labels.namePlaceholder, placeholderTextColor: c.secondary, style: [s.input, { color: c.foreground, backgroundColor: surface.field, borderColor: surface.border }] }), p.profileFields] }) : _jsxs(_Fragment, { children: [_jsxs(Pressable, { accessible: false, onPress: () => input.current?.focus(), style: { minHeight: 58, position: 'relative' }, children: [_jsx(View, { accessible: false, style: s.codeRow, children: Array.from({ length: 6 }, (_, i) => _jsx(View, { style: [s.codeCell, { backgroundColor: surface.field, borderColor: focused && i === Math.min(p.code.length, 5) ? c.accent : p.code[i] ? c.secondary : surface.border, borderWidth: focused && i === Math.min(p.code.length, 5) ? 2 : 1 }], children: _jsx(Text, { style: { fontSize: 28, fontWeight: '700', color: c.foreground }, children: p.code[i] ?? '' }) }, i)) }), _jsx(TextInput, { ref: input, accessibilityLabel: labels.code, value: p.code, onChangeText: v => p.onCodeChange(v.replace(/\D/g, '').slice(0, 6)), onFocus: () => setFocused(true), onBlur: () => setFocused(false), editable: !p.busy && !expired, keyboardType: "number-pad", autoComplete: "sms-otp", textContentType: "oneTimeCode", maxLength: 6, caretHidden: true, style: s.hiddenInput })] }), p.secondsRemaining !== undefined && _jsxs(View, { style: s.countdown, children: [_jsx(RobonoIcon, { name: "time-outline", size: 17, color: c.secondary }), _jsx(Text, { accessibilityLiveRegion: expired ? 'polite' : 'none', style: { color: expired ? '#EF4444' : c.secondary, fontSize: 15, fontWeight: '700', fontVariant: ['tabular-nums'] }, children: expired ? labels.expired : Math.floor(p.secondsRemaining / 60) + ':' + String(p.secondsRemaining % 60).padStart(2, '0') })] })] }), !!p.error && _jsx(Text, { accessibilityRole: "alert", style: { color: '#EF4444', fontSize: 14, lineHeight: 19 }, children: p.error }), _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: label, accessibilityState: { disabled, busy: !!p.busy }, disabled: disabled, onPress: p.onSubmit, style: [s.button, { backgroundColor: c.accent, opacity: disabled ? .45 : 1 }], children: _jsx(Text, { style: { color: c.background, fontWeight: '800' }, children: label }) }), p.stage !== 'phone' && _jsx(Pressable, { disabled: p.busy, accessibilityRole: "button", onPress: p.onChangePhone, children: _jsx(Text, { style: { color: c.accent, fontWeight: '600', textAlign: 'center', paddingVertical: 12 }, children: labels.changePhone }) })] }) }) }) });
24
+ return _jsx(MessagingTypography, { appearance: a, screen: styleScreen, children: _jsx(MessagingPopupHost, { children: _jsx(KeyboardAvoidingView, { behavior: Platform.OS === 'ios' ? 'padding' : undefined, style: { flex: 1, minHeight: 0, backgroundColor: c.background }, children: _jsx(ScrollView, { keyboardShouldPersistTaps: "handled", contentContainerStyle: s.page, children: _jsxs(Pressable, { accessible: false, onPress: Keyboard.dismiss, style: [s.card, { backgroundColor: surface.card, borderColor: surface.border }], children: [p.logo ? _jsx(View, { style: s.logo, children: p.logo }) : a.logoUrl ? _jsx(Image, { accessibilityLabel: a.name, source: { uri: a.logoUrl }, style: s.logo, resizeMode: "contain" }) : _jsx(Text, { style: [s.brand, { color: c.foreground }], children: a.name }), _jsx(Text, { style: { color: c.secondary, fontSize: 16 }, children: p.stage === 'phone' ? labels.phoneSubtitle : p.stage === 'code' ? labels.codeSubtitle : labels.profileSubtitle }), p.stage === 'phone' ? _jsxs(_Fragment, { children: [_jsx(Text, { style: [s.label, { color: c.foreground }], children: labels.phone }), p.phoneField, _jsxs(View, { style: s.consentRow, children: [_jsx(Pressable, { accessibilityRole: "checkbox", accessibilityLabel: p.consent.title, accessibilityState: { checked: p.consent.checked, disabled: !!p.busy }, disabled: p.busy, hitSlop: 8, onPress: () => { Keyboard.dismiss(); p.consent.onChange(!p.consent.checked); }, style: [s.checkbox, { borderColor: c.accent, backgroundColor: p.consent.checked ? c.accent : 'transparent' }], children: p.consent.checked && _jsx(RobonoIcon, { name: "checkmark", size: 17, color: c.background }) }), _jsxs(View, { style: { flex: 1, minWidth: 0, gap: 4 }, children: [_jsx(Text, { style: [s.consentTitle, { color: c.foreground }], children: p.consent.title }), _jsx(Text, { style: [s.consentDetails, { color: c.secondary }], children: p.consent.details })] })] })] }) : p.stage === 'profile' ? _jsxs(_Fragment, { children: [_jsx(Text, { style: [s.label, { color: c.foreground }], children: labels.name }), _jsx(TextInput, { accessibilityLabel: labels.name, value: p.name, onChangeText: p.onNameChange, editable: !p.busy, maxLength: 80, autoCapitalize: "words", textContentType: "name", placeholder: labels.namePlaceholder, placeholderTextColor: c.secondary, style: [s.input, { color: c.foreground, backgroundColor: surface.field, borderColor: surface.border }] }), p.profileFields] }) : _jsxs(_Fragment, { children: [_jsxs(Pressable, { accessible: false, onPress: () => input.current?.focus(), style: { minHeight: 58, position: 'relative' }, children: [_jsx(View, { accessible: false, style: s.codeRow, children: Array.from({ length: 6 }, (_, i) => _jsx(View, { style: [s.codeCell, { backgroundColor: surface.field, borderColor: focused && i === Math.min(p.code.length, 5) ? c.accent : p.code[i] ? c.secondary : surface.border, borderWidth: focused && i === Math.min(p.code.length, 5) ? 2 : 1 }], children: _jsx(Text, { style: { fontSize: 28, fontWeight: '700', color: c.foreground }, children: p.code[i] ?? '' }) }, i)) }), _jsx(TextInput, { ref: input, accessibilityLabel: labels.code, value: p.code, onChangeText: v => p.onCodeChange(v.replace(/\D/g, '').slice(0, 6)), onFocus: () => setFocused(true), onBlur: () => setFocused(false), editable: !p.busy && !expired, keyboardType: "number-pad", autoComplete: "sms-otp", textContentType: "oneTimeCode", maxLength: 6, caretHidden: true, style: s.hiddenInput })] }), p.secondsRemaining !== undefined && _jsxs(View, { style: s.countdown, children: [_jsx(RobonoIcon, { name: "time-outline", size: 17, color: c.secondary }), _jsx(Text, { accessibilityLiveRegion: expired ? 'polite' : 'none', style: { color: expired ? '#EF4444' : c.secondary, fontSize: 15, fontWeight: '700', fontVariant: ['tabular-nums'] }, children: expired ? labels.expired : Math.floor(p.secondsRemaining / 60) + ':' + String(p.secondsRemaining % 60).padStart(2, '0') })] })] }), !!p.error && _jsx(Text, { accessibilityRole: "alert", style: { color: '#EF4444', fontSize: 14, lineHeight: 19 }, children: p.error }), _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: label, accessibilityState: { disabled, busy: !!p.busy }, disabled: disabled, onPress: p.onSubmit, style: [s.button, { backgroundColor: c.accent, opacity: disabled ? .45 : 1 }], children: _jsx(Text, { style: { color: c.background, fontWeight: '800' }, children: label }) }), p.stage !== 'phone' && _jsx(Pressable, { disabled: p.busy, accessibilityRole: "button", onPress: p.onChangePhone, children: _jsx(Text, { style: { color: c.accent, fontWeight: '600', textAlign: 'center', paddingVertical: 12 }, children: labels.changePhone }) })] }) }) }) }) });
23
25
  }
24
26
  /** Same field proportions and divider as Messenger, with host-owned country data. */
25
27
  export function MessagingPhoneInput(p) { const c = (p.appearance ?? defaultMessagingSettings().appearance).colors, surface = surfaces(c.background); return _jsxs(View, { style: [s.phoneRow, { backgroundColor: surface.field, borderColor: surface.border }], children: [_jsxs(Pressable, { accessibilityRole: "button", accessibilityLabel: 'Country, ' + p.countryName, disabled: p.disabled, hitSlop: 4, onPress: () => { Keyboard.dismiss(); p.onChooseCountry(); }, style: s.country, children: [_jsx(Text, { style: { fontSize: 19 }, children: p.flag }), _jsx(Text, { style: { fontSize: 17, fontWeight: '700', color: c.foreground }, children: p.callingCode }), _jsx(RobonoIcon, { name: "chevron-down", size: 16, color: c.secondary })] }), _jsx(View, { style: [s.divider, { backgroundColor: surface.border }] }), _jsx(TextInput, { accessibilityLabel: p.label ?? 'Mobile number', value: p.value, onChangeText: p.onChange, editable: !p.disabled, keyboardType: "phone-pad", autoComplete: "tel-national", textContentType: "telephoneNumber", maxLength: 20, placeholder: p.placeholder, placeholderTextColor: c.secondary, style: { flex: 1, minHeight: 52, fontSize: 17, color: c.foreground } })] }); }
26
28
  /** The same compact choice list for customer sign-in, language and country fields. */
27
29
  export function MessagingChoicePicker(p) {
28
- const c = (p.appearance ?? defaultMessagingSettings().appearance).colors, surface = surfaces(c.background);
29
- return _jsx(MessagingMenuSurface, { visible: p.visible, onClose: p.onClose, children: () => _jsx(View, { style: { flex: 1, justifyContent: 'center', padding: 16, backgroundColor: 'rgba(0,0,0,.72)' }, children: _jsxs(View, { accessibilityViewIsModal: true, style: { maxHeight: '82%', width: '100%', maxWidth: 480, alignSelf: 'center', borderRadius: 8, borderWidth: 1, borderColor: surface.border, backgroundColor: c.background, overflow: 'hidden' }, children: [_jsxs(View, { style: { minHeight: 58, paddingStart: 16, paddingEnd: 58, justifyContent: 'center', borderBottomWidth: StyleSheet.hairlineWidth, borderBottomColor: surface.border, backgroundColor: surface.card }, children: [_jsx(Text, { accessibilityRole: "header", style: { color: c.foreground, fontSize: 18, fontWeight: '800' }, children: p.title }), _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: p.closeLabel ?? 'Close ' + p.title, onPress: p.onClose, style: { position: 'absolute', top: 0, end: 0, width: 58, height: 58, alignItems: 'center', justifyContent: 'center' }, children: _jsx(RobonoIcon, { name: "close", size: 22, color: c.foreground }) })] }), _jsx(FlatList, { data: p.choices, keyExtractor: row => row.value, keyboardShouldPersistTaps: "handled", contentContainerStyle: { padding: 8 }, renderItem: ({ item }) => _jsxs(Pressable, { accessibilityRole: "radio", accessibilityLabel: item.label + (item.detail ? ', ' + item.detail : ''), accessibilityState: { selected: p.selected === item.value }, onPress: () => p.onSelect(item.value), style: { minHeight: 58, borderRadius: 8, flexDirection: 'row', alignItems: 'center', gap: 12, paddingHorizontal: 12, paddingVertical: 8, backgroundColor: p.selected === item.value ? surface.field : 'transparent' }, children: [item.symbol && _jsx(Text, { style: { width: 31, fontSize: 21 }, children: item.symbol }), _jsxs(View, { style: { flex: 1, minWidth: 0 }, children: [_jsx(Text, { style: { color: c.foreground, fontSize: 16, fontWeight: '800' }, children: item.label }), item.detail && _jsx(Text, { style: { color: c.secondary, fontSize: 13, marginTop: 2 }, children: item.detail })] }), p.selected === item.value && _jsx(RobonoIcon, { name: "checkmark", size: 22, color: c.accent })] }) })] }) }) });
30
+ const a = p.appearance ?? defaultMessagingSettings().appearance, c = messagingScreenAppearance(a, 'choicePicker').colors, surface = surfaces(c.background);
31
+ return _jsx(MessagingMenuSurface, { visible: p.visible, onClose: p.onClose, children: () => _jsx(MessagingTypography, { appearance: a, screen: "choicePicker", children: _jsx(View, { style: { flex: 1, justifyContent: 'center', padding: 16, backgroundColor: 'rgba(0,0,0,.72)' }, children: _jsxs(View, { testID: "messaging-choice-picker", accessibilityViewIsModal: true, style: { maxHeight: '82%', width: '100%', maxWidth: 480, alignSelf: 'center', borderRadius: 8, borderWidth: 1, borderColor: surface.border, backgroundColor: c.background, overflow: 'hidden' }, children: [_jsxs(View, { style: { minHeight: 58, paddingStart: 16, paddingEnd: 58, justifyContent: 'center', borderBottomWidth: StyleSheet.hairlineWidth, borderBottomColor: surface.border, backgroundColor: surface.card }, children: [_jsx(Text, { accessibilityRole: "header", style: { color: c.foreground, fontSize: 18, fontWeight: '800' }, children: p.title }), _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: p.closeLabel ?? 'Close ' + p.title, onPress: p.onClose, style: { position: 'absolute', top: 0, end: 0, width: 58, height: 58, alignItems: 'center', justifyContent: 'center' }, children: _jsx(RobonoIcon, { name: "close", size: 22, color: c.foreground }) })] }), _jsx(FlatList, { data: p.choices, keyExtractor: row => row.value, keyboardShouldPersistTaps: "handled", contentContainerStyle: { padding: 8 }, renderItem: ({ item }) => _jsxs(Pressable, { accessibilityRole: "radio", accessibilityLabel: item.label + (item.detail ? ', ' + item.detail : ''), accessibilityState: { selected: p.selected === item.value }, onPress: () => p.onSelect(item.value), style: { minHeight: 58, borderRadius: 8, flexDirection: 'row', alignItems: 'center', gap: 12, paddingHorizontal: 12, paddingVertical: 8, backgroundColor: p.selected === item.value ? surface.field : 'transparent' }, children: [item.symbol && _jsx(Text, { style: { width: 31, fontSize: 21 }, children: item.symbol }), _jsxs(View, { style: { flex: 1, minWidth: 0 }, children: [_jsx(Text, { style: { color: c.foreground, fontSize: 16, fontWeight: '800' }, children: item.label }), item.detail && _jsx(Text, { style: { color: c.secondary, fontSize: 13, marginTop: 2 }, children: item.detail })] }), p.selected === item.value && _jsx(RobonoIcon, { name: "checkmark", size: 22, color: c.accent })] }) })] }) }) }) });
30
32
  }
31
33
  // Measurements copied from src/AppRoot.tsx authCard/phoneInput/codeCell/smsConsent styles.
32
34
  // Keep behavior and presentation here: the consumer app must not fork these screens.
@@ -41,6 +43,6 @@ const s = StyleSheet.create({
41
43
  countdown: { alignSelf: 'center', flexDirection: 'row', alignItems: 'center', gap: 6, direction: 'ltr' }, button: { minHeight: 48, borderRadius: 8, alignItems: 'center', justifyContent: 'center', paddingHorizontal: 16 },
42
44
  });
43
45
  export function MessagingConnectionState({ appearance, error, onRetry, onSignOut, labels }) {
44
- const colors = (appearance ?? defaultMessagingSettings().appearance).colors;
45
- return _jsxs(View, { style: { flex: 1, minHeight: 160, backgroundColor: colors.background, alignItems: 'center', justifyContent: 'center', padding: 24, gap: 16 }, children: [!error && _jsx(ActivityIndicator, { color: colors.accent }), _jsx(Text, { accessibilityRole: error ? 'alert' : undefined, accessibilityLiveRegion: "polite", style: { color: colors.foreground, fontSize: 17, lineHeight: 25, textAlign: 'center', maxWidth: 400 }, children: error || labels?.loading || 'Opening Messenger…' }), error && onRetry && _jsx(Pressable, { accessibilityRole: "button", onPress: onRetry, style: { minHeight: 48, minWidth: 180, paddingHorizontal: 24, alignItems: 'center', justifyContent: 'center', backgroundColor: colors.accent, borderRadius: 8 }, children: _jsx(Text, { style: { color: colors.background, fontSize: 16, fontWeight: '700' }, children: labels?.retry || 'Try again' }) }), error && onSignOut && _jsx(Pressable, { accessibilityRole: "button", onPress: onSignOut, style: { minHeight: 44, justifyContent: 'center', paddingHorizontal: 16 }, children: _jsx(Text, { style: { color: colors.accent, fontSize: 16 }, children: labels?.signOut || 'Sign out' }) })] });
46
+ const a = appearance ?? defaultMessagingSettings().appearance, colors = messagingScreenAppearance(a, 'connection').colors;
47
+ return _jsx(MessagingTypography, { appearance: a, screen: "connection", children: _jsxs(View, { style: { flex: 1, minHeight: 160, backgroundColor: colors.background, alignItems: 'center', justifyContent: 'center', padding: 24, gap: 16 }, children: [!error && _jsx(ActivityIndicator, { color: colors.accent }), _jsx(Text, { accessibilityRole: error ? 'alert' : undefined, accessibilityLiveRegion: "polite", style: { color: colors.foreground, fontSize: 17, lineHeight: 25, textAlign: 'center', maxWidth: 400 }, children: error || labels?.loading || 'Opening Messenger…' }), error && onRetry && _jsx(Pressable, { accessibilityRole: "button", onPress: onRetry, style: { minHeight: 48, minWidth: 180, paddingHorizontal: 24, alignItems: 'center', justifyContent: 'center', backgroundColor: colors.accent, borderRadius: 8 }, children: _jsx(Text, { style: { color: colors.background, fontSize: 16, fontWeight: '700' }, children: labels?.retry || 'Try again' }) }), error && onSignOut && _jsx(Pressable, { accessibilityRole: "button", onPress: onSignOut, style: { minHeight: 44, justifyContent: 'center', paddingHorizontal: 16 }, children: _jsx(Text, { style: { color: colors.accent, fontSize: 16 }, children: labels?.signOut || 'Sign out' }) })] }) });
46
48
  }
package/dist/social.d.ts CHANGED
@@ -22,4 +22,9 @@ interface SocialMessagePreviewProps {
22
22
  export declare const SocialMessagePreview: React.ForwardRefExoticComponent<SocialMessagePreviewProps & React.RefAttributes<{
23
23
  open: () => void;
24
24
  }>>;
25
+ export declare function SocialPreviewPopup({ message, client, Player, origin, provider, url, accent, foreground, background, onClose }: SocialMessagePreviewProps & {
26
+ provider: string;
27
+ url: string;
28
+ onClose: () => void;
29
+ }): React.JSX.Element;
25
30
  export {};
package/dist/social.js CHANGED
@@ -4,7 +4,7 @@ import { useRobonoLocale } from './localization.js';
4
4
  import { forwardRef, useImperativeHandle, useEffect, useState } from 'react';
5
5
  import { ActivityIndicator, AppState, Linking, Pressable, View } from 'react-native';
6
6
  import { socialShare } from '@robono/messaging';
7
- import { MessagingPopup } from './popup.js';
7
+ import { MessagingPopup, useMessagingPopupColors } from './popup.js';
8
8
  import { MessageIcon } from './icons.js';
9
9
  import { messageLinks } from './message-links.js';
10
10
  export const SocialMessagePreview = forwardRef(function SocialMessagePreview({ message, client, Player, origin, accent, foreground, background, onLongPress, renderMessage }, ref) {
@@ -21,8 +21,9 @@ export const SocialMessagePreview = forwardRef(function SocialMessagePreview({ m
21
21
  const action = _jsx(Pressable, { testID: "social-preview-action", hitSlop: 6, accessibilityRole: "button", accessibilityLabel: uiText("Play {value1} preview", { value1: share.provider }), onLongPress: onLongPress, onPress: event => { event.stopPropagation(); setOpened({ client, message }); }, style: ({ pressed }) => ({ flexShrink: 0, width: 32, height: 32, borderRadius: 16, borderWidth: 1, borderColor: accent + '70', backgroundColor: accent + (pressed ? '30' : '0d'), flexDirection: 'row', alignItems: 'center', justifyContent: 'center' }), children: _jsx(MessageIcon, { name: "play", color: accent, size: 16 }) });
22
22
  return _jsxs(_Fragment, { children: [renderMessage ? renderMessage(action) : action, open && _jsx(SocialPreviewPopup, { message: message, client: client, Player: Player, origin: origin, provider: share.provider, url: share.url, accent: accent, foreground: foreground, background: background, onClose: () => setOpened(null) }, message.id)] });
23
23
  });
24
- function SocialPreviewPopup({ message, client, Player, origin, provider, url, accent, foreground, background, onClose }) {
24
+ export function SocialPreviewPopup({ message, client, Player, origin, provider, url, accent, foreground, background, onClose }) {
25
25
  const { text: uiText, locale: uiLocale, number: uiNumber, count: uiCount } = useRobonoLocale();
26
+ const palette = useMessagingPopupColors(undefined, 'social');
26
27
  const [preview, setPreview] = useState(null), [busy, setBusy] = useState(true), [error, setError] = useState('');
27
28
  useEffect(() => { let active = true; void client.socialPreview(message.id, origin).then(result => { if (active) {
28
29
  setPreview(result);
@@ -31,5 +32,5 @@ function SocialPreviewPopup({ message, client, Player, origin, provider, url, ac
31
32
  } }).catch(() => { if (active)
32
33
  setError(uiText("This preview could not be loaded. Open the original below.")); }).finally(() => { if (active)
33
34
  setBusy(false); }); return () => { active = false; }; }, [client, message.id, origin]);
34
- return _jsxs(MessagingPopup, { expanded: true, bottomPadding: 4, background: "#000000", title: provider, foreground: "#ffffff", closeLabel: uiText("Close social preview"), onClose: onClose, children: [busy && _jsx(View, { style: { flex: 1, alignItems: 'center', justifyContent: 'center' }, children: _jsx(ActivityIndicator, { accessibilityLabel: uiText("Loading social preview"), color: accent }) }), !!preview?.html && _jsx(View, { testID: "social-preview-player", style: { flex: 1, minHeight: 0, overflow: 'hidden', borderRadius: 10 }, children: _jsx(Player, { html: preview.html, frame: preview.frame, origin: origin, provider: provider, onClose: onClose, onError: () => setError(uiText("This preview is unavailable. Open the original below.")) }) }), !!error && _jsx(Text, { accessibilityRole: "alert", style: { color: '#ffffff', fontSize: 13, paddingVertical: 8 }, children: error }), _jsx(Pressable, { accessibilityRole: "link", accessibilityLabel: uiText("Open {value1}", { value1: provider }), onPress: () => { void Linking.openURL(url).catch(() => setError(uiText("This link could not be opened."))); }, style: { minHeight: 44, justifyContent: 'center' }, children: _jsxs(Text, { style: { color: accent, fontWeight: '600' }, children: [uiText("Open"), provider] }) })] });
35
+ return _jsxs(MessagingPopup, { screen: "social", expanded: true, bottomPadding: 4, background: palette.background, title: provider, foreground: palette.foreground, closeLabel: uiText("Close social preview"), onClose: onClose, children: [busy && _jsx(View, { style: { flex: 1, alignItems: 'center', justifyContent: 'center' }, children: _jsx(ActivityIndicator, { accessibilityLabel: uiText("Loading social preview"), color: accent }) }), !!preview?.html && _jsx(View, { testID: "social-preview-player", style: { flex: 1, minHeight: 0, overflow: 'hidden', borderRadius: 10 }, children: _jsx(Player, { html: preview.html, frame: preview.frame, origin: origin, provider: provider, onClose: onClose, onError: () => setError(uiText("This preview is unavailable. Open the original below.")) }) }), !!error && _jsx(Text, { accessibilityRole: "alert", style: { color: palette.foreground, fontSize: 13, paddingVertical: 8 }, children: error }), _jsx(Pressable, { accessibilityRole: "link", accessibilityLabel: uiText("Open {value1}", { value1: provider }), onPress: () => { void Linking.openURL(url).catch(() => setError(uiText("This link could not be opened."))); }, style: { minHeight: 44, justifyContent: 'center' }, children: _jsxs(Text, { style: { color: palette.accent, fontWeight: '600' }, children: [uiText("Open"), provider] }) })] });
35
36
  }
@@ -0,0 +1,2 @@
1
+ /** Bounded path-hash reuse only: never caches files, credentials or permissions. */
2
+ export declare function cacheStorageDigest(digest: (value: string) => Promise<string>, limit?: number): (value: string) => Promise<string>;
@@ -0,0 +1,19 @@
1
+ /** Bounded path-hash reuse only: never caches files, credentials or permissions. */
2
+ export function cacheStorageDigest(digest, limit = 128) {
3
+ const entries = new Map();
4
+ return (value) => {
5
+ const existing = entries.get(value);
6
+ if (existing) {
7
+ entries.delete(value);
8
+ entries.set(value, existing);
9
+ return existing;
10
+ }
11
+ const result = Promise.resolve().then(() => digest(value));
12
+ entries.set(value, result);
13
+ while (entries.size > limit)
14
+ entries.delete(entries.keys().next().value);
15
+ void result.catch(() => { if (entries.get(value) === result)
16
+ entries.delete(value); });
17
+ return result;
18
+ };
19
+ }
@@ -1,21 +1,23 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { messagingContrastInk } from '@robono/messaging';
2
3
  import { Text } from './typography.js';
3
4
  import { useRobonoLocale } from './localization.js';
4
5
  import { MessageIcon } from './icons.js';
5
- import { messagingPopupColors } from './popup.js';
6
+ import { useMessagingPopupColors } from './popup.js';
6
7
  import { useEffect, useState } from 'react';
7
8
  import { Pressable, ScrollView, View } from 'react-native';
8
9
  import { normalizeLanguageCode, supportedLanguages, supportedLanguageLabel } from '@robono/messaging';
9
10
  /** The choice belongs to the conversation, never to an individual message. */
10
11
  export function TranslationSettings({ client, appearance, preference, language, sourceLanguage, voiceAvailable, onSaved }) {
12
+ const messagingPopupColors = useMessagingPopupColors(appearance, 'translation');
11
13
  const { text: uiText, locale: uiLocale, number: uiNumber, count: uiCount } = useRobonoLocale();
12
14
  const [value, setValue] = useState(() => preference ? { ...preference, mode: preference.mode === 'voice' && !voiceAvailable ? 'text' : preference.mode } : { mode: 'off', language: normalizeLanguageCode(language ?? Intl.DateTimeFormat().resolvedOptions().locale) ?? 'en', sourceLanguage: normalizeLanguageCode(sourceLanguage) });
13
15
  const [choosing, setChoosing] = useState(null), [busy, setBusy] = useState(false), [error, setError] = useState('');
14
16
  const c = { ...appearance.colors, ...messagingPopupColors };
15
17
  useEffect(() => { if (!voiceAvailable)
16
18
  setValue(value => value.mode === 'voice' ? { ...value, mode: 'text' } : value); }, [voiceAvailable]);
17
- return _jsxs(View, { style: { gap: 8 }, children: [_jsx(Text, { style: { fontSize: 13, fontWeight: '600', color: c.secondary, paddingHorizontal: 4 }, children: uiText("Translation") }), _jsxs(View, { style: { backgroundColor: '#111111', borderRadius: 12, borderWidth: 1, borderColor: '#ffffff14', padding: 12, gap: 4 }, children: [_jsx(View, { accessibilityRole: "radiogroup", style: { flexDirection: 'row', borderWidth: 1, borderColor: '#ffffff14', borderRadius: 9, overflow: 'hidden', padding: 3, gap: 3 }, children: ['off', 'text', 'voice'].filter(mode => mode !== 'voice' || voiceAvailable).map(mode => _jsx(Pressable, { accessibilityRole: "radio", accessibilityLabel: uiText('Translation: {mode}', { mode: mode === 'off' ? uiText('Off') : mode === 'text' ? uiText('Text') : uiText('Voice') }), accessibilityState: { checked: value.mode === mode, disabled: busy || mode === 'voice' && !voiceAvailable }, disabled: busy || mode === 'voice' && !voiceAvailable, onPress: () => setValue(v => ({ ...v, mode })), style: { flex: 1, minHeight: 36, borderRadius: 6, alignItems: 'center', justifyContent: 'center', backgroundColor: value.mode === mode ? c.accent + '25' : 'transparent', opacity: mode === 'voice' && !voiceAvailable ? .4 : 1 }, children: _jsx(Text, { style: { color: value.mode === mode ? c.accent : c.secondary, fontSize: 14, fontWeight: '600' }, children: mode === 'off' ? uiText("Off") : mode === 'text' ? uiText("Text") : uiText("Voice") }) }, mode)) }), ['sourceLanguage', 'language'].map(field => _jsxs(View, { children: [_jsxs(Pressable, { accessibilityRole: "button", accessibilityLabel: field === 'language' ? uiText("Translation language") : uiText("Incoming language"), disabled: busy, onPress: () => setChoosing(choosing === field ? null : field), style: { minHeight: 48, flexDirection: 'row', alignItems: 'center', gap: 10, borderBottomWidth: field === 'sourceLanguage' ? 1 : 0, borderBottomColor: '#ffffff14' }, children: [_jsx(Text, { style: { flex: 1, color: c.secondary, fontSize: 14 }, children: field === 'language' ? uiText("Translate into") : uiText("Messages in") }), _jsx(Text, { style: { color: c.accent, fontSize: 15, flexShrink: 1, textAlign: 'right' }, children: value[field] ? supportedLanguageLabel(value[field]) : uiText("Choose language") }), _jsx(MessageIcon, { name: choosing === field ? 'chevron-up' : 'chevron-down', color: c.secondary, size: 16 })] }), choosing === field && _jsx(ScrollView, { style: { maxHeight: 180 }, keyboardShouldPersistTaps: "handled", children: supportedLanguages.map(item => _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: uiText('Choose {language}', { language: item.name }), onPress: () => { setValue(v => ({ ...v, [field]: item.code })); setChoosing(null); }, style: { minHeight: 40, paddingHorizontal: 8, justifyContent: 'center' }, children: _jsx(Text, { style: { color: c.foreground }, children: item.name }) }, item.code)) })] }, field)), !!error && _jsx(Text, { accessibilityRole: "alert", style: { color: c.foreground }, children: error }), _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: uiText("Save translation preference"), disabled: busy, onPress: () => { if (value.mode !== 'off' && !value.sourceLanguage) {
19
+ return _jsxs(View, { style: { gap: 8 }, children: [_jsx(Text, { style: { fontSize: 13, fontWeight: '600', color: c.secondary, paddingHorizontal: 4 }, children: uiText("Translation") }), _jsxs(View, { style: { backgroundColor: c.incoming, borderRadius: 12, borderWidth: 1, borderColor: c.foreground + '14', padding: 12, gap: 4 }, children: [_jsx(View, { accessibilityRole: "radiogroup", style: { flexDirection: 'row', borderWidth: 1, borderColor: c.foreground + '14', borderRadius: 9, overflow: 'hidden', padding: 3, gap: 3 }, children: ['off', 'text', 'voice'].filter(mode => mode !== 'voice' || voiceAvailable).map(mode => _jsx(Pressable, { accessibilityRole: "radio", accessibilityLabel: uiText('Translation: {mode}', { mode: mode === 'off' ? uiText('Off') : mode === 'text' ? uiText('Text') : uiText('Voice') }), accessibilityState: { checked: value.mode === mode, disabled: busy || mode === 'voice' && !voiceAvailable }, disabled: busy || mode === 'voice' && !voiceAvailable, onPress: () => setValue(v => ({ ...v, mode })), style: { flex: 1, minHeight: 36, borderRadius: 6, alignItems: 'center', justifyContent: 'center', backgroundColor: value.mode === mode ? c.accent + '25' : 'transparent', opacity: mode === 'voice' && !voiceAvailable ? .4 : 1 }, children: _jsx(Text, { style: { color: value.mode === mode ? c.accent : c.secondary, fontSize: 14, fontWeight: '600' }, children: mode === 'off' ? uiText("Off") : mode === 'text' ? uiText("Text") : uiText("Voice") }) }, mode)) }), ['sourceLanguage', 'language'].map(field => _jsxs(View, { children: [_jsxs(Pressable, { accessibilityRole: "button", accessibilityLabel: field === 'language' ? uiText("Translation language") : uiText("Incoming language"), disabled: busy, onPress: () => setChoosing(choosing === field ? null : field), style: { minHeight: 48, flexDirection: 'row', alignItems: 'center', gap: 10, borderBottomWidth: field === 'sourceLanguage' ? 1 : 0, borderBottomColor: c.foreground + '14' }, children: [_jsx(Text, { style: { flex: 1, color: c.secondary, fontSize: 14 }, children: field === 'language' ? uiText("Translate into") : uiText("Messages in") }), _jsx(Text, { style: { color: c.accent, fontSize: 15, flexShrink: 1, textAlign: 'right' }, children: value[field] ? supportedLanguageLabel(value[field]) : uiText("Choose language") }), _jsx(MessageIcon, { name: choosing === field ? 'chevron-up' : 'chevron-down', color: c.secondary, size: 16 })] }), choosing === field && _jsx(ScrollView, { style: { maxHeight: 180 }, keyboardShouldPersistTaps: "handled", children: supportedLanguages.map(item => _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: uiText('Choose {language}', { language: item.name }), onPress: () => { setValue(v => ({ ...v, [field]: item.code })); setChoosing(null); }, style: { minHeight: 40, paddingHorizontal: 8, justifyContent: 'center' }, children: _jsx(Text, { style: { color: c.foreground }, children: item.name }) }, item.code)) })] }, field)), !!error && _jsx(Text, { accessibilityRole: "alert", style: { color: c.foreground }, children: error }), _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: uiText("Save translation preference"), disabled: busy, onPress: () => { if (value.mode !== 'off' && !value.sourceLanguage) {
18
20
  setError(uiText("Choose the incoming language once for this conversation."));
19
21
  return;
20
- } setError(''); setBusy(true); void client.setTranslationPreference(value).then(onSaved).catch(() => setError(uiText("The translation preference could not be saved. Try again."))).finally(() => setBusy(false)); }, style: { minHeight: 40, minWidth: 96, paddingHorizontal: 18, marginTop: 8, alignSelf: 'flex-end', alignItems: 'center', justifyContent: 'center', borderRadius: 9, backgroundColor: c.accent, opacity: busy ? 0.5 : 1 }, children: _jsx(Text, { style: { color: '#111111', fontSize: 14, fontWeight: '600' }, children: busy ? uiText("Saving…") : uiText("Save") }) })] })] });
22
+ } setError(''); setBusy(true); void client.setTranslationPreference(value).then(onSaved).catch(() => setError(uiText("The translation preference could not be saved. Try again."))).finally(() => setBusy(false)); }, style: { minHeight: 40, minWidth: 96, paddingHorizontal: 18, marginTop: 8, alignSelf: 'flex-end', alignItems: 'center', justifyContent: 'center', borderRadius: 9, backgroundColor: c.accent, opacity: busy ? 0.5 : 1 }, children: _jsx(Text, { style: { color: messagingContrastInk(c.accent), fontSize: 14, fontWeight: '600' }, children: busy ? uiText("Saving…") : uiText("Save") }) })] })] });
21
23
  }
@@ -1,12 +1,17 @@
1
1
  import React from 'react';
2
2
  import { Text as NativeText, TextInput as NativeTextInput, type TextProps, type TextInputProps } from 'react-native';
3
- import type { MessagingAppearance } from '@robono/messaging';
3
+ import { type MessagingAppearance, type MessagingFont, type MessagingStyleScreen } from '@robono/messaging';
4
+ /** Installed system families: no remote font fetch during Messenger startup. */
5
+ export declare function messagingFontFamily(font?: MessagingFont): string | undefined;
4
6
  /** Local to this Messenger. Does not change host-app text or device accessibility scaling. */
5
- export declare function MessagingTypography({ appearance, children }: {
7
+ export declare function MessagingTypography({ appearance, children, screen }: {
6
8
  appearance: MessagingAppearance;
7
9
  children: React.ReactNode;
10
+ screen?: MessagingStyleScreen;
8
11
  }): React.JSX.Element;
9
12
  export type Text = NativeText;
10
- export declare const Text: React.ForwardRefExoticComponent<TextProps & React.RefAttributes<NativeText>>;
13
+ export declare const Text: React.ForwardRefExoticComponent<TextProps & {
14
+ inheritEmphasis?: boolean;
15
+ } & React.RefAttributes<NativeText>>;
11
16
  export type TextInput = NativeTextInput;
12
17
  export declare const TextInput: React.ForwardRefExoticComponent<TextInputProps & React.RefAttributes<NativeTextInput>>;
@@ -1,18 +1,31 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { MessagingAppearanceContext } from './appearance-context.js';
2
3
  import { createContext, forwardRef, useContext, useMemo } from 'react';
3
4
  import { Platform, StyleSheet, Text as NativeText, TextInput as NativeTextInput } from 'react-native';
4
- const defaults = { fontFamily: undefined, scale: 1 };
5
+ import { messagingScreenStyle } from '@robono/messaging';
6
+ /** Installed system families: no remote font fetch during Messenger startup. */
7
+ export function messagingFontFamily(font = 'system') {
8
+ const families = { system: [undefined, undefined, undefined], sans: ['Helvetica', 'sans-serif', 'Arial, Helvetica, sans-serif'], humanist: ['Avenir Next', 'sans-serif', 'Trebuchet MS, sans-serif'], condensed: ['AvenirNextCondensed-Regular', 'sans-serif-condensed', 'Arial Narrow, Liberation Sans Narrow, sans-serif'], serif: ['Georgia', 'serif', 'Georgia, Times New Roman, serif'], monospace: ['Menlo', 'monospace', 'Menlo, Consolas, monospace'] };
9
+ return families[font]?.[Platform.OS === 'ios' ? 0 : Platform.OS === 'android' ? 1 : 2];
10
+ }
11
+ const defaults = { fontFamily: undefined, scale: 1, emphasis: {} };
5
12
  const Typography = createContext(defaults), InsideText = createContext(false);
6
13
  /** Local to this Messenger. Does not change host-app text or device accessibility scaling. */
7
- export function MessagingTypography({ appearance, children }) {
8
- const font = appearance.presentation?.font ?? 'system', scale = appearance.presentation?.textScale ?? 1;
9
- const value = useMemo(() => ({ fontFamily: font === 'serif' ? Platform.OS === 'ios' ? 'Georgia' : Platform.OS === 'web' ? 'Georgia, "Times New Roman", serif' : 'serif' : font === 'monospace' ? Platform.OS === 'ios' ? 'Menlo' : Platform.OS === 'web' ? 'Menlo, Consolas, monospace' : 'monospace' : undefined, scale: [1, 1.15, 1.3].includes(scale) ? scale : 1 }), [font, scale]);
10
- return _jsx(Typography.Provider, { value: value, children: children });
14
+ export function MessagingTypography({ appearance, children, screen = 'main' }) {
15
+ const text = messagingScreenStyle(appearance, screen).typography ?? {}, scale = text.textScale ?? 1;
16
+ const value = useMemo(() => ({ fontFamily: messagingFontFamily(text.font), scale: [1, 1.15, 1.3].includes(scale) ? scale : 1, emphasis: text }), [text.font, text.bold, text.italic, text.underline, scale]);
17
+ return _jsx(MessagingAppearanceContext.Provider, { value: appearance, children: _jsx(Typography.Provider, { value: value, children: children }) });
11
18
  }
12
- function useTextStyle(style, nested = false) {
13
- const { fontFamily, scale } = useContext(Typography), flat = StyleSheet.flatten(style) ?? {};
19
+ function useTextStyle(style, nested = false, inheritEmphasis = true) {
20
+ const { fontFamily, scale, emphasis } = useContext(Typography), flat = StyleSheet.flatten(style) ?? {};
14
21
  const base = typeof flat.fontSize === 'number' ? flat.fontSize : nested ? undefined : 14;
15
22
  const resolved = { ...(fontFamily ? { fontFamily } : {}), ...flat };
23
+ if (inheritEmphasis && emphasis.bold !== undefined)
24
+ resolved.fontWeight = emphasis.bold ? '700' : '400';
25
+ if (inheritEmphasis && emphasis.italic !== undefined)
26
+ resolved.fontStyle = emphasis.italic ? 'italic' : 'normal';
27
+ if (inheritEmphasis && emphasis.underline !== undefined)
28
+ resolved.textDecorationLine = emphasis.underline ? 'underline' : 'none';
16
29
  if (scale !== 1) {
17
30
  if (base !== undefined)
18
31
  resolved.fontSize = base * scale;
@@ -21,8 +34,8 @@ function useTextStyle(style, nested = false) {
21
34
  }
22
35
  return resolved;
23
36
  }
24
- export const Text = forwardRef(function MessagingText({ style, children, ...props }, ref) {
25
- const nested = useContext(InsideText), resolved = useTextStyle(style, nested);
37
+ export const Text = forwardRef(function MessagingText({ style, children, inheritEmphasis = true, ...props }, ref) {
38
+ const nested = useContext(InsideText), resolved = useTextStyle(style, nested, inheritEmphasis);
26
39
  return _jsx(InsideText.Provider, { value: true, children: _jsx(NativeText, { ...props, ref: ref, style: resolved, children: children }) });
27
40
  });
28
41
  export const TextInput = forwardRef(function MessagingTextInput({ style, ...props }, ref) {
@@ -1,4 +1,4 @@
1
- import { useEffect, useRef, useState } from 'react';
1
+ import { useEffect, useMemo, useRef, useState } from 'react';
2
2
  import { Animated, Easing, I18nManager, PanResponder, Platform } from 'react-native';
3
3
  // Same travel, trigger and return timing as Messenger's MessageSwipeReveal.
4
4
  export const messageInfoRevealWidth = 176;
@@ -9,6 +9,10 @@ export function useQuoteGesture(enabled, outgoing, quote, details, onQuoteReady)
9
9
  const [webOffset, setWebOffset] = useState(0);
10
10
  const [webDragging, setWebDragging] = useState(false);
11
11
  const direction = (outgoing !== !!I18nManager.isRTL) ? -1 : 1;
12
+ // Keep native animation nodes attached across receipt and history updates.
13
+ // Recreating interpolations on every bubble redraw rebuilds the native graph.
14
+ const nativeInfoOpacity = useMemo(() => offset.interpolate({ inputRange: direction === 1 ? [-24, -8, 0] : [0, 8, 24], outputRange: direction === 1 ? [1, .35, 0] : [0, .35, 1], extrapolate: 'clamp' }), [offset, direction]);
15
+ const nativeRevealOpacity = useMemo(() => offset.interpolate({ inputRange: direction === -1 ? [-messageReplyRevealWidth, -18, 0] : [0, 18, messageReplyRevealWidth], outputRange: direction === -1 ? [1, .35, 0] : [0, .35, 1], extrapolate: 'clamp' }), [offset, direction]);
12
16
  const [infoLoaded, setInfoLoaded] = useState(false);
13
17
  const quoteReady = useRef(false);
14
18
  const current = useRef({ enabled, direction, quote, details, onQuoteReady });
@@ -141,9 +145,9 @@ export function useQuoteGesture(enabled, outgoing, quote, details, onQuoteReady)
141
145
  return { offset: Platform.OS === 'web' ? webOffset : offset,
142
146
  webRef: Platform.OS === 'web' ? webRef : undefined,
143
147
  infoLoaded,
144
- infoOpacity: Platform.OS === 'web' ? Math.min(1, Math.max(0, -webOffset * direction) / 24) : offset.interpolate({ inputRange: direction === 1 ? [-24, -8, 0] : [0, 8, 24], outputRange: direction === 1 ? [1, .35, 0] : [0, .35, 1], extrapolate: 'clamp' }),
148
+ infoOpacity: Platform.OS === 'web' ? Math.min(1, Math.max(0, -webOffset * direction) / 24) : nativeInfoOpacity,
145
149
  revealOpacity: Platform.OS === 'web' ? Math.min(1, Math.max(0, webOffset * direction) / messageReplyRevealWidth)
146
- : offset.interpolate({ inputRange: direction === -1 ? [-messageReplyRevealWidth, -18, 0] : [0, 18, messageReplyRevealWidth], outputRange: direction === -1 ? [1, .35, 0] : [0, .35, 1], extrapolate: 'clamp' }),
150
+ : nativeRevealOpacity,
147
151
  revealWebStyle: Platform.OS === 'web' ? { transitionProperty: 'opacity', transitionDuration: webDragging ? '0ms' : '150ms' } : {},
148
152
  webStyle: Platform.OS === 'web' ? { transitionProperty: 'transform', transitionDuration: webDragging ? '0ms' : '150ms', transitionTimingFunction: 'cubic-bezier(0.215,0.61,0.355,1)' } : {},
149
153
  handlers: Platform.OS === 'web' ? {} : responder.panHandlers,