@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/account.js CHANGED
@@ -4,9 +4,11 @@ import { Text } from './typography.js';
4
4
  import { useRobonoLocale } from './localization.js';
5
5
  import { useEffect, useRef, useState } from 'react';
6
6
  import { AppState, Image, Platform, Pressable, ScrollView, View } from 'react-native';
7
- import { MessagingPopup, messagingPopupColors as c } from './popup.js';
7
+ import { MessagingPopup, useMessagingPopupColors } from './popup.js';
8
8
  import { MessageIcon } from './icons.js';
9
9
  export function MessagingAccountScreen({ account, companyName, onClose }) {
10
+ const deviceColors = useMessagingPopupColors(undefined, 'deviceCheck');
11
+ const c = useMessagingPopupColors(undefined, 'account');
10
12
  const { text: uiText, locale: uiLocale, number: uiNumber, count: uiCount } = useRobonoLocale();
11
13
  const [checking, setChecking] = useState(false);
12
14
  useEffect(() => { const sub = AppState.addEventListener('change', value => { if (value !== 'active')
@@ -29,12 +31,12 @@ export function MessagingAccountScreen({ account, companyName, onClose }) {
29
31
  finally {
30
32
  setBusy(false);
31
33
  } };
32
- return _jsx(MessagingPopup, { visible: visible, onDismiss: dismissed, title: uiText(checking ? "Check call devices" : "Account"), headerBack: checking, closeLabel: uiText("Close account"), closeDisabled: busy, background: c.background, contentWidth: 640, onClose: () => { if (!busy) {
34
+ return _jsx(MessagingPopup, { screen: checking ? 'deviceCheck' : 'account', visible: visible, onDismiss: dismissed, title: uiText(checking ? "Check call devices" : "Account"), headerBack: checking, closeLabel: uiText("Close account"), closeDisabled: busy, background: c.background, contentWidth: 640, onClose: () => { if (!busy) {
33
35
  if (checking) {
34
36
  void account?.deviceCheck?.close();
35
37
  setChecking(false);
36
38
  }
37
39
  else
38
40
  onClose();
39
- } }, children: _jsx(ScrollView, { contentContainerStyle: { gap: 16, paddingBottom: 12 }, children: checking && account?.deviceCheck ? _jsx(CallDeviceCheckPanel, { check: account.deviceCheck, renderVideo: account.renderCallPreview, labels: Object.fromEntries(Object.entries(callDeviceCheckText).map(([key, value]) => [key, uiText(value)])) }) : _jsxs(_Fragment, { children: [_jsxs(View, { style: { backgroundColor: '#111111', borderRadius: 16, padding: 16, gap: 14 }, children: [_jsxs(View, { style: { flexDirection: 'row', alignItems: 'center', gap: 14 }, children: [account?.avatarUrl ? _jsx(Image, { source: { uri: account.avatarUrl }, style: { width: 56, height: 56, borderRadius: 28 } }) : _jsx(View, { style: { width: 56, height: 56, borderRadius: 28, backgroundColor: '#252525', alignItems: 'center', justifyContent: 'center' }, children: _jsx(MessageIcon, { name: "person-circle-outline", color: c.foreground, size: 36 }) }), _jsxs(View, { style: { flex: 1, gap: 4 }, children: [_jsx(Text, { style: { color: c.foreground, fontSize: 20, fontWeight: '600' }, children: account?.name ?? uiText("Your account") }), _jsx(Text, { style: { color: c.secondary, fontSize: 14 }, children: companyName })] })] }), account?.phone && _jsx(Text, { style: { color: c.foreground, fontSize: 16 }, children: account.phone }), account?.email && _jsx(Text, { style: { color: c.foreground, fontSize: 16 }, children: account.email }), account?.onEditProfile && _jsxs(Pressable, { accessibilityRole: "button", accessibilityLabel: uiText("Edit profile"), disabled: busy, onPress: () => begin(account.onEditProfile), style: { minHeight: 44, flexDirection: 'row', alignItems: 'center', gap: 10 }, children: [_jsx(MessageIcon, { name: "edit", color: c.foreground, size: 20 }), _jsx(Text, { style: { color: c.foreground, fontSize: 16 }, children: uiText("Edit profile") })] })] }), account?.deviceCheck && _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: uiText("Check call devices"), disabled: busy, onPress: () => setChecking(true), style: { backgroundColor: '#111111', borderRadius: 12, minHeight: 52, paddingHorizontal: 16, justifyContent: 'center' }, children: _jsx(Text, { style: { color: c.foreground, fontSize: 16 }, children: uiText("Check call devices") }) }), account?.onEnableNotifications && _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: uiText("Enable notifications"), disabled: busy, onPress: () => void run(account.onEnableNotifications), style: { backgroundColor: '#111111', borderRadius: 12, minHeight: 52, paddingHorizontal: 16, justifyContent: 'center' }, children: _jsx(Text, { style: { color: c.foreground, fontSize: 16 }, children: uiText("Enable notifications") }) }), account?.onDeleteAccount && _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: uiText("Delete account"), disabled: busy, onPress: () => begin(account.onDeleteAccount), style: { backgroundColor: '#111111', borderRadius: 12, minHeight: 52, paddingHorizontal: 16, justifyContent: 'center' }, children: _jsx(Text, { style: { color: '#ffb5a3', fontSize: 16 }, children: uiText("Delete account") }) }), account?.onSignOut && _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: uiText("Sign out"), disabled: busy, onPress: () => begin(account.onSignOut), style: { backgroundColor: '#111111', borderRadius: 12, minHeight: 52, paddingHorizontal: 16, justifyContent: 'center' }, children: _jsx(Text, { style: { color: c.foreground, fontSize: 16 }, children: uiText("Sign out") }) }), !!error && _jsx(Text, { accessibilityRole: "alert", style: { color: c.foreground, fontSize: 15 }, children: error })] }) }) });
41
+ } }, children: _jsx(ScrollView, { contentContainerStyle: { gap: 16, paddingBottom: 12 }, children: checking && account?.deviceCheck ? _jsx(CallDeviceCheckPanel, { TextComponent: Text, colors: { foreground: deviceColors.foreground, secondary: deviceColors.secondary, controls: deviceColors.incoming }, accent: deviceColors.accent, check: account.deviceCheck, renderVideo: account.renderCallPreview, labels: Object.fromEntries(Object.entries(callDeviceCheckText).map(([key, value]) => [key, uiText(value)])) }) : _jsxs(_Fragment, { children: [_jsxs(View, { style: { backgroundColor: c.incoming, borderRadius: 16, padding: 16, gap: 14 }, children: [_jsxs(View, { style: { flexDirection: 'row', alignItems: 'center', gap: 14 }, children: [account?.avatarUrl ? _jsx(Image, { source: { uri: account.avatarUrl }, style: { width: 56, height: 56, borderRadius: 28 } }) : _jsx(View, { style: { width: 56, height: 56, borderRadius: 28, backgroundColor: c.incoming, alignItems: 'center', justifyContent: 'center' }, children: _jsx(MessageIcon, { name: "person-circle-outline", color: c.foreground, size: 36 }) }), _jsxs(View, { style: { flex: 1, gap: 4 }, children: [_jsx(Text, { style: { color: c.foreground, fontSize: 20, fontWeight: '600' }, children: account?.name ?? uiText("Your account") }), _jsx(Text, { style: { color: c.secondary, fontSize: 14 }, children: companyName })] })] }), account?.phone && _jsx(Text, { style: { color: c.foreground, fontSize: 16 }, children: account.phone }), account?.email && _jsx(Text, { style: { color: c.foreground, fontSize: 16 }, children: account.email }), account?.onEditProfile && _jsxs(Pressable, { accessibilityRole: "button", accessibilityLabel: uiText("Edit profile"), disabled: busy, onPress: () => begin(account.onEditProfile), style: { minHeight: 44, flexDirection: 'row', alignItems: 'center', gap: 10 }, children: [_jsx(MessageIcon, { name: "edit", color: c.foreground, size: 20 }), _jsx(Text, { style: { color: c.foreground, fontSize: 16 }, children: uiText("Edit profile") })] })] }), account?.deviceCheck && _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: uiText("Check call devices"), disabled: busy, onPress: () => setChecking(true), style: { backgroundColor: c.incoming, borderRadius: 12, minHeight: 52, paddingHorizontal: 16, justifyContent: 'center' }, children: _jsx(Text, { style: { color: c.foreground, fontSize: 16 }, children: uiText("Check call devices") }) }), account?.onEnableNotifications && _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: uiText("Enable notifications"), disabled: busy, onPress: () => void run(account.onEnableNotifications), style: { backgroundColor: c.incoming, borderRadius: 12, minHeight: 52, paddingHorizontal: 16, justifyContent: 'center' }, children: _jsx(Text, { style: { color: c.foreground, fontSize: 16 }, children: uiText("Enable notifications") }) }), account?.onDeleteAccount && _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: uiText("Delete account"), disabled: busy, onPress: () => begin(account.onDeleteAccount), style: { backgroundColor: c.incoming, borderRadius: 12, minHeight: 52, paddingHorizontal: 16, justifyContent: 'center' }, children: _jsx(Text, { style: { color: c.danger, fontSize: 16 }, children: uiText("Delete account") }) }), account?.onSignOut && _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: uiText("Sign out"), disabled: busy, onPress: () => begin(account.onSignOut), style: { backgroundColor: c.incoming, borderRadius: 12, minHeight: 52, paddingHorizontal: 16, justifyContent: 'center' }, children: _jsx(Text, { style: { color: c.foreground, fontSize: 16 }, children: uiText("Sign out") }) }), !!error && _jsx(Text, { accessibilityRole: "alert", style: { color: c.foreground, fontSize: 15 }, children: error })] }) }) });
40
42
  }
@@ -0,0 +1,11 @@
1
+ import { type MessagingAppearance, type MessagingStyleScreen } from '@robono/messaging';
2
+ export declare const MessagingAppearanceContext: import("react").Context<MessagingAppearance | undefined>;
3
+ export declare const useMessagingAppearance: () => MessagingAppearance | undefined;
4
+ export declare function useMessagingPopupColors(appearance?: MessagingAppearance, screen?: MessagingStyleScreen): {
5
+ accent: string;
6
+ background: string;
7
+ foreground: string;
8
+ secondary: string;
9
+ incoming: string;
10
+ danger: string;
11
+ };
@@ -0,0 +1,5 @@
1
+ import { createContext, useContext } from 'react';
2
+ import { messagingPanelColors } from '@robono/messaging';
3
+ export const MessagingAppearanceContext = createContext(undefined);
4
+ export const useMessagingAppearance = () => useContext(MessagingAppearanceContext);
5
+ export function useMessagingPopupColors(appearance, screen = 'panels') { const inherited = useMessagingAppearance(); return messagingPanelColors(appearance ?? inherited, screen); }
@@ -1,4 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useMessagingAppearance } from './appearance-context.js';
3
+ import { defaultMessagingSettings, messagingMenuColors, messagingMenuLayout } from '@robono/messaging';
2
4
  import { Text } from './typography.js';
3
5
  import { useRobonoLocale } from './localization.js';
4
6
  import { useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
@@ -8,6 +10,7 @@ import { MessageIcon } from './icons.js';
8
10
  /** Messenger's 206 × 46 attachment chips, staggered above its plus button. */
9
11
  export function AttachmentMenu({ anchor, actions, accent, onClose }) {
10
12
  const { text: uiText, locale: uiLocale, number: uiNumber, count: uiCount } = useRobonoLocale();
13
+ const appearance = useMessagingAppearance() ?? defaultMessagingSettings().appearance, style = appearance.menus?.attachments, palette = messagingMenuColors(appearance, 'attachments'), layout = messagingMenuLayout(style), rowHeight = style?.spacing ? Math.max(46, layout.rowHeight) : 46;
11
14
  const bounds = useMessagingPopupBounds(), window = useWindowDimensions(), fade = useRef(new Animated.Value(0)).current;
12
15
  const [position, setPosition] = useState(null);
13
16
  const menu = useRef(null), close = useRef(onClose);
@@ -58,17 +61,17 @@ export function AttachmentMenu({ anchor, actions, accent, onClose }) {
58
61
  const node = useMemo(() => {
59
62
  if (!position)
60
63
  return null;
61
- const compact = position.y - 80 < Math.max(0, actions.length - 1) * 46;
62
- const listHeight = Math.min(Math.max(46, position.height - 28), actions.length * 54 - 8);
64
+ const compact = position.y - 80 < Math.max(0, actions.length - 1) * rowHeight;
65
+ const listHeight = Math.min(Math.max(rowHeight, position.height - 28), actions.length * (rowHeight + 8) - 8);
63
66
  const listTop = Math.max(14, Math.min(position.height - listHeight - 14, position.y - listHeight - 30));
64
67
  const Container = compact ? ScrollView : View;
65
- return _jsxs(View, { style: { position: 'absolute', inset: 0, zIndex: 1000, elevation: 1000 }, children: [_jsx(Animated.View, { pointerEvents: "none", style: { position: 'absolute', inset: 0, backgroundColor: '#000', opacity: fade.interpolate({ inputRange: [0, 1], outputRange: [0, .38] }) } }), _jsx(Pressable, { accessibilityLabel: uiText("Close attachment menu"), onPress: onClose, style: { position: 'absolute', inset: 0 } }), _jsx(View, { ref: menu, accessibilityViewIsModal: true, style: { position: 'absolute', inset: 0 }, pointerEvents: "box-none", children: _jsx(Container, { style: compact ? { position: 'absolute', top: listTop, left: 10, right: 10, maxHeight: listHeight } : { position: 'absolute', inset: 0 }, ...(compact ? { contentContainerStyle: { gap: 8, paddingHorizontal: 4 }, keyboardShouldPersistTaps: 'always' } : { pointerEvents: 'box-none' }), children: (compact ? [...actions].reverse() : actions).map((action, index) => {
66
- const chipWidth = Math.min(206, position.width - 20), step = Math.min(58, Math.max(46, (position.y - 80) / Math.max(1, actions.length - 1)));
68
+ return _jsxs(View, { style: { position: 'absolute', inset: 0, zIndex: 1000, elevation: 1000 }, children: [_jsx(Animated.View, { pointerEvents: "none", style: { position: 'absolute', inset: 0, backgroundColor: '#000', opacity: fade.interpolate({ inputRange: [0, 1], outputRange: [0, .38] }) } }), _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: uiText("Close attachment menu"), onPress: onClose, style: { position: 'absolute', inset: 0 } }), _jsx(View, { ref: menu, accessibilityViewIsModal: true, style: { position: 'absolute', inset: 0 }, pointerEvents: "box-none", children: _jsx(Container, { style: compact ? { position: 'absolute', top: listTop, left: 10, right: 10, maxHeight: listHeight } : { position: 'absolute', inset: 0 }, ...(compact ? { contentContainerStyle: { gap: 8, paddingHorizontal: 4 }, keyboardShouldPersistTaps: 'always' } : { pointerEvents: 'box-none' }), children: (compact ? [...actions].reverse() : actions).map((action, index) => {
69
+ const chipWidth = Math.min(206, position.width - 20), step = Math.min(rowHeight + 12, Math.max(rowHeight, (position.y - 80) / Math.max(1, actions.length - 1)));
67
70
  return _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: action.label, onPress: () => { onClose(); if (Platform.OS === 'web')
68
71
  action.run();
69
72
  else
70
- requestAnimationFrame(() => requestAnimationFrame(action.run)); }, style: { position: compact ? 'relative' : 'absolute', width: chipWidth, height: 46, flexShrink: 0, left: compact ? 0 : Math.max(10, Math.min(position.width - chipWidth - 10, position.x + 14 + index * 18)), top: compact ? 0 : Math.max(14, position.y - 66 - index * step), shadowColor: '#000', shadowOpacity: .42, shadowRadius: 15, shadowOffset: { width: 0, height: 7 }, elevation: 10 }, children: ({ pressed }) => _jsxs(Animated.View, { pointerEvents: "none", style: { flex: 1, opacity: fade, borderRadius: 23, borderWidth: 1, borderColor: '#ffffff1c', backgroundColor: pressed ? '#211D1A' : '#171717', flexDirection: 'row', alignItems: 'center', gap: 10, paddingStart: 7, paddingEnd: 12, transform: [{ scale: pressed ? .97 : 1 }] }, children: [_jsx(View, { style: { width: 32, height: 32, borderRadius: 11, borderWidth: .5, borderColor: accent + '38', backgroundColor: accent + '1a', alignItems: 'center', justifyContent: 'center' }, children: _jsx(MessageIcon, { name: action.icon, size: 21, color: accent }) }), _jsx(Text, { numberOfLines: 1, style: { flex: 1, color: '#ffffffeb', fontFamily: Platform.select({ ios: 'Avenir Next', android: 'sans-serif-medium' }), fontSize: 14, fontWeight: '600', letterSpacing: .12 }, children: action.label }), _jsx(MessageIcon, { name: "chevron-forward", size: 14, color: "#ffffff52" })] }) }, action.key);
73
+ requestAnimationFrame(() => requestAnimationFrame(action.run)); }, style: { position: compact ? 'relative' : 'absolute', width: chipWidth, height: rowHeight, flexShrink: 0, left: compact ? 0 : Math.max(10, Math.min(position.width - chipWidth - 10, position.x + 14 + index * 18)), top: compact ? 0 : Math.max(14, position.y - 66 - index * step), shadowColor: '#000', shadowOpacity: .42, shadowRadius: 15, shadowOffset: { width: 0, height: 7 }, elevation: 10 }, children: ({ pressed }) => _jsxs(Animated.View, { pointerEvents: "none", style: { flex: 1, opacity: fade, borderRadius: style?.corners === 'square' ? 0 : style?.corners === 'soft' ? 8 : 23, borderWidth: 1, borderColor: palette.foreground + '1c', backgroundColor: style?.background ?? (pressed ? '#211D1A' : '#171717'), flexDirection: 'row', alignItems: 'center', gap: 10, paddingStart: 7, paddingEnd: 12, transform: [{ scale: pressed ? .97 : 1 }] }, children: [layout.showIcons && _jsx(View, { style: { width: 32, height: 32, borderRadius: 11, borderWidth: .5, borderColor: accent + '38', backgroundColor: accent + '1a', alignItems: 'center', justifyContent: 'center' }, children: _jsx(MessageIcon, { name: action.icon, size: 21, color: style?.icons ?? accent }) }), _jsx(Text, { numberOfLines: 1, style: { flex: 1, color: style?.foreground ?? '#ffffffeb', fontFamily: Platform.select({ ios: 'Avenir Next', android: 'sans-serif-medium' }), fontSize: style?.textSize ?? 14, fontWeight: '600', letterSpacing: .12 }, children: action.label }), _jsx(MessageIcon, { name: "chevron-forward", size: 14, color: palette.foreground + '52' })] }) }, action.key);
71
74
  }) }) })] });
72
- }, [position, actions, accent, onClose, fade]);
75
+ }, [position, actions, accent, onClose, fade, appearance, rowHeight]);
73
76
  return _jsx(MessagingPopupLayer, { children: node });
74
77
  }
package/dist/brand.js CHANGED
@@ -1,7 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useEffect, useRef, useState } from 'react';
3
3
  import { Image, Platform, View } from 'react-native';
4
- import { Text } from './typography.js';
4
+ import { Text, messagingFontFamily } from './typography.js';
5
+ import { messagingScreenStyle } from '@robono/messaging';
5
6
  const sizes = new Map();
6
7
  /** The original Messenger reserves 145 × 38 points for branding. No cropping. */
7
8
  export function MessagingBrand({ appearance, companyName }) {
@@ -22,10 +23,10 @@ export function MessagingBrand({ appearance, companyName }) {
22
23
  } }, () => { if (active)
23
24
  setSource({ url, width: 0, height: 0, failed: true }); }); return () => { active = false; }; }, [url]);
24
25
  const ready = source.url === url && source.width > 0, scale = ready ? Math.min(145 / source.width, 38 / source.height) : 1;
25
- const font = settings?.brandFont ?? 'system', fontFamily = font === 'serif' ? (Platform.OS === 'ios' ? 'Georgia' : Platform.OS === 'web' ? 'Georgia, serif' : 'serif') : font === 'monospace' ? (Platform.OS === 'ios' ? 'Menlo' : Platform.OS === 'web' ? 'Menlo, monospace' : 'monospace') : undefined;
26
+ const mainText = messagingScreenStyle(appearance).typography, fontFamily = messagingFontFamily(settings?.brandFont ?? mainText?.font);
26
27
  useEffect(() => { if (Platform.OS !== 'web')
27
28
  return; let active = true; const measure = () => { const element = textRef.current; if (!active || !element)
28
29
  return; const base = settings?.brandTextSize ?? 24, canvas = document.createElement('canvas'), context = canvas.getContext('2d'); if (!context)
29
- return; const style = getComputedStyle(element); context.font = `${settings?.brandWeight ?? '700'} ${base * (appearance.presentation?.textScale ?? 1)}px ${style.fontFamily}`; const width = context.measureText(companyName ?? appearance.name).width; setFittedSize(Math.max(base * .5, Math.min(base, base * 145 / Math.max(1, width)))); }; measure(); void document.fonts?.ready.then(measure); return () => { active = false; }; }, [companyName, appearance.name, url, source.failed, settings?.brandFont, settings?.brandWeight, settings?.brandTextSize, appearance.presentation?.textScale]);
30
- return _jsx(View, { testID: "messaging-brand-slot", style: { width: 145, height: 38, flexShrink: 0, alignItems: 'flex-end', justifyContent: 'center' }, children: url && !(source.url === url && source.failed) ? _jsx(Image, { testID: "messaging-brand-logo", accessibilityLabel: appearance.name + ' logo', source: { uri: url }, resizeMode: "contain", style: { width: ready ? source.width * scale : 145, height: ready ? source.height * scale : 38 } }) : _jsx(Text, { ref: textRef, accessibilityRole: "header", accessibilityLabel: companyName ?? appearance.name, numberOfLines: 1, adjustsFontSizeToFit: true, minimumFontScale: 0.5, style: { width: 145, textAlign: 'right', color: settings?.headerText ?? appearance.colors.foreground, fontFamily, fontSize: Platform.OS === 'web' ? (fittedSize ?? settings?.brandTextSize ?? 24) : (settings?.brandTextSize ?? 24), fontWeight: settings?.brandWeight ?? '700' }, children: companyName ?? appearance.name }) });
30
+ return; const style = getComputedStyle(element); context.font = `${settings?.brandItalic ?? mainText?.italic ? 'italic ' : ''}${settings?.brandWeight ?? (mainText?.bold === false ? '400' : '700')} ${base * (mainText?.textScale ?? 1)}px ${style.fontFamily}`; const width = context.measureText(companyName ?? appearance.name).width; setFittedSize(Math.max(base * .5, Math.min(base, base * 145 / Math.max(1, width)))); }; measure(); void document.fonts?.ready.then(measure); return () => { active = false; }; }, [companyName, appearance.name, url, source.failed, settings?.brandFont, mainText?.font, mainText?.bold, mainText?.textScale, mainText?.italic, settings?.brandItalic, settings?.brandWeight, settings?.brandTextSize, appearance.presentation?.textScale]);
31
+ return _jsx(View, { testID: "messaging-brand-slot", style: { width: 145, height: 38, flexShrink: 0, alignSelf: 'flex-start', alignItems: settings?.brandAlign === 'left' ? 'flex-start' : settings?.brandAlign === 'center' ? 'center' : 'flex-end', justifyContent: 'flex-start' }, children: url && !(source.url === url && source.failed) ? _jsx(Image, { testID: "messaging-brand-logo", accessibilityLabel: appearance.name + ' logo', source: { uri: url }, onError: () => { sizes.delete(url); setSource({ url, width: 0, height: 0, failed: true }); }, resizeMode: "contain", style: { width: ready ? source.width * scale : 145, height: ready ? source.height * scale : 38 } }) : _jsx(Text, { inheritEmphasis: false, ref: textRef, accessibilityRole: "header", accessibilityLabel: companyName ?? appearance.name, numberOfLines: 1, adjustsFontSizeToFit: true, minimumFontScale: 0.5, style: { width: 145, textAlign: settings?.brandAlign ?? 'right', color: settings?.headerText ?? appearance.colors.foreground, fontFamily, fontSize: Platform.OS === 'web' ? (fittedSize ?? settings?.brandTextSize ?? 24) : (settings?.brandTextSize ?? 24), fontWeight: settings?.brandWeight ?? (mainText?.bold === false ? '400' : '700'), fontStyle: (settings?.brandItalic ?? mainText?.italic) ? 'italic' : 'normal', textDecorationLine: (settings?.brandUnderline ?? mainText?.underline) ? 'underline' : 'none' }, children: companyName ?? appearance.name }) });
31
32
  }
package/dist/calling.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Text } from './typography.js';
3
3
  import { useRobonoLocale } from './localization.js';
4
- import { createContext, useContext, useSyncExternalStore } from 'react';
4
+ import { createContext, useContext, useMemo, useSyncExternalStore } from 'react';
5
5
  import { Pressable, View } from 'react-native';
6
6
  import { RobonoIcon } from './visual/RobonoIcon.js';
7
7
  import { MessagingScreen, MessagingProvider, MessagingHeader, MessagingComposer } from './index.js';
@@ -14,9 +14,10 @@ export function MessagingCallHeader() { return _jsx(MessagingHeader, {}); }
14
14
  export function MessagingCallingScreen({ onCall, onVideoCall, videoCallLabel = 'Video call', callLabel = 'Robono call', components, unansweredCallId, onDismissCallMessage, ...props }) {
15
15
  const { text: uiText, locale: uiLocale, number: uiNumber, count: uiCount } = useRobonoLocale();
16
16
  const state = useSyncExternalStore(props.client.subscribe, props.client.getSnapshot, props.client.getSnapshot);
17
+ const screenComponents = useMemo(() => ({ Header: MessagingCallHeader, Composer: CallingMessageComposer, ...components }), [components]);
17
18
  const design = props.appearance ?? state.settings?.appearance;
18
19
  const screenProps = { ...props, callActions: { ...props.callActions, ...(onCall ? { voice: onCall, voiceLabel: callLabel } : {}), ...(onVideoCall ? { video: onVideoCall, videoLabel: videoCallLabel } : {}) } };
19
20
  const callingOnly = (onCall || onVideoCall) && design && state.settings && !state.settings.enabled;
20
21
  const callingContent = design ? _jsxs(View, { style: [{ flex: 1, backgroundColor: design.colors.background }, props.style], children: [_jsx(MessagingCallHeader, {}), _jsxs(View, { style: { flex: 1, alignItems: 'center', justifyContent: 'center', gap: 24, padding: 24 }, children: [_jsx(Text, { style: { fontSize: 28, fontWeight: '600', color: design.colors.foreground }, children: props.contact.name }), onCall && _jsxs(Pressable, { accessibilityRole: "button", accessibilityLabel: uiText("Start {value1}", { value1: callLabel.toLowerCase() }), onPress: onCall, style: { minHeight: 56, minWidth: 160, borderRadius: 28, backgroundColor: design.colors.incoming, alignItems: 'center', justifyContent: 'center', padding: 16, flexDirection: 'row', gap: 12 }, children: [_jsx(RobonoIcon, { name: "phone", size: 24, color: design.colors.incomingText }), _jsx(Text, { style: { fontSize: 18, color: design.colors.incomingText }, children: callLabel })] }), onVideoCall && _jsxs(Pressable, { accessibilityRole: "button", accessibilityLabel: uiText("Start {value1}", { value1: videoCallLabel.toLowerCase() }), onPress: onVideoCall, style: { minHeight: 56, padding: 16, borderRadius: 28, backgroundColor: design.colors.incoming, flexDirection: 'row', alignItems: 'center', gap: 12 }, children: [_jsx(RobonoIcon, { name: "video", size: 24, color: design.colors.incomingText }), _jsx(Text, { style: { color: design.colors.incomingText, fontSize: 18 }, children: videoCallLabel })] })] })] }) : null;
21
- return _jsx(FollowUp.Provider, { value: unansweredCallId && onDismissCallMessage ? { callId: unansweredCallId, dismiss: onDismissCallMessage } : null, children: callingOnly ? _jsx(MessagingProvider, { ...screenProps, children: props.renderLayout ? props.renderLayout(callingContent) : callingContent }) : _jsx(MessagingScreen, { ...screenProps, components: { Header: MessagingCallHeader, Composer: CallingMessageComposer, ...components } }) });
22
+ return _jsx(FollowUp.Provider, { value: unansweredCallId && onDismissCallMessage ? { callId: unansweredCallId, dismiss: onDismissCallMessage } : null, children: callingOnly ? _jsx(MessagingProvider, { ...screenProps, children: props.renderLayout ? props.renderLayout(callingContent) : callingContent }) : _jsx(MessagingScreen, { ...screenProps, components: screenComponents }) });
22
23
  }
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ /** Supplied full Messengers connect these to the authenticated inbox automatically. */
3
+ export type ConversationActions = import('@robono/messaging').MessagingConversationActions;
4
+ export declare function ChatOptions({ actions, privacy, onClose, accent }: {
5
+ actions?: ConversationActions;
6
+ privacy?: {
7
+ enabled: boolean;
8
+ set: (enabled: boolean) => Promise<void>;
9
+ };
10
+ onClose: () => void;
11
+ accent: string;
12
+ }): React.JSX.Element;
@@ -0,0 +1,25 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { Pressable, ScrollView, View } from 'react-native';
4
+ import { Text } from './typography.js';
5
+ import { MessagingPopup, useMessagingPopupColors } from './popup.js';
6
+ import { useRobonoLocale } from './localization.js';
7
+ export function ChatOptions({ actions, privacy, onClose, accent }) {
8
+ const c = useMessagingPopupColors(undefined, 'options');
9
+ const { text: uiText } = useRobonoLocale();
10
+ const [busy, setBusy] = useState(false), [error, setError] = useState(''), [confirmDelete, setConfirmDelete] = useState(false);
11
+ async function save(action) { setBusy(true); setError(''); try {
12
+ await action();
13
+ }
14
+ catch {
15
+ setError(uiText('Chat options could not be saved.'));
16
+ }
17
+ finally {
18
+ setBusy(false);
19
+ } }
20
+ const row = (label, value, action) => _jsxs(Pressable, { accessibilityRole: "switch", "aria-checked": value, accessibilityLabel: label, accessibilityState: { checked: value, disabled: busy }, disabled: busy, onPress: () => void save(action), style: { minHeight: 56, flexDirection: 'row', alignItems: 'center', gap: 16, borderBottomWidth: 1, borderBottomColor: c.foreground + '20' }, children: [_jsx(Text, { style: { flex: 1, fontSize: 17, color: c.foreground }, children: label }), _jsx(View, { style: { width: 44, height: 26, borderRadius: 14, padding: 3, backgroundColor: value ? accent : '#555', alignItems: value ? 'flex-end' : 'flex-start' }, children: _jsx(View, { style: { width: 20, height: 20, borderRadius: 10, backgroundColor: '#fff' } }) })] });
21
+ return _jsx(MessagingPopup, { screen: "options", background: c.background, title: uiText(confirmDelete ? 'Delete chat?' : 'Chat options'), compact: confirmDelete, closeDisabled: busy, onClose: () => { if (confirmDelete)
22
+ setConfirmDelete(false);
23
+ else
24
+ onClose(); }, children: _jsxs(ScrollView, { contentContainerStyle: { gap: 16, paddingBottom: 12 }, children: [confirmDelete ? _jsxs(_Fragment, { children: [_jsx(Text, { style: { color: c.secondary, fontSize: 16, lineHeight: 23 }, children: uiText('This removes the chat and its messages from your history. The other person keeps their copy. New messages can appear again.') }), _jsxs(View, { style: { flexDirection: 'row', gap: 12 }, children: [_jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: uiText('Cancel'), disabled: busy, onPress: () => setConfirmDelete(false), style: { flex: 1, minHeight: 48, alignItems: 'center', justifyContent: 'center' }, children: _jsx(Text, { style: { color: c.foreground, fontSize: 16 }, children: uiText('Cancel') }) }), _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: uiText('Delete chat'), disabled: busy, onPress: () => void save(async () => { await actions.deleteConversation(); onClose(); }), style: { flex: 1, minHeight: 48, borderRadius: 12, backgroundColor: '#b72d34', alignItems: 'center', justifyContent: 'center' }, children: _jsx(Text, { style: { color: '#fff', fontSize: 16, fontWeight: '600' }, children: uiText('Delete chat') }) })] })] }) : _jsxs(_Fragment, { children: [actions?.setMuted && row(uiText('Mute notifications'), actions.muted, () => actions.setMuted(!actions.muted)), privacy && row(uiText('Privacy Lens'), privacy.enabled, () => privacy.set(!privacy.enabled)), actions?.deleteConversation && _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: uiText('Delete chat'), onPress: () => setConfirmDelete(true), style: { minHeight: 48, justifyContent: 'center' }, children: _jsx(Text, { style: { color: '#ff8282', fontSize: 17 }, children: uiText('Delete chat') }) })] }), !!error && _jsx(Text, { accessibilityRole: "alert", style: { color: c.foreground }, children: error })] }) });
25
+ }
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { messagingFriendsColors } from '@robono/messaging';
2
+ import { messagingAvatarStyle, messagingFriendsColors } from '@robono/messaging';
3
3
  import { Image, Pressable, View } from 'react-native';
4
4
  import { Text } from './typography.js';
5
5
  export function directoryWithoutChats(directory, chats, query = '') {
@@ -12,6 +12,6 @@ export function directoryWithoutChats(directory, chats, query = '') {
12
12
  });
13
13
  }
14
14
  export function MessagingDirectoryRow({ contact, appearance, onPress }) {
15
- const c = messagingFriendsColors(appearance);
16
- return _jsxs(Pressable, { testID: 'messaging-directory-' + contact.id, accessibilityRole: "button", accessibilityLabel: contact.name + ', ' + contact.status, onPress: onPress, style: { flexDirection: 'row', alignItems: 'center', gap: 12, paddingHorizontal: 12, paddingVertical: 10, minHeight: 68 }, children: [appearance.screens?.friends?.showAvatars !== false && (contact.avatarUrl ? _jsx(Image, { source: { uri: contact.avatarUrl }, style: { width: 40, height: 40, borderRadius: 20 } }) : _jsx(View, { style: { width: 40, height: 40, borderRadius: 20, backgroundColor: c.accent + '20', alignItems: 'center', justifyContent: 'center' }, children: _jsx(Text, { style: { color: c.accent, fontSize: 18, fontWeight: '700' }, children: contact.name.slice(0, 1).toUpperCase() }) })), _jsxs(View, { style: { flex: 1, minWidth: 0 }, children: [_jsx(Text, { numberOfLines: 1, style: { color: c.foreground, fontSize: 16, fontWeight: '700' }, children: contact.name }), _jsx(Text, { numberOfLines: 1, style: { color: c.secondary, marginTop: 3, fontSize: 14 }, children: contact.status })] })] });
15
+ const c = messagingFriendsColors(appearance), f = appearance.screens?.friends, avatar = messagingAvatarStyle(f?.avatarSize ?? 40, f?.avatarShape), padding = f?.rowSpacing === 'compact' ? 6 : f?.rowSpacing === 'relaxed' ? 16 : 10;
16
+ return _jsxs(Pressable, { testID: 'messaging-directory-' + contact.id, accessibilityRole: "button", accessibilityLabel: contact.name + ', ' + contact.status, onPress: onPress, style: { flexDirection: 'row', alignItems: 'center', gap: 12, paddingHorizontal: 12, paddingVertical: padding, minHeight: Math.max(44, avatar.height + padding * 2) }, children: [appearance.screens?.friends?.showAvatars !== false && (contact.avatarUrl ? _jsx(Image, { source: { uri: contact.avatarUrl }, style: { ...avatar } }) : _jsx(View, { style: { ...avatar, backgroundColor: c.accent + '20', alignItems: 'center', justifyContent: 'center' }, children: _jsx(Text, { style: { color: c.accent, fontSize: 18, fontWeight: '700' }, children: contact.name.slice(0, 1).toUpperCase() }) })), _jsxs(View, { style: { flex: 1, minWidth: 0 }, children: [_jsx(Text, { numberOfLines: 1, style: { color: c.foreground, fontSize: f?.nameSize ?? 16, fontWeight: '700' }, children: contact.name }), _jsx(Text, { numberOfLines: f?.previewLines ?? 1, style: { color: c.secondary, marginTop: 3, fontSize: f?.previewSize ?? 14 }, children: contact.status })] })] });
17
17
  }
@@ -5,6 +5,8 @@ type Person = {
5
5
  avatarUrl?: string;
6
6
  };
7
7
  export interface ConversationDetailsProps {
8
+ initialTab?: 'profile' | 'media';
9
+ onOptions?: () => void;
8
10
  client: MessagingClient;
9
11
  state: MessagingState;
10
12
  userId: string;
@@ -3,9 +3,10 @@ import { Text } from './typography.js';
3
3
  import { useRobonoLocale } from './localization.js';
4
4
  import { useEffect, useRef, useState } from 'react';
5
5
  import { ActivityIndicator, FlatList, Image, Platform, Pressable, View } from 'react-native';
6
- import { MessagingPopup, messagingPopupColors as c } from './popup.js';
6
+ import { MessagingPopup, useMessagingPopupColors } from './popup.js';
7
7
  import { MessageIcon, fileSize, duration } from './icons.js';
8
8
  function MediaThumbnail({ message, preview }) {
9
+ const c = useMessagingPopupColors();
9
10
  const { text: uiText, locale: uiLocale, number: uiNumber, count: uiCount } = useRobonoLocale();
10
11
  const [uri, setUri] = useState();
11
12
  useEffect(() => { let live = true; setUri(undefined); if (preview && ['image', 'video'].includes(message.kind))
@@ -17,7 +18,8 @@ function MediaThumbnail({ message, preview }) {
17
18
  export function ConversationDetails(props) {
18
19
  const { text: uiText, locale: uiLocale, number: uiNumber, count: uiCount } = useRobonoLocale();
19
20
  const { client, state, contact, participants = {}, userId, accent, onClose } = props, group = state.conversation?.kind === 'group';
20
- const [tab, setTab] = useState('media'), [messages, setMessages] = useState([]), [members, setMembers] = useState([]);
21
+ const [tab, setTab] = useState(props.initialTab ?? 'profile'), [messages, setMessages] = useState([]), [members, setMembers] = useState([]);
22
+ const styleScreen = tab === 'media' ? 'media' : 'profile', c = useMessagingPopupColors(undefined, styleScreen);
21
23
  const [next, setNext] = useState(null), [busy, setBusy] = useState(false), [error, setError] = useState(''), [visible, setVisible] = useState(true);
22
24
  const [leaving, setLeaving] = useState(false), leaveRequest = useRef(undefined);
23
25
  const request = useRef(null), generation = useRef(0), pending = useRef(null);
@@ -75,13 +77,13 @@ export function ConversationDetails(props) {
75
77
  setBusy(false);
76
78
  }
77
79
  }
78
- useEffect(() => { setMessages([]); setMembers([]); setNext(null); if (tab === 'members' || state.sharedMediaAvailable)
80
+ useEffect(() => { setMessages([]); setMembers([]); setNext(null); if (tab === 'members' || tab === 'media' && state.sharedMediaAvailable)
79
81
  void load(); return () => { ++generation.current; request.current?.abort(); }; }, [client, state.conversationId, tab]);
80
82
  const footer = _jsxs(View, { children: [busy && _jsx(ActivityIndicator, { accessibilityLabel: uiText("Loading conversation details"), color: accent, style: { padding: 16 } }), !!error && _jsxs(_Fragment, { children: [_jsx(Text, { accessibilityRole: "alert", style: { color: c.foreground, padding: 12 }, children: error }), _jsx(Pressable, { accessibilityRole: "button", onPress: () => void load(!!next), style: { minHeight: 44, justifyContent: 'center' }, children: _jsx(Text, { style: { color: accent }, children: uiText("Try again") }) })] }), next && !busy && !error && _jsx(Pressable, { accessibilityRole: "button", onPress: () => void load(true), style: { minHeight: 48, alignItems: 'center', justifyContent: 'center' }, children: _jsx(Text, { style: { color: accent }, children: uiText("Load more") }) })] });
81
- return _jsx(MessagingPopup, { visible: visible, onDismiss: dismiss, title: leaving ? uiText("Leave group?") : group ? uiText("Group details") : uiText("Contact details"), compact: leaving, closeDisabled: busy, background: c.background, onClose: () => { if (!busy) {
83
+ return _jsx(MessagingPopup, { screen: styleScreen, visible: visible, onDismiss: dismiss, title: leaving ? uiText("Leave group?") : group ? uiText("Group details") : uiText("Contact details"), compact: leaving, closeDisabled: leaving && busy, background: c.background, onClose: () => { if (!leaving || !busy) {
82
84
  if (leaving)
83
85
  setLeaving(false);
84
86
  else
85
87
  setVisible(false);
86
- } }, children: leaving ? _jsxs(View, { style: { gap: 16, paddingTop: 12 }, children: [_jsxs(Text, { style: { color: c.secondary, fontSize: 16, lineHeight: 23 }, children: [uiText("You will stop receiving this group’s messages."), state.conversation?.ownerId === userId ? ' ' + uiText("Ownership will pass to another member.") : ''] }), !!error && _jsx(Text, { accessibilityRole: "alert", style: { color: c.foreground }, children: error }), _jsx(Pressable, { accessibilityRole: "button", disabled: busy, onPress: () => void leave(), style: { minHeight: 48, borderRadius: 12, backgroundColor: '#b72d34', alignItems: 'center', justifyContent: 'center' }, children: _jsx(Text, { style: { color: '#fff', fontSize: 16, fontWeight: '600' }, children: busy ? uiText("Leaving…") : uiText("Leave group") }) })] }) : _jsxs(_Fragment, { children: [_jsxs(View, { style: { alignItems: 'center', gap: 8, paddingVertical: 20 }, children: [!group && contact.avatarUrl ? _jsx(Image, { source: { uri: contact.avatarUrl }, style: { width: 64, height: 64, borderRadius: 32 } }) : _jsx(View, { style: { width: 64, height: 64, borderRadius: 32, backgroundColor: c.incoming, alignItems: 'center', justifyContent: 'center' }, children: _jsx(Text, { style: { fontSize: 26, color: accent }, children: title.slice(0, 1).toUpperCase() }) }), _jsx(Text, { style: { color: c.foreground, fontSize: 21, fontWeight: '600' }, children: title }), group && _jsx(Text, { style: { color: c.secondary, fontSize: 15 }, children: uiText('{count} members', { count: state.conversation?.memberCount ?? state.conversation?.memberIds?.length ?? 0 }) })] }), _jsx(View, { style: { flexDirection: 'row', gap: 8, paddingBottom: 12 }, children: ['media', ...(group ? ['members'] : [])].map(value => _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: value === 'media' ? uiText("Shared media") : uiText("Members"), accessibilityState: { selected: tab === value }, onPress: () => setTab(value), style: { flex: 1, minHeight: 44, alignItems: 'center', justifyContent: 'center', borderBottomWidth: 2, borderBottomColor: tab === value ? accent : 'transparent' }, children: _jsx(Text, { style: { color: tab === value ? accent : c.secondary, fontSize: 16, fontWeight: '600' }, children: value === 'media' ? uiText("Shared media") : uiText("Members") }) }, value)) }), tab === 'media' ? _jsx(FlatList, { data: messages, keyExtractor: m => m.id, style: { flex: 1 }, ListFooterComponent: footer, ListEmptyComponent: !busy && !error ? _jsx(Text, { style: { color: c.secondary, padding: 16, textAlign: 'center' }, children: state.sharedMediaAvailable ? uiText("No shared photos, videos, files or voice messages.") : uiText("Shared media is unavailable for this integration.") }) : null, renderItem: ({ item }) => _jsxs(Pressable, { accessibilityRole: "button", accessibilityLabel: uiText('Open {name}', { name: item.media?.fileName ?? uiText('Attachment') }), disabled: !props.openAttachment, onPress: () => { pending.current = () => { void props.openAttachment?.(item).catch(() => { }); }; setVisible(false); }, style: { minHeight: 76, flexDirection: 'row', alignItems: 'center', gap: 12, paddingVertical: 8, borderBottomWidth: 1, borderBottomColor: '#ffffff16' }, children: [_jsx(MediaThumbnail, { message: item, preview: props.attachmentPreview }), _jsxs(View, { style: { flex: 1, minWidth: 0, gap: 4 }, children: [_jsx(Text, { numberOfLines: 2, style: { color: c.foreground, fontSize: 16 }, children: item.media?.fileName ?? ({ image: 'Photo', video: 'Video', voice: 'Voice message', document: 'File' }[item.kind]) }), _jsxs(Text, { style: { color: c.secondary, fontSize: 13 }, children: [item.senderId === userId ? uiText("You") : participants[item.senderId]?.name ?? (!group ? contact.name : 'Member'), " \u00B7 ", item.media?.durationMs ? duration(item.media.durationMs) : fileSize(item.media?.byteSize), " \u00B7 ", new Date(item.createdAt).toLocaleDateString(uiLocale)] })] }), _jsx(MessageIcon, { name: "chevron-right", color: c.secondary, size: 20 })] }) }) : _jsx(FlatList, { data: members, keyExtractor: m => m.userId, style: { flex: 1 }, ListFooterComponent: footer, renderItem: ({ item }) => _jsxs(View, { style: { minHeight: 56, flexDirection: 'row', alignItems: 'center', gap: 12, borderBottomWidth: 1, borderBottomColor: '#ffffff16' }, children: [participants[item.userId]?.avatarUrl ? _jsx(Image, { source: { uri: participants[item.userId].avatarUrl }, style: { width: 36, height: 36, borderRadius: 18 } }) : _jsx(View, { style: { width: 36, height: 36, borderRadius: 18, backgroundColor: c.incoming, alignItems: 'center', justifyContent: 'center' }, children: _jsx(Text, { style: { color: accent }, children: (participants[item.userId]?.name ?? 'Member').slice(0, 1) }) }), _jsx(Text, { style: { flex: 1, color: c.foreground, fontSize: 16 }, children: item.userId === userId ? uiText("You") : participants[item.userId]?.name ?? uiText("Member") }), state.conversation?.ownerId === item.userId && _jsx(Text, { style: { color: accent, fontSize: 13 }, children: uiText("Owner") }), !item.canSend && _jsx(Text, { style: { color: c.secondary, fontSize: 13 }, children: uiText("Read only") })] }) }), group && props.onModerate && ['owner', 'moderator'].includes(state.conversation?.roomRole ?? '') && _jsx(Pressable, { accessibilityRole: "button", onPress: () => { pending.current = props.onModerate; setVisible(false); }, style: { minHeight: 48, justifyContent: 'center', alignItems: 'center', borderTopWidth: 1, borderTopColor: '#ffffff20' }, children: _jsx(Text, { style: { color: accent, fontSize: 16 }, children: uiText('Group moderation') }) }), group && state.conversation?.managementAvailable && _jsxs(View, { style: { flexDirection: 'row', gap: 12, borderTopWidth: 1, borderTopColor: '#ffffff20' }, children: [state.conversation.ownerId === userId && props.onEditGroup && _jsx(Pressable, { accessibilityRole: "button", onPress: () => { pending.current = props.onEditGroup; setVisible(false); }, style: { flex: 1, minHeight: 48, justifyContent: 'center', alignItems: 'center' }, children: _jsx(Text, { style: { color: accent, fontSize: 16 }, children: uiText("Edit group") }) }), _jsx(Pressable, { accessibilityRole: "button", onPress: () => { setError(''); setLeaving(true); }, style: { flex: 1, minHeight: 48, justifyContent: 'center', alignItems: 'center' }, children: _jsx(Text, { style: { color: '#ff8282', fontSize: 16 }, children: uiText("Leave group") }) })] })] }) });
88
+ } }, children: leaving ? _jsxs(View, { style: { gap: 16, paddingTop: 12 }, children: [_jsxs(Text, { style: { color: c.secondary, fontSize: 16, lineHeight: 23 }, children: [uiText("You will stop receiving this group’s messages."), state.conversation?.ownerId === userId ? ' ' + uiText("Ownership will pass to another member.") : ''] }), !!error && _jsx(Text, { accessibilityRole: "alert", style: { color: c.foreground }, children: error }), _jsx(Pressable, { accessibilityRole: "button", disabled: busy, onPress: () => void leave(), style: { minHeight: 48, borderRadius: 12, backgroundColor: '#b72d34', alignItems: 'center', justifyContent: 'center' }, children: _jsx(Text, { style: { color: '#fff', fontSize: 16, fontWeight: '600' }, children: busy ? uiText("Leaving…") : uiText("Leave group") }) })] }) : _jsxs(_Fragment, { children: [_jsxs(View, { style: { alignItems: 'center', gap: 8, paddingVertical: 20 }, children: [!group && contact.avatarUrl ? _jsx(Image, { source: { uri: contact.avatarUrl }, style: { width: 64, height: 64, borderRadius: 32 } }) : _jsx(View, { style: { width: 64, height: 64, borderRadius: 32, backgroundColor: c.incoming, alignItems: 'center', justifyContent: 'center' }, children: _jsx(Text, { style: { fontSize: 26, color: accent }, children: title.slice(0, 1).toUpperCase() }) }), _jsx(Text, { style: { color: c.foreground, fontSize: 21, fontWeight: '600' }, children: title }), group && _jsx(Text, { style: { color: c.secondary, fontSize: 15 }, children: uiText('{count} members', { count: state.conversation?.memberCount ?? state.conversation?.memberIds?.length ?? 0 }) })] }), _jsx(View, { style: { flexDirection: 'row', gap: 8, paddingBottom: 12 }, children: ['profile', ...(state.sharedMediaAvailable ? ['media'] : []), ...(group ? ['members'] : [])].map(value => _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: value === 'profile' ? uiText('Profile') : value === 'media' ? uiText("Shared media") : uiText("Members"), accessibilityState: { selected: tab === value }, onPress: () => setTab(value), style: { flex: 1, minHeight: 44, alignItems: 'center', justifyContent: 'center', borderBottomWidth: 2, borderBottomColor: tab === value ? accent : 'transparent' }, children: _jsx(Text, { style: { color: tab === value ? accent : c.secondary, fontSize: 16, fontWeight: '600' }, children: value === 'profile' ? uiText('Profile') : value === 'media' ? uiText("Shared media") : uiText("Members") }) }, value)) }), tab === 'profile' ? _jsxs(View, { style: { flex: 1, gap: 12 }, children: [state.sharedMediaAvailable && _jsxs(Pressable, { accessibilityRole: "button", onPress: () => setTab('media'), style: { minHeight: 48, flexDirection: 'row', alignItems: 'center', gap: 12 }, children: [_jsx(MessageIcon, { name: "image", size: 22, color: accent }), _jsx(Text, { style: { color: c.foreground, fontSize: 17 }, children: uiText('Shared media') })] }), props.onOptions && _jsxs(Pressable, { accessibilityRole: "button", onPress: () => { pending.current = props.onOptions; setVisible(false); }, style: { minHeight: 48, flexDirection: 'row', alignItems: 'center', gap: 12 }, children: [_jsx(MessageIcon, { name: "settings", size: 22, color: accent }), _jsx(Text, { style: { color: c.foreground, fontSize: 17 }, children: uiText('Chat options') })] })] }) : tab === 'media' ? _jsx(FlatList, { data: messages, keyExtractor: m => m.id, style: { flex: 1 }, ListFooterComponent: footer, ListEmptyComponent: !busy && !error ? _jsx(Text, { style: { color: c.secondary, padding: 16, textAlign: 'center' }, children: state.sharedMediaAvailable ? uiText("No shared photos, videos, files or voice messages.") : uiText("Shared media is unavailable for this integration.") }) : null, renderItem: ({ item }) => _jsxs(Pressable, { accessibilityRole: "button", accessibilityLabel: uiText('Open {name}', { name: item.media?.fileName ?? uiText('Attachment') }), disabled: !props.openAttachment, onPress: () => { pending.current = () => { void props.openAttachment?.(item).catch(() => { }); }; setVisible(false); }, style: { minHeight: 76, flexDirection: 'row', alignItems: 'center', gap: 12, paddingVertical: 8, borderBottomWidth: 1, borderBottomColor: c.foreground + '16' }, children: [_jsx(MediaThumbnail, { message: item, preview: props.attachmentPreview }), _jsxs(View, { style: { flex: 1, minWidth: 0, gap: 4 }, children: [_jsx(Text, { numberOfLines: 2, style: { color: c.foreground, fontSize: 16 }, children: item.media?.fileName ?? ({ image: 'Photo', video: 'Video', voice: 'Voice message', document: 'File' }[item.kind]) }), _jsxs(Text, { style: { color: c.secondary, fontSize: 13 }, children: [item.senderId === userId ? uiText("You") : participants[item.senderId]?.name ?? (!group ? contact.name : 'Member'), " \u00B7 ", item.media?.durationMs ? duration(item.media.durationMs) : fileSize(item.media?.byteSize), " \u00B7 ", new Date(item.createdAt).toLocaleDateString(uiLocale)] })] }), _jsx(MessageIcon, { name: "chevron-right", color: c.secondary, size: 20 })] }) }) : _jsx(FlatList, { data: members, keyExtractor: m => m.userId, style: { flex: 1 }, ListFooterComponent: footer, renderItem: ({ item }) => _jsxs(View, { style: { minHeight: 56, flexDirection: 'row', alignItems: 'center', gap: 12, borderBottomWidth: 1, borderBottomColor: c.foreground + '16' }, children: [participants[item.userId]?.avatarUrl ? _jsx(Image, { source: { uri: participants[item.userId].avatarUrl }, style: { width: 36, height: 36, borderRadius: 18 } }) : _jsx(View, { style: { width: 36, height: 36, borderRadius: 18, backgroundColor: c.incoming, alignItems: 'center', justifyContent: 'center' }, children: _jsx(Text, { style: { color: accent }, children: (participants[item.userId]?.name ?? 'Member').slice(0, 1) }) }), _jsx(Text, { style: { flex: 1, color: c.foreground, fontSize: 16 }, children: item.userId === userId ? uiText("You") : participants[item.userId]?.name ?? uiText("Member") }), state.conversation?.ownerId === item.userId && _jsx(Text, { style: { color: accent, fontSize: 13 }, children: uiText("Owner") }), !item.canSend && _jsx(Text, { style: { color: c.secondary, fontSize: 13 }, children: uiText("Read only") })] }) }), group && props.onModerate && ['owner', 'moderator'].includes(state.conversation?.roomRole ?? '') && _jsx(Pressable, { accessibilityRole: "button", onPress: () => { pending.current = props.onModerate; setVisible(false); }, style: { minHeight: 48, justifyContent: 'center', alignItems: 'center', borderTopWidth: 1, borderTopColor: c.foreground + '20' }, children: _jsx(Text, { style: { color: accent, fontSize: 16 }, children: uiText('Group moderation') }) }), group && state.conversation?.managementAvailable && _jsxs(View, { style: { flexDirection: 'row', gap: 12, borderTopWidth: 1, borderTopColor: c.foreground + '20' }, children: [state.conversation.ownerId === userId && props.onEditGroup && _jsx(Pressable, { accessibilityRole: "button", onPress: () => { pending.current = props.onEditGroup; setVisible(false); }, style: { flex: 1, minHeight: 48, justifyContent: 'center', alignItems: 'center' }, children: _jsx(Text, { style: { color: accent, fontSize: 16 }, children: uiText("Edit group") }) }), _jsx(Pressable, { accessibilityRole: "button", onPress: () => { setError(''); setLeaving(true); }, style: { flex: 1, minHeight: 48, justifyContent: 'center', alignItems: 'center' }, children: _jsx(Text, { style: { color: c.danger, fontSize: 16 }, children: uiText("Leave group") }) })] })] }) });
87
89
  }
@@ -0,0 +1,22 @@
1
+ import { type MessagingAudioSession } from './expo-media.js';
2
+ /** Standard ExpoMessagingScreen connection for an already accepted Bridge friend. */
3
+ export declare function createExpoBridgeMessenger(options: {
4
+ url: string;
5
+ userId: string;
6
+ connectionId: string;
7
+ getAccessToken: () => Promise<string>;
8
+ fetch?: typeof fetch;
9
+ namespace?: string;
10
+ persistence?: false;
11
+ audioSession?: MessagingAudioSession;
12
+ isCallActive?: () => boolean;
13
+ }): {
14
+ client: import("@robono/messaging").MessagingClient;
15
+ storage: import("./media-controller.js").MessagingMediaStorage;
16
+ audioSession: MessagingAudioSession;
17
+ conversationId: string;
18
+ open: () => Promise<void>;
19
+ handlePush: (payload: unknown) => Promise<boolean>;
20
+ signOut: () => Promise<void>;
21
+ dispose: () => void;
22
+ };
@@ -0,0 +1,29 @@
1
+ import { bridgeMessengerFetch, refreshBridgeMessengerFromPush } from '@robono/messaging';
2
+ import { createExpoMessagingClient, expoOutbox } from './expo-outbox.js';
3
+ import { createExpoMessagingStorage, createExpoMessagingAudioSession } from './expo-media.js';
4
+ /** Standard ExpoMessagingScreen connection for an already accepted Bridge friend. */
5
+ export function createExpoBridgeMessenger(options) {
6
+ const transportFetch = bridgeMessengerFetch(options.connectionId, options.fetch);
7
+ const client = createExpoMessagingClient({ ...options, fetch: transportFetch, namespace: (options.namespace ?? '') + ':bridge:' + options.connectionId });
8
+ const storage = createExpoMessagingStorage({ url: options.url, getAccessToken: options.getAccessToken, fetch: transportFetch });
9
+ const outgoing = expoOutbox(client);
10
+ if (outgoing)
11
+ client.setRecoveryAdapter(worker => {
12
+ const abort = new AbortController(), conversationId = worker.getSnapshot().conversationId;
13
+ const release = worker.setAttachmentPreparer(async (content) => {
14
+ if (!content.media || content.kind === 'text' || content.kind === 'poll')
15
+ throw Error('The saved attachment is unavailable.');
16
+ const file = await outgoing.file(conversationId, content.media.assetId);
17
+ if (!file)
18
+ throw Error('The saved attachment is missing. Choose it again.');
19
+ const media = await storage.upload(file, { conversationId, uploadId: content.media.assetId, kind: content.kind, signal: abort.signal, onProgress: () => { } });
20
+ return { ...content, media };
21
+ });
22
+ return () => { abort.abort(); release(); };
23
+ });
24
+ const audioSession = options.audioSession ?? createExpoMessagingAudioSession({ isCallActive: options.isCallActive });
25
+ return { client, storage, audioSession, conversationId: options.connectionId,
26
+ open: () => client.open(options.connectionId),
27
+ handlePush: (payload) => refreshBridgeMessengerFromPush(client, options.connectionId, payload),
28
+ signOut: () => client.signOut(), dispose: () => client.dispose(), };
29
+ }
@@ -1,9 +1,9 @@
1
1
  import * as FS from 'expo-file-system/legacy';
2
2
  import * as Crypto from 'expo-crypto';
3
3
  import { MessagingHistoryCache } from '@robono/messaging';
4
+ import { storageDigest as digest } from './expo-storage-digest.js';
4
5
  /** App-private recent history; no downloaded attachments or access tokens. */
5
6
  export function createExpoMessagingHistory(endpoint, userId, namespace = 'default') {
6
- const digest = (value) => Crypto.digestStringAsync(Crypto.CryptoDigestAlgorithm.SHA256, value);
7
7
  const directory = async () => {
8
8
  if (!FS.documentDirectory)
9
9
  throw Error('Offline history storage is unavailable.');
@@ -327,7 +327,7 @@ export function createExpoMessagingStorage(options) {
327
327
  check(context.signal);
328
328
  if (message.deleted)
329
329
  throw Error('This attachment is no longer available.');
330
- if (options.streaming === false || !['voice', 'video'].includes(message.kind) || !message.media?.assetId.startsWith('robono-r2:'))
330
+ if (options.streaming === false || !['voice', 'video'].includes(message.kind) || !['robono-r2:', 'bridge:'].some(prefix => message.media?.assetId.startsWith(prefix)))
331
331
  return null;
332
332
  const plan = await playbackPlan(message, context.signal);
333
333
  // The native player requests byte ranges directly from the same private,
@@ -392,7 +392,7 @@ export function createExpoMessagingStorage(options) {
392
392
  if (!plan)
393
393
  return null;
394
394
  const media = plan.media;
395
- if (media?.assetId !== message.media?.assetId || media?.mimeType !== 'image/jpeg' || !Number.isInteger(media.byteSize) || media.byteSize < 1 || media.byteSize > 131072)
395
+ if (media?.assetId !== message.media?.assetId || media?.mimeType !== 'image/jpeg' || !Number.isInteger(media.byteSize) || media.byteSize < 1 || media.byteSize > (message.media?.assetId.startsWith('bridge:') ? 204800 : 131072))
396
396
  throw Error('Invalid attachment preview.');
397
397
  const path = await cachePath('preview.jpg');
398
398
  try {
@@ -11,7 +11,7 @@ import { View, AppState } from 'react-native';
11
11
  import { createExpoMaps, RobonoMaps } from '@robono/location-react-native/expo';
12
12
  import { createExpoMessagingExtras } from './expo-extras.js';
13
13
  import { connectExpoMessagingNotifications } from './expo-notifications.js';
14
- import { useMemo, useLayoutEffect, useEffect, useState, useSyncExternalStore } from 'react';
14
+ import { useMemo, useLayoutEffect, useEffect, useRef, useState, useSyncExternalStore } from 'react';
15
15
  import { MessagingAvailabilityClient, connectHostedRobono, createMessagingTransport, defaultMessagingSettings, MessagingInboxClient } from '@robono/messaging';
16
16
  import { ExpoMessagingScreen } from './expo-screen.js';
17
17
  import { createExpoMessagingClient, expoOutbox } from './expo-outbox.js';
@@ -135,7 +135,8 @@ export async function createHostedExpoMessenger(options) {
135
135
  export function ExpoMessenger(props) {
136
136
  return _jsx(RobonoLocaleProvider, { value: props.interfaceLocale, children: _jsx(ExpoMessengerContent, { ...props }) });
137
137
  }
138
- function ExpoMessengerContent({ inbox, contacts = {}, initialConversation, selectedConversation, onSelectConversation, notifications, maps, calling, ...props }) {
138
+ const emptyContacts = Object.freeze({});
139
+ function ExpoMessengerContent({ inbox, contacts = emptyContacts, initialConversation, selectedConversation, onSelectConversation, notifications, maps, calling, ...props }) {
139
140
  const inboxMemory = useMemo(createInboxViewMemory, [inbox, props.userId]);
140
141
  const { configuration: mapsLocale } = useRobonoLocale();
141
142
  const callState = useExpoMessengerCalling(calling);
@@ -164,6 +165,14 @@ function ExpoMessengerContent({ inbox, contacts = {}, initialConversation, selec
164
165
  const setSelected = (row) => { setInternal(row); onSelectConversation?.(row); };
165
166
  const [showMaps, setShowMaps] = useState(false), mapConnection = useMessengerMaps(maps), mapsAvailable = mapConnection.available;
166
167
  const inboxState = useSyncExternalStore(inbox.subscribe, inbox.getSnapshot, inbox.getSnapshot);
168
+ const selectedId = useRef(selected?.id);
169
+ selectedId.current = selected?.id;
170
+ const conversationActions = selected && inboxState.inboxActionsAvailable ? {
171
+ muted: (inboxState.conversations.find(row => row.id === selected.id) ?? selected).muted === true,
172
+ setMuted: async (muted) => { await inbox.setMuted(selected.id, muted); },
173
+ deleteConversation: async () => { const row = inbox.getSnapshot().conversations.find(row => row.id === selected.id) ?? selected; await inbox.deleteConversation(row); await props.client.forgetConversation(row.id); if (selectedId.current === row.id)
174
+ setSelected(null); },
175
+ } : props.conversationActions;
167
176
  const open = (row, messageId) => {
168
177
  setShowMaps(false);
169
178
  setSelected(row);
@@ -174,6 +183,7 @@ function ExpoMessengerContent({ inbox, contacts = {}, initialConversation, selec
174
183
  open(row, message); }).catch(() => { }); }, [notifications, inbox]);
175
184
  const notificationAccount = notifications ? { name: props.account?.name ?? 'Your account', ...props.account, onEnableNotifications: () => notifications.enable() } : props.account;
176
185
  const account = calling?.deviceCheck ? { name: 'Your account', ...notificationAccount, deviceCheck: calling.deviceCheck, renderCallPreview: (stream) => renderNativeCallVideo({ stream, local: true, style: { width: '100%', height: '100%' } }) } : notificationAccount;
177
- const contact = selected?.contactId === props.userId ? { name: 'Notes to self' } : selected?.kind === 'group' ? { name: selected.name ?? 'Group' } : contacts[selected?.contactId ?? ''] ?? { name: selected?.contactId ?? 'Chat' };
178
- return _jsxs(View, { style: { flex: 1, minHeight: 0 }, children: [_jsx(MessengerMapsNotice, { error: mapConnection.error, retry: mapConnection.retry }), showMaps && maps ? _jsx(RobonoMaps, { interfaceLocale: mapsLocale, workspace: maps, contacts: contacts, onClose: () => setShowMaps(false) }) : _jsx(ExpoMessagingScreen, { ...props, account: account, contact: contact, participants: props.participants ?? contacts, extras: selected ? props.extras : undefined, callActions: selected && selected.contactId !== props.userId ? { ...autoCalls, ...props.callActions, phoneNumber: contacts[selected.contactId ?? '']?.phoneNumber ?? props.callActions?.phoneNumber } : undefined, onBack: () => { props.client.stop(); setSelected(null); void inbox.refresh().catch(() => { }); }, renderConversation: screen => selected ? _jsx(MessagingCallingScreen, { ...screen, onCall: screen.callActions?.voice, onVideoCall: screen.callActions?.video, callLabel: "Internet call", unansweredCallId: callState.unanswered?.conversationId === selected.id ? callState.unanswered.id : undefined, onDismissCallMessage: calling?.dismissUnanswered }) : _jsxs(MessagingProvider, { ...screen, appearance: props.appearance ?? inboxState.appearance ?? undefined, children: [_jsx(MessagingInbox, { directory: props.directory, onOpenDirectoryContact: props.onOpenDirectoryContact, viewMemory: inboxMemory, client: inbox, userId: props.userId, contacts: contacts, companyName: props.companyName, appearance: props.appearance, active: props.active !== false, headerActions: _jsx(MessagingAccountMenu, { onNewConversation: props.onNewConversation, onPublicRooms: inboxState.publicRoomsAvailable ? () => setPublicRooms(true) : undefined, onMaps: mapsAvailable ? () => setShowMaps(true) : undefined, onNewGroup: inboxState.groupCreationAvailable ? () => setNewGroup(true) : undefined }), onSelect: open, onDeleted: id => props.client.forgetConversation(id) }), publicRooms && _jsx(MessagingPublicRooms, { inbox: inbox, accent: (props.appearance ?? inboxState.appearance ?? defaultMessagingSettings().appearance).colors.accent, createRequestId: () => props.client.createForwardId(), onClose: () => setPublicRooms(false), onJoined: (id, name) => { setPublicRooms(false); open(inbox.getSnapshot().conversations.find(c => c.id === id) ?? { id, kind: 'group', name, contactId: null, lastMessage: null, unreadCount: 0, canSend: true }); } }), newGroup && _jsx(MessagingGroupEditor, { client: props.client, inbox: inbox, userId: props.userId, contacts: contacts, groups: inboxState.groups, accent: (props.appearance ?? inboxState.appearance ?? defaultMessagingSettings().appearance).colors.accent, onClose: () => setNewGroup(false), onSaved: (id, name) => { setNewGroup(false); const row = inbox.getSnapshot().conversations.find(c => c.id === id) ?? { id, kind: 'group', name, contactId: null, lastMessage: null, unreadCount: 0, canSend: true }; open(row); } }), props.inboxOverlay] }) }), _jsx(ExpoMessengerCalls, { calling: calling, state: callState })] });
186
+ const knownContact = contacts[selected?.contactId ?? ''];
187
+ const contact = useMemo(() => selected?.contactId === props.userId ? { name: 'Notes to self' } : selected?.kind === 'group' ? { name: selected.name ?? 'Group' } : knownContact ?? { name: selected?.contactId ?? 'Chat' }, [selected?.contactId, selected?.kind, selected?.name, props.userId, knownContact]);
188
+ return _jsxs(View, { style: { flex: 1, minHeight: 0 }, children: [_jsx(MessengerMapsNotice, { error: mapConnection.error, retry: mapConnection.retry }), showMaps && maps ? _jsx(RobonoMaps, { interfaceLocale: mapsLocale, workspace: maps, contacts: contacts, onClose: () => setShowMaps(false) }) : _jsx(ExpoMessagingScreen, { ...props, conversationActions: conversationActions, account: account, contact: contact, participants: props.participants ?? contacts, extras: selected ? props.extras : undefined, callActions: selected && selected.contactId !== props.userId ? { ...autoCalls, ...props.callActions, phoneNumber: contacts[selected.contactId ?? '']?.phoneNumber ?? props.callActions?.phoneNumber } : undefined, onBack: () => { props.client.stop(); setSelected(null); void inbox.refresh().catch(() => { }); }, renderConversation: screen => selected ? _jsx(MessagingCallingScreen, { ...screen, onCall: screen.callActions?.voice, onVideoCall: screen.callActions?.video, callLabel: "Internet call", unansweredCallId: callState.unanswered?.conversationId === selected.id ? callState.unanswered.id : undefined, onDismissCallMessage: calling?.dismissUnanswered }) : _jsxs(MessagingProvider, { ...screen, appearance: props.appearance ?? inboxState.appearance ?? undefined, children: [_jsx(MessagingInbox, { directory: props.directory, onOpenDirectoryContact: props.onOpenDirectoryContact, viewMemory: inboxMemory, client: inbox, userId: props.userId, contacts: contacts, companyName: props.companyName, appearance: props.appearance, active: props.active !== false, headerActions: _jsx(MessagingAccountMenu, { onNewConversation: props.onNewConversation, onPublicRooms: inboxState.publicRoomsAvailable ? () => setPublicRooms(true) : undefined, onMaps: mapsAvailable ? () => setShowMaps(true) : undefined, onNewGroup: inboxState.groupCreationAvailable ? () => setNewGroup(true) : undefined }), onSelect: open, onDeleted: id => props.client.forgetConversation(id) }), publicRooms && _jsx(MessagingPublicRooms, { inbox: inbox, accent: (props.appearance ?? inboxState.appearance ?? defaultMessagingSettings().appearance).colors.accent, createRequestId: () => props.client.createForwardId(), onClose: () => setPublicRooms(false), onJoined: (id, name) => { setPublicRooms(false); open(inbox.getSnapshot().conversations.find(c => c.id === id) ?? { id, kind: 'group', name, contactId: null, lastMessage: null, unreadCount: 0, canSend: true }); } }), newGroup && _jsx(MessagingGroupEditor, { client: props.client, inbox: inbox, userId: props.userId, contacts: contacts, groups: inboxState.groups, accent: (props.appearance ?? inboxState.appearance ?? defaultMessagingSettings().appearance).colors.accent, onClose: () => setNewGroup(false), onSaved: (id, name) => { setNewGroup(false); const row = inbox.getSnapshot().conversations.find(c => c.id === id) ?? { id, kind: 'group', name, contactId: null, lastMessage: null, unreadCount: 0, canSend: true }; open(row); } }), props.inboxOverlay] }) }), _jsx(ExpoMessengerCalls, { calling: calling, state: callState })] });
179
189
  }
@@ -4,9 +4,9 @@ import { MessagingClient, createMessagingTransport } from '@robono/messaging';
4
4
  import { NativeMessagingOutbox, emptyNativeDraft } from './native-outbox.js';
5
5
  import { createExpoMessagingHistory } from './expo-history.js';
6
6
  import { ExpoSavedMessages, bindExpoSaved } from './expo-saved.js';
7
+ import { storageDigest as digest } from './expo-storage-digest.js';
7
8
  const stores = new WeakMap();
8
9
  export const expoOutbox = (client) => stores.get(client);
9
- const digest = (value) => Crypto.digestStringAsync(Crypto.CryptoDigestAlgorithm.SHA256, value);
10
10
  const root = async (scope) => { if (!FS.documentDirectory)
11
11
  throw Error('Private app storage is unavailable.'); return FS.documentDirectory + 'robono-outgoing/' + await digest(scope) + '/'; };
12
12
  const folder = async (scope, cid) => (await root(scope)) + await digest(cid) + '/';
@@ -544,13 +544,21 @@ function ExpoMessagingScreenContent({ storage, audioSession, renderConversation,
544
544
  useEffect(() => saved?.bindDownload(async (m) => { const device = createExpoMessagingDevice(audioSession), file = await storage.download(m, { signal: AbortSignal.timeout(120000), onProgress: () => { } }); return { file, release: () => device.remove(file) }; }), [saved, storage, audioSession]);
545
545
  const attachmentPreview = useCallback(async (m, options) => { if (m.media && m.kind !== 'text' && m.kind !== 'poll')
546
546
  await restore(m.media, m.kind); return thumbnails.preview(m, options); }, [restore, thumbnails]);
547
+ const defaultQuoteReady = useCallback(() => { if (Platform.OS === 'android')
548
+ Vibration.vibrate(8);
549
+ else if (Platform.OS === 'ios')
550
+ void Haptics.selectionAsync().catch(() => { }); }, []);
551
+ const defaultCopyText = useCallback(async (text) => { await Clipboard.setStringAsync(text); }, []);
552
+ const components = useMemo(() => ({ PrivacyLayer: ExpoMessagingPrivacyLayer, SocialPlayer, TranslationVoice, VoiceMessage: InlineVoice, VoiceComposer: InlineComposer, VoiceAttachment, ...props.components }), [SocialPlayer, TranslationVoice, InlineVoice, InlineComposer, VoiceAttachment, props.components]);
553
+ const openAttachment = useCallback(async (m) => { const intent = ++openingIntent.current; await stopVoicePlayers(); if (intent !== openingIntent.current)
554
+ return; opened.current = { messageId: m.id, kind: m.kind, started: Date.now(), reported: new Set() }; message.current = m; const draft = m.media && m.kind !== 'text' && m.kind !== 'poll' ? await restore(m.media, m.kind) : undefined; if (draft && m.kind !== 'text' && m.kind !== 'poll')
555
+ await controller.previewLocal(await copyMessagingCache(draft), m.kind);
556
+ else
557
+ await controller.open(m); }, [restore, controller]);
547
558
  const screenProps = { ...props, requestedMessageAction,
548
- onQuoteReady: props.onQuoteReady ?? (() => { if (Platform.OS === 'android')
549
- Vibration.vibrate(8);
550
- else if (Platform.OS === 'ios')
551
- void Haptics.selectionAsync().catch(() => { }); }),
552
- copyText: props.copyText ?? (async (text) => { await Clipboard.setStringAsync(text); }),
553
- components: { PrivacyLayer: ExpoMessagingPrivacyLayer, SocialPlayer, TranslationVoice, VoiceMessage: InlineVoice, VoiceComposer: InlineComposer, VoiceAttachment, ...props.components },
559
+ onQuoteReady: props.onQuoteReady ?? defaultQuoteReady,
560
+ copyText: props.copyText ?? defaultCopyText,
561
+ components,
554
562
  attachmentPreview: props.attachmentPreview ?? attachmentPreview,
555
563
  prepareAttachment: prepare,
556
564
  retainDraftAttachments: !!outbox,
@@ -581,11 +589,7 @@ function ExpoMessagingScreenContent({ storage, audioSession, renderConversation,
581
589
  }
582
590
  return media;
583
591
  },
584
- openAttachment: async (m) => { const intent = ++openingIntent.current; await stopVoicePlayers(); if (intent !== openingIntent.current)
585
- return; opened.current = { messageId: m.id, kind: m.kind, started: Date.now(), reported: new Set() }; message.current = m; const draft = m.media && m.kind !== 'text' && m.kind !== 'poll' ? await restore(m.media, m.kind) : undefined; if (draft && m.kind !== 'text' && m.kind !== 'poll')
586
- await controller.previewLocal(await copyMessagingCache(draft), m.kind);
587
- else
588
- await controller.open(m); },
592
+ openAttachment,
589
593
  openSavedAttachment: async (record) => { if (!saved || record.message.kind === 'text' || record.message.kind === 'poll')
590
594
  throw Error('This saved attachment is unavailable.'); const intent = ++openingIntent.current; await stopVoicePlayers(); const file = await copyMessagingCache(await saved.file(record)); if (intent !== openingIntent.current) {
591
595
  await createExpoMessagingDevice(audioSession).remove(file);
@@ -0,0 +1 @@
1
+ export declare const storageDigest: (value: string) => Promise<string>;
@@ -0,0 +1,5 @@
1
+ import * as Crypto from 'expo-crypto';
2
+ import { cacheStorageDigest } from './storage-digest-cache.js';
3
+ // Hashes are deterministic. Reuse them across outgoing and recent-history
4
+ // operations, while every operation still reads the current private files.
5
+ export const storageDigest = cacheStorageDigest(value => Crypto.digestStringAsync(Crypto.CryptoDigestAlgorithm.SHA256, value));
package/dist/expo.d.ts CHANGED
@@ -3,3 +3,4 @@ export { ExpoMessenger, createExpoMessenger, createHostedExpoMessenger, type Exp
3
3
  export { MessagingPopup } from './popup.js';
4
4
  export { MessagingConnectionState, type MessagingConnectionStateProps, MessagingSignIn, MessagingPhoneInput, MessagingChoicePicker, type MessagingSignInProps, type MessagingPhoneInputProps, type MessagingChoice, type MessagingChoicePickerProps } from './sign-in.js';
5
5
  export type { MessagingDirectoryContact, MessagingDirectoryOptions } from './contact-directory.js';
6
+ export { createExpoBridgeMessenger } from './expo-bridge.js';
package/dist/expo.js CHANGED
@@ -2,3 +2,4 @@ export * from './expo-screen.js';
2
2
  export { ExpoMessenger, createExpoMessenger, createHostedExpoMessenger } from './expo-messenger.js';
3
3
  export { MessagingPopup } from './popup.js';
4
4
  export { MessagingConnectionState, MessagingSignIn, MessagingPhoneInput, MessagingChoicePicker } from './sign-in.js';
5
+ export { createExpoBridgeMessenger } from './expo-bridge.js';
package/dist/extras.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { MessagingStyleScreen } from '@robono/messaging';
1
2
  import React, { type ReactNode } from 'react';
2
3
  import { type ChatExtra, type ChatTracker, type ChatDestination, type MessagingExtrasClient } from '@robono/messaging';
3
4
  /** Render every supplied tracker with an avatar pin and a speed/ETA callout.
@@ -21,7 +22,8 @@ export declare const privacyReadingStripHeight = 74;
21
22
  /** Messenger's fixed 74px reading strip. Scrolling moves messages through it. */
22
23
  export declare function MessagingPrivacyLayer({ children, enabled, background }: PrivacyLayerProps): React.JSX.Element;
23
24
  export declare function openChatAddress(address: string): Promise<void>;
24
- export declare function ExtraPopup({ title, onClose, background, foreground, children, expanded }: {
25
+ export declare function ExtraPopup({ screen, title, onClose, background, foreground, children, expanded }: {
26
+ screen?: MessagingStyleScreen;
25
27
  title: string;
26
28
  onClose: () => void;
27
29
  background: string;